From 55c03cff7fd73349473cc0a964df9d55b312dbbc Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 21 May 2012 17:12:12 -0700 Subject: staging: comedi: remove private header comedi_pci.h Remove the private header, comedi_pci.h, by moving the two helper functions into divers.c and providing the prototypes in comedidev.h. This allows the comedi_pci_enable/disable helper functions to be shared instead of having an inline version in every comedi pci driver. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 134be93..9cd2b51 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -40,6 +40,7 @@ #include #include #include +#include #include "comedi.h" @@ -180,7 +181,6 @@ struct comedi_async { unsigned int x); }; -struct pci_dev; struct usb_interface; struct comedi_driver { @@ -310,7 +310,8 @@ int comedi_driver_unregister(struct comedi_driver *); module_driver(__comedi_driver, comedi_driver_register, \ comedi_driver_unregister) -struct pci_driver; +int comedi_pci_enable(struct pci_dev *, const char *); +void comedi_pci_disable(struct pci_dev *); int comedi_pci_driver_register(struct comedi_driver *, struct pci_driver *); void comedi_pci_driver_unregister(struct comedi_driver *, struct pci_driver *); diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 1c3d638..7289dcb 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -908,6 +908,40 @@ static void comedi_auto_unconfig(struct device *hardware_device) comedi_free_board_minor(minor); } +/** + * comedi_pci_enable() - Enable the PCI device and request the regions. + * @pdev: pci_dev struct + * @res_name: name for the requested reqource + */ +int comedi_pci_enable(struct pci_dev *pdev, const char *res_name) +{ + int rc; + + rc = pci_enable_device(pdev); + if (rc < 0) + return rc; + + rc = pci_request_regions(pdev, res_name); + if (rc < 0) + pci_disable_device(pdev); + + return rc; +} +EXPORT_SYMBOL_GPL(comedi_pci_enable); + +/** + * comedi_pci_disable() - Release the regions and disable the PCI device. + * @pdev: pci_dev struct + * + * This must be matched with a previous successful call to comedi_pci_enable(). + */ +void comedi_pci_disable(struct pci_dev *pdev) +{ + pci_release_regions(pdev); + pci_disable_device(pdev); +} +EXPORT_SYMBOL_GPL(comedi_pci_disable); + static int comedi_old_pci_auto_config(struct pci_dev *pcidev, struct comedi_driver *driver) { diff --git a/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h b/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h index 35a3ea1..d70ac8b 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h @@ -22,8 +22,6 @@ #include "../../comedidev.h" -#include "../comedi_pci.h" - #ifdef PCI_SUPPORT_VER1 #error No support for 2.1.55 and older #endif diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index de8c68a..2f48dc7 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -52,7 +52,6 @@ References: * options that are used with comedi_config. */ #include "../comedidev.h" -#include "comedi_pci.h" /* Board descriptions */ struct pci6208_board { diff --git a/drivers/staging/comedi/drivers/adl_pci7230.c b/drivers/staging/comedi/drivers/adl_pci7230.c index e8053bc..e7eb229 100644 --- a/drivers/staging/comedi/drivers/adl_pci7230.c +++ b/drivers/staging/comedi/drivers/adl_pci7230.c @@ -36,7 +36,6 @@ Configuration Options: #include "../comedidev.h" #include -#include "comedi_pci.h" #define PCI7230_DI 0x00 #define PCI7230_DO 0x00 diff --git a/drivers/staging/comedi/drivers/adl_pci7296.c b/drivers/staging/comedi/drivers/adl_pci7296.c index b4dae3b..bf2f7fb 100644 --- a/drivers/staging/comedi/drivers/adl_pci7296.c +++ b/drivers/staging/comedi/drivers/adl_pci7296.c @@ -37,7 +37,6 @@ Configuration Options: #include "../comedidev.h" #include -#include "comedi_pci.h" #include "8255.h" /* #include "8253.h" */ diff --git a/drivers/staging/comedi/drivers/adl_pci7432.c b/drivers/staging/comedi/drivers/adl_pci7432.c index 9cbfb61..2fc1dbb 100644 --- a/drivers/staging/comedi/drivers/adl_pci7432.c +++ b/drivers/staging/comedi/drivers/adl_pci7432.c @@ -36,7 +36,6 @@ Configuration Options: #include "../comedidev.h" #include -#include "comedi_pci.h" #define PCI7432_DI 0x00 #define PCI7432_DO 0x00 diff --git a/drivers/staging/comedi/drivers/adl_pci8164.c b/drivers/staging/comedi/drivers/adl_pci8164.c index 409ef13a..fbc859e 100644 --- a/drivers/staging/comedi/drivers/adl_pci8164.c +++ b/drivers/staging/comedi/drivers/adl_pci8164.c @@ -38,7 +38,6 @@ Configuration Options: #include #include #include "comedi_fc.h" -#include "comedi_pci.h" #include "8253.h" #define PCI8164_AXIS_X 0x00 diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c index ccfb1a5..308cca7 100644 --- a/drivers/staging/comedi/drivers/adl_pci9111.c +++ b/drivers/staging/comedi/drivers/adl_pci9111.c @@ -81,7 +81,6 @@ TODO: #include #include "8253.h" -#include "comedi_pci.h" #include "comedi_fc.h" #define PCI9111_DRIVER_NAME "adl_pci9111" diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 7864586..aa4244e 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -71,7 +71,6 @@ Configuration options: #include "amcc_s5933.h" #include "8253.h" -#include "comedi_pci.h" #include "comedi_fc.h" #define PCI_VENDOR_ID_AMCC 0x10e8 diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index de8c98c..db9f0a5 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -45,8 +45,6 @@ Configuration options: #include "../comedidev.h" -#include "comedi_pci.h" - #include "8253.h" #include "amcc_s5933.h" diff --git a/drivers/staging/comedi/drivers/adv_pci1723.c b/drivers/staging/comedi/drivers/adv_pci1723.c index 336addc..b8768b5 100644 --- a/drivers/staging/comedi/drivers/adv_pci1723.c +++ b/drivers/staging/comedi/drivers/adv_pci1723.c @@ -50,8 +50,6 @@ TODO: #include "../comedidev.h" -#include "comedi_pci.h" - #define PCI_VENDOR_ID_ADVANTECH 0x13fe /* Advantech PCI vendor ID */ /* hardware types of the cards */ diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 43a32dc..df8236c 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -33,7 +33,6 @@ Configuration options: #include -#include "comedi_pci.h" #include "8255.h" #include "8253.h" diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index c9c5d97..f6f6144 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -210,8 +210,6 @@ order they appear in the channel list. #include "../comedidev.h" -#include "comedi_pci.h" - #include "8255.h" #include "8253.h" diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c index 57ba322..6cb06ec 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236.c +++ b/drivers/staging/comedi/drivers/amplc_pc236.c @@ -56,8 +56,6 @@ unused. #include "../comedidev.h" -#include "comedi_pci.h" - #include "8255.h" #include "plx9052.h" diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index 974d745..086579f 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c @@ -46,8 +46,6 @@ The state of the outputs can be read. #include "../comedidev.h" -#include "comedi_pci.h" - #define PC263_DRIVER_NAME "amplc_pc263" #ifdef CONFIG_COMEDI_AMPLC_PC263_ISA_MODULE diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index fbf19ca..0d1f9cc 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -108,8 +108,6 @@ Caveats: #include "../comedidev.h" -#include "comedi_pci.h" - #include "comedi_fc.h" #include "8253.h" diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index d4c80b1..b05a684 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -193,7 +193,6 @@ for (or detection of) various hardware problems added by Ian Abbott. #include #include -#include "comedi_pci.h" #include "8253.h" #include "8255.h" diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index ee9e084b..7f88d08 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -77,7 +77,6 @@ analog triggering on 1602 series #include "8253.h" #include "8255.h" #include "amcc_s5933.h" -#include "comedi_pci.h" #include "comedi_fc.h" #undef CB_PCIDAS_DEBUG /* disable debugging code */ diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 9d0b875..1e30f22 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -87,7 +87,6 @@ TODO: #include #include -#include "comedi_pci.h" #include "8253.h" #include "8255.h" #include "plx9080.h" diff --git a/drivers/staging/comedi/drivers/cb_pcidda.c b/drivers/staging/comedi/drivers/cb_pcidda.c index 25ebca1..dc4cf0b 100644 --- a/drivers/staging/comedi/drivers/cb_pcidda.c +++ b/drivers/staging/comedi/drivers/cb_pcidda.c @@ -48,10 +48,8 @@ Please report success/failure with other different cards to #include "../comedidev.h" -#include "comedi_pci.h" #include "8255.h" - /* PCI vendor number of ComputerBoards */ #define PCI_VENDOR_ID_CB 0x1307 #define EEPROM_SIZE 128 /* number of entries in eeprom */ diff --git a/drivers/staging/comedi/drivers/cb_pcidio.c b/drivers/staging/comedi/drivers/cb_pcidio.c index 713132c..58d5a3d 100644 --- a/drivers/staging/comedi/drivers/cb_pcidio.c +++ b/drivers/staging/comedi/drivers/cb_pcidio.c @@ -41,7 +41,6 @@ Passing a zero for an option is the same as leaving it unspecified. /*------------------------------ HEADER FILES ---------------------------------*/ #include "../comedidev.h" -#include "comedi_pci.h" #include "8255.h" /*-------------------------- MACROS and DATATYPES -----------------------------*/ diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index 5f834d0..a06b67a 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -45,7 +45,6 @@ See http://www.mccdaq.com/PDFs/Manuals/pcim-das1602-16.pdf for more details. #include #include -#include "comedi_pci.h" #include "plx9052.h" #include "8255.h" diff --git a/drivers/staging/comedi/drivers/cb_pcimdda.c b/drivers/staging/comedi/drivers/cb_pcimdda.c index b339685..bec250b 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdda.c +++ b/drivers/staging/comedi/drivers/cb_pcimdda.c @@ -86,8 +86,6 @@ Configuration Options: #include "../comedidev.h" -#include "comedi_pci.h" - #include "8255.h" /* device ids of the cards we support -- currently only 1 card supported */ diff --git a/drivers/staging/comedi/drivers/comedi_pci.h b/drivers/staging/comedi/drivers/comedi_pci.h deleted file mode 100644 index c14a036..0000000 --- a/drivers/staging/comedi/drivers/comedi_pci.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - comedi/drivers/comedi_pci.h - Various PCI functions for drivers. - - Copyright (C) 2007 MEV Ltd. - - COMEDI - Linux Control and Measurement Device Interface - Copyright (C) 2000 David A. Schleef - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - 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., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef _COMEDI_PCI_H_ -#define _COMEDI_PCI_H_ - -#include - -/* - * Enable the PCI device and request the regions. - */ -static inline int comedi_pci_enable(struct pci_dev *pdev, const char *res_name) -{ - int rc; - - rc = pci_enable_device(pdev); - if (rc < 0) - return rc; - - rc = pci_request_regions(pdev, res_name); - if (rc < 0) - pci_disable_device(pdev); - - return rc; -} - -/* - * Release the regions and disable the PCI device. - * - * This must be matched with a previous successful call to comedi_pci_enable(). - */ -static inline void comedi_pci_disable(struct pci_dev *pdev) -{ - pci_release_regions(pdev); - pci_disable_device(pdev); -} - -#endif diff --git a/drivers/staging/comedi/drivers/contec_pci_dio.c b/drivers/staging/comedi/drivers/contec_pci_dio.c index b8bac80..2cd7407 100644 --- a/drivers/staging/comedi/drivers/contec_pci_dio.c +++ b/drivers/staging/comedi/drivers/contec_pci_dio.c @@ -36,8 +36,6 @@ Configuration Options: #include "../comedidev.h" -#include "comedi_pci.h" - enum contec_model { PIO1616L = 0, }; diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c index 696b58c..d84794c 100644 --- a/drivers/staging/comedi/drivers/daqboard2000.c +++ b/drivers/staging/comedi/drivers/daqboard2000.c @@ -118,7 +118,6 @@ Configuration options: #include #include -#include "comedi_pci.h" #include "8255.h" #define DAQBOARD2000_SUBSYSTEM_IDS2 0x00021616 /* Daqboard/2000 - 2 Dacs */ diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index 1f31943..f53e597 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -55,7 +55,6 @@ #include -#include "comedi_pci.h" #include "8255.h" #include "das08.h" diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c index 0d27326..2c1c6140 100644 --- a/drivers/staging/comedi/drivers/dt3000.c +++ b/drivers/staging/comedi/drivers/dt3000.c @@ -63,8 +63,6 @@ AO commands are not supported. #include "../comedidev.h" #include -#include "comedi_pci.h" - #define PCI_VENDOR_ID_DT 0x1116 static const struct comedi_lrange range_dt3000_ai = { 4, { diff --git a/drivers/staging/comedi/drivers/dyna_pci10xx.c b/drivers/staging/comedi/drivers/dyna_pci10xx.c index b0cec7b..9586f24 100644 --- a/drivers/staging/comedi/drivers/dyna_pci10xx.c +++ b/drivers/staging/comedi/drivers/dyna_pci10xx.c @@ -38,7 +38,6 @@ */ #include "../comedidev.h" -#include "comedi_pci.h" #include #define PCI_VENDOR_ID_DYNALOG 0x10b5 diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c b/drivers/staging/comedi/drivers/gsc_hpdi.c index 8aece08..79e22b1 100644 --- a/drivers/staging/comedi/drivers/gsc_hpdi.c +++ b/drivers/staging/comedi/drivers/gsc_hpdi.c @@ -49,7 +49,6 @@ support could be added to this driver. #include "../comedidev.h" #include -#include "comedi_pci.h" #include "plx9080.h" #include "comedi_fc.h" diff --git a/drivers/staging/comedi/drivers/icp_multi.h b/drivers/staging/comedi/drivers/icp_multi.h index 68acefe..dbf9908 100644 --- a/drivers/staging/comedi/drivers/icp_multi.h +++ b/drivers/staging/comedi/drivers/icp_multi.h @@ -11,7 +11,6 @@ #define _ICP_MULTI_H_ #include "../comedidev.h" -#include "comedi_pci.h" /****************************************************************************/ diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c index d536a11..e8dfc36 100644 --- a/drivers/staging/comedi/drivers/jr3_pci.c +++ b/drivers/staging/comedi/drivers/jr3_pci.c @@ -49,7 +49,6 @@ Devices: [JR3] PCI force sensor board (jr3_pci) #include #include #include -#include "comedi_pci.h" #include "jr3_pci.h" #define PCI_VENDOR_ID_JR3 0x1762 diff --git a/drivers/staging/comedi/drivers/ke_counter.c b/drivers/staging/comedi/drivers/ke_counter.c index 09d1918..9f92420 100644 --- a/drivers/staging/comedi/drivers/ke_counter.c +++ b/drivers/staging/comedi/drivers/ke_counter.c @@ -40,8 +40,6 @@ Kolter Electronic PCI Counter Card. #include "../comedidev.h" -#include "comedi_pci.h" - #define CNT_DRIVER_NAME "ke_counter" #define PCI_VENDOR_ID_KOLTER 0x1001 #define CNT_CARD_DEVICE_ID 0x0014 diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 8ca1b54..cb6bf8c 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -58,7 +58,6 @@ broken. #include #include -#include "comedi_pci.h" #include "me4000.h" #if 0 /* file removed due to GPL incompatibility */ diff --git a/drivers/staging/comedi/drivers/me_daq.c b/drivers/staging/comedi/drivers/me_daq.c index ffe2512..fcadb0f 100644 --- a/drivers/staging/comedi/drivers/me_daq.c +++ b/drivers/staging/comedi/drivers/me_daq.c @@ -54,8 +54,6 @@ from http://www.comedi.org #include #include "../comedidev.h" -#include "comedi_pci.h" - /*#include "me2600_fw.h" */ #define ME_DRIVER_NAME "me_daq" diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c index 13e9c80..a93166d 100644 --- a/drivers/staging/comedi/drivers/mite.c +++ b/drivers/staging/comedi/drivers/mite.c @@ -52,7 +52,6 @@ #include "mite.h" #include "comedi_fc.h" -#include "comedi_pci.h" #include "../comedidev.h" diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 1678a0c..d3e2786 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -105,7 +105,6 @@ Configuration options: #include #include "../comedidev.h" -#include "comedi_pci.h" #define DRV_NAME "rtd520" diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 7beb8f6..5160370 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -74,8 +74,6 @@ INSN_CONFIG instructions: #include "../comedidev.h" -#include "comedi_pci.h" - #include "comedi_fc.h" #include "s626.h" -- cgit v0.10.2 From 85a15d5bcab6dbae638fb51e2bc93217c7c3b23c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 21 May 2012 17:43:31 -0700 Subject: staging: comedi: dt3000: io_addr is a void __iomem * MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The io_addr variable in struct dt3k_private is an ioremap'ed pci resource and should be void __iomem * not a void *. This quiets a lot of sparse warings for the writew and readw calls like: warning: incorrect type in argument 1 (different address spaces)    expected void const volatile [noderef] *addr    got void * warning: incorrect type in argument 2 (different address spaces)    expected void volatile [noderef] *addr    got void * Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Cc: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c index 2c1c6140..af02024 100644 --- a/drivers/staging/comedi/drivers/dt3000.c +++ b/drivers/staging/comedi/drivers/dt3000.c @@ -252,7 +252,7 @@ struct dt3k_private { struct pci_dev *pci_dev; resource_size_t phys_addr; - void *io_addr; + void __iomem *io_addr; unsigned int lock; unsigned int ao_readback[2]; unsigned int ai_front; -- cgit v0.10.2 From ff450314d5ef05843d3b3bd33fc65f7aaea3b2df Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 21 May 2012 17:52:07 -0700 Subject: staging: comedi: gsc_hpdi: plx9080_iobase and hpdi_iobase are void __iomem * MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The plx9080_iobase and hpdi_iobase variables in struct hpdi_private are ioremap'ed pci resource and should be void __iomem * not void *. This quiets a lot of sparse warings for the writel and readl calls like: warning: incorrect type in argument 1 (different address spaces)    expected void const volatile [noderef] *addr    got void * warning: incorrect type in argument 2 (different address spaces)    expected void volatile [noderef] *addr    got void * Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Cc: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c b/drivers/staging/comedi/drivers/gsc_hpdi.c index 79e22b1..eeb0555 100644 --- a/drivers/staging/comedi/drivers/gsc_hpdi.c +++ b/drivers/staging/comedi/drivers/gsc_hpdi.c @@ -296,8 +296,8 @@ struct hpdi_private { resource_size_t plx9080_phys_iobase; resource_size_t hpdi_phys_iobase; /* base addresses (ioremapped) */ - void *plx9080_iobase; - void *hpdi_iobase; + void __iomem *plx9080_iobase; + void __iomem *hpdi_iobase; uint32_t *dio_buffer[NUM_DMA_BUFFERS]; /* dma buffers */ /* physical addresses of dma buffers */ dma_addr_t dio_buffer_phys_addr[NUM_DMA_BUFFERS]; @@ -363,7 +363,7 @@ static void disable_plx_interrupts(struct comedi_device *dev) static void init_plx9080(struct comedi_device *dev) { uint32_t bits; - void *plx_iobase = priv(dev)->plx9080_iobase; + void __iomem *plx_iobase = priv(dev)->plx9080_iobase; /* plx9080 dump */ DEBUG_PRINT(" plx interrupt status 0x%x\n", @@ -672,10 +672,10 @@ static void hpdi_detach(struct comedi_device *dev) if ((priv(dev)) && (priv(dev)->hw_dev)) { if (priv(dev)->plx9080_iobase) { disable_plx_interrupts(dev); - iounmap((void *)priv(dev)->plx9080_iobase); + iounmap(priv(dev)->plx9080_iobase); } if (priv(dev)->hpdi_iobase) - iounmap((void *)priv(dev)->hpdi_iobase); + iounmap(priv(dev)->hpdi_iobase); /* free pci dma buffers */ for (i = 0; i < NUM_DMA_BUFFERS; i++) { if (priv(dev)->dio_buffer[i]) @@ -902,7 +902,7 @@ static void drain_dma_buffers(struct comedi_device *dev, unsigned int channel) uint32_t next_transfer_addr; int j; int num_samples = 0; - void *pci_addr_reg; + void __iomem *pci_addr_reg; if (channel) pci_addr_reg = -- cgit v0.10.2 From 86a5eb8ccef09916e622b43f97f115c2526d7d2e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 21 May 2012 17:55:33 -0700 Subject: staging: comedi: icp_multi: io_addr is a void __iomem * MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The io_addr variable in struct dt3k_private is an ioremap'ed pci resource and should be void __iomem * not a void *. This quiets a lot of sparse warings for the writew and readw calls like: warning: incorrect type in argument 1 (different address spaces)    expected void const volatile [noderef] *addr    got void * warning: incorrect type in argument 2 (different address spaces)    expected void volatile [noderef] *addr    got void * Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/icp_multi.c b/drivers/staging/comedi/drivers/icp_multi.c index fdc596f..f870d3d 100644 --- a/drivers/staging/comedi/drivers/icp_multi.c +++ b/drivers/staging/comedi/drivers/icp_multi.c @@ -148,7 +148,7 @@ struct boardtype { struct icp_multi_private { struct pcilst_struct *card; /* pointer to card */ char valid; /* card is usable */ - void *io_addr; /* Pointer to mapped io address */ + void __iomem *io_addr; /* Pointer to mapped io address */ resource_size_t phys_iobase; /* Physical io address */ unsigned int AdcCmdStatus; /* ADC Command/Status register */ unsigned int DacCmdStatus; /* DAC Command/Status register */ -- cgit v0.10.2 From 4aa7419e082ef5ca38f8934d38fda5909a27962b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 21 May 2012 18:10:07 -0700 Subject: staging: comedi: ii_pci20kc: iobase and ioaddr are void __iomem * MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The iobase variables in struct pci20xxx_subdev_private and ioaddr variable in struct pci20xxx_private should be void __iomem * not void *. This quiets a lot of sparse warings for the writeb and readb calls like: warning: incorrect type in argument 1 (different address spaces)    expected void const volatile [noderef] *addr    got void * warning: incorrect type in argument 2 (different address spaces)    expected void volatile [noderef] *addr    got void * Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Cc: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ii_pci20kc.c b/drivers/staging/comedi/drivers/ii_pci20kc.c index f0a579a..6f69476 100644 --- a/drivers/staging/comedi/drivers/ii_pci20kc.c +++ b/drivers/staging/comedi/drivers/ii_pci20kc.c @@ -135,15 +135,15 @@ options for PCI-20341M: #define PCI20341_SCANLIST 0x80 /* Channel/Gain Scan List */ union pci20xxx_subdev_private { - void *iobase; + void __iomem *iobase; struct { - void *iobase; + void __iomem *iobase; const struct comedi_lrange *ao_range_list[2]; /* range of channels of ao module */ unsigned int last_data[2]; } pci20006; struct { - void *iobase; + void __iomem *iobase; int timebase; int settling_time; int ai_gain; @@ -152,7 +152,7 @@ union pci20xxx_subdev_private { struct pci20xxx_private { - void *ioaddr; + void __iomem *ioaddr; union pci20xxx_subdev_private subdev_private[PCI20000_MODULES]; }; @@ -210,7 +210,7 @@ static int pci20xxx_attach(struct comedi_device *dev, if (ret < 0) return ret; - devpriv->ioaddr = (void *)(unsigned long)it->options[0]; + devpriv->ioaddr = (void __iomem *)(unsigned long)it->options[0]; dev->board_name = "pci20kc"; /* Check PCI-20001 C-2A Carrier Board ID */ -- cgit v0.10.2 From 42caa910f286e2be0763a6fb8aa7a998e10c6e02 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 21 May 2012 18:21:39 -0700 Subject: staging: comedi: s626: base_addr is a void __iomem * MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The base_addr variable in struct s626_private is an ioremap'ed pci resource and should be void __iomem * not a void *. This quiets a lot of sparse warings for the writel and readl calls like: warning: incorrect type in argument 1 (different address spaces)    expected void const volatile [noderef] *addr    got void * warning: incorrect type in argument 2 (different address spaces)    expected void volatile [noderef] *addr    got void * Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 5160370..d6dc338 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -118,7 +118,7 @@ static const struct s626_board s626_boards[] = { struct s626_private { struct pci_dev *pdev; - void *base_addr; + void __iomem *base_addr; int got_regions; short allocatedBuf; uint8_t ai_cmd_running; /* ai_cmd is running */ -- cgit v0.10.2 From ad401db6684bef91aca6304e640d63c9c858de2b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 18:08:36 -0700 Subject: staging: comedi: remove thisboard macro in the ssv_dnp driver The 'thisboard' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ssv_dnp.c b/drivers/staging/comedi/drivers/ssv_dnp.c index 16c4f5a..de58095 100644 --- a/drivers/staging/comedi/drivers/ssv_dnp.c +++ b/drivers/staging/comedi/drivers/ssv_dnp.c @@ -59,9 +59,6 @@ struct dnp_board { int have_dio; }; -/* Useful for shorthand access to the particular board structure ----------- */ -#define thisboard ((const struct dnp_board *)dev->board_ptr) - /* This structure is for data unique to the DNP driver --------------------- */ struct dnp_private_data { @@ -188,18 +185,12 @@ static int dnp_dio_insn_config(struct comedi_device *dev, static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct dnp_board *board = comedi_board(dev); struct comedi_subdevice *s; printk(KERN_INFO "comedi%d: dnp: ", dev->minor); - /* Autoprobing: this should find out which board we have. Currently */ - /* only the 1486 board is supported and autoprobing is not */ - /* implemented :-) */ - /* dev->board_ptr = dnp_probe(dev); */ - - /* Initialize the name of the board. */ - /* We can use the "thisboard" macro now. */ - dev->board_name = thisboard->name; + dev->board_name = board->name; /* Allocate the private structure area. alloc_private() is a */ /* convenient macro defined in comedidev.h. */ -- cgit v0.10.2 From 609dd342fb7eab79d42350455c2d86238c7dc15f Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 18:04:18 -0700 Subject: staging: comedi: remove this_board macro in the serial2002 driver The 'thisboard' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c index 6342bc5..9200310 100644 --- a/drivers/staging/comedi/drivers/serial2002.c +++ b/drivers/staging/comedi/drivers/serial2002.c @@ -47,11 +47,6 @@ struct serial2002_board { const char *name; }; -/* - * Useful for shorthand access to the particular board structure - */ -#define thisboard ((const struct serial2002_board *)dev->board_ptr) - struct serial2002_range_table_t { /* HACK... */ @@ -783,10 +778,11 @@ static int serial2002_ei_rinsn(struct comedi_device *dev, static int serial2002_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct serial2002_board *board = comedi_board(dev); struct comedi_subdevice *s; dev_dbg(dev->hw_dev, "comedi%d: attached\n", dev->minor); - dev->board_name = thisboard->name; + dev->board_name = board->name; if (alloc_private(dev, sizeof(struct serial2002_private)) < 0) return -ENOMEM; dev->open = serial_2002_open; -- cgit v0.10.2 From 354c00a67697fc7a56b540647ef7fe93333ed903 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 17:59:07 -0700 Subject: staging: comedi: remove this_board macro in the rti800 driver The 'this_board' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rti800.c b/drivers/staging/comedi/drivers/rti800.c index f0eb52a..04a2368 100644 --- a/drivers/staging/comedi/drivers/rti800.c +++ b/drivers/staging/comedi/drivers/rti800.c @@ -138,8 +138,6 @@ struct rti800_board { int has_ao; }; -#define this_board ((const struct rti800_board *)dev->board_ptr) - static irqreturn_t rti800_interrupt(int irq, void *dev); struct rti800_private { @@ -309,6 +307,7 @@ static int rti800_do_insn_bits(struct comedi_device *dev, static int rti800_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct rti800_board *board = comedi_board(dev); unsigned int irq; unsigned long iobase; int ret; @@ -347,7 +346,7 @@ static int rti800_attach(struct comedi_device *dev, struct comedi_devconfig *it) printk(KERN_INFO "( no irq )\n"); } - dev->board_name = this_board->name; + dev->board_name = board->name; ret = alloc_subdevices(dev, 4); if (ret < 0) @@ -386,7 +385,7 @@ static int rti800_attach(struct comedi_device *dev, struct comedi_devconfig *it) } s++; - if (this_board->has_ao) { + if (board->has_ao) { /* ao subdevice (only on rti815) */ s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_WRITABLE; -- cgit v0.10.2 From d5016e242b3ca919e3be7fa98dbb2b35e61c1efe Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 17:54:46 -0700 Subject: staging: comedi: remove this_board macro in the poc driver The 'this_board' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/poc.c b/drivers/staging/comedi/drivers/poc.c index e712048..95e348f 100644 --- a/drivers/staging/comedi/drivers/poc.c +++ b/drivers/staging/comedi/drivers/poc.c @@ -57,8 +57,6 @@ struct boarddef_struct { const struct comedi_lrange *range; }; -#define this_board ((const struct boarddef_struct *)dev->board_ptr) - static int readback_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { @@ -137,22 +135,23 @@ static int pcl734_insn_bits(struct comedi_device *dev, static int poc_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct boarddef_struct *board = comedi_board(dev); struct comedi_subdevice *s; unsigned long iobase; unsigned int iosize; iobase = it->options[0]; printk(KERN_INFO "comedi%d: poc: using %s iobase 0x%lx\n", dev->minor, - this_board->name, iobase); + board->name, iobase); - dev->board_name = this_board->name; + dev->board_name = board->name; if (iobase == 0) { printk(KERN_ERR "io base address required\n"); return -EINVAL; } - iosize = this_board->iosize; + iosize = board->iosize; /* check if io addresses are available */ if (!request_region(iobase, iosize, "dac02")) { printk(KERN_ERR "I/O port conflict: failed to allocate ports " @@ -163,18 +162,18 @@ static int poc_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (alloc_subdevices(dev, 1) < 0) return -ENOMEM; - if (alloc_private(dev, sizeof(unsigned int) * this_board->n_chan) < 0) + if (alloc_private(dev, sizeof(unsigned int) * board->n_chan) < 0) return -ENOMEM; /* analog output subdevice */ s = dev->subdevices + 0; - s->type = this_board->type; - s->n_chan = this_board->n_chan; - s->maxdata = (1 << this_board->n_bits) - 1; - s->range_table = this_board->range; - s->insn_write = this_board->winsn; - s->insn_read = this_board->rinsn; - s->insn_bits = this_board->insnbits; + s->type = board->type; + s->n_chan = board->n_chan; + s->maxdata = (1 << board->n_bits) - 1; + s->range_table = board->range; + s->insn_write = board->winsn; + s->insn_read = board->rinsn; + s->insn_bits = board->insnbits; if (s->type == COMEDI_SUBD_AO || s->type == COMEDI_SUBD_DO) s->subdev_flags = SDF_WRITABLE; @@ -183,8 +182,10 @@ static int poc_attach(struct comedi_device *dev, struct comedi_devconfig *it) static void poc_detach(struct comedi_device *dev) { + const struct boarddef_struct *board = comedi_board(dev); + if (dev->iobase) - release_region(dev->iobase, this_board->iosize); + release_region(dev->iobase, board->iosize); } static const struct boarddef_struct boards[] = { -- cgit v0.10.2 From a28b59957d3ad01481c2ea87aca50cfdb85417f2 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 17:51:35 -0700 Subject: staging: comedi: remove this_board macro in the pcmuio driver The 'thisboard' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/pcmuio.c b/drivers/staging/comedi/drivers/pcmuio.c index 623381d..b1a9bed 100644 --- a/drivers/staging/comedi/drivers/pcmuio.c +++ b/drivers/staging/comedi/drivers/pcmuio.c @@ -155,11 +155,6 @@ struct pcmuio_board { const int num_ports; }; -/* - * Useful for shorthand access to the particular board structure - */ -#define thisboard ((const struct pcmuio_board *)dev->board_ptr) - /* this structure is for data unique to this subdevice. */ struct pcmuio_subdev_private { /* mapping of halfwords (bytes) in port/chanarray to iobase */ @@ -354,7 +349,9 @@ static int pcmuio_dio_insn_config(struct comedi_device *dev, static void switch_page(struct comedi_device *dev, int asic, int page) { - if (asic < 0 || asic >= thisboard->num_asics) + const struct pcmuio_board *board = comedi_board(dev); + + if (asic < 0 || asic >= board->num_asics) return; /* paranoia */ if (page < 0 || page >= NUM_PAGES) return; /* more paranoia */ @@ -370,9 +367,10 @@ static void switch_page(struct comedi_device *dev, int asic, int page) static void init_asics(struct comedi_device *dev) { /* sets up an ASIC chip to defaults */ + const struct pcmuio_board *board = comedi_board(dev); int asic; - for (asic = 0; asic < thisboard->num_asics; ++asic) { + for (asic = 0; asic < board->num_asics; ++asic) { int port, page; unsigned long baseaddr = dev->iobase + asic * ASIC_IOSIZE; @@ -407,7 +405,9 @@ static void init_asics(struct comedi_device *dev) #ifdef notused static void lock_port(struct comedi_device *dev, int asic, int port) { - if (asic < 0 || asic >= thisboard->num_asics) + const struct pcmuio_board *board = comedi_board(dev); + + if (asic < 0 || asic >= board->num_asics) return; /* paranoia */ if (port < 0 || port >= PORTS_PER_ASIC) return; /* more paranoia */ @@ -420,7 +420,9 @@ static void lock_port(struct comedi_device *dev, int asic, int port) static void unlock_port(struct comedi_device *dev, int asic, int port) { - if (asic < 0 || asic >= thisboard->num_asics) + const struct pcmuio_board *board = comedi_board(dev); + + if (asic < 0 || asic >= board->num_asics) return; /* paranoia */ if (port < 0 || port >= PORTS_PER_ASIC) return; /* more paranoia */ @@ -747,6 +749,7 @@ pcmuio_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct pcmuio_board *board = comedi_board(dev); struct comedi_subdevice *s; int sdev_no, chans_left, n_subdevs, port, asic, thisasic_chanct = 0; unsigned long iobase; @@ -762,17 +765,13 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->iobase = iobase; if (!iobase || !request_region(iobase, - thisboard->num_asics * ASIC_IOSIZE, + board->num_asics * ASIC_IOSIZE, dev->driver->driver_name)) { dev_err(dev->hw_dev, "I/O port conflict\n"); return -EIO; } -/* - * Initialize dev->board_name. Note that we can use the "thisboard" - * macro now, since we just initialized it in the last line. - */ - dev->board_name = thisboard->name; + dev->board_name = board->name; /* * Allocate the private structure area. alloc_private() is a @@ -792,7 +791,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) spin_lock_init(&devpriv->asics[asic].spinlock); } - chans_left = CHANS_PER_ASIC * thisboard->num_asics; + chans_left = CHANS_PER_ASIC * board->num_asics; n_subdevs = CALC_N_SUBDEVS(chans_left); devpriv->sprivs = kcalloc(n_subdevs, sizeof(struct pcmuio_subdev_private), @@ -881,7 +880,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) for (asic = 0; irq[0] && asic < MAX_ASICS; ++asic) { if (irq[asic] && request_irq(irq[asic], interrupt_pcmuio, - IRQF_SHARED, thisboard->name, dev)) { + IRQF_SHARED, board->name, dev)) { int i; /* unroll the allocated irqs.. */ for (i = asic - 1; i >= 0; --i) { @@ -898,7 +897,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (irq[0]) { dev_dbg(dev->hw_dev, "irq: %u\n", irq[0]); - if (irq[1] && thisboard->num_asics == 2) + if (irq[1] && board->num_asics == 2) dev_dbg(dev->hw_dev, "second ASIC irq: %u\n", irq[1]); } else { dev_dbg(dev->hw_dev, "(IRQ mode disabled)\n"); @@ -910,10 +909,11 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) static void pcmuio_detach(struct comedi_device *dev) { + const struct pcmuio_board *board = comedi_board(dev); int i; if (dev->iobase) - release_region(dev->iobase, ASIC_IOSIZE * thisboard->num_asics); + release_region(dev->iobase, ASIC_IOSIZE * board->num_asics); for (i = 0; i < MAX_ASICS; ++i) { if (devpriv->asics[i].irq) free_irq(devpriv->asics[i].irq, dev); -- cgit v0.10.2 From 57bbeb3b9bc32f1ee4b14439e11ed475deab1263 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 17:46:56 -0700 Subject: staging: comedi: remove this_board macro in the pcmmio driver The 'thisboard' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c index efed168..c4482ae 100644 --- a/drivers/staging/comedi/drivers/pcmmio.c +++ b/drivers/staging/comedi/drivers/pcmmio.c @@ -183,11 +183,6 @@ static const struct comedi_lrange ranges_ao = { RANGE(-2.5, 2.5), RANGE(-2.5, 7.5)} }; -/* - * Useful for shorthand access to the particular board structure - */ -#define thisboard ((const struct pcmmio_board *)dev->board_ptr) - /* this structure is for data unique to this subdevice. */ struct pcmmio_subdev_private { @@ -423,7 +418,9 @@ static int pcmmio_dio_insn_config(struct comedi_device *dev, static void switch_page(struct comedi_device *dev, int asic, int page) { - if (asic < 0 || asic >= thisboard->dio_num_asics) + const struct pcmmio_board *board = comedi_board(dev); + + if (asic < 0 || asic >= board->dio_num_asics) return; /* paranoia */ if (page < 0 || page >= NUM_PAGES) return; /* more paranoia */ @@ -439,9 +436,10 @@ static void switch_page(struct comedi_device *dev, int asic, int page) static void init_asics(struct comedi_device *dev) { /* sets up an ASIC chip to defaults */ + const struct pcmmio_board *board = comedi_board(dev); int asic; - for (asic = 0; asic < thisboard->dio_num_asics; ++asic) { + for (asic = 0; asic < board->dio_num_asics; ++asic) { int port, page; unsigned long baseaddr = devpriv->asics[asic].iobase; @@ -476,7 +474,9 @@ static void init_asics(struct comedi_device *dev) #ifdef notused static void lock_port(struct comedi_device *dev, int asic, int port) { - if (asic < 0 || asic >= thisboard->dio_num_asics) + const struct pcmmio_board *board = comedi_board(dev); + + if (asic < 0 || asic >= board->dio_num_asics) return; /* paranoia */ if (port < 0 || port >= PORTS_PER_ASIC) return; /* more paranoia */ @@ -490,7 +490,9 @@ static void lock_port(struct comedi_device *dev, int asic, int port) static void unlock_port(struct comedi_device *dev, int asic, int port) { - if (asic < 0 || asic >= thisboard->dio_num_asics) + const struct pcmmio_board *board = comedi_board(dev); + + if (asic < 0 || asic >= board->dio_num_asics) return; /* paranoia */ if (port < 0 || port >= PORTS_PER_ASIC) return; /* more paranoia */ @@ -1012,6 +1014,7 @@ static int ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct pcmmio_board *board = comedi_board(dev); struct comedi_subdevice *s; int sdev_no, chans_left, n_dio_subdevs, n_subdevs, port, asic, thisasic_chanct = 0; @@ -1027,17 +1030,13 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->iobase = iobase; if (!iobase || !request_region(iobase, - thisboard->total_iosize, + board->total_iosize, dev->driver->driver_name)) { printk(KERN_ERR "comedi%d: I/O port conflict\n", dev->minor); return -EIO; } -/* - * Initialize dev->board_name. Note that we can use the "thisboard" - * macro now, since we just initialized it in the last line. - */ - dev->board_name = thisboard->name; + dev->board_name = board->name; /* * Allocate the private structure area. alloc_private() is a @@ -1061,7 +1060,7 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) spin_lock_init(&devpriv->asics[asic].spinlock); } - chans_left = CHANS_PER_ASIC * thisboard->dio_num_asics; + chans_left = CHANS_PER_ASIC * board->dio_num_asics; n_dio_subdevs = CALC_N_DIO_SUBDEVS(chans_left); n_subdevs = n_dio_subdevs + 2; devpriv->sprivs = @@ -1088,13 +1087,13 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) sdev_no = 0; s = dev->subdevices + sdev_no; s->private = devpriv->sprivs + sdev_no; - s->maxdata = (1 << thisboard->ai_bits) - 1; - s->range_table = thisboard->ai_range_table; + s->maxdata = (1 << board->ai_bits) - 1; + s->range_table = board->ai_range_table; s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; s->type = COMEDI_SUBD_AI; - s->n_chan = thisboard->n_ai_chans; + s->n_chan = board->n_ai_chans; s->len_chanlist = s->n_chan; - s->insn_read = thisboard->ai_rinsn; + s->insn_read = board->ai_rinsn; subpriv->iobase = dev->iobase + 0; /* initialize the resource enable register by clearing it */ outb(0, subpriv->iobase + 3); @@ -1104,14 +1103,14 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) ++sdev_no; s = dev->subdevices + sdev_no; s->private = devpriv->sprivs + sdev_no; - s->maxdata = (1 << thisboard->ao_bits) - 1; - s->range_table = thisboard->ao_range_table; + s->maxdata = (1 << board->ao_bits) - 1; + s->range_table = board->ao_range_table; s->subdev_flags = SDF_READABLE; s->type = COMEDI_SUBD_AO; - s->n_chan = thisboard->n_ao_chans; + s->n_chan = board->n_ao_chans; s->len_chanlist = s->n_chan; - s->insn_read = thisboard->ao_rinsn; - s->insn_write = thisboard->ao_winsn; + s->insn_read = board->ao_rinsn; + s->insn_write = board->ao_winsn; subpriv->iobase = dev->iobase + 8; /* initialize the resource enable register by clearing it */ outb(0, subpriv->iobase + 3); @@ -1192,7 +1191,7 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) for (asic = 0; irq[0] && asic < MAX_ASICS; ++asic) { if (irq[asic] && request_irq(irq[asic], interrupt_pcmmio, - IRQF_SHARED, thisboard->name, dev)) { + IRQF_SHARED, board->name, dev)) { int i; /* unroll the allocated irqs.. */ for (i = asic - 1; i >= 0; --i) { @@ -1211,7 +1210,7 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (irq[0]) { printk(KERN_DEBUG "comedi%d: irq: %u\n", dev->minor, irq[0]); - if (thisboard->dio_num_asics == 2 && irq[1]) + if (board->dio_num_asics == 2 && irq[1]) printk(KERN_DEBUG "comedi%d: second ASIC irq: %u\n", dev->minor, irq[1]); } else { @@ -1225,10 +1224,11 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) static void pcmmio_detach(struct comedi_device *dev) { + const struct pcmmio_board *board = comedi_board(dev); int i; if (dev->iobase) - release_region(dev->iobase, thisboard->total_iosize); + release_region(dev->iobase, board->total_iosize); for (i = 0; i < MAX_ASICS; ++i) { if (devpriv && devpriv->asics[i].irq) free_irq(devpriv->asics[i].irq, dev); -- cgit v0.10.2 From 2fbffee0604fd3f6f9e3aa56e3fe1aa061a32ca6 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 17:42:55 -0700 Subject: staging: comedi: remove thisboard macro in the pcmda12 driver The 'thisboard' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/pcmda12.c b/drivers/staging/comedi/drivers/pcmda12.c index 4786148..f49c66a 100644 --- a/drivers/staging/comedi/drivers/pcmda12.c +++ b/drivers/staging/comedi/drivers/pcmda12.c @@ -80,11 +80,6 @@ static const struct comedi_lrange pcmda12_ranges = { } }; -/* - * Useful for shorthand access to the particular board structure - */ -#define thisboard ((const struct pcmda12_board *)dev->board_ptr) - struct pcmda12_private { unsigned int ao_readback[CHANS]; @@ -167,6 +162,7 @@ static int ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, static int pcmda12_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct pcmda12_board *board = comedi_board(dev); struct comedi_subdevice *s; unsigned long iobase; @@ -181,11 +177,7 @@ static int pcmda12_attach(struct comedi_device *dev, } dev->iobase = iobase; -/* - * Initialize dev->board_name. Note that we can use the "thisboard" - * macro now, since we just initialized it in the last line. - */ - dev->board_name = thisboard->name; + dev->board_name = board->name; /* * Allocate the private structure area. alloc_private() is a -- cgit v0.10.2 From 449b683c6b4f92af648447f9eb449fd52ce6d56b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 17:39:22 -0700 Subject: staging: comedi: remove this_board macro in the pcmad driver The 'this_board' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/pcmad.c b/drivers/staging/comedi/drivers/pcmad.c index 1ec7d5c..2ec0b2e 100644 --- a/drivers/staging/comedi/drivers/pcmad.c +++ b/drivers/staging/comedi/drivers/pcmad.c @@ -58,8 +58,6 @@ struct pcmad_board_struct { int n_ai_bits; }; -#define this_board ((const struct pcmad_board_struct *)(dev->board_ptr)) - struct pcmad_priv_struct { int differential; int twos_comp; @@ -72,6 +70,7 @@ static int pcmad_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + const struct pcmad_board_struct *board = comedi_board(dev); int i; int chan; int n; @@ -89,7 +88,7 @@ static int pcmad_ai_insn_read(struct comedi_device *dev, data[n] |= (inb(dev->iobase + PCMAD_MSB) << 8); if (devpriv->twos_comp) - data[n] ^= (1 << (this_board->n_ai_bits - 1)); + data[n] ^= (1 << (board->n_ai_bits - 1)); } return n; @@ -104,6 +103,7 @@ static int pcmad_ai_insn_read(struct comedi_device *dev, */ static int pcmad_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct pcmad_board_struct *board = comedi_board(dev); int ret; struct comedi_subdevice *s; unsigned long iobase; @@ -125,7 +125,7 @@ static int pcmad_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (ret < 0) return ret; - dev->board_name = this_board->name; + dev->board_name = board->name; s = dev->subdevices + 0; s->type = COMEDI_SUBD_AI; @@ -133,7 +133,7 @@ static int pcmad_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->n_chan = 16; /* XXX */ s->len_chanlist = 1; s->insn_read = pcmad_ai_insn_read; - s->maxdata = (1 << this_board->n_ai_bits) - 1; + s->maxdata = (1 << board->n_ai_bits) - 1; s->range_table = &range_unknown; return 0; -- cgit v0.10.2 From 3cff0f1249f9be93c44ea071bafd9f28f673898d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 17:26:43 -0700 Subject: staging: comedi: remove this_board macro in the pcm3724 driver The 'this_board' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/pcm3724.c b/drivers/staging/comedi/drivers/pcm3724.c index 7492b8f..9eee708 100644 --- a/drivers/staging/comedi/drivers/pcm3724.c +++ b/drivers/staging/comedi/drivers/pcm3724.c @@ -76,10 +76,6 @@ struct priv_pcm3724 { int dio_2; }; -#define this_board ((const struct pcm3724_board *)dev->board_ptr) - -/* (setq c-basic-offset 8) */ - static int subdev_8255_cb(int dir, int port, int data, unsigned long arg) { unsigned long iobase = arg; @@ -234,12 +230,13 @@ static int subdev_3724_insn_config(struct comedi_device *dev, static int pcm3724_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct pcm3724_board *board = comedi_board(dev); unsigned long iobase; unsigned int iorange; int ret, i, n_subdevices; iobase = it->options[0]; - iorange = this_board->io_range; + iorange = board->io_range; ret = alloc_private(dev, sizeof(struct priv_pcm3724)); if (ret < 0) @@ -249,17 +246,17 @@ static int pcm3724_attach(struct comedi_device *dev, ((struct priv_pcm3724 *)(dev->private))->dio_2 = 0; printk(KERN_INFO "comedi%d: pcm3724: board=%s, 0x%03lx ", dev->minor, - this_board->name, iobase); + board->name, iobase); if (!iobase || !request_region(iobase, iorange, "pcm3724")) { printk("I/O port conflict\n"); return -EIO; } dev->iobase = iobase; - dev->board_name = this_board->name; + dev->board_name = board->name; printk(KERN_INFO "\n"); - n_subdevices = this_board->numofports; + n_subdevices = board->numofports; ret = alloc_subdevices(dev, n_subdevices); if (ret < 0) @@ -275,6 +272,7 @@ static int pcm3724_attach(struct comedi_device *dev, static void pcm3724_detach(struct comedi_device *dev) { + const struct pcm3724_board *board = comedi_board(dev); int i; if (dev->subdevices) { @@ -282,7 +280,7 @@ static void pcm3724_detach(struct comedi_device *dev) subdev_8255_cleanup(dev, dev->subdevices + i); } if (dev->iobase) - release_region(dev->iobase, this_board->io_range); + release_region(dev->iobase, board->io_range); } static const struct pcm3724_board boardtypes[] = { -- cgit v0.10.2 From dd8a4b478846c2cd38c09dcc564a8b964da185d0 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 17:22:48 -0700 Subject: staging: comedi: remove this_board macro in the pcl818 driver The 'this_board' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c index 1406c97..6c84b29 100644 --- a/drivers/staging/comedi/drivers/pcl818.c +++ b/drivers/staging/comedi/drivers/pcl818.c @@ -326,7 +326,6 @@ static const unsigned int muxonechan[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0 }; #define devpriv ((struct pcl818_private *)dev->private) -#define this_board ((const struct pcl818_board *)dev->board_ptr) /* ============================================================================== @@ -1264,6 +1263,7 @@ static int check_single_ended(unsigned int port) static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { + const struct pcl818_board *board = comedi_board(dev); int err = 0; int tmp, divisor1 = 0, divisor2 = 0; @@ -1334,8 +1334,8 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, } if (cmd->convert_src == TRIG_TIMER) { - if (cmd->convert_arg < this_board->ns_min) { - cmd->convert_arg = this_board->ns_min; + if (cmd->convert_arg < board->ns_min) { + cmd->convert_arg = board->ns_min; err++; } } else { /* TRIG_EXT */ @@ -1371,8 +1371,8 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, i8253_cascade_ns_to_timer(devpriv->i8253_osc_base, &divisor1, &divisor2, &cmd->convert_arg, cmd->flags & TRIG_ROUND_MASK); - if (cmd->convert_arg < this_board->ns_min) - cmd->convert_arg = this_board->ns_min; + if (cmd->convert_arg < board->ns_min) + cmd->convert_arg = board->ns_min; if (tmp != cmd->convert_arg) err++; } @@ -1519,6 +1519,8 @@ static int pcl818_check(unsigned long iobase) */ static void pcl818_reset(struct comedi_device *dev) { + const struct pcl818_board *board = comedi_board(dev); + if (devpriv->usefifo) { /* FIFO shutdown */ outb(0, dev->iobase + PCL818_FI_INTCLR); outb(0, dev->iobase + PCL818_FI_FLUSH); @@ -1537,7 +1539,7 @@ static void pcl818_reset(struct comedi_device *dev) outb(0xb0, dev->iobase + PCL818_CTRCTL); /* Stop pacer */ outb(0x70, dev->iobase + PCL818_CTRCTL); outb(0x30, dev->iobase + PCL818_CTRCTL); - if (this_board->is_818) { + if (board->is_818) { outb(0, dev->iobase + PCL818_RANGE); } else { outb(0, dev->iobase + PCL718_DA2_LO); @@ -1636,6 +1638,7 @@ static int rtc_setfreq_irq(int freq) static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct pcl818_board *board = comedi_board(dev); int ret; unsigned long iobase; unsigned int irq; @@ -1651,9 +1654,10 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it) iobase = it->options[0]; printk ("comedi%d: pcl818: board=%s, ioport=0x%03lx", - dev->minor, this_board->name, iobase); - devpriv->io_range = this_board->io_range; - if ((this_board->fifo) && (it->options[2] == -1)) { /* we've board with FIFO and we want to use FIFO */ + dev->minor, board->name, iobase); + devpriv->io_range = board->io_range; + if ((board->fifo) && (it->options[2] == -1)) { + /* we've board with FIFO and we want to use FIFO */ devpriv->io_range = PCLx1xFIFO_RANGE; devpriv->usefifo = 1; } @@ -1669,14 +1673,14 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it) return -EIO; } - /* set up some name stuff */ - dev->board_name = this_board->name; + dev->board_name = board->name; + /* grab our IRQ */ irq = 0; - if (this_board->IRQbits != 0) { /* board support IRQ */ + if (board->IRQbits != 0) { /* board support IRQ */ irq = it->options[1]; if (irq) { /* we want to use IRQ */ - if (((1 << irq) & this_board->IRQbits) == 0) { + if (((1 << irq) & board->IRQbits) == 0) { printk (", IRQ %u is out of allowed range, DISABLING IT", irq); @@ -1740,11 +1744,11 @@ no_rtc: devpriv->dma = dma; if ((devpriv->irq_free == 0) && (devpriv->dma_rtc == 0)) goto no_dma; /* if we haven't IRQ, we can't use DMA */ - if (this_board->DMAbits != 0) { /* board support DMA */ + if (board->DMAbits != 0) { /* board support DMA */ dma = it->options[2]; if (dma < 1) goto no_dma; /* DMA disabled */ - if (((1 << dma) & this_board->DMAbits) == 0) { + if (((1 << dma) & board->DMAbits) == 0) { printk(KERN_ERR "DMA is out of allowed range, FAIL!\n"); return -EINVAL; /* Bad DMA */ } @@ -1779,24 +1783,24 @@ no_dma: return ret; s = dev->subdevices + 0; - if (!this_board->n_aichan_se) { + if (!board->n_aichan_se) { s->type = COMEDI_SUBD_UNUSED; } else { s->type = COMEDI_SUBD_AI; devpriv->sub_ai = s; s->subdev_flags = SDF_READABLE; if (check_single_ended(dev->iobase)) { - s->n_chan = this_board->n_aichan_se; + s->n_chan = board->n_aichan_se; s->subdev_flags |= SDF_COMMON | SDF_GROUND; printk(", %dchans S.E. DAC", s->n_chan); } else { - s->n_chan = this_board->n_aichan_diff; + s->n_chan = board->n_aichan_diff; s->subdev_flags |= SDF_DIFF; printk(", %dchans DIFF DAC", s->n_chan); } - s->maxdata = this_board->ai_maxdata; + s->maxdata = board->ai_maxdata; s->len_chanlist = s->n_chan; - s->range_table = this_board->ai_range_type; + s->range_table = board->ai_range_type; s->cancel = pcl818_ai_cancel; s->insn_read = pcl818_ai_insn_read; if ((irq) || (devpriv->dma_rtc)) { @@ -1805,7 +1809,7 @@ no_dma: s->do_cmdtest = ai_cmdtest; s->do_cmd = ai_cmd; } - if (this_board->is_818) { + if (board->is_818) { if ((it->options[4] == 1) || (it->options[4] == 10)) s->range_table = &range_pcl818l_h_ai; /* secondary range list jumper selectable */ } else { @@ -1845,15 +1849,15 @@ no_dma: } s = dev->subdevices + 1; - if (!this_board->n_aochan) { + if (!board->n_aochan) { s->type = COMEDI_SUBD_UNUSED; } else { s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_WRITABLE | SDF_GROUND; - s->n_chan = this_board->n_aochan; - s->maxdata = this_board->ao_maxdata; - s->len_chanlist = this_board->n_aochan; - s->range_table = this_board->ao_range_type; + s->n_chan = board->n_aochan; + s->maxdata = board->ao_maxdata; + s->len_chanlist = board->n_aochan; + s->range_table = board->ao_range_type; s->insn_read = pcl818_ao_insn_read; s->insn_write = pcl818_ao_insn_write; #ifdef unused @@ -1864,7 +1868,7 @@ no_dma: } #endif #endif - if (this_board->is_818) { + if (board->is_818) { if ((it->options[4] == 1) || (it->options[4] == 10)) s->range_table = &range_unipolar10; if (it->options[4] == 2) @@ -1878,27 +1882,27 @@ no_dma: } s = dev->subdevices + 2; - if (!this_board->n_dichan) { + if (!board->n_dichan) { s->type = COMEDI_SUBD_UNUSED; } else { s->type = COMEDI_SUBD_DI; s->subdev_flags = SDF_READABLE; - s->n_chan = this_board->n_dichan; + s->n_chan = board->n_dichan; s->maxdata = 1; - s->len_chanlist = this_board->n_dichan; + s->len_chanlist = board->n_dichan; s->range_table = &range_digital; s->insn_bits = pcl818_di_insn_bits; } s = dev->subdevices + 3; - if (!this_board->n_dochan) { + if (!board->n_dochan) { s->type = COMEDI_SUBD_UNUSED; } else { s->type = COMEDI_SUBD_DO; s->subdev_flags = SDF_WRITABLE; - s->n_chan = this_board->n_dochan; + s->n_chan = board->n_dochan; s->maxdata = 1; - s->len_chanlist = this_board->n_dochan; + s->len_chanlist = board->n_dochan; s->range_table = &range_digital; s->insn_bits = pcl818_do_insn_bits; } @@ -1910,9 +1914,9 @@ no_dma: devpriv->i8253_osc_base = 1000; /* max sampling speed */ - devpriv->ns_min = this_board->ns_min; + devpriv->ns_min = board->ns_min; - if (!this_board->is_818) { + if (!board->is_818) { if ((it->options[6] == 1) || (it->options[6] == 100)) devpriv->ns_min = 10000; /* extended PCL718 to 100kHz DAC */ } -- cgit v0.10.2 From 240c6e6a7125fd7a6ebcbdd8fbbf646df0f69186 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 17:14:14 -0700 Subject: staging: comedi: remove this_board macro in the pcl816 driver The 'this_board' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c index cc67b6d..277a23e 100644 --- a/drivers/staging/comedi/drivers/pcl816.c +++ b/drivers/staging/comedi/drivers/pcl816.c @@ -126,7 +126,6 @@ struct pcl816_board { }; #define devpriv ((struct pcl816_private *)dev->private) -#define this_board ((const struct pcl816_board *)dev->board_ptr) #ifdef unused static int RTC_lock; /* RTC lock */ @@ -451,6 +450,7 @@ static void pcl816_cmdtest_out(int e, struct comedi_cmd *cmd) static int pcl816_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { + const struct pcl816_board *board = comedi_board(dev); int err = 0; int tmp, divisor1 = 0, divisor2 = 0; @@ -531,8 +531,8 @@ static int pcl816_ai_cmdtest(struct comedi_device *dev, err++; } if (cmd->convert_src == TRIG_TIMER) { - if (cmd->convert_arg < this_board->ai_ns_min) { - cmd->convert_arg = this_board->ai_ns_min; + if (cmd->convert_arg < board->ai_ns_min) { + cmd->convert_arg = board->ai_ns_min; err++; } } else { /* TRIG_EXT */ @@ -565,12 +565,12 @@ static int pcl816_ai_cmdtest(struct comedi_device *dev, /* step 4: fix up any arguments */ if (cmd->convert_src == TRIG_TIMER) { tmp = cmd->convert_arg; - i8253_cascade_ns_to_timer(this_board->i8254_osc_base, + i8253_cascade_ns_to_timer(board->i8254_osc_base, &divisor1, &divisor2, &cmd->convert_arg, cmd->flags & TRIG_ROUND_MASK); - if (cmd->convert_arg < this_board->ai_ns_min) - cmd->convert_arg = this_board->ai_ns_min; + if (cmd->convert_arg < board->ai_ns_min) + cmd->convert_arg = board->ai_ns_min; if (tmp != cmd->convert_arg) err++; } @@ -592,6 +592,7 @@ static int pcl816_ai_cmdtest(struct comedi_device *dev, static int pcl816_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { + const struct pcl816_board *board = comedi_board(dev); unsigned int divisor1 = 0, divisor2 = 0, dma_flags, bytes, dmairq; struct comedi_cmd *cmd = &s->async->cmd; unsigned int seglen; @@ -609,10 +610,10 @@ static int pcl816_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) return -EBUSY; if (cmd->convert_src == TRIG_TIMER) { - if (cmd->convert_arg < this_board->ai_ns_min) - cmd->convert_arg = this_board->ai_ns_min; + if (cmd->convert_arg < board->ai_ns_min) + cmd->convert_arg = board->ai_ns_min; - i8253_cascade_ns_to_timer(this_board->i8254_osc_base, &divisor1, + i8253_cascade_ns_to_timer(board->i8254_osc_base, &divisor1, &divisor2, &cmd->convert_arg, cmd->flags & TRIG_ROUND_MASK); @@ -1028,6 +1029,7 @@ static int set_rtc_irq_bit(unsigned char bit) static int pcl816_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct pcl816_board *board = comedi_board(dev); int ret; unsigned long iobase; unsigned int irq, dma; @@ -1038,9 +1040,9 @@ static int pcl816_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* claim our I/O space */ iobase = it->options[0]; printk("comedi%d: pcl816: board=%s, ioport=0x%03lx", dev->minor, - this_board->name, iobase); + board->name, iobase); - if (!request_region(iobase, this_board->io_range, "pcl816")) { + if (!request_region(iobase, board->io_range, "pcl816")) { printk("I/O port conflict\n"); return -EIO; } @@ -1056,15 +1058,14 @@ static int pcl816_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (ret < 0) return ret; /* Can't alloc mem */ - /* set up some name stuff */ - dev->board_name = this_board->name; + dev->board_name = board->name; /* grab our IRQ */ irq = 0; - if (this_board->IRQbits != 0) { /* board support IRQ */ + if (board->IRQbits != 0) { /* board support IRQ */ irq = it->options[1]; if (irq) { /* we want to use IRQ */ - if (((1 << irq) & this_board->IRQbits) == 0) { + if (((1 << irq) & board->IRQbits) == 0) { printk (", IRQ %u is out of allowed range, " "DISABLING IT", irq); @@ -1134,12 +1135,12 @@ no_rtc: if ((devpriv->irq_free == 0) && (devpriv->dma_rtc == 0)) goto no_dma; /* if we haven't IRQ, we can't use DMA */ - if (this_board->DMAbits != 0) { /* board support DMA */ + if (board->DMAbits != 0) { /* board support DMA */ dma = it->options[2]; if (dma < 1) goto no_dma; /* DMA disabled */ - if (((1 << dma) & this_board->DMAbits) == 0) { + if (((1 << dma) & board->DMAbits) == 0) { printk(", DMA is out of allowed range, FAIL!\n"); return -EINVAL; /* Bad DMA */ } @@ -1185,11 +1186,11 @@ no_rtc: no_dma: -/* if (this_board->n_aochan > 0) +/* if (board->n_aochan > 0) subdevs[1] = COMEDI_SUBD_AO; - if (this_board->n_dichan > 0) + if (board->n_dichan > 0) subdevs[2] = COMEDI_SUBD_DI; - if (this_board->n_dochan > 0) + if (board->n_dochan > 0) subdevs[3] = COMEDI_SUBD_DO; */ @@ -1198,17 +1199,17 @@ no_dma: return ret; s = dev->subdevices + 0; - if (this_board->n_aichan > 0) { + if (board->n_aichan > 0) { s->type = COMEDI_SUBD_AI; devpriv->sub_ai = s; dev->read_subdev = s; s->subdev_flags = SDF_READABLE | SDF_CMD_READ; - s->n_chan = this_board->n_aichan; + s->n_chan = board->n_aichan; s->subdev_flags |= SDF_DIFF; /* printk (", %dchans DIFF DAC - %d", s->n_chan, i); */ - s->maxdata = this_board->ai_maxdata; - s->len_chanlist = this_board->ai_chanlist; - s->range_table = this_board->ai_range_type; + s->maxdata = board->ai_maxdata; + s->len_chanlist = board->ai_chanlist; + s->range_table = board->ai_range_type; s->cancel = pcl816_ai_cancel; s->do_cmdtest = pcl816_ai_cmdtest; s->do_cmd = pcl816_ai_cmd; @@ -1221,25 +1222,25 @@ no_dma: #if 0 case COMEDI_SUBD_AO: s->subdev_flags = SDF_WRITABLE | SDF_GROUND; - s->n_chan = this_board->n_aochan; - s->maxdata = this_board->ao_maxdata; - s->len_chanlist = this_board->ao_chanlist; - s->range_table = this_board->ao_range_type; + s->n_chan = board->n_aochan; + s->maxdata = board->ao_maxdata; + s->len_chanlist = board->ao_chanlist; + s->range_table = board->ao_range_type; break; case COMEDI_SUBD_DI: s->subdev_flags = SDF_READABLE; - s->n_chan = this_board->n_dichan; + s->n_chan = board->n_dichan; s->maxdata = 1; - s->len_chanlist = this_board->n_dichan; + s->len_chanlist = board->n_dichan; s->range_table = &range_digital; break; case COMEDI_SUBD_DO: s->subdev_flags = SDF_WRITABLE; - s->n_chan = this_board->n_dochan; + s->n_chan = board->n_dochan; s->maxdata = 1; - s->len_chanlist = this_board->n_dochan; + s->len_chanlist = board->n_dochan; s->range_table = &range_digital; break; #endif @@ -1253,6 +1254,8 @@ case COMEDI_SUBD_DO: static void pcl816_detach(struct comedi_device *dev) { + const struct pcl816_board *board = comedi_board(dev); + if (dev->private) { pcl816_ai_cancel(dev, devpriv->sub_ai); pcl816_reset(dev); @@ -1275,7 +1278,7 @@ static void pcl816_detach(struct comedi_device *dev) if (dev->irq) free_irq(dev->irq, dev); if (dev->iobase) - release_region(dev->iobase, this_board->io_range); + release_region(dev->iobase, board->io_range); #ifdef unused if (devpriv->dma_rtc) RTC_lock--; -- cgit v0.10.2 From 3cb08e08fbeab09fa5f3ba1cf27176dd41f5b70f Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 17:09:03 -0700 Subject: staging: comedi: remove this_board macro in the pcl812 driver The 'this_board' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/pcl812.c b/drivers/staging/comedi/drivers/pcl812.c index 51f4ca9..28780ed 100644 --- a/drivers/staging/comedi/drivers/pcl812.c +++ b/drivers/staging/comedi/drivers/pcl812.c @@ -336,8 +336,6 @@ struct pcl812_board { unsigned char haveMPC508; /* 1=board use MPC508A multiplexor */ }; -#define this_board ((const struct pcl812_board *)dev->board_ptr) - struct pcl812_private { unsigned char valid; /* =1 device is OK */ @@ -560,6 +558,7 @@ static void pcl812_cmdtest_out(int e, struct comedi_cmd *cmd) static int pcl812_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { + const struct pcl812_board *board = comedi_board(dev); int err = 0; int tmp, divisor1, divisor2; @@ -666,8 +665,8 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev, } if (cmd->convert_src == TRIG_TIMER) { - if (cmd->convert_arg < this_board->ai_ns_min) { - cmd->convert_arg = this_board->ai_ns_min; + if (cmd->convert_arg < board->ai_ns_min) { + cmd->convert_arg = board->ai_ns_min; err++; } } else { /* TRIG_EXT */ @@ -682,7 +681,7 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev, err++; } if (cmd->chanlist_len > MAX_CHANLIST_LEN) { - cmd->chanlist_len = this_board->n_aichan; + cmd->chanlist_len = board->n_aichan; err++; } if (cmd->scan_end_arg != cmd->chanlist_len) { @@ -715,11 +714,11 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev, if (cmd->convert_src == TRIG_TIMER) { tmp = cmd->convert_arg; - i8253_cascade_ns_to_timer(this_board->i8254_osc_base, &divisor1, + i8253_cascade_ns_to_timer(board->i8254_osc_base, &divisor1, &divisor2, &cmd->convert_arg, cmd->flags & TRIG_ROUND_MASK); - if (cmd->convert_arg < this_board->ai_ns_min) - cmd->convert_arg = this_board->ai_ns_min; + if (cmd->convert_arg < board->ai_ns_min) + cmd->convert_arg = board->ai_ns_min; if (tmp != cmd->convert_arg) err++; } @@ -741,6 +740,7 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev, */ static int pcl812_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { + const struct pcl812_board *board = comedi_board(dev); unsigned int divisor1 = 0, divisor2 = 0, i, dma_flags, bytes; struct comedi_cmd *cmd = &s->async->cmd; @@ -767,9 +767,9 @@ static int pcl812_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) return -EINVAL; if (cmd->convert_src == TRIG_TIMER) { - if (cmd->convert_arg < this_board->ai_ns_min) - cmd->convert_arg = this_board->ai_ns_min; - i8253_cascade_ns_to_timer(this_board->i8254_osc_base, + if (cmd->convert_arg < board->ai_ns_min) + cmd->convert_arg = board->ai_ns_min; + i8253_cascade_ns_to_timer(board->i8254_osc_base, &divisor1, &divisor2, &cmd->convert_arg, cmd->flags & TRIG_ROUND_MASK); @@ -1192,6 +1192,7 @@ static void start_pacer(struct comedi_device *dev, int mode, */ static void free_resources(struct comedi_device *dev) { + const struct pcl812_board *board = comedi_board(dev); if (dev->private) { if (devpriv->dmabuf[0]) @@ -1204,7 +1205,7 @@ static void free_resources(struct comedi_device *dev) if (dev->irq) free_irq(dev->irq, dev); if (dev->iobase) - release_region(dev->iobase, this_board->io_range); + release_region(dev->iobase, board->io_range); } /* @@ -1234,6 +1235,8 @@ static int pcl812_ai_cancel(struct comedi_device *dev, */ static void pcl812_reset(struct comedi_device *dev) { + const struct pcl812_board *board = comedi_board(dev); + #ifdef PCL812_EXTDEBUG printk(KERN_DEBUG "pcl812 EDBG: BGN: pcl812_reset(...)\n"); #endif @@ -1242,7 +1245,7 @@ static void pcl812_reset(struct comedi_device *dev) devpriv->old_chan_reg = -1; /* invalidate chain/gain memory */ devpriv->old_gain_reg = -1; - switch (this_board->board_type) { + switch (board->board_type) { case boardPCL812PG: case boardPCL812: case boardACL8112: @@ -1273,6 +1276,7 @@ static void pcl812_reset(struct comedi_device *dev) static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct pcl812_board *board = comedi_board(dev); int ret, subdev; unsigned long iobase; unsigned int irq; @@ -1283,9 +1287,9 @@ static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it) iobase = it->options[0]; printk(KERN_INFO "comedi%d: pcl812: board=%s, ioport=0x%03lx", - dev->minor, this_board->name, iobase); + dev->minor, board->name, iobase); - if (!request_region(iobase, this_board->io_range, "pcl812")) { + if (!request_region(iobase, board->io_range, "pcl812")) { printk("I/O port conflict\n"); return -EIO; } @@ -1297,13 +1301,13 @@ static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it) return ret; /* Can't alloc mem */ } - dev->board_name = this_board->name; + dev->board_name = board->name; irq = 0; - if (this_board->IRQbits != 0) { /* board support IRQ */ + if (board->IRQbits != 0) { /* board support IRQ */ irq = it->options[1]; if (irq) { /* we want to use IRQ */ - if (((1 << irq) & this_board->IRQbits) == 0) { + if (((1 << irq) & board->IRQbits) == 0) { printk (", IRQ %u is out of allowed range, " "DISABLING IT", irq); @@ -1328,9 +1332,9 @@ static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->dma = dma; if (!dev->irq) goto no_dma; /* if we haven't IRQ, we can't use DMA */ - if (this_board->DMAbits != 0) { /* board support DMA */ + if (board->DMAbits != 0) { /* board support DMA */ dma = it->options[2]; - if (((1 << dma) & this_board->DMAbits) == 0) { + if (((1 << dma) & board->DMAbits) == 0) { printk(", DMA is out of allowed range, FAIL!\n"); return -EINVAL; /* Bad DMA */ } @@ -1369,13 +1373,13 @@ static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it) no_dma: n_subdevices = 0; - if (this_board->n_aichan > 0) + if (board->n_aichan > 0) n_subdevices++; - if (this_board->n_aochan > 0) + if (board->n_aochan > 0) n_subdevices++; - if (this_board->n_dichan > 0) + if (board->n_dichan > 0) n_subdevices++; - if (this_board->n_dochan > 0) + if (board->n_dochan > 0) n_subdevices++; ret = alloc_subdevices(dev, n_subdevices); @@ -1387,46 +1391,46 @@ no_dma: subdev = 0; /* analog input */ - if (this_board->n_aichan > 0) { + if (board->n_aichan > 0) { s = dev->subdevices + subdev; s->type = COMEDI_SUBD_AI; s->subdev_flags = SDF_READABLE; - switch (this_board->board_type) { + switch (board->board_type) { case boardA821: if (it->options[2] == 1) { - s->n_chan = this_board->n_aichan_diff; + s->n_chan = board->n_aichan_diff; s->subdev_flags |= SDF_DIFF; devpriv->use_diff = 1; } else { - s->n_chan = this_board->n_aichan; + s->n_chan = board->n_aichan; s->subdev_flags |= SDF_GROUND; } break; case boardACL8112: case boardACL8216: if (it->options[4] == 1) { - s->n_chan = this_board->n_aichan_diff; + s->n_chan = board->n_aichan_diff; s->subdev_flags |= SDF_DIFF; devpriv->use_diff = 1; } else { - s->n_chan = this_board->n_aichan; + s->n_chan = board->n_aichan; s->subdev_flags |= SDF_GROUND; } break; default: - s->n_chan = this_board->n_aichan; + s->n_chan = board->n_aichan; s->subdev_flags |= SDF_GROUND; break; } - s->maxdata = this_board->ai_maxdata; + s->maxdata = board->ai_maxdata; s->len_chanlist = MAX_CHANLIST_LEN; - s->range_table = this_board->rangelist_ai; - if (this_board->board_type == boardACL8216) + s->range_table = board->rangelist_ai; + if (board->board_type == boardACL8216) s->insn_read = acl8216_ai_insn_read; else s->insn_read = pcl812_ai_insn_read; - devpriv->use_MPC = this_board->haveMPC508; + devpriv->use_MPC = board->haveMPC508; s->cancel = pcl812_ai_cancel; if (dev->irq) { dev->read_subdev = s; @@ -1435,7 +1439,7 @@ no_dma: s->do_cmd = pcl812_ai_cmd; s->poll = pcl812_ai_poll; } - switch (this_board->board_type) { + switch (board->board_type) { case boardPCL812PG: if (it->options[4] == 1) s->range_table = &range_pcl812pg2_ai; @@ -1529,17 +1533,17 @@ no_dma: } /* analog output */ - if (this_board->n_aochan > 0) { + if (board->n_aochan > 0) { s = dev->subdevices + subdev; s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_WRITABLE | SDF_GROUND; - s->n_chan = this_board->n_aochan; + s->n_chan = board->n_aochan; s->maxdata = 0xfff; s->len_chanlist = 1; - s->range_table = this_board->rangelist_ao; + s->range_table = board->rangelist_ao; s->insn_read = pcl812_ao_insn_read; s->insn_write = pcl812_ao_insn_write; - switch (this_board->board_type) { + switch (board->board_type) { case boardA821: if (it->options[3] == 1) s->range_table = &range_unipolar10; @@ -1558,32 +1562,32 @@ no_dma: } /* digital input */ - if (this_board->n_dichan > 0) { + if (board->n_dichan > 0) { s = dev->subdevices + subdev; s->type = COMEDI_SUBD_DI; s->subdev_flags = SDF_READABLE; - s->n_chan = this_board->n_dichan; + s->n_chan = board->n_dichan; s->maxdata = 1; - s->len_chanlist = this_board->n_dichan; + s->len_chanlist = board->n_dichan; s->range_table = &range_digital; s->insn_bits = pcl812_di_insn_bits; subdev++; } /* digital output */ - if (this_board->n_dochan > 0) { + if (board->n_dochan > 0) { s = dev->subdevices + subdev; s->type = COMEDI_SUBD_DO; s->subdev_flags = SDF_WRITABLE; - s->n_chan = this_board->n_dochan; + s->n_chan = board->n_dochan; s->maxdata = 1; - s->len_chanlist = this_board->n_dochan; + s->len_chanlist = board->n_dochan; s->range_table = &range_digital; s->insn_bits = pcl812_do_insn_bits; subdev++; } - switch (this_board->board_type) { + switch (board->board_type) { case boardACL8216: devpriv->ai_is16b = 1; case boardPCL812PG: -- cgit v0.10.2 From 6f929aeb175fd634f5d1ea54c045cf632a052557 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 17:03:19 -0700 Subject: staging: comedi: remove this_board macro in the pcl730 driver The 'this_board' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/pcl730.c b/drivers/staging/comedi/drivers/pcl730.c index e11704a..02a4386 100644 --- a/drivers/staging/comedi/drivers/pcl730.c +++ b/drivers/staging/comedi/drivers/pcl730.c @@ -32,8 +32,6 @@ struct pcl730_board { unsigned int io_range; /* len of I/O space */ }; -#define this_board ((const struct pcl730_board *)dev->board_ptr) - static int pcl730_do_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { @@ -70,19 +68,20 @@ static int pcl730_di_insn(struct comedi_device *dev, struct comedi_subdevice *s, static int pcl730_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct pcl730_board *board = comedi_board(dev); struct comedi_subdevice *s; unsigned long iobase; unsigned int iorange; iobase = it->options[0]; - iorange = this_board->io_range; + iorange = board->io_range; printk(KERN_INFO "comedi%d: pcl730: board=%s 0x%04lx ", dev->minor, - this_board->name, iobase); + board->name, iobase); if (!request_region(iobase, iorange, "pcl730")) { printk("I/O port conflict\n"); return -EIO; } - dev->board_name = this_board->name; + dev->board_name = board->name; dev->iobase = iobase; dev->irq = 0; @@ -136,8 +135,10 @@ static int pcl730_attach(struct comedi_device *dev, struct comedi_devconfig *it) static void pcl730_detach(struct comedi_device *dev) { + const struct pcl730_board *board = comedi_board(dev); + if (dev->iobase) - release_region(dev->iobase, this_board->io_range); + release_region(dev->iobase, board->io_range); } static const struct pcl730_board boardtypes[] = { -- cgit v0.10.2 From d877269ed3c539b4cfcd738b5e705267d95bd5fd Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 16:59:57 -0700 Subject: staging: comedi: remove this_board macro in the pcl726 driver The 'this_board' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/pcl726.c b/drivers/staging/comedi/drivers/pcl726.c index d25c30c..e9449bb 100644 --- a/drivers/staging/comedi/drivers/pcl726.c +++ b/drivers/staging/comedi/drivers/pcl726.c @@ -145,8 +145,6 @@ static const struct pcl726_board boardtypes[] = { &rangelist_728[0],}, }; -#define this_board ((const struct pcl726_board *)dev->board_ptr) - struct pcl726_private { int bipolar[12]; @@ -197,11 +195,13 @@ static int pcl726_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + const struct pcl726_board *board = comedi_board(dev); + if (insn->n != 2) return -EINVAL; - data[1] = inb(dev->iobase + this_board->di_lo) | - (inb(dev->iobase + this_board->di_hi) << 8); + data[1] = inb(dev->iobase + board->di_lo) | + (inb(dev->iobase + board->di_hi) << 8); return 2; } @@ -210,6 +210,8 @@ static int pcl726_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + const struct pcl726_board *board = comedi_board(dev); + if (insn->n != 2) return -EINVAL; @@ -218,9 +220,9 @@ static int pcl726_do_insn_bits(struct comedi_device *dev, s->state |= data[0] & data[1]; } if (data[1] & 0x00ff) - outb(s->state & 0xff, dev->iobase + this_board->do_lo); + outb(s->state & 0xff, dev->iobase + board->do_lo); if (data[1] & 0xff00) - outb((s->state >> 8), dev->iobase + this_board->do_hi); + outb((s->state >> 8), dev->iobase + board->do_hi); data[1] = s->state; @@ -229,6 +231,7 @@ static int pcl726_do_insn_bits(struct comedi_device *dev, static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct pcl726_board *board = comedi_board(dev); struct comedi_subdevice *s; unsigned long iobase; unsigned int iorange; @@ -238,9 +241,9 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it) #endif iobase = it->options[0]; - iorange = this_board->io_range; + iorange = board->io_range; printk(KERN_WARNING "comedi%d: pcl726: board=%s, 0x%03lx ", dev->minor, - this_board->name, iobase); + board->name, iobase); if (!request_region(iobase, iorange, "pcl726")) { printk(KERN_WARNING "I/O port conflict\n"); return -EIO; @@ -248,7 +251,7 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->iobase = iobase; - dev->board_name = this_board->name; + dev->board_name = board->name; ret = alloc_private(dev, sizeof(struct pcl726_private)); if (ret < 0) @@ -297,23 +300,23 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* ao */ s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_WRITABLE | SDF_GROUND; - s->n_chan = this_board->n_aochan; + s->n_chan = board->n_aochan; s->maxdata = 0xfff; s->len_chanlist = 1; s->insn_write = pcl726_ao_insn; s->insn_read = pcl726_ao_insn_read; s->range_table_list = devpriv->rangelist; - for (i = 0; i < this_board->n_aochan; i++) { + for (i = 0; i < board->n_aochan; i++) { int j; j = it->options[2 + 1]; - if ((j < 0) || (j >= this_board->num_of_ranges)) { + if ((j < 0) || (j >= board->num_of_ranges)) { printk ("Invalid range for channel %d! Must be 0<=%d<%d\n", - i, j, this_board->num_of_ranges - 1); + i, j, board->num_of_ranges - 1); j = 0; } - devpriv->rangelist[i] = this_board->range_type_list[j]; + devpriv->rangelist[i] = board->range_type_list[j]; if (devpriv->rangelist[i]->range[0].min == -devpriv->rangelist[i]->range[0].max) devpriv->bipolar[i] = 1; /* bipolar range */ @@ -321,7 +324,7 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it) s = dev->subdevices + 1; /* di */ - if (!this_board->have_dio) { + if (!board->have_dio) { s->type = COMEDI_SUBD_UNUSED; } else { s->type = COMEDI_SUBD_DI; @@ -335,7 +338,7 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it) s = dev->subdevices + 2; /* do */ - if (!this_board->have_dio) { + if (!board->have_dio) { s->type = COMEDI_SUBD_UNUSED; } else { s->type = COMEDI_SUBD_DO; @@ -352,12 +355,14 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it) static void pcl726_detach(struct comedi_device *dev) { + const struct pcl726_board *board = comedi_board(dev); + #ifdef ACL6126_IRQ if (dev->irq) free_irq(dev->irq, dev); #endif if (dev->iobase) - release_region(dev->iobase, this_board->io_range); + release_region(dev->iobase, board->io_range); } static struct comedi_driver pcl726_driver = { -- cgit v0.10.2 From f21b15be885ca3e14199773c9a9f52c90804fdb9 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 16:55:37 -0700 Subject: staging: comedi: remove this_board macro in the pcl724 driver The 'this_board' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/pcl724.c b/drivers/staging/comedi/drivers/pcl724.c index 1f66fe1..4136a03 100644 --- a/drivers/staging/comedi/drivers/pcl724.c +++ b/drivers/staging/comedi/drivers/pcl724.c @@ -67,8 +67,6 @@ struct pcl724_board { char is_pet48; }; -#define this_board ((const struct pcl724_board *)dev->board_ptr) - static int subdev_8255_cb(int dir, int port, int data, unsigned long arg) { unsigned long iobase = arg; @@ -100,6 +98,7 @@ static int subdev_8255mapped_cb(int dir, int port, int data, static int pcl724_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct pcl724_board *board = comedi_board(dev); unsigned long iobase; unsigned int iorange; int ret, i, n_subdevices; @@ -108,12 +107,12 @@ static int pcl724_attach(struct comedi_device *dev, struct comedi_devconfig *it) #endif iobase = it->options[0]; - iorange = this_board->io_range; - if ((this_board->can_have96) && ((it->options[1] == 1) + iorange = board->io_range; + if ((board->can_have96) && ((it->options[1] == 1) || (it->options[1] == 96))) iorange = PCL722_96_SIZE; /* PCL-724 in 96 DIO configuration */ printk(KERN_INFO "comedi%d: pcl724: board=%s, 0x%03lx ", dev->minor, - this_board->name, iobase); + board->name, iobase); if (!request_region(iobase, iorange, "pcl724")) { printk("I/O port conflict\n"); return -EIO; @@ -121,14 +120,14 @@ static int pcl724_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->iobase = iobase; - dev->board_name = this_board->name; + dev->board_name = board->name; #ifdef PCL724_IRQ irq = 0; - if (this_board->IRQbits != 0) { /* board support IRQ */ + if (board->IRQbits != 0) { /* board support IRQ */ irq = it->options[1]; if (irq) { /* we want to use IRQ */ - if (((1 << irq) & this_board->IRQbits) == 0) { + if (((1 << irq) & board->IRQbits) == 0) { printk(KERN_WARNING ", IRQ %u is out of allowed range, " "DISABLING IT", irq); @@ -152,8 +151,8 @@ static int pcl724_attach(struct comedi_device *dev, struct comedi_devconfig *it) printk("\n"); - n_subdevices = this_board->numofports; - if ((this_board->can_have96) && ((it->options[1] == 1) + n_subdevices = board->numofports; + if ((board->can_have96) && ((it->options[1] == 1) || (it->options[1] == 96))) n_subdevices = 4; /* PCL-724 in 96 DIO configuration */ @@ -162,7 +161,7 @@ static int pcl724_attach(struct comedi_device *dev, struct comedi_devconfig *it) return ret; for (i = 0; i < dev->n_subdevices; i++) { - if (this_board->is_pet48) { + if (board->is_pet48) { subdev_8255_init(dev, dev->subdevices + i, subdev_8255mapped_cb, (unsigned long)(dev->iobase + @@ -179,6 +178,7 @@ static int pcl724_attach(struct comedi_device *dev, struct comedi_devconfig *it) static void pcl724_detach(struct comedi_device *dev) { + const struct pcl724_board *board = comedi_board(dev); int i; for (i = 0; i < dev->n_subdevices; i++) @@ -187,7 +187,7 @@ static void pcl724_detach(struct comedi_device *dev) if (dev->irq) free_irq(dev->irq, dev); #endif - release_region(dev->iobase, this_board->io_range); + release_region(dev->iobase, board->io_range); } static const struct pcl724_board boardtypes[] = { -- cgit v0.10.2 From 90d662e3f1b42145f6d1ae9e58a423c859ed284d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 16:52:00 -0700 Subject: staging: comedi: remove this_board macro in the pcl711 driver The 'this_board' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/pcl711.c b/drivers/staging/comedi/drivers/pcl711.c index 2e7753f..e943b52 100644 --- a/drivers/staging/comedi/drivers/pcl711.c +++ b/drivers/staging/comedi/drivers/pcl711.c @@ -148,8 +148,6 @@ struct pcl711_board { const struct comedi_lrange *ai_range_type; }; -#define this_board ((const struct pcl711_board *)dev->board_ptr) - struct pcl711_private { int board; @@ -169,6 +167,7 @@ static irqreturn_t pcl711_interrupt(int irq, void *d) int lo, hi; int data; struct comedi_device *dev = d; + const struct pcl711_board *board = comedi_board(dev); struct comedi_subdevice *s = dev->subdevices + 0; if (!dev->attached) { @@ -184,7 +183,7 @@ static irqreturn_t pcl711_interrupt(int irq, void *d) /* FIXME! Nothing else sets ntrig! */ if (!(--devpriv->ntrig)) { - if (this_board->is_8112) + if (board->is_8112) outb(1, dev->iobase + PCL711_MODE); else outb(0, dev->iobase + PCL711_MODE); @@ -197,13 +196,14 @@ static irqreturn_t pcl711_interrupt(int irq, void *d) static void pcl711_set_changain(struct comedi_device *dev, int chan) { + const struct pcl711_board *board = comedi_board(dev); int chan_register; outb(CR_RANGE(chan), dev->iobase + PCL711_GAIN); chan_register = CR_CHAN(chan); - if (this_board->is_8112) { + if (board->is_8112) { /* * Set the correct channel. The two channel banks are switched @@ -225,6 +225,7 @@ static void pcl711_set_changain(struct comedi_device *dev, int chan) static int pcl711_ai_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + const struct pcl711_board *board = comedi_board(dev); int i, n; int hi, lo; @@ -237,7 +238,7 @@ static int pcl711_ai_insn(struct comedi_device *dev, struct comedi_subdevice *s, */ outb(1, dev->iobase + PCL711_MODE); - if (!this_board->is_8112) + if (!board->is_8112) outb(0, dev->iobase + PCL711_SOFTTRIG); i = PCL711_TIMEOUT; @@ -481,6 +482,7 @@ static int pcl711_do_insn_bits(struct comedi_device *dev, static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct pcl711_board *board = comedi_board(dev); int ret; unsigned long iobase; unsigned int irq; @@ -498,12 +500,11 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* there should be a sanity check here */ - /* set up some name stuff */ - dev->board_name = this_board->name; + dev->board_name = board->name; /* grab our IRQ */ irq = it->options[1]; - if (irq > this_board->maxirq) { + if (irq > board->maxirq) { printk(KERN_ERR "irq out of range\n"); return -EINVAL; } @@ -529,10 +530,10 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* AI subdevice */ s->type = COMEDI_SUBD_AI; s->subdev_flags = SDF_READABLE | SDF_GROUND; - s->n_chan = this_board->n_aichan; + s->n_chan = board->n_aichan; s->maxdata = 0xfff; s->len_chanlist = 1; - s->range_table = this_board->ai_range_type; + s->range_table = board->ai_range_type; s->insn_read = pcl711_ai_insn; if (irq) { dev->read_subdev = s; @@ -545,7 +546,7 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* AO subdevice */ s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_WRITABLE; - s->n_chan = this_board->n_aochan; + s->n_chan = board->n_aochan; s->maxdata = 0xfff; s->len_chanlist = 1; s->range_table = &range_bipolar5; @@ -577,7 +578,7 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it) this is the "base value" for the mode register, which is used for the irq on the PCL711 */ - if (this_board->is_pcl711b) + if (board->is_pcl711b) devpriv->mode = (dev->irq << 4); /* clear DAC */ -- cgit v0.10.2 From 27b40b89e83aa3db99e392694c46b053ad804bba Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 16:46:07 -0700 Subject: staging: comedi: remove boardtype macro in the ni_atmio16d driver The 'boardtype' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_atmio16d.c b/drivers/staging/comedi/drivers/ni_atmio16d.c index 4f61453..a0890ee 100644 --- a/drivers/staging/comedi/drivers/ni_atmio16d.c +++ b/drivers/staging/comedi/drivers/ni_atmio16d.c @@ -110,8 +110,6 @@ struct atmio16_board_t { int has_8255; }; -#define boardtype ((const struct atmio16_board_t *)dev->board_ptr) - /* range structs */ static const struct comedi_lrange range_atmio16d_ai_10_bipolar = { 4, { BIP_RANGE @@ -693,6 +691,7 @@ static int atmio16d_dio_insn_config(struct comedi_device *dev, static int atmio16d_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct atmio16_board_t *board = comedi_board(dev); unsigned int irq; unsigned long iobase; int ret; @@ -708,8 +707,7 @@ static int atmio16d_attach(struct comedi_device *dev, } dev->iobase = iobase; - /* board name */ - dev->board_name = boardtype->name; + dev->board_name = board->name; ret = alloc_subdevices(dev, 4); if (ret < 0) @@ -811,7 +809,7 @@ static int atmio16d_attach(struct comedi_device *dev, /* 8255 subdevice */ s++; - if (boardtype->has_8255) + if (board->has_8255) subdev_8255_init(dev, s, NULL, dev->iobase); else s->type = COMEDI_SUBD_UNUSED; @@ -831,7 +829,9 @@ static int atmio16d_attach(struct comedi_device *dev, static void atmio16d_detach(struct comedi_device *dev) { - if (dev->subdevices && boardtype->has_8255) + const struct atmio16_board_t *board = comedi_board(dev); + + if (dev->subdevices && board->has_8255) subdev_8255_cleanup(dev, dev->subdevices + 3); if (dev->irq) free_irq(dev->irq, dev); -- cgit v0.10.2 From 75b9ad9e902a51edc90cfcb4dd84c53683554de2 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 16:41:39 -0700 Subject: staging: comedi: remove thisboard macro in the ni_at_ao driver The 'thisboard' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_at_ao.c b/drivers/staging/comedi/drivers/ni_at_ao.c index c43dd8a..bfe7fb7 100644 --- a/drivers/staging/comedi/drivers/ni_at_ao.c +++ b/drivers/staging/comedi/drivers/ni_at_ao.c @@ -157,8 +157,6 @@ struct atao_board { int n_ao_chans; }; -#define thisboard ((struct atao_board *)dev->board_ptr) - struct atao_private { unsigned short cfg1; @@ -335,6 +333,7 @@ static int atao_calib_insn_write(struct comedi_device *dev, static int atao_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct atao_board *board = comedi_board(dev); struct comedi_subdevice *s; unsigned long iobase; int ao_unipolar; @@ -352,9 +351,7 @@ static int atao_attach(struct comedi_device *dev, struct comedi_devconfig *it) } dev->iobase = iobase; - /* dev->board_ptr = atao_probe(dev); */ - - dev->board_name = thisboard->name; + dev->board_name = board->name; if (alloc_private(dev, sizeof(struct atao_private)) < 0) return -ENOMEM; @@ -366,7 +363,7 @@ static int atao_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* analog output subdevice */ s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_WRITABLE; - s->n_chan = thisboard->n_ao_chans; + s->n_chan = board->n_ao_chans; s->maxdata = (1 << 12) - 1; if (ao_unipolar) s->range_table = &range_unipolar10; -- cgit v0.10.2 From 061319698271bc80155cf3a67f0d5afed4024705 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 16:33:51 -0700 Subject: staging: comedi: remove this_board macro in the dt282x driver The 'this_board' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c index 736d8fa..eefda3c 100644 --- a/drivers/staging/comedi/drivers/dt282x.c +++ b/drivers/staging/comedi/drivers/dt282x.c @@ -221,8 +221,6 @@ struct dt282x_board { int dabits; }; -#define this_board ((const struct dt282x_board *)dev->board_ptr) - struct dt282x_private { int ad_2scomp; /* we have 2's comp jumper set */ int da0_2scomp; /* same, for DAC0 */ @@ -580,6 +578,7 @@ static int dt282x_ai_insn_read(struct comedi_device *dev, static int dt282x_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { + const struct dt282x_board *board = comedi_board(dev); int err = 0; int tmp; @@ -658,8 +657,8 @@ static int dt282x_ai_cmdtest(struct comedi_device *dev, cmd->convert_arg = SLOWEST_TIMER; err++; } - if (cmd->convert_arg < this_board->ai_speed) { - cmd->convert_arg = this_board->ai_speed; + if (cmd->convert_arg < board->ai_speed) { + cmd->convert_arg = board->ai_speed; err++; } if (cmd->scan_end_arg != cmd->chanlist_len) { @@ -694,6 +693,7 @@ static int dt282x_ai_cmdtest(struct comedi_device *dev, static int dt282x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { + const struct dt282x_board *board = comedi_board(dev); struct comedi_cmd *cmd = &s->async->cmd; int timer; @@ -706,8 +706,8 @@ static int dt282x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) dt282x_disable_dma(dev); - if (cmd->convert_arg < this_board->ai_speed) - cmd->convert_arg = this_board->ai_speed; + if (cmd->convert_arg < board->ai_speed) + cmd->convert_arg = board->ai_speed; timer = dt282x_ns_to_timer(&cmd->convert_arg, TRIG_ROUND_NEAREST); outw(timer, dev->iobase + DT2821_TMRCTR); @@ -1176,12 +1176,13 @@ static int dt282x_grab_dma(struct comedi_device *dev, int dma1, int dma2) */ static int dt282x_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct dt282x_board *board = comedi_board(dev); int i, irq; int ret; struct comedi_subdevice *s; unsigned long iobase; - dev->board_name = this_board->name; + dev->board_name = board->name; iobase = it->options[opt_iobase]; if (!iobase) -- cgit v0.10.2 From 5a011d61ed5ca531470493acf19756fc4e894675 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 16:28:02 -0700 Subject: staging: comedi: remove this_board macro in the dt2811 driver The 'this_board' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index 106ffea..727da9e 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -211,8 +211,6 @@ struct dt2811_board { const struct comedi_lrange *unip_5; }; -#define this_board ((const struct dt2811_board *)dev->board_ptr) - enum { card_2811_pgh, card_2811_pgl }; struct dt2811_private { @@ -404,6 +402,7 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* unsigned long irqs; */ /* long flags; */ + const struct dt2811_board *board = comedi_board(dev); int ret; struct comedi_subdevice *s; unsigned long iobase; @@ -418,7 +417,7 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) } dev->iobase = iobase; - dev->board_name = this_board->name; + dev->board_name = board->name; #if 0 outb(0, dev->iobase + DT2811_ADCSR); @@ -527,13 +526,13 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) switch (it->options[3]) { case 0: default: - s->range_table = this_board->bip_5; + s->range_table = board->bip_5; break; case 1: - s->range_table = this_board->bip_2_5; + s->range_table = board->bip_2_5; break; case 2: - s->range_table = this_board->unip_5; + s->range_table = board->unip_5; break; } -- cgit v0.10.2 From df9d33493474a342c866119c28204e0a790de5c0 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 16:23:09 -0700 Subject: staging: comedi: remove thisboard macro in the dmm32at driver The 'thisboard' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c index 8382890..5be99b5 100644 --- a/drivers/staging/comedi/drivers/dmm32at.c +++ b/drivers/staging/comedi/drivers/dmm32at.c @@ -189,11 +189,6 @@ static const struct dmm32at_board dmm32at_boards[] = { }, }; -/* - * Useful for shorthand access to the particular board structure - */ -#define thisboard ((const struct dmm32at_board *)dev->board_ptr) - /* this structure is for data unique to this hardware driver. If * several hardware drivers keep similar information in this structure, * feel free to suggest moving the variable to the struct comedi_device struct. @@ -290,6 +285,7 @@ void dmm32at_setaitimer(struct comedi_device *dev, unsigned int nansec); static int dmm32at_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct dmm32at_board *board = comedi_board(dev); int ret; struct comedi_subdevice *s; unsigned char aihi, ailo, fifostat, aistat, intstat, airback; @@ -304,7 +300,7 @@ static int dmm32at_attach(struct comedi_device *dev, iobase, irq); /* register address space */ - if (!request_region(iobase, DMM32AT_MEMSIZE, thisboard->name)) { + if (!request_region(iobase, DMM32AT_MEMSIZE, board->name)) { printk(KERN_ERR "comedi%d: dmm32at: I/O port conflict\n", dev->minor); return -EIO; @@ -358,7 +354,7 @@ static int dmm32at_attach(struct comedi_device *dev, /* board is there, register interrupt */ if (irq) { - ret = request_irq(irq, dmm32at_isr, 0, thisboard->name, dev); + ret = request_irq(irq, dmm32at_isr, 0, board->name, dev); if (ret < 0) { printk(KERN_ERR "dmm32at: irq conflict\n"); return ret; @@ -366,18 +362,7 @@ static int dmm32at_attach(struct comedi_device *dev, dev->irq = irq; } -/* - * If you can probe the device to determine what device in a series - * it is, this is the place to do it. Otherwise, dev->board_ptr - * should already be initialized. - */ - /* dev->board_ptr = dmm32at_probe(dev); */ - -/* - * Initialize dev->board_name. Note that we can use the "thisboard" - * macro now, since we just initialized it in the last line. - */ - dev->board_name = thisboard->name; + dev->board_name = board->name; /* * Allocate the private structure area. alloc_private() is a @@ -399,9 +384,9 @@ static int dmm32at_attach(struct comedi_device *dev, s->type = COMEDI_SUBD_AI; /* we support single-ended (ground) and differential */ s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF | SDF_CMD_READ; - s->n_chan = thisboard->ai_chans; - s->maxdata = (1 << thisboard->ai_bits) - 1; - s->range_table = thisboard->ai_ranges; + s->n_chan = board->ai_chans; + s->maxdata = (1 << board->ai_bits) - 1; + s->range_table = board->ai_ranges; s->len_chanlist = 32; /* This is the maximum chanlist length that the board can handle */ s->insn_read = dmm32at_ai_rinsn; @@ -413,15 +398,15 @@ static int dmm32at_attach(struct comedi_device *dev, /* analog output subdevice */ s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_WRITABLE; - s->n_chan = thisboard->ao_chans; - s->maxdata = (1 << thisboard->ao_bits) - 1; - s->range_table = thisboard->ao_ranges; + s->n_chan = board->ao_chans; + s->maxdata = (1 << board->ao_bits) - 1; + s->range_table = board->ao_ranges; s->insn_write = dmm32at_ao_winsn; s->insn_read = dmm32at_ao_rinsn; s = dev->subdevices + 2; /* digital i/o subdevice */ - if (thisboard->have_dio) { + if (board->have_dio) { /* get access to the DIO regs */ dmm_outb(dev, DMM32AT_CNTRL, DMM32AT_DIOACC); @@ -433,7 +418,7 @@ static int dmm32at_attach(struct comedi_device *dev, /* set up the subdevice */ s->type = COMEDI_SUBD_DIO; s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = thisboard->dio_chans; + s->n_chan = board->dio_chans; s->maxdata = 1; s->state = 0; s->range_table = &range_digital; -- cgit v0.10.2 From 4c354b492eeb257e65886329ba5acfb1fde81dec Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 16:13:38 -0700 Subject: staging: comedi: remove thisboard macro in the das16m1 driver The 'thisboard' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das16m1.c b/drivers/staging/comedi/drivers/das16m1.c index d2e1490..e468ff1 100644 --- a/drivers/staging/comedi/drivers/das16m1.c +++ b/drivers/staging/comedi/drivers/das16m1.c @@ -150,7 +150,6 @@ struct das16m1_private_struct { unsigned int divisor2; /* divides master clock to obtain conversion speed */ }; #define devpriv ((struct das16m1_private_struct *)(dev->private)) -#define thisboard ((const struct das16m1_board *)(dev->board_ptr)) static inline short munge_sample(short data) { @@ -168,6 +167,7 @@ static void munge_sample_array(short *array, unsigned int num_elements) static int das16m1_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { + const struct das16m1_board *board = comedi_board(dev); unsigned int err = 0, tmp, i; /* make sure triggers are valid */ @@ -225,8 +225,8 @@ static int das16m1_cmd_test(struct comedi_device *dev, } if (cmd->convert_src == TRIG_TIMER) { - if (cmd->convert_arg < thisboard->ai_speed) { - cmd->convert_arg = thisboard->ai_speed; + if (cmd->convert_arg < board->ai_speed) { + cmd->convert_arg = board->ai_speed; err++; } } @@ -600,6 +600,7 @@ static int das16m1_irq_bits(unsigned int irq) static int das16m1_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct das16m1_board *board = comedi_board(dev); struct comedi_subdevice *s; int ret; unsigned int irq; @@ -611,7 +612,7 @@ static int das16m1_attach(struct comedi_device *dev, if (ret < 0) return ret; - dev->board_name = thisboard->name; + dev->board_name = board->name; if (!request_region(iobase, DAS16M1_SIZE, dev->driver->driver_name)) { comedi_error(dev, "I/O port conflict\n"); -- cgit v0.10.2 From d493f213ab2bfcc41792f904abee75ecfd6afc10 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 16:09:58 -0700 Subject: staging: comedi: remove thisboard macro in the das16 driver The 'thisboard' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c index 998444c..6170536 100644 --- a/drivers/staging/comedi/drivers/das16.c +++ b/drivers/staging/comedi/drivers/das16.c @@ -393,11 +393,11 @@ struct das16_private_struct { volatile short timer_mode; /* true if using timer mode */ }; #define devpriv ((struct das16_private_struct *)(dev->private)) -#define thisboard ((struct das16_board *)(dev->board_ptr)) static int das16_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { + const struct das16_board *board = comedi_board(dev); int err = 0, tmp; int gain, start_chan, i; int mask; @@ -411,7 +411,7 @@ static int das16_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, tmp = cmd->scan_begin_src; mask = TRIG_FOLLOW; /* if board supports burst mode */ - if (thisboard->size > 0x400) + if (board->size > 0x400) mask |= TRIG_TIMER | TRIG_EXT; cmd->scan_begin_src &= mask; if (!cmd->scan_begin_src || tmp != cmd->scan_begin_src) @@ -420,7 +420,7 @@ static int das16_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, tmp = cmd->convert_src; mask = TRIG_TIMER | TRIG_EXT; /* if board supports burst mode */ - if (thisboard->size > 0x400) + if (board->size > 0x400) mask |= TRIG_NOW; cmd->convert_src &= mask; if (!cmd->convert_src || tmp != cmd->convert_src) @@ -483,15 +483,15 @@ static int das16_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, /* check against maximum frequency */ if (cmd->scan_begin_src == TRIG_TIMER) { if (cmd->scan_begin_arg < - thisboard->ai_speed * cmd->chanlist_len) { + board->ai_speed * cmd->chanlist_len) { cmd->scan_begin_arg = - thisboard->ai_speed * cmd->chanlist_len; + board->ai_speed * cmd->chanlist_len; err++; } } if (cmd->convert_src == TRIG_TIMER) { - if (cmd->convert_arg < thisboard->ai_speed) { - cmd->convert_arg = thisboard->ai_speed; + if (cmd->convert_arg < board->ai_speed) { + cmd->convert_arg = board->ai_speed; err++; } } @@ -614,6 +614,7 @@ static unsigned int das16_set_pacer(struct comedi_device *dev, unsigned int ns, static int das16_cmd_exec(struct comedi_device *dev, struct comedi_subdevice *s) { + const struct das16_board *board = comedi_board(dev); struct comedi_async *async = s->async; struct comedi_cmd *cmd = &async->cmd; unsigned int byte; @@ -637,7 +638,7 @@ static int das16_cmd_exec(struct comedi_device *dev, struct comedi_subdevice *s) cmd->stop_arg * cmd->chanlist_len * sizeof(uint16_t); /* disable conversions for das1600 mode */ - if (thisboard->size > 0x400) + if (board->size > 0x400) outb(DAS1600_CONV_DISABLE, dev->iobase + DAS1600_CONV); /* set scan limits */ @@ -648,9 +649,9 @@ static int das16_cmd_exec(struct comedi_device *dev, struct comedi_subdevice *s) /* set gain (this is also burst rate register but according to * computer boards manual, burst rate does nothing, even on * keithley cards) */ - if (thisboard->ai_pg != das16_pg_none) { + if (board->ai_pg != das16_pg_none) { range = CR_RANGE(cmd->chanlist[0]); - outb((das16_gainlists[thisboard->ai_pg])[range], + outb((das16_gainlists[board->ai_pg])[range], dev->iobase + DAS16_GAIN); } @@ -663,7 +664,7 @@ static int das16_cmd_exec(struct comedi_device *dev, struct comedi_subdevice *s) /* enable counters */ byte = 0; /* Enable burst mode if appropriate. */ - if (thisboard->size > 0x400) { + if (board->size > 0x400) { if (cmd->convert_src == TRIG_NOW) { outb(DAS1600_BURST_VAL, dev->iobase + DAS1600_BURST); /* set burst length */ @@ -710,7 +711,7 @@ static int das16_cmd_exec(struct comedi_device *dev, struct comedi_subdevice *s) outb(devpriv->control_state, dev->iobase + DAS16_CONTROL); /* Enable conversions if using das1600 mode */ - if (thisboard->size > 0x400) + if (board->size > 0x400) outb(0, dev->iobase + DAS1600_CONV); @@ -719,6 +720,7 @@ static int das16_cmd_exec(struct comedi_device *dev, struct comedi_subdevice *s) static int das16_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { + const struct das16_board *board = comedi_board(dev); unsigned long flags; spin_lock_irqsave(&dev->spinlock, flags); @@ -735,7 +737,7 @@ static int das16_cancel(struct comedi_device *dev, struct comedi_subdevice *s) } /* disable burst mode */ - if (thisboard->size > 0x400) + if (board->size > 0x400) outb(0, dev->iobase + DAS1600_BURST); @@ -755,6 +757,7 @@ static void das16_reset(struct comedi_device *dev) static int das16_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + const struct das16_board *board = comedi_board(dev); int i, n; int range; int chan; @@ -770,9 +773,9 @@ static int das16_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, outb(chan, dev->iobase + DAS16_MUX); /* set gain */ - if (thisboard->ai_pg != das16_pg_none) { + if (board->ai_pg != das16_pg_none) { range = CR_RANGE(insn->chanspec); - outb((das16_gainlists[thisboard->ai_pg])[range], + outb((das16_gainlists[board->ai_pg])[range], dev->iobase + DAS16_GAIN); } @@ -790,7 +793,7 @@ static int das16_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, } msb = inb(dev->iobase + DAS16_AI_MSB); lsb = inb(dev->iobase + DAS16_AI_LSB); - if (thisboard->ai_nbits == 12) + if (board->ai_nbits == 12) data[n] = ((lsb >> 4) & 0xf) | (msb << 4); else data[n] = lsb | (msb << 8); @@ -835,6 +838,7 @@ static int das16_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, static int das16_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + const struct das16_board *board = comedi_board(dev); int i; int lsb, msb; int chan; @@ -842,7 +846,7 @@ static int das16_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, chan = CR_CHAN(insn->chanspec); for (i = 0; i < insn->n; i++) { - if (thisboard->ao_nbits == 12) { + if (board->ao_nbits == 12) { lsb = (data[i] << 4) & 0xff; msb = (data[i] >> 4) & 0xff; } else { @@ -892,6 +896,7 @@ static int disable_dma_on_even(struct comedi_device *dev) static void das16_interrupt(struct comedi_device *dev) { + const struct das16_board *board = comedi_board(dev); unsigned long dma_flags, spin_flags; struct comedi_subdevice *s = dev->read_subdev; struct comedi_async *async; @@ -953,7 +958,7 @@ static void das16_interrupt(struct comedi_device *dev) set_dma_count(devpriv->dma_chan, devpriv->dma_transfer_size); enable_dma(devpriv->dma_chan); /* reenable conversions for das1600 mode, (stupid hardware) */ - if (thisboard->size > 0x400 && devpriv->timer_mode == 0) + if (board->size > 0x400 && devpriv->timer_mode == 0) outb(0x00, dev->iobase + DAS1600_CONV); } @@ -1015,6 +1020,7 @@ static void reg_dump(struct comedi_device *dev) static int das16_probe(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct das16_board *board = comedi_board(dev); int status; int diobits; @@ -1039,9 +1045,9 @@ static int das16_probe(struct comedi_device *dev, struct comedi_devconfig *it) diobits = inb(dev->iobase + DAS16_DIO) & 0xf0; printk(KERN_INFO " id bits are 0x%02x\n", diobits); - if (thisboard->id != diobits) { + if (board->id != diobits) { printk(KERN_INFO " requested board's id bits are 0x%x (ignore)\n", - thisboard->id); + board->id); } return 0; @@ -1071,12 +1077,13 @@ static void das16_ai_munge(struct comedi_device *dev, unsigned int num_bytes, unsigned int start_chan_index) { + const struct das16_board *board = comedi_board(dev); unsigned int i, num_samples = num_bytes / sizeof(short); short *data = array; for (i = 0; i < num_samples; i++) { data[i] = le16_to_cpu(data[i]); - if (thisboard->ai_nbits == 12) + if (board->ai_nbits == 12) data[i] = (data[i] >> 4) & 0xfff; } @@ -1092,6 +1099,7 @@ static void das16_ai_munge(struct comedi_device *dev, */ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct das16_board *board = comedi_board(dev); struct comedi_subdevice *s; int ret; unsigned int irq; @@ -1130,9 +1138,9 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (ret < 0) return ret; - if (thisboard->size < 0x400) { - printk(" 0x%04lx-0x%04lx\n", iobase, iobase + thisboard->size); - if (!request_region(iobase, thisboard->size, "das16")) { + if (board->size < 0x400) { + printk(" 0x%04lx-0x%04lx\n", iobase, iobase + board->size); + if (!request_region(iobase, board->size, "das16")) { printk(KERN_ERR " I/O port conflict\n"); return -EIO; } @@ -1140,18 +1148,18 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) printk(KERN_INFO " 0x%04lx-0x%04lx 0x%04lx-0x%04lx\n", iobase, iobase + 0x0f, iobase + 0x400, - iobase + 0x400 + (thisboard->size & 0x3ff)); + iobase + 0x400 + (board->size & 0x3ff)); if (!request_region(iobase, 0x10, "das16")) { printk(KERN_ERR " I/O port conflict: 0x%04lx-0x%04lx\n", iobase, iobase + 0x0f); return -EIO; } - if (!request_region(iobase + 0x400, thisboard->size & 0x3ff, + if (!request_region(iobase + 0x400, board->size & 0x3ff, "das16")) { release_region(iobase, 0x10); printk(KERN_ERR " I/O port conflict: 0x%04lx-0x%04lx\n", iobase + 0x400, - iobase + 0x400 + (thisboard->size & 0x3ff)); + iobase + 0x400 + (board->size & 0x3ff)); return -EIO; } } @@ -1163,10 +1171,10 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) printk(KERN_ERR " id bits do not match selected board, aborting\n"); return -EINVAL; } - dev->board_name = thisboard->name; + dev->board_name = board->name; /* get master clock speed */ - if (thisboard->size < 0x400) { + if (board->size < 0x400) { if (it->options[3]) devpriv->clockbase = 1000 / it->options[3]; else @@ -1222,7 +1230,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) } /* get any user-defined input range */ - if (thisboard->ai_pg == das16_pg_none && + if (board->ai_pg == das16_pg_none && (it->options[4] || it->options[5])) { /* allocate single-range range table */ devpriv->user_ai_range_table = @@ -1263,7 +1271,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) s = dev->subdevices + 0; dev->read_subdev = s; /* ai */ - if (thisboard->ai) { + if (board->ai) { s->type = COMEDI_SUBD_AI; s->subdev_flags = SDF_READABLE | SDF_CMD_READ; if (devpriv->ai_singleended) { @@ -1275,15 +1283,15 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->len_chanlist = 8; s->subdev_flags |= SDF_DIFF; } - s->maxdata = (1 << thisboard->ai_nbits) - 1; + s->maxdata = (1 << board->ai_nbits) - 1; if (devpriv->user_ai_range_table) { /* user defined ai range */ s->range_table = devpriv->user_ai_range_table; } else if (devpriv->ai_unipolar) { - s->range_table = das16_ai_uni_lranges[thisboard->ai_pg]; + s->range_table = das16_ai_uni_lranges[board->ai_pg]; } else { - s->range_table = das16_ai_bip_lranges[thisboard->ai_pg]; + s->range_table = das16_ai_bip_lranges[board->ai_pg]; } - s->insn_read = thisboard->ai; + s->insn_read = board->ai; s->do_cmdtest = das16_cmd_test; s->do_cmd = das16_cmd_exec; s->cancel = das16_cancel; @@ -1294,44 +1302,44 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) s = dev->subdevices + 1; /* ao */ - if (thisboard->ao) { + if (board->ao) { s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_WRITABLE; s->n_chan = 2; - s->maxdata = (1 << thisboard->ao_nbits) - 1; + s->maxdata = (1 << board->ao_nbits) - 1; /* user defined ao range */ if (devpriv->user_ao_range_table) s->range_table = devpriv->user_ao_range_table; else s->range_table = &range_unknown; - s->insn_write = thisboard->ao; + s->insn_write = board->ao; } else { s->type = COMEDI_SUBD_UNUSED; } s = dev->subdevices + 2; /* di */ - if (thisboard->di) { + if (board->di) { s->type = COMEDI_SUBD_DI; s->subdev_flags = SDF_READABLE; s->n_chan = 4; s->maxdata = 1; s->range_table = &range_digital; - s->insn_bits = thisboard->di; + s->insn_bits = board->di; } else { s->type = COMEDI_SUBD_UNUSED; } s = dev->subdevices + 3; /* do */ - if (thisboard->do_) { + if (board->do_) { s->type = COMEDI_SUBD_DO; s->subdev_flags = SDF_WRITABLE | SDF_READABLE; s->n_chan = 4; s->maxdata = 1; s->range_table = &range_digital; - s->insn_bits = thisboard->do_; + s->insn_bits = board->do_; /* initialize digital output lines */ outb(s->state, dev->iobase + DAS16_DIO); } else { @@ -1340,9 +1348,9 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) s = dev->subdevices + 4; /* 8255 */ - if (thisboard->i8255_offset != 0) { + if (board->i8255_offset != 0) { subdev_8255_init(dev, s, NULL, (dev->iobase + - thisboard->i8255_offset)); + board->i8255_offset)); } else { s->type = COMEDI_SUBD_UNUSED; } @@ -1353,7 +1361,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) outb(devpriv->control_state, dev->iobase + DAS16_CONTROL); /* turn on das1600 mode if available */ - if (thisboard->size > 0x400) { + if (board->size > 0x400) { outb(DAS1600_ENABLE_VAL, dev->iobase + DAS1600_ENABLE); outb(0, dev->iobase + DAS1600_CONV); outb(0, dev->iobase + DAS1600_BURST); @@ -1364,6 +1372,8 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) static void das16_detach(struct comedi_device *dev) { + const struct das16_board *board = comedi_board(dev); + das16_reset(dev); if (dev->subdevices) subdev_8255_cleanup(dev, dev->subdevices + 4); @@ -1384,12 +1394,12 @@ static void das16_detach(struct comedi_device *dev) if (dev->irq) free_irq(dev->irq, dev); if (dev->iobase) { - if (thisboard->size < 0x400) { - release_region(dev->iobase, thisboard->size); + if (board->size < 0x400) { + release_region(dev->iobase, board->size); } else { release_region(dev->iobase, 0x10); release_region(dev->iobase + 0x400, - thisboard->size & 0x3ff); + board->size & 0x3ff); } } } -- cgit v0.10.2 From bf4683bdbdfafc02f5f4d3170efcd25ff9f00c6b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 15:58:28 -0700 Subject: staging: comedi: remove thisboard macro in the comedi_test driver The 'thisboard' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c index 873e374..9f3c3d5 100644 --- a/drivers/staging/comedi/drivers/comedi_test.c +++ b/drivers/staging/comedi/drivers/comedi_test.c @@ -67,8 +67,6 @@ struct waveform_board { #define N_CHANS 8 -#define thisboard ((const struct waveform_board *)dev->board_ptr) - /* Data unique to this driver */ struct waveform_private { struct timer_list timer; @@ -429,12 +427,13 @@ static int waveform_ao_insn_write(struct comedi_device *dev, static int waveform_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct waveform_board *board = comedi_board(dev); struct comedi_subdevice *s; int amplitude = it->options[0]; int period = it->options[1]; int i; - dev->board_name = thisboard->name; + dev->board_name = board->name; if (alloc_private(dev, sizeof(struct waveform_private)) < 0) return -ENOMEM; @@ -457,8 +456,8 @@ static int waveform_attach(struct comedi_device *dev, /* analog input subdevice */ s->type = COMEDI_SUBD_AI; s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_CMD_READ; - s->n_chan = thisboard->ai_chans; - s->maxdata = (1 << thisboard->ai_bits) - 1; + s->n_chan = board->ai_chans; + s->maxdata = (1 << board->ai_bits) - 1; s->range_table = &waveform_ai_ranges; s->len_chanlist = s->n_chan * 2; s->insn_read = waveform_ai_insn_read; @@ -471,8 +470,8 @@ static int waveform_attach(struct comedi_device *dev, /* analog output subdevice (loopback) */ s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_WRITEABLE | SDF_GROUND; - s->n_chan = thisboard->ai_chans; - s->maxdata = (1 << thisboard->ai_bits) - 1; + s->n_chan = board->ai_chans; + s->maxdata = (1 << board->ai_bits) - 1; s->range_table = &waveform_ai_ranges; s->len_chanlist = s->n_chan * 2; s->insn_write = waveform_ao_insn_write; -- cgit v0.10.2 From b74055465ce47c75b3ebf667c2ff0661828d7a11 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 15:51:14 -0700 Subject: staging: comedi: remove thisboard macro in the aio_iiro_16 driver The 'thisboard' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/aio_iiro_16.c b/drivers/staging/comedi/drivers/aio_iiro_16.c index 04f6f94..5c1548b 100644 --- a/drivers/staging/comedi/drivers/aio_iiro_16.c +++ b/drivers/staging/comedi/drivers/aio_iiro_16.c @@ -57,8 +57,6 @@ static const struct aio_iiro_16_board aio_iiro_16_boards[] = { .do_ = 16}, }; -#define thisboard ((const struct aio_iiro_16_board *) dev->board_ptr) - struct aio_iiro_16_private { int data; struct pci_dev *pci_dev; @@ -106,12 +104,13 @@ static int aio_iiro_16_dio_insn_bits_read(struct comedi_device *dev, static int aio_iiro_16_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct aio_iiro_16_board *board = comedi_board(dev); int iobase; struct comedi_subdevice *s; printk(KERN_INFO "comedi%d: aio_iiro_16: ", dev->minor); - dev->board_name = thisboard->name; + dev->board_name = board->name; iobase = it->options[0]; -- cgit v0.10.2 From 797ef32ba35589393f993bb2f18698d4bc3ad07d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 15:46:02 -0700 Subject: staging: comedi: remove this_board macro in the aio_aio12_8 driver The 'thisboard' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/aio_aio12_8.c b/drivers/staging/comedi/drivers/aio_aio12_8.c index 64d82bc..d215ae1 100644 --- a/drivers/staging/comedi/drivers/aio_aio12_8.c +++ b/drivers/staging/comedi/drivers/aio_aio12_8.c @@ -80,8 +80,6 @@ static const struct aio12_8_boardtype board_types[] = { .name = "aio_aio12_8"}, }; -#define thisboard ((const struct aio12_8_boardtype *) dev->board_ptr) - struct aio12_8_private { unsigned int ao_readback[4]; }; @@ -167,6 +165,7 @@ static const struct comedi_lrange range_aio_aio12_8 = { static int aio_aio12_8_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct aio12_8_boardtype *board = comedi_board(dev); int iobase; struct comedi_subdevice *s; @@ -176,7 +175,7 @@ static int aio_aio12_8_attach(struct comedi_device *dev, return -EIO; } - dev->board_name = thisboard->name; + dev->board_name = board->name; dev->iobase = iobase; -- cgit v0.10.2 From b13ff04654b406618f96e59168006c530f4774aa Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 15:41:29 -0700 Subject: staging: comedi: remove thisboard macro in the adq12b driver The 'thisboard' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adq12b.c b/drivers/staging/comedi/drivers/adq12b.c index 7d585a1..1da2989 100644 --- a/drivers/staging/comedi/drivers/adq12b.c +++ b/drivers/staging/comedi/drivers/adq12b.c @@ -125,8 +125,6 @@ struct adq12b_board { int do_chans; }; -#define thisboard ((const struct adq12b_board *)dev->board_ptr) - struct adq12b_private { int unipolar; /* option 2 of comedi_config (1 is iobase) */ int differential; /* option 3 of comedi_config */ @@ -222,6 +220,7 @@ static int adq12b_do_insn_bits(struct comedi_device *dev, static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct adq12b_board *board = comedi_board(dev); struct comedi_subdevice *s; unsigned long iobase; int unipolar, differential; @@ -250,11 +249,7 @@ static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it) } dev->iobase = iobase; -/* - * Initialize dev->board_name. Note that we can use the "thisboard" - * macro now, since we just initialized it in the last line. - */ - dev->board_name = thisboard->name; + dev->board_name = board->name; /* * Allocate the private structure area. alloc_private() is a @@ -284,10 +279,10 @@ static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->type = COMEDI_SUBD_AI; if (differential) { s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; - s->n_chan = thisboard->ai_diff_chans; + s->n_chan = board->ai_diff_chans; } else { s->subdev_flags = SDF_READABLE | SDF_GROUND; - s->n_chan = thisboard->ai_se_chans; + s->n_chan = board->ai_se_chans; } if (unipolar) @@ -295,7 +290,7 @@ static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it) else s->range_table = &range_adq12b_ai_bipolar; - s->maxdata = (1 << thisboard->ai_bits) - 1; + s->maxdata = (1 << board->ai_bits) - 1; s->len_chanlist = 4; /* This is the maximum chanlist length that the board can handle */ @@ -305,7 +300,7 @@ static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* digital input subdevice */ s->type = COMEDI_SUBD_DI; s->subdev_flags = SDF_READABLE; - s->n_chan = thisboard->di_chans; + s->n_chan = board->di_chans; s->maxdata = 1; s->range_table = &range_digital; s->insn_bits = adq12b_di_insn_bits; @@ -314,7 +309,7 @@ static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* digital output subdevice */ s->type = COMEDI_SUBD_DO; s->subdev_flags = SDF_WRITABLE; - s->n_chan = thisboard->do_chans; + s->n_chan = board->do_chans; s->maxdata = 1; s->range_table = &range_digital; s->insn_bits = adq12b_do_insn_bits; -- cgit v0.10.2 From 960ca1ae1e0676dfef699c37362dad1d4fee5397 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 15:31:41 -0700 Subject: staging: comedi: remove this_board macro in the acl7225b driver The 'this_board' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/acl7225b.c b/drivers/staging/comedi/drivers/acl7225b.c index 4e4fc41..c1963ad 100644 --- a/drivers/staging/comedi/drivers/acl7225b.c +++ b/drivers/staging/comedi/drivers/acl7225b.c @@ -27,8 +27,6 @@ struct boardtype { int io_range; /* len of I/O space */ }; -#define this_board ((const struct boardtype *)dev->board_ptr) - static int acl7225b_do_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -67,19 +65,20 @@ static int acl7225b_di_insn(struct comedi_device *dev, static int acl7225b_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct boardtype *board = comedi_board(dev); struct comedi_subdevice *s; int iobase, iorange; iobase = it->options[0]; - iorange = this_board->io_range; + iorange = board->io_range; printk(KERN_INFO "comedi%d: acl7225b: board=%s 0x%04x\n", dev->minor, - this_board->name, iobase); + board->name, iobase); if (!request_region(iobase, iorange, "acl7225b")) { printk(KERN_ERR "comedi%d: request_region failed - I/O port conflict\n", dev->minor); return -EIO; } - dev->board_name = this_board->name; + dev->board_name = board->name; dev->iobase = iobase; dev->irq = 0; @@ -121,8 +120,10 @@ static int acl7225b_attach(struct comedi_device *dev, static void acl7225b_detach(struct comedi_device *dev) { + const struct boardtype *board = comedi_board(dev); + if (dev->iobase) - release_region(dev->iobase, this_board->io_range); + release_region(dev->iobase, board->io_range); } static const struct boardtype boardtypes[] = { -- cgit v0.10.2 From 5254cbe795c3bb9ef28d61a474d707385fc87178 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 22 May 2012 18:20:10 -0700 Subject: staging: comedi: remove this_board macro in the s526 driver The 'thisboard' macro depends on having a local variable with a magic name. The CodingStyle document suggests not doing this to avoid confusion. Remove the macro and use the comedi_board() inline helper to get the dev->board_ptr information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/s526.c b/drivers/staging/comedi/drivers/s526.c index 7a56434..3c8e979 100644 --- a/drivers/staging/comedi/drivers/s526.c +++ b/drivers/staging/comedi/drivers/s526.c @@ -200,11 +200,6 @@ static const struct s526_board s526_boards[] = { #define ADDR_REG(reg) (dev->iobase + (reg)) #define ADDR_CHAN_REG(reg, chan) (dev->iobase + (reg) + (chan) * 8) -/* - * Useful for shorthand access to the particular board structure - */ -#define thisboard ((const struct s526_board *)dev->board_ptr) - /* this structure is for data unique to this hardware driver. If several hardware drivers keep similar information in this structure, feel free to suggest moving the variable to the struct comedi_device @@ -744,6 +739,7 @@ static int s526_dio_insn_config(struct comedi_device *dev, static int s526_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct s526_board *board = comedi_board(dev); struct comedi_subdevice *s; int iobase; int i, n; @@ -754,7 +750,7 @@ static int s526_attach(struct comedi_device *dev, struct comedi_devconfig *it) printk(KERN_INFO "comedi%d: s526: ", dev->minor); iobase = it->options[0]; - if (!iobase || !request_region(iobase, S526_IOSIZE, thisboard->name)) { + if (!iobase || !request_region(iobase, S526_IOSIZE, board->name)) { comedi_error(dev, "I/O port conflict"); return -EIO; } @@ -769,13 +765,7 @@ static int s526_attach(struct comedi_device *dev, struct comedi_devconfig *it) } ***/ -/* - * Initialize dev->board_name. Note that we can use the "thisboard" - * macro now, since we just initialized it in the last line. - */ - dev->board_ptr = &s526_boards[0]; - - dev->board_name = thisboard->name; + dev->board_name = board->name; /* * Allocate the private structure area. alloc_private() is a @@ -797,7 +787,7 @@ static int s526_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->type = COMEDI_SUBD_COUNTER; s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL; /* KG: What does SDF_LSAMPL (see multiq3.c) mean? */ - s->n_chan = thisboard->gpct_chans; + s->n_chan = board->gpct_chans; s->maxdata = 0x00ffffff; /* 24 bit counter */ s->insn_read = s526_gpct_rinsn; s->insn_config = s526_gpct_insn_config; @@ -838,7 +828,7 @@ static int s526_attach(struct comedi_device *dev, struct comedi_devconfig *it) s = dev->subdevices + 3; /* digital i/o subdevice */ - if (thisboard->have_dio) { + if (board->have_dio) { s->type = COMEDI_SUBD_DIO; s->subdev_flags = SDF_READABLE | SDF_WRITABLE; s->n_chan = 8; -- cgit v0.10.2 From 1c9de58acc06cba56b5f1bd17a5a74a66427f8b1 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Sat, 26 May 2012 15:14:45 +0300 Subject: staging: comedi: cleanup comedi_recognize() This function is more complicated than it needs to be because of the consts. It's not worth saving them when we drop the consts anyway when we return (void *)name_ptr. Signed-off-by: Dan Carpenter Cc: Ian Abbott Cc: Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 7289dcb..438c52a 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -304,14 +304,13 @@ static int postconfig(struct comedi_device *dev) * that register their supported board names */ static void *comedi_recognize(struct comedi_driver *driv, const char *name) { - unsigned i; - const char *const *name_ptr = driv->board_name; + char **name_ptr = (char **)driv->board_name; + int i; + for (i = 0; i < driv->num_names; i++) { if (strcmp(*name_ptr, name) == 0) - return (void *)name_ptr; - name_ptr = - (const char *const *)((const char *)name_ptr + - driv->offset); + return name_ptr; + name_ptr = (void *)name_ptr + driv->offset; } return NULL; -- cgit v0.10.2 From 8d0300a1d983a10cd3358f47b4317eca62c9b96b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 23 May 2012 14:14:13 -0700 Subject: staging: comedi: adl_pci7230: factor out the find PCI device code Factor out the code that finds a matching PCI device from attach function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci7230.c b/drivers/staging/comedi/drivers/adl_pci7230.c index e7eb229..2c83492 100644 --- a/drivers/staging/comedi/drivers/adl_pci7230.c +++ b/drivers/staging/comedi/drivers/adl_pci7230.c @@ -80,18 +80,38 @@ static int adl_pci7230_di_insn_bits(struct comedi_device *dev, return 2; } -static int adl_pci7230_attach(struct comedi_device *dev, +static struct pci_dev *adl_pci7230_find_pci(struct comedi_device *dev, struct comedi_devconfig *it) { struct pci_dev *pcidev = NULL; + int bus = it->options[0]; + int slot = it->options[1]; + + for_each_pci_dev(pcidev) { + if (pcidev->vendor != PCI_VENDOR_ID_ADLINK || + pcidev->device != PCI_DEVICE_ID_PCI7230) + continue; + if (bus || slot) { + /* requested particular bus/slot */ + if (pcidev->bus->number != bus || + PCI_SLOT(pcidev->devfn) != slot) + continue; + } + return pcidev; + } + printk(KERN_ERR "comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", + dev->minor, bus, slot); + return NULL; +} + +static int adl_pci7230_attach(struct comedi_device *dev, + struct comedi_devconfig *it) +{ struct comedi_subdevice *s; - int bus, slot; printk(KERN_INFO "comedi%d: adl_pci7230\n", dev->minor); dev->board_name = "pci7230"; - bus = it->options[0]; - slot = it->options[1]; if (alloc_private(dev, sizeof(struct adl_pci7230_private)) < 0) return -ENOMEM; @@ -99,31 +119,16 @@ static int adl_pci7230_attach(struct comedi_device *dev, if (alloc_subdevices(dev, 2) < 0) return -ENOMEM; - for_each_pci_dev(pcidev) { - if (pcidev->vendor == PCI_VENDOR_ID_ADLINK && - pcidev->device == PCI_DEVICE_ID_PCI7230) { - if (bus || slot) { - /* requested particular bus/slot */ - if (pcidev->bus->number != bus || - PCI_SLOT(pcidev->devfn) != slot) { - continue; - } - } - devpriv->pci_dev = pcidev; - break; - } - } - if (pcidev == NULL) { - printk(KERN_ERR "comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", - dev->minor, bus, slot); + devpriv->pci_dev = adl_pci7230_find_pci(dev, it); + if (!devpriv->pci_dev) return -EIO; - } - if (comedi_pci_enable(pcidev, "adl_pci7230") < 0) { + + if (comedi_pci_enable(devpriv->pci_dev, "adl_pci7230") < 0) { printk(KERN_ERR "comedi%d: Failed to enable PCI device and request regions\n", dev->minor); return -EIO; } - dev->iobase = pci_resource_start(pcidev, 2); + dev->iobase = pci_resource_start(devpriv->pci_dev, 2); printk(KERN_DEBUG "comedi: base addr %4lx\n", dev->iobase); s = dev->subdevices + 0; -- cgit v0.10.2 From 93b6e4790ecd3025a1a38d3758ee1ac0b264799c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 23 May 2012 16:34:58 -0700 Subject: staging: comedi: adl_pci9118: factor out the find PCI device code Factor out the code that finds a matching PCI device from attach function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index aa4244e..f2135bf 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -2110,6 +2110,44 @@ static int pci9118_reset(struct comedi_device *dev) return 0; } +static struct pci_dev *pci9118_find_pci(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + struct pci_dev *pcidev = NULL; + int bus = it->options[0]; + int slot = it->options[1]; + + for_each_pci_dev(pcidev) { + if (pcidev->vendor != PCI_VENDOR_ID_AMCC) + continue; + if (pcidev->device != this_board->device_id) + continue; + if (bus || slot) { + /* requested particular bus/slot */ + if (pcidev->bus->number != bus || + PCI_SLOT(pcidev->devfn) != slot) + continue; + } + /* + * Look for device that isn't in use. + * Enable PCI device and request regions. + */ + if (comedi_pci_enable(pcidev, "adl_pci9118")) + continue; + printk(KERN_ERR ", b:s:f=%d:%d:%d, io=0x%4lx, 0x%4lx", + pcidev->bus->number, + PCI_SLOT(pcidev->devfn), + PCI_FUNC(pcidev->devfn), + (unsigned long)pci_resource_start(pcidev, 2), + (unsigned long)pci_resource_start(pcidev, 0)); + return pcidev; + } + printk(KERN_ERR + "comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", + dev->minor, bus, slot); + return NULL; +} + static int pci9118_attach(struct comedi_device *dev, struct comedi_devconfig *it) { @@ -2117,17 +2155,10 @@ static int pci9118_attach(struct comedi_device *dev, int ret, pages, i; unsigned short master; unsigned int irq; - unsigned long iobase_a, iobase_9; - struct pci_dev *pcidev; - int opt_bus, opt_slot; - const char *errstr; - unsigned char pci_bus, pci_slot, pci_func; u16 u16w; printk("comedi%d: adl_pci9118: board=%s", dev->minor, this_board->name); - opt_bus = it->options[0]; - opt_slot = it->options[1]; if (it->options[3] & 1) master = 0; /* user don't want use bus master */ else @@ -2139,61 +2170,19 @@ static int pci9118_attach(struct comedi_device *dev, return -ENOMEM; } - /* Look for matching PCI device */ - errstr = "not found!"; - pcidev = NULL; - while (NULL != (pcidev = pci_get_device(PCI_VENDOR_ID_AMCC, - this_board->device_id, - pcidev))) { - /* Found matching vendor/device. */ - if (opt_bus || opt_slot) { - /* Check bus/slot. */ - if (opt_bus != pcidev->bus->number - || opt_slot != PCI_SLOT(pcidev->devfn)) - continue; /* no match */ - } - /* - * Look for device that isn't in use. - * Enable PCI device and request regions. - */ - if (comedi_pci_enable(pcidev, "adl_pci9118")) { - errstr = - "failed to enable PCI device and request regions!"; - continue; - } - break; - } - - if (!pcidev) { - if (opt_bus || opt_slot) { - printk(KERN_ERR " - Card at b:s %d:%d %s\n", - opt_bus, opt_slot, errstr); - } else { - printk(KERN_ERR " - Card %s\n", errstr); - } + devpriv->pcidev = pci9118_find_pci(dev, it); + if (!devpriv->pcidev) return -EIO; - } if (master) - pci_set_master(pcidev); + pci_set_master(devpriv->pcidev); + irq = devpriv->pcidev->irq; + devpriv->iobase_a = pci_resource_start(devpriv->pcidev, 0); + dev->iobase = pci_resource_start(devpriv->pcidev, 2); - pci_bus = pcidev->bus->number; - pci_slot = PCI_SLOT(pcidev->devfn); - pci_func = PCI_FUNC(pcidev->devfn); - irq = pcidev->irq; - iobase_a = pci_resource_start(pcidev, 0); - iobase_9 = pci_resource_start(pcidev, 2); - - printk(KERN_ERR ", b:s:f=%d:%d:%d, io=0x%4lx, 0x%4lx", pci_bus, - pci_slot, pci_func, iobase_9, iobase_a); - - dev->iobase = iobase_9; dev->board_name = this_board->name; - devpriv->pcidev = pcidev; - devpriv->iobase_a = iobase_a; - pci9118_reset(dev); if (it->options[3] & 2) -- cgit v0.10.2 From 1158244e013eeac80ad418ab8042cfc4462ee278 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 23 May 2012 16:06:39 -0700 Subject: staging: comedi: adl_pci9111: factor out the find PCI device code Factor out the code that finds a matching PCI device from attach function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c index 308cca7..410bbf9 100644 --- a/drivers/staging/comedi/drivers/adl_pci9111.c +++ b/drivers/staging/comedi/drivers/adl_pci9111.c @@ -1209,17 +1209,47 @@ static int pci9111_reset(struct comedi_device *dev) return 0; } -/* Attach */ -/* - Register PCI device */ -/* - Declare device driver capability */ +static struct pci_dev *pci9111_find_pci(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + struct pci_dev *pcidev = NULL; + int bus = it->options[0]; + int slot = it->options[1]; + int i; + + for_each_pci_dev(pcidev) { + if (pcidev->vendor != PCI_VENDOR_ID_ADLINK) + continue; + for (i = 0; i < pci9111_board_nbr; i++) { + if (pcidev->device != pci9111_boards[i].device_id) + continue; + if (bus || slot) { + /* requested particular bus/slot */ + if (pcidev->bus->number != bus || + PCI_SLOT(pcidev->devfn) != slot) + continue; + } + dev->board_ptr = pci9111_boards + i; + printk(KERN_ERR + "comedi%d: found %s (b:s:f=%d:%d:%d), irq=%d\n", + dev->minor, pci9111_boards[i].name, + pcidev->bus->number, PCI_SLOT(pcidev->devfn), + PCI_FUNC(pcidev->devfn), pcidev->irq); + return pcidev; + } + } + printk(KERN_ERR + "comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", + dev->minor, bus, slot); + return NULL; +} static int pci9111_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *subdevice; unsigned long io_base, io_range, lcr_io_base, lcr_io_range; - struct pci_dev *pci_device = NULL; - int error, i; + int error; const struct pci9111_board *board; if (alloc_private(dev, sizeof(struct pci9111_private_data)) < 0) @@ -1229,65 +1259,25 @@ static int pci9111_attach(struct comedi_device *dev, printk(KERN_ERR "comedi%d: " PCI9111_DRIVER_NAME " driver\n", dev->minor); - for_each_pci_dev(pci_device) { - if (pci_device->vendor == PCI_VENDOR_ID_ADLINK) { - for (i = 0; i < pci9111_board_nbr; i++) { - if (pci9111_boards[i].device_id == - pci_device->device) { - /* was a particular bus/slot - * requested? */ - if ((it->options[0] != 0) - || (it->options[1] != 0)) { - /* are we on the wrong - * bus/slot? */ - if (pci_device->bus->number != - it->options[0] - || - PCI_SLOT(pci_device->devfn) - != it->options[1]) { - continue; - } - } - - dev->board_ptr = pci9111_boards + i; - board = - (struct pci9111_board *) - dev->board_ptr; - dev_private->pci_device = pci_device; - goto found; - } - } - } - } - - printk(KERN_ERR - "comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", - dev->minor, it->options[0], it->options[1]); - return -EIO; - -found: - - printk(KERN_ERR "comedi%d: found %s (b:s:f=%d:%d:%d) , irq=%d\n", - dev->minor, - pci9111_boards[i].name, - pci_device->bus->number, - PCI_SLOT(pci_device->devfn), - PCI_FUNC(pci_device->devfn), pci_device->irq); + dev_private->pci_device = pci9111_find_pci(dev, it); + if (!dev_private->pci_device) + return -EIO; + board = (struct pci9111_board *)dev->board_ptr; /* TODO: Warn about non-tested boards. */ /* Read local configuration register base address * [PCI_BASE_ADDRESS #1]. */ - lcr_io_base = pci_resource_start(pci_device, 1); - lcr_io_range = pci_resource_len(pci_device, 1); + lcr_io_base = pci_resource_start(dev_private->pci_device, 1); + lcr_io_range = pci_resource_len(dev_private->pci_device, 1); printk ("comedi%d: local configuration registers at address 0x%4lx [0x%4lx]\n", dev->minor, lcr_io_base, lcr_io_range); /* Enable PCI device and request regions */ - if (comedi_pci_enable(pci_device, PCI9111_DRIVER_NAME) < 0) { + if (comedi_pci_enable(dev_private->pci_device, PCI9111_DRIVER_NAME) < 0) { printk ("comedi%d: Failed to enable PCI device and request regions\n", dev->minor); @@ -1295,8 +1285,8 @@ found: } /* Read PCI6308 register base address [PCI_BASE_ADDRESS #2]. */ - io_base = pci_resource_start(pci_device, 2); - io_range = pci_resource_len(pci_device, 2); + io_base = pci_resource_start(dev_private->pci_device, 2); + io_range = pci_resource_len(dev_private->pci_device, 2); printk(KERN_ERR "comedi%d: 6503 registers at address 0x%4lx [0x%4lx]\n", dev->minor, io_base, io_range); @@ -1313,16 +1303,17 @@ found: /* Irq setup */ dev->irq = 0; - if (pci_device->irq > 0) { - if (request_irq(pci_device->irq, pci9111_interrupt, + if (dev_private->pci_device->irq > 0) { + dev->irq = dev_private->pci_device->irq; + + if (request_irq(dev->irq, pci9111_interrupt, IRQF_SHARED, PCI9111_DRIVER_NAME, dev) != 0) { printk(KERN_ERR "comedi%d: unable to allocate irq %u\n", - dev->minor, pci_device->irq); + dev->minor, dev->irq); return -EINVAL; } } - dev->irq = pci_device->irq; /* TODO: Add external multiplexer setup (according to option[2]). */ -- cgit v0.10.2 From d3ff7b93ee8b619f777a73f34812e66de07ecd93 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 23 May 2012 15:44:10 -0700 Subject: staging: comedi: adl_pci8164: factor out the PCI device code Factor out the code that finds a matching PCI device from attach function. This allows reducing the indent level of the remaining code in the attach function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci8164.c b/drivers/staging/comedi/drivers/adl_pci8164.c index fbc859e..3447548 100644 --- a/drivers/staging/comedi/drivers/adl_pci8164.c +++ b/drivers/staging/comedi/drivers/adl_pci8164.c @@ -223,19 +223,40 @@ static int adl_pci8164_insn_write_buf1(struct comedi_device *dev, return 2; } +static struct pci_dev *adl_pci8164_find_pci(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + struct pci_dev *pcidev = NULL; + int bus = it->options[0]; + int slot = it->options[1]; + + for_each_pci_dev(pcidev) { + if (pcidev->vendor != PCI_VENDOR_ID_ADLINK || + pcidev->device != PCI_DEVICE_ID_PCI8164) + continue; + if (bus || slot) { + /* requested particular bus/slot */ + if (pcidev->bus->number != bus || + PCI_SLOT(pcidev->devfn) != slot) + continue; + } + return pcidev; + } + printk(KERN_ERR + "comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", + dev->minor, bus, slot); + return NULL; +} + static int adl_pci8164_attach(struct comedi_device *dev, struct comedi_devconfig *it) { - struct pci_dev *pcidev = NULL; struct comedi_subdevice *s; - int bus, slot; printk(KERN_INFO "comedi: attempt to attach...\n"); printk(KERN_INFO "comedi%d: adl_pci8164\n", dev->minor); dev->board_name = "pci8164"; - bus = it->options[0]; - slot = it->options[1]; if (alloc_private(dev, sizeof(struct adl_pci8164_private)) < 0) return -ENOMEM; @@ -243,74 +264,60 @@ static int adl_pci8164_attach(struct comedi_device *dev, if (alloc_subdevices(dev, 4) < 0) return -ENOMEM; - for_each_pci_dev(pcidev) { - if (pcidev->vendor == PCI_VENDOR_ID_ADLINK && - pcidev->device == PCI_DEVICE_ID_PCI8164) { - if (bus || slot) { - /* requested particular bus/slot */ - if (pcidev->bus->number != bus - || PCI_SLOT(pcidev->devfn) != slot) - continue; - } - devpriv->pci_dev = pcidev; - if (comedi_pci_enable(pcidev, "adl_pci8164") < 0) { - printk(KERN_ERR "comedi%d: Failed to enable " - "PCI device and request regions\n", dev->minor); - return -EIO; - } - dev->iobase = pci_resource_start(pcidev, 2); - printk(KERN_DEBUG "comedi: base addr %4lx\n", - dev->iobase); - - s = dev->subdevices + 0; - s->type = COMEDI_SUBD_PROC; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 4; - s->maxdata = 0xffff; - s->len_chanlist = 4; - /* s->range_table = &range_axis; */ - s->insn_read = adl_pci8164_insn_read_msts; - s->insn_write = adl_pci8164_insn_write_cmd; - - s = dev->subdevices + 1; - s->type = COMEDI_SUBD_PROC; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 4; - s->maxdata = 0xffff; - s->len_chanlist = 4; - /* s->range_table = &range_axis; */ - s->insn_read = adl_pci8164_insn_read_ssts; - s->insn_write = adl_pci8164_insn_write_otp; - - s = dev->subdevices + 2; - s->type = COMEDI_SUBD_PROC; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 4; - s->maxdata = 0xffff; - s->len_chanlist = 4; - /* s->range_table = &range_axis; */ - s->insn_read = adl_pci8164_insn_read_buf0; - s->insn_write = adl_pci8164_insn_write_buf0; - - s = dev->subdevices + 3; - s->type = COMEDI_SUBD_PROC; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 4; - s->maxdata = 0xffff; - s->len_chanlist = 4; - /* s->range_table = &range_axis; */ - s->insn_read = adl_pci8164_insn_read_buf1; - s->insn_write = adl_pci8164_insn_write_buf1; - - printk(KERN_INFO "comedi: attached\n"); - - return 1; - } - } + devpriv->pci_dev = adl_pci8164_find_pci(dev, it); + if (!devpriv->pci_dev) + return -EIO; - printk(KERN_ERR "comedi%d: no supported board found!" - "(req. bus/slot : %d/%d)\n", dev->minor, bus, slot); - return -EIO; + if (comedi_pci_enable(devpriv->pci_dev, "adl_pci8164") < 0) { + printk(KERN_ERR "comedi%d: Failed to enable " + "PCI device and request regions\n", dev->minor); + return -EIO; + } + dev->iobase = pci_resource_start(devpriv->pci_dev, 2); + printk(KERN_DEBUG "comedi: base addr %4lx\n", dev->iobase); + + s = dev->subdevices + 0; + s->type = COMEDI_SUBD_PROC; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 0xffff; + s->len_chanlist = 4; + /* s->range_table = &range_axis; */ + s->insn_read = adl_pci8164_insn_read_msts; + s->insn_write = adl_pci8164_insn_write_cmd; + + s = dev->subdevices + 1; + s->type = COMEDI_SUBD_PROC; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 0xffff; + s->len_chanlist = 4; + /* s->range_table = &range_axis; */ + s->insn_read = adl_pci8164_insn_read_ssts; + s->insn_write = adl_pci8164_insn_write_otp; + + s = dev->subdevices + 2; + s->type = COMEDI_SUBD_PROC; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 0xffff; + s->len_chanlist = 4; + /* s->range_table = &range_axis; */ + s->insn_read = adl_pci8164_insn_read_buf0; + s->insn_write = adl_pci8164_insn_write_buf0; + + s = dev->subdevices + 3; + s->type = COMEDI_SUBD_PROC; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 0xffff; + s->len_chanlist = 4; + /* s->range_table = &range_axis; */ + s->insn_read = adl_pci8164_insn_read_buf1; + s->insn_write = adl_pci8164_insn_write_buf1; + + printk(KERN_INFO "comedi: attached\n"); + return 0; } static void adl_pci8164_detach(struct comedi_device *dev) -- cgit v0.10.2 From fc330f458941df0f1651964e8e1207e62fb6db51 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 23 May 2012 14:38:33 -0700 Subject: staging: comedi: adl_pci7432: factor out the PCI device code Factor out the code that finds a matching PCI device from attach function. This allows reducing the indent level of the remaining code in the attach function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci7432.c b/drivers/staging/comedi/drivers/adl_pci7432.c index 2fc1dbb..dd818f1 100644 --- a/drivers/staging/comedi/drivers/adl_pci7432.c +++ b/drivers/staging/comedi/drivers/adl_pci7432.c @@ -88,18 +88,39 @@ static int adl_pci7432_di_insn_bits(struct comedi_device *dev, return 2; } +static struct pci_dev *adl_pci7432_find_pci(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + struct pci_dev *pcidev = NULL; + int bus = it->options[0]; + int slot = it->options[1]; + + for_each_pci_dev(pcidev) { + if (pcidev->vendor != PCI_VENDOR_ID_ADLINK || + pcidev->device != PCI_DEVICE_ID_PCI7432) + continue; + if (bus || slot) { + /* requested particular bus/slot */ + if (pcidev->bus->number != bus || + PCI_SLOT(pcidev->devfn) != slot) + continue; + } + return pcidev; + } + printk(KERN_ERR + "comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", + dev->minor, bus, slot); + return NULL; +} + static int adl_pci7432_attach(struct comedi_device *dev, struct comedi_devconfig *it) { - struct pci_dev *pcidev = NULL; struct comedi_subdevice *s; - int bus, slot; printk(KERN_INFO "comedi%d: attach adl_pci7432\n", dev->minor); dev->board_name = "pci7432"; - bus = it->options[0]; - slot = it->options[1]; if (alloc_private(dev, sizeof(struct adl_pci7432_private)) < 0) return -ENOMEM; @@ -107,57 +128,40 @@ static int adl_pci7432_attach(struct comedi_device *dev, if (alloc_subdevices(dev, 2) < 0) return -ENOMEM; - for_each_pci_dev(pcidev) { - if (pcidev->vendor == PCI_VENDOR_ID_ADLINK && - pcidev->device == PCI_DEVICE_ID_PCI7432) { - if (bus || slot) { - /* requested particular bus/slot */ - if (pcidev->bus->number != bus - || PCI_SLOT(pcidev->devfn) != slot) { - continue; - } - } - devpriv->pci_dev = pcidev; - if (comedi_pci_enable(pcidev, "adl_pci7432") < 0) { - printk(KERN_ERR "comedi%d: Failed to enable PCI device and request regions\n", - dev->minor); - return -EIO; - } - dev->iobase = pci_resource_start(pcidev, 2); - printk(KERN_INFO "comedi: base addr %4lx\n", - dev->iobase); - - s = dev->subdevices + 0; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = - SDF_READABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = 32; - s->maxdata = 1; - s->len_chanlist = 32; - s->io_bits = 0x00000000; - s->range_table = &range_digital; - s->insn_bits = adl_pci7432_di_insn_bits; - - s = dev->subdevices + 1; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = - SDF_WRITABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = 32; - s->maxdata = 1; - s->len_chanlist = 32; - s->io_bits = 0xffffffff; - s->range_table = &range_digital; - s->insn_bits = adl_pci7432_do_insn_bits; - - printk(KERN_DEBUG "comedi%d: adl_pci7432 attached\n", - dev->minor); - return 1; - } - } + devpriv->pci_dev = adl_pci7432_find_pci(dev, it); + if (!devpriv->pci_dev) + return -EIO; - printk(KERN_ERR "comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", - dev->minor, bus, slot); - return -EIO; + if (comedi_pci_enable(devpriv->pci_dev, "adl_pci7432") < 0) { + printk(KERN_ERR "comedi%d: Failed to enable PCI device and request regions\n", + dev->minor); + return -EIO; + } + dev->iobase = pci_resource_start(devpriv->pci_dev, 2); + printk(KERN_INFO "comedi: base addr %4lx\n", dev->iobase); + + s = dev->subdevices + 0; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON; + s->n_chan = 32; + s->maxdata = 1; + s->len_chanlist = 32; + s->io_bits = 0x00000000; + s->range_table = &range_digital; + s->insn_bits = adl_pci7432_di_insn_bits; + + s = dev->subdevices + 1; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; + s->n_chan = 32; + s->maxdata = 1; + s->len_chanlist = 32; + s->io_bits = 0xffffffff; + s->range_table = &range_digital; + s->insn_bits = adl_pci7432_do_insn_bits; + + printk(KERN_DEBUG "comedi%d: adl_pci7432 attached\n", dev->minor); + return 0; } static void adl_pci7432_detach(struct comedi_device *dev) -- cgit v0.10.2 From 262ea0d476049fa393509a70c9ecfa06df403b4a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 23 May 2012 14:28:47 -0700 Subject: staging: comedi: adl_pci7296: factor out the PCI device code Factor out the code that finds a matching PCI device from attach function. This allows reducing the indent level of the remaining code in the attach function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci7296.c b/drivers/staging/comedi/drivers/adl_pci7296.c index bf2f7fb..0b8b279 100644 --- a/drivers/staging/comedi/drivers/adl_pci7296.c +++ b/drivers/staging/comedi/drivers/adl_pci7296.c @@ -54,19 +54,40 @@ struct adl_pci7296_private { #define devpriv ((struct adl_pci7296_private *)dev->private) +static struct pci_dev *adl_pci7296_find_pci(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + struct pci_dev *pcidev = NULL; + int bus = it->options[0]; + int slot = it->options[1]; + + for_each_pci_dev(pcidev) { + if (pcidev->vendor != PCI_VENDOR_ID_ADLINK || + pcidev->device != PCI_DEVICE_ID_PCI7296) + continue; + if (bus || slot) { + /* requested particular bus/slot */ + if (pcidev->bus->number != bus || + PCI_SLOT(pcidev->devfn) != slot) + continue; + } + return pcidev; + } + printk(KERN_ERR + "comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", + dev->minor, bus, slot); + return NULL; +} + static int adl_pci7296_attach(struct comedi_device *dev, struct comedi_devconfig *it) { - struct pci_dev *pcidev = NULL; struct comedi_subdevice *s; - int bus, slot; int ret; printk(KERN_INFO "comedi%d: attach adl_pci7432\n", dev->minor); dev->board_name = "pci7432"; - bus = it->options[0]; - slot = it->options[1]; if (alloc_private(dev, sizeof(struct adl_pci7296_private)) < 0) return -ENOMEM; @@ -74,63 +95,45 @@ static int adl_pci7296_attach(struct comedi_device *dev, if (alloc_subdevices(dev, 4) < 0) return -ENOMEM; - for_each_pci_dev(pcidev) { - if (pcidev->vendor == PCI_VENDOR_ID_ADLINK && - pcidev->device == PCI_DEVICE_ID_PCI7296) { - if (bus || slot) { - /* requested particular bus/slot */ - if (pcidev->bus->number != bus - || PCI_SLOT(pcidev->devfn) != slot) { - continue; - } - } - devpriv->pci_dev = pcidev; - if (comedi_pci_enable(pcidev, "adl_pci7296") < 0) { - printk(KERN_ERR "comedi%d: Failed to enable PCI device and request regions\n", - dev->minor); - return -EIO; - } - - dev->iobase = pci_resource_start(pcidev, 2); - printk(KERN_INFO "comedi: base addr %4lx\n", - dev->iobase); - - /* four 8255 digital io subdevices */ - s = dev->subdevices + 0; - subdev_8255_init(dev, s, NULL, - (unsigned long)(dev->iobase)); - - s = dev->subdevices + 1; - ret = subdev_8255_init(dev, s, NULL, - (unsigned long)(dev->iobase + - PORT2A)); - if (ret < 0) - return ret; - - s = dev->subdevices + 2; - ret = subdev_8255_init(dev, s, NULL, - (unsigned long)(dev->iobase + - PORT3A)); - if (ret < 0) - return ret; - - s = dev->subdevices + 3; - ret = subdev_8255_init(dev, s, NULL, - (unsigned long)(dev->iobase + - PORT4A)); - if (ret < 0) - return ret; - - printk(KERN_DEBUG "comedi%d: adl_pci7432 attached\n", - dev->minor); - - return 1; - } + devpriv->pci_dev = adl_pci7296_find_pci(dev, it); + if (!devpriv->pci_dev) + return -EIO; + + if (comedi_pci_enable(devpriv->pci_dev, "adl_pci7296") < 0) { + printk(KERN_ERR + "comedi%d: Failed to enable PCI device and request regions\n", + dev->minor); + return -EIO; } - printk(KERN_ERR "comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", - dev->minor, bus, slot); - return -EIO; + dev->iobase = pci_resource_start(devpriv->pci_dev, 2); + printk(KERN_INFO "comedi: base addr %4lx\n", dev->iobase); + + /* four 8255 digital io subdevices */ + s = dev->subdevices + 0; + subdev_8255_init(dev, s, NULL, (unsigned long)(dev->iobase)); + + s = dev->subdevices + 1; + ret = subdev_8255_init(dev, s, NULL, + (unsigned long)(dev->iobase + PORT2A)); + if (ret < 0) + return ret; + + s = dev->subdevices + 2; + ret = subdev_8255_init(dev, s, NULL, + (unsigned long)(dev->iobase + PORT3A)); + if (ret < 0) + return ret; + + s = dev->subdevices + 3; + ret = subdev_8255_init(dev, s, NULL, + (unsigned long)(dev->iobase + PORT4A)); + if (ret < 0) + return ret; + + printk(KERN_DEBUG "comedi%d: adl_pci7432 attached\n", dev->minor); + + return 0; } static void adl_pci7296_detach(struct comedi_device *dev) -- cgit v0.10.2 From c98d90fd1fb9a5ff612e05766198cb09a1dd63b7 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 23 May 2012 18:31:48 -0700 Subject: staging: comedi: rtd520 complete the refactor to remove all forward declarations Complete the refactor of the rtd520 driver to remove all the forward declarations. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index d3e2786..84b28b6 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -702,1616 +702,1586 @@ struct rtdPrivate { #define RtdDma1Status(dev) \ readb(devpriv->lcfg+LCFG_DMACSR1) -static int rtd_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int rtd_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int rtd_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int rtd_dio_insn_bits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int rtd_dio_insn_config(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int rtd_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd); -static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s); -static int rtd_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s); /* - * static int rtd_ai_poll(struct comedi_device *dev, - * struct comedi_subdevice *s); - */ -static int rtd_ns_to_timer(unsigned int *ns, int roundMode); -static irqreturn_t rtd_interrupt(int irq, void *d); -static int rtd520_probe_fifo_depth(struct comedi_device *dev); + Given a desired period and the clock period (both in ns), + return the proper counter value (divider-1). + Sets the original period to be the true value. + Note: you have to check if the value is larger than the counter range! +*/ +static int rtd_ns_to_timer_base(unsigned int *nanosec, /* desired period (in ns) */ + int round_mode, int base) +{ /* clock period (in ns) */ + int divider; + + switch (round_mode) { + case TRIG_ROUND_NEAREST: + default: + divider = (*nanosec + base / 2) / base; + break; + case TRIG_ROUND_DOWN: + divider = (*nanosec) / base; + break; + case TRIG_ROUND_UP: + divider = (*nanosec + base - 1) / base; + break; + } + if (divider < 2) + divider = 2; /* min is divide by 2 */ + + /* Note: we don't check for max, because different timers + have different ranges */ + + *nanosec = base * divider; + return divider - 1; /* countdown is divisor+1 */ +} /* - * Attach is called by the Comedi core to configure the driver - * for a particular board. If you specified a board_name array - * in the driver structure, dev->board_ptr contains that - * address. - */ -static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) -{ /* board name and options flags */ - struct comedi_subdevice *s; - struct pci_dev *pcidev; - int ret; - resource_size_t physLas0; /* configuration */ - resource_size_t physLas1; /* data area */ - resource_size_t physLcfg; /* PLX9080 */ -#ifdef USE_DMA - int index; -#endif + Given a desired period (in ns), + return the proper counter value (divider-1) for the internal clock. + Sets the original period to be the true value. +*/ +static int rtd_ns_to_timer(unsigned int *ns, int round_mode) +{ + return rtd_ns_to_timer_base(ns, round_mode, RTD_CLOCK_BASE); +} - printk(KERN_INFO "comedi%d: rtd520 attaching.\n", dev->minor); +/* + Convert a single comedi channel-gain entry to a RTD520 table entry +*/ +static unsigned short rtdConvertChanGain(struct comedi_device *dev, + unsigned int comediChan, int chanIndex) +{ /* index in channel list */ + unsigned int chan, range, aref; + unsigned short r = 0; -#if defined(CONFIG_COMEDI_DEBUG) && defined(USE_DMA) - /* You can set this a load time: modprobe comedi comedi_debug=1 */ - if (0 == comedi_debug) /* force DMA debug printks */ - comedi_debug = 1; -#endif + chan = CR_CHAN(comediChan); + range = CR_RANGE(comediChan); + aref = CR_AREF(comediChan); - /* - * Allocate the private structure area. alloc_private() is a - * convenient macro defined in comedidev.h. - */ - if (alloc_private(dev, sizeof(struct rtdPrivate)) < 0) - return -ENOMEM; + r |= chan & 0xf; - /* - * Probe the device to determine what device in the series it is. - */ - for (pcidev = pci_get_device(PCI_VENDOR_ID_RTD, PCI_ANY_ID, NULL); - pcidev != NULL; - pcidev = pci_get_device(PCI_VENDOR_ID_RTD, PCI_ANY_ID, pcidev)) { - int i; + /* Note: we also setup the channel list bipolar flag array */ + if (range < thisboard->range10Start) { /* first batch are +-5 */ + r |= 0x000; /* +-5 range */ + r |= (range & 0x7) << 4; /* gain */ + CHAN_ARRAY_SET(devpriv->chanBipolar, chanIndex); + } else if (range < thisboard->rangeUniStart) { /* second batch are +-10 */ + r |= 0x100; /* +-10 range */ + /* gain */ + r |= ((range - thisboard->range10Start) & 0x7) << 4; + CHAN_ARRAY_SET(devpriv->chanBipolar, chanIndex); + } else { /* last batch is +10 */ + r |= 0x200; /* +10 range */ + /* gain */ + r |= ((range - thisboard->rangeUniStart) & 0x7) << 4; + CHAN_ARRAY_CLEAR(devpriv->chanBipolar, chanIndex); + } - if (it->options[0] || it->options[1]) { - if (pcidev->bus->number != it->options[0] - || PCI_SLOT(pcidev->devfn) != it->options[1]) { - continue; - } - } - for (i = 0; i < ARRAY_SIZE(rtd520Boards); ++i) { - if (pcidev->device == rtd520Boards[i].device_id) { - dev->board_ptr = &rtd520Boards[i]; - break; - } + switch (aref) { + case AREF_GROUND: /* on-board ground */ + break; + + case AREF_COMMON: + r |= 0x80; /* ref external analog common */ + break; + + case AREF_DIFF: + r |= 0x400; /* differential inputs */ + break; + + case AREF_OTHER: /* ??? */ + break; + } + /*printk ("chan=%d r=%d a=%d -> 0x%x\n", + chan, range, aref, r); */ + return r; +} + +/* + Setup the channel-gain table from a comedi list +*/ +static void rtd_load_channelgain_list(struct comedi_device *dev, + unsigned int n_chan, unsigned int *list) +{ + if (n_chan > 1) { /* setup channel gain table */ + int ii; + RtdClearCGT(dev); + RtdEnableCGT(dev, 1); /* enable table */ + for (ii = 0; ii < n_chan; ii++) { + RtdWriteCGTable(dev, rtdConvertChanGain(dev, list[ii], + ii)); } - if (dev->board_ptr) - break; /* found one */ + } else { /* just use the channel gain latch */ + RtdEnableCGT(dev, 0); /* disable table, enable latch */ + RtdWriteCGLatch(dev, rtdConvertChanGain(dev, list[0], 0)); } - if (!pcidev) { - if (it->options[0] && it->options[1]) { - printk(KERN_INFO "No RTD card at bus=%d slot=%d.\n", - it->options[0], it->options[1]); - } else { - printk(KERN_INFO "No RTD card found.\n"); +} + +/* determine fifo size by doing adc conversions until the fifo half +empty status flag clears */ +static int rtd520_probe_fifo_depth(struct comedi_device *dev) +{ + unsigned int chanspec = CR_PACK(0, 0, AREF_GROUND); + unsigned i; + static const unsigned limit = 0x2000; + unsigned fifo_size = 0; + + RtdAdcClearFifo(dev); + rtd_load_channelgain_list(dev, 1, &chanspec); + RtdAdcConversionSource(dev, 0); /* software */ + /* convert samples */ + for (i = 0; i < limit; ++i) { + unsigned fifo_status; + /* trigger conversion */ + RtdAdcStart(dev); + udelay(1); + fifo_status = RtdFifoStatus(dev); + if ((fifo_status & FS_ADC_HEMPTY) == 0) { + fifo_size = 2 * i; + break; } + } + if (i == limit) { + printk(KERN_INFO "\ncomedi: %s: failed to probe fifo size.\n", + DRV_NAME); return -EIO; } - devpriv->pci_dev = pcidev; - dev->board_name = thisboard->name; - - ret = comedi_pci_enable(pcidev, DRV_NAME); - if (ret < 0) { - printk(KERN_INFO "Failed to enable PCI device and request regions.\n"); - return ret; + RtdAdcClearFifo(dev); + if (fifo_size != 0x400 && fifo_size != 0x2000) { + printk + (KERN_INFO "\ncomedi: %s: unexpected fifo size of %i, expected 1024 or 8192.\n", + DRV_NAME, fifo_size); + return -EIO; } - devpriv->got_regions = 1; - - /* - * Initialize base addresses - */ - /* Get the physical address from PCI config */ - physLas0 = pci_resource_start(devpriv->pci_dev, LAS0_PCIINDEX); - physLas1 = pci_resource_start(devpriv->pci_dev, LAS1_PCIINDEX); - physLcfg = pci_resource_start(devpriv->pci_dev, LCFG_PCIINDEX); - /* Now have the kernel map this into memory */ - /* ASSUME page aligned */ - devpriv->las0 = ioremap_nocache(physLas0, LAS0_PCISIZE); - devpriv->las1 = ioremap_nocache(physLas1, LAS1_PCISIZE); - devpriv->lcfg = ioremap_nocache(physLcfg, LCFG_PCISIZE); + return fifo_size; +} - if (!devpriv->las0 || !devpriv->las1 || !devpriv->lcfg) - return -ENOMEM; +/* + "instructions" read/write data in "one-shot" or "software-triggered" + mode (simplest case). + This doesn't use interrupts. + Note, we don't do any settling delays. Use a instruction list to + select, delay, then read. + */ +static int rtd_ai_rinsn(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, + unsigned int *data) +{ + int n, ii; + int stat; - DPRINTK("%s: LAS0=%llx, LAS1=%llx, CFG=%llx.\n", dev->board_name, - (unsigned long long)physLas0, (unsigned long long)physLas1, - (unsigned long long)physLcfg); - { /* The RTD driver does this */ - unsigned char pci_latency; - u16 revision; - /*uint32_t epld_version; */ + /* clear any old fifo data */ + RtdAdcClearFifo(dev); - pci_read_config_word(devpriv->pci_dev, PCI_REVISION_ID, - &revision); - DPRINTK("%s: PCI revision %d.\n", dev->board_name, revision); + /* write channel to multiplexer and clear channel gain table */ + rtd_load_channelgain_list(dev, 1, &insn->chanspec); - pci_read_config_byte(devpriv->pci_dev, - PCI_LATENCY_TIMER, &pci_latency); - if (pci_latency < 32) { - printk(KERN_INFO "%s: PCI latency changed from %d to %d\n", - dev->board_name, pci_latency, 32); - pci_write_config_byte(devpriv->pci_dev, - PCI_LATENCY_TIMER, 32); - } else { - DPRINTK("rtd520: PCI latency = %d\n", pci_latency); - } + /* set conversion source */ + RtdAdcConversionSource(dev, 0); /* software */ - /* - * Undocumented EPLD version (doesn't match RTD driver results) - */ - /*DPRINTK ("rtd520: Reading epld from %p\n", - devpriv->las0+0); - epld_version = readl (devpriv->las0+0); - if ((epld_version & 0xF0) >> 4 == 0x0F) { - DPRINTK("rtd520: pre-v8 EPLD. (%x)\n", epld_version); - } else { - DPRINTK("rtd520: EPLD version %x.\n", epld_version >> 4); - } */ + /* convert n samples */ + for (n = 0; n < insn->n; n++) { + s16 d; + /* trigger conversion */ + RtdAdcStart(dev); + + for (ii = 0; ii < RTD_ADC_TIMEOUT; ++ii) { + stat = RtdFifoStatus(dev); + if (stat & FS_ADC_NOT_EMPTY) /* 1 -> not empty */ + break; + WAIT_QUIETLY; + } + if (ii >= RTD_ADC_TIMEOUT) { + DPRINTK + ("rtd520: Error: ADC never finished! FifoStatus=0x%x\n", + stat ^ 0x6666); + return -ETIMEDOUT; + } + + /* read data */ + d = RtdAdcFifoGet(dev); /* get 2s comp value */ + /*printk ("rtd520: Got 0x%x after %d usec\n", d, ii+1); */ + d = d >> 3; /* low 3 bits are marker lines */ + if (CHAN_ARRAY_TEST(devpriv->chanBipolar, 0)) + /* convert to comedi unsigned data */ + data[n] = d + 2048; + else + data[n] = d; } - /* Show board configuration */ - printk(KERN_INFO "%s:", dev->board_name); + /* return the number of samples read/written */ + return n; +} - /* - * Allocate the subdevice structures. alloc_subdevice() is a - * convenient macro defined in comedidev.h. - */ - if (alloc_subdevices(dev, 4) < 0) - return -ENOMEM; +/* + Get what we know is there.... Fast! + This uses 1/2 the bus cycles of read_dregs (below). + The manual claims that we can do a lword read, but it doesn't work here. +*/ +static int ai_read_n(struct comedi_device *dev, struct comedi_subdevice *s, + int count) +{ + int ii; - s = dev->subdevices + 0; - dev->read_subdev = s; - /* analog input subdevice */ - s->type = COMEDI_SUBD_AI; - s->subdev_flags = - SDF_READABLE | SDF_GROUND | SDF_COMMON | SDF_DIFF | SDF_CMD_READ; - s->n_chan = thisboard->aiChans; - s->maxdata = (1 << thisboard->aiBits) - 1; - if (thisboard->aiMaxGain <= 32) - s->range_table = &rtd_ai_7520_range; - else - s->range_table = &rtd_ai_4520_range; + for (ii = 0; ii < count; ii++) { + short sample; + s16 d; - s->len_chanlist = RTD_MAX_CHANLIST; /* devpriv->fifoLen */ - s->insn_read = rtd_ai_rinsn; - s->do_cmd = rtd_ai_cmd; - s->do_cmdtest = rtd_ai_cmdtest; - s->cancel = rtd_ai_cancel; - /* s->poll = rtd_ai_poll; *//* not ready yet */ + if (0 == devpriv->aiCount) { /* done */ + d = RtdAdcFifoGet(dev); /* Read N and discard */ + continue; + } +#if 0 + if (0 == (RtdFifoStatus(dev) & FS_ADC_NOT_EMPTY)) { /* DEBUG */ + DPRINTK("comedi: READ OOPS on %d of %d\n", ii + 1, + count); + break; + } +#endif + d = RtdAdcFifoGet(dev); /* get 2s comp value */ - s = dev->subdevices + 1; - /* analog output subdevice */ - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 2; - s->maxdata = (1 << thisboard->aiBits) - 1; - s->range_table = &rtd_ao_range; - s->insn_write = rtd_ao_winsn; - s->insn_read = rtd_ao_rinsn; + d = d >> 3; /* low 3 bits are marker lines */ + if (CHAN_ARRAY_TEST(devpriv->chanBipolar, s->async->cur_chan)) { + /* convert to comedi unsigned data */ + sample = d + 2048; + } else + sample = d; - s = dev->subdevices + 2; - /* digital i/o subdevice */ - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - /* we only support port 0 right now. Ignoring port 1 and user IO */ - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = rtd_dio_insn_bits; - s->insn_config = rtd_dio_insn_config; + if (!comedi_buf_put(s->async, sample)) + return -1; - /* timer/counter subdevices (not currently supported) */ - s = dev->subdevices + 3; - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 3; - s->maxdata = 0xffff; + if (devpriv->aiCount > 0) /* < 0, means read forever */ + devpriv->aiCount--; + } + return 0; +} - /* initialize board, per RTD spec */ - /* also, initialize shadow registers */ - RtdResetBoard(dev); - udelay(100); /* needed? */ - RtdPlxInterruptWrite(dev, 0); - RtdInterruptMask(dev, 0); /* and sets shadow */ - RtdInterruptClearMask(dev, ~0); /* and sets shadow */ - RtdInterruptClear(dev); /* clears bits set by mask */ - RtdInterruptOverrunClear(dev); - RtdClearCGT(dev); - RtdAdcClearFifo(dev); - RtdDacClearFifo(dev, 0); - RtdDacClearFifo(dev, 1); - /* clear digital IO fifo */ - RtdDioStatusWrite(dev, 0); /* safe state, set shadow */ - RtdUtcCtrlPut(dev, 0, 0x30); /* safe state, set shadow */ - RtdUtcCtrlPut(dev, 1, 0x30); /* safe state, set shadow */ - RtdUtcCtrlPut(dev, 2, 0x30); /* safe state, set shadow */ - RtdUtcCtrlPut(dev, 3, 0); /* safe state, set shadow */ - /* TODO: set user out source ??? */ +/* + unknown amout of data is waiting in fifo. +*/ +static int ai_read_dregs(struct comedi_device *dev, struct comedi_subdevice *s) +{ + while (RtdFifoStatus(dev) & FS_ADC_NOT_EMPTY) { /* 1 -> not empty */ + short sample; + s16 d = RtdAdcFifoGet(dev); /* get 2s comp value */ - /* check if our interrupt is available and get it */ - ret = request_irq(devpriv->pci_dev->irq, rtd_interrupt, - IRQF_SHARED, DRV_NAME, dev); + if (0 == devpriv->aiCount) { /* done */ + continue; /* read rest */ + } - if (ret < 0) { - printk("Could not get interrupt! (%u)\n", - devpriv->pci_dev->irq); - return ret; - } - dev->irq = devpriv->pci_dev->irq; - printk(KERN_INFO "( irq=%u )", dev->irq); + d = d >> 3; /* low 3 bits are marker lines */ + if (CHAN_ARRAY_TEST(devpriv->chanBipolar, s->async->cur_chan)) { + /* convert to comedi unsigned data */ + sample = d + 2048; + } else + sample = d; - ret = rtd520_probe_fifo_depth(dev); - if (ret < 0) - return ret; + if (!comedi_buf_put(s->async, sample)) + return -1; - devpriv->fifoLen = ret; - printk("( fifoLen=%d )", devpriv->fifoLen); + if (devpriv->aiCount > 0) /* < 0, means read forever */ + devpriv->aiCount--; + } + return 0; +} #ifdef USE_DMA - if (dev->irq > 0) { - printk("( DMA buff=%d )\n", DMA_CHAIN_COUNT); - /* - * The PLX9080 has 2 DMA controllers, but there could be - * 4 sources: ADC, digital, DAC1, and DAC2. Since only the - * ADC supports cmd mode right now, this isn't an issue (yet) - */ - devpriv->dma0Offset = 0; +/* + Terminate a DMA transfer and wait for everything to quiet down +*/ +void abort_dma(struct comedi_device *dev, unsigned int channel) +{ /* DMA channel 0, 1 */ + unsigned long dma_cs_addr; /* the control/status register */ + uint8_t status; + unsigned int ii; + /* unsigned long flags; */ - for (index = 0; index < DMA_CHAIN_COUNT; index++) { - devpriv->dma0Buff[index] = - pci_alloc_consistent(devpriv->pci_dev, - sizeof(u16) * - devpriv->fifoLen / 2, - &devpriv-> - dma0BuffPhysAddr[index]); - if (devpriv->dma0Buff[index] == NULL) { - ret = -ENOMEM; - goto rtd_attach_die_error; - } - /*DPRINTK ("buff[%d] @ %p virtual, %x PCI\n", - index, - devpriv->dma0Buff[index], - devpriv->dma0BuffPhysAddr[index]); */ - } + dma_cs_addr = (unsigned long)devpriv->lcfg + + ((channel == 0) ? LCFG_DMACSR0 : LCFG_DMACSR1); - /* - * setup DMA descriptor ring (use cpu_to_le32 for byte - * ordering?) - */ - devpriv->dma0Chain = - pci_alloc_consistent(devpriv->pci_dev, - sizeof(struct plx_dma_desc) * - DMA_CHAIN_COUNT, - &devpriv->dma0ChainPhysAddr); - for (index = 0; index < DMA_CHAIN_COUNT; index++) { - devpriv->dma0Chain[index].pci_start_addr = - devpriv->dma0BuffPhysAddr[index]; - devpriv->dma0Chain[index].local_start_addr = - DMALADDR_ADC; - devpriv->dma0Chain[index].transfer_size = - sizeof(u16) * devpriv->fifoLen / 2; - devpriv->dma0Chain[index].next = - (devpriv->dma0ChainPhysAddr + ((index + - 1) % - (DMA_CHAIN_COUNT)) - * sizeof(devpriv->dma0Chain[0])) - | DMA_TRANSFER_BITS; - /*DPRINTK ("ring[%d] @%lx PCI: %x, local: %x, N: 0x%x, next: %x\n", - index, - ((long)devpriv->dma0ChainPhysAddr - + (index * sizeof(devpriv->dma0Chain[0]))), - devpriv->dma0Chain[index].pci_start_addr, - devpriv->dma0Chain[index].local_start_addr, - devpriv->dma0Chain[index].transfer_size, - devpriv->dma0Chain[index].next); */ - } + /* spinlock for plx dma control/status reg */ + /* spin_lock_irqsave( &dev->spinlock, flags ); */ - if (devpriv->dma0Chain == NULL) { - ret = -ENOMEM; - goto rtd_attach_die_error; - } + /* abort dma transfer if necessary */ + status = readb(dma_cs_addr); + if ((status & PLX_DMA_EN_BIT) == 0) { /* not enabled (Error?) */ + DPRINTK("rtd520: AbortDma on non-active channel %d (0x%x)\n", + channel, status); + goto abortDmaExit; + } - RtdDma0Mode(dev, DMA_MODE_BITS); - /* set DMA trigger source */ - RtdDma0Source(dev, DMAS_ADFIFO_HALF_FULL); - } else { - printk(KERN_INFO "( no IRQ->no DMA )"); + /* wait to make sure done bit is zero (needed?) */ + for (ii = 0; (status & PLX_DMA_DONE_BIT) && ii < RTD_DMA_TIMEOUT; ii++) { + WAIT_QUIETLY; + status = readb(dma_cs_addr); + } + if (status & PLX_DMA_DONE_BIT) { + printk("rtd520: Timeout waiting for dma %i done clear\n", + channel); + goto abortDmaExit; } -#endif /* USE_DMA */ - if (dev->irq) { /* enable plx9080 interrupts */ - RtdPlxInterruptWrite(dev, ICS_PIE | ICS_PLIE); + /* disable channel (required) */ + writeb(0, dma_cs_addr); + udelay(1); /* needed?? */ + /* set abort bit for channel */ + writeb(PLX_DMA_ABORT_BIT, dma_cs_addr); + + /* wait for dma done bit to be set */ + status = readb(dma_cs_addr); + for (ii = 0; + (status & PLX_DMA_DONE_BIT) == 0 && ii < RTD_DMA_TIMEOUT; ii++) { + status = readb(dma_cs_addr); + WAIT_QUIETLY; + } + if ((status & PLX_DMA_DONE_BIT) == 0) { + printk("rtd520: Timeout waiting for dma %i done set\n", + channel); } - printk("\ncomedi%d: rtd520 driver attached.\n", dev->minor); +abortDmaExit: + /* spin_unlock_irqrestore( &dev->spinlock, flags ); */ +} - return 1; +/* + Process what is in the DMA transfer buffer and pass to comedi + Note: this is not re-entrant +*/ +static int ai_process_dma(struct comedi_device *dev, struct comedi_subdevice *s) +{ + int ii, n; + s16 *dp; -#if 0 - /* hit an error, clean up memory and return ret */ -/* rtd_attach_die_error: */ -#ifdef USE_DMA - for (index = 0; index < DMA_CHAIN_COUNT; index++) { - if (NULL != devpriv->dma0Buff[index]) { /* free buffer memory */ - pci_free_consistent(devpriv->pci_dev, - sizeof(u16) * devpriv->fifoLen / 2, - devpriv->dma0Buff[index], - devpriv->dma0BuffPhysAddr[index]); - devpriv->dma0Buff[index] = NULL; + if (devpriv->aiCount == 0) /* transfer already complete */ + return 0; + + dp = devpriv->dma0Buff[devpriv->dma0Offset]; + for (ii = 0; ii < devpriv->fifoLen / 2;) { /* convert samples */ + short sample; + + if (CHAN_ARRAY_TEST(devpriv->chanBipolar, s->async->cur_chan)) { + sample = (*dp >> 3) + 2048; /* convert to comedi unsigned data */ + else + sample = *dp >> 3; /* low 3 bits are marker lines */ + + *dp++ = sample; /* put processed value back */ + + if (++s->async->cur_chan >= s->async->cmd.chanlist_len) + s->async->cur_chan = 0; + + ++ii; /* number ready to transfer */ + if (devpriv->aiCount > 0) { /* < 0, means read forever */ + if (--devpriv->aiCount == 0) { /* done */ + /*DPRINTK ("rtd520: Final %d samples\n", ii); */ + break; + } } } - if (NULL != devpriv->dma0Chain) { - pci_free_consistent(devpriv->pci_dev, - sizeof(struct plx_dma_desc) - * DMA_CHAIN_COUNT, - devpriv->dma0Chain, - devpriv->dma0ChainPhysAddr); - devpriv->dma0Chain = NULL; - } -#endif /* USE_DMA */ - /* subdevices and priv are freed by the core */ - if (dev->irq) { - /* disable interrupt controller */ - RtdPlxInterruptWrite(dev, RtdPlxInterruptRead(dev) - & ~(ICS_PLIE | ICS_DMA0_E | ICS_DMA1_E)); - free_irq(dev->irq, dev); + + /* now pass the whole array to the comedi buffer */ + dp = devpriv->dma0Buff[devpriv->dma0Offset]; + n = comedi_buf_write_alloc(s->async, ii * sizeof(s16)); + if (n < (ii * sizeof(s16))) { /* any residual is an error */ + DPRINTK("rtd520:ai_process_dma buffer overflow %d samples!\n", + ii - (n / sizeof(s16))); + s->async->events |= COMEDI_CB_ERROR; + return -1; } + comedi_buf_memcpy_to(s->async, 0, dp, n); + comedi_buf_write_free(s->async, n); - /* release all regions that were allocated */ - if (devpriv->las0) - iounmap(devpriv->las0); + /* + * always at least 1 scan -- 1/2 FIFO is larger than our max scan list + */ + s->async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOS; - if (devpriv->las1) - iounmap(devpriv->las1); + if (++devpriv->dma0Offset >= DMA_CHAIN_COUNT) { /* next buffer */ + devpriv->dma0Offset = 0; + } + return 0; +} +#endif /* USE_DMA */ - if (devpriv->lcfg) - iounmap(devpriv->lcfg); +/* + Handle all rtd520 interrupts. + Runs atomically and is never re-entered. + This is a "slow handler"; other interrupts may be active. + The data conversion may someday happen in a "bottom half". +*/ +static irqreturn_t rtd_interrupt(int irq, /* interrupt number (ignored) */ + void *d) +{ /* our data *//* cpu context (ignored) */ + struct comedi_device *dev = d; /* must be called "dev" for devpriv */ + u16 status; + u16 fifoStatus; + struct comedi_subdevice *s = dev->subdevices + 0; /* analog in subdevice */ - if (devpriv->pci_dev) - pci_dev_put(devpriv->pci_dev); + if (!dev->attached) + return IRQ_NONE; - return ret; -#endif -} + devpriv->intCount++; /* DEBUG statistics */ -static void rtd_detach(struct comedi_device *dev) -{ + fifoStatus = RtdFifoStatus(dev); + /* check for FIFO full, this automatically halts the ADC! */ + if (!(fifoStatus & FS_ADC_NOT_FULL)) { /* 0 -> full */ + DPRINTK("rtd520: FIFO full! fifo_status=0x%x\n", (fifoStatus ^ 0x6666) & 0x7777); /* should be all 0s */ + goto abortTransfer; + } #ifdef USE_DMA - int index; -#endif + if (devpriv->flags & DMA0_ACTIVE) { /* Check DMA */ + u32 istatus = RtdPlxInterruptRead(dev); - if (devpriv) { - /* Shut down any board ops by resetting it */ -#ifdef USE_DMA - if (devpriv->lcfg) { - RtdDma0Control(dev, 0); /* disable DMA */ - RtdDma1Control(dev, 0); /* disable DMA */ - RtdPlxInterruptWrite(dev, ICS_PIE | ICS_PLIE); - } -#endif /* USE_DMA */ - if (devpriv->las0) { - RtdResetBoard(dev); - RtdInterruptMask(dev, 0); - RtdInterruptClearMask(dev, ~0); - RtdInterruptClear(dev); /* clears bits set by mask */ - } -#ifdef USE_DMA - /* release DMA */ - for (index = 0; index < DMA_CHAIN_COUNT; index++) { - if (NULL != devpriv->dma0Buff[index]) { - pci_free_consistent(devpriv->pci_dev, - sizeof(u16) * - devpriv->fifoLen / 2, - devpriv->dma0Buff[index], - devpriv-> - dma0BuffPhysAddr[index]); - devpriv->dma0Buff[index] = NULL; + if (istatus & ICS_DMA0_A) { + if (ai_process_dma(dev, s) < 0) { + DPRINTK + ("rtd520: comedi read buffer overflow (DMA) with %ld to go!\n", + devpriv->aiCount); + RtdDma0Control(dev, + (devpriv->dma0Control & + ~PLX_DMA_START_BIT) + | PLX_CLEAR_DMA_INTR_BIT); + goto abortTransfer; } + + /*DPRINTK ("rtd520: DMA transfer: %ld to go, istatus %x\n", + devpriv->aiCount, istatus); */ + RtdDma0Control(dev, + (devpriv-> + dma0Control & ~PLX_DMA_START_BIT) + | PLX_CLEAR_DMA_INTR_BIT); + if (0 == devpriv->aiCount) { /* counted down */ + DPRINTK("rtd520: Samples Done (DMA).\n"); + goto transferDone; + } + comedi_event(dev, s); + } else { + /*DPRINTK ("rtd520: No DMA ready: istatus %x\n", istatus); */ } - if (NULL != devpriv->dma0Chain) { - pci_free_consistent(devpriv->pci_dev, - sizeof(struct plx_dma_desc) * - DMA_CHAIN_COUNT, devpriv->dma0Chain, - devpriv->dma0ChainPhysAddr); - devpriv->dma0Chain = NULL; - } + } + /* Fall through and check for other interrupt sources */ #endif /* USE_DMA */ - if (dev->irq) { - RtdPlxInterruptWrite(dev, RtdPlxInterruptRead(dev) - & ~(ICS_PLIE | ICS_DMA0_E | - ICS_DMA1_E)); - free_irq(dev->irq, dev); - } - if (devpriv->las0) - iounmap(devpriv->las0); - if (devpriv->las1) - iounmap(devpriv->las1); - if (devpriv->lcfg) - iounmap(devpriv->lcfg); - if (devpriv->pci_dev) { - if (devpriv->got_regions) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); + + status = RtdInterruptStatus(dev); + /* if interrupt was not caused by our board, or handled above */ + if (0 == status) + return IRQ_HANDLED; + + if (status & IRQM_ADC_ABOUT_CNT) { /* sample count -> read FIFO */ + /* since the priority interrupt controller may have queued a sample + counter interrupt, even though we have already finished, + we must handle the possibility that there is no data here */ + if (!(fifoStatus & FS_ADC_HEMPTY)) { /* 0 -> 1/2 full */ + /*DPRINTK("rtd520: Sample int, reading 1/2FIFO. fifo_status 0x%x\n", + (fifoStatus ^ 0x6666) & 0x7777); */ + if (ai_read_n(dev, s, devpriv->fifoLen / 2) < 0) { + DPRINTK + ("rtd520: comedi read buffer overflow (1/2FIFO) with %ld to go!\n", + devpriv->aiCount); + goto abortTransfer; + } + if (0 == devpriv->aiCount) { /* counted down */ + DPRINTK("rtd520: Samples Done (1/2). fifo_status was 0x%x\n", (fifoStatus ^ 0x6666) & 0x7777); /* should be all 0s */ + goto transferDone; + } + comedi_event(dev, s); + } else if (devpriv->transCount > 0) { /* read often */ + /*DPRINTK("rtd520: Sample int, reading %d fifo_status 0x%x\n", + devpriv->transCount, (fifoStatus ^ 0x6666) & 0x7777); */ + if (fifoStatus & FS_ADC_NOT_EMPTY) { /* 1 -> not empty */ + if (ai_read_n(dev, s, devpriv->transCount) < 0) { + DPRINTK + ("rtd520: comedi read buffer overflow (N) with %ld to go!\n", + devpriv->aiCount); + goto abortTransfer; + } + if (0 == devpriv->aiCount) { /* counted down */ + DPRINTK + ("rtd520: Samples Done (N). fifo_status was 0x%x\n", + (fifoStatus ^ 0x6666) & 0x7777); + goto transferDone; + } + comedi_event(dev, s); + } + } else { /* wait for 1/2 FIFO (old) */ + DPRINTK + ("rtd520: Sample int. Wait for 1/2. fifo_status 0x%x\n", + (fifoStatus ^ 0x6666) & 0x7777); } + } else { + DPRINTK("rtd520: unknown interrupt source!\n"); } -} -/* - Convert a single comedi channel-gain entry to a RTD520 table entry -*/ -static unsigned short rtdConvertChanGain(struct comedi_device *dev, - unsigned int comediChan, int chanIndex) -{ /* index in channel list */ - unsigned int chan, range, aref; - unsigned short r = 0; + if (0xffff & RtdInterruptOverrunStatus(dev)) { /* interrupt overrun */ + DPRINTK + ("rtd520: Interrupt overrun with %ld to go! over_status=0x%x\n", + devpriv->aiCount, 0xffff & RtdInterruptOverrunStatus(dev)); + goto abortTransfer; + } - chan = CR_CHAN(comediChan); - range = CR_RANGE(comediChan); - aref = CR_AREF(comediChan); + /* clear the interrupt */ + RtdInterruptClearMask(dev, status); + RtdInterruptClear(dev); + return IRQ_HANDLED; - r |= chan & 0xf; +abortTransfer: + RtdAdcClearFifo(dev); /* clears full flag */ + s->async->events |= COMEDI_CB_ERROR; + devpriv->aiCount = 0; /* stop and don't transfer any more */ + /* fall into transferDone */ - /* Note: we also setup the channel list bipolar flag array */ - if (range < thisboard->range10Start) { /* first batch are +-5 */ - r |= 0x000; /* +-5 range */ - r |= (range & 0x7) << 4; /* gain */ - CHAN_ARRAY_SET(devpriv->chanBipolar, chanIndex); - } else if (range < thisboard->rangeUniStart) { /* second batch are +-10 */ - r |= 0x100; /* +-10 range */ - /* gain */ - r |= ((range - thisboard->range10Start) & 0x7) << 4; - CHAN_ARRAY_SET(devpriv->chanBipolar, chanIndex); - } else { /* last batch is +10 */ - r |= 0x200; /* +10 range */ - /* gain */ - r |= ((range - thisboard->rangeUniStart) & 0x7) << 4; - CHAN_ARRAY_CLEAR(devpriv->chanBipolar, chanIndex); +transferDone: + RtdPacerStopSource(dev, 0); /* stop on SOFTWARE stop */ + RtdPacerStop(dev); /* Stop PACER */ + RtdAdcConversionSource(dev, 0); /* software trigger only */ + RtdInterruptMask(dev, 0); /* mask out SAMPLE */ +#ifdef USE_DMA + if (devpriv->flags & DMA0_ACTIVE) { + RtdPlxInterruptWrite(dev, /* disable any more interrupts */ + RtdPlxInterruptRead(dev) & ~ICS_DMA0_E); + abort_dma(dev, 0); + devpriv->flags &= ~DMA0_ACTIVE; + /* if Using DMA, then we should have read everything by now */ + if (devpriv->aiCount > 0) { + DPRINTK("rtd520: Lost DMA data! %ld remain\n", + devpriv->aiCount); + } } +#endif /* USE_DMA */ - switch (aref) { - case AREF_GROUND: /* on-board ground */ - break; + if (devpriv->aiCount > 0) { /* there shouldn't be anything left */ + fifoStatus = RtdFifoStatus(dev); + DPRINTK("rtd520: Finishing up. %ld remain, fifoStat=%x\n", devpriv->aiCount, (fifoStatus ^ 0x6666) & 0x7777); /* should read all 0s */ + ai_read_dregs(dev, s); /* read anything left in FIFO */ + } - case AREF_COMMON: - r |= 0x80; /* ref external analog common */ - break; + s->async->events |= COMEDI_CB_EOA; /* signal end to comedi */ + comedi_event(dev, s); - case AREF_DIFF: - r |= 0x400; /* differential inputs */ - break; + /* clear the interrupt */ + status = RtdInterruptStatus(dev); + RtdInterruptClearMask(dev, status); + RtdInterruptClear(dev); - case AREF_OTHER: /* ??? */ - break; - } - /*printk ("chan=%d r=%d a=%d -> 0x%x\n", - chan, range, aref, r); */ - return r; + fifoStatus = RtdFifoStatus(dev); /* DEBUG */ + DPRINTK + ("rtd520: Acquisition complete. %ld ints, intStat=%x, overStat=%x\n", + devpriv->intCount, status, + 0xffff & RtdInterruptOverrunStatus(dev)); + + return IRQ_HANDLED; } +#if 0 /* - Setup the channel-gain table from a comedi list + return the number of samples available */ -static void rtd_load_channelgain_list(struct comedi_device *dev, - unsigned int n_chan, unsigned int *list) +static int rtd_ai_poll(struct comedi_device *dev, struct comedi_subdevice *s) { - if (n_chan > 1) { /* setup channel gain table */ - int ii; - RtdClearCGT(dev); - RtdEnableCGT(dev, 1); /* enable table */ - for (ii = 0; ii < n_chan; ii++) { - RtdWriteCGTable(dev, rtdConvertChanGain(dev, list[ii], - ii)); - } - } else { /* just use the channel gain latch */ - RtdEnableCGT(dev, 0); /* disable table, enable latch */ - RtdWriteCGLatch(dev, rtdConvertChanGain(dev, list[0], 0)); - } + /* TODO: This needs to mask interrupts, read_dregs, and then re-enable */ + /* Not sure what to do if DMA is active */ + return s->async->buf_write_count - s->async->buf_read_count; } +#endif -/* determine fifo size by doing adc conversions until the fifo half -empty status flag clears */ -static int rtd520_probe_fifo_depth(struct comedi_device *dev) +/* + cmdtest tests a particular command to see if it is valid. + Using the cmdtest ioctl, a user can create a valid cmd + and then have it executed by the cmd ioctl (asyncronously). + + cmdtest returns 1,2,3,4 or 0, depending on which tests + the command passes. +*/ + +static int rtd_ai_cmdtest(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_cmd *cmd) { - unsigned int chanspec = CR_PACK(0, 0, AREF_GROUND); - unsigned i; - static const unsigned limit = 0x2000; - unsigned fifo_size = 0; + int err = 0; + int tmp; - RtdAdcClearFifo(dev); - rtd_load_channelgain_list(dev, 1, &chanspec); - RtdAdcConversionSource(dev, 0); /* software */ - /* convert samples */ - for (i = 0; i < limit; ++i) { - unsigned fifo_status; - /* trigger conversion */ - RtdAdcStart(dev); - udelay(1); - fifo_status = RtdFifoStatus(dev); - if ((fifo_status & FS_ADC_HEMPTY) == 0) { - fifo_size = 2 * i; - break; - } - } - if (i == limit) { - printk(KERN_INFO "\ncomedi: %s: failed to probe fifo size.\n", - DRV_NAME); - return -EIO; - } - RtdAdcClearFifo(dev); - if (fifo_size != 0x400 && fifo_size != 0x2000) { - printk - (KERN_INFO "\ncomedi: %s: unexpected fifo size of %i, expected 1024 or 8192.\n", - DRV_NAME, fifo_size); - return -EIO; - } - return fifo_size; -} + /* step 1: make sure trigger sources are trivially valid */ -/* - "instructions" read/write data in "one-shot" or "software-triggered" - mode (simplest case). - This doesn't use interrupts. + tmp = cmd->start_src; + cmd->start_src &= TRIG_NOW; + if (!cmd->start_src || tmp != cmd->start_src) + err++; - Note, we don't do any settling delays. Use a instruction list to - select, delay, then read. - */ -static int rtd_ai_rinsn(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, - unsigned int *data) -{ - int n, ii; - int stat; + tmp = cmd->scan_begin_src; + cmd->scan_begin_src &= TRIG_TIMER | TRIG_EXT; + if (!cmd->scan_begin_src || tmp != cmd->scan_begin_src) + err++; - /* clear any old fifo data */ - RtdAdcClearFifo(dev); - /* write channel to multiplexer and clear channel gain table */ - rtd_load_channelgain_list(dev, 1, &insn->chanspec); + tmp = cmd->convert_src; + cmd->convert_src &= TRIG_TIMER | TRIG_EXT; + if (!cmd->convert_src || tmp != cmd->convert_src) + err++; - /* set conversion source */ - RtdAdcConversionSource(dev, 0); /* software */ - /* convert n samples */ - for (n = 0; n < insn->n; n++) { - s16 d; - /* trigger conversion */ - RtdAdcStart(dev); + tmp = cmd->scan_end_src; + cmd->scan_end_src &= TRIG_COUNT; + if (!cmd->scan_end_src || tmp != cmd->scan_end_src) + err++; - for (ii = 0; ii < RTD_ADC_TIMEOUT; ++ii) { - stat = RtdFifoStatus(dev); - if (stat & FS_ADC_NOT_EMPTY) /* 1 -> not empty */ - break; - WAIT_QUIETLY; - } - if (ii >= RTD_ADC_TIMEOUT) { - DPRINTK - ("rtd520: Error: ADC never finished! FifoStatus=0x%x\n", - stat ^ 0x6666); - return -ETIMEDOUT; - } - /* read data */ - d = RtdAdcFifoGet(dev); /* get 2s comp value */ - /*printk ("rtd520: Got 0x%x after %d usec\n", d, ii+1); */ - d = d >> 3; /* low 3 bits are marker lines */ - if (CHAN_ARRAY_TEST(devpriv->chanBipolar, 0)) - /* convert to comedi unsigned data */ - data[n] = d + 2048; - else - data[n] = d; + tmp = cmd->stop_src; + cmd->stop_src &= TRIG_COUNT | TRIG_NONE; + if (!cmd->stop_src || tmp != cmd->stop_src) + err++; + + + if (err) + return 1; + + /* step 2: make sure trigger sources are unique + and mutually compatible */ + /* note that mutual compatibility is not an issue here */ + if (cmd->scan_begin_src != TRIG_TIMER && + cmd->scan_begin_src != TRIG_EXT) { + err++; } + if (cmd->convert_src != TRIG_TIMER && cmd->convert_src != TRIG_EXT) + err++; - /* return the number of samples read/written */ - return n; -} + if (cmd->stop_src != TRIG_COUNT && cmd->stop_src != TRIG_NONE) + err++; -/* - Get what we know is there.... Fast! - This uses 1/2 the bus cycles of read_dregs (below). + if (err) + return 2; - The manual claims that we can do a lword read, but it doesn't work here. -*/ -static int ai_read_n(struct comedi_device *dev, struct comedi_subdevice *s, - int count) -{ - int ii; + /* step 3: make sure arguments are trivially compatible */ - for (ii = 0; ii < count; ii++) { - short sample; - s16 d; + if (cmd->start_arg != 0) { + cmd->start_arg = 0; + err++; + } - if (0 == devpriv->aiCount) { /* done */ - d = RtdAdcFifoGet(dev); /* Read N and discard */ - continue; + if (cmd->scan_begin_src == TRIG_TIMER) { + /* Note: these are time periods, not actual rates */ + if (1 == cmd->chanlist_len) { /* no scanning */ + if (cmd->scan_begin_arg < RTD_MAX_SPEED_1) { + cmd->scan_begin_arg = RTD_MAX_SPEED_1; + rtd_ns_to_timer(&cmd->scan_begin_arg, + TRIG_ROUND_UP); + err++; + } + if (cmd->scan_begin_arg > RTD_MIN_SPEED_1) { + cmd->scan_begin_arg = RTD_MIN_SPEED_1; + rtd_ns_to_timer(&cmd->scan_begin_arg, + TRIG_ROUND_DOWN); + err++; + } + } else { + if (cmd->scan_begin_arg < RTD_MAX_SPEED) { + cmd->scan_begin_arg = RTD_MAX_SPEED; + rtd_ns_to_timer(&cmd->scan_begin_arg, + TRIG_ROUND_UP); + err++; + } + if (cmd->scan_begin_arg > RTD_MIN_SPEED) { + cmd->scan_begin_arg = RTD_MIN_SPEED; + rtd_ns_to_timer(&cmd->scan_begin_arg, + TRIG_ROUND_DOWN); + err++; + } } -#if 0 - if (0 == (RtdFifoStatus(dev) & FS_ADC_NOT_EMPTY)) { /* DEBUG */ - DPRINTK("comedi: READ OOPS on %d of %d\n", ii + 1, - count); - break; + } else { + /* external trigger */ + /* should be level/edge, hi/lo specification here */ + /* should specify multiple external triggers */ + if (cmd->scan_begin_arg > 9) { + cmd->scan_begin_arg = 9; + err++; + } + } + if (cmd->convert_src == TRIG_TIMER) { + if (1 == cmd->chanlist_len) { /* no scanning */ + if (cmd->convert_arg < RTD_MAX_SPEED_1) { + cmd->convert_arg = RTD_MAX_SPEED_1; + rtd_ns_to_timer(&cmd->convert_arg, + TRIG_ROUND_UP); + err++; + } + if (cmd->convert_arg > RTD_MIN_SPEED_1) { + cmd->convert_arg = RTD_MIN_SPEED_1; + rtd_ns_to_timer(&cmd->convert_arg, + TRIG_ROUND_DOWN); + err++; + } + } else { + if (cmd->convert_arg < RTD_MAX_SPEED) { + cmd->convert_arg = RTD_MAX_SPEED; + rtd_ns_to_timer(&cmd->convert_arg, + TRIG_ROUND_UP); + err++; + } + if (cmd->convert_arg > RTD_MIN_SPEED) { + cmd->convert_arg = RTD_MIN_SPEED; + rtd_ns_to_timer(&cmd->convert_arg, + TRIG_ROUND_DOWN); + err++; + } + } + } else { + /* external trigger */ + /* see above */ + if (cmd->convert_arg > 9) { + cmd->convert_arg = 9; + err++; } + } + +#if 0 + if (cmd->scan_end_arg != cmd->chanlist_len) { + cmd->scan_end_arg = cmd->chanlist_len; + err++; + } #endif - d = RtdAdcFifoGet(dev); /* get 2s comp value */ + if (cmd->stop_src == TRIG_COUNT) { + /* TODO check for rounding error due to counter wrap */ - d = d >> 3; /* low 3 bits are marker lines */ - if (CHAN_ARRAY_TEST(devpriv->chanBipolar, s->async->cur_chan)) { - /* convert to comedi unsigned data */ - sample = d + 2048; - } else - sample = d; + } else { + /* TRIG_NONE */ + if (cmd->stop_arg != 0) { + cmd->stop_arg = 0; + err++; + } + } - if (!comedi_buf_put(s->async, sample)) - return -1; + if (err) + return 3; - if (devpriv->aiCount > 0) /* < 0, means read forever */ - devpriv->aiCount--; + + /* step 4: fix up any arguments */ + + if (cmd->chanlist_len > RTD_MAX_CHANLIST) { + cmd->chanlist_len = RTD_MAX_CHANLIST; + err++; } - return 0; -} + if (cmd->scan_begin_src == TRIG_TIMER) { + tmp = cmd->scan_begin_arg; + rtd_ns_to_timer(&cmd->scan_begin_arg, + cmd->flags & TRIG_ROUND_MASK); + if (tmp != cmd->scan_begin_arg) + err++; -/* - unknown amout of data is waiting in fifo. -*/ -static int ai_read_dregs(struct comedi_device *dev, struct comedi_subdevice *s) -{ - while (RtdFifoStatus(dev) & FS_ADC_NOT_EMPTY) { /* 1 -> not empty */ - short sample; - s16 d = RtdAdcFifoGet(dev); /* get 2s comp value */ + } + if (cmd->convert_src == TRIG_TIMER) { + tmp = cmd->convert_arg; + rtd_ns_to_timer(&cmd->convert_arg, + cmd->flags & TRIG_ROUND_MASK); + if (tmp != cmd->convert_arg) + err++; - if (0 == devpriv->aiCount) { /* done */ - continue; /* read rest */ + if (cmd->scan_begin_src == TRIG_TIMER + && (cmd->scan_begin_arg + < (cmd->convert_arg * cmd->scan_end_arg))) { + cmd->scan_begin_arg = + cmd->convert_arg * cmd->scan_end_arg; + err++; } + } - d = d >> 3; /* low 3 bits are marker lines */ - if (CHAN_ARRAY_TEST(devpriv->chanBipolar, s->async->cur_chan)) { - /* convert to comedi unsigned data */ - sample = d + 2048; - } else - sample = d; - - if (!comedi_buf_put(s->async, sample)) - return -1; + if (err) + return 4; - if (devpriv->aiCount > 0) /* < 0, means read forever */ - devpriv->aiCount--; - } return 0; } -#ifdef USE_DMA /* - Terminate a DMA transfer and wait for everything to quiet down + Execute a analog in command with many possible triggering options. + The data get stored in the async structure of the subdevice. + This is usually done by an interrupt handler. + Userland gets to the data using read calls. */ -void abort_dma(struct comedi_device *dev, unsigned int channel) -{ /* DMA channel 0, 1 */ - unsigned long dma_cs_addr; /* the control/status register */ - uint8_t status; - unsigned int ii; - /* unsigned long flags; */ - - dma_cs_addr = (unsigned long)devpriv->lcfg - + ((channel == 0) ? LCFG_DMACSR0 : LCFG_DMACSR1); - - /* spinlock for plx dma control/status reg */ - /* spin_lock_irqsave( &dev->spinlock, flags ); */ +static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) +{ + struct comedi_cmd *cmd = &s->async->cmd; + int timer; - /* abort dma transfer if necessary */ - status = readb(dma_cs_addr); - if ((status & PLX_DMA_EN_BIT) == 0) { /* not enabled (Error?) */ - DPRINTK("rtd520: AbortDma on non-active channel %d (0x%x)\n", - channel, status); - goto abortDmaExit; + /* stop anything currently running */ + RtdPacerStopSource(dev, 0); /* stop on SOFTWARE stop */ + RtdPacerStop(dev); /* make sure PACER is stopped */ + RtdAdcConversionSource(dev, 0); /* software trigger only */ + RtdInterruptMask(dev, 0); +#ifdef USE_DMA + if (devpriv->flags & DMA0_ACTIVE) { /* cancel anything running */ + RtdPlxInterruptWrite(dev, /* disable any more interrupts */ + RtdPlxInterruptRead(dev) & ~ICS_DMA0_E); + abort_dma(dev, 0); + devpriv->flags &= ~DMA0_ACTIVE; + if (RtdPlxInterruptRead(dev) & ICS_DMA0_A) { /*clear pending int */ + RtdDma0Control(dev, PLX_CLEAR_DMA_INTR_BIT); + } } + RtdDma0Reset(dev); /* reset onboard state */ +#endif /* USE_DMA */ + RtdAdcClearFifo(dev); /* clear any old data */ + RtdInterruptOverrunClear(dev); + devpriv->intCount = 0; - /* wait to make sure done bit is zero (needed?) */ - for (ii = 0; (status & PLX_DMA_DONE_BIT) && ii < RTD_DMA_TIMEOUT; ii++) { - WAIT_QUIETLY; - status = readb(dma_cs_addr); - } - if (status & PLX_DMA_DONE_BIT) { - printk("rtd520: Timeout waiting for dma %i done clear\n", - channel); - goto abortDmaExit; + if (!dev->irq) { /* we need interrupts for this */ + DPRINTK("rtd520: ERROR! No interrupt available!\n"); + return -ENXIO; } - /* disable channel (required) */ - writeb(0, dma_cs_addr); - udelay(1); /* needed?? */ - /* set abort bit for channel */ - writeb(PLX_DMA_ABORT_BIT, dma_cs_addr); + /* start configuration */ + /* load channel list and reset CGT */ + rtd_load_channelgain_list(dev, cmd->chanlist_len, cmd->chanlist); - /* wait for dma done bit to be set */ - status = readb(dma_cs_addr); - for (ii = 0; - (status & PLX_DMA_DONE_BIT) == 0 && ii < RTD_DMA_TIMEOUT; ii++) { - status = readb(dma_cs_addr); - WAIT_QUIETLY; + /* setup the common case and override if needed */ + if (cmd->chanlist_len > 1) { + /*DPRINTK ("rtd520: Multi channel setup\n"); */ + RtdPacerStartSource(dev, 0); /* software triggers pacer */ + RtdBurstStartSource(dev, 1); /* PACER triggers burst */ + RtdAdcConversionSource(dev, 2); /* BURST triggers ADC */ + } else { /* single channel */ + /*DPRINTK ("rtd520: single channel setup\n"); */ + RtdPacerStartSource(dev, 0); /* software triggers pacer */ + RtdAdcConversionSource(dev, 1); /* PACER triggers ADC */ } - if ((status & PLX_DMA_DONE_BIT) == 0) { - printk("rtd520: Timeout waiting for dma %i done set\n", - channel); + RtdAboutCounter(dev, devpriv->fifoLen / 2 - 1); /* 1/2 FIFO */ + + if (TRIG_TIMER == cmd->scan_begin_src) { + /* scan_begin_arg is in nanoseconds */ + /* find out how many samples to wait before transferring */ + if (cmd->flags & TRIG_WAKE_EOS) { + /* this may generate un-sustainable interrupt rates */ + /* the application is responsible for doing the right thing */ + devpriv->transCount = cmd->chanlist_len; + devpriv->flags |= SEND_EOS; + } else { + /* arrange to transfer data periodically */ + devpriv->transCount + = + (TRANS_TARGET_PERIOD * cmd->chanlist_len) / + cmd->scan_begin_arg; + if (devpriv->transCount < cmd->chanlist_len) { + /* transfer after each scan (and avoid 0) */ + devpriv->transCount = cmd->chanlist_len; + } else { /* make a multiple of scan length */ + devpriv->transCount = + (devpriv->transCount + + cmd->chanlist_len - 1) + / cmd->chanlist_len; + devpriv->transCount *= cmd->chanlist_len; + } + devpriv->flags |= SEND_EOS; + } + if (devpriv->transCount >= (devpriv->fifoLen / 2)) { + /* out of counter range, use 1/2 fifo instead */ + devpriv->transCount = 0; + devpriv->flags &= ~SEND_EOS; + } else { + /* interrupt for each transfer */ + RtdAboutCounter(dev, devpriv->transCount - 1); + } + + DPRINTK + ("rtd520: scanLen=%d transferCount=%d fifoLen=%d\n scanTime(ns)=%d flags=0x%x\n", + cmd->chanlist_len, devpriv->transCount, devpriv->fifoLen, + cmd->scan_begin_arg, devpriv->flags); + } else { /* unknown timing, just use 1/2 FIFO */ + devpriv->transCount = 0; + devpriv->flags &= ~SEND_EOS; } + RtdPacerClockSource(dev, 1); /* use INTERNAL 8Mhz clock source */ + RtdAboutStopEnable(dev, 1); /* just interrupt, dont stop */ -abortDmaExit: - /* spin_unlock_irqrestore( &dev->spinlock, flags ); */ -} + /* BUG??? these look like enumerated values, but they are bit fields */ -/* - Process what is in the DMA transfer buffer and pass to comedi - Note: this is not re-entrant -*/ -static int ai_process_dma(struct comedi_device *dev, struct comedi_subdevice *s) -{ - int ii, n; - s16 *dp; + /* First, setup when to stop */ + switch (cmd->stop_src) { + case TRIG_COUNT: /* stop after N scans */ + devpriv->aiCount = cmd->stop_arg * cmd->chanlist_len; + if ((devpriv->transCount > 0) + && (devpriv->transCount > devpriv->aiCount)) { + devpriv->transCount = devpriv->aiCount; + } + break; - if (devpriv->aiCount == 0) /* transfer already complete */ - return 0; + case TRIG_NONE: /* stop when cancel is called */ + devpriv->aiCount = -1; /* read forever */ + break; - dp = devpriv->dma0Buff[devpriv->dma0Offset]; - for (ii = 0; ii < devpriv->fifoLen / 2;) { /* convert samples */ - short sample; + default: + DPRINTK("rtd520: Warning! ignoring stop_src mode %d\n", + cmd->stop_src); + } + + /* Scan timing */ + switch (cmd->scan_begin_src) { + case TRIG_TIMER: /* periodic scanning */ + timer = rtd_ns_to_timer(&cmd->scan_begin_arg, + TRIG_ROUND_NEAREST); + /* set PACER clock */ + /*DPRINTK ("rtd520: loading %d into pacer\n", timer); */ + RtdPacerCounter(dev, timer); - if (CHAN_ARRAY_TEST(devpriv->chanBipolar, s->async->cur_chan)) { - sample = (*dp >> 3) + 2048; /* convert to comedi unsigned data */ - else - sample = *dp >> 3; /* low 3 bits are marker lines */ + break; - *dp++ = sample; /* put processed value back */ + case TRIG_EXT: + RtdPacerStartSource(dev, 1); /* EXTERNALy trigger pacer */ + break; - if (++s->async->cur_chan >= s->async->cmd.chanlist_len) - s->async->cur_chan = 0; + default: + DPRINTK("rtd520: Warning! ignoring scan_begin_src mode %d\n", + cmd->scan_begin_src); + } - ++ii; /* number ready to transfer */ - if (devpriv->aiCount > 0) { /* < 0, means read forever */ - if (--devpriv->aiCount == 0) { /* done */ - /*DPRINTK ("rtd520: Final %d samples\n", ii); */ - break; - } + /* Sample timing within a scan */ + switch (cmd->convert_src) { + case TRIG_TIMER: /* periodic */ + if (cmd->chanlist_len > 1) { /* only needed for multi-channel */ + timer = rtd_ns_to_timer(&cmd->convert_arg, + TRIG_ROUND_NEAREST); + /* setup BURST clock */ + /*DPRINTK ("rtd520: loading %d into burst\n", timer); */ + RtdBurstCounter(dev, timer); } - } - /* now pass the whole array to the comedi buffer */ - dp = devpriv->dma0Buff[devpriv->dma0Offset]; - n = comedi_buf_write_alloc(s->async, ii * sizeof(s16)); - if (n < (ii * sizeof(s16))) { /* any residual is an error */ - DPRINTK("rtd520:ai_process_dma buffer overflow %d samples!\n", - ii - (n / sizeof(s16))); - s->async->events |= COMEDI_CB_ERROR; - return -1; - } - comedi_buf_memcpy_to(s->async, 0, dp, n); - comedi_buf_write_free(s->async, n); + break; - /* - * always at least 1 scan -- 1/2 FIFO is larger than our max scan list - */ - s->async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOS; + case TRIG_EXT: /* external */ + RtdBurstStartSource(dev, 2); /* EXTERNALy trigger burst */ + break; - if (++devpriv->dma0Offset >= DMA_CHAIN_COUNT) { /* next buffer */ - devpriv->dma0Offset = 0; + default: + DPRINTK("rtd520: Warning! ignoring convert_src mode %d\n", + cmd->convert_src); } - return 0; -} -#endif /* USE_DMA */ - -/* - Handle all rtd520 interrupts. - Runs atomically and is never re-entered. - This is a "slow handler"; other interrupts may be active. - The data conversion may someday happen in a "bottom half". -*/ -static irqreturn_t rtd_interrupt(int irq, /* interrupt number (ignored) */ - void *d) -{ /* our data *//* cpu context (ignored) */ - struct comedi_device *dev = d; /* must be called "dev" for devpriv */ - u16 status; - u16 fifoStatus; - struct comedi_subdevice *s = dev->subdevices + 0; /* analog in subdevice */ - - if (!dev->attached) - return IRQ_NONE; + /* end configuration */ - devpriv->intCount++; /* DEBUG statistics */ + /* This doesn't seem to work. There is no way to clear an interrupt + that the priority controller has queued! */ + RtdInterruptClearMask(dev, ~0); /* clear any existing flags */ + RtdInterruptClear(dev); - fifoStatus = RtdFifoStatus(dev); - /* check for FIFO full, this automatically halts the ADC! */ - if (!(fifoStatus & FS_ADC_NOT_FULL)) { /* 0 -> full */ - DPRINTK("rtd520: FIFO full! fifo_status=0x%x\n", (fifoStatus ^ 0x6666) & 0x7777); /* should be all 0s */ - goto abortTransfer; - } + /* TODO: allow multiple interrupt sources */ + if (devpriv->transCount > 0) { /* transfer every N samples */ + RtdInterruptMask(dev, IRQM_ADC_ABOUT_CNT); + DPRINTK("rtd520: Transferring every %d\n", devpriv->transCount); + } else { /* 1/2 FIFO transfers */ #ifdef USE_DMA - if (devpriv->flags & DMA0_ACTIVE) { /* Check DMA */ - u32 istatus = RtdPlxInterruptRead(dev); + devpriv->flags |= DMA0_ACTIVE; - if (istatus & ICS_DMA0_A) { - if (ai_process_dma(dev, s) < 0) { - DPRINTK - ("rtd520: comedi read buffer overflow (DMA) with %ld to go!\n", - devpriv->aiCount); - RtdDma0Control(dev, - (devpriv->dma0Control & - ~PLX_DMA_START_BIT) - | PLX_CLEAR_DMA_INTR_BIT); - goto abortTransfer; - } + /* point to first transfer in ring */ + devpriv->dma0Offset = 0; + RtdDma0Mode(dev, DMA_MODE_BITS); + RtdDma0Next(dev, /* point to first block */ + devpriv->dma0Chain[DMA_CHAIN_COUNT - 1].next); + RtdDma0Source(dev, DMAS_ADFIFO_HALF_FULL); /* set DMA trigger source */ - /*DPRINTK ("rtd520: DMA transfer: %ld to go, istatus %x\n", - devpriv->aiCount, istatus); */ - RtdDma0Control(dev, - (devpriv-> - dma0Control & ~PLX_DMA_START_BIT) - | PLX_CLEAR_DMA_INTR_BIT); - if (0 == devpriv->aiCount) { /* counted down */ - DPRINTK("rtd520: Samples Done (DMA).\n"); - goto transferDone; - } - comedi_event(dev, s); - } else { - /*DPRINTK ("rtd520: No DMA ready: istatus %x\n", istatus); */ - } - } - /* Fall through and check for other interrupt sources */ + RtdPlxInterruptWrite(dev, /* enable interrupt */ + RtdPlxInterruptRead(dev) | ICS_DMA0_E); + /* Must be 2 steps. See PLX app note about "Starting a DMA transfer" */ + RtdDma0Control(dev, PLX_DMA_EN_BIT); /* enable DMA (clear INTR?) */ + RtdDma0Control(dev, PLX_DMA_EN_BIT | PLX_DMA_START_BIT); /*start DMA */ + DPRINTK("rtd520: Using DMA0 transfers. plxInt %x RtdInt %x\n", + RtdPlxInterruptRead(dev), devpriv->intMask); +#else /* USE_DMA */ + RtdInterruptMask(dev, IRQM_ADC_ABOUT_CNT); + DPRINTK("rtd520: Transferring every 1/2 FIFO\n"); #endif /* USE_DMA */ - - status = RtdInterruptStatus(dev); - /* if interrupt was not caused by our board, or handled above */ - if (0 == status) - return IRQ_HANDLED; - - if (status & IRQM_ADC_ABOUT_CNT) { /* sample count -> read FIFO */ - /* since the priority interrupt controller may have queued a sample - counter interrupt, even though we have already finished, - we must handle the possibility that there is no data here */ - if (!(fifoStatus & FS_ADC_HEMPTY)) { /* 0 -> 1/2 full */ - /*DPRINTK("rtd520: Sample int, reading 1/2FIFO. fifo_status 0x%x\n", - (fifoStatus ^ 0x6666) & 0x7777); */ - if (ai_read_n(dev, s, devpriv->fifoLen / 2) < 0) { - DPRINTK - ("rtd520: comedi read buffer overflow (1/2FIFO) with %ld to go!\n", - devpriv->aiCount); - goto abortTransfer; - } - if (0 == devpriv->aiCount) { /* counted down */ - DPRINTK("rtd520: Samples Done (1/2). fifo_status was 0x%x\n", (fifoStatus ^ 0x6666) & 0x7777); /* should be all 0s */ - goto transferDone; - } - comedi_event(dev, s); - } else if (devpriv->transCount > 0) { /* read often */ - /*DPRINTK("rtd520: Sample int, reading %d fifo_status 0x%x\n", - devpriv->transCount, (fifoStatus ^ 0x6666) & 0x7777); */ - if (fifoStatus & FS_ADC_NOT_EMPTY) { /* 1 -> not empty */ - if (ai_read_n(dev, s, devpriv->transCount) < 0) { - DPRINTK - ("rtd520: comedi read buffer overflow (N) with %ld to go!\n", - devpriv->aiCount); - goto abortTransfer; - } - if (0 == devpriv->aiCount) { /* counted down */ - DPRINTK - ("rtd520: Samples Done (N). fifo_status was 0x%x\n", - (fifoStatus ^ 0x6666) & 0x7777); - goto transferDone; - } - comedi_event(dev, s); - } - } else { /* wait for 1/2 FIFO (old) */ - DPRINTK - ("rtd520: Sample int. Wait for 1/2. fifo_status 0x%x\n", - (fifoStatus ^ 0x6666) & 0x7777); - } - } else { - DPRINTK("rtd520: unknown interrupt source!\n"); - } - - if (0xffff & RtdInterruptOverrunStatus(dev)) { /* interrupt overrun */ - DPRINTK - ("rtd520: Interrupt overrun with %ld to go! over_status=0x%x\n", - devpriv->aiCount, 0xffff & RtdInterruptOverrunStatus(dev)); - goto abortTransfer; } - /* clear the interrupt */ - RtdInterruptClearMask(dev, status); - RtdInterruptClear(dev); - return IRQ_HANDLED; + /* BUG: start_src is ASSUMED to be TRIG_NOW */ + /* BUG? it seems like things are running before the "start" */ + RtdPacerStart(dev); /* Start PACER */ + return 0; +} -abortTransfer: - RtdAdcClearFifo(dev); /* clears full flag */ - s->async->events |= COMEDI_CB_ERROR; - devpriv->aiCount = 0; /* stop and don't transfer any more */ - /* fall into transferDone */ +/* + Stop a running data acquisition. +*/ +static int rtd_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) +{ + u16 status; -transferDone: RtdPacerStopSource(dev, 0); /* stop on SOFTWARE stop */ RtdPacerStop(dev); /* Stop PACER */ RtdAdcConversionSource(dev, 0); /* software trigger only */ - RtdInterruptMask(dev, 0); /* mask out SAMPLE */ + RtdInterruptMask(dev, 0); + devpriv->aiCount = 0; /* stop and don't transfer any more */ #ifdef USE_DMA if (devpriv->flags & DMA0_ACTIVE) { RtdPlxInterruptWrite(dev, /* disable any more interrupts */ RtdPlxInterruptRead(dev) & ~ICS_DMA0_E); abort_dma(dev, 0); devpriv->flags &= ~DMA0_ACTIVE; - /* if Using DMA, then we should have read everything by now */ - if (devpriv->aiCount > 0) { - DPRINTK("rtd520: Lost DMA data! %ld remain\n", - devpriv->aiCount); - } } #endif /* USE_DMA */ - - if (devpriv->aiCount > 0) { /* there shouldn't be anything left */ - fifoStatus = RtdFifoStatus(dev); - DPRINTK("rtd520: Finishing up. %ld remain, fifoStat=%x\n", devpriv->aiCount, (fifoStatus ^ 0x6666) & 0x7777); /* should read all 0s */ - ai_read_dregs(dev, s); /* read anything left in FIFO */ - } - - s->async->events |= COMEDI_CB_EOA; /* signal end to comedi */ - comedi_event(dev, s); - - /* clear the interrupt */ status = RtdInterruptStatus(dev); - RtdInterruptClearMask(dev, status); - RtdInterruptClear(dev); - - fifoStatus = RtdFifoStatus(dev); /* DEBUG */ DPRINTK - ("rtd520: Acquisition complete. %ld ints, intStat=%x, overStat=%x\n", - devpriv->intCount, status, - 0xffff & RtdInterruptOverrunStatus(dev)); - - return IRQ_HANDLED; -} - -#if 0 -/* - return the number of samples available -*/ -static int rtd_ai_poll(struct comedi_device *dev, struct comedi_subdevice *s) -{ - /* TODO: This needs to mask interrupts, read_dregs, and then re-enable */ - /* Not sure what to do if DMA is active */ - return s->async->buf_write_count - s->async->buf_read_count; + ("rtd520: Acquisition canceled. %ld ints, intStat=%x, overStat=%x\n", + devpriv->intCount, status, + 0xffff & RtdInterruptOverrunStatus(dev)); + return 0; } -#endif /* - cmdtest tests a particular command to see if it is valid. - Using the cmdtest ioctl, a user can create a valid cmd - and then have it executed by the cmd ioctl (asyncronously). - - cmdtest returns 1,2,3,4 or 0, depending on which tests - the command passes. + Output one (or more) analog values to a single port as fast as possible. */ - -static int rtd_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) +static int rtd_ao_winsn(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, + unsigned int *data) { - int err = 0; - int tmp; - - /* step 1: make sure trigger sources are trivially valid */ - - tmp = cmd->start_src; - cmd->start_src &= TRIG_NOW; - if (!cmd->start_src || tmp != cmd->start_src) - err++; - - tmp = cmd->scan_begin_src; - cmd->scan_begin_src &= TRIG_TIMER | TRIG_EXT; - if (!cmd->scan_begin_src || tmp != cmd->scan_begin_src) - err++; - - - tmp = cmd->convert_src; - cmd->convert_src &= TRIG_TIMER | TRIG_EXT; - if (!cmd->convert_src || tmp != cmd->convert_src) - err++; - - - tmp = cmd->scan_end_src; - cmd->scan_end_src &= TRIG_COUNT; - if (!cmd->scan_end_src || tmp != cmd->scan_end_src) - err++; - - - tmp = cmd->stop_src; - cmd->stop_src &= TRIG_COUNT | TRIG_NONE; - if (!cmd->stop_src || tmp != cmd->stop_src) - err++; + int i; + int chan = CR_CHAN(insn->chanspec); + int range = CR_RANGE(insn->chanspec); + /* Configure the output range (table index matches the range values) */ + RtdDacRange(dev, chan, range); - if (err) - return 1; + /* Writing a list of values to an AO channel is probably not + * very useful, but that's how the interface is defined. */ + for (i = 0; i < insn->n; ++i) { + int val = data[i] << 3; + int stat = 0; /* initialize to avoid bogus warning */ + int ii; - /* step 2: make sure trigger sources are unique - and mutually compatible */ - /* note that mutual compatibility is not an issue here */ - if (cmd->scan_begin_src != TRIG_TIMER && - cmd->scan_begin_src != TRIG_EXT) { - err++; - } - if (cmd->convert_src != TRIG_TIMER && cmd->convert_src != TRIG_EXT) - err++; + /* VERIFY: comedi range and offset conversions */ - if (cmd->stop_src != TRIG_COUNT && cmd->stop_src != TRIG_NONE) - err++; + if ((range > 1) /* bipolar */ + && (data[i] < 2048)) { + /* offset and sign extend */ + val = (((int)data[i]) - 2048) << 3; + } else { /* unipolor */ + val = data[i] << 3; + } - if (err) - return 2; + DPRINTK + ("comedi: rtd520 DAC chan=%d range=%d writing %d as 0x%x\n", + chan, range, data[i], val); - /* step 3: make sure arguments are trivially compatible */ + /* a typical programming sequence */ + RtdDacFifoPut(dev, chan, val); /* put the value in */ + RtdDacUpdate(dev, chan); /* trigger the conversion */ - if (cmd->start_arg != 0) { - cmd->start_arg = 0; - err++; - } + devpriv->aoValue[chan] = data[i]; /* save for read back */ - if (cmd->scan_begin_src == TRIG_TIMER) { - /* Note: these are time periods, not actual rates */ - if (1 == cmd->chanlist_len) { /* no scanning */ - if (cmd->scan_begin_arg < RTD_MAX_SPEED_1) { - cmd->scan_begin_arg = RTD_MAX_SPEED_1; - rtd_ns_to_timer(&cmd->scan_begin_arg, - TRIG_ROUND_UP); - err++; - } - if (cmd->scan_begin_arg > RTD_MIN_SPEED_1) { - cmd->scan_begin_arg = RTD_MIN_SPEED_1; - rtd_ns_to_timer(&cmd->scan_begin_arg, - TRIG_ROUND_DOWN); - err++; - } - } else { - if (cmd->scan_begin_arg < RTD_MAX_SPEED) { - cmd->scan_begin_arg = RTD_MAX_SPEED; - rtd_ns_to_timer(&cmd->scan_begin_arg, - TRIG_ROUND_UP); - err++; - } - if (cmd->scan_begin_arg > RTD_MIN_SPEED) { - cmd->scan_begin_arg = RTD_MIN_SPEED; - rtd_ns_to_timer(&cmd->scan_begin_arg, - TRIG_ROUND_DOWN); - err++; - } - } - } else { - /* external trigger */ - /* should be level/edge, hi/lo specification here */ - /* should specify multiple external triggers */ - if (cmd->scan_begin_arg > 9) { - cmd->scan_begin_arg = 9; - err++; - } - } - if (cmd->convert_src == TRIG_TIMER) { - if (1 == cmd->chanlist_len) { /* no scanning */ - if (cmd->convert_arg < RTD_MAX_SPEED_1) { - cmd->convert_arg = RTD_MAX_SPEED_1; - rtd_ns_to_timer(&cmd->convert_arg, - TRIG_ROUND_UP); - err++; - } - if (cmd->convert_arg > RTD_MIN_SPEED_1) { - cmd->convert_arg = RTD_MIN_SPEED_1; - rtd_ns_to_timer(&cmd->convert_arg, - TRIG_ROUND_DOWN); - err++; - } - } else { - if (cmd->convert_arg < RTD_MAX_SPEED) { - cmd->convert_arg = RTD_MAX_SPEED; - rtd_ns_to_timer(&cmd->convert_arg, - TRIG_ROUND_UP); - err++; - } - if (cmd->convert_arg > RTD_MIN_SPEED) { - cmd->convert_arg = RTD_MIN_SPEED; - rtd_ns_to_timer(&cmd->convert_arg, - TRIG_ROUND_DOWN); - err++; - } + for (ii = 0; ii < RTD_DAC_TIMEOUT; ++ii) { + stat = RtdFifoStatus(dev); + /* 1 -> not empty */ + if (stat & ((0 == chan) ? FS_DAC1_NOT_EMPTY : + FS_DAC2_NOT_EMPTY)) + break; + WAIT_QUIETLY; } - } else { - /* external trigger */ - /* see above */ - if (cmd->convert_arg > 9) { - cmd->convert_arg = 9; - err++; + if (ii >= RTD_DAC_TIMEOUT) { + DPRINTK + ("rtd520: Error: DAC never finished! FifoStatus=0x%x\n", + stat ^ 0x6666); + return -ETIMEDOUT; } } -#if 0 - if (cmd->scan_end_arg != cmd->chanlist_len) { - cmd->scan_end_arg = cmd->chanlist_len; - err++; - } -#endif - if (cmd->stop_src == TRIG_COUNT) { - /* TODO check for rounding error due to counter wrap */ + /* return the number of samples read/written */ + return i; +} - } else { - /* TRIG_NONE */ - if (cmd->stop_arg != 0) { - cmd->stop_arg = 0; - err++; - } - } +/* AO subdevices should have a read insn as well as a write insn. + * Usually this means copying a value stored in devpriv. */ +static int rtd_ao_rinsn(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, + unsigned int *data) +{ + int i; + int chan = CR_CHAN(insn->chanspec); - if (err) - return 3; + for (i = 0; i < insn->n; i++) + data[i] = devpriv->aoValue[chan]; - /* step 4: fix up any arguments */ + return i; +} - if (cmd->chanlist_len > RTD_MAX_CHANLIST) { - cmd->chanlist_len = RTD_MAX_CHANLIST; - err++; - } - if (cmd->scan_begin_src == TRIG_TIMER) { - tmp = cmd->scan_begin_arg; - rtd_ns_to_timer(&cmd->scan_begin_arg, - cmd->flags & TRIG_ROUND_MASK); - if (tmp != cmd->scan_begin_arg) - err++; +/* + Write a masked set of bits and the read back the port. + We track what the bits should be (i.e. we don't read the port first). - } - if (cmd->convert_src == TRIG_TIMER) { - tmp = cmd->convert_arg; - rtd_ns_to_timer(&cmd->convert_arg, - cmd->flags & TRIG_ROUND_MASK); - if (tmp != cmd->convert_arg) - err++; + DIO devices are slightly special. Although it is possible to + * implement the insn_read/insn_write interface, it is much more + * useful to applications if you implement the insn_bits interface. + * This allows packed reading/writing of the DIO channels. The + * comedi core can convert between insn_bits and insn_read/write + */ +static int rtd_dio_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) +{ + if (insn->n != 2) + return -EINVAL; - if (cmd->scan_begin_src == TRIG_TIMER - && (cmd->scan_begin_arg - < (cmd->convert_arg * cmd->scan_end_arg))) { - cmd->scan_begin_arg = - cmd->convert_arg * cmd->scan_end_arg; - err++; - } + /* The insn data is a mask in data[0] and the new data + * in data[1], each channel cooresponding to a bit. */ + if (data[0]) { + s->state &= ~data[0]; + s->state |= data[0] & data[1]; + + /* Write out the new digital output lines */ + RtdDio0Write(dev, s->state); } + /* on return, data[1] contains the value of the digital + * input lines. */ + data[1] = RtdDio0Read(dev); - if (err) - return 4; + /*DPRINTK("rtd520:port_0 wrote: 0x%x read: 0x%x\n", s->state, data[1]); */ - return 0; + return 2; } /* - Execute a analog in command with many possible triggering options. - The data get stored in the async structure of the subdevice. - This is usually done by an interrupt handler. - Userland gets to the data using read calls. + Configure one bit on a IO port as Input or Output (hence the name :-). */ -static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) +static int rtd_dio_insn_config(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - struct comedi_cmd *cmd = &s->async->cmd; - int timer; - - /* stop anything currently running */ - RtdPacerStopSource(dev, 0); /* stop on SOFTWARE stop */ - RtdPacerStop(dev); /* make sure PACER is stopped */ - RtdAdcConversionSource(dev, 0); /* software trigger only */ - RtdInterruptMask(dev, 0); -#ifdef USE_DMA - if (devpriv->flags & DMA0_ACTIVE) { /* cancel anything running */ - RtdPlxInterruptWrite(dev, /* disable any more interrupts */ - RtdPlxInterruptRead(dev) & ~ICS_DMA0_E); - abort_dma(dev, 0); - devpriv->flags &= ~DMA0_ACTIVE; - if (RtdPlxInterruptRead(dev) & ICS_DMA0_A) { /*clear pending int */ - RtdDma0Control(dev, PLX_CLEAR_DMA_INTR_BIT); - } - } - RtdDma0Reset(dev); /* reset onboard state */ -#endif /* USE_DMA */ - RtdAdcClearFifo(dev); /* clear any old data */ - RtdInterruptOverrunClear(dev); - devpriv->intCount = 0; - - if (!dev->irq) { /* we need interrupts for this */ - DPRINTK("rtd520: ERROR! No interrupt available!\n"); - return -ENXIO; - } - - /* start configuration */ - /* load channel list and reset CGT */ - rtd_load_channelgain_list(dev, cmd->chanlist_len, cmd->chanlist); + int chan = CR_CHAN(insn->chanspec); - /* setup the common case and override if needed */ - if (cmd->chanlist_len > 1) { - /*DPRINTK ("rtd520: Multi channel setup\n"); */ - RtdPacerStartSource(dev, 0); /* software triggers pacer */ - RtdBurstStartSource(dev, 1); /* PACER triggers burst */ - RtdAdcConversionSource(dev, 2); /* BURST triggers ADC */ - } else { /* single channel */ - /*DPRINTK ("rtd520: single channel setup\n"); */ - RtdPacerStartSource(dev, 0); /* software triggers pacer */ - RtdAdcConversionSource(dev, 1); /* PACER triggers ADC */ + /* The input or output configuration of each digital line is + * configured by a special insn_config instruction. chanspec + * contains the channel to be changed, and data[0] contains the + * value COMEDI_INPUT or COMEDI_OUTPUT. */ + switch (data[0]) { + case INSN_CONFIG_DIO_OUTPUT: + s->io_bits |= 1 << chan; /* 1 means Out */ + break; + case INSN_CONFIG_DIO_INPUT: + s->io_bits &= ~(1 << chan); + break; + case INSN_CONFIG_DIO_QUERY: + data[1] = + (s->io_bits & (1 << chan)) ? COMEDI_OUTPUT : COMEDI_INPUT; + return insn->n; + break; + default: + return -EINVAL; } - RtdAboutCounter(dev, devpriv->fifoLen / 2 - 1); /* 1/2 FIFO */ - if (TRIG_TIMER == cmd->scan_begin_src) { - /* scan_begin_arg is in nanoseconds */ - /* find out how many samples to wait before transferring */ - if (cmd->flags & TRIG_WAKE_EOS) { - /* this may generate un-sustainable interrupt rates */ - /* the application is responsible for doing the right thing */ - devpriv->transCount = cmd->chanlist_len; - devpriv->flags |= SEND_EOS; - } else { - /* arrange to transfer data periodically */ - devpriv->transCount - = - (TRANS_TARGET_PERIOD * cmd->chanlist_len) / - cmd->scan_begin_arg; - if (devpriv->transCount < cmd->chanlist_len) { - /* transfer after each scan (and avoid 0) */ - devpriv->transCount = cmd->chanlist_len; - } else { /* make a multiple of scan length */ - devpriv->transCount = - (devpriv->transCount + - cmd->chanlist_len - 1) - / cmd->chanlist_len; - devpriv->transCount *= cmd->chanlist_len; - } - devpriv->flags |= SEND_EOS; - } - if (devpriv->transCount >= (devpriv->fifoLen / 2)) { - /* out of counter range, use 1/2 fifo instead */ - devpriv->transCount = 0; - devpriv->flags &= ~SEND_EOS; - } else { - /* interrupt for each transfer */ - RtdAboutCounter(dev, devpriv->transCount - 1); - } + DPRINTK("rtd520: port_0_direction=0x%x (1 means out)\n", s->io_bits); + /* TODO support digital match interrupts and strobes */ + RtdDioStatusWrite(dev, 0x01); /* make Dio0Ctrl point to direction */ + RtdDio0CtrlWrite(dev, s->io_bits); /* set direction 1 means Out */ + RtdDioStatusWrite(dev, 0); /* make Dio0Ctrl clear interrupts */ - DPRINTK - ("rtd520: scanLen=%d transferCount=%d fifoLen=%d\n scanTime(ns)=%d flags=0x%x\n", - cmd->chanlist_len, devpriv->transCount, devpriv->fifoLen, - cmd->scan_begin_arg, devpriv->flags); - } else { /* unknown timing, just use 1/2 FIFO */ - devpriv->transCount = 0; - devpriv->flags &= ~SEND_EOS; - } - RtdPacerClockSource(dev, 1); /* use INTERNAL 8Mhz clock source */ - RtdAboutStopEnable(dev, 1); /* just interrupt, dont stop */ + /* port1 can only be all input or all output */ - /* BUG??? these look like enumerated values, but they are bit fields */ + /* there are also 2 user input lines and 2 user output lines */ - /* First, setup when to stop */ - switch (cmd->stop_src) { - case TRIG_COUNT: /* stop after N scans */ - devpriv->aiCount = cmd->stop_arg * cmd->chanlist_len; - if ((devpriv->transCount > 0) - && (devpriv->transCount > devpriv->aiCount)) { - devpriv->transCount = devpriv->aiCount; - } - break; + return 1; +} - case TRIG_NONE: /* stop when cancel is called */ - devpriv->aiCount = -1; /* read forever */ - break; +static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) +{ /* board name and options flags */ + struct comedi_subdevice *s; + struct pci_dev *pcidev; + int ret; + resource_size_t physLas0; /* configuration */ + resource_size_t physLas1; /* data area */ + resource_size_t physLcfg; /* PLX9080 */ +#ifdef USE_DMA + int index; +#endif - default: - DPRINTK("rtd520: Warning! ignoring stop_src mode %d\n", - cmd->stop_src); - } + printk(KERN_INFO "comedi%d: rtd520 attaching.\n", dev->minor); - /* Scan timing */ - switch (cmd->scan_begin_src) { - case TRIG_TIMER: /* periodic scanning */ - timer = rtd_ns_to_timer(&cmd->scan_begin_arg, - TRIG_ROUND_NEAREST); - /* set PACER clock */ - /*DPRINTK ("rtd520: loading %d into pacer\n", timer); */ - RtdPacerCounter(dev, timer); +#if defined(CONFIG_COMEDI_DEBUG) && defined(USE_DMA) + /* You can set this a load time: modprobe comedi comedi_debug=1 */ + if (0 == comedi_debug) /* force DMA debug printks */ + comedi_debug = 1; +#endif - break; + /* + * Allocate the private structure area. alloc_private() is a + * convenient macro defined in comedidev.h. + */ + if (alloc_private(dev, sizeof(struct rtdPrivate)) < 0) + return -ENOMEM; - case TRIG_EXT: - RtdPacerStartSource(dev, 1); /* EXTERNALy trigger pacer */ - break; + /* + * Probe the device to determine what device in the series it is. + */ + for (pcidev = pci_get_device(PCI_VENDOR_ID_RTD, PCI_ANY_ID, NULL); + pcidev != NULL; + pcidev = pci_get_device(PCI_VENDOR_ID_RTD, PCI_ANY_ID, pcidev)) { + int i; - default: - DPRINTK("rtd520: Warning! ignoring scan_begin_src mode %d\n", - cmd->scan_begin_src); + if (it->options[0] || it->options[1]) { + if (pcidev->bus->number != it->options[0] + || PCI_SLOT(pcidev->devfn) != it->options[1]) { + continue; + } + } + for (i = 0; i < ARRAY_SIZE(rtd520Boards); ++i) { + if (pcidev->device == rtd520Boards[i].device_id) { + dev->board_ptr = &rtd520Boards[i]; + break; + } + } + if (dev->board_ptr) + break; /* found one */ } - - /* Sample timing within a scan */ - switch (cmd->convert_src) { - case TRIG_TIMER: /* periodic */ - if (cmd->chanlist_len > 1) { /* only needed for multi-channel */ - timer = rtd_ns_to_timer(&cmd->convert_arg, - TRIG_ROUND_NEAREST); - /* setup BURST clock */ - /*DPRINTK ("rtd520: loading %d into burst\n", timer); */ - RtdBurstCounter(dev, timer); + if (!pcidev) { + if (it->options[0] && it->options[1]) { + printk(KERN_INFO "No RTD card at bus=%d slot=%d.\n", + it->options[0], it->options[1]); + } else { + printk(KERN_INFO "No RTD card found.\n"); } + return -EIO; + } + devpriv->pci_dev = pcidev; + dev->board_name = thisboard->name; - break; - - case TRIG_EXT: /* external */ - RtdBurstStartSource(dev, 2); /* EXTERNALy trigger burst */ - break; - - default: - DPRINTK("rtd520: Warning! ignoring convert_src mode %d\n", - cmd->convert_src); + ret = comedi_pci_enable(pcidev, DRV_NAME); + if (ret < 0) { + printk(KERN_INFO "Failed to enable PCI device and request regions.\n"); + return ret; } - /* end configuration */ + devpriv->got_regions = 1; - /* This doesn't seem to work. There is no way to clear an interrupt - that the priority controller has queued! */ - RtdInterruptClearMask(dev, ~0); /* clear any existing flags */ - RtdInterruptClear(dev); + /* + * Initialize base addresses + */ + /* Get the physical address from PCI config */ + physLas0 = pci_resource_start(devpriv->pci_dev, LAS0_PCIINDEX); + physLas1 = pci_resource_start(devpriv->pci_dev, LAS1_PCIINDEX); + physLcfg = pci_resource_start(devpriv->pci_dev, LCFG_PCIINDEX); + /* Now have the kernel map this into memory */ + /* ASSUME page aligned */ + devpriv->las0 = ioremap_nocache(physLas0, LAS0_PCISIZE); + devpriv->las1 = ioremap_nocache(physLas1, LAS1_PCISIZE); + devpriv->lcfg = ioremap_nocache(physLcfg, LCFG_PCISIZE); - /* TODO: allow multiple interrupt sources */ - if (devpriv->transCount > 0) { /* transfer every N samples */ - RtdInterruptMask(dev, IRQM_ADC_ABOUT_CNT); - DPRINTK("rtd520: Transferring every %d\n", devpriv->transCount); - } else { /* 1/2 FIFO transfers */ -#ifdef USE_DMA - devpriv->flags |= DMA0_ACTIVE; + if (!devpriv->las0 || !devpriv->las1 || !devpriv->lcfg) + return -ENOMEM; - /* point to first transfer in ring */ - devpriv->dma0Offset = 0; - RtdDma0Mode(dev, DMA_MODE_BITS); - RtdDma0Next(dev, /* point to first block */ - devpriv->dma0Chain[DMA_CHAIN_COUNT - 1].next); - RtdDma0Source(dev, DMAS_ADFIFO_HALF_FULL); /* set DMA trigger source */ - RtdPlxInterruptWrite(dev, /* enable interrupt */ - RtdPlxInterruptRead(dev) | ICS_DMA0_E); - /* Must be 2 steps. See PLX app note about "Starting a DMA transfer" */ - RtdDma0Control(dev, PLX_DMA_EN_BIT); /* enable DMA (clear INTR?) */ - RtdDma0Control(dev, PLX_DMA_EN_BIT | PLX_DMA_START_BIT); /*start DMA */ - DPRINTK("rtd520: Using DMA0 transfers. plxInt %x RtdInt %x\n", - RtdPlxInterruptRead(dev), devpriv->intMask); -#else /* USE_DMA */ - RtdInterruptMask(dev, IRQM_ADC_ABOUT_CNT); - DPRINTK("rtd520: Transferring every 1/2 FIFO\n"); -#endif /* USE_DMA */ - } + DPRINTK("%s: LAS0=%llx, LAS1=%llx, CFG=%llx.\n", dev->board_name, + (unsigned long long)physLas0, (unsigned long long)physLas1, + (unsigned long long)physLcfg); + { /* The RTD driver does this */ + unsigned char pci_latency; + u16 revision; + /*uint32_t epld_version; */ - /* BUG: start_src is ASSUMED to be TRIG_NOW */ - /* BUG? it seems like things are running before the "start" */ - RtdPacerStart(dev); /* Start PACER */ - return 0; -} + pci_read_config_word(devpriv->pci_dev, PCI_REVISION_ID, + &revision); + DPRINTK("%s: PCI revision %d.\n", dev->board_name, revision); -/* - Stop a running data acquisition. -*/ -static int rtd_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) -{ - u16 status; + pci_read_config_byte(devpriv->pci_dev, + PCI_LATENCY_TIMER, &pci_latency); + if (pci_latency < 32) { + printk(KERN_INFO "%s: PCI latency changed from %d to %d\n", + dev->board_name, pci_latency, 32); + pci_write_config_byte(devpriv->pci_dev, + PCI_LATENCY_TIMER, 32); + } else { + DPRINTK("rtd520: PCI latency = %d\n", pci_latency); + } - RtdPacerStopSource(dev, 0); /* stop on SOFTWARE stop */ - RtdPacerStop(dev); /* Stop PACER */ - RtdAdcConversionSource(dev, 0); /* software trigger only */ - RtdInterruptMask(dev, 0); - devpriv->aiCount = 0; /* stop and don't transfer any more */ -#ifdef USE_DMA - if (devpriv->flags & DMA0_ACTIVE) { - RtdPlxInterruptWrite(dev, /* disable any more interrupts */ - RtdPlxInterruptRead(dev) & ~ICS_DMA0_E); - abort_dma(dev, 0); - devpriv->flags &= ~DMA0_ACTIVE; + /* + * Undocumented EPLD version (doesn't match RTD driver results) + */ + /*DPRINTK ("rtd520: Reading epld from %p\n", + devpriv->las0+0); + epld_version = readl (devpriv->las0+0); + if ((epld_version & 0xF0) >> 4 == 0x0F) { + DPRINTK("rtd520: pre-v8 EPLD. (%x)\n", epld_version); + } else { + DPRINTK("rtd520: EPLD version %x.\n", epld_version >> 4); + } */ } -#endif /* USE_DMA */ - status = RtdInterruptStatus(dev); - DPRINTK - ("rtd520: Acquisition canceled. %ld ints, intStat=%x, overStat=%x\n", - devpriv->intCount, status, - 0xffff & RtdInterruptOverrunStatus(dev)); - return 0; -} -/* - Given a desired period and the clock period (both in ns), - return the proper counter value (divider-1). - Sets the original period to be the true value. - Note: you have to check if the value is larger than the counter range! -*/ -static int rtd_ns_to_timer_base(unsigned int *nanosec, /* desired period (in ns) */ - int round_mode, int base) -{ /* clock period (in ns) */ - int divider; + /* Show board configuration */ + printk(KERN_INFO "%s:", dev->board_name); - switch (round_mode) { - case TRIG_ROUND_NEAREST: - default: - divider = (*nanosec + base / 2) / base; - break; - case TRIG_ROUND_DOWN: - divider = (*nanosec) / base; - break; - case TRIG_ROUND_UP: - divider = (*nanosec + base - 1) / base; - break; - } - if (divider < 2) - divider = 2; /* min is divide by 2 */ + /* + * Allocate the subdevice structures. alloc_subdevice() is a + * convenient macro defined in comedidev.h. + */ + if (alloc_subdevices(dev, 4) < 0) + return -ENOMEM; - /* Note: we don't check for max, because different timers - have different ranges */ - *nanosec = base * divider; - return divider - 1; /* countdown is divisor+1 */ -} + s = dev->subdevices + 0; + dev->read_subdev = s; + /* analog input subdevice */ + s->type = COMEDI_SUBD_AI; + s->subdev_flags = + SDF_READABLE | SDF_GROUND | SDF_COMMON | SDF_DIFF | SDF_CMD_READ; + s->n_chan = thisboard->aiChans; + s->maxdata = (1 << thisboard->aiBits) - 1; + if (thisboard->aiMaxGain <= 32) + s->range_table = &rtd_ai_7520_range; + else + s->range_table = &rtd_ai_4520_range; -/* - Given a desired period (in ns), - return the proper counter value (divider-1) for the internal clock. - Sets the original period to be the true value. -*/ -static int rtd_ns_to_timer(unsigned int *ns, int round_mode) -{ - return rtd_ns_to_timer_base(ns, round_mode, RTD_CLOCK_BASE); -} + s->len_chanlist = RTD_MAX_CHANLIST; /* devpriv->fifoLen */ + s->insn_read = rtd_ai_rinsn; + s->do_cmd = rtd_ai_cmd; + s->do_cmdtest = rtd_ai_cmdtest; + s->cancel = rtd_ai_cancel; + /* s->poll = rtd_ai_poll; *//* not ready yet */ -/* - Output one (or more) analog values to a single port as fast as possible. -*/ -static int rtd_ao_winsn(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, - unsigned int *data) -{ - int i; - int chan = CR_CHAN(insn->chanspec); - int range = CR_RANGE(insn->chanspec); + s = dev->subdevices + 1; + /* analog output subdevice */ + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 2; + s->maxdata = (1 << thisboard->aiBits) - 1; + s->range_table = &rtd_ao_range; + s->insn_write = rtd_ao_winsn; + s->insn_read = rtd_ao_rinsn; - /* Configure the output range (table index matches the range values) */ - RtdDacRange(dev, chan, range); + s = dev->subdevices + 2; + /* digital i/o subdevice */ + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + /* we only support port 0 right now. Ignoring port 1 and user IO */ + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = rtd_dio_insn_bits; + s->insn_config = rtd_dio_insn_config; - /* Writing a list of values to an AO channel is probably not - * very useful, but that's how the interface is defined. */ - for (i = 0; i < insn->n; ++i) { - int val = data[i] << 3; - int stat = 0; /* initialize to avoid bogus warning */ - int ii; + /* timer/counter subdevices (not currently supported) */ + s = dev->subdevices + 3; + s->type = COMEDI_SUBD_COUNTER; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 3; + s->maxdata = 0xffff; - /* VERIFY: comedi range and offset conversions */ + /* initialize board, per RTD spec */ + /* also, initialize shadow registers */ + RtdResetBoard(dev); + udelay(100); /* needed? */ + RtdPlxInterruptWrite(dev, 0); + RtdInterruptMask(dev, 0); /* and sets shadow */ + RtdInterruptClearMask(dev, ~0); /* and sets shadow */ + RtdInterruptClear(dev); /* clears bits set by mask */ + RtdInterruptOverrunClear(dev); + RtdClearCGT(dev); + RtdAdcClearFifo(dev); + RtdDacClearFifo(dev, 0); + RtdDacClearFifo(dev, 1); + /* clear digital IO fifo */ + RtdDioStatusWrite(dev, 0); /* safe state, set shadow */ + RtdUtcCtrlPut(dev, 0, 0x30); /* safe state, set shadow */ + RtdUtcCtrlPut(dev, 1, 0x30); /* safe state, set shadow */ + RtdUtcCtrlPut(dev, 2, 0x30); /* safe state, set shadow */ + RtdUtcCtrlPut(dev, 3, 0); /* safe state, set shadow */ + /* TODO: set user out source ??? */ - if ((range > 1) /* bipolar */ - && (data[i] < 2048)) { - /* offset and sign extend */ - val = (((int)data[i]) - 2048) << 3; - } else { /* unipolor */ - val = data[i] << 3; - } + /* check if our interrupt is available and get it */ + ret = request_irq(devpriv->pci_dev->irq, rtd_interrupt, + IRQF_SHARED, DRV_NAME, dev); - DPRINTK - ("comedi: rtd520 DAC chan=%d range=%d writing %d as 0x%x\n", - chan, range, data[i], val); + if (ret < 0) { + printk("Could not get interrupt! (%u)\n", + devpriv->pci_dev->irq); + return ret; + } + dev->irq = devpriv->pci_dev->irq; + printk(KERN_INFO "( irq=%u )", dev->irq); - /* a typical programming sequence */ - RtdDacFifoPut(dev, chan, val); /* put the value in */ - RtdDacUpdate(dev, chan); /* trigger the conversion */ + ret = rtd520_probe_fifo_depth(dev); + if (ret < 0) + return ret; - devpriv->aoValue[chan] = data[i]; /* save for read back */ + devpriv->fifoLen = ret; + printk("( fifoLen=%d )", devpriv->fifoLen); + +#ifdef USE_DMA + if (dev->irq > 0) { + printk("( DMA buff=%d )\n", DMA_CHAIN_COUNT); + /* + * The PLX9080 has 2 DMA controllers, but there could be + * 4 sources: ADC, digital, DAC1, and DAC2. Since only the + * ADC supports cmd mode right now, this isn't an issue (yet) + */ + devpriv->dma0Offset = 0; - for (ii = 0; ii < RTD_DAC_TIMEOUT; ++ii) { - stat = RtdFifoStatus(dev); - /* 1 -> not empty */ - if (stat & ((0 == chan) ? FS_DAC1_NOT_EMPTY : - FS_DAC2_NOT_EMPTY)) - break; - WAIT_QUIETLY; + for (index = 0; index < DMA_CHAIN_COUNT; index++) { + devpriv->dma0Buff[index] = + pci_alloc_consistent(devpriv->pci_dev, + sizeof(u16) * + devpriv->fifoLen / 2, + &devpriv-> + dma0BuffPhysAddr[index]); + if (devpriv->dma0Buff[index] == NULL) { + ret = -ENOMEM; + goto rtd_attach_die_error; + } + /*DPRINTK ("buff[%d] @ %p virtual, %x PCI\n", + index, + devpriv->dma0Buff[index], + devpriv->dma0BuffPhysAddr[index]); */ } - if (ii >= RTD_DAC_TIMEOUT) { - DPRINTK - ("rtd520: Error: DAC never finished! FifoStatus=0x%x\n", - stat ^ 0x6666); - return -ETIMEDOUT; + + /* + * setup DMA descriptor ring (use cpu_to_le32 for byte + * ordering?) + */ + devpriv->dma0Chain = + pci_alloc_consistent(devpriv->pci_dev, + sizeof(struct plx_dma_desc) * + DMA_CHAIN_COUNT, + &devpriv->dma0ChainPhysAddr); + for (index = 0; index < DMA_CHAIN_COUNT; index++) { + devpriv->dma0Chain[index].pci_start_addr = + devpriv->dma0BuffPhysAddr[index]; + devpriv->dma0Chain[index].local_start_addr = + DMALADDR_ADC; + devpriv->dma0Chain[index].transfer_size = + sizeof(u16) * devpriv->fifoLen / 2; + devpriv->dma0Chain[index].next = + (devpriv->dma0ChainPhysAddr + ((index + + 1) % + (DMA_CHAIN_COUNT)) + * sizeof(devpriv->dma0Chain[0])) + | DMA_TRANSFER_BITS; + /*DPRINTK ("ring[%d] @%lx PCI: %x, local: %x, N: 0x%x, next: %x\n", + index, + ((long)devpriv->dma0ChainPhysAddr + + (index * sizeof(devpriv->dma0Chain[0]))), + devpriv->dma0Chain[index].pci_start_addr, + devpriv->dma0Chain[index].local_start_addr, + devpriv->dma0Chain[index].transfer_size, + devpriv->dma0Chain[index].next); */ } - } - /* return the number of samples read/written */ - return i; -} + if (devpriv->dma0Chain == NULL) { + ret = -ENOMEM; + goto rtd_attach_die_error; + } -/* AO subdevices should have a read insn as well as a write insn. - * Usually this means copying a value stored in devpriv. */ -static int rtd_ao_rinsn(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, - unsigned int *data) -{ - int i; - int chan = CR_CHAN(insn->chanspec); + RtdDma0Mode(dev, DMA_MODE_BITS); + /* set DMA trigger source */ + RtdDma0Source(dev, DMAS_ADFIFO_HALF_FULL); + } else { + printk(KERN_INFO "( no IRQ->no DMA )"); + } +#endif /* USE_DMA */ - for (i = 0; i < insn->n; i++) - data[i] = devpriv->aoValue[chan]; + if (dev->irq) { /* enable plx9080 interrupts */ + RtdPlxInterruptWrite(dev, ICS_PIE | ICS_PLIE); + } + printk("\ncomedi%d: rtd520 driver attached.\n", dev->minor); - return i; -} + return 1; -/* - Write a masked set of bits and the read back the port. - We track what the bits should be (i.e. we don't read the port first). +#if 0 + /* hit an error, clean up memory and return ret */ +/* rtd_attach_die_error: */ +#ifdef USE_DMA + for (index = 0; index < DMA_CHAIN_COUNT; index++) { + if (NULL != devpriv->dma0Buff[index]) { /* free buffer memory */ + pci_free_consistent(devpriv->pci_dev, + sizeof(u16) * devpriv->fifoLen / 2, + devpriv->dma0Buff[index], + devpriv->dma0BuffPhysAddr[index]); + devpriv->dma0Buff[index] = NULL; + } + } + if (NULL != devpriv->dma0Chain) { + pci_free_consistent(devpriv->pci_dev, + sizeof(struct plx_dma_desc) + * DMA_CHAIN_COUNT, + devpriv->dma0Chain, + devpriv->dma0ChainPhysAddr); + devpriv->dma0Chain = NULL; + } +#endif /* USE_DMA */ + /* subdevices and priv are freed by the core */ + if (dev->irq) { + /* disable interrupt controller */ + RtdPlxInterruptWrite(dev, RtdPlxInterruptRead(dev) + & ~(ICS_PLIE | ICS_DMA0_E | ICS_DMA1_E)); + free_irq(dev->irq, dev); + } - DIO devices are slightly special. Although it is possible to - * implement the insn_read/insn_write interface, it is much more - * useful to applications if you implement the insn_bits interface. - * This allows packed reading/writing of the DIO channels. The - * comedi core can convert between insn_bits and insn_read/write - */ -static int rtd_dio_insn_bits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) -{ - if (insn->n != 2) - return -EINVAL; + /* release all regions that were allocated */ + if (devpriv->las0) + iounmap(devpriv->las0); - /* The insn data is a mask in data[0] and the new data - * in data[1], each channel cooresponding to a bit. */ - if (data[0]) { - s->state &= ~data[0]; - s->state |= data[0] & data[1]; + if (devpriv->las1) + iounmap(devpriv->las1); - /* Write out the new digital output lines */ - RtdDio0Write(dev, s->state); - } - /* on return, data[1] contains the value of the digital - * input lines. */ - data[1] = RtdDio0Read(dev); + if (devpriv->lcfg) + iounmap(devpriv->lcfg); - /*DPRINTK("rtd520:port_0 wrote: 0x%x read: 0x%x\n", s->state, data[1]); */ + if (devpriv->pci_dev) + pci_dev_put(devpriv->pci_dev); - return 2; + return ret; +#endif } -/* - Configure one bit on a IO port as Input or Output (hence the name :-). -*/ -static int rtd_dio_insn_config(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static void rtd_detach(struct comedi_device *dev) { - int chan = CR_CHAN(insn->chanspec); +#ifdef USE_DMA + int index; +#endif - /* The input or output configuration of each digital line is - * configured by a special insn_config instruction. chanspec - * contains the channel to be changed, and data[0] contains the - * value COMEDI_INPUT or COMEDI_OUTPUT. */ - switch (data[0]) { - case INSN_CONFIG_DIO_OUTPUT: - s->io_bits |= 1 << chan; /* 1 means Out */ - break; - case INSN_CONFIG_DIO_INPUT: - s->io_bits &= ~(1 << chan); - break; - case INSN_CONFIG_DIO_QUERY: - data[1] = - (s->io_bits & (1 << chan)) ? COMEDI_OUTPUT : COMEDI_INPUT; - return insn->n; - break; - default: - return -EINVAL; + if (devpriv) { + /* Shut down any board ops by resetting it */ +#ifdef USE_DMA + if (devpriv->lcfg) { + RtdDma0Control(dev, 0); /* disable DMA */ + RtdDma1Control(dev, 0); /* disable DMA */ + RtdPlxInterruptWrite(dev, ICS_PIE | ICS_PLIE); + } +#endif /* USE_DMA */ + if (devpriv->las0) { + RtdResetBoard(dev); + RtdInterruptMask(dev, 0); + RtdInterruptClearMask(dev, ~0); + RtdInterruptClear(dev); /* clears bits set by mask */ + } +#ifdef USE_DMA + /* release DMA */ + for (index = 0; index < DMA_CHAIN_COUNT; index++) { + if (NULL != devpriv->dma0Buff[index]) { + pci_free_consistent(devpriv->pci_dev, + sizeof(u16) * + devpriv->fifoLen / 2, + devpriv->dma0Buff[index], + devpriv-> + dma0BuffPhysAddr[index]); + devpriv->dma0Buff[index] = NULL; + } + } + if (NULL != devpriv->dma0Chain) { + pci_free_consistent(devpriv->pci_dev, + sizeof(struct plx_dma_desc) * + DMA_CHAIN_COUNT, devpriv->dma0Chain, + devpriv->dma0ChainPhysAddr); + devpriv->dma0Chain = NULL; + } +#endif /* USE_DMA */ + if (dev->irq) { + RtdPlxInterruptWrite(dev, RtdPlxInterruptRead(dev) + & ~(ICS_PLIE | ICS_DMA0_E | + ICS_DMA1_E)); + free_irq(dev->irq, dev); + } + if (devpriv->las0) + iounmap(devpriv->las0); + if (devpriv->las1) + iounmap(devpriv->las1); + if (devpriv->lcfg) + iounmap(devpriv->lcfg); + if (devpriv->pci_dev) { + if (devpriv->got_regions) + comedi_pci_disable(devpriv->pci_dev); + pci_dev_put(devpriv->pci_dev); + } } - - DPRINTK("rtd520: port_0_direction=0x%x (1 means out)\n", s->io_bits); - /* TODO support digital match interrupts and strobes */ - RtdDioStatusWrite(dev, 0x01); /* make Dio0Ctrl point to direction */ - RtdDio0CtrlWrite(dev, s->io_bits); /* set direction 1 means Out */ - RtdDioStatusWrite(dev, 0); /* make Dio0Ctrl clear interrupts */ - - /* port1 can only be all input or all output */ - - /* there are also 2 user input lines and 2 user output lines */ - - return 1; } static struct comedi_driver rtd520_driver = { -- cgit v0.10.2 From 73e183c347242c90524f8913f1af5fc481ad5370 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 23 May 2012 18:19:17 -0700 Subject: staging: comedi: das1800: complete the refactor to remove all forward declarations Complete the refactor of the das1800 driver to remove all the forward declarations. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c index 2ac3443..079fb06 100644 --- a/drivers/staging/comedi/drivers/das1800.c +++ b/drivers/staging/comedi/drivers/das1800.c @@ -183,46 +183,6 @@ enum { das1802hr, das1802hr_da, das1801hc, das1802hc, das1801ao, das1802ao }; -static int das1800_probe(struct comedi_device *dev); -static int das1800_cancel(struct comedi_device *dev, - struct comedi_subdevice *s); -static irqreturn_t das1800_interrupt(int irq, void *d); -static int das1800_ai_poll(struct comedi_device *dev, - struct comedi_subdevice *s); -static void das1800_ai_handler(struct comedi_device *dev); -static void das1800_handle_dma(struct comedi_device *dev, - struct comedi_subdevice *s, unsigned int status); -static void das1800_flush_dma(struct comedi_device *dev, - struct comedi_subdevice *s); -static void das1800_flush_dma_channel(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned int channel, uint16_t *buffer); -static void das1800_handle_fifo_half_full(struct comedi_device *dev, - struct comedi_subdevice *s); -static void das1800_handle_fifo_not_empty(struct comedi_device *dev, - struct comedi_subdevice *s); -static int das1800_ai_do_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_cmd *cmd); -static int das1800_ai_do_cmd(struct comedi_device *dev, - struct comedi_subdevice *s); -static int das1800_ai_rinsn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int das1800_ao_winsn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int das1800_di_rbits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int das1800_do_wbits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); - -static int das1800_set_frequency(struct comedi_device *dev); -static unsigned int burst_convert_arg(unsigned int convert_arg, int round_mode); -static unsigned int suggest_transfer_size(struct comedi_cmd *cmd); - /* analog input ranges */ static const struct comedi_lrange range_ai_das1801 = { 8, @@ -515,421 +475,203 @@ static const struct comedi_lrange range_ao_2 = { }; */ -static int das1800_init_dma(struct comedi_device *dev, unsigned int dma0, - unsigned int dma1) +static inline uint16_t munge_bipolar_sample(const struct comedi_device *dev, + uint16_t sample) { - unsigned long flags; - - /* need an irq to do dma */ - if (dev->irq && dma0) { - /* encode dma0 and dma1 into 2 digit hexadecimal for switch */ - switch ((dma0 & 0x7) | (dma1 << 4)) { - case 0x5: /* dma0 == 5 */ - devpriv->dma_bits |= DMA_CH5; - break; - case 0x6: /* dma0 == 6 */ - devpriv->dma_bits |= DMA_CH6; - break; - case 0x7: /* dma0 == 7 */ - devpriv->dma_bits |= DMA_CH7; - break; - case 0x65: /* dma0 == 5, dma1 == 6 */ - devpriv->dma_bits |= DMA_CH5_CH6; - break; - case 0x76: /* dma0 == 6, dma1 == 7 */ - devpriv->dma_bits |= DMA_CH6_CH7; - break; - case 0x57: /* dma0 == 7, dma1 == 5 */ - devpriv->dma_bits |= DMA_CH7_CH5; - break; - default: - dev_err(dev->hw_dev, " only supports dma channels 5 through 7\n" - " Dual dma only allows the following combinations:\n" - " dma 5,6 / 6,7 / or 7,5\n"); - return -EINVAL; - break; - } - if (request_dma(dma0, dev->driver->driver_name)) { - dev_err(dev->hw_dev, "failed to allocate dma channel %i\n", - dma0); - return -EINVAL; - } - devpriv->dma0 = dma0; - devpriv->dma_current = dma0; - if (dma1) { - if (request_dma(dma1, dev->driver->driver_name)) { - dev_err(dev->hw_dev, "failed to allocate dma channel %i\n", - dma1); - return -EINVAL; - } - devpriv->dma1 = dma1; - } - devpriv->ai_buf0 = kmalloc(DMA_BUF_SIZE, GFP_KERNEL | GFP_DMA); - if (devpriv->ai_buf0 == NULL) - return -ENOMEM; - devpriv->dma_current_buf = devpriv->ai_buf0; - if (dma1) { - devpriv->ai_buf1 = - kmalloc(DMA_BUF_SIZE, GFP_KERNEL | GFP_DMA); - if (devpriv->ai_buf1 == NULL) - return -ENOMEM; - } - flags = claim_dma_lock(); - disable_dma(devpriv->dma0); - set_dma_mode(devpriv->dma0, DMA_MODE_READ); - if (dma1) { - disable_dma(devpriv->dma1); - set_dma_mode(devpriv->dma1, DMA_MODE_READ); - } - release_dma_lock(flags); - } - return 0; + sample += 1 << (thisboard->resolution - 1); + return sample; } -static int das1800_attach(struct comedi_device *dev, - struct comedi_devconfig *it) +static void munge_data(struct comedi_device *dev, uint16_t * array, + unsigned int num_elements) { - struct comedi_subdevice *s; - unsigned long iobase = it->options[0]; - unsigned int irq = it->options[1]; - unsigned int dma0 = it->options[2]; - unsigned int dma1 = it->options[3]; - unsigned long iobase2; - int board; - int retval; + unsigned int i; + int unipolar; - /* allocate and initialize dev->private */ - if (alloc_private(dev, sizeof(struct das1800_private)) < 0) - return -ENOMEM; + /* see if card is using a unipolar or bipolar range so we can munge data correctly */ + unipolar = inb(dev->iobase + DAS1800_CONTROL_C) & UB; - printk(KERN_DEBUG "comedi%d: %s: io 0x%lx", dev->minor, - dev->driver->driver_name, iobase); - if (irq) { - printk(KERN_CONT ", irq %u", irq); - if (dma0) { - printk(KERN_CONT ", dma %u", dma0); - if (dma1) - printk(KERN_CONT " and %u", dma1); - } + /* convert to unsigned type if we are in a bipolar mode */ + if (!unipolar) { + for (i = 0; i < num_elements; i++) + array[i] = munge_bipolar_sample(dev, array[i]); } - printk(KERN_CONT "\n"); +} - if (iobase == 0) { - dev_err(dev->hw_dev, "io base address required\n"); - return -EINVAL; - } +static void das1800_handle_fifo_half_full(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + int numPoints = 0; /* number of points to read */ + struct comedi_cmd *cmd = &s->async->cmd; - /* check if io addresses are available */ - if (!request_region(iobase, DAS1800_SIZE, dev->driver->driver_name)) { - printk - (" I/O port conflict: failed to allocate ports 0x%lx to 0x%lx\n", - iobase, iobase + DAS1800_SIZE - 1); - return -EIO; - } - dev->iobase = iobase; + numPoints = FIFO_SIZE / 2; + /* if we only need some of the points */ + if (cmd->stop_src == TRIG_COUNT && devpriv->count < numPoints) + numPoints = devpriv->count; + insw(dev->iobase + DAS1800_FIFO, devpriv->ai_buf0, numPoints); + munge_data(dev, devpriv->ai_buf0, numPoints); + cfc_write_array_to_buffer(s, devpriv->ai_buf0, + numPoints * sizeof(devpriv->ai_buf0[0])); + if (cmd->stop_src == TRIG_COUNT) + devpriv->count -= numPoints; + return; +} - board = das1800_probe(dev); - if (board < 0) { - dev_err(dev->hw_dev, "unable to determine board type\n"); - return -ENODEV; - } +static void das1800_handle_fifo_not_empty(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + short dpnt; + int unipolar; + struct comedi_cmd *cmd = &s->async->cmd; - dev->board_ptr = das1800_boards + board; - dev->board_name = thisboard->name; + unipolar = inb(dev->iobase + DAS1800_CONTROL_C) & UB; - /* if it is an 'ao' board with fancy analog out then we need extra io ports */ - if (thisboard->ao_ability == 2) { - iobase2 = iobase + IOBASE2; - if (!request_region(iobase2, DAS1800_SIZE, - dev->driver->driver_name)) { - printk - (" I/O port conflict: failed to allocate ports 0x%lx to 0x%lx\n", - iobase2, iobase2 + DAS1800_SIZE - 1); - return -EIO; - } - devpriv->iobase2 = iobase2; + while (inb(dev->iobase + DAS1800_STATUS) & FNE) { + if (cmd->stop_src == TRIG_COUNT && devpriv->count == 0) + break; + dpnt = inw(dev->iobase + DAS1800_FIFO); + /* convert to unsigned type if we are in a bipolar mode */ + if (!unipolar) + ; + dpnt = munge_bipolar_sample(dev, dpnt); + cfc_write_to_buffer(s, dpnt); + if (cmd->stop_src == TRIG_COUNT) + devpriv->count--; } - /* grab our IRQ */ - if (irq) { - if (request_irq(irq, das1800_interrupt, 0, - dev->driver->driver_name, dev)) { - dev_dbg(dev->hw_dev, "unable to allocate irq %u\n", - irq); - return -EINVAL; - } - } - dev->irq = irq; + return; +} - /* set bits that tell card which irq to use */ - switch (irq) { - case 0: - break; - case 3: - devpriv->irq_dma_bits |= 0x8; - break; - case 5: - devpriv->irq_dma_bits |= 0x10; - break; - case 7: - devpriv->irq_dma_bits |= 0x18; - break; - case 10: - devpriv->irq_dma_bits |= 0x28; - break; - case 11: - devpriv->irq_dma_bits |= 0x30; - break; - case 15: - devpriv->irq_dma_bits |= 0x38; - break; - default: - dev_err(dev->hw_dev, "irq out of range\n"); - return -EINVAL; - break; - } +/* Utility function used by das1800_flush_dma() and das1800_handle_dma(). + * Assumes dma lock is held */ +static void das1800_flush_dma_channel(struct comedi_device *dev, + struct comedi_subdevice *s, + unsigned int channel, uint16_t *buffer) +{ + unsigned int num_bytes, num_samples; + struct comedi_cmd *cmd = &s->async->cmd; - retval = das1800_init_dma(dev, dma0, dma1); - if (retval < 0) - return retval; + disable_dma(channel); - if (devpriv->ai_buf0 == NULL) { - devpriv->ai_buf0 = - kmalloc(FIFO_SIZE * sizeof(uint16_t), GFP_KERNEL); - if (devpriv->ai_buf0 == NULL) - return -ENOMEM; - } + /* clear flip-flop to make sure 2-byte registers + * get set correctly */ + clear_dma_ff(channel); - if (alloc_subdevices(dev, 4) < 0) - return -ENOMEM; + /* figure out how many points to read */ + num_bytes = devpriv->dma_transfer_size - get_dma_residue(channel); + num_samples = num_bytes / sizeof(short); - /* analog input subdevice */ - s = dev->subdevices + 0; - dev->read_subdev = s; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_DIFF | SDF_GROUND | SDF_CMD_READ; - if (thisboard->common) - s->subdev_flags |= SDF_COMMON; - s->n_chan = thisboard->qram_len; - s->len_chanlist = thisboard->qram_len; - s->maxdata = (1 << thisboard->resolution) - 1; - s->range_table = thisboard->range_ai; - s->do_cmd = das1800_ai_do_cmd; - s->do_cmdtest = das1800_ai_do_cmdtest; - s->insn_read = das1800_ai_rinsn; - s->poll = das1800_ai_poll; - s->cancel = das1800_cancel; - - /* analog out */ - s = dev->subdevices + 1; - if (thisboard->ao_ability == 1) { - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = thisboard->ao_n_chan; - s->maxdata = (1 << thisboard->resolution) - 1; - s->range_table = &range_ao_1; - s->insn_write = das1800_ao_winsn; - } else { - s->type = COMEDI_SUBD_UNUSED; - } + /* if we only need some of the points */ + if (cmd->stop_src == TRIG_COUNT && devpriv->count < num_samples) + num_samples = devpriv->count; - /* di */ - s = dev->subdevices + 2; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 4; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = das1800_di_rbits; + munge_data(dev, buffer, num_samples); + cfc_write_array_to_buffer(s, buffer, num_bytes); + if (s->async->cmd.stop_src == TRIG_COUNT) + devpriv->count -= num_samples; - /* do */ - s = dev->subdevices + 3; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = thisboard->do_n_chan; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = das1800_do_wbits; + return; +} - das1800_cancel(dev, dev->read_subdev); +/* flushes remaining data from board when external trigger has stopped acquisition + * and we are using dma transfers */ +static void das1800_flush_dma(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + unsigned long flags; + const int dual_dma = devpriv->irq_dma_bits & DMA_DUAL; - /* initialize digital out channels */ - outb(devpriv->do_bits, dev->iobase + DAS1800_DIGITAL); + flags = claim_dma_lock(); + das1800_flush_dma_channel(dev, s, devpriv->dma_current, + devpriv->dma_current_buf); - /* initialize analog out channels */ - if (thisboard->ao_ability == 1) { - /* select 'update' dac channel for baseAddress + 0x0 */ - outb(DAC(thisboard->ao_n_chan - 1), - dev->iobase + DAS1800_SELECT); - outw(devpriv->ao_update_bits, dev->iobase + DAS1800_DAC); + if (dual_dma) { + /* switch to other channel and flush it */ + if (devpriv->dma_current == devpriv->dma0) { + devpriv->dma_current = devpriv->dma1; + devpriv->dma_current_buf = devpriv->ai_buf1; + } else { + devpriv->dma_current = devpriv->dma0; + devpriv->dma_current_buf = devpriv->ai_buf0; + } + das1800_flush_dma_channel(dev, s, devpriv->dma_current, + devpriv->dma_current_buf); } - return 0; -}; + release_dma_lock(flags); -static void das1800_detach(struct comedi_device *dev) -{ - if (dev->iobase) - release_region(dev->iobase, DAS1800_SIZE); - if (dev->irq) - free_irq(dev->irq, dev); - if (dev->private) { - if (devpriv->iobase2) - release_region(devpriv->iobase2, DAS1800_SIZE); - if (devpriv->dma0) - free_dma(devpriv->dma0); - if (devpriv->dma1) - free_dma(devpriv->dma1); - kfree(devpriv->ai_buf0); - kfree(devpriv->ai_buf1); - } -}; + /* get any remaining samples in fifo */ + das1800_handle_fifo_not_empty(dev, s); -/* probes and checks das-1800 series board type - */ -static int das1800_probe(struct comedi_device *dev) + return; +} + +static void das1800_handle_dma(struct comedi_device *dev, + struct comedi_subdevice *s, unsigned int status) { - int id; - int board; + unsigned long flags; + const int dual_dma = devpriv->irq_dma_bits & DMA_DUAL; - id = (inb(dev->iobase + DAS1800_DIGITAL) >> 4) & 0xf; /* get id bits */ - board = ((struct das1800_board *)dev->board_ptr) - das1800_boards; + flags = claim_dma_lock(); + das1800_flush_dma_channel(dev, s, devpriv->dma_current, + devpriv->dma_current_buf); + /* re-enable dma channel */ + set_dma_addr(devpriv->dma_current, + virt_to_bus(devpriv->dma_current_buf)); + set_dma_count(devpriv->dma_current, devpriv->dma_transfer_size); + enable_dma(devpriv->dma_current); + release_dma_lock(flags); - switch (id) { - case 0x3: - if (board == das1801st_da || board == das1802st_da || - board == das1701st_da || board == das1702st_da) { - dev_dbg(dev->hw_dev, "Board model: %s\n", - das1800_boards[board].name); - return board; - } - printk - (" Board model (probed, not recommended): das-1800st-da series\n"); - return das1801st; - break; - case 0x4: - if (board == das1802hr_da || board == das1702hr_da) { - dev_dbg(dev->hw_dev, "Board model: %s\n", - das1800_boards[board].name); - return board; - } - printk - (" Board model (probed, not recommended): das-1802hr-da\n"); - return das1802hr; - break; - case 0x5: - if (board == das1801ao || board == das1802ao || - board == das1701ao || board == das1702ao) { - dev_dbg(dev->hw_dev, "Board model: %s\n", - das1800_boards[board].name); - return board; - } - printk - (" Board model (probed, not recommended): das-1800ao series\n"); - return das1801ao; - break; - case 0x6: - if (board == das1802hr || board == das1702hr) { - dev_dbg(dev->hw_dev, "Board model: %s\n", - das1800_boards[board].name); - return board; - } - printk - (" Board model (probed, not recommended): das-1802hr\n"); - return das1802hr; - break; - case 0x7: - if (board == das1801st || board == das1802st || - board == das1701st || board == das1702st) { - dev_dbg(dev->hw_dev, "Board model: %s\n", - das1800_boards[board].name); - return board; - } - printk - (" Board model (probed, not recommended): das-1800st series\n"); - return das1801st; - break; - case 0x8: - if (board == das1801hc || board == das1802hc) { - dev_dbg(dev->hw_dev, "Board model: %s\n", - das1800_boards[board].name); - return board; + if (status & DMATC) { + /* clear DMATC interrupt bit */ + outb(CLEAR_INTR_MASK & ~DMATC, dev->iobase + DAS1800_STATUS); + /* switch dma channels for next time, if appropriate */ + if (dual_dma) { + /* read data from the other channel next time */ + if (devpriv->dma_current == devpriv->dma0) { + devpriv->dma_current = devpriv->dma1; + devpriv->dma_current_buf = devpriv->ai_buf1; + } else { + devpriv->dma_current = devpriv->dma0; + devpriv->dma_current_buf = devpriv->ai_buf0; + } } - printk - (" Board model (probed, not recommended): das-1800hc series\n"); - return das1801hc; - break; - default: - printk - (" Board model: probe returned 0x%x (unknown, please report)\n", - id); - return board; - break; } - return -1; + + return; } -static int das1800_ai_poll(struct comedi_device *dev, - struct comedi_subdevice *s) +static int das1800_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { - unsigned long flags; - - /* prevent race with interrupt handler */ - spin_lock_irqsave(&dev->spinlock, flags); - das1800_ai_handler(dev); - spin_unlock_irqrestore(&dev->spinlock, flags); - - return s->async->buf_write_count - s->async->buf_read_count; + outb(0x0, dev->iobase + DAS1800_STATUS); /* disable conversions */ + outb(0x0, dev->iobase + DAS1800_CONTROL_B); /* disable interrupts and dma */ + outb(0x0, dev->iobase + DAS1800_CONTROL_A); /* disable and clear fifo and stop triggering */ + if (devpriv->dma0) + disable_dma(devpriv->dma0); + if (devpriv->dma1) + disable_dma(devpriv->dma1); + return 0; } -static irqreturn_t das1800_interrupt(int irq, void *d) +/* the guts of the interrupt handler, that is shared with das1800_ai_poll */ +static void das1800_ai_handler(struct comedi_device *dev) { - struct comedi_device *dev = d; - unsigned int status; + struct comedi_subdevice *s = dev->subdevices + 0; /* analog input subdevice */ + struct comedi_async *async = s->async; + struct comedi_cmd *cmd = &async->cmd; + unsigned int status = inb(dev->iobase + DAS1800_STATUS); - if (dev->attached == 0) { - comedi_error(dev, "premature interrupt"); - return IRQ_HANDLED; - } - - /* Prevent race with das1800_ai_poll() on multi processor systems. - * Also protects indirect addressing in das1800_ai_handler */ - spin_lock(&dev->spinlock); - status = inb(dev->iobase + DAS1800_STATUS); - - /* if interrupt was not caused by das-1800 */ - if (!(status & INT)) { - spin_unlock(&dev->spinlock); - return IRQ_NONE; - } - /* clear the interrupt status bit INT */ - outb(CLEAR_INTR_MASK & ~INT, dev->iobase + DAS1800_STATUS); - /* handle interrupt */ - das1800_ai_handler(dev); - - spin_unlock(&dev->spinlock); - return IRQ_HANDLED; -} - -/* the guts of the interrupt handler, that is shared with das1800_ai_poll */ -static void das1800_ai_handler(struct comedi_device *dev) -{ - struct comedi_subdevice *s = dev->subdevices + 0; /* analog input subdevice */ - struct comedi_async *async = s->async; - struct comedi_cmd *cmd = &async->cmd; - unsigned int status = inb(dev->iobase + DAS1800_STATUS); - - async->events = 0; - /* select adc for base address + 0 */ - outb(ADC, dev->iobase + DAS1800_SELECT); - /* dma buffer full */ - if (devpriv->irq_dma_bits & DMA_ENABLED) { - /* look for data from dma transfer even if dma terminal count hasn't happened yet */ - das1800_handle_dma(dev, s, status); - } else if (status & FHF) { /* if fifo half full */ - das1800_handle_fifo_half_full(dev, s); - } else if (status & FNE) { /* if fifo not empty */ - das1800_handle_fifo_not_empty(dev, s); + async->events = 0; + /* select adc for base address + 0 */ + outb(ADC, dev->iobase + DAS1800_SELECT); + /* dma buffer full */ + if (devpriv->irq_dma_bits & DMA_ENABLED) { + /* look for data from dma transfer even if dma terminal count hasn't happened yet */ + das1800_handle_dma(dev, s, status); + } else if (status & FHF) { /* if fifo half full */ + das1800_handle_fifo_half_full(dev, s); + } else if (status & FNE) { /* if fifo not empty */ + das1800_handle_fifo_not_empty(dev, s); } async->events |= COMEDI_CB_BLOCK; @@ -965,182 +707,75 @@ static void das1800_ai_handler(struct comedi_device *dev) return; } -static void das1800_handle_dma(struct comedi_device *dev, - struct comedi_subdevice *s, unsigned int status) +static int das1800_ai_poll(struct comedi_device *dev, + struct comedi_subdevice *s) { unsigned long flags; - const int dual_dma = devpriv->irq_dma_bits & DMA_DUAL; - - flags = claim_dma_lock(); - das1800_flush_dma_channel(dev, s, devpriv->dma_current, - devpriv->dma_current_buf); - /* re-enable dma channel */ - set_dma_addr(devpriv->dma_current, - virt_to_bus(devpriv->dma_current_buf)); - set_dma_count(devpriv->dma_current, devpriv->dma_transfer_size); - enable_dma(devpriv->dma_current); - release_dma_lock(flags); - - if (status & DMATC) { - /* clear DMATC interrupt bit */ - outb(CLEAR_INTR_MASK & ~DMATC, dev->iobase + DAS1800_STATUS); - /* switch dma channels for next time, if appropriate */ - if (dual_dma) { - /* read data from the other channel next time */ - if (devpriv->dma_current == devpriv->dma0) { - devpriv->dma_current = devpriv->dma1; - devpriv->dma_current_buf = devpriv->ai_buf1; - } else { - devpriv->dma_current = devpriv->dma0; - devpriv->dma_current_buf = devpriv->ai_buf0; - } - } - } - return; -} + /* prevent race with interrupt handler */ + spin_lock_irqsave(&dev->spinlock, flags); + das1800_ai_handler(dev); + spin_unlock_irqrestore(&dev->spinlock, flags); -static inline uint16_t munge_bipolar_sample(const struct comedi_device *dev, - uint16_t sample) -{ - sample += 1 << (thisboard->resolution - 1); - return sample; + return s->async->buf_write_count - s->async->buf_read_count; } -static void munge_data(struct comedi_device *dev, uint16_t * array, - unsigned int num_elements) +static irqreturn_t das1800_interrupt(int irq, void *d) { - unsigned int i; - int unipolar; - - /* see if card is using a unipolar or bipolar range so we can munge data correctly */ - unipolar = inb(dev->iobase + DAS1800_CONTROL_C) & UB; + struct comedi_device *dev = d; + unsigned int status; - /* convert to unsigned type if we are in a bipolar mode */ - if (!unipolar) { - for (i = 0; i < num_elements; i++) - array[i] = munge_bipolar_sample(dev, array[i]); + if (dev->attached == 0) { + comedi_error(dev, "premature interrupt"); + return IRQ_HANDLED; } -} - -/* Utility function used by das1800_flush_dma() and das1800_handle_dma(). - * Assumes dma lock is held */ -static void das1800_flush_dma_channel(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned int channel, uint16_t *buffer) -{ - unsigned int num_bytes, num_samples; - struct comedi_cmd *cmd = &s->async->cmd; - - disable_dma(channel); - - /* clear flip-flop to make sure 2-byte registers - * get set correctly */ - clear_dma_ff(channel); - - /* figure out how many points to read */ - num_bytes = devpriv->dma_transfer_size - get_dma_residue(channel); - num_samples = num_bytes / sizeof(short); - - /* if we only need some of the points */ - if (cmd->stop_src == TRIG_COUNT && devpriv->count < num_samples) - num_samples = devpriv->count; - - munge_data(dev, buffer, num_samples); - cfc_write_array_to_buffer(s, buffer, num_bytes); - if (s->async->cmd.stop_src == TRIG_COUNT) - devpriv->count -= num_samples; - return; -} - -/* flushes remaining data from board when external trigger has stopped acquisition - * and we are using dma transfers */ -static void das1800_flush_dma(struct comedi_device *dev, - struct comedi_subdevice *s) -{ - unsigned long flags; - const int dual_dma = devpriv->irq_dma_bits & DMA_DUAL; - - flags = claim_dma_lock(); - das1800_flush_dma_channel(dev, s, devpriv->dma_current, - devpriv->dma_current_buf); + /* Prevent race with das1800_ai_poll() on multi processor systems. + * Also protects indirect addressing in das1800_ai_handler */ + spin_lock(&dev->spinlock); + status = inb(dev->iobase + DAS1800_STATUS); - if (dual_dma) { - /* switch to other channel and flush it */ - if (devpriv->dma_current == devpriv->dma0) { - devpriv->dma_current = devpriv->dma1; - devpriv->dma_current_buf = devpriv->ai_buf1; - } else { - devpriv->dma_current = devpriv->dma0; - devpriv->dma_current_buf = devpriv->ai_buf0; - } - das1800_flush_dma_channel(dev, s, devpriv->dma_current, - devpriv->dma_current_buf); + /* if interrupt was not caused by das-1800 */ + if (!(status & INT)) { + spin_unlock(&dev->spinlock); + return IRQ_NONE; } + /* clear the interrupt status bit INT */ + outb(CLEAR_INTR_MASK & ~INT, dev->iobase + DAS1800_STATUS); + /* handle interrupt */ + das1800_ai_handler(dev); - release_dma_lock(flags); - - /* get any remaining samples in fifo */ - das1800_handle_fifo_not_empty(dev, s); - - return; -} - -static void das1800_handle_fifo_half_full(struct comedi_device *dev, - struct comedi_subdevice *s) -{ - int numPoints = 0; /* number of points to read */ - struct comedi_cmd *cmd = &s->async->cmd; - - numPoints = FIFO_SIZE / 2; - /* if we only need some of the points */ - if (cmd->stop_src == TRIG_COUNT && devpriv->count < numPoints) - numPoints = devpriv->count; - insw(dev->iobase + DAS1800_FIFO, devpriv->ai_buf0, numPoints); - munge_data(dev, devpriv->ai_buf0, numPoints); - cfc_write_array_to_buffer(s, devpriv->ai_buf0, - numPoints * sizeof(devpriv->ai_buf0[0])); - if (cmd->stop_src == TRIG_COUNT) - devpriv->count -= numPoints; - return; + spin_unlock(&dev->spinlock); + return IRQ_HANDLED; } -static void das1800_handle_fifo_not_empty(struct comedi_device *dev, - struct comedi_subdevice *s) +/* converts requested conversion timing to timing compatible with + * hardware, used only when card is in 'burst mode' + */ +static unsigned int burst_convert_arg(unsigned int convert_arg, int round_mode) { - short dpnt; - int unipolar; - struct comedi_cmd *cmd = &s->async->cmd; + unsigned int micro_sec; - unipolar = inb(dev->iobase + DAS1800_CONTROL_C) & UB; + /* in burst mode, the maximum conversion time is 64 microseconds */ + if (convert_arg > 64000) + convert_arg = 64000; - while (inb(dev->iobase + DAS1800_STATUS) & FNE) { - if (cmd->stop_src == TRIG_COUNT && devpriv->count == 0) - break; - dpnt = inw(dev->iobase + DAS1800_FIFO); - /* convert to unsigned type if we are in a bipolar mode */ - if (!unipolar) - ; - dpnt = munge_bipolar_sample(dev, dpnt); - cfc_write_to_buffer(s, dpnt); - if (cmd->stop_src == TRIG_COUNT) - devpriv->count--; + /* the conversion time must be an integral number of microseconds */ + switch (round_mode) { + case TRIG_ROUND_NEAREST: + default: + micro_sec = (convert_arg + 500) / 1000; + break; + case TRIG_ROUND_DOWN: + micro_sec = convert_arg / 1000; + break; + case TRIG_ROUND_UP: + micro_sec = (convert_arg - 1) / 1000 + 1; + break; } - return; -} - -static int das1800_cancel(struct comedi_device *dev, struct comedi_subdevice *s) -{ - outb(0x0, dev->iobase + DAS1800_STATUS); /* disable conversions */ - outb(0x0, dev->iobase + DAS1800_CONTROL_B); /* disable interrupts and dma */ - outb(0x0, dev->iobase + DAS1800_CONTROL_A); /* disable and clear fifo and stop triggering */ - if (devpriv->dma0) - disable_dma(devpriv->dma0); - if (devpriv->dma1) - disable_dma(devpriv->dma1); - return 0; + /* return number of nanoseconds */ + return micro_sec * 1000; } /* test analog input cmd */ @@ -1322,10 +957,6 @@ static int das1800_ai_do_cmdtest(struct comedi_device *dev, return 0; } -/* analog input cmd interface */ - -/* first, some utility functions used in the main ai_do_cmd() */ - /* returns appropriate bits for control register a, depending on command */ static int control_a_bits(struct comedi_cmd cmd) { @@ -1396,15 +1027,34 @@ static int control_c_bits(struct comedi_cmd cmd) return control_c; } -/* sets up counters */ -static int setup_counters(struct comedi_device *dev, struct comedi_cmd cmd) +/* loads counters with divisor1, divisor2 from private structure */ +static int das1800_set_frequency(struct comedi_device *dev) { - /* setup cascaded counters for conversion/scan frequency */ - switch (cmd.scan_begin_src) { - case TRIG_FOLLOW: /* not in burst mode */ - if (cmd.convert_src == TRIG_TIMER) { - /* set conversion frequency */ - i8253_cascade_ns_to_timer_2div(TIMER_BASE, + int err = 0; + + /* counter 1, mode 2 */ + if (i8254_load(dev->iobase + DAS1800_COUNTER, 0, 1, devpriv->divisor1, + 2)) + err++; + /* counter 2, mode 2 */ + if (i8254_load(dev->iobase + DAS1800_COUNTER, 0, 2, devpriv->divisor2, + 2)) + err++; + if (err) + return -1; + + return 0; +} + +/* sets up counters */ +static int setup_counters(struct comedi_device *dev, struct comedi_cmd cmd) +{ + /* setup cascaded counters for conversion/scan frequency */ + switch (cmd.scan_begin_src) { + case TRIG_FOLLOW: /* not in burst mode */ + if (cmd.convert_src == TRIG_TIMER) { + /* set conversion frequency */ + i8253_cascade_ns_to_timer_2div(TIMER_BASE, &(devpriv->divisor1), &(devpriv->divisor2), &(cmd.convert_arg), @@ -1436,6 +1086,44 @@ static int setup_counters(struct comedi_device *dev, struct comedi_cmd cmd) return 0; } +/* utility function that suggests a dma transfer size based on the conversion period 'ns' */ +static unsigned int suggest_transfer_size(struct comedi_cmd *cmd) +{ + unsigned int size = DMA_BUF_SIZE; + static const int sample_size = 2; /* size in bytes of one sample from board */ + unsigned int fill_time = 300000000; /* target time in nanoseconds for filling dma buffer */ + unsigned int max_size; /* maximum size we will allow for a transfer */ + + /* make dma buffer fill in 0.3 seconds for timed modes */ + switch (cmd->scan_begin_src) { + case TRIG_FOLLOW: /* not in burst mode */ + if (cmd->convert_src == TRIG_TIMER) + size = (fill_time / cmd->convert_arg) * sample_size; + break; + case TRIG_TIMER: + size = (fill_time / (cmd->scan_begin_arg * cmd->chanlist_len)) * + sample_size; + break; + default: + size = DMA_BUF_SIZE; + break; + } + + /* set a minimum and maximum size allowed */ + max_size = DMA_BUF_SIZE; + /* if we are taking limited number of conversions, limit transfer size to that */ + if (cmd->stop_src == TRIG_COUNT && + cmd->stop_arg * cmd->chanlist_len * sample_size < max_size) + max_size = cmd->stop_arg * cmd->chanlist_len * sample_size; + + if (size > max_size) + size = max_size; + if (size < sample_size) + size = sample_size; + + return size; +} + /* sets up dma */ static void setup_dma(struct comedi_device *dev, struct comedi_cmd cmd) { @@ -1689,91 +1377,357 @@ static int das1800_do_wbits(struct comedi_device *dev, return 2; } -/* loads counters with divisor1, divisor2 from private structure */ -static int das1800_set_frequency(struct comedi_device *dev) +static int das1800_init_dma(struct comedi_device *dev, unsigned int dma0, + unsigned int dma1) { - int err = 0; - - /* counter 1, mode 2 */ - if (i8254_load(dev->iobase + DAS1800_COUNTER, 0, 1, devpriv->divisor1, - 2)) - err++; - /* counter 2, mode 2 */ - if (i8254_load(dev->iobase + DAS1800_COUNTER, 0, 2, devpriv->divisor2, - 2)) - err++; - if (err) - return -1; + unsigned long flags; + /* need an irq to do dma */ + if (dev->irq && dma0) { + /* encode dma0 and dma1 into 2 digit hexadecimal for switch */ + switch ((dma0 & 0x7) | (dma1 << 4)) { + case 0x5: /* dma0 == 5 */ + devpriv->dma_bits |= DMA_CH5; + break; + case 0x6: /* dma0 == 6 */ + devpriv->dma_bits |= DMA_CH6; + break; + case 0x7: /* dma0 == 7 */ + devpriv->dma_bits |= DMA_CH7; + break; + case 0x65: /* dma0 == 5, dma1 == 6 */ + devpriv->dma_bits |= DMA_CH5_CH6; + break; + case 0x76: /* dma0 == 6, dma1 == 7 */ + devpriv->dma_bits |= DMA_CH6_CH7; + break; + case 0x57: /* dma0 == 7, dma1 == 5 */ + devpriv->dma_bits |= DMA_CH7_CH5; + break; + default: + dev_err(dev->hw_dev, " only supports dma channels 5 through 7\n" + " Dual dma only allows the following combinations:\n" + " dma 5,6 / 6,7 / or 7,5\n"); + return -EINVAL; + break; + } + if (request_dma(dma0, dev->driver->driver_name)) { + dev_err(dev->hw_dev, "failed to allocate dma channel %i\n", + dma0); + return -EINVAL; + } + devpriv->dma0 = dma0; + devpriv->dma_current = dma0; + if (dma1) { + if (request_dma(dma1, dev->driver->driver_name)) { + dev_err(dev->hw_dev, "failed to allocate dma channel %i\n", + dma1); + return -EINVAL; + } + devpriv->dma1 = dma1; + } + devpriv->ai_buf0 = kmalloc(DMA_BUF_SIZE, GFP_KERNEL | GFP_DMA); + if (devpriv->ai_buf0 == NULL) + return -ENOMEM; + devpriv->dma_current_buf = devpriv->ai_buf0; + if (dma1) { + devpriv->ai_buf1 = + kmalloc(DMA_BUF_SIZE, GFP_KERNEL | GFP_DMA); + if (devpriv->ai_buf1 == NULL) + return -ENOMEM; + } + flags = claim_dma_lock(); + disable_dma(devpriv->dma0); + set_dma_mode(devpriv->dma0, DMA_MODE_READ); + if (dma1) { + disable_dma(devpriv->dma1); + set_dma_mode(devpriv->dma1, DMA_MODE_READ); + } + release_dma_lock(flags); + } return 0; } -/* converts requested conversion timing to timing compatible with - * hardware, used only when card is in 'burst mode' - */ -static unsigned int burst_convert_arg(unsigned int convert_arg, int round_mode) +static int das1800_probe(struct comedi_device *dev) { - unsigned int micro_sec; + int id; + int board; - /* in burst mode, the maximum conversion time is 64 microseconds */ - if (convert_arg > 64000) - convert_arg = 64000; + id = (inb(dev->iobase + DAS1800_DIGITAL) >> 4) & 0xf; /* get id bits */ + board = ((struct das1800_board *)dev->board_ptr) - das1800_boards; - /* the conversion time must be an integral number of microseconds */ - switch (round_mode) { - case TRIG_ROUND_NEAREST: - default: - micro_sec = (convert_arg + 500) / 1000; + switch (id) { + case 0x3: + if (board == das1801st_da || board == das1802st_da || + board == das1701st_da || board == das1702st_da) { + dev_dbg(dev->hw_dev, "Board model: %s\n", + das1800_boards[board].name); + return board; + } + printk + (" Board model (probed, not recommended): das-1800st-da series\n"); + return das1801st; break; - case TRIG_ROUND_DOWN: - micro_sec = convert_arg / 1000; + case 0x4: + if (board == das1802hr_da || board == das1702hr_da) { + dev_dbg(dev->hw_dev, "Board model: %s\n", + das1800_boards[board].name); + return board; + } + printk + (" Board model (probed, not recommended): das-1802hr-da\n"); + return das1802hr; break; - case TRIG_ROUND_UP: - micro_sec = (convert_arg - 1) / 1000 + 1; + case 0x5: + if (board == das1801ao || board == das1802ao || + board == das1701ao || board == das1702ao) { + dev_dbg(dev->hw_dev, "Board model: %s\n", + das1800_boards[board].name); + return board; + } + printk + (" Board model (probed, not recommended): das-1800ao series\n"); + return das1801ao; + break; + case 0x6: + if (board == das1802hr || board == das1702hr) { + dev_dbg(dev->hw_dev, "Board model: %s\n", + das1800_boards[board].name); + return board; + } + printk + (" Board model (probed, not recommended): das-1802hr\n"); + return das1802hr; + break; + case 0x7: + if (board == das1801st || board == das1802st || + board == das1701st || board == das1702st) { + dev_dbg(dev->hw_dev, "Board model: %s\n", + das1800_boards[board].name); + return board; + } + printk + (" Board model (probed, not recommended): das-1800st series\n"); + return das1801st; + break; + case 0x8: + if (board == das1801hc || board == das1802hc) { + dev_dbg(dev->hw_dev, "Board model: %s\n", + das1800_boards[board].name); + return board; + } + printk + (" Board model (probed, not recommended): das-1800hc series\n"); + return das1801hc; + break; + default: + printk + (" Board model: probe returned 0x%x (unknown, please report)\n", + id); + return board; break; } - - /* return number of nanoseconds */ - return micro_sec * 1000; + return -1; } -/* utility function that suggests a dma transfer size based on the conversion period 'ns' */ -static unsigned int suggest_transfer_size(struct comedi_cmd *cmd) +static int das1800_attach(struct comedi_device *dev, + struct comedi_devconfig *it) { - unsigned int size = DMA_BUF_SIZE; - static const int sample_size = 2; /* size in bytes of one sample from board */ - unsigned int fill_time = 300000000; /* target time in nanoseconds for filling dma buffer */ - unsigned int max_size; /* maximum size we will allow for a transfer */ + struct comedi_subdevice *s; + unsigned long iobase = it->options[0]; + unsigned int irq = it->options[1]; + unsigned int dma0 = it->options[2]; + unsigned int dma1 = it->options[3]; + unsigned long iobase2; + int board; + int retval; - /* make dma buffer fill in 0.3 seconds for timed modes */ - switch (cmd->scan_begin_src) { - case TRIG_FOLLOW: /* not in burst mode */ - if (cmd->convert_src == TRIG_TIMER) - size = (fill_time / cmd->convert_arg) * sample_size; + /* allocate and initialize dev->private */ + if (alloc_private(dev, sizeof(struct das1800_private)) < 0) + return -ENOMEM; + + printk(KERN_DEBUG "comedi%d: %s: io 0x%lx", dev->minor, + dev->driver->driver_name, iobase); + if (irq) { + printk(KERN_CONT ", irq %u", irq); + if (dma0) { + printk(KERN_CONT ", dma %u", dma0); + if (dma1) + printk(KERN_CONT " and %u", dma1); + } + } + printk(KERN_CONT "\n"); + + if (iobase == 0) { + dev_err(dev->hw_dev, "io base address required\n"); + return -EINVAL; + } + + /* check if io addresses are available */ + if (!request_region(iobase, DAS1800_SIZE, dev->driver->driver_name)) { + printk + (" I/O port conflict: failed to allocate ports 0x%lx to 0x%lx\n", + iobase, iobase + DAS1800_SIZE - 1); + return -EIO; + } + dev->iobase = iobase; + + board = das1800_probe(dev); + if (board < 0) { + dev_err(dev->hw_dev, "unable to determine board type\n"); + return -ENODEV; + } + + dev->board_ptr = das1800_boards + board; + dev->board_name = thisboard->name; + + /* if it is an 'ao' board with fancy analog out then we need extra io ports */ + if (thisboard->ao_ability == 2) { + iobase2 = iobase + IOBASE2; + if (!request_region(iobase2, DAS1800_SIZE, + dev->driver->driver_name)) { + printk + (" I/O port conflict: failed to allocate ports 0x%lx to 0x%lx\n", + iobase2, iobase2 + DAS1800_SIZE - 1); + return -EIO; + } + devpriv->iobase2 = iobase2; + } + + /* grab our IRQ */ + if (irq) { + if (request_irq(irq, das1800_interrupt, 0, + dev->driver->driver_name, dev)) { + dev_dbg(dev->hw_dev, "unable to allocate irq %u\n", + irq); + return -EINVAL; + } + } + dev->irq = irq; + + /* set bits that tell card which irq to use */ + switch (irq) { + case 0: break; - case TRIG_TIMER: - size = (fill_time / (cmd->scan_begin_arg * cmd->chanlist_len)) * - sample_size; + case 3: + devpriv->irq_dma_bits |= 0x8; + break; + case 5: + devpriv->irq_dma_bits |= 0x10; + break; + case 7: + devpriv->irq_dma_bits |= 0x18; + break; + case 10: + devpriv->irq_dma_bits |= 0x28; + break; + case 11: + devpriv->irq_dma_bits |= 0x30; + break; + case 15: + devpriv->irq_dma_bits |= 0x38; break; default: - size = DMA_BUF_SIZE; + dev_err(dev->hw_dev, "irq out of range\n"); + return -EINVAL; break; } - /* set a minimum and maximum size allowed */ - max_size = DMA_BUF_SIZE; - /* if we are taking limited number of conversions, limit transfer size to that */ - if (cmd->stop_src == TRIG_COUNT && - cmd->stop_arg * cmd->chanlist_len * sample_size < max_size) - max_size = cmd->stop_arg * cmd->chanlist_len * sample_size; + retval = das1800_init_dma(dev, dma0, dma1); + if (retval < 0) + return retval; - if (size > max_size) - size = max_size; - if (size < sample_size) - size = sample_size; + if (devpriv->ai_buf0 == NULL) { + devpriv->ai_buf0 = + kmalloc(FIFO_SIZE * sizeof(uint16_t), GFP_KERNEL); + if (devpriv->ai_buf0 == NULL) + return -ENOMEM; + } - return size; -} + if (alloc_subdevices(dev, 4) < 0) + return -ENOMEM; + + /* analog input subdevice */ + s = dev->subdevices + 0; + dev->read_subdev = s; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_DIFF | SDF_GROUND | SDF_CMD_READ; + if (thisboard->common) + s->subdev_flags |= SDF_COMMON; + s->n_chan = thisboard->qram_len; + s->len_chanlist = thisboard->qram_len; + s->maxdata = (1 << thisboard->resolution) - 1; + s->range_table = thisboard->range_ai; + s->do_cmd = das1800_ai_do_cmd; + s->do_cmdtest = das1800_ai_do_cmdtest; + s->insn_read = das1800_ai_rinsn; + s->poll = das1800_ai_poll; + s->cancel = das1800_cancel; + + /* analog out */ + s = dev->subdevices + 1; + if (thisboard->ao_ability == 1) { + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = thisboard->ao_n_chan; + s->maxdata = (1 << thisboard->resolution) - 1; + s->range_table = &range_ao_1; + s->insn_write = das1800_ao_winsn; + } else { + s->type = COMEDI_SUBD_UNUSED; + } + + /* di */ + s = dev->subdevices + 2; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = das1800_di_rbits; + + /* do */ + s = dev->subdevices + 3; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE; + s->n_chan = thisboard->do_n_chan; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = das1800_do_wbits; + + das1800_cancel(dev, dev->read_subdev); + + /* initialize digital out channels */ + outb(devpriv->do_bits, dev->iobase + DAS1800_DIGITAL); + + /* initialize analog out channels */ + if (thisboard->ao_ability == 1) { + /* select 'update' dac channel for baseAddress + 0x0 */ + outb(DAC(thisboard->ao_n_chan - 1), + dev->iobase + DAS1800_SELECT); + outw(devpriv->ao_update_bits, dev->iobase + DAS1800_DAC); + } + + return 0; +}; + +static void das1800_detach(struct comedi_device *dev) +{ + if (dev->iobase) + release_region(dev->iobase, DAS1800_SIZE); + if (dev->irq) + free_irq(dev->irq, dev); + if (dev->private) { + if (devpriv->iobase2) + release_region(devpriv->iobase2, DAS1800_SIZE); + if (devpriv->dma0) + free_dma(devpriv->dma0); + if (devpriv->dma1) + free_dma(devpriv->dma1); + kfree(devpriv->ai_buf0); + kfree(devpriv->ai_buf1); + } +}; static struct comedi_driver das1800_driver = { .driver_name = "das1800", -- cgit v0.10.2 From 4b5c0f106e7eb588e904184d9bc16427111c486f Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 24 May 2012 17:27:11 +0100 Subject: staging: comedi: das08: Use IS_ENABLED() Change conditional compilation on kernel config options to use the IS_ENABLED() macro. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index f53e597..d921bee 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -60,17 +60,7 @@ #define DRV_NAME "das08" -#ifdef CONFIG_COMEDI_DAS08_ISA_MODULE -#define CONFIG_COMEDI_DAS08_ISA -#endif -#ifdef CONFIG_COMEDI_DAS08_PCI_MODULE -#define CONFIG_COMEDI_DAS08_PCI -#endif -#ifdef CONFIG_COMEDI_DAS08_CS_MODULE -#define CONFIG_COMEDI_DAS08_CS -#endif - -#if defined(CONFIG_COMEDI_DAS08_ISA) || defined(CONFIG_COMEDI_DAS08_PCI) +#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) || IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) #define DO_COMEDI_DRIVER_REGISTER #endif @@ -173,7 +163,7 @@ static int das08_di_rbits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); static int das08_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -#ifdef CONFIG_COMEDI_DAS08_ISA +#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) static int das08jr_di_rbits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); @@ -270,7 +260,7 @@ static const int *const das08_gainlists[] = { #ifdef DO_COMEDI_DRIVER_REGISTER static const struct das08_board_struct das08_boards[] = { -#ifdef CONFIG_COMEDI_DAS08_ISA +#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) { .name = "isa-das08", /* cio-das08.pdf */ .bustype = isa, @@ -460,8 +450,8 @@ static const struct das08_board_struct das08_boards[] = { .name = "das08-pga-g2", /* a KM board */ }, #endif -#endif /* CONFIG_COMEDI_DAS08_ISA */ -#ifdef CONFIG_COMEDI_DAS08_PCI +#endif /* IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) */ +#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) { .name = "das08", /* pci-das08 */ .id = PCI_DEVICE_ID_PCIDAS08, @@ -479,11 +469,11 @@ static const struct das08_board_struct das08_boards[] = { .i8254_offset = 4, .iosize = 8, }, -#endif /* CONFIG_COMEDI_DAS08_PCI */ +#endif /* IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) */ }; #endif /* DO_COMEDI_DRIVER_REGISTER */ -#ifdef CONFIG_COMEDI_DAS08_CS +#if IS_ENABLED(CONFIG_COMEDI_DAS08_CS) struct das08_board_struct das08_cs_boards[NUM_DAS08_CS_BOARDS] = { { .name = "pcm-das08", @@ -523,7 +513,7 @@ struct das08_board_struct das08_cs_boards[NUM_DAS08_CS_BOARDS] = { }; #endif -#ifdef CONFIG_COMEDI_DAS08_PCI +#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) static DEFINE_PCI_DEVICE_TABLE(das08_pci_table) = { { PCI_DEVICE(PCI_VENDOR_ID_COMPUTERBOARDS, PCI_DEVICE_ID_PCIDAS08) }, {0} @@ -638,7 +628,7 @@ static int das08_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, return 2; } -#ifdef CONFIG_COMEDI_DAS08_ISA +#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) static int das08jr_di_rbits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -650,7 +640,7 @@ static int das08jr_di_rbits(struct comedi_device *dev, } #endif -#ifdef CONFIG_COMEDI_DAS08_ISA +#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) static int das08jr_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -667,7 +657,7 @@ static int das08jr_do_wbits(struct comedi_device *dev, } #endif -#ifdef CONFIG_COMEDI_DAS08_ISA +#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) static int das08jr_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -704,7 +694,7 @@ static int das08jr_ao_winsn(struct comedi_device *dev, * a different method to force an update. * */ -#ifdef CONFIG_COMEDI_DAS08_ISA +#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) static int das08ao_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -1006,7 +996,7 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) { int ret; unsigned long iobase; -#ifdef CONFIG_COMEDI_DAS08_PCI +#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) unsigned long pci_iobase = 0; struct pci_dev *pdev = NULL; #endif @@ -1016,7 +1006,7 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) return ret; printk(KERN_INFO "comedi%d: das08: ", dev->minor); -#ifdef CONFIG_COMEDI_DAS08_PCI +#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) /* deal with a pci board */ if (thisboard->bustype == pci) { if (it->options[0] || it->options[1]) { @@ -1068,7 +1058,7 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) outw(INTR1_ENABLE | PCI_INTR_ENABLE, pci_iobase + INTCSR); #endif } else -#endif /* CONFIG_COMEDI_DAS08_PCI */ +#endif /* IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) */ { iobase = it->options[0]; } @@ -1086,7 +1076,7 @@ void das08_common_detach(struct comedi_device *dev) if (dev->iobase) release_region(dev->iobase, thisboard->iosize); } -#ifdef CONFIG_COMEDI_DAS08_PCI +#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) if (devpriv) { if (devpriv->pdev) { if (devpriv->pci_iobase) @@ -1099,7 +1089,7 @@ void das08_common_detach(struct comedi_device *dev) } EXPORT_SYMBOL_GPL(das08_common_detach); -#ifdef CONFIG_COMEDI_DAS08_PCI +#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) static int __devinit driver_das08_pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) { @@ -1127,7 +1117,7 @@ static int __init driver_das08_init_module(void) if (retval < 0) return retval; #endif -#ifdef CONFIG_COMEDI_DAS08_PCI +#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) driver_das08_pci_driver.name = (char *)driver_das08.driver_name; retval = pci_register_driver(&driver_das08_pci_driver); #endif @@ -1136,7 +1126,7 @@ static int __init driver_das08_init_module(void) static void __exit driver_das08_cleanup_module(void) { -#ifdef CONFIG_COMEDI_DAS08_PCI +#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) pci_unregister_driver(&driver_das08_pci_driver); #endif #ifdef DO_COMEDI_DRIVER_REGISTER @@ -1147,7 +1137,7 @@ static void __exit driver_das08_cleanup_module(void) module_init(driver_das08_init_module); module_exit(driver_das08_cleanup_module); -#ifdef CONFIG_COMEDI_DAS08_CS +#if IS_ENABLED(CONFIG_COMEDI_DAS08_CS) EXPORT_SYMBOL_GPL(das08_cs_boards); #endif -- cgit v0.10.2 From d60d9f34d37775fa64695a22b405e58ac3cda39c Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 24 May 2012 17:27:12 +0100 Subject: staging: comedi: das08: Move I/O resource (de)allocation. Don't deal with allocation and deallocation of I/O resources and PCI enabling/disabling in the exported functions das08_common_attach() and das08_common_detach(). Do it in das08_attach() and new function das08_detach() (which is now the comedi detach() hook for this driver). This keeps things more symmetrical. Callers of das08_common_attach() and das08_common_detach() are now responsible for allocation of their own I/O resources and enabling of their own devices. The only external caller of das08_common_attach() and das08_common_detach() is the das08_cs module, which looks after its own I/O resources. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index d921bee..c69df87 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -861,12 +861,13 @@ static int das08_counter_config(struct comedi_device *dev, #ifdef DO_COMEDI_DRIVER_REGISTER static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it); +static void das08_detach(struct comedi_device *dev); static struct comedi_driver driver_das08 = { .driver_name = DRV_NAME, .module = THIS_MODULE, .attach = das08_attach, - .detach = das08_common_detach, + .detach = das08_detach, .board_name = &das08_boards[0].name, .num_names = sizeof(das08_boards) / sizeof(struct das08_board_struct), .offset = sizeof(struct das08_board_struct), @@ -878,14 +879,6 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) struct comedi_subdevice *s; int ret; - /* allocate ioports for non-pcmcia, non-pci boards */ - if ((thisboard->bustype != pcmcia) && (thisboard->bustype != pci)) { - printk(KERN_INFO " iobase 0x%lx\n", iobase); - if (!request_region(iobase, thisboard->iosize, DRV_NAME)) { - printk(KERN_ERR " I/O port conflict\n"); - return -EIO; - } - } dev->iobase = iobase; dev->board_name = thisboard->name; @@ -996,19 +989,15 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) { int ret; unsigned long iobase; -#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) - unsigned long pci_iobase = 0; - struct pci_dev *pdev = NULL; -#endif ret = alloc_private(dev, sizeof(struct das08_private_struct)); if (ret < 0) return ret; printk(KERN_INFO "comedi%d: das08: ", dev->minor); -#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) - /* deal with a pci board */ - if (thisboard->bustype == pci) { + if (IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) && thisboard->bustype == pci) { + unsigned long pci_iobase = 0; + struct pci_dev *pdev = NULL; if (it->options[0] || it->options[1]) { printk("bus %i slot %i ", it->options[0], it->options[1]); @@ -1057,13 +1046,16 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Enable local interrupt 1 and pci interrupt */ outw(INTR1_ENABLE | PCI_INTR_ENABLE, pci_iobase + INTCSR); #endif - } else -#endif /* IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) */ - { + } else if (IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) && + (thisboard->bustype == isa || thisboard->bustype == pc104)) { iobase = it->options[0]; - } - printk(KERN_INFO "\n"); - + printk(KERN_INFO " iobase 0x%lx\n", iobase); + if (!request_region(iobase, thisboard->iosize, DRV_NAME)) { + printk(KERN_ERR " I/O port conflict\n"); + return -EIO; + } + } else + return -EIO; return das08_common_attach(dev, iobase); } #endif /* DO_COMEDI_DRIVER_REGISTER */ @@ -1072,22 +1064,27 @@ void das08_common_detach(struct comedi_device *dev) { if (dev->subdevices) subdev_8255_cleanup(dev, dev->subdevices + 4); - if ((thisboard->bustype != pcmcia) && (thisboard->bustype != pci)) { +} +EXPORT_SYMBOL_GPL(das08_common_detach); + +#ifdef DO_COMEDI_DRIVER_REGISTER +static void das08_detach(struct comedi_device *dev) +{ + das08_common_detach(dev); + if (IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) && + (thisboard->bustype == isa || thisboard->bustype == pc104)) { if (dev->iobase) release_region(dev->iobase, thisboard->iosize); - } -#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) - if (devpriv) { - if (devpriv->pdev) { + } else if (IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) && + thisboard->bustype == pci) { + if (devpriv && devpriv->pdev) { if (devpriv->pci_iobase) comedi_pci_disable(devpriv->pdev); - pci_dev_put(devpriv->pdev); } } -#endif } -EXPORT_SYMBOL_GPL(das08_common_detach); +#endif /* DO_COMEDI_DRIVER_REGISTER */ #if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) static int __devinit driver_das08_pci_probe(struct pci_dev *dev, -- cgit v0.10.2 From 1e576a5707c95a4fb5927d97ed21582a55f75a82 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 24 May 2012 17:27:13 +0100 Subject: staging: comedi: das08: Use module_comedi_{pci_, }driver If PCI boards are supported, use the module_comedi_pci_driver() macro to register the module as a comedi driver and a PCI driver. Otherwise, if ISA (or PC/104) boards are supported, use the module_comedi_driver() macro to register the module as a comedi driver. Otherwise, this is only a helper module for an external comedi driver (das08_cs). Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index c69df87..3e0c021 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -863,7 +863,7 @@ static int das08_counter_config(struct comedi_device *dev, static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it); static void das08_detach(struct comedi_device *dev); -static struct comedi_driver driver_das08 = { +static struct comedi_driver das08_driver = { .driver_name = DRV_NAME, .module = THIS_MODULE, .attach = das08_attach, @@ -1087,52 +1087,44 @@ static void das08_detach(struct comedi_device *dev) #endif /* DO_COMEDI_DRIVER_REGISTER */ #if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) -static int __devinit driver_das08_pci_probe(struct pci_dev *dev, +static int __devinit das08_pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) { - return comedi_pci_auto_config(dev, &driver_das08); + return comedi_pci_auto_config(dev, &das08_driver); } -static void __devexit driver_das08_pci_remove(struct pci_dev *dev) +static void __devexit das08_pci_remove(struct pci_dev *dev) { comedi_pci_auto_unconfig(dev); } -static struct pci_driver driver_das08_pci_driver = { +static struct pci_driver das08_pci_driver = { .id_table = das08_pci_table, - .probe = &driver_das08_pci_probe, - .remove = __devexit_p(&driver_das08_pci_remove) + .name = DRV_NAME, + .probe = &das08_pci_probe, + .remove = __devexit_p(&das08_pci_remove) }; #endif /* CONFIG_COMEDI_DAS08_PCI */ -static int __init driver_das08_init_module(void) -{ - int retval = 0; - #ifdef DO_COMEDI_DRIVER_REGISTER - retval = comedi_driver_register(&driver_das08); - if (retval < 0) - return retval; -#endif #if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) - driver_das08_pci_driver.name = (char *)driver_das08.driver_name; - retval = pci_register_driver(&driver_das08_pci_driver); +module_comedi_pci_driver(das08_driver, das08_pci_driver); +#else +module_comedi_driver(das08_driver); #endif - return retval; +#else /* DO_COMEDI_DRIVER_REGISTER */ +static int __init das08_init(void) +{ + return 0; } -static void __exit driver_das08_cleanup_module(void) +static void __exit das08_exit(void) { -#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) - pci_unregister_driver(&driver_das08_pci_driver); -#endif -#ifdef DO_COMEDI_DRIVER_REGISTER - comedi_driver_unregister(&driver_das08); -#endif } -module_init(driver_das08_init_module); -module_exit(driver_das08_cleanup_module); +module_init(das08_init); +module_exit(das08_exit); +#endif /* DO_COMEDI_DRIVER_REGISTER */ #if IS_ENABLED(CONFIG_COMEDI_DAS08_CS) EXPORT_SYMBOL_GPL(das08_cs_boards); -- cgit v0.10.2 From d8fdaea5c9cd422f87cf0257c191e030a54d71e2 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 24 May 2012 17:27:14 +0100 Subject: staging: comedi: das08: Remove forward function declarations. Moved some functions to avoid forward declarations. Moved a few other bits at the same time to keep EXPORT_SYMBOL{,_GPL}() close to the symbol being exported, and PCI table close to the code that refers to it. Changed whitespace in das08_board[] and das08_cs_board[] initializers. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index 3e0c021..901411e 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -157,29 +157,6 @@ /* gainlist same as _pgx_ below */ -static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int das08_di_rbits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int das08_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) -static int das08jr_di_rbits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int das08jr_do_wbits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int das08jr_ao_winsn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int das08ao_ao_winsn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -#endif -static void i8254_set_mode_low(unsigned int base, int channel, - unsigned int mode); - static const struct comedi_lrange range_das08_pgl = { 9, { BIP_RANGE(10), BIP_RANGE(5), @@ -258,270 +235,6 @@ static const int *const das08_gainlists[] = { das08_pgm_gainlist, }; -#ifdef DO_COMEDI_DRIVER_REGISTER -static const struct das08_board_struct das08_boards[] = { -#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) - { - .name = "isa-das08", /* cio-das08.pdf */ - .bustype = isa, - .ai = das08_ai_rinsn, - .ai_nbits = 12, - .ai_pg = das08_pg_none, - .ai_encoding = das08_encode12, - .ao = NULL, - .ao_nbits = 12, - .di = das08_di_rbits, - .do_ = das08_do_wbits, - .do_nchan = 4, - .i8255_offset = 8, - .i8254_offset = 4, - .iosize = 16, /* unchecked */ - }, - { - .name = "das08-pgm", /* cio-das08pgx.pdf */ - .bustype = isa, - .ai = das08_ai_rinsn, - .ai_nbits = 12, - .ai_pg = das08_pgm, - .ai_encoding = das08_encode12, - .ao = NULL, - .di = das08_di_rbits, - .do_ = das08_do_wbits, - .do_nchan = 4, - .i8255_offset = 0, - .i8254_offset = 0x04, - .iosize = 16, /* unchecked */ - }, - { - .name = "das08-pgh", /* cio-das08pgx.pdf */ - .bustype = isa, - .ai = das08_ai_rinsn, - .ai_nbits = 12, - .ai_pg = das08_pgh, - .ai_encoding = das08_encode12, - .ao = NULL, - .di = das08_di_rbits, - .do_ = das08_do_wbits, - .do_nchan = 4, - .i8255_offset = 0, - .i8254_offset = 0x04, - .iosize = 16, /* unchecked */ - }, - { - .name = "das08-pgl", /* cio-das08pgx.pdf */ - .bustype = isa, - .ai = das08_ai_rinsn, - .ai_nbits = 12, - .ai_pg = das08_pgl, - .ai_encoding = das08_encode12, - .ao = NULL, - .di = das08_di_rbits, - .do_ = das08_do_wbits, - .do_nchan = 4, - .i8255_offset = 0, - .i8254_offset = 0x04, - .iosize = 16, /* unchecked */ - }, - { - .name = "das08-aoh", /* cio-das08_aox.pdf */ - .bustype = isa, - .ai = das08_ai_rinsn, - .ai_nbits = 12, - .ai_pg = das08_pgh, - .ai_encoding = das08_encode12, - .ao = das08ao_ao_winsn, /* 8 */ - .ao_nbits = 12, - .di = das08_di_rbits, - .do_ = das08_do_wbits, - .do_nchan = 4, - .i8255_offset = 0x0c, - .i8254_offset = 0x04, - .iosize = 16, /* unchecked */ - }, - { - .name = "das08-aol", /* cio-das08_aox.pdf */ - .bustype = isa, - .ai = das08_ai_rinsn, - .ai_nbits = 12, - .ai_pg = das08_pgl, - .ai_encoding = das08_encode12, - .ao = das08ao_ao_winsn, /* 8 */ - .ao_nbits = 12, - .di = das08_di_rbits, - .do_ = das08_do_wbits, - .do_nchan = 4, - .i8255_offset = 0x0c, - .i8254_offset = 0x04, - .iosize = 16, /* unchecked */ - }, - { - .name = "das08-aom", /* cio-das08_aox.pdf */ - .bustype = isa, - .ai = das08_ai_rinsn, - .ai_nbits = 12, - .ai_pg = das08_pgm, - .ai_encoding = das08_encode12, - .ao = das08ao_ao_winsn, /* 8 */ - .ao_nbits = 12, - .di = das08_di_rbits, - .do_ = das08_do_wbits, - .do_nchan = 4, - .i8255_offset = 0x0c, - .i8254_offset = 0x04, - .iosize = 16, /* unchecked */ - }, - { - .name = "das08/jr-ao", /* cio-das08-jr-ao.pdf */ - .bustype = isa, - .ai = das08_ai_rinsn, - .ai_nbits = 12, - .ai_pg = das08_pg_none, - .ai_encoding = das08_encode12, - .ao = das08jr_ao_winsn, - .ao_nbits = 12, - .di = das08jr_di_rbits, - .do_ = das08jr_do_wbits, - .do_nchan = 8, - .i8255_offset = 0, - .i8254_offset = 0, - .iosize = 16, /* unchecked */ - }, - { - .name = "das08jr-16-ao", /* cio-das08jr-16-ao.pdf */ - .bustype = isa, - .ai = das08_ai_rinsn, - .ai_nbits = 16, - .ai_pg = das08_pg_none, - .ai_encoding = das08_encode12, - .ao = das08jr_ao_winsn, - .ao_nbits = 16, - .di = das08jr_di_rbits, - .do_ = das08jr_do_wbits, - .do_nchan = 8, - .i8255_offset = 0, - .i8254_offset = 0x04, - .iosize = 16, /* unchecked */ - }, - { - .name = "pc104-das08", - .bustype = pc104, - .ai = das08_ai_rinsn, - .ai_nbits = 12, - .ai_pg = das08_pg_none, - .ai_encoding = das08_encode12, - .ao = NULL, - .ao_nbits = 0, - .di = das08_di_rbits, - .do_ = das08_do_wbits, - .do_nchan = 4, - .i8255_offset = 0, - .i8254_offset = 4, - .iosize = 16, /* unchecked */ - }, -#if 0 - { - .name = "das08/f", - }, - { - .name = "das08jr", - }, -#endif - { - .name = "das08jr/16", - .bustype = isa, - .ai = das08_ai_rinsn, - .ai_nbits = 16, - .ai_pg = das08_pg_none, - .ai_encoding = das08_encode16, - .ao = NULL, - .ao_nbits = 0, - .di = das08jr_di_rbits, - .do_ = das08jr_do_wbits, - .do_nchan = 8, - .i8255_offset = 0, - .i8254_offset = 0, - .iosize = 16, /* unchecked */ - }, -#if 0 - { - .name = "das48-pga", /* cio-das48-pga.pdf */ - }, - { - .name = "das08-pga-g2", /* a KM board */ - }, -#endif -#endif /* IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) */ -#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) - { - .name = "das08", /* pci-das08 */ - .id = PCI_DEVICE_ID_PCIDAS08, - .bustype = pci, - .ai = das08_ai_rinsn, - .ai_nbits = 12, - .ai_pg = das08_bipolar5, - .ai_encoding = das08_encode12, - .ao = NULL, - .ao_nbits = 0, - .di = das08_di_rbits, - .do_ = das08_do_wbits, - .do_nchan = 4, - .i8255_offset = 0, - .i8254_offset = 4, - .iosize = 8, - }, -#endif /* IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) */ -}; -#endif /* DO_COMEDI_DRIVER_REGISTER */ - -#if IS_ENABLED(CONFIG_COMEDI_DAS08_CS) -struct das08_board_struct das08_cs_boards[NUM_DAS08_CS_BOARDS] = { - { - .name = "pcm-das08", - .id = 0x0, /* XXX */ - .bustype = pcmcia, - .ai = das08_ai_rinsn, - .ai_nbits = 12, - .ai_pg = das08_bipolar5, - .ai_encoding = das08_pcm_encode12, - .ao = NULL, - .ao_nbits = 0, - .di = das08_di_rbits, - .do_ = das08_do_wbits, - .do_nchan = 3, - .i8255_offset = 0, - .i8254_offset = 0, - .iosize = 16, - }, - /* duplicate so driver name can be used also */ - { - .name = "das08_cs", - .id = 0x0, /* XXX */ - .bustype = pcmcia, - .ai = das08_ai_rinsn, - .ai_nbits = 12, - .ai_pg = das08_bipolar5, - .ai_encoding = das08_pcm_encode12, - .ao = NULL, - .ao_nbits = 0, - .di = das08_di_rbits, - .do_ = das08_do_wbits, - .do_nchan = 3, - .i8255_offset = 0, - .i8254_offset = 0, - .iosize = 16, - }, -}; -#endif - -#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) -static DEFINE_PCI_DEVICE_TABLE(das08_pci_table) = { - { PCI_DEVICE(PCI_VENDOR_ID_COMPUTERBOARDS, PCI_DEVICE_ID_PCIDAS08) }, - {0} -}; - -MODULE_DEVICE_TABLE(pci, das08_pci_table); -#endif - #define devpriv ((struct das08_private_struct *)dev->private) #define thisboard ((const struct das08_board_struct *)dev->board_ptr) @@ -776,13 +489,6 @@ static void i8254_write_channel(struct i8254_struct *st, int channel, i8254_write_channel_low(st->iobase, chan, value); } -static void i8254_initialize(struct i8254_struct *st) -{ - int i; - for (i = 0; i < 3; ++i) - i8254_set_mode_low(st->iobase, i, st->mode[i]); -} - static void i8254_set_mode_low(unsigned int base, int channel, unsigned int mode) { @@ -811,6 +517,13 @@ static unsigned int i8254_read_status(struct i8254_struct *st, int channel) return i8254_read_status_low(st->iobase, chan); } +static void i8254_initialize(struct i8254_struct *st) +{ + int i; + for (i = 0; i < 3; ++i) + i8254_set_mode_low(st->iobase, i, st->mode[i]); +} + static int das08_counter_read(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -860,18 +573,259 @@ static int das08_counter_config(struct comedi_device *dev, } #ifdef DO_COMEDI_DRIVER_REGISTER -static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it); -static void das08_detach(struct comedi_device *dev); +static const struct das08_board_struct das08_boards[] = { +#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) + { + .name = "isa-das08", /* cio-das08.pdf */ + .bustype = isa, + .ai = das08_ai_rinsn, + .ai_nbits = 12, + .ai_pg = das08_pg_none, + .ai_encoding = das08_encode12, + .ao = NULL, + .ao_nbits = 12, + .di = das08_di_rbits, + .do_ = das08_do_wbits, + .do_nchan = 4, + .i8255_offset = 8, + .i8254_offset = 4, + .iosize = 16, /* unchecked */ + }, + { + .name = "das08-pgm", /* cio-das08pgx.pdf */ + .bustype = isa, + .ai = das08_ai_rinsn, + .ai_nbits = 12, + .ai_pg = das08_pgm, + .ai_encoding = das08_encode12, + .ao = NULL, + .di = das08_di_rbits, + .do_ = das08_do_wbits, + .do_nchan = 4, + .i8255_offset = 0, + .i8254_offset = 0x04, + .iosize = 16, /* unchecked */ + }, + { + .name = "das08-pgh", /* cio-das08pgx.pdf */ + .bustype = isa, + .ai = das08_ai_rinsn, + .ai_nbits = 12, + .ai_pg = das08_pgh, + .ai_encoding = das08_encode12, + .ao = NULL, + .di = das08_di_rbits, + .do_ = das08_do_wbits, + .do_nchan = 4, + .i8255_offset = 0, + .i8254_offset = 0x04, + .iosize = 16, /* unchecked */ + }, + { + .name = "das08-pgl", /* cio-das08pgx.pdf */ + .bustype = isa, + .ai = das08_ai_rinsn, + .ai_nbits = 12, + .ai_pg = das08_pgl, + .ai_encoding = das08_encode12, + .ao = NULL, + .di = das08_di_rbits, + .do_ = das08_do_wbits, + .do_nchan = 4, + .i8255_offset = 0, + .i8254_offset = 0x04, + .iosize = 16, /* unchecked */ + }, + { + .name = "das08-aoh", /* cio-das08_aox.pdf */ + .bustype = isa, + .ai = das08_ai_rinsn, + .ai_nbits = 12, + .ai_pg = das08_pgh, + .ai_encoding = das08_encode12, + .ao = das08ao_ao_winsn, /* 8 */ + .ao_nbits = 12, + .di = das08_di_rbits, + .do_ = das08_do_wbits, + .do_nchan = 4, + .i8255_offset = 0x0c, + .i8254_offset = 0x04, + .iosize = 16, /* unchecked */ + }, + { + .name = "das08-aol", /* cio-das08_aox.pdf */ + .bustype = isa, + .ai = das08_ai_rinsn, + .ai_nbits = 12, + .ai_pg = das08_pgl, + .ai_encoding = das08_encode12, + .ao = das08ao_ao_winsn, /* 8 */ + .ao_nbits = 12, + .di = das08_di_rbits, + .do_ = das08_do_wbits, + .do_nchan = 4, + .i8255_offset = 0x0c, + .i8254_offset = 0x04, + .iosize = 16, /* unchecked */ + }, + { + .name = "das08-aom", /* cio-das08_aox.pdf */ + .bustype = isa, + .ai = das08_ai_rinsn, + .ai_nbits = 12, + .ai_pg = das08_pgm, + .ai_encoding = das08_encode12, + .ao = das08ao_ao_winsn, /* 8 */ + .ao_nbits = 12, + .di = das08_di_rbits, + .do_ = das08_do_wbits, + .do_nchan = 4, + .i8255_offset = 0x0c, + .i8254_offset = 0x04, + .iosize = 16, /* unchecked */ + }, + { + .name = "das08/jr-ao", /* cio-das08-jr-ao.pdf */ + .bustype = isa, + .ai = das08_ai_rinsn, + .ai_nbits = 12, + .ai_pg = das08_pg_none, + .ai_encoding = das08_encode12, + .ao = das08jr_ao_winsn, + .ao_nbits = 12, + .di = das08jr_di_rbits, + .do_ = das08jr_do_wbits, + .do_nchan = 8, + .i8255_offset = 0, + .i8254_offset = 0, + .iosize = 16, /* unchecked */ + }, + { + .name = "das08jr-16-ao", /* cio-das08jr-16-ao.pdf */ + .bustype = isa, + .ai = das08_ai_rinsn, + .ai_nbits = 16, + .ai_pg = das08_pg_none, + .ai_encoding = das08_encode12, + .ao = das08jr_ao_winsn, + .ao_nbits = 16, + .di = das08jr_di_rbits, + .do_ = das08jr_do_wbits, + .do_nchan = 8, + .i8255_offset = 0, + .i8254_offset = 0x04, + .iosize = 16, /* unchecked */ + }, + { + .name = "pc104-das08", + .bustype = pc104, + .ai = das08_ai_rinsn, + .ai_nbits = 12, + .ai_pg = das08_pg_none, + .ai_encoding = das08_encode12, + .ao = NULL, + .ao_nbits = 0, + .di = das08_di_rbits, + .do_ = das08_do_wbits, + .do_nchan = 4, + .i8255_offset = 0, + .i8254_offset = 4, + .iosize = 16, /* unchecked */ + }, +#if 0 + { + .name = "das08/f", + }, + { + .name = "das08jr", + }, +#endif + { + .name = "das08jr/16", + .bustype = isa, + .ai = das08_ai_rinsn, + .ai_nbits = 16, + .ai_pg = das08_pg_none, + .ai_encoding = das08_encode16, + .ao = NULL, + .ao_nbits = 0, + .di = das08jr_di_rbits, + .do_ = das08jr_do_wbits, + .do_nchan = 8, + .i8255_offset = 0, + .i8254_offset = 0, + .iosize = 16, /* unchecked */ + }, +#if 0 + { + .name = "das48-pga", /* cio-das48-pga.pdf */ + }, + { + .name = "das08-pga-g2", /* a KM board */ + }, +#endif +#endif /* IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) */ +#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) + { + .name = "das08", /* pci-das08 */ + .id = PCI_DEVICE_ID_PCIDAS08, + .bustype = pci, + .ai = das08_ai_rinsn, + .ai_nbits = 12, + .ai_pg = das08_bipolar5, + .ai_encoding = das08_encode12, + .ao = NULL, + .ao_nbits = 0, + .di = das08_di_rbits, + .do_ = das08_do_wbits, + .do_nchan = 4, + .i8255_offset = 0, + .i8254_offset = 4, + .iosize = 8, + }, +#endif /* IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) */ +}; +#endif /* DO_COMEDI_DRIVER_REGISTER */ -static struct comedi_driver das08_driver = { - .driver_name = DRV_NAME, - .module = THIS_MODULE, - .attach = das08_attach, - .detach = das08_detach, - .board_name = &das08_boards[0].name, - .num_names = sizeof(das08_boards) / sizeof(struct das08_board_struct), - .offset = sizeof(struct das08_board_struct), +#if IS_ENABLED(CONFIG_COMEDI_DAS08_CS) +struct das08_board_struct das08_cs_boards[NUM_DAS08_CS_BOARDS] = { + { + .name = "pcm-das08", + .id = 0x0, /* XXX */ + .bustype = pcmcia, + .ai = das08_ai_rinsn, + .ai_nbits = 12, + .ai_pg = das08_bipolar5, + .ai_encoding = das08_pcm_encode12, + .ao = NULL, + .ao_nbits = 0, + .di = das08_di_rbits, + .do_ = das08_do_wbits, + .do_nchan = 3, + .i8255_offset = 0, + .i8254_offset = 0, + .iosize = 16, + }, + /* duplicate so driver name can be used also */ + { + .name = "das08_cs", + .id = 0x0, /* XXX */ + .bustype = pcmcia, + .ai = das08_ai_rinsn, + .ai_nbits = 12, + .ai_pg = das08_bipolar5, + .ai_encoding = das08_pcm_encode12, + .ao = NULL, + .ao_nbits = 0, + .di = das08_di_rbits, + .do_ = das08_do_wbits, + .do_nchan = 3, + .i8255_offset = 0, + .i8254_offset = 0, + .iosize = 16, + }, }; +EXPORT_SYMBOL_GPL(das08_cs_boards); #endif int das08_common_attach(struct comedi_device *dev, unsigned long iobase) @@ -1086,7 +1040,26 @@ static void das08_detach(struct comedi_device *dev) } #endif /* DO_COMEDI_DRIVER_REGISTER */ +#ifdef DO_COMEDI_DRIVER_REGISTER +static struct comedi_driver das08_driver = { + .driver_name = DRV_NAME, + .module = THIS_MODULE, + .attach = das08_attach, + .detach = das08_detach, + .board_name = &das08_boards[0].name, + .num_names = sizeof(das08_boards) / sizeof(struct das08_board_struct), + .offset = sizeof(struct das08_board_struct), +}; +#endif + #if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) +static DEFINE_PCI_DEVICE_TABLE(das08_pci_table) = { + { PCI_DEVICE(PCI_VENDOR_ID_COMPUTERBOARDS, PCI_DEVICE_ID_PCIDAS08) }, + {0} +}; + +MODULE_DEVICE_TABLE(pci, das08_pci_table); + static int __devinit das08_pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) { @@ -1126,10 +1099,6 @@ module_init(das08_init); module_exit(das08_exit); #endif /* DO_COMEDI_DRIVER_REGISTER */ -#if IS_ENABLED(CONFIG_COMEDI_DAS08_CS) -EXPORT_SYMBOL_GPL(das08_cs_boards); -#endif - MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_DESCRIPTION("Comedi low-level driver"); MODULE_LICENSE("GPL"); -- cgit v0.10.2 From 33fba3b7841b0cf7565e4352a2bab69fc5f4288f Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 24 May 2012 17:27:15 +0100 Subject: staging: comedi: das08: Replace printk calls Replace the printk calls with dev_info, dev_err, etc. Some of the printk strings were missing newlines on the end. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index 901411e..680384c 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -274,7 +274,7 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, /* clear over-range bits for 16-bit boards */ if (thisboard->ai_nbits == 16) if (inb(dev->iobase + DAS08_MSB) & 0x80) - printk(KERN_INFO "das08: over-range\n"); + dev_info(dev->class_dev, "over-range\n"); /* trigger conversion */ outb_p(0, dev->iobase + DAS08_TRIG_12BIT); @@ -284,7 +284,7 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, break; } if (i == TIMEOUT) { - printk(KERN_ERR "das08: timeout\n"); + dev_err(dev->class_dev, "timeout\n"); return -ETIME; } msb = inb(dev->iobase + DAS08_MSB); @@ -529,11 +529,7 @@ static int das08_counter_read(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { int chan = insn->chanspec; - - /* printk("Reading counter channel %d ",chan); */ data[0] = i8254_read_channel(&devpriv->i8254, chan); - /* printk("=> 0x%08X\n",data[0]); */ - return 1; } @@ -542,10 +538,7 @@ static int das08_counter_write(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { int chan = insn->chanspec; - - /* printk("Writing counter channel %d with 0x%04X\n",chan,data[0]); */ i8254_write_channel(&devpriv->i8254, chan, data[0]); - return 1; } @@ -948,15 +941,14 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (ret < 0) return ret; - printk(KERN_INFO "comedi%d: das08: ", dev->minor); + dev_info(dev->class_dev, "attach\n"); if (IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) && thisboard->bustype == pci) { unsigned long pci_iobase = 0; struct pci_dev *pdev = NULL; if (it->options[0] || it->options[1]) { - printk("bus %i slot %i ", + dev_info(dev->class_dev, "pci bus %i slot %i\n", it->options[0], it->options[1]); } - printk("\n"); /* find card */ for_each_pci_dev(pdev) { if (pdev->vendor == PCI_VENDOR_ID_COMPUTERBOARDS @@ -973,21 +965,21 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) } } if (!pdev) { - printk(KERN_ERR "No pci das08 cards found\n"); + dev_err(dev->class_dev, "No pci das08 cards found\n"); return -EIO; } devpriv->pdev = pdev; /* enable PCI device and reserve I/O spaces */ if (comedi_pci_enable(pdev, DRV_NAME)) { - printk(KERN_ERR " Error enabling PCI device and " - "requesting regions\n"); + dev_err(dev->class_dev, + "Error enabling PCI device and requesting regions\n"); return -EIO; } /* read base addresses */ pci_iobase = pci_resource_start(pdev, 1); iobase = pci_resource_start(pdev, 2); - printk(KERN_INFO "pcibase 0x%lx iobase 0x%lx\n", - pci_iobase, iobase); + dev_info(dev->class_dev, "pcibase 0x%lx iobase 0x%lx\n", + pci_iobase, iobase); devpriv->pci_iobase = pci_iobase; #if 0 /* We could enable to pci-das08's interrupt here to make it possible @@ -1003,9 +995,9 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) } else if (IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) && (thisboard->bustype == isa || thisboard->bustype == pc104)) { iobase = it->options[0]; - printk(KERN_INFO " iobase 0x%lx\n", iobase); + dev_info(dev->class_dev, "iobase 0x%lx\n", iobase); if (!request_region(iobase, thisboard->iosize, DRV_NAME)) { - printk(KERN_ERR " I/O port conflict\n"); + dev_err(dev->class_dev, "I/O port conflict\n"); return -EIO; } } else -- cgit v0.10.2 From 282f3528e21cd35f85e8ea3cb7dbcd285a6e5379 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 24 May 2012 17:27:16 +0100 Subject: staging: comedi: das08: Remove thisboard and devpriv macros The 'thisboard' and 'devpriv' macros rely on a local variable having a specific name and yield pointers derived from that local variable. Replace the macros with local variables wherever they occur. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index 680384c..8ebb56d 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -235,14 +235,13 @@ static const int *const das08_gainlists[] = { das08_pgm_gainlist, }; -#define devpriv ((struct das08_private_struct *)dev->private) -#define thisboard ((const struct das08_board_struct *)dev->board_ptr) - #define TIMEOUT 100000 static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + const struct das08_board_struct *thisboard = comedi_board(dev); + struct das08_private_struct *devpriv = dev->private; int i, n; int chan; int range; @@ -320,6 +319,7 @@ static int das08_di_rbits(struct comedi_device *dev, struct comedi_subdevice *s, static int das08_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct das08_private_struct *devpriv = dev->private; int wbits; /* get current settings of digital output lines */ @@ -358,6 +358,8 @@ static int das08jr_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct das08_private_struct *devpriv = dev->private; + /* null bits we are going to set */ devpriv->do_bits &= ~data[0]; /* set new bit values */ @@ -528,6 +530,7 @@ static int das08_counter_read(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct das08_private_struct *devpriv = dev->private; int chan = insn->chanspec; data[0] = i8254_read_channel(&devpriv->i8254, chan); return 1; @@ -537,6 +540,7 @@ static int das08_counter_write(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct das08_private_struct *devpriv = dev->private; int chan = insn->chanspec; i8254_write_channel(&devpriv->i8254, chan, data[0]); return 1; @@ -546,6 +550,7 @@ static int das08_counter_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct das08_private_struct *devpriv = dev->private; int chan = insn->chanspec; if (insn->n != 2) @@ -823,6 +828,8 @@ EXPORT_SYMBOL_GPL(das08_cs_boards); int das08_common_attach(struct comedi_device *dev, unsigned long iobase) { + const struct das08_board_struct *thisboard = comedi_board(dev); + struct das08_private_struct *devpriv = dev->private; struct comedi_subdevice *s; int ret; @@ -934,12 +941,15 @@ EXPORT_SYMBOL_GPL(das08_common_attach); #ifdef DO_COMEDI_DRIVER_REGISTER static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct das08_board_struct *thisboard = comedi_board(dev); + struct das08_private_struct *devpriv; int ret; unsigned long iobase; ret = alloc_private(dev, sizeof(struct das08_private_struct)); if (ret < 0) return ret; + devpriv = dev->private; dev_info(dev->class_dev, "attach\n"); if (IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) && thisboard->bustype == pci) { @@ -1016,6 +1026,9 @@ EXPORT_SYMBOL_GPL(das08_common_detach); #ifdef DO_COMEDI_DRIVER_REGISTER static void das08_detach(struct comedi_device *dev) { + const struct das08_board_struct *thisboard = comedi_board(dev); + struct das08_private_struct *devpriv = dev->private; + das08_common_detach(dev); if (IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) && (thisboard->bustype == isa || thisboard->bustype == pc104)) { -- cgit v0.10.2 From f86b0d7da3ab15f73723d98f6685d6d8ef48c166 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 24 May 2012 17:27:17 +0100 Subject: staging: comedi: das08: Support multiple PCI card types in future Rename the existing board entry named "das08" for the PCI-DAS08 board to "pci-das08". Add a new wildcard board entry called "das08" that will match any supported PCI board. If 'dev->board_ptr' points to the wildcard board entry in the ->attach() routine, it will be replaced with a supported PCI board entry if there are any (taking into account the bus and slot specified by the device config options passed in to the function). Split the code that finds a matching PCI device into a new function das08_find_pci(). Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index 8ebb56d..7324461 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -32,7 +32,7 @@ * [ComputerBoards] DAS08 (isa-das08), DAS08-PGM (das08-pgm), * DAS08-PGH (das08-pgh), DAS08-PGL (das08-pgl), DAS08-AOH (das08-aoh), * DAS08-AOL (das08-aol), DAS08-AOM (das08-aom), DAS08/JR-AO (das08/jr-ao), - * DAS08/JR-16-AO (das08jr-16-ao), PCI-DAS08 (das08), + * DAS08/JR-16-AO (das08jr-16-ao), PCI-DAS08 (pci-das08 or das08), * PC104-DAS08 (pc104-das08), DAS08/JR/16 (das08jr/16) * Status: works * @@ -765,7 +765,7 @@ static const struct das08_board_struct das08_boards[] = { #endif /* IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) */ #if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) { - .name = "das08", /* pci-das08 */ + .name = "pci-das08", /* pci-das08 */ .id = PCI_DEVICE_ID_PCIDAS08, .bustype = pci, .ai = das08_ai_rinsn, @@ -781,6 +781,11 @@ static const struct das08_board_struct das08_boards[] = { .i8254_offset = 4, .iosize = 8, }, + { /* wildcard entry matches any supported PCI device */ + .name = DRV_NAME, + .id = PCI_ANY_ID, + .bustype = pci, + }, #endif /* IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) */ }; #endif /* DO_COMEDI_DRIVER_REGISTER */ @@ -938,6 +943,66 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) } EXPORT_SYMBOL_GPL(das08_common_attach); +#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) +static struct pci_dev *das08_find_pci(struct comedi_device *dev, + int bus, int slot) +{ + const struct das08_board_struct *thisboard = comedi_board(dev); + struct pci_dev *pdev; + unsigned int matchid; + + if (bus || slot) + dev_dbg(dev->class_dev, "Looking for %s at PCI %02X:%02X\n", + thisboard->name, bus, slot); + else + dev_dbg(dev->class_dev, "Looking for %s on PCI buses\n", + thisboard->name); + + matchid = thisboard->id; + pdev = NULL; + for_each_pci_dev(pdev) { + if ((bus || slot) && + (bus != pdev->bus->number || slot != PCI_SLOT(pdev->devfn))) + continue; + if (pdev->vendor != PCI_VENDOR_ID_COMPUTERBOARDS) + continue; + if (matchid == PCI_ANY_ID) { + /* wildcard board matches any supported PCI board */ + unsigned int i; + for (i = 0; i < ARRAY_SIZE(das08_boards); i++) { + if (das08_boards[i].bustype != pci) + continue; + if (pdev->device == das08_boards[i].id) { + /* replace wildcard board_ptr */ + dev->board_ptr = &das08_boards[i]; + thisboard = comedi_board(dev); + break; + } + } + if (i == ARRAY_SIZE(das08_boards)) + continue; + } else { + /* match specific PCI board */ + if (pdev->device != matchid) + continue; + } + /* found a match */ + dev_info(dev->class_dev, "Found %s at PCI %s\n", + thisboard->name, pci_name(pdev)); + return pdev; + } + /* no match found */ + if (bus || slot) + dev_err(dev->class_dev, + "No %s cards found at PCI %02X:%02X\n", + thisboard->name, bus, slot); + else + dev_err(dev->class_dev, "No %s cards found on PCI buses\n", + thisboard->name); + return NULL; +} +#endif + #ifdef DO_COMEDI_DRIVER_REGISTER static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) { @@ -954,30 +1019,11 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev_info(dev->class_dev, "attach\n"); if (IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) && thisboard->bustype == pci) { unsigned long pci_iobase = 0; - struct pci_dev *pdev = NULL; - if (it->options[0] || it->options[1]) { - dev_info(dev->class_dev, "pci bus %i slot %i\n", - it->options[0], it->options[1]); - } - /* find card */ - for_each_pci_dev(pdev) { - if (pdev->vendor == PCI_VENDOR_ID_COMPUTERBOARDS - && pdev->device == PCI_DEVICE_ID_PCIDAS08) { - if (it->options[0] || it->options[1]) { - if (pdev->bus->number == it->options[0] - && PCI_SLOT(pdev->devfn) == - it->options[1]) { - break; - } - } else { - break; - } - } - } - if (!pdev) { - dev_err(dev->class_dev, "No pci das08 cards found\n"); + struct pci_dev *pdev; + pdev = das08_find_pci(dev, it->options[0], it->options[1]); + if (pdev == NULL) return -EIO; - } + thisboard = comedi_board(dev); /* replaced wildcard board */ devpriv->pdev = pdev; /* enable PCI device and reserve I/O spaces */ if (comedi_pci_enable(pdev, DRV_NAME)) { -- cgit v0.10.2 From 8b7d417c406bafacedeae6cc3e110b11640d14e5 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 24 May 2012 17:27:18 +0100 Subject: staging: comedi: das08: Add attach_pci() hook Implement the attach_pci() hook. This is called by comedi_pci_auto_config() in preference to the old attach() hook and avoids searching for the probed PCI device. Factor out some common code used by both the attach() and attach_pci() hooks into a couple of new functions, das08_pci_attach_common() and das08_find_pci_board(). Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index 7324461..fa2784d 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -944,6 +944,75 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) EXPORT_SYMBOL_GPL(das08_common_attach); #if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) +static int das08_pci_attach_common(struct comedi_device *dev, + struct pci_dev *pdev) +{ + unsigned long iobase; + unsigned long pci_iobase; + struct das08_private_struct *devpriv = dev->private; + + devpriv->pdev = pdev; + /* enable PCI device and reserve I/O spaces */ + if (comedi_pci_enable(pdev, dev->driver->driver_name)) { + dev_err(dev->class_dev, + "Error enabling PCI device and requesting regions\n"); + return -EIO; + } + /* read base addresses */ + pci_iobase = pci_resource_start(pdev, 1); + iobase = pci_resource_start(pdev, 2); + dev_info(dev->class_dev, "pcibase 0x%lx iobase 0x%lx\n", + pci_iobase, iobase); + devpriv->pci_iobase = pci_iobase; +#if 0 + /* We could enable pci-das08's interrupt here to make it possible + * to do timed input in this driver, but there is little point since + * conversions would have to be started by the interrupt handler + * so you might as well use comedi_rt_timer to emulate commands + */ + /* set source of interrupt trigger to counter2 output */ + outb(CNTRL_INTR | CNTRL_DIR, pci_iobase + CNTRL); + /* Enable local interrupt 1 and pci interrupt */ + outw(INTR1_ENABLE | PCI_INTR_ENABLE, pci_iobase + INTCSR); +#endif + return das08_common_attach(dev, iobase); +} +#endif + +#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) +static const struct das08_board_struct * +das08_find_pci_board(struct pci_dev *pdev) +{ + unsigned int i; + for (i = 0; i < ARRAY_SIZE(das08_boards); i++) + if (das08_boards[i].bustype == pci && + pdev->device == das08_boards[i].id) + return &das08_boards[i]; + return NULL; +} +#endif + +#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) +/* only called in the PCI probe path, via comedi_pci_auto_config() */ +static int __devinit das08_attach_pci(struct comedi_device *dev, + struct pci_dev *pdev) +{ + int ret; + + ret = alloc_private(dev, sizeof(struct das08_private_struct)); + if (ret < 0) + return ret; + dev_info(dev->class_dev, "attach pci %s\n", pci_name(pdev)); + dev->board_ptr = das08_find_pci_board(pdev); + if (dev->board_ptr == NULL) { + dev_err(dev->class_dev, "BUG! cannot determine board type!\n"); + return -EINVAL; + } + return das08_pci_attach_common(dev, pdev); +} +#endif + +#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) static struct pci_dev *das08_find_pci(struct comedi_device *dev, int bus, int slot) { @@ -968,19 +1037,12 @@ static struct pci_dev *das08_find_pci(struct comedi_device *dev, continue; if (matchid == PCI_ANY_ID) { /* wildcard board matches any supported PCI board */ - unsigned int i; - for (i = 0; i < ARRAY_SIZE(das08_boards); i++) { - if (das08_boards[i].bustype != pci) - continue; - if (pdev->device == das08_boards[i].id) { - /* replace wildcard board_ptr */ - dev->board_ptr = &das08_boards[i]; - thisboard = comedi_board(dev); - break; - } - } - if (i == ARRAY_SIZE(das08_boards)) + const struct das08_board_struct *foundboard; + foundboard = das08_find_pci_board(pdev); + if (foundboard == NULL) continue; + /* replace wildcard board_ptr */ + dev->board_ptr = thisboard = foundboard; } else { /* match specific PCI board */ if (pdev->device != matchid) @@ -1018,36 +1080,11 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev_info(dev->class_dev, "attach\n"); if (IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) && thisboard->bustype == pci) { - unsigned long pci_iobase = 0; struct pci_dev *pdev; pdev = das08_find_pci(dev, it->options[0], it->options[1]); if (pdev == NULL) return -EIO; - thisboard = comedi_board(dev); /* replaced wildcard board */ - devpriv->pdev = pdev; - /* enable PCI device and reserve I/O spaces */ - if (comedi_pci_enable(pdev, DRV_NAME)) { - dev_err(dev->class_dev, - "Error enabling PCI device and requesting regions\n"); - return -EIO; - } - /* read base addresses */ - pci_iobase = pci_resource_start(pdev, 1); - iobase = pci_resource_start(pdev, 2); - dev_info(dev->class_dev, "pcibase 0x%lx iobase 0x%lx\n", - pci_iobase, iobase); - devpriv->pci_iobase = pci_iobase; -#if 0 -/* We could enable to pci-das08's interrupt here to make it possible - * to do timed input in this driver, but there is little point since - * conversions would have to be started by the interrupt handler - * so you might as well use comedi_rt_timer to emulate commands - */ - /* set source of interrupt trigger to counter2 output */ - outb(CNTRL_INTR | CNTRL_DIR, pci_iobase + CNTRL); - /* Enable local interrupt 1 and pci interrupt */ - outw(INTR1_ENABLE | PCI_INTR_ENABLE, pci_iobase + INTCSR); -#endif + return das08_pci_attach_common(dev, pdev); } else if (IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) && (thisboard->bustype == isa || thisboard->bustype == pc104)) { iobase = it->options[0]; @@ -1056,9 +1093,9 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev_err(dev->class_dev, "I/O port conflict\n"); return -EIO; } + return das08_common_attach(dev, iobase); } else return -EIO; - return das08_common_attach(dev, iobase); } #endif /* DO_COMEDI_DRIVER_REGISTER */ @@ -1096,6 +1133,9 @@ static struct comedi_driver das08_driver = { .driver_name = DRV_NAME, .module = THIS_MODULE, .attach = das08_attach, +#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) + .attach_pci = das08_attach_pci, +#endif .detach = das08_detach, .board_name = &das08_boards[0].name, .num_names = sizeof(das08_boards) / sizeof(struct das08_board_struct), -- cgit v0.10.2 From bc04bec0e0c982dfc90e206ea51f19bd650ccee2 Mon Sep 17 00:00:00 2001 From: Masanari Iida Date: Sun, 27 May 2012 01:45:19 +0900 Subject: staging: comedi: Fix typo in comedi Correct spelling typo in comments within staging/comedi. Signed-off-by: Masanari Iida Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index f2135bf..3670ebd 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -299,7 +299,7 @@ struct pci9118_private { short *ai_data; short ao_data[2]; /* data output buffer */ unsigned int ai_scans; /* number of scans to do */ - char dma_doublebuf; /* we can use double buffring */ + char dma_doublebuf; /* we can use double buffering */ unsigned int dma_actbuf; /* which buffer is used now */ short *dmabuf_virt[2]; /* * pointers to begin of diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 7f88d08..074feee 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -57,8 +57,8 @@ range and aref. AI Triggering: For start_src == TRIG_EXT, the A/D EXTERNAL TRIGGER IN (pin 45) is used. For 1602 series, the start_arg is interpreted as follows: - start_arg == 0 => gated triger (level high) - start_arg == CR_INVERT => gated triger (level low) + start_arg == 0 => gated trigger (level high) + start_arg == CR_INVERT => gated trigger (level low) start_arg == CR_EDGE => Rising edge start_arg == CR_EDGE | CR_INVERT => Falling edge For the other boards the trigger will be done on rising edge diff --git a/drivers/staging/comedi/drivers/das800.c b/drivers/staging/comedi/drivers/das800.c index a3a54e1..4e33b2a 100644 --- a/drivers/staging/comedi/drivers/das800.c +++ b/drivers/staging/comedi/drivers/das800.c @@ -450,7 +450,7 @@ static irqreturn_t das800_interrupt(int irq, void *d) /* otherwise, stop taking data */ } else { spin_unlock_irqrestore(&dev->spinlock, irq_flags); - disable_das800(dev); /* diable hardware triggered conversions */ + disable_das800(dev); /* disable hardware triggered conversions */ async->events |= COMEDI_CB_EOA; } comedi_event(dev, s); diff --git a/drivers/staging/comedi/drivers/dyna_pci10xx.c b/drivers/staging/comedi/drivers/dyna_pci10xx.c index 9586f24..367a7c8 100644 --- a/drivers/staging/comedi/drivers/dyna_pci10xx.c +++ b/drivers/staging/comedi/drivers/dyna_pci10xx.c @@ -141,7 +141,7 @@ static int dyna_pci10xx_insn_read_ai(struct comedi_device *dev, for (counter = 0; counter < READ_TIMEOUT; counter++) { d = inw_p(devpriv->BADR2); - /* check if read is successfull if the EOC bit is set */ + /* check if read is successful if the EOC bit is set */ if (d & (1 << 15)) goto conv_finish; } diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c b/drivers/staging/comedi/drivers/gsc_hpdi.c index eeb0555..fe1fd2f 100644 --- a/drivers/staging/comedi/drivers/gsc_hpdi.c +++ b/drivers/staging/comedi/drivers/gsc_hpdi.c @@ -631,7 +631,7 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it) printk(KERN_WARNING " irq %u\n", dev->irq); - /* alocate pci dma buffers */ + /* allocate pci dma buffers */ for (i = 0; i < NUM_DMA_BUFFERS; i++) { priv(dev)->dio_buffer[i] = pci_alloc_consistent(priv(dev)->hw_dev, DMA_BUFFER_SIZE, diff --git a/drivers/staging/comedi/drivers/icp_multi.c b/drivers/staging/comedi/drivers/icp_multi.c index f870d3d..1f254f4 100644 --- a/drivers/staging/comedi/drivers/icp_multi.c +++ b/drivers/staging/comedi/drivers/icp_multi.c @@ -835,7 +835,7 @@ static int icp_multi_attach(struct comedi_device *dev, printk(KERN_WARNING "icp_multi EDBG: BGN: icp_multi_attach(...)\n"); - /* Alocate private data storage space */ + /* Allocate private data storage space */ ret = alloc_private(dev, sizeof(struct icp_multi_private)); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index 465afbd..441ccef 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -1358,7 +1358,7 @@ static int usbdux_ai_insn_read(struct comedi_device *dev, /* 32 bits big endian from the A/D converter */ one = be32_to_cpu(*((int32_t *) ((this_usbduxsub->insnBuffer)+1))); - /* mask out the staus byte */ + /* mask out the status byte */ one = one & 0x00ffffff; /* turn it into an unsigned integer */ one = one ^ 0x00800000; -- cgit v0.10.2 From 856ff77e3307eb89ba68e7cc3c1fa91112efff89 Mon Sep 17 00:00:00 2001 From: Dimitrios Semitsoglou-Tsiapos Date: Tue, 29 May 2012 00:51:44 +0300 Subject: staging: comedi: cb_pcidas64: Fixed coding style errors Fixed a few coding style errors in cb_pcidas64. Signed-off-by: Dimitrios Semitsoglou-Tsiapos Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 1e30f22..5bcadcb 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -1152,7 +1152,7 @@ static int eeprom_read_insn(struct comedi_device *dev, static void check_adc_timing(struct comedi_device *dev, struct comedi_cmd *cmd); static unsigned int get_divisor(unsigned int ns, unsigned int flags); static void i2c_write(struct comedi_device *dev, unsigned int address, - const uint8_t * data, unsigned int length); + const uint8_t *data, unsigned int length); static void caldac_write(struct comedi_device *dev, unsigned int channel, unsigned int value); static int caldac_8800_write(struct comedi_device *dev, unsigned int address, @@ -1229,7 +1229,7 @@ static unsigned int hw_revision(const struct comedi_device *dev, } static void set_dac_range_bits(struct comedi_device *dev, - volatile uint16_t * bits, unsigned int channel, + volatile uint16_t *bits, unsigned int channel, unsigned int range) { unsigned int code = board(dev)->ao_range_code[range]; @@ -4190,7 +4190,7 @@ static void i2c_stop(struct comedi_device *dev) } static void i2c_write(struct comedi_device *dev, unsigned int address, - const uint8_t * data, unsigned int length) + const uint8_t *data, unsigned int length) { unsigned int i; uint8_t bitstream; -- cgit v0.10.2 From 5b28e55eb15f88920cd509332a22f80d72d55284 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 29 May 2012 15:30:18 -0700 Subject: staging: comedi: Make COMEDI_FC a hidden Kconfig option The COMEDI_FC Kconfig option is selected by the relevant drivers when needed. Since it only contains shared functions, selecting it manually serves no purpose. Just make it a hidden selection. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 3bbe3fd..54e32da 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -1305,15 +1305,8 @@ config COMEDI_8255 called 8255. config COMEDI_FC - tristate "Comedi shared functions for low-level driver support" + tristate depends on COMEDI - ---help--- - Enable support for shared functions for low-level drivers. - This module is not used directly by end-users. Rather, it - is used by many other comedi drivers. - - To compile this driver as a module, choose M here: the module will be - called comedi_fc. config COMEDI_AMPLC_DIO200 tristate -- cgit v0.10.2 From 1364b02fbf6e2d298ff2428ace81f9c6517b4bd8 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Thu, 31 May 2012 13:56:28 -0700 Subject: staging: comedi: drivers.c: remove unused inline functions Remove the inline functions uvirt_to_kva and kvirt_to_kva, they are not referenced by any of the drivers.c code. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 438c52a..9d2b206 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -383,39 +383,6 @@ static int insn_rw_emulate_bits(struct comedi_device *dev, return 1; } -static inline unsigned long uvirt_to_kva(pgd_t *pgd, unsigned long adr) -{ - unsigned long ret = 0UL; - pmd_t *pmd; - pte_t *ptep, pte; - pud_t *pud; - - if (!pgd_none(*pgd)) { - pud = pud_offset(pgd, adr); - pmd = pmd_offset(pud, adr); - if (!pmd_none(*pmd)) { - ptep = pte_offset_kernel(pmd, adr); - pte = *ptep; - if (pte_present(pte)) { - ret = (unsigned long) - page_address(pte_page(pte)); - ret |= (adr & (PAGE_SIZE - 1)); - } - } - } - return ret; -} - -static inline unsigned long kvirt_to_kva(unsigned long adr) -{ - unsigned long va, kva; - - va = adr; - kva = uvirt_to_kva(pgd_offset_k(va), va); - - return kva; -} - int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, unsigned long new_size) { -- cgit v0.10.2 From 1bb6dfc407b7c29d22dc9b5d21db86f50653b46e Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 29 May 2012 14:49:28 +0100 Subject: staging: comedi: amplc_pc236: Use IS_ENABLED() Change conditional compilation on kernel config options to use the IS_ENABLED() macro. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c index 6cb06ec..5f1caac 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236.c +++ b/drivers/staging/comedi/drivers/amplc_pc236.c @@ -61,14 +61,6 @@ unused. #define PC236_DRIVER_NAME "amplc_pc236" -#ifdef CONFIG_COMEDI_AMPLC_PC236_ISA_MODULE -#define CONFIG_COMEDI_AMPLC_PC236_ISA -#endif - -#ifdef CONFIG_COMEDI_AMPLC_PC236_PCI_MODULE -#define CONFIG_COMEDI_AMPLC_PC236_PCI -#endif - /* PCI236 PCI configuration register information */ #define PCI_VENDOR_ID_AMPLICON 0x14dc #define PCI_DEVICE_ID_AMPLICON_PCI236 0x0009 @@ -112,7 +104,7 @@ struct pc236_board { enum pc236_model model; }; static const struct pc236_board pc236_boards[] = { -#ifdef CONFIG_COMEDI_AMPLC_PC236_ISA +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) { .name = "pc36at", .fancy_name = "PC36AT", @@ -120,7 +112,7 @@ static const struct pc236_board pc236_boards[] = { .model = pc36at_model, }, #endif -#ifdef CONFIG_COMEDI_AMPLC_PC236_PCI +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) { .name = "pci236", .fancy_name = "PCI236", @@ -138,7 +130,7 @@ static const struct pc236_board pc236_boards[] = { #endif }; -#ifdef CONFIG_COMEDI_AMPLC_PC236_PCI +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) static DEFINE_PCI_DEVICE_TABLE(pc236_pci_table) = { { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI236) }, {0} @@ -157,7 +149,7 @@ MODULE_DEVICE_TABLE(pci, pc236_pci_table); feel free to suggest moving the variable to the struct comedi_device struct. */ struct pc236_private { -#ifdef CONFIG_COMEDI_AMPLC_PC236_PCI +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) /* PCI device */ struct pci_dev *pci_dev; unsigned long lcr_iobase; /* PLX PCI9052 config registers in PCIBAR1 */ @@ -185,7 +177,7 @@ static struct comedi_driver driver_amplc_pc236 = { .num_names = ARRAY_SIZE(pc236_boards), }; -#ifdef CONFIG_COMEDI_AMPLC_PC236_PCI +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) static int __devinit driver_amplc_pc236_pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) @@ -240,7 +232,7 @@ module_init(driver_amplc_pc236_init_module); module_exit(driver_amplc_pc236_cleanup_module); #endif -#ifdef CONFIG_COMEDI_AMPLC_PC236_ISA +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) static int pc236_request_region(unsigned minor, unsigned long from, unsigned long extent); #endif @@ -263,7 +255,7 @@ static irqreturn_t pc236_interrupt(int irq, void *d); * This function looks for a PCI device matching the requested board name, * bus and slot. */ -#ifdef CONFIG_COMEDI_AMPLC_PC236_PCI +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) static int pc236_find_pci(struct comedi_device *dev, int bus, int slot, struct pci_dev **pci_dev_p) @@ -332,7 +324,7 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) struct comedi_subdevice *s; unsigned long iobase = 0; unsigned int irq = 0; -#ifdef CONFIG_COMEDI_AMPLC_PC236_PCI +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) struct pci_dev *pci_dev = NULL; int bus = 0, slot = 0; #endif @@ -353,14 +345,14 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) } /* Process options. */ switch (thisboard->bustype) { -#ifdef CONFIG_COMEDI_AMPLC_PC236_ISA +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) case isa_bustype: iobase = it->options[0]; irq = it->options[1]; share_irq = 0; break; #endif -#ifdef CONFIG_COMEDI_AMPLC_PC236_PCI +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) case pci_bustype: bus = it->options[0]; slot = it->options[1]; @@ -386,7 +378,7 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->board_name = thisboard->name; /* Enable device and reserve I/O spaces. */ -#ifdef CONFIG_COMEDI_AMPLC_PC236_PCI +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) if (pci_dev) { ret = comedi_pci_enable(pci_dev, PC236_DRIVER_NAME); @@ -402,7 +394,7 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) } else #endif { -#ifdef CONFIG_COMEDI_AMPLC_PC236_ISA +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) ret = pc236_request_region(dev->minor, iobase, PC236_IO_SIZE); if (ret < 0) return ret; @@ -452,12 +444,12 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) } printk(KERN_INFO "comedi%d: %s ", dev->minor, dev->board_name); switch (thisboard->bustype) { -#ifdef CONFIG_COMEDI_AMPLC_PC236_ISA +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) case isa_bustype: printk("(base %#lx) ", iobase); break; #endif -#ifdef CONFIG_COMEDI_AMPLC_PC236_PCI +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) case pci_bustype: printk("(pci %s) ", pci_name(pci_dev)); break; @@ -484,7 +476,7 @@ static void pc236_detach(struct comedi_device *dev) if (dev->subdevices) subdev_8255_cleanup(dev, dev->subdevices + 0); if (devpriv) { -#ifdef CONFIG_COMEDI_AMPLC_PC236_PCI +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) if (devpriv->pci_dev) { if (dev->iobase) comedi_pci_disable(devpriv->pci_dev); @@ -492,7 +484,7 @@ static void pc236_detach(struct comedi_device *dev) } else #endif { -#ifdef CONFIG_COMEDI_AMPLC_PC236_ISA +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) if (dev->iobase) release_region(dev->iobase, PC236_IO_SIZE); #endif @@ -504,7 +496,7 @@ static void pc236_detach(struct comedi_device *dev) * This function checks and requests an I/O region, reporting an error * if there is a conflict. */ -#ifdef CONFIG_COMEDI_AMPLC_PC236_ISA +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) static int pc236_request_region(unsigned minor, unsigned long from, unsigned long extent) { @@ -528,7 +520,7 @@ static void pc236_intr_disable(struct comedi_device *dev) spin_lock_irqsave(&dev->spinlock, flags); devpriv->enable_irq = 0; -#ifdef CONFIG_COMEDI_AMPLC_PC236_PCI +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) if (devpriv->lcr_iobase) outl(PCI236_INTR_DISABLE, devpriv->lcr_iobase + PLX9052_INTCSR); #endif @@ -546,7 +538,7 @@ static void pc236_intr_enable(struct comedi_device *dev) spin_lock_irqsave(&dev->spinlock, flags); devpriv->enable_irq = 1; -#ifdef CONFIG_COMEDI_AMPLC_PC236_PCI +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) if (devpriv->lcr_iobase) outl(PCI236_INTR_ENABLE, devpriv->lcr_iobase + PLX9052_INTCSR); #endif @@ -568,7 +560,7 @@ static int pc236_intr_check(struct comedi_device *dev) spin_lock_irqsave(&dev->spinlock, flags); if (devpriv->enable_irq) { retval = 1; -#ifdef CONFIG_COMEDI_AMPLC_PC236_PCI +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) if (devpriv->lcr_iobase) { if ((inl(devpriv->lcr_iobase + PLX9052_INTCSR) & PLX9052_INTCSR_LI1STAT_MASK) -- cgit v0.10.2 From c25386f5db48ee5d94b6ff3b1dc43ea6c87c9560 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 29 May 2012 14:49:29 +0100 Subject: staging: comedi: amplc_pc236: Use module_comedi_{pci,}_driver() If PCI boards are supported, use the module_comedi_pci_driver() macro to register the module as a comedi driver and a PCI driver. Otherwise, only ISA boards are supported so use the module_comedi_driver() macro to register the module as a comedi driver. Renamed 'driver_amplc_pc236' to 'amplc_pc236_driver' and removed 'driver_' prefix from PCI related functions and variables, purely for aesthetic reasons. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c index 5f1caac..afd08f0 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236.c +++ b/drivers/staging/comedi/drivers/amplc_pc236.c @@ -167,7 +167,7 @@ struct pc236_private { */ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it); static void pc236_detach(struct comedi_device *dev); -static struct comedi_driver driver_amplc_pc236 = { +static struct comedi_driver amplc_pc236_driver = { .driver_name = PC236_DRIVER_NAME, .module = THIS_MODULE, .attach = pc236_attach, @@ -178,58 +178,28 @@ static struct comedi_driver driver_amplc_pc236 = { }; #if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) -static int __devinit driver_amplc_pc236_pci_probe(struct pci_dev *dev, +static int __devinit amplc_pc236_pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) { - return comedi_pci_auto_config(dev, &driver_amplc_pc236); + return comedi_pci_auto_config(dev, &lc_pc236_driver); } -static void __devexit driver_amplc_pc236_pci_remove(struct pci_dev *dev) +static void __devexit amplc_pc236_pci_remove(struct pci_dev *dev) { comedi_pci_auto_unconfig(dev); } -static struct pci_driver driver_amplc_pc236_pci_driver = { +static struct pci_driver amplc_pc236_pci_driver = { + .name = PC236_DRIVER_NAME, .id_table = pc236_pci_table, - .probe = &driver_amplc_pc236_pci_probe, - .remove = __devexit_p(&driver_amplc_pc236_pci_remove) + .probe = &lc_pc236_pci_probe, + .remove = __devexit_p(&lc_pc236_pci_remove) }; -static int __init driver_amplc_pc236_init_module(void) -{ - int retval; - - retval = comedi_driver_register(&driver_amplc_pc236); - if (retval < 0) - return retval; - - driver_amplc_pc236_pci_driver.name = - (char *)driver_amplc_pc236.driver_name; - return pci_register_driver(&driver_amplc_pc236_pci_driver); -} - -static void __exit driver_amplc_pc236_cleanup_module(void) -{ - pci_unregister_driver(&driver_amplc_pc236_pci_driver); - comedi_driver_unregister(&driver_amplc_pc236); -} - -module_init(driver_amplc_pc236_init_module); -module_exit(driver_amplc_pc236_cleanup_module); +module_comedi_pci_driver(amplc_pc236_driver, amplc_pc236_pci_driver); #else -static int __init driver_amplc_pc236_init_module(void) -{ - return comedi_driver_register(&driver_amplc_pc236); -} - -static void __exit driver_amplc_pc236_cleanup_module(void) -{ - comedi_driver_unregister(&driver_amplc_pc236); -} - -module_init(driver_amplc_pc236_init_module); -module_exit(driver_amplc_pc236_cleanup_module); +module_comedi_driver(amplc_pc236_driver); #endif #if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) -- cgit v0.10.2 From 7bd06f69f3f52fcd04999790a2a9d66f1a8cd0c9 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 29 May 2012 14:49:30 +0100 Subject: staging: comedi: amplc_pc236: Remove forward function declarations Moved some functions and variables to avoid forward declarations. Moved PCI table closer to the struct pci_driver that refers to it. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c index afd08f0..007b45b 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236.c +++ b/drivers/staging/comedi/drivers/amplc_pc236.c @@ -130,15 +130,6 @@ static const struct pc236_board pc236_boards[] = { #endif }; -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) -static DEFINE_PCI_DEVICE_TABLE(pc236_pci_table) = { - { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI236) }, - {0} -}; - -MODULE_DEVICE_TABLE(pci, pc236_pci_table); -#endif /* CONFIG_COMEDI_AMPLC_PC236_PCI */ - /* * Useful for shorthand access to the particular board structure */ @@ -160,68 +151,6 @@ struct pc236_private { #define devpriv ((struct pc236_private *)dev->private) /* - * The struct comedi_driver structure tells the Comedi core module - * which functions to call to configure/deconfigure (attach/detach) - * the board, and also about the kernel module that contains - * the device code. - */ -static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it); -static void pc236_detach(struct comedi_device *dev); -static struct comedi_driver amplc_pc236_driver = { - .driver_name = PC236_DRIVER_NAME, - .module = THIS_MODULE, - .attach = pc236_attach, - .detach = pc236_detach, - .board_name = &pc236_boards[0].name, - .offset = sizeof(struct pc236_board), - .num_names = ARRAY_SIZE(pc236_boards), -}; - -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) -static int __devinit amplc_pc236_pci_probe(struct pci_dev *dev, - const struct pci_device_id - *ent) -{ - return comedi_pci_auto_config(dev, &lc_pc236_driver); -} - -static void __devexit amplc_pc236_pci_remove(struct pci_dev *dev) -{ - comedi_pci_auto_unconfig(dev); -} - -static struct pci_driver amplc_pc236_pci_driver = { - .name = PC236_DRIVER_NAME, - .id_table = pc236_pci_table, - .probe = &lc_pc236_pci_probe, - .remove = __devexit_p(&lc_pc236_pci_remove) -}; - -module_comedi_pci_driver(amplc_pc236_driver, amplc_pc236_pci_driver); -#else -module_comedi_driver(amplc_pc236_driver); -#endif - -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) -static int pc236_request_region(unsigned minor, unsigned long from, - unsigned long extent); -#endif -static void pc236_intr_disable(struct comedi_device *dev); -static void pc236_intr_enable(struct comedi_device *dev); -static int pc236_intr_check(struct comedi_device *dev); -static int pc236_intr_insn(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, - unsigned int *data); -static int pc236_intr_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_cmd *cmd); -static int pc236_intr_cmd(struct comedi_device *dev, - struct comedi_subdevice *s); -static int pc236_intr_cancel(struct comedi_device *dev, - struct comedi_subdevice *s); -static irqreturn_t pc236_interrupt(int irq, void *d); - -/* * This function looks for a PCI device matching the requested board name, * bus and slot. */ @@ -284,185 +213,6 @@ pc236_find_pci(struct comedi_device *dev, int bus, int slot, #endif /* - * Attach is called by the Comedi core to configure the driver - * for a particular board. If you specified a board_name array - * in the driver structure, dev->board_ptr contains that - * address. - */ -static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) -{ - struct comedi_subdevice *s; - unsigned long iobase = 0; - unsigned int irq = 0; -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) - struct pci_dev *pci_dev = NULL; - int bus = 0, slot = 0; -#endif - int share_irq = 0; - int ret; - - printk(KERN_DEBUG "comedi%d: %s: attach\n", dev->minor, - PC236_DRIVER_NAME); -/* - * Allocate the private structure area. alloc_private() is a - * convenient macro defined in comedidev.h. - */ - ret = alloc_private(dev, sizeof(struct pc236_private)); - if (ret < 0) { - printk(KERN_ERR "comedi%d: error! out of memory!\n", - dev->minor); - return ret; - } - /* Process options. */ - switch (thisboard->bustype) { -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) - case isa_bustype: - iobase = it->options[0]; - irq = it->options[1]; - share_irq = 0; - break; -#endif -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) - case pci_bustype: - bus = it->options[0]; - slot = it->options[1]; - share_irq = 1; - - ret = pc236_find_pci(dev, bus, slot, &pci_dev); - if (ret < 0) - return ret; - devpriv->pci_dev = pci_dev; - break; -#endif - default: - printk(KERN_ERR - "comedi%d: %s: BUG! cannot determine board type!\n", - dev->minor, PC236_DRIVER_NAME); - return -EINVAL; - break; - } - -/* - * Initialize dev->board_name. - */ - dev->board_name = thisboard->name; - - /* Enable device and reserve I/O spaces. */ -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) - if (pci_dev) { - - ret = comedi_pci_enable(pci_dev, PC236_DRIVER_NAME); - if (ret < 0) { - printk(KERN_ERR - "comedi%d: error! cannot enable PCI device and request regions!\n", - dev->minor); - return ret; - } - devpriv->lcr_iobase = pci_resource_start(pci_dev, 1); - iobase = pci_resource_start(pci_dev, 2); - irq = pci_dev->irq; - } else -#endif - { -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) - ret = pc236_request_region(dev->minor, iobase, PC236_IO_SIZE); - if (ret < 0) - return ret; -#endif - } - dev->iobase = iobase; - -/* - * Allocate the subdevice structures. alloc_subdevice() is a - * convenient macro defined in comedidev.h. - */ - ret = alloc_subdevices(dev, 2); - if (ret < 0) { - printk(KERN_ERR "comedi%d: error! out of memory!\n", - dev->minor); - return ret; - } - - s = dev->subdevices + 0; - /* digital i/o subdevice (8255) */ - ret = subdev_8255_init(dev, s, NULL, iobase); - if (ret < 0) { - printk(KERN_ERR "comedi%d: error! out of memory!\n", - dev->minor); - return ret; - } - s = dev->subdevices + 1; - dev->read_subdev = s; - s->type = COMEDI_SUBD_UNUSED; - pc236_intr_disable(dev); - if (irq) { - unsigned long flags = share_irq ? IRQF_SHARED : 0; - - if (request_irq(irq, pc236_interrupt, flags, - PC236_DRIVER_NAME, dev) >= 0) { - dev->irq = irq; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE | SDF_CMD_READ; - s->n_chan = 1; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pc236_intr_insn; - s->do_cmdtest = pc236_intr_cmdtest; - s->do_cmd = pc236_intr_cmd; - s->cancel = pc236_intr_cancel; - } - } - printk(KERN_INFO "comedi%d: %s ", dev->minor, dev->board_name); - switch (thisboard->bustype) { -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) - case isa_bustype: - printk("(base %#lx) ", iobase); - break; -#endif -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) - case pci_bustype: - printk("(pci %s) ", pci_name(pci_dev)); - break; -#endif - default: - break; - } - if (irq) - printk("(irq %u%s) ", irq, (dev->irq ? "" : " UNAVAILABLE")); - else - printk("(no irq) "); - - printk("attached\n"); - - return 1; -} - -static void pc236_detach(struct comedi_device *dev) -{ - if (devpriv) - pc236_intr_disable(dev); - if (dev->irq) - free_irq(dev->irq, dev); - if (dev->subdevices) - subdev_8255_cleanup(dev, dev->subdevices + 0); - if (devpriv) { -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) - if (devpriv->pci_dev) { - if (dev->iobase) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); - } else -#endif - { -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) - if (dev->iobase) - release_region(dev->iobase, PC236_IO_SIZE); -#endif - } - } -} - -/* * This function checks and requests an I/O region, reporting an error * if there is a conflict. */ @@ -681,6 +431,232 @@ static irqreturn_t pc236_interrupt(int irq, void *d) return IRQ_RETVAL(handled); } +/* + * Attach is called by the Comedi core to configure the driver + * for a particular board. If you specified a board_name array + * in the driver structure, dev->board_ptr contains that + * address. + */ +static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) +{ + struct comedi_subdevice *s; + unsigned long iobase = 0; + unsigned int irq = 0; +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) + struct pci_dev *pci_dev = NULL; + int bus = 0, slot = 0; +#endif + int share_irq = 0; + int ret; + + printk(KERN_DEBUG "comedi%d: %s: attach\n", dev->minor, + PC236_DRIVER_NAME); +/* + * Allocate the private structure area. alloc_private() is a + * convenient macro defined in comedidev.h. + */ + ret = alloc_private(dev, sizeof(struct pc236_private)); + if (ret < 0) { + printk(KERN_ERR "comedi%d: error! out of memory!\n", + dev->minor); + return ret; + } + /* Process options. */ + switch (thisboard->bustype) { +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) + case isa_bustype: + iobase = it->options[0]; + irq = it->options[1]; + share_irq = 0; + break; +#endif +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) + case pci_bustype: + bus = it->options[0]; + slot = it->options[1]; + share_irq = 1; + + ret = pc236_find_pci(dev, bus, slot, &pci_dev); + if (ret < 0) + return ret; + devpriv->pci_dev = pci_dev; + break; +#endif + default: + printk(KERN_ERR + "comedi%d: %s: BUG! cannot determine board type!\n", + dev->minor, PC236_DRIVER_NAME); + return -EINVAL; + break; + } + +/* + * Initialize dev->board_name. + */ + dev->board_name = thisboard->name; + + /* Enable device and reserve I/O spaces. */ +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) + if (pci_dev) { + + ret = comedi_pci_enable(pci_dev, PC236_DRIVER_NAME); + if (ret < 0) { + printk(KERN_ERR + "comedi%d: error! cannot enable PCI device and request regions!\n", + dev->minor); + return ret; + } + devpriv->lcr_iobase = pci_resource_start(pci_dev, 1); + iobase = pci_resource_start(pci_dev, 2); + irq = pci_dev->irq; + } else +#endif + { +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) + ret = pc236_request_region(dev->minor, iobase, PC236_IO_SIZE); + if (ret < 0) + return ret; +#endif + } + dev->iobase = iobase; + +/* + * Allocate the subdevice structures. alloc_subdevice() is a + * convenient macro defined in comedidev.h. + */ + ret = alloc_subdevices(dev, 2); + if (ret < 0) { + printk(KERN_ERR "comedi%d: error! out of memory!\n", + dev->minor); + return ret; + } + + s = dev->subdevices + 0; + /* digital i/o subdevice (8255) */ + ret = subdev_8255_init(dev, s, NULL, iobase); + if (ret < 0) { + printk(KERN_ERR "comedi%d: error! out of memory!\n", + dev->minor); + return ret; + } + s = dev->subdevices + 1; + dev->read_subdev = s; + s->type = COMEDI_SUBD_UNUSED; + pc236_intr_disable(dev); + if (irq) { + unsigned long flags = share_irq ? IRQF_SHARED : 0; + + if (request_irq(irq, pc236_interrupt, flags, + PC236_DRIVER_NAME, dev) >= 0) { + dev->irq = irq; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE | SDF_CMD_READ; + s->n_chan = 1; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pc236_intr_insn; + s->do_cmdtest = pc236_intr_cmdtest; + s->do_cmd = pc236_intr_cmd; + s->cancel = pc236_intr_cancel; + } + } + printk(KERN_INFO "comedi%d: %s ", dev->minor, dev->board_name); + switch (thisboard->bustype) { +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) + case isa_bustype: + printk("(base %#lx) ", iobase); + break; +#endif +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) + case pci_bustype: + printk("(pci %s) ", pci_name(pci_dev)); + break; +#endif + default: + break; + } + if (irq) + printk("(irq %u%s) ", irq, (dev->irq ? "" : " UNAVAILABLE")); + else + printk("(no irq) "); + + printk("attached\n"); + + return 1; +} + +static void pc236_detach(struct comedi_device *dev) +{ + if (devpriv) + pc236_intr_disable(dev); + if (dev->irq) + free_irq(dev->irq, dev); + if (dev->subdevices) + subdev_8255_cleanup(dev, dev->subdevices + 0); + if (devpriv) { +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) + if (devpriv->pci_dev) { + if (dev->iobase) + comedi_pci_disable(devpriv->pci_dev); + pci_dev_put(devpriv->pci_dev); + } else +#endif + { +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) + if (dev->iobase) + release_region(dev->iobase, PC236_IO_SIZE); +#endif + } + } +} + +/* + * The struct comedi_driver structure tells the Comedi core module + * which functions to call to configure/deconfigure (attach/detach) + * the board, and also about the kernel module that contains + * the device code. + */ +static struct comedi_driver amplc_pc236_driver = { + .driver_name = PC236_DRIVER_NAME, + .module = THIS_MODULE, + .attach = pc236_attach, + .detach = pc236_detach, + .board_name = &pc236_boards[0].name, + .offset = sizeof(struct pc236_board), + .num_names = ARRAY_SIZE(pc236_boards), +}; + +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) +static DEFINE_PCI_DEVICE_TABLE(pc236_pci_table) = { + { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI236) }, + {0} +}; + +MODULE_DEVICE_TABLE(pci, pc236_pci_table); + +static int __devinit amplc_pc236_pci_probe(struct pci_dev *dev, + const struct pci_device_id *ent) +{ + return comedi_pci_auto_config(dev, &lc_pc236_driver); +} + +static void __devexit amplc_pc236_pci_remove(struct pci_dev *dev) +{ + comedi_pci_auto_unconfig(dev); +} + +static struct pci_driver amplc_pc236_pci_driver = { + .name = PC236_DRIVER_NAME, + .id_table = pc236_pci_table, + .probe = &lc_pc236_pci_probe, + .remove = __devexit_p(&lc_pc236_pci_remove) +}; + +module_comedi_pci_driver(amplc_pc236_driver, amplc_pc236_pci_driver); +#else +module_comedi_driver(amplc_pc236_driver); +#endif + MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_DESCRIPTION("Comedi low-level driver"); MODULE_LICENSE("GPL"); -- cgit v0.10.2 From 62bc23d145d636f0de2bf412dcf31a33fcf16046 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 29 May 2012 14:49:31 +0100 Subject: staging: comedi: amplc_pc236: Replace printk calls Replace the printk calls with dev_info, dev_err, etc. There were some consecutive printk calls without newlines which now scnprintf into a temporary buffer and this bit of code has been factored out into new function pc236_report_attach(). Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c index 007b45b..b56881c 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236.c +++ b/drivers/staging/comedi/drivers/amplc_pc236.c @@ -201,12 +201,12 @@ pc236_find_pci(struct comedi_device *dev, int bus, int slot, } /* No match found. */ if (bus || slot) { - printk(KERN_ERR - "comedi%d: error! no %s found at pci %02x:%02x!\n", - dev->minor, thisboard->name, bus, slot); + dev_err(dev->class_dev, + "error! no %s found at pci %02x:%02x!\n", + thisboard->name, bus, slot); } else { - printk(KERN_ERR "comedi%d: error! no %s found!\n", - dev->minor, thisboard->name); + dev_err(dev->class_dev, "error! no %s found!\n", + thisboard->name); } return -EIO; } @@ -217,12 +217,12 @@ pc236_find_pci(struct comedi_device *dev, int bus, int slot, * if there is a conflict. */ #if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) -static int pc236_request_region(unsigned minor, unsigned long from, +static int pc236_request_region(struct comedi_device *dev, unsigned long from, unsigned long extent) { if (!from || !request_region(from, extent, PC236_DRIVER_NAME)) { - printk(KERN_ERR "comedi%d: I/O port conflict (%#lx,%lu)!\n", - minor, from, extent); + dev_err(dev->class_dev, "I/O port conflict (%#lx,%lu)!\n", + from, extent); return -EIO; } return 0; @@ -431,6 +431,39 @@ static irqreturn_t pc236_interrupt(int irq, void *d) return IRQ_RETVAL(handled); } +static void pc236_report_attach(struct comedi_device *dev, unsigned int irq) +{ + char tmpbuf[60]; + int tmplen; + + switch (thisboard->bustype) { +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) + case isa_bustype: + tmplen = scnprintf(tmpbuf, sizeof(tmpbuf), + "(base %#lx) ", dev->iobase); + break; +#endif +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) + case pci_bustype: + tmplen = scnprintf(tmpbuf, sizeof(tmpbuf), + "(pci %s) ", pci_name(devpriv->pci_dev)); + break; +#endif + default: + tmplen = 0; + break; + } + if (irq) + tmplen += scnprintf(&tmpbuf[tmplen], sizeof(tmpbuf) - tmplen, + "(irq %u%s) ", irq, + (dev->irq ? "" : " UNAVAILABLE")); + else + tmplen += scnprintf(&tmpbuf[tmplen], sizeof(tmpbuf) - tmplen, + "(no irq) "); + dev_info(dev->class_dev, "%s %sattached\n", + dev->board_name, tmpbuf); +} + /* * Attach is called by the Comedi core to configure the driver * for a particular board. If you specified a board_name array @@ -449,16 +482,10 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) int share_irq = 0; int ret; - printk(KERN_DEBUG "comedi%d: %s: attach\n", dev->minor, - PC236_DRIVER_NAME); -/* - * Allocate the private structure area. alloc_private() is a - * convenient macro defined in comedidev.h. - */ + dev_info(dev->class_dev, PC236_DRIVER_NAME ": attach\n"); ret = alloc_private(dev, sizeof(struct pc236_private)); if (ret < 0) { - printk(KERN_ERR "comedi%d: error! out of memory!\n", - dev->minor); + dev_err(dev->class_dev, "error! out of memory!\n"); return ret; } /* Process options. */ @@ -483,16 +510,13 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) break; #endif default: - printk(KERN_ERR - "comedi%d: %s: BUG! cannot determine board type!\n", - dev->minor, PC236_DRIVER_NAME); + dev_err(dev->class_dev, PC236_DRIVER_NAME + ": BUG! cannot determine board type!\n"); return -EINVAL; break; } -/* - * Initialize dev->board_name. - */ + /* Initialize dev->board_name. */ dev->board_name = thisboard->name; /* Enable device and reserve I/O spaces. */ @@ -501,9 +525,8 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) ret = comedi_pci_enable(pci_dev, PC236_DRIVER_NAME); if (ret < 0) { - printk(KERN_ERR - "comedi%d: error! cannot enable PCI device and request regions!\n", - dev->minor); + dev_err(dev->class_dev, + "error! cannot enable PCI device and request regions!\n"); return ret; } devpriv->lcr_iobase = pci_resource_start(pci_dev, 1); @@ -513,21 +536,16 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) #endif { #if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) - ret = pc236_request_region(dev->minor, iobase, PC236_IO_SIZE); + ret = pc236_request_region(dev, iobase, PC236_IO_SIZE); if (ret < 0) return ret; #endif } dev->iobase = iobase; -/* - * Allocate the subdevice structures. alloc_subdevice() is a - * convenient macro defined in comedidev.h. - */ ret = alloc_subdevices(dev, 2); if (ret < 0) { - printk(KERN_ERR "comedi%d: error! out of memory!\n", - dev->minor); + dev_err(dev->class_dev, "error! out of memory!\n"); return ret; } @@ -535,8 +553,7 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* digital i/o subdevice (8255) */ ret = subdev_8255_init(dev, s, NULL, iobase); if (ret < 0) { - printk(KERN_ERR "comedi%d: error! out of memory!\n", - dev->minor); + dev_err(dev->class_dev, "error! out of memory!\n"); return ret; } s = dev->subdevices + 1; @@ -560,28 +577,7 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->cancel = pc236_intr_cancel; } } - printk(KERN_INFO "comedi%d: %s ", dev->minor, dev->board_name); - switch (thisboard->bustype) { -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) - case isa_bustype: - printk("(base %#lx) ", iobase); - break; -#endif -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) - case pci_bustype: - printk("(pci %s) ", pci_name(pci_dev)); - break; -#endif - default: - break; - } - if (irq) - printk("(irq %u%s) ", irq, (dev->irq ? "" : " UNAVAILABLE")); - else - printk("(no irq) "); - - printk("attached\n"); - + pc236_report_attach(dev, irq); return 1; } -- cgit v0.10.2 From 916d7028a91a6a0e4b76e7cfb97819f294cbd803 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 29 May 2012 14:49:32 +0100 Subject: staging: comedi: amplc_pc236: Remove unused fancy_name Remove fancy_name member from struct pc236_board. It is initialized in pc235_boards[] but not used anywhere else. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c index b56881c..7926569 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236.c +++ b/drivers/staging/comedi/drivers/amplc_pc236.c @@ -98,7 +98,6 @@ enum pc236_model { pc36at_model, pci236_model, anypci_model }; struct pc236_board { const char *name; - const char *fancy_name; unsigned short devid; enum pc236_bustype bustype; enum pc236_model model; @@ -106,27 +105,24 @@ struct pc236_board { static const struct pc236_board pc236_boards[] = { #if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) { - .name = "pc36at", - .fancy_name = "PC36AT", - .bustype = isa_bustype, - .model = pc36at_model, - }, + .name = "pc36at", + .bustype = isa_bustype, + .model = pc36at_model, + }, #endif #if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) { - .name = "pci236", - .fancy_name = "PCI236", - .devid = PCI_DEVICE_ID_AMPLICON_PCI236, - .bustype = pci_bustype, - .model = pci236_model, - }, + .name = "pci236", + .devid = PCI_DEVICE_ID_AMPLICON_PCI236, + .bustype = pci_bustype, + .model = pci236_model, + }, { - .name = PC236_DRIVER_NAME, - .fancy_name = PC236_DRIVER_NAME, - .devid = PCI_DEVICE_ID_INVALID, - .bustype = pci_bustype, - .model = anypci_model, /* wildcard */ - }, + .name = PC236_DRIVER_NAME, + .devid = PCI_DEVICE_ID_INVALID, + .bustype = pci_bustype, + .model = anypci_model, /* wildcard */ + }, #endif }; -- cgit v0.10.2 From 273ba547da12406d609795bc8976cb2464b15d82 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 29 May 2012 14:49:33 +0100 Subject: staging: comedi: amplc_pc236: Change return type of pc236_find_pci() pc236_find_pci() finds a supported PCI device, returning 0 on success or -EIO on failure and returning the pointer to the PCI device via a struct pci_dev ** parameter. Change it to return the struct pci_dev * on success or NULL on failure. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c index 7926569..a94ac0e 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236.c +++ b/drivers/staging/comedi/drivers/amplc_pc236.c @@ -151,14 +151,11 @@ struct pc236_private { * bus and slot. */ #if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) -static int -pc236_find_pci(struct comedi_device *dev, int bus, int slot, - struct pci_dev **pci_dev_p) +struct pci_dev * +pc236_find_pci(struct comedi_device *dev, int bus, int slot) { struct pci_dev *pci_dev = NULL; - *pci_dev_p = NULL; - /* Look for matching PCI device. */ for (pci_dev = pci_get_device(PCI_VENDOR_ID_AMPLICON, PCI_ANY_ID, NULL); pci_dev != NULL; @@ -192,8 +189,7 @@ pc236_find_pci(struct comedi_device *dev, int bus, int slot, } /* Found a match. */ - *pci_dev_p = pci_dev; - return 0; + return pci_dev; } /* No match found. */ if (bus || slot) { @@ -204,7 +200,7 @@ pc236_find_pci(struct comedi_device *dev, int bus, int slot, dev_err(dev->class_dev, "error! no %s found!\n", thisboard->name); } - return -EIO; + return NULL; } #endif @@ -499,9 +495,9 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) slot = it->options[1]; share_irq = 1; - ret = pc236_find_pci(dev, bus, slot, &pci_dev); - if (ret < 0) - return ret; + pci_dev = pc236_find_pci(dev, bus, slot); + if (pci_dev == NULL) + return -EIO; devpriv->pci_dev = pci_dev; break; #endif -- cgit v0.10.2 From 24ffe74c93ac93bae84b2e44b868bbfd2c7954c3 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 29 May 2012 14:49:34 +0100 Subject: staging: comedi: amplc_pc236: Remove thisboard and devpriv macros The 'thisboard' and 'devpriv' macros rely on a local variable having a specific name and yield pointers derived from that local variable. Replace the macros with local variables wherever they occur. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c index a94ac0e..d52c728 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236.c +++ b/drivers/staging/comedi/drivers/amplc_pc236.c @@ -126,11 +126,6 @@ static const struct pc236_board pc236_boards[] = { #endif }; -/* - * Useful for shorthand access to the particular board structure - */ -#define thisboard ((const struct pc236_board *)dev->board_ptr) - /* this structure is for data unique to this hardware driver. If several hardware drivers keep similar information in this structure, feel free to suggest moving the variable to the struct comedi_device struct. @@ -144,8 +139,6 @@ struct pc236_private { int enable_irq; }; -#define devpriv ((struct pc236_private *)dev->private) - /* * This function looks for a PCI device matching the requested board name, * bus and slot. @@ -154,6 +147,7 @@ struct pc236_private { struct pci_dev * pc236_find_pci(struct comedi_device *dev, int bus, int slot) { + const struct pc236_board *thisboard = comedi_board(dev); struct pci_dev *pci_dev = NULL; /* Look for matching PCI device. */ @@ -177,6 +171,7 @@ pc236_find_pci(struct comedi_device *dev, int bus, int slot) if (pci_dev->device == pc236_boards[i].devid) { /* Change board_ptr to matched board. */ dev->board_ptr = &pc236_boards[i]; + thisboard = comedi_board(dev); break; } } @@ -228,6 +223,7 @@ static int pc236_request_region(struct comedi_device *dev, unsigned long from, */ static void pc236_intr_disable(struct comedi_device *dev) { + struct pc236_private *devpriv = dev->private; unsigned long flags; spin_lock_irqsave(&dev->spinlock, flags); @@ -246,6 +242,7 @@ static void pc236_intr_disable(struct comedi_device *dev) */ static void pc236_intr_enable(struct comedi_device *dev) { + struct pc236_private *devpriv = dev->private; unsigned long flags; spin_lock_irqsave(&dev->spinlock, flags); @@ -266,6 +263,7 @@ static void pc236_intr_enable(struct comedi_device *dev) */ static int pc236_intr_check(struct comedi_device *dev) { + struct pc236_private *devpriv = dev->private; int retval = 0; unsigned long flags; @@ -425,6 +423,7 @@ static irqreturn_t pc236_interrupt(int irq, void *d) static void pc236_report_attach(struct comedi_device *dev, unsigned int irq) { + const struct pc236_board *thisboard = comedi_board(dev); char tmpbuf[60]; int tmplen; @@ -436,9 +435,12 @@ static void pc236_report_attach(struct comedi_device *dev, unsigned int irq) break; #endif #if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) - case pci_bustype: - tmplen = scnprintf(tmpbuf, sizeof(tmpbuf), - "(pci %s) ", pci_name(devpriv->pci_dev)); + case pci_bustype: { + struct pc236_private *devpriv = dev->private; + struct pci_dev *pci_dev = devpriv->pci_dev; + tmplen = scnprintf(tmpbuf, sizeof(tmpbuf), + "(pci %s) ", pci_name(pci_dev)); + } break; #endif default: @@ -464,10 +466,12 @@ static void pc236_report_attach(struct comedi_device *dev, unsigned int irq) */ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct pc236_board *thisboard = comedi_board(dev); struct comedi_subdevice *s; unsigned long iobase = 0; unsigned int irq = 0; #if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) + struct pc236_private *devpriv = dev->private; struct pci_dev *pci_dev = NULL; int bus = 0, slot = 0; #endif @@ -498,6 +502,7 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) pci_dev = pc236_find_pci(dev, bus, slot); if (pci_dev == NULL) return -EIO; + thisboard = comedi_board(dev); /* replaced wildcard board */ devpriv->pci_dev = pci_dev; break; #endif @@ -575,6 +580,8 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) static void pc236_detach(struct comedi_device *dev) { + struct pc236_private *devpriv = dev->private; + if (devpriv) pc236_intr_disable(dev); if (dev->irq) -- cgit v0.10.2 From 18e41de083075b3b6a0bd55e00f1662d045efb49 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 29 May 2012 14:49:35 +0100 Subject: staging: comedi: amplc_pc236: Add attach_pci() hook Implement the attach_pci() hook as function pc236_attach_pci(). This is called bu comedi_pci_auto_config() in preference to the old attach() hook (implemented by pc236_attach()) and avoids searching for the probed PCI device. Factor out code common to pc236_find_pci() and pc236_attach_pci() into new function pc236_find_pci_board(). Factor out most code common to pc236_attach() and pc236_attach_pci() into new functions pc236_pci_common_attach() and pc236_common_attach(). Also #if out member 'devid' from struct pc236_board unless PCI boards are supported as it is not used for ISA boards. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c index d52c728..f119906 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236.c +++ b/drivers/staging/comedi/drivers/amplc_pc236.c @@ -98,7 +98,9 @@ enum pc236_model { pc36at_model, pci236_model, anypci_model }; struct pc236_board { const char *name; +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) unsigned short devid; +#endif enum pc236_bustype bustype; enum pc236_model model; }; @@ -140,6 +142,22 @@ struct pc236_private { }; /* + * This function looks for a board matching the supplied PCI device. + */ +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) +static const struct pc236_board *pc236_find_pci_board(struct pci_dev *pci_dev) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(pc236_boards); i++) + if (pc236_boards[i].bustype == pci_bustype && + pci_dev->device == pc236_boards[i].devid) + return &pc236_boards[i]; + return NULL; +} +#endif + +/* * This function looks for a PCI device matching the requested board name, * bus and slot. */ @@ -162,21 +180,13 @@ pc236_find_pci(struct comedi_device *dev, int bus, int slot) continue; } if (thisboard->model == anypci_model) { - /* Match any supported model. */ - int i; - - for (i = 0; i < ARRAY_SIZE(pc236_boards); i++) { - if (pc236_boards[i].bustype != pci_bustype) - continue; - if (pci_dev->device == pc236_boards[i].devid) { - /* Change board_ptr to matched board. */ - dev->board_ptr = &pc236_boards[i]; - thisboard = comedi_board(dev); - break; - } - } - if (i == ARRAY_SIZE(pc236_boards)) + /* Wildcard board matches any supported PCI board. */ + const struct pc236_board *foundboard; + foundboard = pc236_find_pci_board(pci_dev); + if (foundboard == NULL) continue; + /* Replace wildcard board_ptr. */ + dev->board_ptr = thisboard = foundboard; } else { /* Match specific model name. */ if (pci_dev->device != thisboard->devid) @@ -458,86 +468,14 @@ static void pc236_report_attach(struct comedi_device *dev, unsigned int irq) dev->board_name, tmpbuf); } -/* - * Attach is called by the Comedi core to configure the driver - * for a particular board. If you specified a board_name array - * in the driver structure, dev->board_ptr contains that - * address. - */ -static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) +static int pc236_common_attach(struct comedi_device *dev, unsigned long iobase, + unsigned int irq, unsigned long req_irq_flags) { const struct pc236_board *thisboard = comedi_board(dev); struct comedi_subdevice *s; - unsigned long iobase = 0; - unsigned int irq = 0; -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) - struct pc236_private *devpriv = dev->private; - struct pci_dev *pci_dev = NULL; - int bus = 0, slot = 0; -#endif - int share_irq = 0; int ret; - dev_info(dev->class_dev, PC236_DRIVER_NAME ": attach\n"); - ret = alloc_private(dev, sizeof(struct pc236_private)); - if (ret < 0) { - dev_err(dev->class_dev, "error! out of memory!\n"); - return ret; - } - /* Process options. */ - switch (thisboard->bustype) { -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) - case isa_bustype: - iobase = it->options[0]; - irq = it->options[1]; - share_irq = 0; - break; -#endif -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) - case pci_bustype: - bus = it->options[0]; - slot = it->options[1]; - share_irq = 1; - - pci_dev = pc236_find_pci(dev, bus, slot); - if (pci_dev == NULL) - return -EIO; - thisboard = comedi_board(dev); /* replaced wildcard board */ - devpriv->pci_dev = pci_dev; - break; -#endif - default: - dev_err(dev->class_dev, PC236_DRIVER_NAME - ": BUG! cannot determine board type!\n"); - return -EINVAL; - break; - } - - /* Initialize dev->board_name. */ dev->board_name = thisboard->name; - - /* Enable device and reserve I/O spaces. */ -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) - if (pci_dev) { - - ret = comedi_pci_enable(pci_dev, PC236_DRIVER_NAME); - if (ret < 0) { - dev_err(dev->class_dev, - "error! cannot enable PCI device and request regions!\n"); - return ret; - } - devpriv->lcr_iobase = pci_resource_start(pci_dev, 1); - iobase = pci_resource_start(pci_dev, 2); - irq = pci_dev->irq; - } else -#endif - { -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) - ret = pc236_request_region(dev, iobase, PC236_IO_SIZE); - if (ret < 0) - return ret; -#endif - } dev->iobase = iobase; ret = alloc_subdevices(dev, 2); @@ -558,9 +496,7 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->type = COMEDI_SUBD_UNUSED; pc236_intr_disable(dev); if (irq) { - unsigned long flags = share_irq ? IRQF_SHARED : 0; - - if (request_irq(irq, pc236_interrupt, flags, + if (request_irq(irq, pc236_interrupt, req_irq_flags, PC236_DRIVER_NAME, dev) >= 0) { dev->irq = irq; s->type = COMEDI_SUBD_DI; @@ -578,6 +514,105 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) return 1; } +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) +static int pc236_pci_common_attach(struct comedi_device *dev, + struct pci_dev *pci_dev) +{ + struct pc236_private *devpriv = dev->private; + unsigned long iobase; + int ret; + + devpriv->pci_dev = pci_dev; + ret = comedi_pci_enable(pci_dev, PC236_DRIVER_NAME); + if (ret < 0) { + dev_err(dev->class_dev, + "error! cannot enable PCI device and request regions!\n"); + return ret; + } + devpriv->lcr_iobase = pci_resource_start(pci_dev, 1); + iobase = pci_resource_start(pci_dev, 2); + return pc236_common_attach(dev, iobase, pci_dev->irq, IRQF_SHARED); +} +#endif + +/* + * Attach is called by the Comedi core to configure the driver + * for a particular board. If you specified a board_name array + * in the driver structure, dev->board_ptr contains that + * address. + */ +static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) +{ + const struct pc236_board *thisboard = comedi_board(dev); + int ret; + + dev_info(dev->class_dev, PC236_DRIVER_NAME ": attach\n"); + ret = alloc_private(dev, sizeof(struct pc236_private)); + if (ret < 0) { + dev_err(dev->class_dev, "error! out of memory!\n"); + return ret; + } + /* Process options according to bus type. */ + switch (thisboard->bustype) { +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) + case isa_bustype: { + unsigned long iobase = it->options[0]; + unsigned int irq = it->options[1]; + ret = pc236_request_region(dev, iobase, PC236_IO_SIZE); + if (ret < 0) + return ret; + return pc236_common_attach(dev, iobase, irq, 0); + } + break; +#endif +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) + case pci_bustype: { + int bus = it->options[0]; + int slot = it->options[1]; + struct pci_dev *pci_dev; + + pci_dev = pc236_find_pci(dev, bus, slot); + if (pci_dev == NULL) + return -EIO; + return pc236_pci_common_attach(dev, pci_dev); + } + break; +#endif + default: + dev_err(dev->class_dev, PC236_DRIVER_NAME + ": BUG! cannot determine board type!\n"); + break; + } + return -EINVAL; +} + +/* + * The attach_pci hook (if non-NULL) is called at PCI probe time in preference + * to the "manual" attach hook. dev->board_ptr is NULL on entry. There should + * be a board entry matching the supplied PCI device. + */ +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) +static int __devinit pc236_attach_pci(struct comedi_device *dev, + struct pci_dev *pci_dev) +{ + int ret; + + dev_info(dev->class_dev, PC236_DRIVER_NAME ": attach pci %s\n", + pci_name(pci_dev)); + ret = alloc_private(dev, sizeof(struct pc236_private)); + if (ret < 0) { + dev_err(dev->class_dev, "error! out of memory!\n"); + return ret; + } + dev->board_ptr = pc236_find_pci_board(pci_dev); + if (dev->board_ptr == NULL) { + dev_err(dev->class_dev, "BUG! cannot determine board type!\n"); + return -EINVAL; + } + return pc236_pci_common_attach(dev, pci_dev); +} +#endif + static void pc236_detach(struct comedi_device *dev) { struct pc236_private *devpriv = dev->private; @@ -615,6 +650,9 @@ static struct comedi_driver amplc_pc236_driver = { .driver_name = PC236_DRIVER_NAME, .module = THIS_MODULE, .attach = pc236_attach, +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) + .attach_pci = pc236_attach_pci, +#endif .detach = pc236_detach, .board_name = &pc236_boards[0].name, .offset = sizeof(struct pc236_board), -- cgit v0.10.2 From a46e759fc05a048530da43f241c8f07e0624232c Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 30 May 2012 14:37:52 +0100 Subject: staging: comedi: amplc_pc236: Remove most #if lines Remove most of the #if IS_ENABLED(xxx) lines, but add extra if (IS_ENABLED(xxx)) tests so the compiler can remove unreachable code. The pci_driver stuff and device table is still conditionally compiled. Also made pc236_find_pci() static as it was accidentally made non-static by an earlier patch, so the compiler wouldn't remove it when it was unreachable. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c index f119906..9cf514e 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236.c +++ b/drivers/staging/comedi/drivers/amplc_pc236.c @@ -98,9 +98,7 @@ enum pc236_model { pc36at_model, pci236_model, anypci_model }; struct pc236_board { const char *name; -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) unsigned short devid; -#endif enum pc236_bustype bustype; enum pc236_model model; }; @@ -133,18 +131,15 @@ static const struct pc236_board pc236_boards[] = { feel free to suggest moving the variable to the struct comedi_device struct. */ struct pc236_private { -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) /* PCI device */ struct pci_dev *pci_dev; unsigned long lcr_iobase; /* PLX PCI9052 config registers in PCIBAR1 */ -#endif int enable_irq; }; /* * This function looks for a board matching the supplied PCI device. */ -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) static const struct pc236_board *pc236_find_pci_board(struct pci_dev *pci_dev) { unsigned int i; @@ -155,14 +150,12 @@ static const struct pc236_board *pc236_find_pci_board(struct pci_dev *pci_dev) return &pc236_boards[i]; return NULL; } -#endif /* * This function looks for a PCI device matching the requested board name, * bus and slot. */ -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) -struct pci_dev * +static struct pci_dev * pc236_find_pci(struct comedi_device *dev, int bus, int slot) { const struct pc236_board *thisboard = comedi_board(dev); @@ -207,13 +200,11 @@ pc236_find_pci(struct comedi_device *dev, int bus, int slot) } return NULL; } -#endif /* * This function checks and requests an I/O region, reporting an error * if there is a conflict. */ -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) static int pc236_request_region(struct comedi_device *dev, unsigned long from, unsigned long extent) { @@ -224,7 +215,6 @@ static int pc236_request_region(struct comedi_device *dev, unsigned long from, } return 0; } -#endif /* * This function is called to mark the interrupt as disabled (no command @@ -238,10 +228,8 @@ static void pc236_intr_disable(struct comedi_device *dev) spin_lock_irqsave(&dev->spinlock, flags); devpriv->enable_irq = 0; -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) - if (devpriv->lcr_iobase) + if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) && devpriv->lcr_iobase) outl(PCI236_INTR_DISABLE, devpriv->lcr_iobase + PLX9052_INTCSR); -#endif spin_unlock_irqrestore(&dev->spinlock, flags); } @@ -257,10 +245,8 @@ static void pc236_intr_enable(struct comedi_device *dev) spin_lock_irqsave(&dev->spinlock, flags); devpriv->enable_irq = 1; -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) - if (devpriv->lcr_iobase) + if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) && devpriv->lcr_iobase) outl(PCI236_INTR_ENABLE, devpriv->lcr_iobase + PLX9052_INTCSR); -#endif spin_unlock_irqrestore(&dev->spinlock, flags); } @@ -280,8 +266,8 @@ static int pc236_intr_check(struct comedi_device *dev) spin_lock_irqsave(&dev->spinlock, flags); if (devpriv->enable_irq) { retval = 1; -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) - if (devpriv->lcr_iobase) { + if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) && + devpriv->lcr_iobase) { if ((inl(devpriv->lcr_iobase + PLX9052_INTCSR) & PLX9052_INTCSR_LI1STAT_MASK) == PLX9052_INTCSR_LI1STAT_INACTIVE) { @@ -292,7 +278,6 @@ static int pc236_intr_check(struct comedi_device *dev) devpriv->lcr_iobase + PLX9052_INTCSR); } } -#endif } spin_unlock_irqrestore(&dev->spinlock, flags); @@ -437,26 +422,18 @@ static void pc236_report_attach(struct comedi_device *dev, unsigned int irq) char tmpbuf[60]; int tmplen; - switch (thisboard->bustype) { -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) - case isa_bustype: + if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) && + thisboard->bustype == isa_bustype) tmplen = scnprintf(tmpbuf, sizeof(tmpbuf), "(base %#lx) ", dev->iobase); - break; -#endif -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) - case pci_bustype: { - struct pc236_private *devpriv = dev->private; - struct pci_dev *pci_dev = devpriv->pci_dev; - tmplen = scnprintf(tmpbuf, sizeof(tmpbuf), - "(pci %s) ", pci_name(pci_dev)); - } - break; -#endif - default: + else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) && + thisboard->bustype == pci_bustype) { + struct pc236_private *devpriv = dev->private; + struct pci_dev *pci_dev = devpriv->pci_dev; + tmplen = scnprintf(tmpbuf, sizeof(tmpbuf), + "(pci %s) ", pci_name(pci_dev)); + } else tmplen = 0; - break; - } if (irq) tmplen += scnprintf(&tmpbuf[tmplen], sizeof(tmpbuf) - tmplen, "(irq %u%s) ", irq, @@ -514,7 +491,6 @@ static int pc236_common_attach(struct comedi_device *dev, unsigned long iobase, return 1; } -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) static int pc236_pci_common_attach(struct comedi_device *dev, struct pci_dev *pci_dev) { @@ -533,7 +509,6 @@ static int pc236_pci_common_attach(struct comedi_device *dev, iobase = pci_resource_start(pci_dev, 2); return pc236_common_attach(dev, iobase, pci_dev->irq, IRQF_SHARED); } -#endif /* * Attach is called by the Comedi core to configure the driver @@ -553,37 +528,29 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) return ret; } /* Process options according to bus type. */ - switch (thisboard->bustype) { -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) - case isa_bustype: { - unsigned long iobase = it->options[0]; - unsigned int irq = it->options[1]; - ret = pc236_request_region(dev, iobase, PC236_IO_SIZE); - if (ret < 0) - return ret; - return pc236_common_attach(dev, iobase, irq, 0); - } - break; -#endif -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) - case pci_bustype: { - int bus = it->options[0]; - int slot = it->options[1]; - struct pci_dev *pci_dev; - - pci_dev = pc236_find_pci(dev, bus, slot); - if (pci_dev == NULL) - return -EIO; - return pc236_pci_common_attach(dev, pci_dev); - } - break; -#endif - default: + if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) && + thisboard->bustype == isa_bustype) { + unsigned long iobase = it->options[0]; + unsigned int irq = it->options[1]; + ret = pc236_request_region(dev, iobase, PC236_IO_SIZE); + if (ret < 0) + return ret; + return pc236_common_attach(dev, iobase, irq, 0); + } else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) && + thisboard->bustype == pci_bustype) { + int bus = it->options[0]; + int slot = it->options[1]; + struct pci_dev *pci_dev; + + pci_dev = pc236_find_pci(dev, bus, slot); + if (pci_dev == NULL) + return -EIO; + return pc236_pci_common_attach(dev, pci_dev); + } else { dev_err(dev->class_dev, PC236_DRIVER_NAME ": BUG! cannot determine board type!\n"); - break; + return -EINVAL; } - return -EINVAL; } /* @@ -591,12 +558,14 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) * to the "manual" attach hook. dev->board_ptr is NULL on entry. There should * be a board entry matching the supplied PCI device. */ -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) static int __devinit pc236_attach_pci(struct comedi_device *dev, struct pci_dev *pci_dev) { int ret; + if (!IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI)) + return -EINVAL; + dev_info(dev->class_dev, PC236_DRIVER_NAME ": attach pci %s\n", pci_name(pci_dev)); ret = alloc_private(dev, sizeof(struct pc236_private)); @@ -611,7 +580,6 @@ static int __devinit pc236_attach_pci(struct comedi_device *dev, } return pc236_pci_common_attach(dev, pci_dev); } -#endif static void pc236_detach(struct comedi_device *dev) { @@ -624,18 +592,14 @@ static void pc236_detach(struct comedi_device *dev) if (dev->subdevices) subdev_8255_cleanup(dev, dev->subdevices + 0); if (devpriv) { -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) - if (devpriv->pci_dev) { + if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) && + devpriv->pci_dev) { if (dev->iobase) comedi_pci_disable(devpriv->pci_dev); pci_dev_put(devpriv->pci_dev); - } else -#endif - { -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA) + } else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA)) { if (dev->iobase) release_region(dev->iobase, PC236_IO_SIZE); -#endif } } } @@ -650,9 +614,7 @@ static struct comedi_driver amplc_pc236_driver = { .driver_name = PC236_DRIVER_NAME, .module = THIS_MODULE, .attach = pc236_attach, -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) .attach_pci = pc236_attach_pci, -#endif .detach = pc236_detach, .board_name = &pc236_boards[0].name, .offset = sizeof(struct pc236_board), -- cgit v0.10.2 From 9f989000b54fe3131104bb26f1cc7bd0fab92e40 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 30 May 2012 19:04:35 +0100 Subject: staging: comedi: amplc_pc263: Correct initial state The initial state of the relays is being read incorrectly. It's reading a single 8-bit port twice, but should be reading two consecutive 8-bit ports. Fix it. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index 086579f..e2dbf74 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c @@ -330,8 +330,7 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* all outputs */ s->io_bits = 0xffff; /* read initial relay state */ - s->state = inb(dev->iobase); - s->state = s->state | (inb(dev->iobase) << 8); + s->state = inb(dev->iobase) | (inb(dev->iobase + 1) << 8); printk(KERN_INFO "comedi%d: %s ", dev->minor, dev->board_name); switch (thisboard->bustype) { -- cgit v0.10.2 From d35a73e099fd9900208ebdbc3adaba76d30acac4 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 30 May 2012 19:04:36 +0100 Subject: staging: comedi: amplc_pc263: Change DIO subdevice to DO This is a relay output card with no inputs. It's single subdevice is currently a digital input/output subdevice (COMEDI_SUBD_DIO). It should really be a digital output subdevice (COMEDI_SUBD_DO). Change the subdevice type and remove the insn_config() hook as it doesn't do anything useful. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index e2dbf74..a6a2543 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c @@ -154,12 +154,9 @@ static struct comedi_driver driver_amplc_pc263 = { static int pc263_request_region(unsigned minor, unsigned long from, unsigned long extent); #endif -static int pc263_dio_insn_bits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int pc263_dio_insn_config(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); +static int pc263_do_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data); /* * This function looks for a PCI device matching the requested board name, @@ -319,16 +316,13 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) } s = dev->subdevices + 0; - /* digital i/o subdevice */ - s->type = COMEDI_SUBD_DIO; + /* digital output subdevice */ + s->type = COMEDI_SUBD_DO; s->subdev_flags = SDF_READABLE | SDF_WRITABLE; s->n_chan = 16; s->maxdata = 1; s->range_table = &range_digital; - s->insn_bits = pc263_dio_insn_bits; - s->insn_config = pc263_dio_insn_config; - /* all outputs */ - s->io_bits = 0xffff; + s->insn_bits = pc263_do_insn_bits; /* read initial relay state */ s->state = inb(dev->iobase) | (inb(dev->iobase + 1) << 8); @@ -391,14 +385,9 @@ static int pc263_request_region(unsigned minor, unsigned long from, } #endif -/* DIO devices are slightly special. Although it is possible to - * implement the insn_read/insn_write interface, it is much more - * useful to applications if you implement the insn_bits interface. - * This allows packed reading/writing of the DIO channels. The - * comedi core can convert between insn_bits and insn_read/write */ -static int pc263_dio_insn_bits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int pc263_do_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { if (insn->n != 2) return -EINVAL; @@ -422,15 +411,6 @@ static int pc263_dio_insn_bits(struct comedi_device *dev, return 2; } -static int pc263_dio_insn_config(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) -{ - if (insn->n != 1) - return -EINVAL; - return 1; -} - /* * A convenient macro that defines init_module() and cleanup_module(), * as necessary. -- cgit v0.10.2 From 61f5a223155d278c9731f2406513847b8fe0bddc Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 30 May 2012 19:04:37 +0100 Subject: staging: comedi: amplc_pc263: Add a missing case There is a missing case label in the switch statement that prints out details of the attached device in pc263_attach(). Fix it. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index a6a2543..f38a56e 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c @@ -334,6 +334,7 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) break; #endif #ifdef CONFIG_COMEDI_AMPLC_PC263_PCI + case pci_bustype: printk("(pci %s) ", pci_name(pci_dev)); break; #endif -- cgit v0.10.2 From b4843c19be4cbae48dc002080bdf49c274f26796 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 30 May 2012 19:04:38 +0100 Subject: staging: comedi: amplc_pc263: Use IS_ENABLED() Change conditional compilation on kernel options to use the IS_ENABLED() macro. Remove most of the #ifdef lines and add extra if (IS_ENABLED(xxx)) tests so the compiler can remove unreachable code. The pci_driver stuff and device table is still conditionally compiled. In pc263_attach() move the call to alloc_private() as it is only used for PCI devices. (In pc263_detach(), for ISA devices a non-zero dev->iobase means the I/O region needs releasing.) Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index f38a56e..f33eb0d 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c @@ -48,14 +48,6 @@ The state of the outputs can be read. #define PC263_DRIVER_NAME "amplc_pc263" -#ifdef CONFIG_COMEDI_AMPLC_PC263_ISA_MODULE -#define CONFIG_COMEDI_AMPLC_PC263_ISA -#endif - -#ifdef CONFIG_COMEDI_AMPLC_PC263_PCI_MODULE -#define CONFIG_COMEDI_AMPLC_PC263_PCI -#endif - /* PCI263 PCI configuration register information */ #define PCI_VENDOR_ID_AMPLICON 0x14dc #define PCI_DEVICE_ID_AMPLICON_PCI263 0x000c @@ -79,33 +71,33 @@ struct pc263_board { enum pc263_model model; }; static const struct pc263_board pc263_boards[] = { -#ifdef CONFIG_COMEDI_AMPLC_PC263_ISA +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_ISA) { - .name = "pc263", - .fancy_name = "PC263", - .bustype = isa_bustype, - .model = pc263_model, - }, + .name = "pc263", + .fancy_name = "PC263", + .bustype = isa_bustype, + .model = pc263_model, + }, #endif -#ifdef CONFIG_COMEDI_AMPLC_PC263_PCI +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) { - .name = "pci263", - .fancy_name = "PCI263", - .devid = PCI_DEVICE_ID_AMPLICON_PCI263, - .bustype = pci_bustype, - .model = pci263_model, - }, + .name = "pci263", + .fancy_name = "PCI263", + .devid = PCI_DEVICE_ID_AMPLICON_PCI263, + .bustype = pci_bustype, + .model = pci263_model, + }, { - .name = PC263_DRIVER_NAME, - .fancy_name = PC263_DRIVER_NAME, - .devid = PCI_DEVICE_ID_INVALID, - .bustype = pci_bustype, - .model = anypci_model, /* wildcard */ - }, + .name = PC263_DRIVER_NAME, + .fancy_name = PC263_DRIVER_NAME, + .devid = PCI_DEVICE_ID_INVALID, + .bustype = pci_bustype, + .model = anypci_model, /* wildcard */ + }, #endif }; -#ifdef CONFIG_COMEDI_AMPLC_PC263_PCI +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) static DEFINE_PCI_DEVICE_TABLE(pc263_pci_table) = { { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI263) }, {0} @@ -123,14 +115,12 @@ MODULE_DEVICE_TABLE(pci, pc263_pci_table); several hardware drivers keep similar information in this structure, feel free to suggest moving the variable to the struct comedi_device struct. */ -#ifdef CONFIG_COMEDI_AMPLC_PC263_PCI struct pc263_private { /* PCI device. */ struct pci_dev *pci_dev; }; #define devpriv ((struct pc263_private *)dev->private) -#endif /* CONFIG_COMEDI_AMPLC_PC263_PCI */ /* * The struct comedi_driver structure tells the Comedi core module @@ -150,10 +140,8 @@ static struct comedi_driver driver_amplc_pc263 = { .num_names = ARRAY_SIZE(pc263_boards), }; -#ifdef CONFIG_COMEDI_AMPLC_PC263_ISA static int pc263_request_region(unsigned minor, unsigned long from, unsigned long extent); -#endif static int pc263_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); @@ -162,7 +150,6 @@ static int pc263_do_insn_bits(struct comedi_device *dev, * This function looks for a PCI device matching the requested board name, * bus and slot. */ -#ifdef CONFIG_COMEDI_AMPLC_PC263_PCI static int pc263_find_pci(struct comedi_device *dev, int bus, int slot, struct pci_dev **pci_dev_p) @@ -218,7 +205,6 @@ pc263_find_pci(struct comedi_device *dev, int bus, int slot, } return -EIO; } -#endif /* * Attach is called by the Comedi core to configure the driver @@ -230,60 +216,35 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; unsigned long iobase = 0; -#ifdef CONFIG_COMEDI_AMPLC_PC263_PCI - struct pci_dev *pci_dev = NULL; - int bus = 0, slot = 0; -#endif int ret; printk(KERN_DEBUG "comedi%d: %s: attach\n", dev->minor, PC263_DRIVER_NAME); -/* - * Allocate the private structure area. alloc_private() is a - * convenient macro defined in comedidev.h. - */ -#ifdef CONFIG_COMEDI_AMPLC_PC263_PCI - ret = alloc_private(dev, sizeof(struct pc263_private)); - if (ret < 0) { - printk(KERN_ERR "comedi%d: error! out of memory!\n", - dev->minor); - return ret; - } -#endif - /* Process options. */ - switch (thisboard->bustype) { -#ifdef CONFIG_COMEDI_AMPLC_PC263_ISA - case isa_bustype: + + /* Process options and reserve resources according to bus type. */ + if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_ISA) && + thisboard->bustype == isa_bustype) { iobase = it->options[0]; - break; -#endif -#ifdef CONFIG_COMEDI_AMPLC_PC263_PCI - case pci_bustype: + ret = pc263_request_region(dev->minor, iobase, PC263_IO_SIZE); + if (ret < 0) + return ret; + } else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) && + thisboard->bustype == pci_bustype) { + struct pci_dev *pci_dev = NULL; + int bus, slot; + + ret = alloc_private(dev, sizeof(struct pc263_private)); + if (ret < 0) { + printk(KERN_ERR "comedi%d: error! out of memory!\n", + dev->minor); + return ret; + } bus = it->options[0]; slot = it->options[1]; - ret = pc263_find_pci(dev, bus, slot, &pci_dev); if (ret < 0) return ret; devpriv->pci_dev = pci_dev; - break; -#endif - default: - printk(KERN_ERR - "comedi%d: %s: BUG! cannot determine board type!\n", - dev->minor, PC263_DRIVER_NAME); - return -EINVAL; - break; - } - -/* - * Initialize dev->board_name. - */ - dev->board_name = thisboard->name; - - /* Enable device and reserve I/O spaces. */ -#ifdef CONFIG_COMEDI_AMPLC_PC263_PCI - if (pci_dev) { ret = comedi_pci_enable(pci_dev, PC263_DRIVER_NAME); if (ret < 0) { printk(KERN_ERR @@ -293,21 +254,16 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) return ret; } iobase = pci_resource_start(pci_dev, 2); - } else -#endif - { -#ifdef CONFIG_COMEDI_AMPLC_PC263_ISA - ret = pc263_request_region(dev->minor, iobase, PC263_IO_SIZE); - if (ret < 0) - return ret; -#endif + } else { + printk(KERN_ERR + "comedi%d: %s: BUG! cannot determine board type!\n", + dev->minor, PC263_DRIVER_NAME); + return -EINVAL; } + + dev->board_name = thisboard->name; dev->iobase = iobase; -/* - * Allocate the subdevice structures. alloc_subdevice() is a - * convenient macro defined in comedidev.h. - */ ret = alloc_subdevices(dev, 1); if (ret < 0) { printk(KERN_ERR "comedi%d: error! out of memory!\n", @@ -327,20 +283,12 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->state = inb(dev->iobase) | (inb(dev->iobase + 1) << 8); printk(KERN_INFO "comedi%d: %s ", dev->minor, dev->board_name); - switch (thisboard->bustype) { -#ifdef CONFIG_COMEDI_AMPLC_PC263_ISA - case isa_bustype: + if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_ISA) && + thisboard->bustype == isa_bustype) printk("(base %#lx) ", iobase); - break; -#endif -#ifdef CONFIG_COMEDI_AMPLC_PC263_PCI - case pci_bustype: - printk("(pci %s) ", pci_name(pci_dev)); - break; -#endif - default: - break; - } + else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) && + thisboard->bustype == pci_bustype) + printk("(pci %s) ", pci_name(devpriv->pci_dev)); printk("attached\n"); @@ -349,23 +297,14 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) static void pc263_detach(struct comedi_device *dev) { -#ifdef CONFIG_COMEDI_AMPLC_PC263_PCI - if (devpriv) -#endif - { -#ifdef CONFIG_COMEDI_AMPLC_PC263_PCI - if (devpriv->pci_dev) { - if (dev->iobase) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); - } else -#endif - { -#ifdef CONFIG_COMEDI_AMPLC_PC263_ISA - if (dev->iobase) - release_region(dev->iobase, PC263_IO_SIZE); -#endif - } + if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) && devpriv && + devpriv->pci_dev) { + if (dev->iobase) + comedi_pci_disable(devpriv->pci_dev); + pci_dev_put(devpriv->pci_dev); + } else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_ISA)) { + if (dev->iobase) + release_region(dev->iobase, PC263_IO_SIZE); } } @@ -373,7 +312,6 @@ static void pc263_detach(struct comedi_device *dev) * This function checks and requests an I/O region, reporting an error * if there is a conflict. */ -#ifdef CONFIG_COMEDI_AMPLC_PC263_ISA static int pc263_request_region(unsigned minor, unsigned long from, unsigned long extent) { @@ -384,7 +322,6 @@ static int pc263_request_region(unsigned minor, unsigned long from, } return 0; } -#endif static int pc263_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, @@ -416,7 +353,7 @@ static int pc263_do_insn_bits(struct comedi_device *dev, * A convenient macro that defines init_module() and cleanup_module(), * as necessary. */ -#ifdef CONFIG_COMEDI_AMPLC_PC263_PCI +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) static int __devinit driver_amplc_pc263_pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) -- cgit v0.10.2 From 40372f5f66c4d123b8bd17b785fadecd19eb2bd1 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 30 May 2012 19:04:39 +0100 Subject: staging: comedi: amplc_pc263: Use module_comedi_{pci, }_driver() If PCI boards are supported, use the module_comedi_pci_driver() macro to register the module as a comedi driver and a PCI driver. Otherwise, only ISA boards are supported so use the module_comedi_driver() macro to register the module as a comedi driver. Renamed 'driver_amplc_pc263' to 'amplc_pc263_driver' and removed 'driver_' prefix from PCI related functions and variables, purely for aesthetic reasons. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index f33eb0d..f3cab35 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c @@ -130,7 +130,7 @@ struct pc263_private { */ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it); static void pc263_detach(struct comedi_device *dev); -static struct comedi_driver driver_amplc_pc263 = { +static struct comedi_driver amplc_pc263_driver = { .driver_name = PC263_DRIVER_NAME, .module = THIS_MODULE, .attach = pc263_attach, @@ -349,63 +349,28 @@ static int pc263_do_insn_bits(struct comedi_device *dev, return 2; } -/* - * A convenient macro that defines init_module() and cleanup_module(), - * as necessary. - */ #if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) -static int __devinit driver_amplc_pc263_pci_probe(struct pci_dev *dev, +static int __devinit amplc_pc263_pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) { - return comedi_pci_auto_config(dev, &driver_amplc_pc263); + return comedi_pci_auto_config(dev, &lc_pc263_driver); } -static void __devexit driver_amplc_pc263_pci_remove(struct pci_dev *dev) +static void __devexit amplc_pc263_pci_remove(struct pci_dev *dev) { comedi_pci_auto_unconfig(dev); } -static struct pci_driver driver_amplc_pc263_pci_driver = { +static struct pci_driver amplc_pc263_pci_driver = { + .name = PC263_DRIVER_NAME, .id_table = pc263_pci_table, - .probe = &driver_amplc_pc263_pci_probe, - .remove = __devexit_p(&driver_amplc_pc263_pci_remove) + .probe = &lc_pc263_pci_probe, + .remove = __devexit_p(&lc_pc263_pci_remove) }; - -static int __init driver_amplc_pc263_init_module(void) -{ - int retval; - - retval = comedi_driver_register(&driver_amplc_pc263); - if (retval < 0) - return retval; - - driver_amplc_pc263_pci_driver.name = - (char *)driver_amplc_pc263.driver_name; - return pci_register_driver(&driver_amplc_pc263_pci_driver); -} - -static void __exit driver_amplc_pc263_cleanup_module(void) -{ - pci_unregister_driver(&driver_amplc_pc263_pci_driver); - comedi_driver_unregister(&driver_amplc_pc263); -} - -module_init(driver_amplc_pc263_init_module); -module_exit(driver_amplc_pc263_cleanup_module); +module_comedi_pci_driver(amplc_pc263_driver, amplc_pc263_pci_driver); #else -static int __init driver_amplc_pc263_init_module(void) -{ - return comedi_driver_register(&driver_amplc_pc263); -} - -static void __exit driver_amplc_pc263_cleanup_module(void) -{ - comedi_driver_unregister(&driver_amplc_pc263); -} - -module_init(driver_amplc_pc263_init_module); -module_exit(driver_amplc_pc263_cleanup_module); +module_comedi_driver(amplc_pc263_driver); #endif MODULE_AUTHOR("Comedi http://www.comedi.org"); -- cgit v0.10.2 From ba7914cd133cff9ac73e3434ba6980f2ac97a362 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 30 May 2012 19:04:40 +0100 Subject: staging: comedi: amplc_pc263: Remove forward function declarations Moved some functions and variables to avoid forward declarations. Moved PCI table closer to the struct pci_driver that refers to it. Also removed some useless comments from pc263_attach(). Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index f3cab35..5d5d9a2 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c @@ -97,15 +97,6 @@ static const struct pc263_board pc263_boards[] = { #endif }; -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) -static DEFINE_PCI_DEVICE_TABLE(pc263_pci_table) = { - { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI263) }, - {0} -}; - -MODULE_DEVICE_TABLE(pci, pc263_pci_table); -#endif /* CONFIG_COMEDI_AMPLC_PC263_PCI */ - /* * Useful for shorthand access to the particular board structure */ @@ -123,30 +114,6 @@ struct pc263_private { #define devpriv ((struct pc263_private *)dev->private) /* - * The struct comedi_driver structure tells the Comedi core module - * which functions to call to configure/deconfigure (attach/detach) - * the board, and also about the kernel module that contains - * the device code. - */ -static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it); -static void pc263_detach(struct comedi_device *dev); -static struct comedi_driver amplc_pc263_driver = { - .driver_name = PC263_DRIVER_NAME, - .module = THIS_MODULE, - .attach = pc263_attach, - .detach = pc263_detach, - .board_name = &pc263_boards[0].name, - .offset = sizeof(struct pc263_board), - .num_names = ARRAY_SIZE(pc263_boards), -}; - -static int pc263_request_region(unsigned minor, unsigned long from, - unsigned long extent); -static int pc263_do_insn_bits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); - -/* * This function looks for a PCI device matching the requested board name, * bus and slot. */ @@ -205,6 +172,39 @@ pc263_find_pci(struct comedi_device *dev, int bus, int slot, } return -EIO; } +/* + * This function checks and requests an I/O region, reporting an error + * if there is a conflict. + */ +static int pc263_request_region(unsigned minor, unsigned long from, + unsigned long extent) +{ + if (!from || !request_region(from, extent, PC263_DRIVER_NAME)) { + printk(KERN_ERR "comedi%d: I/O port conflict (%#lx,%lu)!\n", + minor, from, extent); + return -EIO; + } + return 0; +} + +static int pc263_do_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) +{ + if (insn->n != 2) + return -EINVAL; + + /* The insn data is a mask in data[0] and the new data + * in data[1], each channel cooresponding to a bit. */ + if (data[0]) { + s->state &= ~data[0]; + s->state |= data[0] & data[1]; + /* Write out the new digital output lines */ + outb(s->state & 0xFF, dev->iobase); + outb(s->state >> 8, dev->iobase + 1); + } + return 2; +} /* * Attach is called by the Comedi core to configure the driver @@ -309,47 +309,28 @@ static void pc263_detach(struct comedi_device *dev) } /* - * This function checks and requests an I/O region, reporting an error - * if there is a conflict. + * The struct comedi_driver structure tells the Comedi core module + * which functions to call to configure/deconfigure (attach/detach) + * the board, and also about the kernel module that contains + * the device code. */ -static int pc263_request_region(unsigned minor, unsigned long from, - unsigned long extent) -{ - if (!from || !request_region(from, extent, PC263_DRIVER_NAME)) { - printk(KERN_ERR "comedi%d: I/O port conflict (%#lx,%lu)!\n", - minor, from, extent); - return -EIO; - } - return 0; -} - -static int pc263_do_insn_bits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) -{ - if (insn->n != 2) - return -EINVAL; - - /* The insn data is a mask in data[0] and the new data - * in data[1], each channel cooresponding to a bit. */ - if (data[0]) { - s->state &= ~data[0]; - s->state |= data[0] & data[1]; - /* Write out the new digital output lines */ - outb(s->state & 0xFF, dev->iobase); - outb(s->state >> 8, dev->iobase + 1); - } - - /* on return, data[1] contains the value of the digital - * input and output lines. */ - /* or we could just return the software copy of the output values if - * it was a purely digital output subdevice */ - data[1] = s->state; - - return 2; -} +static struct comedi_driver amplc_pc263_driver = { + .driver_name = PC263_DRIVER_NAME, + .module = THIS_MODULE, + .attach = pc263_attach, + .detach = pc263_detach, + .board_name = &pc263_boards[0].name, + .offset = sizeof(struct pc263_board), + .num_names = ARRAY_SIZE(pc263_boards), +}; #if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) +static DEFINE_PCI_DEVICE_TABLE(pc263_pci_table) = { + { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI263) }, + {0} +}; +MODULE_DEVICE_TABLE(pci, pc263_pci_table); + static int __devinit amplc_pc263_pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) -- cgit v0.10.2 From 03668b101362b031b74a7cde865fa7346b44eb30 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 30 May 2012 19:04:41 +0100 Subject: staging: comedi: amplc_pc263: Replace printk calls Replace the printk calls with dev_info, dev_err, etc. There were some consecutive printk calls without newlines which now snprintf into a temporary buffer and this bit of code has been factored out into new function pc263_report_attach(). Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index 5d5d9a2..b504c43 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c @@ -163,12 +163,12 @@ pc263_find_pci(struct comedi_device *dev, int bus, int slot, } /* No match found. */ if (bus || slot) { - printk(KERN_ERR - "comedi%d: error! no %s found at pci %02x:%02x!\n", - dev->minor, thisboard->name, bus, slot); + dev_err(dev->class_dev, + "error! no %s found at pci %02x:%02x!\n", + thisboard->name, bus, slot); } else { - printk(KERN_ERR "comedi%d: error! no %s found!\n", - dev->minor, thisboard->name); + dev_err(dev->class_dev, "error! no %s found!\n", + thisboard->name); } return -EIO; } @@ -176,12 +176,12 @@ pc263_find_pci(struct comedi_device *dev, int bus, int slot, * This function checks and requests an I/O region, reporting an error * if there is a conflict. */ -static int pc263_request_region(unsigned minor, unsigned long from, +static int pc263_request_region(struct comedi_device *dev, unsigned long from, unsigned long extent) { if (!from || !request_region(from, extent, PC263_DRIVER_NAME)) { - printk(KERN_ERR "comedi%d: I/O port conflict (%#lx,%lu)!\n", - minor, from, extent); + dev_err(dev->class_dev, "I/O port conflict (%#lx,%lu)!\n", + from, extent); return -EIO; } return 0; @@ -206,6 +206,22 @@ static int pc263_do_insn_bits(struct comedi_device *dev, return 2; } +static void pc263_report_attach(struct comedi_device *dev) +{ + char tmpbuf[40]; + + if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_ISA) && + thisboard->bustype == isa_bustype) + snprintf(tmpbuf, sizeof(tmpbuf), "(base %#lx) ", dev->iobase); + else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) && + thisboard->bustype == pci_bustype) + snprintf(tmpbuf, sizeof(tmpbuf), "(pci %s) ", + pci_name(devpriv->pci_dev)); + else + tmpbuf[0] = '\0'; + dev_info(dev->class_dev, "%s %sattached\n", dev->board_name, tmpbuf); +} + /* * Attach is called by the Comedi core to configure the driver * for a particular board. If you specified a board_name array @@ -218,14 +234,13 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) unsigned long iobase = 0; int ret; - printk(KERN_DEBUG "comedi%d: %s: attach\n", dev->minor, - PC263_DRIVER_NAME); + dev_info(dev->class_dev, PC263_DRIVER_NAME ": attach\n"); /* Process options and reserve resources according to bus type. */ if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_ISA) && thisboard->bustype == isa_bustype) { iobase = it->options[0]; - ret = pc263_request_region(dev->minor, iobase, PC263_IO_SIZE); + ret = pc263_request_region(dev, iobase, PC263_IO_SIZE); if (ret < 0) return ret; } else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) && @@ -235,8 +250,7 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) ret = alloc_private(dev, sizeof(struct pc263_private)); if (ret < 0) { - printk(KERN_ERR "comedi%d: error! out of memory!\n", - dev->minor); + dev_err(dev->class_dev, "error! out of memory!\n"); return ret; } bus = it->options[0]; @@ -247,17 +261,14 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->pci_dev = pci_dev; ret = comedi_pci_enable(pci_dev, PC263_DRIVER_NAME); if (ret < 0) { - printk(KERN_ERR - "comedi%d: error! cannot enable PCI device and " - "request regions!\n", - dev->minor); + dev_err(dev->class_dev, + "error! cannot enable PCI device and request regions!\n"); return ret; } iobase = pci_resource_start(pci_dev, 2); } else { - printk(KERN_ERR - "comedi%d: %s: BUG! cannot determine board type!\n", - dev->minor, PC263_DRIVER_NAME); + dev_err(dev->class_dev, PC263_DRIVER_NAME + ": BUG! cannot determine board type!\n"); return -EINVAL; } @@ -266,8 +277,7 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) ret = alloc_subdevices(dev, 1); if (ret < 0) { - printk(KERN_ERR "comedi%d: error! out of memory!\n", - dev->minor); + dev_err(dev->class_dev, "error! out of memory!\n"); return ret; } @@ -282,16 +292,7 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* read initial relay state */ s->state = inb(dev->iobase) | (inb(dev->iobase + 1) << 8); - printk(KERN_INFO "comedi%d: %s ", dev->minor, dev->board_name); - if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_ISA) && - thisboard->bustype == isa_bustype) - printk("(base %#lx) ", iobase); - else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) && - thisboard->bustype == pci_bustype) - printk("(pci %s) ", pci_name(devpriv->pci_dev)); - - printk("attached\n"); - + pc263_report_attach(dev); return 1; } -- cgit v0.10.2 From 6ac682520ec3318f0a43582f642c0444ad5e3314 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 30 May 2012 19:04:42 +0100 Subject: staging: comedi: amplc_pc263: Remove unused fancy_name Remove fancy_name member from struct pc263_board. It is initialized in pc263_boards[] but not used anywhere else. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index b504c43..9fa98c4 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c @@ -65,7 +65,6 @@ enum pc263_model { pc263_model, pci263_model, anypci_model }; struct pc263_board { const char *name; - const char *fancy_name; unsigned short devid; enum pc263_bustype bustype; enum pc263_model model; @@ -74,7 +73,6 @@ static const struct pc263_board pc263_boards[] = { #if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_ISA) { .name = "pc263", - .fancy_name = "PC263", .bustype = isa_bustype, .model = pc263_model, }, @@ -82,14 +80,12 @@ static const struct pc263_board pc263_boards[] = { #if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) { .name = "pci263", - .fancy_name = "PCI263", .devid = PCI_DEVICE_ID_AMPLICON_PCI263, .bustype = pci_bustype, .model = pci263_model, }, { .name = PC263_DRIVER_NAME, - .fancy_name = PC263_DRIVER_NAME, .devid = PCI_DEVICE_ID_INVALID, .bustype = pci_bustype, .model = anypci_model, /* wildcard */ -- cgit v0.10.2 From 7ac75ba4f364fb655c89b4f9ccf1cfbdf9dfd370 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 30 May 2012 19:04:43 +0100 Subject: staging: comedi: amplc_pc263: Change return type of pc263_find_pci() pc263_find_pci() finds a supported PCI device, returning 0 on success or -EIO on failure and returning the pointer to the PCI device via a struct pci_dev ** parameter. Change it to return the struct pci_dev * on success or NULL on failure. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index 9fa98c4..dd0b4b2 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c @@ -113,14 +113,11 @@ struct pc263_private { * This function looks for a PCI device matching the requested board name, * bus and slot. */ -static int -pc263_find_pci(struct comedi_device *dev, int bus, int slot, - struct pci_dev **pci_dev_p) +static struct pci_dev * +pc263_find_pci(struct comedi_device *dev, int bus, int slot) { struct pci_dev *pci_dev = NULL; - *pci_dev_p = NULL; - /* Look for matching PCI device. */ for (pci_dev = pci_get_device(PCI_VENDOR_ID_AMPLICON, PCI_ANY_ID, NULL); pci_dev != NULL; @@ -154,8 +151,7 @@ pc263_find_pci(struct comedi_device *dev, int bus, int slot, } /* Found a match. */ - *pci_dev_p = pci_dev; - return 0; + return pci_dev; } /* No match found. */ if (bus || slot) { @@ -166,7 +162,7 @@ pc263_find_pci(struct comedi_device *dev, int bus, int slot, dev_err(dev->class_dev, "error! no %s found!\n", thisboard->name); } - return -EIO; + return NULL; } /* * This function checks and requests an I/O region, reporting an error @@ -251,9 +247,9 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) } bus = it->options[0]; slot = it->options[1]; - ret = pc263_find_pci(dev, bus, slot, &pci_dev); - if (ret < 0) - return ret; + pci_dev = pc263_find_pci(dev, bus, slot); + if (pci_dev == NULL) + return -EIO; devpriv->pci_dev = pci_dev; ret = comedi_pci_enable(pci_dev, PC263_DRIVER_NAME); if (ret < 0) { -- cgit v0.10.2 From 04d66968b34e3e22a524064df387c9fe906c6efa Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 30 May 2012 19:04:44 +0100 Subject: staging: comedi: amplc_pc263: Remove thisboard and devpriv macros The 'thisboard' and 'devpriv' macros rely on a local variable having a specific name and yield pointers derived from that local variable. Replace the macros with local variables wherever they occur. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index dd0b4b2..62fc335 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c @@ -93,11 +93,6 @@ static const struct pc263_board pc263_boards[] = { #endif }; -/* - * Useful for shorthand access to the particular board structure - */ -#define thisboard ((const struct pc263_board *)dev->board_ptr) - /* this structure is for data unique to this hardware driver. If several hardware drivers keep similar information in this structure, feel free to suggest moving the variable to the struct comedi_device struct. @@ -107,8 +102,6 @@ struct pc263_private { struct pci_dev *pci_dev; }; -#define devpriv ((struct pc263_private *)dev->private) - /* * This function looks for a PCI device matching the requested board name, * bus and slot. @@ -116,6 +109,7 @@ struct pc263_private { static struct pci_dev * pc263_find_pci(struct comedi_device *dev, int bus, int slot) { + const struct pc263_board *thisboard = comedi_board(dev); struct pci_dev *pci_dev = NULL; /* Look for matching PCI device. */ @@ -139,6 +133,7 @@ pc263_find_pci(struct comedi_device *dev, int bus, int slot) if (pci_dev->device == pc263_boards[i].devid) { /* Change board_ptr to matched board. */ dev->board_ptr = &pc263_boards[i]; + thisboard = comedi_board(dev); break; } } @@ -200,6 +195,8 @@ static int pc263_do_insn_bits(struct comedi_device *dev, static void pc263_report_attach(struct comedi_device *dev) { + const struct pc263_board *thisboard = comedi_board(dev); + struct pc263_private *devpriv = dev->private; char tmpbuf[40]; if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_ISA) && @@ -222,6 +219,7 @@ static void pc263_report_attach(struct comedi_device *dev) */ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct pc263_board *thisboard = comedi_board(dev); struct comedi_subdevice *s; unsigned long iobase = 0; int ret; @@ -237,6 +235,7 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) return ret; } else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) && thisboard->bustype == pci_bustype) { + struct pc263_private *devpriv; struct pci_dev *pci_dev = NULL; int bus, slot; @@ -245,11 +244,13 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev_err(dev->class_dev, "error! out of memory!\n"); return ret; } + devpriv = dev->private; bus = it->options[0]; slot = it->options[1]; pci_dev = pc263_find_pci(dev, bus, slot); if (pci_dev == NULL) return -EIO; + thisboard = comedi_board(dev); /* replaced wildcard board */ devpriv->pci_dev = pci_dev; ret = comedi_pci_enable(pci_dev, PC263_DRIVER_NAME); if (ret < 0) { @@ -290,6 +291,8 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) static void pc263_detach(struct comedi_device *dev) { + struct pc263_private *devpriv = dev->private; + if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) && devpriv && devpriv->pci_dev) { if (dev->iobase) -- cgit v0.10.2 From d8967b6ed676c697da3c05ab917a8eaae7a14f81 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 30 May 2012 19:04:45 +0100 Subject: staging: comedi: amplc_pc263: Add attach_pci() hook Implement the attach_pci() hook as function pc263_attach_pci(). This is called bu comedi_pci_auto_config() in preference to the old attach() hook (implemented by pc263_attach()) and avoids searching for the probed PCI device. Factor out code common to pc263_find_pci() and pc263_attach_pci() into new function pc263_find_pci_board(). Factor out most code common to pc263_attach() and pc263_attach_pci() into new functions pc263_pci_common_attach() and pc263_common_attach(). Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index 62fc335..7020907 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c @@ -103,6 +103,21 @@ struct pc263_private { }; /* + * This function looks for a board matching the supplied PCI device. + */ +static const struct pc263_board *pc263_find_pci_board(struct pci_dev *pci_dev) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(pc263_boards); i++) + if (pc263_boards[i].bustype == pci_bustype && + pci_dev->device == pc263_boards[i].devid) + return &pc263_boards[i]; + return NULL; +} + + +/* * This function looks for a PCI device matching the requested board name, * bus and slot. */ @@ -124,21 +139,13 @@ pc263_find_pci(struct comedi_device *dev, int bus, int slot) continue; } if (thisboard->model == anypci_model) { - /* Match any supported model. */ - int i; - - for (i = 0; i < ARRAY_SIZE(pc263_boards); i++) { - if (pc263_boards[i].bustype != pci_bustype) - continue; - if (pci_dev->device == pc263_boards[i].devid) { - /* Change board_ptr to matched board. */ - dev->board_ptr = &pc263_boards[i]; - thisboard = comedi_board(dev); - break; - } - } - if (i == ARRAY_SIZE(pc263_boards)) + /* Wildcard board matches any supported PCI board. */ + const struct pc263_board *foundboard; + foundboard = pc263_find_pci_board(pci_dev); + if (foundboard == NULL) continue; + /* Replace wildcard board_ptr. */ + dev->board_ptr = thisboard = foundboard; } else { /* Match specific model name. */ if (pci_dev->device != thisboard->devid) @@ -211,6 +218,54 @@ static void pc263_report_attach(struct comedi_device *dev) dev_info(dev->class_dev, "%s %sattached\n", dev->board_name, tmpbuf); } +static int pc263_common_attach(struct comedi_device *dev, unsigned long iobase) +{ + const struct pc263_board *thisboard = comedi_board(dev); + struct comedi_subdevice *s; + int ret; + + dev->board_name = thisboard->name; + dev->iobase = iobase; + + ret = alloc_subdevices(dev, 1); + if (ret < 0) { + dev_err(dev->class_dev, "error! out of memory!\n"); + return ret; + } + + s = dev->subdevices + 0; + /* digital output subdevice */ + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pc263_do_insn_bits; + /* read initial relay state */ + s->state = inb(dev->iobase) | (inb(dev->iobase + 1) << 8); + + pc263_report_attach(dev); + return 1; +} + +static int pc263_pci_common_attach(struct comedi_device *dev, + struct pci_dev *pci_dev) +{ + struct pc263_private *devpriv = dev->private; + unsigned long iobase; + int ret; + + devpriv->pci_dev = pci_dev; + ret = comedi_pci_enable(pci_dev, PC263_DRIVER_NAME); + if (ret < 0) { + dev_err(dev->class_dev, + "error! cannot enable PCI device and request regions!\n"); + return ret; + } + iobase = pci_resource_start(pci_dev, 2); + return pc263_common_attach(dev, iobase); +} + /* * Attach is called by the Comedi core to configure the driver * for a particular board. If you specified a board_name array @@ -220,8 +275,6 @@ static void pc263_report_attach(struct comedi_device *dev) static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) { const struct pc263_board *thisboard = comedi_board(dev); - struct comedi_subdevice *s; - unsigned long iobase = 0; int ret; dev_info(dev->class_dev, PC263_DRIVER_NAME ": attach\n"); @@ -229,14 +282,14 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Process options and reserve resources according to bus type. */ if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_ISA) && thisboard->bustype == isa_bustype) { - iobase = it->options[0]; + unsigned long iobase = it->options[0]; ret = pc263_request_region(dev, iobase, PC263_IO_SIZE); if (ret < 0) return ret; + return pc263_common_attach(dev, iobase); } else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) && thisboard->bustype == pci_bustype) { - struct pc263_private *devpriv; - struct pci_dev *pci_dev = NULL; + struct pci_dev *pci_dev; int bus, slot; ret = alloc_private(dev, sizeof(struct pc263_private)); @@ -244,49 +297,44 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev_err(dev->class_dev, "error! out of memory!\n"); return ret; } - devpriv = dev->private; bus = it->options[0]; slot = it->options[1]; pci_dev = pc263_find_pci(dev, bus, slot); if (pci_dev == NULL) return -EIO; - thisboard = comedi_board(dev); /* replaced wildcard board */ - devpriv->pci_dev = pci_dev; - ret = comedi_pci_enable(pci_dev, PC263_DRIVER_NAME); - if (ret < 0) { - dev_err(dev->class_dev, - "error! cannot enable PCI device and request regions!\n"); - return ret; - } - iobase = pci_resource_start(pci_dev, 2); + return pc263_pci_common_attach(dev, pci_dev); } else { dev_err(dev->class_dev, PC263_DRIVER_NAME ": BUG! cannot determine board type!\n"); return -EINVAL; } +} +/* + * The attach_pci hook (if non-NULL) is called at PCI probe time in preference + * to the "manual" attach hook. dev->board_ptr is NULL on entry. There should + * be a board entry matching the supplied PCI device. + */ +static int __devinit pc263_attach_pci(struct comedi_device *dev, + struct pci_dev *pci_dev) +{ + int ret; - dev->board_name = thisboard->name; - dev->iobase = iobase; + if (!IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI)) + return -EINVAL; - ret = alloc_subdevices(dev, 1); + dev_info(dev->class_dev, PC263_DRIVER_NAME ": attach pci %s\n", + pci_name(pci_dev)); + ret = alloc_private(dev, sizeof(struct pc263_private)); if (ret < 0) { dev_err(dev->class_dev, "error! out of memory!\n"); return ret; } - - s = dev->subdevices + 0; - /* digital output subdevice */ - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pc263_do_insn_bits; - /* read initial relay state */ - s->state = inb(dev->iobase) | (inb(dev->iobase + 1) << 8); - - pc263_report_attach(dev); - return 1; + dev->board_ptr = pc263_find_pci_board(pci_dev); + if (dev->board_ptr == NULL) { + dev_err(dev->class_dev, "BUG! cannot determine board type!\n"); + return -EINVAL; + } + return pc263_pci_common_attach(dev, pci_dev); } static void pc263_detach(struct comedi_device *dev) @@ -314,6 +362,7 @@ static struct comedi_driver amplc_pc263_driver = { .driver_name = PC263_DRIVER_NAME, .module = THIS_MODULE, .attach = pc263_attach, + .attach_pci = pc263_attach_pci, .detach = pc263_detach, .board_name = &pc263_boards[0].name, .offset = sizeof(struct pc263_board), -- cgit v0.10.2 From a6e11e3b9ffe994f1f2f8ab74ebdc9d1937c16e0 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 31 May 2012 14:08:31 +0100 Subject: staging: comedi: amplc_dio200: Use IS_ENABLED() Change conditional compilation on kernel options to use the IS_ENABLED() macro. Remove most of the #ifdef lines and add extra if (IS_ENABLED(xxx)) tests so the compiler can remove unreachable code. The pci_driver stuff and device table and some of the static const data is still conditionally compiled. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index f6f6144..95d4370 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -215,14 +215,6 @@ order they appear in the channel list. #define DIO200_DRIVER_NAME "amplc_dio200" -#ifdef CONFIG_COMEDI_AMPLC_DIO200_ISA_MODULE -#define CONFIG_COMEDI_AMPLC_DIO200_ISA -#endif - -#ifdef CONFIG_COMEDI_AMPLC_DIO200_PCI_MODULE -#define CONFIG_COMEDI_AMPLC_DIO200_PCI -#endif - /* PCI IDs */ #define PCI_VENDOR_ID_AMPLICON 0x14dc #define PCI_DEVICE_ID_AMPLICON_PCI272 0x000a @@ -280,12 +272,12 @@ enum dio200_model { }; enum dio200_layout { -#ifdef CONFIG_COMEDI_AMPLC_DIO200_ISA +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA) pc212_layout, pc214_layout, #endif pc215_layout, -#ifdef CONFIG_COMEDI_AMPLC_DIO200_ISA +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA) pc218_layout, #endif pc272_layout @@ -300,7 +292,7 @@ struct dio200_board { }; static const struct dio200_board dio200_boards[] = { -#ifdef CONFIG_COMEDI_AMPLC_DIO200_ISA +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA) { .name = "pc212e", .bustype = isa_bustype, @@ -332,7 +324,7 @@ static const struct dio200_board dio200_boards[] = { .layout = pc272_layout, }, #endif -#ifdef CONFIG_COMEDI_AMPLC_DIO200_PCI +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI) { .name = "pci215", .devid = PCI_DEVICE_ID_AMPLICON_PCI215, @@ -375,7 +367,7 @@ struct dio200_layout_struct { }; static const struct dio200_layout_struct dio200_layouts[] = { -#ifdef CONFIG_COMEDI_AMPLC_DIO200_ISA +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA) [pc212_layout] = { .n_subdevs = 6, .sdtype = {sd_8255, sd_8254, sd_8254, sd_8254, @@ -404,7 +396,7 @@ static const struct dio200_layout_struct dio200_layouts[] = { .has_int_sce = 1, .has_clk_gat_sce = 1, }, -#ifdef CONFIG_COMEDI_AMPLC_DIO200_ISA +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA) [pc218_layout] = { .n_subdevs = 7, .sdtype = {sd_8254, sd_8254, sd_8255, sd_8254, @@ -431,7 +423,7 @@ static const struct dio200_layout_struct dio200_layouts[] = { * PCI driver table. */ -#ifdef CONFIG_COMEDI_AMPLC_DIO200_PCI +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI) static DEFINE_PCI_DEVICE_TABLE(dio200_pci_table) = { { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI215) }, { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI272) }, @@ -453,9 +445,7 @@ MODULE_DEVICE_TABLE(pci, dio200_pci_table); feel free to suggest moving the variable to the struct comedi_device struct. */ struct dio200_private { -#ifdef CONFIG_COMEDI_AMPLC_DIO200_PCI struct pci_dev *pci_dev; /* PCI device */ -#endif int intr_sd; }; @@ -502,7 +492,7 @@ static struct comedi_driver driver_amplc_dio200 = { .num_names = ARRAY_SIZE(dio200_boards), }; -#ifdef CONFIG_COMEDI_AMPLC_DIO200_PCI +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI) static int __devinit driver_amplc_dio200_pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) @@ -561,7 +551,6 @@ module_exit(driver_amplc_dio200_cleanup_module); * This function looks for a PCI device matching the requested board name, * bus and slot. */ -#ifdef CONFIG_COMEDI_AMPLC_DIO200_PCI static int dio200_find_pci(struct comedi_device *dev, int bus, int slot, struct pci_dev **pci_dev_p) @@ -617,13 +606,11 @@ dio200_find_pci(struct comedi_device *dev, int bus, int slot, } return -EIO; } -#endif /* * This function checks and requests an I/O region, reporting an error * if there is a conflict. */ -#ifdef CONFIG_COMEDI_AMPLC_DIO200_ISA static int dio200_request_region(unsigned minor, unsigned long from, unsigned long extent) { @@ -634,7 +621,6 @@ dio200_request_region(unsigned minor, unsigned long from, unsigned long extent) } return 0; } -#endif /* * 'insn_bits' function for an 'INTERRUPT' subdevice. @@ -1346,10 +1332,6 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) struct comedi_subdevice *s; unsigned long iobase = 0; unsigned int irq = 0; -#ifdef CONFIG_COMEDI_AMPLC_DIO200_PCI - struct pci_dev *pci_dev = NULL; - int bus = 0, slot = 0; -#endif const struct dio200_layout_struct *layout; int share_irq = 0; int sdx; @@ -1366,40 +1348,27 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) return ret; } - /* Process options. */ - switch (thisboard->bustype) { -#ifdef CONFIG_COMEDI_AMPLC_DIO200_ISA - case isa_bustype: + /* Process options and reserve resources according to bus type. */ + if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA) && + thisboard->bustype == isa_bustype) { iobase = it->options[0]; irq = it->options[1]; share_irq = 0; - break; -#endif -#ifdef CONFIG_COMEDI_AMPLC_DIO200_PCI - case pci_bustype: + ret = dio200_request_region(dev->minor, iobase, DIO200_IO_SIZE); + if (ret < 0) + return ret; + } else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI) && + thisboard->bustype == pci_bustype) { + struct pci_dev *pci_dev = NULL; + int bus, slot; + bus = it->options[0]; slot = it->options[1]; share_irq = 1; - ret = dio200_find_pci(dev, bus, slot, &pci_dev); if (ret < 0) return ret; devpriv->pci_dev = pci_dev; - break; -#endif - default: - printk(KERN_ERR - "comedi%d: %s: BUG! cannot determine board type!\n", - dev->minor, DIO200_DRIVER_NAME); - return -EINVAL; - break; - } - - devpriv->intr_sd = -1; - - /* Enable device and reserve I/O spaces. */ -#ifdef CONFIG_COMEDI_AMPLC_DIO200_PCI - if (pci_dev) { ret = comedi_pci_enable(pci_dev, DIO200_DRIVER_NAME); if (ret < 0) { printk(KERN_ERR @@ -1409,15 +1378,15 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) } iobase = pci_resource_start(pci_dev, 2); irq = pci_dev->irq; - } else -#endif - { -#ifdef CONFIG_COMEDI_AMPLC_DIO200_ISA - ret = dio200_request_region(dev->minor, iobase, DIO200_IO_SIZE); - if (ret < 0) - return ret; -#endif + } else { + printk(KERN_ERR + "comedi%d: %s: BUG! cannot determine board type!\n", + dev->minor, DIO200_DRIVER_NAME); + return -EINVAL; } + + devpriv->intr_sd = -1; + dev->iobase = iobase; layout = thislayout; @@ -1492,20 +1461,12 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) } printk(KERN_INFO "comedi%d: %s ", dev->minor, dev->board_name); - switch (thisboard->bustype) { -#ifdef CONFIG_COMEDI_AMPLC_DIO200_ISA - case isa_bustype: + if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA) && + thisboard->bustype == isa_bustype) printk("(base %#lx) ", iobase); - break; -#endif -#ifdef CONFIG_COMEDI_AMPLC_DIO200_PCI - case pci_bustype: - printk("(pci %s) ", pci_name(pci_dev)); - break; -#endif - default: - break; - } + else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI) && + thisboard->bustype == pci_bustype) + printk("(pci %s) ", pci_name(devpriv->pci_dev)); if (irq) printk("(irq %u%s) ", irq, (dev->irq ? "" : " UNAVAILABLE")); else @@ -1543,18 +1504,17 @@ static void dio200_detach(struct comedi_device *dev) } } if (devpriv) { -#ifdef CONFIG_COMEDI_AMPLC_DIO200_PCI - if (devpriv->pci_dev) { - if (dev->iobase) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); - } else -#endif - { -#ifdef CONFIG_COMEDI_AMPLC_DIO200_ISA + if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI) && + thisboard->bustype == pci_bustype) { + if (devpriv->pci_dev) { + if (dev->iobase) + comedi_pci_disable(devpriv->pci_dev); + pci_dev_put(devpriv->pci_dev); + } + } else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA) && + thisboard->bustype == isa_bustype) { if (dev->iobase) release_region(dev->iobase, DIO200_IO_SIZE); -#endif } } } -- cgit v0.10.2 From d22e9306c3e119ebc058d5b77306042d6603b231 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 31 May 2012 14:08:32 +0100 Subject: staging: comedi: amplc_dio200: Use module_comedi_{pci,}_driver() If PCI boards are supported, use the module_comedi_pci_driver() macro to register the module as a comedi driver and a PCI driver. Otherwise, only ISA boards are supported so use the module_comedi_driver() macro to register the module as a comedi driver. Renamed 'driver_amplc_dio200' to 'amplc_dio200_driver' and removed 'driver_' prefix from PCI related functions and variables, purely for aesthetic reasons. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index 95d4370..598e51a 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -482,7 +482,7 @@ struct dio200_subdev_intr { static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it); static void dio200_detach(struct comedi_device *dev); -static struct comedi_driver driver_amplc_dio200 = { +static struct comedi_driver amplc_dio200_driver = { .driver_name = DIO200_DRIVER_NAME, .module = THIS_MODULE, .attach = dio200_attach, @@ -493,58 +493,27 @@ static struct comedi_driver driver_amplc_dio200 = { }; #if IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI) -static int __devinit driver_amplc_dio200_pci_probe(struct pci_dev *dev, +static int __devinit amplc_dio200_pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) { - return comedi_pci_auto_config(dev, &driver_amplc_dio200); + return comedi_pci_auto_config(dev, &lc_dio200_driver); } -static void __devexit driver_amplc_dio200_pci_remove(struct pci_dev *dev) +static void __devexit amplc_dio200_pci_remove(struct pci_dev *dev) { comedi_pci_auto_unconfig(dev); } -static struct pci_driver driver_amplc_dio200_pci_driver = { +static struct pci_driver amplc_dio200_pci_driver = { + .name = DIO200_DRIVER_NAME, .id_table = dio200_pci_table, - .probe = &driver_amplc_dio200_pci_probe, - .remove = __devexit_p(&driver_amplc_dio200_pci_remove) + .probe = &lc_dio200_pci_probe, + .remove = __devexit_p(&lc_dio200_pci_remove) }; - -static int __init driver_amplc_dio200_init_module(void) -{ - int retval; - - retval = comedi_driver_register(&driver_amplc_dio200); - if (retval < 0) - return retval; - - driver_amplc_dio200_pci_driver.name = - (char *)driver_amplc_dio200.driver_name; - return pci_register_driver(&driver_amplc_dio200_pci_driver); -} - -static void __exit driver_amplc_dio200_cleanup_module(void) -{ - pci_unregister_driver(&driver_amplc_dio200_pci_driver); - comedi_driver_unregister(&driver_amplc_dio200); -} - -module_init(driver_amplc_dio200_init_module); -module_exit(driver_amplc_dio200_cleanup_module); +module_comedi_pci_driver(amplc_dio200_driver, amplc_dio200_pci_driver); #else -static int __init driver_amplc_dio200_init_module(void) -{ - return comedi_driver_register(&driver_amplc_dio200); -} - -static void __exit driver_amplc_dio200_cleanup_module(void) -{ - comedi_driver_unregister(&driver_amplc_dio200); -} - -module_init(driver_amplc_dio200_init_module); -module_exit(driver_amplc_dio200_cleanup_module); +module_comedi_driver(amplc_dio200_driver); #endif /* -- cgit v0.10.2 From fd97962b4142fc3460d3628c3842be6d33b9aa94 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 31 May 2012 14:08:33 +0100 Subject: staging: comedi: amplc_dio200: Remove forward function declarations Moved some functions and variables to avoid forward declarations. Moved PCI table closer to the struct pci_driver that refers to it. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index 598e51a..8b31ab9 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -420,20 +420,6 @@ static const struct dio200_layout_struct dio200_layouts[] = { }; /* - * PCI driver table. - */ - -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI) -static DEFINE_PCI_DEVICE_TABLE(dio200_pci_table) = { - { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI215) }, - { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI272) }, - {0} -}; - -MODULE_DEVICE_TABLE(pci, dio200_pci_table); -#endif /* CONFIG_COMEDI_AMPLC_DIO200_PCI */ - -/* * Useful for shorthand access to the particular board structure */ #define thisboard ((const struct dio200_board *)dev->board_ptr) @@ -474,49 +460,6 @@ struct dio200_subdev_intr { }; /* - * The struct comedi_driver structure tells the Comedi core module - * which functions to call to configure/deconfigure (attach/detach) - * the board, and also about the kernel module that contains - * the device code. - */ -static int dio200_attach(struct comedi_device *dev, - struct comedi_devconfig *it); -static void dio200_detach(struct comedi_device *dev); -static struct comedi_driver amplc_dio200_driver = { - .driver_name = DIO200_DRIVER_NAME, - .module = THIS_MODULE, - .attach = dio200_attach, - .detach = dio200_detach, - .board_name = &dio200_boards[0].name, - .offset = sizeof(struct dio200_board), - .num_names = ARRAY_SIZE(dio200_boards), -}; - -#if IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI) -static int __devinit amplc_dio200_pci_probe(struct pci_dev *dev, - const struct pci_device_id - *ent) -{ - return comedi_pci_auto_config(dev, &lc_dio200_driver); -} - -static void __devexit amplc_dio200_pci_remove(struct pci_dev *dev) -{ - comedi_pci_auto_unconfig(dev); -} - -static struct pci_driver amplc_dio200_pci_driver = { - .name = DIO200_DRIVER_NAME, - .id_table = dio200_pci_table, - .probe = &lc_dio200_pci_probe, - .remove = __devexit_p(&lc_dio200_pci_remove) -}; -module_comedi_pci_driver(amplc_dio200_driver, amplc_dio200_pci_driver); -#else -module_comedi_driver(amplc_dio200_driver); -#endif - -/* * This function looks for a PCI device matching the requested board name, * bus and slot. */ @@ -1488,6 +1431,54 @@ static void dio200_detach(struct comedi_device *dev) } } +/* + * The struct comedi_driver structure tells the Comedi core module + * which functions to call to configure/deconfigure (attach/detach) + * the board, and also about the kernel module that contains + * the device code. + */ +static struct comedi_driver amplc_dio200_driver = { + .driver_name = DIO200_DRIVER_NAME, + .module = THIS_MODULE, + .attach = dio200_attach, + .detach = dio200_detach, + .board_name = &dio200_boards[0].name, + .offset = sizeof(struct dio200_board), + .num_names = ARRAY_SIZE(dio200_boards), +}; + +#if IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI) +static DEFINE_PCI_DEVICE_TABLE(dio200_pci_table) = { + { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI215) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI272) }, + {0} +}; + +MODULE_DEVICE_TABLE(pci, dio200_pci_table); + +static int __devinit amplc_dio200_pci_probe(struct pci_dev *dev, + const struct pci_device_id + *ent) +{ + return comedi_pci_auto_config(dev, &lc_dio200_driver); +} + +static void __devexit amplc_dio200_pci_remove(struct pci_dev *dev) +{ + comedi_pci_auto_unconfig(dev); +} + +static struct pci_driver amplc_dio200_pci_driver = { + .name = DIO200_DRIVER_NAME, + .id_table = dio200_pci_table, + .probe = &lc_dio200_pci_probe, + .remove = __devexit_p(&lc_dio200_pci_remove) +}; +module_comedi_pci_driver(amplc_dio200_driver, amplc_dio200_pci_driver); +#else +module_comedi_driver(amplc_dio200_driver); +#endif + MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_DESCRIPTION("Comedi low-level driver"); MODULE_LICENSE("GPL"); -- cgit v0.10.2 From 485455d01b26e849d30c2b20ce20a4d6fc50555e Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 31 May 2012 14:08:34 +0100 Subject: staging: comedi: amplc_dio200: Replace printk calls Replace the printk calls with dev_info, dev_err, etc. There were some consecutive printk calls without newlines which now scnprintf into a temporary buffer and this bit of code has been factored out into new function dio200_report_attach(). Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index 8b31ab9..be932e8 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -509,12 +509,12 @@ dio200_find_pci(struct comedi_device *dev, int bus, int slot, } /* No match found. */ if (bus || slot) { - printk(KERN_ERR - "comedi%d: error! no %s found at pci %02x:%02x!\n", - dev->minor, thisboard->name, bus, slot); + dev_err(dev->class_dev, + "error! no %s found at pci %02x:%02x!\n", + thisboard->name, bus, slot); } else { - printk(KERN_ERR "comedi%d: error! no %s found!\n", - dev->minor, thisboard->name); + dev_err(dev->class_dev, "error! no %s found!\n", + thisboard->name); } return -EIO; } @@ -524,11 +524,12 @@ dio200_find_pci(struct comedi_device *dev, int bus, int slot, * if there is a conflict. */ static int -dio200_request_region(unsigned minor, unsigned long from, unsigned long extent) +dio200_request_region(struct comedi_device *dev, + unsigned long from, unsigned long extent) { if (!from || !request_region(from, extent, DIO200_DRIVER_NAME)) { - printk(KERN_ERR "comedi%d: I/O port conflict (%#lx,%lu)!\n", - minor, from, extent); + dev_err(dev->class_dev, "I/O port conflict (%#lx,%lu)!\n", + from, extent); return -EIO; } return 0; @@ -926,8 +927,7 @@ dio200_subdev_intr_init(struct comedi_device *dev, struct comedi_subdevice *s, subpriv = kzalloc(sizeof(*subpriv), GFP_KERNEL); if (!subpriv) { - printk(KERN_ERR "comedi%d: error! out of memory!\n", - dev->minor); + dev_err(dev->class_dev, "error! out of memory!\n"); return -ENOMEM; } subpriv->iobase = iobase; @@ -1180,8 +1180,7 @@ dio200_subdev_8254_init(struct comedi_device *dev, struct comedi_subdevice *s, subpriv = kzalloc(sizeof(*subpriv), GFP_KERNEL); if (!subpriv) { - printk(KERN_ERR "comedi%d: error! out of memory!\n", - dev->minor); + dev_err(dev->class_dev, "error! out of memory!\n"); return -ENOMEM; } @@ -1233,6 +1232,31 @@ dio200_subdev_8254_cleanup(struct comedi_device *dev, kfree(subpriv); } +static void dio200_report_attach(struct comedi_device *dev, unsigned int irq) +{ + char tmpbuf[60]; + int tmplen; + + if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA) && + thisboard->bustype == isa_bustype) + tmplen = scnprintf(tmpbuf, sizeof(tmpbuf), + "(base %#lx) ", dev->iobase); + else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI) && + thisboard->bustype == pci_bustype) + tmplen = scnprintf(tmpbuf, sizeof(tmpbuf), + "(pci %s) ", pci_name(devpriv->pci_dev)); + else + tmplen = 0; + if (irq) + tmplen += scnprintf(&tmpbuf[tmplen], sizeof(tmpbuf) - tmplen, + "(irq %u%s) ", irq, + (dev->irq ? "" : " UNAVAILABLE")); + else + tmplen += scnprintf(&tmpbuf[tmplen], sizeof(tmpbuf) - tmplen, + "(no irq) "); + dev_info(dev->class_dev, "%s %sattached\n", dev->board_name, tmpbuf); +} + /* * Attach is called by the Comedi core to configure the driver * for a particular board. If you specified a board_name array @@ -1250,13 +1274,11 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) unsigned n; int ret; - printk(KERN_DEBUG "comedi%d: %s: attach\n", dev->minor, - DIO200_DRIVER_NAME); + dev_info(dev->class_dev, DIO200_DRIVER_NAME ": attach\n"); ret = alloc_private(dev, sizeof(struct dio200_private)); if (ret < 0) { - printk(KERN_ERR "comedi%d: error! out of memory!\n", - dev->minor); + dev_err(dev->class_dev, "error! out of memory!\n"); return ret; } @@ -1266,7 +1288,7 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) iobase = it->options[0]; irq = it->options[1]; share_irq = 0; - ret = dio200_request_region(dev->minor, iobase, DIO200_IO_SIZE); + ret = dio200_request_region(dev, iobase, DIO200_IO_SIZE); if (ret < 0) return ret; } else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI) && @@ -1283,17 +1305,15 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->pci_dev = pci_dev; ret = comedi_pci_enable(pci_dev, DIO200_DRIVER_NAME); if (ret < 0) { - printk(KERN_ERR - "comedi%d: error! cannot enable PCI device and request regions!\n", - dev->minor); + dev_err(dev->class_dev, + "error! cannot enable PCI device and request regions!\n"); return ret; } iobase = pci_resource_start(pci_dev, 2); irq = pci_dev->irq; } else { - printk(KERN_ERR - "comedi%d: %s: BUG! cannot determine board type!\n", - dev->minor, DIO200_DRIVER_NAME); + dev_err(dev->class_dev, DIO200_DRIVER_NAME + ": BUG! cannot determine board type!\n"); return -EINVAL; } @@ -1305,8 +1325,7 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) ret = alloc_subdevices(dev, layout->n_subdevs); if (ret < 0) { - printk(KERN_ERR "comedi%d: error! out of memory!\n", - dev->minor); + dev_err(dev->class_dev, "error! out of memory!\n"); return ret; } @@ -1366,26 +1385,12 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) DIO200_DRIVER_NAME, dev) >= 0) { dev->irq = irq; } else { - printk(KERN_WARNING - "comedi%d: warning! irq %u unavailable!\n", - dev->minor, irq); + dev_warn(dev->class_dev, + "warning! irq %u unavailable!\n", irq); } } - printk(KERN_INFO "comedi%d: %s ", dev->minor, dev->board_name); - if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA) && - thisboard->bustype == isa_bustype) - printk("(base %#lx) ", iobase); - else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI) && - thisboard->bustype == pci_bustype) - printk("(pci %s) ", pci_name(devpriv->pci_dev)); - if (irq) - printk("(irq %u%s) ", irq, (dev->irq ? "" : " UNAVAILABLE")); - else - printk("(no irq) "); - - printk("attached\n"); - + dio200_report_attach(dev, irq); return 1; } -- cgit v0.10.2 From 181ad5edbf6d3c244263b770e9dd4eda645de5bf Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 31 May 2012 14:08:35 +0100 Subject: staging: comedi: amplc_dio200: Change return type of dio200_find_pci() dio200_find_pci() finds a supported PCI device, returning 0 on success or -EIO on failure and returning the pointer to the PCI device via a struct pci_dev ** parameter. Change it to return the struct pci_dev * on success or NULL on failure. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index be932e8..6d04378 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -463,14 +463,11 @@ struct dio200_subdev_intr { * This function looks for a PCI device matching the requested board name, * bus and slot. */ -static int -dio200_find_pci(struct comedi_device *dev, int bus, int slot, - struct pci_dev **pci_dev_p) +static struct pci_dev * +dio200_find_pci(struct comedi_device *dev, int bus, int slot) { struct pci_dev *pci_dev = NULL; - *pci_dev_p = NULL; - /* Look for matching PCI device. */ for (pci_dev = pci_get_device(PCI_VENDOR_ID_AMPLICON, PCI_ANY_ID, NULL); pci_dev != NULL; @@ -504,8 +501,7 @@ dio200_find_pci(struct comedi_device *dev, int bus, int slot, } /* Found a match. */ - *pci_dev_p = pci_dev; - return 0; + return pci_dev; } /* No match found. */ if (bus || slot) { @@ -516,7 +512,7 @@ dio200_find_pci(struct comedi_device *dev, int bus, int slot, dev_err(dev->class_dev, "error! no %s found!\n", thisboard->name); } - return -EIO; + return NULL; } /* @@ -1293,15 +1289,15 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) return ret; } else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI) && thisboard->bustype == pci_bustype) { - struct pci_dev *pci_dev = NULL; + struct pci_dev *pci_dev; int bus, slot; bus = it->options[0]; slot = it->options[1]; share_irq = 1; - ret = dio200_find_pci(dev, bus, slot, &pci_dev); - if (ret < 0) - return ret; + pci_dev = dio200_find_pci(dev, bus, slot); + if (pci_dev == NULL) + return -EIO; devpriv->pci_dev = pci_dev; ret = comedi_pci_enable(pci_dev, DIO200_DRIVER_NAME); if (ret < 0) { -- cgit v0.10.2 From adb4601a82343e846997320b41d5b7d49137fe42 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 31 May 2012 14:08:36 +0100 Subject: staging: comedi: amplc_dio200: Remove thisboard, thislayout and devpriv macros The 'thisboard', 'thislayout' and 'devpriv' macros rely on a local variable having a specific name and yield pointers derived from that local variable. Replace the macros with local variables wherever they occur. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index 6d04378..5b8c677 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -419,13 +419,6 @@ static const struct dio200_layout_struct dio200_layouts[] = { }, }; -/* - * Useful for shorthand access to the particular board structure - */ -#define thisboard ((const struct dio200_board *)dev->board_ptr) -#define thislayout (&dio200_layouts[((struct dio200_board *) \ - dev->board_ptr)->layout]) - /* this structure is for data unique to this hardware driver. If several hardware drivers keep similar information in this structure, feel free to suggest moving the variable to the struct comedi_device struct. @@ -435,8 +428,6 @@ struct dio200_private { int intr_sd; }; -#define devpriv ((struct dio200_private *)dev->private) - struct dio200_subdev_8254 { unsigned long iobase; /* Counter base address */ unsigned long clk_sce_iobase; /* CLK_SCE base address */ @@ -466,6 +457,7 @@ struct dio200_subdev_intr { static struct pci_dev * dio200_find_pci(struct comedi_device *dev, int bus, int slot) { + const struct dio200_board *thisboard = comedi_board(dev); struct pci_dev *pci_dev = NULL; /* Look for matching PCI device. */ @@ -489,6 +481,7 @@ dio200_find_pci(struct comedi_device *dev, int bus, int slot) if (pci_dev->device == dio200_boards[i].devid) { /* Change board_ptr to matched board. */ dev->board_ptr = &dio200_boards[i]; + thisboard = comedi_board(dev); break; } } @@ -972,6 +965,7 @@ dio200_subdev_intr_cleanup(struct comedi_device *dev, static irqreturn_t dio200_interrupt(int irq, void *d) { struct comedi_device *dev = d; + struct dio200_private *devpriv = dev->private; int handled; if (!dev->attached) @@ -1230,6 +1224,8 @@ dio200_subdev_8254_cleanup(struct comedi_device *dev, static void dio200_report_attach(struct comedi_device *dev, unsigned int irq) { + const struct dio200_board *thisboard = comedi_board(dev); + struct dio200_private *devpriv = dev->private; char tmpbuf[60]; int tmplen; @@ -1261,6 +1257,8 @@ static void dio200_report_attach(struct comedi_device *dev, unsigned int irq) */ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct dio200_board *thisboard = comedi_board(dev); + struct dio200_private *devpriv; struct comedi_subdevice *s; unsigned long iobase = 0; unsigned int irq = 0; @@ -1277,6 +1275,7 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev_err(dev->class_dev, "error! out of memory!\n"); return ret; } + devpriv = dev->private; /* Process options and reserve resources according to bus type. */ if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA) && @@ -1298,6 +1297,7 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) pci_dev = dio200_find_pci(dev, bus, slot); if (pci_dev == NULL) return -EIO; + thisboard = comedi_board(dev); /* replaced wildcard board */ devpriv->pci_dev = pci_dev; ret = comedi_pci_enable(pci_dev, DIO200_DRIVER_NAME); if (ret < 0) { @@ -1317,7 +1317,7 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->iobase = iobase; - layout = thislayout; + layout = &dio200_layouts[thisboard->layout]; ret = alloc_subdevices(dev, layout->n_subdevs); if (ret < 0) { @@ -1392,13 +1392,15 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) static void dio200_detach(struct comedi_device *dev) { + const struct dio200_board *thisboard = comedi_board(dev); + struct dio200_private *devpriv = dev->private; const struct dio200_layout_struct *layout; unsigned n; if (dev->irq) free_irq(dev->irq, dev); if (dev->subdevices) { - layout = thislayout; + layout = &dio200_layouts[thisboard->layout]; for (n = 0; n < dev->n_subdevices; n++) { struct comedi_subdevice *s = &dev->subdevices[n]; switch (layout->sdtype[n]) { -- cgit v0.10.2 From c894ec8da05aa8a58830297d1564675f3e1174cc Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 31 May 2012 14:08:37 +0100 Subject: staging: comedi: amplc_dio200: Add attach_pci() hook Implement the attach_pci() hook as function dio200_attach_pci(). This is called by comedi_pci_auto_config() in preference to the old attach() hook (implemented by dio200_attach()) and avoids searching for the probed PCI device. Factor out code common to dio200_find_pci() and dio200_attach_pci() into new function dio200_find_pci_board(). Factor out most code common to dio200_attach() and dio200_attach_pci() into new functions dio200_pci_common_attach() and dio200_common_attach(). Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index 5b8c677..3afebb2 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -451,6 +451,21 @@ struct dio200_subdev_intr { }; /* + * This function looks for a board matching the supplied PCI device. + */ +static const struct dio200_board * +dio200_find_pci_board(struct pci_dev *pci_dev) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(dio200_boards); i++) + if (dio200_boards[i].bustype == pci_bustype && + pci_dev->device == dio200_boards[i].devid) + return &dio200_boards[i]; + return NULL; +} + +/* * This function looks for a PCI device matching the requested board name, * bus and slot. */ @@ -472,21 +487,15 @@ dio200_find_pci(struct comedi_device *dev, int bus, int slot) continue; } if (thisboard->model == anypci_model) { - /* Match any supported model. */ - int i; - - for (i = 0; i < ARRAY_SIZE(dio200_boards); i++) { - if (dio200_boards[i].bustype != pci_bustype) - continue; - if (pci_dev->device == dio200_boards[i].devid) { - /* Change board_ptr to matched board. */ - dev->board_ptr = &dio200_boards[i]; - thisboard = comedi_board(dev); - break; - } - } - if (i == ARRAY_SIZE(dio200_boards)) + /* Wildcard board matches any supported PCI board. */ + const struct dio200_board *foundboard; + + foundboard = dio200_find_pci_board(pci_dev); + if (foundboard == NULL) continue; + /* Replace wildcard board_ptr. */ + dev->board_ptr = foundboard; + thisboard = comedi_board(dev); } else { /* Match specific model name. */ if (pci_dev->device != thisboard->devid) @@ -1249,82 +1258,26 @@ static void dio200_report_attach(struct comedi_device *dev, unsigned int irq) dev_info(dev->class_dev, "%s %sattached\n", dev->board_name, tmpbuf); } -/* - * Attach is called by the Comedi core to configure the driver - * for a particular board. If you specified a board_name array - * in the driver structure, dev->board_ptr contains that - * address. - */ -static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) +static int dio200_common_attach(struct comedi_device *dev, unsigned long iobase, + unsigned int irq, unsigned long req_irq_flags) { const struct dio200_board *thisboard = comedi_board(dev); - struct dio200_private *devpriv; + struct dio200_private *devpriv = dev->private; + const struct dio200_layout_struct *layout = + &dio200_layouts[thisboard->layout]; struct comedi_subdevice *s; - unsigned long iobase = 0; - unsigned int irq = 0; - const struct dio200_layout_struct *layout; - int share_irq = 0; int sdx; - unsigned n; + unsigned int n; int ret; - dev_info(dev->class_dev, DIO200_DRIVER_NAME ": attach\n"); - - ret = alloc_private(dev, sizeof(struct dio200_private)); - if (ret < 0) { - dev_err(dev->class_dev, "error! out of memory!\n"); - return ret; - } - devpriv = dev->private; - - /* Process options and reserve resources according to bus type. */ - if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA) && - thisboard->bustype == isa_bustype) { - iobase = it->options[0]; - irq = it->options[1]; - share_irq = 0; - ret = dio200_request_region(dev, iobase, DIO200_IO_SIZE); - if (ret < 0) - return ret; - } else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI) && - thisboard->bustype == pci_bustype) { - struct pci_dev *pci_dev; - int bus, slot; - - bus = it->options[0]; - slot = it->options[1]; - share_irq = 1; - pci_dev = dio200_find_pci(dev, bus, slot); - if (pci_dev == NULL) - return -EIO; - thisboard = comedi_board(dev); /* replaced wildcard board */ - devpriv->pci_dev = pci_dev; - ret = comedi_pci_enable(pci_dev, DIO200_DRIVER_NAME); - if (ret < 0) { - dev_err(dev->class_dev, - "error! cannot enable PCI device and request regions!\n"); - return ret; - } - iobase = pci_resource_start(pci_dev, 2); - irq = pci_dev->irq; - } else { - dev_err(dev->class_dev, DIO200_DRIVER_NAME - ": BUG! cannot determine board type!\n"); - return -EINVAL; - } - devpriv->intr_sd = -1; - dev->iobase = iobase; - - layout = &dio200_layouts[thisboard->layout]; - + dev->board_name = thisboard->name; ret = alloc_subdevices(dev, layout->n_subdevs); if (ret < 0) { dev_err(dev->class_dev, "error! out of memory!\n"); return ret; } - for (n = 0; n < dev->n_subdevices; n++) { s = &dev->subdevices[n]; switch (layout->sdtype[n]) { @@ -1335,7 +1288,6 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) layout->has_clk_gat_sce); if (ret < 0) return ret; - break; case sd_8255: /* digital i/o subdevice (8255) */ @@ -1343,7 +1295,6 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) iobase + layout->sdinfo[n]); if (ret < 0) return ret; - break; case sd_intr: /* 'INTERRUPT' subdevice */ @@ -1356,7 +1307,6 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) has_int_sce); if (ret < 0) return ret; - devpriv->intr_sd = n; } else { s->type = COMEDI_SUBD_UNUSED; @@ -1367,17 +1317,11 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) break; } } - sdx = devpriv->intr_sd; if (sdx >= 0 && sdx < dev->n_subdevices) dev->read_subdev = &dev->subdevices[sdx]; - - dev->board_name = thisboard->name; - if (irq) { - unsigned long flags = share_irq ? IRQF_SHARED : 0; - - if (request_irq(irq, dio200_interrupt, flags, + if (request_irq(irq, dio200_interrupt, req_irq_flags, DIO200_DRIVER_NAME, dev) >= 0) { dev->irq = irq; } else { @@ -1385,11 +1329,105 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) "warning! irq %u unavailable!\n", irq); } } - dio200_report_attach(dev, irq); return 1; } +static int dio200_pci_common_attach(struct comedi_device *dev, + struct pci_dev *pci_dev) +{ + struct dio200_private *devpriv = dev->private; + unsigned long iobase; + int ret; + + devpriv->pci_dev = pci_dev; + ret = comedi_pci_enable(pci_dev, DIO200_DRIVER_NAME); + if (ret < 0) { + dev_err(dev->class_dev, + "error! cannot enable PCI device and request regions!\n"); + return ret; + } + iobase = pci_resource_start(pci_dev, 2); + return dio200_common_attach(dev, iobase, pci_dev->irq, IRQF_SHARED); +} + +/* + * Attach is called by the Comedi core to configure the driver + * for a particular board. If you specified a board_name array + * in the driver structure, dev->board_ptr contains that + * address. + */ +static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) +{ + const struct dio200_board *thisboard = comedi_board(dev); + int ret; + + dev_info(dev->class_dev, DIO200_DRIVER_NAME ": attach\n"); + + ret = alloc_private(dev, sizeof(struct dio200_private)); + if (ret < 0) { + dev_err(dev->class_dev, "error! out of memory!\n"); + return ret; + } + + /* Process options and reserve resources according to bus type. */ + if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA) && + thisboard->bustype == isa_bustype) { + unsigned long iobase; + unsigned int irq; + + iobase = it->options[0]; + irq = it->options[1]; + ret = dio200_request_region(dev, iobase, DIO200_IO_SIZE); + if (ret < 0) + return ret; + return dio200_common_attach(dev, iobase, irq, 0); + } else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI) && + thisboard->bustype == pci_bustype) { + struct pci_dev *pci_dev; + int bus, slot; + + bus = it->options[0]; + slot = it->options[1]; + pci_dev = dio200_find_pci(dev, bus, slot); + if (pci_dev == NULL) + return -EIO; + return dio200_pci_common_attach(dev, pci_dev); + } else { + dev_err(dev->class_dev, DIO200_DRIVER_NAME + ": BUG! cannot determine board type!\n"); + return -EINVAL; + } +} + +/* + * The attach_pci hook (if non-NULL) is called at PCI probe time in preference + * to the "manual" attach hook. dev->board_ptr is NULL on entry. There should + * be a board entry matching the supplied PCI device. + */ +static int __devinit dio200_attach_pci(struct comedi_device *dev, + struct pci_dev *pci_dev) +{ + int ret; + + if (!IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI)) + return -EINVAL; + + dev_info(dev->class_dev, DIO200_DRIVER_NAME ": attach pci %s\n", + pci_name(pci_dev)); + ret = alloc_private(dev, sizeof(struct dio200_private)); + if (ret < 0) { + dev_err(dev->class_dev, "error! out of memory!\n"); + return ret; + } + dev->board_ptr = dio200_find_pci_board(pci_dev); + if (dev->board_ptr == NULL) { + dev_err(dev->class_dev, "BUG! cannot determine board type!\n"); + return -EINVAL; + } + return dio200_pci_common_attach(dev, pci_dev); +} + static void dio200_detach(struct comedi_device *dev) { const struct dio200_board *thisboard = comedi_board(dev); @@ -1444,6 +1482,7 @@ static struct comedi_driver amplc_dio200_driver = { .driver_name = DIO200_DRIVER_NAME, .module = THIS_MODULE, .attach = dio200_attach, + .attach_pci = dio200_attach_pci, .detach = dio200_detach, .board_name = &dio200_boards[0].name, .offset = sizeof(struct dio200_board), -- cgit v0.10.2 From 52954abcee66f9a3c5c2416a89c8b2affd2f5a2b Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 31 May 2012 16:02:02 +0100 Subject: staging: comedi: amplc_pci224: __devinit pci224_attach_pci() pci224_attach_pci() is only called during PCI probe, indirectly via comedi_pci_auto_config(), so it can be marked __devinit. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index 0d1f9cc..96a9d34 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -1495,7 +1495,7 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) return pci224_attach_common(dev, pci_dev, it->options); } -static int +static int __devinit pci224_attach_pci(struct comedi_device *dev, struct pci_dev *pci_dev) { int ret; -- cgit v0.10.2 From eedc1b7be2ea7c8350f359ff9afa568cb89a70d7 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 31 May 2012 16:02:03 +0100 Subject: staging: comedi: amplc_pci224: Replace printk calls Replace the printk calls with dev_info, dev_err, etc. There were some consecutive printk calls without newlines which now scnprintf into a temporary buffer and this bit of code has been factored out into new function pci224_report_attach(). A couple of DPRINTK() macro calls which may result in printk() calls have been left alone to be tackled en masse at a later date. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index 96a9d34..a07546e0 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -626,8 +626,7 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev, /* Nothing left to put in the FIFO. */ pci224_ao_stop(dev, s); s->async->events |= COMEDI_CB_OVERFLOW; - printk(KERN_ERR "comedi%d: " - "AO buffer underrun\n", dev->minor); + dev_err(dev->class_dev, "AO buffer underrun\n"); } } /* Determine how many new scans can be put in the FIFO. */ @@ -1295,16 +1294,29 @@ pci224_find_pci(struct comedi_device *dev, int bus, int slot, } /* No match found. */ if (bus || slot) { - printk(KERN_ERR "comedi%d: error! " - "no %s found at pci %02x:%02x!\n", - dev->minor, thisboard->name, bus, slot); + dev_err(dev->class_dev, + "error! no %s found at pci %02x:%02x!\n", + thisboard->name, bus, slot); } else { - printk(KERN_ERR "comedi%d: error! no %s found!\n", - dev->minor, thisboard->name); + dev_err(dev->class_dev, "error! no %s found!\n", + thisboard->name); } return -EIO; } +static void pci224_report_attach(struct comedi_device *dev, unsigned int irq) +{ + char tmpbuf[30]; + + if (irq) + snprintf(tmpbuf, sizeof(tmpbuf), "irq %u%s", irq, + (dev->irq ? "" : " UNAVAILABLE")); + else + snprintf(tmpbuf, sizeof(tmpbuf), "no irq"); + dev_info(dev->class_dev, "%s (pci %s) (%s) attached\n", + dev->board_name, pci_name(devpriv->pci_dev), tmpbuf); +} + /* * Common part of attach and attach_pci. */ @@ -1319,9 +1331,9 @@ static int pci224_attach_common(struct comedi_device *dev, devpriv->pci_dev = pci_dev; ret = comedi_pci_enable(pci_dev, DRIVER_NAME); if (ret < 0) { - printk(KERN_ERR - "comedi%d: error! cannot enable PCI device " - "and request regions!\n", dev->minor); + dev_err(dev->class_dev, + "error! cannot enable PCI device and request regions!\n" + ); return ret; } spin_lock_init(&devpriv->ao_spinlock); @@ -1368,8 +1380,7 @@ static int pci224_attach_common(struct comedi_device *dev, /* Allocate subdevices. There is only one! */ ret = alloc_subdevices(dev, 1); if (ret < 0) { - printk(KERN_ERR "comedi%d: error! out of memory!\n", - dev->minor); + dev_err(dev->class_dev, "error! out of memory!\n"); return ret; } @@ -1403,10 +1414,9 @@ static int pci224_attach_common(struct comedi_device *dev, if (options) { for (n = 2; n < 3 + s->n_chan; n++) { if (options[n] < 0 || options[n] > 1) { - printk(KERN_WARNING - "comedi%d: %s: warning! bad options[%u]=%d\n", - dev->minor, DRIVER_NAME, n, - options[n]); + dev_warn(dev->class_dev, DRIVER_NAME + ": warning! bad options[%u]=%d\n", + n, options[n]); } } } @@ -1435,9 +1445,9 @@ static int pci224_attach_common(struct comedi_device *dev, devpriv->hwrange = hwrange_pci224_external; } else { if (options && options[2] != 0) { - printk(KERN_WARNING "comedi%d: %s: warning! " - "bad options[2]=%d\n", - dev->minor, DRIVER_NAME, options[2]); + dev_warn(dev->class_dev, DRIVER_NAME + ": warning! bad options[2]=%d\n", + options[2]); } s->range_table = &range_pci224_internal; devpriv->hwrange = hwrange_pci224_internal; @@ -1450,24 +1460,15 @@ static int pci224_attach_common(struct comedi_device *dev, ret = request_irq(irq, pci224_interrupt, IRQF_SHARED, DRIVER_NAME, dev); if (ret < 0) { - printk(KERN_ERR "comedi%d: error! " - "unable to allocate irq %u\n", dev->minor, irq); + dev_err(dev->class_dev, + "error! unable to allocate irq %u\n", irq); return ret; } else { dev->irq = irq; } } - printk(KERN_INFO "comedi%d: %s ", dev->minor, dev->board_name); - printk("(pci %s) ", pci_name(pci_dev)); - if (irq) - printk("(irq %u%s) ", irq, (dev->irq ? "" : " UNAVAILABLE")); - else - printk("(no irq) "); - - - printk("attached\n"); - + pci224_report_attach(dev, irq); return 1; } @@ -1477,14 +1478,13 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) int bus, slot; int ret; - printk(KERN_DEBUG "comedi%d: %s: attach\n", dev->minor, DRIVER_NAME); + dev_info(dev->class_dev, DRIVER_NAME ": attach\n"); bus = it->options[0]; slot = it->options[1]; ret = alloc_private(dev, sizeof(struct pci224_private)); if (ret < 0) { - printk(KERN_ERR "comedi%d: error! out of memory!\n", - dev->minor); + dev_err(dev->class_dev, "error! out of memory!\n"); return ret; } @@ -1500,21 +1500,19 @@ pci224_attach_pci(struct comedi_device *dev, struct pci_dev *pci_dev) { int ret; - printk(KERN_DEBUG "comedi%d: %s: attach_pci %s\n", dev->minor, - DRIVER_NAME, pci_name(pci_dev)); + dev_info(dev->class_dev, DRIVER_NAME ": attach_pci %s\n", + pci_name(pci_dev)); ret = alloc_private(dev, sizeof(struct pci224_private)); if (ret < 0) { - printk(KERN_ERR "comedi%d: error! out of memory!\n", - dev->minor); + dev_err(dev->class_dev, "error! out of memory!\n"); return ret; } dev->board_ptr = pci224_find_pci_board(pci_dev); if (dev->board_ptr == NULL) { - printk(KERN_ERR - "comedi%d: %s: BUG! cannot determine board type!\n", - dev->minor, DRIVER_NAME); + dev_err(dev->class_dev, + DRIVER_NAME ": BUG! cannot determine board type!\n"); return -EINVAL; } return pci224_attach_common(dev, pci_dev, NULL); -- cgit v0.10.2 From 01ea83bce2d5219a71a044a084e3cecd6f0ad28e Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 31 May 2012 16:02:04 +0100 Subject: staging: comedi: amplc_pci224: Change return type of pci224_find_pci() pci224_find_pci() finds a supported PCI device, returning 0 on success or -EIO on failure and returning the pointer to the PCI device via a struct pci_dev ** parameter. Change it to return the struct pci_dev * on success or NULL on failure. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index a07546e0..4c41c28 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -1255,14 +1255,11 @@ static const struct pci224_board * This function looks for a PCI device matching the requested board name, * bus and slot. */ -static int -pci224_find_pci(struct comedi_device *dev, int bus, int slot, - struct pci_dev **pci_dev_p) +static struct pci_dev * +pci224_find_pci(struct comedi_device *dev, int bus, int slot) { struct pci_dev *pci_dev = NULL; - *pci_dev_p = NULL; - /* Look for matching PCI device. */ for (pci_dev = pci_get_device(PCI_VENDOR_ID_AMPLICON, PCI_ANY_ID, NULL); pci_dev != NULL; @@ -1289,8 +1286,7 @@ pci224_find_pci(struct comedi_device *dev, int bus, int slot, } /* Found a match. */ - *pci_dev_p = pci_dev; - return 0; + return pci_dev; } /* No match found. */ if (bus || slot) { @@ -1301,7 +1297,7 @@ pci224_find_pci(struct comedi_device *dev, int bus, int slot, dev_err(dev->class_dev, "error! no %s found!\n", thisboard->name); } - return -EIO; + return NULL; } static void pci224_report_attach(struct comedi_device *dev, unsigned int irq) @@ -1488,9 +1484,9 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) return ret; } - ret = pci224_find_pci(dev, bus, slot, &pci_dev); - if (ret < 0) - return ret; + pci_dev = pci224_find_pci(dev, bus, slot); + if (pci_dev == NULL) + return -EIO; return pci224_attach_common(dev, pci_dev, it->options); } -- cgit v0.10.2 From 9dc5a822ea8eaa2397f95aace504fcc657a6cd8b Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 31 May 2012 16:02:05 +0100 Subject: staging: comedi: amplc_pci224: Remove thisboard and devpriv macros The 'thisboard' and 'devpriv' macros rely on a local variable having a specific name and yield pointers derived from that local variable. Replace the macros with local variables wherever they occur. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index 4c41c28..43f07f8 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -377,11 +377,6 @@ static const struct pci224_board pci224_boards[] = { }, }; -/* - * Useful for shorthand access to the particular board structure - */ -#define thisboard ((struct pci224_board *)dev->board_ptr) - /* this structure is for data unique to this hardware driver. If several hardware drivers keep similar information in this structure, feel free to suggest moving the variable to the struct comedi_device struct. */ @@ -405,8 +400,6 @@ struct pci224_private { unsigned char intsce; }; -#define devpriv ((struct pci224_private *)dev->private) - /* * Called from the 'insn_write' function to perform a single write. */ @@ -414,6 +407,8 @@ static void pci224_ao_set_data(struct comedi_device *dev, int chan, int range, unsigned int data) { + const struct pci224_board *thisboard = comedi_board(dev); + struct pci224_private *devpriv = dev->private; unsigned short mangled; /* Store unmangled data for readback. */ @@ -476,6 +471,7 @@ static int pci224_ao_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct pci224_private *devpriv = dev->private; int i; int chan; @@ -504,6 +500,7 @@ pci224_cascade_ns_to_timer(int osc_base, unsigned int *d1, unsigned int *d2, static void pci224_ao_stop(struct comedi_device *dev, struct comedi_subdevice *s) { + struct pci224_private *devpriv = dev->private; unsigned long flags; if (!test_and_clear_bit(AO_CMD_STARTED, &devpriv->state)) @@ -547,6 +544,7 @@ static void pci224_ao_stop(struct comedi_device *dev, static void pci224_ao_start(struct comedi_device *dev, struct comedi_subdevice *s) { + struct pci224_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; unsigned long flags; @@ -575,6 +573,7 @@ static void pci224_ao_start(struct comedi_device *dev, static void pci224_ao_handle_fifo(struct comedi_device *dev, struct comedi_subdevice *s) { + struct pci224_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; unsigned int num_scans; unsigned int room; @@ -721,6 +720,7 @@ static int pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { + struct pci224_private *devpriv = dev->private; int err = 0; unsigned int tmp; @@ -991,6 +991,7 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, */ static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { + struct pci224_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; int range; unsigned int i, j; @@ -1163,6 +1164,8 @@ static void pci224_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s, void *data, unsigned int num_bytes, unsigned int chan_index) { + const struct pci224_board *thisboard = comedi_board(dev); + struct pci224_private *devpriv = dev->private; struct comedi_async *async = s->async; short *array = data; unsigned int length = num_bytes / sizeof(*array); @@ -1193,6 +1196,7 @@ pci224_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s, static irqreturn_t pci224_interrupt(int irq, void *d) { struct comedi_device *dev = d; + struct pci224_private *devpriv = dev->private; struct comedi_subdevice *s = &dev->subdevices[0]; struct comedi_cmd *cmd; unsigned char intstat, valid_intstat; @@ -1258,6 +1262,7 @@ static const struct pci224_board static struct pci_dev * pci224_find_pci(struct comedi_device *dev, int bus, int slot) { + const struct pci224_board *thisboard = comedi_board(dev); struct pci_dev *pci_dev = NULL; /* Look for matching PCI device. */ @@ -1279,6 +1284,7 @@ pci224_find_pci(struct comedi_device *dev, int bus, int slot) continue; /* Change board_ptr to matched board. */ dev->board_ptr = board_ptr; + thisboard = comedi_board(dev); } else { /* Match specific model name. */ if (thisboard->devid != pci_dev->device) @@ -1302,6 +1308,7 @@ pci224_find_pci(struct comedi_device *dev, int bus, int slot) static void pci224_report_attach(struct comedi_device *dev, unsigned int irq) { + struct pci224_private *devpriv = dev->private; char tmpbuf[30]; if (irq) @@ -1319,6 +1326,8 @@ static void pci224_report_attach(struct comedi_device *dev, unsigned int irq) static int pci224_attach_common(struct comedi_device *dev, struct pci_dev *pci_dev, int *options) { + const struct pci224_board *thisboard = comedi_board(dev); + struct pci224_private *devpriv = dev->private; struct comedi_subdevice *s; unsigned int irq; unsigned n; @@ -1516,6 +1525,8 @@ pci224_attach_pci(struct comedi_device *dev, struct pci_dev *pci_dev) static void pci224_detach(struct comedi_device *dev) { + struct pci224_private *devpriv = dev->private; + if (dev->irq) free_irq(dev->irq, dev); if (dev->subdevices) { -- cgit v0.10.2 From 4b05d17d8dcea60ccb1c39aaec60164dccdbc3e5 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 1 Jun 2012 17:31:39 +0100 Subject: staging: comedi: amplc_pci230: Replace printk calls Replace the printk calls with dev_info, dev_err, etc. A load of DPRINTK() macro calls which may result in printk() calls have been left alone to be tackled en masse at a later date. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index b05a684..512ead7 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -697,8 +697,8 @@ static int pci230_attach(struct comedi_device *dev, struct comedi_devconfig *it) struct pci_dev *pci_dev = NULL; int i = 0, irq_hdl, rc; - printk("comedi%d: amplc_pci230: attach %s %d,%d\n", dev->minor, - thisboard->name, it->options[0], it->options[1]); + dev_info(dev->class_dev, "amplc_pci230: attach %s %d,%d\n", + thisboard->name, it->options[0], it->options[1]); /* Allocate the private structure area using alloc_private(). * Macro defined in comedidev.h - memsets struct fields to 0. */ @@ -772,8 +772,7 @@ static int pci230_attach(struct comedi_device *dev, struct comedi_devconfig *it) } } if (!pci_dev) { - printk("comedi%d: No %s card found\n", dev->minor, - thisboard->name); + dev_err(dev->class_dev, "No %s card found\n", thisboard->name); return -EIO; } devpriv->pci_dev = pci_dev; @@ -785,8 +784,8 @@ static int pci230_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Enable PCI device and reserve I/O spaces. */ if (comedi_pci_enable(pci_dev, "amplc_pci230") < 0) { - printk("comedi%d: failed to enable PCI device " - "and request regions\n", dev->minor); + dev_err(dev->class_dev, + "failed to enable PCI device and request regions\n"); return -EIO; } @@ -795,8 +794,9 @@ static int pci230_attach(struct comedi_device *dev, struct comedi_devconfig *it) iobase1 = pci_resource_start(pci_dev, 2); iobase2 = pci_resource_start(pci_dev, 3); - printk("comedi%d: %s I/O region 1 0x%04lx I/O region 2 0x%04lx\n", - dev->minor, dev->board_name, iobase1, iobase2); + dev_dbg(dev->class_dev, + "%s I/O region 1 0x%04lx I/O region 2 0x%04lx\n", + dev->board_name, iobase1, iobase2); devpriv->iobase1 = iobase1; dev->iobase = iobase2; @@ -811,10 +811,10 @@ static int pci230_attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->hwver = inw(dev->iobase + PCI230P_HWVER); if (devpriv->hwver < thisboard->min_hwver) { - printk("comedi%d: %s - bad hardware version " - "- got %u, need %u\n", dev->minor, - dev->board_name, devpriv->hwver, - thisboard->min_hwver); + dev_err(dev->class_dev, + "%s - bad hardware version - got %u, need %u\n", + dev->board_name, devpriv->hwver, + thisboard->min_hwver); return -EIO; } if (devpriv->hwver > 0) { @@ -862,13 +862,13 @@ static int pci230_attach(struct comedi_device *dev, struct comedi_devconfig *it) irq_hdl = request_irq(devpriv->pci_dev->irq, pci230_interrupt, IRQF_SHARED, "amplc_pci230", dev); if (irq_hdl < 0) { - printk("comedi%d: unable to register irq, " - "commands will not be available %d\n", dev->minor, - devpriv->pci_dev->irq); + dev_warn(dev->class_dev, + "unable to register irq %u, commands will not be available\n", + devpriv->pci_dev->irq); } else { dev->irq = devpriv->pci_dev->irq; - printk("comedi%d: registered irq %u\n", dev->minor, - devpriv->pci_dev->irq); + dev_dbg(dev->class_dev, "registered irq %u\n", + devpriv->pci_dev->irq); } /* @@ -931,7 +931,7 @@ static int pci230_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->type = COMEDI_SUBD_UNUSED; } - printk("comedi%d: attached\n", dev->minor); + dev_info(dev->class_dev, "attached\n"); return 1; } @@ -1117,9 +1117,7 @@ static int pci230_ai_rinsn(struct comedi_device *dev, udelay(1); } if (i == TIMEOUT) { - /* printk() should be used instead of printk() - * whenever the code can be called from real-time. */ - printk("timeout\n"); + dev_err(dev->class_dev, "timeout\n"); return -ETIMEDOUT; } @@ -1992,13 +1990,9 @@ static int pci230_ai_cmdtest(struct comedi_device *dev, (s->n_chan / 2) - 1); } if ((errors & buggy_chan0_err) != 0) { - /* Use printk instead of DPRINTK here. */ - printk("comedi: comedi%d: amplc_pci230: " - "ai_cmdtest: Buggy PCI230+/260+ " - "h/w version %u requires first channel " - "of multi-channel sequence to be 0 " - "(corrected in h/w version 4)\n", - dev->minor, devpriv->hwver); + dev_info(dev->class_dev, + "amplc_pci230: ai_cmdtest: Buggy PCI230+/260+ h/w version %u requires first channel of multi-channel sequence to be 0 (corrected in h/w version 4)\n", + devpriv->hwver); } } } -- cgit v0.10.2 From 967bfbc2c90e456bdfc0ef045dd1e81221461c06 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 1 Jun 2012 17:31:40 +0100 Subject: staging: comedi: amplc_pci230: Remove thisboard and devpriv macros The 'thisboard' and 'devpriv' macros rely on a local variable having a specific name and yield pointers derived from that local variable. Replace the macros with local variables wherever they occur. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index 512ead7..6d3c6c9 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -499,11 +499,7 @@ static const struct pci230_board pci230_boards[] = { }, }; -/* - * Useful for shorthand access to the particular board structure - */ #define n_pci230_boards ARRAY_SIZE(pci230_boards) -#define thisboard ((const struct pci230_board *)dev->board_ptr) /* this structure is for data unique to this hardware driver. If several hardware drivers keep similar information in this structure, @@ -548,8 +544,6 @@ struct pci230_private { unsigned char res_owner[NUM_RESOURCES]; /* Shared resource owners. */ }; -#define devpriv ((struct pci230_private *)dev->private) - /* PCI230 clock source periods in ns */ static const unsigned int pci230_timebase[8] = { [CLK_10MHZ] = TIMEBASE_10MHZ, @@ -627,9 +621,12 @@ static void pci230_handle_ai(struct comedi_device *dev, static short pci230_ai_read(struct comedi_device *dev) { - /* Read sample. */ - short data = (short)inw(dev->iobase + PCI230_ADCDATA); + const struct pci230_board *thisboard = comedi_board(dev); + struct pci230_private *devpriv = dev->private; + short data; + /* Read sample. */ + data = (short)inw(dev->iobase + PCI230_ADCDATA); /* PCI230 is 12 bit - stored in upper bits of 16 bit register (lower * four bits reserved for expansion). */ /* PCI230+ is 16 bit AI. */ @@ -646,12 +643,14 @@ static short pci230_ai_read(struct comedi_device *dev) static inline unsigned short pci230_ao_mangle_datum(struct comedi_device *dev, short datum) { + const struct pci230_board *thisboard = comedi_board(dev); + struct pci230_private *devpriv = dev->private; + /* If a bipolar range was specified, mangle it (straight binary->twos * complement). */ if (devpriv->ao_bipolar) datum ^= 1 << (thisboard->ao_bits - 1); - /* PCI230 is 12 bit - stored in upper bits of 16 bit register (lower * four bits reserved for expansion). */ /* PCI230+ is also 12 bit AO. */ @@ -662,6 +661,8 @@ static inline unsigned short pci230_ao_mangle_datum(struct comedi_device *dev, static inline void pci230_ao_write_nofifo(struct comedi_device *dev, short datum, unsigned int chan) { + struct pci230_private *devpriv = dev->private; + /* Store unmangled datum to be read back later. */ devpriv->ao_readback[chan] = datum; @@ -675,6 +676,8 @@ static inline void pci230_ao_write_nofifo(struct comedi_device *dev, static inline void pci230_ao_write_fifo(struct comedi_device *dev, short datum, unsigned int chan) { + struct pci230_private *devpriv = dev->private; + /* Store unmangled datum to be read back later. */ devpriv->ao_readback[chan] = datum; @@ -691,6 +694,8 @@ static inline void pci230_ao_write_fifo(struct comedi_device *dev, short datum, */ static int pci230_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct pci230_board *thisboard = comedi_board(dev); + struct pci230_private *devpriv; struct comedi_subdevice *s; unsigned long iobase1, iobase2; /* PCI230's I/O spaces 1 and 2 respectively. */ @@ -704,6 +709,7 @@ static int pci230_attach(struct comedi_device *dev, struct comedi_devconfig *it) * Macro defined in comedidev.h - memsets struct fields to 0. */ if ((alloc_private(dev, sizeof(struct pci230_private))) < 0) return -ENOMEM; + devpriv = dev->private; spin_lock_init(&devpriv->isr_spinlock); spin_lock_init(&devpriv->res_spinlock); @@ -742,6 +748,7 @@ static int pci230_attach(struct comedi_device *dev, struct comedi_devconfig *it) } /* Change board_ptr to matched board */ dev->board_ptr = &pci230_boards[i]; + thisboard = comedi_board(dev); break; } } @@ -938,6 +945,9 @@ static int pci230_attach(struct comedi_device *dev, struct comedi_devconfig *it) static void pci230_detach(struct comedi_device *dev) { + const struct pci230_board *thisboard = comedi_board(dev); + struct pci230_private *devpriv = dev->private; + if (dev->subdevices && thisboard->have_dio) subdev_8255_cleanup(dev, dev->subdevices + 2); if (dev->irq) @@ -954,6 +964,7 @@ static void pci230_detach(struct comedi_device *dev) static int get_resources(struct comedi_device *dev, unsigned int res_mask, unsigned char owner) { + struct pci230_private *devpriv = dev->private; int ok; unsigned int i; unsigned int b; @@ -996,6 +1007,7 @@ static inline int get_one_resource(struct comedi_device *dev, static void put_resources(struct comedi_device *dev, unsigned int res_mask, unsigned char owner) { + struct pci230_private *devpriv = dev->private; unsigned int i; unsigned int b; unsigned long irqflags; @@ -1032,6 +1044,7 @@ static int pci230_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct pci230_private *devpriv = dev->private; unsigned int n, i; unsigned int chan, range, aref; unsigned int gainshift; @@ -1136,6 +1149,7 @@ static int pci230_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct pci230_private *devpriv = dev->private; int i; int chan, range; @@ -1165,6 +1179,7 @@ static int pci230_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct pci230_private *devpriv = dev->private; int i; int chan = CR_CHAN(insn->chanspec); @@ -1177,6 +1192,8 @@ static int pci230_ao_rinsn(struct comedi_device *dev, static int pci230_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { + const struct pci230_board *thisboard = comedi_board(dev); + struct pci230_private *devpriv = dev->private; int err = 0; unsigned int tmp; @@ -1390,6 +1407,7 @@ static int pci230_ao_inttrig_scan_begin(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int trig_num) { + struct pci230_private *devpriv = dev->private; unsigned long irqflags; if (trig_num != 0) @@ -1422,6 +1440,7 @@ static int pci230_ao_inttrig_scan_begin(struct comedi_device *dev, static void pci230_ao_start(struct comedi_device *dev, struct comedi_subdevice *s) { + struct pci230_private *devpriv = dev->private; struct comedi_async *async = s->async; struct comedi_cmd *cmd = &async->cmd; unsigned long irqflags; @@ -1523,6 +1542,7 @@ static int pci230_ao_inttrig_start(struct comedi_device *dev, static int pci230_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { + struct pci230_private *devpriv = dev->private; unsigned short daccon; unsigned int range; @@ -1625,6 +1645,8 @@ static int pci230_ai_check_scan_period(struct comedi_cmd *cmd) static int pci230_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { + const struct pci230_board *thisboard = comedi_board(dev); + struct pci230_private *devpriv = dev->private; int err = 0; unsigned int tmp; @@ -2006,6 +2028,7 @@ static int pci230_ai_cmdtest(struct comedi_device *dev, static void pci230_ai_update_fifo_trigger_level(struct comedi_device *dev, struct comedi_subdevice *s) { + struct pci230_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; unsigned int scanlen = cmd->scan_end_arg; unsigned int wake; @@ -2050,6 +2073,7 @@ static int pci230_ai_inttrig_convert(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int trig_num) { + struct pci230_private *devpriv = dev->private; unsigned long irqflags; if (trig_num != 0) @@ -2092,6 +2116,7 @@ static int pci230_ai_inttrig_scan_begin(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int trig_num) { + struct pci230_private *devpriv = dev->private; unsigned long irqflags; unsigned char zgat; @@ -2114,6 +2139,7 @@ static int pci230_ai_inttrig_scan_begin(struct comedi_device *dev, static void pci230_ai_start(struct comedi_device *dev, struct comedi_subdevice *s) { + struct pci230_private *devpriv = dev->private; unsigned long irqflags; unsigned short conv; struct comedi_async *async = s->async; @@ -2264,6 +2290,7 @@ static int pci230_ai_inttrig_start(struct comedi_device *dev, static int pci230_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { + struct pci230_private *devpriv = dev->private; unsigned int i, chan, range, diff; unsigned int res_mask; unsigned short adccon, adcen; @@ -2509,6 +2536,7 @@ static void pci230_ct_setup_ns_mode(struct comedi_device *dev, unsigned int ct, unsigned int mode, uint64_t ns, unsigned int round) { + struct pci230_private *devpriv = dev->private; unsigned int clk_src; unsigned int count; @@ -2527,6 +2555,8 @@ static void pci230_ct_setup_ns_mode(struct comedi_device *dev, unsigned int ct, static void pci230_cancel_ct(struct comedi_device *dev, unsigned int ct) { + struct pci230_private *devpriv = dev->private; + i8254_set_mode(devpriv->iobase1 + PCI230_Z2_CT_BASE, 0, ct, I8254_MODE1); /* Counter ct, 8254 mode 1, initial count not written. */ @@ -2537,6 +2567,7 @@ static irqreturn_t pci230_interrupt(int irq, void *d) { unsigned char status_int, valid_status_int; struct comedi_device *dev = (struct comedi_device *)d; + struct pci230_private *devpriv = dev->private; struct comedi_subdevice *s; unsigned long irqflags; @@ -2599,6 +2630,7 @@ static irqreturn_t pci230_interrupt(int irq, void *d) static void pci230_handle_ao_nofifo(struct comedi_device *dev, struct comedi_subdevice *s) { + struct pci230_private *devpriv = dev->private; short data; int i, ret; struct comedi_async *async = s->async; @@ -2637,6 +2669,7 @@ static void pci230_handle_ao_nofifo(struct comedi_device *dev, static int pci230_handle_ao_fifo(struct comedi_device *dev, struct comedi_subdevice *s) { + struct pci230_private *devpriv = dev->private; struct comedi_async *async = s->async; struct comedi_cmd *cmd = &async->cmd; unsigned int num_scans; @@ -2742,6 +2775,7 @@ static int pci230_handle_ao_fifo(struct comedi_device *dev, static void pci230_handle_ai(struct comedi_device *dev, struct comedi_subdevice *s) { + struct pci230_private *devpriv = dev->private; unsigned int events = 0; unsigned int status_fifo; unsigned int i; @@ -2842,6 +2876,7 @@ static void pci230_handle_ai(struct comedi_device *dev, static void pci230_ao_stop(struct comedi_device *dev, struct comedi_subdevice *s) { + struct pci230_private *devpriv = dev->private; unsigned long irqflags; unsigned char intsrc; int started; @@ -2905,6 +2940,7 @@ static int pci230_ao_cancel(struct comedi_device *dev, static void pci230_ai_stop(struct comedi_device *dev, struct comedi_subdevice *s) { + struct pci230_private *devpriv = dev->private; unsigned long irqflags; struct comedi_cmd *cmd; int started; -- cgit v0.10.2 From ba54fa6893aa72159c046c6099f7644df745feea Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 1 Jun 2012 17:31:41 +0100 Subject: staging: comedi: amplc_pci230: Add attach_pci() hook Implement the attach_pci() hook as function pci230_attach_pci(). This is called by comedi_pci_auto_config() in preference to the old attach() hook (implemented by pci230_attach() and still required for "manual" configuration of comedi devices). The advantage of the attach_pci() hook is that it avoids searching for the PCI device. Refactor pci230_attach() and factor out code common to pci230_attach() and pci230_attach_pci() into new functions pci230_match_pci_board(), pci230_find_pci_board(), pci230_find_pci(), pci230_alloc_private() and pci230_attach_common(). Finally, move pci230_attach() and pci230_detach() along with all the new functions towards the bottom of the file as it makes the patch much cleaner (though longer) and I plan to move things around soon to get rid of the remaining forward references. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index 6d3c6c9..fbc9da9 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -499,8 +499,6 @@ static const struct pci230_board pci230_boards[] = { }, }; -#define n_pci230_boards ARRAY_SIZE(pci230_boards) - /* this structure is for data unique to this hardware driver. If several hardware drivers keep similar information in this structure, feel free to suggest moving the variable to the struct comedi_device struct. */ @@ -686,281 +684,6 @@ static inline void pci230_ao_write_fifo(struct comedi_device *dev, short datum, dev->iobase + PCI230P2_DACDATA); } -/* - * Attach is called by the Comedi core to configure the driver - * for a particular board. If you specified a board_name array - * in the driver structure, dev->board_ptr contains that - * address. - */ -static int pci230_attach(struct comedi_device *dev, struct comedi_devconfig *it) -{ - const struct pci230_board *thisboard = comedi_board(dev); - struct pci230_private *devpriv; - struct comedi_subdevice *s; - unsigned long iobase1, iobase2; - /* PCI230's I/O spaces 1 and 2 respectively. */ - struct pci_dev *pci_dev = NULL; - int i = 0, irq_hdl, rc; - - dev_info(dev->class_dev, "amplc_pci230: attach %s %d,%d\n", - thisboard->name, it->options[0], it->options[1]); - - /* Allocate the private structure area using alloc_private(). - * Macro defined in comedidev.h - memsets struct fields to 0. */ - if ((alloc_private(dev, sizeof(struct pci230_private))) < 0) - return -ENOMEM; - devpriv = dev->private; - - spin_lock_init(&devpriv->isr_spinlock); - spin_lock_init(&devpriv->res_spinlock); - spin_lock_init(&devpriv->ai_stop_spinlock); - spin_lock_init(&devpriv->ao_stop_spinlock); - /* Find card */ - for_each_pci_dev(pci_dev) { - if (it->options[0] || it->options[1]) { - /* Match against bus/slot options. */ - if (it->options[0] != pci_dev->bus->number || - it->options[1] != PCI_SLOT(pci_dev->devfn)) - continue; - } - if (pci_dev->vendor != PCI_VENDOR_ID_AMPLICON) - continue; - if (thisboard->id == PCI_DEVICE_ID_INVALID) { - /* The name was specified as "amplc_pci230" which is - * used to match any supported device. Replace the - * current dev->board_ptr with one that matches the - * PCI device ID. */ - for (i = 0; i < n_pci230_boards; i++) { - if (pci_dev->device == pci230_boards[i].id) { - if (pci230_boards[i].min_hwver > 0) { - /* Check for a '+' model. - * First check length of - * registers. */ - if (pci_resource_len(pci_dev, 3) - < 32) { - /* Not a '+' model. */ - continue; - } - /* TODO: temporarily enable the - * PCI device and read the - * hardware version register. - * For now assume it's okay. */ - } - /* Change board_ptr to matched board */ - dev->board_ptr = &pci230_boards[i]; - thisboard = comedi_board(dev); - break; - } - } - if (i < n_pci230_boards) - break; - } else { - /* The name was specified as a specific device name. - * The current dev->board_ptr is correct. Check - * whether it matches the PCI device ID. */ - if (thisboard->id == pci_dev->device) { - /* Check minimum hardware version. */ - if (thisboard->min_hwver > 0) { - /* Looking for a '+' model. First - * check length of registers. */ - if (pci_resource_len(pci_dev, 3) < 32) { - /* Not a '+' model. */ - continue; - } - /* TODO: temporarily enable the PCI - * device and read the hardware version - * register. For now, assume it's - * okay. */ - break; - } else { - break; - } - } - } - } - if (!pci_dev) { - dev_err(dev->class_dev, "No %s card found\n", thisboard->name); - return -EIO; - } - devpriv->pci_dev = pci_dev; - - /* - * Initialize dev->board_name. - */ - dev->board_name = thisboard->name; - - /* Enable PCI device and reserve I/O spaces. */ - if (comedi_pci_enable(pci_dev, "amplc_pci230") < 0) { - dev_err(dev->class_dev, - "failed to enable PCI device and request regions\n"); - return -EIO; - } - - /* Read base addresses of the PCI230's two I/O regions from PCI - * configuration register. */ - iobase1 = pci_resource_start(pci_dev, 2); - iobase2 = pci_resource_start(pci_dev, 3); - - dev_dbg(dev->class_dev, - "%s I/O region 1 0x%04lx I/O region 2 0x%04lx\n", - dev->board_name, iobase1, iobase2); - - devpriv->iobase1 = iobase1; - dev->iobase = iobase2; - - /* Read bits of DACCON register - only the output range. */ - devpriv->daccon = inw(dev->iobase + PCI230_DACCON) & PCI230_DAC_OR_MASK; - - /* Read hardware version register and set extended function register - * if they exist. */ - if (pci_resource_len(pci_dev, 3) >= 32) { - unsigned short extfunc = 0; - - devpriv->hwver = inw(dev->iobase + PCI230P_HWVER); - if (devpriv->hwver < thisboard->min_hwver) { - dev_err(dev->class_dev, - "%s - bad hardware version - got %u, need %u\n", - dev->board_name, devpriv->hwver, - thisboard->min_hwver); - return -EIO; - } - if (devpriv->hwver > 0) { - if (!thisboard->have_dio) { - /* No DIO ports. Route counters' external gates - * to the EXTTRIG signal (PCI260+ pin 17). - * (Otherwise, they would be routed to DIO - * inputs PC0, PC1 and PC2 which don't exist - * on PCI260[+].) */ - extfunc |= PCI230P_EXTFUNC_GAT_EXTTRIG; - } - if ((thisboard->ao_chans > 0) - && (devpriv->hwver >= 2)) { - /* Enable DAC FIFO functionality. */ - extfunc |= PCI230P2_EXTFUNC_DACFIFO; - } - } - outw(extfunc, dev->iobase + PCI230P_EXTFUNC); - if ((extfunc & PCI230P2_EXTFUNC_DACFIFO) != 0) { - /* Temporarily enable DAC FIFO, reset it and disable - * FIFO wraparound. */ - outw(devpriv->daccon | PCI230P2_DAC_FIFO_EN - | PCI230P2_DAC_FIFO_RESET, - dev->iobase + PCI230_DACCON); - /* Clear DAC FIFO channel enable register. */ - outw(0, dev->iobase + PCI230P2_DACEN); - /* Disable DAC FIFO. */ - outw(devpriv->daccon, dev->iobase + PCI230_DACCON); - } - } - - /* Disable board's interrupts. */ - outb(0, devpriv->iobase1 + PCI230_INT_SCE); - - /* Set ADC to a reasonable state. */ - devpriv->adcg = 0; - devpriv->adccon = PCI230_ADC_TRIG_NONE | PCI230_ADC_IM_SE - | PCI230_ADC_IR_BIP; - outw(1 << 0, dev->iobase + PCI230_ADCEN); - outw(devpriv->adcg, dev->iobase + PCI230_ADCG); - outw(devpriv->adccon | PCI230_ADC_FIFO_RESET, - dev->iobase + PCI230_ADCCON); - - /* Register the interrupt handler. */ - irq_hdl = request_irq(devpriv->pci_dev->irq, pci230_interrupt, - IRQF_SHARED, "amplc_pci230", dev); - if (irq_hdl < 0) { - dev_warn(dev->class_dev, - "unable to register irq %u, commands will not be available\n", - devpriv->pci_dev->irq); - } else { - dev->irq = devpriv->pci_dev->irq; - dev_dbg(dev->class_dev, "registered irq %u\n", - devpriv->pci_dev->irq); - } - - /* - * Allocate the subdevice structures. alloc_subdevice() is a - * convenient macro defined in comedidev.h. - */ - if (alloc_subdevices(dev, 3) < 0) - return -ENOMEM; - - s = dev->subdevices + 0; - /* analog input subdevice */ - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_DIFF | SDF_GROUND; - s->n_chan = thisboard->ai_chans; - s->maxdata = (1 << thisboard->ai_bits) - 1; - s->range_table = &pci230_ai_range; - s->insn_read = &pci230_ai_rinsn; - s->len_chanlist = 256; /* but there are restrictions. */ - /* Only register commands if the interrupt handler is installed. */ - if (irq_hdl == 0) { - dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->do_cmd = &pci230_ai_cmd; - s->do_cmdtest = &pci230_ai_cmdtest; - s->cancel = pci230_ai_cancel; - } - - s = dev->subdevices + 1; - /* analog output subdevice */ - if (thisboard->ao_chans > 0) { - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_GROUND; - s->n_chan = thisboard->ao_chans; - s->maxdata = (1 << thisboard->ao_bits) - 1; - s->range_table = &pci230_ao_range; - s->insn_write = &pci230_ao_winsn; - s->insn_read = &pci230_ao_rinsn; - s->len_chanlist = thisboard->ao_chans; - /* Only register commands if the interrupt handler is - * installed. */ - if (irq_hdl == 0) { - dev->write_subdev = s; - s->subdev_flags |= SDF_CMD_WRITE; - s->do_cmd = &pci230_ao_cmd; - s->do_cmdtest = &pci230_ao_cmdtest; - s->cancel = pci230_ao_cancel; - } - } else { - s->type = COMEDI_SUBD_UNUSED; - } - - s = dev->subdevices + 2; - /* digital i/o subdevice */ - if (thisboard->have_dio) { - rc = subdev_8255_init(dev, s, NULL, - (devpriv->iobase1 + PCI230_PPI_X_BASE)); - if (rc < 0) - return rc; - } else { - s->type = COMEDI_SUBD_UNUSED; - } - - dev_info(dev->class_dev, "attached\n"); - - return 1; -} - -static void pci230_detach(struct comedi_device *dev) -{ - const struct pci230_board *thisboard = comedi_board(dev); - struct pci230_private *devpriv = dev->private; - - if (dev->subdevices && thisboard->have_dio) - subdev_8255_cleanup(dev, dev->subdevices + 2); - if (dev->irq) - free_irq(dev->irq, dev); - if (devpriv) { - if (devpriv->pci_dev) { - if (dev->iobase) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); - } - } -} - static int get_resources(struct comedi_device *dev, unsigned int res_mask, unsigned char owner) { @@ -2995,10 +2718,311 @@ static int pci230_ai_cancel(struct comedi_device *dev, return 0; } +/* Check if PCI device matches a specific board. */ +static bool pci230_match_pci_board(const struct pci230_board *board, + struct pci_dev *pci_dev) +{ + /* assume pci_dev->device != PCI_DEVICE_ID_INVALID */ + if (board->id != pci_dev->device) + return false; + if (board->min_hwver == 0) + return true; + /* Looking for a '+' model. First check length of registers. */ + if (pci_resource_len(pci_dev, 3) < 32) + return false; /* Not a '+' model. */ + /* TODO: temporarily enable PCI device and read the hardware version + * register. For now, assume it's okay. */ + return true; +} + +/* Look for board matching PCI device. */ +static const struct pci230_board *pci230_find_pci_board(struct pci_dev *pci_dev) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(pci230_boards); i++) + if (pci230_match_pci_board(&pci230_boards[i], pci_dev)) + return &pci230_boards[i]; + return NULL; +} + +/* Look for PCI device matching requested board name, bus and slot. */ +static struct pci_dev *pci230_find_pci(struct comedi_device *dev, + int bus, int slot) +{ + const struct pci230_board *thisboard = comedi_board(dev); + struct pci_dev *pci_dev = NULL; + + for_each_pci_dev(pci_dev) { + /* Check vendor ID (same for all supported PCI boards). */ + if (pci_dev->vendor != PCI_VENDOR_ID_AMPLICON) + continue; + /* If bus/slot specified, check them. */ + if ((bus || slot) && + (bus != pci_dev->bus->number || + slot != PCI_SLOT(pci_dev->devfn))) + continue; + if (thisboard->id == PCI_DEVICE_ID_INVALID) { + /* Wildcard board matches any supported PCI board. */ + const struct pci230_board *foundboard; + + foundboard = pci230_find_pci_board(pci_dev); + if (foundboard == NULL) + continue; + /* Replace wildcard board_ptr. */ + dev->board_ptr = foundboard; + thisboard = comedi_board(dev); + } else { + /* Need to match a specific board. */ + if (!pci230_match_pci_board(thisboard, pci_dev)) + continue; + } + /* Found a matching PCI device. */ + return pci_dev; + } + /* No matching PCI device found. */ + if (bus || slot) + dev_err(dev->class_dev, + "error! no %s found at pci %02x:%02x\n", + thisboard->name, bus, slot); + else + dev_err(dev->class_dev, + "error! no %s found\n", thisboard->name); + return NULL; +} + +static int pci230_alloc_private(struct comedi_device *dev) +{ + struct pci230_private *devpriv; + int err; + + /* sets dev->private to allocated memory */ + err = alloc_private(dev, sizeof(struct pci230_private)); + if (err) { + dev_err(dev->class_dev, "error! out of memory!\n"); + return err; + } + devpriv = dev->private; + spin_lock_init(&devpriv->isr_spinlock); + spin_lock_init(&devpriv->res_spinlock); + spin_lock_init(&devpriv->ai_stop_spinlock); + spin_lock_init(&devpriv->ao_stop_spinlock); + return 0; +} + +/* Common part of attach and attach_pci. */ +static int pci230_attach_common(struct comedi_device *dev, + struct pci_dev *pci_dev) +{ + const struct pci230_board *thisboard = comedi_board(dev); + struct pci230_private *devpriv = dev->private; + struct comedi_subdevice *s; + unsigned long iobase1, iobase2; + /* PCI230's I/O spaces 1 and 2 respectively. */ + int irq_hdl, rc; + + devpriv->pci_dev = pci_dev; + dev->board_name = thisboard->name; + /* Enable PCI device and reserve I/O spaces. */ + if (comedi_pci_enable(pci_dev, "amplc_pci230") < 0) { + dev_err(dev->class_dev, + "failed to enable PCI device and request regions\n"); + return -EIO; + } + /* Read base addresses of the PCI230's two I/O regions from PCI + * configuration register. */ + iobase1 = pci_resource_start(pci_dev, 2); + iobase2 = pci_resource_start(pci_dev, 3); + dev_dbg(dev->class_dev, + "%s I/O region 1 0x%04lx I/O region 2 0x%04lx\n", + dev->board_name, iobase1, iobase2); + devpriv->iobase1 = iobase1; + dev->iobase = iobase2; + /* Read bits of DACCON register - only the output range. */ + devpriv->daccon = inw(dev->iobase + PCI230_DACCON) & PCI230_DAC_OR_MASK; + /* Read hardware version register and set extended function register + * if they exist. */ + if (pci_resource_len(pci_dev, 3) >= 32) { + unsigned short extfunc = 0; + + devpriv->hwver = inw(dev->iobase + PCI230P_HWVER); + if (devpriv->hwver < thisboard->min_hwver) { + dev_err(dev->class_dev, + "%s - bad hardware version - got %u, need %u\n", + dev->board_name, devpriv->hwver, + thisboard->min_hwver); + return -EIO; + } + if (devpriv->hwver > 0) { + if (!thisboard->have_dio) { + /* No DIO ports. Route counters' external gates + * to the EXTTRIG signal (PCI260+ pin 17). + * (Otherwise, they would be routed to DIO + * inputs PC0, PC1 and PC2 which don't exist + * on PCI260[+].) */ + extfunc |= PCI230P_EXTFUNC_GAT_EXTTRIG; + } + if ((thisboard->ao_chans > 0) + && (devpriv->hwver >= 2)) { + /* Enable DAC FIFO functionality. */ + extfunc |= PCI230P2_EXTFUNC_DACFIFO; + } + } + outw(extfunc, dev->iobase + PCI230P_EXTFUNC); + if ((extfunc & PCI230P2_EXTFUNC_DACFIFO) != 0) { + /* Temporarily enable DAC FIFO, reset it and disable + * FIFO wraparound. */ + outw(devpriv->daccon | PCI230P2_DAC_FIFO_EN + | PCI230P2_DAC_FIFO_RESET, + dev->iobase + PCI230_DACCON); + /* Clear DAC FIFO channel enable register. */ + outw(0, dev->iobase + PCI230P2_DACEN); + /* Disable DAC FIFO. */ + outw(devpriv->daccon, dev->iobase + PCI230_DACCON); + } + } + /* Disable board's interrupts. */ + outb(0, devpriv->iobase1 + PCI230_INT_SCE); + /* Set ADC to a reasonable state. */ + devpriv->adcg = 0; + devpriv->adccon = PCI230_ADC_TRIG_NONE | PCI230_ADC_IM_SE + | PCI230_ADC_IR_BIP; + outw(1 << 0, dev->iobase + PCI230_ADCEN); + outw(devpriv->adcg, dev->iobase + PCI230_ADCG); + outw(devpriv->adccon | PCI230_ADC_FIFO_RESET, + dev->iobase + PCI230_ADCCON); + /* Register the interrupt handler. */ + irq_hdl = request_irq(devpriv->pci_dev->irq, pci230_interrupt, + IRQF_SHARED, "amplc_pci230", dev); + if (irq_hdl < 0) { + dev_warn(dev->class_dev, + "unable to register irq %u, commands will not be available\n", + devpriv->pci_dev->irq); + } else { + dev->irq = devpriv->pci_dev->irq; + dev_dbg(dev->class_dev, "registered irq %u\n", + devpriv->pci_dev->irq); + } + /* + * Allocate the subdevice structures. alloc_subdevice() is a + * convenient macro defined in comedidev.h. + */ + if (alloc_subdevices(dev, 3) < 0) + return -ENOMEM; + s = dev->subdevices + 0; + /* analog input subdevice */ + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_DIFF | SDF_GROUND; + s->n_chan = thisboard->ai_chans; + s->maxdata = (1 << thisboard->ai_bits) - 1; + s->range_table = &pci230_ai_range; + s->insn_read = &pci230_ai_rinsn; + s->len_chanlist = 256; /* but there are restrictions. */ + /* Only register commands if the interrupt handler is installed. */ + if (irq_hdl == 0) { + dev->read_subdev = s; + s->subdev_flags |= SDF_CMD_READ; + s->do_cmd = &pci230_ai_cmd; + s->do_cmdtest = &pci230_ai_cmdtest; + s->cancel = pci230_ai_cancel; + } + s = dev->subdevices + 1; + /* analog output subdevice */ + if (thisboard->ao_chans > 0) { + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_GROUND; + s->n_chan = thisboard->ao_chans; + s->maxdata = (1 << thisboard->ao_bits) - 1; + s->range_table = &pci230_ao_range; + s->insn_write = &pci230_ao_winsn; + s->insn_read = &pci230_ao_rinsn; + s->len_chanlist = thisboard->ao_chans; + /* Only register commands if the interrupt handler is + * installed. */ + if (irq_hdl == 0) { + dev->write_subdev = s; + s->subdev_flags |= SDF_CMD_WRITE; + s->do_cmd = &pci230_ao_cmd; + s->do_cmdtest = &pci230_ao_cmdtest; + s->cancel = pci230_ao_cancel; + } + } else { + s->type = COMEDI_SUBD_UNUSED; + } + s = dev->subdevices + 2; + /* digital i/o subdevice */ + if (thisboard->have_dio) { + rc = subdev_8255_init(dev, s, NULL, + (devpriv->iobase1 + PCI230_PPI_X_BASE)); + if (rc < 0) + return rc; + } else { + s->type = COMEDI_SUBD_UNUSED; + } + dev_info(dev->class_dev, "attached\n"); + return 1; +} + +static int pci230_attach(struct comedi_device *dev, struct comedi_devconfig *it) +{ + const struct pci230_board *thisboard = comedi_board(dev); + struct pci_dev *pci_dev; + int rc; + + dev_info(dev->class_dev, "amplc_pci230: attach %s %d,%d\n", + thisboard->name, it->options[0], it->options[1]); + rc = pci230_alloc_private(dev); /* sets dev->private */ + if (rc) + return rc; + /* Find card. */ + pci_dev = pci230_find_pci(dev, it->options[0], it->options[1]); + if (!pci_dev) + return -EIO; + return pci230_attach_common(dev, pci_dev); +} + +static int __devinit pci230_attach_pci(struct comedi_device *dev, + struct pci_dev *pci_dev) +{ + int rc; + + dev_info(dev->class_dev, "amplc_pci230: attach pci %s\n", + pci_name(pci_dev)); + rc = pci230_alloc_private(dev); /* sets dev->private */ + if (rc) + return rc; + dev->board_ptr = pci230_find_pci_board(pci_dev); + if (dev->board_ptr == NULL) { + dev_err(dev->class_dev, + "amplc_pci230: BUG! cannot determine board type!\n"); + return -EINVAL; + } + return pci230_attach_common(dev, pci_dev); +} + +static void pci230_detach(struct comedi_device *dev) +{ + const struct pci230_board *thisboard = comedi_board(dev); + struct pci230_private *devpriv = dev->private; + + if (dev->subdevices && thisboard->have_dio) + subdev_8255_cleanup(dev, dev->subdevices + 2); + if (dev->irq) + free_irq(dev->irq, dev); + if (devpriv) { + if (devpriv->pci_dev) { + if (dev->iobase) + comedi_pci_disable(devpriv->pci_dev); + pci_dev_put(devpriv->pci_dev); + } + } +} + static struct comedi_driver amplc_pci230_driver = { .driver_name = "amplc_pci230", .module = THIS_MODULE, .attach = pci230_attach, + .attach_pci = pci230_attach_pci, .detach = pci230_detach, .board_name = &pci230_boards[0].name, .offset = sizeof(pci230_boards[0]), -- cgit v0.10.2 From 027ee06835e96d425998003fe0b60ab128581fd6 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 1 Jun 2012 17:31:42 +0100 Subject: staging: comedi: amplc_pci230: Remove forward declarations 1 Remove the redundant forward function declarations. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index fbc9da9..a99e90f 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -579,39 +579,17 @@ static const struct comedi_lrange pci230_ao_range = { 2, { /* PCI230 daccon bipolar flag for each analogue output range. */ static const unsigned char pci230_ao_bipolar[2] = { 0, 1 }; -static int pci230_ai_rinsn(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, - unsigned int *data); -static int pci230_ao_winsn(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, - unsigned int *data); -static int pci230_ao_rinsn(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, - unsigned int *data); static void pci230_ct_setup_ns_mode(struct comedi_device *dev, unsigned int ct, unsigned int mode, uint64_t ns, unsigned int round); static void pci230_ns_to_single_timer(unsigned int *ns, unsigned int round); static void pci230_cancel_ct(struct comedi_device *dev, unsigned int ct); -static irqreturn_t pci230_interrupt(int irq, void *d); -static int pci230_ao_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_cmd *cmd); -static int pci230_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s); -static int pci230_ao_cancel(struct comedi_device *dev, - struct comedi_subdevice *s); static void pci230_ao_stop(struct comedi_device *dev, struct comedi_subdevice *s); static void pci230_handle_ao_nofifo(struct comedi_device *dev, struct comedi_subdevice *s); static int pci230_handle_ao_fifo(struct comedi_device *dev, struct comedi_subdevice *s); -static int pci230_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_cmd *cmd); -static int pci230_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s); -static int pci230_ai_cancel(struct comedi_device *dev, - struct comedi_subdevice *s); static void pci230_ai_stop(struct comedi_device *dev, struct comedi_subdevice *s); static void pci230_handle_ai(struct comedi_device *dev, -- cgit v0.10.2 From 091e8d8ff434f5e6e67dcfd742e2df8cac999ce4 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 1 Jun 2012 17:31:43 +0100 Subject: staging: comedi: amplc_pci230: Remove forward declarations 2 Remove some forward function declarations: pci230_ct_setup_ns_mode(), pci230_ns_to_single_timer(), pci230_cancel_ct(). Also need to move: divide_ns(). Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index a99e90f..d028962 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -579,11 +579,6 @@ static const struct comedi_lrange pci230_ao_range = { 2, { /* PCI230 daccon bipolar flag for each analogue output range. */ static const unsigned char pci230_ao_bipolar[2] = { 0, 1 }; -static void pci230_ct_setup_ns_mode(struct comedi_device *dev, unsigned int ct, - unsigned int mode, uint64_t ns, - unsigned int round); -static void pci230_ns_to_single_timer(unsigned int *ns, unsigned int round); -static void pci230_cancel_ct(struct comedi_device *dev, unsigned int ct); static void pci230_ao_stop(struct comedi_device *dev, struct comedi_subdevice *s); static void pci230_handle_ao_nofifo(struct comedi_device *dev, @@ -738,6 +733,86 @@ static inline void put_all_resources(struct comedi_device *dev, put_resources(dev, (1U << NUM_RESOURCES) - 1, owner); } +static unsigned int divide_ns(uint64_t ns, unsigned int timebase, + unsigned int round_mode) +{ + uint64_t div; + unsigned int rem; + + div = ns; + rem = do_div(div, timebase); + round_mode &= TRIG_ROUND_MASK; + switch (round_mode) { + default: + case TRIG_ROUND_NEAREST: + div += (rem + (timebase / 2)) / timebase; + break; + case TRIG_ROUND_DOWN: + break; + case TRIG_ROUND_UP: + div += (rem + timebase - 1) / timebase; + break; + } + return div > UINT_MAX ? UINT_MAX : (unsigned int)div; +} + +/* Given desired period in ns, returns the required internal clock source + * and gets the initial count. */ +static unsigned int pci230_choose_clk_count(uint64_t ns, unsigned int *count, + unsigned int round_mode) +{ + unsigned int clk_src, cnt; + + for (clk_src = CLK_10MHZ;; clk_src++) { + cnt = divide_ns(ns, pci230_timebase[clk_src], round_mode); + if ((cnt <= 65536) || (clk_src == CLK_1KHZ)) + break; + + } + *count = cnt; + return clk_src; +} + +static void pci230_ns_to_single_timer(unsigned int *ns, unsigned int round) +{ + unsigned int count; + unsigned int clk_src; + + clk_src = pci230_choose_clk_count(*ns, &count, round); + *ns = count * pci230_timebase[clk_src]; + return; +} + +static void pci230_ct_setup_ns_mode(struct comedi_device *dev, unsigned int ct, + unsigned int mode, uint64_t ns, + unsigned int round) +{ + struct pci230_private *devpriv = dev->private; + unsigned int clk_src; + unsigned int count; + + /* Set mode. */ + i8254_set_mode(devpriv->iobase1 + PCI230_Z2_CT_BASE, 0, ct, mode); + /* Determine clock source and count. */ + clk_src = pci230_choose_clk_count(ns, &count, round); + /* Program clock source. */ + outb(CLK_CONFIG(ct, clk_src), devpriv->iobase1 + PCI230_ZCLK_SCE); + /* Set initial count. */ + if (count >= 65536) + count = 0; + + i8254_write(devpriv->iobase1 + PCI230_Z2_CT_BASE, 0, ct, count); +} + +static void pci230_cancel_ct(struct comedi_device *dev, unsigned int ct) +{ + struct pci230_private *devpriv = dev->private; + + i8254_set_mode(devpriv->iobase1 + PCI230_Z2_CT_BASE, 0, ct, + I8254_MODE1); + /* Counter ct, 8254 mode 1, initial count not written. */ +} + /* * COMEDI_SUBD_AI instruction; */ @@ -2183,86 +2258,6 @@ static int pci230_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) return 0; } -static unsigned int divide_ns(uint64_t ns, unsigned int timebase, - unsigned int round_mode) -{ - uint64_t div; - unsigned int rem; - - div = ns; - rem = do_div(div, timebase); - round_mode &= TRIG_ROUND_MASK; - switch (round_mode) { - default: - case TRIG_ROUND_NEAREST: - div += (rem + (timebase / 2)) / timebase; - break; - case TRIG_ROUND_DOWN: - break; - case TRIG_ROUND_UP: - div += (rem + timebase - 1) / timebase; - break; - } - return div > UINT_MAX ? UINT_MAX : (unsigned int)div; -} - -/* Given desired period in ns, returns the required internal clock source - * and gets the initial count. */ -static unsigned int pci230_choose_clk_count(uint64_t ns, unsigned int *count, - unsigned int round_mode) -{ - unsigned int clk_src, cnt; - - for (clk_src = CLK_10MHZ;; clk_src++) { - cnt = divide_ns(ns, pci230_timebase[clk_src], round_mode); - if ((cnt <= 65536) || (clk_src == CLK_1KHZ)) - break; - - } - *count = cnt; - return clk_src; -} - -static void pci230_ns_to_single_timer(unsigned int *ns, unsigned int round) -{ - unsigned int count; - unsigned int clk_src; - - clk_src = pci230_choose_clk_count(*ns, &count, round); - *ns = count * pci230_timebase[clk_src]; - return; -} - -static void pci230_ct_setup_ns_mode(struct comedi_device *dev, unsigned int ct, - unsigned int mode, uint64_t ns, - unsigned int round) -{ - struct pci230_private *devpriv = dev->private; - unsigned int clk_src; - unsigned int count; - - /* Set mode. */ - i8254_set_mode(devpriv->iobase1 + PCI230_Z2_CT_BASE, 0, ct, mode); - /* Determine clock source and count. */ - clk_src = pci230_choose_clk_count(ns, &count, round); - /* Program clock source. */ - outb(CLK_CONFIG(ct, clk_src), devpriv->iobase1 + PCI230_ZCLK_SCE); - /* Set initial count. */ - if (count >= 65536) - count = 0; - - i8254_write(devpriv->iobase1 + PCI230_Z2_CT_BASE, 0, ct, count); -} - -static void pci230_cancel_ct(struct comedi_device *dev, unsigned int ct) -{ - struct pci230_private *devpriv = dev->private; - - i8254_set_mode(devpriv->iobase1 + PCI230_Z2_CT_BASE, 0, ct, - I8254_MODE1); - /* Counter ct, 8254 mode 1, initial count not written. */ -} - /* Interrupt handler */ static irqreturn_t pci230_interrupt(int irq, void *d) { -- cgit v0.10.2 From bd4447e597e0609fccb91aeeb2add40a7fcf3289 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 1 Jun 2012 17:31:44 +0100 Subject: staging: comedi: amplc_pci230: Remove forward declarations 3 Move these functions and remove their forward declarations: pci230_ao_stop(), pci230_handle_ao_nofifo(), pci230_handle_ao_fifo(). Also move pci230_ao_cancel() for aesthetic reasons. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index d028962..0e9c4ba 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -579,12 +579,6 @@ static const struct comedi_lrange pci230_ao_range = { 2, { /* PCI230 daccon bipolar flag for each analogue output range. */ static const unsigned char pci230_ao_bipolar[2] = { 0, 1 }; -static void pci230_ao_stop(struct comedi_device *dev, - struct comedi_subdevice *s); -static void pci230_handle_ao_nofifo(struct comedi_device *dev, - struct comedi_subdevice *s); -static int pci230_handle_ao_fifo(struct comedi_device *dev, - struct comedi_subdevice *s); static void pci230_ai_stop(struct comedi_device *dev, struct comedi_subdevice *s); static void pci230_handle_ai(struct comedi_device *dev, @@ -1179,6 +1173,196 @@ static int pci230_ao_cmdtest(struct comedi_device *dev, return 0; } +static void pci230_ao_stop(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + struct pci230_private *devpriv = dev->private; + unsigned long irqflags; + unsigned char intsrc; + int started; + struct comedi_cmd *cmd; + + spin_lock_irqsave(&devpriv->ao_stop_spinlock, irqflags); + started = test_and_clear_bit(AO_CMD_STARTED, &devpriv->state); + spin_unlock_irqrestore(&devpriv->ao_stop_spinlock, irqflags); + if (!started) + return; + cmd = &s->async->cmd; + if (cmd->scan_begin_src == TRIG_TIMER) { + /* Stop scan rate generator. */ + pci230_cancel_ct(dev, 1); + } + /* Determine interrupt source. */ + if (devpriv->hwver < 2) { + /* Not using DAC FIFO. Using CT1 interrupt. */ + intsrc = PCI230_INT_ZCLK_CT1; + } else { + /* Using DAC FIFO interrupt. */ + intsrc = PCI230P2_INT_DAC; + } + /* Disable interrupt and wait for interrupt routine to finish running + * unless we are called from the interrupt routine. */ + spin_lock_irqsave(&devpriv->isr_spinlock, irqflags); + devpriv->int_en &= ~intsrc; + while (devpriv->intr_running && devpriv->intr_cpuid != THISCPU) { + spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags); + spin_lock_irqsave(&devpriv->isr_spinlock, irqflags); + } + if (devpriv->ier != devpriv->int_en) { + devpriv->ier = devpriv->int_en; + outb(devpriv->ier, devpriv->iobase1 + PCI230_INT_SCE); + } + spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags); + if (devpriv->hwver >= 2) { + /* Using DAC FIFO. Reset FIFO, clear underrun error, + * disable FIFO. */ + devpriv->daccon &= PCI230_DAC_OR_MASK; + outw(devpriv->daccon | PCI230P2_DAC_FIFO_RESET + | PCI230P2_DAC_FIFO_UNDERRUN_CLEAR, + dev->iobase + PCI230_DACCON); + } + /* Release resources. */ + put_all_resources(dev, OWNER_AOCMD); +} + +static void pci230_handle_ao_nofifo(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + struct pci230_private *devpriv = dev->private; + short data; + int i, ret; + struct comedi_async *async = s->async; + struct comedi_cmd *cmd = &async->cmd; + + if (!devpriv->ao_continuous && (devpriv->ao_scan_count == 0)) + return; + for (i = 0; i < cmd->chanlist_len; i++) { + /* Read sample from Comedi's circular buffer. */ + ret = comedi_buf_get(s->async, &data); + if (ret == 0) { + s->async->events |= COMEDI_CB_OVERFLOW; + pci230_ao_stop(dev, s); + comedi_error(dev, "AO buffer underrun"); + return; + } + /* Write value to DAC. */ + pci230_ao_write_nofifo(dev, data, CR_CHAN(cmd->chanlist[i])); + } + async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOS; + if (!devpriv->ao_continuous) { + devpriv->ao_scan_count--; + if (devpriv->ao_scan_count == 0) { + /* End of acquisition. */ + async->events |= COMEDI_CB_EOA; + pci230_ao_stop(dev, s); + } + } +} + +/* Loads DAC FIFO (if using it) from buffer. */ +/* Returns 0 if AO finished due to completion or error, 1 if still going. */ +static int pci230_handle_ao_fifo(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + struct pci230_private *devpriv = dev->private; + struct comedi_async *async = s->async; + struct comedi_cmd *cmd = &async->cmd; + unsigned int num_scans; + unsigned int room; + unsigned short dacstat; + unsigned int i, n; + unsigned int bytes_per_scan; + unsigned int events = 0; + int running; + + /* Get DAC FIFO status. */ + dacstat = inw(dev->iobase + PCI230_DACCON); + /* Determine number of scans available in buffer. */ + bytes_per_scan = cmd->chanlist_len * sizeof(short); + num_scans = comedi_buf_read_n_available(async) / bytes_per_scan; + if (!devpriv->ao_continuous) { + /* Fixed number of scans. */ + if (num_scans > devpriv->ao_scan_count) + num_scans = devpriv->ao_scan_count; + if (devpriv->ao_scan_count == 0) { + /* End of acquisition. */ + events |= COMEDI_CB_EOA; + } + } + if (events == 0) { + /* Check for FIFO underrun. */ + if ((dacstat & PCI230P2_DAC_FIFO_UNDERRUN_LATCHED) != 0) { + comedi_error(dev, "AO FIFO underrun"); + events |= COMEDI_CB_OVERFLOW | COMEDI_CB_ERROR; + } + /* Check for buffer underrun if FIFO less than half full + * (otherwise there will be loads of "DAC FIFO not half full" + * interrupts). */ + if ((num_scans == 0) + && ((dacstat & PCI230P2_DAC_FIFO_HALF) == 0)) { + comedi_error(dev, "AO buffer underrun"); + events |= COMEDI_CB_OVERFLOW | COMEDI_CB_ERROR; + } + } + if (events == 0) { + /* Determine how much room is in the FIFO (in samples). */ + if ((dacstat & PCI230P2_DAC_FIFO_FULL) != 0) + room = PCI230P2_DAC_FIFOROOM_FULL; + else if ((dacstat & PCI230P2_DAC_FIFO_HALF) != 0) + room = PCI230P2_DAC_FIFOROOM_HALFTOFULL; + else if ((dacstat & PCI230P2_DAC_FIFO_EMPTY) != 0) + room = PCI230P2_DAC_FIFOROOM_EMPTY; + else + room = PCI230P2_DAC_FIFOROOM_ONETOHALF; + /* Convert room to number of scans that can be added. */ + room /= cmd->chanlist_len; + /* Determine number of scans to process. */ + if (num_scans > room) + num_scans = room; + /* Process scans. */ + for (n = 0; n < num_scans; n++) { + for (i = 0; i < cmd->chanlist_len; i++) { + short datum; + + comedi_buf_get(async, &datum); + pci230_ao_write_fifo(dev, datum, + CR_CHAN(cmd->chanlist[i])); + } + } + events |= COMEDI_CB_EOS | COMEDI_CB_BLOCK; + if (!devpriv->ao_continuous) { + devpriv->ao_scan_count -= num_scans; + if (devpriv->ao_scan_count == 0) { + /* All data for the command has been written + * to FIFO. Set FIFO interrupt trigger level + * to 'empty'. */ + devpriv->daccon = (devpriv->daccon + & + ~PCI230P2_DAC_INT_FIFO_MASK) + | PCI230P2_DAC_INT_FIFO_EMPTY; + outw(devpriv->daccon, + dev->iobase + PCI230_DACCON); + } + } + /* Check if FIFO underrun occurred while writing to FIFO. */ + dacstat = inw(dev->iobase + PCI230_DACCON); + if ((dacstat & PCI230P2_DAC_FIFO_UNDERRUN_LATCHED) != 0) { + comedi_error(dev, "AO FIFO underrun"); + events |= COMEDI_CB_OVERFLOW | COMEDI_CB_ERROR; + } + } + if ((events & (COMEDI_CB_EOA | COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW)) + != 0) { + /* Stopping AO due to completion or error. */ + pci230_ao_stop(dev, s); + running = 0; + } else { + running = 1; + } + async->events |= events; + return running; +} + static int pci230_ao_inttrig_scan_begin(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int trig_num) @@ -1394,6 +1578,13 @@ static int pci230_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) return 0; } +static int pci230_ao_cancel(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + pci230_ao_stop(dev, s); + return 0; +} + static int pci230_ai_check_scan_period(struct comedi_cmd *cmd) { unsigned int min_scan_period, chanlist_len; @@ -2323,151 +2514,6 @@ static irqreturn_t pci230_interrupt(int irq, void *d) return IRQ_HANDLED; } -static void pci230_handle_ao_nofifo(struct comedi_device *dev, - struct comedi_subdevice *s) -{ - struct pci230_private *devpriv = dev->private; - short data; - int i, ret; - struct comedi_async *async = s->async; - struct comedi_cmd *cmd = &async->cmd; - - if (!devpriv->ao_continuous && (devpriv->ao_scan_count == 0)) - return; - - - for (i = 0; i < cmd->chanlist_len; i++) { - /* Read sample from Comedi's circular buffer. */ - ret = comedi_buf_get(s->async, &data); - if (ret == 0) { - s->async->events |= COMEDI_CB_OVERFLOW; - pci230_ao_stop(dev, s); - comedi_error(dev, "AO buffer underrun"); - return; - } - /* Write value to DAC. */ - pci230_ao_write_nofifo(dev, data, CR_CHAN(cmd->chanlist[i])); - } - - async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOS; - if (!devpriv->ao_continuous) { - devpriv->ao_scan_count--; - if (devpriv->ao_scan_count == 0) { - /* End of acquisition. */ - async->events |= COMEDI_CB_EOA; - pci230_ao_stop(dev, s); - } - } -} - -/* Loads DAC FIFO (if using it) from buffer. */ -/* Returns 0 if AO finished due to completion or error, 1 if still going. */ -static int pci230_handle_ao_fifo(struct comedi_device *dev, - struct comedi_subdevice *s) -{ - struct pci230_private *devpriv = dev->private; - struct comedi_async *async = s->async; - struct comedi_cmd *cmd = &async->cmd; - unsigned int num_scans; - unsigned int room; - unsigned short dacstat; - unsigned int i, n; - unsigned int bytes_per_scan; - unsigned int events = 0; - int running; - - /* Get DAC FIFO status. */ - dacstat = inw(dev->iobase + PCI230_DACCON); - - /* Determine number of scans available in buffer. */ - bytes_per_scan = cmd->chanlist_len * sizeof(short); - num_scans = comedi_buf_read_n_available(async) / bytes_per_scan; - if (!devpriv->ao_continuous) { - /* Fixed number of scans. */ - if (num_scans > devpriv->ao_scan_count) - num_scans = devpriv->ao_scan_count; - - if (devpriv->ao_scan_count == 0) { - /* End of acquisition. */ - events |= COMEDI_CB_EOA; - } - } - if (events == 0) { - /* Check for FIFO underrun. */ - if ((dacstat & PCI230P2_DAC_FIFO_UNDERRUN_LATCHED) != 0) { - comedi_error(dev, "AO FIFO underrun"); - events |= COMEDI_CB_OVERFLOW | COMEDI_CB_ERROR; - } - /* Check for buffer underrun if FIFO less than half full - * (otherwise there will be loads of "DAC FIFO not half full" - * interrupts). */ - if ((num_scans == 0) - && ((dacstat & PCI230P2_DAC_FIFO_HALF) == 0)) { - comedi_error(dev, "AO buffer underrun"); - events |= COMEDI_CB_OVERFLOW | COMEDI_CB_ERROR; - } - } - if (events == 0) { - /* Determine how much room is in the FIFO (in samples). */ - if ((dacstat & PCI230P2_DAC_FIFO_FULL) != 0) - room = PCI230P2_DAC_FIFOROOM_FULL; - else if ((dacstat & PCI230P2_DAC_FIFO_HALF) != 0) - room = PCI230P2_DAC_FIFOROOM_HALFTOFULL; - else if ((dacstat & PCI230P2_DAC_FIFO_EMPTY) != 0) - room = PCI230P2_DAC_FIFOROOM_EMPTY; - else - room = PCI230P2_DAC_FIFOROOM_ONETOHALF; - - /* Convert room to number of scans that can be added. */ - room /= cmd->chanlist_len; - /* Determine number of scans to process. */ - if (num_scans > room) - num_scans = room; - - /* Process scans. */ - for (n = 0; n < num_scans; n++) { - for (i = 0; i < cmd->chanlist_len; i++) { - short datum; - - comedi_buf_get(async, &datum); - pci230_ao_write_fifo(dev, datum, - CR_CHAN(cmd->chanlist[i])); - } - } - events |= COMEDI_CB_EOS | COMEDI_CB_BLOCK; - if (!devpriv->ao_continuous) { - devpriv->ao_scan_count -= num_scans; - if (devpriv->ao_scan_count == 0) { - /* All data for the command has been written - * to FIFO. Set FIFO interrupt trigger level - * to 'empty'. */ - devpriv->daccon = (devpriv->daccon - & - ~PCI230P2_DAC_INT_FIFO_MASK) - | PCI230P2_DAC_INT_FIFO_EMPTY; - outw(devpriv->daccon, - dev->iobase + PCI230_DACCON); - } - } - /* Check if FIFO underrun occurred while writing to FIFO. */ - dacstat = inw(dev->iobase + PCI230_DACCON); - if ((dacstat & PCI230P2_DAC_FIFO_UNDERRUN_LATCHED) != 0) { - comedi_error(dev, "AO FIFO underrun"); - events |= COMEDI_CB_OVERFLOW | COMEDI_CB_ERROR; - } - } - if ((events & (COMEDI_CB_EOA | COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW)) - != 0) { - /* Stopping AO due to completion or error. */ - pci230_ao_stop(dev, s); - running = 0; - } else { - running = 1; - } - async->events |= events; - return running; -} - static void pci230_handle_ai(struct comedi_device *dev, struct comedi_subdevice *s) { @@ -2569,70 +2615,6 @@ static void pci230_handle_ai(struct comedi_device *dev, } } -static void pci230_ao_stop(struct comedi_device *dev, - struct comedi_subdevice *s) -{ - struct pci230_private *devpriv = dev->private; - unsigned long irqflags; - unsigned char intsrc; - int started; - struct comedi_cmd *cmd; - - spin_lock_irqsave(&devpriv->ao_stop_spinlock, irqflags); - started = test_and_clear_bit(AO_CMD_STARTED, &devpriv->state); - spin_unlock_irqrestore(&devpriv->ao_stop_spinlock, irqflags); - if (!started) - return; - - - cmd = &s->async->cmd; - if (cmd->scan_begin_src == TRIG_TIMER) { - /* Stop scan rate generator. */ - pci230_cancel_ct(dev, 1); - } - - /* Determine interrupt source. */ - if (devpriv->hwver < 2) { - /* Not using DAC FIFO. Using CT1 interrupt. */ - intsrc = PCI230_INT_ZCLK_CT1; - } else { - /* Using DAC FIFO interrupt. */ - intsrc = PCI230P2_INT_DAC; - } - /* Disable interrupt and wait for interrupt routine to finish running - * unless we are called from the interrupt routine. */ - spin_lock_irqsave(&devpriv->isr_spinlock, irqflags); - devpriv->int_en &= ~intsrc; - while (devpriv->intr_running && devpriv->intr_cpuid != THISCPU) { - spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags); - spin_lock_irqsave(&devpriv->isr_spinlock, irqflags); - } - if (devpriv->ier != devpriv->int_en) { - devpriv->ier = devpriv->int_en; - outb(devpriv->ier, devpriv->iobase1 + PCI230_INT_SCE); - } - spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags); - - if (devpriv->hwver >= 2) { - /* Using DAC FIFO. Reset FIFO, clear underrun error, - * disable FIFO. */ - devpriv->daccon &= PCI230_DAC_OR_MASK; - outw(devpriv->daccon | PCI230P2_DAC_FIFO_RESET - | PCI230P2_DAC_FIFO_UNDERRUN_CLEAR, - dev->iobase + PCI230_DACCON); - } - - /* Release resources. */ - put_all_resources(dev, OWNER_AOCMD); -} - -static int pci230_ao_cancel(struct comedi_device *dev, - struct comedi_subdevice *s) -{ - pci230_ao_stop(dev, s); - return 0; -} - static void pci230_ai_stop(struct comedi_device *dev, struct comedi_subdevice *s) { -- cgit v0.10.2 From 5d3b0d1859722a855b0310fcdc34c2e545cc1c7d Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 1 Jun 2012 17:31:45 +0100 Subject: staging: comedi: amplc_pci230: Remove forward declarations 4 Move these functions and remove their forward declarations: pci230_ai_stop(), pci230_handle_ai(). Also move pci230_ai_cancel() for aesthetic reasons. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index 0e9c4ba..30487be 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -579,11 +579,6 @@ static const struct comedi_lrange pci230_ao_range = { 2, { /* PCI230 daccon bipolar flag for each analogue output range. */ static const unsigned char pci230_ao_bipolar[2] = { 0, 1 }; -static void pci230_ai_stop(struct comedi_device *dev, - struct comedi_subdevice *s); -static void pci230_handle_ai(struct comedi_device *dev, - struct comedi_subdevice *s); - static short pci230_ai_read(struct comedi_device *dev) { const struct pci230_board *thisboard = comedi_board(dev); @@ -2103,6 +2098,52 @@ static int pci230_ai_inttrig_scan_begin(struct comedi_device *dev, return 1; } +static void pci230_ai_stop(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + struct pci230_private *devpriv = dev->private; + unsigned long irqflags; + struct comedi_cmd *cmd; + int started; + + spin_lock_irqsave(&devpriv->ai_stop_spinlock, irqflags); + started = test_and_clear_bit(AI_CMD_STARTED, &devpriv->state); + spin_unlock_irqrestore(&devpriv->ai_stop_spinlock, irqflags); + if (!started) + return; + cmd = &s->async->cmd; + if (cmd->convert_src == TRIG_TIMER) { + /* Stop conversion rate generator. */ + pci230_cancel_ct(dev, 2); + } + if (cmd->scan_begin_src != TRIG_FOLLOW) { + /* Stop scan period monostable. */ + pci230_cancel_ct(dev, 0); + } + spin_lock_irqsave(&devpriv->isr_spinlock, irqflags); + /* Disable ADC interrupt and wait for interrupt routine to finish + * running unless we are called from the interrupt routine. */ + devpriv->int_en &= ~PCI230_INT_ADC; + while (devpriv->intr_running && devpriv->intr_cpuid != THISCPU) { + spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags); + spin_lock_irqsave(&devpriv->isr_spinlock, irqflags); + } + if (devpriv->ier != devpriv->int_en) { + devpriv->ier = devpriv->int_en; + outb(devpriv->ier, devpriv->iobase1 + PCI230_INT_SCE); + } + spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags); + /* Reset FIFO, disable FIFO and set start conversion source to none. + * Keep se/diff and bip/uni settings */ + devpriv->adccon = (devpriv->adccon & (PCI230_ADC_IR_MASK + | PCI230_ADC_IM_MASK)) | + PCI230_ADC_TRIG_NONE; + outw(devpriv->adccon | PCI230_ADC_FIFO_RESET, + dev->iobase + PCI230_ADCCON); + /* Release resources. */ + put_all_resources(dev, OWNER_AICMD); +} + static void pci230_ai_start(struct comedi_device *dev, struct comedi_subdevice *s) { @@ -2255,6 +2296,99 @@ static int pci230_ai_inttrig_start(struct comedi_device *dev, return 1; } +static void pci230_handle_ai(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + struct pci230_private *devpriv = dev->private; + unsigned int events = 0; + unsigned int status_fifo; + unsigned int i; + unsigned int todo; + unsigned int fifoamount; + struct comedi_async *async = s->async; + unsigned int scanlen = async->cmd.scan_end_arg; + + /* Determine number of samples to read. */ + if (devpriv->ai_continuous) { + todo = PCI230_ADC_FIFOLEVEL_HALFFULL; + } else if (devpriv->ai_scan_count == 0) { + todo = 0; + } else if ((devpriv->ai_scan_count > PCI230_ADC_FIFOLEVEL_HALFFULL) + || (scanlen > PCI230_ADC_FIFOLEVEL_HALFFULL)) { + todo = PCI230_ADC_FIFOLEVEL_HALFFULL; + } else { + todo = (devpriv->ai_scan_count * scanlen) + - devpriv->ai_scan_pos; + if (todo > PCI230_ADC_FIFOLEVEL_HALFFULL) + todo = PCI230_ADC_FIFOLEVEL_HALFFULL; + } + if (todo == 0) + return; + fifoamount = 0; + for (i = 0; i < todo; i++) { + if (fifoamount == 0) { + /* Read FIFO state. */ + status_fifo = inw(dev->iobase + PCI230_ADCCON); + if ((status_fifo & PCI230_ADC_FIFO_FULL_LATCHED) != 0) { + /* Report error otherwise FIFO overruns will go + * unnoticed by the caller. */ + comedi_error(dev, "AI FIFO overrun"); + events |= COMEDI_CB_OVERFLOW | COMEDI_CB_ERROR; + break; + } else if ((status_fifo & PCI230_ADC_FIFO_EMPTY) != 0) { + /* FIFO empty. */ + break; + } else if ((status_fifo & PCI230_ADC_FIFO_HALF) != 0) { + /* FIFO half full. */ + fifoamount = PCI230_ADC_FIFOLEVEL_HALFFULL; + } else { + /* FIFO not empty. */ + if (devpriv->hwver > 0) { + /* Read PCI230+/260+ ADC FIFO level. */ + fifoamount = inw(dev->iobase + + PCI230P_ADCFFLEV); + if (fifoamount == 0) { + /* Shouldn't happen. */ + break; + } + } else { + fifoamount = 1; + } + } + } + /* Read sample and store in Comedi's circular buffer. */ + if (comedi_buf_put(async, pci230_ai_read(dev)) == 0) { + events |= COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW; + comedi_error(dev, "AI buffer overflow"); + break; + } + fifoamount--; + devpriv->ai_scan_pos++; + if (devpriv->ai_scan_pos == scanlen) { + /* End of scan. */ + devpriv->ai_scan_pos = 0; + devpriv->ai_scan_count--; + async->events |= COMEDI_CB_EOS; + } + } + if (!devpriv->ai_continuous && (devpriv->ai_scan_count == 0)) { + /* End of acquisition. */ + events |= COMEDI_CB_EOA; + } else { + /* More samples required, tell Comedi to block. */ + events |= COMEDI_CB_BLOCK; + } + async->events |= events; + if ((async->events & (COMEDI_CB_EOA | COMEDI_CB_ERROR | + COMEDI_CB_OVERFLOW)) != 0) { + /* disable hardware conversions */ + pci230_ai_stop(dev, s); + } else { + /* update FIFO interrupt trigger level */ + pci230_ai_update_fifo_trigger_level(dev, s); + } +} + static int pci230_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { struct pci230_private *devpriv = dev->private; @@ -2449,6 +2583,13 @@ static int pci230_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) return 0; } +static int pci230_ai_cancel(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + pci230_ai_stop(dev, s); + return 0; +} + /* Interrupt handler */ static irqreturn_t pci230_interrupt(int irq, void *d) { @@ -2514,165 +2655,6 @@ static irqreturn_t pci230_interrupt(int irq, void *d) return IRQ_HANDLED; } -static void pci230_handle_ai(struct comedi_device *dev, - struct comedi_subdevice *s) -{ - struct pci230_private *devpriv = dev->private; - unsigned int events = 0; - unsigned int status_fifo; - unsigned int i; - unsigned int todo; - unsigned int fifoamount; - struct comedi_async *async = s->async; - unsigned int scanlen = async->cmd.scan_end_arg; - - /* Determine number of samples to read. */ - if (devpriv->ai_continuous) { - todo = PCI230_ADC_FIFOLEVEL_HALFFULL; - } else if (devpriv->ai_scan_count == 0) { - todo = 0; - } else if ((devpriv->ai_scan_count > PCI230_ADC_FIFOLEVEL_HALFFULL) - || (scanlen > PCI230_ADC_FIFOLEVEL_HALFFULL)) { - todo = PCI230_ADC_FIFOLEVEL_HALFFULL; - } else { - todo = (devpriv->ai_scan_count * scanlen) - - devpriv->ai_scan_pos; - if (todo > PCI230_ADC_FIFOLEVEL_HALFFULL) - todo = PCI230_ADC_FIFOLEVEL_HALFFULL; - - } - - if (todo == 0) - return; - - - fifoamount = 0; - for (i = 0; i < todo; i++) { - if (fifoamount == 0) { - /* Read FIFO state. */ - status_fifo = inw(dev->iobase + PCI230_ADCCON); - - if ((status_fifo & PCI230_ADC_FIFO_FULL_LATCHED) != 0) { - /* Report error otherwise FIFO overruns will go - * unnoticed by the caller. */ - comedi_error(dev, "AI FIFO overrun"); - events |= COMEDI_CB_OVERFLOW | COMEDI_CB_ERROR; - break; - } else if ((status_fifo & PCI230_ADC_FIFO_EMPTY) != 0) { - /* FIFO empty. */ - break; - } else if ((status_fifo & PCI230_ADC_FIFO_HALF) != 0) { - /* FIFO half full. */ - fifoamount = PCI230_ADC_FIFOLEVEL_HALFFULL; - } else { - /* FIFO not empty. */ - if (devpriv->hwver > 0) { - /* Read PCI230+/260+ ADC FIFO level. */ - fifoamount = inw(dev->iobase - + PCI230P_ADCFFLEV); - if (fifoamount == 0) { - /* Shouldn't happen. */ - break; - } - } else { - fifoamount = 1; - } - } - } - - /* Read sample and store in Comedi's circular buffer. */ - if (comedi_buf_put(async, pci230_ai_read(dev)) == 0) { - events |= COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW; - comedi_error(dev, "AI buffer overflow"); - break; - } - fifoamount--; - devpriv->ai_scan_pos++; - if (devpriv->ai_scan_pos == scanlen) { - /* End of scan. */ - devpriv->ai_scan_pos = 0; - devpriv->ai_scan_count--; - async->events |= COMEDI_CB_EOS; - } - } - - if (!devpriv->ai_continuous && (devpriv->ai_scan_count == 0)) { - /* End of acquisition. */ - events |= COMEDI_CB_EOA; - } else { - /* More samples required, tell Comedi to block. */ - events |= COMEDI_CB_BLOCK; - } - async->events |= events; - - if ((async->events & (COMEDI_CB_EOA | COMEDI_CB_ERROR | - COMEDI_CB_OVERFLOW)) != 0) { - /* disable hardware conversions */ - pci230_ai_stop(dev, s); - } else { - /* update FIFO interrupt trigger level */ - pci230_ai_update_fifo_trigger_level(dev, s); - } -} - -static void pci230_ai_stop(struct comedi_device *dev, - struct comedi_subdevice *s) -{ - struct pci230_private *devpriv = dev->private; - unsigned long irqflags; - struct comedi_cmd *cmd; - int started; - - spin_lock_irqsave(&devpriv->ai_stop_spinlock, irqflags); - started = test_and_clear_bit(AI_CMD_STARTED, &devpriv->state); - spin_unlock_irqrestore(&devpriv->ai_stop_spinlock, irqflags); - if (!started) - return; - - - cmd = &s->async->cmd; - if (cmd->convert_src == TRIG_TIMER) { - /* Stop conversion rate generator. */ - pci230_cancel_ct(dev, 2); - } - if (cmd->scan_begin_src != TRIG_FOLLOW) { - /* Stop scan period monostable. */ - pci230_cancel_ct(dev, 0); - } - - spin_lock_irqsave(&devpriv->isr_spinlock, irqflags); - /* Disable ADC interrupt and wait for interrupt routine to finish - * running unless we are called from the interrupt routine. */ - devpriv->int_en &= ~PCI230_INT_ADC; - while (devpriv->intr_running && devpriv->intr_cpuid != THISCPU) { - spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags); - spin_lock_irqsave(&devpriv->isr_spinlock, irqflags); - } - if (devpriv->ier != devpriv->int_en) { - devpriv->ier = devpriv->int_en; - outb(devpriv->ier, devpriv->iobase1 + PCI230_INT_SCE); - } - spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags); - - /* Reset FIFO, disable FIFO and set start conversion source to none. - * Keep se/diff and bip/uni settings */ - devpriv->adccon = (devpriv->adccon & (PCI230_ADC_IR_MASK - | PCI230_ADC_IM_MASK)) | - PCI230_ADC_TRIG_NONE; - outw(devpriv->adccon | PCI230_ADC_FIFO_RESET, - dev->iobase + PCI230_ADCCON); - - /* Release resources. */ - put_all_resources(dev, OWNER_AICMD); -} - -static int pci230_ai_cancel(struct comedi_device *dev, - struct comedi_subdevice *s) -{ - pci230_ai_stop(dev, s); - return 0; -} - /* Check if PCI device matches a specific board. */ static bool pci230_match_pci_board(const struct pci230_board *board, struct pci_dev *pci_dev) -- cgit v0.10.2 From 8a7245ea2c48641257ff149569b56650d0cfc99c Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Sun, 20 May 2012 14:06:36 -0700 Subject: Staging: android: alarm: Rename pr_alarm to alarm_dbg Rename a macro to make it explicit it's for debugging. Use %s: __func__ instead of embedding function names. Coalesce formats, align arguments. Signed-off-by: Joe Perches Acked-by: David Rientjes Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/android/alarm-dev.c b/drivers/staging/android/alarm-dev.c index 53ce6ec..32614d6 100644 --- a/drivers/staging/android/alarm-dev.c +++ b/drivers/staging/android/alarm-dev.c @@ -29,16 +29,14 @@ #define ANDROID_ALARM_PRINT_IO (1U << 1) #define ANDROID_ALARM_PRINT_INT (1U << 2) - static int debug_mask = ANDROID_ALARM_PRINT_INFO; module_param_named(debug_mask, debug_mask, int, S_IRUGO | S_IWUSR | S_IWGRP); -#define pr_alarm(debug_level_mask, args...) \ - do { \ - if (debug_mask & ANDROID_ALARM_PRINT_##debug_level_mask) { \ - pr_info(args); \ - } \ - } while (0) +#define alarm_dbg(debug_level_mask, fmt, ...) \ +do { \ + if (debug_mask & ANDROID_ALARM_PRINT_##debug_level_mask) \ + pr_info(fmt, ##__VA_ARGS__); \ +} while (0) #define ANDROID_ALARM_WAKEUP_MASK ( \ ANDROID_ALARM_RTC_WAKEUP_MASK | \ @@ -138,7 +136,7 @@ static long alarm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) switch (ANDROID_ALARM_BASE_CMD(cmd)) { case ANDROID_ALARM_CLEAR(0): spin_lock_irqsave(&alarm_slock, flags); - pr_alarm(IO, "alarm %d clear\n", alarm_type); + alarm_dbg(IO, "alarm %d clear\n", alarm_type); devalarm_try_to_cancel(&alarms[alarm_type]); if (alarm_pending) { alarm_pending &= ~alarm_type_mask; @@ -167,8 +165,9 @@ static long alarm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) } from_old_alarm_set: spin_lock_irqsave(&alarm_slock, flags); - pr_alarm(IO, "alarm %d set %ld.%09ld\n", alarm_type, - new_alarm_time.tv_sec, new_alarm_time.tv_nsec); + alarm_dbg(IO, "alarm %d set %ld.%09ld\n", + alarm_type, + new_alarm_time.tv_sec, new_alarm_time.tv_nsec); alarm_enabled |= alarm_type_mask; devalarm_start(&alarms[alarm_type], timespec_to_ktime(new_alarm_time)); @@ -179,7 +178,7 @@ from_old_alarm_set: /* fall though */ case ANDROID_ALARM_WAIT: spin_lock_irqsave(&alarm_slock, flags); - pr_alarm(IO, "alarm wait\n"); + alarm_dbg(IO, "alarm wait\n"); if (!alarm_pending && wait_pending) { __pm_relax(&alarm_wake_lock); wait_pending = 0; @@ -260,9 +259,10 @@ static int alarm_release(struct inode *inode, struct file *file) for (i = 0; i < ANDROID_ALARM_TYPE_COUNT; i++) { uint32_t alarm_type_mask = 1U << i; if (alarm_enabled & alarm_type_mask) { - pr_alarm(INFO, "alarm_release: clear alarm, " - "pending %d\n", - !!(alarm_pending & alarm_type_mask)); + alarm_dbg(INFO, + "%s: clear alarm, pending %d\n", + __func__, + !!(alarm_pending & alarm_type_mask)); alarm_enabled &= ~alarm_type_mask; } spin_unlock_irqrestore(&alarm_slock, flags); @@ -271,8 +271,8 @@ static int alarm_release(struct inode *inode, struct file *file) } if (alarm_pending | wait_pending) { if (alarm_pending) - pr_alarm(INFO, "alarm_release: clear " - "pending alarms %x\n", alarm_pending); + alarm_dbg(INFO, "%s: clear pending alarms %x\n", + __func__, alarm_pending); __pm_relax(&alarm_wake_lock); wait_pending = 0; alarm_pending = 0; @@ -288,7 +288,7 @@ static void devalarm_triggered(struct devalarm *alarm) unsigned long flags; uint32_t alarm_type_mask = 1U << alarm->type; - pr_alarm(INT, "devalarm_triggered type %d\n", alarm->type); + alarm_dbg(INT, "%s: type %d\n", __func__, alarm->type); spin_lock_irqsave(&alarm_slock, flags); if (alarm_enabled & alarm_type_mask) { __pm_wakeup_event(&alarm_wake_lock, 5000); /* 5secs */ -- cgit v0.10.2 From 3fe192d8e0c99ca3b96573cdc7cc03cfcf935f74 Mon Sep 17 00:00:00 2001 From: "Justin P. Mattock" Date: Mon, 21 May 2012 07:56:57 -0700 Subject: staging "rts_pstor" fix some typos while reading through rts_pstor Signed-off-by: Justin P. Mattock Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/rts_pstor/ms.c b/drivers/staging/rts_pstor/ms.c index 0bf6d95..7cc2b53 100644 --- a/drivers/staging/rts_pstor/ms.c +++ b/drivers/staging/rts_pstor/ms.c @@ -2488,7 +2488,7 @@ int reset_ms_card(struct rtsx_chip *chip) if (!CHK_MSPRO(ms_card)) { /* Build table for the last segment, - * to check if L2P talbe block exist,erasing it + * to check if L2P table block exists, erasing it */ retval = ms_build_l2p_tbl(chip, ms_card->total_block / 512 - 1); if (retval != STATUS_SUCCESS) { diff --git a/drivers/staging/rts_pstor/sd.c b/drivers/staging/rts_pstor/sd.c index aab6909..b9474a8 100644 --- a/drivers/staging/rts_pstor/sd.c +++ b/drivers/staging/rts_pstor/sd.c @@ -1169,7 +1169,7 @@ static int sd_check_switch_mode(struct rtsx_chip *chip, u8 mode, RTSX_DEBUGP("func_group4_mask = 0x%02x\n", buf[0x07]); } else { /* Maximum current consumption, check whether current is acceptable; - * bit[511:496] = 0x0000 means some error happaned. + * bit[511:496] = 0x0000 means some error happened. */ u16 cc = ((u16)buf[0] << 8) | buf[1]; RTSX_DEBUGP("Maximum current consumption: %dmA\n", cc); -- cgit v0.10.2 From 76cc6f92039208e04291af751c5d46568aa24162 Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Sat, 26 May 2012 12:04:53 -0400 Subject: Staging: bcm: Remove typedef from "eInterface_setting" in Adapter.h This patch removes the typedef from eInterface_setting, and renames the enum to bcm_einterface_setting. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index aa51d17..a67022f 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -585,9 +585,9 @@ int InitAdapter(PMINI_ADAPTER psAdapter); #define EP5 4 #define EP6 5 -typedef enum eInterface_setting { +enum bcm_einterface_setting { DEFAULT_SETTING_0 = 0, ALTERNATE_SETTING_1 = 1, -} INTERFACE_SETTING; +}; #endif /* __ADAPTER_H__ */ -- cgit v0.10.2 From be3099957ca9d465a46b83d08c1cd9617a461078 Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Sat, 26 May 2012 12:04:54 -0400 Subject: Staging: bcm: Remove typedef for _DDR_SETTING and call directly. This patch removes the typedef for _DDR_SETTING, changes the name of the struct from _DDR_SETTING, to bcm_ddr_setting. In addition, any calls to the following typedefs "DDR_SET_NODE and *PDDR_SET_NODE" are changed to call the struct directly. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index a67022f..9b78856 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -549,11 +549,10 @@ typedef struct _cntl_pkt { } cntl_pkt; typedef LINK_REQUEST CONTROL_MESSAGE; -typedef struct _DDR_SETTING { +struct bcm_ddr_setting { UINT ulRegAddress; UINT ulRegValue; -} DDR_SETTING, *PDDR_SETTING; -typedef DDR_SETTING DDR_SET_NODE, *PDDR_SET_NODE; +}; int InitAdapter(PMINI_ADAPTER psAdapter); /* ===================================================================== diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c index 2b46f4d..e7571da 100644 --- a/drivers/staging/bcm/DDRInit.c +++ b/drivers/staging/bcm/DDRInit.c @@ -7,7 +7,7 @@ //DDR INIT-133Mhz #define T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 12 //index for 0x0F007000 -static DDR_SET_NODE asT3_DDRSetting133MHz[]= {// # DPLL Clock Setting +static struct bcm_ddr_setting asT3_DDRSetting133MHz[]= {// # DPLL Clock Setting {0x0F000800,0x00007212}, {0x0f000820,0x07F13FFF}, {0x0f000810,0x00000F95}, @@ -65,7 +65,7 @@ static DDR_SET_NODE asT3_DDRSetting133MHz[]= {// # DPLL Clock Setting }; //80Mhz #define T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 10 //index for 0x0F007000 -static DDR_SET_NODE asT3_DDRSetting80MHz[]= {// # DPLL Clock Setting +static struct bcm_ddr_setting asT3_DDRSetting80MHz[]= {// # DPLL Clock Setting {0x0f000810,0x00000F95}, {0x0f000820,0x07f1ffff}, {0x0f000860,0x00000000}, @@ -117,7 +117,7 @@ static DDR_SET_NODE asT3_DDRSetting80MHz[]= {// # DPLL Clock Setting }; //100Mhz #define T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 13 //index for 0x0F007000 -static DDR_SET_NODE asT3_DDRSetting100MHz[]= {// # DPLL Clock Setting +static struct bcm_ddr_setting asT3_DDRSetting100MHz[]= {// # DPLL Clock Setting {0x0F000800,0x00007008}, {0x0f000810,0x00000F95}, {0x0f000820,0x07F13E3F}, @@ -177,7 +177,7 @@ static DDR_SET_NODE asT3_DDRSetting100MHz[]= {// # DPLL Clock Setting //Net T3B DDR Settings //DDR INIT-133Mhz -static DDR_SET_NODE asDPLL_266MHZ[] = { +static struct bcm_ddr_setting asDPLL_266MHZ[] = { {0x0F000800,0x00007212}, {0x0f000820,0x07F13FFF}, {0x0f000810,0x00000F95}, @@ -189,7 +189,7 @@ static DDR_SET_NODE asDPLL_266MHZ[] = { }; #define T3B_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 11 //index for 0x0F007000 -static DDR_SET_NODE asT3B_DDRSetting133MHz[] = {// # DPLL Clock Setting +static struct bcm_ddr_setting asT3B_DDRSetting133MHz[] = {// # DPLL Clock Setting {0x0f000810,0x00000F95}, {0x0f000810,0x00000F95}, {0x0f000810,0x00000F95}, @@ -247,7 +247,7 @@ static DDR_SET_NODE asT3B_DDRSetting133MHz[] = {// # DPLL Clock Setting }; #define T3B_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 9 //index for 0x0F007000 -static DDR_SET_NODE asT3B_DDRSetting80MHz[] = {// # DPLL Clock Setting +static struct bcm_ddr_setting asT3B_DDRSetting80MHz[] = {// # DPLL Clock Setting {0x0f000810,0x00000F95}, {0x0f000820,0x07F13FFF}, {0x0f000840,0x0FFF1F00}, @@ -301,7 +301,7 @@ static DDR_SET_NODE asT3B_DDRSetting80MHz[] = {// # DPLL Clock Setting //100Mhz #define T3B_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 9 //index for 0x0F007000 -static DDR_SET_NODE asT3B_DDRSetting100MHz[] = {// # DPLL Clock Setting +static struct bcm_ddr_setting asT3B_DDRSetting100MHz[] = {// # DPLL Clock Setting {0x0f000810,0x00000F95}, {0x0f000820,0x07F1369B}, {0x0f000840,0x0FFF0800}, @@ -356,7 +356,7 @@ static DDR_SET_NODE asT3B_DDRSetting100MHz[] = {// # DPLL Clock Setting #define T3LP_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 9 //index for 0x0F007000 -static DDR_SET_NODE asT3LP_DDRSetting133MHz[]= {// # DPLL Clock Setting +static struct bcm_ddr_setting asT3LP_DDRSetting133MHz[]= {// # DPLL Clock Setting {0x0f000820,0x03F1365B}, {0x0f000810,0x00002F95}, {0x0f000880,0x000003DD}, @@ -416,7 +416,7 @@ static DDR_SET_NODE asT3LP_DDRSetting133MHz[]= {// # DPLL Clock Setting }; #define T3LP_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 11 //index for 0x0F007000 -static DDR_SET_NODE asT3LP_DDRSetting100MHz[]= {// # DPLL Clock Setting +static struct bcm_ddr_setting asT3LP_DDRSetting100MHz[]= {// # DPLL Clock Setting {0x0f000810,0x00002F95}, {0x0f000820,0x03F1369B}, {0x0f000840,0x0fff0000}, @@ -476,7 +476,7 @@ static DDR_SET_NODE asT3LP_DDRSetting100MHz[]= {// # DPLL Clock Setting }; #define T3LP_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 9 //index for 0x0F007000 -static DDR_SET_NODE asT3LP_DDRSetting80MHz[]= {// # DPLL Clock Setting +static struct bcm_ddr_setting asT3LP_DDRSetting80MHz[]= {// # DPLL Clock Setting {0x0f000820,0x07F13FFF}, {0x0f000810,0x00002F95}, {0x0f000860,0x00000000}, @@ -536,7 +536,7 @@ static DDR_SET_NODE asT3LP_DDRSetting80MHz[]= {// # DPLL Clock Setting ///T3 LP-B (UMA-B) #define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_160MHZ 7 //index for 0x0F007000 -static DDR_SET_NODE asT3LPB_DDRSetting160MHz[]= {// # DPLL Clock Setting +static struct bcm_ddr_setting asT3LPB_DDRSetting160MHz[]= {// # DPLL Clock Setting {0x0f000820,0x03F137DB}, {0x0f000810,0x01842795}, @@ -594,7 +594,7 @@ static DDR_SET_NODE asT3LPB_DDRSetting160MHz[]= {// # DPLL Clock Setting #define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 7 //index for 0x0F007000 -static DDR_SET_NODE asT3LPB_DDRSetting133MHz[]= {// # DPLL Clock Setting +static struct bcm_ddr_setting asT3LPB_DDRSetting133MHz[]= {// # DPLL Clock Setting {0x0f000820,0x03F1365B}, {0x0f000810,0x00002F95}, {0x0f000880,0x000003DD}, @@ -655,7 +655,7 @@ static DDR_SET_NODE asT3LPB_DDRSetting133MHz[]= {// # DPLL Clock Setting }; #define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 8 //index for 0x0F007000 -static DDR_SET_NODE asT3LPB_DDRSetting100MHz[]= {// # DPLL Clock Setting +static struct bcm_ddr_setting asT3LPB_DDRSetting100MHz[]= {// # DPLL Clock Setting {0x0f000810,0x00002F95}, {0x0f000820,0x03F1369B}, {0x0f000840,0x0fff0000}, @@ -716,7 +716,7 @@ static DDR_SET_NODE asT3LPB_DDRSetting100MHz[]= {// # DPLL Clock Setting }; #define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 7 //index for 0x0F007000 -static DDR_SET_NODE asT3LPB_DDRSetting80MHz[]= {// # DPLL Clock Setting +static struct bcm_ddr_setting asT3LPB_DDRSetting80MHz[]= {// # DPLL Clock Setting {0x0f000820,0x07F13FFF}, {0x0f000810,0x00002F95}, {0x0f000860,0x00000000}, @@ -774,7 +774,7 @@ static DDR_SET_NODE asT3LPB_DDRSetting80MHz[]= {// # DPLL Clock Setting int ddr_init(MINI_ADAPTER *Adapter) { - PDDR_SETTING psDDRSetting=NULL; + struct bcm_ddr_setting *psDDRSetting=NULL; ULONG RegCount=0; UINT value = 0; UINT uiResetValue = 0; @@ -789,17 +789,17 @@ int ddr_init(MINI_ADAPTER *Adapter) case DDR_80_MHZ: psDDRSetting=asT3LP_DDRSetting80MHz; RegCount=(sizeof(asT3LP_DDRSetting80MHz)/ - sizeof(DDR_SETTING)); + sizeof(struct bcm_ddr_setting)); break; case DDR_100_MHZ: psDDRSetting=asT3LP_DDRSetting100MHz; RegCount=(sizeof(asT3LP_DDRSetting100MHz)/ - sizeof(DDR_SETTING)); + sizeof(struct bcm_ddr_setting)); break; case DDR_133_MHZ: psDDRSetting=asT3LP_DDRSetting133MHz; RegCount=(sizeof(asT3LP_DDRSetting133MHz)/ - sizeof(DDR_SETTING)); + sizeof(struct bcm_ddr_setting)); if(Adapter->bMipsConfig == MIPS_200_MHZ) { uiClockSetting = 0x03F13652; @@ -846,17 +846,17 @@ int ddr_init(MINI_ADAPTER *Adapter) case DDR_80_MHZ: psDDRSetting = asT3LPB_DDRSetting80MHz; RegCount=(sizeof(asT3B_DDRSetting80MHz)/ - sizeof(DDR_SETTING)); + sizeof(struct bcm_ddr_setting)); break; case DDR_100_MHZ: psDDRSetting=asT3LPB_DDRSetting100MHz; RegCount=(sizeof(asT3B_DDRSetting100MHz)/ - sizeof(DDR_SETTING)); + sizeof(struct bcm_ddr_setting)); break; case DDR_133_MHZ: psDDRSetting = asT3LPB_DDRSetting133MHz; RegCount=(sizeof(asT3B_DDRSetting133MHz)/ - sizeof(DDR_SETTING)); + sizeof(struct bcm_ddr_setting)); if(Adapter->bMipsConfig == MIPS_200_MHZ) { @@ -870,7 +870,7 @@ int ddr_init(MINI_ADAPTER *Adapter) case DDR_160_MHZ: psDDRSetting = asT3LPB_DDRSetting160MHz; - RegCount = sizeof(asT3LPB_DDRSetting160MHz)/sizeof(DDR_SETTING); + RegCount = sizeof(asT3LPB_DDRSetting160MHz)/sizeof(struct bcm_ddr_setting); if(Adapter->bMipsConfig == MIPS_200_MHZ) { @@ -894,17 +894,17 @@ int ddr_init(MINI_ADAPTER *Adapter) case DDR_80_MHZ: psDDRSetting = asT3_DDRSetting80MHz; RegCount = (sizeof(asT3_DDRSetting80MHz)/ - sizeof(DDR_SETTING)); + sizeof(struct bcm_ddr_setting)); break; case DDR_100_MHZ: psDDRSetting = asT3_DDRSetting100MHz; RegCount = (sizeof(asT3_DDRSetting100MHz)/ - sizeof(DDR_SETTING)); + sizeof(struct bcm_ddr_setting)); break; case DDR_133_MHZ: psDDRSetting = asT3_DDRSetting133MHz; RegCount = (sizeof(asT3_DDRSetting133MHz)/ - sizeof(DDR_SETTING)); + sizeof(struct bcm_ddr_setting)); break; default: return -EINVAL; @@ -916,12 +916,12 @@ int ddr_init(MINI_ADAPTER *Adapter) case DDR_80_MHZ: psDDRSetting = asT3B_DDRSetting80MHz; RegCount=(sizeof(asT3B_DDRSetting80MHz)/ - sizeof(DDR_SETTING)); + sizeof(struct bcm_ddr_setting)); break; case DDR_100_MHZ: psDDRSetting=asT3B_DDRSetting100MHz; RegCount=(sizeof(asT3B_DDRSetting100MHz)/ - sizeof(DDR_SETTING)); + sizeof(struct bcm_ddr_setting)); break; case DDR_133_MHZ: @@ -931,13 +931,13 @@ int ddr_init(MINI_ADAPTER *Adapter) sizeof(asDPLL_266MHZ)); psDDRSetting = asT3B_DDRSetting133MHz; RegCount=(sizeof(asT3B_DDRSetting133MHz)/ - sizeof(DDR_SETTING)); + sizeof(struct bcm_ddr_setting)); } else { psDDRSetting = asT3B_DDRSetting133MHz; RegCount=(sizeof(asT3B_DDRSetting133MHz)/ - sizeof(DDR_SETTING)); + sizeof(struct bcm_ddr_setting)); if(Adapter->bMipsConfig == MIPS_200_MHZ) { uiClockSetting = 0x07F13652; @@ -1101,7 +1101,7 @@ int ddr_init(MINI_ADAPTER *Adapter) int download_ddr_settings(PMINI_ADAPTER Adapter) { - PDDR_SET_NODE psDDRSetting=NULL; + struct bcm_ddr_setting *psDDRSetting=NULL; ULONG RegCount=0; unsigned long ul_ddr_setting_load_addr = DDR_DUMP_INTERNAL_DEVICE_MEMORY; UINT value = 0; @@ -1250,7 +1250,7 @@ int download_ddr_settings(PMINI_ADAPTER Adapter) } ul_ddr_setting_load_addr+=sizeof(ULONG); - RegCount*=(sizeof(DDR_SETTING)/sizeof(ULONG)); + RegCount*=(sizeof(struct bcm_ddr_setting)/sizeof(ULONG)); while(RegCount && !retval) { -- cgit v0.10.2 From 7905c78816783dff5d167cf922557e35e8c1a45f Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Sat, 26 May 2012 12:04:55 -0400 Subject: Staging: bcm: Remove typedef for _cntl_pkt in Adapter.h This patch removes typedef for _cntl_pkt because it is not used. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index 9b78856..45c2e8c 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -543,10 +543,7 @@ typedef struct FirmwareInfo { /* holds the value of net_device structure.. */ extern struct net_device *gblpnetdev; -typedef struct _cntl_pkt { - PMINI_ADAPTER Adapter; - PLEADER PLeader; -} cntl_pkt; + typedef LINK_REQUEST CONTROL_MESSAGE; struct bcm_ddr_setting { -- cgit v0.10.2 From 7a27a2ccf8a6368f6d7f77cb02f5c5c698015c2e Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Sat, 26 May 2012 12:04:56 -0400 Subject: Staging: bcm: Remove typedef for FirmwareInfo and call directly. This patch removes typedef for FirmwareInfo, changes the name from Firmwareinfo to bcm_firmware_info. In addition, any calls to the following typedefs "PFIRMWARE_INFO, FIRMWARE_INFO" are changed to call the struct directly. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index 45c2e8c..12a43fb 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -535,11 +535,11 @@ struct _ETH_HEADER_STRUC { } __packed; typedef struct _ETH_HEADER_STRUC ETH_HEADER_STRUC, *PETH_HEADER_STRUC; -typedef struct FirmwareInfo { +struct bcm_firmware_info { void __user *pvMappedFirmwareAddress; ULONG u32FirmwareLength; ULONG u32StartingAddress; -} __packed FIRMWARE_INFO, *PFIRMWARE_INFO; +} __packed; /* holds the value of net_device structure.. */ extern struct net_device *gblpnetdev; diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index cf30592..cd0348e 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c @@ -787,7 +787,7 @@ cntrlEnd: } case IOCTL_BCM_BUFFER_DOWNLOAD: { - FIRMWARE_INFO *psFwInfo = NULL; + struct bcm_firmware_info *psFwInfo = NULL; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Starting the firmware download PID =0x%x!!!!\n", current->pid); if (!down_trylock(&Adapter->fw_download_sema)) { @@ -807,7 +807,7 @@ cntrlEnd: BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Length for FW DLD is : %lx\n", IoBuffer.InputLength); - if (IoBuffer.InputLength > sizeof(FIRMWARE_INFO)) { + if (IoBuffer.InputLength > sizeof(struct bcm_firmware_info)) { up(&Adapter->fw_download_sema); return -EINVAL; } diff --git a/drivers/staging/bcm/InterfaceDld.c b/drivers/staging/bcm/InterfaceDld.c index 65c352f..cb0e72e 100644 --- a/drivers/staging/bcm/InterfaceDld.c +++ b/drivers/staging/bcm/InterfaceDld.c @@ -132,7 +132,7 @@ exit: return Status; } -static int bcm_download_config_file(PMINI_ADAPTER Adapter, FIRMWARE_INFO *psFwInfo) +static int bcm_download_config_file(PMINI_ADAPTER Adapter, struct bcm_firmware_info *psFwInfo) { int retval = STATUS_SUCCESS; B_UINT32 value = 0; @@ -229,7 +229,7 @@ static int bcm_compare_buff_contents(unsigned char *readbackbuff, unsigned char return retval; } -int bcm_ioctl_fw_download(PMINI_ADAPTER Adapter, FIRMWARE_INFO *psFwInfo) +int bcm_ioctl_fw_download(PMINI_ADAPTER Adapter, struct bcm_firmware_info *psFwInfo) { int retval = STATUS_SUCCESS; PUCHAR buff = NULL; diff --git a/drivers/staging/bcm/Prototypes.h b/drivers/staging/bcm/Prototypes.h index b80b806..a8676b9 100644 --- a/drivers/staging/bcm/Prototypes.h +++ b/drivers/staging/bcm/Prototypes.h @@ -92,7 +92,7 @@ int ProcessGetHostMibs(PMINI_ADAPTER Adapter, S_MIBS_HOST_STATS_MIBS *buf); void GetDroppedAppCntrlPktMibs(S_MIBS_HOST_STATS_MIBS *ioBuffer, PPER_TARANG_DATA pTarang); void beceem_parse_target_struct(PMINI_ADAPTER Adapter); -int bcm_ioctl_fw_download(PMINI_ADAPTER Adapter, FIRMWARE_INFO *psFwInfo); +int bcm_ioctl_fw_download(PMINI_ADAPTER Adapter, struct bcm_firmware_info *psFwInfo); void CopyMIBSExtendedSFParameters(PMINI_ADAPTER Adapter, CServiceFlowParamSI *psfLocalSet, UINT uiSearchRuleIndex); -- cgit v0.10.2 From 406a50826fb728ff3105907a2bf3e3180667e122 Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Sat, 26 May 2012 12:04:57 -0400 Subject: Staging: bcm: Remove typedef for _ETH_HEADER_STRUC and call directly. This patch removes typedef for _ETH_HEADER_STRUC, changes the name of the struct from _ETH_HEADER_STRUC to bcm_eth_header. In addition, any calls to the following typedefs "ETH_HEADER_STRUC, *PETH_HEADER_STRUC" are changed to call the struct directly. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index 12a43fb..338f1ac 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -528,12 +528,11 @@ typedef struct _MINI_ADAPTER MINI_ADAPTER, *PMINI_ADAPTER; #define GET_BCM_ADAPTER(net_dev) netdev_priv(net_dev) -struct _ETH_HEADER_STRUC { +struct bcm_eth_header { UCHAR au8DestinationAddress[6]; UCHAR au8SourceAddress[6]; USHORT u16Etype; } __packed; -typedef struct _ETH_HEADER_STRUC ETH_HEADER_STRUC, *PETH_HEADER_STRUC; struct bcm_firmware_info { void __user *pvMappedFirmwareAddress; diff --git a/drivers/staging/bcm/Protocol.h b/drivers/staging/bcm/Protocol.h index b8a4009..562d4dd 100644 --- a/drivers/staging/bcm/Protocol.h +++ b/drivers/staging/bcm/Protocol.h @@ -55,7 +55,7 @@ typedef struct _S_ETHCS_PKT_INFO typedef struct _ETH_CS_802_Q_FRAME { - ETH_HEADER_STRUC EThHdr; + struct bcm_eth_header EThHdr; USHORT UserPriority:3; USHORT CFI:1; USHORT VLANID:12; @@ -64,7 +64,7 @@ typedef struct _ETH_CS_802_Q_FRAME typedef struct _ETH_CS_802_LLC_FRAME { - ETH_HEADER_STRUC EThHdr; + struct bcm_eth_header EThHdr; unsigned char DSAP; unsigned char SSAP; unsigned char Control; @@ -72,7 +72,7 @@ typedef struct _ETH_CS_802_LLC_FRAME typedef struct _ETH_CS_802_LLC_SNAP_FRAME { - ETH_HEADER_STRUC EThHdr; + struct bcm_eth_header EThHdr; unsigned char DSAP; unsigned char SSAP; unsigned char Control; @@ -82,7 +82,7 @@ typedef struct _ETH_CS_802_LLC_SNAP_FRAME typedef struct _ETH_CS_ETH2_FRAME { - ETH_HEADER_STRUC EThHdr; + struct bcm_eth_header EThHdr; } __attribute__((packed)) ETH_CS_ETH2_FRAME; #define ETHERNET_FRAMETYPE_IPV4 ntohs(0x0800) diff --git a/drivers/staging/bcm/Qos.c b/drivers/staging/bcm/Qos.c index c97020f..9bf61ff 100644 --- a/drivers/staging/bcm/Qos.c +++ b/drivers/staging/bcm/Qos.c @@ -733,7 +733,7 @@ static BOOLEAN EthCSMatchVLANRules(S_CLASSIFIER_RULE *pstClassifierRule,struct s if(pstEthCsPktInfo->eNwpktEthFrameType!=eEth802QVLANFrame) return FALSE; - uPriority = (ntohs(*(USHORT *)(skb->data + sizeof(ETH_HEADER_STRUC))) & 0xF000) >> 13; + uPriority = (ntohs(*(USHORT *)(skb->data + sizeof(struct bcm_eth_header))) & 0xF000) >> 13; if((uPriority >= pstClassifierRule->usUserPriority[0]) && (uPriority <= pstClassifierRule->usUserPriority[1])) bClassificationSucceed = TRUE; @@ -751,7 +751,7 @@ static BOOLEAN EthCSMatchVLANRules(S_CLASSIFIER_RULE *pstClassifierRule,struct s if(pstEthCsPktInfo->eNwpktEthFrameType!=eEth802QVLANFrame) return FALSE; - usVLANID = ntohs(*(USHORT *)(skb->data + sizeof(ETH_HEADER_STRUC))) & 0xFFF; + usVLANID = ntohs(*(USHORT *)(skb->data + sizeof(struct bcm_eth_header))) & 0xFFF; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "%s Pkt VLANID %x Priority: %d\n",__FUNCTION__,usVLANID, uPriority); @@ -774,12 +774,12 @@ static BOOLEAN EThCSClassifyPkt(PMINI_ADAPTER Adapter,struct sk_buff* skb, B_UINT8 EthCSCupport) { BOOLEAN bClassificationSucceed = FALSE; - bClassificationSucceed = EthCSMatchSrcMACAddress(pstClassifierRule,((ETH_HEADER_STRUC *)(skb->data))->au8SourceAddress); + bClassificationSucceed = EthCSMatchSrcMACAddress(pstClassifierRule,((struct bcm_eth_header *)(skb->data))->au8SourceAddress); if(!bClassificationSucceed) return FALSE; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "ETH CS SrcMAC Matched\n"); - bClassificationSucceed = EthCSMatchDestMACAddress(pstClassifierRule,((ETH_HEADER_STRUC*)(skb->data))->au8DestinationAddress); + bClassificationSucceed = EthCSMatchDestMACAddress(pstClassifierRule,((struct bcm_eth_header *)(skb->data))->au8DestinationAddress); if(!bClassificationSucceed) return FALSE; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "ETH CS DestMAC Matched\n"); @@ -804,7 +804,7 @@ static BOOLEAN EThCSClassifyPkt(PMINI_ADAPTER Adapter,struct sk_buff* skb, static void EThCSGetPktInfo(PMINI_ADAPTER Adapter,PVOID pvEthPayload, PS_ETHCS_PKT_INFO pstEthCsPktInfo) { - USHORT u16Etype = ntohs(((ETH_HEADER_STRUC*)pvEthPayload)->u16Etype); + USHORT u16Etype = ntohs(((struct bcm_eth_header *)pvEthPayload)->u16Etype); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "EthCSGetPktInfo : Eth Hdr Type : %X\n",u16Etype); if(u16Etype > 0x5dc) @@ -845,7 +845,7 @@ static void EThCSGetPktInfo(PMINI_ADAPTER Adapter,PVOID pvEthPayload, else pstEthCsPktInfo->eNwpktIPFrameType = eNonIPPacket; - pstEthCsPktInfo->usEtherType = ((ETH_HEADER_STRUC*)pvEthPayload)->u16Etype; + pstEthCsPktInfo->usEtherType = ((struct bcm_eth_header *)pvEthPayload)->u16Etype; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "EthCsPktInfo->eNwpktIPFrameType : %x\n",pstEthCsPktInfo->eNwpktIPFrameType); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "EthCsPktInfo->eNwpktEthFrameType : %x\n",pstEthCsPktInfo->eNwpktEthFrameType); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "EthCsPktInfo->usEtherType : %x\n",pstEthCsPktInfo->usEtherType); -- cgit v0.10.2 From 3753164384a99c52682ba6dc38a9c8a87ecf55ad Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Sat, 26 May 2012 12:04:58 -0400 Subject: Staging: bcm: Remove typedef for _STTARGETDSXBUFFER and call directly. This patch removes typedef for _STTARGETDSXBUFFER, changes the name of the struct from _STTARGETDSXBUFFER to bcm_targetdsx_buffer. In addition, any calls to the following typedefs "STTARGETDSXBUFFER, *PSTTARGETDSXBUFFER" are changed to call the struct directly. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index 338f1ac..1d18ef9 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -332,11 +332,11 @@ typedef struct _TARGET_PARAMS { } STARGETPARAMS, *PSTARGETPARAMS; #endif -typedef struct _STTARGETDSXBUFFER { +struct bcm_targetdsx_buffer { ULONG ulTargetDsxBuffer; B_UINT16 tid; BOOLEAN valid; -} STTARGETDSXBUFFER, *PSTTARGETDSXBUFFER; +}; typedef int (*FP_FLASH_WRITE)(struct _MINI_ADAPTER *, UINT, PVOID); @@ -404,7 +404,7 @@ struct _MINI_ADAPTER { UINT index_datpkt; struct semaphore rdmwrmsync; - STTARGETDSXBUFFER astTargetDsxBuffer[MAX_TARGET_DSX_BUFFERS]; + struct bcm_targetdsx_buffer astTargetDsxBuffer[MAX_TARGET_DSX_BUFFERS]; ULONG ulFreeTargetBufferCnt; ULONG ulCurrentTargetBuffer; ULONG ulTotalTargetBuffersAvailable; -- cgit v0.10.2 From d0830f6c44050b78fde2fca8597d04064854cd87 Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Sat, 26 May 2012 12:04:59 -0400 Subject: Staging: bcm: Remove condition check on macro REL_4_1 because it is not used. This patch removes the conditional check on macro REL_4_1, and the corresponding controlled text because it is not used. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index 1d18ef9..ade2b0d 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -251,87 +251,6 @@ typedef struct _PER_TARANG_DATA { ULONG RxCntrlMsgBitMask; } PER_TARANG_DATA, *PPER_TARANG_DATA; -#ifdef REL_4_1 -typedef struct _TARGET_PARAMS { - B_UINT32 m_u32CfgVersion; - - /* Scanning Related Params */ - B_UINT32 m_u32CenterFrequency; - B_UINT32 m_u32BandAScan; - B_UINT32 m_u32BandBScan; - B_UINT32 m_u32BandCScan; - - /* QoS Params */ - B_UINT32 m_u32minGrantsize; /* size of minimum grant is 0 or 6 */ - B_UINT32 m_u32PHSEnable; - - /* HO Params */ - B_UINT32 m_u32HoEnable; - B_UINT32 m_u32HoReserved1; - B_UINT32 m_u32HoReserved2; - - /* Power Control Params */ - B_UINT32 m_u32MimoEnable; - B_UINT32 m_u32SecurityEnable; - /* - * bit 1: 1 Idlemode enable; - * bit 2: 1 Sleepmode Enable - */ - B_UINT32 m_u32PowerSavingModesEnable; - /* PowerSaving Mode Options: - * bit 0 = 1: CPE mode - to keep pcmcia if alive; - * bit 1 = 1: CINR reporing in Idlemode Msg - * bit 2 = 1: Default PSC Enable in sleepmode - */ - B_UINT32 m_u32PowerSavingModeOptions; - - B_UINT32 m_u32ArqEnable; - - /* From Version #3, the HARQ section renamed as general */ - B_UINT32 m_u32HarqEnable; - /* EEPROM Param Location */ - B_UINT32 m_u32EEPROMFlag; - /* BINARY TYPE - 4th MSByte: - * Interface Type - 3rd MSByte: - * Vendor Type - 2nd MSByte - */ - /* Unused - LSByte */ - B_UINT32 m_u32Customize; - B_UINT32 m_u32ConfigBW; /* In Hz */ - B_UINT32 m_u32ShutDownTimer; - B_UINT32 m_u32RadioParameter; - B_UINT32 m_u32PhyParameter1; - B_UINT32 m_u32PhyParameter2; - B_UINT32 m_u32PhyParameter3; - - /* in eval mode only; - * lower 16bits = basic cid for testing; - * then bit 16 is test cqich, - * bit 17 test init rang; - * bit 18 test periodic rang - * bit 19 is test harq ack/nack - */ - B_UINT32 m_u32TestOptions; - B_UINT32 m_u32MaxMACDataperDLFrame; - B_UINT32 m_u32MaxMACDataperULFrame; - B_UINT32 m_u32Corr2MacFlags; - - /* adding driver params. */ - B_UINT32 HostDrvrConfig1; - B_UINT32 HostDrvrConfig2; - B_UINT32 HostDrvrConfig3; - B_UINT32 HostDrvrConfig4; - B_UINT32 HostDrvrConfig5; - B_UINT32 HostDrvrConfig6; - B_UINT32 m_u32SegmentedPUSCenable; - - /* BAMC enable - but 4.x does not support this feature - * This is added just to sync 4.x and 5.x CFGs - */ - B_UINT32 m_u32BandAMCEnable; -} STARGETPARAMS, *PSTARGETPARAMS; -#endif - struct bcm_targetdsx_buffer { ULONG ulTargetDsxBuffer; B_UINT16 tid; diff --git a/drivers/staging/bcm/Macros.h b/drivers/staging/bcm/Macros.h index 46ed99c..8238cdb 100644 --- a/drivers/staging/bcm/Macros.h +++ b/drivers/staging/bcm/Macros.h @@ -252,11 +252,7 @@ typedef enum _E_PHS_DSC_ACTION { #define IDLE_MODE_WAKEUP_NOTIFIER_ADDRESS 0x1FC02FA8 #define IDLE_MODE_MAX_RETRY_COUNT 1000 -#ifdef REL_4_1 -#define CONFIG_BEGIN_ADDR 0xBF60B004 -#else #define CONFIG_BEGIN_ADDR 0xBF60B000 -#endif #define FIRMWARE_BEGIN_ADDR 0xBFC00000 -- cgit v0.10.2 From 774bea8314c3fa59a977e64114286d6e3341b7cc Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Sat, 26 May 2012 12:05:00 -0400 Subject: Staging: bcm: Remove typedef for _PER_TARANG_DATA and call directly. This patch removes typedef for _PER_TARANG_DATA, changes the name of the struct from _PER_TARANG_DATA to bcm_per_tarang_data. In addition, any calls to the following typedefs "PER_TARANG_DATA, *PPER_TARANG_DATA" are changed to call the struct directly. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index ade2b0d..7f58322 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -239,8 +239,8 @@ struct _packet_info { }; typedef struct _packet_info PacketInfo; -typedef struct _PER_TARANG_DATA { - struct _PER_TARANG_DATA *next; +struct bcm_tarang_data { + struct bcm_tarang_data *next; struct _MINI_ADAPTER *Adapter; struct sk_buff *RxAppControlHead; struct sk_buff *RxAppControlTail; @@ -249,7 +249,7 @@ typedef struct _PER_TARANG_DATA { BOOLEAN bApplicationToExit; S_MIBS_DROPPED_APP_CNTRL_MESSAGES stDroppedAppCntrlMsgs; ULONG RxCntrlMsgBitMask; -} PER_TARANG_DATA, *PPER_TARANG_DATA; +}; struct bcm_targetdsx_buffer { ULONG ulTargetDsxBuffer; @@ -280,7 +280,7 @@ struct _MINI_ADAPTER { struct sk_buff *RxControlTail; struct semaphore RxAppControlQueuelock; struct semaphore fw_download_sema; - PPER_TARANG_DATA pTarangs; + struct bcm_tarang_data *pTarangs; spinlock_t control_queue_lock; wait_queue_head_t process_read_wait_queue; diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index cd0348e..03dc2b0 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c @@ -16,10 +16,10 @@ static int bcm_char_open(struct inode *inode, struct file * filp) { PMINI_ADAPTER Adapter = NULL; - PPER_TARANG_DATA pTarang = NULL; + struct bcm_tarang_data *pTarang = NULL; Adapter = GET_BCM_ADAPTER(gblpnetdev); - pTarang = kzalloc(sizeof(PER_TARANG_DATA), GFP_KERNEL); + pTarang = kzalloc(sizeof(struct bcm_tarang_data), GFP_KERNEL); if (!pTarang) return -ENOMEM; @@ -43,11 +43,11 @@ static int bcm_char_open(struct inode *inode, struct file * filp) static int bcm_char_release(struct inode *inode, struct file *filp) { - PPER_TARANG_DATA pTarang, tmp, ptmp; + struct bcm_tarang_data *pTarang, *tmp, *ptmp; PMINI_ADAPTER Adapter = NULL; struct sk_buff *pkt, *npkt; - pTarang = (PPER_TARANG_DATA)filp->private_data; + pTarang = (struct bcm_tarang_data *)filp->private_data; if (pTarang == NULL) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, @@ -97,7 +97,7 @@ static int bcm_char_release(struct inode *inode, struct file *filp) static ssize_t bcm_char_read(struct file *filp, char __user *buf, size_t size, loff_t *f_pos) { - PPER_TARANG_DATA pTarang = filp->private_data; + struct bcm_tarang_data *pTarang = filp->private_data; PMINI_ADAPTER Adapter = pTarang->Adapter; struct sk_buff *Packet = NULL; ssize_t PktLen = 0; @@ -155,7 +155,7 @@ static ssize_t bcm_char_read(struct file *filp, char __user *buf, size_t size, static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) { - PPER_TARANG_DATA pTarang = filp->private_data; + struct bcm_tarang_data *pTarang = filp->private_data; void __user *argp = (void __user *)arg; PMINI_ADAPTER Adapter = pTarang->Adapter; INT Status = STATUS_FAILURE; diff --git a/drivers/staging/bcm/HandleControlPacket.c b/drivers/staging/bcm/HandleControlPacket.c index b058e30..691b366 100644 --- a/drivers/staging/bcm/HandleControlPacket.c +++ b/drivers/staging/bcm/HandleControlPacket.c @@ -13,7 +13,7 @@ */ static VOID handle_rx_control_packet(PMINI_ADAPTER Adapter, struct sk_buff *skb) { - PPER_TARANG_DATA pTarang = NULL; + struct bcm_tarang_data *pTarang = NULL; BOOLEAN HighPriorityMessage = FALSE; struct sk_buff *newPacket = NULL; CHAR cntrl_msg_mask_bit = 0; @@ -214,7 +214,7 @@ int control_packet_handler(PMINI_ADAPTER Adapter /* pointer to adapter object*/) INT flushAllAppQ(void) { PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); - PPER_TARANG_DATA pTarang = NULL; + struct bcm_tarang_data *pTarang = NULL; struct sk_buff *PacketToDrop = NULL; for (pTarang = Adapter->pTarangs; pTarang; pTarang = pTarang->next) { while (pTarang->RxAppControlHead != NULL) { diff --git a/drivers/staging/bcm/Prototypes.h b/drivers/staging/bcm/Prototypes.h index a8676b9..b22f61d 100644 --- a/drivers/staging/bcm/Prototypes.h +++ b/drivers/staging/bcm/Prototypes.h @@ -89,7 +89,7 @@ void SendIdleModeResponse(PMINI_ADAPTER Adapter); int ProcessGetHostMibs(PMINI_ADAPTER Adapter, S_MIBS_HOST_STATS_MIBS *buf); -void GetDroppedAppCntrlPktMibs(S_MIBS_HOST_STATS_MIBS *ioBuffer, PPER_TARANG_DATA pTarang); +void GetDroppedAppCntrlPktMibs(S_MIBS_HOST_STATS_MIBS *ioBuffer, struct bcm_tarang_data *pTarang); void beceem_parse_target_struct(PMINI_ADAPTER Adapter); int bcm_ioctl_fw_download(PMINI_ADAPTER Adapter, struct bcm_firmware_info *psFwInfo); diff --git a/drivers/staging/bcm/hostmibs.c b/drivers/staging/bcm/hostmibs.c index 101c4e3..27ddcbf 100644 --- a/drivers/staging/bcm/hostmibs.c +++ b/drivers/staging/bcm/hostmibs.c @@ -94,7 +94,7 @@ INT ProcessGetHostMibs(PMINI_ADAPTER Adapter, S_MIBS_HOST_STATS_MIBS *pstHostMib return STATUS_SUCCESS; } -VOID GetDroppedAppCntrlPktMibs(S_MIBS_HOST_STATS_MIBS *pstHostMibs, const PPER_TARANG_DATA pTarang) +VOID GetDroppedAppCntrlPktMibs(S_MIBS_HOST_STATS_MIBS *pstHostMibs, struct bcm_tarang_data *pTarang) { memcpy(&(pstHostMibs->stDroppedAppCntrlMsgs), &(pTarang->stDroppedAppCntrlMsgs), -- cgit v0.10.2 From 0b3edf760a56cf5372d2dafa35b400561ddc0eb0 Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Sat, 26 May 2012 12:05:01 -0400 Subject: Staging: bcm: Remove typedef for _packet_info and call directly. This patch removes typedef for _packet_info, changes the name of the struct from _packet_info to bcm_packet_info. In addition, any calls to the following typedefs "PacketInfo, _packet_info" are changed to call the struct directly. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index 7f58322..20ac2b3 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -99,7 +99,6 @@ typedef union _U_IP_ADDRESS { UCHAR ucIpv6Mask[MAX_IP_RANGE_LENGTH * IPV6_ADDRESS_SIZEINBYTES]; }; } U_IP_ADDRESS; -struct _packet_info; typedef struct _S_HDR_SUPRESSION_CONTEXTINFO { UCHAR ucaHdrSupressionInBuf[MAX_PHS_LENGTHS]; /* Intermediate buffer to accumulate pkt Header for PHS */ @@ -168,7 +167,7 @@ typedef struct _S_FRAGMENTED_PACKET_INFO { BOOLEAN bOutOfOrderFragment; } S_FRAGMENTED_PACKET_INFO, *PS_FRAGMENTED_PACKET_INFO; -struct _packet_info { +struct bcm_packet_info { /* classification extension Rule */ ULONG ulSFID; USHORT usVCID_Value; @@ -237,7 +236,6 @@ struct _packet_info { UCHAR bIPCSSupport; UCHAR bEthCSSupport; }; -typedef struct _packet_info PacketInfo; struct bcm_tarang_data { struct bcm_tarang_data *next; @@ -296,7 +294,7 @@ struct _MINI_ADAPTER { USHORT PrevNumRecvDescs; USHORT CurrNumRecvDescs; UINT u32TotalDSD; - PacketInfo PackInfo[NO_OF_QUEUES]; + struct bcm_packet_info PackInfo[NO_OF_QUEUES]; S_CLASSIFIER_RULE astClassifierTable[MAX_CLASSIFIERS]; BOOLEAN TransferMode; diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index 03dc2b0..8d4052a 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c @@ -971,7 +971,7 @@ cntrlEnd: break; case IOCTL_GET_PACK_INFO: - if (copy_to_user(argp, &Adapter->PackInfo, sizeof(PacketInfo)*NO_OF_QUEUES)) + if (copy_to_user(argp, &Adapter->PackInfo, sizeof(struct bcm_packet_info)*NO_OF_QUEUES)) return -EFAULT; Status = STATUS_SUCCESS; break; diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 7e38af5..f584fdc 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -1918,7 +1918,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /* "); /* Validate the parameters */ @@ -113,7 +113,7 @@ This function despatches packet from the specified queue. @return Zero(success) or Negative value(failure) */ static INT SendPacketFromQueue(PMINI_ADAPTER Adapter,/**bValid || !pb->bValid) return 0; @@ -27,7 +27,7 @@ VOID SortPackInfo(PMINI_ADAPTER Adapter) BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<======="); - sort(Adapter->PackInfo, NO_OF_QUEUES, sizeof(PacketInfo), + sort(Adapter->PackInfo, NO_OF_QUEUES, sizeof(struct bcm_packet_info), compare_packet_info, NULL); } -- cgit v0.10.2 From 7f22485def175b9378019b90a1a54cd8f5df0af0 Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Sat, 26 May 2012 12:05:02 -0400 Subject: Staging: bcm: Remove typedef for _S_FRAGMENTED_PACKET_INFO and call directly. This patch removes typedef for _S_FRAGMENTED_PACKET_INFO, changes the name of the struct from _S_FRAGMENTED_PACKET_INFO to bcm_fragmented_packet_info. In addition, any calls to the following typedefs "S_FRAGMENTED_PACKET_INFO, *PS_FRAGMENTED_PACKET_INFO" are changed to call the struct directly. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index 20ac2b3..f604b1b 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -159,13 +159,13 @@ typedef struct _S_CLASSIFIER_RULE { } S_CLASSIFIER_RULE; /* typedef struct _S_CLASSIFIER_RULE S_CLASSIFIER_RULE; */ -typedef struct _S_FRAGMENTED_PACKET_INFO { +struct bcm_fragmented_packet_info { BOOLEAN bUsed; ULONG ulSrcIpAddress; USHORT usIpIdentification; S_CLASSIFIER_RULE *pstMatchedClassifierEntry; BOOLEAN bOutOfOrderFragment; -} S_FRAGMENTED_PACKET_INFO, *PS_FRAGMENTED_PACKET_INFO; +}; struct bcm_packet_info { /* classification extension Rule */ @@ -389,7 +389,7 @@ struct _MINI_ADAPTER { BOOLEAN bDPLLConfig; UINT32 aTxPktSizeHist[MIBS_MAX_HIST_ENTRIES]; UINT32 aRxPktSizeHist[MIBS_MAX_HIST_ENTRIES]; - S_FRAGMENTED_PACKET_INFO astFragmentedPktClassifierTable[MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES]; + struct bcm_fragmented_packet_info astFragmentedPktClassifierTable[MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES]; atomic_t uiMBupdate; UINT32 PmuMode; NVM_TYPE eNVMType; diff --git a/drivers/staging/bcm/Misc.c b/drivers/staging/bcm/Misc.c index 8223a69..3ca962d 100644 --- a/drivers/staging/bcm/Misc.c +++ b/drivers/staging/bcm/Misc.c @@ -1533,12 +1533,12 @@ S_CLASSIFIER_RULE *GetFragIPClsEntry(PMINI_ADAPTER Adapter, USHORT usIpIdentific return NULL; } -void AddFragIPClsEntry(PMINI_ADAPTER Adapter, PS_FRAGMENTED_PACKET_INFO psFragPktInfo) +void AddFragIPClsEntry(PMINI_ADAPTER Adapter, struct bcm_fragmented_packet_info *psFragPktInfo) { UINT uiIndex = 0; for (uiIndex = 0; uiIndex < MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES; uiIndex++) { if (!Adapter->astFragmentedPktClassifierTable[uiIndex].bUsed) { - memcpy(&Adapter->astFragmentedPktClassifierTable[uiIndex], psFragPktInfo, sizeof(S_FRAGMENTED_PACKET_INFO)); + memcpy(&Adapter->astFragmentedPktClassifierTable[uiIndex], psFragPktInfo, sizeof(struct bcm_fragmented_packet_info)); break; } } @@ -1552,7 +1552,7 @@ void DelFragIPClsEntry(PMINI_ADAPTER Adapter, USHORT usIpIdentification, ULONG S (Adapter->astFragmentedPktClassifierTable[uiIndex].usIpIdentification == usIpIdentification) && (Adapter->astFragmentedPktClassifierTable[uiIndex].ulSrcIpAddress == SrcIp)) - memset(&Adapter->astFragmentedPktClassifierTable[uiIndex], 0, sizeof(S_FRAGMENTED_PACKET_INFO)); + memset(&Adapter->astFragmentedPktClassifierTable[uiIndex], 0, sizeof(struct bcm_fragmented_packet_info)); } } @@ -1652,7 +1652,7 @@ static void beceem_protocol_reset(PMINI_ADAPTER Adapter) if (Adapter->TimerActive == TRUE) Adapter->TimerActive = FALSE; - memset(Adapter->astFragmentedPktClassifierTable, 0, sizeof(S_FRAGMENTED_PACKET_INFO) * MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES); + memset(Adapter->astFragmentedPktClassifierTable, 0, sizeof(struct bcm_fragmented_packet_info) * MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES); for (i = 0; i < HiPriority; i++) { /* resetting only the first size (S_MIBS_SERVICEFLOW_TABLE) for the SF. */ diff --git a/drivers/staging/bcm/Prototypes.h b/drivers/staging/bcm/Prototypes.h index b22f61d..4bb3796 100644 --- a/drivers/staging/bcm/Prototypes.h +++ b/drivers/staging/bcm/Prototypes.h @@ -103,7 +103,7 @@ int InitLedSettings(PMINI_ADAPTER Adapter); S_CLASSIFIER_RULE *GetFragIPClsEntry(PMINI_ADAPTER Adapter,USHORT usIpIdentification,ULONG SrcIP); -void AddFragIPClsEntry(PMINI_ADAPTER Adapter,PS_FRAGMENTED_PACKET_INFO psFragPktInfo); +void AddFragIPClsEntry(PMINI_ADAPTER Adapter, struct bcm_fragmented_packet_info *psFragPktInfo); void DelFragIPClsEntry(PMINI_ADAPTER Adapter,USHORT usIpIdentification,ULONG SrcIp); diff --git a/drivers/staging/bcm/Qos.c b/drivers/staging/bcm/Qos.c index 9bf61ff..c87801c 100644 --- a/drivers/staging/bcm/Qos.c +++ b/drivers/staging/bcm/Qos.c @@ -631,7 +631,7 @@ USHORT ClassifyPacket(PMINI_ADAPTER Adapter,struct sk_buff* skb) if(bFragmentedPkt && (usCurrFragment == 0)) { //First Fragment of Fragmented Packet. Create Frag CLS Entry - S_FRAGMENTED_PACKET_INFO stFragPktInfo; + struct bcm_fragmented_packet_info stFragPktInfo; stFragPktInfo.bUsed = TRUE; stFragPktInfo.ulSrcIpAddress = pIpHeader->saddr; stFragPktInfo.usIpIdentification = pIpHeader->id; -- cgit v0.10.2 From 92562aeec46c965821c59f78e58f1cfe0a47bbaf Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Sat, 26 May 2012 12:05:03 -0400 Subject: Staging: bcm: Remove typedef for _S_CLASSIFIER_RULE and call directly. This patch removes typedef for _S_CLASSIFIER_RULE, changes the name of the struct from _S_CLASSIFIER_RULE to bcm_classifier_rule. In addition, any calls to the following typedefs "S_CLASSIFIER_RULE" are changed to call the struct directly. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index f604b1b..d2260fe 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -105,7 +105,7 @@ typedef struct _S_HDR_SUPRESSION_CONTEXTINFO { UCHAR ucaHdrSupressionOutBuf[MAX_PHS_LENGTHS + PHSI_LEN]; /* Intermediate buffer containing pkt Header after PHS */ } S_HDR_SUPRESSION_CONTEXTINFO; -typedef struct _S_CLASSIFIER_RULE { +struct bcm_classifier_rule { ULONG ulSFID; UCHAR ucReserved[2]; B_UINT16 uiClassifierRuleIndex; @@ -156,14 +156,13 @@ typedef struct _S_CLASSIFIER_RULE { UCHAR usUserPriority[2]; USHORT usVLANID; USHORT usValidityBitMap; -} S_CLASSIFIER_RULE; -/* typedef struct _S_CLASSIFIER_RULE S_CLASSIFIER_RULE; */ +}; struct bcm_fragmented_packet_info { BOOLEAN bUsed; ULONG ulSrcIpAddress; USHORT usIpIdentification; - S_CLASSIFIER_RULE *pstMatchedClassifierEntry; + struct bcm_classifier_rule *pstMatchedClassifierEntry; BOOLEAN bOutOfOrderFragment; }; @@ -295,7 +294,7 @@ struct _MINI_ADAPTER { USHORT CurrNumRecvDescs; UINT u32TotalDSD; struct bcm_packet_info PackInfo[NO_OF_QUEUES]; - S_CLASSIFIER_RULE astClassifierTable[MAX_CLASSIFIERS]; + struct bcm_classifier_rule astClassifierTable[MAX_CLASSIFIERS]; BOOLEAN TransferMode; /*************** qos ******************/ diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index f584fdc..a0b1720 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -112,7 +112,7 @@ static VOID deleteSFBySfid(PMINI_ADAPTER Adapter, UINT uiSearchRuleIndex) } static inline VOID -CopyIpAddrToClassifier(S_CLASSIFIER_RULE *pstClassifierEntry, +CopyIpAddrToClassifier(struct bcm_classifier_rule *pstClassifierEntry, B_UINT8 u8IpAddressLen, B_UINT8 *pu8IpAddressMaskSrc, BOOLEAN bIpVersion6, E_IPADDR_CONTEXT eIpAddrContext) { @@ -238,7 +238,7 @@ void ClearTargetDSXBuffer(PMINI_ADAPTER Adapter, B_UINT16 TID, BOOLEAN bFreeAll) */ static inline VOID CopyClassifierRuleToSF(PMINI_ADAPTER Adapter, stConvergenceSLTypes *psfCSType, UINT uiSearchRuleIndex, UINT nClassifierIndex) { - S_CLASSIFIER_RULE *pstClassifierEntry = NULL; + struct bcm_classifier_rule *pstClassifierEntry = NULL; /* VOID *pvPhsContext = NULL; */ int i; /* UCHAR ucProtocolLength=0; */ @@ -367,7 +367,7 @@ static inline VOID CopyClassifierRuleToSF(PMINI_ADAPTER Adapter, stConvergenceSL */ static inline VOID DeleteClassifierRuleFromSF(PMINI_ADAPTER Adapter, UINT uiSearchRuleIndex, UINT nClassifierIndex) { - S_CLASSIFIER_RULE *pstClassifierEntry = NULL; + struct bcm_classifier_rule *pstClassifierEntry = NULL; B_UINT16 u16PacketClassificationRuleIndex; USHORT usVCID; /* VOID *pvPhsContext = NULL; */ @@ -386,7 +386,7 @@ static inline VOID DeleteClassifierRuleFromSF(PMINI_ADAPTER Adapter, UINT uiSear if (pstClassifierEntry) { pstClassifierEntry->bUsed = FALSE; pstClassifierEntry->uiClassifierRuleIndex = 0; - memset(pstClassifierEntry, 0, sizeof(S_CLASSIFIER_RULE)); + memset(pstClassifierEntry, 0, sizeof(struct bcm_classifier_rule)); /* Delete the PHS Rule for this classifier */ PhsDeleteClassifierRule(&Adapter->stBCMPhsContext, usVCID, u16PacketClassificationRuleIndex); @@ -398,7 +398,7 @@ static inline VOID DeleteClassifierRuleFromSF(PMINI_ADAPTER Adapter, UINT uiSear */ VOID DeleteAllClassifiersForSF(PMINI_ADAPTER Adapter, UINT uiSearchRuleIndex) { - S_CLASSIFIER_RULE *pstClassifierEntry = NULL; + struct bcm_classifier_rule *pstClassifierEntry = NULL; int i; /* B_UINT16 u16PacketClassificationRuleIndex; */ USHORT ulVCID; diff --git a/drivers/staging/bcm/IPv6Protocol.c b/drivers/staging/bcm/IPv6Protocol.c index 1da2164..4adbf9d 100644 --- a/drivers/staging/bcm/IPv6Protocol.c +++ b/drivers/staging/bcm/IPv6Protocol.c @@ -1,8 +1,8 @@ #include "headers.h" -static BOOLEAN MatchSrcIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule, +static BOOLEAN MatchSrcIpv6Address(struct bcm_classifier_rule *pstClassifierRule, IPV6Header *pstIpv6Header); -static BOOLEAN MatchDestIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule, +static BOOLEAN MatchDestIpv6Address(struct bcm_classifier_rule *pstClassifierRule, IPV6Header *pstIpv6Header); static VOID DumpIpv6Header(IPV6Header *pstIpv6Header); @@ -181,7 +181,7 @@ static UCHAR GetIpv6ProtocolPorts(UCHAR *pucPayload, USHORT *pusSrcPort, * Arg 2 PVOID pcIpHeader is a pointer to the IP header of the packet */ USHORT IpVersion6(PMINI_ADAPTER Adapter, PVOID pcIpHeader, - S_CLASSIFIER_RULE *pstClassifierRule) + struct bcm_classifier_rule *pstClassifierRule) { USHORT ushDestPort = 0; USHORT ushSrcPort = 0; @@ -288,7 +288,7 @@ USHORT IpVersion6(PMINI_ADAPTER Adapter, PVOID pcIpHeader, } -static BOOLEAN MatchSrcIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule, +static BOOLEAN MatchSrcIpv6Address(struct bcm_classifier_rule *pstClassifierRule, IPV6Header *pstIpv6Header) { UINT uiLoopIndex = 0; @@ -344,7 +344,7 @@ static BOOLEAN MatchSrcIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule, return FALSE; } -static BOOLEAN MatchDestIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule, +static BOOLEAN MatchDestIpv6Address(struct bcm_classifier_rule *pstClassifierRule, IPV6Header *pstIpv6Header) { UINT uiLoopIndex = 0; diff --git a/drivers/staging/bcm/IPv6ProtocolHdr.h b/drivers/staging/bcm/IPv6ProtocolHdr.h index a0db5a1..369b553 100644 --- a/drivers/staging/bcm/IPv6ProtocolHdr.h +++ b/drivers/staging/bcm/IPv6ProtocolHdr.h @@ -104,13 +104,13 @@ typedef enum _E_IPADDR_CONTEXT USHORT IpVersion6(PMINI_ADAPTER Adapter, /**< Pointer to the driver control structure */ PVOID pcIpHeader, /**bShutStatus = FALSE; } -S_CLASSIFIER_RULE *GetFragIPClsEntry(PMINI_ADAPTER Adapter, USHORT usIpIdentification, ULONG SrcIP) +struct bcm_classifier_rule *GetFragIPClsEntry(PMINI_ADAPTER Adapter, USHORT usIpIdentification, ULONG SrcIP) { UINT uiIndex = 0; for (uiIndex = 0; uiIndex < MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES; uiIndex++) { diff --git a/drivers/staging/bcm/Prototypes.h b/drivers/staging/bcm/Prototypes.h index 4bb3796..42a04b9 100644 --- a/drivers/staging/bcm/Prototypes.h +++ b/drivers/staging/bcm/Prototypes.h @@ -33,9 +33,9 @@ INT SearchSfid(PMINI_ADAPTER Adapter,UINT uiSfid); USHORT ClassifyPacket(PMINI_ADAPTER Adapter,struct sk_buff* skb); -BOOLEAN MatchSrcPort(S_CLASSIFIER_RULE *pstClassifierRule,USHORT ushSrcPort); -BOOLEAN MatchDestPort(S_CLASSIFIER_RULE *pstClassifierRule,USHORT ushSrcPort); -BOOLEAN MatchProtocol(S_CLASSIFIER_RULE *pstClassifierRule,UCHAR ucProtocol); +BOOLEAN MatchSrcPort(struct bcm_classifier_rule *pstClassifierRule,USHORT ushSrcPort); +BOOLEAN MatchDestPort(struct bcm_classifier_rule *pstClassifierRule,USHORT ushSrcPort); +BOOLEAN MatchProtocol(struct bcm_classifier_rule *pstClassifierRule,UCHAR ucProtocol); INT SetupNextSend(PMINI_ADAPTER Adapter, /**ucEtherTypeLen==0)|| @@ -718,7 +718,7 @@ static BOOLEAN EthCSMatchEThTypeSAP(S_CLASSIFIER_RULE *pstClassifierRule,struct } -static BOOLEAN EthCSMatchVLANRules(S_CLASSIFIER_RULE *pstClassifierRule,struct sk_buff* skb,PS_ETHCS_PKT_INFO pstEthCsPktInfo) +static BOOLEAN EthCSMatchVLANRules(struct bcm_classifier_rule *pstClassifierRule,struct sk_buff* skb,PS_ETHCS_PKT_INFO pstEthCsPktInfo) { BOOLEAN bClassificationSucceed = FALSE; USHORT usVLANID; @@ -770,7 +770,7 @@ static BOOLEAN EthCSMatchVLANRules(S_CLASSIFIER_RULE *pstClassifierRule,struct s static BOOLEAN EThCSClassifyPkt(PMINI_ADAPTER Adapter,struct sk_buff* skb, PS_ETHCS_PKT_INFO pstEthCsPktInfo, - S_CLASSIFIER_RULE *pstClassifierRule, + struct bcm_classifier_rule *pstClassifierRule, B_UINT8 EthCSCupport) { BOOLEAN bClassificationSucceed = FALSE; diff --git a/drivers/staging/bcm/sort.c b/drivers/staging/bcm/sort.c index 79585e4..5f891fa 100644 --- a/drivers/staging/bcm/sort.c +++ b/drivers/staging/bcm/sort.c @@ -33,8 +33,8 @@ VOID SortPackInfo(PMINI_ADAPTER Adapter) static int compare_classifiers(void const *a, void const *b) { - S_CLASSIFIER_RULE const *pa = a; - S_CLASSIFIER_RULE const *pb = b; + struct bcm_classifier_rule const *pa = a; + struct bcm_classifier_rule const *pb = b; if (!pa->bUsed || !pb->bUsed) return 0; @@ -48,5 +48,5 @@ VOID SortClassifiers(PMINI_ADAPTER Adapter) DBG_LVL_ALL, "<======="); sort(Adapter->astClassifierTable, MAX_CLASSIFIERS, - sizeof(S_CLASSIFIER_RULE), compare_classifiers, NULL); + sizeof(struct bcm_classifier_rule), compare_classifiers, NULL); } -- cgit v0.10.2 From f428450a5d675682def5403e6842f6c61872c3dd Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Sat, 26 May 2012 12:05:04 -0400 Subject: Staging: bcm: Remove typedef for _S_HDR_SUPRESSION_CONTEXTINFO and call directly. This patch removes typedef for _S_HDR_SUPRESSION_CONTEXTINFO, changes the name of the struct from _S_HDR_SUPRESSION_CONTEXTINFO to bcm_hdr_supression_contextinfo. In addition, any calls to the following typedefs "S_HDR_SUPRESSION_CONTEXTINFO" are changed to call the struct directly. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index d2260fe..9b5a0aa 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -100,10 +100,10 @@ typedef union _U_IP_ADDRESS { }; } U_IP_ADDRESS; -typedef struct _S_HDR_SUPRESSION_CONTEXTINFO { +struct bcm_hdr_supression_contextinfo { UCHAR ucaHdrSupressionInBuf[MAX_PHS_LENGTHS]; /* Intermediate buffer to accumulate pkt Header for PHS */ UCHAR ucaHdrSupressionOutBuf[MAX_PHS_LENGTHS + PHSI_LEN]; /* Intermediate buffer containing pkt Header after PHS */ -} S_HDR_SUPRESSION_CONTEXTINFO; +}; struct bcm_classifier_rule { ULONG ulSFID; @@ -380,7 +380,7 @@ struct _MINI_ADAPTER { BOOLEAN bLinkDownRequested; int downloadDDR; PHS_DEVICE_EXTENSION stBCMPhsContext; - S_HDR_SUPRESSION_CONTEXTINFO stPhsTxContextInfo; + struct bcm_hdr_supression_contextinfo stPhsTxContextInfo; uint8_t ucaPHSPktRestoreBuf[2048]; uint8_t bPHSEnabled; BOOLEAN AutoFirmDld; -- cgit v0.10.2 From 0e000c2ee331a3389ab8875cb036e9cfcbcebea5 Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Sat, 26 May 2012 12:05:05 -0400 Subject: Staging: bcm: Remove typedef for _CLASSIFICATION_ONLY. This patch removes typedef for _CLASSIFICATION_ONLY, because it is not being used. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index 9b5a0aa..13c0d0a 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -66,16 +66,6 @@ typedef struct _CLASSIFICATION_RULE { USHORT usVcid; } CLASSIFICATION_RULE, *PCLASSIFICATION_RULE; -typedef struct _CLASSIFICATION_ONLY { - USHORT usVcid; - ULONG DestIpAddress; - ULONG DestIpMask; - USHORT usPortLo; - USHORT usPortHi; - BOOLEAN bIpVersion; - UCHAR ucDestinationAddress[16]; -} CLASSIFICATION_ONLY, *PCLASSIFICATION_ONLY; - #define MAX_IP_RANGE_LENGTH 4 #define MAX_PORT_RANGE 4 #define MAX_PROTOCOL_LENGTH 32 -- cgit v0.10.2 From fa64354ff32a06dc8f392c2b3e0ddd57e2eb0357 Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Sat, 26 May 2012 12:05:06 -0400 Subject: Staging: bcm: Remove typedef for _CLASSIFICATION_RULE. This patch removes typedef for _CLASSIFICATION_RULE, because it is not being used. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index 13c0d0a..e626923 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -54,18 +54,6 @@ typedef struct _ADD_CONNECTION { UCHAR SrcProtocol; } ADD_CONNECTION, *PADD_CONNECTION; -typedef struct _CLASSIFICATION_RULE { - UCHAR ucIPSrcAddrLen; - UCHAR ucIPSrcAddr[32]; - UCHAR ucIPDestAddrLen; - UCHAR ucIPDestAddr[32]; - UCHAR ucSrcPortRangeLen; - UCHAR ucSrcPortRange[4]; - UCHAR ucDestPortRangeLen; - UCHAR ucDestPortRange[4]; - USHORT usVcid; -} CLASSIFICATION_RULE, *PCLASSIFICATION_RULE; - #define MAX_IP_RANGE_LENGTH 4 #define MAX_PORT_RANGE 4 #define MAX_PROTOCOL_LENGTH 32 -- cgit v0.10.2 From 845bd532cda92afc3329dff753aefbe4164a8f83 Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Sat, 26 May 2012 12:05:07 -0400 Subject: Staging: bcm: Remove typedef for _ADD_CONNECTION. This patch removes typedef for _ADD_CONNECTION, because it is not being used. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index e626923..5256e3f 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -34,26 +34,6 @@ struct link_request { } __packed; typedef struct link_request LINK_REQUEST, *PLINK_REQUEST; -/* classification extension is added */ -typedef struct _ADD_CONNECTION { - ULONG SrcIpAddressCount; - ULONG SrcIpAddress[MAX_CONNECTIONS]; - ULONG SrcIpMask[MAX_CONNECTIONS]; - - ULONG DestIpAddressCount; - ULONG DestIpAddress[MAX_CONNECTIONS]; - ULONG DestIpMask[MAX_CONNECTIONS]; - - USHORT SrcPortBegin; - USHORT SrcPortEnd; - - USHORT DestPortBegin; - USHORT DestPortEnd; - - UCHAR SrcTOS; - UCHAR SrcProtocol; -} ADD_CONNECTION, *PADD_CONNECTION; - #define MAX_IP_RANGE_LENGTH 4 #define MAX_PORT_RANGE 4 #define MAX_PROTOCOL_LENGTH 32 -- cgit v0.10.2 From 2610c7a889103587ce9a5714291a53dbf5490c3c Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Sat, 26 May 2012 12:05:08 -0400 Subject: Staging: bcm: Remove typedef for link_request and call directly. This patch removes typedef for link_request, changes the name of the struct from link_request to bcm_link_request. In addition, any calls to the following typedefs "LINK_REQUEST, *PLINK_REQUEST, *CONTROL_MESSAGE" are changed to call the struct directly. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index 5256e3f..a36767d 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -28,11 +28,10 @@ struct _CONTROL_PACKET { } __packed; typedef struct _CONTROL_PACKET CONTROL_PACKET, *PCONTROL_PACKET; -struct link_request { +struct bcm_link_request { LEADER Leader; UCHAR szData[4]; } __packed; -typedef struct link_request LINK_REQUEST, *PLINK_REQUEST; #define MAX_IP_RANGE_LENGTH 4 #define MAX_PORT_RANGE 4 @@ -417,8 +416,6 @@ struct bcm_firmware_info { /* holds the value of net_device structure.. */ extern struct net_device *gblpnetdev; -typedef LINK_REQUEST CONTROL_MESSAGE; - struct bcm_ddr_setting { UINT ulRegAddress; UINT ulRegValue; diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index 8d4052a..d1dc0c3 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c @@ -722,7 +722,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER))) return -EFAULT; - if (IoBuffer.InputLength < sizeof(struct link_request)) + if (IoBuffer.InputLength < sizeof(struct bcm_link_request)) return -EINVAL; if (IoBuffer.InputLength > MAX_CNTL_PKT_SIZE) diff --git a/drivers/staging/bcm/InterfaceTx.c b/drivers/staging/bcm/InterfaceTx.c index a842de9..3012f29 100644 --- a/drivers/staging/bcm/InterfaceTx.c +++ b/drivers/staging/bcm/InterfaceTx.c @@ -5,7 +5,7 @@ static void write_bulk_callback(struct urb *urb/*, struct pt_regs *regs*/) { PUSB_TCB pTcb= (PUSB_TCB)urb->context; PS_INTERFACE_ADAPTER psIntfAdapter = pTcb->psIntfAdapter; - CONTROL_MESSAGE *pControlMsg = (CONTROL_MESSAGE *)urb->transfer_buffer; + struct bcm_link_request *pControlMsg = (struct bcm_link_request *)urb->transfer_buffer; PMINI_ADAPTER psAdapter = psIntfAdapter->psAdapter ; BOOLEAN bpowerDownMsg = FALSE ; PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); diff --git a/drivers/staging/bcm/Misc.c b/drivers/staging/bcm/Misc.c index b2d90d1..954c3ad 100644 --- a/drivers/staging/bcm/Misc.c +++ b/drivers/staging/bcm/Misc.c @@ -237,7 +237,7 @@ INT CopyBufferToControlPacket(PMINI_ADAPTER Adapter, PVOID ioBuffer) INT Status = 0; unsigned char *ctrl_buff = NULL; UINT pktlen = 0; - PLINK_REQUEST pLinkReq = NULL; + struct bcm_link_request *pLinkReq = NULL; PUCHAR pucAddIndication = NULL; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "======>"); @@ -246,7 +246,7 @@ INT CopyBufferToControlPacket(PMINI_ADAPTER Adapter, PVOID ioBuffer) return -EINVAL; } - pLinkReq = (PLINK_REQUEST)ioBuffer; + pLinkReq = (struct bcm_link_request *)ioBuffer; pLeader = (PLEADER)ioBuffer; /* ioBuffer Contains sw_Status and Payload */ if (Adapter->bShutStatus == TRUE && @@ -414,7 +414,7 @@ INT CopyBufferToControlPacket(PMINI_ADAPTER Adapter, PVOID ioBuffer) * * Returns - None. *****************************************************************/ -static VOID SendStatisticsPointerRequest(PMINI_ADAPTER Adapter, PLINK_REQUEST pstStatisticsPtrRequest) +static VOID SendStatisticsPointerRequest(PMINI_ADAPTER Adapter, struct bcm_link_request *pstStatisticsPtrRequest) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "======>"); pstStatisticsPtrRequest->Leader.Status = STATS_POINTER_REQ_STATUS; @@ -438,10 +438,10 @@ static VOID SendStatisticsPointerRequest(PMINI_ADAPTER Adapter, PLINK_REQUEST ps *******************************************************************/ VOID LinkMessage(PMINI_ADAPTER Adapter) { - PLINK_REQUEST pstLinkRequest = NULL; + struct bcm_link_request *pstLinkRequest = NULL; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "=====>"); if (Adapter->LinkStatus == SYNC_UP_REQUEST && Adapter->AutoSyncup) { - pstLinkRequest = kzalloc(sizeof(LINK_REQUEST), GFP_ATOMIC); + pstLinkRequest = kzalloc(sizeof(struct bcm_link_request), GFP_ATOMIC); if (!pstLinkRequest) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Can not allocate memory for Link request!"); return; @@ -456,7 +456,7 @@ VOID LinkMessage(PMINI_ADAPTER Adapter) Adapter->bSyncUpRequestSent = TRUE; } else if (Adapter->LinkStatus == PHY_SYNC_ACHIVED && Adapter->AutoLinkUp) { - pstLinkRequest = kzalloc(sizeof(LINK_REQUEST), GFP_ATOMIC); + pstLinkRequest = kzalloc(sizeof(struct bcm_link_request), GFP_ATOMIC); if (!pstLinkRequest) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Can not allocate memory for Link request!"); return; @@ -584,7 +584,7 @@ void SendIdleModeResponse(PMINI_ADAPTER Adapter) { INT status = 0, NVMAccess = 0, lowPwrAbortMsg = 0; struct timeval tv; - CONTROL_MESSAGE stIdleResponse = {{0} }; + struct bcm_link_request stIdleResponse = {{0} }; memset(&tv, 0, sizeof(tv)); stIdleResponse.Leader.Status = IDLE_MESSAGE; stIdleResponse.Leader.PLength = IDLE_MODE_PAYLOAD_LENGTH; @@ -1392,11 +1392,11 @@ static VOID HandleShutDownModeWakeup(PMINI_ADAPTER Adapter) static VOID SendShutModeResponse(PMINI_ADAPTER Adapter) { - CONTROL_MESSAGE stShutdownResponse; + struct bcm_link_request stShutdownResponse; UINT NVMAccess = 0, lowPwrAbortMsg = 0; UINT Status = 0; - memset(&stShutdownResponse, 0, sizeof(CONTROL_MESSAGE)); + memset(&stShutdownResponse, 0, sizeof(struct bcm_link_request)); stShutdownResponse.Leader.Status = LINK_UP_CONTROL_REQ; stShutdownResponse.Leader.PLength = 8; /* 8 bytes; */ stShutdownResponse.szData[0] = LINK_UP_ACK; -- cgit v0.10.2 From c1975eda98d12c7b34cdc94c53cda32de263e4af Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Sat, 26 May 2012 12:05:09 -0400 Subject: Staging: bcm: Remove typedef for _CONTROL_PACKET and call directly. This patch removes typedef for _CONTROL_PACKET, changes the name of the struct from _CONTROL_PACKET to bcm_control_packet. In addition, any calls to the following typedefs "CONTROL_PACKET, *PCONTROL_PACKET" are changed to call the struct directly. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index a36767d..ea83bc0 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -21,12 +21,11 @@ struct _PACKETTOSEND { } __packed; typedef struct _PACKETTOSEND PACKETTOSEND, *PPACKETTOSEND; -struct _CONTROL_PACKET { +struct bcm_control_packet { PVOID ControlBuff; UINT ControlBuffLen; - struct _CONTROL_PACKET *next; + struct bcm_control_packet *next; } __packed; -typedef struct _CONTROL_PACKET CONTROL_PACKET, *PCONTROL_PACKET; struct bcm_link_request { LEADER Leader; -- cgit v0.10.2 From a869993f8f763b9792990e7ef8e8a644b799d0d3 Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Sat, 26 May 2012 12:05:10 -0400 Subject: Staging: bcm: Remove typedef for _PACKETTOSEND and call directly. This patch removes typedef for _PACKETTOSEND, changes the name of the struct from _PACKETTOSEND to bcm_packettosend. In addition, any calls to the following typedefs "PACKETTOSEND, *PPACKETTOSEND" are changed to call the struct directly. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index ea83bc0..fce61ed 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -15,11 +15,10 @@ struct _LEADER { } __packed; typedef struct _LEADER LEADER, *PLEADER; -struct _PACKETTOSEND { +struct bcm_packettosend { LEADER Leader; UCHAR ucPayload; } __packed; -typedef struct _PACKETTOSEND PACKETTOSEND, *PPACKETTOSEND; struct bcm_control_packet { PVOID ControlBuff; diff --git a/drivers/staging/bcm/Macros.h b/drivers/staging/bcm/Macros.h index 8238cdb..7c03cce 100644 --- a/drivers/staging/bcm/Macros.h +++ b/drivers/staging/bcm/Macros.h @@ -109,10 +109,10 @@ #define LEADER_STATUS 0x00 #define LEADER_STATUS_TCP_ACK 0x1 #define LEADER_SIZE sizeof(LEADER) -#define MAC_ADDR_REQ_SIZE sizeof(PACKETTOSEND) -#define SS_INFO_REQ_SIZE sizeof(PACKETTOSEND) +#define MAC_ADDR_REQ_SIZE sizeof(struct bcm_packettosend) +#define SS_INFO_REQ_SIZE sizeof(struct bcm_packettosend) #define CM_REQUEST_SIZE (LEADER_SIZE + sizeof(stLocalSFChangeRequest)) -#define IDLE_REQ_SIZE sizeof(PACKETTOSEND) +#define IDLE_REQ_SIZE sizeof(struct bcm_packettosend) #define MAX_TRANSFER_CTRL_BYTE_USB (2*1024) -- cgit v0.10.2 From ff352042ebb8f3823fb3725bc2356f6a60ce20df Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Sat, 26 May 2012 12:05:11 -0400 Subject: Staging: bcm: Remove typedef for _LEADER and call directly. This patch removes typedef for _LEADER, changes the name of the struct from _LEADER to bcm_leader. In addition, any calls to the following typedefs "LEADER, *PLEADER" are changed to call the struct directly. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index fce61ed..f269daa 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -7,16 +7,15 @@ #define MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES 256 #include "Debug.h" -struct _LEADER { +struct bcm_leader { USHORT Vcid; USHORT PLength; UCHAR Status; UCHAR Unused[3]; } __packed; -typedef struct _LEADER LEADER, *PLEADER; struct bcm_packettosend { - LEADER Leader; + struct bcm_leader Leader; UCHAR ucPayload; } __packed; @@ -27,7 +26,7 @@ struct bcm_control_packet { } __packed; struct bcm_link_request { - LEADER Leader; + struct bcm_leader Leader; UCHAR szData[4]; } __packed; diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index a0b1720..7189df6 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -1663,7 +1663,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /* "); - pLeader = (PLEADER)Adapter->caDsxReqResp; + pLeader = (struct bcm_leader *)Adapter->caDsxReqResp; pLeader->Status = CM_CONTROL_NEWDSX_MULTICLASSIFIER_REQ; pLeader->Vcid = 0; diff --git a/drivers/staging/bcm/InterfaceRx.c b/drivers/staging/bcm/InterfaceRx.c index d495828..7940a2e 100644 --- a/drivers/staging/bcm/InterfaceRx.c +++ b/drivers/staging/bcm/InterfaceRx.c @@ -46,7 +46,7 @@ static void read_bulk_callback(struct urb *urb) PUSB_RCB pRcb = (PUSB_RCB)urb->context; PS_INTERFACE_ADAPTER psIntfAdapter = pRcb->psIntfAdapter; PMINI_ADAPTER Adapter = psIntfAdapter->psAdapter; - PLEADER pLeader = urb->transfer_buffer; + struct bcm_leader *pLeader = urb->transfer_buffer; if (unlikely(netif_msg_rx_status(Adapter))) pr_info(PFX "%s: rx urb status %d length %d\n", @@ -126,7 +126,7 @@ static void read_bulk_callback(struct urb *urb) BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_RX, RX_CTRL, DBG_LVL_ALL, "Received control pkt..."); *(PUSHORT)skb->data = pLeader->Status; memcpy(skb->data+sizeof(USHORT), urb->transfer_buffer + - (sizeof(LEADER)), pLeader->PLength); + (sizeof(struct bcm_leader)), pLeader->PLength); skb->len = pLeader->PLength + sizeof(USHORT); spin_lock(&Adapter->control_queue_lock); @@ -144,7 +144,7 @@ static void read_bulk_callback(struct urb *urb) */ BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_RX, RX_DATA, DBG_LVL_ALL, "Received Data pkt..."); skb_reserve(skb, 2 + SKB_RESERVE_PHS_BYTES); - memcpy(skb->data+ETH_HLEN, (PUCHAR)urb->transfer_buffer + sizeof(LEADER), pLeader->PLength); + memcpy(skb->data+ETH_HLEN, (PUCHAR)urb->transfer_buffer + sizeof(struct bcm_leader), pLeader->PLength); skb->dev = Adapter->dev; /* currently skb->len has extra ETH_HLEN bytes in the beginning */ diff --git a/drivers/staging/bcm/LeakyBucket.c b/drivers/staging/bcm/LeakyBucket.c index 89f1e57..a6584d7 100644 --- a/drivers/staging/bcm/LeakyBucket.c +++ b/drivers/staging/bcm/LeakyBucket.c @@ -243,10 +243,10 @@ static VOID CheckAndSendPacketFromIndex(PMINI_ADAPTER Adapter, struct bcm_packet { spin_lock_bh(&psSF->SFQueueLock); psSF->NumOfPacketsSent++; - psSF->uiSentBytes+=((PLEADER)pControlPacket)->PLength; + psSF->uiSentBytes+=((struct bcm_leader *)pControlPacket)->PLength; psSF->uiSentPackets++; atomic_dec(&Adapter->TotalPacketCount); - psSF->uiCurrentBytesOnHost -= ((PLEADER)pControlPacket)->PLength; + psSF->uiCurrentBytesOnHost -= ((struct bcm_leader *)pControlPacket)->PLength; psSF->uiCurrentPacketsOnHost--; atomic_inc(&Adapter->index_rd_txcntrlpkt); spin_unlock_bh(&psSF->SFQueueLock); diff --git a/drivers/staging/bcm/Macros.h b/drivers/staging/bcm/Macros.h index 7c03cce..b5ca6f6 100644 --- a/drivers/staging/bcm/Macros.h +++ b/drivers/staging/bcm/Macros.h @@ -108,7 +108,7 @@ /*Leader related terms */ #define LEADER_STATUS 0x00 #define LEADER_STATUS_TCP_ACK 0x1 -#define LEADER_SIZE sizeof(LEADER) +#define LEADER_SIZE sizeof(struct bcm_leader) #define MAC_ADDR_REQ_SIZE sizeof(struct bcm_packettosend) #define SS_INFO_REQ_SIZE sizeof(struct bcm_packettosend) #define CM_REQUEST_SIZE (LEADER_SIZE + sizeof(stLocalSFChangeRequest)) diff --git a/drivers/staging/bcm/Misc.c b/drivers/staging/bcm/Misc.c index 954c3ad..2772e92 100644 --- a/drivers/staging/bcm/Misc.c +++ b/drivers/staging/bcm/Misc.c @@ -233,7 +233,7 @@ exit_download: */ INT CopyBufferToControlPacket(PMINI_ADAPTER Adapter, PVOID ioBuffer) { - PLEADER pLeader = NULL; + struct bcm_leader *pLeader = NULL; INT Status = 0; unsigned char *ctrl_buff = NULL; UINT pktlen = 0; @@ -247,7 +247,7 @@ INT CopyBufferToControlPacket(PMINI_ADAPTER Adapter, PVOID ioBuffer) } pLinkReq = (struct bcm_link_request *)ioBuffer; - pLeader = (PLEADER)ioBuffer; /* ioBuffer Contains sw_Status and Payload */ + pLeader = (struct bcm_leader *)ioBuffer; /* ioBuffer Contains sw_Status and Payload */ if (Adapter->bShutStatus == TRUE && pLinkReq->szData[0] == LINK_DOWN_REQ_PAYLOAD && @@ -373,7 +373,7 @@ INT CopyBufferToControlPacket(PMINI_ADAPTER Adapter, PVOID ioBuffer) memset(ctrl_buff, 0, pktlen+LEADER_SIZE); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Copying the Control Packet Buffer with length=%d\n", pLeader->PLength); - *(PLEADER)ctrl_buff = *pLeader; + *(struct bcm_leader *)ctrl_buff = *pLeader; memcpy(ctrl_buff + LEADER_SIZE, ((PUCHAR)ioBuffer + LEADER_SIZE), pLeader->PLength); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Enqueuing the Control Packet"); diff --git a/drivers/staging/bcm/Transmit.c b/drivers/staging/bcm/Transmit.c index d5e4a74..63c6a74 100644 --- a/drivers/staging/bcm/Transmit.c +++ b/drivers/staging/bcm/Transmit.c @@ -43,7 +43,7 @@ This function dispatches control packet to the h/w interface */ INT SendControlPacket(PMINI_ADAPTER Adapter, char *pControlPacket) { - PLEADER PLeader = (PLEADER)pControlPacket; + struct bcm_leader *PLeader = (struct bcm_leader *)pControlPacket; BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Tx"); if(!pControlPacket || !Adapter) @@ -90,7 +90,7 @@ INT SetupNextSend(PMINI_ADAPTER Adapter, struct sk_buff *Packet, USHORT Vcid) BOOLEAN bHeaderSupressionEnabled = FALSE; B_UINT16 uiClassifierRuleID; u16 QueueIndex = skb_get_queue_mapping(Packet); - LEADER Leader={0}; + struct bcm_leader Leader={0}; if(Packet->len > MAX_DEVICE_DESC_SIZE) { @@ -143,7 +143,7 @@ INT SetupNextSend(PMINI_ADAPTER Adapter, struct sk_buff *Packet, USHORT Vcid) else { Leader.PLength = Packet->len - ETH_HLEN; - memcpy((LEADER*)skb_pull(Packet, (ETH_HLEN - LEADER_SIZE)), &Leader, LEADER_SIZE); + memcpy((struct bcm_leader *)skb_pull(Packet, (ETH_HLEN - LEADER_SIZE)), &Leader, LEADER_SIZE); } status = Adapter->interface_transmit(Adapter->pvInterfaceAdapter, -- cgit v0.10.2 From 2979460d7aba1dac3452edcacd7b8c4cfcf06067 Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Sat, 26 May 2012 12:05:12 -0400 Subject: Staging: bcm: Remove typedef for _MINI_ADAPTER and call directly. This patch removes typedef for _MINI_ADAPTER, changes the name of the struct from _MINI_ADAPTER to bcm_mini_adapter. In addition, any calls to the following typedefs "MINI_ADAPTER, *PMINI_ADAPTER" are changed to call the struct directly. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index f269daa..11d2c5a 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -192,7 +192,7 @@ struct bcm_packet_info { struct bcm_tarang_data { struct bcm_tarang_data *next; - struct _MINI_ADAPTER *Adapter; + struct bcm_mini_adapter *Adapter; struct sk_buff *RxAppControlHead; struct sk_buff *RxAppControlTail; int AppCtrlQueueLen; @@ -208,15 +208,15 @@ struct bcm_targetdsx_buffer { BOOLEAN valid; }; -typedef int (*FP_FLASH_WRITE)(struct _MINI_ADAPTER *, UINT, PVOID); +typedef int (*FP_FLASH_WRITE)(struct bcm_mini_adapter *, UINT, PVOID); -typedef int (*FP_FLASH_WRITE_STATUS)(struct _MINI_ADAPTER *, UINT, PVOID); +typedef int (*FP_FLASH_WRITE_STATUS)(struct bcm_mini_adapter *, UINT, PVOID); /* * Driver adapter data structure */ -struct _MINI_ADAPTER { - struct _MINI_ADAPTER *next; +struct bcm_mini_adapter { + struct bcm_mini_adapter *next; struct net_device *dev; u32 msg_enable; CHAR *caDsxReqResp; @@ -394,7 +394,6 @@ struct _MINI_ADAPTER { UINT gpioBitMap; S_BCM_DEBUG_STATE stDebugState; }; -typedef struct _MINI_ADAPTER MINI_ADAPTER, *PMINI_ADAPTER; #define GET_BCM_ADAPTER(net_dev) netdev_priv(net_dev) @@ -417,7 +416,7 @@ struct bcm_ddr_setting { UINT ulRegAddress; UINT ulRegValue; }; -int InitAdapter(PMINI_ADAPTER psAdapter); +int InitAdapter(struct bcm_mini_adapter *psAdapter); /* ===================================================================== * Beceem vendor request codes for EP0 diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index d1dc0c3..cf411d1 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c @@ -15,7 +15,7 @@ static int bcm_char_open(struct inode *inode, struct file * filp) { - PMINI_ADAPTER Adapter = NULL; + struct bcm_mini_adapter *Adapter = NULL; struct bcm_tarang_data *pTarang = NULL; Adapter = GET_BCM_ADAPTER(gblpnetdev); @@ -44,7 +44,7 @@ static int bcm_char_open(struct inode *inode, struct file * filp) static int bcm_char_release(struct inode *inode, struct file *filp) { struct bcm_tarang_data *pTarang, *tmp, *ptmp; - PMINI_ADAPTER Adapter = NULL; + struct bcm_mini_adapter *Adapter = NULL; struct sk_buff *pkt, *npkt; pTarang = (struct bcm_tarang_data *)filp->private_data; @@ -98,7 +98,7 @@ static ssize_t bcm_char_read(struct file *filp, char __user *buf, size_t size, loff_t *f_pos) { struct bcm_tarang_data *pTarang = filp->private_data; - PMINI_ADAPTER Adapter = pTarang->Adapter; + struct bcm_mini_adapter *Adapter = pTarang->Adapter; struct sk_buff *Packet = NULL; ssize_t PktLen = 0; int wait_ret_val = 0; @@ -157,7 +157,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) { struct bcm_tarang_data *pTarang = filp->private_data; void __user *argp = (void __user *)arg; - PMINI_ADAPTER Adapter = pTarang->Adapter; + struct bcm_mini_adapter *Adapter = pTarang->Adapter; INT Status = STATUS_FAILURE; int timeout = 0; IOCTL_BUFFER IoBuffer; @@ -2014,7 +2014,7 @@ static const struct file_operations bcm_fops = { .llseek = no_llseek, }; -int register_control_device_interface(PMINI_ADAPTER Adapter) +int register_control_device_interface(struct bcm_mini_adapter *Adapter) { if (Adapter->major > 0) @@ -2039,7 +2039,7 @@ int register_control_device_interface(PMINI_ADAPTER Adapter) return 0; } -void unregister_control_device_interface(PMINI_ADAPTER Adapter) +void unregister_control_device_interface(struct bcm_mini_adapter *Adapter) { if (Adapter->major > 0) { device_destroy(bcm_class, MKDEV(Adapter->major, 0)); diff --git a/drivers/staging/bcm/Bcmnet.c b/drivers/staging/bcm/Bcmnet.c index 133e146..6e8c7f5 100644 --- a/drivers/staging/bcm/Bcmnet.c +++ b/drivers/staging/bcm/Bcmnet.c @@ -4,7 +4,7 @@ struct net_device *gblpnetdev; static INT bcm_open(struct net_device *dev) { - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(dev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(dev); if (Adapter->fw_download_done == FALSE) { pr_notice(PFX "%s: link up failed (download in progress)\n", @@ -28,7 +28,7 @@ static INT bcm_open(struct net_device *dev) static INT bcm_close(struct net_device *dev) { - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(dev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(dev); if (netif_msg_ifdown(Adapter)) pr_info(PFX "%s: disabling interface\n", dev->name); @@ -59,7 +59,7 @@ static u16 bcm_select_queue(struct net_device *dev, struct sk_buff *skb) static netdev_tx_t bcm_transmit(struct sk_buff *skb, struct net_device *dev) { - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(dev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(dev); u16 qindex = skb_get_queue_mapping(skb); @@ -141,7 +141,7 @@ static int bcm_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) static void bcm_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(dev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(dev); PS_INTERFACE_ADAPTER psIntfAdapter = Adapter->pvInterfaceAdapter; struct usb_device *udev = interface_to_usbdev(psIntfAdapter->interface); @@ -156,21 +156,21 @@ static void bcm_get_drvinfo(struct net_device *dev, static u32 bcm_get_link(struct net_device *dev) { - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(dev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(dev); return Adapter->LinkUpStatus; } static u32 bcm_get_msglevel(struct net_device *dev) { - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(dev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(dev); return Adapter->msg_enable; } static void bcm_set_msglevel(struct net_device *dev, u32 level) { - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(dev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(dev); Adapter->msg_enable = level; } @@ -183,7 +183,7 @@ static const struct ethtool_ops bcm_ethtool_ops = { .set_msglevel = bcm_set_msglevel, }; -int register_networkdev(PMINI_ADAPTER Adapter) +int register_networkdev(struct bcm_mini_adapter *Adapter) { struct net_device *net = Adapter->dev; PS_INTERFACE_ADAPTER IntfAdapter = Adapter->pvInterfaceAdapter; @@ -224,7 +224,7 @@ int register_networkdev(PMINI_ADAPTER Adapter) return 0; } -void unregister_networkdev(PMINI_ADAPTER Adapter) +void unregister_networkdev(struct bcm_mini_adapter *Adapter) { struct net_device *net = Adapter->dev; PS_INTERFACE_ADAPTER IntfAdapter = Adapter->pvInterfaceAdapter; diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 7189df6..189d243 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -14,7 +14,7 @@ enum E_CLASSIFIER_ACTION { eDeleteClassifier }; -static ULONG GetNextTargetBufferLocation(PMINI_ADAPTER Adapter, B_UINT16 tid); +static ULONG GetNextTargetBufferLocation(struct bcm_mini_adapter *Adapter, B_UINT16 tid); /************************************************************ * Function - SearchSfid @@ -28,7 +28,7 @@ static ULONG GetNextTargetBufferLocation(PMINI_ADAPTER Adapter, B_UINT16 tid); * Returns - Queue index for this SFID(If matched) * Else Invalid Queue Index(If Not matched) ************************************************************/ -int SearchSfid(PMINI_ADAPTER Adapter, UINT uiSfid) +int SearchSfid(struct bcm_mini_adapter *Adapter, UINT uiSfid) { int i; @@ -49,7 +49,7 @@ int SearchSfid(PMINI_ADAPTER Adapter, UINT uiSfid) * Returns - Queue index for the free SFID * Else returns Invalid Index. ****************************************************************/ -static int SearchFreeSfid(PMINI_ADAPTER Adapter) +static int SearchFreeSfid(struct bcm_mini_adapter *Adapter) { int i; @@ -63,12 +63,12 @@ static int SearchFreeSfid(PMINI_ADAPTER Adapter) /* * Function: SearchClsid * Description: This routinue would search Classifier having specified ClassifierID as input parameter - * Input parameters: PMINI_ADAPTER Adapter - Adapter Context + * Input parameters: struct bcm_mini_adapter *Adapter - Adapter Context * unsigned int uiSfid - The SF in which the classifier is to searched * B_UINT16 uiClassifierID - The classifier ID to be searched * Return: int :Classifier table index of matching entry */ -static int SearchClsid(PMINI_ADAPTER Adapter, ULONG ulSFID, B_UINT16 uiClassifierID) +static int SearchClsid(struct bcm_mini_adapter *Adapter, ULONG ulSFID, B_UINT16 uiClassifierID) { int i; @@ -87,7 +87,7 @@ static int SearchClsid(PMINI_ADAPTER Adapter, ULONG ulSFID, B_UINT16 uiClassifi * This routinue would search Free available Classifier entry in classifier table. * @return free Classifier Entry index in classifier table for specified SF */ -static int SearchFreeClsid(PMINI_ADAPTER Adapter /**Adapter Context*/) +static int SearchFreeClsid(struct bcm_mini_adapter *Adapter /**Adapter Context*/) { int i; @@ -99,7 +99,7 @@ static int SearchFreeClsid(PMINI_ADAPTER Adapter /**Adapter Context*/) return MAX_CLASSIFIERS+1; } -static VOID deleteSFBySfid(PMINI_ADAPTER Adapter, UINT uiSearchRuleIndex) +static VOID deleteSFBySfid(struct bcm_mini_adapter *Adapter, UINT uiSearchRuleIndex) { /* deleting all the packet held in the SF */ flush_queue(Adapter, uiSearchRuleIndex); @@ -120,7 +120,7 @@ CopyIpAddrToClassifier(struct bcm_classifier_rule *pstClassifierEntry, UINT nSizeOfIPAddressInBytes = IP_LENGTH_OF_ADDRESS; UCHAR *ptrClassifierIpAddress = NULL; UCHAR *ptrClassifierIpMask = NULL; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); if (bIpVersion6) nSizeOfIPAddressInBytes = IPV6_ADDRESS_SIZEINBYTES; @@ -214,7 +214,7 @@ CopyIpAddrToClassifier(struct bcm_classifier_rule *pstClassifierEntry, } } -void ClearTargetDSXBuffer(PMINI_ADAPTER Adapter, B_UINT16 TID, BOOLEAN bFreeAll) +void ClearTargetDSXBuffer(struct bcm_mini_adapter *Adapter, B_UINT16 TID, BOOLEAN bFreeAll) { int i; @@ -236,7 +236,7 @@ void ClearTargetDSXBuffer(PMINI_ADAPTER Adapter, B_UINT16 TID, BOOLEAN bFreeAll) * @ingroup ctrl_pkt_functions * copy classifier rule into the specified SF index */ -static inline VOID CopyClassifierRuleToSF(PMINI_ADAPTER Adapter, stConvergenceSLTypes *psfCSType, UINT uiSearchRuleIndex, UINT nClassifierIndex) +static inline VOID CopyClassifierRuleToSF(struct bcm_mini_adapter *Adapter, stConvergenceSLTypes *psfCSType, UINT uiSearchRuleIndex, UINT nClassifierIndex) { struct bcm_classifier_rule *pstClassifierEntry = NULL; /* VOID *pvPhsContext = NULL; */ @@ -365,7 +365,7 @@ static inline VOID CopyClassifierRuleToSF(PMINI_ADAPTER Adapter, stConvergenceSL /* * @ingroup ctrl_pkt_functions */ -static inline VOID DeleteClassifierRuleFromSF(PMINI_ADAPTER Adapter, UINT uiSearchRuleIndex, UINT nClassifierIndex) +static inline VOID DeleteClassifierRuleFromSF(struct bcm_mini_adapter *Adapter, UINT uiSearchRuleIndex, UINT nClassifierIndex) { struct bcm_classifier_rule *pstClassifierEntry = NULL; B_UINT16 u16PacketClassificationRuleIndex; @@ -396,7 +396,7 @@ static inline VOID DeleteClassifierRuleFromSF(PMINI_ADAPTER Adapter, UINT uiSear /* * @ingroup ctrl_pkt_functions */ -VOID DeleteAllClassifiersForSF(PMINI_ADAPTER Adapter, UINT uiSearchRuleIndex) +VOID DeleteAllClassifiersForSF(struct bcm_mini_adapter *Adapter, UINT uiSearchRuleIndex) { struct bcm_classifier_rule *pstClassifierEntry = NULL; int i; @@ -428,7 +428,7 @@ VOID DeleteAllClassifiersForSF(PMINI_ADAPTER Adapter, UINT uiSearchRuleIndex) * related data into the Adapter structure. * @ingroup ctrl_pkt_functions */ -static VOID CopyToAdapter(register PMINI_ADAPTER Adapter, /* "); @@ -1325,7 +1325,7 @@ static VOID DumpCmControlPacket(PVOID pvBuffer) BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " bValid: 0x%X", pstAddIndication->sfActiveSet.bValid); } -static inline ULONG RestoreSFParam(PMINI_ADAPTER Adapter, ULONG ulAddrSFParamSet, PUCHAR pucDestBuffer) +static inline ULONG RestoreSFParam(struct bcm_mini_adapter *Adapter, ULONG ulAddrSFParamSet, PUCHAR pucDestBuffer) { UINT nBytesToRead = sizeof(stServiceFlowParamSI); @@ -1342,7 +1342,7 @@ static inline ULONG RestoreSFParam(PMINI_ADAPTER Adapter, ULONG ulAddrSFParamSet return 1; } -static ULONG StoreSFParam(PMINI_ADAPTER Adapter, PUCHAR pucSrcBuffer, ULONG ulAddrSFParamSet) +static ULONG StoreSFParam(struct bcm_mini_adapter *Adapter, PUCHAR pucSrcBuffer, ULONG ulAddrSFParamSet) { UINT nBytesToWrite = sizeof(stServiceFlowParamSI); int ret = 0; @@ -1358,7 +1358,7 @@ static ULONG StoreSFParam(PMINI_ADAPTER Adapter, PUCHAR pucSrcBuffer, ULONG ulAd return 1; } -ULONG StoreCmControlResponseMessage(PMINI_ADAPTER Adapter, PVOID pvBuffer, UINT *puBufferLength) +ULONG StoreCmControlResponseMessage(struct bcm_mini_adapter *Adapter, PVOID pvBuffer, UINT *puBufferLength) { stLocalSFAddIndicationAlt *pstAddIndicationAlt = NULL; stLocalSFAddIndication *pstAddIndication = NULL; @@ -1473,7 +1473,7 @@ ULONG StoreCmControlResponseMessage(PMINI_ADAPTER Adapter, PVOID pvBuffer, UINT } static inline stLocalSFAddIndicationAlt -*RestoreCmControlResponseMessage(register PMINI_ADAPTER Adapter, register PVOID pvBuffer) +*RestoreCmControlResponseMessage(register struct bcm_mini_adapter *Adapter, register PVOID pvBuffer) { ULONG ulStatus = 0; stLocalSFAddIndication *pstAddIndication = NULL; @@ -1551,7 +1551,7 @@ failed_restore_sf_param: return NULL; } -ULONG SetUpTargetDsxBuffers(PMINI_ADAPTER Adapter) +ULONG SetUpTargetDsxBuffers(struct bcm_mini_adapter *Adapter) { ULONG ulTargetDsxBuffersBase = 0; ULONG ulCntTargetBuffers; @@ -1598,7 +1598,7 @@ ULONG SetUpTargetDsxBuffers(PMINI_ADAPTER Adapter) return 1; } -static ULONG GetNextTargetBufferLocation(PMINI_ADAPTER Adapter, B_UINT16 tid) +static ULONG GetNextTargetBufferLocation(struct bcm_mini_adapter *Adapter, B_UINT16 tid) { ULONG ulTargetDSXBufferAddress; ULONG ulTargetDsxBufferIndexToUse, ulMaxTry; @@ -1632,7 +1632,7 @@ static ULONG GetNextTargetBufferLocation(PMINI_ADAPTER Adapter, B_UINT16 tid) return ulTargetDSXBufferAddress; } -int AllocAdapterDsxBuffer(PMINI_ADAPTER Adapter) +int AllocAdapterDsxBuffer(struct bcm_mini_adapter *Adapter) { /* * Need to Allocate memory to contain the SUPER Large structures @@ -1645,7 +1645,7 @@ int AllocAdapterDsxBuffer(PMINI_ADAPTER Adapter) return 0; } -int FreeAdapterDsxBuffer(PMINI_ADAPTER Adapter) +int FreeAdapterDsxBuffer(struct bcm_mini_adapter *Adapter) { kfree(Adapter->caDsxReqResp); return 0; @@ -1657,7 +1657,7 @@ int FreeAdapterDsxBuffer(PMINI_ADAPTER Adapter) * for the Connection Management. * @return - Queue index for the free SFID else returns Invalid Index. */ -BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /* pTarangs; pTarang; pTarang = pTarang->next) { diff --git a/drivers/staging/bcm/IPv6Protocol.c b/drivers/staging/bcm/IPv6Protocol.c index 4adbf9d..4745ddd 100644 --- a/drivers/staging/bcm/IPv6Protocol.c +++ b/drivers/staging/bcm/IPv6Protocol.c @@ -12,7 +12,7 @@ static UCHAR *GetNextIPV6ChainedHeader(UCHAR **ppucPayload, UCHAR *pucRetHeaderPtr = NULL; UCHAR *pucPayloadPtr = NULL; USHORT usNextHeaderOffset = 0 ; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); if ((ppucPayload == NULL) || (*pusPayloadLength == 0) || (*bParseDone)) { @@ -147,7 +147,7 @@ static UCHAR GetIpv6ProtocolPorts(UCHAR *pucPayload, USHORT *pusSrcPort, BOOLEAN bDone = FALSE; UCHAR ucHeaderType = 0; UCHAR *pucNextHeader = NULL; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); if (!pucPayload || (usPayloadLength == 0)) return 0; @@ -177,10 +177,10 @@ static UCHAR GetIpv6ProtocolPorts(UCHAR *pucPayload, USHORT *pusSrcPort, /* - * Arg 1 PMINI_ADAPTER Adapter is a pointer ot the driver contorl structure + * Arg 1 struct bcm_mini_adapter *Adapter is a pointer ot the driver contorl structure * Arg 2 PVOID pcIpHeader is a pointer to the IP header of the packet */ -USHORT IpVersion6(PMINI_ADAPTER Adapter, PVOID pcIpHeader, +USHORT IpVersion6(struct bcm_mini_adapter *Adapter, PVOID pcIpHeader, struct bcm_classifier_rule *pstClassifierRule) { USHORT ushDestPort = 0; @@ -295,7 +295,7 @@ static BOOLEAN MatchSrcIpv6Address(struct bcm_classifier_rule *pstClassifierRule UINT uiIpv6AddIndex = 0; UINT uiIpv6AddrNoLongWords = 4; ULONG aulSrcIP[4]; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); /* * This is the no. of Src Addresses ie Range of IP Addresses contained * in the classifier rule for which we need to match @@ -351,7 +351,7 @@ static BOOLEAN MatchDestIpv6Address(struct bcm_classifier_rule *pstClassifierRul UINT uiIpv6AddIndex = 0; UINT uiIpv6AddrNoLongWords = 4; ULONG aulDestIP[4]; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); /* * This is the no. of Destination Addresses * ie Range of IP Addresses contained in the classifier rule @@ -406,7 +406,7 @@ VOID DumpIpv6Address(ULONG *puIpv6Address) { UINT uiIpv6AddrNoLongWords = 4; UINT uiIpv6AddIndex = 0; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); for (uiIpv6AddIndex = 0; uiIpv6AddIndex < uiIpv6AddrNoLongWords; uiIpv6AddIndex++) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, ":%lx", puIpv6Address[uiIpv6AddIndex]); @@ -418,7 +418,7 @@ static VOID DumpIpv6Header(IPV6Header *pstIpv6Header) { UCHAR ucVersion; UCHAR ucPrio; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "----Ipv6 Header---"); ucVersion = pstIpv6Header->ucVersionPrio & 0xf0; diff --git a/drivers/staging/bcm/IPv6ProtocolHdr.h b/drivers/staging/bcm/IPv6ProtocolHdr.h index 369b553..8ba88a5 100644 --- a/drivers/staging/bcm/IPv6ProtocolHdr.h +++ b/drivers/staging/bcm/IPv6ProtocolHdr.h @@ -102,7 +102,7 @@ typedef enum _E_IPADDR_CONTEXT //Function Prototypes -USHORT IpVersion6(PMINI_ADAPTER Adapter, /**< Pointer to the driver control structure */ +USHORT IpVersion6(struct bcm_mini_adapter *Adapter, /**< Pointer to the driver control structure */ PVOID pcIpHeader, /**psAdapter; */ + /* struct bcm_mini_adapter *Adapter = psIntfAdapter->psAdapter; */ char *buff = kmalloc(MAX_TRANSFER_CTRL_BYTE_USB, GFP_KERNEL); if (!buff) @@ -132,7 +132,7 @@ exit: return Status; } -static int bcm_download_config_file(PMINI_ADAPTER Adapter, struct bcm_firmware_info *psFwInfo) +static int bcm_download_config_file(struct bcm_mini_adapter *Adapter, struct bcm_firmware_info *psFwInfo) { int retval = STATUS_SUCCESS; B_UINT32 value = 0; @@ -208,7 +208,7 @@ static int bcm_download_config_file(PMINI_ADAPTER Adapter, struct bcm_firmware_i static int bcm_compare_buff_contents(unsigned char *readbackbuff, unsigned char *buff, unsigned int len) { int retval = STATUS_SUCCESS; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); if ((len-sizeof(unsigned int)) < 4) { if (memcmp(readbackbuff , buff, len)) retval = -EINVAL; @@ -229,7 +229,7 @@ static int bcm_compare_buff_contents(unsigned char *readbackbuff, unsigned char return retval; } -int bcm_ioctl_fw_download(PMINI_ADAPTER Adapter, struct bcm_firmware_info *psFwInfo) +int bcm_ioctl_fw_download(struct bcm_mini_adapter *Adapter, struct bcm_firmware_info *psFwInfo) { int retval = STATUS_SUCCESS; PUCHAR buff = NULL; @@ -278,7 +278,7 @@ error: return retval; } -static INT buffDnld(PMINI_ADAPTER Adapter, PUCHAR mappedbuffer, UINT u32FirmwareLength, ULONG u32StartingAddress) +static INT buffDnld(struct bcm_mini_adapter *Adapter, PUCHAR mappedbuffer, UINT u32FirmwareLength, ULONG u32StartingAddress) { unsigned int len = 0; int retval = STATUS_SUCCESS; @@ -299,7 +299,7 @@ static INT buffDnld(PMINI_ADAPTER Adapter, PUCHAR mappedbuffer, UINT u32Firmware return retval; } -static INT buffRdbkVerify(PMINI_ADAPTER Adapter, PUCHAR mappedbuffer, UINT u32FirmwareLength, ULONG u32StartingAddress) +static INT buffRdbkVerify(struct bcm_mini_adapter *Adapter, PUCHAR mappedbuffer, UINT u32FirmwareLength, ULONG u32StartingAddress) { UINT len = u32FirmwareLength; INT retval = STATUS_SUCCESS; @@ -334,7 +334,7 @@ static INT buffRdbkVerify(PMINI_ADAPTER Adapter, PUCHAR mappedbuffer, UINT u32Fi return retval; } -INT buffDnldVerify(PMINI_ADAPTER Adapter, unsigned char *mappedbuffer, unsigned int u32FirmwareLength, unsigned long u32StartingAddress) +INT buffDnldVerify(struct bcm_mini_adapter *Adapter, unsigned char *mappedbuffer, unsigned int u32FirmwareLength, unsigned long u32StartingAddress) { INT status = STATUS_SUCCESS; diff --git a/drivers/staging/bcm/InterfaceIdleMode.c b/drivers/staging/bcm/InterfaceIdleMode.c index faeb03e..4f2f490 100644 --- a/drivers/staging/bcm/InterfaceIdleMode.c +++ b/drivers/staging/bcm/InterfaceIdleMode.c @@ -7,7 +7,7 @@ Description: This is the hardware specific Function for waking up HW device fr A software abort pattern is written to the device to wake it and necessary power state transitions from host are performed here. -Input parameters: IN PMINI_ADAPTER Adapter - Miniport Adapter Context +Input parameters: IN struct bcm_mini_adapter *Adapter - Miniport Adapter Context Return: BCM_STATUS_SUCCESS - If Wakeup of the HW Interface was successful. @@ -22,7 +22,7 @@ Description: This is the hardware specific Function for responding to Idle mod Necessary power state transitions from host for idle mode or other device specific initializations are performed here. -Input parameters: IN PMINI_ADAPTER Adapter - Miniport Adapter Context +Input parameters: IN struct bcm_mini_adapter * Adapter - Miniport Adapter Context Return: BCM_STATUS_SUCCESS - If Idle mode response related HW configuration was successful. @@ -42,7 +42,7 @@ send to f/w with in 200 ms after the Idle/Shutdown req issued */ -int InterfaceIdleModeRespond(PMINI_ADAPTER Adapter, unsigned int* puiBuffer) +int InterfaceIdleModeRespond(struct bcm_mini_adapter *Adapter, unsigned int* puiBuffer) { int status = STATUS_SUCCESS; unsigned int uiRegRead = 0; @@ -147,7 +147,7 @@ int InterfaceIdleModeRespond(PMINI_ADAPTER Adapter, unsigned int* puiBuffer) return status; } -static int InterfaceAbortIdlemode(PMINI_ADAPTER Adapter, unsigned int Pattern) +static int InterfaceAbortIdlemode(struct bcm_mini_adapter *Adapter, unsigned int Pattern) { int status = STATUS_SUCCESS; unsigned int value; @@ -246,7 +246,7 @@ static int InterfaceAbortIdlemode(PMINI_ADAPTER Adapter, unsigned int Pattern) } return status; } -int InterfaceIdleModeWakeup(PMINI_ADAPTER Adapter) +int InterfaceIdleModeWakeup(struct bcm_mini_adapter *Adapter) { ULONG Status = 0; if(Adapter->bTriedToWakeUpFromlowPowerMode) @@ -263,7 +263,7 @@ int InterfaceIdleModeWakeup(PMINI_ADAPTER Adapter) return Status; } -void InterfaceHandleShutdownModeWakeup(PMINI_ADAPTER Adapter) +void InterfaceHandleShutdownModeWakeup(struct bcm_mini_adapter *Adapter) { unsigned int uiRegVal = 0; INT Status = 0; diff --git a/drivers/staging/bcm/InterfaceIdleMode.h b/drivers/staging/bcm/InterfaceIdleMode.h index 859a2ff..c3338c8 100644 --- a/drivers/staging/bcm/InterfaceIdleMode.h +++ b/drivers/staging/bcm/InterfaceIdleMode.h @@ -1,14 +1,14 @@ #ifndef _INTERFACE_IDLEMODE_H #define _INTERFACE_IDLEMODE_H -INT InterfaceIdleModeWakeup(PMINI_ADAPTER Adapter); +INT InterfaceIdleModeWakeup(struct bcm_mini_adapter *Adapter); -INT InterfaceIdleModeRespond(PMINI_ADAPTER Adapter, unsigned int *puiBuffer); +INT InterfaceIdleModeRespond(struct bcm_mini_adapter *Adapter, unsigned int *puiBuffer); -VOID InterfaceWriteIdleModeWakePattern(PMINI_ADAPTER Adapter); +VOID InterfaceWriteIdleModeWakePattern(struct bcm_mini_adapter *Adapter); -INT InterfaceWakeUp(PMINI_ADAPTER Adapter); +INT InterfaceWakeUp(struct bcm_mini_adapter * Adapter); -VOID InterfaceHandleShutdownModeWakeup(PMINI_ADAPTER Adapter); +VOID InterfaceHandleShutdownModeWakeup(struct bcm_mini_adapter *Adapter); #endif diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c index 8e3c586..8f85de6 100644 --- a/drivers/staging/bcm/InterfaceInit.c +++ b/drivers/staging/bcm/InterfaceInit.c @@ -65,7 +65,7 @@ static void InterfaceAdapterFree(PS_INTERFACE_ADAPTER psIntfAdapter) AdapterFree(psIntfAdapter->psAdapter); } -static void ConfigureEndPointTypesThroughEEPROM(PMINI_ADAPTER Adapter) +static void ConfigureEndPointTypesThroughEEPROM(struct bcm_mini_adapter *Adapter) { unsigned long ulReg = 0; int bytes; @@ -143,12 +143,12 @@ static int usbbcm_device_probe(struct usb_interface *intf, const struct usb_devi { struct usb_device *udev = interface_to_usbdev(intf); int retval; - PMINI_ADAPTER psAdapter; + struct bcm_mini_adapter *psAdapter; PS_INTERFACE_ADAPTER psIntfAdapter; struct net_device *ndev; /* Reserve one extra queue for the bit-bucket */ - ndev = alloc_etherdev_mq(sizeof(MINI_ADAPTER), NO_OF_QUEUES+1); + ndev = alloc_etherdev_mq(sizeof(struct bcm_mini_adapter), NO_OF_QUEUES+1); if (ndev == NULL) { dev_err(&udev->dev, DRV_NAME ": no memory for device\n"); return -ENOMEM; @@ -257,7 +257,7 @@ static int usbbcm_device_probe(struct usb_interface *intf, const struct usb_devi static void usbbcm_disconnect(struct usb_interface *intf) { PS_INTERFACE_ADAPTER psIntfAdapter = usb_get_intfdata(intf); - PMINI_ADAPTER psAdapter; + struct bcm_mini_adapter *psAdapter; struct usb_device *udev = interface_to_usbdev(intf); if (psIntfAdapter == NULL) diff --git a/drivers/staging/bcm/InterfaceIsr.c b/drivers/staging/bcm/InterfaceIsr.c index 67719d5..6ee3428 100644 --- a/drivers/staging/bcm/InterfaceIsr.c +++ b/drivers/staging/bcm/InterfaceIsr.c @@ -5,7 +5,7 @@ static void read_int_callback(struct urb *urb/*, struct pt_regs *regs*/) { int status = urb->status; PS_INTERFACE_ADAPTER psIntfAdapter = (PS_INTERFACE_ADAPTER)urb->context; - PMINI_ADAPTER Adapter = psIntfAdapter->psAdapter ; + struct bcm_mini_adapter *Adapter = psIntfAdapter->psAdapter ; if (netif_msg_intr(Adapter)) pr_info(PFX "%s: interrupt status %d\n", diff --git a/drivers/staging/bcm/InterfaceIsr.h b/drivers/staging/bcm/InterfaceIsr.h index 6065a71..4039978 100644 --- a/drivers/staging/bcm/InterfaceIsr.h +++ b/drivers/staging/bcm/InterfaceIsr.h @@ -7,9 +7,9 @@ int CreateInterruptUrb(PS_INTERFACE_ADAPTER psIntfAdapter); INT StartInterruptUrb(PS_INTERFACE_ADAPTER psIntfAdapter); -VOID InterfaceEnableInterrupt(PMINI_ADAPTER Adapter); +VOID InterfaceEnableInterrupt(struct bcm_mini_adapter *Adapter); -VOID InterfaceDisableInterrupt(PMINI_ADAPTER Adapter); +VOID InterfaceDisableInterrupt(struct bcm_mini_adapter *Adapter); #endif diff --git a/drivers/staging/bcm/InterfaceMisc.c b/drivers/staging/bcm/InterfaceMisc.c index 2218fae..bbe9099 100644 --- a/drivers/staging/bcm/InterfaceMisc.c +++ b/drivers/staging/bcm/InterfaceMisc.c @@ -133,7 +133,7 @@ INT BcmWRM(PVOID arg, return InterfaceWRM((PS_INTERFACE_ADAPTER)arg, addr, buff, len); } -INT Bcm_clear_halt_of_endpoints(PMINI_ADAPTER Adapter) +INT Bcm_clear_halt_of_endpoints(struct bcm_mini_adapter *Adapter) { PS_INTERFACE_ADAPTER psIntfAdapter = (PS_INTERFACE_ADAPTER)(Adapter->pvInterfaceAdapter); INT status = STATUS_SUCCESS; diff --git a/drivers/staging/bcm/InterfaceMisc.h b/drivers/staging/bcm/InterfaceMisc.h index 6c9e39b..1dfabdc 100644 --- a/drivers/staging/bcm/InterfaceMisc.h +++ b/drivers/staging/bcm/InterfaceMisc.h @@ -33,7 +33,7 @@ int BcmWRM(PVOID arg, PVOID buff, INT len); -INT Bcm_clear_halt_of_endpoints(PMINI_ADAPTER Adapter); +INT Bcm_clear_halt_of_endpoints(struct bcm_mini_adapter *Adapter); VOID Bcm_kill_all_URBs(PS_INTERFACE_ADAPTER psIntfAdapter); diff --git a/drivers/staging/bcm/InterfaceRx.c b/drivers/staging/bcm/InterfaceRx.c index 7940a2e..8a9f90f 100644 --- a/drivers/staging/bcm/InterfaceRx.c +++ b/drivers/staging/bcm/InterfaceRx.c @@ -1,6 +1,6 @@ #include "headers.h" -static int SearchVcid(PMINI_ADAPTER Adapter,unsigned short usVcid) +static int SearchVcid(struct bcm_mini_adapter *Adapter,unsigned short usVcid) { int iIndex=0; @@ -45,7 +45,7 @@ static void read_bulk_callback(struct urb *urb) //int idleflag = 0 ; PUSB_RCB pRcb = (PUSB_RCB)urb->context; PS_INTERFACE_ADAPTER psIntfAdapter = pRcb->psIntfAdapter; - PMINI_ADAPTER Adapter = psIntfAdapter->psAdapter; + struct bcm_mini_adapter *Adapter = psIntfAdapter->psAdapter; struct bcm_leader *pLeader = urb->transfer_buffer; if (unlikely(netif_msg_rx_status(Adapter))) @@ -232,7 +232,7 @@ Function: InterfaceRx Description: This is the hardware specific Function for Receiving data packet/control packets from the device. -Input parameters: IN PMINI_ADAPTER Adapter - Miniport Adapter Context +Input parameters: IN struct bcm_mini_adapter *Adapter - Miniport Adapter Context diff --git a/drivers/staging/bcm/InterfaceTx.c b/drivers/staging/bcm/InterfaceTx.c index 3012f29..7e2b53b 100644 --- a/drivers/staging/bcm/InterfaceTx.c +++ b/drivers/staging/bcm/InterfaceTx.c @@ -6,9 +6,9 @@ static void write_bulk_callback(struct urb *urb/*, struct pt_regs *regs*/) PUSB_TCB pTcb= (PUSB_TCB)urb->context; PS_INTERFACE_ADAPTER psIntfAdapter = pTcb->psIntfAdapter; struct bcm_link_request *pControlMsg = (struct bcm_link_request *)urb->transfer_buffer; - PMINI_ADAPTER psAdapter = psIntfAdapter->psAdapter ; + struct bcm_mini_adapter *psAdapter = psIntfAdapter->psAdapter ; BOOLEAN bpowerDownMsg = FALSE ; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); if (unlikely(netif_msg_tx_done(Adapter))) pr_info(PFX "%s: transmit status %d\n", Adapter->dev->name, urb->status); diff --git a/drivers/staging/bcm/LeakyBucket.c b/drivers/staging/bcm/LeakyBucket.c index a6584d7..6e8a327 100644 --- a/drivers/staging/bcm/LeakyBucket.c +++ b/drivers/staging/bcm/LeakyBucket.c @@ -15,7 +15,7 @@ * Returns - None **********************************************************************/ -static VOID UpdateTokenCount(register PMINI_ADAPTER Adapter) +static VOID UpdateTokenCount(register struct bcm_mini_adapter *Adapter) { ULONG liCurrentTime; INT i = 0; @@ -75,7 +75,7 @@ static VOID UpdateTokenCount(register PMINI_ADAPTER Adapter) * Returns - The number of bytes allowed for transmission. * ***********************************************************************/ -static ULONG GetSFTokenCount(PMINI_ADAPTER Adapter, struct bcm_packet_info *psSF) +static ULONG GetSFTokenCount(struct bcm_mini_adapter *Adapter, struct bcm_packet_info *psSF) { BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, "IsPacketAllowedForFlow ===>"); /* Validate the parameters */ @@ -112,7 +112,7 @@ static ULONG GetSFTokenCount(PMINI_ADAPTER Adapter, struct bcm_packet_info *psSF This function despatches packet from the specified queue. @return Zero(success) or Negative value(failure) */ -static INT SendPacketFromQueue(PMINI_ADAPTER Adapter,/**dev); } -static int create_worker_threads(PMINI_ADAPTER psAdapter) +static int create_worker_threads(struct bcm_mini_adapter *psAdapter) { /* Rx Control Packets Processing */ psAdapter->control_packet_handler = kthread_run((int (*)(void *)) @@ -155,7 +155,7 @@ static int create_worker_threads(PMINI_ADAPTER psAdapter) return 0; } -static struct file *open_firmware_file(PMINI_ADAPTER Adapter, const char *path) +static struct file *open_firmware_file(struct bcm_mini_adapter *Adapter, const char *path) { struct file *flp = NULL; mm_segment_t oldfs; @@ -179,7 +179,7 @@ static struct file *open_firmware_file(PMINI_ADAPTER Adapter, const char *path) * Path to image file * Download Address on the chip */ -static int BcmFileDownload(PMINI_ADAPTER Adapter, const char *path, unsigned int loc) +static int BcmFileDownload(struct bcm_mini_adapter *Adapter, const char *path, unsigned int loc) { int errorno = 0; struct file *flp = NULL; @@ -231,7 +231,7 @@ exit_download: * Logical Adapter * Control Packet Buffer */ -INT CopyBufferToControlPacket(PMINI_ADAPTER Adapter, PVOID ioBuffer) +INT CopyBufferToControlPacket(struct bcm_mini_adapter *Adapter, PVOID ioBuffer) { struct bcm_leader *pLeader = NULL; INT Status = 0; @@ -414,7 +414,7 @@ INT CopyBufferToControlPacket(PMINI_ADAPTER Adapter, PVOID ioBuffer) * * Returns - None. *****************************************************************/ -static VOID SendStatisticsPointerRequest(PMINI_ADAPTER Adapter, struct bcm_link_request *pstStatisticsPtrRequest) +static VOID SendStatisticsPointerRequest(struct bcm_mini_adapter *Adapter, struct bcm_link_request *pstStatisticsPtrRequest) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "======>"); pstStatisticsPtrRequest->Leader.Status = STATS_POINTER_REQ_STATUS; @@ -436,7 +436,7 @@ static VOID SendStatisticsPointerRequest(PMINI_ADAPTER Adapter, struct bcm_link_ * * Returns - None. *******************************************************************/ -VOID LinkMessage(PMINI_ADAPTER Adapter) +VOID LinkMessage(struct bcm_mini_adapter *Adapter) { struct bcm_link_request *pstLinkRequest = NULL; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "=====>"); @@ -487,7 +487,7 @@ VOID LinkMessage(PMINI_ADAPTER Adapter) * * Returns - None. ************************************************************************/ -VOID StatisticsResponse(PMINI_ADAPTER Adapter, PVOID pvBuffer) +VOID StatisticsResponse(struct bcm_mini_adapter *Adapter, PVOID pvBuffer) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "%s====>", __func__); Adapter->StatisticsPointer = ntohl(*(__be32 *)pvBuffer); @@ -506,7 +506,7 @@ VOID StatisticsResponse(PMINI_ADAPTER Adapter, PVOID pvBuffer) * * Returns - None. ***********************************************************************/ -VOID LinkControlResponseMessage(PMINI_ADAPTER Adapter, PUCHAR pucBuffer) +VOID LinkControlResponseMessage(struct bcm_mini_adapter *Adapter, PUCHAR pucBuffer) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "=====>"); @@ -580,7 +580,7 @@ VOID LinkControlResponseMessage(PMINI_ADAPTER Adapter, PUCHAR pucBuffer) return; } -void SendIdleModeResponse(PMINI_ADAPTER Adapter) +void SendIdleModeResponse(struct bcm_mini_adapter *Adapter) { INT status = 0, NVMAccess = 0, lowPwrAbortMsg = 0; struct timeval tv; @@ -679,7 +679,7 @@ void SendIdleModeResponse(PMINI_ADAPTER Adapter) * * Returns - None. *******************************************************************/ -VOID DumpPackInfo(PMINI_ADAPTER Adapter) +VOID DumpPackInfo(struct bcm_mini_adapter *Adapter) { UINT uiLoopIndex = 0; UINT uiIndex = 0; @@ -808,10 +808,10 @@ VOID DumpPackInfo(PMINI_ADAPTER Adapter) return; } -int reset_card_proc(PMINI_ADAPTER ps_adapter) +int reset_card_proc(struct bcm_mini_adapter *ps_adapter) { int retval = STATUS_SUCCESS; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); PS_INTERFACE_ADAPTER psIntfAdapter = NULL; unsigned int value = 0, uiResetValue = 0; int bytes; @@ -926,7 +926,7 @@ err_exit: return retval; } -int run_card_proc(PMINI_ADAPTER ps_adapter) +int run_card_proc(struct bcm_mini_adapter *ps_adapter) { int status = STATUS_SUCCESS; int bytes; @@ -953,7 +953,7 @@ int run_card_proc(PMINI_ADAPTER ps_adapter) return status; } -int InitCardAndDownloadFirmware(PMINI_ADAPTER ps_adapter) +int InitCardAndDownloadFirmware(struct bcm_mini_adapter *ps_adapter) { int status; UINT value = 0; @@ -1077,7 +1077,7 @@ OUT: return status; } -static int bcm_parse_target_params(PMINI_ADAPTER Adapter) +static int bcm_parse_target_params(struct bcm_mini_adapter *Adapter) { struct file *flp = NULL; mm_segment_t oldfs = {0}; @@ -1128,7 +1128,7 @@ static int bcm_parse_target_params(PMINI_ADAPTER Adapter) return STATUS_SUCCESS; } -void beceem_parse_target_struct(PMINI_ADAPTER Adapter) +void beceem_parse_target_struct(struct bcm_mini_adapter *Adapter) { UINT uiHostDrvrCfg6 = 0, uiEEPROMFlag = 0; @@ -1186,7 +1186,7 @@ void beceem_parse_target_struct(PMINI_ADAPTER Adapter) doPowerAutoCorrection(Adapter); } -static VOID doPowerAutoCorrection(PMINI_ADAPTER psAdapter) +static VOID doPowerAutoCorrection(struct bcm_mini_adapter *psAdapter) { UINT reporting_mode; @@ -1218,7 +1218,7 @@ static VOID doPowerAutoCorrection(PMINI_ADAPTER psAdapter) } #if 0 -static unsigned char *ReadMacAddrEEPROM(PMINI_ADAPTER Adapter, ulong dwAddress) +static unsigned char *ReadMacAddrEEPROM(struct bcm_mini_adapter *Adapter, ulong dwAddress) { int status = 0, i = 0; unsigned int temp = 0; @@ -1272,13 +1272,13 @@ static void convertEndian(B_UINT8 rwFlag, PUINT puiBuffer, UINT uiByteCount) #define CACHE_ADDRESS_MASK 0x80000000 #define UNCACHE_ADDRESS_MASK 0xa0000000 -int rdm(PMINI_ADAPTER Adapter, UINT uiAddress, PCHAR pucBuff, size_t sSize) +int rdm(struct bcm_mini_adapter *Adapter, UINT uiAddress, PCHAR pucBuff, size_t sSize) { return Adapter->interface_rdm(Adapter->pvInterfaceAdapter, uiAddress, pucBuff, sSize); } -int wrm(PMINI_ADAPTER Adapter, UINT uiAddress, PCHAR pucBuff, size_t sSize) +int wrm(struct bcm_mini_adapter *Adapter, UINT uiAddress, PCHAR pucBuff, size_t sSize) { int iRetVal; @@ -1287,13 +1287,13 @@ int wrm(PMINI_ADAPTER Adapter, UINT uiAddress, PCHAR pucBuff, size_t sSize) return iRetVal; } -int wrmalt(PMINI_ADAPTER Adapter, UINT uiAddress, PUINT pucBuff, size_t size) +int wrmalt(struct bcm_mini_adapter *Adapter, UINT uiAddress, PUINT pucBuff, size_t size) { convertEndian(RWM_WRITE, pucBuff, size); return wrm(Adapter, uiAddress, (PUCHAR)pucBuff, size); } -int rdmalt(PMINI_ADAPTER Adapter, UINT uiAddress, PUINT pucBuff, size_t size) +int rdmalt(struct bcm_mini_adapter *Adapter, UINT uiAddress, PUINT pucBuff, size_t size) { INT uiRetVal = 0; @@ -1303,7 +1303,7 @@ int rdmalt(PMINI_ADAPTER Adapter, UINT uiAddress, PUINT pucBuff, size_t size) return uiRetVal; } -int wrmWithLock(PMINI_ADAPTER Adapter, UINT uiAddress, PCHAR pucBuff, size_t sSize) +int wrmWithLock(struct bcm_mini_adapter *Adapter, UINT uiAddress, PCHAR pucBuff, size_t sSize) { INT status = STATUS_SUCCESS; down(&Adapter->rdmwrmsync); @@ -1322,7 +1322,7 @@ exit: return status; } -int wrmaltWithLock(PMINI_ADAPTER Adapter, UINT uiAddress, PUINT pucBuff, size_t size) +int wrmaltWithLock(struct bcm_mini_adapter *Adapter, UINT uiAddress, PUINT pucBuff, size_t size) { int iRetVal = STATUS_SUCCESS; @@ -1342,7 +1342,7 @@ exit: return iRetVal; } -int rdmaltWithLock(PMINI_ADAPTER Adapter, UINT uiAddress, PUINT pucBuff, size_t size) +int rdmaltWithLock(struct bcm_mini_adapter *Adapter, UINT uiAddress, PUINT pucBuff, size_t size) { INT uiRetVal = STATUS_SUCCESS; @@ -1361,7 +1361,7 @@ exit: return uiRetVal; } -static VOID HandleShutDownModeWakeup(PMINI_ADAPTER Adapter) +static VOID HandleShutDownModeWakeup(struct bcm_mini_adapter *Adapter) { int clear_abort_pattern = 0, Status = 0; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, MP_SHUTDOWN, DBG_LVL_ALL, "====>\n"); @@ -1390,7 +1390,7 @@ static VOID HandleShutDownModeWakeup(PMINI_ADAPTER Adapter) BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, MP_SHUTDOWN, DBG_LVL_ALL, "<====\n"); } -static VOID SendShutModeResponse(PMINI_ADAPTER Adapter) +static VOID SendShutModeResponse(struct bcm_mini_adapter *Adapter) { struct bcm_link_request stShutdownResponse; UINT NVMAccess = 0, lowPwrAbortMsg = 0; @@ -1474,7 +1474,7 @@ static VOID SendShutModeResponse(PMINI_ADAPTER Adapter) } } -static void HandleShutDownModeRequest(PMINI_ADAPTER Adapter, PUCHAR pucBuffer) +static void HandleShutDownModeRequest(struct bcm_mini_adapter *Adapter, PUCHAR pucBuffer) { B_UINT32 uiResetValue = 0; @@ -1503,7 +1503,7 @@ static void HandleShutDownModeRequest(PMINI_ADAPTER Adapter, PUCHAR pucBuffer) return; } -VOID ResetCounters(PMINI_ADAPTER Adapter) +VOID ResetCounters(struct bcm_mini_adapter *Adapter) { beceem_protocol_reset(Adapter); Adapter->CurrNumRecvDescs = 0; @@ -1519,7 +1519,7 @@ VOID ResetCounters(PMINI_ADAPTER Adapter) Adapter->bShutStatus = FALSE; } -struct bcm_classifier_rule *GetFragIPClsEntry(PMINI_ADAPTER Adapter, USHORT usIpIdentification, ULONG SrcIP) +struct bcm_classifier_rule *GetFragIPClsEntry(struct bcm_mini_adapter *Adapter, USHORT usIpIdentification, ULONG SrcIP) { UINT uiIndex = 0; for (uiIndex = 0; uiIndex < MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES; uiIndex++) { @@ -1533,7 +1533,7 @@ struct bcm_classifier_rule *GetFragIPClsEntry(PMINI_ADAPTER Adapter, USHORT usIp return NULL; } -void AddFragIPClsEntry(PMINI_ADAPTER Adapter, struct bcm_fragmented_packet_info *psFragPktInfo) +void AddFragIPClsEntry(struct bcm_mini_adapter *Adapter, struct bcm_fragmented_packet_info *psFragPktInfo) { UINT uiIndex = 0; for (uiIndex = 0; uiIndex < MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES; uiIndex++) { @@ -1544,7 +1544,7 @@ void AddFragIPClsEntry(PMINI_ADAPTER Adapter, struct bcm_fragmented_packet_info } } -void DelFragIPClsEntry(PMINI_ADAPTER Adapter, USHORT usIpIdentification, ULONG SrcIp) +void DelFragIPClsEntry(struct bcm_mini_adapter *Adapter, USHORT usIpIdentification, ULONG SrcIp) { UINT uiIndex = 0; for (uiIndex = 0; uiIndex < MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES; uiIndex++) { @@ -1556,7 +1556,7 @@ void DelFragIPClsEntry(PMINI_ADAPTER Adapter, USHORT usIpIdentification, ULONG S } } -void update_per_cid_rx(PMINI_ADAPTER Adapter) +void update_per_cid_rx(struct bcm_mini_adapter *Adapter) { UINT qindex = 0; @@ -1580,7 +1580,7 @@ void update_per_cid_rx(PMINI_ADAPTER Adapter) Adapter->liDrainCalculated = jiffies; } -void update_per_sf_desc_cnts(PMINI_ADAPTER Adapter) +void update_per_sf_desc_cnts(struct bcm_mini_adapter *Adapter) { INT iIndex = 0; u32 uibuff[MAX_TARGET_DSX_BUFFERS]; @@ -1606,7 +1606,7 @@ void update_per_sf_desc_cnts(PMINI_ADAPTER Adapter) atomic_set(&Adapter->uiMBupdate, FALSE); } -void flush_queue(PMINI_ADAPTER Adapter, UINT iQIndex) +void flush_queue(struct bcm_mini_adapter *Adapter, UINT iQIndex) { struct sk_buff *PacketToDrop = NULL; struct net_device_stats *netstats = &Adapter->dev->stats; @@ -1630,7 +1630,7 @@ void flush_queue(PMINI_ADAPTER Adapter, UINT iQIndex) spin_unlock_bh(&Adapter->PackInfo[iQIndex].SFQueueLock); } -static void beceem_protocol_reset(PMINI_ADAPTER Adapter) +static void beceem_protocol_reset(struct bcm_mini_adapter *Adapter) { int i; if (netif_msg_link(Adapter)) diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c index 4aa2b71..a6e6151 100644 --- a/drivers/staging/bcm/PHSModule.c +++ b/drivers/staging/bcm/PHSModule.c @@ -58,7 +58,7 @@ Description: This routine handle PHS(Payload Header Suppression for Tx path. The header data after supression is copied back to the NDIS_PACKET. -Input parameters: IN PMINI_ADAPTER Adapter - Miniport Adapter Context +Input parameters: IN struct bcm_mini_adapter *Adapter - Miniport Adapter Context IN Packet - NDIS packet containing data to be transmitted IN USHORT Vcid - vcid pertaining to connection on which the packet is being sent.Used to identify PHS rule to be applied. @@ -69,7 +69,7 @@ Return: STATUS_SUCCESS - If the send was successful. Other - If an error occured. */ -int PHSTransmit(PMINI_ADAPTER Adapter, +int PHSTransmit(struct bcm_mini_adapter *Adapter, struct sk_buff **pPacket, USHORT Vcid, B_UINT16 uiClassifierRuleID, @@ -209,7 +209,7 @@ int PHSTransmit(PMINI_ADAPTER Adapter, return STATUS_SUCCESS; } -int PHSReceive(PMINI_ADAPTER Adapter, +int PHSReceive(struct bcm_mini_adapter *Adapter, USHORT usVcid, struct sk_buff *packet, UINT *punPacketLen, @@ -273,7 +273,7 @@ int PHSReceive(PMINI_ADAPTER Adapter, void DumpFullPacket(UCHAR *pBuf,UINT nPktLen) { - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL,"Dumping Data Packet"); BCM_DEBUG_PRINT_BUFFER(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL,pBuf,nPktLen); } @@ -291,7 +291,7 @@ void DumpFullPacket(UCHAR *pBuf,UINT nPktLen) // TRUE(1) -If allocation of memory was success full. // FALSE -If allocation of memory fails. //----------------------------------------------------------------------------- -int phs_init(PPHS_DEVICE_EXTENSION pPhsdeviceExtension,PMINI_ADAPTER Adapter) +int phs_init(PPHS_DEVICE_EXTENSION pPhsdeviceExtension, struct bcm_mini_adapter *Adapter) { int i; S_SERVICEFLOW_TABLE *pstServiceFlowTable; @@ -398,7 +398,7 @@ ULONG PhsUpdateClassifierRule(IN void* pvContext, ULONG lStatus =0; UINT nSFIndex =0 ; S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); @@ -462,7 +462,7 @@ ULONG PhsDeletePHSRule(IN void* pvContext,IN B_UINT16 uiVcid,IN B_UINT8 u8PHSI) UINT nSFIndex =0, nClsidIndex =0 ; S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL; S_CLASSIFIER_TABLE *pstClassifierRulesTable = NULL; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); PPHS_DEVICE_EXTENSION pDeviceExtension= (PPHS_DEVICE_EXTENSION)pvContext; @@ -528,7 +528,7 @@ ULONG PhsDeleteClassifierRule(IN void* pvContext,IN B_UINT16 uiVcid ,IN B_UINT16 UINT nSFIndex =0, nClsidIndex =0 ; S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL; S_CLASSIFIER_ENTRY *pstClassifierEntry = NULL; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); PPHS_DEVICE_EXTENSION pDeviceExtension= (PPHS_DEVICE_EXTENSION)pvContext; if(pDeviceExtension) @@ -592,7 +592,7 @@ ULONG PhsDeleteSFRules(IN void* pvContext,IN B_UINT16 uiVcid) UINT nSFIndex =0, nClsidIndex =0 ; S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL; S_CLASSIFIER_TABLE *pstClassifierRulesTable = NULL; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); PPHS_DEVICE_EXTENSION pDeviceExtension= (PPHS_DEVICE_EXTENSION)pvContext; BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,"====> \n"); @@ -684,7 +684,7 @@ ULONG PhsCompress(IN void* pvContext, S_CLASSIFIER_ENTRY *pstClassifierEntry = NULL; S_PHS_RULE *pstPhsRule = NULL; ULONG lStatus =0; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); @@ -778,7 +778,7 @@ ULONG PhsDeCompress(IN void* pvContext, S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL; S_PHS_RULE *pstPhsRule = NULL; UINT phsi; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); PPHS_DEVICE_EXTENSION pDeviceExtension= (PPHS_DEVICE_EXTENSION)pvContext; @@ -847,7 +847,7 @@ ULONG PhsDeCompress(IN void* pvContext, static void free_phs_serviceflow_rules(S_SERVICEFLOW_TABLE *psServiceFlowRulesTable) { int i,j; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "=======>\n"); if(psServiceFlowRulesTable) @@ -1057,7 +1057,7 @@ UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid, UINT uiStatus =PHS_SUCCESS; UINT nClassifierIndex = 0; S_CLASSIFIER_TABLE *psaClassifiertable = NULL; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); psaClassifiertable = pstServiceFlowEntry->pstClassifierTable; BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "==>"); @@ -1148,7 +1148,7 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, BOOLEAN bFreeEntryFound = FALSE; S_CLASSIFIER_ENTRY *psClassifierRules = NULL; UINT nStatus = PHS_SUCCESS; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,"Inside CreateClassifierPHSRule"); if(psaClassifiertable == NULL) { @@ -1259,7 +1259,7 @@ static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId, S_PHS_RULE *pstAddPhsRule = NULL; UINT nPhsRuleIndex = 0; BOOLEAN bPHSRuleOrphaned = FALSE; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); psPhsRule->u8RefCnt =0; /* Step 1 Deref Any Exisiting PHS Rule in this classifier Entry*/ @@ -1334,7 +1334,7 @@ static BOOLEAN DerefPhsRule(IN B_UINT16 uiClsId,S_CLASSIFIER_TABLE *psaClassifi void DumpPhsRules(PPHS_DEVICE_EXTENSION pDeviceExtension) { int i,j,k,l; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\n Dumping PHS Rules : \n"); for(i=0;i\n"); *header_size = 0; @@ -1495,7 +1495,7 @@ static int phs_compress(S_PHS_RULE *phs_rule,unsigned char *in_buf { unsigned char *old_addr = out_buf; int supress = 0; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); if(phs_rule == NULL) { BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nphs_compress(): phs_rule null!"); @@ -1557,7 +1557,7 @@ static int verify_suppress_phsf(unsigned char *in_buffer,unsigned char *out_buff { unsigned int size=0; int bit,i=0; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nCOMP:In verify_phsf PHSM - 0x%X",*phsm); diff --git a/drivers/staging/bcm/PHSModule.h b/drivers/staging/bcm/PHSModule.h index c629585..b5f2115 100644 --- a/drivers/staging/bcm/PHSModule.h +++ b/drivers/staging/bcm/PHSModule.h @@ -1,7 +1,7 @@ #ifndef BCM_MINIPORT_PHSMODULE_H #define BCM_MINIPORT_PHSMODULE_H -int PHSTransmit(PMINI_ADAPTER Adapter, +int PHSTransmit(struct bcm_mini_adapter *Adapter, struct sk_buff **pPacket, USHORT Vcid, B_UINT16 uiClassifierRuleID, @@ -9,7 +9,7 @@ int PHSTransmit(PMINI_ADAPTER Adapter, PUINT PacketLen, UCHAR bEthCSSupport); -int PHSReceive(PMINI_ADAPTER Adapter, +int PHSReceive(struct bcm_mini_adapter *Adapter, USHORT usVcid, struct sk_buff *packet, UINT *punPacketLen, @@ -25,7 +25,7 @@ void DumpFullPacket(UCHAR *pBuf,UINT nPktLen); void DumpPhsRules(PPHS_DEVICE_EXTENSION pDeviceExtension); -int phs_init(PPHS_DEVICE_EXTENSION pPhsdeviceExtension,PMINI_ADAPTER Adapter); +int phs_init(PPHS_DEVICE_EXTENSION pPhsdeviceExtension,struct bcm_mini_adapter *Adapter); int PhsCleanup(PPHS_DEVICE_EXTENSION pPHSDeviceExt); diff --git a/drivers/staging/bcm/Prototypes.h b/drivers/staging/bcm/Prototypes.h index 42a04b9..3c8cc5b 100644 --- a/drivers/staging/bcm/Prototypes.h +++ b/drivers/staging/bcm/Prototypes.h @@ -1,172 +1,172 @@ #ifndef _PROTOTYPES_H_ #define _PROTOTYPES_H_ -VOID LinkControlResponseMessage(PMINI_ADAPTER Adapter, PUCHAR pucBuffer); +VOID LinkControlResponseMessage(struct bcm_mini_adapter *Adapter, PUCHAR pucBuffer); -VOID StatisticsResponse(PMINI_ADAPTER Adapter,PVOID pvBuffer); +VOID StatisticsResponse(struct bcm_mini_adapter *Adapter,PVOID pvBuffer); -VOID IdleModeResponse(PMINI_ADAPTER Adapter,PUINT puiBuffer); +VOID IdleModeResponse(struct bcm_mini_adapter *Adapter,PUINT puiBuffer); -int control_packet_handler (PMINI_ADAPTER Adapter); +int control_packet_handler (struct bcm_mini_adapter *Adapter); -VOID DeleteAllClassifiersForSF(PMINI_ADAPTER Adapter,UINT uiSearchRuleIndex); +VOID DeleteAllClassifiersForSF(struct bcm_mini_adapter *Adapter,UINT uiSearchRuleIndex); -VOID flush_all_queues(PMINI_ADAPTER Adapter); +VOID flush_all_queues(struct bcm_mini_adapter *Adapter); -int register_control_device_interface(PMINI_ADAPTER ps_adapter); +int register_control_device_interface(struct bcm_mini_adapter *ps_adapter); -void unregister_control_device_interface(PMINI_ADAPTER Adapter); +void unregister_control_device_interface(struct bcm_mini_adapter *Adapter); -INT CopyBufferToControlPacket(PMINI_ADAPTER Adapter,/**ucIPSourceAddressLength) @@ -61,7 +61,7 @@ BOOLEAN MatchSrcIpAddress(struct bcm_classifier_rule *pstClassifierRule,ULONG ul BOOLEAN MatchDestIpAddress(struct bcm_classifier_rule *pstClassifierRule,ULONG ulDestIP) { UCHAR ucLoopIndex=0; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); ulDestIP=ntohl(ulDestIP); if(0 == pstClassifierRule->ucIPDestinationAddressLength) @@ -94,7 +94,7 @@ BOOLEAN MatchDestIpAddress(struct bcm_classifier_rule *pstClassifierRule,ULONG u BOOLEAN MatchTos(struct bcm_classifier_rule *pstClassifierRule,UCHAR ucTypeOfService) { - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); if( 3 != pstClassifierRule->ucIPTypeOfServiceLength ) return TRUE; @@ -120,7 +120,7 @@ BOOLEAN MatchTos(struct bcm_classifier_rule *pstClassifierRule,UCHAR ucTypeOfSer BOOLEAN MatchProtocol(struct bcm_classifier_rule *pstClassifierRule,UCHAR ucProtocol) { UCHAR ucLoopIndex=0; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); if(0 == pstClassifierRule->ucProtocolLength) return TRUE; for(ucLoopIndex=0;ucLoopIndexucProtocolLength;ucLoopIndex++) @@ -150,7 +150,7 @@ BOOLEAN MatchSrcPort(struct bcm_classifier_rule *pstClassifierRule,USHORT ushSrc { UCHAR ucLoopIndex=0; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); if(0 == pstClassifierRule->ucSrcPortRangeLength) @@ -181,7 +181,7 @@ BOOLEAN MatchSrcPort(struct bcm_classifier_rule *pstClassifierRule,USHORT ushSrc BOOLEAN MatchDestPort(struct bcm_classifier_rule *pstClassifierRule,USHORT ushDestPort) { UCHAR ucLoopIndex=0; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); if(0 == pstClassifierRule->ucDestPortRangeLength) return TRUE; @@ -204,7 +204,7 @@ BOOLEAN MatchDestPort(struct bcm_classifier_rule *pstClassifierRule,USHORT ushDe Compares IPV4 Ip address and port number @return Queue Index. */ -static USHORT IpVersion4(PMINI_ADAPTER Adapter, +static USHORT IpVersion4(struct bcm_mini_adapter *Adapter, struct iphdr *iphd, struct bcm_classifier_rule *pstClassifierRule) { @@ -302,7 +302,7 @@ static USHORT IpVersion4(PMINI_ADAPTER Adapter, return bClassificationSucceed; } -VOID PruneQueueAllSF(PMINI_ADAPTER Adapter) +VOID PruneQueueAllSF(struct bcm_mini_adapter *Adapter) { UINT iIndex = 0; @@ -323,7 +323,7 @@ is less than number of bytes in the queue. If so - drops packets from the Head till the number of bytes is less than or equal to max queue size for the queue. */ -static VOID PruneQueue(PMINI_ADAPTER Adapter, INT iIndex) +static VOID PruneQueue(struct bcm_mini_adapter *Adapter, INT iIndex) { struct sk_buff* PacketToDrop=NULL; struct net_device_stats *netstats; @@ -392,7 +392,7 @@ static VOID PruneQueue(PMINI_ADAPTER Adapter, INT iIndex) BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, PRUNE_QUEUE, DBG_LVL_ALL, "<====="); } -VOID flush_all_queues(PMINI_ADAPTER Adapter) +VOID flush_all_queues(struct bcm_mini_adapter *Adapter) { INT iQIndex; UINT uiTotalPacketLength; @@ -442,7 +442,7 @@ VOID flush_all_queues(PMINI_ADAPTER Adapter) BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "<====="); } -USHORT ClassifyPacket(PMINI_ADAPTER Adapter,struct sk_buff* skb) +USHORT ClassifyPacket(struct bcm_mini_adapter *Adapter,struct sk_buff* skb) { INT uiLoopIndex=0; struct bcm_classifier_rule *pstClassifierRule = NULL; @@ -652,7 +652,7 @@ USHORT ClassifyPacket(PMINI_ADAPTER Adapter,struct sk_buff* skb) static BOOLEAN EthCSMatchSrcMACAddress(struct bcm_classifier_rule *pstClassifierRule,PUCHAR Mac) { UINT i=0; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); if(pstClassifierRule->ucEthCSSrcMACLen==0) return TRUE; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "%s \n",__FUNCTION__); @@ -669,7 +669,7 @@ static BOOLEAN EthCSMatchSrcMACAddress(struct bcm_classifier_rule *pstClassifier static BOOLEAN EthCSMatchDestMACAddress(struct bcm_classifier_rule *pstClassifierRule,PUCHAR Mac) { UINT i=0; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); if(pstClassifierRule->ucEthCSDestMACLen==0) return TRUE; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "%s \n",__FUNCTION__); @@ -685,7 +685,7 @@ static BOOLEAN EthCSMatchDestMACAddress(struct bcm_classifier_rule *pstClassifie static BOOLEAN EthCSMatchEThTypeSAP(struct bcm_classifier_rule *pstClassifierRule,struct sk_buff* skb,PS_ETHCS_PKT_INFO pstEthCsPktInfo) { - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); if((pstClassifierRule->ucEtherTypeLen==0)|| (pstClassifierRule->au8EthCSEtherType[0] == 0)) return TRUE; @@ -723,7 +723,7 @@ static BOOLEAN EthCSMatchVLANRules(struct bcm_classifier_rule *pstClassifierRule BOOLEAN bClassificationSucceed = FALSE; USHORT usVLANID; B_UINT8 uPriority = 0; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "%s CLS UserPrio:%x CLS VLANID:%x\n",__FUNCTION__,ntohs(*((USHORT *)pstClassifierRule->usUserPriority)),pstClassifierRule->usVLANID); @@ -768,7 +768,7 @@ static BOOLEAN EthCSMatchVLANRules(struct bcm_classifier_rule *pstClassifierRule } -static BOOLEAN EThCSClassifyPkt(PMINI_ADAPTER Adapter,struct sk_buff* skb, +static BOOLEAN EThCSClassifyPkt(struct bcm_mini_adapter *Adapter,struct sk_buff* skb, PS_ETHCS_PKT_INFO pstEthCsPktInfo, struct bcm_classifier_rule *pstClassifierRule, B_UINT8 EthCSCupport) @@ -801,7 +801,7 @@ static BOOLEAN EThCSClassifyPkt(PMINI_ADAPTER Adapter,struct sk_buff* skb, return bClassificationSucceed; } -static void EThCSGetPktInfo(PMINI_ADAPTER Adapter,PVOID pvEthPayload, +static void EThCSGetPktInfo(struct bcm_mini_adapter *Adapter,PVOID pvEthPayload, PS_ETHCS_PKT_INFO pstEthCsPktInfo) { USHORT u16Etype = ntohs(((struct bcm_eth_header *)pvEthPayload)->u16Etype); diff --git a/drivers/staging/bcm/Transmit.c b/drivers/staging/bcm/Transmit.c index 63c6a74..5e603ce 100644 --- a/drivers/staging/bcm/Transmit.c +++ b/drivers/staging/bcm/Transmit.c @@ -41,7 +41,7 @@ SendPacketFromQueue->SetupNextSend->bcm_cmd53 This function dispatches control packet to the h/w interface @return zero(success) or -ve value(failure) */ -INT SendControlPacket(PMINI_ADAPTER Adapter, char *pControlPacket) +INT SendControlPacket(struct bcm_mini_adapter *Adapter, char *pControlPacket) { struct bcm_leader *PLeader = (struct bcm_leader *)pControlPacket; @@ -84,7 +84,7 @@ This function despatches the IP packets with the given vcid to the target via the host h/w interface. @return zero(success) or -ve value(failure) */ -INT SetupNextSend(PMINI_ADAPTER Adapter, struct sk_buff *Packet, USHORT Vcid) +INT SetupNextSend(struct bcm_mini_adapter *Adapter, struct sk_buff *Packet, USHORT Vcid) { int status=0; BOOLEAN bHeaderSupressionEnabled = FALSE; @@ -180,7 +180,7 @@ errExit: return status; } -static int tx_pending(PMINI_ADAPTER Adapter) +static int tx_pending(struct bcm_mini_adapter *Adapter) { return (atomic_read(&Adapter->TxPktAvail) && MINIMUM_PENDING_DESCRIPTORS < atomic_read(&Adapter->CurrNumFreeTxDesc)) @@ -191,7 +191,7 @@ static int tx_pending(PMINI_ADAPTER Adapter) @ingroup tx_functions Transmit thread */ -int tx_pkt_handler(PMINI_ADAPTER Adapter /**< pointer to adapter object*/ +int tx_pkt_handler(struct bcm_mini_adapter *Adapter /**< pointer to adapter object*/ ) { int status = 0; diff --git a/drivers/staging/bcm/hostmibs.c b/drivers/staging/bcm/hostmibs.c index 27ddcbf..08d13a4 100644 --- a/drivers/staging/bcm/hostmibs.c +++ b/drivers/staging/bcm/hostmibs.c @@ -9,7 +9,7 @@ #include "headers.h" -INT ProcessGetHostMibs(PMINI_ADAPTER Adapter, S_MIBS_HOST_STATS_MIBS *pstHostMibs) +INT ProcessGetHostMibs(struct bcm_mini_adapter *Adapter, S_MIBS_HOST_STATS_MIBS *pstHostMibs) { S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL; S_PHS_RULE *pstPhsRule = NULL; @@ -101,7 +101,7 @@ VOID GetDroppedAppCntrlPktMibs(S_MIBS_HOST_STATS_MIBS *pstHostMibs, struct bcm_t sizeof(S_MIBS_DROPPED_APP_CNTRL_MESSAGES)); } -VOID CopyMIBSExtendedSFParameters(PMINI_ADAPTER Adapter, CServiceFlowParamSI *psfLocalSet, UINT uiSearchRuleIndex) +VOID CopyMIBSExtendedSFParameters(struct bcm_mini_adapter *Adapter, CServiceFlowParamSI *psfLocalSet, UINT uiSearchRuleIndex) { S_MIBS_EXTSERVICEFLOW_PARAMETERS *t = &Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable; diff --git a/drivers/staging/bcm/led_control.c b/drivers/staging/bcm/led_control.c index c7f4886..252a1b3 100644 --- a/drivers/staging/bcm/led_control.c +++ b/drivers/staging/bcm/led_control.c @@ -13,7 +13,7 @@ static B_UINT16 CFG_CalculateChecksum(B_UINT8 *pu8Buffer, B_UINT32 u32Size) return u16CheckSum; } -BOOLEAN IsReqGpioIsLedInNVM(PMINI_ADAPTER Adapter, UINT gpios) +BOOLEAN IsReqGpioIsLedInNVM(struct bcm_mini_adapter *Adapter, UINT gpios) { INT Status; Status = (Adapter->gpioBitMap & gpios) ^ gpios; @@ -23,7 +23,7 @@ BOOLEAN IsReqGpioIsLedInNVM(PMINI_ADAPTER Adapter, UINT gpios) return TRUE; } -static INT LED_Blink(PMINI_ADAPTER Adapter, UINT GPIO_Num, UCHAR uiLedIndex, +static INT LED_Blink(struct bcm_mini_adapter *Adapter, UINT GPIO_Num, UCHAR uiLedIndex, ULONG timeout, INT num_of_time, LedEventInfo_t currdriverstate) { int Status = STATUS_SUCCESS; @@ -95,7 +95,7 @@ static INT ScaleRateofTransfer(ULONG rate) -static INT LED_Proportional_Blink(PMINI_ADAPTER Adapter, UCHAR GPIO_Num_tx, +static INT LED_Proportional_Blink(struct bcm_mini_adapter *Adapter, UCHAR GPIO_Num_tx, UCHAR uiTxLedIndex, UCHAR GPIO_Num_rx, UCHAR uiRxLedIndex, LedEventInfo_t currdriverstate) { @@ -261,7 +261,7 @@ static INT LED_Proportional_Blink(PMINI_ADAPTER Adapter, UCHAR GPIO_Num_tx, * * ----------------------------------------------------------------------------- */ -static INT ValidateDSDParamsChecksum(PMINI_ADAPTER Adapter, ULONG ulParamOffset, +static INT ValidateDSDParamsChecksum(struct bcm_mini_adapter *Adapter, ULONG ulParamOffset, USHORT usParamLen) { INT Status = STATUS_SUCCESS; @@ -347,7 +347,7 @@ exit: * * ----------------------------------------------------------------------------- */ -static INT ValidateHWParmStructure(PMINI_ADAPTER Adapter, ULONG ulHwParamOffset) +static INT ValidateHWParmStructure(struct bcm_mini_adapter *Adapter, ULONG ulHwParamOffset) { INT Status = STATUS_SUCCESS; @@ -371,7 +371,7 @@ static INT ValidateHWParmStructure(PMINI_ADAPTER Adapter, ULONG ulHwParamOffset) return Status; } /* ValidateHWParmStructure() */ -static int ReadLEDInformationFromEEPROM(PMINI_ADAPTER Adapter, +static int ReadLEDInformationFromEEPROM(struct bcm_mini_adapter *Adapter, UCHAR GPIO_Array[]) { int Status = STATUS_SUCCESS; @@ -477,7 +477,7 @@ static int ReadLEDInformationFromEEPROM(PMINI_ADAPTER Adapter, } -static int ReadConfigFileStructure(PMINI_ADAPTER Adapter, +static int ReadConfigFileStructure(struct bcm_mini_adapter *Adapter, BOOLEAN *bEnableThread) { int Status = STATUS_SUCCESS; @@ -580,7 +580,7 @@ static int ReadConfigFileStructure(PMINI_ADAPTER Adapter, * * ----------------------------------------------------------------------------- */ -static VOID LedGpioInit(PMINI_ADAPTER Adapter) +static VOID LedGpioInit(struct bcm_mini_adapter *Adapter) { UINT uiResetValue = 0; UINT uiIndex = 0; @@ -605,7 +605,7 @@ static VOID LedGpioInit(PMINI_ADAPTER Adapter) Adapter->LEDInfo.bIdle_led_off = FALSE; } -static INT BcmGetGPIOPinInfo(PMINI_ADAPTER Adapter, UCHAR *GPIO_num_tx, +static INT BcmGetGPIOPinInfo(struct bcm_mini_adapter *Adapter, UCHAR *GPIO_num_tx, UCHAR *GPIO_num_rx, UCHAR *uiLedTxIndex, UCHAR *uiLedRxIndex, LedEventInfo_t currdriverstate) { @@ -645,7 +645,7 @@ static INT BcmGetGPIOPinInfo(PMINI_ADAPTER Adapter, UCHAR *GPIO_num_tx, } return STATUS_SUCCESS; } -static VOID LEDControlThread(PMINI_ADAPTER Adapter) +static VOID LEDControlThread(struct bcm_mini_adapter *Adapter) { UINT uiIndex = 0; UCHAR GPIO_num = 0; @@ -857,7 +857,7 @@ static VOID LEDControlThread(PMINI_ADAPTER Adapter) Adapter->LEDInfo.led_thread_running = BCM_LED_THREAD_DISABLED; } -int InitLedSettings(PMINI_ADAPTER Adapter) +int InitLedSettings(struct bcm_mini_adapter *Adapter) { int Status = STATUS_SUCCESS; BOOLEAN bEnableThread = TRUE; diff --git a/drivers/staging/bcm/nvm.c b/drivers/staging/bcm/nvm.c index 7d703cb..f16d3bb 100644 --- a/drivers/staging/bcm/nvm.c +++ b/drivers/staging/bcm/nvm.c @@ -2,54 +2,54 @@ #define DWORD unsigned int -static INT BcmDoChipSelect(PMINI_ADAPTER Adapter, UINT offset); -static INT BcmGetActiveDSD(PMINI_ADAPTER Adapter); -static INT BcmGetActiveISO(PMINI_ADAPTER Adapter); -static UINT BcmGetEEPROMSize(PMINI_ADAPTER Adapter); -static INT BcmGetFlashCSInfo(PMINI_ADAPTER Adapter); -static UINT BcmGetFlashSectorSize(PMINI_ADAPTER Adapter, UINT FlashSectorSizeSig, UINT FlashSectorSize); - -static VOID BcmValidateNvmType(PMINI_ADAPTER Adapter); -static INT BcmGetNvmSize(PMINI_ADAPTER Adapter); -static UINT BcmGetFlashSize(PMINI_ADAPTER Adapter); -static NVM_TYPE BcmGetNvmType(PMINI_ADAPTER Adapter); - -static INT BcmGetSectionValEndOffset(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal); - -static B_UINT8 IsOffsetWritable(PMINI_ADAPTER Adapter, UINT uiOffset); -static INT IsSectionWritable(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL Section); -static INT IsSectionExistInVendorInfo(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL section); - -static INT ReadDSDPriority(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL dsd); -static INT ReadDSDSignature(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL dsd); -static INT ReadISOPriority(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL iso); -static INT ReadISOSignature(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL iso); - -static INT CorruptDSDSig(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal); -static INT CorruptISOSig(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal); -static INT SaveHeaderIfPresent(PMINI_ADAPTER Adapter, PUCHAR pBuff, UINT uiSectAlignAddr); -static INT WriteToFlashWithoutSectorErase(PMINI_ADAPTER Adapter, PUINT pBuff, +static INT BcmDoChipSelect(struct bcm_mini_adapter *Adapter, UINT offset); +static INT BcmGetActiveDSD(struct bcm_mini_adapter *Adapter); +static INT BcmGetActiveISO(struct bcm_mini_adapter *Adapter); +static UINT BcmGetEEPROMSize(struct bcm_mini_adapter *Adapter); +static INT BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter); +static UINT BcmGetFlashSectorSize(struct bcm_mini_adapter *Adapter, UINT FlashSectorSizeSig, UINT FlashSectorSize); + +static VOID BcmValidateNvmType(struct bcm_mini_adapter *Adapter); +static INT BcmGetNvmSize(struct bcm_mini_adapter *Adapter); +static UINT BcmGetFlashSize(struct bcm_mini_adapter *Adapter); +static NVM_TYPE BcmGetNvmType(struct bcm_mini_adapter *Adapter); + +static INT BcmGetSectionValEndOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal); + +static B_UINT8 IsOffsetWritable(struct bcm_mini_adapter *Adapter, UINT uiOffset); +static INT IsSectionWritable(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL Section); +static INT IsSectionExistInVendorInfo(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL section); + +static INT ReadDSDPriority(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL dsd); +static INT ReadDSDSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL dsd); +static INT ReadISOPriority(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL iso); +static INT ReadISOSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL iso); + +static INT CorruptDSDSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal); +static INT CorruptISOSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal); +static INT SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, UINT uiSectAlignAddr); +static INT WriteToFlashWithoutSectorErase(struct bcm_mini_adapter *Adapter, PUINT pBuff, FLASH2X_SECTION_VAL eFlash2xSectionVal, UINT uiOffset, UINT uiNumBytes); -static FLASH2X_SECTION_VAL getHighestPriDSD(PMINI_ADAPTER Adapter); -static FLASH2X_SECTION_VAL getHighestPriISO(PMINI_ADAPTER Adapter); +static FLASH2X_SECTION_VAL getHighestPriDSD(struct bcm_mini_adapter *Adapter); +static FLASH2X_SECTION_VAL getHighestPriISO(struct bcm_mini_adapter *Adapter); static INT BeceemFlashBulkRead( - PMINI_ADAPTER Adapter, + struct bcm_mini_adapter *Adapter, PUINT pBuffer, UINT uiOffset, UINT uiNumBytes); static INT BeceemFlashBulkWrite( - PMINI_ADAPTER Adapter, + struct bcm_mini_adapter *Adapter, PUINT pBuffer, UINT uiOffset, UINT uiNumBytes, BOOLEAN bVerify); -static INT GetFlashBaseAddr(PMINI_ADAPTER Adapter); +static INT GetFlashBaseAddr(struct bcm_mini_adapter *Adapter); -static INT ReadBeceemEEPROMBulk(PMINI_ADAPTER Adapter,UINT dwAddress, UINT *pdwData, UINT dwNumData); +static INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter,UINT dwAddress, UINT *pdwData, UINT dwNumData); // Procedure: ReadEEPROMStatusRegister // @@ -62,7 +62,7 @@ static INT ReadBeceemEEPROMBulk(PMINI_ADAPTER Adapter,UINT dwAddress, UINT *pdwD // //----------------------------------------------------------------------------- -static UCHAR ReadEEPROMStatusRegister( PMINI_ADAPTER Adapter ) +static UCHAR ReadEEPROMStatusRegister(struct bcm_mini_adapter *Adapter ) { UCHAR uiData = 0; DWORD dwRetries = MAX_EEPROM_RETRIES*RETRIES_PER_DELAY; @@ -128,7 +128,7 @@ static UCHAR ReadEEPROMStatusRegister( PMINI_ADAPTER Adapter ) // OSAL_STATUS_CODE: //----------------------------------------------------------------------------- -INT ReadBeceemEEPROMBulk( PMINI_ADAPTER Adapter, +INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, DWORD dwAddress, DWORD *pdwData, DWORD dwNumWords @@ -255,7 +255,7 @@ INT ReadBeceemEEPROMBulk( PMINI_ADAPTER Adapter, // OSAL_STATUS_CODE: //----------------------------------------------------------------------------- -INT ReadBeceemEEPROM( PMINI_ADAPTER Adapter, +INT ReadBeceemEEPROM(struct bcm_mini_adapter *Adapter, DWORD uiOffset, DWORD *pBuffer ) @@ -285,7 +285,7 @@ INT ReadBeceemEEPROM( PMINI_ADAPTER Adapter, -INT ReadMacAddressFromNVM(PMINI_ADAPTER Adapter) +INT ReadMacAddressFromNVM(struct bcm_mini_adapter *Adapter) { INT Status; unsigned char puMacAddr[6]; @@ -318,7 +318,7 @@ INT ReadMacAddressFromNVM(PMINI_ADAPTER Adapter) //----------------------------------------------------------------------------- INT BeceemEEPROMBulkRead( - PMINI_ADAPTER Adapter, + struct bcm_mini_adapter *Adapter, PUINT pBuffer, UINT uiOffset, UINT uiNumBytes) @@ -436,7 +436,7 @@ INT BeceemEEPROMBulkRead( //----------------------------------------------------------------------------- static INT BeceemFlashBulkRead( - PMINI_ADAPTER Adapter, + struct bcm_mini_adapter *Adapter, PUINT pBuffer, UINT uiOffset, UINT uiNumBytes) @@ -518,7 +518,7 @@ static INT BeceemFlashBulkRead( // //----------------------------------------------------------------------------- -static UINT BcmGetFlashSize(PMINI_ADAPTER Adapter) +static UINT BcmGetFlashSize(struct bcm_mini_adapter *Adapter) { if(IsFlash2x(Adapter)) return (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER)); @@ -541,7 +541,7 @@ static UINT BcmGetFlashSize(PMINI_ADAPTER Adapter) // //----------------------------------------------------------------------------- -static UINT BcmGetEEPROMSize(PMINI_ADAPTER Adapter) +static UINT BcmGetEEPROMSize(struct bcm_mini_adapter *Adapter) { UINT uiData = 0; UINT uiIndex = 0; @@ -607,7 +607,7 @@ static UINT BcmGetEEPROMSize(PMINI_ADAPTER Adapter) //----------------------------------------------------------------------------- -static INT FlashSectorErase(PMINI_ADAPTER Adapter, +static INT FlashSectorErase(struct bcm_mini_adapter *Adapter, UINT addr, UINT numOfSectors) { @@ -672,7 +672,7 @@ static INT FlashSectorErase(PMINI_ADAPTER Adapter, //----------------------------------------------------------------------------- static INT flashByteWrite( - PMINI_ADAPTER Adapter, + struct bcm_mini_adapter *Adapter, UINT uiOffset, PVOID pData) { @@ -762,7 +762,7 @@ static INT flashByteWrite( //----------------------------------------------------------------------------- static INT flashWrite( - PMINI_ADAPTER Adapter, + struct bcm_mini_adapter *Adapter, UINT uiOffset, PVOID pData) @@ -848,7 +848,7 @@ static INT flashWrite( // //----------------------------------------------------------------------------- static INT flashByteWriteStatus( - PMINI_ADAPTER Adapter, + struct bcm_mini_adapter *Adapter, UINT uiOffset, PVOID pData) { @@ -935,7 +935,7 @@ static INT flashByteWriteStatus( //----------------------------------------------------------------------------- static INT flashWriteStatus( - PMINI_ADAPTER Adapter, + struct bcm_mini_adapter *Adapter, UINT uiOffset, PVOID pData) { @@ -1014,7 +1014,7 @@ static INT flashWriteStatus( // //----------------------------------------------------------------------------- -static VOID BcmRestoreBlockProtectStatus(PMINI_ADAPTER Adapter,ULONG ulWriteStatus) +static VOID BcmRestoreBlockProtectStatus(struct bcm_mini_adapter *Adapter,ULONG ulWriteStatus) { UINT value; value = (FLASH_CMD_WRITE_ENABLE<< 24); @@ -1037,7 +1037,7 @@ static VOID BcmRestoreBlockProtectStatus(PMINI_ADAPTER Adapter,ULONG ulWriteStat // ULONG - Status value before UnProtect. // //----------------------------------------------------------------------------- -static ULONG BcmFlashUnProtectBlock(PMINI_ADAPTER Adapter,UINT uiOffset, UINT uiLength) +static ULONG BcmFlashUnProtectBlock(struct bcm_mini_adapter *Adapter,UINT uiOffset, UINT uiLength) { ULONG ulStatus = 0; ULONG ulWriteStatus = 0; @@ -1146,7 +1146,7 @@ static ULONG BcmFlashUnProtectBlock(PMINI_ADAPTER Adapter,UINT uiOffset, UINT ui //----------------------------------------------------------------------------- static INT BeceemFlashBulkWrite( - PMINI_ADAPTER Adapter, + struct bcm_mini_adapter *Adapter, PUINT pBuffer, UINT uiOffset, UINT uiNumBytes, @@ -1365,7 +1365,7 @@ BeceemFlashBulkWrite_EXIT: //----------------------------------------------------------------------------- static INT BeceemFlashBulkWriteStatus( - PMINI_ADAPTER Adapter, + struct bcm_mini_adapter *Adapter, PUINT pBuffer, UINT uiOffset, UINT uiNumBytes, @@ -1545,7 +1545,7 @@ BeceemFlashBulkWriteStatus_EXIT: //----------------------------------------------------------------------------- -INT PropagateCalParamsFromEEPROMToMemory(PMINI_ADAPTER Adapter) +INT PropagateCalParamsFromEEPROMToMemory(struct bcm_mini_adapter *Adapter) { PCHAR pBuff = kmalloc(BUFFER_4K, GFP_KERNEL); UINT uiEepromSize = 0; @@ -1614,7 +1614,7 @@ INT PropagateCalParamsFromEEPROMToMemory(PMINI_ADAPTER Adapter) // //----------------------------------------------------------------------------- -INT PropagateCalParamsFromFlashToMemory(PMINI_ADAPTER Adapter) +INT PropagateCalParamsFromFlashToMemory(struct bcm_mini_adapter *Adapter) { PCHAR pBuff, pPtr; UINT uiEepromSize = 0; @@ -1699,7 +1699,7 @@ INT PropagateCalParamsFromFlashToMemory(PMINI_ADAPTER Adapter) //----------------------------------------------------------------------------- static INT BeceemEEPROMReadBackandVerify( - PMINI_ADAPTER Adapter, + struct bcm_mini_adapter *Adapter, PUINT pBuffer, UINT uiOffset, UINT uiNumBytes) @@ -1798,7 +1798,7 @@ static VOID BcmSwapWord(UINT *ptr1) { // OSAL_STATUS_CODE // //----------------------------------------------------------------------------- -static INT BeceemEEPROMWritePage( PMINI_ADAPTER Adapter, UINT uiData[], UINT uiOffset ) +static INT BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[], UINT uiOffset ) { UINT uiRetries = MAX_EEPROM_RETRIES*RETRIES_PER_DELAY; UINT uiStatus = 0; @@ -1934,7 +1934,7 @@ static INT BeceemEEPROMWritePage( PMINI_ADAPTER Adapter, UINT uiData[], UINT uiO //----------------------------------------------------------------------------- INT BeceemEEPROMBulkWrite( - PMINI_ADAPTER Adapter, + struct bcm_mini_adapter *Adapter, PUCHAR pBuffer, UINT uiOffset, UINT uiNumBytes, @@ -2036,7 +2036,7 @@ INT BeceemEEPROMBulkWrite( //----------------------------------------------------------------------------- INT BeceemNVMRead( - PMINI_ADAPTER Adapter, + struct bcm_mini_adapter *Adapter, PUINT pBuffer, UINT uiOffset, UINT uiNumBytes) @@ -2099,7 +2099,7 @@ INT BeceemNVMRead( //----------------------------------------------------------------------------- INT BeceemNVMWrite( - PMINI_ADAPTER Adapter, + struct bcm_mini_adapter *Adapter, PUINT pBuffer, UINT uiOffset, UINT uiNumBytes, @@ -2233,7 +2233,7 @@ INT BeceemNVMWrite( // - if failed. //----------------------------------------------------------------------------- -INT BcmUpdateSectorSize(PMINI_ADAPTER Adapter,UINT uiSectorSize) +INT BcmUpdateSectorSize(struct bcm_mini_adapter *Adapter,UINT uiSectorSize) { INT Status = -1; FLASH_CS_INFO sFlashCsInfo = {0}; @@ -2308,7 +2308,7 @@ INT BcmUpdateSectorSize(PMINI_ADAPTER Adapter,UINT uiSectorSize) // //----------------------------------------------------------------------------- -static UINT BcmGetFlashSectorSize(PMINI_ADAPTER Adapter, UINT FlashSectorSizeSig, UINT FlashSectorSize) +static UINT BcmGetFlashSectorSize(struct bcm_mini_adapter *Adapter, UINT FlashSectorSizeSig, UINT FlashSectorSize) { UINT uiSectorSize = 0; UINT uiSectorSig = 0; @@ -2377,7 +2377,7 @@ static UINT BcmGetFlashSectorSize(PMINI_ADAPTER Adapter, UINT FlashSectorSizeSig // //----------------------------------------------------------------------------- -static INT BcmInitEEPROMQueues(PMINI_ADAPTER Adapter) +static INT BcmInitEEPROMQueues(struct bcm_mini_adapter *Adapter) { UINT value = 0; /* CHIP Bug : Clear the Avail bits on the Read queue. The default @@ -2413,7 +2413,7 @@ static INT BcmInitEEPROMQueues(PMINI_ADAPTER Adapter) // //----------------------------------------------------------------------------- -INT BcmInitNVM(PMINI_ADAPTER ps_adapter) +INT BcmInitNVM(struct bcm_mini_adapter *ps_adapter) { BcmValidateNvmType(ps_adapter); BcmInitEEPROMQueues(ps_adapter); @@ -2445,7 +2445,7 @@ INT BcmInitNVM(PMINI_ADAPTER ps_adapter) */ /***************************************************************************/ -static INT BcmGetNvmSize(PMINI_ADAPTER Adapter) +static INT BcmGetNvmSize(struct bcm_mini_adapter *Adapter) { if(Adapter->eNVMType == NVM_EEPROM) { @@ -2469,7 +2469,7 @@ static INT BcmGetNvmSize(PMINI_ADAPTER Adapter) // Returns: // //----------------------------------------------------------------------------- -static VOID BcmValidateNvmType(PMINI_ADAPTER Adapter) +static VOID BcmValidateNvmType(struct bcm_mini_adapter *Adapter) { // @@ -2495,7 +2495,7 @@ static VOID BcmValidateNvmType(PMINI_ADAPTER Adapter) // Returns: // Flash ID //----------------------------------------------------------------------------- -static ULONG BcmReadFlashRDID(PMINI_ADAPTER Adapter) +static ULONG BcmReadFlashRDID(struct bcm_mini_adapter *Adapter) { ULONG ulRDID = 0; UINT value; @@ -2518,7 +2518,7 @@ static ULONG BcmReadFlashRDID(PMINI_ADAPTER Adapter) } -INT BcmAllocFlashCSStructure(PMINI_ADAPTER psAdapter) +INT BcmAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter) { if(psAdapter == NULL) { @@ -2552,7 +2552,7 @@ INT BcmAllocFlashCSStructure(PMINI_ADAPTER psAdapter) return STATUS_SUCCESS; } -INT BcmDeAllocFlashCSStructure(PMINI_ADAPTER psAdapter) +INT BcmDeAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter) { if(psAdapter == NULL) { @@ -2565,7 +2565,7 @@ INT BcmDeAllocFlashCSStructure(PMINI_ADAPTER psAdapter) return STATUS_SUCCESS ; } -static INT BcmDumpFlash2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo,PMINI_ADAPTER Adapter) +static INT BcmDumpFlash2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo,struct bcm_mini_adapter *Adapter) { UINT Index = 0; BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "**********************FLASH2X CS Structure *******************"); @@ -2715,14 +2715,14 @@ static INT ConvertEndianOfCSStructure(PFLASH_CS_INFO psFlashCSInfo) return STATUS_SUCCESS; } -static INT IsSectionExistInVendorInfo(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL section) +static INT IsSectionExistInVendorInfo(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL section) { return ( Adapter->uiVendorExtnFlag && (Adapter->psFlash2xVendorInfo->VendorSection[section].AccessFlags & FLASH2X_SECTION_PRESENT) && (Adapter->psFlash2xVendorInfo->VendorSection[section].OffsetFromZeroForSectionStart != UNINIT_PTR_IN_CS) ); } -static VOID UpdateVendorInfo(PMINI_ADAPTER Adapter) +static VOID UpdateVendorInfo(struct bcm_mini_adapter *Adapter) { B_UINT32 i = 0; UINT uiSizeSection = 0; @@ -2813,7 +2813,7 @@ static VOID UpdateVendorInfo(PMINI_ADAPTER Adapter) // //----------------------------------------------------------------------------- -static INT BcmGetFlashCSInfo(PMINI_ADAPTER Adapter) +static INT BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) { //FLASH_CS_INFO sFlashCsInfo = {0}; @@ -2960,7 +2960,7 @@ static INT BcmGetFlashCSInfo(PMINI_ADAPTER Adapter) // //----------------------------------------------------------------------------- -static NVM_TYPE BcmGetNvmType(PMINI_ADAPTER Adapter) +static NVM_TYPE BcmGetNvmType(struct bcm_mini_adapter *Adapter) { UINT uiData = 0; @@ -3004,7 +3004,7 @@ static NVM_TYPE BcmGetNvmType(PMINI_ADAPTER Adapter) * On Failure -returns STATUS_FAILURE **/ -INT BcmGetSectionValStartOffset(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlashSectionVal) +INT BcmGetSectionValStartOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlashSectionVal) { /* * Considering all the section for which end offset can be calculated or directly given @@ -3098,7 +3098,7 @@ INT BcmGetSectionValStartOffset(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlas * On Failure -returns STATUS_FAILURE **/ -INT BcmGetSectionValEndOffset(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) +INT BcmGetSectionValEndOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) { INT SectEndOffset = 0 ; SectEndOffset = INVALID_OFFSET; @@ -3188,7 +3188,7 @@ INT BcmGetSectionValEndOffset(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2 */ INT BcmFlash2xBulkRead( - PMINI_ADAPTER Adapter, + struct bcm_mini_adapter *Adapter, PUINT pBuffer, FLASH2X_SECTION_VAL eFlash2xSectionVal, UINT uiOffsetWithinSectionVal, @@ -3257,7 +3257,7 @@ INT BcmFlash2xBulkRead( */ INT BcmFlash2xBulkWrite( - PMINI_ADAPTER Adapter, + struct bcm_mini_adapter *Adapter, PUINT pBuffer, FLASH2X_SECTION_VAL eFlash2xSectVal, UINT uiOffset, @@ -3322,7 +3322,7 @@ INT BcmFlash2xBulkWrite( * Return STATUS_SUCESS if get success in setting the right DSD else negaive error code * **/ -static INT BcmGetActiveDSD(PMINI_ADAPTER Adapter) +static INT BcmGetActiveDSD(struct bcm_mini_adapter *Adapter) { FLASH2X_SECTION_VAL uiHighestPriDSD = 0 ; @@ -3371,7 +3371,7 @@ static INT BcmGetActiveDSD(PMINI_ADAPTER Adapter) * **/ -static INT BcmGetActiveISO(PMINI_ADAPTER Adapter) +static INT BcmGetActiveISO(struct bcm_mini_adapter *Adapter) { INT HighestPriISO = 0 ; @@ -3399,7 +3399,7 @@ static INT BcmGetActiveISO(PMINI_ADAPTER Adapter) * Failure:-FALSE, offset is RO * **/ -B_UINT8 IsOffsetWritable(PMINI_ADAPTER Adapter, UINT uiOffset) +B_UINT8 IsOffsetWritable(struct bcm_mini_adapter *Adapter, UINT uiOffset) { UINT uiSectorNum = 0; UINT uiWordOfSectorPermission =0; @@ -3424,7 +3424,7 @@ B_UINT8 IsOffsetWritable(PMINI_ADAPTER Adapter, UINT uiOffset) static INT BcmDumpFlash2xSectionBitMap(PFLASH2X_BITMAP psFlash2xBitMap) { - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "***************Flash 2.x Section Bitmap***************"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"ISO_IMAGE1 :0X%x", psFlash2xBitMap->ISO_IMAGE1); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"ISO_IMAGE2 :0X%x", psFlash2xBitMap->ISO_IMAGE2); @@ -3456,7 +3456,7 @@ static INT BcmDumpFlash2xSectionBitMap(PFLASH2X_BITMAP psFlash2xBitMap) * Failure:- negative error code **/ -INT BcmGetFlash2xSectionalBitMap(PMINI_ADAPTER Adapter, PFLASH2X_BITMAP psFlash2xBitMap) +INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITMAP psFlash2xBitMap) { @@ -3752,7 +3752,7 @@ BcmSetActiveSection :- Set Active section is used to make priority field highest Return Value:- Make the priorit highest else return erorr code **/ -INT BcmSetActiveSection(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectVal) +INT BcmSetActiveSection(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectVal) { unsigned int SectImagePriority = 0; INT Status =STATUS_SUCCESS; @@ -3958,7 +3958,7 @@ BcmCopyISO - Used only for copying the ISO section Return value:- SUCCESS if copies successfully else negative error code **/ -INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) +INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectStrut) { PCHAR Buff = NULL; @@ -4289,7 +4289,7 @@ Return Value :- **/ -INT BcmFlash2xCorruptSig(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) +INT BcmFlash2xCorruptSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) { INT Status = STATUS_SUCCESS ; @@ -4321,7 +4321,7 @@ Return Value :- Failure :-Return negative error code **/ -INT BcmFlash2xWriteSig(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlashSectionVal) +INT BcmFlash2xWriteSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlashSectionVal) { UINT uiSignature = 0 ; @@ -4394,7 +4394,7 @@ Return values:-Return TRUE is request is valid else FALSE. **/ -INT validateFlash2xReadWrite(PMINI_ADAPTER Adapter, PFLASH2X_READWRITE psFlash2xReadWrite) +INT validateFlash2xReadWrite(struct bcm_mini_adapter *Adapter, PFLASH2X_READWRITE psFlash2xReadWrite) { UINT uiNumOfBytes = 0 ; UINT uiSectStartOffset = 0 ; @@ -4459,7 +4459,7 @@ Return value:- return TRUE if flah2.x of hgher version else return false. **/ -INT IsFlash2x(PMINI_ADAPTER Adapter) +INT IsFlash2x(struct bcm_mini_adapter *Adapter) { if(Adapter->uiFlashLayoutMajorVersion >= FLASH_2X_MAJOR_NUMBER) return TRUE ; @@ -4474,7 +4474,7 @@ Return Value:- Success :- Base Address of the Flash **/ -static INT GetFlashBaseAddr(PMINI_ADAPTER Adapter) +static INT GetFlashBaseAddr(struct bcm_mini_adapter *Adapter) { UINT uiBaseAddr = 0; @@ -4525,7 +4525,7 @@ Return Values- **/ -INT BcmCopySection(PMINI_ADAPTER Adapter, +INT BcmCopySection(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL SrcSection, FLASH2X_SECTION_VAL DstSection, UINT offset, @@ -4642,7 +4642,7 @@ Return value :- **/ -INT SaveHeaderIfPresent(PMINI_ADAPTER Adapter, PUCHAR pBuff, UINT uiOffset) +INT SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, UINT uiOffset) { UINT offsetToProtect = 0,HeaderSizeToProtect =0; BOOLEAN bHasHeader = FALSE ; @@ -4715,7 +4715,7 @@ BcmDoChipSelect : This will selcet the appropriate chip for writing. OutPut:- Select the Appropriate chip and retrn status Success **/ -static INT BcmDoChipSelect(PMINI_ADAPTER Adapter, UINT offset) +static INT BcmDoChipSelect(struct bcm_mini_adapter *Adapter, UINT offset) { UINT FlashConfig = 0; INT ChipNum = 0; @@ -4791,7 +4791,7 @@ static INT BcmDoChipSelect(PMINI_ADAPTER Adapter, UINT offset) return STATUS_SUCCESS; } -INT ReadDSDSignature(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL dsd) +INT ReadDSDSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL dsd) { UINT uiDSDsig = 0; //UINT sigoffsetInMap = 0; @@ -4816,7 +4816,7 @@ INT ReadDSDSignature(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL dsd) return uiDSDsig ; } -INT ReadDSDPriority(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL dsd) +INT ReadDSDPriority(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL dsd) { //UINT priOffsetInMap = 0 ; unsigned int uiDSDPri = STATUS_FAILURE; @@ -4839,7 +4839,7 @@ INT ReadDSDPriority(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL dsd) } return uiDSDPri; } -FLASH2X_SECTION_VAL getHighestPriDSD(PMINI_ADAPTER Adapter) +FLASH2X_SECTION_VAL getHighestPriDSD(struct bcm_mini_adapter *Adapter) { INT DSDHighestPri = STATUS_FAILURE; INT DsdPri= 0 ; @@ -4873,7 +4873,7 @@ FLASH2X_SECTION_VAL getHighestPriDSD(PMINI_ADAPTER Adapter) return HighestPriDSD ; } -INT ReadISOSignature(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL iso) +INT ReadISOSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL iso) { UINT uiISOsig = 0; //UINT sigoffsetInMap = 0; @@ -4898,7 +4898,7 @@ INT ReadISOSignature(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL iso) return uiISOsig ; } -INT ReadISOPriority(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL iso) +INT ReadISOPriority(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL iso) { unsigned int ISOPri = STATUS_FAILURE; @@ -4919,7 +4919,7 @@ INT ReadISOPriority(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL iso) } return ISOPri; } -FLASH2X_SECTION_VAL getHighestPriISO(PMINI_ADAPTER Adapter) +FLASH2X_SECTION_VAL getHighestPriISO(struct bcm_mini_adapter *Adapter) { INT ISOHighestPri = STATUS_FAILURE; INT ISOPri= 0 ; @@ -4943,7 +4943,7 @@ FLASH2X_SECTION_VAL getHighestPriISO(PMINI_ADAPTER Adapter) BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Highest ISO :%x and its Pri :%x",HighestPriISO,ISOHighestPri); return HighestPriISO ; } -INT WriteToFlashWithoutSectorErase(PMINI_ADAPTER Adapter, +INT WriteToFlashWithoutSectorErase(struct bcm_mini_adapter *Adapter, PUINT pBuff, FLASH2X_SECTION_VAL eFlash2xSectionVal, UINT uiOffset, @@ -5006,7 +5006,7 @@ INT WriteToFlashWithoutSectorErase(PMINI_ADAPTER Adapter, return Status; } -BOOLEAN IsSectionExistInFlash(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL section) +BOOLEAN IsSectionExistInFlash(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL section) { BOOLEAN SectionPresent = FALSE ; @@ -5062,7 +5062,7 @@ BOOLEAN IsSectionExistInFlash(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL section } return SectionPresent ; } -INT IsSectionWritable(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL Section) +INT IsSectionWritable(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL Section) { INT offset = STATUS_FAILURE; INT Status = FALSE; @@ -5087,7 +5087,7 @@ INT IsSectionWritable(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL Section) return Status ; } -static INT CorruptDSDSig(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) +static INT CorruptDSDSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) { PUCHAR pBuff = NULL; @@ -5160,7 +5160,7 @@ static INT CorruptDSDSig(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSect return STATUS_SUCCESS ; } -static INT CorruptISOSig(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) +static INT CorruptISOSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) { PUCHAR pBuff = NULL; @@ -5212,7 +5212,7 @@ static INT CorruptISOSig(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSect return STATUS_SUCCESS ; } -BOOLEAN IsNonCDLessDevice(PMINI_ADAPTER Adapter) +BOOLEAN IsNonCDLessDevice(struct bcm_mini_adapter *Adapter) { if(Adapter->psFlash2xCSInfo->IsCDLessDeviceBootSig == NON_CDLESS_DEVICE_BOOT_SIG) return TRUE; diff --git a/drivers/staging/bcm/sort.c b/drivers/staging/bcm/sort.c index 5f891fa..d518c42 100644 --- a/drivers/staging/bcm/sort.c +++ b/drivers/staging/bcm/sort.c @@ -22,7 +22,7 @@ static int compare_packet_info(void const *a, void const *b) return pa->u8TrafficPriority - pb->u8TrafficPriority; } -VOID SortPackInfo(PMINI_ADAPTER Adapter) +VOID SortPackInfo(struct bcm_mini_adapter *Adapter) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<======="); @@ -42,7 +42,7 @@ static int compare_classifiers(void const *a, void const *b) return pa->u8ClassifierRulePriority - pb->u8ClassifierRulePriority; } -VOID SortClassifiers(PMINI_ADAPTER Adapter) +VOID SortClassifiers(struct bcm_mini_adapter *Adapter) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<======="); diff --git a/drivers/staging/bcm/vendorspecificextn.c b/drivers/staging/bcm/vendorspecificextn.c index 4178cd1..833883c 100644 --- a/drivers/staging/bcm/vendorspecificextn.c +++ b/drivers/staging/bcm/vendorspecificextn.c @@ -28,7 +28,7 @@ INT vendorextnGetSectionInfo(PVOID pContext,PFLASH2X_VENDORSPECIFIC_INFO pVendo // STATUS_SUCCESS/STATUS_FAILURE // //----------------------------------------------------------------------------- -INT vendorextnInit(PMINI_ADAPTER Adapter) +INT vendorextnInit(struct bcm_mini_adapter *Adapter) { return STATUS_SUCCESS; } @@ -45,7 +45,7 @@ INT vendorextnInit(PMINI_ADAPTER Adapter) // STATUS_SUCCESS/STATUS_FAILURE // //----------------------------------------------------------------------------- -INT vendorextnExit(PMINI_ADAPTER Adapter) +INT vendorextnExit(struct bcm_mini_adapter *Adapter) { return STATUS_SUCCESS; } @@ -65,7 +65,7 @@ INT vendorextnExit(PMINI_ADAPTER Adapter) // STATUS_SUCCESS/STATUS_FAILURE as per the IOCTL return value // //-------------------------------------------------------------------------- -INT vendorextnIoctl(PMINI_ADAPTER Adapter, UINT cmd, ULONG arg) +INT vendorextnIoctl(struct bcm_mini_adapter *Adapter, UINT cmd, ULONG arg) { return CONTINUE_COMMON_PATH; } diff --git a/drivers/staging/bcm/vendorspecificextn.h b/drivers/staging/bcm/vendorspecificextn.h index 7ff1495..f237891b 100644 --- a/drivers/staging/bcm/vendorspecificextn.h +++ b/drivers/staging/bcm/vendorspecificextn.h @@ -5,9 +5,9 @@ #define CONTINUE_COMMON_PATH 0xFFFF INT vendorextnGetSectionInfo(PVOID pContext,PFLASH2X_VENDORSPECIFIC_INFO pVendorInfo); -INT vendorextnExit(PMINI_ADAPTER Adapter); -INT vendorextnInit(PMINI_ADAPTER Adapter); -INT vendorextnIoctl(PMINI_ADAPTER Adapter, UINT cmd, ULONG arg); +INT vendorextnExit(struct bcm_mini_adapter *Adapter); +INT vendorextnInit(struct bcm_mini_adapter *Adapter); +INT vendorextnIoctl(struct bcm_mini_adapter *Adapter, UINT cmd, ULONG arg); INT vendorextnReadSection(PVOID pContext, PUCHAR pBuffer, FLASH2X_SECTION_VAL SectionVal, UINT offset, UINT numOfBytes); INT vendorextnWriteSection(PVOID pContext, PUCHAR pBuffer, FLASH2X_SECTION_VAL SectionVal, -- cgit v0.10.2 From 9c8ea1b29bc9c9bbd922a652d1b91ddceeb180c6 Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Mon, 21 May 2012 14:18:06 +0200 Subject: iio: add LM3533 ambient-light-sensor driver Add sub-driver for the ambient-light-sensor interface on National Semiconductor / TI LM3533 lighting power chips. The sensor interface can be used to control the LEDs and backlights of the chip through defining five light zones and three sets of corresponding output-current values. The driver provides raw and mean adc readings along with the current light zone through sysfs. A threshold event can be generated on zone changes. The ALS-control output values can be set per zone for the three current output channels. Signed-off-by: Johan Hovold Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/Documentation/ABI/testing/sysfs-bus-iio-light-lm3533-als b/Documentation/ABI/testing/sysfs-bus-iio-light-lm3533-als new file mode 100644 index 0000000..694a52c --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-iio-light-lm3533-als @@ -0,0 +1,62 @@ +What: /sys/.../events/in_illuminance0_thresh_either_en +Date: April 2012 +KernelVersion: 3.5 +Contact: Johan Hovold +Description: + Event generated when channel passes one of the four thresholds + in each direction (rising|falling) and a zone change occurs. + The corresponding light zone can be read from + in_illuminance0_zone. + +What: /sys/.../events/in_illuminance0_threshY_hysteresis +Date: May 2012 +KernelVersion: 3.5 +Contact: Johan Hovold +Description: + Get the hysteresis for thresholds Y, that is, + + threshY_hysteresis = threshY_raising - threshY_falling + +What: /sys/.../events/illuminance_threshY_falling_value +What: /sys/.../events/illuminance_threshY_raising_value +Date: April 2012 +KernelVersion: 3.5 +Contact: Johan Hovold +Description: + Specifies the value of threshold that the device is comparing + against for the events enabled by + in_illuminance0_thresh_either_en (0..255), where Y in 0..3. + + Note that threshY_falling must be less than or equal to + threshY_raising. + + These thresholds correspond to the eight zone-boundary + registers (boundaryY_{low,high}) and defines the five light + zones. + +What: /sys/bus/iio/devices/iio:deviceX/in_illuminance0_zone +Date: April 2012 +KernelVersion: 3.5 +Contact: Johan Hovold +Description: + Get the current light zone (0..4) as defined by the + in_illuminance0_threshY_{falling,rising} thresholds. + +What: /sys/bus/iio/devices/iio:deviceX/out_currentY_raw +Date: May 2012 +KernelVersion: 3.5 +Contact: Johan Hovold +Description: + Get output current for channel Y (0..255), that is, + out_currentY_currentZ_raw, where Z is the current zone. + +What: /sys/bus/iio/devices/iio:deviceX/out_currentY_currentZ_raw +Date: May 2012 +KernelVersion: 3.5 +Contact: Johan Hovold +Description: + Set the output current for channel out_currentY when in zone + Z (0..255), where Y in 0..2 and Z in 0..4. + + These values correspond to the ALS-mapper target registers for + ALS-mapper Y + 1. diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig index 56eecef..cacc74d 100644 --- a/drivers/iio/Kconfig +++ b/drivers/iio/Kconfig @@ -50,5 +50,6 @@ config IIO_CONSUMERS_PER_TRIGGER source "drivers/iio/adc/Kconfig" source "drivers/iio/amplifiers/Kconfig" +source "drivers/iio/light/Kconfig" endif # IIO diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile index e425afd..060b674 100644 --- a/drivers/iio/Makefile +++ b/drivers/iio/Makefile @@ -11,3 +11,4 @@ obj-$(CONFIG_IIO_KFIFO_BUF) += kfifo_buf.o obj-y += adc/ obj-y += amplifiers/ +obj-y += light/ diff --git a/drivers/iio/light/Kconfig b/drivers/iio/light/Kconfig new file mode 100644 index 0000000..db5618e --- /dev/null +++ b/drivers/iio/light/Kconfig @@ -0,0 +1,22 @@ +# +# Light sensors +# +menu "Light sensors" + +config SENSORS_LM3533 + tristate "LM3533 ambient light sensor" + depends on MFD_LM3533 + help + If you say yes here you get support for the ambient light sensor + interface on National Semiconductor / TI LM3533 Lighting Power + chips. + + The sensor interface can be used to control the LEDs and backlights + of the chip through defining five light zones and three sets of + corresponding output-current values. + + The driver provides raw and mean adc readings along with the current + light zone through sysfs. A threshold event can be generated on zone + changes. The ALS-control output values can be set per zone for the + three current output channels. +endmenu diff --git a/drivers/iio/light/Makefile b/drivers/iio/light/Makefile new file mode 100644 index 0000000..c1c23a0 --- /dev/null +++ b/drivers/iio/light/Makefile @@ -0,0 +1,5 @@ +# +# Makefile for IIO Light sensors +# + +obj-$(CONFIG_SENSORS_LM3533) += lm3533-als.o diff --git a/drivers/iio/light/lm3533-als.c b/drivers/iio/light/lm3533-als.c new file mode 100644 index 0000000..c3e7bac --- /dev/null +++ b/drivers/iio/light/lm3533-als.c @@ -0,0 +1,932 @@ +/* + * lm3533-als.c -- LM3533 Ambient Light Sensor driver + * + * Copyright (C) 2011-2012 Texas Instruments + * + * Author: Johan Hovold + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +#define LM3533_ALS_RESISTOR_MIN 1 +#define LM3533_ALS_RESISTOR_MAX 127 +#define LM3533_ALS_CHANNEL_CURRENT_MAX 2 +#define LM3533_ALS_THRESH_MAX 3 +#define LM3533_ALS_ZONE_MAX 4 + +#define LM3533_REG_ALS_RESISTOR_SELECT 0x30 +#define LM3533_REG_ALS_CONF 0x31 +#define LM3533_REG_ALS_ZONE_INFO 0x34 +#define LM3533_REG_ALS_READ_ADC_RAW 0x37 +#define LM3533_REG_ALS_READ_ADC_AVERAGE 0x38 +#define LM3533_REG_ALS_BOUNDARY_BASE 0x50 +#define LM3533_REG_ALS_TARGET_BASE 0x60 + +#define LM3533_ALS_ENABLE_MASK 0x01 +#define LM3533_ALS_INPUT_MODE_MASK 0x02 +#define LM3533_ALS_INT_ENABLE_MASK 0x01 + +#define LM3533_ALS_ZONE_SHIFT 2 +#define LM3533_ALS_ZONE_MASK 0x1c + +#define LM3533_ALS_FLAG_INT_ENABLED 1 + + +struct lm3533_als { + struct lm3533 *lm3533; + struct platform_device *pdev; + + unsigned long flags; + int irq; + + atomic_t zone; + struct mutex thresh_mutex; +}; + + +static int lm3533_als_get_adc(struct iio_dev *indio_dev, bool average, + int *adc) +{ + struct lm3533_als *als = iio_priv(indio_dev); + u8 reg; + u8 val; + int ret; + + if (average) + reg = LM3533_REG_ALS_READ_ADC_AVERAGE; + else + reg = LM3533_REG_ALS_READ_ADC_RAW; + + ret = lm3533_read(als->lm3533, reg, &val); + if (ret) { + dev_err(&indio_dev->dev, "failed to read adc\n"); + return ret; + } + + *adc = val; + + return 0; +} + +static int _lm3533_als_get_zone(struct iio_dev *indio_dev, u8 *zone) +{ + struct lm3533_als *als = iio_priv(indio_dev); + u8 val; + int ret; + + ret = lm3533_read(als->lm3533, LM3533_REG_ALS_ZONE_INFO, &val); + if (ret) { + dev_err(&indio_dev->dev, "failed to read zone\n"); + return ret; + } + + val = (val & LM3533_ALS_ZONE_MASK) >> LM3533_ALS_ZONE_SHIFT; + *zone = min_t(u8, val, LM3533_ALS_ZONE_MAX); + + return 0; +} + +static int lm3533_als_get_zone(struct iio_dev *indio_dev, u8 *zone) +{ + struct lm3533_als *als = iio_priv(indio_dev); + int ret; + + if (test_bit(LM3533_ALS_FLAG_INT_ENABLED, &als->flags)) { + *zone = atomic_read(&als->zone); + } else { + ret = _lm3533_als_get_zone(indio_dev, zone); + if (ret) + return ret; + } + + return 0; +} + +/* + * channel output channel 0..2 + * zone zone 0..4 + */ +static inline u8 lm3533_als_get_target_reg(unsigned channel, unsigned zone) +{ + return LM3533_REG_ALS_TARGET_BASE + 5 * channel + zone; +} + +static int lm3533_als_get_target(struct iio_dev *indio_dev, unsigned channel, + unsigned zone, u8 *val) +{ + struct lm3533_als *als = iio_priv(indio_dev); + u8 reg; + int ret; + + if (channel > LM3533_ALS_CHANNEL_CURRENT_MAX) + return -EINVAL; + + if (zone > LM3533_ALS_ZONE_MAX) + return -EINVAL; + + reg = lm3533_als_get_target_reg(channel, zone); + ret = lm3533_read(als->lm3533, reg, val); + if (ret) + dev_err(&indio_dev->dev, "failed to get target current\n"); + + return ret; +} + +static int lm3533_als_set_target(struct iio_dev *indio_dev, unsigned channel, + unsigned zone, u8 val) +{ + struct lm3533_als *als = iio_priv(indio_dev); + u8 reg; + int ret; + + if (channel > LM3533_ALS_CHANNEL_CURRENT_MAX) + return -EINVAL; + + if (zone > LM3533_ALS_ZONE_MAX) + return -EINVAL; + + reg = lm3533_als_get_target_reg(channel, zone); + ret = lm3533_write(als->lm3533, reg, val); + if (ret) + dev_err(&indio_dev->dev, "failed to set target current\n"); + + return ret; +} + +static int lm3533_als_get_current(struct iio_dev *indio_dev, unsigned channel, + int *val) +{ + u8 zone; + u8 target; + int ret; + + ret = lm3533_als_get_zone(indio_dev, &zone); + if (ret) + return ret; + + ret = lm3533_als_get_target(indio_dev, channel, zone, &target); + if (ret) + return ret; + + *val = target; + + return 0; +} + +static int lm3533_als_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, int *val2, long mask) +{ + int ret; + + switch (mask) { + case 0: + switch (chan->type) { + case IIO_LIGHT: + ret = lm3533_als_get_adc(indio_dev, false, val); + break; + case IIO_CURRENT: + ret = lm3533_als_get_current(indio_dev, chan->channel, + val); + break; + default: + return -EINVAL; + } + break; + case IIO_CHAN_INFO_AVERAGE_RAW: + ret = lm3533_als_get_adc(indio_dev, true, val); + break; + default: + return -EINVAL; + } + + if (ret) + return ret; + + return IIO_VAL_INT; +} + +#define CHANNEL_CURRENT(_channel) \ + { \ + .type = IIO_CURRENT, \ + .channel = _channel, \ + .indexed = true, \ + .output = true, \ + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT, \ + } + +static const struct iio_chan_spec lm3533_als_channels[] = { + { + .type = IIO_LIGHT, + .channel = 0, + .indexed = true, + .info_mask = (IIO_CHAN_INFO_AVERAGE_RAW_SEPARATE_BIT | + IIO_CHAN_INFO_RAW_SEPARATE_BIT), + }, + CHANNEL_CURRENT(0), + CHANNEL_CURRENT(1), + CHANNEL_CURRENT(2), +}; + +static irqreturn_t lm3533_als_isr(int irq, void *dev_id) +{ + + struct iio_dev *indio_dev = dev_id; + struct lm3533_als *als = iio_priv(indio_dev); + u8 zone; + int ret; + + /* Clear interrupt by reading the ALS zone register. */ + ret = _lm3533_als_get_zone(indio_dev, &zone); + if (ret) + goto out; + + atomic_set(&als->zone, zone); + + iio_push_event(indio_dev, + IIO_UNMOD_EVENT_CODE(IIO_LIGHT, + 0, + IIO_EV_TYPE_THRESH, + IIO_EV_DIR_EITHER), + iio_get_time_ns()); +out: + return IRQ_HANDLED; +} + +static int lm3533_als_set_int_mode(struct iio_dev *indio_dev, int enable) +{ + struct lm3533_als *als = iio_priv(indio_dev); + u8 mask = LM3533_ALS_INT_ENABLE_MASK; + u8 val; + int ret; + + if (enable) + val = mask; + else + val = 0; + + ret = lm3533_update(als->lm3533, LM3533_REG_ALS_ZONE_INFO, val, mask); + if (ret) { + dev_err(&indio_dev->dev, "failed to set int mode %d\n", + enable); + return ret; + } + + return 0; +} + +static int lm3533_als_get_int_mode(struct iio_dev *indio_dev, int *enable) +{ + struct lm3533_als *als = iio_priv(indio_dev); + u8 mask = LM3533_ALS_INT_ENABLE_MASK; + u8 val; + int ret; + + ret = lm3533_read(als->lm3533, LM3533_REG_ALS_ZONE_INFO, &val); + if (ret) { + dev_err(&indio_dev->dev, "failed to get int mode\n"); + return ret; + } + + *enable = !!(val & mask); + + return 0; +} + +static inline u8 lm3533_als_get_threshold_reg(unsigned nr, bool raising) +{ + u8 offset = !raising; + + return LM3533_REG_ALS_BOUNDARY_BASE + 2 * nr + offset; +} + +static int lm3533_als_get_threshold(struct iio_dev *indio_dev, unsigned nr, + bool raising, u8 *val) +{ + struct lm3533_als *als = iio_priv(indio_dev); + u8 reg; + int ret; + + if (nr > LM3533_ALS_THRESH_MAX) + return -EINVAL; + + reg = lm3533_als_get_threshold_reg(nr, raising); + ret = lm3533_read(als->lm3533, reg, val); + if (ret) + dev_err(&indio_dev->dev, "failed to get threshold\n"); + + return ret; +} + +static int lm3533_als_set_threshold(struct iio_dev *indio_dev, unsigned nr, + bool raising, u8 val) +{ + struct lm3533_als *als = iio_priv(indio_dev); + u8 val2; + u8 reg, reg2; + int ret; + + if (nr > LM3533_ALS_THRESH_MAX) + return -EINVAL; + + reg = lm3533_als_get_threshold_reg(nr, raising); + reg2 = lm3533_als_get_threshold_reg(nr, !raising); + + mutex_lock(&als->thresh_mutex); + ret = lm3533_read(als->lm3533, reg2, &val2); + if (ret) { + dev_err(&indio_dev->dev, "failed to get threshold\n"); + goto out; + } + /* + * This device does not allow negative hysteresis (in fact, it uses + * whichever value is smaller as the lower bound) so we need to make + * sure that thresh_falling <= thresh_raising. + */ + if ((raising && (val < val2)) || (!raising && (val > val2))) { + ret = -EINVAL; + goto out; + } + + ret = lm3533_write(als->lm3533, reg, val); + if (ret) { + dev_err(&indio_dev->dev, "failed to set threshold\n"); + goto out; + } +out: + mutex_unlock(&als->thresh_mutex); + + return ret; +} + +static int lm3533_als_get_hysteresis(struct iio_dev *indio_dev, unsigned nr, + u8 *val) +{ + struct lm3533_als *als = iio_priv(indio_dev); + u8 falling; + u8 raising; + int ret; + + if (nr > LM3533_ALS_THRESH_MAX) + return -EINVAL; + + mutex_lock(&als->thresh_mutex); + ret = lm3533_als_get_threshold(indio_dev, nr, false, &falling); + if (ret) + goto out; + ret = lm3533_als_get_threshold(indio_dev, nr, true, &raising); + if (ret) + goto out; + + *val = raising - falling; +out: + mutex_unlock(&als->thresh_mutex); + + return ret; +} + +static int show_thresh_either_en(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + struct lm3533_als *als = iio_priv(indio_dev); + int enable; + int ret; + + if (als->irq) { + ret = lm3533_als_get_int_mode(indio_dev, &enable); + if (ret) + return ret; + } else { + enable = 0; + } + + return scnprintf(buf, PAGE_SIZE, "%u\n", enable); +} + +static int store_thresh_either_en(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + struct lm3533_als *als = iio_priv(indio_dev); + unsigned long enable; + bool int_enabled; + u8 zone; + int ret; + + if (!als->irq) + return -EBUSY; + + if (kstrtoul(buf, 0, &enable)) + return -EINVAL; + + int_enabled = test_bit(LM3533_ALS_FLAG_INT_ENABLED, &als->flags); + + if (enable && !int_enabled) { + ret = lm3533_als_get_zone(indio_dev, &zone); + if (ret) + return ret; + + atomic_set(&als->zone, zone); + + set_bit(LM3533_ALS_FLAG_INT_ENABLED, &als->flags); + } + + ret = lm3533_als_set_int_mode(indio_dev, enable); + if (ret) { + if (!int_enabled) + clear_bit(LM3533_ALS_FLAG_INT_ENABLED, &als->flags); + + return ret; + } + + if (!enable) + clear_bit(LM3533_ALS_FLAG_INT_ENABLED, &als->flags); + + return len; +} + +static ssize_t show_zone(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + u8 zone; + int ret; + + ret = lm3533_als_get_zone(indio_dev, &zone); + if (ret) + return ret; + + return scnprintf(buf, PAGE_SIZE, "%u\n", zone); +} + +enum lm3533_als_attribute_type { + LM3533_ATTR_TYPE_HYSTERESIS, + LM3533_ATTR_TYPE_TARGET, + LM3533_ATTR_TYPE_THRESH_FALLING, + LM3533_ATTR_TYPE_THRESH_RAISING, +}; + +struct lm3533_als_attribute { + struct device_attribute dev_attr; + enum lm3533_als_attribute_type type; + u8 val1; + u8 val2; +}; + +static inline struct lm3533_als_attribute * +to_lm3533_als_attr(struct device_attribute *attr) +{ + return container_of(attr, struct lm3533_als_attribute, dev_attr); +} + +static ssize_t show_als_attr(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + struct lm3533_als_attribute *als_attr = to_lm3533_als_attr(attr); + u8 val; + int ret; + + switch (als_attr->type) { + case LM3533_ATTR_TYPE_HYSTERESIS: + ret = lm3533_als_get_hysteresis(indio_dev, als_attr->val1, + &val); + break; + case LM3533_ATTR_TYPE_TARGET: + ret = lm3533_als_get_target(indio_dev, als_attr->val1, + als_attr->val2, &val); + break; + case LM3533_ATTR_TYPE_THRESH_FALLING: + ret = lm3533_als_get_threshold(indio_dev, als_attr->val1, + false, &val); + break; + case LM3533_ATTR_TYPE_THRESH_RAISING: + ret = lm3533_als_get_threshold(indio_dev, als_attr->val1, + true, &val); + break; + default: + ret = -ENXIO; + } + + if (ret) + return ret; + + return scnprintf(buf, PAGE_SIZE, "%u\n", val); +} + +static ssize_t store_als_attr(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + struct lm3533_als_attribute *als_attr = to_lm3533_als_attr(attr); + u8 val; + int ret; + + if (kstrtou8(buf, 0, &val)) + return -EINVAL; + + switch (als_attr->type) { + case LM3533_ATTR_TYPE_TARGET: + ret = lm3533_als_set_target(indio_dev, als_attr->val1, + als_attr->val2, val); + break; + case LM3533_ATTR_TYPE_THRESH_FALLING: + ret = lm3533_als_set_threshold(indio_dev, als_attr->val1, + false, val); + break; + case LM3533_ATTR_TYPE_THRESH_RAISING: + ret = lm3533_als_set_threshold(indio_dev, als_attr->val1, + true, val); + break; + default: + ret = -ENXIO; + } + + if (ret) + return ret; + + return len; +} + +#define ALS_ATTR(_name, _mode, _show, _store, _type, _val1, _val2) \ + { .dev_attr = __ATTR(_name, _mode, _show, _store), \ + .type = _type, \ + .val1 = _val1, \ + .val2 = _val2 } + +#define LM3533_ALS_ATTR(_name, _mode, _show, _store, _type, _val1, _val2) \ + struct lm3533_als_attribute lm3533_als_attr_##_name = \ + ALS_ATTR(_name, _mode, _show, _store, _type, _val1, _val2) + +#define ALS_TARGET_ATTR_RW(_channel, _zone) \ + LM3533_ALS_ATTR(out_current##_channel##_current##_zone##_raw, \ + S_IRUGO | S_IWUSR, \ + show_als_attr, store_als_attr, \ + LM3533_ATTR_TYPE_TARGET, _channel, _zone) +/* + * ALS output current values (ALS mapper targets) + * + * out_current[0-2]_current[0-4]_raw 0-255 + */ +static ALS_TARGET_ATTR_RW(0, 0); +static ALS_TARGET_ATTR_RW(0, 1); +static ALS_TARGET_ATTR_RW(0, 2); +static ALS_TARGET_ATTR_RW(0, 3); +static ALS_TARGET_ATTR_RW(0, 4); + +static ALS_TARGET_ATTR_RW(1, 0); +static ALS_TARGET_ATTR_RW(1, 1); +static ALS_TARGET_ATTR_RW(1, 2); +static ALS_TARGET_ATTR_RW(1, 3); +static ALS_TARGET_ATTR_RW(1, 4); + +static ALS_TARGET_ATTR_RW(2, 0); +static ALS_TARGET_ATTR_RW(2, 1); +static ALS_TARGET_ATTR_RW(2, 2); +static ALS_TARGET_ATTR_RW(2, 3); +static ALS_TARGET_ATTR_RW(2, 4); + +#define ALS_THRESH_FALLING_ATTR_RW(_nr) \ + LM3533_ALS_ATTR(in_illuminance0_thresh##_nr##_falling_value, \ + S_IRUGO | S_IWUSR, \ + show_als_attr, store_als_attr, \ + LM3533_ATTR_TYPE_THRESH_FALLING, _nr, 0) + +#define ALS_THRESH_RAISING_ATTR_RW(_nr) \ + LM3533_ALS_ATTR(in_illuminance0_thresh##_nr##_raising_value, \ + S_IRUGO | S_IWUSR, \ + show_als_attr, store_als_attr, \ + LM3533_ATTR_TYPE_THRESH_RAISING, _nr, 0) +/* + * ALS Zone thresholds (boundaries) + * + * in_illuminance0_thresh[0-3]_falling_value 0-255 + * in_illuminance0_thresh[0-3]_raising_value 0-255 + */ +static ALS_THRESH_FALLING_ATTR_RW(0); +static ALS_THRESH_FALLING_ATTR_RW(1); +static ALS_THRESH_FALLING_ATTR_RW(2); +static ALS_THRESH_FALLING_ATTR_RW(3); + +static ALS_THRESH_RAISING_ATTR_RW(0); +static ALS_THRESH_RAISING_ATTR_RW(1); +static ALS_THRESH_RAISING_ATTR_RW(2); +static ALS_THRESH_RAISING_ATTR_RW(3); + +#define ALS_HYSTERESIS_ATTR_RO(_nr) \ + LM3533_ALS_ATTR(in_illuminance0_thresh##_nr##_hysteresis, \ + S_IRUGO, show_als_attr, NULL, \ + LM3533_ATTR_TYPE_HYSTERESIS, _nr, 0) +/* + * ALS Zone threshold hysteresis + * + * threshY_hysteresis = threshY_raising - threshY_falling + * + * in_illuminance0_thresh[0-3]_hysteresis 0-255 + * in_illuminance0_thresh[0-3]_hysteresis 0-255 + */ +static ALS_HYSTERESIS_ATTR_RO(0); +static ALS_HYSTERESIS_ATTR_RO(1); +static ALS_HYSTERESIS_ATTR_RO(2); +static ALS_HYSTERESIS_ATTR_RO(3); + +#define ILLUMINANCE_ATTR_RO(_name) \ + DEVICE_ATTR(in_illuminance0_##_name, S_IRUGO, show_##_name, NULL) +#define ILLUMINANCE_ATTR_RW(_name) \ + DEVICE_ATTR(in_illuminance0_##_name, S_IRUGO | S_IWUSR , \ + show_##_name, store_##_name) +/* + * ALS Zone threshold-event enable + * + * in_illuminance0_thresh_either_en 0,1 + */ +static ILLUMINANCE_ATTR_RW(thresh_either_en); + +/* + * ALS Current Zone + * + * in_illuminance0_zone 0-4 + */ +static ILLUMINANCE_ATTR_RO(zone); + +static struct attribute *lm3533_als_event_attributes[] = { + &dev_attr_in_illuminance0_thresh_either_en.attr, + &lm3533_als_attr_in_illuminance0_thresh0_falling_value.dev_attr.attr, + &lm3533_als_attr_in_illuminance0_thresh0_hysteresis.dev_attr.attr, + &lm3533_als_attr_in_illuminance0_thresh0_raising_value.dev_attr.attr, + &lm3533_als_attr_in_illuminance0_thresh1_falling_value.dev_attr.attr, + &lm3533_als_attr_in_illuminance0_thresh1_hysteresis.dev_attr.attr, + &lm3533_als_attr_in_illuminance0_thresh1_raising_value.dev_attr.attr, + &lm3533_als_attr_in_illuminance0_thresh2_falling_value.dev_attr.attr, + &lm3533_als_attr_in_illuminance0_thresh2_hysteresis.dev_attr.attr, + &lm3533_als_attr_in_illuminance0_thresh2_raising_value.dev_attr.attr, + &lm3533_als_attr_in_illuminance0_thresh3_falling_value.dev_attr.attr, + &lm3533_als_attr_in_illuminance0_thresh3_hysteresis.dev_attr.attr, + &lm3533_als_attr_in_illuminance0_thresh3_raising_value.dev_attr.attr, + NULL +}; + +static struct attribute_group lm3533_als_event_attribute_group = { + .attrs = lm3533_als_event_attributes +}; + +static struct attribute *lm3533_als_attributes[] = { + &dev_attr_in_illuminance0_zone.attr, + &lm3533_als_attr_out_current0_current0_raw.dev_attr.attr, + &lm3533_als_attr_out_current0_current1_raw.dev_attr.attr, + &lm3533_als_attr_out_current0_current2_raw.dev_attr.attr, + &lm3533_als_attr_out_current0_current3_raw.dev_attr.attr, + &lm3533_als_attr_out_current0_current4_raw.dev_attr.attr, + &lm3533_als_attr_out_current1_current0_raw.dev_attr.attr, + &lm3533_als_attr_out_current1_current1_raw.dev_attr.attr, + &lm3533_als_attr_out_current1_current2_raw.dev_attr.attr, + &lm3533_als_attr_out_current1_current3_raw.dev_attr.attr, + &lm3533_als_attr_out_current1_current4_raw.dev_attr.attr, + &lm3533_als_attr_out_current2_current0_raw.dev_attr.attr, + &lm3533_als_attr_out_current2_current1_raw.dev_attr.attr, + &lm3533_als_attr_out_current2_current2_raw.dev_attr.attr, + &lm3533_als_attr_out_current2_current3_raw.dev_attr.attr, + &lm3533_als_attr_out_current2_current4_raw.dev_attr.attr, + NULL +}; + +static struct attribute_group lm3533_als_attribute_group = { + .attrs = lm3533_als_attributes +}; + +static int __devinit lm3533_als_set_input_mode(struct lm3533_als *als, + bool pwm_mode) +{ + u8 mask = LM3533_ALS_INPUT_MODE_MASK; + u8 val; + int ret; + + if (pwm_mode) + val = mask; /* pwm input */ + else + val = 0; /* analog input */ + + ret = lm3533_update(als->lm3533, LM3533_REG_ALS_CONF, val, mask); + if (ret) { + dev_err(&als->pdev->dev, "failed to set input mode %d\n", + pwm_mode); + return ret; + } + + return 0; +} + +static int __devinit lm3533_als_set_resistor(struct lm3533_als *als, u8 val) +{ + int ret; + + if (val < LM3533_ALS_RESISTOR_MIN || val > LM3533_ALS_RESISTOR_MAX) + return -EINVAL; + + ret = lm3533_write(als->lm3533, LM3533_REG_ALS_RESISTOR_SELECT, val); + if (ret) { + dev_err(&als->pdev->dev, "failed to set resistor\n"); + return ret; + } + + return 0; +} + +static int __devinit lm3533_als_setup(struct lm3533_als *als, + struct lm3533_als_platform_data *pdata) +{ + int ret; + + ret = lm3533_als_set_input_mode(als, pdata->pwm_mode); + if (ret) + return ret; + + /* ALS input is always high impedance in PWM-mode. */ + if (!pdata->pwm_mode) { + ret = lm3533_als_set_resistor(als, pdata->r_select); + if (ret) + return ret; + } + + return 0; +} + +static int __devinit lm3533_als_setup_irq(struct lm3533_als *als, void *dev) +{ + u8 mask = LM3533_ALS_INT_ENABLE_MASK; + int ret; + + /* Make sure interrupts are disabled. */ + ret = lm3533_update(als->lm3533, LM3533_REG_ALS_ZONE_INFO, 0, mask); + if (ret) { + dev_err(&als->pdev->dev, "failed to disable interrupts\n"); + return ret; + } + + ret = request_threaded_irq(als->irq, NULL, lm3533_als_isr, + IRQF_TRIGGER_LOW | IRQF_ONESHOT, + dev_name(&als->pdev->dev), dev); + if (ret) { + dev_err(&als->pdev->dev, "failed to request irq %d\n", + als->irq); + return ret; + } + + return 0; +} + +static int __devinit lm3533_als_enable(struct lm3533_als *als) +{ + u8 mask = LM3533_ALS_ENABLE_MASK; + int ret; + + ret = lm3533_update(als->lm3533, LM3533_REG_ALS_CONF, mask, mask); + if (ret) + dev_err(&als->pdev->dev, "failed to enable ALS\n"); + + return ret; +} + +static int lm3533_als_disable(struct lm3533_als *als) +{ + u8 mask = LM3533_ALS_ENABLE_MASK; + int ret; + + ret = lm3533_update(als->lm3533, LM3533_REG_ALS_CONF, 0, mask); + if (ret) + dev_err(&als->pdev->dev, "failed to disable ALS\n"); + + return ret; +} + +static const struct iio_info lm3533_als_info = { + .attrs = &lm3533_als_attribute_group, + .event_attrs = &lm3533_als_event_attribute_group, + .driver_module = THIS_MODULE, + .read_raw = &lm3533_als_read_raw, +}; + +static int __devinit lm3533_als_probe(struct platform_device *pdev) +{ + struct lm3533 *lm3533; + struct lm3533_als_platform_data *pdata; + struct lm3533_als *als; + struct iio_dev *indio_dev; + int ret; + + lm3533 = dev_get_drvdata(pdev->dev.parent); + if (!lm3533) + return -EINVAL; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "no platform data\n"); + return -EINVAL; + } + + indio_dev = iio_device_alloc(sizeof(*als)); + if (!indio_dev) + return -ENOMEM; + + indio_dev->info = &lm3533_als_info; + indio_dev->channels = lm3533_als_channels; + indio_dev->num_channels = ARRAY_SIZE(lm3533_als_channels); + indio_dev->name = dev_name(&pdev->dev); + indio_dev->dev.parent = pdev->dev.parent; + indio_dev->modes = INDIO_DIRECT_MODE; + + als = iio_priv(indio_dev); + als->lm3533 = lm3533; + als->pdev = pdev; + als->irq = lm3533->irq; + atomic_set(&als->zone, 0); + mutex_init(&als->thresh_mutex); + + platform_set_drvdata(pdev, indio_dev); + + if (als->irq) { + ret = lm3533_als_setup_irq(als, indio_dev); + if (ret) + goto err_free_dev; + } + + ret = lm3533_als_setup(als, pdata); + if (ret) + goto err_free_irq; + + ret = lm3533_als_enable(als); + if (ret) + goto err_free_irq; + + ret = iio_device_register(indio_dev); + if (ret) { + dev_err(&pdev->dev, "failed to register ALS\n"); + goto err_disable; + } + + return 0; + +err_disable: + lm3533_als_disable(als); +err_free_irq: + if (als->irq) + free_irq(als->irq, indio_dev); +err_free_dev: + iio_device_free(indio_dev); + + return ret; +} + +static int __devexit lm3533_als_remove(struct platform_device *pdev) +{ + struct iio_dev *indio_dev = platform_get_drvdata(pdev); + struct lm3533_als *als = iio_priv(indio_dev); + + lm3533_als_set_int_mode(indio_dev, false); + iio_device_unregister(indio_dev); + lm3533_als_disable(als); + if (als->irq) + free_irq(als->irq, indio_dev); + iio_device_free(indio_dev); + + return 0; +} + +static struct platform_driver lm3533_als_driver = { + .driver = { + .name = "lm3533-als", + .owner = THIS_MODULE, + }, + .probe = lm3533_als_probe, + .remove = __devexit_p(lm3533_als_remove), +}; +module_platform_driver(lm3533_als_driver); + +MODULE_AUTHOR("Johan Hovold "); +MODULE_DESCRIPTION("LM3533 Ambient Light Sensor driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:lm3533-als"); -- cgit v0.10.2 From cd1678f963298a9e777f3edb72d28bc18a3a32c2 Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Tue, 29 May 2012 12:41:19 +0200 Subject: iio: frequency: New driver for AD9523 SPI Low Jitter Clock Generator Changes since V1: Apply Jonathan's review feedback: Revise device status attribute names, and split documentation into two sections. Add additional comments, and fix indention issues. Remove pointless zero initializations. Revise return value handling. Simplify some code sections. Split store_eeprom and sync handling into separate functions. Use strtobool where applicable. Document platform data structures using kernel-doc style. Use dev_to_iio_dev write_raw IIO_CHAN_INFO_FREQUENCY: Reject values <= 0 Make patch target drivers/iio Changes since V2: Use for_each_clear_bit() and __set_bit() where applicable. Add descriptive comment. Avoid temporary for struct regulator. spi_device_id name use ad9523-1, ad9523 will be added later. Signed-off-by: Michael Hennerich Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/Documentation/ABI/testing/sysfs-bus-iio-frequency-ad9523 b/Documentation/ABI/testing/sysfs-bus-iio-frequency-ad9523 new file mode 100644 index 0000000..2ce9c3f --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-iio-frequency-ad9523 @@ -0,0 +1,37 @@ +What: /sys/bus/iio/devices/iio:deviceX/pll2_feedback_clk_present +What: /sys/bus/iio/devices/iio:deviceX/pll2_reference_clk_present +What: /sys/bus/iio/devices/iio:deviceX/pll1_reference_clk_a_present +What: /sys/bus/iio/devices/iio:deviceX/pll1_reference_clk_b_present +What: /sys/bus/iio/devices/iio:deviceX/pll1_reference_clk_test_present +What: /sys/bus/iio/devices/iio:deviceX/vcxo_clk_present +KernelVersion: 3.4.0 +Contact: linux-iio@vger.kernel.org +Description: + Reading returns either '1' or '0'. + '1' means that the clock in question is present. + '0' means that the clock is missing. + +What: /sys/bus/iio/devices/iio:deviceX/pllY_locked +KernelVersion: 3.4.0 +Contact: linux-iio@vger.kernel.org +Description: + Reading returns either '1' or '0'. '1' means that the + pllY is locked. + +What: /sys/bus/iio/devices/iio:deviceX/store_eeprom +KernelVersion: 3.4.0 +Contact: linux-iio@vger.kernel.org +Description: + Writing '1' stores the current device configuration into + on-chip EEPROM. After power-up or chip reset the device will + automatically load the saved configuration. + +What: /sys/bus/iio/devices/iio:deviceX/sync_dividers +KernelVersion: 3.4.0 +Contact: linux-iio@vger.kernel.org +Description: + Writing '1' triggers the clock distribution synchronization + functionality. All dividers are reset and the channels start + with their predefined phase offsets (out_altvoltageY_phase). + Writing this file has the effect as driving the external + /SYNC pin low. diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig index cacc74d..64c88e5 100644 --- a/drivers/iio/Kconfig +++ b/drivers/iio/Kconfig @@ -51,5 +51,6 @@ config IIO_CONSUMERS_PER_TRIGGER source "drivers/iio/adc/Kconfig" source "drivers/iio/amplifiers/Kconfig" source "drivers/iio/light/Kconfig" +source "drivers/iio/frequency/Kconfig" endif # IIO diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile index 060b674..bd801c0 100644 --- a/drivers/iio/Makefile +++ b/drivers/iio/Makefile @@ -12,3 +12,4 @@ obj-$(CONFIG_IIO_KFIFO_BUF) += kfifo_buf.o obj-y += adc/ obj-y += amplifiers/ obj-y += light/ +obj-y += frequency/ diff --git a/drivers/iio/frequency/Kconfig b/drivers/iio/frequency/Kconfig new file mode 100644 index 0000000..0458c92 --- /dev/null +++ b/drivers/iio/frequency/Kconfig @@ -0,0 +1,23 @@ +# +# Frequency +# Direct Digital Synthesis drivers (DDS) +# Clock Distribution device drivers +# Phase-Locked Loop (PLL) frequency synthesizers +# + +menu "Frequency Synthesizers DDS/PLL" + +menu "Clock Generator/Distribution" + +config AD9523 + tristate "Analog Devices AD9523 Low Jitter Clock Generator" + depends on SPI + help + Say yes here to build support for Analog Devices AD9523 Low Jitter + Clock Generator. The driver provides direct access via sysfs. + + To compile this driver as a module, choose M here: the + module will be called ad9523. + +endmenu +endmenu diff --git a/drivers/iio/frequency/Makefile b/drivers/iio/frequency/Makefile new file mode 100644 index 0000000..1b5b224 --- /dev/null +++ b/drivers/iio/frequency/Makefile @@ -0,0 +1,5 @@ +# +# Makefile iio/frequency +# + +obj-$(CONFIG_AD9523) += ad9523.o diff --git a/drivers/iio/frequency/ad9523.c b/drivers/iio/frequency/ad9523.c new file mode 100644 index 0000000..7272924 --- /dev/null +++ b/drivers/iio/frequency/ad9523.c @@ -0,0 +1,1057 @@ +/* + * AD9523 SPI Low Jitter Clock Generator + * + * Copyright 2012 Analog Devices Inc. + * + * Licensed under the GPL-2. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define AD9523_READ (1 << 15) +#define AD9523_WRITE (0 << 15) +#define AD9523_CNT(x) (((x) - 1) << 13) +#define AD9523_ADDR(x) ((x) & 0xFFF) + +#define AD9523_R1B (1 << 16) +#define AD9523_R2B (2 << 16) +#define AD9523_R3B (3 << 16) +#define AD9523_TRANSF_LEN(x) ((x) >> 16) + +#define AD9523_SERIAL_PORT_CONFIG (AD9523_R1B | 0x0) +#define AD9523_VERSION_REGISTER (AD9523_R1B | 0x2) +#define AD9523_PART_REGISTER (AD9523_R1B | 0x3) +#define AD9523_READBACK_CTRL (AD9523_R1B | 0x4) + +#define AD9523_EEPROM_CUSTOMER_VERSION_ID (AD9523_R2B | 0x6) + +#define AD9523_PLL1_REF_A_DIVIDER (AD9523_R2B | 0x11) +#define AD9523_PLL1_REF_B_DIVIDER (AD9523_R2B | 0x13) +#define AD9523_PLL1_REF_TEST_DIVIDER (AD9523_R1B | 0x14) +#define AD9523_PLL1_FEEDBACK_DIVIDER (AD9523_R2B | 0x17) +#define AD9523_PLL1_CHARGE_PUMP_CTRL (AD9523_R2B | 0x19) +#define AD9523_PLL1_INPUT_RECEIVERS_CTRL (AD9523_R1B | 0x1A) +#define AD9523_PLL1_REF_CTRL (AD9523_R1B | 0x1B) +#define AD9523_PLL1_MISC_CTRL (AD9523_R1B | 0x1C) +#define AD9523_PLL1_LOOP_FILTER_CTRL (AD9523_R1B | 0x1D) + +#define AD9523_PLL2_CHARGE_PUMP (AD9523_R1B | 0xF0) +#define AD9523_PLL2_FEEDBACK_DIVIDER_AB (AD9523_R1B | 0xF1) +#define AD9523_PLL2_CTRL (AD9523_R1B | 0xF2) +#define AD9523_PLL2_VCO_CTRL (AD9523_R1B | 0xF3) +#define AD9523_PLL2_VCO_DIVIDER (AD9523_R1B | 0xF4) +#define AD9523_PLL2_LOOP_FILTER_CTRL (AD9523_R2B | 0xF6) +#define AD9523_PLL2_R2_DIVIDER (AD9523_R1B | 0xF7) + +#define AD9523_CHANNEL_CLOCK_DIST(ch) (AD9523_R3B | (0x192 + 3 * ch)) + +#define AD9523_PLL1_OUTPUT_CTRL (AD9523_R1B | 0x1BA) +#define AD9523_PLL1_OUTPUT_CHANNEL_CTRL (AD9523_R1B | 0x1BB) + +#define AD9523_READBACK_0 (AD9523_R1B | 0x22C) +#define AD9523_READBACK_1 (AD9523_R1B | 0x22D) + +#define AD9523_STATUS_SIGNALS (AD9523_R3B | 0x232) +#define AD9523_POWER_DOWN_CTRL (AD9523_R1B | 0x233) +#define AD9523_IO_UPDATE (AD9523_R1B | 0x234) + +#define AD9523_EEPROM_DATA_XFER_STATUS (AD9523_R1B | 0xB00) +#define AD9523_EEPROM_ERROR_READBACK (AD9523_R1B | 0xB01) +#define AD9523_EEPROM_CTRL1 (AD9523_R1B | 0xB02) +#define AD9523_EEPROM_CTRL2 (AD9523_R1B | 0xB03) + +/* AD9523_SERIAL_PORT_CONFIG */ + +#define AD9523_SER_CONF_SDO_ACTIVE (1 << 7) +#define AD9523_SER_CONF_SOFT_RESET (1 << 5) + +/* AD9523_READBACK_CTRL */ +#define AD9523_READBACK_CTRL_READ_BUFFERED (1 << 0) + +/* AD9523_PLL1_CHARGE_PUMP_CTRL */ +#define AD9523_PLL1_CHARGE_PUMP_CURRENT_nA(x) (((x) / 500) & 0x7F) +#define AD9523_PLL1_CHARGE_PUMP_TRISTATE (1 << 7) +#define AD9523_PLL1_CHARGE_PUMP_MODE_NORMAL (3 << 8) +#define AD9523_PLL1_CHARGE_PUMP_MODE_PUMP_DOWN (2 << 8) +#define AD9523_PLL1_CHARGE_PUMP_MODE_PUMP_UP (1 << 8) +#define AD9523_PLL1_CHARGE_PUMP_MODE_TRISTATE (0 << 8) +#define AD9523_PLL1_BACKLASH_PW_MIN (0 << 10) +#define AD9523_PLL1_BACKLASH_PW_LOW (1 << 10) +#define AD9523_PLL1_BACKLASH_PW_HIGH (2 << 10) +#define AD9523_PLL1_BACKLASH_PW_MAX (3 << 10) + +/* AD9523_PLL1_INPUT_RECEIVERS_CTRL */ +#define AD9523_PLL1_REF_TEST_RCV_EN (1 << 7) +#define AD9523_PLL1_REFB_DIFF_RCV_EN (1 << 6) +#define AD9523_PLL1_REFA_DIFF_RCV_EN (1 << 5) +#define AD9523_PLL1_REFB_RCV_EN (1 << 4) +#define AD9523_PLL1_REFA_RCV_EN (1 << 3) +#define AD9523_PLL1_REFA_REFB_PWR_CTRL_EN (1 << 2) +#define AD9523_PLL1_OSC_IN_CMOS_NEG_INP_EN (1 << 1) +#define AD9523_PLL1_OSC_IN_DIFF_EN (1 << 0) + +/* AD9523_PLL1_REF_CTRL */ +#define AD9523_PLL1_BYPASS_REF_TEST_DIV_EN (1 << 7) +#define AD9523_PLL1_BYPASS_FEEDBACK_DIV_EN (1 << 6) +#define AD9523_PLL1_ZERO_DELAY_MODE_INT (1 << 5) +#define AD9523_PLL1_ZERO_DELAY_MODE_EXT (0 << 5) +#define AD9523_PLL1_OSC_IN_PLL_FEEDBACK_EN (1 << 4) +#define AD9523_PLL1_ZD_IN_CMOS_NEG_INP_EN (1 << 3) +#define AD9523_PLL1_ZD_IN_DIFF_EN (1 << 2) +#define AD9523_PLL1_REFB_CMOS_NEG_INP_EN (1 << 1) +#define AD9523_PLL1_REFA_CMOS_NEG_INP_EN (1 << 0) + +/* AD9523_PLL1_MISC_CTRL */ +#define AD9523_PLL1_REFB_INDEP_DIV_CTRL_EN (1 << 7) +#define AD9523_PLL1_OSC_CTRL_FAIL_VCC_BY2_EN (1 << 6) +#define AD9523_PLL1_REF_MODE(x) ((x) << 2) +#define AD9523_PLL1_BYPASS_REFB_DIV (1 << 1) +#define AD9523_PLL1_BYPASS_REFA_DIV (1 << 0) + +/* AD9523_PLL1_LOOP_FILTER_CTRL */ +#define AD9523_PLL1_LOOP_FILTER_RZERO(x) ((x) & 0xF) + +/* AD9523_PLL2_CHARGE_PUMP */ +#define AD9523_PLL2_CHARGE_PUMP_CURRENT_nA(x) ((x) / 3500) + +/* AD9523_PLL2_FEEDBACK_DIVIDER_AB */ +#define AD9523_PLL2_FB_NDIV_A_CNT(x) (((x) & 0x3) << 6) +#define AD9523_PLL2_FB_NDIV_B_CNT(x) (((x) & 0x3F) << 0) +#define AD9523_PLL2_FB_NDIV(a, b) (4 * (b) + (a)) + +/* AD9523_PLL2_CTRL */ +#define AD9523_PLL2_CHARGE_PUMP_MODE_NORMAL (3 << 0) +#define AD9523_PLL2_CHARGE_PUMP_MODE_PUMP_DOWN (2 << 0) +#define AD9523_PLL2_CHARGE_PUMP_MODE_PUMP_UP (1 << 0) +#define AD9523_PLL2_CHARGE_PUMP_MODE_TRISTATE (0 << 0) +#define AD9523_PLL2_BACKLASH_PW_MIN (0 << 2) +#define AD9523_PLL2_BACKLASH_PW_LOW (1 << 2) +#define AD9523_PLL2_BACKLASH_PW_HIGH (2 << 2) +#define AD9523_PLL2_BACKLASH_PW_MAX (3 << 1) +#define AD9523_PLL2_BACKLASH_CTRL_EN (1 << 4) +#define AD9523_PLL2_FREQ_DOUBLER_EN (1 << 5) +#define AD9523_PLL2_LOCK_DETECT_PWR_DOWN_EN (1 << 7) + +/* AD9523_PLL2_VCO_CTRL */ +#define AD9523_PLL2_VCO_CALIBRATE (1 << 1) +#define AD9523_PLL2_FORCE_VCO_MIDSCALE (1 << 2) +#define AD9523_PLL2_FORCE_REFERENCE_VALID (1 << 3) +#define AD9523_PLL2_FORCE_RELEASE_SYNC (1 << 4) + +/* AD9523_PLL2_VCO_DIVIDER */ +#define AD9523_PLL2_VCO_DIV_M1(x) ((((x) - 3) & 0x3) << 0) +#define AD9523_PLL2_VCO_DIV_M2(x) ((((x) - 3) & 0x3) << 4) +#define AD9523_PLL2_VCO_DIV_M1_PWR_DOWN_EN (1 << 2) +#define AD9523_PLL2_VCO_DIV_M2_PWR_DOWN_EN (1 << 6) + +/* AD9523_PLL2_LOOP_FILTER_CTRL */ +#define AD9523_PLL2_LOOP_FILTER_CPOLE1(x) (((x) & 0x7) << 0) +#define AD9523_PLL2_LOOP_FILTER_RZERO(x) (((x) & 0x7) << 3) +#define AD9523_PLL2_LOOP_FILTER_RPOLE2(x) (((x) & 0x7) << 6) +#define AD9523_PLL2_LOOP_FILTER_RZERO_BYPASS_EN (1 << 8) + +/* AD9523_PLL2_R2_DIVIDER */ +#define AD9523_PLL2_R2_DIVIDER_VAL(x) (((x) & 0x1F) << 0) + +/* AD9523_CHANNEL_CLOCK_DIST */ +#define AD9523_CLK_DIST_DIV_PHASE(x) (((x) & 0x3F) << 18) +#define AD9523_CLK_DIST_DIV_PHASE_REV(x) ((ret >> 18) & 0x3F) +#define AD9523_CLK_DIST_DIV(x) ((((x) - 1) & 0x3FF) << 8) +#define AD9523_CLK_DIST_DIV_REV(x) (((ret >> 8) & 0x3FF) + 1) +#define AD9523_CLK_DIST_INV_DIV_OUTPUT_EN (1 << 7) +#define AD9523_CLK_DIST_IGNORE_SYNC_EN (1 << 6) +#define AD9523_CLK_DIST_PWR_DOWN_EN (1 << 5) +#define AD9523_CLK_DIST_LOW_PWR_MODE_EN (1 << 4) +#define AD9523_CLK_DIST_DRIVER_MODE(x) (((x) & 0xF) << 0) + +/* AD9523_PLL1_OUTPUT_CTRL */ +#define AD9523_PLL1_OUTP_CTRL_VCO_DIV_SEL_CH6_M2 (1 << 7) +#define AD9523_PLL1_OUTP_CTRL_VCO_DIV_SEL_CH5_M2 (1 << 6) +#define AD9523_PLL1_OUTP_CTRL_VCO_DIV_SEL_CH4_M2 (1 << 5) +#define AD9523_PLL1_OUTP_CTRL_CMOS_DRV_WEAK (1 << 4) +#define AD9523_PLL1_OUTP_CTRL_OUTPUT_DIV_1 (0 << 0) +#define AD9523_PLL1_OUTP_CTRL_OUTPUT_DIV_2 (1 << 0) +#define AD9523_PLL1_OUTP_CTRL_OUTPUT_DIV_4 (2 << 0) +#define AD9523_PLL1_OUTP_CTRL_OUTPUT_DIV_8 (4 << 0) +#define AD9523_PLL1_OUTP_CTRL_OUTPUT_DIV_16 (8 << 0) + +/* AD9523_PLL1_OUTPUT_CHANNEL_CTRL */ +#define AD9523_PLL1_OUTP_CH_CTRL_OUTPUT_PWR_DOWN_EN (1 << 7) +#define AD9523_PLL1_OUTP_CH_CTRL_VCO_DIV_SEL_CH9_M2 (1 << 6) +#define AD9523_PLL1_OUTP_CH_CTRL_VCO_DIV_SEL_CH8_M2 (1 << 5) +#define AD9523_PLL1_OUTP_CH_CTRL_VCO_DIV_SEL_CH7_M2 (1 << 4) +#define AD9523_PLL1_OUTP_CH_CTRL_VCXO_SRC_SEL_CH3 (1 << 3) +#define AD9523_PLL1_OUTP_CH_CTRL_VCXO_SRC_SEL_CH2 (1 << 2) +#define AD9523_PLL1_OUTP_CH_CTRL_VCXO_SRC_SEL_CH1 (1 << 1) +#define AD9523_PLL1_OUTP_CH_CTRL_VCXO_SRC_SEL_CH0 (1 << 0) + +/* AD9523_READBACK_0 */ +#define AD9523_READBACK_0_STAT_PLL2_REF_CLK (1 << 7) +#define AD9523_READBACK_0_STAT_PLL2_FB_CLK (1 << 6) +#define AD9523_READBACK_0_STAT_VCXO (1 << 5) +#define AD9523_READBACK_0_STAT_REF_TEST (1 << 4) +#define AD9523_READBACK_0_STAT_REFB (1 << 3) +#define AD9523_READBACK_0_STAT_REFA (1 << 2) +#define AD9523_READBACK_0_STAT_PLL2_LD (1 << 1) +#define AD9523_READBACK_0_STAT_PLL1_LD (1 << 0) + +/* AD9523_READBACK_1 */ +#define AD9523_READBACK_1_HOLDOVER_ACTIVE (1 << 3) +#define AD9523_READBACK_1_AUTOMODE_SEL_REFB (1 << 2) +#define AD9523_READBACK_1_VCO_CALIB_IN_PROGRESS (1 << 0) + +/* AD9523_STATUS_SIGNALS */ +#define AD9523_STATUS_SIGNALS_SYNC_MAN_CTRL (1 << 16) +#define AD9523_STATUS_MONITOR_01_PLL12_LOCKED (0x302) +/* AD9523_POWER_DOWN_CTRL */ +#define AD9523_POWER_DOWN_CTRL_PLL1_PWR_DOWN (1 << 2) +#define AD9523_POWER_DOWN_CTRL_PLL2_PWR_DOWN (1 << 1) +#define AD9523_POWER_DOWN_CTRL_DIST_PWR_DOWN (1 << 0) + +/* AD9523_IO_UPDATE */ +#define AD9523_IO_UPDATE_EN (1 << 0) + +/* AD9523_EEPROM_DATA_XFER_STATUS */ +#define AD9523_EEPROM_DATA_XFER_IN_PROGRESS (1 << 0) + +/* AD9523_EEPROM_ERROR_READBACK */ +#define AD9523_EEPROM_ERROR_READBACK_FAIL (1 << 0) + +/* AD9523_EEPROM_CTRL1 */ +#define AD9523_EEPROM_CTRL1_SOFT_EEPROM (1 << 1) +#define AD9523_EEPROM_CTRL1_EEPROM_WRITE_PROT_DIS (1 << 0) + +/* AD9523_EEPROM_CTRL2 */ +#define AD9523_EEPROM_CTRL2_REG2EEPROM (1 << 0) + +#define AD9523_NUM_CHAN 14 +#define AD9523_NUM_CHAN_ALT_CLK_SRC 10 + +/* Helpers to avoid excess line breaks */ +#define AD_IFE(_pde, _a, _b) ((pdata->_pde) ? _a : _b) +#define AD_IF(_pde, _a) AD_IFE(_pde, _a, 0) + +enum { + AD9523_STAT_PLL1_LD, + AD9523_STAT_PLL2_LD, + AD9523_STAT_REFA, + AD9523_STAT_REFB, + AD9523_STAT_REF_TEST, + AD9523_STAT_VCXO, + AD9523_STAT_PLL2_FB_CLK, + AD9523_STAT_PLL2_REF_CLK, + AD9523_SYNC, + AD9523_EEPROM, +}; + +enum { + AD9523_VCO1, + AD9523_VCO2, + AD9523_VCXO, + AD9523_NUM_CLK_SRC, +}; + +struct ad9523_state { + struct spi_device *spi; + struct regulator *reg; + struct ad9523_platform_data *pdata; + struct iio_chan_spec ad9523_channels[AD9523_NUM_CHAN]; + + unsigned long vcxo_freq; + unsigned long vco_freq; + unsigned long vco_out_freq[AD9523_NUM_CLK_SRC]; + unsigned char vco_out_map[AD9523_NUM_CHAN_ALT_CLK_SRC]; + + /* + * DMA (thus cache coherency maintenance) requires the + * transfer buffers to live in their own cache lines. + */ + union { + __be32 d32; + u8 d8[4]; + } data[2] ____cacheline_aligned; +}; + +static int ad9523_read(struct iio_dev *indio_dev, unsigned addr) +{ + struct ad9523_state *st = iio_priv(indio_dev); + struct spi_message m; + int ret; + + /* We encode the register size 1..3 bytes into the register address. + * On transfer we get the size from the register datum, and make sure + * the result is properly aligned. + */ + + struct spi_transfer t[] = { + { + .tx_buf = &st->data[0].d8[2], + .len = 2, + }, { + .rx_buf = &st->data[1].d8[4 - AD9523_TRANSF_LEN(addr)], + .len = AD9523_TRANSF_LEN(addr), + }, + }; + + spi_message_init(&m); + spi_message_add_tail(&t[0], &m); + spi_message_add_tail(&t[1], &m); + + st->data[0].d32 = cpu_to_be32(AD9523_READ | + AD9523_CNT(AD9523_TRANSF_LEN(addr)) | + AD9523_ADDR(addr)); + + ret = spi_sync(st->spi, &m); + if (ret < 0) + dev_err(&indio_dev->dev, "read failed (%d)", ret); + else + ret = be32_to_cpu(st->data[1].d32) & (0xFFFFFF >> + (8 * (3 - AD9523_TRANSF_LEN(addr)))); + + return ret; +}; + +static int ad9523_write(struct iio_dev *indio_dev, unsigned addr, unsigned val) +{ + struct ad9523_state *st = iio_priv(indio_dev); + struct spi_message m; + int ret; + struct spi_transfer t[] = { + { + .tx_buf = &st->data[0].d8[2], + .len = 2, + }, { + .tx_buf = &st->data[1].d8[4 - AD9523_TRANSF_LEN(addr)], + .len = AD9523_TRANSF_LEN(addr), + }, + }; + + spi_message_init(&m); + spi_message_add_tail(&t[0], &m); + spi_message_add_tail(&t[1], &m); + + st->data[0].d32 = cpu_to_be32(AD9523_WRITE | + AD9523_CNT(AD9523_TRANSF_LEN(addr)) | + AD9523_ADDR(addr)); + st->data[1].d32 = cpu_to_be32(val); + + ret = spi_sync(st->spi, &m); + + if (ret < 0) + dev_err(&indio_dev->dev, "write failed (%d)", ret); + + return ret; +} + +static int ad9523_io_update(struct iio_dev *indio_dev) +{ + return ad9523_write(indio_dev, AD9523_IO_UPDATE, AD9523_IO_UPDATE_EN); +} + +static int ad9523_vco_out_map(struct iio_dev *indio_dev, + unsigned ch, bool out) +{ + struct ad9523_state *st = iio_priv(indio_dev); + int ret; + unsigned mask; + + switch (ch) { + case 0 ... 3: + ret = ad9523_read(indio_dev, AD9523_PLL1_OUTPUT_CHANNEL_CTRL); + if (ret < 0) + break; + mask = AD9523_PLL1_OUTP_CH_CTRL_VCXO_SRC_SEL_CH0 << ch; + if (out) { + ret |= mask; + out = 2; + } else { + ret &= ~mask; + } + ret = ad9523_write(indio_dev, + AD9523_PLL1_OUTPUT_CHANNEL_CTRL, ret); + break; + case 4 ... 6: + ret = ad9523_read(indio_dev, AD9523_PLL1_OUTPUT_CTRL); + if (ret < 0) + break; + mask = AD9523_PLL1_OUTP_CTRL_VCO_DIV_SEL_CH4_M2 << (ch - 4); + if (out) + ret |= mask; + else + ret &= ~mask; + ret = ad9523_write(indio_dev, AD9523_PLL1_OUTPUT_CTRL, ret); + break; + case 7 ... 9: + ret = ad9523_read(indio_dev, AD9523_PLL1_OUTPUT_CHANNEL_CTRL); + if (ret < 0) + break; + mask = AD9523_PLL1_OUTP_CH_CTRL_VCO_DIV_SEL_CH7_M2 << (ch - 7); + if (out) + ret |= mask; + else + ret &= ~mask; + ret = ad9523_write(indio_dev, + AD9523_PLL1_OUTPUT_CHANNEL_CTRL, ret); + break; + default: + return 0; + } + + st->vco_out_map[ch] = out; + + return ret; +} + +static int ad9523_set_clock_provider(struct iio_dev *indio_dev, + unsigned ch, unsigned long freq) +{ + struct ad9523_state *st = iio_priv(indio_dev); + long tmp1, tmp2; + bool use_alt_clk_src; + + switch (ch) { + case 0 ... 3: + use_alt_clk_src = (freq == st->vco_out_freq[AD9523_VCXO]); + break; + case 4 ... 9: + tmp1 = st->vco_out_freq[AD9523_VCO1] / freq; + tmp2 = st->vco_out_freq[AD9523_VCO2] / freq; + tmp1 *= freq; + tmp2 *= freq; + use_alt_clk_src = (abs(tmp1 - freq) > abs(tmp2 - freq)); + break; + default: + /* Ch 10..14: No action required, return success */ + return 0; + } + + return ad9523_vco_out_map(indio_dev, ch, use_alt_clk_src); +} + +static int ad9523_store_eeprom(struct iio_dev *indio_dev) +{ + int ret, tmp; + + ret = ad9523_write(indio_dev, AD9523_EEPROM_CTRL1, + AD9523_EEPROM_CTRL1_EEPROM_WRITE_PROT_DIS); + if (ret < 0) + return ret; + ret = ad9523_write(indio_dev, AD9523_EEPROM_CTRL2, + AD9523_EEPROM_CTRL2_REG2EEPROM); + if (ret < 0) + return ret; + + tmp = 4; + do { + msleep(16); + ret = ad9523_read(indio_dev, + AD9523_EEPROM_DATA_XFER_STATUS); + if (ret < 0) + return ret; + } while ((ret & AD9523_EEPROM_DATA_XFER_IN_PROGRESS) && tmp--); + + ret = ad9523_write(indio_dev, AD9523_EEPROM_CTRL1, 0); + if (ret < 0) + return ret; + + ret = ad9523_read(indio_dev, AD9523_EEPROM_ERROR_READBACK); + if (ret < 0) + return ret; + + if (ret & AD9523_EEPROM_ERROR_READBACK_FAIL) { + dev_err(&indio_dev->dev, "Verify EEPROM failed"); + ret = -EIO; + } + + return ret; +} + +static int ad9523_sync(struct iio_dev *indio_dev) +{ + int ret, tmp; + + ret = ad9523_read(indio_dev, AD9523_STATUS_SIGNALS); + if (ret < 0) + return ret; + + tmp = ret; + tmp |= AD9523_STATUS_SIGNALS_SYNC_MAN_CTRL; + + ret = ad9523_write(indio_dev, AD9523_STATUS_SIGNALS, tmp); + if (ret < 0) + return ret; + + ad9523_io_update(indio_dev); + tmp &= ~AD9523_STATUS_SIGNALS_SYNC_MAN_CTRL; + + ret = ad9523_write(indio_dev, AD9523_STATUS_SIGNALS, tmp); + if (ret < 0) + return ret; + + return ad9523_io_update(indio_dev); +} + +static ssize_t ad9523_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); + bool state; + int ret; + + ret = strtobool(buf, &state); + if (ret < 0) + return ret; + + if (!state) + return 0; + + mutex_lock(&indio_dev->mlock); + switch ((u32)this_attr->address) { + case AD9523_SYNC: + ret = ad9523_sync(indio_dev); + break; + case AD9523_EEPROM: + ret = ad9523_store_eeprom(indio_dev); + break; + default: + ret = -ENODEV; + } + mutex_unlock(&indio_dev->mlock); + + return ret ? ret : len; +} + +static ssize_t ad9523_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); + int ret; + + mutex_lock(&indio_dev->mlock); + ret = ad9523_read(indio_dev, AD9523_READBACK_0); + if (ret >= 0) { + ret = sprintf(buf, "%d\n", !!(ret & (1 << + (u32)this_attr->address))); + } + mutex_unlock(&indio_dev->mlock); + + return ret; +} + +static IIO_DEVICE_ATTR(pll1_locked, S_IRUGO, + ad9523_show, + NULL, + AD9523_STAT_PLL1_LD); + +static IIO_DEVICE_ATTR(pll2_locked, S_IRUGO, + ad9523_show, + NULL, + AD9523_STAT_PLL2_LD); + +static IIO_DEVICE_ATTR(pll1_reference_clk_a_present, S_IRUGO, + ad9523_show, + NULL, + AD9523_STAT_REFA); + +static IIO_DEVICE_ATTR(pll1_reference_clk_b_present, S_IRUGO, + ad9523_show, + NULL, + AD9523_STAT_REFB); + +static IIO_DEVICE_ATTR(pll1_reference_clk_test_present, S_IRUGO, + ad9523_show, + NULL, + AD9523_STAT_REF_TEST); + +static IIO_DEVICE_ATTR(vcxo_clk_present, S_IRUGO, + ad9523_show, + NULL, + AD9523_STAT_VCXO); + +static IIO_DEVICE_ATTR(pll2_feedback_clk_present, S_IRUGO, + ad9523_show, + NULL, + AD9523_STAT_PLL2_FB_CLK); + +static IIO_DEVICE_ATTR(pll2_reference_clk_present, S_IRUGO, + ad9523_show, + NULL, + AD9523_STAT_PLL2_REF_CLK); + +static IIO_DEVICE_ATTR(sync_dividers, S_IWUSR, + NULL, + ad9523_store, + AD9523_SYNC); + +static IIO_DEVICE_ATTR(store_eeprom, S_IWUSR, + NULL, + ad9523_store, + AD9523_EEPROM); + +static struct attribute *ad9523_attributes[] = { + &iio_dev_attr_sync_dividers.dev_attr.attr, + &iio_dev_attr_store_eeprom.dev_attr.attr, + &iio_dev_attr_pll2_feedback_clk_present.dev_attr.attr, + &iio_dev_attr_pll2_reference_clk_present.dev_attr.attr, + &iio_dev_attr_pll1_reference_clk_a_present.dev_attr.attr, + &iio_dev_attr_pll1_reference_clk_b_present.dev_attr.attr, + &iio_dev_attr_pll1_reference_clk_test_present.dev_attr.attr, + &iio_dev_attr_vcxo_clk_present.dev_attr.attr, + &iio_dev_attr_pll1_locked.dev_attr.attr, + &iio_dev_attr_pll2_locked.dev_attr.attr, + NULL, +}; + +static const struct attribute_group ad9523_attribute_group = { + .attrs = ad9523_attributes, +}; + +static int ad9523_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, + int *val2, + long m) +{ + struct ad9523_state *st = iio_priv(indio_dev); + unsigned code; + int ret; + + mutex_lock(&indio_dev->mlock); + ret = ad9523_read(indio_dev, AD9523_CHANNEL_CLOCK_DIST(chan->channel)); + mutex_unlock(&indio_dev->mlock); + + if (ret < 0) + return ret; + + switch (m) { + case IIO_CHAN_INFO_RAW: + *val = !(ret & AD9523_CLK_DIST_PWR_DOWN_EN); + return IIO_VAL_INT; + case IIO_CHAN_INFO_FREQUENCY: + *val = st->vco_out_freq[st->vco_out_map[chan->channel]] / + AD9523_CLK_DIST_DIV_REV(ret); + return IIO_VAL_INT; + case IIO_CHAN_INFO_PHASE: + code = (AD9523_CLK_DIST_DIV_PHASE_REV(ret) * 3141592) / + AD9523_CLK_DIST_DIV_REV(ret); + *val = code / 1000000; + *val2 = (code % 1000000) * 10; + return IIO_VAL_INT_PLUS_MICRO; + default: + return -EINVAL; + } +}; + +static int ad9523_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int val, + int val2, + long mask) +{ + struct ad9523_state *st = iio_priv(indio_dev); + unsigned reg; + int ret, tmp, code; + + mutex_lock(&indio_dev->mlock); + ret = ad9523_read(indio_dev, AD9523_CHANNEL_CLOCK_DIST(chan->channel)); + if (ret < 0) + goto out; + + reg = ret; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + if (val) + reg &= ~AD9523_CLK_DIST_PWR_DOWN_EN; + else + reg |= AD9523_CLK_DIST_PWR_DOWN_EN; + break; + case IIO_CHAN_INFO_FREQUENCY: + if (val <= 0) { + ret = -EINVAL; + goto out; + } + ret = ad9523_set_clock_provider(indio_dev, chan->channel, val); + if (ret < 0) + goto out; + tmp = st->vco_out_freq[st->vco_out_map[chan->channel]] / val; + tmp = clamp(tmp, 1, 1024); + reg &= ~(0x3FF << 8); + reg |= AD9523_CLK_DIST_DIV(tmp); + break; + case IIO_CHAN_INFO_PHASE: + code = val * 1000000 + val2 % 1000000; + tmp = (code * AD9523_CLK_DIST_DIV_REV(ret)) / 3141592; + tmp = clamp(tmp, 0, 63); + reg &= ~AD9523_CLK_DIST_DIV_PHASE(~0); + reg |= AD9523_CLK_DIST_DIV_PHASE(tmp); + break; + default: + ret = -EINVAL; + goto out; + } + + ret = ad9523_write(indio_dev, AD9523_CHANNEL_CLOCK_DIST(chan->channel), + reg); + if (ret < 0) + goto out; + + ad9523_io_update(indio_dev); +out: + mutex_unlock(&indio_dev->mlock); + return ret; +} + +static int ad9523_reg_access(struct iio_dev *indio_dev, + unsigned reg, unsigned writeval, + unsigned *readval) +{ + int ret; + + mutex_lock(&indio_dev->mlock); + if (readval == NULL) { + ret = ad9523_write(indio_dev, reg | AD9523_R1B, writeval); + ad9523_io_update(indio_dev); + } else { + ret = ad9523_read(indio_dev, reg | AD9523_R1B); + if (ret < 0) + return ret; + *readval = ret; + ret = 0; + } + mutex_unlock(&indio_dev->mlock); + + return ret; +} + +static const struct iio_info ad9523_info = { + .read_raw = &ad9523_read_raw, + .write_raw = &ad9523_write_raw, + .debugfs_reg_access = &ad9523_reg_access, + .attrs = &ad9523_attribute_group, + .driver_module = THIS_MODULE, +}; + +static int ad9523_setup(struct iio_dev *indio_dev) +{ + struct ad9523_state *st = iio_priv(indio_dev); + struct ad9523_platform_data *pdata = st->pdata; + struct ad9523_channel_spec *chan; + unsigned long active_mask = 0; + int ret, i; + + ret = ad9523_write(indio_dev, AD9523_SERIAL_PORT_CONFIG, + AD9523_SER_CONF_SOFT_RESET | + (st->spi->mode & SPI_3WIRE ? 0 : + AD9523_SER_CONF_SDO_ACTIVE)); + if (ret < 0) + return ret; + + ret = ad9523_write(indio_dev, AD9523_READBACK_CTRL, + AD9523_READBACK_CTRL_READ_BUFFERED); + if (ret < 0) + return ret; + + ret = ad9523_io_update(indio_dev); + if (ret < 0) + return ret; + + /* + * PLL1 Setup + */ + ret = ad9523_write(indio_dev, AD9523_PLL1_REF_A_DIVIDER, + pdata->refa_r_div); + if (ret < 0) + return ret; + + ret = ad9523_write(indio_dev, AD9523_PLL1_REF_B_DIVIDER, + pdata->refb_r_div); + if (ret < 0) + return ret; + + ret = ad9523_write(indio_dev, AD9523_PLL1_FEEDBACK_DIVIDER, + pdata->pll1_feedback_div); + if (ret < 0) + return ret; + + ret = ad9523_write(indio_dev, AD9523_PLL1_CHARGE_PUMP_CTRL, + AD9523_PLL1_CHARGE_PUMP_CURRENT_nA(pdata-> + pll1_charge_pump_current_nA) | + AD9523_PLL1_CHARGE_PUMP_MODE_NORMAL | + AD9523_PLL1_BACKLASH_PW_MIN); + if (ret < 0) + return ret; + + ret = ad9523_write(indio_dev, AD9523_PLL1_INPUT_RECEIVERS_CTRL, + AD_IF(refa_diff_rcv_en, AD9523_PLL1_REFA_RCV_EN) | + AD_IF(refb_diff_rcv_en, AD9523_PLL1_REFB_RCV_EN) | + AD_IF(osc_in_diff_en, AD9523_PLL1_OSC_IN_DIFF_EN) | + AD_IF(osc_in_cmos_neg_inp_en, + AD9523_PLL1_OSC_IN_CMOS_NEG_INP_EN) | + AD_IF(refa_diff_rcv_en, AD9523_PLL1_REFA_DIFF_RCV_EN) | + AD_IF(refb_diff_rcv_en, AD9523_PLL1_REFB_DIFF_RCV_EN)); + if (ret < 0) + return ret; + + ret = ad9523_write(indio_dev, AD9523_PLL1_REF_CTRL, + AD_IF(zd_in_diff_en, AD9523_PLL1_ZD_IN_DIFF_EN) | + AD_IF(zd_in_cmos_neg_inp_en, + AD9523_PLL1_ZD_IN_CMOS_NEG_INP_EN) | + AD_IF(zero_delay_mode_internal_en, + AD9523_PLL1_ZERO_DELAY_MODE_INT) | + AD_IF(osc_in_feedback_en, AD9523_PLL1_OSC_IN_PLL_FEEDBACK_EN) | + AD_IF(refa_cmos_neg_inp_en, AD9523_PLL1_REFA_CMOS_NEG_INP_EN) | + AD_IF(refb_cmos_neg_inp_en, AD9523_PLL1_REFB_CMOS_NEG_INP_EN)); + if (ret < 0) + return ret; + + ret = ad9523_write(indio_dev, AD9523_PLL1_MISC_CTRL, + AD9523_PLL1_REFB_INDEP_DIV_CTRL_EN | + AD9523_PLL1_REF_MODE(pdata->ref_mode)); + if (ret < 0) + return ret; + + ret = ad9523_write(indio_dev, AD9523_PLL1_LOOP_FILTER_CTRL, + AD9523_PLL1_LOOP_FILTER_RZERO(pdata->pll1_loop_filter_rzero)); + if (ret < 0) + return ret; + /* + * PLL2 Setup + */ + + ret = ad9523_write(indio_dev, AD9523_PLL2_CHARGE_PUMP, + AD9523_PLL2_CHARGE_PUMP_CURRENT_nA(pdata-> + pll2_charge_pump_current_nA)); + if (ret < 0) + return ret; + + ret = ad9523_write(indio_dev, AD9523_PLL2_FEEDBACK_DIVIDER_AB, + AD9523_PLL2_FB_NDIV_A_CNT(pdata->pll2_ndiv_a_cnt) | + AD9523_PLL2_FB_NDIV_B_CNT(pdata->pll2_ndiv_b_cnt)); + if (ret < 0) + return ret; + + ret = ad9523_write(indio_dev, AD9523_PLL2_CTRL, + AD9523_PLL2_CHARGE_PUMP_MODE_NORMAL | + AD9523_PLL2_BACKLASH_CTRL_EN | + AD_IF(pll2_freq_doubler_en, AD9523_PLL2_FREQ_DOUBLER_EN)); + if (ret < 0) + return ret; + + st->vco_freq = (pdata->vcxo_freq * (pdata->pll2_freq_doubler_en ? 2 : 1) + / pdata->pll2_r2_div) * AD9523_PLL2_FB_NDIV(pdata-> + pll2_ndiv_a_cnt, pdata->pll2_ndiv_b_cnt); + + ret = ad9523_write(indio_dev, AD9523_PLL2_VCO_CTRL, + AD9523_PLL2_VCO_CALIBRATE); + if (ret < 0) + return ret; + + ret = ad9523_write(indio_dev, AD9523_PLL2_VCO_DIVIDER, + AD9523_PLL2_VCO_DIV_M1(pdata->pll2_vco_diff_m1) | + AD9523_PLL2_VCO_DIV_M2(pdata->pll2_vco_diff_m2) | + AD_IFE(pll2_vco_diff_m1, 0, + AD9523_PLL2_VCO_DIV_M1_PWR_DOWN_EN) | + AD_IFE(pll2_vco_diff_m2, 0, + AD9523_PLL2_VCO_DIV_M2_PWR_DOWN_EN)); + if (ret < 0) + return ret; + + if (pdata->pll2_vco_diff_m1) + st->vco_out_freq[AD9523_VCO1] = + st->vco_freq / pdata->pll2_vco_diff_m1; + + if (pdata->pll2_vco_diff_m2) + st->vco_out_freq[AD9523_VCO2] = + st->vco_freq / pdata->pll2_vco_diff_m2; + + st->vco_out_freq[AD9523_VCXO] = pdata->vcxo_freq; + + ret = ad9523_write(indio_dev, AD9523_PLL2_R2_DIVIDER, + AD9523_PLL2_R2_DIVIDER_VAL(pdata->pll2_r2_div)); + if (ret < 0) + return ret; + + ret = ad9523_write(indio_dev, AD9523_PLL2_LOOP_FILTER_CTRL, + AD9523_PLL2_LOOP_FILTER_CPOLE1(pdata->cpole1) | + AD9523_PLL2_LOOP_FILTER_RZERO(pdata->rzero) | + AD9523_PLL2_LOOP_FILTER_RPOLE2(pdata->rpole2) | + AD_IF(rzero_bypass_en, + AD9523_PLL2_LOOP_FILTER_RZERO_BYPASS_EN)); + if (ret < 0) + return ret; + + for (i = 0; i < pdata->num_channels; i++) { + chan = &pdata->channels[i]; + if (chan->channel_num < AD9523_NUM_CHAN) { + __set_bit(chan->channel_num, &active_mask); + ret = ad9523_write(indio_dev, + AD9523_CHANNEL_CLOCK_DIST(chan->channel_num), + AD9523_CLK_DIST_DRIVER_MODE(chan->driver_mode) | + AD9523_CLK_DIST_DIV(chan->channel_divider) | + AD9523_CLK_DIST_DIV_PHASE(chan->divider_phase) | + (chan->sync_ignore_en ? + AD9523_CLK_DIST_IGNORE_SYNC_EN : 0) | + (chan->divider_output_invert_en ? + AD9523_CLK_DIST_INV_DIV_OUTPUT_EN : 0) | + (chan->low_power_mode_en ? + AD9523_CLK_DIST_LOW_PWR_MODE_EN : 0) | + (chan->output_dis ? + AD9523_CLK_DIST_PWR_DOWN_EN : 0)); + if (ret < 0) + return ret; + + ret = ad9523_vco_out_map(indio_dev, chan->channel_num, + chan->use_alt_clock_src); + if (ret < 0) + return ret; + + st->ad9523_channels[i].type = IIO_ALTVOLTAGE; + st->ad9523_channels[i].output = 1; + st->ad9523_channels[i].indexed = 1; + st->ad9523_channels[i].channel = chan->channel_num; + st->ad9523_channels[i].extend_name = + chan->extended_name; + st->ad9523_channels[i].info_mask = + IIO_CHAN_INFO_RAW_SEPARATE_BIT | + IIO_CHAN_INFO_PHASE_SEPARATE_BIT | + IIO_CHAN_INFO_FREQUENCY_SEPARATE_BIT; + } + } + + for_each_clear_bit(i, &active_mask, AD9523_NUM_CHAN) + ad9523_write(indio_dev, + AD9523_CHANNEL_CLOCK_DIST(i), + AD9523_CLK_DIST_DRIVER_MODE(TRISTATE) | + AD9523_CLK_DIST_PWR_DOWN_EN); + + ret = ad9523_write(indio_dev, AD9523_POWER_DOWN_CTRL, 0); + if (ret < 0) + return ret; + + ret = ad9523_write(indio_dev, AD9523_STATUS_SIGNALS, + AD9523_STATUS_MONITOR_01_PLL12_LOCKED); + if (ret < 0) + return ret; + + ret = ad9523_io_update(indio_dev); + if (ret < 0) + return ret; + + return 0; +} + +static int __devinit ad9523_probe(struct spi_device *spi) +{ + struct ad9523_platform_data *pdata = spi->dev.platform_data; + struct iio_dev *indio_dev; + struct ad9523_state *st; + int ret; + + if (!pdata) { + dev_err(&spi->dev, "no platform data?\n"); + return -EINVAL; + } + + indio_dev = iio_device_alloc(sizeof(*st)); + if (indio_dev == NULL) + return -ENOMEM; + + st = iio_priv(indio_dev); + + st->reg = regulator_get(&spi->dev, "vcc"); + if (!IS_ERR(st->reg)) { + ret = regulator_enable(st->reg); + if (ret) + goto error_put_reg; + } + + spi_set_drvdata(spi, indio_dev); + st->spi = spi; + st->pdata = pdata; + + indio_dev->dev.parent = &spi->dev; + indio_dev->name = (pdata->name[0] != 0) ? pdata->name : + spi_get_device_id(spi)->name; + indio_dev->info = &ad9523_info; + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->channels = st->ad9523_channels; + indio_dev->num_channels = pdata->num_channels; + + ret = ad9523_setup(indio_dev); + if (ret < 0) + goto error_disable_reg; + + ret = iio_device_register(indio_dev); + if (ret) + goto error_disable_reg; + + dev_info(&spi->dev, "probed %s\n", indio_dev->name); + + return 0; + +error_disable_reg: + if (!IS_ERR(st->reg)) + regulator_disable(st->reg); +error_put_reg: + if (!IS_ERR(st->reg)) + regulator_put(st->reg); + + iio_device_free(indio_dev); + + return ret; +} + +static int __devexit ad9523_remove(struct spi_device *spi) +{ + struct iio_dev *indio_dev = spi_get_drvdata(spi); + struct ad9523_state *st = iio_priv(indio_dev); + + iio_device_unregister(indio_dev); + + if (!IS_ERR(st->reg)) { + regulator_disable(st->reg); + regulator_put(st->reg); + } + + iio_device_free(indio_dev); + + return 0; +} + +static const struct spi_device_id ad9523_id[] = { + {"ad9523-1", 9523}, + {} +}; +MODULE_DEVICE_TABLE(spi, ad9523_id); + +static struct spi_driver ad9523_driver = { + .driver = { + .name = "ad9523", + .owner = THIS_MODULE, + }, + .probe = ad9523_probe, + .remove = __devexit_p(ad9523_remove), + .id_table = ad9523_id, +}; +module_spi_driver(ad9523_driver); + +MODULE_AUTHOR("Michael Hennerich "); +MODULE_DESCRIPTION("Analog Devices AD9523 CLOCKDIST/PLL"); +MODULE_LICENSE("GPL v2"); diff --git a/include/linux/iio/frequency/ad9523.h b/include/linux/iio/frequency/ad9523.h new file mode 100644 index 0000000..12ce3ee --- /dev/null +++ b/include/linux/iio/frequency/ad9523.h @@ -0,0 +1,195 @@ +/* + * AD9523 SPI Low Jitter Clock Generator + * + * Copyright 2012 Analog Devices Inc. + * + * Licensed under the GPL-2. + */ + +#ifndef IIO_FREQUENCY_AD9523_H_ +#define IIO_FREQUENCY_AD9523_H_ + +enum outp_drv_mode { + TRISTATE, + LVPECL_8mA, + LVDS_4mA, + LVDS_7mA, + HSTL0_16mA, + HSTL1_8mA, + CMOS_CONF1, + CMOS_CONF2, + CMOS_CONF3, + CMOS_CONF4, + CMOS_CONF5, + CMOS_CONF6, + CMOS_CONF7, + CMOS_CONF8, + CMOS_CONF9 +}; + +enum ref_sel_mode { + NONEREVERTIVE_STAY_ON_REFB, + REVERT_TO_REFA, + SELECT_REFA, + SELECT_REFB, + EXT_REF_SEL +}; + +/** + * struct ad9523_channel_spec - Output channel configuration + * + * @channel_num: Output channel number. + * @divider_output_invert_en: Invert the polarity of the output clock. + * @sync_ignore_en: Ignore chip-level SYNC signal. + * @low_power_mode_en: Reduce power used in the differential output modes. + * @use_alt_clock_src: Channel divider uses alternative clk source. + * @output_dis: Disables, powers down the entire channel. + * @driver_mode: Output driver mode (logic level family). + * @divider_phase: Divider initial phase after a SYNC. Range 0..63 + LSB = 1/2 of a period of the divider input clock. + * @channel_divider: 10-bit channel divider. + * @extended_name: Optional descriptive channel name. + */ + +struct ad9523_channel_spec { + unsigned channel_num; + bool divider_output_invert_en; + bool sync_ignore_en; + bool low_power_mode_en; + /* CH0..CH3 VCXO, CH4..CH9 VCO2 */ + bool use_alt_clock_src; + bool output_dis; + enum outp_drv_mode driver_mode; + unsigned char divider_phase; + unsigned short channel_divider; + char extended_name[16]; +}; + +enum pll1_rzero_resistor { + RZERO_883_OHM, + RZERO_677_OHM, + RZERO_341_OHM, + RZERO_135_OHM, + RZERO_10_OHM, + RZERO_USE_EXT_RES = 8, +}; + +enum rpole2_resistor { + RPOLE2_900_OHM, + RPOLE2_450_OHM, + RPOLE2_300_OHM, + RPOLE2_225_OHM, +}; + +enum rzero_resistor { + RZERO_3250_OHM, + RZERO_2750_OHM, + RZERO_2250_OHM, + RZERO_2100_OHM, + RZERO_3000_OHM, + RZERO_2500_OHM, + RZERO_2000_OHM, + RZERO_1850_OHM, +}; + +enum cpole1_capacitor { + CPOLE1_0_PF, + CPOLE1_8_PF, + CPOLE1_16_PF, + CPOLE1_24_PF, + _CPOLE1_24_PF, /* place holder */ + CPOLE1_32_PF, + CPOLE1_40_PF, + CPOLE1_48_PF, +}; + +/** + * struct ad9523_platform_data - platform specific information + * + * @vcxo_freq: External VCXO frequency in Hz + * @refa_diff_rcv_en: REFA differential/single-ended input selection. + * @refb_diff_rcv_en: REFB differential/single-ended input selection. + * @zd_in_diff_en: Zero Delay differential/single-ended input selection. + * @osc_in_diff_en: OSC differential/ single-ended input selection. + * @refa_cmos_neg_inp_en: REFA single-ended neg./pos. input enable. + * @refb_cmos_neg_inp_en: REFB single-ended neg./pos. input enable. + * @zd_in_cmos_neg_inp_en: Zero Delay single-ended neg./pos. input enable. + * @osc_in_cmos_neg_inp_en: OSC single-ended neg./pos. input enable. + * @refa_r_div: PLL1 10-bit REFA R divider. + * @refb_r_div: PLL1 10-bit REFB R divider. + * @pll1_feedback_div: PLL1 10-bit Feedback N divider. + * @pll1_charge_pump_current_nA: Magnitude of PLL1 charge pump current (nA). + * @zero_delay_mode_internal_en: Internal, external Zero Delay mode selection. + * @osc_in_feedback_en: PLL1 feedback path, local feedback from + * the OSC_IN receiver or zero delay mode + * @pll1_loop_filter_rzero: PLL1 Loop Filter Zero Resistor selection. + * @ref_mode: Reference selection mode. + * @pll2_charge_pump_current_nA: Magnitude of PLL2 charge pump current (nA). + * @pll2_ndiv_a_cnt: PLL2 Feedback N-divider, A Counter, range 0..4. + * @pll2_ndiv_b_cnt: PLL2 Feedback N-divider, B Counter, range 0..63. + * @pll2_freq_doubler_en: PLL2 frequency doubler enable. + * @pll2_r2_div: PLL2 R2 divider, range 0..31. + * @pll2_vco_diff_m1: VCO1 divider, range 3..5. + * @pll2_vco_diff_m2: VCO2 divider, range 3..5. + * @rpole2: PLL2 loop filter Rpole resistor value. + * @rzero: PLL2 loop filter Rzero resistor value. + * @cpole1: PLL2 loop filter Cpole capacitor value. + * @rzero_bypass_en: PLL2 loop filter Rzero bypass enable. + * @num_channels: Array size of struct ad9523_channel_spec. + * @channels: Pointer to channel array. + * @name: Optional alternative iio device name. + */ + +struct ad9523_platform_data { + unsigned long vcxo_freq; + + /* Differential/ Single-Ended Input Configuration */ + bool refa_diff_rcv_en; + bool refb_diff_rcv_en; + bool zd_in_diff_en; + bool osc_in_diff_en; + + /* + * Valid if differential input disabled + * if false defaults to pos input + */ + bool refa_cmos_neg_inp_en; + bool refb_cmos_neg_inp_en; + bool zd_in_cmos_neg_inp_en; + bool osc_in_cmos_neg_inp_en; + + /* PLL1 Setting */ + unsigned short refa_r_div; + unsigned short refb_r_div; + unsigned short pll1_feedback_div; + unsigned short pll1_charge_pump_current_nA; + bool zero_delay_mode_internal_en; + bool osc_in_feedback_en; + enum pll1_rzero_resistor pll1_loop_filter_rzero; + + /* Reference */ + enum ref_sel_mode ref_mode; + + /* PLL2 Setting */ + unsigned int pll2_charge_pump_current_nA; + unsigned char pll2_ndiv_a_cnt; + unsigned char pll2_ndiv_b_cnt; + bool pll2_freq_doubler_en; + unsigned char pll2_r2_div; + unsigned char pll2_vco_diff_m1; /* 3..5 */ + unsigned char pll2_vco_diff_m2; /* 3..5 */ + + /* Loop Filter PLL2 */ + enum rpole2_resistor rpole2; + enum rzero_resistor rzero; + enum cpole1_capacitor cpole1; + bool rzero_bypass_en; + + /* Output Channel Configuration */ + int num_channels; + struct ad9523_channel_spec *channels; + + char name[SPI_NAME_SIZE]; +}; + +#endif /* IIO_FREQUENCY_AD9523_H_ */ -- cgit v0.10.2 From e31166f0fd48478866ee9661c36789126435ebe8 Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Tue, 29 May 2012 12:41:20 +0200 Subject: iio: frequency: New driver for Analog Devices ADF4350/ADF4351 Wideband Synthesizers Changes since V1: Apply Jonathan's review feedback: Introduce and use IIO_ALTVOLTAGE. Fix up comments and documentation. Remove dead code. Reorder some code fragments. Add missing iio_device_free. Convert to new API. Fix-up out of staging includes. Removed pll_locked attribute. Changes since V2: Use module_spi_driver. adf4350_remove: move gpio_free after regulator. target patch to drivers/iio Signed-off-by: Michael Hennerich Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/Documentation/ABI/testing/sysfs-bus-iio-frequency-adf4350 b/Documentation/ABI/testing/sysfs-bus-iio-frequency-adf4350 new file mode 100644 index 0000000..d89aded --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-iio-frequency-adf4350 @@ -0,0 +1,21 @@ +What: /sys/bus/iio/devices/iio:deviceX/out_altvoltageY_frequency_resolution +KernelVersion: 3.4.0 +Contact: linux-iio@vger.kernel.org +Description: + Stores channel Y frequency resolution/channel spacing in Hz. + The value given directly influences the MODULUS used by + the fractional-N PLL. It is assumed that the algorithm + that is used to compute the various dividers, is able to + generate proper values for multiples of channel spacing. + +What: /sys/bus/iio/devices/iio:deviceX/out_altvoltageY_refin_frequency +KernelVersion: 3.4.0 +Contact: linux-iio@vger.kernel.org +Description: + Sets channel Y REFin frequency in Hz. In some clock chained + applications, the reference frequency used by the PLL may + change during runtime. This attribute allows the user to + adjust the reference frequency accordingly. + The value written has no effect until out_altvoltageY_frequency + is updated. Consider to use out_altvoltageY_powerdown to power + down the PLL and it's RFOut buffers during REFin changes. diff --git a/drivers/iio/frequency/Kconfig b/drivers/iio/frequency/Kconfig index 0458c92..6aaa33e 100644 --- a/drivers/iio/frequency/Kconfig +++ b/drivers/iio/frequency/Kconfig @@ -20,4 +20,22 @@ config AD9523 module will be called ad9523. endmenu + +# +# Phase-Locked Loop (PLL) frequency synthesizers +# + +menu "Phase-Locked Loop (PLL) frequency synthesizers" + +config ADF4350 + tristate "Analog Devices ADF4350/ADF4351 Wideband Synthesizers" + depends on SPI + help + Say yes here to build support for Analog Devices ADF4350/ADF4351 + Wideband Synthesizers. The driver provides direct access via sysfs. + + To compile this driver as a module, choose M here: the + module will be called adf4350. + +endmenu endmenu diff --git a/drivers/iio/frequency/Makefile b/drivers/iio/frequency/Makefile index 1b5b224..00d26e5 100644 --- a/drivers/iio/frequency/Makefile +++ b/drivers/iio/frequency/Makefile @@ -3,3 +3,4 @@ # obj-$(CONFIG_AD9523) += ad9523.o +obj-$(CONFIG_ADF4350) += adf4350.o diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c new file mode 100644 index 0000000..fd4c850 --- /dev/null +++ b/drivers/iio/frequency/adf4350.c @@ -0,0 +1,478 @@ +/* + * ADF4350/ADF4351 SPI Wideband Synthesizer driver + * + * Copyright 2012 Analog Devices Inc. + * + * Licensed under the GPL-2. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +enum { + ADF4350_FREQ, + ADF4350_FREQ_REFIN, + ADF4350_FREQ_RESOLUTION, + ADF4350_PWRDOWN, +}; + +struct adf4350_state { + struct spi_device *spi; + struct regulator *reg; + struct adf4350_platform_data *pdata; + unsigned long clkin; + unsigned long chspc; /* Channel Spacing */ + unsigned long fpfd; /* Phase Frequency Detector */ + unsigned long min_out_freq; + unsigned r0_fract; + unsigned r0_int; + unsigned r1_mod; + unsigned r4_rf_div_sel; + unsigned long regs[6]; + unsigned long regs_hw[6]; + + /* + * DMA (thus cache coherency maintenance) requires the + * transfer buffers to live in their own cache lines. + */ + __be32 val ____cacheline_aligned; +}; + +static struct adf4350_platform_data default_pdata = { + .clkin = 122880000, + .channel_spacing = 10000, + .r2_user_settings = ADF4350_REG2_PD_POLARITY_POS, + ADF4350_REG2_CHARGE_PUMP_CURR_uA(2500), + .r3_user_settings = ADF4350_REG3_12BIT_CLKDIV_MODE(0), + .r4_user_settings = ADF4350_REG4_OUTPUT_PWR(3) | + ADF4350_REG4_MUTE_TILL_LOCK_EN, + .gpio_lock_detect = -1, +}; + +static int adf4350_sync_config(struct adf4350_state *st) +{ + int ret, i, doublebuf = 0; + + for (i = ADF4350_REG5; i >= ADF4350_REG0; i--) { + if ((st->regs_hw[i] != st->regs[i]) || + ((i == ADF4350_REG0) && doublebuf)) { + + switch (i) { + case ADF4350_REG1: + case ADF4350_REG4: + doublebuf = 1; + break; + } + + st->val = cpu_to_be32(st->regs[i] | i); + ret = spi_write(st->spi, &st->val, 4); + if (ret < 0) + return ret; + st->regs_hw[i] = st->regs[i]; + dev_dbg(&st->spi->dev, "[%d] 0x%X\n", + i, (u32)st->regs[i] | i); + } + } + return 0; +} + +static int adf4350_reg_access(struct iio_dev *indio_dev, + unsigned reg, unsigned writeval, + unsigned *readval) +{ + struct adf4350_state *st = iio_priv(indio_dev); + int ret; + + if (reg > ADF4350_REG5) + return -EINVAL; + + mutex_lock(&indio_dev->mlock); + if (readval == NULL) { + st->regs[reg] = writeval & ~(BIT(0) | BIT(1) | BIT(2)); + ret = adf4350_sync_config(st); + } else { + *readval = st->regs_hw[reg]; + ret = 0; + } + mutex_unlock(&indio_dev->mlock); + + return ret; +} + +static int adf4350_tune_r_cnt(struct adf4350_state *st, unsigned short r_cnt) +{ + struct adf4350_platform_data *pdata = st->pdata; + + do { + r_cnt++; + st->fpfd = (st->clkin * (pdata->ref_doubler_en ? 2 : 1)) / + (r_cnt * (pdata->ref_div2_en ? 2 : 1)); + } while (st->fpfd > ADF4350_MAX_FREQ_PFD); + + return r_cnt; +} + +static int adf4350_set_freq(struct adf4350_state *st, unsigned long long freq) +{ + struct adf4350_platform_data *pdata = st->pdata; + u64 tmp; + u32 div_gcd, prescaler; + u16 mdiv, r_cnt = 0; + u8 band_sel_div; + + if (freq > ADF4350_MAX_OUT_FREQ || freq < st->min_out_freq) + return -EINVAL; + + if (freq > ADF4350_MAX_FREQ_45_PRESC) { + prescaler = ADF4350_REG1_PRESCALER; + mdiv = 75; + } else { + prescaler = 0; + mdiv = 23; + } + + st->r4_rf_div_sel = 0; + + while (freq < ADF4350_MIN_VCO_FREQ) { + freq <<= 1; + st->r4_rf_div_sel++; + } + + /* + * Allow a predefined reference division factor + * if not set, compute our own + */ + if (pdata->ref_div_factor) + r_cnt = pdata->ref_div_factor - 1; + + do { + r_cnt = adf4350_tune_r_cnt(st, r_cnt); + + st->r1_mod = st->fpfd / st->chspc; + while (st->r1_mod > ADF4350_MAX_MODULUS) { + r_cnt = adf4350_tune_r_cnt(st, r_cnt); + st->r1_mod = st->fpfd / st->chspc; + } + + tmp = freq * (u64)st->r1_mod + (st->fpfd > 1); + do_div(tmp, st->fpfd); /* Div round closest (n + d/2)/d */ + st->r0_fract = do_div(tmp, st->r1_mod); + st->r0_int = tmp; + } while (mdiv > st->r0_int); + + band_sel_div = DIV_ROUND_UP(st->fpfd, ADF4350_MAX_BANDSEL_CLK); + + if (st->r0_fract && st->r1_mod) { + div_gcd = gcd(st->r1_mod, st->r0_fract); + st->r1_mod /= div_gcd; + st->r0_fract /= div_gcd; + } else { + st->r0_fract = 0; + st->r1_mod = 1; + } + + dev_dbg(&st->spi->dev, "VCO: %llu Hz, PFD %lu Hz\n" + "REF_DIV %d, R0_INT %d, R0_FRACT %d\n" + "R1_MOD %d, RF_DIV %d\nPRESCALER %s, BAND_SEL_DIV %d\n", + freq, st->fpfd, r_cnt, st->r0_int, st->r0_fract, st->r1_mod, + 1 << st->r4_rf_div_sel, prescaler ? "8/9" : "4/5", + band_sel_div); + + st->regs[ADF4350_REG0] = ADF4350_REG0_INT(st->r0_int) | + ADF4350_REG0_FRACT(st->r0_fract); + + st->regs[ADF4350_REG1] = ADF4350_REG1_PHASE(0) | + ADF4350_REG1_MOD(st->r1_mod) | + prescaler; + + st->regs[ADF4350_REG2] = + ADF4350_REG2_10BIT_R_CNT(r_cnt) | + ADF4350_REG2_DOUBLE_BUFF_EN | + (pdata->ref_doubler_en ? ADF4350_REG2_RMULT2_EN : 0) | + (pdata->ref_div2_en ? ADF4350_REG2_RDIV2_EN : 0) | + (pdata->r2_user_settings & (ADF4350_REG2_PD_POLARITY_POS | + ADF4350_REG2_LDP_6ns | ADF4350_REG2_LDF_INT_N | + ADF4350_REG2_CHARGE_PUMP_CURR_uA(5000) | + ADF4350_REG2_MUXOUT(0x7) | ADF4350_REG2_NOISE_MODE(0x9))); + + st->regs[ADF4350_REG3] = pdata->r3_user_settings & + (ADF4350_REG3_12BIT_CLKDIV(0xFFF) | + ADF4350_REG3_12BIT_CLKDIV_MODE(0x3) | + ADF4350_REG3_12BIT_CSR_EN | + ADF4351_REG3_CHARGE_CANCELLATION_EN | + ADF4351_REG3_ANTI_BACKLASH_3ns_EN | + ADF4351_REG3_BAND_SEL_CLOCK_MODE_HIGH); + + st->regs[ADF4350_REG4] = + ADF4350_REG4_FEEDBACK_FUND | + ADF4350_REG4_RF_DIV_SEL(st->r4_rf_div_sel) | + ADF4350_REG4_8BIT_BAND_SEL_CLKDIV(band_sel_div) | + ADF4350_REG4_RF_OUT_EN | + (pdata->r4_user_settings & + (ADF4350_REG4_OUTPUT_PWR(0x3) | + ADF4350_REG4_AUX_OUTPUT_PWR(0x3) | + ADF4350_REG4_AUX_OUTPUT_EN | + ADF4350_REG4_AUX_OUTPUT_FUND | + ADF4350_REG4_MUTE_TILL_LOCK_EN)); + + st->regs[ADF4350_REG5] = ADF4350_REG5_LD_PIN_MODE_DIGITAL; + + return adf4350_sync_config(st); +} + +static ssize_t adf4350_write(struct iio_dev *indio_dev, + uintptr_t private, + const struct iio_chan_spec *chan, + const char *buf, size_t len) +{ + struct adf4350_state *st = iio_priv(indio_dev); + unsigned long long readin; + int ret; + + ret = kstrtoull(buf, 10, &readin); + if (ret) + return ret; + + mutex_lock(&indio_dev->mlock); + switch ((u32)private) { + case ADF4350_FREQ: + ret = adf4350_set_freq(st, readin); + break; + case ADF4350_FREQ_REFIN: + if (readin > ADF4350_MAX_FREQ_REFIN) + ret = -EINVAL; + else + st->clkin = readin; + break; + case ADF4350_FREQ_RESOLUTION: + if (readin == 0) + ret = -EINVAL; + else + st->chspc = readin; + break; + case ADF4350_PWRDOWN: + if (readin) + st->regs[ADF4350_REG2] |= ADF4350_REG2_POWER_DOWN_EN; + else + st->regs[ADF4350_REG2] &= ~ADF4350_REG2_POWER_DOWN_EN; + + adf4350_sync_config(st); + break; + default: + ret = -ENODEV; + } + mutex_unlock(&indio_dev->mlock); + + return ret ? ret : len; +} + +static ssize_t adf4350_read(struct iio_dev *indio_dev, + uintptr_t private, + const struct iio_chan_spec *chan, + char *buf) +{ + struct adf4350_state *st = iio_priv(indio_dev); + unsigned long long val; + int ret = 0; + + mutex_lock(&indio_dev->mlock); + switch ((u32)private) { + case ADF4350_FREQ: + val = (u64)((st->r0_int * st->r1_mod) + st->r0_fract) * + (u64)st->fpfd; + do_div(val, st->r1_mod * (1 << st->r4_rf_div_sel)); + /* PLL unlocked? return error */ + if (gpio_is_valid(st->pdata->gpio_lock_detect)) + if (!gpio_get_value(st->pdata->gpio_lock_detect)) { + dev_dbg(&st->spi->dev, "PLL un-locked\n"); + ret = -EBUSY; + } + break; + case ADF4350_FREQ_REFIN: + val = st->clkin; + break; + case ADF4350_FREQ_RESOLUTION: + val = st->chspc; + break; + case ADF4350_PWRDOWN: + val = !!(st->regs[ADF4350_REG2] & ADF4350_REG2_POWER_DOWN_EN); + break; + } + mutex_unlock(&indio_dev->mlock); + + return ret < 0 ? ret : sprintf(buf, "%llu\n", val); +} + +#define _ADF4350_EXT_INFO(_name, _ident) { \ + .name = _name, \ + .read = adf4350_read, \ + .write = adf4350_write, \ + .private = _ident, \ +} + +static const struct iio_chan_spec_ext_info adf4350_ext_info[] = { + /* Ideally we use IIO_CHAN_INFO_FREQUENCY, but there are + * values > 2^32 in order to support the entire frequency range + * in Hz. Using scale is a bit ugly. + */ + _ADF4350_EXT_INFO("frequency", ADF4350_FREQ), + _ADF4350_EXT_INFO("frequency_resolution", ADF4350_FREQ_RESOLUTION), + _ADF4350_EXT_INFO("refin_frequency", ADF4350_FREQ_REFIN), + _ADF4350_EXT_INFO("powerdown", ADF4350_PWRDOWN), + { }, +}; + +static const struct iio_chan_spec adf4350_chan = { + .type = IIO_ALTVOLTAGE, + .indexed = 1, + .output = 1, + .ext_info = adf4350_ext_info, +}; + +static const struct iio_info adf4350_info = { + .debugfs_reg_access = &adf4350_reg_access, + .driver_module = THIS_MODULE, +}; + +static int __devinit adf4350_probe(struct spi_device *spi) +{ + struct adf4350_platform_data *pdata = spi->dev.platform_data; + struct iio_dev *indio_dev; + struct adf4350_state *st; + int ret; + + if (!pdata) { + dev_warn(&spi->dev, "no platform data? using default\n"); + + pdata = &default_pdata; + } + + indio_dev = iio_device_alloc(sizeof(*st)); + if (indio_dev == NULL) + return -ENOMEM; + + st = iio_priv(indio_dev); + + st->reg = regulator_get(&spi->dev, "vcc"); + if (!IS_ERR(st->reg)) { + ret = regulator_enable(st->reg); + if (ret) + goto error_put_reg; + } + + spi_set_drvdata(spi, indio_dev); + st->spi = spi; + st->pdata = pdata; + + indio_dev->dev.parent = &spi->dev; + indio_dev->name = (pdata->name[0] != 0) ? pdata->name : + spi_get_device_id(spi)->name; + + indio_dev->info = &adf4350_info; + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->channels = &adf4350_chan; + indio_dev->num_channels = 1; + + st->chspc = pdata->channel_spacing; + st->clkin = pdata->clkin; + + st->min_out_freq = spi_get_device_id(spi)->driver_data == 4351 ? + ADF4351_MIN_OUT_FREQ : ADF4350_MIN_OUT_FREQ; + + memset(st->regs_hw, 0xFF, sizeof(st->regs_hw)); + + if (gpio_is_valid(pdata->gpio_lock_detect)) { + ret = gpio_request(pdata->gpio_lock_detect, indio_dev->name); + if (ret) { + dev_err(&spi->dev, "fail to request lock detect GPIO-%d", + pdata->gpio_lock_detect); + goto error_disable_reg; + } + gpio_direction_input(pdata->gpio_lock_detect); + } + + if (pdata->power_up_frequency) { + ret = adf4350_set_freq(st, pdata->power_up_frequency); + if (ret) + goto error_free_gpio; + } + + ret = iio_device_register(indio_dev); + if (ret) + goto error_free_gpio; + + return 0; + +error_free_gpio: + if (gpio_is_valid(pdata->gpio_lock_detect)) + gpio_free(pdata->gpio_lock_detect); + +error_disable_reg: + if (!IS_ERR(st->reg)) + regulator_disable(st->reg); +error_put_reg: + if (!IS_ERR(st->reg)) + regulator_put(st->reg); + + iio_device_free(indio_dev); + + return ret; +} + +static int __devexit adf4350_remove(struct spi_device *spi) +{ + struct iio_dev *indio_dev = spi_get_drvdata(spi); + struct adf4350_state *st = iio_priv(indio_dev); + struct regulator *reg = st->reg; + + st->regs[ADF4350_REG2] |= ADF4350_REG2_POWER_DOWN_EN; + adf4350_sync_config(st); + + iio_device_unregister(indio_dev); + + if (!IS_ERR(reg)) { + regulator_disable(reg); + regulator_put(reg); + } + + if (gpio_is_valid(st->pdata->gpio_lock_detect)) + gpio_free(st->pdata->gpio_lock_detect); + + iio_device_free(indio_dev); + + return 0; +} + +static const struct spi_device_id adf4350_id[] = { + {"adf4350", 4350}, + {"adf4351", 4351}, + {} +}; + +static struct spi_driver adf4350_driver = { + .driver = { + .name = "adf4350", + .owner = THIS_MODULE, + }, + .probe = adf4350_probe, + .remove = __devexit_p(adf4350_remove), + .id_table = adf4350_id, +}; +module_spi_driver(adf4350_driver); + +MODULE_AUTHOR("Michael Hennerich "); +MODULE_DESCRIPTION("Analog Devices ADF4350/ADF4351 PLL"); +MODULE_LICENSE("GPL v2"); diff --git a/include/linux/iio/frequency/adf4350.h b/include/linux/iio/frequency/adf4350.h new file mode 100644 index 0000000..b76b4a8 --- /dev/null +++ b/include/linux/iio/frequency/adf4350.h @@ -0,0 +1,126 @@ +/* + * ADF4350/ADF4351 SPI PLL driver + * + * Copyright 2012 Analog Devices Inc. + * + * Licensed under the GPL-2. + */ + +#ifndef IIO_PLL_ADF4350_H_ +#define IIO_PLL_ADF4350_H_ + +/* Registers */ +#define ADF4350_REG0 0 +#define ADF4350_REG1 1 +#define ADF4350_REG2 2 +#define ADF4350_REG3 3 +#define ADF4350_REG4 4 +#define ADF4350_REG5 5 + +/* REG0 Bit Definitions */ +#define ADF4350_REG0_FRACT(x) (((x) & 0xFFF) << 3) +#define ADF4350_REG0_INT(x) (((x) & 0xFFFF) << 15) + +/* REG1 Bit Definitions */ +#define ADF4350_REG1_MOD(x) (((x) & 0xFFF) << 3) +#define ADF4350_REG1_PHASE(x) (((x) & 0xFFF) << 15) +#define ADF4350_REG1_PRESCALER (1 << 27) + +/* REG2 Bit Definitions */ +#define ADF4350_REG2_COUNTER_RESET_EN (1 << 3) +#define ADF4350_REG2_CP_THREESTATE_EN (1 << 4) +#define ADF4350_REG2_POWER_DOWN_EN (1 << 5) +#define ADF4350_REG2_PD_POLARITY_POS (1 << 6) +#define ADF4350_REG2_LDP_6ns (1 << 7) +#define ADF4350_REG2_LDP_10ns (0 << 7) +#define ADF4350_REG2_LDF_FRACT_N (0 << 8) +#define ADF4350_REG2_LDF_INT_N (1 << 8) +#define ADF4350_REG2_CHARGE_PUMP_CURR_uA(x) (((((x)-312) / 312) & 0xF) << 9) +#define ADF4350_REG2_DOUBLE_BUFF_EN (1 << 13) +#define ADF4350_REG2_10BIT_R_CNT(x) ((x) << 14) +#define ADF4350_REG2_RDIV2_EN (1 << 24) +#define ADF4350_REG2_RMULT2_EN (1 << 25) +#define ADF4350_REG2_MUXOUT(x) ((x) << 26) +#define ADF4350_REG2_NOISE_MODE(x) ((x) << 29) +#define ADF4350_MUXOUT_THREESTATE 0 +#define ADF4350_MUXOUT_DVDD 1 +#define ADF4350_MUXOUT_GND 2 +#define ADF4350_MUXOUT_R_DIV_OUT 3 +#define ADF4350_MUXOUT_N_DIV_OUT 4 +#define ADF4350_MUXOUT_ANALOG_LOCK_DETECT 5 +#define ADF4350_MUXOUT_DIGITAL_LOCK_DETECT 6 + +/* REG3 Bit Definitions */ +#define ADF4350_REG3_12BIT_CLKDIV(x) ((x) << 3) +#define ADF4350_REG3_12BIT_CLKDIV_MODE(x) ((x) << 16) +#define ADF4350_REG3_12BIT_CSR_EN (1 << 18) +#define ADF4351_REG3_CHARGE_CANCELLATION_EN (1 << 21) +#define ADF4351_REG3_ANTI_BACKLASH_3ns_EN (1 << 22) +#define ADF4351_REG3_BAND_SEL_CLOCK_MODE_HIGH (1 << 23) + +/* REG4 Bit Definitions */ +#define ADF4350_REG4_OUTPUT_PWR(x) ((x) << 3) +#define ADF4350_REG4_RF_OUT_EN (1 << 5) +#define ADF4350_REG4_AUX_OUTPUT_PWR(x) ((x) << 6) +#define ADF4350_REG4_AUX_OUTPUT_EN (1 << 8) +#define ADF4350_REG4_AUX_OUTPUT_FUND (1 << 9) +#define ADF4350_REG4_AUX_OUTPUT_DIV (0 << 9) +#define ADF4350_REG4_MUTE_TILL_LOCK_EN (1 << 10) +#define ADF4350_REG4_VCO_PWRDOWN_EN (1 << 11) +#define ADF4350_REG4_8BIT_BAND_SEL_CLKDIV(x) ((x) << 12) +#define ADF4350_REG4_RF_DIV_SEL(x) ((x) << 20) +#define ADF4350_REG4_FEEDBACK_DIVIDED (0 << 23) +#define ADF4350_REG4_FEEDBACK_FUND (1 << 23) + +/* REG5 Bit Definitions */ +#define ADF4350_REG5_LD_PIN_MODE_LOW (0 << 22) +#define ADF4350_REG5_LD_PIN_MODE_DIGITAL (1 << 22) +#define ADF4350_REG5_LD_PIN_MODE_HIGH (3 << 22) + +/* Specifications */ +#define ADF4350_MAX_OUT_FREQ 4400000000ULL /* Hz */ +#define ADF4350_MIN_OUT_FREQ 137500000 /* Hz */ +#define ADF4351_MIN_OUT_FREQ 34375000 /* Hz */ +#define ADF4350_MIN_VCO_FREQ 2200000000ULL /* Hz */ +#define ADF4350_MAX_FREQ_45_PRESC 3000000000ULL /* Hz */ +#define ADF4350_MAX_FREQ_PFD 32000000 /* Hz */ +#define ADF4350_MAX_BANDSEL_CLK 125000 /* Hz */ +#define ADF4350_MAX_FREQ_REFIN 250000000 /* Hz */ +#define ADF4350_MAX_MODULUS 4095 + +/** + * struct adf4350_platform_data - platform specific information + * @name: Optional device name. + * @clkin: REFin frequency in Hz. + * @channel_spacing: Channel spacing in Hz (influences MODULUS). + * @power_up_frequency: Optional, If set in Hz the PLL tunes to the desired + * frequency on probe. + * @ref_div_factor: Optional, if set the driver skips dynamic calculation + * and uses this default value instead. + * @ref_doubler_en: Enables reference doubler. + * @ref_div2_en: Enables reference divider. + * @r2_user_settings: User defined settings for ADF4350/1 REGISTER_2. + * @r3_user_settings: User defined settings for ADF4350/1 REGISTER_3. + * @r4_user_settings: User defined settings for ADF4350/1 REGISTER_4. + * @gpio_lock_detect: Optional, if set with a valid GPIO number, + * pll lock state is tested upon read. + * If not used - set to -1. + */ + +struct adf4350_platform_data { + char name[32]; + unsigned long clkin; + unsigned long channel_spacing; + unsigned long long power_up_frequency; + + unsigned short ref_div_factor; /* 10-bit R counter */ + bool ref_doubler_en; + bool ref_div2_en; + + unsigned r2_user_settings; + unsigned r3_user_settings; + unsigned r4_user_settings; + int gpio_lock_detect; +}; + +#endif /* IIO_PLL_ADF4350_H_ */ -- cgit v0.10.2 From 44dd5b02530a5aaea16c1a0a9eea377407445b4a Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Mon, 4 Jun 2012 11:34:49 +0530 Subject: staging: iio: Remove version.h header file inclusion version.h header file is no longer required. Signed-off-by: Sachin Kamat Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c index c3b05a1..040da4a 100755 --- a/drivers/staging/iio/light/tsl2x7x_core.c +++ b/drivers/staging/iio/light/tsl2x7x_core.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include -- cgit v0.10.2 From e4e8b7765867e8f4705bcc18b8930edbe0e4ef3c Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 Jun 2012 10:50:02 +0200 Subject: iio: Add iio_device_get() This patch add the iio_device_get() function, which increases the reference count of a iio device. The matching function to decrease the reference count - iio_device_put() - already exists. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index 3a4f6a3..3238fa3 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h @@ -438,6 +438,17 @@ static inline struct iio_dev *dev_to_iio_dev(struct device *dev) return container_of(dev, struct iio_dev, dev); } +/** + * iio_device_get() - increment reference count for the device + * @indio_dev: IIO device structure + * + * Returns: The passed IIO device + **/ +static inline struct iio_dev *iio_device_get(struct iio_dev *indio_dev) +{ + return indio_dev ? dev_to_iio_dev(get_device(&indio_dev->dev)) : NULL; +} + /* Can we make this smaller? */ #define IIO_ALIGN L1_CACHE_BYTES /** -- cgit v0.10.2 From 1875ffd218ddafd78f0f8e78198c137cef97fd8a Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 Jun 2012 10:50:03 +0200 Subject: iio:inkern: Use iio_device_{get,put} Use iio_device_get and iio_device_put instead of open-coding it. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Lars-Peter Clausen Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index 9226458..d4760bd 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c @@ -125,7 +125,7 @@ struct iio_channel *iio_st_channel_get(const char *name, strcmp(channel_name, c_i->map->consumer_channel) != 0)) continue; c = c_i; - get_device(&c->indio_dev->dev); + iio_device_get(c->indio_dev); break; } mutex_unlock(&iio_map_list_lock); @@ -149,7 +149,7 @@ EXPORT_SYMBOL_GPL(iio_st_channel_get); void iio_st_channel_release(struct iio_channel *channel) { - put_device(&channel->indio_dev->dev); + iio_device_put(channel->indio_dev); kfree(channel); } EXPORT_SYMBOL_GPL(iio_st_channel_release); @@ -195,10 +195,10 @@ struct iio_channel *iio_st_channel_get_all(const char *name) c->map->adc_channel_label); if (chans[mapind].channel == NULL) { ret = -EINVAL; - put_device(&chans[mapind].indio_dev->dev); + iio_device_put(chans[mapind].indio_dev); goto error_free_chans; } - get_device(&chans[mapind].indio_dev->dev); + iio_device_get(chans[mapind].indio_dev); mapind++; } mutex_unlock(&iio_map_list_lock); @@ -210,8 +210,7 @@ struct iio_channel *iio_st_channel_get_all(const char *name) error_free_chans: for (i = 0; i < nummaps; i++) - if (chans[i].indio_dev) - put_device(&chans[i].indio_dev->dev); + iio_device_put(chans[i].indio_dev); kfree(chans); error_ret: mutex_unlock(&iio_map_list_lock); @@ -225,7 +224,7 @@ void iio_st_channel_release_all(struct iio_channel *channels) struct iio_channel *chan = &channels[0]; while (chan->indio_dev) { - put_device(&chan->indio_dev->dev); + iio_device_put(chan->indio_dev); chan++; } kfree(channels); -- cgit v0.10.2 From 5212cc8a9d833791a7aec566db136e78951f203d Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 Jun 2012 11:36:11 +0200 Subject: iio: Add helper functions for enum style channel attributes We often have the case were we do have a enum style channel attribute. These attributes have in common that they are a list of string values which usually map in a 1-to-1 fashion to integer values. This patch implements some common helper code for implementing enum style channel attributes using extended channel attributes. The helper functions take care of converting between the string and integer values, as well providing a function for "_available" attributes which list all available enum items. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 1ddd886..56a3c0b 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -289,6 +289,69 @@ static ssize_t iio_write_channel_ext_info(struct device *dev, this_attr->c, buf, len); } +ssize_t iio_enum_available_read(struct iio_dev *indio_dev, + uintptr_t priv, const struct iio_chan_spec *chan, char *buf) +{ + const struct iio_enum *e = (const struct iio_enum *)priv; + unsigned int i; + size_t len = 0; + + if (!e->num_items) + return 0; + + for (i = 0; i < e->num_items; ++i) + len += snprintf(buf + len, PAGE_SIZE - len, "%s ", e->items[i]); + + /* replace last space with a newline */ + buf[len - 1] = '\n'; + + return len; +} +EXPORT_SYMBOL_GPL(iio_enum_available_read); + +ssize_t iio_enum_read(struct iio_dev *indio_dev, + uintptr_t priv, const struct iio_chan_spec *chan, char *buf) +{ + const struct iio_enum *e = (const struct iio_enum *)priv; + int i; + + if (!e->get) + return -EINVAL; + + i = e->get(indio_dev, chan); + if (i < 0) + return i; + else if (i >= e->num_items) + return -EINVAL; + + return sprintf(buf, "%s\n", e->items[i]); +} +EXPORT_SYMBOL_GPL(iio_enum_read); + +ssize_t iio_enum_write(struct iio_dev *indio_dev, + uintptr_t priv, const struct iio_chan_spec *chan, const char *buf, + size_t len) +{ + const struct iio_enum *e = (const struct iio_enum *)priv; + unsigned int i; + int ret; + + if (!e->set) + return -EINVAL; + + for (i = 0; i < e->num_items; i++) { + if (sysfs_streq(buf, e->items[i])) + break; + } + + if (i == e->num_items) + return -EINVAL; + + ret = e->set(indio_dev, chan, i); + return ret ? ret : len; +} +EXPORT_SYMBOL_GPL(iio_enum_write); + static ssize_t iio_read_channel_info(struct device *dev, struct device_attribute *attr, char *buf) diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index 3238fa3..944c635 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h @@ -130,6 +130,70 @@ struct iio_chan_spec_ext_info { }; /** + * struct iio_enum - Enum channel info attribute + * items: A array of strings. + * num_items: Length of the item array. + * set: Set callback function, may be NULL. + * get: Get callback function, may be NULL. + * + * The iio_enum struct can be used to implement enum style channel attributes. + * Enum style attributes are those which have a set of strings which map to + * unsigned integer values. The IIO enum helper code takes care of mapping + * between value and string as well as generating a "_available" file which + * contains a list of all available items. The set callback will be called when + * the attribute is updated. The last parameter is the index to the newly + * activated item. The get callback will be used to query the currently active + * item and is supposed to return the index for it. + */ +struct iio_enum { + const char * const *items; + unsigned int num_items; + int (*set)(struct iio_dev *, const struct iio_chan_spec *, unsigned int); + int (*get)(struct iio_dev *, const struct iio_chan_spec *); +}; + +ssize_t iio_enum_available_read(struct iio_dev *indio_dev, + uintptr_t priv, const struct iio_chan_spec *chan, char *buf); +ssize_t iio_enum_read(struct iio_dev *indio_dev, + uintptr_t priv, const struct iio_chan_spec *chan, char *buf); +ssize_t iio_enum_write(struct iio_dev *indio_dev, + uintptr_t priv, const struct iio_chan_spec *chan, const char *buf, + size_t len); + +/** + * IIO_ENUM() - Initialize enum extended channel attribute + * @_name: Attribute name + * @_shared: Whether the attribute is shared between all channels + * @_e: Pointer to a iio_enum struct + * + * This should usually be used together with IIO_ENUM_AVAILABLE() + */ +#define IIO_ENUM(_name, _shared, _e) \ +{ \ + .name = (_name), \ + .shared = (_shared), \ + .read = iio_enum_read, \ + .write = iio_enum_write, \ + .private = (uintptr_t)(_e), \ +} + +/** + * IIO_ENUM_AVAILABLE() - Initialize enum available extended channel attribute + * @_name: Attribute name ("_available" will be appended to the name) + * @_e: Pointer to a iio_enum struct + * + * Creates a read only attribute which list all the available enum items in a + * space separated list. This should usually be used together with IIO_ENUM() + */ +#define IIO_ENUM_AVAILABLE(_name, _e) \ +{ \ + .name = (_name "_available"), \ + .shared = true, \ + .read = iio_enum_available_read, \ + .private = (uintptr_t)(_e), \ +} + +/** * struct iio_chan_spec - specification of a single channel * @type: What type of measurement is the channel making. * @channel: What number or name do we wish to assign the channel. -- cgit v0.10.2 From 26628f6b53d1ae3610146607c0c7fcbaf403bee7 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 Jun 2012 11:36:12 +0200 Subject: staging:iio:dac:ad5064: Use iio_enum for powerdown modes This allows us to remove some boilerplate code for comparing and formatting the enum strings. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/dac/ad5064.c b/drivers/staging/iio/dac/ad5064.c index 047148a..2394f05 100644 --- a/drivers/staging/iio/dac/ad5064.c +++ b/drivers/staging/iio/dac/ad5064.c @@ -136,57 +136,42 @@ static int ad5064_sync_powerdown_mode(struct ad5064_state *st, return ret; } -static const char ad5064_powerdown_modes[][15] = { - [AD5064_LDAC_PWRDN_NONE] = "", - [AD5064_LDAC_PWRDN_1K] = "1kohm_to_gnd", - [AD5064_LDAC_PWRDN_100K] = "100kohm_to_gnd", - [AD5064_LDAC_PWRDN_3STATE] = "three_state", +static const char * const ad5064_powerdown_modes[] = { + "1kohm_to_gnd", + "100kohm_to_gnd", + "three_state", }; -static ssize_t ad5064_read_powerdown_mode_available(struct iio_dev *indio_dev, - uintptr_t private, const struct iio_chan_spec *chan, char *buf) -{ - return sprintf(buf, "%s %s %s\n", ad5064_powerdown_modes[1], - ad5064_powerdown_modes[2], ad5064_powerdown_modes[3]); -} - -static ssize_t ad5064_read_powerdown_mode(struct iio_dev *indio_dev, - uintptr_t private, const struct iio_chan_spec *chan, char *buf) +static int ad5064_get_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan) { struct ad5064_state *st = iio_priv(indio_dev); - return sprintf(buf, "%s\n", - ad5064_powerdown_modes[st->pwr_down_mode[chan->channel]]); + return st->pwr_down_mode[chan->channel] - 1; } -static ssize_t ad5064_write_powerdown_mode(struct iio_dev *indio_dev, - uintptr_t private, const struct iio_chan_spec *chan, const char *buf, - size_t len) +static int ad5064_set_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, unsigned int mode) { struct ad5064_state *st = iio_priv(indio_dev); - unsigned int mode, i; int ret; - mode = 0; - - for (i = 1; i < ARRAY_SIZE(ad5064_powerdown_modes); ++i) { - if (sysfs_streq(buf, ad5064_powerdown_modes[i])) { - mode = i; - break; - } - } - if (mode == 0) - return -EINVAL; - mutex_lock(&indio_dev->mlock); - st->pwr_down_mode[chan->channel] = mode; + st->pwr_down_mode[chan->channel] = mode + 1; ret = ad5064_sync_powerdown_mode(st, chan->channel); mutex_unlock(&indio_dev->mlock); - return ret ? ret : len; + return ret; } +static const struct iio_enum ad5064_powerdown_mode_enum = { + .items = ad5064_powerdown_modes, + .num_items = ARRAY_SIZE(ad5064_powerdown_modes), + .get = ad5064_get_powerdown_mode, + .set = ad5064_set_powerdown_mode, +}; + static ssize_t ad5064_read_dac_powerdown(struct iio_dev *indio_dev, uintptr_t private, const struct iio_chan_spec *chan, char *buf) { @@ -286,22 +271,14 @@ static const struct iio_info ad5064_info = { .driver_module = THIS_MODULE, }; -static struct iio_chan_spec_ext_info ad5064_ext_info[] = { +static const struct iio_chan_spec_ext_info ad5064_ext_info[] = { { .name = "powerdown", .read = ad5064_read_dac_powerdown, .write = ad5064_write_dac_powerdown, }, - { - .name = "powerdown_mode", - .read = ad5064_read_powerdown_mode, - .write = ad5064_write_powerdown_mode, - }, - { - .name = "powerdown_mode_available", - .shared = true, - .read = ad5064_read_powerdown_mode_available, - }, + IIO_ENUM("powerdown_mode", false, &ad5064_powerdown_mode_enum), + IIO_ENUM_AVAILABLE("powerdown_mode", &ad5064_powerdown_mode_enum), { }, }; -- cgit v0.10.2 From 09d48aa9f67e05770c48df6437a753b9c4d4469a Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 Jun 2012 11:36:13 +0200 Subject: staging:iio:dac:ad5446: Use iio_enum for powerdown modes This allows us to remove some boilerplate code for comparing and formatting the enum strings. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/dac/ad5446.c b/drivers/staging/iio/dac/ad5446.c index daa65b3..1774f7f 100644 --- a/drivers/staging/iio/dac/ad5446.c +++ b/drivers/staging/iio/dac/ad5446.c @@ -42,47 +42,34 @@ static int ad5660_write(struct ad5446_state *st, unsigned val) } static const char * const ad5446_powerdown_modes[] = { - "", "1kohm_to_gnd", "100kohm_to_gnd", "three_state" + "1kohm_to_gnd", "100kohm_to_gnd", "three_state" }; -static ssize_t ad5446_read_powerdown_mode_available(struct iio_dev *indio_dev, - uintptr_t private, const struct iio_chan_spec *chan, char *buf) -{ - return sprintf(buf, "%s %s %s\n", ad5446_powerdown_modes[1], - ad5446_powerdown_modes[2], ad5446_powerdown_modes[3]); -} - -static ssize_t ad5446_write_powerdown_mode(struct iio_dev *indio_dev, - uintptr_t private, - const struct iio_chan_spec *chan, - const char *buf, size_t len) +static int ad5446_set_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, unsigned int mode) { struct ad5446_state *st = iio_priv(indio_dev); - int i; - - for (i = 1; i < ARRAY_SIZE(ad5446_powerdown_modes); i++) { - if (sysfs_streq(buf, ad5446_powerdown_modes[i])) { - st->pwr_down_mode = i; - break; - } - } - if (i == ARRAY_SIZE(ad5446_powerdown_modes)) - return -EINVAL; + st->pwr_down_mode = mode + 1; - return len; + return 0; } -static ssize_t ad5446_read_powerdown_mode(struct iio_dev *indio_dev, - uintptr_t private, - const struct iio_chan_spec *chan, - char *buf) +static int ad5446_get_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan) { struct ad5446_state *st = iio_priv(indio_dev); - return sprintf(buf, "%s\n", ad5446_powerdown_modes[st->pwr_down_mode]); + return st->pwr_down_mode - 1; } +static const struct iio_enum ad5446_powerdown_mode_enum = { + .items = ad5446_powerdown_modes, + .num_items = ARRAY_SIZE(ad5446_powerdown_modes), + .get = ad5446_get_powerdown_mode, + .set = ad5446_set_powerdown_mode, +}; + static ssize_t ad5446_read_dac_powerdown(struct iio_dev *indio_dev, uintptr_t private, const struct iio_chan_spec *chan, @@ -129,15 +116,9 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info_powerdown[] = { .name = "powerdown", .read = ad5446_read_dac_powerdown, .write = ad5446_write_dac_powerdown, - }, { - .name = "powerdown_mode", - .read = ad5446_read_powerdown_mode, - .write = ad5446_write_powerdown_mode, - }, { - .name = "powerdown_mode_available", - .shared = true, - .read = ad5446_read_powerdown_mode_available, }, + IIO_ENUM("powerdown_mode", false, &ad5446_powerdown_mode_enum), + IIO_ENUM_AVAILABLE("powerdown_mode", &ad5446_powerdown_mode_enum), { }, }; @@ -321,6 +302,8 @@ static int __devinit ad5446_probe(struct spi_device *spi) indio_dev->channels = &st->chip_info->channel; indio_dev->num_channels = 1; + st->pwr_down_mode = MODE_PWRDWN_1k; + if (st->chip_info->int_vref_mv) st->vref_mv = st->chip_info->int_vref_mv; else if (voltage_uv) -- cgit v0.10.2 From 868e0862c9f6a8bd6bf42534b80e1e7bd230bf74 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 Jun 2012 11:36:14 +0200 Subject: staging:iio:dac:ad5380: Convert to extended channel attributes Use extended channel attributes instead of raw sysfs files for the additional channel attributes. This allows us to remove some boilerplate code. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/dac/ad5380.c b/drivers/staging/iio/dac/ad5380.c index 370d284..7a35cc6 100644 --- a/drivers/staging/iio/dac/ad5380.c +++ b/drivers/staging/iio/dac/ad5380.c @@ -81,103 +81,18 @@ enum ad5380_type { ID_AD5392_5, }; -#define AD5380_CHANNEL(_bits) { \ - .type = IIO_VOLTAGE, \ - .indexed = 1, \ - .output = 1, \ - .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ - IIO_CHAN_INFO_SCALE_SHARED_BIT | \ - IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT | \ - IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT, \ - .scan_type = IIO_ST('u', (_bits), 16, 14 - (_bits)) \ -} - -static const struct ad5380_chip_info ad5380_chip_info_tbl[] = { - [ID_AD5380_3] = { - .channel_template = AD5380_CHANNEL(14), - .num_channels = 40, - .int_vref = 1250000, - }, - [ID_AD5380_5] = { - .channel_template = AD5380_CHANNEL(14), - .num_channels = 40, - .int_vref = 2500000, - }, - [ID_AD5381_3] = { - .channel_template = AD5380_CHANNEL(12), - .num_channels = 16, - .int_vref = 1250000, - }, - [ID_AD5381_5] = { - .channel_template = AD5380_CHANNEL(12), - .num_channels = 16, - .int_vref = 2500000, - }, - [ID_AD5382_3] = { - .channel_template = AD5380_CHANNEL(14), - .num_channels = 32, - .int_vref = 1250000, - }, - [ID_AD5382_5] = { - .channel_template = AD5380_CHANNEL(14), - .num_channels = 32, - .int_vref = 2500000, - }, - [ID_AD5383_3] = { - .channel_template = AD5380_CHANNEL(12), - .num_channels = 32, - .int_vref = 1250000, - }, - [ID_AD5383_5] = { - .channel_template = AD5380_CHANNEL(12), - .num_channels = 32, - .int_vref = 2500000, - }, - [ID_AD5390_3] = { - .channel_template = AD5380_CHANNEL(14), - .num_channels = 16, - .int_vref = 1250000, - }, - [ID_AD5390_5] = { - .channel_template = AD5380_CHANNEL(14), - .num_channels = 16, - .int_vref = 2500000, - }, - [ID_AD5391_3] = { - .channel_template = AD5380_CHANNEL(12), - .num_channels = 16, - .int_vref = 1250000, - }, - [ID_AD5391_5] = { - .channel_template = AD5380_CHANNEL(12), - .num_channels = 16, - .int_vref = 2500000, - }, - [ID_AD5392_3] = { - .channel_template = AD5380_CHANNEL(14), - .num_channels = 8, - .int_vref = 1250000, - }, - [ID_AD5392_5] = { - .channel_template = AD5380_CHANNEL(14), - .num_channels = 8, - .int_vref = 2500000, - }, -}; - -static ssize_t ad5380_read_dac_powerdown(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t ad5380_read_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, char *buf) { - struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad5380_state *st = iio_priv(indio_dev); return sprintf(buf, "%d\n", st->pwr_down); } -static ssize_t ad5380_write_dac_powerdown(struct device *dev, - struct device_attribute *attr, const char *buf, size_t len) +static ssize_t ad5380_write_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, const char *buf, + size_t len) { - struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad5380_state *st = iio_priv(indio_dev); bool pwr_down; int ret; @@ -200,20 +115,14 @@ static ssize_t ad5380_write_dac_powerdown(struct device *dev, return ret ? ret : len; } -static IIO_DEVICE_ATTR(out_voltage_powerdown, - S_IRUGO | S_IWUSR, - ad5380_read_dac_powerdown, - ad5380_write_dac_powerdown, 0); - -static const char ad5380_powerdown_modes[][15] = { - [0] = "100kohm_to_gnd", - [1] = "three_state", +static const char * const ad5380_powerdown_modes[] = { + "100kohm_to_gnd", + "three_state", }; -static ssize_t ad5380_read_powerdown_mode(struct device *dev, - struct device_attribute *attr, char *buf) +static int ad5380_get_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan) { - struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad5380_state *st = iio_priv(indio_dev); unsigned int mode; int ret; @@ -224,49 +133,27 @@ static ssize_t ad5380_read_powerdown_mode(struct device *dev, mode = (mode >> AD5380_CTRL_PWR_DOWN_MODE_OFFSET) & 1; - return sprintf(buf, "%s\n", ad5380_powerdown_modes[mode]); + return mode; } -static ssize_t ad5380_write_powerdown_mode(struct device *dev, - struct device_attribute *attr, const char *buf, size_t len) +static int ad5380_set_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, unsigned int mode) { - struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad5380_state *st = iio_priv(indio_dev); - unsigned int i; int ret; - for (i = 0; i < ARRAY_SIZE(ad5380_powerdown_modes); ++i) { - if (sysfs_streq(buf, ad5380_powerdown_modes[i])) - break; - } - - if (i == ARRAY_SIZE(ad5380_powerdown_modes)) - return -EINVAL; - ret = regmap_update_bits(st->regmap, AD5380_REG_SF_CTRL, 1 << AD5380_CTRL_PWR_DOWN_MODE_OFFSET, - i << AD5380_CTRL_PWR_DOWN_MODE_OFFSET); + mode << AD5380_CTRL_PWR_DOWN_MODE_OFFSET); - return ret ? ret : len; + return ret; } -static IIO_DEVICE_ATTR(out_voltage_powerdown_mode, - S_IRUGO | S_IWUSR, - ad5380_read_powerdown_mode, - ad5380_write_powerdown_mode, 0); - -static IIO_CONST_ATTR(out_voltage_powerdown_mode_available, - "100kohm_to_gnd three_state"); - -static struct attribute *ad5380_attributes[] = { - &iio_dev_attr_out_voltage_powerdown.dev_attr.attr, - &iio_dev_attr_out_voltage_powerdown_mode.dev_attr.attr, - &iio_const_attr_out_voltage_powerdown_mode_available.dev_attr.attr, - NULL, -}; - -static const struct attribute_group ad5380_attribute_group = { - .attrs = ad5380_attributes, +static const struct iio_enum ad5380_powerdown_mode_enum = { + .items = ad5380_powerdown_modes, + .num_items = ARRAY_SIZE(ad5380_powerdown_modes), + .get = ad5380_get_powerdown_mode, + .set = ad5380_set_powerdown_mode, }; static unsigned int ad5380_info_to_reg(struct iio_chan_spec const *chan, @@ -354,10 +241,105 @@ static int ad5380_read_raw(struct iio_dev *indio_dev, static const struct iio_info ad5380_info = { .read_raw = ad5380_read_raw, .write_raw = ad5380_write_raw, - .attrs = &ad5380_attribute_group, .driver_module = THIS_MODULE, }; +static struct iio_chan_spec_ext_info ad5380_ext_info[] = { + { + .name = "powerdown", + .read = ad5380_read_dac_powerdown, + .write = ad5380_write_dac_powerdown, + }, + IIO_ENUM("powerdown_mode", true, &ad5380_powerdown_mode_enum), + IIO_ENUM_AVAILABLE("powerdown_mode", &ad5380_powerdown_mode_enum), + { }, +}; + +#define AD5380_CHANNEL(_bits) { \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .output = 1, \ + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ + IIO_CHAN_INFO_SCALE_SHARED_BIT | \ + IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT | \ + IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT, \ + .scan_type = IIO_ST('u', (_bits), 16, 14 - (_bits)), \ + .ext_info = ad5380_ext_info, \ +} + +static const struct ad5380_chip_info ad5380_chip_info_tbl[] = { + [ID_AD5380_3] = { + .channel_template = AD5380_CHANNEL(14), + .num_channels = 40, + .int_vref = 1250000, + }, + [ID_AD5380_5] = { + .channel_template = AD5380_CHANNEL(14), + .num_channels = 40, + .int_vref = 2500000, + }, + [ID_AD5381_3] = { + .channel_template = AD5380_CHANNEL(12), + .num_channels = 16, + .int_vref = 1250000, + }, + [ID_AD5381_5] = { + .channel_template = AD5380_CHANNEL(12), + .num_channels = 16, + .int_vref = 2500000, + }, + [ID_AD5382_3] = { + .channel_template = AD5380_CHANNEL(14), + .num_channels = 32, + .int_vref = 1250000, + }, + [ID_AD5382_5] = { + .channel_template = AD5380_CHANNEL(14), + .num_channels = 32, + .int_vref = 2500000, + }, + [ID_AD5383_3] = { + .channel_template = AD5380_CHANNEL(12), + .num_channels = 32, + .int_vref = 1250000, + }, + [ID_AD5383_5] = { + .channel_template = AD5380_CHANNEL(12), + .num_channels = 32, + .int_vref = 2500000, + }, + [ID_AD5390_3] = { + .channel_template = AD5380_CHANNEL(14), + .num_channels = 16, + .int_vref = 1250000, + }, + [ID_AD5390_5] = { + .channel_template = AD5380_CHANNEL(14), + .num_channels = 16, + .int_vref = 2500000, + }, + [ID_AD5391_3] = { + .channel_template = AD5380_CHANNEL(12), + .num_channels = 16, + .int_vref = 1250000, + }, + [ID_AD5391_5] = { + .channel_template = AD5380_CHANNEL(12), + .num_channels = 16, + .int_vref = 2500000, + }, + [ID_AD5392_3] = { + .channel_template = AD5380_CHANNEL(14), + .num_channels = 8, + .int_vref = 1250000, + }, + [ID_AD5392_5] = { + .channel_template = AD5380_CHANNEL(14), + .num_channels = 8, + .int_vref = 2500000, + }, +}; + static int __devinit ad5380_alloc_channels(struct iio_dev *indio_dev) { struct ad5380_state *st = iio_priv(indio_dev); -- cgit v0.10.2 From 8d05d7773d644bbde98e27eeba0e8f6251b30d1e Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 Jun 2012 11:36:15 +0200 Subject: staging:iio:dac:ad5504: Convert to extended channel attributes Use extended channel attributes instead of raw sysfs files for the additional channel attributes. This allows us to remove some boilerplate code. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/dac/ad5504.c b/drivers/staging/iio/dac/ad5504.c index 019cf15..acb1d59 100644 --- a/drivers/staging/iio/dac/ad5504.c +++ b/drivers/staging/iio/dac/ad5504.c @@ -22,24 +22,6 @@ #include "dac.h" #include "ad5504.h" -#define AD5504_CHANNEL(_chan) { \ - .type = IIO_VOLTAGE, \ - .indexed = 1, \ - .output = 1, \ - .channel = (_chan), \ - .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ - IIO_CHAN_INFO_SCALE_SHARED_BIT, \ - .address = AD5504_ADDR_DAC(_chan), \ - .scan_type = IIO_ST('u', 12, 16, 0), \ -} - -static const struct iio_chan_spec ad5504_channels[] = { - AD5504_CHANNEL(0), - AD5504_CHANNEL(1), - AD5504_CHANNEL(2), - AD5504_CHANNEL(3), -}; - static int ad5504_spi_write(struct spi_device *spi, u8 addr, u16 val) { u16 tmp = cpu_to_be16(AD5504_CMD_WRITE | @@ -122,65 +104,61 @@ static int ad5504_write_raw(struct iio_dev *indio_dev, return -EINVAL; } -static ssize_t ad5504_read_powerdown_mode(struct device *dev, - struct device_attribute *attr, char *buf) +static const char * const ad5504_powerdown_modes[] = { + "20kohm_to_gnd", + "three_state", +}; + +static int ad5504_get_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan) { - struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad5504_state *st = iio_priv(indio_dev); - const char mode[][14] = {"20kohm_to_gnd", "three_state"}; - - return sprintf(buf, "%s\n", mode[st->pwr_down_mode]); + return st->pwr_down_mode; } -static ssize_t ad5504_write_powerdown_mode(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) +static int ad5504_set_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, unsigned int mode) { - struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad5504_state *st = iio_priv(indio_dev); - int ret; - if (sysfs_streq(buf, "20kohm_to_gnd")) - st->pwr_down_mode = AD5504_DAC_PWRDN_20K; - else if (sysfs_streq(buf, "three_state")) - st->pwr_down_mode = AD5504_DAC_PWRDN_3STATE; - else - ret = -EINVAL; + st->pwr_down_mode = mode; - return ret ? ret : len; + return 0; } -static ssize_t ad5504_read_dac_powerdown(struct device *dev, - struct device_attribute *attr, - char *buf) +static const struct iio_enum ad5504_powerdown_mode_enum = { + .items = ad5504_powerdown_modes, + .num_items = ARRAY_SIZE(ad5504_powerdown_modes), + .get = ad5504_get_powerdown_mode, + .set = ad5504_set_powerdown_mode, +}; + +static ssize_t ad5504_read_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, char *buf) { - struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad5504_state *st = iio_priv(indio_dev); - struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); return sprintf(buf, "%d\n", - !(st->pwr_down_mask & (1 << this_attr->address))); + !(st->pwr_down_mask & (1 << chan->channel))); } -static ssize_t ad5504_write_dac_powerdown(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) +static ssize_t ad5504_write_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, const char *buf, + size_t len) { long readin; int ret; - struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad5504_state *st = iio_priv(indio_dev); - struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); ret = strict_strtol(buf, 10, &readin); if (ret) return ret; if (readin == 0) - st->pwr_down_mask |= (1 << this_attr->address); + st->pwr_down_mask |= (1 << chan->channel); else if (readin == 1) - st->pwr_down_mask &= ~(1 << this_attr->address); + st->pwr_down_mask &= ~(1 << chan->channel); else ret = -EINVAL; @@ -194,50 +172,6 @@ static ssize_t ad5504_write_dac_powerdown(struct device *dev, return ret ? ret : len; } -static IIO_DEVICE_ATTR(out_voltage_powerdown_mode, S_IRUGO | - S_IWUSR, ad5504_read_powerdown_mode, - ad5504_write_powerdown_mode, 0); - -static IIO_CONST_ATTR(out_voltage_powerdown_mode_available, - "20kohm_to_gnd three_state"); - -#define IIO_DEV_ATTR_DAC_POWERDOWN(_num, _show, _store, _addr) \ - IIO_DEVICE_ATTR(out_voltage##_num##_powerdown, \ - S_IRUGO | S_IWUSR, _show, _store, _addr) -static IIO_DEV_ATTR_DAC_POWERDOWN(0, ad5504_read_dac_powerdown, - ad5504_write_dac_powerdown, 0); -static IIO_DEV_ATTR_DAC_POWERDOWN(1, ad5504_read_dac_powerdown, - ad5504_write_dac_powerdown, 1); -static IIO_DEV_ATTR_DAC_POWERDOWN(2, ad5504_read_dac_powerdown, - ad5504_write_dac_powerdown, 2); -static IIO_DEV_ATTR_DAC_POWERDOWN(3, ad5504_read_dac_powerdown, - ad5504_write_dac_powerdown, 3); - -static struct attribute *ad5504_attributes[] = { - &iio_dev_attr_out_voltage0_powerdown.dev_attr.attr, - &iio_dev_attr_out_voltage1_powerdown.dev_attr.attr, - &iio_dev_attr_out_voltage2_powerdown.dev_attr.attr, - &iio_dev_attr_out_voltage3_powerdown.dev_attr.attr, - &iio_dev_attr_out_voltage_powerdown_mode.dev_attr.attr, - &iio_const_attr_out_voltage_powerdown_mode_available.dev_attr.attr, - NULL, -}; - -static const struct attribute_group ad5504_attribute_group = { - .attrs = ad5504_attributes, -}; - -static struct attribute *ad5501_attributes[] = { - &iio_dev_attr_out_voltage0_powerdown.dev_attr.attr, - &iio_dev_attr_out_voltage_powerdown_mode.dev_attr.attr, - &iio_const_attr_out_voltage_powerdown_mode_available.dev_attr.attr, - NULL, -}; - -static const struct attribute_group ad5501_attribute_group = { - .attrs = ad5501_attributes, -}; - static IIO_CONST_ATTR(temp0_thresh_rising_value, "110000"); static IIO_CONST_ATTR(temp0_thresh_rising_en, "1"); @@ -267,17 +201,38 @@ static irqreturn_t ad5504_event_handler(int irq, void *private) static const struct iio_info ad5504_info = { .write_raw = ad5504_write_raw, .read_raw = ad5504_read_raw, - .attrs = &ad5504_attribute_group, .event_attrs = &ad5504_ev_attribute_group, .driver_module = THIS_MODULE, }; -static const struct iio_info ad5501_info = { - .write_raw = ad5504_write_raw, - .read_raw = ad5504_read_raw, - .attrs = &ad5501_attribute_group, - .event_attrs = &ad5504_ev_attribute_group, - .driver_module = THIS_MODULE, +static const struct iio_chan_spec_ext_info ad5504_ext_info[] = { + { + .name = "powerdown", + .read = ad5504_read_dac_powerdown, + .write = ad5504_write_dac_powerdown, + }, + IIO_ENUM("powerdown_mode", true, &ad5504_powerdown_mode_enum), + IIO_ENUM_AVAILABLE("powerdown_mode", &ad5504_powerdown_mode_enum), + { }, +}; + +#define AD5504_CHANNEL(_chan) { \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .output = 1, \ + .channel = (_chan), \ + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ + IIO_CHAN_INFO_SCALE_SHARED_BIT, \ + .address = AD5504_ADDR_DAC(_chan), \ + .scan_type = IIO_ST('u', 12, 16, 0), \ + .ext_info = ad5504_ext_info, \ +} + +static const struct iio_chan_spec ad5504_channels[] = { + AD5504_CHANNEL(0), + AD5504_CHANNEL(1), + AD5504_CHANNEL(2), + AD5504_CHANNEL(3), }; static int __devinit ad5504_probe(struct spi_device *spi) @@ -315,13 +270,11 @@ static int __devinit ad5504_probe(struct spi_device *spi) st->spi = spi; indio_dev->dev.parent = &spi->dev; indio_dev->name = spi_get_device_id(st->spi)->name; - if (spi_get_device_id(st->spi)->driver_data == ID_AD5501) { - indio_dev->info = &ad5501_info; + indio_dev->info = &ad5504_info; + if (spi_get_device_id(st->spi)->driver_data == ID_AD5501) indio_dev->num_channels = 1; - } else { - indio_dev->info = &ad5504_info; + else indio_dev->num_channels = 4; - } indio_dev->channels = ad5504_channels; indio_dev->modes = INDIO_DIRECT_MODE; -- cgit v0.10.2 From 66eb90505eaf38f3e88491eb9090cd7be7c2da03 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 Jun 2012 11:36:16 +0200 Subject: staging:iio:dac:ad5624r: Convert to extended channel attributes Use extended channel attributes instead of raw sysfs files for the additional channel attributes. This allows us to remove some boilerplate code. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/dac/ad5624r_spi.c b/drivers/staging/iio/dac/ad5624r_spi.c index 42ff644..4c95eae 100644 --- a/drivers/staging/iio/dac/ad5624r_spi.c +++ b/drivers/staging/iio/dac/ad5624r_spi.c @@ -21,56 +21,6 @@ #include "dac.h" #include "ad5624r.h" -#define AD5624R_CHANNEL(_chan, _bits) { \ - .type = IIO_VOLTAGE, \ - .indexed = 1, \ - .output = 1, \ - .channel = (_chan), \ - .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ - IIO_CHAN_INFO_SCALE_SHARED_BIT, \ - .address = (_chan), \ - .scan_type = IIO_ST('u', (_bits), 16, 16 - (_bits)), \ -} - -#define DECLARE_AD5624R_CHANNELS(_name, _bits) \ - const struct iio_chan_spec _name##_channels[] = { \ - AD5624R_CHANNEL(0, _bits), \ - AD5624R_CHANNEL(1, _bits), \ - AD5624R_CHANNEL(2, _bits), \ - AD5624R_CHANNEL(3, _bits), \ -} - -static DECLARE_AD5624R_CHANNELS(ad5624r, 12); -static DECLARE_AD5624R_CHANNELS(ad5644r, 14); -static DECLARE_AD5624R_CHANNELS(ad5664r, 16); - -static const struct ad5624r_chip_info ad5624r_chip_info_tbl[] = { - [ID_AD5624R3] = { - .channels = ad5624r_channels, - .int_vref_mv = 1250, - }, - [ID_AD5624R5] = { - .channels = ad5624r_channels, - .int_vref_mv = 2500, - }, - [ID_AD5644R3] = { - .channels = ad5644r_channels, - .int_vref_mv = 1250, - }, - [ID_AD5644R5] = { - .channels = ad5644r_channels, - .int_vref_mv = 2500, - }, - [ID_AD5664R3] = { - .channels = ad5664r_channels, - .int_vref_mv = 1250, - }, - [ID_AD5664R5] = { - .channels = ad5664r_channels, - .int_vref_mv = 2500, - }, -}; - static int ad5624r_spi_write(struct spi_device *spi, u8 cmd, u8 addr, u16 val, u8 len) { @@ -138,67 +88,62 @@ static int ad5624r_write_raw(struct iio_dev *indio_dev, return -EINVAL; } -static ssize_t ad5624r_read_powerdown_mode(struct device *dev, - struct device_attribute *attr, char *buf) +static const char * const ad5624r_powerdown_modes[] = { + "1kohm_to_gnd", + "100kohm_to_gnd", + "three_state" +}; + +static int ad5624r_get_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan) { - struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad5624r_state *st = iio_priv(indio_dev); - char mode[][15] = {"", "1kohm_to_gnd", "100kohm_to_gnd", "three_state"}; - - return sprintf(buf, "%s\n", mode[st->pwr_down_mode]); + return st->pwr_down_mode; } -static ssize_t ad5624r_write_powerdown_mode(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) +static int ad5624r_set_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, unsigned int mode) { - struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad5624r_state *st = iio_priv(indio_dev); - int ret; - if (sysfs_streq(buf, "1kohm_to_gnd")) - st->pwr_down_mode = AD5624R_LDAC_PWRDN_1K; - else if (sysfs_streq(buf, "100kohm_to_gnd")) - st->pwr_down_mode = AD5624R_LDAC_PWRDN_100K; - else if (sysfs_streq(buf, "three_state")) - st->pwr_down_mode = AD5624R_LDAC_PWRDN_3STATE; - else - ret = -EINVAL; + st->pwr_down_mode = mode; - return ret ? ret : len; + return 0; } -static ssize_t ad5624r_read_dac_powerdown(struct device *dev, - struct device_attribute *attr, - char *buf) +static const struct iio_enum ad5624r_powerdown_mode_enum = { + .items = ad5624r_powerdown_modes, + .num_items = ARRAY_SIZE(ad5624r_powerdown_modes), + .get = ad5624r_get_powerdown_mode, + .set = ad5624r_set_powerdown_mode, +}; + +static ssize_t ad5624r_read_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, char *buf) { - struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad5624r_state *st = iio_priv(indio_dev); - struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); return sprintf(buf, "%d\n", - !!(st->pwr_down_mask & (1 << this_attr->address))); + !!(st->pwr_down_mask & (1 << chan->channel))); } -static ssize_t ad5624r_write_dac_powerdown(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) +static ssize_t ad5624r_write_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, const char *buf, + size_t len) { long readin; int ret; - struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad5624r_state *st = iio_priv(indio_dev); - struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); ret = strict_strtol(buf, 10, &readin); if (ret) return ret; if (readin == 1) - st->pwr_down_mask |= (1 << this_attr->address); + st->pwr_down_mask |= (1 << chan->channel); else if (!readin) - st->pwr_down_mask &= ~(1 << this_attr->address); + st->pwr_down_mask &= ~(1 << chan->channel); else ret = -EINVAL; @@ -209,47 +154,74 @@ static ssize_t ad5624r_write_dac_powerdown(struct device *dev, return ret ? ret : len; } -static IIO_DEVICE_ATTR(out_voltage_powerdown_mode, S_IRUGO | - S_IWUSR, ad5624r_read_powerdown_mode, - ad5624r_write_powerdown_mode, 0); - -static IIO_CONST_ATTR(out_voltage_powerdown_mode_available, - "1kohm_to_gnd 100kohm_to_gnd three_state"); - -#define IIO_DEV_ATTR_DAC_POWERDOWN(_num, _show, _store, _addr) \ - IIO_DEVICE_ATTR(out_voltage##_num##_powerdown, \ - S_IRUGO | S_IWUSR, _show, _store, _addr) - -static IIO_DEV_ATTR_DAC_POWERDOWN(0, ad5624r_read_dac_powerdown, - ad5624r_write_dac_powerdown, 0); -static IIO_DEV_ATTR_DAC_POWERDOWN(1, ad5624r_read_dac_powerdown, - ad5624r_write_dac_powerdown, 1); -static IIO_DEV_ATTR_DAC_POWERDOWN(2, ad5624r_read_dac_powerdown, - ad5624r_write_dac_powerdown, 2); -static IIO_DEV_ATTR_DAC_POWERDOWN(3, ad5624r_read_dac_powerdown, - ad5624r_write_dac_powerdown, 3); - -static struct attribute *ad5624r_attributes[] = { - &iio_dev_attr_out_voltage0_powerdown.dev_attr.attr, - &iio_dev_attr_out_voltage1_powerdown.dev_attr.attr, - &iio_dev_attr_out_voltage2_powerdown.dev_attr.attr, - &iio_dev_attr_out_voltage3_powerdown.dev_attr.attr, - &iio_dev_attr_out_voltage_powerdown_mode.dev_attr.attr, - &iio_const_attr_out_voltage_powerdown_mode_available.dev_attr.attr, - NULL, -}; - -static const struct attribute_group ad5624r_attribute_group = { - .attrs = ad5624r_attributes, -}; - static const struct iio_info ad5624r_info = { .write_raw = ad5624r_write_raw, .read_raw = ad5624r_read_raw, - .attrs = &ad5624r_attribute_group, .driver_module = THIS_MODULE, }; +static const struct iio_chan_spec_ext_info ad5624r_ext_info[] = { + { + .name = "powerdown", + .read = ad5624r_read_dac_powerdown, + .write = ad5624r_write_dac_powerdown, + }, + IIO_ENUM("powerdown_mode", true, &ad5624r_powerdown_mode_enum), + IIO_ENUM_AVAILABLE("powerdown_mode", &ad5624r_powerdown_mode_enum), + { }, +}; + +#define AD5624R_CHANNEL(_chan, _bits) { \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .output = 1, \ + .channel = (_chan), \ + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ + IIO_CHAN_INFO_SCALE_SHARED_BIT, \ + .address = (_chan), \ + .scan_type = IIO_ST('u', (_bits), 16, 16 - (_bits)), \ + .ext_info = ad5624r_ext_info, \ +} + +#define DECLARE_AD5624R_CHANNELS(_name, _bits) \ + const struct iio_chan_spec _name##_channels[] = { \ + AD5624R_CHANNEL(0, _bits), \ + AD5624R_CHANNEL(1, _bits), \ + AD5624R_CHANNEL(2, _bits), \ + AD5624R_CHANNEL(3, _bits), \ +} + +static DECLARE_AD5624R_CHANNELS(ad5624r, 12); +static DECLARE_AD5624R_CHANNELS(ad5644r, 14); +static DECLARE_AD5624R_CHANNELS(ad5664r, 16); + +static const struct ad5624r_chip_info ad5624r_chip_info_tbl[] = { + [ID_AD5624R3] = { + .channels = ad5624r_channels, + .int_vref_mv = 1250, + }, + [ID_AD5624R5] = { + .channels = ad5624r_channels, + .int_vref_mv = 2500, + }, + [ID_AD5644R3] = { + .channels = ad5644r_channels, + .int_vref_mv = 1250, + }, + [ID_AD5644R5] = { + .channels = ad5644r_channels, + .int_vref_mv = 2500, + }, + [ID_AD5664R3] = { + .channels = ad5664r_channels, + .int_vref_mv = 1250, + }, + [ID_AD5664R5] = { + .channels = ad5664r_channels, + .int_vref_mv = 2500, + }, +}; + static int __devinit ad5624r_probe(struct spi_device *spi) { struct ad5624r_state *st; -- cgit v0.10.2 From fe4586a8753117a089acb54f75870d07c8e474d0 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 Jun 2012 11:36:17 +0200 Subject: staging:iio:dac:ad5686: Convert to extended channel attributes Use extended channel attributes instead of raw sysfs files for the additional channel attributes. This allows us to remove some boilerplate code. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/dac/ad5686.c b/drivers/staging/iio/dac/ad5686.c index c1e903e..f07e197 100644 --- a/drivers/staging/iio/dac/ad5686.c +++ b/drivers/staging/iio/dac/ad5686.c @@ -93,40 +93,6 @@ enum ad5686_supported_device_ids { ID_AD5685, ID_AD5686, }; -#define AD5868_CHANNEL(chan, bits, shift) { \ - .type = IIO_VOLTAGE, \ - .indexed = 1, \ - .output = 1, \ - .channel = chan, \ - .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ - IIO_CHAN_INFO_SCALE_SHARED_BIT, \ - .address = AD5686_ADDR_DAC(chan), \ - .scan_type = IIO_ST('u', bits, 16, shift) \ -} -static const struct ad5686_chip_info ad5686_chip_info_tbl[] = { - [ID_AD5684] = { - .channel[0] = AD5868_CHANNEL(0, 12, 4), - .channel[1] = AD5868_CHANNEL(1, 12, 4), - .channel[2] = AD5868_CHANNEL(2, 12, 4), - .channel[3] = AD5868_CHANNEL(3, 12, 4), - .int_vref_mv = 2500, - }, - [ID_AD5685] = { - .channel[0] = AD5868_CHANNEL(0, 14, 2), - .channel[1] = AD5868_CHANNEL(1, 14, 2), - .channel[2] = AD5868_CHANNEL(2, 14, 2), - .channel[3] = AD5868_CHANNEL(3, 14, 2), - .int_vref_mv = 2500, - }, - [ID_AD5686] = { - .channel[0] = AD5868_CHANNEL(0, 16, 0), - .channel[1] = AD5868_CHANNEL(1, 16, 0), - .channel[2] = AD5868_CHANNEL(2, 16, 0), - .channel[3] = AD5868_CHANNEL(3, 16, 0), - .int_vref_mv = 2500, - }, -}; - static int ad5686_spi_write(struct ad5686_state *st, u8 cmd, u8 addr, u16 val, u8 shift) { @@ -170,73 +136,63 @@ static int ad5686_spi_read(struct ad5686_state *st, u8 addr) return be32_to_cpu(st->data[2].d32); } -static ssize_t ad5686_read_powerdown_mode(struct device *dev, - struct device_attribute *attr, char *buf) +static const char * const ad5686_powerdown_modes[] = { + "1kohm_to_gnd", + "100kohm_to_gnd", + "three_state" +}; + +static int ad5686_get_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan) { - struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad5686_state *st = iio_priv(indio_dev); - struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); - char mode[][15] = {"", "1kohm_to_gnd", "100kohm_to_gnd", "three_state"}; - - return sprintf(buf, "%s\n", mode[(st->pwr_down_mode >> - (this_attr->address * 2)) & 0x3]); + return ((st->pwr_down_mode >> (chan->channel * 2)) & 0x3) - 1; } -static ssize_t ad5686_write_powerdown_mode(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) +static int ad5686_set_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, unsigned int mode) { - struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad5686_state *st = iio_priv(indio_dev); - struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); - unsigned mode; - - if (sysfs_streq(buf, "1kohm_to_gnd")) - mode = AD5686_LDAC_PWRDN_1K; - else if (sysfs_streq(buf, "100kohm_to_gnd")) - mode = AD5686_LDAC_PWRDN_100K; - else if (sysfs_streq(buf, "three_state")) - mode = AD5686_LDAC_PWRDN_3STATE; - else - return -EINVAL; - st->pwr_down_mode &= ~(0x3 << (this_attr->address * 2)); - st->pwr_down_mode |= (mode << (this_attr->address * 2)); + st->pwr_down_mode &= ~(0x3 << (chan->channel * 2)); + st->pwr_down_mode |= ((mode + 1) << (chan->channel * 2)); - return len; + return 0; } -static ssize_t ad5686_read_dac_powerdown(struct device *dev, - struct device_attribute *attr, - char *buf) +static const struct iio_enum ad5686_powerdown_mode_enum = { + .items = ad5686_powerdown_modes, + .num_items = ARRAY_SIZE(ad5686_powerdown_modes), + .get = ad5686_get_powerdown_mode, + .set = ad5686_set_powerdown_mode, +}; + +static ssize_t ad5686_read_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, char *buf) { - struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad5686_state *st = iio_priv(indio_dev); - struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); return sprintf(buf, "%d\n", !!(st->pwr_down_mask & - (0x3 << (this_attr->address * 2)))); + (0x3 << (chan->channel * 2)))); } -static ssize_t ad5686_write_dac_powerdown(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) +static ssize_t ad5686_write_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, const char *buf, + size_t len) { bool readin; int ret; - struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad5686_state *st = iio_priv(indio_dev); - struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); ret = strtobool(buf, &readin); if (ret) return ret; if (readin == true) - st->pwr_down_mask |= (0x3 << (this_attr->address * 2)); + st->pwr_down_mask |= (0x3 << (chan->channel * 2)); else - st->pwr_down_mask &= ~(0x3 << (this_attr->address * 2)); + st->pwr_down_mask &= ~(0x3 << (chan->channel * 2)); ret = ad5686_spi_write(st, AD5686_CMD_POWERDOWN_DAC, 0, st->pwr_down_mask & st->pwr_down_mode, 0); @@ -244,48 +200,6 @@ static ssize_t ad5686_write_dac_powerdown(struct device *dev, return ret ? ret : len; } -static IIO_CONST_ATTR(out_voltage_powerdown_mode_available, - "1kohm_to_gnd 100kohm_to_gnd three_state"); - -#define IIO_DEV_ATTR_DAC_POWERDOWN_MODE(_num) \ - IIO_DEVICE_ATTR(out_voltage##_num##_powerdown_mode, \ - S_IRUGO | S_IWUSR, \ - ad5686_read_powerdown_mode, \ - ad5686_write_powerdown_mode, _num) - -static IIO_DEV_ATTR_DAC_POWERDOWN_MODE(0); -static IIO_DEV_ATTR_DAC_POWERDOWN_MODE(1); -static IIO_DEV_ATTR_DAC_POWERDOWN_MODE(2); -static IIO_DEV_ATTR_DAC_POWERDOWN_MODE(3); - -#define IIO_DEV_ATTR_DAC_POWERDOWN(_num) \ - IIO_DEVICE_ATTR(out_voltage##_num##_powerdown, \ - S_IRUGO | S_IWUSR, \ - ad5686_read_dac_powerdown, \ - ad5686_write_dac_powerdown, _num) - -static IIO_DEV_ATTR_DAC_POWERDOWN(0); -static IIO_DEV_ATTR_DAC_POWERDOWN(1); -static IIO_DEV_ATTR_DAC_POWERDOWN(2); -static IIO_DEV_ATTR_DAC_POWERDOWN(3); - -static struct attribute *ad5686_attributes[] = { - &iio_dev_attr_out_voltage0_powerdown.dev_attr.attr, - &iio_dev_attr_out_voltage1_powerdown.dev_attr.attr, - &iio_dev_attr_out_voltage2_powerdown.dev_attr.attr, - &iio_dev_attr_out_voltage3_powerdown.dev_attr.attr, - &iio_dev_attr_out_voltage0_powerdown_mode.dev_attr.attr, - &iio_dev_attr_out_voltage1_powerdown_mode.dev_attr.attr, - &iio_dev_attr_out_voltage2_powerdown_mode.dev_attr.attr, - &iio_dev_attr_out_voltage3_powerdown_mode.dev_attr.attr, - &iio_const_attr_out_voltage_powerdown_mode_available.dev_attr.attr, - NULL, -}; - -static const struct attribute_group ad5686_attribute_group = { - .attrs = ad5686_attributes, -}; - static int ad5686_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val, @@ -349,10 +263,57 @@ static int ad5686_write_raw(struct iio_dev *indio_dev, static const struct iio_info ad5686_info = { .read_raw = ad5686_read_raw, .write_raw = ad5686_write_raw, - .attrs = &ad5686_attribute_group, .driver_module = THIS_MODULE, }; +static const struct iio_chan_spec_ext_info ad5686_ext_info[] = { + { + .name = "powerdown", + .read = ad5686_read_dac_powerdown, + .write = ad5686_write_dac_powerdown, + }, + IIO_ENUM("powerdown_mode", false, &ad5686_powerdown_mode_enum), + IIO_ENUM_AVAILABLE("powerdown_mode", &ad5686_powerdown_mode_enum), + { }, +}; + +#define AD5868_CHANNEL(chan, bits, shift) { \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .output = 1, \ + .channel = chan, \ + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ + IIO_CHAN_INFO_SCALE_SHARED_BIT, \ + .address = AD5686_ADDR_DAC(chan), \ + .scan_type = IIO_ST('u', bits, 16, shift), \ + .ext_info = ad5686_ext_info, \ +} + +static const struct ad5686_chip_info ad5686_chip_info_tbl[] = { + [ID_AD5684] = { + .channel[0] = AD5868_CHANNEL(0, 12, 4), + .channel[1] = AD5868_CHANNEL(1, 12, 4), + .channel[2] = AD5868_CHANNEL(2, 12, 4), + .channel[3] = AD5868_CHANNEL(3, 12, 4), + .int_vref_mv = 2500, + }, + [ID_AD5685] = { + .channel[0] = AD5868_CHANNEL(0, 14, 2), + .channel[1] = AD5868_CHANNEL(1, 14, 2), + .channel[2] = AD5868_CHANNEL(2, 14, 2), + .channel[3] = AD5868_CHANNEL(3, 14, 2), + .int_vref_mv = 2500, + }, + [ID_AD5686] = { + .channel[0] = AD5868_CHANNEL(0, 16, 0), + .channel[1] = AD5868_CHANNEL(1, 16, 0), + .channel[2] = AD5868_CHANNEL(2, 16, 0), + .channel[3] = AD5868_CHANNEL(3, 16, 0), + .int_vref_mv = 2500, + }, +}; + + static int __devinit ad5686_probe(struct spi_device *spi) { struct ad5686_state *st; @@ -385,6 +346,9 @@ static int __devinit ad5686_probe(struct spi_device *spi) st->spi = spi; + /* Set all the power down mode for all channels to 1K pulldown */ + st->pwr_down_mode = 0x55; + indio_dev->dev.parent = &spi->dev; indio_dev->name = spi_get_device_id(spi)->name; indio_dev->info = &ad5686_info; -- cgit v0.10.2 From 4571b39b0b08ff855707011c6f7fa04ceb43e5ca Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 Jun 2012 11:36:18 +0200 Subject: staging:iio:dac:ad5791: Convert to extended channel attributes Use extended channel attributes instead of raw sysfs files for the additional channel attributes. This allows us to remove some boilerplate code. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/dac/ad5791.c b/drivers/staging/iio/dac/ad5791.c index 13d8b5b..ad33725 100644 --- a/drivers/staging/iio/dac/ad5791.c +++ b/drivers/staging/iio/dac/ad5791.c @@ -72,71 +72,50 @@ static int ad5791_spi_read(struct spi_device *spi, u8 addr, u32 *val) return ret; } -#define AD5791_CHAN(bits, shift) { \ - .type = IIO_VOLTAGE, \ - .output = 1, \ - .indexed = 1, \ - .address = AD5791_ADDR_DAC0, \ - .channel = 0, \ - .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ - IIO_CHAN_INFO_SCALE_SHARED_BIT | \ - IIO_CHAN_INFO_OFFSET_SHARED_BIT, \ - .scan_type = IIO_ST('u', bits, 24, shift) \ -} - -static const struct iio_chan_spec ad5791_channels[] = { - [ID_AD5760] = AD5791_CHAN(16, 4), - [ID_AD5780] = AD5791_CHAN(18, 2), - [ID_AD5781] = AD5791_CHAN(18, 2), - [ID_AD5791] = AD5791_CHAN(20, 0) +static const char * const ad5791_powerdown_modes[] = { + "6kohm_to_gnd", + "three_state", }; -static ssize_t ad5791_read_powerdown_mode(struct device *dev, - struct device_attribute *attr, char *buf) +static int ad5791_get_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan) { - struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad5791_state *st = iio_priv(indio_dev); - const char mode[][14] = {"6kohm_to_gnd", "three_state"}; - - return sprintf(buf, "%s\n", mode[st->pwr_down_mode]); + return st->pwr_down_mode; } -static ssize_t ad5791_write_powerdown_mode(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) +static int ad5791_set_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, unsigned int mode) { - struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad5791_state *st = iio_priv(indio_dev); - int ret; - if (sysfs_streq(buf, "6kohm_to_gnd")) - st->pwr_down_mode = AD5791_DAC_PWRDN_6K; - else if (sysfs_streq(buf, "three_state")) - st->pwr_down_mode = AD5791_DAC_PWRDN_3STATE; - else - ret = -EINVAL; + st->pwr_down_mode = mode; - return ret ? ret : len; + return 0; } -static ssize_t ad5791_read_dac_powerdown(struct device *dev, - struct device_attribute *attr, - char *buf) +static const struct iio_enum ad5791_powerdown_mode_enum = { + .items = ad5791_powerdown_modes, + .num_items = ARRAY_SIZE(ad5791_powerdown_modes), + .get = ad5791_get_powerdown_mode, + .set = ad5791_set_powerdown_mode, +}; + +static ssize_t ad5791_read_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, char *buf) { - struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad5791_state *st = iio_priv(indio_dev); return sprintf(buf, "%d\n", st->pwr_down); } -static ssize_t ad5791_write_dac_powerdown(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) +static ssize_t ad5791_write_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, const char *buf, + size_t len) { long readin; int ret; - struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad5791_state *st = iio_priv(indio_dev); ret = strict_strtol(buf, 10, &readin); @@ -160,31 +139,6 @@ static ssize_t ad5791_write_dac_powerdown(struct device *dev, return ret ? ret : len; } -static IIO_DEVICE_ATTR(out_voltage_powerdown_mode, S_IRUGO | - S_IWUSR, ad5791_read_powerdown_mode, - ad5791_write_powerdown_mode, 0); - -static IIO_CONST_ATTR(out_voltage_powerdown_mode_available, - "6kohm_to_gnd three_state"); - -#define IIO_DEV_ATTR_DAC_POWERDOWN(_num, _show, _store, _addr) \ - IIO_DEVICE_ATTR(out_voltage##_num##_powerdown, \ - S_IRUGO | S_IWUSR, _show, _store, _addr) - -static IIO_DEV_ATTR_DAC_POWERDOWN(0, ad5791_read_dac_powerdown, - ad5791_write_dac_powerdown, 0); - -static struct attribute *ad5791_attributes[] = { - &iio_dev_attr_out_voltage0_powerdown.dev_attr.attr, - &iio_dev_attr_out_voltage_powerdown_mode.dev_attr.attr, - &iio_const_attr_out_voltage_powerdown_mode_available.dev_attr.attr, - NULL, -}; - -static const struct attribute_group ad5791_attribute_group = { - .attrs = ad5791_attributes, -}; - static int ad5791_get_lin_comp(unsigned int span) { if (span <= 10000) @@ -254,6 +208,37 @@ static int ad5791_read_raw(struct iio_dev *indio_dev, }; +static const struct iio_chan_spec_ext_info ad5791_ext_info[] = { + { + .name = "powerdown", + .shared = true, + .read = ad5791_read_dac_powerdown, + .write = ad5791_write_dac_powerdown, + }, + IIO_ENUM("powerdown_mode", true, &ad5791_powerdown_mode_enum), + IIO_ENUM_AVAILABLE("powerdown_mode", &ad5791_powerdown_mode_enum), + { }, +}; + +#define AD5791_CHAN(bits, shift) { \ + .type = IIO_VOLTAGE, \ + .output = 1, \ + .indexed = 1, \ + .address = AD5791_ADDR_DAC0, \ + .channel = 0, \ + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ + IIO_CHAN_INFO_SCALE_SHARED_BIT | \ + IIO_CHAN_INFO_OFFSET_SHARED_BIT, \ + .scan_type = IIO_ST('u', bits, 24, shift), \ + .ext_info = ad5791_ext_info, \ +} + +static const struct iio_chan_spec ad5791_channels[] = { + [ID_AD5760] = AD5791_CHAN(16, 4), + [ID_AD5780] = AD5791_CHAN(18, 2), + [ID_AD5781] = AD5791_CHAN(18, 2), + [ID_AD5791] = AD5791_CHAN(20, 0) +}; static int ad5791_write_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, @@ -278,7 +263,6 @@ static int ad5791_write_raw(struct iio_dev *indio_dev, static const struct iio_info ad5791_info = { .read_raw = &ad5791_read_raw, .write_raw = &ad5791_write_raw, - .attrs = &ad5791_attribute_group, .driver_module = THIS_MODULE, }; -- cgit v0.10.2 From cadb695113f6f30b0a19a0437dbcf000e1d3419a Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 Jun 2012 11:36:19 +0200 Subject: staging:iio:dac: Remove unused dac.h includes None of these drivers use anything from dac.h, so remove the include. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/dac/ad5064.c b/drivers/staging/iio/dac/ad5064.c index 2394f05..276af02 100644 --- a/drivers/staging/iio/dac/ad5064.c +++ b/drivers/staging/iio/dac/ad5064.c @@ -18,7 +18,6 @@ #include #include -#include "dac.h" #define AD5064_MAX_DAC_CHANNELS 8 #define AD5064_MAX_VREFS 4 diff --git a/drivers/staging/iio/dac/ad5360.c b/drivers/staging/iio/dac/ad5360.c index 38660ef..8fce84f 100644 --- a/drivers/staging/iio/dac/ad5360.c +++ b/drivers/staging/iio/dac/ad5360.c @@ -18,7 +18,6 @@ #include #include -#include "dac.h" #define AD5360_CMD(x) ((x) << 22) #define AD5360_ADDR(x) ((x) << 16) diff --git a/drivers/staging/iio/dac/ad5380.c b/drivers/staging/iio/dac/ad5380.c index 7a35cc6..5dfb445 100644 --- a/drivers/staging/iio/dac/ad5380.c +++ b/drivers/staging/iio/dac/ad5380.c @@ -20,8 +20,6 @@ #include #include -#include "dac.h" - #define AD5380_REG_DATA(x) (((x) << 2) | 3) #define AD5380_REG_OFFSET(x) (((x) << 2) | 2) diff --git a/drivers/staging/iio/dac/ad5421.c b/drivers/staging/iio/dac/ad5421.c index ffbd4c2..ea2f83b 100644 --- a/drivers/staging/iio/dac/ad5421.c +++ b/drivers/staging/iio/dac/ad5421.c @@ -19,7 +19,6 @@ #include #include #include -#include "dac.h" #include "ad5421.h" diff --git a/drivers/staging/iio/dac/ad5446.c b/drivers/staging/iio/dac/ad5446.c index 1774f7f..49f557f 100644 --- a/drivers/staging/iio/dac/ad5446.c +++ b/drivers/staging/iio/dac/ad5446.c @@ -20,7 +20,6 @@ #include #include -#include "dac.h" #include "ad5446.h" diff --git a/drivers/staging/iio/dac/ad5504.c b/drivers/staging/iio/dac/ad5504.c index acb1d59..331b536 100644 --- a/drivers/staging/iio/dac/ad5504.c +++ b/drivers/staging/iio/dac/ad5504.c @@ -19,7 +19,7 @@ #include #include #include -#include "dac.h" + #include "ad5504.h" static int ad5504_spi_write(struct spi_device *spi, u8 addr, u16 val) diff --git a/drivers/staging/iio/dac/ad5624r_spi.c b/drivers/staging/iio/dac/ad5624r_spi.c index 4c95eae..7524f96 100644 --- a/drivers/staging/iio/dac/ad5624r_spi.c +++ b/drivers/staging/iio/dac/ad5624r_spi.c @@ -18,7 +18,7 @@ #include #include -#include "dac.h" + #include "ad5624r.h" static int ad5624r_spi_write(struct spi_device *spi, diff --git a/drivers/staging/iio/dac/ad5686.c b/drivers/staging/iio/dac/ad5686.c index f07e197..6948d75 100644 --- a/drivers/staging/iio/dac/ad5686.c +++ b/drivers/staging/iio/dac/ad5686.c @@ -18,7 +18,6 @@ #include #include -#include "dac.h" #define AD5686_DAC_CHANNELS 4 diff --git a/drivers/staging/iio/dac/ad5764.c b/drivers/staging/iio/dac/ad5764.c index 03dbd93..ffce304 100644 --- a/drivers/staging/iio/dac/ad5764.c +++ b/drivers/staging/iio/dac/ad5764.c @@ -18,7 +18,6 @@ #include #include -#include "dac.h" #define AD5764_REG_SF_NOP 0x0 #define AD5764_REG_SF_CONFIG 0x1 diff --git a/drivers/staging/iio/dac/ad5791.c b/drivers/staging/iio/dac/ad5791.c index ad33725..4e955ed9 100644 --- a/drivers/staging/iio/dac/ad5791.c +++ b/drivers/staging/iio/dac/ad5791.c @@ -19,7 +19,7 @@ #include #include -#include "dac.h" + #include "ad5791.h" static int ad5791_spi_write(struct spi_device *spi, u8 addr, u32 val) -- cgit v0.10.2 From 4cd8d87446d521b7824aa1be84d767c8b5300601 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 Jun 2012 11:36:20 +0200 Subject: staging:iio:dac:max517: Convert to channel spec Convert the max517 driver to channel spec. As part of the conversion the "out_voltage_1&2_raw" property, which updates both channel 1 and 2 simultaneously with the same value, is lost, since this is not really covered by the IIO spec and has only a limited use case in practice. Also the channel index for the sysfs files is now zero based instead of one based, which means all channel numbers will be lower by one. E.g. "out_voltage_1_scale" instead of "out_voltage_2_scale" Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Acked-by: Roland Stigge Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/dac/max517.c b/drivers/staging/iio/dac/max517.c index 5287cad..403e06f 100644 --- a/drivers/staging/iio/dac/max517.c +++ b/drivers/staging/iio/dac/max517.c @@ -27,7 +27,6 @@ #include #include -#include "dac.h" #include "max517.h" @@ -55,129 +54,67 @@ struct max517_data { * bit 1: channel 2 * (this way, it's possible to set both channels at once) */ -static ssize_t max517_set_value(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count, int channel) +static int max517_set_value(struct iio_dev *indio_dev, + long val, int channel) { - struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct max517_data *data = iio_priv(indio_dev); struct i2c_client *client = data->client; - u8 outbuf[4]; /* 1x or 2x command + value */ - int outbuf_size = 0; + u8 outbuf[2]; int res; - long val; - - res = strict_strtol(buf, 10, &val); - - if (res) - return res; if (val < 0 || val > 255) return -EINVAL; - if (channel & 1) { - outbuf[outbuf_size++] = COMMAND_CHANNEL0; - outbuf[outbuf_size++] = val; - } - if (channel & 2) { - outbuf[outbuf_size++] = COMMAND_CHANNEL1; - outbuf[outbuf_size++] = val; - } + outbuf[0] = channel; + outbuf[1] = val; - /* - * At this point, there are always 1 or 2 two-byte commands in - * outbuf. With 2 commands, the device can set two outputs - * simultaneously, latching the values upon the end of the I2C - * transfer. - */ - - res = i2c_master_send(client, outbuf, outbuf_size); + res = i2c_master_send(client, outbuf, 2); if (res < 0) return res; - - return count; -} - -static ssize_t max517_set_value_1(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - return max517_set_value(dev, attr, buf, count, 1); -} -static IIO_DEV_ATTR_OUT_RAW(1, max517_set_value_1, 0); - -static ssize_t max517_set_value_2(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - return max517_set_value(dev, attr, buf, count, 2); -} -static IIO_DEV_ATTR_OUT_RAW(2, max517_set_value_2, 1); - -static ssize_t max517_set_value_both(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - return max517_set_value(dev, attr, buf, count, 3); + else if (res != 2) + return -EIO; + else + return 0; } -static IIO_DEVICE_ATTR_NAMED(out_voltage1and2_raw, - out_voltage1&2_raw, S_IWUSR, NULL, - max517_set_value_both, -1); -static ssize_t max517_show_scale(struct device *dev, - struct device_attribute *attr, - char *buf, int channel) +static int max517_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, + int *val2, + long m) { - struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct max517_data *data = iio_priv(indio_dev); - /* Corresponds to Vref / 2^(bits) */ - unsigned int scale_uv = (data->vref_mv[channel - 1] * 1000) >> 8; - - return sprintf(buf, "%d.%03d\n", scale_uv / 1000, scale_uv % 1000); + unsigned int scale_uv; + + switch (m) { + case IIO_CHAN_INFO_SCALE: + /* Corresponds to Vref / 2^(bits) */ + scale_uv = (data->vref_mv[chan->channel] * 1000) >> 8; + *val = scale_uv / 1000000; + *val2 = scale_uv % 1000000; + return IIO_VAL_INT_PLUS_MICRO; + default: + break; + } + return -EINVAL; } -static ssize_t max517_show_scale1(struct device *dev, - struct device_attribute *attr, - char *buf) +static int max517_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int val, int val2, long mask) { - return max517_show_scale(dev, attr, buf, 1); -} -static IIO_DEVICE_ATTR(out_voltage1_scale, S_IRUGO, - max517_show_scale1, NULL, 0); + int ret; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + ret = max517_set_value(indio_dev, val, chan->channel); + break; + default: + ret = -EINVAL; + break; + } -static ssize_t max517_show_scale2(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - return max517_show_scale(dev, attr, buf, 2); + return ret; } -static IIO_DEVICE_ATTR(out_voltage2_scale, S_IRUGO, - max517_show_scale2, NULL, 0); - -/* On MAX517 variant, we have one output */ -static struct attribute *max517_attributes[] = { - &iio_dev_attr_out_voltage1_raw.dev_attr.attr, - &iio_dev_attr_out_voltage1_scale.dev_attr.attr, - NULL -}; - -static struct attribute_group max517_attribute_group = { - .attrs = max517_attributes, -}; - -/* On MAX518 and MAX519 variant, we have two outputs */ -static struct attribute *max518_attributes[] = { - &iio_dev_attr_out_voltage1_raw.dev_attr.attr, - &iio_dev_attr_out_voltage1_scale.dev_attr.attr, - &iio_dev_attr_out_voltage2_raw.dev_attr.attr, - &iio_dev_attr_out_voltage2_scale.dev_attr.attr, - &iio_dev_attr_out_voltage1and2_raw.dev_attr.attr, - NULL -}; - -static struct attribute_group max518_attribute_group = { - .attrs = max518_attributes, -}; #ifdef CONFIG_PM_SLEEP static int max517_suspend(struct device *dev) @@ -201,13 +138,24 @@ static SIMPLE_DEV_PM_OPS(max517_pm_ops, max517_suspend, max517_resume); #endif static const struct iio_info max517_info = { - .attrs = &max517_attribute_group, + .read_raw = max517_read_raw, + .write_raw = max517_write_raw, .driver_module = THIS_MODULE, }; -static const struct iio_info max518_info = { - .attrs = &max518_attribute_group, - .driver_module = THIS_MODULE, +#define MAX517_CHANNEL(chan) { \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .output = 1, \ + .channel = (chan), \ + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ + IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \ + .scan_type = IIO_ST('u', 8, 8, 0), \ +} + +static const struct iio_chan_spec max517_channels[] = { + MAX517_CHANNEL(0), + MAX517_CHANNEL(1) }; static int max517_probe(struct i2c_client *client, @@ -230,12 +178,14 @@ static int max517_probe(struct i2c_client *client, /* establish that the iio_dev is a child of the i2c device */ indio_dev->dev.parent = &client->dev; - /* reduced attribute set for MAX517 */ + /* reduced channel set for MAX517 */ if (id->driver_data == ID_MAX517) - indio_dev->info = &max517_info; + indio_dev->num_channels = 1; else - indio_dev->info = &max518_info; + indio_dev->num_channels = 2; + indio_dev->channels = max517_channels; indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->info = &max517_info; /* * Reference voltage on MAX518 and default is 5V, else take vref_mv -- cgit v0.10.2 From 159fe695ae2ad53b915465f30ddd0fbc7f014900 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 Jun 2012 11:36:21 +0200 Subject: staging:iio:dac: Remove dac.h Now that all drivers have been converted to channel spec, we can finally remove the dac.h file since it is no longer used. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/dac/dac.h b/drivers/staging/iio/dac/dac.h deleted file mode 100644 index 0754d71..0000000 --- a/drivers/staging/iio/dac/dac.h +++ /dev/null @@ -1,6 +0,0 @@ -/* - * dac.h - sysfs attributes associated with DACs - */ - -#define IIO_DEV_ATTR_OUT_RAW(_num, _store, _addr) \ - IIO_DEVICE_ATTR(out_voltage##_num##_raw, S_IWUSR, NULL, _store, _addr) -- cgit v0.10.2 From 3bbbf150ffde2ca48249537d2d9e4b52bc0a5fc8 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 Jun 2012 11:36:22 +0200 Subject: staging:iio:dac:ad5504: Use strtobool for boolean values Use strtobool for parsing the powerdown value instead of strict_strtol, since the powerdown attribute is a boolean value. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/dac/ad5504.c b/drivers/staging/iio/dac/ad5504.c index 331b536..220150d 100644 --- a/drivers/staging/iio/dac/ad5504.c +++ b/drivers/staging/iio/dac/ad5504.c @@ -147,20 +147,18 @@ static ssize_t ad5504_write_dac_powerdown(struct iio_dev *indio_dev, uintptr_t private, const struct iio_chan_spec *chan, const char *buf, size_t len) { - long readin; + bool pwr_down; int ret; struct ad5504_state *st = iio_priv(indio_dev); - ret = strict_strtol(buf, 10, &readin); + ret = strtobool(buf, &pwr_down); if (ret) return ret; - if (readin == 0) + if (pwr_down) st->pwr_down_mask |= (1 << chan->channel); - else if (readin == 1) - st->pwr_down_mask &= ~(1 << chan->channel); else - ret = -EINVAL; + st->pwr_down_mask &= ~(1 << chan->channel); ret = ad5504_spi_write(st->spi, AD5504_ADDR_CTRL, AD5504_DAC_PWRDWN_MODE(st->pwr_down_mode) | -- cgit v0.10.2 From 2490594e89c7286585daeaf05a06b6cd7b5c8876 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 Jun 2012 11:36:23 +0200 Subject: staging:iio:dac:ad5624r: Use strtobool for boolean values Use strtobool for parsing the powerdown value instead of strict_strtol, since the powerdown attribute is a boolean value. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/dac/ad5624r_spi.c b/drivers/staging/iio/dac/ad5624r_spi.c index 7524f96..6a7d6a4 100644 --- a/drivers/staging/iio/dac/ad5624r_spi.c +++ b/drivers/staging/iio/dac/ad5624r_spi.c @@ -132,20 +132,18 @@ static ssize_t ad5624r_write_dac_powerdown(struct iio_dev *indio_dev, uintptr_t private, const struct iio_chan_spec *chan, const char *buf, size_t len) { - long readin; + bool pwr_down; int ret; struct ad5624r_state *st = iio_priv(indio_dev); - ret = strict_strtol(buf, 10, &readin); + ret = strtobool(buf, &pwr_down); if (ret) return ret; - if (readin == 1) + if (pwr_down) st->pwr_down_mask |= (1 << chan->channel); - else if (!readin) - st->pwr_down_mask &= ~(1 << chan->channel); else - ret = -EINVAL; + st->pwr_down_mask &= ~(1 << chan->channel); ret = ad5624r_spi_write(st->us, AD5624R_CMD_POWERDOWN_DAC, 0, (st->pwr_down_mode << 4) | -- cgit v0.10.2 From 4468cb552536731fd85f22a367602e9242a55376 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 Jun 2012 11:36:24 +0200 Subject: staging:iio:dac:ad5791: Use strtobool for boolean values Use strtobool for parsing the powerdown value instead of strict_strtol, since the powerdown attribute is a boolean value. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/dac/ad5791.c b/drivers/staging/iio/dac/ad5791.c index 4e955ed9..82b51a7 100644 --- a/drivers/staging/iio/dac/ad5791.c +++ b/drivers/staging/iio/dac/ad5791.c @@ -114,25 +114,23 @@ static ssize_t ad5791_write_dac_powerdown(struct iio_dev *indio_dev, uintptr_t private, const struct iio_chan_spec *chan, const char *buf, size_t len) { - long readin; + bool pwr_down; int ret; struct ad5791_state *st = iio_priv(indio_dev); - ret = strict_strtol(buf, 10, &readin); + ret = strtobool(buf, &pwr_down); if (ret) return ret; - if (readin == 0) { - st->pwr_down = false; + if (!pwr_down) { st->ctrl &= ~(AD5791_CTRL_OPGND | AD5791_CTRL_DACTRI); - } else if (readin == 1) { - st->pwr_down = true; + } else { if (st->pwr_down_mode == AD5791_DAC_PWRDN_6K) st->ctrl |= AD5791_CTRL_OPGND; else if (st->pwr_down_mode == AD5791_DAC_PWRDN_3STATE) st->ctrl |= AD5791_CTRL_DACTRI; - } else - ret = -EINVAL; + } + st->pwr_down = pwr_down; ret = ad5791_spi_write(st->spi, AD5791_ADDR_CTRL, st->ctrl); -- cgit v0.10.2 From 4f0a788dc892d62fabcfd61b289b6212bdedadfd Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 Jun 2012 11:36:25 +0200 Subject: staging:iio:dac:ad5504: Check if IRQ was requested before freeing it IRQ support is optional, so we have to check whether it was actually requested before we attempt to free it. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/dac/ad5504.c b/drivers/staging/iio/dac/ad5504.c index 220150d..f3d7b47 100644 --- a/drivers/staging/iio/dac/ad5504.c +++ b/drivers/staging/iio/dac/ad5504.c @@ -294,7 +294,8 @@ static int __devinit ad5504_probe(struct spi_device *spi) return 0; error_free_irq: - free_irq(spi->irq, indio_dev); + if (spi->irq) + free_irq(spi->irq, indio_dev); error_disable_reg: if (!IS_ERR(reg)) regulator_disable(reg); -- cgit v0.10.2 From a98348b74ec2c4c5cda0f14d38ff19e08fc4e4bf Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 Jun 2012 11:36:26 +0200 Subject: staging:iio:dac:ad5504: Move private structs and defines from header to C file The header for this driver contains some private structs and defines, which do not have to be shared between multiple source files, as well as the platform data struct for this driver, which has to be shared with other source files. Since there is no need to expose those private structs and defines move them to the source file. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/dac/ad5504.c b/drivers/staging/iio/dac/ad5504.c index f3d7b47..1289e9b 100644 --- a/drivers/staging/iio/dac/ad5504.c +++ b/drivers/staging/iio/dac/ad5504.c @@ -22,6 +22,51 @@ #include "ad5504.h" +#define AD5505_BITS 12 +#define AD5504_RES_MASK ((1 << (AD5505_BITS)) - 1) + +#define AD5504_CMD_READ (1 << 15) +#define AD5504_CMD_WRITE (0 << 15) +#define AD5504_ADDR(addr) ((addr) << 12) + +/* Registers */ +#define AD5504_ADDR_NOOP 0 +#define AD5504_ADDR_DAC(x) ((x) + 1) +#define AD5504_ADDR_ALL_DAC 5 +#define AD5504_ADDR_CTRL 7 + +/* Control Register */ +#define AD5504_DAC_PWR(ch) ((ch) << 2) +#define AD5504_DAC_PWRDWN_MODE(mode) ((mode) << 6) +#define AD5504_DAC_PWRDN_20K 0 +#define AD5504_DAC_PWRDN_3STATE 1 + +/** + * struct ad5446_state - driver instance specific data + * @us: spi_device + * @reg: supply regulator + * @vref_mv: actual reference voltage used + * @pwr_down_mask power down mask + * @pwr_down_mode current power down mode + */ + +struct ad5504_state { + struct spi_device *spi; + struct regulator *reg; + unsigned short vref_mv; + unsigned pwr_down_mask; + unsigned pwr_down_mode; +}; + +/** + * ad5504_supported_device_ids: + */ + +enum ad5504_supported_device_ids { + ID_AD5504, + ID_AD5501, +}; + static int ad5504_spi_write(struct spi_device *spi, u8 addr, u16 val) { u16 tmp = cpu_to_be16(AD5504_CMD_WRITE | diff --git a/drivers/staging/iio/dac/ad5504.h b/drivers/staging/iio/dac/ad5504.h index afe0952..d4980bf 100644 --- a/drivers/staging/iio/dac/ad5504.h +++ b/drivers/staging/iio/dac/ad5504.h @@ -9,25 +9,6 @@ #ifndef SPI_AD5504_H_ #define SPI_AD5504_H_ -#define AD5505_BITS 12 -#define AD5504_RES_MASK ((1 << (AD5505_BITS)) - 1) - -#define AD5504_CMD_READ (1 << 15) -#define AD5504_CMD_WRITE (0 << 15) -#define AD5504_ADDR(addr) ((addr) << 12) - -/* Registers */ -#define AD5504_ADDR_NOOP 0 -#define AD5504_ADDR_DAC(x) ((x) + 1) -#define AD5504_ADDR_ALL_DAC 5 -#define AD5504_ADDR_CTRL 7 - -/* Control Register */ -#define AD5504_DAC_PWR(ch) ((ch) << 2) -#define AD5504_DAC_PWRDWN_MODE(mode) ((mode) << 6) -#define AD5504_DAC_PWRDN_20K 0 -#define AD5504_DAC_PWRDN_3STATE 1 - /* * TODO: struct ad5504_platform_data needs to go into include/linux/iio */ @@ -36,30 +17,4 @@ struct ad5504_platform_data { u16 vref_mv; }; -/** - * struct ad5446_state - driver instance specific data - * @us: spi_device - * @reg: supply regulator - * @vref_mv: actual reference voltage used - * @pwr_down_mask power down mask - * @pwr_down_mode current power down mode - */ - -struct ad5504_state { - struct spi_device *spi; - struct regulator *reg; - unsigned short vref_mv; - unsigned pwr_down_mask; - unsigned pwr_down_mode; -}; - -/** - * ad5504_supported_device_ids: - */ - -enum ad5504_supported_device_ids { - ID_AD5504, - ID_AD5501, -}; - #endif /* SPI_AD5504_H_ */ -- cgit v0.10.2 From 20374d1a36df3e20cd6742ba376684e5506254a8 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 Jun 2012 11:36:27 +0200 Subject: staging:iio:dac:ad5791: Move private structs and defines from header to C file The header for this driver contains some private structs and defines, which do not have to be shared between multiple source files, as well as the platform data struct for this driver, which has to be shared with other source files. Since there is no need to expose those private structs and defines move them to the source file. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/dac/ad5791.c b/drivers/staging/iio/dac/ad5791.c index 82b51a7..5de28c2 100644 --- a/drivers/staging/iio/dac/ad5791.c +++ b/drivers/staging/iio/dac/ad5791.c @@ -22,6 +22,89 @@ #include "ad5791.h" +#define AD5791_RES_MASK(x) ((1 << (x)) - 1) +#define AD5791_DAC_MASK AD5791_RES_MASK(20) +#define AD5791_DAC_MSB (1 << 19) + +#define AD5791_CMD_READ (1 << 23) +#define AD5791_CMD_WRITE (0 << 23) +#define AD5791_ADDR(addr) ((addr) << 20) + +/* Registers */ +#define AD5791_ADDR_NOOP 0 +#define AD5791_ADDR_DAC0 1 +#define AD5791_ADDR_CTRL 2 +#define AD5791_ADDR_CLRCODE 3 +#define AD5791_ADDR_SW_CTRL 4 + +/* Control Register */ +#define AD5791_CTRL_RBUF (1 << 1) +#define AD5791_CTRL_OPGND (1 << 2) +#define AD5791_CTRL_DACTRI (1 << 3) +#define AD5791_CTRL_BIN2SC (1 << 4) +#define AD5791_CTRL_SDODIS (1 << 5) +#define AD5761_CTRL_LINCOMP(x) ((x) << 6) + +#define AD5791_LINCOMP_0_10 0 +#define AD5791_LINCOMP_10_12 1 +#define AD5791_LINCOMP_12_16 2 +#define AD5791_LINCOMP_16_19 3 +#define AD5791_LINCOMP_19_20 12 + +#define AD5780_LINCOMP_0_10 0 +#define AD5780_LINCOMP_10_20 12 + +/* Software Control Register */ +#define AD5791_SWCTRL_LDAC (1 << 0) +#define AD5791_SWCTRL_CLR (1 << 1) +#define AD5791_SWCTRL_RESET (1 << 2) + +#define AD5791_DAC_PWRDN_6K 0 +#define AD5791_DAC_PWRDN_3STATE 1 + +/** + * struct ad5791_chip_info - chip specific information + * @get_lin_comp: function pointer to the device specific function + */ + +struct ad5791_chip_info { + int (*get_lin_comp) (unsigned int span); +}; + +/** + * struct ad5791_state - driver instance specific data + * @us: spi_device + * @reg_vdd: positive supply regulator + * @reg_vss: negative supply regulator + * @chip_info: chip model specific constants + * @vref_mv: actual reference voltage used + * @vref_neg_mv: voltage of the negative supply + * @pwr_down_mode current power down mode + */ + +struct ad5791_state { + struct spi_device *spi; + struct regulator *reg_vdd; + struct regulator *reg_vss; + const struct ad5791_chip_info *chip_info; + unsigned short vref_mv; + unsigned int vref_neg_mv; + unsigned ctrl; + unsigned pwr_down_mode; + bool pwr_down; +}; + +/** + * ad5791_supported_device_ids: + */ + +enum ad5791_supported_device_ids { + ID_AD5760, + ID_AD5780, + ID_AD5781, + ID_AD5791, +}; + static int ad5791_spi_write(struct spi_device *spi, u8 addr, u32 val) { union { diff --git a/drivers/staging/iio/dac/ad5791.h b/drivers/staging/iio/dac/ad5791.h index fd7edbd..87a6c92 100644 --- a/drivers/staging/iio/dac/ad5791.h +++ b/drivers/staging/iio/dac/ad5791.h @@ -9,46 +9,6 @@ #ifndef SPI_AD5791_H_ #define SPI_AD5791_H_ -#define AD5791_RES_MASK(x) ((1 << (x)) - 1) -#define AD5791_DAC_MASK AD5791_RES_MASK(20) -#define AD5791_DAC_MSB (1 << 19) - -#define AD5791_CMD_READ (1 << 23) -#define AD5791_CMD_WRITE (0 << 23) -#define AD5791_ADDR(addr) ((addr) << 20) - -/* Registers */ -#define AD5791_ADDR_NOOP 0 -#define AD5791_ADDR_DAC0 1 -#define AD5791_ADDR_CTRL 2 -#define AD5791_ADDR_CLRCODE 3 -#define AD5791_ADDR_SW_CTRL 4 - -/* Control Register */ -#define AD5791_CTRL_RBUF (1 << 1) -#define AD5791_CTRL_OPGND (1 << 2) -#define AD5791_CTRL_DACTRI (1 << 3) -#define AD5791_CTRL_BIN2SC (1 << 4) -#define AD5791_CTRL_SDODIS (1 << 5) -#define AD5761_CTRL_LINCOMP(x) ((x) << 6) - -#define AD5791_LINCOMP_0_10 0 -#define AD5791_LINCOMP_10_12 1 -#define AD5791_LINCOMP_12_16 2 -#define AD5791_LINCOMP_16_19 3 -#define AD5791_LINCOMP_19_20 12 - -#define AD5780_LINCOMP_0_10 0 -#define AD5780_LINCOMP_10_20 12 - -/* Software Control Register */ -#define AD5791_SWCTRL_LDAC (1 << 0) -#define AD5791_SWCTRL_CLR (1 << 1) -#define AD5791_SWCTRL_RESET (1 << 2) - -#define AD5791_DAC_PWRDN_6K 0 -#define AD5791_DAC_PWRDN_3STATE 1 - /* * TODO: struct ad5791_platform_data needs to go into include/linux/iio */ @@ -66,47 +26,4 @@ struct ad5791_platform_data { bool use_rbuf_gain2; }; -/** - * struct ad5791_chip_info - chip specific information - * @get_lin_comp: function pointer to the device specific function - */ - -struct ad5791_chip_info { - int (*get_lin_comp) (unsigned int span); -}; - -/** - * struct ad5791_state - driver instance specific data - * @us: spi_device - * @reg_vdd: positive supply regulator - * @reg_vss: negative supply regulator - * @chip_info: chip model specific constants - * @vref_mv: actual reference voltage used - * @vref_neg_mv: voltage of the negative supply - * @pwr_down_mode current power down mode - */ - -struct ad5791_state { - struct spi_device *spi; - struct regulator *reg_vdd; - struct regulator *reg_vss; - const struct ad5791_chip_info *chip_info; - unsigned short vref_mv; - unsigned int vref_neg_mv; - unsigned ctrl; - unsigned pwr_down_mode; - bool pwr_down; -}; - -/** - * ad5791_supported_device_ids: - */ - -enum ad5791_supported_device_ids { - ID_AD5760, - ID_AD5780, - ID_AD5781, - ID_AD5791, -}; - #endif /* SPI_AD5791_H_ */ -- cgit v0.10.2 From dbdc025bb239ce62c9b4d28c459a98f22ce9ec0a Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 Jun 2012 11:36:28 +0200 Subject: staging:iio: Move DAC drivers out of staging The IIO DAC drivers are in a reasonably good shape. They all make use of channel spec and non of them provides non-documented sysfs attributes. Code style should be OK as well, both checkpatch and coccicheck only report trivial issues. So lets move the whole folder out of staging. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig index 64c88e5..103349f 100644 --- a/drivers/iio/Kconfig +++ b/drivers/iio/Kconfig @@ -52,5 +52,6 @@ source "drivers/iio/adc/Kconfig" source "drivers/iio/amplifiers/Kconfig" source "drivers/iio/light/Kconfig" source "drivers/iio/frequency/Kconfig" +source "drivers/iio/dac/Kconfig" endif # IIO diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile index bd801c0..c38fa2a 100644 --- a/drivers/iio/Makefile +++ b/drivers/iio/Makefile @@ -13,3 +13,4 @@ obj-y += adc/ obj-y += amplifiers/ obj-y += light/ obj-y += frequency/ +obj-y += dac/ diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig new file mode 100644 index 0000000..a626f03 --- /dev/null +++ b/drivers/iio/dac/Kconfig @@ -0,0 +1,121 @@ +# +# DAC drivers +# +menu "Digital to analog converters" + +config AD5064 + tristate "Analog Devices AD5064/64-1/65/44/45/24/25, AD5628/48/66/68 DAC driver" + depends on SPI + help + Say yes here to build support for Analog Devices AD5024, AD5025, AD5044, + AD5045, AD5064, AD5064-1, AD5065, AD5628, AD5648, AD5666, AD5668 Digital + to Analog Converter. + + To compile this driver as a module, choose M here: the + module will be called ad5064. + +config AD5360 + tristate "Analog Devices Analog Devices AD5360/61/62/63/70/71/73 DAC driver" + depends on SPI + help + Say yes here to build support for Analog Devices AD5360, AD5361, + AD5362, AD5363, AD5370, AD5371, AD5373 multi-channel + Digital to Analog Converters (DAC). + + To compile this driver as module choose M here: the module will be called + ad5360. + +config AD5380 + tristate "Analog Devices AD5380/81/82/83/84/90/91/92 DAC driver" + depends on (SPI_MASTER || I2C) + select REGMAP_I2C if I2C + select REGMAP_SPI if SPI_MASTER + help + Say yes here to build support for Analog Devices AD5380, AD5381, + AD5382, AD5383, AD5384, AD5390, AD5391, AD5392 multi-channel + Digital to Analog Converters (DAC). + + To compile this driver as module choose M here: the module will be called + ad5380. + +config AD5421 + tristate "Analog Devices AD5421 DAC driver" + depends on SPI + help + Say yes here to build support for Analog Devices AD5421 loop-powered + digital-to-analog convertors (DAC). + + To compile this driver as module choose M here: the module will be called + ad5421. + +config AD5624R_SPI + tristate "Analog Devices AD5624/44/64R DAC spi driver" + depends on SPI + help + Say yes here to build support for Analog Devices AD5624R, AD5644R and + AD5664R converters (DAC). This driver uses the common SPI interface. + +config AD5446 + tristate "Analog Devices AD5446 and similar single channel DACs driver" + depends on SPI + help + Say yes here to build support for Analog Devices AD5444, AD5446, + AD5512A, AD5541A, AD5542A, AD5543, AD5553, AD5601, AD5611, AD5620, + AD5621, AD5640, AD5660, AD5662 DACs. + + To compile this driver as a module, choose M here: the + module will be called ad5446. + +config AD5504 + tristate "Analog Devices AD5504/AD5501 DAC SPI driver" + depends on SPI + help + Say yes here to build support for Analog Devices AD5504, AD5501, + High Voltage Digital to Analog Converter. + + To compile this driver as a module, choose M here: the + module will be called ad5504. + +config AD5764 + tristate "Analog Devices AD5764/64R/44/44R DAC driver" + depends on SPI_MASTER + help + Say yes here to build support for Analog Devices AD5764, AD5764R, AD5744, + AD5744R Digital to Analog Converter. + + To compile this driver as a module, choose M here: the + module will be called ad5764. + +config AD5791 + tristate "Analog Devices AD5760/AD5780/AD5781/AD5790/AD5791 DAC SPI driver" + depends on SPI + help + Say yes here to build support for Analog Devices AD5760, AD5780, + AD5781, AD5790, AD5791 High Resolution Voltage Output Digital to + Analog Converter. + + To compile this driver as a module, choose M here: the + module will be called ad5791. + +config AD5686 + tristate "Analog Devices AD5686R/AD5685R/AD5684R DAC SPI driver" + depends on SPI + help + Say yes here to build support for Analog Devices AD5686R, AD5685R, + AD5684R, AD5791 Voltage Output Digital to + Analog Converter. + + To compile this driver as a module, choose M here: the + module will be called ad5686. + +config MAX517 + tristate "Maxim MAX517/518/519 DAC driver" + depends on I2C && EXPERIMENTAL + help + If you say yes here you get support for the Maxim chips MAX517, + MAX518 and MAX519 (I2C 8-Bit DACs with rail-to-rail outputs). + + This driver can also be built as a module. If so, the module + will be called max517. + +endmenu diff --git a/drivers/iio/dac/Makefile b/drivers/iio/dac/Makefile new file mode 100644 index 0000000..8ab1d26 --- /dev/null +++ b/drivers/iio/dac/Makefile @@ -0,0 +1,15 @@ +# +# Makefile for industrial I/O DAC drivers +# + +obj-$(CONFIG_AD5360) += ad5360.o +obj-$(CONFIG_AD5380) += ad5380.o +obj-$(CONFIG_AD5421) += ad5421.o +obj-$(CONFIG_AD5624R_SPI) += ad5624r_spi.o +obj-$(CONFIG_AD5064) += ad5064.o +obj-$(CONFIG_AD5504) += ad5504.o +obj-$(CONFIG_AD5446) += ad5446.o +obj-$(CONFIG_AD5764) += ad5764.o +obj-$(CONFIG_AD5791) += ad5791.o +obj-$(CONFIG_AD5686) += ad5686.o +obj-$(CONFIG_MAX517) += max517.o diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c new file mode 100644 index 0000000..276af02 --- /dev/null +++ b/drivers/iio/dac/ad5064.c @@ -0,0 +1,538 @@ +/* + * AD5024, AD5025, AD5044, AD5045, AD5064, AD5064-1, AD5065, AD5628, AD5648, + * AD5666, AD5668 Digital to analog converters driver + * + * Copyright 2011 Analog Devices Inc. + * + * Licensed under the GPL-2. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define AD5064_MAX_DAC_CHANNELS 8 +#define AD5064_MAX_VREFS 4 + +#define AD5064_ADDR(x) ((x) << 20) +#define AD5064_CMD(x) ((x) << 24) + +#define AD5064_ADDR_DAC(chan) (chan) +#define AD5064_ADDR_ALL_DAC 0xF + +#define AD5064_CMD_WRITE_INPUT_N 0x0 +#define AD5064_CMD_UPDATE_DAC_N 0x1 +#define AD5064_CMD_WRITE_INPUT_N_UPDATE_ALL 0x2 +#define AD5064_CMD_WRITE_INPUT_N_UPDATE_N 0x3 +#define AD5064_CMD_POWERDOWN_DAC 0x4 +#define AD5064_CMD_CLEAR 0x5 +#define AD5064_CMD_LDAC_MASK 0x6 +#define AD5064_CMD_RESET 0x7 +#define AD5064_CMD_CONFIG 0x8 + +#define AD5064_CONFIG_DAISY_CHAIN_ENABLE BIT(1) +#define AD5064_CONFIG_INT_VREF_ENABLE BIT(0) + +#define AD5064_LDAC_PWRDN_NONE 0x0 +#define AD5064_LDAC_PWRDN_1K 0x1 +#define AD5064_LDAC_PWRDN_100K 0x2 +#define AD5064_LDAC_PWRDN_3STATE 0x3 + +/** + * struct ad5064_chip_info - chip specific information + * @shared_vref: whether the vref supply is shared between channels + * @internal_vref: internal reference voltage. 0 if the chip has no internal + * vref. + * @channel: channel specification + * @num_channels: number of channels + */ + +struct ad5064_chip_info { + bool shared_vref; + unsigned long internal_vref; + const struct iio_chan_spec *channels; + unsigned int num_channels; +}; + +/** + * struct ad5064_state - driver instance specific data + * @spi: spi_device + * @chip_info: chip model specific constants, available modes etc + * @vref_reg: vref supply regulators + * @pwr_down: whether channel is powered down + * @pwr_down_mode: channel's current power down mode + * @dac_cache: current DAC raw value (chip does not support readback) + * @use_internal_vref: set to true if the internal reference voltage should be + * used. + * @data: spi transfer buffers + */ + +struct ad5064_state { + struct spi_device *spi; + const struct ad5064_chip_info *chip_info; + struct regulator_bulk_data vref_reg[AD5064_MAX_VREFS]; + bool pwr_down[AD5064_MAX_DAC_CHANNELS]; + u8 pwr_down_mode[AD5064_MAX_DAC_CHANNELS]; + unsigned int dac_cache[AD5064_MAX_DAC_CHANNELS]; + bool use_internal_vref; + + /* + * DMA (thus cache coherency maintenance) requires the + * transfer buffers to live in their own cache lines. + */ + __be32 data ____cacheline_aligned; +}; + +enum ad5064_type { + ID_AD5024, + ID_AD5025, + ID_AD5044, + ID_AD5045, + ID_AD5064, + ID_AD5064_1, + ID_AD5065, + ID_AD5628_1, + ID_AD5628_2, + ID_AD5648_1, + ID_AD5648_2, + ID_AD5666_1, + ID_AD5666_2, + ID_AD5668_1, + ID_AD5668_2, +}; + +static int ad5064_spi_write(struct ad5064_state *st, unsigned int cmd, + unsigned int addr, unsigned int val, unsigned int shift) +{ + val <<= shift; + + st->data = cpu_to_be32(AD5064_CMD(cmd) | AD5064_ADDR(addr) | val); + + return spi_write(st->spi, &st->data, sizeof(st->data)); +} + +static int ad5064_sync_powerdown_mode(struct ad5064_state *st, + unsigned int channel) +{ + unsigned int val; + int ret; + + val = (0x1 << channel); + + if (st->pwr_down[channel]) + val |= st->pwr_down_mode[channel] << 8; + + ret = ad5064_spi_write(st, AD5064_CMD_POWERDOWN_DAC, 0, val, 0); + + return ret; +} + +static const char * const ad5064_powerdown_modes[] = { + "1kohm_to_gnd", + "100kohm_to_gnd", + "three_state", +}; + +static int ad5064_get_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan) +{ + struct ad5064_state *st = iio_priv(indio_dev); + + return st->pwr_down_mode[chan->channel] - 1; +} + +static int ad5064_set_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, unsigned int mode) +{ + struct ad5064_state *st = iio_priv(indio_dev); + int ret; + + mutex_lock(&indio_dev->mlock); + st->pwr_down_mode[chan->channel] = mode + 1; + + ret = ad5064_sync_powerdown_mode(st, chan->channel); + mutex_unlock(&indio_dev->mlock); + + return ret; +} + +static const struct iio_enum ad5064_powerdown_mode_enum = { + .items = ad5064_powerdown_modes, + .num_items = ARRAY_SIZE(ad5064_powerdown_modes), + .get = ad5064_get_powerdown_mode, + .set = ad5064_set_powerdown_mode, +}; + +static ssize_t ad5064_read_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, char *buf) +{ + struct ad5064_state *st = iio_priv(indio_dev); + + return sprintf(buf, "%d\n", st->pwr_down[chan->channel]); +} + +static ssize_t ad5064_write_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, const char *buf, + size_t len) +{ + struct ad5064_state *st = iio_priv(indio_dev); + bool pwr_down; + int ret; + + ret = strtobool(buf, &pwr_down); + if (ret) + return ret; + + mutex_lock(&indio_dev->mlock); + st->pwr_down[chan->channel] = pwr_down; + + ret = ad5064_sync_powerdown_mode(st, chan->channel); + mutex_unlock(&indio_dev->mlock); + return ret ? ret : len; +} + +static int ad5064_get_vref(struct ad5064_state *st, + struct iio_chan_spec const *chan) +{ + unsigned int i; + + if (st->use_internal_vref) + return st->chip_info->internal_vref; + + i = st->chip_info->shared_vref ? 0 : chan->channel; + return regulator_get_voltage(st->vref_reg[i].consumer); +} + +static int ad5064_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, + int *val2, + long m) +{ + struct ad5064_state *st = iio_priv(indio_dev); + int scale_uv; + + switch (m) { + case IIO_CHAN_INFO_RAW: + *val = st->dac_cache[chan->channel]; + return IIO_VAL_INT; + case IIO_CHAN_INFO_SCALE: + scale_uv = ad5064_get_vref(st, chan); + if (scale_uv < 0) + return scale_uv; + + scale_uv = (scale_uv * 100) >> chan->scan_type.realbits; + *val = scale_uv / 100000; + *val2 = (scale_uv % 100000) * 10; + return IIO_VAL_INT_PLUS_MICRO; + default: + break; + } + return -EINVAL; +} + +static int ad5064_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int val, int val2, long mask) +{ + struct ad5064_state *st = iio_priv(indio_dev); + int ret; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + if (val > (1 << chan->scan_type.realbits) || val < 0) + return -EINVAL; + + mutex_lock(&indio_dev->mlock); + ret = ad5064_spi_write(st, AD5064_CMD_WRITE_INPUT_N_UPDATE_N, + chan->address, val, chan->scan_type.shift); + if (ret == 0) + st->dac_cache[chan->channel] = val; + mutex_unlock(&indio_dev->mlock); + break; + default: + ret = -EINVAL; + } + + return ret; +} + +static const struct iio_info ad5064_info = { + .read_raw = ad5064_read_raw, + .write_raw = ad5064_write_raw, + .driver_module = THIS_MODULE, +}; + +static const struct iio_chan_spec_ext_info ad5064_ext_info[] = { + { + .name = "powerdown", + .read = ad5064_read_dac_powerdown, + .write = ad5064_write_dac_powerdown, + }, + IIO_ENUM("powerdown_mode", false, &ad5064_powerdown_mode_enum), + IIO_ENUM_AVAILABLE("powerdown_mode", &ad5064_powerdown_mode_enum), + { }, +}; + +#define AD5064_CHANNEL(chan, bits) { \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .output = 1, \ + .channel = (chan), \ + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ + IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \ + .address = AD5064_ADDR_DAC(chan), \ + .scan_type = IIO_ST('u', (bits), 16, 20 - (bits)), \ + .ext_info = ad5064_ext_info, \ +} + +#define DECLARE_AD5064_CHANNELS(name, bits) \ +const struct iio_chan_spec name[] = { \ + AD5064_CHANNEL(0, bits), \ + AD5064_CHANNEL(1, bits), \ + AD5064_CHANNEL(2, bits), \ + AD5064_CHANNEL(3, bits), \ + AD5064_CHANNEL(4, bits), \ + AD5064_CHANNEL(5, bits), \ + AD5064_CHANNEL(6, bits), \ + AD5064_CHANNEL(7, bits), \ +} + +static DECLARE_AD5064_CHANNELS(ad5024_channels, 12); +static DECLARE_AD5064_CHANNELS(ad5044_channels, 14); +static DECLARE_AD5064_CHANNELS(ad5064_channels, 16); + +static const struct ad5064_chip_info ad5064_chip_info_tbl[] = { + [ID_AD5024] = { + .shared_vref = false, + .channels = ad5024_channels, + .num_channels = 4, + }, + [ID_AD5025] = { + .shared_vref = false, + .channels = ad5024_channels, + .num_channels = 2, + }, + [ID_AD5044] = { + .shared_vref = false, + .channels = ad5044_channels, + .num_channels = 4, + }, + [ID_AD5045] = { + .shared_vref = false, + .channels = ad5044_channels, + .num_channels = 2, + }, + [ID_AD5064] = { + .shared_vref = false, + .channels = ad5064_channels, + .num_channels = 4, + }, + [ID_AD5064_1] = { + .shared_vref = true, + .channels = ad5064_channels, + .num_channels = 4, + }, + [ID_AD5065] = { + .shared_vref = false, + .channels = ad5064_channels, + .num_channels = 2, + }, + [ID_AD5628_1] = { + .shared_vref = true, + .internal_vref = 2500000, + .channels = ad5024_channels, + .num_channels = 8, + }, + [ID_AD5628_2] = { + .shared_vref = true, + .internal_vref = 5000000, + .channels = ad5024_channels, + .num_channels = 8, + }, + [ID_AD5648_1] = { + .shared_vref = true, + .internal_vref = 2500000, + .channels = ad5044_channels, + .num_channels = 8, + }, + [ID_AD5648_2] = { + .shared_vref = true, + .internal_vref = 5000000, + .channels = ad5044_channels, + .num_channels = 8, + }, + [ID_AD5666_1] = { + .shared_vref = true, + .internal_vref = 2500000, + .channels = ad5064_channels, + .num_channels = 4, + }, + [ID_AD5666_2] = { + .shared_vref = true, + .internal_vref = 5000000, + .channels = ad5064_channels, + .num_channels = 4, + }, + [ID_AD5668_1] = { + .shared_vref = true, + .internal_vref = 2500000, + .channels = ad5064_channels, + .num_channels = 8, + }, + [ID_AD5668_2] = { + .shared_vref = true, + .internal_vref = 5000000, + .channels = ad5064_channels, + .num_channels = 8, + }, +}; + +static inline unsigned int ad5064_num_vref(struct ad5064_state *st) +{ + return st->chip_info->shared_vref ? 1 : st->chip_info->num_channels; +} + +static const char * const ad5064_vref_names[] = { + "vrefA", + "vrefB", + "vrefC", + "vrefD", +}; + +static const char * const ad5064_vref_name(struct ad5064_state *st, + unsigned int vref) +{ + return st->chip_info->shared_vref ? "vref" : ad5064_vref_names[vref]; +} + +static int __devinit ad5064_probe(struct spi_device *spi) +{ + enum ad5064_type type = spi_get_device_id(spi)->driver_data; + struct iio_dev *indio_dev; + struct ad5064_state *st; + unsigned int i; + int ret; + + indio_dev = iio_device_alloc(sizeof(*st)); + if (indio_dev == NULL) + return -ENOMEM; + + st = iio_priv(indio_dev); + spi_set_drvdata(spi, indio_dev); + + st->chip_info = &ad5064_chip_info_tbl[type]; + st->spi = spi; + + for (i = 0; i < ad5064_num_vref(st); ++i) + st->vref_reg[i].supply = ad5064_vref_name(st, i); + + ret = regulator_bulk_get(&st->spi->dev, ad5064_num_vref(st), + st->vref_reg); + if (ret) { + if (!st->chip_info->internal_vref) + goto error_free; + st->use_internal_vref = true; + ret = ad5064_spi_write(st, AD5064_CMD_CONFIG, 0, + AD5064_CONFIG_INT_VREF_ENABLE, 0); + if (ret) { + dev_err(&spi->dev, "Failed to enable internal vref: %d\n", + ret); + goto error_free; + } + } else { + ret = regulator_bulk_enable(ad5064_num_vref(st), st->vref_reg); + if (ret) + goto error_free_reg; + } + + for (i = 0; i < st->chip_info->num_channels; ++i) { + st->pwr_down_mode[i] = AD5064_LDAC_PWRDN_1K; + st->dac_cache[i] = 0x8000; + } + + indio_dev->dev.parent = &spi->dev; + indio_dev->name = spi_get_device_id(spi)->name; + indio_dev->info = &ad5064_info; + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->channels = st->chip_info->channels; + indio_dev->num_channels = st->chip_info->num_channels; + + ret = iio_device_register(indio_dev); + if (ret) + goto error_disable_reg; + + return 0; + +error_disable_reg: + if (!st->use_internal_vref) + regulator_bulk_disable(ad5064_num_vref(st), st->vref_reg); +error_free_reg: + if (!st->use_internal_vref) + regulator_bulk_free(ad5064_num_vref(st), st->vref_reg); +error_free: + iio_device_free(indio_dev); + + return ret; +} + + +static int __devexit ad5064_remove(struct spi_device *spi) +{ + struct iio_dev *indio_dev = spi_get_drvdata(spi); + struct ad5064_state *st = iio_priv(indio_dev); + + iio_device_unregister(indio_dev); + + if (!st->use_internal_vref) { + regulator_bulk_disable(ad5064_num_vref(st), st->vref_reg); + regulator_bulk_free(ad5064_num_vref(st), st->vref_reg); + } + + iio_device_free(indio_dev); + + return 0; +} + +static const struct spi_device_id ad5064_id[] = { + {"ad5024", ID_AD5024}, + {"ad5025", ID_AD5025}, + {"ad5044", ID_AD5044}, + {"ad5045", ID_AD5045}, + {"ad5064", ID_AD5064}, + {"ad5064-1", ID_AD5064_1}, + {"ad5065", ID_AD5065}, + {"ad5628-1", ID_AD5628_1}, + {"ad5628-2", ID_AD5628_2}, + {"ad5648-1", ID_AD5648_1}, + {"ad5648-2", ID_AD5648_2}, + {"ad5666-1", ID_AD5666_1}, + {"ad5666-2", ID_AD5666_2}, + {"ad5668-1", ID_AD5668_1}, + {"ad5668-2", ID_AD5668_2}, + {"ad5668-3", ID_AD5668_2}, /* similar enough to ad5668-2 */ + {} +}; +MODULE_DEVICE_TABLE(spi, ad5064_id); + +static struct spi_driver ad5064_driver = { + .driver = { + .name = "ad5064", + .owner = THIS_MODULE, + }, + .probe = ad5064_probe, + .remove = __devexit_p(ad5064_remove), + .id_table = ad5064_id, +}; +module_spi_driver(ad5064_driver); + +MODULE_AUTHOR("Lars-Peter Clausen "); +MODULE_DESCRIPTION("Analog Devices AD5024/25/44/45/64/64-1/65, AD5628/48/66/68 DAC"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/iio/dac/ad5360.c b/drivers/iio/dac/ad5360.c new file mode 100644 index 0000000..8fce84f --- /dev/null +++ b/drivers/iio/dac/ad5360.c @@ -0,0 +1,570 @@ +/* + * Analog devices AD5360, AD5361, AD5362, AD5363, AD5370, AD5371, AD5373 + * multi-channel Digital to Analog Converters driver + * + * Copyright 2011 Analog Devices Inc. + * + * Licensed under the GPL-2. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define AD5360_CMD(x) ((x) << 22) +#define AD5360_ADDR(x) ((x) << 16) + +#define AD5360_READBACK_TYPE(x) ((x) << 13) +#define AD5360_READBACK_ADDR(x) ((x) << 7) + +#define AD5360_CHAN_ADDR(chan) ((chan) + 0x8) + +#define AD5360_CMD_WRITE_DATA 0x3 +#define AD5360_CMD_WRITE_OFFSET 0x2 +#define AD5360_CMD_WRITE_GAIN 0x1 +#define AD5360_CMD_SPECIAL_FUNCTION 0x0 + +/* Special function register addresses */ +#define AD5360_REG_SF_NOP 0x0 +#define AD5360_REG_SF_CTRL 0x1 +#define AD5360_REG_SF_OFS(x) (0x2 + (x)) +#define AD5360_REG_SF_READBACK 0x5 + +#define AD5360_SF_CTRL_PWR_DOWN BIT(0) + +#define AD5360_READBACK_X1A 0x0 +#define AD5360_READBACK_X1B 0x1 +#define AD5360_READBACK_OFFSET 0x2 +#define AD5360_READBACK_GAIN 0x3 +#define AD5360_READBACK_SF 0x4 + + +/** + * struct ad5360_chip_info - chip specific information + * @channel_template: channel specification template + * @num_channels: number of channels + * @channels_per_group: number of channels per group + * @num_vrefs: number of vref supplies for the chip +*/ + +struct ad5360_chip_info { + struct iio_chan_spec channel_template; + unsigned int num_channels; + unsigned int channels_per_group; + unsigned int num_vrefs; +}; + +/** + * struct ad5360_state - driver instance specific data + * @spi: spi_device + * @chip_info: chip model specific constants, available modes etc + * @vref_reg: vref supply regulators + * @ctrl: control register cache + * @data: spi transfer buffers + */ + +struct ad5360_state { + struct spi_device *spi; + const struct ad5360_chip_info *chip_info; + struct regulator_bulk_data vref_reg[3]; + unsigned int ctrl; + + /* + * DMA (thus cache coherency maintenance) requires the + * transfer buffers to live in their own cache lines. + */ + union { + __be32 d32; + u8 d8[4]; + } data[2] ____cacheline_aligned; +}; + +enum ad5360_type { + ID_AD5360, + ID_AD5361, + ID_AD5362, + ID_AD5363, + ID_AD5370, + ID_AD5371, + ID_AD5372, + ID_AD5373, +}; + +#define AD5360_CHANNEL(bits) { \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .output = 1, \ + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ + IIO_CHAN_INFO_SCALE_SEPARATE_BIT | \ + IIO_CHAN_INFO_OFFSET_SEPARATE_BIT | \ + IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT | \ + IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT, \ + .scan_type = IIO_ST('u', (bits), 16, 16 - (bits)) \ +} + +static const struct ad5360_chip_info ad5360_chip_info_tbl[] = { + [ID_AD5360] = { + .channel_template = AD5360_CHANNEL(16), + .num_channels = 16, + .channels_per_group = 8, + .num_vrefs = 2, + }, + [ID_AD5361] = { + .channel_template = AD5360_CHANNEL(14), + .num_channels = 16, + .channels_per_group = 8, + .num_vrefs = 2, + }, + [ID_AD5362] = { + .channel_template = AD5360_CHANNEL(16), + .num_channels = 8, + .channels_per_group = 4, + .num_vrefs = 2, + }, + [ID_AD5363] = { + .channel_template = AD5360_CHANNEL(14), + .num_channels = 8, + .channels_per_group = 4, + .num_vrefs = 2, + }, + [ID_AD5370] = { + .channel_template = AD5360_CHANNEL(16), + .num_channels = 40, + .channels_per_group = 8, + .num_vrefs = 2, + }, + [ID_AD5371] = { + .channel_template = AD5360_CHANNEL(14), + .num_channels = 40, + .channels_per_group = 8, + .num_vrefs = 3, + }, + [ID_AD5372] = { + .channel_template = AD5360_CHANNEL(16), + .num_channels = 32, + .channels_per_group = 8, + .num_vrefs = 2, + }, + [ID_AD5373] = { + .channel_template = AD5360_CHANNEL(14), + .num_channels = 32, + .channels_per_group = 8, + .num_vrefs = 2, + }, +}; + +static unsigned int ad5360_get_channel_vref_index(struct ad5360_state *st, + unsigned int channel) +{ + unsigned int i; + + /* The first groups have their own vref, while the remaining groups + * share the last vref */ + i = channel / st->chip_info->channels_per_group; + if (i >= st->chip_info->num_vrefs) + i = st->chip_info->num_vrefs - 1; + + return i; +} + +static int ad5360_get_channel_vref(struct ad5360_state *st, + unsigned int channel) +{ + unsigned int i = ad5360_get_channel_vref_index(st, channel); + + return regulator_get_voltage(st->vref_reg[i].consumer); +} + + +static int ad5360_write_unlocked(struct iio_dev *indio_dev, + unsigned int cmd, unsigned int addr, unsigned int val, + unsigned int shift) +{ + struct ad5360_state *st = iio_priv(indio_dev); + + val <<= shift; + val |= AD5360_CMD(cmd) | AD5360_ADDR(addr); + st->data[0].d32 = cpu_to_be32(val); + + return spi_write(st->spi, &st->data[0].d8[1], 3); +} + +static int ad5360_write(struct iio_dev *indio_dev, unsigned int cmd, + unsigned int addr, unsigned int val, unsigned int shift) +{ + int ret; + + mutex_lock(&indio_dev->mlock); + ret = ad5360_write_unlocked(indio_dev, cmd, addr, val, shift); + mutex_unlock(&indio_dev->mlock); + + return ret; +} + +static int ad5360_read(struct iio_dev *indio_dev, unsigned int type, + unsigned int addr) +{ + struct ad5360_state *st = iio_priv(indio_dev); + struct spi_message m; + int ret; + struct spi_transfer t[] = { + { + .tx_buf = &st->data[0].d8[1], + .len = 3, + .cs_change = 1, + }, { + .rx_buf = &st->data[1].d8[1], + .len = 3, + }, + }; + + spi_message_init(&m); + spi_message_add_tail(&t[0], &m); + spi_message_add_tail(&t[1], &m); + + mutex_lock(&indio_dev->mlock); + + st->data[0].d32 = cpu_to_be32(AD5360_CMD(AD5360_CMD_SPECIAL_FUNCTION) | + AD5360_ADDR(AD5360_REG_SF_READBACK) | + AD5360_READBACK_TYPE(type) | + AD5360_READBACK_ADDR(addr)); + + ret = spi_sync(st->spi, &m); + if (ret >= 0) + ret = be32_to_cpu(st->data[1].d32) & 0xffff; + + mutex_unlock(&indio_dev->mlock); + + return ret; +} + +static ssize_t ad5360_read_dac_powerdown(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + struct ad5360_state *st = iio_priv(indio_dev); + + return sprintf(buf, "%d\n", (bool)(st->ctrl & AD5360_SF_CTRL_PWR_DOWN)); +} + +static int ad5360_update_ctrl(struct iio_dev *indio_dev, unsigned int set, + unsigned int clr) +{ + struct ad5360_state *st = iio_priv(indio_dev); + unsigned int ret; + + mutex_lock(&indio_dev->mlock); + + st->ctrl |= set; + st->ctrl &= ~clr; + + ret = ad5360_write_unlocked(indio_dev, AD5360_CMD_SPECIAL_FUNCTION, + AD5360_REG_SF_CTRL, st->ctrl, 0); + + mutex_unlock(&indio_dev->mlock); + + return ret; +} + +static ssize_t ad5360_write_dac_powerdown(struct device *dev, + struct device_attribute *attr, const char *buf, size_t len) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + bool pwr_down; + int ret; + + ret = strtobool(buf, &pwr_down); + if (ret) + return ret; + + if (pwr_down) + ret = ad5360_update_ctrl(indio_dev, AD5360_SF_CTRL_PWR_DOWN, 0); + else + ret = ad5360_update_ctrl(indio_dev, 0, AD5360_SF_CTRL_PWR_DOWN); + + return ret ? ret : len; +} + +static IIO_DEVICE_ATTR(out_voltage_powerdown, + S_IRUGO | S_IWUSR, + ad5360_read_dac_powerdown, + ad5360_write_dac_powerdown, 0); + +static struct attribute *ad5360_attributes[] = { + &iio_dev_attr_out_voltage_powerdown.dev_attr.attr, + NULL, +}; + +static const struct attribute_group ad5360_attribute_group = { + .attrs = ad5360_attributes, +}; + +static int ad5360_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int val, + int val2, + long mask) +{ + struct ad5360_state *st = iio_priv(indio_dev); + int max_val = (1 << chan->scan_type.realbits); + unsigned int ofs_index; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + if (val >= max_val || val < 0) + return -EINVAL; + + return ad5360_write(indio_dev, AD5360_CMD_WRITE_DATA, + chan->address, val, chan->scan_type.shift); + + case IIO_CHAN_INFO_CALIBBIAS: + if (val >= max_val || val < 0) + return -EINVAL; + + return ad5360_write(indio_dev, AD5360_CMD_WRITE_OFFSET, + chan->address, val, chan->scan_type.shift); + + case IIO_CHAN_INFO_CALIBSCALE: + if (val >= max_val || val < 0) + return -EINVAL; + + return ad5360_write(indio_dev, AD5360_CMD_WRITE_GAIN, + chan->address, val, chan->scan_type.shift); + + case IIO_CHAN_INFO_OFFSET: + if (val <= -max_val || val > 0) + return -EINVAL; + + val = -val; + + /* offset is supposed to have the same scale as raw, but it + * is always 14bits wide, so on a chip where the raw value has + * more bits, we need to shift offset. */ + val >>= (chan->scan_type.realbits - 14); + + /* There is one DAC offset register per vref. Changing one + * channels offset will also change the offset for all other + * channels which share the same vref supply. */ + ofs_index = ad5360_get_channel_vref_index(st, chan->channel); + return ad5360_write(indio_dev, AD5360_CMD_SPECIAL_FUNCTION, + AD5360_REG_SF_OFS(ofs_index), val, 0); + default: + break; + } + + return -EINVAL; +} + +static int ad5360_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, + int *val2, + long m) +{ + struct ad5360_state *st = iio_priv(indio_dev); + unsigned int ofs_index; + int scale_uv; + int ret; + + switch (m) { + case IIO_CHAN_INFO_RAW: + ret = ad5360_read(indio_dev, AD5360_READBACK_X1A, + chan->address); + if (ret < 0) + return ret; + *val = ret >> chan->scan_type.shift; + return IIO_VAL_INT; + case IIO_CHAN_INFO_SCALE: + /* vout = 4 * vref * dac_code */ + scale_uv = ad5360_get_channel_vref(st, chan->channel) * 4 * 100; + if (scale_uv < 0) + return scale_uv; + + scale_uv >>= (chan->scan_type.realbits); + *val = scale_uv / 100000; + *val2 = (scale_uv % 100000) * 10; + return IIO_VAL_INT_PLUS_MICRO; + case IIO_CHAN_INFO_CALIBBIAS: + ret = ad5360_read(indio_dev, AD5360_READBACK_OFFSET, + chan->address); + if (ret < 0) + return ret; + *val = ret; + return IIO_VAL_INT; + case IIO_CHAN_INFO_CALIBSCALE: + ret = ad5360_read(indio_dev, AD5360_READBACK_GAIN, + chan->address); + if (ret < 0) + return ret; + *val = ret; + return IIO_VAL_INT; + case IIO_CHAN_INFO_OFFSET: + ofs_index = ad5360_get_channel_vref_index(st, chan->channel); + ret = ad5360_read(indio_dev, AD5360_READBACK_SF, + AD5360_REG_SF_OFS(ofs_index)); + if (ret < 0) + return ret; + + ret <<= (chan->scan_type.realbits - 14); + *val = -ret; + return IIO_VAL_INT; + } + + return -EINVAL; +} + +static const struct iio_info ad5360_info = { + .read_raw = ad5360_read_raw, + .write_raw = ad5360_write_raw, + .attrs = &ad5360_attribute_group, + .driver_module = THIS_MODULE, +}; + +static const char * const ad5360_vref_name[] = { + "vref0", "vref1", "vref2" +}; + +static int __devinit ad5360_alloc_channels(struct iio_dev *indio_dev) +{ + struct ad5360_state *st = iio_priv(indio_dev); + struct iio_chan_spec *channels; + unsigned int i; + + channels = kcalloc(st->chip_info->num_channels, + sizeof(struct iio_chan_spec), GFP_KERNEL); + + if (!channels) + return -ENOMEM; + + for (i = 0; i < st->chip_info->num_channels; ++i) { + channels[i] = st->chip_info->channel_template; + channels[i].channel = i; + channels[i].address = AD5360_CHAN_ADDR(i); + } + + indio_dev->channels = channels; + + return 0; +} + +static int __devinit ad5360_probe(struct spi_device *spi) +{ + enum ad5360_type type = spi_get_device_id(spi)->driver_data; + struct iio_dev *indio_dev; + struct ad5360_state *st; + unsigned int i; + int ret; + + indio_dev = iio_device_alloc(sizeof(*st)); + if (indio_dev == NULL) { + dev_err(&spi->dev, "Failed to allocate iio device\n"); + return -ENOMEM; + } + + st = iio_priv(indio_dev); + spi_set_drvdata(spi, indio_dev); + + st->chip_info = &ad5360_chip_info_tbl[type]; + st->spi = spi; + + indio_dev->dev.parent = &spi->dev; + indio_dev->name = spi_get_device_id(spi)->name; + indio_dev->info = &ad5360_info; + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->num_channels = st->chip_info->num_channels; + + ret = ad5360_alloc_channels(indio_dev); + if (ret) { + dev_err(&spi->dev, "Failed to allocate channel spec: %d\n", ret); + goto error_free; + } + + for (i = 0; i < st->chip_info->num_vrefs; ++i) + st->vref_reg[i].supply = ad5360_vref_name[i]; + + ret = regulator_bulk_get(&st->spi->dev, st->chip_info->num_vrefs, + st->vref_reg); + if (ret) { + dev_err(&spi->dev, "Failed to request vref regulators: %d\n", ret); + goto error_free_channels; + } + + ret = regulator_bulk_enable(st->chip_info->num_vrefs, st->vref_reg); + if (ret) { + dev_err(&spi->dev, "Failed to enable vref regulators: %d\n", ret); + goto error_free_reg; + } + + ret = iio_device_register(indio_dev); + if (ret) { + dev_err(&spi->dev, "Failed to register iio device: %d\n", ret); + goto error_disable_reg; + } + + return 0; + +error_disable_reg: + regulator_bulk_disable(st->chip_info->num_vrefs, st->vref_reg); +error_free_reg: + regulator_bulk_free(st->chip_info->num_vrefs, st->vref_reg); +error_free_channels: + kfree(indio_dev->channels); +error_free: + iio_device_free(indio_dev); + + return ret; +} + +static int __devexit ad5360_remove(struct spi_device *spi) +{ + struct iio_dev *indio_dev = spi_get_drvdata(spi); + struct ad5360_state *st = iio_priv(indio_dev); + + iio_device_unregister(indio_dev); + + kfree(indio_dev->channels); + + regulator_bulk_disable(st->chip_info->num_vrefs, st->vref_reg); + regulator_bulk_free(st->chip_info->num_vrefs, st->vref_reg); + + iio_device_free(indio_dev); + + return 0; +} + +static const struct spi_device_id ad5360_ids[] = { + { "ad5360", ID_AD5360 }, + { "ad5361", ID_AD5361 }, + { "ad5362", ID_AD5362 }, + { "ad5363", ID_AD5363 }, + { "ad5370", ID_AD5370 }, + { "ad5371", ID_AD5371 }, + { "ad5372", ID_AD5372 }, + { "ad5373", ID_AD5373 }, + {} +}; +MODULE_DEVICE_TABLE(spi, ad5360_ids); + +static struct spi_driver ad5360_driver = { + .driver = { + .name = "ad5360", + .owner = THIS_MODULE, + }, + .probe = ad5360_probe, + .remove = __devexit_p(ad5360_remove), + .id_table = ad5360_ids, +}; +module_spi_driver(ad5360_driver); + +MODULE_AUTHOR("Lars-Peter Clausen "); +MODULE_DESCRIPTION("Analog Devices AD5360/61/62/63/70/71/72/73 DAC"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/iio/dac/ad5380.c b/drivers/iio/dac/ad5380.c new file mode 100644 index 0000000..5dfb445 --- /dev/null +++ b/drivers/iio/dac/ad5380.c @@ -0,0 +1,657 @@ +/* + * Analog devices AD5380, AD5381, AD5382, AD5383, AD5390, AD5391, AD5392 + * multi-channel Digital to Analog Converters driver + * + * Copyright 2011 Analog Devices Inc. + * + * Licensed under the GPL-2. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define AD5380_REG_DATA(x) (((x) << 2) | 3) +#define AD5380_REG_OFFSET(x) (((x) << 2) | 2) +#define AD5380_REG_GAIN(x) (((x) << 2) | 1) +#define AD5380_REG_SF_PWR_DOWN (8 << 2) +#define AD5380_REG_SF_PWR_UP (9 << 2) +#define AD5380_REG_SF_CTRL (12 << 2) + +#define AD5380_CTRL_PWR_DOWN_MODE_OFFSET 13 +#define AD5380_CTRL_INT_VREF_2V5 BIT(12) +#define AD5380_CTRL_INT_VREF_EN BIT(10) + +/** + * struct ad5380_chip_info - chip specific information + * @channel_template: channel specification template + * @num_channels: number of channels + * @int_vref: internal vref in uV +*/ + +struct ad5380_chip_info { + struct iio_chan_spec channel_template; + unsigned int num_channels; + unsigned int int_vref; +}; + +/** + * struct ad5380_state - driver instance specific data + * @regmap: regmap instance used by the device + * @chip_info: chip model specific constants, available modes etc + * @vref_reg: vref supply regulator + * @vref: actual reference voltage used in uA + * @pwr_down: whether the chip is currently in power down mode + */ + +struct ad5380_state { + struct regmap *regmap; + const struct ad5380_chip_info *chip_info; + struct regulator *vref_reg; + int vref; + bool pwr_down; +}; + +enum ad5380_type { + ID_AD5380_3, + ID_AD5380_5, + ID_AD5381_3, + ID_AD5381_5, + ID_AD5382_3, + ID_AD5382_5, + ID_AD5383_3, + ID_AD5383_5, + ID_AD5390_3, + ID_AD5390_5, + ID_AD5391_3, + ID_AD5391_5, + ID_AD5392_3, + ID_AD5392_5, +}; + +static ssize_t ad5380_read_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, char *buf) +{ + struct ad5380_state *st = iio_priv(indio_dev); + + return sprintf(buf, "%d\n", st->pwr_down); +} + +static ssize_t ad5380_write_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, const char *buf, + size_t len) +{ + struct ad5380_state *st = iio_priv(indio_dev); + bool pwr_down; + int ret; + + ret = strtobool(buf, &pwr_down); + if (ret) + return ret; + + mutex_lock(&indio_dev->mlock); + + if (pwr_down) + ret = regmap_write(st->regmap, AD5380_REG_SF_PWR_DOWN, 0); + else + ret = regmap_write(st->regmap, AD5380_REG_SF_PWR_UP, 0); + + st->pwr_down = pwr_down; + + mutex_unlock(&indio_dev->mlock); + + return ret ? ret : len; +} + +static const char * const ad5380_powerdown_modes[] = { + "100kohm_to_gnd", + "three_state", +}; + +static int ad5380_get_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan) +{ + struct ad5380_state *st = iio_priv(indio_dev); + unsigned int mode; + int ret; + + ret = regmap_read(st->regmap, AD5380_REG_SF_CTRL, &mode); + if (ret) + return ret; + + mode = (mode >> AD5380_CTRL_PWR_DOWN_MODE_OFFSET) & 1; + + return mode; +} + +static int ad5380_set_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, unsigned int mode) +{ + struct ad5380_state *st = iio_priv(indio_dev); + int ret; + + ret = regmap_update_bits(st->regmap, AD5380_REG_SF_CTRL, + 1 << AD5380_CTRL_PWR_DOWN_MODE_OFFSET, + mode << AD5380_CTRL_PWR_DOWN_MODE_OFFSET); + + return ret; +} + +static const struct iio_enum ad5380_powerdown_mode_enum = { + .items = ad5380_powerdown_modes, + .num_items = ARRAY_SIZE(ad5380_powerdown_modes), + .get = ad5380_get_powerdown_mode, + .set = ad5380_set_powerdown_mode, +}; + +static unsigned int ad5380_info_to_reg(struct iio_chan_spec const *chan, + long info) +{ + switch (info) { + case 0: + return AD5380_REG_DATA(chan->address); + case IIO_CHAN_INFO_CALIBBIAS: + return AD5380_REG_OFFSET(chan->address); + case IIO_CHAN_INFO_CALIBSCALE: + return AD5380_REG_GAIN(chan->address); + default: + break; + } + + return 0; +} + +static int ad5380_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int val, int val2, long info) +{ + const unsigned int max_val = (1 << chan->scan_type.realbits); + struct ad5380_state *st = iio_priv(indio_dev); + + switch (info) { + case IIO_CHAN_INFO_RAW: + case IIO_CHAN_INFO_CALIBSCALE: + if (val >= max_val || val < 0) + return -EINVAL; + + return regmap_write(st->regmap, + ad5380_info_to_reg(chan, info), + val << chan->scan_type.shift); + case IIO_CHAN_INFO_CALIBBIAS: + val += (1 << chan->scan_type.realbits) / 2; + if (val >= max_val || val < 0) + return -EINVAL; + + return regmap_write(st->regmap, + AD5380_REG_OFFSET(chan->address), + val << chan->scan_type.shift); + default: + break; + } + return -EINVAL; +} + +static int ad5380_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int *val, int *val2, long info) +{ + struct ad5380_state *st = iio_priv(indio_dev); + unsigned long scale_uv; + int ret; + + switch (info) { + case IIO_CHAN_INFO_RAW: + case IIO_CHAN_INFO_CALIBSCALE: + ret = regmap_read(st->regmap, ad5380_info_to_reg(chan, info), + val); + if (ret) + return ret; + *val >>= chan->scan_type.shift; + return IIO_VAL_INT; + case IIO_CHAN_INFO_CALIBBIAS: + ret = regmap_read(st->regmap, AD5380_REG_OFFSET(chan->address), + val); + if (ret) + return ret; + *val >>= chan->scan_type.shift; + val -= (1 << chan->scan_type.realbits) / 2; + return IIO_VAL_INT; + case IIO_CHAN_INFO_SCALE: + scale_uv = ((2 * st->vref) >> chan->scan_type.realbits) * 100; + *val = scale_uv / 100000; + *val2 = (scale_uv % 100000) * 10; + return IIO_VAL_INT_PLUS_MICRO; + default: + break; + } + + return -EINVAL; +} + +static const struct iio_info ad5380_info = { + .read_raw = ad5380_read_raw, + .write_raw = ad5380_write_raw, + .driver_module = THIS_MODULE, +}; + +static struct iio_chan_spec_ext_info ad5380_ext_info[] = { + { + .name = "powerdown", + .read = ad5380_read_dac_powerdown, + .write = ad5380_write_dac_powerdown, + }, + IIO_ENUM("powerdown_mode", true, &ad5380_powerdown_mode_enum), + IIO_ENUM_AVAILABLE("powerdown_mode", &ad5380_powerdown_mode_enum), + { }, +}; + +#define AD5380_CHANNEL(_bits) { \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .output = 1, \ + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ + IIO_CHAN_INFO_SCALE_SHARED_BIT | \ + IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT | \ + IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT, \ + .scan_type = IIO_ST('u', (_bits), 16, 14 - (_bits)), \ + .ext_info = ad5380_ext_info, \ +} + +static const struct ad5380_chip_info ad5380_chip_info_tbl[] = { + [ID_AD5380_3] = { + .channel_template = AD5380_CHANNEL(14), + .num_channels = 40, + .int_vref = 1250000, + }, + [ID_AD5380_5] = { + .channel_template = AD5380_CHANNEL(14), + .num_channels = 40, + .int_vref = 2500000, + }, + [ID_AD5381_3] = { + .channel_template = AD5380_CHANNEL(12), + .num_channels = 16, + .int_vref = 1250000, + }, + [ID_AD5381_5] = { + .channel_template = AD5380_CHANNEL(12), + .num_channels = 16, + .int_vref = 2500000, + }, + [ID_AD5382_3] = { + .channel_template = AD5380_CHANNEL(14), + .num_channels = 32, + .int_vref = 1250000, + }, + [ID_AD5382_5] = { + .channel_template = AD5380_CHANNEL(14), + .num_channels = 32, + .int_vref = 2500000, + }, + [ID_AD5383_3] = { + .channel_template = AD5380_CHANNEL(12), + .num_channels = 32, + .int_vref = 1250000, + }, + [ID_AD5383_5] = { + .channel_template = AD5380_CHANNEL(12), + .num_channels = 32, + .int_vref = 2500000, + }, + [ID_AD5390_3] = { + .channel_template = AD5380_CHANNEL(14), + .num_channels = 16, + .int_vref = 1250000, + }, + [ID_AD5390_5] = { + .channel_template = AD5380_CHANNEL(14), + .num_channels = 16, + .int_vref = 2500000, + }, + [ID_AD5391_3] = { + .channel_template = AD5380_CHANNEL(12), + .num_channels = 16, + .int_vref = 1250000, + }, + [ID_AD5391_5] = { + .channel_template = AD5380_CHANNEL(12), + .num_channels = 16, + .int_vref = 2500000, + }, + [ID_AD5392_3] = { + .channel_template = AD5380_CHANNEL(14), + .num_channels = 8, + .int_vref = 1250000, + }, + [ID_AD5392_5] = { + .channel_template = AD5380_CHANNEL(14), + .num_channels = 8, + .int_vref = 2500000, + }, +}; + +static int __devinit ad5380_alloc_channels(struct iio_dev *indio_dev) +{ + struct ad5380_state *st = iio_priv(indio_dev); + struct iio_chan_spec *channels; + unsigned int i; + + channels = kcalloc(st->chip_info->num_channels, + sizeof(struct iio_chan_spec), GFP_KERNEL); + + if (!channels) + return -ENOMEM; + + for (i = 0; i < st->chip_info->num_channels; ++i) { + channels[i] = st->chip_info->channel_template; + channels[i].channel = i; + channels[i].address = i; + } + + indio_dev->channels = channels; + + return 0; +} + +static int __devinit ad5380_probe(struct device *dev, struct regmap *regmap, + enum ad5380_type type, const char *name) +{ + struct iio_dev *indio_dev; + struct ad5380_state *st; + unsigned int ctrl = 0; + int ret; + + indio_dev = iio_device_alloc(sizeof(*st)); + if (indio_dev == NULL) { + dev_err(dev, "Failed to allocate iio device\n"); + ret = -ENOMEM; + goto error_regmap_exit; + } + + st = iio_priv(indio_dev); + dev_set_drvdata(dev, indio_dev); + + st->chip_info = &ad5380_chip_info_tbl[type]; + st->regmap = regmap; + + indio_dev->dev.parent = dev; + indio_dev->name = name; + indio_dev->info = &ad5380_info; + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->num_channels = st->chip_info->num_channels; + + ret = ad5380_alloc_channels(indio_dev); + if (ret) { + dev_err(dev, "Failed to allocate channel spec: %d\n", ret); + goto error_free; + } + + if (st->chip_info->int_vref == 2500000) + ctrl |= AD5380_CTRL_INT_VREF_2V5; + + st->vref_reg = regulator_get(dev, "vref"); + if (!IS_ERR(st->vref_reg)) { + ret = regulator_enable(st->vref_reg); + if (ret) { + dev_err(dev, "Failed to enable vref regulators: %d\n", + ret); + goto error_free_reg; + } + + st->vref = regulator_get_voltage(st->vref_reg); + } else { + st->vref = st->chip_info->int_vref; + ctrl |= AD5380_CTRL_INT_VREF_EN; + } + + ret = regmap_write(st->regmap, AD5380_REG_SF_CTRL, ctrl); + if (ret) { + dev_err(dev, "Failed to write to device: %d\n", ret); + goto error_disable_reg; + } + + ret = iio_device_register(indio_dev); + if (ret) { + dev_err(dev, "Failed to register iio device: %d\n", ret); + goto error_disable_reg; + } + + return 0; + +error_disable_reg: + if (!IS_ERR(st->vref_reg)) + regulator_disable(st->vref_reg); +error_free_reg: + if (!IS_ERR(st->vref_reg)) + regulator_put(st->vref_reg); + + kfree(indio_dev->channels); +error_free: + iio_device_free(indio_dev); +error_regmap_exit: + regmap_exit(regmap); + + return ret; +} + +static int __devexit ad5380_remove(struct device *dev) +{ + struct iio_dev *indio_dev = dev_get_drvdata(dev); + struct ad5380_state *st = iio_priv(indio_dev); + + iio_device_unregister(indio_dev); + + kfree(indio_dev->channels); + + if (!IS_ERR(st->vref_reg)) { + regulator_disable(st->vref_reg); + regulator_put(st->vref_reg); + } + + regmap_exit(st->regmap); + iio_device_free(indio_dev); + + return 0; +} + +static bool ad5380_reg_false(struct device *dev, unsigned int reg) +{ + return false; +} + +static const struct regmap_config ad5380_regmap_config = { + .reg_bits = 10, + .val_bits = 14, + + .max_register = AD5380_REG_DATA(40), + .cache_type = REGCACHE_RBTREE, + + .volatile_reg = ad5380_reg_false, + .readable_reg = ad5380_reg_false, +}; + +#if IS_ENABLED(CONFIG_SPI_MASTER) + +static int __devinit ad5380_spi_probe(struct spi_device *spi) +{ + const struct spi_device_id *id = spi_get_device_id(spi); + struct regmap *regmap; + + regmap = regmap_init_spi(spi, &ad5380_regmap_config); + + if (IS_ERR(regmap)) + return PTR_ERR(regmap); + + return ad5380_probe(&spi->dev, regmap, id->driver_data, id->name); +} + +static int __devexit ad5380_spi_remove(struct spi_device *spi) +{ + return ad5380_remove(&spi->dev); +} + +static const struct spi_device_id ad5380_spi_ids[] = { + { "ad5380-3", ID_AD5380_3 }, + { "ad5380-5", ID_AD5380_5 }, + { "ad5381-3", ID_AD5381_3 }, + { "ad5381-5", ID_AD5381_5 }, + { "ad5382-3", ID_AD5382_3 }, + { "ad5382-5", ID_AD5382_5 }, + { "ad5383-3", ID_AD5383_3 }, + { "ad5383-5", ID_AD5383_5 }, + { "ad5384-3", ID_AD5380_3 }, + { "ad5384-5", ID_AD5380_5 }, + { "ad5390-3", ID_AD5390_3 }, + { "ad5390-5", ID_AD5390_5 }, + { "ad5391-3", ID_AD5391_3 }, + { "ad5391-5", ID_AD5391_5 }, + { "ad5392-3", ID_AD5392_3 }, + { "ad5392-5", ID_AD5392_5 }, + { } +}; +MODULE_DEVICE_TABLE(spi, ad5380_spi_ids); + +static struct spi_driver ad5380_spi_driver = { + .driver = { + .name = "ad5380", + .owner = THIS_MODULE, + }, + .probe = ad5380_spi_probe, + .remove = __devexit_p(ad5380_spi_remove), + .id_table = ad5380_spi_ids, +}; + +static inline int ad5380_spi_register_driver(void) +{ + return spi_register_driver(&ad5380_spi_driver); +} + +static inline void ad5380_spi_unregister_driver(void) +{ + spi_unregister_driver(&ad5380_spi_driver); +} + +#else + +static inline int ad5380_spi_register_driver(void) +{ + return 0; +} + +static inline void ad5380_spi_unregister_driver(void) +{ +} + +#endif + +#if IS_ENABLED(CONFIG_I2C) + +static int __devinit ad5380_i2c_probe(struct i2c_client *i2c, + const struct i2c_device_id *id) +{ + struct regmap *regmap; + + regmap = regmap_init_i2c(i2c, &ad5380_regmap_config); + + if (IS_ERR(regmap)) + return PTR_ERR(regmap); + + return ad5380_probe(&i2c->dev, regmap, id->driver_data, id->name); +} + +static int __devexit ad5380_i2c_remove(struct i2c_client *i2c) +{ + return ad5380_remove(&i2c->dev); +} + +static const struct i2c_device_id ad5380_i2c_ids[] = { + { "ad5380-3", ID_AD5380_3 }, + { "ad5380-5", ID_AD5380_5 }, + { "ad5381-3", ID_AD5381_3 }, + { "ad5381-5", ID_AD5381_5 }, + { "ad5382-3", ID_AD5382_3 }, + { "ad5382-5", ID_AD5382_5 }, + { "ad5383-3", ID_AD5383_3 }, + { "ad5383-5", ID_AD5383_5 }, + { "ad5384-3", ID_AD5380_3 }, + { "ad5384-5", ID_AD5380_5 }, + { "ad5390-3", ID_AD5390_3 }, + { "ad5390-5", ID_AD5390_5 }, + { "ad5391-3", ID_AD5391_3 }, + { "ad5391-5", ID_AD5391_5 }, + { "ad5392-3", ID_AD5392_3 }, + { "ad5392-5", ID_AD5392_5 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, ad5380_i2c_ids); + +static struct i2c_driver ad5380_i2c_driver = { + .driver = { + .name = "ad5380", + .owner = THIS_MODULE, + }, + .probe = ad5380_i2c_probe, + .remove = __devexit_p(ad5380_i2c_remove), + .id_table = ad5380_i2c_ids, +}; + +static inline int ad5380_i2c_register_driver(void) +{ + return i2c_add_driver(&ad5380_i2c_driver); +} + +static inline void ad5380_i2c_unregister_driver(void) +{ + i2c_del_driver(&ad5380_i2c_driver); +} + +#else + +static inline int ad5380_i2c_register_driver(void) +{ + return 0; +} + +static inline void ad5380_i2c_unregister_driver(void) +{ +} + +#endif + +static int __init ad5380_spi_init(void) +{ + int ret; + + ret = ad5380_spi_register_driver(); + if (ret) + return ret; + + ret = ad5380_i2c_register_driver(); + if (ret) { + ad5380_spi_unregister_driver(); + return ret; + } + + return 0; +} +module_init(ad5380_spi_init); + +static void __exit ad5380_spi_exit(void) +{ + ad5380_i2c_unregister_driver(); + ad5380_spi_unregister_driver(); + +} +module_exit(ad5380_spi_exit); + +MODULE_AUTHOR("Lars-Peter Clausen "); +MODULE_DESCRIPTION("Analog Devices AD5380/81/82/83/84/90/91/92 DAC"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/iio/dac/ad5421.c b/drivers/iio/dac/ad5421.c new file mode 100644 index 0000000..cdbc5bf --- /dev/null +++ b/drivers/iio/dac/ad5421.c @@ -0,0 +1,544 @@ +/* + * AD5421 Digital to analog converters driver + * + * Copyright 2011 Analog Devices Inc. + * + * Licensed under the GPL-2. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + + +#define AD5421_REG_DAC_DATA 0x1 +#define AD5421_REG_CTRL 0x2 +#define AD5421_REG_OFFSET 0x3 +#define AD5421_REG_GAIN 0x4 +/* load dac and fault shared the same register number. Writing to it will cause + * a dac load command, reading from it will return the fault status register */ +#define AD5421_REG_LOAD_DAC 0x5 +#define AD5421_REG_FAULT 0x5 +#define AD5421_REG_FORCE_ALARM_CURRENT 0x6 +#define AD5421_REG_RESET 0x7 +#define AD5421_REG_START_CONVERSION 0x8 +#define AD5421_REG_NOOP 0x9 + +#define AD5421_CTRL_WATCHDOG_DISABLE BIT(12) +#define AD5421_CTRL_AUTO_FAULT_READBACK BIT(11) +#define AD5421_CTRL_MIN_CURRENT BIT(9) +#define AD5421_CTRL_ADC_SOURCE_TEMP BIT(8) +#define AD5421_CTRL_ADC_ENABLE BIT(7) +#define AD5421_CTRL_PWR_DOWN_INT_VREF BIT(6) + +#define AD5421_FAULT_SPI BIT(15) +#define AD5421_FAULT_PEC BIT(14) +#define AD5421_FAULT_OVER_CURRENT BIT(13) +#define AD5421_FAULT_UNDER_CURRENT BIT(12) +#define AD5421_FAULT_TEMP_OVER_140 BIT(11) +#define AD5421_FAULT_TEMP_OVER_100 BIT(10) +#define AD5421_FAULT_UNDER_VOLTAGE_6V BIT(9) +#define AD5421_FAULT_UNDER_VOLTAGE_12V BIT(8) + +/* These bits will cause the fault pin to go high */ +#define AD5421_FAULT_TRIGGER_IRQ \ + (AD5421_FAULT_SPI | AD5421_FAULT_PEC | AD5421_FAULT_OVER_CURRENT | \ + AD5421_FAULT_UNDER_CURRENT | AD5421_FAULT_TEMP_OVER_140) + +/** + * struct ad5421_state - driver instance specific data + * @spi: spi_device + * @ctrl: control register cache + * @current_range: current range which the device is configured for + * @data: spi transfer buffers + * @fault_mask: software masking of events + */ +struct ad5421_state { + struct spi_device *spi; + unsigned int ctrl; + enum ad5421_current_range current_range; + unsigned int fault_mask; + + /* + * DMA (thus cache coherency maintenance) requires the + * transfer buffers to live in their own cache lines. + */ + union { + u32 d32; + u8 d8[4]; + } data[2] ____cacheline_aligned; +}; + +static const struct iio_chan_spec ad5421_channels[] = { + { + .type = IIO_CURRENT, + .indexed = 1, + .output = 1, + .channel = 0, + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | + IIO_CHAN_INFO_SCALE_SHARED_BIT | + IIO_CHAN_INFO_OFFSET_SHARED_BIT | + IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT | + IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT, + .scan_type = IIO_ST('u', 16, 16, 0), + .event_mask = IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING) | + IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_FALLING), + }, + { + .type = IIO_TEMP, + .channel = -1, + .event_mask = IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING), + }, +}; + +static int ad5421_write_unlocked(struct iio_dev *indio_dev, + unsigned int reg, unsigned int val) +{ + struct ad5421_state *st = iio_priv(indio_dev); + + st->data[0].d32 = cpu_to_be32((reg << 16) | val); + + return spi_write(st->spi, &st->data[0].d8[1], 3); +} + +static int ad5421_write(struct iio_dev *indio_dev, unsigned int reg, + unsigned int val) +{ + int ret; + + mutex_lock(&indio_dev->mlock); + ret = ad5421_write_unlocked(indio_dev, reg, val); + mutex_unlock(&indio_dev->mlock); + + return ret; +} + +static int ad5421_read(struct iio_dev *indio_dev, unsigned int reg) +{ + struct ad5421_state *st = iio_priv(indio_dev); + struct spi_message m; + int ret; + struct spi_transfer t[] = { + { + .tx_buf = &st->data[0].d8[1], + .len = 3, + .cs_change = 1, + }, { + .rx_buf = &st->data[1].d8[1], + .len = 3, + }, + }; + + spi_message_init(&m); + spi_message_add_tail(&t[0], &m); + spi_message_add_tail(&t[1], &m); + + mutex_lock(&indio_dev->mlock); + + st->data[0].d32 = cpu_to_be32((1 << 23) | (reg << 16)); + + ret = spi_sync(st->spi, &m); + if (ret >= 0) + ret = be32_to_cpu(st->data[1].d32) & 0xffff; + + mutex_unlock(&indio_dev->mlock); + + return ret; +} + +static int ad5421_update_ctrl(struct iio_dev *indio_dev, unsigned int set, + unsigned int clr) +{ + struct ad5421_state *st = iio_priv(indio_dev); + unsigned int ret; + + mutex_lock(&indio_dev->mlock); + + st->ctrl &= ~clr; + st->ctrl |= set; + + ret = ad5421_write_unlocked(indio_dev, AD5421_REG_CTRL, st->ctrl); + + mutex_unlock(&indio_dev->mlock); + + return ret; +} + +static irqreturn_t ad5421_fault_handler(int irq, void *data) +{ + struct iio_dev *indio_dev = data; + struct ad5421_state *st = iio_priv(indio_dev); + unsigned int fault; + unsigned int old_fault = 0; + unsigned int events; + + fault = ad5421_read(indio_dev, AD5421_REG_FAULT); + if (!fault) + return IRQ_NONE; + + /* If we had a fault, this might mean that the DAC has lost its state + * and has been reset. Make sure that the control register actually + * contains what we expect it to contain. Otherwise the watchdog might + * be enabled and we get watchdog timeout faults, which will render the + * DAC unusable. */ + ad5421_update_ctrl(indio_dev, 0, 0); + + + /* The fault pin stays high as long as a fault condition is present and + * it is not possible to mask fault conditions. For certain fault + * conditions for example like over-temperature it takes some time + * until the fault condition disappears. If we would exit the interrupt + * handler immediately after handling the event it would be entered + * again instantly. Thus we fall back to polling in case we detect that + * a interrupt condition is still present. + */ + do { + /* 0xffff is a invalid value for the register and will only be + * read if there has been a communication error */ + if (fault == 0xffff) + fault = 0; + + /* we are only interested in new events */ + events = (old_fault ^ fault) & fault; + events &= st->fault_mask; + + if (events & AD5421_FAULT_OVER_CURRENT) { + iio_push_event(indio_dev, + IIO_UNMOD_EVENT_CODE(IIO_CURRENT, + 0, + IIO_EV_TYPE_THRESH, + IIO_EV_DIR_RISING), + iio_get_time_ns()); + } + + if (events & AD5421_FAULT_UNDER_CURRENT) { + iio_push_event(indio_dev, + IIO_UNMOD_EVENT_CODE(IIO_CURRENT, + 0, + IIO_EV_TYPE_THRESH, + IIO_EV_DIR_FALLING), + iio_get_time_ns()); + } + + if (events & AD5421_FAULT_TEMP_OVER_140) { + iio_push_event(indio_dev, + IIO_UNMOD_EVENT_CODE(IIO_TEMP, + 0, + IIO_EV_TYPE_MAG, + IIO_EV_DIR_RISING), + iio_get_time_ns()); + } + + old_fault = fault; + fault = ad5421_read(indio_dev, AD5421_REG_FAULT); + + /* still active? go to sleep for some time */ + if (fault & AD5421_FAULT_TRIGGER_IRQ) + msleep(1000); + + } while (fault & AD5421_FAULT_TRIGGER_IRQ); + + + return IRQ_HANDLED; +} + +static void ad5421_get_current_min_max(struct ad5421_state *st, + unsigned int *min, unsigned int *max) +{ + /* The current range is configured using external pins, which are + * usually hard-wired and not run-time switchable. */ + switch (st->current_range) { + case AD5421_CURRENT_RANGE_4mA_20mA: + *min = 4000; + *max = 20000; + break; + case AD5421_CURRENT_RANGE_3mA8_21mA: + *min = 3800; + *max = 21000; + break; + case AD5421_CURRENT_RANGE_3mA2_24mA: + *min = 3200; + *max = 24000; + break; + default: + *min = 0; + *max = 1; + break; + } +} + +static inline unsigned int ad5421_get_offset(struct ad5421_state *st) +{ + unsigned int min, max; + + ad5421_get_current_min_max(st, &min, &max); + return (min * (1 << 16)) / (max - min); +} + +static inline unsigned int ad5421_get_scale(struct ad5421_state *st) +{ + unsigned int min, max; + + ad5421_get_current_min_max(st, &min, &max); + return ((max - min) * 1000) / (1 << 16); +} + +static int ad5421_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int *val, int *val2, long m) +{ + struct ad5421_state *st = iio_priv(indio_dev); + int ret; + + if (chan->type != IIO_CURRENT) + return -EINVAL; + + switch (m) { + case IIO_CHAN_INFO_RAW: + ret = ad5421_read(indio_dev, AD5421_REG_DAC_DATA); + if (ret < 0) + return ret; + *val = ret; + return IIO_VAL_INT; + case IIO_CHAN_INFO_SCALE: + *val = 0; + *val2 = ad5421_get_scale(st); + return IIO_VAL_INT_PLUS_MICRO; + case IIO_CHAN_INFO_OFFSET: + *val = ad5421_get_offset(st); + return IIO_VAL_INT; + case IIO_CHAN_INFO_CALIBBIAS: + ret = ad5421_read(indio_dev, AD5421_REG_OFFSET); + if (ret < 0) + return ret; + *val = ret - 32768; + return IIO_VAL_INT; + case IIO_CHAN_INFO_CALIBSCALE: + ret = ad5421_read(indio_dev, AD5421_REG_GAIN); + if (ret < 0) + return ret; + *val = ret; + return IIO_VAL_INT; + } + + return -EINVAL; +} + +static int ad5421_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int val, int val2, long mask) +{ + const unsigned int max_val = 1 << 16; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + if (val >= max_val || val < 0) + return -EINVAL; + + return ad5421_write(indio_dev, AD5421_REG_DAC_DATA, val); + case IIO_CHAN_INFO_CALIBBIAS: + val += 32768; + if (val >= max_val || val < 0) + return -EINVAL; + + return ad5421_write(indio_dev, AD5421_REG_OFFSET, val); + case IIO_CHAN_INFO_CALIBSCALE: + if (val >= max_val || val < 0) + return -EINVAL; + + return ad5421_write(indio_dev, AD5421_REG_GAIN, val); + default: + break; + } + + return -EINVAL; +} + +static int ad5421_write_event_config(struct iio_dev *indio_dev, + u64 event_code, int state) +{ + struct ad5421_state *st = iio_priv(indio_dev); + unsigned int mask; + + switch (IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(event_code)) { + case IIO_CURRENT: + if (IIO_EVENT_CODE_EXTRACT_DIR(event_code) == + IIO_EV_DIR_RISING) + mask = AD5421_FAULT_OVER_CURRENT; + else + mask = AD5421_FAULT_UNDER_CURRENT; + break; + case IIO_TEMP: + mask = AD5421_FAULT_TEMP_OVER_140; + break; + default: + return -EINVAL; + } + + mutex_lock(&indio_dev->mlock); + if (state) + st->fault_mask |= mask; + else + st->fault_mask &= ~mask; + mutex_unlock(&indio_dev->mlock); + + return 0; +} + +static int ad5421_read_event_config(struct iio_dev *indio_dev, + u64 event_code) +{ + struct ad5421_state *st = iio_priv(indio_dev); + unsigned int mask; + + switch (IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(event_code)) { + case IIO_CURRENT: + if (IIO_EVENT_CODE_EXTRACT_DIR(event_code) == + IIO_EV_DIR_RISING) + mask = AD5421_FAULT_OVER_CURRENT; + else + mask = AD5421_FAULT_UNDER_CURRENT; + break; + case IIO_TEMP: + mask = AD5421_FAULT_TEMP_OVER_140; + break; + default: + return -EINVAL; + } + + return (bool)(st->fault_mask & mask); +} + +static int ad5421_read_event_value(struct iio_dev *indio_dev, u64 event_code, + int *val) +{ + int ret; + + switch (IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(event_code)) { + case IIO_CURRENT: + ret = ad5421_read(indio_dev, AD5421_REG_DAC_DATA); + if (ret < 0) + return ret; + *val = ret; + break; + case IIO_TEMP: + *val = 140000; + break; + default: + return -EINVAL; + } + + return 0; +} + +static const struct iio_info ad5421_info = { + .read_raw = ad5421_read_raw, + .write_raw = ad5421_write_raw, + .read_event_config = ad5421_read_event_config, + .write_event_config = ad5421_write_event_config, + .read_event_value = ad5421_read_event_value, + .driver_module = THIS_MODULE, +}; + +static int __devinit ad5421_probe(struct spi_device *spi) +{ + struct ad5421_platform_data *pdata = dev_get_platdata(&spi->dev); + struct iio_dev *indio_dev; + struct ad5421_state *st; + int ret; + + indio_dev = iio_device_alloc(sizeof(*st)); + if (indio_dev == NULL) { + dev_err(&spi->dev, "Failed to allocate iio device\n"); + return -ENOMEM; + } + + st = iio_priv(indio_dev); + spi_set_drvdata(spi, indio_dev); + + st->spi = spi; + + indio_dev->dev.parent = &spi->dev; + indio_dev->name = "ad5421"; + indio_dev->info = &ad5421_info; + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->channels = ad5421_channels; + indio_dev->num_channels = ARRAY_SIZE(ad5421_channels); + + st->ctrl = AD5421_CTRL_WATCHDOG_DISABLE | + AD5421_CTRL_AUTO_FAULT_READBACK; + + if (pdata) { + st->current_range = pdata->current_range; + if (pdata->external_vref) + st->ctrl |= AD5421_CTRL_PWR_DOWN_INT_VREF; + } else { + st->current_range = AD5421_CURRENT_RANGE_4mA_20mA; + } + + /* write initial ctrl register value */ + ad5421_update_ctrl(indio_dev, 0, 0); + + if (spi->irq) { + ret = request_threaded_irq(spi->irq, + NULL, + ad5421_fault_handler, + IRQF_TRIGGER_HIGH | IRQF_ONESHOT, + "ad5421 fault", + indio_dev); + if (ret) + goto error_free; + } + + ret = iio_device_register(indio_dev); + if (ret) { + dev_err(&spi->dev, "Failed to register iio device: %d\n", ret); + goto error_free_irq; + } + + return 0; + +error_free_irq: + if (spi->irq) + free_irq(spi->irq, indio_dev); +error_free: + iio_device_free(indio_dev); + + return ret; +} + +static int __devexit ad5421_remove(struct spi_device *spi) +{ + struct iio_dev *indio_dev = spi_get_drvdata(spi); + + iio_device_unregister(indio_dev); + if (spi->irq) + free_irq(spi->irq, indio_dev); + iio_device_free(indio_dev); + + return 0; +} + +static struct spi_driver ad5421_driver = { + .driver = { + .name = "ad5421", + .owner = THIS_MODULE, + }, + .probe = ad5421_probe, + .remove = __devexit_p(ad5421_remove), +}; +module_spi_driver(ad5421_driver); + +MODULE_AUTHOR("Lars-Peter Clausen "); +MODULE_DESCRIPTION("Analog Devices AD5421 DAC"); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("spi:ad5421"); diff --git a/drivers/iio/dac/ad5446.c b/drivers/iio/dac/ad5446.c new file mode 100644 index 0000000..49f557f --- /dev/null +++ b/drivers/iio/dac/ad5446.c @@ -0,0 +1,381 @@ +/* + * AD5446 SPI DAC driver + * + * Copyright 2010 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "ad5446.h" + +static int ad5446_write(struct ad5446_state *st, unsigned val) +{ + __be16 data = cpu_to_be16(val); + return spi_write(st->spi, &data, sizeof(data)); +} + +static int ad5660_write(struct ad5446_state *st, unsigned val) +{ + uint8_t data[3]; + + data[0] = (val >> 16) & 0xFF; + data[1] = (val >> 8) & 0xFF; + data[2] = val & 0xFF; + + return spi_write(st->spi, data, sizeof(data)); +} + +static const char * const ad5446_powerdown_modes[] = { + "1kohm_to_gnd", "100kohm_to_gnd", "three_state" +}; + +static int ad5446_set_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, unsigned int mode) +{ + struct ad5446_state *st = iio_priv(indio_dev); + + st->pwr_down_mode = mode + 1; + + return 0; +} + +static int ad5446_get_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan) +{ + struct ad5446_state *st = iio_priv(indio_dev); + + return st->pwr_down_mode - 1; +} + +static const struct iio_enum ad5446_powerdown_mode_enum = { + .items = ad5446_powerdown_modes, + .num_items = ARRAY_SIZE(ad5446_powerdown_modes), + .get = ad5446_get_powerdown_mode, + .set = ad5446_set_powerdown_mode, +}; + +static ssize_t ad5446_read_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, + const struct iio_chan_spec *chan, + char *buf) +{ + struct ad5446_state *st = iio_priv(indio_dev); + + return sprintf(buf, "%d\n", st->pwr_down); +} + +static ssize_t ad5446_write_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, + const struct iio_chan_spec *chan, + const char *buf, size_t len) +{ + struct ad5446_state *st = iio_priv(indio_dev); + unsigned int shift; + unsigned int val; + bool powerdown; + int ret; + + ret = strtobool(buf, &powerdown); + if (ret) + return ret; + + mutex_lock(&indio_dev->mlock); + st->pwr_down = powerdown; + + if (st->pwr_down) { + shift = chan->scan_type.realbits + chan->scan_type.shift; + val = st->pwr_down_mode << shift; + } else { + val = st->cached_val; + } + + ret = st->chip_info->write(st, val); + mutex_unlock(&indio_dev->mlock); + + return ret ? ret : len; +} + +static const struct iio_chan_spec_ext_info ad5064_ext_info_powerdown[] = { + { + .name = "powerdown", + .read = ad5446_read_dac_powerdown, + .write = ad5446_write_dac_powerdown, + }, + IIO_ENUM("powerdown_mode", false, &ad5446_powerdown_mode_enum), + IIO_ENUM_AVAILABLE("powerdown_mode", &ad5446_powerdown_mode_enum), + { }, +}; + +#define _AD5446_CHANNEL(bits, storage, shift, ext) { \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .output = 1, \ + .channel = 0, \ + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ + IIO_CHAN_INFO_SCALE_SHARED_BIT, \ + .scan_type = IIO_ST('u', (bits), (storage), (shift)), \ + .ext_info = (ext), \ +} + +#define AD5446_CHANNEL(bits, storage, shift) \ + _AD5446_CHANNEL(bits, storage, shift, NULL) + +#define AD5446_CHANNEL_POWERDOWN(bits, storage, shift) \ + _AD5446_CHANNEL(bits, storage, shift, ad5064_ext_info_powerdown) + +static const struct ad5446_chip_info ad5446_chip_info_tbl[] = { + [ID_AD5444] = { + .channel = AD5446_CHANNEL(12, 16, 2), + .write = ad5446_write, + }, + [ID_AD5446] = { + .channel = AD5446_CHANNEL(14, 16, 0), + .write = ad5446_write, + }, + [ID_AD5541A] = { + .channel = AD5446_CHANNEL(16, 16, 0), + .write = ad5446_write, + }, + [ID_AD5512A] = { + .channel = AD5446_CHANNEL(12, 16, 4), + .write = ad5446_write, + }, + [ID_AD5553] = { + .channel = AD5446_CHANNEL(14, 16, 0), + .write = ad5446_write, + }, + [ID_AD5601] = { + .channel = AD5446_CHANNEL_POWERDOWN(8, 16, 6), + .write = ad5446_write, + }, + [ID_AD5611] = { + .channel = AD5446_CHANNEL_POWERDOWN(10, 16, 4), + .write = ad5446_write, + }, + [ID_AD5621] = { + .channel = AD5446_CHANNEL_POWERDOWN(12, 16, 2), + .write = ad5446_write, + }, + [ID_AD5620_2500] = { + .channel = AD5446_CHANNEL_POWERDOWN(12, 16, 2), + .int_vref_mv = 2500, + .write = ad5446_write, + }, + [ID_AD5620_1250] = { + .channel = AD5446_CHANNEL_POWERDOWN(12, 16, 2), + .int_vref_mv = 1250, + .write = ad5446_write, + }, + [ID_AD5640_2500] = { + .channel = AD5446_CHANNEL_POWERDOWN(14, 16, 0), + .int_vref_mv = 2500, + .write = ad5446_write, + }, + [ID_AD5640_1250] = { + .channel = AD5446_CHANNEL_POWERDOWN(14, 16, 0), + .int_vref_mv = 1250, + .write = ad5446_write, + }, + [ID_AD5660_2500] = { + .channel = AD5446_CHANNEL_POWERDOWN(16, 16, 0), + .int_vref_mv = 2500, + .write = ad5660_write, + }, + [ID_AD5660_1250] = { + .channel = AD5446_CHANNEL_POWERDOWN(16, 16, 0), + .int_vref_mv = 1250, + .write = ad5660_write, + }, + [ID_AD5662] = { + .channel = AD5446_CHANNEL_POWERDOWN(16, 16, 0), + .write = ad5660_write, + }, +}; + +static int ad5446_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, + int *val2, + long m) +{ + struct ad5446_state *st = iio_priv(indio_dev); + unsigned long scale_uv; + + switch (m) { + case IIO_CHAN_INFO_RAW: + *val = st->cached_val; + return IIO_VAL_INT; + case IIO_CHAN_INFO_SCALE: + scale_uv = (st->vref_mv * 1000) >> chan->scan_type.realbits; + *val = scale_uv / 1000; + *val2 = (scale_uv % 1000) * 1000; + return IIO_VAL_INT_PLUS_MICRO; + + } + return -EINVAL; +} + +static int ad5446_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int val, + int val2, + long mask) +{ + struct ad5446_state *st = iio_priv(indio_dev); + int ret = 0; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + if (val >= (1 << chan->scan_type.realbits) || val < 0) + return -EINVAL; + + val <<= chan->scan_type.shift; + mutex_lock(&indio_dev->mlock); + st->cached_val = val; + if (!st->pwr_down) + ret = st->chip_info->write(st, val); + mutex_unlock(&indio_dev->mlock); + break; + default: + ret = -EINVAL; + } + + return ret; +} + +static const struct iio_info ad5446_info = { + .read_raw = ad5446_read_raw, + .write_raw = ad5446_write_raw, + .driver_module = THIS_MODULE, +}; + +static int __devinit ad5446_probe(struct spi_device *spi) +{ + struct ad5446_state *st; + struct iio_dev *indio_dev; + struct regulator *reg; + int ret, voltage_uv = 0; + + reg = regulator_get(&spi->dev, "vcc"); + if (!IS_ERR(reg)) { + ret = regulator_enable(reg); + if (ret) + goto error_put_reg; + + voltage_uv = regulator_get_voltage(reg); + } + + indio_dev = iio_device_alloc(sizeof(*st)); + if (indio_dev == NULL) { + ret = -ENOMEM; + goto error_disable_reg; + } + st = iio_priv(indio_dev); + st->chip_info = + &ad5446_chip_info_tbl[spi_get_device_id(spi)->driver_data]; + + spi_set_drvdata(spi, indio_dev); + st->reg = reg; + st->spi = spi; + + /* Establish that the iio_dev is a child of the spi device */ + indio_dev->dev.parent = &spi->dev; + indio_dev->name = spi_get_device_id(spi)->name; + indio_dev->info = &ad5446_info; + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->channels = &st->chip_info->channel; + indio_dev->num_channels = 1; + + st->pwr_down_mode = MODE_PWRDWN_1k; + + if (st->chip_info->int_vref_mv) + st->vref_mv = st->chip_info->int_vref_mv; + else if (voltage_uv) + st->vref_mv = voltage_uv / 1000; + else + dev_warn(&spi->dev, "reference voltage unspecified\n"); + + ret = iio_device_register(indio_dev); + if (ret) + goto error_free_device; + + return 0; + +error_free_device: + iio_device_free(indio_dev); +error_disable_reg: + if (!IS_ERR(reg)) + regulator_disable(reg); +error_put_reg: + if (!IS_ERR(reg)) + regulator_put(reg); + + return ret; +} + +static int ad5446_remove(struct spi_device *spi) +{ + struct iio_dev *indio_dev = spi_get_drvdata(spi); + struct ad5446_state *st = iio_priv(indio_dev); + + iio_device_unregister(indio_dev); + if (!IS_ERR(st->reg)) { + regulator_disable(st->reg); + regulator_put(st->reg); + } + iio_device_free(indio_dev); + + return 0; +} + +static const struct spi_device_id ad5446_id[] = { + {"ad5444", ID_AD5444}, + {"ad5446", ID_AD5446}, + {"ad5512a", ID_AD5512A}, + {"ad5541a", ID_AD5541A}, + {"ad5542a", ID_AD5541A}, /* ad5541a and ad5542a are compatible */ + {"ad5543", ID_AD5541A}, /* ad5541a and ad5543 are compatible */ + {"ad5553", ID_AD5553}, + {"ad5601", ID_AD5601}, + {"ad5611", ID_AD5611}, + {"ad5621", ID_AD5621}, + {"ad5620-2500", ID_AD5620_2500}, /* AD5620/40/60: */ + {"ad5620-1250", ID_AD5620_1250}, /* part numbers may look differently */ + {"ad5640-2500", ID_AD5640_2500}, + {"ad5640-1250", ID_AD5640_1250}, + {"ad5660-2500", ID_AD5660_2500}, + {"ad5660-1250", ID_AD5660_1250}, + {"ad5662", ID_AD5662}, + {} +}; +MODULE_DEVICE_TABLE(spi, ad5446_id); + +static struct spi_driver ad5446_driver = { + .driver = { + .name = "ad5446", + .owner = THIS_MODULE, + }, + .probe = ad5446_probe, + .remove = __devexit_p(ad5446_remove), + .id_table = ad5446_id, +}; +module_spi_driver(ad5446_driver); + +MODULE_AUTHOR("Michael Hennerich "); +MODULE_DESCRIPTION("Analog Devices AD5444/AD5446 DAC"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/iio/dac/ad5446.h b/drivers/iio/dac/ad5446.h new file mode 100644 index 0000000..dfd68ce --- /dev/null +++ b/drivers/iio/dac/ad5446.h @@ -0,0 +1,89 @@ +/* + * AD5446 SPI DAC driver + * + * Copyright 2010 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */ +#ifndef IIO_DAC_AD5446_H_ +#define IIO_DAC_AD5446_H_ + +/* DAC Control Bits */ + +#define AD5446_LOAD (0x0 << 14) /* Load and update */ +#define AD5446_SDO_DIS (0x1 << 14) /* Disable SDO */ +#define AD5446_NOP (0x2 << 14) /* No operation */ +#define AD5446_CLK_RISING (0x3 << 14) /* Clock data on rising edge */ + +#define AD5620_LOAD (0x0 << 14) /* Load and update Norm Operation*/ +#define AD5620_PWRDWN_1k (0x1 << 14) /* Power-down: 1kOhm to GND */ +#define AD5620_PWRDWN_100k (0x2 << 14) /* Power-down: 100kOhm to GND */ +#define AD5620_PWRDWN_TRISTATE (0x3 << 14) /* Power-down: Three-state */ + +#define AD5660_LOAD (0x0 << 16) /* Load and update Norm Operation*/ +#define AD5660_PWRDWN_1k (0x1 << 16) /* Power-down: 1kOhm to GND */ +#define AD5660_PWRDWN_100k (0x2 << 16) /* Power-down: 100kOhm to GND */ +#define AD5660_PWRDWN_TRISTATE (0x3 << 16) /* Power-down: Three-state */ + +#define MODE_PWRDWN_1k 0x1 +#define MODE_PWRDWN_100k 0x2 +#define MODE_PWRDWN_TRISTATE 0x3 + +/** + * struct ad5446_state - driver instance specific data + * @spi: spi_device + * @chip_info: chip model specific constants, available modes etc + * @reg: supply regulator + * @vref_mv: actual reference voltage used + */ + +struct ad5446_state { + struct spi_device *spi; + const struct ad5446_chip_info *chip_info; + struct regulator *reg; + unsigned short vref_mv; + unsigned cached_val; + unsigned pwr_down_mode; + unsigned pwr_down; +}; + +/** + * struct ad5446_chip_info - chip specific information + * @channel: channel spec for the DAC + * @int_vref_mv: AD5620/40/60: the internal reference voltage + * @write: chip specific helper function to write to the register + */ + +struct ad5446_chip_info { + struct iio_chan_spec channel; + u16 int_vref_mv; + int (*write)(struct ad5446_state *st, unsigned val); +}; + +/** + * ad5446_supported_device_ids: + * The AD5620/40/60 parts are available in different fixed internal reference + * voltage options. The actual part numbers may look differently + * (and a bit cryptic), however this style is used to make clear which + * parts are supported here. + */ + +enum ad5446_supported_device_ids { + ID_AD5444, + ID_AD5446, + ID_AD5541A, + ID_AD5512A, + ID_AD5553, + ID_AD5601, + ID_AD5611, + ID_AD5621, + ID_AD5620_2500, + ID_AD5620_1250, + ID_AD5640_2500, + ID_AD5640_1250, + ID_AD5660_2500, + ID_AD5660_1250, + ID_AD5662, +}; + +#endif /* IIO_DAC_AD5446_H_ */ diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c new file mode 100644 index 0000000..242bdc7 --- /dev/null +++ b/drivers/iio/dac/ad5504.c @@ -0,0 +1,393 @@ +/* + * AD5504, AD5501 High Voltage Digital to Analog Converter + * + * Copyright 2011 Analog Devices Inc. + * + * Licensed under the GPL-2. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define AD5505_BITS 12 +#define AD5504_RES_MASK ((1 << (AD5505_BITS)) - 1) + +#define AD5504_CMD_READ (1 << 15) +#define AD5504_CMD_WRITE (0 << 15) +#define AD5504_ADDR(addr) ((addr) << 12) + +/* Registers */ +#define AD5504_ADDR_NOOP 0 +#define AD5504_ADDR_DAC(x) ((x) + 1) +#define AD5504_ADDR_ALL_DAC 5 +#define AD5504_ADDR_CTRL 7 + +/* Control Register */ +#define AD5504_DAC_PWR(ch) ((ch) << 2) +#define AD5504_DAC_PWRDWN_MODE(mode) ((mode) << 6) +#define AD5504_DAC_PWRDN_20K 0 +#define AD5504_DAC_PWRDN_3STATE 1 + +/** + * struct ad5446_state - driver instance specific data + * @us: spi_device + * @reg: supply regulator + * @vref_mv: actual reference voltage used + * @pwr_down_mask power down mask + * @pwr_down_mode current power down mode + */ + +struct ad5504_state { + struct spi_device *spi; + struct regulator *reg; + unsigned short vref_mv; + unsigned pwr_down_mask; + unsigned pwr_down_mode; +}; + +/** + * ad5504_supported_device_ids: + */ + +enum ad5504_supported_device_ids { + ID_AD5504, + ID_AD5501, +}; + +static int ad5504_spi_write(struct spi_device *spi, u8 addr, u16 val) +{ + u16 tmp = cpu_to_be16(AD5504_CMD_WRITE | + AD5504_ADDR(addr) | + (val & AD5504_RES_MASK)); + + return spi_write(spi, (u8 *)&tmp, 2); +} + +static int ad5504_spi_read(struct spi_device *spi, u8 addr) +{ + u16 tmp = cpu_to_be16(AD5504_CMD_READ | AD5504_ADDR(addr)); + u16 val; + int ret; + struct spi_transfer t = { + .tx_buf = &tmp, + .rx_buf = &val, + .len = 2, + }; + struct spi_message m; + + spi_message_init(&m); + spi_message_add_tail(&t, &m); + ret = spi_sync(spi, &m); + + if (ret < 0) + return ret; + + return be16_to_cpu(val) & AD5504_RES_MASK; +} + +static int ad5504_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, + int *val2, + long m) +{ + struct ad5504_state *st = iio_priv(indio_dev); + unsigned long scale_uv; + int ret; + + switch (m) { + case IIO_CHAN_INFO_RAW: + ret = ad5504_spi_read(st->spi, chan->address); + if (ret < 0) + return ret; + + *val = ret; + + return IIO_VAL_INT; + case IIO_CHAN_INFO_SCALE: + scale_uv = (st->vref_mv * 1000) >> chan->scan_type.realbits; + *val = scale_uv / 1000; + *val2 = (scale_uv % 1000) * 1000; + return IIO_VAL_INT_PLUS_MICRO; + + } + return -EINVAL; +} + +static int ad5504_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int val, + int val2, + long mask) +{ + struct ad5504_state *st = iio_priv(indio_dev); + int ret; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + if (val >= (1 << chan->scan_type.realbits) || val < 0) + return -EINVAL; + + return ad5504_spi_write(st->spi, chan->address, val); + default: + ret = -EINVAL; + } + + return -EINVAL; +} + +static const char * const ad5504_powerdown_modes[] = { + "20kohm_to_gnd", + "three_state", +}; + +static int ad5504_get_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan) +{ + struct ad5504_state *st = iio_priv(indio_dev); + + return st->pwr_down_mode; +} + +static int ad5504_set_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, unsigned int mode) +{ + struct ad5504_state *st = iio_priv(indio_dev); + + st->pwr_down_mode = mode; + + return 0; +} + +static const struct iio_enum ad5504_powerdown_mode_enum = { + .items = ad5504_powerdown_modes, + .num_items = ARRAY_SIZE(ad5504_powerdown_modes), + .get = ad5504_get_powerdown_mode, + .set = ad5504_set_powerdown_mode, +}; + +static ssize_t ad5504_read_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, char *buf) +{ + struct ad5504_state *st = iio_priv(indio_dev); + + return sprintf(buf, "%d\n", + !(st->pwr_down_mask & (1 << chan->channel))); +} + +static ssize_t ad5504_write_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, const char *buf, + size_t len) +{ + bool pwr_down; + int ret; + struct ad5504_state *st = iio_priv(indio_dev); + + ret = strtobool(buf, &pwr_down); + if (ret) + return ret; + + if (pwr_down) + st->pwr_down_mask |= (1 << chan->channel); + else + st->pwr_down_mask &= ~(1 << chan->channel); + + ret = ad5504_spi_write(st->spi, AD5504_ADDR_CTRL, + AD5504_DAC_PWRDWN_MODE(st->pwr_down_mode) | + AD5504_DAC_PWR(st->pwr_down_mask)); + + /* writes to the CTRL register must be followed by a NOOP */ + ad5504_spi_write(st->spi, AD5504_ADDR_NOOP, 0); + + return ret ? ret : len; +} + +static IIO_CONST_ATTR(temp0_thresh_rising_value, "110000"); +static IIO_CONST_ATTR(temp0_thresh_rising_en, "1"); + +static struct attribute *ad5504_ev_attributes[] = { + &iio_const_attr_temp0_thresh_rising_value.dev_attr.attr, + &iio_const_attr_temp0_thresh_rising_en.dev_attr.attr, + NULL, +}; + +static struct attribute_group ad5504_ev_attribute_group = { + .attrs = ad5504_ev_attributes, + .name = "events", +}; + +static irqreturn_t ad5504_event_handler(int irq, void *private) +{ + iio_push_event(private, + IIO_UNMOD_EVENT_CODE(IIO_TEMP, + 0, + IIO_EV_TYPE_THRESH, + IIO_EV_DIR_RISING), + iio_get_time_ns()); + + return IRQ_HANDLED; +} + +static const struct iio_info ad5504_info = { + .write_raw = ad5504_write_raw, + .read_raw = ad5504_read_raw, + .event_attrs = &ad5504_ev_attribute_group, + .driver_module = THIS_MODULE, +}; + +static const struct iio_chan_spec_ext_info ad5504_ext_info[] = { + { + .name = "powerdown", + .read = ad5504_read_dac_powerdown, + .write = ad5504_write_dac_powerdown, + }, + IIO_ENUM("powerdown_mode", true, &ad5504_powerdown_mode_enum), + IIO_ENUM_AVAILABLE("powerdown_mode", &ad5504_powerdown_mode_enum), + { }, +}; + +#define AD5504_CHANNEL(_chan) { \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .output = 1, \ + .channel = (_chan), \ + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ + IIO_CHAN_INFO_SCALE_SHARED_BIT, \ + .address = AD5504_ADDR_DAC(_chan), \ + .scan_type = IIO_ST('u', 12, 16, 0), \ + .ext_info = ad5504_ext_info, \ +} + +static const struct iio_chan_spec ad5504_channels[] = { + AD5504_CHANNEL(0), + AD5504_CHANNEL(1), + AD5504_CHANNEL(2), + AD5504_CHANNEL(3), +}; + +static int __devinit ad5504_probe(struct spi_device *spi) +{ + struct ad5504_platform_data *pdata = spi->dev.platform_data; + struct iio_dev *indio_dev; + struct ad5504_state *st; + struct regulator *reg; + int ret, voltage_uv = 0; + + indio_dev = iio_device_alloc(sizeof(*st)); + if (indio_dev == NULL) { + ret = -ENOMEM; + goto error_ret; + } + reg = regulator_get(&spi->dev, "vcc"); + if (!IS_ERR(reg)) { + ret = regulator_enable(reg); + if (ret) + goto error_put_reg; + + voltage_uv = regulator_get_voltage(reg); + } + + spi_set_drvdata(spi, indio_dev); + st = iio_priv(indio_dev); + if (voltage_uv) + st->vref_mv = voltage_uv / 1000; + else if (pdata) + st->vref_mv = pdata->vref_mv; + else + dev_warn(&spi->dev, "reference voltage unspecified\n"); + + st->reg = reg; + st->spi = spi; + indio_dev->dev.parent = &spi->dev; + indio_dev->name = spi_get_device_id(st->spi)->name; + indio_dev->info = &ad5504_info; + if (spi_get_device_id(st->spi)->driver_data == ID_AD5501) + indio_dev->num_channels = 1; + else + indio_dev->num_channels = 4; + indio_dev->channels = ad5504_channels; + indio_dev->modes = INDIO_DIRECT_MODE; + + if (spi->irq) { + ret = request_threaded_irq(spi->irq, + NULL, + &ad5504_event_handler, + IRQF_TRIGGER_FALLING | IRQF_ONESHOT, + spi_get_device_id(st->spi)->name, + indio_dev); + if (ret) + goto error_disable_reg; + } + + ret = iio_device_register(indio_dev); + if (ret) + goto error_free_irq; + + return 0; + +error_free_irq: + if (spi->irq) + free_irq(spi->irq, indio_dev); +error_disable_reg: + if (!IS_ERR(reg)) + regulator_disable(reg); +error_put_reg: + if (!IS_ERR(reg)) + regulator_put(reg); + + iio_device_free(indio_dev); +error_ret: + return ret; +} + +static int __devexit ad5504_remove(struct spi_device *spi) +{ + struct iio_dev *indio_dev = spi_get_drvdata(spi); + struct ad5504_state *st = iio_priv(indio_dev); + + iio_device_unregister(indio_dev); + if (spi->irq) + free_irq(spi->irq, indio_dev); + + if (!IS_ERR(st->reg)) { + regulator_disable(st->reg); + regulator_put(st->reg); + } + iio_device_free(indio_dev); + + return 0; +} + +static const struct spi_device_id ad5504_id[] = { + {"ad5504", ID_AD5504}, + {"ad5501", ID_AD5501}, + {} +}; +MODULE_DEVICE_TABLE(spi, ad5504_id); + +static struct spi_driver ad5504_driver = { + .driver = { + .name = "ad5504", + .owner = THIS_MODULE, + }, + .probe = ad5504_probe, + .remove = __devexit_p(ad5504_remove), + .id_table = ad5504_id, +}; +module_spi_driver(ad5504_driver); + +MODULE_AUTHOR("Michael Hennerich "); +MODULE_DESCRIPTION("Analog Devices AD5501/AD5501 DAC"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/iio/dac/ad5624r.h b/drivers/iio/dac/ad5624r.h new file mode 100644 index 0000000..5dca302 --- /dev/null +++ b/drivers/iio/dac/ad5624r.h @@ -0,0 +1,79 @@ +/* + * AD5624R SPI DAC driver + * + * Copyright 2010-2011 Analog Devices Inc. + * + * Licensed under the GPL-2. + */ +#ifndef SPI_AD5624R_H_ +#define SPI_AD5624R_H_ + +#define AD5624R_DAC_CHANNELS 4 + +#define AD5624R_ADDR_DAC0 0x0 +#define AD5624R_ADDR_DAC1 0x1 +#define AD5624R_ADDR_DAC2 0x2 +#define AD5624R_ADDR_DAC3 0x3 +#define AD5624R_ADDR_ALL_DAC 0x7 + +#define AD5624R_CMD_WRITE_INPUT_N 0x0 +#define AD5624R_CMD_UPDATE_DAC_N 0x1 +#define AD5624R_CMD_WRITE_INPUT_N_UPDATE_ALL 0x2 +#define AD5624R_CMD_WRITE_INPUT_N_UPDATE_N 0x3 +#define AD5624R_CMD_POWERDOWN_DAC 0x4 +#define AD5624R_CMD_RESET 0x5 +#define AD5624R_CMD_LDAC_SETUP 0x6 +#define AD5624R_CMD_INTERNAL_REFER_SETUP 0x7 + +#define AD5624R_LDAC_PWRDN_NONE 0x0 +#define AD5624R_LDAC_PWRDN_1K 0x1 +#define AD5624R_LDAC_PWRDN_100K 0x2 +#define AD5624R_LDAC_PWRDN_3STATE 0x3 + +/** + * struct ad5624r_chip_info - chip specific information + * @channels: channel spec for the DAC + * @int_vref_mv: AD5620/40/60: the internal reference voltage + */ + +struct ad5624r_chip_info { + const struct iio_chan_spec *channels; + u16 int_vref_mv; +}; + +/** + * struct ad5446_state - driver instance specific data + * @indio_dev: the industrial I/O device + * @us: spi_device + * @chip_info: chip model specific constants, available modes etc + * @reg: supply regulator + * @vref_mv: actual reference voltage used + * @pwr_down_mask power down mask + * @pwr_down_mode current power down mode + */ + +struct ad5624r_state { + struct spi_device *us; + const struct ad5624r_chip_info *chip_info; + struct regulator *reg; + unsigned short vref_mv; + unsigned pwr_down_mask; + unsigned pwr_down_mode; +}; + +/** + * ad5624r_supported_device_ids: + * The AD5624/44/64 parts are available in different + * fixed internal reference voltage options. + */ + +enum ad5624r_supported_device_ids { + ID_AD5624R3, + ID_AD5644R3, + ID_AD5664R3, + ID_AD5624R5, + ID_AD5644R5, + ID_AD5664R5, +}; + +#endif /* SPI_AD5624R_H_ */ diff --git a/drivers/iio/dac/ad5624r_spi.c b/drivers/iio/dac/ad5624r_spi.c new file mode 100644 index 0000000..6a7d6a4 --- /dev/null +++ b/drivers/iio/dac/ad5624r_spi.c @@ -0,0 +1,324 @@ +/* + * AD5624R, AD5644R, AD5664R Digital to analog convertors spi driver + * + * Copyright 2010-2011 Analog Devices Inc. + * + * Licensed under the GPL-2. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "ad5624r.h" + +static int ad5624r_spi_write(struct spi_device *spi, + u8 cmd, u8 addr, u16 val, u8 len) +{ + u32 data; + u8 msg[3]; + + /* + * The input shift register is 24 bits wide. The first two bits are + * don't care bits. The next three are the command bits, C2 to C0, + * followed by the 3-bit DAC address, A2 to A0, and then the + * 16-, 14-, 12-bit data-word. The data-word comprises the 16-, + * 14-, 12-bit input code followed by 0, 2, or 4 don't care bits, + * for the AD5664R, AD5644R, and AD5624R, respectively. + */ + data = (0 << 22) | (cmd << 19) | (addr << 16) | (val << (16 - len)); + msg[0] = data >> 16; + msg[1] = data >> 8; + msg[2] = data; + + return spi_write(spi, msg, 3); +} + +static int ad5624r_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, + int *val2, + long m) +{ + struct ad5624r_state *st = iio_priv(indio_dev); + unsigned long scale_uv; + + switch (m) { + case IIO_CHAN_INFO_SCALE: + scale_uv = (st->vref_mv * 1000) >> chan->scan_type.realbits; + *val = scale_uv / 1000; + *val2 = (scale_uv % 1000) * 1000; + return IIO_VAL_INT_PLUS_MICRO; + + } + return -EINVAL; +} + +static int ad5624r_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int val, + int val2, + long mask) +{ + struct ad5624r_state *st = iio_priv(indio_dev); + int ret; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + if (val >= (1 << chan->scan_type.realbits) || val < 0) + return -EINVAL; + + return ad5624r_spi_write(st->us, + AD5624R_CMD_WRITE_INPUT_N_UPDATE_N, + chan->address, val, + chan->scan_type.shift); + default: + ret = -EINVAL; + } + + return -EINVAL; +} + +static const char * const ad5624r_powerdown_modes[] = { + "1kohm_to_gnd", + "100kohm_to_gnd", + "three_state" +}; + +static int ad5624r_get_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan) +{ + struct ad5624r_state *st = iio_priv(indio_dev); + + return st->pwr_down_mode; +} + +static int ad5624r_set_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, unsigned int mode) +{ + struct ad5624r_state *st = iio_priv(indio_dev); + + st->pwr_down_mode = mode; + + return 0; +} + +static const struct iio_enum ad5624r_powerdown_mode_enum = { + .items = ad5624r_powerdown_modes, + .num_items = ARRAY_SIZE(ad5624r_powerdown_modes), + .get = ad5624r_get_powerdown_mode, + .set = ad5624r_set_powerdown_mode, +}; + +static ssize_t ad5624r_read_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, char *buf) +{ + struct ad5624r_state *st = iio_priv(indio_dev); + + return sprintf(buf, "%d\n", + !!(st->pwr_down_mask & (1 << chan->channel))); +} + +static ssize_t ad5624r_write_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, const char *buf, + size_t len) +{ + bool pwr_down; + int ret; + struct ad5624r_state *st = iio_priv(indio_dev); + + ret = strtobool(buf, &pwr_down); + if (ret) + return ret; + + if (pwr_down) + st->pwr_down_mask |= (1 << chan->channel); + else + st->pwr_down_mask &= ~(1 << chan->channel); + + ret = ad5624r_spi_write(st->us, AD5624R_CMD_POWERDOWN_DAC, 0, + (st->pwr_down_mode << 4) | + st->pwr_down_mask, 16); + + return ret ? ret : len; +} + +static const struct iio_info ad5624r_info = { + .write_raw = ad5624r_write_raw, + .read_raw = ad5624r_read_raw, + .driver_module = THIS_MODULE, +}; + +static const struct iio_chan_spec_ext_info ad5624r_ext_info[] = { + { + .name = "powerdown", + .read = ad5624r_read_dac_powerdown, + .write = ad5624r_write_dac_powerdown, + }, + IIO_ENUM("powerdown_mode", true, &ad5624r_powerdown_mode_enum), + IIO_ENUM_AVAILABLE("powerdown_mode", &ad5624r_powerdown_mode_enum), + { }, +}; + +#define AD5624R_CHANNEL(_chan, _bits) { \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .output = 1, \ + .channel = (_chan), \ + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ + IIO_CHAN_INFO_SCALE_SHARED_BIT, \ + .address = (_chan), \ + .scan_type = IIO_ST('u', (_bits), 16, 16 - (_bits)), \ + .ext_info = ad5624r_ext_info, \ +} + +#define DECLARE_AD5624R_CHANNELS(_name, _bits) \ + const struct iio_chan_spec _name##_channels[] = { \ + AD5624R_CHANNEL(0, _bits), \ + AD5624R_CHANNEL(1, _bits), \ + AD5624R_CHANNEL(2, _bits), \ + AD5624R_CHANNEL(3, _bits), \ +} + +static DECLARE_AD5624R_CHANNELS(ad5624r, 12); +static DECLARE_AD5624R_CHANNELS(ad5644r, 14); +static DECLARE_AD5624R_CHANNELS(ad5664r, 16); + +static const struct ad5624r_chip_info ad5624r_chip_info_tbl[] = { + [ID_AD5624R3] = { + .channels = ad5624r_channels, + .int_vref_mv = 1250, + }, + [ID_AD5624R5] = { + .channels = ad5624r_channels, + .int_vref_mv = 2500, + }, + [ID_AD5644R3] = { + .channels = ad5644r_channels, + .int_vref_mv = 1250, + }, + [ID_AD5644R5] = { + .channels = ad5644r_channels, + .int_vref_mv = 2500, + }, + [ID_AD5664R3] = { + .channels = ad5664r_channels, + .int_vref_mv = 1250, + }, + [ID_AD5664R5] = { + .channels = ad5664r_channels, + .int_vref_mv = 2500, + }, +}; + +static int __devinit ad5624r_probe(struct spi_device *spi) +{ + struct ad5624r_state *st; + struct iio_dev *indio_dev; + int ret, voltage_uv = 0; + + indio_dev = iio_device_alloc(sizeof(*st)); + if (indio_dev == NULL) { + ret = -ENOMEM; + goto error_ret; + } + st = iio_priv(indio_dev); + st->reg = regulator_get(&spi->dev, "vcc"); + if (!IS_ERR(st->reg)) { + ret = regulator_enable(st->reg); + if (ret) + goto error_put_reg; + + voltage_uv = regulator_get_voltage(st->reg); + } + + spi_set_drvdata(spi, indio_dev); + st->chip_info = + &ad5624r_chip_info_tbl[spi_get_device_id(spi)->driver_data]; + + if (voltage_uv) + st->vref_mv = voltage_uv / 1000; + else + st->vref_mv = st->chip_info->int_vref_mv; + + st->us = spi; + + indio_dev->dev.parent = &spi->dev; + indio_dev->name = spi_get_device_id(spi)->name; + indio_dev->info = &ad5624r_info; + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->channels = st->chip_info->channels; + indio_dev->num_channels = AD5624R_DAC_CHANNELS; + + ret = ad5624r_spi_write(spi, AD5624R_CMD_INTERNAL_REFER_SETUP, 0, + !!voltage_uv, 16); + if (ret) + goto error_disable_reg; + + ret = iio_device_register(indio_dev); + if (ret) + goto error_disable_reg; + + return 0; + +error_disable_reg: + if (!IS_ERR(st->reg)) + regulator_disable(st->reg); +error_put_reg: + if (!IS_ERR(st->reg)) + regulator_put(st->reg); + iio_device_free(indio_dev); +error_ret: + + return ret; +} + +static int __devexit ad5624r_remove(struct spi_device *spi) +{ + struct iio_dev *indio_dev = spi_get_drvdata(spi); + struct ad5624r_state *st = iio_priv(indio_dev); + + iio_device_unregister(indio_dev); + if (!IS_ERR(st->reg)) { + regulator_disable(st->reg); + regulator_put(st->reg); + } + iio_device_free(indio_dev); + + return 0; +} + +static const struct spi_device_id ad5624r_id[] = { + {"ad5624r3", ID_AD5624R3}, + {"ad5644r3", ID_AD5644R3}, + {"ad5664r3", ID_AD5664R3}, + {"ad5624r5", ID_AD5624R5}, + {"ad5644r5", ID_AD5644R5}, + {"ad5664r5", ID_AD5664R5}, + {} +}; +MODULE_DEVICE_TABLE(spi, ad5624r_id); + +static struct spi_driver ad5624r_driver = { + .driver = { + .name = "ad5624r", + .owner = THIS_MODULE, + }, + .probe = ad5624r_probe, + .remove = __devexit_p(ad5624r_remove), + .id_table = ad5624r_id, +}; +module_spi_driver(ad5624r_driver); + +MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); +MODULE_DESCRIPTION("Analog Devices AD5624/44/64R DAC spi driver"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c new file mode 100644 index 0000000..6948d75 --- /dev/null +++ b/drivers/iio/dac/ad5686.c @@ -0,0 +1,418 @@ +/* + * AD5686R, AD5685R, AD5684R Digital to analog converters driver + * + * Copyright 2011 Analog Devices Inc. + * + * Licensed under the GPL-2. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define AD5686_DAC_CHANNELS 4 + +#define AD5686_ADDR(x) ((x) << 16) +#define AD5686_CMD(x) ((x) << 20) + +#define AD5686_ADDR_DAC(chan) (0x1 << (chan)) +#define AD5686_ADDR_ALL_DAC 0xF + +#define AD5686_CMD_NOOP 0x0 +#define AD5686_CMD_WRITE_INPUT_N 0x1 +#define AD5686_CMD_UPDATE_DAC_N 0x2 +#define AD5686_CMD_WRITE_INPUT_N_UPDATE_N 0x3 +#define AD5686_CMD_POWERDOWN_DAC 0x4 +#define AD5686_CMD_LDAC_MASK 0x5 +#define AD5686_CMD_RESET 0x6 +#define AD5686_CMD_INTERNAL_REFER_SETUP 0x7 +#define AD5686_CMD_DAISY_CHAIN_ENABLE 0x8 +#define AD5686_CMD_READBACK_ENABLE 0x9 + +#define AD5686_LDAC_PWRDN_NONE 0x0 +#define AD5686_LDAC_PWRDN_1K 0x1 +#define AD5686_LDAC_PWRDN_100K 0x2 +#define AD5686_LDAC_PWRDN_3STATE 0x3 + +/** + * struct ad5686_chip_info - chip specific information + * @int_vref_mv: AD5620/40/60: the internal reference voltage + * @channel: channel specification +*/ + +struct ad5686_chip_info { + u16 int_vref_mv; + struct iio_chan_spec channel[AD5686_DAC_CHANNELS]; +}; + +/** + * struct ad5446_state - driver instance specific data + * @spi: spi_device + * @chip_info: chip model specific constants, available modes etc + * @reg: supply regulator + * @vref_mv: actual reference voltage used + * @pwr_down_mask: power down mask + * @pwr_down_mode: current power down mode + * @data: spi transfer buffers + */ + +struct ad5686_state { + struct spi_device *spi; + const struct ad5686_chip_info *chip_info; + struct regulator *reg; + unsigned short vref_mv; + unsigned pwr_down_mask; + unsigned pwr_down_mode; + /* + * DMA (thus cache coherency maintenance) requires the + * transfer buffers to live in their own cache lines. + */ + + union { + u32 d32; + u8 d8[4]; + } data[3] ____cacheline_aligned; +}; + +/** + * ad5686_supported_device_ids: + */ + +enum ad5686_supported_device_ids { + ID_AD5684, + ID_AD5685, + ID_AD5686, +}; +static int ad5686_spi_write(struct ad5686_state *st, + u8 cmd, u8 addr, u16 val, u8 shift) +{ + val <<= shift; + + st->data[0].d32 = cpu_to_be32(AD5686_CMD(cmd) | + AD5686_ADDR(addr) | + val); + + return spi_write(st->spi, &st->data[0].d8[1], 3); +} + +static int ad5686_spi_read(struct ad5686_state *st, u8 addr) +{ + struct spi_transfer t[] = { + { + .tx_buf = &st->data[0].d8[1], + .len = 3, + .cs_change = 1, + }, { + .tx_buf = &st->data[1].d8[1], + .rx_buf = &st->data[2].d8[1], + .len = 3, + }, + }; + struct spi_message m; + int ret; + + spi_message_init(&m); + spi_message_add_tail(&t[0], &m); + spi_message_add_tail(&t[1], &m); + + st->data[0].d32 = cpu_to_be32(AD5686_CMD(AD5686_CMD_READBACK_ENABLE) | + AD5686_ADDR(addr)); + st->data[1].d32 = cpu_to_be32(AD5686_CMD(AD5686_CMD_NOOP)); + + ret = spi_sync(st->spi, &m); + if (ret < 0) + return ret; + + return be32_to_cpu(st->data[2].d32); +} + +static const char * const ad5686_powerdown_modes[] = { + "1kohm_to_gnd", + "100kohm_to_gnd", + "three_state" +}; + +static int ad5686_get_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan) +{ + struct ad5686_state *st = iio_priv(indio_dev); + + return ((st->pwr_down_mode >> (chan->channel * 2)) & 0x3) - 1; +} + +static int ad5686_set_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, unsigned int mode) +{ + struct ad5686_state *st = iio_priv(indio_dev); + + st->pwr_down_mode &= ~(0x3 << (chan->channel * 2)); + st->pwr_down_mode |= ((mode + 1) << (chan->channel * 2)); + + return 0; +} + +static const struct iio_enum ad5686_powerdown_mode_enum = { + .items = ad5686_powerdown_modes, + .num_items = ARRAY_SIZE(ad5686_powerdown_modes), + .get = ad5686_get_powerdown_mode, + .set = ad5686_set_powerdown_mode, +}; + +static ssize_t ad5686_read_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, char *buf) +{ + struct ad5686_state *st = iio_priv(indio_dev); + + return sprintf(buf, "%d\n", !!(st->pwr_down_mask & + (0x3 << (chan->channel * 2)))); +} + +static ssize_t ad5686_write_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, const char *buf, + size_t len) +{ + bool readin; + int ret; + struct ad5686_state *st = iio_priv(indio_dev); + + ret = strtobool(buf, &readin); + if (ret) + return ret; + + if (readin == true) + st->pwr_down_mask |= (0x3 << (chan->channel * 2)); + else + st->pwr_down_mask &= ~(0x3 << (chan->channel * 2)); + + ret = ad5686_spi_write(st, AD5686_CMD_POWERDOWN_DAC, 0, + st->pwr_down_mask & st->pwr_down_mode, 0); + + return ret ? ret : len; +} + +static int ad5686_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, + int *val2, + long m) +{ + struct ad5686_state *st = iio_priv(indio_dev); + unsigned long scale_uv; + int ret; + + switch (m) { + case IIO_CHAN_INFO_RAW: + mutex_lock(&indio_dev->mlock); + ret = ad5686_spi_read(st, chan->address); + mutex_unlock(&indio_dev->mlock); + if (ret < 0) + return ret; + *val = ret; + return IIO_VAL_INT; + break; + case IIO_CHAN_INFO_SCALE: + scale_uv = (st->vref_mv * 100000) + >> (chan->scan_type.realbits); + *val = scale_uv / 100000; + *val2 = (scale_uv % 100000) * 10; + return IIO_VAL_INT_PLUS_MICRO; + + } + return -EINVAL; +} + +static int ad5686_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int val, + int val2, + long mask) +{ + struct ad5686_state *st = iio_priv(indio_dev); + int ret; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + if (val > (1 << chan->scan_type.realbits) || val < 0) + return -EINVAL; + + mutex_lock(&indio_dev->mlock); + ret = ad5686_spi_write(st, + AD5686_CMD_WRITE_INPUT_N_UPDATE_N, + chan->address, + val, + chan->scan_type.shift); + mutex_unlock(&indio_dev->mlock); + break; + default: + ret = -EINVAL; + } + + return ret; +} + +static const struct iio_info ad5686_info = { + .read_raw = ad5686_read_raw, + .write_raw = ad5686_write_raw, + .driver_module = THIS_MODULE, +}; + +static const struct iio_chan_spec_ext_info ad5686_ext_info[] = { + { + .name = "powerdown", + .read = ad5686_read_dac_powerdown, + .write = ad5686_write_dac_powerdown, + }, + IIO_ENUM("powerdown_mode", false, &ad5686_powerdown_mode_enum), + IIO_ENUM_AVAILABLE("powerdown_mode", &ad5686_powerdown_mode_enum), + { }, +}; + +#define AD5868_CHANNEL(chan, bits, shift) { \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .output = 1, \ + .channel = chan, \ + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ + IIO_CHAN_INFO_SCALE_SHARED_BIT, \ + .address = AD5686_ADDR_DAC(chan), \ + .scan_type = IIO_ST('u', bits, 16, shift), \ + .ext_info = ad5686_ext_info, \ +} + +static const struct ad5686_chip_info ad5686_chip_info_tbl[] = { + [ID_AD5684] = { + .channel[0] = AD5868_CHANNEL(0, 12, 4), + .channel[1] = AD5868_CHANNEL(1, 12, 4), + .channel[2] = AD5868_CHANNEL(2, 12, 4), + .channel[3] = AD5868_CHANNEL(3, 12, 4), + .int_vref_mv = 2500, + }, + [ID_AD5685] = { + .channel[0] = AD5868_CHANNEL(0, 14, 2), + .channel[1] = AD5868_CHANNEL(1, 14, 2), + .channel[2] = AD5868_CHANNEL(2, 14, 2), + .channel[3] = AD5868_CHANNEL(3, 14, 2), + .int_vref_mv = 2500, + }, + [ID_AD5686] = { + .channel[0] = AD5868_CHANNEL(0, 16, 0), + .channel[1] = AD5868_CHANNEL(1, 16, 0), + .channel[2] = AD5868_CHANNEL(2, 16, 0), + .channel[3] = AD5868_CHANNEL(3, 16, 0), + .int_vref_mv = 2500, + }, +}; + + +static int __devinit ad5686_probe(struct spi_device *spi) +{ + struct ad5686_state *st; + struct iio_dev *indio_dev; + int ret, regdone = 0, voltage_uv = 0; + + indio_dev = iio_device_alloc(sizeof(*st)); + if (indio_dev == NULL) + return -ENOMEM; + + st = iio_priv(indio_dev); + spi_set_drvdata(spi, indio_dev); + + st->reg = regulator_get(&spi->dev, "vcc"); + if (!IS_ERR(st->reg)) { + ret = regulator_enable(st->reg); + if (ret) + goto error_put_reg; + + voltage_uv = regulator_get_voltage(st->reg); + } + + st->chip_info = + &ad5686_chip_info_tbl[spi_get_device_id(spi)->driver_data]; + + if (voltage_uv) + st->vref_mv = voltage_uv / 1000; + else + st->vref_mv = st->chip_info->int_vref_mv; + + st->spi = spi; + + /* Set all the power down mode for all channels to 1K pulldown */ + st->pwr_down_mode = 0x55; + + indio_dev->dev.parent = &spi->dev; + indio_dev->name = spi_get_device_id(spi)->name; + indio_dev->info = &ad5686_info; + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->channels = st->chip_info->channel; + indio_dev->num_channels = AD5686_DAC_CHANNELS; + + regdone = 1; + ret = ad5686_spi_write(st, AD5686_CMD_INTERNAL_REFER_SETUP, 0, + !!voltage_uv, 0); + if (ret) + goto error_disable_reg; + + ret = iio_device_register(indio_dev); + if (ret) + goto error_disable_reg; + + return 0; + +error_disable_reg: + if (!IS_ERR(st->reg)) + regulator_disable(st->reg); +error_put_reg: + if (!IS_ERR(st->reg)) + regulator_put(st->reg); + + iio_device_free(indio_dev); + + return ret; +} + +static int __devexit ad5686_remove(struct spi_device *spi) +{ + struct iio_dev *indio_dev = spi_get_drvdata(spi); + struct ad5686_state *st = iio_priv(indio_dev); + + iio_device_unregister(indio_dev); + if (!IS_ERR(st->reg)) { + regulator_disable(st->reg); + regulator_put(st->reg); + } + iio_device_free(indio_dev); + + return 0; +} + +static const struct spi_device_id ad5686_id[] = { + {"ad5684", ID_AD5684}, + {"ad5685", ID_AD5685}, + {"ad5686", ID_AD5686}, + {} +}; +MODULE_DEVICE_TABLE(spi, ad5686_id); + +static struct spi_driver ad5686_driver = { + .driver = { + .name = "ad5686", + .owner = THIS_MODULE, + }, + .probe = ad5686_probe, + .remove = __devexit_p(ad5686_remove), + .id_table = ad5686_id, +}; +module_spi_driver(ad5686_driver); + +MODULE_AUTHOR("Michael Hennerich "); +MODULE_DESCRIPTION("Analog Devices AD5686/85/84 DAC"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/iio/dac/ad5764.c b/drivers/iio/dac/ad5764.c new file mode 100644 index 0000000..ffce304 --- /dev/null +++ b/drivers/iio/dac/ad5764.c @@ -0,0 +1,382 @@ +/* + * Analog devices AD5764, AD5764R, AD5744, AD5744R quad-channel + * Digital to Analog Converters driver + * + * Copyright 2011 Analog Devices Inc. + * + * Licensed under the GPL-2. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define AD5764_REG_SF_NOP 0x0 +#define AD5764_REG_SF_CONFIG 0x1 +#define AD5764_REG_SF_CLEAR 0x4 +#define AD5764_REG_SF_LOAD 0x5 +#define AD5764_REG_DATA(x) ((2 << 3) | (x)) +#define AD5764_REG_COARSE_GAIN(x) ((3 << 3) | (x)) +#define AD5764_REG_FINE_GAIN(x) ((4 << 3) | (x)) +#define AD5764_REG_OFFSET(x) ((5 << 3) | (x)) + +#define AD5764_NUM_CHANNELS 4 + +/** + * struct ad5764_chip_info - chip specific information + * @int_vref: Value of the internal reference voltage in uV - 0 if external + * reference voltage is used + * @channel channel specification +*/ + +struct ad5764_chip_info { + unsigned long int_vref; + const struct iio_chan_spec *channels; +}; + +/** + * struct ad5764_state - driver instance specific data + * @spi: spi_device + * @chip_info: chip info + * @vref_reg: vref supply regulators + * @data: spi transfer buffers + */ + +struct ad5764_state { + struct spi_device *spi; + const struct ad5764_chip_info *chip_info; + struct regulator_bulk_data vref_reg[2]; + + /* + * DMA (thus cache coherency maintenance) requires the + * transfer buffers to live in their own cache lines. + */ + union { + __be32 d32; + u8 d8[4]; + } data[2] ____cacheline_aligned; +}; + +enum ad5764_type { + ID_AD5744, + ID_AD5744R, + ID_AD5764, + ID_AD5764R, +}; + +#define AD5764_CHANNEL(_chan, _bits) { \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .output = 1, \ + .channel = (_chan), \ + .address = (_chan), \ + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ + IIO_CHAN_INFO_OFFSET_SHARED_BIT | \ + IIO_CHAN_INFO_SCALE_SEPARATE_BIT | \ + IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT | \ + IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT, \ + .scan_type = IIO_ST('u', (_bits), 16, 16 - (_bits)) \ +} + +#define DECLARE_AD5764_CHANNELS(_name, _bits) \ +const struct iio_chan_spec _name##_channels[] = { \ + AD5764_CHANNEL(0, (_bits)), \ + AD5764_CHANNEL(1, (_bits)), \ + AD5764_CHANNEL(2, (_bits)), \ + AD5764_CHANNEL(3, (_bits)), \ +}; + +static DECLARE_AD5764_CHANNELS(ad5764, 16); +static DECLARE_AD5764_CHANNELS(ad5744, 14); + +static const struct ad5764_chip_info ad5764_chip_infos[] = { + [ID_AD5744] = { + .int_vref = 0, + .channels = ad5744_channels, + }, + [ID_AD5744R] = { + .int_vref = 5000000, + .channels = ad5744_channels, + }, + [ID_AD5764] = { + .int_vref = 0, + .channels = ad5764_channels, + }, + [ID_AD5764R] = { + .int_vref = 5000000, + .channels = ad5764_channels, + }, +}; + +static int ad5764_write(struct iio_dev *indio_dev, unsigned int reg, + unsigned int val) +{ + struct ad5764_state *st = iio_priv(indio_dev); + int ret; + + mutex_lock(&indio_dev->mlock); + st->data[0].d32 = cpu_to_be32((reg << 16) | val); + + ret = spi_write(st->spi, &st->data[0].d8[1], 3); + mutex_unlock(&indio_dev->mlock); + + return ret; +} + +static int ad5764_read(struct iio_dev *indio_dev, unsigned int reg, + unsigned int *val) +{ + struct ad5764_state *st = iio_priv(indio_dev); + struct spi_message m; + int ret; + struct spi_transfer t[] = { + { + .tx_buf = &st->data[0].d8[1], + .len = 3, + .cs_change = 1, + }, { + .rx_buf = &st->data[1].d8[1], + .len = 3, + }, + }; + + spi_message_init(&m); + spi_message_add_tail(&t[0], &m); + spi_message_add_tail(&t[1], &m); + + mutex_lock(&indio_dev->mlock); + + st->data[0].d32 = cpu_to_be32((1 << 23) | (reg << 16)); + + ret = spi_sync(st->spi, &m); + if (ret >= 0) + *val = be32_to_cpu(st->data[1].d32) & 0xffff; + + mutex_unlock(&indio_dev->mlock); + + return ret; +} + +static int ad5764_chan_info_to_reg(struct iio_chan_spec const *chan, long info) +{ + switch (info) { + case 0: + return AD5764_REG_DATA(chan->address); + case IIO_CHAN_INFO_CALIBBIAS: + return AD5764_REG_OFFSET(chan->address); + case IIO_CHAN_INFO_CALIBSCALE: + return AD5764_REG_FINE_GAIN(chan->address); + default: + break; + } + + return 0; +} + +static int ad5764_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int val, int val2, long info) +{ + const int max_val = (1 << chan->scan_type.realbits); + unsigned int reg; + + switch (info) { + case IIO_CHAN_INFO_RAW: + if (val >= max_val || val < 0) + return -EINVAL; + val <<= chan->scan_type.shift; + break; + case IIO_CHAN_INFO_CALIBBIAS: + if (val >= 128 || val < -128) + return -EINVAL; + break; + case IIO_CHAN_INFO_CALIBSCALE: + if (val >= 32 || val < -32) + return -EINVAL; + break; + default: + return -EINVAL; + } + + reg = ad5764_chan_info_to_reg(chan, info); + return ad5764_write(indio_dev, reg, (u16)val); +} + +static int ad5764_get_channel_vref(struct ad5764_state *st, + unsigned int channel) +{ + if (st->chip_info->int_vref) + return st->chip_info->int_vref; + else + return regulator_get_voltage(st->vref_reg[channel / 2].consumer); +} + +static int ad5764_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int *val, int *val2, long info) +{ + struct ad5764_state *st = iio_priv(indio_dev); + unsigned long scale_uv; + unsigned int reg; + int vref; + int ret; + + switch (info) { + case IIO_CHAN_INFO_RAW: + reg = AD5764_REG_DATA(chan->address); + ret = ad5764_read(indio_dev, reg, val); + if (ret < 0) + return ret; + *val >>= chan->scan_type.shift; + return IIO_VAL_INT; + case IIO_CHAN_INFO_CALIBBIAS: + reg = AD5764_REG_OFFSET(chan->address); + ret = ad5764_read(indio_dev, reg, val); + if (ret < 0) + return ret; + *val = sign_extend32(*val, 7); + return IIO_VAL_INT; + case IIO_CHAN_INFO_CALIBSCALE: + reg = AD5764_REG_FINE_GAIN(chan->address); + ret = ad5764_read(indio_dev, reg, val); + if (ret < 0) + return ret; + *val = sign_extend32(*val, 5); + return IIO_VAL_INT; + case IIO_CHAN_INFO_SCALE: + /* vout = 4 * vref + ((dac_code / 65535) - 0.5) */ + vref = ad5764_get_channel_vref(st, chan->channel); + if (vref < 0) + return vref; + + scale_uv = (vref * 4 * 100) >> chan->scan_type.realbits; + *val = scale_uv / 100000; + *val2 = (scale_uv % 100000) * 10; + return IIO_VAL_INT_PLUS_MICRO; + case IIO_CHAN_INFO_OFFSET: + *val = -(1 << chan->scan_type.realbits) / 2; + return IIO_VAL_INT; + } + + return -EINVAL; +} + +static const struct iio_info ad5764_info = { + .read_raw = ad5764_read_raw, + .write_raw = ad5764_write_raw, + .driver_module = THIS_MODULE, +}; + +static int __devinit ad5764_probe(struct spi_device *spi) +{ + enum ad5764_type type = spi_get_device_id(spi)->driver_data; + struct iio_dev *indio_dev; + struct ad5764_state *st; + int ret; + + indio_dev = iio_device_alloc(sizeof(*st)); + if (indio_dev == NULL) { + dev_err(&spi->dev, "Failed to allocate iio device\n"); + return -ENOMEM; + } + + st = iio_priv(indio_dev); + spi_set_drvdata(spi, indio_dev); + + st->spi = spi; + st->chip_info = &ad5764_chip_infos[type]; + + indio_dev->dev.parent = &spi->dev; + indio_dev->name = spi_get_device_id(spi)->name; + indio_dev->info = &ad5764_info; + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->num_channels = AD5764_NUM_CHANNELS; + indio_dev->channels = st->chip_info->channels; + + if (st->chip_info->int_vref == 0) { + st->vref_reg[0].supply = "vrefAB"; + st->vref_reg[1].supply = "vrefCD"; + + ret = regulator_bulk_get(&st->spi->dev, + ARRAY_SIZE(st->vref_reg), st->vref_reg); + if (ret) { + dev_err(&spi->dev, "Failed to request vref regulators: %d\n", + ret); + goto error_free; + } + + ret = regulator_bulk_enable(ARRAY_SIZE(st->vref_reg), + st->vref_reg); + if (ret) { + dev_err(&spi->dev, "Failed to enable vref regulators: %d\n", + ret); + goto error_free_reg; + } + } + + ret = iio_device_register(indio_dev); + if (ret) { + dev_err(&spi->dev, "Failed to register iio device: %d\n", ret); + goto error_disable_reg; + } + + return 0; + +error_disable_reg: + if (st->chip_info->int_vref == 0) + regulator_bulk_disable(ARRAY_SIZE(st->vref_reg), st->vref_reg); +error_free_reg: + if (st->chip_info->int_vref == 0) + regulator_bulk_free(ARRAY_SIZE(st->vref_reg), st->vref_reg); +error_free: + iio_device_free(indio_dev); + + return ret; +} + +static int __devexit ad5764_remove(struct spi_device *spi) +{ + struct iio_dev *indio_dev = spi_get_drvdata(spi); + struct ad5764_state *st = iio_priv(indio_dev); + + iio_device_unregister(indio_dev); + + if (st->chip_info->int_vref == 0) { + regulator_bulk_disable(ARRAY_SIZE(st->vref_reg), st->vref_reg); + regulator_bulk_free(ARRAY_SIZE(st->vref_reg), st->vref_reg); + } + + iio_device_free(indio_dev); + + return 0; +} + +static const struct spi_device_id ad5764_ids[] = { + { "ad5744", ID_AD5744 }, + { "ad5744r", ID_AD5744R }, + { "ad5764", ID_AD5764 }, + { "ad5764r", ID_AD5764R }, + { } +}; +MODULE_DEVICE_TABLE(spi, ad5764_ids); + +static struct spi_driver ad5764_driver = { + .driver = { + .name = "ad5764", + .owner = THIS_MODULE, + }, + .probe = ad5764_probe, + .remove = __devexit_p(ad5764_remove), + .id_table = ad5764_ids, +}; +module_spi_driver(ad5764_driver); + +MODULE_AUTHOR("Lars-Peter Clausen "); +MODULE_DESCRIPTION("Analog Devices AD5744/AD5744R/AD5764/AD5764R DAC"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/iio/dac/ad5791.c b/drivers/iio/dac/ad5791.c new file mode 100644 index 0000000..2bd2e37 --- /dev/null +++ b/drivers/iio/dac/ad5791.c @@ -0,0 +1,485 @@ +/* + * AD5760, AD5780, AD5781, AD5790, AD5791 Voltage Output Digital to Analog + * Converter + * + * Copyright 2011 Analog Devices Inc. + * + * Licensed under the GPL-2. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define AD5791_RES_MASK(x) ((1 << (x)) - 1) +#define AD5791_DAC_MASK AD5791_RES_MASK(20) +#define AD5791_DAC_MSB (1 << 19) + +#define AD5791_CMD_READ (1 << 23) +#define AD5791_CMD_WRITE (0 << 23) +#define AD5791_ADDR(addr) ((addr) << 20) + +/* Registers */ +#define AD5791_ADDR_NOOP 0 +#define AD5791_ADDR_DAC0 1 +#define AD5791_ADDR_CTRL 2 +#define AD5791_ADDR_CLRCODE 3 +#define AD5791_ADDR_SW_CTRL 4 + +/* Control Register */ +#define AD5791_CTRL_RBUF (1 << 1) +#define AD5791_CTRL_OPGND (1 << 2) +#define AD5791_CTRL_DACTRI (1 << 3) +#define AD5791_CTRL_BIN2SC (1 << 4) +#define AD5791_CTRL_SDODIS (1 << 5) +#define AD5761_CTRL_LINCOMP(x) ((x) << 6) + +#define AD5791_LINCOMP_0_10 0 +#define AD5791_LINCOMP_10_12 1 +#define AD5791_LINCOMP_12_16 2 +#define AD5791_LINCOMP_16_19 3 +#define AD5791_LINCOMP_19_20 12 + +#define AD5780_LINCOMP_0_10 0 +#define AD5780_LINCOMP_10_20 12 + +/* Software Control Register */ +#define AD5791_SWCTRL_LDAC (1 << 0) +#define AD5791_SWCTRL_CLR (1 << 1) +#define AD5791_SWCTRL_RESET (1 << 2) + +#define AD5791_DAC_PWRDN_6K 0 +#define AD5791_DAC_PWRDN_3STATE 1 + +/** + * struct ad5791_chip_info - chip specific information + * @get_lin_comp: function pointer to the device specific function + */ + +struct ad5791_chip_info { + int (*get_lin_comp) (unsigned int span); +}; + +/** + * struct ad5791_state - driver instance specific data + * @us: spi_device + * @reg_vdd: positive supply regulator + * @reg_vss: negative supply regulator + * @chip_info: chip model specific constants + * @vref_mv: actual reference voltage used + * @vref_neg_mv: voltage of the negative supply + * @pwr_down_mode current power down mode + */ + +struct ad5791_state { + struct spi_device *spi; + struct regulator *reg_vdd; + struct regulator *reg_vss; + const struct ad5791_chip_info *chip_info; + unsigned short vref_mv; + unsigned int vref_neg_mv; + unsigned ctrl; + unsigned pwr_down_mode; + bool pwr_down; +}; + +/** + * ad5791_supported_device_ids: + */ + +enum ad5791_supported_device_ids { + ID_AD5760, + ID_AD5780, + ID_AD5781, + ID_AD5791, +}; + +static int ad5791_spi_write(struct spi_device *spi, u8 addr, u32 val) +{ + union { + u32 d32; + u8 d8[4]; + } data; + + data.d32 = cpu_to_be32(AD5791_CMD_WRITE | + AD5791_ADDR(addr) | + (val & AD5791_DAC_MASK)); + + return spi_write(spi, &data.d8[1], 3); +} + +static int ad5791_spi_read(struct spi_device *spi, u8 addr, u32 *val) +{ + union { + u32 d32; + u8 d8[4]; + } data[3]; + int ret; + struct spi_message msg; + struct spi_transfer xfers[] = { + { + .tx_buf = &data[0].d8[1], + .bits_per_word = 8, + .len = 3, + .cs_change = 1, + }, { + .tx_buf = &data[1].d8[1], + .rx_buf = &data[2].d8[1], + .bits_per_word = 8, + .len = 3, + }, + }; + + data[0].d32 = cpu_to_be32(AD5791_CMD_READ | + AD5791_ADDR(addr)); + data[1].d32 = cpu_to_be32(AD5791_ADDR(AD5791_ADDR_NOOP)); + + spi_message_init(&msg); + spi_message_add_tail(&xfers[0], &msg); + spi_message_add_tail(&xfers[1], &msg); + ret = spi_sync(spi, &msg); + + *val = be32_to_cpu(data[2].d32); + + return ret; +} + +static const char * const ad5791_powerdown_modes[] = { + "6kohm_to_gnd", + "three_state", +}; + +static int ad5791_get_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan) +{ + struct ad5791_state *st = iio_priv(indio_dev); + + return st->pwr_down_mode; +} + +static int ad5791_set_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, unsigned int mode) +{ + struct ad5791_state *st = iio_priv(indio_dev); + + st->pwr_down_mode = mode; + + return 0; +} + +static const struct iio_enum ad5791_powerdown_mode_enum = { + .items = ad5791_powerdown_modes, + .num_items = ARRAY_SIZE(ad5791_powerdown_modes), + .get = ad5791_get_powerdown_mode, + .set = ad5791_set_powerdown_mode, +}; + +static ssize_t ad5791_read_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, char *buf) +{ + struct ad5791_state *st = iio_priv(indio_dev); + + return sprintf(buf, "%d\n", st->pwr_down); +} + +static ssize_t ad5791_write_dac_powerdown(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, const char *buf, + size_t len) +{ + bool pwr_down; + int ret; + struct ad5791_state *st = iio_priv(indio_dev); + + ret = strtobool(buf, &pwr_down); + if (ret) + return ret; + + if (!pwr_down) { + st->ctrl &= ~(AD5791_CTRL_OPGND | AD5791_CTRL_DACTRI); + } else { + if (st->pwr_down_mode == AD5791_DAC_PWRDN_6K) + st->ctrl |= AD5791_CTRL_OPGND; + else if (st->pwr_down_mode == AD5791_DAC_PWRDN_3STATE) + st->ctrl |= AD5791_CTRL_DACTRI; + } + st->pwr_down = pwr_down; + + ret = ad5791_spi_write(st->spi, AD5791_ADDR_CTRL, st->ctrl); + + return ret ? ret : len; +} + +static int ad5791_get_lin_comp(unsigned int span) +{ + if (span <= 10000) + return AD5791_LINCOMP_0_10; + else if (span <= 12000) + return AD5791_LINCOMP_10_12; + else if (span <= 16000) + return AD5791_LINCOMP_12_16; + else if (span <= 19000) + return AD5791_LINCOMP_16_19; + else + return AD5791_LINCOMP_19_20; +} + +static int ad5780_get_lin_comp(unsigned int span) +{ + if (span <= 10000) + return AD5780_LINCOMP_0_10; + else + return AD5780_LINCOMP_10_20; +} +static const struct ad5791_chip_info ad5791_chip_info_tbl[] = { + [ID_AD5760] = { + .get_lin_comp = ad5780_get_lin_comp, + }, + [ID_AD5780] = { + .get_lin_comp = ad5780_get_lin_comp, + }, + [ID_AD5781] = { + .get_lin_comp = ad5791_get_lin_comp, + }, + [ID_AD5791] = { + .get_lin_comp = ad5791_get_lin_comp, + }, +}; + +static int ad5791_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, + int *val2, + long m) +{ + struct ad5791_state *st = iio_priv(indio_dev); + u64 val64; + int ret; + + switch (m) { + case IIO_CHAN_INFO_RAW: + ret = ad5791_spi_read(st->spi, chan->address, val); + if (ret) + return ret; + *val &= AD5791_DAC_MASK; + *val >>= chan->scan_type.shift; + return IIO_VAL_INT; + case IIO_CHAN_INFO_SCALE: + *val = 0; + *val2 = (((u64)st->vref_mv) * 1000000ULL) >> chan->scan_type.realbits; + return IIO_VAL_INT_PLUS_MICRO; + case IIO_CHAN_INFO_OFFSET: + val64 = (((u64)st->vref_neg_mv) << chan->scan_type.realbits); + do_div(val64, st->vref_mv); + *val = -val64; + return IIO_VAL_INT; + default: + return -EINVAL; + } + +}; + +static const struct iio_chan_spec_ext_info ad5791_ext_info[] = { + { + .name = "powerdown", + .shared = true, + .read = ad5791_read_dac_powerdown, + .write = ad5791_write_dac_powerdown, + }, + IIO_ENUM("powerdown_mode", true, &ad5791_powerdown_mode_enum), + IIO_ENUM_AVAILABLE("powerdown_mode", &ad5791_powerdown_mode_enum), + { }, +}; + +#define AD5791_CHAN(bits, shift) { \ + .type = IIO_VOLTAGE, \ + .output = 1, \ + .indexed = 1, \ + .address = AD5791_ADDR_DAC0, \ + .channel = 0, \ + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ + IIO_CHAN_INFO_SCALE_SHARED_BIT | \ + IIO_CHAN_INFO_OFFSET_SHARED_BIT, \ + .scan_type = IIO_ST('u', bits, 24, shift), \ + .ext_info = ad5791_ext_info, \ +} + +static const struct iio_chan_spec ad5791_channels[] = { + [ID_AD5760] = AD5791_CHAN(16, 4), + [ID_AD5780] = AD5791_CHAN(18, 2), + [ID_AD5781] = AD5791_CHAN(18, 2), + [ID_AD5791] = AD5791_CHAN(20, 0) +}; + +static int ad5791_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int val, + int val2, + long mask) +{ + struct ad5791_state *st = iio_priv(indio_dev); + + switch (mask) { + case IIO_CHAN_INFO_RAW: + val &= AD5791_RES_MASK(chan->scan_type.realbits); + val <<= chan->scan_type.shift; + + return ad5791_spi_write(st->spi, chan->address, val); + + default: + return -EINVAL; + } +} + +static const struct iio_info ad5791_info = { + .read_raw = &ad5791_read_raw, + .write_raw = &ad5791_write_raw, + .driver_module = THIS_MODULE, +}; + +static int __devinit ad5791_probe(struct spi_device *spi) +{ + struct ad5791_platform_data *pdata = spi->dev.platform_data; + struct iio_dev *indio_dev; + struct ad5791_state *st; + int ret, pos_voltage_uv = 0, neg_voltage_uv = 0; + + indio_dev = iio_device_alloc(sizeof(*st)); + if (indio_dev == NULL) { + ret = -ENOMEM; + goto error_ret; + } + st = iio_priv(indio_dev); + st->reg_vdd = regulator_get(&spi->dev, "vdd"); + if (!IS_ERR(st->reg_vdd)) { + ret = regulator_enable(st->reg_vdd); + if (ret) + goto error_put_reg_pos; + + pos_voltage_uv = regulator_get_voltage(st->reg_vdd); + } + + st->reg_vss = regulator_get(&spi->dev, "vss"); + if (!IS_ERR(st->reg_vss)) { + ret = regulator_enable(st->reg_vss); + if (ret) + goto error_put_reg_neg; + + neg_voltage_uv = regulator_get_voltage(st->reg_vss); + } + + st->pwr_down = true; + st->spi = spi; + + if (!IS_ERR(st->reg_vss) && !IS_ERR(st->reg_vdd)) { + st->vref_mv = (pos_voltage_uv + neg_voltage_uv) / 1000; + st->vref_neg_mv = neg_voltage_uv / 1000; + } else if (pdata) { + st->vref_mv = pdata->vref_pos_mv + pdata->vref_neg_mv; + st->vref_neg_mv = pdata->vref_neg_mv; + } else { + dev_warn(&spi->dev, "reference voltage unspecified\n"); + } + + ret = ad5791_spi_write(spi, AD5791_ADDR_SW_CTRL, AD5791_SWCTRL_RESET); + if (ret) + goto error_disable_reg_neg; + + st->chip_info = &ad5791_chip_info_tbl[spi_get_device_id(spi) + ->driver_data]; + + + st->ctrl = AD5761_CTRL_LINCOMP(st->chip_info->get_lin_comp(st->vref_mv)) + | ((pdata && pdata->use_rbuf_gain2) ? 0 : AD5791_CTRL_RBUF) | + AD5791_CTRL_BIN2SC; + + ret = ad5791_spi_write(spi, AD5791_ADDR_CTRL, st->ctrl | + AD5791_CTRL_OPGND | AD5791_CTRL_DACTRI); + if (ret) + goto error_disable_reg_neg; + + spi_set_drvdata(spi, indio_dev); + indio_dev->dev.parent = &spi->dev; + indio_dev->info = &ad5791_info; + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->channels + = &ad5791_channels[spi_get_device_id(spi)->driver_data]; + indio_dev->num_channels = 1; + indio_dev->name = spi_get_device_id(st->spi)->name; + ret = iio_device_register(indio_dev); + if (ret) + goto error_disable_reg_neg; + + return 0; + +error_disable_reg_neg: + if (!IS_ERR(st->reg_vss)) + regulator_disable(st->reg_vss); +error_put_reg_neg: + if (!IS_ERR(st->reg_vss)) + regulator_put(st->reg_vss); + + if (!IS_ERR(st->reg_vdd)) + regulator_disable(st->reg_vdd); +error_put_reg_pos: + if (!IS_ERR(st->reg_vdd)) + regulator_put(st->reg_vdd); + iio_device_free(indio_dev); +error_ret: + + return ret; +} + +static int __devexit ad5791_remove(struct spi_device *spi) +{ + struct iio_dev *indio_dev = spi_get_drvdata(spi); + struct ad5791_state *st = iio_priv(indio_dev); + + iio_device_unregister(indio_dev); + if (!IS_ERR(st->reg_vdd)) { + regulator_disable(st->reg_vdd); + regulator_put(st->reg_vdd); + } + + if (!IS_ERR(st->reg_vss)) { + regulator_disable(st->reg_vss); + regulator_put(st->reg_vss); + } + iio_device_free(indio_dev); + + return 0; +} + +static const struct spi_device_id ad5791_id[] = { + {"ad5760", ID_AD5760}, + {"ad5780", ID_AD5780}, + {"ad5781", ID_AD5781}, + {"ad5790", ID_AD5791}, + {"ad5791", ID_AD5791}, + {} +}; +MODULE_DEVICE_TABLE(spi, ad5791_id); + +static struct spi_driver ad5791_driver = { + .driver = { + .name = "ad5791", + .owner = THIS_MODULE, + }, + .probe = ad5791_probe, + .remove = __devexit_p(ad5791_remove), + .id_table = ad5791_id, +}; +module_spi_driver(ad5791_driver); + +MODULE_AUTHOR("Michael Hennerich "); +MODULE_DESCRIPTION("Analog Devices AD5760/AD5780/AD5781/AD5790/AD5791 DAC"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/iio/dac/max517.c b/drivers/iio/dac/max517.c new file mode 100644 index 0000000..92c77c8 --- /dev/null +++ b/drivers/iio/dac/max517.c @@ -0,0 +1,243 @@ +/* + * max517.c - Support for Maxim MAX517, MAX518 and MAX519 + * + * Copyright (C) 2010, 2011 Roland Stigge + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define MAX517_DRV_NAME "max517" + +/* Commands */ +#define COMMAND_CHANNEL0 0x00 +#define COMMAND_CHANNEL1 0x01 /* for MAX518 and MAX519 */ +#define COMMAND_PD 0x08 /* Power Down */ + +enum max517_device_ids { + ID_MAX517, + ID_MAX518, + ID_MAX519, +}; + +struct max517_data { + struct iio_dev *indio_dev; + struct i2c_client *client; + unsigned short vref_mv[2]; +}; + +/* + * channel: bit 0: channel 1 + * bit 1: channel 2 + * (this way, it's possible to set both channels at once) + */ +static int max517_set_value(struct iio_dev *indio_dev, + long val, int channel) +{ + struct max517_data *data = iio_priv(indio_dev); + struct i2c_client *client = data->client; + u8 outbuf[2]; + int res; + + if (val < 0 || val > 255) + return -EINVAL; + + outbuf[0] = channel; + outbuf[1] = val; + + res = i2c_master_send(client, outbuf, 2); + if (res < 0) + return res; + else if (res != 2) + return -EIO; + else + return 0; +} + +static int max517_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, + int *val2, + long m) +{ + struct max517_data *data = iio_priv(indio_dev); + unsigned int scale_uv; + + switch (m) { + case IIO_CHAN_INFO_SCALE: + /* Corresponds to Vref / 2^(bits) */ + scale_uv = (data->vref_mv[chan->channel] * 1000) >> 8; + *val = scale_uv / 1000000; + *val2 = scale_uv % 1000000; + return IIO_VAL_INT_PLUS_MICRO; + default: + break; + } + return -EINVAL; +} + +static int max517_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int val, int val2, long mask) +{ + int ret; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + ret = max517_set_value(indio_dev, val, chan->channel); + break; + default: + ret = -EINVAL; + break; + } + + return ret; +} + +#ifdef CONFIG_PM_SLEEP +static int max517_suspend(struct device *dev) +{ + u8 outbuf = COMMAND_PD; + + return i2c_master_send(to_i2c_client(dev), &outbuf, 1); +} + +static int max517_resume(struct device *dev) +{ + u8 outbuf = 0; + + return i2c_master_send(to_i2c_client(dev), &outbuf, 1); +} + +static SIMPLE_DEV_PM_OPS(max517_pm_ops, max517_suspend, max517_resume); +#define MAX517_PM_OPS (&max517_pm_ops) +#else +#define MAX517_PM_OPS NULL +#endif + +static const struct iio_info max517_info = { + .read_raw = max517_read_raw, + .write_raw = max517_write_raw, + .driver_module = THIS_MODULE, +}; + +#define MAX517_CHANNEL(chan) { \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .output = 1, \ + .channel = (chan), \ + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ + IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \ + .scan_type = IIO_ST('u', 8, 8, 0), \ +} + +static const struct iio_chan_spec max517_channels[] = { + MAX517_CHANNEL(0), + MAX517_CHANNEL(1) +}; + +static int max517_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct max517_data *data; + struct iio_dev *indio_dev; + struct max517_platform_data *platform_data = client->dev.platform_data; + int err; + + indio_dev = iio_device_alloc(sizeof(*data)); + if (indio_dev == NULL) { + err = -ENOMEM; + goto exit; + } + data = iio_priv(indio_dev); + i2c_set_clientdata(client, indio_dev); + data->client = client; + + /* establish that the iio_dev is a child of the i2c device */ + indio_dev->dev.parent = &client->dev; + + /* reduced channel set for MAX517 */ + if (id->driver_data == ID_MAX517) + indio_dev->num_channels = 1; + else + indio_dev->num_channels = 2; + indio_dev->channels = max517_channels; + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->info = &max517_info; + + /* + * Reference voltage on MAX518 and default is 5V, else take vref_mv + * from platform_data + */ + if (id->driver_data == ID_MAX518 || !platform_data) { + data->vref_mv[0] = data->vref_mv[1] = 5000; /* mV */ + } else { + data->vref_mv[0] = platform_data->vref_mv[0]; + data->vref_mv[1] = platform_data->vref_mv[1]; + } + + err = iio_device_register(indio_dev); + if (err) + goto exit_free_device; + + dev_info(&client->dev, "DAC registered\n"); + + return 0; + +exit_free_device: + iio_device_free(indio_dev); +exit: + return err; +} + +static int max517_remove(struct i2c_client *client) +{ + iio_device_unregister(i2c_get_clientdata(client)); + iio_device_free(i2c_get_clientdata(client)); + + return 0; +} + +static const struct i2c_device_id max517_id[] = { + { "max517", ID_MAX517 }, + { "max518", ID_MAX518 }, + { "max519", ID_MAX519 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, max517_id); + +static struct i2c_driver max517_driver = { + .driver = { + .name = MAX517_DRV_NAME, + .pm = MAX517_PM_OPS, + }, + .probe = max517_probe, + .remove = max517_remove, + .id_table = max517_id, +}; +module_i2c_driver(max517_driver); + +MODULE_AUTHOR("Roland Stigge "); +MODULE_DESCRIPTION("MAX517/MAX518/MAX519 8-bit DAC"); +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/iio/Kconfig b/drivers/staging/iio/Kconfig index 3c8e5ec..04cd6ec 100644 --- a/drivers/staging/iio/Kconfig +++ b/drivers/staging/iio/Kconfig @@ -29,7 +29,6 @@ source "drivers/staging/iio/accel/Kconfig" source "drivers/staging/iio/adc/Kconfig" source "drivers/staging/iio/addac/Kconfig" source "drivers/staging/iio/cdc/Kconfig" -source "drivers/staging/iio/dac/Kconfig" source "drivers/staging/iio/frequency/Kconfig" source "drivers/staging/iio/gyro/Kconfig" source "drivers/staging/iio/impedance-analyzer/Kconfig" diff --git a/drivers/staging/iio/Makefile b/drivers/staging/iio/Makefile index 6a46d5a..fa6937d 100644 --- a/drivers/staging/iio/Makefile +++ b/drivers/staging/iio/Makefile @@ -17,7 +17,6 @@ obj-y += accel/ obj-y += adc/ obj-y += addac/ obj-y += cdc/ -obj-y += dac/ obj-y += frequency/ obj-y += gyro/ obj-y += impedance-analyzer/ diff --git a/drivers/staging/iio/dac/Kconfig b/drivers/staging/iio/dac/Kconfig deleted file mode 100644 index a626f03..0000000 --- a/drivers/staging/iio/dac/Kconfig +++ /dev/null @@ -1,121 +0,0 @@ -# -# DAC drivers -# -menu "Digital to analog converters" - -config AD5064 - tristate "Analog Devices AD5064/64-1/65/44/45/24/25, AD5628/48/66/68 DAC driver" - depends on SPI - help - Say yes here to build support for Analog Devices AD5024, AD5025, AD5044, - AD5045, AD5064, AD5064-1, AD5065, AD5628, AD5648, AD5666, AD5668 Digital - to Analog Converter. - - To compile this driver as a module, choose M here: the - module will be called ad5064. - -config AD5360 - tristate "Analog Devices Analog Devices AD5360/61/62/63/70/71/73 DAC driver" - depends on SPI - help - Say yes here to build support for Analog Devices AD5360, AD5361, - AD5362, AD5363, AD5370, AD5371, AD5373 multi-channel - Digital to Analog Converters (DAC). - - To compile this driver as module choose M here: the module will be called - ad5360. - -config AD5380 - tristate "Analog Devices AD5380/81/82/83/84/90/91/92 DAC driver" - depends on (SPI_MASTER || I2C) - select REGMAP_I2C if I2C - select REGMAP_SPI if SPI_MASTER - help - Say yes here to build support for Analog Devices AD5380, AD5381, - AD5382, AD5383, AD5384, AD5390, AD5391, AD5392 multi-channel - Digital to Analog Converters (DAC). - - To compile this driver as module choose M here: the module will be called - ad5380. - -config AD5421 - tristate "Analog Devices AD5421 DAC driver" - depends on SPI - help - Say yes here to build support for Analog Devices AD5421 loop-powered - digital-to-analog convertors (DAC). - - To compile this driver as module choose M here: the module will be called - ad5421. - -config AD5624R_SPI - tristate "Analog Devices AD5624/44/64R DAC spi driver" - depends on SPI - help - Say yes here to build support for Analog Devices AD5624R, AD5644R and - AD5664R converters (DAC). This driver uses the common SPI interface. - -config AD5446 - tristate "Analog Devices AD5446 and similar single channel DACs driver" - depends on SPI - help - Say yes here to build support for Analog Devices AD5444, AD5446, - AD5512A, AD5541A, AD5542A, AD5543, AD5553, AD5601, AD5611, AD5620, - AD5621, AD5640, AD5660, AD5662 DACs. - - To compile this driver as a module, choose M here: the - module will be called ad5446. - -config AD5504 - tristate "Analog Devices AD5504/AD5501 DAC SPI driver" - depends on SPI - help - Say yes here to build support for Analog Devices AD5504, AD5501, - High Voltage Digital to Analog Converter. - - To compile this driver as a module, choose M here: the - module will be called ad5504. - -config AD5764 - tristate "Analog Devices AD5764/64R/44/44R DAC driver" - depends on SPI_MASTER - help - Say yes here to build support for Analog Devices AD5764, AD5764R, AD5744, - AD5744R Digital to Analog Converter. - - To compile this driver as a module, choose M here: the - module will be called ad5764. - -config AD5791 - tristate "Analog Devices AD5760/AD5780/AD5781/AD5790/AD5791 DAC SPI driver" - depends on SPI - help - Say yes here to build support for Analog Devices AD5760, AD5780, - AD5781, AD5790, AD5791 High Resolution Voltage Output Digital to - Analog Converter. - - To compile this driver as a module, choose M here: the - module will be called ad5791. - -config AD5686 - tristate "Analog Devices AD5686R/AD5685R/AD5684R DAC SPI driver" - depends on SPI - help - Say yes here to build support for Analog Devices AD5686R, AD5685R, - AD5684R, AD5791 Voltage Output Digital to - Analog Converter. - - To compile this driver as a module, choose M here: the - module will be called ad5686. - -config MAX517 - tristate "Maxim MAX517/518/519 DAC driver" - depends on I2C && EXPERIMENTAL - help - If you say yes here you get support for the Maxim chips MAX517, - MAX518 and MAX519 (I2C 8-Bit DACs with rail-to-rail outputs). - - This driver can also be built as a module. If so, the module - will be called max517. - -endmenu diff --git a/drivers/staging/iio/dac/Makefile b/drivers/staging/iio/dac/Makefile deleted file mode 100644 index 8ab1d26..0000000 --- a/drivers/staging/iio/dac/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# -# Makefile for industrial I/O DAC drivers -# - -obj-$(CONFIG_AD5360) += ad5360.o -obj-$(CONFIG_AD5380) += ad5380.o -obj-$(CONFIG_AD5421) += ad5421.o -obj-$(CONFIG_AD5624R_SPI) += ad5624r_spi.o -obj-$(CONFIG_AD5064) += ad5064.o -obj-$(CONFIG_AD5504) += ad5504.o -obj-$(CONFIG_AD5446) += ad5446.o -obj-$(CONFIG_AD5764) += ad5764.o -obj-$(CONFIG_AD5791) += ad5791.o -obj-$(CONFIG_AD5686) += ad5686.o -obj-$(CONFIG_MAX517) += max517.o diff --git a/drivers/staging/iio/dac/ad5064.c b/drivers/staging/iio/dac/ad5064.c deleted file mode 100644 index 276af02..0000000 --- a/drivers/staging/iio/dac/ad5064.c +++ /dev/null @@ -1,538 +0,0 @@ -/* - * AD5024, AD5025, AD5044, AD5045, AD5064, AD5064-1, AD5065, AD5628, AD5648, - * AD5666, AD5668 Digital to analog converters driver - * - * Copyright 2011 Analog Devices Inc. - * - * Licensed under the GPL-2. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#define AD5064_MAX_DAC_CHANNELS 8 -#define AD5064_MAX_VREFS 4 - -#define AD5064_ADDR(x) ((x) << 20) -#define AD5064_CMD(x) ((x) << 24) - -#define AD5064_ADDR_DAC(chan) (chan) -#define AD5064_ADDR_ALL_DAC 0xF - -#define AD5064_CMD_WRITE_INPUT_N 0x0 -#define AD5064_CMD_UPDATE_DAC_N 0x1 -#define AD5064_CMD_WRITE_INPUT_N_UPDATE_ALL 0x2 -#define AD5064_CMD_WRITE_INPUT_N_UPDATE_N 0x3 -#define AD5064_CMD_POWERDOWN_DAC 0x4 -#define AD5064_CMD_CLEAR 0x5 -#define AD5064_CMD_LDAC_MASK 0x6 -#define AD5064_CMD_RESET 0x7 -#define AD5064_CMD_CONFIG 0x8 - -#define AD5064_CONFIG_DAISY_CHAIN_ENABLE BIT(1) -#define AD5064_CONFIG_INT_VREF_ENABLE BIT(0) - -#define AD5064_LDAC_PWRDN_NONE 0x0 -#define AD5064_LDAC_PWRDN_1K 0x1 -#define AD5064_LDAC_PWRDN_100K 0x2 -#define AD5064_LDAC_PWRDN_3STATE 0x3 - -/** - * struct ad5064_chip_info - chip specific information - * @shared_vref: whether the vref supply is shared between channels - * @internal_vref: internal reference voltage. 0 if the chip has no internal - * vref. - * @channel: channel specification - * @num_channels: number of channels - */ - -struct ad5064_chip_info { - bool shared_vref; - unsigned long internal_vref; - const struct iio_chan_spec *channels; - unsigned int num_channels; -}; - -/** - * struct ad5064_state - driver instance specific data - * @spi: spi_device - * @chip_info: chip model specific constants, available modes etc - * @vref_reg: vref supply regulators - * @pwr_down: whether channel is powered down - * @pwr_down_mode: channel's current power down mode - * @dac_cache: current DAC raw value (chip does not support readback) - * @use_internal_vref: set to true if the internal reference voltage should be - * used. - * @data: spi transfer buffers - */ - -struct ad5064_state { - struct spi_device *spi; - const struct ad5064_chip_info *chip_info; - struct regulator_bulk_data vref_reg[AD5064_MAX_VREFS]; - bool pwr_down[AD5064_MAX_DAC_CHANNELS]; - u8 pwr_down_mode[AD5064_MAX_DAC_CHANNELS]; - unsigned int dac_cache[AD5064_MAX_DAC_CHANNELS]; - bool use_internal_vref; - - /* - * DMA (thus cache coherency maintenance) requires the - * transfer buffers to live in their own cache lines. - */ - __be32 data ____cacheline_aligned; -}; - -enum ad5064_type { - ID_AD5024, - ID_AD5025, - ID_AD5044, - ID_AD5045, - ID_AD5064, - ID_AD5064_1, - ID_AD5065, - ID_AD5628_1, - ID_AD5628_2, - ID_AD5648_1, - ID_AD5648_2, - ID_AD5666_1, - ID_AD5666_2, - ID_AD5668_1, - ID_AD5668_2, -}; - -static int ad5064_spi_write(struct ad5064_state *st, unsigned int cmd, - unsigned int addr, unsigned int val, unsigned int shift) -{ - val <<= shift; - - st->data = cpu_to_be32(AD5064_CMD(cmd) | AD5064_ADDR(addr) | val); - - return spi_write(st->spi, &st->data, sizeof(st->data)); -} - -static int ad5064_sync_powerdown_mode(struct ad5064_state *st, - unsigned int channel) -{ - unsigned int val; - int ret; - - val = (0x1 << channel); - - if (st->pwr_down[channel]) - val |= st->pwr_down_mode[channel] << 8; - - ret = ad5064_spi_write(st, AD5064_CMD_POWERDOWN_DAC, 0, val, 0); - - return ret; -} - -static const char * const ad5064_powerdown_modes[] = { - "1kohm_to_gnd", - "100kohm_to_gnd", - "three_state", -}; - -static int ad5064_get_powerdown_mode(struct iio_dev *indio_dev, - const struct iio_chan_spec *chan) -{ - struct ad5064_state *st = iio_priv(indio_dev); - - return st->pwr_down_mode[chan->channel] - 1; -} - -static int ad5064_set_powerdown_mode(struct iio_dev *indio_dev, - const struct iio_chan_spec *chan, unsigned int mode) -{ - struct ad5064_state *st = iio_priv(indio_dev); - int ret; - - mutex_lock(&indio_dev->mlock); - st->pwr_down_mode[chan->channel] = mode + 1; - - ret = ad5064_sync_powerdown_mode(st, chan->channel); - mutex_unlock(&indio_dev->mlock); - - return ret; -} - -static const struct iio_enum ad5064_powerdown_mode_enum = { - .items = ad5064_powerdown_modes, - .num_items = ARRAY_SIZE(ad5064_powerdown_modes), - .get = ad5064_get_powerdown_mode, - .set = ad5064_set_powerdown_mode, -}; - -static ssize_t ad5064_read_dac_powerdown(struct iio_dev *indio_dev, - uintptr_t private, const struct iio_chan_spec *chan, char *buf) -{ - struct ad5064_state *st = iio_priv(indio_dev); - - return sprintf(buf, "%d\n", st->pwr_down[chan->channel]); -} - -static ssize_t ad5064_write_dac_powerdown(struct iio_dev *indio_dev, - uintptr_t private, const struct iio_chan_spec *chan, const char *buf, - size_t len) -{ - struct ad5064_state *st = iio_priv(indio_dev); - bool pwr_down; - int ret; - - ret = strtobool(buf, &pwr_down); - if (ret) - return ret; - - mutex_lock(&indio_dev->mlock); - st->pwr_down[chan->channel] = pwr_down; - - ret = ad5064_sync_powerdown_mode(st, chan->channel); - mutex_unlock(&indio_dev->mlock); - return ret ? ret : len; -} - -static int ad5064_get_vref(struct ad5064_state *st, - struct iio_chan_spec const *chan) -{ - unsigned int i; - - if (st->use_internal_vref) - return st->chip_info->internal_vref; - - i = st->chip_info->shared_vref ? 0 : chan->channel; - return regulator_get_voltage(st->vref_reg[i].consumer); -} - -static int ad5064_read_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, - int *val, - int *val2, - long m) -{ - struct ad5064_state *st = iio_priv(indio_dev); - int scale_uv; - - switch (m) { - case IIO_CHAN_INFO_RAW: - *val = st->dac_cache[chan->channel]; - return IIO_VAL_INT; - case IIO_CHAN_INFO_SCALE: - scale_uv = ad5064_get_vref(st, chan); - if (scale_uv < 0) - return scale_uv; - - scale_uv = (scale_uv * 100) >> chan->scan_type.realbits; - *val = scale_uv / 100000; - *val2 = (scale_uv % 100000) * 10; - return IIO_VAL_INT_PLUS_MICRO; - default: - break; - } - return -EINVAL; -} - -static int ad5064_write_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, int val, int val2, long mask) -{ - struct ad5064_state *st = iio_priv(indio_dev); - int ret; - - switch (mask) { - case IIO_CHAN_INFO_RAW: - if (val > (1 << chan->scan_type.realbits) || val < 0) - return -EINVAL; - - mutex_lock(&indio_dev->mlock); - ret = ad5064_spi_write(st, AD5064_CMD_WRITE_INPUT_N_UPDATE_N, - chan->address, val, chan->scan_type.shift); - if (ret == 0) - st->dac_cache[chan->channel] = val; - mutex_unlock(&indio_dev->mlock); - break; - default: - ret = -EINVAL; - } - - return ret; -} - -static const struct iio_info ad5064_info = { - .read_raw = ad5064_read_raw, - .write_raw = ad5064_write_raw, - .driver_module = THIS_MODULE, -}; - -static const struct iio_chan_spec_ext_info ad5064_ext_info[] = { - { - .name = "powerdown", - .read = ad5064_read_dac_powerdown, - .write = ad5064_write_dac_powerdown, - }, - IIO_ENUM("powerdown_mode", false, &ad5064_powerdown_mode_enum), - IIO_ENUM_AVAILABLE("powerdown_mode", &ad5064_powerdown_mode_enum), - { }, -}; - -#define AD5064_CHANNEL(chan, bits) { \ - .type = IIO_VOLTAGE, \ - .indexed = 1, \ - .output = 1, \ - .channel = (chan), \ - .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ - IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \ - .address = AD5064_ADDR_DAC(chan), \ - .scan_type = IIO_ST('u', (bits), 16, 20 - (bits)), \ - .ext_info = ad5064_ext_info, \ -} - -#define DECLARE_AD5064_CHANNELS(name, bits) \ -const struct iio_chan_spec name[] = { \ - AD5064_CHANNEL(0, bits), \ - AD5064_CHANNEL(1, bits), \ - AD5064_CHANNEL(2, bits), \ - AD5064_CHANNEL(3, bits), \ - AD5064_CHANNEL(4, bits), \ - AD5064_CHANNEL(5, bits), \ - AD5064_CHANNEL(6, bits), \ - AD5064_CHANNEL(7, bits), \ -} - -static DECLARE_AD5064_CHANNELS(ad5024_channels, 12); -static DECLARE_AD5064_CHANNELS(ad5044_channels, 14); -static DECLARE_AD5064_CHANNELS(ad5064_channels, 16); - -static const struct ad5064_chip_info ad5064_chip_info_tbl[] = { - [ID_AD5024] = { - .shared_vref = false, - .channels = ad5024_channels, - .num_channels = 4, - }, - [ID_AD5025] = { - .shared_vref = false, - .channels = ad5024_channels, - .num_channels = 2, - }, - [ID_AD5044] = { - .shared_vref = false, - .channels = ad5044_channels, - .num_channels = 4, - }, - [ID_AD5045] = { - .shared_vref = false, - .channels = ad5044_channels, - .num_channels = 2, - }, - [ID_AD5064] = { - .shared_vref = false, - .channels = ad5064_channels, - .num_channels = 4, - }, - [ID_AD5064_1] = { - .shared_vref = true, - .channels = ad5064_channels, - .num_channels = 4, - }, - [ID_AD5065] = { - .shared_vref = false, - .channels = ad5064_channels, - .num_channels = 2, - }, - [ID_AD5628_1] = { - .shared_vref = true, - .internal_vref = 2500000, - .channels = ad5024_channels, - .num_channels = 8, - }, - [ID_AD5628_2] = { - .shared_vref = true, - .internal_vref = 5000000, - .channels = ad5024_channels, - .num_channels = 8, - }, - [ID_AD5648_1] = { - .shared_vref = true, - .internal_vref = 2500000, - .channels = ad5044_channels, - .num_channels = 8, - }, - [ID_AD5648_2] = { - .shared_vref = true, - .internal_vref = 5000000, - .channels = ad5044_channels, - .num_channels = 8, - }, - [ID_AD5666_1] = { - .shared_vref = true, - .internal_vref = 2500000, - .channels = ad5064_channels, - .num_channels = 4, - }, - [ID_AD5666_2] = { - .shared_vref = true, - .internal_vref = 5000000, - .channels = ad5064_channels, - .num_channels = 4, - }, - [ID_AD5668_1] = { - .shared_vref = true, - .internal_vref = 2500000, - .channels = ad5064_channels, - .num_channels = 8, - }, - [ID_AD5668_2] = { - .shared_vref = true, - .internal_vref = 5000000, - .channels = ad5064_channels, - .num_channels = 8, - }, -}; - -static inline unsigned int ad5064_num_vref(struct ad5064_state *st) -{ - return st->chip_info->shared_vref ? 1 : st->chip_info->num_channels; -} - -static const char * const ad5064_vref_names[] = { - "vrefA", - "vrefB", - "vrefC", - "vrefD", -}; - -static const char * const ad5064_vref_name(struct ad5064_state *st, - unsigned int vref) -{ - return st->chip_info->shared_vref ? "vref" : ad5064_vref_names[vref]; -} - -static int __devinit ad5064_probe(struct spi_device *spi) -{ - enum ad5064_type type = spi_get_device_id(spi)->driver_data; - struct iio_dev *indio_dev; - struct ad5064_state *st; - unsigned int i; - int ret; - - indio_dev = iio_device_alloc(sizeof(*st)); - if (indio_dev == NULL) - return -ENOMEM; - - st = iio_priv(indio_dev); - spi_set_drvdata(spi, indio_dev); - - st->chip_info = &ad5064_chip_info_tbl[type]; - st->spi = spi; - - for (i = 0; i < ad5064_num_vref(st); ++i) - st->vref_reg[i].supply = ad5064_vref_name(st, i); - - ret = regulator_bulk_get(&st->spi->dev, ad5064_num_vref(st), - st->vref_reg); - if (ret) { - if (!st->chip_info->internal_vref) - goto error_free; - st->use_internal_vref = true; - ret = ad5064_spi_write(st, AD5064_CMD_CONFIG, 0, - AD5064_CONFIG_INT_VREF_ENABLE, 0); - if (ret) { - dev_err(&spi->dev, "Failed to enable internal vref: %d\n", - ret); - goto error_free; - } - } else { - ret = regulator_bulk_enable(ad5064_num_vref(st), st->vref_reg); - if (ret) - goto error_free_reg; - } - - for (i = 0; i < st->chip_info->num_channels; ++i) { - st->pwr_down_mode[i] = AD5064_LDAC_PWRDN_1K; - st->dac_cache[i] = 0x8000; - } - - indio_dev->dev.parent = &spi->dev; - indio_dev->name = spi_get_device_id(spi)->name; - indio_dev->info = &ad5064_info; - indio_dev->modes = INDIO_DIRECT_MODE; - indio_dev->channels = st->chip_info->channels; - indio_dev->num_channels = st->chip_info->num_channels; - - ret = iio_device_register(indio_dev); - if (ret) - goto error_disable_reg; - - return 0; - -error_disable_reg: - if (!st->use_internal_vref) - regulator_bulk_disable(ad5064_num_vref(st), st->vref_reg); -error_free_reg: - if (!st->use_internal_vref) - regulator_bulk_free(ad5064_num_vref(st), st->vref_reg); -error_free: - iio_device_free(indio_dev); - - return ret; -} - - -static int __devexit ad5064_remove(struct spi_device *spi) -{ - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad5064_state *st = iio_priv(indio_dev); - - iio_device_unregister(indio_dev); - - if (!st->use_internal_vref) { - regulator_bulk_disable(ad5064_num_vref(st), st->vref_reg); - regulator_bulk_free(ad5064_num_vref(st), st->vref_reg); - } - - iio_device_free(indio_dev); - - return 0; -} - -static const struct spi_device_id ad5064_id[] = { - {"ad5024", ID_AD5024}, - {"ad5025", ID_AD5025}, - {"ad5044", ID_AD5044}, - {"ad5045", ID_AD5045}, - {"ad5064", ID_AD5064}, - {"ad5064-1", ID_AD5064_1}, - {"ad5065", ID_AD5065}, - {"ad5628-1", ID_AD5628_1}, - {"ad5628-2", ID_AD5628_2}, - {"ad5648-1", ID_AD5648_1}, - {"ad5648-2", ID_AD5648_2}, - {"ad5666-1", ID_AD5666_1}, - {"ad5666-2", ID_AD5666_2}, - {"ad5668-1", ID_AD5668_1}, - {"ad5668-2", ID_AD5668_2}, - {"ad5668-3", ID_AD5668_2}, /* similar enough to ad5668-2 */ - {} -}; -MODULE_DEVICE_TABLE(spi, ad5064_id); - -static struct spi_driver ad5064_driver = { - .driver = { - .name = "ad5064", - .owner = THIS_MODULE, - }, - .probe = ad5064_probe, - .remove = __devexit_p(ad5064_remove), - .id_table = ad5064_id, -}; -module_spi_driver(ad5064_driver); - -MODULE_AUTHOR("Lars-Peter Clausen "); -MODULE_DESCRIPTION("Analog Devices AD5024/25/44/45/64/64-1/65, AD5628/48/66/68 DAC"); -MODULE_LICENSE("GPL v2"); diff --git a/drivers/staging/iio/dac/ad5360.c b/drivers/staging/iio/dac/ad5360.c deleted file mode 100644 index 8fce84f..0000000 --- a/drivers/staging/iio/dac/ad5360.c +++ /dev/null @@ -1,570 +0,0 @@ -/* - * Analog devices AD5360, AD5361, AD5362, AD5363, AD5370, AD5371, AD5373 - * multi-channel Digital to Analog Converters driver - * - * Copyright 2011 Analog Devices Inc. - * - * Licensed under the GPL-2. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#define AD5360_CMD(x) ((x) << 22) -#define AD5360_ADDR(x) ((x) << 16) - -#define AD5360_READBACK_TYPE(x) ((x) << 13) -#define AD5360_READBACK_ADDR(x) ((x) << 7) - -#define AD5360_CHAN_ADDR(chan) ((chan) + 0x8) - -#define AD5360_CMD_WRITE_DATA 0x3 -#define AD5360_CMD_WRITE_OFFSET 0x2 -#define AD5360_CMD_WRITE_GAIN 0x1 -#define AD5360_CMD_SPECIAL_FUNCTION 0x0 - -/* Special function register addresses */ -#define AD5360_REG_SF_NOP 0x0 -#define AD5360_REG_SF_CTRL 0x1 -#define AD5360_REG_SF_OFS(x) (0x2 + (x)) -#define AD5360_REG_SF_READBACK 0x5 - -#define AD5360_SF_CTRL_PWR_DOWN BIT(0) - -#define AD5360_READBACK_X1A 0x0 -#define AD5360_READBACK_X1B 0x1 -#define AD5360_READBACK_OFFSET 0x2 -#define AD5360_READBACK_GAIN 0x3 -#define AD5360_READBACK_SF 0x4 - - -/** - * struct ad5360_chip_info - chip specific information - * @channel_template: channel specification template - * @num_channels: number of channels - * @channels_per_group: number of channels per group - * @num_vrefs: number of vref supplies for the chip -*/ - -struct ad5360_chip_info { - struct iio_chan_spec channel_template; - unsigned int num_channels; - unsigned int channels_per_group; - unsigned int num_vrefs; -}; - -/** - * struct ad5360_state - driver instance specific data - * @spi: spi_device - * @chip_info: chip model specific constants, available modes etc - * @vref_reg: vref supply regulators - * @ctrl: control register cache - * @data: spi transfer buffers - */ - -struct ad5360_state { - struct spi_device *spi; - const struct ad5360_chip_info *chip_info; - struct regulator_bulk_data vref_reg[3]; - unsigned int ctrl; - - /* - * DMA (thus cache coherency maintenance) requires the - * transfer buffers to live in their own cache lines. - */ - union { - __be32 d32; - u8 d8[4]; - } data[2] ____cacheline_aligned; -}; - -enum ad5360_type { - ID_AD5360, - ID_AD5361, - ID_AD5362, - ID_AD5363, - ID_AD5370, - ID_AD5371, - ID_AD5372, - ID_AD5373, -}; - -#define AD5360_CHANNEL(bits) { \ - .type = IIO_VOLTAGE, \ - .indexed = 1, \ - .output = 1, \ - .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ - IIO_CHAN_INFO_SCALE_SEPARATE_BIT | \ - IIO_CHAN_INFO_OFFSET_SEPARATE_BIT | \ - IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT | \ - IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT, \ - .scan_type = IIO_ST('u', (bits), 16, 16 - (bits)) \ -} - -static const struct ad5360_chip_info ad5360_chip_info_tbl[] = { - [ID_AD5360] = { - .channel_template = AD5360_CHANNEL(16), - .num_channels = 16, - .channels_per_group = 8, - .num_vrefs = 2, - }, - [ID_AD5361] = { - .channel_template = AD5360_CHANNEL(14), - .num_channels = 16, - .channels_per_group = 8, - .num_vrefs = 2, - }, - [ID_AD5362] = { - .channel_template = AD5360_CHANNEL(16), - .num_channels = 8, - .channels_per_group = 4, - .num_vrefs = 2, - }, - [ID_AD5363] = { - .channel_template = AD5360_CHANNEL(14), - .num_channels = 8, - .channels_per_group = 4, - .num_vrefs = 2, - }, - [ID_AD5370] = { - .channel_template = AD5360_CHANNEL(16), - .num_channels = 40, - .channels_per_group = 8, - .num_vrefs = 2, - }, - [ID_AD5371] = { - .channel_template = AD5360_CHANNEL(14), - .num_channels = 40, - .channels_per_group = 8, - .num_vrefs = 3, - }, - [ID_AD5372] = { - .channel_template = AD5360_CHANNEL(16), - .num_channels = 32, - .channels_per_group = 8, - .num_vrefs = 2, - }, - [ID_AD5373] = { - .channel_template = AD5360_CHANNEL(14), - .num_channels = 32, - .channels_per_group = 8, - .num_vrefs = 2, - }, -}; - -static unsigned int ad5360_get_channel_vref_index(struct ad5360_state *st, - unsigned int channel) -{ - unsigned int i; - - /* The first groups have their own vref, while the remaining groups - * share the last vref */ - i = channel / st->chip_info->channels_per_group; - if (i >= st->chip_info->num_vrefs) - i = st->chip_info->num_vrefs - 1; - - return i; -} - -static int ad5360_get_channel_vref(struct ad5360_state *st, - unsigned int channel) -{ - unsigned int i = ad5360_get_channel_vref_index(st, channel); - - return regulator_get_voltage(st->vref_reg[i].consumer); -} - - -static int ad5360_write_unlocked(struct iio_dev *indio_dev, - unsigned int cmd, unsigned int addr, unsigned int val, - unsigned int shift) -{ - struct ad5360_state *st = iio_priv(indio_dev); - - val <<= shift; - val |= AD5360_CMD(cmd) | AD5360_ADDR(addr); - st->data[0].d32 = cpu_to_be32(val); - - return spi_write(st->spi, &st->data[0].d8[1], 3); -} - -static int ad5360_write(struct iio_dev *indio_dev, unsigned int cmd, - unsigned int addr, unsigned int val, unsigned int shift) -{ - int ret; - - mutex_lock(&indio_dev->mlock); - ret = ad5360_write_unlocked(indio_dev, cmd, addr, val, shift); - mutex_unlock(&indio_dev->mlock); - - return ret; -} - -static int ad5360_read(struct iio_dev *indio_dev, unsigned int type, - unsigned int addr) -{ - struct ad5360_state *st = iio_priv(indio_dev); - struct spi_message m; - int ret; - struct spi_transfer t[] = { - { - .tx_buf = &st->data[0].d8[1], - .len = 3, - .cs_change = 1, - }, { - .rx_buf = &st->data[1].d8[1], - .len = 3, - }, - }; - - spi_message_init(&m); - spi_message_add_tail(&t[0], &m); - spi_message_add_tail(&t[1], &m); - - mutex_lock(&indio_dev->mlock); - - st->data[0].d32 = cpu_to_be32(AD5360_CMD(AD5360_CMD_SPECIAL_FUNCTION) | - AD5360_ADDR(AD5360_REG_SF_READBACK) | - AD5360_READBACK_TYPE(type) | - AD5360_READBACK_ADDR(addr)); - - ret = spi_sync(st->spi, &m); - if (ret >= 0) - ret = be32_to_cpu(st->data[1].d32) & 0xffff; - - mutex_unlock(&indio_dev->mlock); - - return ret; -} - -static ssize_t ad5360_read_dac_powerdown(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct iio_dev *indio_dev = dev_to_iio_dev(dev); - struct ad5360_state *st = iio_priv(indio_dev); - - return sprintf(buf, "%d\n", (bool)(st->ctrl & AD5360_SF_CTRL_PWR_DOWN)); -} - -static int ad5360_update_ctrl(struct iio_dev *indio_dev, unsigned int set, - unsigned int clr) -{ - struct ad5360_state *st = iio_priv(indio_dev); - unsigned int ret; - - mutex_lock(&indio_dev->mlock); - - st->ctrl |= set; - st->ctrl &= ~clr; - - ret = ad5360_write_unlocked(indio_dev, AD5360_CMD_SPECIAL_FUNCTION, - AD5360_REG_SF_CTRL, st->ctrl, 0); - - mutex_unlock(&indio_dev->mlock); - - return ret; -} - -static ssize_t ad5360_write_dac_powerdown(struct device *dev, - struct device_attribute *attr, const char *buf, size_t len) -{ - struct iio_dev *indio_dev = dev_to_iio_dev(dev); - bool pwr_down; - int ret; - - ret = strtobool(buf, &pwr_down); - if (ret) - return ret; - - if (pwr_down) - ret = ad5360_update_ctrl(indio_dev, AD5360_SF_CTRL_PWR_DOWN, 0); - else - ret = ad5360_update_ctrl(indio_dev, 0, AD5360_SF_CTRL_PWR_DOWN); - - return ret ? ret : len; -} - -static IIO_DEVICE_ATTR(out_voltage_powerdown, - S_IRUGO | S_IWUSR, - ad5360_read_dac_powerdown, - ad5360_write_dac_powerdown, 0); - -static struct attribute *ad5360_attributes[] = { - &iio_dev_attr_out_voltage_powerdown.dev_attr.attr, - NULL, -}; - -static const struct attribute_group ad5360_attribute_group = { - .attrs = ad5360_attributes, -}; - -static int ad5360_write_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, - int val, - int val2, - long mask) -{ - struct ad5360_state *st = iio_priv(indio_dev); - int max_val = (1 << chan->scan_type.realbits); - unsigned int ofs_index; - - switch (mask) { - case IIO_CHAN_INFO_RAW: - if (val >= max_val || val < 0) - return -EINVAL; - - return ad5360_write(indio_dev, AD5360_CMD_WRITE_DATA, - chan->address, val, chan->scan_type.shift); - - case IIO_CHAN_INFO_CALIBBIAS: - if (val >= max_val || val < 0) - return -EINVAL; - - return ad5360_write(indio_dev, AD5360_CMD_WRITE_OFFSET, - chan->address, val, chan->scan_type.shift); - - case IIO_CHAN_INFO_CALIBSCALE: - if (val >= max_val || val < 0) - return -EINVAL; - - return ad5360_write(indio_dev, AD5360_CMD_WRITE_GAIN, - chan->address, val, chan->scan_type.shift); - - case IIO_CHAN_INFO_OFFSET: - if (val <= -max_val || val > 0) - return -EINVAL; - - val = -val; - - /* offset is supposed to have the same scale as raw, but it - * is always 14bits wide, so on a chip where the raw value has - * more bits, we need to shift offset. */ - val >>= (chan->scan_type.realbits - 14); - - /* There is one DAC offset register per vref. Changing one - * channels offset will also change the offset for all other - * channels which share the same vref supply. */ - ofs_index = ad5360_get_channel_vref_index(st, chan->channel); - return ad5360_write(indio_dev, AD5360_CMD_SPECIAL_FUNCTION, - AD5360_REG_SF_OFS(ofs_index), val, 0); - default: - break; - } - - return -EINVAL; -} - -static int ad5360_read_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, - int *val, - int *val2, - long m) -{ - struct ad5360_state *st = iio_priv(indio_dev); - unsigned int ofs_index; - int scale_uv; - int ret; - - switch (m) { - case IIO_CHAN_INFO_RAW: - ret = ad5360_read(indio_dev, AD5360_READBACK_X1A, - chan->address); - if (ret < 0) - return ret; - *val = ret >> chan->scan_type.shift; - return IIO_VAL_INT; - case IIO_CHAN_INFO_SCALE: - /* vout = 4 * vref * dac_code */ - scale_uv = ad5360_get_channel_vref(st, chan->channel) * 4 * 100; - if (scale_uv < 0) - return scale_uv; - - scale_uv >>= (chan->scan_type.realbits); - *val = scale_uv / 100000; - *val2 = (scale_uv % 100000) * 10; - return IIO_VAL_INT_PLUS_MICRO; - case IIO_CHAN_INFO_CALIBBIAS: - ret = ad5360_read(indio_dev, AD5360_READBACK_OFFSET, - chan->address); - if (ret < 0) - return ret; - *val = ret; - return IIO_VAL_INT; - case IIO_CHAN_INFO_CALIBSCALE: - ret = ad5360_read(indio_dev, AD5360_READBACK_GAIN, - chan->address); - if (ret < 0) - return ret; - *val = ret; - return IIO_VAL_INT; - case IIO_CHAN_INFO_OFFSET: - ofs_index = ad5360_get_channel_vref_index(st, chan->channel); - ret = ad5360_read(indio_dev, AD5360_READBACK_SF, - AD5360_REG_SF_OFS(ofs_index)); - if (ret < 0) - return ret; - - ret <<= (chan->scan_type.realbits - 14); - *val = -ret; - return IIO_VAL_INT; - } - - return -EINVAL; -} - -static const struct iio_info ad5360_info = { - .read_raw = ad5360_read_raw, - .write_raw = ad5360_write_raw, - .attrs = &ad5360_attribute_group, - .driver_module = THIS_MODULE, -}; - -static const char * const ad5360_vref_name[] = { - "vref0", "vref1", "vref2" -}; - -static int __devinit ad5360_alloc_channels(struct iio_dev *indio_dev) -{ - struct ad5360_state *st = iio_priv(indio_dev); - struct iio_chan_spec *channels; - unsigned int i; - - channels = kcalloc(st->chip_info->num_channels, - sizeof(struct iio_chan_spec), GFP_KERNEL); - - if (!channels) - return -ENOMEM; - - for (i = 0; i < st->chip_info->num_channels; ++i) { - channels[i] = st->chip_info->channel_template; - channels[i].channel = i; - channels[i].address = AD5360_CHAN_ADDR(i); - } - - indio_dev->channels = channels; - - return 0; -} - -static int __devinit ad5360_probe(struct spi_device *spi) -{ - enum ad5360_type type = spi_get_device_id(spi)->driver_data; - struct iio_dev *indio_dev; - struct ad5360_state *st; - unsigned int i; - int ret; - - indio_dev = iio_device_alloc(sizeof(*st)); - if (indio_dev == NULL) { - dev_err(&spi->dev, "Failed to allocate iio device\n"); - return -ENOMEM; - } - - st = iio_priv(indio_dev); - spi_set_drvdata(spi, indio_dev); - - st->chip_info = &ad5360_chip_info_tbl[type]; - st->spi = spi; - - indio_dev->dev.parent = &spi->dev; - indio_dev->name = spi_get_device_id(spi)->name; - indio_dev->info = &ad5360_info; - indio_dev->modes = INDIO_DIRECT_MODE; - indio_dev->num_channels = st->chip_info->num_channels; - - ret = ad5360_alloc_channels(indio_dev); - if (ret) { - dev_err(&spi->dev, "Failed to allocate channel spec: %d\n", ret); - goto error_free; - } - - for (i = 0; i < st->chip_info->num_vrefs; ++i) - st->vref_reg[i].supply = ad5360_vref_name[i]; - - ret = regulator_bulk_get(&st->spi->dev, st->chip_info->num_vrefs, - st->vref_reg); - if (ret) { - dev_err(&spi->dev, "Failed to request vref regulators: %d\n", ret); - goto error_free_channels; - } - - ret = regulator_bulk_enable(st->chip_info->num_vrefs, st->vref_reg); - if (ret) { - dev_err(&spi->dev, "Failed to enable vref regulators: %d\n", ret); - goto error_free_reg; - } - - ret = iio_device_register(indio_dev); - if (ret) { - dev_err(&spi->dev, "Failed to register iio device: %d\n", ret); - goto error_disable_reg; - } - - return 0; - -error_disable_reg: - regulator_bulk_disable(st->chip_info->num_vrefs, st->vref_reg); -error_free_reg: - regulator_bulk_free(st->chip_info->num_vrefs, st->vref_reg); -error_free_channels: - kfree(indio_dev->channels); -error_free: - iio_device_free(indio_dev); - - return ret; -} - -static int __devexit ad5360_remove(struct spi_device *spi) -{ - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad5360_state *st = iio_priv(indio_dev); - - iio_device_unregister(indio_dev); - - kfree(indio_dev->channels); - - regulator_bulk_disable(st->chip_info->num_vrefs, st->vref_reg); - regulator_bulk_free(st->chip_info->num_vrefs, st->vref_reg); - - iio_device_free(indio_dev); - - return 0; -} - -static const struct spi_device_id ad5360_ids[] = { - { "ad5360", ID_AD5360 }, - { "ad5361", ID_AD5361 }, - { "ad5362", ID_AD5362 }, - { "ad5363", ID_AD5363 }, - { "ad5370", ID_AD5370 }, - { "ad5371", ID_AD5371 }, - { "ad5372", ID_AD5372 }, - { "ad5373", ID_AD5373 }, - {} -}; -MODULE_DEVICE_TABLE(spi, ad5360_ids); - -static struct spi_driver ad5360_driver = { - .driver = { - .name = "ad5360", - .owner = THIS_MODULE, - }, - .probe = ad5360_probe, - .remove = __devexit_p(ad5360_remove), - .id_table = ad5360_ids, -}; -module_spi_driver(ad5360_driver); - -MODULE_AUTHOR("Lars-Peter Clausen "); -MODULE_DESCRIPTION("Analog Devices AD5360/61/62/63/70/71/72/73 DAC"); -MODULE_LICENSE("GPL v2"); diff --git a/drivers/staging/iio/dac/ad5380.c b/drivers/staging/iio/dac/ad5380.c deleted file mode 100644 index 5dfb445..0000000 --- a/drivers/staging/iio/dac/ad5380.c +++ /dev/null @@ -1,657 +0,0 @@ -/* - * Analog devices AD5380, AD5381, AD5382, AD5383, AD5390, AD5391, AD5392 - * multi-channel Digital to Analog Converters driver - * - * Copyright 2011 Analog Devices Inc. - * - * Licensed under the GPL-2. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#define AD5380_REG_DATA(x) (((x) << 2) | 3) -#define AD5380_REG_OFFSET(x) (((x) << 2) | 2) -#define AD5380_REG_GAIN(x) (((x) << 2) | 1) -#define AD5380_REG_SF_PWR_DOWN (8 << 2) -#define AD5380_REG_SF_PWR_UP (9 << 2) -#define AD5380_REG_SF_CTRL (12 << 2) - -#define AD5380_CTRL_PWR_DOWN_MODE_OFFSET 13 -#define AD5380_CTRL_INT_VREF_2V5 BIT(12) -#define AD5380_CTRL_INT_VREF_EN BIT(10) - -/** - * struct ad5380_chip_info - chip specific information - * @channel_template: channel specification template - * @num_channels: number of channels - * @int_vref: internal vref in uV -*/ - -struct ad5380_chip_info { - struct iio_chan_spec channel_template; - unsigned int num_channels; - unsigned int int_vref; -}; - -/** - * struct ad5380_state - driver instance specific data - * @regmap: regmap instance used by the device - * @chip_info: chip model specific constants, available modes etc - * @vref_reg: vref supply regulator - * @vref: actual reference voltage used in uA - * @pwr_down: whether the chip is currently in power down mode - */ - -struct ad5380_state { - struct regmap *regmap; - const struct ad5380_chip_info *chip_info; - struct regulator *vref_reg; - int vref; - bool pwr_down; -}; - -enum ad5380_type { - ID_AD5380_3, - ID_AD5380_5, - ID_AD5381_3, - ID_AD5381_5, - ID_AD5382_3, - ID_AD5382_5, - ID_AD5383_3, - ID_AD5383_5, - ID_AD5390_3, - ID_AD5390_5, - ID_AD5391_3, - ID_AD5391_5, - ID_AD5392_3, - ID_AD5392_5, -}; - -static ssize_t ad5380_read_dac_powerdown(struct iio_dev *indio_dev, - uintptr_t private, const struct iio_chan_spec *chan, char *buf) -{ - struct ad5380_state *st = iio_priv(indio_dev); - - return sprintf(buf, "%d\n", st->pwr_down); -} - -static ssize_t ad5380_write_dac_powerdown(struct iio_dev *indio_dev, - uintptr_t private, const struct iio_chan_spec *chan, const char *buf, - size_t len) -{ - struct ad5380_state *st = iio_priv(indio_dev); - bool pwr_down; - int ret; - - ret = strtobool(buf, &pwr_down); - if (ret) - return ret; - - mutex_lock(&indio_dev->mlock); - - if (pwr_down) - ret = regmap_write(st->regmap, AD5380_REG_SF_PWR_DOWN, 0); - else - ret = regmap_write(st->regmap, AD5380_REG_SF_PWR_UP, 0); - - st->pwr_down = pwr_down; - - mutex_unlock(&indio_dev->mlock); - - return ret ? ret : len; -} - -static const char * const ad5380_powerdown_modes[] = { - "100kohm_to_gnd", - "three_state", -}; - -static int ad5380_get_powerdown_mode(struct iio_dev *indio_dev, - const struct iio_chan_spec *chan) -{ - struct ad5380_state *st = iio_priv(indio_dev); - unsigned int mode; - int ret; - - ret = regmap_read(st->regmap, AD5380_REG_SF_CTRL, &mode); - if (ret) - return ret; - - mode = (mode >> AD5380_CTRL_PWR_DOWN_MODE_OFFSET) & 1; - - return mode; -} - -static int ad5380_set_powerdown_mode(struct iio_dev *indio_dev, - const struct iio_chan_spec *chan, unsigned int mode) -{ - struct ad5380_state *st = iio_priv(indio_dev); - int ret; - - ret = regmap_update_bits(st->regmap, AD5380_REG_SF_CTRL, - 1 << AD5380_CTRL_PWR_DOWN_MODE_OFFSET, - mode << AD5380_CTRL_PWR_DOWN_MODE_OFFSET); - - return ret; -} - -static const struct iio_enum ad5380_powerdown_mode_enum = { - .items = ad5380_powerdown_modes, - .num_items = ARRAY_SIZE(ad5380_powerdown_modes), - .get = ad5380_get_powerdown_mode, - .set = ad5380_set_powerdown_mode, -}; - -static unsigned int ad5380_info_to_reg(struct iio_chan_spec const *chan, - long info) -{ - switch (info) { - case 0: - return AD5380_REG_DATA(chan->address); - case IIO_CHAN_INFO_CALIBBIAS: - return AD5380_REG_OFFSET(chan->address); - case IIO_CHAN_INFO_CALIBSCALE: - return AD5380_REG_GAIN(chan->address); - default: - break; - } - - return 0; -} - -static int ad5380_write_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, int val, int val2, long info) -{ - const unsigned int max_val = (1 << chan->scan_type.realbits); - struct ad5380_state *st = iio_priv(indio_dev); - - switch (info) { - case IIO_CHAN_INFO_RAW: - case IIO_CHAN_INFO_CALIBSCALE: - if (val >= max_val || val < 0) - return -EINVAL; - - return regmap_write(st->regmap, - ad5380_info_to_reg(chan, info), - val << chan->scan_type.shift); - case IIO_CHAN_INFO_CALIBBIAS: - val += (1 << chan->scan_type.realbits) / 2; - if (val >= max_val || val < 0) - return -EINVAL; - - return regmap_write(st->regmap, - AD5380_REG_OFFSET(chan->address), - val << chan->scan_type.shift); - default: - break; - } - return -EINVAL; -} - -static int ad5380_read_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, int *val, int *val2, long info) -{ - struct ad5380_state *st = iio_priv(indio_dev); - unsigned long scale_uv; - int ret; - - switch (info) { - case IIO_CHAN_INFO_RAW: - case IIO_CHAN_INFO_CALIBSCALE: - ret = regmap_read(st->regmap, ad5380_info_to_reg(chan, info), - val); - if (ret) - return ret; - *val >>= chan->scan_type.shift; - return IIO_VAL_INT; - case IIO_CHAN_INFO_CALIBBIAS: - ret = regmap_read(st->regmap, AD5380_REG_OFFSET(chan->address), - val); - if (ret) - return ret; - *val >>= chan->scan_type.shift; - val -= (1 << chan->scan_type.realbits) / 2; - return IIO_VAL_INT; - case IIO_CHAN_INFO_SCALE: - scale_uv = ((2 * st->vref) >> chan->scan_type.realbits) * 100; - *val = scale_uv / 100000; - *val2 = (scale_uv % 100000) * 10; - return IIO_VAL_INT_PLUS_MICRO; - default: - break; - } - - return -EINVAL; -} - -static const struct iio_info ad5380_info = { - .read_raw = ad5380_read_raw, - .write_raw = ad5380_write_raw, - .driver_module = THIS_MODULE, -}; - -static struct iio_chan_spec_ext_info ad5380_ext_info[] = { - { - .name = "powerdown", - .read = ad5380_read_dac_powerdown, - .write = ad5380_write_dac_powerdown, - }, - IIO_ENUM("powerdown_mode", true, &ad5380_powerdown_mode_enum), - IIO_ENUM_AVAILABLE("powerdown_mode", &ad5380_powerdown_mode_enum), - { }, -}; - -#define AD5380_CHANNEL(_bits) { \ - .type = IIO_VOLTAGE, \ - .indexed = 1, \ - .output = 1, \ - .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ - IIO_CHAN_INFO_SCALE_SHARED_BIT | \ - IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT | \ - IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT, \ - .scan_type = IIO_ST('u', (_bits), 16, 14 - (_bits)), \ - .ext_info = ad5380_ext_info, \ -} - -static const struct ad5380_chip_info ad5380_chip_info_tbl[] = { - [ID_AD5380_3] = { - .channel_template = AD5380_CHANNEL(14), - .num_channels = 40, - .int_vref = 1250000, - }, - [ID_AD5380_5] = { - .channel_template = AD5380_CHANNEL(14), - .num_channels = 40, - .int_vref = 2500000, - }, - [ID_AD5381_3] = { - .channel_template = AD5380_CHANNEL(12), - .num_channels = 16, - .int_vref = 1250000, - }, - [ID_AD5381_5] = { - .channel_template = AD5380_CHANNEL(12), - .num_channels = 16, - .int_vref = 2500000, - }, - [ID_AD5382_3] = { - .channel_template = AD5380_CHANNEL(14), - .num_channels = 32, - .int_vref = 1250000, - }, - [ID_AD5382_5] = { - .channel_template = AD5380_CHANNEL(14), - .num_channels = 32, - .int_vref = 2500000, - }, - [ID_AD5383_3] = { - .channel_template = AD5380_CHANNEL(12), - .num_channels = 32, - .int_vref = 1250000, - }, - [ID_AD5383_5] = { - .channel_template = AD5380_CHANNEL(12), - .num_channels = 32, - .int_vref = 2500000, - }, - [ID_AD5390_3] = { - .channel_template = AD5380_CHANNEL(14), - .num_channels = 16, - .int_vref = 1250000, - }, - [ID_AD5390_5] = { - .channel_template = AD5380_CHANNEL(14), - .num_channels = 16, - .int_vref = 2500000, - }, - [ID_AD5391_3] = { - .channel_template = AD5380_CHANNEL(12), - .num_channels = 16, - .int_vref = 1250000, - }, - [ID_AD5391_5] = { - .channel_template = AD5380_CHANNEL(12), - .num_channels = 16, - .int_vref = 2500000, - }, - [ID_AD5392_3] = { - .channel_template = AD5380_CHANNEL(14), - .num_channels = 8, - .int_vref = 1250000, - }, - [ID_AD5392_5] = { - .channel_template = AD5380_CHANNEL(14), - .num_channels = 8, - .int_vref = 2500000, - }, -}; - -static int __devinit ad5380_alloc_channels(struct iio_dev *indio_dev) -{ - struct ad5380_state *st = iio_priv(indio_dev); - struct iio_chan_spec *channels; - unsigned int i; - - channels = kcalloc(st->chip_info->num_channels, - sizeof(struct iio_chan_spec), GFP_KERNEL); - - if (!channels) - return -ENOMEM; - - for (i = 0; i < st->chip_info->num_channels; ++i) { - channels[i] = st->chip_info->channel_template; - channels[i].channel = i; - channels[i].address = i; - } - - indio_dev->channels = channels; - - return 0; -} - -static int __devinit ad5380_probe(struct device *dev, struct regmap *regmap, - enum ad5380_type type, const char *name) -{ - struct iio_dev *indio_dev; - struct ad5380_state *st; - unsigned int ctrl = 0; - int ret; - - indio_dev = iio_device_alloc(sizeof(*st)); - if (indio_dev == NULL) { - dev_err(dev, "Failed to allocate iio device\n"); - ret = -ENOMEM; - goto error_regmap_exit; - } - - st = iio_priv(indio_dev); - dev_set_drvdata(dev, indio_dev); - - st->chip_info = &ad5380_chip_info_tbl[type]; - st->regmap = regmap; - - indio_dev->dev.parent = dev; - indio_dev->name = name; - indio_dev->info = &ad5380_info; - indio_dev->modes = INDIO_DIRECT_MODE; - indio_dev->num_channels = st->chip_info->num_channels; - - ret = ad5380_alloc_channels(indio_dev); - if (ret) { - dev_err(dev, "Failed to allocate channel spec: %d\n", ret); - goto error_free; - } - - if (st->chip_info->int_vref == 2500000) - ctrl |= AD5380_CTRL_INT_VREF_2V5; - - st->vref_reg = regulator_get(dev, "vref"); - if (!IS_ERR(st->vref_reg)) { - ret = regulator_enable(st->vref_reg); - if (ret) { - dev_err(dev, "Failed to enable vref regulators: %d\n", - ret); - goto error_free_reg; - } - - st->vref = regulator_get_voltage(st->vref_reg); - } else { - st->vref = st->chip_info->int_vref; - ctrl |= AD5380_CTRL_INT_VREF_EN; - } - - ret = regmap_write(st->regmap, AD5380_REG_SF_CTRL, ctrl); - if (ret) { - dev_err(dev, "Failed to write to device: %d\n", ret); - goto error_disable_reg; - } - - ret = iio_device_register(indio_dev); - if (ret) { - dev_err(dev, "Failed to register iio device: %d\n", ret); - goto error_disable_reg; - } - - return 0; - -error_disable_reg: - if (!IS_ERR(st->vref_reg)) - regulator_disable(st->vref_reg); -error_free_reg: - if (!IS_ERR(st->vref_reg)) - regulator_put(st->vref_reg); - - kfree(indio_dev->channels); -error_free: - iio_device_free(indio_dev); -error_regmap_exit: - regmap_exit(regmap); - - return ret; -} - -static int __devexit ad5380_remove(struct device *dev) -{ - struct iio_dev *indio_dev = dev_get_drvdata(dev); - struct ad5380_state *st = iio_priv(indio_dev); - - iio_device_unregister(indio_dev); - - kfree(indio_dev->channels); - - if (!IS_ERR(st->vref_reg)) { - regulator_disable(st->vref_reg); - regulator_put(st->vref_reg); - } - - regmap_exit(st->regmap); - iio_device_free(indio_dev); - - return 0; -} - -static bool ad5380_reg_false(struct device *dev, unsigned int reg) -{ - return false; -} - -static const struct regmap_config ad5380_regmap_config = { - .reg_bits = 10, - .val_bits = 14, - - .max_register = AD5380_REG_DATA(40), - .cache_type = REGCACHE_RBTREE, - - .volatile_reg = ad5380_reg_false, - .readable_reg = ad5380_reg_false, -}; - -#if IS_ENABLED(CONFIG_SPI_MASTER) - -static int __devinit ad5380_spi_probe(struct spi_device *spi) -{ - const struct spi_device_id *id = spi_get_device_id(spi); - struct regmap *regmap; - - regmap = regmap_init_spi(spi, &ad5380_regmap_config); - - if (IS_ERR(regmap)) - return PTR_ERR(regmap); - - return ad5380_probe(&spi->dev, regmap, id->driver_data, id->name); -} - -static int __devexit ad5380_spi_remove(struct spi_device *spi) -{ - return ad5380_remove(&spi->dev); -} - -static const struct spi_device_id ad5380_spi_ids[] = { - { "ad5380-3", ID_AD5380_3 }, - { "ad5380-5", ID_AD5380_5 }, - { "ad5381-3", ID_AD5381_3 }, - { "ad5381-5", ID_AD5381_5 }, - { "ad5382-3", ID_AD5382_3 }, - { "ad5382-5", ID_AD5382_5 }, - { "ad5383-3", ID_AD5383_3 }, - { "ad5383-5", ID_AD5383_5 }, - { "ad5384-3", ID_AD5380_3 }, - { "ad5384-5", ID_AD5380_5 }, - { "ad5390-3", ID_AD5390_3 }, - { "ad5390-5", ID_AD5390_5 }, - { "ad5391-3", ID_AD5391_3 }, - { "ad5391-5", ID_AD5391_5 }, - { "ad5392-3", ID_AD5392_3 }, - { "ad5392-5", ID_AD5392_5 }, - { } -}; -MODULE_DEVICE_TABLE(spi, ad5380_spi_ids); - -static struct spi_driver ad5380_spi_driver = { - .driver = { - .name = "ad5380", - .owner = THIS_MODULE, - }, - .probe = ad5380_spi_probe, - .remove = __devexit_p(ad5380_spi_remove), - .id_table = ad5380_spi_ids, -}; - -static inline int ad5380_spi_register_driver(void) -{ - return spi_register_driver(&ad5380_spi_driver); -} - -static inline void ad5380_spi_unregister_driver(void) -{ - spi_unregister_driver(&ad5380_spi_driver); -} - -#else - -static inline int ad5380_spi_register_driver(void) -{ - return 0; -} - -static inline void ad5380_spi_unregister_driver(void) -{ -} - -#endif - -#if IS_ENABLED(CONFIG_I2C) - -static int __devinit ad5380_i2c_probe(struct i2c_client *i2c, - const struct i2c_device_id *id) -{ - struct regmap *regmap; - - regmap = regmap_init_i2c(i2c, &ad5380_regmap_config); - - if (IS_ERR(regmap)) - return PTR_ERR(regmap); - - return ad5380_probe(&i2c->dev, regmap, id->driver_data, id->name); -} - -static int __devexit ad5380_i2c_remove(struct i2c_client *i2c) -{ - return ad5380_remove(&i2c->dev); -} - -static const struct i2c_device_id ad5380_i2c_ids[] = { - { "ad5380-3", ID_AD5380_3 }, - { "ad5380-5", ID_AD5380_5 }, - { "ad5381-3", ID_AD5381_3 }, - { "ad5381-5", ID_AD5381_5 }, - { "ad5382-3", ID_AD5382_3 }, - { "ad5382-5", ID_AD5382_5 }, - { "ad5383-3", ID_AD5383_3 }, - { "ad5383-5", ID_AD5383_5 }, - { "ad5384-3", ID_AD5380_3 }, - { "ad5384-5", ID_AD5380_5 }, - { "ad5390-3", ID_AD5390_3 }, - { "ad5390-5", ID_AD5390_5 }, - { "ad5391-3", ID_AD5391_3 }, - { "ad5391-5", ID_AD5391_5 }, - { "ad5392-3", ID_AD5392_3 }, - { "ad5392-5", ID_AD5392_5 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, ad5380_i2c_ids); - -static struct i2c_driver ad5380_i2c_driver = { - .driver = { - .name = "ad5380", - .owner = THIS_MODULE, - }, - .probe = ad5380_i2c_probe, - .remove = __devexit_p(ad5380_i2c_remove), - .id_table = ad5380_i2c_ids, -}; - -static inline int ad5380_i2c_register_driver(void) -{ - return i2c_add_driver(&ad5380_i2c_driver); -} - -static inline void ad5380_i2c_unregister_driver(void) -{ - i2c_del_driver(&ad5380_i2c_driver); -} - -#else - -static inline int ad5380_i2c_register_driver(void) -{ - return 0; -} - -static inline void ad5380_i2c_unregister_driver(void) -{ -} - -#endif - -static int __init ad5380_spi_init(void) -{ - int ret; - - ret = ad5380_spi_register_driver(); - if (ret) - return ret; - - ret = ad5380_i2c_register_driver(); - if (ret) { - ad5380_spi_unregister_driver(); - return ret; - } - - return 0; -} -module_init(ad5380_spi_init); - -static void __exit ad5380_spi_exit(void) -{ - ad5380_i2c_unregister_driver(); - ad5380_spi_unregister_driver(); - -} -module_exit(ad5380_spi_exit); - -MODULE_AUTHOR("Lars-Peter Clausen "); -MODULE_DESCRIPTION("Analog Devices AD5380/81/82/83/84/90/91/92 DAC"); -MODULE_LICENSE("GPL v2"); diff --git a/drivers/staging/iio/dac/ad5421.c b/drivers/staging/iio/dac/ad5421.c deleted file mode 100644 index ea2f83b..0000000 --- a/drivers/staging/iio/dac/ad5421.c +++ /dev/null @@ -1,544 +0,0 @@ -/* - * AD5421 Digital to analog converters driver - * - * Copyright 2011 Analog Devices Inc. - * - * Licensed under the GPL-2. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include "ad5421.h" - - -#define AD5421_REG_DAC_DATA 0x1 -#define AD5421_REG_CTRL 0x2 -#define AD5421_REG_OFFSET 0x3 -#define AD5421_REG_GAIN 0x4 -/* load dac and fault shared the same register number. Writing to it will cause - * a dac load command, reading from it will return the fault status register */ -#define AD5421_REG_LOAD_DAC 0x5 -#define AD5421_REG_FAULT 0x5 -#define AD5421_REG_FORCE_ALARM_CURRENT 0x6 -#define AD5421_REG_RESET 0x7 -#define AD5421_REG_START_CONVERSION 0x8 -#define AD5421_REG_NOOP 0x9 - -#define AD5421_CTRL_WATCHDOG_DISABLE BIT(12) -#define AD5421_CTRL_AUTO_FAULT_READBACK BIT(11) -#define AD5421_CTRL_MIN_CURRENT BIT(9) -#define AD5421_CTRL_ADC_SOURCE_TEMP BIT(8) -#define AD5421_CTRL_ADC_ENABLE BIT(7) -#define AD5421_CTRL_PWR_DOWN_INT_VREF BIT(6) - -#define AD5421_FAULT_SPI BIT(15) -#define AD5421_FAULT_PEC BIT(14) -#define AD5421_FAULT_OVER_CURRENT BIT(13) -#define AD5421_FAULT_UNDER_CURRENT BIT(12) -#define AD5421_FAULT_TEMP_OVER_140 BIT(11) -#define AD5421_FAULT_TEMP_OVER_100 BIT(10) -#define AD5421_FAULT_UNDER_VOLTAGE_6V BIT(9) -#define AD5421_FAULT_UNDER_VOLTAGE_12V BIT(8) - -/* These bits will cause the fault pin to go high */ -#define AD5421_FAULT_TRIGGER_IRQ \ - (AD5421_FAULT_SPI | AD5421_FAULT_PEC | AD5421_FAULT_OVER_CURRENT | \ - AD5421_FAULT_UNDER_CURRENT | AD5421_FAULT_TEMP_OVER_140) - -/** - * struct ad5421_state - driver instance specific data - * @spi: spi_device - * @ctrl: control register cache - * @current_range: current range which the device is configured for - * @data: spi transfer buffers - * @fault_mask: software masking of events - */ -struct ad5421_state { - struct spi_device *spi; - unsigned int ctrl; - enum ad5421_current_range current_range; - unsigned int fault_mask; - - /* - * DMA (thus cache coherency maintenance) requires the - * transfer buffers to live in their own cache lines. - */ - union { - u32 d32; - u8 d8[4]; - } data[2] ____cacheline_aligned; -}; - -static const struct iio_chan_spec ad5421_channels[] = { - { - .type = IIO_CURRENT, - .indexed = 1, - .output = 1, - .channel = 0, - .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | - IIO_CHAN_INFO_SCALE_SHARED_BIT | - IIO_CHAN_INFO_OFFSET_SHARED_BIT | - IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT | - IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT, - .scan_type = IIO_ST('u', 16, 16, 0), - .event_mask = IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING) | - IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_FALLING), - }, - { - .type = IIO_TEMP, - .channel = -1, - .event_mask = IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING), - }, -}; - -static int ad5421_write_unlocked(struct iio_dev *indio_dev, - unsigned int reg, unsigned int val) -{ - struct ad5421_state *st = iio_priv(indio_dev); - - st->data[0].d32 = cpu_to_be32((reg << 16) | val); - - return spi_write(st->spi, &st->data[0].d8[1], 3); -} - -static int ad5421_write(struct iio_dev *indio_dev, unsigned int reg, - unsigned int val) -{ - int ret; - - mutex_lock(&indio_dev->mlock); - ret = ad5421_write_unlocked(indio_dev, reg, val); - mutex_unlock(&indio_dev->mlock); - - return ret; -} - -static int ad5421_read(struct iio_dev *indio_dev, unsigned int reg) -{ - struct ad5421_state *st = iio_priv(indio_dev); - struct spi_message m; - int ret; - struct spi_transfer t[] = { - { - .tx_buf = &st->data[0].d8[1], - .len = 3, - .cs_change = 1, - }, { - .rx_buf = &st->data[1].d8[1], - .len = 3, - }, - }; - - spi_message_init(&m); - spi_message_add_tail(&t[0], &m); - spi_message_add_tail(&t[1], &m); - - mutex_lock(&indio_dev->mlock); - - st->data[0].d32 = cpu_to_be32((1 << 23) | (reg << 16)); - - ret = spi_sync(st->spi, &m); - if (ret >= 0) - ret = be32_to_cpu(st->data[1].d32) & 0xffff; - - mutex_unlock(&indio_dev->mlock); - - return ret; -} - -static int ad5421_update_ctrl(struct iio_dev *indio_dev, unsigned int set, - unsigned int clr) -{ - struct ad5421_state *st = iio_priv(indio_dev); - unsigned int ret; - - mutex_lock(&indio_dev->mlock); - - st->ctrl &= ~clr; - st->ctrl |= set; - - ret = ad5421_write_unlocked(indio_dev, AD5421_REG_CTRL, st->ctrl); - - mutex_unlock(&indio_dev->mlock); - - return ret; -} - -static irqreturn_t ad5421_fault_handler(int irq, void *data) -{ - struct iio_dev *indio_dev = data; - struct ad5421_state *st = iio_priv(indio_dev); - unsigned int fault; - unsigned int old_fault = 0; - unsigned int events; - - fault = ad5421_read(indio_dev, AD5421_REG_FAULT); - if (!fault) - return IRQ_NONE; - - /* If we had a fault, this might mean that the DAC has lost its state - * and has been reset. Make sure that the control register actually - * contains what we expect it to contain. Otherwise the watchdog might - * be enabled and we get watchdog timeout faults, which will render the - * DAC unusable. */ - ad5421_update_ctrl(indio_dev, 0, 0); - - - /* The fault pin stays high as long as a fault condition is present and - * it is not possible to mask fault conditions. For certain fault - * conditions for example like over-temperature it takes some time - * until the fault condition disappears. If we would exit the interrupt - * handler immediately after handling the event it would be entered - * again instantly. Thus we fall back to polling in case we detect that - * a interrupt condition is still present. - */ - do { - /* 0xffff is a invalid value for the register and will only be - * read if there has been a communication error */ - if (fault == 0xffff) - fault = 0; - - /* we are only interested in new events */ - events = (old_fault ^ fault) & fault; - events &= st->fault_mask; - - if (events & AD5421_FAULT_OVER_CURRENT) { - iio_push_event(indio_dev, - IIO_UNMOD_EVENT_CODE(IIO_CURRENT, - 0, - IIO_EV_TYPE_THRESH, - IIO_EV_DIR_RISING), - iio_get_time_ns()); - } - - if (events & AD5421_FAULT_UNDER_CURRENT) { - iio_push_event(indio_dev, - IIO_UNMOD_EVENT_CODE(IIO_CURRENT, - 0, - IIO_EV_TYPE_THRESH, - IIO_EV_DIR_FALLING), - iio_get_time_ns()); - } - - if (events & AD5421_FAULT_TEMP_OVER_140) { - iio_push_event(indio_dev, - IIO_UNMOD_EVENT_CODE(IIO_TEMP, - 0, - IIO_EV_TYPE_MAG, - IIO_EV_DIR_RISING), - iio_get_time_ns()); - } - - old_fault = fault; - fault = ad5421_read(indio_dev, AD5421_REG_FAULT); - - /* still active? go to sleep for some time */ - if (fault & AD5421_FAULT_TRIGGER_IRQ) - msleep(1000); - - } while (fault & AD5421_FAULT_TRIGGER_IRQ); - - - return IRQ_HANDLED; -} - -static void ad5421_get_current_min_max(struct ad5421_state *st, - unsigned int *min, unsigned int *max) -{ - /* The current range is configured using external pins, which are - * usually hard-wired and not run-time switchable. */ - switch (st->current_range) { - case AD5421_CURRENT_RANGE_4mA_20mA: - *min = 4000; - *max = 20000; - break; - case AD5421_CURRENT_RANGE_3mA8_21mA: - *min = 3800; - *max = 21000; - break; - case AD5421_CURRENT_RANGE_3mA2_24mA: - *min = 3200; - *max = 24000; - break; - default: - *min = 0; - *max = 1; - break; - } -} - -static inline unsigned int ad5421_get_offset(struct ad5421_state *st) -{ - unsigned int min, max; - - ad5421_get_current_min_max(st, &min, &max); - return (min * (1 << 16)) / (max - min); -} - -static inline unsigned int ad5421_get_scale(struct ad5421_state *st) -{ - unsigned int min, max; - - ad5421_get_current_min_max(st, &min, &max); - return ((max - min) * 1000) / (1 << 16); -} - -static int ad5421_read_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, int *val, int *val2, long m) -{ - struct ad5421_state *st = iio_priv(indio_dev); - int ret; - - if (chan->type != IIO_CURRENT) - return -EINVAL; - - switch (m) { - case IIO_CHAN_INFO_RAW: - ret = ad5421_read(indio_dev, AD5421_REG_DAC_DATA); - if (ret < 0) - return ret; - *val = ret; - return IIO_VAL_INT; - case IIO_CHAN_INFO_SCALE: - *val = 0; - *val2 = ad5421_get_scale(st); - return IIO_VAL_INT_PLUS_MICRO; - case IIO_CHAN_INFO_OFFSET: - *val = ad5421_get_offset(st); - return IIO_VAL_INT; - case IIO_CHAN_INFO_CALIBBIAS: - ret = ad5421_read(indio_dev, AD5421_REG_OFFSET); - if (ret < 0) - return ret; - *val = ret - 32768; - return IIO_VAL_INT; - case IIO_CHAN_INFO_CALIBSCALE: - ret = ad5421_read(indio_dev, AD5421_REG_GAIN); - if (ret < 0) - return ret; - *val = ret; - return IIO_VAL_INT; - } - - return -EINVAL; -} - -static int ad5421_write_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, int val, int val2, long mask) -{ - const unsigned int max_val = 1 << 16; - - switch (mask) { - case IIO_CHAN_INFO_RAW: - if (val >= max_val || val < 0) - return -EINVAL; - - return ad5421_write(indio_dev, AD5421_REG_DAC_DATA, val); - case IIO_CHAN_INFO_CALIBBIAS: - val += 32768; - if (val >= max_val || val < 0) - return -EINVAL; - - return ad5421_write(indio_dev, AD5421_REG_OFFSET, val); - case IIO_CHAN_INFO_CALIBSCALE: - if (val >= max_val || val < 0) - return -EINVAL; - - return ad5421_write(indio_dev, AD5421_REG_GAIN, val); - default: - break; - } - - return -EINVAL; -} - -static int ad5421_write_event_config(struct iio_dev *indio_dev, - u64 event_code, int state) -{ - struct ad5421_state *st = iio_priv(indio_dev); - unsigned int mask; - - switch (IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(event_code)) { - case IIO_CURRENT: - if (IIO_EVENT_CODE_EXTRACT_DIR(event_code) == - IIO_EV_DIR_RISING) - mask = AD5421_FAULT_OVER_CURRENT; - else - mask = AD5421_FAULT_UNDER_CURRENT; - break; - case IIO_TEMP: - mask = AD5421_FAULT_TEMP_OVER_140; - break; - default: - return -EINVAL; - } - - mutex_lock(&indio_dev->mlock); - if (state) - st->fault_mask |= mask; - else - st->fault_mask &= ~mask; - mutex_unlock(&indio_dev->mlock); - - return 0; -} - -static int ad5421_read_event_config(struct iio_dev *indio_dev, - u64 event_code) -{ - struct ad5421_state *st = iio_priv(indio_dev); - unsigned int mask; - - switch (IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(event_code)) { - case IIO_CURRENT: - if (IIO_EVENT_CODE_EXTRACT_DIR(event_code) == - IIO_EV_DIR_RISING) - mask = AD5421_FAULT_OVER_CURRENT; - else - mask = AD5421_FAULT_UNDER_CURRENT; - break; - case IIO_TEMP: - mask = AD5421_FAULT_TEMP_OVER_140; - break; - default: - return -EINVAL; - } - - return (bool)(st->fault_mask & mask); -} - -static int ad5421_read_event_value(struct iio_dev *indio_dev, u64 event_code, - int *val) -{ - int ret; - - switch (IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(event_code)) { - case IIO_CURRENT: - ret = ad5421_read(indio_dev, AD5421_REG_DAC_DATA); - if (ret < 0) - return ret; - *val = ret; - break; - case IIO_TEMP: - *val = 140000; - break; - default: - return -EINVAL; - } - - return 0; -} - -static const struct iio_info ad5421_info = { - .read_raw = ad5421_read_raw, - .write_raw = ad5421_write_raw, - .read_event_config = ad5421_read_event_config, - .write_event_config = ad5421_write_event_config, - .read_event_value = ad5421_read_event_value, - .driver_module = THIS_MODULE, -}; - -static int __devinit ad5421_probe(struct spi_device *spi) -{ - struct ad5421_platform_data *pdata = dev_get_platdata(&spi->dev); - struct iio_dev *indio_dev; - struct ad5421_state *st; - int ret; - - indio_dev = iio_device_alloc(sizeof(*st)); - if (indio_dev == NULL) { - dev_err(&spi->dev, "Failed to allocate iio device\n"); - return -ENOMEM; - } - - st = iio_priv(indio_dev); - spi_set_drvdata(spi, indio_dev); - - st->spi = spi; - - indio_dev->dev.parent = &spi->dev; - indio_dev->name = "ad5421"; - indio_dev->info = &ad5421_info; - indio_dev->modes = INDIO_DIRECT_MODE; - indio_dev->channels = ad5421_channels; - indio_dev->num_channels = ARRAY_SIZE(ad5421_channels); - - st->ctrl = AD5421_CTRL_WATCHDOG_DISABLE | - AD5421_CTRL_AUTO_FAULT_READBACK; - - if (pdata) { - st->current_range = pdata->current_range; - if (pdata->external_vref) - st->ctrl |= AD5421_CTRL_PWR_DOWN_INT_VREF; - } else { - st->current_range = AD5421_CURRENT_RANGE_4mA_20mA; - } - - /* write initial ctrl register value */ - ad5421_update_ctrl(indio_dev, 0, 0); - - if (spi->irq) { - ret = request_threaded_irq(spi->irq, - NULL, - ad5421_fault_handler, - IRQF_TRIGGER_HIGH | IRQF_ONESHOT, - "ad5421 fault", - indio_dev); - if (ret) - goto error_free; - } - - ret = iio_device_register(indio_dev); - if (ret) { - dev_err(&spi->dev, "Failed to register iio device: %d\n", ret); - goto error_free_irq; - } - - return 0; - -error_free_irq: - if (spi->irq) - free_irq(spi->irq, indio_dev); -error_free: - iio_device_free(indio_dev); - - return ret; -} - -static int __devexit ad5421_remove(struct spi_device *spi) -{ - struct iio_dev *indio_dev = spi_get_drvdata(spi); - - iio_device_unregister(indio_dev); - if (spi->irq) - free_irq(spi->irq, indio_dev); - iio_device_free(indio_dev); - - return 0; -} - -static struct spi_driver ad5421_driver = { - .driver = { - .name = "ad5421", - .owner = THIS_MODULE, - }, - .probe = ad5421_probe, - .remove = __devexit_p(ad5421_remove), -}; -module_spi_driver(ad5421_driver); - -MODULE_AUTHOR("Lars-Peter Clausen "); -MODULE_DESCRIPTION("Analog Devices AD5421 DAC"); -MODULE_LICENSE("GPL v2"); -MODULE_ALIAS("spi:ad5421"); diff --git a/drivers/staging/iio/dac/ad5421.h b/drivers/staging/iio/dac/ad5421.h deleted file mode 100644 index cd2bb84..0000000 --- a/drivers/staging/iio/dac/ad5421.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __IIO_DAC_AD5421_H__ -#define __IIO_DAC_AD5421_H__ - -/* - * TODO: This file needs to go into include/linux/iio - */ - -/** - * enum ad5421_current_range - Current range the AD5421 is configured for. - * @AD5421_CURRENT_RANGE_4mA_20mA: 4 mA to 20 mA (RANGE1,0 pins = 00) - * @AD5421_CURRENT_RANGE_3mA8_21mA: 3.8 mA to 21 mA (RANGE1,0 pins = x1) - * @AD5421_CURRENT_RANGE_3mA2_24mA: 3.2 mA to 24 mA (RANGE1,0 pins = 10) - */ - -enum ad5421_current_range { - AD5421_CURRENT_RANGE_4mA_20mA, - AD5421_CURRENT_RANGE_3mA8_21mA, - AD5421_CURRENT_RANGE_3mA2_24mA, -}; - -/** - * struct ad5421_platform_data - AD5421 DAC driver platform data - * @external_vref: whether an external reference voltage is used or not - * @current_range: Current range the AD5421 is configured for - */ - -struct ad5421_platform_data { - bool external_vref; - enum ad5421_current_range current_range; -}; - -#endif diff --git a/drivers/staging/iio/dac/ad5446.c b/drivers/staging/iio/dac/ad5446.c deleted file mode 100644 index 49f557f..0000000 --- a/drivers/staging/iio/dac/ad5446.c +++ /dev/null @@ -1,381 +0,0 @@ -/* - * AD5446 SPI DAC driver - * - * Copyright 2010 Analog Devices Inc. - * - * Licensed under the GPL-2 or later. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "ad5446.h" - -static int ad5446_write(struct ad5446_state *st, unsigned val) -{ - __be16 data = cpu_to_be16(val); - return spi_write(st->spi, &data, sizeof(data)); -} - -static int ad5660_write(struct ad5446_state *st, unsigned val) -{ - uint8_t data[3]; - - data[0] = (val >> 16) & 0xFF; - data[1] = (val >> 8) & 0xFF; - data[2] = val & 0xFF; - - return spi_write(st->spi, data, sizeof(data)); -} - -static const char * const ad5446_powerdown_modes[] = { - "1kohm_to_gnd", "100kohm_to_gnd", "three_state" -}; - -static int ad5446_set_powerdown_mode(struct iio_dev *indio_dev, - const struct iio_chan_spec *chan, unsigned int mode) -{ - struct ad5446_state *st = iio_priv(indio_dev); - - st->pwr_down_mode = mode + 1; - - return 0; -} - -static int ad5446_get_powerdown_mode(struct iio_dev *indio_dev, - const struct iio_chan_spec *chan) -{ - struct ad5446_state *st = iio_priv(indio_dev); - - return st->pwr_down_mode - 1; -} - -static const struct iio_enum ad5446_powerdown_mode_enum = { - .items = ad5446_powerdown_modes, - .num_items = ARRAY_SIZE(ad5446_powerdown_modes), - .get = ad5446_get_powerdown_mode, - .set = ad5446_set_powerdown_mode, -}; - -static ssize_t ad5446_read_dac_powerdown(struct iio_dev *indio_dev, - uintptr_t private, - const struct iio_chan_spec *chan, - char *buf) -{ - struct ad5446_state *st = iio_priv(indio_dev); - - return sprintf(buf, "%d\n", st->pwr_down); -} - -static ssize_t ad5446_write_dac_powerdown(struct iio_dev *indio_dev, - uintptr_t private, - const struct iio_chan_spec *chan, - const char *buf, size_t len) -{ - struct ad5446_state *st = iio_priv(indio_dev); - unsigned int shift; - unsigned int val; - bool powerdown; - int ret; - - ret = strtobool(buf, &powerdown); - if (ret) - return ret; - - mutex_lock(&indio_dev->mlock); - st->pwr_down = powerdown; - - if (st->pwr_down) { - shift = chan->scan_type.realbits + chan->scan_type.shift; - val = st->pwr_down_mode << shift; - } else { - val = st->cached_val; - } - - ret = st->chip_info->write(st, val); - mutex_unlock(&indio_dev->mlock); - - return ret ? ret : len; -} - -static const struct iio_chan_spec_ext_info ad5064_ext_info_powerdown[] = { - { - .name = "powerdown", - .read = ad5446_read_dac_powerdown, - .write = ad5446_write_dac_powerdown, - }, - IIO_ENUM("powerdown_mode", false, &ad5446_powerdown_mode_enum), - IIO_ENUM_AVAILABLE("powerdown_mode", &ad5446_powerdown_mode_enum), - { }, -}; - -#define _AD5446_CHANNEL(bits, storage, shift, ext) { \ - .type = IIO_VOLTAGE, \ - .indexed = 1, \ - .output = 1, \ - .channel = 0, \ - .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ - IIO_CHAN_INFO_SCALE_SHARED_BIT, \ - .scan_type = IIO_ST('u', (bits), (storage), (shift)), \ - .ext_info = (ext), \ -} - -#define AD5446_CHANNEL(bits, storage, shift) \ - _AD5446_CHANNEL(bits, storage, shift, NULL) - -#define AD5446_CHANNEL_POWERDOWN(bits, storage, shift) \ - _AD5446_CHANNEL(bits, storage, shift, ad5064_ext_info_powerdown) - -static const struct ad5446_chip_info ad5446_chip_info_tbl[] = { - [ID_AD5444] = { - .channel = AD5446_CHANNEL(12, 16, 2), - .write = ad5446_write, - }, - [ID_AD5446] = { - .channel = AD5446_CHANNEL(14, 16, 0), - .write = ad5446_write, - }, - [ID_AD5541A] = { - .channel = AD5446_CHANNEL(16, 16, 0), - .write = ad5446_write, - }, - [ID_AD5512A] = { - .channel = AD5446_CHANNEL(12, 16, 4), - .write = ad5446_write, - }, - [ID_AD5553] = { - .channel = AD5446_CHANNEL(14, 16, 0), - .write = ad5446_write, - }, - [ID_AD5601] = { - .channel = AD5446_CHANNEL_POWERDOWN(8, 16, 6), - .write = ad5446_write, - }, - [ID_AD5611] = { - .channel = AD5446_CHANNEL_POWERDOWN(10, 16, 4), - .write = ad5446_write, - }, - [ID_AD5621] = { - .channel = AD5446_CHANNEL_POWERDOWN(12, 16, 2), - .write = ad5446_write, - }, - [ID_AD5620_2500] = { - .channel = AD5446_CHANNEL_POWERDOWN(12, 16, 2), - .int_vref_mv = 2500, - .write = ad5446_write, - }, - [ID_AD5620_1250] = { - .channel = AD5446_CHANNEL_POWERDOWN(12, 16, 2), - .int_vref_mv = 1250, - .write = ad5446_write, - }, - [ID_AD5640_2500] = { - .channel = AD5446_CHANNEL_POWERDOWN(14, 16, 0), - .int_vref_mv = 2500, - .write = ad5446_write, - }, - [ID_AD5640_1250] = { - .channel = AD5446_CHANNEL_POWERDOWN(14, 16, 0), - .int_vref_mv = 1250, - .write = ad5446_write, - }, - [ID_AD5660_2500] = { - .channel = AD5446_CHANNEL_POWERDOWN(16, 16, 0), - .int_vref_mv = 2500, - .write = ad5660_write, - }, - [ID_AD5660_1250] = { - .channel = AD5446_CHANNEL_POWERDOWN(16, 16, 0), - .int_vref_mv = 1250, - .write = ad5660_write, - }, - [ID_AD5662] = { - .channel = AD5446_CHANNEL_POWERDOWN(16, 16, 0), - .write = ad5660_write, - }, -}; - -static int ad5446_read_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, - int *val, - int *val2, - long m) -{ - struct ad5446_state *st = iio_priv(indio_dev); - unsigned long scale_uv; - - switch (m) { - case IIO_CHAN_INFO_RAW: - *val = st->cached_val; - return IIO_VAL_INT; - case IIO_CHAN_INFO_SCALE: - scale_uv = (st->vref_mv * 1000) >> chan->scan_type.realbits; - *val = scale_uv / 1000; - *val2 = (scale_uv % 1000) * 1000; - return IIO_VAL_INT_PLUS_MICRO; - - } - return -EINVAL; -} - -static int ad5446_write_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, - int val, - int val2, - long mask) -{ - struct ad5446_state *st = iio_priv(indio_dev); - int ret = 0; - - switch (mask) { - case IIO_CHAN_INFO_RAW: - if (val >= (1 << chan->scan_type.realbits) || val < 0) - return -EINVAL; - - val <<= chan->scan_type.shift; - mutex_lock(&indio_dev->mlock); - st->cached_val = val; - if (!st->pwr_down) - ret = st->chip_info->write(st, val); - mutex_unlock(&indio_dev->mlock); - break; - default: - ret = -EINVAL; - } - - return ret; -} - -static const struct iio_info ad5446_info = { - .read_raw = ad5446_read_raw, - .write_raw = ad5446_write_raw, - .driver_module = THIS_MODULE, -}; - -static int __devinit ad5446_probe(struct spi_device *spi) -{ - struct ad5446_state *st; - struct iio_dev *indio_dev; - struct regulator *reg; - int ret, voltage_uv = 0; - - reg = regulator_get(&spi->dev, "vcc"); - if (!IS_ERR(reg)) { - ret = regulator_enable(reg); - if (ret) - goto error_put_reg; - - voltage_uv = regulator_get_voltage(reg); - } - - indio_dev = iio_device_alloc(sizeof(*st)); - if (indio_dev == NULL) { - ret = -ENOMEM; - goto error_disable_reg; - } - st = iio_priv(indio_dev); - st->chip_info = - &ad5446_chip_info_tbl[spi_get_device_id(spi)->driver_data]; - - spi_set_drvdata(spi, indio_dev); - st->reg = reg; - st->spi = spi; - - /* Establish that the iio_dev is a child of the spi device */ - indio_dev->dev.parent = &spi->dev; - indio_dev->name = spi_get_device_id(spi)->name; - indio_dev->info = &ad5446_info; - indio_dev->modes = INDIO_DIRECT_MODE; - indio_dev->channels = &st->chip_info->channel; - indio_dev->num_channels = 1; - - st->pwr_down_mode = MODE_PWRDWN_1k; - - if (st->chip_info->int_vref_mv) - st->vref_mv = st->chip_info->int_vref_mv; - else if (voltage_uv) - st->vref_mv = voltage_uv / 1000; - else - dev_warn(&spi->dev, "reference voltage unspecified\n"); - - ret = iio_device_register(indio_dev); - if (ret) - goto error_free_device; - - return 0; - -error_free_device: - iio_device_free(indio_dev); -error_disable_reg: - if (!IS_ERR(reg)) - regulator_disable(reg); -error_put_reg: - if (!IS_ERR(reg)) - regulator_put(reg); - - return ret; -} - -static int ad5446_remove(struct spi_device *spi) -{ - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad5446_state *st = iio_priv(indio_dev); - - iio_device_unregister(indio_dev); - if (!IS_ERR(st->reg)) { - regulator_disable(st->reg); - regulator_put(st->reg); - } - iio_device_free(indio_dev); - - return 0; -} - -static const struct spi_device_id ad5446_id[] = { - {"ad5444", ID_AD5444}, - {"ad5446", ID_AD5446}, - {"ad5512a", ID_AD5512A}, - {"ad5541a", ID_AD5541A}, - {"ad5542a", ID_AD5541A}, /* ad5541a and ad5542a are compatible */ - {"ad5543", ID_AD5541A}, /* ad5541a and ad5543 are compatible */ - {"ad5553", ID_AD5553}, - {"ad5601", ID_AD5601}, - {"ad5611", ID_AD5611}, - {"ad5621", ID_AD5621}, - {"ad5620-2500", ID_AD5620_2500}, /* AD5620/40/60: */ - {"ad5620-1250", ID_AD5620_1250}, /* part numbers may look differently */ - {"ad5640-2500", ID_AD5640_2500}, - {"ad5640-1250", ID_AD5640_1250}, - {"ad5660-2500", ID_AD5660_2500}, - {"ad5660-1250", ID_AD5660_1250}, - {"ad5662", ID_AD5662}, - {} -}; -MODULE_DEVICE_TABLE(spi, ad5446_id); - -static struct spi_driver ad5446_driver = { - .driver = { - .name = "ad5446", - .owner = THIS_MODULE, - }, - .probe = ad5446_probe, - .remove = __devexit_p(ad5446_remove), - .id_table = ad5446_id, -}; -module_spi_driver(ad5446_driver); - -MODULE_AUTHOR("Michael Hennerich "); -MODULE_DESCRIPTION("Analog Devices AD5444/AD5446 DAC"); -MODULE_LICENSE("GPL v2"); diff --git a/drivers/staging/iio/dac/ad5446.h b/drivers/staging/iio/dac/ad5446.h deleted file mode 100644 index dfd68ce..0000000 --- a/drivers/staging/iio/dac/ad5446.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * AD5446 SPI DAC driver - * - * Copyright 2010 Analog Devices Inc. - * - * Licensed under the GPL-2 or later. - */ -#ifndef IIO_DAC_AD5446_H_ -#define IIO_DAC_AD5446_H_ - -/* DAC Control Bits */ - -#define AD5446_LOAD (0x0 << 14) /* Load and update */ -#define AD5446_SDO_DIS (0x1 << 14) /* Disable SDO */ -#define AD5446_NOP (0x2 << 14) /* No operation */ -#define AD5446_CLK_RISING (0x3 << 14) /* Clock data on rising edge */ - -#define AD5620_LOAD (0x0 << 14) /* Load and update Norm Operation*/ -#define AD5620_PWRDWN_1k (0x1 << 14) /* Power-down: 1kOhm to GND */ -#define AD5620_PWRDWN_100k (0x2 << 14) /* Power-down: 100kOhm to GND */ -#define AD5620_PWRDWN_TRISTATE (0x3 << 14) /* Power-down: Three-state */ - -#define AD5660_LOAD (0x0 << 16) /* Load and update Norm Operation*/ -#define AD5660_PWRDWN_1k (0x1 << 16) /* Power-down: 1kOhm to GND */ -#define AD5660_PWRDWN_100k (0x2 << 16) /* Power-down: 100kOhm to GND */ -#define AD5660_PWRDWN_TRISTATE (0x3 << 16) /* Power-down: Three-state */ - -#define MODE_PWRDWN_1k 0x1 -#define MODE_PWRDWN_100k 0x2 -#define MODE_PWRDWN_TRISTATE 0x3 - -/** - * struct ad5446_state - driver instance specific data - * @spi: spi_device - * @chip_info: chip model specific constants, available modes etc - * @reg: supply regulator - * @vref_mv: actual reference voltage used - */ - -struct ad5446_state { - struct spi_device *spi; - const struct ad5446_chip_info *chip_info; - struct regulator *reg; - unsigned short vref_mv; - unsigned cached_val; - unsigned pwr_down_mode; - unsigned pwr_down; -}; - -/** - * struct ad5446_chip_info - chip specific information - * @channel: channel spec for the DAC - * @int_vref_mv: AD5620/40/60: the internal reference voltage - * @write: chip specific helper function to write to the register - */ - -struct ad5446_chip_info { - struct iio_chan_spec channel; - u16 int_vref_mv; - int (*write)(struct ad5446_state *st, unsigned val); -}; - -/** - * ad5446_supported_device_ids: - * The AD5620/40/60 parts are available in different fixed internal reference - * voltage options. The actual part numbers may look differently - * (and a bit cryptic), however this style is used to make clear which - * parts are supported here. - */ - -enum ad5446_supported_device_ids { - ID_AD5444, - ID_AD5446, - ID_AD5541A, - ID_AD5512A, - ID_AD5553, - ID_AD5601, - ID_AD5611, - ID_AD5621, - ID_AD5620_2500, - ID_AD5620_1250, - ID_AD5640_2500, - ID_AD5640_1250, - ID_AD5660_2500, - ID_AD5660_1250, - ID_AD5662, -}; - -#endif /* IIO_DAC_AD5446_H_ */ diff --git a/drivers/staging/iio/dac/ad5504.c b/drivers/staging/iio/dac/ad5504.c deleted file mode 100644 index 1289e9b..0000000 --- a/drivers/staging/iio/dac/ad5504.c +++ /dev/null @@ -1,394 +0,0 @@ -/* - * AD5504, AD5501 High Voltage Digital to Analog Converter - * - * Copyright 2011 Analog Devices Inc. - * - * Licensed under the GPL-2. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "ad5504.h" - -#define AD5505_BITS 12 -#define AD5504_RES_MASK ((1 << (AD5505_BITS)) - 1) - -#define AD5504_CMD_READ (1 << 15) -#define AD5504_CMD_WRITE (0 << 15) -#define AD5504_ADDR(addr) ((addr) << 12) - -/* Registers */ -#define AD5504_ADDR_NOOP 0 -#define AD5504_ADDR_DAC(x) ((x) + 1) -#define AD5504_ADDR_ALL_DAC 5 -#define AD5504_ADDR_CTRL 7 - -/* Control Register */ -#define AD5504_DAC_PWR(ch) ((ch) << 2) -#define AD5504_DAC_PWRDWN_MODE(mode) ((mode) << 6) -#define AD5504_DAC_PWRDN_20K 0 -#define AD5504_DAC_PWRDN_3STATE 1 - -/** - * struct ad5446_state - driver instance specific data - * @us: spi_device - * @reg: supply regulator - * @vref_mv: actual reference voltage used - * @pwr_down_mask power down mask - * @pwr_down_mode current power down mode - */ - -struct ad5504_state { - struct spi_device *spi; - struct regulator *reg; - unsigned short vref_mv; - unsigned pwr_down_mask; - unsigned pwr_down_mode; -}; - -/** - * ad5504_supported_device_ids: - */ - -enum ad5504_supported_device_ids { - ID_AD5504, - ID_AD5501, -}; - -static int ad5504_spi_write(struct spi_device *spi, u8 addr, u16 val) -{ - u16 tmp = cpu_to_be16(AD5504_CMD_WRITE | - AD5504_ADDR(addr) | - (val & AD5504_RES_MASK)); - - return spi_write(spi, (u8 *)&tmp, 2); -} - -static int ad5504_spi_read(struct spi_device *spi, u8 addr) -{ - u16 tmp = cpu_to_be16(AD5504_CMD_READ | AD5504_ADDR(addr)); - u16 val; - int ret; - struct spi_transfer t = { - .tx_buf = &tmp, - .rx_buf = &val, - .len = 2, - }; - struct spi_message m; - - spi_message_init(&m); - spi_message_add_tail(&t, &m); - ret = spi_sync(spi, &m); - - if (ret < 0) - return ret; - - return be16_to_cpu(val) & AD5504_RES_MASK; -} - -static int ad5504_read_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, - int *val, - int *val2, - long m) -{ - struct ad5504_state *st = iio_priv(indio_dev); - unsigned long scale_uv; - int ret; - - switch (m) { - case IIO_CHAN_INFO_RAW: - ret = ad5504_spi_read(st->spi, chan->address); - if (ret < 0) - return ret; - - *val = ret; - - return IIO_VAL_INT; - case IIO_CHAN_INFO_SCALE: - scale_uv = (st->vref_mv * 1000) >> chan->scan_type.realbits; - *val = scale_uv / 1000; - *val2 = (scale_uv % 1000) * 1000; - return IIO_VAL_INT_PLUS_MICRO; - - } - return -EINVAL; -} - -static int ad5504_write_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, - int val, - int val2, - long mask) -{ - struct ad5504_state *st = iio_priv(indio_dev); - int ret; - - switch (mask) { - case IIO_CHAN_INFO_RAW: - if (val >= (1 << chan->scan_type.realbits) || val < 0) - return -EINVAL; - - return ad5504_spi_write(st->spi, chan->address, val); - default: - ret = -EINVAL; - } - - return -EINVAL; -} - -static const char * const ad5504_powerdown_modes[] = { - "20kohm_to_gnd", - "three_state", -}; - -static int ad5504_get_powerdown_mode(struct iio_dev *indio_dev, - const struct iio_chan_spec *chan) -{ - struct ad5504_state *st = iio_priv(indio_dev); - - return st->pwr_down_mode; -} - -static int ad5504_set_powerdown_mode(struct iio_dev *indio_dev, - const struct iio_chan_spec *chan, unsigned int mode) -{ - struct ad5504_state *st = iio_priv(indio_dev); - - st->pwr_down_mode = mode; - - return 0; -} - -static const struct iio_enum ad5504_powerdown_mode_enum = { - .items = ad5504_powerdown_modes, - .num_items = ARRAY_SIZE(ad5504_powerdown_modes), - .get = ad5504_get_powerdown_mode, - .set = ad5504_set_powerdown_mode, -}; - -static ssize_t ad5504_read_dac_powerdown(struct iio_dev *indio_dev, - uintptr_t private, const struct iio_chan_spec *chan, char *buf) -{ - struct ad5504_state *st = iio_priv(indio_dev); - - return sprintf(buf, "%d\n", - !(st->pwr_down_mask & (1 << chan->channel))); -} - -static ssize_t ad5504_write_dac_powerdown(struct iio_dev *indio_dev, - uintptr_t private, const struct iio_chan_spec *chan, const char *buf, - size_t len) -{ - bool pwr_down; - int ret; - struct ad5504_state *st = iio_priv(indio_dev); - - ret = strtobool(buf, &pwr_down); - if (ret) - return ret; - - if (pwr_down) - st->pwr_down_mask |= (1 << chan->channel); - else - st->pwr_down_mask &= ~(1 << chan->channel); - - ret = ad5504_spi_write(st->spi, AD5504_ADDR_CTRL, - AD5504_DAC_PWRDWN_MODE(st->pwr_down_mode) | - AD5504_DAC_PWR(st->pwr_down_mask)); - - /* writes to the CTRL register must be followed by a NOOP */ - ad5504_spi_write(st->spi, AD5504_ADDR_NOOP, 0); - - return ret ? ret : len; -} - -static IIO_CONST_ATTR(temp0_thresh_rising_value, "110000"); -static IIO_CONST_ATTR(temp0_thresh_rising_en, "1"); - -static struct attribute *ad5504_ev_attributes[] = { - &iio_const_attr_temp0_thresh_rising_value.dev_attr.attr, - &iio_const_attr_temp0_thresh_rising_en.dev_attr.attr, - NULL, -}; - -static struct attribute_group ad5504_ev_attribute_group = { - .attrs = ad5504_ev_attributes, - .name = "events", -}; - -static irqreturn_t ad5504_event_handler(int irq, void *private) -{ - iio_push_event(private, - IIO_UNMOD_EVENT_CODE(IIO_TEMP, - 0, - IIO_EV_TYPE_THRESH, - IIO_EV_DIR_RISING), - iio_get_time_ns()); - - return IRQ_HANDLED; -} - -static const struct iio_info ad5504_info = { - .write_raw = ad5504_write_raw, - .read_raw = ad5504_read_raw, - .event_attrs = &ad5504_ev_attribute_group, - .driver_module = THIS_MODULE, -}; - -static const struct iio_chan_spec_ext_info ad5504_ext_info[] = { - { - .name = "powerdown", - .read = ad5504_read_dac_powerdown, - .write = ad5504_write_dac_powerdown, - }, - IIO_ENUM("powerdown_mode", true, &ad5504_powerdown_mode_enum), - IIO_ENUM_AVAILABLE("powerdown_mode", &ad5504_powerdown_mode_enum), - { }, -}; - -#define AD5504_CHANNEL(_chan) { \ - .type = IIO_VOLTAGE, \ - .indexed = 1, \ - .output = 1, \ - .channel = (_chan), \ - .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ - IIO_CHAN_INFO_SCALE_SHARED_BIT, \ - .address = AD5504_ADDR_DAC(_chan), \ - .scan_type = IIO_ST('u', 12, 16, 0), \ - .ext_info = ad5504_ext_info, \ -} - -static const struct iio_chan_spec ad5504_channels[] = { - AD5504_CHANNEL(0), - AD5504_CHANNEL(1), - AD5504_CHANNEL(2), - AD5504_CHANNEL(3), -}; - -static int __devinit ad5504_probe(struct spi_device *spi) -{ - struct ad5504_platform_data *pdata = spi->dev.platform_data; - struct iio_dev *indio_dev; - struct ad5504_state *st; - struct regulator *reg; - int ret, voltage_uv = 0; - - indio_dev = iio_device_alloc(sizeof(*st)); - if (indio_dev == NULL) { - ret = -ENOMEM; - goto error_ret; - } - reg = regulator_get(&spi->dev, "vcc"); - if (!IS_ERR(reg)) { - ret = regulator_enable(reg); - if (ret) - goto error_put_reg; - - voltage_uv = regulator_get_voltage(reg); - } - - spi_set_drvdata(spi, indio_dev); - st = iio_priv(indio_dev); - if (voltage_uv) - st->vref_mv = voltage_uv / 1000; - else if (pdata) - st->vref_mv = pdata->vref_mv; - else - dev_warn(&spi->dev, "reference voltage unspecified\n"); - - st->reg = reg; - st->spi = spi; - indio_dev->dev.parent = &spi->dev; - indio_dev->name = spi_get_device_id(st->spi)->name; - indio_dev->info = &ad5504_info; - if (spi_get_device_id(st->spi)->driver_data == ID_AD5501) - indio_dev->num_channels = 1; - else - indio_dev->num_channels = 4; - indio_dev->channels = ad5504_channels; - indio_dev->modes = INDIO_DIRECT_MODE; - - if (spi->irq) { - ret = request_threaded_irq(spi->irq, - NULL, - &ad5504_event_handler, - IRQF_TRIGGER_FALLING | IRQF_ONESHOT, - spi_get_device_id(st->spi)->name, - indio_dev); - if (ret) - goto error_disable_reg; - } - - ret = iio_device_register(indio_dev); - if (ret) - goto error_free_irq; - - return 0; - -error_free_irq: - if (spi->irq) - free_irq(spi->irq, indio_dev); -error_disable_reg: - if (!IS_ERR(reg)) - regulator_disable(reg); -error_put_reg: - if (!IS_ERR(reg)) - regulator_put(reg); - - iio_device_free(indio_dev); -error_ret: - return ret; -} - -static int __devexit ad5504_remove(struct spi_device *spi) -{ - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad5504_state *st = iio_priv(indio_dev); - - iio_device_unregister(indio_dev); - if (spi->irq) - free_irq(spi->irq, indio_dev); - - if (!IS_ERR(st->reg)) { - regulator_disable(st->reg); - regulator_put(st->reg); - } - iio_device_free(indio_dev); - - return 0; -} - -static const struct spi_device_id ad5504_id[] = { - {"ad5504", ID_AD5504}, - {"ad5501", ID_AD5501}, - {} -}; -MODULE_DEVICE_TABLE(spi, ad5504_id); - -static struct spi_driver ad5504_driver = { - .driver = { - .name = "ad5504", - .owner = THIS_MODULE, - }, - .probe = ad5504_probe, - .remove = __devexit_p(ad5504_remove), - .id_table = ad5504_id, -}; -module_spi_driver(ad5504_driver); - -MODULE_AUTHOR("Michael Hennerich "); -MODULE_DESCRIPTION("Analog Devices AD5501/AD5501 DAC"); -MODULE_LICENSE("GPL v2"); diff --git a/drivers/staging/iio/dac/ad5504.h b/drivers/staging/iio/dac/ad5504.h deleted file mode 100644 index d4980bf..0000000 --- a/drivers/staging/iio/dac/ad5504.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * AD5504 SPI DAC driver - * - * Copyright 2011 Analog Devices Inc. - * - * Licensed under the GPL-2. - */ - -#ifndef SPI_AD5504_H_ -#define SPI_AD5504_H_ - -/* - * TODO: struct ad5504_platform_data needs to go into include/linux/iio - */ - -struct ad5504_platform_data { - u16 vref_mv; -}; - -#endif /* SPI_AD5504_H_ */ diff --git a/drivers/staging/iio/dac/ad5624r.h b/drivers/staging/iio/dac/ad5624r.h deleted file mode 100644 index 5dca302..0000000 --- a/drivers/staging/iio/dac/ad5624r.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * AD5624R SPI DAC driver - * - * Copyright 2010-2011 Analog Devices Inc. - * - * Licensed under the GPL-2. - */ -#ifndef SPI_AD5624R_H_ -#define SPI_AD5624R_H_ - -#define AD5624R_DAC_CHANNELS 4 - -#define AD5624R_ADDR_DAC0 0x0 -#define AD5624R_ADDR_DAC1 0x1 -#define AD5624R_ADDR_DAC2 0x2 -#define AD5624R_ADDR_DAC3 0x3 -#define AD5624R_ADDR_ALL_DAC 0x7 - -#define AD5624R_CMD_WRITE_INPUT_N 0x0 -#define AD5624R_CMD_UPDATE_DAC_N 0x1 -#define AD5624R_CMD_WRITE_INPUT_N_UPDATE_ALL 0x2 -#define AD5624R_CMD_WRITE_INPUT_N_UPDATE_N 0x3 -#define AD5624R_CMD_POWERDOWN_DAC 0x4 -#define AD5624R_CMD_RESET 0x5 -#define AD5624R_CMD_LDAC_SETUP 0x6 -#define AD5624R_CMD_INTERNAL_REFER_SETUP 0x7 - -#define AD5624R_LDAC_PWRDN_NONE 0x0 -#define AD5624R_LDAC_PWRDN_1K 0x1 -#define AD5624R_LDAC_PWRDN_100K 0x2 -#define AD5624R_LDAC_PWRDN_3STATE 0x3 - -/** - * struct ad5624r_chip_info - chip specific information - * @channels: channel spec for the DAC - * @int_vref_mv: AD5620/40/60: the internal reference voltage - */ - -struct ad5624r_chip_info { - const struct iio_chan_spec *channels; - u16 int_vref_mv; -}; - -/** - * struct ad5446_state - driver instance specific data - * @indio_dev: the industrial I/O device - * @us: spi_device - * @chip_info: chip model specific constants, available modes etc - * @reg: supply regulator - * @vref_mv: actual reference voltage used - * @pwr_down_mask power down mask - * @pwr_down_mode current power down mode - */ - -struct ad5624r_state { - struct spi_device *us; - const struct ad5624r_chip_info *chip_info; - struct regulator *reg; - unsigned short vref_mv; - unsigned pwr_down_mask; - unsigned pwr_down_mode; -}; - -/** - * ad5624r_supported_device_ids: - * The AD5624/44/64 parts are available in different - * fixed internal reference voltage options. - */ - -enum ad5624r_supported_device_ids { - ID_AD5624R3, - ID_AD5644R3, - ID_AD5664R3, - ID_AD5624R5, - ID_AD5644R5, - ID_AD5664R5, -}; - -#endif /* SPI_AD5624R_H_ */ diff --git a/drivers/staging/iio/dac/ad5624r_spi.c b/drivers/staging/iio/dac/ad5624r_spi.c deleted file mode 100644 index 6a7d6a4..0000000 --- a/drivers/staging/iio/dac/ad5624r_spi.c +++ /dev/null @@ -1,324 +0,0 @@ -/* - * AD5624R, AD5644R, AD5664R Digital to analog convertors spi driver - * - * Copyright 2010-2011 Analog Devices Inc. - * - * Licensed under the GPL-2. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "ad5624r.h" - -static int ad5624r_spi_write(struct spi_device *spi, - u8 cmd, u8 addr, u16 val, u8 len) -{ - u32 data; - u8 msg[3]; - - /* - * The input shift register is 24 bits wide. The first two bits are - * don't care bits. The next three are the command bits, C2 to C0, - * followed by the 3-bit DAC address, A2 to A0, and then the - * 16-, 14-, 12-bit data-word. The data-word comprises the 16-, - * 14-, 12-bit input code followed by 0, 2, or 4 don't care bits, - * for the AD5664R, AD5644R, and AD5624R, respectively. - */ - data = (0 << 22) | (cmd << 19) | (addr << 16) | (val << (16 - len)); - msg[0] = data >> 16; - msg[1] = data >> 8; - msg[2] = data; - - return spi_write(spi, msg, 3); -} - -static int ad5624r_read_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, - int *val, - int *val2, - long m) -{ - struct ad5624r_state *st = iio_priv(indio_dev); - unsigned long scale_uv; - - switch (m) { - case IIO_CHAN_INFO_SCALE: - scale_uv = (st->vref_mv * 1000) >> chan->scan_type.realbits; - *val = scale_uv / 1000; - *val2 = (scale_uv % 1000) * 1000; - return IIO_VAL_INT_PLUS_MICRO; - - } - return -EINVAL; -} - -static int ad5624r_write_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, - int val, - int val2, - long mask) -{ - struct ad5624r_state *st = iio_priv(indio_dev); - int ret; - - switch (mask) { - case IIO_CHAN_INFO_RAW: - if (val >= (1 << chan->scan_type.realbits) || val < 0) - return -EINVAL; - - return ad5624r_spi_write(st->us, - AD5624R_CMD_WRITE_INPUT_N_UPDATE_N, - chan->address, val, - chan->scan_type.shift); - default: - ret = -EINVAL; - } - - return -EINVAL; -} - -static const char * const ad5624r_powerdown_modes[] = { - "1kohm_to_gnd", - "100kohm_to_gnd", - "three_state" -}; - -static int ad5624r_get_powerdown_mode(struct iio_dev *indio_dev, - const struct iio_chan_spec *chan) -{ - struct ad5624r_state *st = iio_priv(indio_dev); - - return st->pwr_down_mode; -} - -static int ad5624r_set_powerdown_mode(struct iio_dev *indio_dev, - const struct iio_chan_spec *chan, unsigned int mode) -{ - struct ad5624r_state *st = iio_priv(indio_dev); - - st->pwr_down_mode = mode; - - return 0; -} - -static const struct iio_enum ad5624r_powerdown_mode_enum = { - .items = ad5624r_powerdown_modes, - .num_items = ARRAY_SIZE(ad5624r_powerdown_modes), - .get = ad5624r_get_powerdown_mode, - .set = ad5624r_set_powerdown_mode, -}; - -static ssize_t ad5624r_read_dac_powerdown(struct iio_dev *indio_dev, - uintptr_t private, const struct iio_chan_spec *chan, char *buf) -{ - struct ad5624r_state *st = iio_priv(indio_dev); - - return sprintf(buf, "%d\n", - !!(st->pwr_down_mask & (1 << chan->channel))); -} - -static ssize_t ad5624r_write_dac_powerdown(struct iio_dev *indio_dev, - uintptr_t private, const struct iio_chan_spec *chan, const char *buf, - size_t len) -{ - bool pwr_down; - int ret; - struct ad5624r_state *st = iio_priv(indio_dev); - - ret = strtobool(buf, &pwr_down); - if (ret) - return ret; - - if (pwr_down) - st->pwr_down_mask |= (1 << chan->channel); - else - st->pwr_down_mask &= ~(1 << chan->channel); - - ret = ad5624r_spi_write(st->us, AD5624R_CMD_POWERDOWN_DAC, 0, - (st->pwr_down_mode << 4) | - st->pwr_down_mask, 16); - - return ret ? ret : len; -} - -static const struct iio_info ad5624r_info = { - .write_raw = ad5624r_write_raw, - .read_raw = ad5624r_read_raw, - .driver_module = THIS_MODULE, -}; - -static const struct iio_chan_spec_ext_info ad5624r_ext_info[] = { - { - .name = "powerdown", - .read = ad5624r_read_dac_powerdown, - .write = ad5624r_write_dac_powerdown, - }, - IIO_ENUM("powerdown_mode", true, &ad5624r_powerdown_mode_enum), - IIO_ENUM_AVAILABLE("powerdown_mode", &ad5624r_powerdown_mode_enum), - { }, -}; - -#define AD5624R_CHANNEL(_chan, _bits) { \ - .type = IIO_VOLTAGE, \ - .indexed = 1, \ - .output = 1, \ - .channel = (_chan), \ - .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ - IIO_CHAN_INFO_SCALE_SHARED_BIT, \ - .address = (_chan), \ - .scan_type = IIO_ST('u', (_bits), 16, 16 - (_bits)), \ - .ext_info = ad5624r_ext_info, \ -} - -#define DECLARE_AD5624R_CHANNELS(_name, _bits) \ - const struct iio_chan_spec _name##_channels[] = { \ - AD5624R_CHANNEL(0, _bits), \ - AD5624R_CHANNEL(1, _bits), \ - AD5624R_CHANNEL(2, _bits), \ - AD5624R_CHANNEL(3, _bits), \ -} - -static DECLARE_AD5624R_CHANNELS(ad5624r, 12); -static DECLARE_AD5624R_CHANNELS(ad5644r, 14); -static DECLARE_AD5624R_CHANNELS(ad5664r, 16); - -static const struct ad5624r_chip_info ad5624r_chip_info_tbl[] = { - [ID_AD5624R3] = { - .channels = ad5624r_channels, - .int_vref_mv = 1250, - }, - [ID_AD5624R5] = { - .channels = ad5624r_channels, - .int_vref_mv = 2500, - }, - [ID_AD5644R3] = { - .channels = ad5644r_channels, - .int_vref_mv = 1250, - }, - [ID_AD5644R5] = { - .channels = ad5644r_channels, - .int_vref_mv = 2500, - }, - [ID_AD5664R3] = { - .channels = ad5664r_channels, - .int_vref_mv = 1250, - }, - [ID_AD5664R5] = { - .channels = ad5664r_channels, - .int_vref_mv = 2500, - }, -}; - -static int __devinit ad5624r_probe(struct spi_device *spi) -{ - struct ad5624r_state *st; - struct iio_dev *indio_dev; - int ret, voltage_uv = 0; - - indio_dev = iio_device_alloc(sizeof(*st)); - if (indio_dev == NULL) { - ret = -ENOMEM; - goto error_ret; - } - st = iio_priv(indio_dev); - st->reg = regulator_get(&spi->dev, "vcc"); - if (!IS_ERR(st->reg)) { - ret = regulator_enable(st->reg); - if (ret) - goto error_put_reg; - - voltage_uv = regulator_get_voltage(st->reg); - } - - spi_set_drvdata(spi, indio_dev); - st->chip_info = - &ad5624r_chip_info_tbl[spi_get_device_id(spi)->driver_data]; - - if (voltage_uv) - st->vref_mv = voltage_uv / 1000; - else - st->vref_mv = st->chip_info->int_vref_mv; - - st->us = spi; - - indio_dev->dev.parent = &spi->dev; - indio_dev->name = spi_get_device_id(spi)->name; - indio_dev->info = &ad5624r_info; - indio_dev->modes = INDIO_DIRECT_MODE; - indio_dev->channels = st->chip_info->channels; - indio_dev->num_channels = AD5624R_DAC_CHANNELS; - - ret = ad5624r_spi_write(spi, AD5624R_CMD_INTERNAL_REFER_SETUP, 0, - !!voltage_uv, 16); - if (ret) - goto error_disable_reg; - - ret = iio_device_register(indio_dev); - if (ret) - goto error_disable_reg; - - return 0; - -error_disable_reg: - if (!IS_ERR(st->reg)) - regulator_disable(st->reg); -error_put_reg: - if (!IS_ERR(st->reg)) - regulator_put(st->reg); - iio_device_free(indio_dev); -error_ret: - - return ret; -} - -static int __devexit ad5624r_remove(struct spi_device *spi) -{ - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad5624r_state *st = iio_priv(indio_dev); - - iio_device_unregister(indio_dev); - if (!IS_ERR(st->reg)) { - regulator_disable(st->reg); - regulator_put(st->reg); - } - iio_device_free(indio_dev); - - return 0; -} - -static const struct spi_device_id ad5624r_id[] = { - {"ad5624r3", ID_AD5624R3}, - {"ad5644r3", ID_AD5644R3}, - {"ad5664r3", ID_AD5664R3}, - {"ad5624r5", ID_AD5624R5}, - {"ad5644r5", ID_AD5644R5}, - {"ad5664r5", ID_AD5664R5}, - {} -}; -MODULE_DEVICE_TABLE(spi, ad5624r_id); - -static struct spi_driver ad5624r_driver = { - .driver = { - .name = "ad5624r", - .owner = THIS_MODULE, - }, - .probe = ad5624r_probe, - .remove = __devexit_p(ad5624r_remove), - .id_table = ad5624r_id, -}; -module_spi_driver(ad5624r_driver); - -MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); -MODULE_DESCRIPTION("Analog Devices AD5624/44/64R DAC spi driver"); -MODULE_LICENSE("GPL v2"); diff --git a/drivers/staging/iio/dac/ad5686.c b/drivers/staging/iio/dac/ad5686.c deleted file mode 100644 index 6948d75..0000000 --- a/drivers/staging/iio/dac/ad5686.c +++ /dev/null @@ -1,418 +0,0 @@ -/* - * AD5686R, AD5685R, AD5684R Digital to analog converters driver - * - * Copyright 2011 Analog Devices Inc. - * - * Licensed under the GPL-2. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#define AD5686_DAC_CHANNELS 4 - -#define AD5686_ADDR(x) ((x) << 16) -#define AD5686_CMD(x) ((x) << 20) - -#define AD5686_ADDR_DAC(chan) (0x1 << (chan)) -#define AD5686_ADDR_ALL_DAC 0xF - -#define AD5686_CMD_NOOP 0x0 -#define AD5686_CMD_WRITE_INPUT_N 0x1 -#define AD5686_CMD_UPDATE_DAC_N 0x2 -#define AD5686_CMD_WRITE_INPUT_N_UPDATE_N 0x3 -#define AD5686_CMD_POWERDOWN_DAC 0x4 -#define AD5686_CMD_LDAC_MASK 0x5 -#define AD5686_CMD_RESET 0x6 -#define AD5686_CMD_INTERNAL_REFER_SETUP 0x7 -#define AD5686_CMD_DAISY_CHAIN_ENABLE 0x8 -#define AD5686_CMD_READBACK_ENABLE 0x9 - -#define AD5686_LDAC_PWRDN_NONE 0x0 -#define AD5686_LDAC_PWRDN_1K 0x1 -#define AD5686_LDAC_PWRDN_100K 0x2 -#define AD5686_LDAC_PWRDN_3STATE 0x3 - -/** - * struct ad5686_chip_info - chip specific information - * @int_vref_mv: AD5620/40/60: the internal reference voltage - * @channel: channel specification -*/ - -struct ad5686_chip_info { - u16 int_vref_mv; - struct iio_chan_spec channel[AD5686_DAC_CHANNELS]; -}; - -/** - * struct ad5446_state - driver instance specific data - * @spi: spi_device - * @chip_info: chip model specific constants, available modes etc - * @reg: supply regulator - * @vref_mv: actual reference voltage used - * @pwr_down_mask: power down mask - * @pwr_down_mode: current power down mode - * @data: spi transfer buffers - */ - -struct ad5686_state { - struct spi_device *spi; - const struct ad5686_chip_info *chip_info; - struct regulator *reg; - unsigned short vref_mv; - unsigned pwr_down_mask; - unsigned pwr_down_mode; - /* - * DMA (thus cache coherency maintenance) requires the - * transfer buffers to live in their own cache lines. - */ - - union { - u32 d32; - u8 d8[4]; - } data[3] ____cacheline_aligned; -}; - -/** - * ad5686_supported_device_ids: - */ - -enum ad5686_supported_device_ids { - ID_AD5684, - ID_AD5685, - ID_AD5686, -}; -static int ad5686_spi_write(struct ad5686_state *st, - u8 cmd, u8 addr, u16 val, u8 shift) -{ - val <<= shift; - - st->data[0].d32 = cpu_to_be32(AD5686_CMD(cmd) | - AD5686_ADDR(addr) | - val); - - return spi_write(st->spi, &st->data[0].d8[1], 3); -} - -static int ad5686_spi_read(struct ad5686_state *st, u8 addr) -{ - struct spi_transfer t[] = { - { - .tx_buf = &st->data[0].d8[1], - .len = 3, - .cs_change = 1, - }, { - .tx_buf = &st->data[1].d8[1], - .rx_buf = &st->data[2].d8[1], - .len = 3, - }, - }; - struct spi_message m; - int ret; - - spi_message_init(&m); - spi_message_add_tail(&t[0], &m); - spi_message_add_tail(&t[1], &m); - - st->data[0].d32 = cpu_to_be32(AD5686_CMD(AD5686_CMD_READBACK_ENABLE) | - AD5686_ADDR(addr)); - st->data[1].d32 = cpu_to_be32(AD5686_CMD(AD5686_CMD_NOOP)); - - ret = spi_sync(st->spi, &m); - if (ret < 0) - return ret; - - return be32_to_cpu(st->data[2].d32); -} - -static const char * const ad5686_powerdown_modes[] = { - "1kohm_to_gnd", - "100kohm_to_gnd", - "three_state" -}; - -static int ad5686_get_powerdown_mode(struct iio_dev *indio_dev, - const struct iio_chan_spec *chan) -{ - struct ad5686_state *st = iio_priv(indio_dev); - - return ((st->pwr_down_mode >> (chan->channel * 2)) & 0x3) - 1; -} - -static int ad5686_set_powerdown_mode(struct iio_dev *indio_dev, - const struct iio_chan_spec *chan, unsigned int mode) -{ - struct ad5686_state *st = iio_priv(indio_dev); - - st->pwr_down_mode &= ~(0x3 << (chan->channel * 2)); - st->pwr_down_mode |= ((mode + 1) << (chan->channel * 2)); - - return 0; -} - -static const struct iio_enum ad5686_powerdown_mode_enum = { - .items = ad5686_powerdown_modes, - .num_items = ARRAY_SIZE(ad5686_powerdown_modes), - .get = ad5686_get_powerdown_mode, - .set = ad5686_set_powerdown_mode, -}; - -static ssize_t ad5686_read_dac_powerdown(struct iio_dev *indio_dev, - uintptr_t private, const struct iio_chan_spec *chan, char *buf) -{ - struct ad5686_state *st = iio_priv(indio_dev); - - return sprintf(buf, "%d\n", !!(st->pwr_down_mask & - (0x3 << (chan->channel * 2)))); -} - -static ssize_t ad5686_write_dac_powerdown(struct iio_dev *indio_dev, - uintptr_t private, const struct iio_chan_spec *chan, const char *buf, - size_t len) -{ - bool readin; - int ret; - struct ad5686_state *st = iio_priv(indio_dev); - - ret = strtobool(buf, &readin); - if (ret) - return ret; - - if (readin == true) - st->pwr_down_mask |= (0x3 << (chan->channel * 2)); - else - st->pwr_down_mask &= ~(0x3 << (chan->channel * 2)); - - ret = ad5686_spi_write(st, AD5686_CMD_POWERDOWN_DAC, 0, - st->pwr_down_mask & st->pwr_down_mode, 0); - - return ret ? ret : len; -} - -static int ad5686_read_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, - int *val, - int *val2, - long m) -{ - struct ad5686_state *st = iio_priv(indio_dev); - unsigned long scale_uv; - int ret; - - switch (m) { - case IIO_CHAN_INFO_RAW: - mutex_lock(&indio_dev->mlock); - ret = ad5686_spi_read(st, chan->address); - mutex_unlock(&indio_dev->mlock); - if (ret < 0) - return ret; - *val = ret; - return IIO_VAL_INT; - break; - case IIO_CHAN_INFO_SCALE: - scale_uv = (st->vref_mv * 100000) - >> (chan->scan_type.realbits); - *val = scale_uv / 100000; - *val2 = (scale_uv % 100000) * 10; - return IIO_VAL_INT_PLUS_MICRO; - - } - return -EINVAL; -} - -static int ad5686_write_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, - int val, - int val2, - long mask) -{ - struct ad5686_state *st = iio_priv(indio_dev); - int ret; - - switch (mask) { - case IIO_CHAN_INFO_RAW: - if (val > (1 << chan->scan_type.realbits) || val < 0) - return -EINVAL; - - mutex_lock(&indio_dev->mlock); - ret = ad5686_spi_write(st, - AD5686_CMD_WRITE_INPUT_N_UPDATE_N, - chan->address, - val, - chan->scan_type.shift); - mutex_unlock(&indio_dev->mlock); - break; - default: - ret = -EINVAL; - } - - return ret; -} - -static const struct iio_info ad5686_info = { - .read_raw = ad5686_read_raw, - .write_raw = ad5686_write_raw, - .driver_module = THIS_MODULE, -}; - -static const struct iio_chan_spec_ext_info ad5686_ext_info[] = { - { - .name = "powerdown", - .read = ad5686_read_dac_powerdown, - .write = ad5686_write_dac_powerdown, - }, - IIO_ENUM("powerdown_mode", false, &ad5686_powerdown_mode_enum), - IIO_ENUM_AVAILABLE("powerdown_mode", &ad5686_powerdown_mode_enum), - { }, -}; - -#define AD5868_CHANNEL(chan, bits, shift) { \ - .type = IIO_VOLTAGE, \ - .indexed = 1, \ - .output = 1, \ - .channel = chan, \ - .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ - IIO_CHAN_INFO_SCALE_SHARED_BIT, \ - .address = AD5686_ADDR_DAC(chan), \ - .scan_type = IIO_ST('u', bits, 16, shift), \ - .ext_info = ad5686_ext_info, \ -} - -static const struct ad5686_chip_info ad5686_chip_info_tbl[] = { - [ID_AD5684] = { - .channel[0] = AD5868_CHANNEL(0, 12, 4), - .channel[1] = AD5868_CHANNEL(1, 12, 4), - .channel[2] = AD5868_CHANNEL(2, 12, 4), - .channel[3] = AD5868_CHANNEL(3, 12, 4), - .int_vref_mv = 2500, - }, - [ID_AD5685] = { - .channel[0] = AD5868_CHANNEL(0, 14, 2), - .channel[1] = AD5868_CHANNEL(1, 14, 2), - .channel[2] = AD5868_CHANNEL(2, 14, 2), - .channel[3] = AD5868_CHANNEL(3, 14, 2), - .int_vref_mv = 2500, - }, - [ID_AD5686] = { - .channel[0] = AD5868_CHANNEL(0, 16, 0), - .channel[1] = AD5868_CHANNEL(1, 16, 0), - .channel[2] = AD5868_CHANNEL(2, 16, 0), - .channel[3] = AD5868_CHANNEL(3, 16, 0), - .int_vref_mv = 2500, - }, -}; - - -static int __devinit ad5686_probe(struct spi_device *spi) -{ - struct ad5686_state *st; - struct iio_dev *indio_dev; - int ret, regdone = 0, voltage_uv = 0; - - indio_dev = iio_device_alloc(sizeof(*st)); - if (indio_dev == NULL) - return -ENOMEM; - - st = iio_priv(indio_dev); - spi_set_drvdata(spi, indio_dev); - - st->reg = regulator_get(&spi->dev, "vcc"); - if (!IS_ERR(st->reg)) { - ret = regulator_enable(st->reg); - if (ret) - goto error_put_reg; - - voltage_uv = regulator_get_voltage(st->reg); - } - - st->chip_info = - &ad5686_chip_info_tbl[spi_get_device_id(spi)->driver_data]; - - if (voltage_uv) - st->vref_mv = voltage_uv / 1000; - else - st->vref_mv = st->chip_info->int_vref_mv; - - st->spi = spi; - - /* Set all the power down mode for all channels to 1K pulldown */ - st->pwr_down_mode = 0x55; - - indio_dev->dev.parent = &spi->dev; - indio_dev->name = spi_get_device_id(spi)->name; - indio_dev->info = &ad5686_info; - indio_dev->modes = INDIO_DIRECT_MODE; - indio_dev->channels = st->chip_info->channel; - indio_dev->num_channels = AD5686_DAC_CHANNELS; - - regdone = 1; - ret = ad5686_spi_write(st, AD5686_CMD_INTERNAL_REFER_SETUP, 0, - !!voltage_uv, 0); - if (ret) - goto error_disable_reg; - - ret = iio_device_register(indio_dev); - if (ret) - goto error_disable_reg; - - return 0; - -error_disable_reg: - if (!IS_ERR(st->reg)) - regulator_disable(st->reg); -error_put_reg: - if (!IS_ERR(st->reg)) - regulator_put(st->reg); - - iio_device_free(indio_dev); - - return ret; -} - -static int __devexit ad5686_remove(struct spi_device *spi) -{ - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad5686_state *st = iio_priv(indio_dev); - - iio_device_unregister(indio_dev); - if (!IS_ERR(st->reg)) { - regulator_disable(st->reg); - regulator_put(st->reg); - } - iio_device_free(indio_dev); - - return 0; -} - -static const struct spi_device_id ad5686_id[] = { - {"ad5684", ID_AD5684}, - {"ad5685", ID_AD5685}, - {"ad5686", ID_AD5686}, - {} -}; -MODULE_DEVICE_TABLE(spi, ad5686_id); - -static struct spi_driver ad5686_driver = { - .driver = { - .name = "ad5686", - .owner = THIS_MODULE, - }, - .probe = ad5686_probe, - .remove = __devexit_p(ad5686_remove), - .id_table = ad5686_id, -}; -module_spi_driver(ad5686_driver); - -MODULE_AUTHOR("Michael Hennerich "); -MODULE_DESCRIPTION("Analog Devices AD5686/85/84 DAC"); -MODULE_LICENSE("GPL v2"); diff --git a/drivers/staging/iio/dac/ad5764.c b/drivers/staging/iio/dac/ad5764.c deleted file mode 100644 index ffce304..0000000 --- a/drivers/staging/iio/dac/ad5764.c +++ /dev/null @@ -1,382 +0,0 @@ -/* - * Analog devices AD5764, AD5764R, AD5744, AD5744R quad-channel - * Digital to Analog Converters driver - * - * Copyright 2011 Analog Devices Inc. - * - * Licensed under the GPL-2. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#define AD5764_REG_SF_NOP 0x0 -#define AD5764_REG_SF_CONFIG 0x1 -#define AD5764_REG_SF_CLEAR 0x4 -#define AD5764_REG_SF_LOAD 0x5 -#define AD5764_REG_DATA(x) ((2 << 3) | (x)) -#define AD5764_REG_COARSE_GAIN(x) ((3 << 3) | (x)) -#define AD5764_REG_FINE_GAIN(x) ((4 << 3) | (x)) -#define AD5764_REG_OFFSET(x) ((5 << 3) | (x)) - -#define AD5764_NUM_CHANNELS 4 - -/** - * struct ad5764_chip_info - chip specific information - * @int_vref: Value of the internal reference voltage in uV - 0 if external - * reference voltage is used - * @channel channel specification -*/ - -struct ad5764_chip_info { - unsigned long int_vref; - const struct iio_chan_spec *channels; -}; - -/** - * struct ad5764_state - driver instance specific data - * @spi: spi_device - * @chip_info: chip info - * @vref_reg: vref supply regulators - * @data: spi transfer buffers - */ - -struct ad5764_state { - struct spi_device *spi; - const struct ad5764_chip_info *chip_info; - struct regulator_bulk_data vref_reg[2]; - - /* - * DMA (thus cache coherency maintenance) requires the - * transfer buffers to live in their own cache lines. - */ - union { - __be32 d32; - u8 d8[4]; - } data[2] ____cacheline_aligned; -}; - -enum ad5764_type { - ID_AD5744, - ID_AD5744R, - ID_AD5764, - ID_AD5764R, -}; - -#define AD5764_CHANNEL(_chan, _bits) { \ - .type = IIO_VOLTAGE, \ - .indexed = 1, \ - .output = 1, \ - .channel = (_chan), \ - .address = (_chan), \ - .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ - IIO_CHAN_INFO_OFFSET_SHARED_BIT | \ - IIO_CHAN_INFO_SCALE_SEPARATE_BIT | \ - IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT | \ - IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT, \ - .scan_type = IIO_ST('u', (_bits), 16, 16 - (_bits)) \ -} - -#define DECLARE_AD5764_CHANNELS(_name, _bits) \ -const struct iio_chan_spec _name##_channels[] = { \ - AD5764_CHANNEL(0, (_bits)), \ - AD5764_CHANNEL(1, (_bits)), \ - AD5764_CHANNEL(2, (_bits)), \ - AD5764_CHANNEL(3, (_bits)), \ -}; - -static DECLARE_AD5764_CHANNELS(ad5764, 16); -static DECLARE_AD5764_CHANNELS(ad5744, 14); - -static const struct ad5764_chip_info ad5764_chip_infos[] = { - [ID_AD5744] = { - .int_vref = 0, - .channels = ad5744_channels, - }, - [ID_AD5744R] = { - .int_vref = 5000000, - .channels = ad5744_channels, - }, - [ID_AD5764] = { - .int_vref = 0, - .channels = ad5764_channels, - }, - [ID_AD5764R] = { - .int_vref = 5000000, - .channels = ad5764_channels, - }, -}; - -static int ad5764_write(struct iio_dev *indio_dev, unsigned int reg, - unsigned int val) -{ - struct ad5764_state *st = iio_priv(indio_dev); - int ret; - - mutex_lock(&indio_dev->mlock); - st->data[0].d32 = cpu_to_be32((reg << 16) | val); - - ret = spi_write(st->spi, &st->data[0].d8[1], 3); - mutex_unlock(&indio_dev->mlock); - - return ret; -} - -static int ad5764_read(struct iio_dev *indio_dev, unsigned int reg, - unsigned int *val) -{ - struct ad5764_state *st = iio_priv(indio_dev); - struct spi_message m; - int ret; - struct spi_transfer t[] = { - { - .tx_buf = &st->data[0].d8[1], - .len = 3, - .cs_change = 1, - }, { - .rx_buf = &st->data[1].d8[1], - .len = 3, - }, - }; - - spi_message_init(&m); - spi_message_add_tail(&t[0], &m); - spi_message_add_tail(&t[1], &m); - - mutex_lock(&indio_dev->mlock); - - st->data[0].d32 = cpu_to_be32((1 << 23) | (reg << 16)); - - ret = spi_sync(st->spi, &m); - if (ret >= 0) - *val = be32_to_cpu(st->data[1].d32) & 0xffff; - - mutex_unlock(&indio_dev->mlock); - - return ret; -} - -static int ad5764_chan_info_to_reg(struct iio_chan_spec const *chan, long info) -{ - switch (info) { - case 0: - return AD5764_REG_DATA(chan->address); - case IIO_CHAN_INFO_CALIBBIAS: - return AD5764_REG_OFFSET(chan->address); - case IIO_CHAN_INFO_CALIBSCALE: - return AD5764_REG_FINE_GAIN(chan->address); - default: - break; - } - - return 0; -} - -static int ad5764_write_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, int val, int val2, long info) -{ - const int max_val = (1 << chan->scan_type.realbits); - unsigned int reg; - - switch (info) { - case IIO_CHAN_INFO_RAW: - if (val >= max_val || val < 0) - return -EINVAL; - val <<= chan->scan_type.shift; - break; - case IIO_CHAN_INFO_CALIBBIAS: - if (val >= 128 || val < -128) - return -EINVAL; - break; - case IIO_CHAN_INFO_CALIBSCALE: - if (val >= 32 || val < -32) - return -EINVAL; - break; - default: - return -EINVAL; - } - - reg = ad5764_chan_info_to_reg(chan, info); - return ad5764_write(indio_dev, reg, (u16)val); -} - -static int ad5764_get_channel_vref(struct ad5764_state *st, - unsigned int channel) -{ - if (st->chip_info->int_vref) - return st->chip_info->int_vref; - else - return regulator_get_voltage(st->vref_reg[channel / 2].consumer); -} - -static int ad5764_read_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, int *val, int *val2, long info) -{ - struct ad5764_state *st = iio_priv(indio_dev); - unsigned long scale_uv; - unsigned int reg; - int vref; - int ret; - - switch (info) { - case IIO_CHAN_INFO_RAW: - reg = AD5764_REG_DATA(chan->address); - ret = ad5764_read(indio_dev, reg, val); - if (ret < 0) - return ret; - *val >>= chan->scan_type.shift; - return IIO_VAL_INT; - case IIO_CHAN_INFO_CALIBBIAS: - reg = AD5764_REG_OFFSET(chan->address); - ret = ad5764_read(indio_dev, reg, val); - if (ret < 0) - return ret; - *val = sign_extend32(*val, 7); - return IIO_VAL_INT; - case IIO_CHAN_INFO_CALIBSCALE: - reg = AD5764_REG_FINE_GAIN(chan->address); - ret = ad5764_read(indio_dev, reg, val); - if (ret < 0) - return ret; - *val = sign_extend32(*val, 5); - return IIO_VAL_INT; - case IIO_CHAN_INFO_SCALE: - /* vout = 4 * vref + ((dac_code / 65535) - 0.5) */ - vref = ad5764_get_channel_vref(st, chan->channel); - if (vref < 0) - return vref; - - scale_uv = (vref * 4 * 100) >> chan->scan_type.realbits; - *val = scale_uv / 100000; - *val2 = (scale_uv % 100000) * 10; - return IIO_VAL_INT_PLUS_MICRO; - case IIO_CHAN_INFO_OFFSET: - *val = -(1 << chan->scan_type.realbits) / 2; - return IIO_VAL_INT; - } - - return -EINVAL; -} - -static const struct iio_info ad5764_info = { - .read_raw = ad5764_read_raw, - .write_raw = ad5764_write_raw, - .driver_module = THIS_MODULE, -}; - -static int __devinit ad5764_probe(struct spi_device *spi) -{ - enum ad5764_type type = spi_get_device_id(spi)->driver_data; - struct iio_dev *indio_dev; - struct ad5764_state *st; - int ret; - - indio_dev = iio_device_alloc(sizeof(*st)); - if (indio_dev == NULL) { - dev_err(&spi->dev, "Failed to allocate iio device\n"); - return -ENOMEM; - } - - st = iio_priv(indio_dev); - spi_set_drvdata(spi, indio_dev); - - st->spi = spi; - st->chip_info = &ad5764_chip_infos[type]; - - indio_dev->dev.parent = &spi->dev; - indio_dev->name = spi_get_device_id(spi)->name; - indio_dev->info = &ad5764_info; - indio_dev->modes = INDIO_DIRECT_MODE; - indio_dev->num_channels = AD5764_NUM_CHANNELS; - indio_dev->channels = st->chip_info->channels; - - if (st->chip_info->int_vref == 0) { - st->vref_reg[0].supply = "vrefAB"; - st->vref_reg[1].supply = "vrefCD"; - - ret = regulator_bulk_get(&st->spi->dev, - ARRAY_SIZE(st->vref_reg), st->vref_reg); - if (ret) { - dev_err(&spi->dev, "Failed to request vref regulators: %d\n", - ret); - goto error_free; - } - - ret = regulator_bulk_enable(ARRAY_SIZE(st->vref_reg), - st->vref_reg); - if (ret) { - dev_err(&spi->dev, "Failed to enable vref regulators: %d\n", - ret); - goto error_free_reg; - } - } - - ret = iio_device_register(indio_dev); - if (ret) { - dev_err(&spi->dev, "Failed to register iio device: %d\n", ret); - goto error_disable_reg; - } - - return 0; - -error_disable_reg: - if (st->chip_info->int_vref == 0) - regulator_bulk_disable(ARRAY_SIZE(st->vref_reg), st->vref_reg); -error_free_reg: - if (st->chip_info->int_vref == 0) - regulator_bulk_free(ARRAY_SIZE(st->vref_reg), st->vref_reg); -error_free: - iio_device_free(indio_dev); - - return ret; -} - -static int __devexit ad5764_remove(struct spi_device *spi) -{ - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad5764_state *st = iio_priv(indio_dev); - - iio_device_unregister(indio_dev); - - if (st->chip_info->int_vref == 0) { - regulator_bulk_disable(ARRAY_SIZE(st->vref_reg), st->vref_reg); - regulator_bulk_free(ARRAY_SIZE(st->vref_reg), st->vref_reg); - } - - iio_device_free(indio_dev); - - return 0; -} - -static const struct spi_device_id ad5764_ids[] = { - { "ad5744", ID_AD5744 }, - { "ad5744r", ID_AD5744R }, - { "ad5764", ID_AD5764 }, - { "ad5764r", ID_AD5764R }, - { } -}; -MODULE_DEVICE_TABLE(spi, ad5764_ids); - -static struct spi_driver ad5764_driver = { - .driver = { - .name = "ad5764", - .owner = THIS_MODULE, - }, - .probe = ad5764_probe, - .remove = __devexit_p(ad5764_remove), - .id_table = ad5764_ids, -}; -module_spi_driver(ad5764_driver); - -MODULE_AUTHOR("Lars-Peter Clausen "); -MODULE_DESCRIPTION("Analog Devices AD5744/AD5744R/AD5764/AD5764R DAC"); -MODULE_LICENSE("GPL v2"); diff --git a/drivers/staging/iio/dac/ad5791.c b/drivers/staging/iio/dac/ad5791.c deleted file mode 100644 index 5de28c2..0000000 --- a/drivers/staging/iio/dac/ad5791.c +++ /dev/null @@ -1,486 +0,0 @@ -/* - * AD5760, AD5780, AD5781, AD5790, AD5791 Voltage Output Digital to Analog - * Converter - * - * Copyright 2011 Analog Devices Inc. - * - * Licensed under the GPL-2. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "ad5791.h" - -#define AD5791_RES_MASK(x) ((1 << (x)) - 1) -#define AD5791_DAC_MASK AD5791_RES_MASK(20) -#define AD5791_DAC_MSB (1 << 19) - -#define AD5791_CMD_READ (1 << 23) -#define AD5791_CMD_WRITE (0 << 23) -#define AD5791_ADDR(addr) ((addr) << 20) - -/* Registers */ -#define AD5791_ADDR_NOOP 0 -#define AD5791_ADDR_DAC0 1 -#define AD5791_ADDR_CTRL 2 -#define AD5791_ADDR_CLRCODE 3 -#define AD5791_ADDR_SW_CTRL 4 - -/* Control Register */ -#define AD5791_CTRL_RBUF (1 << 1) -#define AD5791_CTRL_OPGND (1 << 2) -#define AD5791_CTRL_DACTRI (1 << 3) -#define AD5791_CTRL_BIN2SC (1 << 4) -#define AD5791_CTRL_SDODIS (1 << 5) -#define AD5761_CTRL_LINCOMP(x) ((x) << 6) - -#define AD5791_LINCOMP_0_10 0 -#define AD5791_LINCOMP_10_12 1 -#define AD5791_LINCOMP_12_16 2 -#define AD5791_LINCOMP_16_19 3 -#define AD5791_LINCOMP_19_20 12 - -#define AD5780_LINCOMP_0_10 0 -#define AD5780_LINCOMP_10_20 12 - -/* Software Control Register */ -#define AD5791_SWCTRL_LDAC (1 << 0) -#define AD5791_SWCTRL_CLR (1 << 1) -#define AD5791_SWCTRL_RESET (1 << 2) - -#define AD5791_DAC_PWRDN_6K 0 -#define AD5791_DAC_PWRDN_3STATE 1 - -/** - * struct ad5791_chip_info - chip specific information - * @get_lin_comp: function pointer to the device specific function - */ - -struct ad5791_chip_info { - int (*get_lin_comp) (unsigned int span); -}; - -/** - * struct ad5791_state - driver instance specific data - * @us: spi_device - * @reg_vdd: positive supply regulator - * @reg_vss: negative supply regulator - * @chip_info: chip model specific constants - * @vref_mv: actual reference voltage used - * @vref_neg_mv: voltage of the negative supply - * @pwr_down_mode current power down mode - */ - -struct ad5791_state { - struct spi_device *spi; - struct regulator *reg_vdd; - struct regulator *reg_vss; - const struct ad5791_chip_info *chip_info; - unsigned short vref_mv; - unsigned int vref_neg_mv; - unsigned ctrl; - unsigned pwr_down_mode; - bool pwr_down; -}; - -/** - * ad5791_supported_device_ids: - */ - -enum ad5791_supported_device_ids { - ID_AD5760, - ID_AD5780, - ID_AD5781, - ID_AD5791, -}; - -static int ad5791_spi_write(struct spi_device *spi, u8 addr, u32 val) -{ - union { - u32 d32; - u8 d8[4]; - } data; - - data.d32 = cpu_to_be32(AD5791_CMD_WRITE | - AD5791_ADDR(addr) | - (val & AD5791_DAC_MASK)); - - return spi_write(spi, &data.d8[1], 3); -} - -static int ad5791_spi_read(struct spi_device *spi, u8 addr, u32 *val) -{ - union { - u32 d32; - u8 d8[4]; - } data[3]; - int ret; - struct spi_message msg; - struct spi_transfer xfers[] = { - { - .tx_buf = &data[0].d8[1], - .bits_per_word = 8, - .len = 3, - .cs_change = 1, - }, { - .tx_buf = &data[1].d8[1], - .rx_buf = &data[2].d8[1], - .bits_per_word = 8, - .len = 3, - }, - }; - - data[0].d32 = cpu_to_be32(AD5791_CMD_READ | - AD5791_ADDR(addr)); - data[1].d32 = cpu_to_be32(AD5791_ADDR(AD5791_ADDR_NOOP)); - - spi_message_init(&msg); - spi_message_add_tail(&xfers[0], &msg); - spi_message_add_tail(&xfers[1], &msg); - ret = spi_sync(spi, &msg); - - *val = be32_to_cpu(data[2].d32); - - return ret; -} - -static const char * const ad5791_powerdown_modes[] = { - "6kohm_to_gnd", - "three_state", -}; - -static int ad5791_get_powerdown_mode(struct iio_dev *indio_dev, - const struct iio_chan_spec *chan) -{ - struct ad5791_state *st = iio_priv(indio_dev); - - return st->pwr_down_mode; -} - -static int ad5791_set_powerdown_mode(struct iio_dev *indio_dev, - const struct iio_chan_spec *chan, unsigned int mode) -{ - struct ad5791_state *st = iio_priv(indio_dev); - - st->pwr_down_mode = mode; - - return 0; -} - -static const struct iio_enum ad5791_powerdown_mode_enum = { - .items = ad5791_powerdown_modes, - .num_items = ARRAY_SIZE(ad5791_powerdown_modes), - .get = ad5791_get_powerdown_mode, - .set = ad5791_set_powerdown_mode, -}; - -static ssize_t ad5791_read_dac_powerdown(struct iio_dev *indio_dev, - uintptr_t private, const struct iio_chan_spec *chan, char *buf) -{ - struct ad5791_state *st = iio_priv(indio_dev); - - return sprintf(buf, "%d\n", st->pwr_down); -} - -static ssize_t ad5791_write_dac_powerdown(struct iio_dev *indio_dev, - uintptr_t private, const struct iio_chan_spec *chan, const char *buf, - size_t len) -{ - bool pwr_down; - int ret; - struct ad5791_state *st = iio_priv(indio_dev); - - ret = strtobool(buf, &pwr_down); - if (ret) - return ret; - - if (!pwr_down) { - st->ctrl &= ~(AD5791_CTRL_OPGND | AD5791_CTRL_DACTRI); - } else { - if (st->pwr_down_mode == AD5791_DAC_PWRDN_6K) - st->ctrl |= AD5791_CTRL_OPGND; - else if (st->pwr_down_mode == AD5791_DAC_PWRDN_3STATE) - st->ctrl |= AD5791_CTRL_DACTRI; - } - st->pwr_down = pwr_down; - - ret = ad5791_spi_write(st->spi, AD5791_ADDR_CTRL, st->ctrl); - - return ret ? ret : len; -} - -static int ad5791_get_lin_comp(unsigned int span) -{ - if (span <= 10000) - return AD5791_LINCOMP_0_10; - else if (span <= 12000) - return AD5791_LINCOMP_10_12; - else if (span <= 16000) - return AD5791_LINCOMP_12_16; - else if (span <= 19000) - return AD5791_LINCOMP_16_19; - else - return AD5791_LINCOMP_19_20; -} - -static int ad5780_get_lin_comp(unsigned int span) -{ - if (span <= 10000) - return AD5780_LINCOMP_0_10; - else - return AD5780_LINCOMP_10_20; -} -static const struct ad5791_chip_info ad5791_chip_info_tbl[] = { - [ID_AD5760] = { - .get_lin_comp = ad5780_get_lin_comp, - }, - [ID_AD5780] = { - .get_lin_comp = ad5780_get_lin_comp, - }, - [ID_AD5781] = { - .get_lin_comp = ad5791_get_lin_comp, - }, - [ID_AD5791] = { - .get_lin_comp = ad5791_get_lin_comp, - }, -}; - -static int ad5791_read_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, - int *val, - int *val2, - long m) -{ - struct ad5791_state *st = iio_priv(indio_dev); - u64 val64; - int ret; - - switch (m) { - case IIO_CHAN_INFO_RAW: - ret = ad5791_spi_read(st->spi, chan->address, val); - if (ret) - return ret; - *val &= AD5791_DAC_MASK; - *val >>= chan->scan_type.shift; - return IIO_VAL_INT; - case IIO_CHAN_INFO_SCALE: - *val = 0; - *val2 = (((u64)st->vref_mv) * 1000000ULL) >> chan->scan_type.realbits; - return IIO_VAL_INT_PLUS_MICRO; - case IIO_CHAN_INFO_OFFSET: - val64 = (((u64)st->vref_neg_mv) << chan->scan_type.realbits); - do_div(val64, st->vref_mv); - *val = -val64; - return IIO_VAL_INT; - default: - return -EINVAL; - } - -}; - -static const struct iio_chan_spec_ext_info ad5791_ext_info[] = { - { - .name = "powerdown", - .shared = true, - .read = ad5791_read_dac_powerdown, - .write = ad5791_write_dac_powerdown, - }, - IIO_ENUM("powerdown_mode", true, &ad5791_powerdown_mode_enum), - IIO_ENUM_AVAILABLE("powerdown_mode", &ad5791_powerdown_mode_enum), - { }, -}; - -#define AD5791_CHAN(bits, shift) { \ - .type = IIO_VOLTAGE, \ - .output = 1, \ - .indexed = 1, \ - .address = AD5791_ADDR_DAC0, \ - .channel = 0, \ - .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ - IIO_CHAN_INFO_SCALE_SHARED_BIT | \ - IIO_CHAN_INFO_OFFSET_SHARED_BIT, \ - .scan_type = IIO_ST('u', bits, 24, shift), \ - .ext_info = ad5791_ext_info, \ -} - -static const struct iio_chan_spec ad5791_channels[] = { - [ID_AD5760] = AD5791_CHAN(16, 4), - [ID_AD5780] = AD5791_CHAN(18, 2), - [ID_AD5781] = AD5791_CHAN(18, 2), - [ID_AD5791] = AD5791_CHAN(20, 0) -}; - -static int ad5791_write_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, - int val, - int val2, - long mask) -{ - struct ad5791_state *st = iio_priv(indio_dev); - - switch (mask) { - case IIO_CHAN_INFO_RAW: - val &= AD5791_RES_MASK(chan->scan_type.realbits); - val <<= chan->scan_type.shift; - - return ad5791_spi_write(st->spi, chan->address, val); - - default: - return -EINVAL; - } -} - -static const struct iio_info ad5791_info = { - .read_raw = &ad5791_read_raw, - .write_raw = &ad5791_write_raw, - .driver_module = THIS_MODULE, -}; - -static int __devinit ad5791_probe(struct spi_device *spi) -{ - struct ad5791_platform_data *pdata = spi->dev.platform_data; - struct iio_dev *indio_dev; - struct ad5791_state *st; - int ret, pos_voltage_uv = 0, neg_voltage_uv = 0; - - indio_dev = iio_device_alloc(sizeof(*st)); - if (indio_dev == NULL) { - ret = -ENOMEM; - goto error_ret; - } - st = iio_priv(indio_dev); - st->reg_vdd = regulator_get(&spi->dev, "vdd"); - if (!IS_ERR(st->reg_vdd)) { - ret = regulator_enable(st->reg_vdd); - if (ret) - goto error_put_reg_pos; - - pos_voltage_uv = regulator_get_voltage(st->reg_vdd); - } - - st->reg_vss = regulator_get(&spi->dev, "vss"); - if (!IS_ERR(st->reg_vss)) { - ret = regulator_enable(st->reg_vss); - if (ret) - goto error_put_reg_neg; - - neg_voltage_uv = regulator_get_voltage(st->reg_vss); - } - - st->pwr_down = true; - st->spi = spi; - - if (!IS_ERR(st->reg_vss) && !IS_ERR(st->reg_vdd)) { - st->vref_mv = (pos_voltage_uv + neg_voltage_uv) / 1000; - st->vref_neg_mv = neg_voltage_uv / 1000; - } else if (pdata) { - st->vref_mv = pdata->vref_pos_mv + pdata->vref_neg_mv; - st->vref_neg_mv = pdata->vref_neg_mv; - } else { - dev_warn(&spi->dev, "reference voltage unspecified\n"); - } - - ret = ad5791_spi_write(spi, AD5791_ADDR_SW_CTRL, AD5791_SWCTRL_RESET); - if (ret) - goto error_disable_reg_neg; - - st->chip_info = &ad5791_chip_info_tbl[spi_get_device_id(spi) - ->driver_data]; - - - st->ctrl = AD5761_CTRL_LINCOMP(st->chip_info->get_lin_comp(st->vref_mv)) - | ((pdata && pdata->use_rbuf_gain2) ? 0 : AD5791_CTRL_RBUF) | - AD5791_CTRL_BIN2SC; - - ret = ad5791_spi_write(spi, AD5791_ADDR_CTRL, st->ctrl | - AD5791_CTRL_OPGND | AD5791_CTRL_DACTRI); - if (ret) - goto error_disable_reg_neg; - - spi_set_drvdata(spi, indio_dev); - indio_dev->dev.parent = &spi->dev; - indio_dev->info = &ad5791_info; - indio_dev->modes = INDIO_DIRECT_MODE; - indio_dev->channels - = &ad5791_channels[spi_get_device_id(spi)->driver_data]; - indio_dev->num_channels = 1; - indio_dev->name = spi_get_device_id(st->spi)->name; - ret = iio_device_register(indio_dev); - if (ret) - goto error_disable_reg_neg; - - return 0; - -error_disable_reg_neg: - if (!IS_ERR(st->reg_vss)) - regulator_disable(st->reg_vss); -error_put_reg_neg: - if (!IS_ERR(st->reg_vss)) - regulator_put(st->reg_vss); - - if (!IS_ERR(st->reg_vdd)) - regulator_disable(st->reg_vdd); -error_put_reg_pos: - if (!IS_ERR(st->reg_vdd)) - regulator_put(st->reg_vdd); - iio_device_free(indio_dev); -error_ret: - - return ret; -} - -static int __devexit ad5791_remove(struct spi_device *spi) -{ - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad5791_state *st = iio_priv(indio_dev); - - iio_device_unregister(indio_dev); - if (!IS_ERR(st->reg_vdd)) { - regulator_disable(st->reg_vdd); - regulator_put(st->reg_vdd); - } - - if (!IS_ERR(st->reg_vss)) { - regulator_disable(st->reg_vss); - regulator_put(st->reg_vss); - } - iio_device_free(indio_dev); - - return 0; -} - -static const struct spi_device_id ad5791_id[] = { - {"ad5760", ID_AD5760}, - {"ad5780", ID_AD5780}, - {"ad5781", ID_AD5781}, - {"ad5790", ID_AD5791}, - {"ad5791", ID_AD5791}, - {} -}; -MODULE_DEVICE_TABLE(spi, ad5791_id); - -static struct spi_driver ad5791_driver = { - .driver = { - .name = "ad5791", - .owner = THIS_MODULE, - }, - .probe = ad5791_probe, - .remove = __devexit_p(ad5791_remove), - .id_table = ad5791_id, -}; -module_spi_driver(ad5791_driver); - -MODULE_AUTHOR("Michael Hennerich "); -MODULE_DESCRIPTION("Analog Devices AD5760/AD5780/AD5781/AD5790/AD5791 DAC"); -MODULE_LICENSE("GPL v2"); diff --git a/drivers/staging/iio/dac/ad5791.h b/drivers/staging/iio/dac/ad5791.h deleted file mode 100644 index 87a6c92..0000000 --- a/drivers/staging/iio/dac/ad5791.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * AD5791 SPI DAC driver - * - * Copyright 2011 Analog Devices Inc. - * - * Licensed under the GPL-2. - */ - -#ifndef SPI_AD5791_H_ -#define SPI_AD5791_H_ - -/* - * TODO: struct ad5791_platform_data needs to go into include/linux/iio - */ - -/** - * struct ad5791_platform_data - platform specific information - * @vref_pos_mv: Vdd Positive Analog Supply Volatge (mV) - * @vref_neg_mv: Vdd Negative Analog Supply Volatge (mV) - * @use_rbuf_gain2: ext. amplifier connected in gain of two configuration - */ - -struct ad5791_platform_data { - u16 vref_pos_mv; - u16 vref_neg_mv; - bool use_rbuf_gain2; -}; - -#endif /* SPI_AD5791_H_ */ diff --git a/drivers/staging/iio/dac/max517.c b/drivers/staging/iio/dac/max517.c deleted file mode 100644 index 403e06f..0000000 --- a/drivers/staging/iio/dac/max517.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * max517.c - Support for Maxim MAX517, MAX518 and MAX519 - * - * Copyright (C) 2010, 2011 Roland Stigge - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "max517.h" - -#define MAX517_DRV_NAME "max517" - -/* Commands */ -#define COMMAND_CHANNEL0 0x00 -#define COMMAND_CHANNEL1 0x01 /* for MAX518 and MAX519 */ -#define COMMAND_PD 0x08 /* Power Down */ - -enum max517_device_ids { - ID_MAX517, - ID_MAX518, - ID_MAX519, -}; - -struct max517_data { - struct iio_dev *indio_dev; - struct i2c_client *client; - unsigned short vref_mv[2]; -}; - -/* - * channel: bit 0: channel 1 - * bit 1: channel 2 - * (this way, it's possible to set both channels at once) - */ -static int max517_set_value(struct iio_dev *indio_dev, - long val, int channel) -{ - struct max517_data *data = iio_priv(indio_dev); - struct i2c_client *client = data->client; - u8 outbuf[2]; - int res; - - if (val < 0 || val > 255) - return -EINVAL; - - outbuf[0] = channel; - outbuf[1] = val; - - res = i2c_master_send(client, outbuf, 2); - if (res < 0) - return res; - else if (res != 2) - return -EIO; - else - return 0; -} - -static int max517_read_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, - int *val, - int *val2, - long m) -{ - struct max517_data *data = iio_priv(indio_dev); - unsigned int scale_uv; - - switch (m) { - case IIO_CHAN_INFO_SCALE: - /* Corresponds to Vref / 2^(bits) */ - scale_uv = (data->vref_mv[chan->channel] * 1000) >> 8; - *val = scale_uv / 1000000; - *val2 = scale_uv % 1000000; - return IIO_VAL_INT_PLUS_MICRO; - default: - break; - } - return -EINVAL; -} - -static int max517_write_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, int val, int val2, long mask) -{ - int ret; - - switch (mask) { - case IIO_CHAN_INFO_RAW: - ret = max517_set_value(indio_dev, val, chan->channel); - break; - default: - ret = -EINVAL; - break; - } - - return ret; -} - -#ifdef CONFIG_PM_SLEEP -static int max517_suspend(struct device *dev) -{ - u8 outbuf = COMMAND_PD; - - return i2c_master_send(to_i2c_client(dev), &outbuf, 1); -} - -static int max517_resume(struct device *dev) -{ - u8 outbuf = 0; - - return i2c_master_send(to_i2c_client(dev), &outbuf, 1); -} - -static SIMPLE_DEV_PM_OPS(max517_pm_ops, max517_suspend, max517_resume); -#define MAX517_PM_OPS (&max517_pm_ops) -#else -#define MAX517_PM_OPS NULL -#endif - -static const struct iio_info max517_info = { - .read_raw = max517_read_raw, - .write_raw = max517_write_raw, - .driver_module = THIS_MODULE, -}; - -#define MAX517_CHANNEL(chan) { \ - .type = IIO_VOLTAGE, \ - .indexed = 1, \ - .output = 1, \ - .channel = (chan), \ - .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ - IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \ - .scan_type = IIO_ST('u', 8, 8, 0), \ -} - -static const struct iio_chan_spec max517_channels[] = { - MAX517_CHANNEL(0), - MAX517_CHANNEL(1) -}; - -static int max517_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - struct max517_data *data; - struct iio_dev *indio_dev; - struct max517_platform_data *platform_data = client->dev.platform_data; - int err; - - indio_dev = iio_device_alloc(sizeof(*data)); - if (indio_dev == NULL) { - err = -ENOMEM; - goto exit; - } - data = iio_priv(indio_dev); - i2c_set_clientdata(client, indio_dev); - data->client = client; - - /* establish that the iio_dev is a child of the i2c device */ - indio_dev->dev.parent = &client->dev; - - /* reduced channel set for MAX517 */ - if (id->driver_data == ID_MAX517) - indio_dev->num_channels = 1; - else - indio_dev->num_channels = 2; - indio_dev->channels = max517_channels; - indio_dev->modes = INDIO_DIRECT_MODE; - indio_dev->info = &max517_info; - - /* - * Reference voltage on MAX518 and default is 5V, else take vref_mv - * from platform_data - */ - if (id->driver_data == ID_MAX518 || !platform_data) { - data->vref_mv[0] = data->vref_mv[1] = 5000; /* mV */ - } else { - data->vref_mv[0] = platform_data->vref_mv[0]; - data->vref_mv[1] = platform_data->vref_mv[1]; - } - - err = iio_device_register(indio_dev); - if (err) - goto exit_free_device; - - dev_info(&client->dev, "DAC registered\n"); - - return 0; - -exit_free_device: - iio_device_free(indio_dev); -exit: - return err; -} - -static int max517_remove(struct i2c_client *client) -{ - iio_device_unregister(i2c_get_clientdata(client)); - iio_device_free(i2c_get_clientdata(client)); - - return 0; -} - -static const struct i2c_device_id max517_id[] = { - { "max517", ID_MAX517 }, - { "max518", ID_MAX518 }, - { "max519", ID_MAX519 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, max517_id); - -static struct i2c_driver max517_driver = { - .driver = { - .name = MAX517_DRV_NAME, - .pm = MAX517_PM_OPS, - }, - .probe = max517_probe, - .remove = max517_remove, - .id_table = max517_id, -}; -module_i2c_driver(max517_driver); - -MODULE_AUTHOR("Roland Stigge "); -MODULE_DESCRIPTION("MAX517/MAX518/MAX519 8-bit DAC"); -MODULE_LICENSE("GPL"); diff --git a/drivers/staging/iio/dac/max517.h b/drivers/staging/iio/dac/max517.h deleted file mode 100644 index 8106cf2..0000000 --- a/drivers/staging/iio/dac/max517.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * MAX517 DAC driver - * - * Copyright 2011 Roland Stigge - * - * Licensed under the GPL-2 or later. - */ -#ifndef IIO_DAC_MAX517_H_ -#define IIO_DAC_MAX517_H_ - -/* - * TODO: struct max517_platform_data needs to go into include/linux/iio - */ - -struct max517_platform_data { - u16 vref_mv[2]; -}; - -#endif /* IIO_DAC_MAX517_H_ */ diff --git a/include/linux/iio/dac/ad5421.h b/include/linux/iio/dac/ad5421.h new file mode 100644 index 0000000..8fd8f05 --- /dev/null +++ b/include/linux/iio/dac/ad5421.h @@ -0,0 +1,28 @@ +#ifndef __IIO_DAC_AD5421_H__ +#define __IIO_DAC_AD5421_H__ + +/** + * enum ad5421_current_range - Current range the AD5421 is configured for. + * @AD5421_CURRENT_RANGE_4mA_20mA: 4 mA to 20 mA (RANGE1,0 pins = 00) + * @AD5421_CURRENT_RANGE_3mA8_21mA: 3.8 mA to 21 mA (RANGE1,0 pins = x1) + * @AD5421_CURRENT_RANGE_3mA2_24mA: 3.2 mA to 24 mA (RANGE1,0 pins = 10) + */ + +enum ad5421_current_range { + AD5421_CURRENT_RANGE_4mA_20mA, + AD5421_CURRENT_RANGE_3mA8_21mA, + AD5421_CURRENT_RANGE_3mA2_24mA, +}; + +/** + * struct ad5421_platform_data - AD5421 DAC driver platform data + * @external_vref: whether an external reference voltage is used or not + * @current_range: Current range the AD5421 is configured for + */ + +struct ad5421_platform_data { + bool external_vref; + enum ad5421_current_range current_range; +}; + +#endif diff --git a/include/linux/iio/dac/ad5504.h b/include/linux/iio/dac/ad5504.h new file mode 100644 index 0000000..4389537 --- /dev/null +++ b/include/linux/iio/dac/ad5504.h @@ -0,0 +1,16 @@ +/* + * AD5504 SPI DAC driver + * + * Copyright 2011 Analog Devices Inc. + * + * Licensed under the GPL-2. + */ + +#ifndef SPI_AD5504_H_ +#define SPI_AD5504_H_ + +struct ad5504_platform_data { + u16 vref_mv; +}; + +#endif /* SPI_AD5504_H_ */ diff --git a/include/linux/iio/dac/ad5791.h b/include/linux/iio/dac/ad5791.h new file mode 100644 index 0000000..45ee281 --- /dev/null +++ b/include/linux/iio/dac/ad5791.h @@ -0,0 +1,25 @@ +/* + * AD5791 SPI DAC driver + * + * Copyright 2011 Analog Devices Inc. + * + * Licensed under the GPL-2. + */ + +#ifndef SPI_AD5791_H_ +#define SPI_AD5791_H_ + +/** + * struct ad5791_platform_data - platform specific information + * @vref_pos_mv: Vdd Positive Analog Supply Volatge (mV) + * @vref_neg_mv: Vdd Negative Analog Supply Volatge (mV) + * @use_rbuf_gain2: ext. amplifier connected in gain of two configuration + */ + +struct ad5791_platform_data { + u16 vref_pos_mv; + u16 vref_neg_mv; + bool use_rbuf_gain2; +}; + +#endif /* SPI_AD5791_H_ */ diff --git a/include/linux/iio/dac/max517.h b/include/linux/iio/dac/max517.h new file mode 100644 index 0000000..f6d1d25 --- /dev/null +++ b/include/linux/iio/dac/max517.h @@ -0,0 +1,15 @@ +/* + * MAX517 DAC driver + * + * Copyright 2011 Roland Stigge + * + * Licensed under the GPL-2 or later. + */ +#ifndef IIO_DAC_MAX517_H_ +#define IIO_DAC_MAX517_H_ + +struct max517_platform_data { + u16 vref_mv[2]; +}; + +#endif /* IIO_DAC_MAX517_H_ */ -- cgit v0.10.2 From 1079def493b55e7a69e6eefc6e026224e1d90e2a Mon Sep 17 00:00:00 2001 From: Shubhrajyoti D Date: Mon, 4 Jun 2012 15:11:04 +0530 Subject: staging: iio: hmc5843: Make it behave better as modules The memory regions of the probe and remove are move to __devinit and __devexit respectively. Acked-by: Jonathan Cameron Signed-off-by: Shubhrajyoti D Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/magnetometer/hmc5843.c b/drivers/staging/iio/magnetometer/hmc5843.c index c1fa09f..6c3e50f 100644 --- a/drivers/staging/iio/magnetometer/hmc5843.c +++ b/drivers/staging/iio/magnetometer/hmc5843.c @@ -665,7 +665,7 @@ static const struct iio_info hmc5843_info = { .driver_module = THIS_MODULE, }; -static int hmc5843_probe(struct i2c_client *client, +static int __devinit hmc5843_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct hmc5843_data *data; @@ -704,7 +704,7 @@ exit: return err; } -static int hmc5843_remove(struct i2c_client *client) +static int __devexit hmc5843_remove(struct i2c_client *client) { struct iio_dev *indio_dev = i2c_get_clientdata(client); @@ -755,7 +755,7 @@ static struct i2c_driver hmc5843_driver = { }, .id_table = hmc5843_id, .probe = hmc5843_probe, - .remove = hmc5843_remove, + .remove = __devexit_p(hmc5843_remove), .detect = hmc5843_detect, .address_list = normal_i2c, }; -- cgit v0.10.2 From f61343b397975c6360c0f83edebbfdad19baf8f7 Mon Sep 17 00:00:00 2001 From: Shubhrajyoti D Date: Mon, 4 Jun 2012 15:11:05 +0530 Subject: staging: iio: ak8975: Make it behave better as modules The memory regions of the probe and remove are move to __devinit and __devexit respectively. Acked-by: Jonathan Cameron Signed-off-by: Shubhrajyoti D Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/magnetometer/ak8975.c b/drivers/staging/iio/magnetometer/ak8975.c index 5834e4a..7562caf 100644 --- a/drivers/staging/iio/magnetometer/ak8975.c +++ b/drivers/staging/iio/magnetometer/ak8975.c @@ -471,7 +471,7 @@ static const struct iio_info ak8975_info = { .driver_module = THIS_MODULE, }; -static int ak8975_probe(struct i2c_client *client, +static int __devinit ak8975_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct ak8975_data *data; @@ -545,7 +545,7 @@ exit: return err; } -static int ak8975_remove(struct i2c_client *client) +static int __devexit ak8975_remove(struct i2c_client *client) { struct iio_dev *indio_dev = i2c_get_clientdata(client); struct ak8975_data *data = iio_priv(indio_dev); -- cgit v0.10.2 From 7721d652c716af3f4c78a84c380822fdbb148d54 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Mon, 4 Jun 2012 11:44:27 +0530 Subject: Staging: ipack: Remove version.h header file inclusion version.h header file is no longer required. Signed-off-by: Sachin Kamat Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/bridges/tpci200.h b/drivers/staging/ipack/bridges/tpci200.h index 0b547ee..eedb007 100644 --- a/drivers/staging/ipack/bridges/tpci200.h +++ b/drivers/staging/ipack/bridges/tpci200.h @@ -14,7 +14,6 @@ #ifndef _TPCI200_H_ #define _TPCI200_H_ -#include #include #include #include -- cgit v0.10.2 From 862fe87a8bace8b3eb463d117d455d56c5a24488 Mon Sep 17 00:00:00 2001 From: Samuel Iglesias Gonsalvez Date: Wed, 23 May 2012 15:54:40 +0200 Subject: Staging: ipack/bridges/tpci200: delete sysfs files To perform the installation of a mezzanine it was needed to write on these files, now it is not needed at all as the device model is properly implemented. Signed-off-by: Samuel Iglesias Gonsalvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c index ad28707..75ed600 100644 --- a/drivers/staging/ipack/bridges/tpci200.c +++ b/drivers/staging/ipack/bridges/tpci200.c @@ -365,207 +365,9 @@ static irqreturn_t tpci200_interrupt(int irq, void *dev_id) return ret; } -#ifdef CONFIG_SYSFS - -static struct ipack_device *tpci200_slot_register(unsigned int tpci200_number, - unsigned int slot_position) -{ - int found = 0; - struct ipack_device *dev; - struct tpci200_board *tpci200; - - list_for_each_entry(tpci200, &tpci200_list, list) { - if (tpci200->number == tpci200_number) { - found = 1; - break; - } - } - - if (!found) { - pr_err("carrier board not found for the device\n"); - return NULL; - } - - if (slot_position >= TPCI200_NB_SLOT) { - pr_info("Slot [%d:%d] doesn't exist!\n", tpci200_number, - slot_position); - return NULL; - } - - if (mutex_lock_interruptible(&tpci200->mutex)) - return NULL; - - if (tpci200->slots[slot_position].dev != NULL) { - pr_err("Slot [%d:%d] already installed !\n", tpci200_number, - slot_position); - goto err_unlock; - } - - /* - * Give the same IRQ number as the slot number. - * The TPCI200 has assigned his own two IRQ by PCI bus driver - */ - dev = ipack_device_register(tpci200->info->ipack_bus, - slot_position, slot_position); - if (dev == NULL) { - pr_info("Slot [%d:%d] Unable to register an ipack device\n", - tpci200_number, slot_position); - goto err_unlock; - } - - tpci200->slots[slot_position].dev = dev; - mutex_unlock(&tpci200->mutex); - return dev; - -err_unlock: - mutex_unlock(&tpci200->mutex); - return NULL; -} - -static ssize_t tpci200_store_board(struct device *pdev, const char *buf, - size_t count, int slot) -{ - struct tpci200_board *card = dev_get_drvdata(pdev); - struct ipack_device *dev = card->slots[slot].dev; - - if (dev != NULL) - return -EBUSY; - - dev = tpci200_slot_register(card->number, slot); - if (dev == NULL) - return -ENODEV; - - return count; -} - -static ssize_t tpci200_show_board(struct device *pdev, char *buf, int slot) -{ - struct tpci200_board *card = dev_get_drvdata(pdev); - struct ipack_device *dev = card->slots[slot].dev; - - if (dev != NULL) - return snprintf(buf, PAGE_SIZE, "%s\n", dev_name(&dev->dev)); - else - return snprintf(buf, PAGE_SIZE, "none\n"); -} - -static ssize_t tpci200_show_description(struct device *pdev, - struct device_attribute *attr, - char *buf) -{ - return snprintf(buf, PAGE_SIZE, - "TEWS tpci200 carrier PCI for Industry-pack mezzanines.\n"); -} - -static ssize_t tpci200_show_board_slot0(struct device *pdev, - struct device_attribute *attr, - char *buf) -{ - return tpci200_show_board(pdev, buf, 0); -} - -static ssize_t tpci200_store_board_slot0(struct device *pdev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - return tpci200_store_board(pdev, buf, count, 0); -} - -static ssize_t tpci200_show_board_slot1(struct device *pdev, - struct device_attribute *attr, - char *buf) -{ - return tpci200_show_board(pdev, buf, 1); -} - -static ssize_t tpci200_store_board_slot1(struct device *pdev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - return tpci200_store_board(pdev, buf, count, 1); -} - -static ssize_t tpci200_show_board_slot2(struct device *pdev, - struct device_attribute *attr, - char *buf) -{ - return tpci200_show_board(pdev, buf, 2); -} - -static ssize_t tpci200_store_board_slot2(struct device *pdev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - return tpci200_store_board(pdev, buf, count, 2); -} - - -static ssize_t tpci200_show_board_slot3(struct device *pdev, - struct device_attribute *attr, - char *buf) -{ - return tpci200_show_board(pdev, buf, 3); -} - -static ssize_t tpci200_store_board_slot3(struct device *pdev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - return tpci200_store_board(pdev, buf, count, 3); -} - -/* Declaration of the device attributes for the TPCI200 */ -static DEVICE_ATTR(description, S_IRUGO, - tpci200_show_description, NULL); -static DEVICE_ATTR(board_slot0, S_IRUGO | S_IWUSR, - tpci200_show_board_slot0, tpci200_store_board_slot0); -static DEVICE_ATTR(board_slot1, S_IRUGO | S_IWUSR, - tpci200_show_board_slot1, tpci200_store_board_slot1); -static DEVICE_ATTR(board_slot2, S_IRUGO | S_IWUSR, - tpci200_show_board_slot2, tpci200_store_board_slot2); -static DEVICE_ATTR(board_slot3, S_IRUGO | S_IWUSR, - tpci200_show_board_slot3, tpci200_store_board_slot3); - -static struct attribute *tpci200_attrs[] = { - &dev_attr_description.attr, - &dev_attr_board_slot0.attr, - &dev_attr_board_slot1.attr, - &dev_attr_board_slot2.attr, - &dev_attr_board_slot3.attr, - NULL, -}; - -static struct attribute_group tpci200_attr_group = { - .attrs = tpci200_attrs, -}; - -static int tpci200_create_sysfs_files(struct tpci200_board *card) -{ - return sysfs_create_group(&card->info->pdev->dev.kobj, - &tpci200_attr_group); -} - -static void tpci200_remove_sysfs_files(struct tpci200_board *card) -{ - sysfs_remove_group(&card->info->pdev->dev.kobj, &tpci200_attr_group); -} - -#else - -static int tpci200_create_sysfs_files(struct tpci200_board *card) -{ - return 0; -} - -static void tpci200_remove_sysfs_files(struct tpci200_board *card) -{ -} - -#endif /* CONFIG_SYSFS */ - static int tpci200_register(struct tpci200_board *tpci200) { - int i; + int i; int res; unsigned long ioidint_base; unsigned long mem_base; @@ -574,12 +376,6 @@ static int tpci200_register(struct tpci200_board *tpci200) if (pci_enable_device(tpci200->info->pdev) < 0) return -ENODEV; - if (tpci200_create_sysfs_files(tpci200) < 0) { - pr_err("failed creating sysfs files\n"); - res = -EFAULT; - goto out_disable_pci; - } - /* Request IP interface register (Bar 2) */ res = pci_request_region(tpci200->info->pdev, TPCI200_IP_INTERFACE_BAR, "Carrier IP interface registers"); @@ -587,7 +383,7 @@ static int tpci200_register(struct tpci200_board *tpci200) pr_err("(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 2 !", tpci200->info->pdev->bus->number, tpci200->info->pdev->devfn); - goto out_remove_sysfs; + goto out_disable_pci; } /* Request IO ID INT space (Bar 3) */ @@ -668,8 +464,7 @@ static int tpci200_register(struct tpci200_board *tpci200) pr_err("(bn 0x%X, sn 0x%X) unable to register IRQ !", tpci200->info->pdev->bus->number, tpci200->info->pdev->devfn); - tpci200_unregister(tpci200); - goto out_err; + goto out_release_ioid_int_space; } return 0; @@ -678,11 +473,8 @@ out_release_ioid_int_space: pci_release_region(tpci200->info->pdev, TPCI200_IO_ID_INT_SPACES_BAR); out_release_ip_space: pci_release_region(tpci200->info->pdev, TPCI200_IP_INTERFACE_BAR); -out_remove_sysfs: - tpci200_remove_sysfs_files(tpci200); out_disable_pci: pci_disable_device(tpci200->info->pdev); -out_err: return res; } @@ -1038,7 +830,7 @@ out_err: static int tpci200_pciprobe(struct pci_dev *pdev, const struct pci_device_id *id) { - int ret; + int ret, i; struct tpci200_board *tpci200; tpci200 = kzalloc(sizeof(struct tpci200_board), GFP_KERNEL); @@ -1081,13 +873,20 @@ static int tpci200_pciprobe(struct pci_dev *pdev, dev_set_drvdata(&pdev->dev, tpci200); /* add the registered device in an internal linked list */ list_add_tail(&tpci200->list, &tpci200_list); + + /* + * Give the same IRQ number as the slot number. + * The TPCI200 has assigned his own two IRQ by PCI bus driver + */ + for (i = 0; i < TPCI200_NB_SLOT; i++) + tpci200->slots[i].dev = + ipack_device_register(tpci200->info->ipack_bus, i, i); return ret; } static void __tpci200_pci_remove(struct tpci200_board *tpci200) { tpci200_uninstall(tpci200); - tpci200_remove_sysfs_files(tpci200); list_del(&tpci200->list); ipack_bus_unregister(tpci200->info->ipack_bus); kfree(tpci200->info); -- cgit v0.10.2 From be98cc1daa0419f31472c21e45aec30d24fa5931 Mon Sep 17 00:00:00 2001 From: Samuel Iglesias Gonsalvez Date: Wed, 23 May 2012 15:54:41 +0200 Subject: Staging: ipack: return proper value in match() function It should return the same value given by the match function of the ipack_driver that has been called. Returning 0 here, means that the match has failed and it could be succeed. Signed-off-by: Samuel Iglesias Gonsalvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/ipack.c b/drivers/staging/ipack/ipack.c index 2b4fa51..e6dc21a 100644 --- a/drivers/staging/ipack/ipack.c +++ b/drivers/staging/ipack/ipack.c @@ -48,7 +48,7 @@ static int ipack_bus_match(struct device *device, struct device_driver *driver) if (ret) dev->driver = drv; - return 0; + return ret; } static int ipack_bus_probe(struct device *device) -- cgit v0.10.2 From 38f1c53df288b56ad4b8421b13fbdb7232e92270 Mon Sep 17 00:00:00 2001 From: Samuel Iglesias Gonsalvez Date: Wed, 23 May 2012 15:54:42 +0200 Subject: Staging: ipack/bridges/tpci200: tpci200_slot_unmap_space() should return 0 if succeed. tpci200_slot_unmap_space() should return 0 if the operation was properly done. If not, the caller will think that something wrong happened. Signed-off-by: Samuel Iglesias Gonsalvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c index 75ed600..85560c7 100644 --- a/drivers/staging/ipack/bridges/tpci200.c +++ b/drivers/staging/ipack/bridges/tpci200.c @@ -551,20 +551,15 @@ out: static int tpci200_slot_unmap_space(struct ipack_device *dev, int space) { - int res; struct ipack_addr_space *virt_addr_space; struct tpci200_board *tpci200; tpci200 = check_slot(dev); - if (tpci200 == NULL) { - res = -EINVAL; - goto out; - } + if (tpci200 == NULL) + return -EINVAL; - if (mutex_lock_interruptible(&tpci200->mutex)) { - res = -ERESTARTSYS; - goto out; - } + if (mutex_lock_interruptible(&tpci200->mutex)) + return -ERESTARTSYS; switch (space) { case IPACK_IO_SPACE: @@ -594,9 +589,8 @@ static int tpci200_slot_unmap_space(struct ipack_device *dev, int space) default: pr_err("Slot [%d:%d] space number %d doesn't exist !\n", dev->bus_nr, dev->slot, space); - res = -EINVAL; - goto out_unlock; - break; + mutex_unlock(&tpci200->mutex); + return -EINVAL; } iounmap(virt_addr_space->address); @@ -605,8 +599,7 @@ static int tpci200_slot_unmap_space(struct ipack_device *dev, int space) virt_addr_space->size = 0; out_unlock: mutex_unlock(&tpci200->mutex); -out: - return res; + return 0; } static int tpci200_slot_unregister(struct ipack_device *dev) -- cgit v0.10.2 From 6ad0c486a4e702fa059ea24c2585c416f01f4664 Mon Sep 17 00:00:00 2001 From: Samuel Iglesias Gonsalvez Date: Wed, 23 May 2012 15:54:43 +0200 Subject: Staging: ipack/bridges/tpci200: tpci200_slot_map_space() should return 0 if succeed. tpci200_slot_map_space() should return 0 if the operation was properly done. If not, the caller will think that something wrong happened. This patch establish the returned value to 0. It is overwritten in case of error. Signed-off-by: Samuel Iglesias Gonsalvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c index 85560c7..0c2a50a 100644 --- a/drivers/staging/ipack/bridges/tpci200.c +++ b/drivers/staging/ipack/bridges/tpci200.c @@ -628,7 +628,7 @@ static int tpci200_slot_unregister(struct ipack_device *dev) static int tpci200_slot_map_space(struct ipack_device *dev, unsigned int memory_size, int space) { - int res; + int res = 0; unsigned int size_to_map; void __iomem *phys_address; struct ipack_addr_space *virt_addr_space; -- cgit v0.10.2 From 786d986ea25632e3d8e7ad5ac2780861ff2b654f Mon Sep 17 00:00:00 2001 From: Samuel Iglesias Gonsalvez Date: Wed, 23 May 2012 15:54:44 +0200 Subject: Staging: ipack/bridges/tpci200: check if the remove function is available To avoid a dereference of a NULL pointer, the availability of the function is checked before its use. Signed-off-by: Samuel Iglesias Gonsalvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c index 0c2a50a..ee26d9a 100644 --- a/drivers/staging/ipack/bridges/tpci200.c +++ b/drivers/staging/ipack/bridges/tpci200.c @@ -764,6 +764,8 @@ out: static void tpci200_slot_remove(struct tpci200_slot *slot) { if ((slot->dev == NULL) || + (slot->dev->driver == NULL) || + (slot->dev->driver->ops == NULL) || (slot->dev->driver->ops->remove == NULL)) return; -- cgit v0.10.2 From e149ef80b08d92a27a9a8333719fe392955af798 Mon Sep 17 00:00:00 2001 From: Samuel Iglesias Gonsalvez Date: Wed, 23 May 2012 15:54:45 +0200 Subject: Staging: ipack/bridges/tpci200: fix indention. Signed-off-by: Samuel Iglesias Gonsalvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c index ee26d9a..24070a3 100644 --- a/drivers/staging/ipack/bridges/tpci200.c +++ b/drivers/staging/ipack/bridges/tpci200.c @@ -582,7 +582,7 @@ static int tpci200_slot_unmap_space(struct ipack_device *dev, int space) if (dev->mem_space.address == NULL) { pr_info("Slot [%d:%d] MEM space not mapped !\n", dev->bus_nr, dev->slot); - goto out_unlock; + goto out_unlock; } virt_addr_space = &dev->mem_space; break; -- cgit v0.10.2 From 1fc75280f1e48d8f941dfea881d0f5b53fca27f6 Mon Sep 17 00:00:00 2001 From: Samuel Iglesias Gonsalvez Date: Wed, 23 May 2012 15:54:46 +0200 Subject: Staging: ipack/bridges/tpci200: remove name field from slot_irq This field is not needed at all, as the IRQ is registered for the carrier not for the mezzanine. Signed-off-by: Samuel Iglesias Gonsalvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c index 24070a3..96bfe5b 100644 --- a/drivers/staging/ipack/bridges/tpci200.c +++ b/drivers/staging/ipack/bridges/tpci200.c @@ -750,7 +750,6 @@ static int tpci200_request_irq(struct ipack_device *dev, int vector, slot_irq->vector = vector; slot_irq->handler = handler; slot_irq->arg = arg; - slot_irq->name = dev_name(&dev->dev); tpci200->slots[dev->slot].irq = slot_irq; res = __tpci200_request_irq(tpci200, dev); diff --git a/drivers/staging/ipack/bridges/tpci200.h b/drivers/staging/ipack/bridges/tpci200.h index eedb007..97ff0d6 100644 --- a/drivers/staging/ipack/bridges/tpci200.h +++ b/drivers/staging/ipack/bridges/tpci200.h @@ -105,14 +105,12 @@ * @vector Vector number * @handler Handler called when IRQ arrives * @arg Handler argument - * @name IRQ name * */ struct slot_irq { int vector; int (*handler)(void *); void *arg; - const char *name; }; /** -- cgit v0.10.2 From 65260291c13d148a7b7f86f3a99af14c43599fa9 Mon Sep 17 00:00:00 2001 From: Samuel Iglesias Gonsalvez Date: Wed, 23 May 2012 15:54:47 +0200 Subject: Staging: ipack/bridges/tpci200: removed check of tpci200->slots[dev->slot].dev When ipack_device_register() is called, the variable tpci200->slots[dev->slot].dev has not assigned a value and it gives an error when the mezzanine driver is reading a register from the board for the match() function, as all the I/O functions call check_slot(). Signed-off-by: Samuel Iglesias Gonsalvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c index 96bfe5b..6751625 100644 --- a/drivers/staging/ipack/bridges/tpci200.c +++ b/drivers/staging/ipack/bridges/tpci200.c @@ -59,13 +59,6 @@ static struct tpci200_board *check_slot(struct ipack_device *dev) return NULL; } - BUG_ON(tpci200->slots == NULL); - if (tpci200->slots[dev->slot].dev == NULL) { - pr_info("Slot [%d:%d] is not registered !\n", dev->bus_nr, - dev->slot); - return NULL; - } - return tpci200; } -- cgit v0.10.2 From 3b86bb2e11d854d258c5e05d709865ca3d3c8951 Mon Sep 17 00:00:00 2001 From: Samuel Iglesias Gonsalvez Date: Fri, 25 May 2012 10:03:01 +0200 Subject: Staging: ipack: use idr interface for numbering buses Use idr interface to give the bus number. That way, we remove the limitation of 64 buses. The mutex is removed because the ida interface uses spinlocks inside, so it is not needed an extra lock. Signed-off-by: Samuel Iglesias Gonsalvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/ipack.c b/drivers/staging/ipack/ipack.c index e6dc21a..e97be99 100644 --- a/drivers/staging/ipack/ipack.c +++ b/drivers/staging/ipack/ipack.c @@ -12,22 +12,14 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include -#include #include +#include #include "ipack.h" #define to_ipack_dev(device) container_of(device, struct ipack_device, dev) #define to_ipack_driver(drv) container_of(drv, struct ipack_driver, driver) -/* used when allocating bus numbers */ -#define IPACK_MAXBUS 64 - -static DEFINE_MUTEX(ipack_mutex); - -struct ipack_busmap { - unsigned long busmap[IPACK_MAXBUS / (8*sizeof(unsigned long))]; -}; -static struct ipack_busmap busmap; +static DEFINE_IDA(ipack_ida); static void ipack_device_release(struct device *dev) { @@ -79,26 +71,6 @@ static struct bus_type ipack_bus_type = { .remove = ipack_bus_remove, }; -static int ipack_assign_bus_number(void) -{ - int busnum; - - mutex_lock(&ipack_mutex); - busnum = find_next_zero_bit(busmap.busmap, IPACK_MAXBUS, 1); - - if (busnum >= IPACK_MAXBUS) { - pr_err("too many buses\n"); - busnum = -1; - goto error_find_busnum; - } - - set_bit(busnum, busmap.busmap); - -error_find_busnum: - mutex_unlock(&ipack_mutex); - return busnum; -} - struct ipack_bus_device *ipack_bus_register(struct device *parent, int slots, struct ipack_bus_ops *ops) { @@ -109,7 +81,7 @@ struct ipack_bus_device *ipack_bus_register(struct device *parent, int slots, if (!bus) return NULL; - bus_nr = ipack_assign_bus_number(); + bus_nr = ida_simple_get(&ipack_ida, 0, 0, GFP_KERNEL); if (bus_nr < 0) { kfree(bus); return NULL; @@ -125,9 +97,7 @@ EXPORT_SYMBOL_GPL(ipack_bus_register); int ipack_bus_unregister(struct ipack_bus_device *bus) { - mutex_lock(&ipack_mutex); - clear_bit(bus->bus_nr, busmap.busmap); - mutex_unlock(&ipack_mutex); + ida_simple_remove(&ipack_ida, bus->bus_nr); kfree(bus); return 0; } @@ -189,12 +159,14 @@ EXPORT_SYMBOL_GPL(ipack_device_unregister); static int __init ipack_init(void) { + ida_init(&ipack_ida); return bus_register(&ipack_bus_type); } static void __exit ipack_exit(void) { bus_unregister(&ipack_bus_type); + ida_destroy(&ipack_ida); } module_init(ipack_init); -- cgit v0.10.2 From b2bc13c5e07501a0a4427b6a9eff8162aef5560a Mon Sep 17 00:00:00 2001 From: Samuel Iglesias Gonsalvez Date: Fri, 25 May 2012 10:03:02 +0200 Subject: Staging: ipack: delete the call to remove() in ipack_driver_register When a bus driver calls ipack_driver_register(), it should manages the returning NULL value to undo all the operations it did before this call, and print the corresponding trace. It is not a task for the ipack driver to call the remove() function here. Signed-off-by: Samuel Iglesias Gonsalvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/ipack.c b/drivers/staging/ipack/ipack.c index e97be99..a1448e6 100644 --- a/drivers/staging/ipack/ipack.c +++ b/drivers/staging/ipack/ipack.c @@ -141,8 +141,6 @@ struct ipack_device *ipack_device_register(struct ipack_bus_device *bus, ret = device_register(&dev->dev); if (ret < 0) { - pr_err("error registering the device.\n"); - dev->driver->ops->remove(dev); kfree(dev); return NULL; } -- cgit v0.10.2 From 597d473f163a1672262b845ede8a65afdf1b27c6 Mon Sep 17 00:00:00 2001 From: Samuel Iglesias Gonsalvez Date: Fri, 25 May 2012 10:03:03 +0200 Subject: Staging: ipack/devices/ipoctal: avoid kernel oops when uninstalling When uninstalling a device, there is a loop of calls that produces, at the end, two calls to __ipoctal_remove() function with the same ipack_device argument. The first time works fine, but the second will fail in tty_unregister_driver() To avoid this situation, the call to __ipoctal_remove() it is done only from the ipack bus driver and not from the ipack device driver. Signed-off-by: Samuel Iglesias Gonsalvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/devices/ipoctal.c b/drivers/staging/ipack/devices/ipoctal.c index 29f6fa8..a6f424e 100644 --- a/drivers/staging/ipack/devices/ipoctal.c +++ b/drivers/staging/ipack/devices/ipoctal.c @@ -853,11 +853,6 @@ static void __ipoctal_remove(struct ipoctal *ipoctal) tty_unregister_driver(ipoctal->tty_drv); put_tty_driver(ipoctal->tty_drv); - - /* Tell the carrier board to free all the resources for this device */ - if (ipoctal->dev->bus->ops->remove_device != NULL) - ipoctal->dev->bus->ops->remove_device(ipoctal->dev); - list_del(&ipoctal->list); kfree(ipoctal); } @@ -889,7 +884,7 @@ static void __exit ipoctal_exit(void) struct ipoctal *p, *next; list_for_each_entry_safe(p, next, &ipoctal_list, list) - __ipoctal_remove(p); + p->dev->bus->ops->remove_device(p->dev); ipack_driver_unregister(&driver); } -- cgit v0.10.2 From ca2d2bb6618396ec0a79b182fcd1591ef62b07cb Mon Sep 17 00:00:00 2001 From: Samuel Iglesias Gonsalvez Date: Fri, 25 May 2012 10:03:04 +0200 Subject: Staging: ipack/bridges/tpci200: avoid dereference of a freed tpci200->info tpci200->info is used later when uninstalling the module. As there is another kfree in the proper place, this patch removes the wrong one. Signed-off-by: Samuel Iglesias Gonsalvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c index 6751625..e04cb8a 100644 --- a/drivers/staging/ipack/bridges/tpci200.c +++ b/drivers/staging/ipack/bridges/tpci200.c @@ -290,8 +290,6 @@ static void tpci200_unregister(struct tpci200_board *tpci200) pci_disable_device(tpci200->info->pdev); pci_dev_put(tpci200->info->pdev); - kfree(tpci200->info); - for (i = 0; i < TPCI200_NB_SLOT; i++) { tpci200->slots[i].io_phys.address = NULL; tpci200->slots[i].io_phys.size = 0; -- cgit v0.10.2 From 20cf70082440ffabbec5c275726f68fe53872c94 Mon Sep 17 00:00:00 2001 From: Samuel Iglesias Gonsalvez Date: Fri, 25 May 2012 10:03:05 +0200 Subject: Staging: ipack/bridges/tpci200: fix kernel oops when uninstalling a device When uninstalling a device, the call to the ipack_bus_ops remove() frees resources in the ipack device driver but without unregistering the device. It generates a kernel oops when somebody wants to unregister the device. Signed-off-by: Samuel Iglesias Gonsalvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c index e04cb8a..46127bc 100644 --- a/drivers/staging/ipack/bridges/tpci200.c +++ b/drivers/staging/ipack/bridges/tpci200.c @@ -751,23 +751,12 @@ out: return res; } -static void tpci200_slot_remove(struct tpci200_slot *slot) -{ - if ((slot->dev == NULL) || - (slot->dev->driver == NULL) || - (slot->dev->driver->ops == NULL) || - (slot->dev->driver->ops->remove == NULL)) - return; - - slot->dev->driver->ops->remove(slot->dev); -} - static void tpci200_uninstall(struct tpci200_board *tpci200) { int i; for (i = 0; i < TPCI200_NB_SLOT; i++) - tpci200_slot_remove(&tpci200->slots[i]); + tpci200_slot_unregister(tpci200->slots[i].dev); tpci200_unregister(tpci200); kfree(tpci200->slots); -- cgit v0.10.2 From a23d32037073bbc818263ac26077a9981218a0d0 Mon Sep 17 00:00:00 2001 From: Samuel Iglesias Gonsalvez Date: Fri, 25 May 2012 13:08:12 +0200 Subject: Staging: ipack/bridges/tpci200: change pr_* usage for dev_* functions Signed-off-by: Samuel Iglesias Gonsalvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c index 46127bc..c39499a 100644 --- a/drivers/staging/ipack/bridges/tpci200.c +++ b/drivers/staging/ipack/bridges/tpci200.c @@ -11,8 +11,6 @@ * Software Foundation; version 2 of the License. */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - #include #include "tpci200.h" @@ -36,10 +34,8 @@ static struct tpci200_board *check_slot(struct ipack_device *dev) struct tpci200_board *tpci200; int found = 0; - if (dev == NULL) { - pr_info("Slot doesn't exist.\n"); + if (dev == NULL) return NULL; - } list_for_each_entry(tpci200, &tpci200_list, list) { if (tpci200->number == dev->bus_nr) { @@ -49,13 +45,14 @@ static struct tpci200_board *check_slot(struct ipack_device *dev) } if (!found) { - pr_err("Carrier not found\n"); + dev_err(&dev->dev, "Carrier not found\n"); return NULL; } if (dev->slot >= TPCI200_NB_SLOT) { - pr_info("Slot [%d:%d] doesn't exist! Last tpci200 slot is %d.\n", - dev->bus_nr, dev->slot, TPCI200_NB_SLOT-1); + dev_info(&dev->dev, + "Slot [%d:%d] doesn't exist! Last tpci200 slot is %d.\n", + dev->bus_nr, dev->slot, TPCI200_NB_SLOT-1); return NULL; } @@ -116,14 +113,15 @@ static struct ipack_addr_space *get_slot_address_space(struct ipack_device *dev, addr = &dev->mem_space; break; default: - pr_err("Slot [%d:%d] space number %d doesn't exist !\n", - dev->bus_nr, dev->slot, space); + dev_err(&dev->dev, + "Slot [%d:%d] space number %d doesn't exist !\n", + dev->bus_nr, dev->slot, space); return NULL; break; } if ((addr->size == 0) || (addr->address == NULL)) { - pr_err("Error, slot space not mapped !\n"); + dev_err(&dev->dev, "Error, slot space not mapped !\n"); return NULL; } @@ -145,7 +143,7 @@ static int tpci200_read8(struct ipack_device *dev, int space, return -EINVAL; if (offset >= addr->size) { - pr_err("Error, slot space offset error !\n"); + dev_err(&dev->dev, "Error, slot space offset error !\n"); return -EFAULT; } @@ -169,7 +167,7 @@ static int tpci200_read16(struct ipack_device *dev, int space, return -EINVAL; if ((offset+2) >= addr->size) { - pr_err("Error, slot space offset error !\n"); + dev_err(&dev->dev, "Error, slot space offset error !\n"); return -EFAULT; } *value = __tpci200_read16(addr->address, offset); @@ -192,7 +190,7 @@ static int tpci200_read32(struct ipack_device *dev, int space, return -EINVAL; if ((offset+4) >= addr->size) { - pr_err("Error, slot space offset error !\n"); + dev_err(&dev->dev, "Error, slot space offset error !\n"); return -EFAULT; } @@ -216,7 +214,7 @@ static int tpci200_write8(struct ipack_device *dev, int space, return -EINVAL; if (offset >= addr->size) { - pr_err("Error, slot space offset error !\n"); + dev_err(&dev->dev, "Error, slot space offset error !\n"); return -EFAULT; } @@ -240,7 +238,7 @@ static int tpci200_write16(struct ipack_device *dev, int space, return -EINVAL; if ((offset+2) >= addr->size) { - pr_err("Error, slot space offset error !\n"); + dev_err(&dev->dev, "Error, slot space offset error !\n"); return -EFAULT; } @@ -264,7 +262,7 @@ static int tpci200_write32(struct ipack_device *dev, int space, return -EINVAL; if ((offset+4) >= addr->size) { - pr_err("Error, slot space offset error !\n"); + dev_err(&dev->dev, "Error, slot space offset error !\n"); return -EFAULT; } @@ -338,8 +336,9 @@ static irqreturn_t tpci200_interrupt(int irq, void *dev_id) if (unhandled_ints) { for (i = 0; i < TPCI200_NB_SLOT; i++) { if (unhandled_ints & ((TPCI200_INT0_EN | TPCI200_INT1_EN) << (2*i))) { - pr_info("No registered ISR for slot [%d:%d]!. IRQ will be disabled.\n", - tpci200->number, i); + dev_info(&tpci200->slots[i].dev->dev, + "No registered ISR for slot [%d:%d]!. IRQ will be disabled.\n", + tpci200->number, i); reg_value = readw( tpci200->info->interface_regs + control_reg[i]); @@ -371,9 +370,10 @@ static int tpci200_register(struct tpci200_board *tpci200) res = pci_request_region(tpci200->info->pdev, TPCI200_IP_INTERFACE_BAR, "Carrier IP interface registers"); if (res) { - pr_err("(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 2 !", - tpci200->info->pdev->bus->number, - tpci200->info->pdev->devfn); + dev_err(&tpci200->info->pdev->dev, + "(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 2 !", + tpci200->info->pdev->bus->number, + tpci200->info->pdev->devfn); goto out_disable_pci; } @@ -382,9 +382,10 @@ static int tpci200_register(struct tpci200_board *tpci200) TPCI200_IO_ID_INT_SPACES_BAR, "Carrier IO ID INT space"); if (res) { - pr_err("(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 3 !", - tpci200->info->pdev->bus->number, - tpci200->info->pdev->devfn); + dev_err(&tpci200->info->pdev->dev, + "(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 3 !", + tpci200->info->pdev->bus->number, + tpci200->info->pdev->devfn); goto out_release_ip_space; } @@ -392,9 +393,10 @@ static int tpci200_register(struct tpci200_board *tpci200) res = pci_request_region(tpci200->info->pdev, TPCI200_MEM8_SPACE_BAR, "Carrier MEM space"); if (res) { - pr_err("(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 4!", - tpci200->info->pdev->bus->number, - tpci200->info->pdev->devfn); + dev_err(&tpci200->info->pdev->dev, + "(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 4!", + tpci200->info->pdev->bus->number, + tpci200->info->pdev->devfn); goto out_release_ioid_int_space; } @@ -452,9 +454,10 @@ static int tpci200_register(struct tpci200_board *tpci200) tpci200_interrupt, IRQF_SHARED, KBUILD_MODNAME, (void *) tpci200); if (res) { - pr_err("(bn 0x%X, sn 0x%X) unable to register IRQ !", - tpci200->info->pdev->bus->number, - tpci200->info->pdev->devfn); + dev_err(&tpci200->info->pdev->dev, + "(bn 0x%X, sn 0x%X) unable to register IRQ !", + tpci200->info->pdev->bus->number, + tpci200->info->pdev->devfn); goto out_release_ioid_int_space; } @@ -555,31 +558,35 @@ static int tpci200_slot_unmap_space(struct ipack_device *dev, int space) switch (space) { case IPACK_IO_SPACE: if (dev->io_space.address == NULL) { - pr_info("Slot [%d:%d] IO space not mapped !\n", - dev->bus_nr, dev->slot); + dev_info(&dev->dev, + "Slot [%d:%d] IO space not mapped !\n", + dev->bus_nr, dev->slot); goto out_unlock; } virt_addr_space = &dev->io_space; break; case IPACK_ID_SPACE: if (dev->id_space.address == NULL) { - pr_info("Slot [%d:%d] ID space not mapped !\n", - dev->bus_nr, dev->slot); + dev_info(&dev->dev, + "Slot [%d:%d] ID space not mapped !\n", + dev->bus_nr, dev->slot); goto out_unlock; } virt_addr_space = &dev->id_space; break; case IPACK_MEM_SPACE: if (dev->mem_space.address == NULL) { - pr_info("Slot [%d:%d] MEM space not mapped !\n", - dev->bus_nr, dev->slot); + dev_info(&dev->dev, + "Slot [%d:%d] MEM space not mapped !\n", + dev->bus_nr, dev->slot); goto out_unlock; } virt_addr_space = &dev->mem_space; break; default: - pr_err("Slot [%d:%d] space number %d doesn't exist !\n", - dev->bus_nr, dev->slot, space); + dev_err(&dev->dev, + "Slot [%d:%d] space number %d doesn't exist !\n", + dev->bus_nr, dev->slot, space); mutex_unlock(&tpci200->mutex); return -EINVAL; } @@ -639,8 +646,9 @@ static int tpci200_slot_map_space(struct ipack_device *dev, switch (space) { case IPACK_IO_SPACE: if (dev->io_space.address != NULL) { - pr_err("Slot [%d:%d] IO space already mapped !\n", - tpci200->number, dev->slot); + dev_err(&dev->dev, + "Slot [%d:%d] IO space already mapped !\n", + tpci200->number, dev->slot); res = -EINVAL; goto out_unlock; } @@ -651,8 +659,9 @@ static int tpci200_slot_map_space(struct ipack_device *dev, break; case IPACK_ID_SPACE: if (dev->id_space.address != NULL) { - pr_err("Slot [%d:%d] ID space already mapped !\n", - tpci200->number, dev->slot); + dev_err(&dev->dev, + "Slot [%d:%d] ID space already mapped !\n", + tpci200->number, dev->slot); res = -EINVAL; goto out_unlock; } @@ -663,17 +672,19 @@ static int tpci200_slot_map_space(struct ipack_device *dev, break; case IPACK_MEM_SPACE: if (dev->mem_space.address != NULL) { - pr_err("Slot [%d:%d] MEM space already mapped !\n", - tpci200->number, dev->slot); + dev_err(&dev->dev, + "Slot [%d:%d] MEM space already mapped !\n", + tpci200->number, dev->slot); res = -EINVAL; goto out_unlock; } virt_addr_space = &dev->mem_space; if (memory_size > tpci200->slots[dev->slot].mem_phys.size) { - pr_err("Slot [%d:%d] request is 0x%X memory, only 0x%X available !\n", - dev->bus_nr, dev->slot, memory_size, - tpci200->slots[dev->slot].mem_phys.size); + dev_err(&dev->dev, + "Slot [%d:%d] request is 0x%X memory, only 0x%X available !\n", + dev->bus_nr, dev->slot, memory_size, + tpci200->slots[dev->slot].mem_phys.size); res = -EINVAL; goto out_unlock; } @@ -682,8 +693,8 @@ static int tpci200_slot_map_space(struct ipack_device *dev, size_to_map = memory_size; break; default: - pr_err("Slot [%d:%d] space %d doesn't exist !\n", - tpci200->number, dev->slot, space); + dev_err(&dev->dev, "Slot [%d:%d] space %d doesn't exist !\n", + tpci200->number, dev->slot, space); res = -EINVAL; goto out_unlock; break; @@ -718,16 +729,18 @@ static int tpci200_request_irq(struct ipack_device *dev, int vector, } if (tpci200->slots[dev->slot].irq != NULL) { - pr_err("Slot [%d:%d] IRQ already registered !\n", dev->bus_nr, - dev->slot); + dev_err(&dev->dev, + "Slot [%d:%d] IRQ already registered !\n", dev->bus_nr, + dev->slot); res = -EINVAL; goto out_unlock; } slot_irq = kzalloc(sizeof(struct slot_irq), GFP_KERNEL); if (slot_irq == NULL) { - pr_err("Slot [%d:%d] unable to allocate memory for IRQ !\n", - dev->bus_nr, dev->slot); + dev_err(&dev->dev, + "Slot [%d:%d] unable to allocate memory for IRQ !\n", + dev->bus_nr, dev->slot); res = -ENOMEM; goto out_unlock; } @@ -824,7 +837,7 @@ static int tpci200_pciprobe(struct pci_dev *pdev, /* register the device and initialize it */ ret = tpci200_install(tpci200); if (ret) { - pr_err("Error during tpci200 install !\n"); + dev_err(&pdev->dev, "Error during tpci200 install !\n"); kfree(tpci200->info); kfree(tpci200); return -ENODEV; @@ -835,7 +848,8 @@ static int tpci200_pciprobe(struct pci_dev *pdev, TPCI200_NB_SLOT, &tpci200_bus_ops); if (!tpci200->info->ipack_bus) { - pr_err("error registering the carrier on ipack driver\n"); + dev_err(&pdev->dev, + "error registering the carrier on ipack driver\n"); tpci200_uninstall(tpci200); kfree(tpci200->info); kfree(tpci200); -- cgit v0.10.2 From 42b38207c36890ead05ab1c0002714c48b9b996a Mon Sep 17 00:00:00 2001 From: Samuel Iglesias Gonsalvez Date: Fri, 25 May 2012 13:08:13 +0200 Subject: Staging: ipack/devices/ipoctal: change pr_* usage for dev_* functions Signed-off-by: Samuel Iglesias Gonsalvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/devices/ipoctal.c b/drivers/staging/ipack/devices/ipoctal.c index a6f424e..17aa35a 100644 --- a/drivers/staging/ipack/devices/ipoctal.c +++ b/drivers/staging/ipack/devices/ipoctal.c @@ -11,8 +11,6 @@ * Software Foundation; version 2 of the License. */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - #include #include #include @@ -116,7 +114,8 @@ static int ipoctal_port_activate(struct tty_port *port, struct tty_struct *tty) ipoctal = ipoctal_find_board(tty); if (ipoctal == NULL) { - pr_err("Device not found. Major %d\n", tty->driver->major); + dev_err(tty->dev, "Device not found. Major %d\n", + tty->driver->major); return -ENODEV; } @@ -136,7 +135,8 @@ static int ipoctal_open(struct tty_struct *tty, struct file *file) ipoctal = ipoctal_find_board(tty); if (ipoctal == NULL) { - pr_err("Device not found. Major %d\n", tty->driver->major); + dev_err(tty->dev, "Device not found. Major %d\n", + tty->driver->major); return -ENODEV; } @@ -381,7 +381,9 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, res = ipoctal->dev->bus->ops->map_space(ipoctal->dev, 0, IPACK_ID_SPACE); if (res) { - pr_err("Unable to map slot [%d:%d] ID space!\n", bus_nr, slot); + dev_err(&ipoctal->dev->dev, + "Unable to map slot [%d:%d] ID space!\n", + bus_nr, slot); return res; } @@ -396,14 +398,18 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, res = ipoctal->dev->bus->ops->map_space(ipoctal->dev, 0, IPACK_IO_SPACE); if (res) { - pr_err("Unable to map slot [%d:%d] IO space!\n", bus_nr, slot); + dev_err(&ipoctal->dev->dev, + "Unable to map slot [%d:%d] IO space!\n", + bus_nr, slot); goto out_unregister_id_space; } res = ipoctal->dev->bus->ops->map_space(ipoctal->dev, 0x8000, IPACK_MEM_SPACE); if (res) { - pr_err("Unable to map slot [%d:%d] MEM space!\n", bus_nr, slot); + dev_err(&ipoctal->dev->dev, + "Unable to map slot [%d:%d] MEM space!\n", + bus_nr, slot); goto out_unregister_io_space; } @@ -472,7 +478,7 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, tty_set_operations(tty, &ipoctal_fops); res = tty_register_driver(tty); if (res) { - pr_err("Can't register tty driver.\n"); + dev_err(&ipoctal->dev->dev, "Can't register tty driver.\n"); put_tty_driver(tty); goto out_unregister_slot_unmap; } -- cgit v0.10.2 From a21e6bfeb40eddf365d3e7841b37f3708fa6b13f Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Tue, 5 Jun 2012 11:52:18 +0200 Subject: iio: adf4350: fix compiler warning [-Wuninitialized] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit drivers/iio/frequency/adf4350.c:316:32: warning: ‘val’ may be used uninitialized in this function [-Wuninitialized] Signed-off-by: Michael Hennerich Reported-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c index fd4c850..2d09f82 100644 --- a/drivers/iio/frequency/adf4350.c +++ b/drivers/iio/frequency/adf4350.c @@ -310,6 +310,8 @@ static ssize_t adf4350_read(struct iio_dev *indio_dev, case ADF4350_PWRDOWN: val = !!(st->regs[ADF4350_REG2] & ADF4350_REG2_POWER_DOWN_EN); break; + default: + ret = -ENODEV; } mutex_unlock(&indio_dev->mlock); -- cgit v0.10.2 From 74dcd439bf8c16b01f9f5a9dffb2b171ed94e2e5 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Tue, 5 Jun 2012 18:24:12 +0200 Subject: iio: iio_enum_available_read: Prevent possible buffer overflow Use scnprint instead of snprintf, because snprintf returns the number of bytes that would have been written to the buffer if there was enough space, and as a result writing to buf[len-1] might cause a access beyond the buffers limits. Reported-by: Dan Carpenter Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 56a3c0b..cf9ecd0 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -300,7 +300,7 @@ ssize_t iio_enum_available_read(struct iio_dev *indio_dev, return 0; for (i = 0; i < e->num_items; ++i) - len += snprintf(buf + len, PAGE_SIZE - len, "%s ", e->items[i]); + len += scnprintf(buf + len, PAGE_SIZE - len, "%s ", e->items[i]); /* replace last space with a newline */ buf[len - 1] = '\n'; -- cgit v0.10.2 From 040f3e5833b9426aaeead6da8957a9b87f3ca9e8 Mon Sep 17 00:00:00 2001 From: Leed Aguilar Date: Wed, 6 Jun 2012 16:14:56 -0400 Subject: staging:iio:magnetometer:ak8975: set power-down mode after reading fuse ROM data Fuse ROM data access mode is the only mode which does not transition to power-down mode automatically. As per the AK8975 data sheet, it is recomended to set the power-down mode first before attempting to change into another mode. Signed-off-by: Leed Aguilar Acked-by: Laxman Dewangan Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/magnetometer/ak8975.c b/drivers/staging/iio/magnetometer/ak8975.c index 7562caf..001b3bf 100644 --- a/drivers/staging/iio/magnetometer/ak8975.c +++ b/drivers/staging/iio/magnetometer/ak8975.c @@ -194,6 +194,17 @@ static int ak8975_setup(struct i2c_client *client) return ret; } + /* After reading fuse ROM data set power-down mode */ + ret = ak8975_write_data(client, + AK8975_REG_CNTL, + AK8975_REG_CNTL_MODE_POWER_DOWN, + AK8975_REG_CNTL_MODE_MASK, + AK8975_REG_CNTL_MODE_SHIFT); + if (ret < 0) { + dev_err(&client->dev, "Error in setting power-down mode\n"); + return ret; + } + /* * Precalculate scale factor (in Gauss units) for each axis and * store in the device data. -- cgit v0.10.2 From 82f2acdce16ad7f124b6bb38c10a1894aa534864 Mon Sep 17 00:00:00 2001 From: Leed Aguilar Date: Wed, 6 Jun 2012 16:15:40 -0400 Subject: staging:iio:magnetometer:ak8975: use gpio_request_one api Use gpio_request_one api, it looks cleaner. Signed-off-by: Leed Aguilar Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/magnetometer/Kconfig b/drivers/staging/iio/magnetometer/Kconfig index b9d9325..df5e0d4 100644 --- a/drivers/staging/iio/magnetometer/Kconfig +++ b/drivers/staging/iio/magnetometer/Kconfig @@ -6,7 +6,7 @@ menu "Magnetometer sensors" config SENSORS_AK8975 tristate "Asahi Kasei AK8975 3-Axis Magnetometer" depends on I2C - depends on GENERIC_GPIO + depends on GPIOLIB help Say yes here to build support for Asahi Kasei AK8975 3-Axis Magnetometer. diff --git a/drivers/staging/iio/magnetometer/ak8975.c b/drivers/staging/iio/magnetometer/ak8975.c index 001b3bf..11bde3f 100644 --- a/drivers/staging/iio/magnetometer/ak8975.c +++ b/drivers/staging/iio/magnetometer/ak8975.c @@ -499,21 +499,13 @@ static int __devinit ak8975_probe(struct i2c_client *client, /* We may not have a GPIO based IRQ to scan, that is fine, we will poll if so */ if (gpio_is_valid(eoc_gpio)) { - err = gpio_request(eoc_gpio, "ak_8975"); + err = gpio_request_one(eoc_gpio, GPIOF_IN, "ak_8975"); if (err < 0) { dev_err(&client->dev, "failed to request GPIO %d, error %d\n", eoc_gpio, err); goto exit; } - - err = gpio_direction_input(eoc_gpio); - if (err < 0) { - dev_err(&client->dev, - "Failed to configure input direction for GPIO %d, error %d\n", - eoc_gpio, err); - goto exit_gpio; - } } /* Register with IIO */ -- cgit v0.10.2 From 4bf8523df925869d4d27478105f23656a2411ce0 Mon Sep 17 00:00:00 2001 From: Leed Aguilar Date: Wed, 6 Jun 2012 16:16:02 -0400 Subject: staging:iio:magnetometer:ak8975: remove 'mode' attribute The raw data reading process (ak8975_read_axis) sets the single measurement mode to take a sample and once the conversion is completed the device enters into power-down mode automatically, therefore there is no need to enable a flag for this to happen. Signed-off-by: Leed Aguilar Acked-by: Jonathan Cameron Acked-by: Laxman Dewangan Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/magnetometer/ak8975.c b/drivers/staging/iio/magnetometer/ak8975.c index 11bde3f..01b4b07 100644 --- a/drivers/staging/iio/magnetometer/ak8975.c +++ b/drivers/staging/iio/magnetometer/ak8975.c @@ -92,7 +92,6 @@ struct ak8975_data { struct mutex lock; u8 asa[3]; long raw_to_gauss[3]; - bool mode; u8 reg_cache[AK8975_MAX_REGS]; int eoc_gpio; int eoc_irq; @@ -247,60 +246,6 @@ static int ak8975_setup(struct i2c_client *client) return 0; } -/* - * Shows the device's mode. 0 = off, 1 = on. - */ -static ssize_t show_mode(struct device *dev, struct device_attribute *devattr, - char *buf) -{ - struct iio_dev *indio_dev = dev_to_iio_dev(dev); - struct ak8975_data *data = iio_priv(indio_dev); - - return sprintf(buf, "%u\n", data->mode); -} - -/* - * Sets the device's mode. 0 = off, 1 = on. The device's mode must be on - * for the magn raw attributes to be available. - */ -static ssize_t store_mode(struct device *dev, struct device_attribute *devattr, - const char *buf, size_t count) -{ - struct iio_dev *indio_dev = dev_to_iio_dev(dev); - struct ak8975_data *data = iio_priv(indio_dev); - struct i2c_client *client = data->client; - bool value; - int ret; - - /* Convert mode string and do some basic sanity checking on it. - only 0 or 1 are valid. */ - ret = strtobool(buf, &value); - if (ret < 0) - return ret; - - mutex_lock(&data->lock); - - /* Write the mode to the device. */ - if (data->mode != value) { - ret = ak8975_write_data(client, - AK8975_REG_CNTL, - (u8)value, - AK8975_REG_CNTL_MODE_MASK, - AK8975_REG_CNTL_MODE_SHIFT); - - if (ret < 0) { - dev_err(&client->dev, "Error in setting mode\n"); - mutex_unlock(&data->lock); - return ret; - } - data->mode = value; - } - - mutex_unlock(&data->lock); - - return count; -} - static int wait_conversion_complete_gpio(struct ak8975_data *data) { struct i2c_client *client = data->client; @@ -368,12 +313,6 @@ static int ak8975_read_axis(struct iio_dev *indio_dev, int index, int *val) mutex_lock(&data->lock); - if (data->mode == 0) { - dev_err(&client->dev, "Operating mode is in power down mode\n"); - ret = -EBUSY; - goto exit; - } - /* Set up the device for taking a sample. */ ret = ak8975_write_data(client, AK8975_REG_CNTL, @@ -465,19 +404,7 @@ static const struct iio_chan_spec ak8975_channels[] = { AK8975_CHANNEL(X, 0), AK8975_CHANNEL(Y, 1), AK8975_CHANNEL(Z, 2), }; -static IIO_DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, show_mode, store_mode, 0); - -static struct attribute *ak8975_attr[] = { - &iio_dev_attr_mode.dev_attr.attr, - NULL -}; - -static struct attribute_group ak8975_attr_group = { - .attrs = ak8975_attr, -}; - static const struct iio_info ak8975_info = { - .attrs = &ak8975_attr_group, .read_raw = &ak8975_read_raw, .driver_module = THIS_MODULE, }; -- cgit v0.10.2 From 7d3da090cdcf400178b81f851c3721e2bbb9fce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Thu, 7 Jun 2012 11:10:17 +0200 Subject: Staging: ipack/bridges/tpci200: remove gotos in tpci200_free_irq(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Handle error conditions with simple returns instead of usig gotos. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c index c39499a..68bcc55 100644 --- a/drivers/staging/ipack/bridges/tpci200.c +++ b/drivers/staging/ipack/bridges/tpci200.c @@ -512,24 +512,19 @@ static void __tpci200_free_irq(struct tpci200_board *tpci200, static int tpci200_free_irq(struct ipack_device *dev) { - int res; struct slot_irq *slot_irq; struct tpci200_board *tpci200; tpci200 = check_slot(dev); - if (tpci200 == NULL) { - res = -EINVAL; - goto out; - } + if (tpci200 == NULL) + return -EINVAL; - if (mutex_lock_interruptible(&tpci200->mutex)) { - res = -ERESTARTSYS; - goto out; - } + if (mutex_lock_interruptible(&tpci200->mutex)) + return -ERESTARTSYS; if (tpci200->slots[dev->slot].irq == NULL) { - res = -EINVAL; - goto out_unlock; + mutex_unlock(&tpci200->mutex); + return -EINVAL; } __tpci200_free_irq(tpci200, dev); @@ -537,10 +532,8 @@ static int tpci200_free_irq(struct ipack_device *dev) tpci200->slots[dev->slot].irq = NULL; kfree(slot_irq); -out_unlock: mutex_unlock(&tpci200->mutex); -out: - return res; + return 0; } static int tpci200_slot_unmap_space(struct ipack_device *dev, int space) -- cgit v0.10.2 From 5e4be523981c7e63873b0321dee51bd94226fc99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Thu, 7 Jun 2012 10:24:51 +0200 Subject: Staging: ipack/bridges/tpci200: remove "out" label in tpci200_slot_map_space() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the "out" label from tpci200_slot_map_space(), as it can directly return the error code instead of jumping. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c index 68bcc55..7baa28a 100644 --- a/drivers/staging/ipack/bridges/tpci200.c +++ b/drivers/staging/ipack/bridges/tpci200.c @@ -626,15 +626,11 @@ static int tpci200_slot_map_space(struct ipack_device *dev, struct tpci200_board *tpci200; tpci200 = check_slot(dev); - if (tpci200 == NULL) { - res = -EINVAL; - goto out; - } + if (tpci200 == NULL) + return -EINVAL; - if (mutex_lock_interruptible(&tpci200->mutex)) { - res = -ERESTARTSYS; - goto out; - } + if (mutex_lock_interruptible(&tpci200->mutex)) + return -ERESTARTSYS; switch (space) { case IPACK_IO_SPACE: @@ -699,7 +695,6 @@ static int tpci200_slot_map_space(struct ipack_device *dev, out_unlock: mutex_unlock(&tpci200->mutex); -out: return res; } -- cgit v0.10.2 From 14d9f9a3e1f9a962f5cc480dcf2ee72fb16031be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Thu, 7 Jun 2012 10:24:52 +0200 Subject: Staging: ipack/bridges/tpci200: remove useless break in tpci200_slot_map_space() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c index 7baa28a..f354b38 100644 --- a/drivers/staging/ipack/bridges/tpci200.c +++ b/drivers/staging/ipack/bridges/tpci200.c @@ -686,7 +686,6 @@ static int tpci200_slot_map_space(struct ipack_device *dev, tpci200->number, dev->slot, space); res = -EINVAL; goto out_unlock; - break; } virt_addr_space->size = size_to_map; -- cgit v0.10.2 From f7986a9e7341e8f4c69cc36a60e1f778a01471ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Thu, 7 Jun 2012 10:24:53 +0200 Subject: Staging: ipack/bridges/tpci200: remove "out" label in tpci200_request_irq() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the "out" label from tpci200_request_irq(), as it can directly return the error code instead of jumping. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c index f354b38..7616c49 100644 --- a/drivers/staging/ipack/bridges/tpci200.c +++ b/drivers/staging/ipack/bridges/tpci200.c @@ -705,15 +705,11 @@ static int tpci200_request_irq(struct ipack_device *dev, int vector, struct tpci200_board *tpci200; tpci200 = check_slot(dev); - if (tpci200 == NULL) { - res = -EINVAL; - goto out; - } + if (tpci200 == NULL) + return -EINVAL; - if (mutex_lock_interruptible(&tpci200->mutex)) { - res = -ERESTARTSYS; - goto out; - } + if (mutex_lock_interruptible(&tpci200->mutex)) + return -ERESTARTSYS; if (tpci200->slots[dev->slot].irq != NULL) { dev_err(&dev->dev, @@ -747,7 +743,6 @@ static int tpci200_request_irq(struct ipack_device *dev, int vector, out_unlock: mutex_unlock(&tpci200->mutex); -out: return res; } -- cgit v0.10.2 From ec0ceb9e42ca9d7c65c1cbea585d8f5d61db7b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Thu, 7 Jun 2012 10:24:54 +0200 Subject: Staging: ipack/bridges/tpci200: remove gotos in tpci200_install() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the gotos when handling error conditions, as the code gets clearer and the gotos are not really avoiding code replication. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c index 7616c49..e692f1e 100644 --- a/drivers/staging/ipack/bridges/tpci200.c +++ b/drivers/staging/ipack/bridges/tpci200.c @@ -777,23 +777,18 @@ static int tpci200_install(struct tpci200_board *tpci200) tpci200->slots = kzalloc( TPCI200_NB_SLOT * sizeof(struct tpci200_slot), GFP_KERNEL); - if (tpci200->slots == NULL) { - res = -ENOMEM; - goto out_err; - } + if (tpci200->slots == NULL) + return -ENOMEM; res = tpci200_register(tpci200); - if (res) - goto out_free; + if (res) { + kfree(tpci200->slots); + tpci200->slots = NULL; + return res; + } mutex_init(&tpci200->mutex); return 0; - -out_free: - kfree(tpci200->slots); - tpci200->slots = NULL; -out_err: - return res; } static int tpci200_pciprobe(struct pci_dev *pdev, -- cgit v0.10.2 From 8ae7012d3ed3314cc1bf52bd6c51eaa4cc1609a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Thu, 7 Jun 2012 10:24:55 +0200 Subject: Staging: ipack/devices/ipoctal: remove ipoctal_config structure. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The configuration of the communication channel is handled by the tty abstraction, so the ipoctal_config structure has become useless and it's only used to store values that are never accesed. Remove it. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/devices/ipoctal.c b/drivers/staging/ipack/devices/ipoctal.c index 17aa35a..ff88800 100644 --- a/drivers/staging/ipack/devices/ipoctal.c +++ b/drivers/staging/ipack/devices/ipoctal.c @@ -49,7 +49,6 @@ struct ipoctal { char *buffer[NR_CHANNELS]; unsigned int nb_bytes[NR_CHANNELS]; unsigned int count_wr[NR_CHANNELS]; - struct ipoctal_config chan_config[NR_CHANNELS]; wait_queue_head_t queue[NR_CHANNELS]; unsigned short error_flag[NR_CHANNELS]; spinlock_t lock[NR_CHANNELS]; @@ -671,22 +670,18 @@ static void ipoctal_set_termios(struct tty_struct *tty, if (cflag & CRTSCTS) { mr1 |= MR1_RxRTS_CONTROL_ON; mr2 |= MR2_TxRTS_CONTROL_OFF | MR2_CTS_ENABLE_TX_ON; - ipoctal->chan_config[channel].flow_control = 1; } else { mr1 |= MR1_RxRTS_CONTROL_OFF; mr2 |= MR2_TxRTS_CONTROL_OFF | MR2_CTS_ENABLE_TX_OFF; - ipoctal->chan_config[channel].flow_control = 0; } break; case IP_OCTAL_422_ID: mr1 |= MR1_RxRTS_CONTROL_OFF; mr2 |= MR2_TxRTS_CONTROL_OFF | MR2_CTS_ENABLE_TX_OFF; - ipoctal->chan_config[channel].flow_control = 0; break; case IP_OCTAL_485_ID: mr1 |= MR1_RxRTS_CONTROL_OFF; mr2 |= MR2_TxRTS_CONTROL_ON | MR2_CTS_ENABLE_TX_OFF; - ipoctal->chan_config[channel].flow_control = 0; break; default: return; @@ -750,12 +745,6 @@ static void ipoctal_set_termios(struct tty_struct *tty, ipoctal_write_io_reg(ipoctal, &ipoctal->chan_regs[channel].u.w.mr, mr2); ipoctal_write_io_reg(ipoctal, &ipoctal->chan_regs[channel].u.w.csr, csr); - /* save the setup in the structure */ - ipoctal->chan_config[channel].baud = tty_get_baud_rate(tty); - ipoctal->chan_config[channel].bits_per_char = cflag & CSIZE; - ipoctal->chan_config[channel].parity = cflag & PARENB; - ipoctal->chan_config[channel].stop_bits = cflag & CSTOPB; - /* Enable again the RX */ ipoctal_write_io_reg(ipoctal, &ipoctal->chan_regs[channel].u.w.cr, CR_ENABLE_RX); diff --git a/drivers/staging/ipack/devices/ipoctal.h b/drivers/staging/ipack/devices/ipoctal.h index 266f361..b3c901c 100644 --- a/drivers/staging/ipack/devices/ipoctal.h +++ b/drivers/staging/ipack/devices/ipoctal.h @@ -42,23 +42,6 @@ enum uart_error { }; /** - * struct ipoctal_config - Serial configuration - * - * @baud: Baud rate - * @stop_bits: Stop bits (1 or 2) - * @bits_per_char: data size in bits - * @parity - * @flow_control: Flow control management (RTS/CTS) (0 disabled, 1 enabled) - */ -struct ipoctal_config { - unsigned int baud; - unsigned int stop_bits; - unsigned int bits_per_char; - unsigned short parity; - unsigned int flow_control; -}; - -/** * struct ipoctal_stats -- Stats since last reset * * @tx: Number of transmitted bytes -- cgit v0.10.2 From c15768bb0c346767eb54e01a7e772041f36eb65e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Thu, 7 Jun 2012 10:24:56 +0200 Subject: Staging: ipack/devices/ipoctal: remove error_flag field from ipoctal struct. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the error_flag field from the ipoctal structure, as the error code is handled through the tty abstraction. Remove the values definition as well. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/devices/ipoctal.c b/drivers/staging/ipack/devices/ipoctal.c index ff88800..2921467 100644 --- a/drivers/staging/ipack/devices/ipoctal.c +++ b/drivers/staging/ipack/devices/ipoctal.c @@ -50,7 +50,6 @@ struct ipoctal { unsigned int nb_bytes[NR_CHANNELS]; unsigned int count_wr[NR_CHANNELS]; wait_queue_head_t queue[NR_CHANNELS]; - unsigned short error_flag[NR_CHANNELS]; spinlock_t lock[NR_CHANNELS]; unsigned int pointer_read[NR_CHANNELS]; unsigned int pointer_write[NR_CHANNELS]; @@ -275,23 +274,19 @@ static int ipoctal_irq_handler(void *arg) CR_CMD_RESET_ERR_STATUS); if (sr & SR_OVERRUN_ERROR) { - ipoctal->error_flag[channel] |= UART_OVERRUN; ipoctal->chan_stats[channel].overrun_err++; /* Overrun doesn't affect the current character*/ tty_insert_flip_char(tty, 0, TTY_OVERRUN); } if (sr & SR_PARITY_ERROR) { - ipoctal->error_flag[channel] |= UART_PARITY; ipoctal->chan_stats[channel].parity_err++; flag = TTY_PARITY; } if (sr & SR_FRAMING_ERROR) { - ipoctal->error_flag[channel] |= UART_FRAMING; ipoctal->chan_stats[channel].framing_err++; flag = TTY_FRAME; } if (sr & SR_RECEIVED_BREAK) { - ipoctal->error_flag[channel] |= UART_BREAK; ipoctal->chan_stats[channel].rcv_break++; flag = TTY_BREAK; } @@ -493,7 +488,6 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, ipoctal_reset_stats(&ipoctal->chan_stats[i]); ipoctal->nb_bytes[i] = 0; init_waitqueue_head(&ipoctal->queue[i]); - ipoctal->error_flag[i] = UART_NOERROR; spin_lock_init(&ipoctal->lock[i]); ipoctal->pointer_read[i] = 0; @@ -552,8 +546,6 @@ static int ipoctal_write(struct ipoctal *ipoctal, unsigned int channel, ipoctal_copy_write_buffer(ipoctal, channel, buf, count); - ipoctal->error_flag[channel] = UART_NOERROR; - /* As the IP-OCTAL 485 only supports half duplex, do it manually */ if (ipoctal->board_id == IP_OCTAL_485_ID) { ipoctal_write_io_reg(ipoctal, diff --git a/drivers/staging/ipack/devices/ipoctal.h b/drivers/staging/ipack/devices/ipoctal.h index b3c901c..2aae170 100644 --- a/drivers/staging/ipack/devices/ipoctal.h +++ b/drivers/staging/ipack/devices/ipoctal.h @@ -29,19 +29,6 @@ enum uart_parity_e { }; /** - * enum uart_error - UART error type - * - */ -enum uart_error { - UART_NOERROR = 0, /* No error during transmission */ - UART_TIMEOUT = 1 << 0, /* Timeout error */ - UART_OVERRUN = 1 << 1, /* Overrun error */ - UART_PARITY = 1 << 2, /* Parity error */ - UART_FRAMING = 1 << 3, /* Framing error */ - UART_BREAK = 1 << 4, /* Received break */ -}; - -/** * struct ipoctal_stats -- Stats since last reset * * @tx: Number of transmitted bytes -- cgit v0.10.2 From 1be9bbddde32a0c414dd65220ca86f808aaeec5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Thu, 7 Jun 2012 10:24:57 +0200 Subject: Staging: ipack/devices/ipoctal: remove unused enum uart_parity_e. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/devices/ipoctal.h b/drivers/staging/ipack/devices/ipoctal.h index 2aae170..c5b4ed4 100644 --- a/drivers/staging/ipack/devices/ipoctal.h +++ b/drivers/staging/ipack/devices/ipoctal.h @@ -20,15 +20,6 @@ #define RELEVANT_IFLAG(iflag) ((iflag) & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) /** - * enum uart_parity_e - UART supported parity. - */ -enum uart_parity_e { - UART_NONE = 0, - UART_ODD = 1, - UART_EVEN = 2, -}; - -/** * struct ipoctal_stats -- Stats since last reset * * @tx: Number of transmitted bytes -- cgit v0.10.2 From 395350370010ab9693085ede5a1c08fb2faeb5a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Thu, 7 Jun 2012 10:24:58 +0200 Subject: Staging: ipack/bridges/tpci200: change device table definition and export it. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use DEFINE_PCI_DEVICE_TABLE() to create the device table and add MODULE_DEVICE_TABLE() to export it. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c index e692f1e..ae9f803 100644 --- a/drivers/staging/ipack/bridges/tpci200.c +++ b/drivers/staging/ipack/bridges/tpci200.c @@ -871,12 +871,14 @@ static void __devexit tpci200_pci_remove(struct pci_dev *dev) } } -static struct pci_device_id tpci200_idtable[2] = { +static DEFINE_PCI_DEVICE_TABLE(tpci200_idtable) = { { TPCI200_VENDOR_ID, TPCI200_DEVICE_ID, TPCI200_SUBVENDOR_ID, TPCI200_SUBDEVICE_ID }, { 0, }, }; +MODULE_DEVICE_TABLE(pci, tpci200_idtable); + static struct pci_driver tpci200_pci_drv = { .name = "tpci200", .id_table = tpci200_idtable, -- cgit v0.10.2 From ef4459341a600703e99a08584350809a96b62371 Mon Sep 17 00:00:00 2001 From: Andy Gross Date: Thu, 24 May 2012 11:43:32 -0500 Subject: staging: omapdrm: Fix error paths during dmm init Failures during the dmm probe can cause the kernel to crash. Moved the spinlock to a global and moved list initializations immediately after the allocation of the dmm private structure. Signed-off-by: Andy Gross Reviewed-by: Rob Clark Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/omapdrm/omap_dmm_priv.h b/drivers/staging/omapdrm/omap_dmm_priv.h index 2f529ab..08b22e9 100644 --- a/drivers/staging/omapdrm/omap_dmm_priv.h +++ b/drivers/staging/omapdrm/omap_dmm_priv.h @@ -181,7 +181,6 @@ struct dmm { /* allocation list and lock */ struct list_head alloc_head; - spinlock_t list_lock; }; #endif diff --git a/drivers/staging/omapdrm/omap_dmm_tiler.c b/drivers/staging/omapdrm/omap_dmm_tiler.c index 9d83060..8619783 100644 --- a/drivers/staging/omapdrm/omap_dmm_tiler.c +++ b/drivers/staging/omapdrm/omap_dmm_tiler.c @@ -40,6 +40,9 @@ static struct tcm *containers[TILFMT_NFORMATS]; static struct dmm *omap_dmm; +/* global spinlock for protecting lists */ +static DEFINE_SPINLOCK(list_lock); + /* Geometry table */ #define GEOM(xshift, yshift, bytes_per_pixel) { \ .x_shft = (xshift), \ @@ -147,13 +150,13 @@ static struct dmm_txn *dmm_txn_init(struct dmm *dmm, struct tcm *tcm) down(&dmm->engine_sem); /* grab an idle engine */ - spin_lock(&dmm->list_lock); + spin_lock(&list_lock); if (!list_empty(&dmm->idle_head)) { engine = list_entry(dmm->idle_head.next, struct refill_engine, idle_node); list_del(&engine->idle_node); } - spin_unlock(&dmm->list_lock); + spin_unlock(&list_lock); BUG_ON(!engine); @@ -256,9 +259,9 @@ static int dmm_txn_commit(struct dmm_txn *txn, bool wait) } cleanup: - spin_lock(&dmm->list_lock); + spin_lock(&list_lock); list_add(&engine->idle_node, &dmm->idle_head); - spin_unlock(&dmm->list_lock); + spin_unlock(&list_lock); up(&omap_dmm->engine_sem); return ret; @@ -351,9 +354,9 @@ struct tiler_block *tiler_reserve_2d(enum tiler_fmt fmt, uint16_t w, } /* add to allocation list */ - spin_lock(&omap_dmm->list_lock); + spin_lock(&list_lock); list_add(&block->alloc_node, &omap_dmm->alloc_head); - spin_unlock(&omap_dmm->list_lock); + spin_unlock(&list_lock); return block; } @@ -374,9 +377,9 @@ struct tiler_block *tiler_reserve_1d(size_t size) return ERR_PTR(-ENOMEM); } - spin_lock(&omap_dmm->list_lock); + spin_lock(&list_lock); list_add(&block->alloc_node, &omap_dmm->alloc_head); - spin_unlock(&omap_dmm->list_lock); + spin_unlock(&list_lock); return block; } @@ -389,9 +392,9 @@ int tiler_release(struct tiler_block *block) if (block->area.tcm) dev_err(omap_dmm->dev, "failed to release block\n"); - spin_lock(&omap_dmm->list_lock); + spin_lock(&list_lock); list_del(&block->alloc_node); - spin_unlock(&omap_dmm->list_lock); + spin_unlock(&list_lock); kfree(block); return ret; @@ -479,13 +482,13 @@ static int omap_dmm_remove(struct platform_device *dev) if (omap_dmm) { /* free all area regions */ - spin_lock(&omap_dmm->list_lock); + spin_lock(&list_lock); list_for_each_entry_safe(block, _block, &omap_dmm->alloc_head, alloc_node) { list_del(&block->alloc_node); kfree(block); } - spin_unlock(&omap_dmm->list_lock); + spin_unlock(&list_lock); for (i = 0; i < omap_dmm->num_lut; i++) if (omap_dmm->tcm && omap_dmm->tcm[i]) @@ -503,7 +506,7 @@ static int omap_dmm_remove(struct platform_device *dev) vfree(omap_dmm->lut); - if (omap_dmm->irq != -1) + if (omap_dmm->irq > 0) free_irq(omap_dmm->irq, omap_dmm); iounmap(omap_dmm->base); @@ -527,6 +530,10 @@ static int omap_dmm_probe(struct platform_device *dev) goto fail; } + /* initialize lists */ + INIT_LIST_HEAD(&omap_dmm->alloc_head); + INIT_LIST_HEAD(&omap_dmm->idle_head); + /* lookup hwmod data - base address and irq */ mem = platform_get_resource(dev, IORESOURCE_MEM, 0); if (!mem) { @@ -629,7 +636,6 @@ static int omap_dmm_probe(struct platform_device *dev) } sema_init(&omap_dmm->engine_sem, omap_dmm->num_engines); - INIT_LIST_HEAD(&omap_dmm->idle_head); for (i = 0; i < omap_dmm->num_engines; i++) { omap_dmm->engines[i].id = i; omap_dmm->engines[i].dmm = omap_dmm; @@ -672,9 +678,6 @@ static int omap_dmm_probe(struct platform_device *dev) containers[TILFMT_32BIT] = omap_dmm->tcm[0]; containers[TILFMT_PAGE] = omap_dmm->tcm[0]; - INIT_LIST_HEAD(&omap_dmm->alloc_head); - spin_lock_init(&omap_dmm->list_lock); - area = (struct tcm_area) { .is2d = true, .tcm = NULL, @@ -697,7 +700,8 @@ static int omap_dmm_probe(struct platform_device *dev) return 0; fail: - omap_dmm_remove(dev); + if (omap_dmm_remove(dev)) + dev_err(&dev->dev, "cleanup failed\n"); return ret; } @@ -810,7 +814,7 @@ int tiler_map_show(struct seq_file *s, void *arg) map[i] = global_map + i * (w_adj + 1); map[i][w_adj] = 0; } - spin_lock_irqsave(&omap_dmm->list_lock, flags); + spin_lock_irqsave(&list_lock, flags); list_for_each_entry(block, &omap_dmm->alloc_head, alloc_node) { if (block->fmt != TILFMT_PAGE) { @@ -836,7 +840,7 @@ int tiler_map_show(struct seq_file *s, void *arg) } } - spin_unlock_irqrestore(&omap_dmm->list_lock, flags); + spin_unlock_irqrestore(&list_lock, flags); if (s) { seq_printf(s, "BEGIN DMM TILER MAP\n"); -- cgit v0.10.2 From 397d3e6029cb816d7a9a78531528a62d08c70d3f Mon Sep 17 00:00:00 2001 From: Adnan Ali Date: Fri, 25 May 2012 18:56:40 +0100 Subject: Staging: et131x: fix coding style issues This commit fixes coding style issues including braces position and line wrapping. Signed-off-by: Adnan Ali Reviewed-by: Jannis Pohlmann Acked-by: Mark Einon Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index 5b11c5e..cf02336 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -85,8 +85,7 @@ MODULE_AUTHOR("Victor Soriano "); MODULE_AUTHOR("Mark Einon "); MODULE_LICENSE("Dual BSD/GPL"); -MODULE_DESCRIPTION("10/100/1000 Base-T Ethernet Driver " - "for the ET1310 by Agere Systems"); +MODULE_DESCRIPTION("10/100/1000 Base-T Ethernet Driver for the ET1310 by Agere Systems"); /* EEPROM defines */ #define MAX_NUM_REGISTER_POLLS 1000 @@ -2967,11 +2966,10 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *adapter) (ring_index == 0 && buff_index > rx_local->fbr[1]->num_entries - 1) || (ring_index == 1 && - buff_index > rx_local->fbr[0]->num_entries - 1)) + buff_index > rx_local->fbr[0]->num_entries - 1)) { #else - if (ring_index != 1 || buff_index > rx_local->fbr[0]->num_entries - 1) + if (ring_index != 1 || buff_index > rx_local->fbr[0]->num_entries - 1) { #endif - { /* Illegal buffer or ring index cannot be used by S/W*/ dev_err(&adapter->pdev->dev, "NICRxPkts PSR Entry %d indicates " @@ -4326,8 +4324,7 @@ static int et131x_mii_probe(struct net_device *netdev) phydev->advertising = phydev->supported; adapter->phydev = phydev; - dev_info(&adapter->pdev->dev, "attached PHY driver [%s] " - "(mii_bus:phy_addr=%s)\n", + dev_info(&adapter->pdev->dev, "attached PHY driver [%s] (mii_bus:phy_addr=%s)\n", phydev->drv->name, dev_name(&phydev->dev)); return 0; -- cgit v0.10.2 From b5b86a4d99f48e5ac28c19ae2a00415e26a7ac1a Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Sat, 9 Jun 2012 12:17:01 +0300 Subject: Staging: et131x: fix | vs & typos These two places seem like they should be using bitwise OR instead of bitwise AND. The first one is a noop which is equivalent to: imr |= (0x0100 & 0x0004 & 0x0001); The second is sets lcr2 to zero instead of just clearing the high bits. lcr2 &= (0x00F0 & 0x000F); Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index cf02336..8f3fc5f 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -1766,8 +1766,8 @@ static void et131x_xcvr_init(struct et131x_adapter *adapter) /* Set the link status interrupt only. Bad behavior when link status * and auto neg are set, we run into a nested interrupt problem */ - imr |= (ET_PHY_INT_MASK_AUTONEGSTAT & - ET_PHY_INT_MASK_LINKSTAT & + imr |= (ET_PHY_INT_MASK_AUTONEGSTAT | + ET_PHY_INT_MASK_LINKSTAT | ET_PHY_INT_MASK_ENABLE); et131x_mii_write(adapter, PHY_INTERRUPT_MASK, imr); @@ -1783,7 +1783,7 @@ static void et131x_xcvr_init(struct et131x_adapter *adapter) if ((adapter->eeprom_data[1] & 0x4) == 0) { et131x_mii_read(adapter, PHY_LED_2, &lcr2); - lcr2 &= (ET_LED2_LED_100TX & ET_LED2_LED_1000T); + lcr2 &= (ET_LED2_LED_100TX | ET_LED2_LED_1000T); lcr2 |= (LED_VAL_LINKON_ACTIVE << LED_LINK_SHIFT); if ((adapter->eeprom_data[1] & 0x8) == 0) -- cgit v0.10.2 From c234434835b1f4bad9bdbae6710044cba387c9e5 Mon Sep 17 00:00:00 2001 From: Minchan Kim Date: Fri, 8 Jun 2012 15:39:25 +0900 Subject: staging: zsmalloc: zsmalloc: use unsigned long instead of void * We should use unsigned long as handle instead of void * to avoid any confusion. Without this, users may just treat zs_malloc return value as a pointer and try to deference it. This patch passed compile test(zram, zcache and ramster) and zram is tested on qemu. changelog * from v2 - remove hval pointed out by Nitin - based on next-20120607 * from v1 - change zcache's zv_create return value - baesd on next-20120604 Cc: Dan Magenheimer Acked-by: Seth Jennings Acked-by: Konrad Rzeszutek Wilk Signed-off-by: Minchan Kim Acked-by: Nitin Gupta Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index 2734dac..d0141fbc 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c @@ -693,14 +693,14 @@ static unsigned int zv_max_mean_zsize = (PAGE_SIZE / 8) * 5; static atomic_t zv_curr_dist_counts[NCHUNKS]; static atomic_t zv_cumul_dist_counts[NCHUNKS]; -static struct zv_hdr *zv_create(struct zs_pool *pool, uint32_t pool_id, +static unsigned long zv_create(struct zs_pool *pool, uint32_t pool_id, struct tmem_oid *oid, uint32_t index, void *cdata, unsigned clen) { struct zv_hdr *zv; u32 size = clen + sizeof(struct zv_hdr); int chunks = (size + (CHUNK_SIZE - 1)) >> CHUNK_SHIFT; - void *handle = NULL; + unsigned long handle = 0; BUG_ON(!irqs_disabled()); BUG_ON(chunks >= NCHUNKS); @@ -721,7 +721,7 @@ out: return handle; } -static void zv_free(struct zs_pool *pool, void *handle) +static void zv_free(struct zs_pool *pool, unsigned long handle) { unsigned long flags; struct zv_hdr *zv; @@ -743,7 +743,7 @@ static void zv_free(struct zs_pool *pool, void *handle) local_irq_restore(flags); } -static void zv_decompress(struct page *page, void *handle) +static void zv_decompress(struct page *page, unsigned long handle) { unsigned int clen = PAGE_SIZE; char *to_va; @@ -1247,7 +1247,7 @@ static int zcache_pampd_get_data(char *data, size_t *bufsize, bool raw, int ret = 0; BUG_ON(is_ephemeral(pool)); - zv_decompress((struct page *)(data), pampd); + zv_decompress((struct page *)(data), (unsigned long)pampd); return ret; } @@ -1282,7 +1282,7 @@ static void zcache_pampd_free(void *pampd, struct tmem_pool *pool, atomic_dec(&zcache_curr_eph_pampd_count); BUG_ON(atomic_read(&zcache_curr_eph_pampd_count) < 0); } else { - zv_free(cli->zspool, pampd); + zv_free(cli->zspool, (unsigned long)pampd); atomic_dec(&zcache_curr_pers_pampd_count); BUG_ON(atomic_read(&zcache_curr_pers_pampd_count) < 0); } diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c index 685d612..abd69d1 100644 --- a/drivers/staging/zram/zram_drv.c +++ b/drivers/staging/zram/zram_drv.c @@ -135,7 +135,7 @@ static void zram_set_disksize(struct zram *zram, size_t totalram_bytes) static void zram_free_page(struct zram *zram, size_t index) { - void *handle = zram->table[index].handle; + unsigned long handle = zram->table[index].handle; if (unlikely(!handle)) { /* @@ -150,7 +150,7 @@ static void zram_free_page(struct zram *zram, size_t index) } if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED))) { - __free_page(handle); + __free_page((struct page *)handle); zram_clear_flag(zram, index, ZRAM_UNCOMPRESSED); zram_stat_dec(&zram->stats.pages_expand); goto out; @@ -166,7 +166,7 @@ out: zram->table[index].size); zram_stat_dec(&zram->stats.pages_stored); - zram->table[index].handle = NULL; + zram->table[index].handle = 0; zram->table[index].size = 0; } @@ -189,7 +189,7 @@ static void handle_uncompressed_page(struct zram *zram, struct bio_vec *bvec, unsigned char *user_mem, *cmem; user_mem = kmap_atomic(page); - cmem = kmap_atomic(zram->table[index].handle); + cmem = kmap_atomic((struct page *)zram->table[index].handle); memcpy(user_mem + bvec->bv_offset, cmem + offset, bvec->bv_len); kunmap_atomic(cmem); @@ -317,7 +317,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, int ret; u32 store_offset; size_t clen; - void *handle; + unsigned long handle; struct zobj_header *zheader; struct page *page, *page_store; unsigned char *user_mem, *cmem, *src, *uncmem = NULL; @@ -399,7 +399,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, store_offset = 0; zram_set_flag(zram, index, ZRAM_UNCOMPRESSED); zram_stat_inc(&zram->stats.pages_expand); - handle = page_store; + handle = (unsigned long)page_store; src = kmap_atomic(page); cmem = kmap_atomic(page_store); goto memstore; @@ -592,12 +592,12 @@ void __zram_reset_device(struct zram *zram) /* Free all pages that are still in this zram device */ for (index = 0; index < zram->disksize >> PAGE_SHIFT; index++) { - void *handle = zram->table[index].handle; + unsigned long handle = zram->table[index].handle; if (!handle) continue; if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED))) - __free_page(handle); + __free_page((struct page *)handle); else zs_free(zram->mem_pool, handle); } diff --git a/drivers/staging/zram/zram_drv.h b/drivers/staging/zram/zram_drv.h index fbe8ac9..7a7e256 100644 --- a/drivers/staging/zram/zram_drv.h +++ b/drivers/staging/zram/zram_drv.h @@ -81,7 +81,7 @@ enum zram_pageflags { /* Allocated for each disk page */ struct table { - void *handle; + unsigned long handle; u16 size; /* object size (excluding header) */ u8 count; /* object ref count (not yet used) */ u8 flags; diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c index 4496737..8e830ee 100644 --- a/drivers/staging/zsmalloc/zsmalloc-main.c +++ b/drivers/staging/zsmalloc/zsmalloc-main.c @@ -247,13 +247,11 @@ static void *obj_location_to_handle(struct page *page, unsigned long obj_idx) } /* Decode pair from the given object handle */ -static void obj_handle_to_location(void *handle, struct page **page, +static void obj_handle_to_location(unsigned long handle, struct page **page, unsigned long *obj_idx) { - unsigned long hval = (unsigned long)handle; - - *page = pfn_to_page(hval >> OBJ_INDEX_BITS); - *obj_idx = hval & OBJ_INDEX_MASK; + *page = pfn_to_page(handle >> OBJ_INDEX_BITS); + *obj_idx = handle & OBJ_INDEX_MASK; } static unsigned long obj_idx_to_offset(struct page *page, @@ -568,12 +566,12 @@ EXPORT_SYMBOL_GPL(zs_destroy_pool); * @size: size of block to allocate * * On success, handle to the allocated object is returned, - * otherwise NULL. + * otherwise 0. * Allocation requests with size > ZS_MAX_ALLOC_SIZE will fail. */ -void *zs_malloc(struct zs_pool *pool, size_t size) +unsigned long zs_malloc(struct zs_pool *pool, size_t size) { - void *obj; + unsigned long obj; struct link_free *link; int class_idx; struct size_class *class; @@ -582,7 +580,7 @@ void *zs_malloc(struct zs_pool *pool, size_t size) unsigned long m_objidx, m_offset; if (unlikely(!size || size > ZS_MAX_ALLOC_SIZE)) - return NULL; + return 0; class_idx = get_size_class_index(size); class = &pool->size_class[class_idx]; @@ -595,14 +593,14 @@ void *zs_malloc(struct zs_pool *pool, size_t size) spin_unlock(&class->lock); first_page = alloc_zspage(class, pool->flags); if (unlikely(!first_page)) - return NULL; + return 0; set_zspage_mapping(first_page, class->index, ZS_EMPTY); spin_lock(&class->lock); class->pages_allocated += class->pages_per_zspage; } - obj = first_page->freelist; + obj = (unsigned long)first_page->freelist; obj_handle_to_location(obj, &m_page, &m_objidx); m_offset = obj_idx_to_offset(m_page, m_objidx, class->size); @@ -621,7 +619,7 @@ void *zs_malloc(struct zs_pool *pool, size_t size) } EXPORT_SYMBOL_GPL(zs_malloc); -void zs_free(struct zs_pool *pool, void *obj) +void zs_free(struct zs_pool *pool, unsigned long obj) { struct link_free *link; struct page *first_page, *f_page; @@ -648,7 +646,7 @@ void zs_free(struct zs_pool *pool, void *obj) + f_offset); link->next = first_page->freelist; kunmap_atomic(link); - first_page->freelist = obj; + first_page->freelist = (void *)obj; first_page->inuse--; fullness = fix_fullness_group(pool, first_page); @@ -672,7 +670,7 @@ EXPORT_SYMBOL_GPL(zs_free); * this function. When done with the object, it must be unmapped using * zs_unmap_object */ -void *zs_map_object(struct zs_pool *pool, void *handle) +void *zs_map_object(struct zs_pool *pool, unsigned long handle) { struct page *page; unsigned long obj_idx, off; @@ -712,7 +710,7 @@ void *zs_map_object(struct zs_pool *pool, void *handle) } EXPORT_SYMBOL_GPL(zs_map_object); -void zs_unmap_object(struct zs_pool *pool, void *handle) +void zs_unmap_object(struct zs_pool *pool, unsigned long handle) { struct page *page; unsigned long obj_idx, off; diff --git a/drivers/staging/zsmalloc/zsmalloc.h b/drivers/staging/zsmalloc/zsmalloc.h index 949384e..485cbb1 100644 --- a/drivers/staging/zsmalloc/zsmalloc.h +++ b/drivers/staging/zsmalloc/zsmalloc.h @@ -20,11 +20,11 @@ struct zs_pool; struct zs_pool *zs_create_pool(const char *name, gfp_t flags); void zs_destroy_pool(struct zs_pool *pool); -void *zs_malloc(struct zs_pool *pool, size_t size); -void zs_free(struct zs_pool *pool, void *obj); +unsigned long zs_malloc(struct zs_pool *pool, size_t size); +void zs_free(struct zs_pool *pool, unsigned long obj); -void *zs_map_object(struct zs_pool *pool, void *handle); -void zs_unmap_object(struct zs_pool *pool, void *handle); +void *zs_map_object(struct zs_pool *pool, unsigned long handle); +void zs_unmap_object(struct zs_pool *pool, unsigned long handle); u64 zs_get_total_size_bytes(struct zs_pool *pool); -- cgit v0.10.2 From 374a69191d12a0525b7ffe1197abc30c4795a230 Mon Sep 17 00:00:00 2001 From: Minchan Kim Date: Fri, 8 Jun 2012 15:39:26 +0900 Subject: staging: zram: fix random data read fd1a30de makes a bug that it uses (struct page *) as zsmalloc's handle although it's a uncompressed page so that it can access random page, return random data or even crashed by get_first_page in zs_map_object. Cc: Seth Jennings Cc: Jerome Marchand Signed-off-by: Minchan Kim Acked-by: Nitin Gupta Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c index abd69d1..0cdc303 100644 --- a/drivers/staging/zram/zram_drv.c +++ b/drivers/staging/zram/zram_drv.c @@ -280,26 +280,27 @@ static int zram_read_before_write(struct zram *zram, char *mem, u32 index) size_t clen = PAGE_SIZE; struct zobj_header *zheader; unsigned char *cmem; + unsigned long handle = zram->table[index].handle; - if (zram_test_flag(zram, index, ZRAM_ZERO) || - !zram->table[index].handle) { + if (zram_test_flag(zram, index, ZRAM_ZERO) || !handle) { memset(mem, 0, PAGE_SIZE); return 0; } - cmem = zs_map_object(zram->mem_pool, zram->table[index].handle); - /* Page is stored uncompressed since it's incompressible */ if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED))) { - memcpy(mem, cmem, PAGE_SIZE); - kunmap_atomic(cmem); + char *src = kmap_atomic((struct page *)handle); + memcpy(mem, src, PAGE_SIZE); + kunmap_atomic(src); return 0; } + cmem = zs_map_object(zram->mem_pool, handle); + ret = lzo1x_decompress_safe(cmem + sizeof(*zheader), zram->table[index].size, mem, &clen); - zs_unmap_object(zram->mem_pool, zram->table[index].handle); + zs_unmap_object(zram->mem_pool, handle); /* Should NEVER happen. Return bio error if it does. */ if (unlikely(ret != LZO_E_OK)) { -- cgit v0.10.2 From 130f315a174d127cbb90d4d1a4a7088dbcf930b5 Mon Sep 17 00:00:00 2001 From: Minchan Kim Date: Fri, 8 Jun 2012 15:39:27 +0900 Subject: staging: zram: remove special handle of uncompressed page xvmalloc can't handle PAGE_SIZE page so that zram have to handle it specially but zsmalloc can do it so let's remove unnecessary special handling code. Quote from Nitin "I think page vs handle distinction was added since xvmalloc could not handle full page allocation. Now that zsmalloc allows full page allocation, we can just use it for both cases. This would also allow removing the ZRAM_UNCOMPRESSED flag. The only downside will be slightly slower code path for full page allocation but this event is anyways supposed to be rare, so should be fine." 1. This patch reduces code very much. drivers/staging/zram/zram_drv.c | 104 +++++-------------------------------- drivers/staging/zram/zram_drv.h | 17 +----- drivers/staging/zram/zram_sysfs.c | 6 +-- 3 files changed, 15 insertions(+), 112 deletions(-) 2. change pages_expand with bad_compress so it can count bad compression(above 75%) ratio. 3. remove zobj_header which is for back-reference for defragmentation because firstly, it's not used at the moment and zsmalloc can't handle bigger size than PAGE_SIZE so zram can't do it any more without redesign. Cc: Seth Jennings Signed-off-by: Minchan Kim Acked-by: Nitin Gupta Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c index 0cdc303..2036a90 100644 --- a/drivers/staging/zram/zram_drv.c +++ b/drivers/staging/zram/zram_drv.c @@ -136,6 +136,7 @@ static void zram_set_disksize(struct zram *zram, size_t totalram_bytes) static void zram_free_page(struct zram *zram, size_t index) { unsigned long handle = zram->table[index].handle; + u16 size = zram->table[index].size; if (unlikely(!handle)) { /* @@ -149,19 +150,14 @@ static void zram_free_page(struct zram *zram, size_t index) return; } - if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED))) { - __free_page((struct page *)handle); - zram_clear_flag(zram, index, ZRAM_UNCOMPRESSED); - zram_stat_dec(&zram->stats.pages_expand); - goto out; - } + if (unlikely(size > max_zpage_size)) + zram_stat_dec(&zram->stats.bad_compress); zs_free(zram->mem_pool, handle); - if (zram->table[index].size <= PAGE_SIZE / 2) + if (size <= PAGE_SIZE / 2) zram_stat_dec(&zram->stats.good_compress); -out: zram_stat64_sub(zram, &zram->stats.compr_size, zram->table[index].size); zram_stat_dec(&zram->stats.pages_stored); @@ -182,22 +178,6 @@ static void handle_zero_page(struct bio_vec *bvec) flush_dcache_page(page); } -static void handle_uncompressed_page(struct zram *zram, struct bio_vec *bvec, - u32 index, int offset) -{ - struct page *page = bvec->bv_page; - unsigned char *user_mem, *cmem; - - user_mem = kmap_atomic(page); - cmem = kmap_atomic((struct page *)zram->table[index].handle); - - memcpy(user_mem + bvec->bv_offset, cmem + offset, bvec->bv_len); - kunmap_atomic(cmem); - kunmap_atomic(user_mem); - - flush_dcache_page(page); -} - static inline int is_partial_io(struct bio_vec *bvec) { return bvec->bv_len != PAGE_SIZE; @@ -209,7 +189,6 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec, int ret; size_t clen; struct page *page; - struct zobj_header *zheader; unsigned char *user_mem, *cmem, *uncmem = NULL; page = bvec->bv_page; @@ -227,12 +206,6 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec, return 0; } - /* Page is stored uncompressed since it's incompressible */ - if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED))) { - handle_uncompressed_page(zram, bvec, index, offset); - return 0; - } - if (is_partial_io(bvec)) { /* Use a temporary buffer to decompress the page */ uncmem = kmalloc(PAGE_SIZE, GFP_KERNEL); @@ -249,8 +222,7 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec, cmem = zs_map_object(zram->mem_pool, zram->table[index].handle); - ret = lzo1x_decompress_safe(cmem + sizeof(*zheader), - zram->table[index].size, + ret = lzo1x_decompress_safe(cmem, zram->table[index].size, uncmem, &clen); if (is_partial_io(bvec)) { @@ -278,7 +250,6 @@ static int zram_read_before_write(struct zram *zram, char *mem, u32 index) { int ret; size_t clen = PAGE_SIZE; - struct zobj_header *zheader; unsigned char *cmem; unsigned long handle = zram->table[index].handle; @@ -287,18 +258,8 @@ static int zram_read_before_write(struct zram *zram, char *mem, u32 index) return 0; } - /* Page is stored uncompressed since it's incompressible */ - if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED))) { - char *src = kmap_atomic((struct page *)handle); - memcpy(mem, src, PAGE_SIZE); - kunmap_atomic(src); - return 0; - } - cmem = zs_map_object(zram->mem_pool, handle); - - ret = lzo1x_decompress_safe(cmem + sizeof(*zheader), - zram->table[index].size, + ret = lzo1x_decompress_safe(cmem, zram->table[index].size, mem, &clen); zs_unmap_object(zram->mem_pool, handle); @@ -316,11 +277,9 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, int offset) { int ret; - u32 store_offset; size_t clen; unsigned long handle; - struct zobj_header *zheader; - struct page *page, *page_store; + struct page *page; unsigned char *user_mem, *cmem, *src, *uncmem = NULL; page = bvec->bv_page; @@ -382,31 +341,10 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, goto out; } - /* - * Page is incompressible. Store it as-is (uncompressed) - * since we do not want to return too many disk write - * errors which has side effect of hanging the system. - */ - if (unlikely(clen > max_zpage_size)) { - clen = PAGE_SIZE; - page_store = alloc_page(GFP_NOIO | __GFP_HIGHMEM); - if (unlikely(!page_store)) { - pr_info("Error allocating memory for " - "incompressible page: %u\n", index); - ret = -ENOMEM; - goto out; - } + if (unlikely(clen > max_zpage_size)) + zram_stat_inc(&zram->stats.bad_compress); - store_offset = 0; - zram_set_flag(zram, index, ZRAM_UNCOMPRESSED); - zram_stat_inc(&zram->stats.pages_expand); - handle = (unsigned long)page_store; - src = kmap_atomic(page); - cmem = kmap_atomic(page_store); - goto memstore; - } - - handle = zs_malloc(zram->mem_pool, clen + sizeof(*zheader)); + handle = zs_malloc(zram->mem_pool, clen); if (!handle) { pr_info("Error allocating memory for compressed " "page: %u, size=%zu\n", index, clen); @@ -415,24 +353,9 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, } cmem = zs_map_object(zram->mem_pool, handle); -memstore: -#if 0 - /* Back-reference needed for memory defragmentation */ - if (!zram_test_flag(zram, index, ZRAM_UNCOMPRESSED)) { - zheader = (struct zobj_header *)cmem; - zheader->table_idx = index; - cmem += sizeof(*zheader); - } -#endif - memcpy(cmem, src, clen); - if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED))) { - kunmap_atomic(cmem); - kunmap_atomic(src); - } else { - zs_unmap_object(zram->mem_pool, handle); - } + zs_unmap_object(zram->mem_pool, handle); zram->table[index].handle = handle; zram->table[index].size = clen; @@ -597,10 +520,7 @@ void __zram_reset_device(struct zram *zram) if (!handle) continue; - if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED))) - __free_page((struct page *)handle); - else - zs_free(zram->mem_pool, handle); + zs_free(zram->mem_pool, handle); } vfree(zram->table); diff --git a/drivers/staging/zram/zram_drv.h b/drivers/staging/zram/zram_drv.h index 7a7e256..9711d1e 100644 --- a/drivers/staging/zram/zram_drv.h +++ b/drivers/staging/zram/zram_drv.h @@ -26,18 +26,6 @@ */ static const unsigned max_num_devices = 32; -/* - * Stored at beginning of each compressed object. - * - * It stores back-reference to table entry which points to this - * object. This is required to support memory defragmentation. - */ -struct zobj_header { -#if 0 - u32 table_idx; -#endif -}; - /*-- Configurable parameters */ /* Default zram disk size: 25% of total RAM */ @@ -68,9 +56,6 @@ static const size_t max_zpage_size = PAGE_SIZE / 4 * 3; /* Flags for zram pages (table[page_no].flags) */ enum zram_pageflags { - /* Page is stored uncompressed */ - ZRAM_UNCOMPRESSED, - /* Page consists entirely of zeros */ ZRAM_ZERO, @@ -98,7 +83,7 @@ struct zram_stats { u32 pages_zero; /* no. of zero filled pages */ u32 pages_stored; /* no. of pages currently stored */ u32 good_compress; /* % of pages with compression ratio<=50% */ - u32 pages_expand; /* % of incompressible pages */ + u32 bad_compress; /* % of pages with compression ratio>=75% */ }; struct zram { diff --git a/drivers/staging/zram/zram_sysfs.c b/drivers/staging/zram/zram_sysfs.c index a7f3771..edb0ed4 100644 --- a/drivers/staging/zram/zram_sysfs.c +++ b/drivers/staging/zram/zram_sysfs.c @@ -186,10 +186,8 @@ static ssize_t mem_used_total_show(struct device *dev, u64 val = 0; struct zram *zram = dev_to_zram(dev); - if (zram->init_done) { - val = zs_get_total_size_bytes(zram->mem_pool) + - ((u64)(zram->stats.pages_expand) << PAGE_SHIFT); - } + if (zram->init_done) + val = zs_get_total_size_bytes(zram->mem_pool); return sprintf(buf, "%llu\n", val); } -- cgit v0.10.2 From 2db51dae56240b52fe08ddbb1a2eb47fe7cfd044 Mon Sep 17 00:00:00 2001 From: Nitin Gupta Date: Sat, 9 Jun 2012 17:41:14 -0700 Subject: staging: zsmalloc documentation Documentation of various struct page fields used by zsmalloc. Changes for v2: - Regroup descriptions as suggested by Konrad Signed-off-by: Nitin Gupta Acked-by: Konrad Rzeszutek Wilk Reviewed-by: Minchan Kim Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c index 8e830ee..fb54a9b 100644 --- a/drivers/staging/zsmalloc/zsmalloc-main.c +++ b/drivers/staging/zsmalloc/zsmalloc-main.c @@ -10,6 +10,54 @@ * Released under the terms of GNU General Public License Version 2.0 */ + +/* + * This allocator is designed for use with zcache and zram. Thus, the + * allocator is supposed to work well under low memory conditions. In + * particular, it never attempts higher order page allocation which is + * very likely to fail under memory pressure. On the other hand, if we + * just use single (0-order) pages, it would suffer from very high + * fragmentation -- any object of size PAGE_SIZE/2 or larger would occupy + * an entire page. This was one of the major issues with its predecessor + * (xvmalloc). + * + * To overcome these issues, zsmalloc allocates a bunch of 0-order pages + * and links them together using various 'struct page' fields. These linked + * pages act as a single higher-order page i.e. an object can span 0-order + * page boundaries. The code refers to these linked pages as a single entity + * called zspage. + * + * Following is how we use various fields and flags of underlying + * struct page(s) to form a zspage. + * + * Usage of struct page fields: + * page->first_page: points to the first component (0-order) page + * page->index (union with page->freelist): offset of the first object + * starting in this page. For the first page, this is + * always 0, so we use this field (aka freelist) to point + * to the first free object in zspage. + * page->lru: links together all component pages (except the first page) + * of a zspage + * + * For _first_ page only: + * + * page->private (union with page->first_page): refers to the + * component page after the first page + * page->freelist: points to the first free object in zspage. + * Free objects are linked together using in-place + * metadata. + * page->objects: maximum number of objects we can store in this + * zspage (class->zspage_order * PAGE_SIZE / class->size) + * page->lru: links together first pages of various zspages. + * Basically forming list of zspages in a fullness group. + * page->mapping: class index and fullness group of the zspage + * + * Usage of struct page flags: + * PG_private: identifies the first component page + * PG_private2: identifies the last component page + * + */ + #ifdef CONFIG_ZSMALLOC_DEBUG #define DEBUG #endif -- cgit v0.10.2 From 94b8435ff4d46dde75173da45564b0d65889dc64 Mon Sep 17 00:00:00 2001 From: Sam Hansen Date: Thu, 7 Jun 2012 16:03:47 -0700 Subject: staging: zram: conventions pr_warning -> pr_warn() Porting zram to use the pr_warn() function instead of the deprecated pr_warning(). Signed-off-by: Sam Hansen Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c index 2036a90..706cb62 100644 --- a/drivers/staging/zram/zram_drv.c +++ b/drivers/staging/zram/zram_drv.c @@ -645,7 +645,7 @@ static int create_device(struct zram *zram, int device_id) zram->disk = alloc_disk(1); if (!zram->disk) { blk_cleanup_queue(zram->queue); - pr_warning("Error allocating disk structure for device %d\n", + pr_warn("Error allocating disk structure for device %d\n", device_id); ret = -ENOMEM; goto out; @@ -676,7 +676,7 @@ static int create_device(struct zram *zram, int device_id) ret = sysfs_create_group(&disk_to_dev(zram->disk)->kobj, &zram_disk_attr_group); if (ret < 0) { - pr_warning("Error creating sysfs group"); + pr_warn("Error creating sysfs group"); goto out; } @@ -710,7 +710,7 @@ static int __init zram_init(void) int ret, dev_id; if (num_devices > max_num_devices) { - pr_warning("Invalid value for num_devices: %u\n", + pr_warn("Invalid value for num_devices: %u\n", num_devices); ret = -EINVAL; goto out; @@ -718,7 +718,7 @@ static int __init zram_init(void) zram_major = register_blkdev(0, "zram"); if (zram_major <= 0) { - pr_warning("Unable to get major number\n"); + pr_warn("Unable to get major number\n"); ret = -EBUSY; goto out; } -- cgit v0.10.2 From 80677c2538283678c7b2ef7ebbd653a3fa54d086 Mon Sep 17 00:00:00 2001 From: Sam Hansen Date: Thu, 7 Jun 2012 16:03:48 -0700 Subject: staging: zram: conventions, __aligned() attribute Using the __aligned() attribute in favor of __attribute__((aligned(size))) Signed-off-by: Sam Hansen Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/zram/zram_drv.h b/drivers/staging/zram/zram_drv.h index 9711d1e..572c0b1 100644 --- a/drivers/staging/zram/zram_drv.h +++ b/drivers/staging/zram/zram_drv.h @@ -70,7 +70,7 @@ struct table { u16 size; /* object size (excluding header) */ u8 count; /* object ref count (not yet used) */ u8 flags; -} __attribute__((aligned(4))); +} __aligned(4); struct zram_stats { u64 compr_size; /* compressed size of pages stored */ -- cgit v0.10.2 From e034410a3dace8ee56906095e737281899126f44 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Fri, 1 Jun 2012 10:14:02 +0200 Subject: staging: usbip: userspace: include headers in release tarballs The header files should be included in generated tarballs for archives. Signed-off-by: Natanael Copa Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/usbip/userspace/src/Makefile.am b/drivers/staging/usbip/userspace/src/Makefile.am index 3f09f6a..c365a3f 100644 --- a/drivers/staging/usbip/userspace/src/Makefile.am +++ b/drivers/staging/usbip/userspace/src/Makefile.am @@ -4,8 +4,9 @@ LDADD = $(top_builddir)/libsrc/libusbip.la @PACKAGE_LIBS@ sbin_PROGRAMS := usbip usbipd -usbip_SOURCES := usbip.c utils.c usbip_network.c \ +usbip_SOURCES := usbip.h utils.h usbip.c utils.c usbip_network.c \ usbip_attach.c usbip_detach.c usbip_list.c \ usbip_bind.c usbip_unbind.c -usbipd_SOURCES := usbipd.c usbip_network.c + +usbipd_SOURCES := usbip_network.h usbipd.c usbip_network.c -- cgit v0.10.2 From a6e51c1e3425fe61040e9e770f514cfdf576a1f0 Mon Sep 17 00:00:00 2001 From: Paul Bolle Date: Fri, 8 Jun 2012 12:22:46 +0200 Subject: staging: Delete if_strip.h Commit f80a3f62383bf673c310926d55142d51f118926d ("Staging: strip: delete the driver") left if_strip.h unused: nothing in the tree includes it anymore. It is still exported, but since nothing in the kernel uses struct MetricomAddress, that seems pointless. Delete this header too. Signed-off-by: Paul Bolle Signed-off-by: Greg Kroah-Hartman diff --git a/include/linux/Kbuild b/include/linux/Kbuild index 8760be3..9366142 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild @@ -183,7 +183,6 @@ header-y += if_ppp.h header-y += if_pppol2tp.h header-y += if_pppox.h header-y += if_slip.h -header-y += if_strip.h header-y += if_team.h header-y += if_tun.h header-y += if_tunnel.h diff --git a/include/linux/if_strip.h b/include/linux/if_strip.h deleted file mode 100644 index 6526a62..0000000 --- a/include/linux/if_strip.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * if_strip.h -- - * - * Definitions for the STRIP interface - * - * Copyright 1996 The Board of Trustees of The Leland Stanford - * Junior University. All Rights Reserved. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies. Stanford University - * makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without - * express or implied warranty. - */ - -#ifndef __LINUX_STRIP_H -#define __LINUX_STRIP_H - -#include - -typedef struct { - __u8 c[6]; -} MetricomAddress; - -#endif -- cgit v0.10.2 From 4bfa9b2ee16e73087435ac64a35f32140a385438 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 6 Jun 2012 13:43:55 +0100 Subject: staging: comedi: das08: Reduce conditional compilation This code is used by some combination of the CONFIG_COMEDI_DAS08_CS, CONFIG_COMEDI_DAS08_ISA, and CONFIG_COMEDI_DAS08_PCI and contains a lot of conditional compilation. Remove most of the conditional compilation, relying on the compiler to optimize out unused static functions and data. Use the '__maybe_unused' tag for those functions that cause compiler warnings as a result of this. Also change the DO_COMEDI_DRIVER_REGISTER macro from a conditionally defined macro to a manifest constant macro to allow it to be tested outside the preprocessor (although this is not currently needed). Signed-off-by: Ian Abbott Acked-by: Randy Dunlap Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index fa2784d..f99f72b 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -60,9 +60,9 @@ #define DRV_NAME "das08" -#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) || IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) -#define DO_COMEDI_DRIVER_REGISTER -#endif +#define DO_COMEDI_DRIVER_REGISTER \ + (IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) || \ + IS_ENABLED(CONFIG_COMEDI_DAS08_PCI)) #define PCI_VENDOR_ID_COMPUTERBOARDS 0x1307 #define PCI_DEVICE_ID_PCIDAS08 0x29 @@ -341,22 +341,19 @@ static int das08_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, return 2; } -#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) -static int das08jr_di_rbits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int __maybe_unused +das08jr_di_rbits(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { data[0] = 0; data[1] = inb(dev->iobase + DAS08JR_DIO); return 2; } -#endif -#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) -static int das08jr_do_wbits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int __maybe_unused +das08jr_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { struct das08_private_struct *devpriv = dev->private; @@ -370,12 +367,10 @@ static int das08jr_do_wbits(struct comedi_device *dev, return 2; } -#endif -#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) -static int das08jr_ao_winsn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int __maybe_unused +das08jr_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { int n; int lsb, msb; @@ -401,7 +396,6 @@ static int das08jr_ao_winsn(struct comedi_device *dev, return n; } -#endif /* * @@ -409,10 +403,9 @@ static int das08jr_ao_winsn(struct comedi_device *dev, * a different method to force an update. * */ -#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) -static int das08ao_ao_winsn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int __maybe_unused +das08ao_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { int n; int lsb, msb; @@ -438,7 +431,6 @@ static int das08ao_ao_winsn(struct comedi_device *dev, return n; } -#endif static unsigned int i8254_read_channel_low(unsigned int base, int chan) { @@ -570,7 +562,7 @@ static int das08_counter_config(struct comedi_device *dev, return 2; } -#ifdef DO_COMEDI_DRIVER_REGISTER +#if DO_COMEDI_DRIVER_REGISTER static const struct das08_board_struct das08_boards[] = { #if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) { @@ -943,7 +935,6 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) } EXPORT_SYMBOL_GPL(das08_common_attach); -#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) static int das08_pci_attach_common(struct comedi_device *dev, struct pci_dev *pdev) { @@ -951,6 +942,9 @@ static int das08_pci_attach_common(struct comedi_device *dev, unsigned long pci_iobase; struct das08_private_struct *devpriv = dev->private; + if (!IS_ENABLED(CONFIG_COMEDI_DAS08_PCI)) + return -EINVAL; + devpriv->pdev = pdev; /* enable PCI device and reserve I/O spaces */ if (comedi_pci_enable(pdev, dev->driver->driver_name)) { @@ -977,28 +971,28 @@ static int das08_pci_attach_common(struct comedi_device *dev, #endif return das08_common_attach(dev, iobase); } -#endif -#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) static const struct das08_board_struct * das08_find_pci_board(struct pci_dev *pdev) { +#if DO_COMEDI_DRIVER_REGISTER unsigned int i; for (i = 0; i < ARRAY_SIZE(das08_boards); i++) if (das08_boards[i].bustype == pci && pdev->device == das08_boards[i].id) return &das08_boards[i]; +#endif return NULL; } -#endif -#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) /* only called in the PCI probe path, via comedi_pci_auto_config() */ -static int __devinit das08_attach_pci(struct comedi_device *dev, - struct pci_dev *pdev) +static int __devinit __maybe_unused +das08_attach_pci(struct comedi_device *dev, struct pci_dev *pdev) { int ret; + if (!IS_ENABLED(CONFIG_COMEDI_DAS08_PCI)) + return -EINVAL; ret = alloc_private(dev, sizeof(struct das08_private_struct)); if (ret < 0) return ret; @@ -1010,9 +1004,7 @@ static int __devinit das08_attach_pci(struct comedi_device *dev, } return das08_pci_attach_common(dev, pdev); } -#endif -#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) static struct pci_dev *das08_find_pci(struct comedi_device *dev, int bus, int slot) { @@ -1063,10 +1055,9 @@ static struct pci_dev *das08_find_pci(struct comedi_device *dev, thisboard->name); return NULL; } -#endif -#ifdef DO_COMEDI_DRIVER_REGISTER -static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) +static int __maybe_unused +das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) { const struct das08_board_struct *thisboard = comedi_board(dev); struct das08_private_struct *devpriv; @@ -1097,7 +1088,6 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) } else return -EIO; } -#endif /* DO_COMEDI_DRIVER_REGISTER */ void das08_common_detach(struct comedi_device *dev) { @@ -1106,8 +1096,7 @@ void das08_common_detach(struct comedi_device *dev) } EXPORT_SYMBOL_GPL(das08_common_detach); -#ifdef DO_COMEDI_DRIVER_REGISTER -static void das08_detach(struct comedi_device *dev) +static void __maybe_unused das08_detach(struct comedi_device *dev) { const struct das08_board_struct *thisboard = comedi_board(dev); struct das08_private_struct *devpriv = dev->private; @@ -1126,16 +1115,13 @@ static void das08_detach(struct comedi_device *dev) } } } -#endif /* DO_COMEDI_DRIVER_REGISTER */ -#ifdef DO_COMEDI_DRIVER_REGISTER +#if DO_COMEDI_DRIVER_REGISTER static struct comedi_driver das08_driver = { .driver_name = DRV_NAME, .module = THIS_MODULE, .attach = das08_attach, -#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) .attach_pci = das08_attach_pci, -#endif .detach = das08_detach, .board_name = &das08_boards[0].name, .num_names = sizeof(das08_boards) / sizeof(struct das08_board_struct), @@ -1170,7 +1156,7 @@ static struct pci_driver das08_pci_driver = { }; #endif /* CONFIG_COMEDI_DAS08_PCI */ -#ifdef DO_COMEDI_DRIVER_REGISTER +#if DO_COMEDI_DRIVER_REGISTER #if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) module_comedi_pci_driver(das08_driver, das08_pci_driver); #else -- cgit v0.10.2 From 4e2f002f7a9b316640eb06ef6df767f017e3e7b1 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 6 Jun 2012 15:17:02 +0100 Subject: staging: comedi: describe comedi_recognize() Add a comment to comedi_recognize() to describe what it does as it's a bit confusing. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 9d2b206..49e53ea 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -300,8 +300,32 @@ static int postconfig(struct comedi_device *dev) return 0; } -/* generic recognize function for drivers - * that register their supported board names */ +/* + * Generic recognize function for drivers that register their supported + * board names. + * + * 'driv->board_name' points to a 'const char *' member within the + * zeroth element of an array of some private board information + * structure, say 'struct foo_board' containing a member 'const char + * *board_name' that is initialized to point to a board name string that + * is one of the candidates matched against this function's 'name' + * parameter. + * + * 'driv->offset' is the size of the private board information + * structure, say 'sizeof(struct foo_board)', and 'driv->num_names' is + * the length of the array of private board information structures. + * + * If one of the board names in the array of private board information + * structures matches the name supplied to this function, the function + * returns a pointer to the pointer to the board name, otherwise it + * returns NULL. The return value ends up in the 'board_ptr' member of + * a 'struct comedi_device' that the low-level comedi driver's + * 'attach()' hook can convert to a point to a particular element of its + * array of private board information structures by subtracting the + * offset of the member that points to the board name. (No subtraction + * is required if the board name pointer is the first member of the + * private board information structure, which is generally the case.) + */ static void *comedi_recognize(struct comedi_driver *driv, const char *name) { char **name_ptr = (char **)driv->board_name; -- cgit v0.10.2 From 72fd9facfb697d5f7b61958bb10efaabbd8461eb Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 5 Jun 2012 10:18:02 -0700 Subject: staging: comedi: cleanup sysfs functions Make the comedi sysfs functions a bit more concise by shortening some of the verbose variable names and reusing some of the variables that were used for intermediate calculations. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 7677657..b3b86d4 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -172,28 +172,19 @@ static int resize_async_buffer(struct comedi_device *dev, /* sysfs attribute files */ -static const unsigned bytes_per_kibi = 1024; - static ssize_t show_max_read_buffer_kb(struct device *dev, struct device_attribute *attr, char *buf) { - ssize_t retval; struct comedi_device_file_info *info = dev_get_drvdata(dev); - unsigned max_buffer_size_kb = 0; - struct comedi_subdevice *const read_subdevice = - comedi_get_read_subdevice(info); + struct comedi_subdevice *s = comedi_get_read_subdevice(info); + unsigned int size = 0; mutex_lock(&info->device->mutex); - if (read_subdevice && - (read_subdevice->subdev_flags & SDF_CMD_READ) && - read_subdevice->async) { - max_buffer_size_kb = read_subdevice->async->max_bufsize / - bytes_per_kibi; - } - retval = snprintf(buf, PAGE_SIZE, "%i\n", max_buffer_size_kb); + if (s && (s->subdev_flags & SDF_CMD_READ) && s->async) + size = s->async->max_bufsize / 1024; mutex_unlock(&info->device->mutex); - return retval; + return snprintf(buf, PAGE_SIZE, "%i\n", size); } static ssize_t store_max_read_buffer_kb(struct device *dev, @@ -201,52 +192,40 @@ static ssize_t store_max_read_buffer_kb(struct device *dev, const char *buf, size_t count) { struct comedi_device_file_info *info = dev_get_drvdata(dev); - unsigned int new_max_size_kb; - unsigned int new_max_size; - int ret; - struct comedi_subdevice *const read_subdevice = - comedi_get_read_subdevice(info); - - ret = kstrtouint(buf, 10, &new_max_size_kb); - if (ret) - return ret; - if (new_max_size_kb > (UINT_MAX / bytes_per_kibi)) + struct comedi_subdevice *s = comedi_get_read_subdevice(info); + unsigned int size; + int err; + + err = kstrtouint(buf, 10, &size); + if (err) + return err; + if (size > (UINT_MAX / 1024)) return -EINVAL; - new_max_size = new_max_size_kb * bytes_per_kibi; + size *= 1024; mutex_lock(&info->device->mutex); - if (read_subdevice == NULL || - (read_subdevice->subdev_flags & SDF_CMD_READ) == 0 || - read_subdevice->async == NULL) { - mutex_unlock(&info->device->mutex); - return -EINVAL; - } - read_subdevice->async->max_bufsize = new_max_size; + if (s && (s->subdev_flags & SDF_CMD_READ) && s->async) + s->async->max_bufsize = size; + else + err = -EINVAL; mutex_unlock(&info->device->mutex); - return count; + return err ? err : count; } static ssize_t show_read_buffer_kb(struct device *dev, struct device_attribute *attr, char *buf) { - ssize_t retval; struct comedi_device_file_info *info = dev_get_drvdata(dev); - unsigned buffer_size_kb = 0; - struct comedi_subdevice *const read_subdevice = - comedi_get_read_subdevice(info); + struct comedi_subdevice *s = comedi_get_read_subdevice(info); + unsigned int size = 0; mutex_lock(&info->device->mutex); - if (read_subdevice && - (read_subdevice->subdev_flags & SDF_CMD_READ) && - read_subdevice->async) { - buffer_size_kb = read_subdevice->async->prealloc_bufsz / - bytes_per_kibi; - } - retval = snprintf(buf, PAGE_SIZE, "%i\n", buffer_size_kb); + if (s && (s->subdev_flags & SDF_CMD_READ) && s->async) + size = s->async->prealloc_bufsz / 1024; mutex_unlock(&info->device->mutex); - return retval; + return snprintf(buf, PAGE_SIZE, "%i\n", size); } static ssize_t store_read_buffer_kb(struct device *dev, @@ -254,57 +233,41 @@ static ssize_t store_read_buffer_kb(struct device *dev, const char *buf, size_t count) { struct comedi_device_file_info *info = dev_get_drvdata(dev); - unsigned int new_size_kb; - unsigned int new_size; - int retval; - int ret; - struct comedi_subdevice *const read_subdevice = - comedi_get_read_subdevice(info); - - ret = kstrtouint(buf, 10, &new_size_kb); - if (ret) - return ret; - if (new_size_kb > (UINT_MAX / bytes_per_kibi)) + struct comedi_subdevice *s = comedi_get_read_subdevice(info); + unsigned int size; + int err; + + err = kstrtouint(buf, 10, &size); + if (err) + return err; + if (size > (UINT_MAX / 1024)) return -EINVAL; - new_size = new_size_kb * bytes_per_kibi; + size *= 1024; mutex_lock(&info->device->mutex); - if (read_subdevice == NULL || - (read_subdevice->subdev_flags & SDF_CMD_READ) == 0 || - read_subdevice->async == NULL) { - mutex_unlock(&info->device->mutex); - return -EINVAL; - } - retval = resize_async_buffer(info->device, read_subdevice, - read_subdevice->async, new_size); + if (s && (s->subdev_flags & SDF_CMD_READ) && s->async) + err = resize_async_buffer(info->device, s, s->async, size); + else + err = -EINVAL; mutex_unlock(&info->device->mutex); - if (retval < 0) - return retval; - return count; + return err ? err : count; } static ssize_t show_max_write_buffer_kb(struct device *dev, struct device_attribute *attr, char *buf) { - ssize_t retval; struct comedi_device_file_info *info = dev_get_drvdata(dev); - unsigned max_buffer_size_kb = 0; - struct comedi_subdevice *const write_subdevice = - comedi_get_write_subdevice(info); + struct comedi_subdevice *s = comedi_get_write_subdevice(info); + unsigned int size = 0; mutex_lock(&info->device->mutex); - if (write_subdevice && - (write_subdevice->subdev_flags & SDF_CMD_WRITE) && - write_subdevice->async) { - max_buffer_size_kb = write_subdevice->async->max_bufsize / - bytes_per_kibi; - } - retval = snprintf(buf, PAGE_SIZE, "%i\n", max_buffer_size_kb); + if (s && (s->subdev_flags & SDF_CMD_WRITE) && s->async) + size = s->async->max_bufsize / 1024; mutex_unlock(&info->device->mutex); - return retval; + return snprintf(buf, PAGE_SIZE, "%i\n", size); } static ssize_t store_max_write_buffer_kb(struct device *dev, @@ -312,52 +275,40 @@ static ssize_t store_max_write_buffer_kb(struct device *dev, const char *buf, size_t count) { struct comedi_device_file_info *info = dev_get_drvdata(dev); - unsigned int new_max_size_kb; - unsigned int new_max_size; - int ret; - struct comedi_subdevice *const write_subdevice = - comedi_get_write_subdevice(info); - - ret = kstrtouint(buf, 10, &new_max_size_kb); - if (ret) - return ret; - if (new_max_size_kb > (UINT_MAX / bytes_per_kibi)) + struct comedi_subdevice *s = comedi_get_write_subdevice(info); + unsigned int size; + int err; + + err = kstrtouint(buf, 10, &size); + if (err) + return err; + if (size > (UINT_MAX / 1024)) return -EINVAL; - new_max_size = new_max_size_kb * bytes_per_kibi; + size *= 1024; mutex_lock(&info->device->mutex); - if (write_subdevice == NULL || - (write_subdevice->subdev_flags & SDF_CMD_WRITE) == 0 || - write_subdevice->async == NULL) { - mutex_unlock(&info->device->mutex); - return -EINVAL; - } - write_subdevice->async->max_bufsize = new_max_size; + if (s && (s->subdev_flags & SDF_CMD_WRITE) && s->async) + s->async->max_bufsize = size; + else + err = -EINVAL; mutex_unlock(&info->device->mutex); - return count; + return err ? err : count; } static ssize_t show_write_buffer_kb(struct device *dev, struct device_attribute *attr, char *buf) { - ssize_t retval; struct comedi_device_file_info *info = dev_get_drvdata(dev); - unsigned buffer_size_kb = 0; - struct comedi_subdevice *const write_subdevice = - comedi_get_write_subdevice(info); + struct comedi_subdevice *s = comedi_get_write_subdevice(info); + unsigned int size = 0; mutex_lock(&info->device->mutex); - if (write_subdevice && - (write_subdevice->subdev_flags & SDF_CMD_WRITE) && - write_subdevice->async) { - buffer_size_kb = write_subdevice->async->prealloc_bufsz / - bytes_per_kibi; - } - retval = snprintf(buf, PAGE_SIZE, "%i\n", buffer_size_kb); + if (s && (s->subdev_flags & SDF_CMD_WRITE) && s->async) + size = s->async->prealloc_bufsz / 1024; mutex_unlock(&info->device->mutex); - return retval; + return snprintf(buf, PAGE_SIZE, "%i\n", size); } static ssize_t store_write_buffer_kb(struct device *dev, @@ -365,34 +316,25 @@ static ssize_t store_write_buffer_kb(struct device *dev, const char *buf, size_t count) { struct comedi_device_file_info *info = dev_get_drvdata(dev); - unsigned int new_size_kb; - unsigned int new_size; - int retval; - int ret; - struct comedi_subdevice *const write_subdevice = - comedi_get_write_subdevice(info); - - ret = kstrtouint(buf, 10, &new_size_kb); - if (ret) - return ret; - if (new_size_kb > (UINT_MAX / bytes_per_kibi)) + struct comedi_subdevice *s = comedi_get_write_subdevice(info); + unsigned int size; + int err; + + err = kstrtouint(buf, 10, &size); + if (err) + return err; + if (size > (UINT_MAX / 1024)) return -EINVAL; - new_size = ((uint64_t) new_size_kb) * bytes_per_kibi; + size *= 1024; mutex_lock(&info->device->mutex); - if (write_subdevice == NULL || - (write_subdevice->subdev_flags & SDF_CMD_WRITE) == 0 || - write_subdevice->async == NULL) { - mutex_unlock(&info->device->mutex); - return -EINVAL; - } - retval = resize_async_buffer(info->device, write_subdevice, - write_subdevice->async, new_size); + if (s && (s->subdev_flags & SDF_CMD_WRITE) && s->async) + err = resize_async_buffer(info->device, s, s->async, size); + else + err = -EINVAL; mutex_unlock(&info->device->mutex); - if (retval < 0) - return retval; - return count; + return err ? err : count; } static struct device_attribute comedi_dev_attrs[] = { -- cgit v0.10.2 From 513e48f90a9d092ffcf8301b6ed10a8d8a5ebe77 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 5 Jun 2012 11:12:18 -0700 Subject: staging: comedi: ni_labpc: unlock spinlock on command error When starting the acquisition the labpc_ai_cmd function was exiting without unlocking the spinlock. This results in a sparse warning: warning: context imbalance in 'labpc_ai_cmd' - different lock contexts for basic block Add the missing spin_unlock_irqrestore calls. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c index 5334977..1d739b2 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.c +++ b/drivers/staging/comedi/drivers/ni_labpc.c @@ -1386,6 +1386,7 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) break; default: comedi_error(dev, "bug with start_src"); + spin_unlock_irqrestore(&dev->spinlock, flags); return -1; break; } @@ -1398,6 +1399,7 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) break; default: comedi_error(dev, "bug with stop_src"); + spin_unlock_irqrestore(&dev->spinlock, flags); return -1; } devpriv->write_byte(devpriv->command2_bits, dev->iobase + COMMAND2_REG); -- cgit v0.10.2 From 91211dd13bec5e87490770f5b530b39b50f5d2f8 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Wed, 6 Jun 2012 23:41:36 +0200 Subject: drivers/staging/comedi/drivers/me4000.c: adjust suspicious bit operation TRIG_ROUND_NEAREST is 0, so a bit-and with it is always false. The value TRIG_ROUND_MASK covers the bits of the TRIG_ROUND constants, so first pick those bits and then make the test using ==. The same is done for TRIG_ROUND_UP for symmetry, even though bit-and would be sufficient in this case. This problem was found using Coccinelle (http://coccinelle.lip6.fr/). Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index cb6bf8c..09890b8 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -948,10 +948,10 @@ static int ai_round_cmd_args(struct comedi_device *dev, *init_ticks = (cmd->start_arg * 33) / 1000; rest = (cmd->start_arg * 33) % 1000; - if (cmd->flags & TRIG_ROUND_NEAREST) { + if ((cmd->flags & TRIG_ROUND_MASK) == TRIG_ROUND_NEAREST) { if (rest > 33) (*init_ticks)++; - } else if (cmd->flags & TRIG_ROUND_UP) { + } else if ((cmd->flags & TRIG_ROUND_MASK) == TRIG_ROUND_UP) { if (rest) (*init_ticks)++; } @@ -961,10 +961,10 @@ static int ai_round_cmd_args(struct comedi_device *dev, *scan_ticks = (cmd->scan_begin_arg * 33) / 1000; rest = (cmd->scan_begin_arg * 33) % 1000; - if (cmd->flags & TRIG_ROUND_NEAREST) { + if ((cmd->flags & TRIG_ROUND_MASK) == TRIG_ROUND_NEAREST) { if (rest > 33) (*scan_ticks)++; - } else if (cmd->flags & TRIG_ROUND_UP) { + } else if ((cmd->flags & TRIG_ROUND_MASK) == TRIG_ROUND_UP) { if (rest) (*scan_ticks)++; } @@ -974,10 +974,10 @@ static int ai_round_cmd_args(struct comedi_device *dev, *chan_ticks = (cmd->convert_arg * 33) / 1000; rest = (cmd->convert_arg * 33) % 1000; - if (cmd->flags & TRIG_ROUND_NEAREST) { + if ((cmd->flags & TRIG_ROUND_MASK) == TRIG_ROUND_NEAREST) { if (rest > 33) (*chan_ticks)++; - } else if (cmd->flags & TRIG_ROUND_UP) { + } else if ((cmd->flags & TRIG_ROUND_MASK) == TRIG_ROUND_UP) { if (rest) (*chan_ticks)++; } -- cgit v0.10.2 From 47db6d58099437ddcec4fd2e572c95eba8c37cdd Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Thu, 7 Jun 2012 17:05:27 -0700 Subject: staging: comedi: refactor comedi_fops to remove most of the forward declarations Move the comedi_unlocked_ioctl function in order to remove most of the forward declarations in this file. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index b3b86d4..ad86347 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -92,36 +92,6 @@ static DEFINE_SPINLOCK(comedi_file_info_table_lock); static struct comedi_device_file_info *comedi_file_info_table[COMEDI_NUM_MINORS]; -static int do_devconfig_ioctl(struct comedi_device *dev, - struct comedi_devconfig __user *arg); -static int do_bufconfig_ioctl(struct comedi_device *dev, - struct comedi_bufconfig __user *arg); -static int do_devinfo_ioctl(struct comedi_device *dev, - struct comedi_devinfo __user *arg, - struct file *file); -static int do_subdinfo_ioctl(struct comedi_device *dev, - struct comedi_subdinfo __user *arg, void *file); -static int do_chaninfo_ioctl(struct comedi_device *dev, - struct comedi_chaninfo __user *arg); -static int do_bufinfo_ioctl(struct comedi_device *dev, - struct comedi_bufinfo __user *arg, void *file); -static int do_cmd_ioctl(struct comedi_device *dev, - struct comedi_cmd __user *arg, void *file); -static int do_lock_ioctl(struct comedi_device *dev, unsigned int arg, - void *file); -static int do_unlock_ioctl(struct comedi_device *dev, unsigned int arg, - void *file); -static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg, - void *file); -static int do_cmdtest_ioctl(struct comedi_device *dev, - struct comedi_cmd __user *arg, void *file); -static int do_insnlist_ioctl(struct comedi_device *dev, - struct comedi_insnlist __user *arg, void *file); -static int do_insn_ioctl(struct comedi_device *dev, - struct comedi_insn __user *arg, void *file); -static int do_poll_ioctl(struct comedi_device *dev, unsigned int subd, - void *file); - static void do_become_nonbusy(struct comedi_device *dev, struct comedi_subdevice *s); static int do_cancel(struct comedi_device *dev, struct comedi_subdevice *s); @@ -349,98 +319,6 @@ static struct device_attribute comedi_dev_attrs[] = { __ATTR_NULL }; -static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - const unsigned minor = iminor(file->f_dentry->d_inode); - struct comedi_device_file_info *dev_file_info = - comedi_get_device_file_info(minor); - struct comedi_device *dev; - int rc; - - if (dev_file_info == NULL || dev_file_info->device == NULL) - return -ENODEV; - dev = dev_file_info->device; - - mutex_lock(&dev->mutex); - - /* Device config is special, because it must work on - * an unconfigured device. */ - if (cmd == COMEDI_DEVCONFIG) { - rc = do_devconfig_ioctl(dev, - (struct comedi_devconfig __user *)arg); - goto done; - } - - if (!dev->attached) { - DPRINTK("no driver configured on /dev/comedi%i\n", dev->minor); - rc = -ENODEV; - goto done; - } - - switch (cmd) { - case COMEDI_BUFCONFIG: - rc = do_bufconfig_ioctl(dev, - (struct comedi_bufconfig __user *)arg); - break; - case COMEDI_DEVINFO: - rc = do_devinfo_ioctl(dev, (struct comedi_devinfo __user *)arg, - file); - break; - case COMEDI_SUBDINFO: - rc = do_subdinfo_ioctl(dev, - (struct comedi_subdinfo __user *)arg, - file); - break; - case COMEDI_CHANINFO: - rc = do_chaninfo_ioctl(dev, (void __user *)arg); - break; - case COMEDI_RANGEINFO: - rc = do_rangeinfo_ioctl(dev, (void __user *)arg); - break; - case COMEDI_BUFINFO: - rc = do_bufinfo_ioctl(dev, - (struct comedi_bufinfo __user *)arg, - file); - break; - case COMEDI_LOCK: - rc = do_lock_ioctl(dev, arg, file); - break; - case COMEDI_UNLOCK: - rc = do_unlock_ioctl(dev, arg, file); - break; - case COMEDI_CANCEL: - rc = do_cancel_ioctl(dev, arg, file); - break; - case COMEDI_CMD: - rc = do_cmd_ioctl(dev, (struct comedi_cmd __user *)arg, file); - break; - case COMEDI_CMDTEST: - rc = do_cmdtest_ioctl(dev, (struct comedi_cmd __user *)arg, - file); - break; - case COMEDI_INSNLIST: - rc = do_insnlist_ioctl(dev, - (struct comedi_insnlist __user *)arg, - file); - break; - case COMEDI_INSN: - rc = do_insn_ioctl(dev, (struct comedi_insn __user *)arg, - file); - break; - case COMEDI_POLL: - rc = do_poll_ioctl(dev, arg, file); - break; - default: - rc = -ENOTTY; - break; - } - -done: - mutex_unlock(&dev->mutex); - return rc; -} - /* COMEDI_DEVCONFIG device config ioctl @@ -1651,6 +1529,98 @@ static int do_poll_ioctl(struct comedi_device *dev, unsigned int arg, return -EINVAL; } +static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) +{ + const unsigned minor = iminor(file->f_dentry->d_inode); + struct comedi_device_file_info *dev_file_info = + comedi_get_device_file_info(minor); + struct comedi_device *dev; + int rc; + + if (dev_file_info == NULL || dev_file_info->device == NULL) + return -ENODEV; + dev = dev_file_info->device; + + mutex_lock(&dev->mutex); + + /* Device config is special, because it must work on + * an unconfigured device. */ + if (cmd == COMEDI_DEVCONFIG) { + rc = do_devconfig_ioctl(dev, + (struct comedi_devconfig __user *)arg); + goto done; + } + + if (!dev->attached) { + DPRINTK("no driver configured on /dev/comedi%i\n", dev->minor); + rc = -ENODEV; + goto done; + } + + switch (cmd) { + case COMEDI_BUFCONFIG: + rc = do_bufconfig_ioctl(dev, + (struct comedi_bufconfig __user *)arg); + break; + case COMEDI_DEVINFO: + rc = do_devinfo_ioctl(dev, (struct comedi_devinfo __user *)arg, + file); + break; + case COMEDI_SUBDINFO: + rc = do_subdinfo_ioctl(dev, + (struct comedi_subdinfo __user *)arg, + file); + break; + case COMEDI_CHANINFO: + rc = do_chaninfo_ioctl(dev, (void __user *)arg); + break; + case COMEDI_RANGEINFO: + rc = do_rangeinfo_ioctl(dev, (void __user *)arg); + break; + case COMEDI_BUFINFO: + rc = do_bufinfo_ioctl(dev, + (struct comedi_bufinfo __user *)arg, + file); + break; + case COMEDI_LOCK: + rc = do_lock_ioctl(dev, arg, file); + break; + case COMEDI_UNLOCK: + rc = do_unlock_ioctl(dev, arg, file); + break; + case COMEDI_CANCEL: + rc = do_cancel_ioctl(dev, arg, file); + break; + case COMEDI_CMD: + rc = do_cmd_ioctl(dev, (struct comedi_cmd __user *)arg, file); + break; + case COMEDI_CMDTEST: + rc = do_cmdtest_ioctl(dev, (struct comedi_cmd __user *)arg, + file); + break; + case COMEDI_INSNLIST: + rc = do_insnlist_ioctl(dev, + (struct comedi_insnlist __user *)arg, + file); + break; + case COMEDI_INSN: + rc = do_insn_ioctl(dev, (struct comedi_insn __user *)arg, + file); + break; + case COMEDI_POLL: + rc = do_poll_ioctl(dev, arg, file); + break; + default: + rc = -ENOTTY; + break; + } + +done: + mutex_unlock(&dev->mutex); + return rc; +} + static int do_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { int ret = 0; -- cgit v0.10.2 From 0bdf8ec0a57e5c4f90f4d6e83938f24653360d84 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Thu, 7 Jun 2012 17:31:19 -0700 Subject: staging: comedi: adl_pci9118: if test should use logical AND not bitwise AND This quiets a couple sparse warnings about: warning: dubious: !x & y Also, remove the unnecessary parentheses around the variables. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 3670ebd..5a5c903 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -1735,7 +1735,7 @@ static int check_channel_list(struct comedi_device *dev, "can't be mixtured!"); return 0; } - if ((!devpriv->usemux) & (differencial) & + if (!devpriv->usemux && differencial && (CR_CHAN(chanlist[i]) >= this_board->n_aichand)) { comedi_error(dev, "If AREF_DIFF is used then is " -- cgit v0.10.2 From e26d925f42064a800c1226e15dbaa23da1721fb7 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Thu, 7 Jun 2012 17:25:35 -0700 Subject: staging: comedi: pcl816: if test should use logical OR not bitwise OR This quiets a couple sparse warnings about: warning: dubious: !x | !y warning: dubious: x | !y Also, remove the unnecessary parentheses abound the variables. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c index 277a23e..845039c 100644 --- a/drivers/staging/comedi/drivers/pcl816.c +++ b/drivers/staging/comedi/drivers/pcl816.c @@ -414,8 +414,8 @@ static irqreturn_t interrupt_pcl816(int irq, void *d) } outb(0, dev->iobase + PCL816_CLRINT); /* clear INT request */ - if ((!dev->irq) | (!devpriv->irq_free) | (!devpriv->irq_blocked) | - (!devpriv->int816_mode)) { + if (!dev->irq || !devpriv->irq_free || !devpriv->irq_blocked || + !devpriv->int816_mode) { if (devpriv->irq_was_now_closed) { devpriv->irq_was_now_closed = 0; /* comedi_error(dev,"last IRQ.."); */ -- cgit v0.10.2 From 27494c092a81847fef515549b76251d96b760619 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Thu, 7 Jun 2012 17:14:25 -0700 Subject: staging: comedi: serial2002: quiet NULL pointer sparse noise Quiet a number of sparse warnings in this file: warning: Using plain integer as NULL pointer Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c index 9200310..c25808c 100644 --- a/drivers/staging/comedi/drivers/serial2002.c +++ b/drivers/staging/comedi/drivers/serial2002.c @@ -643,7 +643,7 @@ err_alloc_configs: if (result) { if (devpriv->tty) { - filp_close(devpriv->tty, 0); + filp_close(devpriv->tty, NULL); devpriv->tty = NULL; } } @@ -653,8 +653,8 @@ err_alloc_configs: static void serial_2002_close(struct comedi_device *dev) { - if (!IS_ERR(devpriv->tty) && (devpriv->tty != 0)) - filp_close(devpriv->tty, 0); + if (!IS_ERR(devpriv->tty) && devpriv->tty) + filp_close(devpriv->tty, NULL); } static int serial2002_di_rinsn(struct comedi_device *dev, @@ -819,7 +819,7 @@ static int serial2002_attach(struct comedi_device *dev, s->subdev_flags = SDF_READABLE | SDF_GROUND; s->n_chan = 0; s->maxdata = 1; - s->range_table = 0; + s->range_table = NULL; s->insn_read = &serial2002_ai_rinsn; /* analog output subdevice */ @@ -828,7 +828,7 @@ static int serial2002_attach(struct comedi_device *dev, s->subdev_flags = SDF_WRITEABLE; s->n_chan = 0; s->maxdata = 1; - s->range_table = 0; + s->range_table = NULL; s->insn_write = &serial2002_ao_winsn; s->insn_read = &serial2002_ao_rinsn; @@ -838,7 +838,7 @@ static int serial2002_attach(struct comedi_device *dev, s->subdev_flags = SDF_READABLE | SDF_LSAMPL; s->n_chan = 0; s->maxdata = 1; - s->range_table = 0; + s->range_table = NULL; s->insn_read = &serial2002_ei_rinsn; return 1; -- cgit v0.10.2 From f59f231e3db835353d8d1ff91062d89140dc8be3 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 8 Jun 2012 09:52:58 +0300 Subject: staging: comedi: amplc_pci230: add a missing unlock This side of the if else statement returned with the lock held and IRQs disabled. Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index 30487be..f2ad35c 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -1387,6 +1387,8 @@ static int pci230_ao_inttrig_scan_begin(struct comedi_device *dev, /* Delay. Should driver be responsible for this? */ /* XXX TODO: See if DAC busy bit can be used. */ udelay(8); + } else { + spin_unlock_irqrestore(&devpriv->ao_stop_spinlock, irqflags); } return 1; -- cgit v0.10.2 From 83afda9d449c61b55881d50465833784d8fda786 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Jun 2012 10:40:05 +0100 Subject: staging: comedi: amplc_pci230: Replace NULLFUNC The source code defines a macro NULLFUNC #define NULLFUNC 0 and uses it as a generic null function pointer constant. This is superfluous. Just use NULL instead. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index f2ad35c..2a43df5 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -430,9 +430,6 @@ enum { /* Combine old and new bits. */ #define COMBINE(old, new, mask) (((old) & ~(mask)) | ((new) & (mask))) -/* A generic null function pointer value. */ -#define NULLFUNC 0 - /* Current CPU. XXX should this be hard_smp_processor_id()? */ #define THISCPU smp_processor_id() @@ -1491,7 +1488,7 @@ static int pci230_ao_inttrig_start(struct comedi_device *dev, if (trig_num != 0) return -EINVAL; - s->async->inttrig = NULLFUNC; + s->async->inttrig = NULL; pci230_ao_start(dev, s); return 1; @@ -2292,7 +2289,7 @@ static int pci230_ai_inttrig_start(struct comedi_device *dev, if (trig_num != 0) return -EINVAL; - s->async->inttrig = NULLFUNC; + s->async->inttrig = NULL; pci230_ai_start(dev, s); return 1; -- cgit v0.10.2 From cbdfaffc461fd3df12f494655aca5cae68d6c7aa Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Jun 2012 10:39:42 +0100 Subject: staging: comedi: amplc_pci224: Replace NULLFUNC The source code defines a macro NULLFUNC #define NULLFUNC 0 and uses it as a generic null function pointer constant. This is superfluous. Just use NULL instead. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index 43f07f8..a1e23ba 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -265,9 +265,6 @@ Caveats: /* Combine old and new bits. */ #define COMBINE(old, new, mask) (((old) & ~(mask)) | ((new) & (mask))) -/* A generic null function pointer value. */ -#define NULLFUNC 0 - /* Current CPU. XXX should this be hard_smp_processor_id()? */ #define THISCPU smp_processor_id() @@ -703,7 +700,7 @@ pci224_ao_inttrig_start(struct comedi_device *dev, struct comedi_subdevice *s, if (trignum != 0) return -EINVAL; - s->async->inttrig = NULLFUNC; + s->async->inttrig = NULL; pci224_ao_start(dev, s); return 1; -- cgit v0.10.2 From f059077388b0c35cd47ee06ba5da3401a62dc657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Wed, 6 Jun 2012 16:22:04 +0200 Subject: Staging: xgifb: Remove #ifdef MODULE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Check for MODULE is not needed. In a static compilation the parameters definition is valid and module_exit() does nothing. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 85dbf32..61dc7cb 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -2325,8 +2325,6 @@ module_init(xgifb_init); /* MODULE */ /*****************************************************/ -#ifdef MODULE - MODULE_DESCRIPTION("Z7 Z9 Z9S Z11 framebuffer device driver"); MODULE_LICENSE("GPL"); MODULE_AUTHOR("XGITECH , Others"); @@ -2359,5 +2357,3 @@ static void __exit xgifb_remove_module(void) } module_exit(xgifb_remove_module); - -#endif /* /MODULE */ -- cgit v0.10.2 From d049053ef052535c8986f104f904548dfcaa14aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Wed, 6 Jun 2012 16:22:05 +0200 Subject: Staging: xgifb: reorder the code a bit to be more module friendly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 61dc7cb..96abb23 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -2306,49 +2306,44 @@ static struct pci_driver xgifb_driver = { .remove = __devexit_p(xgifb_remove) }; -static int __init xgifb_init(void) -{ - char *option = NULL; - - if (forcecrt2type != NULL) - XGIfb_search_crt2type(forcecrt2type); - if (fb_get_options("xgifb", &option)) - return -ENODEV; - XGIfb_setup(option); - - return pci_register_driver(&xgifb_driver); -} -module_init(xgifb_init); /*****************************************************/ /* MODULE */ /*****************************************************/ -MODULE_DESCRIPTION("Z7 Z9 Z9S Z11 framebuffer device driver"); -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("XGITECH , Others"); - module_param(mode, charp, 0); -module_param(vesa, int, 0); -module_param(filter, int, 0); -module_param(forcecrt2type, charp, 0); +MODULE_PARM_DESC(mode, + "\nSelects the desired default display mode in the format XxYxDepth,\n" + "eg. 1024x768x16.\n"); +module_param(forcecrt2type, charp, 0); MODULE_PARM_DESC(forcecrt2type, "\nForce the second display output type. Possible values are NONE,\n" "LCD, TV, VGA, SVIDEO or COMPOSITE.\n"); -MODULE_PARM_DESC(mode, - "\nSelects the desired default display mode in the format XxYxDepth,\n" - "eg. 1024x768x16.\n"); - +module_param(vesa, int, 0); MODULE_PARM_DESC(vesa, "\nSelects the desired default display mode by VESA mode number, eg.\n" "0x117.\n"); +module_param(filter, int, 0); MODULE_PARM_DESC(filter, - "\nSelects TV flicker filter type (only for systems with a SiS301 video bridge).\n" - "(Possible values 0-7, default: [no filter])\n"); + "\nSelects TV flicker filter type (only for systems with a SiS301 video bridge).\n" + "(Possible values 0-7, default: [no filter])\n"); + +static int __init xgifb_init(void) +{ + char *option = NULL; + + if (forcecrt2type != NULL) + XGIfb_search_crt2type(forcecrt2type); + if (fb_get_options("xgifb", &option)) + return -ENODEV; + XGIfb_setup(option); + + return pci_register_driver(&xgifb_driver); +} static void __exit xgifb_remove_module(void) { @@ -2356,4 +2351,8 @@ static void __exit xgifb_remove_module(void) pr_debug("Module unloaded\n"); } +MODULE_DESCRIPTION("Z7 Z9 Z9S Z11 framebuffer device driver"); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("XGITECH , Others"); +module_init(xgifb_init); module_exit(xgifb_remove_module); -- cgit v0.10.2 From 05e06036ddffd3e285bddc23e4ce55f54cd27537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Wed, 6 Jun 2012 16:22:06 +0200 Subject: Staging: xgifb: disable pci device if there's an error after enabling it. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 96abb23..438781f 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -1904,7 +1904,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, if (reg1 != 0xa1) { /*I/O error */ pr_err("I/O error!!!"); ret = -EIO; - goto error; + goto error_disable; } switch (xgifb_info->chip_id) { @@ -1927,7 +1927,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, break; default: ret = -ENODEV; - goto error; + goto error_disable; } pr_info("chipid = %x\n", xgifb_info->chip); @@ -1936,7 +1936,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, if (XGIfb_get_dram_size(xgifb_info)) { pr_err("Fatal error: Unable to determine RAM size.\n"); ret = -ENODEV; - goto error; + goto error_disable; } /* Enable PCI_LINEAR_ADDRESSING and MMIO_ENABLE */ @@ -1956,7 +1956,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, pr_err("Fatal error: Unable to reserve frame buffer memory\n"); pr_err("Is there another framebuffer driver active?\n"); ret = -ENODEV; - goto error; + goto error_disable; } if (!request_mem_region(xgifb_info->mmio_base, @@ -2271,6 +2271,8 @@ error_1: release_mem_region(xgifb_info->mmio_base, xgifb_info->mmio_size); error_0: release_mem_region(xgifb_info->video_base, xgifb_info->video_size); +error_disable: + pci_disable_device(pdev); error: framebuffer_release(fb_info); return ret; -- cgit v0.10.2 From bf55b48371d1ca6ee64152753b359924e3cfcbcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Wed, 6 Jun 2012 16:22:07 +0200 Subject: Staging: xgifb: disable pci device on pci remove function. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 438781f..033463d 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -2297,6 +2297,7 @@ static void __devexit xgifb_remove(struct pci_dev *pdev) iounmap(xgifb_info->video_vbase); release_mem_region(xgifb_info->mmio_base, xgifb_info->mmio_size); release_mem_region(xgifb_info->video_base, xgifb_info->video_size); + pci_disable_device(pdev); framebuffer_release(fb_info); pci_set_drvdata(pdev, NULL); } -- cgit v0.10.2 From 1132b9aafa61bb589a2c09980d13c154659bdb07 Mon Sep 17 00:00:00 2001 From: Bart Westgeest Date: Mon, 11 Jun 2012 16:57:30 -0400 Subject: staging: usbip: Updated comment describing VHCI_NPORTS Updated out-of-date comment describing VHCI_NPORT Signed-off-by: Bart Westgeest Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/usbip/vhci.h b/drivers/staging/usbip/vhci.h index 88b3298..c66b8b3 100644 --- a/drivers/staging/usbip/vhci.h +++ b/drivers/staging/usbip/vhci.h @@ -71,12 +71,7 @@ struct vhci_unlink { unsigned long unlink_seqnum; }; -/* - * The number of ports is less than 16 ? - * USB_MAXCHILDREN is statically defined to 16 in usb.h. Its maximum value - * would be 31 because the event_bits[1] of struct usb_hub is defined as - * unsigned long in hub.h - */ +/* Number of supported ports. Value has an upperbound of USB_MAXCHILDREN */ #define VHCI_NPORTS 8 /* for usb_bus.hcpriv */ -- cgit v0.10.2 From 1caba565e13a867107ca78a316d6076c7b6a740c Mon Sep 17 00:00:00 2001 From: Adnan Ali Date: Mon, 28 May 2012 16:07:49 +0100 Subject: Staging: cptm1217: clearpad_tm1217: fix coding style issues This commit fixes coding style issues including quoted string across multiple lines. Signed-off-by: Adnan Ali Acked-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/cptm1217/clearpad_tm1217.c b/drivers/staging/cptm1217/clearpad_tm1217.c index 5456f82..0d924d3 100644 --- a/drivers/staging/cptm1217/clearpad_tm1217.c +++ b/drivers/staging/cptm1217/clearpad_tm1217.c @@ -396,8 +396,8 @@ static int cp_tm1217_setup_gpio_irq(struct cp_tm1217_device *ts) retval = gpio_to_irq(ts->gpio); if (retval < 0) { - dev_err(ts->dev, "cp_tm1217: GPIO to IRQ failedi," - " error %d\n", retval); + dev_err(ts->dev, + "cp_tm1217: GPIO to IRQ failed, error %d\n", retval); gpio_free(ts->gpio); } dev_dbg(ts->dev, -- cgit v0.10.2 From 2e0bec91399bab115d2a3a60288ce94a977f49c1 Mon Sep 17 00:00:00 2001 From: Adnan Ali Date: Mon, 28 May 2012 17:11:29 +0100 Subject: Staging: sep: fix coding style issues This commit fixes coding style issues related to string split across the lines and space before tab at start of line. Signed-off-by: Adnan Ali Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sep/sep_crypto.c b/drivers/staging/sep/sep_crypto.c index 1cc790e..9fd9da8 100644 --- a/drivers/staging/sep/sep_crypto.c +++ b/drivers/staging/sep/sep_crypto.c @@ -1095,8 +1095,8 @@ static int sep_crypto_take_sep(struct this_task_ctx *ta_ctx) current->comm, sizeof(current->comm)); if (!ta_ctx->queue_elem) { - dev_dbg(&sep->pdev->dev, "[PID%d] updating queue" - " status error\n", current->pid); + dev_dbg(&sep->pdev->dev, + "[PID%d] updating queue status error\n", current->pid); return -EINVAL; } diff --git a/drivers/staging/sep/sep_main.c b/drivers/staging/sep/sep_main.c index df1d13e..ab35128 100644 --- a/drivers/staging/sep/sep_main.c +++ b/drivers/staging/sep/sep_main.c @@ -1436,8 +1436,9 @@ static int sep_lli_table_secure_dma(struct sep_device *sep, start_page = app_virt_addr >> PAGE_SHIFT; num_pages = end_page - start_page + 1; - dev_dbg(&sep->pdev->dev, "[PID%d] lock user pages" - " app_virt_addr is %x\n", current->pid, app_virt_addr); + dev_dbg(&sep->pdev->dev, + "[PID%d] lock user pages app_virt_addr is %x\n", + current->pid, app_virt_addr); dev_dbg(&sep->pdev->dev, "[PID%d] data_size is (hex) %x\n", current->pid, data_size); @@ -1931,9 +1932,9 @@ static int sep_prepare_input_dma_table(struct sep_device *sep, void *dma_lli_table_alloc_addr = NULL; void *dma_in_lli_table_ptr = NULL; - dev_dbg(&sep->pdev->dev, "[PID%d] prepare intput dma " - "tbl data size: (hex) %x\n", - current->pid, data_size); + dev_dbg(&sep->pdev->dev, + "[PID%d] prepare intput dma tbl data size: (hex) %x\n", + current->pid, data_size); dev_dbg(&sep->pdev->dev, "[PID%d] block_size is (hex) %x\n", current->pid, block_size); @@ -2542,17 +2543,18 @@ static int sep_prepare_input_output_dma_table(struct sep_device *sep, } } - dev_dbg(&sep->pdev->dev, "[PID%d] After lock; prep input output dma " - "table sep_in_num_pages is (hex) %x\n", current->pid, + dev_dbg(&sep->pdev->dev, + "[PID%d] After lock; prep input output dma table sep_in_num_pages is (hex) %x\n", + current->pid, dma_ctx->dma_res_arr[dma_ctx->nr_dcb_creat].in_num_pages); dev_dbg(&sep->pdev->dev, "[PID%d] sep_out_num_pages is (hex) %x\n", current->pid, dma_ctx->dma_res_arr[dma_ctx->nr_dcb_creat].out_num_pages); - dev_dbg(&sep->pdev->dev, "[PID%d] SEP_DRIVER_ENTRIES_PER_TABLE_IN_SEP" - " is (hex) %x\n", current->pid, - SEP_DRIVER_ENTRIES_PER_TABLE_IN_SEP); + dev_dbg(&sep->pdev->dev, + "[PID%d] SEP_DRIVER_ENTRIES_PER_TABLE_IN_SEP is (hex) %x\n", + current->pid, SEP_DRIVER_ENTRIES_PER_TABLE_IN_SEP); /* Call the fucntion that creates table from the lli arrays */ dev_dbg(&sep->pdev->dev, "[PID%d] calling create table from lli\n", @@ -3844,8 +3846,9 @@ static ssize_t sep_write(struct file *filp, * buffers created. Only SEP_DOUBLEBUF_USERS_LIMIT number * of threads can progress further at a time */ - dev_dbg(&sep->pdev->dev, "[PID%d] waiting for double buffering " - "region access\n", current->pid); + dev_dbg(&sep->pdev->dev, + "[PID%d] waiting for double buffering region access\n", + current->pid); error = down_interruptible(&sep->sep_doublebuf); dev_dbg(&sep->pdev->dev, "[PID%d] double buffering region start\n", current->pid); @@ -3889,8 +3892,8 @@ static ssize_t sep_write(struct file *filp, current->comm, sizeof(current->comm)); if (!my_queue_elem) { - dev_dbg(&sep->pdev->dev, "[PID%d] updating queue" - "status error\n", current->pid); + dev_dbg(&sep->pdev->dev, + "[PID%d] updating queue status error\n", current->pid); error = -ENOMEM; goto end_function_error_doublebuf; } @@ -4155,8 +4158,8 @@ static int __devinit sep_probe(struct pci_dev *pdev, INIT_LIST_HEAD(&sep->sep_queue_status); - dev_dbg(&sep->pdev->dev, "sep probe: PCI obtained, " - "device being prepared\n"); + dev_dbg(&sep->pdev->dev, + "sep probe: PCI obtained, device being prepared\n"); /* Set up our register area */ sep->reg_physical_addr = pci_resource_start(sep->pdev, 0); @@ -4318,7 +4321,7 @@ static void sep_remove(struct pci_dev *pdev) static DEFINE_PCI_DEVICE_TABLE(sep_pci_id_tbl) = { {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0826)}, {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x08e9)}, - {0} + {0} }; /* Export our pci_device_id structure to user space */ -- cgit v0.10.2 From 6ee19aef7694e9533617573ebe8a0b379d5c75f4 Mon Sep 17 00:00:00 2001 From: Adnan Ali Date: Tue, 29 May 2012 11:33:03 +0100 Subject: Staging: ramster: r2net: fix coding style issues This commit fixes coding style issues related to string splite across multiple lines. Signed-off-by: Adnan Ali Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ramster/r2net.c b/drivers/staging/ramster/r2net.c index 2ee0220..fc830c3 100644 --- a/drivers/staging/ramster/r2net.c +++ b/drivers/staging/ramster/r2net.c @@ -266,8 +266,8 @@ int ramster_remote_put(struct tmem_xhandle *xh, char *data, size_t size, static unsigned long cnt; cnt++; if (!(cnt&(cnt-1))) - pr_err("ramster_remote_put: message failed, " - "ret=%d, cnt=%lu\n", ret, cnt); + pr_err("ramster_remote_put: message failed, ret=%d, cnt=%lu\n", + ret, cnt); ret = -1; } #endif -- cgit v0.10.2 From ff5e4a1d2702582614996f6f6d005e9b5caadeb8 Mon Sep 17 00:00:00 2001 From: Adnan Ali Date: Thu, 31 May 2012 11:32:48 +0100 Subject: Staging: gdm72xx: gdm_usb: fix deprecated function kernel_thread This commit fixes deprecated function kernel_thread by replacing it with kthread_run. Signed-off-by: Adnan Ali Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/gdm72xx/gdm_usb.c b/drivers/staging/gdm72xx/gdm_usb.c index 1e9dc0d..19533c6 100644 --- a/drivers/staging/gdm72xx/gdm_usb.c +++ b/drivers/staging/gdm72xx/gdm_usb.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "gdm_usb.h" #include "gdm_wimax.h" @@ -775,7 +776,7 @@ static struct usb_driver gdm_usb_driver = { static int __init usb_gdm_wimax_init(void) { #ifdef CONFIG_WIMAX_GDM72XX_K_MODE - kernel_thread(k_mode_thread, NULL, CLONE_KERNEL); + kthread_run(k_mode_thread, NULL, "WiMax_thread"); #endif /* CONFIG_WIMAX_GDM72XX_K_MODE */ return usb_register(&gdm_usb_driver); } -- cgit v0.10.2 From dee0dc0d0649b028e16473a8e2410efd455135c2 Mon Sep 17 00:00:00 2001 From: Adnan Ali Date: Tue, 29 May 2012 15:21:20 +0100 Subject: Staging: rts5139: sd_cprm: fix coding style and deprecation issues This commit fixes coding style and deprecation issues which includes long lines, braces with single statments in if condition and deprecated min() function. Signed-off-by: Adnan Ali Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/rts5139/sd_cprm.c b/drivers/staging/rts5139/sd_cprm.c index f8c6071..0167f7f 100644 --- a/drivers/staging/rts5139/sd_cprm.c +++ b/drivers/staging/rts5139/sd_cprm.c @@ -201,9 +201,8 @@ RTY_SEND_CMD: if (buf[1] & 0x80) TRACE_RET(chip, STATUS_FAIL); } - if (buf[1] & 0x7F) { + if (buf[1] & 0x7F) TRACE_RET(chip, STATUS_FAIL); - } if (buf[2] & 0xF8) TRACE_RET(chip, STATUS_FAIL); @@ -224,7 +223,8 @@ RTY_SEND_CMD: return STATUS_SUCCESS; } -static int ext_sd_get_rsp(struct rts51x_chip *chip, int len, u8 *rsp, u8 rsp_type) +static int ext_sd_get_rsp(struct rts51x_chip *chip, int len, + u8 *rsp, u8 rsp_type) { int retval, rsp_len; u16 reg_addr; @@ -844,7 +844,7 @@ int sd_pass_thru_mode(struct scsi_cmnd *srb, struct rts51x_chip *chip) buf[15] = chip->max_lun; - len = min(18, (int)scsi_bufflen(srb)); + len = min_t(unsigned, 18, scsi_bufflen(srb)); rts51x_set_xfer_buf(buf, len, srb); return TRANSPORT_GOOD; -- cgit v0.10.2 From 02fd3b3670fb99017b17757d33a0a17e2405920c Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Mon, 28 May 2012 01:53:22 +0530 Subject: staging/gdm72xx: Remove version.h includes Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/gdm72xx/gdm_qos.c b/drivers/staging/gdm72xx/gdm_qos.c index 0217680..e7134e2 100644 --- a/drivers/staging/gdm72xx/gdm_qos.c +++ b/drivers/staging/gdm72xx/gdm_qos.c @@ -11,7 +11,6 @@ * GNU General Public License for more details. */ -#include #include #include diff --git a/drivers/staging/gdm72xx/gdm_sdio.c b/drivers/staging/gdm72xx/gdm_sdio.c index e1a3dd2..5e19b09 100644 --- a/drivers/staging/gdm72xx/gdm_sdio.c +++ b/drivers/staging/gdm72xx/gdm_sdio.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include diff --git a/drivers/staging/gdm72xx/gdm_usb.c b/drivers/staging/gdm72xx/gdm_usb.c index 19533c6..e201b34 100644 --- a/drivers/staging/gdm72xx/gdm_usb.c +++ b/drivers/staging/gdm72xx/gdm_usb.c @@ -12,7 +12,6 @@ */ #include -#include #include #include #include diff --git a/drivers/staging/gdm72xx/gdm_wimax.c b/drivers/staging/gdm72xx/gdm_wimax.c index f1936b9..110bdbc 100644 --- a/drivers/staging/gdm72xx/gdm_wimax.c +++ b/drivers/staging/gdm72xx/gdm_wimax.c @@ -11,7 +11,6 @@ * GNU General Public License for more details. */ -#include #include #include #include diff --git a/drivers/staging/gdm72xx/gdm_wimax.h b/drivers/staging/gdm72xx/gdm_wimax.h index 023e649..6ec0ab4 100644 --- a/drivers/staging/gdm72xx/gdm_wimax.h +++ b/drivers/staging/gdm72xx/gdm_wimax.h @@ -15,7 +15,6 @@ #define __GDM_WIMAX_H__ #include -#include #include #include "wm_ioctl.h" #if defined(CONFIG_WIMAX_GDM72XX_QOS) diff --git a/drivers/staging/gdm72xx/netlink_k.c b/drivers/staging/gdm72xx/netlink_k.c index 292af0f..1c74b08 100644 --- a/drivers/staging/gdm72xx/netlink_k.c +++ b/drivers/staging/gdm72xx/netlink_k.c @@ -11,7 +11,6 @@ * GNU General Public License for more details. */ -#include #include #include #include diff --git a/drivers/staging/gdm72xx/sdio_boot.c b/drivers/staging/gdm72xx/sdio_boot.c index 6ff4dc3..760efee 100644 --- a/drivers/staging/gdm72xx/sdio_boot.c +++ b/drivers/staging/gdm72xx/sdio_boot.c @@ -12,7 +12,6 @@ */ #include -#include #include #include #include diff --git a/drivers/staging/gdm72xx/usb_boot.c b/drivers/staging/gdm72xx/usb_boot.c index 5a0e030..c163bcc 100644 --- a/drivers/staging/gdm72xx/usb_boot.c +++ b/drivers/staging/gdm72xx/usb_boot.c @@ -13,7 +13,6 @@ #include #include -#include #include #include #include -- cgit v0.10.2 From ef73b7a45dfd3c4cdd447a6767422349e5fe7242 Mon Sep 17 00:00:00 2001 From: "Justin P. Mattock" Date: Mon, 4 Jun 2012 07:46:52 -0700 Subject: staging: "sbe-2t3e3" Fix typos in sbe-2t3e3 Signed-off-by: Justin P. Mattock Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sbe-2t3e3/dc.c b/drivers/staging/sbe-2t3e3/dc.c index 9dc4ec2..e897a43 100644 --- a/drivers/staging/sbe-2t3e3/dc.c +++ b/drivers/staging/sbe-2t3e3/dc.c @@ -81,7 +81,7 @@ void dc_init(struct channel *sc) SBE_2T3E3_21143_VAL_NUMBER_OF_RECEIVE_PACKETS; dc_write(sc->addr, SBE_2T3E3_21143_REG_GENERAL_PURPOSE_TIMER_AND_INTERRUPT_MITIGATION_CONTROL, val); - /* prepare descriptors and data for receive and transmit procecsses */ + /* prepare descriptors and data for receive and transmit processes */ if (dc_init_descriptor_list(sc) != 0) return; diff --git a/drivers/staging/sbe-2t3e3/io.c b/drivers/staging/sbe-2t3e3/io.c index 9a50bcc..d2391cb 100644 --- a/drivers/staging/sbe-2t3e3/io.c +++ b/drivers/staging/sbe-2t3e3/io.c @@ -17,7 +17,7 @@ /* All access to registers done via the 21143 on port 0 must be * protected via the card->bootrom_lock. */ -/* priviate define to be used here only - must be protected by card->bootrom_lock */ +/* private define to be used here only - must be protected by card->bootrom_lock */ #define cpld_write_nolock(channel, reg, val) \ bootrom_write((channel), CPLD_MAP_REG(reg, channel), val) -- cgit v0.10.2 From 8aac4d443980a4b5833b6896169c30d22e4cce74 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Wed, 6 Jun 2012 01:10:50 +0530 Subject: staging/wlan-ng: cfg80211.c coding style cleanup there are warnings that are reported by checkpatch.pl fixed the following problems drivers/staging/wlan-ng/cfg80211.c:130: WARNING: line over 80 characters drivers/staging/wlan-ng/cfg80211.c:366: WARNING: line over 80 characters drivers/staging/wlan-ng/cfg80211.c:543: WARNING: line over 80 characters drivers/staging/wlan-ng/cfg80211.c:665: WARNING: line over 80 characters drivers/staging/wlan-ng/cfg80211.c:692: WARNING: line over 80 characters drivers/staging/wlan-ng/cfg80211.c:735: WARNING: line over 80 characters Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c index 8bc562b..fabff4d 100644 --- a/drivers/staging/wlan-ng/cfg80211.c +++ b/drivers/staging/wlan-ng/cfg80211.c @@ -127,7 +127,9 @@ int prism2_change_virtual_intf(struct wiphy *wiphy, } /* Set Operation mode to the PORT TYPE RID */ - result = prism2_domibset_uint32(wlandev, DIDmib_p2_p2Static_p2CnfPortType, data); + result = prism2_domibset_uint32(wlandev, + DIDmib_p2_p2Static_p2CnfPortType, + data); if (result) err = -EFAULT; @@ -363,7 +365,8 @@ int prism2_scan(struct wiphy *wiphy, struct net_device *dev, if (request->n_ssids > 0) { msg1.scantype.data = P80211ENUM_scantype_active; msg1.ssid.data.len = request->ssids->ssid_len; - memcpy(msg1.ssid.data.data, request->ssids->ssid, request->ssids->ssid_len); + memcpy(msg1.ssid.data.data, + request->ssids->ssid, request->ssids->ssid_len); } else { msg1.scantype.data = 0; } @@ -540,7 +543,9 @@ int prism2_connect(struct wiphy *wiphy, struct net_device *dev, goto exit; } - result = prism2_domibset_pstr32(wlandev, did, sme->key_len, (u8 *) sme->key); + result = prism2_domibset_pstr32(wlandev, + did, sme->key_len, + (u8 *)sme->key); if (result) goto exit; @@ -662,10 +667,11 @@ int prism2_get_tx_power(struct wiphy *wiphy, int *dbm) struct prism2_wiphy_private *priv = wiphy_priv(wiphy); wlandevice_t *wlandev = priv->wlandev; struct p80211msg_dot11req_mibget msg; - p80211item_uint32_t *mibitem = (p80211item_uint32_t *) &msg.mibattribute.data; + p80211item_uint32_t *mibitem; int result; int err = 0; + mibitem = (p80211item_uint32_t *) &msg.mibattribute.data; msg.msgcode = DIDmsg_dot11req_mibget; mibitem->did = DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel; @@ -689,7 +695,8 @@ exit: /* Interface callback functions, passing data back up to the cfg80211 layer */ void prism2_connect_result(wlandevice_t *wlandev, u8 failed) { - u16 status = failed ? WLAN_STATUS_UNSPECIFIED_FAILURE : WLAN_STATUS_SUCCESS; + u16 status = failed ? + WLAN_STATUS_UNSPECIFIED_FAILURE : WLAN_STATUS_SUCCESS; cfg80211_connect_result(wlandev->netdev, wlandev->bssid, NULL, 0, NULL, 0, status, GFP_KERNEL); @@ -732,7 +739,8 @@ struct wiphy *wlan_create_wiphy(struct device *dev, wlandevice_t *wlandev) { struct wiphy *wiphy; struct prism2_wiphy_private *priv; - wiphy = wiphy_new(&prism2_usb_cfg_ops, sizeof(struct prism2_wiphy_private)); + + wiphy = wiphy_new(&prism2_usb_cfg_ops, sizeof(*priv)); if (!wiphy) return NULL; -- cgit v0.10.2 From cf66823dd224294f40ad6ddced70e80bae940741 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Wed, 6 Jun 2012 01:12:06 +0530 Subject: staging/wlan-ng: prsim2fw.c coding style cleanup this patch fixes the coding style problems found by using checkpatch.pl drivers/staging/wlan-ng/prism2fw.c:175: ERROR: "foo * bar" should be "foo *bar" drivers/staging/wlan-ng/prism2fw.c:210: WARNING: line over 80 characters drivers/staging/wlan-ng/prism2fw.c:596: WARNING: line over 80 characters drivers/staging/wlan-ng/prism2fw.c:658: ERROR: "foo * bar" should be "foo *bar" Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/wlan-ng/prism2fw.c b/drivers/staging/wlan-ng/prism2fw.c index 3c40096..f13cdc9 100644 --- a/drivers/staging/wlan-ng/prism2fw.c +++ b/drivers/staging/wlan-ng/prism2fw.c @@ -172,7 +172,7 @@ static int read_cardpda(struct pda *pda, wlandevice_t *wlandev); static int mkpdrlist(struct pda *pda); static int plugimage(struct imgchunk *fchunk, unsigned int nfchunks, - struct s3plugrec *s3plug, unsigned int ns3plug, struct pda * pda); + struct s3plugrec *s3plug, unsigned int ns3plug, struct pda *pda); static int crcimage(struct imgchunk *fchunk, unsigned int nfchunks, struct s3crcrec *s3crc, unsigned int ns3crc); @@ -207,7 +207,8 @@ int prism2_fwtry(struct usb_device *udev, wlandevice_t *wlandev) printk(KERN_INFO "prism2_usb: Checking for firmware %s\n", PRISM2_USB_FWFILE); - if (request_ihex_firmware(&fw_entry, PRISM2_USB_FWFILE, &udev->dev) != 0) { + if (request_ihex_firmware(&fw_entry, + PRISM2_USB_FWFILE, &udev->dev) != 0) { printk(KERN_INFO "prism2_usb: Firmware not available, but not essential\n"); printk(KERN_INFO @@ -593,7 +594,8 @@ int mkpdrlist(struct pda *pda) le16_to_cpu(pda16[curroff + 1]) != HFA384x_PDR_END_OF_PDA) { pda->rec[pda->nrec] = (hfa384x_pdrec_t *) &(pda16[curroff]); - if (le16_to_cpu(pda->rec[pda->nrec]->code) == HFA384x_PDR_NICID) { + if (le16_to_cpu(pda->rec[pda->nrec]->code) == + HFA384x_PDR_NICID) { memcpy(&nicid, &pda->rec[pda->nrec]->data.nicid, sizeof(nicid)); nicid.id = le16_to_cpu(nicid.id); @@ -655,7 +657,7 @@ int mkpdrlist(struct pda *pda) * ~0 failure ----------------------------------------------------------------*/ int plugimage(struct imgchunk *fchunk, unsigned int nfchunks, - struct s3plugrec *s3plug, unsigned int ns3plug, struct pda * pda) + struct s3plugrec *s3plug, unsigned int ns3plug, struct pda *pda) { int result = 0; int i; /* plug index */ -- cgit v0.10.2 From 9b754b17f9ac5fbb9586ae6582de7ecbfc46b56d Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Wed, 6 Jun 2012 14:46:44 -0700 Subject: staging: wlags49_h2: remove direct declarations of KERN_ prefixes Use the standard KERN_ #defines instead of "<.>" Signed-off-by: Joe Perches Cc: Kay Sievers Cc: Henk de Groot Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/wlags49_h2/hcf.c b/drivers/staging/wlags49_h2/hcf.c index 366e4a4..4235446 100644 --- a/drivers/staging/wlags49_h2/hcf.c +++ b/drivers/staging/wlags49_h2/hcf.c @@ -705,7 +705,7 @@ hcf_action( IFBP ifbp, hcf_16 action ) // 800 us latency before FW switches to high power MSF_WAIT(800); // MSF-defined function to wait n microseconds. //OOR if ( ifbp->IFB_DSLinkStat & CFG_LINK_STAT_DS_OOR ) { // OutOfRange -// printk( "<5>ACT_INT_OFF: Deepsleep phase terminated, enable and go to AwaitConnection\n" ); //;?remove me 1 day +// printk(KERN_NOTICE "ACT_INT_OFF: Deepsleep phase terminated, enable and go to AwaitConnection\n" ); //;?remove me 1 day // hcf_cntl( ifbp, HCF_CNTL_ENABLE ); // } // ifbp->IFB_DSLinkStat &= ~( CFG_LINK_STAT_DS_IR | CFG_LINK_STAT_DS_OOR); //clear IR/OOR state @@ -2979,7 +2979,7 @@ hcf_service_nic( IFBP ifbp, wci_bufp bufp, unsigned int len ) ltv.typ = CFG_DDS_TICK_TIME; ltv.tick_time = ( ( ifbp->IFB_DSLinkStat & CFG_LINK_STAT_TIMER ) + 0x10 ) *64; //78 is more right hcf_put_info( ifbp, (LTVP)<v ); - printk( "<5>Preparing for sleep, link_status: %04X, timer : %d\n", + printk(KERN_NOTICE "Preparing for sleep, link_status: %04X, timer : %d\n", ifbp->IFB_DSLinkStat, ltv.tick_time );//;?remove me 1 day ifbp->IFB_TickCnt++; //;?just to make sure we do not keep on printing above message if ( ltv.tick_time < 300 * 125 ) ifbp->IFB_DSLinkStat += 0x0010; @@ -4221,11 +4221,11 @@ isr_info( IFBP ifbp ) // /*4*/ if ( info[1] == CFG_LINK_STAT ) { // ifbp->IFB_DSLinkStat = IPW( HREG_DATA_1 ) | CFG_LINK_STAT_CHANGE; //corrupts BAP !! ;? // ifbp->IFB_LinkStat = ifbp->IFB_DSLinkStat & CFG_LINK_STAT_FW; //;? to be obsoleted -// printk( "<4>linkstatus: %04x\n", ifbp->IFB_DSLinkStat ); //;?remove me 1 day +// printk(KERN_ERR "linkstatus: %04x\n", ifbp->IFB_DSLinkStat ); //;?remove me 1 day // #if (HCF_SLEEP) & HCF_DDS // if ( ( ifbp->IFB_DSLinkStat & CFG_LINK_STAT_CONNECTED ) == 0 ) { //even values are disconnected etc. // ifbp->IFB_TickCnt = 0; //start 2 second period (with 1 tick uncertanty) -// printk( "<5>isr_info: AwaitConnection phase started, IFB_TickCnt = 0\n" ); //;?remove me 1 day +// printk(KERN_NOTICE "isr_info: AwaitConnection phase started, IFB_TickCnt = 0\n" ); //;?remove me 1 day // } // #endif // HCF_DDS // } diff --git a/drivers/staging/wlags49_h2/wl_main.c b/drivers/staging/wlags49_h2/wl_main.c index d5bf0a7..2041078 100644 --- a/drivers/staging/wlags49_h2/wl_main.c +++ b/drivers/staging/wlags49_h2/wl_main.c @@ -3822,7 +3822,7 @@ static int write_int(struct file *file, const char *buffer, unsigned long count, lp->timer_oor.data = (unsigned long)lp; lp->timer_oor.expires = RUN_AT( 3 * HZ ); add_timer( &lp->timer_oor ); - printk( "<5>wl_enable: %ld\n", jiffies ); //;?remove me 1 day + printk(KERN_NOTICE "wl_enable: %ld\n", jiffies ); //;?remove me 1 day #endif //DN554 #ifdef DN554 /******************************************************************************* @@ -3852,7 +3852,7 @@ void timer_oor( u_long arg ) DBG_ENTER( DbgInfo ); DBG_PARAM( DbgInfo, "arg", "0x%08lx", arg ); - printk( "<5>timer_oor: %ld 0x%04X\n", jiffies, lp->timer_oor_cnt ); //;?remove me 1 day + printk(KERN_NOTICE "timer_oor: %ld 0x%04X\n", jiffies, lp->timer_oor_cnt ); //;?remove me 1 day lp->timer_oor_cnt += 10; if ( (lp->timer_oor_cnt & ~DS_OOR) > 300 ) { lp->timer_oor_cnt = 300; -- cgit v0.10.2 From 093abf11d3c4ecb8d8c57adec926dced532878ba Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Wed, 6 Jun 2012 22:54:27 -0400 Subject: Staging: bcm: Fix all whitespace issues in nvm.c This patch resolves all whitespace issues as reported by checkpatch.pl. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/nvm.c b/drivers/staging/bcm/nvm.c index f16d3bb..2bb87c9 100644 --- a/drivers/staging/bcm/nvm.c +++ b/drivers/staging/bcm/nvm.c @@ -29,8 +29,8 @@ static INT CorruptDSDSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL e static INT CorruptISOSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal); static INT SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, UINT uiSectAlignAddr); static INT WriteToFlashWithoutSectorErase(struct bcm_mini_adapter *Adapter, PUINT pBuff, - FLASH2X_SECTION_VAL eFlash2xSectionVal, - UINT uiOffset, UINT uiNumBytes); + FLASH2X_SECTION_VAL eFlash2xSectionVal, + UINT uiOffset, UINT uiNumBytes); static FLASH2X_SECTION_VAL getHighestPriDSD(struct bcm_mini_adapter *Adapter); static FLASH2X_SECTION_VAL getHighestPriISO(struct bcm_mini_adapter *Adapter); @@ -49,7 +49,7 @@ static INT BeceemFlashBulkWrite( static INT GetFlashBaseAddr(struct bcm_mini_adapter *Adapter); -static INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter,UINT dwAddress, UINT *pdwData, UINT dwNumData); +static INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, UINT dwAddress, UINT *pdwData, UINT dwNumData); // Procedure: ReadEEPROMStatusRegister // @@ -62,52 +62,52 @@ static INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter,UINT dwAddress, // //----------------------------------------------------------------------------- -static UCHAR ReadEEPROMStatusRegister(struct bcm_mini_adapter *Adapter ) +static UCHAR ReadEEPROMStatusRegister(struct bcm_mini_adapter *Adapter) { UCHAR uiData = 0; - DWORD dwRetries = MAX_EEPROM_RETRIES*RETRIES_PER_DELAY; + DWORD dwRetries = MAX_EEPROM_RETRIES * RETRIES_PER_DELAY; UINT uiStatus = 0; UINT value = 0; UINT value1 = 0; /* Read the EEPROM status register */ - value = EEPROM_READ_STATUS_REGISTER ; - wrmalt( Adapter, EEPROM_CMDQ_SPI_REG, &value, sizeof(value)); + value = EEPROM_READ_STATUS_REGISTER; + wrmalt(Adapter, EEPROM_CMDQ_SPI_REG, &value, sizeof(value)); - while ( dwRetries != 0 ) + while (dwRetries != 0) { - value=0; - uiStatus = 0 ; + value = 0; + uiStatus = 0; rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &uiStatus, sizeof(uiStatus)); - if(Adapter->device_removed == TRUE) + if (Adapter->device_removed == TRUE) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Modem has got removed hence exiting...."); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Modem has got removed hence exiting...."); break; } /* Wait for Avail bit to be set. */ - if ( ( uiStatus & EEPROM_READ_DATA_AVAIL) != 0 ) + if ((uiStatus & EEPROM_READ_DATA_AVAIL) != 0) { /* Clear the Avail/Full bits - which ever is set. */ value = uiStatus & (EEPROM_READ_DATA_AVAIL | EEPROM_READ_DATA_FULL); - wrmalt( Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); + wrmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); - value =0; + value = 0; rdmalt(Adapter, EEPROM_READ_DATAQ_REG, &value, sizeof(value)); uiData = (UCHAR)value; break; } - dwRetries-- ; - if ( dwRetries == 0 ) + dwRetries--; + if (dwRetries == 0) { - rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); - rdmalt(Adapter, EEPROM_SPI_Q_STATUS_REG, &value1, sizeof(value1)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"0x3004 = %x 0x3008 = %x, retries = %d failed.\n",value,value1, MAX_EEPROM_RETRIES*RETRIES_PER_DELAY); + rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); + rdmalt(Adapter, EEPROM_SPI_Q_STATUS_REG, &value1, sizeof(value1)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "0x3004 = %x 0x3008 = %x, retries = %d failed.\n", value, value1, MAX_EEPROM_RETRIES * RETRIES_PER_DELAY); return uiData; } - if( !(dwRetries%RETRIES_PER_DELAY) ) + if (!(dwRetries%RETRIES_PER_DELAY)) msleep(1); uiStatus = 0 ; } @@ -129,68 +129,65 @@ static UCHAR ReadEEPROMStatusRegister(struct bcm_mini_adapter *Adapter ) //----------------------------------------------------------------------------- INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, - DWORD dwAddress, - DWORD *pdwData, - DWORD dwNumWords - ) + DWORD dwAddress, + DWORD *pdwData, + DWORD dwNumWords) { DWORD dwIndex = 0; - DWORD dwRetries = MAX_EEPROM_RETRIES*RETRIES_PER_DELAY; + DWORD dwRetries = MAX_EEPROM_RETRIES * RETRIES_PER_DELAY; UINT uiStatus = 0; - UINT value= 0; + UINT value = 0; UINT value1 = 0; UCHAR *pvalue; /* Flush the read and cmd queue. */ - value=( EEPROM_READ_QUEUE_FLUSH | EEPROM_CMD_QUEUE_FLUSH ); - wrmalt( Adapter, SPI_FLUSH_REG, &value, sizeof(value) ); - value=0; - wrmalt( Adapter, SPI_FLUSH_REG, &value, sizeof(value)); + value = (EEPROM_READ_QUEUE_FLUSH | EEPROM_CMD_QUEUE_FLUSH); + wrmalt(Adapter, SPI_FLUSH_REG, &value, sizeof(value)); + value = 0; + wrmalt(Adapter, SPI_FLUSH_REG, &value, sizeof(value)); /* Clear the Avail/Full bits. */ - value=( EEPROM_READ_DATA_AVAIL | EEPROM_READ_DATA_FULL ); - wrmalt( Adapter, EEPROM_SPI_Q_STATUS1_REG,&value, sizeof(value)); - - value= dwAddress | ( (dwNumWords == 4) ? EEPROM_16_BYTE_PAGE_READ : EEPROM_4_BYTE_PAGE_READ ); - wrmalt( Adapter, EEPROM_CMDQ_SPI_REG, &value, sizeof(value)); + value = (EEPROM_READ_DATA_AVAIL | EEPROM_READ_DATA_FULL); + wrmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); - while ( dwRetries != 0 ) - { + value = dwAddress | ((dwNumWords == 4) ? EEPROM_16_BYTE_PAGE_READ : EEPROM_4_BYTE_PAGE_READ); + wrmalt(Adapter, EEPROM_CMDQ_SPI_REG, &value, sizeof(value)); + while (dwRetries != 0) + { uiStatus = 0; rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &uiStatus, sizeof(uiStatus)); - if(Adapter->device_removed == TRUE) + if (Adapter->device_removed == TRUE) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Modem has got Removed.hence exiting from loop..."); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Modem has got Removed.hence exiting from loop..."); return -ENODEV; } /* If we are reading 16 bytes we want to be sure that the queue * is full before we read. In the other cases we are ok if the * queue has data available */ - if ( dwNumWords == 4 ) + if (dwNumWords == 4) { - if ( ( uiStatus & EEPROM_READ_DATA_FULL ) != 0 ) + if ((uiStatus & EEPROM_READ_DATA_FULL) != 0) { /* Clear the Avail/Full bits - which ever is set. */ - value = ( uiStatus & (EEPROM_READ_DATA_AVAIL | EEPROM_READ_DATA_FULL) ) ; - wrmalt( Adapter, EEPROM_SPI_Q_STATUS1_REG,&value, sizeof(value)); + value = (uiStatus & (EEPROM_READ_DATA_AVAIL | EEPROM_READ_DATA_FULL)); + wrmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); break; } } - else if ( dwNumWords == 1 ) + else if (dwNumWords == 1) { - - if ( ( uiStatus & EEPROM_READ_DATA_AVAIL ) != 0 ) + if ((uiStatus & EEPROM_READ_DATA_AVAIL) != 0) { /* We just got Avail and we have to read 32bits so we * need this sleep for Cardbus kind of devices. */ - if (Adapter->chip_id == 0xBECE0210 ) - udelay(800); + if (Adapter->chip_id == 0xBECE0210) + udelay(800); /* Clear the Avail/Full bits - which ever is set. */ - value=( uiStatus & (EEPROM_READ_DATA_AVAIL | EEPROM_READ_DATA_FULL) ); - wrmalt( Adapter, EEPROM_SPI_Q_STATUS1_REG,&value, sizeof(value)); + value = (uiStatus & (EEPROM_READ_DATA_AVAIL | EEPROM_READ_DATA_FULL)); + wrmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); break; } } @@ -198,25 +195,27 @@ INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, uiStatus = 0; dwRetries--; - if(dwRetries == 0) + if (dwRetries == 0) { - value=0; - value1=0; + value = 0; + value1 = 0; rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); rdmalt(Adapter, EEPROM_SPI_Q_STATUS_REG, &value1, sizeof(value1)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "dwNumWords %d 0x3004 = %x 0x3008 = %x retries = %d failed.\n", dwNumWords, value, value1, MAX_EEPROM_RETRIES*RETRIES_PER_DELAY); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "dwNumWords %d 0x3004 = %x 0x3008 = %x retries = %d failed.\n", + dwNumWords, value, value1, MAX_EEPROM_RETRIES * RETRIES_PER_DELAY); return STATUS_FAILURE; } - if( !(dwRetries%RETRIES_PER_DELAY) ) + + if (!(dwRetries%RETRIES_PER_DELAY)) msleep(1); } - for ( dwIndex = 0; dwIndex < dwNumWords ; dwIndex++ ) + for (dwIndex = 0; dwIndex < dwNumWords; dwIndex++) { /* We get only a byte at a time - from LSB to MSB. We shift it into an integer. */ pvalue = (PUCHAR)(pdwData + dwIndex); - value =0; + value = 0; rdmalt(Adapter, EEPROM_READ_DATAQ_REG, &value, sizeof(value)); pvalue[0] = value; @@ -226,7 +225,7 @@ INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, pvalue[1] = value; - value =0; + value = 0; rdmalt(Adapter, EEPROM_READ_DATAQ_REG, &value, sizeof(value)); pvalue[2] = value; @@ -256,15 +255,14 @@ INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, //----------------------------------------------------------------------------- INT ReadBeceemEEPROM(struct bcm_mini_adapter *Adapter, - DWORD uiOffset, - DWORD *pBuffer - ) + DWORD uiOffset, + DWORD *pBuffer) { - UINT uiData[8] = {0}; + UINT uiData[8] = {0}; UINT uiByteOffset = 0; UINT uiTempOffset = 0; - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL," ====> "); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, " ====> "); uiTempOffset = uiOffset - (uiOffset % MAX_RW_SIZE); uiByteOffset = uiOffset - uiTempOffset; @@ -273,18 +271,16 @@ INT ReadBeceemEEPROM(struct bcm_mini_adapter *Adapter, /* A word can overlap at most over 2 pages. In that case we read the * next page too. */ - if ( uiByteOffset > 12 ) + if (uiByteOffset > 12) { ReadBeceemEEPROMBulk(Adapter, uiTempOffset + MAX_RW_SIZE, (PUINT)&uiData[4], 4); } - memcpy( (PUCHAR) pBuffer, ( ((PUCHAR)&uiData[0]) + uiByteOffset ), 4); + memcpy((PUCHAR)pBuffer, (((PUCHAR)&uiData[0]) + uiByteOffset), 4); return STATUS_SUCCESS; } /* ReadBeceemEEPROM() */ - - INT ReadMacAddressFromNVM(struct bcm_mini_adapter *Adapter) { INT Status; @@ -295,7 +291,7 @@ INT ReadMacAddressFromNVM(struct bcm_mini_adapter *Adapter) INIT_PARAMS_1_MACADDRESS_ADDRESS, MAC_ADDRESS_SIZE); - if(Status == STATUS_SUCCESS) + if (Status == STATUS_SUCCESS) memcpy(Adapter->dev->dev_addr, puMacAddr, MAC_ADDRESS_SIZE); return Status; @@ -317,62 +313,56 @@ INT ReadMacAddressFromNVM(struct bcm_mini_adapter *Adapter) // - if failed. //----------------------------------------------------------------------------- -INT BeceemEEPROMBulkRead( - struct bcm_mini_adapter *Adapter, - PUINT pBuffer, - UINT uiOffset, - UINT uiNumBytes) +INT BeceemEEPROMBulkRead(struct bcm_mini_adapter *Adapter, + PUINT pBuffer, + UINT uiOffset, + UINT uiNumBytes) { - UINT uiData[4] = {0}; - //UINT uiAddress = 0; - UINT uiBytesRemaining = uiNumBytes; - UINT uiIndex = 0; - UINT uiTempOffset = 0; - UINT uiExtraBytes = 0; - UINT uiFailureRetries = 0; + UINT uiData[4] = {0}; + // UINT uiAddress = 0; + UINT uiBytesRemaining = uiNumBytes; + UINT uiIndex = 0; + UINT uiTempOffset = 0; + UINT uiExtraBytes = 0; + UINT uiFailureRetries = 0; PUCHAR pcBuff = (PUCHAR)pBuffer; - - if(uiOffset%MAX_RW_SIZE&& uiBytesRemaining) + if (uiOffset % MAX_RW_SIZE && uiBytesRemaining) { - uiTempOffset = uiOffset - (uiOffset%MAX_RW_SIZE); - uiExtraBytes = uiOffset-uiTempOffset; - ReadBeceemEEPROMBulk(Adapter,uiTempOffset,(PUINT)&uiData[0],4); - if(uiBytesRemaining >= (MAX_RW_SIZE - uiExtraBytes)) + uiTempOffset = uiOffset - (uiOffset % MAX_RW_SIZE); + uiExtraBytes = uiOffset - uiTempOffset; + ReadBeceemEEPROMBulk(Adapter, uiTempOffset, (PUINT)&uiData[0], 4); + if (uiBytesRemaining >= (MAX_RW_SIZE - uiExtraBytes)) { - memcpy(pBuffer,(((PUCHAR)&uiData[0])+uiExtraBytes),MAX_RW_SIZE - uiExtraBytes); - + memcpy(pBuffer, (((PUCHAR)&uiData[0]) + uiExtraBytes), MAX_RW_SIZE - uiExtraBytes); uiBytesRemaining -= (MAX_RW_SIZE - uiExtraBytes); uiIndex += (MAX_RW_SIZE - uiExtraBytes); uiOffset += (MAX_RW_SIZE - uiExtraBytes); } else { - memcpy(pBuffer,(((PUCHAR)&uiData[0])+uiExtraBytes),uiBytesRemaining); + memcpy(pBuffer, (((PUCHAR)&uiData[0]) + uiExtraBytes), uiBytesRemaining); uiIndex += uiBytesRemaining; uiOffset += uiBytesRemaining; uiBytesRemaining = 0; } - - } - - while(uiBytesRemaining && uiFailureRetries != 128) + while (uiBytesRemaining && uiFailureRetries != 128) { - if(Adapter->device_removed ) + if (Adapter->device_removed) { return -1; } - if(uiBytesRemaining >= MAX_RW_SIZE) + if (uiBytesRemaining >= MAX_RW_SIZE) { /* For the requests more than or equal to 16 bytes, use bulk * read function to make the access faster. * We read 4 Dwords of data */ - if(0 == ReadBeceemEEPROMBulk(Adapter,uiOffset,&uiData[0],4)) + if (0 == ReadBeceemEEPROMBulk(Adapter, uiOffset, &uiData[0], 4)) { - memcpy(pcBuff+uiIndex,&uiData[0],MAX_RW_SIZE); + memcpy(pcBuff + uiIndex, &uiData[0], MAX_RW_SIZE); uiOffset += MAX_RW_SIZE; uiBytesRemaining -= MAX_RW_SIZE; uiIndex += MAX_RW_SIZE; @@ -380,40 +370,39 @@ INT BeceemEEPROMBulkRead( else { uiFailureRetries++; - mdelay(3);//sleep for a while before retry... + mdelay(3); //sleep for a while before retry... } } - else if(uiBytesRemaining >= 4) + else if (uiBytesRemaining >= 4) { - if(0 == ReadBeceemEEPROM(Adapter,uiOffset,&uiData[0])) + if (0 == ReadBeceemEEPROM(Adapter, uiOffset, &uiData[0])) { - memcpy(pcBuff+uiIndex,&uiData[0],4); + memcpy(pcBuff + uiIndex, &uiData[0], 4); uiOffset += 4; uiBytesRemaining -= 4; - uiIndex +=4; + uiIndex += 4; } else { uiFailureRetries++; - mdelay(3);//sleep for a while before retry... + mdelay(3); //sleep for a while before retry... } } else - { // Handle the reads less than 4 bytes... + { // Handle the reads less than 4 bytes... PUCHAR pCharBuff = (PUCHAR)pBuffer; pCharBuff += uiIndex; - if(0 == ReadBeceemEEPROM(Adapter,uiOffset,&uiData[0])) + if (0 == ReadBeceemEEPROM(Adapter, uiOffset, &uiData[0])) { - memcpy(pCharBuff,&uiData[0],uiBytesRemaining);//copy only bytes requested. + memcpy(pCharBuff, &uiData[0], uiBytesRemaining); //copy only bytes requested. uiBytesRemaining = 0; } else { uiFailureRetries++; - mdelay(3);//sleep for a while before retry... + mdelay(3); //sleep for a while before retry... } } - } return 0; @@ -435,11 +424,10 @@ INT BeceemEEPROMBulkRead( // - if failed. //----------------------------------------------------------------------------- -static INT BeceemFlashBulkRead( - struct bcm_mini_adapter *Adapter, - PUINT pBuffer, - UINT uiOffset, - UINT uiNumBytes) +static INT BeceemFlashBulkRead(struct bcm_mini_adapter *Adapter, + PUINT pBuffer, + UINT uiOffset, + UINT uiNumBytes) { UINT uiIndex = 0; UINT uiBytesToRead = uiNumBytes; @@ -447,30 +435,30 @@ static INT BeceemFlashBulkRead( UINT uiPartOffset = 0; int bytes; - if(Adapter->device_removed ) + if (Adapter->device_removed) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Device Got Removed "); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Device Got Removed"); return -ENODEV; } - //Adding flash Base address -// uiOffset = uiOffset + GetFlashBaseAddr(Adapter); -#if defined(BCM_SHM_INTERFACE) && !defined(FLASH_DIRECT_ACCESS) - Status = bcmflash_raw_read((uiOffset/FLASH_PART_SIZE),(uiOffset % FLASH_PART_SIZE),( unsigned char *)pBuffer,uiNumBytes); - return Status; -#endif + // Adding flash Base address + // uiOffset = uiOffset + GetFlashBaseAddr(Adapter); + #if defined(BCM_SHM_INTERFACE) && !defined(FLASH_DIRECT_ACCESS) + Status = bcmflash_raw_read((uiOffset/FLASH_PART_SIZE), (uiOffset % FLASH_PART_SIZE), (unsigned char *)pBuffer, uiNumBytes); + return Status; + #endif Adapter->SelectedChip = RESET_CHIP_SELECT; - if(uiOffset % MAX_RW_SIZE) + if (uiOffset % MAX_RW_SIZE) { - BcmDoChipSelect(Adapter,uiOffset); + BcmDoChipSelect(Adapter, uiOffset); uiPartOffset = (uiOffset & (FLASH_PART_SIZE - 1)) + GetFlashBaseAddr(Adapter); - uiBytesToRead = MAX_RW_SIZE - (uiOffset%MAX_RW_SIZE); - uiBytesToRead = MIN(uiNumBytes,uiBytesToRead); + uiBytesToRead = MAX_RW_SIZE - (uiOffset % MAX_RW_SIZE); + uiBytesToRead = MIN(uiNumBytes, uiBytesToRead); - bytes = rdm(Adapter, uiPartOffset, (PCHAR)pBuffer+uiIndex, uiBytesToRead); + bytes = rdm(Adapter, uiPartOffset, (PCHAR)pBuffer + uiIndex, uiBytesToRead); if (bytes < 0) { Status = bytes; Adapter->SelectedChip = RESET_CHIP_SELECT; @@ -482,24 +470,22 @@ static INT BeceemFlashBulkRead( uiNumBytes -= uiBytesToRead; } - while(uiNumBytes) + while (uiNumBytes) { - BcmDoChipSelect(Adapter,uiOffset); + BcmDoChipSelect(Adapter, uiOffset); uiPartOffset = (uiOffset & (FLASH_PART_SIZE - 1)) + GetFlashBaseAddr(Adapter); - uiBytesToRead = MIN(uiNumBytes,MAX_RW_SIZE); + uiBytesToRead = MIN(uiNumBytes, MAX_RW_SIZE); - bytes = rdm(Adapter, uiPartOffset, (PCHAR)pBuffer+uiIndex, uiBytesToRead); + bytes = rdm(Adapter, uiPartOffset, (PCHAR)pBuffer + uiIndex, uiBytesToRead); if (bytes < 0) { Status = bytes; break; } - uiIndex += uiBytesToRead; uiOffset += uiBytesToRead; uiNumBytes -= uiBytesToRead; - } Adapter->SelectedChip = RESET_CHIP_SELECT; return Status; @@ -520,12 +506,10 @@ static INT BeceemFlashBulkRead( static UINT BcmGetFlashSize(struct bcm_mini_adapter *Adapter) { - if(IsFlash2x(Adapter)) - return (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER)); + if (IsFlash2x(Adapter)) + return (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER)); else - return 32*1024; - - + return 32 * 1024; } //----------------------------------------------------------------------------- @@ -546,51 +530,48 @@ static UINT BcmGetEEPROMSize(struct bcm_mini_adapter *Adapter) UINT uiData = 0; UINT uiIndex = 0; -// -// if EEPROM is present and already Calibrated,it will have -// 'BECM' string at 0th offset. -// To find the EEPROM size read the possible boundaries of the -// EEPROM like 4K,8K etc..accessing the EEPROM beyond its size will -// result in wrap around. So when we get the End of the EEPROM we will -// get 'BECM' string which is indeed at offset 0. -// - BeceemEEPROMBulkRead(Adapter,&uiData,0x0,4); - if(uiData == BECM) + // + // if EEPROM is present and already Calibrated,it will have + // 'BECM' string at 0th offset. + // To find the EEPROM size read the possible boundaries of the + // EEPROM like 4K,8K etc..accessing the EEPROM beyond its size will + // result in wrap around. So when we get the End of the EEPROM we will + // get 'BECM' string which is indeed at offset 0. + // + BeceemEEPROMBulkRead(Adapter, &uiData, 0x0, 4); + if (uiData == BECM) { - for(uiIndex = 2;uiIndex <=256; uiIndex*=2) + for (uiIndex = 2; uiIndex <= 256; uiIndex *= 2) { - BeceemEEPROMBulkRead(Adapter,&uiData,uiIndex*1024,4); - if(uiData == BECM) + BeceemEEPROMBulkRead(Adapter, &uiData, uiIndex * 1024, 4); + if (uiData == BECM) { - return uiIndex*1024; + return uiIndex * 1024; } } } else { -// -// EEPROM may not be present or not programmed -// - - uiData = 0xBABEFACE; - if(0 == BeceemEEPROMBulkWrite(Adapter,(PUCHAR)&uiData,0,4,TRUE)) + // + // EEPROM may not be present or not programmed + // + uiData = 0xBABEFACE; + if (0 == BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&uiData, 0, 4, TRUE)) { uiData = 0; - for(uiIndex = 2;uiIndex <=256; uiIndex*=2) + for (uiIndex = 2; uiIndex <= 256; uiIndex *= 2) { - BeceemEEPROMBulkRead(Adapter,&uiData,uiIndex*1024,4); - if(uiData == 0xBABEFACE) + BeceemEEPROMBulkRead(Adapter, &uiData, uiIndex * 1024, 4); + if (uiData == 0xBABEFACE) { - return uiIndex*1024; + return uiIndex * 1024; } } } - } return 0; } - //----------------------------------------------------------------------------- // Procedure: FlashSectorErase // @@ -606,17 +587,16 @@ static UINT BcmGetEEPROMSize(struct bcm_mini_adapter *Adapter) // //----------------------------------------------------------------------------- - static INT FlashSectorErase(struct bcm_mini_adapter *Adapter, - UINT addr, - UINT numOfSectors) + UINT addr, + UINT numOfSectors) { UINT iIndex = 0, iRetries = 0; UINT uiStatus = 0; UINT value; int bytes; - for(iIndex=0;iIndex\n")); + // DumpDebug(NVM_RW,("flashWrite ====>\n")); value = (FLASH_CMD_WRITE_ENABLE << 24); - if(wrmalt(Adapter, FLASH_SPI_CMDQ_REG,&value, sizeof(value)) < 0) + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Write enable in FLASH_SPI_CMDQ_REG register fails"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Write enable in FLASH_SPI_CMDQ_REG register fails"); return STATUS_FAILURE; } - if(wrm(Adapter,FLASH_SPI_WRITEQ_REG, (PCHAR)&ulData, 4) < 0 ) + + if (wrm(Adapter, FLASH_SPI_WRITEQ_REG, (PCHAR)&ulData, 4) < 0) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"DATA Write on FLASH_SPI_WRITEQ_REG fails"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "DATA Write on FLASH_SPI_WRITEQ_REG fails"); return STATUS_FAILURE; } value = (0x02000000 | (uiOffset & 0xFFFFFF)); - if(wrmalt(Adapter, FLASH_SPI_CMDQ_REG,&value, sizeof(value)) < 0 ) + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Programming of FLASH_SPI_CMDQ_REG fails"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Programming of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; } @@ -718,35 +695,33 @@ static INT flashByteWrite( do { value = (FLASH_CMD_STATUS_REG_READ << 24); - if(wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Programing of FLASH_SPI_CMDQ_REG fails"); + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) + { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Programing of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; - } - //__udelay(1); + } + //__udelay(1); bytes = rdmalt(Adapter, FLASH_SPI_READQ_REG, &uiStatus, sizeof(uiStatus)); if (bytes < 0) { uiStatus = bytes; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Reading status of FLASH_SPI_READQ_REG fails"); return uiStatus; } - iRetries--; - if( iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) - msleep(1); + iRetries--; + if (iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) + msleep(1); - }while((uiStatus & 0x1) && (iRetries >0) ); + } while ((uiStatus & 0x1) && (iRetries > 0)); - if(uiStatus & 0x1) + if (uiStatus & 0x1) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Flash Write fails even after checking status for 200 times."); - return STATUS_FAILURE ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Flash Write fails even after checking status for 200 times."); + return STATUS_FAILURE; } return STATUS_SUCCESS; } - - //----------------------------------------------------------------------------- // Procedure: flashWrite // @@ -761,11 +736,9 @@ static INT flashByteWrite( // //----------------------------------------------------------------------------- -static INT flashWrite( - struct bcm_mini_adapter *Adapter, - UINT uiOffset, - PVOID pData) - +static INT flashWrite(struct bcm_mini_adapter *Adapter, + UINT uiOffset, + PVOID pData) { //UINT uiStatus = 0; //INT iRetries = 0; @@ -773,14 +746,13 @@ static INT flashWrite( UINT uiStatus = 0; INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; //3 - UINT value; - UINT uiErasePattern[4] = {0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF}; + UINT uiErasePattern[4] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; int bytes; -// -// need not write 0xFFFFFFFF because write requires an erase and erase will -// make whole sector 0xFFFFFFFF. -// + // + // need not write 0xFFFFFFFF because write requires an erase and erase will + // make whole sector 0xFFFFFFFF. + // if (!memcmp(pData, uiErasePattern, MAX_RW_SIZE)) { return 0; @@ -788,14 +760,15 @@ static INT flashWrite( value = (FLASH_CMD_WRITE_ENABLE << 24); - if(wrmalt(Adapter, FLASH_SPI_CMDQ_REG,&value, sizeof(value)) < 0 ) + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Write Enable of FLASH_SPI_CMDQ_REG fails"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Write Enable of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; } - if(wrm(Adapter, uiOffset, (PCHAR)pData, MAX_RW_SIZE) < 0) + + if (wrm(Adapter, uiOffset, (PCHAR)pData, MAX_RW_SIZE) < 0) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Data write fails..."); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Data write fails..."); return STATUS_FAILURE; } @@ -803,12 +776,12 @@ static INT flashWrite( do { value = (FLASH_CMD_STATUS_REG_READ << 24); - if(wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Programing of FLASH_SPI_CMDQ_REG fails"); + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) + { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Programing of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; - } - //__udelay(1); + } + //__udelay(1); bytes = rdmalt(Adapter, FLASH_SPI_READQ_REG, &uiStatus, sizeof(uiStatus)); if (bytes < 0) { uiStatus = bytes; @@ -821,14 +794,14 @@ static INT flashWrite( //currently one rdm/wrm takes 125 us. //Hence 125 *2 * FLASH_PER_RETRIES_DELAY > 3 ms(worst case delay) //Hence current implementation cycle will intoduce no delay in current path - if(iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) - msleep(1); - }while((uiStatus & 0x1) && (iRetries > 0)); + if (iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) + msleep(1); + } while ((uiStatus & 0x1) && (iRetries > 0)); - if(uiStatus & 0x1) + if (uiStatus & 0x1) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Flash Write fails even after checking status for 200 times."); - return STATUS_FAILURE ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Flash Write fails even after checking status for 200 times."); + return STATUS_FAILURE; } return STATUS_SUCCESS; @@ -847,10 +820,9 @@ static INT flashWrite( // OSAL_STATUS_CODE // //----------------------------------------------------------------------------- -static INT flashByteWriteStatus( - struct bcm_mini_adapter *Adapter, - UINT uiOffset, - PVOID pData) +static INT flashByteWriteStatus(struct bcm_mini_adapter *Adapter, + UINT uiOffset, + PVOID pData) { UINT uiStatus = 0; INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; //3 @@ -858,12 +830,12 @@ static INT flashByteWriteStatus( UINT value; int bytes; -// -// need not write 0xFFFFFFFF because write requires an erase and erase will -// make whole sector 0xFFFFFFFF. -// + // + // need not write 0xFFFFFFFF because write requires an erase and erase will + // make whole sector 0xFFFFFFFF. + // - if(0xFF == ulData) + if (0xFF == ulData) { return STATUS_SUCCESS; } @@ -871,31 +843,31 @@ static INT flashByteWriteStatus( // DumpDebug(NVM_RW,("flashWrite ====>\n")); value = (FLASH_CMD_WRITE_ENABLE << 24); - if(wrmalt(Adapter, FLASH_SPI_CMDQ_REG,&value, sizeof(value)) < 0) + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Write enable in FLASH_SPI_CMDQ_REG register fails"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Write enable in FLASH_SPI_CMDQ_REG register fails"); return STATUS_SUCCESS; } - if(wrm(Adapter,FLASH_SPI_WRITEQ_REG, (PCHAR)&ulData, 4) < 0) + if (wrm(Adapter, FLASH_SPI_WRITEQ_REG, (PCHAR)&ulData, 4) < 0) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"DATA Write on FLASH_SPI_WRITEQ_REG fails"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "DATA Write on FLASH_SPI_WRITEQ_REG fails"); return STATUS_FAILURE; } value = (0x02000000 | (uiOffset & 0xFFFFFF)); - if(wrmalt(Adapter, FLASH_SPI_CMDQ_REG,&value, sizeof(value)) < 0) + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Programming of FLASH_SPI_CMDQ_REG fails"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Programming of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; } - //msleep(1); + //msleep(1); do { value = (FLASH_CMD_STATUS_REG_READ << 24); - if(wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Programing of FLASH_SPI_CMDQ_REG fails"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Programing of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; } //__udelay(1); @@ -907,18 +879,18 @@ static INT flashByteWriteStatus( } iRetries--; - if( iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) - msleep(1); - }while((uiStatus & 0x1) && (iRetries > 0)); + if (iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) + msleep(1); + + } while ((uiStatus & 0x1) && (iRetries > 0)); - if(uiStatus & 0x1) + if (uiStatus & 0x1) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Flash Write fails even after checking status for 200 times."); - return STATUS_FAILURE ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Flash Write fails even after checking status for 200 times."); + return STATUS_FAILURE; } return STATUS_SUCCESS; - } //----------------------------------------------------------------------------- // Procedure: flashWriteStatus @@ -934,68 +906,69 @@ static INT flashByteWriteStatus( // //----------------------------------------------------------------------------- -static INT flashWriteStatus( - struct bcm_mini_adapter *Adapter, - UINT uiOffset, - PVOID pData) +static INT flashWriteStatus(struct bcm_mini_adapter *Adapter, + UINT uiOffset, + PVOID pData) { UINT uiStatus = 0; INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; //3 //UINT uiReadBack = 0; UINT value; - UINT uiErasePattern[4] = {0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF}; + UINT uiErasePattern[4] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; int bytes; -// -// need not write 0xFFFFFFFF because write requires an erase and erase will -// make whole sector 0xFFFFFFFF. -// - if (!memcmp(pData,uiErasePattern,MAX_RW_SIZE)) + // + // need not write 0xFFFFFFFF because write requires an erase and erase will + // make whole sector 0xFFFFFFFF. + // + if (!memcmp(pData, uiErasePattern, MAX_RW_SIZE)) { return 0; } value = (FLASH_CMD_WRITE_ENABLE << 24); - if(wrmalt(Adapter, FLASH_SPI_CMDQ_REG,&value, sizeof(value)) < 0) + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Write Enable of FLASH_SPI_CMDQ_REG fails"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Write Enable of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; } - if(wrm(Adapter, uiOffset, (PCHAR)pData, MAX_RW_SIZE) < 0) + + if (wrm(Adapter, uiOffset, (PCHAR)pData, MAX_RW_SIZE) < 0) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Data write fails..."); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Data write fails..."); return STATUS_FAILURE; } - // __udelay(1); + // __udelay(1); do { value = (FLASH_CMD_STATUS_REG_READ << 24); - if(wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Programing of FLASH_SPI_CMDQ_REG fails"); + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) + { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Programing of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; - } - //__udelay(1); + } + //__udelay(1); bytes = rdmalt(Adapter, FLASH_SPI_READQ_REG, &uiStatus, sizeof(uiStatus)); if (bytes < 0) { uiStatus = bytes; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Reading status of FLASH_SPI_READQ_REG fails"); return uiStatus; } - iRetries--; - //this will ensure that in there will be no changes in the current path. - //currently one rdm/wrm takes 125 us. - //Hence 125 *2 * FLASH_PER_RETRIES_DELAY >3 ms(worst case delay) - //Hence current implementation cycle will intoduce no delay in current path - if(iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) - msleep(1); - }while((uiStatus & 0x1) && (iRetries >0)); + iRetries--; + // this will ensure that in there will be no changes in the current path. + // currently one rdm/wrm takes 125 us. + // Hence 125 *2 * FLASH_PER_RETRIES_DELAY >3 ms(worst case delay) + // Hence current implementation cycle will intoduce no delay in current path + if (iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) + msleep(1); - if(uiStatus & 0x1) + } while ((uiStatus & 0x1) && (iRetries > 0)); + + if (uiStatus & 0x1) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Flash Write fails even after checking status for 200 times."); - return STATUS_FAILURE ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Flash Write fails even after checking status for 200 times."); + return STATUS_FAILURE; } return STATUS_SUCCESS; @@ -1014,17 +987,18 @@ static INT flashWriteStatus( // //----------------------------------------------------------------------------- -static VOID BcmRestoreBlockProtectStatus(struct bcm_mini_adapter *Adapter,ULONG ulWriteStatus) +static VOID BcmRestoreBlockProtectStatus(struct bcm_mini_adapter *Adapter, ULONG ulWriteStatus) { UINT value; - value = (FLASH_CMD_WRITE_ENABLE<< 24); + value = (FLASH_CMD_WRITE_ENABLE << 24); wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)); udelay(20); - value = (FLASH_CMD_STATUS_REG_WRITE<<24)|(ulWriteStatus << 16); + value = (FLASH_CMD_STATUS_REG_WRITE << 24) | (ulWriteStatus << 16); wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)); udelay(20); } + //----------------------------------------------------------------------------- // Procedure: BcmFlashUnProtectBlock // @@ -1037,98 +1011,96 @@ static VOID BcmRestoreBlockProtectStatus(struct bcm_mini_adapter *Adapter,ULONG // ULONG - Status value before UnProtect. // //----------------------------------------------------------------------------- -static ULONG BcmFlashUnProtectBlock(struct bcm_mini_adapter *Adapter,UINT uiOffset, UINT uiLength) + +static ULONG BcmFlashUnProtectBlock(struct bcm_mini_adapter *Adapter, UINT uiOffset, UINT uiLength) { - ULONG ulStatus = 0; - ULONG ulWriteStatus = 0; + ULONG ulStatus = 0; + ULONG ulWriteStatus = 0; UINT value; - uiOffset = uiOffset&0x000FFFFF; -// -// Implemented only for 1MB Flash parts. -// - if(FLASH_PART_SST25VF080B == Adapter->ulFlashID) - { + uiOffset = uiOffset&0x000FFFFF; // - // Get Current BP status. + // Implemented only for 1MB Flash parts. // + if (FLASH_PART_SST25VF080B == Adapter->ulFlashID) + { + // + // Get Current BP status. + // value = (FLASH_CMD_STATUS_REG_READ << 24); wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)); udelay(10); - // - // Read status will be WWXXYYZZ. We have to take only WW. - // + // + // Read status will be WWXXYYZZ. We have to take only WW. + // rdmalt(Adapter, FLASH_SPI_READQ_REG, (PUINT)&ulStatus, sizeof(ulStatus)); ulStatus >>= 24; ulWriteStatus = ulStatus; - - // - // Bits [5-2] give current block level protection status. - // Bit5: BP3 - DONT CARE - // BP2-BP0: 0 - NO PROTECTION, 1 - UPPER 1/16, 2 - UPPER 1/8, 3 - UPPER 1/4 - // 4 - UPPER 1/2. 5 to 7 - ALL BLOCKS - // - - if(ulStatus) + // + // Bits [5-2] give current block level protection status. + // Bit5: BP3 - DONT CARE + // BP2-BP0: 0 - NO PROTECTION, 1 - UPPER 1/16, 2 - UPPER 1/8, 3 - UPPER 1/4 + // 4 - UPPER 1/2. 5 to 7 - ALL BLOCKS + // + + if (ulStatus) { - if((uiOffset+uiLength) <= 0x80000) + if ((uiOffset+uiLength) <= 0x80000) { - // - // Offset comes in lower half of 1MB. Protect the upper half. - // Clear BP1 and BP0 and set BP2. - // + // + // Offset comes in lower half of 1MB. Protect the upper half. + // Clear BP1 and BP0 and set BP2. + // ulWriteStatus |= (0x4<<2); ulWriteStatus &= ~(0x3<<2); } - else if((uiOffset+uiLength) <= 0xC0000) + else if ((uiOffset + uiLength) <= 0xC0000) { - // - // Offset comes below Upper 1/4. Upper 1/4 can be protected. - // Clear BP2 and set BP1 and BP0. - // + // + // Offset comes below Upper 1/4. Upper 1/4 can be protected. + // Clear BP2 and set BP1 and BP0. + // ulWriteStatus |= (0x3<<2); ulWriteStatus &= ~(0x1<<4); } - else if((uiOffset+uiLength) <= 0xE0000) - { - // - // Offset comes below Upper 1/8. Upper 1/8 can be protected. - // Clear BP2 and BP0 and set BP1 - // - ulWriteStatus |= (0x1<<3); - ulWriteStatus &= ~(0x5<<2); - - } - else if((uiOffset+uiLength) <= 0xF0000) - { - // - // Offset comes below Upper 1/16. Only upper 1/16 can be protected. - // Set BP0 and Clear BP2,BP1. - // - ulWriteStatus |= (0x1<<2); - ulWriteStatus &= ~(0x3<<3); - } - else - { - // - // Unblock all. - // Clear BP2,BP1 and BP0. - // - ulWriteStatus &= ~(0x7<<2); - } - - value = (FLASH_CMD_WRITE_ENABLE<< 24); + else if ((uiOffset + uiLength) <= 0xE0000) + { + // + // Offset comes below Upper 1/8. Upper 1/8 can be protected. + // Clear BP2 and BP0 and set BP1 + // + ulWriteStatus |= (0x1<<3); + ulWriteStatus &= ~(0x5<<2); + } + else if ((uiOffset + uiLength) <= 0xF0000) + { + // + // Offset comes below Upper 1/16. Only upper 1/16 can be protected. + // Set BP0 and Clear BP2,BP1. + // + ulWriteStatus |= (0x1<<2); + ulWriteStatus &= ~(0x3<<3); + } + else + { + // + // Unblock all. + // Clear BP2,BP1 and BP0. + // + ulWriteStatus &= ~(0x7<<2); + } + + value = (FLASH_CMD_WRITE_ENABLE << 24); wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)); udelay(20); - value = (FLASH_CMD_STATUS_REG_WRITE<<24)|(ulWriteStatus << 16); + value = (FLASH_CMD_STATUS_REG_WRITE << 24) | (ulWriteStatus << 16); wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)); udelay(20); - } - } return ulStatus; } + //----------------------------------------------------------------------------- // Procedure: BeceemFlashBulkWrite // @@ -1136,7 +1108,7 @@ static ULONG BcmFlashUnProtectBlock(struct bcm_mini_adapter *Adapter,UINT uiOffs // // Arguments: // Adapter - ptr to Adapter object instance -// pBuffer - Data to be written. +// pBuffer - Data to be written. // uiOffset - Offset of the flash where data needs to be written to. // uiNumBytes - Number of bytes to be written. // bVerify - read verify flag. @@ -1145,91 +1117,90 @@ static ULONG BcmFlashUnProtectBlock(struct bcm_mini_adapter *Adapter,UINT uiOffs // //----------------------------------------------------------------------------- -static INT BeceemFlashBulkWrite( - struct bcm_mini_adapter *Adapter, - PUINT pBuffer, - UINT uiOffset, - UINT uiNumBytes, - BOOLEAN bVerify) +static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, + PUINT pBuffer, + UINT uiOffset, + UINT uiNumBytes, + BOOLEAN bVerify) { - PCHAR pTempBuff = NULL; - PUCHAR pcBuffer = (PUCHAR)pBuffer; - UINT uiIndex = 0; - UINT uiOffsetFromSectStart = 0; - UINT uiSectAlignAddr = 0; - UINT uiCurrSectOffsetAddr = 0; - UINT uiSectBoundary = 0; - UINT uiNumSectTobeRead = 0; - UCHAR ucReadBk[16] = {0}; - ULONG ulStatus = 0; - INT Status = STATUS_SUCCESS; - UINT uiTemp = 0; - UINT index = 0; - UINT uiPartOffset = 0; - -#if defined(BCM_SHM_INTERFACE) && !defined(FLASH_DIRECT_ACCESS) - Status = bcmflash_raw_write((uiOffset/FLASH_PART_SIZE),(uiOffset % FLASH_PART_SIZE),( unsigned char *)pBuffer,uiNumBytes); - return Status; -#endif - - uiOffsetFromSectStart = uiOffset & ~(Adapter->uiSectorSize - 1); - - //Adding flash Base address -// uiOffset = uiOffset + GetFlashBaseAddr(Adapter); - - uiSectAlignAddr = uiOffset & ~(Adapter->uiSectorSize - 1); - uiCurrSectOffsetAddr = uiOffset & (Adapter->uiSectorSize - 1); - uiSectBoundary = uiSectAlignAddr + Adapter->uiSectorSize; + PCHAR pTempBuff = NULL; + PUCHAR pcBuffer = (PUCHAR)pBuffer; + UINT uiIndex = 0; + UINT uiOffsetFromSectStart = 0; + UINT uiSectAlignAddr = 0; + UINT uiCurrSectOffsetAddr = 0; + UINT uiSectBoundary = 0; + UINT uiNumSectTobeRead = 0; + UCHAR ucReadBk[16] = {0}; + ULONG ulStatus = 0; + INT Status = STATUS_SUCCESS; + UINT uiTemp = 0; + UINT index = 0; + UINT uiPartOffset = 0; + + #if defined(BCM_SHM_INTERFACE) && !defined(FLASH_DIRECT_ACCESS) + Status = bcmflash_raw_write((uiOffset / FLASH_PART_SIZE), (uiOffset % FLASH_PART_SIZE), (unsigned char *)pBuffer, uiNumBytes); + return Status; + #endif + + uiOffsetFromSectStart = uiOffset & ~(Adapter->uiSectorSize - 1); + + // Adding flash Base address + // uiOffset = uiOffset + GetFlashBaseAddr(Adapter); + + uiSectAlignAddr = uiOffset & ~(Adapter->uiSectorSize - 1); + uiCurrSectOffsetAddr = uiOffset & (Adapter->uiSectorSize - 1); + uiSectBoundary = uiSectAlignAddr + Adapter->uiSectorSize; pTempBuff = kmalloc(Adapter->uiSectorSize, GFP_KERNEL); - if(NULL == pTempBuff) + if (NULL == pTempBuff) goto BeceemFlashBulkWrite_EXIT; -// -// check if the data to be written is overlapped across sectors -// - if(uiOffset+uiNumBytes < uiSectBoundary) + // + // check if the data to be written is overlapped across sectors + // + if (uiOffset+uiNumBytes < uiSectBoundary) { uiNumSectTobeRead = 1; } else { - // Number of sectors = Last sector start address/First sector start address - uiNumSectTobeRead = (uiCurrSectOffsetAddr+uiNumBytes)/Adapter->uiSectorSize; - if((uiCurrSectOffsetAddr+uiNumBytes)%Adapter->uiSectorSize) + // Number of sectors = Last sector start address/First sector start address + uiNumSectTobeRead = (uiCurrSectOffsetAddr + uiNumBytes) / Adapter->uiSectorSize; + if ((uiCurrSectOffsetAddr + uiNumBytes)%Adapter->uiSectorSize) { uiNumSectTobeRead++; } } - //Check whether Requested sector is writable or not in case of flash2x write. But if write call is + // Check whether Requested sector is writable or not in case of flash2x write. But if write call is // for DSD calibration, allow it without checking of sector permission - if(IsFlash2x(Adapter) && (Adapter->bAllDSDWriteAllow == FALSE)) + if (IsFlash2x(Adapter) && (Adapter->bAllDSDWriteAllow == FALSE)) { index = 0; - uiTemp = uiNumSectTobeRead ; - while(uiTemp) + uiTemp = uiNumSectTobeRead; + while (uiTemp) { - if(IsOffsetWritable(Adapter, uiOffsetFromSectStart + index * Adapter->uiSectorSize ) == FALSE) - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Sector Starting at offset <0X%X> is not writable", - (uiOffsetFromSectStart + index * Adapter->uiSectorSize)); + if (IsOffsetWritable(Adapter, uiOffsetFromSectStart + index * Adapter->uiSectorSize) == FALSE) + { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Sector Starting at offset <0X%X> is not writable", + (uiOffsetFromSectStart + index * Adapter->uiSectorSize)); Status = SECTOR_IS_NOT_WRITABLE; goto BeceemFlashBulkWrite_EXIT; - } - uiTemp = uiTemp - 1; - index = index + 1 ; + } + uiTemp = uiTemp - 1; + index = index + 1 ; } } Adapter->SelectedChip = RESET_CHIP_SELECT; - while(uiNumSectTobeRead) + while (uiNumSectTobeRead) { - //do_gettimeofday(&tv1); - //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "\nTime In start of write :%ld ms\n",(tv1.tv_sec *1000 + tv1.tv_usec /1000)); + // do_gettimeofday(&tv1); + // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "\nTime In start of write :%ld ms\n",(tv1.tv_sec *1000 + tv1.tv_usec /1000)); uiPartOffset = (uiSectAlignAddr & (FLASH_PART_SIZE - 1)) + GetFlashBaseAddr(Adapter); - BcmDoChipSelect(Adapter,uiSectAlignAddr); + BcmDoChipSelect(Adapter, uiSectAlignAddr); - if(0 != BeceemFlashBulkRead(Adapter, + if (0 != BeceemFlashBulkRead(Adapter, (PUINT)pTempBuff, uiOffsetFromSectStart, Adapter->uiSectorSize)) @@ -1238,61 +1209,60 @@ static INT BeceemFlashBulkWrite( goto BeceemFlashBulkWrite_EXIT; } - //do_gettimeofday(&tr); - //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken by Read :%ld ms\n", (tr.tv_sec *1000 + tr.tv_usec/1000) - (tv1.tv_sec *1000 + tv1.tv_usec/1000)); - - ulStatus = BcmFlashUnProtectBlock(Adapter,uiSectAlignAddr,Adapter->uiSectorSize); + // do_gettimeofday(&tr); + // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken by Read :%ld ms\n", (tr.tv_sec *1000 + tr.tv_usec/1000) - (tv1.tv_sec *1000 + tv1.tv_usec/1000)); + ulStatus = BcmFlashUnProtectBlock(Adapter, uiSectAlignAddr, Adapter->uiSectorSize); - if(uiNumSectTobeRead > 1) + if (uiNumSectTobeRead > 1) { - - memcpy(&pTempBuff[uiCurrSectOffsetAddr],pcBuffer,uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr)); - pcBuffer += ((uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr))); - uiNumBytes -= (uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr)); + memcpy(&pTempBuff[uiCurrSectOffsetAddr], pcBuffer, uiSectBoundary - (uiSectAlignAddr + uiCurrSectOffsetAddr)); + pcBuffer += ((uiSectBoundary - (uiSectAlignAddr + uiCurrSectOffsetAddr))); + uiNumBytes -= (uiSectBoundary - (uiSectAlignAddr + uiCurrSectOffsetAddr)); } else { - memcpy(&pTempBuff[uiCurrSectOffsetAddr],pcBuffer,uiNumBytes); + memcpy(&pTempBuff[uiCurrSectOffsetAddr], pcBuffer, uiNumBytes); } - if(IsFlash2x(Adapter)) + if (IsFlash2x(Adapter)) { - SaveHeaderIfPresent(Adapter,(PUCHAR)pTempBuff,uiOffsetFromSectStart); + SaveHeaderIfPresent(Adapter, (PUCHAR)pTempBuff, uiOffsetFromSectStart); } - FlashSectorErase(Adapter,uiPartOffset,1); - //do_gettimeofday(&te); - //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken by Erase :%ld ms\n", (te.tv_sec *1000 + te.tv_usec/1000) - (tr.tv_sec *1000 + tr.tv_usec/1000)); + FlashSectorErase(Adapter, uiPartOffset, 1); + // do_gettimeofday(&te); + // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken by Erase :%ld ms\n", (te.tv_sec *1000 + te.tv_usec/1000) - (tr.tv_sec *1000 + tr.tv_usec/1000)); - for(uiIndex = 0; uiIndex < Adapter->uiSectorSize; uiIndex +=Adapter->ulFlashWriteSize) + for (uiIndex = 0; uiIndex < Adapter->uiSectorSize; uiIndex += Adapter->ulFlashWriteSize) { - if(Adapter->device_removed) + if (Adapter->device_removed) { Status = -1; goto BeceemFlashBulkWrite_EXIT; } - if(STATUS_SUCCESS != (*Adapter->fpFlashWrite)(Adapter,uiPartOffset+uiIndex,(&pTempBuff[uiIndex]))) + + if (STATUS_SUCCESS != (*Adapter->fpFlashWrite)(Adapter, uiPartOffset + uiIndex, (&pTempBuff[uiIndex]))) { Status = -1; goto BeceemFlashBulkWrite_EXIT; } } - //do_gettimeofday(&tw); - //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken in Write to Flash :%ld ms\n", (tw.tv_sec *1000 + tw.tv_usec/1000) - (te.tv_sec *1000 + te.tv_usec/1000)); - for(uiIndex = 0;uiIndex < Adapter->uiSectorSize;uiIndex += MAX_RW_SIZE) + // do_gettimeofday(&tw); + // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken in Write to Flash :%ld ms\n", (tw.tv_sec *1000 + tw.tv_usec/1000) - (te.tv_sec *1000 + te.tv_usec/1000)); + for (uiIndex = 0; uiIndex < Adapter->uiSectorSize; uiIndex += MAX_RW_SIZE) { - if(STATUS_SUCCESS == BeceemFlashBulkRead(Adapter,(PUINT)ucReadBk,uiOffsetFromSectStart+uiIndex,MAX_RW_SIZE)) + if (STATUS_SUCCESS == BeceemFlashBulkRead(Adapter, (PUINT)ucReadBk, uiOffsetFromSectStart + uiIndex, MAX_RW_SIZE)) { - if(Adapter->ulFlashWriteSize == 1) + if (Adapter->ulFlashWriteSize == 1) { UINT uiReadIndex = 0; - for(uiReadIndex = 0; uiReadIndex < 16; uiReadIndex++) + for (uiReadIndex = 0; uiReadIndex < 16; uiReadIndex++) { - if(ucReadBk[uiReadIndex] != pTempBuff[uiIndex+uiReadIndex]) + if (ucReadBk[uiReadIndex] != pTempBuff[uiIndex + uiReadIndex]) { - if(STATUS_SUCCESS != (*Adapter->fpFlashWriteWithStatusCheck)(Adapter,uiPartOffset+uiIndex+uiReadIndex,&pTempBuff[uiIndex+uiReadIndex])) + if (STATUS_SUCCESS != (*Adapter->fpFlashWriteWithStatusCheck)(Adapter, uiPartOffset + uiIndex + uiReadIndex, &pTempBuff[uiIndex+uiReadIndex])) { Status = STATUS_FAILURE; goto BeceemFlashBulkWrite_EXIT; @@ -1302,9 +1272,9 @@ static INT BeceemFlashBulkWrite( } else { - if(memcmp(ucReadBk,&pTempBuff[uiIndex],MAX_RW_SIZE)) + if (memcmp(ucReadBk, &pTempBuff[uiIndex], MAX_RW_SIZE)) { - if(STATUS_SUCCESS != (*Adapter->fpFlashWriteWithStatusCheck)(Adapter,uiPartOffset+uiIndex,&pTempBuff[uiIndex])) + if (STATUS_SUCCESS != (*Adapter->fpFlashWriteWithStatusCheck)(Adapter, uiPartOffset + uiIndex, &pTempBuff[uiIndex])) { Status = STATUS_FAILURE; goto BeceemFlashBulkWrite_EXIT; @@ -1313,13 +1283,11 @@ static INT BeceemFlashBulkWrite( } } } - //do_gettimeofday(&twv); - //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken in Write to Flash verification :%ld ms\n", (twv.tv_sec *1000 + twv.tv_usec/1000) - (tw.tv_sec *1000 + tw.tv_usec/1000)); - - - if(ulStatus) + // do_gettimeofday(&twv); + // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken in Write to Flash verification :%ld ms\n", (twv.tv_sec *1000 + twv.tv_usec/1000) - (tw.tv_sec *1000 + tw.tv_usec/1000)); + if (ulStatus) { - BcmRestoreBlockProtectStatus(Adapter,ulStatus); + BcmRestoreBlockProtectStatus(Adapter, ulStatus); ulStatus = 0; } @@ -1329,119 +1297,117 @@ static INT BeceemFlashBulkWrite( uiOffsetFromSectStart += Adapter->uiSectorSize; uiNumSectTobeRead--; } - //do_gettimeofday(&tv2); - //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Time after Write :%ld ms\n",(tv2.tv_sec *1000 + tv2.tv_usec/1000)); - //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken by in Write is :%ld ms\n", (tv2.tv_sec *1000 + tv2.tv_usec/1000) - (tv1.tv_sec *1000 + tv1.tv_usec/1000)); -// -// Cleanup. -// -BeceemFlashBulkWrite_EXIT: - if(ulStatus) + // do_gettimeofday(&tv2); + // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Time after Write :%ld ms\n",(tv2.tv_sec *1000 + tv2.tv_usec/1000)); + // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken by in Write is :%ld ms\n", (tv2.tv_sec *1000 + tv2.tv_usec/1000) - (tv1.tv_sec *1000 + tv1.tv_usec/1000)); + // + // Cleanup. + // +BeceemFlashBulkWrite_EXIT : + if (ulStatus) { - BcmRestoreBlockProtectStatus(Adapter,ulStatus); + BcmRestoreBlockProtectStatus(Adapter, ulStatus); } - + kfree(pTempBuff); Adapter->SelectedChip = RESET_CHIP_SELECT; return Status; } - //----------------------------------------------------------------------------- // Procedure: BeceemFlashBulkWriteStatus // // Description: Writes to Flash. Checks the SPI status after each write. // // Arguments: -// Adapter - ptr to Adapter object instance -// pBuffer - Data to be written. -// uiOffset - Offset of the flash where data needs to be written to. -// uiNumBytes - Number of bytes to be written. -// bVerify - read verify flag. +// Adapter - ptr to Adapter object instance +// pBuffer - Data to be written. +// uiOffset - Offset of the flash where data needs to be written to. +// uiNumBytes - Number of bytes to be written. +// bVerify - read verify flag. // Returns: // OSAL_STATUS_CODE // //----------------------------------------------------------------------------- -static INT BeceemFlashBulkWriteStatus( - struct bcm_mini_adapter *Adapter, - PUINT pBuffer, - UINT uiOffset, - UINT uiNumBytes, - BOOLEAN bVerify) +static INT BeceemFlashBulkWriteStatus(struct bcm_mini_adapter *Adapter, + PUINT pBuffer, + UINT uiOffset, + UINT uiNumBytes, + BOOLEAN bVerify) { - PCHAR pTempBuff = NULL; - PUCHAR pcBuffer = (PUCHAR)pBuffer; - UINT uiIndex = 0; - UINT uiOffsetFromSectStart = 0; - UINT uiSectAlignAddr = 0; - UINT uiCurrSectOffsetAddr = 0; - UINT uiSectBoundary = 0; - UINT uiNumSectTobeRead = 0; - UCHAR ucReadBk[16] = {0}; - ULONG ulStatus = 0; - UINT Status = STATUS_SUCCESS; - UINT uiTemp = 0; - UINT index = 0; - UINT uiPartOffset = 0; - - uiOffsetFromSectStart = uiOffset & ~(Adapter->uiSectorSize - 1); - - //uiOffset += Adapter->ulFlashCalStart; - //Adding flash Base address -// uiOffset = uiOffset + GetFlashBaseAddr(Adapter); - - uiSectAlignAddr = uiOffset & ~(Adapter->uiSectorSize - 1); - uiCurrSectOffsetAddr = uiOffset & (Adapter->uiSectorSize - 1); - uiSectBoundary = uiSectAlignAddr + Adapter->uiSectorSize; + PCHAR pTempBuff = NULL; + PUCHAR pcBuffer = (PUCHAR)pBuffer; + UINT uiIndex = 0; + UINT uiOffsetFromSectStart = 0; + UINT uiSectAlignAddr = 0; + UINT uiCurrSectOffsetAddr = 0; + UINT uiSectBoundary = 0; + UINT uiNumSectTobeRead = 0; + UCHAR ucReadBk[16] = {0}; + ULONG ulStatus = 0; + UINT Status = STATUS_SUCCESS; + UINT uiTemp = 0; + UINT index = 0; + UINT uiPartOffset = 0; + + uiOffsetFromSectStart = uiOffset & ~(Adapter->uiSectorSize - 1); + + // uiOffset += Adapter->ulFlashCalStart; + // Adding flash Base address + // uiOffset = uiOffset + GetFlashBaseAddr(Adapter); + + uiSectAlignAddr = uiOffset & ~(Adapter->uiSectorSize - 1); + uiCurrSectOffsetAddr = uiOffset & (Adapter->uiSectorSize - 1); + uiSectBoundary = uiSectAlignAddr + Adapter->uiSectorSize; pTempBuff = kmalloc(Adapter->uiSectorSize, GFP_KERNEL); - if(NULL == pTempBuff) + if (NULL == pTempBuff) goto BeceemFlashBulkWriteStatus_EXIT; -// -// check if the data to be written is overlapped across sectors -// - if(uiOffset+uiNumBytes < uiSectBoundary) + // + // check if the data to be written is overlapped across sectors + // + if (uiOffset+uiNumBytes < uiSectBoundary) { uiNumSectTobeRead = 1; } else { -// Number of sectors = Last sector start address/First sector start address - uiNumSectTobeRead = (uiCurrSectOffsetAddr+uiNumBytes)/Adapter->uiSectorSize; - if((uiCurrSectOffsetAddr+uiNumBytes)%Adapter->uiSectorSize) + // Number of sectors = Last sector start address/First sector start address + uiNumSectTobeRead = (uiCurrSectOffsetAddr + uiNumBytes) / Adapter->uiSectorSize; + if ((uiCurrSectOffsetAddr + uiNumBytes)%Adapter->uiSectorSize) { uiNumSectTobeRead++; } } - if(IsFlash2x(Adapter) && (Adapter->bAllDSDWriteAllow == FALSE)) + if (IsFlash2x(Adapter) && (Adapter->bAllDSDWriteAllow == FALSE)) { index = 0; - uiTemp = uiNumSectTobeRead ; - while(uiTemp) + uiTemp = uiNumSectTobeRead; + while (uiTemp) { - if(IsOffsetWritable(Adapter,uiOffsetFromSectStart + index * Adapter->uiSectorSize ) == FALSE) - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Sector Starting at offset <0X%x> is not writable", - (uiOffsetFromSectStart + index * Adapter->uiSectorSize)); + if (IsOffsetWritable(Adapter, uiOffsetFromSectStart + index * Adapter->uiSectorSize) == FALSE) + { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Sector Starting at offset <0X%x> is not writable", + (uiOffsetFromSectStart + index * Adapter->uiSectorSize)); Status = SECTOR_IS_NOT_WRITABLE; goto BeceemFlashBulkWriteStatus_EXIT; - } - uiTemp = uiTemp - 1; - index = index + 1 ; + } + uiTemp = uiTemp - 1; + index = index + 1 ; } } Adapter->SelectedChip = RESET_CHIP_SELECT; - while(uiNumSectTobeRead) + while (uiNumSectTobeRead) { uiPartOffset = (uiSectAlignAddr & (FLASH_PART_SIZE - 1)) + GetFlashBaseAddr(Adapter); - BcmDoChipSelect(Adapter,uiSectAlignAddr); - if(0 != BeceemFlashBulkRead(Adapter, + BcmDoChipSelect(Adapter, uiSectAlignAddr); + if (0 != BeceemFlashBulkRead(Adapter, (PUINT)pTempBuff, uiOffsetFromSectStart, Adapter->uiSectorSize)) @@ -1450,64 +1416,59 @@ static INT BeceemFlashBulkWriteStatus( goto BeceemFlashBulkWriteStatus_EXIT; } - ulStatus = BcmFlashUnProtectBlock(Adapter,uiOffsetFromSectStart,Adapter->uiSectorSize); + ulStatus = BcmFlashUnProtectBlock(Adapter, uiOffsetFromSectStart, Adapter->uiSectorSize); - if(uiNumSectTobeRead > 1) + if (uiNumSectTobeRead > 1) { - - memcpy(&pTempBuff[uiCurrSectOffsetAddr],pcBuffer,uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr)); - pcBuffer += ((uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr))); - uiNumBytes -= (uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr)); + memcpy(&pTempBuff[uiCurrSectOffsetAddr], pcBuffer, uiSectBoundary - (uiSectAlignAddr + uiCurrSectOffsetAddr)); + pcBuffer += ((uiSectBoundary - (uiSectAlignAddr + uiCurrSectOffsetAddr))); + uiNumBytes -= (uiSectBoundary - (uiSectAlignAddr + uiCurrSectOffsetAddr)); } else { - memcpy(&pTempBuff[uiCurrSectOffsetAddr],pcBuffer,uiNumBytes); + memcpy(&pTempBuff[uiCurrSectOffsetAddr], pcBuffer, uiNumBytes); } - if(IsFlash2x(Adapter)) + if (IsFlash2x(Adapter)) { - SaveHeaderIfPresent(Adapter,(PUCHAR)pTempBuff,uiOffsetFromSectStart); + SaveHeaderIfPresent(Adapter, (PUCHAR)pTempBuff, uiOffsetFromSectStart); } - FlashSectorErase(Adapter,uiPartOffset,1); - - for(uiIndex = 0; uiIndex < Adapter->uiSectorSize; uiIndex +=Adapter->ulFlashWriteSize) + FlashSectorErase(Adapter, uiPartOffset, 1); + for (uiIndex = 0; uiIndex < Adapter->uiSectorSize; uiIndex += Adapter->ulFlashWriteSize) { - if(Adapter->device_removed) + if (Adapter->device_removed) { Status = -1; goto BeceemFlashBulkWriteStatus_EXIT; } - if(STATUS_SUCCESS != (*Adapter->fpFlashWriteWithStatusCheck)(Adapter,uiPartOffset+uiIndex,&pTempBuff[uiIndex])) + if (STATUS_SUCCESS != (*Adapter->fpFlashWriteWithStatusCheck)(Adapter, uiPartOffset+uiIndex, &pTempBuff[uiIndex])) { Status = -1; goto BeceemFlashBulkWriteStatus_EXIT; } } - if(bVerify) + if (bVerify) { - for(uiIndex = 0;uiIndex < Adapter->uiSectorSize;uiIndex += MAX_RW_SIZE) + for (uiIndex = 0; uiIndex < Adapter->uiSectorSize; uiIndex += MAX_RW_SIZE) { - - if(STATUS_SUCCESS == BeceemFlashBulkRead(Adapter,(PUINT)ucReadBk,uiOffsetFromSectStart+uiIndex,MAX_RW_SIZE)) + if (STATUS_SUCCESS == BeceemFlashBulkRead(Adapter, (PUINT)ucReadBk, uiOffsetFromSectStart + uiIndex, MAX_RW_SIZE)) { - if(memcmp(ucReadBk,&pTempBuff[uiIndex],MAX_RW_SIZE)) + if (memcmp(ucReadBk, &pTempBuff[uiIndex], MAX_RW_SIZE)) { Status = STATUS_FAILURE; goto BeceemFlashBulkWriteStatus_EXIT; } - } - } } - if(ulStatus) + if (ulStatus) { - BcmRestoreBlockProtectStatus(Adapter,ulStatus); + BcmRestoreBlockProtectStatus(Adapter, ulStatus); ulStatus = 0; } @@ -1520,16 +1481,15 @@ static INT BeceemFlashBulkWriteStatus( // // Cleanup. // -BeceemFlashBulkWriteStatus_EXIT: - if(ulStatus) +BeceemFlashBulkWriteStatus_EXIT : + if (ulStatus) { - BcmRestoreBlockProtectStatus(Adapter,ulStatus); + BcmRestoreBlockProtectStatus(Adapter, ulStatus); } kfree(pTempBuff); Adapter->SelectedChip = RESET_CHIP_SELECT; return Status; - } //----------------------------------------------------------------------------- @@ -1544,7 +1504,6 @@ BeceemFlashBulkWriteStatus_EXIT: // //----------------------------------------------------------------------------- - INT PropagateCalParamsFromEEPROMToMemory(struct bcm_mini_adapter *Adapter) { PCHAR pBuff = kmalloc(BUFFER_4K, GFP_KERNEL); @@ -1555,51 +1514,49 @@ INT PropagateCalParamsFromEEPROMToMemory(struct bcm_mini_adapter *Adapter) UINT uiMemoryLoc = EEPROM_CAL_DATA_INTERNAL_LOC; UINT value; INT Status = 0; - if(pBuff == NULL) + + if (pBuff == NULL) { return -1; } - if(0 != BeceemEEPROMBulkRead(Adapter,&uiEepromSize,EEPROM_SIZE_OFFSET,4)) + if (0 != BeceemEEPROMBulkRead(Adapter, &uiEepromSize, EEPROM_SIZE_OFFSET, 4)) { - kfree(pBuff); return -1; } uiEepromSize >>= 16; - if(uiEepromSize > 1024*1024) + if (uiEepromSize > 1024 * 1024) { kfree(pBuff); return -1; } + uiBytesToCopy = MIN(BUFFER_4K, uiEepromSize); - uiBytesToCopy = MIN(BUFFER_4K,uiEepromSize); - - while(uiBytesToCopy) + while (uiBytesToCopy) { - if(0 != BeceemEEPROMBulkRead(Adapter,(PUINT)pBuff,uiCalStartAddr,uiBytesToCopy)) + if (0 != BeceemEEPROMBulkRead(Adapter, (PUINT)pBuff, uiCalStartAddr, uiBytesToCopy)) { Status = -1; break; } - wrm(Adapter,uiMemoryLoc,(PCHAR)(((PULONG)pBuff)+uiIndex),uiBytesToCopy); + wrm(Adapter, uiMemoryLoc, (PCHAR)(((PULONG)pBuff) + uiIndex), uiBytesToCopy); uiMemoryLoc += uiBytesToCopy; uiEepromSize -= uiBytesToCopy; uiCalStartAddr += uiBytesToCopy; - uiIndex += uiBytesToCopy/4; - uiBytesToCopy = MIN(BUFFER_4K,uiEepromSize); + uiIndex += uiBytesToCopy / 4; + uiBytesToCopy = MIN(BUFFER_4K, uiEepromSize); } value = 0xbeadbead; - wrmalt(Adapter, EEPROM_CAL_DATA_INTERNAL_LOC-4,&value, sizeof(value)); + wrmalt(Adapter, EEPROM_CAL_DATA_INTERNAL_LOC - 4, &value, sizeof(value)); value = 0xbeadbead; - wrmalt(Adapter, EEPROM_CAL_DATA_INTERNAL_LOC-8,&value, sizeof(value)); + wrmalt(Adapter, EEPROM_CAL_DATA_INTERNAL_LOC - 8, &value, sizeof(value)); kfree(pBuff); return Status; - } //----------------------------------------------------------------------------- @@ -1624,36 +1581,37 @@ INT PropagateCalParamsFromFlashToMemory(struct bcm_mini_adapter *Adapter) UINT uiMemoryLoc = EEPROM_CAL_DATA_INTERNAL_LOC; UINT value; INT Status = 0; -// -// Write the signature first. This will ensure firmware does not access EEPROM. -// + + // + // Write the signature first. This will ensure firmware does not access EEPROM. + // value = 0xbeadbead; wrmalt(Adapter, EEPROM_CAL_DATA_INTERNAL_LOC - 4, &value, sizeof(value)); value = 0xbeadbead; wrmalt(Adapter, EEPROM_CAL_DATA_INTERNAL_LOC - 8, &value, sizeof(value)); - if(0 != BeceemNVMRead(Adapter,&uiEepromSize,EEPROM_SIZE_OFFSET, 4)) + if (0 != BeceemNVMRead(Adapter, &uiEepromSize, EEPROM_SIZE_OFFSET, 4)) { return -1; } uiEepromSize = ntohl(uiEepromSize); uiEepromSize >>= 16; -// -// subtract the auto init section size -// + // + // subtract the auto init section size + // uiEepromSize -= EEPROM_CALPARAM_START; - if(uiEepromSize > 1024*1024) + if (uiEepromSize > 1024 * 1024) { return -1; } pBuff = kmalloc(uiEepromSize, GFP_KERNEL); - if ( pBuff == NULL ) + if (pBuff == NULL) return -1; - if(0 != BeceemNVMRead(Adapter,(PUINT)pBuff,uiCalStartAddr, uiEepromSize)) + if (0 != BeceemNVMRead(Adapter, (PUINT)pBuff, uiCalStartAddr, uiEepromSize)) { kfree(pBuff); return -1; @@ -1661,26 +1619,25 @@ INT PropagateCalParamsFromFlashToMemory(struct bcm_mini_adapter *Adapter) pPtr = pBuff; - uiBytesToCopy = MIN(BUFFER_4K,uiEepromSize); + uiBytesToCopy = MIN(BUFFER_4K, uiEepromSize); - while(uiBytesToCopy) + while (uiBytesToCopy) { - Status = wrm(Adapter,uiMemoryLoc,(PCHAR)pPtr,uiBytesToCopy); - if(Status) + Status = wrm(Adapter, uiMemoryLoc, (PCHAR)pPtr, uiBytesToCopy); + if (Status) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"wrm failed with status :%d",Status); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "wrm failed with status :%d", Status); break; } pPtr += uiBytesToCopy; uiEepromSize -= uiBytesToCopy; uiMemoryLoc += uiBytesToCopy; - uiBytesToCopy = MIN(BUFFER_4K,uiEepromSize); + uiBytesToCopy = MIN(BUFFER_4K, uiEepromSize); } kfree(pBuff); return Status; - } //----------------------------------------------------------------------------- @@ -1689,45 +1646,44 @@ INT PropagateCalParamsFromFlashToMemory(struct bcm_mini_adapter *Adapter) // Description: Read back the data written and verifies. // // Arguments: -// Adapter - ptr to Adapter object instance -// pBuffer - Data to be written. -// uiOffset - Offset of the flash where data needs to be written to. -// uiNumBytes - Number of bytes to be written. +// Adapter - ptr to Adapter object instance +// pBuffer - Data to be written. +// uiOffset - Offset of the flash where data needs to be written to. +// uiNumBytes - Number of bytes to be written. // Returns: // OSAL_STATUS_CODE // //----------------------------------------------------------------------------- -static INT BeceemEEPROMReadBackandVerify( - struct bcm_mini_adapter *Adapter, - PUINT pBuffer, - UINT uiOffset, - UINT uiNumBytes) +static INT BeceemEEPROMReadBackandVerify(struct bcm_mini_adapter *Adapter, + PUINT pBuffer, + UINT uiOffset, + UINT uiNumBytes) { - UINT uiRdbk = 0; - UINT uiIndex = 0; - UINT uiData = 0; - UINT auiData[4] = {0}; + UINT uiRdbk = 0; + UINT uiIndex = 0; + UINT uiData = 0; + UINT auiData[4] = {0}; - while(uiNumBytes) + while (uiNumBytes) { - if(Adapter->device_removed ) + if (Adapter->device_removed) { return -1; } - if(uiNumBytes >= MAX_RW_SIZE) - {// for the requests more than or equal to MAX_RW_SIZE bytes, use bulk read function to make the access faster. - BeceemEEPROMBulkRead(Adapter,&auiData[0],uiOffset,MAX_RW_SIZE); + if (uiNumBytes >= MAX_RW_SIZE) + { // for the requests more than or equal to MAX_RW_SIZE bytes, use bulk read function to make the access faster. + BeceemEEPROMBulkRead(Adapter, &auiData[0], uiOffset, MAX_RW_SIZE); - if(memcmp(&pBuffer[uiIndex],&auiData[0],MAX_RW_SIZE)) + if (memcmp(&pBuffer[uiIndex], &auiData[0], MAX_RW_SIZE)) { // re-write - BeceemEEPROMBulkWrite(Adapter,(PUCHAR)(pBuffer+uiIndex),uiOffset,MAX_RW_SIZE,FALSE); + BeceemEEPROMBulkWrite(Adapter, (PUCHAR)(pBuffer + uiIndex), uiOffset, MAX_RW_SIZE, FALSE); mdelay(3); - BeceemEEPROMBulkRead(Adapter,&auiData[0],uiOffset,MAX_RW_SIZE); + BeceemEEPROMBulkRead(Adapter, &auiData[0], uiOffset, MAX_RW_SIZE); - if(memcmp(&pBuffer[uiIndex],&auiData[0],MAX_RW_SIZE)) + if (memcmp(&pBuffer[uiIndex], &auiData[0], MAX_RW_SIZE)) { return -1; } @@ -1735,18 +1691,17 @@ static INT BeceemEEPROMReadBackandVerify( uiOffset += MAX_RW_SIZE; uiNumBytes -= MAX_RW_SIZE; uiIndex += 4; - } - else if(uiNumBytes >= 4) + else if (uiNumBytes >= 4) { - BeceemEEPROMBulkRead(Adapter,&uiData,uiOffset,4); - if(uiData != pBuffer[uiIndex]) + BeceemEEPROMBulkRead(Adapter, &uiData, uiOffset, 4); + if (uiData != pBuffer[uiIndex]) { - //re-write - BeceemEEPROMBulkWrite(Adapter,(PUCHAR)(pBuffer+uiIndex),uiOffset,4,FALSE); + // re-write + BeceemEEPROMBulkWrite(Adapter, (PUCHAR)(pBuffer + uiIndex), uiOffset, 4, FALSE); mdelay(3); - BeceemEEPROMBulkRead(Adapter,&uiData,uiOffset,4); - if(uiData != pBuffer[uiIndex]) + BeceemEEPROMBulkRead(Adapter, &uiData, uiOffset, 4); + if (uiData != pBuffer[uiIndex]) { return -1; } @@ -1754,20 +1709,18 @@ static INT BeceemEEPROMReadBackandVerify( uiOffset += 4; uiNumBytes -= 4; uiIndex++; - } else { // Handle the reads less than 4 bytes... uiData = 0; - memcpy(&uiData,((PUCHAR)pBuffer)+(uiIndex*sizeof(UINT)),uiNumBytes); - BeceemEEPROMBulkRead(Adapter,&uiRdbk,uiOffset,4); + memcpy(&uiData, ((PUCHAR)pBuffer) + (uiIndex * sizeof(UINT)), uiNumBytes); + BeceemEEPROMBulkRead(Adapter, &uiRdbk, uiOffset, 4); - if(memcmp(&uiData, &uiRdbk, uiNumBytes)) + if (memcmp(&uiData, &uiRdbk, uiNumBytes)) return -1; uiNumBytes = 0; } - } return 0; @@ -1775,7 +1728,7 @@ static INT BeceemEEPROMReadBackandVerify( static VOID BcmSwapWord(UINT *ptr1) { - UINT tempval = (UINT)*ptr1; + UINT tempval = (UINT)*ptr1; char *ptr2 = (char *)&tempval; char *ptr = (char *)ptr1; @@ -1791,95 +1744,95 @@ static VOID BcmSwapWord(UINT *ptr1) { // Description: Performs page write (16bytes) to the EEPROM // // Arguments: -// Adapter - ptr to Adapter object instance -// uiData - Data to be written. -// uiOffset - Offset of the EEPROM where data needs to be written to. +// Adapter - ptr to Adapter object instance +// uiData - Data to be written. +// uiOffset - Offset of the EEPROM where data needs to be written to. // Returns: // OSAL_STATUS_CODE // //----------------------------------------------------------------------------- -static INT BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[], UINT uiOffset ) + +static INT BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[], UINT uiOffset) { - UINT uiRetries = MAX_EEPROM_RETRIES*RETRIES_PER_DELAY; + UINT uiRetries = MAX_EEPROM_RETRIES * RETRIES_PER_DELAY; UINT uiStatus = 0; UCHAR uiEpromStatus = 0; - UINT value =0 ; + UINT value = 0; /* Flush the Write/Read/Cmd queues. */ - value = ( EEPROM_WRITE_QUEUE_FLUSH | EEPROM_CMD_QUEUE_FLUSH | EEPROM_READ_QUEUE_FLUSH ); - wrmalt( Adapter, SPI_FLUSH_REG, &value, sizeof(value)); - value = 0 ; - wrmalt( Adapter, SPI_FLUSH_REG, &value, sizeof(value) ); + value = (EEPROM_WRITE_QUEUE_FLUSH | EEPROM_CMD_QUEUE_FLUSH | EEPROM_READ_QUEUE_FLUSH); + wrmalt(Adapter, SPI_FLUSH_REG, &value, sizeof(value)); + value = 0; + wrmalt(Adapter, SPI_FLUSH_REG, &value, sizeof(value)); /* Clear the Empty/Avail/Full bits. After this it has been confirmed * that the bit was cleared by reading back the register. See NOTE below. * We also clear the Read queues as we do a EEPROM status register read * later. */ - value = ( EEPROM_WRITE_QUEUE_EMPTY | EEPROM_WRITE_QUEUE_AVAIL | EEPROM_WRITE_QUEUE_FULL | EEPROM_READ_DATA_AVAIL | EEPROM_READ_DATA_FULL ) ; - wrmalt( Adapter, EEPROM_SPI_Q_STATUS1_REG,&value, sizeof(value)); + value = (EEPROM_WRITE_QUEUE_EMPTY | EEPROM_WRITE_QUEUE_AVAIL | EEPROM_WRITE_QUEUE_FULL | EEPROM_READ_DATA_AVAIL | EEPROM_READ_DATA_FULL); + wrmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); /* Enable write */ - value = EEPROM_WRITE_ENABLE ; - wrmalt( Adapter, EEPROM_CMDQ_SPI_REG,&value, sizeof(value) ); + value = EEPROM_WRITE_ENABLE; + wrmalt(Adapter, EEPROM_CMDQ_SPI_REG, &value, sizeof(value)); /* We can write back to back 8bits * 16 into the queue and as we have * checked for the queue to be empty we can write in a burst. */ value = uiData[0]; BcmSwapWord(&value); - wrm( Adapter, EEPROM_WRITE_DATAQ_REG, (PUCHAR)&value, 4); + wrm(Adapter, EEPROM_WRITE_DATAQ_REG, (PUCHAR)&value, 4); value = uiData[1]; BcmSwapWord(&value); - wrm( Adapter, EEPROM_WRITE_DATAQ_REG, (PUCHAR)&value, 4); + wrm(Adapter, EEPROM_WRITE_DATAQ_REG, (PUCHAR)&value, 4); value = uiData[2]; BcmSwapWord(&value); - wrm( Adapter, EEPROM_WRITE_DATAQ_REG, (PUCHAR)&value, 4); + wrm(Adapter, EEPROM_WRITE_DATAQ_REG, (PUCHAR)&value, 4); value = uiData[3]; BcmSwapWord(&value); - wrm( Adapter, EEPROM_WRITE_DATAQ_REG, (PUCHAR)&value, 4); + wrm(Adapter, EEPROM_WRITE_DATAQ_REG, (PUCHAR)&value, 4); /* NOTE : After this write, on readback of EEPROM_SPI_Q_STATUS1_REG * shows that we see 7 for the EEPROM data write. Which means that * queue got full, also space is available as well as the queue is empty. * This may happen in sequence. */ - value = EEPROM_16_BYTE_PAGE_WRITE | uiOffset ; - wrmalt( Adapter, EEPROM_CMDQ_SPI_REG, &value, sizeof(value) ); + value = EEPROM_16_BYTE_PAGE_WRITE | uiOffset; + wrmalt(Adapter, EEPROM_CMDQ_SPI_REG, &value, sizeof(value)); /* Ideally we should loop here without tries and eventually succeed. * What we are checking if the previous write has completed, and this * may take time. We should wait till the Empty bit is set. */ uiStatus = 0; rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &uiStatus, sizeof(uiStatus)); - while ( ( uiStatus & EEPROM_WRITE_QUEUE_EMPTY ) == 0 ) + while ((uiStatus & EEPROM_WRITE_QUEUE_EMPTY) == 0) { uiRetries--; - if ( uiRetries == 0 ) + if (uiRetries == 0) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "0x0f003004 = %x, %d retries failed.\n", uiStatus, MAX_EEPROM_RETRIES *RETRIES_PER_DELAY); - return STATUS_FAILURE ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "0x0f003004 = %x, %d retries failed.\n", uiStatus, MAX_EEPROM_RETRIES * RETRIES_PER_DELAY); + return STATUS_FAILURE; } - if( !(uiRetries%RETRIES_PER_DELAY) ) - msleep(1); + if (!(uiRetries%RETRIES_PER_DELAY)) + msleep(1); uiStatus = 0; rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &uiStatus, sizeof(uiStatus)); - if(Adapter->device_removed == TRUE) + if (Adapter->device_removed == TRUE) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Modem got removed hence exiting from loop...."); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Modem got removed hence exiting from loop...."); return -ENODEV; } - } - if ( uiRetries != 0 ) + if (uiRetries != 0) { /* Clear the ones that are set - either, Empty/Full/Avail bits */ - value = ( uiStatus & ( EEPROM_WRITE_QUEUE_EMPTY | EEPROM_WRITE_QUEUE_AVAIL | EEPROM_WRITE_QUEUE_FULL ) ); - wrmalt( Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); + value = (uiStatus & (EEPROM_WRITE_QUEUE_EMPTY | EEPROM_WRITE_QUEUE_AVAIL | EEPROM_WRITE_QUEUE_FULL)); + wrmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); } /* Here we should check if the EEPROM status register is correct before @@ -1887,82 +1840,79 @@ static INT BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[] * we proceed further. A 1 at Bit 0 indicates that the EEPROM is busy * with the previous write. Note also that issuing this read finally * means the previous write to the EEPROM has completed. */ - uiRetries = MAX_EEPROM_RETRIES*RETRIES_PER_DELAY; + uiRetries = MAX_EEPROM_RETRIES * RETRIES_PER_DELAY; uiEpromStatus = 0; - while ( uiRetries != 0 ) + while (uiRetries != 0) { - uiEpromStatus = ReadEEPROMStatusRegister( Adapter) ; - if(Adapter->device_removed == TRUE) + uiEpromStatus = ReadEEPROMStatusRegister(Adapter); + if (Adapter->device_removed == TRUE) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Modem has got removed hence exiting from loop..."); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Modem has got removed hence exiting from loop..."); return -ENODEV; } - if ( ( EEPROM_STATUS_REG_WRITE_BUSY & uiEpromStatus ) == 0 ) + if ((EEPROM_STATUS_REG_WRITE_BUSY & uiEpromStatus) == 0) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "EEPROM status register = %x tries = %d\n", uiEpromStatus, (MAX_EEPROM_RETRIES * RETRIES_PER_DELAY- uiRetries) ); - return STATUS_SUCCESS ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "EEPROM status register = %x tries = %d\n", uiEpromStatus, (MAX_EEPROM_RETRIES * RETRIES_PER_DELAY - uiRetries)); + return STATUS_SUCCESS; } uiRetries--; - if ( uiRetries == 0 ) + if (uiRetries == 0) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "0x0f003004 = %x, for EEPROM status read %d retries failed.\n", uiEpromStatus, MAX_EEPROM_RETRIES *RETRIES_PER_DELAY); - return STATUS_FAILURE ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "0x0f003004 = %x, for EEPROM status read %d retries failed.\n", uiEpromStatus, MAX_EEPROM_RETRIES * RETRIES_PER_DELAY); + return STATUS_FAILURE; } uiEpromStatus = 0; - if( !(uiRetries%RETRIES_PER_DELAY) ) - msleep(1); + if (!(uiRetries%RETRIES_PER_DELAY)) + msleep(1); } - return STATUS_SUCCESS ; + return STATUS_SUCCESS; } /* BeceemEEPROMWritePage */ - //----------------------------------------------------------------------------- // Procedure: BeceemEEPROMBulkWrite // // Description: Performs write to the EEPROM // // Arguments: -// Adapter - ptr to Adapter object instance -// pBuffer - Data to be written. -// uiOffset - Offset of the EEPROM where data needs to be written to. -// uiNumBytes - Number of bytes to be written. -// bVerify - read verify flag. +// Adapter - ptr to Adapter object instance +// pBuffer - Data to be written. +// uiOffset - Offset of the EEPROM where data needs to be written to. +// uiNumBytes - Number of bytes to be written. +// bVerify - read verify flag. // Returns: // OSAL_STATUS_CODE // //----------------------------------------------------------------------------- -INT BeceemEEPROMBulkWrite( - struct bcm_mini_adapter *Adapter, - PUCHAR pBuffer, - UINT uiOffset, - UINT uiNumBytes, - BOOLEAN bVerify) +INT BeceemEEPROMBulkWrite(struct bcm_mini_adapter *Adapter, + PUCHAR pBuffer, + UINT uiOffset, + UINT uiNumBytes, + BOOLEAN bVerify) { - UINT uiBytesToCopy = uiNumBytes; - //UINT uiRdbk = 0; - UINT uiData[4] = {0}; - UINT uiIndex = 0; - UINT uiTempOffset = 0; - UINT uiExtraBytes = 0; - //PUINT puiBuffer = (PUINT)pBuffer; - //INT value; + UINT uiBytesToCopy = uiNumBytes; + // UINT uiRdbk = 0; + UINT uiData[4] = {0}; + UINT uiIndex = 0; + UINT uiTempOffset = 0; + UINT uiExtraBytes = 0; + // PUINT puiBuffer = (PUINT)pBuffer; + // INT value; - if(uiOffset%MAX_RW_SIZE && uiBytesToCopy) + if (uiOffset % MAX_RW_SIZE && uiBytesToCopy) { - uiTempOffset = uiOffset - (uiOffset%MAX_RW_SIZE); - uiExtraBytes = uiOffset-uiTempOffset; - + uiTempOffset = uiOffset - (uiOffset % MAX_RW_SIZE); + uiExtraBytes = uiOffset - uiTempOffset; - BeceemEEPROMBulkRead(Adapter,&uiData[0],uiTempOffset,MAX_RW_SIZE); + BeceemEEPROMBulkRead(Adapter, &uiData[0], uiTempOffset, MAX_RW_SIZE); - if(uiBytesToCopy >= (16 -uiExtraBytes)) + if (uiBytesToCopy >= (16 - uiExtraBytes)) { - memcpy((((PUCHAR)&uiData[0])+uiExtraBytes),pBuffer,MAX_RW_SIZE- uiExtraBytes); + memcpy((((PUCHAR)&uiData[0]) + uiExtraBytes), pBuffer, MAX_RW_SIZE - uiExtraBytes); - if ( STATUS_FAILURE == BeceemEEPROMWritePage( Adapter, uiData, uiTempOffset ) ) - return STATUS_FAILURE; + if (STATUS_FAILURE == BeceemEEPROMWritePage(Adapter, uiData, uiTempOffset)) + return STATUS_FAILURE; uiBytesToCopy -= (MAX_RW_SIZE - uiExtraBytes); uiIndex += (MAX_RW_SIZE - uiExtraBytes); @@ -1970,50 +1920,46 @@ INT BeceemEEPROMBulkWrite( } else { - memcpy((((PUCHAR)&uiData[0])+uiExtraBytes),pBuffer,uiBytesToCopy); + memcpy((((PUCHAR)&uiData[0]) + uiExtraBytes), pBuffer, uiBytesToCopy); - if ( STATUS_FAILURE == BeceemEEPROMWritePage( Adapter, uiData, uiTempOffset ) ) - return STATUS_FAILURE; + if (STATUS_FAILURE == BeceemEEPROMWritePage(Adapter, uiData, uiTempOffset)) + return STATUS_FAILURE; uiIndex += uiBytesToCopy; uiOffset += uiBytesToCopy; uiBytesToCopy = 0; } - - } - while(uiBytesToCopy) + while (uiBytesToCopy) { - if(Adapter->device_removed) + if (Adapter->device_removed) { return -1; } - if(uiBytesToCopy >= MAX_RW_SIZE) + if (uiBytesToCopy >= MAX_RW_SIZE) { - - if (STATUS_FAILURE == BeceemEEPROMWritePage( Adapter, (PUINT) &pBuffer[uiIndex], uiOffset ) ) - return STATUS_FAILURE; + if (STATUS_FAILURE == BeceemEEPROMWritePage(Adapter, (PUINT) &pBuffer[uiIndex], uiOffset)) + return STATUS_FAILURE; uiIndex += MAX_RW_SIZE; uiOffset += MAX_RW_SIZE; - uiBytesToCopy -= MAX_RW_SIZE; + uiBytesToCopy -= MAX_RW_SIZE; } else { - // - // To program non 16byte aligned data, read 16byte and then update. - // - BeceemEEPROMBulkRead(Adapter,&uiData[0],uiOffset,16); - memcpy(&uiData[0],pBuffer+uiIndex,uiBytesToCopy); + // + // To program non 16byte aligned data, read 16byte and then update. + // + BeceemEEPROMBulkRead(Adapter, &uiData[0], uiOffset, 16); + memcpy(&uiData[0], pBuffer + uiIndex, uiBytesToCopy); + if (STATUS_FAILURE == BeceemEEPROMWritePage(Adapter, uiData, uiOffset)) + return STATUS_FAILURE; - if ( STATUS_FAILURE == BeceemEEPROMWritePage( Adapter, uiData, uiOffset ) ) - return STATUS_FAILURE; uiBytesToCopy = 0; } - } return 0; @@ -2035,40 +1981,41 @@ INT BeceemEEPROMBulkWrite( // - if failed. //----------------------------------------------------------------------------- -INT BeceemNVMRead( - struct bcm_mini_adapter *Adapter, - PUINT pBuffer, - UINT uiOffset, - UINT uiNumBytes) +INT BeceemNVMRead(struct bcm_mini_adapter *Adapter, + PUINT pBuffer, + UINT uiOffset, + UINT uiNumBytes) { INT Status = 0; -#if !defined(BCM_SHM_INTERFACE) || defined(FLASH_DIRECT_ACCESS) - UINT uiTemp = 0, value; -#endif - if(Adapter->eNVMType == NVM_FLASH) + #if !defined(BCM_SHM_INTERFACE) || defined(FLASH_DIRECT_ACCESS) + UINT uiTemp = 0, value; + #endif + + if (Adapter->eNVMType == NVM_FLASH) { - if(Adapter->bFlashRawRead == FALSE) + if (Adapter->bFlashRawRead == FALSE) { - if (IsSectionExistInVendorInfo(Adapter,Adapter->eActiveDSD)) - return vendorextnReadSection(Adapter,(PUCHAR)pBuffer,Adapter->eActiveDSD,uiOffset,uiNumBytes); - uiOffset = uiOffset+ Adapter->ulFlashCalStart ; + if (IsSectionExistInVendorInfo(Adapter, Adapter->eActiveDSD)) + return vendorextnReadSection(Adapter, (PUCHAR)pBuffer, Adapter->eActiveDSD, uiOffset, uiNumBytes); + + uiOffset = uiOffset + Adapter->ulFlashCalStart; } -#if defined(BCM_SHM_INTERFACE) && !defined(FLASH_DIRECT_ACCESS) - Status = bcmflash_raw_read((uiOffset/FLASH_PART_SIZE),(uiOffset % FLASH_PART_SIZE),( unsigned char *)pBuffer,uiNumBytes); -#else - rdmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); - value = 0; - wrmalt(Adapter, 0x0f000C80,&value, sizeof(value)); - Status = BeceemFlashBulkRead(Adapter, + #if defined(BCM_SHM_INTERFACE) && !defined(FLASH_DIRECT_ACCESS) + Status = bcmflash_raw_read((uiOffset / FLASH_PART_SIZE), (uiOffset % FLASH_PART_SIZE), (unsigned char *)pBuffer, uiNumBytes); + #else + rdmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); + value = 0; + wrmalt(Adapter, 0x0f000C80, &value, sizeof(value)); + Status = BeceemFlashBulkRead(Adapter, pBuffer, uiOffset, uiNumBytes); - wrmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); -#endif + wrmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); + #endif } - else if(Adapter->eNVMType == NVM_EEPROM) + else if (Adapter->eNVMType == NVM_EEPROM) { Status = BeceemEEPROMBulkRead(Adapter, pBuffer, @@ -2079,6 +2026,7 @@ INT BeceemNVMRead( { Status = -1; } + return Status; } @@ -2098,72 +2046,72 @@ INT BeceemNVMRead( // - if failed. //----------------------------------------------------------------------------- -INT BeceemNVMWrite( - struct bcm_mini_adapter *Adapter, - PUINT pBuffer, - UINT uiOffset, - UINT uiNumBytes, - BOOLEAN bVerify) +INT BeceemNVMWrite(struct bcm_mini_adapter *Adapter, + PUINT pBuffer, + UINT uiOffset, + UINT uiNumBytes, + BOOLEAN bVerify) { INT Status = 0; UINT uiTemp = 0; UINT uiMemoryLoc = EEPROM_CAL_DATA_INTERNAL_LOC; UINT uiIndex = 0; -#if !defined(BCM_SHM_INTERFACE) || defined(FLASH_DIRECT_ACCESS) - UINT value; -#endif + + #if !defined(BCM_SHM_INTERFACE) || defined(FLASH_DIRECT_ACCESS) + UINT value; + #endif + UINT uiFlashOffset = 0; - if(Adapter->eNVMType == NVM_FLASH) + if (Adapter->eNVMType == NVM_FLASH) { - if (IsSectionExistInVendorInfo(Adapter,Adapter->eActiveDSD)) - Status = vendorextnWriteSection(Adapter,(PUCHAR)pBuffer,Adapter->eActiveDSD,uiOffset,uiNumBytes,bVerify); + if (IsSectionExistInVendorInfo(Adapter, Adapter->eActiveDSD)) + Status = vendorextnWriteSection(Adapter, (PUCHAR)pBuffer, Adapter->eActiveDSD, uiOffset, uiNumBytes, bVerify); else { uiFlashOffset = uiOffset + Adapter->ulFlashCalStart; -#if defined(BCM_SHM_INTERFACE) && !defined(FLASH_DIRECT_ACCESS) - Status = bcmflash_raw_write((uiFlashOffset/FLASH_PART_SIZE), (uiFlashOffset % FLASH_PART_SIZE), (unsigned char *)pBuffer,uiNumBytes); -#else - rdmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); - value = 0; - wrmalt(Adapter, 0x0f000C80, &value, sizeof(value)); + #if defined(BCM_SHM_INTERFACE) && !defined(FLASH_DIRECT_ACCESS) + Status = bcmflash_raw_write((uiFlashOffset / FLASH_PART_SIZE), (uiFlashOffset % FLASH_PART_SIZE), (unsigned char *)pBuffer, uiNumBytes); + #else + rdmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); + value = 0; + wrmalt(Adapter, 0x0f000C80, &value, sizeof(value)); - if(Adapter->bStatusWrite == TRUE) - { - Status = BeceemFlashBulkWriteStatus(Adapter, - pBuffer, - uiFlashOffset, - uiNumBytes , - bVerify); - } - else - { + if (Adapter->bStatusWrite == TRUE) + { + Status = BeceemFlashBulkWriteStatus(Adapter, + pBuffer, + uiFlashOffset, + uiNumBytes , + bVerify); + } + else + { - Status = BeceemFlashBulkWrite(Adapter, - pBuffer, - uiFlashOffset, - uiNumBytes, - bVerify); - } -#endif + Status = BeceemFlashBulkWrite(Adapter, + pBuffer, + uiFlashOffset, + uiNumBytes, + bVerify); + } + #endif } - - if(uiOffset >= EEPROM_CALPARAM_START) + if (uiOffset >= EEPROM_CALPARAM_START) { uiMemoryLoc += (uiOffset - EEPROM_CALPARAM_START); - while(uiNumBytes) + while (uiNumBytes) { - if(uiNumBytes > BUFFER_4K) + if (uiNumBytes > BUFFER_4K) { - wrm(Adapter,(uiMemoryLoc+uiIndex),(PCHAR)(pBuffer+(uiIndex/4)),BUFFER_4K); + wrm(Adapter, (uiMemoryLoc+uiIndex), (PCHAR)(pBuffer + (uiIndex / 4)), BUFFER_4K); uiNumBytes -= BUFFER_4K; uiIndex += BUFFER_4K; } else { - wrm(Adapter,uiMemoryLoc+uiIndex,(PCHAR)(pBuffer+(uiIndex/4)),uiNumBytes); + wrm(Adapter, uiMemoryLoc+uiIndex, (PCHAR)(pBuffer + (uiIndex / 4)), uiNumBytes); uiNumBytes = 0; break; } @@ -2171,45 +2119,43 @@ INT BeceemNVMWrite( } else { - if((uiOffset+uiNumBytes) > EEPROM_CALPARAM_START) + if ((uiOffset + uiNumBytes) > EEPROM_CALPARAM_START) { ULONG ulBytesTobeSkipped = 0; - PUCHAR pcBuffer = (PUCHAR)pBuffer;// char pointer to take care of odd byte cases. + PUCHAR pcBuffer = (PUCHAR)pBuffer; // char pointer to take care of odd byte cases. uiNumBytes -= (EEPROM_CALPARAM_START - uiOffset); ulBytesTobeSkipped += (EEPROM_CALPARAM_START - uiOffset); uiOffset += (EEPROM_CALPARAM_START - uiOffset); - while(uiNumBytes) + while (uiNumBytes) { - if(uiNumBytes > BUFFER_4K) + if (uiNumBytes > BUFFER_4K) { - wrm(Adapter,uiMemoryLoc+uiIndex,(PCHAR )&pcBuffer[ulBytesTobeSkipped+uiIndex],BUFFER_4K); + wrm(Adapter, uiMemoryLoc + uiIndex, (PCHAR)&pcBuffer[ulBytesTobeSkipped + uiIndex], BUFFER_4K); uiNumBytes -= BUFFER_4K; uiIndex += BUFFER_4K; } else { - wrm(Adapter,uiMemoryLoc+uiIndex,(PCHAR)&pcBuffer[ulBytesTobeSkipped+uiIndex],uiNumBytes); + wrm(Adapter, uiMemoryLoc + uiIndex, (PCHAR)&pcBuffer[ulBytesTobeSkipped + uiIndex], uiNumBytes); uiNumBytes = 0; break; } } - } } - - // restore the values. - wrmalt(Adapter,0x0f000C80,&uiTemp, sizeof(uiTemp)); + // restore the values. + wrmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); } - else if(Adapter->eNVMType == NVM_EEPROM) + else if (Adapter->eNVMType == NVM_EEPROM) { Status = BeceemEEPROMBulkWrite(Adapter, (PUCHAR)pBuffer, uiOffset, uiNumBytes, bVerify); - if(bVerify) + if (bVerify) { - Status = BeceemEEPROMReadBackandVerify(Adapter,(PUINT)pBuffer,uiOffset,uiNumBytes); + Status = BeceemEEPROMReadBackandVerify(Adapter, (PUINT)pBuffer, uiOffset, uiNumBytes); } } else @@ -2233,47 +2179,41 @@ INT BeceemNVMWrite( // - if failed. //----------------------------------------------------------------------------- -INT BcmUpdateSectorSize(struct bcm_mini_adapter *Adapter,UINT uiSectorSize) +INT BcmUpdateSectorSize(struct bcm_mini_adapter *Adapter, UINT uiSectorSize) { INT Status = -1; FLASH_CS_INFO sFlashCsInfo = {0}; UINT uiTemp = 0; - UINT uiSectorSig = 0; UINT uiCurrentSectorSize = 0; - UINT value; - - rdmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); value = 0; - wrmalt(Adapter, 0x0f000C80,&value, sizeof(value)); + wrmalt(Adapter, 0x0f000C80, &value, sizeof(value)); -// -// Before updating the sector size in the reserved area, check if already present. -// - BeceemFlashBulkRead(Adapter,(PUINT)&sFlashCsInfo,Adapter->ulFlashControlSectionStart,sizeof(sFlashCsInfo)); + // + // Before updating the sector size in the reserved area, check if already present. + // + BeceemFlashBulkRead(Adapter, (PUINT)&sFlashCsInfo, Adapter->ulFlashControlSectionStart, sizeof(sFlashCsInfo)); uiSectorSig = ntohl(sFlashCsInfo.FlashSectorSizeSig); uiCurrentSectorSize = ntohl(sFlashCsInfo.FlashSectorSize); - if(uiSectorSig == FLASH_SECTOR_SIZE_SIG) + if (uiSectorSig == FLASH_SECTOR_SIZE_SIG) { - - if((uiCurrentSectorSize <= MAX_SECTOR_SIZE) && (uiCurrentSectorSize >= MIN_SECTOR_SIZE)) + if ((uiCurrentSectorSize <= MAX_SECTOR_SIZE) && (uiCurrentSectorSize >= MIN_SECTOR_SIZE)) { - if(uiSectorSize == uiCurrentSectorSize) + if (uiSectorSize == uiCurrentSectorSize) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Provided sector size is same as programmed in Flash"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Provided sector size is same as programmed in Flash"); Status = STATUS_SUCCESS; - goto Restore ; + goto Restore; } } } - if((uiSectorSize <= MAX_SECTOR_SIZE) && (uiSectorSize >= MIN_SECTOR_SIZE)) + if ((uiSectorSize <= MAX_SECTOR_SIZE) && (uiSectorSize >= MIN_SECTOR_SIZE)) { - sFlashCsInfo.FlashSectorSize = htonl(uiSectorSize); sFlashCsInfo.FlashSectorSizeSig = htonl(FLASH_SECTOR_SIZE_SIG); @@ -2282,17 +2222,13 @@ INT BcmUpdateSectorSize(struct bcm_mini_adapter *Adapter,UINT uiSectorSize) Adapter->ulFlashControlSectionStart, sizeof(sFlashCsInfo), TRUE); - - } - Restore : +Restore: // restore the values. - wrmalt(Adapter, 0x0f000C80,&uiTemp, sizeof(uiTemp)); - + wrmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); return Status; - } //----------------------------------------------------------------------------- @@ -2313,44 +2249,42 @@ static UINT BcmGetFlashSectorSize(struct bcm_mini_adapter *Adapter, UINT FlashSe UINT uiSectorSize = 0; UINT uiSectorSig = 0; - if(Adapter->bSectorSizeOverride && + if (Adapter->bSectorSizeOverride && (Adapter->uiSectorSizeInCFG <= MAX_SECTOR_SIZE && - Adapter->uiSectorSizeInCFG >= MIN_SECTOR_SIZE)) + Adapter->uiSectorSizeInCFG >= MIN_SECTOR_SIZE)) { Adapter->uiSectorSize = Adapter->uiSectorSizeInCFG; } else { - uiSectorSig = FlashSectorSizeSig; - if(uiSectorSig == FLASH_SECTOR_SIZE_SIG) + if (uiSectorSig == FLASH_SECTOR_SIZE_SIG) { uiSectorSize = FlashSectorSize; - // - // If the sector size stored in the FLASH makes sense then use it. - // - if(uiSectorSize <= MAX_SECTOR_SIZE && uiSectorSize >= MIN_SECTOR_SIZE) + // + // If the sector size stored in the FLASH makes sense then use it. + // + if (uiSectorSize <= MAX_SECTOR_SIZE && uiSectorSize >= MIN_SECTOR_SIZE) { Adapter->uiSectorSize = uiSectorSize; } - //No valid size in FLASH, check if Config file has it. - else if(Adapter->uiSectorSizeInCFG <= MAX_SECTOR_SIZE && - Adapter->uiSectorSizeInCFG >= MIN_SECTOR_SIZE) + //No valid size in FLASH, check if Config file has it. + else if (Adapter->uiSectorSizeInCFG <= MAX_SECTOR_SIZE && + Adapter->uiSectorSizeInCFG >= MIN_SECTOR_SIZE) { Adapter->uiSectorSize = Adapter->uiSectorSizeInCFG; } - // Init to Default, if none of the above works. + // Init to Default, if none of the above works. else { Adapter->uiSectorSize = DEFAULT_SECTOR_SIZE; } - } else { - if(Adapter->uiSectorSizeInCFG <= MAX_SECTOR_SIZE && - Adapter->uiSectorSizeInCFG >= MIN_SECTOR_SIZE) + if (Adapter->uiSectorSizeInCFG <= MAX_SECTOR_SIZE && + Adapter->uiSectorSizeInCFG >= MIN_SECTOR_SIZE) { Adapter->uiSectorSize = Adapter->uiSectorSizeInCFG; } @@ -2361,7 +2295,8 @@ static UINT BcmGetFlashSectorSize(struct bcm_mini_adapter *Adapter, UINT FlashSe } } - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Sector size :%x \n", Adapter->uiSectorSize); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Sector size :%x\n", Adapter->uiSectorSize); + return Adapter->uiSectorSize; } @@ -2383,20 +2318,20 @@ static INT BcmInitEEPROMQueues(struct bcm_mini_adapter *Adapter) /* CHIP Bug : Clear the Avail bits on the Read queue. The default * value on this register is supposed to be 0x00001102. * But we get 0x00001122. */ - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Fixing reset value on 0x0f003004 register\n" ); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Fixing reset value on 0x0f003004 register\n"); value = EEPROM_READ_DATA_AVAIL; - wrmalt( Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); + wrmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); /* Flush the all the EEPROM queues. */ - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, " Flushing the queues\n"); - value =EEPROM_ALL_QUEUE_FLUSH ; - wrmalt( Adapter, SPI_FLUSH_REG, &value, sizeof(value)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, " Flushing the queues\n"); + value = EEPROM_ALL_QUEUE_FLUSH; + wrmalt(Adapter, SPI_FLUSH_REG, &value, sizeof(value)); value = 0; - wrmalt( Adapter, SPI_FLUSH_REG, &value, sizeof(value) ); + wrmalt(Adapter, SPI_FLUSH_REG, &value, sizeof(value)); /* Read the EEPROM Status Register. Just to see, no real purpose. */ - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "EEPROM Status register value = %x\n", ReadEEPROMStatusRegister(Adapter) ); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "EEPROM Status register value = %x\n", ReadEEPROMStatusRegister(Adapter)); return STATUS_SUCCESS; } /* BcmInitEEPROMQueues() */ @@ -2418,15 +2353,15 @@ INT BcmInitNVM(struct bcm_mini_adapter *ps_adapter) BcmValidateNvmType(ps_adapter); BcmInitEEPROMQueues(ps_adapter); - if(ps_adapter->eNVMType == NVM_AUTODETECT) + if (ps_adapter->eNVMType == NVM_AUTODETECT) { ps_adapter->eNVMType = BcmGetNvmType(ps_adapter); - if(ps_adapter->eNVMType == NVM_UNKNOWN) + if (ps_adapter->eNVMType == NVM_UNKNOWN) { - BCM_DEBUG_PRINT(ps_adapter,DBG_TYPE_PRINTK, 0, 0, "NVM Type is unknown!!\n"); + BCM_DEBUG_PRINT(ps_adapter, DBG_TYPE_PRINTK, 0, 0, "NVM Type is unknown!!\n"); } } - else if(ps_adapter->eNVMType == NVM_FLASH) + else if (ps_adapter->eNVMType == NVM_FLASH) { BcmGetFlashCSInfo(ps_adapter); } @@ -2435,6 +2370,7 @@ INT BcmInitNVM(struct bcm_mini_adapter *ps_adapter) return STATUS_SUCCESS; } + /***************************************************************************/ /*BcmGetNvmSize : set the EEPROM or flash size in Adapter. * @@ -2447,11 +2383,11 @@ INT BcmInitNVM(struct bcm_mini_adapter *ps_adapter) static INT BcmGetNvmSize(struct bcm_mini_adapter *Adapter) { - if(Adapter->eNVMType == NVM_EEPROM) + if (Adapter->eNVMType == NVM_EEPROM) { Adapter->uiNVMDSDSize = BcmGetEEPROMSize(Adapter); } - else if(Adapter->eNVMType == NVM_FLASH) + else if (Adapter->eNVMType == NVM_FLASH) { Adapter->uiNVMDSDSize = BcmGetFlashSize(Adapter); } @@ -2469,21 +2405,22 @@ static INT BcmGetNvmSize(struct bcm_mini_adapter *Adapter) // Returns: // //----------------------------------------------------------------------------- + static VOID BcmValidateNvmType(struct bcm_mini_adapter *Adapter) { - // // if forcing the FLASH through CFG file, we should ensure device really has a FLASH. // Accessing the FLASH address without the FLASH being present can cause hang/freeze etc. // So if NVM_FLASH is selected for older chipsets, change it to AUTODETECT where EEPROM is 1st choice. // - if(Adapter->eNVMType == NVM_FLASH && + if (Adapter->eNVMType == NVM_FLASH && Adapter->chip_id < 0xBECE3300) { Adapter->eNVMType = NVM_AUTODETECT; } } + //----------------------------------------------------------------------------- // Procedure: BcmReadFlashRDID // @@ -2495,55 +2432,56 @@ static VOID BcmValidateNvmType(struct bcm_mini_adapter *Adapter) // Returns: // Flash ID //----------------------------------------------------------------------------- + static ULONG BcmReadFlashRDID(struct bcm_mini_adapter *Adapter) { ULONG ulRDID = 0; UINT value; -// -// Read ID Instruction. -// - value = (FLASH_CMD_READ_ID<<24); - wrmalt(Adapter, FLASH_SPI_CMDQ_REG,&value, sizeof(value)); -//Delay - udelay(10); -// -// Read SPI READQ REG. The output will be WWXXYYZZ. -// The ID is 3Bytes long and is WWXXYY. ZZ needs to be Ignored. -// - rdmalt(Adapter, FLASH_SPI_READQ_REG, (PUINT)&ulRDID, sizeof(ulRDID)); + // + // Read ID Instruction. + // + value = (FLASH_CMD_READ_ID << 24); + wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)); - return (ulRDID >>8); + //Delay + udelay(10); + // + // Read SPI READQ REG. The output will be WWXXYYZZ. + // The ID is 3Bytes long and is WWXXYY. ZZ needs to be Ignored. + // + rdmalt(Adapter, FLASH_SPI_READQ_REG, (PUINT)&ulRDID, sizeof(ulRDID)); + return (ulRDID >> 8); } INT BcmAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter) { - if(psAdapter == NULL) + if (psAdapter == NULL) { - BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_PRINTK, 0, 0, "Adapter structure point is NULL"); + BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_PRINTK, 0, 0, "Adapter structure point is NULL"); return -EINVAL; } psAdapter->psFlashCSInfo = (PFLASH_CS_INFO)kzalloc(sizeof(FLASH_CS_INFO), GFP_KERNEL); - if(psAdapter->psFlashCSInfo == NULL) + if (psAdapter->psFlashCSInfo == NULL) { - BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_PRINTK, 0, 0,"Can't Allocate memory for Flash 1.x"); + BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_PRINTK, 0, 0, "Can't Allocate memory for Flash 1.x"); return -ENOMEM; } psAdapter->psFlash2xCSInfo = (PFLASH2X_CS_INFO)kzalloc(sizeof(FLASH2X_CS_INFO), GFP_KERNEL); - if(psAdapter->psFlash2xCSInfo == NULL) + if (psAdapter->psFlash2xCSInfo == NULL) { - BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_PRINTK, 0, 0,"Can't Allocate memory for Flash 2.x"); + BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_PRINTK, 0, 0, "Can't Allocate memory for Flash 2.x"); kfree(psAdapter->psFlashCSInfo); return -ENOMEM; } psAdapter->psFlash2xVendorInfo = (PFLASH2X_VENDORSPECIFIC_INFO)kzalloc(sizeof(FLASH2X_VENDORSPECIFIC_INFO), GFP_KERNEL); - if(psAdapter->psFlash2xVendorInfo == NULL) + if (psAdapter->psFlash2xVendorInfo == NULL) { - BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_PRINTK, 0, 0,"Can't Allocate Vendor Info Memory for Flash 2.x"); + BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_PRINTK, 0, 0, "Can't Allocate Vendor Info Memory for Flash 2.x"); kfree(psAdapter->psFlashCSInfo); kfree(psAdapter->psFlash2xCSInfo); return -ENOMEM; @@ -2554,89 +2492,91 @@ INT BcmAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter) INT BcmDeAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter) { - if(psAdapter == NULL) + if (psAdapter == NULL) { - BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_PRINTK, 0, 0," Adapter structure point is NULL"); + BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_PRINTK, 0, 0, "Adapter structure point is NULL"); return -EINVAL; } kfree(psAdapter->psFlashCSInfo); kfree(psAdapter->psFlash2xCSInfo); kfree(psAdapter->psFlash2xVendorInfo); - return STATUS_SUCCESS ; + return STATUS_SUCCESS; } -static INT BcmDumpFlash2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo,struct bcm_mini_adapter *Adapter) +static INT BcmDumpFlash2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo, struct bcm_mini_adapter *Adapter) { UINT Index = 0; - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "**********************FLASH2X CS Structure *******************"); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Signature is :%x", (psFlash2xCSInfo->MagicNumber)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Flash Major Version :%d", MAJOR_VERSION(psFlash2xCSInfo->FlashLayoutVersion)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Flash Minor Version :%d", MINOR_VERSION(psFlash2xCSInfo->FlashLayoutVersion)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, " ISOImageMajorVersion:0x%x", (psFlash2xCSInfo->ISOImageVersion)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "SCSIFirmwareMajorVersion :0x%x", (psFlash2xCSInfo->SCSIFirmwareVersion)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForPart1ISOImage :0x%x", (psFlash2xCSInfo->OffsetFromZeroForPart1ISOImage)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForScsiFirmware :0x%x", (psFlash2xCSInfo->OffsetFromZeroForScsiFirmware)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "SizeOfScsiFirmware :0x%x", (psFlash2xCSInfo->SizeOfScsiFirmware )); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForPart2ISOImage :0x%x", (psFlash2xCSInfo->OffsetFromZeroForPart2ISOImage)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForDSDStart :0x%x", (psFlash2xCSInfo->OffsetFromZeroForDSDStart)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForDSDEnd :0x%x", (psFlash2xCSInfo->OffsetFromZeroForDSDEnd)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForVSAStart :0x%x", (psFlash2xCSInfo->OffsetFromZeroForVSAStart)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForVSAEnd :0x%x", (psFlash2xCSInfo->OffsetFromZeroForVSAEnd)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForControlSectionStart :0x%x", (psFlash2xCSInfo->OffsetFromZeroForControlSectionStart)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForControlSectionData :0x%x", (psFlash2xCSInfo->OffsetFromZeroForControlSectionData)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "CDLessInactivityTimeout :0x%x", (psFlash2xCSInfo->CDLessInactivityTimeout)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "NewImageSignature :0x%x", (psFlash2xCSInfo->NewImageSignature)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "FlashSectorSizeSig :0x%x", (psFlash2xCSInfo->FlashSectorSizeSig)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "FlashSectorSize :0x%x", (psFlash2xCSInfo->FlashSectorSize)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "FlashWriteSupportSize :0x%x", (psFlash2xCSInfo->FlashWriteSupportSize)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "TotalFlashSize :0x%X", (psFlash2xCSInfo->TotalFlashSize)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "FlashBaseAddr :0x%x", (psFlash2xCSInfo->FlashBaseAddr)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "FlashPartMaxSize :0x%x", (psFlash2xCSInfo->FlashPartMaxSize)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "IsCDLessDeviceBootSig :0x%x", (psFlash2xCSInfo->IsCDLessDeviceBootSig)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "MassStorageTimeout :0x%x", (psFlash2xCSInfo->MassStorageTimeout)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage1Part1Start :0x%x", (psFlash2xCSInfo->OffsetISOImage1Part1Start)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage1Part1End :0x%x", (psFlash2xCSInfo->OffsetISOImage1Part1End)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage1Part2Start :0x%x", (psFlash2xCSInfo->OffsetISOImage1Part2Start)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage1Part2End :0x%x", (psFlash2xCSInfo->OffsetISOImage1Part2End)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage1Part3Start :0x%x", (psFlash2xCSInfo->OffsetISOImage1Part3Start)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage1Part3End :0x%x", (psFlash2xCSInfo->OffsetISOImage1Part3End)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage2Part1Start :0x%x", (psFlash2xCSInfo->OffsetISOImage2Part1Start)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage2Part1End :0x%x", (psFlash2xCSInfo->OffsetISOImage2Part1End)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage2Part2Start :0x%x", (psFlash2xCSInfo->OffsetISOImage2Part2Start)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage2Part2End :0x%x", (psFlash2xCSInfo->OffsetISOImage2Part2End)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage2Part3Start :0x%x", (psFlash2xCSInfo->OffsetISOImage2Part3Start)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage2Part3End :0x%x", (psFlash2xCSInfo->OffsetISOImage2Part3End)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromDSDStartForDSDHeader :0x%x", (psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForDSD1Start :0x%x", (psFlash2xCSInfo->OffsetFromZeroForDSD1Start)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForDSD1End :0x%x", (psFlash2xCSInfo->OffsetFromZeroForDSD1End)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForDSD2Start :0x%x", (psFlash2xCSInfo->OffsetFromZeroForDSD2Start)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForDSD2End :0x%x", (psFlash2xCSInfo->OffsetFromZeroForDSD2End)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForVSA1Start :0x%x", (psFlash2xCSInfo->OffsetFromZeroForVSA1Start)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForVSA1End :0x%x", (psFlash2xCSInfo->OffsetFromZeroForVSA1End)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForVSA2Start :0x%x", (psFlash2xCSInfo->OffsetFromZeroForVSA2Start)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForVSA2End :0x%x", (psFlash2xCSInfo->OffsetFromZeroForVSA2End)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Sector Access Bit Map is Defined as :"); - for(Index =0; Index <(FLASH2X_TOTAL_SIZE/(DEFAULT_SECTOR_SIZE *16)); Index++) - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "SectorAccessBitMap[%d] :0x%x", Index, + + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "**********************FLASH2X CS Structure *******************"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Signature is :%x", (psFlash2xCSInfo->MagicNumber)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Flash Major Version :%d", MAJOR_VERSION(psFlash2xCSInfo->FlashLayoutVersion)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Flash Minor Version :%d", MINOR_VERSION(psFlash2xCSInfo->FlashLayoutVersion)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, " ISOImageMajorVersion:0x%x", (psFlash2xCSInfo->ISOImageVersion)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "SCSIFirmwareMajorVersion :0x%x", (psFlash2xCSInfo->SCSIFirmwareVersion)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForPart1ISOImage :0x%x", (psFlash2xCSInfo->OffsetFromZeroForPart1ISOImage)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForScsiFirmware :0x%x", (psFlash2xCSInfo->OffsetFromZeroForScsiFirmware)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "SizeOfScsiFirmware :0x%x", (psFlash2xCSInfo->SizeOfScsiFirmware)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForPart2ISOImage :0x%x", (psFlash2xCSInfo->OffsetFromZeroForPart2ISOImage)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForDSDStart :0x%x", (psFlash2xCSInfo->OffsetFromZeroForDSDStart)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForDSDEnd :0x%x", (psFlash2xCSInfo->OffsetFromZeroForDSDEnd)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForVSAStart :0x%x", (psFlash2xCSInfo->OffsetFromZeroForVSAStart)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForVSAEnd :0x%x", (psFlash2xCSInfo->OffsetFromZeroForVSAEnd)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForControlSectionStart :0x%x", (psFlash2xCSInfo->OffsetFromZeroForControlSectionStart)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForControlSectionData :0x%x", (psFlash2xCSInfo->OffsetFromZeroForControlSectionData)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "CDLessInactivityTimeout :0x%x", (psFlash2xCSInfo->CDLessInactivityTimeout)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "NewImageSignature :0x%x", (psFlash2xCSInfo->NewImageSignature)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "FlashSectorSizeSig :0x%x", (psFlash2xCSInfo->FlashSectorSizeSig)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "FlashSectorSize :0x%x", (psFlash2xCSInfo->FlashSectorSize)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "FlashWriteSupportSize :0x%x", (psFlash2xCSInfo->FlashWriteSupportSize)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "TotalFlashSize :0x%X", (psFlash2xCSInfo->TotalFlashSize)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "FlashBaseAddr :0x%x", (psFlash2xCSInfo->FlashBaseAddr)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "FlashPartMaxSize :0x%x", (psFlash2xCSInfo->FlashPartMaxSize)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "IsCDLessDeviceBootSig :0x%x", (psFlash2xCSInfo->IsCDLessDeviceBootSig)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "MassStorageTimeout :0x%x", (psFlash2xCSInfo->MassStorageTimeout)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage1Part1Start :0x%x", (psFlash2xCSInfo->OffsetISOImage1Part1Start)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage1Part1End :0x%x", (psFlash2xCSInfo->OffsetISOImage1Part1End)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage1Part2Start :0x%x", (psFlash2xCSInfo->OffsetISOImage1Part2Start)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage1Part2End :0x%x", (psFlash2xCSInfo->OffsetISOImage1Part2End)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage1Part3Start :0x%x", (psFlash2xCSInfo->OffsetISOImage1Part3Start)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage1Part3End :0x%x", (psFlash2xCSInfo->OffsetISOImage1Part3End)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage2Part1Start :0x%x", (psFlash2xCSInfo->OffsetISOImage2Part1Start)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage2Part1End :0x%x", (psFlash2xCSInfo->OffsetISOImage2Part1End)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage2Part2Start :0x%x", (psFlash2xCSInfo->OffsetISOImage2Part2Start)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage2Part2End :0x%x", (psFlash2xCSInfo->OffsetISOImage2Part2End)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage2Part3Start :0x%x", (psFlash2xCSInfo->OffsetISOImage2Part3Start)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetISOImage2Part3End :0x%x", (psFlash2xCSInfo->OffsetISOImage2Part3End)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromDSDStartForDSDHeader :0x%x", (psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForDSD1Start :0x%x", (psFlash2xCSInfo->OffsetFromZeroForDSD1Start)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForDSD1End :0x%x", (psFlash2xCSInfo->OffsetFromZeroForDSD1End)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForDSD2Start :0x%x", (psFlash2xCSInfo->OffsetFromZeroForDSD2Start)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForDSD2End :0x%x", (psFlash2xCSInfo->OffsetFromZeroForDSD2End)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForVSA1Start :0x%x", (psFlash2xCSInfo->OffsetFromZeroForVSA1Start)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForVSA1End :0x%x", (psFlash2xCSInfo->OffsetFromZeroForVSA1End)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForVSA2Start :0x%x", (psFlash2xCSInfo->OffsetFromZeroForVSA2Start)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "OffsetFromZeroForVSA2End :0x%x", (psFlash2xCSInfo->OffsetFromZeroForVSA2End)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Sector Access Bit Map is Defined as :"); + + for (Index = 0; Index < (FLASH2X_TOTAL_SIZE / (DEFAULT_SECTOR_SIZE * 16)); Index++) + { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "SectorAccessBitMap[%d] :0x%x", Index, (psFlash2xCSInfo->SectorAccessBitMap[Index])); } return STATUS_SUCCESS; } - -static INT ConvertEndianOf2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo) +static INT ConvertEndianOf2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo) { UINT Index = 0; + psFlash2xCSInfo->MagicNumber = ntohl(psFlash2xCSInfo->MagicNumber); - psFlash2xCSInfo->FlashLayoutVersion= ntohl(psFlash2xCSInfo->FlashLayoutVersion); + psFlash2xCSInfo->FlashLayoutVersion = ntohl(psFlash2xCSInfo->FlashLayoutVersion); //psFlash2xCSInfo->FlashLayoutMinorVersion = ntohs(psFlash2xCSInfo->FlashLayoutMinorVersion); psFlash2xCSInfo->ISOImageVersion = ntohl(psFlash2xCSInfo->ISOImageVersion); - psFlash2xCSInfo->SCSIFirmwareVersion =ntohl(psFlash2xCSInfo->SCSIFirmwareVersion); + psFlash2xCSInfo->SCSIFirmwareVersion = ntohl(psFlash2xCSInfo->SCSIFirmwareVersion); psFlash2xCSInfo->OffsetFromZeroForPart1ISOImage = ntohl(psFlash2xCSInfo->OffsetFromZeroForPart1ISOImage); psFlash2xCSInfo->OffsetFromZeroForScsiFirmware = ntohl(psFlash2xCSInfo->OffsetFromZeroForScsiFirmware); - psFlash2xCSInfo->SizeOfScsiFirmware = ntohl(psFlash2xCSInfo->SizeOfScsiFirmware ); + psFlash2xCSInfo->SizeOfScsiFirmware = ntohl(psFlash2xCSInfo->SizeOfScsiFirmware); psFlash2xCSInfo->OffsetFromZeroForPart2ISOImage = ntohl(psFlash2xCSInfo->OffsetFromZeroForPart2ISOImage); psFlash2xCSInfo->OffsetFromZeroForDSDStart = ntohl(psFlash2xCSInfo->OffsetFromZeroForDSDStart); psFlash2xCSInfo->OffsetFromZeroForDSDEnd = ntohl(psFlash2xCSInfo->OffsetFromZeroForDSDEnd); @@ -2675,51 +2615,51 @@ static INT ConvertEndianOf2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo) psFlash2xCSInfo->OffsetFromZeroForVSA1End = ntohl(psFlash2xCSInfo->OffsetFromZeroForVSA1End); psFlash2xCSInfo->OffsetFromZeroForVSA2Start = ntohl(psFlash2xCSInfo->OffsetFromZeroForVSA2Start); psFlash2xCSInfo->OffsetFromZeroForVSA2End = ntohl(psFlash2xCSInfo->OffsetFromZeroForVSA2End); - for(Index =0; Index <(FLASH2X_TOTAL_SIZE/(DEFAULT_SECTOR_SIZE *16)); Index++) + + for (Index = 0; Index < (FLASH2X_TOTAL_SIZE / (DEFAULT_SECTOR_SIZE * 16)); Index++) { - psFlash2xCSInfo->SectorAccessBitMap[Index] = ntohl(psFlash2xCSInfo->SectorAccessBitMap[Index]); + psFlash2xCSInfo->SectorAccessBitMap[Index] = ntohl(psFlash2xCSInfo->SectorAccessBitMap[Index]); } return STATUS_SUCCESS; } -static INT ConvertEndianOfCSStructure(PFLASH_CS_INFO psFlashCSInfo) +static INT ConvertEndianOfCSStructure(PFLASH_CS_INFO psFlashCSInfo) { //UINT Index = 0; - psFlashCSInfo->MagicNumber =ntohl(psFlashCSInfo->MagicNumber); - psFlashCSInfo->FlashLayoutVersion =ntohl(psFlashCSInfo->FlashLayoutVersion); - psFlashCSInfo->ISOImageVersion = ntohl(psFlashCSInfo->ISOImageVersion); + psFlashCSInfo->MagicNumber = ntohl(psFlashCSInfo->MagicNumber); + psFlashCSInfo->FlashLayoutVersion = ntohl(psFlashCSInfo->FlashLayoutVersion); + psFlashCSInfo->ISOImageVersion = ntohl(psFlashCSInfo->ISOImageVersion); //won't convert according to old assumption - psFlashCSInfo->SCSIFirmwareVersion =(psFlashCSInfo->SCSIFirmwareVersion); - - psFlashCSInfo->OffsetFromZeroForPart1ISOImage = ntohl(psFlashCSInfo->OffsetFromZeroForPart1ISOImage); - psFlashCSInfo->OffsetFromZeroForScsiFirmware = ntohl(psFlashCSInfo->OffsetFromZeroForScsiFirmware); - psFlashCSInfo->SizeOfScsiFirmware = ntohl(psFlashCSInfo->SizeOfScsiFirmware ); - psFlashCSInfo->OffsetFromZeroForPart2ISOImage = ntohl(psFlashCSInfo->OffsetFromZeroForPart2ISOImage); - psFlashCSInfo->OffsetFromZeroForCalibrationStart = ntohl(psFlashCSInfo->OffsetFromZeroForCalibrationStart); - psFlashCSInfo->OffsetFromZeroForCalibrationEnd = ntohl(psFlashCSInfo->OffsetFromZeroForCalibrationEnd); - psFlashCSInfo->OffsetFromZeroForVSAStart = ntohl(psFlashCSInfo->OffsetFromZeroForVSAStart); - psFlashCSInfo->OffsetFromZeroForVSAEnd = ntohl(psFlashCSInfo->OffsetFromZeroForVSAEnd); - psFlashCSInfo->OffsetFromZeroForControlSectionStart = ntohl(psFlashCSInfo->OffsetFromZeroForControlSectionStart); - psFlashCSInfo->OffsetFromZeroForControlSectionData = ntohl(psFlashCSInfo->OffsetFromZeroForControlSectionData); - psFlashCSInfo->CDLessInactivityTimeout = ntohl(psFlashCSInfo->CDLessInactivityTimeout); - psFlashCSInfo->NewImageSignature = ntohl(psFlashCSInfo->NewImageSignature); - psFlashCSInfo->FlashSectorSizeSig = ntohl(psFlashCSInfo->FlashSectorSizeSig); - psFlashCSInfo->FlashSectorSize = ntohl(psFlashCSInfo->FlashSectorSize); - psFlashCSInfo->FlashWriteSupportSize = ntohl(psFlashCSInfo->FlashWriteSupportSize); - psFlashCSInfo->TotalFlashSize = ntohl(psFlashCSInfo->TotalFlashSize); - psFlashCSInfo->FlashBaseAddr = ntohl(psFlashCSInfo->FlashBaseAddr); - psFlashCSInfo->FlashPartMaxSize = ntohl(psFlashCSInfo->FlashPartMaxSize); - psFlashCSInfo->IsCDLessDeviceBootSig = ntohl(psFlashCSInfo->IsCDLessDeviceBootSig); - psFlashCSInfo->MassStorageTimeout = ntohl(psFlashCSInfo->MassStorageTimeout); + psFlashCSInfo->SCSIFirmwareVersion = (psFlashCSInfo->SCSIFirmwareVersion); + psFlashCSInfo->OffsetFromZeroForPart1ISOImage = ntohl(psFlashCSInfo->OffsetFromZeroForPart1ISOImage); + psFlashCSInfo->OffsetFromZeroForScsiFirmware = ntohl(psFlashCSInfo->OffsetFromZeroForScsiFirmware); + psFlashCSInfo->SizeOfScsiFirmware = ntohl(psFlashCSInfo->SizeOfScsiFirmware); + psFlashCSInfo->OffsetFromZeroForPart2ISOImage = ntohl(psFlashCSInfo->OffsetFromZeroForPart2ISOImage); + psFlashCSInfo->OffsetFromZeroForCalibrationStart = ntohl(psFlashCSInfo->OffsetFromZeroForCalibrationStart); + psFlashCSInfo->OffsetFromZeroForCalibrationEnd = ntohl(psFlashCSInfo->OffsetFromZeroForCalibrationEnd); + psFlashCSInfo->OffsetFromZeroForVSAStart = ntohl(psFlashCSInfo->OffsetFromZeroForVSAStart); + psFlashCSInfo->OffsetFromZeroForVSAEnd = ntohl(psFlashCSInfo->OffsetFromZeroForVSAEnd); + psFlashCSInfo->OffsetFromZeroForControlSectionStart = ntohl(psFlashCSInfo->OffsetFromZeroForControlSectionStart); + psFlashCSInfo->OffsetFromZeroForControlSectionData = ntohl(psFlashCSInfo->OffsetFromZeroForControlSectionData); + psFlashCSInfo->CDLessInactivityTimeout = ntohl(psFlashCSInfo->CDLessInactivityTimeout); + psFlashCSInfo->NewImageSignature = ntohl(psFlashCSInfo->NewImageSignature); + psFlashCSInfo->FlashSectorSizeSig = ntohl(psFlashCSInfo->FlashSectorSizeSig); + psFlashCSInfo->FlashSectorSize = ntohl(psFlashCSInfo->FlashSectorSize); + psFlashCSInfo->FlashWriteSupportSize = ntohl(psFlashCSInfo->FlashWriteSupportSize); + psFlashCSInfo->TotalFlashSize = ntohl(psFlashCSInfo->TotalFlashSize); + psFlashCSInfo->FlashBaseAddr = ntohl(psFlashCSInfo->FlashBaseAddr); + psFlashCSInfo->FlashPartMaxSize = ntohl(psFlashCSInfo->FlashPartMaxSize); + psFlashCSInfo->IsCDLessDeviceBootSig = ntohl(psFlashCSInfo->IsCDLessDeviceBootSig); + psFlashCSInfo->MassStorageTimeout = ntohl(psFlashCSInfo->MassStorageTimeout); return STATUS_SUCCESS; } static INT IsSectionExistInVendorInfo(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL section) { - return ( Adapter->uiVendorExtnFlag && - (Adapter->psFlash2xVendorInfo->VendorSection[section].AccessFlags & FLASH2X_SECTION_PRESENT) && - (Adapter->psFlash2xVendorInfo->VendorSection[section].OffsetFromZeroForSectionStart != UNINIT_PTR_IN_CS) ); + return (Adapter->uiVendorExtnFlag && + (Adapter->psFlash2xVendorInfo->VendorSection[section].AccessFlags & FLASH2X_SECTION_PRESENT) && + (Adapter->psFlash2xVendorInfo->VendorSection[section].OffsetFromZeroForSectionStart != UNINIT_PTR_IN_CS)); } static VOID UpdateVendorInfo(struct bcm_mini_adapter *Adapter) @@ -2729,16 +2669,16 @@ static VOID UpdateVendorInfo(struct bcm_mini_adapter *Adapter) Adapter->uiVendorExtnFlag = FALSE; - for(i = 0;i < TOTAL_SECTIONS;i++) + for (i = 0; i < TOTAL_SECTIONS; i++) Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart = UNINIT_PTR_IN_CS; - if(STATUS_SUCCESS != vendorextnGetSectionInfo(Adapter, Adapter->psFlash2xVendorInfo)) + if (STATUS_SUCCESS != vendorextnGetSectionInfo(Adapter, Adapter->psFlash2xVendorInfo)) return; i = 0; - while(i < TOTAL_SECTIONS) + while (i < TOTAL_SECTIONS) { - if(!(Adapter->psFlash2xVendorInfo->VendorSection[i].AccessFlags & FLASH2X_SECTION_PRESENT)) + if (!(Adapter->psFlash2xVendorInfo->VendorSection[i].AccessFlags & FLASH2X_SECTION_PRESENT)) { i++; continue; @@ -2746,59 +2686,58 @@ static VOID UpdateVendorInfo(struct bcm_mini_adapter *Adapter) Adapter->uiVendorExtnFlag = TRUE; uiSizeSection = (Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionEnd - - Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart); + Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart); - switch(i) + switch (i) { - case DSD0: - if(( uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER))) && - (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart)) - Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDEnd = VENDOR_PTR_IN_CS; - else - Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDEnd = UNINIT_PTR_IN_CS; - break; + case DSD0: + if ((uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER))) && + (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart)) + Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDEnd = VENDOR_PTR_IN_CS; + else + Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDEnd = UNINIT_PTR_IN_CS; + break; - case DSD1: - if(( uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER))) && - (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart)) - Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1End = VENDOR_PTR_IN_CS; - else - Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1End = UNINIT_PTR_IN_CS; - break; + case DSD1: + if ((uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER))) && + (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart)) + Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1End = VENDOR_PTR_IN_CS; + else + Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1End = UNINIT_PTR_IN_CS; + break; - case DSD2: - if(( uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER))) && - (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart)) - Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2End = VENDOR_PTR_IN_CS; - else - Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2End = UNINIT_PTR_IN_CS; - break; - case VSA0: - if(UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart) - Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAEnd = VENDOR_PTR_IN_CS; - else - Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAEnd = UNINIT_PTR_IN_CS; - break; + case DSD2: + if ((uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER))) && + (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart)) + Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2End = VENDOR_PTR_IN_CS; + else + Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2End = UNINIT_PTR_IN_CS; + break; + case VSA0: + if (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart) + Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAEnd = VENDOR_PTR_IN_CS; + else + Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAEnd = UNINIT_PTR_IN_CS; + break; - case VSA1: - if(UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart) - Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1End = VENDOR_PTR_IN_CS; - else - Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1End = UNINIT_PTR_IN_CS; - break; - case VSA2: - if(UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart) - Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2End = VENDOR_PTR_IN_CS; - else - Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2End = UNINIT_PTR_IN_CS; - break; + case VSA1: + if (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart) + Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1End = VENDOR_PTR_IN_CS; + else + Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1End = UNINIT_PTR_IN_CS; + break; + case VSA2: + if (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart) + Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2End = VENDOR_PTR_IN_CS; + else + Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2End = UNINIT_PTR_IN_CS; + break; - default: - break; + default: + break; } i++; } - } //----------------------------------------------------------------------------- @@ -2817,21 +2756,21 @@ static INT BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) { //FLASH_CS_INFO sFlashCsInfo = {0}; -#if !defined(BCM_SHM_INTERFACE) || defined(FLASH_DIRECT_ACCESS) - UINT value; -#endif + #if !defined(BCM_SHM_INTERFACE) || defined(FLASH_DIRECT_ACCESS) + UINT value; + #endif + UINT uiFlashLayoutMajorVersion; Adapter->uiFlashLayoutMinorVersion = 0; Adapter->uiFlashLayoutMajorVersion = 0; Adapter->ulFlashControlSectionStart = FLASH_CS_INFO_START_ADDR; - Adapter->uiFlashBaseAdd = 0; Adapter->ulFlashCalStart = 0; - memset(Adapter->psFlashCSInfo, 0 ,sizeof(FLASH_CS_INFO)); - memset(Adapter->psFlash2xCSInfo, 0 ,sizeof(FLASH2X_CS_INFO)); + memset(Adapter->psFlashCSInfo, 0 , sizeof(FLASH_CS_INFO)); + memset(Adapter->psFlash2xCSInfo, 0 , sizeof(FLASH2X_CS_INFO)); - if(!Adapter->bDDRInitDone) + if (!Adapter->bDDRInitDone) { { value = FLASH_CONTIGIOUS_START_ADDR_BEFORE_INIT; @@ -2839,17 +2778,16 @@ static INT BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) } } - // Reading first 8 Bytes to get the Flash Layout // MagicNumber(4 bytes) +FlashLayoutMinorVersion(2 Bytes) +FlashLayoutMajorVersion(2 Bytes) - BeceemFlashBulkRead(Adapter,(PUINT)Adapter->psFlashCSInfo,Adapter->ulFlashControlSectionStart,8); + BeceemFlashBulkRead(Adapter, (PUINT)Adapter->psFlashCSInfo, Adapter->ulFlashControlSectionStart, 8); Adapter->psFlashCSInfo->FlashLayoutVersion = ntohl(Adapter->psFlashCSInfo->FlashLayoutVersion); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Flash Layout Version :%X", (Adapter->psFlashCSInfo->FlashLayoutVersion)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Flash Layout Version :%X", (Adapter->psFlashCSInfo->FlashLayoutVersion)); //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Flash Layout Minor Version :%d\n", ntohs(sFlashCsInfo.FlashLayoutMinorVersion)); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Signature is :%x\n", ntohl(Adapter->psFlashCSInfo->MagicNumber)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Signature is :%x\n", ntohl(Adapter->psFlashCSInfo->MagicNumber)); - if(FLASH_CONTROL_STRUCT_SIGNATURE == ntohl(Adapter->psFlashCSInfo->MagicNumber)) + if (FLASH_CONTROL_STRUCT_SIGNATURE == ntohl(Adapter->psFlashCSInfo->MagicNumber)) { uiFlashLayoutMajorVersion = MAJOR_VERSION((Adapter->psFlashCSInfo->FlashLayoutVersion)); Adapter->uiFlashLayoutMinorVersion = MINOR_VERSION((Adapter->psFlashCSInfo->FlashLayoutVersion)); @@ -2860,71 +2798,68 @@ static INT BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) uiFlashLayoutMajorVersion = 0; } - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"FLASH LAYOUT MAJOR VERSION :%X", uiFlashLayoutMajorVersion); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "FLASH LAYOUT MAJOR VERSION :%X", uiFlashLayoutMajorVersion); - if(uiFlashLayoutMajorVersion < FLASH_2X_MAJOR_NUMBER) + if (uiFlashLayoutMajorVersion < FLASH_2X_MAJOR_NUMBER) { - BeceemFlashBulkRead(Adapter,(PUINT)Adapter->psFlashCSInfo,Adapter->ulFlashControlSectionStart,sizeof(FLASH_CS_INFO)); + BeceemFlashBulkRead(Adapter, (PUINT)Adapter->psFlashCSInfo, Adapter->ulFlashControlSectionStart, sizeof(FLASH_CS_INFO)); ConvertEndianOfCSStructure(Adapter->psFlashCSInfo); Adapter->ulFlashCalStart = (Adapter->psFlashCSInfo->OffsetFromZeroForCalibrationStart); - if(!((Adapter->uiFlashLayoutMajorVersion == 1) && (Adapter->uiFlashLayoutMinorVersion == 1))) + if (!((Adapter->uiFlashLayoutMajorVersion == 1) && (Adapter->uiFlashLayoutMinorVersion == 1))) { Adapter->ulFlashControlSectionStart = Adapter->psFlashCSInfo->OffsetFromZeroForControlSectionStart; } - if((FLASH_CONTROL_STRUCT_SIGNATURE == (Adapter->psFlashCSInfo->MagicNumber)) && - (SCSI_FIRMWARE_MINOR_VERSION <= MINOR_VERSION(Adapter->psFlashCSInfo->SCSIFirmwareVersion)) && - (FLASH_SECTOR_SIZE_SIG == (Adapter->psFlashCSInfo->FlashSectorSizeSig)) && - (BYTE_WRITE_SUPPORT == (Adapter->psFlashCSInfo->FlashWriteSupportSize))) + if ((FLASH_CONTROL_STRUCT_SIGNATURE == (Adapter->psFlashCSInfo->MagicNumber)) && + (SCSI_FIRMWARE_MINOR_VERSION <= MINOR_VERSION(Adapter->psFlashCSInfo->SCSIFirmwareVersion)) && + (FLASH_SECTOR_SIZE_SIG == (Adapter->psFlashCSInfo->FlashSectorSizeSig)) && + (BYTE_WRITE_SUPPORT == (Adapter->psFlashCSInfo->FlashWriteSupportSize))) { Adapter->ulFlashWriteSize = (Adapter->psFlashCSInfo->FlashWriteSupportSize); - Adapter->fpFlashWrite = flashByteWrite; - Adapter->fpFlashWriteWithStatusCheck = flashByteWriteStatus; + Adapter->fpFlashWrite = flashByteWrite; + Adapter->fpFlashWriteWithStatusCheck = flashByteWriteStatus; } else { Adapter->ulFlashWriteSize = MAX_RW_SIZE; Adapter->fpFlashWrite = flashWrite; - Adapter->fpFlashWriteWithStatusCheck = flashWriteStatus; + Adapter->fpFlashWriteWithStatusCheck = flashWriteStatus; } BcmGetFlashSectorSize(Adapter, (Adapter->psFlashCSInfo->FlashSectorSizeSig), - (Adapter->psFlashCSInfo->FlashSectorSize)); - - + (Adapter->psFlashCSInfo->FlashSectorSize)); Adapter->uiFlashBaseAdd = Adapter->psFlashCSInfo->FlashBaseAddr & 0xFCFFFFFF; - - } else { - if(BcmFlash2xBulkRead(Adapter,(PUINT)Adapter->psFlash2xCSInfo,NO_SECTION_VAL, - Adapter->ulFlashControlSectionStart,sizeof(FLASH2X_CS_INFO))) + if (BcmFlash2xBulkRead(Adapter, (PUINT)Adapter->psFlash2xCSInfo, NO_SECTION_VAL, + Adapter->ulFlashControlSectionStart, sizeof(FLASH2X_CS_INFO))) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Unable to read CS structure \n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Unable to read CS structure\n"); return STATUS_FAILURE; } + ConvertEndianOf2XCSStructure(Adapter->psFlash2xCSInfo); - BcmDumpFlash2XCSStructure(Adapter->psFlash2xCSInfo,Adapter); - if((FLASH_CONTROL_STRUCT_SIGNATURE == Adapter->psFlash2xCSInfo->MagicNumber) && - (SCSI_FIRMWARE_MINOR_VERSION <= MINOR_VERSION(Adapter->psFlash2xCSInfo->SCSIFirmwareVersion)) && - (FLASH_SECTOR_SIZE_SIG == Adapter->psFlash2xCSInfo->FlashSectorSizeSig) && - (BYTE_WRITE_SUPPORT == Adapter->psFlash2xCSInfo->FlashWriteSupportSize)) + BcmDumpFlash2XCSStructure(Adapter->psFlash2xCSInfo, Adapter); + if ((FLASH_CONTROL_STRUCT_SIGNATURE == Adapter->psFlash2xCSInfo->MagicNumber) && + (SCSI_FIRMWARE_MINOR_VERSION <= MINOR_VERSION(Adapter->psFlash2xCSInfo->SCSIFirmwareVersion)) && + (FLASH_SECTOR_SIZE_SIG == Adapter->psFlash2xCSInfo->FlashSectorSizeSig) && + (BYTE_WRITE_SUPPORT == Adapter->psFlash2xCSInfo->FlashWriteSupportSize)) { Adapter->ulFlashWriteSize = Adapter->psFlash2xCSInfo->FlashWriteSupportSize; - Adapter->fpFlashWrite = flashByteWrite; - Adapter->fpFlashWriteWithStatusCheck = flashByteWriteStatus; + Adapter->fpFlashWrite = flashByteWrite; + Adapter->fpFlashWriteWithStatusCheck = flashByteWriteStatus; } else { Adapter->ulFlashWriteSize = MAX_RW_SIZE; Adapter->fpFlashWrite = flashWrite; - Adapter->fpFlashWriteWithStatusCheck = flashWriteStatus; + Adapter->fpFlashWriteWithStatusCheck = flashWriteStatus; } BcmGetFlashSectorSize(Adapter, Adapter->psFlash2xCSInfo->FlashSectorSizeSig, - Adapter->psFlash2xCSInfo->FlashSectorSize); + Adapter->psFlash2xCSInfo->FlashSectorSize); UpdateVendorInfo(Adapter); @@ -2932,21 +2867,17 @@ static INT BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) BcmGetActiveISO(Adapter); Adapter->uiFlashBaseAdd = Adapter->psFlash2xCSInfo->FlashBaseAddr & 0xFCFFFFFF; Adapter->ulFlashControlSectionStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForControlSectionStart; - } /* - Concerns: what if CS sector size does not match with this sector size ??? - what is the indication of AccessBitMap in CS in flash 2.x ???? + Concerns: what if CS sector size does not match with this sector size ??? + what is the indication of AccessBitMap in CS in flash 2.x ???? */ Adapter->ulFlashID = BcmReadFlashRDID(Adapter); - Adapter->uiFlashLayoutMajorVersion = uiFlashLayoutMajorVersion; - - return STATUS_SUCCESS ; + return STATUS_SUCCESS; } - //----------------------------------------------------------------------------- // Procedure: BcmGetNvmType // @@ -2964,33 +2895,33 @@ static NVM_TYPE BcmGetNvmType(struct bcm_mini_adapter *Adapter) { UINT uiData = 0; - BeceemEEPROMBulkRead(Adapter,&uiData,0x0,4); - if(uiData == BECM) + BeceemEEPROMBulkRead(Adapter, &uiData, 0x0, 4); + if (uiData == BECM) { return NVM_EEPROM; } + // // Read control struct and get cal addresses before accessing the flash // BcmGetFlashCSInfo(Adapter); - BeceemFlashBulkRead(Adapter,&uiData,0x0 + Adapter->ulFlashCalStart,4); - if(uiData == BECM) + BeceemFlashBulkRead(Adapter, &uiData, 0x0 + Adapter->ulFlashCalStart, 4); + if (uiData == BECM) { return NVM_FLASH; } -// -// even if there is no valid signature on EEPROM/FLASH find out if they really exist. -// if exist select it. -// - if(BcmGetEEPROMSize(Adapter)) + + // + // even if there is no valid signature on EEPROM/FLASH find out if they really exist. + // if exist select it. + // + if (BcmGetEEPROMSize(Adapter)) { return NVM_EEPROM; } -//TBD for Flash. - - + //TBD for Flash. return NVM_UNKNOWN; } @@ -3007,84 +2938,85 @@ static NVM_TYPE BcmGetNvmType(struct bcm_mini_adapter *Adapter) INT BcmGetSectionValStartOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlashSectionVal) { /* - * Considering all the section for which end offset can be calculated or directly given - * in CS Structure. if matching case does not exist, return STATUS_FAILURE indicating section - * endoffset can't be calculated or given in CS Structure. - */ + * Considering all the section for which end offset can be calculated or directly given + * in CS Structure. if matching case does not exist, return STATUS_FAILURE indicating section + * endoffset can't be calculated or given in CS Structure. + */ - INT SectStartOffset = 0 ; + INT SectStartOffset = 0; - SectStartOffset = INVALID_OFFSET ; + SectStartOffset = INVALID_OFFSET; - if(IsSectionExistInVendorInfo(Adapter,eFlashSectionVal)) + if (IsSectionExistInVendorInfo(Adapter, eFlashSectionVal)) { return Adapter->psFlash2xVendorInfo->VendorSection[eFlashSectionVal].OffsetFromZeroForSectionStart; } - switch(eFlashSectionVal) - { - case ISO_IMAGE1 : - if((Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start != UNINIT_PTR_IN_CS) && - (IsNonCDLessDevice(Adapter) == FALSE)) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start); - break; - case ISO_IMAGE2 : - if((Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start != UNINIT_PTR_IN_CS) && - (IsNonCDLessDevice(Adapter) == FALSE)) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start); - break; - case DSD0 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart); - break; - case DSD1 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start); - break; - case DSD2 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start); - break; - case VSA0 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart); - break; - case VSA1 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start); - break; - case VSA2 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start); - break; - case SCSI : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware); - break; - case CONTROL_SECTION : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForControlSectionStart != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForControlSectionStart); - break; - case ISO_IMAGE1_PART2 : - if(Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start); - break; - case ISO_IMAGE1_PART3 : - if(Adapter->psFlash2xCSInfo->OffsetISOImage1Part3Start != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3Start); - break; - case ISO_IMAGE2_PART2 : - if(Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start); - break; - case ISO_IMAGE2_PART3 : - if(Adapter->psFlash2xCSInfo->OffsetISOImage2Part3Start != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3Start); - break; - default : - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Section Does not exist in Flash 2.x"); - SectStartOffset = INVALID_OFFSET; + switch (eFlashSectionVal) + { + case ISO_IMAGE1: + if ((Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start != UNINIT_PTR_IN_CS) && + (IsNonCDLessDevice(Adapter) == FALSE)) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start); + break; + case ISO_IMAGE2: + if ((Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start != UNINIT_PTR_IN_CS) && + (IsNonCDLessDevice(Adapter) == FALSE)) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start); + break; + case DSD0: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart); + break; + case DSD1: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start); + break; + case DSD2: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start); + break; + case VSA0: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart); + break; + case VSA1: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start); + break; + case VSA2: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start); + break; + case SCSI: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware); + break; + case CONTROL_SECTION: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForControlSectionStart != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForControlSectionStart); + break; + case ISO_IMAGE1_PART2: + if (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start); + break; + case ISO_IMAGE1_PART3: + if (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3Start != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3Start); + break; + case ISO_IMAGE2_PART2: + if (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start); + break; + case ISO_IMAGE2_PART3: + if (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3Start != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3Start); + break; + default: + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Section Does not exist in Flash 2.x"); + SectStartOffset = INVALID_OFFSET; } + return SectStartOffset; } @@ -3100,78 +3032,78 @@ INT BcmGetSectionValStartOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTIO INT BcmGetSectionValEndOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) { - INT SectEndOffset = 0 ; - SectEndOffset = INVALID_OFFSET; + INT SectEndOffset = 0; - if(IsSectionExistInVendorInfo(Adapter,eFlash2xSectionVal)) + SectEndOffset = INVALID_OFFSET; + if (IsSectionExistInVendorInfo(Adapter, eFlash2xSectionVal)) { return Adapter->psFlash2xVendorInfo->VendorSection[eFlash2xSectionVal].OffsetFromZeroForSectionEnd; } - switch(eFlash2xSectionVal) + switch (eFlash2xSectionVal) { - case ISO_IMAGE1 : - if((Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End!= UNINIT_PTR_IN_CS) && - (IsNonCDLessDevice(Adapter) == FALSE)) - SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End); - break; - case ISO_IMAGE2 : - if((Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End!= UNINIT_PTR_IN_CS) && + case ISO_IMAGE1: + if ((Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End != UNINIT_PTR_IN_CS) && (IsNonCDLessDevice(Adapter) == FALSE)) - SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End); - break; - case DSD0 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDEnd != UNINIT_PTR_IN_CS) + SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End); + break; + case ISO_IMAGE2: + if ((Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End != UNINIT_PTR_IN_CS) && + (IsNonCDLessDevice(Adapter) == FALSE)) + SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End); + break; + case DSD0: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDEnd != UNINIT_PTR_IN_CS) SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDEnd); break; - case DSD1 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1End != UNINIT_PTR_IN_CS) + case DSD1: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1End != UNINIT_PTR_IN_CS) SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1End); break; - case DSD2 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2End != UNINIT_PTR_IN_CS) + case DSD2: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2End != UNINIT_PTR_IN_CS) SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2End); break; - case VSA0 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAEnd != UNINIT_PTR_IN_CS) + case VSA0: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAEnd != UNINIT_PTR_IN_CS) SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAEnd); break; - case VSA1 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1End != UNINIT_PTR_IN_CS) + case VSA1: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1End != UNINIT_PTR_IN_CS) SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1End); break; - case VSA2 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2End != UNINIT_PTR_IN_CS) + case VSA2: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2End != UNINIT_PTR_IN_CS) SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2End); break; - case SCSI : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware != UNINIT_PTR_IN_CS) + case SCSI: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware != UNINIT_PTR_IN_CS) SectEndOffset = ((Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware) + - (Adapter->psFlash2xCSInfo->SizeOfScsiFirmware)); + (Adapter->psFlash2xCSInfo->SizeOfScsiFirmware)); + break; + case CONTROL_SECTION: + //Not Clear So Putting failure. confirm and fix it. + SectEndOffset = STATUS_FAILURE; + case ISO_IMAGE1_PART2: + if (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End != UNINIT_PTR_IN_CS) + SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End); + break; + case ISO_IMAGE1_PART3: + if (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3End != UNINIT_PTR_IN_CS) + SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3End); + break; + case ISO_IMAGE2_PART2: + if (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End != UNINIT_PTR_IN_CS) + SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End); break; - case CONTROL_SECTION : - //Not Clear So Putting failure. confirm and fix it. - SectEndOffset = STATUS_FAILURE; - case ISO_IMAGE1_PART2 : - if(Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End!= UNINIT_PTR_IN_CS) - SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End); - break; - case ISO_IMAGE1_PART3 : - if(Adapter->psFlash2xCSInfo->OffsetISOImage1Part3End!= UNINIT_PTR_IN_CS) - SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3End); - break; - case ISO_IMAGE2_PART2 : - if(Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End != UNINIT_PTR_IN_CS) - SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End); - break; - case ISO_IMAGE2_PART3 : - if(Adapter->psFlash2xCSInfo->OffsetISOImage2Part3End!= UNINIT_PTR_IN_CS) - SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3End); - break; - - default : + case ISO_IMAGE2_PART3: + if (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3End != UNINIT_PTR_IN_CS) + SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3End); + break; + default: SectEndOffset = INVALID_OFFSET; } + return SectEndOffset ; } @@ -3187,57 +3119,54 @@ INT BcmGetSectionValEndOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_ * return true on success and STATUS_FAILURE on fail. */ -INT BcmFlash2xBulkRead( - struct bcm_mini_adapter *Adapter, - PUINT pBuffer, - FLASH2X_SECTION_VAL eFlash2xSectionVal, - UINT uiOffsetWithinSectionVal, - UINT uiNumBytes) +INT BcmFlash2xBulkRead(struct bcm_mini_adapter *Adapter, + PUINT pBuffer, + FLASH2X_SECTION_VAL eFlash2xSectionVal, + UINT uiOffsetWithinSectionVal, + UINT uiNumBytes) { - INT Status = STATUS_SUCCESS; INT SectionStartOffset = 0; - UINT uiAbsoluteOffset = 0 ; - UINT uiTemp =0, value =0 ; - if(Adapter == NULL) + UINT uiAbsoluteOffset = 0; + UINT uiTemp = 0, value = 0; + + if (Adapter == NULL) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Adapter structure is NULL"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Adapter structure is NULL"); return -EINVAL; } - if(Adapter->device_removed ) + if (Adapter->device_removed) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Device has been removed"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Device has been removed"); return -ENODEV; } //NO_SECTION_VAL means absolute offset is given. - if(eFlash2xSectionVal == NO_SECTION_VAL) + if (eFlash2xSectionVal == NO_SECTION_VAL) SectionStartOffset = 0; else - SectionStartOffset = BcmGetSectionValStartOffset(Adapter,eFlash2xSectionVal); + SectionStartOffset = BcmGetSectionValStartOffset(Adapter, eFlash2xSectionVal); - if(SectionStartOffset == STATUS_FAILURE ) + if (SectionStartOffset == STATUS_FAILURE) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"This Section<%d> does not exixt in Flash 2.x Map ",eFlash2xSectionVal); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "This Section<%d> does not exixt in Flash 2.x Map ", eFlash2xSectionVal); return -EINVAL; } - if(IsSectionExistInVendorInfo(Adapter,eFlash2xSectionVal)) - return vendorextnReadSection(Adapter,(PUCHAR)pBuffer, eFlash2xSectionVal, uiOffsetWithinSectionVal, uiNumBytes); + if (IsSectionExistInVendorInfo(Adapter, eFlash2xSectionVal)) + return vendorextnReadSection(Adapter, (PUCHAR)pBuffer, eFlash2xSectionVal, uiOffsetWithinSectionVal, uiNumBytes); //calculating the absolute offset from FLASH; uiAbsoluteOffset = uiOffsetWithinSectionVal + SectionStartOffset; rdmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); value = 0; - wrmalt(Adapter, 0x0f000C80,&value, sizeof(value)); - - Status= BeceemFlashBulkRead(Adapter, pBuffer,uiAbsoluteOffset,uiNumBytes) ; - + wrmalt(Adapter, 0x0f000C80, &value, sizeof(value)); + Status = BeceemFlashBulkRead(Adapter, pBuffer, uiAbsoluteOffset, uiNumBytes); wrmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); - if(Status) + if (Status) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Flash Read Failed with Status :%d", Status); - return Status ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Flash Read Failed with Status :%d", Status); + return Status; } return Status; @@ -3256,42 +3185,42 @@ INT BcmFlash2xBulkRead( * */ -INT BcmFlash2xBulkWrite( - struct bcm_mini_adapter *Adapter, - PUINT pBuffer, - FLASH2X_SECTION_VAL eFlash2xSectVal, - UINT uiOffset, - UINT uiNumBytes, - UINT bVerify) +INT BcmFlash2xBulkWrite(struct bcm_mini_adapter *Adapter, + PUINT pBuffer, + FLASH2X_SECTION_VAL eFlash2xSectVal, + UINT uiOffset, + UINT uiNumBytes, + UINT bVerify) { - - INT Status = STATUS_SUCCESS; + INT Status = STATUS_SUCCESS; UINT FlashSectValStartOffset = 0; UINT uiTemp = 0, value = 0; - if(Adapter == NULL) + + if (Adapter == NULL) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Adapter structure is NULL"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Adapter structure is NULL"); return -EINVAL; } - if(Adapter->device_removed ) + + if (Adapter->device_removed) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Device has been removed"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Device has been removed"); return -ENODEV; } //NO_SECTION_VAL means absolute offset is given. - if(eFlash2xSectVal == NO_SECTION_VAL) + if (eFlash2xSectVal == NO_SECTION_VAL) FlashSectValStartOffset = 0; else - FlashSectValStartOffset = BcmGetSectionValStartOffset(Adapter,eFlash2xSectVal); + FlashSectValStartOffset = BcmGetSectionValStartOffset(Adapter, eFlash2xSectVal); - if(FlashSectValStartOffset == STATUS_FAILURE ) + if (FlashSectValStartOffset == STATUS_FAILURE) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"This Section<%d> does not exixt in Flash Map 2.x",eFlash2xSectVal); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "This Section<%d> does not exixt in Flash Map 2.x", eFlash2xSectVal); return -EINVAL; } - if(IsSectionExistInVendorInfo(Adapter,eFlash2xSectVal)) + if (IsSectionExistInVendorInfo(Adapter, eFlash2xSectVal)) return vendorextnWriteSection(Adapter, (PUCHAR)pBuffer, eFlash2xSectVal, uiOffset, uiNumBytes, bVerify); //calculating the absolute offset from FLASH; @@ -3299,19 +3228,18 @@ INT BcmFlash2xBulkWrite( rdmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); value = 0; - wrmalt(Adapter, 0x0f000C80,&value, sizeof(value)); + wrmalt(Adapter, 0x0f000C80, &value, sizeof(value)); - Status = BeceemFlashBulkWrite(Adapter, pBuffer,uiOffset,uiNumBytes,bVerify); + Status = BeceemFlashBulkWrite(Adapter, pBuffer, uiOffset, uiNumBytes, bVerify); wrmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); - if(Status) + if (Status) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Flash Write failed with Status :%d", Status); - return Status ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Flash Write failed with Status :%d", Status); + return Status; } return Status; - } /** @@ -3322,35 +3250,36 @@ INT BcmFlash2xBulkWrite( * Return STATUS_SUCESS if get success in setting the right DSD else negaive error code * **/ + static INT BcmGetActiveDSD(struct bcm_mini_adapter *Adapter) { - FLASH2X_SECTION_VAL uiHighestPriDSD = 0 ; + FLASH2X_SECTION_VAL uiHighestPriDSD = 0; uiHighestPriDSD = getHighestPriDSD(Adapter); Adapter->eActiveDSD = uiHighestPriDSD; - if(DSD0 == uiHighestPriDSD) + if (DSD0 == uiHighestPriDSD) Adapter->ulFlashCalStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart; - if(DSD1 == uiHighestPriDSD) + if (DSD1 == uiHighestPriDSD) Adapter->ulFlashCalStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start; - if(DSD2 == uiHighestPriDSD) + if (DSD2 == uiHighestPriDSD) Adapter->ulFlashCalStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start; - if(Adapter->eActiveDSD) - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Active DSD :%d", Adapter->eActiveDSD); - if(Adapter->eActiveDSD == 0) + if (Adapter->eActiveDSD) + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Active DSD :%d", Adapter->eActiveDSD); + if (Adapter->eActiveDSD == 0) { //if No DSD gets Active, Make Active the DSD with WR permission - if(IsSectionWritable(Adapter,DSD2)) + if (IsSectionWritable(Adapter, DSD2)) { Adapter->eActiveDSD = DSD2; Adapter->ulFlashCalStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start; } - else if(IsSectionWritable(Adapter,DSD1)) + else if (IsSectionWritable(Adapter, DSD1)) { Adapter->eActiveDSD = DSD1; Adapter->ulFlashCalStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start; } - else if(IsSectionWritable(Adapter,DSD0)) + else if (IsSectionWritable(Adapter, DSD0)) { Adapter->eActiveDSD = DSD0; Adapter->ulFlashCalStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart; @@ -3360,7 +3289,6 @@ static INT BcmGetActiveDSD(struct bcm_mini_adapter *Adapter) return STATUS_SUCCESS; } - /** * BcmGetActiveISO :- Set the Active ISO in Adapter Data Structue * @Adapter : Driver private Data Structure @@ -3373,18 +3301,18 @@ static INT BcmGetActiveDSD(struct bcm_mini_adapter *Adapter) static INT BcmGetActiveISO(struct bcm_mini_adapter *Adapter) { + INT HighestPriISO = 0; - INT HighestPriISO = 0 ; HighestPriISO = getHighestPriISO(Adapter); - Adapter->eActiveISO = HighestPriISO ; - if(Adapter->eActiveISO == ISO_IMAGE2) + Adapter->eActiveISO = HighestPriISO; + if (Adapter->eActiveISO == ISO_IMAGE2) Adapter->uiActiveISOOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start); - else if(Adapter->eActiveISO == ISO_IMAGE1) + else if (Adapter->eActiveISO == ISO_IMAGE1) Adapter->uiActiveISOOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start); - if(Adapter->eActiveISO) - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Active ISO :%x", Adapter->eActiveISO); + if (Adapter->eActiveISO) + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Active ISO :%x", Adapter->eActiveISO); return STATUS_SUCCESS; } @@ -3399,25 +3327,27 @@ static INT BcmGetActiveISO(struct bcm_mini_adapter *Adapter) * Failure:-FALSE, offset is RO * **/ + B_UINT8 IsOffsetWritable(struct bcm_mini_adapter *Adapter, UINT uiOffset) { UINT uiSectorNum = 0; - UINT uiWordOfSectorPermission =0; + UINT uiWordOfSectorPermission = 0; UINT uiBitofSectorePermission = 0; B_UINT32 permissionBits = 0; + uiSectorNum = uiOffset/Adapter->uiSectorSize; - //calculating the word having this Sector Access permission from SectorAccessBitMap Array - uiWordOfSectorPermission = Adapter->psFlash2xCSInfo->SectorAccessBitMap[uiSectorNum /16]; + // calculating the word having this Sector Access permission from SectorAccessBitMap Array + uiWordOfSectorPermission = Adapter->psFlash2xCSInfo->SectorAccessBitMap[uiSectorNum / 16]; - //calculating the bit index inside the word for this sector - uiBitofSectorePermission = 2*(15 - uiSectorNum %16); + // calculating the bit index inside the word for this sector + uiBitofSectorePermission = 2 * (15 - uiSectorNum % 16); - //Setting Access permission - permissionBits = uiWordOfSectorPermission & (0x3 << uiBitofSectorePermission) ; + // Setting Access permission + permissionBits = uiWordOfSectorPermission & (0x3 << uiBitofSectorePermission); permissionBits = (permissionBits >> uiBitofSectorePermission) & 0x3; - if(permissionBits == SECTOR_READWRITE_PERMISSION) - return TRUE; + if (permissionBits == SECTOR_READWRITE_PERMISSION) + return TRUE; else return FALSE; } @@ -3425,17 +3355,18 @@ B_UINT8 IsOffsetWritable(struct bcm_mini_adapter *Adapter, UINT uiOffset) static INT BcmDumpFlash2xSectionBitMap(PFLASH2X_BITMAP psFlash2xBitMap) { struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "***************Flash 2.x Section Bitmap***************"); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"ISO_IMAGE1 :0X%x", psFlash2xBitMap->ISO_IMAGE1); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"ISO_IMAGE2 :0X%x", psFlash2xBitMap->ISO_IMAGE2); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"DSD0 :0X%x", psFlash2xBitMap->DSD0); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"DSD1 :0X%x", psFlash2xBitMap->DSD1); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"DSD2 :0X%x", psFlash2xBitMap->DSD2); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"VSA0 :0X%x", psFlash2xBitMap->VSA0); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"VSA1 :0X%x", psFlash2xBitMap->VSA1); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"VSA2 :0X%x", psFlash2xBitMap->VSA2); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"SCSI :0X%x", psFlash2xBitMap->SCSI); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"CONTROL_SECTION :0X%x", psFlash2xBitMap->CONTROL_SECTION); + + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "***************Flash 2.x Section Bitmap***************"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "ISO_IMAGE1 :0X%x", psFlash2xBitMap->ISO_IMAGE1); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "ISO_IMAGE2 :0X%x", psFlash2xBitMap->ISO_IMAGE2); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "DSD0 :0X%x", psFlash2xBitMap->DSD0); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "DSD1 :0X%x", psFlash2xBitMap->DSD1); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "DSD2 :0X%x", psFlash2xBitMap->DSD2); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "VSA0 :0X%x", psFlash2xBitMap->VSA0); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "VSA1 :0X%x", psFlash2xBitMap->VSA1); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "VSA2 :0X%x", psFlash2xBitMap->VSA2); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "SCSI :0X%x", psFlash2xBitMap->SCSI); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "CONTROL_SECTION :0X%x", psFlash2xBitMap->CONTROL_SECTION); return STATUS_SUCCESS; } @@ -3458,33 +3389,31 @@ static INT BcmDumpFlash2xSectionBitMap(PFLASH2X_BITMAP psFlash2xBitMap) INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITMAP psFlash2xBitMap) { - - PFLASH2X_CS_INFO psFlash2xCSInfo = Adapter->psFlash2xCSInfo; - FLASH2X_SECTION_VAL uiHighestPriDSD = 0 ; - FLASH2X_SECTION_VAL uiHighestPriISO= 0 ; - BOOLEAN SetActiveDSDDone = FALSE ; - BOOLEAN SetActiveISODone = FALSE ; + FLASH2X_SECTION_VAL uiHighestPriDSD = 0; + FLASH2X_SECTION_VAL uiHighestPriISO = 0; + BOOLEAN SetActiveDSDDone = FALSE; + BOOLEAN SetActiveISODone = FALSE; - //For 1.x map all the section except DSD0 will be shown as not present - //This part will be used by calibration tool to detect the number of DSD present in Flash. - if(IsFlash2x(Adapter) == FALSE) + // For 1.x map all the section except DSD0 will be shown as not present + // This part will be used by calibration tool to detect the number of DSD present in Flash. + if (IsFlash2x(Adapter) == FALSE) { psFlash2xBitMap->ISO_IMAGE2 = 0; psFlash2xBitMap->ISO_IMAGE1 = 0; psFlash2xBitMap->DSD0 = FLASH2X_SECTION_VALID | FLASH2X_SECTION_ACT | FLASH2X_SECTION_PRESENT; //0xF; //0000(Reseved)1(Active)0(RW)1(valid)1(present) - psFlash2xBitMap->DSD1 = 0 ; - psFlash2xBitMap->DSD2 = 0 ; - psFlash2xBitMap->VSA0 = 0 ; - psFlash2xBitMap->VSA1 = 0 ; - psFlash2xBitMap->VSA2 = 0 ; - psFlash2xBitMap->CONTROL_SECTION = 0 ; - psFlash2xBitMap->SCSI= 0 ; - psFlash2xBitMap->Reserved0 = 0 ; - psFlash2xBitMap->Reserved1 = 0 ; - psFlash2xBitMap->Reserved2 = 0 ; - return STATUS_SUCCESS ; + psFlash2xBitMap->DSD1 = 0; + psFlash2xBitMap->DSD2 = 0; + psFlash2xBitMap->VSA0 = 0; + psFlash2xBitMap->VSA1 = 0; + psFlash2xBitMap->VSA2 = 0; + psFlash2xBitMap->CONTROL_SECTION = 0; + psFlash2xBitMap->SCSI = 0; + psFlash2xBitMap->Reserved0 = 0; + psFlash2xBitMap->Reserved1 = 0; + psFlash2xBitMap->Reserved2 = 0; + return STATUS_SUCCESS; } uiHighestPriDSD = getHighestPriDSD(Adapter); @@ -3493,76 +3422,70 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM /// // IS0 IMAGE 2 /// - if((psFlash2xCSInfo->OffsetISOImage2Part1Start) != UNINIT_PTR_IN_CS) + if ((psFlash2xCSInfo->OffsetISOImage2Part1Start) != UNINIT_PTR_IN_CS) { //Setting the 0th Bit representing the Section is present or not. - psFlash2xBitMap->ISO_IMAGE2= psFlash2xBitMap->ISO_IMAGE2 | FLASH2X_SECTION_PRESENT; + psFlash2xBitMap->ISO_IMAGE2 = psFlash2xBitMap->ISO_IMAGE2 | FLASH2X_SECTION_PRESENT; - - if(ReadISOSignature(Adapter,ISO_IMAGE2)== ISO_IMAGE_MAGIC_NUMBER) + if (ReadISOSignature(Adapter, ISO_IMAGE2) == ISO_IMAGE_MAGIC_NUMBER) psFlash2xBitMap->ISO_IMAGE2 |= FLASH2X_SECTION_VALID; - - //Calculation for extrating the Access permission - if(IsSectionWritable(Adapter, ISO_IMAGE2) == FALSE) + // Calculation for extrating the Access permission + if (IsSectionWritable(Adapter, ISO_IMAGE2) == FALSE) psFlash2xBitMap->ISO_IMAGE2 |= FLASH2X_SECTION_RO; - if(SetActiveISODone == FALSE && uiHighestPriISO == ISO_IMAGE2) + if (SetActiveISODone == FALSE && uiHighestPriISO == ISO_IMAGE2) { - psFlash2xBitMap->ISO_IMAGE2 |= FLASH2X_SECTION_ACT ; + psFlash2xBitMap->ISO_IMAGE2 |= FLASH2X_SECTION_ACT; SetActiveISODone = TRUE; } - } /// // IS0 IMAGE 1 /// - if((psFlash2xCSInfo->OffsetISOImage1Part1Start) != UNINIT_PTR_IN_CS) + if ((psFlash2xCSInfo->OffsetISOImage1Part1Start) != UNINIT_PTR_IN_CS) { - //Setting the 0th Bit representing the Section is present or not. + // Setting the 0th Bit representing the Section is present or not. psFlash2xBitMap->ISO_IMAGE1 = psFlash2xBitMap->ISO_IMAGE1 | FLASH2X_SECTION_PRESENT; - if(ReadISOSignature(Adapter,ISO_IMAGE1) == ISO_IMAGE_MAGIC_NUMBER) + if (ReadISOSignature(Adapter, ISO_IMAGE1) == ISO_IMAGE_MAGIC_NUMBER) psFlash2xBitMap->ISO_IMAGE1 |= FLASH2X_SECTION_VALID; - // Calculation for extrating the Access permission - if(IsSectionWritable(Adapter, ISO_IMAGE1) == FALSE) + // Calculation for extrating the Access permission + if (IsSectionWritable(Adapter, ISO_IMAGE1) == FALSE) psFlash2xBitMap->ISO_IMAGE1 |= FLASH2X_SECTION_RO; - if(SetActiveISODone == FALSE && uiHighestPriISO == ISO_IMAGE1) + if (SetActiveISODone == FALSE && uiHighestPriISO == ISO_IMAGE1) { - psFlash2xBitMap->ISO_IMAGE1 |= FLASH2X_SECTION_ACT ; + psFlash2xBitMap->ISO_IMAGE1 |= FLASH2X_SECTION_ACT; SetActiveISODone = TRUE; } } - - /// // DSD2 /// - if((psFlash2xCSInfo->OffsetFromZeroForDSD2Start) != UNINIT_PTR_IN_CS) + if ((psFlash2xCSInfo->OffsetFromZeroForDSD2Start) != UNINIT_PTR_IN_CS) { //Setting the 0th Bit representing the Section is present or not. - psFlash2xBitMap->DSD2= psFlash2xBitMap->DSD2 | FLASH2X_SECTION_PRESENT; + psFlash2xBitMap->DSD2 = psFlash2xBitMap->DSD2 | FLASH2X_SECTION_PRESENT; - if(ReadDSDSignature(Adapter,DSD2)== DSD_IMAGE_MAGIC_NUMBER) + if (ReadDSDSignature(Adapter, DSD2) == DSD_IMAGE_MAGIC_NUMBER) psFlash2xBitMap->DSD2 |= FLASH2X_SECTION_VALID; - //Calculation for extrating the Access permission - if(IsSectionWritable(Adapter, DSD2) == FALSE) + // Calculation for extrating the Access permission + if (IsSectionWritable(Adapter, DSD2) == FALSE) { psFlash2xBitMap->DSD2 |= FLASH2X_SECTION_RO; - } else { //Means section is writable - if((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD2)) + if ((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD2)) { - psFlash2xBitMap->DSD2 |= FLASH2X_SECTION_ACT ; - SetActiveDSDDone =TRUE ; + psFlash2xBitMap->DSD2 |= FLASH2X_SECTION_ACT; + SetActiveDSDDone = TRUE; } } } @@ -3570,178 +3493,163 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM /// // DSD 1 /// - if((psFlash2xCSInfo->OffsetFromZeroForDSD1Start) != UNINIT_PTR_IN_CS) + if ((psFlash2xCSInfo->OffsetFromZeroForDSD1Start) != UNINIT_PTR_IN_CS) { - //Setting the 0th Bit representing the Section is present or not. - psFlash2xBitMap->DSD1= psFlash2xBitMap->DSD1 | FLASH2X_SECTION_PRESENT; - + // Setting the 0th Bit representing the Section is present or not. + psFlash2xBitMap->DSD1 = psFlash2xBitMap->DSD1 | FLASH2X_SECTION_PRESENT; - if(ReadDSDSignature(Adapter,DSD1)== DSD_IMAGE_MAGIC_NUMBER) + if (ReadDSDSignature(Adapter, DSD1) == DSD_IMAGE_MAGIC_NUMBER) psFlash2xBitMap->DSD1 |= FLASH2X_SECTION_VALID; - //Calculation for extrating the Access permission - if(IsSectionWritable(Adapter, DSD1) == FALSE) + // Calculation for extrating the Access permission + if (IsSectionWritable(Adapter, DSD1) == FALSE) { psFlash2xBitMap->DSD1 |= FLASH2X_SECTION_RO; } else { - //Means section is writable - if((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD1)) + // Means section is writable + if ((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD1)) { - psFlash2xBitMap->DSD1 |= FLASH2X_SECTION_ACT ; - SetActiveDSDDone =TRUE ; + psFlash2xBitMap->DSD1 |= FLASH2X_SECTION_ACT; + SetActiveDSDDone = TRUE; } } - } /// //For DSD 0 // - if((psFlash2xCSInfo->OffsetFromZeroForDSDStart) != UNINIT_PTR_IN_CS) + if ((psFlash2xCSInfo->OffsetFromZeroForDSDStart) != UNINIT_PTR_IN_CS) { //Setting the 0th Bit representing the Section is present or not. psFlash2xBitMap->DSD0 = psFlash2xBitMap->DSD0 | FLASH2X_SECTION_PRESENT; - if(ReadDSDSignature(Adapter,DSD0) == DSD_IMAGE_MAGIC_NUMBER) + if (ReadDSDSignature(Adapter, DSD0) == DSD_IMAGE_MAGIC_NUMBER) psFlash2xBitMap->DSD0 |= FLASH2X_SECTION_VALID; - //Setting Access permission - if(IsSectionWritable(Adapter, DSD0) == FALSE) + // Setting Access permission + if (IsSectionWritable(Adapter, DSD0) == FALSE) { psFlash2xBitMap->DSD0 |= FLASH2X_SECTION_RO; } else { - //Means section is writable - if((SetActiveDSDDone == FALSE) &&(uiHighestPriDSD == DSD0)) + // Means section is writable + if ((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD0)) { - psFlash2xBitMap->DSD0 |= FLASH2X_SECTION_ACT ; - SetActiveDSDDone =TRUE ; + psFlash2xBitMap->DSD0 |= FLASH2X_SECTION_ACT; + SetActiveDSDDone = TRUE; } } } /// - // VSA 0 + // VSA 0 /// - if((psFlash2xCSInfo->OffsetFromZeroForVSAStart) != UNINIT_PTR_IN_CS) + if ((psFlash2xCSInfo->OffsetFromZeroForVSAStart) != UNINIT_PTR_IN_CS) { - //Setting the 0th Bit representing the Section is present or not. - psFlash2xBitMap->VSA0= psFlash2xBitMap->VSA0 | FLASH2X_SECTION_PRESENT; + // Setting the 0th Bit representing the Section is present or not. + psFlash2xBitMap->VSA0 = psFlash2xBitMap->VSA0 | FLASH2X_SECTION_PRESENT; - //Setting the Access Bit. Map is not defined hece setting it always valid + // Setting the Access Bit. Map is not defined hece setting it always valid psFlash2xBitMap->VSA0 |= FLASH2X_SECTION_VALID; - //Calculation for extrating the Access permission - if(IsSectionWritable(Adapter, VSA0) == FALSE) + // Calculation for extrating the Access permission + if (IsSectionWritable(Adapter, VSA0) == FALSE) psFlash2xBitMap->VSA0 |= FLASH2X_SECTION_RO; - //By Default section is Active - psFlash2xBitMap->VSA0 |= FLASH2X_SECTION_ACT ; - + // By Default section is Active + psFlash2xBitMap->VSA0 |= FLASH2X_SECTION_ACT; } - /// - // VSA 1 + // VSA 1 /// - - if((psFlash2xCSInfo->OffsetFromZeroForVSA1Start) != UNINIT_PTR_IN_CS) + if ((psFlash2xCSInfo->OffsetFromZeroForVSA1Start) != UNINIT_PTR_IN_CS) { - //Setting the 0th Bit representing the Section is present or not. - psFlash2xBitMap->VSA1= psFlash2xBitMap->VSA1 | FLASH2X_SECTION_PRESENT; + // Setting the 0th Bit representing the Section is present or not. + psFlash2xBitMap->VSA1 = psFlash2xBitMap->VSA1 | FLASH2X_SECTION_PRESENT; - //Setting the Access Bit. Map is not defined hece setting it always valid - psFlash2xBitMap->VSA1|= FLASH2X_SECTION_VALID; + // Setting the Access Bit. Map is not defined hece setting it always valid + psFlash2xBitMap->VSA1 |= FLASH2X_SECTION_VALID; - //Checking For Access permission - if(IsSectionWritable(Adapter, VSA1) == FALSE) + // Checking For Access permission + if (IsSectionWritable(Adapter, VSA1) == FALSE) psFlash2xBitMap->VSA1 |= FLASH2X_SECTION_RO; - //By Default section is Active - psFlash2xBitMap->VSA1 |= FLASH2X_SECTION_ACT ; - + // By Default section is Active + psFlash2xBitMap->VSA1 |= FLASH2X_SECTION_ACT; } - /// - // VSA 2 + // VSA 2 /// - - if((psFlash2xCSInfo->OffsetFromZeroForVSA2Start) != UNINIT_PTR_IN_CS) + if ((psFlash2xCSInfo->OffsetFromZeroForVSA2Start) != UNINIT_PTR_IN_CS) { - //Setting the 0th Bit representing the Section is present or not. - psFlash2xBitMap->VSA2= psFlash2xBitMap->VSA2 | FLASH2X_SECTION_PRESENT; - + // Setting the 0th Bit representing the Section is present or not. + psFlash2xBitMap->VSA2 = psFlash2xBitMap->VSA2 | FLASH2X_SECTION_PRESENT; - //Setting the Access Bit. Map is not defined hece setting it always valid + // Setting the Access Bit. Map is not defined hece setting it always valid psFlash2xBitMap->VSA2 |= FLASH2X_SECTION_VALID; - //Checking For Access permission - if(IsSectionWritable(Adapter, VSA2) == FALSE) + // Checking For Access permission + if (IsSectionWritable(Adapter, VSA2) == FALSE) psFlash2xBitMap->VSA2 |= FLASH2X_SECTION_RO; - //By Default section is Active - psFlash2xBitMap->VSA2 |= FLASH2X_SECTION_ACT ; + // By Default section is Active + psFlash2xBitMap->VSA2 |= FLASH2X_SECTION_ACT; } /// // SCSI Section /// - if((psFlash2xCSInfo->OffsetFromZeroForScsiFirmware) != UNINIT_PTR_IN_CS) + if ((psFlash2xCSInfo->OffsetFromZeroForScsiFirmware) != UNINIT_PTR_IN_CS) { - //Setting the 0th Bit representing the Section is present or not. - psFlash2xBitMap->SCSI= psFlash2xBitMap->SCSI | FLASH2X_SECTION_PRESENT; - + // Setting the 0th Bit representing the Section is present or not. + psFlash2xBitMap->SCSI = psFlash2xBitMap->SCSI | FLASH2X_SECTION_PRESENT; - //Setting the Access Bit. Map is not defined hece setting it always valid - psFlash2xBitMap->SCSI|= FLASH2X_SECTION_VALID; + // Setting the Access Bit. Map is not defined hece setting it always valid + psFlash2xBitMap->SCSI |= FLASH2X_SECTION_VALID; - //Checking For Access permission - if(IsSectionWritable(Adapter, SCSI) == FALSE) + // Checking For Access permission + if (IsSectionWritable(Adapter, SCSI) == FALSE) psFlash2xBitMap->SCSI |= FLASH2X_SECTION_RO; - //By Default section is Active - psFlash2xBitMap->SCSI |= FLASH2X_SECTION_ACT ; - + // By Default section is Active + psFlash2xBitMap->SCSI |= FLASH2X_SECTION_ACT; } - /// - // Control Section + // Control Section /// - if((psFlash2xCSInfo->OffsetFromZeroForControlSectionStart) != UNINIT_PTR_IN_CS) + if ((psFlash2xCSInfo->OffsetFromZeroForControlSectionStart) != UNINIT_PTR_IN_CS) { - //Setting the 0th Bit representing the Section is present or not. + // Setting the 0th Bit representing the Section is present or not. psFlash2xBitMap->CONTROL_SECTION = psFlash2xBitMap->CONTROL_SECTION | (FLASH2X_SECTION_PRESENT); - - //Setting the Access Bit. Map is not defined hece setting it always valid + // Setting the Access Bit. Map is not defined hece setting it always valid psFlash2xBitMap->CONTROL_SECTION |= FLASH2X_SECTION_VALID; - //Checking For Access permission - if(IsSectionWritable(Adapter, CONTROL_SECTION) == FALSE) + // Checking For Access permission + if (IsSectionWritable(Adapter, CONTROL_SECTION) == FALSE) psFlash2xBitMap->CONTROL_SECTION |= FLASH2X_SECTION_RO; - //By Default section is Active - psFlash2xBitMap->CONTROL_SECTION |= FLASH2X_SECTION_ACT ; - + // By Default section is Active + psFlash2xBitMap->CONTROL_SECTION |= FLASH2X_SECTION_ACT; } /// - // For Reserved Sections + // For Reserved Sections /// psFlash2xBitMap->Reserved0 = 0; psFlash2xBitMap->Reserved0 = 0; psFlash2xBitMap->Reserved0 = 0; - BcmDumpFlash2xSectionBitMap(psFlash2xBitMap); - return STATUS_SUCCESS ; - + return STATUS_SUCCESS; } + /** BcmSetActiveSection :- Set Active section is used to make priority field highest over other section of same type. @@ -3752,49 +3660,48 @@ BcmSetActiveSection :- Set Active section is used to make priority field highest Return Value:- Make the priorit highest else return erorr code **/ + INT BcmSetActiveSection(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectVal) { unsigned int SectImagePriority = 0; - INT Status =STATUS_SUCCESS; + INT Status = STATUS_SUCCESS; //DSD_HEADER sDSD = {0}; //ISO_HEADER sISO = {0}; INT HighestPriDSD = 0 ; INT HighestPriISO = 0; - - - Status = IsSectionWritable(Adapter,eFlash2xSectVal) ; - if(Status != TRUE ) + Status = IsSectionWritable(Adapter, eFlash2xSectVal); + if (Status != TRUE) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Provided Section <%d> is not writable",eFlash2xSectVal); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Provided Section <%d> is not writable", eFlash2xSectVal); return STATUS_FAILURE; } - Adapter->bHeaderChangeAllowed = TRUE ; - switch(eFlash2xSectVal) + Adapter->bHeaderChangeAllowed = TRUE; + switch (eFlash2xSectVal) { - case ISO_IMAGE1 : - case ISO_IMAGE2 : - if(ReadISOSignature(Adapter,eFlash2xSectVal)== ISO_IMAGE_MAGIC_NUMBER ) + case ISO_IMAGE1: + case ISO_IMAGE2: + if (ReadISOSignature(Adapter, eFlash2xSectVal) == ISO_IMAGE_MAGIC_NUMBER) { HighestPriISO = getHighestPriISO(Adapter); - if(HighestPriISO == eFlash2xSectVal ) + if (HighestPriISO == eFlash2xSectVal) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Given ISO<%x> already has highest priority",eFlash2xSectVal ); - Status = STATUS_SUCCESS ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Given ISO<%x> already has highest priority", eFlash2xSectVal); + Status = STATUS_SUCCESS; break; } SectImagePriority = ReadISOPriority(Adapter, HighestPriISO) + 1; - if((SectImagePriority <= 0) && IsSectionWritable(Adapter,HighestPriISO)) + if ((SectImagePriority <= 0) && IsSectionWritable(Adapter, HighestPriISO)) { // This is a SPECIAL Case which will only happen if the current highest priority ISO has priority value = 0x7FFFFFFF. // We will write 1 to the current Highest priority ISO And then shall increase the priority of the requested ISO // by user - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "SectImagePriority wraparound happened, eFlash2xSectVal: 0x%x\n",eFlash2xSectVal); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "SectImagePriority wraparound happened, eFlash2xSectVal: 0x%x\n", eFlash2xSectVal); SectImagePriority = htonl(0x1); Status = BcmFlash2xBulkWrite(Adapter, &SectImagePriority, @@ -3802,152 +3709,144 @@ INT BcmSetActiveSection(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eF 0 + FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImagePriority), SIGNATURE_SIZE, TRUE); - - if(Status) + if (Status) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Priority has not been written properly"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Priority has not been written properly"); Status = STATUS_FAILURE; - break ; + break; } HighestPriISO = getHighestPriISO(Adapter); - if(HighestPriISO == eFlash2xSectVal ) + if (HighestPriISO == eFlash2xSectVal) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Given ISO<%x> already has highest priority",eFlash2xSectVal ); - Status = STATUS_SUCCESS ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Given ISO<%x> already has highest priority", eFlash2xSectVal); + Status = STATUS_SUCCESS; break; } SectImagePriority = 2; - } - + } SectImagePriority = htonl(SectImagePriority); Status = BcmFlash2xBulkWrite(Adapter, - &SectImagePriority, - eFlash2xSectVal, - 0 + FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImagePriority), - SIGNATURE_SIZE, - TRUE); - if(Status) + &SectImagePriority, + eFlash2xSectVal, + 0 + FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImagePriority), + SIGNATURE_SIZE, + TRUE); + if (Status) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Priority has not been written properly"); - break ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Priority has not been written properly"); + break; } } else { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Signature is currupted. Hence can't increase the priority"); - Status = STATUS_FAILURE ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Signature is currupted. Hence can't increase the priority"); + Status = STATUS_FAILURE; break; } break; - case DSD0 : - case DSD1 : - case DSD2 : - if(ReadDSDSignature(Adapter,eFlash2xSectVal)== DSD_IMAGE_MAGIC_NUMBER) + case DSD0: + case DSD1: + case DSD2: + if (ReadDSDSignature(Adapter, eFlash2xSectVal) == DSD_IMAGE_MAGIC_NUMBER) { HighestPriDSD = getHighestPriDSD(Adapter); - - if((HighestPriDSD == eFlash2xSectVal)) + if ((HighestPriDSD == eFlash2xSectVal)) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Given DSD<%x> already has highest priority", eFlash2xSectVal); - Status = STATUS_SUCCESS ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Given DSD<%x> already has highest priority", eFlash2xSectVal); + Status = STATUS_SUCCESS; break; } - SectImagePriority = ReadDSDPriority(Adapter, HighestPriDSD) + 1 ; - if(SectImagePriority <= 0) + SectImagePriority = ReadDSDPriority(Adapter, HighestPriDSD) + 1; + if (SectImagePriority <= 0) { // This is a SPECIAL Case which will only happen if the current highest priority DSD has priority value = 0x7FFFFFFF. // We will write 1 to the current Highest priority DSD And then shall increase the priority of the requested DSD // by user - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, NVM_RW, DBG_LVL_ALL, "SectImagePriority wraparound happened, eFlash2xSectVal: 0x%x\n",eFlash2xSectVal); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, NVM_RW, DBG_LVL_ALL, "SectImagePriority wraparound happened, eFlash2xSectVal: 0x%x\n", eFlash2xSectVal); SectImagePriority = htonl(0x1); Status = BcmFlash2xBulkWrite(Adapter, - &SectImagePriority, - HighestPriDSD, - Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImagePriority), - SIGNATURE_SIZE, - TRUE); - - if(Status) + &SectImagePriority, + HighestPriDSD, + Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImagePriority), + SIGNATURE_SIZE, + TRUE); + if (Status) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Priority has not been written properly"); - break ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Priority has not been written properly"); + break; } HighestPriDSD = getHighestPriDSD(Adapter); - if((HighestPriDSD == eFlash2xSectVal)) + if ((HighestPriDSD == eFlash2xSectVal)) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Made the DSD: %x highest by reducing priority of other\n", eFlash2xSectVal); - Status = STATUS_SUCCESS ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Made the DSD: %x highest by reducing priority of other\n", eFlash2xSectVal); + Status = STATUS_SUCCESS; break; } SectImagePriority = htonl(0x2); Status = BcmFlash2xBulkWrite(Adapter, - &SectImagePriority, - HighestPriDSD, - Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImagePriority), - SIGNATURE_SIZE, - TRUE); - - if(Status) + &SectImagePriority, + HighestPriDSD, + Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImagePriority), + SIGNATURE_SIZE, + TRUE); + if (Status) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Priority has not been written properly"); - break ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Priority has not been written properly"); + break; } HighestPriDSD = getHighestPriDSD(Adapter); - - if((HighestPriDSD == eFlash2xSectVal)) + if ((HighestPriDSD == eFlash2xSectVal)) { - Status = STATUS_SUCCESS ; + Status = STATUS_SUCCESS; break; } - SectImagePriority = 3 ; + SectImagePriority = 3; } SectImagePriority = htonl(SectImagePriority); Status = BcmFlash2xBulkWrite(Adapter, - &SectImagePriority, - eFlash2xSectVal, - Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImagePriority), - SIGNATURE_SIZE , - TRUE); - if(Status) + &SectImagePriority, + eFlash2xSectVal, + Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImagePriority), + SIGNATURE_SIZE, + TRUE); + if (Status) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Priority has not been written properly"); - Status = STATUS_FAILURE ; - break ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Priority has not been written properly"); + Status = STATUS_FAILURE; + break; } } else { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Signature is currupted. Hence can't increase the priority"); - Status = STATUS_FAILURE ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Signature is currupted. Hence can't increase the priority"); + Status = STATUS_FAILURE; break; } break; - case VSA0 : - case VSA1 : - case VSA2 : - //Has to be decided - break ; - default : - Status = STATUS_FAILURE ; - break; - + case VSA0: + case VSA1: + case VSA2: + // Has to be decided + break; + default: + Status = STATUS_FAILURE; + break; } - Adapter->bHeaderChangeAllowed = FALSE ; + Adapter->bHeaderChangeAllowed = FALSE; return Status; - } /** @@ -3958,325 +3857,315 @@ BcmCopyISO - Used only for copying the ISO section Return value:- SUCCESS if copies successfully else negative error code **/ + INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectStrut) { - PCHAR Buff = NULL; - FLASH2X_SECTION_VAL eISOReadPart = 0,eISOWritePart = 0; + FLASH2X_SECTION_VAL eISOReadPart = 0, eISOWritePart = 0; UINT uiReadOffsetWithinPart = 0, uiWriteOffsetWithinPart = 0; UINT uiTotalDataToCopy = 0; - BOOLEAN IsThisHeaderSector = FALSE ; + BOOLEAN IsThisHeaderSector = FALSE; UINT sigOffset = 0; UINT ISOLength = 0; UINT Status = STATUS_SUCCESS; UINT SigBuff[MAX_RW_SIZE]; UINT i = 0; - if(ReadISOSignature(Adapter,sCopySectStrut.SrcSection) != ISO_IMAGE_MAGIC_NUMBER) + if (ReadISOSignature(Adapter, sCopySectStrut.SrcSection) != ISO_IMAGE_MAGIC_NUMBER) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "error as Source ISO Section does not have valid signature"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "error as Source ISO Section does not have valid signature"); return STATUS_FAILURE; } Status = BcmFlash2xBulkRead(Adapter, - &ISOLength, - sCopySectStrut.SrcSection, - 0 + FIELD_OFFSET_IN_HEADER(PISO_HEADER,ISOImageSize), - 4); - - if(Status) + &ISOLength, + sCopySectStrut.SrcSection, + 0 + FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImageSize), + 4); + if (Status) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Read failed while copying ISO\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Read failed while copying ISO\n"); return Status; } ISOLength = htonl(ISOLength); - - if(ISOLength % Adapter->uiSectorSize) + if (ISOLength % Adapter->uiSectorSize) { - ISOLength = Adapter->uiSectorSize*(1 + ISOLength/Adapter->uiSectorSize); + ISOLength = Adapter->uiSectorSize * (1 + ISOLength/Adapter->uiSectorSize); } sigOffset = FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImageMagicNumber); Buff = kzalloc(Adapter->uiSectorSize, GFP_KERNEL); - if(Buff == NULL) + if (Buff == NULL) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Memory allocation failed for section size"); - return -ENOMEM; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Memory allocation failed for section size"); + return -ENOMEM; } - if(sCopySectStrut.SrcSection ==ISO_IMAGE1 && sCopySectStrut.DstSection ==ISO_IMAGE2) + if (sCopySectStrut.SrcSection == ISO_IMAGE1 && sCopySectStrut.DstSection == ISO_IMAGE2) { - eISOReadPart = ISO_IMAGE1 ; - eISOWritePart = ISO_IMAGE2 ; + eISOReadPart = ISO_IMAGE1; + eISOWritePart = ISO_IMAGE2; uiReadOffsetWithinPart = 0; - uiWriteOffsetWithinPart = 0 ; + uiWriteOffsetWithinPart = 0; - uiTotalDataToCopy =(Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End) - - (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start)+ - (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End) - - (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start)+ - (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3End) - - (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3Start); + uiTotalDataToCopy = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End) - + (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start) + + (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End) - + (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start) + + (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3End) - + (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3Start); - if(uiTotalDataToCopy < ISOLength) + if (uiTotalDataToCopy < ISOLength) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"error as Source ISO Section does not have valid signature"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "error as Source ISO Section does not have valid signature"); Status = STATUS_FAILURE; goto out; } - uiTotalDataToCopy =(Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End) - - (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start)+ - (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End) - - (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start)+ - (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3End) - - (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3Start); + uiTotalDataToCopy = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End) - + (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start) + + (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End) - + (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start) + + (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3End) - + (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3Start); - if(uiTotalDataToCopy < ISOLength) + if (uiTotalDataToCopy < ISOLength) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"error as Dest ISO Section does not have enough section size"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "error as Dest ISO Section does not have enough section size"); Status = STATUS_FAILURE; goto out; } uiTotalDataToCopy = ISOLength; - CorruptISOSig(Adapter,ISO_IMAGE2); - - while(uiTotalDataToCopy) + CorruptISOSig(Adapter, ISO_IMAGE2); + while (uiTotalDataToCopy) { - if(uiTotalDataToCopy == Adapter->uiSectorSize) + if (uiTotalDataToCopy == Adapter->uiSectorSize) { - //Setting for write of first sector. First sector is assumed to be written in last - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Writing the signature sector"); - eISOReadPart = ISO_IMAGE1 ; + // Setting for write of first sector. First sector is assumed to be written in last + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Writing the signature sector"); + eISOReadPart = ISO_IMAGE1; uiReadOffsetWithinPart = 0; eISOWritePart = ISO_IMAGE2; - uiWriteOffsetWithinPart = 0 ; - IsThisHeaderSector = TRUE ; - + uiWriteOffsetWithinPart = 0; + IsThisHeaderSector = TRUE; } else { - uiReadOffsetWithinPart = uiReadOffsetWithinPart + Adapter->uiSectorSize ; - uiWriteOffsetWithinPart = uiWriteOffsetWithinPart + Adapter->uiSectorSize ; + uiReadOffsetWithinPart = uiReadOffsetWithinPart + Adapter->uiSectorSize; + uiWriteOffsetWithinPart = uiWriteOffsetWithinPart + Adapter->uiSectorSize; - if((eISOReadPart == ISO_IMAGE1) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start) )) + if ((eISOReadPart == ISO_IMAGE1) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start))) { - eISOReadPart = ISO_IMAGE1_PART2 ; + eISOReadPart = ISO_IMAGE1_PART2; uiReadOffsetWithinPart = 0; } - if((eISOReadPart == ISO_IMAGE1_PART2) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start))) + + if ((eISOReadPart == ISO_IMAGE1_PART2) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start))) { - eISOReadPart = ISO_IMAGE1_PART3 ; + eISOReadPart = ISO_IMAGE1_PART3; uiReadOffsetWithinPart = 0; } - if((eISOWritePart == ISO_IMAGE2) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start))) + + if ((eISOWritePart == ISO_IMAGE2) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start))) { - eISOWritePart = ISO_IMAGE2_PART2 ; + eISOWritePart = ISO_IMAGE2_PART2; uiWriteOffsetWithinPart = 0; } - if((eISOWritePart == ISO_IMAGE2_PART2) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start))) + + if ((eISOWritePart == ISO_IMAGE2_PART2) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start))) { - eISOWritePart = ISO_IMAGE2_PART3 ; + eISOWritePart = ISO_IMAGE2_PART3; uiWriteOffsetWithinPart = 0; } } Status = BcmFlash2xBulkRead(Adapter, - (PUINT)Buff, - eISOReadPart, - uiReadOffsetWithinPart, - Adapter->uiSectorSize - ); - - if(Status) + (PUINT)Buff, + eISOReadPart, + uiReadOffsetWithinPart, + Adapter->uiSectorSize); + if (Status) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Read failed while copying ISO: Part: %x, OffsetWithinPart: %x\n", eISOReadPart, uiReadOffsetWithinPart); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Read failed while copying ISO: Part: %x, OffsetWithinPart: %x\n", eISOReadPart, uiReadOffsetWithinPart); break; } - if(IsThisHeaderSector == TRUE) + if (IsThisHeaderSector == TRUE) { - //If this is header sector write 0xFFFFFFFF at the sig time and in last write sig + // If this is header sector write 0xFFFFFFFF at the sig time and in last write sig memcpy(SigBuff, Buff + sigOffset, MAX_RW_SIZE); - for(i = 0; i < MAX_RW_SIZE;i++) + for (i = 0; i < MAX_RW_SIZE; i++) *(Buff + sigOffset + i) = 0xFF; } - Adapter->bHeaderChangeAllowed = TRUE ; - + Adapter->bHeaderChangeAllowed = TRUE; Status = BcmFlash2xBulkWrite(Adapter, - (PUINT)Buff, - eISOWritePart, - uiWriteOffsetWithinPart, - Adapter->uiSectorSize, - TRUE); - if(Status) + (PUINT)Buff, + eISOWritePart, + uiWriteOffsetWithinPart, + Adapter->uiSectorSize, + TRUE); + if (Status) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Write failed while copying ISO: Part: %x, OffsetWithinPart: %x\n", eISOWritePart, uiWriteOffsetWithinPart); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Write failed while copying ISO: Part: %x, OffsetWithinPart: %x\n", eISOWritePart, uiWriteOffsetWithinPart); break; } Adapter->bHeaderChangeAllowed = FALSE; - - if(IsThisHeaderSector == TRUE) + if (IsThisHeaderSector == TRUE) { WriteToFlashWithoutSectorErase(Adapter, - SigBuff, - eISOWritePart, - sigOffset, - MAX_RW_SIZE); - IsThisHeaderSector = FALSE ; + SigBuff, + eISOWritePart, + sigOffset, + MAX_RW_SIZE); + IsThisHeaderSector = FALSE; } //subtracting the written Data - uiTotalDataToCopy = uiTotalDataToCopy - Adapter->uiSectorSize ; + uiTotalDataToCopy = uiTotalDataToCopy - Adapter->uiSectorSize; } - - } - if(sCopySectStrut.SrcSection ==ISO_IMAGE2 && sCopySectStrut.DstSection ==ISO_IMAGE1) + if (sCopySectStrut.SrcSection == ISO_IMAGE2 && sCopySectStrut.DstSection == ISO_IMAGE1) { - eISOReadPart = ISO_IMAGE2 ; - eISOWritePart = ISO_IMAGE1 ; - uiReadOffsetWithinPart = 0; - uiWriteOffsetWithinPart = 0 ; + eISOReadPart = ISO_IMAGE2; + eISOWritePart = ISO_IMAGE1; + uiReadOffsetWithinPart = 0; + uiWriteOffsetWithinPart = 0; - uiTotalDataToCopy =(Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End) - - (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start)+ - (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End) - - (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start)+ - (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3End) - - (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3Start); + uiTotalDataToCopy = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End) - + (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start) + + (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End) - + (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start) + + (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3End) - + (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3Start); - if(uiTotalDataToCopy < ISOLength) + if (uiTotalDataToCopy < ISOLength) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"error as Source ISO Section does not have valid signature"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "error as Source ISO Section does not have valid signature"); Status = STATUS_FAILURE; goto out; } - uiTotalDataToCopy =(Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End) - - (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start)+ - (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End) - - (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start)+ - (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3End) - - (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3Start); + uiTotalDataToCopy = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End) - + (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start) + + (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End) - + (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start) + + (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3End) - + (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3Start); - if(uiTotalDataToCopy < ISOLength) + if (uiTotalDataToCopy < ISOLength) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"error as Dest ISO Section does not have enough section size"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "error as Dest ISO Section does not have enough section size"); Status = STATUS_FAILURE; goto out; } uiTotalDataToCopy = ISOLength; - CorruptISOSig(Adapter,ISO_IMAGE1); + CorruptISOSig(Adapter, ISO_IMAGE1); - while(uiTotalDataToCopy) + while (uiTotalDataToCopy) { - if(uiTotalDataToCopy == Adapter->uiSectorSize) + if (uiTotalDataToCopy == Adapter->uiSectorSize) { //Setting for write of first sector. First sector is assumed to be written in last - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Writing the signature sector"); - eISOReadPart = ISO_IMAGE2 ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Writing the signature sector"); + eISOReadPart = ISO_IMAGE2; uiReadOffsetWithinPart = 0; eISOWritePart = ISO_IMAGE1; - uiWriteOffsetWithinPart = 0 ; + uiWriteOffsetWithinPart = 0; IsThisHeaderSector = TRUE; - } else { - uiReadOffsetWithinPart = uiReadOffsetWithinPart + Adapter->uiSectorSize ; - uiWriteOffsetWithinPart = uiWriteOffsetWithinPart + Adapter->uiSectorSize ; + uiReadOffsetWithinPart = uiReadOffsetWithinPart + Adapter->uiSectorSize; + uiWriteOffsetWithinPart = uiWriteOffsetWithinPart + Adapter->uiSectorSize; - if((eISOReadPart == ISO_IMAGE2) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start) )) + if ((eISOReadPart == ISO_IMAGE2) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start))) { - eISOReadPart = ISO_IMAGE2_PART2 ; + eISOReadPart = ISO_IMAGE2_PART2; uiReadOffsetWithinPart = 0; } - if((eISOReadPart == ISO_IMAGE2_PART2) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start))) + + if ((eISOReadPart == ISO_IMAGE2_PART2) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start))) { - eISOReadPart = ISO_IMAGE2_PART3 ; + eISOReadPart = ISO_IMAGE2_PART3; uiReadOffsetWithinPart = 0; } - if((eISOWritePart == ISO_IMAGE1) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start))) + + if ((eISOWritePart == ISO_IMAGE1) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start))) { - eISOWritePart = ISO_IMAGE1_PART2 ; + eISOWritePart = ISO_IMAGE1_PART2; uiWriteOffsetWithinPart = 0; } - if((eISOWritePart == ISO_IMAGE1_PART2) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start))) + + if ((eISOWritePart == ISO_IMAGE1_PART2) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start))) { - eISOWritePart = ISO_IMAGE1_PART3 ; + eISOWritePart = ISO_IMAGE1_PART3; uiWriteOffsetWithinPart = 0; } } Status = BcmFlash2xBulkRead(Adapter, - (PUINT)Buff, - eISOReadPart, - uiReadOffsetWithinPart, - Adapter->uiSectorSize - ); - if(Status) + (PUINT)Buff, + eISOReadPart, + uiReadOffsetWithinPart, + Adapter->uiSectorSize); + if (Status) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Read failed while copying ISO: Part: %x, OffsetWithinPart: %x\n", eISOReadPart, uiReadOffsetWithinPart); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Read failed while copying ISO: Part: %x, OffsetWithinPart: %x\n", eISOReadPart, uiReadOffsetWithinPart); break; } - if(IsThisHeaderSector == TRUE) + if (IsThisHeaderSector == TRUE) { - //If this is header sector write 0xFFFFFFFF at the sig time and in last write sig + // If this is header sector write 0xFFFFFFFF at the sig time and in last write sig memcpy(SigBuff, Buff + sigOffset, MAX_RW_SIZE); - for(i = 0; i < MAX_RW_SIZE;i++) + for (i = 0; i < MAX_RW_SIZE; i++) *(Buff + sigOffset + i) = 0xFF; - } - Adapter->bHeaderChangeAllowed = TRUE ; + Adapter->bHeaderChangeAllowed = TRUE; Status = BcmFlash2xBulkWrite(Adapter, - (PUINT)Buff, - eISOWritePart, - uiWriteOffsetWithinPart, - Adapter->uiSectorSize, - TRUE); - - if(Status) + (PUINT)Buff, + eISOWritePart, + uiWriteOffsetWithinPart, + Adapter->uiSectorSize, + TRUE); + if (Status) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Write failed while copying ISO: Part: %x, OffsetWithinPart: %x\n", eISOWritePart, uiWriteOffsetWithinPart); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Write failed while copying ISO: Part: %x, OffsetWithinPart: %x\n", eISOWritePart, uiWriteOffsetWithinPart); break; } - Adapter->bHeaderChangeAllowed = FALSE ; - - if(IsThisHeaderSector == TRUE) + Adapter->bHeaderChangeAllowed = FALSE; + if (IsThisHeaderSector == TRUE) { WriteToFlashWithoutSectorErase(Adapter, - SigBuff, - eISOWritePart, - sigOffset, - MAX_RW_SIZE); - IsThisHeaderSector = FALSE ; + SigBuff, + eISOWritePart, + sigOffset, + MAX_RW_SIZE); + + IsThisHeaderSector = FALSE; } - //subtracting the written Data - uiTotalDataToCopy = uiTotalDataToCopy - Adapter->uiSectorSize ; + // subtracting the written Data + uiTotalDataToCopy = uiTotalDataToCopy - Adapter->uiSectorSize; } - - } - out: kfree(Buff); return Status; } + /** BcmFlash2xCorruptSig : this API is used to corrupt the written sig in Bcm Header present in flash section. It will corrupt the sig, if Section is writable, by making first bytes as zero. @@ -4289,27 +4178,29 @@ Return Value :- **/ + INT BcmFlash2xCorruptSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) { + INT Status = STATUS_SUCCESS; - INT Status = STATUS_SUCCESS ; - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Section Value :%x \n", eFlash2xSectionVal); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Section Value :%x\n", eFlash2xSectionVal); - if((eFlash2xSectionVal == DSD0) || (eFlash2xSectionVal == DSD1) || (eFlash2xSectionVal == DSD2)) + if ((eFlash2xSectionVal == DSD0) || (eFlash2xSectionVal == DSD1) || (eFlash2xSectionVal == DSD2)) { Status = CorruptDSDSig(Adapter, eFlash2xSectionVal); } - else if(eFlash2xSectionVal == ISO_IMAGE1 || eFlash2xSectionVal == ISO_IMAGE2) + else if (eFlash2xSectionVal == ISO_IMAGE1 || eFlash2xSectionVal == ISO_IMAGE2) { Status = CorruptISOSig(Adapter, eFlash2xSectionVal); } else { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Given Section <%d>does not have Header",eFlash2xSectionVal); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Given Section <%d>does not have Header", eFlash2xSectionVal); return STATUS_SUCCESS; } return Status; } + /** BcmFlash2xWriteSig :-this API is used to Write the sig if requested Section has header and Write Permission. @@ -4321,69 +4212,68 @@ Return Value :- Failure :-Return negative error code **/ + INT BcmFlash2xWriteSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlashSectionVal) { - - UINT uiSignature = 0 ; + UINT uiSignature = 0; UINT uiOffset = 0; - //DSD_HEADER dsdHeader = {0}; - if(Adapter->bSigCorrupted == FALSE) + // DSD_HEADER dsdHeader = {0}; + if (Adapter->bSigCorrupted == FALSE) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Signature is not corrupted by driver, hence not restoring\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Signature is not corrupted by driver, hence not restoring\n"); return STATUS_SUCCESS; } - if(Adapter->bAllDSDWriteAllow == FALSE) + + if (Adapter->bAllDSDWriteAllow == FALSE) { - if(IsSectionWritable(Adapter,eFlashSectionVal) == FALSE) + if (IsSectionWritable(Adapter, eFlashSectionVal) == FALSE) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Section is not Writable...Hence can't Write signature"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Section is not Writable...Hence can't Write signature"); return SECTOR_IS_NOT_WRITABLE; } } - if((eFlashSectionVal == DSD0) ||(eFlashSectionVal == DSD1) || (eFlashSectionVal == DSD2)) + + if ((eFlashSectionVal == DSD0) || (eFlashSectionVal == DSD1) || (eFlashSectionVal == DSD2)) { - uiSignature = htonl(DSD_IMAGE_MAGIC_NUMBER) ; - uiOffset = Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader ; + uiSignature = htonl(DSD_IMAGE_MAGIC_NUMBER); + uiOffset = Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader; - uiOffset += FIELD_OFFSET_IN_HEADER(PDSD_HEADER,DSDImageMagicNumber); + uiOffset += FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImageMagicNumber); - if((ReadDSDSignature(Adapter,eFlashSectionVal) & 0xFF000000) != CORRUPTED_PATTERN) + if ((ReadDSDSignature(Adapter, eFlashSectionVal) & 0xFF000000) != CORRUPTED_PATTERN) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Corrupted Pattern is not there. Hence won't write sig"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Corrupted Pattern is not there. Hence won't write sig"); return STATUS_FAILURE; } - } - else if((eFlashSectionVal == ISO_IMAGE1) || (eFlashSectionVal == ISO_IMAGE2)) + else if ((eFlashSectionVal == ISO_IMAGE1) || (eFlashSectionVal == ISO_IMAGE2)) { uiSignature = htonl(ISO_IMAGE_MAGIC_NUMBER); - //uiOffset = 0; - uiOffset = FIELD_OFFSET_IN_HEADER(PISO_HEADER,ISOImageMagicNumber); - if((ReadISOSignature(Adapter,eFlashSectionVal) & 0xFF000000) != CORRUPTED_PATTERN) + // uiOffset = 0; + uiOffset = FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImageMagicNumber); + if ((ReadISOSignature(Adapter, eFlashSectionVal) & 0xFF000000) != CORRUPTED_PATTERN) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Currupted Pattern is not there. Hence won't write sig"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Currupted Pattern is not there. Hence won't write sig"); return STATUS_FAILURE; } } else { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"GIVEN SECTION< %d > IS NOT VALID FOR SIG WRITE...", eFlashSectionVal); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "GIVEN SECTION< %d > IS NOT VALID FOR SIG WRITE...", eFlashSectionVal); return STATUS_FAILURE; } - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Restoring the signature"); - + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Restoring the signature"); Adapter->bHeaderChangeAllowed = TRUE; Adapter->bSigCorrupted = FALSE; - BcmFlash2xBulkWrite(Adapter, &uiSignature,eFlashSectionVal,uiOffset,SIGNATURE_SIZE,TRUE); + BcmFlash2xBulkWrite(Adapter, &uiSignature, eFlashSectionVal, uiOffset, SIGNATURE_SIZE, TRUE); Adapter->bHeaderChangeAllowed = FALSE; - - return STATUS_SUCCESS; } + /** validateFlash2xReadWrite :- This API is used to validate the user request for Read/Write. if requested Bytes goes beyond the Requested section, it reports error. @@ -4394,61 +4284,62 @@ Return values:-Return TRUE is request is valid else FALSE. **/ -INT validateFlash2xReadWrite(struct bcm_mini_adapter *Adapter, PFLASH2X_READWRITE psFlash2xReadWrite) + +INT validateFlash2xReadWrite(struct bcm_mini_adapter *Adapter, PFLASH2X_READWRITE psFlash2xReadWrite) { - UINT uiNumOfBytes = 0 ; - UINT uiSectStartOffset = 0 ; + UINT uiNumOfBytes = 0; + UINT uiSectStartOffset = 0; UINT uiSectEndOffset = 0; + uiNumOfBytes = psFlash2xReadWrite->numOfBytes; - if(IsSectionExistInFlash(Adapter,psFlash2xReadWrite->Section) != TRUE) + if (IsSectionExistInFlash(Adapter, psFlash2xReadWrite->Section) != TRUE) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Section<%x> does not exixt in Flash",psFlash2xReadWrite->Section); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Section<%x> does not exixt in Flash", psFlash2xReadWrite->Section); return FALSE; } - uiSectStartOffset = BcmGetSectionValStartOffset(Adapter,psFlash2xReadWrite->Section); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Start offset :%x ,section :%d\n",uiSectStartOffset,psFlash2xReadWrite->Section); - if((psFlash2xReadWrite->Section == ISO_IMAGE1) ||(psFlash2xReadWrite->Section == ISO_IMAGE2)) + uiSectStartOffset = BcmGetSectionValStartOffset(Adapter, psFlash2xReadWrite->Section); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Start offset :%x ,section :%d\n", uiSectStartOffset, psFlash2xReadWrite->Section); + if ((psFlash2xReadWrite->Section == ISO_IMAGE1) || (psFlash2xReadWrite->Section == ISO_IMAGE2)) { - if(psFlash2xReadWrite->Section == ISO_IMAGE1) + if (psFlash2xReadWrite->Section == ISO_IMAGE1) { - uiSectEndOffset = BcmGetSectionValEndOffset(Adapter,ISO_IMAGE1) - - BcmGetSectionValStartOffset(Adapter,ISO_IMAGE1)+ - BcmGetSectionValEndOffset(Adapter,ISO_IMAGE1_PART2) - - BcmGetSectionValStartOffset(Adapter,ISO_IMAGE1_PART2)+ - BcmGetSectionValEndOffset(Adapter,ISO_IMAGE1_PART3) - - BcmGetSectionValStartOffset(Adapter,ISO_IMAGE1_PART3); + uiSectEndOffset = BcmGetSectionValEndOffset(Adapter, ISO_IMAGE1) - + BcmGetSectionValStartOffset(Adapter, ISO_IMAGE1) + + BcmGetSectionValEndOffset(Adapter, ISO_IMAGE1_PART2) - + BcmGetSectionValStartOffset(Adapter, ISO_IMAGE1_PART2) + + BcmGetSectionValEndOffset(Adapter, ISO_IMAGE1_PART3) - + BcmGetSectionValStartOffset(Adapter, ISO_IMAGE1_PART3); } - else if(psFlash2xReadWrite->Section == ISO_IMAGE2) + else if (psFlash2xReadWrite->Section == ISO_IMAGE2) { - uiSectEndOffset = BcmGetSectionValEndOffset(Adapter,ISO_IMAGE2) - - BcmGetSectionValStartOffset(Adapter,ISO_IMAGE2)+ - BcmGetSectionValEndOffset(Adapter,ISO_IMAGE2_PART2) - - BcmGetSectionValStartOffset(Adapter,ISO_IMAGE2_PART2)+ - BcmGetSectionValEndOffset(Adapter,ISO_IMAGE2_PART3) - - BcmGetSectionValStartOffset(Adapter,ISO_IMAGE2_PART3); - + uiSectEndOffset = BcmGetSectionValEndOffset(Adapter, ISO_IMAGE2) - + BcmGetSectionValStartOffset(Adapter, ISO_IMAGE2) + + BcmGetSectionValEndOffset(Adapter, ISO_IMAGE2_PART2) - + BcmGetSectionValStartOffset(Adapter, ISO_IMAGE2_PART2) + + BcmGetSectionValEndOffset(Adapter, ISO_IMAGE2_PART3) - + BcmGetSectionValStartOffset(Adapter, ISO_IMAGE2_PART3); } - //since this uiSectEndoffset is the size of iso Image. hence for calculating the vitual endoffset - //it should be added in startoffset. so that check done in last of this function can be valued. - uiSectEndOffset = uiSectStartOffset + uiSectEndOffset ; + // since this uiSectEndoffset is the size of iso Image. hence for calculating the vitual endoffset + // it should be added in startoffset. so that check done in last of this function can be valued. + uiSectEndOffset = uiSectStartOffset + uiSectEndOffset; - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Total size of the ISO Image :%x",uiSectEndOffset); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Total size of the ISO Image :%x", uiSectEndOffset); } else - uiSectEndOffset = BcmGetSectionValEndOffset(Adapter,psFlash2xReadWrite->Section); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "End offset :%x \n",uiSectEndOffset); + uiSectEndOffset = BcmGetSectionValEndOffset(Adapter, psFlash2xReadWrite->Section); + + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "End offset :%x\n", uiSectEndOffset); - //Checking the boundary condition - if((uiSectStartOffset + psFlash2xReadWrite->offset + uiNumOfBytes) <= uiSectEndOffset) + // Checking the boundary condition + if ((uiSectStartOffset + psFlash2xReadWrite->offset + uiNumOfBytes) <= uiSectEndOffset) return TRUE; else { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Invalid Request...."); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Invalid Request...."); return FALSE; } - } /** @@ -4461,11 +4352,12 @@ Return value:- INT IsFlash2x(struct bcm_mini_adapter *Adapter) { - if(Adapter->uiFlashLayoutMajorVersion >= FLASH_2X_MAJOR_NUMBER) - return TRUE ; + if (Adapter->uiFlashLayoutMajorVersion >= FLASH_2X_MAJOR_NUMBER) + return TRUE; else return FALSE; } + /** GetFlashBaseAddr :- Calculate the Flash Base address @Adapater :- Bcm Driver Private Data Structure @@ -4476,38 +4368,36 @@ Return Value:- static INT GetFlashBaseAddr(struct bcm_mini_adapter *Adapter) { - UINT uiBaseAddr = 0; - if(Adapter->bDDRInitDone) + if (Adapter->bDDRInitDone) { /* - For All Valid Flash Versions... except 1.1, take the value from FlashBaseAddr - In case of Raw Read... use the default value + For All Valid Flash Versions... except 1.1, take the value from FlashBaseAddr + In case of Raw Read... use the default value */ - if(Adapter->uiFlashLayoutMajorVersion && (Adapter->bFlashRawRead == FALSE) && - !((Adapter->uiFlashLayoutMajorVersion == 1) && (Adapter->uiFlashLayoutMinorVersion == 1)) - ) - uiBaseAddr = Adapter->uiFlashBaseAdd ; + if (Adapter->uiFlashLayoutMajorVersion && (Adapter->bFlashRawRead == FALSE) && + !((Adapter->uiFlashLayoutMajorVersion == 1) && (Adapter->uiFlashLayoutMinorVersion == 1))) + uiBaseAddr = Adapter->uiFlashBaseAdd; else uiBaseAddr = FLASH_CONTIGIOUS_START_ADDR_AFTER_INIT; } else { /* - For All Valid Flash Versions... except 1.1, take the value from FlashBaseAddr - In case of Raw Read... use the default value + For All Valid Flash Versions... except 1.1, take the value from FlashBaseAddr + In case of Raw Read... use the default value */ - if(Adapter->uiFlashLayoutMajorVersion && (Adapter->bFlashRawRead == FALSE) && - !((Adapter->uiFlashLayoutMajorVersion == 1) && (Adapter->uiFlashLayoutMinorVersion == 1)) - ) + if (Adapter->uiFlashLayoutMajorVersion && (Adapter->bFlashRawRead == FALSE) && + !((Adapter->uiFlashLayoutMajorVersion == 1) && (Adapter->uiFlashLayoutMinorVersion == 1))) uiBaseAddr = Adapter->uiFlashBaseAdd | FLASH_CONTIGIOUS_START_ADDR_BEFORE_INIT; else uiBaseAddr = FLASH_CONTIGIOUS_START_ADDR_BEFORE_INIT; } - return uiBaseAddr ; + return uiBaseAddr; } + /** BcmCopySection :- This API is used to copy the One section in another. Both section should be contiuous and of same size. Hence this Will not be applicabe to copy ISO. @@ -4525,108 +4415,108 @@ Return Values- **/ -INT BcmCopySection(struct bcm_mini_adapter *Adapter, - FLASH2X_SECTION_VAL SrcSection, - FLASH2X_SECTION_VAL DstSection, - UINT offset, - UINT numOfBytes) +INT BcmCopySection(struct bcm_mini_adapter *Adapter, + FLASH2X_SECTION_VAL SrcSection, + FLASH2X_SECTION_VAL DstSection, + UINT offset, + UINT numOfBytes) { - UINT BuffSize = 0 ; + UINT BuffSize = 0; UINT BytesToBeCopied = 0; - PUCHAR pBuff = NULL ; - INT Status = STATUS_SUCCESS ; - if(SrcSection == DstSection) + PUCHAR pBuff = NULL; + INT Status = STATUS_SUCCESS; + + if (SrcSection == DstSection) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Source and Destination should be different ...try again"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Source and Destination should be different ...try again"); return -EINVAL; } - if((SrcSection != DSD0) && (SrcSection != DSD1) && (SrcSection != DSD2)) + + if ((SrcSection != DSD0) && (SrcSection != DSD1) && (SrcSection != DSD2)) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Source should be DSD subsection"); - return -EINVAL; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Source should be DSD subsection"); + return -EINVAL; } - if((DstSection != DSD0) && (DstSection != DSD1) && (DstSection != DSD2)) + + if ((DstSection != DSD0) && (DstSection != DSD1) && (DstSection != DSD2)) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Destination should be DSD subsection"); - return -EINVAL; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Destination should be DSD subsection"); + return -EINVAL; } - //if offset zero means have to copy complete secton - - if(numOfBytes == 0) + // if offset zero means have to copy complete secton + if (numOfBytes == 0) { - numOfBytes = BcmGetSectionValEndOffset(Adapter,SrcSection) - - BcmGetSectionValStartOffset(Adapter,SrcSection); + numOfBytes = BcmGetSectionValEndOffset(Adapter, SrcSection) + - BcmGetSectionValStartOffset(Adapter, SrcSection); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL," Section Size :0x%x",numOfBytes); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Section Size :0x%x", numOfBytes); } - if((offset + numOfBytes) > BcmGetSectionValEndOffset(Adapter,SrcSection) - - BcmGetSectionValStartOffset(Adapter,SrcSection)) + if ((offset + numOfBytes) > BcmGetSectionValEndOffset(Adapter, SrcSection) + - BcmGetSectionValStartOffset(Adapter, SrcSection)) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0," Input parameters going beyond the section offS: %x numB: %x of Source Section\n", - offset, numOfBytes); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, " Input parameters going beyond the section offS: %x numB: %x of Source Section\n", + offset, numOfBytes); return -EINVAL; } - if((offset + numOfBytes) > BcmGetSectionValEndOffset(Adapter,DstSection) - - BcmGetSectionValStartOffset(Adapter,DstSection)) + if ((offset + numOfBytes) > BcmGetSectionValEndOffset(Adapter, DstSection) + - BcmGetSectionValStartOffset(Adapter, DstSection)) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0," Input parameters going beyond the section offS: %x numB: %x of Destination Section\n", - offset, numOfBytes); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Input parameters going beyond the section offS: %x numB: %x of Destination Section\n", + offset, numOfBytes); return -EINVAL; } - - if(numOfBytes > Adapter->uiSectorSize ) + if (numOfBytes > Adapter->uiSectorSize) BuffSize = Adapter->uiSectorSize; else - BuffSize = numOfBytes ; + BuffSize = numOfBytes; pBuff = (PCHAR)kzalloc(BuffSize, GFP_KERNEL); - if(pBuff == NULL) + if (pBuff == NULL) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Memory allocation failed.. "); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Memory allocation failed.. "); return -ENOMEM; } - - BytesToBeCopied = Adapter->uiSectorSize ; - if(offset % Adapter->uiSectorSize) + BytesToBeCopied = Adapter->uiSectorSize; + if (offset % Adapter->uiSectorSize) BytesToBeCopied = Adapter->uiSectorSize - (offset % Adapter->uiSectorSize); - if(BytesToBeCopied > numOfBytes) - BytesToBeCopied = numOfBytes ; - - + if (BytesToBeCopied > numOfBytes) + BytesToBeCopied = numOfBytes; Adapter->bHeaderChangeAllowed = TRUE; do { - Status = BcmFlash2xBulkRead(Adapter, (PUINT)pBuff, SrcSection , offset,BytesToBeCopied); - if(Status) + Status = BcmFlash2xBulkRead(Adapter, (PUINT)pBuff, SrcSection , offset, BytesToBeCopied); + if (Status) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Read failed at offset :%d for NOB :%d", SrcSection,BytesToBeCopied); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Read failed at offset :%d for NOB :%d", SrcSection, BytesToBeCopied); break; } - Status = BcmFlash2xBulkWrite(Adapter,(PUINT)pBuff,DstSection,offset,BytesToBeCopied,FALSE); - if(Status) + Status = BcmFlash2xBulkWrite(Adapter, (PUINT)pBuff, DstSection, offset, BytesToBeCopied, FALSE); + if (Status) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Write failed at offset :%d for NOB :%d", DstSection,BytesToBeCopied); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Write failed at offset :%d for NOB :%d", DstSection, BytesToBeCopied); break; } offset = offset + BytesToBeCopied; - numOfBytes = numOfBytes - BytesToBeCopied ; - if(numOfBytes) + numOfBytes = numOfBytes - BytesToBeCopied; + if (numOfBytes) { - if(numOfBytes > Adapter->uiSectorSize ) + if (numOfBytes > Adapter->uiSectorSize) BytesToBeCopied = Adapter->uiSectorSize; else BytesToBeCopied = numOfBytes; } - }while(numOfBytes > 0) ; + } while (numOfBytes > 0); + kfree(pBuff); - Adapter->bHeaderChangeAllowed = FALSE ; + Adapter->bHeaderChangeAllowed = FALSE; + return Status; } @@ -4644,68 +4534,66 @@ Return value :- INT SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, UINT uiOffset) { - UINT offsetToProtect = 0,HeaderSizeToProtect =0; - BOOLEAN bHasHeader = FALSE ; - PUCHAR pTempBuff =NULL; + UINT offsetToProtect = 0, HeaderSizeToProtect = 0; + BOOLEAN bHasHeader = FALSE; + PUCHAR pTempBuff = NULL; UINT uiSectAlignAddr = 0; UINT sig = 0; //making the offset sector aligned uiSectAlignAddr = uiOffset & ~(Adapter->uiSectorSize - 1); - - if((uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter,DSD2)- Adapter->uiSectorSize)|| - (uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter,DSD1)- Adapter->uiSectorSize)|| - (uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter,DSD0)- Adapter->uiSectorSize)) + if ((uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter, DSD2) - Adapter->uiSectorSize) || + (uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter, DSD1) - Adapter->uiSectorSize) || + (uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter, DSD0) - Adapter->uiSectorSize)) { - - //offset from the sector boundary having the header map + // offset from the sector boundary having the header map offsetToProtect = Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader % Adapter->uiSectorSize; HeaderSizeToProtect = sizeof(DSD_HEADER); - bHasHeader = TRUE ; + bHasHeader = TRUE; } - if(uiSectAlignAddr == BcmGetSectionValStartOffset(Adapter,ISO_IMAGE1) || - uiSectAlignAddr == BcmGetSectionValStartOffset(Adapter,ISO_IMAGE2)) + if (uiSectAlignAddr == BcmGetSectionValStartOffset(Adapter, ISO_IMAGE1) || + uiSectAlignAddr == BcmGetSectionValStartOffset(Adapter, ISO_IMAGE2)) { offsetToProtect = 0; HeaderSizeToProtect = sizeof(ISO_HEADER); bHasHeader = TRUE; } - //If Header is present overwrite passed buffer with this - if(bHasHeader && (Adapter->bHeaderChangeAllowed == FALSE)) + // If Header is present overwrite passed buffer with this + if (bHasHeader && (Adapter->bHeaderChangeAllowed == FALSE)) { pTempBuff = (PUCHAR)kzalloc(HeaderSizeToProtect, GFP_KERNEL); - if(pTempBuff == NULL) + if (pTempBuff == NULL) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Memory allocation failed "); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Memory allocation failed"); return -ENOMEM; } - //Read header - BeceemFlashBulkRead(Adapter,(PUINT)pTempBuff,(uiSectAlignAddr + offsetToProtect),HeaderSizeToProtect); - BCM_DEBUG_PRINT_BUFFER(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,pTempBuff ,HeaderSizeToProtect); + // Read header + BeceemFlashBulkRead(Adapter, (PUINT)pTempBuff, (uiSectAlignAddr + offsetToProtect), HeaderSizeToProtect); + BCM_DEBUG_PRINT_BUFFER(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, pTempBuff, HeaderSizeToProtect); //Replace Buffer content with Header - memcpy(pBuff +offsetToProtect,pTempBuff,HeaderSizeToProtect); + memcpy(pBuff + offsetToProtect, pTempBuff, HeaderSizeToProtect); kfree(pTempBuff); } - if(bHasHeader && Adapter->bSigCorrupted) + if (bHasHeader && Adapter->bSigCorrupted) { - sig = *((PUINT)(pBuff + offsetToProtect + FIELD_OFFSET_IN_HEADER(PDSD_HEADER,DSDImageMagicNumber))); + sig = *((PUINT)(pBuff + offsetToProtect + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImageMagicNumber))); sig = ntohl(sig); - if((sig & 0xFF000000) != CORRUPTED_PATTERN) + if ((sig & 0xFF000000) != CORRUPTED_PATTERN) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Desired pattern is not at sig offset. Hence won't restore"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Desired pattern is not at sig offset. Hence won't restore"); Adapter->bSigCorrupted = FALSE; return STATUS_SUCCESS; } - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL," Corrupted sig is :%X", sig); - *((PUINT)(pBuff + offsetToProtect + FIELD_OFFSET_IN_HEADER(PDSD_HEADER,DSDImageMagicNumber)))= htonl(DSD_IMAGE_MAGIC_NUMBER); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Restoring the signature in Header Write only"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, " Corrupted sig is :%X", sig); + *((PUINT)(pBuff + offsetToProtect + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImageMagicNumber))) = htonl(DSD_IMAGE_MAGIC_NUMBER); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Restoring the signature in Header Write only"); Adapter->bSigCorrupted = FALSE; } - return STATUS_SUCCESS ; + return STATUS_SUCCESS; } /** @@ -4722,7 +4610,7 @@ static INT BcmDoChipSelect(struct bcm_mini_adapter *Adapter, UINT offset) UINT GPIOConfig = 0; UINT PartNum = 0; - ChipNum = offset / FLASH_PART_SIZE ; + ChipNum = offset / FLASH_PART_SIZE; // // Chip Select mapping to enable flash0. @@ -4733,363 +4621,369 @@ static INT BcmDoChipSelect(struct bcm_mini_adapter *Adapter, UINT offset) // /* - SelectedChip Variable is the selection that the host is 100% Sure the same as what the register will hold. This can be ONLY ensured - if the Chip doesn't goes to low power mode while the flash operation is in progress (NVMRdmWrmLock is taken) - Before every new Flash Write operation, we reset the variable. This is to ensure that after any wake-up from - power down modes (Idle mode/shutdown mode), the values in the register will be different. + SelectedChip Variable is the selection that the host is 100% Sure the same as what the register will hold. This can be ONLY ensured + if the Chip doesn't goes to low power mode while the flash operation is in progress (NVMRdmWrmLock is taken) + Before every new Flash Write operation, we reset the variable. This is to ensure that after any wake-up from + power down modes (Idle mode/shutdown mode), the values in the register will be different. */ - if(Adapter->SelectedChip == ChipNum) - return STATUS_SUCCESS; + if (Adapter->SelectedChip == ChipNum) + return STATUS_SUCCESS; - //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Selected Chip :%x", ChipNum); - Adapter->SelectedChip = ChipNum ; + // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Selected Chip :%x", ChipNum); + Adapter->SelectedChip = ChipNum; - //bit[13..12] will select the appropriate chip + // bit[13..12] will select the appropriate chip rdmalt(Adapter, FLASH_CONFIG_REG, &FlashConfig, 4); rdmalt(Adapter, FLASH_GPIO_CONFIG_REG, &GPIOConfig, 4); - { - switch(ChipNum) + switch (ChipNum) { - case 0: - PartNum = 0; - break; - case 1: - PartNum = 3; - GPIOConfig |= (0x4 << CHIP_SELECT_BIT12); - break; - case 2: - PartNum = 1; - GPIOConfig |= (0x1 << CHIP_SELECT_BIT12); - break; - case 3: - PartNum = 2; - GPIOConfig |= (0x2 << CHIP_SELECT_BIT12); - break; + case 0: + PartNum = 0; + break; + case 1: + PartNum = 3; + GPIOConfig |= (0x4 << CHIP_SELECT_BIT12); + break; + case 2: + PartNum = 1; + GPIOConfig |= (0x1 << CHIP_SELECT_BIT12); + break; + case 3: + PartNum = 2; + GPIOConfig |= (0x2 << CHIP_SELECT_BIT12); + break; } } /* In case the bits already written in the FLASH_CONFIG_REG is same as what the user desired, - nothing to do... can return immediately. - ASSUMPTION: FLASH_GPIO_CONFIG_REG will be in sync with FLASH_CONFIG_REG. - Even if the chip goes to low power mode, it should wake with values in each register in sync with each other. - These values are not written by host other than during CHIP_SELECT. + nothing to do... can return immediately. + ASSUMPTION: FLASH_GPIO_CONFIG_REG will be in sync with FLASH_CONFIG_REG. + Even if the chip goes to low power mode, it should wake with values in each register in sync with each other. + These values are not written by host other than during CHIP_SELECT. */ - if(PartNum == ((FlashConfig >> CHIP_SELECT_BIT12) & 0x3)) + if (PartNum == ((FlashConfig >> CHIP_SELECT_BIT12) & 0x3)) return STATUS_SUCCESS; - //clearing the bit[13..12] + // clearing the bit[13..12] FlashConfig &= 0xFFFFCFFF; - FlashConfig = (FlashConfig | (PartNum<psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(PDSD_HEADER,DSDImageMagicNumber), - SIGNATURE_SIZE); + if (dsd != DSD0 && dsd != DSD1 && dsd != DSD2) + { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "passed section value is not for DSDs"); + return STATUS_FAILURE; + } + BcmFlash2xBulkRead(Adapter, + &uiDSDsig, + dsd, + Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImageMagicNumber), + SIGNATURE_SIZE); - uiDSDsig = ntohl(uiDSDsig); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"DSD SIG :%x", uiDSDsig); + uiDSDsig = ntohl(uiDSDsig); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "DSD SIG :%x", uiDSDsig); - return uiDSDsig ; + return uiDSDsig; } + INT ReadDSDPriority(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL dsd) { - //UINT priOffsetInMap = 0 ; + // UINT priOffsetInMap = 0 ; unsigned int uiDSDPri = STATUS_FAILURE; - //DSD_HEADER dsdHeader = {0}; - //priOffsetInMap = (PUCHAR)&(dsdHeader.DSDImagePriority) -(PUCHAR)&dsdHeader; - if(IsSectionWritable(Adapter,dsd)) + // DSD_HEADER dsdHeader = {0}; + // priOffsetInMap = (PUCHAR)&(dsdHeader.DSDImagePriority) -(PUCHAR)&dsdHeader; + if (IsSectionWritable(Adapter, dsd)) { - if(ReadDSDSignature(Adapter,dsd)== DSD_IMAGE_MAGIC_NUMBER) + if (ReadDSDSignature(Adapter, dsd) == DSD_IMAGE_MAGIC_NUMBER) { BcmFlash2xBulkRead(Adapter, - &uiDSDPri, - dsd, - Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader +FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImagePriority), - 4); + &uiDSDPri, + dsd, + Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImagePriority), + 4); uiDSDPri = ntohl(uiDSDPri); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"DSD<%x> Priority :%x", dsd, uiDSDPri); - + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "DSD<%x> Priority :%x", dsd, uiDSDPri); } } + return uiDSDPri; } + FLASH2X_SECTION_VAL getHighestPriDSD(struct bcm_mini_adapter *Adapter) { INT DSDHighestPri = STATUS_FAILURE; - INT DsdPri= 0 ; - FLASH2X_SECTION_VAL HighestPriDSD = 0 ; + INT DsdPri = 0; + FLASH2X_SECTION_VAL HighestPriDSD = 0; - if(IsSectionWritable(Adapter,DSD2)) + if (IsSectionWritable(Adapter, DSD2)) { - DSDHighestPri = ReadDSDPriority(Adapter,DSD2); - HighestPriDSD = DSD2 ; + DSDHighestPri = ReadDSDPriority(Adapter, DSD2); + HighestPriDSD = DSD2; } - if(IsSectionWritable(Adapter,DSD1)) + + if (IsSectionWritable(Adapter, DSD1)) { - DsdPri = ReadDSDPriority(Adapter,DSD1); - if(DSDHighestPri < DsdPri) - { - DSDHighestPri = DsdPri ; + DsdPri = ReadDSDPriority(Adapter, DSD1); + if (DSDHighestPri < DsdPri) + { + DSDHighestPri = DsdPri; HighestPriDSD = DSD1; - } + } } - if(IsSectionWritable(Adapter,DSD0)) + + if (IsSectionWritable(Adapter, DSD0)) { - DsdPri = ReadDSDPriority(Adapter,DSD0); - if(DSDHighestPri < DsdPri) - { - DSDHighestPri = DsdPri ; + DsdPri = ReadDSDPriority(Adapter, DSD0); + if (DSDHighestPri < DsdPri) + { + DSDHighestPri = DsdPri; HighestPriDSD = DSD0; - } + } } - if(HighestPriDSD) - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Highest DSD :%x , and its Pri :%x", HighestPriDSD, DSDHighestPri); - return HighestPriDSD ; + if (HighestPriDSD) + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Highest DSD :%x , and its Pri :%x", HighestPriDSD, DSDHighestPri); + + return HighestPriDSD; } INT ReadISOSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL iso) { - UINT uiISOsig = 0; - //UINT sigoffsetInMap = 0; - //ISO_HEADER ISOHeader = {0}; + UINT uiISOsig = 0; + //UINT sigoffsetInMap = 0; + //ISO_HEADER ISOHeader = {0}; + //sigoffsetInMap =(PUCHAR)&(ISOHeader.ISOImageMagicNumber) -(PUCHAR)&ISOHeader; + if (iso != ISO_IMAGE1 && iso != ISO_IMAGE2) + { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "passed section value is not for ISOs"); + return STATUS_FAILURE; + } + BcmFlash2xBulkRead(Adapter, + &uiISOsig, + iso, + 0 + FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImageMagicNumber), + SIGNATURE_SIZE); - //sigoffsetInMap =(PUCHAR)&(ISOHeader.ISOImageMagicNumber) -(PUCHAR)&ISOHeader; - - if(iso != ISO_IMAGE1 && iso != ISO_IMAGE2) - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"passed section value is not for ISOs"); - return STATUS_FAILURE; - } - BcmFlash2xBulkRead(Adapter, - &uiISOsig, - iso, - 0 + FIELD_OFFSET_IN_HEADER(PISO_HEADER,ISOImageMagicNumber), - SIGNATURE_SIZE); - - uiISOsig = ntohl(uiISOsig); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"ISO SIG :%x", uiISOsig); + uiISOsig = ntohl(uiISOsig); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "ISO SIG :%x", uiISOsig); - return uiISOsig ; + return uiISOsig; } + INT ReadISOPriority(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL iso) { - unsigned int ISOPri = STATUS_FAILURE; - if(IsSectionWritable(Adapter,iso)) + if (IsSectionWritable(Adapter, iso)) { - if(ReadISOSignature(Adapter,iso)== ISO_IMAGE_MAGIC_NUMBER) + if (ReadISOSignature(Adapter, iso) == ISO_IMAGE_MAGIC_NUMBER) { BcmFlash2xBulkRead(Adapter, - &ISOPri, - iso, - 0 + FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImagePriority), - 4); + &ISOPri, + iso, + 0 + FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImagePriority), + 4); ISOPri = ntohl(ISOPri); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"ISO<%x> Priority :%x", iso, ISOPri); - + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "ISO<%x> Priority :%x", iso, ISOPri); } } + return ISOPri; } + FLASH2X_SECTION_VAL getHighestPriISO(struct bcm_mini_adapter *Adapter) { INT ISOHighestPri = STATUS_FAILURE; - INT ISOPri= 0 ; - FLASH2X_SECTION_VAL HighestPriISO = NO_SECTION_VAL ; + INT ISOPri = 0; + FLASH2X_SECTION_VAL HighestPriISO = NO_SECTION_VAL; - if(IsSectionWritable(Adapter,ISO_IMAGE2)) + if (IsSectionWritable(Adapter, ISO_IMAGE2)) { - ISOHighestPri = ReadISOPriority(Adapter,ISO_IMAGE2); - HighestPriISO = ISO_IMAGE2 ; + ISOHighestPri = ReadISOPriority(Adapter, ISO_IMAGE2); + HighestPriISO = ISO_IMAGE2; } - if(IsSectionWritable(Adapter,ISO_IMAGE1)) + + if (IsSectionWritable(Adapter, ISO_IMAGE1)) { - ISOPri = ReadISOPriority(Adapter,ISO_IMAGE1); - if(ISOHighestPri < ISOPri) - { - ISOHighestPri = ISOPri ; + ISOPri = ReadISOPriority(Adapter, ISO_IMAGE1); + if (ISOHighestPri < ISOPri) + { + ISOHighestPri = ISOPri; HighestPriISO = ISO_IMAGE1; - } + } } - if(HighestPriISO) - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Highest ISO :%x and its Pri :%x",HighestPriISO,ISOHighestPri); - return HighestPriISO ; + if (HighestPriISO) + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Highest ISO :%x and its Pri :%x", HighestPriISO, ISOHighestPri); + + return HighestPriISO; } + INT WriteToFlashWithoutSectorErase(struct bcm_mini_adapter *Adapter, - PUINT pBuff, - FLASH2X_SECTION_VAL eFlash2xSectionVal, - UINT uiOffset, - UINT uiNumBytes - ) + PUINT pBuff, + FLASH2X_SECTION_VAL eFlash2xSectionVal, + UINT uiOffset, + UINT uiNumBytes) { -#if !defined(BCM_SHM_INTERFACE) || defined(FLASH_DIRECT_ACCESS) - UINT uiTemp = 0, value = 0 ; - UINT i = 0; - UINT uiPartOffset = 0; -#endif + #if !defined(BCM_SHM_INTERFACE) || defined(FLASH_DIRECT_ACCESS) + UINT uiTemp = 0, value = 0; + UINT i = 0; + UINT uiPartOffset = 0; + #endif UINT uiStartOffset = 0; - //Adding section start address + // Adding section start address INT Status = STATUS_SUCCESS; PUCHAR pcBuff = (PUCHAR)pBuff; - if(uiNumBytes % Adapter->ulFlashWriteSize) + if (uiNumBytes % Adapter->ulFlashWriteSize) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Writing without Sector Erase for non-FlashWriteSize number of bytes 0x%x\n", uiNumBytes); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Writing without Sector Erase for non-FlashWriteSize number of bytes 0x%x\n", uiNumBytes); return STATUS_FAILURE; } - uiStartOffset = BcmGetSectionValStartOffset(Adapter,eFlash2xSectionVal); + uiStartOffset = BcmGetSectionValStartOffset(Adapter, eFlash2xSectionVal); - if(IsSectionExistInVendorInfo(Adapter,eFlash2xSectionVal)) + if (IsSectionExistInVendorInfo(Adapter, eFlash2xSectionVal)) { return vendorextnWriteSectionWithoutErase(Adapter, pcBuff, eFlash2xSectionVal, uiOffset, uiNumBytes); } uiOffset = uiOffset + uiStartOffset; -#if defined(BCM_SHM_INTERFACE) && !defined(FLASH_DIRECT_ACCESS) - Status = bcmflash_raw_writenoerase((uiOffset/FLASH_PART_SIZE),(uiOffset % FLASH_PART_SIZE), pcBuff,uiNumBytes); -#else - rdmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); - value = 0; - wrmalt(Adapter, 0x0f000C80,&value, sizeof(value)); + #if defined(BCM_SHM_INTERFACE) && !defined(FLASH_DIRECT_ACCESS) + Status = bcmflash_raw_writenoerase((uiOffset / FLASH_PART_SIZE), (uiOffset % FLASH_PART_SIZE), pcBuff, uiNumBytes); + #else + rdmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); + value = 0; + wrmalt(Adapter, 0x0f000C80, &value, sizeof(value)); - Adapter->SelectedChip = RESET_CHIP_SELECT; - BcmDoChipSelect(Adapter,uiOffset); - uiPartOffset = (uiOffset & (FLASH_PART_SIZE - 1)) + GetFlashBaseAddr(Adapter); + Adapter->SelectedChip = RESET_CHIP_SELECT; + BcmDoChipSelect(Adapter, uiOffset); + uiPartOffset = (uiOffset & (FLASH_PART_SIZE - 1)) + GetFlashBaseAddr(Adapter); - for(i = 0 ; i< uiNumBytes; i += Adapter->ulFlashWriteSize) - { - if(Adapter->ulFlashWriteSize == BYTE_WRITE_SUPPORT) - Status = flashByteWrite(Adapter,uiPartOffset, pcBuff); - else - Status = flashWrite(Adapter,uiPartOffset, pcBuff); + for (i = 0 ; i < uiNumBytes; i += Adapter->ulFlashWriteSize) + { + if (Adapter->ulFlashWriteSize == BYTE_WRITE_SUPPORT) + Status = flashByteWrite(Adapter, uiPartOffset, pcBuff); + else + Status = flashWrite(Adapter, uiPartOffset, pcBuff); - if(Status != STATUS_SUCCESS) - break; + if (Status != STATUS_SUCCESS) + break; - pcBuff = pcBuff + Adapter->ulFlashWriteSize; - uiPartOffset = uiPartOffset + Adapter->ulFlashWriteSize; - } - wrmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); - Adapter->SelectedChip = RESET_CHIP_SELECT; -#endif + pcBuff = pcBuff + Adapter->ulFlashWriteSize; + uiPartOffset = uiPartOffset + Adapter->ulFlashWriteSize; + } + wrmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); + Adapter->SelectedChip = RESET_CHIP_SELECT; + #endif return Status; } BOOLEAN IsSectionExistInFlash(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL section) { + BOOLEAN SectionPresent = FALSE; - BOOLEAN SectionPresent = FALSE ; - - switch(section) + switch (section) { - - case ISO_IMAGE1 : - if((Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start != UNINIT_PTR_IN_CS) && - (IsNonCDLessDevice(Adapter) == FALSE)) - SectionPresent = TRUE ; - break; - case ISO_IMAGE2 : - if((Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start != UNINIT_PTR_IN_CS) && - (IsNonCDLessDevice(Adapter) == FALSE)) - SectionPresent = TRUE ; - break; - case DSD0 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart != UNINIT_PTR_IN_CS) - SectionPresent = TRUE ; - break; - case DSD1 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start != UNINIT_PTR_IN_CS) - SectionPresent = TRUE ; - break; - case DSD2 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start != UNINIT_PTR_IN_CS) - SectionPresent = TRUE ; - break; - case VSA0 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart != UNINIT_PTR_IN_CS) - SectionPresent = TRUE ; - break; - case VSA1 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start != UNINIT_PTR_IN_CS) - SectionPresent = TRUE ; - break; - case VSA2 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start != UNINIT_PTR_IN_CS) - SectionPresent = TRUE ; - break; - case SCSI : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware != UNINIT_PTR_IN_CS) - SectionPresent = TRUE ; - break; - case CONTROL_SECTION : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForControlSectionStart != UNINIT_PTR_IN_CS) - SectionPresent = TRUE ; - break; - default : - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Section Does not exist in Flash 2.x"); + case ISO_IMAGE1: + if ((Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start != UNINIT_PTR_IN_CS) && + (IsNonCDLessDevice(Adapter) == FALSE)) + SectionPresent = TRUE; + break; + case ISO_IMAGE2: + if ((Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start != UNINIT_PTR_IN_CS) && + (IsNonCDLessDevice(Adapter) == FALSE)) + SectionPresent = TRUE; + break; + case DSD0: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart != UNINIT_PTR_IN_CS) + SectionPresent = TRUE; + break; + case DSD1: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start != UNINIT_PTR_IN_CS) + SectionPresent = TRUE; + break; + case DSD2: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start != UNINIT_PTR_IN_CS) + SectionPresent = TRUE; + break; + case VSA0: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart != UNINIT_PTR_IN_CS) + SectionPresent = TRUE; + break; + case VSA1: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start != UNINIT_PTR_IN_CS) + SectionPresent = TRUE; + break; + case VSA2: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start != UNINIT_PTR_IN_CS) + SectionPresent = TRUE; + break; + case SCSI: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware != UNINIT_PTR_IN_CS) + SectionPresent = TRUE; + break; + case CONTROL_SECTION: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForControlSectionStart != UNINIT_PTR_IN_CS) + SectionPresent = TRUE; + break; + default: + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Section Does not exist in Flash 2.x"); SectionPresent = FALSE; } - return SectionPresent ; + + return SectionPresent; } + INT IsSectionWritable(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL Section) { - INT offset = STATUS_FAILURE; - INT Status = FALSE; - if(IsSectionExistInFlash(Adapter,Section) == FALSE) - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Section <%d> does not exixt", Section); - return FALSE; - } - offset = BcmGetSectionValStartOffset(Adapter,Section); - if(offset == INVALID_OFFSET) - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Section<%d> does not exixt", Section); - return FALSE; - } + INT offset = STATUS_FAILURE; + INT Status = FALSE; - if(IsSectionExistInVendorInfo(Adapter,Section)) - { - return !(Adapter->psFlash2xVendorInfo->VendorSection[Section].AccessFlags & FLASH2X_SECTION_RO); - } + if (IsSectionExistInFlash(Adapter, Section) == FALSE) + { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Section <%d> does not exixt", Section); + return FALSE; + } + + offset = BcmGetSectionValStartOffset(Adapter, Section); + if (offset == INVALID_OFFSET) + { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Section<%d> does not exixt", Section); + return FALSE; + } + + if (IsSectionExistInVendorInfo(Adapter, Section)) + { + return !(Adapter->psFlash2xVendorInfo->VendorSection[Section].AccessFlags & FLASH2X_SECTION_RO); + } - Status = IsOffsetWritable(Adapter,offset); - return Status ; + Status = IsOffsetWritable(Adapter, offset); + return Status; } static INT CorruptDSDSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) { - PUCHAR pBuff = NULL; UINT sig = 0; UINT uiOffset = 0; @@ -5097,126 +4991,125 @@ static INT CorruptDSDSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL e UINT uiSectAlignAddr = 0; Adapter->bSigCorrupted = FALSE; - - if(Adapter->bAllDSDWriteAllow == FALSE) + if (Adapter->bAllDSDWriteAllow == FALSE) { - if(IsSectionWritable(Adapter,eFlash2xSectionVal) != TRUE) + if (IsSectionWritable(Adapter, eFlash2xSectionVal) != TRUE) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Section is not Writable...Hence can't Corrupt signature"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Section is not Writable...Hence can't Corrupt signature"); return SECTOR_IS_NOT_WRITABLE; } } pBuff = (PUCHAR)kzalloc(MAX_RW_SIZE, GFP_KERNEL); - if(pBuff == NULL) + if (pBuff == NULL) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Can't allocate memorey"); - return -ENOMEM ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Can't allocate memorey"); + return -ENOMEM; } uiOffset = Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER); - uiOffset -= MAX_RW_SIZE ; - - BcmFlash2xBulkRead(Adapter, (PUINT)pBuff,eFlash2xSectionVal,uiOffset,MAX_RW_SIZE); + uiOffset -= MAX_RW_SIZE; + BcmFlash2xBulkRead(Adapter, (PUINT)pBuff, eFlash2xSectionVal, uiOffset, MAX_RW_SIZE); - sig = *((PUINT)(pBuff +12)); - sig =ntohl(sig); - BCM_DEBUG_PRINT_BUFFER(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,pBuff,MAX_RW_SIZE); - //Now corrupting the sig by corrupting 4th last Byte. + sig = *((PUINT)(pBuff + 12)); + sig = ntohl(sig); + BCM_DEBUG_PRINT_BUFFER(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, pBuff, MAX_RW_SIZE); + // Now corrupting the sig by corrupting 4th last Byte. *(pBuff + 12) = 0; - if(sig == DSD_IMAGE_MAGIC_NUMBER) + if (sig == DSD_IMAGE_MAGIC_NUMBER) { Adapter->bSigCorrupted = TRUE; - if(Adapter->ulFlashWriteSize == BYTE_WRITE_SUPPORT) + if (Adapter->ulFlashWriteSize == BYTE_WRITE_SUPPORT) { - uiSectAlignAddr = uiOffset & ~(Adapter->uiSectorSize -1); - BlockStatus = BcmFlashUnProtectBlock(Adapter,uiSectAlignAddr,Adapter->uiSectorSize); + uiSectAlignAddr = uiOffset & ~(Adapter->uiSectorSize - 1); + BlockStatus = BcmFlashUnProtectBlock(Adapter, uiSectAlignAddr, Adapter->uiSectorSize); - WriteToFlashWithoutSectorErase(Adapter,(PUINT)(pBuff + 12),eFlash2xSectionVal, - (uiOffset + 12),BYTE_WRITE_SUPPORT); - if(BlockStatus) + WriteToFlashWithoutSectorErase(Adapter, (PUINT)(pBuff + 12), eFlash2xSectionVal, + (uiOffset + 12), BYTE_WRITE_SUPPORT); + if (BlockStatus) { - BcmRestoreBlockProtectStatus(Adapter,BlockStatus); + BcmRestoreBlockProtectStatus(Adapter, BlockStatus); BlockStatus = 0; } } else { - WriteToFlashWithoutSectorErase(Adapter,(PUINT)pBuff,eFlash2xSectionVal, - uiOffset ,MAX_RW_SIZE); + WriteToFlashWithoutSectorErase(Adapter, (PUINT)pBuff, eFlash2xSectionVal, + uiOffset, MAX_RW_SIZE); } } else { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"BCM Signature is not present in header"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "BCM Signature is not present in header"); kfree(pBuff); + return STATUS_FAILURE; } kfree(pBuff); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Corrupted the signature"); - return STATUS_SUCCESS ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Corrupted the signature"); + + return STATUS_SUCCESS; } static INT CorruptISOSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) { - PUCHAR pBuff = NULL; UINT sig = 0; UINT uiOffset = 0; Adapter->bSigCorrupted = FALSE; - if(IsSectionWritable(Adapter,eFlash2xSectionVal) != TRUE) + if (IsSectionWritable(Adapter, eFlash2xSectionVal) != TRUE) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Section is not Writable...Hence can't Corrupt signature"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Section is not Writable...Hence can't Corrupt signature"); return SECTOR_IS_NOT_WRITABLE; } pBuff = (PUCHAR)kzalloc(MAX_RW_SIZE, GFP_KERNEL); - if(pBuff == NULL) + if (pBuff == NULL) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Can't allocate memorey"); - return -ENOMEM ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Can't allocate memorey"); + return -ENOMEM; } uiOffset = 0; - BcmFlash2xBulkRead(Adapter, (PUINT)pBuff,eFlash2xSectionVal,uiOffset, MAX_RW_SIZE); + BcmFlash2xBulkRead(Adapter, (PUINT)pBuff, eFlash2xSectionVal, uiOffset, MAX_RW_SIZE); sig = *((PUINT)pBuff); - sig =ntohl(sig); + sig = ntohl(sig); - //corrupt signature + // corrupt signature *pBuff = 0; - if(sig == ISO_IMAGE_MAGIC_NUMBER) + if (sig == ISO_IMAGE_MAGIC_NUMBER) { Adapter->bSigCorrupted = TRUE; - WriteToFlashWithoutSectorErase(Adapter,(PUINT)pBuff,eFlash2xSectionVal, - uiOffset ,Adapter->ulFlashWriteSize); + WriteToFlashWithoutSectorErase(Adapter, (PUINT)pBuff, eFlash2xSectionVal, + uiOffset, Adapter->ulFlashWriteSize); } else { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"BCM Signature is not present in header"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "BCM Signature is not present in header"); kfree(pBuff); + return STATUS_FAILURE; } - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Corrupted the signature"); - BCM_DEBUG_PRINT_BUFFER(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,pBuff,MAX_RW_SIZE); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Corrupted the signature"); + BCM_DEBUG_PRINT_BUFFER(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, pBuff, MAX_RW_SIZE); kfree(pBuff); - return STATUS_SUCCESS ; + return STATUS_SUCCESS; } BOOLEAN IsNonCDLessDevice(struct bcm_mini_adapter *Adapter) { - if(Adapter->psFlash2xCSInfo->IsCDLessDeviceBootSig == NON_CDLESS_DEVICE_BOOT_SIG) + if (Adapter->psFlash2xCSInfo->IsCDLessDeviceBootSig == NON_CDLESS_DEVICE_BOOT_SIG) return TRUE; else - return FALSE ; + return FALSE; } - -- cgit v0.10.2 From a2940b635bbe6bc4b7d6156eddc92fdbe1037bd9 Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Wed, 6 Jun 2012 22:54:28 -0400 Subject: Staging: bcm: Properly format braces in nvm.c This patch cuddles braces as reported by checkpatch.pl. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/nvm.c b/drivers/staging/bcm/nvm.c index 2bb87c9..66001fc 100644 --- a/drivers/staging/bcm/nvm.c +++ b/drivers/staging/bcm/nvm.c @@ -74,20 +74,17 @@ static UCHAR ReadEEPROMStatusRegister(struct bcm_mini_adapter *Adapter) value = EEPROM_READ_STATUS_REGISTER; wrmalt(Adapter, EEPROM_CMDQ_SPI_REG, &value, sizeof(value)); - while (dwRetries != 0) - { + while (dwRetries != 0) { value = 0; uiStatus = 0; rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &uiStatus, sizeof(uiStatus)); - if (Adapter->device_removed == TRUE) - { + if (Adapter->device_removed == TRUE) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Modem has got removed hence exiting...."); break; } /* Wait for Avail bit to be set. */ - if ((uiStatus & EEPROM_READ_DATA_AVAIL) != 0) - { + if ((uiStatus & EEPROM_READ_DATA_AVAIL) != 0) { /* Clear the Avail/Full bits - which ever is set. */ value = uiStatus & (EEPROM_READ_DATA_AVAIL | EEPROM_READ_DATA_FULL); wrmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); @@ -100,8 +97,7 @@ static UCHAR ReadEEPROMStatusRegister(struct bcm_mini_adapter *Adapter) } dwRetries--; - if (dwRetries == 0) - { + if (dwRetries == 0) { rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); rdmalt(Adapter, EEPROM_SPI_Q_STATUS_REG, &value1, sizeof(value1)); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "0x3004 = %x 0x3008 = %x, retries = %d failed.\n", value, value1, MAX_EEPROM_RETRIES * RETRIES_PER_DELAY); @@ -153,12 +149,10 @@ INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, value = dwAddress | ((dwNumWords == 4) ? EEPROM_16_BYTE_PAGE_READ : EEPROM_4_BYTE_PAGE_READ); wrmalt(Adapter, EEPROM_CMDQ_SPI_REG, &value, sizeof(value)); - while (dwRetries != 0) - { + while (dwRetries != 0) { uiStatus = 0; rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &uiStatus, sizeof(uiStatus)); - if (Adapter->device_removed == TRUE) - { + if (Adapter->device_removed == TRUE) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Modem has got Removed.hence exiting from loop..."); return -ENODEV; } @@ -166,20 +160,15 @@ INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, /* If we are reading 16 bytes we want to be sure that the queue * is full before we read. In the other cases we are ok if the * queue has data available */ - if (dwNumWords == 4) - { - if ((uiStatus & EEPROM_READ_DATA_FULL) != 0) - { + if (dwNumWords == 4) { + if ((uiStatus & EEPROM_READ_DATA_FULL) != 0) { /* Clear the Avail/Full bits - which ever is set. */ value = (uiStatus & (EEPROM_READ_DATA_AVAIL | EEPROM_READ_DATA_FULL)); wrmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); break; } - } - else if (dwNumWords == 1) - { - if ((uiStatus & EEPROM_READ_DATA_AVAIL) != 0) - { + } else if (dwNumWords == 1) { + if ((uiStatus & EEPROM_READ_DATA_AVAIL) != 0) { /* We just got Avail and we have to read 32bits so we * need this sleep for Cardbus kind of devices. */ if (Adapter->chip_id == 0xBECE0210) @@ -195,8 +184,7 @@ INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, uiStatus = 0; dwRetries--; - if (dwRetries == 0) - { + if (dwRetries == 0) { value = 0; value1 = 0; rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); @@ -210,8 +198,7 @@ INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, msleep(1); } - for (dwIndex = 0; dwIndex < dwNumWords; dwIndex++) - { + for (dwIndex = 0; dwIndex < dwNumWords; dwIndex++) { /* We get only a byte at a time - from LSB to MSB. We shift it into an integer. */ pvalue = (PUCHAR)(pdwData + dwIndex); @@ -272,9 +259,7 @@ INT ReadBeceemEEPROM(struct bcm_mini_adapter *Adapter, /* A word can overlap at most over 2 pages. In that case we read the * next page too. */ if (uiByteOffset > 12) - { ReadBeceemEEPROMBulk(Adapter, uiTempOffset + MAX_RW_SIZE, (PUINT)&uiData[4], 4); - } memcpy((PUCHAR)pBuffer, (((PUCHAR)&uiData[0]) + uiByteOffset), 4); @@ -327,20 +312,16 @@ INT BeceemEEPROMBulkRead(struct bcm_mini_adapter *Adapter, UINT uiFailureRetries = 0; PUCHAR pcBuff = (PUCHAR)pBuffer; - if (uiOffset % MAX_RW_SIZE && uiBytesRemaining) - { + if (uiOffset % MAX_RW_SIZE && uiBytesRemaining) { uiTempOffset = uiOffset - (uiOffset % MAX_RW_SIZE); uiExtraBytes = uiOffset - uiTempOffset; ReadBeceemEEPROMBulk(Adapter, uiTempOffset, (PUINT)&uiData[0], 4); - if (uiBytesRemaining >= (MAX_RW_SIZE - uiExtraBytes)) - { + if (uiBytesRemaining >= (MAX_RW_SIZE - uiExtraBytes)) { memcpy(pBuffer, (((PUCHAR)&uiData[0]) + uiExtraBytes), MAX_RW_SIZE - uiExtraBytes); uiBytesRemaining -= (MAX_RW_SIZE - uiExtraBytes); uiIndex += (MAX_RW_SIZE - uiExtraBytes); uiOffset += (MAX_RW_SIZE - uiExtraBytes); - } - else - { + } else { memcpy(pBuffer, (((PUCHAR)&uiData[0]) + uiExtraBytes), uiBytesRemaining); uiIndex += uiBytesRemaining; uiOffset += uiBytesRemaining; @@ -348,57 +329,41 @@ INT BeceemEEPROMBulkRead(struct bcm_mini_adapter *Adapter, } } - while (uiBytesRemaining && uiFailureRetries != 128) - { + while (uiBytesRemaining && uiFailureRetries != 128) { if (Adapter->device_removed) - { return -1; - } - if (uiBytesRemaining >= MAX_RW_SIZE) - { + if (uiBytesRemaining >= MAX_RW_SIZE) { /* For the requests more than or equal to 16 bytes, use bulk * read function to make the access faster. * We read 4 Dwords of data */ - if (0 == ReadBeceemEEPROMBulk(Adapter, uiOffset, &uiData[0], 4)) - { + if (0 == ReadBeceemEEPROMBulk(Adapter, uiOffset, &uiData[0], 4)) { memcpy(pcBuff + uiIndex, &uiData[0], MAX_RW_SIZE); uiOffset += MAX_RW_SIZE; uiBytesRemaining -= MAX_RW_SIZE; uiIndex += MAX_RW_SIZE; - } - else - { + } else { uiFailureRetries++; mdelay(3); //sleep for a while before retry... } - } - else if (uiBytesRemaining >= 4) - { - if (0 == ReadBeceemEEPROM(Adapter, uiOffset, &uiData[0])) - { + } else if (uiBytesRemaining >= 4) { + if (0 == ReadBeceemEEPROM(Adapter, uiOffset, &uiData[0])) { memcpy(pcBuff + uiIndex, &uiData[0], 4); uiOffset += 4; uiBytesRemaining -= 4; uiIndex += 4; - } - else - { + } else { uiFailureRetries++; mdelay(3); //sleep for a while before retry... } - } - else - { // Handle the reads less than 4 bytes... + } else { + // Handle the reads less than 4 bytes... PUCHAR pCharBuff = (PUCHAR)pBuffer; pCharBuff += uiIndex; - if (0 == ReadBeceemEEPROM(Adapter, uiOffset, &uiData[0])) - { + if (0 == ReadBeceemEEPROM(Adapter, uiOffset, &uiData[0])) { memcpy(pCharBuff, &uiData[0], uiBytesRemaining); //copy only bytes requested. uiBytesRemaining = 0; - } - else - { + } else { uiFailureRetries++; mdelay(3); //sleep for a while before retry... } @@ -435,8 +400,7 @@ static INT BeceemFlashBulkRead(struct bcm_mini_adapter *Adapter, UINT uiPartOffset = 0; int bytes; - if (Adapter->device_removed) - { + if (Adapter->device_removed) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Device Got Removed"); return -ENODEV; } @@ -450,8 +414,7 @@ static INT BeceemFlashBulkRead(struct bcm_mini_adapter *Adapter, Adapter->SelectedChip = RESET_CHIP_SELECT; - if (uiOffset % MAX_RW_SIZE) - { + if (uiOffset % MAX_RW_SIZE) { BcmDoChipSelect(Adapter, uiOffset); uiPartOffset = (uiOffset & (FLASH_PART_SIZE - 1)) + GetFlashBaseAddr(Adapter); @@ -470,8 +433,7 @@ static INT BeceemFlashBulkRead(struct bcm_mini_adapter *Adapter, uiNumBytes -= uiBytesToRead; } - while (uiNumBytes) - { + while (uiNumBytes) { BcmDoChipSelect(Adapter, uiOffset); uiPartOffset = (uiOffset & (FLASH_PART_SIZE - 1)) + GetFlashBaseAddr(Adapter); @@ -539,33 +501,23 @@ static UINT BcmGetEEPROMSize(struct bcm_mini_adapter *Adapter) // get 'BECM' string which is indeed at offset 0. // BeceemEEPROMBulkRead(Adapter, &uiData, 0x0, 4); - if (uiData == BECM) - { - for (uiIndex = 2; uiIndex <= 256; uiIndex *= 2) - { + if (uiData == BECM) { + for (uiIndex = 2; uiIndex <= 256; uiIndex *= 2) { BeceemEEPROMBulkRead(Adapter, &uiData, uiIndex * 1024, 4); if (uiData == BECM) - { return uiIndex * 1024; - } } - } - else - { + } else { // // EEPROM may not be present or not programmed // uiData = 0xBABEFACE; - if (0 == BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&uiData, 0, 4, TRUE)) - { + if (0 == BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&uiData, 0, 4, TRUE)) { uiData = 0; - for (uiIndex = 2; uiIndex <= 256; uiIndex *= 2) - { + for (uiIndex = 2; uiIndex <= 256; uiIndex *= 2) { BeceemEEPROMBulkRead(Adapter, &uiData, uiIndex * 1024, 4); if (uiData == 0xBABEFACE) - { return uiIndex * 1024; - } } } } @@ -596,8 +548,7 @@ static INT FlashSectorErase(struct bcm_mini_adapter *Adapter, UINT value; int bytes; - for (iIndex = 0; iIndex < numOfSectors; iIndex++) - { + for (iIndex = 0; iIndex < numOfSectors; iIndex++) { value = 0x06000000; wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)); @@ -605,11 +556,9 @@ static INT FlashSectorErase(struct bcm_mini_adapter *Adapter, wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)); iRetries = 0; - do - { + do { value = (FLASH_CMD_STATUS_REG_READ << 24); - if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) - { + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Programing of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; } @@ -627,8 +576,7 @@ static INT FlashSectorErase(struct bcm_mini_adapter *Adapter, msleep(10); } while ((uiStatus & 0x1) && (iRetries < 400)); - if (uiStatus & 0x1) - { + if (uiStatus & 0x1) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "iRetries crossing the limit of 80000\n"); return STATUS_FAILURE; } @@ -666,37 +614,30 @@ static INT flashByteWrite(struct bcm_mini_adapter *Adapter, // if (0xFF == ulData) - { return STATUS_SUCCESS; - } // DumpDebug(NVM_RW,("flashWrite ====>\n")); value = (FLASH_CMD_WRITE_ENABLE << 24); - if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) - { + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Write enable in FLASH_SPI_CMDQ_REG register fails"); return STATUS_FAILURE; } - if (wrm(Adapter, FLASH_SPI_WRITEQ_REG, (PCHAR)&ulData, 4) < 0) - { + if (wrm(Adapter, FLASH_SPI_WRITEQ_REG, (PCHAR)&ulData, 4) < 0) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "DATA Write on FLASH_SPI_WRITEQ_REG fails"); return STATUS_FAILURE; } value = (0x02000000 | (uiOffset & 0xFFFFFF)); - if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) - { + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Programming of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; } //__udelay(950); - do - { + do { value = (FLASH_CMD_STATUS_REG_READ << 24); - if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) - { + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Programing of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; } @@ -713,8 +654,7 @@ static INT flashByteWrite(struct bcm_mini_adapter *Adapter, } while ((uiStatus & 0x1) && (iRetries > 0)); - if (uiStatus & 0x1) - { + if (uiStatus & 0x1) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Flash Write fails even after checking status for 200 times."); return STATUS_FAILURE; } @@ -754,30 +694,24 @@ static INT flashWrite(struct bcm_mini_adapter *Adapter, // make whole sector 0xFFFFFFFF. // if (!memcmp(pData, uiErasePattern, MAX_RW_SIZE)) - { return 0; - } value = (FLASH_CMD_WRITE_ENABLE << 24); - if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) - { + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Write Enable of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; } - if (wrm(Adapter, uiOffset, (PCHAR)pData, MAX_RW_SIZE) < 0) - { + if (wrm(Adapter, uiOffset, (PCHAR)pData, MAX_RW_SIZE) < 0) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Data write fails..."); return STATUS_FAILURE; } //__udelay(950); - do - { + do { value = (FLASH_CMD_STATUS_REG_READ << 24); - if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) - { + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Programing of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; } @@ -798,8 +732,7 @@ static INT flashWrite(struct bcm_mini_adapter *Adapter, msleep(1); } while ((uiStatus & 0x1) && (iRetries > 0)); - if (uiStatus & 0x1) - { + if (uiStatus & 0x1) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Flash Write fails even after checking status for 200 times."); return STATUS_FAILURE; } @@ -836,37 +769,30 @@ static INT flashByteWriteStatus(struct bcm_mini_adapter *Adapter, // if (0xFF == ulData) - { return STATUS_SUCCESS; - } // DumpDebug(NVM_RW,("flashWrite ====>\n")); value = (FLASH_CMD_WRITE_ENABLE << 24); - if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) - { + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Write enable in FLASH_SPI_CMDQ_REG register fails"); return STATUS_SUCCESS; } - if (wrm(Adapter, FLASH_SPI_WRITEQ_REG, (PCHAR)&ulData, 4) < 0) - { + if (wrm(Adapter, FLASH_SPI_WRITEQ_REG, (PCHAR)&ulData, 4) < 0) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "DATA Write on FLASH_SPI_WRITEQ_REG fails"); return STATUS_FAILURE; } value = (0x02000000 | (uiOffset & 0xFFFFFF)); - if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) - { + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Programming of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; } //msleep(1); - do - { + do { value = (FLASH_CMD_STATUS_REG_READ << 24); - if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) - { + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Programing of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; } @@ -884,8 +810,7 @@ static INT flashByteWriteStatus(struct bcm_mini_adapter *Adapter, } while ((uiStatus & 0x1) && (iRetries > 0)); - if (uiStatus & 0x1) - { + if (uiStatus & 0x1) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Flash Write fails even after checking status for 200 times."); return STATUS_FAILURE; } @@ -922,29 +847,23 @@ static INT flashWriteStatus(struct bcm_mini_adapter *Adapter, // make whole sector 0xFFFFFFFF. // if (!memcmp(pData, uiErasePattern, MAX_RW_SIZE)) - { return 0; - } value = (FLASH_CMD_WRITE_ENABLE << 24); - if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) - { + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Write Enable of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; } - if (wrm(Adapter, uiOffset, (PCHAR)pData, MAX_RW_SIZE) < 0) - { + if (wrm(Adapter, uiOffset, (PCHAR)pData, MAX_RW_SIZE) < 0) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Data write fails..."); return STATUS_FAILURE; } // __udelay(1); - do - { + do { value = (FLASH_CMD_STATUS_REG_READ << 24); - if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) - { + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Programing of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; } @@ -965,8 +884,7 @@ static INT flashWriteStatus(struct bcm_mini_adapter *Adapter, } while ((uiStatus & 0x1) && (iRetries > 0)); - if (uiStatus & 0x1) - { + if (uiStatus & 0x1) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Flash Write fails even after checking status for 200 times."); return STATUS_FAILURE; } @@ -1022,8 +940,7 @@ static ULONG BcmFlashUnProtectBlock(struct bcm_mini_adapter *Adapter, UINT uiOff // // Implemented only for 1MB Flash parts. // - if (FLASH_PART_SST25VF080B == Adapter->ulFlashID) - { + if (FLASH_PART_SST25VF080B == Adapter->ulFlashID) { // // Get Current BP status. // @@ -1043,46 +960,36 @@ static ULONG BcmFlashUnProtectBlock(struct bcm_mini_adapter *Adapter, UINT uiOff // 4 - UPPER 1/2. 5 to 7 - ALL BLOCKS // - if (ulStatus) - { - if ((uiOffset+uiLength) <= 0x80000) - { + if (ulStatus) { + if ((uiOffset+uiLength) <= 0x80000) { // // Offset comes in lower half of 1MB. Protect the upper half. // Clear BP1 and BP0 and set BP2. // ulWriteStatus |= (0x4<<2); ulWriteStatus &= ~(0x3<<2); - } - else if ((uiOffset + uiLength) <= 0xC0000) - { + } else if ((uiOffset + uiLength) <= 0xC0000) { // // Offset comes below Upper 1/4. Upper 1/4 can be protected. // Clear BP2 and set BP1 and BP0. // ulWriteStatus |= (0x3<<2); ulWriteStatus &= ~(0x1<<4); - } - else if ((uiOffset + uiLength) <= 0xE0000) - { + } else if ((uiOffset + uiLength) <= 0xE0000) { // // Offset comes below Upper 1/8. Upper 1/8 can be protected. // Clear BP2 and BP0 and set BP1 // ulWriteStatus |= (0x1<<3); ulWriteStatus &= ~(0x5<<2); - } - else if ((uiOffset + uiLength) <= 0xF0000) - { + } else if ((uiOffset + uiLength) <= 0xF0000) { // // Offset comes below Upper 1/16. Only upper 1/16 can be protected. // Set BP0 and Clear BP2,BP1. // ulWriteStatus |= (0x1<<2); ulWriteStatus &= ~(0x3<<3); - } - else - { + } else { // // Unblock all. // Clear BP2,BP1 and BP0. @@ -1158,30 +1065,22 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, // // check if the data to be written is overlapped across sectors // - if (uiOffset+uiNumBytes < uiSectBoundary) - { + if (uiOffset+uiNumBytes < uiSectBoundary) { uiNumSectTobeRead = 1; - } - else - { + } else { // Number of sectors = Last sector start address/First sector start address uiNumSectTobeRead = (uiCurrSectOffsetAddr + uiNumBytes) / Adapter->uiSectorSize; if ((uiCurrSectOffsetAddr + uiNumBytes)%Adapter->uiSectorSize) - { uiNumSectTobeRead++; - } } // Check whether Requested sector is writable or not in case of flash2x write. But if write call is // for DSD calibration, allow it without checking of sector permission - if (IsFlash2x(Adapter) && (Adapter->bAllDSDWriteAllow == FALSE)) - { + if (IsFlash2x(Adapter) && (Adapter->bAllDSDWriteAllow == FALSE)) { index = 0; uiTemp = uiNumSectTobeRead; - while (uiTemp) - { - if (IsOffsetWritable(Adapter, uiOffsetFromSectStart + index * Adapter->uiSectorSize) == FALSE) - { + while (uiTemp) { + if (IsOffsetWritable(Adapter, uiOffsetFromSectStart + index * Adapter->uiSectorSize) == FALSE) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Sector Starting at offset <0X%X> is not writable", (uiOffsetFromSectStart + index * Adapter->uiSectorSize)); Status = SECTOR_IS_NOT_WRITABLE; @@ -1192,8 +1091,7 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, } } Adapter->SelectedChip = RESET_CHIP_SELECT; - while (uiNumSectTobeRead) - { + while (uiNumSectTobeRead) { // do_gettimeofday(&tv1); // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "\nTime In start of write :%ld ms\n",(tv1.tv_sec *1000 + tv1.tv_usec /1000)); uiPartOffset = (uiSectAlignAddr & (FLASH_PART_SIZE - 1)) + GetFlashBaseAddr(Adapter); @@ -1203,8 +1101,7 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, if (0 != BeceemFlashBulkRead(Adapter, (PUINT)pTempBuff, uiOffsetFromSectStart, - Adapter->uiSectorSize)) - { + Adapter->uiSectorSize)) { Status = -1; goto BeceemFlashBulkWrite_EXIT; } @@ -1214,36 +1111,28 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, ulStatus = BcmFlashUnProtectBlock(Adapter, uiSectAlignAddr, Adapter->uiSectorSize); - if (uiNumSectTobeRead > 1) - { + if (uiNumSectTobeRead > 1) { memcpy(&pTempBuff[uiCurrSectOffsetAddr], pcBuffer, uiSectBoundary - (uiSectAlignAddr + uiCurrSectOffsetAddr)); pcBuffer += ((uiSectBoundary - (uiSectAlignAddr + uiCurrSectOffsetAddr))); uiNumBytes -= (uiSectBoundary - (uiSectAlignAddr + uiCurrSectOffsetAddr)); - } - else - { + } else { memcpy(&pTempBuff[uiCurrSectOffsetAddr], pcBuffer, uiNumBytes); } if (IsFlash2x(Adapter)) - { SaveHeaderIfPresent(Adapter, (PUCHAR)pTempBuff, uiOffsetFromSectStart); - } FlashSectorErase(Adapter, uiPartOffset, 1); // do_gettimeofday(&te); // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken by Erase :%ld ms\n", (te.tv_sec *1000 + te.tv_usec/1000) - (tr.tv_sec *1000 + tr.tv_usec/1000)); - for (uiIndex = 0; uiIndex < Adapter->uiSectorSize; uiIndex += Adapter->ulFlashWriteSize) - { - if (Adapter->device_removed) - { + for (uiIndex = 0; uiIndex < Adapter->uiSectorSize; uiIndex += Adapter->ulFlashWriteSize) { + if (Adapter->device_removed) { Status = -1; goto BeceemFlashBulkWrite_EXIT; } - if (STATUS_SUCCESS != (*Adapter->fpFlashWrite)(Adapter, uiPartOffset + uiIndex, (&pTempBuff[uiIndex]))) - { + if (STATUS_SUCCESS != (*Adapter->fpFlashWrite)(Adapter, uiPartOffset + uiIndex, (&pTempBuff[uiIndex]))) { Status = -1; goto BeceemFlashBulkWrite_EXIT; } @@ -1251,31 +1140,21 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, // do_gettimeofday(&tw); // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken in Write to Flash :%ld ms\n", (tw.tv_sec *1000 + tw.tv_usec/1000) - (te.tv_sec *1000 + te.tv_usec/1000)); - for (uiIndex = 0; uiIndex < Adapter->uiSectorSize; uiIndex += MAX_RW_SIZE) - { - if (STATUS_SUCCESS == BeceemFlashBulkRead(Adapter, (PUINT)ucReadBk, uiOffsetFromSectStart + uiIndex, MAX_RW_SIZE)) - { - if (Adapter->ulFlashWriteSize == 1) - { + for (uiIndex = 0; uiIndex < Adapter->uiSectorSize; uiIndex += MAX_RW_SIZE) { + if (STATUS_SUCCESS == BeceemFlashBulkRead(Adapter, (PUINT)ucReadBk, uiOffsetFromSectStart + uiIndex, MAX_RW_SIZE)) { + if (Adapter->ulFlashWriteSize == 1) { UINT uiReadIndex = 0; - for (uiReadIndex = 0; uiReadIndex < 16; uiReadIndex++) - { - if (ucReadBk[uiReadIndex] != pTempBuff[uiIndex + uiReadIndex]) - { - if (STATUS_SUCCESS != (*Adapter->fpFlashWriteWithStatusCheck)(Adapter, uiPartOffset + uiIndex + uiReadIndex, &pTempBuff[uiIndex+uiReadIndex])) - { + for (uiReadIndex = 0; uiReadIndex < 16; uiReadIndex++) { + if (ucReadBk[uiReadIndex] != pTempBuff[uiIndex + uiReadIndex]) { + if (STATUS_SUCCESS != (*Adapter->fpFlashWriteWithStatusCheck)(Adapter, uiPartOffset + uiIndex + uiReadIndex, &pTempBuff[uiIndex+uiReadIndex])) { Status = STATUS_FAILURE; goto BeceemFlashBulkWrite_EXIT; } } } - } - else - { - if (memcmp(ucReadBk, &pTempBuff[uiIndex], MAX_RW_SIZE)) - { - if (STATUS_SUCCESS != (*Adapter->fpFlashWriteWithStatusCheck)(Adapter, uiPartOffset + uiIndex, &pTempBuff[uiIndex])) - { + } else { + if (memcmp(ucReadBk, &pTempBuff[uiIndex], MAX_RW_SIZE)) { + if (STATUS_SUCCESS != (*Adapter->fpFlashWriteWithStatusCheck)(Adapter, uiPartOffset + uiIndex, &pTempBuff[uiIndex])) { Status = STATUS_FAILURE; goto BeceemFlashBulkWrite_EXIT; } @@ -1285,8 +1164,7 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, } // do_gettimeofday(&twv); // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken in Write to Flash verification :%ld ms\n", (twv.tv_sec *1000 + twv.tv_usec/1000) - (tw.tv_sec *1000 + tw.tv_usec/1000)); - if (ulStatus) - { + if (ulStatus) { BcmRestoreBlockProtectStatus(Adapter, ulStatus); ulStatus = 0; } @@ -1305,9 +1183,7 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, // BeceemFlashBulkWrite_EXIT : if (ulStatus) - { BcmRestoreBlockProtectStatus(Adapter, ulStatus); - } kfree(pTempBuff); @@ -1369,28 +1245,20 @@ static INT BeceemFlashBulkWriteStatus(struct bcm_mini_adapter *Adapter, // // check if the data to be written is overlapped across sectors // - if (uiOffset+uiNumBytes < uiSectBoundary) - { + if (uiOffset+uiNumBytes < uiSectBoundary) { uiNumSectTobeRead = 1; - } - else - { + } else { // Number of sectors = Last sector start address/First sector start address uiNumSectTobeRead = (uiCurrSectOffsetAddr + uiNumBytes) / Adapter->uiSectorSize; if ((uiCurrSectOffsetAddr + uiNumBytes)%Adapter->uiSectorSize) - { uiNumSectTobeRead++; - } } - if (IsFlash2x(Adapter) && (Adapter->bAllDSDWriteAllow == FALSE)) - { + if (IsFlash2x(Adapter) && (Adapter->bAllDSDWriteAllow == FALSE)) { index = 0; uiTemp = uiNumSectTobeRead; - while (uiTemp) - { - if (IsOffsetWritable(Adapter, uiOffsetFromSectStart + index * Adapter->uiSectorSize) == FALSE) - { + while (uiTemp) { + if (IsOffsetWritable(Adapter, uiOffsetFromSectStart + index * Adapter->uiSectorSize) == FALSE) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Sector Starting at offset <0X%x> is not writable", (uiOffsetFromSectStart + index * Adapter->uiSectorSize)); Status = SECTOR_IS_NOT_WRITABLE; @@ -1402,63 +1270,49 @@ static INT BeceemFlashBulkWriteStatus(struct bcm_mini_adapter *Adapter, } Adapter->SelectedChip = RESET_CHIP_SELECT; - while (uiNumSectTobeRead) - { + while (uiNumSectTobeRead) { uiPartOffset = (uiSectAlignAddr & (FLASH_PART_SIZE - 1)) + GetFlashBaseAddr(Adapter); BcmDoChipSelect(Adapter, uiSectAlignAddr); if (0 != BeceemFlashBulkRead(Adapter, (PUINT)pTempBuff, uiOffsetFromSectStart, - Adapter->uiSectorSize)) - { + Adapter->uiSectorSize)) { Status = -1; goto BeceemFlashBulkWriteStatus_EXIT; } ulStatus = BcmFlashUnProtectBlock(Adapter, uiOffsetFromSectStart, Adapter->uiSectorSize); - if (uiNumSectTobeRead > 1) - { + if (uiNumSectTobeRead > 1) { memcpy(&pTempBuff[uiCurrSectOffsetAddr], pcBuffer, uiSectBoundary - (uiSectAlignAddr + uiCurrSectOffsetAddr)); pcBuffer += ((uiSectBoundary - (uiSectAlignAddr + uiCurrSectOffsetAddr))); uiNumBytes -= (uiSectBoundary - (uiSectAlignAddr + uiCurrSectOffsetAddr)); - } - else - { + } else { memcpy(&pTempBuff[uiCurrSectOffsetAddr], pcBuffer, uiNumBytes); } if (IsFlash2x(Adapter)) - { SaveHeaderIfPresent(Adapter, (PUCHAR)pTempBuff, uiOffsetFromSectStart); - } FlashSectorErase(Adapter, uiPartOffset, 1); - for (uiIndex = 0; uiIndex < Adapter->uiSectorSize; uiIndex += Adapter->ulFlashWriteSize) - { - if (Adapter->device_removed) - { + for (uiIndex = 0; uiIndex < Adapter->uiSectorSize; uiIndex += Adapter->ulFlashWriteSize) { + if (Adapter->device_removed) { Status = -1; goto BeceemFlashBulkWriteStatus_EXIT; } - if (STATUS_SUCCESS != (*Adapter->fpFlashWriteWithStatusCheck)(Adapter, uiPartOffset+uiIndex, &pTempBuff[uiIndex])) - { + if (STATUS_SUCCESS != (*Adapter->fpFlashWriteWithStatusCheck)(Adapter, uiPartOffset+uiIndex, &pTempBuff[uiIndex])) { Status = -1; goto BeceemFlashBulkWriteStatus_EXIT; } } - if (bVerify) - { - for (uiIndex = 0; uiIndex < Adapter->uiSectorSize; uiIndex += MAX_RW_SIZE) - { - if (STATUS_SUCCESS == BeceemFlashBulkRead(Adapter, (PUINT)ucReadBk, uiOffsetFromSectStart + uiIndex, MAX_RW_SIZE)) - { - if (memcmp(ucReadBk, &pTempBuff[uiIndex], MAX_RW_SIZE)) - { + if (bVerify) { + for (uiIndex = 0; uiIndex < Adapter->uiSectorSize; uiIndex += MAX_RW_SIZE) { + if (STATUS_SUCCESS == BeceemFlashBulkRead(Adapter, (PUINT)ucReadBk, uiOffsetFromSectStart + uiIndex, MAX_RW_SIZE)) { + if (memcmp(ucReadBk, &pTempBuff[uiIndex], MAX_RW_SIZE)) { Status = STATUS_FAILURE; goto BeceemFlashBulkWriteStatus_EXIT; } @@ -1466,8 +1320,7 @@ static INT BeceemFlashBulkWriteStatus(struct bcm_mini_adapter *Adapter, } } - if (ulStatus) - { + if (ulStatus) { BcmRestoreBlockProtectStatus(Adapter, ulStatus); ulStatus = 0; } @@ -1483,9 +1336,7 @@ static INT BeceemFlashBulkWriteStatus(struct bcm_mini_adapter *Adapter, // BeceemFlashBulkWriteStatus_EXIT : if (ulStatus) - { BcmRestoreBlockProtectStatus(Adapter, ulStatus); - } kfree(pTempBuff); Adapter->SelectedChip = RESET_CHIP_SELECT; @@ -1516,29 +1367,23 @@ INT PropagateCalParamsFromEEPROMToMemory(struct bcm_mini_adapter *Adapter) INT Status = 0; if (pBuff == NULL) - { return -1; - } - if (0 != BeceemEEPROMBulkRead(Adapter, &uiEepromSize, EEPROM_SIZE_OFFSET, 4)) - { + if (0 != BeceemEEPROMBulkRead(Adapter, &uiEepromSize, EEPROM_SIZE_OFFSET, 4)) { kfree(pBuff); return -1; } uiEepromSize >>= 16; - if (uiEepromSize > 1024 * 1024) - { + if (uiEepromSize > 1024 * 1024) { kfree(pBuff); return -1; } uiBytesToCopy = MIN(BUFFER_4K, uiEepromSize); - while (uiBytesToCopy) - { - if (0 != BeceemEEPROMBulkRead(Adapter, (PUINT)pBuff, uiCalStartAddr, uiBytesToCopy)) - { + while (uiBytesToCopy) { + if (0 != BeceemEEPROMBulkRead(Adapter, (PUINT)pBuff, uiCalStartAddr, uiBytesToCopy)) { Status = -1; break; } @@ -1591,9 +1436,8 @@ INT PropagateCalParamsFromFlashToMemory(struct bcm_mini_adapter *Adapter) wrmalt(Adapter, EEPROM_CAL_DATA_INTERNAL_LOC - 8, &value, sizeof(value)); if (0 != BeceemNVMRead(Adapter, &uiEepromSize, EEPROM_SIZE_OFFSET, 4)) - { return -1; - } + uiEepromSize = ntohl(uiEepromSize); uiEepromSize >>= 16; @@ -1603,16 +1447,13 @@ INT PropagateCalParamsFromFlashToMemory(struct bcm_mini_adapter *Adapter) uiEepromSize -= EEPROM_CALPARAM_START; if (uiEepromSize > 1024 * 1024) - { return -1; - } pBuff = kmalloc(uiEepromSize, GFP_KERNEL); if (pBuff == NULL) return -1; - if (0 != BeceemNVMRead(Adapter, (PUINT)pBuff, uiCalStartAddr, uiEepromSize)) - { + if (0 != BeceemNVMRead(Adapter, (PUINT)pBuff, uiCalStartAddr, uiEepromSize)) { kfree(pBuff); return -1; } @@ -1621,11 +1462,9 @@ INT PropagateCalParamsFromFlashToMemory(struct bcm_mini_adapter *Adapter) uiBytesToCopy = MIN(BUFFER_4K, uiEepromSize); - while (uiBytesToCopy) - { + while (uiBytesToCopy) { Status = wrm(Adapter, uiMemoryLoc, (PCHAR)pPtr, uiBytesToCopy); - if (Status) - { + if (Status) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "wrm failed with status :%d", Status); break; } @@ -1665,53 +1504,41 @@ static INT BeceemEEPROMReadBackandVerify(struct bcm_mini_adapter *Adapter, UINT uiData = 0; UINT auiData[4] = {0}; - while (uiNumBytes) - { + while (uiNumBytes) { if (Adapter->device_removed) - { return -1; - } - if (uiNumBytes >= MAX_RW_SIZE) - { // for the requests more than or equal to MAX_RW_SIZE bytes, use bulk read function to make the access faster. + if (uiNumBytes >= MAX_RW_SIZE) { + // for the requests more than or equal to MAX_RW_SIZE bytes, use bulk read function to make the access faster. BeceemEEPROMBulkRead(Adapter, &auiData[0], uiOffset, MAX_RW_SIZE); - if (memcmp(&pBuffer[uiIndex], &auiData[0], MAX_RW_SIZE)) - { + if (memcmp(&pBuffer[uiIndex], &auiData[0], MAX_RW_SIZE)) { // re-write BeceemEEPROMBulkWrite(Adapter, (PUCHAR)(pBuffer + uiIndex), uiOffset, MAX_RW_SIZE, FALSE); mdelay(3); BeceemEEPROMBulkRead(Adapter, &auiData[0], uiOffset, MAX_RW_SIZE); if (memcmp(&pBuffer[uiIndex], &auiData[0], MAX_RW_SIZE)) - { return -1; - } } uiOffset += MAX_RW_SIZE; uiNumBytes -= MAX_RW_SIZE; uiIndex += 4; - } - else if (uiNumBytes >= 4) - { + } else if (uiNumBytes >= 4) { BeceemEEPROMBulkRead(Adapter, &uiData, uiOffset, 4); - if (uiData != pBuffer[uiIndex]) - { + if (uiData != pBuffer[uiIndex]) { // re-write BeceemEEPROMBulkWrite(Adapter, (PUCHAR)(pBuffer + uiIndex), uiOffset, 4, FALSE); mdelay(3); BeceemEEPROMBulkRead(Adapter, &uiData, uiOffset, 4); if (uiData != pBuffer[uiIndex]) - { return -1; - } } uiOffset += 4; uiNumBytes -= 4; uiIndex++; - } - else - { // Handle the reads less than 4 bytes... + } else { + // Handle the reads less than 4 bytes... uiData = 0; memcpy(&uiData, ((PUCHAR)pBuffer) + (uiIndex * sizeof(UINT)), uiNumBytes); BeceemEEPROMBulkRead(Adapter, &uiRdbk, uiOffset, 4); @@ -1726,8 +1553,8 @@ static INT BeceemEEPROMReadBackandVerify(struct bcm_mini_adapter *Adapter, return 0; } -static VOID BcmSwapWord(UINT *ptr1) { - +static VOID BcmSwapWord(UINT *ptr1) +{ UINT tempval = (UINT)*ptr1; char *ptr2 = (char *)&tempval; char *ptr = (char *)ptr1; @@ -1807,11 +1634,9 @@ static INT BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[] * may take time. We should wait till the Empty bit is set. */ uiStatus = 0; rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &uiStatus, sizeof(uiStatus)); - while ((uiStatus & EEPROM_WRITE_QUEUE_EMPTY) == 0) - { + while ((uiStatus & EEPROM_WRITE_QUEUE_EMPTY) == 0) { uiRetries--; - if (uiRetries == 0) - { + if (uiRetries == 0) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "0x0f003004 = %x, %d retries failed.\n", uiStatus, MAX_EEPROM_RETRIES * RETRIES_PER_DELAY); return STATUS_FAILURE; } @@ -1821,15 +1646,13 @@ static INT BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[] uiStatus = 0; rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &uiStatus, sizeof(uiStatus)); - if (Adapter->device_removed == TRUE) - { + if (Adapter->device_removed == TRUE) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Modem got removed hence exiting from loop...."); return -ENODEV; } } - if (uiRetries != 0) - { + if (uiRetries != 0) { /* Clear the ones that are set - either, Empty/Full/Avail bits */ value = (uiStatus & (EEPROM_WRITE_QUEUE_EMPTY | EEPROM_WRITE_QUEUE_AVAIL | EEPROM_WRITE_QUEUE_FULL)); wrmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); @@ -1842,22 +1665,18 @@ static INT BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[] * means the previous write to the EEPROM has completed. */ uiRetries = MAX_EEPROM_RETRIES * RETRIES_PER_DELAY; uiEpromStatus = 0; - while (uiRetries != 0) - { + while (uiRetries != 0) { uiEpromStatus = ReadEEPROMStatusRegister(Adapter); - if (Adapter->device_removed == TRUE) - { + if (Adapter->device_removed == TRUE) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Modem has got removed hence exiting from loop..."); return -ENODEV; } - if ((EEPROM_STATUS_REG_WRITE_BUSY & uiEpromStatus) == 0) - { + if ((EEPROM_STATUS_REG_WRITE_BUSY & uiEpromStatus) == 0) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "EEPROM status register = %x tries = %d\n", uiEpromStatus, (MAX_EEPROM_RETRIES * RETRIES_PER_DELAY - uiRetries)); return STATUS_SUCCESS; } uiRetries--; - if (uiRetries == 0) - { + if (uiRetries == 0) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "0x0f003004 = %x, for EEPROM status read %d retries failed.\n", uiEpromStatus, MAX_EEPROM_RETRIES * RETRIES_PER_DELAY); return STATUS_FAILURE; } @@ -1900,15 +1719,13 @@ INT BeceemEEPROMBulkWrite(struct bcm_mini_adapter *Adapter, // PUINT puiBuffer = (PUINT)pBuffer; // INT value; - if (uiOffset % MAX_RW_SIZE && uiBytesToCopy) - { + if (uiOffset % MAX_RW_SIZE && uiBytesToCopy) { uiTempOffset = uiOffset - (uiOffset % MAX_RW_SIZE); uiExtraBytes = uiOffset - uiTempOffset; BeceemEEPROMBulkRead(Adapter, &uiData[0], uiTempOffset, MAX_RW_SIZE); - if (uiBytesToCopy >= (16 - uiExtraBytes)) - { + if (uiBytesToCopy >= (16 - uiExtraBytes)) { memcpy((((PUCHAR)&uiData[0]) + uiExtraBytes), pBuffer, MAX_RW_SIZE - uiExtraBytes); if (STATUS_FAILURE == BeceemEEPROMWritePage(Adapter, uiData, uiTempOffset)) @@ -1917,9 +1734,7 @@ INT BeceemEEPROMBulkWrite(struct bcm_mini_adapter *Adapter, uiBytesToCopy -= (MAX_RW_SIZE - uiExtraBytes); uiIndex += (MAX_RW_SIZE - uiExtraBytes); uiOffset += (MAX_RW_SIZE - uiExtraBytes); - } - else - { + } else { memcpy((((PUCHAR)&uiData[0]) + uiExtraBytes), pBuffer, uiBytesToCopy); if (STATUS_FAILURE == BeceemEEPROMWritePage(Adapter, uiData, uiTempOffset)) @@ -1931,24 +1746,18 @@ INT BeceemEEPROMBulkWrite(struct bcm_mini_adapter *Adapter, } } - while (uiBytesToCopy) - { + while (uiBytesToCopy) { if (Adapter->device_removed) - { return -1; - } - if (uiBytesToCopy >= MAX_RW_SIZE) - { + if (uiBytesToCopy >= MAX_RW_SIZE) { if (STATUS_FAILURE == BeceemEEPROMWritePage(Adapter, (PUINT) &pBuffer[uiIndex], uiOffset)) return STATUS_FAILURE; uiIndex += MAX_RW_SIZE; uiOffset += MAX_RW_SIZE; uiBytesToCopy -= MAX_RW_SIZE; - } - else - { + } else { // // To program non 16byte aligned data, read 16byte and then update. // @@ -1992,10 +1801,8 @@ INT BeceemNVMRead(struct bcm_mini_adapter *Adapter, UINT uiTemp = 0, value; #endif - if (Adapter->eNVMType == NVM_FLASH) - { - if (Adapter->bFlashRawRead == FALSE) - { + if (Adapter->eNVMType == NVM_FLASH) { + if (Adapter->bFlashRawRead == FALSE) { if (IsSectionExistInVendorInfo(Adapter, Adapter->eActiveDSD)) return vendorextnReadSection(Adapter, (PUCHAR)pBuffer, Adapter->eActiveDSD, uiOffset, uiNumBytes); @@ -2014,16 +1821,12 @@ INT BeceemNVMRead(struct bcm_mini_adapter *Adapter, uiNumBytes); wrmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); #endif - } - else if (Adapter->eNVMType == NVM_EEPROM) - { + } else if (Adapter->eNVMType == NVM_EEPROM) { Status = BeceemEEPROMBulkRead(Adapter, pBuffer, uiOffset, uiNumBytes); - } - else - { + } else { Status = -1; } @@ -2063,12 +1866,10 @@ INT BeceemNVMWrite(struct bcm_mini_adapter *Adapter, UINT uiFlashOffset = 0; - if (Adapter->eNVMType == NVM_FLASH) - { + if (Adapter->eNVMType == NVM_FLASH) { if (IsSectionExistInVendorInfo(Adapter, Adapter->eActiveDSD)) Status = vendorextnWriteSection(Adapter, (PUCHAR)pBuffer, Adapter->eActiveDSD, uiOffset, uiNumBytes, bVerify); - else - { + else { uiFlashOffset = uiOffset + Adapter->ulFlashCalStart; #if defined(BCM_SHM_INTERFACE) && !defined(FLASH_DIRECT_ACCESS) @@ -2079,63 +1880,47 @@ INT BeceemNVMWrite(struct bcm_mini_adapter *Adapter, wrmalt(Adapter, 0x0f000C80, &value, sizeof(value)); if (Adapter->bStatusWrite == TRUE) - { Status = BeceemFlashBulkWriteStatus(Adapter, pBuffer, uiFlashOffset, uiNumBytes , bVerify); - } else - { Status = BeceemFlashBulkWrite(Adapter, pBuffer, uiFlashOffset, uiNumBytes, bVerify); - } #endif } - if (uiOffset >= EEPROM_CALPARAM_START) - { + if (uiOffset >= EEPROM_CALPARAM_START) { uiMemoryLoc += (uiOffset - EEPROM_CALPARAM_START); - while (uiNumBytes) - { - if (uiNumBytes > BUFFER_4K) - { + while (uiNumBytes) { + if (uiNumBytes > BUFFER_4K) { wrm(Adapter, (uiMemoryLoc+uiIndex), (PCHAR)(pBuffer + (uiIndex / 4)), BUFFER_4K); uiNumBytes -= BUFFER_4K; uiIndex += BUFFER_4K; - } - else - { + } else { wrm(Adapter, uiMemoryLoc+uiIndex, (PCHAR)(pBuffer + (uiIndex / 4)), uiNumBytes); uiNumBytes = 0; break; } } - } - else - { - if ((uiOffset + uiNumBytes) > EEPROM_CALPARAM_START) - { + } else { + if ((uiOffset + uiNumBytes) > EEPROM_CALPARAM_START) { ULONG ulBytesTobeSkipped = 0; PUCHAR pcBuffer = (PUCHAR)pBuffer; // char pointer to take care of odd byte cases. uiNumBytes -= (EEPROM_CALPARAM_START - uiOffset); ulBytesTobeSkipped += (EEPROM_CALPARAM_START - uiOffset); uiOffset += (EEPROM_CALPARAM_START - uiOffset); - while (uiNumBytes) - { - if (uiNumBytes > BUFFER_4K) - { + while (uiNumBytes) { + if (uiNumBytes > BUFFER_4K) { wrm(Adapter, uiMemoryLoc + uiIndex, (PCHAR)&pcBuffer[ulBytesTobeSkipped + uiIndex], BUFFER_4K); uiNumBytes -= BUFFER_4K; uiIndex += BUFFER_4K; - } - else - { + } else { wrm(Adapter, uiMemoryLoc + uiIndex, (PCHAR)&pcBuffer[ulBytesTobeSkipped + uiIndex], uiNumBytes); uiNumBytes = 0; break; @@ -2145,21 +1930,15 @@ INT BeceemNVMWrite(struct bcm_mini_adapter *Adapter, } // restore the values. wrmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); - } - else if (Adapter->eNVMType == NVM_EEPROM) - { + } else if (Adapter->eNVMType == NVM_EEPROM) { Status = BeceemEEPROMBulkWrite(Adapter, (PUCHAR)pBuffer, uiOffset, uiNumBytes, bVerify); if (bVerify) - { Status = BeceemEEPROMReadBackandVerify(Adapter, (PUINT)pBuffer, uiOffset, uiNumBytes); - } - } - else - { + } else { Status = -1; } return Status; @@ -2199,12 +1978,9 @@ INT BcmUpdateSectorSize(struct bcm_mini_adapter *Adapter, UINT uiSectorSize) uiSectorSig = ntohl(sFlashCsInfo.FlashSectorSizeSig); uiCurrentSectorSize = ntohl(sFlashCsInfo.FlashSectorSize); - if (uiSectorSig == FLASH_SECTOR_SIZE_SIG) - { - if ((uiCurrentSectorSize <= MAX_SECTOR_SIZE) && (uiCurrentSectorSize >= MIN_SECTOR_SIZE)) - { - if (uiSectorSize == uiCurrentSectorSize) - { + if (uiSectorSig == FLASH_SECTOR_SIZE_SIG) { + if ((uiCurrentSectorSize <= MAX_SECTOR_SIZE) && (uiCurrentSectorSize >= MIN_SECTOR_SIZE)) { + if (uiSectorSize == uiCurrentSectorSize) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Provided sector size is same as programmed in Flash"); Status = STATUS_SUCCESS; goto Restore; @@ -2212,8 +1988,7 @@ INT BcmUpdateSectorSize(struct bcm_mini_adapter *Adapter, UINT uiSectorSize) } } - if ((uiSectorSize <= MAX_SECTOR_SIZE) && (uiSectorSize >= MIN_SECTOR_SIZE)) - { + if ((uiSectorSize <= MAX_SECTOR_SIZE) && (uiSectorSize >= MIN_SECTOR_SIZE)) { sFlashCsInfo.FlashSectorSize = htonl(uiSectorSize); sFlashCsInfo.FlashSectorSizeSig = htonl(FLASH_SECTOR_SIZE_SIG); @@ -2251,47 +2026,32 @@ static UINT BcmGetFlashSectorSize(struct bcm_mini_adapter *Adapter, UINT FlashSe if (Adapter->bSectorSizeOverride && (Adapter->uiSectorSizeInCFG <= MAX_SECTOR_SIZE && - Adapter->uiSectorSizeInCFG >= MIN_SECTOR_SIZE)) - { + Adapter->uiSectorSizeInCFG >= MIN_SECTOR_SIZE)) { Adapter->uiSectorSize = Adapter->uiSectorSizeInCFG; - } - else - { + } else { uiSectorSig = FlashSectorSizeSig; - if (uiSectorSig == FLASH_SECTOR_SIZE_SIG) - { + if (uiSectorSig == FLASH_SECTOR_SIZE_SIG) { uiSectorSize = FlashSectorSize; // // If the sector size stored in the FLASH makes sense then use it. // - if (uiSectorSize <= MAX_SECTOR_SIZE && uiSectorSize >= MIN_SECTOR_SIZE) - { + if (uiSectorSize <= MAX_SECTOR_SIZE && uiSectorSize >= MIN_SECTOR_SIZE) { Adapter->uiSectorSize = uiSectorSize; - } - //No valid size in FLASH, check if Config file has it. - else if (Adapter->uiSectorSizeInCFG <= MAX_SECTOR_SIZE && - Adapter->uiSectorSizeInCFG >= MIN_SECTOR_SIZE) - { + } else if (Adapter->uiSectorSizeInCFG <= MAX_SECTOR_SIZE && + Adapter->uiSectorSizeInCFG >= MIN_SECTOR_SIZE) { + //No valid size in FLASH, check if Config file has it. Adapter->uiSectorSize = Adapter->uiSectorSizeInCFG; - } - // Init to Default, if none of the above works. - else - { + } else { + // Init to Default, if none of the above works. Adapter->uiSectorSize = DEFAULT_SECTOR_SIZE; } - } - else - { + } else { if (Adapter->uiSectorSizeInCFG <= MAX_SECTOR_SIZE && Adapter->uiSectorSizeInCFG >= MIN_SECTOR_SIZE) - { Adapter->uiSectorSize = Adapter->uiSectorSizeInCFG; - } else - { Adapter->uiSectorSize = DEFAULT_SECTOR_SIZE; - } } } @@ -2353,16 +2113,11 @@ INT BcmInitNVM(struct bcm_mini_adapter *ps_adapter) BcmValidateNvmType(ps_adapter); BcmInitEEPROMQueues(ps_adapter); - if (ps_adapter->eNVMType == NVM_AUTODETECT) - { + if (ps_adapter->eNVMType == NVM_AUTODETECT) { ps_adapter->eNVMType = BcmGetNvmType(ps_adapter); if (ps_adapter->eNVMType == NVM_UNKNOWN) - { BCM_DEBUG_PRINT(ps_adapter, DBG_TYPE_PRINTK, 0, 0, "NVM Type is unknown!!\n"); - } - } - else if (ps_adapter->eNVMType == NVM_FLASH) - { + } else if (ps_adapter->eNVMType == NVM_FLASH) { BcmGetFlashCSInfo(ps_adapter); } @@ -2384,13 +2139,10 @@ INT BcmInitNVM(struct bcm_mini_adapter *ps_adapter) static INT BcmGetNvmSize(struct bcm_mini_adapter *Adapter) { if (Adapter->eNVMType == NVM_EEPROM) - { Adapter->uiNVMDSDSize = BcmGetEEPROMSize(Adapter); - } else if (Adapter->eNVMType == NVM_FLASH) - { Adapter->uiNVMDSDSize = BcmGetFlashSize(Adapter); - } + return 0; } @@ -2416,9 +2168,7 @@ static VOID BcmValidateNvmType(struct bcm_mini_adapter *Adapter) if (Adapter->eNVMType == NVM_FLASH && Adapter->chip_id < 0xBECE3300) - { Adapter->eNVMType = NVM_AUTODETECT; - } } //----------------------------------------------------------------------------- @@ -2458,29 +2208,25 @@ static ULONG BcmReadFlashRDID(struct bcm_mini_adapter *Adapter) INT BcmAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter) { - if (psAdapter == NULL) - { + if (psAdapter == NULL) { BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_PRINTK, 0, 0, "Adapter structure point is NULL"); return -EINVAL; } psAdapter->psFlashCSInfo = (PFLASH_CS_INFO)kzalloc(sizeof(FLASH_CS_INFO), GFP_KERNEL); - if (psAdapter->psFlashCSInfo == NULL) - { + if (psAdapter->psFlashCSInfo == NULL) { BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_PRINTK, 0, 0, "Can't Allocate memory for Flash 1.x"); return -ENOMEM; } psAdapter->psFlash2xCSInfo = (PFLASH2X_CS_INFO)kzalloc(sizeof(FLASH2X_CS_INFO), GFP_KERNEL); - if (psAdapter->psFlash2xCSInfo == NULL) - { + if (psAdapter->psFlash2xCSInfo == NULL) { BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_PRINTK, 0, 0, "Can't Allocate memory for Flash 2.x"); kfree(psAdapter->psFlashCSInfo); return -ENOMEM; } psAdapter->psFlash2xVendorInfo = (PFLASH2X_VENDORSPECIFIC_INFO)kzalloc(sizeof(FLASH2X_VENDORSPECIFIC_INFO), GFP_KERNEL); - if (psAdapter->psFlash2xVendorInfo == NULL) - { + if (psAdapter->psFlash2xVendorInfo == NULL) { BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_PRINTK, 0, 0, "Can't Allocate Vendor Info Memory for Flash 2.x"); kfree(psAdapter->psFlashCSInfo); kfree(psAdapter->psFlash2xCSInfo); @@ -2492,8 +2238,7 @@ INT BcmAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter) INT BcmDeAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter) { - if (psAdapter == NULL) - { + if (psAdapter == NULL) { BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_PRINTK, 0, 0, "Adapter structure point is NULL"); return -EINVAL; } @@ -2557,10 +2302,8 @@ static INT BcmDumpFlash2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo, struct bc BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Sector Access Bit Map is Defined as :"); for (Index = 0; Index < (FLASH2X_TOTAL_SIZE / (DEFAULT_SECTOR_SIZE * 16)); Index++) - { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "SectorAccessBitMap[%d] :0x%x", Index, (psFlash2xCSInfo->SectorAccessBitMap[Index])); - } return STATUS_SUCCESS; } @@ -2617,9 +2360,8 @@ static INT ConvertEndianOf2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo) psFlash2xCSInfo->OffsetFromZeroForVSA2End = ntohl(psFlash2xCSInfo->OffsetFromZeroForVSA2End); for (Index = 0; Index < (FLASH2X_TOTAL_SIZE / (DEFAULT_SECTOR_SIZE * 16)); Index++) - { psFlash2xCSInfo->SectorAccessBitMap[Index] = ntohl(psFlash2xCSInfo->SectorAccessBitMap[Index]); - } + return STATUS_SUCCESS; } @@ -2676,10 +2418,8 @@ static VOID UpdateVendorInfo(struct bcm_mini_adapter *Adapter) return; i = 0; - while (i < TOTAL_SECTIONS) - { - if (!(Adapter->psFlash2xVendorInfo->VendorSection[i].AccessFlags & FLASH2X_SECTION_PRESENT)) - { + while (i < TOTAL_SECTIONS) { + if (!(Adapter->psFlash2xVendorInfo->VendorSection[i].AccessFlags & FLASH2X_SECTION_PRESENT)) { i++; continue; } @@ -2688,53 +2428,52 @@ static VOID UpdateVendorInfo(struct bcm_mini_adapter *Adapter) uiSizeSection = (Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionEnd - Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart); - switch (i) - { - case DSD0: - if ((uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER))) && - (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart)) - Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDEnd = VENDOR_PTR_IN_CS; - else - Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDEnd = UNINIT_PTR_IN_CS; - break; + switch (i) { + case DSD0: + if ((uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER))) && + (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart)) + Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDEnd = VENDOR_PTR_IN_CS; + else + Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDEnd = UNINIT_PTR_IN_CS; + break; - case DSD1: - if ((uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER))) && - (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart)) - Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1End = VENDOR_PTR_IN_CS; - else - Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1End = UNINIT_PTR_IN_CS; - break; + case DSD1: + if ((uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER))) && + (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart)) + Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1End = VENDOR_PTR_IN_CS; + else + Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1End = UNINIT_PTR_IN_CS; + break; - case DSD2: - if ((uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER))) && - (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart)) - Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2End = VENDOR_PTR_IN_CS; - else - Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2End = UNINIT_PTR_IN_CS; - break; - case VSA0: - if (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart) - Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAEnd = VENDOR_PTR_IN_CS; - else - Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAEnd = UNINIT_PTR_IN_CS; - break; + case DSD2: + if ((uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER))) && + (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart)) + Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2End = VENDOR_PTR_IN_CS; + else + Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2End = UNINIT_PTR_IN_CS; + break; + case VSA0: + if (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart) + Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAEnd = VENDOR_PTR_IN_CS; + else + Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAEnd = UNINIT_PTR_IN_CS; + break; - case VSA1: - if (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart) - Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1End = VENDOR_PTR_IN_CS; - else - Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1End = UNINIT_PTR_IN_CS; - break; - case VSA2: - if (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart) - Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2End = VENDOR_PTR_IN_CS; - else - Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2End = UNINIT_PTR_IN_CS; - break; + case VSA1: + if (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart) + Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1End = VENDOR_PTR_IN_CS; + else + Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1End = UNINIT_PTR_IN_CS; + break; + case VSA2: + if (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart) + Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2End = VENDOR_PTR_IN_CS; + else + Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2End = UNINIT_PTR_IN_CS; + break; - default: - break; + default: + break; } i++; } @@ -2770,12 +2509,9 @@ static INT BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) memset(Adapter->psFlashCSInfo, 0 , sizeof(FLASH_CS_INFO)); memset(Adapter->psFlash2xCSInfo, 0 , sizeof(FLASH2X_CS_INFO)); - if (!Adapter->bDDRInitDone) - { - { - value = FLASH_CONTIGIOUS_START_ADDR_BEFORE_INIT; - wrmalt(Adapter, 0xAF00A080, &value, sizeof(value)); - } + if (!Adapter->bDDRInitDone) { + value = FLASH_CONTIGIOUS_START_ADDR_BEFORE_INIT; + wrmalt(Adapter, 0xAF00A080, &value, sizeof(value)); } // Reading first 8 Bytes to get the Flash Layout @@ -2787,41 +2523,32 @@ static INT BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Flash Layout Minor Version :%d\n", ntohs(sFlashCsInfo.FlashLayoutMinorVersion)); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Signature is :%x\n", ntohl(Adapter->psFlashCSInfo->MagicNumber)); - if (FLASH_CONTROL_STRUCT_SIGNATURE == ntohl(Adapter->psFlashCSInfo->MagicNumber)) - { + if (FLASH_CONTROL_STRUCT_SIGNATURE == ntohl(Adapter->psFlashCSInfo->MagicNumber)) { uiFlashLayoutMajorVersion = MAJOR_VERSION((Adapter->psFlashCSInfo->FlashLayoutVersion)); Adapter->uiFlashLayoutMinorVersion = MINOR_VERSION((Adapter->psFlashCSInfo->FlashLayoutVersion)); - } - else - { + } else { Adapter->uiFlashLayoutMinorVersion = 0; uiFlashLayoutMajorVersion = 0; } BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "FLASH LAYOUT MAJOR VERSION :%X", uiFlashLayoutMajorVersion); - if (uiFlashLayoutMajorVersion < FLASH_2X_MAJOR_NUMBER) - { + if (uiFlashLayoutMajorVersion < FLASH_2X_MAJOR_NUMBER) { BeceemFlashBulkRead(Adapter, (PUINT)Adapter->psFlashCSInfo, Adapter->ulFlashControlSectionStart, sizeof(FLASH_CS_INFO)); ConvertEndianOfCSStructure(Adapter->psFlashCSInfo); Adapter->ulFlashCalStart = (Adapter->psFlashCSInfo->OffsetFromZeroForCalibrationStart); if (!((Adapter->uiFlashLayoutMajorVersion == 1) && (Adapter->uiFlashLayoutMinorVersion == 1))) - { Adapter->ulFlashControlSectionStart = Adapter->psFlashCSInfo->OffsetFromZeroForControlSectionStart; - } if ((FLASH_CONTROL_STRUCT_SIGNATURE == (Adapter->psFlashCSInfo->MagicNumber)) && (SCSI_FIRMWARE_MINOR_VERSION <= MINOR_VERSION(Adapter->psFlashCSInfo->SCSIFirmwareVersion)) && (FLASH_SECTOR_SIZE_SIG == (Adapter->psFlashCSInfo->FlashSectorSizeSig)) && - (BYTE_WRITE_SUPPORT == (Adapter->psFlashCSInfo->FlashWriteSupportSize))) - { + (BYTE_WRITE_SUPPORT == (Adapter->psFlashCSInfo->FlashWriteSupportSize))) { Adapter->ulFlashWriteSize = (Adapter->psFlashCSInfo->FlashWriteSupportSize); Adapter->fpFlashWrite = flashByteWrite; Adapter->fpFlashWriteWithStatusCheck = flashByteWriteStatus; - } - else - { + } else { Adapter->ulFlashWriteSize = MAX_RW_SIZE; Adapter->fpFlashWrite = flashWrite; Adapter->fpFlashWriteWithStatusCheck = flashWriteStatus; @@ -2830,12 +2557,9 @@ static INT BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) BcmGetFlashSectorSize(Adapter, (Adapter->psFlashCSInfo->FlashSectorSizeSig), (Adapter->psFlashCSInfo->FlashSectorSize)); Adapter->uiFlashBaseAdd = Adapter->psFlashCSInfo->FlashBaseAddr & 0xFCFFFFFF; - } - else - { + } else { if (BcmFlash2xBulkRead(Adapter, (PUINT)Adapter->psFlash2xCSInfo, NO_SECTION_VAL, - Adapter->ulFlashControlSectionStart, sizeof(FLASH2X_CS_INFO))) - { + Adapter->ulFlashControlSectionStart, sizeof(FLASH2X_CS_INFO))) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Unable to read CS structure\n"); return STATUS_FAILURE; } @@ -2845,14 +2569,11 @@ static INT BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) if ((FLASH_CONTROL_STRUCT_SIGNATURE == Adapter->psFlash2xCSInfo->MagicNumber) && (SCSI_FIRMWARE_MINOR_VERSION <= MINOR_VERSION(Adapter->psFlash2xCSInfo->SCSIFirmwareVersion)) && (FLASH_SECTOR_SIZE_SIG == Adapter->psFlash2xCSInfo->FlashSectorSizeSig) && - (BYTE_WRITE_SUPPORT == Adapter->psFlash2xCSInfo->FlashWriteSupportSize)) - { + (BYTE_WRITE_SUPPORT == Adapter->psFlash2xCSInfo->FlashWriteSupportSize)) { Adapter->ulFlashWriteSize = Adapter->psFlash2xCSInfo->FlashWriteSupportSize; Adapter->fpFlashWrite = flashByteWrite; Adapter->fpFlashWriteWithStatusCheck = flashByteWriteStatus; - } - else - { + } else { Adapter->ulFlashWriteSize = MAX_RW_SIZE; Adapter->fpFlashWrite = flashWrite; Adapter->fpFlashWriteWithStatusCheck = flashWriteStatus; @@ -2897,9 +2618,7 @@ static NVM_TYPE BcmGetNvmType(struct bcm_mini_adapter *Adapter) BeceemEEPROMBulkRead(Adapter, &uiData, 0x0, 4); if (uiData == BECM) - { return NVM_EEPROM; - } // // Read control struct and get cal addresses before accessing the flash @@ -2908,18 +2627,14 @@ static NVM_TYPE BcmGetNvmType(struct bcm_mini_adapter *Adapter) BeceemFlashBulkRead(Adapter, &uiData, 0x0 + Adapter->ulFlashCalStart, 4); if (uiData == BECM) - { return NVM_FLASH; - } // // even if there is no valid signature on EEPROM/FLASH find out if they really exist. // if exist select it. // if (BcmGetEEPROMSize(Adapter)) - { return NVM_EEPROM; - } //TBD for Flash. return NVM_UNKNOWN; @@ -2948,73 +2663,70 @@ INT BcmGetSectionValStartOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTIO SectStartOffset = INVALID_OFFSET; if (IsSectionExistInVendorInfo(Adapter, eFlashSectionVal)) - { return Adapter->psFlash2xVendorInfo->VendorSection[eFlashSectionVal].OffsetFromZeroForSectionStart; - } - switch (eFlashSectionVal) - { - case ISO_IMAGE1: - if ((Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start != UNINIT_PTR_IN_CS) && - (IsNonCDLessDevice(Adapter) == FALSE)) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start); - break; - case ISO_IMAGE2: - if ((Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start != UNINIT_PTR_IN_CS) && - (IsNonCDLessDevice(Adapter) == FALSE)) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start); - break; - case DSD0: - if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart); - break; - case DSD1: - if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start); - break; - case DSD2: - if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start); - break; - case VSA0: - if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart); - break; - case VSA1: - if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start); - break; - case VSA2: - if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start); - break; - case SCSI: - if (Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware); - break; - case CONTROL_SECTION: - if (Adapter->psFlash2xCSInfo->OffsetFromZeroForControlSectionStart != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForControlSectionStart); - break; - case ISO_IMAGE1_PART2: - if (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start); - break; - case ISO_IMAGE1_PART3: - if (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3Start != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3Start); - break; - case ISO_IMAGE2_PART2: - if (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start); - break; - case ISO_IMAGE2_PART3: - if (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3Start != UNINIT_PTR_IN_CS) - SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3Start); - break; - default: - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Section Does not exist in Flash 2.x"); - SectStartOffset = INVALID_OFFSET; + switch (eFlashSectionVal) { + case ISO_IMAGE1: + if ((Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start != UNINIT_PTR_IN_CS) && + (IsNonCDLessDevice(Adapter) == FALSE)) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start); + break; + case ISO_IMAGE2: + if ((Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start != UNINIT_PTR_IN_CS) && + (IsNonCDLessDevice(Adapter) == FALSE)) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start); + break; + case DSD0: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart); + break; + case DSD1: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start); + break; + case DSD2: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start); + break; + case VSA0: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart); + break; + case VSA1: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start); + break; + case VSA2: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start); + break; + case SCSI: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware); + break; + case CONTROL_SECTION: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForControlSectionStart != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForControlSectionStart); + break; + case ISO_IMAGE1_PART2: + if (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start); + break; + case ISO_IMAGE1_PART3: + if (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3Start != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3Start); + break; + case ISO_IMAGE2_PART2: + if (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start); + break; + case ISO_IMAGE2_PART3: + if (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3Start != UNINIT_PTR_IN_CS) + SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3Start); + break; + default: + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Section Does not exist in Flash 2.x"); + SectStartOffset = INVALID_OFFSET; } return SectStartOffset; @@ -3036,72 +2748,69 @@ INT BcmGetSectionValEndOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_ SectEndOffset = INVALID_OFFSET; if (IsSectionExistInVendorInfo(Adapter, eFlash2xSectionVal)) - { return Adapter->psFlash2xVendorInfo->VendorSection[eFlash2xSectionVal].OffsetFromZeroForSectionEnd; - } - switch (eFlash2xSectionVal) - { - case ISO_IMAGE1: - if ((Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End != UNINIT_PTR_IN_CS) && - (IsNonCDLessDevice(Adapter) == FALSE)) - SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End); - break; - case ISO_IMAGE2: - if ((Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End != UNINIT_PTR_IN_CS) && - (IsNonCDLessDevice(Adapter) == FALSE)) - SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End); - break; - case DSD0: - if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDEnd != UNINIT_PTR_IN_CS) - SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDEnd); - break; - case DSD1: - if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1End != UNINIT_PTR_IN_CS) - SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1End); - break; - case DSD2: - if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2End != UNINIT_PTR_IN_CS) - SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2End); - break; - case VSA0: - if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAEnd != UNINIT_PTR_IN_CS) - SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAEnd); - break; - case VSA1: - if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1End != UNINIT_PTR_IN_CS) - SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1End); - break; - case VSA2: - if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2End != UNINIT_PTR_IN_CS) - SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2End); - break; - case SCSI: - if (Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware != UNINIT_PTR_IN_CS) - SectEndOffset = ((Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware) + - (Adapter->psFlash2xCSInfo->SizeOfScsiFirmware)); - break; - case CONTROL_SECTION: - //Not Clear So Putting failure. confirm and fix it. - SectEndOffset = STATUS_FAILURE; - case ISO_IMAGE1_PART2: - if (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End != UNINIT_PTR_IN_CS) - SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End); - break; - case ISO_IMAGE1_PART3: - if (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3End != UNINIT_PTR_IN_CS) - SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3End); - break; - case ISO_IMAGE2_PART2: - if (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End != UNINIT_PTR_IN_CS) - SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End); - break; - case ISO_IMAGE2_PART3: - if (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3End != UNINIT_PTR_IN_CS) - SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3End); - break; - default: - SectEndOffset = INVALID_OFFSET; + switch (eFlash2xSectionVal) { + case ISO_IMAGE1: + if ((Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End != UNINIT_PTR_IN_CS) && + (IsNonCDLessDevice(Adapter) == FALSE)) + SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End); + break; + case ISO_IMAGE2: + if ((Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End != UNINIT_PTR_IN_CS) && + (IsNonCDLessDevice(Adapter) == FALSE)) + SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End); + break; + case DSD0: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDEnd != UNINIT_PTR_IN_CS) + SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDEnd); + break; + case DSD1: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1End != UNINIT_PTR_IN_CS) + SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1End); + break; + case DSD2: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2End != UNINIT_PTR_IN_CS) + SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2End); + break; + case VSA0: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAEnd != UNINIT_PTR_IN_CS) + SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAEnd); + break; + case VSA1: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1End != UNINIT_PTR_IN_CS) + SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1End); + break; + case VSA2: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2End != UNINIT_PTR_IN_CS) + SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2End); + break; + case SCSI: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware != UNINIT_PTR_IN_CS) + SectEndOffset = ((Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware) + + (Adapter->psFlash2xCSInfo->SizeOfScsiFirmware)); + break; + case CONTROL_SECTION: + //Not Clear So Putting failure. confirm and fix it. + SectEndOffset = STATUS_FAILURE; + case ISO_IMAGE1_PART2: + if (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End != UNINIT_PTR_IN_CS) + SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End); + break; + case ISO_IMAGE1_PART3: + if (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3End != UNINIT_PTR_IN_CS) + SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3End); + break; + case ISO_IMAGE2_PART2: + if (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End != UNINIT_PTR_IN_CS) + SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End); + break; + case ISO_IMAGE2_PART3: + if (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3End != UNINIT_PTR_IN_CS) + SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3End); + break; + default: + SectEndOffset = INVALID_OFFSET; } return SectEndOffset ; @@ -3130,13 +2839,11 @@ INT BcmFlash2xBulkRead(struct bcm_mini_adapter *Adapter, UINT uiAbsoluteOffset = 0; UINT uiTemp = 0, value = 0; - if (Adapter == NULL) - { + if (Adapter == NULL) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Adapter structure is NULL"); return -EINVAL; } - if (Adapter->device_removed) - { + if (Adapter->device_removed) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Device has been removed"); return -ENODEV; } @@ -3147,8 +2854,7 @@ INT BcmFlash2xBulkRead(struct bcm_mini_adapter *Adapter, else SectionStartOffset = BcmGetSectionValStartOffset(Adapter, eFlash2xSectionVal); - if (SectionStartOffset == STATUS_FAILURE) - { + if (SectionStartOffset == STATUS_FAILURE) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "This Section<%d> does not exixt in Flash 2.x Map ", eFlash2xSectionVal); return -EINVAL; } @@ -3163,8 +2869,7 @@ INT BcmFlash2xBulkRead(struct bcm_mini_adapter *Adapter, wrmalt(Adapter, 0x0f000C80, &value, sizeof(value)); Status = BeceemFlashBulkRead(Adapter, pBuffer, uiAbsoluteOffset, uiNumBytes); wrmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); - if (Status) - { + if (Status) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Flash Read Failed with Status :%d", Status); return Status; } @@ -3196,14 +2901,12 @@ INT BcmFlash2xBulkWrite(struct bcm_mini_adapter *Adapter, UINT FlashSectValStartOffset = 0; UINT uiTemp = 0, value = 0; - if (Adapter == NULL) - { + if (Adapter == NULL) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Adapter structure is NULL"); return -EINVAL; } - if (Adapter->device_removed) - { + if (Adapter->device_removed) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Device has been removed"); return -ENODEV; } @@ -3214,8 +2917,7 @@ INT BcmFlash2xBulkWrite(struct bcm_mini_adapter *Adapter, else FlashSectValStartOffset = BcmGetSectionValStartOffset(Adapter, eFlash2xSectVal); - if (FlashSectValStartOffset == STATUS_FAILURE) - { + if (FlashSectValStartOffset == STATUS_FAILURE) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "This Section<%d> does not exixt in Flash Map 2.x", eFlash2xSectVal); return -EINVAL; } @@ -3233,8 +2935,7 @@ INT BcmFlash2xBulkWrite(struct bcm_mini_adapter *Adapter, Status = BeceemFlashBulkWrite(Adapter, pBuffer, uiOffset, uiNumBytes, bVerify); wrmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); - if (Status) - { + if (Status) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Flash Write failed with Status :%d", Status); return Status; } @@ -3266,21 +2967,15 @@ static INT BcmGetActiveDSD(struct bcm_mini_adapter *Adapter) Adapter->ulFlashCalStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start; if (Adapter->eActiveDSD) BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Active DSD :%d", Adapter->eActiveDSD); - if (Adapter->eActiveDSD == 0) - { + if (Adapter->eActiveDSD == 0) { //if No DSD gets Active, Make Active the DSD with WR permission - if (IsSectionWritable(Adapter, DSD2)) - { + if (IsSectionWritable(Adapter, DSD2)) { Adapter->eActiveDSD = DSD2; Adapter->ulFlashCalStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start; - } - else if (IsSectionWritable(Adapter, DSD1)) - { + } else if (IsSectionWritable(Adapter, DSD1)) { Adapter->eActiveDSD = DSD1; Adapter->ulFlashCalStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start; - } - else if (IsSectionWritable(Adapter, DSD0)) - { + } else if (IsSectionWritable(Adapter, DSD0)) { Adapter->eActiveDSD = DSD0; Adapter->ulFlashCalStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart; } @@ -3397,8 +3092,7 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM // For 1.x map all the section except DSD0 will be shown as not present // This part will be used by calibration tool to detect the number of DSD present in Flash. - if (IsFlash2x(Adapter) == FALSE) - { + if (IsFlash2x(Adapter) == FALSE) { psFlash2xBitMap->ISO_IMAGE2 = 0; psFlash2xBitMap->ISO_IMAGE1 = 0; psFlash2xBitMap->DSD0 = FLASH2X_SECTION_VALID | FLASH2X_SECTION_ACT | FLASH2X_SECTION_PRESENT; //0xF; //0000(Reseved)1(Active)0(RW)1(valid)1(present) @@ -3422,8 +3116,7 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM /// // IS0 IMAGE 2 /// - if ((psFlash2xCSInfo->OffsetISOImage2Part1Start) != UNINIT_PTR_IN_CS) - { + if ((psFlash2xCSInfo->OffsetISOImage2Part1Start) != UNINIT_PTR_IN_CS) { //Setting the 0th Bit representing the Section is present or not. psFlash2xBitMap->ISO_IMAGE2 = psFlash2xBitMap->ISO_IMAGE2 | FLASH2X_SECTION_PRESENT; @@ -3434,8 +3127,7 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM if (IsSectionWritable(Adapter, ISO_IMAGE2) == FALSE) psFlash2xBitMap->ISO_IMAGE2 |= FLASH2X_SECTION_RO; - if (SetActiveISODone == FALSE && uiHighestPriISO == ISO_IMAGE2) - { + if (SetActiveISODone == FALSE && uiHighestPriISO == ISO_IMAGE2) { psFlash2xBitMap->ISO_IMAGE2 |= FLASH2X_SECTION_ACT; SetActiveISODone = TRUE; } @@ -3444,8 +3136,7 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM /// // IS0 IMAGE 1 /// - if ((psFlash2xCSInfo->OffsetISOImage1Part1Start) != UNINIT_PTR_IN_CS) - { + if ((psFlash2xCSInfo->OffsetISOImage1Part1Start) != UNINIT_PTR_IN_CS) { // Setting the 0th Bit representing the Section is present or not. psFlash2xBitMap->ISO_IMAGE1 = psFlash2xBitMap->ISO_IMAGE1 | FLASH2X_SECTION_PRESENT; @@ -3456,8 +3147,7 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM if (IsSectionWritable(Adapter, ISO_IMAGE1) == FALSE) psFlash2xBitMap->ISO_IMAGE1 |= FLASH2X_SECTION_RO; - if (SetActiveISODone == FALSE && uiHighestPriISO == ISO_IMAGE1) - { + if (SetActiveISODone == FALSE && uiHighestPriISO == ISO_IMAGE1) { psFlash2xBitMap->ISO_IMAGE1 |= FLASH2X_SECTION_ACT; SetActiveISODone = TRUE; } @@ -3466,8 +3156,7 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM /// // DSD2 /// - if ((psFlash2xCSInfo->OffsetFromZeroForDSD2Start) != UNINIT_PTR_IN_CS) - { + if ((psFlash2xCSInfo->OffsetFromZeroForDSD2Start) != UNINIT_PTR_IN_CS) { //Setting the 0th Bit representing the Section is present or not. psFlash2xBitMap->DSD2 = psFlash2xBitMap->DSD2 | FLASH2X_SECTION_PRESENT; @@ -3475,15 +3164,11 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM psFlash2xBitMap->DSD2 |= FLASH2X_SECTION_VALID; // Calculation for extrating the Access permission - if (IsSectionWritable(Adapter, DSD2) == FALSE) - { + if (IsSectionWritable(Adapter, DSD2) == FALSE) { psFlash2xBitMap->DSD2 |= FLASH2X_SECTION_RO; - } - else - { + } else { //Means section is writable - if ((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD2)) - { + if ((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD2)) { psFlash2xBitMap->DSD2 |= FLASH2X_SECTION_ACT; SetActiveDSDDone = TRUE; } @@ -3493,8 +3178,7 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM /// // DSD 1 /// - if ((psFlash2xCSInfo->OffsetFromZeroForDSD1Start) != UNINIT_PTR_IN_CS) - { + if ((psFlash2xCSInfo->OffsetFromZeroForDSD1Start) != UNINIT_PTR_IN_CS) { // Setting the 0th Bit representing the Section is present or not. psFlash2xBitMap->DSD1 = psFlash2xBitMap->DSD1 | FLASH2X_SECTION_PRESENT; @@ -3502,15 +3186,11 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM psFlash2xBitMap->DSD1 |= FLASH2X_SECTION_VALID; // Calculation for extrating the Access permission - if (IsSectionWritable(Adapter, DSD1) == FALSE) - { + if (IsSectionWritable(Adapter, DSD1) == FALSE) { psFlash2xBitMap->DSD1 |= FLASH2X_SECTION_RO; - } - else - { + } else { // Means section is writable - if ((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD1)) - { + if ((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD1)) { psFlash2xBitMap->DSD1 |= FLASH2X_SECTION_ACT; SetActiveDSDDone = TRUE; } @@ -3520,8 +3200,7 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM /// //For DSD 0 // - if ((psFlash2xCSInfo->OffsetFromZeroForDSDStart) != UNINIT_PTR_IN_CS) - { + if ((psFlash2xCSInfo->OffsetFromZeroForDSDStart) != UNINIT_PTR_IN_CS) { //Setting the 0th Bit representing the Section is present or not. psFlash2xBitMap->DSD0 = psFlash2xBitMap->DSD0 | FLASH2X_SECTION_PRESENT; @@ -3529,15 +3208,11 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM psFlash2xBitMap->DSD0 |= FLASH2X_SECTION_VALID; // Setting Access permission - if (IsSectionWritable(Adapter, DSD0) == FALSE) - { + if (IsSectionWritable(Adapter, DSD0) == FALSE) { psFlash2xBitMap->DSD0 |= FLASH2X_SECTION_RO; - } - else - { + } else { // Means section is writable - if ((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD0)) - { + if ((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD0)) { psFlash2xBitMap->DSD0 |= FLASH2X_SECTION_ACT; SetActiveDSDDone = TRUE; } @@ -3547,8 +3222,7 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM /// // VSA 0 /// - if ((psFlash2xCSInfo->OffsetFromZeroForVSAStart) != UNINIT_PTR_IN_CS) - { + if ((psFlash2xCSInfo->OffsetFromZeroForVSAStart) != UNINIT_PTR_IN_CS) { // Setting the 0th Bit representing the Section is present or not. psFlash2xBitMap->VSA0 = psFlash2xBitMap->VSA0 | FLASH2X_SECTION_PRESENT; @@ -3566,8 +3240,7 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM /// // VSA 1 /// - if ((psFlash2xCSInfo->OffsetFromZeroForVSA1Start) != UNINIT_PTR_IN_CS) - { + if ((psFlash2xCSInfo->OffsetFromZeroForVSA1Start) != UNINIT_PTR_IN_CS) { // Setting the 0th Bit representing the Section is present or not. psFlash2xBitMap->VSA1 = psFlash2xBitMap->VSA1 | FLASH2X_SECTION_PRESENT; @@ -3585,8 +3258,7 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM /// // VSA 2 /// - if ((psFlash2xCSInfo->OffsetFromZeroForVSA2Start) != UNINIT_PTR_IN_CS) - { + if ((psFlash2xCSInfo->OffsetFromZeroForVSA2Start) != UNINIT_PTR_IN_CS) { // Setting the 0th Bit representing the Section is present or not. psFlash2xBitMap->VSA2 = psFlash2xBitMap->VSA2 | FLASH2X_SECTION_PRESENT; @@ -3604,8 +3276,7 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM /// // SCSI Section /// - if ((psFlash2xCSInfo->OffsetFromZeroForScsiFirmware) != UNINIT_PTR_IN_CS) - { + if ((psFlash2xCSInfo->OffsetFromZeroForScsiFirmware) != UNINIT_PTR_IN_CS) { // Setting the 0th Bit representing the Section is present or not. psFlash2xBitMap->SCSI = psFlash2xBitMap->SCSI | FLASH2X_SECTION_PRESENT; @@ -3623,8 +3294,7 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM /// // Control Section /// - if ((psFlash2xCSInfo->OffsetFromZeroForControlSectionStart) != UNINIT_PTR_IN_CS) - { + if ((psFlash2xCSInfo->OffsetFromZeroForControlSectionStart) != UNINIT_PTR_IN_CS) { // Setting the 0th Bit representing the Section is present or not. psFlash2xBitMap->CONTROL_SECTION = psFlash2xBitMap->CONTROL_SECTION | (FLASH2X_SECTION_PRESENT); @@ -3672,177 +3342,157 @@ INT BcmSetActiveSection(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eF INT HighestPriISO = 0; Status = IsSectionWritable(Adapter, eFlash2xSectVal); - if (Status != TRUE) - { + if (Status != TRUE) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Provided Section <%d> is not writable", eFlash2xSectVal); return STATUS_FAILURE; } Adapter->bHeaderChangeAllowed = TRUE; - switch (eFlash2xSectVal) - { - case ISO_IMAGE1: - case ISO_IMAGE2: - if (ReadISOSignature(Adapter, eFlash2xSectVal) == ISO_IMAGE_MAGIC_NUMBER) - { + switch (eFlash2xSectVal) { + case ISO_IMAGE1: + case ISO_IMAGE2: + if (ReadISOSignature(Adapter, eFlash2xSectVal) == ISO_IMAGE_MAGIC_NUMBER) { + HighestPriISO = getHighestPriISO(Adapter); + + if (HighestPriISO == eFlash2xSectVal) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Given ISO<%x> already has highest priority", eFlash2xSectVal); + Status = STATUS_SUCCESS; + break; + } + + SectImagePriority = ReadISOPriority(Adapter, HighestPriISO) + 1; + + if ((SectImagePriority <= 0) && IsSectionWritable(Adapter, HighestPriISO)) { + // This is a SPECIAL Case which will only happen if the current highest priority ISO has priority value = 0x7FFFFFFF. + // We will write 1 to the current Highest priority ISO And then shall increase the priority of the requested ISO + // by user + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "SectImagePriority wraparound happened, eFlash2xSectVal: 0x%x\n", eFlash2xSectVal); + SectImagePriority = htonl(0x1); + Status = BcmFlash2xBulkWrite(Adapter, + &SectImagePriority, + HighestPriISO, + 0 + FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImagePriority), + SIGNATURE_SIZE, + TRUE); + if (Status) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Priority has not been written properly"); + Status = STATUS_FAILURE; + break; + } + HighestPriISO = getHighestPriISO(Adapter); - if (HighestPriISO == eFlash2xSectVal) - { + if (HighestPriISO == eFlash2xSectVal) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Given ISO<%x> already has highest priority", eFlash2xSectVal); Status = STATUS_SUCCESS; break; } - SectImagePriority = ReadISOPriority(Adapter, HighestPriISO) + 1; - - if ((SectImagePriority <= 0) && IsSectionWritable(Adapter, HighestPriISO)) - { - // This is a SPECIAL Case which will only happen if the current highest priority ISO has priority value = 0x7FFFFFFF. - // We will write 1 to the current Highest priority ISO And then shall increase the priority of the requested ISO - // by user - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "SectImagePriority wraparound happened, eFlash2xSectVal: 0x%x\n", eFlash2xSectVal); - SectImagePriority = htonl(0x1); - Status = BcmFlash2xBulkWrite(Adapter, - &SectImagePriority, - HighestPriISO, - 0 + FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImagePriority), - SIGNATURE_SIZE, - TRUE); - if (Status) - { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Priority has not been written properly"); - Status = STATUS_FAILURE; - break; - } - - HighestPriISO = getHighestPriISO(Adapter); + SectImagePriority = 2; + } - if (HighestPriISO == eFlash2xSectVal) - { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Given ISO<%x> already has highest priority", eFlash2xSectVal); - Status = STATUS_SUCCESS; - break; - } + SectImagePriority = htonl(SectImagePriority); - SectImagePriority = 2; - } + Status = BcmFlash2xBulkWrite(Adapter, + &SectImagePriority, + eFlash2xSectVal, + 0 + FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImagePriority), + SIGNATURE_SIZE, + TRUE); + if (Status) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Priority has not been written properly"); + break; + } + } else { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Signature is currupted. Hence can't increase the priority"); + Status = STATUS_FAILURE; + break; + } + break; + case DSD0: + case DSD1: + case DSD2: + if (ReadDSDSignature(Adapter, eFlash2xSectVal) == DSD_IMAGE_MAGIC_NUMBER) { + HighestPriDSD = getHighestPriDSD(Adapter); + if ((HighestPriDSD == eFlash2xSectVal)) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Given DSD<%x> already has highest priority", eFlash2xSectVal); + Status = STATUS_SUCCESS; + break; + } - SectImagePriority = htonl(SectImagePriority); + SectImagePriority = ReadDSDPriority(Adapter, HighestPriDSD) + 1; + if (SectImagePriority <= 0) { + // This is a SPECIAL Case which will only happen if the current highest priority DSD has priority value = 0x7FFFFFFF. + // We will write 1 to the current Highest priority DSD And then shall increase the priority of the requested DSD + // by user + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, NVM_RW, DBG_LVL_ALL, "SectImagePriority wraparound happened, eFlash2xSectVal: 0x%x\n", eFlash2xSectVal); + SectImagePriority = htonl(0x1); Status = BcmFlash2xBulkWrite(Adapter, &SectImagePriority, - eFlash2xSectVal, - 0 + FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImagePriority), + HighestPriDSD, + Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImagePriority), SIGNATURE_SIZE, TRUE); - if (Status) - { + if (Status) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Priority has not been written properly"); break; } - } - else - { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Signature is currupted. Hence can't increase the priority"); - Status = STATUS_FAILURE; - break; - } - break; - case DSD0: - case DSD1: - case DSD2: - if (ReadDSDSignature(Adapter, eFlash2xSectVal) == DSD_IMAGE_MAGIC_NUMBER) - { + HighestPriDSD = getHighestPriDSD(Adapter); - if ((HighestPriDSD == eFlash2xSectVal)) - { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Given DSD<%x> already has highest priority", eFlash2xSectVal); + + if ((HighestPriDSD == eFlash2xSectVal)) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Made the DSD: %x highest by reducing priority of other\n", eFlash2xSectVal); Status = STATUS_SUCCESS; break; } - SectImagePriority = ReadDSDPriority(Adapter, HighestPriDSD) + 1; - if (SectImagePriority <= 0) - { - // This is a SPECIAL Case which will only happen if the current highest priority DSD has priority value = 0x7FFFFFFF. - // We will write 1 to the current Highest priority DSD And then shall increase the priority of the requested DSD - // by user - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, NVM_RW, DBG_LVL_ALL, "SectImagePriority wraparound happened, eFlash2xSectVal: 0x%x\n", eFlash2xSectVal); - SectImagePriority = htonl(0x1); - - Status = BcmFlash2xBulkWrite(Adapter, - &SectImagePriority, - HighestPriDSD, - Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImagePriority), - SIGNATURE_SIZE, - TRUE); - if (Status) - { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Priority has not been written properly"); - break; - } - - HighestPriDSD = getHighestPriDSD(Adapter); - - if ((HighestPriDSD == eFlash2xSectVal)) - { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Made the DSD: %x highest by reducing priority of other\n", eFlash2xSectVal); - Status = STATUS_SUCCESS; - break; - } - - SectImagePriority = htonl(0x2); - Status = BcmFlash2xBulkWrite(Adapter, - &SectImagePriority, - HighestPriDSD, - Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImagePriority), - SIGNATURE_SIZE, - TRUE); - if (Status) - { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Priority has not been written properly"); - break; - } - - HighestPriDSD = getHighestPriDSD(Adapter); - if ((HighestPriDSD == eFlash2xSectVal)) - { - Status = STATUS_SUCCESS; - break; - } - - SectImagePriority = 3; - } - SectImagePriority = htonl(SectImagePriority); + SectImagePriority = htonl(0x2); Status = BcmFlash2xBulkWrite(Adapter, &SectImagePriority, - eFlash2xSectVal, + HighestPriDSD, Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImagePriority), SIGNATURE_SIZE, TRUE); - if (Status) - { + if (Status) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Priority has not been written properly"); - Status = STATUS_FAILURE; break; } + + HighestPriDSD = getHighestPriDSD(Adapter); + if ((HighestPriDSD == eFlash2xSectVal)) { + Status = STATUS_SUCCESS; + break; + } + + SectImagePriority = 3; } - else - { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Signature is currupted. Hence can't increase the priority"); + SectImagePriority = htonl(SectImagePriority); + Status = BcmFlash2xBulkWrite(Adapter, + &SectImagePriority, + eFlash2xSectVal, + Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImagePriority), + SIGNATURE_SIZE, + TRUE); + if (Status) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Priority has not been written properly"); Status = STATUS_FAILURE; break; } - break; - case VSA0: - case VSA1: - case VSA2: - // Has to be decided - break; - default: + } else { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Signature is currupted. Hence can't increase the priority"); Status = STATUS_FAILURE; break; + } + break; + case VSA0: + case VSA1: + case VSA2: + // Has to be decided + break; + default: + Status = STATUS_FAILURE; + break; } Adapter->bHeaderChangeAllowed = FALSE; @@ -3871,8 +3521,7 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS UINT SigBuff[MAX_RW_SIZE]; UINT i = 0; - if (ReadISOSignature(Adapter, sCopySectStrut.SrcSection) != ISO_IMAGE_MAGIC_NUMBER) - { + if (ReadISOSignature(Adapter, sCopySectStrut.SrcSection) != ISO_IMAGE_MAGIC_NUMBER) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "error as Source ISO Section does not have valid signature"); return STATUS_FAILURE; } @@ -3882,30 +3531,25 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS sCopySectStrut.SrcSection, 0 + FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImageSize), 4); - if (Status) - { + if (Status) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Read failed while copying ISO\n"); return Status; } ISOLength = htonl(ISOLength); if (ISOLength % Adapter->uiSectorSize) - { ISOLength = Adapter->uiSectorSize * (1 + ISOLength/Adapter->uiSectorSize); - } sigOffset = FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImageMagicNumber); Buff = kzalloc(Adapter->uiSectorSize, GFP_KERNEL); - if (Buff == NULL) - { + if (Buff == NULL) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Memory allocation failed for section size"); return -ENOMEM; } - if (sCopySectStrut.SrcSection == ISO_IMAGE1 && sCopySectStrut.DstSection == ISO_IMAGE2) - { + if (sCopySectStrut.SrcSection == ISO_IMAGE1 && sCopySectStrut.DstSection == ISO_IMAGE2) { eISOReadPart = ISO_IMAGE1; eISOWritePart = ISO_IMAGE2; uiReadOffsetWithinPart = 0; @@ -3918,8 +3562,7 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3End) - (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3Start); - if (uiTotalDataToCopy < ISOLength) - { + if (uiTotalDataToCopy < ISOLength) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "error as Source ISO Section does not have valid signature"); Status = STATUS_FAILURE; goto out; @@ -3932,8 +3575,7 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3End) - (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3Start); - if (uiTotalDataToCopy < ISOLength) - { + if (uiTotalDataToCopy < ISOLength) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "error as Dest ISO Section does not have enough section size"); Status = STATUS_FAILURE; goto out; @@ -3942,10 +3584,8 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS uiTotalDataToCopy = ISOLength; CorruptISOSig(Adapter, ISO_IMAGE2); - while (uiTotalDataToCopy) - { - if (uiTotalDataToCopy == Adapter->uiSectorSize) - { + while (uiTotalDataToCopy) { + if (uiTotalDataToCopy == Adapter->uiSectorSize) { // Setting for write of first sector. First sector is assumed to be written in last BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Writing the signature sector"); eISOReadPart = ISO_IMAGE1; @@ -3953,32 +3593,26 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS eISOWritePart = ISO_IMAGE2; uiWriteOffsetWithinPart = 0; IsThisHeaderSector = TRUE; - } - else - { + } else { uiReadOffsetWithinPart = uiReadOffsetWithinPart + Adapter->uiSectorSize; uiWriteOffsetWithinPart = uiWriteOffsetWithinPart + Adapter->uiSectorSize; - if ((eISOReadPart == ISO_IMAGE1) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start))) - { + if ((eISOReadPart == ISO_IMAGE1) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start))) { eISOReadPart = ISO_IMAGE1_PART2; uiReadOffsetWithinPart = 0; } - if ((eISOReadPart == ISO_IMAGE1_PART2) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start))) - { + if ((eISOReadPart == ISO_IMAGE1_PART2) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start))) { eISOReadPart = ISO_IMAGE1_PART3; uiReadOffsetWithinPart = 0; } - if ((eISOWritePart == ISO_IMAGE2) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start))) - { + if ((eISOWritePart == ISO_IMAGE2) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start))) { eISOWritePart = ISO_IMAGE2_PART2; uiWriteOffsetWithinPart = 0; } - if ((eISOWritePart == ISO_IMAGE2_PART2) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start))) - { + if ((eISOWritePart == ISO_IMAGE2_PART2) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start))) { eISOWritePart = ISO_IMAGE2_PART3; uiWriteOffsetWithinPart = 0; } @@ -3989,14 +3623,12 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS eISOReadPart, uiReadOffsetWithinPart, Adapter->uiSectorSize); - if (Status) - { + if (Status) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Read failed while copying ISO: Part: %x, OffsetWithinPart: %x\n", eISOReadPart, uiReadOffsetWithinPart); break; } - if (IsThisHeaderSector == TRUE) - { + if (IsThisHeaderSector == TRUE) { // If this is header sector write 0xFFFFFFFF at the sig time and in last write sig memcpy(SigBuff, Buff + sigOffset, MAX_RW_SIZE); @@ -4010,15 +3642,13 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS uiWriteOffsetWithinPart, Adapter->uiSectorSize, TRUE); - if (Status) - { + if (Status) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Write failed while copying ISO: Part: %x, OffsetWithinPart: %x\n", eISOWritePart, uiWriteOffsetWithinPart); break; } Adapter->bHeaderChangeAllowed = FALSE; - if (IsThisHeaderSector == TRUE) - { + if (IsThisHeaderSector == TRUE) { WriteToFlashWithoutSectorErase(Adapter, SigBuff, eISOWritePart, @@ -4031,8 +3661,7 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS } } - if (sCopySectStrut.SrcSection == ISO_IMAGE2 && sCopySectStrut.DstSection == ISO_IMAGE1) - { + if (sCopySectStrut.SrcSection == ISO_IMAGE2 && sCopySectStrut.DstSection == ISO_IMAGE1) { eISOReadPart = ISO_IMAGE2; eISOWritePart = ISO_IMAGE1; uiReadOffsetWithinPart = 0; @@ -4045,8 +3674,7 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3End) - (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3Start); - if (uiTotalDataToCopy < ISOLength) - { + if (uiTotalDataToCopy < ISOLength) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "error as Source ISO Section does not have valid signature"); Status = STATUS_FAILURE; goto out; @@ -4059,8 +3687,7 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3End) - (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3Start); - if (uiTotalDataToCopy < ISOLength) - { + if (uiTotalDataToCopy < ISOLength) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "error as Dest ISO Section does not have enough section size"); Status = STATUS_FAILURE; goto out; @@ -4070,10 +3697,8 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS CorruptISOSig(Adapter, ISO_IMAGE1); - while (uiTotalDataToCopy) - { - if (uiTotalDataToCopy == Adapter->uiSectorSize) - { + while (uiTotalDataToCopy) { + if (uiTotalDataToCopy == Adapter->uiSectorSize) { //Setting for write of first sector. First sector is assumed to be written in last BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Writing the signature sector"); eISOReadPart = ISO_IMAGE2; @@ -4081,32 +3706,26 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS eISOWritePart = ISO_IMAGE1; uiWriteOffsetWithinPart = 0; IsThisHeaderSector = TRUE; - } - else - { + } else { uiReadOffsetWithinPart = uiReadOffsetWithinPart + Adapter->uiSectorSize; uiWriteOffsetWithinPart = uiWriteOffsetWithinPart + Adapter->uiSectorSize; - if ((eISOReadPart == ISO_IMAGE2) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start))) - { + if ((eISOReadPart == ISO_IMAGE2) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start))) { eISOReadPart = ISO_IMAGE2_PART2; uiReadOffsetWithinPart = 0; } - if ((eISOReadPart == ISO_IMAGE2_PART2) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start))) - { + if ((eISOReadPart == ISO_IMAGE2_PART2) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start))) { eISOReadPart = ISO_IMAGE2_PART3; uiReadOffsetWithinPart = 0; } - if ((eISOWritePart == ISO_IMAGE1) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start))) - { + if ((eISOWritePart == ISO_IMAGE1) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start))) { eISOWritePart = ISO_IMAGE1_PART2; uiWriteOffsetWithinPart = 0; } - if ((eISOWritePart == ISO_IMAGE1_PART2) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start))) - { + if ((eISOWritePart == ISO_IMAGE1_PART2) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start))) { eISOWritePart = ISO_IMAGE1_PART3; uiWriteOffsetWithinPart = 0; } @@ -4117,14 +3736,12 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS eISOReadPart, uiReadOffsetWithinPart, Adapter->uiSectorSize); - if (Status) - { + if (Status) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Read failed while copying ISO: Part: %x, OffsetWithinPart: %x\n", eISOReadPart, uiReadOffsetWithinPart); break; } - if (IsThisHeaderSector == TRUE) - { + if (IsThisHeaderSector == TRUE) { // If this is header sector write 0xFFFFFFFF at the sig time and in last write sig memcpy(SigBuff, Buff + sigOffset, MAX_RW_SIZE); @@ -4138,15 +3755,13 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS uiWriteOffsetWithinPart, Adapter->uiSectorSize, TRUE); - if (Status) - { + if (Status) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Write failed while copying ISO: Part: %x, OffsetWithinPart: %x\n", eISOWritePart, uiWriteOffsetWithinPart); break; } Adapter->bHeaderChangeAllowed = FALSE; - if (IsThisHeaderSector == TRUE) - { + if (IsThisHeaderSector == TRUE) { WriteToFlashWithoutSectorErase(Adapter, SigBuff, eISOWritePart, @@ -4185,16 +3800,11 @@ INT BcmFlash2xCorruptSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL e BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Section Value :%x\n", eFlash2xSectionVal); - if ((eFlash2xSectionVal == DSD0) || (eFlash2xSectionVal == DSD1) || (eFlash2xSectionVal == DSD2)) - { + if ((eFlash2xSectionVal == DSD0) || (eFlash2xSectionVal == DSD1) || (eFlash2xSectionVal == DSD2)) { Status = CorruptDSDSig(Adapter, eFlash2xSectionVal); - } - else if (eFlash2xSectionVal == ISO_IMAGE1 || eFlash2xSectionVal == ISO_IMAGE2) - { + } else if (eFlash2xSectionVal == ISO_IMAGE1 || eFlash2xSectionVal == ISO_IMAGE2) { Status = CorruptISOSig(Adapter, eFlash2xSectionVal); - } - else - { + } else { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Given Section <%d>does not have Header", eFlash2xSectionVal); return STATUS_SUCCESS; } @@ -4219,47 +3829,37 @@ INT BcmFlash2xWriteSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFl UINT uiOffset = 0; // DSD_HEADER dsdHeader = {0}; - if (Adapter->bSigCorrupted == FALSE) - { + if (Adapter->bSigCorrupted == FALSE) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Signature is not corrupted by driver, hence not restoring\n"); return STATUS_SUCCESS; } - if (Adapter->bAllDSDWriteAllow == FALSE) - { - if (IsSectionWritable(Adapter, eFlashSectionVal) == FALSE) - { + if (Adapter->bAllDSDWriteAllow == FALSE) { + if (IsSectionWritable(Adapter, eFlashSectionVal) == FALSE) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Section is not Writable...Hence can't Write signature"); return SECTOR_IS_NOT_WRITABLE; } } - if ((eFlashSectionVal == DSD0) || (eFlashSectionVal == DSD1) || (eFlashSectionVal == DSD2)) - { + if ((eFlashSectionVal == DSD0) || (eFlashSectionVal == DSD1) || (eFlashSectionVal == DSD2)) { uiSignature = htonl(DSD_IMAGE_MAGIC_NUMBER); uiOffset = Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader; uiOffset += FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImageMagicNumber); - if ((ReadDSDSignature(Adapter, eFlashSectionVal) & 0xFF000000) != CORRUPTED_PATTERN) - { + if ((ReadDSDSignature(Adapter, eFlashSectionVal) & 0xFF000000) != CORRUPTED_PATTERN) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Corrupted Pattern is not there. Hence won't write sig"); return STATUS_FAILURE; } - } - else if ((eFlashSectionVal == ISO_IMAGE1) || (eFlashSectionVal == ISO_IMAGE2)) - { + } else if ((eFlashSectionVal == ISO_IMAGE1) || (eFlashSectionVal == ISO_IMAGE2)) { uiSignature = htonl(ISO_IMAGE_MAGIC_NUMBER); // uiOffset = 0; uiOffset = FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImageMagicNumber); - if ((ReadISOSignature(Adapter, eFlashSectionVal) & 0xFF000000) != CORRUPTED_PATTERN) - { + if ((ReadISOSignature(Adapter, eFlashSectionVal) & 0xFF000000) != CORRUPTED_PATTERN) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Currupted Pattern is not there. Hence won't write sig"); return STATUS_FAILURE; } - } - else - { + } else { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "GIVEN SECTION< %d > IS NOT VALID FOR SIG WRITE...", eFlashSectionVal); return STATUS_FAILURE; } @@ -4293,26 +3893,21 @@ INT validateFlash2xReadWrite(struct bcm_mini_adapter *Adapter, PFLASH2X_READWRIT uiNumOfBytes = psFlash2xReadWrite->numOfBytes; - if (IsSectionExistInFlash(Adapter, psFlash2xReadWrite->Section) != TRUE) - { + if (IsSectionExistInFlash(Adapter, psFlash2xReadWrite->Section) != TRUE) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Section<%x> does not exixt in Flash", psFlash2xReadWrite->Section); return FALSE; } uiSectStartOffset = BcmGetSectionValStartOffset(Adapter, psFlash2xReadWrite->Section); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Start offset :%x ,section :%d\n", uiSectStartOffset, psFlash2xReadWrite->Section); - if ((psFlash2xReadWrite->Section == ISO_IMAGE1) || (psFlash2xReadWrite->Section == ISO_IMAGE2)) - { - if (psFlash2xReadWrite->Section == ISO_IMAGE1) - { + if ((psFlash2xReadWrite->Section == ISO_IMAGE1) || (psFlash2xReadWrite->Section == ISO_IMAGE2)) { + if (psFlash2xReadWrite->Section == ISO_IMAGE1) { uiSectEndOffset = BcmGetSectionValEndOffset(Adapter, ISO_IMAGE1) - BcmGetSectionValStartOffset(Adapter, ISO_IMAGE1) + BcmGetSectionValEndOffset(Adapter, ISO_IMAGE1_PART2) - BcmGetSectionValStartOffset(Adapter, ISO_IMAGE1_PART2) + BcmGetSectionValEndOffset(Adapter, ISO_IMAGE1_PART3) - BcmGetSectionValStartOffset(Adapter, ISO_IMAGE1_PART3); - } - else if (psFlash2xReadWrite->Section == ISO_IMAGE2) - { + } else if (psFlash2xReadWrite->Section == ISO_IMAGE2) { uiSectEndOffset = BcmGetSectionValEndOffset(Adapter, ISO_IMAGE2) - BcmGetSectionValStartOffset(Adapter, ISO_IMAGE2) + BcmGetSectionValEndOffset(Adapter, ISO_IMAGE2_PART2) - @@ -4326,8 +3921,7 @@ INT validateFlash2xReadWrite(struct bcm_mini_adapter *Adapter, PFLASH2X_READWRIT uiSectEndOffset = uiSectStartOffset + uiSectEndOffset; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Total size of the ISO Image :%x", uiSectEndOffset); - } - else + } else uiSectEndOffset = BcmGetSectionValEndOffset(Adapter, psFlash2xReadWrite->Section); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "End offset :%x\n", uiSectEndOffset); @@ -4335,8 +3929,7 @@ INT validateFlash2xReadWrite(struct bcm_mini_adapter *Adapter, PFLASH2X_READWRIT // Checking the boundary condition if ((uiSectStartOffset + psFlash2xReadWrite->offset + uiNumOfBytes) <= uiSectEndOffset) return TRUE; - else - { + else { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Invalid Request...."); return FALSE; } @@ -4370,8 +3963,7 @@ static INT GetFlashBaseAddr(struct bcm_mini_adapter *Adapter) { UINT uiBaseAddr = 0; - if (Adapter->bDDRInitDone) - { + if (Adapter->bDDRInitDone) { /* For All Valid Flash Versions... except 1.1, take the value from FlashBaseAddr In case of Raw Read... use the default value @@ -4381,9 +3973,7 @@ static INT GetFlashBaseAddr(struct bcm_mini_adapter *Adapter) uiBaseAddr = Adapter->uiFlashBaseAdd; else uiBaseAddr = FLASH_CONTIGIOUS_START_ADDR_AFTER_INIT; - } - else - { + } else { /* For All Valid Flash Versions... except 1.1, take the value from FlashBaseAddr In case of Raw Read... use the default value @@ -4426,27 +4016,23 @@ INT BcmCopySection(struct bcm_mini_adapter *Adapter, PUCHAR pBuff = NULL; INT Status = STATUS_SUCCESS; - if (SrcSection == DstSection) - { + if (SrcSection == DstSection) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Source and Destination should be different ...try again"); return -EINVAL; } - if ((SrcSection != DSD0) && (SrcSection != DSD1) && (SrcSection != DSD2)) - { + if ((SrcSection != DSD0) && (SrcSection != DSD1) && (SrcSection != DSD2)) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Source should be DSD subsection"); return -EINVAL; } - if ((DstSection != DSD0) && (DstSection != DSD1) && (DstSection != DSD2)) - { + if ((DstSection != DSD0) && (DstSection != DSD1) && (DstSection != DSD2)) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Destination should be DSD subsection"); return -EINVAL; } // if offset zero means have to copy complete secton - if (numOfBytes == 0) - { + if (numOfBytes == 0) { numOfBytes = BcmGetSectionValEndOffset(Adapter, SrcSection) - BcmGetSectionValStartOffset(Adapter, SrcSection); @@ -4454,16 +4040,14 @@ INT BcmCopySection(struct bcm_mini_adapter *Adapter, } if ((offset + numOfBytes) > BcmGetSectionValEndOffset(Adapter, SrcSection) - - BcmGetSectionValStartOffset(Adapter, SrcSection)) - { + - BcmGetSectionValStartOffset(Adapter, SrcSection)) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, " Input parameters going beyond the section offS: %x numB: %x of Source Section\n", offset, numOfBytes); return -EINVAL; } if ((offset + numOfBytes) > BcmGetSectionValEndOffset(Adapter, DstSection) - - BcmGetSectionValStartOffset(Adapter, DstSection)) - { + - BcmGetSectionValStartOffset(Adapter, DstSection)) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Input parameters going beyond the section offS: %x numB: %x of Destination Section\n", offset, numOfBytes); return -EINVAL; @@ -4475,8 +4059,7 @@ INT BcmCopySection(struct bcm_mini_adapter *Adapter, BuffSize = numOfBytes; pBuff = (PCHAR)kzalloc(BuffSize, GFP_KERNEL); - if (pBuff == NULL) - { + if (pBuff == NULL) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Memory allocation failed.. "); return -ENOMEM; } @@ -4489,24 +4072,20 @@ INT BcmCopySection(struct bcm_mini_adapter *Adapter, Adapter->bHeaderChangeAllowed = TRUE; - do - { + do { Status = BcmFlash2xBulkRead(Adapter, (PUINT)pBuff, SrcSection , offset, BytesToBeCopied); - if (Status) - { + if (Status) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Read failed at offset :%d for NOB :%d", SrcSection, BytesToBeCopied); break; } Status = BcmFlash2xBulkWrite(Adapter, (PUINT)pBuff, DstSection, offset, BytesToBeCopied, FALSE); - if (Status) - { + if (Status) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Write failed at offset :%d for NOB :%d", DstSection, BytesToBeCopied); break; } offset = offset + BytesToBeCopied; numOfBytes = numOfBytes - BytesToBeCopied; - if (numOfBytes) - { + if (numOfBytes) { if (numOfBytes > Adapter->uiSectorSize) BytesToBeCopied = Adapter->uiSectorSize; else @@ -4545,8 +4124,7 @@ INT SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, UINT uiO if ((uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter, DSD2) - Adapter->uiSectorSize) || (uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter, DSD1) - Adapter->uiSectorSize) || - (uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter, DSD0) - Adapter->uiSectorSize)) - { + (uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter, DSD0) - Adapter->uiSectorSize)) { // offset from the sector boundary having the header map offsetToProtect = Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader % Adapter->uiSectorSize; HeaderSizeToProtect = sizeof(DSD_HEADER); @@ -4554,18 +4132,15 @@ INT SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, UINT uiO } if (uiSectAlignAddr == BcmGetSectionValStartOffset(Adapter, ISO_IMAGE1) || - uiSectAlignAddr == BcmGetSectionValStartOffset(Adapter, ISO_IMAGE2)) - { + uiSectAlignAddr == BcmGetSectionValStartOffset(Adapter, ISO_IMAGE2)) { offsetToProtect = 0; HeaderSizeToProtect = sizeof(ISO_HEADER); bHasHeader = TRUE; } // If Header is present overwrite passed buffer with this - if (bHasHeader && (Adapter->bHeaderChangeAllowed == FALSE)) - { + if (bHasHeader && (Adapter->bHeaderChangeAllowed == FALSE)) { pTempBuff = (PUCHAR)kzalloc(HeaderSizeToProtect, GFP_KERNEL); - if (pTempBuff == NULL) - { + if (pTempBuff == NULL) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Memory allocation failed"); return -ENOMEM; } @@ -4577,12 +4152,10 @@ INT SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, UINT uiO kfree(pTempBuff); } - if (bHasHeader && Adapter->bSigCorrupted) - { + if (bHasHeader && Adapter->bSigCorrupted) { sig = *((PUINT)(pBuff + offsetToProtect + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImageMagicNumber))); sig = ntohl(sig); - if ((sig & 0xFF000000) != CORRUPTED_PATTERN) - { + if ((sig & 0xFF000000) != CORRUPTED_PATTERN) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Desired pattern is not at sig offset. Hence won't restore"); Adapter->bSigCorrupted = FALSE; return STATUS_SUCCESS; @@ -4637,23 +4210,22 @@ static INT BcmDoChipSelect(struct bcm_mini_adapter *Adapter, UINT offset) rdmalt(Adapter, FLASH_CONFIG_REG, &FlashConfig, 4); rdmalt(Adapter, FLASH_GPIO_CONFIG_REG, &GPIOConfig, 4); { - switch (ChipNum) - { - case 0: - PartNum = 0; - break; - case 1: - PartNum = 3; - GPIOConfig |= (0x4 << CHIP_SELECT_BIT12); - break; - case 2: - PartNum = 1; - GPIOConfig |= (0x1 << CHIP_SELECT_BIT12); - break; - case 3: - PartNum = 2; - GPIOConfig |= (0x2 << CHIP_SELECT_BIT12); - break; + switch (ChipNum) { + case 0: + PartNum = 0; + break; + case 1: + PartNum = 3; + GPIOConfig |= (0x4 << CHIP_SELECT_BIT12); + break; + case 2: + PartNum = 1; + GPIOConfig |= (0x1 << CHIP_SELECT_BIT12); + break; + case 3: + PartNum = 2; + GPIOConfig |= (0x2 << CHIP_SELECT_BIT12); + break; } } /* In case the bits already written in the FLASH_CONFIG_REG is same as what the user desired, @@ -4687,8 +4259,7 @@ INT ReadDSDSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL dsd) //sigoffsetInMap =(PUCHAR)&(dsdHeader.DSDImageMagicNumber) -(PUCHAR)&dsdHeader; - if (dsd != DSD0 && dsd != DSD1 && dsd != DSD2) - { + if (dsd != DSD0 && dsd != DSD1 && dsd != DSD2) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "passed section value is not for DSDs"); return STATUS_FAILURE; } @@ -4710,10 +4281,8 @@ INT ReadDSDPriority(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL dsd) unsigned int uiDSDPri = STATUS_FAILURE; // DSD_HEADER dsdHeader = {0}; // priOffsetInMap = (PUCHAR)&(dsdHeader.DSDImagePriority) -(PUCHAR)&dsdHeader; - if (IsSectionWritable(Adapter, dsd)) - { - if (ReadDSDSignature(Adapter, dsd) == DSD_IMAGE_MAGIC_NUMBER) - { + if (IsSectionWritable(Adapter, dsd)) { + if (ReadDSDSignature(Adapter, dsd) == DSD_IMAGE_MAGIC_NUMBER) { BcmFlash2xBulkRead(Adapter, &uiDSDPri, dsd, @@ -4734,27 +4303,22 @@ FLASH2X_SECTION_VAL getHighestPriDSD(struct bcm_mini_adapter *Adapter) INT DsdPri = 0; FLASH2X_SECTION_VAL HighestPriDSD = 0; - if (IsSectionWritable(Adapter, DSD2)) - { + if (IsSectionWritable(Adapter, DSD2)) { DSDHighestPri = ReadDSDPriority(Adapter, DSD2); HighestPriDSD = DSD2; } - if (IsSectionWritable(Adapter, DSD1)) - { + if (IsSectionWritable(Adapter, DSD1)) { DsdPri = ReadDSDPriority(Adapter, DSD1); - if (DSDHighestPri < DsdPri) - { + if (DSDHighestPri < DsdPri) { DSDHighestPri = DsdPri; HighestPriDSD = DSD1; } } - if (IsSectionWritable(Adapter, DSD0)) - { + if (IsSectionWritable(Adapter, DSD0)) { DsdPri = ReadDSDPriority(Adapter, DSD0); - if (DSDHighestPri < DsdPri) - { + if (DSDHighestPri < DsdPri) { DSDHighestPri = DsdPri; HighestPriDSD = DSD0; } @@ -4772,8 +4336,7 @@ INT ReadISOSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL iso) //ISO_HEADER ISOHeader = {0}; //sigoffsetInMap =(PUCHAR)&(ISOHeader.ISOImageMagicNumber) -(PUCHAR)&ISOHeader; - if (iso != ISO_IMAGE1 && iso != ISO_IMAGE2) - { + if (iso != ISO_IMAGE1 && iso != ISO_IMAGE2) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "passed section value is not for ISOs"); return STATUS_FAILURE; } @@ -4792,10 +4355,8 @@ INT ReadISOSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL iso) INT ReadISOPriority(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL iso) { unsigned int ISOPri = STATUS_FAILURE; - if (IsSectionWritable(Adapter, iso)) - { - if (ReadISOSignature(Adapter, iso) == ISO_IMAGE_MAGIC_NUMBER) - { + if (IsSectionWritable(Adapter, iso)) { + if (ReadISOSignature(Adapter, iso) == ISO_IMAGE_MAGIC_NUMBER) { BcmFlash2xBulkRead(Adapter, &ISOPri, iso, @@ -4816,17 +4377,14 @@ FLASH2X_SECTION_VAL getHighestPriISO(struct bcm_mini_adapter *Adapter) INT ISOPri = 0; FLASH2X_SECTION_VAL HighestPriISO = NO_SECTION_VAL; - if (IsSectionWritable(Adapter, ISO_IMAGE2)) - { + if (IsSectionWritable(Adapter, ISO_IMAGE2)) { ISOHighestPri = ReadISOPriority(Adapter, ISO_IMAGE2); HighestPriISO = ISO_IMAGE2; } - if (IsSectionWritable(Adapter, ISO_IMAGE1)) - { + if (IsSectionWritable(Adapter, ISO_IMAGE1)) { ISOPri = ReadISOPriority(Adapter, ISO_IMAGE1); - if (ISOHighestPri < ISOPri) - { + if (ISOHighestPri < ISOPri) { ISOHighestPri = ISOPri; HighestPriISO = ISO_IMAGE1; } @@ -4853,8 +4411,7 @@ INT WriteToFlashWithoutSectorErase(struct bcm_mini_adapter *Adapter, INT Status = STATUS_SUCCESS; PUCHAR pcBuff = (PUCHAR)pBuff; - if (uiNumBytes % Adapter->ulFlashWriteSize) - { + if (uiNumBytes % Adapter->ulFlashWriteSize) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Writing without Sector Erase for non-FlashWriteSize number of bytes 0x%x\n", uiNumBytes); return STATUS_FAILURE; } @@ -4862,9 +4419,7 @@ INT WriteToFlashWithoutSectorErase(struct bcm_mini_adapter *Adapter, uiStartOffset = BcmGetSectionValStartOffset(Adapter, eFlash2xSectionVal); if (IsSectionExistInVendorInfo(Adapter, eFlash2xSectionVal)) - { return vendorextnWriteSectionWithoutErase(Adapter, pcBuff, eFlash2xSectionVal, uiOffset, uiNumBytes); - } uiOffset = uiOffset + uiStartOffset; @@ -4879,8 +4434,7 @@ INT WriteToFlashWithoutSectorErase(struct bcm_mini_adapter *Adapter, BcmDoChipSelect(Adapter, uiOffset); uiPartOffset = (uiOffset & (FLASH_PART_SIZE - 1)) + GetFlashBaseAddr(Adapter); - for (i = 0 ; i < uiNumBytes; i += Adapter->ulFlashWriteSize) - { + for (i = 0 ; i < uiNumBytes; i += Adapter->ulFlashWriteSize) { if (Adapter->ulFlashWriteSize == BYTE_WRITE_SUPPORT) Status = flashByteWrite(Adapter, uiPartOffset, pcBuff); else @@ -4903,53 +4457,52 @@ BOOLEAN IsSectionExistInFlash(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_ { BOOLEAN SectionPresent = FALSE; - switch (section) - { - case ISO_IMAGE1: - if ((Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start != UNINIT_PTR_IN_CS) && - (IsNonCDLessDevice(Adapter) == FALSE)) - SectionPresent = TRUE; - break; - case ISO_IMAGE2: - if ((Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start != UNINIT_PTR_IN_CS) && - (IsNonCDLessDevice(Adapter) == FALSE)) - SectionPresent = TRUE; - break; - case DSD0: - if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart != UNINIT_PTR_IN_CS) - SectionPresent = TRUE; - break; - case DSD1: - if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start != UNINIT_PTR_IN_CS) - SectionPresent = TRUE; - break; - case DSD2: - if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start != UNINIT_PTR_IN_CS) - SectionPresent = TRUE; - break; - case VSA0: - if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart != UNINIT_PTR_IN_CS) - SectionPresent = TRUE; - break; - case VSA1: - if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start != UNINIT_PTR_IN_CS) - SectionPresent = TRUE; - break; - case VSA2: - if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start != UNINIT_PTR_IN_CS) - SectionPresent = TRUE; - break; - case SCSI: - if (Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware != UNINIT_PTR_IN_CS) - SectionPresent = TRUE; - break; - case CONTROL_SECTION: - if (Adapter->psFlash2xCSInfo->OffsetFromZeroForControlSectionStart != UNINIT_PTR_IN_CS) - SectionPresent = TRUE; - break; - default: - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Section Does not exist in Flash 2.x"); - SectionPresent = FALSE; + switch (section) { + case ISO_IMAGE1: + if ((Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start != UNINIT_PTR_IN_CS) && + (IsNonCDLessDevice(Adapter) == FALSE)) + SectionPresent = TRUE; + break; + case ISO_IMAGE2: + if ((Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start != UNINIT_PTR_IN_CS) && + (IsNonCDLessDevice(Adapter) == FALSE)) + SectionPresent = TRUE; + break; + case DSD0: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart != UNINIT_PTR_IN_CS) + SectionPresent = TRUE; + break; + case DSD1: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start != UNINIT_PTR_IN_CS) + SectionPresent = TRUE; + break; + case DSD2: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start != UNINIT_PTR_IN_CS) + SectionPresent = TRUE; + break; + case VSA0: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart != UNINIT_PTR_IN_CS) + SectionPresent = TRUE; + break; + case VSA1: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start != UNINIT_PTR_IN_CS) + SectionPresent = TRUE; + break; + case VSA2: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start != UNINIT_PTR_IN_CS) + SectionPresent = TRUE; + break; + case SCSI: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware != UNINIT_PTR_IN_CS) + SectionPresent = TRUE; + break; + case CONTROL_SECTION: + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForControlSectionStart != UNINIT_PTR_IN_CS) + SectionPresent = TRUE; + break; + default: + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Section Does not exist in Flash 2.x"); + SectionPresent = FALSE; } return SectionPresent; @@ -4960,23 +4513,19 @@ INT IsSectionWritable(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL Sect INT offset = STATUS_FAILURE; INT Status = FALSE; - if (IsSectionExistInFlash(Adapter, Section) == FALSE) - { + if (IsSectionExistInFlash(Adapter, Section) == FALSE) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Section <%d> does not exixt", Section); return FALSE; } offset = BcmGetSectionValStartOffset(Adapter, Section); - if (offset == INVALID_OFFSET) - { + if (offset == INVALID_OFFSET) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Section<%d> does not exixt", Section); return FALSE; } if (IsSectionExistInVendorInfo(Adapter, Section)) - { return !(Adapter->psFlash2xVendorInfo->VendorSection[Section].AccessFlags & FLASH2X_SECTION_RO); - } Status = IsOffsetWritable(Adapter, offset); return Status; @@ -4991,18 +4540,15 @@ static INT CorruptDSDSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL e UINT uiSectAlignAddr = 0; Adapter->bSigCorrupted = FALSE; - if (Adapter->bAllDSDWriteAllow == FALSE) - { - if (IsSectionWritable(Adapter, eFlash2xSectionVal) != TRUE) - { + if (Adapter->bAllDSDWriteAllow == FALSE) { + if (IsSectionWritable(Adapter, eFlash2xSectionVal) != TRUE) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Section is not Writable...Hence can't Corrupt signature"); return SECTOR_IS_NOT_WRITABLE; } } pBuff = (PUCHAR)kzalloc(MAX_RW_SIZE, GFP_KERNEL); - if (pBuff == NULL) - { + if (pBuff == NULL) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Can't allocate memorey"); return -ENOMEM; } @@ -5018,30 +4564,23 @@ static INT CorruptDSDSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL e // Now corrupting the sig by corrupting 4th last Byte. *(pBuff + 12) = 0; - if (sig == DSD_IMAGE_MAGIC_NUMBER) - { + if (sig == DSD_IMAGE_MAGIC_NUMBER) { Adapter->bSigCorrupted = TRUE; - if (Adapter->ulFlashWriteSize == BYTE_WRITE_SUPPORT) - { + if (Adapter->ulFlashWriteSize == BYTE_WRITE_SUPPORT) { uiSectAlignAddr = uiOffset & ~(Adapter->uiSectorSize - 1); BlockStatus = BcmFlashUnProtectBlock(Adapter, uiSectAlignAddr, Adapter->uiSectorSize); WriteToFlashWithoutSectorErase(Adapter, (PUINT)(pBuff + 12), eFlash2xSectionVal, (uiOffset + 12), BYTE_WRITE_SUPPORT); - if (BlockStatus) - { + if (BlockStatus) { BcmRestoreBlockProtectStatus(Adapter, BlockStatus); BlockStatus = 0; } - } - else - { + } else { WriteToFlashWithoutSectorErase(Adapter, (PUINT)pBuff, eFlash2xSectionVal, uiOffset, MAX_RW_SIZE); } - } - else - { + } else { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "BCM Signature is not present in header"); kfree(pBuff); @@ -5062,15 +4601,13 @@ static INT CorruptISOSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL e Adapter->bSigCorrupted = FALSE; - if (IsSectionWritable(Adapter, eFlash2xSectionVal) != TRUE) - { + if (IsSectionWritable(Adapter, eFlash2xSectionVal) != TRUE) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Section is not Writable...Hence can't Corrupt signature"); return SECTOR_IS_NOT_WRITABLE; } pBuff = (PUCHAR)kzalloc(MAX_RW_SIZE, GFP_KERNEL); - if (pBuff == NULL) - { + if (pBuff == NULL) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Can't allocate memorey"); return -ENOMEM; } @@ -5085,14 +4622,11 @@ static INT CorruptISOSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL e // corrupt signature *pBuff = 0; - if (sig == ISO_IMAGE_MAGIC_NUMBER) - { + if (sig == ISO_IMAGE_MAGIC_NUMBER) { Adapter->bSigCorrupted = TRUE; WriteToFlashWithoutSectorErase(Adapter, (PUINT)pBuff, eFlash2xSectionVal, uiOffset, Adapter->ulFlashWriteSize); - } - else - { + } else { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "BCM Signature is not present in header"); kfree(pBuff); -- cgit v0.10.2 From de443c96e5e62c5c32ae6fdfc44e12470bbf70b3 Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Wed, 6 Jun 2012 22:54:29 -0400 Subject: Staging: bcm: Correctly format all comments in nvm.c This patch correctly formats all comments as reported by checkpatch.pl. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/nvm.c b/drivers/staging/bcm/nvm.c index 66001fc..cfc0458 100644 --- a/drivers/staging/bcm/nvm.c +++ b/drivers/staging/bcm/nvm.c @@ -51,17 +51,15 @@ static INT GetFlashBaseAddr(struct bcm_mini_adapter *Adapter); static INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, UINT dwAddress, UINT *pdwData, UINT dwNumData); -// Procedure: ReadEEPROMStatusRegister -// -// Description: Reads the standard EEPROM Status Register. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- - +/* Procedure: ReadEEPROMStatusRegister + * + * Description: Reads the standard EEPROM Status Register. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * Returns: + * OSAL_STATUS_CODE + */ static UCHAR ReadEEPROMStatusRegister(struct bcm_mini_adapter *Adapter) { UCHAR uiData = 0; @@ -110,19 +108,19 @@ static UCHAR ReadEEPROMStatusRegister(struct bcm_mini_adapter *Adapter) return uiData; } /* ReadEEPROMStatusRegister */ -//----------------------------------------------------------------------------- -// Procedure: ReadBeceemEEPROMBulk -// -// Description: This routine reads 16Byte data from EEPROM -// -// Arguments: -// Adapter - ptr to Adapter object instance -// dwAddress - EEPROM Offset to read the data from. -// pdwData - Pointer to double word where data needs to be stored in. // dwNumWords - Number of words. Valid values are 4 ONLY. -// -// Returns: -// OSAL_STATUS_CODE: -//----------------------------------------------------------------------------- +/* + * Procedure: ReadBeceemEEPROMBulk + * + * Description: This routine reads 16Byte data from EEPROM + * + * Arguments: + * Adapter - ptr to Adapter object instance + * dwAddress - EEPROM Offset to read the data from. + * pdwData - Pointer to double word where data needs to be stored in. // dwNumWords - Number of words. Valid values are 4 ONLY. + * + * Returns: + * OSAL_STATUS_CODE: + */ INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, DWORD dwAddress, @@ -159,7 +157,8 @@ INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, /* If we are reading 16 bytes we want to be sure that the queue * is full before we read. In the other cases we are ok if the - * queue has data available */ + * queue has data available + */ if (dwNumWords == 4) { if ((uiStatus & EEPROM_READ_DATA_FULL) != 0) { /* Clear the Avail/Full bits - which ever is set. */ @@ -170,7 +169,8 @@ INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, } else if (dwNumWords == 1) { if ((uiStatus & EEPROM_READ_DATA_AVAIL) != 0) { /* We just got Avail and we have to read 32bits so we - * need this sleep for Cardbus kind of devices. */ + * need this sleep for Cardbus kind of devices. + */ if (Adapter->chip_id == 0xBECE0210) udelay(800); @@ -226,20 +226,20 @@ INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, return STATUS_SUCCESS; } /* ReadBeceemEEPROMBulk() */ -//----------------------------------------------------------------------------- -// Procedure: ReadBeceemEEPROM -// -// Description: This routine reads 4 data from EEPROM. It uses 1 or 2 page -// reads to do this operation. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// uiOffset - EEPROM Offset to read the data from. -// pBuffer - Pointer to word where data needs to be stored in. -// -// Returns: -// OSAL_STATUS_CODE: -//----------------------------------------------------------------------------- +/* + * Procedure: ReadBeceemEEPROM + * + * Description: This routine reads 4 data from EEPROM. It uses 1 or 2 page + * reads to do this operation. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * uiOffset - EEPROM Offset to read the data from. + * pBuffer - Pointer to word where data needs to be stored in. + * + * Returns: + * OSAL_STATUS_CODE: + */ INT ReadBeceemEEPROM(struct bcm_mini_adapter *Adapter, DWORD uiOffset, @@ -257,7 +257,8 @@ INT ReadBeceemEEPROM(struct bcm_mini_adapter *Adapter, ReadBeceemEEPROMBulk(Adapter, uiTempOffset, (PUINT)&uiData[0], 4); /* A word can overlap at most over 2 pages. In that case we read the - * next page too. */ + * next page too. + */ if (uiByteOffset > 12) ReadBeceemEEPROMBulk(Adapter, uiTempOffset + MAX_RW_SIZE, (PUINT)&uiData[4], 4); @@ -282,21 +283,21 @@ INT ReadMacAddressFromNVM(struct bcm_mini_adapter *Adapter) return Status; } -//----------------------------------------------------------------------------- -// Procedure: BeceemEEPROMBulkRead -// -// Description: Reads the EEPROM and returns the Data. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// pBuffer - Buffer to store the data read from EEPROM -// uiOffset - Offset of EEPROM from where data should be read -// uiNumBytes - Number of bytes to be read from the EEPROM. -// -// Returns: -// OSAL_STATUS_SUCCESS - if EEPROM read is successful. -// - if failed. -//----------------------------------------------------------------------------- +/* + * Procedure: BeceemEEPROMBulkRead + * + * Description: Reads the EEPROM and returns the Data. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * pBuffer - Buffer to store the data read from EEPROM + * uiOffset - Offset of EEPROM from where data should be read + * uiNumBytes - Number of bytes to be read from the EEPROM. + * + * Returns: + * OSAL_STATUS_SUCCESS - if EEPROM read is successful. + * - if failed. + */ INT BeceemEEPROMBulkRead(struct bcm_mini_adapter *Adapter, PUINT pBuffer, @@ -304,7 +305,7 @@ INT BeceemEEPROMBulkRead(struct bcm_mini_adapter *Adapter, UINT uiNumBytes) { UINT uiData[4] = {0}; - // UINT uiAddress = 0; + /* UINT uiAddress = 0; */ UINT uiBytesRemaining = uiNumBytes; UINT uiIndex = 0; UINT uiTempOffset = 0; @@ -336,7 +337,8 @@ INT BeceemEEPROMBulkRead(struct bcm_mini_adapter *Adapter, if (uiBytesRemaining >= MAX_RW_SIZE) { /* For the requests more than or equal to 16 bytes, use bulk * read function to make the access faster. - * We read 4 Dwords of data */ + * We read 4 Dwords of data + */ if (0 == ReadBeceemEEPROMBulk(Adapter, uiOffset, &uiData[0], 4)) { memcpy(pcBuff + uiIndex, &uiData[0], MAX_RW_SIZE); uiOffset += MAX_RW_SIZE; @@ -344,7 +346,7 @@ INT BeceemEEPROMBulkRead(struct bcm_mini_adapter *Adapter, uiIndex += MAX_RW_SIZE; } else { uiFailureRetries++; - mdelay(3); //sleep for a while before retry... + mdelay(3); /* sleep for a while before retry... */ } } else if (uiBytesRemaining >= 4) { if (0 == ReadBeceemEEPROM(Adapter, uiOffset, &uiData[0])) { @@ -354,18 +356,18 @@ INT BeceemEEPROMBulkRead(struct bcm_mini_adapter *Adapter, uiIndex += 4; } else { uiFailureRetries++; - mdelay(3); //sleep for a while before retry... + mdelay(3); /* sleep for a while before retry... */ } } else { - // Handle the reads less than 4 bytes... + /* Handle the reads less than 4 bytes... */ PUCHAR pCharBuff = (PUCHAR)pBuffer; pCharBuff += uiIndex; if (0 == ReadBeceemEEPROM(Adapter, uiOffset, &uiData[0])) { - memcpy(pCharBuff, &uiData[0], uiBytesRemaining); //copy only bytes requested. + memcpy(pCharBuff, &uiData[0], uiBytesRemaining); /* copy only bytes requested. */ uiBytesRemaining = 0; } else { uiFailureRetries++; - mdelay(3); //sleep for a while before retry... + mdelay(3); /* sleep for a while before retry... */ } } } @@ -373,21 +375,21 @@ INT BeceemEEPROMBulkRead(struct bcm_mini_adapter *Adapter, return 0; } -//----------------------------------------------------------------------------- -// Procedure: BeceemFlashBulkRead -// -// Description: Reads the FLASH and returns the Data. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// pBuffer - Buffer to store the data read from FLASH -// uiOffset - Offset of FLASH from where data should be read -// uiNumBytes - Number of bytes to be read from the FLASH. -// -// Returns: -// OSAL_STATUS_SUCCESS - if FLASH read is successful. -// - if failed. -//----------------------------------------------------------------------------- +/* + * Procedure: BeceemFlashBulkRead + * + * Description: Reads the FLASH and returns the Data. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * pBuffer - Buffer to store the data read from FLASH + * uiOffset - Offset of FLASH from where data should be read + * uiNumBytes - Number of bytes to be read from the FLASH. + * + * Returns: + * OSAL_STATUS_SUCCESS - if FLASH read is successful. + * - if failed. + */ static INT BeceemFlashBulkRead(struct bcm_mini_adapter *Adapter, PUINT pBuffer, @@ -405,8 +407,9 @@ static INT BeceemFlashBulkRead(struct bcm_mini_adapter *Adapter, return -ENODEV; } - // Adding flash Base address - // uiOffset = uiOffset + GetFlashBaseAddr(Adapter); + /* Adding flash Base address + * uiOffset = uiOffset + GetFlashBaseAddr(Adapter); + */ #if defined(BCM_SHM_INTERFACE) && !defined(FLASH_DIRECT_ACCESS) Status = bcmflash_raw_read((uiOffset/FLASH_PART_SIZE), (uiOffset % FLASH_PART_SIZE), (unsigned char *)pBuffer, uiNumBytes); return Status; @@ -453,18 +456,18 @@ static INT BeceemFlashBulkRead(struct bcm_mini_adapter *Adapter, return Status; } -//----------------------------------------------------------------------------- -// Procedure: BcmGetFlashSize -// -// Description: Finds the size of FLASH. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// -// Returns: -// UINT - size of the FLASH Storage. -// -//----------------------------------------------------------------------------- +/* + * Procedure: BcmGetFlashSize + * + * Description: Finds the size of FLASH. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * + * Returns: + * UINT - size of the FLASH Storage. + * + */ static UINT BcmGetFlashSize(struct bcm_mini_adapter *Adapter) { @@ -474,32 +477,32 @@ static UINT BcmGetFlashSize(struct bcm_mini_adapter *Adapter) return 32 * 1024; } -//----------------------------------------------------------------------------- -// Procedure: BcmGetEEPROMSize -// -// Description: Finds the size of EEPROM. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// -// Returns: -// UINT - size of the EEPROM Storage. -// -//----------------------------------------------------------------------------- +/* + * Procedure: BcmGetEEPROMSize + * + * Description: Finds the size of EEPROM. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * + * Returns: + * UINT - size of the EEPROM Storage. + * + */ static UINT BcmGetEEPROMSize(struct bcm_mini_adapter *Adapter) { UINT uiData = 0; UINT uiIndex = 0; - // - // if EEPROM is present and already Calibrated,it will have - // 'BECM' string at 0th offset. - // To find the EEPROM size read the possible boundaries of the - // EEPROM like 4K,8K etc..accessing the EEPROM beyond its size will - // result in wrap around. So when we get the End of the EEPROM we will - // get 'BECM' string which is indeed at offset 0. - // + /* + * if EEPROM is present and already Calibrated,it will have + * 'BECM' string at 0th offset. + * To find the EEPROM size read the possible boundaries of the + * EEPROM like 4K,8K etc..accessing the EEPROM beyond its size will + * result in wrap around. So when we get the End of the EEPROM we will + * get 'BECM' string which is indeed at offset 0. + */ BeceemEEPROMBulkRead(Adapter, &uiData, 0x0, 4); if (uiData == BECM) { for (uiIndex = 2; uiIndex <= 256; uiIndex *= 2) { @@ -508,9 +511,9 @@ static UINT BcmGetEEPROMSize(struct bcm_mini_adapter *Adapter) return uiIndex * 1024; } } else { - // - // EEPROM may not be present or not programmed - // + /* + * EEPROM may not be present or not programmed + */ uiData = 0xBABEFACE; if (0 == BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&uiData, 0, 4, TRUE)) { uiData = 0; @@ -524,20 +527,20 @@ static UINT BcmGetEEPROMSize(struct bcm_mini_adapter *Adapter) return 0; } -//----------------------------------------------------------------------------- -// Procedure: FlashSectorErase -// -// Description: Finds the sector size of the FLASH. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// addr - sector start address -// numOfSectors - number of sectors to be erased. -// -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/* + * Procedure: FlashSectorErase + * + * Description: Finds the sector size of the FLASH. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * addr - sector start address + * numOfSectors - number of sectors to be erased. + * + * Returns: + * OSAL_STATUS_CODE + * + */ static INT FlashSectorErase(struct bcm_mini_adapter *Adapter, UINT addr, @@ -570,9 +573,10 @@ static INT FlashSectorErase(struct bcm_mini_adapter *Adapter, return uiStatus; } iRetries++; - // After every try lets make the CPU free for 10 ms. generally time taken by the - // the sector erase cycle is 500 ms to 40000 msec. hence sleeping 10 ms - // won't hamper performance in any case. + /* After every try lets make the CPU free for 10 ms. generally time taken by the + * the sector erase cycle is 500 ms to 40000 msec. hence sleeping 10 ms + * won't hamper performance in any case. + */ msleep(10); } while ((uiStatus & 0x1) && (iRetries < 400)); @@ -585,38 +589,38 @@ static INT FlashSectorErase(struct bcm_mini_adapter *Adapter, } return 0; } -//----------------------------------------------------------------------------- -// Procedure: flashByteWrite -// -// Description: Performs Byte by Byte write to flash -// -// Arguments: -// Adapter - ptr to Adapter object instance -// uiOffset - Offset of the flash where data needs to be written to. -// pData - Address of Data to be written. -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/* + * Procedure: flashByteWrite + * + * Description: Performs Byte by Byte write to flash + * + * Arguments: + * Adapter - ptr to Adapter object instance + * uiOffset - Offset of the flash where data needs to be written to. + * pData - Address of Data to be written. + * Returns: + * OSAL_STATUS_CODE + * + */ static INT flashByteWrite(struct bcm_mini_adapter *Adapter, UINT uiOffset, PVOID pData) { UINT uiStatus = 0; - INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; //3 + INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; /* 3 */ UINT value; ULONG ulData = *(PUCHAR)pData; int bytes; - // - // need not write 0xFF because write requires an erase and erase will - // make whole sector 0xFF. - // + /* + * need not write 0xFF because write requires an erase and erase will + * make whole sector 0xFF. + */ if (0xFF == ulData) return STATUS_SUCCESS; - // DumpDebug(NVM_RW,("flashWrite ====>\n")); + /* DumpDebug(NVM_RW,("flashWrite ====>\n")); */ value = (FLASH_CMD_WRITE_ENABLE << 24); if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Write enable in FLASH_SPI_CMDQ_REG register fails"); @@ -633,7 +637,7 @@ static INT flashByteWrite(struct bcm_mini_adapter *Adapter, return STATUS_FAILURE; } - //__udelay(950); + /* __udelay(950); */ do { value = (FLASH_CMD_STATUS_REG_READ << 24); @@ -641,7 +645,7 @@ static INT flashByteWrite(struct bcm_mini_adapter *Adapter, BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Programing of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; } - //__udelay(1); + /* __udelay(1); */ bytes = rdmalt(Adapter, FLASH_SPI_READQ_REG, &uiStatus, sizeof(uiStatus)); if (bytes < 0) { uiStatus = bytes; @@ -662,37 +666,37 @@ static INT flashByteWrite(struct bcm_mini_adapter *Adapter, return STATUS_SUCCESS; } -//----------------------------------------------------------------------------- -// Procedure: flashWrite -// -// Description: Performs write to flash -// -// Arguments: -// Adapter - ptr to Adapter object instance -// uiOffset - Offset of the flash where data needs to be written to. -// pData - Address of Data to be written. -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/* + * Procedure: flashWrite + * + * Description: Performs write to flash + * + * Arguments: + * Adapter - ptr to Adapter object instance + * uiOffset - Offset of the flash where data needs to be written to. + * pData - Address of Data to be written. + * Returns: + * OSAL_STATUS_CODE + * + */ static INT flashWrite(struct bcm_mini_adapter *Adapter, UINT uiOffset, PVOID pData) { - //UINT uiStatus = 0; - //INT iRetries = 0; - //UINT uiReadBack = 0; - + /* UINT uiStatus = 0; + * INT iRetries = 0; + * UINT uiReadBack = 0; + */ UINT uiStatus = 0; - INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; //3 + INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; /* 3 */ UINT value; UINT uiErasePattern[4] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; int bytes; - // - // need not write 0xFFFFFFFF because write requires an erase and erase will - // make whole sector 0xFFFFFFFF. - // + /* + * need not write 0xFFFFFFFF because write requires an erase and erase will + * make whole sector 0xFFFFFFFF. + */ if (!memcmp(pData, uiErasePattern, MAX_RW_SIZE)) return 0; @@ -708,14 +712,14 @@ static INT flashWrite(struct bcm_mini_adapter *Adapter, return STATUS_FAILURE; } - //__udelay(950); + /* __udelay(950); */ do { value = (FLASH_CMD_STATUS_REG_READ << 24); if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Programing of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; } - //__udelay(1); + /* __udelay(1); */ bytes = rdmalt(Adapter, FLASH_SPI_READQ_REG, &uiStatus, sizeof(uiStatus)); if (bytes < 0) { uiStatus = bytes; @@ -724,10 +728,11 @@ static INT flashWrite(struct bcm_mini_adapter *Adapter, } iRetries--; - //this will ensure that in there will be no changes in the current path. - //currently one rdm/wrm takes 125 us. - //Hence 125 *2 * FLASH_PER_RETRIES_DELAY > 3 ms(worst case delay) - //Hence current implementation cycle will intoduce no delay in current path + /* this will ensure that in there will be no changes in the current path. + * currently one rdm/wrm takes 125 us. + * Hence 125 *2 * FLASH_PER_RETRIES_DELAY > 3 ms(worst case delay) + * Hence current implementation cycle will intoduce no delay in current path + */ if (iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) msleep(1); } while ((uiStatus & 0x1) && (iRetries > 0)); @@ -740,38 +745,38 @@ static INT flashWrite(struct bcm_mini_adapter *Adapter, return STATUS_SUCCESS; } -//----------------------------------------------------------------------------- -// Procedure: flashByteWriteStatus -// -// Description: Performs byte by byte write to flash with write done status check -// -// Arguments: -// Adapter - ptr to Adapter object instance -// uiOffset - Offset of the flash where data needs to be written to. -// pData - Address of the Data to be written. -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/*----------------------------------------------------------------------------- + * Procedure: flashByteWriteStatus + * + * Description: Performs byte by byte write to flash with write done status check + * + * Arguments: + * Adapter - ptr to Adapter object instance + * uiOffset - Offset of the flash where data needs to be written to. + * pData - Address of the Data to be written. + * Returns: + * OSAL_STATUS_CODE + * + */ static INT flashByteWriteStatus(struct bcm_mini_adapter *Adapter, UINT uiOffset, PVOID pData) { UINT uiStatus = 0; - INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; //3 + INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; /* 3 */ ULONG ulData = *(PUCHAR)pData; UINT value; int bytes; - // - // need not write 0xFFFFFFFF because write requires an erase and erase will - // make whole sector 0xFFFFFFFF. - // + /* + * need not write 0xFFFFFFFF because write requires an erase and erase will + * make whole sector 0xFFFFFFFF. + */ if (0xFF == ulData) return STATUS_SUCCESS; - // DumpDebug(NVM_RW,("flashWrite ====>\n")); + /* DumpDebug(NVM_RW,("flashWrite ====>\n")); */ value = (FLASH_CMD_WRITE_ENABLE << 24); if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { @@ -788,7 +793,7 @@ static INT flashByteWriteStatus(struct bcm_mini_adapter *Adapter, return STATUS_FAILURE; } - //msleep(1); + /* msleep(1); */ do { value = (FLASH_CMD_STATUS_REG_READ << 24); @@ -796,7 +801,7 @@ static INT flashByteWriteStatus(struct bcm_mini_adapter *Adapter, BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Programing of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; } - //__udelay(1); + /* __udelay(1); */ bytes = rdmalt(Adapter, FLASH_SPI_READQ_REG, &uiStatus, sizeof(uiStatus)); if (bytes < 0) { uiStatus = bytes; @@ -817,35 +822,35 @@ static INT flashByteWriteStatus(struct bcm_mini_adapter *Adapter, return STATUS_SUCCESS; } -//----------------------------------------------------------------------------- -// Procedure: flashWriteStatus -// -// Description: Performs write to flash with write done status check -// -// Arguments: -// Adapter - ptr to Adapter object instance -// uiOffset - Offset of the flash where data needs to be written to. -// pData - Address of the Data to be written. -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/* + * Procedure: flashWriteStatus + * + * Description: Performs write to flash with write done status check + * + * Arguments: + * Adapter - ptr to Adapter object instance + * uiOffset - Offset of the flash where data needs to be written to. + * pData - Address of the Data to be written. + * Returns: + * OSAL_STATUS_CODE + * + */ static INT flashWriteStatus(struct bcm_mini_adapter *Adapter, UINT uiOffset, PVOID pData) { UINT uiStatus = 0; - INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; //3 - //UINT uiReadBack = 0; + INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; /* 3 */ + /* UINT uiReadBack = 0; */ UINT value; UINT uiErasePattern[4] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; int bytes; - // - // need not write 0xFFFFFFFF because write requires an erase and erase will - // make whole sector 0xFFFFFFFF. - // + /* + * need not write 0xFFFFFFFF because write requires an erase and erase will + * make whole sector 0xFFFFFFFF. + */ if (!memcmp(pData, uiErasePattern, MAX_RW_SIZE)) return 0; @@ -859,7 +864,7 @@ static INT flashWriteStatus(struct bcm_mini_adapter *Adapter, BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Data write fails..."); return STATUS_FAILURE; } - // __udelay(1); + /* __udelay(1); */ do { value = (FLASH_CMD_STATUS_REG_READ << 24); @@ -867,7 +872,7 @@ static INT flashWriteStatus(struct bcm_mini_adapter *Adapter, BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Programing of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; } - //__udelay(1); + /* __udelay(1); */ bytes = rdmalt(Adapter, FLASH_SPI_READQ_REG, &uiStatus, sizeof(uiStatus)); if (bytes < 0) { uiStatus = bytes; @@ -875,10 +880,11 @@ static INT flashWriteStatus(struct bcm_mini_adapter *Adapter, return uiStatus; } iRetries--; - // this will ensure that in there will be no changes in the current path. - // currently one rdm/wrm takes 125 us. - // Hence 125 *2 * FLASH_PER_RETRIES_DELAY >3 ms(worst case delay) - // Hence current implementation cycle will intoduce no delay in current path + /* this will ensure that in there will be no changes in the current path. + * currently one rdm/wrm takes 125 us. + * Hence 125 *2 * FLASH_PER_RETRIES_DELAY >3 ms(worst case delay) + * Hence current implementation cycle will intoduce no delay in current path + */ if (iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) msleep(1); @@ -892,18 +898,18 @@ static INT flashWriteStatus(struct bcm_mini_adapter *Adapter, return STATUS_SUCCESS; } -//----------------------------------------------------------------------------- -// Procedure: BcmRestoreBlockProtectStatus -// -// Description: Restores the original block protection status. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// ulWriteStatus -Original status -// Returns: -// -// -//----------------------------------------------------------------------------- +/* + * Procedure: BcmRestoreBlockProtectStatus + * + * Description: Restores the original block protection status. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * ulWriteStatus -Original status + * Returns: + * + * + */ static VOID BcmRestoreBlockProtectStatus(struct bcm_mini_adapter *Adapter, ULONG ulWriteStatus) { @@ -917,18 +923,18 @@ static VOID BcmRestoreBlockProtectStatus(struct bcm_mini_adapter *Adapter, ULONG udelay(20); } -//----------------------------------------------------------------------------- -// Procedure: BcmFlashUnProtectBlock -// -// Description: UnProtects appropriate blocks for writing. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// uiOffset - Offset of the flash where data needs to be written to. This should be Sector aligned. -// Returns: -// ULONG - Status value before UnProtect. -// -//----------------------------------------------------------------------------- +/* + * Procedure: BcmFlashUnProtectBlock + * + * Description: UnProtects appropriate blocks for writing. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * uiOffset - Offset of the flash where data needs to be written to. This should be Sector aligned. + * Returns: + * ULONG - Status value before UnProtect. + * + */ static ULONG BcmFlashUnProtectBlock(struct bcm_mini_adapter *Adapter, UINT uiOffset, UINT uiLength) { @@ -937,63 +943,63 @@ static ULONG BcmFlashUnProtectBlock(struct bcm_mini_adapter *Adapter, UINT uiOff UINT value; uiOffset = uiOffset&0x000FFFFF; - // - // Implemented only for 1MB Flash parts. - // + /* + * Implemented only for 1MB Flash parts. + */ if (FLASH_PART_SST25VF080B == Adapter->ulFlashID) { - // - // Get Current BP status. - // + /* + * Get Current BP status. + */ value = (FLASH_CMD_STATUS_REG_READ << 24); wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)); udelay(10); - // - // Read status will be WWXXYYZZ. We have to take only WW. - // + /* + * Read status will be WWXXYYZZ. We have to take only WW. + */ rdmalt(Adapter, FLASH_SPI_READQ_REG, (PUINT)&ulStatus, sizeof(ulStatus)); ulStatus >>= 24; ulWriteStatus = ulStatus; - // - // Bits [5-2] give current block level protection status. - // Bit5: BP3 - DONT CARE - // BP2-BP0: 0 - NO PROTECTION, 1 - UPPER 1/16, 2 - UPPER 1/8, 3 - UPPER 1/4 - // 4 - UPPER 1/2. 5 to 7 - ALL BLOCKS - // + /* + * Bits [5-2] give current block level protection status. + * Bit5: BP3 - DONT CARE + * BP2-BP0: 0 - NO PROTECTION, 1 - UPPER 1/16, 2 - UPPER 1/8, 3 - UPPER 1/4 + * 4 - UPPER 1/2. 5 to 7 - ALL BLOCKS + */ if (ulStatus) { if ((uiOffset+uiLength) <= 0x80000) { - // - // Offset comes in lower half of 1MB. Protect the upper half. - // Clear BP1 and BP0 and set BP2. - // + /* + * Offset comes in lower half of 1MB. Protect the upper half. + * Clear BP1 and BP0 and set BP2. + */ ulWriteStatus |= (0x4<<2); ulWriteStatus &= ~(0x3<<2); } else if ((uiOffset + uiLength) <= 0xC0000) { - // - // Offset comes below Upper 1/4. Upper 1/4 can be protected. - // Clear BP2 and set BP1 and BP0. - // + /* + * Offset comes below Upper 1/4. Upper 1/4 can be protected. + * Clear BP2 and set BP1 and BP0. + */ ulWriteStatus |= (0x3<<2); ulWriteStatus &= ~(0x1<<4); } else if ((uiOffset + uiLength) <= 0xE0000) { - // - // Offset comes below Upper 1/8. Upper 1/8 can be protected. - // Clear BP2 and BP0 and set BP1 - // + /* + * Offset comes below Upper 1/8. Upper 1/8 can be protected. + * Clear BP2 and BP0 and set BP1 + */ ulWriteStatus |= (0x1<<3); ulWriteStatus &= ~(0x5<<2); } else if ((uiOffset + uiLength) <= 0xF0000) { - // - // Offset comes below Upper 1/16. Only upper 1/16 can be protected. - // Set BP0 and Clear BP2,BP1. - // + /* + * Offset comes below Upper 1/16. Only upper 1/16 can be protected. + * Set BP0 and Clear BP2,BP1. + */ ulWriteStatus |= (0x1<<2); ulWriteStatus &= ~(0x3<<3); } else { - // - // Unblock all. - // Clear BP2,BP1 and BP0. - // + /* + * Unblock all. + * Clear BP2,BP1 and BP0. + */ ulWriteStatus &= ~(0x7<<2); } @@ -1008,21 +1014,21 @@ static ULONG BcmFlashUnProtectBlock(struct bcm_mini_adapter *Adapter, UINT uiOff return ulStatus; } -//----------------------------------------------------------------------------- -// Procedure: BeceemFlashBulkWrite -// -// Description: Performs write to the flash -// -// Arguments: -// Adapter - ptr to Adapter object instance -// pBuffer - Data to be written. -// uiOffset - Offset of the flash where data needs to be written to. -// uiNumBytes - Number of bytes to be written. -// bVerify - read verify flag. -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/* + * Procedure: BeceemFlashBulkWrite + * + * Description: Performs write to the flash + * + * Arguments: + * Adapter - ptr to Adapter object instance + * pBuffer - Data to be written. + * uiOffset - Offset of the flash where data needs to be written to. + * uiNumBytes - Number of bytes to be written. + * bVerify - read verify flag. + * Returns: + * OSAL_STATUS_CODE + * + */ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, PUINT pBuffer, @@ -1052,8 +1058,9 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, uiOffsetFromSectStart = uiOffset & ~(Adapter->uiSectorSize - 1); - // Adding flash Base address - // uiOffset = uiOffset + GetFlashBaseAddr(Adapter); + /* Adding flash Base address + * uiOffset = uiOffset + GetFlashBaseAddr(Adapter); + */ uiSectAlignAddr = uiOffset & ~(Adapter->uiSectorSize - 1); uiCurrSectOffsetAddr = uiOffset & (Adapter->uiSectorSize - 1); @@ -1062,19 +1069,20 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, pTempBuff = kmalloc(Adapter->uiSectorSize, GFP_KERNEL); if (NULL == pTempBuff) goto BeceemFlashBulkWrite_EXIT; - // - // check if the data to be written is overlapped across sectors - // + /* + * check if the data to be written is overlapped across sectors + */ if (uiOffset+uiNumBytes < uiSectBoundary) { uiNumSectTobeRead = 1; } else { - // Number of sectors = Last sector start address/First sector start address + /* Number of sectors = Last sector start address/First sector start address */ uiNumSectTobeRead = (uiCurrSectOffsetAddr + uiNumBytes) / Adapter->uiSectorSize; if ((uiCurrSectOffsetAddr + uiNumBytes)%Adapter->uiSectorSize) uiNumSectTobeRead++; } - // Check whether Requested sector is writable or not in case of flash2x write. But if write call is - // for DSD calibration, allow it without checking of sector permission + /* Check whether Requested sector is writable or not in case of flash2x write. But if write call is + * for DSD calibration, allow it without checking of sector permission + */ if (IsFlash2x(Adapter) && (Adapter->bAllDSDWriteAllow == FALSE)) { index = 0; @@ -1092,8 +1100,9 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, } Adapter->SelectedChip = RESET_CHIP_SELECT; while (uiNumSectTobeRead) { - // do_gettimeofday(&tv1); - // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "\nTime In start of write :%ld ms\n",(tv1.tv_sec *1000 + tv1.tv_usec /1000)); + /* do_gettimeofday(&tv1); + * BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "\nTime In start of write :%ld ms\n",(tv1.tv_sec *1000 + tv1.tv_usec /1000)); + */ uiPartOffset = (uiSectAlignAddr & (FLASH_PART_SIZE - 1)) + GetFlashBaseAddr(Adapter); BcmDoChipSelect(Adapter, uiSectAlignAddr); @@ -1106,9 +1115,9 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, goto BeceemFlashBulkWrite_EXIT; } - // do_gettimeofday(&tr); - // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken by Read :%ld ms\n", (tr.tv_sec *1000 + tr.tv_usec/1000) - (tv1.tv_sec *1000 + tv1.tv_usec/1000)); - + /* do_gettimeofday(&tr); + * BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken by Read :%ld ms\n", (tr.tv_sec *1000 + tr.tv_usec/1000) - (tv1.tv_sec *1000 + tv1.tv_usec/1000)); + */ ulStatus = BcmFlashUnProtectBlock(Adapter, uiSectAlignAddr, Adapter->uiSectorSize); if (uiNumSectTobeRead > 1) { @@ -1123,9 +1132,9 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, SaveHeaderIfPresent(Adapter, (PUCHAR)pTempBuff, uiOffsetFromSectStart); FlashSectorErase(Adapter, uiPartOffset, 1); - // do_gettimeofday(&te); - // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken by Erase :%ld ms\n", (te.tv_sec *1000 + te.tv_usec/1000) - (tr.tv_sec *1000 + tr.tv_usec/1000)); - + /* do_gettimeofday(&te); + * BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken by Erase :%ld ms\n", (te.tv_sec *1000 + te.tv_usec/1000) - (tr.tv_sec *1000 + tr.tv_usec/1000)); + */ for (uiIndex = 0; uiIndex < Adapter->uiSectorSize; uiIndex += Adapter->ulFlashWriteSize) { if (Adapter->device_removed) { Status = -1; @@ -1138,8 +1147,9 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, } } - // do_gettimeofday(&tw); - // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken in Write to Flash :%ld ms\n", (tw.tv_sec *1000 + tw.tv_usec/1000) - (te.tv_sec *1000 + te.tv_usec/1000)); + /* do_gettimeofday(&tw); + * BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken in Write to Flash :%ld ms\n", (tw.tv_sec *1000 + tw.tv_usec/1000) - (te.tv_sec *1000 + te.tv_usec/1000)); + */ for (uiIndex = 0; uiIndex < Adapter->uiSectorSize; uiIndex += MAX_RW_SIZE) { if (STATUS_SUCCESS == BeceemFlashBulkRead(Adapter, (PUINT)ucReadBk, uiOffsetFromSectStart + uiIndex, MAX_RW_SIZE)) { if (Adapter->ulFlashWriteSize == 1) { @@ -1162,8 +1172,9 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, } } } - // do_gettimeofday(&twv); - // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken in Write to Flash verification :%ld ms\n", (twv.tv_sec *1000 + twv.tv_usec/1000) - (tw.tv_sec *1000 + tw.tv_usec/1000)); + /* do_gettimeofday(&twv); + * BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken in Write to Flash verification :%ld ms\n", (twv.tv_sec *1000 + twv.tv_usec/1000) - (tw.tv_sec *1000 + tw.tv_usec/1000)); + */ if (ulStatus) { BcmRestoreBlockProtectStatus(Adapter, ulStatus); ulStatus = 0; @@ -1175,13 +1186,13 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, uiOffsetFromSectStart += Adapter->uiSectorSize; uiNumSectTobeRead--; } - // do_gettimeofday(&tv2); - // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Time after Write :%ld ms\n",(tv2.tv_sec *1000 + tv2.tv_usec/1000)); - // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken by in Write is :%ld ms\n", (tv2.tv_sec *1000 + tv2.tv_usec/1000) - (tv1.tv_sec *1000 + tv1.tv_usec/1000)); - // - // Cleanup. - // -BeceemFlashBulkWrite_EXIT : + /* do_gettimeofday(&tv2); + * BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Time after Write :%ld ms\n",(tv2.tv_sec *1000 + tv2.tv_usec/1000)); + * BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken by in Write is :%ld ms\n", (tv2.tv_sec *1000 + tv2.tv_usec/1000) - (tv1.tv_sec *1000 + tv1.tv_usec/1000)); + * + * Cleanup. + */ +BeceemFlashBulkWrite_EXIT: if (ulStatus) BcmRestoreBlockProtectStatus(Adapter, ulStatus); @@ -1191,21 +1202,21 @@ BeceemFlashBulkWrite_EXIT : return Status; } -//----------------------------------------------------------------------------- -// Procedure: BeceemFlashBulkWriteStatus -// -// Description: Writes to Flash. Checks the SPI status after each write. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// pBuffer - Data to be written. -// uiOffset - Offset of the flash where data needs to be written to. -// uiNumBytes - Number of bytes to be written. -// bVerify - read verify flag. -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/* + * Procedure: BeceemFlashBulkWriteStatus + * + * Description: Writes to Flash. Checks the SPI status after each write. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * pBuffer - Data to be written. + * uiOffset - Offset of the flash where data needs to be written to. + * uiNumBytes - Number of bytes to be written. + * bVerify - read verify flag. + * Returns: + * OSAL_STATUS_CODE + * + */ static INT BeceemFlashBulkWriteStatus(struct bcm_mini_adapter *Adapter, PUINT pBuffer, @@ -1230,10 +1241,10 @@ static INT BeceemFlashBulkWriteStatus(struct bcm_mini_adapter *Adapter, uiOffsetFromSectStart = uiOffset & ~(Adapter->uiSectorSize - 1); - // uiOffset += Adapter->ulFlashCalStart; - // Adding flash Base address - // uiOffset = uiOffset + GetFlashBaseAddr(Adapter); - + /* uiOffset += Adapter->ulFlashCalStart; + * Adding flash Base address + * uiOffset = uiOffset + GetFlashBaseAddr(Adapter); + */ uiSectAlignAddr = uiOffset & ~(Adapter->uiSectorSize - 1); uiCurrSectOffsetAddr = uiOffset & (Adapter->uiSectorSize - 1); uiSectBoundary = uiSectAlignAddr + Adapter->uiSectorSize; @@ -1242,13 +1253,13 @@ static INT BeceemFlashBulkWriteStatus(struct bcm_mini_adapter *Adapter, if (NULL == pTempBuff) goto BeceemFlashBulkWriteStatus_EXIT; - // - // check if the data to be written is overlapped across sectors - // + /* + * check if the data to be written is overlapped across sectors + */ if (uiOffset+uiNumBytes < uiSectBoundary) { uiNumSectTobeRead = 1; } else { - // Number of sectors = Last sector start address/First sector start address + /* Number of sectors = Last sector start address/First sector start address */ uiNumSectTobeRead = (uiCurrSectOffsetAddr + uiNumBytes) / Adapter->uiSectorSize; if ((uiCurrSectOffsetAddr + uiNumBytes)%Adapter->uiSectorSize) uiNumSectTobeRead++; @@ -1331,10 +1342,10 @@ static INT BeceemFlashBulkWriteStatus(struct bcm_mini_adapter *Adapter, uiOffsetFromSectStart += Adapter->uiSectorSize; uiNumSectTobeRead--; } -// -// Cleanup. -// -BeceemFlashBulkWriteStatus_EXIT : +/* + * Cleanup. + */ +BeceemFlashBulkWriteStatus_EXIT: if (ulStatus) BcmRestoreBlockProtectStatus(Adapter, ulStatus); @@ -1343,17 +1354,17 @@ BeceemFlashBulkWriteStatus_EXIT : return Status; } -//----------------------------------------------------------------------------- -// Procedure: PropagateCalParamsFromEEPROMToMemory -// -// Description: Dumps the calibration section of EEPROM to DDR. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/* + * Procedure: PropagateCalParamsFromEEPROMToMemory + * + * Description: Dumps the calibration section of EEPROM to DDR. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * Returns: + * OSAL_STATUS_CODE + * + */ INT PropagateCalParamsFromEEPROMToMemory(struct bcm_mini_adapter *Adapter) { @@ -1404,32 +1415,32 @@ INT PropagateCalParamsFromEEPROMToMemory(struct bcm_mini_adapter *Adapter) return Status; } -//----------------------------------------------------------------------------- -// Procedure: PropagateCalParamsFromFlashToMemory -// -// Description: Dumps the calibration section of EEPROM to DDR. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/* + * Procedure: PropagateCalParamsFromFlashToMemory + * + * Description: Dumps the calibration section of EEPROM to DDR. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * Returns: + * OSAL_STATUS_CODE + * + */ INT PropagateCalParamsFromFlashToMemory(struct bcm_mini_adapter *Adapter) { PCHAR pBuff, pPtr; UINT uiEepromSize = 0; UINT uiBytesToCopy = 0; - //UINT uiIndex = 0; + /* UINT uiIndex = 0; */ UINT uiCalStartAddr = EEPROM_CALPARAM_START; UINT uiMemoryLoc = EEPROM_CAL_DATA_INTERNAL_LOC; UINT value; INT Status = 0; - // - // Write the signature first. This will ensure firmware does not access EEPROM. - // + /* + * Write the signature first. This will ensure firmware does not access EEPROM. + */ value = 0xbeadbead; wrmalt(Adapter, EEPROM_CAL_DATA_INTERNAL_LOC - 4, &value, sizeof(value)); value = 0xbeadbead; @@ -1441,9 +1452,9 @@ INT PropagateCalParamsFromFlashToMemory(struct bcm_mini_adapter *Adapter) uiEepromSize = ntohl(uiEepromSize); uiEepromSize >>= 16; - // - // subtract the auto init section size - // + /* + * subtract the auto init section size + */ uiEepromSize -= EEPROM_CALPARAM_START; if (uiEepromSize > 1024 * 1024) @@ -1479,20 +1490,20 @@ INT PropagateCalParamsFromFlashToMemory(struct bcm_mini_adapter *Adapter) return Status; } -//----------------------------------------------------------------------------- -// Procedure: BeceemEEPROMReadBackandVerify -// -// Description: Read back the data written and verifies. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// pBuffer - Data to be written. -// uiOffset - Offset of the flash where data needs to be written to. -// uiNumBytes - Number of bytes to be written. -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/* + * Procedure: BeceemEEPROMReadBackandVerify + * + * Description: Read back the data written and verifies. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * pBuffer - Data to be written. + * uiOffset - Offset of the flash where data needs to be written to. + * uiNumBytes - Number of bytes to be written. + * Returns: + * OSAL_STATUS_CODE + * + */ static INT BeceemEEPROMReadBackandVerify(struct bcm_mini_adapter *Adapter, PUINT pBuffer, @@ -1509,11 +1520,11 @@ static INT BeceemEEPROMReadBackandVerify(struct bcm_mini_adapter *Adapter, return -1; if (uiNumBytes >= MAX_RW_SIZE) { - // for the requests more than or equal to MAX_RW_SIZE bytes, use bulk read function to make the access faster. + /* for the requests more than or equal to MAX_RW_SIZE bytes, use bulk read function to make the access faster. */ BeceemEEPROMBulkRead(Adapter, &auiData[0], uiOffset, MAX_RW_SIZE); if (memcmp(&pBuffer[uiIndex], &auiData[0], MAX_RW_SIZE)) { - // re-write + /* re-write */ BeceemEEPROMBulkWrite(Adapter, (PUCHAR)(pBuffer + uiIndex), uiOffset, MAX_RW_SIZE, FALSE); mdelay(3); BeceemEEPROMBulkRead(Adapter, &auiData[0], uiOffset, MAX_RW_SIZE); @@ -1527,7 +1538,7 @@ static INT BeceemEEPROMReadBackandVerify(struct bcm_mini_adapter *Adapter, } else if (uiNumBytes >= 4) { BeceemEEPROMBulkRead(Adapter, &uiData, uiOffset, 4); if (uiData != pBuffer[uiIndex]) { - // re-write + /* re-write */ BeceemEEPROMBulkWrite(Adapter, (PUCHAR)(pBuffer + uiIndex), uiOffset, 4, FALSE); mdelay(3); BeceemEEPROMBulkRead(Adapter, &uiData, uiOffset, 4); @@ -1538,7 +1549,7 @@ static INT BeceemEEPROMReadBackandVerify(struct bcm_mini_adapter *Adapter, uiNumBytes -= 4; uiIndex++; } else { - // Handle the reads less than 4 bytes... + /* Handle the reads less than 4 bytes... */ uiData = 0; memcpy(&uiData, ((PUCHAR)pBuffer) + (uiIndex * sizeof(UINT)), uiNumBytes); BeceemEEPROMBulkRead(Adapter, &uiRdbk, uiOffset, 4); @@ -1565,19 +1576,19 @@ static VOID BcmSwapWord(UINT *ptr1) ptr[3] = ptr2[0]; } -//----------------------------------------------------------------------------- -// Procedure: BeceemEEPROMWritePage -// -// Description: Performs page write (16bytes) to the EEPROM -// -// Arguments: -// Adapter - ptr to Adapter object instance -// uiData - Data to be written. -// uiOffset - Offset of the EEPROM where data needs to be written to. -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/* + * Procedure: BeceemEEPROMWritePage + * + * Description: Performs page write (16bytes) to the EEPROM + * + * Arguments: + * Adapter - ptr to Adapter object instance + * uiData - Data to be written. + * uiOffset - Offset of the EEPROM where data needs to be written to. + * Returns: + * OSAL_STATUS_CODE + * + */ static INT BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[], UINT uiOffset) { @@ -1595,7 +1606,8 @@ static INT BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[] /* Clear the Empty/Avail/Full bits. After this it has been confirmed * that the bit was cleared by reading back the register. See NOTE below. * We also clear the Read queues as we do a EEPROM status register read - * later. */ + * later. + */ value = (EEPROM_WRITE_QUEUE_EMPTY | EEPROM_WRITE_QUEUE_AVAIL | EEPROM_WRITE_QUEUE_FULL | EEPROM_READ_DATA_AVAIL | EEPROM_READ_DATA_FULL); wrmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); @@ -1604,7 +1616,8 @@ static INT BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[] wrmalt(Adapter, EEPROM_CMDQ_SPI_REG, &value, sizeof(value)); /* We can write back to back 8bits * 16 into the queue and as we have - * checked for the queue to be empty we can write in a burst. */ + * checked for the queue to be empty we can write in a burst. + */ value = uiData[0]; BcmSwapWord(&value); @@ -1625,13 +1638,15 @@ static INT BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[] /* NOTE : After this write, on readback of EEPROM_SPI_Q_STATUS1_REG * shows that we see 7 for the EEPROM data write. Which means that * queue got full, also space is available as well as the queue is empty. - * This may happen in sequence. */ + * This may happen in sequence. + */ value = EEPROM_16_BYTE_PAGE_WRITE | uiOffset; wrmalt(Adapter, EEPROM_CMDQ_SPI_REG, &value, sizeof(value)); /* Ideally we should loop here without tries and eventually succeed. * What we are checking if the previous write has completed, and this - * may take time. We should wait till the Empty bit is set. */ + * may take time. We should wait till the Empty bit is set. + */ uiStatus = 0; rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &uiStatus, sizeof(uiStatus)); while ((uiStatus & EEPROM_WRITE_QUEUE_EMPTY) == 0) { @@ -1662,7 +1677,8 @@ static INT BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[] * proceeding. Bit 0 in the EEPROM Status register should be 0 before * we proceed further. A 1 at Bit 0 indicates that the EEPROM is busy * with the previous write. Note also that issuing this read finally - * means the previous write to the EEPROM has completed. */ + * means the previous write to the EEPROM has completed. + */ uiRetries = MAX_EEPROM_RETRIES * RETRIES_PER_DELAY; uiEpromStatus = 0; while (uiRetries != 0) { @@ -1688,21 +1704,21 @@ static INT BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[] return STATUS_SUCCESS; } /* BeceemEEPROMWritePage */ -//----------------------------------------------------------------------------- -// Procedure: BeceemEEPROMBulkWrite -// -// Description: Performs write to the EEPROM -// -// Arguments: -// Adapter - ptr to Adapter object instance -// pBuffer - Data to be written. -// uiOffset - Offset of the EEPROM where data needs to be written to. -// uiNumBytes - Number of bytes to be written. -// bVerify - read verify flag. -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/* + * Procedure: BeceemEEPROMBulkWrite + * + * Description: Performs write to the EEPROM + * + * Arguments: + * Adapter - ptr to Adapter object instance + * pBuffer - Data to be written. + * uiOffset - Offset of the EEPROM where data needs to be written to. + * uiNumBytes - Number of bytes to be written. + * bVerify - read verify flag. + * Returns: + * OSAL_STATUS_CODE + * + */ INT BeceemEEPROMBulkWrite(struct bcm_mini_adapter *Adapter, PUCHAR pBuffer, @@ -1711,13 +1727,14 @@ INT BeceemEEPROMBulkWrite(struct bcm_mini_adapter *Adapter, BOOLEAN bVerify) { UINT uiBytesToCopy = uiNumBytes; - // UINT uiRdbk = 0; + /* UINT uiRdbk = 0; */ UINT uiData[4] = {0}; UINT uiIndex = 0; UINT uiTempOffset = 0; UINT uiExtraBytes = 0; - // PUINT puiBuffer = (PUINT)pBuffer; - // INT value; + /* PUINT puiBuffer = (PUINT)pBuffer; + * INT value; + */ if (uiOffset % MAX_RW_SIZE && uiBytesToCopy) { uiTempOffset = uiOffset - (uiOffset % MAX_RW_SIZE); @@ -1758,9 +1775,9 @@ INT BeceemEEPROMBulkWrite(struct bcm_mini_adapter *Adapter, uiOffset += MAX_RW_SIZE; uiBytesToCopy -= MAX_RW_SIZE; } else { - // - // To program non 16byte aligned data, read 16byte and then update. - // + /* + * To program non 16byte aligned data, read 16byte and then update. + */ BeceemEEPROMBulkRead(Adapter, &uiData[0], uiOffset, 16); memcpy(&uiData[0], pBuffer + uiIndex, uiBytesToCopy); @@ -1774,21 +1791,21 @@ INT BeceemEEPROMBulkWrite(struct bcm_mini_adapter *Adapter, return 0; } -//----------------------------------------------------------------------------- -// Procedure: BeceemNVMRead -// -// Description: Reads n number of bytes from NVM. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// pBuffer - Buffer to store the data read from NVM -// uiOffset - Offset of NVM from where data should be read -// uiNumBytes - Number of bytes to be read from the NVM. -// -// Returns: -// OSAL_STATUS_SUCCESS - if NVM read is successful. -// - if failed. -//----------------------------------------------------------------------------- +/* + * Procedure: BeceemNVMRead + * + * Description: Reads n number of bytes from NVM. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * pBuffer - Buffer to store the data read from NVM + * uiOffset - Offset of NVM from where data should be read + * uiNumBytes - Number of bytes to be read from the NVM. + * + * Returns: + * OSAL_STATUS_SUCCESS - if NVM read is successful. + * - if failed. + */ INT BeceemNVMRead(struct bcm_mini_adapter *Adapter, PUINT pBuffer, @@ -1833,21 +1850,21 @@ INT BeceemNVMRead(struct bcm_mini_adapter *Adapter, return Status; } -//----------------------------------------------------------------------------- -// Procedure: BeceemNVMWrite -// -// Description: Writes n number of bytes to NVM. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// pBuffer - Buffer contains the data to be written. -// uiOffset - Offset of NVM where data to be written to. -// uiNumBytes - Number of bytes to be written.. -// -// Returns: -// OSAL_STATUS_SUCCESS - if NVM write is successful. -// - if failed. -//----------------------------------------------------------------------------- +/* + * Procedure: BeceemNVMWrite + * + * Description: Writes n number of bytes to NVM. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * pBuffer - Buffer contains the data to be written. + * uiOffset - Offset of NVM where data to be written to. + * uiNumBytes - Number of bytes to be written.. + * + * Returns: + * OSAL_STATUS_SUCCESS - if NVM write is successful. + * - if failed. + */ INT BeceemNVMWrite(struct bcm_mini_adapter *Adapter, PUINT pBuffer, @@ -1911,7 +1928,7 @@ INT BeceemNVMWrite(struct bcm_mini_adapter *Adapter, } else { if ((uiOffset + uiNumBytes) > EEPROM_CALPARAM_START) { ULONG ulBytesTobeSkipped = 0; - PUCHAR pcBuffer = (PUCHAR)pBuffer; // char pointer to take care of odd byte cases. + PUCHAR pcBuffer = (PUCHAR)pBuffer; /* char pointer to take care of odd byte cases. */ uiNumBytes -= (EEPROM_CALPARAM_START - uiOffset); ulBytesTobeSkipped += (EEPROM_CALPARAM_START - uiOffset); uiOffset += (EEPROM_CALPARAM_START - uiOffset); @@ -1928,7 +1945,7 @@ INT BeceemNVMWrite(struct bcm_mini_adapter *Adapter, } } } - // restore the values. + /* restore the values. */ wrmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); } else if (Adapter->eNVMType == NVM_EEPROM) { Status = BeceemEEPROMBulkWrite(Adapter, @@ -1944,19 +1961,19 @@ INT BeceemNVMWrite(struct bcm_mini_adapter *Adapter, return Status; } -//----------------------------------------------------------------------------- -// Procedure: BcmUpdateSectorSize -// -// Description: Updates the sector size to FLASH. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// uiSectorSize - sector size -// -// Returns: -// OSAL_STATUS_SUCCESS - if NVM write is successful. -// - if failed. -//----------------------------------------------------------------------------- +/* + * Procedure: BcmUpdateSectorSize + * + * Description: Updates the sector size to FLASH. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * uiSectorSize - sector size + * + * Returns: + * OSAL_STATUS_SUCCESS - if NVM write is successful. + * - if failed. + */ INT BcmUpdateSectorSize(struct bcm_mini_adapter *Adapter, UINT uiSectorSize) { @@ -1971,9 +1988,9 @@ INT BcmUpdateSectorSize(struct bcm_mini_adapter *Adapter, UINT uiSectorSize) value = 0; wrmalt(Adapter, 0x0f000C80, &value, sizeof(value)); - // - // Before updating the sector size in the reserved area, check if already present. - // + /* + * Before updating the sector size in the reserved area, check if already present. + */ BeceemFlashBulkRead(Adapter, (PUINT)&sFlashCsInfo, Adapter->ulFlashControlSectionStart, sizeof(sFlashCsInfo)); uiSectorSig = ntohl(sFlashCsInfo.FlashSectorSizeSig); uiCurrentSectorSize = ntohl(sFlashCsInfo.FlashSectorSize); @@ -2000,24 +2017,24 @@ INT BcmUpdateSectorSize(struct bcm_mini_adapter *Adapter, UINT uiSectorSize) } Restore: - // restore the values. + /* restore the values. */ wrmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); return Status; } -//----------------------------------------------------------------------------- -// Procedure: BcmGetFlashSectorSize -// -// Description: Finds the sector size of the FLASH. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// -// Returns: -// UINT - sector size. -// -//----------------------------------------------------------------------------- +/* + * Procedure: BcmGetFlashSectorSize + * + * Description: Finds the sector size of the FLASH. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * + * Returns: + * UINT - sector size. + * + */ static UINT BcmGetFlashSectorSize(struct bcm_mini_adapter *Adapter, UINT FlashSectorSizeSig, UINT FlashSectorSize) { @@ -2033,17 +2050,17 @@ static UINT BcmGetFlashSectorSize(struct bcm_mini_adapter *Adapter, UINT FlashSe if (uiSectorSig == FLASH_SECTOR_SIZE_SIG) { uiSectorSize = FlashSectorSize; - // - // If the sector size stored in the FLASH makes sense then use it. - // + /* + * If the sector size stored in the FLASH makes sense then use it. + */ if (uiSectorSize <= MAX_SECTOR_SIZE && uiSectorSize >= MIN_SECTOR_SIZE) { Adapter->uiSectorSize = uiSectorSize; } else if (Adapter->uiSectorSizeInCFG <= MAX_SECTOR_SIZE && Adapter->uiSectorSizeInCFG >= MIN_SECTOR_SIZE) { - //No valid size in FLASH, check if Config file has it. + /* No valid size in FLASH, check if Config file has it. */ Adapter->uiSectorSize = Adapter->uiSectorSizeInCFG; } else { - // Init to Default, if none of the above works. + /* Init to Default, if none of the above works. */ Adapter->uiSectorSize = DEFAULT_SECTOR_SIZE; } } else { @@ -2060,24 +2077,25 @@ static UINT BcmGetFlashSectorSize(struct bcm_mini_adapter *Adapter, UINT FlashSe return Adapter->uiSectorSize; } -//----------------------------------------------------------------------------- -// Procedure: BcmInitEEPROMQueues -// -// Description: Initialization of EEPROM queues. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// -// Returns: -// -//----------------------------------------------------------------------------- +/* + * Procedure: BcmInitEEPROMQueues + * + * Description: Initialization of EEPROM queues. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * + * Returns: + * + */ static INT BcmInitEEPROMQueues(struct bcm_mini_adapter *Adapter) { UINT value = 0; /* CHIP Bug : Clear the Avail bits on the Read queue. The default * value on this register is supposed to be 0x00001102. - * But we get 0x00001122. */ + * But we get 0x00001122. + */ BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Fixing reset value on 0x0f003004 register\n"); value = EEPROM_READ_DATA_AVAIL; wrmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); @@ -2096,17 +2114,17 @@ static INT BcmInitEEPROMQueues(struct bcm_mini_adapter *Adapter) return STATUS_SUCCESS; } /* BcmInitEEPROMQueues() */ -//----------------------------------------------------------------------------- -// Procedure: BcmInitNVM -// -// Description: Initialization of NVM, EEPROM size,FLASH size, sector size etc. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// -// Returns: -// -//----------------------------------------------------------------------------- +/* + * Procedure: BcmInitNVM + * + * Description: Initialization of NVM, EEPROM size,FLASH size, sector size etc. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * + * Returns: + * + */ INT BcmInitNVM(struct bcm_mini_adapter *ps_adapter) { @@ -2126,15 +2144,13 @@ INT BcmInitNVM(struct bcm_mini_adapter *ps_adapter) return STATUS_SUCCESS; } -/***************************************************************************/ -/*BcmGetNvmSize : set the EEPROM or flash size in Adapter. -* -*Input Parameter: -* Adapter data structure -*Return Value : -* 0. means success; -*/ -/***************************************************************************/ +/* BcmGetNvmSize : set the EEPROM or flash size in Adapter. + * + * Input Parameter: + * Adapter data structure + * Return Value : + * 0. means success; + */ static INT BcmGetNvmSize(struct bcm_mini_adapter *Adapter) { @@ -2146,61 +2162,61 @@ static INT BcmGetNvmSize(struct bcm_mini_adapter *Adapter) return 0; } -//----------------------------------------------------------------------------- -// Procedure: BcmValidateNvm -// -// Description: Validates the NVM Type option selected against the device -// -// Arguments: -// Adapter - ptr to Adapter object instance -// -// Returns: -// -//----------------------------------------------------------------------------- +/* + * Procedure: BcmValidateNvm + * + * Description: Validates the NVM Type option selected against the device + * + * Arguments: + * Adapter - ptr to Adapter object instance + * + * Returns: + * + */ static VOID BcmValidateNvmType(struct bcm_mini_adapter *Adapter) { - // - // if forcing the FLASH through CFG file, we should ensure device really has a FLASH. - // Accessing the FLASH address without the FLASH being present can cause hang/freeze etc. - // So if NVM_FLASH is selected for older chipsets, change it to AUTODETECT where EEPROM is 1st choice. - // + /* + * if forcing the FLASH through CFG file, we should ensure device really has a FLASH. + * Accessing the FLASH address without the FLASH being present can cause hang/freeze etc. + * So if NVM_FLASH is selected for older chipsets, change it to AUTODETECT where EEPROM is 1st choice. + */ if (Adapter->eNVMType == NVM_FLASH && Adapter->chip_id < 0xBECE3300) Adapter->eNVMType = NVM_AUTODETECT; } -//----------------------------------------------------------------------------- -// Procedure: BcmReadFlashRDID -// -// Description: Reads ID from Serial Flash -// -// Arguments: -// Adapter - ptr to Adapter object instance -// -// Returns: -// Flash ID -//----------------------------------------------------------------------------- +/* + * Procedure: BcmReadFlashRDID + * + * Description: Reads ID from Serial Flash + * + * Arguments: + * Adapter - ptr to Adapter object instance + * + * Returns: + * Flash ID + */ static ULONG BcmReadFlashRDID(struct bcm_mini_adapter *Adapter) { ULONG ulRDID = 0; UINT value; - // - // Read ID Instruction. - // + /* + * Read ID Instruction. + */ value = (FLASH_CMD_READ_ID << 24); wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)); - //Delay + /* Delay */ udelay(10); - // - // Read SPI READQ REG. The output will be WWXXYYZZ. - // The ID is 3Bytes long and is WWXXYY. ZZ needs to be Ignored. - // + /* + * Read SPI READQ REG. The output will be WWXXYYZZ. + * The ID is 3Bytes long and is WWXXYY. ZZ needs to be Ignored. + */ rdmalt(Adapter, FLASH_SPI_READQ_REG, (PUINT)&ulRDID, sizeof(ulRDID)); return (ulRDID >> 8); @@ -2314,7 +2330,7 @@ static INT ConvertEndianOf2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo) psFlash2xCSInfo->MagicNumber = ntohl(psFlash2xCSInfo->MagicNumber); psFlash2xCSInfo->FlashLayoutVersion = ntohl(psFlash2xCSInfo->FlashLayoutVersion); - //psFlash2xCSInfo->FlashLayoutMinorVersion = ntohs(psFlash2xCSInfo->FlashLayoutMinorVersion); + /* psFlash2xCSInfo->FlashLayoutMinorVersion = ntohs(psFlash2xCSInfo->FlashLayoutMinorVersion); */ psFlash2xCSInfo->ISOImageVersion = ntohl(psFlash2xCSInfo->ISOImageVersion); psFlash2xCSInfo->SCSIFirmwareVersion = ntohl(psFlash2xCSInfo->SCSIFirmwareVersion); psFlash2xCSInfo->OffsetFromZeroForPart1ISOImage = ntohl(psFlash2xCSInfo->OffsetFromZeroForPart1ISOImage); @@ -2367,11 +2383,11 @@ static INT ConvertEndianOf2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo) static INT ConvertEndianOfCSStructure(PFLASH_CS_INFO psFlashCSInfo) { - //UINT Index = 0; + /* UINT Index = 0; */ psFlashCSInfo->MagicNumber = ntohl(psFlashCSInfo->MagicNumber); psFlashCSInfo->FlashLayoutVersion = ntohl(psFlashCSInfo->FlashLayoutVersion); psFlashCSInfo->ISOImageVersion = ntohl(psFlashCSInfo->ISOImageVersion); - //won't convert according to old assumption + /* won't convert according to old assumption */ psFlashCSInfo->SCSIFirmwareVersion = (psFlashCSInfo->SCSIFirmwareVersion); psFlashCSInfo->OffsetFromZeroForPart1ISOImage = ntohl(psFlashCSInfo->OffsetFromZeroForPart1ISOImage); psFlashCSInfo->OffsetFromZeroForScsiFirmware = ntohl(psFlashCSInfo->OffsetFromZeroForScsiFirmware); @@ -2479,21 +2495,21 @@ static VOID UpdateVendorInfo(struct bcm_mini_adapter *Adapter) } } -//----------------------------------------------------------------------------- -// Procedure: BcmGetFlashCSInfo -// -// Description: Reads control structure and gets Cal section addresses. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// -// Returns: -// -//----------------------------------------------------------------------------- +/* + * Procedure: BcmGetFlashCSInfo + * + * Description: Reads control structure and gets Cal section addresses. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * + * Returns: + * + */ static INT BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) { - //FLASH_CS_INFO sFlashCsInfo = {0}; + /* FLASH_CS_INFO sFlashCsInfo = {0}; */ #if !defined(BCM_SHM_INTERFACE) || defined(FLASH_DIRECT_ACCESS) UINT value; @@ -2514,13 +2530,14 @@ static INT BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) wrmalt(Adapter, 0xAF00A080, &value, sizeof(value)); } - // Reading first 8 Bytes to get the Flash Layout - // MagicNumber(4 bytes) +FlashLayoutMinorVersion(2 Bytes) +FlashLayoutMajorVersion(2 Bytes) + /* Reading first 8 Bytes to get the Flash Layout + * MagicNumber(4 bytes) +FlashLayoutMinorVersion(2 Bytes) +FlashLayoutMajorVersion(2 Bytes) + */ BeceemFlashBulkRead(Adapter, (PUINT)Adapter->psFlashCSInfo, Adapter->ulFlashControlSectionStart, 8); Adapter->psFlashCSInfo->FlashLayoutVersion = ntohl(Adapter->psFlashCSInfo->FlashLayoutVersion); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Flash Layout Version :%X", (Adapter->psFlashCSInfo->FlashLayoutVersion)); - //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Flash Layout Minor Version :%d\n", ntohs(sFlashCsInfo.FlashLayoutMinorVersion)); + /* BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Flash Layout Minor Version :%d\n", ntohs(sFlashCsInfo.FlashLayoutMinorVersion)); */ BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Signature is :%x\n", ntohl(Adapter->psFlashCSInfo->MagicNumber)); if (FLASH_CONTROL_STRUCT_SIGNATURE == ntohl(Adapter->psFlashCSInfo->MagicNumber)) { @@ -2590,27 +2607,27 @@ static INT BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) Adapter->ulFlashControlSectionStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForControlSectionStart; } /* - Concerns: what if CS sector size does not match with this sector size ??? - what is the indication of AccessBitMap in CS in flash 2.x ???? - */ + * Concerns: what if CS sector size does not match with this sector size ??? + * what is the indication of AccessBitMap in CS in flash 2.x ???? + */ Adapter->ulFlashID = BcmReadFlashRDID(Adapter); Adapter->uiFlashLayoutMajorVersion = uiFlashLayoutMajorVersion; return STATUS_SUCCESS; } -//----------------------------------------------------------------------------- -// Procedure: BcmGetNvmType -// -// Description: Finds the type of NVM used. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// -// Returns: -// NVM_TYPE -// -//----------------------------------------------------------------------------- +/* + * Procedure: BcmGetNvmType + * + * Description: Finds the type of NVM used. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * + * Returns: + * NVM_TYPE + * + */ static NVM_TYPE BcmGetNvmType(struct bcm_mini_adapter *Adapter) { @@ -2620,35 +2637,35 @@ static NVM_TYPE BcmGetNvmType(struct bcm_mini_adapter *Adapter) if (uiData == BECM) return NVM_EEPROM; - // - // Read control struct and get cal addresses before accessing the flash - // + /* + * Read control struct and get cal addresses before accessing the flash + */ BcmGetFlashCSInfo(Adapter); BeceemFlashBulkRead(Adapter, &uiData, 0x0 + Adapter->ulFlashCalStart, 4); if (uiData == BECM) return NVM_FLASH; - // - // even if there is no valid signature on EEPROM/FLASH find out if they really exist. - // if exist select it. - // + /* + * even if there is no valid signature on EEPROM/FLASH find out if they really exist. + * if exist select it. + */ if (BcmGetEEPROMSize(Adapter)) return NVM_EEPROM; - //TBD for Flash. + /* TBD for Flash. */ return NVM_UNKNOWN; } -/** -* BcmGetSectionValStartOffset - this will calculate the section's starting offset if section val is given -* @Adapter : Drivers Private Data structure -* @eFlashSectionVal : Flash secion value defined in enum FLASH2X_SECTION_VAL -* -* Return value:- -* On success it return the start offset of the provided section val -* On Failure -returns STATUS_FAILURE -**/ +/* + * BcmGetSectionValStartOffset - this will calculate the section's starting offset if section val is given + * @Adapter : Drivers Private Data structure + * @eFlashSectionVal : Flash secion value defined in enum FLASH2X_SECTION_VAL + * + * Return value:- + * On success it return the start offset of the provided section val + * On Failure -returns STATUS_FAILURE + */ INT BcmGetSectionValStartOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlashSectionVal) { @@ -2732,15 +2749,15 @@ INT BcmGetSectionValStartOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTIO return SectStartOffset; } -/** -* BcmGetSectionValEndOffset - this will calculate the section's Ending offset if section val is given -* @Adapter : Drivers Private Data structure -* @eFlashSectionVal : Flash secion value defined in enum FLASH2X_SECTION_VAL -* -* Return value:- -* On success it return the end offset of the provided section val -* On Failure -returns STATUS_FAILURE -**/ +/* + * BcmGetSectionValEndOffset - this will calculate the section's Ending offset if section val is given + * @Adapter : Drivers Private Data structure + * @eFlashSectionVal : Flash secion value defined in enum FLASH2X_SECTION_VAL + * + * Return value:- + * On success it return the end offset of the provided section val + * On Failure -returns STATUS_FAILURE + */ INT BcmGetSectionValEndOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) { @@ -2791,7 +2808,7 @@ INT BcmGetSectionValEndOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_ (Adapter->psFlash2xCSInfo->SizeOfScsiFirmware)); break; case CONTROL_SECTION: - //Not Clear So Putting failure. confirm and fix it. + /* Not Clear So Putting failure. confirm and fix it. */ SectEndOffset = STATUS_FAILURE; case ISO_IMAGE1_PART2: if (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End != UNINIT_PTR_IN_CS) @@ -2817,16 +2834,16 @@ INT BcmGetSectionValEndOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_ } /* -* BcmFlash2xBulkRead:- Read API for Flash Map 2.x . -* @Adapter :Driver Private Data Structure -* @pBuffer : Buffer where data has to be put after reading -* @eFlashSectionVal :Flash Section Val defined in FLASH2X_SECTION_VAL -* @uiOffsetWithinSectionVal :- Offset with in provided section -* @uiNumBytes : Number of Bytes for Read -* -* Return value:- -* return true on success and STATUS_FAILURE on fail. -*/ + * BcmFlash2xBulkRead:- Read API for Flash Map 2.x . + * @Adapter :Driver Private Data Structure + * @pBuffer : Buffer where data has to be put after reading + * @eFlashSectionVal :Flash Section Val defined in FLASH2X_SECTION_VAL + * @uiOffsetWithinSectionVal :- Offset with in provided section + * @uiNumBytes : Number of Bytes for Read + * + * Return value:- + * return true on success and STATUS_FAILURE on fail. + */ INT BcmFlash2xBulkRead(struct bcm_mini_adapter *Adapter, PUINT pBuffer, @@ -2848,7 +2865,7 @@ INT BcmFlash2xBulkRead(struct bcm_mini_adapter *Adapter, return -ENODEV; } - //NO_SECTION_VAL means absolute offset is given. + /* NO_SECTION_VAL means absolute offset is given. */ if (eFlash2xSectionVal == NO_SECTION_VAL) SectionStartOffset = 0; else @@ -2862,7 +2879,7 @@ INT BcmFlash2xBulkRead(struct bcm_mini_adapter *Adapter, if (IsSectionExistInVendorInfo(Adapter, eFlash2xSectionVal)) return vendorextnReadSection(Adapter, (PUCHAR)pBuffer, eFlash2xSectionVal, uiOffsetWithinSectionVal, uiNumBytes); - //calculating the absolute offset from FLASH; + /* calculating the absolute offset from FLASH; */ uiAbsoluteOffset = uiOffsetWithinSectionVal + SectionStartOffset; rdmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); value = 0; @@ -2878,17 +2895,17 @@ INT BcmFlash2xBulkRead(struct bcm_mini_adapter *Adapter, } /* -* BcmFlash2xBulkWrite :-API for Writing on the Flash Map 2.x. -* @Adapter :Driver Private Data Structure -* @pBuffer : Buffer From where data has to taken for writing -* @eFlashSectionVal :Flash Section Val defined in FLASH2X_SECTION_VAL -* @uiOffsetWithinSectionVal :- Offset with in provided section -* @uiNumBytes : Number of Bytes for Write -* -* Return value:- -* return true on success and STATUS_FAILURE on fail. -* -*/ + * BcmFlash2xBulkWrite :-API for Writing on the Flash Map 2.x. + * @Adapter :Driver Private Data Structure + * @pBuffer : Buffer From where data has to taken for writing + * @eFlashSectionVal :Flash Section Val defined in FLASH2X_SECTION_VAL + * @uiOffsetWithinSectionVal :- Offset with in provided section + * @uiNumBytes : Number of Bytes for Write + * + * Return value:- + * return true on success and STATUS_FAILURE on fail. + * + */ INT BcmFlash2xBulkWrite(struct bcm_mini_adapter *Adapter, PUINT pBuffer, @@ -2911,7 +2928,7 @@ INT BcmFlash2xBulkWrite(struct bcm_mini_adapter *Adapter, return -ENODEV; } - //NO_SECTION_VAL means absolute offset is given. + /* NO_SECTION_VAL means absolute offset is given. */ if (eFlash2xSectVal == NO_SECTION_VAL) FlashSectValStartOffset = 0; else @@ -2925,7 +2942,7 @@ INT BcmFlash2xBulkWrite(struct bcm_mini_adapter *Adapter, if (IsSectionExistInVendorInfo(Adapter, eFlash2xSectVal)) return vendorextnWriteSection(Adapter, (PUCHAR)pBuffer, eFlash2xSectVal, uiOffset, uiNumBytes, bVerify); - //calculating the absolute offset from FLASH; + /* calculating the absolute offset from FLASH; */ uiOffset = uiOffset + FlashSectValStartOffset; rdmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); @@ -2943,14 +2960,14 @@ INT BcmFlash2xBulkWrite(struct bcm_mini_adapter *Adapter, return Status; } -/** -* BcmGetActiveDSD : Set the Active DSD in Adapter Structure which has to be dumped in DDR -* @Adapter :-Drivers private Data Structure -* -* Return Value:- -* Return STATUS_SUCESS if get success in setting the right DSD else negaive error code -* -**/ +/* + * BcmGetActiveDSD : Set the Active DSD in Adapter Structure which has to be dumped in DDR + * @Adapter :-Drivers private Data Structure + * + * Return Value:- + * Return STATUS_SUCESS if get success in setting the right DSD else negaive error code + * + */ static INT BcmGetActiveDSD(struct bcm_mini_adapter *Adapter) { @@ -2968,7 +2985,7 @@ static INT BcmGetActiveDSD(struct bcm_mini_adapter *Adapter) if (Adapter->eActiveDSD) BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Active DSD :%d", Adapter->eActiveDSD); if (Adapter->eActiveDSD == 0) { - //if No DSD gets Active, Make Active the DSD with WR permission + /* if No DSD gets Active, Make Active the DSD with WR permission */ if (IsSectionWritable(Adapter, DSD2)) { Adapter->eActiveDSD = DSD2; Adapter->ulFlashCalStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start; @@ -2984,15 +3001,15 @@ static INT BcmGetActiveDSD(struct bcm_mini_adapter *Adapter) return STATUS_SUCCESS; } -/** -* BcmGetActiveISO :- Set the Active ISO in Adapter Data Structue -* @Adapter : Driver private Data Structure -* -* Return Value:- -* Sucsess:- STATUS_SUCESS -* Failure- : negative erro code -* -**/ +/* + * BcmGetActiveISO :- Set the Active ISO in Adapter Data Structue + * @Adapter : Driver private Data Structure + * + * Return Value:- + * Sucsess:- STATUS_SUCESS + * Failure- : negative erro code + * + */ static INT BcmGetActiveISO(struct bcm_mini_adapter *Adapter) { @@ -3012,16 +3029,16 @@ static INT BcmGetActiveISO(struct bcm_mini_adapter *Adapter) return STATUS_SUCCESS; } -/** -* IsOffsetWritable :- it will tell the access permission of the sector having passed offset -* @Adapter : Drivers Private Data Structure -* @uiOffset : Offset provided in the Flash -* -* Return Value:- -* Success:-TRUE , offset is writable -* Failure:-FALSE, offset is RO -* -**/ +/* + * IsOffsetWritable :- it will tell the access permission of the sector having passed offset + * @Adapter : Drivers Private Data Structure + * @uiOffset : Offset provided in the Flash + * + * Return Value:- + * Success:-TRUE , offset is writable + * Failure:-FALSE, offset is RO + * + */ B_UINT8 IsOffsetWritable(struct bcm_mini_adapter *Adapter, UINT uiOffset) { @@ -3032,13 +3049,13 @@ B_UINT8 IsOffsetWritable(struct bcm_mini_adapter *Adapter, UINT uiOffset) uiSectorNum = uiOffset/Adapter->uiSectorSize; - // calculating the word having this Sector Access permission from SectorAccessBitMap Array + /* calculating the word having this Sector Access permission from SectorAccessBitMap Array */ uiWordOfSectorPermission = Adapter->psFlash2xCSInfo->SectorAccessBitMap[uiSectorNum / 16]; - // calculating the bit index inside the word for this sector + /* calculating the bit index inside the word for this sector */ uiBitofSectorePermission = 2 * (15 - uiSectorNum % 16); - // Setting Access permission + /* Setting Access permission */ permissionBits = uiWordOfSectorPermission & (0x3 << uiBitofSectorePermission); permissionBits = (permissionBits >> uiBitofSectorePermission) & 0x3; if (permissionBits == SECTOR_READWRITE_PERMISSION) @@ -3066,21 +3083,21 @@ static INT BcmDumpFlash2xSectionBitMap(PFLASH2X_BITMAP psFlash2xBitMap) return STATUS_SUCCESS; } -/** -* BcmGetFlash2xSectionalBitMap :- It will provide the bit map of all the section present in Flash -* 8bit has been assigned to every section. - bit[0] :Section present or not - bit[1] :section is valid or not - bit[2] : Secton is read only or has write permission too. - bit[3] : Active Section - - bit[7...4] = Reserved . - - @Adapter:-Driver private Data Structure -* -* Return value:- -* Success:- STATUS_SUCESS -* Failure:- negative error code -**/ +/* + * BcmGetFlash2xSectionalBitMap :- It will provide the bit map of all the section present in Flash + * 8bit has been assigned to every section. + * bit[0] :Section present or not + * bit[1] :section is valid or not + * bit[2] : Secton is read only or has write permission too. + * bit[3] : Active Section - + * bit[7...4] = Reserved . + * + * @Adapter:-Driver private Data Structure + * + * Return value:- + * Success:- STATUS_SUCESS + * Failure:- negative error code + */ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITMAP psFlash2xBitMap) { @@ -3090,12 +3107,13 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM BOOLEAN SetActiveDSDDone = FALSE; BOOLEAN SetActiveISODone = FALSE; - // For 1.x map all the section except DSD0 will be shown as not present - // This part will be used by calibration tool to detect the number of DSD present in Flash. + /* For 1.x map all the section except DSD0 will be shown as not present + * This part will be used by calibration tool to detect the number of DSD present in Flash. + */ if (IsFlash2x(Adapter) == FALSE) { psFlash2xBitMap->ISO_IMAGE2 = 0; psFlash2xBitMap->ISO_IMAGE1 = 0; - psFlash2xBitMap->DSD0 = FLASH2X_SECTION_VALID | FLASH2X_SECTION_ACT | FLASH2X_SECTION_PRESENT; //0xF; //0000(Reseved)1(Active)0(RW)1(valid)1(present) + psFlash2xBitMap->DSD0 = FLASH2X_SECTION_VALID | FLASH2X_SECTION_ACT | FLASH2X_SECTION_PRESENT; /* 0xF; 0000(Reseved)1(Active)0(RW)1(valid)1(present) */ psFlash2xBitMap->DSD1 = 0; psFlash2xBitMap->DSD2 = 0; psFlash2xBitMap->VSA0 = 0; @@ -3113,17 +3131,17 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM uiHighestPriDSD = getHighestPriDSD(Adapter); uiHighestPriISO = getHighestPriISO(Adapter); - /// - // IS0 IMAGE 2 - /// + /* + * IS0 IMAGE 2 + */ if ((psFlash2xCSInfo->OffsetISOImage2Part1Start) != UNINIT_PTR_IN_CS) { - //Setting the 0th Bit representing the Section is present or not. + /* Setting the 0th Bit representing the Section is present or not. */ psFlash2xBitMap->ISO_IMAGE2 = psFlash2xBitMap->ISO_IMAGE2 | FLASH2X_SECTION_PRESENT; if (ReadISOSignature(Adapter, ISO_IMAGE2) == ISO_IMAGE_MAGIC_NUMBER) psFlash2xBitMap->ISO_IMAGE2 |= FLASH2X_SECTION_VALID; - // Calculation for extrating the Access permission + /* Calculation for extrating the Access permission */ if (IsSectionWritable(Adapter, ISO_IMAGE2) == FALSE) psFlash2xBitMap->ISO_IMAGE2 |= FLASH2X_SECTION_RO; @@ -3133,17 +3151,17 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM } } - /// - // IS0 IMAGE 1 - /// + /* + * IS0 IMAGE 1 + */ if ((psFlash2xCSInfo->OffsetISOImage1Part1Start) != UNINIT_PTR_IN_CS) { - // Setting the 0th Bit representing the Section is present or not. + /* Setting the 0th Bit representing the Section is present or not. */ psFlash2xBitMap->ISO_IMAGE1 = psFlash2xBitMap->ISO_IMAGE1 | FLASH2X_SECTION_PRESENT; if (ReadISOSignature(Adapter, ISO_IMAGE1) == ISO_IMAGE_MAGIC_NUMBER) psFlash2xBitMap->ISO_IMAGE1 |= FLASH2X_SECTION_VALID; - // Calculation for extrating the Access permission + /* Calculation for extrating the Access permission */ if (IsSectionWritable(Adapter, ISO_IMAGE1) == FALSE) psFlash2xBitMap->ISO_IMAGE1 |= FLASH2X_SECTION_RO; @@ -3153,21 +3171,21 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM } } - /// - // DSD2 - /// + /* + * DSD2 + */ if ((psFlash2xCSInfo->OffsetFromZeroForDSD2Start) != UNINIT_PTR_IN_CS) { - //Setting the 0th Bit representing the Section is present or not. + /* Setting the 0th Bit representing the Section is present or not. */ psFlash2xBitMap->DSD2 = psFlash2xBitMap->DSD2 | FLASH2X_SECTION_PRESENT; if (ReadDSDSignature(Adapter, DSD2) == DSD_IMAGE_MAGIC_NUMBER) psFlash2xBitMap->DSD2 |= FLASH2X_SECTION_VALID; - // Calculation for extrating the Access permission + /* Calculation for extrating the Access permission */ if (IsSectionWritable(Adapter, DSD2) == FALSE) { psFlash2xBitMap->DSD2 |= FLASH2X_SECTION_RO; } else { - //Means section is writable + /* Means section is writable */ if ((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD2)) { psFlash2xBitMap->DSD2 |= FLASH2X_SECTION_ACT; SetActiveDSDDone = TRUE; @@ -3175,21 +3193,21 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM } } - /// - // DSD 1 - /// + /* + * DSD 1 + */ if ((psFlash2xCSInfo->OffsetFromZeroForDSD1Start) != UNINIT_PTR_IN_CS) { - // Setting the 0th Bit representing the Section is present or not. + /* Setting the 0th Bit representing the Section is present or not. */ psFlash2xBitMap->DSD1 = psFlash2xBitMap->DSD1 | FLASH2X_SECTION_PRESENT; if (ReadDSDSignature(Adapter, DSD1) == DSD_IMAGE_MAGIC_NUMBER) psFlash2xBitMap->DSD1 |= FLASH2X_SECTION_VALID; - // Calculation for extrating the Access permission + /* Calculation for extrating the Access permission */ if (IsSectionWritable(Adapter, DSD1) == FALSE) { psFlash2xBitMap->DSD1 |= FLASH2X_SECTION_RO; } else { - // Means section is writable + /* Means section is writable */ if ((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD1)) { psFlash2xBitMap->DSD1 |= FLASH2X_SECTION_ACT; SetActiveDSDDone = TRUE; @@ -3197,21 +3215,21 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM } } - /// - //For DSD 0 - // + /* + * For DSD 0 + */ if ((psFlash2xCSInfo->OffsetFromZeroForDSDStart) != UNINIT_PTR_IN_CS) { - //Setting the 0th Bit representing the Section is present or not. + /* Setting the 0th Bit representing the Section is present or not. */ psFlash2xBitMap->DSD0 = psFlash2xBitMap->DSD0 | FLASH2X_SECTION_PRESENT; if (ReadDSDSignature(Adapter, DSD0) == DSD_IMAGE_MAGIC_NUMBER) psFlash2xBitMap->DSD0 |= FLASH2X_SECTION_VALID; - // Setting Access permission + /* Setting Access permission */ if (IsSectionWritable(Adapter, DSD0) == FALSE) { psFlash2xBitMap->DSD0 |= FLASH2X_SECTION_RO; } else { - // Means section is writable + /* Means section is writable */ if ((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD0)) { psFlash2xBitMap->DSD0 |= FLASH2X_SECTION_ACT; SetActiveDSDDone = TRUE; @@ -3219,99 +3237,99 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM } } - /// - // VSA 0 - /// + /* + * VSA 0 + */ if ((psFlash2xCSInfo->OffsetFromZeroForVSAStart) != UNINIT_PTR_IN_CS) { - // Setting the 0th Bit representing the Section is present or not. + /* Setting the 0th Bit representing the Section is present or not. */ psFlash2xBitMap->VSA0 = psFlash2xBitMap->VSA0 | FLASH2X_SECTION_PRESENT; - // Setting the Access Bit. Map is not defined hece setting it always valid + /* Setting the Access Bit. Map is not defined hece setting it always valid */ psFlash2xBitMap->VSA0 |= FLASH2X_SECTION_VALID; - // Calculation for extrating the Access permission + /* Calculation for extrating the Access permission */ if (IsSectionWritable(Adapter, VSA0) == FALSE) psFlash2xBitMap->VSA0 |= FLASH2X_SECTION_RO; - // By Default section is Active + /* By Default section is Active */ psFlash2xBitMap->VSA0 |= FLASH2X_SECTION_ACT; } - /// - // VSA 1 - /// + /* + * VSA 1 + */ if ((psFlash2xCSInfo->OffsetFromZeroForVSA1Start) != UNINIT_PTR_IN_CS) { - // Setting the 0th Bit representing the Section is present or not. + /* Setting the 0th Bit representing the Section is present or not. */ psFlash2xBitMap->VSA1 = psFlash2xBitMap->VSA1 | FLASH2X_SECTION_PRESENT; - // Setting the Access Bit. Map is not defined hece setting it always valid + /* Setting the Access Bit. Map is not defined hece setting it always valid */ psFlash2xBitMap->VSA1 |= FLASH2X_SECTION_VALID; - // Checking For Access permission + /* Checking For Access permission */ if (IsSectionWritable(Adapter, VSA1) == FALSE) psFlash2xBitMap->VSA1 |= FLASH2X_SECTION_RO; - // By Default section is Active + /* By Default section is Active */ psFlash2xBitMap->VSA1 |= FLASH2X_SECTION_ACT; } - /// - // VSA 2 - /// + /* + * VSA 2 + */ if ((psFlash2xCSInfo->OffsetFromZeroForVSA2Start) != UNINIT_PTR_IN_CS) { - // Setting the 0th Bit representing the Section is present or not. + /* Setting the 0th Bit representing the Section is present or not. */ psFlash2xBitMap->VSA2 = psFlash2xBitMap->VSA2 | FLASH2X_SECTION_PRESENT; - // Setting the Access Bit. Map is not defined hece setting it always valid + /* Setting the Access Bit. Map is not defined hece setting it always valid */ psFlash2xBitMap->VSA2 |= FLASH2X_SECTION_VALID; - // Checking For Access permission + /* Checking For Access permission */ if (IsSectionWritable(Adapter, VSA2) == FALSE) psFlash2xBitMap->VSA2 |= FLASH2X_SECTION_RO; - // By Default section is Active + /* By Default section is Active */ psFlash2xBitMap->VSA2 |= FLASH2X_SECTION_ACT; } - /// - // SCSI Section - /// + /* + * SCSI Section + */ if ((psFlash2xCSInfo->OffsetFromZeroForScsiFirmware) != UNINIT_PTR_IN_CS) { - // Setting the 0th Bit representing the Section is present or not. + /* Setting the 0th Bit representing the Section is present or not. */ psFlash2xBitMap->SCSI = psFlash2xBitMap->SCSI | FLASH2X_SECTION_PRESENT; - // Setting the Access Bit. Map is not defined hece setting it always valid + /* Setting the Access Bit. Map is not defined hece setting it always valid */ psFlash2xBitMap->SCSI |= FLASH2X_SECTION_VALID; - // Checking For Access permission + /* Checking For Access permission */ if (IsSectionWritable(Adapter, SCSI) == FALSE) psFlash2xBitMap->SCSI |= FLASH2X_SECTION_RO; - // By Default section is Active + /* By Default section is Active */ psFlash2xBitMap->SCSI |= FLASH2X_SECTION_ACT; } - /// - // Control Section - /// + /* + * Control Section + */ if ((psFlash2xCSInfo->OffsetFromZeroForControlSectionStart) != UNINIT_PTR_IN_CS) { - // Setting the 0th Bit representing the Section is present or not. + /* Setting the 0th Bit representing the Section is present or not. */ psFlash2xBitMap->CONTROL_SECTION = psFlash2xBitMap->CONTROL_SECTION | (FLASH2X_SECTION_PRESENT); - // Setting the Access Bit. Map is not defined hece setting it always valid + /* Setting the Access Bit. Map is not defined hece setting it always valid */ psFlash2xBitMap->CONTROL_SECTION |= FLASH2X_SECTION_VALID; - // Checking For Access permission + /* Checking For Access permission */ if (IsSectionWritable(Adapter, CONTROL_SECTION) == FALSE) psFlash2xBitMap->CONTROL_SECTION |= FLASH2X_SECTION_RO; - // By Default section is Active + /* By Default section is Active */ psFlash2xBitMap->CONTROL_SECTION |= FLASH2X_SECTION_ACT; } - /// - // For Reserved Sections - /// + /* + * For Reserved Sections + */ psFlash2xBitMap->Reserved0 = 0; psFlash2xBitMap->Reserved0 = 0; psFlash2xBitMap->Reserved0 = 0; @@ -3320,24 +3338,25 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM return STATUS_SUCCESS; } -/** -BcmSetActiveSection :- Set Active section is used to make priority field highest over other - section of same type. - -@Adapater :- Bcm Driver Private Data Structure -@eFlash2xSectionVal :- Flash section val whose priority has to be made highest. - -Return Value:- Make the priorit highest else return erorr code - -**/ +/* + * BcmSetActiveSection :- Set Active section is used to make priority field highest over other + * section of same type. + * + * @Adapater :- Bcm Driver Private Data Structure + * @eFlash2xSectionVal :- Flash section val whose priority has to be made highest. + * + * Return Value:- Make the priorit highest else return erorr code + * + */ INT BcmSetActiveSection(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectVal) { unsigned int SectImagePriority = 0; INT Status = STATUS_SUCCESS; - //DSD_HEADER sDSD = {0}; - //ISO_HEADER sISO = {0}; + /* DSD_HEADER sDSD = {0}; + * ISO_HEADER sISO = {0}; + */ INT HighestPriDSD = 0 ; INT HighestPriISO = 0; @@ -3363,9 +3382,10 @@ INT BcmSetActiveSection(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eF SectImagePriority = ReadISOPriority(Adapter, HighestPriISO) + 1; if ((SectImagePriority <= 0) && IsSectionWritable(Adapter, HighestPriISO)) { - // This is a SPECIAL Case which will only happen if the current highest priority ISO has priority value = 0x7FFFFFFF. - // We will write 1 to the current Highest priority ISO And then shall increase the priority of the requested ISO - // by user + /* This is a SPECIAL Case which will only happen if the current highest priority ISO has priority value = 0x7FFFFFFF. + * We will write 1 to the current Highest priority ISO And then shall increase the priority of the requested ISO + * by user + */ BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "SectImagePriority wraparound happened, eFlash2xSectVal: 0x%x\n", eFlash2xSectVal); SectImagePriority = htonl(0x1); Status = BcmFlash2xBulkWrite(Adapter, @@ -3422,9 +3442,10 @@ INT BcmSetActiveSection(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eF SectImagePriority = ReadDSDPriority(Adapter, HighestPriDSD) + 1; if (SectImagePriority <= 0) { - // This is a SPECIAL Case which will only happen if the current highest priority DSD has priority value = 0x7FFFFFFF. - // We will write 1 to the current Highest priority DSD And then shall increase the priority of the requested DSD - // by user + /* This is a SPECIAL Case which will only happen if the current highest priority DSD has priority value = 0x7FFFFFFF. + * We will write 1 to the current Highest priority DSD And then shall increase the priority of the requested DSD + * by user + */ BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, NVM_RW, DBG_LVL_ALL, "SectImagePriority wraparound happened, eFlash2xSectVal: 0x%x\n", eFlash2xSectVal); SectImagePriority = htonl(0x1); @@ -3488,7 +3509,7 @@ INT BcmSetActiveSection(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eF case VSA0: case VSA1: case VSA2: - // Has to be decided + /* Has to be decided */ break; default: Status = STATUS_FAILURE; @@ -3499,14 +3520,14 @@ INT BcmSetActiveSection(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eF return Status; } -/** -BcmCopyISO - Used only for copying the ISO section -@Adapater :- Bcm Driver Private Data Structure -@sCopySectStrut :- Section copy structure - -Return value:- SUCCESS if copies successfully else negative error code - -**/ +/* + * BcmCopyISO - Used only for copying the ISO section + * @Adapater :- Bcm Driver Private Data Structure + * @sCopySectStrut :- Section copy structure + * + * Return value:- SUCCESS if copies successfully else negative error code + * + */ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectStrut) { @@ -3586,7 +3607,7 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS CorruptISOSig(Adapter, ISO_IMAGE2); while (uiTotalDataToCopy) { if (uiTotalDataToCopy == Adapter->uiSectorSize) { - // Setting for write of first sector. First sector is assumed to be written in last + /* Setting for write of first sector. First sector is assumed to be written in last */ BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Writing the signature sector"); eISOReadPart = ISO_IMAGE1; uiReadOffsetWithinPart = 0; @@ -3629,7 +3650,7 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS } if (IsThisHeaderSector == TRUE) { - // If this is header sector write 0xFFFFFFFF at the sig time and in last write sig + /* If this is header sector write 0xFFFFFFFF at the sig time and in last write sig */ memcpy(SigBuff, Buff + sigOffset, MAX_RW_SIZE); for (i = 0; i < MAX_RW_SIZE; i++) @@ -3656,7 +3677,7 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS MAX_RW_SIZE); IsThisHeaderSector = FALSE; } - //subtracting the written Data + /* subtracting the written Data */ uiTotalDataToCopy = uiTotalDataToCopy - Adapter->uiSectorSize; } } @@ -3699,7 +3720,7 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS while (uiTotalDataToCopy) { if (uiTotalDataToCopy == Adapter->uiSectorSize) { - //Setting for write of first sector. First sector is assumed to be written in last + /* Setting for write of first sector. First sector is assumed to be written in last */ BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Writing the signature sector"); eISOReadPart = ISO_IMAGE2; uiReadOffsetWithinPart = 0; @@ -3742,7 +3763,7 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS } if (IsThisHeaderSector == TRUE) { - // If this is header sector write 0xFFFFFFFF at the sig time and in last write sig + /* If this is header sector write 0xFFFFFFFF at the sig time and in last write sig */ memcpy(SigBuff, Buff + sigOffset, MAX_RW_SIZE); for (i = 0; i < MAX_RW_SIZE; i++) @@ -3771,7 +3792,7 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS IsThisHeaderSector = FALSE; } - // subtracting the written Data + /* subtracting the written Data */ uiTotalDataToCopy = uiTotalDataToCopy - Adapter->uiSectorSize; } } @@ -3781,18 +3802,16 @@ out: return Status; } -/** -BcmFlash2xCorruptSig : this API is used to corrupt the written sig in Bcm Header present in flash section. - It will corrupt the sig, if Section is writable, by making first bytes as zero. -@Adapater :- Bcm Driver Private Data Structure -@eFlash2xSectionVal :- Flash section val which has header - -Return Value :- - Success :- If Section is present and writable, corrupt the sig and return STATUS_SUCCESS - Failure :-Return negative error code - - -**/ +/* + * BcmFlash2xCorruptSig : this API is used to corrupt the written sig in Bcm Header present in flash section. + * It will corrupt the sig, if Section is writable, by making first bytes as zero. + * @Adapater :- Bcm Driver Private Data Structure + * @eFlash2xSectionVal :- Flash section val which has header + * + * Return Value :- + * Success :- If Section is present and writable, corrupt the sig and return STATUS_SUCCESS + * Failure :-Return negative error code + */ INT BcmFlash2xCorruptSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) { @@ -3811,24 +3830,23 @@ INT BcmFlash2xCorruptSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL e return Status; } -/** -BcmFlash2xWriteSig :-this API is used to Write the sig if requested Section has - header and Write Permission. -@Adapater :- Bcm Driver Private Data Structure -@eFlashSectionVal :- Flash section val which has header - -Return Value :- - Success :- If Section is present and writable write the sig and return STATUS_SUCCESS - Failure :-Return negative error code - -**/ +/* + *BcmFlash2xWriteSig :-this API is used to Write the sig if requested Section has + * header and Write Permission. + * @Adapater :- Bcm Driver Private Data Structure + * @eFlashSectionVal :- Flash section val which has header + * + * Return Value :- + * Success :- If Section is present and writable write the sig and return STATUS_SUCCESS + * Failure :-Return negative error code + */ INT BcmFlash2xWriteSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlashSectionVal) { UINT uiSignature = 0; UINT uiOffset = 0; - // DSD_HEADER dsdHeader = {0}; + /* DSD_HEADER dsdHeader = {0}; */ if (Adapter->bSigCorrupted == FALSE) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Signature is not corrupted by driver, hence not restoring\n"); return STATUS_SUCCESS; @@ -3853,7 +3871,7 @@ INT BcmFlash2xWriteSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFl } } else if ((eFlashSectionVal == ISO_IMAGE1) || (eFlashSectionVal == ISO_IMAGE2)) { uiSignature = htonl(ISO_IMAGE_MAGIC_NUMBER); - // uiOffset = 0; + /* uiOffset = 0; */ uiOffset = FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImageMagicNumber); if ((ReadISOSignature(Adapter, eFlashSectionVal) & 0xFF000000) != CORRUPTED_PATTERN) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Currupted Pattern is not there. Hence won't write sig"); @@ -3874,16 +3892,14 @@ INT BcmFlash2xWriteSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFl return STATUS_SUCCESS; } -/** -validateFlash2xReadWrite :- This API is used to validate the user request for Read/Write. - if requested Bytes goes beyond the Requested section, it reports error. -@Adapater :- Bcm Driver Private Data Structure -@psFlash2xReadWrite :-Flash2x Read/write structure pointer - -Return values:-Return TRUE is request is valid else FALSE. - - -**/ +/* + * validateFlash2xReadWrite :- This API is used to validate the user request for Read/Write. + * if requested Bytes goes beyond the Requested section, it reports error. + * @Adapater :- Bcm Driver Private Data Structure + * @psFlash2xReadWrite :-Flash2x Read/write structure pointer + * + * Return values:-Return TRUE is request is valid else FALSE. + */ INT validateFlash2xReadWrite(struct bcm_mini_adapter *Adapter, PFLASH2X_READWRITE psFlash2xReadWrite) { @@ -3916,8 +3932,9 @@ INT validateFlash2xReadWrite(struct bcm_mini_adapter *Adapter, PFLASH2X_READWRIT BcmGetSectionValStartOffset(Adapter, ISO_IMAGE2_PART3); } - // since this uiSectEndoffset is the size of iso Image. hence for calculating the vitual endoffset - // it should be added in startoffset. so that check done in last of this function can be valued. + /* since this uiSectEndoffset is the size of iso Image. hence for calculating the vitual endoffset + * it should be added in startoffset. so that check done in last of this function can be valued. + */ uiSectEndOffset = uiSectStartOffset + uiSectEndOffset; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Total size of the ISO Image :%x", uiSectEndOffset); @@ -3926,7 +3943,7 @@ INT validateFlash2xReadWrite(struct bcm_mini_adapter *Adapter, PFLASH2X_READWRIT BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "End offset :%x\n", uiSectEndOffset); - // Checking the boundary condition + /* Checking the boundary condition */ if ((uiSectStartOffset + psFlash2xReadWrite->offset + uiNumOfBytes) <= uiSectEndOffset) return TRUE; else { @@ -3935,13 +3952,13 @@ INT validateFlash2xReadWrite(struct bcm_mini_adapter *Adapter, PFLASH2X_READWRIT } } -/** -IsFlash2x :- check for Flash 2.x -@Adapater :- Bcm Driver Private Data Structure - -Return value:- - return TRUE if flah2.x of hgher version else return false. -**/ +/* + * IsFlash2x :- check for Flash 2.x + * Adapater :- Bcm Driver Private Data Structure + * + * Return value:- + * return TRUE if flah2.x of hgher version else return false. + */ INT IsFlash2x(struct bcm_mini_adapter *Adapter) { @@ -3951,13 +3968,13 @@ INT IsFlash2x(struct bcm_mini_adapter *Adapter) return FALSE; } -/** -GetFlashBaseAddr :- Calculate the Flash Base address -@Adapater :- Bcm Driver Private Data Structure - -Return Value:- - Success :- Base Address of the Flash -**/ +/* + * GetFlashBaseAddr :- Calculate the Flash Base address + * @Adapater :- Bcm Driver Private Data Structure + * + * Return Value:- + * Success :- Base Address of the Flash + */ static INT GetFlashBaseAddr(struct bcm_mini_adapter *Adapter) { @@ -3965,9 +3982,9 @@ static INT GetFlashBaseAddr(struct bcm_mini_adapter *Adapter) if (Adapter->bDDRInitDone) { /* - For All Valid Flash Versions... except 1.1, take the value from FlashBaseAddr - In case of Raw Read... use the default value - */ + * For All Valid Flash Versions... except 1.1, take the value from FlashBaseAddr + * In case of Raw Read... use the default value + */ if (Adapter->uiFlashLayoutMajorVersion && (Adapter->bFlashRawRead == FALSE) && !((Adapter->uiFlashLayoutMajorVersion == 1) && (Adapter->uiFlashLayoutMinorVersion == 1))) uiBaseAddr = Adapter->uiFlashBaseAdd; @@ -3975,9 +3992,9 @@ static INT GetFlashBaseAddr(struct bcm_mini_adapter *Adapter) uiBaseAddr = FLASH_CONTIGIOUS_START_ADDR_AFTER_INIT; } else { /* - For All Valid Flash Versions... except 1.1, take the value from FlashBaseAddr - In case of Raw Read... use the default value - */ + * For All Valid Flash Versions... except 1.1, take the value from FlashBaseAddr + * In case of Raw Read... use the default value + */ if (Adapter->uiFlashLayoutMajorVersion && (Adapter->bFlashRawRead == FALSE) && !((Adapter->uiFlashLayoutMajorVersion == 1) && (Adapter->uiFlashLayoutMinorVersion == 1))) uiBaseAddr = Adapter->uiFlashBaseAdd | FLASH_CONTIGIOUS_START_ADDR_BEFORE_INIT; @@ -3988,22 +4005,20 @@ static INT GetFlashBaseAddr(struct bcm_mini_adapter *Adapter) return uiBaseAddr; } -/** -BcmCopySection :- This API is used to copy the One section in another. Both section should - be contiuous and of same size. Hence this Will not be applicabe to copy ISO. - -@Adapater :- Bcm Driver Private Data Structure -@SrcSection :- Source section From where data has to be copied -@DstSection :- Destination section to which data has to be copied -@offset :- Offset from/to where data has to be copied from one section to another. -@numOfBytes :- number of byes that has to be copyed from one section to another at given offset. - in case of numofBytes equal zero complete section will be copied. - -Return Values- - Success : Return STATUS_SUCCESS - Faillure :- return negative error code - -**/ +/* + * BcmCopySection :- This API is used to copy the One section in another. Both section should + * be contiuous and of same size. Hence this Will not be applicabe to copy ISO. + * + * @Adapater :- Bcm Driver Private Data Structure + * @SrcSection :- Source section From where data has to be copied + * @DstSection :- Destination section to which data has to be copied + * @offset :- Offset from/to where data has to be copied from one section to another. + * @numOfBytes :- number of byes that has to be copyed from one section to another at given offset. + * in case of numofBytes equal zero complete section will be copied. + * Return Values- + * Success : Return STATUS_SUCCESS + * Faillure :- return negative error code + */ INT BcmCopySection(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL SrcSection, @@ -4031,7 +4046,7 @@ INT BcmCopySection(struct bcm_mini_adapter *Adapter, return -EINVAL; } - // if offset zero means have to copy complete secton + /* if offset zero means have to copy complete secton */ if (numOfBytes == 0) { numOfBytes = BcmGetSectionValEndOffset(Adapter, SrcSection) - BcmGetSectionValStartOffset(Adapter, SrcSection); @@ -4099,17 +4114,16 @@ INT BcmCopySection(struct bcm_mini_adapter *Adapter, return Status; } -/** -SaveHeaderIfPresent :- This API is use to Protect the Header in case of Header Sector write -@Adapater :- Bcm Driver Private Data Structure -@pBuff :- Data buffer that has to be written in sector having the header map. -@uiOffset :- Flash offset that has to be written. - -Return value :- - Success :- On success return STATUS_SUCCESS - Faillure :- Return negative error code - -**/ +/* + * SaveHeaderIfPresent :- This API is use to Protect the Header in case of Header Sector write + * @Adapater :- Bcm Driver Private Data Structure + * @pBuff :- Data buffer that has to be written in sector having the header map. + * @uiOffset :- Flash offset that has to be written. + * + * Return value :- + * Success :- On success return STATUS_SUCCESS + * Faillure :- Return negative error code + */ INT SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, UINT uiOffset) { @@ -4119,13 +4133,13 @@ INT SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, UINT uiO UINT uiSectAlignAddr = 0; UINT sig = 0; - //making the offset sector aligned + /* making the offset sector aligned */ uiSectAlignAddr = uiOffset & ~(Adapter->uiSectorSize - 1); if ((uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter, DSD2) - Adapter->uiSectorSize) || (uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter, DSD1) - Adapter->uiSectorSize) || (uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter, DSD0) - Adapter->uiSectorSize)) { - // offset from the sector boundary having the header map + /* offset from the sector boundary having the header map */ offsetToProtect = Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader % Adapter->uiSectorSize; HeaderSizeToProtect = sizeof(DSD_HEADER); bHasHeader = TRUE; @@ -4137,17 +4151,17 @@ INT SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, UINT uiO HeaderSizeToProtect = sizeof(ISO_HEADER); bHasHeader = TRUE; } - // If Header is present overwrite passed buffer with this + /* If Header is present overwrite passed buffer with this */ if (bHasHeader && (Adapter->bHeaderChangeAllowed == FALSE)) { pTempBuff = (PUCHAR)kzalloc(HeaderSizeToProtect, GFP_KERNEL); if (pTempBuff == NULL) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Memory allocation failed"); return -ENOMEM; } - // Read header + /* Read header */ BeceemFlashBulkRead(Adapter, (PUINT)pTempBuff, (uiSectAlignAddr + offsetToProtect), HeaderSizeToProtect); BCM_DEBUG_PRINT_BUFFER(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, pTempBuff, HeaderSizeToProtect); - //Replace Buffer content with Header + /* Replace Buffer content with Header */ memcpy(pBuff + offsetToProtect, pTempBuff, HeaderSizeToProtect); kfree(pTempBuff); @@ -4169,13 +4183,13 @@ INT SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, UINT uiO return STATUS_SUCCESS; } -/** -BcmDoChipSelect : This will selcet the appropriate chip for writing. -@Adapater :- Bcm Driver Private Data Structure - -OutPut:- - Select the Appropriate chip and retrn status Success -**/ +/* + * BcmDoChipSelect : This will selcet the appropriate chip for writing. + * @Adapater :- Bcm Driver Private Data Structure + * + * OutPut:- + * Select the Appropriate chip and retrn status Success + */ static INT BcmDoChipSelect(struct bcm_mini_adapter *Adapter, UINT offset) { UINT FlashConfig = 0; @@ -4185,28 +4199,28 @@ static INT BcmDoChipSelect(struct bcm_mini_adapter *Adapter, UINT offset) ChipNum = offset / FLASH_PART_SIZE; - // - // Chip Select mapping to enable flash0. - // To select flash 0, we have to OR with (0<<12). - // ORing 0 will have no impact so not doing that part. - // In future if Chip select value changes from 0 to non zero, - // That needs be taken care with backward comaptibility. No worries for now. - // + /* + * Chip Select mapping to enable flash0. + * To select flash 0, we have to OR with (0<<12). + * ORing 0 will have no impact so not doing that part. + * In future if Chip select value changes from 0 to non zero, + * That needs be taken care with backward comaptibility. No worries for now. + */ /* - SelectedChip Variable is the selection that the host is 100% Sure the same as what the register will hold. This can be ONLY ensured - if the Chip doesn't goes to low power mode while the flash operation is in progress (NVMRdmWrmLock is taken) - Before every new Flash Write operation, we reset the variable. This is to ensure that after any wake-up from - power down modes (Idle mode/shutdown mode), the values in the register will be different. - */ + * SelectedChip Variable is the selection that the host is 100% Sure the same as what the register will hold. This can be ONLY ensured + * if the Chip doesn't goes to low power mode while the flash operation is in progress (NVMRdmWrmLock is taken) + * Before every new Flash Write operation, we reset the variable. This is to ensure that after any wake-up from + * power down modes (Idle mode/shutdown mode), the values in the register will be different. + */ if (Adapter->SelectedChip == ChipNum) return STATUS_SUCCESS; - // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Selected Chip :%x", ChipNum); + /* BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Selected Chip :%x", ChipNum); */ Adapter->SelectedChip = ChipNum; - // bit[13..12] will select the appropriate chip + /* bit[13..12] will select the appropriate chip */ rdmalt(Adapter, FLASH_CONFIG_REG, &FlashConfig, 4); rdmalt(Adapter, FLASH_GPIO_CONFIG_REG, &GPIOConfig, 4); { @@ -4229,17 +4243,17 @@ static INT BcmDoChipSelect(struct bcm_mini_adapter *Adapter, UINT offset) } } /* In case the bits already written in the FLASH_CONFIG_REG is same as what the user desired, - nothing to do... can return immediately. - ASSUMPTION: FLASH_GPIO_CONFIG_REG will be in sync with FLASH_CONFIG_REG. - Even if the chip goes to low power mode, it should wake with values in each register in sync with each other. - These values are not written by host other than during CHIP_SELECT. - */ + * nothing to do... can return immediately. + * ASSUMPTION: FLASH_GPIO_CONFIG_REG will be in sync with FLASH_CONFIG_REG. + * Even if the chip goes to low power mode, it should wake with values in each register in sync with each other. + * These values are not written by host other than during CHIP_SELECT. + */ if (PartNum == ((FlashConfig >> CHIP_SELECT_BIT12) & 0x3)) return STATUS_SUCCESS; - // clearing the bit[13..12] + /* clearing the bit[13..12] */ FlashConfig &= 0xFFFFCFFF; - FlashConfig = (FlashConfig | (PartNum< Date: Wed, 6 Jun 2012 22:54:30 -0400 Subject: Staging: bcm: Fix ERROR: return is not a function, parentheses are not required. This patch fixes the following error reported by checkpatch.pl in nvm.c: "ERROR: return is not a function, parentheses are not required". Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/nvm.c b/drivers/staging/bcm/nvm.c index cfc0458..02a0904 100644 --- a/drivers/staging/bcm/nvm.c +++ b/drivers/staging/bcm/nvm.c @@ -472,7 +472,7 @@ static INT BeceemFlashBulkRead(struct bcm_mini_adapter *Adapter, static UINT BcmGetFlashSize(struct bcm_mini_adapter *Adapter) { if (IsFlash2x(Adapter)) - return (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER)); + return Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER); else return 32 * 1024; } @@ -2219,7 +2219,7 @@ static ULONG BcmReadFlashRDID(struct bcm_mini_adapter *Adapter) */ rdmalt(Adapter, FLASH_SPI_READQ_REG, (PUINT)&ulRDID, sizeof(ulRDID)); - return (ulRDID >> 8); + return ulRDID >> 8; } INT BcmAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter) -- cgit v0.10.2 From 6788d7dab6a5b126604ae0f40cfb13400fdf37f6 Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Wed, 6 Jun 2012 22:54:31 -0400 Subject: Staging: bcm: Use udelay instead of msleep for delays in nvm.c This patch uses udelay instead of msleep for delays because msleep can sleep up to 20ms for any value less than 20. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/nvm.c b/drivers/staging/bcm/nvm.c index 02a0904..c8a0a90 100644 --- a/drivers/staging/bcm/nvm.c +++ b/drivers/staging/bcm/nvm.c @@ -102,7 +102,7 @@ static UCHAR ReadEEPROMStatusRegister(struct bcm_mini_adapter *Adapter) return uiData; } if (!(dwRetries%RETRIES_PER_DELAY)) - msleep(1); + udelay(1000); uiStatus = 0 ; } return uiData; @@ -195,7 +195,7 @@ INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, } if (!(dwRetries%RETRIES_PER_DELAY)) - msleep(1); + udelay(1000); } for (dwIndex = 0; dwIndex < dwNumWords; dwIndex++) { @@ -577,7 +577,7 @@ static INT FlashSectorErase(struct bcm_mini_adapter *Adapter, * the sector erase cycle is 500 ms to 40000 msec. hence sleeping 10 ms * won't hamper performance in any case. */ - msleep(10); + udelay(10000); } while ((uiStatus & 0x1) && (iRetries < 400)); if (uiStatus & 0x1) { @@ -654,7 +654,7 @@ static INT flashByteWrite(struct bcm_mini_adapter *Adapter, } iRetries--; if (iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) - msleep(1); + udelay(1000); } while ((uiStatus & 0x1) && (iRetries > 0)); @@ -734,7 +734,7 @@ static INT flashWrite(struct bcm_mini_adapter *Adapter, * Hence current implementation cycle will intoduce no delay in current path */ if (iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) - msleep(1); + udelay(1000); } while ((uiStatus & 0x1) && (iRetries > 0)); if (uiStatus & 0x1) { @@ -811,7 +811,7 @@ static INT flashByteWriteStatus(struct bcm_mini_adapter *Adapter, iRetries--; if (iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) - msleep(1); + udelay(1000); } while ((uiStatus & 0x1) && (iRetries > 0)); @@ -886,7 +886,7 @@ static INT flashWriteStatus(struct bcm_mini_adapter *Adapter, * Hence current implementation cycle will intoduce no delay in current path */ if (iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) - msleep(1); + udelay(1000); } while ((uiStatus & 0x1) && (iRetries > 0)); @@ -1657,7 +1657,7 @@ static INT BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[] } if (!(uiRetries%RETRIES_PER_DELAY)) - msleep(1); + udelay(1000); uiStatus = 0; rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &uiStatus, sizeof(uiStatus)); @@ -1698,7 +1698,7 @@ static INT BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[] } uiEpromStatus = 0; if (!(uiRetries%RETRIES_PER_DELAY)) - msleep(1); + udelay(1000); } return STATUS_SUCCESS; -- cgit v0.10.2 From 7dd80eb925a5aac4ebe8b1abec20802e91f60c2e Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Thu, 7 Jun 2012 23:52:42 -0400 Subject: Staging: bcm: Return -ENOMEM instead of -1 when memory not acquired in nmv.c This patch changes the return statement on two conditions where memory could not be acquired. It returns -ENOMEM instead of -1. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/nvm.c b/drivers/staging/bcm/nvm.c index c8a0a90..ed23165 100644 --- a/drivers/staging/bcm/nvm.c +++ b/drivers/staging/bcm/nvm.c @@ -1378,7 +1378,7 @@ INT PropagateCalParamsFromEEPROMToMemory(struct bcm_mini_adapter *Adapter) INT Status = 0; if (pBuff == NULL) - return -1; + return -ENOMEM; if (0 != BeceemEEPROMBulkRead(Adapter, &uiEepromSize, EEPROM_SIZE_OFFSET, 4)) { kfree(pBuff); @@ -1462,7 +1462,7 @@ INT PropagateCalParamsFromFlashToMemory(struct bcm_mini_adapter *Adapter) pBuff = kmalloc(uiEepromSize, GFP_KERNEL); if (pBuff == NULL) - return -1; + return -ENOMEM; if (0 != BeceemNVMRead(Adapter, (PUINT)pBuff, uiCalStartAddr, uiEepromSize)) { kfree(pBuff); -- cgit v0.10.2 From dd13c86b0dae86efdde98119ffd7348e80719ade Mon Sep 17 00:00:00 2001 From: Ben Chan Date: Wed, 6 Jun 2012 23:01:26 -0700 Subject: staging: gdm72xx: Fix spinlock recursion on gdm_usb_send_complete This patch fixes a spinlock recursion bug on several call sites of gdm_usb_send_complete by not calling spin_lock_irqsave on urb->context->tx_cxt->lock when the lock has already been acquired. Signed-off-by: Ben Chan Cc: Sage Ahn Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/gdm72xx/gdm_usb.c b/drivers/staging/gdm72xx/gdm_usb.c index e201b34..646e0ac 100644 --- a/drivers/staging/gdm72xx/gdm_usb.c +++ b/drivers/staging/gdm72xx/gdm_usb.c @@ -270,7 +270,7 @@ static void release_usb(struct usbwm_dev *udev) } } -static void gdm_usb_send_complete(struct urb *urb) +static void gdm_usb_send_complete_impl(struct urb *urb, bool need_lock) { struct usb_tx *t = urb->context; struct tx_cxt *tx = t->tx_cxt; @@ -282,7 +282,8 @@ static void gdm_usb_send_complete(struct urb *urb) if (urb->status == -ECONNRESET) return; - spin_lock_irqsave(&tx->lock, flags); + if (need_lock) + spin_lock_irqsave(&tx->lock, flags); if (t->callback) t->callback(t->cb_data); @@ -296,7 +297,18 @@ static void gdm_usb_send_complete(struct urb *urb) else free_tx_struct(t); - spin_unlock_irqrestore(&tx->lock, flags); + if (need_lock) + spin_unlock_irqrestore(&tx->lock, flags); +} + +static void gdm_usb_send_complete(struct urb *urb) +{ + gdm_usb_send_complete_impl(urb, true); +} + +static void gdm_usb_send_complete_no_lock(struct urb *urb) +{ + gdm_usb_send_complete_impl(urb, false); } static int gdm_usb_send(void *priv_dev, void *data, int len, @@ -411,7 +423,7 @@ out: send_fail: t->callback = NULL; - gdm_usb_send_complete(t->urb); + gdm_usb_send_complete_no_lock(t->urb); spin_unlock_irqrestore(&tx->lock, flags); return ret; } @@ -540,7 +552,7 @@ static void do_pm_control(struct work_struct *work) if (ret) { t->callback = NULL; - gdm_usb_send_complete(t->urb); + gdm_usb_send_complete_no_lock(t->urb); } } } @@ -742,7 +754,7 @@ static int k_mode_thread(void *arg) if (ret) { t->callback = NULL; - gdm_usb_send_complete(t->urb); + gdm_usb_send_complete_no_lock(t->urb); } } -- cgit v0.10.2 From 60ebf60b614cafd0c9f58e72cae151edf5e8bd94 Mon Sep 17 00:00:00 2001 From: Masanari Iida Date: Sat, 9 Jun 2012 00:13:57 +0900 Subject: staging: Fix typo in winbond Correct spelling typo in winbond/mto.c and mds_s.h Signed-off-by: Masanari Iida Acked-by: Pavel Machek Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/winbond/mds_s.h b/drivers/staging/winbond/mds_s.h index 07d835b..2972d66 100644 --- a/drivers/staging/winbond/mds_s.h +++ b/drivers/staging/winbond/mds_s.h @@ -40,7 +40,7 @@ enum { /* * ================================================================ - * Configration default value + * Configuration default value * ================================================================ */ #define DEFAULT_MULTICASTLISTMAX 32 /* standard */ diff --git a/drivers/staging/winbond/mto.c b/drivers/staging/winbond/mto.c index 5250217..1b52ebd 100644 --- a/drivers/staging/winbond/mto.c +++ b/drivers/staging/winbond/mto.c @@ -33,7 +33,7 @@ u16 MTO_Frag_Th_Tbl[MTO_MAX_FRAG_TH_LEVELS] = { /* * Declare data rate table: - * The following table will be changed at anytime if the opration rate + * The following table will be changed at anytime if the operation rate * supported by AP don't match the table */ static u8 MTO_Data_Rate_Tbl[MTO_MAX_DATA_RATE_LEVELS] = { -- cgit v0.10.2 From 0cf5755f00f555d7cef4a7be0ae5aac5e4bdf07d Mon Sep 17 00:00:00 2001 From: Masanari Iida Date: Sat, 9 Jun 2012 00:19:17 +0900 Subject: staging: rts5139: Fix typo in rts5139 Correct spelling typo in rts5139/rts51x_chip.h, rts51x_scsi.h Signed-off-by: Masanari Iida Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/rts5139/rts51x_chip.h b/drivers/staging/rts5139/rts51x_chip.h index 6d395b6..64257ca 100644 --- a/drivers/staging/rts5139/rts51x_chip.h +++ b/drivers/staging/rts5139/rts51x_chip.h @@ -204,7 +204,7 @@ struct trace_msg_t { /*---- error code ----*/ #define CUR_ERR 0x70 /* current error */ -/*---- sense key Infomation ----*/ +/*---- sense key Information ----*/ #define SKSV 0x80 #define CDB_ILLEGAL 0x40 diff --git a/drivers/staging/rts5139/rts51x_scsi.h b/drivers/staging/rts5139/rts51x_scsi.h index 060d2c2..9042bc9 100644 --- a/drivers/staging/rts5139/rts51x_scsi.h +++ b/drivers/staging/rts5139/rts51x_scsi.h @@ -73,7 +73,7 @@ #define GET_BATCHRSP 0x44 #ifdef SUPPORT_CPRM -/* SD Pass Through Command Extention */ +/* SD Pass Through Command Extension */ #define SD_PASS_THRU_MODE 0xD0 #define SD_EXECUTE_NO_DATA 0xD1 #define SD_EXECUTE_READ 0xD2 -- cgit v0.10.2 From 6fe864409b54f60ed36804752acfd148da459e53 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Sat, 9 Jun 2012 20:05:16 +0300 Subject: Staging: rtl8187se, rtl8192e: fix '&' vs '|' bugs The original code is equivalent to: wrqu->retry.flags = 0x1000 & 0x0002; so it just sets .flags to zero. We should be ORing the values together like r8192_wx_get_retry() does in drivers/staging/rtl8192u/r8192U_wx.c. Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/rtl8187se/r8180_wx.c b/drivers/staging/rtl8187se/r8180_wx.c index 46ee6f4..52f63d7 100644 --- a/drivers/staging/rtl8187se/r8180_wx.c +++ b/drivers/staging/rtl8187se/r8180_wx.c @@ -615,10 +615,10 @@ static int r8180_wx_get_retry(struct net_device *dev, return -EINVAL; if (wrqu->retry.flags & IW_RETRY_MAX) { - wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX; + wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MAX; wrqu->retry.value = priv->retry_rts; } else { - wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MIN; + wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MIN; wrqu->retry.value = priv->retry_data; } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index 778d7ba..6202358 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -919,10 +919,10 @@ static int r8192_wx_get_retry(struct net_device *dev, return -EINVAL; if (wrqu->retry.flags & IW_RETRY_MAX) { - wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX; + wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MAX; wrqu->retry.value = priv->retry_rts; } else { - wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MIN; + wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MIN; wrqu->retry.value = priv->retry_data; } return 0; -- cgit v0.10.2 From 67c4e9f46b5241ff777ced09e29048363de8703f Mon Sep 17 00:00:00 2001 From: "Javier M. Mellid" Date: Sun, 10 Jun 2012 13:12:22 +0200 Subject: staging: sm7xx: code improvement This patch simplifies code. It erases redundant code under little endian compilations. Signed-off-by: Javier M. Mellid Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sm7xx/smtcfb.c b/drivers/staging/sm7xx/smtcfb.c index 746c4cd5..2c172d6 100644 --- a/drivers/staging/sm7xx/smtcfb.c +++ b/drivers/staging/sm7xx/smtcfb.c @@ -724,16 +724,13 @@ static void smtc_unmap_mmio(struct smtcfb_info *sfb) static int smtc_map_smem(struct smtcfb_info *sfb, struct pci_dev *pdev, u_long smem_len) { - if (sfb->fb.var.bits_per_pixel == 32) { + + sfb->fb.fix.smem_start = pci_resource_start(pdev, 0); + #ifdef __BIG_ENDIAN - sfb->fb.fix.smem_start = pci_resource_start(pdev, 0) - + 0x800000; -#else - sfb->fb.fix.smem_start = pci_resource_start(pdev, 0); + if (sfb->fb.var.bits_per_pixel == 32) + sfb->fb.fix.smem_start += 0x800000; #endif - } else { - sfb->fb.fix.smem_start = pci_resource_start(pdev, 0); - } sfb->fb.fix.smem_len = smem_len; -- cgit v0.10.2 From 0beb30d365b0fb36c9cac7b7dbe980e882378f23 Mon Sep 17 00:00:00 2001 From: "Javier M. Mellid" Date: Sun, 10 Jun 2012 13:12:23 +0200 Subject: staging: sm7xx: update comments and clarify supported chips This patch updates/adds comments in order to clarify devices and Lynx families supported for this driver. Signed-off-by: Javier M. Mellid Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sm7xx/Kconfig b/drivers/staging/sm7xx/Kconfig index 315102c..323964f 100644 --- a/drivers/staging/sm7xx/Kconfig +++ b/drivers/staging/sm7xx/Kconfig @@ -1,8 +1,13 @@ config FB_SM7XX - tristate "Silicon Motion SM7XX Frame Buffer Support" + tristate "Silicon Motion SM7XX framebuffer support" depends on FB select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT help - Frame Buffer driver for the Silicon Motion SM7XX serial graphic card. + Frame buffer driver for the Silicon Motion SM710, SM712, SM721 + and SM722 chips. + + This driver is also available as a module. The module will be + called sm7xx. If you want to compile it as a module, say M + here and read . diff --git a/drivers/staging/sm7xx/smtcfb.c b/drivers/staging/sm7xx/smtcfb.c index 2c172d6..e7028a3 100644 --- a/drivers/staging/sm7xx/smtcfb.c +++ b/drivers/staging/sm7xx/smtcfb.c @@ -15,6 +15,7 @@ * License. See the file COPYING in the main directory of this archive for * more details. * + * Framebuffer driver for Silicon Motion SM710, SM712, SM721 and SM722 chips */ #include @@ -758,7 +759,7 @@ static void smtc_unmap_smem(struct smtcfb_info *sfb) } /* - * We need to wake up the LynxEM+, and make sure its in linear memory mode. + * We need to wake up the device and make sure its in linear memory mode. */ static inline void sm7xx_init_hw(void) { @@ -963,7 +964,11 @@ failed_free: return err; } - +/* + * 0x710 (LynxEM) + * 0x712 (LynxEM+) + * 0x720 (Lynx3DM, Lynx3DM+) + */ static DEFINE_PCI_DEVICE_TABLE(smtcfb_pci_table) = { { PCI_DEVICE(0x126f, 0x710), }, { PCI_DEVICE(0x126f, 0x712), }, @@ -971,7 +976,6 @@ static DEFINE_PCI_DEVICE_TABLE(smtcfb_pci_table) = { {0,} }; - static void __devexit smtcfb_pci_remove(struct pci_dev *pdev) { struct smtcfb_info *sfb; -- cgit v0.10.2 From 925aa6600cee015b694cb5fe2a9c667e0d9a68c6 Mon Sep 17 00:00:00 2001 From: "Javier M. Mellid" Date: Sun, 10 Jun 2012 13:12:24 +0200 Subject: staging: sm7xxfb: sm7xx becomes sm7xxfb Rename sm7xx driver to sm7xxfb. Fix Kconfig and Makefile to fit the new change. Changes are coherent with the rest of stable framebuffer drivers. TODO updated. Signed-off-by: Javier M. Mellid Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 05e33c7..38f1fb0 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -84,7 +84,7 @@ source "drivers/staging/wlags49_h2/Kconfig" source "drivers/staging/wlags49_h25/Kconfig" -source "drivers/staging/sm7xx/Kconfig" +source "drivers/staging/sm7xxfb/Kconfig" source "drivers/staging/crystalhd/Kconfig" diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index a987b3a..e0c4c24 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -37,7 +37,7 @@ obj-$(CONFIG_ZCACHE) += zcache/ obj-$(CONFIG_ZSMALLOC) += zsmalloc/ obj-$(CONFIG_WLAGS49_H2) += wlags49_h2/ obj-$(CONFIG_WLAGS49_H25) += wlags49_h25/ -obj-$(CONFIG_FB_SM7XX) += sm7xx/ +obj-$(CONFIG_FB_SM7XX) += sm7xxfb/ obj-$(CONFIG_CRYSTALHD) += crystalhd/ obj-$(CONFIG_CXT1E1) += cxt1e1/ obj-$(CONFIG_FB_XGI) += xgifb/ diff --git a/drivers/staging/sm7xx/Kconfig b/drivers/staging/sm7xx/Kconfig deleted file mode 100644 index 323964f..0000000 --- a/drivers/staging/sm7xx/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -config FB_SM7XX - tristate "Silicon Motion SM7XX framebuffer support" - depends on FB - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT - help - Frame buffer driver for the Silicon Motion SM710, SM712, SM721 - and SM722 chips. - - This driver is also available as a module. The module will be - called sm7xx. If you want to compile it as a module, say M - here and read . diff --git a/drivers/staging/sm7xx/Makefile b/drivers/staging/sm7xx/Makefile deleted file mode 100644 index f43cb91..0000000 --- a/drivers/staging/sm7xx/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -obj-$(CONFIG_FB_SM7XX) += sm7xx.o - -sm7xx-y := smtcfb.o diff --git a/drivers/staging/sm7xx/TODO b/drivers/staging/sm7xx/TODO deleted file mode 100644 index 7304021..0000000 --- a/drivers/staging/sm7xx/TODO +++ /dev/null @@ -1,9 +0,0 @@ -TODO: -- Dual head support -- 2D acceleration support -- use kernel coding style -- refine the code and remove unused code -- move it to drivers/video/sm7xx/ or make it be drivers/video/sm7xxfb.c - -Please send any patches to Greg Kroah-Hartman and -Teddy Wang . diff --git a/drivers/staging/sm7xx/smtcfb.c b/drivers/staging/sm7xx/smtcfb.c deleted file mode 100644 index e7028a3..0000000 --- a/drivers/staging/sm7xx/smtcfb.c +++ /dev/null @@ -1,1097 +0,0 @@ -/* - * Silicon Motion SM7XX frame buffer device - * - * Copyright (C) 2006 Silicon Motion Technology Corp. - * Authors: Ge Wang, gewang@siliconmotion.com - * Boyod boyod.yang@siliconmotion.com.cn - * - * Copyright (C) 2009 Lemote, Inc. - * Author: Wu Zhangjin, wuzhangjin@gmail.com - * - * Copyright (C) 2011 Igalia, S.L. - * Author: Javier M. Mellid - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file COPYING in the main directory of this archive for - * more details. - * - * Framebuffer driver for Silicon Motion SM710, SM712, SM721 and SM722 chips - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef CONFIG_PM -#include -#endif - -#include "smtcfb.h" - -struct screen_info smtc_screen_info; - -/* -* Private structure -*/ -struct smtcfb_info { - struct fb_info fb; - struct pci_dev *pdev; - struct { - u8 red, green, blue; - } palette[NR_RGB]; - u_int palette_size; - - u16 chipID; - unsigned char __iomem *m_pMMIO; - char __iomem *m_pLFB; - char *m_pDPR; - char *m_pVPR; - char *m_pCPR; - - u_int width; - u_int height; - u_int hz; - u_long BaseAddressInVRAM; - u8 chipRevID; -}; - -struct vesa_mode_table { - char mode_index[6]; - u16 lfb_width; - u16 lfb_height; - u16 lfb_depth; -}; - -static struct vesa_mode_table vesa_mode[] = { - {"0x301", 640, 480, 8}, - {"0x303", 800, 600, 8}, - {"0x305", 1024, 768, 8}, - {"0x307", 1280, 1024, 8}, - - {"0x311", 640, 480, 16}, - {"0x314", 800, 600, 16}, - {"0x317", 1024, 768, 16}, - {"0x31A", 1280, 1024, 16}, - - {"0x312", 640, 480, 24}, - {"0x315", 800, 600, 24}, - {"0x318", 1024, 768, 24}, - {"0x31B", 1280, 1024, 24}, -}; - -char __iomem *smtc_RegBaseAddress; /* Memory Map IO starting address */ -char __iomem *smtc_VRAMBaseAddress; /* video memory starting address */ - -static u32 colreg[17]; - -static struct fb_var_screeninfo smtcfb_var = { - .xres = 1024, - .yres = 600, - .xres_virtual = 1024, - .yres_virtual = 600, - .bits_per_pixel = 16, - .red = {16, 8, 0}, - .green = {8, 8, 0}, - .blue = {0, 8, 0}, - .activate = FB_ACTIVATE_NOW, - .height = -1, - .width = -1, - .vmode = FB_VMODE_NONINTERLACED, -}; - -static struct fb_fix_screeninfo smtcfb_fix = { - .id = "sm712fb", - .type = FB_TYPE_PACKED_PIXELS, - .visual = FB_VISUAL_TRUECOLOR, - .line_length = 800 * 3, - .accel = FB_ACCEL_SMI_LYNX, -}; - -static void sm712_set_timing(struct smtcfb_info *sfb) -{ - int i = 0, j = 0; - u32 m_nScreenStride; - - dev_dbg(&sfb->pdev->dev, - "sfb->width=%d sfb->height=%d " - "sfb->fb.var.bits_per_pixel=%d sfb->hz=%d\n", - sfb->width, sfb->height, sfb->fb.var.bits_per_pixel, sfb->hz); - - for (j = 0; j < numVGAModes; j++) { - if (VGAMode[j].mmSizeX == sfb->width && - VGAMode[j].mmSizeY == sfb->height && - VGAMode[j].bpp == sfb->fb.var.bits_per_pixel && - VGAMode[j].hz == sfb->hz) { - - dev_dbg(&sfb->pdev->dev, - "VGAMode[j].mmSizeX=%d VGAMode[j].mmSizeY=%d " - "VGAMode[j].bpp=%d VGAMode[j].hz=%d\n", - VGAMode[j].mmSizeX, VGAMode[j].mmSizeY, - VGAMode[j].bpp, VGAMode[j].hz); - - dev_dbg(&sfb->pdev->dev, "VGAMode index=%d\n", j); - - smtc_mmiowb(0x0, 0x3c6); - - smtc_seqw(0, 0x1); - - smtc_mmiowb(VGAMode[j].Init_MISC, 0x3c2); - - /* init SEQ register SR00 - SR04 */ - for (i = 0; i < SIZE_SR00_SR04; i++) - smtc_seqw(i, VGAMode[j].Init_SR00_SR04[i]); - - /* init SEQ register SR10 - SR24 */ - for (i = 0; i < SIZE_SR10_SR24; i++) - smtc_seqw(i + 0x10, - VGAMode[j].Init_SR10_SR24[i]); - - /* init SEQ register SR30 - SR75 */ - for (i = 0; i < SIZE_SR30_SR75; i++) - if (((i + 0x30) != 0x62) \ - && ((i + 0x30) != 0x6a) \ - && ((i + 0x30) != 0x6b)) - smtc_seqw(i + 0x30, - VGAMode[j].Init_SR30_SR75[i]); - - /* init SEQ register SR80 - SR93 */ - for (i = 0; i < SIZE_SR80_SR93; i++) - smtc_seqw(i + 0x80, - VGAMode[j].Init_SR80_SR93[i]); - - /* init SEQ register SRA0 - SRAF */ - for (i = 0; i < SIZE_SRA0_SRAF; i++) - smtc_seqw(i + 0xa0, - VGAMode[j].Init_SRA0_SRAF[i]); - - /* init Graphic register GR00 - GR08 */ - for (i = 0; i < SIZE_GR00_GR08; i++) - smtc_grphw(i, VGAMode[j].Init_GR00_GR08[i]); - - /* init Attribute register AR00 - AR14 */ - for (i = 0; i < SIZE_AR00_AR14; i++) - smtc_attrw(i, VGAMode[j].Init_AR00_AR14[i]); - - /* init CRTC register CR00 - CR18 */ - for (i = 0; i < SIZE_CR00_CR18; i++) - smtc_crtcw(i, VGAMode[j].Init_CR00_CR18[i]); - - /* init CRTC register CR30 - CR4D */ - for (i = 0; i < SIZE_CR30_CR4D; i++) - smtc_crtcw(i + 0x30, - VGAMode[j].Init_CR30_CR4D[i]); - - /* init CRTC register CR90 - CRA7 */ - for (i = 0; i < SIZE_CR90_CRA7; i++) - smtc_crtcw(i + 0x90, - VGAMode[j].Init_CR90_CRA7[i]); - } - } - smtc_mmiowb(0x67, 0x3c2); - - /* set VPR registers */ - writel(0x0, sfb->m_pVPR + 0x0C); - writel(0x0, sfb->m_pVPR + 0x40); - - /* set data width */ - m_nScreenStride = - (sfb->width * sfb->fb.var.bits_per_pixel) / 64; - switch (sfb->fb.var.bits_per_pixel) { - case 8: - writel(0x0, sfb->m_pVPR + 0x0); - break; - case 16: - writel(0x00020000, sfb->m_pVPR + 0x0); - break; - case 24: - writel(0x00040000, sfb->m_pVPR + 0x0); - break; - case 32: - writel(0x00030000, sfb->m_pVPR + 0x0); - break; - } - writel((u32) (((m_nScreenStride + 2) << 16) | m_nScreenStride), - sfb->m_pVPR + 0x10); - -} - -static void sm712_setpalette(int regno, unsigned red, unsigned green, - unsigned blue, struct fb_info *info) -{ - struct smtcfb_info *sfb = info->par; - - if (sfb->BaseAddressInVRAM) - /* - * second display palette for dual head. Enable CRT RAM, 6-bit - * RAM - */ - smtc_seqw(0x66, (smtc_seqr(0x66) & 0xC3) | 0x20); - else - /* primary display palette. Enable LCD RAM only, 6-bit RAM */ - smtc_seqw(0x66, (smtc_seqr(0x66) & 0xC3) | 0x10); - smtc_mmiowb(regno, dac_reg); - smtc_mmiowb(red >> 10, dac_val); - smtc_mmiowb(green >> 10, dac_val); - smtc_mmiowb(blue >> 10, dac_val); -} - -static void smtc_set_timing(struct smtcfb_info *sfb) -{ - switch (sfb->chipID) { - case 0x710: - case 0x712: - case 0x720: - sm712_set_timing(sfb); - break; - } -} - -/* chan_to_field - * - * convert a colour value into a field position - * - * from pxafb.c - */ - -static inline unsigned int chan_to_field(unsigned int chan, - struct fb_bitfield *bf) -{ - chan &= 0xffff; - chan >>= 16 - bf->length; - return chan << bf->offset; -} - -static int smtc_blank(int blank_mode, struct fb_info *info) -{ - /* clear DPMS setting */ - switch (blank_mode) { - case FB_BLANK_UNBLANK: - /* Screen On: HSync: On, VSync : On */ - smtc_seqw(0x01, (smtc_seqr(0x01) & (~0x20))); - smtc_seqw(0x6a, 0x16); - smtc_seqw(0x6b, 0x02); - smtc_seqw(0x21, (smtc_seqr(0x21) & 0x77)); - smtc_seqw(0x22, (smtc_seqr(0x22) & (~0x30))); - smtc_seqw(0x23, (smtc_seqr(0x23) & (~0xc0))); - smtc_seqw(0x24, (smtc_seqr(0x24) | 0x01)); - smtc_seqw(0x31, (smtc_seqr(0x31) | 0x03)); - break; - case FB_BLANK_NORMAL: - /* Screen Off: HSync: On, VSync : On Soft blank */ - smtc_seqw(0x01, (smtc_seqr(0x01) & (~0x20))); - smtc_seqw(0x6a, 0x16); - smtc_seqw(0x6b, 0x02); - smtc_seqw(0x22, (smtc_seqr(0x22) & (~0x30))); - smtc_seqw(0x23, (smtc_seqr(0x23) & (~0xc0))); - smtc_seqw(0x24, (smtc_seqr(0x24) | 0x01)); - smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00)); - break; - case FB_BLANK_VSYNC_SUSPEND: - /* Screen On: HSync: On, VSync : Off */ - smtc_seqw(0x01, (smtc_seqr(0x01) | 0x20)); - smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0))); - smtc_seqw(0x6a, 0x0c); - smtc_seqw(0x6b, 0x02); - smtc_seqw(0x21, (smtc_seqr(0x21) | 0x88)); - smtc_seqw(0x22, ((smtc_seqr(0x22) & (~0x30)) | 0x20)); - smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0x20)); - smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01))); - smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00)); - smtc_seqw(0x34, (smtc_seqr(0x34) | 0x80)); - break; - case FB_BLANK_HSYNC_SUSPEND: - /* Screen On: HSync: Off, VSync : On */ - smtc_seqw(0x01, (smtc_seqr(0x01) | 0x20)); - smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0))); - smtc_seqw(0x6a, 0x0c); - smtc_seqw(0x6b, 0x02); - smtc_seqw(0x21, (smtc_seqr(0x21) | 0x88)); - smtc_seqw(0x22, ((smtc_seqr(0x22) & (~0x30)) | 0x10)); - smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0xD8)); - smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01))); - smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00)); - smtc_seqw(0x34, (smtc_seqr(0x34) | 0x80)); - break; - case FB_BLANK_POWERDOWN: - /* Screen On: HSync: Off, VSync : Off */ - smtc_seqw(0x01, (smtc_seqr(0x01) | 0x20)); - smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0))); - smtc_seqw(0x6a, 0x0c); - smtc_seqw(0x6b, 0x02); - smtc_seqw(0x21, (smtc_seqr(0x21) | 0x88)); - smtc_seqw(0x22, ((smtc_seqr(0x22) & (~0x30)) | 0x30)); - smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0xD8)); - smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01))); - smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00)); - smtc_seqw(0x34, (smtc_seqr(0x34) | 0x80)); - break; - default: - return -EINVAL; - } - - return 0; -} - -static int smtc_setcolreg(unsigned regno, unsigned red, unsigned green, - unsigned blue, unsigned trans, struct fb_info *info) -{ - struct smtcfb_info *sfb = (struct smtcfb_info *)info; - u32 val; - - if (regno > 255) - return 1; - - switch (sfb->fb.fix.visual) { - case FB_VISUAL_DIRECTCOLOR: - case FB_VISUAL_TRUECOLOR: - /* - * 16/32 bit true-colour, use pseuo-palette for 16 base color - */ - if (regno < 16) { - if (sfb->fb.var.bits_per_pixel == 16) { - u32 *pal = sfb->fb.pseudo_palette; - val = chan_to_field(red, &sfb->fb.var.red); - val |= chan_to_field(green, \ - &sfb->fb.var.green); - val |= chan_to_field(blue, &sfb->fb.var.blue); -#ifdef __BIG_ENDIAN - pal[regno] = - ((red & 0xf800) >> 8) | - ((green & 0xe000) >> 13) | - ((green & 0x1c00) << 3) | - ((blue & 0xf800) >> 3); -#else - pal[regno] = val; -#endif - } else { - u32 *pal = sfb->fb.pseudo_palette; - val = chan_to_field(red, &sfb->fb.var.red); - val |= chan_to_field(green, \ - &sfb->fb.var.green); - val |= chan_to_field(blue, &sfb->fb.var.blue); -#ifdef __BIG_ENDIAN - val = - (val & 0xff00ff00 >> 8) | - (val & 0x00ff00ff << 8); -#endif - pal[regno] = val; - } - } - break; - - case FB_VISUAL_PSEUDOCOLOR: - /* color depth 8 bit */ - sm712_setpalette(regno, red, green, blue, info); - break; - - default: - return 1; /* unknown type */ - } - - return 0; - -} - -#ifdef __BIG_ENDIAN -static ssize_t smtcfb_read(struct fb_info *info, char __user *buf, size_t - count, loff_t *ppos) -{ - unsigned long p = *ppos; - - u32 *buffer, *dst; - u32 __iomem *src; - int c, i, cnt = 0, err = 0; - unsigned long total_size; - - if (!info || !info->screen_base) - return -ENODEV; - - if (info->state != FBINFO_STATE_RUNNING) - return -EPERM; - - total_size = info->screen_size; - - if (total_size == 0) - total_size = info->fix.smem_len; - - if (p >= total_size) - return 0; - - if (count >= total_size) - count = total_size; - - if (count + p > total_size) - count = total_size - p; - - buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, GFP_KERNEL); - if (!buffer) - return -ENOMEM; - - src = (u32 __iomem *) (info->screen_base + p); - - if (info->fbops->fb_sync) - info->fbops->fb_sync(info); - - while (count) { - c = (count > PAGE_SIZE) ? PAGE_SIZE : count; - dst = buffer; - for (i = c >> 2; i--;) { - *dst = fb_readl(src++); - *dst = - (*dst & 0xff00ff00 >> 8) | - (*dst & 0x00ff00ff << 8); - dst++; - } - if (c & 3) { - u8 *dst8 = (u8 *) dst; - u8 __iomem *src8 = (u8 __iomem *) src; - - for (i = c & 3; i--;) { - if (i & 1) { - *dst8++ = fb_readb(++src8); - } else { - *dst8++ = fb_readb(--src8); - src8 += 2; - } - } - src = (u32 __iomem *) src8; - } - - if (copy_to_user(buf, buffer, c)) { - err = -EFAULT; - break; - } - *ppos += c; - buf += c; - cnt += c; - count -= c; - } - - kfree(buffer); - - return (err) ? err : cnt; -} - -static ssize_t -smtcfb_write(struct fb_info *info, const char __user *buf, size_t count, - loff_t *ppos) -{ - unsigned long p = *ppos; - - u32 *buffer, *src; - u32 __iomem *dst; - int c, i, cnt = 0, err = 0; - unsigned long total_size; - - if (!info || !info->screen_base) - return -ENODEV; - - if (info->state != FBINFO_STATE_RUNNING) - return -EPERM; - - total_size = info->screen_size; - - if (total_size == 0) - total_size = info->fix.smem_len; - - if (p > total_size) - return -EFBIG; - - if (count > total_size) { - err = -EFBIG; - count = total_size; - } - - if (count + p > total_size) { - if (!err) - err = -ENOSPC; - - count = total_size - p; - } - - buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, GFP_KERNEL); - if (!buffer) - return -ENOMEM; - - dst = (u32 __iomem *) (info->screen_base + p); - - if (info->fbops->fb_sync) - info->fbops->fb_sync(info); - - while (count) { - c = (count > PAGE_SIZE) ? PAGE_SIZE : count; - src = buffer; - - if (copy_from_user(src, buf, c)) { - err = -EFAULT; - break; - } - - for (i = c >> 2; i--;) { - fb_writel((*src & 0xff00ff00 >> 8) | - (*src & 0x00ff00ff << 8), dst++); - src++; - } - if (c & 3) { - u8 *src8 = (u8 *) src; - u8 __iomem *dst8 = (u8 __iomem *) dst; - - for (i = c & 3; i--;) { - if (i & 1) { - fb_writeb(*src8++, ++dst8); - } else { - fb_writeb(*src8++, --dst8); - dst8 += 2; - } - } - dst = (u32 __iomem *) dst8; - } - - *ppos += c; - buf += c; - cnt += c; - count -= c; - } - - kfree(buffer); - - return (cnt) ? cnt : err; -} -#endif /* ! __BIG_ENDIAN */ - -void smtcfb_setmode(struct smtcfb_info *sfb) -{ - switch (sfb->fb.var.bits_per_pixel) { - case 32: - sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR; - sfb->fb.fix.line_length = sfb->fb.var.xres * 4; - sfb->fb.var.red.length = 8; - sfb->fb.var.green.length = 8; - sfb->fb.var.blue.length = 8; - sfb->fb.var.red.offset = 16; - sfb->fb.var.green.offset = 8; - sfb->fb.var.blue.offset = 0; - - break; - case 8: - sfb->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR; - sfb->fb.fix.line_length = sfb->fb.var.xres; - sfb->fb.var.red.offset = 5; - sfb->fb.var.red.length = 3; - sfb->fb.var.green.offset = 2; - sfb->fb.var.green.length = 3; - sfb->fb.var.blue.offset = 0; - sfb->fb.var.blue.length = 2; - break; - case 24: - sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR; - sfb->fb.fix.line_length = sfb->fb.var.xres * 3; - sfb->fb.var.red.length = 8; - sfb->fb.var.green.length = 8; - sfb->fb.var.blue.length = 8; - - sfb->fb.var.red.offset = 16; - sfb->fb.var.green.offset = 8; - sfb->fb.var.blue.offset = 0; - - break; - case 16: - default: - sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR; - sfb->fb.fix.line_length = sfb->fb.var.xres * 2; - - sfb->fb.var.red.length = 5; - sfb->fb.var.green.length = 6; - sfb->fb.var.blue.length = 5; - - sfb->fb.var.red.offset = 11; - sfb->fb.var.green.offset = 5; - sfb->fb.var.blue.offset = 0; - - break; - } - - sfb->width = sfb->fb.var.xres; - sfb->height = sfb->fb.var.yres; - sfb->hz = 60; - smtc_set_timing(sfb); -} - -static int smtc_check_var(struct fb_var_screeninfo *var, struct fb_info *info) -{ - /* sanity checks */ - if (var->xres_virtual < var->xres) - var->xres_virtual = var->xres; - - if (var->yres_virtual < var->yres) - var->yres_virtual = var->yres; - - /* set valid default bpp */ - if ((var->bits_per_pixel != 8) && (var->bits_per_pixel != 16) && - (var->bits_per_pixel != 24) && (var->bits_per_pixel != 32)) - var->bits_per_pixel = 16; - - return 0; -} - -static int smtc_set_par(struct fb_info *info) -{ - struct smtcfb_info *sfb = (struct smtcfb_info *)info; - - smtcfb_setmode(sfb); - - return 0; -} - -static struct fb_ops smtcfb_ops = { - .owner = THIS_MODULE, - .fb_check_var = smtc_check_var, - .fb_set_par = smtc_set_par, - .fb_setcolreg = smtc_setcolreg, - .fb_blank = smtc_blank, - .fb_fillrect = cfb_fillrect, - .fb_imageblit = cfb_imageblit, - .fb_copyarea = cfb_copyarea, -#ifdef __BIG_ENDIAN - .fb_read = smtcfb_read, - .fb_write = smtcfb_write, -#endif -}; - -/* - * Alloc struct smtcfb_info and assign the default value - */ -static struct smtcfb_info *smtc_alloc_fb_info(struct pci_dev *pdev, char *name) -{ - struct smtcfb_info *sfb; - - sfb = kzalloc(sizeof(*sfb), GFP_KERNEL); - - if (!sfb) - return NULL; - - sfb->pdev = pdev; - - /*** Init sfb->fb with default value ***/ - sfb->fb.flags = FBINFO_FLAG_DEFAULT; - sfb->fb.fbops = &smtcfb_ops; - sfb->fb.var = smtcfb_var; - sfb->fb.fix = smtcfb_fix; - - strcpy(sfb->fb.fix.id, name); - - sfb->fb.fix.type = FB_TYPE_PACKED_PIXELS; - sfb->fb.fix.type_aux = 0; - sfb->fb.fix.xpanstep = 0; - sfb->fb.fix.ypanstep = 0; - sfb->fb.fix.ywrapstep = 0; - sfb->fb.fix.accel = FB_ACCEL_SMI_LYNX; - - sfb->fb.var.nonstd = 0; - sfb->fb.var.activate = FB_ACTIVATE_NOW; - sfb->fb.var.height = -1; - sfb->fb.var.width = -1; - /* text mode acceleration */ - sfb->fb.var.accel_flags = FB_ACCELF_TEXT; - sfb->fb.var.vmode = FB_VMODE_NONINTERLACED; - - sfb->fb.par = sfb; - - sfb->fb.pseudo_palette = colreg; - - return sfb; -} - -/* - * Unmap in the memory mapped IO registers - */ - -static void smtc_unmap_mmio(struct smtcfb_info *sfb) -{ - if (sfb && smtc_RegBaseAddress) - smtc_RegBaseAddress = NULL; -} - -/* - * Map in the screen memory - */ - -static int smtc_map_smem(struct smtcfb_info *sfb, - struct pci_dev *pdev, u_long smem_len) -{ - - sfb->fb.fix.smem_start = pci_resource_start(pdev, 0); - -#ifdef __BIG_ENDIAN - if (sfb->fb.var.bits_per_pixel == 32) - sfb->fb.fix.smem_start += 0x800000; -#endif - - sfb->fb.fix.smem_len = smem_len; - - sfb->fb.screen_base = smtc_VRAMBaseAddress; - - if (!sfb->fb.screen_base) { - dev_err(&pdev->dev, - "%s: unable to map screen memory\n", sfb->fb.fix.id); - return -ENOMEM; - } - - return 0; -} - -/* - * Unmap in the screen memory - * - */ -static void smtc_unmap_smem(struct smtcfb_info *sfb) -{ - if (sfb && sfb->fb.screen_base) { - iounmap(sfb->fb.screen_base); - sfb->fb.screen_base = NULL; - } -} - -/* - * We need to wake up the device and make sure its in linear memory mode. - */ -static inline void sm7xx_init_hw(void) -{ - outb_p(0x18, 0x3c4); - outb_p(0x11, 0x3c5); -} - -static void smtc_free_fb_info(struct smtcfb_info *sfb) -{ - if (sfb) { - fb_alloc_cmap(&sfb->fb.cmap, 0, 0); - kfree(sfb); - } -} - -/* - * sm712vga_setup - process command line options, get vga parameter - * @options: string of options - * Returns zero. - * - */ -static int __init sm712vga_setup(char *options) -{ - int index; - - if (!options || !*options) - return -EINVAL; - - smtc_screen_info.lfb_width = 0; - smtc_screen_info.lfb_height = 0; - smtc_screen_info.lfb_depth = 0; - - pr_debug("sm712vga_setup = %s\n", options); - - for (index = 0; - index < ARRAY_SIZE(vesa_mode); - index++) { - if (strstr(options, vesa_mode[index].mode_index)) { - smtc_screen_info.lfb_width = vesa_mode[index].lfb_width; - smtc_screen_info.lfb_height = - vesa_mode[index].lfb_height; - smtc_screen_info.lfb_depth = vesa_mode[index].lfb_depth; - return 0; - } - } - - return -1; -} -__setup("vga=", sm712vga_setup); - -static int __devinit smtcfb_pci_probe(struct pci_dev *pdev, - const struct pci_device_id *ent) -{ - struct smtcfb_info *sfb; - u_long smem_size = 0x00800000; /* default 8MB */ - char name[16]; - int err; - unsigned long pFramebufferPhysical; - - dev_info(&pdev->dev, "Silicon Motion display driver."); - - err = pci_enable_device(pdev); /* enable SMTC chip */ - if (err) - return err; - - sfb = smtc_alloc_fb_info(pdev, name); - - if (!sfb) - goto failed_free; - - sfb->chipID = ent->device; - sprintf(name, "sm%Xfb", sfb->chipID); - - pci_set_drvdata(pdev, sfb); - - sm7xx_init_hw(); - - /*get mode parameter from smtc_screen_info */ - if (smtc_screen_info.lfb_width != 0) { - sfb->fb.var.xres = smtc_screen_info.lfb_width; - sfb->fb.var.yres = smtc_screen_info.lfb_height; - sfb->fb.var.bits_per_pixel = smtc_screen_info.lfb_depth; - } else { - /* default resolution 1024x600 16bit mode */ - sfb->fb.var.xres = SCREEN_X_RES; - sfb->fb.var.yres = SCREEN_Y_RES; - sfb->fb.var.bits_per_pixel = SCREEN_BPP; - } - -#ifdef __BIG_ENDIAN - if (sfb->fb.var.bits_per_pixel == 24) - sfb->fb.var.bits_per_pixel = (smtc_screen_info.lfb_depth = 32); -#endif - /* Map address and memory detection */ - pFramebufferPhysical = pci_resource_start(pdev, 0); - pci_read_config_byte(pdev, PCI_REVISION_ID, &sfb->chipRevID); - - switch (sfb->chipID) { - case 0x710: - case 0x712: - sfb->fb.fix.mmio_start = pFramebufferPhysical + 0x00400000; - sfb->fb.fix.mmio_len = 0x00400000; - smem_size = SM712_VIDEOMEMORYSIZE; -#ifdef __BIG_ENDIAN - sfb->m_pLFB = (smtc_VRAMBaseAddress = - ioremap(pFramebufferPhysical, 0x00c00000)); -#else - sfb->m_pLFB = (smtc_VRAMBaseAddress = - ioremap(pFramebufferPhysical, 0x00800000)); -#endif - sfb->m_pMMIO = (smtc_RegBaseAddress = - smtc_VRAMBaseAddress + 0x00700000); - sfb->m_pDPR = smtc_VRAMBaseAddress + 0x00408000; - sfb->m_pVPR = sfb->m_pLFB + 0x0040c000; -#ifdef __BIG_ENDIAN - if (sfb->fb.var.bits_per_pixel == 32) { - smtc_VRAMBaseAddress += 0x800000; - sfb->m_pLFB += 0x800000; - dev_info(&pdev->dev, - "smtc_VRAMBaseAddress=%p sfb->m_pLFB=%p", - smtc_VRAMBaseAddress, sfb->m_pLFB); - } -#endif - if (!smtc_RegBaseAddress) { - dev_err(&pdev->dev, - "%s: unable to map memory mapped IO!", - sfb->fb.fix.id); - err = -ENOMEM; - goto failed_fb; - } - - /* set MCLK = 14.31818 * (0x16 / 0x2) */ - smtc_seqw(0x6a, 0x16); - smtc_seqw(0x6b, 0x02); - smtc_seqw(0x62, 0x3e); - /* enable PCI burst */ - smtc_seqw(0x17, 0x20); - /* enable word swap */ -#ifdef __BIG_ENDIAN - if (sfb->fb.var.bits_per_pixel == 32) - smtc_seqw(0x17, 0x30); -#endif - break; - case 0x720: - sfb->fb.fix.mmio_start = pFramebufferPhysical; - sfb->fb.fix.mmio_len = 0x00200000; - smem_size = SM722_VIDEOMEMORYSIZE; - sfb->m_pDPR = ioremap(pFramebufferPhysical, 0x00a00000); - sfb->m_pLFB = (smtc_VRAMBaseAddress = - sfb->m_pDPR + 0x00200000); - sfb->m_pMMIO = (smtc_RegBaseAddress = - sfb->m_pDPR + 0x000c0000); - sfb->m_pVPR = sfb->m_pDPR + 0x800; - - smtc_seqw(0x62, 0xff); - smtc_seqw(0x6a, 0x0d); - smtc_seqw(0x6b, 0x02); - break; - default: - dev_err(&pdev->dev, - "No valid Silicon Motion display chip was detected!"); - - goto failed_fb; - } - - /* can support 32 bpp */ - if (15 == sfb->fb.var.bits_per_pixel) - sfb->fb.var.bits_per_pixel = 16; - - sfb->fb.var.xres_virtual = sfb->fb.var.xres; - sfb->fb.var.yres_virtual = sfb->fb.var.yres; - err = smtc_map_smem(sfb, pdev, smem_size); - if (err) - goto failed; - - smtcfb_setmode(sfb); - /* Primary display starting from 0 position */ - sfb->BaseAddressInVRAM = 0; - - err = register_framebuffer(&sfb->fb); - if (err < 0) - goto failed; - - dev_info(&pdev->dev, - "Silicon Motion SM%X Rev%X primary display mode %dx%d-%d Init Complete.", - sfb->chipID, sfb->chipRevID, sfb->fb.var.xres, - sfb->fb.var.yres, sfb->fb.var.bits_per_pixel); - - return 0; - -failed: - dev_err(&pdev->dev, "Silicon Motion, Inc. primary display init fail."); - - smtc_unmap_smem(sfb); - smtc_unmap_mmio(sfb); -failed_fb: - smtc_free_fb_info(sfb); - -failed_free: - pci_disable_device(pdev); - - return err; -} - -/* - * 0x710 (LynxEM) - * 0x712 (LynxEM+) - * 0x720 (Lynx3DM, Lynx3DM+) - */ -static DEFINE_PCI_DEVICE_TABLE(smtcfb_pci_table) = { - { PCI_DEVICE(0x126f, 0x710), }, - { PCI_DEVICE(0x126f, 0x712), }, - { PCI_DEVICE(0x126f, 0x720), }, - {0,} -}; - -static void __devexit smtcfb_pci_remove(struct pci_dev *pdev) -{ - struct smtcfb_info *sfb; - - sfb = pci_get_drvdata(pdev); - pci_set_drvdata(pdev, NULL); - smtc_unmap_smem(sfb); - smtc_unmap_mmio(sfb); - unregister_framebuffer(&sfb->fb); - smtc_free_fb_info(sfb); -} - -#ifdef CONFIG_PM -static int smtcfb_pci_suspend(struct device *device) -{ - struct pci_dev *pdev = to_pci_dev(device); - struct smtcfb_info *sfb; - - sfb = pci_get_drvdata(pdev); - - /* set the hw in sleep mode use externel clock and self memory refresh - * so that we can turn off internal PLLs later on - */ - smtc_seqw(0x20, (smtc_seqr(0x20) | 0xc0)); - smtc_seqw(0x69, (smtc_seqr(0x69) & 0xf7)); - - console_lock(); - fb_set_suspend(&sfb->fb, 1); - console_unlock(); - - /* additionally turn off all function blocks including internal PLLs */ - smtc_seqw(0x21, 0xff); - - return 0; -} - -static int smtcfb_pci_resume(struct device *device) -{ - struct pci_dev *pdev = to_pci_dev(device); - struct smtcfb_info *sfb; - - sfb = pci_get_drvdata(pdev); - - /* reinit hardware */ - sm7xx_init_hw(); - switch (sfb->chipID) { - case 0x710: - case 0x712: - /* set MCLK = 14.31818 * (0x16 / 0x2) */ - smtc_seqw(0x6a, 0x16); - smtc_seqw(0x6b, 0x02); - smtc_seqw(0x62, 0x3e); - /* enable PCI burst */ - smtc_seqw(0x17, 0x20); -#ifdef __BIG_ENDIAN - if (sfb->fb.var.bits_per_pixel == 32) - smtc_seqw(0x17, 0x30); -#endif - break; - case 0x720: - smtc_seqw(0x62, 0xff); - smtc_seqw(0x6a, 0x0d); - smtc_seqw(0x6b, 0x02); - break; - } - - smtc_seqw(0x34, (smtc_seqr(0x34) | 0xc0)); - smtc_seqw(0x33, ((smtc_seqr(0x33) | 0x08) & 0xfb)); - - smtcfb_setmode(sfb); - - console_lock(); - fb_set_suspend(&sfb->fb, 0); - console_unlock(); - - return 0; -} - -static const struct dev_pm_ops sm7xx_pm_ops = { - .suspend = smtcfb_pci_suspend, - .resume = smtcfb_pci_resume, - .freeze = smtcfb_pci_suspend, - .thaw = smtcfb_pci_resume, - .poweroff = smtcfb_pci_suspend, - .restore = smtcfb_pci_resume, -}; - -#define SM7XX_PM_OPS (&sm7xx_pm_ops) - -#else /* !CONFIG_PM */ - -#define SM7XX_PM_OPS NULL - -#endif /* !CONFIG_PM */ - -static struct pci_driver smtcfb_driver = { - .name = "smtcfb", - .id_table = smtcfb_pci_table, - .probe = smtcfb_pci_probe, - .remove = __devexit_p(smtcfb_pci_remove), - .driver.pm = SM7XX_PM_OPS, -}; - -static int __init smtcfb_init(void) -{ - return pci_register_driver(&smtcfb_driver); -} - -static void __exit smtcfb_exit(void) -{ - pci_unregister_driver(&smtcfb_driver); -} - -module_init(smtcfb_init); -module_exit(smtcfb_exit); - -MODULE_AUTHOR("Siliconmotion "); -MODULE_DESCRIPTION("Framebuffer driver for SMI Graphic Cards"); -MODULE_LICENSE("GPL"); diff --git a/drivers/staging/sm7xx/smtcfb.h b/drivers/staging/sm7xx/smtcfb.h deleted file mode 100644 index 43d86f8..0000000 --- a/drivers/staging/sm7xx/smtcfb.h +++ /dev/null @@ -1,780 +0,0 @@ -/* - * Silicon Motion SM712 frame buffer device - * - * Copyright (C) 2006 Silicon Motion Technology Corp. - * Authors: Ge Wang, gewang@siliconmotion.com - * Boyod boyod.yang@siliconmotion.com.cn - * - * Copyright (C) 2009 Lemote, Inc. - * Author: Wu Zhangjin, wuzhangjin@gmail.com - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file COPYING in the main directory of this archive for - * more details. - */ - -#define NR_PALETTE 256 -#define NR_RGB 2 - -#define FB_ACCEL_SMI_LYNX 88 - -#define SCREEN_X_RES 1024 -#define SCREEN_Y_RES 600 -#define SCREEN_BPP 16 - -/*Assume SM712 graphics chip has 4MB VRAM */ -#define SM712_VIDEOMEMORYSIZE 0x00400000 -/*Assume SM722 graphics chip has 8MB VRAM */ -#define SM722_VIDEOMEMORYSIZE 0x00800000 - -#define dac_reg (0x3c8) -#define dac_val (0x3c9) - -extern char __iomem *smtc_RegBaseAddress; -#define smtc_mmiowb(dat, reg) writeb(dat, smtc_RegBaseAddress + reg) -#define smtc_mmioww(dat, reg) writew(dat, smtc_RegBaseAddress + reg) -#define smtc_mmiowl(dat, reg) writel(dat, smtc_RegBaseAddress + reg) - -#define smtc_mmiorb(reg) readb(smtc_RegBaseAddress + reg) -#define smtc_mmiorw(reg) readw(smtc_RegBaseAddress + reg) -#define smtc_mmiorl(reg) readl(smtc_RegBaseAddress + reg) - -#define SIZE_SR00_SR04 (0x04 - 0x00 + 1) -#define SIZE_SR10_SR24 (0x24 - 0x10 + 1) -#define SIZE_SR30_SR75 (0x75 - 0x30 + 1) -#define SIZE_SR80_SR93 (0x93 - 0x80 + 1) -#define SIZE_SRA0_SRAF (0xAF - 0xA0 + 1) -#define SIZE_GR00_GR08 (0x08 - 0x00 + 1) -#define SIZE_AR00_AR14 (0x14 - 0x00 + 1) -#define SIZE_CR00_CR18 (0x18 - 0x00 + 1) -#define SIZE_CR30_CR4D (0x4D - 0x30 + 1) -#define SIZE_CR90_CRA7 (0xA7 - 0x90 + 1) -#define SIZE_VPR (0x6C + 1) -#define SIZE_DPR (0x44 + 1) - -static inline void smtc_crtcw(int reg, int val) -{ - smtc_mmiowb(reg, 0x3d4); - smtc_mmiowb(val, 0x3d5); -} - -static inline unsigned int smtc_crtcr(int reg) -{ - smtc_mmiowb(reg, 0x3d4); - return smtc_mmiorb(0x3d5); -} - -static inline void smtc_grphw(int reg, int val) -{ - smtc_mmiowb(reg, 0x3ce); - smtc_mmiowb(val, 0x3cf); -} - -static inline unsigned int smtc_grphr(int reg) -{ - smtc_mmiowb(reg, 0x3ce); - return smtc_mmiorb(0x3cf); -} - -static inline void smtc_attrw(int reg, int val) -{ - smtc_mmiorb(0x3da); - smtc_mmiowb(reg, 0x3c0); - smtc_mmiorb(0x3c1); - smtc_mmiowb(val, 0x3c0); -} - -static inline void smtc_seqw(int reg, int val) -{ - smtc_mmiowb(reg, 0x3c4); - smtc_mmiowb(val, 0x3c5); -} - -static inline unsigned int smtc_seqr(int reg) -{ - smtc_mmiowb(reg, 0x3c4); - return smtc_mmiorb(0x3c5); -} - -/* The next structure holds all information relevant for a specific video mode. - */ - -struct ModeInit { - int mmSizeX; - int mmSizeY; - int bpp; - int hz; - unsigned char Init_MISC; - unsigned char Init_SR00_SR04[SIZE_SR00_SR04]; - unsigned char Init_SR10_SR24[SIZE_SR10_SR24]; - unsigned char Init_SR30_SR75[SIZE_SR30_SR75]; - unsigned char Init_SR80_SR93[SIZE_SR80_SR93]; - unsigned char Init_SRA0_SRAF[SIZE_SRA0_SRAF]; - unsigned char Init_GR00_GR08[SIZE_GR00_GR08]; - unsigned char Init_AR00_AR14[SIZE_AR00_AR14]; - unsigned char Init_CR00_CR18[SIZE_CR00_CR18]; - unsigned char Init_CR30_CR4D[SIZE_CR30_CR4D]; - unsigned char Init_CR90_CRA7[SIZE_CR90_CRA7]; -}; - -/********************************************************************** - SM712 Mode table. - **********************************************************************/ -struct ModeInit VGAMode[] = { - { - /* mode#0: 640 x 480 16Bpp 60Hz */ - 640, 480, 16, 60, - /* Init_MISC */ - 0xE3, - { /* Init_SR0_SR4 */ - 0x03, 0x01, 0x0F, 0x00, 0x0E, - }, - { /* Init_SR10_SR24 */ - 0xFF, 0xBE, 0xEF, 0xFF, 0x00, 0x0E, 0x17, 0x2C, - 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xC4, 0x30, 0x02, 0x01, 0x01, - }, - { /* Init_SR30_SR75 */ - 0x32, 0x03, 0xA0, 0x09, 0xC0, 0x32, 0x32, 0x32, - 0x32, 0x32, 0x32, 0x32, 0x00, 0x00, 0x03, 0xFF, - 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC, - 0x20, 0x0C, 0x44, 0x20, 0x00, 0x32, 0x32, 0x32, - 0x04, 0x24, 0x63, 0x4F, 0x52, 0x0B, 0xDF, 0xEA, - 0x04, 0x50, 0x19, 0x32, 0x32, 0x00, 0x00, 0x32, - 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00, - 0x50, 0x03, 0x74, 0x14, 0x07, 0x82, 0x07, 0x04, - 0x00, 0x45, 0x30, 0x30, 0x40, 0x30, - }, - { /* Init_SR80_SR93 */ - 0xFF, 0x07, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x32, - 0xF7, 0x00, 0x00, 0x00, 0xEF, 0xFF, 0x32, 0x32, - 0x00, 0x00, 0x00, 0x00, - }, - { /* Init_SRA0_SRAF */ - 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED, - 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xFF, 0xDF, - }, - { /* Init_GR00_GR08 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, - 0xFF, - }, - { /* Init_AR00_AR14 */ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x41, 0x00, 0x0F, 0x00, 0x00, - }, - { /* Init_CR00_CR18 */ - 0x5F, 0x4F, 0x4F, 0x00, 0x53, 0x1F, 0x0B, 0x3E, - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xEA, 0x0C, 0xDF, 0x50, 0x40, 0xDF, 0x00, 0xE3, - 0xFF, - }, - { /* Init_CR30_CR4D */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x03, 0x20, - 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xFF, 0xFD, - 0x5F, 0x4F, 0x00, 0x54, 0x00, 0x0B, 0xDF, 0x00, - 0xEA, 0x0C, 0x2E, 0x00, 0x4F, 0xDF, - }, - { /* Init_CR90_CRA7 */ - 0x56, 0xDD, 0x5E, 0xEA, 0x87, 0x44, 0x8F, 0x55, - 0x0A, 0x8F, 0x55, 0x0A, 0x00, 0x00, 0x18, 0x00, - 0x11, 0x10, 0x0B, 0x0A, 0x0A, 0x0A, 0x0A, 0x00, - }, - }, - { - /* mode#1: 640 x 480 24Bpp 60Hz */ - 640, 480, 24, 60, - /* Init_MISC */ - 0xE3, - { /* Init_SR0_SR4 */ - 0x03, 0x01, 0x0F, 0x00, 0x0E, - }, - { /* Init_SR10_SR24 */ - 0xFF, 0xBE, 0xEF, 0xFF, 0x00, 0x0E, 0x17, 0x2C, - 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xC4, 0x30, 0x02, 0x01, 0x01, - }, - { /* Init_SR30_SR75 */ - 0x32, 0x03, 0xA0, 0x09, 0xC0, 0x32, 0x32, 0x32, - 0x32, 0x32, 0x32, 0x32, 0x00, 0x00, 0x03, 0xFF, - 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC, - 0x20, 0x0C, 0x44, 0x20, 0x00, 0x32, 0x32, 0x32, - 0x04, 0x24, 0x63, 0x4F, 0x52, 0x0B, 0xDF, 0xEA, - 0x04, 0x50, 0x19, 0x32, 0x32, 0x00, 0x00, 0x32, - 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00, - 0x50, 0x03, 0x74, 0x14, 0x07, 0x82, 0x07, 0x04, - 0x00, 0x45, 0x30, 0x30, 0x40, 0x30, - }, - { /* Init_SR80_SR93 */ - 0xFF, 0x07, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x32, - 0xF7, 0x00, 0x00, 0x00, 0xEF, 0xFF, 0x32, 0x32, - 0x00, 0x00, 0x00, 0x00, - }, - { /* Init_SRA0_SRAF */ - 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED, - 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xFF, 0xDF, - }, - { /* Init_GR00_GR08 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, - 0xFF, - }, - { /* Init_AR00_AR14 */ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x41, 0x00, 0x0F, 0x00, 0x00, - }, - { /* Init_CR00_CR18 */ - 0x5F, 0x4F, 0x4F, 0x00, 0x53, 0x1F, 0x0B, 0x3E, - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xEA, 0x0C, 0xDF, 0x50, 0x40, 0xDF, 0x00, 0xE3, - 0xFF, - }, - { /* Init_CR30_CR4D */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x03, 0x20, - 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xFF, 0xFD, - 0x5F, 0x4F, 0x00, 0x54, 0x00, 0x0B, 0xDF, 0x00, - 0xEA, 0x0C, 0x2E, 0x00, 0x4F, 0xDF, - }, - { /* Init_CR90_CRA7 */ - 0x56, 0xDD, 0x5E, 0xEA, 0x87, 0x44, 0x8F, 0x55, - 0x0A, 0x8F, 0x55, 0x0A, 0x00, 0x00, 0x18, 0x00, - 0x11, 0x10, 0x0B, 0x0A, 0x0A, 0x0A, 0x0A, 0x00, - }, - }, - { - /* mode#0: 640 x 480 32Bpp 60Hz */ - 640, 480, 32, 60, - /* Init_MISC */ - 0xE3, - { /* Init_SR0_SR4 */ - 0x03, 0x01, 0x0F, 0x00, 0x0E, - }, - { /* Init_SR10_SR24 */ - 0xFF, 0xBE, 0xEF, 0xFF, 0x00, 0x0E, 0x17, 0x2C, - 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xC4, 0x30, 0x02, 0x01, 0x01, - }, - { /* Init_SR30_SR75 */ - 0x32, 0x03, 0xA0, 0x09, 0xC0, 0x32, 0x32, 0x32, - 0x32, 0x32, 0x32, 0x32, 0x00, 0x00, 0x03, 0xFF, - 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC, - 0x20, 0x0C, 0x44, 0x20, 0x00, 0x32, 0x32, 0x32, - 0x04, 0x24, 0x63, 0x4F, 0x52, 0x0B, 0xDF, 0xEA, - 0x04, 0x50, 0x19, 0x32, 0x32, 0x00, 0x00, 0x32, - 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00, - 0x50, 0x03, 0x74, 0x14, 0x07, 0x82, 0x07, 0x04, - 0x00, 0x45, 0x30, 0x30, 0x40, 0x30, - }, - { /* Init_SR80_SR93 */ - 0xFF, 0x07, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x32, - 0xF7, 0x00, 0x00, 0x00, 0xEF, 0xFF, 0x32, 0x32, - 0x00, 0x00, 0x00, 0x00, - }, - { /* Init_SRA0_SRAF */ - 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED, - 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xFF, 0xDF, - }, - { /* Init_GR00_GR08 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, - 0xFF, - }, - { /* Init_AR00_AR14 */ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x41, 0x00, 0x0F, 0x00, 0x00, - }, - { /* Init_CR00_CR18 */ - 0x5F, 0x4F, 0x4F, 0x00, 0x53, 0x1F, 0x0B, 0x3E, - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xEA, 0x0C, 0xDF, 0x50, 0x40, 0xDF, 0x00, 0xE3, - 0xFF, - }, - { /* Init_CR30_CR4D */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x03, 0x20, - 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xFF, 0xFD, - 0x5F, 0x4F, 0x00, 0x54, 0x00, 0x0B, 0xDF, 0x00, - 0xEA, 0x0C, 0x2E, 0x00, 0x4F, 0xDF, - }, - { /* Init_CR90_CRA7 */ - 0x56, 0xDD, 0x5E, 0xEA, 0x87, 0x44, 0x8F, 0x55, - 0x0A, 0x8F, 0x55, 0x0A, 0x00, 0x00, 0x18, 0x00, - 0x11, 0x10, 0x0B, 0x0A, 0x0A, 0x0A, 0x0A, 0x00, - }, - }, - - { /* mode#2: 800 x 600 16Bpp 60Hz */ - 800, 600, 16, 60, - /* Init_MISC */ - 0x2B, - { /* Init_SR0_SR4 */ - 0x03, 0x01, 0x0F, 0x03, 0x0E, - }, - { /* Init_SR10_SR24 */ - 0xFF, 0xBE, 0xEE, 0xFF, 0x00, 0x0E, 0x17, 0x2C, - 0x99, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xC4, 0x30, 0x02, 0x01, 0x01, - }, - { /* Init_SR30_SR75 */ - 0x34, 0x03, 0x20, 0x09, 0xC0, 0x24, 0x24, 0x24, - 0x24, 0x24, 0x24, 0x24, 0x00, 0x00, 0x03, 0xFF, - 0x00, 0xFC, 0x00, 0x00, 0x20, 0x38, 0x00, 0xFC, - 0x20, 0x0C, 0x44, 0x20, 0x00, 0x24, 0x24, 0x24, - 0x04, 0x48, 0x83, 0x63, 0x68, 0x72, 0x57, 0x58, - 0x04, 0x55, 0x59, 0x24, 0x24, 0x00, 0x00, 0x24, - 0x01, 0x80, 0x7A, 0x1A, 0x1A, 0x00, 0x00, 0x00, - 0x50, 0x03, 0x74, 0x14, 0x1C, 0x85, 0x35, 0x13, - 0x02, 0x45, 0x30, 0x35, 0x40, 0x20, - }, - { /* Init_SR80_SR93 */ - 0x00, 0x00, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x24, - 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x24, 0x24, - 0x00, 0x00, 0x00, 0x00, - }, - { /* Init_SRA0_SRAF */ - 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED, - 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xBF, 0xDF, - }, - { /* Init_GR00_GR08 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, - 0xFF, - }, - { /* Init_AR00_AR14 */ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x41, 0x00, 0x0F, 0x00, 0x00, - }, - { /* Init_CR00_CR18 */ - 0x7F, 0x63, 0x63, 0x00, 0x68, 0x18, 0x72, 0xF0, - 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x58, 0x0C, 0x57, 0x64, 0x40, 0x57, 0x00, 0xE3, - 0xFF, - }, - { /* Init_CR30_CR4D */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x03, 0x20, - 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xBF, 0xFD, - 0x7F, 0x63, 0x00, 0x69, 0x18, 0x72, 0x57, 0x00, - 0x58, 0x0C, 0xE0, 0x20, 0x63, 0x57, - }, - { /* Init_CR90_CRA7 */ - 0x56, 0x4B, 0x5E, 0x55, 0x86, 0x9D, 0x8E, 0xAA, - 0xDB, 0x2A, 0xDF, 0x33, 0x00, 0x00, 0x18, 0x00, - 0x20, 0x1F, 0x1A, 0x19, 0x0F, 0x0F, 0x0F, 0x00, - }, - }, - { /* mode#3: 800 x 600 24Bpp 60Hz */ - 800, 600, 24, 60, - 0x2B, - { /* Init_SR0_SR4 */ - 0x03, 0x01, 0x0F, 0x03, 0x0E, - }, - { /* Init_SR10_SR24 */ - 0xFF, 0xBE, 0xEE, 0xFF, 0x00, 0x0E, 0x17, 0x2C, - 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xC4, 0x30, 0x02, 0x01, 0x01, - }, - { /* Init_SR30_SR75 */ - 0x36, 0x03, 0x20, 0x09, 0xC0, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x03, 0xFF, - 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC, - 0x20, 0x0C, 0x44, 0x20, 0x00, 0x36, 0x36, 0x36, - 0x04, 0x48, 0x83, 0x63, 0x68, 0x72, 0x57, 0x58, - 0x04, 0x55, 0x59, 0x36, 0x36, 0x00, 0x00, 0x36, - 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00, - 0x50, 0x03, 0x74, 0x14, 0x1C, 0x85, 0x35, 0x13, - 0x02, 0x45, 0x30, 0x30, 0x40, 0x20, - }, - { /* Init_SR80_SR93 */ - 0xFF, 0x07, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x36, - 0xF7, 0x00, 0x00, 0x00, 0xEF, 0xFF, 0x36, 0x36, - 0x00, 0x00, 0x00, 0x00, - }, - { /* Init_SRA0_SRAF */ - 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED, - 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xBF, 0xDF, - }, - { /* Init_GR00_GR08 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, - 0xFF, - }, - { /* Init_AR00_AR14 */ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x41, 0x00, 0x0F, 0x00, 0x00, - }, - { /* Init_CR00_CR18 */ - 0x7F, 0x63, 0x63, 0x00, 0x68, 0x18, 0x72, 0xF0, - 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x58, 0x0C, 0x57, 0x64, 0x40, 0x57, 0x00, 0xE3, - 0xFF, - }, - { /* Init_CR30_CR4D */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x03, 0x20, - 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xBF, 0xFD, - 0x7F, 0x63, 0x00, 0x69, 0x18, 0x72, 0x57, 0x00, - 0x58, 0x0C, 0xE0, 0x20, 0x63, 0x57, - }, - { /* Init_CR90_CRA7 */ - 0x56, 0x4B, 0x5E, 0x55, 0x86, 0x9D, 0x8E, 0xAA, - 0xDB, 0x2A, 0xDF, 0x33, 0x00, 0x00, 0x18, 0x00, - 0x20, 0x1F, 0x1A, 0x19, 0x0F, 0x0F, 0x0F, 0x00, - }, - }, - { /* mode#7: 800 x 600 32Bpp 60Hz */ - 800, 600, 32, 60, - /* Init_MISC */ - 0x2B, - { /* Init_SR0_SR4 */ - 0x03, 0x01, 0x0F, 0x03, 0x0E, - }, - { /* Init_SR10_SR24 */ - 0xFF, 0xBE, 0xEE, 0xFF, 0x00, 0x0E, 0x17, 0x2C, - 0x99, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xC4, 0x30, 0x02, 0x01, 0x01, - }, - { /* Init_SR30_SR75 */ - 0x34, 0x03, 0x20, 0x09, 0xC0, 0x24, 0x24, 0x24, - 0x24, 0x24, 0x24, 0x24, 0x00, 0x00, 0x03, 0xFF, - 0x00, 0xFC, 0x00, 0x00, 0x20, 0x38, 0x00, 0xFC, - 0x20, 0x0C, 0x44, 0x20, 0x00, 0x24, 0x24, 0x24, - 0x04, 0x48, 0x83, 0x63, 0x68, 0x72, 0x57, 0x58, - 0x04, 0x55, 0x59, 0x24, 0x24, 0x00, 0x00, 0x24, - 0x01, 0x80, 0x7A, 0x1A, 0x1A, 0x00, 0x00, 0x00, - 0x50, 0x03, 0x74, 0x14, 0x1C, 0x85, 0x35, 0x13, - 0x02, 0x45, 0x30, 0x35, 0x40, 0x20, - }, - { /* Init_SR80_SR93 */ - 0x00, 0x00, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x24, - 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x24, 0x24, - 0x00, 0x00, 0x00, 0x00, - }, - { /* Init_SRA0_SRAF */ - 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED, - 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xBF, 0xDF, - }, - { /* Init_GR00_GR08 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, - 0xFF, - }, - { /* Init_AR00_AR14 */ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x41, 0x00, 0x0F, 0x00, 0x00, - }, - { /* Init_CR00_CR18 */ - 0x7F, 0x63, 0x63, 0x00, 0x68, 0x18, 0x72, 0xF0, - 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x58, 0x0C, 0x57, 0x64, 0x40, 0x57, 0x00, 0xE3, - 0xFF, - }, - { /* Init_CR30_CR4D */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x03, 0x20, - 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xBF, 0xFD, - 0x7F, 0x63, 0x00, 0x69, 0x18, 0x72, 0x57, 0x00, - 0x58, 0x0C, 0xE0, 0x20, 0x63, 0x57, - }, - { /* Init_CR90_CRA7 */ - 0x56, 0x4B, 0x5E, 0x55, 0x86, 0x9D, 0x8E, 0xAA, - 0xDB, 0x2A, 0xDF, 0x33, 0x00, 0x00, 0x18, 0x00, - 0x20, 0x1F, 0x1A, 0x19, 0x0F, 0x0F, 0x0F, 0x00, - }, - }, - /* We use 1024x768 table to light 1024x600 panel for lemote */ - { /* mode#4: 1024 x 600 16Bpp 60Hz */ - 1024, 600, 16, 60, - /* Init_MISC */ - 0xEB, - { /* Init_SR0_SR4 */ - 0x03, 0x01, 0x0F, 0x00, 0x0E, - }, - { /* Init_SR10_SR24 */ - 0xC8, 0x40, 0x14, 0x60, 0x00, 0x0A, 0x17, 0x20, - 0x51, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xC4, 0x30, 0x02, 0x00, 0x01, - }, - { /* Init_SR30_SR75 */ - 0x22, 0x03, 0x24, 0x09, 0xC0, 0x22, 0x22, 0x22, - 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x03, 0xFF, - 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC, - 0x20, 0x0C, 0x44, 0x20, 0x00, 0x22, 0x22, 0x22, - 0x06, 0x68, 0xA7, 0x7F, 0x83, 0x24, 0xFF, 0x03, - 0x00, 0x60, 0x59, 0x22, 0x22, 0x00, 0x00, 0x22, - 0x01, 0x80, 0x7A, 0x1A, 0x1A, 0x00, 0x00, 0x00, - 0x50, 0x03, 0x16, 0x02, 0x0D, 0x82, 0x09, 0x02, - 0x04, 0x45, 0x3F, 0x30, 0x40, 0x20, - }, - { /* Init_SR80_SR93 */ - 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3A, - 0xF7, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3A, 0x3A, - 0x00, 0x00, 0x00, 0x00, - }, - { /* Init_SRA0_SRAF */ - 0x00, 0xFB, 0x9F, 0x01, 0x00, 0xED, 0xED, 0xED, - 0x7B, 0xFB, 0xFF, 0xFF, 0x97, 0xEF, 0xBF, 0xDF, - }, - { /* Init_GR00_GR08 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, - 0xFF, - }, - { /* Init_AR00_AR14 */ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x41, 0x00, 0x0F, 0x00, 0x00, - }, - { /* Init_CR00_CR18 */ - 0xA3, 0x7F, 0x7F, 0x00, 0x85, 0x16, 0x24, 0xF5, - 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x09, 0xFF, 0x80, 0x40, 0xFF, 0x00, 0xE3, - 0xFF, - }, - { /* Init_CR30_CR4D */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20, - 0x00, 0x00, 0x00, 0x40, 0x00, 0xFF, 0xBF, 0xFF, - 0xA3, 0x7F, 0x00, 0x82, 0x0b, 0x6f, 0x57, 0x00, - 0x5c, 0x0f, 0xE0, 0xe0, 0x7F, 0x57, - }, - { /* Init_CR90_CRA7 */ - 0x55, 0xD9, 0x5D, 0xE1, 0x86, 0x1B, 0x8E, 0x26, - 0xDA, 0x8D, 0xDE, 0x94, 0x00, 0x00, 0x18, 0x00, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03, - }, - }, - { /* mode#5: 1024 x 768 24Bpp 60Hz */ - 1024, 768, 24, 60, - /* Init_MISC */ - 0xEB, - { /* Init_SR0_SR4 */ - 0x03, 0x01, 0x0F, 0x03, 0x0E, - }, - { /* Init_SR10_SR24 */ - 0xF3, 0xB6, 0xC0, 0xDD, 0x00, 0x0E, 0x17, 0x2C, - 0x99, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xC4, 0x30, 0x02, 0x01, 0x01, - }, - { /* Init_SR30_SR75 */ - 0x38, 0x03, 0x20, 0x09, 0xC0, 0x3A, 0x3A, 0x3A, - 0x3A, 0x3A, 0x3A, 0x3A, 0x00, 0x00, 0x03, 0xFF, - 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC, - 0x20, 0x0C, 0x44, 0x20, 0x00, 0x00, 0x00, 0x3A, - 0x06, 0x68, 0xA7, 0x7F, 0x83, 0x24, 0xFF, 0x03, - 0x00, 0x60, 0x59, 0x3A, 0x3A, 0x00, 0x00, 0x3A, - 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00, - 0x50, 0x03, 0x74, 0x14, 0x3B, 0x0D, 0x09, 0x02, - 0x04, 0x45, 0x30, 0x30, 0x40, 0x20, - }, - { /* Init_SR80_SR93 */ - 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3A, - 0xF7, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3A, 0x3A, - 0x00, 0x00, 0x00, 0x00, - }, - { /* Init_SRA0_SRAF */ - 0x00, 0xFB, 0x9F, 0x01, 0x00, 0xED, 0xED, 0xED, - 0x7B, 0xFB, 0xFF, 0xFF, 0x97, 0xEF, 0xBF, 0xDF, - }, - { /* Init_GR00_GR08 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, - 0xFF, - }, - { /* Init_AR00_AR14 */ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x41, 0x00, 0x0F, 0x00, 0x00, - }, - { /* Init_CR00_CR18 */ - 0xA3, 0x7F, 0x7F, 0x00, 0x85, 0x16, 0x24, 0xF5, - 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x09, 0xFF, 0x80, 0x40, 0xFF, 0x00, 0xE3, - 0xFF, - }, - { /* Init_CR30_CR4D */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20, - 0x00, 0x00, 0x00, 0x40, 0x00, 0xFF, 0xBF, 0xFF, - 0xA3, 0x7F, 0x00, 0x86, 0x15, 0x24, 0xFF, 0x00, - 0x01, 0x07, 0xE5, 0x20, 0x7F, 0xFF, - }, - { /* Init_CR90_CRA7 */ - 0x55, 0xD9, 0x5D, 0xE1, 0x86, 0x1B, 0x8E, 0x26, - 0xDA, 0x8D, 0xDE, 0x94, 0x00, 0x00, 0x18, 0x00, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03, - }, - }, - { /* mode#4: 1024 x 768 32Bpp 60Hz */ - 1024, 768, 32, 60, - /* Init_MISC */ - 0xEB, - { /* Init_SR0_SR4 */ - 0x03, 0x01, 0x0F, 0x03, 0x0E, - }, - { /* Init_SR10_SR24 */ - 0xF3, 0xB6, 0xC0, 0xDD, 0x00, 0x0E, 0x17, 0x2C, - 0x99, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xC4, 0x32, 0x02, 0x01, 0x01, - }, - { /* Init_SR30_SR75 */ - 0x38, 0x03, 0x20, 0x09, 0xC0, 0x3A, 0x3A, 0x3A, - 0x3A, 0x3A, 0x3A, 0x3A, 0x00, 0x00, 0x03, 0xFF, - 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC, - 0x20, 0x0C, 0x44, 0x20, 0x00, 0x00, 0x00, 0x3A, - 0x06, 0x68, 0xA7, 0x7F, 0x83, 0x24, 0xFF, 0x03, - 0x00, 0x60, 0x59, 0x3A, 0x3A, 0x00, 0x00, 0x3A, - 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00, - 0x50, 0x03, 0x74, 0x14, 0x3B, 0x0D, 0x09, 0x02, - 0x04, 0x45, 0x30, 0x30, 0x40, 0x20, - }, - { /* Init_SR80_SR93 */ - 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3A, - 0xF7, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3A, 0x3A, - 0x00, 0x00, 0x00, 0x00, - }, - { /* Init_SRA0_SRAF */ - 0x00, 0xFB, 0x9F, 0x01, 0x00, 0xED, 0xED, 0xED, - 0x7B, 0xFB, 0xFF, 0xFF, 0x97, 0xEF, 0xBF, 0xDF, - }, - { /* Init_GR00_GR08 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, - 0xFF, - }, - { /* Init_AR00_AR14 */ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x41, 0x00, 0x0F, 0x00, 0x00, - }, - { /* Init_CR00_CR18 */ - 0xA3, 0x7F, 0x7F, 0x00, 0x85, 0x16, 0x24, 0xF5, - 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x09, 0xFF, 0x80, 0x40, 0xFF, 0x00, 0xE3, - 0xFF, - }, - { /* Init_CR30_CR4D */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20, - 0x00, 0x00, 0x00, 0x40, 0x00, 0xFF, 0xBF, 0xFF, - 0xA3, 0x7F, 0x00, 0x86, 0x15, 0x24, 0xFF, 0x00, - 0x01, 0x07, 0xE5, 0x20, 0x7F, 0xFF, - }, - { /* Init_CR90_CRA7 */ - 0x55, 0xD9, 0x5D, 0xE1, 0x86, 0x1B, 0x8E, 0x26, - 0xDA, 0x8D, 0xDE, 0x94, 0x00, 0x00, 0x18, 0x00, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03, - }, - }, - { /* mode#6: 320 x 240 16Bpp 60Hz */ - 320, 240, 16, 60, - /* Init_MISC */ - 0xEB, - { /* Init_SR0_SR4 */ - 0x03, 0x01, 0x0F, 0x03, 0x0E, - }, - { /* Init_SR10_SR24 */ - 0xF3, 0xB6, 0xC0, 0xDD, 0x00, 0x0E, 0x17, 0x2C, - 0x99, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xC4, 0x32, 0x02, 0x01, 0x01, - }, - { /* Init_SR30_SR75 */ - 0x38, 0x03, 0x20, 0x09, 0xC0, 0x3A, 0x3A, 0x3A, - 0x3A, 0x3A, 0x3A, 0x3A, 0x00, 0x00, 0x03, 0xFF, - 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC, - 0x20, 0x0C, 0x44, 0x20, 0x00, 0x00, 0x00, 0x3A, - 0x06, 0x68, 0xA7, 0x7F, 0x83, 0x24, 0xFF, 0x03, - 0x00, 0x60, 0x59, 0x3A, 0x3A, 0x00, 0x00, 0x3A, - 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00, - 0x50, 0x03, 0x74, 0x14, 0x08, 0x43, 0x08, 0x43, - 0x04, 0x45, 0x30, 0x30, 0x40, 0x20, - }, - { /* Init_SR80_SR93 */ - 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3A, - 0xF7, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3A, 0x3A, - 0x00, 0x00, 0x00, 0x00, - }, - { /* Init_SRA0_SRAF */ - 0x00, 0xFB, 0x9F, 0x01, 0x00, 0xED, 0xED, 0xED, - 0x7B, 0xFB, 0xFF, 0xFF, 0x97, 0xEF, 0xBF, 0xDF, - }, - { /* Init_GR00_GR08 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, - 0xFF, - }, - { /* Init_AR00_AR14 */ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x41, 0x00, 0x0F, 0x00, 0x00, - }, - { /* Init_CR00_CR18 */ - 0xA3, 0x7F, 0x7F, 0x00, 0x85, 0x16, 0x24, 0xF5, - 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x09, 0xFF, 0x80, 0x40, 0xFF, 0x00, 0xE3, - 0xFF, - }, - { /* Init_CR30_CR4D */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20, - 0x00, 0x00, 0x30, 0x40, 0x00, 0xFF, 0xBF, 0xFF, - 0x2E, 0x27, 0x00, 0x2b, 0x0c, 0x0F, 0xEF, 0x00, - 0xFe, 0x0f, 0x01, 0xC0, 0x27, 0xEF, - }, - { /* Init_CR90_CRA7 */ - 0x55, 0xD9, 0x5D, 0xE1, 0x86, 0x1B, 0x8E, 0x26, - 0xDA, 0x8D, 0xDE, 0x94, 0x00, 0x00, 0x18, 0x00, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03, - }, - }, - - { /* mode#8: 320 x 240 32Bpp 60Hz */ - 320, 240, 32, 60, - /* Init_MISC */ - 0xEB, - { /* Init_SR0_SR4 */ - 0x03, 0x01, 0x0F, 0x03, 0x0E, - }, - { /* Init_SR10_SR24 */ - 0xF3, 0xB6, 0xC0, 0xDD, 0x00, 0x0E, 0x17, 0x2C, - 0x99, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xC4, 0x32, 0x02, 0x01, 0x01, - }, - { /* Init_SR30_SR75 */ - 0x38, 0x03, 0x20, 0x09, 0xC0, 0x3A, 0x3A, 0x3A, - 0x3A, 0x3A, 0x3A, 0x3A, 0x00, 0x00, 0x03, 0xFF, - 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC, - 0x20, 0x0C, 0x44, 0x20, 0x00, 0x00, 0x00, 0x3A, - 0x06, 0x68, 0xA7, 0x7F, 0x83, 0x24, 0xFF, 0x03, - 0x00, 0x60, 0x59, 0x3A, 0x3A, 0x00, 0x00, 0x3A, - 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00, - 0x50, 0x03, 0x74, 0x14, 0x08, 0x43, 0x08, 0x43, - 0x04, 0x45, 0x30, 0x30, 0x40, 0x20, - }, - { /* Init_SR80_SR93 */ - 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3A, - 0xF7, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3A, 0x3A, - 0x00, 0x00, 0x00, 0x00, - }, - { /* Init_SRA0_SRAF */ - 0x00, 0xFB, 0x9F, 0x01, 0x00, 0xED, 0xED, 0xED, - 0x7B, 0xFB, 0xFF, 0xFF, 0x97, 0xEF, 0xBF, 0xDF, - }, - { /* Init_GR00_GR08 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, - 0xFF, - }, - { /* Init_AR00_AR14 */ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x41, 0x00, 0x0F, 0x00, 0x00, - }, - { /* Init_CR00_CR18 */ - 0xA3, 0x7F, 0x7F, 0x00, 0x85, 0x16, 0x24, 0xF5, - 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x09, 0xFF, 0x80, 0x40, 0xFF, 0x00, 0xE3, - 0xFF, - }, - { /* Init_CR30_CR4D */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20, - 0x00, 0x00, 0x30, 0x40, 0x00, 0xFF, 0xBF, 0xFF, - 0x2E, 0x27, 0x00, 0x2b, 0x0c, 0x0F, 0xEF, 0x00, - 0xFe, 0x0f, 0x01, 0xC0, 0x27, 0xEF, - }, - { /* Init_CR90_CRA7 */ - 0x55, 0xD9, 0x5D, 0xE1, 0x86, 0x1B, 0x8E, 0x26, - 0xDA, 0x8D, 0xDE, 0x94, 0x00, 0x00, 0x18, 0x00, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03, - }, - }, -}; - -#define numVGAModes ARRAY_SIZE(VGAMode) diff --git a/drivers/staging/sm7xxfb/Kconfig b/drivers/staging/sm7xxfb/Kconfig new file mode 100644 index 0000000..d5013f8 --- /dev/null +++ b/drivers/staging/sm7xxfb/Kconfig @@ -0,0 +1,13 @@ +config FB_SM7XX + tristate "Silicon Motion SM7XX framebuffer support" + depends on FB + select FB_CFB_FILLRECT + select FB_CFB_COPYAREA + select FB_CFB_IMAGEBLIT + help + Frame buffer driver for the Silicon Motion SM710, SM712, SM721 + and SM722 chips. + + This driver is also available as a module. The module will be + called sm7xxfb. If you want to compile it as a module, say M + here and read . diff --git a/drivers/staging/sm7xxfb/Makefile b/drivers/staging/sm7xxfb/Makefile new file mode 100644 index 0000000..48f471c --- /dev/null +++ b/drivers/staging/sm7xxfb/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_FB_SM7XX) += sm7xxfb.o diff --git a/drivers/staging/sm7xxfb/TODO b/drivers/staging/sm7xxfb/TODO new file mode 100644 index 0000000..1fcead5 --- /dev/null +++ b/drivers/staging/sm7xxfb/TODO @@ -0,0 +1,9 @@ +TODO: +- Dual head support +- 2D acceleration support +- use kernel coding style +- refine the code and remove unused code +- move it to drivers/video/sm7xxfb.c + +Please send any patches to Greg Kroah-Hartman and +Teddy Wang . diff --git a/drivers/staging/sm7xxfb/sm7xx.h b/drivers/staging/sm7xxfb/sm7xx.h new file mode 100644 index 0000000..43d86f8 --- /dev/null +++ b/drivers/staging/sm7xxfb/sm7xx.h @@ -0,0 +1,780 @@ +/* + * Silicon Motion SM712 frame buffer device + * + * Copyright (C) 2006 Silicon Motion Technology Corp. + * Authors: Ge Wang, gewang@siliconmotion.com + * Boyod boyod.yang@siliconmotion.com.cn + * + * Copyright (C) 2009 Lemote, Inc. + * Author: Wu Zhangjin, wuzhangjin@gmail.com + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive for + * more details. + */ + +#define NR_PALETTE 256 +#define NR_RGB 2 + +#define FB_ACCEL_SMI_LYNX 88 + +#define SCREEN_X_RES 1024 +#define SCREEN_Y_RES 600 +#define SCREEN_BPP 16 + +/*Assume SM712 graphics chip has 4MB VRAM */ +#define SM712_VIDEOMEMORYSIZE 0x00400000 +/*Assume SM722 graphics chip has 8MB VRAM */ +#define SM722_VIDEOMEMORYSIZE 0x00800000 + +#define dac_reg (0x3c8) +#define dac_val (0x3c9) + +extern char __iomem *smtc_RegBaseAddress; +#define smtc_mmiowb(dat, reg) writeb(dat, smtc_RegBaseAddress + reg) +#define smtc_mmioww(dat, reg) writew(dat, smtc_RegBaseAddress + reg) +#define smtc_mmiowl(dat, reg) writel(dat, smtc_RegBaseAddress + reg) + +#define smtc_mmiorb(reg) readb(smtc_RegBaseAddress + reg) +#define smtc_mmiorw(reg) readw(smtc_RegBaseAddress + reg) +#define smtc_mmiorl(reg) readl(smtc_RegBaseAddress + reg) + +#define SIZE_SR00_SR04 (0x04 - 0x00 + 1) +#define SIZE_SR10_SR24 (0x24 - 0x10 + 1) +#define SIZE_SR30_SR75 (0x75 - 0x30 + 1) +#define SIZE_SR80_SR93 (0x93 - 0x80 + 1) +#define SIZE_SRA0_SRAF (0xAF - 0xA0 + 1) +#define SIZE_GR00_GR08 (0x08 - 0x00 + 1) +#define SIZE_AR00_AR14 (0x14 - 0x00 + 1) +#define SIZE_CR00_CR18 (0x18 - 0x00 + 1) +#define SIZE_CR30_CR4D (0x4D - 0x30 + 1) +#define SIZE_CR90_CRA7 (0xA7 - 0x90 + 1) +#define SIZE_VPR (0x6C + 1) +#define SIZE_DPR (0x44 + 1) + +static inline void smtc_crtcw(int reg, int val) +{ + smtc_mmiowb(reg, 0x3d4); + smtc_mmiowb(val, 0x3d5); +} + +static inline unsigned int smtc_crtcr(int reg) +{ + smtc_mmiowb(reg, 0x3d4); + return smtc_mmiorb(0x3d5); +} + +static inline void smtc_grphw(int reg, int val) +{ + smtc_mmiowb(reg, 0x3ce); + smtc_mmiowb(val, 0x3cf); +} + +static inline unsigned int smtc_grphr(int reg) +{ + smtc_mmiowb(reg, 0x3ce); + return smtc_mmiorb(0x3cf); +} + +static inline void smtc_attrw(int reg, int val) +{ + smtc_mmiorb(0x3da); + smtc_mmiowb(reg, 0x3c0); + smtc_mmiorb(0x3c1); + smtc_mmiowb(val, 0x3c0); +} + +static inline void smtc_seqw(int reg, int val) +{ + smtc_mmiowb(reg, 0x3c4); + smtc_mmiowb(val, 0x3c5); +} + +static inline unsigned int smtc_seqr(int reg) +{ + smtc_mmiowb(reg, 0x3c4); + return smtc_mmiorb(0x3c5); +} + +/* The next structure holds all information relevant for a specific video mode. + */ + +struct ModeInit { + int mmSizeX; + int mmSizeY; + int bpp; + int hz; + unsigned char Init_MISC; + unsigned char Init_SR00_SR04[SIZE_SR00_SR04]; + unsigned char Init_SR10_SR24[SIZE_SR10_SR24]; + unsigned char Init_SR30_SR75[SIZE_SR30_SR75]; + unsigned char Init_SR80_SR93[SIZE_SR80_SR93]; + unsigned char Init_SRA0_SRAF[SIZE_SRA0_SRAF]; + unsigned char Init_GR00_GR08[SIZE_GR00_GR08]; + unsigned char Init_AR00_AR14[SIZE_AR00_AR14]; + unsigned char Init_CR00_CR18[SIZE_CR00_CR18]; + unsigned char Init_CR30_CR4D[SIZE_CR30_CR4D]; + unsigned char Init_CR90_CRA7[SIZE_CR90_CRA7]; +}; + +/********************************************************************** + SM712 Mode table. + **********************************************************************/ +struct ModeInit VGAMode[] = { + { + /* mode#0: 640 x 480 16Bpp 60Hz */ + 640, 480, 16, 60, + /* Init_MISC */ + 0xE3, + { /* Init_SR0_SR4 */ + 0x03, 0x01, 0x0F, 0x00, 0x0E, + }, + { /* Init_SR10_SR24 */ + 0xFF, 0xBE, 0xEF, 0xFF, 0x00, 0x0E, 0x17, 0x2C, + 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xC4, 0x30, 0x02, 0x01, 0x01, + }, + { /* Init_SR30_SR75 */ + 0x32, 0x03, 0xA0, 0x09, 0xC0, 0x32, 0x32, 0x32, + 0x32, 0x32, 0x32, 0x32, 0x00, 0x00, 0x03, 0xFF, + 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC, + 0x20, 0x0C, 0x44, 0x20, 0x00, 0x32, 0x32, 0x32, + 0x04, 0x24, 0x63, 0x4F, 0x52, 0x0B, 0xDF, 0xEA, + 0x04, 0x50, 0x19, 0x32, 0x32, 0x00, 0x00, 0x32, + 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00, + 0x50, 0x03, 0x74, 0x14, 0x07, 0x82, 0x07, 0x04, + 0x00, 0x45, 0x30, 0x30, 0x40, 0x30, + }, + { /* Init_SR80_SR93 */ + 0xFF, 0x07, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x32, + 0xF7, 0x00, 0x00, 0x00, 0xEF, 0xFF, 0x32, 0x32, + 0x00, 0x00, 0x00, 0x00, + }, + { /* Init_SRA0_SRAF */ + 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED, + 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xFF, 0xDF, + }, + { /* Init_GR00_GR08 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, + 0xFF, + }, + { /* Init_AR00_AR14 */ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x41, 0x00, 0x0F, 0x00, 0x00, + }, + { /* Init_CR00_CR18 */ + 0x5F, 0x4F, 0x4F, 0x00, 0x53, 0x1F, 0x0B, 0x3E, + 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xEA, 0x0C, 0xDF, 0x50, 0x40, 0xDF, 0x00, 0xE3, + 0xFF, + }, + { /* Init_CR30_CR4D */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x03, 0x20, + 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xFF, 0xFD, + 0x5F, 0x4F, 0x00, 0x54, 0x00, 0x0B, 0xDF, 0x00, + 0xEA, 0x0C, 0x2E, 0x00, 0x4F, 0xDF, + }, + { /* Init_CR90_CRA7 */ + 0x56, 0xDD, 0x5E, 0xEA, 0x87, 0x44, 0x8F, 0x55, + 0x0A, 0x8F, 0x55, 0x0A, 0x00, 0x00, 0x18, 0x00, + 0x11, 0x10, 0x0B, 0x0A, 0x0A, 0x0A, 0x0A, 0x00, + }, + }, + { + /* mode#1: 640 x 480 24Bpp 60Hz */ + 640, 480, 24, 60, + /* Init_MISC */ + 0xE3, + { /* Init_SR0_SR4 */ + 0x03, 0x01, 0x0F, 0x00, 0x0E, + }, + { /* Init_SR10_SR24 */ + 0xFF, 0xBE, 0xEF, 0xFF, 0x00, 0x0E, 0x17, 0x2C, + 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xC4, 0x30, 0x02, 0x01, 0x01, + }, + { /* Init_SR30_SR75 */ + 0x32, 0x03, 0xA0, 0x09, 0xC0, 0x32, 0x32, 0x32, + 0x32, 0x32, 0x32, 0x32, 0x00, 0x00, 0x03, 0xFF, + 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC, + 0x20, 0x0C, 0x44, 0x20, 0x00, 0x32, 0x32, 0x32, + 0x04, 0x24, 0x63, 0x4F, 0x52, 0x0B, 0xDF, 0xEA, + 0x04, 0x50, 0x19, 0x32, 0x32, 0x00, 0x00, 0x32, + 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00, + 0x50, 0x03, 0x74, 0x14, 0x07, 0x82, 0x07, 0x04, + 0x00, 0x45, 0x30, 0x30, 0x40, 0x30, + }, + { /* Init_SR80_SR93 */ + 0xFF, 0x07, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x32, + 0xF7, 0x00, 0x00, 0x00, 0xEF, 0xFF, 0x32, 0x32, + 0x00, 0x00, 0x00, 0x00, + }, + { /* Init_SRA0_SRAF */ + 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED, + 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xFF, 0xDF, + }, + { /* Init_GR00_GR08 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, + 0xFF, + }, + { /* Init_AR00_AR14 */ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x41, 0x00, 0x0F, 0x00, 0x00, + }, + { /* Init_CR00_CR18 */ + 0x5F, 0x4F, 0x4F, 0x00, 0x53, 0x1F, 0x0B, 0x3E, + 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xEA, 0x0C, 0xDF, 0x50, 0x40, 0xDF, 0x00, 0xE3, + 0xFF, + }, + { /* Init_CR30_CR4D */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x03, 0x20, + 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xFF, 0xFD, + 0x5F, 0x4F, 0x00, 0x54, 0x00, 0x0B, 0xDF, 0x00, + 0xEA, 0x0C, 0x2E, 0x00, 0x4F, 0xDF, + }, + { /* Init_CR90_CRA7 */ + 0x56, 0xDD, 0x5E, 0xEA, 0x87, 0x44, 0x8F, 0x55, + 0x0A, 0x8F, 0x55, 0x0A, 0x00, 0x00, 0x18, 0x00, + 0x11, 0x10, 0x0B, 0x0A, 0x0A, 0x0A, 0x0A, 0x00, + }, + }, + { + /* mode#0: 640 x 480 32Bpp 60Hz */ + 640, 480, 32, 60, + /* Init_MISC */ + 0xE3, + { /* Init_SR0_SR4 */ + 0x03, 0x01, 0x0F, 0x00, 0x0E, + }, + { /* Init_SR10_SR24 */ + 0xFF, 0xBE, 0xEF, 0xFF, 0x00, 0x0E, 0x17, 0x2C, + 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xC4, 0x30, 0x02, 0x01, 0x01, + }, + { /* Init_SR30_SR75 */ + 0x32, 0x03, 0xA0, 0x09, 0xC0, 0x32, 0x32, 0x32, + 0x32, 0x32, 0x32, 0x32, 0x00, 0x00, 0x03, 0xFF, + 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC, + 0x20, 0x0C, 0x44, 0x20, 0x00, 0x32, 0x32, 0x32, + 0x04, 0x24, 0x63, 0x4F, 0x52, 0x0B, 0xDF, 0xEA, + 0x04, 0x50, 0x19, 0x32, 0x32, 0x00, 0x00, 0x32, + 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00, + 0x50, 0x03, 0x74, 0x14, 0x07, 0x82, 0x07, 0x04, + 0x00, 0x45, 0x30, 0x30, 0x40, 0x30, + }, + { /* Init_SR80_SR93 */ + 0xFF, 0x07, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x32, + 0xF7, 0x00, 0x00, 0x00, 0xEF, 0xFF, 0x32, 0x32, + 0x00, 0x00, 0x00, 0x00, + }, + { /* Init_SRA0_SRAF */ + 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED, + 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xFF, 0xDF, + }, + { /* Init_GR00_GR08 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, + 0xFF, + }, + { /* Init_AR00_AR14 */ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x41, 0x00, 0x0F, 0x00, 0x00, + }, + { /* Init_CR00_CR18 */ + 0x5F, 0x4F, 0x4F, 0x00, 0x53, 0x1F, 0x0B, 0x3E, + 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xEA, 0x0C, 0xDF, 0x50, 0x40, 0xDF, 0x00, 0xE3, + 0xFF, + }, + { /* Init_CR30_CR4D */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x03, 0x20, + 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xFF, 0xFD, + 0x5F, 0x4F, 0x00, 0x54, 0x00, 0x0B, 0xDF, 0x00, + 0xEA, 0x0C, 0x2E, 0x00, 0x4F, 0xDF, + }, + { /* Init_CR90_CRA7 */ + 0x56, 0xDD, 0x5E, 0xEA, 0x87, 0x44, 0x8F, 0x55, + 0x0A, 0x8F, 0x55, 0x0A, 0x00, 0x00, 0x18, 0x00, + 0x11, 0x10, 0x0B, 0x0A, 0x0A, 0x0A, 0x0A, 0x00, + }, + }, + + { /* mode#2: 800 x 600 16Bpp 60Hz */ + 800, 600, 16, 60, + /* Init_MISC */ + 0x2B, + { /* Init_SR0_SR4 */ + 0x03, 0x01, 0x0F, 0x03, 0x0E, + }, + { /* Init_SR10_SR24 */ + 0xFF, 0xBE, 0xEE, 0xFF, 0x00, 0x0E, 0x17, 0x2C, + 0x99, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xC4, 0x30, 0x02, 0x01, 0x01, + }, + { /* Init_SR30_SR75 */ + 0x34, 0x03, 0x20, 0x09, 0xC0, 0x24, 0x24, 0x24, + 0x24, 0x24, 0x24, 0x24, 0x00, 0x00, 0x03, 0xFF, + 0x00, 0xFC, 0x00, 0x00, 0x20, 0x38, 0x00, 0xFC, + 0x20, 0x0C, 0x44, 0x20, 0x00, 0x24, 0x24, 0x24, + 0x04, 0x48, 0x83, 0x63, 0x68, 0x72, 0x57, 0x58, + 0x04, 0x55, 0x59, 0x24, 0x24, 0x00, 0x00, 0x24, + 0x01, 0x80, 0x7A, 0x1A, 0x1A, 0x00, 0x00, 0x00, + 0x50, 0x03, 0x74, 0x14, 0x1C, 0x85, 0x35, 0x13, + 0x02, 0x45, 0x30, 0x35, 0x40, 0x20, + }, + { /* Init_SR80_SR93 */ + 0x00, 0x00, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x24, + 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x24, 0x24, + 0x00, 0x00, 0x00, 0x00, + }, + { /* Init_SRA0_SRAF */ + 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED, + 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xBF, 0xDF, + }, + { /* Init_GR00_GR08 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, + 0xFF, + }, + { /* Init_AR00_AR14 */ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x41, 0x00, 0x0F, 0x00, 0x00, + }, + { /* Init_CR00_CR18 */ + 0x7F, 0x63, 0x63, 0x00, 0x68, 0x18, 0x72, 0xF0, + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x58, 0x0C, 0x57, 0x64, 0x40, 0x57, 0x00, 0xE3, + 0xFF, + }, + { /* Init_CR30_CR4D */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x03, 0x20, + 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xBF, 0xFD, + 0x7F, 0x63, 0x00, 0x69, 0x18, 0x72, 0x57, 0x00, + 0x58, 0x0C, 0xE0, 0x20, 0x63, 0x57, + }, + { /* Init_CR90_CRA7 */ + 0x56, 0x4B, 0x5E, 0x55, 0x86, 0x9D, 0x8E, 0xAA, + 0xDB, 0x2A, 0xDF, 0x33, 0x00, 0x00, 0x18, 0x00, + 0x20, 0x1F, 0x1A, 0x19, 0x0F, 0x0F, 0x0F, 0x00, + }, + }, + { /* mode#3: 800 x 600 24Bpp 60Hz */ + 800, 600, 24, 60, + 0x2B, + { /* Init_SR0_SR4 */ + 0x03, 0x01, 0x0F, 0x03, 0x0E, + }, + { /* Init_SR10_SR24 */ + 0xFF, 0xBE, 0xEE, 0xFF, 0x00, 0x0E, 0x17, 0x2C, + 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xC4, 0x30, 0x02, 0x01, 0x01, + }, + { /* Init_SR30_SR75 */ + 0x36, 0x03, 0x20, 0x09, 0xC0, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x03, 0xFF, + 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC, + 0x20, 0x0C, 0x44, 0x20, 0x00, 0x36, 0x36, 0x36, + 0x04, 0x48, 0x83, 0x63, 0x68, 0x72, 0x57, 0x58, + 0x04, 0x55, 0x59, 0x36, 0x36, 0x00, 0x00, 0x36, + 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00, + 0x50, 0x03, 0x74, 0x14, 0x1C, 0x85, 0x35, 0x13, + 0x02, 0x45, 0x30, 0x30, 0x40, 0x20, + }, + { /* Init_SR80_SR93 */ + 0xFF, 0x07, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x36, + 0xF7, 0x00, 0x00, 0x00, 0xEF, 0xFF, 0x36, 0x36, + 0x00, 0x00, 0x00, 0x00, + }, + { /* Init_SRA0_SRAF */ + 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED, + 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xBF, 0xDF, + }, + { /* Init_GR00_GR08 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, + 0xFF, + }, + { /* Init_AR00_AR14 */ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x41, 0x00, 0x0F, 0x00, 0x00, + }, + { /* Init_CR00_CR18 */ + 0x7F, 0x63, 0x63, 0x00, 0x68, 0x18, 0x72, 0xF0, + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x58, 0x0C, 0x57, 0x64, 0x40, 0x57, 0x00, 0xE3, + 0xFF, + }, + { /* Init_CR30_CR4D */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x03, 0x20, + 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xBF, 0xFD, + 0x7F, 0x63, 0x00, 0x69, 0x18, 0x72, 0x57, 0x00, + 0x58, 0x0C, 0xE0, 0x20, 0x63, 0x57, + }, + { /* Init_CR90_CRA7 */ + 0x56, 0x4B, 0x5E, 0x55, 0x86, 0x9D, 0x8E, 0xAA, + 0xDB, 0x2A, 0xDF, 0x33, 0x00, 0x00, 0x18, 0x00, + 0x20, 0x1F, 0x1A, 0x19, 0x0F, 0x0F, 0x0F, 0x00, + }, + }, + { /* mode#7: 800 x 600 32Bpp 60Hz */ + 800, 600, 32, 60, + /* Init_MISC */ + 0x2B, + { /* Init_SR0_SR4 */ + 0x03, 0x01, 0x0F, 0x03, 0x0E, + }, + { /* Init_SR10_SR24 */ + 0xFF, 0xBE, 0xEE, 0xFF, 0x00, 0x0E, 0x17, 0x2C, + 0x99, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xC4, 0x30, 0x02, 0x01, 0x01, + }, + { /* Init_SR30_SR75 */ + 0x34, 0x03, 0x20, 0x09, 0xC0, 0x24, 0x24, 0x24, + 0x24, 0x24, 0x24, 0x24, 0x00, 0x00, 0x03, 0xFF, + 0x00, 0xFC, 0x00, 0x00, 0x20, 0x38, 0x00, 0xFC, + 0x20, 0x0C, 0x44, 0x20, 0x00, 0x24, 0x24, 0x24, + 0x04, 0x48, 0x83, 0x63, 0x68, 0x72, 0x57, 0x58, + 0x04, 0x55, 0x59, 0x24, 0x24, 0x00, 0x00, 0x24, + 0x01, 0x80, 0x7A, 0x1A, 0x1A, 0x00, 0x00, 0x00, + 0x50, 0x03, 0x74, 0x14, 0x1C, 0x85, 0x35, 0x13, + 0x02, 0x45, 0x30, 0x35, 0x40, 0x20, + }, + { /* Init_SR80_SR93 */ + 0x00, 0x00, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x24, + 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x24, 0x24, + 0x00, 0x00, 0x00, 0x00, + }, + { /* Init_SRA0_SRAF */ + 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED, + 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xBF, 0xDF, + }, + { /* Init_GR00_GR08 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, + 0xFF, + }, + { /* Init_AR00_AR14 */ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x41, 0x00, 0x0F, 0x00, 0x00, + }, + { /* Init_CR00_CR18 */ + 0x7F, 0x63, 0x63, 0x00, 0x68, 0x18, 0x72, 0xF0, + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x58, 0x0C, 0x57, 0x64, 0x40, 0x57, 0x00, 0xE3, + 0xFF, + }, + { /* Init_CR30_CR4D */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x03, 0x20, + 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xBF, 0xFD, + 0x7F, 0x63, 0x00, 0x69, 0x18, 0x72, 0x57, 0x00, + 0x58, 0x0C, 0xE0, 0x20, 0x63, 0x57, + }, + { /* Init_CR90_CRA7 */ + 0x56, 0x4B, 0x5E, 0x55, 0x86, 0x9D, 0x8E, 0xAA, + 0xDB, 0x2A, 0xDF, 0x33, 0x00, 0x00, 0x18, 0x00, + 0x20, 0x1F, 0x1A, 0x19, 0x0F, 0x0F, 0x0F, 0x00, + }, + }, + /* We use 1024x768 table to light 1024x600 panel for lemote */ + { /* mode#4: 1024 x 600 16Bpp 60Hz */ + 1024, 600, 16, 60, + /* Init_MISC */ + 0xEB, + { /* Init_SR0_SR4 */ + 0x03, 0x01, 0x0F, 0x00, 0x0E, + }, + { /* Init_SR10_SR24 */ + 0xC8, 0x40, 0x14, 0x60, 0x00, 0x0A, 0x17, 0x20, + 0x51, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xC4, 0x30, 0x02, 0x00, 0x01, + }, + { /* Init_SR30_SR75 */ + 0x22, 0x03, 0x24, 0x09, 0xC0, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x03, 0xFF, + 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC, + 0x20, 0x0C, 0x44, 0x20, 0x00, 0x22, 0x22, 0x22, + 0x06, 0x68, 0xA7, 0x7F, 0x83, 0x24, 0xFF, 0x03, + 0x00, 0x60, 0x59, 0x22, 0x22, 0x00, 0x00, 0x22, + 0x01, 0x80, 0x7A, 0x1A, 0x1A, 0x00, 0x00, 0x00, + 0x50, 0x03, 0x16, 0x02, 0x0D, 0x82, 0x09, 0x02, + 0x04, 0x45, 0x3F, 0x30, 0x40, 0x20, + }, + { /* Init_SR80_SR93 */ + 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3A, + 0xF7, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3A, 0x3A, + 0x00, 0x00, 0x00, 0x00, + }, + { /* Init_SRA0_SRAF */ + 0x00, 0xFB, 0x9F, 0x01, 0x00, 0xED, 0xED, 0xED, + 0x7B, 0xFB, 0xFF, 0xFF, 0x97, 0xEF, 0xBF, 0xDF, + }, + { /* Init_GR00_GR08 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, + 0xFF, + }, + { /* Init_AR00_AR14 */ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x41, 0x00, 0x0F, 0x00, 0x00, + }, + { /* Init_CR00_CR18 */ + 0xA3, 0x7F, 0x7F, 0x00, 0x85, 0x16, 0x24, 0xF5, + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x09, 0xFF, 0x80, 0x40, 0xFF, 0x00, 0xE3, + 0xFF, + }, + { /* Init_CR30_CR4D */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20, + 0x00, 0x00, 0x00, 0x40, 0x00, 0xFF, 0xBF, 0xFF, + 0xA3, 0x7F, 0x00, 0x82, 0x0b, 0x6f, 0x57, 0x00, + 0x5c, 0x0f, 0xE0, 0xe0, 0x7F, 0x57, + }, + { /* Init_CR90_CRA7 */ + 0x55, 0xD9, 0x5D, 0xE1, 0x86, 0x1B, 0x8E, 0x26, + 0xDA, 0x8D, 0xDE, 0x94, 0x00, 0x00, 0x18, 0x00, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03, + }, + }, + { /* mode#5: 1024 x 768 24Bpp 60Hz */ + 1024, 768, 24, 60, + /* Init_MISC */ + 0xEB, + { /* Init_SR0_SR4 */ + 0x03, 0x01, 0x0F, 0x03, 0x0E, + }, + { /* Init_SR10_SR24 */ + 0xF3, 0xB6, 0xC0, 0xDD, 0x00, 0x0E, 0x17, 0x2C, + 0x99, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xC4, 0x30, 0x02, 0x01, 0x01, + }, + { /* Init_SR30_SR75 */ + 0x38, 0x03, 0x20, 0x09, 0xC0, 0x3A, 0x3A, 0x3A, + 0x3A, 0x3A, 0x3A, 0x3A, 0x00, 0x00, 0x03, 0xFF, + 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC, + 0x20, 0x0C, 0x44, 0x20, 0x00, 0x00, 0x00, 0x3A, + 0x06, 0x68, 0xA7, 0x7F, 0x83, 0x24, 0xFF, 0x03, + 0x00, 0x60, 0x59, 0x3A, 0x3A, 0x00, 0x00, 0x3A, + 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00, + 0x50, 0x03, 0x74, 0x14, 0x3B, 0x0D, 0x09, 0x02, + 0x04, 0x45, 0x30, 0x30, 0x40, 0x20, + }, + { /* Init_SR80_SR93 */ + 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3A, + 0xF7, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3A, 0x3A, + 0x00, 0x00, 0x00, 0x00, + }, + { /* Init_SRA0_SRAF */ + 0x00, 0xFB, 0x9F, 0x01, 0x00, 0xED, 0xED, 0xED, + 0x7B, 0xFB, 0xFF, 0xFF, 0x97, 0xEF, 0xBF, 0xDF, + }, + { /* Init_GR00_GR08 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, + 0xFF, + }, + { /* Init_AR00_AR14 */ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x41, 0x00, 0x0F, 0x00, 0x00, + }, + { /* Init_CR00_CR18 */ + 0xA3, 0x7F, 0x7F, 0x00, 0x85, 0x16, 0x24, 0xF5, + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x09, 0xFF, 0x80, 0x40, 0xFF, 0x00, 0xE3, + 0xFF, + }, + { /* Init_CR30_CR4D */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20, + 0x00, 0x00, 0x00, 0x40, 0x00, 0xFF, 0xBF, 0xFF, + 0xA3, 0x7F, 0x00, 0x86, 0x15, 0x24, 0xFF, 0x00, + 0x01, 0x07, 0xE5, 0x20, 0x7F, 0xFF, + }, + { /* Init_CR90_CRA7 */ + 0x55, 0xD9, 0x5D, 0xE1, 0x86, 0x1B, 0x8E, 0x26, + 0xDA, 0x8D, 0xDE, 0x94, 0x00, 0x00, 0x18, 0x00, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03, + }, + }, + { /* mode#4: 1024 x 768 32Bpp 60Hz */ + 1024, 768, 32, 60, + /* Init_MISC */ + 0xEB, + { /* Init_SR0_SR4 */ + 0x03, 0x01, 0x0F, 0x03, 0x0E, + }, + { /* Init_SR10_SR24 */ + 0xF3, 0xB6, 0xC0, 0xDD, 0x00, 0x0E, 0x17, 0x2C, + 0x99, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xC4, 0x32, 0x02, 0x01, 0x01, + }, + { /* Init_SR30_SR75 */ + 0x38, 0x03, 0x20, 0x09, 0xC0, 0x3A, 0x3A, 0x3A, + 0x3A, 0x3A, 0x3A, 0x3A, 0x00, 0x00, 0x03, 0xFF, + 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC, + 0x20, 0x0C, 0x44, 0x20, 0x00, 0x00, 0x00, 0x3A, + 0x06, 0x68, 0xA7, 0x7F, 0x83, 0x24, 0xFF, 0x03, + 0x00, 0x60, 0x59, 0x3A, 0x3A, 0x00, 0x00, 0x3A, + 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00, + 0x50, 0x03, 0x74, 0x14, 0x3B, 0x0D, 0x09, 0x02, + 0x04, 0x45, 0x30, 0x30, 0x40, 0x20, + }, + { /* Init_SR80_SR93 */ + 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3A, + 0xF7, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3A, 0x3A, + 0x00, 0x00, 0x00, 0x00, + }, + { /* Init_SRA0_SRAF */ + 0x00, 0xFB, 0x9F, 0x01, 0x00, 0xED, 0xED, 0xED, + 0x7B, 0xFB, 0xFF, 0xFF, 0x97, 0xEF, 0xBF, 0xDF, + }, + { /* Init_GR00_GR08 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, + 0xFF, + }, + { /* Init_AR00_AR14 */ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x41, 0x00, 0x0F, 0x00, 0x00, + }, + { /* Init_CR00_CR18 */ + 0xA3, 0x7F, 0x7F, 0x00, 0x85, 0x16, 0x24, 0xF5, + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x09, 0xFF, 0x80, 0x40, 0xFF, 0x00, 0xE3, + 0xFF, + }, + { /* Init_CR30_CR4D */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20, + 0x00, 0x00, 0x00, 0x40, 0x00, 0xFF, 0xBF, 0xFF, + 0xA3, 0x7F, 0x00, 0x86, 0x15, 0x24, 0xFF, 0x00, + 0x01, 0x07, 0xE5, 0x20, 0x7F, 0xFF, + }, + { /* Init_CR90_CRA7 */ + 0x55, 0xD9, 0x5D, 0xE1, 0x86, 0x1B, 0x8E, 0x26, + 0xDA, 0x8D, 0xDE, 0x94, 0x00, 0x00, 0x18, 0x00, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03, + }, + }, + { /* mode#6: 320 x 240 16Bpp 60Hz */ + 320, 240, 16, 60, + /* Init_MISC */ + 0xEB, + { /* Init_SR0_SR4 */ + 0x03, 0x01, 0x0F, 0x03, 0x0E, + }, + { /* Init_SR10_SR24 */ + 0xF3, 0xB6, 0xC0, 0xDD, 0x00, 0x0E, 0x17, 0x2C, + 0x99, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xC4, 0x32, 0x02, 0x01, 0x01, + }, + { /* Init_SR30_SR75 */ + 0x38, 0x03, 0x20, 0x09, 0xC0, 0x3A, 0x3A, 0x3A, + 0x3A, 0x3A, 0x3A, 0x3A, 0x00, 0x00, 0x03, 0xFF, + 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC, + 0x20, 0x0C, 0x44, 0x20, 0x00, 0x00, 0x00, 0x3A, + 0x06, 0x68, 0xA7, 0x7F, 0x83, 0x24, 0xFF, 0x03, + 0x00, 0x60, 0x59, 0x3A, 0x3A, 0x00, 0x00, 0x3A, + 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00, + 0x50, 0x03, 0x74, 0x14, 0x08, 0x43, 0x08, 0x43, + 0x04, 0x45, 0x30, 0x30, 0x40, 0x20, + }, + { /* Init_SR80_SR93 */ + 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3A, + 0xF7, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3A, 0x3A, + 0x00, 0x00, 0x00, 0x00, + }, + { /* Init_SRA0_SRAF */ + 0x00, 0xFB, 0x9F, 0x01, 0x00, 0xED, 0xED, 0xED, + 0x7B, 0xFB, 0xFF, 0xFF, 0x97, 0xEF, 0xBF, 0xDF, + }, + { /* Init_GR00_GR08 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, + 0xFF, + }, + { /* Init_AR00_AR14 */ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x41, 0x00, 0x0F, 0x00, 0x00, + }, + { /* Init_CR00_CR18 */ + 0xA3, 0x7F, 0x7F, 0x00, 0x85, 0x16, 0x24, 0xF5, + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x09, 0xFF, 0x80, 0x40, 0xFF, 0x00, 0xE3, + 0xFF, + }, + { /* Init_CR30_CR4D */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20, + 0x00, 0x00, 0x30, 0x40, 0x00, 0xFF, 0xBF, 0xFF, + 0x2E, 0x27, 0x00, 0x2b, 0x0c, 0x0F, 0xEF, 0x00, + 0xFe, 0x0f, 0x01, 0xC0, 0x27, 0xEF, + }, + { /* Init_CR90_CRA7 */ + 0x55, 0xD9, 0x5D, 0xE1, 0x86, 0x1B, 0x8E, 0x26, + 0xDA, 0x8D, 0xDE, 0x94, 0x00, 0x00, 0x18, 0x00, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03, + }, + }, + + { /* mode#8: 320 x 240 32Bpp 60Hz */ + 320, 240, 32, 60, + /* Init_MISC */ + 0xEB, + { /* Init_SR0_SR4 */ + 0x03, 0x01, 0x0F, 0x03, 0x0E, + }, + { /* Init_SR10_SR24 */ + 0xF3, 0xB6, 0xC0, 0xDD, 0x00, 0x0E, 0x17, 0x2C, + 0x99, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xC4, 0x32, 0x02, 0x01, 0x01, + }, + { /* Init_SR30_SR75 */ + 0x38, 0x03, 0x20, 0x09, 0xC0, 0x3A, 0x3A, 0x3A, + 0x3A, 0x3A, 0x3A, 0x3A, 0x00, 0x00, 0x03, 0xFF, + 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC, + 0x20, 0x0C, 0x44, 0x20, 0x00, 0x00, 0x00, 0x3A, + 0x06, 0x68, 0xA7, 0x7F, 0x83, 0x24, 0xFF, 0x03, + 0x00, 0x60, 0x59, 0x3A, 0x3A, 0x00, 0x00, 0x3A, + 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00, + 0x50, 0x03, 0x74, 0x14, 0x08, 0x43, 0x08, 0x43, + 0x04, 0x45, 0x30, 0x30, 0x40, 0x20, + }, + { /* Init_SR80_SR93 */ + 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3A, + 0xF7, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3A, 0x3A, + 0x00, 0x00, 0x00, 0x00, + }, + { /* Init_SRA0_SRAF */ + 0x00, 0xFB, 0x9F, 0x01, 0x00, 0xED, 0xED, 0xED, + 0x7B, 0xFB, 0xFF, 0xFF, 0x97, 0xEF, 0xBF, 0xDF, + }, + { /* Init_GR00_GR08 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, + 0xFF, + }, + { /* Init_AR00_AR14 */ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x41, 0x00, 0x0F, 0x00, 0x00, + }, + { /* Init_CR00_CR18 */ + 0xA3, 0x7F, 0x7F, 0x00, 0x85, 0x16, 0x24, 0xF5, + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x09, 0xFF, 0x80, 0x40, 0xFF, 0x00, 0xE3, + 0xFF, + }, + { /* Init_CR30_CR4D */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20, + 0x00, 0x00, 0x30, 0x40, 0x00, 0xFF, 0xBF, 0xFF, + 0x2E, 0x27, 0x00, 0x2b, 0x0c, 0x0F, 0xEF, 0x00, + 0xFe, 0x0f, 0x01, 0xC0, 0x27, 0xEF, + }, + { /* Init_CR90_CRA7 */ + 0x55, 0xD9, 0x5D, 0xE1, 0x86, 0x1B, 0x8E, 0x26, + 0xDA, 0x8D, 0xDE, 0x94, 0x00, 0x00, 0x18, 0x00, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03, + }, + }, +}; + +#define numVGAModes ARRAY_SIZE(VGAMode) diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c new file mode 100644 index 0000000..21dab34 --- /dev/null +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -0,0 +1,1097 @@ +/* + * Silicon Motion SM7XX frame buffer device + * + * Copyright (C) 2006 Silicon Motion Technology Corp. + * Authors: Ge Wang, gewang@siliconmotion.com + * Boyod boyod.yang@siliconmotion.com.cn + * + * Copyright (C) 2009 Lemote, Inc. + * Author: Wu Zhangjin, wuzhangjin@gmail.com + * + * Copyright (C) 2011 Igalia, S.L. + * Author: Javier M. Mellid + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive for + * more details. + * + * Framebuffer driver for Silicon Motion SM710, SM712, SM721 and SM722 chips + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef CONFIG_PM +#include +#endif + +#include "sm7xx.h" + +struct screen_info smtc_screen_info; + +/* +* Private structure +*/ +struct smtcfb_info { + struct fb_info fb; + struct pci_dev *pdev; + struct { + u8 red, green, blue; + } palette[NR_RGB]; + u_int palette_size; + + u16 chipID; + unsigned char __iomem *m_pMMIO; + char __iomem *m_pLFB; + char *m_pDPR; + char *m_pVPR; + char *m_pCPR; + + u_int width; + u_int height; + u_int hz; + u_long BaseAddressInVRAM; + u8 chipRevID; +}; + +struct vesa_mode_table { + char mode_index[6]; + u16 lfb_width; + u16 lfb_height; + u16 lfb_depth; +}; + +static struct vesa_mode_table vesa_mode[] = { + {"0x301", 640, 480, 8}, + {"0x303", 800, 600, 8}, + {"0x305", 1024, 768, 8}, + {"0x307", 1280, 1024, 8}, + + {"0x311", 640, 480, 16}, + {"0x314", 800, 600, 16}, + {"0x317", 1024, 768, 16}, + {"0x31A", 1280, 1024, 16}, + + {"0x312", 640, 480, 24}, + {"0x315", 800, 600, 24}, + {"0x318", 1024, 768, 24}, + {"0x31B", 1280, 1024, 24}, +}; + +char __iomem *smtc_RegBaseAddress; /* Memory Map IO starting address */ +char __iomem *smtc_VRAMBaseAddress; /* video memory starting address */ + +static u32 colreg[17]; + +static struct fb_var_screeninfo smtcfb_var = { + .xres = 1024, + .yres = 600, + .xres_virtual = 1024, + .yres_virtual = 600, + .bits_per_pixel = 16, + .red = {16, 8, 0}, + .green = {8, 8, 0}, + .blue = {0, 8, 0}, + .activate = FB_ACTIVATE_NOW, + .height = -1, + .width = -1, + .vmode = FB_VMODE_NONINTERLACED, +}; + +static struct fb_fix_screeninfo smtcfb_fix = { + .id = "sm712fb", + .type = FB_TYPE_PACKED_PIXELS, + .visual = FB_VISUAL_TRUECOLOR, + .line_length = 800 * 3, + .accel = FB_ACCEL_SMI_LYNX, +}; + +static void sm712_set_timing(struct smtcfb_info *sfb) +{ + int i = 0, j = 0; + u32 m_nScreenStride; + + dev_dbg(&sfb->pdev->dev, + "sfb->width=%d sfb->height=%d " + "sfb->fb.var.bits_per_pixel=%d sfb->hz=%d\n", + sfb->width, sfb->height, sfb->fb.var.bits_per_pixel, sfb->hz); + + for (j = 0; j < numVGAModes; j++) { + if (VGAMode[j].mmSizeX == sfb->width && + VGAMode[j].mmSizeY == sfb->height && + VGAMode[j].bpp == sfb->fb.var.bits_per_pixel && + VGAMode[j].hz == sfb->hz) { + + dev_dbg(&sfb->pdev->dev, + "VGAMode[j].mmSizeX=%d VGAMode[j].mmSizeY=%d " + "VGAMode[j].bpp=%d VGAMode[j].hz=%d\n", + VGAMode[j].mmSizeX, VGAMode[j].mmSizeY, + VGAMode[j].bpp, VGAMode[j].hz); + + dev_dbg(&sfb->pdev->dev, "VGAMode index=%d\n", j); + + smtc_mmiowb(0x0, 0x3c6); + + smtc_seqw(0, 0x1); + + smtc_mmiowb(VGAMode[j].Init_MISC, 0x3c2); + + /* init SEQ register SR00 - SR04 */ + for (i = 0; i < SIZE_SR00_SR04; i++) + smtc_seqw(i, VGAMode[j].Init_SR00_SR04[i]); + + /* init SEQ register SR10 - SR24 */ + for (i = 0; i < SIZE_SR10_SR24; i++) + smtc_seqw(i + 0x10, + VGAMode[j].Init_SR10_SR24[i]); + + /* init SEQ register SR30 - SR75 */ + for (i = 0; i < SIZE_SR30_SR75; i++) + if (((i + 0x30) != 0x62) \ + && ((i + 0x30) != 0x6a) \ + && ((i + 0x30) != 0x6b)) + smtc_seqw(i + 0x30, + VGAMode[j].Init_SR30_SR75[i]); + + /* init SEQ register SR80 - SR93 */ + for (i = 0; i < SIZE_SR80_SR93; i++) + smtc_seqw(i + 0x80, + VGAMode[j].Init_SR80_SR93[i]); + + /* init SEQ register SRA0 - SRAF */ + for (i = 0; i < SIZE_SRA0_SRAF; i++) + smtc_seqw(i + 0xa0, + VGAMode[j].Init_SRA0_SRAF[i]); + + /* init Graphic register GR00 - GR08 */ + for (i = 0; i < SIZE_GR00_GR08; i++) + smtc_grphw(i, VGAMode[j].Init_GR00_GR08[i]); + + /* init Attribute register AR00 - AR14 */ + for (i = 0; i < SIZE_AR00_AR14; i++) + smtc_attrw(i, VGAMode[j].Init_AR00_AR14[i]); + + /* init CRTC register CR00 - CR18 */ + for (i = 0; i < SIZE_CR00_CR18; i++) + smtc_crtcw(i, VGAMode[j].Init_CR00_CR18[i]); + + /* init CRTC register CR30 - CR4D */ + for (i = 0; i < SIZE_CR30_CR4D; i++) + smtc_crtcw(i + 0x30, + VGAMode[j].Init_CR30_CR4D[i]); + + /* init CRTC register CR90 - CRA7 */ + for (i = 0; i < SIZE_CR90_CRA7; i++) + smtc_crtcw(i + 0x90, + VGAMode[j].Init_CR90_CRA7[i]); + } + } + smtc_mmiowb(0x67, 0x3c2); + + /* set VPR registers */ + writel(0x0, sfb->m_pVPR + 0x0C); + writel(0x0, sfb->m_pVPR + 0x40); + + /* set data width */ + m_nScreenStride = + (sfb->width * sfb->fb.var.bits_per_pixel) / 64; + switch (sfb->fb.var.bits_per_pixel) { + case 8: + writel(0x0, sfb->m_pVPR + 0x0); + break; + case 16: + writel(0x00020000, sfb->m_pVPR + 0x0); + break; + case 24: + writel(0x00040000, sfb->m_pVPR + 0x0); + break; + case 32: + writel(0x00030000, sfb->m_pVPR + 0x0); + break; + } + writel((u32) (((m_nScreenStride + 2) << 16) | m_nScreenStride), + sfb->m_pVPR + 0x10); + +} + +static void sm712_setpalette(int regno, unsigned red, unsigned green, + unsigned blue, struct fb_info *info) +{ + struct smtcfb_info *sfb = info->par; + + if (sfb->BaseAddressInVRAM) + /* + * second display palette for dual head. Enable CRT RAM, 6-bit + * RAM + */ + smtc_seqw(0x66, (smtc_seqr(0x66) & 0xC3) | 0x20); + else + /* primary display palette. Enable LCD RAM only, 6-bit RAM */ + smtc_seqw(0x66, (smtc_seqr(0x66) & 0xC3) | 0x10); + smtc_mmiowb(regno, dac_reg); + smtc_mmiowb(red >> 10, dac_val); + smtc_mmiowb(green >> 10, dac_val); + smtc_mmiowb(blue >> 10, dac_val); +} + +static void smtc_set_timing(struct smtcfb_info *sfb) +{ + switch (sfb->chipID) { + case 0x710: + case 0x712: + case 0x720: + sm712_set_timing(sfb); + break; + } +} + +/* chan_to_field + * + * convert a colour value into a field position + * + * from pxafb.c + */ + +static inline unsigned int chan_to_field(unsigned int chan, + struct fb_bitfield *bf) +{ + chan &= 0xffff; + chan >>= 16 - bf->length; + return chan << bf->offset; +} + +static int smtc_blank(int blank_mode, struct fb_info *info) +{ + /* clear DPMS setting */ + switch (blank_mode) { + case FB_BLANK_UNBLANK: + /* Screen On: HSync: On, VSync : On */ + smtc_seqw(0x01, (smtc_seqr(0x01) & (~0x20))); + smtc_seqw(0x6a, 0x16); + smtc_seqw(0x6b, 0x02); + smtc_seqw(0x21, (smtc_seqr(0x21) & 0x77)); + smtc_seqw(0x22, (smtc_seqr(0x22) & (~0x30))); + smtc_seqw(0x23, (smtc_seqr(0x23) & (~0xc0))); + smtc_seqw(0x24, (smtc_seqr(0x24) | 0x01)); + smtc_seqw(0x31, (smtc_seqr(0x31) | 0x03)); + break; + case FB_BLANK_NORMAL: + /* Screen Off: HSync: On, VSync : On Soft blank */ + smtc_seqw(0x01, (smtc_seqr(0x01) & (~0x20))); + smtc_seqw(0x6a, 0x16); + smtc_seqw(0x6b, 0x02); + smtc_seqw(0x22, (smtc_seqr(0x22) & (~0x30))); + smtc_seqw(0x23, (smtc_seqr(0x23) & (~0xc0))); + smtc_seqw(0x24, (smtc_seqr(0x24) | 0x01)); + smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00)); + break; + case FB_BLANK_VSYNC_SUSPEND: + /* Screen On: HSync: On, VSync : Off */ + smtc_seqw(0x01, (smtc_seqr(0x01) | 0x20)); + smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0))); + smtc_seqw(0x6a, 0x0c); + smtc_seqw(0x6b, 0x02); + smtc_seqw(0x21, (smtc_seqr(0x21) | 0x88)); + smtc_seqw(0x22, ((smtc_seqr(0x22) & (~0x30)) | 0x20)); + smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0x20)); + smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01))); + smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00)); + smtc_seqw(0x34, (smtc_seqr(0x34) | 0x80)); + break; + case FB_BLANK_HSYNC_SUSPEND: + /* Screen On: HSync: Off, VSync : On */ + smtc_seqw(0x01, (smtc_seqr(0x01) | 0x20)); + smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0))); + smtc_seqw(0x6a, 0x0c); + smtc_seqw(0x6b, 0x02); + smtc_seqw(0x21, (smtc_seqr(0x21) | 0x88)); + smtc_seqw(0x22, ((smtc_seqr(0x22) & (~0x30)) | 0x10)); + smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0xD8)); + smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01))); + smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00)); + smtc_seqw(0x34, (smtc_seqr(0x34) | 0x80)); + break; + case FB_BLANK_POWERDOWN: + /* Screen On: HSync: Off, VSync : Off */ + smtc_seqw(0x01, (smtc_seqr(0x01) | 0x20)); + smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0))); + smtc_seqw(0x6a, 0x0c); + smtc_seqw(0x6b, 0x02); + smtc_seqw(0x21, (smtc_seqr(0x21) | 0x88)); + smtc_seqw(0x22, ((smtc_seqr(0x22) & (~0x30)) | 0x30)); + smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0xD8)); + smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01))); + smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00)); + smtc_seqw(0x34, (smtc_seqr(0x34) | 0x80)); + break; + default: + return -EINVAL; + } + + return 0; +} + +static int smtc_setcolreg(unsigned regno, unsigned red, unsigned green, + unsigned blue, unsigned trans, struct fb_info *info) +{ + struct smtcfb_info *sfb = (struct smtcfb_info *)info; + u32 val; + + if (regno > 255) + return 1; + + switch (sfb->fb.fix.visual) { + case FB_VISUAL_DIRECTCOLOR: + case FB_VISUAL_TRUECOLOR: + /* + * 16/32 bit true-colour, use pseuo-palette for 16 base color + */ + if (regno < 16) { + if (sfb->fb.var.bits_per_pixel == 16) { + u32 *pal = sfb->fb.pseudo_palette; + val = chan_to_field(red, &sfb->fb.var.red); + val |= chan_to_field(green, \ + &sfb->fb.var.green); + val |= chan_to_field(blue, &sfb->fb.var.blue); +#ifdef __BIG_ENDIAN + pal[regno] = + ((red & 0xf800) >> 8) | + ((green & 0xe000) >> 13) | + ((green & 0x1c00) << 3) | + ((blue & 0xf800) >> 3); +#else + pal[regno] = val; +#endif + } else { + u32 *pal = sfb->fb.pseudo_palette; + val = chan_to_field(red, &sfb->fb.var.red); + val |= chan_to_field(green, \ + &sfb->fb.var.green); + val |= chan_to_field(blue, &sfb->fb.var.blue); +#ifdef __BIG_ENDIAN + val = + (val & 0xff00ff00 >> 8) | + (val & 0x00ff00ff << 8); +#endif + pal[regno] = val; + } + } + break; + + case FB_VISUAL_PSEUDOCOLOR: + /* color depth 8 bit */ + sm712_setpalette(regno, red, green, blue, info); + break; + + default: + return 1; /* unknown type */ + } + + return 0; + +} + +#ifdef __BIG_ENDIAN +static ssize_t smtcfb_read(struct fb_info *info, char __user *buf, size_t + count, loff_t *ppos) +{ + unsigned long p = *ppos; + + u32 *buffer, *dst; + u32 __iomem *src; + int c, i, cnt = 0, err = 0; + unsigned long total_size; + + if (!info || !info->screen_base) + return -ENODEV; + + if (info->state != FBINFO_STATE_RUNNING) + return -EPERM; + + total_size = info->screen_size; + + if (total_size == 0) + total_size = info->fix.smem_len; + + if (p >= total_size) + return 0; + + if (count >= total_size) + count = total_size; + + if (count + p > total_size) + count = total_size - p; + + buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, GFP_KERNEL); + if (!buffer) + return -ENOMEM; + + src = (u32 __iomem *) (info->screen_base + p); + + if (info->fbops->fb_sync) + info->fbops->fb_sync(info); + + while (count) { + c = (count > PAGE_SIZE) ? PAGE_SIZE : count; + dst = buffer; + for (i = c >> 2; i--;) { + *dst = fb_readl(src++); + *dst = + (*dst & 0xff00ff00 >> 8) | + (*dst & 0x00ff00ff << 8); + dst++; + } + if (c & 3) { + u8 *dst8 = (u8 *) dst; + u8 __iomem *src8 = (u8 __iomem *) src; + + for (i = c & 3; i--;) { + if (i & 1) { + *dst8++ = fb_readb(++src8); + } else { + *dst8++ = fb_readb(--src8); + src8 += 2; + } + } + src = (u32 __iomem *) src8; + } + + if (copy_to_user(buf, buffer, c)) { + err = -EFAULT; + break; + } + *ppos += c; + buf += c; + cnt += c; + count -= c; + } + + kfree(buffer); + + return (err) ? err : cnt; +} + +static ssize_t +smtcfb_write(struct fb_info *info, const char __user *buf, size_t count, + loff_t *ppos) +{ + unsigned long p = *ppos; + + u32 *buffer, *src; + u32 __iomem *dst; + int c, i, cnt = 0, err = 0; + unsigned long total_size; + + if (!info || !info->screen_base) + return -ENODEV; + + if (info->state != FBINFO_STATE_RUNNING) + return -EPERM; + + total_size = info->screen_size; + + if (total_size == 0) + total_size = info->fix.smem_len; + + if (p > total_size) + return -EFBIG; + + if (count > total_size) { + err = -EFBIG; + count = total_size; + } + + if (count + p > total_size) { + if (!err) + err = -ENOSPC; + + count = total_size - p; + } + + buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, GFP_KERNEL); + if (!buffer) + return -ENOMEM; + + dst = (u32 __iomem *) (info->screen_base + p); + + if (info->fbops->fb_sync) + info->fbops->fb_sync(info); + + while (count) { + c = (count > PAGE_SIZE) ? PAGE_SIZE : count; + src = buffer; + + if (copy_from_user(src, buf, c)) { + err = -EFAULT; + break; + } + + for (i = c >> 2; i--;) { + fb_writel((*src & 0xff00ff00 >> 8) | + (*src & 0x00ff00ff << 8), dst++); + src++; + } + if (c & 3) { + u8 *src8 = (u8 *) src; + u8 __iomem *dst8 = (u8 __iomem *) dst; + + for (i = c & 3; i--;) { + if (i & 1) { + fb_writeb(*src8++, ++dst8); + } else { + fb_writeb(*src8++, --dst8); + dst8 += 2; + } + } + dst = (u32 __iomem *) dst8; + } + + *ppos += c; + buf += c; + cnt += c; + count -= c; + } + + kfree(buffer); + + return (cnt) ? cnt : err; +} +#endif /* ! __BIG_ENDIAN */ + +void smtcfb_setmode(struct smtcfb_info *sfb) +{ + switch (sfb->fb.var.bits_per_pixel) { + case 32: + sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR; + sfb->fb.fix.line_length = sfb->fb.var.xres * 4; + sfb->fb.var.red.length = 8; + sfb->fb.var.green.length = 8; + sfb->fb.var.blue.length = 8; + sfb->fb.var.red.offset = 16; + sfb->fb.var.green.offset = 8; + sfb->fb.var.blue.offset = 0; + + break; + case 8: + sfb->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR; + sfb->fb.fix.line_length = sfb->fb.var.xres; + sfb->fb.var.red.offset = 5; + sfb->fb.var.red.length = 3; + sfb->fb.var.green.offset = 2; + sfb->fb.var.green.length = 3; + sfb->fb.var.blue.offset = 0; + sfb->fb.var.blue.length = 2; + break; + case 24: + sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR; + sfb->fb.fix.line_length = sfb->fb.var.xres * 3; + sfb->fb.var.red.length = 8; + sfb->fb.var.green.length = 8; + sfb->fb.var.blue.length = 8; + + sfb->fb.var.red.offset = 16; + sfb->fb.var.green.offset = 8; + sfb->fb.var.blue.offset = 0; + + break; + case 16: + default: + sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR; + sfb->fb.fix.line_length = sfb->fb.var.xres * 2; + + sfb->fb.var.red.length = 5; + sfb->fb.var.green.length = 6; + sfb->fb.var.blue.length = 5; + + sfb->fb.var.red.offset = 11; + sfb->fb.var.green.offset = 5; + sfb->fb.var.blue.offset = 0; + + break; + } + + sfb->width = sfb->fb.var.xres; + sfb->height = sfb->fb.var.yres; + sfb->hz = 60; + smtc_set_timing(sfb); +} + +static int smtc_check_var(struct fb_var_screeninfo *var, struct fb_info *info) +{ + /* sanity checks */ + if (var->xres_virtual < var->xres) + var->xres_virtual = var->xres; + + if (var->yres_virtual < var->yres) + var->yres_virtual = var->yres; + + /* set valid default bpp */ + if ((var->bits_per_pixel != 8) && (var->bits_per_pixel != 16) && + (var->bits_per_pixel != 24) && (var->bits_per_pixel != 32)) + var->bits_per_pixel = 16; + + return 0; +} + +static int smtc_set_par(struct fb_info *info) +{ + struct smtcfb_info *sfb = (struct smtcfb_info *)info; + + smtcfb_setmode(sfb); + + return 0; +} + +static struct fb_ops smtcfb_ops = { + .owner = THIS_MODULE, + .fb_check_var = smtc_check_var, + .fb_set_par = smtc_set_par, + .fb_setcolreg = smtc_setcolreg, + .fb_blank = smtc_blank, + .fb_fillrect = cfb_fillrect, + .fb_imageblit = cfb_imageblit, + .fb_copyarea = cfb_copyarea, +#ifdef __BIG_ENDIAN + .fb_read = smtcfb_read, + .fb_write = smtcfb_write, +#endif +}; + +/* + * Alloc struct smtcfb_info and assign the default value + */ +static struct smtcfb_info *smtc_alloc_fb_info(struct pci_dev *pdev, char *name) +{ + struct smtcfb_info *sfb; + + sfb = kzalloc(sizeof(*sfb), GFP_KERNEL); + + if (!sfb) + return NULL; + + sfb->pdev = pdev; + + /*** Init sfb->fb with default value ***/ + sfb->fb.flags = FBINFO_FLAG_DEFAULT; + sfb->fb.fbops = &smtcfb_ops; + sfb->fb.var = smtcfb_var; + sfb->fb.fix = smtcfb_fix; + + strcpy(sfb->fb.fix.id, name); + + sfb->fb.fix.type = FB_TYPE_PACKED_PIXELS; + sfb->fb.fix.type_aux = 0; + sfb->fb.fix.xpanstep = 0; + sfb->fb.fix.ypanstep = 0; + sfb->fb.fix.ywrapstep = 0; + sfb->fb.fix.accel = FB_ACCEL_SMI_LYNX; + + sfb->fb.var.nonstd = 0; + sfb->fb.var.activate = FB_ACTIVATE_NOW; + sfb->fb.var.height = -1; + sfb->fb.var.width = -1; + /* text mode acceleration */ + sfb->fb.var.accel_flags = FB_ACCELF_TEXT; + sfb->fb.var.vmode = FB_VMODE_NONINTERLACED; + + sfb->fb.par = sfb; + + sfb->fb.pseudo_palette = colreg; + + return sfb; +} + +/* + * Unmap in the memory mapped IO registers + */ + +static void smtc_unmap_mmio(struct smtcfb_info *sfb) +{ + if (sfb && smtc_RegBaseAddress) + smtc_RegBaseAddress = NULL; +} + +/* + * Map in the screen memory + */ + +static int smtc_map_smem(struct smtcfb_info *sfb, + struct pci_dev *pdev, u_long smem_len) +{ + + sfb->fb.fix.smem_start = pci_resource_start(pdev, 0); + +#ifdef __BIG_ENDIAN + if (sfb->fb.var.bits_per_pixel == 32) + sfb->fb.fix.smem_start += 0x800000; +#endif + + sfb->fb.fix.smem_len = smem_len; + + sfb->fb.screen_base = smtc_VRAMBaseAddress; + + if (!sfb->fb.screen_base) { + dev_err(&pdev->dev, + "%s: unable to map screen memory\n", sfb->fb.fix.id); + return -ENOMEM; + } + + return 0; +} + +/* + * Unmap in the screen memory + * + */ +static void smtc_unmap_smem(struct smtcfb_info *sfb) +{ + if (sfb && sfb->fb.screen_base) { + iounmap(sfb->fb.screen_base); + sfb->fb.screen_base = NULL; + } +} + +/* + * We need to wake up the device and make sure its in linear memory mode. + */ +static inline void sm7xx_init_hw(void) +{ + outb_p(0x18, 0x3c4); + outb_p(0x11, 0x3c5); +} + +static void smtc_free_fb_info(struct smtcfb_info *sfb) +{ + if (sfb) { + fb_alloc_cmap(&sfb->fb.cmap, 0, 0); + kfree(sfb); + } +} + +/* + * sm712vga_setup - process command line options, get vga parameter + * @options: string of options + * Returns zero. + * + */ +static int __init sm712vga_setup(char *options) +{ + int index; + + if (!options || !*options) + return -EINVAL; + + smtc_screen_info.lfb_width = 0; + smtc_screen_info.lfb_height = 0; + smtc_screen_info.lfb_depth = 0; + + pr_debug("sm712vga_setup = %s\n", options); + + for (index = 0; + index < ARRAY_SIZE(vesa_mode); + index++) { + if (strstr(options, vesa_mode[index].mode_index)) { + smtc_screen_info.lfb_width = vesa_mode[index].lfb_width; + smtc_screen_info.lfb_height = + vesa_mode[index].lfb_height; + smtc_screen_info.lfb_depth = vesa_mode[index].lfb_depth; + return 0; + } + } + + return -1; +} +__setup("vga=", sm712vga_setup); + +static int __devinit smtcfb_pci_probe(struct pci_dev *pdev, + const struct pci_device_id *ent) +{ + struct smtcfb_info *sfb; + u_long smem_size = 0x00800000; /* default 8MB */ + char name[16]; + int err; + unsigned long pFramebufferPhysical; + + dev_info(&pdev->dev, "Silicon Motion display driver."); + + err = pci_enable_device(pdev); /* enable SMTC chip */ + if (err) + return err; + + sfb = smtc_alloc_fb_info(pdev, name); + + if (!sfb) + goto failed_free; + + sfb->chipID = ent->device; + sprintf(name, "sm%Xfb", sfb->chipID); + + pci_set_drvdata(pdev, sfb); + + sm7xx_init_hw(); + + /*get mode parameter from smtc_screen_info */ + if (smtc_screen_info.lfb_width != 0) { + sfb->fb.var.xres = smtc_screen_info.lfb_width; + sfb->fb.var.yres = smtc_screen_info.lfb_height; + sfb->fb.var.bits_per_pixel = smtc_screen_info.lfb_depth; + } else { + /* default resolution 1024x600 16bit mode */ + sfb->fb.var.xres = SCREEN_X_RES; + sfb->fb.var.yres = SCREEN_Y_RES; + sfb->fb.var.bits_per_pixel = SCREEN_BPP; + } + +#ifdef __BIG_ENDIAN + if (sfb->fb.var.bits_per_pixel == 24) + sfb->fb.var.bits_per_pixel = (smtc_screen_info.lfb_depth = 32); +#endif + /* Map address and memory detection */ + pFramebufferPhysical = pci_resource_start(pdev, 0); + pci_read_config_byte(pdev, PCI_REVISION_ID, &sfb->chipRevID); + + switch (sfb->chipID) { + case 0x710: + case 0x712: + sfb->fb.fix.mmio_start = pFramebufferPhysical + 0x00400000; + sfb->fb.fix.mmio_len = 0x00400000; + smem_size = SM712_VIDEOMEMORYSIZE; +#ifdef __BIG_ENDIAN + sfb->m_pLFB = (smtc_VRAMBaseAddress = + ioremap(pFramebufferPhysical, 0x00c00000)); +#else + sfb->m_pLFB = (smtc_VRAMBaseAddress = + ioremap(pFramebufferPhysical, 0x00800000)); +#endif + sfb->m_pMMIO = (smtc_RegBaseAddress = + smtc_VRAMBaseAddress + 0x00700000); + sfb->m_pDPR = smtc_VRAMBaseAddress + 0x00408000; + sfb->m_pVPR = sfb->m_pLFB + 0x0040c000; +#ifdef __BIG_ENDIAN + if (sfb->fb.var.bits_per_pixel == 32) { + smtc_VRAMBaseAddress += 0x800000; + sfb->m_pLFB += 0x800000; + dev_info(&pdev->dev, + "smtc_VRAMBaseAddress=%p sfb->m_pLFB=%p", + smtc_VRAMBaseAddress, sfb->m_pLFB); + } +#endif + if (!smtc_RegBaseAddress) { + dev_err(&pdev->dev, + "%s: unable to map memory mapped IO!", + sfb->fb.fix.id); + err = -ENOMEM; + goto failed_fb; + } + + /* set MCLK = 14.31818 * (0x16 / 0x2) */ + smtc_seqw(0x6a, 0x16); + smtc_seqw(0x6b, 0x02); + smtc_seqw(0x62, 0x3e); + /* enable PCI burst */ + smtc_seqw(0x17, 0x20); + /* enable word swap */ +#ifdef __BIG_ENDIAN + if (sfb->fb.var.bits_per_pixel == 32) + smtc_seqw(0x17, 0x30); +#endif + break; + case 0x720: + sfb->fb.fix.mmio_start = pFramebufferPhysical; + sfb->fb.fix.mmio_len = 0x00200000; + smem_size = SM722_VIDEOMEMORYSIZE; + sfb->m_pDPR = ioremap(pFramebufferPhysical, 0x00a00000); + sfb->m_pLFB = (smtc_VRAMBaseAddress = + sfb->m_pDPR + 0x00200000); + sfb->m_pMMIO = (smtc_RegBaseAddress = + sfb->m_pDPR + 0x000c0000); + sfb->m_pVPR = sfb->m_pDPR + 0x800; + + smtc_seqw(0x62, 0xff); + smtc_seqw(0x6a, 0x0d); + smtc_seqw(0x6b, 0x02); + break; + default: + dev_err(&pdev->dev, + "No valid Silicon Motion display chip was detected!"); + + goto failed_fb; + } + + /* can support 32 bpp */ + if (15 == sfb->fb.var.bits_per_pixel) + sfb->fb.var.bits_per_pixel = 16; + + sfb->fb.var.xres_virtual = sfb->fb.var.xres; + sfb->fb.var.yres_virtual = sfb->fb.var.yres; + err = smtc_map_smem(sfb, pdev, smem_size); + if (err) + goto failed; + + smtcfb_setmode(sfb); + /* Primary display starting from 0 position */ + sfb->BaseAddressInVRAM = 0; + + err = register_framebuffer(&sfb->fb); + if (err < 0) + goto failed; + + dev_info(&pdev->dev, + "Silicon Motion SM%X Rev%X primary display mode %dx%d-%d Init Complete.", + sfb->chipID, sfb->chipRevID, sfb->fb.var.xres, + sfb->fb.var.yres, sfb->fb.var.bits_per_pixel); + + return 0; + +failed: + dev_err(&pdev->dev, "Silicon Motion, Inc. primary display init fail."); + + smtc_unmap_smem(sfb); + smtc_unmap_mmio(sfb); +failed_fb: + smtc_free_fb_info(sfb); + +failed_free: + pci_disable_device(pdev); + + return err; +} + +/* + * 0x710 (LynxEM) + * 0x712 (LynxEM+) + * 0x720 (Lynx3DM, Lynx3DM+) + */ +static DEFINE_PCI_DEVICE_TABLE(smtcfb_pci_table) = { + { PCI_DEVICE(0x126f, 0x710), }, + { PCI_DEVICE(0x126f, 0x712), }, + { PCI_DEVICE(0x126f, 0x720), }, + {0,} +}; + +static void __devexit smtcfb_pci_remove(struct pci_dev *pdev) +{ + struct smtcfb_info *sfb; + + sfb = pci_get_drvdata(pdev); + pci_set_drvdata(pdev, NULL); + smtc_unmap_smem(sfb); + smtc_unmap_mmio(sfb); + unregister_framebuffer(&sfb->fb); + smtc_free_fb_info(sfb); +} + +#ifdef CONFIG_PM +static int smtcfb_pci_suspend(struct device *device) +{ + struct pci_dev *pdev = to_pci_dev(device); + struct smtcfb_info *sfb; + + sfb = pci_get_drvdata(pdev); + + /* set the hw in sleep mode use externel clock and self memory refresh + * so that we can turn off internal PLLs later on + */ + smtc_seqw(0x20, (smtc_seqr(0x20) | 0xc0)); + smtc_seqw(0x69, (smtc_seqr(0x69) & 0xf7)); + + console_lock(); + fb_set_suspend(&sfb->fb, 1); + console_unlock(); + + /* additionally turn off all function blocks including internal PLLs */ + smtc_seqw(0x21, 0xff); + + return 0; +} + +static int smtcfb_pci_resume(struct device *device) +{ + struct pci_dev *pdev = to_pci_dev(device); + struct smtcfb_info *sfb; + + sfb = pci_get_drvdata(pdev); + + /* reinit hardware */ + sm7xx_init_hw(); + switch (sfb->chipID) { + case 0x710: + case 0x712: + /* set MCLK = 14.31818 * (0x16 / 0x2) */ + smtc_seqw(0x6a, 0x16); + smtc_seqw(0x6b, 0x02); + smtc_seqw(0x62, 0x3e); + /* enable PCI burst */ + smtc_seqw(0x17, 0x20); +#ifdef __BIG_ENDIAN + if (sfb->fb.var.bits_per_pixel == 32) + smtc_seqw(0x17, 0x30); +#endif + break; + case 0x720: + smtc_seqw(0x62, 0xff); + smtc_seqw(0x6a, 0x0d); + smtc_seqw(0x6b, 0x02); + break; + } + + smtc_seqw(0x34, (smtc_seqr(0x34) | 0xc0)); + smtc_seqw(0x33, ((smtc_seqr(0x33) | 0x08) & 0xfb)); + + smtcfb_setmode(sfb); + + console_lock(); + fb_set_suspend(&sfb->fb, 0); + console_unlock(); + + return 0; +} + +static const struct dev_pm_ops sm7xx_pm_ops = { + .suspend = smtcfb_pci_suspend, + .resume = smtcfb_pci_resume, + .freeze = smtcfb_pci_suspend, + .thaw = smtcfb_pci_resume, + .poweroff = smtcfb_pci_suspend, + .restore = smtcfb_pci_resume, +}; + +#define SM7XX_PM_OPS (&sm7xx_pm_ops) + +#else /* !CONFIG_PM */ + +#define SM7XX_PM_OPS NULL + +#endif /* !CONFIG_PM */ + +static struct pci_driver smtcfb_driver = { + .name = "smtcfb", + .id_table = smtcfb_pci_table, + .probe = smtcfb_pci_probe, + .remove = __devexit_p(smtcfb_pci_remove), + .driver.pm = SM7XX_PM_OPS, +}; + +static int __init smtcfb_init(void) +{ + return pci_register_driver(&smtcfb_driver); +} + +static void __exit smtcfb_exit(void) +{ + pci_unregister_driver(&smtcfb_driver); +} + +module_init(smtcfb_init); +module_exit(smtcfb_exit); + +MODULE_AUTHOR("Siliconmotion "); +MODULE_DESCRIPTION("Framebuffer driver for SMI Graphic Cards"); +MODULE_LICENSE("GPL"); -- cgit v0.10.2 From 14e70bfdc6dd4d6b88f3477f3966df7405e78a69 Mon Sep 17 00:00:00 2001 From: Samuel Iglesias Gonsalvez Date: Mon, 11 Jun 2012 08:56:36 +0200 Subject: Staging: ipack: remove pr_fmt definition. As there is no pr_* function used here, pr_fmt is not needed. Signed-off-by: Samuel Iglesias Gonsalvez Acked-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/ipack.c b/drivers/staging/ipack/ipack.c index a1448e6..c1cd97a 100644 --- a/drivers/staging/ipack/ipack.c +++ b/drivers/staging/ipack/ipack.c @@ -9,8 +9,6 @@ * Software Foundation; version 2 of the License. */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - #include #include #include -- cgit v0.10.2 From 4bce6b897ed6812e000c034968c8c250de40da9b Mon Sep 17 00:00:00 2001 From: Andrzej Pietrasiewicz Date: Mon, 11 Jun 2012 11:11:59 +0200 Subject: staging: usb: gadget: Configurable Composite Gadget depends on BLOCK Signed-off-by: Andrzej Pietrasiewicz Signed-off-by: Kyungmin Park Acked-by: Randy Dunlap Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ccg/Kconfig b/drivers/staging/ccg/Kconfig index ff05e52..1f00d70 100644 --- a/drivers/staging/ccg/Kconfig +++ b/drivers/staging/ccg/Kconfig @@ -2,7 +2,7 @@ if USB_GADGET config USB_G_CCG tristate "Configurable Composite Gadget (STAGING)" - depends on STAGING && !USB_ZERO && !USB_ZERO_HNPTEST && !USB_AUDIO && !GADGET_UAC1 && !USB_ETH && !USB_ETH_RNDIS && !USB_ETH_EEM && !USB_G_NCM && !USB_GADGETFS && !USB_FUNCTIONFS && !USB_FUNCTIONFS_ETH && !USB_FUNCTIONFS_RNDIS && !USB_FUNCTIONFS_GENERIC && !USB_FILE_STORAGE && !USB_FILE_STORAGE_TEST && !USB_MASS_STORAGE && !USB_G_SERIAL && !USB_MIDI_GADGET && !USB_G_PRINTER && !USB_CDC_COMPOSITE && !USB_G_NOKIA && !USB_G_ACM_MS && !USB_G_MULTI && !USB_G_MULTI_RNDIS && !USB_G_MULTI_CDC && !USB_G_HID && !USB_G_DBGP && !USB_G_WEBCAM + depends on STAGING && BLOCK && !USB_ZERO && !USB_ZERO_HNPTEST && !USB_AUDIO && !GADGET_UAC1 && !USB_ETH && !USB_ETH_RNDIS && !USB_ETH_EEM && !USB_G_NCM && !USB_GADGETFS && !USB_FUNCTIONFS && !USB_FUNCTIONFS_ETH && !USB_FUNCTIONFS_RNDIS && !USB_FUNCTIONFS_GENERIC && !USB_FILE_STORAGE && !USB_FILE_STORAGE_TEST && !USB_MASS_STORAGE && !USB_G_SERIAL && !USB_MIDI_GADGET && !USB_G_PRINTER && !USB_CDC_COMPOSITE && !USB_G_NOKIA && !USB_G_ACM_MS && !USB_G_MULTI && !USB_G_MULTI_RNDIS && !USB_G_MULTI_CDC && !USB_G_HID && !USB_G_DBGP && !USB_G_WEBCAM help The Configurable Composite Gadget supports multiple USB functions: acm, mass storage, rndis and FunctionFS. -- cgit v0.10.2 From 383b7fc2dca769d98ca373306e105987e8f143b3 Mon Sep 17 00:00:00 2001 From: William Blair Date: Sun, 10 Jun 2012 15:10:33 -0400 Subject: Staging: keucr: init: fixed a brace coding style issue Fixed a coding style issue. Signed-off-by: William Blair Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/keucr/init.c b/drivers/staging/keucr/init.c index 071bdc2..231611d 100644 --- a/drivers/staging/keucr/init.c +++ b/drivers/staging/keucr/init.c @@ -30,9 +30,8 @@ int ENE_InitMedia(struct us_data *us) if (MiscReg03 & 0x02) { if (!us->SM_Status.Ready && !us->MS_Status.Ready) { result = ENE_SMInit(us); - if (result != USB_STOR_XFER_GOOD) { + if (result != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; - } } } -- cgit v0.10.2 From 7a2ea600fcda3cfa04033cf3077116cf2522aa9c Mon Sep 17 00:00:00 2001 From: Samuel Iglesias Gonsalvez Date: Tue, 12 Jun 2012 11:37:46 +0200 Subject: Staging: ipack: delete sysfs from to-do list. As we have already got rid of sysfs files in the tpci200 driver, it is needed to delete that mention in the TODO file. Signed-off-by: Samuel Iglesias Gonsalvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/TODO b/drivers/staging/ipack/TODO index 3a45a53..0f8bf20 100644 --- a/drivers/staging/ipack/TODO +++ b/drivers/staging/ipack/TODO @@ -15,10 +15,6 @@ TODO TPCI-200 -------- -* It receives the name of the mezzanine plugged in each slot by SYSFS. - No autodetection supported yet, because the mezzanine driver could not be - loaded at the time that the tpci200 driver loads. - * It has a linked list with the tpci200 devices it is managing. Get rid of it and use driver_for_each_device() instead. -- cgit v0.10.2 From e34995148a2a305106c4f746fb76da23488c46c7 Mon Sep 17 00:00:00 2001 From: "Justin P. Mattock" Date: Mon, 11 Jun 2012 07:48:46 -0700 Subject: staging "sep" Fix typos found while reading. Signed-off-by: Justin P. Mattock Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sep/sep_crypto.c b/drivers/staging/sep/sep_crypto.c index 9fd9da8..045493b 100644 --- a/drivers/staging/sep/sep_crypto.c +++ b/drivers/staging/sep/sep_crypto.c @@ -807,7 +807,7 @@ end_function: * @size: size of parameter to copy (in bytes) * @max_size: size to move up offset; SEP mesg is in word sizes * @msg_offset: pointer to current offset (is updated) - * @byte_array: flag ti indicate wheter endian must be changed + * @byte_array: flag ti indicate whether endian must be changed * Copies data into the message area from caller */ static void sep_write_msg(struct this_task_ctx *ta_ctx, void *in_addr, @@ -855,7 +855,7 @@ static void sep_make_header(struct this_task_ctx *ta_ctx, u32 *msg_offset, * @size: size of parameter to copy (in bytes) * @max_size: size to move up offset; SEP mesg is in word sizes * @msg_offset: pointer to current offset (is updated) - * @byte_array: flag ti indicate wheter endian must be changed + * @byte_array: flag ti indicate whether endian must be changed * Copies data out of the message area to caller */ static void sep_read_msg(struct this_task_ctx *ta_ctx, void *in_addr, @@ -990,7 +990,7 @@ static void sep_clear_out(struct this_task_ctx *ta_ctx) /** * The following unlocks the sep and makes it available * to any other application - * First, null out crypto entries in sep before relesing it + * First, null out crypto entries in sep before releasing it */ ta_ctx->sep_used->current_hash_req = NULL; ta_ctx->sep_used->current_cypher_req = NULL; @@ -1001,7 +1001,7 @@ static void sep_clear_out(struct this_task_ctx *ta_ctx) ta_ctx->call_status.status = 0; - /* Remove anything confidentail */ + /* Remove anything confidential */ memset(ta_ctx->sep_used->shared_addr, 0, SEP_DRIVER_MESSAGE_SHARED_AREA_SIZE_IN_BYTES); @@ -1207,7 +1207,7 @@ static int sep_crypto_block_data(struct ablkcipher_request *req) req->nbytes, ta_ctx->walk.blocksize, &new_sg, 1); if (int_error < 0) { - dev_warn(&ta_ctx->sep_used->pdev->dev, "oddball page eerror\n"); + dev_warn(&ta_ctx->sep_used->pdev->dev, "oddball page error\n"); return -ENOMEM; } else if (int_error == 1) { ta_ctx->src_sg = new_sg; @@ -1870,7 +1870,7 @@ static u32 hash_update_post_op(struct sep_device *sep) sizeof(struct sep_hash_private_context)); /** - * Following is only for finup; if we just completd the + * Following is only for finup; if we just completed the * data portion of finup, we now need to kick off the * finish portion of finup. */ @@ -2011,7 +2011,7 @@ static u32 hash_digest_post_op(struct sep_device *sep) } /** - * The sep_finish function is the function that is schedule (via tasket) + * The sep_finish function is the function that is scheduled (via tasklet) * by the interrupt service routine when the SEP sends and interrupt * This is only called by the interrupt handler as a tasklet. */ @@ -2249,7 +2249,7 @@ static void sep_hash_update(void *data) head_len = (block_size - int_ctx->prev_update_bytes) % block_size; tail_len = (req->nbytes - head_len) % block_size; - /* Make sure all pages are even block */ + /* Make sure all pages are an even block */ int_error = sep_oddball_pages(ta_ctx->sep_used, req->src, req->nbytes, block_size, &new_sg, 1); @@ -2482,7 +2482,7 @@ static void sep_hash_digest(void *data) dev_dbg(&ta_ctx->sep_used->pdev->dev, "block_size is %x\n", block_size); dev_dbg(&ta_ctx->sep_used->pdev->dev, "tail len is %x\n", tail_len); - /* Make sure all pages are even block */ + /* Make sure all pages are an even block */ int_error = sep_oddball_pages(ta_ctx->sep_used, req->src, req->nbytes, block_size, &new_sg, 1); diff --git a/drivers/staging/sep/sep_driver_api.h b/drivers/staging/sep/sep_driver_api.h index 8b797d5..7ee1c3b 100644 --- a/drivers/staging/sep/sep_driver_api.h +++ b/drivers/staging/sep/sep_driver_api.h @@ -91,7 +91,7 @@ struct sep_dcblock { }; /* - command structure for building dcb block (currently for ext app only + command structure for building dcb block (currently for ext app only) */ struct build_dcb_struct { /* address value of the data in */ @@ -234,7 +234,7 @@ struct sep_dma_context { u32 dmatables_len; /* size of input data */ u32 input_data_len; - /* secure dma use (for imr memory restriced area in output */ + /* secure dma use (for imr memory restricted area in output) */ bool secure_dma; struct sep_dma_resource dma_res_arr[SEP_MAX_NUM_SYNC_DMA_OPS]; /* Scatter gather for kernel crypto */ @@ -347,10 +347,10 @@ int sep_prepare_input_output_dma_table_in_dcb(struct sep_device *sep, /** * sep_free_dma_table_data_handler - free DMA table - * @sep: pointere to struct sep_device + * @sep: pointer to struct sep_device * @dma_ctx: dma context * - * Handles the request to free DMA table for synchronic actions + * Handles the request to free DMA table for synchronic actions */ int sep_free_dma_table_data_handler(struct sep_device *sep, struct sep_dma_context **dma_ctx); diff --git a/drivers/staging/sep/sep_driver_config.h b/drivers/staging/sep/sep_driver_config.h index 9d9fc7c..7d7c7ab 100644 --- a/drivers/staging/sep/sep_driver_config.h +++ b/drivers/staging/sep/sep_driver_config.h @@ -43,7 +43,7 @@ #define SEP_DRIVER_POLLING_MODE 0 /* flag which defines if the shared area address should be - reconfiged (send to SEP anew) during init of the driver */ + reconfigured (send to SEP anew) during init of the driver */ #define SEP_DRIVER_RECONFIG_MESSAGE_AREA 0 /* the mode for running on the ARM1172 Evaluation platform (flag is 1) */ @@ -166,7 +166,7 @@ held by the process (struct file) */ (SEP_DRIVER_STATIC_AREA_OFFSET_IN_BYTES + \ SEP_DRIVER_STATIC_AREA_SIZE_IN_BYTES) -/* synhronic dma tables area offset */ +/* synchronic dma tables area offset */ #define SYNCHRONIC_DMA_TABLES_AREA_OFFSET_BYTES \ (SEP_DRIVER_DATA_POOL_AREA_OFFSET_IN_BYTES + \ SEP_DRIVER_DATA_POOL_SHARED_AREA_SIZE_IN_BYTES) diff --git a/drivers/staging/sep/sep_main.c b/drivers/staging/sep/sep_main.c index ab35128..270fcb8 100644 --- a/drivers/staging/sep/sep_main.c +++ b/drivers/staging/sep/sep_main.c @@ -94,7 +94,7 @@ #endif /** - * Currenlty, there is only one SEP device per platform; + * Currently, there is only one SEP device per platform; * In event platforms in the future have more than one SEP * device, this will be a linked list */ @@ -106,7 +106,7 @@ struct sep_device *sep_dev; * @sep: SEP device * @sep_queue_info: pointer to status queue * - * This function will removes information about transaction from the queue. + * This function will remove information about transaction from the queue. */ void sep_queue_status_remove(struct sep_device *sep, struct sep_queue_info **queue_elem) @@ -294,7 +294,7 @@ int sep_wait_transaction(struct sep_device *sep) end_function_setpid: /* * The pid_doing_transaction indicates that this process - * now owns the facilities to performa a transaction with + * now owns the facilities to perform a transaction with * the SEP. While this process is performing a transaction, * no other process who has the SEP device open can perform * any transactions. This method allows more than one process @@ -447,10 +447,10 @@ static int sep_open(struct inode *inode, struct file *filp) /** * sep_free_dma_table_data_handler - free DMA table - * @sep: pointere to struct sep_device + * @sep: pointer to struct sep_device * @dma_ctx: dma context * - * Handles the request to free DMA table for synchronic actions + * Handles the request to free DMA table for synchronic actions */ int sep_free_dma_table_data_handler(struct sep_device *sep, struct sep_dma_context **dma_ctx) @@ -540,7 +540,7 @@ int sep_free_dma_table_data_handler(struct sep_device *sep, * don't have a page array; the page array is generated * only in the lock_user_pages, which is not called * for kernel crypto, which is what the sg (scatter gather - * is used for exclusively + * is used for exclusively) */ if (dma->src_sg) { dma_unmap_sg(&sep->pdev->dev, dma->src_sg, @@ -1227,7 +1227,7 @@ static int sep_lock_user_pages(struct sep_device *sep, /* Map array */ struct sep_dma_map *map_array; - /* Set start and end pages and num pages */ + /* Set start and end pages and num pages */ end_page = (app_virt_addr + data_size - 1) >> PAGE_SHIFT; start_page = app_virt_addr >> PAGE_SHIFT; num_pages = end_page - start_page + 1; @@ -1431,7 +1431,7 @@ static int sep_lli_table_secure_dma(struct sep_device *sep, /* Array of lli */ struct sep_lli_entry *lli_array; - /* Set start and end pages and num pages */ + /* Set start and end pages and num pages */ end_page = (app_virt_addr + data_size - 1) >> PAGE_SHIFT; start_page = app_virt_addr >> PAGE_SHIFT; num_pages = end_page - start_page + 1; @@ -1602,7 +1602,7 @@ end_function: * @num_table_entries_ptr: pointer to number of tables * @table_data_size: total data size * - * Builds ant lli table from the lli_array according to + * Builds an lli table from the lli_array according to * the given size of data */ static void sep_build_lli_table(struct sep_device *sep, @@ -1701,7 +1701,7 @@ static void sep_build_lli_table(struct sep_device *sep, * @virt_address: virtual address to convert * * This functions returns the physical address inside shared area according - * to the virtual address. It can be either on the externa RAM device + * to the virtual address. It can be either on the external RAM device * (ioremapped), or on the system RAM * This implementation is for the external RAM */ @@ -1725,7 +1725,7 @@ static dma_addr_t sep_shared_area_virt_to_bus(struct sep_device *sep, * * This functions returns the virtual address inside shared area * according to the physical address. It can be either on the - * externa RAM device (ioremapped), or on the system RAM + * external RAM device (ioremapped), or on the system RAM * This implementation is for the external RAM */ static void *sep_shared_area_bus_to_virt(struct sep_device *sep, @@ -1891,9 +1891,9 @@ static void sep_prepare_empty_lli_table(struct sep_device *sep, * @lli_table_ptr: * @num_entries_ptr: * @table_data_size_ptr: - * @is_kva: set for kernel data (kernel cryptio call) + * @is_kva: set for kernel data (kernel crypt io call) * - * This function prepares only input DMA table for synhronic symmetric + * This function prepares only input DMA table for synchronic symmetric * operations (HASH) * Note that all bus addresses that are passed to the SEP * are in 32 bit format; the SEP is a 32 bit device @@ -2174,9 +2174,9 @@ static int sep_construct_dma_tables_from_lli( u32 last_table_flag = 0; /* The data size that should be in table */ u32 table_data_size = 0; - /* Number of etnries in the input table */ + /* Number of entries in the input table */ u32 num_entries_in_table = 0; - /* Number of etnries in the output table */ + /* Number of entries in the output table */ u32 num_entries_out_table = 0; if (!dma_ctx) { @@ -2401,7 +2401,7 @@ static int sep_construct_dma_tables_from_lli( * @table_data_size_ptr: * @is_kva: set for kernel data; used only for kernel crypto module * - * This function builds input and output DMA tables for synhronic + * This function builds input and output DMA tables for synchronic * symmetric operations (AES, DES, HASH). It also checks that each table * is of the modular block size * Note that all bus addresses that are passed to the SEP @@ -2556,7 +2556,7 @@ static int sep_prepare_input_output_dma_table(struct sep_device *sep, "[PID%d] SEP_DRIVER_ENTRIES_PER_TABLE_IN_SEP is (hex) %x\n", current->pid, SEP_DRIVER_ENTRIES_PER_TABLE_IN_SEP); - /* Call the fucntion that creates table from the lli arrays */ + /* Call the function that creates table from the lli arrays */ dev_dbg(&sep->pdev->dev, "[PID%d] calling create table from lli\n", current->pid); error = sep_construct_dma_tables_from_lli( @@ -3663,7 +3663,7 @@ static ssize_t sep_read(struct file *filp, goto end_function; } - /* Checks that user has called necessarry apis */ + /* Checks that user has called necessary apis */ if (0 == test_bit(SEP_FASTCALL_WRITE_DONE_OFFSET, &call_status->status)) { dev_warn(&sep->pdev->dev, -- cgit v0.10.2 From 2f0b9d082e5d0056a3aca4be038483a564849196 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 11 Jun 2012 17:45:15 -0700 Subject: staging: comedi: export alloc_subdevices as comedi_alloc_subdevices Move the inline alloc_subdevices() function from comedidev.h to drivers.c and rename it to comedi_alloc_subdevices(). The function is large enough to warrant being an exported symbol rather than being an inline in every driver. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 9cd2b51..bb98f82 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -292,6 +292,8 @@ static inline struct comedi_subdevice *comedi_get_write_subdevice( return info->device->write_subdev; } +int comedi_alloc_subdevices(struct comedi_device *, unsigned int); + void comedi_device_detach(struct comedi_device *dev); int comedi_device_attach(struct comedi_device *dev, struct comedi_devconfig *it); @@ -413,26 +415,6 @@ struct comedi_lrange { /* some silly little inline functions */ -static inline int alloc_subdevices(struct comedi_device *dev, - unsigned int num_subdevices) -{ - unsigned i; - - dev->n_subdevices = num_subdevices; - dev->subdevices = - kcalloc(num_subdevices, sizeof(struct comedi_subdevice), - GFP_KERNEL); - if (!dev->subdevices) - return -ENOMEM; - for (i = 0; i < num_subdevices; ++i) { - dev->subdevices[i].device = dev; - dev->subdevices[i].async_dma_dir = DMA_NONE; - spin_lock_init(&dev->subdevices[i].spin_lock); - dev->subdevices[i].minor = -1; - } - return 0; -} - static inline int alloc_private(struct comedi_device *dev, int size) { dev->private = kzalloc(size, GFP_KERNEL); diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 49e53ea..5413647 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -56,6 +56,27 @@ static int poll_invalid(struct comedi_device *dev, struct comedi_subdevice *s); struct comedi_driver *comedi_drivers; +int comedi_alloc_subdevices(struct comedi_device *dev, + unsigned int num_subdevices) +{ + unsigned i; + + dev->n_subdevices = num_subdevices; + dev->subdevices = + kcalloc(num_subdevices, sizeof(struct comedi_subdevice), + GFP_KERNEL); + if (!dev->subdevices) + return -ENOMEM; + for (i = 0; i < num_subdevices; ++i) { + dev->subdevices[i].device = dev; + dev->subdevices[i].async_dma_dir = DMA_NONE; + spin_lock_init(&dev->subdevices[i].spin_lock); + dev->subdevices[i].minor = -1; + } + return 0; +} +EXPORT_SYMBOL_GPL(comedi_alloc_subdevices); + static void cleanup_device(struct comedi_device *dev) { int i; diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index 27e39e4..875b020 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -388,7 +388,7 @@ static int dev_8255_attach(struct comedi_device *dev, return -EINVAL; } - ret = alloc_subdevices(dev, i); + ret = comedi_alloc_subdevices(dev, i); if (ret < 0) { /* FIXME this printk call should give a proper message, the * below line just maintains previous functionality */ diff --git a/drivers/staging/comedi/drivers/acl7225b.c b/drivers/staging/comedi/drivers/acl7225b.c index c1963ad..3c39148 100644 --- a/drivers/staging/comedi/drivers/acl7225b.c +++ b/drivers/staging/comedi/drivers/acl7225b.c @@ -82,7 +82,7 @@ static int acl7225b_attach(struct comedi_device *dev, dev->iobase = iobase; dev->irq = 0; - if (alloc_subdevices(dev, 3) < 0) + if (comedi_alloc_subdevices(dev, 3) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c index 44aaf83..274990a 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.c +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c @@ -1688,7 +1688,7 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it) } else { /* Update-0.7.57->0.7.68dev->n_subdevices = 7; */ n_subdevices = 7; - ret = alloc_subdevices(dev, n_subdevices); + ret = comedi_alloc_subdevices(dev, n_subdevices); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.c index a76ed25..9632ca1 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.c @@ -63,7 +63,7 @@ void i_ADDI_AttachPCI1710(struct comedi_device *dev) int n_subdevices = 9; /* Update-0.7.57->0.7.68dev->n_subdevices = 9; */ - ret = alloc_subdevices(dev, n_subdevices); + ret = comedi_alloc_subdevices(dev, n_subdevices); if (ret < 0) return; diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index 2f48dc7..7d26d45 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -301,7 +301,7 @@ static int pci6208_attach(struct comedi_device *dev, dev->iobase = io_base; dev->board_name = thisboard->name; - if (alloc_subdevices(dev, 2) < 0) + if (comedi_alloc_subdevices(dev, 2) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/adl_pci7230.c b/drivers/staging/comedi/drivers/adl_pci7230.c index 2c83492..5a6e6c1 100644 --- a/drivers/staging/comedi/drivers/adl_pci7230.c +++ b/drivers/staging/comedi/drivers/adl_pci7230.c @@ -116,7 +116,7 @@ static int adl_pci7230_attach(struct comedi_device *dev, if (alloc_private(dev, sizeof(struct adl_pci7230_private)) < 0) return -ENOMEM; - if (alloc_subdevices(dev, 2) < 0) + if (comedi_alloc_subdevices(dev, 2) < 0) return -ENOMEM; devpriv->pci_dev = adl_pci7230_find_pci(dev, it); diff --git a/drivers/staging/comedi/drivers/adl_pci7296.c b/drivers/staging/comedi/drivers/adl_pci7296.c index 0b8b279..fd9b33a 100644 --- a/drivers/staging/comedi/drivers/adl_pci7296.c +++ b/drivers/staging/comedi/drivers/adl_pci7296.c @@ -92,7 +92,7 @@ static int adl_pci7296_attach(struct comedi_device *dev, if (alloc_private(dev, sizeof(struct adl_pci7296_private)) < 0) return -ENOMEM; - if (alloc_subdevices(dev, 4) < 0) + if (comedi_alloc_subdevices(dev, 4) < 0) return -ENOMEM; devpriv->pci_dev = adl_pci7296_find_pci(dev, it); diff --git a/drivers/staging/comedi/drivers/adl_pci7432.c b/drivers/staging/comedi/drivers/adl_pci7432.c index dd818f1..4976a70 100644 --- a/drivers/staging/comedi/drivers/adl_pci7432.c +++ b/drivers/staging/comedi/drivers/adl_pci7432.c @@ -125,7 +125,7 @@ static int adl_pci7432_attach(struct comedi_device *dev, if (alloc_private(dev, sizeof(struct adl_pci7432_private)) < 0) return -ENOMEM; - if (alloc_subdevices(dev, 2) < 0) + if (comedi_alloc_subdevices(dev, 2) < 0) return -ENOMEM; devpriv->pci_dev = adl_pci7432_find_pci(dev, it); diff --git a/drivers/staging/comedi/drivers/adl_pci8164.c b/drivers/staging/comedi/drivers/adl_pci8164.c index 3447548..78169f7 100644 --- a/drivers/staging/comedi/drivers/adl_pci8164.c +++ b/drivers/staging/comedi/drivers/adl_pci8164.c @@ -261,7 +261,7 @@ static int adl_pci8164_attach(struct comedi_device *dev, if (alloc_private(dev, sizeof(struct adl_pci8164_private)) < 0) return -ENOMEM; - if (alloc_subdevices(dev, 4) < 0) + if (comedi_alloc_subdevices(dev, 4) < 0) return -ENOMEM; devpriv->pci_dev = adl_pci8164_find_pci(dev, it); diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c index 410bbf9..cc17946 100644 --- a/drivers/staging/comedi/drivers/adl_pci9111.c +++ b/drivers/staging/comedi/drivers/adl_pci9111.c @@ -1317,7 +1317,7 @@ static int pci9111_attach(struct comedi_device *dev, /* TODO: Add external multiplexer setup (according to option[2]). */ - error = alloc_subdevices(dev, 4); + error = comedi_alloc_subdevices(dev, 4); if (error < 0) return error; diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 5a5c903..ebd8b8e 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -2268,7 +2268,7 @@ static int pci9118_attach(struct comedi_device *dev, pci_write_config_word(devpriv->pcidev, PCI_COMMAND, u16w | 64); /* Enable parity check for parity error */ - ret = alloc_subdevices(dev, 4); + ret = comedi_alloc_subdevices(dev, 4); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/adq12b.c b/drivers/staging/comedi/drivers/adq12b.c index 1da2989..ca8892e 100644 --- a/drivers/staging/comedi/drivers/adq12b.c +++ b/drivers/staging/comedi/drivers/adq12b.c @@ -271,7 +271,7 @@ static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it) * Allocate the subdevice structures. alloc_subdevice() is a * convenient macro defined in comedidev.h. */ - if (alloc_subdevices(dev, 3) < 0) + if (comedi_alloc_subdevices(dev, 3) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index db9f0a5..be3fc4d 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -1433,7 +1433,7 @@ static int pci1710_attach(struct comedi_device *dev, if (this_board->n_counter) n_subdevices++; - ret = alloc_subdevices(dev, n_subdevices); + ret = comedi_alloc_subdevices(dev, n_subdevices); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/adv_pci1723.c b/drivers/staging/comedi/drivers/adv_pci1723.c index b8768b5..0aa0af4 100644 --- a/drivers/staging/comedi/drivers/adv_pci1723.c +++ b/drivers/staging/comedi/drivers/adv_pci1723.c @@ -365,7 +365,7 @@ static int pci1723_attach(struct comedi_device *dev, if (this_board->n_diochan) n_subdevices++; - ret = alloc_subdevices(dev, n_subdevices); + ret = comedi_alloc_subdevices(dev, n_subdevices); if (ret < 0) { printk(" - Allocation failed!\n"); return ret; diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index df8236c..0fc4f85 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -1156,7 +1156,7 @@ static int pci_dio_attach(struct comedi_device *dev, n_subdevices++; } - ret = alloc_subdevices(dev, n_subdevices); + ret = comedi_alloc_subdevices(dev, n_subdevices); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/aio_aio12_8.c b/drivers/staging/comedi/drivers/aio_aio12_8.c index d215ae1..60466c8 100644 --- a/drivers/staging/comedi/drivers/aio_aio12_8.c +++ b/drivers/staging/comedi/drivers/aio_aio12_8.c @@ -182,7 +182,7 @@ static int aio_aio12_8_attach(struct comedi_device *dev, if (alloc_private(dev, sizeof(struct aio12_8_private)) < 0) return -ENOMEM; - if (alloc_subdevices(dev, 3) < 0) + if (comedi_alloc_subdevices(dev, 3) < 0) return -ENOMEM; s = &dev->subdevices[0]; diff --git a/drivers/staging/comedi/drivers/aio_iiro_16.c b/drivers/staging/comedi/drivers/aio_iiro_16.c index 5c1548b..7d161d6 100644 --- a/drivers/staging/comedi/drivers/aio_iiro_16.c +++ b/drivers/staging/comedi/drivers/aio_iiro_16.c @@ -124,7 +124,7 @@ static int aio_iiro_16_attach(struct comedi_device *dev, if (alloc_private(dev, sizeof(struct aio_iiro_16_private)) < 0) return -ENOMEM; - if (alloc_subdevices(dev, 2) < 0) + if (comedi_alloc_subdevices(dev, 2) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index 3afebb2..d7d056e 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -1273,7 +1273,7 @@ static int dio200_common_attach(struct comedi_device *dev, unsigned long iobase, devpriv->intr_sd = -1; dev->iobase = iobase; dev->board_name = thisboard->name; - ret = alloc_subdevices(dev, layout->n_subdevs); + ret = comedi_alloc_subdevices(dev, layout->n_subdevs); if (ret < 0) { dev_err(dev->class_dev, "error! out of memory!\n"); return ret; diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c index 9cf514e..522e1c0 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236.c +++ b/drivers/staging/comedi/drivers/amplc_pc236.c @@ -455,7 +455,7 @@ static int pc236_common_attach(struct comedi_device *dev, unsigned long iobase, dev->board_name = thisboard->name; dev->iobase = iobase; - ret = alloc_subdevices(dev, 2); + ret = comedi_alloc_subdevices(dev, 2); if (ret < 0) { dev_err(dev->class_dev, "error! out of memory!\n"); return ret; diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index 7020907..cfb69fa 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c @@ -227,7 +227,7 @@ static int pc263_common_attach(struct comedi_device *dev, unsigned long iobase) dev->board_name = thisboard->name; dev->iobase = iobase; - ret = alloc_subdevices(dev, 1); + ret = comedi_alloc_subdevices(dev, 1); if (ret < 0) { dev_err(dev->class_dev, "error! out of memory!\n"); return ret; diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index a1e23ba..8d33aea 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -1380,7 +1380,7 @@ static int pci224_attach_common(struct comedi_device *dev, dev->iobase + PCI224_DACCON); /* Allocate subdevices. There is only one! */ - ret = alloc_subdevices(dev, 1); + ret = comedi_alloc_subdevices(dev, 1); if (ret < 0) { dev_err(dev->class_dev, "error! out of memory!\n"); return ret; diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index 2a43df5..e6598ca 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -2843,7 +2843,7 @@ static int pci230_attach_common(struct comedi_device *dev, * Allocate the subdevice structures. alloc_subdevice() is a * convenient macro defined in comedidev.h. */ - if (alloc_subdevices(dev, 3) < 0) + if (comedi_alloc_subdevices(dev, 3) < 0) return -ENOMEM; s = dev->subdevices + 0; /* analog input subdevice */ diff --git a/drivers/staging/comedi/drivers/c6xdigio.c b/drivers/staging/comedi/drivers/c6xdigio.c index fb9951a..72b000f 100644 --- a/drivers/staging/comedi/drivers/c6xdigio.c +++ b/drivers/staging/comedi/drivers/c6xdigio.c @@ -433,7 +433,8 @@ static int c6xdigio_attach(struct comedi_device *dev, dev->iobase = iobase; dev->board_name = "c6xdigio"; - result = alloc_subdevices(dev, 2); /* 3 with encoder_init write */ + /* 3 subdevices with encoder_init write */ + result = comedi_alloc_subdevices(dev, 2); if (result < 0) return result; diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 3515923..9aa11c1 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -195,7 +195,7 @@ static int das16cs_attach(struct comedi_device *dev, if (alloc_private(dev, sizeof(struct das16cs_private)) < 0) return -ENOMEM; - if (alloc_subdevices(dev, 4) < 0) + if (comedi_alloc_subdevices(dev, 4) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 074feee..435f3aa 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -617,7 +617,7 @@ found: /* * Allocate the subdevice structures. */ - if (alloc_subdevices(dev, 7) < 0) + if (comedi_alloc_subdevices(dev, 7) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 5bcadcb..6b2f153 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -1345,7 +1345,7 @@ static int setup_subdevices(struct comedi_device *dev) void __iomem *dio_8255_iobase; int i; - if (alloc_subdevices(dev, 10) < 0) + if (comedi_alloc_subdevices(dev, 10) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/cb_pcidda.c b/drivers/staging/comedi/drivers/cb_pcidda.c index dc4cf0b..4ab3584 100644 --- a/drivers/staging/comedi/drivers/cb_pcidda.c +++ b/drivers/staging/comedi/drivers/cb_pcidda.c @@ -336,7 +336,7 @@ found: /* * Allocate the subdevice structures. */ - if (alloc_subdevices(dev, 3) < 0) + if (comedi_alloc_subdevices(dev, 3) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/cb_pcidio.c b/drivers/staging/comedi/drivers/cb_pcidio.c index 58d5a3d..56c1d09 100644 --- a/drivers/staging/comedi/drivers/cb_pcidio.c +++ b/drivers/staging/comedi/drivers/cb_pcidio.c @@ -181,7 +181,7 @@ found: * Allocate the subdevice structures. alloc_subdevice() is a * convenient macro defined in comedidev.h. */ - if (alloc_subdevices(dev, thisboard->n_8255) < 0) + if (comedi_alloc_subdevices(dev, thisboard->n_8255) < 0) return -ENOMEM; for (i = 0; i < thisboard->n_8255; i++) { diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index a06b67a..6acb319 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -273,7 +273,7 @@ found: * Allocate the subdevice structures. alloc_subdevice() is a * convenient macro defined in comedidev.h. */ - if (alloc_subdevices(dev, 3) < 0) + if (comedi_alloc_subdevices(dev, 3) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/cb_pcimdda.c b/drivers/staging/comedi/drivers/cb_pcimdda.c index bec250b..abb6008 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdda.c +++ b/drivers/staging/comedi/drivers/cb_pcimdda.c @@ -240,7 +240,7 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it) * Allocate the subdevice structures. alloc_subdevice() is a * convenient macro defined in comedidev.h. */ - if (alloc_subdevices(dev, 2) < 0) + if (comedi_alloc_subdevices(dev, 2) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/comedi_bond.c b/drivers/staging/comedi/drivers/comedi_bond.c index 29412de..d56eec4 100644 --- a/drivers/staging/comedi/drivers/comedi_bond.c +++ b/drivers/staging/comedi/drivers/comedi_bond.c @@ -362,7 +362,7 @@ static int bonding_attach(struct comedi_device *dev, * Allocate the subdevice structures. alloc_subdevice() is a * convenient macro defined in comedidev.h. */ - if (alloc_subdevices(dev, 1) < 0) + if (comedi_alloc_subdevices(dev, 1) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index bff5dcd..c9a725f 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -315,7 +315,7 @@ static int parport_attach(struct comedi_device *dev, } dev->board_name = "parport"; - ret = alloc_subdevices(dev, 4); + ret = comedi_alloc_subdevices(dev, 4); if (ret < 0) return ret; ret = alloc_private(dev, sizeof(struct parport_private)); diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c index 9f3c3d5..cd43c0d 100644 --- a/drivers/staging/comedi/drivers/comedi_test.c +++ b/drivers/staging/comedi/drivers/comedi_test.c @@ -448,7 +448,7 @@ static int waveform_attach(struct comedi_device *dev, devpriv->usec_period = period; dev->n_subdevices = 2; - if (alloc_subdevices(dev, dev->n_subdevices) < 0) + if (comedi_alloc_subdevices(dev, dev->n_subdevices) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/contec_pci_dio.c b/drivers/staging/comedi/drivers/contec_pci_dio.c index 2cd7407..a5bad1b 100644 --- a/drivers/staging/comedi/drivers/contec_pci_dio.c +++ b/drivers/staging/comedi/drivers/contec_pci_dio.c @@ -115,7 +115,7 @@ static int contec_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (alloc_private(dev, sizeof(struct contec_private)) < 0) return -ENOMEM; - if (alloc_subdevices(dev, 2) < 0) + if (comedi_alloc_subdevices(dev, 2) < 0) return -ENOMEM; for_each_pci_dev(pcidev) { diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c index d84794c..dbd0472 100644 --- a/drivers/staging/comedi/drivers/daqboard2000.c +++ b/drivers/staging/comedi/drivers/daqboard2000.c @@ -772,7 +772,7 @@ static int daqboard2000_attach(struct comedi_device *dev, if (!devpriv->plx || !devpriv->daq) return -ENOMEM; - result = alloc_subdevices(dev, 3); + result = comedi_alloc_subdevices(dev, 3); if (result < 0) goto out; diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index f99f72b..1dea21a 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -834,7 +834,7 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) dev->board_name = thisboard->name; - ret = alloc_subdevices(dev, 6); + ret = comedi_alloc_subdevices(dev, 6); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c index 6170536..6a8a7eb 100644 --- a/drivers/staging/comedi/drivers/das16.c +++ b/drivers/staging/comedi/drivers/das16.c @@ -1264,7 +1264,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) } devpriv->timer_mode = timer_mode ? 1 : 0; - ret = alloc_subdevices(dev, 5); + ret = comedi_alloc_subdevices(dev, 5); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/das16m1.c b/drivers/staging/comedi/drivers/das16m1.c index e468ff1..eafd6b5 100644 --- a/drivers/staging/comedi/drivers/das16m1.c +++ b/drivers/staging/comedi/drivers/das16m1.c @@ -646,7 +646,7 @@ static int das16m1_attach(struct comedi_device *dev, return -EINVAL; } - ret = alloc_subdevices(dev, 4); + ret = comedi_alloc_subdevices(dev, 4); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c index 079fb06..12d736a 100644 --- a/drivers/staging/comedi/drivers/das1800.c +++ b/drivers/staging/comedi/drivers/das1800.c @@ -1644,7 +1644,7 @@ static int das1800_attach(struct comedi_device *dev, return -ENOMEM; } - if (alloc_subdevices(dev, 4) < 0) + if (comedi_alloc_subdevices(dev, 4) < 0) return -ENOMEM; /* analog input subdevice */ diff --git a/drivers/staging/comedi/drivers/das6402.c b/drivers/staging/comedi/drivers/das6402.c index 881f392..2039b6c 100644 --- a/drivers/staging/comedi/drivers/das6402.c +++ b/drivers/staging/comedi/drivers/das6402.c @@ -307,7 +307,7 @@ static int das6402_attach(struct comedi_device *dev, if (ret < 0) return ret; - ret = alloc_subdevices(dev, 1); + ret = comedi_alloc_subdevices(dev, 1); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/das800.c b/drivers/staging/comedi/drivers/das800.c index 4e33b2a..6263f53 100644 --- a/drivers/staging/comedi/drivers/das800.c +++ b/drivers/staging/comedi/drivers/das800.c @@ -510,7 +510,7 @@ static int das800_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->board_name = thisboard->name; - if (alloc_subdevices(dev, 3) < 0) + if (comedi_alloc_subdevices(dev, 3) < 0) return -ENOMEM; /* analog input subdevice */ diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c index 5be99b5..40d7bef 100644 --- a/drivers/staging/comedi/drivers/dmm32at.c +++ b/drivers/staging/comedi/drivers/dmm32at.c @@ -375,7 +375,7 @@ static int dmm32at_attach(struct comedi_device *dev, * Allocate the subdevice structures. alloc_subdevice() is a * convenient macro defined in comedidev.h. */ - if (alloc_subdevices(dev, 3) < 0) + if (comedi_alloc_subdevices(dev, 3) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/dt2801.c b/drivers/staging/comedi/drivers/dt2801.c index 625bd61..35ce076 100644 --- a/drivers/staging/comedi/drivers/dt2801.c +++ b/drivers/staging/comedi/drivers/dt2801.c @@ -628,7 +628,7 @@ havetype: n_ai_chans = probe_number_of_ai_chans(dev); printk(" (ai channels = %d)", n_ai_chans); - ret = alloc_subdevices(dev, 4); + ret = comedi_alloc_subdevices(dev, 4); if (ret < 0) goto out; diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index 727da9e..6ff610d 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -465,7 +465,7 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) } #endif - ret = alloc_subdevices(dev, 4); + ret = comedi_alloc_subdevices(dev, 4); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/dt2814.c b/drivers/staging/comedi/drivers/dt2814.c index fa4ade6..876d5cb 100644 --- a/drivers/staging/comedi/drivers/dt2814.c +++ b/drivers/staging/comedi/drivers/dt2814.c @@ -338,7 +338,7 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) #endif } - ret = alloc_subdevices(dev, 1); + ret = comedi_alloc_subdevices(dev, 1); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/dt2815.c b/drivers/staging/comedi/drivers/dt2815.c index bbab712..33ad1fa 100644 --- a/drivers/staging/comedi/drivers/dt2815.c +++ b/drivers/staging/comedi/drivers/dt2815.c @@ -177,7 +177,7 @@ static int dt2815_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->iobase = iobase; dev->board_name = "dt2815"; - if (alloc_subdevices(dev, 1) < 0) + if (comedi_alloc_subdevices(dev, 1) < 0) return -ENOMEM; if (alloc_private(dev, sizeof(struct dt2815_private)) < 0) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/dt2817.c b/drivers/staging/comedi/drivers/dt2817.c index 1ee10e7b..665db07 100644 --- a/drivers/staging/comedi/drivers/dt2817.c +++ b/drivers/staging/comedi/drivers/dt2817.c @@ -137,7 +137,7 @@ static int dt2817_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->iobase = iobase; dev->board_name = "dt2817"; - ret = alloc_subdevices(dev, 1); + ret = comedi_alloc_subdevices(dev, 1); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c index eefda3c..f11d1fd 100644 --- a/drivers/staging/comedi/drivers/dt282x.c +++ b/drivers/staging/comedi/drivers/dt282x.c @@ -1268,7 +1268,7 @@ static int dt282x_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (ret < 0) return ret; - ret = alloc_subdevices(dev, 3); + ret = comedi_alloc_subdevices(dev, 3); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c index af02024..10415b2 100644 --- a/drivers/staging/comedi/drivers/dt3000.c +++ b/drivers/staging/comedi/drivers/dt3000.c @@ -882,7 +882,7 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it) } dev->irq = devpriv->pci_dev->irq; - ret = alloc_subdevices(dev, 4); + ret = comedi_alloc_subdevices(dev, 4); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/dt9812.c b/drivers/staging/comedi/drivers/dt9812.c index 22cda5c..56af2f2 100644 --- a/drivers/staging/comedi/drivers/dt9812.c +++ b/drivers/staging/comedi/drivers/dt9812.c @@ -1036,7 +1036,7 @@ static int dt9812_attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->serial = it->options[0]; /* Allocate subdevices */ - if (alloc_subdevices(dev, 4) < 0) + if (comedi_alloc_subdevices(dev, 4) < 0) return -ENOMEM; /* digital input subdevice */ diff --git a/drivers/staging/comedi/drivers/dyna_pci10xx.c b/drivers/staging/comedi/drivers/dyna_pci10xx.c index 367a7c8..6f6fb52 100644 --- a/drivers/staging/comedi/drivers/dyna_pci10xx.c +++ b/drivers/staging/comedi/drivers/dyna_pci10xx.c @@ -329,7 +329,7 @@ found: devpriv->BADR4 = pci_resource_start(pcidev, 4); devpriv->BADR5 = pci_resource_start(pcidev, 5); - if (alloc_subdevices(dev, 4) < 0) { + if (comedi_alloc_subdevices(dev, 4) < 0) { printk(KERN_ERR "comedi: dyna_pci10xx: " "failed allocating subdevices\n"); mutex_unlock(&start_stop_sem); diff --git a/drivers/staging/comedi/drivers/fl512.c b/drivers/staging/comedi/drivers/fl512.c index d2381445..7218a9b 100644 --- a/drivers/staging/comedi/drivers/fl512.c +++ b/drivers/staging/comedi/drivers/fl512.c @@ -131,7 +131,7 @@ static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it) printk(KERN_DEBUG "malloc ok\n"); #endif - if (alloc_subdevices(dev, 2) < 0) + if (comedi_alloc_subdevices(dev, 2) < 0) return -ENOMEM; /* diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c b/drivers/staging/comedi/drivers/gsc_hpdi.c index fe1fd2f..b103cfb 100644 --- a/drivers/staging/comedi/drivers/gsc_hpdi.c +++ b/drivers/staging/comedi/drivers/gsc_hpdi.c @@ -431,7 +431,7 @@ static int setup_subdevices(struct comedi_device *dev) { struct comedi_subdevice *s; - if (alloc_subdevices(dev, 1) < 0) + if (comedi_alloc_subdevices(dev, 1) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/icp_multi.c b/drivers/staging/comedi/drivers/icp_multi.c index 1f254f4..06c66af 100644 --- a/drivers/staging/comedi/drivers/icp_multi.c +++ b/drivers/staging/comedi/drivers/icp_multi.c @@ -903,7 +903,7 @@ static int icp_multi_attach(struct comedi_device *dev, if (this_board->n_ctrs) n_subdevices++; - ret = alloc_subdevices(dev, n_subdevices); + ret = comedi_alloc_subdevices(dev, n_subdevices); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/ii_pci20kc.c b/drivers/staging/comedi/drivers/ii_pci20kc.c index 6f69476..9c11657 100644 --- a/drivers/staging/comedi/drivers/ii_pci20kc.c +++ b/drivers/staging/comedi/drivers/ii_pci20kc.c @@ -202,7 +202,7 @@ static int pci20xxx_attach(struct comedi_device *dev, struct comedi_subdevice *s; union pci20xxx_subdev_private *sdp; - ret = alloc_subdevices(dev, 1 + PCI20000_MODULES); + ret = comedi_alloc_subdevices(dev, 1 + PCI20000_MODULES); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c index e8dfc36..182643b 100644 --- a/drivers/staging/comedi/drivers/jr3_pci.c +++ b/drivers/staging/comedi/drivers/jr3_pci.c @@ -826,7 +826,7 @@ static int jr3_pci_attach(struct comedi_device *dev, if (!devpriv->iobase) return -ENOMEM; - result = alloc_subdevices(dev, devpriv->n_channels); + result = comedi_alloc_subdevices(dev, devpriv->n_channels); if (result < 0) goto out; diff --git a/drivers/staging/comedi/drivers/ke_counter.c b/drivers/staging/comedi/drivers/ke_counter.c index 9f92420..bcb1eb4 100644 --- a/drivers/staging/comedi/drivers/ke_counter.c +++ b/drivers/staging/comedi/drivers/ke_counter.c @@ -190,7 +190,7 @@ found: dev->iobase = io_base; /* allocate the subdevice structures */ - error = alloc_subdevices(dev, 1); + error = comedi_alloc_subdevices(dev, 1); if (error < 0) return error; diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 09890b8..39100dd 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -2195,7 +2195,7 @@ static int me4000_attach(struct comedi_device *dev, struct comedi_devconfig *it) * convenient macro defined in comedidev.h. It relies on * n_subdevices being set correctly. */ - if (alloc_subdevices(dev, 4) < 0) + if (comedi_alloc_subdevices(dev, 4) < 0) return -ENOMEM; /*========================================================================= diff --git a/drivers/staging/comedi/drivers/me_daq.c b/drivers/staging/comedi/drivers/me_daq.c index fcadb0f..231b294 100644 --- a/drivers/staging/comedi/drivers/me_daq.c +++ b/drivers/staging/comedi/drivers/me_daq.c @@ -762,7 +762,7 @@ found: me_reset(dev); /* device driver capabilities */ - error = alloc_subdevices(dev, 3); + error = comedi_alloc_subdevices(dev, 3); if (error < 0) return error; diff --git a/drivers/staging/comedi/drivers/mpc624.c b/drivers/staging/comedi/drivers/mpc624.c index 4304e86..48ba6b9 100644 --- a/drivers/staging/comedi/drivers/mpc624.c +++ b/drivers/staging/comedi/drivers/mpc624.c @@ -349,7 +349,7 @@ static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it) } /* Subdevices structures */ - if (alloc_subdevices(dev, 1) < 0) + if (comedi_alloc_subdevices(dev, 1) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/mpc8260cpm.c b/drivers/staging/comedi/drivers/mpc8260cpm.c index 364470e..1311051 100644 --- a/drivers/staging/comedi/drivers/mpc8260cpm.c +++ b/drivers/staging/comedi/drivers/mpc8260cpm.c @@ -131,7 +131,7 @@ static int mpc8260cpm_attach(struct comedi_device *dev, if (alloc_private(dev, sizeof(struct mpc8260cpm_private)) < 0) return -ENOMEM; - if (alloc_subdevices(dev, 4) < 0) + if (comedi_alloc_subdevices(dev, 4) < 0) return -ENOMEM; for (i = 0; i < 4; i++) { diff --git a/drivers/staging/comedi/drivers/multiq3.c b/drivers/staging/comedi/drivers/multiq3.c index e951e73..00d497c 100644 --- a/drivers/staging/comedi/drivers/multiq3.c +++ b/drivers/staging/comedi/drivers/multiq3.c @@ -255,7 +255,7 @@ static int multiq3_attach(struct comedi_device *dev, else printk(KERN_WARNING "comedi%d: no irq\n", dev->minor); dev->board_name = "multiq3"; - result = alloc_subdevices(dev, 5); + result = comedi_alloc_subdevices(dev, 5); if (result < 0) return result; diff --git a/drivers/staging/comedi/drivers/ni_6527.c b/drivers/staging/comedi/drivers/ni_6527.c index b02aa0e..89fee6f 100644 --- a/drivers/staging/comedi/drivers/ni_6527.c +++ b/drivers/staging/comedi/drivers/ni_6527.c @@ -397,7 +397,7 @@ static int ni6527_attach(struct comedi_device *dev, struct comedi_devconfig *it) printk(KERN_INFO "comedi board: %s, ID=0x%02x\n", dev->board_name, readb(devpriv->mite->daq_io_addr + ID_Register)); - ret = alloc_subdevices(dev, 3); + ret = comedi_alloc_subdevices(dev, 3); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index 0d27a93..a49dcea 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -678,7 +678,7 @@ static int ni_65xx_attach(struct comedi_device *dev, printk(KERN_INFO " ID=0x%02x", readb(private(dev)->mite->daq_io_addr + ID_Register)); - ret = alloc_subdevices(dev, 4); + ret = comedi_alloc_subdevices(dev, 4); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 8c40730..5827deb 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -1095,7 +1095,7 @@ static int ni_660x_attach(struct comedi_device *dev, dev->n_subdevices = 2 + NI_660X_MAX_NUM_COUNTERS; - if (alloc_subdevices(dev, dev->n_subdevices) < 0) + if (comedi_alloc_subdevices(dev, dev->n_subdevices) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index a9cf94f..45a03e6 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -202,7 +202,7 @@ static int ni_670x_attach(struct comedi_device *dev, dev->irq = mite_irq(devpriv->mite); printk(KERN_INFO " %s", dev->board_name); - if (alloc_subdevices(dev, 2) < 0) + if (comedi_alloc_subdevices(dev, 2) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/ni_at_a2150.c b/drivers/staging/comedi/drivers/ni_at_a2150.c index ae896a0..9d1a0f7 100644 --- a/drivers/staging/comedi/drivers/ni_at_a2150.c +++ b/drivers/staging/comedi/drivers/ni_at_a2150.c @@ -826,7 +826,7 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->board_ptr = a2150_boards + a2150_probe(dev); dev->board_name = thisboard->name; - if (alloc_subdevices(dev, 1) < 0) + if (comedi_alloc_subdevices(dev, 1) < 0) return -ENOMEM; /* analog input subdevice */ diff --git a/drivers/staging/comedi/drivers/ni_at_ao.c b/drivers/staging/comedi/drivers/ni_at_ao.c index bfe7fb7..03a4d73 100644 --- a/drivers/staging/comedi/drivers/ni_at_ao.c +++ b/drivers/staging/comedi/drivers/ni_at_ao.c @@ -356,7 +356,7 @@ static int atao_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (alloc_private(dev, sizeof(struct atao_private)) < 0) return -ENOMEM; - if (alloc_subdevices(dev, 4) < 0) + if (comedi_alloc_subdevices(dev, 4) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/ni_atmio16d.c b/drivers/staging/comedi/drivers/ni_atmio16d.c index a0890ee..37ff6fc 100644 --- a/drivers/staging/comedi/drivers/ni_atmio16d.c +++ b/drivers/staging/comedi/drivers/ni_atmio16d.c @@ -709,7 +709,7 @@ static int atmio16d_attach(struct comedi_device *dev, dev->board_name = board->name; - ret = alloc_subdevices(dev, 4); + ret = comedi_alloc_subdevices(dev, 4); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 75764e8..8860207 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -409,7 +409,7 @@ static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->board_name = thisboard->name; - if (alloc_subdevices(dev, 1) < 0) + if (comedi_alloc_subdevices(dev, 1) < 0) return -ENOMEM; /* DAQCard-700 dio */ diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c index 493a227..36c0c62 100644 --- a/drivers/staging/comedi/drivers/ni_daq_dio24.c +++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c @@ -158,7 +158,7 @@ static int dio24_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->board_name = thisboard->name; - if (alloc_subdevices(dev, 1) < 0) + if (comedi_alloc_subdevices(dev, 1) < 0) return -ENOMEM; /* 8255 dio */ diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c index 1d739b2..a92570f5 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.c +++ b/drivers/staging/comedi/drivers/ni_labpc.c @@ -622,7 +622,7 @@ int labpc_common_attach(struct comedi_device *dev, unsigned long iobase, dev->board_name = thisboard->name; - if (alloc_subdevices(dev, 5) < 0) + if (comedi_alloc_subdevices(dev, 5) < 0) return -ENOMEM; /* analog input subdevice */ diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index fd232bc..4261e92 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -4412,7 +4412,7 @@ static int ni_E_init(struct comedi_device *dev, struct comedi_devconfig *it) return -EINVAL; } - if (alloc_subdevices(dev, NI_NUM_SUBDEVICES) < 0) + if (comedi_alloc_subdevices(dev, NI_NUM_SUBDEVICES) < 0) return -ENOMEM; /* analog input subdevice */ diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c index 37b7008..77ef312 100644 --- a/drivers/staging/comedi/drivers/ni_pcidio.c +++ b/drivers/staging/comedi/drivers/ni_pcidio.c @@ -1248,7 +1248,7 @@ static int nidio_attach(struct comedi_device *dev, struct comedi_devconfig *it) else n_subdevices = 1; - ret = alloc_subdevices(dev, n_subdevices); + ret = comedi_alloc_subdevices(dev, n_subdevices); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/pcl711.c b/drivers/staging/comedi/drivers/pcl711.c index e943b52..35b9510 100644 --- a/drivers/staging/comedi/drivers/pcl711.c +++ b/drivers/staging/comedi/drivers/pcl711.c @@ -518,7 +518,7 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it) } dev->irq = irq; - ret = alloc_subdevices(dev, 4); + ret = comedi_alloc_subdevices(dev, 4); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/pcl724.c b/drivers/staging/comedi/drivers/pcl724.c index 4136a03..698c900 100644 --- a/drivers/staging/comedi/drivers/pcl724.c +++ b/drivers/staging/comedi/drivers/pcl724.c @@ -156,7 +156,7 @@ static int pcl724_attach(struct comedi_device *dev, struct comedi_devconfig *it) || (it->options[1] == 96))) n_subdevices = 4; /* PCL-724 in 96 DIO configuration */ - ret = alloc_subdevices(dev, n_subdevices); + ret = comedi_alloc_subdevices(dev, n_subdevices); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/pcl725.c b/drivers/staging/comedi/drivers/pcl725.c index 83a6fa5..d7ba336 100644 --- a/drivers/staging/comedi/drivers/pcl725.c +++ b/drivers/staging/comedi/drivers/pcl725.c @@ -63,7 +63,7 @@ static int pcl725_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->iobase = iobase; dev->irq = 0; - if (alloc_subdevices(dev, 2) < 0) + if (comedi_alloc_subdevices(dev, 2) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/pcl726.c b/drivers/staging/comedi/drivers/pcl726.c index e9449bb..e756a303 100644 --- a/drivers/staging/comedi/drivers/pcl726.c +++ b/drivers/staging/comedi/drivers/pcl726.c @@ -292,7 +292,7 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it) printk("\n"); - ret = alloc_subdevices(dev, 3); + ret = comedi_alloc_subdevices(dev, 3); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/pcl730.c b/drivers/staging/comedi/drivers/pcl730.c index 02a4386..e258bce 100644 --- a/drivers/staging/comedi/drivers/pcl730.c +++ b/drivers/staging/comedi/drivers/pcl730.c @@ -85,7 +85,7 @@ static int pcl730_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->iobase = iobase; dev->irq = 0; - if (alloc_subdevices(dev, 4) < 0) + if (comedi_alloc_subdevices(dev, 4) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/pcl812.c b/drivers/staging/comedi/drivers/pcl812.c index 28780ed..128f5b6 100644 --- a/drivers/staging/comedi/drivers/pcl812.c +++ b/drivers/staging/comedi/drivers/pcl812.c @@ -1382,7 +1382,7 @@ no_dma: if (board->n_dochan > 0) n_subdevices++; - ret = alloc_subdevices(dev, n_subdevices); + ret = comedi_alloc_subdevices(dev, n_subdevices); if (ret < 0) { free_resources(dev); return ret; diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c index 845039c..37cedbc 100644 --- a/drivers/staging/comedi/drivers/pcl816.c +++ b/drivers/staging/comedi/drivers/pcl816.c @@ -1194,7 +1194,7 @@ no_dma: subdevs[3] = COMEDI_SUBD_DO; */ - ret = alloc_subdevices(dev, 1); + ret = comedi_alloc_subdevices(dev, 1); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c index 6c84b29..a4c2870 100644 --- a/drivers/staging/comedi/drivers/pcl818.c +++ b/drivers/staging/comedi/drivers/pcl818.c @@ -1778,7 +1778,7 @@ no_rtc: no_dma: - ret = alloc_subdevices(dev, 4); + ret = comedi_alloc_subdevices(dev, 4); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/pcm3724.c b/drivers/staging/comedi/drivers/pcm3724.c index 9eee708..d755b40 100644 --- a/drivers/staging/comedi/drivers/pcm3724.c +++ b/drivers/staging/comedi/drivers/pcm3724.c @@ -258,7 +258,7 @@ static int pcm3724_attach(struct comedi_device *dev, n_subdevices = board->numofports; - ret = alloc_subdevices(dev, n_subdevices); + ret = comedi_alloc_subdevices(dev, n_subdevices); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/pcm3730.c b/drivers/staging/comedi/drivers/pcm3730.c index f8d1c64..48a21bd 100644 --- a/drivers/staging/comedi/drivers/pcm3730.c +++ b/drivers/staging/comedi/drivers/pcm3730.c @@ -71,7 +71,7 @@ static int pcm3730_attach(struct comedi_device *dev, dev->iobase = dev->iobase; dev->irq = 0; - if (alloc_subdevices(dev, 6) < 0) + if (comedi_alloc_subdevices(dev, 6) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/pcmad.c b/drivers/staging/comedi/drivers/pcmad.c index 2ec0b2e..00b0f2a 100644 --- a/drivers/staging/comedi/drivers/pcmad.c +++ b/drivers/staging/comedi/drivers/pcmad.c @@ -117,7 +117,7 @@ static int pcmad_attach(struct comedi_device *dev, struct comedi_devconfig *it) printk(KERN_CONT "\n"); dev->iobase = iobase; - ret = alloc_subdevices(dev, 1); + ret = comedi_alloc_subdevices(dev, 1); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/pcmda12.c b/drivers/staging/comedi/drivers/pcmda12.c index f49c66a..3645e9e 100644 --- a/drivers/staging/comedi/drivers/pcmda12.c +++ b/drivers/staging/comedi/drivers/pcmda12.c @@ -197,7 +197,7 @@ static int pcmda12_attach(struct comedi_device *dev, * Allocate 2 subdevs (32 + 16 DIO lines) or 3 32 DIO subdevs for the * 96-channel version of the board. */ - if (alloc_subdevices(dev, 1) < 0) { + if (comedi_alloc_subdevices(dev, 1) < 0) { printk(KERN_ERR "cannot allocate subdevice data structures\n"); return -ENOMEM; } diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c index c4482ae..67fdac5 100644 --- a/drivers/staging/comedi/drivers/pcmmio.c +++ b/drivers/staging/comedi/drivers/pcmmio.c @@ -1077,7 +1077,7 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) * * Allocate 1 AI + 1 AO + 2 DIO subdevs (24 lines per DIO) */ - if (alloc_subdevices(dev, n_subdevs) < 0) { + if (comedi_alloc_subdevices(dev, n_subdevs) < 0) { printk(KERN_ERR "comedi%d: cannot allocate subdevice data structures\n", dev->minor); return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/pcmuio.c b/drivers/staging/comedi/drivers/pcmuio.c index b1a9bed..ce5068e 100644 --- a/drivers/staging/comedi/drivers/pcmuio.c +++ b/drivers/staging/comedi/drivers/pcmuio.c @@ -807,7 +807,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) * Allocate 2 subdevs (32 + 16 DIO lines) or 3 32 DIO subdevs for the * 96-channel version of the board. */ - if (alloc_subdevices(dev, n_subdevs) < 0) { + if (comedi_alloc_subdevices(dev, n_subdevs) < 0) { dev_dbg(dev->hw_dev, "cannot allocate subdevice data structures\n"); return -ENOMEM; } diff --git a/drivers/staging/comedi/drivers/poc.c b/drivers/staging/comedi/drivers/poc.c index 95e348f..1e954f9 100644 --- a/drivers/staging/comedi/drivers/poc.c +++ b/drivers/staging/comedi/drivers/poc.c @@ -160,7 +160,7 @@ static int poc_attach(struct comedi_device *dev, struct comedi_devconfig *it) } dev->iobase = iobase; - if (alloc_subdevices(dev, 1) < 0) + if (comedi_alloc_subdevices(dev, 1) < 0) return -ENOMEM; if (alloc_private(dev, sizeof(unsigned int) * board->n_chan) < 0) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index 2f130b3..38a13ba 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -871,7 +871,7 @@ static int daqp_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->iobase = local->link->resource[0]->start; - ret = alloc_subdevices(dev, 4); + ret = comedi_alloc_subdevices(dev, 4); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 84b28b6..7d248a7 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -2003,7 +2003,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) * Allocate the subdevice structures. alloc_subdevice() is a * convenient macro defined in comedidev.h. */ - if (alloc_subdevices(dev, 4) < 0) + if (comedi_alloc_subdevices(dev, 4) < 0) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/rti800.c b/drivers/staging/comedi/drivers/rti800.c index 04a2368..a80f630 100644 --- a/drivers/staging/comedi/drivers/rti800.c +++ b/drivers/staging/comedi/drivers/rti800.c @@ -348,7 +348,7 @@ static int rti800_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->board_name = board->name; - ret = alloc_subdevices(dev, 4); + ret = comedi_alloc_subdevices(dev, 4); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/rti802.c b/drivers/staging/comedi/drivers/rti802.c index 09da5c2..1aacf3f 100644 --- a/drivers/staging/comedi/drivers/rti802.c +++ b/drivers/staging/comedi/drivers/rti802.c @@ -103,7 +103,7 @@ static int rti802_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->board_name = "rti802"; - if (alloc_subdevices(dev, 1) < 0 + if (comedi_alloc_subdevices(dev, 1) < 0 || alloc_private(dev, sizeof(struct rti802_private))) { return -ENOMEM; } diff --git a/drivers/staging/comedi/drivers/s526.c b/drivers/staging/comedi/drivers/s526.c index 3c8e979..17d581b 100644 --- a/drivers/staging/comedi/drivers/s526.c +++ b/drivers/staging/comedi/drivers/s526.c @@ -779,7 +779,7 @@ static int s526_attach(struct comedi_device *dev, struct comedi_devconfig *it) * convenient macro defined in comedidev.h. */ dev->n_subdevices = 4; - if (alloc_subdevices(dev, dev->n_subdevices) < 0) + if (comedi_alloc_subdevices(dev, dev->n_subdevices) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index d6dc338..f2eeca5 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -595,7 +595,7 @@ static int s626_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->board_ptr = s626_boards; dev->board_name = thisboard->name; - if (alloc_subdevices(dev, 6) < 0) + if (comedi_alloc_subdevices(dev, 6) < 0) return -ENOMEM; dev->iobase = (unsigned long)devpriv->base_addr; diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c index c25808c..dc41c04 100644 --- a/drivers/staging/comedi/drivers/serial2002.c +++ b/drivers/staging/comedi/drivers/serial2002.c @@ -792,7 +792,7 @@ static int serial2002_attach(struct comedi_device *dev, dev_dbg(dev->hw_dev, "/dev/ttyS%d @ %d\n", devpriv->port, devpriv->speed); - if (alloc_subdevices(dev, 5) < 0) + if (comedi_alloc_subdevices(dev, 5) < 0) return -ENOMEM; /* digital input subdevice */ diff --git a/drivers/staging/comedi/drivers/skel.c b/drivers/staging/comedi/drivers/skel.c index 7d13ffa..16947c8 100644 --- a/drivers/staging/comedi/drivers/skel.c +++ b/drivers/staging/comedi/drivers/skel.c @@ -237,7 +237,7 @@ static int skel_attach(struct comedi_device *dev, struct comedi_devconfig *it) * Allocate the subdevice structures. alloc_subdevice() is a * convenient macro defined in comedidev.h. */ - if (alloc_subdevices(dev, 3) < 0) + if (comedi_alloc_subdevices(dev, 3) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/ssv_dnp.c b/drivers/staging/comedi/drivers/ssv_dnp.c index de58095..5eaef84 100644 --- a/drivers/staging/comedi/drivers/ssv_dnp.c +++ b/drivers/staging/comedi/drivers/ssv_dnp.c @@ -200,7 +200,7 @@ static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Allocate the subdevice structures. alloc_subdevice() is a */ /* convenient macro defined in comedidev.h. */ - if (alloc_subdevices(dev, 1) < 0) + if (comedi_alloc_subdevices(dev, 1) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/unioxx5.c b/drivers/staging/comedi/drivers/unioxx5.c index d5f1f22..170bc48 100644 --- a/drivers/staging/comedi/drivers/unioxx5.c +++ b/drivers/staging/comedi/drivers/unioxx5.c @@ -468,7 +468,7 @@ static int unioxx5_attach(struct comedi_device *dev, return -1; } - if (alloc_subdevices(dev, n_subd) < 0) { + if (comedi_alloc_subdevices(dev, n_subd) < 0) { printk(KERN_ERR "out of memory\n"); return -ENOMEM; } diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 13d9fd3..ca8b3e1 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -2645,7 +2645,7 @@ static int usbdux_attach_common(struct comedi_device *dev, } /* allocate space for the subdevices */ - ret = alloc_subdevices(dev, dev->n_subdevices); + ret = comedi_alloc_subdevices(dev, dev->n_subdevices); if (ret < 0) { dev_err(&udev->interface->dev, "comedi%d: error alloc space for subdev\n", dev->minor); diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index 7b1d21a..b2f7350 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c @@ -1675,7 +1675,7 @@ static int usbduxfast_attach(struct comedi_device *dev, dev->n_subdevices = N_SUBDEVICES; /* allocate space for the subdevices */ - ret = alloc_subdevices(dev, N_SUBDEVICES); + ret = comedi_alloc_subdevices(dev, N_SUBDEVICES); if (ret < 0) { printk(KERN_ERR "comedi%d: usbduxfast: error alloc space for " "subdev\n", dev->minor); diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index 441ccef..00faf4a 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -2690,7 +2690,7 @@ static int usbduxsigma_attach(struct comedi_device *dev, } /* allocate space for the subdevices */ - ret = alloc_subdevices(dev, dev->n_subdevices); + ret = comedi_alloc_subdevices(dev, dev->n_subdevices); if (ret < 0) { dev_err(&udev->interface->dev, "comedi%d: no space for subdev\n", dev->minor); diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c index baee8d7..5a3e33d 100644 --- a/drivers/staging/comedi/drivers/vmk80xx.c +++ b/drivers/staging/comedi/drivers/vmk80xx.c @@ -1159,7 +1159,7 @@ static int vmk80xx_attach(struct comedi_device *cdev, else n_subd = 6; - if (alloc_subdevices(cdev, n_subd) < 0) { + if (comedi_alloc_subdevices(cdev, n_subd) < 0) { up(&dev->limit_sem); mutex_unlock(&glb_mutex); return -ENOMEM; -- cgit v0.10.2 From c810a399798022d545191e2daaca0368623c15d3 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Tue, 5 Jun 2012 16:40:10 +0530 Subject: staging: Android: Fix some checkpatch warnings Warnings reported by checkpatch.pl have been fixed. Cc: Brian Swetland Signed-off-by: Sachin Kamat Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index e84dbec..69cf2db 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -16,6 +16,8 @@ ** GNU General Public License for more details. */ +#define pr_fmt(fmt) "ashmem: " fmt + #include #include #include @@ -707,7 +709,7 @@ static int __init ashmem_init(void) sizeof(struct ashmem_area), 0, 0, NULL); if (unlikely(!ashmem_area_cachep)) { - printk(KERN_ERR "ashmem: failed to create slab cache\n"); + pr_err("failed to create slab cache\n"); return -ENOMEM; } @@ -715,19 +717,19 @@ static int __init ashmem_init(void) sizeof(struct ashmem_range), 0, 0, NULL); if (unlikely(!ashmem_range_cachep)) { - printk(KERN_ERR "ashmem: failed to create slab cache\n"); + pr_err("failed to create slab cache\n"); return -ENOMEM; } ret = misc_register(&ashmem_misc); if (unlikely(ret)) { - printk(KERN_ERR "ashmem: failed to register misc device!\n"); + pr_err("failed to register misc device!\n"); return ret; } register_shrinker(&ashmem_shrinker); - printk(KERN_INFO "ashmem: initialized\n"); + pr_info("initialized\n"); return 0; } @@ -740,12 +742,12 @@ static void __exit ashmem_exit(void) ret = misc_deregister(&ashmem_misc); if (unlikely(ret)) - printk(KERN_ERR "ashmem: failed to unregister misc device!\n"); + pr_err("failed to unregister misc device!\n"); kmem_cache_destroy(ashmem_range_cachep); kmem_cache_destroy(ashmem_area_cachep); - printk(KERN_INFO "ashmem: unloaded\n"); + pr_info("unloaded\n"); } module_init(ashmem_init); diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c index b2e71c6..f7b8237 100644 --- a/drivers/staging/android/logger.c +++ b/drivers/staging/android/logger.c @@ -17,6 +17,8 @@ * GNU General Public License for more details. */ +#define pr_fmt(fmt) "logger: " fmt + #include #include #include @@ -621,13 +623,13 @@ static int __init create_log(char *log_name, int size) /* finally, initialize the misc device for this log */ ret = misc_register(&log->misc); if (unlikely(ret)) { - printk(KERN_ERR "logger: failed to register misc " - "device for log '%s'!\n", log->misc.name); + pr_err("failed to register misc device for log '%s'!\n", + log->misc.name); goto out_free_log; } - printk(KERN_INFO "logger: created %luK log '%s'\n", - (unsigned long) log->size >> 10, log->misc.name); + pr_info("created %luK log '%s'\n", + (unsigned long) log->size >> 10, log->misc.name); return 0; diff --git a/drivers/staging/android/ram_console.c b/drivers/staging/android/ram_console.c index 82323bb..7add022 100644 --- a/drivers/staging/android/ram_console.c +++ b/drivers/staging/android/ram_console.c @@ -13,6 +13,8 @@ * */ +#define pr_fmt(fmt) "ram_console: " fmt + #include #include #include @@ -162,7 +164,7 @@ static int __init ram_console_late_init(void) entry = create_proc_entry("last_kmsg", S_IFREG | S_IRUGO, NULL); if (!entry) { - printk(KERN_ERR "ram_console: failed to create proc entry\n"); + pr_err("failed to create proc entry\n"); persistent_ram_free_old(prz); return 0; } diff --git a/drivers/staging/android/timed_output.c b/drivers/staging/android/timed_output.c index 38d930c..ec9e2ae 100644 --- a/drivers/staging/android/timed_output.c +++ b/drivers/staging/android/timed_output.c @@ -14,6 +14,8 @@ * */ +#define pr_fmt(fmt) "timed_output: " fmt + #include #include #include @@ -90,7 +92,7 @@ int timed_output_dev_register(struct timed_output_dev *tdev) err_create_file: device_destroy(timed_output_class, MKDEV(0, tdev->index)); - printk(KERN_ERR "timed_output: Failed to register driver %s\n", + pr_err("failed to register driver %s\n", tdev->name); return ret; -- cgit v0.10.2 From 592314e9e1c0057bdb75ff00cbd1c51aa06c65e7 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Tue, 5 Jun 2012 15:05:13 +0530 Subject: staging: Android: Fix NULL pointer related warning in alarm-dev.c file Fixes the following sparse warning: drivers/staging/android/alarm-dev.c:259:35: warning: Using plain integer as NULL pointer Cc: Brian Swetland Signed-off-by: Sachin Kamat Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/android/alarm-dev.c b/drivers/staging/android/alarm-dev.c index 32614d6..c2d87c5 100644 --- a/drivers/staging/android/alarm-dev.c +++ b/drivers/staging/android/alarm-dev.c @@ -255,7 +255,7 @@ static int alarm_release(struct inode *inode, struct file *file) unsigned long flags; spin_lock_irqsave(&alarm_slock, flags); - if (file->private_data != 0) { + if (file->private_data) { for (i = 0; i < ANDROID_ALARM_TYPE_COUNT; i++) { uint32_t alarm_type_mask = 1U << i; if (alarm_enabled & alarm_type_mask) { -- cgit v0.10.2 From 0c16ae762990660c4dfd7515e3d46b4249f535f0 Mon Sep 17 00:00:00 2001 From: Ben Chan Date: Tue, 12 Jun 2012 11:23:32 -0700 Subject: staging: gdm72xx: Simplify spinlock fix for gdm_usb_send_complete This patch simplifies the previous patch (commit dd13c86b0dae86efdde98119ffd7348e80719ade) for fixing the spinlock recursion issue on several call sites of gdm_usb_send_complete. Signed-off-by: Ben Chan Cc: Sage Ahn Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/gdm72xx/gdm_usb.c b/drivers/staging/gdm72xx/gdm_usb.c index 646e0ac..89268c7 100644 --- a/drivers/staging/gdm72xx/gdm_usb.c +++ b/drivers/staging/gdm72xx/gdm_usb.c @@ -270,21 +270,17 @@ static void release_usb(struct usbwm_dev *udev) } } -static void gdm_usb_send_complete_impl(struct urb *urb, bool need_lock) +static void __gdm_usb_send_complete(struct urb *urb) { struct usb_tx *t = urb->context; struct tx_cxt *tx = t->tx_cxt; u8 *pkt = t->buf; u16 cmd_evt; - unsigned long flags; /* Completion by usb_unlink_urb */ if (urb->status == -ECONNRESET) return; - if (need_lock) - spin_lock_irqsave(&tx->lock, flags); - if (t->callback) t->callback(t->cb_data); @@ -296,19 +292,17 @@ static void gdm_usb_send_complete_impl(struct urb *urb, bool need_lock) put_tx_struct(tx, t); else free_tx_struct(t); - - if (need_lock) - spin_unlock_irqrestore(&tx->lock, flags); } static void gdm_usb_send_complete(struct urb *urb) { - gdm_usb_send_complete_impl(urb, true); -} + struct usb_tx *t = urb->context; + struct tx_cxt *tx = t->tx_cxt; + unsigned long flags; -static void gdm_usb_send_complete_no_lock(struct urb *urb) -{ - gdm_usb_send_complete_impl(urb, false); + spin_lock_irqsave(&tx->lock, flags); + __gdm_usb_send_complete(urb); + spin_unlock_irqrestore(&tx->lock, flags); } static int gdm_usb_send(void *priv_dev, void *data, int len, @@ -423,7 +417,7 @@ out: send_fail: t->callback = NULL; - gdm_usb_send_complete_no_lock(t->urb); + __gdm_usb_send_complete(t->urb); spin_unlock_irqrestore(&tx->lock, flags); return ret; } @@ -552,7 +546,7 @@ static void do_pm_control(struct work_struct *work) if (ret) { t->callback = NULL; - gdm_usb_send_complete_no_lock(t->urb); + __gdm_usb_send_complete(t->urb); } } } @@ -754,7 +748,7 @@ static int k_mode_thread(void *arg) if (ret) { t->callback = NULL; - gdm_usb_send_complete_no_lock(t->urb); + __gdm_usb_send_complete(t->urb); } } -- cgit v0.10.2 From 8b9ba6e5efc3213f384cda155861a4f7ae903365 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 12 Jun 2012 11:57:27 -0700 Subject: staging: comedi: change type of num_subdevices parameter to comedi_alloc_subdevices The n_subdevices variable of struct comedi_device is an int type. Change the type of the comedi_alloc_subdevices 'num_subdevices' from an unsigned int to an int to match it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index bb98f82..e0f3915 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -292,7 +292,7 @@ static inline struct comedi_subdevice *comedi_get_write_subdevice( return info->device->write_subdev; } -int comedi_alloc_subdevices(struct comedi_device *, unsigned int); +int comedi_alloc_subdevices(struct comedi_device *, int); void comedi_device_detach(struct comedi_device *dev); int comedi_device_attach(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 5413647..979aa0e 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -56,10 +56,9 @@ static int poll_invalid(struct comedi_device *dev, struct comedi_subdevice *s); struct comedi_driver *comedi_drivers; -int comedi_alloc_subdevices(struct comedi_device *dev, - unsigned int num_subdevices) +int comedi_alloc_subdevices(struct comedi_device *dev, int num_subdevices) { - unsigned i; + int i; dev->n_subdevices = num_subdevices; dev->subdevices = -- cgit v0.10.2 From 7f801c41714729f7741a042de839918be2bb56f0 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 12 Jun 2012 11:57:45 -0700 Subject: staging: comedi: sanity check num_subdevices parameter in comedi_alloc_subdevices It's possible for a couple of the comedi drivers to incorrectly call comedi_alloc_subdevices with num_subdevices = 0. Add a sanity check before doing the kcalloc. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 979aa0e..61161ce 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -60,6 +60,8 @@ int comedi_alloc_subdevices(struct comedi_device *dev, int num_subdevices) { int i; + if (num_subdevices < 1) + return -EINVAL; dev->n_subdevices = num_subdevices; dev->subdevices = kcalloc(num_subdevices, sizeof(struct comedi_subdevice), -- cgit v0.10.2 From fba1d0faf726b442ab8771d5e9fbaf5f5a4c624c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 12 Jun 2012 11:58:27 -0700 Subject: staging: comedi: only set dev->n_subdevices when kcalloc succeedes It's possible for the kcalloc in comedi_alloc_subdevices to fail. Only set the dev->n_subdevices variable if the allocation is successful. Since the core sets dev->n_subdevices, remove all the places in the drivers where this variable was getting set. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 61161ce..ecad228 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -62,12 +62,12 @@ int comedi_alloc_subdevices(struct comedi_device *dev, int num_subdevices) if (num_subdevices < 1) return -EINVAL; - dev->n_subdevices = num_subdevices; dev->subdevices = kcalloc(num_subdevices, sizeof(struct comedi_subdevice), GFP_KERNEL); if (!dev->subdevices) return -ENOMEM; + dev->n_subdevices = num_subdevices; for (i = 0; i < num_subdevices; ++i) { dev->subdevices[i].device = dev; dev->subdevices[i].async_dma_dir = DMA_NONE; diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c index cd43c0d..004da30 100644 --- a/drivers/staging/comedi/drivers/comedi_test.c +++ b/drivers/staging/comedi/drivers/comedi_test.c @@ -447,8 +447,7 @@ static int waveform_attach(struct comedi_device *dev, devpriv->uvolt_amplitude = amplitude; devpriv->usec_period = period; - dev->n_subdevices = 2; - if (comedi_alloc_subdevices(dev, dev->n_subdevices) < 0) + if (comedi_alloc_subdevices(dev, 2) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 5827deb..8c6a6ba 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -1093,9 +1093,7 @@ static int ni_660x_attach(struct comedi_device *dev, printk(KERN_INFO " %s ", dev->board_name); - dev->n_subdevices = 2 + NI_660X_MAX_NUM_COUNTERS; - - if (comedi_alloc_subdevices(dev, dev->n_subdevices) < 0) + if (comedi_alloc_subdevices(dev, 2 + NI_660X_MAX_NUM_COUNTERS) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/s526.c b/drivers/staging/comedi/drivers/s526.c index 17d581b..dbbff70 100644 --- a/drivers/staging/comedi/drivers/s526.c +++ b/drivers/staging/comedi/drivers/s526.c @@ -778,8 +778,7 @@ static int s526_attach(struct comedi_device *dev, struct comedi_devconfig *it) * Allocate the subdevice structures. alloc_subdevice() is a * convenient macro defined in comedidev.h. */ - dev->n_subdevices = 4; - if (comedi_alloc_subdevices(dev, dev->n_subdevices) < 0) + if (comedi_alloc_subdevices(dev, 4) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index ca8b3e1..3819663 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -2624,6 +2624,7 @@ static int usbdux_attach_common(struct comedi_device *dev, { int ret; struct comedi_subdevice *s = NULL; + int n_subdevs; down(&udev->sem); /* pointer back to the corresponding comedi device */ @@ -2638,14 +2639,14 @@ static int usbdux_attach_common(struct comedi_device *dev, /* set number of subdevices */ if (udev->high_speed) { /* with pwm */ - dev->n_subdevices = 5; + n_subdevs = 5; } else { /* without pwm */ - dev->n_subdevices = 4; + n_subdevs = 4; } /* allocate space for the subdevices */ - ret = comedi_alloc_subdevices(dev, dev->n_subdevices); + ret = comedi_alloc_subdevices(dev, n_subdevs); if (ret < 0) { dev_err(&udev->interface->dev, "comedi%d: error alloc space for subdev\n", dev->minor); diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index b2f7350..262556e 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c @@ -127,11 +127,6 @@ #define NUMUSBDUXFAST 16 /* - * number of subdevices - */ -#define N_SUBDEVICES 1 - -/* * analogue in subdevice */ #define SUBDEV_AD 0 @@ -1671,11 +1666,8 @@ static int usbduxfast_attach(struct comedi_device *dev, dev->board_name = BOARDNAME; - /* set number of subdevices */ - dev->n_subdevices = N_SUBDEVICES; - /* allocate space for the subdevices */ - ret = comedi_alloc_subdevices(dev, N_SUBDEVICES); + ret = comedi_alloc_subdevices(dev, 1); if (ret < 0) { printk(KERN_ERR "comedi%d: usbduxfast: error alloc space for " "subdev\n", dev->minor); diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index 00faf4a..87c613e 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -2642,6 +2642,7 @@ static int usbduxsigma_attach(struct comedi_device *dev, int index; int i; struct usbduxsub *udev; + int n_subdevs; int offset; @@ -2683,14 +2684,14 @@ static int usbduxsigma_attach(struct comedi_device *dev, /* set number of subdevices */ if (udev->high_speed) { /* with pwm */ - dev->n_subdevices = 4; + n_subdevs = 4; } else { /* without pwm */ - dev->n_subdevices = 3; + n_subdevs = 3; } /* allocate space for the subdevices */ - ret = comedi_alloc_subdevices(dev, dev->n_subdevices); + ret = comedi_alloc_subdevices(dev, n_subdevs); if (ret < 0) { dev_err(&udev->interface->dev, "comedi%d: no space for subdev\n", dev->minor); -- cgit v0.10.2 From 0e4039f3112326d73f66b00fd18468a3804ed29e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 12 Jun 2012 11:58:45 -0700 Subject: staging: comedi: remove the comed_alloc_subdevices "allocation failed" messages Remove all the "allocation failed" debug messages that are displayed when the comedi_alloc_subdevices call fails. Signed-off-by: H Hartley Sweeten Cc: Ian Abbot Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index 875b020..64b0054 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -389,12 +389,8 @@ static int dev_8255_attach(struct comedi_device *dev, } ret = comedi_alloc_subdevices(dev, i); - if (ret < 0) { - /* FIXME this printk call should give a proper message, the - * below line just maintains previous functionality */ - printk("comedi%d: 8255:", dev->minor); + if (ret < 0) return ret; - } printk(KERN_INFO "comedi%d: 8255:", dev->minor); diff --git a/drivers/staging/comedi/drivers/adv_pci1723.c b/drivers/staging/comedi/drivers/adv_pci1723.c index 0aa0af4..c14ad35 100644 --- a/drivers/staging/comedi/drivers/adv_pci1723.c +++ b/drivers/staging/comedi/drivers/adv_pci1723.c @@ -366,10 +366,8 @@ static int pci1723_attach(struct comedi_device *dev, n_subdevices++; ret = comedi_alloc_subdevices(dev, n_subdevices); - if (ret < 0) { - printk(" - Allocation failed!\n"); + if (ret < 0) return ret; - } pci1723_reset(dev); subdev = 0; diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index d7d056e..17d3489 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -1274,10 +1274,8 @@ static int dio200_common_attach(struct comedi_device *dev, unsigned long iobase, dev->iobase = iobase; dev->board_name = thisboard->name; ret = comedi_alloc_subdevices(dev, layout->n_subdevs); - if (ret < 0) { - dev_err(dev->class_dev, "error! out of memory!\n"); + if (ret < 0) return ret; - } for (n = 0; n < dev->n_subdevices; n++) { s = &dev->subdevices[n]; switch (layout->sdtype[n]) { diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c index 522e1c0..6205985 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236.c +++ b/drivers/staging/comedi/drivers/amplc_pc236.c @@ -456,10 +456,8 @@ static int pc236_common_attach(struct comedi_device *dev, unsigned long iobase, dev->iobase = iobase; ret = comedi_alloc_subdevices(dev, 2); - if (ret < 0) { - dev_err(dev->class_dev, "error! out of memory!\n"); + if (ret < 0) return ret; - } s = dev->subdevices + 0; /* digital i/o subdevice (8255) */ diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index cfb69fa..f1d68df 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c @@ -228,10 +228,8 @@ static int pc263_common_attach(struct comedi_device *dev, unsigned long iobase) dev->iobase = iobase; ret = comedi_alloc_subdevices(dev, 1); - if (ret < 0) { - dev_err(dev->class_dev, "error! out of memory!\n"); + if (ret < 0) return ret; - } s = dev->subdevices + 0; /* digital output subdevice */ diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index 8d33aea..c64e328 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -1381,10 +1381,8 @@ static int pci224_attach_common(struct comedi_device *dev, /* Allocate subdevices. There is only one! */ ret = comedi_alloc_subdevices(dev, 1); - if (ret < 0) { - dev_err(dev->class_dev, "error! out of memory!\n"); + if (ret < 0) return ret; - } s = dev->subdevices + 0; /* Analog output subdevice. */ diff --git a/drivers/staging/comedi/drivers/dyna_pci10xx.c b/drivers/staging/comedi/drivers/dyna_pci10xx.c index 6f6fb52..bab2e37 100644 --- a/drivers/staging/comedi/drivers/dyna_pci10xx.c +++ b/drivers/staging/comedi/drivers/dyna_pci10xx.c @@ -330,8 +330,6 @@ found: devpriv->BADR5 = pci_resource_start(pcidev, 5); if (comedi_alloc_subdevices(dev, 4) < 0) { - printk(KERN_ERR "comedi: dyna_pci10xx: " - "failed allocating subdevices\n"); mutex_unlock(&start_stop_sem); return -ENOMEM; } diff --git a/drivers/staging/comedi/drivers/pcmda12.c b/drivers/staging/comedi/drivers/pcmda12.c index 3645e9e..e1b30cc 100644 --- a/drivers/staging/comedi/drivers/pcmda12.c +++ b/drivers/staging/comedi/drivers/pcmda12.c @@ -197,10 +197,8 @@ static int pcmda12_attach(struct comedi_device *dev, * Allocate 2 subdevs (32 + 16 DIO lines) or 3 32 DIO subdevs for the * 96-channel version of the board. */ - if (comedi_alloc_subdevices(dev, 1) < 0) { - printk(KERN_ERR "cannot allocate subdevice data structures\n"); + if (comedi_alloc_subdevices(dev, 1) < 0) return -ENOMEM; - } s = dev->subdevices; s->private = NULL; diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c index 67fdac5..abaf6c7 100644 --- a/drivers/staging/comedi/drivers/pcmmio.c +++ b/drivers/staging/comedi/drivers/pcmmio.c @@ -1077,11 +1077,8 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) * * Allocate 1 AI + 1 AO + 2 DIO subdevs (24 lines per DIO) */ - if (comedi_alloc_subdevices(dev, n_subdevs) < 0) { - printk(KERN_ERR "comedi%d: cannot allocate subdevice data structures\n", - dev->minor); + if (comedi_alloc_subdevices(dev, n_subdevs) < 0) return -ENOMEM; - } /* First, AI */ sdev_no = 0; diff --git a/drivers/staging/comedi/drivers/pcmuio.c b/drivers/staging/comedi/drivers/pcmuio.c index ce5068e..e4153bd 100644 --- a/drivers/staging/comedi/drivers/pcmuio.c +++ b/drivers/staging/comedi/drivers/pcmuio.c @@ -807,10 +807,8 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) * Allocate 2 subdevs (32 + 16 DIO lines) or 3 32 DIO subdevs for the * 96-channel version of the board. */ - if (comedi_alloc_subdevices(dev, n_subdevs) < 0) { - dev_dbg(dev->hw_dev, "cannot allocate subdevice data structures\n"); + if (comedi_alloc_subdevices(dev, n_subdevs) < 0) return -ENOMEM; - } port = 0; asic = 0; diff --git a/drivers/staging/comedi/drivers/unioxx5.c b/drivers/staging/comedi/drivers/unioxx5.c index 170bc48..711dad7 100644 --- a/drivers/staging/comedi/drivers/unioxx5.c +++ b/drivers/staging/comedi/drivers/unioxx5.c @@ -468,10 +468,8 @@ static int unioxx5_attach(struct comedi_device *dev, return -1; } - if (comedi_alloc_subdevices(dev, n_subd) < 0) { - printk(KERN_ERR "out of memory\n"); + if (comedi_alloc_subdevices(dev, n_subd) < 0) return -ENOMEM; - } /* initializing each of for same subdevices */ for (i = 0; i < n_subd; i++, iobase += UNIOXX5_SUBDEV_ODDS) { diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 3819663..79df200 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -2648,8 +2648,6 @@ static int usbdux_attach_common(struct comedi_device *dev, /* allocate space for the subdevices */ ret = comedi_alloc_subdevices(dev, n_subdevs); if (ret < 0) { - dev_err(&udev->interface->dev, - "comedi%d: error alloc space for subdev\n", dev->minor); up(&udev->sem); return ret; } diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index 262556e..660dd4e 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c @@ -1669,8 +1669,6 @@ static int usbduxfast_attach(struct comedi_device *dev, /* allocate space for the subdevices */ ret = comedi_alloc_subdevices(dev, 1); if (ret < 0) { - printk(KERN_ERR "comedi%d: usbduxfast: error alloc space for " - "subdev\n", dev->minor); up(&(usbduxfastsub[index].sem)); up(&start_stop_sem); return ret; diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index 87c613e..f37e96c 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -2693,8 +2693,6 @@ static int usbduxsigma_attach(struct comedi_device *dev, /* allocate space for the subdevices */ ret = comedi_alloc_subdevices(dev, n_subdevs); if (ret < 0) { - dev_err(&udev->interface->dev, - "comedi%d: no space for subdev\n", dev->minor); up(&udev->sem); up(&start_stop_sem); return ret; -- cgit v0.10.2 From eea6838b1206b0ac90110f1a6f58e101aa496e99 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 12 Jun 2012 11:59:15 -0700 Subject: staging: comedi: remove the "Allocate the subdevice..." comments These comments are redundant. The function name 'comedi_alloc_subdevices' provides this information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c index 274990a..46c590b 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.c +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c @@ -1686,7 +1686,6 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->s_BoardInfos.ui_Address = io_addr[2]; #endif } else { - /* Update-0.7.57->0.7.68dev->n_subdevices = 7; */ n_subdevices = 7; ret = comedi_alloc_subdevices(dev, n_subdevices); if (ret < 0) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.c index 9632ca1..aa390b0 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.c @@ -62,7 +62,6 @@ void i_ADDI_AttachPCI1710(struct comedi_device *dev) int ret = 0; int n_subdevices = 9; - /* Update-0.7.57->0.7.68dev->n_subdevices = 9; */ ret = comedi_alloc_subdevices(dev, n_subdevices); if (ret < 0) return; diff --git a/drivers/staging/comedi/drivers/adq12b.c b/drivers/staging/comedi/drivers/adq12b.c index ca8892e..afc6815 100644 --- a/drivers/staging/comedi/drivers/adq12b.c +++ b/drivers/staging/comedi/drivers/adq12b.c @@ -267,10 +267,6 @@ static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->last_channel = -1; devpriv->last_range = -1; -/* - * Allocate the subdevice structures. alloc_subdevice() is a - * convenient macro defined in comedidev.h. - */ if (comedi_alloc_subdevices(dev, 3) < 0) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index c64e328..1392406 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -1379,7 +1379,6 @@ static int pci224_attach_common(struct comedi_device *dev, outw(devpriv->daccon | PCI224_DACCON_FIFORESET, dev->iobase + PCI224_DACCON); - /* Allocate subdevices. There is only one! */ ret = comedi_alloc_subdevices(dev, 1); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index e6598ca..52f3cb8 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -2839,10 +2839,7 @@ static int pci230_attach_common(struct comedi_device *dev, dev_dbg(dev->class_dev, "registered irq %u\n", devpriv->pci_dev->irq); } - /* - * Allocate the subdevice structures. alloc_subdevice() is a - * convenient macro defined in comedidev.h. - */ + if (comedi_alloc_subdevices(dev, 3) < 0) return -ENOMEM; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/c6xdigio.c b/drivers/staging/comedi/drivers/c6xdigio.c index 72b000f..5fa344b 100644 --- a/drivers/staging/comedi/drivers/c6xdigio.c +++ b/drivers/staging/comedi/drivers/c6xdigio.c @@ -433,7 +433,6 @@ static int c6xdigio_attach(struct comedi_device *dev, dev->iobase = iobase; dev->board_name = "c6xdigio"; - /* 3 subdevices with encoder_init write */ result = comedi_alloc_subdevices(dev, 2); if (result < 0) return result; diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 435f3aa..e1bd99a 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -614,9 +614,6 @@ found: /* Initialize dev->board_name */ dev->board_name = thisboard->name; -/* - * Allocate the subdevice structures. - */ if (comedi_alloc_subdevices(dev, 7) < 0) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/cb_pcidda.c b/drivers/staging/comedi/drivers/cb_pcidda.c index 4ab3584..fedaf55 100644 --- a/drivers/staging/comedi/drivers/cb_pcidda.c +++ b/drivers/staging/comedi/drivers/cb_pcidda.c @@ -333,9 +333,6 @@ found: */ dev->board_name = thisboard->name; -/* - * Allocate the subdevice structures. - */ if (comedi_alloc_subdevices(dev, 3) < 0) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/cb_pcidio.c b/drivers/staging/comedi/drivers/cb_pcidio.c index 56c1d09..f2fff4f 100644 --- a/drivers/staging/comedi/drivers/cb_pcidio.c +++ b/drivers/staging/comedi/drivers/cb_pcidio.c @@ -177,10 +177,6 @@ found: pci_resource_start(devpriv->pci_dev, pcidio_boards[index].dioregs_badrindex); -/* - * Allocate the subdevice structures. alloc_subdevice() is a - * convenient macro defined in comedidev.h. - */ if (comedi_alloc_subdevices(dev, thisboard->n_8255) < 0) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index 6acb319..0ada8b9 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -269,10 +269,6 @@ found: /* Initialize dev->board_name */ dev->board_name = thisboard->name; -/* - * Allocate the subdevice structures. alloc_subdevice() is a - * convenient macro defined in comedidev.h. - */ if (comedi_alloc_subdevices(dev, 3) < 0) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/cb_pcimdda.c b/drivers/staging/comedi/drivers/cb_pcimdda.c index abb6008..b401aec 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdda.c +++ b/drivers/staging/comedi/drivers/cb_pcimdda.c @@ -236,10 +236,6 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it) */ dev->board_name = thisboard->name; -/* - * Allocate the subdevice structures. alloc_subdevice() is a - * convenient macro defined in comedidev.h. - */ if (comedi_alloc_subdevices(dev, 2) < 0) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/comedi_bond.c b/drivers/staging/comedi/drivers/comedi_bond.c index d56eec4..96e5b35 100644 --- a/drivers/staging/comedi/drivers/comedi_bond.c +++ b/drivers/staging/comedi/drivers/comedi_bond.c @@ -358,10 +358,6 @@ static int bonding_attach(struct comedi_device *dev, */ dev->board_name = devpriv->name; - /* - * Allocate the subdevice structures. alloc_subdevice() is a - * convenient macro defined in comedidev.h. - */ if (comedi_alloc_subdevices(dev, 1) < 0) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c index 40d7bef..6b637a2 100644 --- a/drivers/staging/comedi/drivers/dmm32at.c +++ b/drivers/staging/comedi/drivers/dmm32at.c @@ -371,10 +371,6 @@ static int dmm32at_attach(struct comedi_device *dev, if (alloc_private(dev, sizeof(struct dmm32at_private)) < 0) return -ENOMEM; -/* - * Allocate the subdevice structures. alloc_subdevice() is a - * convenient macro defined in comedidev.h. - */ if (comedi_alloc_subdevices(dev, 3) < 0) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/dt9812.c b/drivers/staging/comedi/drivers/dt9812.c index 56af2f2..678fa50 100644 --- a/drivers/staging/comedi/drivers/dt9812.c +++ b/drivers/staging/comedi/drivers/dt9812.c @@ -1035,7 +1035,6 @@ static int dt9812_attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->serial = it->options[0]; - /* Allocate subdevices */ if (comedi_alloc_subdevices(dev, 4) < 0) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/ke_counter.c b/drivers/staging/comedi/drivers/ke_counter.c index bcb1eb4..7c256f4 100644 --- a/drivers/staging/comedi/drivers/ke_counter.c +++ b/drivers/staging/comedi/drivers/ke_counter.c @@ -189,7 +189,6 @@ found: io_base = pci_resource_start(pci_device, 0); dev->iobase = io_base; - /* allocate the subdevice structures */ error = comedi_alloc_subdevices(dev, 1); if (error < 0) return error; diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 39100dd..4adb206 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -2190,11 +2190,6 @@ static int me4000_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (result) return result; - /* - * Allocate the subdevice structures. alloc_subdevice() is a - * convenient macro defined in comedidev.h. It relies on - * n_subdevices being set correctly. - */ if (comedi_alloc_subdevices(dev, 4) < 0) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/mpc624.c b/drivers/staging/comedi/drivers/mpc624.c index 48ba6b9..9750336 100644 --- a/drivers/staging/comedi/drivers/mpc624.c +++ b/drivers/staging/comedi/drivers/mpc624.c @@ -348,7 +348,6 @@ static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->ulConvertionRate = MPC624_SPEED_3_52_kHz; } - /* Subdevices structures */ if (comedi_alloc_subdevices(dev, 1) < 0) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/pcmda12.c b/drivers/staging/comedi/drivers/pcmda12.c index e1b30cc..87faa03 100644 --- a/drivers/staging/comedi/drivers/pcmda12.c +++ b/drivers/staging/comedi/drivers/pcmda12.c @@ -190,13 +190,6 @@ static int pcmda12_attach(struct comedi_device *dev, devpriv->simultaneous_xfer_mode = it->options[1]; - /* - * Allocate the subdevice structures. alloc_subdevice() is a - * convenient macro defined in comedidev.h. - * - * Allocate 2 subdevs (32 + 16 DIO lines) or 3 32 DIO subdevs for the - * 96-channel version of the board. - */ if (comedi_alloc_subdevices(dev, 1) < 0) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c index abaf6c7..3105303 100644 --- a/drivers/staging/comedi/drivers/pcmmio.c +++ b/drivers/staging/comedi/drivers/pcmmio.c @@ -1071,12 +1071,7 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->minor); return -ENOMEM; } - /* - * Allocate the subdevice structures. alloc_subdevice() is a - * convenient macro defined in comedidev.h. - * - * Allocate 1 AI + 1 AO + 2 DIO subdevs (24 lines per DIO) - */ + if (comedi_alloc_subdevices(dev, n_subdevs) < 0) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/pcmuio.c b/drivers/staging/comedi/drivers/pcmuio.c index e4153bd..33ab4c6 100644 --- a/drivers/staging/comedi/drivers/pcmuio.c +++ b/drivers/staging/comedi/drivers/pcmuio.c @@ -800,13 +800,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev_warn(dev->hw_dev, "cannot allocate subdevice private data structures\n"); return -ENOMEM; } - /* - * Allocate the subdevice structures. alloc_subdevice() is a - * convenient macro defined in comedidev.h. - * - * Allocate 2 subdevs (32 + 16 DIO lines) or 3 32 DIO subdevs for the - * 96-channel version of the board. - */ + if (comedi_alloc_subdevices(dev, n_subdevs) < 0) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 7d248a7..445333b 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -1999,10 +1999,6 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Show board configuration */ printk(KERN_INFO "%s:", dev->board_name); - /* - * Allocate the subdevice structures. alloc_subdevice() is a - * convenient macro defined in comedidev.h. - */ if (comedi_alloc_subdevices(dev, 4) < 0) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/s526.c b/drivers/staging/comedi/drivers/s526.c index dbbff70..6a30537 100644 --- a/drivers/staging/comedi/drivers/s526.c +++ b/drivers/staging/comedi/drivers/s526.c @@ -774,10 +774,6 @@ static int s526_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (alloc_private(dev, sizeof(struct s526_private)) < 0) return -ENOMEM; -/* - * Allocate the subdevice structures. alloc_subdevice() is a - * convenient macro defined in comedidev.h. - */ if (comedi_alloc_subdevices(dev, 4) < 0) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/skel.c b/drivers/staging/comedi/drivers/skel.c index 16947c8..ca10b1a 100644 --- a/drivers/staging/comedi/drivers/skel.c +++ b/drivers/staging/comedi/drivers/skel.c @@ -233,10 +233,6 @@ static int skel_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (alloc_private(dev, sizeof(struct skel_private)) < 0) return -ENOMEM; -/* - * Allocate the subdevice structures. alloc_subdevice() is a - * convenient macro defined in comedidev.h. - */ if (comedi_alloc_subdevices(dev, 3) < 0) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/ssv_dnp.c b/drivers/staging/comedi/drivers/ssv_dnp.c index 5eaef84..130e4bd 100644 --- a/drivers/staging/comedi/drivers/ssv_dnp.c +++ b/drivers/staging/comedi/drivers/ssv_dnp.c @@ -197,9 +197,6 @@ static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (alloc_private(dev, sizeof(struct dnp_private_data)) < 0) return -ENOMEM; - /* Allocate the subdevice structures. alloc_subdevice() is a */ - /* convenient macro defined in comedidev.h. */ - if (comedi_alloc_subdevices(dev, 1) < 0) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 79df200..a6cf134 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -2645,7 +2645,6 @@ static int usbdux_attach_common(struct comedi_device *dev, n_subdevs = 4; } - /* allocate space for the subdevices */ ret = comedi_alloc_subdevices(dev, n_subdevs); if (ret < 0) { up(&udev->sem); diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index 660dd4e..f7d4f56 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c @@ -1666,7 +1666,6 @@ static int usbduxfast_attach(struct comedi_device *dev, dev->board_name = BOARDNAME; - /* allocate space for the subdevices */ ret = comedi_alloc_subdevices(dev, 1); if (ret < 0) { up(&(usbduxfastsub[index].sem)); diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index f37e96c..f23fad9 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -2690,7 +2690,6 @@ static int usbduxsigma_attach(struct comedi_device *dev, n_subdevs = 3; } - /* allocate space for the subdevices */ ret = comedi_alloc_subdevices(dev, n_subdevs); if (ret < 0) { up(&udev->sem); -- cgit v0.10.2 From 8b6c56949ffa83dbc2a6e8fa3f98b10a19372207 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 12 Jun 2012 11:59:33 -0700 Subject: staging: comedi: propogate error code from comedi_alloc_subdevices comedi_alloc_subdevices can fail with -EINVAL or -ENOMEM. When it does fail make sure to pass the proper error code back. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index 64b0054..502bde8 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -389,7 +389,7 @@ static int dev_8255_attach(struct comedi_device *dev, } ret = comedi_alloc_subdevices(dev, i); - if (ret < 0) + if (ret) return ret; printk(KERN_INFO "comedi%d: 8255:", dev->minor); diff --git a/drivers/staging/comedi/drivers/acl7225b.c b/drivers/staging/comedi/drivers/acl7225b.c index 3c39148..0bf55258 100644 --- a/drivers/staging/comedi/drivers/acl7225b.c +++ b/drivers/staging/comedi/drivers/acl7225b.c @@ -68,6 +68,7 @@ static int acl7225b_attach(struct comedi_device *dev, const struct boardtype *board = comedi_board(dev); struct comedi_subdevice *s; int iobase, iorange; + int ret; iobase = it->options[0]; iorange = board->io_range; @@ -82,8 +83,9 @@ static int acl7225b_attach(struct comedi_device *dev, dev->iobase = iobase; dev->irq = 0; - if (comedi_alloc_subdevices(dev, 3) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 3); + if (ret) + return ret; s = dev->subdevices + 0; /* Relays outputs */ diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c index 46c590b..a5aa673 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.c +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c @@ -1688,7 +1688,7 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it) } else { n_subdevices = 7; ret = comedi_alloc_subdevices(dev, n_subdevices); - if (ret < 0) + if (ret) return ret; /* Allocate and Initialise AI Subdevice Structures */ diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.c index aa390b0..595238f 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.c @@ -63,7 +63,7 @@ void i_ADDI_AttachPCI1710(struct comedi_device *dev) int n_subdevices = 9; ret = comedi_alloc_subdevices(dev, n_subdevices); - if (ret < 0) + if (ret) return; /* Allocate and Initialise Timer Subdevice Structures */ diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index 7d26d45..98b3730 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -301,8 +301,9 @@ static int pci6208_attach(struct comedi_device *dev, dev->iobase = io_base; dev->board_name = thisboard->name; - if (comedi_alloc_subdevices(dev, 2) < 0) - return -ENOMEM; + retval = comedi_alloc_subdevices(dev, 2); + if (retval) + return retval; s = dev->subdevices + 0; /* analog output subdevice */ diff --git a/drivers/staging/comedi/drivers/adl_pci7230.c b/drivers/staging/comedi/drivers/adl_pci7230.c index 5a6e6c1..62fdf7f 100644 --- a/drivers/staging/comedi/drivers/adl_pci7230.c +++ b/drivers/staging/comedi/drivers/adl_pci7230.c @@ -108,6 +108,7 @@ static int adl_pci7230_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; + int ret; printk(KERN_INFO "comedi%d: adl_pci7230\n", dev->minor); @@ -116,8 +117,9 @@ static int adl_pci7230_attach(struct comedi_device *dev, if (alloc_private(dev, sizeof(struct adl_pci7230_private)) < 0) return -ENOMEM; - if (comedi_alloc_subdevices(dev, 2) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 2); + if (ret) + return ret; devpriv->pci_dev = adl_pci7230_find_pci(dev, it); if (!devpriv->pci_dev) diff --git a/drivers/staging/comedi/drivers/adl_pci7296.c b/drivers/staging/comedi/drivers/adl_pci7296.c index fd9b33a..58deb60 100644 --- a/drivers/staging/comedi/drivers/adl_pci7296.c +++ b/drivers/staging/comedi/drivers/adl_pci7296.c @@ -92,8 +92,9 @@ static int adl_pci7296_attach(struct comedi_device *dev, if (alloc_private(dev, sizeof(struct adl_pci7296_private)) < 0) return -ENOMEM; - if (comedi_alloc_subdevices(dev, 4) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 4); + if (ret) + return ret; devpriv->pci_dev = adl_pci7296_find_pci(dev, it); if (!devpriv->pci_dev) diff --git a/drivers/staging/comedi/drivers/adl_pci7432.c b/drivers/staging/comedi/drivers/adl_pci7432.c index 4976a70..aabf418 100644 --- a/drivers/staging/comedi/drivers/adl_pci7432.c +++ b/drivers/staging/comedi/drivers/adl_pci7432.c @@ -117,6 +117,7 @@ static int adl_pci7432_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; + int ret; printk(KERN_INFO "comedi%d: attach adl_pci7432\n", dev->minor); @@ -125,8 +126,9 @@ static int adl_pci7432_attach(struct comedi_device *dev, if (alloc_private(dev, sizeof(struct adl_pci7432_private)) < 0) return -ENOMEM; - if (comedi_alloc_subdevices(dev, 2) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 2); + if (ret) + return ret; devpriv->pci_dev = adl_pci7432_find_pci(dev, it); if (!devpriv->pci_dev) diff --git a/drivers/staging/comedi/drivers/adl_pci8164.c b/drivers/staging/comedi/drivers/adl_pci8164.c index 78169f7..1811375 100644 --- a/drivers/staging/comedi/drivers/adl_pci8164.c +++ b/drivers/staging/comedi/drivers/adl_pci8164.c @@ -252,6 +252,7 @@ static int adl_pci8164_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; + int ret; printk(KERN_INFO "comedi: attempt to attach...\n"); printk(KERN_INFO "comedi%d: adl_pci8164\n", dev->minor); @@ -261,8 +262,9 @@ static int adl_pci8164_attach(struct comedi_device *dev, if (alloc_private(dev, sizeof(struct adl_pci8164_private)) < 0) return -ENOMEM; - if (comedi_alloc_subdevices(dev, 4) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 4); + if (ret) + return ret; devpriv->pci_dev = adl_pci8164_find_pci(dev, it); if (!devpriv->pci_dev) diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c index cc17946..4f2cea8 100644 --- a/drivers/staging/comedi/drivers/adl_pci9111.c +++ b/drivers/staging/comedi/drivers/adl_pci9111.c @@ -1318,7 +1318,7 @@ static int pci9111_attach(struct comedi_device *dev, /* TODO: Add external multiplexer setup (according to option[2]). */ error = comedi_alloc_subdevices(dev, 4); - if (error < 0) + if (error) return error; subdevice = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index ebd8b8e..9a7b6a5 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -2269,7 +2269,7 @@ static int pci9118_attach(struct comedi_device *dev, /* Enable parity check for parity error */ ret = comedi_alloc_subdevices(dev, 4); - if (ret < 0) + if (ret) return ret; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/adq12b.c b/drivers/staging/comedi/drivers/adq12b.c index afc6815..f7bb145 100644 --- a/drivers/staging/comedi/drivers/adq12b.c +++ b/drivers/staging/comedi/drivers/adq12b.c @@ -224,6 +224,7 @@ static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it) struct comedi_subdevice *s; unsigned long iobase; int unipolar, differential; + int ret; iobase = it->options[0]; unipolar = it->options[1]; @@ -267,8 +268,9 @@ static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->last_channel = -1; devpriv->last_range = -1; - if (comedi_alloc_subdevices(dev, 3) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 3); + if (ret) + return ret; s = dev->subdevices + 0; /* analog input subdevice */ diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index be3fc4d..60a50ad 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -1434,7 +1434,7 @@ static int pci1710_attach(struct comedi_device *dev, n_subdevices++; ret = comedi_alloc_subdevices(dev, n_subdevices); - if (ret < 0) + if (ret) return ret; pci1710_reset(dev); diff --git a/drivers/staging/comedi/drivers/adv_pci1723.c b/drivers/staging/comedi/drivers/adv_pci1723.c index c14ad35..d37c14d 100644 --- a/drivers/staging/comedi/drivers/adv_pci1723.c +++ b/drivers/staging/comedi/drivers/adv_pci1723.c @@ -366,7 +366,7 @@ static int pci1723_attach(struct comedi_device *dev, n_subdevices++; ret = comedi_alloc_subdevices(dev, n_subdevices); - if (ret < 0) + if (ret) return ret; pci1723_reset(dev); diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 0fc4f85..942dc77 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -1157,7 +1157,7 @@ static int pci_dio_attach(struct comedi_device *dev, } ret = comedi_alloc_subdevices(dev, n_subdevices); - if (ret < 0) + if (ret) return ret; subdev = 0; diff --git a/drivers/staging/comedi/drivers/aio_aio12_8.c b/drivers/staging/comedi/drivers/aio_aio12_8.c index 60466c8..f7d453f 100644 --- a/drivers/staging/comedi/drivers/aio_aio12_8.c +++ b/drivers/staging/comedi/drivers/aio_aio12_8.c @@ -168,6 +168,7 @@ static int aio_aio12_8_attach(struct comedi_device *dev, const struct aio12_8_boardtype *board = comedi_board(dev); int iobase; struct comedi_subdevice *s; + int ret; iobase = it->options[0]; if (!request_region(iobase, 24, "aio_aio12_8")) { @@ -182,8 +183,9 @@ static int aio_aio12_8_attach(struct comedi_device *dev, if (alloc_private(dev, sizeof(struct aio12_8_private)) < 0) return -ENOMEM; - if (comedi_alloc_subdevices(dev, 3) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 3); + if (ret) + return ret; s = &dev->subdevices[0]; s->type = COMEDI_SUBD_AI; diff --git a/drivers/staging/comedi/drivers/aio_iiro_16.c b/drivers/staging/comedi/drivers/aio_iiro_16.c index 7d161d6..8059cef 100644 --- a/drivers/staging/comedi/drivers/aio_iiro_16.c +++ b/drivers/staging/comedi/drivers/aio_iiro_16.c @@ -107,6 +107,7 @@ static int aio_iiro_16_attach(struct comedi_device *dev, const struct aio_iiro_16_board *board = comedi_board(dev); int iobase; struct comedi_subdevice *s; + int ret; printk(KERN_INFO "comedi%d: aio_iiro_16: ", dev->minor); @@ -124,8 +125,9 @@ static int aio_iiro_16_attach(struct comedi_device *dev, if (alloc_private(dev, sizeof(struct aio_iiro_16_private)) < 0) return -ENOMEM; - if (comedi_alloc_subdevices(dev, 2) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 2); + if (ret) + return ret; s = dev->subdevices + 0; s->type = COMEDI_SUBD_DIO; diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index 17d3489..c67b09f 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -1273,9 +1273,11 @@ static int dio200_common_attach(struct comedi_device *dev, unsigned long iobase, devpriv->intr_sd = -1; dev->iobase = iobase; dev->board_name = thisboard->name; + ret = comedi_alloc_subdevices(dev, layout->n_subdevs); - if (ret < 0) + if (ret) return ret; + for (n = 0; n < dev->n_subdevices; n++) { s = &dev->subdevices[n]; switch (layout->sdtype[n]) { diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c index 6205985..e55321e 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236.c +++ b/drivers/staging/comedi/drivers/amplc_pc236.c @@ -456,7 +456,7 @@ static int pc236_common_attach(struct comedi_device *dev, unsigned long iobase, dev->iobase = iobase; ret = comedi_alloc_subdevices(dev, 2); - if (ret < 0) + if (ret) return ret; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index f1d68df..4f15bfd 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c @@ -228,7 +228,7 @@ static int pc263_common_attach(struct comedi_device *dev, unsigned long iobase) dev->iobase = iobase; ret = comedi_alloc_subdevices(dev, 1); - if (ret < 0) + if (ret) return ret; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index 1392406..b87e10d 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -1380,7 +1380,7 @@ static int pci224_attach_common(struct comedi_device *dev, dev->iobase + PCI224_DACCON); ret = comedi_alloc_subdevices(dev, 1); - if (ret < 0) + if (ret) return ret; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index 52f3cb8..3d7f2cd 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -2840,8 +2840,10 @@ static int pci230_attach_common(struct comedi_device *dev, devpriv->pci_dev->irq); } - if (comedi_alloc_subdevices(dev, 3) < 0) - return -ENOMEM; + rc = comedi_alloc_subdevices(dev, 3); + if (rc) + return rc; + s = dev->subdevices + 0; /* analog input subdevice */ s->type = COMEDI_SUBD_AI; diff --git a/drivers/staging/comedi/drivers/c6xdigio.c b/drivers/staging/comedi/drivers/c6xdigio.c index 5fa344b..41ed857 100644 --- a/drivers/staging/comedi/drivers/c6xdigio.c +++ b/drivers/staging/comedi/drivers/c6xdigio.c @@ -434,7 +434,7 @@ static int c6xdigio_attach(struct comedi_device *dev, dev->board_name = "c6xdigio"; result = comedi_alloc_subdevices(dev, 2); - if (result < 0) + if (result) return result; /* Make sure that PnP ports get activated */ diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 9aa11c1..0310077 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -195,8 +195,9 @@ static int das16cs_attach(struct comedi_device *dev, if (alloc_private(dev, sizeof(struct das16cs_private)) < 0) return -ENOMEM; - if (comedi_alloc_subdevices(dev, 4) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 4); + if (ret) + return ret; s = dev->subdevices + 0; dev->read_subdev = s; diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index e1bd99a..2ca3fa0 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -533,6 +533,7 @@ static int cb_pcidas_attach(struct comedi_device *dev, struct pci_dev *pcidev = NULL; int index; int i; + int ret; /* * Allocate the private structure area. @@ -614,8 +615,9 @@ found: /* Initialize dev->board_name */ dev->board_name = thisboard->name; - if (comedi_alloc_subdevices(dev, 7) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 7); + if (ret) + return ret; s = dev->subdevices + 0; /* analog input subdevice */ diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 6b2f153..3aab75b 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -1344,9 +1344,11 @@ static int setup_subdevices(struct comedi_device *dev) struct comedi_subdevice *s; void __iomem *dio_8255_iobase; int i; + int ret; - if (comedi_alloc_subdevices(dev, 10) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 10); + if (ret) + return ret; s = dev->subdevices + 0; /* analog input subdevice */ diff --git a/drivers/staging/comedi/drivers/cb_pcidda.c b/drivers/staging/comedi/drivers/cb_pcidda.c index fedaf55..0572dc6 100644 --- a/drivers/staging/comedi/drivers/cb_pcidda.c +++ b/drivers/staging/comedi/drivers/cb_pcidda.c @@ -265,7 +265,7 @@ static int cb_pcidda_attach(struct comedi_device *dev, struct comedi_subdevice *s; struct pci_dev *pcidev = NULL; int index; - + int ret; /* * Allocate the private structure area. @@ -333,8 +333,9 @@ found: */ dev->board_name = thisboard->name; - if (comedi_alloc_subdevices(dev, 3) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 3); + if (ret) + return ret; s = dev->subdevices + 0; /* analog output subdevice */ diff --git a/drivers/staging/comedi/drivers/cb_pcidio.c b/drivers/staging/comedi/drivers/cb_pcidio.c index f2fff4f..0186737 100644 --- a/drivers/staging/comedi/drivers/cb_pcidio.c +++ b/drivers/staging/comedi/drivers/cb_pcidio.c @@ -116,6 +116,7 @@ static int pcidio_attach(struct comedi_device *dev, struct comedi_devconfig *it) struct pci_dev *pcidev = NULL; int index; int i; + int ret; /* * Allocate the private structure area. alloc_private() is a @@ -177,8 +178,9 @@ found: pci_resource_start(devpriv->pci_dev, pcidio_boards[index].dioregs_badrindex); - if (comedi_alloc_subdevices(dev, thisboard->n_8255) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, thisboard->n_8255); + if (ret) + return ret; for (i = 0; i < thisboard->n_8255; i++) { subdev_8255_init(dev, dev->subdevices + i, diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index 0ada8b9..b99a451 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -187,6 +187,7 @@ static int cb_pcimdas_attach(struct comedi_device *dev, struct comedi_subdevice *s; struct pci_dev *pcidev = NULL; int index; + int ret; /* int i; */ /* @@ -269,8 +270,9 @@ found: /* Initialize dev->board_name */ dev->board_name = thisboard->name; - if (comedi_alloc_subdevices(dev, 3) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 3); + if (ret) + return ret; s = dev->subdevices + 0; /* dev->read_subdev=s; */ diff --git a/drivers/staging/comedi/drivers/cb_pcimdda.c b/drivers/staging/comedi/drivers/cb_pcimdda.c index b401aec..a801461 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdda.c +++ b/drivers/staging/comedi/drivers/cb_pcimdda.c @@ -236,8 +236,9 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it) */ dev->board_name = thisboard->name; - if (comedi_alloc_subdevices(dev, 2) < 0) - return -ENOMEM; + err = comedi_alloc_subdevices(dev, 2); + if (err) + return err; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/comedi_bond.c b/drivers/staging/comedi/drivers/comedi_bond.c index 96e5b35..0260ddc 100644 --- a/drivers/staging/comedi/drivers/comedi_bond.c +++ b/drivers/staging/comedi/drivers/comedi_bond.c @@ -336,6 +336,7 @@ static int bonding_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; + int ret; LOG_MSG("comedi%d\n", dev->minor); @@ -358,8 +359,9 @@ static int bonding_attach(struct comedi_device *dev, */ dev->board_name = devpriv->name; - if (comedi_alloc_subdevices(dev, 1) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 1); + if (ret) + return ret; s = dev->subdevices + 0; s->type = COMEDI_SUBD_DIO; diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index c9a725f..589d12f 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -316,8 +316,9 @@ static int parport_attach(struct comedi_device *dev, dev->board_name = "parport"; ret = comedi_alloc_subdevices(dev, 4); - if (ret < 0) + if (ret) return ret; + ret = alloc_private(dev, sizeof(struct parport_private)); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c index 004da30..523a809 100644 --- a/drivers/staging/comedi/drivers/comedi_test.c +++ b/drivers/staging/comedi/drivers/comedi_test.c @@ -432,6 +432,7 @@ static int waveform_attach(struct comedi_device *dev, int amplitude = it->options[0]; int period = it->options[1]; int i; + int ret; dev->board_name = board->name; @@ -447,8 +448,9 @@ static int waveform_attach(struct comedi_device *dev, devpriv->uvolt_amplitude = amplitude; devpriv->usec_period = period; - if (comedi_alloc_subdevices(dev, 2) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 2); + if (ret) + return ret; s = dev->subdevices + 0; dev->read_subdev = s; diff --git a/drivers/staging/comedi/drivers/contec_pci_dio.c b/drivers/staging/comedi/drivers/contec_pci_dio.c index a5bad1b..79854b1 100644 --- a/drivers/staging/comedi/drivers/contec_pci_dio.c +++ b/drivers/staging/comedi/drivers/contec_pci_dio.c @@ -107,6 +107,7 @@ static int contec_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct pci_dev *pcidev = NULL; struct comedi_subdevice *s; + int ret; printk("comedi%d: contec: ", dev->minor); @@ -115,8 +116,9 @@ static int contec_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (alloc_private(dev, sizeof(struct contec_private)) < 0) return -ENOMEM; - if (comedi_alloc_subdevices(dev, 2) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 2); + if (ret) + return ret; for_each_pci_dev(pcidev) { if (pcidev->vendor == PCI_VENDOR_ID_CONTEC && diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c index dbd0472..9ecf1a4 100644 --- a/drivers/staging/comedi/drivers/daqboard2000.c +++ b/drivers/staging/comedi/drivers/daqboard2000.c @@ -773,8 +773,8 @@ static int daqboard2000_attach(struct comedi_device *dev, return -ENOMEM; result = comedi_alloc_subdevices(dev, 3); - if (result < 0) - goto out; + if (result) + return result; readl(devpriv->plx + 0x6c); diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index 1dea21a..c4627a6 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -835,7 +835,7 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) dev->board_name = thisboard->name; ret = comedi_alloc_subdevices(dev, 6); - if (ret < 0) + if (ret) return ret; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c index 6a8a7eb..0c6ad10 100644 --- a/drivers/staging/comedi/drivers/das16.c +++ b/drivers/staging/comedi/drivers/das16.c @@ -1265,7 +1265,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->timer_mode = timer_mode ? 1 : 0; ret = comedi_alloc_subdevices(dev, 5); - if (ret < 0) + if (ret) return ret; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/das16m1.c b/drivers/staging/comedi/drivers/das16m1.c index eafd6b5..f3fba13 100644 --- a/drivers/staging/comedi/drivers/das16m1.c +++ b/drivers/staging/comedi/drivers/das16m1.c @@ -647,7 +647,7 @@ static int das16m1_attach(struct comedi_device *dev, } ret = comedi_alloc_subdevices(dev, 4); - if (ret < 0) + if (ret) return ret; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c index 12d736a..af60e5d 100644 --- a/drivers/staging/comedi/drivers/das1800.c +++ b/drivers/staging/comedi/drivers/das1800.c @@ -1644,8 +1644,9 @@ static int das1800_attach(struct comedi_device *dev, return -ENOMEM; } - if (comedi_alloc_subdevices(dev, 4) < 0) - return -ENOMEM; + retval = comedi_alloc_subdevices(dev, 4); + if (retval) + return retval; /* analog input subdevice */ s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/das6402.c b/drivers/staging/comedi/drivers/das6402.c index 2039b6c..22a9b34 100644 --- a/drivers/staging/comedi/drivers/das6402.c +++ b/drivers/staging/comedi/drivers/das6402.c @@ -308,7 +308,7 @@ static int das6402_attach(struct comedi_device *dev, return ret; ret = comedi_alloc_subdevices(dev, 1); - if (ret < 0) + if (ret) return ret; /* ai subdevice */ diff --git a/drivers/staging/comedi/drivers/das800.c b/drivers/staging/comedi/drivers/das800.c index 6263f53..81698b1 100644 --- a/drivers/staging/comedi/drivers/das800.c +++ b/drivers/staging/comedi/drivers/das800.c @@ -465,6 +465,7 @@ static int das800_attach(struct comedi_device *dev, struct comedi_devconfig *it) unsigned int irq = it->options[1]; unsigned long irq_flags; int board; + int ret; dev_info(dev->hw_dev, "comedi%d: das800: io 0x%lx\n", dev->minor, iobase); @@ -510,8 +511,9 @@ static int das800_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->board_name = thisboard->name; - if (comedi_alloc_subdevices(dev, 3) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 3); + if (ret) + return ret; /* analog input subdevice */ s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c index 6b637a2..2b60cf8 100644 --- a/drivers/staging/comedi/drivers/dmm32at.c +++ b/drivers/staging/comedi/drivers/dmm32at.c @@ -371,8 +371,9 @@ static int dmm32at_attach(struct comedi_device *dev, if (alloc_private(dev, sizeof(struct dmm32at_private)) < 0) return -ENOMEM; - if (comedi_alloc_subdevices(dev, 3) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 3); + if (ret) + return ret; s = dev->subdevices + 0; dev->read_subdev = s; diff --git a/drivers/staging/comedi/drivers/dt2801.c b/drivers/staging/comedi/drivers/dt2801.c index 35ce076..5afbf8a 100644 --- a/drivers/staging/comedi/drivers/dt2801.c +++ b/drivers/staging/comedi/drivers/dt2801.c @@ -626,15 +626,15 @@ havetype: printk("dt2801: %s at port 0x%lx", boardtype.name, iobase); n_ai_chans = probe_number_of_ai_chans(dev); - printk(" (ai channels = %d)", n_ai_chans); + printk(" (ai channels = %d)\n", n_ai_chans); ret = comedi_alloc_subdevices(dev, 4); - if (ret < 0) + if (ret) goto out; ret = alloc_private(dev, sizeof(struct dt2801_private)); if (ret < 0) - goto out; + return ret; dev->board_name = boardtype.name; @@ -688,8 +688,6 @@ havetype: ret = 0; out: - printk("\n"); - return ret; } diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index 6ff610d..91fbf4a 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -466,7 +466,7 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) #endif ret = comedi_alloc_subdevices(dev, 4); - if (ret < 0) + if (ret) return ret; ret = alloc_private(dev, sizeof(struct dt2811_private)); diff --git a/drivers/staging/comedi/drivers/dt2814.c b/drivers/staging/comedi/drivers/dt2814.c index 876d5cb..2e39ebe 100644 --- a/drivers/staging/comedi/drivers/dt2814.c +++ b/drivers/staging/comedi/drivers/dt2814.c @@ -339,7 +339,7 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) } ret = comedi_alloc_subdevices(dev, 1); - if (ret < 0) + if (ret) return ret; ret = alloc_private(dev, sizeof(struct dt2814_private)); diff --git a/drivers/staging/comedi/drivers/dt2815.c b/drivers/staging/comedi/drivers/dt2815.c index 33ad1fa..45b20be 100644 --- a/drivers/staging/comedi/drivers/dt2815.c +++ b/drivers/staging/comedi/drivers/dt2815.c @@ -166,6 +166,7 @@ static int dt2815_attach(struct comedi_device *dev, struct comedi_devconfig *it) int i; const struct comedi_lrange *current_range_type, *voltage_range_type; unsigned long iobase; + int ret; iobase = it->options[0]; printk(KERN_INFO "comedi%d: dt2815: 0x%04lx ", dev->minor, iobase); @@ -177,8 +178,10 @@ static int dt2815_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->iobase = iobase; dev->board_name = "dt2815"; - if (comedi_alloc_subdevices(dev, 1) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 1); + if (ret) + return ret; + if (alloc_private(dev, sizeof(struct dt2815_private)) < 0) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/dt2817.c b/drivers/staging/comedi/drivers/dt2817.c index 665db07..9282ca5 100644 --- a/drivers/staging/comedi/drivers/dt2817.c +++ b/drivers/staging/comedi/drivers/dt2817.c @@ -138,7 +138,7 @@ static int dt2817_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->board_name = "dt2817"; ret = comedi_alloc_subdevices(dev, 1); - if (ret < 0) + if (ret) return ret; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c index f11d1fd..9c0a0df 100644 --- a/drivers/staging/comedi/drivers/dt282x.c +++ b/drivers/staging/comedi/drivers/dt282x.c @@ -1269,7 +1269,7 @@ static int dt282x_attach(struct comedi_device *dev, struct comedi_devconfig *it) return ret; ret = comedi_alloc_subdevices(dev, 3); - if (ret < 0) + if (ret) return ret; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c index 10415b2..9828fb1 100644 --- a/drivers/staging/comedi/drivers/dt3000.c +++ b/drivers/staging/comedi/drivers/dt3000.c @@ -883,7 +883,7 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->irq = devpriv->pci_dev->irq; ret = comedi_alloc_subdevices(dev, 4); - if (ret < 0) + if (ret) return ret; s = dev->subdevices; diff --git a/drivers/staging/comedi/drivers/dt9812.c b/drivers/staging/comedi/drivers/dt9812.c index 678fa50..40821c7 100644 --- a/drivers/staging/comedi/drivers/dt9812.c +++ b/drivers/staging/comedi/drivers/dt9812.c @@ -1021,6 +1021,7 @@ static int dt9812_attach(struct comedi_device *dev, struct comedi_devconfig *it) { int i; struct comedi_subdevice *s; + int ret; dev->board_name = "dt9812"; @@ -1035,8 +1036,9 @@ static int dt9812_attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->serial = it->options[0]; - if (comedi_alloc_subdevices(dev, 4) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 4); + if (ret) + return ret; /* digital input subdevice */ s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/dyna_pci10xx.c b/drivers/staging/comedi/drivers/dyna_pci10xx.c index bab2e37..9c855e2 100644 --- a/drivers/staging/comedi/drivers/dyna_pci10xx.c +++ b/drivers/staging/comedi/drivers/dyna_pci10xx.c @@ -246,6 +246,7 @@ static int dyna_pci10xx_attach(struct comedi_device *dev, struct pci_dev *pcidev; unsigned int opt_bus, opt_slot; int board_index, i; + int ret; mutex_lock(&start_stop_sem); @@ -329,9 +330,10 @@ found: devpriv->BADR4 = pci_resource_start(pcidev, 4); devpriv->BADR5 = pci_resource_start(pcidev, 5); - if (comedi_alloc_subdevices(dev, 4) < 0) { + ret = comedi_alloc_subdevices(dev, 4); + if (ret) { mutex_unlock(&start_stop_sem); - return -ENOMEM; + return ret; } /* analog input */ diff --git a/drivers/staging/comedi/drivers/fl512.c b/drivers/staging/comedi/drivers/fl512.c index 7218a9b..d1da809 100644 --- a/drivers/staging/comedi/drivers/fl512.c +++ b/drivers/staging/comedi/drivers/fl512.c @@ -111,6 +111,7 @@ static int fl512_ao_insn_readback(struct comedi_device *dev, static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it) { unsigned long iobase; + int ret; /* pointer to the subdevice: Analog in, Analog out, (not made ->and Digital IO) */ @@ -131,8 +132,9 @@ static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it) printk(KERN_DEBUG "malloc ok\n"); #endif - if (comedi_alloc_subdevices(dev, 2) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 2); + if (ret) + return ret; /* * this if the definitions of the supdevices, 2 have been defined diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c b/drivers/staging/comedi/drivers/gsc_hpdi.c index b103cfb..79f5808 100644 --- a/drivers/staging/comedi/drivers/gsc_hpdi.c +++ b/drivers/staging/comedi/drivers/gsc_hpdi.c @@ -430,9 +430,11 @@ static void init_plx9080(struct comedi_device *dev) static int setup_subdevices(struct comedi_device *dev) { struct comedi_subdevice *s; + int ret; - if (comedi_alloc_subdevices(dev, 1) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 1); + if (ret) + return ret; s = dev->subdevices + 0; /* analog input subdevice */ diff --git a/drivers/staging/comedi/drivers/icp_multi.c b/drivers/staging/comedi/drivers/icp_multi.c index 06c66af..544bed8 100644 --- a/drivers/staging/comedi/drivers/icp_multi.c +++ b/drivers/staging/comedi/drivers/icp_multi.c @@ -904,7 +904,7 @@ static int icp_multi_attach(struct comedi_device *dev, n_subdevices++; ret = comedi_alloc_subdevices(dev, n_subdevices); - if (ret < 0) + if (ret) return ret; icp_multi_reset(dev); diff --git a/drivers/staging/comedi/drivers/ii_pci20kc.c b/drivers/staging/comedi/drivers/ii_pci20kc.c index 9c11657..bea3d03 100644 --- a/drivers/staging/comedi/drivers/ii_pci20kc.c +++ b/drivers/staging/comedi/drivers/ii_pci20kc.c @@ -203,7 +203,7 @@ static int pci20xxx_attach(struct comedi_device *dev, union pci20xxx_subdev_private *sdp; ret = comedi_alloc_subdevices(dev, 1 + PCI20000_MODULES); - if (ret < 0) + if (ret) return ret; ret = alloc_private(dev, sizeof(struct pci20xxx_private)); diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c index 182643b..3c043e5 100644 --- a/drivers/staging/comedi/drivers/jr3_pci.c +++ b/drivers/staging/comedi/drivers/jr3_pci.c @@ -827,8 +827,8 @@ static int jr3_pci_attach(struct comedi_device *dev, return -ENOMEM; result = comedi_alloc_subdevices(dev, devpriv->n_channels); - if (result < 0) - goto out; + if (result) + return result; dev->open = jr3_pci_open; for (i = 0; i < devpriv->n_channels; i++) { diff --git a/drivers/staging/comedi/drivers/ke_counter.c b/drivers/staging/comedi/drivers/ke_counter.c index 7c256f4..019e91a 100644 --- a/drivers/staging/comedi/drivers/ke_counter.c +++ b/drivers/staging/comedi/drivers/ke_counter.c @@ -190,7 +190,7 @@ found: dev->iobase = io_base; error = comedi_alloc_subdevices(dev, 1); - if (error < 0) + if (error) return error; subdevice = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 4adb206..aae01f1 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -2190,8 +2190,9 @@ static int me4000_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (result) return result; - if (comedi_alloc_subdevices(dev, 4) < 0) - return -ENOMEM; + result = comedi_alloc_subdevices(dev, 4); + if (result) + return result; /*========================================================================= Analog input subdevice diff --git a/drivers/staging/comedi/drivers/me_daq.c b/drivers/staging/comedi/drivers/me_daq.c index 231b294..ae3b046 100644 --- a/drivers/staging/comedi/drivers/me_daq.c +++ b/drivers/staging/comedi/drivers/me_daq.c @@ -761,9 +761,8 @@ found: me_reset(dev); - /* device driver capabilities */ error = comedi_alloc_subdevices(dev, 3); - if (error < 0) + if (error) return error; subdevice = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/mpc624.c b/drivers/staging/comedi/drivers/mpc624.c index 9750336..b928b67 100644 --- a/drivers/staging/comedi/drivers/mpc624.c +++ b/drivers/staging/comedi/drivers/mpc624.c @@ -285,6 +285,7 @@ static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; unsigned long iobase; + int ret; iobase = it->options[0]; printk(KERN_INFO "comedi%d: mpc624 [0x%04lx, ", dev->minor, iobase); @@ -348,8 +349,9 @@ static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->ulConvertionRate = MPC624_SPEED_3_52_kHz; } - if (comedi_alloc_subdevices(dev, 1) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 1); + if (ret) + return ret; s = dev->subdevices + 0; s->type = COMEDI_SUBD_AI; diff --git a/drivers/staging/comedi/drivers/mpc8260cpm.c b/drivers/staging/comedi/drivers/mpc8260cpm.c index 1311051..a6311b1 100644 --- a/drivers/staging/comedi/drivers/mpc8260cpm.c +++ b/drivers/staging/comedi/drivers/mpc8260cpm.c @@ -121,6 +121,7 @@ static int mpc8260cpm_attach(struct comedi_device *dev, { struct comedi_subdevice *s; int i; + int ret; printk("comedi%d: mpc8260cpm: ", dev->minor); @@ -131,8 +132,9 @@ static int mpc8260cpm_attach(struct comedi_device *dev, if (alloc_private(dev, sizeof(struct mpc8260cpm_private)) < 0) return -ENOMEM; - if (comedi_alloc_subdevices(dev, 4) < 0) - return -ENOMEM; + ret =comedi_alloc_subdevices(dev, 4); + if (ret) + return ret; for (i = 0; i < 4; i++) { s = dev->subdevices + i; diff --git a/drivers/staging/comedi/drivers/multiq3.c b/drivers/staging/comedi/drivers/multiq3.c index 00d497c..b1bbd02 100644 --- a/drivers/staging/comedi/drivers/multiq3.c +++ b/drivers/staging/comedi/drivers/multiq3.c @@ -255,8 +255,9 @@ static int multiq3_attach(struct comedi_device *dev, else printk(KERN_WARNING "comedi%d: no irq\n", dev->minor); dev->board_name = "multiq3"; + result = comedi_alloc_subdevices(dev, 5); - if (result < 0) + if (result) return result; result = alloc_private(dev, sizeof(struct multiq3_private)); diff --git a/drivers/staging/comedi/drivers/ni_6527.c b/drivers/staging/comedi/drivers/ni_6527.c index 89fee6f..b60ab48 100644 --- a/drivers/staging/comedi/drivers/ni_6527.c +++ b/drivers/staging/comedi/drivers/ni_6527.c @@ -398,7 +398,7 @@ static int ni6527_attach(struct comedi_device *dev, struct comedi_devconfig *it) readb(devpriv->mite->daq_io_addr + ID_Register)); ret = comedi_alloc_subdevices(dev, 3); - if (ret < 0) + if (ret) return ret; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index a49dcea..ac7c74b 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -679,7 +679,7 @@ static int ni_65xx_attach(struct comedi_device *dev, readb(private(dev)->mite->daq_io_addr + ID_Register)); ret = comedi_alloc_subdevices(dev, 4); - if (ret < 0) + if (ret) return ret; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 8c6a6ba..5391a39 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -1093,8 +1093,9 @@ static int ni_660x_attach(struct comedi_device *dev, printk(KERN_INFO " %s ", dev->board_name); - if (comedi_alloc_subdevices(dev, 2 + NI_660X_MAX_NUM_COUNTERS) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 2 + NI_660X_MAX_NUM_COUNTERS); + if (ret) + return ret; s = dev->subdevices + 0; /* Old GENERAL-PURPOSE COUNTER/TIME (GPCT) subdevice, no longer used */ diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index 45a03e6..5dffe6c 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -202,8 +202,9 @@ static int ni_670x_attach(struct comedi_device *dev, dev->irq = mite_irq(devpriv->mite); printk(KERN_INFO " %s", dev->board_name); - if (comedi_alloc_subdevices(dev, 2) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 2); + if (ret) + return ret; s = dev->subdevices + 0; /* analog output subdevice */ diff --git a/drivers/staging/comedi/drivers/ni_at_a2150.c b/drivers/staging/comedi/drivers/ni_at_a2150.c index 9d1a0f7..b53a428 100644 --- a/drivers/staging/comedi/drivers/ni_at_a2150.c +++ b/drivers/staging/comedi/drivers/ni_at_a2150.c @@ -755,6 +755,7 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it) unsigned int dma = it->options[2]; static const int timeout = 2000; int i; + int ret; printk("comedi%d: %s: io 0x%lx", dev->minor, dev->driver->driver_name, iobase); @@ -826,8 +827,9 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->board_ptr = a2150_boards + a2150_probe(dev); dev->board_name = thisboard->name; - if (comedi_alloc_subdevices(dev, 1) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 1); + if (ret) + return ret; /* analog input subdevice */ s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/ni_at_ao.c b/drivers/staging/comedi/drivers/ni_at_ao.c index 03a4d73..1c3f322 100644 --- a/drivers/staging/comedi/drivers/ni_at_ao.c +++ b/drivers/staging/comedi/drivers/ni_at_ao.c @@ -337,6 +337,7 @@ static int atao_attach(struct comedi_device *dev, struct comedi_devconfig *it) struct comedi_subdevice *s; unsigned long iobase; int ao_unipolar; + int ret; iobase = it->options[0]; if (iobase == 0) @@ -356,8 +357,9 @@ static int atao_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (alloc_private(dev, sizeof(struct atao_private)) < 0) return -ENOMEM; - if (comedi_alloc_subdevices(dev, 4) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 4); + if (ret) + return ret; s = dev->subdevices + 0; /* analog output subdevice */ diff --git a/drivers/staging/comedi/drivers/ni_atmio16d.c b/drivers/staging/comedi/drivers/ni_atmio16d.c index 37ff6fc..95bee84 100644 --- a/drivers/staging/comedi/drivers/ni_atmio16d.c +++ b/drivers/staging/comedi/drivers/ni_atmio16d.c @@ -710,7 +710,7 @@ static int atmio16d_attach(struct comedi_device *dev, dev->board_name = board->name; ret = comedi_alloc_subdevices(dev, 4); - if (ret < 0) + if (ret) return ret; ret = alloc_private(dev, sizeof(struct atmio16d_private)); diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 8860207..53b0173 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -364,6 +364,7 @@ static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) unsigned int irq = 0; #endif struct pcmcia_device *link; + int ret; /* allocate and initialize dev->private */ if (alloc_private(dev, sizeof(struct dio700_private)) < 0) @@ -409,8 +410,9 @@ static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->board_name = thisboard->name; - if (comedi_alloc_subdevices(dev, 1) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 1); + if (ret) + return ret; /* DAQCard-700 dio */ s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c index 36c0c62..e27cae0 100644 --- a/drivers/staging/comedi/drivers/ni_daq_dio24.c +++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c @@ -116,6 +116,7 @@ static int dio24_attach(struct comedi_device *dev, struct comedi_devconfig *it) unsigned int irq = 0; #endif struct pcmcia_device *link; + int ret; /* allocate and initialize dev->private */ if (alloc_private(dev, sizeof(struct dio24_private)) < 0) @@ -158,8 +159,9 @@ static int dio24_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->board_name = thisboard->name; - if (comedi_alloc_subdevices(dev, 1) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 1); + if (ret) + return ret; /* 8255 dio */ s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c index a92570f5..ab8b787 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.c +++ b/drivers/staging/comedi/drivers/ni_labpc.c @@ -536,6 +536,7 @@ int labpc_common_attach(struct comedi_device *dev, unsigned long iobase, unsigned long dma_flags; #endif short lsb, msb; + int ret; printk(KERN_ERR "comedi%d: ni_labpc: %s, io 0x%lx", dev->minor, thisboard->name, @@ -622,8 +623,9 @@ int labpc_common_attach(struct comedi_device *dev, unsigned long iobase, dev->board_name = thisboard->name; - if (comedi_alloc_subdevices(dev, 5) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 5); + if (ret) + return ret; /* analog input subdevice */ s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 4261e92..1f796b9 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -4406,14 +4406,16 @@ static int ni_E_init(struct comedi_device *dev, struct comedi_devconfig *it) struct comedi_subdevice *s; unsigned j; enum ni_gpct_variant counter_variant; + int ret; if (boardtype.n_aochan > MAX_N_AO_CHAN) { printk("bug! boardtype.n_aochan > MAX_N_AO_CHAN\n"); return -EINVAL; } - if (comedi_alloc_subdevices(dev, NI_NUM_SUBDEVICES) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, NI_NUM_SUBDEVICES); + if (ret) + return ret; /* analog input subdevice */ diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c index 77ef312..cba0459 100644 --- a/drivers/staging/comedi/drivers/ni_pcidio.c +++ b/drivers/staging/comedi/drivers/ni_pcidio.c @@ -1249,7 +1249,7 @@ static int nidio_attach(struct comedi_device *dev, struct comedi_devconfig *it) n_subdevices = 1; ret = comedi_alloc_subdevices(dev, n_subdevices); - if (ret < 0) + if (ret) return ret; if (!this_board->is_diodaq) { diff --git a/drivers/staging/comedi/drivers/pcl711.c b/drivers/staging/comedi/drivers/pcl711.c index 35b9510..d5fa6f2 100644 --- a/drivers/staging/comedi/drivers/pcl711.c +++ b/drivers/staging/comedi/drivers/pcl711.c @@ -519,7 +519,7 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->irq = irq; ret = comedi_alloc_subdevices(dev, 4); - if (ret < 0) + if (ret) return ret; ret = alloc_private(dev, sizeof(struct pcl711_private)); diff --git a/drivers/staging/comedi/drivers/pcl724.c b/drivers/staging/comedi/drivers/pcl724.c index 698c900..c8fe23c 100644 --- a/drivers/staging/comedi/drivers/pcl724.c +++ b/drivers/staging/comedi/drivers/pcl724.c @@ -157,7 +157,7 @@ static int pcl724_attach(struct comedi_device *dev, struct comedi_devconfig *it) n_subdevices = 4; /* PCL-724 in 96 DIO configuration */ ret = comedi_alloc_subdevices(dev, n_subdevices); - if (ret < 0) + if (ret) return ret; for (i = 0; i < dev->n_subdevices; i++) { diff --git a/drivers/staging/comedi/drivers/pcl725.c b/drivers/staging/comedi/drivers/pcl725.c index d7ba336..8edbefd 100644 --- a/drivers/staging/comedi/drivers/pcl725.c +++ b/drivers/staging/comedi/drivers/pcl725.c @@ -52,6 +52,7 @@ static int pcl725_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; unsigned long iobase; + int ret; iobase = it->options[0]; printk(KERN_INFO "comedi%d: pcl725: 0x%04lx ", dev->minor, iobase); @@ -63,8 +64,9 @@ static int pcl725_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->iobase = iobase; dev->irq = 0; - if (comedi_alloc_subdevices(dev, 2) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 2); + if (ret) + return ret; s = dev->subdevices + 0; /* do */ diff --git a/drivers/staging/comedi/drivers/pcl726.c b/drivers/staging/comedi/drivers/pcl726.c index e756a303..b2e73cd 100644 --- a/drivers/staging/comedi/drivers/pcl726.c +++ b/drivers/staging/comedi/drivers/pcl726.c @@ -293,7 +293,7 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it) printk("\n"); ret = comedi_alloc_subdevices(dev, 3); - if (ret < 0) + if (ret) return ret; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/pcl730.c b/drivers/staging/comedi/drivers/pcl730.c index e258bce..3cba79a 100644 --- a/drivers/staging/comedi/drivers/pcl730.c +++ b/drivers/staging/comedi/drivers/pcl730.c @@ -72,6 +72,7 @@ static int pcl730_attach(struct comedi_device *dev, struct comedi_devconfig *it) struct comedi_subdevice *s; unsigned long iobase; unsigned int iorange; + int ret; iobase = it->options[0]; iorange = board->io_range; @@ -85,8 +86,9 @@ static int pcl730_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->iobase = iobase; dev->irq = 0; - if (comedi_alloc_subdevices(dev, 4) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 4); + if (ret) + return ret; s = dev->subdevices + 0; /* Isolated do */ diff --git a/drivers/staging/comedi/drivers/pcl812.c b/drivers/staging/comedi/drivers/pcl812.c index 128f5b6..0a4074a 100644 --- a/drivers/staging/comedi/drivers/pcl812.c +++ b/drivers/staging/comedi/drivers/pcl812.c @@ -1383,7 +1383,7 @@ no_dma: n_subdevices++; ret = comedi_alloc_subdevices(dev, n_subdevices); - if (ret < 0) { + if (ret) { free_resources(dev); return ret; } diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c index 37cedbc..c3ee6d6 100644 --- a/drivers/staging/comedi/drivers/pcl816.c +++ b/drivers/staging/comedi/drivers/pcl816.c @@ -1195,7 +1195,7 @@ no_dma: */ ret = comedi_alloc_subdevices(dev, 1); - if (ret < 0) + if (ret) return ret; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c index a4c2870..66b2570 100644 --- a/drivers/staging/comedi/drivers/pcl818.c +++ b/drivers/staging/comedi/drivers/pcl818.c @@ -1779,7 +1779,7 @@ no_rtc: no_dma: ret = comedi_alloc_subdevices(dev, 4); - if (ret < 0) + if (ret) return ret; s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/pcm3724.c b/drivers/staging/comedi/drivers/pcm3724.c index d755b40..62c22cc 100644 --- a/drivers/staging/comedi/drivers/pcm3724.c +++ b/drivers/staging/comedi/drivers/pcm3724.c @@ -259,7 +259,7 @@ static int pcm3724_attach(struct comedi_device *dev, n_subdevices = board->numofports; ret = comedi_alloc_subdevices(dev, n_subdevices); - if (ret < 0) + if (ret) return ret; for (i = 0; i < dev->n_subdevices; i++) { diff --git a/drivers/staging/comedi/drivers/pcm3730.c b/drivers/staging/comedi/drivers/pcm3730.c index 48a21bd..b48f7aa 100644 --- a/drivers/staging/comedi/drivers/pcm3730.c +++ b/drivers/staging/comedi/drivers/pcm3730.c @@ -59,6 +59,7 @@ static int pcm3730_attach(struct comedi_device *dev, { struct comedi_subdevice *s; unsigned long iobase; + int ret; iobase = it->options[0]; printk(KERN_INFO "comedi%d: pcm3730: 0x%04lx ", dev->minor, iobase); @@ -71,8 +72,9 @@ static int pcm3730_attach(struct comedi_device *dev, dev->iobase = dev->iobase; dev->irq = 0; - if (comedi_alloc_subdevices(dev, 6) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 6); + if (ret) + return ret; s = dev->subdevices + 0; s->type = COMEDI_SUBD_DO; diff --git a/drivers/staging/comedi/drivers/pcmad.c b/drivers/staging/comedi/drivers/pcmad.c index 00b0f2a..54d19c9 100644 --- a/drivers/staging/comedi/drivers/pcmad.c +++ b/drivers/staging/comedi/drivers/pcmad.c @@ -118,7 +118,7 @@ static int pcmad_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->iobase = iobase; ret = comedi_alloc_subdevices(dev, 1); - if (ret < 0) + if (ret) return ret; ret = alloc_private(dev, sizeof(struct pcmad_priv_struct)); diff --git a/drivers/staging/comedi/drivers/pcmda12.c b/drivers/staging/comedi/drivers/pcmda12.c index 87faa03..291ce7c 100644 --- a/drivers/staging/comedi/drivers/pcmda12.c +++ b/drivers/staging/comedi/drivers/pcmda12.c @@ -165,6 +165,7 @@ static int pcmda12_attach(struct comedi_device *dev, const struct pcmda12_board *board = comedi_board(dev); struct comedi_subdevice *s; unsigned long iobase; + int ret; iobase = it->options[0]; printk(KERN_INFO @@ -190,8 +191,9 @@ static int pcmda12_attach(struct comedi_device *dev, devpriv->simultaneous_xfer_mode = it->options[1]; - if (comedi_alloc_subdevices(dev, 1) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 1); + if (ret) + return ret; s = dev->subdevices; s->private = NULL; diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c index 3105303..0e64d84 100644 --- a/drivers/staging/comedi/drivers/pcmmio.c +++ b/drivers/staging/comedi/drivers/pcmmio.c @@ -1020,6 +1020,7 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) thisasic_chanct = 0; unsigned long iobase; unsigned int irq[MAX_ASICS]; + int ret; iobase = it->options[0]; irq[0] = it->options[1]; @@ -1072,8 +1073,9 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) return -ENOMEM; } - if (comedi_alloc_subdevices(dev, n_subdevs) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, n_subdevs); + if (ret) + return ret; /* First, AI */ sdev_no = 0; diff --git a/drivers/staging/comedi/drivers/pcmuio.c b/drivers/staging/comedi/drivers/pcmuio.c index 33ab4c6..48565fe 100644 --- a/drivers/staging/comedi/drivers/pcmuio.c +++ b/drivers/staging/comedi/drivers/pcmuio.c @@ -754,6 +754,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) int sdev_no, chans_left, n_subdevs, port, asic, thisasic_chanct = 0; unsigned long iobase; unsigned int irq[MAX_ASICS]; + int ret; iobase = it->options[0]; irq[0] = it->options[1]; @@ -801,8 +802,9 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) return -ENOMEM; } - if (comedi_alloc_subdevices(dev, n_subdevs) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, n_subdevs); + if (ret) + return ret; port = 0; asic = 0; diff --git a/drivers/staging/comedi/drivers/poc.c b/drivers/staging/comedi/drivers/poc.c index 1e954f9..a129cca 100644 --- a/drivers/staging/comedi/drivers/poc.c +++ b/drivers/staging/comedi/drivers/poc.c @@ -139,6 +139,7 @@ static int poc_attach(struct comedi_device *dev, struct comedi_devconfig *it) struct comedi_subdevice *s; unsigned long iobase; unsigned int iosize; + int ret; iobase = it->options[0]; printk(KERN_INFO "comedi%d: poc: using %s iobase 0x%lx\n", dev->minor, @@ -160,8 +161,10 @@ static int poc_attach(struct comedi_device *dev, struct comedi_devconfig *it) } dev->iobase = iobase; - if (comedi_alloc_subdevices(dev, 1) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 1); + if (ret) + return ret; + if (alloc_private(dev, sizeof(unsigned int) * board->n_chan) < 0) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index 38a13ba..a029147 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -872,7 +872,7 @@ static int daqp_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->iobase = local->link->resource[0]->start; ret = comedi_alloc_subdevices(dev, 4); - if (ret < 0) + if (ret) return ret; printk(KERN_INFO "comedi%d: attaching daqp%d (io 0x%04lx)\n", diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 445333b..c3c8097 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -1999,9 +1999,9 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Show board configuration */ printk(KERN_INFO "%s:", dev->board_name); - if (comedi_alloc_subdevices(dev, 4) < 0) - return -ENOMEM; - + ret = comedi_alloc_subdevices(dev, 4); + if (ret) + return ret; s = dev->subdevices + 0; dev->read_subdev = s; diff --git a/drivers/staging/comedi/drivers/rti800.c b/drivers/staging/comedi/drivers/rti800.c index a80f630..966ac2c 100644 --- a/drivers/staging/comedi/drivers/rti800.c +++ b/drivers/staging/comedi/drivers/rti800.c @@ -349,7 +349,7 @@ static int rti800_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->board_name = board->name; ret = comedi_alloc_subdevices(dev, 4); - if (ret < 0) + if (ret) return ret; ret = alloc_private(dev, sizeof(struct rti800_private)); diff --git a/drivers/staging/comedi/drivers/rti802.c b/drivers/staging/comedi/drivers/rti802.c index 1aacf3f..fc16508 100644 --- a/drivers/staging/comedi/drivers/rti802.c +++ b/drivers/staging/comedi/drivers/rti802.c @@ -92,6 +92,7 @@ static int rti802_attach(struct comedi_device *dev, struct comedi_devconfig *it) struct comedi_subdevice *s; int i; unsigned long iobase; + int ret; iobase = it->options[0]; printk(KERN_INFO "comedi%d: rti802: 0x%04lx ", dev->minor, iobase); @@ -103,10 +104,12 @@ static int rti802_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->board_name = "rti802"; - if (comedi_alloc_subdevices(dev, 1) < 0 - || alloc_private(dev, sizeof(struct rti802_private))) { + if (alloc_private(dev, sizeof(struct rti802_private))) return -ENOMEM; - } + + ret = comedi_alloc_subdevices(dev, 1); + if (ret) + return ret; s = dev->subdevices; /* ao subdevice */ diff --git a/drivers/staging/comedi/drivers/s526.c b/drivers/staging/comedi/drivers/s526.c index 6a30537..141bc9e 100644 --- a/drivers/staging/comedi/drivers/s526.c +++ b/drivers/staging/comedi/drivers/s526.c @@ -743,6 +743,7 @@ static int s526_attach(struct comedi_device *dev, struct comedi_devconfig *it) struct comedi_subdevice *s; int iobase; int i, n; + int ret; /* short value; */ /* int subdev_channel = 0; */ union cmReg cmReg; @@ -774,8 +775,9 @@ static int s526_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (alloc_private(dev, sizeof(struct s526_private)) < 0) return -ENOMEM; - if (comedi_alloc_subdevices(dev, 4) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 4); + if (ret) + return ret; s = dev->subdevices + 0; /* GENERAL-PURPOSE COUNTER/TIME (GPCT) */ diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index f2eeca5..32e03bc 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -595,8 +595,9 @@ static int s626_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->board_ptr = s626_boards; dev->board_name = thisboard->name; - if (comedi_alloc_subdevices(dev, 6) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 6); + if (ret) + return ret; dev->iobase = (unsigned long)devpriv->base_addr; dev->irq = devpriv->pdev->irq; diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c index dc41c04..e622973 100644 --- a/drivers/staging/comedi/drivers/serial2002.c +++ b/drivers/staging/comedi/drivers/serial2002.c @@ -780,6 +780,7 @@ static int serial2002_attach(struct comedi_device *dev, { const struct serial2002_board *board = comedi_board(dev); struct comedi_subdevice *s; + int ret; dev_dbg(dev->hw_dev, "comedi%d: attached\n", dev->minor); dev->board_name = board->name; @@ -792,8 +793,9 @@ static int serial2002_attach(struct comedi_device *dev, dev_dbg(dev->hw_dev, "/dev/ttyS%d @ %d\n", devpriv->port, devpriv->speed); - if (comedi_alloc_subdevices(dev, 5) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 5); + if (ret) + return ret; /* digital input subdevice */ s = dev->subdevices + 0; diff --git a/drivers/staging/comedi/drivers/skel.c b/drivers/staging/comedi/drivers/skel.c index ca10b1a..92d44c1d 100644 --- a/drivers/staging/comedi/drivers/skel.c +++ b/drivers/staging/comedi/drivers/skel.c @@ -210,6 +210,7 @@ static int skel_ns_to_timer(unsigned int *ns, int round); static int skel_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; + int ret; pr_info("comedi%d: skel: ", dev->minor); @@ -233,8 +234,9 @@ static int skel_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (alloc_private(dev, sizeof(struct skel_private)) < 0) return -ENOMEM; - if (comedi_alloc_subdevices(dev, 3) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 3); + if (ret) + return ret; s = dev->subdevices + 0; /* dev->read_subdev=s; */ diff --git a/drivers/staging/comedi/drivers/ssv_dnp.c b/drivers/staging/comedi/drivers/ssv_dnp.c index 130e4bd..b12bafe 100644 --- a/drivers/staging/comedi/drivers/ssv_dnp.c +++ b/drivers/staging/comedi/drivers/ssv_dnp.c @@ -187,6 +187,7 @@ static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it) { const struct dnp_board *board = comedi_board(dev); struct comedi_subdevice *s; + int ret; printk(KERN_INFO "comedi%d: dnp: ", dev->minor); @@ -197,8 +198,9 @@ static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (alloc_private(dev, sizeof(struct dnp_private_data)) < 0) return -ENOMEM; - if (comedi_alloc_subdevices(dev, 1) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 1); + if (ret) + return ret; s = dev->subdevices + 0; /* digital i/o subdevice */ diff --git a/drivers/staging/comedi/drivers/unioxx5.c b/drivers/staging/comedi/drivers/unioxx5.c index 711dad7..9f1fdec 100644 --- a/drivers/staging/comedi/drivers/unioxx5.c +++ b/drivers/staging/comedi/drivers/unioxx5.c @@ -443,6 +443,7 @@ static int unioxx5_attach(struct comedi_device *dev, { int iobase, i, n_subd; int id, num, ba; + int ret; iobase = it->options[0]; @@ -468,8 +469,9 @@ static int unioxx5_attach(struct comedi_device *dev, return -1; } - if (comedi_alloc_subdevices(dev, n_subd) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, n_subd); + if (ret) + return ret; /* initializing each of for same subdevices */ for (i = 0; i < n_subd; i++, iobase += UNIOXX5_SUBDEV_ODDS) { diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index a6cf134..0386fd4 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -2646,7 +2646,7 @@ static int usbdux_attach_common(struct comedi_device *dev, } ret = comedi_alloc_subdevices(dev, n_subdevs); - if (ret < 0) { + if (ret) { up(&udev->sem); return ret; } diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index f7d4f56..2ee9ecd 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c @@ -1667,7 +1667,7 @@ static int usbduxfast_attach(struct comedi_device *dev, dev->board_name = BOARDNAME; ret = comedi_alloc_subdevices(dev, 1); - if (ret < 0) { + if (ret) { up(&(usbduxfastsub[index].sem)); up(&start_stop_sem); return ret; diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index f23fad9..502a409 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -2691,7 +2691,7 @@ static int usbduxsigma_attach(struct comedi_device *dev, } ret = comedi_alloc_subdevices(dev, n_subdevs); - if (ret < 0) { + if (ret) { up(&udev->sem); up(&start_stop_sem); return ret; diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c index 5a3e33d..69402da 100644 --- a/drivers/staging/comedi/drivers/vmk80xx.c +++ b/drivers/staging/comedi/drivers/vmk80xx.c @@ -1135,6 +1135,7 @@ static int vmk80xx_attach(struct comedi_device *cdev, int n_subd; struct comedi_subdevice *s; int minor; + int ret; mutex_lock(&glb_mutex); @@ -1159,10 +1160,11 @@ static int vmk80xx_attach(struct comedi_device *cdev, else n_subd = 6; - if (comedi_alloc_subdevices(cdev, n_subd) < 0) { + ret = comedi_alloc_subdevices(cdev, n_subd); + if (ret) { up(&dev->limit_sem); mutex_unlock(&glb_mutex); - return -ENOMEM; + return ret; } /* Analog input subdevice */ -- cgit v0.10.2 From 03afcf472785a63d720202d28d51852d965a95d9 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 12 Jun 2012 11:59:55 -0700 Subject: staging: comedi: cleanup comedi_alloc_subdevices Access the individual comedi_subdevices using a pointer instead of directly accessing as an array. This is how the rest of the comedi core accesses them. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index ecad228..6af4a5b 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -58,21 +58,24 @@ struct comedi_driver *comedi_drivers; int comedi_alloc_subdevices(struct comedi_device *dev, int num_subdevices) { + struct comedi_subdevice *s; int i; if (num_subdevices < 1) return -EINVAL; - dev->subdevices = - kcalloc(num_subdevices, sizeof(struct comedi_subdevice), - GFP_KERNEL); - if (!dev->subdevices) + + s = kcalloc(num_subdevices, sizeof(*s), GFP_KERNEL); + if (!s) return -ENOMEM; + dev->subdevices = s; dev->n_subdevices = num_subdevices; + for (i = 0; i < num_subdevices; ++i) { - dev->subdevices[i].device = dev; - dev->subdevices[i].async_dma_dir = DMA_NONE; - spin_lock_init(&dev->subdevices[i].spin_lock); - dev->subdevices[i].minor = -1; + s = dev->subdevices + i; + s->device = dev; + s->async_dma_dir = DMA_NONE; + spin_lock_init(&s->spin_lock); + s->minor = -1; } return 0; } -- cgit v0.10.2 From 17c88eb6a09bafb75644b8c37fd65c89c8f49bec Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 8 Jun 2012 09:54:03 +0300 Subject: iio: frequency: ad9523: unlock on error in ad9523_reg_access() There was a return path which got missed accidentally. Signed-off-by: Dan Carpenter Acked-by: Michael Hennerich Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/iio/frequency/ad9523.c b/drivers/iio/frequency/ad9523.c index 7272924..832e6ab 100644 --- a/drivers/iio/frequency/ad9523.c +++ b/drivers/iio/frequency/ad9523.c @@ -731,10 +731,12 @@ static int ad9523_reg_access(struct iio_dev *indio_dev, } else { ret = ad9523_read(indio_dev, reg | AD9523_R1B); if (ret < 0) - return ret; + goto out_unlock; *readval = ret; ret = 0; } + +out_unlock: mutex_unlock(&indio_dev->mlock); return ret; -- cgit v0.10.2 From 227d5e0040ff18b6258ef6680e3c54150bb6b8b1 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Fri, 8 Jun 2012 08:54:17 +0200 Subject: iio: remove indio_dev pointer from max517_data Signed-off-by: Peter Meerwald Acked-by: Roland Stigge Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/iio/dac/max517.c b/drivers/iio/dac/max517.c index 92c77c8..352abe2 100644 --- a/drivers/iio/dac/max517.c +++ b/drivers/iio/dac/max517.c @@ -43,7 +43,6 @@ enum max517_device_ids { }; struct max517_data { - struct iio_dev *indio_dev; struct i2c_client *client; unsigned short vref_mv[2]; }; -- cgit v0.10.2 From f9eb89e97dec966981494c75ef7dc41630b0cb43 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Fri, 8 Jun 2012 08:54:18 +0200 Subject: iio: max517: mark probe() and remove() with __devinit and __devexit Signed-off-by: Peter Meerwald Acked-by: Roland Stigge Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/iio/dac/max517.c b/drivers/iio/dac/max517.c index 352abe2..c3d748c 100644 --- a/drivers/iio/dac/max517.c +++ b/drivers/iio/dac/max517.c @@ -156,7 +156,7 @@ static const struct iio_chan_spec max517_channels[] = { MAX517_CHANNEL(1) }; -static int max517_probe(struct i2c_client *client, +static int __devinit max517_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct max517_data *data; @@ -210,7 +210,7 @@ exit: return err; } -static int max517_remove(struct i2c_client *client) +static int __devexit max517_remove(struct i2c_client *client) { iio_device_unregister(i2c_get_clientdata(client)); iio_device_free(i2c_get_clientdata(client)); @@ -232,7 +232,7 @@ static struct i2c_driver max517_driver = { .pm = MAX517_PM_OPS, }, .probe = max517_probe, - .remove = max517_remove, + .remove = __devexit_p(max517_remove), .id_table = max517_id, }; module_i2c_driver(max517_driver); -- cgit v0.10.2 From e86ee142a223ec85efda7c66b3e99fe79aa8cc4f Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 8 Jun 2012 09:55:37 +0300 Subject: iio: frequency: adf4350: fix an initialization Sparse complains about this: drivers/iio/frequency/adf4350.c:58:29: warning: Initializer entry defined twice drivers/iio/frequency/adf4350.c:59:10: also defined here It looks like '|' was intended here instead of ','. Signed-off-by: Dan Carpenter Acked-by: Michael Hennerich Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c index 2d09f82..6ce45f5 100644 --- a/drivers/iio/frequency/adf4350.c +++ b/drivers/iio/frequency/adf4350.c @@ -54,7 +54,7 @@ struct adf4350_state { static struct adf4350_platform_data default_pdata = { .clkin = 122880000, .channel_spacing = 10000, - .r2_user_settings = ADF4350_REG2_PD_POLARITY_POS, + .r2_user_settings = ADF4350_REG2_PD_POLARITY_POS | ADF4350_REG2_CHARGE_PUMP_CURR_uA(2500), .r3_user_settings = ADF4350_REG3_12BIT_CLKDIV_MODE(0), .r4_user_settings = ADF4350_REG4_OUTPUT_PWR(3) | -- cgit v0.10.2 From 1a135d1ab5e3122ab2a50cbbdb9cb1504c1f421f Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 8 Jun 2012 09:54:32 +0300 Subject: iio: frequency: adf4350: using an uninitialized variable GCC complains that we use an uninitialized variable if the user passes an invalid parameter to adf4350_read(). I decided that we should return -EINVAL instead in that case. However, when I looked up at adf4350_write() it returned -ENODEV for that condition. In the end, I decided the -EINVAL was the right thing and I change adf4350_write() to match. Signed-off-by: Dan Carpenter Acked-by: Michael Hennerich Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c index 6ce45f5..59fbb3ae 100644 --- a/drivers/iio/frequency/adf4350.c +++ b/drivers/iio/frequency/adf4350.c @@ -272,7 +272,7 @@ static ssize_t adf4350_write(struct iio_dev *indio_dev, adf4350_sync_config(st); break; default: - ret = -ENODEV; + ret = -EINVAL; } mutex_unlock(&indio_dev->mlock); @@ -311,7 +311,7 @@ static ssize_t adf4350_read(struct iio_dev *indio_dev, val = !!(st->regs[ADF4350_REG2] & ADF4350_REG2_POWER_DOWN_EN); break; default: - ret = -ENODEV; + ret = -EINVAL; } mutex_unlock(&indio_dev->mlock); -- cgit v0.10.2 From cf35ad61aca2c0c8983fa1e140c901f6588aba7e Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Fri, 8 Jun 2012 18:06:45 +0200 Subject: iio: add mcp4725 I2C DAC driver v5: * fix warnings (Jonathan Cameron) v4: * remove unused indio_dev pointer in mcp4725_data (Jonathan Cameron) * use u16 instead of unsigned short in mcp4725_data (Jonathan Cameron) * #include mcp4725.h from linux/iio/dac/ v3: * move from staging to drivers/iio * switch to chan_spec * dev_get_drvdata() -> dev_to_iio_dev() * annotate probe() and remove() with __devinit and __devexit v2 (based on comments from Jonathan Cameron and Lars-Peter Clausen): * did NOT switch to chan_spec yet * rebase to staging-next tree, update iio header locations * dropped dac.h #include, not needed * strict_strtol() -> kstrtol() * call iio_device_unregister() in remove() * everything in one patch Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig index a626f03..92fb3a0 100644 --- a/drivers/iio/dac/Kconfig +++ b/drivers/iio/dac/Kconfig @@ -118,4 +118,15 @@ config MAX517 This driver can also be built as a module. If so, the module will be called max517. +config MCP4725 + tristate "MCP4725 DAC driver" + depends on I2C + ---help--- + Say Y here if you want to build a driver for the Microchip + MCP 4725 12-bit digital-to-analog converter (DAC) with I2C + interface. + + To compile this driver as a module, choose M here: the module + will be called mcp4725. + endmenu diff --git a/drivers/iio/dac/Makefile b/drivers/iio/dac/Makefile index 8ab1d26..9ea3cee 100644 --- a/drivers/iio/dac/Makefile +++ b/drivers/iio/dac/Makefile @@ -13,3 +13,4 @@ obj-$(CONFIG_AD5764) += ad5764.o obj-$(CONFIG_AD5791) += ad5791.o obj-$(CONFIG_AD5686) += ad5686.o obj-$(CONFIG_MAX517) += max517.o +obj-$(CONFIG_MCP4725) += mcp4725.o diff --git a/drivers/iio/dac/mcp4725.c b/drivers/iio/dac/mcp4725.c new file mode 100644 index 0000000..e0e168b --- /dev/null +++ b/drivers/iio/dac/mcp4725.c @@ -0,0 +1,227 @@ +/* + * mcp4725.c - Support for Microchip MCP4725 + * + * Copyright (C) 2012 Peter Meerwald + * + * Based on max517 by Roland Stigge + * + * This file is subject to the terms and conditions of version 2 of + * the GNU General Public License. See the file COPYING in the main + * directory of this archive for more details. + * + * driver for the Microchip I2C 12-bit digital-to-analog converter (DAC) + * (7-bit I2C slave address 0x60, the three LSBs can be configured in + * hardware) + * + * writing the DAC value to EEPROM is not supported + */ + +#include +#include +#include +#include + +#include +#include + +#include + +#define MCP4725_DRV_NAME "mcp4725" + +struct mcp4725_data { + struct i2c_client *client; + u16 vref_mv; + u16 dac_value; +}; + +#ifdef CONFIG_PM_SLEEP +static int mcp4725_suspend(struct device *dev) +{ + u8 outbuf[2]; + + outbuf[0] = 0x3 << 4; /* power-down bits, 500 kOhm resistor */ + outbuf[1] = 0; + + return i2c_master_send(to_i2c_client(dev), outbuf, 2); +} + +static int mcp4725_resume(struct device *dev) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + struct mcp4725_data *data = iio_priv(indio_dev); + u8 outbuf[2]; + + /* restore previous DAC value */ + outbuf[0] = (data->dac_value >> 8) & 0xf; + outbuf[1] = data->dac_value & 0xff; + + return i2c_master_send(to_i2c_client(dev), outbuf, 2); +} + +static SIMPLE_DEV_PM_OPS(mcp4725_pm_ops, mcp4725_suspend, mcp4725_resume); +#define MCP4725_PM_OPS (&mcp4725_pm_ops) +#else +#define MCP4725_PM_OPS NULL +#endif + +static const struct iio_chan_spec mcp4725_channel = { + .type = IIO_VOLTAGE, + .indexed = 1, + .output = 1, + .channel = 0, + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | + IIO_CHAN_INFO_SCALE_SHARED_BIT, + .scan_type = IIO_ST('u', 12, 16, 0), +}; + +static int mcp4725_set_value(struct iio_dev *indio_dev, int val) +{ + struct mcp4725_data *data = iio_priv(indio_dev); + u8 outbuf[2]; + int ret; + + if (val >= (1 << 12) || val < 0) + return -EINVAL; + + outbuf[0] = (val >> 8) & 0xf; + outbuf[1] = val & 0xff; + + ret = i2c_master_send(data->client, outbuf, 2); + if (ret < 0) + return ret; + else if (ret != 2) + return -EIO; + else + return 0; +} + +static int mcp4725_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, int *val2, long mask) +{ + struct mcp4725_data *data = iio_priv(indio_dev); + unsigned long scale_uv; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + *val = data->dac_value; + return IIO_VAL_INT; + case IIO_CHAN_INFO_SCALE: + scale_uv = (data->vref_mv * 1000) >> 12; + *val = scale_uv / 1000000; + *val2 = scale_uv % 1000000; + return IIO_VAL_INT_PLUS_MICRO; + } + return -EINVAL; +} + +static int mcp4725_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int val, int val2, long mask) +{ + struct mcp4725_data *data = iio_priv(indio_dev); + int ret; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + ret = mcp4725_set_value(indio_dev, val); + data->dac_value = val; + break; + default: + ret = -EINVAL; + break; + } + + return ret; +} + +static const struct iio_info mcp4725_info = { + .read_raw = mcp4725_read_raw, + .write_raw = mcp4725_write_raw, + .driver_module = THIS_MODULE, +}; + +static int __devinit mcp4725_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct mcp4725_data *data; + struct iio_dev *indio_dev; + struct mcp4725_platform_data *platform_data = client->dev.platform_data; + u8 inbuf[3]; + int err; + + if (!platform_data || !platform_data->vref_mv) { + dev_err(&client->dev, "invalid platform data"); + err = -EINVAL; + goto exit; + } + + indio_dev = iio_device_alloc(sizeof(*data)); + if (indio_dev == NULL) { + err = -ENOMEM; + goto exit; + } + data = iio_priv(indio_dev); + i2c_set_clientdata(client, indio_dev); + data->client = client; + + indio_dev->dev.parent = &client->dev; + indio_dev->info = &mcp4725_info; + indio_dev->channels = &mcp4725_channel; + indio_dev->num_channels = 1; + indio_dev->modes = INDIO_DIRECT_MODE; + + data->vref_mv = platform_data->vref_mv; + + /* read current DAC value */ + err = i2c_master_recv(client, inbuf, 3); + if (err < 0) { + dev_err(&client->dev, "failed to read DAC value"); + goto exit_free_device; + } + data->dac_value = (inbuf[1] << 4) | (inbuf[2] >> 4); + + err = iio_device_register(indio_dev); + if (err) + goto exit_free_device; + + dev_info(&client->dev, "MCP4725 DAC registered\n"); + + return 0; + +exit_free_device: + iio_device_free(indio_dev); +exit: + return err; +} + +static int __devexit mcp4725_remove(struct i2c_client *client) +{ + struct iio_dev *indio_dev = i2c_get_clientdata(client); + + iio_device_unregister(indio_dev); + iio_device_free(indio_dev); + + return 0; +} + +static const struct i2c_device_id mcp4725_id[] = { + { "mcp4725", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, mcp4725_id); + +static struct i2c_driver mcp4725_driver = { + .driver = { + .name = MCP4725_DRV_NAME, + .pm = MCP4725_PM_OPS, + }, + .probe = mcp4725_probe, + .remove = __devexit_p(mcp4725_remove), + .id_table = mcp4725_id, +}; +module_i2c_driver(mcp4725_driver); + +MODULE_AUTHOR("Peter Meerwald "); +MODULE_DESCRIPTION("MCP4725 12-bit DAC"); +MODULE_LICENSE("GPL"); diff --git a/include/linux/iio/dac/mcp4725.h b/include/linux/iio/dac/mcp4725.h new file mode 100644 index 0000000..91530e6 --- /dev/null +++ b/include/linux/iio/dac/mcp4725.h @@ -0,0 +1,16 @@ +/* + * MCP4725 DAC driver + * + * Copyright (C) 2012 Peter Meerwald + * + * Licensed under the GPL-2 or later. + */ + +#ifndef IIO_DAC_MCP4725_H_ +#define IIO_DAC_MCP4725_H_ + +struct mcp4725_platform_data { + u16 vref_mv; +}; + +#endif /* IIO_DAC_MCP4725_H_ */ -- cgit v0.10.2 From 011c10c351f3f081b496e2197db2948d120cc26c Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Mon, 11 Jun 2012 09:51:04 +0200 Subject: iio: ad9523: Fix argument type mismatch drivers/iio/frequency/ad9523.c:378 ad9523_vco_out_map() warn: value 2 can't fit into 1 'out' Signed-off-by: Michael Hennerich Reported-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/iio/frequency/ad9523.c b/drivers/iio/frequency/ad9523.c index 832e6ab..b737c64 100644 --- a/drivers/iio/frequency/ad9523.c +++ b/drivers/iio/frequency/ad9523.c @@ -361,7 +361,7 @@ static int ad9523_io_update(struct iio_dev *indio_dev) } static int ad9523_vco_out_map(struct iio_dev *indio_dev, - unsigned ch, bool out) + unsigned ch, unsigned out) { struct ad9523_state *st = iio_priv(indio_dev); int ret; -- cgit v0.10.2 From 988bb033d703c8b2e0e71c63f3f55616a0220ced Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Tue, 12 Jun 2012 14:39:37 +0200 Subject: iio: drop comment about 'real' channels Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h index 1b073b1..d086736 100644 --- a/include/linux/iio/types.h +++ b/include/linux/iio/types.h @@ -11,7 +11,6 @@ #define _IIO_TYPES_H_ enum iio_chan_type { - /* real channel types */ IIO_VOLTAGE, IIO_CURRENT, IIO_POWER, -- cgit v0.10.2 From 8b417d78ea486280bf8e908e76214c44c533ed3d Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Tue, 12 Jun 2012 15:31:27 +0200 Subject: iio: nitpicking on sysfs-bus-iio v2: address comments by Jonathan Cameron * add more output power down modes * spelling of etc. Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio index 5bc8a47..e0f68f6 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -40,9 +40,9 @@ Contact: linux-iio@vger.kernel.org Description: Some devices have internal clocks. This parameter sets the resulting sampling frequency. In many devices this - parameter has an effect on input filters etc rather than + parameter has an effect on input filters etc. rather than simply controlling when the input is sampled. As this - effects datardy triggers, hardware buffers and the sysfs + effects data ready triggers, hardware buffers and the sysfs direct access interfaces, it may be found in any of the relevant directories. If it effects all of the above then it is to be found in the base device directory. @@ -74,7 +74,7 @@ What: /sys/bus/iio/devices/iio:deviceX/in_voltageY_supply_raw KernelVersion: 2.6.35 Contact: linux-iio@vger.kernel.org Description: - Raw (unscaled no bias removal etc) voltage measurement from + Raw (unscaled no bias removal etc.) voltage measurement from channel Y. In special cases where the channel does not correspond to externally available input one of the named versions may be used. The number must always be specified and @@ -118,7 +118,7 @@ What: /sys/bus/iio/devices/iio:deviceX/in_temp_z_raw KernelVersion: 2.6.35 Contact: linux-iio@vger.kernel.org Description: - Raw (unscaled no bias removal etc) temperature measurement. + Raw (unscaled no bias removal etc.) temperature measurement. If an axis is specified it generally means that the temperature sensor is associated with one part of a compound device (e.g. a gyroscope axis). Units after application of scale and offset @@ -148,10 +148,9 @@ KernelVersion: 2.6.35 Contact: linux-iio@vger.kernel.org Description: Angular velocity about axis x, y or z (may be arbitrarily - assigned) Data converted by application of offset then scale to - radians per second. Has all the equivalent parameters as - per voltageY. Units after application of scale and offset are - radians per second. + assigned). Has all the equivalent parameters as per voltageY. + Units after application of scale and offset are radians per + second. What: /sys/bus/iio/devices/iio:deviceX/in_incli_x_raw What: /sys/bus/iio/devices/iio:deviceX/in_incli_y_raw @@ -161,7 +160,7 @@ Contact: linux-iio@vger.kernel.org Description: Inclination raw reading about axis x, y or z (may be arbitrarily assigned). Data converted by application of offset - and scale to Degrees. + and scale to degrees. What: /sys/bus/iio/devices/iio:deviceX/in_magn_x_raw What: /sys/bus/iio/devices/iio:deviceX/in_magn_y_raw @@ -203,7 +202,7 @@ Contact: linux-iio@vger.kernel.org Description: If known for a device, offset to be added to [Y]_raw prior to scaling by [Y]_scale in order to obtain value in the - units as specified in [y]_raw documentation. + units as specified in [Y]_raw documentation. Not present if the offset is always 0 or unknown. If Y or axis is not present, then the offset applies to all in channels of . @@ -248,7 +247,7 @@ What: /sys/bus/iio/devices/iio:deviceX/in_proximity0_calibbias KernelVersion: 2.6.35 Contact: linux-iio@vger.kernel.org Description: - Hardware applied calibration offset. (assumed to fix production + Hardware applied calibration offset (assumed to fix production inaccuracies). What /sys/bus/iio/devices/iio:deviceX/in_voltageY_calibscale @@ -265,7 +264,7 @@ what /sys/bus/iio/devices/iio:deviceX/in_proximity0_calibscale KernelVersion: 2.6.35 Contact: linux-iio@vger.kernel.org Description: - Hardware applied calibration scale factor. (assumed to fix + Hardware applied calibration scale factor (assumed to fix production inaccuracies). If shared across all channels, _calibscale is used. @@ -277,7 +276,7 @@ What: /sys/.../iio:deviceX/in_capacitance_scale_available KernelVersion: 2.635 Contact: linux-iio@vger.kernel.org Description: - If a discrete set of scale values are available, they + If a discrete set of scale values is available, they are listed in this attribute. What /sys/bus/iio/devices/iio:deviceX/out_voltageY_hardwaregain @@ -321,9 +320,11 @@ Contact: linux-iio@vger.kernel.org Description: Specifies the output powerdown mode. DAC output stage is disconnected from the amplifier and - 1kohm_to_gnd: connected to ground via an 1kOhm resistor - 100kohm_to_gnd: connected to ground via an 100kOhm resistor - three_state: left floating + 1kohm_to_gnd: connected to ground via an 1kOhm resistor, + 6kohm_to_gnd: connected to ground via a 6kOhm resistor, + 20kohm_to_gnd: connected to ground via a 20kOhm resistor, + 100kohm_to_gnd: connected to ground via an 100kOhm resistor, + three_state: left floating. For a list of available output power down options read outX_powerdown_mode_available. If Y is not present the mode is shared across all outputs. @@ -342,9 +343,10 @@ KernelVersion: 2.6.38 Contact: linux-iio@vger.kernel.org Description: Writing 1 causes output Y to enter the power down mode specified - by the corresponding outY_powerdown_mode. Clearing returns to - normal operation. Y may be suppressed if all outputs are - controlled together. + by the corresponding outY_powerdown_mode. DAC output stage is + disconnected from the amplifier. Clearing returns to normal + operation. Y may be suppressed if all outputs are controlled + together. What: /sys/bus/iio/devices/iio:deviceX/events KernelVersion: 2.6.35 @@ -390,12 +392,12 @@ Description: different values, but the device can only enable both thresholds or neither. Note the driver will assume the last p events requested are - to be enabled where p is however many it supports (which may - vary depending on the exact set requested. So if you want to be + to be enabled where p is how many it supports (which may vary + depending on the exact set requested. So if you want to be sure you have set what you think you have, check the contents of these attributes after everything is configured. Drivers may have to buffer any parameters so that they are consistent when - a given event type is enabled a future point (and not those for + a given event type is enabled at a future point (and not those for whatever event was previously enabled). What: /sys/.../iio:deviceX/events/in_accel_x_roc_rising_en @@ -671,7 +673,7 @@ What: /sys/.../buffer/scan_elements/in_anglvel_type What: /sys/.../buffer/scan_elements/in_magn_type What: /sys/.../buffer/scan_elements/in_incli_type What: /sys/.../buffer/scan_elements/in_voltageY_type -What: /sys/.../buffer/scan_elements/in_voltage-in_type +What: /sys/.../buffer/scan_elements/in_voltage_type What: /sys/.../buffer/scan_elements/in_voltageY_supply_type What: /sys/.../buffer/scan_elements/in_timestamp_type KernelVersion: 2.6.37 @@ -692,7 +694,7 @@ Description: the buffer output value appropriately. The storagebits value also specifies the data alignment. So s48/64>>2 will be a signed 48 bit integer stored in a 64 bit location aligned to - a a64 bit boundary. To obtain the clean value, shift right 2 + a 64 bit boundary. To obtain the clean value, shift right 2 and apply a mask to zero the top 16 bits of the result. For other storage combinations this attribute will be extended appropriately. -- cgit v0.10.2 From 1787948873fd2ca730fb5891b6a2ade510367ace Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Tue, 12 Jun 2012 15:38:45 +0200 Subject: iio: fix typos in iio.h v2: * "used in in-kernel" (Jonathan Cameron) Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index 944c635..01afaa0 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h @@ -131,7 +131,7 @@ struct iio_chan_spec_ext_info { /** * struct iio_enum - Enum channel info attribute - * items: A array of strings. + * items: An array of strings. * num_items: Length of the item array. * set: Set callback function, may be NULL. * get: Get callback function, may be NULL. @@ -218,7 +218,7 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev, * @extend_name: Allows labeling of channel attributes with an * informative name. Note this has no effect codes etc, * unlike modifiers. - * @datasheet_name: A name used in in kernel mapping of channels. It should + * @datasheet_name: A name used in in-kernel mapping of channels. It should * correspond to the first name that the channel is referred * to by in the datasheet (e.g. IND), or the nearest * possible compound name (e.g. IND-INC). @@ -393,7 +393,7 @@ struct iio_buffer_setup_ops { * @trig: [INTERN] current device trigger (buffer modes) * @pollfunc: [DRIVER] function run on trigger being received * @channels: [DRIVER] channel specification structure table - * @num_channels: [DRIVER] number of chanels specified in @channels. + * @num_channels: [DRIVER] number of channels specified in @channels. * @channel_attr_list: [INTERN] keep track of automatically created channel * attributes * @chan_attr_group: [INTERN] group for all attrs in base directory -- cgit v0.10.2 From a16561c6f713630270b905297f3eedf02db7fa98 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Tue, 12 Jun 2012 15:38:46 +0200 Subject: iio: clarify channel and indexed in struct iio_chan_spec Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index 01afaa0..9a9e6d5 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h @@ -196,7 +196,7 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev, /** * struct iio_chan_spec - specification of a single channel * @type: What type of measurement is the channel making. - * @channel: What number or name do we wish to assign the channel. + * @channel: What number do we wish to assign the channel. * @channel2: If there is a second number for a differential * channel then this is it. If modified is set then the * value here specifies the modifier. @@ -227,9 +227,8 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev, * channel2. Examples are IIO_MOD_X for axial sensors about * the 'x' axis. * @indexed: Specify the channel has a numerical index. If not, - * the value in channel will be suppressed for attribute - * but not for event codes. Typically set it to 0 when - * the index is false. + * the channel index number will be suppressed for sysfs + * attributes but not for event codes. * @differential: Channel is differential. */ struct iio_chan_spec { -- cgit v0.10.2 From f4c349395e8ad4fe07f1222502568f0d9d5d1dfc Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Tue, 12 Jun 2012 15:38:47 +0200 Subject: iio: mark struct iio_enum elements with @ in comment Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index 9a9e6d5..bd3e721 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h @@ -131,10 +131,10 @@ struct iio_chan_spec_ext_info { /** * struct iio_enum - Enum channel info attribute - * items: An array of strings. - * num_items: Length of the item array. - * set: Set callback function, may be NULL. - * get: Get callback function, may be NULL. + * @items: An array of strings. + * @num_items: Length of the item array. + * @set: Set callback function, may be NULL. + * @get: Get callback function, may be NULL. * * The iio_enum struct can be used to implement enum style channel attributes. * Enum style attributes are those which have a set of strings which map to -- cgit v0.10.2 From 7dcd7b60724cab551deba54f31752fa8959efab4 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Tue, 12 Jun 2012 15:38:48 +0200 Subject: iio: cleanup iio/iio.h indentation of parameter description, fix parameter name (@dev -> @indio_dev) in comments, IIO device info structure -> IIO device structure Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index bd3e721..ae0cad9 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h @@ -131,10 +131,10 @@ struct iio_chan_spec_ext_info { /** * struct iio_enum - Enum channel info attribute - * @items: An array of strings. - * @num_items: Length of the item array. - * @set: Set callback function, may be NULL. - * @get: Get callback function, may be NULL. + * @items: An array of strings. + * @num_items: Length of the item array. + * @set: Set callback function, may be NULL. + * @get: Get callback function, may be NULL. * * The iio_enum struct can be used to implement enum style channel attributes. * Enum style attributes are those which have a set of strings which map to @@ -162,9 +162,9 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev, /** * IIO_ENUM() - Initialize enum extended channel attribute - * @_name: Attribute name - * @_shared: Whether the attribute is shared between all channels - * @_e: Pointer to a iio_enum struct + * @_name: Attribute name + * @_shared: Whether the attribute is shared between all channels + * @_e: Pointer to a iio_enum struct * * This should usually be used together with IIO_ENUM_AVAILABLE() */ @@ -179,8 +179,8 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev, /** * IIO_ENUM_AVAILABLE() - Initialize enum available extended channel attribute - * @_name: Attribute name ("_available" will be appended to the name) - * @_e: Pointer to a iio_enum struct + * @_name: Attribute name ("_available" will be appended to the name) + * @_e: Pointer to a iio_enum struct * * Creates a read only attribute which list all the available enum items in a * space separated list. This should usually be used together with IIO_ENUM() @@ -201,7 +201,7 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev, * channel then this is it. If modified is set then the * value here specifies the modifier. * @address: Driver specific identifier. - * @scan_index: Monotonic index to give ordering in scans when read + * @scan_index: Monotonic index to give ordering in scans when read * from a buffer. * @scan_type: Sign: 's' or 'u' to specify signed or unsigned * realbits: Number of valid bits of data @@ -211,7 +211,7 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev, * endianness: little or big endian * @info_mask: What information is to be exported about this channel. * This includes calibbias, scale etc. - * @event_mask: What events can this channel produce. + * @event_mask: What events can this channel produce. * @ext_info: Array of extended info attributes for this channel. * The array is NULL terminated, the last element should * have it's name field set to NULL. @@ -482,7 +482,7 @@ extern struct bus_type iio_bus_type; /** * iio_device_put() - reference counted deallocation of struct device - * @dev: the iio_device containing the device + * @indio_dev: IIO device structure containing the device **/ static inline void iio_device_put(struct iio_dev *indio_dev) { @@ -492,7 +492,7 @@ static inline void iio_device_put(struct iio_dev *indio_dev) /** * dev_to_iio_dev() - Get IIO device struct from a device struct - * @dev: The device embedded in the IIO device + * @dev: The device embedded in the IIO device * * Note: The device must be a IIO device, otherwise the result is undefined. */ @@ -503,7 +503,7 @@ static inline struct iio_dev *dev_to_iio_dev(struct device *dev) /** * iio_device_get() - increment reference count for the device - * @indio_dev: IIO device structure + * @indio_dev: IIO device structure * * Returns: The passed IIO device **/ @@ -516,7 +516,7 @@ static inline struct iio_dev *iio_device_get(struct iio_dev *indio_dev) #define IIO_ALIGN L1_CACHE_BYTES /** * iio_device_alloc() - allocate an iio_dev from a driver - * @sizeof_priv: Space to allocate for private structure. + * @sizeof_priv: Space to allocate for private structure. **/ struct iio_dev *iio_device_alloc(int sizeof_priv); @@ -533,13 +533,13 @@ static inline struct iio_dev *iio_priv_to_dev(void *priv) /** * iio_device_free() - free an iio_dev from a driver - * @dev: the iio_dev associated with the device + * @indio_dev: the iio_dev associated with the device **/ void iio_device_free(struct iio_dev *indio_dev); /** * iio_buffer_enabled() - helper function to test if the buffer is enabled - * @indio_dev: IIO device info structure for device + * @indio_dev: IIO device structure for device **/ static inline bool iio_buffer_enabled(struct iio_dev *indio_dev) { @@ -549,7 +549,7 @@ static inline bool iio_buffer_enabled(struct iio_dev *indio_dev) /** * iio_get_debugfs_dentry() - helper function to get the debugfs_dentry - * @indio_dev: IIO device info structure for device + * @indio_dev: IIO device structure for device **/ #if defined(CONFIG_DEBUG_FS) static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev) -- cgit v0.10.2 From 95dc690eb7cc394a7b5749ecf0118e2f2e011e69 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 12 Jun 2012 15:58:29 -0700 Subject: staging: comedi: remove check for PCI_SUPPORT_VER1 This symbol is not defined in the kernel. It appears to be left over from the 2.4 kernel. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h b/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h index d70ac8b..95f7dc6 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h @@ -22,10 +22,6 @@ #include "../../comedidev.h" -#ifdef PCI_SUPPORT_VER1 -#error No support for 2.1.55 and older -#endif - /* written on base0 */ #define FIFO_ADVANCE_ON_BYTE_2 0x20000000 diff --git a/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h b/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h index 349e93c..c26c28c 100644 --- a/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h +++ b/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h @@ -23,10 +23,6 @@ #include #include "../../comedidev.h" -#ifdef PCI_SUPPORT_VER1 -#error Sorry, no support for 2.1.55 and older! :-(((( -#endif - /***********Added by sarath for compatibility with APCI3120 *************************/ -- cgit v0.10.2 From f922ffc0b52f8ee9e7503e769fa6931cb51635ab Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Wed, 13 Jun 2012 20:44:34 +0200 Subject: staging bcm: spelling of suppress in comments Signed-off-by: Peter Meerwald Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c index a6e6151..c0862c6 100644 --- a/drivers/staging/bcm/PHSModule.c +++ b/drivers/staging/bcm/PHSModule.c @@ -54,8 +54,8 @@ Function: PHSTransmit Description: This routine handle PHS(Payload Header Suppression for Tx path. It extracts a fragment of the NDIS_PACKET containing the header - to be suppressed.It then supresses the header by invoking PHS exported compress routine. - The header data after supression is copied back to the NDIS_PACKET. + to be suppressed. It then suppresses the header by invoking PHS exported compress routine. + The header data after suppression is copied back to the NDIS_PACKET. Input parameters: IN struct bcm_mini_adapter *Adapter - Miniport Adapter Context @@ -101,7 +101,7 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, if(!bEthCSSupport) BytesToRemove=ETH_HLEN; /* - Accumulate the header upto the size we support supression + Accumulate the header upto the size we support suppression from NDIS packet */ @@ -125,7 +125,7 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, { - // Step 2 Supress Header using PHS and fill into intermediate ucaPHSPktHdrOutBuf. + // Step 2 Suppress Header using PHS and fill into intermediate ucaPHSPktHdrOutBuf. // Suppress only if IP Header and PHS Enabled For the Service Flow if(((usPacketType == ETHERNET_FRAMETYPE_IPV4) || (usPacketType == ETHERNET_FRAMETYPE_IPV6)) && @@ -238,7 +238,7 @@ int PHSReceive(struct bcm_mini_adapter *Adapter, &nTotalsupressedPktHdrBytes, &nStandardPktHdrLen); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nSupressed PktHdrLen : 0x%x Restored PktHdrLen : 0x%x", + BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nSuppressed PktHdrLen : 0x%x Restored PktHdrLen : 0x%x", nTotalsupressedPktHdrBytes,nStandardPktHdrLen); if(ulPhsStatus != STATUS_PHS_COMPRESSED) diff --git a/drivers/staging/bcm/cntrl_SignalingInterface.h b/drivers/staging/bcm/cntrl_SignalingInterface.h index ab13180..7619e4b 100644 --- a/drivers/staging/bcm/cntrl_SignalingInterface.h +++ b/drivers/staging/bcm/cntrl_SignalingInterface.h @@ -117,7 +117,7 @@ typedef struct _stPhsRuleSI { B_UINT8 u8PHSM[MAX_PHS_LENGTHS]; /** 8bit Total number of bytes to be suppressed for the Service Flow*/ B_UINT8 u8PHSS; - /** 8bit Indicates whether or not Packet Header contents need to be verified prior to supression */ + /** 8bit Indicates whether or not Packet Header contents need to be verified prior to suppression */ B_UINT8 u8PHSV; /** Vendor Specific PHS param Length Of The Service Flow*/ B_UINT8 u8VendorSpecificPHSParamsLength; -- cgit v0.10.2 From b38e274fdb6dfa2dd77598b8b6e2c32d7608f494 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Wed, 13 Jun 2012 20:44:35 +0200 Subject: staging bcm: spelling of suppress in code Signed-off-by: Peter Meerwald Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index 11d2c5a..4d490a9 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -54,9 +54,9 @@ typedef union _U_IP_ADDRESS { }; } U_IP_ADDRESS; -struct bcm_hdr_supression_contextinfo { - UCHAR ucaHdrSupressionInBuf[MAX_PHS_LENGTHS]; /* Intermediate buffer to accumulate pkt Header for PHS */ - UCHAR ucaHdrSupressionOutBuf[MAX_PHS_LENGTHS + PHSI_LEN]; /* Intermediate buffer containing pkt Header after PHS */ +struct bcm_hdr_suppression_contextinfo { + UCHAR ucaHdrSuppressionInBuf[MAX_PHS_LENGTHS]; /* Intermediate buffer to accumulate pkt Header for PHS */ + UCHAR ucaHdrSuppressionOutBuf[MAX_PHS_LENGTHS + PHSI_LEN]; /* Intermediate buffer containing pkt Header after PHS */ }; struct bcm_classifier_rule { @@ -334,7 +334,7 @@ struct bcm_mini_adapter { BOOLEAN bLinkDownRequested; int downloadDDR; PHS_DEVICE_EXTENSION stBCMPhsContext; - struct bcm_hdr_supression_contextinfo stPhsTxContextInfo; + struct bcm_hdr_suppression_contextinfo stPhsTxContextInfo; uint8_t ucaPHSPktRestoreBuf[2048]; uint8_t bPHSEnabled; BOOLEAN AutoFirmDld; diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c index c0862c6..4795742 100644 --- a/drivers/staging/bcm/PHSModule.c +++ b/drivers/staging/bcm/PHSModule.c @@ -84,10 +84,10 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, UINT unPHSNewPktHeaderLen = 0; /* Pointer to PHS IN Hdr Buffer */ PUCHAR pucPHSPktHdrInBuf = - Adapter->stPhsTxContextInfo.ucaHdrSupressionInBuf; + Adapter->stPhsTxContextInfo.ucaHdrSuppressionInBuf; /* Pointer to PHS OUT Hdr Buffer */ PUCHAR pucPHSPktHdrOutBuf = - Adapter->stPhsTxContextInfo.ucaHdrSupressionOutBuf; + Adapter->stPhsTxContextInfo.ucaHdrSuppressionOutBuf; UINT usPacketType; UINT BytesToRemove=0; BOOLEAN bPHSI = 0; @@ -217,7 +217,7 @@ int PHSReceive(struct bcm_mini_adapter *Adapter, UINT bHeaderSuppressionEnabled) { u32 nStandardPktHdrLen = 0; - u32 nTotalsupressedPktHdrBytes = 0; + u32 nTotalsuppressedPktHdrBytes = 0; int ulPhsStatus = 0; PUCHAR pucInBuff = NULL ; UINT TotalBytesAdded = 0; @@ -235,11 +235,11 @@ int PHSReceive(struct bcm_mini_adapter *Adapter, usVcid, pucInBuff, Adapter->ucaPHSPktRestoreBuf, - &nTotalsupressedPktHdrBytes, + &nTotalsuppressedPktHdrBytes, &nStandardPktHdrLen); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nSuppressed PktHdrLen : 0x%x Restored PktHdrLen : 0x%x", - nTotalsupressedPktHdrBytes,nStandardPktHdrLen); + nTotalsuppressedPktHdrBytes,nStandardPktHdrLen); if(ulPhsStatus != STATUS_PHS_COMPRESSED) { @@ -248,7 +248,7 @@ int PHSReceive(struct bcm_mini_adapter *Adapter, } else { - TotalBytesAdded = nStandardPktHdrLen - nTotalsupressedPktHdrBytes - PHSI_LEN; + TotalBytesAdded = nStandardPktHdrLen - nTotalsuppressedPktHdrBytes - PHSI_LEN; if(TotalBytesAdded) { if(skb_headroom(packet) >= (SKB_RESERVE_ETHERNET_HEADER + TotalBytesAdded)) @@ -1494,7 +1494,7 @@ static int phs_compress(S_PHS_RULE *phs_rule,unsigned char *in_buf ,unsigned char *out_buf,UINT *header_size,UINT *new_header_size) { unsigned char *old_addr = out_buf; - int supress = 0; + int suppress = 0; struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); if(phs_rule == NULL) { @@ -1514,10 +1514,10 @@ static int phs_compress(S_PHS_RULE *phs_rule,unsigned char *in_buf } //To copy PHSI out_buf++; - supress = verify_suppress_phsf(in_buf,out_buf,phs_rule->u8PHSF, + suppress = verify_suppress_phsf(in_buf,out_buf,phs_rule->u8PHSF, phs_rule->u8PHSM, phs_rule->u8PHSS, phs_rule->u8PHSV,new_header_size); - if(supress == STATUS_PHS_COMPRESSED) + if(suppress == STATUS_PHS_COMPRESSED) { *old_addr = (unsigned char)phs_rule->u8PHSI; BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nCOMP:In phs_compress phsi %d",phs_rule->u8PHSI); @@ -1527,7 +1527,7 @@ static int phs_compress(S_PHS_RULE *phs_rule,unsigned char *in_buf *old_addr = ZERO_PHSI; BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nCOMP:In phs_compress PHSV Verification failed"); } - return supress; + return suppress; } -- cgit v0.10.2 From a2c49a9ac993fa2b4795890d5fa56f2fc002453e Mon Sep 17 00:00:00 2001 From: William Blair Date: Wed, 13 Jun 2012 01:16:49 -0400 Subject: Staging: keucr: scsiglue: fixed a do while coding style issue Added a do ... while (0) to a multi statement macro and reformatted a similar macro. Signed-off-by: William Blair Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/keucr/scsiglue.c b/drivers/staging/keucr/scsiglue.c index e1f3931..083b20e 100644 --- a/drivers/staging/keucr/scsiglue.c +++ b/drivers/staging/keucr/scsiglue.c @@ -230,7 +230,10 @@ void usb_stor_report_bus_reset(struct us_data *us) /* we use this macro to help us write into the buffer */ #undef SPRINTF #define SPRINTF(args...) \ - do { if (pos < buffer+length) pos += sprintf(pos, ## args); } while (0) + do { \ + if (pos < buffer+length) \ + pos += sprintf(pos, ## args); \ + } while (0) /* * proc_info() @@ -279,8 +282,10 @@ static int proc_info(struct Scsi_Host *host, char *buffer, char **start, pos += sprintf(pos, " Quirks:"); #define US_FLAG(name, value) \ - if (us->fflags & value)\ - pos += sprintf(pos, " " #name); + do { \ + if (us->fflags & value) \ + pos += sprintf(pos, " " #name); \ + } while (0); US_DO_ALL_FLAGS #undef US_FLAG -- cgit v0.10.2 From e888fabd10cdd46a4b46bcc029c5c6d2364dab7f Mon Sep 17 00:00:00 2001 From: Chris Yungmann Date: Wed, 13 Jun 2012 12:39:55 -0400 Subject: staging: speakup: fixed checkpatch and sparse warnings in selection.c Signed-off-by: Chris Yungmann Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/speakup/selection.c b/drivers/staging/speakup/selection.c index fe1f405..0612df0 100644 --- a/drivers/staging/speakup/selection.c +++ b/drivers/staging/speakup/selection.c @@ -68,7 +68,7 @@ int speakup_set_selection(struct tty_struct *tty) if (spk_sel_cons != vc_cons[fg_console].d) { speakup_clear_selection(); spk_sel_cons = vc_cons[fg_console].d; - printk(KERN_WARNING + dev_warn(tty->dev, "Selection: mark console not the same as cut\n"); return -EINVAL; } @@ -95,7 +95,7 @@ int speakup_set_selection(struct tty_struct *tty) /* Allocate a new buffer before freeing the old one ... */ bp = kmalloc((sel_end-sel_start)/2+1, GFP_ATOMIC); if (!bp) { - printk(KERN_WARNING "selection: kmalloc() failed\n"); + dev_warn(tty->dev, "selection: kmalloc() failed\n"); speakup_clear_selection(); return -ENOMEM; } @@ -141,7 +141,7 @@ int speakup_paste_selection(struct tty_struct *tty) count = sel_buffer_lth - pasted; count = min_t(int, count, tty->receive_room); tty->ldisc->ops->receive_buf(tty, sel_buffer + pasted, - 0, count); + NULL, count); pasted += count; } remove_wait_queue(&vc->paste_wait, &wait); -- cgit v0.10.2 From 4829a9967dbe3a3ab192df0bfdde281960cc1319 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 12 Jun 2012 17:37:10 -0700 Subject: staging: comedi: Kconfig: cleanup depends on logic All of the config options for comedi depend on COMEDI being selected. Wrap everything in an 'if COMEDI/endif' block and remove all the individual 'depends on COMEDI' in the Kconfig. Also, remove the redundant && ISA/PCI/PCMCIA/USB for the if blocks with those driver types. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 54e32da..848cf7e 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -6,9 +6,10 @@ config COMEDI Enable support a wide range of data acquisition devices for Linux. +if COMEDI + config COMEDI_DEBUG bool "Comedi debugging" - depends on COMEDI != n ---help--- This is an option for use by developers; most people should say N here. This enables comedi core and driver debugging. @@ -16,7 +17,6 @@ config COMEDI_DEBUG config COMEDI_DEFAULT_BUF_SIZE_KB int "Comedi default initial asynchronous buffer size in KiB" default "2048" - depends on COMEDI != n ---help--- This is the default asynchronous buffer size which is used for commands running in the background in kernel space. This @@ -26,7 +26,6 @@ config COMEDI_DEFAULT_BUF_SIZE_KB config COMEDI_DEFAULT_BUF_MAXSIZE_KB int "Comedi default maximum asynchronous buffer size in KiB" default "20480" - depends on COMEDI != n ---help--- This is the default maximum asynchronous buffer size which can be requested by a userspace program without root privileges. @@ -35,7 +34,6 @@ config COMEDI_DEFAULT_BUF_MAXSIZE_KB menuconfig COMEDI_MISC_DRIVERS tristate "Comedi misc drivers" - depends on COMEDI ---help--- Enable comedi misc drivers to be built @@ -103,7 +101,7 @@ endif # COMEDI_MISC_DRIVERS menuconfig COMEDI_ISA_DRIVERS tristate "Comedi ISA and PC/104 drivers" - depends on COMEDI && ISA + depends on ISA ---help--- Enable comedi ISA and PC/104 drivers to be built @@ -111,7 +109,7 @@ menuconfig COMEDI_ISA_DRIVERS kernel: saying N will just cause the configurator to skip all the questions about ISA and PC/104 comedi drivers. -if COMEDI_ISA_DRIVERS && ISA +if COMEDI_ISA_DRIVERS config COMEDI_ACL7225B tristate "ADlink NuDAQ ACL-7225b and compatibles support" @@ -543,7 +541,7 @@ endif # COMEDI_ISA_DRIVERS menuconfig COMEDI_PCI_DRIVERS tristate "Comedi PCI drivers" - depends on COMEDI && PCI + depends on PCI ---help--- Enable comedi PCI drivers to be built @@ -551,7 +549,7 @@ menuconfig COMEDI_PCI_DRIVERS kernel: saying N will just cause the configurator to skip all the questions about PCI comedi drivers. -if COMEDI_PCI_DRIVERS && PCI +if COMEDI_PCI_DRIVERS config COMEDI_ADDI_APCI_035 tristate "ADDI-DATA APCI_035 support" @@ -1099,7 +1097,7 @@ endif # COMEDI_PCI_DRIVERS menuconfig COMEDI_PCMCIA_DRIVERS tristate "Comedi PCMCIA drivers" - depends on COMEDI && (PCMCIA || PCCARD) + depends on (PCMCIA || PCCARD) ---help--- Enable comedi PCMCIA and PCCARD drivers to be built @@ -1107,7 +1105,7 @@ menuconfig COMEDI_PCMCIA_DRIVERS kernel: saying N will just cause the configurator to skip all the questions about PCMCIA comedi drivers. -if COMEDI_PCMCIA_DRIVERS && PCMCIA +if COMEDI_PCMCIA_DRIVERS config COMEDI_CB_DAS16_CS tristate "CB DAS16 series PCMCIA support" @@ -1182,7 +1180,7 @@ endif # COMEDI_PCMCIA_DRIVERS menuconfig COMEDI_USB_DRIVERS tristate "Comedi USB drivers" - depends on COMEDI && USB + depends on USB ---help--- Enable comedi USB drivers to be built @@ -1190,7 +1188,7 @@ menuconfig COMEDI_USB_DRIVERS kernel: saying N will just cause the configurator to skip all the questions about USB comedi drivers. -if COMEDI_USB_DRIVERS && USB +if COMEDI_USB_DRIVERS config COMEDI_DT9812 tristate "DataTranslation DT9812 USB module support" @@ -1290,7 +1288,6 @@ endif # COMEDI_NI_COMMON config COMEDI_8255 tristate "Generic 8255 support" - depends on COMEDI ---help--- Enable generic 8255 support. @@ -1306,23 +1303,20 @@ config COMEDI_8255 config COMEDI_FC tristate - depends on COMEDI config COMEDI_AMPLC_DIO200 tristate - depends on COMEDI select COMEDI_8255 config COMEDI_AMPLC_PC236 tristate - depends on COMEDI select COMEDI_8255 config COMEDI_AMPLC_PC263 tristate - depends on COMEDI config COMEDI_DAS08 tristate - depends on COMEDI select COMEDI_8255 + +endif # COMEDI -- cgit v0.10.2 From 71f882fe71823c54ae095ce29ce050f814eefdbc Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Sun, 20 May 2012 00:23:26 +0530 Subject: staging: android: alarm: remove unnecessary goto statement Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/android/alarm-dev.c b/drivers/staging/android/alarm-dev.c index c2d87c5..5b70640 100644 --- a/drivers/staging/android/alarm-dev.c +++ b/drivers/staging/android/alarm-dev.c @@ -237,7 +237,6 @@ from_old_alarm_set: default: rv = -EINVAL; - goto err1; } err1: return rv; -- cgit v0.10.2 From f29e5956aebafe63f81e80f972c44c4a666e5c7f Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Sat, 26 May 2012 06:20:19 -0700 Subject: pstore: Add console log messages support Pstore doesn't support logging kernel messages in run-time, it only dumps dmesg when kernel oopses/panics. This makes pstore useless for debugging hangs caused by HW issues or improper use of HW (e.g. weird device inserted -> driver tried to write a reserved bits -> SoC hanged. In that case we don't get any messages in the pstore. Therefore, let's add a runtime logging support: PSTORE_TYPE_CONSOLE. Signed-off-by: Anton Vorontsov Acked-by: Kees Cook Acked-by: Colin Cross Signed-off-by: Greg Kroah-Hartman diff --git a/fs/pstore/Kconfig b/fs/pstore/Kconfig index 23ade26..d044de6 100644 --- a/fs/pstore/Kconfig +++ b/fs/pstore/Kconfig @@ -12,6 +12,13 @@ config PSTORE If you don't have a platform persistent store driver, say N. +config PSTORE_CONSOLE + bool "Log kernel console messages" + depends on PSTORE + help + When the option is enabled, pstore will log all kernel + messages, even if no oops or panic happened. + config PSTORE_RAM tristate "Log panic/oops to a RAM buffer" depends on PSTORE diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c index 11a2aa2..45bff54 100644 --- a/fs/pstore/inode.c +++ b/fs/pstore/inode.c @@ -212,6 +212,9 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, case PSTORE_TYPE_DMESG: sprintf(name, "dmesg-%s-%lld", psname, id); break; + case PSTORE_TYPE_CONSOLE: + sprintf(name, "console-%s", psname); + break; case PSTORE_TYPE_MCE: sprintf(name, "mce-%s-%lld", psname, id); break; diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 82c585f..61461ed 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -1,6 +1,7 @@ /* * Persistent Storage - platform driver interface parts. * + * Copyright (C) 2007-2008 Google, Inc. * Copyright (C) 2010 Intel Corporation * * This program is free software; you can redistribute it and/or modify @@ -22,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -156,6 +158,40 @@ static struct kmsg_dumper pstore_dumper = { .dump = pstore_dump, }; +#ifdef CONFIG_PSTORE_CONSOLE +static void pstore_console_write(struct console *con, const char *s, unsigned c) +{ + const char *e = s + c; + + while (s < e) { + unsigned long flags; + + if (c > psinfo->bufsize) + c = psinfo->bufsize; + spin_lock_irqsave(&psinfo->buf_lock, flags); + memcpy(psinfo->buf, s, c); + psinfo->write(PSTORE_TYPE_CONSOLE, 0, NULL, 0, c, psinfo); + spin_unlock_irqrestore(&psinfo->buf_lock, flags); + s += c; + c = e - s; + } +} + +static struct console pstore_console = { + .name = "pstore", + .write = pstore_console_write, + .flags = CON_PRINTBUFFER | CON_ENABLED | CON_ANYTIME, + .index = -1, +}; + +static void pstore_register_console(void) +{ + register_console(&pstore_console); +} +#else +static void pstore_register_console(void) {} +#endif + /* * platform specific persistent storage driver registers with * us here. If pstore is already mounted, call the platform @@ -193,6 +229,7 @@ int pstore_register(struct pstore_info *psi) pstore_get_records(0); kmsg_dump_register(&pstore_dumper); + pstore_register_console(); pstore_timer.expires = jiffies + PSTORE_INTERVAL; add_timer(&pstore_timer); diff --git a/include/linux/pstore.h b/include/linux/pstore.h index e1461e1..1bd014b 100644 --- a/include/linux/pstore.h +++ b/include/linux/pstore.h @@ -29,6 +29,7 @@ enum pstore_type_id { PSTORE_TYPE_DMESG = 0, PSTORE_TYPE_MCE = 1, + PSTORE_TYPE_CONSOLE = 2, PSTORE_TYPE_UNKNOWN = 255 }; -- cgit v0.10.2 From cac2eb7b580c95e3871a71276c99e2bd751a1624 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Sat, 26 May 2012 06:20:20 -0700 Subject: pstore/ram: Give proper names to dump-related variables We're about to add support for other message types, so let's rename some variables to not be confused later. Signed-off-by: Anton Vorontsov Acked-by: Kees Cook Signed-off-by: Greg Kroah-Hartman diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 453030f..9b274b9 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -68,9 +68,9 @@ struct ramoops_context { size_t record_size; int dump_oops; bool ecc; - unsigned int count; - unsigned int max_count; - unsigned int read_count; + unsigned int max_dump_cnt; + unsigned int dump_write_cnt; + unsigned int dump_read_cnt; struct pstore_info pstore; }; @@ -81,7 +81,7 @@ static int ramoops_pstore_open(struct pstore_info *psi) { struct ramoops_context *cxt = psi->data; - cxt->read_count = 0; + cxt->dump_read_cnt = 0; return 0; } @@ -94,10 +94,10 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type, struct ramoops_context *cxt = psi->data; struct persistent_ram_zone *prz; - if (cxt->read_count >= cxt->max_count) + if (cxt->dump_read_cnt >= cxt->max_dump_cnt) return -EINVAL; - *id = cxt->read_count++; + *id = cxt->dump_read_cnt++; prz = cxt->przs[*id]; /* Only supports dmesg output so far. */ @@ -141,7 +141,7 @@ static int ramoops_pstore_write(enum pstore_type_id type, size_t size, struct pstore_info *psi) { struct ramoops_context *cxt = psi->data; - struct persistent_ram_zone *prz = cxt->przs[cxt->count]; + struct persistent_ram_zone *prz = cxt->przs[cxt->dump_write_cnt]; size_t hlen; /* Currently ramoops is designed to only store dmesg dumps. */ @@ -172,7 +172,7 @@ static int ramoops_pstore_write(enum pstore_type_id type, size = prz->buffer_size - hlen; persistent_ram_write(prz, cxt->pstore.buf, size); - cxt->count = (cxt->count + 1) % cxt->max_count; + cxt->dump_write_cnt = (cxt->dump_write_cnt + 1) % cxt->max_dump_cnt; return 0; } @@ -182,7 +182,7 @@ static int ramoops_pstore_erase(enum pstore_type_id type, u64 id, { struct ramoops_context *cxt = psi->data; - if (id >= cxt->max_count) + if (id >= cxt->max_dump_cnt) return -EINVAL; persistent_ram_free_old(cxt->przs[id]); @@ -213,7 +213,7 @@ static int __init ramoops_probe(struct platform_device *pdev) /* Only a single ramoops area allowed at a time, so fail extra * probes. */ - if (cxt->max_count) + if (cxt->max_dump_cnt) goto fail_out; if (!pdata->mem_size || !pdata->record_size) { @@ -239,22 +239,22 @@ static int __init ramoops_probe(struct platform_device *pdev) goto fail_out; } - cxt->max_count = pdata->mem_size / pdata->record_size; - cxt->count = 0; + cxt->max_dump_cnt = pdata->mem_size / pdata->record_size; + cxt->dump_read_cnt = 0; cxt->size = pdata->mem_size; cxt->phys_addr = pdata->mem_address; cxt->record_size = pdata->record_size; cxt->dump_oops = pdata->dump_oops; cxt->ecc = pdata->ecc; - cxt->przs = kzalloc(sizeof(*cxt->przs) * cxt->max_count, GFP_KERNEL); + cxt->przs = kzalloc(sizeof(*cxt->przs) * cxt->max_dump_cnt, GFP_KERNEL); if (!cxt->przs) { err = -ENOMEM; dev_err(dev, "failed to initialize a prz array\n"); goto fail_out; } - for (i = 0; i < cxt->max_count; i++) { + for (i = 0; i < cxt->max_dump_cnt; i++) { size_t sz = cxt->record_size; phys_addr_t start = cxt->phys_addr + sz * i; @@ -293,7 +293,7 @@ static int __init ramoops_probe(struct platform_device *pdev) pr_info("attached 0x%lx@0x%llx (%ux0x%zx), ecc: %s\n", cxt->size, (unsigned long long)cxt->phys_addr, - cxt->max_count, cxt->record_size, + cxt->max_dump_cnt, cxt->record_size, ramoops_ecc ? "on" : "off"); return 0; @@ -302,7 +302,7 @@ fail_buf: kfree(cxt->pstore.buf); fail_clear: cxt->pstore.bufsize = 0; - cxt->max_count = 0; + cxt->max_dump_cnt = 0; fail_przs: for (i = 0; cxt->przs[i]; i++) persistent_ram_free(cxt->przs[i]); @@ -321,7 +321,7 @@ static int __exit ramoops_remove(struct platform_device *pdev) iounmap(cxt->virt_addr); release_mem_region(cxt->phys_addr, cxt->size); - cxt->max_count = 0; + cxt->max_dump_cnt = 0; /* TODO(kees): When pstore supports unregistering, call it here. */ kfree(cxt->pstore.buf); -- cgit v0.10.2 From f4c5d2423c64266ba0daa9cc803d1d5ba469fe36 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Sat, 26 May 2012 06:20:21 -0700 Subject: pstore/ram: Factor dmesg przs initialization out of probe() This will help make code clearer when we'll add support for other message types. This also makes probe() much shorter and understandable, plus makes mem/record size checking a bit easier. Implementation detail: we now use a paddr pointer, this will be used for allocating persistent ram zones for other message types. Signed-off-by: Anton Vorontsov Acked-by: Kees Cook Signed-off-by: Greg Kroah-Hartman diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 9b274b9..6b76767 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -202,13 +202,65 @@ static struct ramoops_context oops_cxt = { }, }; +static void ramoops_free_przs(struct ramoops_context *cxt) +{ + int i; + + if (!cxt->przs) + return; + + for (i = 0; cxt->przs[i]; i++) + persistent_ram_free(cxt->przs[i]); + kfree(cxt->przs); +} + +static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt, + phys_addr_t *paddr, size_t dump_mem_sz) +{ + int err = -ENOMEM; + int i; + + if (!cxt->record_size) + return 0; + + cxt->max_dump_cnt = dump_mem_sz / cxt->record_size; + if (!cxt->max_dump_cnt) + return -ENOMEM; + + cxt->przs = kzalloc(sizeof(*cxt->przs) * cxt->max_dump_cnt, + GFP_KERNEL); + if (!cxt->przs) { + dev_err(dev, "failed to initialize a prz array for dumps\n"); + return -ENOMEM; + } + + for (i = 0; i < cxt->max_dump_cnt; i++) { + size_t sz = cxt->record_size; + + cxt->przs[i] = persistent_ram_new(*paddr, sz, cxt->ecc); + if (IS_ERR(cxt->przs[i])) { + err = PTR_ERR(cxt->przs[i]); + dev_err(dev, "failed to request mem region (0x%zx@0x%llx): %d\n", + sz, (unsigned long long)*paddr, err); + goto fail_prz; + } + *paddr += sz; + } + + return 0; +fail_prz: + ramoops_free_przs(cxt); + return err; +} + static int __init ramoops_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct ramoops_platform_data *pdata = pdev->dev.platform_data; struct ramoops_context *cxt = &oops_cxt; + size_t dump_mem_sz; + phys_addr_t paddr; int err = -EINVAL; - int i; /* Only a single ramoops area allowed at a time, so fail extra * probes. @@ -225,21 +277,6 @@ static int __init ramoops_probe(struct platform_device *pdev) pdata->mem_size = rounddown_pow_of_two(pdata->mem_size); pdata->record_size = rounddown_pow_of_two(pdata->record_size); - /* Check for the minimum memory size */ - if (pdata->mem_size < MIN_MEM_SIZE && - pdata->record_size < MIN_MEM_SIZE) { - pr_err("memory size too small, minimum is %lu\n", - MIN_MEM_SIZE); - goto fail_out; - } - - if (pdata->mem_size < pdata->record_size) { - pr_err("The memory size must be larger than the " - "records size\n"); - goto fail_out; - } - - cxt->max_dump_cnt = pdata->mem_size / pdata->record_size; cxt->dump_read_cnt = 0; cxt->size = pdata->mem_size; cxt->phys_addr = pdata->mem_address; @@ -247,24 +284,14 @@ static int __init ramoops_probe(struct platform_device *pdev) cxt->dump_oops = pdata->dump_oops; cxt->ecc = pdata->ecc; - cxt->przs = kzalloc(sizeof(*cxt->przs) * cxt->max_dump_cnt, GFP_KERNEL); - if (!cxt->przs) { - err = -ENOMEM; - dev_err(dev, "failed to initialize a prz array\n"); - goto fail_out; - } - - for (i = 0; i < cxt->max_dump_cnt; i++) { - size_t sz = cxt->record_size; - phys_addr_t start = cxt->phys_addr + sz * i; + paddr = cxt->phys_addr; - cxt->przs[i] = persistent_ram_new(start, sz, cxt->ecc); - if (IS_ERR(cxt->przs[i])) { - err = PTR_ERR(cxt->przs[i]); - dev_err(dev, "failed to request mem region (0x%zx@0x%llx): %d\n", - sz, (unsigned long long)start, err); - goto fail_przs; - } + dump_mem_sz = cxt->size; + err = ramoops_init_przs(dev, cxt, &paddr, dump_mem_sz); + if (err) { + pr_err("memory size too small, minimum is %lu\n", + cxt->record_size); + goto fail_count; } cxt->pstore.data = cxt; @@ -303,10 +330,8 @@ fail_buf: fail_clear: cxt->pstore.bufsize = 0; cxt->max_dump_cnt = 0; -fail_przs: - for (i = 0; cxt->przs[i]; i++) - persistent_ram_free(cxt->przs[i]); - kfree(cxt->przs); +fail_count: + ramoops_free_przs(cxt); fail_out: return err; } -- cgit v0.10.2 From 755d66b48fe5a1f2a07802fcc8704e8b9e775e7d Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Sat, 26 May 2012 06:20:22 -0700 Subject: pstore/ram: Factor ramoops_get_next_prz() out of ramoops_pstore_read() This will help make code clearer when we'll add support for other message types. The patch also changes return value from -EINVAL to 0 in case of end-of-records. The exact value doesn't matter for pstore (it should be just <= 0), but 0 feels more correct. Signed-off-by: Anton Vorontsov Acked-by: Kees Cook Signed-off-by: Greg Kroah-Hartman diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 6b76767..d770d72 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -85,6 +85,33 @@ static int ramoops_pstore_open(struct pstore_info *psi) return 0; } +static struct persistent_ram_zone * +ramoops_get_next_prz(struct persistent_ram_zone *przs[], uint *c, uint max, + u64 *id, + enum pstore_type_id *typep, enum pstore_type_id type, + bool update) +{ + struct persistent_ram_zone *prz; + int i = (*c)++; + + if (i >= max) + return NULL; + + prz = przs[i]; + + if (update) { + /* Update old/shadowed buffer. */ + persistent_ram_save_old(prz); + if (!persistent_ram_old_size(prz)) + return NULL; + } + + *typep = type; + *id = i; + + return prz; +} + static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type, struct timespec *time, char **buf, @@ -94,20 +121,16 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type, struct ramoops_context *cxt = psi->data; struct persistent_ram_zone *prz; - if (cxt->dump_read_cnt >= cxt->max_dump_cnt) - return -EINVAL; - - *id = cxt->dump_read_cnt++; - prz = cxt->przs[*id]; + prz = ramoops_get_next_prz(cxt->przs, &cxt->dump_read_cnt, + cxt->max_dump_cnt, id, type, + PSTORE_TYPE_DMESG, 1); + if (!prz) + return 0; - /* Only supports dmesg output so far. */ - *type = PSTORE_TYPE_DMESG; /* TODO(kees): Bogus time for the moment. */ time->tv_sec = 0; time->tv_nsec = 0; - /* Update old/shadowed buffer. */ - persistent_ram_save_old(prz); size = persistent_ram_old_size(prz); *buf = kmalloc(size, GFP_KERNEL); if (*buf == NULL) -- cgit v0.10.2 From b5d38e9bf1b0c4db19e336b59b38dfb5d28bf1bf Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Sat, 26 May 2012 06:20:23 -0700 Subject: pstore/ram: Add console messages handling The console log size is configurable via ramoops.console_size module option, and the log itself is available via /console-ramoops file. Signed-off-by: Anton Vorontsov Acked-by: Kees Cook Signed-off-by: Greg Kroah-Hartman diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index d770d72..c7acf94 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -41,6 +41,10 @@ module_param(record_size, ulong, 0400); MODULE_PARM_DESC(record_size, "size of each dump done on oops/panic"); +static ulong ramoops_console_size = MIN_MEM_SIZE; +module_param_named(console_size, ramoops_console_size, ulong, 0400); +MODULE_PARM_DESC(console_size, "size of kernel console log"); + static ulong mem_address; module_param(mem_address, ulong, 0400); MODULE_PARM_DESC(mem_address, @@ -63,14 +67,17 @@ MODULE_PARM_DESC(ramoops_ecc, struct ramoops_context { struct persistent_ram_zone **przs; + struct persistent_ram_zone *cprz; phys_addr_t phys_addr; unsigned long size; size_t record_size; + size_t console_size; int dump_oops; bool ecc; unsigned int max_dump_cnt; unsigned int dump_write_cnt; unsigned int dump_read_cnt; + unsigned int console_read_cnt; struct pstore_info pstore; }; @@ -82,6 +89,7 @@ static int ramoops_pstore_open(struct pstore_info *psi) struct ramoops_context *cxt = psi->data; cxt->dump_read_cnt = 0; + cxt->console_read_cnt = 0; return 0; } @@ -125,6 +133,9 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type, cxt->max_dump_cnt, id, type, PSTORE_TYPE_DMESG, 1); if (!prz) + prz = ramoops_get_next_prz(&cxt->cprz, &cxt->console_read_cnt, + 1, id, type, PSTORE_TYPE_CONSOLE, 0); + if (!prz) return 0; /* TODO(kees): Bogus time for the moment. */ @@ -167,7 +178,13 @@ static int ramoops_pstore_write(enum pstore_type_id type, struct persistent_ram_zone *prz = cxt->przs[cxt->dump_write_cnt]; size_t hlen; - /* Currently ramoops is designed to only store dmesg dumps. */ + if (type == PSTORE_TYPE_CONSOLE) { + if (!cxt->cprz) + return -ENOMEM; + persistent_ram_write(cxt->cprz, cxt->pstore.buf, size); + return 0; + } + if (type != PSTORE_TYPE_DMESG) return -EINVAL; @@ -204,12 +221,23 @@ static int ramoops_pstore_erase(enum pstore_type_id type, u64 id, struct pstore_info *psi) { struct ramoops_context *cxt = psi->data; + struct persistent_ram_zone *prz; - if (id >= cxt->max_dump_cnt) + switch (type) { + case PSTORE_TYPE_DMESG: + if (id >= cxt->max_dump_cnt) + return -EINVAL; + prz = cxt->przs[id]; + break; + case PSTORE_TYPE_CONSOLE: + prz = cxt->cprz; + break; + default: return -EINVAL; + } - persistent_ram_free_old(cxt->przs[id]); - persistent_ram_zap(cxt->przs[id]); + persistent_ram_free_old(prz); + persistent_ram_zap(prz); return 0; } @@ -276,6 +304,32 @@ fail_prz: return err; } +static int ramoops_init_prz(struct device *dev, struct ramoops_context *cxt, + struct persistent_ram_zone **prz, + phys_addr_t *paddr, size_t sz) +{ + if (!sz) + return 0; + + if (*paddr + sz > *paddr + cxt->size) + return -ENOMEM; + + *prz = persistent_ram_new(*paddr, sz, cxt->ecc); + if (IS_ERR(*prz)) { + int err = PTR_ERR(*prz); + + dev_err(dev, "failed to request mem region (0x%zx@0x%llx): %d\n", + sz, (unsigned long long)*paddr, err); + return err; + } + + persistent_ram_zap(*prz); + + *paddr += sz; + + return 0; +} + static int __init ramoops_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -291,34 +345,50 @@ static int __init ramoops_probe(struct platform_device *pdev) if (cxt->max_dump_cnt) goto fail_out; - if (!pdata->mem_size || !pdata->record_size) { - pr_err("The memory size and the record size must be " + if (!pdata->mem_size || (!pdata->record_size && !pdata->console_size)) { + pr_err("The memory size and the record/console size must be " "non-zero\n"); goto fail_out; } pdata->mem_size = rounddown_pow_of_two(pdata->mem_size); pdata->record_size = rounddown_pow_of_two(pdata->record_size); + pdata->console_size = rounddown_pow_of_two(pdata->console_size); cxt->dump_read_cnt = 0; cxt->size = pdata->mem_size; cxt->phys_addr = pdata->mem_address; cxt->record_size = pdata->record_size; + cxt->console_size = pdata->console_size; cxt->dump_oops = pdata->dump_oops; cxt->ecc = pdata->ecc; paddr = cxt->phys_addr; - dump_mem_sz = cxt->size; + dump_mem_sz = cxt->size - cxt->console_size; err = ramoops_init_przs(dev, cxt, &paddr, dump_mem_sz); - if (err) { + if (err) + goto fail_out; + + err = ramoops_init_prz(dev, cxt, &cxt->cprz, &paddr, cxt->console_size); + if (err) + goto fail_init_cprz; + + if (!cxt->przs && !cxt->cprz) { pr_err("memory size too small, minimum is %lu\n", - cxt->record_size); - goto fail_count; + cxt->console_size + cxt->record_size); + goto fail_cnt; } cxt->pstore.data = cxt; - cxt->pstore.bufsize = cxt->przs[0]->buffer_size; + /* + * Console can handle any buffer size, so prefer dumps buffer + * size since usually it is smaller. + */ + if (cxt->przs) + cxt->pstore.bufsize = cxt->przs[0]->buffer_size; + else + cxt->pstore.bufsize = cxt->cprz->buffer_size; cxt->pstore.buf = kmalloc(cxt->pstore.bufsize, GFP_KERNEL); spin_lock_init(&cxt->pstore.buf_lock); if (!cxt->pstore.buf) { @@ -341,9 +411,8 @@ static int __init ramoops_probe(struct platform_device *pdev) record_size = pdata->record_size; dump_oops = pdata->dump_oops; - pr_info("attached 0x%lx@0x%llx (%ux0x%zx), ecc: %s\n", + pr_info("attached 0x%lx@0x%llx, ecc: %s\n", cxt->size, (unsigned long long)cxt->phys_addr, - cxt->max_dump_cnt, cxt->record_size, ramoops_ecc ? "on" : "off"); return 0; @@ -353,7 +422,9 @@ fail_buf: fail_clear: cxt->pstore.bufsize = 0; cxt->max_dump_cnt = 0; -fail_count: +fail_cnt: + kfree(cxt->cprz); +fail_init_cprz: ramoops_free_przs(cxt); fail_out: return err; @@ -405,6 +476,7 @@ static int __init ramoops_init(void) dummy_data->mem_size = mem_size; dummy_data->mem_address = mem_address; dummy_data->record_size = record_size; + dummy_data->console_size = ramoops_console_size; dummy_data->dump_oops = dump_oops; dummy_data->ecc = ramoops_ecc; dummy = platform_create_bundle(&ramoops_driver, ramoops_probe, diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h index 3b823d4..9385d41 100644 --- a/include/linux/pstore_ram.h +++ b/include/linux/pstore_ram.h @@ -93,6 +93,7 @@ struct ramoops_platform_data { unsigned long mem_size; unsigned long mem_address; unsigned long record_size; + unsigned long console_size; int dump_oops; bool ecc; }; -- cgit v0.10.2 From 602b5be4f14cabd5b751c340919958549475ab62 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Sat, 26 May 2012 06:20:24 -0700 Subject: pstore/ram_core: Silence some printks Since we use multiple regions, the messages are somewhat annoying. We do print total mapped memory already, so no need to print the information for each region in the library routines. Signed-off-by: Anton Vorontsov Acked-by: Kees Cook Acked-by: Colin Cross Signed-off-by: Greg Kroah-Hartman diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index c5fbdbb..78f6d4b 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c @@ -409,14 +409,14 @@ static int __init persistent_ram_post_init(struct persistent_ram_zone *prz, bool " size %zu, start %zu\n", buffer_size(prz), buffer_start(prz)); else { - pr_info("persistent_ram: found existing buffer," + pr_debug("persistent_ram: found existing buffer," " size %zu, start %zu\n", buffer_size(prz), buffer_start(prz)); persistent_ram_save_old(prz); return 0; } } else { - pr_info("persistent_ram: no valid data in buffer" + pr_debug("persistent_ram: no valid data in buffer" " (sig = 0x%08x)\n", prz->buffer->sig); } -- cgit v0.10.2 From 958502d836cf18c6f39bdb787b76d53839e4d8aa Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Sat, 26 May 2012 06:20:25 -0700 Subject: pstore/ram: Add some more documentation and examples Suggested-by: Shuah Khan Signed-off-by: Anton Vorontsov Acked-by: Kees Cook Acked-by: Colin Cross Signed-off-by: Greg Kroah-Hartman diff --git a/Documentation/ramoops.txt b/Documentation/ramoops.txt index 4ba7db2..59a74a8 100644 --- a/Documentation/ramoops.txt +++ b/Documentation/ramoops.txt @@ -40,6 +40,12 @@ corrupt, but usually it is restorable. Setting the ramoops parameters can be done in 2 different manners: 1. Use the module parameters (which have the names of the variables described as before). + For quick debugging, you can also reserve parts of memory during boot + and then use the reserved memory for ramoops. For example, assuming a machine + with > 128 MB of memory, the following kernel command line will tell the + kernel to use only the first 128 MB of memory, and place ECC-protected ramoops + region at 128 MB boundary: + "mem=128M ramoops.mem_address=0x8000000 ramoops.ecc=1" 2. Use a platform device and set the platform data. The parameters can then be set through that platform data. An example of doing that is: @@ -70,6 +76,14 @@ if (ret) { return ret; } +You can specify either RAM memory or peripheral devices' memory. However, when +specifying RAM, be sure to reserve the memory by issuing memblock_reserve() +very early in the architecture code, e.g.: + +#include + +memblock_reserve(ramoops_data.mem_address, ramoops_data.mem_size); + 3. Dump format The data dump begins with a header, currently defined as "====" followed by a -- cgit v0.10.2 From b8587daa756141da776e3d4c3a5a315f5af78708 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Sat, 26 May 2012 06:20:27 -0700 Subject: pstore/ram_core: Remove now unused code The code tried to maintain the global list of persistent ram zones, which isn't a great idea overall, plus since Android's ram_console is no longer there, we can remove some unused functions. Signed-off-by: Anton Vorontsov Acked-by: Kees Cook Acked-by: Colin Cross Signed-off-by: Greg Kroah-Hartman diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index 78f6d4b..0fd8161 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c @@ -35,8 +35,6 @@ struct persistent_ram_buffer { #define PERSISTENT_RAM_SIG (0x43474244) /* DBGC */ -static __initdata LIST_HEAD(persistent_ram_list); - static inline size_t buffer_size(struct persistent_ram_zone *prz) { return atomic_read(&prz->buffer->size); @@ -462,78 +460,3 @@ err: kfree(prz); return ERR_PTR(ret); } - -#ifndef MODULE -static int __init persistent_ram_buffer_init(const char *name, - struct persistent_ram_zone *prz) -{ - int i; - struct persistent_ram *ram; - struct persistent_ram_descriptor *desc; - phys_addr_t start; - - list_for_each_entry(ram, &persistent_ram_list, node) { - start = ram->start; - for (i = 0; i < ram->num_descs; i++) { - desc = &ram->descs[i]; - if (!strcmp(desc->name, name)) - return persistent_ram_buffer_map(start, - desc->size, prz); - start += desc->size; - } - } - - return -EINVAL; -} - -static __init -struct persistent_ram_zone *__persistent_ram_init(struct device *dev, bool ecc) -{ - struct persistent_ram_zone *prz; - int ret = -ENOMEM; - - prz = kzalloc(sizeof(struct persistent_ram_zone), GFP_KERNEL); - if (!prz) { - pr_err("persistent_ram: failed to allocate persistent ram zone\n"); - goto err; - } - - ret = persistent_ram_buffer_init(dev_name(dev), prz); - if (ret) { - pr_err("persistent_ram: failed to initialize buffer\n"); - goto err; - } - - persistent_ram_post_init(prz, ecc); - - return prz; -err: - kfree(prz); - return ERR_PTR(ret); -} - -struct persistent_ram_zone * __init -persistent_ram_init_ringbuffer(struct device *dev, bool ecc) -{ - return __persistent_ram_init(dev, ecc); -} - -int __init persistent_ram_early_init(struct persistent_ram *ram) -{ - int ret; - - ret = memblock_reserve(ram->start, ram->size); - if (ret) { - pr_err("Failed to reserve persistent memory from %08lx-%08lx\n", - (long)ram->start, (long)(ram->start + ram->size - 1)); - return ret; - } - - list_add_tail(&ram->node, &persistent_ram_list); - - pr_info("Initialized persistent memory from %08lx-%08lx\n", - (long)ram->start, (long)(ram->start + ram->size - 1)); - - return 0; -} -#endif diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h index 9385d41..2470bb5 100644 --- a/include/linux/pstore_ram.h +++ b/include/linux/pstore_ram.h @@ -25,21 +25,6 @@ struct persistent_ram_buffer; -struct persistent_ram_descriptor { - const char *name; - phys_addr_t size; -}; - -struct persistent_ram { - phys_addr_t start; - phys_addr_t size; - - int num_descs; - struct persistent_ram_descriptor *descs; - - struct list_head node; -}; - struct persistent_ram_zone { phys_addr_t paddr; size_t size; @@ -63,15 +48,11 @@ struct persistent_ram_zone { size_t old_log_size; }; -int persistent_ram_early_init(struct persistent_ram *ram); - struct persistent_ram_zone * __init persistent_ram_new(phys_addr_t start, size_t size, bool ecc); void persistent_ram_free(struct persistent_ram_zone *prz); void persistent_ram_zap(struct persistent_ram_zone *prz); -struct persistent_ram_zone *persistent_ram_init_ringbuffer(struct device *dev, - bool ecc); int persistent_ram_write(struct persistent_ram_zone *prz, const void *s, unsigned int count); -- cgit v0.10.2 From a3f5f075c2e2c52c9c656c54ea77ceff5b2e1e25 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Sat, 26 May 2012 06:20:28 -0700 Subject: pstore/platform: Make automatic updates interval configurable There is no behavioural change, the default value is still 60 seconds. Signed-off-by: Anton Vorontsov Acked-by: Kees Cook Signed-off-by: Greg Kroah-Hartman diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 61461ed..34ca314 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include "internal.h" @@ -40,7 +41,10 @@ * whether the system is actually still running well enough * to let someone see the entry */ -#define PSTORE_INTERVAL (60 * HZ) +static int pstore_update_ms = 60000; +module_param_named(update_ms, pstore_update_ms, int, 0600); +MODULE_PARM_DESC(update_ms, "milliseconds before pstore updates its content " + "(default is 60000; -1 means runtime updates are disabled)"); static int pstore_new_entry; @@ -231,8 +235,11 @@ int pstore_register(struct pstore_info *psi) kmsg_dump_register(&pstore_dumper); pstore_register_console(); - pstore_timer.expires = jiffies + PSTORE_INTERVAL; - add_timer(&pstore_timer); + if (pstore_update_ms >= 0) { + pstore_timer.expires = jiffies + + msecs_to_jiffies(pstore_update_ms); + add_timer(&pstore_timer); + } return 0; } @@ -291,7 +298,7 @@ static void pstore_timefunc(unsigned long dummy) schedule_work(&pstore_work); } - mod_timer(&pstore_timer, jiffies + PSTORE_INTERVAL); + mod_timer(&pstore_timer, jiffies + msecs_to_jiffies(pstore_update_ms)); } module_param(backend, charp, 0444); -- cgit v0.10.2 From 521f7288a8126a8ec28e3ab623aacf0590684b80 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Sat, 26 May 2012 06:20:29 -0700 Subject: pstore/platform: Disable automatic updates by default Having automatic updates seems pointless for production system, and even dangerous and thus counter-productive: 1. If we can mount pstore, or read files, we can as well read /proc/kmsg. So, there's little point in duplicating the functionality and present the same information but via another userland ABI; 2. Expecting the kernel to behave sanely after oops/panic is naive. It might work, but you'd rather not try it. Screwed up kernel can do rather bad things, like recursive faults[1]; and pstore rather provoking bad things to happen. It uses: 1. Timers (assumes sane interrupts state); 2. Workqueues and mutexes (assumes scheduler in a sane state); 3. kzalloc (a working slab allocator); That's too much for a dead kernel, so the debugging facility itself might just make debugging harder, which is not what we want. Maybe for non-oops message types it would make sense to re-enable automatic updates, but so far I don't see any use case for this. Even for tracing, it has its own run-time/normal ABI, so we're only interested in pstore upon next boot, to retrieve what has gone wrong with HW or SW. So, let's disable the updates by default. [1] BUG: unable to handle kernel paging request at fffffffffffffff8 IP: [] kthread_data+0xb/0x20 [...] Process kworker/0:1 (pid: 14, threadinfo ffff8800072c0000, task ffff88000725b100) [... Call Trace: [] wq_worker_sleeping+0x10/0xa0 [] __schedule+0x568/0x7d0 [] ? trace_hardirqs_on+0xd/0x10 [] ? call_rcu_sched+0x12/0x20 [] ? release_task+0x156/0x2d0 [] ? release_task+0x1e/0x2d0 [] ? trace_hardirqs_on+0xd/0x10 [] schedule+0x24/0x70 [] do_exit+0x1f8/0x370 [] oops_end+0x77/0xb0 [] no_context+0x1a6/0x1b5 [] __bad_area_nosemaphore+0x1ce/0x1ed [] ? ttwu_queue+0xc6/0xe0 [] bad_area_nosemaphore+0xe/0x10 [] do_page_fault+0x2c7/0x450 [] ? __lock_release+0x6b/0xe0 [] ? mark_held_locks+0x61/0x140 [] ? __wake_up+0x4e/0x70 [] ? trace_hardirqs_off_thunk+0x3a/0x3c [] ? pstore_register+0x120/0x120 [] page_fault+0x1f/0x30 [] ? pstore_register+0x120/0x120 [] ? memcpy+0x68/0x110 [] ? pstore_get_records+0x3a/0x130 [] ? persistent_ram_copy_old+0x64/0x90 [] ramoops_pstore_read+0x84/0x130 [] pstore_get_records+0x79/0x130 [] ? process_one_work+0x116/0x450 [] ? pstore_register+0x120/0x120 [] pstore_dowork+0xe/0x10 [] process_one_work+0x174/0x450 [] ? process_one_work+0x116/0x450 [] worker_thread+0x123/0x2d0 [] ? manage_workers.isra.28+0x120/0x120 [] kthread+0x8e/0xa0 [] kernel_thread_helper+0x4/0x10 [] ? retint_restore_args+0xe/0xe [] ? __init_kthread_worker+0x70/0x70 [] ? gs_change+0xb/0xb Code: be e2 00 00 00 48 c7 c7 d1 2a 4e 81 e8 bf fb fd ff 48 8b 5d f0 4c 8b 65 f8 c9 c3 0f 1f 44 00 00 48 8b 87 08 02 00 00 55 48 89 e5 <48> 8b 40 f8 5d c3 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 RIP [] kthread_data+0xb/0x20 RSP CR2: fffffffffffffff8 ---[ end trace 996a332dc399111d ]--- Fixing recursive fault but reboot is needed! Signed-off-by: Anton Vorontsov Signed-off-by: Greg Kroah-Hartman diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 34ca314..be4614f 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -41,10 +41,12 @@ * whether the system is actually still running well enough * to let someone see the entry */ -static int pstore_update_ms = 60000; +static int pstore_update_ms = -1; module_param_named(update_ms, pstore_update_ms, int, 0600); MODULE_PARM_DESC(update_ms, "milliseconds before pstore updates its content " - "(default is 60000; -1 means runtime updates are disabled)"); + "(default is -1, which means runtime updates are disabled; " + "enabling this option is not safe, it may lead to further " + "corruption on Oopses)"); static int pstore_new_entry; -- cgit v0.10.2 From 15d76446205710ddfcba6cc9156c7883074f84b1 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Sat, 26 May 2012 06:20:26 -0700 Subject: staging/android: Remove ram_console driver All the functionality is now supported by pstore and pstore_ram drivers. Signed-off-by: Anton Vorontsov Acked-by: Kees Cook Acked-by: Colin Cross Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig index 0e16b59..0ce50d1 100644 --- a/drivers/staging/android/Kconfig +++ b/drivers/staging/android/Kconfig @@ -25,11 +25,6 @@ config ANDROID_LOGGER tristate "Android log driver" default n -config ANDROID_RAM_CONSOLE - bool "Android RAM buffer console" - depends on !S390 && !UML && HAVE_MEMBLOCK && PSTORE_RAM=y - default n - config ANDROID_TIMED_OUTPUT bool "Timed output class driver" default y diff --git a/drivers/staging/android/Makefile b/drivers/staging/android/Makefile index 98711e2..e16fcd5 100644 --- a/drivers/staging/android/Makefile +++ b/drivers/staging/android/Makefile @@ -1,7 +1,6 @@ obj-$(CONFIG_ANDROID_BINDER_IPC) += binder.o obj-$(CONFIG_ASHMEM) += ashmem.o obj-$(CONFIG_ANDROID_LOGGER) += logger.o -obj-$(CONFIG_ANDROID_RAM_CONSOLE) += ram_console.o obj-$(CONFIG_ANDROID_TIMED_OUTPUT) += timed_output.o obj-$(CONFIG_ANDROID_TIMED_GPIO) += timed_gpio.o obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER) += lowmemorykiller.o diff --git a/drivers/staging/android/ram_console.c b/drivers/staging/android/ram_console.c deleted file mode 100644 index 7add022..0000000 --- a/drivers/staging/android/ram_console.c +++ /dev/null @@ -1,181 +0,0 @@ -/* drivers/android/ram_console.c - * - * Copyright (C) 2007-2008 Google, Inc. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * 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. - * - */ - -#define pr_fmt(fmt) "ram_console: " fmt - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "ram_console.h" - -static struct persistent_ram_zone *ram_console_zone; -static const char *bootinfo; -static size_t bootinfo_size; - -static void -ram_console_write(struct console *console, const char *s, unsigned int count) -{ - struct persistent_ram_zone *prz = console->data; - persistent_ram_write(prz, s, count); -} - -static struct console ram_console = { - .name = "ram", - .write = ram_console_write, - .flags = CON_PRINTBUFFER | CON_ENABLED | CON_ANYTIME, - .index = -1, -}; - -void ram_console_enable_console(int enabled) -{ - if (enabled) - ram_console.flags |= CON_ENABLED; - else - ram_console.flags &= ~CON_ENABLED; -} - -static int __init ram_console_probe(struct platform_device *pdev) -{ - struct ram_console_platform_data *pdata = pdev->dev.platform_data; - struct persistent_ram_zone *prz; - - prz = persistent_ram_init_ringbuffer(&pdev->dev, true); - if (IS_ERR(prz)) - return PTR_ERR(prz); - - - if (pdata) { - bootinfo = kstrdup(pdata->bootinfo, GFP_KERNEL); - if (bootinfo) - bootinfo_size = strlen(bootinfo); - } - - ram_console_zone = prz; - ram_console.data = prz; - - register_console(&ram_console); - - return 0; -} - -static struct platform_driver ram_console_driver = { - .driver = { - .name = "ram_console", - }, -}; - -static int __init ram_console_module_init(void) -{ - return platform_driver_probe(&ram_console_driver, ram_console_probe); -} - -#ifndef CONFIG_PRINTK -#define dmesg_restrict 0 -#endif - -static ssize_t ram_console_read_old(struct file *file, char __user *buf, - size_t len, loff_t *offset) -{ - loff_t pos = *offset; - ssize_t count; - struct persistent_ram_zone *prz = ram_console_zone; - size_t old_log_size = persistent_ram_old_size(prz); - const char *old_log = persistent_ram_old(prz); - char *str; - int ret; - - if (dmesg_restrict && !capable(CAP_SYSLOG)) - return -EPERM; - - /* Main last_kmsg log */ - if (pos < old_log_size) { - count = min(len, (size_t)(old_log_size - pos)); - if (copy_to_user(buf, old_log + pos, count)) - return -EFAULT; - goto out; - } - - /* ECC correction notice */ - pos -= old_log_size; - count = persistent_ram_ecc_string(prz, NULL, 0); - if (pos < count) { - str = kmalloc(count, GFP_KERNEL); - if (!str) - return -ENOMEM; - persistent_ram_ecc_string(prz, str, count + 1); - count = min(len, (size_t)(count - pos)); - ret = copy_to_user(buf, str + pos, count); - kfree(str); - if (ret) - return -EFAULT; - goto out; - } - - /* Boot info passed through pdata */ - pos -= count; - if (pos < bootinfo_size) { - count = min(len, (size_t)(bootinfo_size - pos)); - if (copy_to_user(buf, bootinfo + pos, count)) - return -EFAULT; - goto out; - } - - /* EOF */ - return 0; - -out: - *offset += count; - return count; -} - -static const struct file_operations ram_console_file_ops = { - .owner = THIS_MODULE, - .read = ram_console_read_old, -}; - -static int __init ram_console_late_init(void) -{ - struct proc_dir_entry *entry; - struct persistent_ram_zone *prz = ram_console_zone; - - if (!prz) - return 0; - - if (persistent_ram_old_size(prz) == 0) - return 0; - - entry = create_proc_entry("last_kmsg", S_IFREG | S_IRUGO, NULL); - if (!entry) { - pr_err("failed to create proc entry\n"); - persistent_ram_free_old(prz); - return 0; - } - - entry->proc_fops = &ram_console_file_ops; - entry->size = persistent_ram_old_size(prz) + - persistent_ram_ecc_string(prz, NULL, 0) + - bootinfo_size; - - return 0; -} - -late_initcall(ram_console_late_init); -postcore_initcall(ram_console_module_init); -- cgit v0.10.2 From 176f7842a8c0a19e0947f630d71bb53db312812f Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Thu, 14 Jun 2012 00:21:39 +0200 Subject: staging/xgifb: Remove assignments without effect This patch removes assignments to the fb_fix_screeninfo struct which are overwritten by the memset in XGIfb_get_fix() a few lines later. Since the name/id might be useful this was moved to XGIfb_get_fix(). Signed-off-by: Peter Huewe Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 033463d..729d980 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -1348,6 +1348,8 @@ static int XGIfb_get_fix(struct fb_fix_screeninfo *fix, int con, DEBUGPRN("inside get_fix"); memset(fix, 0, sizeof(struct fb_fix_screeninfo)); + strncpy(fix->id, "XGI", sizeof(fix->id) - 1); + fix->smem_start = xgifb_info->video_base; fix->smem_len = xgifb_info->video_size; @@ -2230,11 +2232,6 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, } - strncpy(fb_info->fix.id, "XGI", sizeof(fb_info->fix.id) - 1); - fb_info->fix.type = FB_TYPE_PACKED_PIXELS; - fb_info->fix.xpanstep = 1; - fb_info->fix.ypanstep = 1; - fb_info->flags = FBINFO_FLAG_DEFAULT; fb_info->screen_base = xgifb_info->video_vbase; fb_info->fbops = &XGIfb_ops; -- cgit v0.10.2 From 95649c425fa2805b76f183c27aeed93f159e47cc Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Thu, 14 Jun 2012 00:21:40 +0200 Subject: staging/xgifb: Add mutext for fb_mmap locking This adds a mutex for fb_mmap around smem_start and smem_len so the mutex inside the fb_mmap() is actually used. Changing of these fields before calling the framebuffer_register() are not mutexed. We check whether framebuffer_register has been called by reading fbinfo->count. See 537a1bf0 - "fbdev: add mutex for fb_mmap locking" by Krzysztof Helt for details. Signed-off-by: Peter Huewe Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 729d980..3a4328f 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -1350,10 +1350,17 @@ static int XGIfb_get_fix(struct fb_fix_screeninfo *fix, int con, strncpy(fix->id, "XGI", sizeof(fix->id) - 1); - fix->smem_start = xgifb_info->video_base; + /* if register_framebuffer has been called, we must lock */ + if (atomic_read(&info->count)) + mutex_lock(&info->mm_lock); + fix->smem_start = xgifb_info->video_base; fix->smem_len = xgifb_info->video_size; + /* if register_framebuffer has been called, we can unlock */ + if (atomic_read(&info->count)) + mutex_unlock(&info->mm_lock); + fix->type = FB_TYPE_PACKED_PIXELS; fix->type_aux = 0; if (xgifb_info->video_bpp == 8) -- cgit v0.10.2 From ac326fb96bdf720ceb4871a7219073c5fc257595 Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Thu, 14 Jun 2012 00:21:41 +0200 Subject: staging/xgifb: Add header #include guards to vb_table.h This patch adds a simple #include guard to vb_table.h Signed-off-by: Peter Huewe Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h index d22e599..9a17113 100644 --- a/drivers/staging/xgifb/vb_table.h +++ b/drivers/staging/xgifb/vb_table.h @@ -1,3 +1,5 @@ +#ifndef _VB_TABLE_ +#define _VB_TABLE_ /* yilin modify for xgi20 */ static struct SiS_MCLKData XGI340New_MCLKData[] = { {0x16, 0x01, 0x01, 166}, @@ -2696,3 +2698,4 @@ static struct XGI301C_Tap4TimingStruct YPbPr750pTap4Timing[] = { } } }; +#endif -- cgit v0.10.2 From f3ca589baf317d61b87c409e205bfaf740169710 Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Thu, 14 Jun 2012 00:21:42 +0200 Subject: staging/xgifb: Remove superfluous header includes This patch removes all unnecessary, redundant and superfluous header includes from xgifb. Tested on hp t5325 (XGI Z11) Signed-off-by: Peter Huewe Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/XGI_main.h b/drivers/staging/xgifb/XGI_main.h index 9c62aeb..ce18f8c 100644 --- a/drivers/staging/xgifb/XGI_main.h +++ b/drivers/staging/xgifb/XGI_main.h @@ -1,13 +1,7 @@ #ifndef _XGIFB_MAIN #define _XGIFB_MAIN - - /* ------------------- Constant Definitions ------------------------- */ - - #include "XGIfb.h" -#include "vb_struct.h" -#include "../../video/sis/sis.h" #include "vb_def.h" #define XGIFAIL(x) do { printk(x "\n"); return -EINVAL; } while (0) diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 3a4328f..3382272 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -6,36 +6,12 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -/* #include */ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include + #ifdef CONFIG_MTRR #include #endif -#include "XGIfb.h" -#include "vgatypes.h" #include "XGI_main.h" #include "vb_init.h" #include "vb_util.h" diff --git a/drivers/staging/xgifb/XGIfb.h b/drivers/staging/xgifb/XGIfb.h index 9068c5a..741bba3 100644 --- a/drivers/staging/xgifb/XGIfb.h +++ b/drivers/staging/xgifb/XGIfb.h @@ -1,8 +1,5 @@ #ifndef _LINUX_XGIFB #define _LINUX_XGIFB -#include -#include - #include "vgatypes.h" #include "vb_struct.h" diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c index c222d61..dd6a519 100644 --- a/drivers/staging/xgifb/vb_init.c +++ b/drivers/staging/xgifb/vb_init.c @@ -1,19 +1,10 @@ -#include #include /* udelay */ -#include #include #include "XGIfb.h" -#include "vgatypes.h" - #include "vb_def.h" -#include "vb_struct.h" #include "vb_util.h" #include "vb_setmode.h" -#include "vb_init.h" - - -#include static const unsigned short XGINew_DDRDRAM_TYPE340[4][5] = { { 2, 13, 9, 64, 0x45}, diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index b2f4338..ad1e23d 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -1,17 +1,9 @@ - -#include #include -#include #include "XGIfb.h" - #include "vb_def.h" -#include "vgatypes.h" -#include "vb_struct.h" -#include "vb_init.h" #include "vb_util.h" #include "vb_table.h" -#include "vb_setmode.h" #define IndexMask 0xff diff --git a/drivers/staging/xgifb/vb_util.c b/drivers/staging/xgifb/vb_util.c index b5c9989..5c93a22 100644 --- a/drivers/staging/xgifb/vb_util.c +++ b/drivers/staging/xgifb/vb_util.c @@ -1,13 +1,4 @@ -#include -#include - -#include "vb_def.h" #include "vgatypes.h" -#include "vb_struct.h" - -#include "XGIfb.h" - -#include "vb_util.h" void xgifb_reg_set(unsigned long port, u8 index, u8 data) { diff --git a/drivers/staging/xgifb/vgatypes.h b/drivers/staging/xgifb/vgatypes.h index 30cdd1a..7fc0719 100644 --- a/drivers/staging/xgifb/vgatypes.h +++ b/drivers/staging/xgifb/vgatypes.h @@ -1,7 +1,6 @@ #ifndef _VGATYPES_ #define _VGATYPES_ -#include #include /* for struct fb_var_screeninfo for sis.h */ #include "../../video/sis/vgatypes.h" #include "../../video/sis/sis.h" /* for LCD_TYPE */ -- cgit v0.10.2 From 391f695b90ba8b3905c818f03188440a5df9cfe7 Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Thu, 14 Jun 2012 00:21:43 +0200 Subject: staging/xgifb: Consolidate XGINew_SetDRAMSize{,20}Reg This patch consolidates the almost identical functions XGINew_SetDRAMSizeReg and XGINew_SetDRAMSize20Reg as they are implemented identically except one division factor. The changed factor is now reflected in the input data. Signed-off-by: Peter Huewe Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c index dd6a519..726c335 100644 --- a/drivers/staging/xgifb/vb_init.c +++ b/drivers/staging/xgifb/vb_init.c @@ -7,10 +7,10 @@ #include "vb_setmode.h" static const unsigned short XGINew_DDRDRAM_TYPE340[4][5] = { - { 2, 13, 9, 64, 0x45}, - { 2, 12, 9, 32, 0x35}, - { 2, 12, 8, 16, 0x31}, - { 2, 11, 8, 8, 0x21} }; + { 2, 13, 9, 16, 0x45}, + { 2, 12, 9, 8, 0x35}, + { 2, 12, 8, 4, 0x31}, + { 2, 11, 8, 2, 0x21} }; static const unsigned short XGINew_DDRDRAM_TYPE20[12][5] = { { 2, 14, 11, 128, 0x5D}, @@ -591,50 +591,6 @@ static void XGINew_SetDRAMSizingType(int index, /* should delay 50 ns */ } -static unsigned short XGINew_SetDRAMSizeReg(int index, - const unsigned short DRAMTYPE_TABLE[][5], - struct vb_device_info *pVBInfo) -{ - unsigned short data = 0, memsize = 0; - int RankSize; - unsigned char ChannelNo; - - RankSize = DRAMTYPE_TABLE[index][3] * pVBInfo->ram_bus / 32; - data = xgifb_reg_get(pVBInfo->P3c4, 0x13); - data &= 0x80; - - if (data == 0x80) - RankSize *= 2; - - data = 0; - - if (pVBInfo->ram_channel == 3) - ChannelNo = 4; - else - ChannelNo = pVBInfo->ram_channel; - - if (ChannelNo * RankSize <= 256) { - while ((RankSize >>= 1) > 0) - data += 0x10; - - memsize = data >> 4; - - /* [2004/03/25] Vicent, Fix DRAM Sizing Error */ - xgifb_reg_set(pVBInfo->P3c4, - 0x14, - (xgifb_reg_get(pVBInfo->P3c4, 0x14) & 0x0F) | - (data & 0xF0)); - - /* data |= pVBInfo->ram_channel << 2; */ - /* data |= (pVBInfo->ram_bus / 64) << 1; */ - /* xgifb_reg_set(pVBInfo->P3c4, 0x14, data); */ - - /* should delay */ - /* XGINew_SetDRAMModeRegister340(pVBInfo); */ - } - return memsize; -} - static unsigned short XGINew_SetDRAMSize20Reg(int index, const unsigned short DRAMTYPE_TABLE[][5], struct vb_device_info *pVBInfo) @@ -968,7 +924,7 @@ static int XGINew_DDRSizing340(struct xgi_hw_device_info *HwDeviceExtension, XGINew_SetDRAMSizingType(i, XGINew_DDRDRAM_TYPE340, pVBInfo); - memsize = XGINew_SetDRAMSizeReg(i, + memsize = XGINew_SetDRAMSize20Reg(i, XGINew_DDRDRAM_TYPE340, pVBInfo); -- cgit v0.10.2 From 672f5ee27e622c995bd0c19d2ba1bb5a55b6d902 Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Thu, 14 Jun 2012 00:21:44 +0200 Subject: staging/xgifb: Remove duplicated code from XGINew_DDRSizing340 Since XGINew_SetDRAMSize20Reg now handles both cases we can remove the code duplication in XGINew_DDRSizing340. Signed-off-by: Peter Huewe Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c index 726c335..512284c 100644 --- a/drivers/staging/xgifb/vb_init.c +++ b/drivers/staging/xgifb/vb_init.c @@ -893,52 +893,38 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension, static int XGINew_DDRSizing340(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) { - int i; - unsigned short memsize, addr; + u8 i, size; + unsigned short memsize, start_addr; + const unsigned short (*dram_table)[5]; xgifb_reg_set(pVBInfo->P3c4, 0x15, 0x00); /* noninterleaving */ xgifb_reg_set(pVBInfo->P3c4, 0x1C, 0x00); /* nontiling */ XGINew_CheckChannel(HwDeviceExtension, pVBInfo); if (HwDeviceExtension->jChipType >= XG20) { - for (i = 0; i < 12; i++) { - XGINew_SetDRAMSizingType(i, - XGINew_DDRDRAM_TYPE20, - pVBInfo); - memsize = XGINew_SetDRAMSize20Reg(i, - XGINew_DDRDRAM_TYPE20, - pVBInfo); - if (memsize == 0) - continue; - - addr = memsize + (pVBInfo->ram_channel - 2) + 20; - if ((HwDeviceExtension->ulVideoMemorySize - 1) < - (unsigned long) (1 << addr)) - continue; - - if (XGINew_ReadWriteRest(addr, 5, pVBInfo) == 1) - return 1; - } + dram_table = XGINew_DDRDRAM_TYPE20; + size = ARRAY_SIZE(XGINew_DDRDRAM_TYPE20); + start_addr = 5; } else { - for (i = 0; i < 4; i++) { - XGINew_SetDRAMSizingType(i, - XGINew_DDRDRAM_TYPE340, - pVBInfo); - memsize = XGINew_SetDRAMSize20Reg(i, - XGINew_DDRDRAM_TYPE340, - pVBInfo); - - if (memsize == 0) - continue; - - addr = memsize + (pVBInfo->ram_channel - 2) + 20; - if ((HwDeviceExtension->ulVideoMemorySize - 1) < - (unsigned long) (1 << addr)) - continue; - - if (XGINew_ReadWriteRest(addr, 9, pVBInfo) == 1) - return 1; - } + dram_table = XGINew_DDRDRAM_TYPE340; + size = ARRAY_SIZE(XGINew_DDRDRAM_TYPE340); + start_addr = 9; + } + + for (i = 0; i < size; i++) { + XGINew_SetDRAMSizingType(i, dram_table, pVBInfo); + memsize = XGINew_SetDRAMSize20Reg(i, dram_table, pVBInfo); + + if (memsize == 0) + continue; + + memsize += (pVBInfo->ram_channel - 2) + 20; + if ((HwDeviceExtension->ulVideoMemorySize - 1) < + (unsigned long) (1 << memsize)) + continue; + + if (XGINew_ReadWriteRest(memsize, start_addr, pVBInfo) == 1) + return 1; } return 0; } -- cgit v0.10.2 From 4e55d0b3ee13bb21dc0f74217675e86486004b8b Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Thu, 14 Jun 2012 00:21:45 +0200 Subject: staging/xgifb: Inline XGINew_SetDRAMSizingType Since the function XGINew_SetDRAMSizingType is only called from one location and consist only of 2 valuable lines we can simply inline it here. Signed-off-by: Peter Huewe Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c index 512284c..63011af 100644 --- a/drivers/staging/xgifb/vb_init.c +++ b/drivers/staging/xgifb/vb_init.c @@ -579,17 +579,6 @@ static void XGINew_SetDRAMDefaultRegister340( pVBInfo->SR15[3][pVBInfo->ram_type]); /* SR1B */ } -static void XGINew_SetDRAMSizingType(int index, - const unsigned short DRAMTYPE_TABLE[][5], - struct vb_device_info *pVBInfo) -{ - unsigned short data; - - data = DRAMTYPE_TABLE[index][4]; - xgifb_reg_and_or(pVBInfo->P3c4, 0x13, 0x80, data); - udelay(15); - /* should delay 50 ns */ -} static unsigned short XGINew_SetDRAMSize20Reg(int index, const unsigned short DRAMTYPE_TABLE[][5], @@ -912,7 +901,10 @@ static int XGINew_DDRSizing340(struct xgi_hw_device_info *HwDeviceExtension, } for (i = 0; i < size; i++) { - XGINew_SetDRAMSizingType(i, dram_table, pVBInfo); + /* SetDRAMSizingType */ + xgifb_reg_and_or(pVBInfo->P3c4, 0x13, 0x80, dram_table[i][4]); + udelay(15); /* should delay 50 ns */ + memsize = XGINew_SetDRAMSize20Reg(i, dram_table, pVBInfo); if (memsize == 0) -- cgit v0.10.2 From d6461e49c09a1a7f203437c084ec169563bcbf68 Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Thu, 14 Jun 2012 00:21:46 +0200 Subject: staging/xgifb: Remove unnecessary fields of XGINew_DDRDRAM_TYPE{340, 20} Since the first three entries in XGINew_DDRDRAM_TYPE{340,20} are never used, we can simply remove them; and instead of passing XGINew_DDRDRAM_TYPE with an index we can simply pass the value directly to XGINew_SetDRAMSize20Reg. Signed-off-by: Peter Huewe Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c index 63011af..944653d 100644 --- a/drivers/staging/xgifb/vb_init.c +++ b/drivers/staging/xgifb/vb_init.c @@ -6,25 +6,25 @@ #include "vb_util.h" #include "vb_setmode.h" -static const unsigned short XGINew_DDRDRAM_TYPE340[4][5] = { - { 2, 13, 9, 16, 0x45}, - { 2, 12, 9, 8, 0x35}, - { 2, 12, 8, 4, 0x31}, - { 2, 11, 8, 2, 0x21} }; - -static const unsigned short XGINew_DDRDRAM_TYPE20[12][5] = { - { 2, 14, 11, 128, 0x5D}, - { 2, 14, 10, 64, 0x59}, - { 2, 13, 11, 64, 0x4D}, - { 2, 14, 9, 32, 0x55}, - { 2, 13, 10, 32, 0x49}, - { 2, 12, 11, 32, 0x3D}, - { 2, 14, 8, 16, 0x51}, - { 2, 13, 9, 16, 0x45}, - { 2, 12, 10, 16, 0x39}, - { 2, 13, 8, 8, 0x41}, - { 2, 12, 9, 8, 0x35}, - { 2, 12, 8, 4, 0x31} }; +static const unsigned short XGINew_DDRDRAM_TYPE340[4][2] = { + { 16, 0x45}, + { 8, 0x35}, + { 4, 0x31}, + { 2, 0x21} }; + +static const unsigned short XGINew_DDRDRAM_TYPE20[12][2] = { + { 128, 0x5D}, + { 64, 0x59}, + { 64, 0x4D}, + { 32, 0x55}, + { 32, 0x49}, + { 32, 0x3D}, + { 16, 0x51}, + { 16, 0x45}, + { 16, 0x39}, + { 8, 0x41}, + { 8, 0x35}, + { 4, 0x31} }; #define XGIFB_ROM_SIZE 65536 @@ -580,15 +580,15 @@ static void XGINew_SetDRAMDefaultRegister340( } -static unsigned short XGINew_SetDRAMSize20Reg(int index, - const unsigned short DRAMTYPE_TABLE[][5], +static unsigned short XGINew_SetDRAMSize20Reg( + unsigned short dram_size, struct vb_device_info *pVBInfo) { unsigned short data = 0, memsize = 0; int RankSize; unsigned char ChannelNo; - RankSize = DRAMTYPE_TABLE[index][3] * pVBInfo->ram_bus / 8; + RankSize = dram_size * pVBInfo->ram_bus / 8; data = xgifb_reg_get(pVBInfo->P3c4, 0x13); data &= 0x80; @@ -884,7 +884,7 @@ static int XGINew_DDRSizing340(struct xgi_hw_device_info *HwDeviceExtension, { u8 i, size; unsigned short memsize, start_addr; - const unsigned short (*dram_table)[5]; + const unsigned short (*dram_table)[2]; xgifb_reg_set(pVBInfo->P3c4, 0x15, 0x00); /* noninterleaving */ xgifb_reg_set(pVBInfo->P3c4, 0x1C, 0x00); /* nontiling */ @@ -902,10 +902,10 @@ static int XGINew_DDRSizing340(struct xgi_hw_device_info *HwDeviceExtension, for (i = 0; i < size; i++) { /* SetDRAMSizingType */ - xgifb_reg_and_or(pVBInfo->P3c4, 0x13, 0x80, dram_table[i][4]); + xgifb_reg_and_or(pVBInfo->P3c4, 0x13, 0x80, dram_table[i][1]); udelay(15); /* should delay 50 ns */ - memsize = XGINew_SetDRAMSize20Reg(i, dram_table, pVBInfo); + memsize = XGINew_SetDRAMSize20Reg(dram_table[i][0], pVBInfo); if (memsize == 0) continue; -- cgit v0.10.2 From f477d3e6bb1bef4f3e2286d762137ae7e8a53195 Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Thu, 14 Jun 2012 00:21:47 +0200 Subject: staging/xgifb: Replace constant arrays with constant values This patch removes the arrays in XGI_GetVCLK2Ptr which each contain only one value four times and replaces them with their constant value. Signed-off-by: Peter Huewe Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index ad1e23d..47d60c8 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -1010,24 +1010,6 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) { - unsigned short LCDXlat1VCLK[4] = { VCLK65_315 + 2, - VCLK65_315 + 2, - VCLK65_315 + 2, - VCLK65_315 + 2 }; - unsigned short LCDXlat2VCLK[4] = { VCLK108_2_315 + 5, - VCLK108_2_315 + 5, - VCLK108_2_315 + 5, - VCLK108_2_315 + 5 }; - unsigned short LVDSXlat1VCLK[4] = { VCLK40, VCLK40, VCLK40, VCLK40 }; - unsigned short LVDSXlat2VCLK[4] = { VCLK65_315 + 2, - VCLK65_315 + 2, - VCLK65_315 + 2, - VCLK65_315 + 2 }; - unsigned short LVDSXlat3VCLK[4] = { VCLK65_315 + 2, - VCLK65_315 + 2, - VCLK65_315 + 2, - VCLK65_315 + 2 }; - unsigned short CRT2Index, VCLKIndex; unsigned short modeflag, resinfo; @@ -1040,9 +1022,9 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo, CRT2Index = CRT2Index >> 6; /* for LCD */ if (pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) { /*301b*/ if (pVBInfo->LCDResInfo != Panel_1024x768) - VCLKIndex = LCDXlat2VCLK[CRT2Index]; + VCLKIndex = VCLK108_2_315 + 5; /* LCDXlat2VCLK */ else - VCLKIndex = LCDXlat1VCLK[CRT2Index]; + VCLKIndex = VCLK65_315 + 2; /* LCDXlat1VCLK */ } else if (pVBInfo->VBInfo & SetCRT2ToHiVision) { if (pVBInfo->SetFlag & RPLLDIV2XO) { VCLKIndex = TVCLKBASE_315 + HiTVVCLKDIV2; @@ -1093,12 +1075,12 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo, VCLKIndex = VCLKIndex >> 6; if ((pVBInfo->LCDResInfo == Panel_800x600) || (pVBInfo->LCDResInfo == Panel_320x480)) - VCLKIndex = LVDSXlat1VCLK[VCLKIndex]; + VCLKIndex = VCLK40; /* LVDSXlat1VCLK */ else if ((pVBInfo->LCDResInfo == Panel_1024x768) || (pVBInfo->LCDResInfo == Panel_1024x768x75)) - VCLKIndex = LVDSXlat2VCLK[VCLKIndex]; + VCLKIndex = VCLK65_315 + 2; /* LVDSXlat2VCLK */ else - VCLKIndex = LVDSXlat3VCLK[VCLKIndex]; + VCLKIndex = VCLK65_315 + 2; /* LVDSXlat3VCLK */ } return VCLKIndex; -- cgit v0.10.2 From 950725920af27251b4c3b253017572c664f2300a Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Thu, 14 Jun 2012 00:21:48 +0200 Subject: staging/xgifb: Simplyfy XGI_GetVCLK2Ptr a bit This patch simplyfies the XGI_GetVCLK2Ptr a bit by moving the +=25 to a define and removing statements without effect. Signed-off-by: Peter Huewe Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index 47d60c8..3b9a0f7 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -7,6 +7,7 @@ #define IndexMask 0xff +#define TVCLKBASE_315_25 (TVCLKBASE_315 + 25) static const unsigned short XGINew_VGA_DAC[] = { 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15, @@ -1027,20 +1028,16 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo, VCLKIndex = VCLK65_315 + 2; /* LCDXlat1VCLK */ } else if (pVBInfo->VBInfo & SetCRT2ToHiVision) { if (pVBInfo->SetFlag & RPLLDIV2XO) { - VCLKIndex = TVCLKBASE_315 + HiTVVCLKDIV2; - VCLKIndex += 25; + VCLKIndex = TVCLKBASE_315_25 + HiTVVCLKDIV2; } else { - VCLKIndex = TVCLKBASE_315 + HiTVVCLK; - VCLKIndex += 25; + VCLKIndex = TVCLKBASE_315_25 + HiTVVCLK; } if (pVBInfo->SetFlag & TVSimuMode) { if (modeflag & Charx8Dot) { - VCLKIndex = TVCLKBASE_315 + HiTVSimuVCLK; - VCLKIndex += 25; + VCLKIndex = TVCLKBASE_315_25 + HiTVSimuVCLK; } else { - VCLKIndex = TVCLKBASE_315 + HiTVTextVCLK; - VCLKIndex += 25; + VCLKIndex = TVCLKBASE_315_25 + HiTVTextVCLK; } } @@ -1058,11 +1055,9 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo, } } else if (pVBInfo->VBInfo & SetCRT2ToTV) { if (pVBInfo->SetFlag & RPLLDIV2XO) { - VCLKIndex = TVCLKBASE_315 + TVVCLKDIV2; - VCLKIndex += 25; + VCLKIndex = TVCLKBASE_315_25 + TVVCLKDIV2; } else { - VCLKIndex = TVCLKBASE_315 + TVVCLK; - VCLKIndex += 25; + VCLKIndex = TVCLKBASE_315_25 + TVVCLK; } } else { /* for CRT2 */ /* di+Ext_CRTVCLK */ @@ -1071,16 +1066,11 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo, VCLKIndex &= IndexMask; } } else { /* LVDS */ - VCLKIndex = CRT2Index; - VCLKIndex = VCLKIndex >> 6; if ((pVBInfo->LCDResInfo == Panel_800x600) || (pVBInfo->LCDResInfo == Panel_320x480)) VCLKIndex = VCLK40; /* LVDSXlat1VCLK */ - else if ((pVBInfo->LCDResInfo == Panel_1024x768) || - (pVBInfo->LCDResInfo == Panel_1024x768x75)) - VCLKIndex = VCLK65_315 + 2; /* LVDSXlat2VCLK */ else - VCLKIndex = VCLK65_315 + 2; /* LVDSXlat3VCLK */ + VCLKIndex = VCLK65_315 + 2; /* LVDSXlat2VCLK, LVDSXlat3VCLK */ } return VCLKIndex; -- cgit v0.10.2 From 64e2498b6cd47eb64b1ced4ab173b6c5ecc4025e Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Thu, 14 Jun 2012 00:21:49 +0200 Subject: staging/xgifb: Remove useless function XGI_CloseCRTC Since XGI_CloseCRTC does not perform anything useful we can simply remove it. Signed-off-by: Peter Huewe Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index 3b9a0f7..2ffab45 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -6229,17 +6229,6 @@ static void XGI_SetCRT2ModeRegs(unsigned short ModeNo, } } -static void XGI_CloseCRTC(struct xgi_hw_device_info *HwDeviceExtension, - struct vb_device_info *pVBInfo) -{ - unsigned short tempbx; - - tempbx = 0; - - if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) - tempbx = 0x08A0; - -} void XGI_UnLockCRT2(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) @@ -6831,7 +6820,6 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info, XGI_SetCRT2ModeRegs(ModeNo, HwDeviceExtension, pVBInfo); XGI_OEM310Setting(ModeNo, ModeIdIndex, pVBInfo); /*0212*/ - XGI_CloseCRTC(HwDeviceExtension, pVBInfo); XGI_EnableBridge(xgifb_info, HwDeviceExtension, pVBInfo); } /* !XG20 */ else { -- cgit v0.10.2 From 03f76fc617fdcf0f9cde4d56c5d7c6d9d33acbc1 Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Thu, 14 Jun 2012 00:21:50 +0200 Subject: staging/xgifb: Replace delay lookup tables with constant values For TV Devices: The values taken from XGI_TVDelayList are always overwritten with the values from XGI_TVDelayList2 since the if condition for using the values from XGI_TVDelayList2 is identical with the check to enter this scope and thus always true. The delay values in XGI_TVDelayList2 is always 0x22 so we can simply replace it with this constant value. For LCD Devices: The LCD_DelayCompensation field is always set to 0x12 so we can simply replace this field with a constant value. This saves about 500 bytes in compiled size. Signed-off-by: Peter Huewe Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index 2ffab45..c6c6843 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -105,9 +105,6 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo) else pVBInfo->LCDCapList = XGI_LCDCapList; - pVBInfo->XGI_TVDelayList = XGI301TVDelayList; - pVBInfo->XGI_TVDelayList2 = XGI301TVDelayList2; - pVBInfo->pXGINew_I2CDefinition = &XG40_I2CDefinition; if (ChipType >= XG20) @@ -5712,32 +5709,19 @@ static void XGI_GetTVPtrIndex2(unsigned short *tempbx, unsigned char *tempcl, static void XGI_SetDelayComp(struct vb_device_info *pVBInfo) { - unsigned short index; - unsigned char tempah, tempbl, tempbh; if (pVBInfo->VBType & (VB_SIS301B | VB_SIS302B | VB_SIS301LV | VB_SIS302LV | VB_XGI301C)) { if (pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA | SetCRT2ToTV | SetCRT2ToRAMDAC)) { - tempbl = 0; tempbh = 0; - - index = XGI_GetTVPtrIndex(pVBInfo); /* Get TV Delay */ - tempbl = pVBInfo->XGI_TVDelayList[index]; - - if (pVBInfo->VBType & (VB_SIS301B | VB_SIS302B - | VB_SIS301LV | VB_SIS302LV - | VB_XGI301C)) - tempbl = pVBInfo->XGI_TVDelayList2[index]; + tempbl = XGI301TVDelay; if (pVBInfo->VBInfo & SetCRT2ToDualEdge) tempbl = tempbl >> 4; if (pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) { - /* Get LCD Delay */ - index = XGI_GetLCDCapPtr(pVBInfo); - tempbh = pVBInfo->LCDCapList[index]. - LCD_DelayCompensation; + tempbh = XGI301LCDDelay; if (!(pVBInfo->VBInfo & XGI_SetCRT2ToLCDA)) tempbl = tempbh; @@ -5763,10 +5747,7 @@ static void XGI_SetDelayComp(struct vb_device_info *pVBInfo) tempbl = 0; tempbh = 0; if (pVBInfo->VBInfo & SetCRT2ToLCD) { - /* / Get LCD Delay */ - tempah = pVBInfo->LCDCapList[ - XGI_GetLCDCapPtr(pVBInfo)]. - LCD_DelayCompensation; + tempah = XGI301LCDDelay; tempah &= 0x0f; tempah = tempah << 4; xgifb_reg_and_or(pVBInfo->Part1Port, 0x2D, 0x0f, diff --git a/drivers/staging/xgifb/vb_struct.h b/drivers/staging/xgifb/vb_struct.h index 38f47ff..b954971 100644 --- a/drivers/staging/xgifb/vb_struct.h +++ b/drivers/staging/xgifb/vb_struct.h @@ -126,7 +126,6 @@ struct XGI330_LCDCapStruct { unsigned char LCD_ID; unsigned short LCD_Capability; unsigned char LCD_SetFlag; - unsigned char LCD_DelayCompensation; unsigned char LCD_HSyncWidth; unsigned char LCD_VSyncWidth; unsigned char LCD_VCLK; @@ -262,8 +261,6 @@ struct vb_device_info { struct SiS_MCLKData *MCLKData; struct XGI_ECLKDataStruct *ECLKData; - unsigned char *XGI_TVDelayList; - unsigned char *XGI_TVDelayList2; unsigned char *NTSCTiming; unsigned char *PALTiming; unsigned char *HiTVExtTiming; diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h index 9a17113..50ef885 100644 --- a/drivers/staging/xgifb/vb_table.h +++ b/drivers/staging/xgifb/vb_table.h @@ -1993,70 +1993,70 @@ static unsigned short LCDLenList[] = { /* Dual link only */ static struct XGI330_LCDCapStruct XGI_LCDDLCapList[] = { /* LCDCap1024x768 */ - {Panel_1024x768, DefaultLCDCap, 0, 0x012, 0x88, 0x06, VCLK65_315, + {Panel_1024x768, DefaultLCDCap, 0, 0x88, 0x06, VCLK65_315, 0x6C, 0xC3, 0x35, 0x62, 0x02, 0x14, 0x0A, 0x02, 0x00, 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x28, 0x10}, /* LCDCap1280x1024 */ {Panel_1280x1024, XGI_LCDDualLink+DefaultLCDCap, StLCDBToA, - 0x012, 0x70, 0x03, VCLK108_2_315, + 0x70, 0x03, VCLK108_2_315, 0x70, 0x44, 0xF8, 0x2F, 0x02, 0x14, 0x0A, 0x02, 0x00, 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x30, 0x10}, /* LCDCap1400x1050 */ {Panel_1400x1050, XGI_LCDDualLink+DefaultLCDCap, StLCDBToA, - 0x012, 0x70, 0x03, VCLK108_2_315, + 0x70, 0x03, VCLK108_2_315, 0x70, 0x44, 0xF8, 0x2F, 0x02, 0x14, 0x0A, 0x02, 0x00, 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x30, 0x10}, /* LCDCap1600x1200 */ {Panel_1600x1200, XGI_LCDDualLink+DefaultLCDCap, LCDToFull, - 0x012, 0xC0, 0x03, VCLK162, + 0xC0, 0x03, VCLK162, 0x43, 0x22, 0x70, 0x24, 0x02, 0x14, 0x0A, 0x02, 0x00, 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x30, 0x10}, /* LCDCap1024x768x75 */ - {Panel_1024x768x75, DefaultLCDCap, 0, 0x012, 0x60, 0, VCLK78_75, + {Panel_1024x768x75, DefaultLCDCap, 0, 0x60, 0, VCLK78_75, 0x2B, 0x61, 0x2B, 0x61, 0x02, 0x14, 0x0A, 0x02, 0x00, 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x28, 0x10}, /* LCDCap1280x1024x75 */ {Panel_1280x1024x75, XGI_LCDDualLink+DefaultLCDCap, StLCDBToA, - 0x012, 0x90, 0x03, VCLK135_5, + 0x90, 0x03, VCLK135_5, 0x54, 0x42, 0x4A, 0x61, 0x02, 0x14, 0x0A, 0x02, 0x00, 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x30, 0x10}, /* LCDCapDefault */ - {0xFF, DefaultLCDCap, 0, 0x012, 0x88, 0x06, VCLK65_315, + {0xFF, DefaultLCDCap, 0, 0x88, 0x06, VCLK65_315, 0x6C, 0xC3, 0x35, 0x62, 0x02, 0x14, 0x0A, 0x02, 0x00, 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x28, 0x10} }; static struct XGI330_LCDCapStruct XGI_LCDCapList[] = { /* LCDCap1024x768 */ - {Panel_1024x768, DefaultLCDCap, 0, 0x012, 0x88, 0x06, VCLK65_315, + {Panel_1024x768, DefaultLCDCap, 0, 0x88, 0x06, VCLK65_315, 0x6C, 0xC3, 0x35, 0x62, 0x02, 0x14, 0x0A, 0x02, 0x00, 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x28, 0x10}, /* LCDCap1280x1024 */ {Panel_1280x1024, DefaultLCDCap, StLCDBToA, - 0x012, 0x70, 0x03, VCLK108_2_315, + 0x70, 0x03, VCLK108_2_315, 0x70, 0x44, 0xF8, 0x2F, 0x02, 0x14, 0x0A, 0x02, 0x00, 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x30, 0x10}, /* LCDCap1400x1050 */ {Panel_1400x1050, DefaultLCDCap, StLCDBToA, - 0x012, 0x70, 0x03, VCLK108_2_315, + 0x70, 0x03, VCLK108_2_315, 0x70, 0x44, 0xF8, 0x2F, 0x02, 0x14, 0x0A, 0x02, 0x00, 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x30, 0x10}, /* LCDCap1600x1200 */ {Panel_1600x1200, DefaultLCDCap, LCDToFull, - 0x012, 0xC0, 0x03, VCLK162, + 0xC0, 0x03, VCLK162, 0x5A, 0x23, 0x5A, 0x23, 0x02, 0x14, 0x0A, 0x02, 0x00, 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x30, 0x10}, /* LCDCap1024x768x75 */ - {Panel_1024x768x75, DefaultLCDCap, 0, 0x012, 0x60, 0, VCLK78_75, + {Panel_1024x768x75, DefaultLCDCap, 0, 0x60, 0, VCLK78_75, 0x2B, 0x61, 0x2B, 0x61, 0x02, 0x14, 0x0A, 0x02, 0x00, 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x28, 0x10}, /* LCDCap1280x1024x75 */ {Panel_1280x1024x75, DefaultLCDCap, StLCDBToA, - 0x012, 0x90, 0x03, VCLK135_5, + 0x90, 0x03, VCLK135_5, 0x54, 0x42, 0x4A, 0x61, 0x02, 0x14, 0x0A, 0x02, 0x00, 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x30, 0x10}, /* LCDCapDefault */ - {0xFF, DefaultLCDCap, 0, 0x012, 0x88, 0x06, VCLK65_315, + {0xFF, DefaultLCDCap, 0, 0x88, 0x06, VCLK65_315, 0x6C, 0xC3, 0x35, 0x62, 0x02, 0x14, 0x0A, 0x02, 0x00, 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x28, 0x10} }; @@ -2482,36 +2482,8 @@ static struct XGI330_VCLKDataStruct XGI_VBVCLKData[] = { {0xFF, 0x00, 0} /* End mark */ }; -static unsigned char XGI301TVDelayList[] = { - 0x22, /* ; 0 ExtNTSCDelay */ - 0x22, /* ; 1 StNTSCDelay */ - 0x22, /* ; 2 ExtPALDelay */ - 0x22, /* ; 3 StPALDelay */ - 0x88, /* ; 4 ExtHiTVDelay(1080i) */ - 0xBB, /* ; 5 StHiTVDelay(1080i) */ - 0x22, /* ; 6 ExtYPbPrDelay(525i) */ - 0x22, /* ; 7 StYPbPrDealy(525i) */ - 0x22, /* ; 8 ExtYPbPrDelay(525p) */ - 0x22, /* ; 9 StYPbPrDealy(525p) */ - 0x22, /* ; A ExtYPbPrDelay(750p) */ - 0x22 /* B StYPbPrDealy(750p) */ -}; - -static unsigned char XGI301TVDelayList2[] = { - 0x22, /* ; 0 ExtNTSCDelay */ - 0x22, /* ; 1 StNTSCDelay */ - 0x22, /* ; 2 ExtPALDelay */ - 0x22, /* ; 3 StPALDelay */ - 0x22, /* ; 4 ExtHiTVDelay */ - 0x22, /* ; 5 StHiTVDelay */ - 0x22, /* ; 6 ExtYPbPrDelay(525i) */ - 0x22, /* ; 7 StYPbPrDealy(525i) */ - 0x22, /* ; 8 ExtYPbPrDelay(525p) */ - 0x22, /* ; 9 StYPbPrDealy(525p) */ - 0x22, /* ; A ExtYPbPrDelay(750p) */ - 0x22 /* ; B StYPbPrDealy(750p) */ -}; - +#define XGI301TVDelay 0x22 +#define XGI301LCDDelay 0x12 static unsigned char TVAntiFlickList[] = {/* NTSCAntiFlicker */ 0x04, /* ; 0 Adaptive */ -- cgit v0.10.2 From 51f984bc068c8704221a8eddd96b580eafcd2912 Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Thu, 14 Jun 2012 00:21:51 +0200 Subject: staging/xgifb: Use SiS structs This patch replaces some of the XGI internal structs by their counterparts in the SiS driver. XGI330_LVDSDataStruct -> SiS_LVDSData XGI330_LCDDataStruct -> SiS_LCDData XGI330_CHTVDataStruct -> SiS_LVDSData Signed-off-by: Peter Huewe Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index c6c6843..183afe4 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -1980,12 +1980,12 @@ static void XGI_GetLVDSData(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) { unsigned short tempbx; - struct XGI330_LVDSDataStruct *LCDPtr = NULL; + struct SiS_LVDSData *LCDPtr = NULL; tempbx = 2; if (pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) { - LCDPtr = (struct XGI330_LVDSDataStruct *) XGI_GetLcdPtr(tempbx, + LCDPtr = (struct SiS_LVDSData *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); pVBInfo->VGAHT = LCDPtr->VGAHT; diff --git a/drivers/staging/xgifb/vb_struct.h b/drivers/staging/xgifb/vb_struct.h index b954971..b54488b 100644 --- a/drivers/staging/xgifb/vb_struct.h +++ b/drivers/staging/xgifb/vb_struct.h @@ -51,13 +51,6 @@ struct XGI_LCDDataTablStruct { unsigned short DATAPTR; }; -struct XGI330_LVDSDataStruct { - unsigned short VGAHT; - unsigned short VGAVT; - unsigned short LCDHT; - unsigned short LCDVT; -}; - struct XGI330_LCDDataDesStruct2 { unsigned short LCDHDES; unsigned short LCDHRS; @@ -67,15 +60,6 @@ struct XGI330_LCDDataDesStruct2 { unsigned short LCDVSync; }; -struct XGI330_LCDDataStruct { - unsigned short RVBHCMAX; - unsigned short RVBHCFACT; - unsigned short VGAHT; - unsigned short VGAVT; - unsigned short LCDHT; - unsigned short LCDVT; -}; - struct XGI330_TVDataStruct { unsigned short RVBHCMAX; @@ -103,13 +87,6 @@ struct XGI330_TVDataTablStruct { }; -struct XGI330_CHTVDataStruct { - unsigned short VGAHT; - unsigned short VGAVT; - unsigned short LCDHT; - unsigned short LCDVT; -}; - struct XGI_TimingHStruct { unsigned char data[8]; }; @@ -173,11 +150,6 @@ struct XGI_CRT1TableStruct { }; -struct XGI330_VCLKDataStruct { - unsigned char SR2B, SR2C; - unsigned short CLOCK; -}; - struct XGI301C_Tap4TimingStruct { unsigned short DE; unsigned char Reg[64]; /* C0-FF */ diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h index 50ef885..16bb831 100644 --- a/drivers/staging/xgifb/vb_table.h +++ b/drivers/staging/xgifb/vb_table.h @@ -420,7 +420,7 @@ static unsigned char XGI_CH7017LV1400x1050[] = { 0xAD, 0xDB, 0xF6, 0xAC, 0xE0, 0x02}; /*add for new UNIVGABIOS*/ -static struct XGI330_LCDDataStruct XGI_StLCD1024x768Data[] = { +static struct SiS_LCDData XGI_StLCD1024x768Data[] = { {62, 25, 800, 546, 1344, 806}, {32, 15, 930, 546, 1344, 806}, {62, 25, 800, 546, 1344, 806}, /*chiawenfordot9->dot8*/ @@ -430,7 +430,7 @@ static struct XGI330_LCDDataStruct XGI_StLCD1024x768Data[] = { {1, 1, 1344, 806, 1344, 806} }; -static struct XGI330_LCDDataStruct XGI_ExtLCD1024x768Data[] = { +static struct SiS_LCDData XGI_ExtLCD1024x768Data[] = { /* { 12, 5, 896, 512,1344, 806}, // alan 09/12/2003 */ {42, 25, 1536, 419, 1344, 806}, /* { 12, 5, 896, 510,1344, 806}, // alan 09/12/2003 */ @@ -450,7 +450,7 @@ static struct XGI330_LCDDataStruct XGI_ExtLCD1024x768Data[] = { {1, 1, 1344, 806, 1344, 806} }; -static struct XGI330_LCDDataStruct XGI_CetLCD1024x768Data[] = { +static struct SiS_LCDData XGI_CetLCD1024x768Data[] = { {1, 1, 1344, 806, 1344, 806}, /* ; 00 (320x200,320x400, 640x200,640x400) */ {1, 1, 1344, 806, 1344, 806}, /* 01 (320x350,640x350) */ @@ -461,7 +461,7 @@ static struct XGI330_LCDDataStruct XGI_CetLCD1024x768Data[] = { {1, 1, 1344, 806, 1344, 806} /* 06 (1024x768x60Hz) */ }; -static struct XGI330_LCDDataStruct XGI_StLCD1280x1024Data[] = { +static struct SiS_LCDData XGI_StLCD1280x1024Data[] = { {22, 5, 800, 510, 1650, 1088}, {22, 5, 800, 510, 1650, 1088}, {176, 45, 900, 510, 1650, 1088}, @@ -472,7 +472,7 @@ static struct XGI330_LCDDataStruct XGI_StLCD1280x1024Data[] = { {1, 1, 1688, 1066, 1688, 1066} }; -static struct XGI330_LCDDataStruct XGI_ExtLCD1280x1024Data[] = { +static struct SiS_LCDData XGI_ExtLCD1280x1024Data[] = { {211, 60, 1024, 501, 1688, 1066}, {211, 60, 1024, 508, 1688, 1066}, {211, 60, 1024, 501, 1688, 1066}, @@ -483,7 +483,7 @@ static struct XGI330_LCDDataStruct XGI_ExtLCD1280x1024Data[] = { {1, 1, 1688, 1066, 1688, 1066} }; -static struct XGI330_LCDDataStruct XGI_CetLCD1280x1024Data[] = { +static struct SiS_LCDData XGI_CetLCD1280x1024Data[] = { {1, 1, 1688, 1066, 1688, 1066}, /* 00 (320x200,320x400, 640x200,640x400) */ {1, 1, 1688, 1066, 1688, 1066}, /* 01 (320x350,640x350) */ @@ -496,7 +496,7 @@ static struct XGI330_LCDDataStruct XGI_CetLCD1280x1024Data[] = { {1, 1, 1688, 1066, 1688, 1066} /* 08 (1400x1050x60Hz) */ }; -static struct XGI330_LCDDataStruct xgifb_lcd_1400x1050[] = { +static struct SiS_LCDData xgifb_lcd_1400x1050[] = { {211, 100, 2100, 408, 1688, 1066}, /* 00 (320x200,320x400, 640x200,640x400) */ {211, 64, 1536, 358, 1688, 1066}, /* 01 (320x350,640x350) */ @@ -510,7 +510,7 @@ static struct XGI330_LCDDataStruct xgifb_lcd_1400x1050[] = { {1, 1, 1688, 1066, 1688, 1066} /* 08 (1400x1050x60Hz) */ }; -static struct XGI330_LCDDataStruct XGI_ExtLCD1600x1200Data[] = { +static struct SiS_LCDData XGI_ExtLCD1600x1200Data[] = { {4, 1, 1620, 420, 2160, 1250}, /* { 3,1,2160,425,2160,1250 }, // 00 (320x200,320x400, // 640x200,640x400) @@ -528,7 +528,7 @@ static struct XGI330_LCDDataStruct XGI_ExtLCD1600x1200Data[] = { {1, 1, 2160, 1250, 2160, 1250} /* 09 (1600x1200x60Hz) ;302lv */ }; -static struct XGI330_LCDDataStruct XGI_StLCD1600x1200Data[] = { +static struct SiS_LCDData XGI_StLCD1600x1200Data[] = { {27, 4, 800, 500, 2160, 1250}, /* 00 (320x200,320x400, 640x200,640x400) */ {27, 4, 800, 500, 2160, 1250}, /* 01 (320x350,640x350) */ @@ -542,7 +542,7 @@ static struct XGI330_LCDDataStruct XGI_StLCD1600x1200Data[] = { {1, 1, 2160, 1250, 2160, 1250} /* 09 (1600x1200) */ }; -static struct XGI330_LCDDataStruct XGI_CetLCD1400x1050Data[] = { +static struct SiS_LCDData XGI_CetLCD1400x1050Data[] = { {1, 1, 1688, 1066, 1688, 1066}, /* 00 (320x200,320x400, 640x200,640x400) */ {1, 1, 1688, 1066, 1688, 1066}, /* 01 (320x350,640x350) */ @@ -555,7 +555,7 @@ static struct XGI330_LCDDataStruct XGI_CetLCD1400x1050Data[] = { {1, 1, 1688, 1066, 1688, 1066} /* 08 (1400x1050x60Hz) */ }; -static struct XGI330_LCDDataStruct XGI_NoScalingData[] = { +static struct SiS_LCDData XGI_NoScalingData[] = { {1, 1, 800, 449, 800, 449}, {1, 1, 800, 449, 800, 449}, {1, 1, 900, 449, 900, 449}, @@ -566,7 +566,7 @@ static struct XGI330_LCDDataStruct XGI_NoScalingData[] = { {1, 1, 1688, 1066, 1688, 1066} }; -static struct XGI330_LCDDataStruct XGI_ExtLCD1024x768x75Data[] = { +static struct SiS_LCDData XGI_ExtLCD1024x768x75Data[] = { {42, 25, 1536, 419, 1344, 806}, /* ; 00 (320x200,320x400, 640x200,640x400) */ {48, 25, 1536, 369, 1344, 806}, /* ; 01 (320x350,640x350) */ @@ -577,7 +577,7 @@ static struct XGI330_LCDDataStruct XGI_ExtLCD1024x768x75Data[] = { {1, 1, 1312, 800, 1312, 800} /* ; 06 (1024x768x75Hz) */ }; -static struct XGI330_LCDDataStruct XGI_CetLCD1024x768x75Data[] = { +static struct SiS_LCDData XGI_CetLCD1024x768x75Data[] = { {1, 1, 1312, 800, 1312, 800}, /* ; 00 (320x200,320x400, 640x200,640x400) */ {1, 1, 1312, 800, 1312, 800}, /* ; 01 (320x350,640x350) */ @@ -588,7 +588,7 @@ static struct XGI330_LCDDataStruct XGI_CetLCD1024x768x75Data[] = { {1, 1, 1312, 800, 1312, 800} /* ; 06 (1024x768x75Hz) */ }; -static struct XGI330_LCDDataStruct xgifb_lcd_1280x1024x75[] = { +static struct SiS_LCDData xgifb_lcd_1280x1024x75[] = { {211, 60, 1024, 501, 1688, 1066}, /* ; 00 (320x200,320x400, 640x200,640x400) */ {211, 60, 1024, 508, 1688, 1066}, /* ; 01 (320x350,640x350) */ @@ -600,7 +600,7 @@ static struct XGI330_LCDDataStruct xgifb_lcd_1280x1024x75[] = { {1, 1, 1688, 1066, 1688, 1066} /* ; 07 (1280x1024x75Hz) */ }; -static struct XGI330_LCDDataStruct XGI_CetLCD1280x1024x75Data[] = { +static struct SiS_LCDData XGI_CetLCD1280x1024x75Data[] = { {1, 1, 1688, 1066, 1688, 1066}, /* ; 00 (320x200,320x400, 640x200,640x400) */ {1, 1, 1688, 1066, 1688, 1066}, /* ; 01 (320x350,640x350) */ @@ -612,7 +612,7 @@ static struct XGI330_LCDDataStruct XGI_CetLCD1280x1024x75Data[] = { {1, 1, 1688, 1066, 1688, 1066} /* ; 07 (1280x1024x75Hz) */ }; -static struct XGI330_LCDDataStruct XGI_NoScalingDatax75[] = { +static struct SiS_LCDData XGI_NoScalingDatax75[] = { {1, 1, 800, 449, 800, 449}, /* ; 00 (320x200, 320x400, 640x200, 640x400) */ {1, 1, 800, 449, 800, 449}, /* ; 01 (320x350, 640x350) */ @@ -1222,7 +1222,7 @@ static unsigned char XGI330_Ren750pGroup3[] = { 0x18, 0x1D, 0x23, 0x28, 0x4C, 0xAA, 0x01 }; -static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Data_1[] = { +static struct SiS_LVDSData XGI_LVDS1024x768Data_1[] = { { 960, 438, 1344, 806}, /* 00 (320x200,320x400,640x200,640x400) */ { 960, 388, 1344, 806}, /* 01 (320x350,640x350) */ {1040, 438, 1344, 806}, /* 02 (360x400,720x400) */ @@ -1233,7 +1233,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Data_1[] = { }; -static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Data_2[] = { +static struct SiS_LVDSData XGI_LVDS1024x768Data_2[] = { {1344, 806, 1344, 806}, {1344, 806, 1344, 806}, {1344, 806, 1344, 806}, @@ -1245,7 +1245,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Data_2[] = { {800, 525, 1280, 813} }; -static struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Data_1[] = { +static struct SiS_LVDSData XGI_LVDS1280x1024Data_1[] = { {1048, 442, 1688, 1066}, {1048, 392, 1688, 1066}, {1048, 442, 1688, 1066}, @@ -1256,7 +1256,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Data_1[] = { {1688, 1066, 1688, 1066} }; -static struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Data_2[] = { +static struct SiS_LVDSData XGI_LVDS1280x1024Data_2[] = { {1344, 806, 1344, 806}, {1344, 806, 1344, 806}, {1344, 806, 1344, 806}, @@ -1268,7 +1268,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Data_2[] = { {800, 525, 1280, 813} }; -static struct XGI330_LVDSDataStruct XGI_LVDS1400x1050Data_1[] = { +static struct SiS_LVDSData XGI_LVDS1400x1050Data_1[] = { {928, 416, 1688, 1066}, {928, 366, 1688, 1066}, {928, 416, 1688, 1066}, @@ -1280,7 +1280,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDS1400x1050Data_1[] = { {1688, 1066, 1688, 1066} }; -static struct XGI330_LVDSDataStruct XGI_LVDS1400x1050Data_2[] = { +static struct SiS_LVDSData XGI_LVDS1400x1050Data_2[] = { {1688, 1066, 1688, 1066}, {1688, 1066, 1688, 1066}, {1688, 1066, 1688, 1066}, @@ -1293,7 +1293,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDS1400x1050Data_2[] = { }; /* ;;[ycchen] 12/05/02 LCDHTxLCDVT=2048x1320 */ -static struct XGI330_LVDSDataStruct XGI_LVDS1600x1200Data_1[] = { +static struct SiS_LVDSData XGI_LVDS1600x1200Data_1[] = { {1088, 520, 2048, 1320}, /* 00 (320x200,320x400,640x200,640x400) */ {1088, 470, 2048, 1320}, /* 01 (320x350,640x350) */ {1088, 520, 2048, 1320}, /* 02 (360x400,720x400) */ @@ -1306,7 +1306,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDS1600x1200Data_1[] = { {2048, 1320, 2048, 1320} /* 09 (1600x1200) */ }; -static struct XGI330_LVDSDataStruct XGI_LVDSNoScalingData[] = { +static struct SiS_LVDSData XGI_LVDSNoScalingData[] = { { 800, 449, 800, 449}, /* 00 (320x200,320x400,640x200,640x400) */ { 800, 449, 800, 449}, /* 01 (320x350,640x350) */ { 800, 449, 800, 449}, /* 02 (360x400,720x400) */ @@ -1320,7 +1320,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDSNoScalingData[] = { {1688, 806, 1688, 806} /* 0A (1280x768x60Hz) */ }; -static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Data_1x75[] = { +static struct SiS_LVDSData XGI_LVDS1024x768Data_1x75[] = { { 960, 438, 1312, 800}, /* 00 (320x200,320x400,640x200,640x400) */ { 960, 388, 1312, 800}, /* 01 (320x350,640x350) */ {1040, 438, 1312, 800}, /* 02 (360x400,720x400) */ @@ -1331,7 +1331,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Data_1x75[] = { }; -static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Data_2x75[] = { +static struct SiS_LVDSData XGI_LVDS1024x768Data_2x75[] = { {1312, 800, 1312, 800}, /* ; 00 (320x200,320x400,640x200,640x400) */ {1312, 800, 1312, 800}, /* ; 01 (320x350,640x350) */ {1312, 800, 1312, 800}, /* ; 02 (360x400,720x400) */ @@ -1341,7 +1341,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Data_2x75[] = { {1312, 800, 1312, 800}, /* ; 06 (512x384,1024x768) */ }; -static struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Data_1x75[] = { +static struct SiS_LVDSData XGI_LVDS1280x1024Data_1x75[] = { {1048, 442, 1688, 1066 }, /* ; 00 (320x200,320x400,640x200,640x400) */ {1048, 392, 1688, 1066 }, /* ; 01 (320x350,640x350) */ {1128, 442, 1688, 1066 }, /* ; 02 (360x400,720x400) */ @@ -1352,7 +1352,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Data_1x75[] = { {1688, 1066, 1688, 1066 }, /* ; 06; 07 (640x512,1280x1024) */ }; -static struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Data_2x75[] = { +static struct SiS_LVDSData XGI_LVDS1280x1024Data_2x75[] = { {1688, 1066, 1688, 1066 }, /* ; 00 (320x200,320x400,640x200,640x400) */ {1688, 1066, 1688, 1066 }, /* ; 01 (320x350,640x350) */ {1688, 1066, 1688, 1066 }, /* ; 02 (360x400,720x400) */ @@ -1363,7 +1363,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Data_2x75[] = { {1688, 1066, 1688, 1066 }, /* ; 06; 07 (640x512,1280x1024) */ }; -static struct XGI330_LVDSDataStruct XGI_LVDSNoScalingDatax75[] = { +static struct SiS_LVDSData XGI_LVDSNoScalingDatax75[] = { { 800, 449, 800, 449}, /* ; 00 (320x200,320x400,640x200,640x400) */ { 800, 449, 800, 449}, /* ; 01 (320x350,640x350) */ { 900, 449, 900, 449}, /* ; 02 (360x400,720x400) */ @@ -1378,7 +1378,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDSNoScalingDatax75[] = { {1688, 806, 1688, 806}, /* ; 0A (1280x768x75Hz) */ }; -static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_1[] = { +static struct SiS_LVDSData XGI_LVDS1024x768Des_1[] = { {0, 1048, 0, 771}, /* 00 (320x200,320x400,640x200,640x400) */ {0, 1048, 0, 771}, /* 01 (320x350,640x350) */ {0, 1048, 0, 771}, /* 02 (360x400,720x400) */ @@ -1388,7 +1388,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_1[] = { {0, 1048, 805, 770} /* 06 (1024x768x60Hz) */ } ; -static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_2[] = { +static struct SiS_LVDSData XGI_LVDS1024x768Des_2[] = { {1142, 856, 622, 587}, /* 00 (320x200,320x400,640x200,640x400) */ {1142, 856, 597, 562}, /* 01 (320x350,640x350) */ {1142, 856, 622, 587}, /* 02 (360x400,720x400) */ @@ -1398,7 +1398,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_2[] = { { 0, 1048, 805, 771} /* 06 (1024x768x60Hz) */ }; -static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_3[] = { +static struct SiS_LVDSData XGI_LVDS1024x768Des_3[] = { {320, 24, 622, 587}, /* 00 (320x200,320x400,640x200,640x400) */ {320, 24, 597, 562}, /* 01 (320x350,640x350) */ {320, 24, 622, 587}, /* 02 (360x400,720x400) */ @@ -1406,7 +1406,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_3[] = { {320, 24, 722, 687} /* 04 (640x480x60Hz) */ }; -static struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Des_1[] = { +static struct SiS_LVDSData XGI_LVDS1280x1024Des_1[] = { {0, 1328, 0, 1025}, /* 00 (320x200,320x400,640x200,640x400) */ {0, 1328, 0, 1025}, /* 01 (320x350,640x350) */ {0, 1328, 0, 1025}, /* 02 (360x400,720x400) */ @@ -1418,7 +1418,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Des_1[] = { }; /* The Display setting for DE Mode Panel */ -static struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Des_2[] = { +static struct SiS_LVDSData XGI_LVDS1280x1024Des_2[] = { {1368, 1008, 752, 711}, /* 00 (320x200,320x400,640x200,640x400) */ {1368, 1008, 729, 688}, /* 01 (320x350,640x350) */ {1408, 1048, 752, 711}, /* 02 (360x400,720x400) */ @@ -1429,7 +1429,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Des_2[] = { {0000, 1328, 0, 1025} /* 07 (1280x1024x60Hz) */ }; -static struct XGI330_LVDSDataStruct XGI_LVDS1400x1050Des_1[] = { +static struct SiS_LVDSData XGI_LVDS1400x1050Des_1[] = { {0, 1448, 0, 1051}, /* 00 (320x200,320x400,640x200,640x400) */ {0, 1448, 0, 1051}, /* 01 (320x350,640x350) */ {0, 1448, 0, 1051}, /* 02 (360x400,720x400) */ @@ -1441,7 +1441,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDS1400x1050Des_1[] = { {0, 1448, 0, 1051} /* 08 (1400x1050x60Hz) */ }; -static struct XGI330_LVDSDataStruct XGI_LVDS1400x1050Des_2[] = { +static struct SiS_LVDSData XGI_LVDS1400x1050Des_2[] = { {1308, 1068, 781, 766}, /* 00 (320x200,320x400,640x200,640x400) */ {1308, 1068, 781, 766}, /* 01 (320x350,640x350) */ {1308, 1068, 781, 766}, /* 02 (360x400,720x400) */ @@ -1453,7 +1453,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDS1400x1050Des_2[] = { { 0, 1448, 0, 1051} /* 08 (1400x1050x60Hz) */ }; -static struct XGI330_LVDSDataStruct XGI_LVDS1600x1200Des_1[] = { +static struct SiS_LVDSData XGI_LVDS1600x1200Des_1[] = { {0, 1664, 0, 1201}, /* 00 (320x200,320x400,640x200,640x400) */ {0, 1664, 0, 1201}, /* 01 (320x350,640x350) */ {0, 1664, 0, 1201}, /* 02 (360x400,720x400) */ @@ -1483,7 +1483,7 @@ static struct XGI330_LCDDataDesStruct2 XGI_LVDSNoScalingDesData[] = { }; /* ; 1024x768 Full-screen */ -static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_1x75[] = { +static struct SiS_LVDSData XGI_LVDS1024x768Des_1x75[] = { {0, 1040, 0, 769}, /* ; 00 (320x200,320x400,640x200,640x400) */ {0, 1040, 0, 769}, /* ; 01 (320x350,640x350) */ {0, 1040, 0, 769}, /* ; 02 (360x400,720x400) */ @@ -1494,7 +1494,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_1x75[] = { }; /* ; 1024x768 center-screen (Enh. Mode) */ -static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_2x75[] = { +static struct SiS_LVDSData XGI_LVDS1024x768Des_2x75[] = { {1142, 856, 622, 587}, /* 00 (320x200,320x400,640x200,640x400) */ {1142, 856, 597, 562}, /* 01 (320x350,640x350) */ {1142, 856, 622, 587}, /* 02 (360x400,720x400) */ @@ -1505,7 +1505,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_2x75[] = { }; /* ; 1024x768 center-screen (St.Mode) */ -static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_3x75[] = { +static struct SiS_LVDSData XGI_LVDS1024x768Des_3x75[] = { {320, 24, 622, 587}, /* ; 00 (320x200,320x400,640x200,640x400) */ {320, 24, 597, 562}, /* ; 01 (320x350,640x350) */ {320, 24, 622, 587}, /* ; 02 (360x400,720x400) */ @@ -1513,7 +1513,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_3x75[] = { {320, 24, 722, 687} /* ; 04 (640x480x60Hz) */ }; -static struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Des_1x75[] = { +static struct SiS_LVDSData XGI_LVDS1280x1024Des_1x75[] = { {0, 1296, 0, 1025}, /* ; 00 (320x200,320x400,640x200,640x400) */ {0, 1296, 0, 1025}, /* ; 01 (320x350,640x350) */ {0, 1296, 0, 1025}, /* ; 02 (360x400,720x400) */ @@ -1526,7 +1526,7 @@ static struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Des_1x75[] = { /* The Display setting for DE Mode Panel */ /* [ycchen] 02/18/03 Set DE as default */ -static struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Des_2x75[] = { +static struct SiS_LVDSData XGI_LVDS1280x1024Des_2x75[] = { {1368, 976, 752, 711}, /* ; 00 (320x200,320x400,640x200,640x400) */ {1368, 976, 729, 688}, /* ; 01 (320x350,640x350) */ {1408, 976, 752, 711}, /* ; 02 (360x400,720x400) */ @@ -1554,7 +1554,7 @@ static struct XGI330_LCDDataDesStruct2 XGI_LVDSNoScalingDesDatax75[] = { {0, 1328, 0, 771, 112, 6} /* ; 0A (1280x768x75Hz) */ }; -static struct XGI330_CHTVDataStruct XGI_CHTVUNTSCData[] = { +static struct SiS_LVDSData XGI_CHTVUNTSCData[] = { { 840, 600, 840, 600}, { 840, 600, 840, 600}, { 840, 600, 840, 600}, @@ -1563,7 +1563,7 @@ static struct XGI330_CHTVDataStruct XGI_CHTVUNTSCData[] = { {1064, 750, 1064, 750} }; -static struct XGI330_CHTVDataStruct XGI_CHTVONTSCData[] = { +static struct SiS_LVDSData XGI_CHTVONTSCData[] = { { 840, 525, 840, 525}, { 840, 525, 840, 525}, { 840, 525, 840, 525}, @@ -1572,7 +1572,7 @@ static struct XGI330_CHTVDataStruct XGI_CHTVONTSCData[] = { {1040, 700, 1040, 700} }; -static struct XGI330_CHTVDataStruct XGI_CHTVUPALData[] = { +static struct SiS_LVDSData XGI_CHTVUPALData[] = { {1008, 625, 1008, 625}, {1008, 625, 1008, 625}, {1008, 625, 1008, 625}, @@ -1581,7 +1581,7 @@ static struct XGI330_CHTVDataStruct XGI_CHTVUPALData[] = { { 936, 836, 936, 836} }; -static struct XGI330_CHTVDataStruct XGI_CHTVOPALData[] = { +static struct SiS_LVDSData XGI_CHTVOPALData[] = { {1008, 625, 1008, 625}, {1008, 625, 1008, 625}, {1008, 625, 1008, 625}, @@ -2297,7 +2297,7 @@ static unsigned char XG27_SR41 = 0x00 ; static unsigned char Z11m_CR97 = 0x80 ; -static struct XGI330_VCLKDataStruct XGI_VCLKData[] = { +static struct SiS_VCLKData XGI_VCLKData[] = { /* SR2B,SR2C,SR2D */ {0x1B, 0xE1, 25}, /* 00 (25.175MHz) */ {0x4E, 0xE4, 28}, /* 01 (28.322MHz) */ @@ -2390,7 +2390,7 @@ static struct XGI330_VCLKDataStruct XGI_VCLKData[] = { {0xFF, 0x00, 0} /* End mark */ }; -static struct XGI330_VCLKDataStruct XGI_VBVCLKData[] = { +static struct SiS_VCLKData XGI_VBVCLKData[] = { {0x1B, 0xE1, 25}, /* 00 (25.175MHz) */ {0x4E, 0xE4, 28}, /* 01 (28.322MHz) */ {0x57, 0xE4, 31}, /* 02 (31.500MHz) */ -- cgit v0.10.2 From 6d12dae47e8c93da24d54a402a48dab0958083ca Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Thu, 14 Jun 2012 00:21:52 +0200 Subject: staging/xgifb: Cleanup vb_device_info struct This patch cleans up the vb_device_info struct and the related functions. The cleanup decreases the size of the compiled module by about 10kB. == Remove fields in vb_device_info that are never read: == pOutputSelect pRGBSenseData pRGBSenseData2 pVideoSenseData pVideoSenseData2 pYCSenseData pYCSenseData2 CR49 pXGINew_I2CDefinition pCR2E pCR2F pCR46 pCR47 pCRD0 pCRDE pSR40 pSR41 pCR47 === Remove the corresponding 'constants' === XGI330_RGBSenseData XGI330_RGBSenseData2 XGI330_VideoSenseData XGI330_VideoSenseData2 XGI330_YCSenseData XGI330_YCSenseData2 XGI330_CR49 XG40_I2CDefinition XG21_CR2E XG21_CR2F XG21_CR46 XG21_CR47 XG27_CRD0 XG27_CRDE XGI330_OutputSelect == Remove 'constant fields' and replace constant value with #define == pSR07 = XGI330_SR07 -> 0x18 pSR1F = XGI330_SR1F -> 0 pSR23 = XGI330_SR23 -> 0xf6 pSR24 = XGI330_SR24 -> 0x0d pSR33 = XGI330_SR33 ->0 pCRT2Data_1_2 = XGI330_CRT2Data_1_2 -> 0 pCRT2Data_4_D = XGI330_CRT2Data_4_D -> 0 pCRT2Data_4_E = XGI330_CRT2Data_4_E -> 0 pCRT2Data_4_10 = XGI330_CRT2Data_4_10 -> 0x80 pSR36 = XG27_SR36 -> 0x30 pCR8F = &XG27_CR8F -> 0x0C pSR40 = XG27_SR40 -> 0x04 pSR41 = XG27_SR41 ->0x00 pSR31 = XGI330_SR31 -> 0xc0 pSR32 = XGI330_SR32 -> 0xc0 SR25 = XGI330_sr25 -> 0 (we only use XGI330_sr25[0]) == Constant fields with 'dead' code: == pSoftSetting is set to XGI330_SoftSetting = 0x30 -> if (*pVBInfo->pSoftSetting & SoftDRAMType) is never true since SoftDRAMType = 0x80 -> if (*pVBInfo->pSoftSetting & ModeSoftSetting) is never true since ModeSoftSetting = 0x04 --> remove the code, remove pSoftSetting, remove XGI330_SoftSetting pDVOSetting is set to XG21_DVOSetting = 0 -> if (((*pVBInfo->pDVOSetting) & 0xC0) == 0xC0) is never true --> remove the code, remove pDVOSetting, remove XG21_DVOSetting pXGINew_DRAMTypeDefinition is set to &XG40_DRAMTypeDefinition 0xFF -> if (*pVBInfo->pXGINew_DRAMTypeDefinition != 0x0C) is always true --> remove the if and remove pXGINew_DRAMTypeDefinition remove XG40_DRAMTypeDefinition == Replace pointer to unsigned char with unsigned char variable and assign value of referenced pointer: == pSR21 -> SR21, remove XGI330_SR21 pSR22 -> SR22, remove XGI330_SR22 pXGINew_CR97 -> XGINew_CR97, remove XG20_CR97, XG27_CR97 and Z11m_CR97 Signed-off-by: Peter Huewe Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/vb_def.h b/drivers/staging/xgifb/vb_def.h index c731793..5b987a6 100644 --- a/drivers/staging/xgifb/vb_def.h +++ b/drivers/staging/xgifb/vb_def.h @@ -264,4 +264,23 @@ #define RES1280x960x85 0x46 #define RES1280x960x120 0x47 + +#define XG27_CR8F 0x0C +#define XG27_SR36 0x30 +#define XG27_SR40 0x04 +#define XG27_SR41 0x00 +#define XG40_CRCF 0x13 +#define XGI330_CRT2Data_1_2 0 +#define XGI330_CRT2Data_4_D 0 +#define XGI330_CRT2Data_4_E 0 +#define XGI330_CRT2Data_4_10 0x80 +#define XGI330_SR07 0x18 +#define XGI330_SR1F 0 +#define XGI330_SR23 0xf6 +#define XGI330_SR24 0x0d +#define XGI330_SR25 0 +#define XGI330_SR31 0xc0 +#define XGI330_SR32 0x11 +#define XGI330_SR33 0 + #endif diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c index 944653d..a3d54b7 100644 --- a/drivers/staging/xgifb/vb_init.c +++ b/drivers/staging/xgifb/vb_init.c @@ -5,7 +5,6 @@ #include "vb_def.h" #include "vb_util.h" #include "vb_setmode.h" - static const unsigned short XGINew_DDRDRAM_TYPE340[4][2] = { { 16, 0x45}, { 8, 0x35}, @@ -35,21 +34,12 @@ XGINew_GetXG20DRAMType(struct xgi_hw_device_info *HwDeviceExtension, unsigned char data, temp; if (HwDeviceExtension->jChipType < XG20) { - if (*pVBInfo->pSoftSetting & SoftDRAMType) { - data = *pVBInfo->pSoftSetting & 0x07; - return data; - } else { - data = xgifb_reg_get(pVBInfo->P3c4, 0x39) & 0x02; - if (data == 0) - data = (xgifb_reg_get(pVBInfo->P3c4, 0x3A) & - 0x02) >> 1; - return data; - } + data = xgifb_reg_get(pVBInfo->P3c4, 0x39) & 0x02; + if (data == 0) + data = (xgifb_reg_get(pVBInfo->P3c4, 0x3A) & + 0x02) >> 1; + return data; } else if (HwDeviceExtension->jChipType == XG27) { - if (*pVBInfo->pSoftSetting & SoftDRAMType) { - data = *pVBInfo->pSoftSetting & 0x07; - return data; - } temp = xgifb_reg_get(pVBInfo->P3c4, 0x3B); /* SR3B[7][3]MAA15 MAA11 (Power on Trapping) */ if (((temp & 0x88) == 0x80) || ((temp & 0x88) == 0x08)) @@ -92,13 +82,11 @@ static void XGINew_DDR1x_MRS_340(unsigned long P3c4, xgifb_reg_set(P3c4, 0x16, 0x00); xgifb_reg_set(P3c4, 0x16, 0x80); - if (*pVBInfo->pXGINew_DRAMTypeDefinition != 0x0C) { /* Samsung F Die */ - mdelay(3); - xgifb_reg_set(P3c4, 0x18, 0x00); - xgifb_reg_set(P3c4, 0x19, 0x20); - xgifb_reg_set(P3c4, 0x16, 0x00); - xgifb_reg_set(P3c4, 0x16, 0x80); - } + mdelay(3); + xgifb_reg_set(P3c4, 0x18, 0x00); + xgifb_reg_set(P3c4, 0x19, 0x20); + xgifb_reg_set(P3c4, 0x16, 0x00); + xgifb_reg_set(P3c4, 0x16, 0x80); udelay(60); xgifb_reg_set(P3c4, @@ -172,7 +160,7 @@ static void XGINew_DDRII_Bootup_XG27( /* Set Double Frequency */ /* xgifb_reg_set(P3d4, 0x97, 0x11); *//* CR97 */ - xgifb_reg_set(P3d4, 0x97, *pVBInfo->pXGINew_CR97); /* CR97 */ + xgifb_reg_set(P3d4, 0x97, pVBInfo->XGINew_CR97); /* CR97 */ udelay(200); @@ -532,7 +520,7 @@ static void XGINew_SetDRAMDefaultRegister340( pVBInfo->CR40[0][pVBInfo->ram_type]); /* CR41 */ if (HwDeviceExtension->jChipType == XG27) - xgifb_reg_set(P3d4, 0x8F, *pVBInfo->pCR8F); /* CR8F */ + xgifb_reg_set(P3d4, 0x8F, XG27_CR8F); /* CR8F */ for (j = 0; j <= 6; j++) /* CR90 - CR96 */ xgifb_reg_set(P3d4, (0x90 + j), @@ -555,7 +543,7 @@ static void XGINew_SetDRAMDefaultRegister340( xgifb_reg_set(P3d4, 0x83, 0x09); /* CR83 */ xgifb_reg_set(P3d4, 0x87, 0x00); /* CR87 */ - xgifb_reg_set(P3d4, 0xCF, *pVBInfo->pCRCF); /* CRCF */ + xgifb_reg_set(P3d4, 0xCF, XG40_CRCF); /* CRCF */ if (pVBInfo->ram_type) { /* xgifb_reg_set(P3c4, 0x17, 0xC0); */ /* SR17 DDRII */ xgifb_reg_set(P3c4, 0x17, 0x80); /* SR17 DDRII */ @@ -1075,13 +1063,9 @@ static void XGINew_ChkSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, CR3CData = xgifb_reg_get(pVBInfo->P3d4, 0x3c); if (!(CR3CData & DisplayDeviceFromCMOS)) { tempcx = 0x1FF0; - if (*pVBInfo->pSoftSetting & ModeSoftSetting) - tempbx = 0x1FF0; } } else { tempcx = 0x1FF0; - if (*pVBInfo->pSoftSetting & ModeSoftSetting) - tempbx = 0x1FF0; } tempbx &= tempcx; @@ -1425,7 +1409,7 @@ unsigned char XGIInitNew(struct pci_dev *pdev) printk("10"); if (HwDeviceExtension->jChipType >= XG20) - xgifb_reg_set(pVBInfo->P3d4, 0x97, *pVBInfo->pXGINew_CR97); + xgifb_reg_set(pVBInfo->P3d4, 0x97, pVBInfo->XGINew_CR97); /* 3.SetMemoryClock @@ -1435,20 +1419,20 @@ unsigned char XGIInitNew(struct pci_dev *pdev) printk("11"); /* 4.SetDefExt1Regs begin */ - xgifb_reg_set(pVBInfo->P3c4, 0x07, *pVBInfo->pSR07); + xgifb_reg_set(pVBInfo->P3c4, 0x07, XGI330_SR07); if (HwDeviceExtension->jChipType == XG27) { - xgifb_reg_set(pVBInfo->P3c4, 0x40, *pVBInfo->pSR40); - xgifb_reg_set(pVBInfo->P3c4, 0x41, *pVBInfo->pSR41); + xgifb_reg_set(pVBInfo->P3c4, 0x40, XG27_SR40); + xgifb_reg_set(pVBInfo->P3c4, 0x41, XG27_SR41); } xgifb_reg_set(pVBInfo->P3c4, 0x11, 0x0F); - xgifb_reg_set(pVBInfo->P3c4, 0x1F, *pVBInfo->pSR1F); + xgifb_reg_set(pVBInfo->P3c4, 0x1F, XGI330_SR1F); /* xgifb_reg_set(pVBInfo->P3c4, 0x20, 0x20); */ /* alan, 2001/6/26 Frame buffer can read/write SR20 */ xgifb_reg_set(pVBInfo->P3c4, 0x20, 0xA0); /* Hsuan, 2006/01/01 H/W request for slow corner chip */ xgifb_reg_set(pVBInfo->P3c4, 0x36, 0x70); if (HwDeviceExtension->jChipType == XG27) /* Alan 12/07/2006 */ - xgifb_reg_set(pVBInfo->P3c4, 0x36, *pVBInfo->pSR36); + xgifb_reg_set(pVBInfo->P3c4, 0x36, XG27_SR36); /* SR11 = 0x0F; */ /* xgifb_reg_set(pVBInfo->P3c4, 0x11, SR11); */ @@ -1534,9 +1518,9 @@ unsigned char XGIInitNew(struct pci_dev *pdev) } /* != XG20 */ /* Set PCI */ - xgifb_reg_set(pVBInfo->P3c4, 0x23, *pVBInfo->pSR23); - xgifb_reg_set(pVBInfo->P3c4, 0x24, *pVBInfo->pSR24); - xgifb_reg_set(pVBInfo->P3c4, 0x25, pVBInfo->SR25[0]); + xgifb_reg_set(pVBInfo->P3c4, 0x23, XGI330_SR23); + xgifb_reg_set(pVBInfo->P3c4, 0x24, XGI330_SR24); + xgifb_reg_set(pVBInfo->P3c4, 0x25, XGI330_SR25); printk("15"); if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */ @@ -1550,8 +1534,7 @@ unsigned char XGIInitNew(struct pci_dev *pdev) temp = (unsigned char) ((temp1 >> 4) & 0x0F); xgifb_reg_set(pVBInfo->Part1Port, - 0x02, - (*pVBInfo->pCRT2Data_1_2)); + 0x02, XGI330_CRT2Data_1_2); printk("16"); @@ -1565,15 +1548,15 @@ unsigned char XGIInitNew(struct pci_dev *pdev) /* Not DDR */ xgifb_reg_set(pVBInfo->P3c4, 0x31, - (*pVBInfo->pSR31 & 0x3F) | 0x40); + (XGI330_SR31 & 0x3F) | 0x40); xgifb_reg_set(pVBInfo->P3c4, 0x32, - (*pVBInfo->pSR32 & 0xFC) | 0x01); + (XGI330_SR32 & 0xFC) | 0x01); } else { - xgifb_reg_set(pVBInfo->P3c4, 0x31, *pVBInfo->pSR31); - xgifb_reg_set(pVBInfo->P3c4, 0x32, *pVBInfo->pSR32); + xgifb_reg_set(pVBInfo->P3c4, 0x31, XGI330_SR31); + xgifb_reg_set(pVBInfo->P3c4, 0x32, XGI330_SR32); } - xgifb_reg_set(pVBInfo->P3c4, 0x33, *pVBInfo->pSR33); + xgifb_reg_set(pVBInfo->P3c4, 0x33, XGI330_SR33); printk("17"); /* @@ -1584,14 +1567,11 @@ unsigned char XGIInitNew(struct pci_dev *pdev) if (pVBInfo->IF_DEF_LVDS == 0) { xgifb_reg_set(pVBInfo->Part2Port, 0x00, 0x1C); xgifb_reg_set(pVBInfo->Part4Port, - 0x0D, - *pVBInfo->pCRT2Data_4_D); + 0x0D, XGI330_CRT2Data_4_D); xgifb_reg_set(pVBInfo->Part4Port, - 0x0E, - *pVBInfo->pCRT2Data_4_E); + 0x0E, XGI330_CRT2Data_4_E); xgifb_reg_set(pVBInfo->Part4Port, - 0x10, - *pVBInfo->pCRT2Data_4_10); + 0x10, XGI330_CRT2Data_4_10); xgifb_reg_set(pVBInfo->Part4Port, 0x0F, 0x3F); } @@ -1651,12 +1631,12 @@ unsigned char XGIInitNew(struct pci_dev *pdev) AGP = 0; if (AGP == 0) - *pVBInfo->pSR21 &= 0xEF; + pVBInfo->SR21 &= 0xEF; - xgifb_reg_set(pVBInfo->P3c4, 0x21, *pVBInfo->pSR21); + xgifb_reg_set(pVBInfo->P3c4, 0x21, pVBInfo->SR21); if (AGP == 1) - *pVBInfo->pSR22 &= 0x20; - xgifb_reg_set(pVBInfo->P3c4, 0x22, *pVBInfo->pSR22); + pVBInfo->SR22 &= 0x20; + xgifb_reg_set(pVBInfo->P3c4, 0x22, pVBInfo->SR22); */ /* base = 0x80000000; */ /* OutPortLong(0xcf8, base); */ @@ -1664,12 +1644,12 @@ unsigned char XGIInitNew(struct pci_dev *pdev) /* if (Temp == 0x1039) { */ xgifb_reg_set(pVBInfo->P3c4, 0x22, - (unsigned char) ((*pVBInfo->pSR22) & 0xFE)); + (unsigned char) ((pVBInfo->SR22) & 0xFE)); /* } else { */ - /* xgifb_reg_set(pVBInfo->P3c4, 0x22, *pVBInfo->pSR22); */ + /* xgifb_reg_set(pVBInfo->P3c4, 0x22, pVBInfo->SR22); */ /* } */ - xgifb_reg_set(pVBInfo->P3c4, 0x21, *pVBInfo->pSR21); + xgifb_reg_set(pVBInfo->P3c4, 0x21, pVBInfo->SR21); printk("23"); diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index 183afe4..b1713d3 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -38,9 +38,6 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo) pVBInfo->ModeResInfo = (struct SiS_ModeResInfo_S *) XGI330_ModeResInfo; - pVBInfo->pOutputSelect = &XGI330_OutputSelect; - pVBInfo->pSoftSetting = &XGI330_SoftSetting; - pVBInfo->pSR07 = &XGI330_SR07; pVBInfo->LCDResInfo = 0; pVBInfo->LCDTypeInfo = 0; pVBInfo->LCDInfo = 0; @@ -49,36 +46,15 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo) pVBInfo->SR15 = XGI340_SR13; pVBInfo->CR40 = XGI340_cr41; - pVBInfo->SR25 = XGI330_sr25; - pVBInfo->pSR31 = &XGI330_sr31; - pVBInfo->pSR32 = &XGI330_sr32; pVBInfo->CR6B = XGI340_CR6B; pVBInfo->CR6E = XGI340_CR6E; pVBInfo->CR6F = XGI340_CR6F; pVBInfo->CR89 = XGI340_CR89; pVBInfo->AGPReg = XGI340_AGPReg; pVBInfo->SR16 = XGI340_SR16; - pVBInfo->pCRCF = &XG40_CRCF; - pVBInfo->pXGINew_DRAMTypeDefinition = &XG40_DRAMTypeDefinition; - - pVBInfo->CR49 = XGI330_CR49; - pVBInfo->pSR1F = &XGI330_SR1F; - pVBInfo->pSR21 = &XGI330_SR21; - pVBInfo->pSR22 = &XGI330_SR22; - pVBInfo->pSR23 = &XGI330_SR23; - pVBInfo->pSR24 = &XGI330_SR24; - pVBInfo->pSR33 = &XGI330_SR33; - - pVBInfo->pCRT2Data_1_2 = &XGI330_CRT2Data_1_2; - pVBInfo->pCRT2Data_4_D = &XGI330_CRT2Data_4_D; - pVBInfo->pCRT2Data_4_E = &XGI330_CRT2Data_4_E; - pVBInfo->pCRT2Data_4_10 = &XGI330_CRT2Data_4_10; - pVBInfo->pRGBSenseData = &XGI330_RGBSenseData; - pVBInfo->pVideoSenseData = &XGI330_VideoSenseData; - pVBInfo->pYCSenseData = &XGI330_YCSenseData; - pVBInfo->pRGBSenseData2 = &XGI330_RGBSenseData2; - pVBInfo->pVideoSenseData2 = &XGI330_VideoSenseData2; - pVBInfo->pYCSenseData2 = &XGI330_YCSenseData2; + + pVBInfo->SR21 = 0xa3; + pVBInfo->SR22 = 0xfb; pVBInfo->NTSCTiming = XGI330_NTSCTiming; pVBInfo->PALTiming = XGI330_PALTiming; @@ -105,38 +81,22 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo) else pVBInfo->LCDCapList = XGI_LCDCapList; - pVBInfo->pXGINew_I2CDefinition = &XG40_I2CDefinition; - if (ChipType >= XG20) - pVBInfo->pXGINew_CR97 = &XG20_CR97; + pVBInfo->XGINew_CR97 = 0x10; if (ChipType == XG27) { unsigned char temp; pVBInfo->MCLKData = (struct SiS_MCLKData *) XGI27New_MCLKData; pVBInfo->CR40 = XGI27_cr41; - pVBInfo->pXGINew_CR97 = &XG27_CR97; - pVBInfo->pSR36 = &XG27_SR36; - pVBInfo->pCR8F = &XG27_CR8F; - pVBInfo->pCRD0 = XG27_CRD0; - pVBInfo->pCRDE = XG27_CRDE; - pVBInfo->pSR40 = &XG27_SR40; - pVBInfo->pSR41 = &XG27_SR41; + pVBInfo->XGINew_CR97 = 0xc1; pVBInfo->SR15 = XG27_SR13; /*Z11m DDR*/ temp = xgifb_reg_get(pVBInfo->P3c4, 0x3B); /* SR3B[7][3]MAA15 MAA11 (Power on Trapping) */ if (((temp & 0x88) == 0x80) || ((temp & 0x88) == 0x08)) - pVBInfo->pXGINew_CR97 = &Z11m_CR97; - } - - if (ChipType >= XG20) { - pVBInfo->pDVOSetting = &XG21_DVOSetting; - pVBInfo->pCR2E = &XG21_CR2E; - pVBInfo->pCR2F = &XG21_CR2F; - pVBInfo->pCR46 = &XG21_CR46; - pVBInfo->pCR47 = &XG21_CR47; + pVBInfo->XGINew_CR97 = 0x80; } } @@ -783,13 +743,6 @@ static void xgifb_set_lcd(int chip_id, } } - if (((*pVBInfo->pDVOSetting) & 0xC0) == 0xC0) { - xgifb_reg_set(pVBInfo->P3d4, 0x2E, *pVBInfo->pCR2E); - xgifb_reg_set(pVBInfo->P3d4, 0x2F, *pVBInfo->pCR2F); - xgifb_reg_set(pVBInfo->P3d4, 0x46, *pVBInfo->pCR46); - xgifb_reg_set(pVBInfo->P3d4, 0x47, *pVBInfo->pCR47); - } - if (chip_id == XG27) { XGI_SetXG27FPBits(pVBInfo); } else { diff --git a/drivers/staging/xgifb/vb_struct.h b/drivers/staging/xgifb/vb_struct.h index b54488b..aea760a 100644 --- a/drivers/staging/xgifb/vb_struct.h +++ b/drivers/staging/xgifb/vb_struct.h @@ -191,45 +191,11 @@ struct vb_device_info { unsigned char (*SR15)[8]; unsigned char (*CR40)[8]; - unsigned char *pSoftSetting; - unsigned char *pOutputSelect; - - unsigned short *pRGBSenseData; - unsigned short *pRGBSenseData2; /*301b*/ - unsigned short *pVideoSenseData; - unsigned short *pVideoSenseData2; - unsigned short *pYCSenseData; - unsigned short *pYCSenseData2; - - unsigned char *pSR07; - unsigned char *CR49; - unsigned char *pSR1F; unsigned char *AGPReg; unsigned char *SR16; - unsigned char *pSR21; - unsigned char *pSR22; - unsigned char *pSR23; - unsigned char *pSR24; - unsigned char *SR25; - unsigned char *pSR31; - unsigned char *pSR32; - unsigned char *pSR33; - unsigned char *pSR36; /* alan 12/07/2006 */ - unsigned char *pCRCF; - unsigned char *pCRD0; /* alan 12/07/2006 */ - unsigned char *pCRDE; /* alan 12/07/2006 */ - unsigned char *pCR8F; /* alan 12/07/2006 */ - unsigned char *pSR40; /* alan 12/07/2006 */ - unsigned char *pSR41; /* alan 12/07/2006 */ - unsigned char *pDVOSetting; - unsigned char *pCR2E; - unsigned char *pCR2F; - unsigned char *pCR46; - unsigned char *pCR47; - unsigned char *pCRT2Data_1_2; - unsigned char *pCRT2Data_4_D; - unsigned char *pCRT2Data_4_E; - unsigned char *pCRT2Data_4_10; + unsigned char SR21; + unsigned char SR22; + unsigned char SR25; struct SiS_MCLKData *MCLKData; struct XGI_ECLKDataStruct *ECLKData; @@ -249,8 +215,7 @@ struct vb_device_info { unsigned char *Ren750pGroup3; unsigned char *ScreenOffset; unsigned char *pXGINew_DRAMTypeDefinition; - unsigned char *pXGINew_I2CDefinition ; - unsigned char *pXGINew_CR97 ; + unsigned char XGINew_CR97; struct XGI330_LCDCapStruct *LCDCapList; diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h index 16bb831..75da7c3 100644 --- a/drivers/staging/xgifb/vb_table.h +++ b/drivers/staging/xgifb/vb_table.h @@ -130,13 +130,6 @@ static unsigned char XGI340_AGPReg[12] = { static unsigned char XGI340_SR16[4] = {0x03, 0x83, 0x03, 0x83}; -static unsigned char XGI330_sr25[2]; -static unsigned char XGI330_sr31 = 0xc0; -static unsigned char XGI330_sr32 = 0x11; -static unsigned char XGI330_SR33; -static unsigned char XG40_CRCF = 0x13; -static unsigned char XG40_DRAMTypeDefinition = 0xFF ; - static struct XGI_ExtStruct XGI330_EModeIDTable[] = { {0x2e, 0x0a1b, 0x0306, 0x06, 0x05, 0x06}, {0x2f, 0x0a1b, 0x0305, 0x05, 0x05, 0x05}, @@ -2255,48 +2248,6 @@ static struct SiS_ModeResInfo_S XGI330_ModeResInfo[] = { {1152, 864, 8, 16} }; -static unsigned char XGI330_OutputSelect = 0x40; -static unsigned char XGI330_SoftSetting = 0x30; -static unsigned char XGI330_SR07 = 0x18; - -static unsigned char XGI330_CR49[] = {0xaa, 0x88}; -static unsigned char XGI330_SR1F; -static unsigned char XGI330_SR21 = 0xa3; -static unsigned char XGI330_SR22 = 0xfb; -static unsigned char XGI330_SR23 = 0xf6; -static unsigned char XGI330_SR24 = 0xd; - -static unsigned char XGI330_CRT2Data_1_2; -static unsigned char XGI330_CRT2Data_4_D; -static unsigned char XGI330_CRT2Data_4_E; -static unsigned char XGI330_CRT2Data_4_10 = 0x80; -static unsigned short XGI330_RGBSenseData = 0xd1; -static unsigned short XGI330_VideoSenseData = 0xb9; -static unsigned short XGI330_YCSenseData = 0xb3; -static unsigned short XGI330_RGBSenseData2 = 0x0190; /*301b*/ -static unsigned short XGI330_VideoSenseData2 = 0x0110; -static unsigned short XGI330_YCSenseData2 = 0x016B; -static unsigned char XG40_I2CDefinition; -static unsigned char XG20_CR97 = 0x10 ; - -static unsigned char XG21_DVOSetting; -static unsigned char XG21_CR2E; -static unsigned char XG21_CR2F; -static unsigned char XG21_CR46; -static unsigned char XG21_CR47; - -static unsigned char XG27_CR97 = 0xC1 ; -static unsigned char XG27_SR36 = 0x30 ; -static unsigned char XG27_CR8F = 0x0C ; -static unsigned char XG27_CRD0[] = { - 0, 0, 0, 0, 0, 0, 0, 0x82, 0x00, 0x66, 0x01, 0x00 -}; -static unsigned char XG27_CRDE[2]; -static unsigned char XG27_SR40 = 0x04 ; -static unsigned char XG27_SR41 = 0x00 ; - -static unsigned char Z11m_CR97 = 0x80 ; - static struct SiS_VCLKData XGI_VCLKData[] = { /* SR2B,SR2C,SR2D */ {0x1B, 0xE1, 25}, /* 00 (25.175MHz) */ -- cgit v0.10.2 From 01bd3e3fc9f9fa62c6c86a32c9f60b4501b96b3d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 15:41:15 -0700 Subject: staging: comedi: 8255: replace printk calls Replace the printk calls with dev_info, dev_warn, etc. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index 502bde8..b608a05 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -383,8 +383,7 @@ static int dev_8255_attach(struct comedi_device *dev, break; } if (i == 0) { - printk(KERN_WARNING - "comedi%d: 8255: no devices specified\n", dev->minor); + dev_warn(dev->class_dev, "no devices specified\n"); return -EINVAL; } @@ -392,24 +391,21 @@ static int dev_8255_attach(struct comedi_device *dev, if (ret) return ret; - printk(KERN_INFO "comedi%d: 8255:", dev->minor); - for (i = 0; i < dev->n_subdevices; i++) { iobase = it->options[i]; - printk(" 0x%04lx", iobase); if (!request_region(iobase, _8255_SIZE, "8255")) { - printk(" (I/O port conflict)"); + dev_warn(dev->class_dev, + "0x%04lx (I/O port conflict)\n", iobase); dev->subdevices[i].type = COMEDI_SUBD_UNUSED; } else { subdev_8255_init(dev, dev->subdevices + i, NULL, iobase); + dev_info(dev->class_dev, "0x%04lx\n", iobase); } } - printk("\n"); - return 0; } -- cgit v0.10.2 From e40e8375c0eb546b66c5e66f5e10b68ec46f7b95 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 15:41:27 -0700 Subject: staging: comedi: 8255: use pointer to dev->subdevices Instead of accessing the dev->subdevices directly as an array, use a pointer. This method is more common in the comedi subsystem. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index b608a05..23b9acc 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -371,6 +371,7 @@ EXPORT_SYMBOL(subdev_8255_cleanup); static int dev_8255_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + struct comedi_subdevice *s; int ret; unsigned long iobase; int i; @@ -392,16 +393,16 @@ static int dev_8255_attach(struct comedi_device *dev, return ret; for (i = 0; i < dev->n_subdevices; i++) { + s = dev->subdevices + i; iobase = it->options[i]; if (!request_region(iobase, _8255_SIZE, "8255")) { dev_warn(dev->class_dev, "0x%04lx (I/O port conflict)\n", iobase); - dev->subdevices[i].type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } else { - subdev_8255_init(dev, dev->subdevices + i, NULL, - iobase); + subdev_8255_init(dev, s, NULL, iobase); dev_info(dev->class_dev, "0x%04lx\n", iobase); } } -- cgit v0.10.2 From a9044d91990d4ba611f95fc5c84e2531fa54a5f9 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 15:41:36 -0700 Subject: staging: comedi: 8255: rename the private data structure Rename the 8255's private data structure from subdev_8255_struct to subdev_8255_private. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index 23b9acc..446dfc5 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -97,15 +97,15 @@ I/O port base address can be found in the output of 'lspci -v'. #define CR_A_MODE(a) ((a)<<5) #define CR_CW 0x80 -struct subdev_8255_struct { +struct subdev_8255_private { unsigned long cb_arg; int (*cb_func) (int, int, int, unsigned long); int have_irq; }; -#define CALLBACK_ARG (((struct subdev_8255_struct *)s->private)->cb_arg) -#define CALLBACK_FUNC (((struct subdev_8255_struct *)s->private)->cb_func) -#define subdevpriv ((struct subdev_8255_struct *)s->private) +#define CALLBACK_ARG (((struct subdev_8255_private *)s->private)->cb_arg) +#define CALLBACK_FUNC (((struct subdev_8255_private *)s->private)->cb_func) +#define subdevpriv ((struct subdev_8255_private *)s->private) void subdev_8255_interrupt(struct comedi_device *dev, struct comedi_subdevice *s) @@ -316,7 +316,7 @@ int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s, s->range_table = &range_digital; s->maxdata = 1; - s->private = kmalloc(sizeof(struct subdev_8255_struct), GFP_KERNEL); + s->private = kmalloc(sizeof(struct subdev_8255_private), GFP_KERNEL); if (!s->private) return -ENOMEM; -- cgit v0.10.2 From 7c61452afcf5cf2f781f8aabc42405af0edc4b06 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 15:41:45 -0700 Subject: staging: comedi: 8255: remove the s->private access macros The macros CALLBACK_ARG, CALLBACK_FUNC, and subdevpriv all rely on a a local variable having a specific name. Replace the macros with local variables wherever they occur. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index 446dfc5..5e0e8ff 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -103,17 +103,14 @@ struct subdev_8255_private { int have_irq; }; -#define CALLBACK_ARG (((struct subdev_8255_private *)s->private)->cb_arg) -#define CALLBACK_FUNC (((struct subdev_8255_private *)s->private)->cb_func) -#define subdevpriv ((struct subdev_8255_private *)s->private) - void subdev_8255_interrupt(struct comedi_device *dev, struct comedi_subdevice *s) { + struct subdev_8255_private *spriv = s->private; short d; - d = CALLBACK_FUNC(0, _8255_DATA, 0, CALLBACK_ARG); - d |= (CALLBACK_FUNC(0, _8255_DATA + 1, 0, CALLBACK_ARG) << 8); + d = spriv->cb_func(0, _8255_DATA, 0, spriv->cb_arg); + d |= (spriv->cb_func(0, _8255_DATA + 1, 0, spriv->cb_arg) << 8); comedi_buf_put(s->async, d); s->async->events |= COMEDI_CB_EOS; @@ -138,30 +135,33 @@ static int subdev_8255_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct subdev_8255_private *spriv = s->private; + if (data[0]) { s->state &= ~data[0]; s->state |= (data[0] & data[1]); if (data[0] & 0xff) - CALLBACK_FUNC(1, _8255_DATA, s->state & 0xff, - CALLBACK_ARG); + spriv->cb_func(1, _8255_DATA, s->state & 0xff, + spriv->cb_arg); if (data[0] & 0xff00) - CALLBACK_FUNC(1, _8255_DATA + 1, (s->state >> 8) & 0xff, - CALLBACK_ARG); + spriv->cb_func(1, _8255_DATA + 1, + (s->state >> 8) & 0xff, spriv->cb_arg); if (data[0] & 0xff0000) - CALLBACK_FUNC(1, _8255_DATA + 2, - (s->state >> 16) & 0xff, CALLBACK_ARG); + spriv->cb_func(1, _8255_DATA + 2, + (s->state >> 16) & 0xff, spriv->cb_arg); } - data[1] = CALLBACK_FUNC(0, _8255_DATA, 0, CALLBACK_ARG); - data[1] |= (CALLBACK_FUNC(0, _8255_DATA + 1, 0, CALLBACK_ARG) << 8); - data[1] |= (CALLBACK_FUNC(0, _8255_DATA + 2, 0, CALLBACK_ARG) << 16); + data[1] = spriv->cb_func(0, _8255_DATA, 0, spriv->cb_arg); + data[1] |= (spriv->cb_func(0, _8255_DATA + 1, 0, spriv->cb_arg) << 8); + data[1] |= (spriv->cb_func(0, _8255_DATA + 2, 0, spriv->cb_arg) << 16); return 2; } static void do_config(struct comedi_device *dev, struct comedi_subdevice *s) { + struct subdev_8255_private *spriv = s->private; int config; config = CR_CW; @@ -174,7 +174,7 @@ static void do_config(struct comedi_device *dev, struct comedi_subdevice *s) config |= CR_C_LO_IO; if (!(s->io_bits & 0xf00000)) config |= CR_C_HI_IO; - CALLBACK_FUNC(1, _8255_CR, config, CALLBACK_ARG); + spriv->cb_func(1, _8255_CR, config, spriv->cb_arg); } static int subdev_8255_insn_config(struct comedi_device *dev, @@ -310,21 +310,24 @@ int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s, int (*cb) (int, int, int, unsigned long), unsigned long arg) { + struct subdev_8255_private *spriv; + s->type = COMEDI_SUBD_DIO; s->subdev_flags = SDF_READABLE | SDF_WRITABLE; s->n_chan = 24; s->range_table = &range_digital; s->maxdata = 1; - s->private = kmalloc(sizeof(struct subdev_8255_private), GFP_KERNEL); - if (!s->private) + spriv = kmalloc(sizeof(*spriv), GFP_KERNEL); + if (!spriv) return -ENOMEM; + s->private = spriv; - CALLBACK_ARG = arg; + spriv->cb_arg = arg; if (cb == NULL) - CALLBACK_FUNC = subdev_8255_cb; + spriv->cb_func = subdev_8255_cb; else - CALLBACK_FUNC = cb; + spriv->cb_func = cb; s->insn_bits = subdev_8255_insn; s->insn_config = subdev_8255_insn_config; @@ -340,18 +343,20 @@ int subdev_8255_init_irq(struct comedi_device *dev, struct comedi_subdevice *s, int (*cb) (int, int, int, unsigned long), unsigned long arg) { + struct subdev_8255_private *spriv; int ret; ret = subdev_8255_init(dev, s, cb, arg); if (ret < 0) return ret; + spriv = s->private; + + spriv->have_irq = 1; s->do_cmdtest = subdev_8255_cmdtest; s->do_cmd = subdev_8255_cmd; s->cancel = subdev_8255_cancel; - subdevpriv->have_irq = 1; - return 0; } EXPORT_SYMBOL(subdev_8255_init_irq); @@ -412,15 +417,15 @@ static int dev_8255_attach(struct comedi_device *dev, static void dev_8255_detach(struct comedi_device *dev) { - int i; - unsigned long iobase; struct comedi_subdevice *s; + struct subdev_8255_private *spriv; + int i; for (i = 0; i < dev->n_subdevices; i++) { s = dev->subdevices + i; if (s->type != COMEDI_SUBD_UNUSED) { - iobase = CALLBACK_ARG; - release_region(iobase, _8255_SIZE); + spriv = s->private; + release_region(spriv->cb_arg, _8255_SIZE); } subdev_8255_cleanup(dev, s); } -- cgit v0.10.2 From 7a583163e87c8dd5b1826199d2a189f0daaf3247 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 15:41:54 -0700 Subject: staging: comedi: 8255: rename cb_arg and cb_func The 8255's private data variables cb_arg and cb_func are actually the iobase for the 8255 device and the pointer to the io function to access the device. Rename them as such to improve the readability of the driver. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index 5e0e8ff..7b7768b 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -98,8 +98,8 @@ I/O port base address can be found in the output of 'lspci -v'. #define CR_CW 0x80 struct subdev_8255_private { - unsigned long cb_arg; - int (*cb_func) (int, int, int, unsigned long); + unsigned long iobase; + int (*io) (int, int, int, unsigned long); int have_irq; }; @@ -109,8 +109,8 @@ void subdev_8255_interrupt(struct comedi_device *dev, struct subdev_8255_private *spriv = s->private; short d; - d = spriv->cb_func(0, _8255_DATA, 0, spriv->cb_arg); - d |= (spriv->cb_func(0, _8255_DATA + 1, 0, spriv->cb_arg) << 8); + d = spriv->io(0, _8255_DATA, 0, spriv->iobase); + d |= (spriv->io(0, _8255_DATA + 1, 0, spriv->iobase) << 8); comedi_buf_put(s->async, d); s->async->events |= COMEDI_CB_EOS; @@ -142,19 +142,19 @@ static int subdev_8255_insn(struct comedi_device *dev, s->state |= (data[0] & data[1]); if (data[0] & 0xff) - spriv->cb_func(1, _8255_DATA, s->state & 0xff, - spriv->cb_arg); + spriv->io(1, _8255_DATA, s->state & 0xff, + spriv->iobase); if (data[0] & 0xff00) - spriv->cb_func(1, _8255_DATA + 1, - (s->state >> 8) & 0xff, spriv->cb_arg); + spriv->io(1, _8255_DATA + 1, + (s->state >> 8) & 0xff, spriv->iobase); if (data[0] & 0xff0000) - spriv->cb_func(1, _8255_DATA + 2, - (s->state >> 16) & 0xff, spriv->cb_arg); + spriv->io(1, _8255_DATA + 2, + (s->state >> 16) & 0xff, spriv->iobase); } - data[1] = spriv->cb_func(0, _8255_DATA, 0, spriv->cb_arg); - data[1] |= (spriv->cb_func(0, _8255_DATA + 1, 0, spriv->cb_arg) << 8); - data[1] |= (spriv->cb_func(0, _8255_DATA + 2, 0, spriv->cb_arg) << 16); + data[1] = spriv->io(0, _8255_DATA, 0, spriv->iobase); + data[1] |= (spriv->io(0, _8255_DATA + 1, 0, spriv->iobase) << 8); + data[1] |= (spriv->io(0, _8255_DATA + 2, 0, spriv->iobase) << 16); return 2; } @@ -174,7 +174,7 @@ static void do_config(struct comedi_device *dev, struct comedi_subdevice *s) config |= CR_C_LO_IO; if (!(s->io_bits & 0xf00000)) config |= CR_C_HI_IO; - spriv->cb_func(1, _8255_CR, config, spriv->cb_arg); + spriv->io(1, _8255_CR, config, spriv->iobase); } static int subdev_8255_insn_config(struct comedi_device *dev, @@ -323,11 +323,11 @@ int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s, return -ENOMEM; s->private = spriv; - spriv->cb_arg = arg; + spriv->iobase = arg; if (cb == NULL) - spriv->cb_func = subdev_8255_cb; + spriv->io = subdev_8255_cb; else - spriv->cb_func = cb; + spriv->io = cb; s->insn_bits = subdev_8255_insn; s->insn_config = subdev_8255_insn_config; @@ -425,7 +425,7 @@ static void dev_8255_detach(struct comedi_device *dev) s = dev->subdevices + i; if (s->type != COMEDI_SUBD_UNUSED) { spriv = s->private; - release_region(spriv->cb_arg, _8255_SIZE); + release_region(spriv->iobase, _8255_SIZE); } subdev_8255_cleanup(dev, s); } -- cgit v0.10.2 From d29a18dcdbfbe250265abdf9c94d60df86f90316 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 15:42:02 -0700 Subject: staging: comedi: 8255: push out the 8255's private data variable rename Push out the rename of the private variables to improve the readability of the driver. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index 7b7768b..80ef031 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -60,15 +60,15 @@ I/O port base address can be found in the output of 'lspci -v'. set up the subdevice in the attach function of the driver by calling: - subdev_8255_init(device, subdevice, callback_function, arg) + subdev_8255_init(device, subdevice, io_function, iobase) device and subdevice are pointers to the device and subdevice - structures. callback_function will be called to provide the + structures. io_function will be called to provide the low-level input/output to the device, i.e., actual register - access. callback_function will be called with the value of arg + access. io_function will be called with the value of iobase as the last parameter. If the 8255 device is mapped as 4 - consecutive I/O ports, you can use NULL for callback_function - and the I/O port base for arg, and an internal function will + consecutive I/O ports, you can use NULL for io_function + and the I/O port base for iobase, and an internal function will handle the register access. In addition, if the main driver handles interrupts, you can @@ -119,10 +119,8 @@ void subdev_8255_interrupt(struct comedi_device *dev, } EXPORT_SYMBOL(subdev_8255_interrupt); -static int subdev_8255_cb(int dir, int port, int data, unsigned long arg) +static int subdev_8255_io(int dir, int port, int data, unsigned long iobase) { - unsigned long iobase = arg; - if (dir) { outb(data, iobase + port); return 0; @@ -307,8 +305,8 @@ static int subdev_8255_cancel(struct comedi_device *dev, } int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s, - int (*cb) (int, int, int, unsigned long), - unsigned long arg) + int (*io) (int, int, int, unsigned long), + unsigned long iobase) { struct subdev_8255_private *spriv; @@ -323,11 +321,11 @@ int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s, return -ENOMEM; s->private = spriv; - spriv->iobase = arg; - if (cb == NULL) - spriv->io = subdev_8255_cb; + spriv->iobase = iobase; + if (io == NULL) + spriv->io = subdev_8255_io; else - spriv->io = cb; + spriv->io = io; s->insn_bits = subdev_8255_insn; s->insn_config = subdev_8255_insn_config; @@ -340,13 +338,13 @@ int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s, EXPORT_SYMBOL(subdev_8255_init); int subdev_8255_init_irq(struct comedi_device *dev, struct comedi_subdevice *s, - int (*cb) (int, int, int, unsigned long), - unsigned long arg) + int (*io) (int, int, int, unsigned long), + unsigned long iobase) { struct subdev_8255_private *spriv; int ret; - ret = subdev_8255_init(dev, s, cb, arg); + ret = subdev_8255_init(dev, s, io, iobase); if (ret < 0) return ret; spriv = s->private; diff --git a/drivers/staging/comedi/drivers/8255.h b/drivers/staging/comedi/drivers/8255.h index b6314c9..1e589b4 100644 --- a/drivers/staging/comedi/drivers/8255.h +++ b/drivers/staging/comedi/drivers/8255.h @@ -27,11 +27,11 @@ #include "../comedidev.h" int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s, - int (*cb) (int, int, int, unsigned long), - unsigned long arg); + int (*io) (int, int, int, unsigned long), + unsigned long iobase); int subdev_8255_init_irq(struct comedi_device *dev, struct comedi_subdevice *s, - int (*cb) (int, int, int, unsigned long), - unsigned long arg); + int (*io) (int, int, int, unsigned long), + unsigned long iobase); void subdev_8255_cleanup(struct comedi_device *dev, struct comedi_subdevice *s); void subdev_8255_interrupt(struct comedi_device *dev, struct comedi_subdevice *s); -- cgit v0.10.2 From cc31b1be67bf4b878157e276056b6dbce76fdb45 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 15:42:12 -0700 Subject: staging: comedi: 8255: refactor subdev_8255_init Refactor the initialization of the 8255 so that the private data allocation is done before the subdevice is setup. This makes sure that the setup is complete. Also, add a bit of whitespace to improve the readability. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index 80ef031..52b9817 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -310,27 +310,26 @@ int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s, { struct subdev_8255_private *spriv; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 24; - s->range_table = &range_digital; - s->maxdata = 1; - spriv = kmalloc(sizeof(*spriv), GFP_KERNEL); if (!spriv) return -ENOMEM; - s->private = spriv; - spriv->iobase = iobase; - if (io == NULL) - spriv->io = subdev_8255_io; - else - spriv->io = io; - s->insn_bits = subdev_8255_insn; - s->insn_config = subdev_8255_insn_config; + spriv->iobase = iobase; + spriv->io = io ? io : subdev_8255_io; + + s->private = spriv; + + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 24; + s->range_table = &range_digital; + s->maxdata = 1; + s->insn_bits = subdev_8255_insn; + s->insn_config = subdev_8255_insn_config; + + s->state = 0; + s->io_bits = 0; - s->state = 0; - s->io_bits = 0; do_config(dev, s); return 0; -- cgit v0.10.2 From 34cfcf9acc6b0697e71294007c57eae91b80005c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 15:42:21 -0700 Subject: staging: comedi: 8255: remove have_irg and refactor subdev_8255_init_irq The have_irq variable in the 8255 private data is not used by the driver, remove it. This removes the need to access the private data in the subdev_8255_init_irq function. Also, add a bit of whitespace to improve the readability. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index 52b9817..da86a04 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -100,7 +100,6 @@ I/O port base address can be found in the output of 'lspci -v'. struct subdev_8255_private { unsigned long iobase; int (*io) (int, int, int, unsigned long); - int have_irq; }; void subdev_8255_interrupt(struct comedi_device *dev, @@ -340,19 +339,15 @@ int subdev_8255_init_irq(struct comedi_device *dev, struct comedi_subdevice *s, int (*io) (int, int, int, unsigned long), unsigned long iobase) { - struct subdev_8255_private *spriv; int ret; ret = subdev_8255_init(dev, s, io, iobase); if (ret < 0) return ret; - spriv = s->private; - - spriv->have_irq = 1; - s->do_cmdtest = subdev_8255_cmdtest; - s->do_cmd = subdev_8255_cmd; - s->cancel = subdev_8255_cancel; + s->do_cmdtest = subdev_8255_cmdtest; + s->do_cmd = subdev_8255_cmd; + s->cancel = subdev_8255_cancel; return 0; } -- cgit v0.10.2 From 3e189f08ef81e27aeccd2c2fb55175451f9faa71 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 15:42:28 -0700 Subject: staging: comedi: 8255: check for failure of subdev_8255_init The initialization of the 8255 subdevice can fail. Make sure to check for it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index da86a04..4cdd007 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -342,7 +342,7 @@ int subdev_8255_init_irq(struct comedi_device *dev, struct comedi_subdevice *s, int ret; ret = subdev_8255_init(dev, s, io, iobase); - if (ret < 0) + if (ret) return ret; s->do_cmdtest = subdev_8255_cmdtest; @@ -399,7 +399,9 @@ static int dev_8255_attach(struct comedi_device *dev, s->type = COMEDI_SUBD_UNUSED; } else { - subdev_8255_init(dev, s, NULL, iobase); + ret = subdev_8255_init(dev, s, NULL, iobase); + if (ret) + return ret; dev_info(dev->class_dev, "0x%04lx\n", iobase); } } -- cgit v0.10.2 From e64fb55b1a519a7d0fda51f40ab668830d6475ac Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 15:42:34 -0700 Subject: staging: comedi: 8255: use kzalloc to allocate the private data Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index 4cdd007..f6ea493 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -309,7 +309,7 @@ int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s, { struct subdev_8255_private *spriv; - spriv = kmalloc(sizeof(*spriv), GFP_KERNEL); + spriv = kzalloc(sizeof(*spriv), GFP_KERNEL); if (!spriv) return -ENOMEM; -- cgit v0.10.2 From f218d9f57b472848da34beac3e8097b054dcb2fe Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 15:42:39 -0700 Subject: staging: comedi: 8255: use a local variable for the iobase To improve readability, use a locale variable to hold the 8255's private iobase value. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index f6ea493..1f4b24c 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -106,10 +106,11 @@ void subdev_8255_interrupt(struct comedi_device *dev, struct comedi_subdevice *s) { struct subdev_8255_private *spriv = s->private; + unsigned long iobase = spriv->iobase; short d; - d = spriv->io(0, _8255_DATA, 0, spriv->iobase); - d |= (spriv->io(0, _8255_DATA + 1, 0, spriv->iobase) << 8); + d = spriv->io(0, _8255_DATA, 0, iobase); + d |= (spriv->io(0, _8255_DATA + 1, 0, iobase) << 8); comedi_buf_put(s->async, d); s->async->events |= COMEDI_CB_EOS; @@ -133,25 +134,25 @@ static int subdev_8255_insn(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { struct subdev_8255_private *spriv = s->private; + unsigned long iobase = spriv->iobase; if (data[0]) { s->state &= ~data[0]; s->state |= (data[0] & data[1]); if (data[0] & 0xff) - spriv->io(1, _8255_DATA, s->state & 0xff, - spriv->iobase); + spriv->io(1, _8255_DATA, s->state & 0xff, iobase); if (data[0] & 0xff00) spriv->io(1, _8255_DATA + 1, - (s->state >> 8) & 0xff, spriv->iobase); + (s->state >> 8) & 0xff, iobase); if (data[0] & 0xff0000) spriv->io(1, _8255_DATA + 2, - (s->state >> 16) & 0xff, spriv->iobase); + (s->state >> 16) & 0xff, iobase); } - data[1] = spriv->io(0, _8255_DATA, 0, spriv->iobase); - data[1] |= (spriv->io(0, _8255_DATA + 1, 0, spriv->iobase) << 8); - data[1] |= (spriv->io(0, _8255_DATA + 2, 0, spriv->iobase) << 16); + data[1] = spriv->io(0, _8255_DATA, 0, iobase); + data[1] |= (spriv->io(0, _8255_DATA + 1, 0, iobase) << 8); + data[1] |= (spriv->io(0, _8255_DATA + 2, 0, iobase) << 16); return 2; } @@ -159,6 +160,7 @@ static int subdev_8255_insn(struct comedi_device *dev, static void do_config(struct comedi_device *dev, struct comedi_subdevice *s) { struct subdev_8255_private *spriv = s->private; + unsigned long iobase = spriv->iobase; int config; config = CR_CW; @@ -171,7 +173,8 @@ static void do_config(struct comedi_device *dev, struct comedi_subdevice *s) config |= CR_C_LO_IO; if (!(s->io_bits & 0xf00000)) config |= CR_C_HI_IO; - spriv->io(1, _8255_CR, config, spriv->iobase); + + spriv->io(1, _8255_CR, config, iobase); } static int subdev_8255_insn_config(struct comedi_device *dev, -- cgit v0.10.2 From 459f299e5b1759644a6cde8328919b6e542fb9eb Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 15:42:45 -0700 Subject: staging: comedi: 8255: refactor subdev_8255_insn function Refactor the subdev_8255_insn function to follow what the user space library is doing. 1) This function requires 'data' to contain 2 parameters. Add a sanity check for this (insn->n != 2). 2) The 'data' parameters are actually a 'mask' of the valid bits and the actual 'bits' to modify. Create local variables of these names to help with maintainability. 3) The value returned in data[1] reflects the actual state of the 8255 io pins after the update of the masked bits. Fetch this data in a local variable and then set data[1]. 4) The user space library only checks for a < 0 return to indicate an error. It appears that the 'return 2' in this function is supposed to indicate the number of data parameters used to perform the command. Return the insn->n value for this, the open coded '2' looks wrong. Signed-off-by: H Hartley Sweeten Cc: Iam Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index 1f4b24c..da374de 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -135,26 +135,38 @@ static int subdev_8255_insn(struct comedi_device *dev, { struct subdev_8255_private *spriv = s->private; unsigned long iobase = spriv->iobase; + unsigned int mask; + unsigned int bits; + unsigned int v; + + if (insn->n != 2) + return -EINVAL; - if (data[0]) { - s->state &= ~data[0]; - s->state |= (data[0] & data[1]); - - if (data[0] & 0xff) - spriv->io(1, _8255_DATA, s->state & 0xff, iobase); - if (data[0] & 0xff00) - spriv->io(1, _8255_DATA + 1, - (s->state >> 8) & 0xff, iobase); - if (data[0] & 0xff0000) - spriv->io(1, _8255_DATA + 2, - (s->state >> 16) & 0xff, iobase); + mask = data[0]; + bits = data[1]; + + if (mask) { + v = s->state; + v &= ~mask; + v |= (bits & mask); + + if (mask & 0xff) + spriv->io(1, _8255_DATA, v & 0xff, iobase); + if (mask & 0xff00) + spriv->io(1, _8255_DATA + 1, (v >> 8) & 0xff, iobase); + if (mask & 0xff0000) + spriv->io(1, _8255_DATA + 2, (v >> 16) & 0xff, iobase); + + s->state = v; } - data[1] = spriv->io(0, _8255_DATA, 0, iobase); - data[1] |= (spriv->io(0, _8255_DATA + 1, 0, iobase) << 8); - data[1] |= (spriv->io(0, _8255_DATA + 2, 0, iobase) << 16); + v = spriv->io(0, _8255_DATA, 0, iobase); + v |= (spriv->io(0, _8255_DATA + 1, 0, iobase) << 8); + v |= (spriv->io(0, _8255_DATA + 2, 0, iobase) << 16); + + data[1] = v; - return 2; + return insn->n; } static void do_config(struct comedi_device *dev, struct comedi_subdevice *s) -- cgit v0.10.2 From f9af899b0c6c778083d1040349930a0f9fffb525 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 15:42:51 -0700 Subject: staging: comedi: 8255: move the subdev_8255_io function The subdev_8255_interrupt function indirectly calls subdev_8255_io. For aesthetic reasons, move the subdev_8255_io function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index da374de..abbb6d4 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -102,6 +102,16 @@ struct subdev_8255_private { int (*io) (int, int, int, unsigned long); }; +static int subdev_8255_io(int dir, int port, int data, unsigned long iobase) +{ + if (dir) { + outb(data, iobase + port); + return 0; + } else { + return inb(iobase + port); + } +} + void subdev_8255_interrupt(struct comedi_device *dev, struct comedi_subdevice *s) { @@ -119,16 +129,6 @@ void subdev_8255_interrupt(struct comedi_device *dev, } EXPORT_SYMBOL(subdev_8255_interrupt); -static int subdev_8255_io(int dir, int port, int data, unsigned long iobase) -{ - if (dir) { - outb(data, iobase + port); - return 0; - } else { - return inb(iobase + port); - } -} - static int subdev_8255_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) -- cgit v0.10.2 From cf8a6b3d86ec4d6ac8e2925a65335bd0d155c480 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 15:43:04 -0700 Subject: staging: comedi: 8255: add namespace to 'do_config' function The name 'do_config' is pretty generic, and this function is the only one in this driver without namespace. Add namespace to it just to avoid any issues. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index abbb6d4..8c97ac1 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -169,7 +169,8 @@ static int subdev_8255_insn(struct comedi_device *dev, return insn->n; } -static void do_config(struct comedi_device *dev, struct comedi_subdevice *s) +static void subdev_8255_do_config(struct comedi_device *dev, + struct comedi_subdevice *s) { struct subdev_8255_private *spriv = s->private; unsigned long iobase = spriv->iobase; @@ -221,7 +222,7 @@ static int subdev_8255_insn_config(struct comedi_device *dev, return -EINVAL; } - do_config(dev, s); + subdev_8255_do_config(dev, s); return 1; } @@ -344,7 +345,7 @@ int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s, s->state = 0; s->io_bits = 0; - do_config(dev, s); + subdev_8255_do_config(dev, s); return 0; } -- cgit v0.10.2 From 03ae8189ee6cab3d4af3e39136105f02d7c35883 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 15:43:11 -0700 Subject: staging: comedi: 8255: add some whitespace to the #define's Add whitespace to the _8255_* defines to improve readability. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index 8c97ac1..e0de149 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -84,10 +84,10 @@ I/O port base address can be found in the output of 'lspci -v'. #include #include "8255.h" -#define _8255_SIZE 4 +#define _8255_SIZE 4 -#define _8255_DATA 0 -#define _8255_CR 3 +#define _8255_DATA 0 +#define _8255_CR 3 #define CR_C_LO_IO 0x01 #define CR_B_IO 0x02 -- cgit v0.10.2 From b4b700c5a61c6e6db976f60d4eb6ad369e838aa9 Mon Sep 17 00:00:00 2001 From: Seth Jennings Date: Wed, 13 Jun 2012 16:03:42 -0500 Subject: staging: zsmalloc: fix uninit'ed variable warning This patch fixes an uninitialized variable warning in alloc_zspage(). It also fixes the secondary issue of prev_page leaving scope on each loop iteration. The only reason this ever worked was because prev_page was occupying the same space on the stack on each iteration. Signed-off-by: Seth Jennings Reported-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c index fb54a9b..4af3dd6 100644 --- a/drivers/staging/zsmalloc/zsmalloc-main.c +++ b/drivers/staging/zsmalloc/zsmalloc-main.c @@ -400,7 +400,7 @@ static void init_zspage(struct page *first_page, struct size_class *class) static struct page *alloc_zspage(struct size_class *class, gfp_t flags) { int i, error; - struct page *first_page = NULL; + struct page *first_page = NULL, *uninitialized_var(prev_page); /* * Allocate individual pages and link them together as: @@ -415,7 +415,7 @@ static struct page *alloc_zspage(struct size_class *class, gfp_t flags) */ error = -ENOMEM; for (i = 0; i < class->pages_per_zspage; i++) { - struct page *page, *prev_page; + struct page *page; page = alloc_page(flags); if (!page) -- cgit v0.10.2 From 7489301a1590c2771d27a08d41fa2778791cdf9d Mon Sep 17 00:00:00 2001 From: Bart Westgeest Date: Wed, 13 Jun 2012 15:37:18 -0400 Subject: staging: usbip: cleanup and fix of vhci_hub_status Changed setting the status bits to a byte-oriented approach. Number of written status bits is now based on VHCI_NPORT, instead of casting status buffer to a long. This fixes a stack corruption bug on 64-bit based architectures, and potential byte order / endianness related issues. In addition updated function comments, and log statements. Signed-off-by: Bart Westgeest Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c index f708cba..12a9a5f 100644 --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c @@ -178,44 +178,32 @@ void rh_port_disconnect(int rhport) | USB_PORT_STAT_C_RESET) << 16) /* - * This function is almostly the same as dummy_hcd.c:dummy_hub_status() without - * suspend/resume support. But, it is modified to provide multiple ports. + * Returns 0 if the status hasn't changed, or the number of bytes in buf. + * Ports are 0-indexed from the HCD point of view, + * and 1-indexed from the USB core pointer of view. * * @buf: a bitmap to show which port status has been changed. - * bit 0: reserved or used for another purpose? + * bit 0: reserved * bit 1: the status of port 0 has been changed. * bit 2: the status of port 1 has been changed. * ... - * bit 7: the status of port 6 has been changed. - * bit 8: the status of port 7 has been changed. - * ... - * bit 15: the status of port 14 has been changed. - * - * So, the maximum number of ports is 31 ( port 0 to port 30) ? - * - * The return value is the actual transferred length in byte. If nothing has - * been changed, return 0. In the case that the number of ports is less than or - * equal to 6 (VHCI_NPORTS==7), return 1. - * */ static int vhci_hub_status(struct usb_hcd *hcd, char *buf) { struct vhci_hcd *vhci; unsigned long flags; - int retval = 0; - - /* the enough buffer is allocated according to USB_MAXCHILDREN */ - unsigned long *event_bits = (unsigned long *) buf; + int retval; int rhport; int changed = 0; - *event_bits = 0; + retval = DIV_ROUND_UP(VHCI_NPORTS + 1, 8); + memset(buf, 0, retval); vhci = hcd_to_vhci(hcd); spin_lock_irqsave(&vhci->lock, flags); if (!HCD_HW_ACCESSIBLE(hcd)) { - usbip_dbg_vhci_rh("hw accessible flag in on?\n"); + usbip_dbg_vhci_rh("hw accessible flag not on?\n"); goto done; } @@ -223,9 +211,9 @@ static int vhci_hub_status(struct usb_hcd *hcd, char *buf) for (rhport = 0; rhport < VHCI_NPORTS; rhport++) { if ((vhci->port_status[rhport] & PORT_C_MASK)) { /* The status of a port has been changed, */ - usbip_dbg_vhci_rh("port %d is changed\n", rhport); + usbip_dbg_vhci_rh("port %d status changed\n", rhport); - *event_bits |= 1 << (rhport + 1); + buf[(rhport + 1) / 8] |= 1 << (rhport + 1) % 8; changed = 1; } } @@ -235,14 +223,9 @@ static int vhci_hub_status(struct usb_hcd *hcd, char *buf) if (hcd->state == HC_STATE_SUSPENDED) usb_hcd_resume_root_hub(hcd); - if (changed) - retval = 1 + (VHCI_NPORTS / 8); - else - retval = 0; - done: spin_unlock_irqrestore(&vhci->lock, flags); - return retval; + return changed ? retval : 0; } /* See hub_configure in hub.c */ -- cgit v0.10.2 From d7be394f7c2869e22d2258a1bba257661ca3fc52 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Wed, 6 Jun 2012 21:05:48 +0200 Subject: staging: zcache: don't limit number of pools per client Currently the amount of pools each client can use is limited to 16, this is and arbitrary limit which isn't really required by current implementation. This places and arbitrary limit on the number of mounted filesystems that can use cleancache. This patch removes that limit and uses IDR to do sparse mapping of pools in each client. Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index d0141fbc..174861f 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c @@ -31,6 +31,7 @@ #include #include #include +#include #include "tmem.h" #include "../zsmalloc/zsmalloc.h" @@ -53,15 +54,13 @@ (__GFP_FS | __GFP_NORETRY | __GFP_NOWARN | __GFP_NOMEMALLOC) #endif -#define MAX_POOLS_PER_CLIENT 16 - #define MAX_CLIENTS 16 #define LOCAL_CLIENT ((uint16_t)-1) MODULE_LICENSE("GPL"); struct zcache_client { - struct tmem_pool *tmem_pools[MAX_POOLS_PER_CLIENT]; + struct idr tmem_pools; struct zs_pool *zspool; bool allocated; atomic_t refcount; @@ -949,11 +948,9 @@ static struct tmem_pool *zcache_get_pool_by_id(uint16_t cli_id, uint16_t poolid) goto out; atomic_inc(&cli->refcount); } - if (poolid < MAX_POOLS_PER_CLIENT) { - pool = cli->tmem_pools[poolid]; - if (pool != NULL) - atomic_inc(&pool->refcount); - } + pool = idr_find(&cli->tmem_pools, poolid); + if (pool != NULL) + atomic_inc(&pool->refcount); out: return pool; } @@ -987,6 +984,7 @@ int zcache_new_client(uint16_t cli_id) cli->zspool = zs_create_pool("zcache", ZCACHE_GFP_MASK); if (cli->zspool == NULL) goto out; + idr_init(&cli->tmem_pools); #endif ret = 0; out: @@ -1673,10 +1671,10 @@ static int zcache_destroy_pool(int cli_id, int pool_id) if (cli == NULL) goto out; atomic_inc(&cli->refcount); - pool = cli->tmem_pools[pool_id]; + pool = idr_find(&cli->tmem_pools, pool_id); if (pool == NULL) goto out; - cli->tmem_pools[pool_id] = NULL; + idr_remove(&cli->tmem_pools, pool_id); /* wait for pool activity on other cpus to quiesce */ while (atomic_read(&pool->refcount) != 0) ; @@ -1696,6 +1694,7 @@ static int zcache_new_pool(uint16_t cli_id, uint32_t flags) int poolid = -1; struct tmem_pool *pool; struct zcache_client *cli = NULL; + int r; if (cli_id == LOCAL_CLIENT) cli = &zcache_host; @@ -1710,20 +1709,25 @@ static int zcache_new_pool(uint16_t cli_id, uint32_t flags) goto out; } - for (poolid = 0; poolid < MAX_POOLS_PER_CLIENT; poolid++) - if (cli->tmem_pools[poolid] == NULL) - break; - if (poolid >= MAX_POOLS_PER_CLIENT) { - pr_info("zcache: pool creation failed: max exceeded\n"); + do { + r = idr_pre_get(&cli->tmem_pools, GFP_ATOMIC); + if (r != 1) { + kfree(pool); + pr_info("zcache: pool creation failed: out of memory\n"); + goto out; + } + r = idr_get_new(&cli->tmem_pools, pool, &poolid); + } while (r == -EAGAIN); + if (r) { + pr_info("zcache: pool creation failed: error %d\n", r); kfree(pool); - poolid = -1; goto out; } + atomic_set(&pool->refcount, 0); pool->client = cli; pool->pool_id = poolid; tmem_new_pool(pool, flags); - cli->tmem_pools[poolid] = pool; pr_info("zcache: created %s tmem pool, id=%d, client=%d\n", flags & TMEM_POOL_PERSIST ? "persistent" : "ephemeral", poolid, cli_id); -- cgit v0.10.2 From 985eb50d553f4e2609778f999ecc5ec9837152f0 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 18:09:51 -0700 Subject: staging: comedi: ni_atmio16d: remove the function tracing debug These printk's are #ifdef'ed out with an undefined symbol anyway. Just remove them. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_atmio16d.c b/drivers/staging/comedi/drivers/ni_atmio16d.c index 95bee84..87992c9 100644 --- a/drivers/staging/comedi/drivers/ni_atmio16d.c +++ b/drivers/staging/comedi/drivers/ni_atmio16d.c @@ -236,10 +236,6 @@ static irqreturn_t atmio16d_interrupt(int irq, void *d) struct comedi_device *dev = d; struct comedi_subdevice *s = dev->subdevices + 0; -#ifdef DEBUG1 - printk(KERN_DEBUG "atmio16d_interrupt!\n"); -#endif - comedi_buf_put(s->async, inw(dev->iobase + AD_FIFO_REG)); comedi_event(dev, s); @@ -251,9 +247,7 @@ static int atmio16d_ai_cmdtest(struct comedi_device *dev, struct comedi_cmd *cmd) { int err = 0, tmp; -#ifdef DEBUG1 - printk(KERN_DEBUG "atmio16d_ai_cmdtest\n"); -#endif + /* make sure triggers are valid */ tmp = cmd->start_src; cmd->start_src &= TRIG_NOW; @@ -355,9 +349,7 @@ static int atmio16d_ai_cmd(struct comedi_device *dev, unsigned int timer, base_clock; unsigned int sample_count, tmp, chan, gain; int i; -#ifdef DEBUG1 - printk(KERN_DEBUG "atmio16d_ai_cmd\n"); -#endif + /* This is slowly becoming a working command interface. * * It is still uber-experimental */ @@ -517,9 +509,6 @@ static int atmio16d_ai_insn_read(struct comedi_device *dev, int gain; int status; -#ifdef DEBUG1 - printk(KERN_DEBUG "atmio16d_ai_insn_read\n"); -#endif chan = CR_CHAN(insn->chanspec); gain = CR_RANGE(insn->chanspec); @@ -538,9 +527,6 @@ static int atmio16d_ai_insn_read(struct comedi_device *dev, for (t = 0; t < ATMIO16D_TIMEOUT; t++) { /* check conversion status */ status = inw(dev->iobase + STAT_REG); -#ifdef DEBUG1 - printk(KERN_DEBUG "status=%x\n", status); -#endif if (status & STAT_AD_CONVAVAIL) { /* read the data now */ data[i] = inw(dev->iobase + AD_FIFO_REG); @@ -572,9 +558,6 @@ static int atmio16d_ao_insn_read(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { int i; -#ifdef DEBUG1 - printk(KERN_DEBUG "atmio16d_ao_insn_read\n"); -#endif for (i = 0; i < insn->n; i++) data[i] = devpriv->ao_readback[CR_CHAN(insn->chanspec)]; @@ -588,9 +571,6 @@ static int atmio16d_ao_insn_write(struct comedi_device *dev, int i; int chan; int d; -#ifdef DEBUG1 - printk(KERN_DEBUG "atmio16d_ao_insn_write\n"); -#endif chan = CR_CHAN(insn->chanspec); -- cgit v0.10.2 From 2b8557a734ab17d2cbb96a79bc267b30055e0ef3 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 17:50:53 -0700 Subject: staging: comedi: pcl816: remove unneeded tests in pcl816_ai_cmdtest The step 2 tests of the start_src, scan_begin_src, and scan_end_src triggers to make sure they are unique are not needed. These triggers all only have one source and it was trivially validated in step 1. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c index c3ee6d6..ba6911f 100644 --- a/drivers/staging/comedi/drivers/pcl816.c +++ b/drivers/staging/comedi/drivers/pcl816.c @@ -493,26 +493,11 @@ static int pcl816_ai_cmdtest(struct comedi_device *dev, * are unique and mutually compatible */ - if (cmd->start_src != TRIG_NOW) { - cmd->start_src = TRIG_NOW; - err++; - } - - if (cmd->scan_begin_src != TRIG_FOLLOW) { - cmd->scan_begin_src = TRIG_FOLLOW; - err++; - } - if (cmd->convert_src != TRIG_EXT && cmd->convert_src != TRIG_TIMER) { cmd->convert_src = TRIG_TIMER; err++; } - if (cmd->scan_end_src != TRIG_COUNT) { - cmd->scan_end_src = TRIG_COUNT; - err++; - } - if (cmd->stop_src != TRIG_NONE && cmd->stop_src != TRIG_COUNT) err++; -- cgit v0.10.2 From f7f111c214f218483a23d40a1f8e2d798b6e130a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 17:41:35 -0700 Subject: staging: comedi: pcl818: remove unneeded tests in ai_cmdtest The step 2 tests of the start_src, scan_begin_src, and scan_end_src triggers to make sure they are unique are not needed. These triggers all only have one source and it was trivially validated in step 1. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c index 66b2570..786c3b6 100644 --- a/drivers/staging/comedi/drivers/pcl818.c +++ b/drivers/staging/comedi/drivers/pcl818.c @@ -1299,22 +1299,9 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, /* step 2: make sure trigger sources are unique and mutually compatible */ - if (cmd->start_src != TRIG_NOW) { - cmd->start_src = TRIG_NOW; - err++; - } - if (cmd->scan_begin_src != TRIG_FOLLOW) { - cmd->scan_begin_src = TRIG_FOLLOW; - err++; - } if (cmd->convert_src != TRIG_TIMER && cmd->convert_src != TRIG_EXT) err++; - if (cmd->scan_end_src != TRIG_COUNT) { - cmd->scan_end_src = TRIG_COUNT; - err++; - } - if (cmd->stop_src != TRIG_NONE && cmd->stop_src != TRIG_COUNT) err++; -- cgit v0.10.2 From 31a4590ee31f2b46d28a4b85f84b04e90fa7ae00 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 17:58:07 -0700 Subject: staging: comedi: pcl812: remove unneeded tests in pcl812_ai_cmdtest The step 2 tests to make sure that the triggers are unique is not needed for single source triggers. These were already trivially validated in step 1. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/pcl812.c b/drivers/staging/comedi/drivers/pcl812.c index 0a4074a..511c901 100644 --- a/drivers/staging/comedi/drivers/pcl812.c +++ b/drivers/staging/comedi/drivers/pcl812.c @@ -612,33 +612,6 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev, * unique and mutually compatible */ - if (cmd->start_src != TRIG_NOW) { - cmd->start_src = TRIG_NOW; - err++; - } - - if (cmd->scan_begin_src != TRIG_FOLLOW) { - cmd->scan_begin_src = TRIG_FOLLOW; - err++; - } - - if (devpriv->use_ext_trg) { - if (cmd->convert_src != TRIG_EXT) { - cmd->convert_src = TRIG_EXT; - err++; - } - } else { - if (cmd->convert_src != TRIG_TIMER) { - cmd->convert_src = TRIG_TIMER; - err++; - } - } - - if (cmd->scan_end_src != TRIG_COUNT) { - cmd->scan_end_src = TRIG_COUNT; - err++; - } - if (cmd->stop_src != TRIG_NONE && cmd->stop_src != TRIG_COUNT) err++; -- cgit v0.10.2 From 23bcbb6495d04df086450e0751fc9b9fd5e98936 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 18:22:07 -0700 Subject: staging: comedi: pcl812: remove PCL812_EXTDEBUG define and related code The PCL812_EXTDEBUG define enables a bunch of function tracing debug messages as well as a dump of the comedi_cmd info during the cmdtest. There are better ways to do the function tracing and the cmdtest dump shouldn't be in the driver. Just remove all of it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/pcl812.c b/drivers/staging/comedi/drivers/pcl812.c index 511c901..b0eb2ab 100644 --- a/drivers/staging/comedi/drivers/pcl812.c +++ b/drivers/staging/comedi/drivers/pcl812.c @@ -119,9 +119,6 @@ #include "8253.h" -/* if this is defined then a lot of messages is printed */ -#undef PCL812_EXTDEBUG - /* hardware types of the cards */ #define boardPCL812PG 0 /* and ACL-8112PG */ #define boardPCL813B 1 @@ -534,24 +531,6 @@ static int pcl812_do_insn_bits(struct comedi_device *dev, return 2; } -#ifdef PCL812_EXTDEBUG -/* -============================================================================== -*/ -static void pcl812_cmdtest_out(int e, struct comedi_cmd *cmd) -{ - printk(KERN_INFO "pcl812 e=%d startsrc=%x scansrc=%x convsrc=%x\n", e, - cmd->start_src, cmd->scan_begin_src, cmd->convert_src); - printk(KERN_INFO "pcl812 e=%d startarg=%d scanarg=%d convarg=%d\n", e, - cmd->start_arg, cmd->scan_begin_arg, cmd->convert_arg); - printk(KERN_INFO "pcl812 e=%d stopsrc=%x scanend=%x\n", e, - cmd->stop_src, cmd->scan_end_src); - printk(KERN_INFO "pcl812 e=%d stoparg=%d scanendarg=%d " - "chanlistlen=%d\n", e, cmd->stop_arg, cmd->scan_end_arg, - cmd->chanlist_len); -} -#endif - /* ============================================================================== */ @@ -562,10 +541,6 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev, int err = 0; int tmp, divisor1, divisor2; -#ifdef PCL812_EXTDEBUG - printk("pcl812 EDBG: BGN: pcl812_ai_cmdtest(...)\n"); - pcl812_cmdtest_out(-1, cmd); -#endif /* step 1: make sure trigger sources are trivially valid */ tmp = cmd->start_src; @@ -597,15 +572,8 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev, if (!cmd->stop_src || tmp != cmd->stop_src) err++; - if (err) { -#ifdef PCL812_EXTDEBUG - pcl812_cmdtest_out(1, cmd); - printk - ("pcl812 EDBG: BGN: pcl812_ai_cmdtest(...) err=%d ret=1\n", - err); -#endif + if (err) return 1; - } /* * step 2: make sure trigger sources are @@ -615,15 +583,8 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src != TRIG_NONE && cmd->stop_src != TRIG_COUNT) err++; - if (err) { -#ifdef PCL812_EXTDEBUG - pcl812_cmdtest_out(2, cmd); - printk - ("pcl812 EDBG: BGN: pcl812_ai_cmdtest(...) err=%d ret=2\n", - err); -#endif + if (err) return 2; - } /* step 3: make sure arguments are trivially compatible */ @@ -673,15 +634,8 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev, } } - if (err) { -#ifdef PCL812_EXTDEBUG - pcl812_cmdtest_out(3, cmd); - printk - ("pcl812 EDBG: BGN: pcl812_ai_cmdtest(...) err=%d ret=3\n", - err); -#endif + if (err) return 3; - } /* step 4: fix up any arguments */ @@ -696,14 +650,8 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev, err++; } - if (err) { -#ifdef PCL812_EXTDEBUG - printk - ("pcl812 EDBG: BGN: pcl812_ai_cmdtest(...) err=%d ret=4\n", - err); -#endif + if (err) return 4; - } return 0; } @@ -717,10 +665,6 @@ static int pcl812_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) unsigned int divisor1 = 0, divisor2 = 0, i, dma_flags, bytes; struct comedi_cmd *cmd = &s->async->cmd; -#ifdef PCL812_EXTDEBUG - printk(KERN_DEBUG "pcl812 EDBG: BGN: pcl812_ai_cmd(...)\n"); -#endif - if (cmd->start_src != TRIG_NOW) return -EINVAL; if (cmd->scan_begin_src != TRIG_FOLLOW) @@ -844,13 +788,6 @@ static int pcl812_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) set_dma_count(devpriv->dma, devpriv->dmabytestomove[0]); release_dma_lock(dma_flags); enable_dma(devpriv->dma); -#ifdef PCL812_EXTDEBUG - printk - ("pcl812 EDBG: DMA %d PTR 0x%0x/0x%0x LEN %u/%u EOS %d\n", - devpriv->dma, devpriv->hwdmaptr[0], - devpriv->hwdmaptr[1], devpriv->dmabytestomove[0], - devpriv->dmabytestomove[1], devpriv->ai_eos); -#endif } switch (cmd->convert_src) { @@ -864,10 +801,6 @@ static int pcl812_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) else /* let's go! */ outb(devpriv->mode_reg_int | 6, dev->iobase + PCL812_MODE); -#ifdef PCL812_EXTDEBUG - printk(KERN_DEBUG "pcl812 EDBG: END: pcl812_ai_cmd(...)\n"); -#endif - return 0; } @@ -987,9 +920,6 @@ static irqreturn_t interrupt_pcl812_ai_dma(int irq, void *d) int len, bufptr; short *ptr; -#ifdef PCL812_EXTDEBUG - printk(KERN_DEBUG "pcl812 EDBG: BGN: interrupt_pcl812_ai_dma(...)\n"); -#endif ptr = (short *)devpriv->dmabuf[devpriv->next_dma_buf]; len = (devpriv->dmabytestomove[devpriv->next_dma_buf] >> 1) - devpriv->ai_poll_ptr; @@ -1022,9 +952,6 @@ static irqreturn_t interrupt_pcl812_ai_dma(int irq, void *d) transfer_from_dma_buf(dev, s, ptr, bufptr, len); -#ifdef PCL812_EXTDEBUG - printk(KERN_DEBUG "pcl812 EDBG: END: interrupt_pcl812_ai_dma(...)\n"); -#endif return IRQ_HANDLED; } @@ -1141,10 +1068,6 @@ static void setup_range_channel(struct comedi_device *dev, static void start_pacer(struct comedi_device *dev, int mode, unsigned int divisor1, unsigned int divisor2) { -#ifdef PCL812_EXTDEBUG - printk(KERN_DEBUG "pcl812 EDBG: BGN: start_pacer(%d,%u,%u)\n", mode, - divisor1, divisor2); -#endif outb(0xb4, dev->iobase + PCL812_CTRCTL); outb(0x74, dev->iobase + PCL812_CTRCTL); udelay(1); @@ -1155,9 +1078,6 @@ static void start_pacer(struct comedi_device *dev, int mode, outb(divisor1 & 0xff, dev->iobase + PCL812_CTR1); outb((divisor1 >> 8) & 0xff, dev->iobase + PCL812_CTR1); } -#ifdef PCL812_EXTDEBUG - printk(KERN_DEBUG "pcl812 EDBG: END: start_pacer(...)\n"); -#endif } /* @@ -1187,9 +1107,6 @@ static void free_resources(struct comedi_device *dev) static int pcl812_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { -#ifdef PCL812_EXTDEBUG - printk(KERN_DEBUG "pcl812 EDBG: BGN: pcl812_ai_cancel(...)\n"); -#endif if (devpriv->ai_dma) disable_dma(devpriv->dma); outb(0, dev->iobase + PCL812_CLRINT); /* clear INT request */ @@ -1197,9 +1114,6 @@ static int pcl812_ai_cancel(struct comedi_device *dev, outb(devpriv->mode_reg_int | 0, dev->iobase + PCL812_MODE); start_pacer(dev, -1, 0, 0); /* stop 8254 */ outb(0, dev->iobase + PCL812_CLRINT); /* clear INT request */ -#ifdef PCL812_EXTDEBUG - printk(KERN_DEBUG "pcl812 EDBG: END: pcl812_ai_cancel(...)\n"); -#endif return 0; } @@ -1210,9 +1124,6 @@ static void pcl812_reset(struct comedi_device *dev) { const struct pcl812_board *board = comedi_board(dev); -#ifdef PCL812_EXTDEBUG - printk(KERN_DEBUG "pcl812 EDBG: BGN: pcl812_reset(...)\n"); -#endif outb(0, dev->iobase + PCL812_MUX); outb(0 + devpriv->range_correction, dev->iobase + PCL812_GAIN); devpriv->old_chan_reg = -1; /* invalidate chain/gain memory */ @@ -1242,9 +1153,6 @@ static void pcl812_reset(struct comedi_device *dev) break; } udelay(5); -#ifdef PCL812_EXTDEBUG - printk(KERN_DEBUG "pcl812 EDBG: END: pcl812_reset(...)\n"); -#endif } static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it) -- cgit v0.10.2 From 1d489bab6651cfda44ddcb2ae0543ccf3cbd5400 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 19:12:18 -0700 Subject: staging: comedi: me4000: remove CALL_PDEBUG macro The CALL_PDEBUG macro is used to do function tracing in the driver. There are better ways to do this. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Cc: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index aae01f1..f5a0bcf 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -163,8 +163,6 @@ static int me4000_probe(struct comedi_device *dev, struct comedi_devconfig *it) int result, i; struct me4000_board *board; - CALL_PDEBUG("In me4000_probe()\n"); - /* Allocate private memory */ if (alloc_private(dev, sizeof(struct me4000_info)) < 0) return -ENOMEM; @@ -308,9 +306,6 @@ found: static int get_registers(struct comedi_device *dev, struct pci_dev *pci_dev_p) { - - CALL_PDEBUG("In get_registers()\n"); - /*--------------------------- plx regbase -------------------------------*/ info->plx_regbase = pci_resource_start(pci_dev_p, 1); @@ -362,8 +357,6 @@ static int init_board_info(struct comedi_device *dev, struct pci_dev *pci_dev_p) { int result; - CALL_PDEBUG("In init_board_info()\n"); - /* Init spin locks */ /* spin_lock_init(&info->preload_lock); */ /* spin_lock_init(&info->ai_ctrl_lock); */ @@ -394,8 +387,6 @@ static int init_ao_context(struct comedi_device *dev) { int i; - CALL_PDEBUG("In init_ao_context()\n"); - for (i = 0; i < thisboard->ao.count; i++) { /* spin_lock_init(&info->ao_context[i].use_lock); */ info->ao_context[i].irq = info->irq; @@ -475,9 +466,6 @@ static int init_ao_context(struct comedi_device *dev) static int init_ai_context(struct comedi_device *dev) { - - CALL_PDEBUG("In init_ai_context()\n"); - info->ai_context.irq = info->irq; info->ai_context.ctrl_reg = info->me4000_regbase + ME4000_AI_CTRL_REG; @@ -509,9 +497,6 @@ static int init_ai_context(struct comedi_device *dev) static int init_dio_context(struct comedi_device *dev) { - - CALL_PDEBUG("In init_dio_context()\n"); - info->dio_context.dir_reg = info->me4000_regbase + ME4000_DIO_DIR_REG; info->dio_context.ctrl_reg = info->me4000_regbase + ME4000_DIO_CTRL_REG; info->dio_context.port_0_reg = @@ -528,9 +513,6 @@ static int init_dio_context(struct comedi_device *dev) static int init_cnt_context(struct comedi_device *dev) { - - CALL_PDEBUG("In init_cnt_context()\n"); - info->cnt_context.ctrl_reg = info->timer_regbase + ME4000_CNT_CTRL_REG; info->cnt_context.counter_0_reg = info->timer_regbase + ME4000_CNT_COUNTER_0_REG; @@ -554,8 +536,6 @@ static int xilinx_download(struct comedi_device *dev) int idx = 0; int size = 0; - CALL_PDEBUG("In xilinx_download()\n"); - init_waitqueue_head(&queue); /* @@ -634,8 +614,6 @@ static int reset_board(struct comedi_device *dev) { unsigned long icr; - CALL_PDEBUG("In reset_board()\n"); - /* Make a hardware reset */ icr = me4000_inl(dev, info->plx_regbase + PLX_ICR); icr |= 0x40000000; @@ -708,8 +686,6 @@ static int me4000_ai_insn_read(struct comedi_device *dev, unsigned long tmp; long lval; - CALL_PDEBUG("In me4000_ai_insn_read()\n"); - if (insn->n == 0) { return 0; } else if (insn->n > 1) { @@ -827,8 +803,6 @@ static int me4000_ai_cancel(struct comedi_device *dev, { unsigned long tmp; - CALL_PDEBUG("In me4000_ai_cancel()\n"); - /* Stop any running conversion */ tmp = me4000_inl(dev, info->ai_context.ctrl_reg); tmp &= ~(ME4000_AI_CTRL_BIT_STOP | ME4000_AI_CTRL_BIT_IMMEDIATE_STOP); @@ -846,8 +820,6 @@ static int ai_check_chanlist(struct comedi_device *dev, int aref; int i; - CALL_PDEBUG("In ai_check_chanlist()\n"); - /* Check whether a channel list is available */ if (!cmd->chanlist_len) { printk(KERN_ERR @@ -933,8 +905,6 @@ static int ai_round_cmd_args(struct comedi_device *dev, int rest; - CALL_PDEBUG("In ai_round_cmd_args()\n"); - *init_ticks = 0; *scan_ticks = 0; *chan_ticks = 0; @@ -994,9 +964,6 @@ static void ai_write_timer(struct comedi_device *dev, unsigned int init_ticks, unsigned int scan_ticks, unsigned int chan_ticks) { - - CALL_PDEBUG("In ai_write_timer()\n"); - me4000_outl(dev, init_ticks - 1, info->ai_context.scan_pre_timer_low_reg); me4000_outl(dev, 0x0, info->ai_context.scan_pre_timer_high_reg); @@ -1020,8 +987,6 @@ static int ai_prepare(struct comedi_device *dev, unsigned long tmp = 0; - CALL_PDEBUG("In ai_prepare()\n"); - /* Write timer arguments */ ai_write_timer(dev, init_ticks, scan_ticks, chan_ticks); @@ -1089,8 +1054,6 @@ static int ai_write_chanlist(struct comedi_device *dev, unsigned int aref; int i; - CALL_PDEBUG("In ai_write_chanlist()\n"); - for (i = 0; i < cmd->chanlist_len; i++) { chan = CR_CHAN(cmd->chanlist[i]); rang = CR_RANGE(cmd->chanlist[i]); @@ -1127,8 +1090,6 @@ static int me4000_ai_do_cmd(struct comedi_device *dev, unsigned int chan_ticks = 0; struct comedi_cmd *cmd = &s->async->cmd; - CALL_PDEBUG("In me4000_ai_do_cmd()\n"); - /* Reset the analog input */ err = me4000_ai_cancel(dev, s); if (err) @@ -1173,8 +1134,6 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, unsigned int scan_ticks; int err = 0; - CALL_PDEBUG("In me4000_ai_do_cmd_test()\n"); - PDEBUG("me4000_ai_do_cmd_test(): subdev = %d\n", cmd->subdev); PDEBUG("me4000_ai_do_cmd_test(): flags = %08X\n", cmd->flags); PDEBUG("me4000_ai_do_cmd_test(): start_src = %08X\n", @@ -1717,8 +1676,6 @@ static int me4000_ao_insn_write(struct comedi_device *dev, int aref = CR_AREF(insn->chanspec); unsigned long tmp; - CALL_PDEBUG("In me4000_ao_insn_write()\n"); - if (insn->n == 0) { return 0; } else if (insn->n > 1) { @@ -1794,9 +1751,6 @@ static int me4000_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - - CALL_PDEBUG("In me4000_dio_insn_bits()\n"); - /* Length of data must be 2 (mask and new data, see below) */ if (insn->n == 0) return 0; @@ -1851,8 +1805,6 @@ static int me4000_dio_insn_config(struct comedi_device *dev, unsigned long tmp; int chan = CR_CHAN(insn->chanspec); - CALL_PDEBUG("In me4000_dio_insn_config()\n"); - switch (data[0]) { default: return -EINVAL; @@ -1948,9 +1900,6 @@ static int me4000_dio_insn_config(struct comedi_device *dev, static int cnt_reset(struct comedi_device *dev, unsigned int channel) { - - CALL_PDEBUG("In cnt_reset()\n"); - switch (channel) { case 0: me4000_outb(dev, 0x30, info->cnt_context.ctrl_reg); @@ -1982,8 +1931,6 @@ static int cnt_config(struct comedi_device *dev, unsigned int channel, { int tmp = 0; - CALL_PDEBUG("In cnt_config()\n"); - switch (channel) { case 0: tmp |= ME4000_CNT_COUNTER_0; @@ -2041,8 +1988,6 @@ static int me4000_cnt_insn_config(struct comedi_device *dev, int err; - CALL_PDEBUG("In me4000_cnt_insn_config()\n"); - switch (data[0]) { case GPCT_RESET: if (insn->n != 1) { @@ -2087,8 +2032,6 @@ static int me4000_cnt_insn_read(struct comedi_device *dev, unsigned short tmp; - CALL_PDEBUG("In me4000_cnt_insn_read()\n"); - if (insn->n == 0) return 0; @@ -2137,8 +2080,6 @@ static int me4000_cnt_insn_write(struct comedi_device *dev, unsigned short tmp; - CALL_PDEBUG("In me4000_cnt_insn_write()\n"); - if (insn->n == 0) { return 0; } else if (insn->n > 1) { @@ -2184,8 +2125,6 @@ static int me4000_attach(struct comedi_device *dev, struct comedi_devconfig *it) struct comedi_subdevice *s; int result; - CALL_PDEBUG("In me4000_attach()\n"); - result = me4000_probe(dev, it); if (result) return result; diff --git a/drivers/staging/comedi/drivers/me4000.h b/drivers/staging/comedi/drivers/me4000.h index 733b192..7087da2 100644 --- a/drivers/staging/comedi/drivers/me4000.h +++ b/drivers/staging/comedi/drivers/me4000.h @@ -28,18 +28,10 @@ Debug section ===========================================================================*/ -#undef ME4000_CALL_DEBUG /* Debug function entry and exit */ #undef ME4000_PORT_DEBUG /* Debug port access */ #undef ME4000_ISR_DEBUG /* Debug the interrupt service routine */ #undef ME4000_DEBUG /* General purpose debug masseges */ -#ifdef ME4000_CALL_DEBUG -#undef CALL_PDEBUG -#define CALL_PDEBUG(fmt, args...) printk(KERN_DEBUG"comedi%d: me4000: " fmt, dev->minor, ##args) -#else -# define CALL_PDEBUG(fmt, args...) /* no debugging, do nothing */ -#endif - #ifdef ME4000_PORT_DEBUG #undef PORT_PDEBUG #define PORT_PDEBUG(fmt, args...) printk(KERN_DEBUG"comedi%d: me4000: " fmt, dev->minor, ##args) -- cgit v0.10.2 From 3934954b4c76b049c79b28ed245425dee71c2472 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 19:12:35 -0700 Subject: staging: comedi: me4000: remove PORT_PDEBUG macro The PORT_PDEBUG macro is used to output the result of every port io operation. This shouldn't be in a mainline driver. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Cc: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index f5a0bcf..ddb9384 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -111,14 +111,12 @@ static int ai_write_chanlist(struct comedi_device *dev, static inline void me4000_outb(struct comedi_device *dev, unsigned char value, unsigned long port) { - PORT_PDEBUG("--> 0x%02X port 0x%04lX\n", value, port); outb(value, port); } static inline void me4000_outl(struct comedi_device *dev, unsigned long value, unsigned long port) { - PORT_PDEBUG("--> 0x%08lX port 0x%04lX\n", value, port); outl(value, port); } @@ -127,7 +125,6 @@ static inline unsigned long me4000_inl(struct comedi_device *dev, { unsigned long value; value = inl(port); - PORT_PDEBUG("<-- 0x%08lX port 0x%04lX\n", value, port); return value; } @@ -136,7 +133,6 @@ static inline unsigned char me4000_inb(struct comedi_device *dev, { unsigned char value; value = inb(port); - PORT_PDEBUG("<-- 0x%08X port 0x%04lX\n", value, port); return value; } diff --git a/drivers/staging/comedi/drivers/me4000.h b/drivers/staging/comedi/drivers/me4000.h index 7087da2..d9ee3fb 100644 --- a/drivers/staging/comedi/drivers/me4000.h +++ b/drivers/staging/comedi/drivers/me4000.h @@ -28,17 +28,9 @@ Debug section ===========================================================================*/ -#undef ME4000_PORT_DEBUG /* Debug port access */ #undef ME4000_ISR_DEBUG /* Debug the interrupt service routine */ #undef ME4000_DEBUG /* General purpose debug masseges */ -#ifdef ME4000_PORT_DEBUG -#undef PORT_PDEBUG -#define PORT_PDEBUG(fmt, args...) printk(KERN_DEBUG"comedi%d: me4000: " fmt, dev->minor, ##args) -#else -#define PORT_PDEBUG(fmt, args...) /* no debugging, do nothing */ -#endif - #ifdef ME4000_ISR_DEBUG #undef ISR_PDEBUG #define ISR_PDEBUG(fmt, args...) printk(KERN_DEBUG"comedi%d: me4000: " fmt, dev->minor, ##args) -- cgit v0.10.2 From d6cbe537c6f0cb99bc76a48d138ac21f7ec59548 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 19:12:55 -0700 Subject: staging: comedi: me4000: remove inline port io wrappers With the PORT_PDEBUG macro remove we can now remove the inline port io wrappers. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Cc: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index ddb9384..5b45146 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -104,38 +104,6 @@ static int ai_write_chanlist(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd); -/*----------------------------------------------------------------------------- - Meilhaus inline functions - ---------------------------------------------------------------------------*/ - -static inline void me4000_outb(struct comedi_device *dev, unsigned char value, - unsigned long port) -{ - outb(value, port); -} - -static inline void me4000_outl(struct comedi_device *dev, unsigned long value, - unsigned long port) -{ - outl(value, port); -} - -static inline unsigned long me4000_inl(struct comedi_device *dev, - unsigned long port) -{ - unsigned long value; - value = inl(port); - return value; -} - -static inline unsigned char me4000_inb(struct comedi_device *dev, - unsigned long port) -{ - unsigned char value; - value = inb(port); - return value; -} - static const struct comedi_lrange me4000_ai_range = { 4, { @@ -611,56 +579,45 @@ static int reset_board(struct comedi_device *dev) unsigned long icr; /* Make a hardware reset */ - icr = me4000_inl(dev, info->plx_regbase + PLX_ICR); + icr = inl(info->plx_regbase + PLX_ICR); icr |= 0x40000000; - me4000_outl(dev, icr, info->plx_regbase + PLX_ICR); + outl(icr, info->plx_regbase + PLX_ICR); icr &= ~0x40000000; - me4000_outl(dev, icr, info->plx_regbase + PLX_ICR); + outl(icr, info->plx_regbase + PLX_ICR); /* 0x8000 to the DACs means an output voltage of 0V */ - me4000_outl(dev, 0x8000, - info->me4000_regbase + ME4000_AO_00_SINGLE_REG); - me4000_outl(dev, 0x8000, - info->me4000_regbase + ME4000_AO_01_SINGLE_REG); - me4000_outl(dev, 0x8000, - info->me4000_regbase + ME4000_AO_02_SINGLE_REG); - me4000_outl(dev, 0x8000, - info->me4000_regbase + ME4000_AO_03_SINGLE_REG); + outl(0x8000, info->me4000_regbase + ME4000_AO_00_SINGLE_REG); + outl(0x8000, info->me4000_regbase + ME4000_AO_01_SINGLE_REG); + outl(0x8000, info->me4000_regbase + ME4000_AO_02_SINGLE_REG); + outl(0x8000, info->me4000_regbase + ME4000_AO_03_SINGLE_REG); /* Set both stop bits in the analog input control register */ - me4000_outl(dev, - ME4000_AI_CTRL_BIT_IMMEDIATE_STOP | ME4000_AI_CTRL_BIT_STOP, - info->me4000_regbase + ME4000_AI_CTRL_REG); + outl(ME4000_AI_CTRL_BIT_IMMEDIATE_STOP | ME4000_AI_CTRL_BIT_STOP, + info->me4000_regbase + ME4000_AI_CTRL_REG); /* Set both stop bits in the analog output control register */ - me4000_outl(dev, - ME4000_AO_CTRL_BIT_IMMEDIATE_STOP | ME4000_AO_CTRL_BIT_STOP, - info->me4000_regbase + ME4000_AO_00_CTRL_REG); - me4000_outl(dev, - ME4000_AO_CTRL_BIT_IMMEDIATE_STOP | ME4000_AO_CTRL_BIT_STOP, - info->me4000_regbase + ME4000_AO_01_CTRL_REG); - me4000_outl(dev, - ME4000_AO_CTRL_BIT_IMMEDIATE_STOP | ME4000_AO_CTRL_BIT_STOP, - info->me4000_regbase + ME4000_AO_02_CTRL_REG); - me4000_outl(dev, - ME4000_AO_CTRL_BIT_IMMEDIATE_STOP | ME4000_AO_CTRL_BIT_STOP, - info->me4000_regbase + ME4000_AO_03_CTRL_REG); + outl(ME4000_AO_CTRL_BIT_IMMEDIATE_STOP | ME4000_AO_CTRL_BIT_STOP, + info->me4000_regbase + ME4000_AO_00_CTRL_REG); + outl(ME4000_AO_CTRL_BIT_IMMEDIATE_STOP | ME4000_AO_CTRL_BIT_STOP, + info->me4000_regbase + ME4000_AO_01_CTRL_REG); + outl(ME4000_AO_CTRL_BIT_IMMEDIATE_STOP | ME4000_AO_CTRL_BIT_STOP, + info->me4000_regbase + ME4000_AO_02_CTRL_REG); + outl(ME4000_AO_CTRL_BIT_IMMEDIATE_STOP | ME4000_AO_CTRL_BIT_STOP, + info->me4000_regbase + ME4000_AO_03_CTRL_REG); /* Enable interrupts on the PLX */ - me4000_outl(dev, 0x43, info->plx_regbase + PLX_INTCSR); + outl(0x43, info->plx_regbase + PLX_INTCSR); /* Set the adustment register for AO demux */ - me4000_outl(dev, ME4000_AO_DEMUX_ADJUST_VALUE, + outl(ME4000_AO_DEMUX_ADJUST_VALUE, info->me4000_regbase + ME4000_AO_DEMUX_ADJUST_REG); /* * Set digital I/O direction for port 0 * to output on isolated versions */ - if (!(me4000_inl(dev, info->me4000_regbase + ME4000_DIO_DIR_REG) & 0x1)) { - me4000_outl(dev, 0x1, - info->me4000_regbase + ME4000_DIO_CTRL_REG); - } + if (!(inl(info->me4000_regbase + ME4000_DIO_DIR_REG) & 0x1)) + outl(0x1, info->me4000_regbase + ME4000_DIO_CTRL_REG); return 0; } @@ -750,36 +707,34 @@ static int me4000_ai_insn_read(struct comedi_device *dev, entry |= ME4000_AI_LIST_LAST_ENTRY; /* Clear channel list, data fifo and both stop bits */ - tmp = me4000_inl(dev, info->ai_context.ctrl_reg); + tmp = inl(info->ai_context.ctrl_reg); tmp &= ~(ME4000_AI_CTRL_BIT_CHANNEL_FIFO | ME4000_AI_CTRL_BIT_DATA_FIFO | ME4000_AI_CTRL_BIT_STOP | ME4000_AI_CTRL_BIT_IMMEDIATE_STOP); - me4000_outl(dev, tmp, info->ai_context.ctrl_reg); + outl(tmp, info->ai_context.ctrl_reg); /* Set the acquisition mode to single */ tmp &= ~(ME4000_AI_CTRL_BIT_MODE_0 | ME4000_AI_CTRL_BIT_MODE_1 | ME4000_AI_CTRL_BIT_MODE_2); - me4000_outl(dev, tmp, info->ai_context.ctrl_reg); + outl(tmp, info->ai_context.ctrl_reg); /* Enable channel list and data fifo */ tmp |= ME4000_AI_CTRL_BIT_CHANNEL_FIFO | ME4000_AI_CTRL_BIT_DATA_FIFO; - me4000_outl(dev, tmp, info->ai_context.ctrl_reg); + outl(tmp, info->ai_context.ctrl_reg); /* Generate channel list entry */ - me4000_outl(dev, entry, info->ai_context.channel_list_reg); + outl(entry, info->ai_context.channel_list_reg); /* Set the timer to maximum sample rate */ - me4000_outl(dev, ME4000_AI_MIN_TICKS, info->ai_context.chan_timer_reg); - me4000_outl(dev, ME4000_AI_MIN_TICKS, - info->ai_context.chan_pre_timer_reg); + outl(ME4000_AI_MIN_TICKS, info->ai_context.chan_timer_reg); + outl(ME4000_AI_MIN_TICKS, info->ai_context.chan_pre_timer_reg); /* Start conversion by dummy read */ - me4000_inl(dev, info->ai_context.start_reg); + inl(info->ai_context.start_reg); /* Wait until ready */ udelay(10); - if (! - (me4000_inl(dev, info->ai_context.status_reg) & + if (!(inl(info->ai_context.status_reg) & ME4000_AI_STATUS_BIT_EF_DATA)) { printk(KERN_ERR "comedi%d: me4000: me4000_ai_insn_read(): " @@ -788,7 +743,7 @@ static int me4000_ai_insn_read(struct comedi_device *dev, } /* Read value from data fifo */ - lval = me4000_inl(dev, info->ai_context.data_reg) & 0xFFFF; + lval = inl(info->ai_context.data_reg) & 0xFFFF; data[0] = lval ^ 0x8000; return 1; @@ -800,12 +755,12 @@ static int me4000_ai_cancel(struct comedi_device *dev, unsigned long tmp; /* Stop any running conversion */ - tmp = me4000_inl(dev, info->ai_context.ctrl_reg); + tmp = inl(info->ai_context.ctrl_reg); tmp &= ~(ME4000_AI_CTRL_BIT_STOP | ME4000_AI_CTRL_BIT_IMMEDIATE_STOP); - me4000_outl(dev, tmp, info->ai_context.ctrl_reg); + outl(tmp, info->ai_context.ctrl_reg); /* Clear the control register */ - me4000_outl(dev, 0x0, info->ai_context.ctrl_reg); + outl(0x0, info->ai_context.ctrl_reg); return 0; } @@ -960,18 +915,16 @@ static void ai_write_timer(struct comedi_device *dev, unsigned int init_ticks, unsigned int scan_ticks, unsigned int chan_ticks) { - me4000_outl(dev, init_ticks - 1, - info->ai_context.scan_pre_timer_low_reg); - me4000_outl(dev, 0x0, info->ai_context.scan_pre_timer_high_reg); + outl(init_ticks - 1, info->ai_context.scan_pre_timer_low_reg); + outl(0x0, info->ai_context.scan_pre_timer_high_reg); if (scan_ticks) { - me4000_outl(dev, scan_ticks - 1, - info->ai_context.scan_timer_low_reg); - me4000_outl(dev, 0x0, info->ai_context.scan_timer_high_reg); + outl(scan_ticks - 1, info->ai_context.scan_timer_low_reg); + outl(0x0, info->ai_context.scan_timer_high_reg); } - me4000_outl(dev, chan_ticks - 1, info->ai_context.chan_pre_timer_reg); - me4000_outl(dev, chan_ticks - 1, info->ai_context.chan_timer_reg); + outl(chan_ticks - 1, info->ai_context.chan_pre_timer_reg); + outl(chan_ticks - 1, info->ai_context.chan_timer_reg); } static int ai_prepare(struct comedi_device *dev, @@ -987,7 +940,7 @@ static int ai_prepare(struct comedi_device *dev, ai_write_timer(dev, init_ticks, scan_ticks, chan_ticks); /* Reset control register */ - me4000_outl(dev, tmp, info->ai_context.ctrl_reg); + outl(tmp, info->ai_context.ctrl_reg); /* Start sources */ if ((cmd->start_src == TRIG_EXT && @@ -1020,12 +973,12 @@ static int ai_prepare(struct comedi_device *dev, /* Stop triggers */ if (cmd->stop_src == TRIG_COUNT) { - me4000_outl(dev, cmd->chanlist_len * cmd->stop_arg, + outl(cmd->chanlist_len * cmd->stop_arg, info->ai_context.sample_counter_reg); tmp |= ME4000_AI_CTRL_BIT_HF_IRQ | ME4000_AI_CTRL_BIT_SC_IRQ; } else if (cmd->stop_src == TRIG_NONE && cmd->scan_end_src == TRIG_COUNT) { - me4000_outl(dev, cmd->scan_end_arg, + outl(cmd->scan_end_arg, info->ai_context.sample_counter_reg); tmp |= ME4000_AI_CTRL_BIT_HF_IRQ | ME4000_AI_CTRL_BIT_SC_IRQ; } else { @@ -1033,7 +986,7 @@ static int ai_prepare(struct comedi_device *dev, } /* Write the setup to the control register */ - me4000_outl(dev, tmp, info->ai_context.ctrl_reg); + outl(tmp, info->ai_context.ctrl_reg); /* Write the channel list */ ai_write_chanlist(dev, s, cmd); @@ -1071,7 +1024,7 @@ static int ai_write_chanlist(struct comedi_device *dev, else entry |= ME4000_AI_LIST_INPUT_SINGLE_ENDED; - me4000_outl(dev, entry, info->ai_context.channel_list_reg); + outl(entry, info->ai_context.channel_list_reg); } return 0; @@ -1103,7 +1056,7 @@ static int me4000_ai_do_cmd(struct comedi_device *dev, return err; /* Start acquistion by dummy read */ - me4000_inl(dev, info->ai_context.start_reg); + inl(info->ai_context.start_reg); return 0; } @@ -1516,14 +1469,13 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) return IRQ_HANDLED; } - if (me4000_inl(dev, - ai_context->irq_status_reg) & + if (inl(ai_context->irq_status_reg) & ME4000_IRQ_STATUS_BIT_AI_HF) { ISR_PDEBUG ("me4000_ai_isr(): Fifo half full interrupt occurred\n"); /* Read status register to find out what happened */ - tmp = me4000_inl(dev, ai_context->ctrl_reg); + tmp = inl(ai_context->ctrl_reg); if (!(tmp & ME4000_AI_STATUS_BIT_FF_DATA) && !(tmp & ME4000_AI_STATUS_BIT_HF_DATA) && @@ -1538,7 +1490,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) tmp |= ME4000_AI_CTRL_BIT_IMMEDIATE_STOP; tmp &= ~(ME4000_AI_CTRL_BIT_HF_IRQ | ME4000_AI_CTRL_BIT_SC_IRQ); - me4000_outl(dev, tmp, ai_context->ctrl_reg); + outl(tmp, ai_context->ctrl_reg); s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; @@ -1566,7 +1518,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) tmp |= ME4000_AI_CTRL_BIT_IMMEDIATE_STOP; tmp &= ~(ME4000_AI_CTRL_BIT_HF_IRQ | ME4000_AI_CTRL_BIT_SC_IRQ); - me4000_outl(dev, tmp, ai_context->ctrl_reg); + outl(tmp, ai_context->ctrl_reg); s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; @@ -1590,7 +1542,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) tmp |= ME4000_AI_CTRL_BIT_IMMEDIATE_STOP; tmp &= ~(ME4000_AI_CTRL_BIT_HF_IRQ | ME4000_AI_CTRL_BIT_SC_IRQ); - me4000_outl(dev, tmp, ai_context->ctrl_reg); + outl(tmp, ai_context->ctrl_reg); s->async->events |= COMEDI_CB_OVERFLOW; @@ -1605,13 +1557,12 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) /* Work is done, so reset the interrupt */ ISR_PDEBUG("me4000_ai_isr(): Reset fifo half full interrupt\n"); tmp |= ME4000_AI_CTRL_BIT_HF_IRQ_RESET; - me4000_outl(dev, tmp, ai_context->ctrl_reg); + outl(tmp, ai_context->ctrl_reg); tmp &= ~ME4000_AI_CTRL_BIT_HF_IRQ_RESET; - me4000_outl(dev, tmp, ai_context->ctrl_reg); + outl(tmp, ai_context->ctrl_reg); } - if (me4000_inl(dev, - ai_context->irq_status_reg) & ME4000_IRQ_STATUS_BIT_SC) { + if (inl(ai_context->irq_status_reg) & ME4000_IRQ_STATUS_BIT_SC) { ISR_PDEBUG ("me4000_ai_isr(): Sample counter interrupt occurred\n"); @@ -1621,10 +1572,10 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) * Acquisition is complete, so stop * conversion and disable all interrupts */ - tmp = me4000_inl(dev, ai_context->ctrl_reg); + tmp = inl(ai_context->ctrl_reg); tmp |= ME4000_AI_CTRL_BIT_IMMEDIATE_STOP; tmp &= ~(ME4000_AI_CTRL_BIT_HF_IRQ | ME4000_AI_CTRL_BIT_SC_IRQ); - me4000_outl(dev, tmp, ai_context->ctrl_reg); + outl(tmp, ai_context->ctrl_reg); /* Poll data until fifo empty */ while (inl(ai_context->ctrl_reg) & ME4000_AI_STATUS_BIT_EF_DATA) { @@ -1645,9 +1596,9 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) ISR_PDEBUG ("me4000_ai_isr(): Reset interrupt from sample counter\n"); tmp |= ME4000_AI_CTRL_BIT_SC_IRQ_RESET; - me4000_outl(dev, tmp, ai_context->ctrl_reg); + outl(tmp, ai_context->ctrl_reg); tmp &= ~ME4000_AI_CTRL_BIT_SC_IRQ_RESET; - me4000_outl(dev, tmp, ai_context->ctrl_reg); + outl(tmp, ai_context->ctrl_reg); } ISR_PDEBUG("me4000_ai_isr(): Events = 0x%X\n", s->async->events); @@ -1703,15 +1654,15 @@ static int me4000_ao_insn_write(struct comedi_device *dev, } /* Stop any running conversion */ - tmp = me4000_inl(dev, info->ao_context[chan].ctrl_reg); + tmp = inl(info->ao_context[chan].ctrl_reg); tmp |= ME4000_AO_CTRL_BIT_IMMEDIATE_STOP; - me4000_outl(dev, tmp, info->ao_context[chan].ctrl_reg); + outl(tmp, info->ao_context[chan].ctrl_reg); /* Clear control register and set to single mode */ - me4000_outl(dev, 0x0, info->ao_context[chan].ctrl_reg); + outl(0x0, info->ao_context[chan].ctrl_reg); /* Write data value */ - me4000_outl(dev, data[0], info->ao_context[chan].single_reg); + outl(data[0], info->ao_context[chan].single_reg); /* Store in the mirror */ info->ao_context[chan].mirror = data[0]; @@ -1773,23 +1724,22 @@ static int me4000_dio_insn_bits(struct comedi_device *dev, s->state |= data[0] & data[1]; /* Write out the new digital output lines */ - me4000_outl(dev, (s->state >> 0) & 0xFF, + outl((s->state >> 0) & 0xFF, info->dio_context.port_0_reg); - me4000_outl(dev, (s->state >> 8) & 0xFF, + outl((s->state >> 8) & 0xFF, info->dio_context.port_1_reg); - me4000_outl(dev, (s->state >> 16) & 0xFF, + outl((s->state >> 16) & 0xFF, info->dio_context.port_2_reg); - me4000_outl(dev, (s->state >> 24) & 0xFF, + outl((s->state >> 24) & 0xFF, info->dio_context.port_3_reg); } /* On return, data[1] contains the value of the digital input and output lines. */ - data[1] = - ((me4000_inl(dev, info->dio_context.port_0_reg) & 0xFF) << 0) | - ((me4000_inl(dev, info->dio_context.port_1_reg) & 0xFF) << 8) | - ((me4000_inl(dev, info->dio_context.port_2_reg) & 0xFF) << 16) | - ((me4000_inl(dev, info->dio_context.port_3_reg) & 0xFF) << 24); + data[1] = ((inl(info->dio_context.port_0_reg) & 0xFF) << 0) | + ((inl(info->dio_context.port_1_reg) & 0xFF) << 8) | + ((inl(info->dio_context.port_2_reg) & 0xFF) << 16) | + ((inl(info->dio_context.port_3_reg) & 0xFF) << 24); return 2; } @@ -1821,7 +1771,7 @@ static int me4000_dio_insn_config(struct comedi_device *dev, * On the ME-4000 it is only possible to switch port wise (8 bit) */ - tmp = me4000_inl(dev, info->dio_context.ctrl_reg); + tmp = inl(info->dio_context.ctrl_reg); if (data[0] == INSN_CONFIG_DIO_OUTPUT) { if (chan < 8) { @@ -1835,7 +1785,7 @@ static int me4000_dio_insn_config(struct comedi_device *dev, * If one the first port is a fixed output * port and the second is a fixed input port. */ - if (!me4000_inl(dev, info->dio_context.dir_reg)) + if (!inl(info->dio_context.dir_reg)) return -ENODEV; s->io_bits |= 0xFF00; @@ -1862,7 +1812,7 @@ static int me4000_dio_insn_config(struct comedi_device *dev, * If one the first port is a fixed output * port and the second is a fixed input port. */ - if (!me4000_inl(dev, info->dio_context.dir_reg)) + if (!inl(info->dio_context.dir_reg)) return -ENODEV; s->io_bits &= ~0xFF; @@ -1885,7 +1835,7 @@ static int me4000_dio_insn_config(struct comedi_device *dev, } } - me4000_outl(dev, tmp, info->dio_context.ctrl_reg); + outl(tmp, info->dio_context.ctrl_reg); return 1; } @@ -1898,19 +1848,19 @@ static int cnt_reset(struct comedi_device *dev, unsigned int channel) { switch (channel) { case 0: - me4000_outb(dev, 0x30, info->cnt_context.ctrl_reg); - me4000_outb(dev, 0x00, info->cnt_context.counter_0_reg); - me4000_outb(dev, 0x00, info->cnt_context.counter_0_reg); + outb(0x30, info->cnt_context.ctrl_reg); + outb(0x00, info->cnt_context.counter_0_reg); + outb(0x00, info->cnt_context.counter_0_reg); break; case 1: - me4000_outb(dev, 0x70, info->cnt_context.ctrl_reg); - me4000_outb(dev, 0x00, info->cnt_context.counter_1_reg); - me4000_outb(dev, 0x00, info->cnt_context.counter_1_reg); + outb(0x70, info->cnt_context.ctrl_reg); + outb(0x00, info->cnt_context.counter_1_reg); + outb(0x00, info->cnt_context.counter_1_reg); break; case 2: - me4000_outb(dev, 0xB0, info->cnt_context.ctrl_reg); - me4000_outb(dev, 0x00, info->cnt_context.counter_2_reg); - me4000_outb(dev, 0x00, info->cnt_context.counter_2_reg); + outb(0xB0, info->cnt_context.ctrl_reg); + outb(0x00, info->cnt_context.counter_2_reg); + outb(0x00, info->cnt_context.counter_2_reg); break; default: printk(KERN_ERR @@ -1972,7 +1922,7 @@ static int cnt_config(struct comedi_device *dev, unsigned int channel, /* Write the control word */ tmp |= 0x30; - me4000_outb(dev, tmp, info->cnt_context.ctrl_reg); + outb(tmp, info->cnt_context.ctrl_reg); return 0; } @@ -2041,21 +1991,21 @@ static int me4000_cnt_insn_read(struct comedi_device *dev, switch (insn->chanspec) { case 0: - tmp = me4000_inb(dev, info->cnt_context.counter_0_reg); + tmp = inb(info->cnt_context.counter_0_reg); data[0] = tmp; - tmp = me4000_inb(dev, info->cnt_context.counter_0_reg); + tmp = inb(info->cnt_context.counter_0_reg); data[0] |= tmp << 8; break; case 1: - tmp = me4000_inb(dev, info->cnt_context.counter_1_reg); + tmp = inb(info->cnt_context.counter_1_reg); data[0] = tmp; - tmp = me4000_inb(dev, info->cnt_context.counter_1_reg); + tmp = inb(info->cnt_context.counter_1_reg); data[0] |= tmp << 8; break; case 2: - tmp = me4000_inb(dev, info->cnt_context.counter_2_reg); + tmp = inb(info->cnt_context.counter_2_reg); data[0] = tmp; - tmp = me4000_inb(dev, info->cnt_context.counter_2_reg); + tmp = inb(info->cnt_context.counter_2_reg); data[0] |= tmp << 8; break; default: @@ -2089,21 +2039,21 @@ static int me4000_cnt_insn_write(struct comedi_device *dev, switch (insn->chanspec) { case 0: tmp = data[0] & 0xFF; - me4000_outb(dev, tmp, info->cnt_context.counter_0_reg); + outb(tmp, info->cnt_context.counter_0_reg); tmp = (data[0] >> 8) & 0xFF; - me4000_outb(dev, tmp, info->cnt_context.counter_0_reg); + outb(tmp, info->cnt_context.counter_0_reg); break; case 1: tmp = data[0] & 0xFF; - me4000_outb(dev, tmp, info->cnt_context.counter_1_reg); + outb(tmp, info->cnt_context.counter_1_reg); tmp = (data[0] >> 8) & 0xFF; - me4000_outb(dev, tmp, info->cnt_context.counter_1_reg); + outb(tmp, info->cnt_context.counter_1_reg); break; case 2: tmp = data[0] & 0xFF; - me4000_outb(dev, tmp, info->cnt_context.counter_2_reg); + outb(tmp, info->cnt_context.counter_2_reg); tmp = (data[0] >> 8) & 0xFF; - me4000_outb(dev, tmp, info->cnt_context.counter_2_reg); + outb(tmp, info->cnt_context.counter_2_reg); break; default: printk(KERN_ERR @@ -2207,10 +2157,9 @@ static int me4000_attach(struct comedi_device *dev, struct comedi_devconfig *it) * Check for optoisolated ME-4000 version. If one the first * port is a fixed output port and the second is a fixed input port. */ - if (!me4000_inl(dev, info->dio_context.dir_reg)) { + if (!inl(info->dio_context.dir_reg)) { s->io_bits |= 0xFF; - me4000_outl(dev, ME4000_DIO_CTRL_BIT_MODE_0, - info->dio_context.dir_reg); + outl(ME4000_DIO_CTRL_BIT_MODE_0, info->dio_context.dir_reg); } /*========================================================================= -- cgit v0.10.2 From ef5bbfcb29db95c944bbfd4487454cd237d38b29 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 19:13:15 -0700 Subject: staging: comedi: me4000: remove ISR_PDEBUG macro The ISR_PDEBUG macro is used to output trace messages in the isr routine. This shouldn't be in a mainline driver. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Cc: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 5b45146..657d2fa 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -1451,12 +1451,8 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) int c = 0; long lval; - ISR_PDEBUG("me4000_ai_isr() is executed\n"); - - if (!dev->attached) { - ISR_PDEBUG("me4000_ai_isr() premature interrupt\n"); + if (!dev->attached) return IRQ_NONE; - } /* Reset all events */ s->async->events = 0; @@ -1471,16 +1467,12 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) if (inl(ai_context->irq_status_reg) & ME4000_IRQ_STATUS_BIT_AI_HF) { - ISR_PDEBUG - ("me4000_ai_isr(): Fifo half full interrupt occurred\n"); - /* Read status register to find out what happened */ tmp = inl(ai_context->ctrl_reg); if (!(tmp & ME4000_AI_STATUS_BIT_FF_DATA) && !(tmp & ME4000_AI_STATUS_BIT_HF_DATA) && (tmp & ME4000_AI_STATUS_BIT_EF_DATA)) { - ISR_PDEBUG("me4000_ai_isr(): Fifo full\n"); c = ME4000_AI_FIFO_COUNT; /* @@ -1500,8 +1492,6 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) } else if ((tmp & ME4000_AI_STATUS_BIT_FF_DATA) && !(tmp & ME4000_AI_STATUS_BIT_HF_DATA) && (tmp & ME4000_AI_STATUS_BIT_EF_DATA)) { - ISR_PDEBUG("me4000_ai_isr(): Fifo half full\n"); - s->async->events |= COMEDI_CB_BLOCK; c = ME4000_AI_FIFO_COUNT / 2; @@ -1527,8 +1517,6 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) "Undefined FIFO state\n", dev->minor); } - ISR_PDEBUG("me4000_ai_isr(): Try to read %d values\n", c); - for (i = 0; i < c; i++) { /* Read value from data fifo */ lval = inl(ai_context->data_reg) & 0xFFFF; @@ -1555,7 +1543,6 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) } /* Work is done, so reset the interrupt */ - ISR_PDEBUG("me4000_ai_isr(): Reset fifo half full interrupt\n"); tmp |= ME4000_AI_CTRL_BIT_HF_IRQ_RESET; outl(tmp, ai_context->ctrl_reg); tmp &= ~ME4000_AI_CTRL_BIT_HF_IRQ_RESET; @@ -1563,9 +1550,6 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) } if (inl(ai_context->irq_status_reg) & ME4000_IRQ_STATUS_BIT_SC) { - ISR_PDEBUG - ("me4000_ai_isr(): Sample counter interrupt occurred\n"); - s->async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOA; /* @@ -1593,16 +1577,12 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) } /* Work is done, so reset the interrupt */ - ISR_PDEBUG - ("me4000_ai_isr(): Reset interrupt from sample counter\n"); tmp |= ME4000_AI_CTRL_BIT_SC_IRQ_RESET; outl(tmp, ai_context->ctrl_reg); tmp &= ~ME4000_AI_CTRL_BIT_SC_IRQ_RESET; outl(tmp, ai_context->ctrl_reg); } - ISR_PDEBUG("me4000_ai_isr(): Events = 0x%X\n", s->async->events); - if (s->async->events) comedi_event(dev, s); diff --git a/drivers/staging/comedi/drivers/me4000.h b/drivers/staging/comedi/drivers/me4000.h index d9ee3fb..f87dd19 100644 --- a/drivers/staging/comedi/drivers/me4000.h +++ b/drivers/staging/comedi/drivers/me4000.h @@ -28,16 +28,8 @@ Debug section ===========================================================================*/ -#undef ME4000_ISR_DEBUG /* Debug the interrupt service routine */ #undef ME4000_DEBUG /* General purpose debug masseges */ -#ifdef ME4000_ISR_DEBUG -#undef ISR_PDEBUG -#define ISR_PDEBUG(fmt, args...) printk(KERN_DEBUG"comedi%d: me4000: " fmt, dev->minor, ##args) -#else -#define ISR_PDEBUG(fmt, args...) /* no debugging, do nothing */ -#endif - #ifdef ME4000_DEBUG #undef PDEBUG #define PDEBUG(fmt, args...) printk(KERN_DEBUG"comedi%d: me4000: " fmt, dev->minor, ##args) -- cgit v0.10.2 From 871784a5f86323ce654ba56e1f5e85f717a53a5e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Jun 2012 19:13:42 -0700 Subject: staging: comedi: me4000: remove PDEBUG macro The PDEBUG macro is used to output a bunch of debug messages in the driver. These messages might be useful when first creating the driver but they shouldn't be in mainline. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Cc: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 657d2fa..72466bf 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -860,11 +860,6 @@ static int ai_round_cmd_args(struct comedi_device *dev, *scan_ticks = 0; *chan_ticks = 0; - PDEBUG("ai_round_cmd_arg(): start_arg = %d\n", cmd->start_arg); - PDEBUG("ai_round_cmd_arg(): scan_begin_arg = %d\n", - cmd->scan_begin_arg); - PDEBUG("ai_round_cmd_arg(): convert_arg = %d\n", cmd->convert_arg); - if (cmd->start_arg) { *init_ticks = (cmd->start_arg * 33) / 1000; rest = (cmd->start_arg * 33) % 1000; @@ -904,10 +899,6 @@ static int ai_round_cmd_args(struct comedi_device *dev, } } - PDEBUG("ai_round_cmd_args(): init_ticks = %d\n", *init_ticks); - PDEBUG("ai_round_cmd_args(): scan_ticks = %d\n", *scan_ticks); - PDEBUG("ai_round_cmd_args(): chan_ticks = %d\n", *chan_ticks); - return 0; } @@ -1083,32 +1074,6 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, unsigned int scan_ticks; int err = 0; - PDEBUG("me4000_ai_do_cmd_test(): subdev = %d\n", cmd->subdev); - PDEBUG("me4000_ai_do_cmd_test(): flags = %08X\n", cmd->flags); - PDEBUG("me4000_ai_do_cmd_test(): start_src = %08X\n", - cmd->start_src); - PDEBUG("me4000_ai_do_cmd_test(): start_arg = %d\n", - cmd->start_arg); - PDEBUG("me4000_ai_do_cmd_test(): scan_begin_src = %08X\n", - cmd->scan_begin_src); - PDEBUG("me4000_ai_do_cmd_test(): scan_begin_arg = %d\n", - cmd->scan_begin_arg); - PDEBUG("me4000_ai_do_cmd_test(): convert_src = %08X\n", - cmd->convert_src); - PDEBUG("me4000_ai_do_cmd_test(): convert_arg = %d\n", - cmd->convert_arg); - PDEBUG("me4000_ai_do_cmd_test(): scan_end_src = %08X\n", - cmd->scan_end_src); - PDEBUG("me4000_ai_do_cmd_test(): scan_end_arg = %d\n", - cmd->scan_end_arg); - PDEBUG("me4000_ai_do_cmd_test(): stop_src = %08X\n", - cmd->stop_src); - PDEBUG("me4000_ai_do_cmd_test(): stop_arg = %d\n", cmd->stop_arg); - PDEBUG("me4000_ai_do_cmd_test(): chanlist = %d\n", - (unsigned int)cmd->chanlist); - PDEBUG("me4000_ai_do_cmd_test(): chanlist_len = %d\n", - cmd->chanlist_len); - /* Only rounding flags are implemented */ cmd->flags &= TRIG_ROUND_NEAREST | TRIG_ROUND_UP | TRIG_ROUND_DOWN; diff --git a/drivers/staging/comedi/drivers/me4000.h b/drivers/staging/comedi/drivers/me4000.h index f87dd19..5a4df4e 100644 --- a/drivers/staging/comedi/drivers/me4000.h +++ b/drivers/staging/comedi/drivers/me4000.h @@ -25,19 +25,6 @@ #define _ME4000_H_ /*============================================================================= - Debug section - ===========================================================================*/ - -#undef ME4000_DEBUG /* General purpose debug masseges */ - -#ifdef ME4000_DEBUG -#undef PDEBUG -#define PDEBUG(fmt, args...) printk(KERN_DEBUG"comedi%d: me4000: " fmt, dev->minor, ##args) -#else -#define PDEBUG(fmt, args...) /* no debugging, do nothing */ -#endif - -/*============================================================================= PCI vendor and device IDs ===========================================================================*/ -- cgit v0.10.2 From 4d9505af7743828464d066795c6e1311c7884db4 Mon Sep 17 00:00:00 2001 From: Leed Aguilar Date: Thu, 14 Jun 2012 11:05:31 -0400 Subject: staging:iio:gyro:adis16080: remove sparse warnings Removed the following sparse warning: In function 'adis16080_read_raw': warning: 'ut' may be used uninitialized in this function Signed-off-by: Leed Aguilar Acked-by: Lars-Peter Clausen Cc: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/gyro/adis16080_core.c b/drivers/staging/iio/gyro/adis16080_core.c index 11f1dcc..345e4fa 100644 --- a/drivers/staging/iio/gyro/adis16080_core.c +++ b/drivers/staging/iio/gyro/adis16080_core.c @@ -82,7 +82,7 @@ static int adis16080_read_raw(struct iio_dev *indio_dev, long mask) { int ret = -EINVAL; - u16 ut; + u16 ut = 0; /* Take the iio_dev status lock */ mutex_lock(&indio_dev->mlock); -- cgit v0.10.2 From d03fcfe626b89832b36dbfa5fb32a805478b097a Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 15 Jun 2012 16:40:21 +0800 Subject: iio: dac: Convert ad5380 to devm_regmap_* APIs Signed-off-by: Axel Lin Acked-by: Lars-Peter Clausen Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/iio/dac/ad5380.c b/drivers/iio/dac/ad5380.c index 5dfb445..14991ac 100644 --- a/drivers/iio/dac/ad5380.c +++ b/drivers/iio/dac/ad5380.c @@ -373,7 +373,7 @@ static int __devinit ad5380_probe(struct device *dev, struct regmap *regmap, if (indio_dev == NULL) { dev_err(dev, "Failed to allocate iio device\n"); ret = -ENOMEM; - goto error_regmap_exit; + goto error_out; } st = iio_priv(indio_dev); @@ -436,8 +436,7 @@ error_free_reg: kfree(indio_dev->channels); error_free: iio_device_free(indio_dev); -error_regmap_exit: - regmap_exit(regmap); +error_out: return ret; } @@ -456,7 +455,6 @@ static int __devexit ad5380_remove(struct device *dev) regulator_put(st->vref_reg); } - regmap_exit(st->regmap); iio_device_free(indio_dev); return 0; @@ -485,7 +483,7 @@ static int __devinit ad5380_spi_probe(struct spi_device *spi) const struct spi_device_id *id = spi_get_device_id(spi); struct regmap *regmap; - regmap = regmap_init_spi(spi, &ad5380_regmap_config); + regmap = devm_regmap_init_spi(spi, &ad5380_regmap_config); if (IS_ERR(regmap)) return PTR_ERR(regmap); @@ -559,7 +557,7 @@ static int __devinit ad5380_i2c_probe(struct i2c_client *i2c, { struct regmap *regmap; - regmap = regmap_init_i2c(i2c, &ad5380_regmap_config); + regmap = devm_regmap_init_i2c(i2c, &ad5380_regmap_config); if (IS_ERR(regmap)) return PTR_ERR(regmap); -- cgit v0.10.2 From 791de6771ee96e208ee30bfed48e8f6b25422843 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Fri, 15 Jun 2012 18:11:49 +0200 Subject: staging:iio:adis16400: Fix ADIS16300 ROLL_OUT register address In the current driver ROLL_OUT register address is the same as the PITCH_OUT register address. This patch fixes it to use the correct address. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/imu/adis16400.h b/drivers/staging/iio/imu/adis16400.h index 83d133e..1f4e987 100644 --- a/drivers/staging/iio/imu/adis16400.h +++ b/drivers/staging/iio/imu/adis16400.h @@ -42,7 +42,7 @@ #define ADIS16350_ZTEMP_OUT 0x14 /* Z-axis gyroscope temperature measurement */ #define ADIS16300_PITCH_OUT 0x12 /* X axis inclinometer output measurement */ -#define ADIS16300_ROLL_OUT 0x12 /* Y axis inclinometer output measurement */ +#define ADIS16300_ROLL_OUT 0x14 /* Y axis inclinometer output measurement */ /* Calibration parameters */ #define ADIS16400_XGYRO_OFF 0x1A /* X-axis gyroscope bias offset factor */ -- cgit v0.10.2 From 6f30592e8cf0c9eb2e403fe2a44c1d7c1d58b4f1 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Fri, 15 Jun 2012 18:11:50 +0200 Subject: staging:iio:adis16400: Fix ADIS16300 temperature address The ADIS16300 uses the same address for the temperature register as the ADIS16350 and not the same as the ADIS16400. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/imu/adis16400_core.c b/drivers/staging/iio/imu/adis16400_core.c index 1f6bd85..1c9931e 100644 --- a/drivers/staging/iio/imu/adis16400_core.c +++ b/drivers/staging/iio/imu/adis16400_core.c @@ -946,7 +946,7 @@ static struct iio_chan_spec adis16300_channels[] = { .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | IIO_CHAN_INFO_OFFSET_SEPARATE_BIT | IIO_CHAN_INFO_SCALE_SEPARATE_BIT, - .address = temp, + .address = temp0, .scan_index = ADIS16400_SCAN_TEMP, .scan_type = IIO_ST('s', 12, 16, 0), }, { -- cgit v0.10.2 From bb7cf8bc52ff388c89f5984e428e966e326315ad Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Fri, 15 Jun 2012 18:11:51 +0200 Subject: staging:iio:adis16400: Fix ADIS16334 temperature address The channel spec for ADUS16334's temperature channel uses the address and scan index for the Z-axis acceleration channel. This patch fixes it to use the temperature channel address and scan index instead. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/imu/adis16400_core.c b/drivers/staging/iio/imu/adis16400_core.c index 1c9931e..7aa3a9a 100644 --- a/drivers/staging/iio/imu/adis16400_core.c +++ b/drivers/staging/iio/imu/adis16400_core.c @@ -1054,8 +1054,8 @@ static const struct iio_chan_spec adis16334_channels[] = { .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT | IIO_CHAN_INFO_SCALE_SHARED_BIT, - .address = accel_z, - .scan_index = ADIS16400_SCAN_ACC_Z, + .address = temp0, + .scan_index = ADIS16400_SCAN_TEMP, .scan_type = IIO_ST('s', 14, 16, 0), }, IIO_CHAN_SOFT_TIMESTAMP(12) -- cgit v0.10.2 From 07a8329c48b699a85086756eaa1a658540d02ac4 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Fri, 15 Jun 2012 18:11:52 +0200 Subject: staging:iio:adis16400: Fix ADIS163xx AUX_ADC address The ADIS163xx variants use a different register address for the auxiliary ADC channel than the ADIS16400. This patch fixes them to use the correct address. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/imu/adis16400.h b/drivers/staging/iio/imu/adis16400.h index 1f4e987..9dd9f14 100644 --- a/drivers/staging/iio/imu/adis16400.h +++ b/drivers/staging/iio/imu/adis16400.h @@ -43,6 +43,7 @@ #define ADIS16300_PITCH_OUT 0x12 /* X axis inclinometer output measurement */ #define ADIS16300_ROLL_OUT 0x14 /* Y axis inclinometer output measurement */ +#define ADIS16300_AUX_ADC 0x16 /* Auxiliary ADC measurement */ /* Calibration parameters */ #define ADIS16400_XGYRO_OFF 0x1A /* X-axis gyroscope bias offset factor */ diff --git a/drivers/staging/iio/imu/adis16400_core.c b/drivers/staging/iio/imu/adis16400_core.c index 7aa3a9a..3873014 100644 --- a/drivers/staging/iio/imu/adis16400_core.c +++ b/drivers/staging/iio/imu/adis16400_core.c @@ -472,11 +472,12 @@ enum adis16400_chan { temp, temp0, temp1, temp2, in1, + in2, incli_x, incli_y, }; -static u8 adis16400_addresses[17][2] = { +static u8 adis16400_addresses[18][2] = { [in_supply] = { ADIS16400_SUPPLY_OUT }, [gyro_x] = { ADIS16400_XGYRO_OUT, ADIS16400_XGYRO_OFF }, [gyro_y] = { ADIS16400_YGYRO_OUT, ADIS16400_YGYRO_OFF }, @@ -491,7 +492,8 @@ static u8 adis16400_addresses[17][2] = { [temp0] = { ADIS16350_XTEMP_OUT }, [temp1] = { ADIS16350_YTEMP_OUT }, [temp2] = { ADIS16350_ZTEMP_OUT }, - [in1] = { ADIS16400_AUX_ADC }, + [in1] = { ADIS16300_AUX_ADC }, + [in2] = { ADIS16400_AUX_ADC }, [incli_x] = { ADIS16300_PITCH_OUT }, [incli_y] = { ADIS16300_ROLL_OUT } }; @@ -752,7 +754,7 @@ static struct iio_chan_spec adis16400_channels[] = { .channel = 1, .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | IIO_CHAN_INFO_SCALE_SEPARATE_BIT, - .address = in1, + .address = in2, .scan_index = ADIS16400_SCAN_ADC_0, .scan_type = IIO_ST('s', 12, 16, 0), }, -- cgit v0.10.2 From 25c38aa3d17d6ccfca225fafce68401908a1ccb4 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Fri, 15 Jun 2012 19:27:10 +0200 Subject: staging: iio: fix typos in simple dummy driver Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/iio_simple_dummy.c b/drivers/staging/iio/iio_simple_dummy.c index 3104119..155a49a 100644 --- a/drivers/staging/iio/iio_simple_dummy.c +++ b/drivers/staging/iio/iio_simple_dummy.c @@ -27,7 +27,7 @@ /* * A few elements needed to fake a bus for this driver - * Note instances parmeter controls how many of these + * Note instances parameter controls how many of these * dummy devices are registered. */ static unsigned instances = 1; @@ -178,7 +178,7 @@ static struct iio_chan_spec iio_dummy_channels[] = { .scan_index = accelx, .scan_type = { /* Description of storage in buffer */ .sign = 's', /* signed */ - .realbits = 16, /* 12 bits */ + .realbits = 16, /* 16 bits */ .storagebits = 16, /* 16 bits used for storage */ .shift = 0, /* zero shift */ }, @@ -285,9 +285,9 @@ static int iio_dummy_read_raw(struct iio_dev *indio_dev, * iio_dummy_write_raw() - data write function. * @indio_dev: the struct iio_dev associated with this device instance * @chan: the channel whose data is to be read - * @val: first element of returned value (typically INT) - * @val2: second element of returned value (typically MICRO) - * @mask: what we actually want to read. 0 is the channel, everything else + * @val: first element of value to set (typically INT) + * @val2: second element of value to set (typically MICRO) + * @mask: what we actually want to write. 0 is the channel, everything else * is as per the info_mask in iio_chan_spec. * * Note that all raw writes are assumed IIO_VAL_INT and info mask elements diff --git a/drivers/staging/iio/iio_simple_dummy_buffer.c b/drivers/staging/iio/iio_simple_dummy_buffer.c index fdfc873..3e43025 100644 --- a/drivers/staging/iio/iio_simple_dummy_buffer.c +++ b/drivers/staging/iio/iio_simple_dummy_buffer.c @@ -67,8 +67,8 @@ static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p) * software culled hardware scans: * occasionally a driver may process the nearest hardware * scan to avoid storing elements that are not desired. This - * is the fidliest option by far. - * Here lets pretend we have random access. And the values are + * is the fiddliest option by far. + * Here let's pretend we have random access. And the values are * in the constant table fakedata. */ int i, j; -- cgit v0.10.2 From eaedfa54db0584ddf7308bb99c473cc6cf28fb65 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Fri, 15 Jun 2012 18:14:36 +0200 Subject: staging: iio: Remove superfluous flush_scheduled_work None of these drivers ever schedule any work, so there is no need to flush any scheduled work when the driver is removed. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/accel/adis16209_core.c b/drivers/staging/iio/accel/adis16209_core.c index f6fd0d3..6fc426e 100644 --- a/drivers/staging/iio/accel/adis16209_core.c +++ b/drivers/staging/iio/accel/adis16209_core.c @@ -606,8 +606,6 @@ static int adis16209_remove(struct spi_device *spi) { struct iio_dev *indio_dev = spi_get_drvdata(spi); - flush_scheduled_work(); - iio_device_unregister(indio_dev); adis16209_remove_trigger(indio_dev); iio_buffer_unregister(indio_dev); diff --git a/drivers/staging/iio/accel/adis16220_core.c b/drivers/staging/iio/accel/adis16220_core.c index 6a9ac89..af5c576 100644 --- a/drivers/staging/iio/accel/adis16220_core.c +++ b/drivers/staging/iio/accel/adis16220_core.c @@ -694,8 +694,6 @@ static int adis16220_remove(struct spi_device *spi) { struct iio_dev *indio_dev = spi_get_drvdata(spi); - flush_scheduled_work(); - sysfs_remove_bin_file(&indio_dev->dev.kobj, &adc2_bin); sysfs_remove_bin_file(&indio_dev->dev.kobj, &adc1_bin); sysfs_remove_bin_file(&indio_dev->dev.kobj, &accel_bin); diff --git a/drivers/staging/iio/accel/adis16240_core.c b/drivers/staging/iio/accel/adis16240_core.c index 8b15eae..2f59f83 100644 --- a/drivers/staging/iio/accel/adis16240_core.c +++ b/drivers/staging/iio/accel/adis16240_core.c @@ -641,8 +641,6 @@ static int adis16240_remove(struct spi_device *spi) struct iio_dev *indio_dev = spi_get_drvdata(spi); - flush_scheduled_work(); - iio_device_unregister(indio_dev); adis16240_remove_trigger(indio_dev); iio_buffer_unregister(indio_dev); diff --git a/drivers/staging/iio/gyro/adis16260_core.c b/drivers/staging/iio/gyro/adis16260_core.c index ec765f9..fdb84cc 100644 --- a/drivers/staging/iio/gyro/adis16260_core.c +++ b/drivers/staging/iio/gyro/adis16260_core.c @@ -728,8 +728,6 @@ static int adis16260_remove(struct spi_device *spi) if (ret) goto err_ret; - flush_scheduled_work(); - adis16260_remove_trigger(indio_dev); iio_buffer_unregister(indio_dev); adis16260_unconfigure_ring(indio_dev); -- cgit v0.10.2 From cf655d2d6fb38de1a292e87075b39b1741f406c0 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Fri, 15 Jun 2012 19:25:23 +0200 Subject: iio: sysfs-bus-iio typo Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio index 05449c6..a3774a7 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -122,7 +122,7 @@ Description: If an axis is specified it generally means that the temperature sensor is associated with one part of a compound device (e.g. a gyroscope axis). Units after application of scale and offset - are milli degrees Celsuis. + are milli degrees Celsius. What: /sys/bus/iio/devices/iio:deviceX/in_tempX_input KernelVersion: 2.6.38 -- cgit v0.10.2 From 79e9b4e6f2d3fb904233f62cea1b6a42a58416a4 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Fri, 15 Jun 2012 19:25:24 +0200 Subject: iio: cleanup sysfs-bus-iio-light-lm3533-als Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/Documentation/ABI/testing/sysfs-bus-iio-light-lm3533-als b/Documentation/ABI/testing/sysfs-bus-iio-light-lm3533-als index 694a52c..22c5ea6 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio-light-lm3533-als +++ b/Documentation/ABI/testing/sysfs-bus-iio-light-lm3533-als @@ -14,7 +14,6 @@ KernelVersion: 3.5 Contact: Johan Hovold Description: Get the hysteresis for thresholds Y, that is, - threshY_hysteresis = threshY_raising - threshY_falling What: /sys/.../events/illuminance_threshY_falling_value @@ -31,7 +30,7 @@ Description: threshY_raising. These thresholds correspond to the eight zone-boundary - registers (boundaryY_{low,high}) and defines the five light + registers (boundaryY_{low,high}) and define the five light zones. What: /sys/bus/iio/devices/iio:deviceX/in_illuminance0_zone -- cgit v0.10.2 From 33e0c249801c6913b2bd102683ab65ab61e12952 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Fri, 15 Jun 2012 19:25:25 +0200 Subject: iio: iio/machine.h typo Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/include/linux/iio/machine.h b/include/linux/iio/machine.h index 0b1f19b..400a453 100644 --- a/include/linux/iio/machine.h +++ b/include/linux/iio/machine.h @@ -14,7 +14,7 @@ * This is matched against the datasheet_name element * of struct iio_chan_spec. * @consumer_dev_name: Name to uniquely identify the consumer device. - * @consumer_channel: Unique name used to idenitify the channel on the + * @consumer_channel: Unique name used to identify the channel on the * consumer side. */ struct iio_map { -- cgit v0.10.2 From a21601463d0e542d20635b835b6c97294571b0a5 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Fri, 15 Jun 2012 19:25:26 +0200 Subject: staging: iio: add IIO_ALTVOLTAGE to iio_event_monitor example IIO_ALTVOLTAGE is used by frequency/adf4350 and frequency/ad9523 Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/Documentation/iio_event_monitor.c b/drivers/staging/iio/Documentation/iio_event_monitor.c index 2227584..4326e9e 100644 --- a/drivers/staging/iio/Documentation/iio_event_monitor.c +++ b/drivers/staging/iio/Documentation/iio_event_monitor.c @@ -45,6 +45,7 @@ static const char * const iio_chan_type_name_spec[] = { [IIO_ANGL] = "angl", [IIO_TIMESTAMP] = "timestamp", [IIO_CAPACITANCE] = "capacitance", + [IIO_ALTVOLTAGE] = "altvoltage", }; static const char * const iio_ev_type_text[] = { @@ -92,6 +93,7 @@ static bool event_is_known(struct iio_event_data *event) case IIO_ANGL: case IIO_TIMESTAMP: case IIO_CAPACITANCE: + case IIO_ALTVOLTAGE: break; default: return false; -- cgit v0.10.2 From 60ba16e35b887008eececcb935c835026504cef5 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Fri, 15 Jun 2012 19:25:27 +0200 Subject: staging: iio:: fix some typos typos in comments, fix ring_sw module description Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/Documentation/device.txt b/drivers/staging/iio/Documentation/device.txt index f03fbd3..ea08d62 100644 --- a/drivers/staging/iio/Documentation/device.txt +++ b/drivers/staging/iio/Documentation/device.txt @@ -12,7 +12,7 @@ struct iio_dev *indio_dev = iio_device_alloc(sizeof(struct chip_state)); where chip_state is a structure of local state data for this instance of the chip. -That data can be accessed using iio_priv(struct iio_dev *) +That data can be accessed using iio_priv(struct iio_dev *). Then fill in the following: @@ -39,7 +39,7 @@ Then fill in the following: and for associate parameters such as offsets and scales. * info->write_raw: Raw value writing function. Used for writable device values such - as DAC values and caliboffset. + as DAC values and calibbias. * info->read_event_config: Typically only set if there are some interrupt lines. This is used to read if an on sensor event detector is enabled. @@ -62,8 +62,8 @@ Then fill in the following: Poll function related elements. This controls what occurs when a trigger to which this device is attached sends an event. - indio_dev->channels: - Specification of device channels. Most attributes etc are built - form this spec. + Specification of device channels. Most attributes etc. are built + from this spec. - indio_dev->num_channels: How many channels are there? @@ -76,4 +76,4 @@ be registered afterwards (otherwise the whole parentage of devices gets confused) On remove, iio_device_unregister(indio_dev) will remove the device from -the core, and iio_device_free will clean up. +the core, and iio_device_free(indio_dev) will clean up. diff --git a/drivers/staging/iio/Documentation/overview.txt b/drivers/staging/iio/Documentation/overview.txt index afc39ec..43f92b0 100644 --- a/drivers/staging/iio/Documentation/overview.txt +++ b/drivers/staging/iio/Documentation/overview.txt @@ -8,7 +8,7 @@ actual devices combine some ADCs with digital to analog converters The aim is to fill the gap between the somewhat similar hwmon and input subsystems. Hwmon is very much directed at low sample rate sensors used in applications such as fan speed control and temperature -measurement. Input is, as it's name suggests focused on input +measurement. Input is, as its name suggests focused on input devices. In some cases there is considerable overlap between these and IIO. diff --git a/drivers/staging/iio/Documentation/ring.txt b/drivers/staging/iio/Documentation/ring.txt index e338077..e1da433 100644 --- a/drivers/staging/iio/Documentation/ring.txt +++ b/drivers/staging/iio/Documentation/ring.txt @@ -15,8 +15,8 @@ struct iio_ring_buffer contains a struct iio_ring_setup_ops *setup_ops which in turn contains the 4 function pointers (preenable, postenable, predisable and postdisable). These are used to perform device specific steps on either side -of the core changing it's current mode to indicate that the buffer -is enabled or disabled (along with enabling triggering etc as appropriate). +of the core changing its current mode to indicate that the buffer +is enabled or disabled (along with enabling triggering etc. as appropriate). Also in struct iio_ring_buffer is a struct iio_ring_access_funcs. The function pointers within here are used to allow the core to handle diff --git a/drivers/staging/iio/ring_sw.c b/drivers/staging/iio/ring_sw.c index 9358c6c..f61c8fd 100644 --- a/drivers/staging/iio/ring_sw.c +++ b/drivers/staging/iio/ring_sw.c @@ -24,7 +24,7 @@ * @read_p: read pointer (oldest available) * @write_p: write pointer * @half_p: half buffer length behind write_p (event generation) - * @update_needed: flag to indicated change in size requested + * @update_needed: flag to indicate change in size requested * * Note that the first element of all ring buffers must be a * struct iio_buffer. @@ -363,5 +363,5 @@ void iio_sw_rb_free(struct iio_buffer *r) } EXPORT_SYMBOL(iio_sw_rb_free); -MODULE_DESCRIPTION("Industrialio I/O software ring buffer"); +MODULE_DESCRIPTION("Industrial I/O software ring buffer"); MODULE_LICENSE("GPL"); -- cgit v0.10.2 From fb1c4bcd721fcc30d6e43f60a244483dc0d07056 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Fri, 15 Jun 2012 19:25:28 +0200 Subject: iio: iio/events.h typos Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/include/linux/iio/events.h b/include/linux/iio/events.h index b5acbf9..13ce220 100644 --- a/include/linux/iio/events.h +++ b/include/linux/iio/events.h @@ -46,7 +46,7 @@ enum iio_event_direction { * @diff: Whether the event is for an differential channel or not. * @modifier: Modifier for the channel. Should be one of enum iio_modifier. * @direction: Direction of the event. One of enum iio_event_direction. - * @type: Type of the event. Should be one enum iio_event_type. + * @type: Type of the event. Should be one of enum iio_event_type. * @chan: Channel number for non-differential channels. * @chan1: First channel number for differential channels. * @chan2: Second channel number for differential channels. @@ -69,7 +69,7 @@ enum iio_event_direction { * @chan_type: Type of the channel. Should be one of enum iio_chan_type. * @number: Channel number. * @modifier: Modifier for the channel. Should be one of enum iio_modifier. - * @type: Type of the event. Should be one enum iio_event_type. + * @type: Type of the event. Should be one of enum iio_event_type. * @direction: Direction of the event. One of enum iio_event_direction. */ @@ -81,7 +81,7 @@ enum iio_event_direction { * IIO_UNMOD_EVENT_CODE() - create event identifier for unmodified channels * @chan_type: Type of the channel. Should be one of enum iio_chan_type. * @number: Channel number. - * @type: Type of the event. Should be one enum iio_event_type. + * @type: Type of the event. Should be one of enum iio_event_type. * @direction: Direction of the event. One of enum iio_event_direction. */ -- cgit v0.10.2 From aff1eb4e3dd13ee419c6cd76baf1bcc2edeaaa86 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Fri, 15 Jun 2012 18:08:59 +0200 Subject: iio: buffer: Fix NULL pointer deref caused by empty scan mask iio_scan_mask_match() returns NULL if the passed in scan mask is empty. This will happen if no channel has been selected and buffer is enabled. iio_sw_buffer_preenable() will assign NULL to indio_dev->active_scan_mask in this case. As a result iio_update_demux() will cause a NULL pointer deref, because it expects active_scan_mask to be non-NULL. Since it does not make much sense to start data capture if there is no data to capture this patch updates the code to fail gracefully in iio_scan_mask_match() instead of crashing the kernel. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index ac185b8..2f35db9 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -553,6 +553,10 @@ int iio_sw_buffer_preenable(struct iio_dev *indio_dev) buffer->scan_mask); else indio_dev->active_scan_mask = buffer->scan_mask; + + if (indio_dev->active_scan_mask == NULL) + return -EINVAL; + iio_update_demux(indio_dev); if (indio_dev->info->update_scan_mode) -- cgit v0.10.2 From dc348147a9e1ba84395d1e585d26af44f0ca4e29 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 15 Jun 2012 09:18:55 -0700 Subject: staging: comedi: fix Kconfig for COMEDI_PCMCIA_DRIVERS The depends on PCCARD is redundant. All of the comedi PCMCIA drivers depend on PCMCIA which can only be enabled if PCCARD is enabled. Remove the extra depends check. Signed-off-by: H Hartley Sweeten Cc: Frank Mori Hess Tested-by: Ian Abbott Reported-by: Randy Dunlap Acked-by: Randy Dunlap Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 848cf7e..2ca7f08 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -1097,7 +1097,7 @@ endif # COMEDI_PCI_DRIVERS menuconfig COMEDI_PCMCIA_DRIVERS tristate "Comedi PCMCIA drivers" - depends on (PCMCIA || PCCARD) + depends on PCMCIA ---help--- Enable comedi PCMCIA and PCCARD drivers to be built -- cgit v0.10.2 From 4ea418b8b2fa8a70d0fcc8231b65e67b3a72984b Mon Sep 17 00:00:00 2001 From: Christopher Brannon Date: Sat, 16 Jun 2012 16:55:20 -0500 Subject: Staging: speakup: fix an improperly-declared variable. A local static variable was declared as a pointer to a string constant. We're assigning to the underlying memory, so it needs to be an array instead. Signed-off-by: Christopher Brannon Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c index 92b34e2..40e2488 100644 --- a/drivers/staging/speakup/main.c +++ b/drivers/staging/speakup/main.c @@ -1854,7 +1854,7 @@ static void speakup_bits(struct vc_data *vc) static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key) { - static u_char *goto_buf = "\0\0\0\0\0\0"; + static u_char goto_buf[8]; static int num; int maxlen, go_pos; char *cp; -- cgit v0.10.2 From f41ad6675f2d5705a0fc1e210af8eb4a27dbacb4 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Mon, 18 Jun 2012 14:05:34 +0100 Subject: staging: comedi: change device used in dev_...() calls A previous set of patches by Ravishankar Karkala Mallikarjunayya replaced a load of printk() calls with dev_info(), dev_err(), etc. Unfortunately, these used the 'struct device *hw_dev' member of 'struct comedi_device') as the first parameter of these dev_...() calls, but that pointer is usually NULL, so the kernel log messages come out a bit wrong (they contain the phrase "(NULL device *)"). Use the 'struct device *class_dev' member of 'struct comedi_device' instead for these dev_...() calls. It will be non-NULL and somewhat meaningful to users. It's also consistent with those comedi drivers that already use the class_dev member in their dev_...() calls. Some of the messages included the format "comedi%d" with the minor device number used for the "%d". This is now redundant as it will be the same as the dev_name() part of the kernel log message produced by the dev_...() calls. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 60a50ad..94d69e4 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -1347,7 +1347,7 @@ static int pci1710_attach(struct comedi_device *dev, int i; int board_index; - dev_info(dev->hw_dev, "comedi%d: adv_pci1710:\n", dev->minor); + dev_info(dev->class_dev, DRV_NAME ": attach\n"); opt_bus = it->options[0]; opt_slot = it->options[1]; @@ -1399,10 +1399,10 @@ static int pci1710_attach(struct comedi_device *dev, if (!pcidev) { if (opt_bus || opt_slot) { - dev_err(dev->hw_dev, "- Card at b:s %d:%d %s\n", + dev_err(dev->class_dev, "- Card at b:s %d:%d %s\n", opt_bus, opt_slot, errstr); } else { - dev_err(dev->hw_dev, "- Card %s\n", errstr); + dev_err(dev->class_dev, "- Card %s\n", errstr); } return -EIO; } @@ -1413,8 +1413,8 @@ static int pci1710_attach(struct comedi_device *dev, irq = pcidev->irq; iobase = pci_resource_start(pcidev, 2); - dev_dbg(dev->hw_dev, "b:s:f=%d:%d:%d, io=0x%4lx\n", pci_bus, pci_slot, - pci_func, iobase); + dev_dbg(dev->class_dev, "b:s:f=%d:%d:%d, io=0x%4lx\n", + pci_bus, pci_slot, pci_func, iobase); dev->iobase = iobase; @@ -1444,14 +1444,15 @@ static int pci1710_attach(struct comedi_device *dev, if (request_irq(irq, interrupt_service_pci1710, IRQF_SHARED, "Advantech PCI-1710", dev)) { - dev_dbg(dev->hw_dev, "unable to allocate IRQ %d, DISABLING IT", + dev_dbg(dev->class_dev, + "unable to allocate IRQ %d, DISABLING IT", irq); irq = 0; /* Can't use IRQ */ } else { - dev_dbg(dev->hw_dev, "irq=%u", irq); + dev_dbg(dev->class_dev, "irq=%u", irq); } } else { - dev_dbg(dev->hw_dev, "IRQ disabled"); + dev_dbg(dev->class_dev, "IRQ disabled"); } } else { irq = 0; diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 942dc77..176a801 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -1121,16 +1121,18 @@ static int pci_dio_attach(struct comedi_device *dev, } if (!dev->board_ptr) { - dev_err(dev->hw_dev, "Error: Requested type of the card was not found!\n"); + dev_err(dev->class_dev, + "Error: Requested type of the card was not found!\n"); return -EIO; } if (comedi_pci_enable(pcidev, dev->driver->driver_name)) { - dev_err(dev->hw_dev, "Error: Can't enable PCI device and request regions!\n"); + dev_err(dev->class_dev, + "Error: Can't enable PCI device and request regions!\n"); return -EIO; } iobase = pci_resource_start(pcidev, this_board->main_pci_region); - dev_dbg(dev->hw_dev, "b:s:f=%d:%d:%d, io=0x%4lx\n", + dev_dbg(dev->class_dev, "b:s:f=%d:%d:%d, io=0x%4lx\n", pcidev->bus->number, PCI_SLOT(pcidev->devfn), PCI_FUNC(pcidev->devfn), iobase); diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 0310077..77dc880 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -150,7 +150,7 @@ static const struct das16cs_board *das16cs_probe(struct comedi_device *dev, return das16cs_boards + i; } - dev_dbg(dev->hw_dev, "unknown board!\n"); + dev_dbg(dev->class_dev, "unknown board!\n"); return NULL; } @@ -163,18 +163,18 @@ static int das16cs_attach(struct comedi_device *dev, int ret; int i; - dev_dbg(dev->hw_dev, "comedi%d: cb_das16_cs: attached\n", dev->minor); + dev_dbg(dev->class_dev, "cb_das16_cs: attach\n"); link = cur_dev; /* XXX hack */ if (!link) return -EIO; dev->iobase = link->resource[0]->start; - dev_dbg(dev->hw_dev, "I/O base=0x%04lx\n", dev->iobase); + dev_dbg(dev->class_dev, "I/O base=0x%04lx\n", dev->iobase); - dev_dbg(dev->hw_dev, "fingerprint:\n"); + dev_dbg(dev->class_dev, "fingerprint:\n"); for (i = 0; i < 48; i += 2) - dev_dbg(dev->hw_dev, "%04x\n", inw(dev->iobase + i)); + dev_dbg(dev->class_dev, "%04x\n", inw(dev->iobase + i)); ret = request_irq(link->irq, das16cs_interrupt, @@ -184,7 +184,7 @@ static int das16cs_attach(struct comedi_device *dev, dev->irq = link->irq; - dev_dbg(dev->hw_dev, "irq=%u\n", dev->irq); + dev_dbg(dev->class_dev, "irq=%u\n", dev->irq); dev->board_ptr = das16cs_probe(dev, link); if (!dev->board_ptr) @@ -306,7 +306,7 @@ static int das16cs_ai_rinsn(struct comedi_device *dev, break; } if (to == TIMEOUT) { - dev_dbg(dev->hw_dev, "cb_das16_cs: ai timeout\n"); + dev_dbg(dev->class_dev, "cb_das16_cs: ai timeout\n"); return -ETIME; } data[i] = (unsigned short)inw(dev->iobase + 0); diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 2ca3fa0..e2bf222 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -567,12 +567,13 @@ static int cb_pcidas_attach(struct comedi_device *dev, } } - dev_err(dev->hw_dev, "No supported ComputerBoards/MeasurementComputing card found on requested position\n"); + dev_err(dev->class_dev, + "No supported ComputerBoards/MeasurementComputing card found on requested position\n"); return -EIO; found: - dev_dbg(dev->hw_dev, "Found %s on bus %i, slot %i\n", + dev_dbg(dev->class_dev, "Found %s on bus %i, slot %i\n", cb_pcidas_boards[index].name, pcidev->bus->number, PCI_SLOT(pcidev->devfn)); @@ -580,7 +581,8 @@ found: * Enable PCI device and reserve I/O ports. */ if (comedi_pci_enable(pcidev, "cb_pcidas")) { - dev_err(dev->hw_dev, "Failed to enable PCI device and request regions\n"); + dev_err(dev->class_dev, + "Failed to enable PCI device and request regions\n"); return -EIO; } /* @@ -606,7 +608,7 @@ found: /* get irq */ if (request_irq(devpriv->pci_dev->irq, cb_pcidas_interrupt, IRQF_SHARED, "cb_pcidas", dev)) { - dev_dbg(dev->hw_dev, "unable to allocate irq %d\n", + dev_dbg(dev->class_dev, "unable to allocate irq %d\n", devpriv->pci_dev->irq); return -EINVAL; } @@ -807,7 +809,7 @@ static int ai_config_calibration_source(struct comedi_device *dev, unsigned int source = data[1]; if (source >= num_calibration_sources) { - dev_err(dev->hw_dev, "invalid calibration source: %i\n", + dev_err(dev->class_dev, "invalid calibration source: %i\n", source); return -EINVAL; } @@ -1229,7 +1231,7 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, outw(bits, devpriv->control_status + ADCMUX_CONT); #ifdef CB_PCIDAS_DEBUG - dev_dbg(dev->hw_dev, "comedi: sent 0x%x to adcmux control\n", bits); + dev_dbg(dev->class_dev, "sent 0x%x to adcmux control\n", bits); #endif /* load counters */ @@ -1256,7 +1258,7 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, devpriv->adc_fifo_bits |= INT_FHF; /* interrupt fifo half full */ } #ifdef CB_PCIDAS_DEBUG - dev_dbg(dev->hw_dev, "comedi: adc_fifo_bits are 0x%x\n", + dev_dbg(dev->class_dev, "adc_fifo_bits are 0x%x\n", devpriv->adc_fifo_bits); #endif /* enable (and clear) interrupts */ @@ -1283,7 +1285,7 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, bits |= BURSTE; outw(bits, devpriv->control_status + TRIG_CONTSTAT); #ifdef CB_PCIDAS_DEBUG - dev_dbg(dev->hw_dev, "comedi: sent 0x%x to trig control\n", bits); + dev_dbg(dev->class_dev, "sent 0x%x to trig control\n", bits); #endif return 0; @@ -1500,7 +1502,7 @@ static int cb_pcidas_ao_inttrig(struct comedi_device *dev, spin_lock_irqsave(&dev->spinlock, flags); devpriv->adc_fifo_bits |= DAEMIE | DAHFIE; #ifdef CB_PCIDAS_DEBUG - dev_dbg(dev->hw_dev, "comedi: adc_fifo_bits are 0x%x\n", + dev_dbg(dev->class_dev, "adc_fifo_bits are 0x%x\n", devpriv->adc_fifo_bits); #endif /* enable and clear interrupts */ @@ -1511,7 +1513,7 @@ static int cb_pcidas_ao_inttrig(struct comedi_device *dev, devpriv->ao_control_bits |= DAC_START | DACEN | DAC_EMPTY; outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR); #ifdef CB_PCIDAS_DEBUG - dev_dbg(dev->hw_dev, "comedi: sent 0x%x to dac control\n", + dev_dbg(dev->class_dev, "sent 0x%x to dac control\n", devpriv->ao_control_bits); #endif spin_unlock_irqrestore(&dev->spinlock, flags); @@ -1540,8 +1542,8 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d) s5933_status = inl(devpriv->s5933_config + AMCC_OP_REG_INTCSR); #ifdef CB_PCIDAS_DEBUG - dev_dbg(dev->hw_dev, "intcsr 0x%x\n", s5933_status); - dev_dbg(dev->hw_dev, "mbef 0x%x\n", + dev_dbg(dev->class_dev, "intcsr 0x%x\n", s5933_status); + dev_dbg(dev->class_dev, "mbef 0x%x\n", inl(devpriv->s5933_config + AMCC_OP_REG_MBEF)); #endif diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 3aab75b..7aacff3 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -1701,11 +1701,12 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it) return -EIO; } - dev_dbg(dev->hw_dev, "Found %s on bus %i, slot %i\n", board(dev)->name, - pcidev->bus->number, PCI_SLOT(pcidev->devfn)); + dev_dbg(dev->class_dev, "Found %s on bus %i, slot %i\n", + board(dev)->name, pcidev->bus->number, PCI_SLOT(pcidev->devfn)); if (comedi_pci_enable(pcidev, dev->driver->driver_name)) { - dev_warn(dev->hw_dev, "failed to enable PCI device and request regions\n"); + dev_warn(dev->class_dev, + "failed to enable PCI device and request regions\n"); return -EIO; } pci_set_master(pcidev); @@ -1733,7 +1734,7 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it) if (!priv(dev)->plx9080_iobase || !priv(dev)->main_iobase || !priv(dev)->dio_counter_iobase) { - dev_warn(dev->hw_dev, "failed to remap io memory\n"); + dev_warn(dev->class_dev, "failed to remap io memory\n"); return -ENOMEM; } @@ -1769,19 +1770,19 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it) priv(dev)->hw_revision = hw_revision(dev, readw(priv(dev)->main_iobase + HW_STATUS_REG)); - dev_dbg(dev->hw_dev, "stc hardware revision %i\n", + dev_dbg(dev->class_dev, "stc hardware revision %i\n", priv(dev)->hw_revision); init_plx9080(dev); init_stc_registers(dev); /* get irq */ if (request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED, "cb_pcidas64", dev)) { - dev_dbg(dev->hw_dev, "unable to allocate irq %u\n", + dev_dbg(dev->class_dev, "unable to allocate irq %u\n", pcidev->irq); return -EINVAL; } dev->irq = pcidev->irq; - dev_dbg(dev->hw_dev, "irq %u\n", dev->irq); + dev_dbg(dev->class_dev, "irq %u\n", dev->irq); retval = setup_subdevices(dev); if (retval < 0) @@ -2002,7 +2003,7 @@ static int ai_config_calibration_source(struct comedi_device *dev, else num_calibration_sources = 8; if (source >= num_calibration_sources) { - dev_dbg(dev->hw_dev, "invalid calibration source: %i\n", + dev_dbg(dev->class_dev, "invalid calibration source: %i\n", source); return -EINVAL; } @@ -2834,7 +2835,8 @@ static void pio_drain_ai_fifo_16(struct comedi_device *dev) } if (num_samples < 0) { - dev_err(dev->hw_dev, "cb_pcidas64: bug! num_samples < 0\n"); + dev_err(dev->class_dev, + "cb_pcidas64: bug! num_samples < 0\n"); break; } diff --git a/drivers/staging/comedi/drivers/cb_pcidda.c b/drivers/staging/comedi/drivers/cb_pcidda.c index 0572dc6..f5a7957 100644 --- a/drivers/staging/comedi/drivers/cb_pcidda.c +++ b/drivers/staging/comedi/drivers/cb_pcidda.c @@ -294,21 +294,23 @@ static int cb_pcidda_attach(struct comedi_device *dev, } } if (!pcidev) { - dev_err(dev->hw_dev, "Not a ComputerBoards/MeasurementComputing card on requested position\n"); + dev_err(dev->class_dev, + "Not a ComputerBoards/MeasurementComputing card on requested position\n"); return -EIO; } found: devpriv->pci_dev = pcidev; dev->board_ptr = cb_pcidda_boards + index; /* "thisboard" macro can be used from here. */ - dev_dbg(dev->hw_dev, "Found %s at requested position\n", + dev_dbg(dev->class_dev, "Found %s at requested position\n", thisboard->name); /* * Enable PCI device and request regions. */ if (comedi_pci_enable(pcidev, thisboard->name)) { - dev_err(dev->hw_dev, "cb_pcidda: failed to enable PCI device and request regions\n"); + dev_err(dev->class_dev, + "cb_pcidda: failed to enable PCI device and request regions\n"); return -EIO; } @@ -356,10 +358,10 @@ found: s = dev->subdevices + 2; subdev_8255_init(dev, s, NULL, devpriv->digitalio + PORT2A); - dev_dbg(dev->hw_dev, "eeprom:\n"); + dev_dbg(dev->class_dev, "eeprom:\n"); for (index = 0; index < EEPROM_SIZE; index++) { devpriv->eeprom_data[index] = cb_pcidda_read_eeprom(dev, index); - dev_dbg(dev->hw_dev, "%i:0x%x\n", index, + dev_dbg(dev->class_dev, "%i:0x%x\n", index, devpriv->eeprom_data[index]); } diff --git a/drivers/staging/comedi/drivers/cb_pcidio.c b/drivers/staging/comedi/drivers/cb_pcidio.c index 0186737..9160859 100644 --- a/drivers/staging/comedi/drivers/cb_pcidio.c +++ b/drivers/staging/comedi/drivers/cb_pcidio.c @@ -155,7 +155,8 @@ static int pcidio_attach(struct comedi_device *dev, struct comedi_devconfig *it) } } - dev_err(dev->hw_dev, "No supported ComputerBoards/MeasurementComputing card found on requested position\n"); + dev_err(dev->class_dev, + "No supported ComputerBoards/MeasurementComputing card found on requested position\n"); return -EIO; found: @@ -167,8 +168,8 @@ found: dev->board_name = thisboard->name; devpriv->pci_dev = pcidev; - dev_dbg(dev->hw_dev, "Found %s on bus %i, slot %i\n", thisboard->name, - devpriv->pci_dev->bus->number, + dev_dbg(dev->class_dev, "Found %s on bus %i, slot %i\n", + thisboard->name, devpriv->pci_dev->bus->number, PCI_SLOT(devpriv->pci_dev->devfn)); if (comedi_pci_enable(pcidev, thisboard->name)) return -EIO; @@ -185,7 +186,7 @@ found: for (i = 0; i < thisboard->n_8255; i++) { subdev_8255_init(dev, dev->subdevices + i, NULL, devpriv->dio_reg_base + i * 4); - dev_dbg(dev->hw_dev, "subdev %d: base = 0x%lx\n", i, + dev_dbg(dev->class_dev, "subdev %d: base = 0x%lx\n", i, devpriv->dio_reg_base + i * 4); } diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index b99a451..2977f2d 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -223,12 +223,13 @@ static int cb_pcimdas_attach(struct comedi_device *dev, } } - dev_err(dev->hw_dev, "No supported ComputerBoards/MeasurementComputing card found on requested position\n"); + dev_err(dev->class_dev, + "No supported ComputerBoards/MeasurementComputing card found on requested position\n"); return -EIO; found: - dev_dbg(dev->hw_dev, "Found %s on bus %i, slot %i\n", + dev_dbg(dev->class_dev, "Found %s on bus %i, slot %i\n", cb_pcimdas_boards[index].name, pcidev->bus->number, PCI_SLOT(pcidev->devfn)); @@ -237,12 +238,14 @@ found: case 0x56: break; default: - dev_dbg(dev->hw_dev, "THIS CARD IS UNSUPPORTED.\n" + dev_dbg(dev->class_dev, "THIS CARD IS UNSUPPORTED.\n"); + dev_dbg(dev->class_dev, "PLEASE REPORT USAGE TO \n"); } if (comedi_pci_enable(pcidev, "cb_pcimdas")) { - dev_err(dev->hw_dev, "Failed to enable PCI device and request regions\n"); + dev_err(dev->class_dev, + "Failed to enable PCI device and request regions\n"); return -EIO; } @@ -252,11 +255,11 @@ found: devpriv->BADR3 = pci_resource_start(devpriv->pci_dev, 3); devpriv->BADR4 = pci_resource_start(devpriv->pci_dev, 4); - dev_dbg(dev->hw_dev, "devpriv->BADR0 = 0x%lx\n", devpriv->BADR0); - dev_dbg(dev->hw_dev, "devpriv->BADR1 = 0x%lx\n", devpriv->BADR1); - dev_dbg(dev->hw_dev, "devpriv->BADR2 = 0x%lx\n", devpriv->BADR2); - dev_dbg(dev->hw_dev, "devpriv->BADR3 = 0x%lx\n", devpriv->BADR3); - dev_dbg(dev->hw_dev, "devpriv->BADR4 = 0x%lx\n", devpriv->BADR4); + dev_dbg(dev->class_dev, "devpriv->BADR0 = 0x%lx\n", devpriv->BADR0); + dev_dbg(dev->class_dev, "devpriv->BADR1 = 0x%lx\n", devpriv->BADR1); + dev_dbg(dev->class_dev, "devpriv->BADR2 = 0x%lx\n", devpriv->BADR2); + dev_dbg(dev->class_dev, "devpriv->BADR3 = 0x%lx\n", devpriv->BADR3); + dev_dbg(dev->class_dev, "devpriv->BADR4 = 0x%lx\n", devpriv->BADR4); /* Dont support IRQ yet */ /* get irq */ diff --git a/drivers/staging/comedi/drivers/contec_pci_dio.c b/drivers/staging/comedi/drivers/contec_pci_dio.c index 79854b1..d49561f 100644 --- a/drivers/staging/comedi/drivers/contec_pci_dio.c +++ b/drivers/staging/comedi/drivers/contec_pci_dio.c @@ -71,8 +71,8 @@ static int contec_do_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - dev_dbg(dev->hw_dev, "contec_do_insn_bits called\n"); - dev_dbg(dev->hw_dev, "data: %d %d\n", data[0], data[1]); + dev_dbg(dev->class_dev, "contec_do_insn_bits called\n"); + dev_dbg(dev->class_dev, "data: %d %d\n", data[0], data[1]); if (insn->n != 2) return -EINVAL; @@ -80,7 +80,7 @@ static int contec_do_insn_bits(struct comedi_device *dev, if (data[0]) { s->state &= ~data[0]; s->state |= data[0] & data[1]; - dev_dbg(dev->hw_dev, "out: %d on %lx\n", s->state, + dev_dbg(dev->class_dev, "out: %d on %lx\n", s->state, dev->iobase + thisboard->out_offs); outw(s->state, dev->iobase + thisboard->out_offs); } @@ -92,8 +92,8 @@ static int contec_di_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - dev_dbg(dev->hw_dev, "contec_di_insn_bits called\n"); - dev_dbg(dev->hw_dev, "data: %d %d\n", data[0], data[1]); + dev_dbg(dev->class_dev, "contec_di_insn_bits called\n"); + dev_dbg(dev->class_dev, "data: %d %d\n", data[0], data[1]); if (insn->n != 2) return -EINVAL; diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c index 9ecf1a4..8455cb9 100644 --- a/drivers/staging/comedi/drivers/daqboard2000.c +++ b/drivers/staging/comedi/drivers/daqboard2000.c @@ -485,7 +485,7 @@ static int daqboard2000_ao_insn_write(struct comedi_device *dev, static void daqboard2000_resetLocalBus(struct comedi_device *dev) { - dev_dbg(dev->hw_dev, "daqboard2000_resetLocalBus\n"); + dev_dbg(dev->class_dev, "daqboard2000_resetLocalBus\n"); writel(DAQBOARD2000_SECRLocalBusHi, devpriv->plx + 0x6c); udelay(10000); writel(DAQBOARD2000_SECRLocalBusLo, devpriv->plx + 0x6c); @@ -494,7 +494,7 @@ static void daqboard2000_resetLocalBus(struct comedi_device *dev) static void daqboard2000_reloadPLX(struct comedi_device *dev) { - dev_dbg(dev->hw_dev, "daqboard2000_reloadPLX\n"); + dev_dbg(dev->class_dev, "daqboard2000_reloadPLX\n"); writel(DAQBOARD2000_SECRReloadLo, devpriv->plx + 0x6c); udelay(10000); writel(DAQBOARD2000_SECRReloadHi, devpriv->plx + 0x6c); @@ -505,7 +505,7 @@ static void daqboard2000_reloadPLX(struct comedi_device *dev) static void daqboard2000_pulseProgPin(struct comedi_device *dev) { - dev_dbg(dev->hw_dev, "daqboard2000_pulseProgPin 1\n"); + dev_dbg(dev->class_dev, "daqboard2000_pulseProgPin 1\n"); writel(DAQBOARD2000_SECRProgPinHi, devpriv->plx + 0x6c); udelay(10000); writel(DAQBOARD2000_SECRProgPinLo, devpriv->plx + 0x6c); @@ -557,14 +557,14 @@ static int initialize_daqboard2000(struct comedi_device *dev, secr = readl(devpriv->plx + 0x6c); if (!(secr & DAQBOARD2000_EEPROM_PRESENT)) { #ifdef DEBUG_EEPROM - dev_dbg(dev->hw_dev, "no serial eeprom\n"); + dev_dbg(dev->class_dev, "no serial eeprom\n"); #endif return -EIO; } for (retry = 0; retry < 3; retry++) { #ifdef DEBUG_EEPROM - dev_dbg(dev->hw_dev, "Programming EEPROM try %x\n", retry); + dev_dbg(dev->class_dev, "Programming EEPROM try %x\n", retry); #endif daqboard2000_resetLocalBus(dev); @@ -575,8 +575,8 @@ static int initialize_daqboard2000(struct comedi_device *dev, if (cpld_array[i] == 0xff && cpld_array[i + 1] == 0x20) { #ifdef DEBUG_EEPROM - dev_dbg(dev->hw_dev, "Preamble found at %d\n", - i); + dev_dbg(dev->class_dev, + "Preamble found at %d\n", i); #endif break; } @@ -589,7 +589,7 @@ static int initialize_daqboard2000(struct comedi_device *dev, } if (i >= len) { #ifdef DEBUG_EEPROM - dev_dbg(dev->hw_dev, "Programmed\n"); + dev_dbg(dev->class_dev, "Programmed\n"); #endif daqboard2000_resetLocalBus(dev); daqboard2000_reloadPLX(dev); @@ -733,10 +733,11 @@ static int daqboard2000_attach(struct comedi_device *dev, } if (!card) { if (bus || slot) - dev_err(dev->hw_dev, "no daqboard2000 found at bus/slot: %d/%d\n", + dev_err(dev->class_dev, + "no daqboard2000 found at bus/slot: %d/%d\n", bus, slot); else - dev_err(dev->hw_dev, "no daqboard2000 found\n"); + dev_err(dev->class_dev, "no daqboard2000 found\n"); return -EIO; } else { u32 id; @@ -746,7 +747,7 @@ static int daqboard2000_attach(struct comedi_device *dev, subsystem_device << 16) | card->subsystem_vendor; for (i = 0; i < ARRAY_SIZE(boardtypes); i++) { if (boardtypes[i].id == id) { - dev_dbg(dev->hw_dev, "%s\n", + dev_dbg(dev->class_dev, "%s\n", boardtypes[i].name); dev->board_ptr = boardtypes + i; } @@ -761,7 +762,8 @@ static int daqboard2000_attach(struct comedi_device *dev, result = comedi_pci_enable(card, "daqboard2000"); if (result < 0) { - dev_err(dev->hw_dev, "failed to enable PCI device and request regions\n"); + dev_err(dev->class_dev, + "failed to enable PCI device and request regions\n"); return -EIO; } devpriv->got_regions = 1; @@ -791,7 +793,8 @@ static int daqboard2000_attach(struct comedi_device *dev, if (aux_data && aux_len) { result = initialize_daqboard2000(dev, aux_data, aux_len); } else { - dev_dbg(dev->hw_dev, "no FPGA initialization code, aborting\n"); + dev_dbg(dev->class_dev, + "no FPGA initialization code, aborting\n"); result = -EIO; } if (result < 0) diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index 4ad398a..8bf6ec2 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -79,17 +79,18 @@ static int das08_cs_attach(struct comedi_device *dev, if (ret < 0) return ret; - dev_info(dev->hw_dev, "comedi%d: das08_cs:\n", dev->minor); + dev_info(dev->class_dev, "das08_cs: attach\n"); /* deal with a pci board */ if (thisboard->bustype == pcmcia) { if (link == NULL) { - dev_err(dev->hw_dev, "no pcmcia cards found\n"); + dev_err(dev->class_dev, "no pcmcia cards found\n"); return -EIO; } iobase = link->resource[0]->start; } else { - dev_err(dev->hw_dev, "bug! board does not have PCMCIA bustype\n"); + dev_err(dev->class_dev, + "bug! board does not have PCMCIA bustype\n"); return -EINVAL; } diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c index af60e5d..3650287 100644 --- a/drivers/staging/comedi/drivers/das1800.c +++ b/drivers/staging/comedi/drivers/das1800.c @@ -1405,22 +1405,26 @@ static int das1800_init_dma(struct comedi_device *dev, unsigned int dma0, devpriv->dma_bits |= DMA_CH7_CH5; break; default: - dev_err(dev->hw_dev, " only supports dma channels 5 through 7\n" - " Dual dma only allows the following combinations:\n" - " dma 5,6 / 6,7 / or 7,5\n"); + dev_err(dev->class_dev, + "only supports dma channels 5 through 7\n"); + dev_err(dev->class_dev, + "Dual dma only allows the following combinations:\n"); + dev_err(dev->class_dev, + "dma 5,6 / 6,7 / or 7,5\n"); return -EINVAL; break; } if (request_dma(dma0, dev->driver->driver_name)) { - dev_err(dev->hw_dev, "failed to allocate dma channel %i\n", - dma0); + dev_err(dev->class_dev, + "failed to allocate dma channel %i\n", dma0); return -EINVAL; } devpriv->dma0 = dma0; devpriv->dma_current = dma0; if (dma1) { if (request_dma(dma1, dev->driver->driver_name)) { - dev_err(dev->hw_dev, "failed to allocate dma channel %i\n", + dev_err(dev->class_dev, + "failed to allocate dma channel %i\n", dma1); return -EINVAL; } @@ -1460,7 +1464,7 @@ static int das1800_probe(struct comedi_device *dev) case 0x3: if (board == das1801st_da || board == das1802st_da || board == das1701st_da || board == das1702st_da) { - dev_dbg(dev->hw_dev, "Board model: %s\n", + dev_dbg(dev->class_dev, "Board model: %s\n", das1800_boards[board].name); return board; } @@ -1470,7 +1474,7 @@ static int das1800_probe(struct comedi_device *dev) break; case 0x4: if (board == das1802hr_da || board == das1702hr_da) { - dev_dbg(dev->hw_dev, "Board model: %s\n", + dev_dbg(dev->class_dev, "Board model: %s\n", das1800_boards[board].name); return board; } @@ -1481,7 +1485,7 @@ static int das1800_probe(struct comedi_device *dev) case 0x5: if (board == das1801ao || board == das1802ao || board == das1701ao || board == das1702ao) { - dev_dbg(dev->hw_dev, "Board model: %s\n", + dev_dbg(dev->class_dev, "Board model: %s\n", das1800_boards[board].name); return board; } @@ -1491,7 +1495,7 @@ static int das1800_probe(struct comedi_device *dev) break; case 0x6: if (board == das1802hr || board == das1702hr) { - dev_dbg(dev->hw_dev, "Board model: %s\n", + dev_dbg(dev->class_dev, "Board model: %s\n", das1800_boards[board].name); return board; } @@ -1502,7 +1506,7 @@ static int das1800_probe(struct comedi_device *dev) case 0x7: if (board == das1801st || board == das1802st || board == das1701st || board == das1702st) { - dev_dbg(dev->hw_dev, "Board model: %s\n", + dev_dbg(dev->class_dev, "Board model: %s\n", das1800_boards[board].name); return board; } @@ -1512,7 +1516,7 @@ static int das1800_probe(struct comedi_device *dev) break; case 0x8: if (board == das1801hc || board == das1802hc) { - dev_dbg(dev->hw_dev, "Board model: %s\n", + dev_dbg(dev->class_dev, "Board model: %s\n", das1800_boards[board].name); return board; } @@ -1559,7 +1563,7 @@ static int das1800_attach(struct comedi_device *dev, printk(KERN_CONT "\n"); if (iobase == 0) { - dev_err(dev->hw_dev, "io base address required\n"); + dev_err(dev->class_dev, "io base address required\n"); return -EINVAL; } @@ -1574,7 +1578,7 @@ static int das1800_attach(struct comedi_device *dev, board = das1800_probe(dev); if (board < 0) { - dev_err(dev->hw_dev, "unable to determine board type\n"); + dev_err(dev->class_dev, "unable to determine board type\n"); return -ENODEV; } @@ -1598,7 +1602,7 @@ static int das1800_attach(struct comedi_device *dev, if (irq) { if (request_irq(irq, das1800_interrupt, 0, dev->driver->driver_name, dev)) { - dev_dbg(dev->hw_dev, "unable to allocate irq %u\n", + dev_dbg(dev->class_dev, "unable to allocate irq %u\n", irq); return -EINVAL; } @@ -1628,7 +1632,7 @@ static int das1800_attach(struct comedi_device *dev, devpriv->irq_dma_bits |= 0x38; break; default: - dev_err(dev->hw_dev, "irq out of range\n"); + dev_err(dev->class_dev, "irq out of range\n"); return -EINVAL; break; } diff --git a/drivers/staging/comedi/drivers/das6402.c b/drivers/staging/comedi/drivers/das6402.c index 22a9b34..e3afcfa 100644 --- a/drivers/staging/comedi/drivers/das6402.c +++ b/drivers/staging/comedi/drivers/das6402.c @@ -155,7 +155,7 @@ static irqreturn_t intr_handler(int irq, void *d) struct comedi_subdevice *s = dev->subdevices; if (!dev->attached || devpriv->das6402_ignoreirq) { - dev_warn(dev->hw_dev, "BUG: spurious interrupt\n"); + dev_warn(dev->class_dev, "BUG: spurious interrupt\n"); return IRQ_HANDLED; } #ifdef DEBUG @@ -202,7 +202,7 @@ static int das6402_ai_cancel(struct comedi_device *dev, */ devpriv->das6402_ignoreirq = 1; - dev_dbg(dev->hw_dev, "Stopping acquisition\n"); + dev_dbg(dev->class_dev, "Stopping acquisition\n"); devpriv->das6402_ignoreirq = 1; outb_p(0x02, dev->iobase + 10); /* disable external trigging */ outw_p(SCANL, dev->iobase + 2); /* resets the card fifo */ @@ -218,7 +218,7 @@ static int das6402_ai_mode2(struct comedi_device *dev, struct comedi_subdevice *s, comedi_trig * it) { devpriv->das6402_ignoreirq = 1; - dev_dbg(dev->hw_dev, "Starting acquisition\n"); + dev_dbg(dev->class_dev, "Starting acquisition\n"); outb_p(0x03, dev->iobase + 10); /* enable external trigging */ outw_p(SCANL, dev->iobase + 2); /* resets the card fifo */ outb_p(IRQ | CONVSRC | BURSTEN | INTE, dev->iobase + 9); @@ -289,7 +289,7 @@ static int das6402_attach(struct comedi_device *dev, iobase = 0x300; if (!request_region(iobase, DAS6402_SIZE, "das6402")) { - dev_err(dev->hw_dev, "I/O port conflict\n"); + dev_err(dev->class_dev, "I/O port conflict\n"); return -EIO; } dev->iobase = iobase; @@ -297,7 +297,7 @@ static int das6402_attach(struct comedi_device *dev, /* should do a probe here */ irq = it->options[0]; - dev_dbg(dev->hw_dev, "( irq = %u )\n", irq); + dev_dbg(dev->class_dev, "( irq = %u )\n", irq); ret = request_irq(irq, intr_handler, 0, "das6402", dev); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/das800.c b/drivers/staging/comedi/drivers/das800.c index 81698b1..917b318 100644 --- a/drivers/staging/comedi/drivers/das800.c +++ b/drivers/staging/comedi/drivers/das800.c @@ -296,46 +296,47 @@ static int das800_probe(struct comedi_device *dev) switch (id_bits) { case 0x0: if (board == das800) { - dev_dbg(dev->hw_dev, "Board model: DAS-800\n"); + dev_dbg(dev->class_dev, "Board model: DAS-800\n"); return board; } if (board == ciodas800) { - dev_dbg(dev->hw_dev, "Board model: CIO-DAS800\n"); + dev_dbg(dev->class_dev, "Board model: CIO-DAS800\n"); return board; } - dev_dbg(dev->hw_dev, "Board model (probed): DAS-800\n"); + dev_dbg(dev->class_dev, "Board model (probed): DAS-800\n"); return das800; break; case 0x2: if (board == das801) { - dev_dbg(dev->hw_dev, "Board model: DAS-801\n"); + dev_dbg(dev->class_dev, "Board model: DAS-801\n"); return board; } if (board == ciodas801) { - dev_dbg(dev->hw_dev, "Board model: CIO-DAS801\n"); + dev_dbg(dev->class_dev, "Board model: CIO-DAS801\n"); return board; } - dev_dbg(dev->hw_dev, "Board model (probed): DAS-801\n"); + dev_dbg(dev->class_dev, "Board model (probed): DAS-801\n"); return das801; break; case 0x3: if (board == das802) { - dev_dbg(dev->hw_dev, "Board model: DAS-802\n"); + dev_dbg(dev->class_dev, "Board model: DAS-802\n"); return board; } if (board == ciodas802) { - dev_dbg(dev->hw_dev, "Board model: CIO-DAS802\n"); + dev_dbg(dev->class_dev, "Board model: CIO-DAS802\n"); return board; } if (board == ciodas80216) { - dev_dbg(dev->hw_dev, "Board model: CIO-DAS802/16\n"); + dev_dbg(dev->class_dev, "Board model: CIO-DAS802/16\n"); return board; } - dev_dbg(dev->hw_dev, "Board model (probed): DAS-802\n"); + dev_dbg(dev->class_dev, "Board model (probed): DAS-802\n"); return das802; break; default: - dev_dbg(dev->hw_dev, "Board model: probe returned 0x%x (unknown)\n", + dev_dbg(dev->class_dev, + "Board model: probe returned 0x%x (unknown)\n", id_bits); return board; break; @@ -467,42 +468,42 @@ static int das800_attach(struct comedi_device *dev, struct comedi_devconfig *it) int board; int ret; - dev_info(dev->hw_dev, "comedi%d: das800: io 0x%lx\n", dev->minor, - iobase); + dev_info(dev->class_dev, "das800: io 0x%lx\n", iobase); if (irq) - dev_dbg(dev->hw_dev, "irq %u\n", irq); + dev_dbg(dev->class_dev, "irq %u\n", irq); /* allocate and initialize dev->private */ if (alloc_private(dev, sizeof(struct das800_private)) < 0) return -ENOMEM; if (iobase == 0) { - dev_err(dev->hw_dev, "io base address required for das800\n"); + dev_err(dev->class_dev, + "io base address required for das800\n"); return -EINVAL; } /* check if io addresses are available */ if (!request_region(iobase, DAS800_SIZE, "das800")) { - dev_err(dev->hw_dev, "I/O port conflict\n"); + dev_err(dev->class_dev, "I/O port conflict\n"); return -EIO; } dev->iobase = iobase; board = das800_probe(dev); if (board < 0) { - dev_dbg(dev->hw_dev, "unable to determine board type\n"); + dev_dbg(dev->class_dev, "unable to determine board type\n"); return -ENODEV; } dev->board_ptr = das800_boards + board; /* grab our IRQ */ if (irq == 1 || irq > 7) { - dev_err(dev->hw_dev, "irq out of range\n"); + dev_err(dev->class_dev, "irq out of range\n"); return -EINVAL; } if (irq) { if (request_irq(irq, das800_interrupt, 0, "das800", dev)) { - dev_err(dev->hw_dev, "unable to allocate irq %u\n", + dev_err(dev->class_dev, "unable to allocate irq %u\n", irq); return -EINVAL; } diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c index 9828fb1..31a16ed 100644 --- a/drivers/staging/comedi/drivers/dt3000.c +++ b/drivers/staging/comedi/drivers/dt3000.c @@ -289,7 +289,7 @@ static int dt3k_send_cmd(struct comedi_device *dev, unsigned int cmd) if ((status & DT3000_COMPLETION_MASK) == DT3000_NOERROR) return 0; - dev_dbg(dev->hw_dev, "dt3k_send_cmd() timeout/error status=0x%04x\n", + dev_dbg(dev->class_dev, "dt3k_send_cmd() timeout/error status=0x%04x\n", status); return -ETIME; @@ -390,7 +390,7 @@ static void dt3k_ai_empty_fifo(struct comedi_device *dev, if (count < 0) count += AI_FIFO_DEPTH; - dev_dbg(dev->hw_dev, "reading %d samples\n", count); + dev_dbg(dev->class_dev, "reading %d samples\n", count); rear = devpriv->ai_rear; @@ -578,7 +578,7 @@ static int dt3k_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) int ret; unsigned int mode; - dev_dbg(dev->hw_dev, "dt3k_ai_cmd:\n"); + dev_dbg(dev->class_dev, "dt3k_ai_cmd:\n"); for (i = 0; i < cmd->chanlist_len; i++) { chan = CR_CHAN(cmd->chanlist[i]); range = CR_RANGE(cmd->chanlist[i]); @@ -589,15 +589,15 @@ static int dt3k_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) aref = CR_AREF(cmd->chanlist[0]); writew(cmd->scan_end_arg, devpriv->io_addr + DPR_Params(0)); - dev_dbg(dev->hw_dev, "param[0]=0x%04x\n", cmd->scan_end_arg); + dev_dbg(dev->class_dev, "param[0]=0x%04x\n", cmd->scan_end_arg); if (cmd->convert_src == TRIG_TIMER) { divider = dt3k_ns_to_timer(50, &cmd->convert_arg, cmd->flags & TRIG_ROUND_MASK); writew((divider >> 16), devpriv->io_addr + DPR_Params(1)); - dev_dbg(dev->hw_dev, "param[1]=0x%04x\n", divider >> 16); + dev_dbg(dev->class_dev, "param[1]=0x%04x\n", divider >> 16); writew((divider & 0xffff), devpriv->io_addr + DPR_Params(2)); - dev_dbg(dev->hw_dev, "param[2]=0x%04x\n", divider & 0xffff); + dev_dbg(dev->class_dev, "param[2]=0x%04x\n", divider & 0xffff); } else { /* not supported */ } @@ -606,21 +606,21 @@ static int dt3k_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) tscandiv = dt3k_ns_to_timer(100, &cmd->scan_begin_arg, cmd->flags & TRIG_ROUND_MASK); writew((tscandiv >> 16), devpriv->io_addr + DPR_Params(3)); - dev_dbg(dev->hw_dev, "param[3]=0x%04x\n", tscandiv >> 16); + dev_dbg(dev->class_dev, "param[3]=0x%04x\n", tscandiv >> 16); writew((tscandiv & 0xffff), devpriv->io_addr + DPR_Params(4)); - dev_dbg(dev->hw_dev, "param[4]=0x%04x\n", tscandiv & 0xffff); + dev_dbg(dev->class_dev, "param[4]=0x%04x\n", tscandiv & 0xffff); } else { /* not supported */ } mode = DT3000_AD_RETRIG_INTERNAL | 0 | 0; writew(mode, devpriv->io_addr + DPR_Params(5)); - dev_dbg(dev->hw_dev, "param[5]=0x%04x\n", mode); + dev_dbg(dev->class_dev, "param[5]=0x%04x\n", mode); writew(aref == AREF_DIFF, devpriv->io_addr + DPR_Params(6)); - dev_dbg(dev->hw_dev, "param[6]=0x%04x\n", aref == AREF_DIFF); + dev_dbg(dev->class_dev, "param[6]=0x%04x\n", aref == AREF_DIFF); writew(AI_FIFO_DEPTH / 2, devpriv->io_addr + DPR_Params(7)); - dev_dbg(dev->hw_dev, "param[7]=0x%04x\n", AI_FIFO_DEPTH / 2); + dev_dbg(dev->class_dev, "param[7]=0x%04x\n", AI_FIFO_DEPTH / 2); writew(SUBS_AI, devpriv->io_addr + DPR_SubSys); ret = dt3k_send_cmd(dev, CMD_CONFIG); @@ -856,7 +856,7 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it) int bus, slot; int ret = 0; - dev_dbg(dev->hw_dev, "dt3000:\n"); + dev_dbg(dev->class_dev, "dt3000:\n"); bus = it->options[0]; slot = it->options[1]; @@ -868,7 +868,7 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (ret < 0) return ret; if (ret == 0) { - dev_warn(dev->hw_dev, "no DT board found\n"); + dev_warn(dev->class_dev, "no DT board found\n"); return -ENODEV; } @@ -876,7 +876,7 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (request_irq(devpriv->pci_dev->irq, dt3k_interrupt, IRQF_SHARED, "dt3000", dev)) { - dev_err(dev->hw_dev, "unable to allocate IRQ %u\n", + dev_err(dev->class_dev, "unable to allocate IRQ %u\n", devpriv->pci_dev->irq); return -EINVAL; } diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c index 3c043e5..93f94cd 100644 --- a/drivers/staging/comedi/drivers/jr3_pci.c +++ b/drivers/staging/comedi/drivers/jr3_pci.c @@ -349,13 +349,13 @@ static int jr3_pci_open(struct comedi_device *dev) int i; struct jr3_pci_dev_private *devpriv = dev->private; - dev_dbg(dev->hw_dev, "jr3_pci_open\n"); + dev_dbg(dev->class_dev, "jr3_pci_open\n"); for (i = 0; i < devpriv->n_channels; i++) { struct jr3_pci_subdev_private *p; p = dev->subdevices[i].private; if (p) { - dev_dbg(dev->hw_dev, "serial: %p %d (%d)\n", p, + dev_dbg(dev->class_dev, "serial: %p %d (%d)\n", p, p->serial_no, p->channel_no); } } @@ -434,7 +434,8 @@ static int jr3_download_firmware(struct comedi_device *dev, const u8 * data, break; more = more && read_idm_word(data, size, &pos, &addr); - dev_dbg(dev->hw_dev, "Loading#%d %4.4x bytes at %4.4x\n", + dev_dbg(dev->class_dev, + "Loading#%d %4.4x bytes at %4.4x\n", i, count, addr); while (more && count > 0) { if (addr & 0x4000) { @@ -754,7 +755,8 @@ static int jr3_pci_attach(struct comedi_device *dev, opt_slot = it->options[1]; if (sizeof(struct jr3_channel) != 0xc00) { - dev_err(dev->hw_dev, "sizeof(struct jr3_channel) = %x [expected %x]\n", + dev_err(dev->class_dev, + "sizeof(struct jr3_channel) = %x [expected %x]\n", (unsigned)sizeof(struct jr3_channel), 0xc00); return -EINVAL; } @@ -809,7 +811,7 @@ static int jr3_pci_attach(struct comedi_device *dev, } } if (!card) { - dev_err(dev->hw_dev, "no jr3_pci found\n"); + dev_err(dev->class_dev, "no jr3_pci found\n"); return -EIO; } else { devpriv->pci_dev = card; @@ -844,7 +846,7 @@ static int jr3_pci_attach(struct comedi_device *dev, p = dev->subdevices[i].private; p->channel = &devpriv->iobase->channel[i].data; - dev_dbg(dev->hw_dev, "p->channel %p %p (%tx)\n", + dev_dbg(dev->class_dev, "p->channel %p %p (%tx)\n", p->channel, devpriv->iobase, ((char *)(p->channel) - (char *)(devpriv->iobase))); @@ -885,7 +887,7 @@ static int jr3_pci_attach(struct comedi_device *dev, devpriv->iobase->channel[0].reset = 0; result = comedi_load_firmware(dev, "jr3pci.idm", jr3_download_firmware); - dev_dbg(dev->hw_dev, "Firmare load %d\n", result); + dev_dbg(dev->class_dev, "Firmare load %d\n", result); if (result < 0) goto out; @@ -903,7 +905,7 @@ static int jr3_pci_attach(struct comedi_device *dev, */ msleep_interruptible(25); for (i = 0; i < 0x18; i++) { - dev_dbg(dev->hw_dev, "%c\n", + dev_dbg(dev->class_dev, "%c\n", get_u16(&devpriv->iobase->channel[0]. data.copyright[i]) >> 8); } diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c index 3974c0d..89f4d43 100644 --- a/drivers/staging/comedi/drivers/ni_pcimio.c +++ b/drivers/staging/comedi/drivers/ni_pcimio.c @@ -1593,7 +1593,7 @@ static int pcimio_attach(struct comedi_device *dev, struct comedi_devconfig *it) { int ret; - dev_info(dev->hw_dev, "comedi%d: ni_pcimio:\n", dev->minor); + dev_info(dev->class_dev, "ni_pcimio: attach\n"); ret = ni_alloc_private(dev); if (ret < 0) @@ -1603,7 +1603,7 @@ static int pcimio_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (ret < 0) return ret; - dev_dbg(dev->hw_dev, "%s\n", boardtype.name); + dev_dbg(dev->class_dev, "%s\n", boardtype.name); dev->board_name = boardtype.name; if (boardtype.reg_type & ni_reg_m_series_mask) { diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c index 786c3b6..23b61d8 100644 --- a/drivers/staging/comedi/drivers/pcl818.c +++ b/drivers/staging/comedi/drivers/pcl818.c @@ -952,7 +952,7 @@ static int pcl818_ai_cmd_mode(int mode, struct comedi_device *dev, int divisor1 = 0, divisor2 = 0; unsigned int seglen; - dev_dbg(dev->hw_dev, "pcl818_ai_cmd_mode()\n"); + dev_dbg(dev->class_dev, "pcl818_ai_cmd_mode()\n"); if ((!dev->irq) && (!devpriv->dma_rtc)) { comedi_error(dev, "IRQ not defined!"); return -EINVAL; @@ -1055,7 +1055,7 @@ static int pcl818_ai_cmd_mode(int mode, struct comedi_device *dev, break; } #endif - dev_dbg(dev->hw_dev, "pcl818_ai_cmd_mode() end\n"); + dev_dbg(dev->class_dev, "pcl818_ai_cmd_mode() end\n"); return 0; } @@ -1386,7 +1386,7 @@ static int ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) struct comedi_cmd *cmd = &s->async->cmd; int retval; - dev_dbg(dev->hw_dev, "pcl818_ai_cmd()\n"); + dev_dbg(dev->class_dev, "pcl818_ai_cmd()\n"); devpriv->ai_n_chan = cmd->chanlist_len; devpriv->ai_chanlist = cmd->chanlist; devpriv->ai_flags = cmd->flags; @@ -1404,7 +1404,7 @@ static int ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (cmd->convert_src == TRIG_TIMER) { /* mode 1 */ devpriv->ai_timer1 = cmd->convert_arg; retval = pcl818_ai_cmd_mode(1, dev, s); - dev_dbg(dev->hw_dev, "pcl818_ai_cmd() end\n"); + dev_dbg(dev->class_dev, "pcl818_ai_cmd() end\n"); return retval; } if (cmd->convert_src == TRIG_EXT) { /* mode 3 */ @@ -1423,7 +1423,7 @@ static int pcl818_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { if (devpriv->irq_blocked > 0) { - dev_dbg(dev->hw_dev, "pcl818_ai_cancel()\n"); + dev_dbg(dev->class_dev, "pcl818_ai_cancel()\n"); devpriv->irq_was_now_closed = 1; switch (devpriv->ai_mode) { @@ -1473,7 +1473,7 @@ static int pcl818_ai_cancel(struct comedi_device *dev, } end: - dev_dbg(dev->hw_dev, "pcl818_ai_cancel() end\n"); + dev_dbg(dev->class_dev, "pcl818_ai_cancel() end\n"); return 0; } diff --git a/drivers/staging/comedi/drivers/pcmuio.c b/drivers/staging/comedi/drivers/pcmuio.c index 48565fe..4426e17 100644 --- a/drivers/staging/comedi/drivers/pcmuio.c +++ b/drivers/staging/comedi/drivers/pcmuio.c @@ -227,7 +227,7 @@ static int pcmuio_dio_insn_bits(struct comedi_device *dev, #ifdef DAMMIT_ITS_BROKEN /* DEBUG */ - dev_dbg(dev->hw_dev, "write mask: %08x data: %08x\n", data[0], + dev_dbg(dev->class_dev, "write mask: %08x data: %08x\n", data[0], data[1]); #endif @@ -264,7 +264,7 @@ static int pcmuio_dio_insn_bits(struct comedi_device *dev, } #ifdef DAMMIT_ITS_BROKEN /* DEBUG */ - dev_dbg(dev->hw_dev, "data_out_byte %02x\n", (unsigned)byte); + dev_dbg(dev->class_dev, "data_out_byte %02x\n", (unsigned)byte); #endif /* save the digital input lines for this byte.. */ s->state |= ((unsigned int)byte) << offset; @@ -275,7 +275,7 @@ static int pcmuio_dio_insn_bits(struct comedi_device *dev, #ifdef DAMMIT_ITS_BROKEN /* DEBUG */ - dev_dbg(dev->hw_dev, "s->state %08x data_out %08x\n", s->state, + dev_dbg(dev->class_dev, "s->state %08x data_out %08x\n", s->state, data[1]); #endif @@ -760,7 +760,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) irq[0] = it->options[1]; irq[1] = it->options[2]; - dev_dbg(dev->hw_dev, "comedi%d: %s: io: %lx attached\n", dev->minor, + dev_dbg(dev->class_dev, "%s: io: %lx attach\n", dev->driver->driver_name, iobase); dev->iobase = iobase; @@ -768,7 +768,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (!iobase || !request_region(iobase, board->num_asics * ASIC_IOSIZE, dev->driver->driver_name)) { - dev_err(dev->hw_dev, "I/O port conflict\n"); + dev_err(dev->class_dev, "I/O port conflict\n"); return -EIO; } @@ -779,7 +779,8 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) * convenient macro defined in comedidev.h. */ if (alloc_private(dev, sizeof(struct pcmuio_private)) < 0) { - dev_warn(dev->hw_dev, "cannot allocate private data structure\n"); + dev_warn(dev->class_dev, + "cannot allocate private data structure\n"); return -ENOMEM; } @@ -798,7 +799,8 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) kcalloc(n_subdevs, sizeof(struct pcmuio_subdev_private), GFP_KERNEL); if (!devpriv->sprivs) { - dev_warn(dev->hw_dev, "cannot allocate subdevice private data structures\n"); + dev_warn(dev->class_dev, + "cannot allocate subdevice private data structures\n"); return -ENOMEM; } @@ -890,11 +892,12 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) irqs.. */ if (irq[0]) { - dev_dbg(dev->hw_dev, "irq: %u\n", irq[0]); + dev_dbg(dev->class_dev, "irq: %u\n", irq[0]); if (irq[1] && board->num_asics == 2) - dev_dbg(dev->hw_dev, "second ASIC irq: %u\n", irq[1]); + dev_dbg(dev->class_dev, "second ASIC irq: %u\n", + irq[1]); } else { - dev_dbg(dev->hw_dev, "(IRQ mode disabled)\n"); + dev_dbg(dev->class_dev, "(IRQ mode disabled)\n"); } diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c index e622973..c18314b 100644 --- a/drivers/staging/comedi/drivers/serial2002.c +++ b/drivers/staging/comedi/drivers/serial2002.c @@ -782,7 +782,7 @@ static int serial2002_attach(struct comedi_device *dev, struct comedi_subdevice *s; int ret; - dev_dbg(dev->hw_dev, "comedi%d: attached\n", dev->minor); + dev_dbg(dev->class_dev, "serial2002: attach\n"); dev->board_name = board->name; if (alloc_private(dev, sizeof(struct serial2002_private)) < 0) return -ENOMEM; @@ -790,7 +790,7 @@ static int serial2002_attach(struct comedi_device *dev, dev->close = serial_2002_close; devpriv->port = it->options[0]; devpriv->speed = it->options[1]; - dev_dbg(dev->hw_dev, "/dev/ttyS%d @ %d\n", devpriv->port, + dev_dbg(dev->class_dev, "/dev/ttyS%d @ %d\n", devpriv->port, devpriv->speed); ret = comedi_alloc_subdevices(dev, 5); -- cgit v0.10.2 From 185f9aa7df9b75609f6828ecc0d0120fbe94da08 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Mon, 18 Jun 2012 15:16:44 +0100 Subject: staging: comedi: usbduxfast: use attach_usb() hook Change the usbduxfast driver to use the new attach_usb() hook in struct comedi_driver to auto-configure probed USB devices after the firmware is loaded. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index 2ee9ecd..c713620 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c @@ -1619,64 +1619,28 @@ static void usbduxfastsub_disconnect(struct usb_interface *intf) #endif } -/* - * is called when comedi-config is called - */ -static int usbduxfast_attach(struct comedi_device *dev, - struct comedi_devconfig *it) +/* common part of attach and attach_usb */ +static int usbduxfast_attach_common(struct comedi_device *dev, + struct usbduxfastsub_s *udfs, + void *aux_data, int aux_len) { int ret; - int index; - int i; - struct comedi_subdevice *s = NULL; - dev->private = NULL; - - down(&start_stop_sem); - /* - * find a valid device which has been detected by the - * probe function of the usb - */ - index = -1; - for (i = 0; i < NUMUSBDUXFAST; i++) { - if (usbduxfastsub[i].probed && !usbduxfastsub[i].attached) { - index = i; - break; - } - } - - if (index < 0) { - printk(KERN_ERR "comedi%d: usbduxfast: error: attach failed, " - "no usbduxfast devs connected to the usb bus.\n", - dev->minor); - up(&start_stop_sem); - return -ENODEV; - } + struct comedi_subdevice *s; - down(&(usbduxfastsub[index].sem)); + down(&udfs->sem); /* pointer back to the corresponding comedi device */ - usbduxfastsub[index].comedidev = dev; - + udfs->comedidev = dev; /* trying to upload the firmware into the chip */ - if (comedi_aux_data(it->options, 0) && - it->options[COMEDI_DEVCONF_AUX_DATA_LENGTH]) { - firmwareUpload(&usbduxfastsub[index], - comedi_aux_data(it->options, 0), - it->options[COMEDI_DEVCONF_AUX_DATA_LENGTH]); - } - + if (aux_data) + firmwareUpload(udfs, aux_data, aux_len); dev->board_name = BOARDNAME; - ret = comedi_alloc_subdevices(dev, 1); if (ret) { - up(&(usbduxfastsub[index].sem)); - up(&start_stop_sem); + up(&udfs->sem); return ret; } - - printk(KERN_INFO "comedi%d: usbduxfast: usb-device %d is attached to " - "comedi.\n", dev->minor, index); /* private structure is also simply the usb-structure */ - dev->private = usbduxfastsub + index; + dev->private = udfs; /* the first subdevice is the A/D converter */ s = dev->subdevices + SUBDEV_AD; /* @@ -1703,16 +1667,76 @@ static int usbduxfast_attach(struct comedi_device *dev, s->maxdata = 0x1000; /* range table to convert to physical units */ s->range_table = &range_usbduxfast_ai_range; - /* finally decide that it's attached */ - usbduxfastsub[index].attached = 1; + udfs->attached = 1; + up(&udfs->sem); + dev_info(dev->class_dev, "successfully attached to usbduxfast.\n"); + return 0; +} + +/* is called for COMEDI_DEVCONFIG ioctl (when comedi_config is run) */ +static int usbduxfast_attach(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + int ret; + int index; + int i; + void *aux_data; + int aux_len; - up(&(usbduxfastsub[index].sem)); + dev->private = NULL; + + aux_data = comedi_aux_data(it->options, 0); + aux_len = it->options[COMEDI_DEVCONF_AUX_DATA_LENGTH]; + if (aux_data == NULL) + aux_len = 0; + else if (aux_len == 0) + aux_data = NULL; + down(&start_stop_sem); + /* + * find a valid device which has been detected by the + * probe function of the usb + */ + index = -1; + for (i = 0; i < NUMUSBDUXFAST; i++) { + if (usbduxfastsub[i].probed && !usbduxfastsub[i].attached) { + index = i; + break; + } + } + if (index < 0) { + dev_err(dev->class_dev, + "usbduxfast: error: attach failed, no usbduxfast devs connected to the usb bus.\n"); + ret = -ENODEV; + } else + ret = usbduxfast_attach_common(dev, &usbduxfastsub[index], + aux_data, aux_len); up(&start_stop_sem); - printk(KERN_INFO "comedi%d: successfully attached to usbduxfast.\n", - dev->minor); + return ret; +} - return 0; +/* is called from comedi_usb_auto_config() */ +static int usbduxfast_attach_usb(struct comedi_device *dev, + struct usb_interface *uinterf) +{ + int ret; + struct usbduxfastsub_s *udfs; + + dev->private = NULL; + down(&start_stop_sem); + udfs = usb_get_intfdata(uinterf); + if (!udfs || !udfs->probed) { + dev_err(dev->class_dev, + "usbduxfast: error: attach_usb failed, not connected\n"); + ret = -ENODEV; + } else if (udfs->attached) { + dev_err(dev->class_dev, + "usbduxfast: error: attach_usb failed, already attached\n"); + ret = -ENODEV; + } else + ret = usbduxfast_attach_common(dev, udfs, NULL, 0); + up(&start_stop_sem); + return ret; } static void usbduxfast_detach(struct comedi_device *dev) @@ -1737,7 +1761,8 @@ static struct comedi_driver driver_usbduxfast = { .driver_name = "usbduxfast", .module = THIS_MODULE, .attach = usbduxfast_attach, - .detach = usbduxfast_detach + .detach = usbduxfast_detach, + .attach_usb = usbduxfast_attach_usb, }; /* -- cgit v0.10.2 From f7d4d3bc0c5e30ac58e9e41c695852bfdcb8cb95 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Mon, 18 Jun 2012 17:36:58 +0100 Subject: staging: comedi: vmk80xx: use attach_usb() hook Change the vmv80xx driver to use the new attach_usb() hook in struct comedi_driver to auto-configure probed USB devices after the firmware is loaded. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c index 69402da..7d3cb3a 100644 --- a/drivers/staging/comedi/drivers/vmk80xx.c +++ b/drivers/staging/comedi/drivers/vmk80xx.c @@ -1127,46 +1127,25 @@ static int vmk80xx_pwm_winsn(struct comedi_device *cdev, return n; } -static int vmk80xx_attach(struct comedi_device *cdev, - struct comedi_devconfig *it) +static int vmk80xx_attach_common(struct comedi_device *cdev, + struct vmk80xx_usb *dev) { - int i; - struct vmk80xx_usb *dev; int n_subd; struct comedi_subdevice *s; - int minor; int ret; - mutex_lock(&glb_mutex); - - for (i = 0; i < VMK80XX_MAX_BOARDS; i++) - if (vmb[i].probed && !vmb[i].attached) - break; - - if (i == VMK80XX_MAX_BOARDS) { - mutex_unlock(&glb_mutex); - return -ENODEV; - } - - dev = &vmb[i]; - down(&dev->limit_sem); - cdev->board_name = dev->board.name; cdev->private = dev; - if (dev->board.model == VMK8055_MODEL) n_subd = 5; else n_subd = 6; - ret = comedi_alloc_subdevices(cdev, n_subd); if (ret) { up(&dev->limit_sem); - mutex_unlock(&glb_mutex); return ret; } - /* Analog input subdevice */ s = cdev->subdevices + VMK80XX_SUBD_AI; s->type = COMEDI_SUBD_AI; @@ -1175,7 +1154,6 @@ static int vmk80xx_attach(struct comedi_device *cdev, s->maxdata = (1 << dev->board.ai_bits) - 1; s->range_table = dev->board.range; s->insn_read = vmk80xx_ai_rinsn; - /* Analog output subdevice */ s = cdev->subdevices + VMK80XX_SUBD_AO; s->type = COMEDI_SUBD_AO; @@ -1184,12 +1162,10 @@ static int vmk80xx_attach(struct comedi_device *cdev, s->maxdata = (1 << dev->board.ao_bits) - 1; s->range_table = dev->board.range; s->insn_write = vmk80xx_ao_winsn; - if (dev->board.model == VMK8061_MODEL) { s->subdev_flags |= SDF_READABLE; s->insn_read = vmk80xx_ao_rinsn; } - /* Digital input subdevice */ s = cdev->subdevices + VMK80XX_SUBD_DI; s->type = COMEDI_SUBD_DI; @@ -1198,7 +1174,6 @@ static int vmk80xx_attach(struct comedi_device *cdev, s->maxdata = 1; s->insn_read = vmk80xx_di_rinsn; s->insn_bits = vmk80xx_di_bits; - /* Digital output subdevice */ s = cdev->subdevices + VMK80XX_SUBD_DO; s->type = COMEDI_SUBD_DO; @@ -1207,12 +1182,10 @@ static int vmk80xx_attach(struct comedi_device *cdev, s->maxdata = 1; s->insn_write = vmk80xx_do_winsn; s->insn_bits = vmk80xx_do_bits; - if (dev->board.model == VMK8061_MODEL) { s->subdev_flags |= SDF_READABLE; s->insn_read = vmk80xx_do_rinsn; } - /* Counter subdevice */ s = cdev->subdevices + VMK80XX_SUBD_CNT; s->type = COMEDI_SUBD_COUNTER; @@ -1220,13 +1193,11 @@ static int vmk80xx_attach(struct comedi_device *cdev, s->n_chan = dev->board.cnt_chans; s->insn_read = vmk80xx_cnt_rinsn; s->insn_config = vmk80xx_cnt_cinsn; - if (dev->board.model == VMK8055_MODEL) { s->subdev_flags |= SDF_WRITEABLE; s->maxdata = (1 << dev->board.cnt_bits) - 1; s->insn_write = vmk80xx_cnt_winsn; } - /* PWM subdevice */ if (dev->board.model == VMK8061_MODEL) { s = cdev->subdevices + VMK80XX_SUBD_PWM; @@ -1237,19 +1208,51 @@ static int vmk80xx_attach(struct comedi_device *cdev, s->insn_read = vmk80xx_pwm_rinsn; s->insn_write = vmk80xx_pwm_winsn; } - dev->attached = 1; + dev_info(cdev->class_dev, "vmk80xx: board #%d [%s] attached\n", + dev->count, dev->board.name); + up(&dev->limit_sem); + return 0; +} - minor = cdev->minor; - - printk(KERN_INFO - "comedi%d: vmk80xx: board #%d [%s] attached to comedi\n", - minor, dev->count, dev->board.name); +/* called for COMEDI_DEVCONFIG ioctl for board_name "vmk80xx" */ +static int vmk80xx_attach(struct comedi_device *cdev, + struct comedi_devconfig *it) +{ + int i; + int ret; - up(&dev->limit_sem); + mutex_lock(&glb_mutex); + for (i = 0; i < VMK80XX_MAX_BOARDS; i++) + if (vmb[i].probed && !vmb[i].attached) + break; + if (i == VMK80XX_MAX_BOARDS) + ret = -ENODEV; + else + ret = vmk80xx_attach_common(cdev, &vmb[i]); mutex_unlock(&glb_mutex); + return ret; +} - return 0; +/* called via comedi_usb_auto_config() */ +static int vmk80xx_attach_usb(struct comedi_device *cdev, + struct usb_interface *intf) +{ + int i; + int ret; + + mutex_lock(&glb_mutex); + for (i = 0; i < VMK80XX_MAX_BOARDS; i++) + if (vmb[i].probed && vmb[i].intf == intf) + break; + if (i == VMK80XX_MAX_BOARDS) + ret = -ENODEV; + else if (vmb[i].attached) + ret = -EBUSY; + else + ret = vmk80xx_attach_common(cdev, &vmb[i]); + mutex_unlock(&glb_mutex); + return ret; } static void vmk80xx_detach(struct comedi_device *dev) @@ -1457,7 +1460,8 @@ static struct comedi_driver driver_vmk80xx = { .module = THIS_MODULE, .driver_name = "vmk80xx", .attach = vmk80xx_attach, - .detach = vmk80xx_detach + .detach = vmk80xx_detach, + .attach_usb = vmk80xx_attach_usb, }; static int __init vmk80xx_init(void) -- cgit v0.10.2 From 60ff46106744220506841c45f82576b9b56cf22e Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Mon, 18 Jun 2012 16:35:54 +0100 Subject: staging: comedi: usbduxsigma: use attach_usb() hook Change the usbduxsigma driver to use the new attach_usb() hook in struct comedi_driver to auto-configure probed USB devices after the firmware is loaded. Move the release of the driver's static 'start_stop_sem' semaphore in usbduxsigma_attach() to occur a bit later for convenience, otherwise the new usbduxsigma_attach_common() would need to be split in two. I don't think the slight delay in releasing the semaphore matters too much; it's only used in the USB probe and disconnect functions and when attaching and detaching comedi devices. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index 502a409..699deb1 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -2634,72 +2634,35 @@ static void usbduxsigma_disconnect(struct usb_interface *intf) dev_info(&intf->dev, "comedi_: disconnected from the usb\n"); } -/* is called when comedi-config is called */ -static int usbduxsigma_attach(struct comedi_device *dev, - struct comedi_devconfig *it) +/* common part of attach and attach_usb */ +static int usbduxsigma_attach_common(struct comedi_device *dev, + struct usbduxsub *uds, + void *aux_data, int aux_len) { int ret; - int index; - int i; - struct usbduxsub *udev; + struct comedi_subdevice *s; int n_subdevs; - int offset; - struct comedi_subdevice *s = NULL; - dev->private = NULL; - - down(&start_stop_sem); - /* find a valid device which has been detected by the probe function of - * the usb */ - index = -1; - for (i = 0; i < NUMUSBDUX; i++) { - if ((usbduxsub[i].probed) && (!usbduxsub[i].attached)) { - index = i; - break; - } - } - - if (index < 0) { - printk(KERN_ERR "comedi%d: usbduxsigma: error: attach failed," - "dev not connected to the usb bus.\n", dev->minor); - up(&start_stop_sem); - return -ENODEV; - } - - udev = &usbduxsub[index]; - down(&udev->sem); + down(&uds->sem); /* pointer back to the corresponding comedi device */ - udev->comedidev = dev; - + uds->comedidev = dev; /* trying to upload the firmware into the FX2 */ - if (comedi_aux_data(it->options, 0) && - it->options[COMEDI_DEVCONF_AUX_DATA_LENGTH]) { - firmwareUpload(udev, comedi_aux_data(it->options, 0), - it->options[COMEDI_DEVCONF_AUX_DATA_LENGTH]); - } - + if (aux_data) + firmwareUpload(uds, aux_data, aux_len); dev->board_name = BOARDNAME; - /* set number of subdevices */ - if (udev->high_speed) { - /* with pwm */ - n_subdevs = 4; - } else { - /* without pwm */ - n_subdevs = 3; - } - + if (uds->high_speed) + n_subdevs = 4; /* with pwm */ + else + n_subdevs = 3; /* without pwm */ ret = comedi_alloc_subdevices(dev, n_subdevs); if (ret) { - up(&udev->sem); - up(&start_stop_sem); + up(&uds->sem); return ret; } - /* private structure is also simply the usb-structure */ - dev->private = udev; - + dev->private = uds; /* the first subdevice is the A/D converter */ s = dev->subdevices + SUBDEV_AD; /* the URBs get the comedi subdevice */ @@ -2727,8 +2690,7 @@ static int usbduxsigma_attach(struct comedi_device *dev, s->maxdata = 0x00FFFFFF; /* range table to convert to physical units */ s->range_table = (&range_usbdux_ai_range); - - /* analog out */ + /* analog output subdevice */ s = dev->subdevices + SUBDEV_DA; /* analog out */ s->type = COMEDI_SUBD_AO; @@ -2753,8 +2715,7 @@ static int usbduxsigma_attach(struct comedi_device *dev, s->cancel = usbdux_ao_cancel; s->insn_read = usbdux_ao_insn_read; s->insn_write = usbdux_ao_insn_write; - - /* digital I/O */ + /* digital I/O subdevice */ s = dev->subdevices + SUBDEV_DIO; s->type = COMEDI_SUBD_DIO; s->subdev_flags = SDF_READABLE | SDF_WRITABLE; @@ -2766,37 +2727,94 @@ static int usbduxsigma_attach(struct comedi_device *dev, s->insn_config = usbdux_dio_insn_config; /* we don't use it */ s->private = NULL; - - if (udev->high_speed) { - /* timer / pwm */ + if (uds->high_speed) { + /* timer / pwm subdevice */ s = dev->subdevices + SUBDEV_PWM; s->type = COMEDI_SUBD_PWM; s->subdev_flags = SDF_WRITABLE | SDF_PWM_HBRIDGE; s->n_chan = 8; /* this defines the max duty cycle resolution */ - s->maxdata = udev->sizePwmBuf; + s->maxdata = uds->sizePwmBuf; s->insn_write = usbdux_pwm_write; s->insn_read = usbdux_pwm_read; s->insn_config = usbdux_pwm_config; usbdux_pwm_period(dev, s, PWM_DEFAULT_PERIOD); } /* finally decide that it's attached */ - udev->attached = 1; + uds->attached = 1; + up(&uds->sem); + offset = usbdux_getstatusinfo(dev, 0); + if (offset < 0) + dev_err(&uds->interface->dev, + "Communication to USBDUXSIGMA failed! Check firmware and cabling."); + dev_info(&uds->interface->dev, + "comedi%d: attached, ADC_zero = %x\n", dev->minor, offset); + return 0; +} - up(&udev->sem); +/* is called for COMEDI_DEVCONFIG ioctl (when comedi_config is run) */ +static int usbduxsigma_attach(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + int ret; + int index; + int i; + void *aux_data; + int aux_len; - up(&start_stop_sem); + dev->private = NULL; - offset = usbdux_getstatusinfo(dev, 0); - if (offset < 0) - dev_err(&udev->interface->dev, - "Communication to USBDUXSIGMA failed!" - "Check firmware and cabling."); + aux_data = comedi_aux_data(it->options, 0); + aux_len = it->options[COMEDI_DEVCONF_AUX_DATA_LENGTH]; + if (aux_data == NULL) + aux_len = 0; + else if (aux_len == 0) + aux_data = NULL; - dev_info(&udev->interface->dev, - "comedi%d: attached, ADC_zero = %x", dev->minor, offset); + down(&start_stop_sem); + /* find a valid device which has been detected by the probe function of + * the usb */ + index = -1; + for (i = 0; i < NUMUSBDUX; i++) { + if ((usbduxsub[i].probed) && (!usbduxsub[i].attached)) { + index = i; + break; + } + } + if (index < 0) { + dev_err(dev->class_dev, + "usbduxsigma: error: attach failed, dev not connected to the usb bus.\n"); + up(&start_stop_sem); + ret = -ENODEV; + } else + ret = usbduxsigma_attach_common(dev, &usbduxsub[index], + aux_data, aux_len); + up(&start_stop_sem); + return ret; +} - return 0; +/* is called from comedi_usb_auto_config() */ +static int usbduxsigma_attach_usb(struct comedi_device *dev, + struct usb_interface *uinterf) +{ + int ret; + struct usbduxsub *uds; + + dev->private = NULL; + down(&start_stop_sem); + uds = usb_get_intfdata(uinterf); + if (!uds || !uds->probed) { + dev_err(dev->class_dev, + "usbduxsigma: error: attach_usb failed, not connected\n"); + ret = -ENODEV; + } else if (uds->attached) { + dev_err(dev->class_dev, + "usbduxsigma: error: attach_usb failed, already attached\n"); + ret = -ENODEV; + } else + ret = usbduxsigma_attach_common(dev, uds, NULL, 0); + up(&start_stop_sem); + return ret; } static void usbduxsigma_detach(struct comedi_device *dev) @@ -2818,6 +2836,7 @@ static struct comedi_driver driver_usbduxsigma = { .module = THIS_MODULE, .attach = usbduxsigma_attach, .detach = usbduxsigma_detach, + .attach_usb = usbduxsigma_attach_usb, }; /* Table with the USB-devices */ -- cgit v0.10.2 From 520706607befd1f5c20ec14db35d6be45791bc41 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 18 Jun 2012 11:18:25 -0700 Subject: staging: comedi: remove unneeded sanity check in insn_bits functions The comedi core does the sanity check to make sure that the data length the INSN_BITS instruction is 2. There is no need for the drivers to do this check. Remove all the sanity checks in the drivers. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index e0de149..4c9977b 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -139,9 +139,6 @@ static int subdev_8255_insn(struct comedi_device *dev, unsigned int bits; unsigned int v; - if (insn->n != 2) - return -EINVAL; - mask = data[0]; bits = data[1]; diff --git a/drivers/staging/comedi/drivers/acl7225b.c b/drivers/staging/comedi/drivers/acl7225b.c index 0bf55258..ab765d3 100644 --- a/drivers/staging/comedi/drivers/acl7225b.c +++ b/drivers/staging/comedi/drivers/acl7225b.c @@ -31,9 +31,6 @@ static int acl7225b_do_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - if (data[0]) { s->state &= ~data[0]; s->state |= (data[0] & data[1]); @@ -53,9 +50,6 @@ static int acl7225b_di_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - data[1] = inb(dev->iobase + (unsigned long)s->private) | (inb(dev->iobase + (unsigned long)s->private + 1) << 8); diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index 98b3730..f0a5958 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -141,8 +141,6 @@ static int pci6208_ao_rinsn(struct comedi_device *dev, * struct comedi_subdevice *s, */ /* struct comedi_insn *insn,unsigned int *data) */ /* { */ -/* if(insn->n!=2)return -EINVAL; */ - /* The insn data is a mask in data[0] and the new data * in data[1], each channel cooresponding to a bit. */ /* if(data[0]){ */ diff --git a/drivers/staging/comedi/drivers/adl_pci7230.c b/drivers/staging/comedi/drivers/adl_pci7230.c index 62fdf7f..d75734a 100644 --- a/drivers/staging/comedi/drivers/adl_pci7230.c +++ b/drivers/staging/comedi/drivers/adl_pci7230.c @@ -54,9 +54,6 @@ static int adl_pci7230_do_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - if (data[0]) { s->state &= ~data[0]; s->state |= (data[0] & data[1]); @@ -72,9 +69,6 @@ static int adl_pci7230_di_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - data[1] = inl(dev->iobase + PCI7230_DI) & 0xffffffff; return 2; diff --git a/drivers/staging/comedi/drivers/adl_pci7432.c b/drivers/staging/comedi/drivers/adl_pci7432.c index aabf418..b071a08 100644 --- a/drivers/staging/comedi/drivers/adl_pci7432.c +++ b/drivers/staging/comedi/drivers/adl_pci7432.c @@ -57,9 +57,6 @@ static int adl_pci7432_do_insn_bits(struct comedi_device *dev, printk(KERN_DEBUG "comedi: pci7432_do_insn_bits called\n"); printk(KERN_DEBUG "comedi: data0: %8x data1: %8x\n", data[0], data[1]); - if (insn->n != 2) - return -EINVAL; - if (data[0]) { s->state &= ~data[0]; s->state |= (data[0] & data[1]); @@ -79,9 +76,6 @@ static int adl_pci7432_di_insn_bits(struct comedi_device *dev, printk(KERN_DEBUG "comedi: pci7432_di_insn_bits called\n"); printk(KERN_DEBUG "comedi: data0: %8x data1: %8x\n", data[0], data[1]); - if (insn->n != 2) - return -EINVAL; - data[1] = inl(dev->iobase + PCI7432_DI) & 0xffffffff; printk(KERN_DEBUG "comedi: data1 %8x\n", data[1]); diff --git a/drivers/staging/comedi/drivers/aio_iiro_16.c b/drivers/staging/comedi/drivers/aio_iiro_16.c index 8059cef..3434107 100644 --- a/drivers/staging/comedi/drivers/aio_iiro_16.c +++ b/drivers/staging/comedi/drivers/aio_iiro_16.c @@ -70,9 +70,6 @@ static int aio_iiro_16_dio_insn_bits_write(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - if (data[0]) { s->state &= ~data[0]; s->state |= data[0] & data[1]; @@ -91,9 +88,6 @@ static int aio_iiro_16_dio_insn_bits_read(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - data[1] = 0; data[1] |= inb(dev->iobase + AIO_IIRO_16_INPUT_0_7); data[1] |= inb(dev->iobase + AIO_IIRO_16_INPUT_8_15) << 8; diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index 4f15bfd..a018d81 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c @@ -185,9 +185,6 @@ static int pc263_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - /* The insn data is a mask in data[0] and the new data * in data[1], each channel cooresponding to a bit. */ if (data[0]) { diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 77dc880..515dda0 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -549,9 +549,6 @@ static int das16cs_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - if (data[0]) { s->state &= ~data[0]; s->state |= data[0] & data[1]; diff --git a/drivers/staging/comedi/drivers/comedi_bond.c b/drivers/staging/comedi/drivers/comedi_bond.c index 0260ddc..5ed324c 100644 --- a/drivers/staging/comedi/drivers/comedi_bond.c +++ b/drivers/staging/comedi/drivers/comedi_bond.c @@ -133,8 +133,6 @@ static int bonding_dio_insn_bits(struct comedi_device *dev, { #define LSAMPL_BITS (sizeof(unsigned int)*8) unsigned nchans = LSAMPL_BITS, num_done = 0, i; - if (insn->n != 2) - return -EINVAL; if (devpriv->nchans < nchans) nchans = devpriv->nchans; diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index 589d12f..10c3c35 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -162,9 +162,6 @@ static int parport_intr_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n < 1) - return -EINVAL; - data[1] = 0; return 2; } diff --git a/drivers/staging/comedi/drivers/contec_pci_dio.c b/drivers/staging/comedi/drivers/contec_pci_dio.c index d49561f..6aec9a6 100644 --- a/drivers/staging/comedi/drivers/contec_pci_dio.c +++ b/drivers/staging/comedi/drivers/contec_pci_dio.c @@ -74,9 +74,6 @@ static int contec_do_insn_bits(struct comedi_device *dev, dev_dbg(dev->class_dev, "contec_do_insn_bits called\n"); dev_dbg(dev->class_dev, "data: %d %d\n", data[0], data[1]); - if (insn->n != 2) - return -EINVAL; - if (data[0]) { s->state &= ~data[0]; s->state |= data[0] & data[1]; @@ -95,9 +92,6 @@ static int contec_di_insn_bits(struct comedi_device *dev, dev_dbg(dev->class_dev, "contec_di_insn_bits called\n"); dev_dbg(dev->class_dev, "data: %d %d\n", data[0], data[1]); - if (insn->n != 2) - return -EINVAL; - data[1] = inw(dev->iobase + thisboard->in_offs); return 2; diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c index 2b60cf8..7cc9d20 100644 --- a/drivers/staging/comedi/drivers/dmm32at.c +++ b/drivers/staging/comedi/drivers/dmm32at.c @@ -914,9 +914,6 @@ static int dmm32at_dio_insn_bits(struct comedi_device *dev, { unsigned char diobits; - if (insn->n != 2) - return -EINVAL; - /* The insn data is a mask in data[0] and the new data * in data[1], each channel cooresponding to a bit. */ if (data[0]) { diff --git a/drivers/staging/comedi/drivers/dt2801.c b/drivers/staging/comedi/drivers/dt2801.c index 5afbf8a..d0bbbbb 100644 --- a/drivers/staging/comedi/drivers/dt2801.c +++ b/drivers/staging/comedi/drivers/dt2801.c @@ -535,8 +535,6 @@ static int dt2801_dio_insn_bits(struct comedi_device *dev, if (s == dev->subdevices + 4) which = 1; - if (insn->n != 2) - return -EINVAL; if (data[0]) { s->state &= ~data[0]; s->state |= (data[0] & data[1]); diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index 91fbf4a..b239f38 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -352,9 +352,6 @@ static int dt2811_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - data[1] = inb(dev->iobase + DT2811_DIO); return 2; @@ -364,9 +361,6 @@ static int dt2811_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - s->state &= ~data[0]; s->state |= data[0] & data[1]; outb(s->state, dev->iobase + DT2811_DIO); diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c index 31a16ed..6acfe05 100644 --- a/drivers/staging/comedi/drivers/dt3000.c +++ b/drivers/staging/comedi/drivers/dt3000.c @@ -745,9 +745,6 @@ static int dt3k_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - if (data[0]) { s->state &= ~data[0]; s->state |= data[1] & data[0]; diff --git a/drivers/staging/comedi/drivers/dyna_pci10xx.c b/drivers/staging/comedi/drivers/dyna_pci10xx.c index 9c855e2..78f3c8b 100644 --- a/drivers/staging/comedi/drivers/dyna_pci10xx.c +++ b/drivers/staging/comedi/drivers/dyna_pci10xx.c @@ -189,9 +189,6 @@ static int dyna_pci10xx_di_insn_bits(struct comedi_device *dev, { u16 d = 0; - if (insn->n != 2) - return -EINVAL; - mutex_lock(&devpriv->mutex); smp_mb(); d = inw_p(devpriv->BADR3); @@ -209,9 +206,6 @@ static int dyna_pci10xx_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - /* The insn data is a mask in data[0] and the new data * in data[1], each channel cooresponding to a bit. * s->state contains the previous write data diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 72466bf..631b422 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -1643,17 +1643,6 @@ static int me4000_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - /* Length of data must be 2 (mask and new data, see below) */ - if (insn->n == 0) - return 0; - - if (insn->n != 2) { - printk - ("comedi%d: me4000: me4000_dio_insn_bits(): " - "Invalid instruction length\n", dev->minor); - return -EINVAL; - } - /* * The insn data consists of a mask in data[0] and the new data * in data[1]. The mask defines which bits we are concerning about. diff --git a/drivers/staging/comedi/drivers/multiq3.c b/drivers/staging/comedi/drivers/multiq3.c index b1bbd02..d1a8e91 100644 --- a/drivers/staging/comedi/drivers/multiq3.c +++ b/drivers/staging/comedi/drivers/multiq3.c @@ -161,9 +161,6 @@ static int multiq3_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - data[1] = inw(dev->iobase + MULTIQ3_DIGIN_PORT); return 2; @@ -173,9 +170,6 @@ static int multiq3_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - s->state &= ~data[0]; s->state |= (data[0] & data[1]); outw(s->state, dev->iobase + MULTIQ3_DIGOUT_PORT); diff --git a/drivers/staging/comedi/drivers/ni_6527.c b/drivers/staging/comedi/drivers/ni_6527.c index b60ab48..eec44a0 100644 --- a/drivers/staging/comedi/drivers/ni_6527.c +++ b/drivers/staging/comedi/drivers/ni_6527.c @@ -174,9 +174,6 @@ static int ni6527_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - data[1] = readb(devpriv->mite->daq_io_addr + Port_Register(0)); data[1] |= readb(devpriv->mite->daq_io_addr + Port_Register(1)) << 8; data[1] |= readb(devpriv->mite->daq_io_addr + Port_Register(2)) << 16; @@ -188,8 +185,6 @@ static int ni6527_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; if (data[0]) { s->state &= ~data[0]; s->state |= (data[0] & data[1]); @@ -339,9 +334,6 @@ static int ni6527_intr_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n < 1) - return -EINVAL; - data[1] = 0; return 2; } diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index ac7c74b..f92f8ab 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -415,8 +415,7 @@ static int ni_65xx_dio_insn_bits(struct comedi_device *dev, const unsigned max_ports_per_bitfield = 5; unsigned read_bits = 0; unsigned j; - if (insn->n != 2) - return -EINVAL; + base_bitfield_channel = CR_CHAN(insn->chanspec); for (j = 0; j < max_ports_per_bitfield; ++j) { const unsigned port_offset = @@ -602,9 +601,6 @@ static int ni_65xx_intr_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n < 1) - return -EINVAL; - data[1] = 0; return 2; } diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index 5dffe6c..b62b427 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -306,9 +306,6 @@ static int ni_670x_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - /* The insn data is a mask in data[0] and the new data * in data[1], each channel cooresponding to a bit. */ if (data[0]) { diff --git a/drivers/staging/comedi/drivers/ni_at_ao.c b/drivers/staging/comedi/drivers/ni_at_ao.c index 1c3f322..28848bc 100644 --- a/drivers/staging/comedi/drivers/ni_at_ao.c +++ b/drivers/staging/comedi/drivers/ni_at_ao.c @@ -239,9 +239,6 @@ static int atao_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - if (data[0]) { s->state &= ~data[0]; s->state |= data[0] & data[1]; diff --git a/drivers/staging/comedi/drivers/ni_atmio16d.c b/drivers/staging/comedi/drivers/ni_atmio16d.c index 87992c9..54c0394 100644 --- a/drivers/staging/comedi/drivers/ni_atmio16d.c +++ b/drivers/staging/comedi/drivers/ni_atmio16d.c @@ -599,9 +599,6 @@ static int atmio16d_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - if (data[0]) { s->state &= ~data[0]; s->state |= (data[0] | data[1]); diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 1f796b9..42df64e 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -3567,8 +3567,7 @@ static int ni_dio_insn_bits(struct comedi_device *dev, #ifdef DEBUG_DIO printk("ni_dio_insn_bits() mask=0x%x bits=0x%x\n", data[0], data[1]); #endif - if (insn->n != 2) - return -EINVAL; + if (data[0]) { /* Perform check to make sure we're not using the serial part of the dio */ @@ -3629,8 +3628,7 @@ static int ni_m_series_dio_insn_bits(struct comedi_device *dev, printk("ni_m_series_dio_insn_bits() mask=0x%x bits=0x%x\n", data[0], data[1]); #endif - if (insn->n != 2) - return -EINVAL; + if (data[0]) { s->state &= ~data[0]; s->state |= (data[0] & data[1]); @@ -5485,9 +5483,6 @@ static int ni_rtsi_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - data[1] = 0; return 2; diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c index cba0459..133ab2f 100644 --- a/drivers/staging/comedi/drivers/ni_pcidio.c +++ b/drivers/staging/comedi/drivers/ni_pcidio.c @@ -745,8 +745,6 @@ static int ni_pcidio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; if (data[0]) { s->state &= ~data[0]; s->state |= (data[0] & data[1]); diff --git a/drivers/staging/comedi/drivers/pcl711.c b/drivers/staging/comedi/drivers/pcl711.c index d5fa6f2..0df086a 100644 --- a/drivers/staging/comedi/drivers/pcl711.c +++ b/drivers/staging/comedi/drivers/pcl711.c @@ -449,9 +449,6 @@ static int pcl711_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - data[1] = inb(dev->iobase + PCL711_DI_LO) | (inb(dev->iobase + PCL711_DI_HI) << 8); @@ -463,9 +460,6 @@ static int pcl711_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - if (data[0]) { s->state &= ~data[0]; s->state |= data[0] & data[1]; diff --git a/drivers/staging/comedi/drivers/pcl725.c b/drivers/staging/comedi/drivers/pcl725.c index 8edbefd..433ea05 100644 --- a/drivers/staging/comedi/drivers/pcl725.c +++ b/drivers/staging/comedi/drivers/pcl725.c @@ -23,9 +23,6 @@ Devices: [Advantech] PCL-725 (pcl725) static int pcl725_do_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - if (data[0]) { s->state &= ~data[0]; s->state |= (data[0] & data[1]); @@ -40,9 +37,6 @@ static int pcl725_do_insn(struct comedi_device *dev, struct comedi_subdevice *s, static int pcl725_di_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - data[1] = inb(dev->iobase + PCL725_DI); return 2; diff --git a/drivers/staging/comedi/drivers/pcl726.c b/drivers/staging/comedi/drivers/pcl726.c index b2e73cd..dfff9af 100644 --- a/drivers/staging/comedi/drivers/pcl726.c +++ b/drivers/staging/comedi/drivers/pcl726.c @@ -197,9 +197,6 @@ static int pcl726_di_insn_bits(struct comedi_device *dev, { const struct pcl726_board *board = comedi_board(dev); - if (insn->n != 2) - return -EINVAL; - data[1] = inb(dev->iobase + board->di_lo) | (inb(dev->iobase + board->di_hi) << 8); @@ -212,9 +209,6 @@ static int pcl726_do_insn_bits(struct comedi_device *dev, { const struct pcl726_board *board = comedi_board(dev); - if (insn->n != 2) - return -EINVAL; - if (data[0]) { s->state &= ~data[0]; s->state |= data[0] & data[1]; diff --git a/drivers/staging/comedi/drivers/pcl730.c b/drivers/staging/comedi/drivers/pcl730.c index 3cba79a..d40caca 100644 --- a/drivers/staging/comedi/drivers/pcl730.c +++ b/drivers/staging/comedi/drivers/pcl730.c @@ -35,9 +35,6 @@ struct pcl730_board { static int pcl730_do_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - if (data[0]) { s->state &= ~data[0]; s->state |= (data[0] & data[1]); @@ -57,9 +54,6 @@ static int pcl730_do_insn(struct comedi_device *dev, struct comedi_subdevice *s, static int pcl730_di_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - data[1] = inb(dev->iobase + ((unsigned long)s->private)) | (inb(dev->iobase + ((unsigned long)s->private) + 1) << 8); diff --git a/drivers/staging/comedi/drivers/pcl812.c b/drivers/staging/comedi/drivers/pcl812.c index b0eb2ab..1c146c8 100644 --- a/drivers/staging/comedi/drivers/pcl812.c +++ b/drivers/staging/comedi/drivers/pcl812.c @@ -501,9 +501,6 @@ static int pcl812_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - data[1] = inb(dev->iobase + PCL812_DI_LO); data[1] |= inb(dev->iobase + PCL812_DI_HI) << 8; @@ -517,9 +514,6 @@ static int pcl812_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - if (data[0]) { s->state &= ~data[0]; s->state |= data[0] & data[1]; diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c index 23b61d8..13eaadf 100644 --- a/drivers/staging/comedi/drivers/pcl818.c +++ b/drivers/staging/comedi/drivers/pcl818.c @@ -442,9 +442,6 @@ static int pcl818_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - data[1] = inb(dev->iobase + PCL818_DI_LO) | (inb(dev->iobase + PCL818_DI_HI) << 8); @@ -461,9 +458,6 @@ static int pcl818_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - s->state &= ~data[0]; s->state |= (data[0] & data[1]); diff --git a/drivers/staging/comedi/drivers/pcm3730.c b/drivers/staging/comedi/drivers/pcm3730.c index b48f7aa..311fe2d 100644 --- a/drivers/staging/comedi/drivers/pcm3730.c +++ b/drivers/staging/comedi/drivers/pcm3730.c @@ -32,8 +32,6 @@ static int pcm3730_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; if (data[0]) { s->state &= ~data[0]; s->state |= (data[0] & data[1]); @@ -48,8 +46,6 @@ static int pcm3730_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; data[1] = inb(dev->iobase + (unsigned long)(s->private)); return 2; } diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c index 0e64d84..a918cc0 100644 --- a/drivers/staging/comedi/drivers/pcmmio.c +++ b/drivers/staging/comedi/drivers/pcmmio.c @@ -275,8 +275,6 @@ static int pcmmio_dio_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { int byte_no; - if (insn->n != 2) - return -EINVAL; /* NOTE: reading a 0 means this channel was high diff --git a/drivers/staging/comedi/drivers/pcmuio.c b/drivers/staging/comedi/drivers/pcmuio.c index 4426e17..33f740e 100644 --- a/drivers/staging/comedi/drivers/pcmuio.c +++ b/drivers/staging/comedi/drivers/pcmuio.c @@ -211,8 +211,6 @@ static int pcmuio_dio_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { int byte_no; - if (insn->n != 2) - return -EINVAL; /* NOTE: reading a 0 means this channel was high diff --git a/drivers/staging/comedi/drivers/poc.c b/drivers/staging/comedi/drivers/poc.c index a129cca..a655b90 100644 --- a/drivers/staging/comedi/drivers/poc.c +++ b/drivers/staging/comedi/drivers/poc.c @@ -99,9 +99,6 @@ static int pcl733_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - data[1] = inb(dev->iobase + 0); data[1] |= (inb(dev->iobase + 1) << 8); data[1] |= (inb(dev->iobase + 2) << 16); @@ -114,8 +111,6 @@ static int pcl734_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; if (data[0]) { s->state &= ~data[0]; s->state |= (data[0] & data[1]); diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index c3c8097..6ff1fa0 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -1811,9 +1811,6 @@ static int rtd_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - /* The insn data is a mask in data[0] and the new data * in data[1], each channel cooresponding to a bit. */ if (data[0]) { diff --git a/drivers/staging/comedi/drivers/rti800.c b/drivers/staging/comedi/drivers/rti800.c index 966ac2c..b6f2199 100644 --- a/drivers/staging/comedi/drivers/rti800.c +++ b/drivers/staging/comedi/drivers/rti800.c @@ -263,8 +263,6 @@ static int rti800_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; data[1] = inb(dev->iobase + RTI800_DI); return 2; } @@ -273,9 +271,6 @@ static int rti800_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - if (data[0]) { s->state &= ~data[0]; s->state |= data[0] & data[1]; diff --git a/drivers/staging/comedi/drivers/s526.c b/drivers/staging/comedi/drivers/s526.c index 141bc9e..b1dd224 100644 --- a/drivers/staging/comedi/drivers/s526.c +++ b/drivers/staging/comedi/drivers/s526.c @@ -678,9 +678,6 @@ static int s526_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - /* The insn data is a mask in data[0] and the new data * in data[1], each channel cooresponding to a bit. */ if (data[0]) { diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 32e03bc..182074c 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -2140,18 +2140,6 @@ static int s626_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - - /* Length of data must be 2 (mask and new data, see below) */ - if (insn->n == 0) - return 0; - - if (insn->n != 2) { - printk - ("comedi%d: s626: s626_dio_insn_bits(): Invalid instruction length\n", - dev->minor); - return -EINVAL; - } - /* * The insn data consists of a mask in data[0] and the new data in * data[1]. The mask defines which bits we are concerning about. diff --git a/drivers/staging/comedi/drivers/skel.c b/drivers/staging/comedi/drivers/skel.c index 92d44c1d..67207de 100644 --- a/drivers/staging/comedi/drivers/skel.c +++ b/drivers/staging/comedi/drivers/skel.c @@ -561,9 +561,6 @@ static int skel_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (insn->n != 2) - return -EINVAL; - /* The insn data is a mask in data[0] and the new data * in data[1], each channel cooresponding to a bit. */ if (data[0]) { diff --git a/drivers/staging/comedi/drivers/ssv_dnp.c b/drivers/staging/comedi/drivers/ssv_dnp.c index b12bafe..f7bf3a2 100644 --- a/drivers/staging/comedi/drivers/ssv_dnp.c +++ b/drivers/staging/comedi/drivers/ssv_dnp.c @@ -77,10 +77,6 @@ static int dnp_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - - if (insn->n != 2) - return -EINVAL; /* insn uses data[0] and data[1] */ - /* The insn data is a mask in data[0] and the new data in data[1], */ /* each channel cooresponding to a bit. */ diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 0386fd4..3185e1c 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -1780,9 +1780,6 @@ static int usbdux_dio_insn_bits(struct comedi_device *dev, if (!this_usbduxsub) return -EFAULT; - if (insn->n != 2) - return -EINVAL; - down(&this_usbduxsub->sem); if (!(this_usbduxsub->probed)) { diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index 699deb1..a93cc5d 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -1845,9 +1845,6 @@ static int usbdux_dio_insn_bits(struct comedi_device *dev, if (!this_usbduxsub) return -EFAULT; - if (insn->n != 2) - return -EINVAL; - down(&this_usbduxsub->sem); if (!(this_usbduxsub->probed)) { -- cgit v0.10.2 From a2714e3e42e746d6c8525c35fdcc58fb60c2830d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 18 Jun 2012 13:16:35 -0700 Subject: staging: comedi: fix return value for insn_bits functions The comedi_subdevice 'insn_bits' functions return the number of data elements used to perform the command. Most of the insn_bits functions return an open coded '2' to indicate this. The same value is available as 'insn->n'. Return that instead to better indicate what the return means. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/acl7225b.c b/drivers/staging/comedi/drivers/acl7225b.c index ab765d3..ddba5db 100644 --- a/drivers/staging/comedi/drivers/acl7225b.c +++ b/drivers/staging/comedi/drivers/acl7225b.c @@ -43,7 +43,7 @@ static int acl7225b_do_insn(struct comedi_device *dev, data[1] = s->state; - return 2; + return insn->n; } static int acl7225b_di_insn(struct comedi_device *dev, @@ -53,7 +53,7 @@ static int acl7225b_di_insn(struct comedi_device *dev, data[1] = inb(dev->iobase + (unsigned long)s->private) | (inb(dev->iobase + (unsigned long)s->private + 1) << 8); - return 2; + return insn->n; } static int acl7225b_attach(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index f0a5958..79f6765 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -157,7 +157,7 @@ static int pci6208_ao_rinsn(struct comedi_device *dev, * it was a purely digital output subdevice */ /* data[1]=s->state; */ -/* return 2; */ +/* return insn->n; */ /* } */ /* static int pci6208_dio_insn_config(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/adl_pci7230.c b/drivers/staging/comedi/drivers/adl_pci7230.c index d75734a..cfb8bb0 100644 --- a/drivers/staging/comedi/drivers/adl_pci7230.c +++ b/drivers/staging/comedi/drivers/adl_pci7230.c @@ -61,7 +61,7 @@ static int adl_pci7230_do_insn_bits(struct comedi_device *dev, outl((s->state << 16) & 0xffffffff, dev->iobase + PCI7230_DO); } - return 2; + return insn->n; } static int adl_pci7230_di_insn_bits(struct comedi_device *dev, @@ -71,7 +71,7 @@ static int adl_pci7230_di_insn_bits(struct comedi_device *dev, { data[1] = inl(dev->iobase + PCI7230_DI) & 0xffffffff; - return 2; + return insn->n; } static struct pci_dev *adl_pci7230_find_pci(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/adl_pci7432.c b/drivers/staging/comedi/drivers/adl_pci7432.c index b071a08..10683c2 100644 --- a/drivers/staging/comedi/drivers/adl_pci7432.c +++ b/drivers/staging/comedi/drivers/adl_pci7432.c @@ -65,7 +65,7 @@ static int adl_pci7432_do_insn_bits(struct comedi_device *dev, dev->iobase + PCI7432_DO); outl(s->state & 0xffffffff, dev->iobase + PCI7432_DO); } - return 2; + return insn->n; } static int adl_pci7432_di_insn_bits(struct comedi_device *dev, @@ -79,7 +79,7 @@ static int adl_pci7432_di_insn_bits(struct comedi_device *dev, data[1] = inl(dev->iobase + PCI7432_DI) & 0xffffffff; printk(KERN_DEBUG "comedi: data1 %8x\n", data[1]); - return 2; + return insn->n; } static struct pci_dev *adl_pci7432_find_pci(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c index 4f2cea8..c41cfc5 100644 --- a/drivers/staging/comedi/drivers/adl_pci9111.c +++ b/drivers/staging/comedi/drivers/adl_pci9111.c @@ -1153,7 +1153,7 @@ static int pci9111_di_insn_bits(struct comedi_device *dev, bits = pci9111_di_get_bits(); data[1] = bits; - return 2; + return insn->n; } /* Digital outputs */ @@ -1179,7 +1179,7 @@ static int pci9111_do_insn_bits(struct comedi_device *dev, data[1] = bits; - return 2; + return insn->n; } /* ------------------------------------------------------------------ */ diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 9a7b6a5..4482aab 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -492,7 +492,7 @@ static int pci9118_insn_bits_di(struct comedi_device *dev, { data[1] = inl(dev->iobase + PCI9118_DI) & 0xf; - return 2; + return insn->n; } /* @@ -509,7 +509,7 @@ static int pci9118_insn_bits_do(struct comedi_device *dev, } data[1] = s->state; - return 2; + return insn->n; } /* diff --git a/drivers/staging/comedi/drivers/adq12b.c b/drivers/staging/comedi/drivers/adq12b.c index f7bb145..6df51c8 100644 --- a/drivers/staging/comedi/drivers/adq12b.c +++ b/drivers/staging/comedi/drivers/adq12b.c @@ -193,7 +193,7 @@ static int adq12b_di_insn_bits(struct comedi_device *dev, /* only bits 0-4 have information about digital inputs */ data[1] = (inb(dev->iobase + ADQ12B_STINR) & (0x1f)); - return 2; + return insn->n; } static int adq12b_do_insn_bits(struct comedi_device *dev, @@ -215,7 +215,7 @@ static int adq12b_do_insn_bits(struct comedi_device *dev, data[1] = devpriv->digital_state; - return 2; + return insn->n; } static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 94d69e4..0ed1ff9 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -435,7 +435,7 @@ static int pci171x_insn_bits_di(struct comedi_device *dev, { data[1] = inw(dev->iobase + PCI171x_DI); - return 2; + return insn->n; } /* @@ -452,7 +452,7 @@ static int pci171x_insn_bits_do(struct comedi_device *dev, } data[1] = s->state; - return 2; + return insn->n; } /* diff --git a/drivers/staging/comedi/drivers/adv_pci1723.c b/drivers/staging/comedi/drivers/adv_pci1723.c index d37c14d..5c99c74 100644 --- a/drivers/staging/comedi/drivers/adv_pci1723.c +++ b/drivers/staging/comedi/drivers/adv_pci1723.c @@ -284,7 +284,7 @@ static int pci1723_dio_insn_bits(struct comedi_device *dev, outw(s->state, dev->iobase + PCI1723_WRITE_DIGITAL_OUTPUT_CMD); } data[1] = inw(dev->iobase + PCI1723_READ_DIGITAL_INPUT_DATA); - return 2; + return insn->n; } static int pci1723_attach(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 176a801..ad653a5 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -424,7 +424,7 @@ static int pci_dio_insn_bits_di_b(struct comedi_device *dev, data[1] |= inb(dev->iobase + d->addr + i) << (8 * i); - return 2; + return insn->n; } /* @@ -441,7 +441,7 @@ static int pci_dio_insn_bits_di_w(struct comedi_device *dev, for (i = 0; i < d->regs; i++) data[1] |= inw(dev->iobase + d->addr + 2 * i) << (16 * i); - return 2; + return insn->n; } /* @@ -463,7 +463,7 @@ static int pci_dio_insn_bits_do_b(struct comedi_device *dev, } data[1] = s->state; - return 2; + return insn->n; } /* @@ -485,7 +485,7 @@ static int pci_dio_insn_bits_do_w(struct comedi_device *dev, } data[1] = s->state; - return 2; + return insn->n; } /* @@ -634,7 +634,7 @@ static int pci1760_insn_bits_di(struct comedi_device *dev, { data[1] = inb(dev->iobase + IMB3); - return 2; + return insn->n; } /* @@ -663,7 +663,7 @@ static int pci1760_insn_bits_do(struct comedi_device *dev, } data[1] = s->state; - return 2; + return insn->n; } /* diff --git a/drivers/staging/comedi/drivers/aio_iiro_16.c b/drivers/staging/comedi/drivers/aio_iiro_16.c index 3434107..16f28f6 100644 --- a/drivers/staging/comedi/drivers/aio_iiro_16.c +++ b/drivers/staging/comedi/drivers/aio_iiro_16.c @@ -80,7 +80,7 @@ static int aio_iiro_16_dio_insn_bits_write(struct comedi_device *dev, data[1] = s->state; - return 2; + return insn->n; } static int aio_iiro_16_dio_insn_bits_read(struct comedi_device *dev, @@ -92,7 +92,7 @@ static int aio_iiro_16_dio_insn_bits_read(struct comedi_device *dev, data[1] |= inb(dev->iobase + AIO_IIRO_16_INPUT_0_7); data[1] |= inb(dev->iobase + AIO_IIRO_16_INPUT_8_15) << 8; - return 2; + return insn->n; } static int aio_iiro_16_attach(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index c67b09f..55f3050 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -551,7 +551,7 @@ dio200_subdev_intr_insn_bits(struct comedi_device *dev, data[0] = 0; } - return 2; + return insn->n; } /* diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c index e55321e..77dae8e 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236.c +++ b/drivers/staging/comedi/drivers/amplc_pc236.c @@ -293,7 +293,7 @@ static int pc236_intr_insn(struct comedi_device *dev, unsigned int *data) { data[1] = 0; - return 2; + return insn->n; } /* diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index a018d81..e90178d 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c @@ -194,7 +194,7 @@ static int pc263_do_insn_bits(struct comedi_device *dev, outb(s->state & 0xFF, dev->iobase); outb(s->state >> 8, dev->iobase + 1); } - return 2; + return insn->n; } static void pc263_report_attach(struct comedi_device *dev) diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 515dda0..6866e25 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -560,7 +560,7 @@ static int das16cs_dio_insn_bits(struct comedi_device *dev, * input and output lines. */ data[1] = inw(dev->iobase + 16); - return 2; + return insn->n; } static int das16cs_dio_insn_config(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 7aacff3..11ce3fdf 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -3617,7 +3617,7 @@ static int di_rbits(struct comedi_device *dev, struct comedi_subdevice *s, data[1] = bits; data[0] = 0; - return 2; + return insn->n; } static int do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, @@ -3633,7 +3633,7 @@ static int do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, data[1] = s->state; - return 2; + return insn->n; } static int dio_60xx_config_insn(struct comedi_device *dev, @@ -3676,7 +3676,7 @@ static int dio_60xx_wbits(struct comedi_device *dev, struct comedi_subdevice *s, data[1] = readb(priv(dev)->dio_counter_iobase + DIO_DATA_60XX_REG); - return 2; + return insn->n; } static void caldac_write(struct comedi_device *dev, unsigned int channel, diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index 10c3c35..9a63cac 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -110,7 +110,7 @@ static int parport_insn_a(struct comedi_device *dev, struct comedi_subdevice *s, data[1] = inb(dev->iobase + PARPORT_A); - return 2; + return insn->n; } static int parport_insn_config_a(struct comedi_device *dev, @@ -139,7 +139,7 @@ static int parport_insn_b(struct comedi_device *dev, struct comedi_subdevice *s, data[1] = (inb(dev->iobase + PARPORT_B) >> 3); - return 2; + return insn->n; } static int parport_insn_c(struct comedi_device *dev, struct comedi_subdevice *s, @@ -155,7 +155,7 @@ static int parport_insn_c(struct comedi_device *dev, struct comedi_subdevice *s, data[1] = devpriv->c_data & 0xf; - return 2; + return insn->n; } static int parport_intr_insn(struct comedi_device *dev, @@ -163,7 +163,7 @@ static int parport_intr_insn(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { data[1] = 0; - return 2; + return insn->n; } static int parport_intr_cmdtest(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/contec_pci_dio.c b/drivers/staging/comedi/drivers/contec_pci_dio.c index 6aec9a6..ee769e0 100644 --- a/drivers/staging/comedi/drivers/contec_pci_dio.c +++ b/drivers/staging/comedi/drivers/contec_pci_dio.c @@ -81,7 +81,7 @@ static int contec_do_insn_bits(struct comedi_device *dev, dev->iobase + thisboard->out_offs); outw(s->state, dev->iobase + thisboard->out_offs); } - return 2; + return insn->n; } static int contec_di_insn_bits(struct comedi_device *dev, @@ -94,7 +94,7 @@ static int contec_di_insn_bits(struct comedi_device *dev, data[1] = inw(dev->iobase + thisboard->in_offs); - return 2; + return insn->n; } static int contec_attach(struct comedi_device *dev, struct comedi_devconfig *it) diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index c4627a6..d0128e0 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -313,7 +313,7 @@ static int das08_di_rbits(struct comedi_device *dev, struct comedi_subdevice *s, data[0] = 0; data[1] = DAS08_IP(inb(dev->iobase + DAS08_STATUS)); - return 2; + return insn->n; } static int das08_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, @@ -338,7 +338,7 @@ static int das08_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, data[1] = wbits; - return 2; + return insn->n; } static int __maybe_unused @@ -348,7 +348,7 @@ das08jr_di_rbits(struct comedi_device *dev, struct comedi_subdevice *s, data[0] = 0; data[1] = inb(dev->iobase + DAS08JR_DIO); - return 2; + return insn->n; } static int __maybe_unused @@ -365,7 +365,7 @@ das08jr_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, data[1] = devpriv->do_bits; - return 2; + return insn->n; } static int __maybe_unused diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c index 0c6ad10..895cc77 100644 --- a/drivers/staging/comedi/drivers/das16.c +++ b/drivers/staging/comedi/drivers/das16.c @@ -812,7 +812,7 @@ static int das16_di_rbits(struct comedi_device *dev, struct comedi_subdevice *s, data[1] = bits; data[0] = 0; - return 2; + return insn->n; } static int das16_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, @@ -832,7 +832,7 @@ static int das16_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, outb(s->state, dev->iobase + DAS16_DIO); - return 2; + return insn->n; } static int das16_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, diff --git a/drivers/staging/comedi/drivers/das16m1.c b/drivers/staging/comedi/drivers/das16m1.c index f3fba13..2009263 100644 --- a/drivers/staging/comedi/drivers/das16m1.c +++ b/drivers/staging/comedi/drivers/das16m1.c @@ -428,7 +428,7 @@ static int das16m1_di_rbits(struct comedi_device *dev, data[1] = bits; data[0] = 0; - return 2; + return insn->n; } static int das16m1_do_wbits(struct comedi_device *dev, @@ -449,7 +449,7 @@ static int das16m1_do_wbits(struct comedi_device *dev, outb(devpriv->do_bits, dev->iobase + DAS16M1_DIO); - return 2; + return insn->n; } static void das16m1_handler(struct comedi_device *dev, unsigned int status) diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c index 3650287..25e7e56 100644 --- a/drivers/staging/comedi/drivers/das1800.c +++ b/drivers/staging/comedi/drivers/das1800.c @@ -1353,7 +1353,7 @@ static int das1800_di_rbits(struct comedi_device *dev, data[1] = inb(dev->iobase + DAS1800_DIGITAL) & 0xf; data[0] = 0; - return 2; + return insn->n; } /* writes to digital output channels */ @@ -1374,7 +1374,7 @@ static int das1800_do_wbits(struct comedi_device *dev, data[1] = devpriv->do_bits; - return 2; + return insn->n; } static int das1800_init_dma(struct comedi_device *dev, unsigned int dma0, diff --git a/drivers/staging/comedi/drivers/das800.c b/drivers/staging/comedi/drivers/das800.c index 917b318..a0959a5 100644 --- a/drivers/staging/comedi/drivers/das800.c +++ b/drivers/staging/comedi/drivers/das800.c @@ -875,7 +875,7 @@ static int das800_di_rbits(struct comedi_device *dev, data[1] = bits; data[0] = 0; - return 2; + return insn->n; } static int das800_do_wbits(struct comedi_device *dev, @@ -899,7 +899,7 @@ static int das800_do_wbits(struct comedi_device *dev, data[1] = wbits; - return 2; + return insn->n; } /* loads counters with divisor1, divisor2 from private structure */ diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c index 7cc9d20..af353167 100644 --- a/drivers/staging/comedi/drivers/dmm32at.c +++ b/drivers/staging/comedi/drivers/dmm32at.c @@ -956,7 +956,7 @@ static int dmm32at_dio_insn_bits(struct comedi_device *dev, * it was a purely digital output subdevice */ /* data[1]=s->state; */ - return 2; + return insn->n; } static int dmm32at_dio_insn_config(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/dt2801.c b/drivers/staging/comedi/drivers/dt2801.c index d0bbbbb..d332269 100644 --- a/drivers/staging/comedi/drivers/dt2801.c +++ b/drivers/staging/comedi/drivers/dt2801.c @@ -546,7 +546,7 @@ static int dt2801_dio_insn_bits(struct comedi_device *dev, dt2801_writedata(dev, which); dt2801_readdata(dev, data + 1); - return 2; + return insn->n; } static int dt2801_dio_insn_config(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index b239f38..290b933 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -354,7 +354,7 @@ static int dt2811_di_insn_bits(struct comedi_device *dev, { data[1] = inb(dev->iobase + DT2811_DIO); - return 2; + return insn->n; } static int dt2811_do_insn_bits(struct comedi_device *dev, @@ -367,7 +367,7 @@ static int dt2811_do_insn_bits(struct comedi_device *dev, data[1] = s->state; - return 2; + return insn->n; } /* diff --git a/drivers/staging/comedi/drivers/dt2817.c b/drivers/staging/comedi/drivers/dt2817.c index 9282ca5..beba044 100644 --- a/drivers/staging/comedi/drivers/dt2817.c +++ b/drivers/staging/comedi/drivers/dt2817.c @@ -119,7 +119,7 @@ static int dt2817_dio_insn_bits(struct comedi_device *dev, data[1] |= (inb(dev->iobase + DT2817_DATA + 2) << 16); data[1] |= (inb(dev->iobase + DT2817_DATA + 3) << 24); - return 2; + return insn->n; } static int dt2817_attach(struct comedi_device *dev, struct comedi_devconfig *it) diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c index 9c0a0df..4af3343 100644 --- a/drivers/staging/comedi/drivers/dt282x.c +++ b/drivers/staging/comedi/drivers/dt282x.c @@ -1038,7 +1038,7 @@ static int dt282x_dio_insn_bits(struct comedi_device *dev, } data[1] = inw(dev->iobase + DT2821_DIODAT); - return 2; + return insn->n; } static int dt282x_dio_insn_config(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c index 6acfe05..d1d99a3 100644 --- a/drivers/staging/comedi/drivers/dt3000.c +++ b/drivers/staging/comedi/drivers/dt3000.c @@ -752,7 +752,7 @@ static int dt3k_dio_insn_bits(struct comedi_device *dev, } data[1] = dt3k_readsingle(dev, SUBS_DIN, 0, 0); - return 2; + return insn->n; } static int dt3k_mem_insn_read(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/dyna_pci10xx.c b/drivers/staging/comedi/drivers/dyna_pci10xx.c index 78f3c8b..d0e3679 100644 --- a/drivers/staging/comedi/drivers/dyna_pci10xx.c +++ b/drivers/staging/comedi/drivers/dyna_pci10xx.c @@ -198,7 +198,7 @@ static int dyna_pci10xx_di_insn_bits(struct comedi_device *dev, data[1] = d; data[0] = s->state; mutex_unlock(&devpriv->mutex); - return 2; + return insn->n; } /* digital output bit interface */ @@ -226,7 +226,7 @@ static int dyna_pci10xx_do_insn_bits(struct comedi_device *dev, */ data[1] = s->state; mutex_unlock(&devpriv->mutex); - return 2; + return insn->n; } /******************************************************************************/ diff --git a/drivers/staging/comedi/drivers/icp_multi.c b/drivers/staging/comedi/drivers/icp_multi.c index 544bed8..b10ebdb 100644 --- a/drivers/staging/comedi/drivers/icp_multi.c +++ b/drivers/staging/comedi/drivers/icp_multi.c @@ -542,7 +542,7 @@ static int icp_multi_insn_bits_di(struct comedi_device *dev, { data[1] = readw(devpriv->io_addr + ICP_MULTI_DI); - return 2; + return insn->n; } /* @@ -585,7 +585,7 @@ static int icp_multi_insn_bits_do(struct comedi_device *dev, #ifdef ICP_MULTI_EXTDEBUG printk(KERN_DEBUG "icp multi EDBG: END: icp_multi_insn_bits_do(...)\n"); #endif - return 2; + return insn->n; } /* diff --git a/drivers/staging/comedi/drivers/ii_pci20kc.c b/drivers/staging/comedi/drivers/ii_pci20kc.c index bea3d03..0f9cfe6 100644 --- a/drivers/staging/comedi/drivers/ii_pci20kc.c +++ b/drivers/staging/comedi/drivers/ii_pci20kc.c @@ -565,7 +565,7 @@ static int pci20xxx_dio_insn_bits(struct comedi_device *dev, data[1] |= readb(devpriv->ioaddr + PCI20000_DIO_2) << 16; data[1] |= readb(devpriv->ioaddr + PCI20000_DIO_3) << 24; - return 2; + return insn->n; } static void pci20xxx_dio_config(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 631b422..9a8258e 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -1675,7 +1675,7 @@ static int me4000_dio_insn_bits(struct comedi_device *dev, ((inl(info->dio_context.port_2_reg) & 0xFF) << 16) | ((inl(info->dio_context.port_3_reg) & 0xFF) << 24); - return 2; + return insn->n; } static int me4000_dio_insn_config(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/me_daq.c b/drivers/staging/comedi/drivers/me_daq.c index ae3b046..1803d66 100644 --- a/drivers/staging/comedi/drivers/me_daq.c +++ b/drivers/staging/comedi/drivers/me_daq.c @@ -331,7 +331,7 @@ static int me_dio_insn_bits(struct comedi_device *dev, data[1] |= readw(dev_private->me_regbase + ME_DIO_PORT_B) << 16; } - return 2; + return insn->n; } /* diff --git a/drivers/staging/comedi/drivers/mpc8260cpm.c b/drivers/staging/comedi/drivers/mpc8260cpm.c index a6311b1..a7fda8f 100644 --- a/drivers/staging/comedi/drivers/mpc8260cpm.c +++ b/drivers/staging/comedi/drivers/mpc8260cpm.c @@ -113,7 +113,7 @@ static int mpc8260cpm_dio_bits(struct comedi_device *dev, p = cpm_pdat((int)s->private); - return 2; + return insn->n; } static int mpc8260cpm_attach(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/multiq3.c b/drivers/staging/comedi/drivers/multiq3.c index d1a8e91..eccbe1f 100644 --- a/drivers/staging/comedi/drivers/multiq3.c +++ b/drivers/staging/comedi/drivers/multiq3.c @@ -163,7 +163,7 @@ static int multiq3_di_insn_bits(struct comedi_device *dev, { data[1] = inw(dev->iobase + MULTIQ3_DIGIN_PORT); - return 2; + return insn->n; } static int multiq3_do_insn_bits(struct comedi_device *dev, @@ -176,7 +176,7 @@ static int multiq3_do_insn_bits(struct comedi_device *dev, data[1] = s->state; - return 2; + return insn->n; } static int multiq3_encoder_insn_read(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/ni_6527.c b/drivers/staging/comedi/drivers/ni_6527.c index eec44a0..a80c52f 100644 --- a/drivers/staging/comedi/drivers/ni_6527.c +++ b/drivers/staging/comedi/drivers/ni_6527.c @@ -178,7 +178,7 @@ static int ni6527_di_insn_bits(struct comedi_device *dev, data[1] |= readb(devpriv->mite->daq_io_addr + Port_Register(1)) << 8; data[1] |= readb(devpriv->mite->daq_io_addr + Port_Register(2)) << 16; - return 2; + return insn->n; } static int ni6527_do_insn_bits(struct comedi_device *dev, @@ -206,7 +206,7 @@ static int ni6527_do_insn_bits(struct comedi_device *dev, } data[1] = s->state; - return 2; + return insn->n; } static irqreturn_t ni6527_interrupt(int irq, void *d) @@ -335,7 +335,7 @@ static int ni6527_intr_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { data[1] = 0; - return 2; + return insn->n; } static int ni6527_intr_insn_config(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index f92f8ab..bce39f1 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -602,7 +602,7 @@ static int ni_65xx_intr_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { data[1] = 0; - return 2; + return insn->n; } static int ni_65xx_intr_insn_config(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 5391a39..5e863ff 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -1285,7 +1285,7 @@ static int ni_660x_dio_insn_bits(struct comedi_device *dev, data[1] = (ni_660x_read_register(dev, 0, DIO32Input) >> base_bitfield_channel); - return 2; + return insn->n; } static void ni_660x_select_pfi_output(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index b62b427..9032bac 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -319,7 +319,7 @@ static int ni_670x_dio_insn_bits(struct comedi_device *dev, * input lines. */ data[1] = readl(devpriv->mite->daq_io_addr + DIO_PORT0_DATA_OFFSET); - return 2; + return insn->n; } static int ni_670x_dio_insn_config(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/ni_at_ao.c b/drivers/staging/comedi/drivers/ni_at_ao.c index 28848bc..62c8c44 100644 --- a/drivers/staging/comedi/drivers/ni_at_ao.c +++ b/drivers/staging/comedi/drivers/ni_at_ao.c @@ -247,7 +247,7 @@ static int atao_dio_insn_bits(struct comedi_device *dev, data[1] = inw(dev->iobase + ATAO_DIN); - return 2; + return insn->n; } static int atao_dio_insn_config(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/ni_atmio16d.c b/drivers/staging/comedi/drivers/ni_atmio16d.c index 54c0394..2c78d3d 100644 --- a/drivers/staging/comedi/drivers/ni_atmio16d.c +++ b/drivers/staging/comedi/drivers/ni_atmio16d.c @@ -606,7 +606,7 @@ static int atmio16d_dio_insn_bits(struct comedi_device *dev, } data[1] = inw(dev->iobase + MIO_16_DIG_IN_REG); - return 2; + return insn->n; } static int atmio16d_dio_insn_config(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 53b0173..4b42809 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -174,7 +174,7 @@ static int subdev_700_insn(struct comedi_device *dev, data[1] = s->state & 0xff; data[1] |= CALLBACK_FUNC(0, _700_DATA, 0, CALLBACK_ARG) << 8; - return 2; + return insn->n; } static int subdev_700_insn_config(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 42df64e..cf0e0d14 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -3584,7 +3584,7 @@ static int ni_dio_insn_bits(struct comedi_device *dev, } data[1] = devpriv->stc_readw(dev, DIO_Parallel_Input_Register); - return 2; + return insn->n; } static int ni_m_series_dio_insn_config(struct comedi_device *dev, @@ -3636,7 +3636,7 @@ static int ni_m_series_dio_insn_bits(struct comedi_device *dev, } data[1] = ni_readl(M_Offset_Static_Digital_Input); - return 2; + return insn->n; } static int ni_cdio_cmdtest(struct comedi_device *dev, @@ -5394,7 +5394,7 @@ static int ni_pfi_insn_bits(struct comedi_device *dev, ni_writew(s->state, M_Offset_PFI_DO); } data[1] = ni_readw(M_Offset_PFI_DI); - return 2; + return insn->n; } static int ni_pfi_insn_config(struct comedi_device *dev, @@ -5485,7 +5485,7 @@ static int ni_rtsi_insn_bits(struct comedi_device *dev, { data[1] = 0; - return 2; + return insn->n; } /* Find best multiplier/divider to try and get the PLL running at 80 MHz diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c index 133ab2f..0a55de9 100644 --- a/drivers/staging/comedi/drivers/ni_pcidio.c +++ b/drivers/staging/comedi/drivers/ni_pcidio.c @@ -752,7 +752,7 @@ static int ni_pcidio_insn_bits(struct comedi_device *dev, } data[1] = readl(devpriv->mite->daq_io_addr + Port_IO(0)); - return 2; + return insn->n; } static int ni_pcidio_cmdtest(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/pcl711.c b/drivers/staging/comedi/drivers/pcl711.c index 0df086a..bb72d0b 100644 --- a/drivers/staging/comedi/drivers/pcl711.c +++ b/drivers/staging/comedi/drivers/pcl711.c @@ -452,7 +452,7 @@ static int pcl711_di_insn_bits(struct comedi_device *dev, data[1] = inb(dev->iobase + PCL711_DI_LO) | (inb(dev->iobase + PCL711_DI_HI) << 8); - return 2; + return insn->n; } /* Digital port write - Untested on 8112 */ @@ -471,7 +471,7 @@ static int pcl711_do_insn_bits(struct comedi_device *dev, data[1] = s->state; - return 2; + return insn->n; } static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it) diff --git a/drivers/staging/comedi/drivers/pcl725.c b/drivers/staging/comedi/drivers/pcl725.c index 433ea05..d5b60cf 100644 --- a/drivers/staging/comedi/drivers/pcl725.c +++ b/drivers/staging/comedi/drivers/pcl725.c @@ -31,7 +31,7 @@ static int pcl725_do_insn(struct comedi_device *dev, struct comedi_subdevice *s, data[1] = s->state; - return 2; + return insn->n; } static int pcl725_di_insn(struct comedi_device *dev, struct comedi_subdevice *s, @@ -39,7 +39,7 @@ static int pcl725_di_insn(struct comedi_device *dev, struct comedi_subdevice *s, { data[1] = inb(dev->iobase + PCL725_DI); - return 2; + return insn->n; } static int pcl725_attach(struct comedi_device *dev, struct comedi_devconfig *it) diff --git a/drivers/staging/comedi/drivers/pcl726.c b/drivers/staging/comedi/drivers/pcl726.c index dfff9af..2b10f1d 100644 --- a/drivers/staging/comedi/drivers/pcl726.c +++ b/drivers/staging/comedi/drivers/pcl726.c @@ -200,7 +200,7 @@ static int pcl726_di_insn_bits(struct comedi_device *dev, data[1] = inb(dev->iobase + board->di_lo) | (inb(dev->iobase + board->di_hi) << 8); - return 2; + return insn->n; } static int pcl726_do_insn_bits(struct comedi_device *dev, @@ -220,7 +220,7 @@ static int pcl726_do_insn_bits(struct comedi_device *dev, data[1] = s->state; - return 2; + return insn->n; } static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it) diff --git a/drivers/staging/comedi/drivers/pcl730.c b/drivers/staging/comedi/drivers/pcl730.c index d40caca..4675ec5 100644 --- a/drivers/staging/comedi/drivers/pcl730.c +++ b/drivers/staging/comedi/drivers/pcl730.c @@ -48,7 +48,7 @@ static int pcl730_do_insn(struct comedi_device *dev, struct comedi_subdevice *s, data[1] = s->state; - return 2; + return insn->n; } static int pcl730_di_insn(struct comedi_device *dev, struct comedi_subdevice *s, @@ -57,7 +57,7 @@ static int pcl730_di_insn(struct comedi_device *dev, struct comedi_subdevice *s, data[1] = inb(dev->iobase + ((unsigned long)s->private)) | (inb(dev->iobase + ((unsigned long)s->private) + 1) << 8); - return 2; + return insn->n; } static int pcl730_attach(struct comedi_device *dev, struct comedi_devconfig *it) diff --git a/drivers/staging/comedi/drivers/pcl812.c b/drivers/staging/comedi/drivers/pcl812.c index 1c146c8..578fd89 100644 --- a/drivers/staging/comedi/drivers/pcl812.c +++ b/drivers/staging/comedi/drivers/pcl812.c @@ -504,7 +504,7 @@ static int pcl812_di_insn_bits(struct comedi_device *dev, data[1] = inb(dev->iobase + PCL812_DI_LO); data[1] |= inb(dev->iobase + PCL812_DI_HI) << 8; - return 2; + return insn->n; } /* @@ -522,7 +522,7 @@ static int pcl812_do_insn_bits(struct comedi_device *dev, } data[1] = s->state; - return 2; + return insn->n; } /* diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c index 13eaadf..34169c1 100644 --- a/drivers/staging/comedi/drivers/pcl818.c +++ b/drivers/staging/comedi/drivers/pcl818.c @@ -445,7 +445,7 @@ static int pcl818_di_insn_bits(struct comedi_device *dev, data[1] = inb(dev->iobase + PCL818_DI_LO) | (inb(dev->iobase + PCL818_DI_HI) << 8); - return 2; + return insn->n; } /* @@ -466,7 +466,7 @@ static int pcl818_do_insn_bits(struct comedi_device *dev, data[1] = s->state; - return 2; + return insn->n; } /* diff --git a/drivers/staging/comedi/drivers/pcm3730.c b/drivers/staging/comedi/drivers/pcm3730.c index 311fe2d..d65e0bd 100644 --- a/drivers/staging/comedi/drivers/pcm3730.c +++ b/drivers/staging/comedi/drivers/pcm3730.c @@ -39,7 +39,7 @@ static int pcm3730_do_insn_bits(struct comedi_device *dev, } data[1] = s->state; - return 2; + return insn->n; } static int pcm3730_di_insn_bits(struct comedi_device *dev, @@ -47,7 +47,7 @@ static int pcm3730_di_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { data[1] = inb(dev->iobase + (unsigned long)(s->private)); - return 2; + return insn->n; } static int pcm3730_attach(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c index a918cc0..82a60d6 100644 --- a/drivers/staging/comedi/drivers/pcmmio.c +++ b/drivers/staging/comedi/drivers/pcmmio.c @@ -344,7 +344,7 @@ static int pcmmio_dio_insn_bits(struct comedi_device *dev, printk(KERN_DEBUG "s->state %08x data_out %08x\n", s->state, data[1]); #endif - return 2; + return insn->n; } /* The input or output configuration of each digital line is diff --git a/drivers/staging/comedi/drivers/pcmuio.c b/drivers/staging/comedi/drivers/pcmuio.c index 33f740e..feef3d0 100644 --- a/drivers/staging/comedi/drivers/pcmuio.c +++ b/drivers/staging/comedi/drivers/pcmuio.c @@ -277,7 +277,7 @@ static int pcmuio_dio_insn_bits(struct comedi_device *dev, data[1]); #endif - return 2; + return insn->n; } /* The input or output configuration of each digital line is diff --git a/drivers/staging/comedi/drivers/poc.c b/drivers/staging/comedi/drivers/poc.c index a655b90..c253bb9 100644 --- a/drivers/staging/comedi/drivers/poc.c +++ b/drivers/staging/comedi/drivers/poc.c @@ -104,7 +104,7 @@ static int pcl733_insn_bits(struct comedi_device *dev, data[1] |= (inb(dev->iobase + 2) << 16); data[1] |= (inb(dev->iobase + 3) << 24); - return 2; + return insn->n; } static int pcl734_insn_bits(struct comedi_device *dev, @@ -125,7 +125,7 @@ static int pcl734_insn_bits(struct comedi_device *dev, } data[1] = s->state; - return 2; + return insn->n; } static int poc_attach(struct comedi_device *dev, struct comedi_devconfig *it) diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 6ff1fa0..cc1371d 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -1826,7 +1826,7 @@ static int rtd_dio_insn_bits(struct comedi_device *dev, /*DPRINTK("rtd520:port_0 wrote: 0x%x read: 0x%x\n", s->state, data[1]); */ - return 2; + return insn->n; } /* diff --git a/drivers/staging/comedi/drivers/rti800.c b/drivers/staging/comedi/drivers/rti800.c index b6f2199..f7fa940 100644 --- a/drivers/staging/comedi/drivers/rti800.c +++ b/drivers/staging/comedi/drivers/rti800.c @@ -264,7 +264,7 @@ static int rti800_di_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { data[1] = inb(dev->iobase + RTI800_DI); - return 2; + return insn->n; } static int rti800_do_insn_bits(struct comedi_device *dev, @@ -280,7 +280,7 @@ static int rti800_do_insn_bits(struct comedi_device *dev, data[1] = s->state; - return 2; + return insn->n; } /* diff --git a/drivers/staging/comedi/drivers/s526.c b/drivers/staging/comedi/drivers/s526.c index b1dd224..358380f 100644 --- a/drivers/staging/comedi/drivers/s526.c +++ b/drivers/staging/comedi/drivers/s526.c @@ -694,7 +694,7 @@ static int s526_dio_insn_bits(struct comedi_device *dev, * it was a purely digital output subdevice */ /* data[1]=s->state & 0xFF; */ - return 2; + return insn->n; } static int s526_dio_insn_config(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 182074c..d5edd9c 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -2160,7 +2160,7 @@ static int s626_dio_insn_bits(struct comedi_device *dev, } data[1] = DEBIread(dev, diopriv->RDDIn); - return 2; + return insn->n; } static int s626_dio_insn_config(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/skel.c b/drivers/staging/comedi/drivers/skel.c index 67207de..6baac52 100644 --- a/drivers/staging/comedi/drivers/skel.c +++ b/drivers/staging/comedi/drivers/skel.c @@ -577,7 +577,7 @@ static int skel_dio_insn_bits(struct comedi_device *dev, * it was a purely digital output subdevice */ /* data[1]=s->state; */ - return 2; + return insn->n; } static int skel_dio_insn_config(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/ssv_dnp.c b/drivers/staging/comedi/drivers/ssv_dnp.c index f7bf3a2..72dbccc 100644 --- a/drivers/staging/comedi/drivers/ssv_dnp.c +++ b/drivers/staging/comedi/drivers/ssv_dnp.c @@ -110,7 +110,7 @@ static int dnp_dio_insn_bits(struct comedi_device *dev, outb(PCDR, CSCIR); data[0] += ((inb(CSCDR) & 0xF0) << 12); - return 2; + return insn->n; } diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 3185e1c..83ee669 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -1809,7 +1809,7 @@ static int usbdux_dio_insn_bits(struct comedi_device *dev, data[1] = le16_to_cpu(this_usbduxsub->insnBuffer[1]); up(&this_usbduxsub->sem); - return 2; + return insn->n; } /* reads the 4 counters, only two are used just now */ diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index a93cc5d..28f41e9 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -1884,7 +1884,7 @@ static int usbdux_dio_insn_bits(struct comedi_device *dev, s->state = data[1]; up(&this_usbduxsub->sem); - return 2; + return insn->n; } /***********************************/ -- cgit v0.10.2 From d4a7dc85289306d019378bac18fd88f35dc81b51 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 18 Jun 2012 14:45:42 -0700 Subject: staging: comedi: comedi_subdevice 'io_bits' should be an unsigned int The 'io_bits' variable in the comedi_subdevice struct is a bitmask of the input/output configuration of the the subdevice. It should be an unsigned int to correctly represent this. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess: Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index e0f3915..7363fd8 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -78,7 +78,7 @@ struct comedi_subdevice { unsigned runflags; spinlock_t spin_lock; - int io_bits; + unsigned int io_bits; unsigned int maxdata; /* if maxdata==0, use list */ const unsigned int *maxdata_list; /* list is channel specific */ -- cgit v0.10.2 From 560e8788eb659d9d301137eac1704ae1520d2fad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Mon, 18 Jun 2012 13:11:59 +0200 Subject: Staging: xgifb: reformat module parameter descriptions. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 3382272..8e0786d 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -2297,23 +2297,23 @@ static struct pci_driver xgifb_driver = { module_param(mode, charp, 0); MODULE_PARM_DESC(mode, - "\nSelects the desired default display mode in the format XxYxDepth,\n" - "eg. 1024x768x16.\n"); + "Selects the desired default display mode in the format XxYxDepth " + "(eg. 1024x768x16)."); module_param(forcecrt2type, charp, 0); MODULE_PARM_DESC(forcecrt2type, - "\nForce the second display output type. Possible values are NONE,\n" - "LCD, TV, VGA, SVIDEO or COMPOSITE.\n"); + "Force the second display output type. Possible values are NONE, " + "LCD, TV, VGA, SVIDEO or COMPOSITE."); module_param(vesa, int, 0); MODULE_PARM_DESC(vesa, - "\nSelects the desired default display mode by VESA mode number, eg.\n" - "0x117.\n"); + "Selects the desired default display mode by VESA mode number " + "(eg. 0x117)."); module_param(filter, int, 0); MODULE_PARM_DESC(filter, - "\nSelects TV flicker filter type (only for systems with a SiS301 video bridge).\n" - "(Possible values 0-7, default: [no filter])\n"); + "Selects TV flicker filter type (only for systems with a SiS301 video bridge). " + "Possible values 0-7. Default: [no filter])."); static int __init xgifb_init(void) { -- cgit v0.10.2 From 67c0bf7ac72ebe7453ce822ca0d40e54fbbee52d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Mon, 18 Jun 2012 13:12:00 +0200 Subject: Staging: xgifb: remove DEBUGPRN() macro and its uses. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove DEBUGPRN() macro which is defined as empty. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 8e0786d..143dd31 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -117,12 +117,6 @@ static inline void dumpVGAReg(void) } #endif -#if 1 -#define DEBUGPRN(x) -#else -#define DEBUGPRN(x) pr_info(x "\n"); -#endif - /* --------------- Hardware Access Routines -------------------------- */ static int XGIfb_mode_rate_to_dclock(struct vb_device_info *XGI_Pr, @@ -1054,7 +1048,6 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, int old_mode; /* unsigned char reg, reg1; */ - DEBUGPRN("Inside do_set_var"); /* printk(KERN_DEBUG "XGIfb:var->yres=%d, var->upper_margin=%d, var->lower_margin=%d, var->vsync_len=%d\n", var->yres, var->upper_margin, var->lower_margin, var->vsync_len); */ info->var.xres_virtual = var->xres_virtual; @@ -1199,7 +1192,6 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, } } XGIfb_bpp_to_var(xgifb_info, var); /*update ARGB info*/ - DEBUGPRN("End of do_set_var"); dumpVGAReg(); return 0; @@ -1321,7 +1313,6 @@ static int XGIfb_get_fix(struct fb_fix_screeninfo *fix, int con, { struct xgifb_video_info *xgifb_info = info->par; - DEBUGPRN("inside get_fix"); memset(fix, 0, sizeof(struct fb_fix_screeninfo)); strncpy(fix->id, "XGI", sizeof(fix->id) - 1); @@ -1352,7 +1343,6 @@ static int XGIfb_get_fix(struct fb_fix_screeninfo *fix, int con, fix->mmio_len = xgifb_info->mmio_size; fix->accel = FB_ACCEL_SIS_XABRE; - DEBUGPRN("end of get_fix"); return 0; } @@ -1379,8 +1369,6 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) int found_mode = 0; int refresh_rate, search_idx; - DEBUGPRN("Inside check_var"); - if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_NONINTERLACED) { vtotal = var->upper_margin + var->yres + var->lower_margin + var->vsync_len; @@ -1511,7 +1499,6 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) var->blue.msb_right = var->transp.offset = var->transp.length = var->transp.msb_right = 0; - DEBUGPRN("end of check_var"); return 0; } -- cgit v0.10.2 From d56b4c3dff9d1761bbd87746a0d92424960d2df0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Mon, 18 Jun 2012 13:12:01 +0200 Subject: Staging: xgifb: remove DPRINTK() macro and replace it with pr_debug. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 143dd31..9ffc853 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -33,12 +33,6 @@ static unsigned int refresh_rate; #undef XGIFBDEBUG #ifdef XGIFBDEBUG -#define DPRINTK(fmt, args...) pr_debug("%s: " fmt, __func__ , ## args) -#else -#define DPRINTK(fmt, args...) -#endif - -#ifdef XGIFBDEBUG static void dumpVGAReg(void) { u8 i, reg; @@ -662,8 +656,8 @@ static u8 XGIfb_search_refresh_rate(struct xgifb_video_info *xgifb_info, break; } else if (XGIfb_vrate[i].refresh > rate) { if ((XGIfb_vrate[i].refresh - rate) <= 3) { - DPRINTK("XGIfb: Adjusting rate from %d up to %d\n", - rate, XGIfb_vrate[i].refresh); + pr_debug("XGIfb: Adjusting rate from %d up to %d\n", + rate, XGIfb_vrate[i].refresh); xgifb_info->rate_idx = XGIfb_vrate[i].idx; xgifb_info->refresh_rate = @@ -671,8 +665,8 @@ static u8 XGIfb_search_refresh_rate(struct xgifb_video_info *xgifb_info, } else if (((rate - XGIfb_vrate[i - 1].refresh) <= 2) && (XGIfb_vrate[i].idx != 1)) { - DPRINTK("XGIfb: Adjusting rate from %d down to %d\n", - rate, XGIfb_vrate[i-1].refresh); + pr_debug("XGIfb: Adjusting rate from %d down to %d\n", + rate, XGIfb_vrate[i-1].refresh); xgifb_info->rate_idx = XGIfb_vrate[i - 1].idx; xgifb_info->refresh_rate = @@ -680,8 +674,8 @@ static u8 XGIfb_search_refresh_rate(struct xgifb_video_info *xgifb_info, } break; } else if ((rate - XGIfb_vrate[i].refresh) <= 2) { - DPRINTK("XGIfb: Adjusting rate from %d down to %d\n", - rate, XGIfb_vrate[i].refresh); + pr_debug("XGIfb: Adjusting rate from %d down to %d\n", + rate, XGIfb_vrate[i].refresh); xgifb_info->rate_idx = XGIfb_vrate[i].idx; break; } @@ -995,15 +989,15 @@ static void XGIfb_post_setmode(struct xgifb_video_info *xgifb_info) } if ((filter >= 0) && (filter <= 7)) { - DPRINTK("FilterTable[%d]-%d: %02x %02x %02x %02x\n", - filter_tb, filter, - XGI_TV_filter[filter_tb]. + pr_debug("FilterTable[%d]-%d: %02x %02x %02x %02x\n", + filter_tb, filter, + XGI_TV_filter[filter_tb]. filter[filter][0], - XGI_TV_filter[filter_tb]. + XGI_TV_filter[filter_tb]. filter[filter][1], - XGI_TV_filter[filter_tb]. + XGI_TV_filter[filter_tb]. filter[filter][2], - XGI_TV_filter[filter_tb]. + XGI_TV_filter[filter_tb]. filter[filter][3] ); xgifb_reg_set( @@ -1064,7 +1058,7 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, } if (!htotal || !vtotal) { - DPRINTK("XGIfb: Invalid 'var' information\n"); + pr_debug("XGIfb: Invalid 'var' information\n"); return -EINVAL; } pr_debug("var->pixclock=%d, htotal=%d, vtotal=%d\n", var->pixclock, htotal, vtotal); @@ -1140,11 +1134,11 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, XGIfb_post_setmode(xgifb_info); - DPRINTK("XGIfb: Set new mode: %dx%dx%d-%d\n", - XGIbios_mode[xgifb_info->mode_idx].xres, - XGIbios_mode[xgifb_info->mode_idx].yres, - XGIbios_mode[xgifb_info->mode_idx].bpp, - xgifb_info->refresh_rate); + pr_debug("XGIfb: Set new mode: %dx%dx%d-%d\n", + XGIbios_mode[xgifb_info->mode_idx].xres, + XGIbios_mode[xgifb_info->mode_idx].yres, + XGIbios_mode[xgifb_info->mode_idx].bpp, + xgifb_info->refresh_rate); xgifb_info->video_bpp = XGIbios_mode[xgifb_info->mode_idx].bpp; xgifb_info->video_vwidth = info->var.xres_virtual; -- cgit v0.10.2 From 96cd1f8b41c36c2520cc8b524734784a9e995ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Mon, 18 Jun 2012 13:12:02 +0200 Subject: Staging: xgifb: define real dumpVGAReg() content only in DEBUG mode. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Define real content of dumpVGAReg() only in debug mode. Remove old condition. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 9ffc853..a45a497 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -30,9 +30,7 @@ static unsigned int refresh_rate; /* -------------------- Macro definitions ---------------------------- */ -#undef XGIFBDEBUG - -#ifdef XGIFBDEBUG +#ifdef DEBUG static void dumpVGAReg(void) { u8 i, reg; -- cgit v0.10.2 From 47cee13d1dfe9867758c82a5ef93fd96629ceefd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Mon, 18 Jun 2012 13:12:03 +0200 Subject: Staging: xgifb: Remove XGIFAIL() macro and its calls. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit XGIFAIL() prints a message and returns a value, but it's used only in one place. Better remove it and replace the call with the macro content. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/XGI_main.h b/drivers/staging/xgifb/XGI_main.h index ce18f8c..be6bb7d 100644 --- a/drivers/staging/xgifb/XGI_main.h +++ b/drivers/staging/xgifb/XGI_main.h @@ -4,8 +4,6 @@ #include "XGIfb.h" #include "vb_def.h" -#define XGIFAIL(x) do { printk(x "\n"); return -EINVAL; } while (0) - #ifndef PCI_DEVICE_ID_XGI_42 #define PCI_DEVICE_ID_XGI_42 0x042 #endif diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index a45a497..58cddb4 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -1376,8 +1376,10 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) vtotal = var->upper_margin + var->yres + var->lower_margin + var->vsync_len; - if (!(htotal) || !(vtotal)) - XGIFAIL("XGIfb: no valid timing data"); + if (!(htotal) || !(vtotal)) { + pr_debug("XGIfb: no valid timing data\n"); + return -EINVAL; + } if (var->pixclock && htotal && vtotal) { drate = 1000000000 / var->pixclock; -- cgit v0.10.2 From 448810662ac3ba1c93c23a352a46d1f523f0b0f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Mon, 18 Jun 2012 13:12:04 +0200 Subject: Staging: xgifb: Remove printk usage. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace meaninful printks with pr_debug and remove useless ones. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 58cddb4..df6ef46 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -69,37 +69,37 @@ static void dumpVGAReg(void) for (i = 0; i < 0x4f; i++) { reg = xgifb_reg_get(XGISR, i); - printk("\no 3c4 %x", i); - printk("\ni 3c5 => %x", reg); + pr_debug("\no 3c4 %x", i); + pr_debug("\ni 3c5 => %x", reg); } for (i = 0; i < 0xF0; i++) { reg = xgifb_reg_get(XGICR, i); - printk("\no 3d4 %x", i); - printk("\ni 3d5 => %x", reg); + pr_debug("\no 3d4 %x", i); + pr_debug("\ni 3d5 => %x", reg); } /* xgifb_reg_set(XGIPART1,0x2F,1); for (i=1; i < 0x50; i++) { reg = xgifb_reg_get(XGIPART1, i); - printk("\no d004 %x", i); - printk("\ni d005 => %x", reg); + pr_debug("\no d004 %x", i); + pr_debug("\ni d005 => %x", reg); } for (i=0; i < 0x50; i++) { reg = xgifb_reg_get(XGIPART2, i); - printk("\no d010 %x", i); - printk("\ni d011 => %x", reg); + pr_debug("\no d010 %x", i); + pr_debug("\ni d011 => %x", reg); } for (i=0; i < 0x50; i++) { reg = xgifb_reg_get(XGIPART3, i); - printk("\no d012 %x",i); - printk("\ni d013 => %x",reg); + pr_debug("\no d012 %x",i); + pr_debug("\ni d013 => %x",reg); } for (i=0; i < 0x50; i++) { reg = xgifb_reg_get(XGIPART4, i); - printk("\no d014 %x",i); - printk("\ni d015 => %x",reg); + pr_debug("\no d014 %x",i); + pr_debug("\ni d015 => %x",reg); } */ } @@ -1040,8 +1040,6 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, int old_mode; /* unsigned char reg, reg1; */ - /* printk(KERN_DEBUG "XGIfb:var->yres=%d, var->upper_margin=%d, var->lower_margin=%d, var->vsync_len=%d\n", var->yres, var->upper_margin, var->lower_margin, var->vsync_len); */ - info->var.xres_virtual = var->xres_virtual; info->var.yres_virtual = var->yres_virtual; info->var.bits_per_pixel = var->bits_per_pixel; @@ -1194,8 +1192,6 @@ static int XGIfb_pan_var(struct fb_var_screeninfo *var, struct fb_info *info) struct xgifb_video_info *xgifb_info = info->par; unsigned int base; - /* printk("Inside pan_var"); */ - base = var->yoffset * info->var.xres_virtual + var->xoffset; /* calculate base bpp dep. */ @@ -1229,7 +1225,6 @@ static int XGIfb_pan_var(struct fb_var_screeninfo *var, struct fb_info *info) 0x7F, ((base >> 24) & 0x01) << 7); } - /* printk("End of pan_var"); */ return 0; } @@ -1342,12 +1337,10 @@ static int XGIfb_set_par(struct fb_info *info) { int err; - /* printk("XGIfb: inside set_par\n"); */ err = XGIfb_do_set_var(&info->var, 1, info); if (err) return err; XGIfb_get_fix(&info->fix, -1, info); - /* printk("XGIfb: end of set_par\n"); */ return 0; } @@ -1501,8 +1494,6 @@ static int XGIfb_pan_display(struct fb_var_screeninfo *var, { int err; - /* printk("\nInside pan_display:\n"); */ - if (var->xoffset > (info->var.xres_virtual - info->var.xres)) return -EINVAL; if (var->yoffset > (info->var.yres_virtual - info->var.yres)) @@ -1529,7 +1520,6 @@ static int XGIfb_pan_display(struct fb_var_screeninfo *var, else info->var.vmode &= ~FB_VMODE_YWRAP; - /* printk("End of pan_display\n"); */ return 0; } @@ -1986,7 +1976,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, /* else if (reg >= 0xB0) { hw_info->ujVBChipID = VB_CHIP_301B; reg1 = xgifb_reg_get(XGIPART4, 0x23); - printk("XGIfb: XGI301B bridge detected\n"); + pr_debug("XGIfb: XGI301B bridge detected\n"); } */ else { hw_info->ujVBChipID = VB_CHIP_301; diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c index a3d54b7..64d1311 100644 --- a/drivers/staging/xgifb/vb_init.c +++ b/drivers/staging/xgifb/vb_init.c @@ -1318,22 +1318,17 @@ unsigned char XGIInitNew(struct pci_dev *pdev) /* Newdebugcode(0x99); */ if (pVBInfo->FBAddr == NULL) { - printk("\n pVBInfo->FBAddr == 0 "); + pr_debug("pVBInfo->FBAddr == 0\n"); return 0; } - printk("1"); if (pVBInfo->BaseAddr == 0) { - printk("\npVBInfo->BaseAddr == 0 "); + pr_debug("pVBInfo->BaseAddr == 0\n"); return 0; } - printk("2"); outb(0x67, (pVBInfo->BaseAddr + 0x12)); /* 3c2 <- 67 ,ynlai */ pVBInfo->ISXPDOS = 0; - printk("3"); - - printk("4"); /* VBIOSVersion[4] = 0x0; */ @@ -1356,7 +1351,6 @@ unsigned char XGIInitNew(struct pci_dev *pdev) pVBInfo->Part3Port = pVBInfo->BaseAddr + SIS_CRT2_PORT_12; pVBInfo->Part4Port = pVBInfo->BaseAddr + SIS_CRT2_PORT_14; pVBInfo->Part5Port = pVBInfo->BaseAddr + SIS_CRT2_PORT_14 + 2; - printk("5"); if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 */ /* Run XGI_GetVBType before InitTo330Pointer */ @@ -1368,7 +1362,6 @@ unsigned char XGIInitNew(struct pci_dev *pdev) /* 1.Openkey */ xgifb_reg_set(pVBInfo->P3c4, 0x05, 0x86); - printk("6"); /* GetXG21Sense (GPIO) */ if (HwDeviceExtension->jChipType == XG21) @@ -1377,8 +1370,6 @@ unsigned char XGIInitNew(struct pci_dev *pdev) if (HwDeviceExtension->jChipType == XG27) XGINew_GetXG27Sense(HwDeviceExtension, pVBInfo); - printk("7"); - /* 2.Reset Extended register */ for (i = 0x06; i < 0x20; i++) @@ -1390,11 +1381,8 @@ unsigned char XGIInitNew(struct pci_dev *pdev) /* for(i = 0x06; i <= 0x27; i++) */ /* xgifb_reg_set(pVBInfo->P3c4, i, 0); */ - printk("8"); - for (i = 0x31; i <= 0x3B; i++) xgifb_reg_set(pVBInfo->P3c4, i, 0); - printk("9"); /* [Hsuan] 2004/08/20 Auto over driver for XG42 */ if (HwDeviceExtension->jChipType == XG42) @@ -1406,8 +1394,6 @@ unsigned char XGIInitNew(struct pci_dev *pdev) for (i = 0x79; i <= 0x7C; i++) xgifb_reg_set(pVBInfo->P3d4, i, 0); /* shampoo 0208 */ - printk("10"); - if (HwDeviceExtension->jChipType >= XG20) xgifb_reg_set(pVBInfo->P3d4, 0x97, pVBInfo->XGINew_CR97); @@ -1416,8 +1402,6 @@ unsigned char XGIInitNew(struct pci_dev *pdev) pVBInfo->ram_type = XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo); */ - printk("11"); - /* 4.SetDefExt1Regs begin */ xgifb_reg_set(pVBInfo->P3c4, 0x07, XGI330_SR07); if (HwDeviceExtension->jChipType == XG27) { @@ -1437,8 +1421,6 @@ unsigned char XGIInitNew(struct pci_dev *pdev) /* SR11 = 0x0F; */ /* xgifb_reg_set(pVBInfo->P3c4, 0x11, SR11); */ - printk("12"); - if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */ u32 Temp; @@ -1484,8 +1466,6 @@ unsigned char XGIInitNew(struct pci_dev *pdev) } */ - printk("13"); - /* Set AGP customize registers (in SetDefAGPRegs) Start */ for (i = 0x47; i <= 0x4C; i++) xgifb_reg_set(pVBInfo->P3d4, @@ -1514,14 +1494,12 @@ unsigned char XGIInitNew(struct pci_dev *pdev) if (Temp == 1) xgifb_reg_set(pVBInfo->P3d4, 0x48, 0x20); /* CR48 */ - printk("14"); } /* != XG20 */ /* Set PCI */ xgifb_reg_set(pVBInfo->P3c4, 0x23, XGI330_SR23); xgifb_reg_set(pVBInfo->P3c4, 0x24, XGI330_SR24); xgifb_reg_set(pVBInfo->P3c4, 0x25, XGI330_SR25); - printk("15"); if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */ /* Set VB */ @@ -1536,8 +1514,6 @@ unsigned char XGIInitNew(struct pci_dev *pdev) xgifb_reg_set(pVBInfo->Part1Port, 0x02, XGI330_CRT2Data_1_2); - printk("16"); - xgifb_reg_set(pVBInfo->Part1Port, 0x2E, 0x08); /* use VB */ } /* != XG20 */ @@ -1557,7 +1533,6 @@ unsigned char XGIInitNew(struct pci_dev *pdev) xgifb_reg_set(pVBInfo->P3c4, 0x32, XGI330_SR32); } xgifb_reg_set(pVBInfo->P3c4, 0x33, XGI330_SR33); - printk("17"); /* SetPowerConsume (HwDeviceExtension, pVBInfo->P3c4); */ @@ -1578,18 +1553,11 @@ unsigned char XGIInitNew(struct pci_dev *pdev) XGI_LockCRT2(HwDeviceExtension, pVBInfo); } } /* != XG20 */ - printk("18"); - - printk("181"); - - printk("182"); XGI_SenseCRT1(pVBInfo); - printk("183"); /* XGINew_DetectMonitor(HwDeviceExtension); */ if (HwDeviceExtension->jChipType == XG21) { - printk("186"); xgifb_reg_and_or(pVBInfo->P3d4, 0x32, @@ -1597,7 +1565,6 @@ unsigned char XGIInitNew(struct pci_dev *pdev) Monitor1Sense); /* Z9 default has CRT */ temp = GetXG21FPBits(pVBInfo); xgifb_reg_and_or(pVBInfo->P3d4, 0x37, ~0x01, temp); - printk("187"); } if (HwDeviceExtension->jChipType == XG27) { @@ -1608,7 +1575,6 @@ unsigned char XGIInitNew(struct pci_dev *pdev) temp = GetXG27FPBits(pVBInfo); xgifb_reg_and_or(pVBInfo->P3d4, 0x37, ~0x03, temp); } - printk("19"); pVBInfo->ram_type = XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo); @@ -1616,11 +1582,7 @@ unsigned char XGIInitNew(struct pci_dev *pdev) pVBInfo->P3d4, pVBInfo); - printk("20"); XGINew_SetDRAMSize_340(xgifb_info, HwDeviceExtension, pVBInfo); - printk("21"); - - printk("22"); /* SetDefExt2Regs begin */ /* @@ -1651,16 +1613,11 @@ unsigned char XGIInitNew(struct pci_dev *pdev) xgifb_reg_set(pVBInfo->P3c4, 0x21, pVBInfo->SR21); - printk("23"); - XGINew_ChkSenseStatus(HwDeviceExtension, pVBInfo); XGINew_SetModeScratch(HwDeviceExtension, pVBInfo); - printk("24"); - xgifb_reg_set(pVBInfo->P3d4, 0x8c, 0x87); xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x31); - printk("25"); return 1; } /* end of init */ -- cgit v0.10.2 From e054102b9fee7ef8cd1a10a8a6474f566e1c5631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Mon, 18 Jun 2012 13:12:05 +0200 Subject: Staging: xgifb: Fix sparse warnings. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add include files with function definitions to avoid sparse warnings. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c index 64d1311..143957f 100644 --- a/drivers/staging/xgifb/vb_init.c +++ b/drivers/staging/xgifb/vb_init.c @@ -5,6 +5,7 @@ #include "vb_def.h" #include "vb_util.h" #include "vb_setmode.h" +#include "vb_init.h" static const unsigned short XGINew_DDRDRAM_TYPE340[4][2] = { { 16, 0x45}, { 8, 0x35}, diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index b1713d3..479362e 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -4,7 +4,7 @@ #include "vb_def.h" #include "vb_util.h" #include "vb_table.h" - +#include "vb_setmode.h" #define IndexMask 0xff #define TVCLKBASE_315_25 (TVCLKBASE_315 + 25) diff --git a/drivers/staging/xgifb/vb_util.c b/drivers/staging/xgifb/vb_util.c index 5c93a22..1b452f8 100644 --- a/drivers/staging/xgifb/vb_util.c +++ b/drivers/staging/xgifb/vb_util.c @@ -1,4 +1,5 @@ #include "vgatypes.h" +#include "vb_util.h" void xgifb_reg_set(unsigned long port, u8 index, u8 data) { -- cgit v0.10.2 From 1918570388066fb15d591d9b9bf915dfc793aff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Mon, 18 Jun 2012 13:12:06 +0200 Subject: Staging: xgifb: Replace pr_* with dev_* when possible. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace pr_* calls with dev_* ones when the device structure is available. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index df6ef46..fe9061d 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -1838,9 +1838,9 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, xgifb_info->mmio_base = pci_resource_start(pdev, 1); xgifb_info->mmio_size = pci_resource_len(pdev, 1); xgifb_info->vga_base = pci_resource_start(pdev, 2) + 0x30; - pr_info("Relocate IO address: %Lx [%08lx]\n", - (u64) pci_resource_start(pdev, 2), - xgifb_info->vga_base); + dev_info(&pdev->dev, "Relocate IO address: %Lx [%08lx]\n", + (u64) pci_resource_start(pdev, 2), + xgifb_info->vga_base); if (pci_enable_device(pdev)) { ret = -EIO; @@ -1858,7 +1858,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, reg1 = xgifb_reg_get(XGISR, IND_SIS_PASSWORD); if (reg1 != 0xa1) { /*I/O error */ - pr_err("I/O error!!!"); + dev_err(&pdev->dev, "I/O error!!!"); ret = -EIO; goto error_disable; } @@ -1886,11 +1886,12 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, goto error_disable; } - pr_info("chipid = %x\n", xgifb_info->chip); + dev_info(&pdev->dev, "chipid = %x\n", xgifb_info->chip); hw_info->jChipType = xgifb_info->chip; if (XGIfb_get_dram_size(xgifb_info)) { - pr_err("Fatal error: Unable to determine RAM size.\n"); + dev_err(&pdev->dev, + "Fatal error: Unable to determine RAM size.\n"); ret = -ENODEV; goto error_disable; } @@ -1907,10 +1908,11 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, if (!request_mem_region(xgifb_info->video_base, xgifb_info->video_size, "XGIfb FB")) { - pr_err("unable request memory size %x\n", + dev_err(&pdev->dev, "unable request memory size %x\n", xgifb_info->video_size); - pr_err("Fatal error: Unable to reserve frame buffer memory\n"); - pr_err("Is there another framebuffer driver active?\n"); + dev_err(&pdev->dev, + "Fatal error: Unable to reserve frame buffer memory. " + "Is there another framebuffer driver active?\n"); ret = -ENODEV; goto error_disable; } @@ -1918,7 +1920,8 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, if (!request_mem_region(xgifb_info->mmio_base, xgifb_info->mmio_size, "XGIfb MMIO")) { - pr_err("Fatal error: Unable to reserve MMIO region\n"); + dev_err(&pdev->dev, + "Fatal error: Unable to reserve MMIO region\n"); ret = -ENODEV; goto error_0; } @@ -1928,18 +1931,20 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, xgifb_info->mmio_vbase = ioremap(xgifb_info->mmio_base, xgifb_info->mmio_size); - pr_info("Framebuffer at 0x%Lx, mapped to 0x%p, size %dk\n", - (u64) xgifb_info->video_base, - xgifb_info->video_vbase, - xgifb_info->video_size / 1024); + dev_info(&pdev->dev, + "Framebuffer at 0x%Lx, mapped to 0x%p, size %dk\n", + (u64) xgifb_info->video_base, + xgifb_info->video_vbase, + xgifb_info->video_size / 1024); - pr_info("MMIO at 0x%Lx, mapped to 0x%p, size %ldk\n", - (u64) xgifb_info->mmio_base, xgifb_info->mmio_vbase, - xgifb_info->mmio_size / 1024); + dev_info(&pdev->dev, + "MMIO at 0x%Lx, mapped to 0x%p, size %ldk\n", + (u64) xgifb_info->mmio_base, xgifb_info->mmio_vbase, + xgifb_info->mmio_size / 1024); pci_set_drvdata(pdev, xgifb_info); if (!XGIInitNew(pdev)) - pr_err("XGIInitNew() failed!\n"); + dev_err(&pdev->dev, "XGIInitNew() failed!\n"); xgifb_info->mtrr = (unsigned int) 0; @@ -1968,10 +1973,14 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, reg = xgifb_reg_get(XGIPART4, 0x01); if (reg >= 0xE0) { hw_info->ujVBChipID = VB_CHIP_302LV; - pr_info("XGI302LV bridge detected (revision 0x%02x)\n", reg); + dev_info(&pdev->dev, + "XGI302LV bridge detected (revision 0x%02x)\n", + reg); } else if (reg >= 0xD0) { hw_info->ujVBChipID = VB_CHIP_301LV; - pr_info("XGI301LV bridge detected (revision 0x%02x)\n", reg); + dev_info(&pdev->dev, + "XGI301LV bridge detected (revision 0x%02x)\n", + reg); } /* else if (reg >= 0xB0) { hw_info->ujVBChipID = VB_CHIP_301B; @@ -1980,17 +1989,21 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, } */ else { hw_info->ujVBChipID = VB_CHIP_301; - pr_info("XGI301 bridge detected\n"); + dev_info(&pdev->dev, "XGI301 bridge detected\n"); } break; case HASVB_302: reg = xgifb_reg_get(XGIPART4, 0x01); if (reg >= 0xE0) { hw_info->ujVBChipID = VB_CHIP_302LV; - pr_info("XGI302LV bridge detected (revision 0x%02x)\n", reg); + dev_info(&pdev->dev, + "XGI302LV bridge detected (revision 0x%02x)\n", + reg); } else if (reg >= 0xD0) { hw_info->ujVBChipID = VB_CHIP_301LV; - pr_info("XGI302LV bridge detected (revision 0x%02x)\n", reg); + dev_info(&pdev->dev, + "XGI302LV bridge detected (revision 0x%02x)\n", + reg); } else if (reg >= 0xB0) { reg1 = xgifb_reg_get(XGIPART4, 0x23); @@ -1998,27 +2011,28 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, } else { hw_info->ujVBChipID = VB_CHIP_302; - pr_info("XGI302 bridge detected\n"); + dev_info(&pdev->dev, "XGI302 bridge detected\n"); } break; case HASVB_LVDS: hw_info->ulExternalChip = 0x1; - pr_info("LVDS transmitter detected\n"); + dev_info(&pdev->dev, "LVDS transmitter detected\n"); break; case HASVB_TRUMPION: hw_info->ulExternalChip = 0x2; - pr_info("Trumpion Zurac LVDS scaler detected\n"); + dev_info(&pdev->dev, "Trumpion Zurac LVDS scaler detected\n"); break; case HASVB_CHRONTEL: hw_info->ulExternalChip = 0x4; - pr_info("Chrontel TV encoder detected\n"); + dev_info(&pdev->dev, "Chrontel TV encoder detected\n"); break; case HASVB_LVDS_CHRONTEL: hw_info->ulExternalChip = 0x5; - pr_info("LVDS transmitter and Chrontel TV encoder detected\n"); + dev_info(&pdev->dev, + "LVDS transmitter and Chrontel TV encoder detected\n"); break; default: - pr_info("No or unknown bridge type detected\n"); + dev_info(&pdev->dev, "No or unknown bridge type detected\n"); break; } diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c index 143957f..7c555a7 100644 --- a/drivers/staging/xgifb/vb_init.c +++ b/drivers/staging/xgifb/vb_init.c @@ -1319,11 +1319,11 @@ unsigned char XGIInitNew(struct pci_dev *pdev) /* Newdebugcode(0x99); */ if (pVBInfo->FBAddr == NULL) { - pr_debug("pVBInfo->FBAddr == 0\n"); + dev_dbg(&pdev->dev, "pVBInfo->FBAddr == 0\n"); return 0; } if (pVBInfo->BaseAddr == 0) { - pr_debug("pVBInfo->BaseAddr == 0\n"); + dev_dbg(&pdev->dev, "pVBInfo->BaseAddr == 0\n"); return 0; } -- cgit v0.10.2 From 1351acce4fd25c6b7f007a92cc706e3fbd56479c Mon Sep 17 00:00:00 2001 From: "Justin P. Mattock" Date: Mon, 18 Jun 2012 07:42:23 -0700 Subject: staging: serqt_usb2: Fix some typos. Fixes some typos that was found while reading through staging/serqt_usb2 Signed-off-by: Justin P. Mattock Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/serqt_usb2/serqt_usb2.c b/drivers/staging/serqt_usb2/serqt_usb2.c index 43045db..8a362f7 100644 --- a/drivers/staging/serqt_usb2/serqt_usb2.c +++ b/drivers/staging/serqt_usb2/serqt_usb2.c @@ -609,7 +609,7 @@ static int BoxSetRegister(struct usb_serial *serial, unsigned short Uart_Number, /* * qt_setuart - * issuse a SET_UART vendor-spcific request on the default control pipe + * issues a SET_UART vendor-specific request on the default control pipe * If successful sets baud rate divisor and LCR value */ static int qt_setuart(struct usb_serial *serial, unsigned short Uart_Number, @@ -1388,7 +1388,7 @@ static inline int qt_real_tiocmset(struct tty_struct *tty, return -ESPIPE; /* - * Turn off the RTS and DTR and loopbcck and then only turn on what was + * Turn off the RTS and DTR and loopback and then only turn on what was * asked for */ mcr &= ~(SERIAL_MCR_RTS | SERIAL_MCR_DTR | SERIAL_MCR_LOOP); -- cgit v0.10.2 From 493b67b73c7f575058acec61903a2cb128207106 Mon Sep 17 00:00:00 2001 From: "Justin P. Mattock" Date: Mon, 18 Jun 2012 07:42:24 -0700 Subject: staging: slicoss: Fix a typo. The below patch fixes a typo found while reading through staging/slicoss Signed-off-by: Justin P. Mattock Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 77a0751..d2b82a7 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -47,7 +47,7 @@ * Oasis cards (single and dual port PCI-x Gigabit) copper and fiber * Kalahari cards (dual and quad port PCI-e Gigabit) copper and fiber * - * The driver was acutally tested on Oasis and Kalahari cards. + * The driver was actually tested on Oasis and Kalahari cards. * * * NOTE: This is the standard, non-accelerated version of Alacritech's -- cgit v0.10.2 From f5b81ddd12da71bd00b2963203c23ff929e0c182 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 18 Jun 2012 18:33:47 +0200 Subject: iio: iio_buffer_register: Skip channels with negative scan index It is not always the case that all channels can be used in buffered mode. This patch allows channels, which can not be used in buffered mode, to set their scan index to a negative number, which will cause iio_buffer_register to ignore the channel. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index 2f35db9..3d8d187 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -285,6 +285,9 @@ int iio_buffer_register(struct iio_dev *indio_dev, if (channels) { /* new magic */ for (i = 0; i < num_channels; i++) { + if (channels[i].scan_index < 0) + continue; + /* Establish necessary mask length */ if (channels[i].scan_index > (int)indio_dev->masklength - 1) -- cgit v0.10.2 From 23f2d735a932c7833d2d00da5e3ecdf4a6836210 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 18 Jun 2012 18:33:48 +0200 Subject: iio: Add helper function for initializing triggered buffers Add a helper function for executing the common tasks which are usually involved in setting up a simple software ringbuffer. It will allocate the buffer, allocate the pollfunc and register the buffer. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig index 103349f..612073f 100644 --- a/drivers/iio/Kconfig +++ b/drivers/iio/Kconfig @@ -30,6 +30,13 @@ config IIO_KFIFO_BUF no buffer events so it is up to userspace to work out how often to read from the buffer. +config IIO_TRIGGERED_BUFFER + tristate + select IIO_TRIGGER + select IIO_KFIFO_BUF + help + Provides helper functions for setting up triggered buffers. + endif # IIO_BUFFER config IIO_TRIGGER diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile index c38fa2a..34309ab 100644 --- a/drivers/iio/Makefile +++ b/drivers/iio/Makefile @@ -7,6 +7,7 @@ industrialio-y := industrialio-core.o industrialio-event.o inkern.o industrialio-$(CONFIG_IIO_BUFFER) += industrialio-buffer.o industrialio-$(CONFIG_IIO_TRIGGER) += industrialio-trigger.o +obj-$(CONFIG_IIO_TRIGGERED_BUFFER) += industrialio-triggered-buffer.o obj-$(CONFIG_IIO_KFIFO_BUF) += kfifo_buf.o obj-y += adc/ diff --git a/drivers/iio/industrialio-triggered-buffer.c b/drivers/iio/industrialio-triggered-buffer.c new file mode 100644 index 0000000..46c619b --- /dev/null +++ b/drivers/iio/industrialio-triggered-buffer.c @@ -0,0 +1,110 @@ + /* + * Copyright (c) 2012 Analog Devices, Inc. + * Author: Lars-Peter Clausen + * + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +static const struct iio_buffer_setup_ops iio_triggered_buffer_setup_ops = { + .preenable = &iio_sw_buffer_preenable, + .postenable = &iio_triggered_buffer_postenable, + .predisable = &iio_triggered_buffer_predisable, +}; + +/** + * iio_triggered_buffer_setup() - Setup triggered buffer and pollfunc + * @indio_dev: IIO device structure + * @pollfunc_bh: Function which will be used as pollfunc bottom half + * @pollfunc_th: Function which will be used as pollfunc top half + * @setup_ops: Buffer setup functions to use for this device. + * If NULL the default setup functions for triggered + * buffers will be used. + * + * This function combines some common tasks which will normally be performed + * when setting up a triggered buffer. It will allocate the buffer and the + * pollfunc, as well as register the buffer with the IIO core. + * + * Before calling this function the indio_dev structure should already be + * completely initialized, but not yet registered. In practice this means that + * this function should be called right before iio_device_register(). + * + * To free the resources allocated by this function call + * iio_triggered_buffer_cleanup(). + */ +int iio_triggered_buffer_setup(struct iio_dev *indio_dev, + irqreturn_t (*pollfunc_bh)(int irq, void *p), + irqreturn_t (*pollfunc_th)(int irq, void *p), + const struct iio_buffer_setup_ops *setup_ops) +{ + int ret; + + indio_dev->buffer = iio_kfifo_allocate(indio_dev); + if (!indio_dev->buffer) { + ret = -ENOMEM; + goto error_ret; + } + + indio_dev->pollfunc = iio_alloc_pollfunc(pollfunc_bh, + pollfunc_th, + IRQF_ONESHOT, + indio_dev, + "%s_consumer%d", + indio_dev->name, + indio_dev->id); + if (indio_dev->pollfunc == NULL) { + ret = -ENOMEM; + goto error_kfifo_free; + } + + /* Ring buffer functions - here trigger setup related */ + if (setup_ops) + indio_dev->setup_ops = setup_ops; + else + indio_dev->setup_ops = &iio_triggered_buffer_setup_ops; + + /* Flag that polled ring buffering is possible */ + indio_dev->modes |= INDIO_BUFFER_TRIGGERED; + + ret = iio_buffer_register(indio_dev, + indio_dev->channels, + indio_dev->num_channels); + if (ret) + goto error_dealloc_pollfunc; + + return 0; + +error_dealloc_pollfunc: + iio_dealloc_pollfunc(indio_dev->pollfunc); +error_kfifo_free: + iio_kfifo_free(indio_dev->buffer); +error_ret: + return ret; +} +EXPORT_SYMBOL(iio_triggered_buffer_setup); + +/** + * iio_triggered_buffer_cleanup() - Free resources allocated by iio_triggered_buffer_setup() + * @indio_dev: IIO device structure + */ +void iio_triggered_buffer_cleanup(struct iio_dev *indio_dev) +{ + iio_buffer_unregister(indio_dev); + iio_dealloc_pollfunc(indio_dev->pollfunc); + iio_kfifo_free(indio_dev->buffer); +} +EXPORT_SYMBOL(iio_triggered_buffer_cleanup); + +MODULE_AUTHOR("Lars-Peter Clausen "); +MODULE_DESCRIPTION("IIO helper functions for setting up triggered buffers"); +MODULE_LICENSE("GPL"); diff --git a/include/linux/iio/triggered_buffer.h b/include/linux/iio/triggered_buffer.h new file mode 100644 index 0000000..c378ebe --- /dev/null +++ b/include/linux/iio/triggered_buffer.h @@ -0,0 +1,15 @@ +#ifndef _LINUX_IIO_TRIGGERED_BUFFER_H_ +#define _LINUX_IIO_TRIGGERED_BUFFER_H_ + +#include + +struct iio_dev; +struct iio_buffer_setup_ops; + +int iio_triggered_buffer_setup(struct iio_dev *indio_dev, + irqreturn_t (*pollfunc_bh)(int irq, void *p), + irqreturn_t (*pollfunc_th)(int irq, void *p), + const struct iio_buffer_setup_ops *setup_ops); +void iio_triggered_buffer_cleanup(struct iio_dev *indio_dev); + +#endif -- cgit v0.10.2 From 90032e4e9cc40e2933259190b670d70ddd149e68 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 18 Jun 2012 18:33:49 +0200 Subject: iio:adc:at91: Use new triggered buffer setup helper Use the new triggered buffer setup helper function to allocate and register buffer and pollfunc. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Acked-by: Maxime Ripard Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 9a0df81..4f7f584 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -7,8 +7,7 @@ config AT91_ADC tristate "Atmel AT91 ADC" depends on ARCH_AT91 select IIO_BUFFER - select IIO_KFIFO_BUF - select IIO_TRIGGER + select IIO_TRIGGERED_BUFFER select SYSFS help Say yes here to build support for Atmel AT91 ADC. diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index f18a95d..6a08469 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c @@ -26,9 +26,9 @@ #include #include -#include #include #include +#include #include @@ -318,58 +318,15 @@ static void at91_adc_trigger_remove(struct iio_dev *idev) } } -static const struct iio_buffer_setup_ops at91_adc_buffer_ops = { - .preenable = &iio_sw_buffer_preenable, - .postenable = &iio_triggered_buffer_postenable, - .predisable = &iio_triggered_buffer_predisable, -}; - static int at91_adc_buffer_init(struct iio_dev *idev) { - int ret; - - idev->buffer = iio_kfifo_allocate(idev); - if (!idev->buffer) { - ret = -ENOMEM; - goto error_ret; - } - - idev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time, - &at91_adc_trigger_handler, - IRQF_ONESHOT, - idev, - "%s-consumer%d", - idev->name, - idev->id); - if (idev->pollfunc == NULL) { - ret = -ENOMEM; - goto error_pollfunc; - } - - idev->setup_ops = &at91_adc_buffer_ops; - idev->modes |= INDIO_BUFFER_TRIGGERED; - - ret = iio_buffer_register(idev, - idev->channels, - idev->num_channels); - if (ret) - goto error_register; - - return 0; - -error_register: - iio_dealloc_pollfunc(idev->pollfunc); -error_pollfunc: - iio_kfifo_free(idev->buffer); -error_ret: - return ret; + return iio_triggered_buffer_setup(idev, &iio_pollfunc_store_time, + &at91_adc_trigger_handler, NULL); } static void at91_adc_buffer_remove(struct iio_dev *idev) { - iio_buffer_unregister(idev); - iio_dealloc_pollfunc(idev->pollfunc); - iio_kfifo_free(idev->buffer); + iio_triggered_buffer_cleanup(idev); } static int at91_adc_read_raw(struct iio_dev *idev, -- cgit v0.10.2 From a648232dc5ed840c6dab0a949450ee4cdf5830bd Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 18 Jun 2012 18:33:50 +0200 Subject: staging:iio:adc:ad7192: Use new triggered buffer setup helper function Use the new triggered buffer setup helper function to allocate and register buffer and pollfunc. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/adc/Kconfig b/drivers/staging/iio/adc/Kconfig index 8f1b3af..7cdf421 100644 --- a/drivers/staging/iio/adc/Kconfig +++ b/drivers/staging/iio/adc/Kconfig @@ -136,8 +136,7 @@ config AD7192 tristate "Analog Devices AD7190 AD7192 AD7195 ADC driver" depends on SPI select IIO_BUFFER - select IIO_KFIFO_BUF - select IIO_TRIGGER + select IIO_TRIGGERED_BUFFER help Say yes here to build support for Analog Devices AD7190, AD7192 or AD7195 SPI analog to digital converters (ADC). diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c index 5eaeaf1..839f17c4 100644 --- a/drivers/staging/iio/adc/ad7192.c +++ b/drivers/staging/iio/adc/ad7192.c @@ -20,9 +20,9 @@ #include #include #include -#include #include #include +#include #include "ad7192.h" @@ -542,41 +542,13 @@ static const struct iio_buffer_setup_ops ad7192_ring_setup_ops = { static int ad7192_register_ring_funcs_and_init(struct iio_dev *indio_dev) { - int ret; - - indio_dev->buffer = iio_kfifo_allocate(indio_dev); - if (!indio_dev->buffer) { - ret = -ENOMEM; - goto error_ret; - } - indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time, - &ad7192_trigger_handler, - IRQF_ONESHOT, - indio_dev, - "ad7192_consumer%d", - indio_dev->id); - if (indio_dev->pollfunc == NULL) { - ret = -ENOMEM; - goto error_deallocate_kfifo; - } - - /* Ring buffer functions - here trigger setup related */ - indio_dev->setup_ops = &ad7192_ring_setup_ops; - - /* Flag that polled ring buffering is possible */ - indio_dev->modes |= INDIO_BUFFER_TRIGGERED; - return 0; - -error_deallocate_kfifo: - iio_kfifo_free(indio_dev->buffer); -error_ret: - return ret; + return iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time, + &ad7192_trigger_handler, &ad7192_ring_setup_ops); } static void ad7192_ring_cleanup(struct iio_dev *indio_dev) { - iio_dealloc_pollfunc(indio_dev->pollfunc); - iio_kfifo_free(indio_dev->buffer); + iio_triggered_buffer_cleanup(indio_dev); } /** @@ -1077,23 +1049,15 @@ static int __devinit ad7192_probe(struct spi_device *spi) if (ret) goto error_ring_cleanup; - ret = iio_buffer_register(indio_dev, - indio_dev->channels, - indio_dev->num_channels); - if (ret) - goto error_remove_trigger; - ret = ad7192_setup(st); if (ret) - goto error_unreg_ring; + goto error_remove_trigger; ret = iio_device_register(indio_dev); if (ret < 0) - goto error_unreg_ring; + goto error_remove_trigger; return 0; -error_unreg_ring: - iio_buffer_unregister(indio_dev); error_remove_trigger: ad7192_remove_trigger(indio_dev); error_ring_cleanup: @@ -1116,7 +1080,6 @@ static int ad7192_remove(struct spi_device *spi) struct ad7192_state *st = iio_priv(indio_dev); iio_device_unregister(indio_dev); - iio_buffer_unregister(indio_dev); ad7192_remove_trigger(indio_dev); ad7192_ring_cleanup(indio_dev); -- cgit v0.10.2 From d045b9d21b9591a4605590e7fe433f92d4b54762 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 18 Jun 2012 18:33:51 +0200 Subject: staging:iio:adc:ad7298: Use new triggered buffer setup helper function Use the new triggered buffer setup helper function to allocate and register buffer and pollfunc. The previous code was not passing the temperature channel to iio_buffer_register since the temperature channel can not be used in buffered mode. With the new helper functions it is not possible to do this, instead the scan index for the temperature channel is set to -1 which will cause iio_buffer_register to ignore the channel. (Also While we are at it also assign the symbolic constant instead of the raw value to the channel address for the temperature channel). Also as part of the conversion drop scan_timestamp being enabled by default, since it is a left over of an earlier cleanup. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/adc/Kconfig b/drivers/staging/iio/adc/Kconfig index 7cdf421..bb6fffd 100644 --- a/drivers/staging/iio/adc/Kconfig +++ b/drivers/staging/iio/adc/Kconfig @@ -13,7 +13,7 @@ config AD7291 config AD7298 tristate "Analog Devices AD7298 ADC driver" depends on SPI - select IIO_KFIFO_BUF if IIO_BUFFER + select IIO_TRIGGERED_BUFFER if IIO_BUFFER help Say yes here to build support for Analog Devices AD7298 8 Channel ADC with temperature sensor. diff --git a/drivers/staging/iio/adc/ad7298.h b/drivers/staging/iio/adc/ad7298.h index 5051a7e..18f2787 100644 --- a/drivers/staging/iio/adc/ad7298.h +++ b/drivers/staging/iio/adc/ad7298.h @@ -55,6 +55,8 @@ struct ad7298_state { #ifdef CONFIG_IIO_BUFFER int ad7298_register_ring_funcs_and_init(struct iio_dev *indio_dev); void ad7298_ring_cleanup(struct iio_dev *indio_dev); +int ad7298_update_scan_mode(struct iio_dev *indio_dev, + const unsigned long *active_scan_mask); #else /* CONFIG_IIO_BUFFER */ static inline int @@ -66,5 +68,8 @@ ad7298_register_ring_funcs_and_init(struct iio_dev *indio_dev) static inline void ad7298_ring_cleanup(struct iio_dev *indio_dev) { } + +#define ad7298_update_scan_mode NULL + #endif /* CONFIG_IIO_BUFFER */ #endif /* IIO_ADC_AD7298_H_ */ diff --git a/drivers/staging/iio/adc/ad7298_core.c b/drivers/staging/iio/adc/ad7298_core.c index c90f2b3..6141f4a 100644 --- a/drivers/staging/iio/adc/ad7298_core.c +++ b/drivers/staging/iio/adc/ad7298_core.c @@ -45,8 +45,8 @@ static struct iio_chan_spec ad7298_channels[] = { .channel = 0, .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | IIO_CHAN_INFO_SCALE_SEPARATE_BIT, - .address = 9, - .scan_index = AD7298_CH_TEMP, + .address = AD7298_CH_TEMP, + .scan_index = -1, .scan_type = { .sign = 's', .realbits = 32, @@ -171,6 +171,7 @@ static int ad7298_read_raw(struct iio_dev *indio_dev, static const struct iio_info ad7298_info = { .read_raw = &ad7298_read_raw, + .update_scan_mode = ad7298_update_scan_mode, .driver_module = THIS_MODULE, }; @@ -231,19 +232,12 @@ static int __devinit ad7298_probe(struct spi_device *spi) if (ret) goto error_disable_reg; - ret = iio_buffer_register(indio_dev, - &ad7298_channels[1], /* skip temp0 */ - ARRAY_SIZE(ad7298_channels) - 1); - if (ret) - goto error_cleanup_ring; ret = iio_device_register(indio_dev); if (ret) - goto error_unregister_ring; + goto error_cleanup_ring; return 0; -error_unregister_ring: - iio_buffer_unregister(indio_dev); error_cleanup_ring: ad7298_ring_cleanup(indio_dev); error_disable_reg: @@ -263,7 +257,6 @@ static int __devexit ad7298_remove(struct spi_device *spi) struct ad7298_state *st = iio_priv(indio_dev); iio_device_unregister(indio_dev); - iio_buffer_unregister(indio_dev); ad7298_ring_cleanup(indio_dev); if (!IS_ERR(st->reg)) { regulator_disable(st->reg); diff --git a/drivers/staging/iio/adc/ad7298_ring.c b/drivers/staging/iio/adc/ad7298_ring.c index 908a3e5..cd3e9cb 100644 --- a/drivers/staging/iio/adc/ad7298_ring.c +++ b/drivers/staging/iio/adc/ad7298_ring.c @@ -13,37 +13,29 @@ #include #include -#include #include +#include #include "ad7298.h" /** - * ad7298_ring_preenable() setup the parameters of the ring before enabling - * - * The complex nature of the setting of the number of bytes per datum is due - * to this driver currently ensuring that the timestamp is stored at an 8 - * byte boundary. + * ad7298_update_scan_mode() setup the spi transfer buffer for the new scan mask **/ -static int ad7298_ring_preenable(struct iio_dev *indio_dev) +int ad7298_update_scan_mode(struct iio_dev *indio_dev, + const unsigned long *active_scan_mask) { struct ad7298_state *st = iio_priv(indio_dev); int i, m; unsigned short command; - int scan_count, ret; - - ret = iio_sw_buffer_preenable(indio_dev); - if (ret < 0) - return ret; + int scan_count; /* Now compute overall size */ - scan_count = bitmap_weight(indio_dev->active_scan_mask, - indio_dev->masklength); + scan_count = bitmap_weight(active_scan_mask, indio_dev->masklength); command = AD7298_WRITE | st->ext_ref; for (i = 0, m = AD7298_CH(0); i < AD7298_MAX_CHAN; i++, m >>= 1) - if (test_bit(i, indio_dev->active_scan_mask)) + if (test_bit(i, active_scan_mask)) command |= m; st->tx_buf[0] = cpu_to_be16(command); @@ -108,49 +100,13 @@ static irqreturn_t ad7298_trigger_handler(int irq, void *p) return IRQ_HANDLED; } -static const struct iio_buffer_setup_ops ad7298_ring_setup_ops = { - .preenable = &ad7298_ring_preenable, - .postenable = &iio_triggered_buffer_postenable, - .predisable = &iio_triggered_buffer_predisable, -}; - int ad7298_register_ring_funcs_and_init(struct iio_dev *indio_dev) { - int ret; - - indio_dev->buffer = iio_kfifo_allocate(indio_dev); - if (!indio_dev->buffer) { - ret = -ENOMEM; - goto error_ret; - } - indio_dev->pollfunc = iio_alloc_pollfunc(NULL, - &ad7298_trigger_handler, - IRQF_ONESHOT, - indio_dev, - "ad7298_consumer%d", - indio_dev->id); - - if (indio_dev->pollfunc == NULL) { - ret = -ENOMEM; - goto error_deallocate_kfifo; - } - - /* Ring buffer functions - here trigger setup related */ - indio_dev->setup_ops = &ad7298_ring_setup_ops; - indio_dev->buffer->scan_timestamp = true; - - /* Flag that polled ring buffering is possible */ - indio_dev->modes |= INDIO_BUFFER_TRIGGERED; - return 0; - -error_deallocate_kfifo: - iio_kfifo_free(indio_dev->buffer); -error_ret: - return ret; + return iio_triggered_buffer_setup(indio_dev, NULL, + &ad7298_trigger_handler, NULL); } void ad7298_ring_cleanup(struct iio_dev *indio_dev) { - iio_dealloc_pollfunc(indio_dev->pollfunc); - iio_kfifo_free(indio_dev->buffer); + iio_triggered_buffer_cleanup(indio_dev); } -- cgit v0.10.2 From 397b85dd860db633e73fd5c1daf995431d5f6f7e Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 18 Jun 2012 18:33:52 +0200 Subject: staging:iio:adc:ad7476: Use new triggered buffer setup helper function Use the new triggered buffer setup helper function to allocate and register buffer and pollfunc. Also as part of the conversion drop scan_timestamp being enabled by default, since it is a left over of an earlier cleanup. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/adc/Kconfig b/drivers/staging/iio/adc/Kconfig index bb6fffd..c5f5651 100644 --- a/drivers/staging/iio/adc/Kconfig +++ b/drivers/staging/iio/adc/Kconfig @@ -73,8 +73,7 @@ config AD7476 tristate "Analog Devices AD7475/6/7/8 AD7466/7/8 and AD7495 ADC driver" depends on SPI select IIO_BUFFER - select IIO_KFIFO_BUF - select IIO_TRIGGER + select IIO_TRIGGERED_BUFFER help Say yes here to build support for Analog Devices AD7475, AD7476, AD7477, AD7478, AD7466, AD7467, AD7468, AD7495 diff --git a/drivers/staging/iio/adc/ad7476_core.c b/drivers/staging/iio/adc/ad7476_core.c index be1c260..4d30a79 100644 --- a/drivers/staging/iio/adc/ad7476_core.c +++ b/drivers/staging/iio/adc/ad7476_core.c @@ -177,20 +177,12 @@ static int __devinit ad7476_probe(struct spi_device *spi) if (ret) goto error_disable_reg; - ret = iio_buffer_register(indio_dev, - st->chip_info->channel, - ARRAY_SIZE(st->chip_info->channel)); - if (ret) - goto error_cleanup_ring; - ret = iio_device_register(indio_dev); if (ret) goto error_ring_unregister; return 0; error_ring_unregister: - iio_buffer_unregister(indio_dev); -error_cleanup_ring: ad7476_ring_cleanup(indio_dev); error_disable_reg: if (!IS_ERR(st->reg)) @@ -210,7 +202,6 @@ static int ad7476_remove(struct spi_device *spi) struct ad7476_state *st = iio_priv(indio_dev); iio_device_unregister(indio_dev); - iio_buffer_unregister(indio_dev); ad7476_ring_cleanup(indio_dev); if (!IS_ERR(st->reg)) { regulator_disable(st->reg); diff --git a/drivers/staging/iio/adc/ad7476_ring.c b/drivers/staging/iio/adc/ad7476_ring.c index 383611b..10f8b8d 100644 --- a/drivers/staging/iio/adc/ad7476_ring.c +++ b/drivers/staging/iio/adc/ad7476_ring.c @@ -15,8 +15,8 @@ #include #include -#include #include +#include #include "ad7476.h" @@ -52,51 +52,13 @@ done: return IRQ_HANDLED; } -static const struct iio_buffer_setup_ops ad7476_ring_setup_ops = { - .preenable = &iio_sw_buffer_preenable, - .postenable = &iio_triggered_buffer_postenable, - .predisable = &iio_triggered_buffer_predisable, -}; - int ad7476_register_ring_funcs_and_init(struct iio_dev *indio_dev) { - struct ad7476_state *st = iio_priv(indio_dev); - int ret = 0; - - indio_dev->buffer = iio_kfifo_allocate(indio_dev); - if (!indio_dev->buffer) { - ret = -ENOMEM; - goto error_ret; - } - indio_dev->pollfunc - = iio_alloc_pollfunc(NULL, - &ad7476_trigger_handler, - IRQF_ONESHOT, - indio_dev, - "%s_consumer%d", - spi_get_device_id(st->spi)->name, - indio_dev->id); - if (indio_dev->pollfunc == NULL) { - ret = -ENOMEM; - goto error_deallocate_kfifo; - } - - /* Ring buffer functions - here trigger setup related */ - indio_dev->setup_ops = &ad7476_ring_setup_ops; - indio_dev->buffer->scan_timestamp = true; - - /* Flag that polled ring buffering is possible */ - indio_dev->modes |= INDIO_BUFFER_TRIGGERED; - return 0; - -error_deallocate_kfifo: - iio_kfifo_free(indio_dev->buffer); -error_ret: - return ret; + return iio_triggered_buffer_setup(indio_dev, NULL, + &ad7476_trigger_handler, NULL); } void ad7476_ring_cleanup(struct iio_dev *indio_dev) { - iio_dealloc_pollfunc(indio_dev->pollfunc); - iio_kfifo_free(indio_dev->buffer); + iio_triggered_buffer_cleanup(indio_dev); } -- cgit v0.10.2 From 74ed964931b1be634bce199ac854dc4ed76679b5 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 18 Jun 2012 18:33:53 +0200 Subject: staging:iio:adc:ad7606: Use new triggered buffer setup helper function Use the new triggered buffer setup helper function to allocate and register buffer and pollfunc. Also as part of the conversion drop scan_timestamp being enabled by default, since it is a left over of an earlier cleanup. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/adc/Kconfig b/drivers/staging/iio/adc/Kconfig index c5f5651..ca46627 100644 --- a/drivers/staging/iio/adc/Kconfig +++ b/drivers/staging/iio/adc/Kconfig @@ -25,8 +25,7 @@ config AD7606 tristate "Analog Devices AD7606 ADC driver" depends on GPIOLIB select IIO_BUFFER - select IIO_TRIGGER - select IIO_KFIFO_BUF + select IIO_TRIGGERED_BUFFER help Say yes here to build support for Analog Devices: ad7606, ad7606-6, ad7606-4 analog to digital converters (ADC). diff --git a/drivers/staging/iio/adc/ad7606_core.c b/drivers/staging/iio/adc/ad7606_core.c index a13afff..ccb97fe 100644 --- a/drivers/staging/iio/adc/ad7606_core.c +++ b/drivers/staging/iio/adc/ad7606_core.c @@ -533,20 +533,12 @@ struct iio_dev *ad7606_probe(struct device *dev, int irq, if (ret) goto error_free_irq; - ret = iio_buffer_register(indio_dev, - indio_dev->channels, - indio_dev->num_channels); - if (ret) - goto error_cleanup_ring; ret = iio_device_register(indio_dev); if (ret) goto error_unregister_ring; return indio_dev; error_unregister_ring: - iio_buffer_unregister(indio_dev); - -error_cleanup_ring: ad7606_ring_cleanup(indio_dev); error_free_irq: @@ -571,7 +563,6 @@ int ad7606_remove(struct iio_dev *indio_dev, int irq) struct ad7606_state *st = iio_priv(indio_dev); iio_device_unregister(indio_dev); - iio_buffer_unregister(indio_dev); ad7606_ring_cleanup(indio_dev); free_irq(irq, indio_dev); diff --git a/drivers/staging/iio/adc/ad7606_ring.c b/drivers/staging/iio/adc/ad7606_ring.c index 24ce8fc..f15afe4 100644 --- a/drivers/staging/iio/adc/ad7606_ring.c +++ b/drivers/staging/iio/adc/ad7606_ring.c @@ -13,8 +13,8 @@ #include #include -#include #include +#include #include "ad7606.h" @@ -91,54 +91,18 @@ done: kfree(buf); } -static const struct iio_buffer_setup_ops ad7606_ring_setup_ops = { - .preenable = &iio_sw_buffer_preenable, - .postenable = &iio_triggered_buffer_postenable, - .predisable = &iio_triggered_buffer_predisable, -}; - int ad7606_register_ring_funcs_and_init(struct iio_dev *indio_dev) { struct ad7606_state *st = iio_priv(indio_dev); - int ret; - - indio_dev->buffer = iio_kfifo_allocate(indio_dev); - if (!indio_dev->buffer) { - ret = -ENOMEM; - goto error_ret; - } - - indio_dev->pollfunc = iio_alloc_pollfunc(&ad7606_trigger_handler_th_bh, - &ad7606_trigger_handler_th_bh, - 0, - indio_dev, - "%s_consumer%d", - indio_dev->name, - indio_dev->id); - if (indio_dev->pollfunc == NULL) { - ret = -ENOMEM; - goto error_deallocate_kfifo; - } - - /* Ring buffer functions - here trigger setup related */ - - indio_dev->setup_ops = &ad7606_ring_setup_ops; - indio_dev->buffer->scan_timestamp = true; INIT_WORK(&st->poll_work, &ad7606_poll_bh_to_ring); - /* Flag that polled ring buffering is possible */ - indio_dev->modes |= INDIO_BUFFER_TRIGGERED; - return 0; - -error_deallocate_kfifo: - iio_kfifo_free(indio_dev->buffer); -error_ret: - return ret; + return iio_triggered_buffer_setup(indio_dev, + &ad7606_trigger_handler_th_bh, &ad7606_trigger_handler_th_bh, + NULL); } void ad7606_ring_cleanup(struct iio_dev *indio_dev) { - iio_dealloc_pollfunc(indio_dev->pollfunc); - iio_kfifo_free(indio_dev->buffer); + iio_triggered_buffer_cleanup(indio_dev); } -- cgit v0.10.2 From 82796edca9ba014aa09cc158240c23b5b3f9326d Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 18 Jun 2012 18:33:54 +0200 Subject: staging:iio:adc:ad7793: Use new triggered buffer setup helper function Use the new triggered buffer setup helper function to allocate and register buffer and pollfunc. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/adc/Kconfig b/drivers/staging/iio/adc/Kconfig index ca46627..4fcc4be 100644 --- a/drivers/staging/iio/adc/Kconfig +++ b/drivers/staging/iio/adc/Kconfig @@ -112,8 +112,7 @@ config AD7793 tristate "Analog Devices AD7792 AD7793 ADC driver" depends on SPI select IIO_BUFFER - select IIO_KFIFO_BUF - select IIO_TRIGGER + select IIO_TRIGGERED_BUFFER help Say yes here to build support for Analog Devices AD7792 and AD7793 SPI analog to digital converters (ADC). diff --git a/drivers/staging/iio/adc/ad7793.c b/drivers/staging/iio/adc/ad7793.c index b36556f..2bb9f68 100644 --- a/drivers/staging/iio/adc/ad7793.c +++ b/drivers/staging/iio/adc/ad7793.c @@ -21,9 +21,9 @@ #include #include #include -#include #include #include +#include #include "ad7793.h" @@ -407,41 +407,13 @@ static const struct iio_buffer_setup_ops ad7793_ring_setup_ops = { static int ad7793_register_ring_funcs_and_init(struct iio_dev *indio_dev) { - int ret; - - indio_dev->buffer = iio_kfifo_allocate(indio_dev); - if (!indio_dev->buffer) { - ret = -ENOMEM; - goto error_ret; - } - indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time, - &ad7793_trigger_handler, - IRQF_ONESHOT, - indio_dev, - "ad7793_consumer%d", - indio_dev->id); - if (indio_dev->pollfunc == NULL) { - ret = -ENOMEM; - goto error_deallocate_kfifo; - } - - /* Ring buffer functions - here trigger setup related */ - indio_dev->setup_ops = &ad7793_ring_setup_ops; - - /* Flag that polled ring buffering is possible */ - indio_dev->modes |= INDIO_BUFFER_TRIGGERED; - return 0; - -error_deallocate_kfifo: - iio_kfifo_free(indio_dev->buffer); -error_ret: - return ret; + return iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time, + &ad7793_trigger_handler, &ad7793_ring_setup_ops); } static void ad7793_ring_cleanup(struct iio_dev *indio_dev) { - iio_dealloc_pollfunc(indio_dev->pollfunc); - iio_kfifo_free(indio_dev->buffer); + iio_triggered_buffer_cleanup(indio_dev); } /** @@ -959,24 +931,16 @@ static int __devinit ad7793_probe(struct spi_device *spi) if (ret) goto error_unreg_ring; - ret = iio_buffer_register(indio_dev, - indio_dev->channels, - indio_dev->num_channels); - if (ret) - goto error_remove_trigger; - ret = ad7793_setup(st); if (ret) - goto error_uninitialize_ring; + goto error_remove_trigger; ret = iio_device_register(indio_dev); if (ret) - goto error_uninitialize_ring; + goto error_remove_trigger; return 0; -error_uninitialize_ring: - iio_buffer_unregister(indio_dev); error_remove_trigger: ad7793_remove_trigger(indio_dev); error_unreg_ring: @@ -999,7 +963,6 @@ static int ad7793_remove(struct spi_device *spi) struct ad7793_state *st = iio_priv(indio_dev); iio_device_unregister(indio_dev); - iio_buffer_unregister(indio_dev); ad7793_remove_trigger(indio_dev); ad7793_ring_cleanup(indio_dev); -- cgit v0.10.2 From cc4dd03a6a9535cb2f731c5069e6a02781e3267a Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 18 Jun 2012 18:33:55 +0200 Subject: staging:iio:adc:ad7887: Use new triggered buffer setup helper function Use the new triggered buffer setup helper function to allocate and register buffer and pollfunc. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/adc/Kconfig b/drivers/staging/iio/adc/Kconfig index 4fcc4be..e3fdb84 100644 --- a/drivers/staging/iio/adc/Kconfig +++ b/drivers/staging/iio/adc/Kconfig @@ -86,8 +86,7 @@ config AD7887 tristate "Analog Devices AD7887 ADC driver" depends on SPI select IIO_BUFFER - select IIO_KFIFO_BUF - select IIO_TRIGGER + select IIO_TRIGGERED_BUFFER help Say yes here to build support for Analog Devices AD7887 SPI analog to digital converter (ADC). diff --git a/drivers/staging/iio/adc/ad7887_core.c b/drivers/staging/iio/adc/ad7887_core.c index 7186074..397b849 100644 --- a/drivers/staging/iio/adc/ad7887_core.c +++ b/drivers/staging/iio/adc/ad7887_core.c @@ -201,20 +201,12 @@ static int __devinit ad7887_probe(struct spi_device *spi) if (ret) goto error_disable_reg; - ret = iio_buffer_register(indio_dev, - indio_dev->channels, - indio_dev->num_channels); - if (ret) - goto error_cleanup_ring; - ret = iio_device_register(indio_dev); if (ret) goto error_unregister_ring; return 0; error_unregister_ring: - iio_buffer_unregister(indio_dev); -error_cleanup_ring: ad7887_ring_cleanup(indio_dev); error_disable_reg: if (!IS_ERR(st->reg)) @@ -233,7 +225,6 @@ static int ad7887_remove(struct spi_device *spi) struct ad7887_state *st = iio_priv(indio_dev); iio_device_unregister(indio_dev); - iio_buffer_unregister(indio_dev); ad7887_ring_cleanup(indio_dev); if (!IS_ERR(st->reg)) { regulator_disable(st->reg); diff --git a/drivers/staging/iio/adc/ad7887_ring.c b/drivers/staging/iio/adc/ad7887_ring.c index fd91384..1c406da 100644 --- a/drivers/staging/iio/adc/ad7887_ring.c +++ b/drivers/staging/iio/adc/ad7887_ring.c @@ -14,8 +14,8 @@ #include #include -#include #include +#include #include "ad7887.h" @@ -112,38 +112,11 @@ static const struct iio_buffer_setup_ops ad7887_ring_setup_ops = { int ad7887_register_ring_funcs_and_init(struct iio_dev *indio_dev) { - int ret; - - indio_dev->buffer = iio_kfifo_allocate(indio_dev); - if (!indio_dev->buffer) { - ret = -ENOMEM; - goto error_ret; - } - indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time, - &ad7887_trigger_handler, - IRQF_ONESHOT, - indio_dev, - "ad7887_consumer%d", - indio_dev->id); - if (indio_dev->pollfunc == NULL) { - ret = -ENOMEM; - goto error_deallocate_kfifo; - } - /* Ring buffer functions - here trigger setup related */ - indio_dev->setup_ops = &ad7887_ring_setup_ops; - - /* Flag that polled ring buffering is possible */ - indio_dev->modes |= INDIO_BUFFER_TRIGGERED; - return 0; - -error_deallocate_kfifo: - iio_kfifo_free(indio_dev->buffer); -error_ret: - return ret; + return iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time, + &ad7887_trigger_handler, &ad7887_ring_setup_ops); } void ad7887_ring_cleanup(struct iio_dev *indio_dev) { - iio_dealloc_pollfunc(indio_dev->pollfunc); - iio_kfifo_free(indio_dev->buffer); + iio_triggered_buffer_cleanup(indio_dev); } -- cgit v0.10.2 From ae3805c3aece38ee40ebc902a598b44a393902e1 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 18 Jun 2012 18:33:56 +0200 Subject: staging:iio:adc:ad799x: Use new triggered buffer setup helper function Use the new triggered buffer setup helper function to allocate and register buffer and pollfunc. Also as part of the conversion drop scan_timestamp being enabled by default, since it is a left over of an earlier cleanup. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/adc/Kconfig b/drivers/staging/iio/adc/Kconfig index e3fdb84..67711b7 100644 --- a/drivers/staging/iio/adc/Kconfig +++ b/drivers/staging/iio/adc/Kconfig @@ -63,7 +63,7 @@ config AD799X_RING_BUFFER bool "Analog Devices AD799x: use ring buffer" depends on AD799X select IIO_BUFFER - select IIO_KFIFO_BUF + select IIO_TRIGGERED_BUFFER help Say yes here to include ring buffer support in the AD799X ADC driver. diff --git a/drivers/staging/iio/adc/ad799x.h b/drivers/staging/iio/adc/ad799x.h index 99f8abe..3e363c4 100644 --- a/drivers/staging/iio/adc/ad799x.h +++ b/drivers/staging/iio/adc/ad799x.h @@ -120,8 +120,6 @@ struct ad799x_platform_data { u16 vref_mv; }; -int ad7997_8_set_scan_mode(struct ad799x_state *st, unsigned mask); - #ifdef CONFIG_AD799X_RING_BUFFER int ad799x_register_ring_funcs_and_init(struct iio_dev *indio_dev); void ad799x_ring_cleanup(struct iio_dev *indio_dev); diff --git a/drivers/staging/iio/adc/ad799x_core.c b/drivers/staging/iio/adc/ad799x_core.c index 80e0c6e..2d4bda9 100644 --- a/drivers/staging/iio/adc/ad799x_core.c +++ b/drivers/staging/iio/adc/ad799x_core.c @@ -99,10 +99,21 @@ static int ad799x_i2c_write8(struct ad799x_state *st, u8 reg, u8 data) return ret; } -int ad7997_8_set_scan_mode(struct ad799x_state *st, unsigned mask) +static int ad7997_8_update_scan_mode(struct iio_dev *indio_dev, + const unsigned long *scan_mask) { - return ad799x_i2c_write16(st, AD7998_CONF_REG, - st->config | (mask << AD799X_CHANNEL_SHIFT)); + struct ad799x_state *st = iio_priv(indio_dev); + + switch (st->id) { + case ad7997: + case ad7998: + return ad799x_i2c_write16(st, AD7998_CONF_REG, + st->config | (*scan_mask << AD799X_CHANNEL_SHIFT)); + default: + break; + } + + return 0; } static int ad799x_scan_direct(struct ad799x_state *st, unsigned ch) @@ -442,6 +453,7 @@ static const struct iio_info ad7993_4_7_8_info = { .read_event_value = &ad799x_read_event_value, .write_event_value = &ad799x_write_event_value, .driver_module = THIS_MODULE, + .update_scan_mode = ad7997_8_update_scan_mode, }; #define AD799X_EV_MASK (IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING) | \ @@ -887,12 +899,6 @@ static int __devinit ad799x_probe(struct i2c_client *client, if (ret) goto error_disable_reg; - ret = iio_buffer_register(indio_dev, - indio_dev->channels, - indio_dev->num_channels); - if (ret) - goto error_cleanup_ring; - if (client->irq > 0) { ret = request_threaded_irq(client->irq, NULL, @@ -934,7 +940,6 @@ static __devexit int ad799x_remove(struct i2c_client *client) if (client->irq > 0) free_irq(client->irq, indio_dev); - iio_buffer_unregister(indio_dev); ad799x_ring_cleanup(indio_dev); if (!IS_ERR(st->reg)) { regulator_disable(st->reg); diff --git a/drivers/staging/iio/adc/ad799x_ring.c b/drivers/staging/iio/adc/ad799x_ring.c index 1c7ff44..0882c9e 100644 --- a/drivers/staging/iio/adc/ad799x_ring.c +++ b/drivers/staging/iio/adc/ad799x_ring.c @@ -18,33 +18,12 @@ #include #include -#include #include +#include #include "ad799x.h" /** - * ad799x_ring_preenable() setup the parameters of the ring before enabling - * - * The complex nature of the setting of the number of bytes per datum is due - * to this driver currently ensuring that the timestamp is stored at an 8 - * byte boundary. - **/ -static int ad799x_ring_preenable(struct iio_dev *indio_dev) -{ - struct ad799x_state *st = iio_priv(indio_dev); - /* - * Need to figure out the current mode based upon the requested - * scan mask in iio_dev - */ - - if (st->id == ad7997 || st->id == ad7998) - ad7997_8_set_scan_mode(st, *indio_dev->active_scan_mask); - - return iio_sw_buffer_preenable(indio_dev); -} - -/** * ad799x_trigger_handler() bh of trigger launched polling to ring buffer * * Currently there is no option in this driver to disable the saving of @@ -110,49 +89,13 @@ out: return IRQ_HANDLED; } -static const struct iio_buffer_setup_ops ad799x_buf_setup_ops = { - .preenable = &ad799x_ring_preenable, - .postenable = &iio_triggered_buffer_postenable, - .predisable = &iio_triggered_buffer_predisable, -}; - int ad799x_register_ring_funcs_and_init(struct iio_dev *indio_dev) { - int ret = 0; - - indio_dev->buffer = iio_kfifo_allocate(indio_dev); - if (!indio_dev->buffer) { - ret = -ENOMEM; - goto error_ret; - } - indio_dev->pollfunc = iio_alloc_pollfunc(NULL, - &ad799x_trigger_handler, - IRQF_ONESHOT, - indio_dev, - "%s_consumer%d", - indio_dev->name, - indio_dev->id); - if (indio_dev->pollfunc == NULL) { - ret = -ENOMEM; - goto error_deallocate_kfifo; - } - - /* Ring buffer functions - here trigger setup related */ - indio_dev->setup_ops = &ad799x_buf_setup_ops; - indio_dev->buffer->scan_timestamp = true; - - /* Flag that polled ring buffering is possible */ - indio_dev->modes |= INDIO_BUFFER_TRIGGERED; - return 0; - -error_deallocate_kfifo: - iio_kfifo_free(indio_dev->buffer); -error_ret: - return ret; + return iio_triggered_buffer_setup(indio_dev, NULL, + &ad799x_trigger_handler, NULL); } void ad799x_ring_cleanup(struct iio_dev *indio_dev) { - iio_dealloc_pollfunc(indio_dev->pollfunc); - iio_kfifo_free(indio_dev->buffer); + iio_triggered_buffer_cleanup(indio_dev); } -- cgit v0.10.2 From 0941b9307e461570afe0378a410fb339936fad31 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Mon, 18 Jun 2012 20:33:06 +0200 Subject: iio staging: fix typos in tsl*: register Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/light/tsl2583.c b/drivers/staging/iio/light/tsl2583.c index 5e23ad5..6d2f4c6 100644 --- a/drivers/staging/iio/light/tsl2583.c +++ b/drivers/staging/iio/light/tsl2583.c @@ -410,7 +410,7 @@ static int taos_chip_on(struct iio_dev *indio_dev) return -EINVAL; } - /* determine als integration regster */ + /* determine als integration register */ als_count = (chip->taos_settings.als_time * 100 + 135) / 270; if (als_count == 0) als_count = 1; /* ensure at least one cycle */ diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c index 040da4a..fdf75e4 100755 --- a/drivers/staging/iio/light/tsl2x7x_core.c +++ b/drivers/staging/iio/light/tsl2x7x_core.c @@ -736,7 +736,7 @@ static int tsl2x7x_chip_on(struct iio_dev *indio_dev) return -EINVAL; } - /* determine als integration regster */ + /* determine als integration register */ als_count = (chip->tsl2x7x_settings.als_time * 100 + 135) / 270; if (als_count == 0) als_count = 1; /* ensure at least one cycle */ -- cgit v0.10.2 From 7695afdeb4dc6ae1ac7118c6ef9df7246f575923 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Mon, 18 Jun 2012 20:33:05 +0200 Subject: iio staging: fix tsl2x7x file mode just drop execute permission Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/Documentation/light/sysfs-bus-iio-light-tsl2583 b/drivers/staging/iio/Documentation/light/sysfs-bus-iio-light-tsl2583 old mode 100755 new mode 100644 diff --git a/drivers/staging/iio/Documentation/light/sysfs-bus-iio-light-tsl2x7x b/drivers/staging/iio/Documentation/light/sysfs-bus-iio-light-tsl2x7x old mode 100755 new mode 100644 diff --git a/drivers/staging/iio/light/tsl2x7x.h b/drivers/staging/iio/light/tsl2x7x.h old mode 100755 new mode 100644 diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c old mode 100755 new mode 100644 -- cgit v0.10.2 From 2a1d45ecc8cac79afe7f769f4241e4ad919c45bf Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Mon, 18 Jun 2012 20:33:07 +0200 Subject: iio staging: fix spelling of suppression in isl29018 beware, does change the ABI as proximity_on_chip_ambient_infrared_supression is changed to proximity_on_chip_ambient_infrared_suppression Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Acked-by: Laxman Dewangan Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/Documentation/sysfs-bus-iio-light b/drivers/staging/iio/Documentation/sysfs-bus-iio-light index 715c74d..d52be03 100644 --- a/drivers/staging/iio/Documentation/sysfs-bus-iio-light +++ b/drivers/staging/iio/Documentation/sysfs-bus-iio-light @@ -34,7 +34,7 @@ Description: it comes back in SI units, it should also include _input else it should include _raw to signify it is not in SI units. -What: /sys/.../device[n]/proximity_on_chip_ambient_infrared_supression +What: /sys/.../device[n]/proximity_on_chip_ambient_infrared_suppression KernelVersion: 2.6.37 Contact: linux-iio@vger.kernel.org Description: diff --git a/drivers/staging/iio/light/isl29018.c b/drivers/staging/iio/light/isl29018.c index 0abbf18..31d22f5 100644 --- a/drivers/staging/iio/light/isl29018.c +++ b/drivers/staging/iio/light/isl29018.c @@ -292,18 +292,18 @@ static ssize_t store_resolution(struct device *dev, } /* proximity scheme */ -static ssize_t show_prox_infrared_supression(struct device *dev, +static ssize_t show_prox_infrared_suppression(struct device *dev, struct device_attribute *attr, char *buf) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct isl29018_chip *chip = iio_priv(indio_dev); /* return the "proximity scheme" i.e. if the chip does on chip - infrared supression (1 means perform on chip supression) */ + infrared suppression (1 means perform on chip suppression) */ return sprintf(buf, "%d\n", chip->prox_scheme); } -static ssize_t store_prox_infrared_supression(struct device *dev, +static ssize_t store_prox_infrared_suppression(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); @@ -318,7 +318,7 @@ static ssize_t store_prox_infrared_supression(struct device *dev, } /* get the "proximity scheme" i.e. if the chip does on chip - infrared supression (1 means perform on chip supression) */ + infrared suppression (1 means perform on chip suppression) */ mutex_lock(&chip->lock); chip->prox_scheme = (int)lval; mutex_unlock(&chip->lock); @@ -413,10 +413,10 @@ static IIO_CONST_ATTR(range_available, "1000 4000 16000 64000"); static IIO_CONST_ATTR(adc_resolution_available, "4 8 12 16"); static IIO_DEVICE_ATTR(adc_resolution, S_IRUGO | S_IWUSR, show_resolution, store_resolution, 0); -static IIO_DEVICE_ATTR(proximity_on_chip_ambient_infrared_supression, +static IIO_DEVICE_ATTR(proximity_on_chip_ambient_infrared_suppression, S_IRUGO | S_IWUSR, - show_prox_infrared_supression, - store_prox_infrared_supression, 0); + show_prox_infrared_suppression, + store_prox_infrared_suppression, 0); #define ISL29018_DEV_ATTR(name) (&iio_dev_attr_##name.dev_attr.attr) #define ISL29018_CONST_ATTR(name) (&iio_const_attr_##name.dev_attr.attr) @@ -425,7 +425,7 @@ static struct attribute *isl29018_attributes[] = { ISL29018_CONST_ATTR(range_available), ISL29018_DEV_ATTR(adc_resolution), ISL29018_CONST_ATTR(adc_resolution_available), - ISL29018_DEV_ATTR(proximity_on_chip_ambient_infrared_supression), + ISL29018_DEV_ATTR(proximity_on_chip_ambient_infrared_suppression), NULL }; -- cgit v0.10.2 From 9cc113bc84e683435c110268712d25aea05b8198 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Mon, 18 Jun 2012 20:33:01 +0200 Subject: iio: typo in iio_chan_spec.ext_info comment Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index ae0cad9..2afbb6f 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h @@ -214,7 +214,7 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev, * @event_mask: What events can this channel produce. * @ext_info: Array of extended info attributes for this channel. * The array is NULL terminated, the last element should - * have it's name field set to NULL. + * have its name field set to NULL. * @extend_name: Allows labeling of channel attributes with an * informative name. Note this has no effect codes etc, * unlike modifiers. -- cgit v0.10.2 From b90406f1e5f4cb673e331ce6d435f4bdbf2136a2 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Mon, 18 Jun 2012 20:33:02 +0200 Subject: iio: correct documentation for IIO_CONST_ATTR_SAMP_FREQ_AVAIL, match name of #define Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/include/linux/iio/sysfs.h b/include/linux/iio/sysfs.h index bfedb73..b7a934b 100644 --- a/include/linux/iio/sysfs.h +++ b/include/linux/iio/sysfs.h @@ -97,7 +97,7 @@ struct iio_const_attr { #define IIO_DEV_ATTR_SAMP_FREQ_AVAIL(_show) \ IIO_DEVICE_ATTR(sampling_frequency_available, S_IRUGO, _show, NULL, 0) /** - * IIO_CONST_ATTR_AVAIL_SAMP_FREQ - list available sampling frequencies + * IIO_CONST_ATTR_SAMP_FREQ_AVAIL - list available sampling frequencies * @_string: frequency string for the attribute * * Constant version -- cgit v0.10.2 From 19ea4752fc1f45c778ae66443c1023aced14ba05 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Mon, 18 Jun 2012 20:33:03 +0200 Subject: iio: remove extra ; after function definition Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h index fb0fe46..ad4fb1a 100644 --- a/include/linux/iio/buffer.h +++ b/include/linux/iio/buffer.h @@ -184,7 +184,7 @@ static inline int iio_buffer_register(struct iio_dev *indio_dev, } static inline void iio_buffer_unregister(struct iio_dev *indio_dev) -{}; +{} #endif /* CONFIG_IIO_BUFFER */ -- cgit v0.10.2 From d163a19d915e9bb3dfa01abc251bc4d5395dc118 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Mon, 18 Jun 2012 20:33:04 +0200 Subject: iio staging: another typo in iio_simple_dummy_buffer Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/iio_simple_dummy_buffer.c b/drivers/staging/iio/iio_simple_dummy_buffer.c index 3e43025..fa4939c 100644 --- a/drivers/staging/iio/iio_simple_dummy_buffer.c +++ b/drivers/staging/iio/iio_simple_dummy_buffer.c @@ -78,7 +78,7 @@ static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p) i++) { j = find_next_bit(buffer->scan_mask, indio_dev->masklength, j + 1); - /* random access read form the 'device' */ + /* random access read from the 'device' */ data[i] = fakedata[j]; len += 2; } -- cgit v0.10.2 From 76728a93a70f23c6376c728e337fb26473737e7f Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 18 Jun 2012 17:03:17 -0700 Subject: staging: comedi: pcmmio: quiet NULL pointer sparse noise The comedi_async 'inttrig' member is a pointer to a callback function. NULL should be used to clear it not 0. This quiets a number of sparse warnings about: Warning: Using plain integer as NULL pointer Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c index 82a60d6..3d2e6f0 100644 --- a/drivers/staging/comedi/drivers/pcmmio.c +++ b/drivers/staging/comedi/drivers/pcmmio.c @@ -512,7 +512,7 @@ static void pcmmio_stop_intr(struct comedi_device *dev, subpriv->dio.intr.enabled_mask = 0; subpriv->dio.intr.active = 0; - s->async->inttrig = 0; + s->async->inttrig = NULL; nports = subpriv->dio.intr.num_asic_chans / CHANS_PER_PORT; firstport = subpriv->dio.intr.asic_chan / CHANS_PER_PORT; switch_page(dev, asic, PAGE_ENAB); @@ -778,7 +778,7 @@ pcmmio_inttrig_start_intr(struct comedi_device *dev, struct comedi_subdevice *s, return -EINVAL; spin_lock_irqsave(&subpriv->dio.intr.spinlock, flags); - s->async->inttrig = 0; + s->async->inttrig = NULL; if (subpriv->dio.intr.active) event = pcmmio_start_intr(dev, s); spin_unlock_irqrestore(&subpriv->dio.intr.spinlock, flags); -- cgit v0.10.2 From 55232eca66c540cbef9b950e71b358137651955b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 18 Jun 2012 16:53:17 -0700 Subject: staging: comedi: comedi_compat_ioctl should be NULL not 0 When CONFIG_COMPAT is not defined, comedi_compat_ioctl should be NULL not 0 in order to set the file_operations compat_ioctl variable correctly. This quiets a sparse warning about: warning: Using plain integer as NULL pointer Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/comedi_compat32.h b/drivers/staging/comedi/comedi_compat32.h index 0340a89..c99573b 100644 --- a/drivers/staging/comedi/comedi_compat32.h +++ b/drivers/staging/comedi/comedi_compat32.h @@ -37,7 +37,7 @@ extern long comedi_compat_ioctl(struct file *file, unsigned int cmd, #else /* CONFIG_COMPAT */ -#define comedi_compat_ioctl 0 /* NULL */ +#define comedi_compat_ioctl NULL #endif /* CONFIG_COMPAT */ -- cgit v0.10.2 From 15a4bc17b7f4e85cb019e683f14e834078ec2208 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 24 May 2012 09:47:38 -0700 Subject: Staging: add CSR Wifi "os helper" module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This module is used by the CSR wifi driver to "abstract" away the OS-specific parts of core functions. It will be eventually deleted, but for now is needed as the CSR driver relies on it. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 38f1fb0..d3934d7 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -132,4 +132,6 @@ source "drivers/staging/ipack/Kconfig" source "drivers/staging/gdm72xx/Kconfig" +source "drivers/staging/csr/Kconfig" + endif # STAGING diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index e0c4c24..5b2219a 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -58,3 +58,4 @@ obj-$(CONFIG_RAMSTER) += ramster/ obj-$(CONFIG_USB_WPAN_HCD) += ozwpan/ obj-$(CONFIG_USB_G_CCG) += ccg/ obj-$(CONFIG_WIMAX_GDM72XX) += gdm72xx/ +obj-$(CONFIG_CSR_WIFI) += csr/ diff --git a/drivers/staging/csr/Kconfig b/drivers/staging/csr/Kconfig new file mode 100644 index 0000000..5d7b800 --- /dev/null +++ b/drivers/staging/csr/Kconfig @@ -0,0 +1,7 @@ +config CSR_WIFI + tristate "CSR wireless driver" + depends on PCI + help + Driver for the CSR wireless SDIO device. + + If unsure, select N. diff --git a/drivers/staging/csr/Makefile b/drivers/staging/csr/Makefile new file mode 100644 index 0000000..b9ba3b3 --- /dev/null +++ b/drivers/staging/csr/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_CSR_WIFI) += oska/ diff --git a/drivers/staging/csr/oska/Makefile b/drivers/staging/csr/oska/Makefile new file mode 100644 index 0000000..3a0b648 --- /dev/null +++ b/drivers/staging/csr/oska/Makefile @@ -0,0 +1,12 @@ +obj-$(CONFIG_CSR_WIFI) := csr_oska.o + +csr_oska-y := \ + list.o \ + refcount.o \ + compat.o \ + event.o \ + oska_module.o \ + print.o \ + thread.o \ + timer.o + diff --git a/drivers/staging/csr/oska/all.h b/drivers/staging/csr/oska/all.h new file mode 100644 index 0000000..5fe8583 --- /dev/null +++ b/drivers/staging/csr/oska/all.h @@ -0,0 +1,61 @@ +/* + * Operating system kernel abstraction -- all functions + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef __OSKA_ALL_H +#define __OSKA_ALL_H + +/** + * @mainpage Operating System Kernel Abstraction + * + * @section intro Introduction + * + * The Operating System Kernel Abstraction (oska) is a software + * package providing an abstraction for various operating system + * kernel facilities for use by device drivers and other OS kernel + * software (e.g., SDIO stacks). Oska is modularized and intended to + * be a lightweight wrapper around an OSes interfaces. + * + * @section modules Modules + * + * Oska is organized into the modules, each of which has it's own + * header file providing the interface. + * + * - \ref alloc "Memory allocation" + * - \ref event "Events" + * - \ref mutex "Mutexes" + * - \ref print "Console output" + * - \ref spinlock "Spinlocks" + * - \ref thread "Threading" + * - \ref time "Timing and delays" + * - \ref timer "Timers" + * - \ref types "Standard Types" + * - \ref util "Miscellaneous utilities" + * + * An header is provided which includes all the above + * modules. + * + * There are additional modules that are not included in . + * + * - \ref io "Memory mapped I/O" + * - \ref refcount "Reference Counting" + * - \ref list "Linked lists" + * - \ref trace "Tracing messages" + */ + +#include "alloc.h" +#include "event.h" +#include "mutex.h" +#include "print.h" +#include "spinlock.h" +#include "thread.h" +#include "time.h" +#include "timer.h" +#include "types.h" +#include "util.h" + +#endif /* __OSKA_ALL_H */ diff --git a/drivers/staging/csr/oska/alloc.h b/drivers/staging/csr/oska/alloc.h new file mode 100644 index 0000000..0f10601 --- /dev/null +++ b/drivers/staging/csr/oska/alloc.h @@ -0,0 +1,41 @@ +/* + * OSKA Linux implementation -- memory allocation + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef __OSKA_LINUX_ALLOC_H +#define __OSKA_LINUX_ALLOC_H + +#include +#include +#include + +static inline void *os_alloc(size_t size) +{ + return kzalloc(size, GFP_ATOMIC); +} + +static inline void *os_alloc_nonzeroed(size_t size) +{ + return kmalloc(size, GFP_KERNEL); +} + +static inline void os_free(void *ptr) +{ + kfree(ptr); +} + +static inline void *os_alloc_big(size_t size) +{ + return vmalloc(size); +} + +static inline void os_free_big(void *ptr) +{ + vfree(ptr); +} + +#endif /* #ifndef __OSKA_LINUX_ALLOC_H */ diff --git a/drivers/staging/csr/oska/compat.c b/drivers/staging/csr/oska/compat.c new file mode 100644 index 0000000..790b97a --- /dev/null +++ b/drivers/staging/csr/oska/compat.c @@ -0,0 +1,54 @@ +/* + * Linux version compatibility functions. + * + * Copyright (C) 2008 Cambridge Silicon Radio Ltd. + * + * 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, see . + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#include "kernel-compat.h" + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) + +int dev_set_name(struct device *dev, const char *fmt, ...) +{ + va_list vargs; + + va_start(vargs, fmt); + vsnprintf(dev->bus_id, sizeof(dev->bus_id), fmt, vargs); + va_end(vargs); + return 0; +} +EXPORT_SYMBOL_GPL(dev_set_name); + +#endif /* Linux kernel < 2.6.26 */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) + +struct device *class_find_device(struct class *class, struct device *start, + void *data, int (*match)(struct device *, void *)) +{ + struct device *dev; + + list_for_each_entry(dev, &class->devices, node) { + if (match(dev, data)) { + get_device(dev); + return dev; + } + } + return NULL; +} +EXPORT_SYMBOL_GPL(class_find_device); + +#endif /* Linux kernel < 2.6.25 */ diff --git a/drivers/staging/csr/oska/event.c b/drivers/staging/csr/oska/event.c new file mode 100644 index 0000000..4aedaaa --- /dev/null +++ b/drivers/staging/csr/oska/event.c @@ -0,0 +1,82 @@ +/* + * Linux event functions. + * + * Copyright (C) 2009 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#include +#include + +#include "event.h" + +void os_event_init(os_event_t *evt) +{ + init_waitqueue_head(&evt->wq); + spin_lock_init(&evt->lock); + evt->events = 0; +} +EXPORT_SYMBOL(os_event_init); + +uint16_t os_event_wait(os_event_t *evt) +{ + uint16_t e; + unsigned long flags; + + wait_event(evt->wq, evt->events != 0); + + spin_lock_irqsave(&evt->lock, flags); + e = evt->events; + evt->events &= ~e; + spin_unlock_irqrestore(&evt->lock, flags); + + return e; +} +EXPORT_SYMBOL(os_event_wait); + +uint16_t os_event_wait_interruptible(os_event_t *evt) +{ + uint16_t e; + unsigned long flags; + + wait_event_interruptible(evt->wq, evt->events != 0); + + spin_lock_irqsave(&evt->lock, flags); + e = evt->events; + evt->events &= ~e; + spin_unlock_irqrestore(&evt->lock, flags); + + return e; +} +EXPORT_SYMBOL(os_event_wait_interruptible); + +uint16_t os_event_wait_timed(os_event_t *evt, unsigned timeout_ms) +{ + uint16_t e; + unsigned long flags; + + wait_event_interruptible_timeout(evt->wq, + evt->events != 0, + msecs_to_jiffies(timeout_ms)); + + spin_lock_irqsave(&evt->lock, flags); + e = evt->events; + evt->events &= ~e; + spin_unlock_irqrestore(&evt->lock, flags); + + return e; +} +EXPORT_SYMBOL(os_event_wait_timed); + +void os_event_raise(os_event_t *evt, uint16_t events) +{ + unsigned long flags; + + spin_lock_irqsave(&evt->lock, flags); + evt->events |= events; + spin_unlock_irqrestore(&evt->lock, flags); + + wake_up(&evt->wq); +} +EXPORT_SYMBOL(os_event_raise); diff --git a/drivers/staging/csr/oska/event.h b/drivers/staging/csr/oska/event.h new file mode 100644 index 0000000..be52e42 --- /dev/null +++ b/drivers/staging/csr/oska/event.h @@ -0,0 +1,33 @@ +/* + * OSKA Linux implementation -- events + * + * Copyright (C) 2009 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef __OSKA_LINUX_EVENT_H +#define __OSKA_LINUX_EVENT_H + +#include +#include +#include + +typedef struct { + wait_queue_head_t wq; + spinlock_t lock; + uint16_t events; +} os_event_t; + +void os_event_init(os_event_t *evt); + +static inline void os_event_destroy(os_event_t *evt) +{ +} + +uint16_t os_event_wait(os_event_t *evt); +uint16_t os_event_wait_interruptible(os_event_t *evt); +uint16_t os_event_wait_timed(os_event_t *evt, unsigned timeout_ms); +void os_event_raise(os_event_t *evt, uint16_t events); + +#endif /* #ifndef __OSKA_LINUX_EVENT_H */ diff --git a/drivers/staging/csr/oska/io.h b/drivers/staging/csr/oska/io.h new file mode 100644 index 0000000..c6c406c --- /dev/null +++ b/drivers/staging/csr/oska/io.h @@ -0,0 +1,63 @@ +/* + * OSKA Linux implementation -- memory mapped I/O. + * + * Copyright (C) 2009 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef __OSKA_LINUX_IO_H +#define __OSKA_LINUX_IO_H + +#include +#include +#include + +typedef void __iomem *os_io_mem_t; + +static inline uint8_t os_io_read8(os_io_mem_t base, unsigned offset) +{ + return readb(base + offset); +} + +static inline uint16_t os_io_read16(os_io_mem_t base, unsigned offset) +{ + return readw(base + offset); +} + +static inline uint32_t os_io_read32(os_io_mem_t base, unsigned offset) +{ + return readl(base + offset); +} + +static inline uint64_t os_io_read64(os_io_mem_t base, unsigned offset) +{ + return readq(base + offset); +} + +static inline void os_io_write8(os_io_mem_t base, unsigned offset, uint8_t val) +{ + writeb(val, base + offset); +} + +static inline void os_io_write16(os_io_mem_t base, unsigned offset, uint16_t val) +{ + writew(val, base + offset); +} + +static inline void os_io_write32(os_io_mem_t base, unsigned offset, uint32_t val) +{ + writel(val, base + offset); +} + +static inline void os_io_write64(os_io_mem_t base, unsigned offset, uint64_t val) +{ + writeq(val, base + offset); +} + +static inline void os_io_memory_barrier(void) +{ + mb(); +} + +#endif /* #ifndef __OSKA_LINUX_IO_H */ diff --git a/drivers/staging/csr/oska/kernel-compat.h b/drivers/staging/csr/oska/kernel-compat.h new file mode 100644 index 0000000..b6d27d3 --- /dev/null +++ b/drivers/staging/csr/oska/kernel-compat.h @@ -0,0 +1,199 @@ +/* + * Kernel version compatibility. + * + * Copyright (C) 2007-2008 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * Wherever possible compatible implementations of newer APIs are + * provided for older kernel versions. + */ +#ifndef __LINUX_KERNEL_COMPAT_H +#define __LINUX_KERNEL_COMPAT_H + +#include +#include +#include + +#include + +/* + * linux/semaphore.h replaces asm/semaphore.h in 2.6.27. + */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) +# include +#else +# include +#endif + +/* + * Workqueue API changes in 2.6.20 + * + * See http://lwn.net/Articles/211279/ for details. + * + * We deliberately don't provide the non-automatic release (NAR) + * variants as a simple compatible implementation is not possible. + * This shouldn't be a problem as all usage so far is to embed the + * struct work_struct into another struct and the NAR variants aren't + * useful in this case (see http://lwn.net/Articles/213149/). + */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) + +#include + +#undef INIT_WORK +#define INIT_WORK(_work, _func) \ + do { \ + INIT_LIST_HEAD(&(_work)->entry); \ + (_work)->pending = 0; \ + PREPARE_WORK((_work), (_func), (_work)); \ + init_timer(&(_work)->timer); \ + } while(0) + +#undef DECLARE_WORK +#define DECLARE_WORK(n, f) \ + struct work_struct n = __WORK_INITIALIZER((n), (f), &(n)) + +struct delayed_work { + struct work_struct work; +}; + +#define INIT_DELAYED_WORK(dw, fn) \ + INIT_WORK(&(dw)->work, (fn)) + +#define queue_delayed_work(wq, dw, delay) \ + queue_delayed_work((wq), &(dw)->work, (delay)) + +#define schedule_delayed_work(dw, delay) \ + schedule_delayed_work(&(dw)->work, (delay)) + +#define cancel_delayed_work(dw) \ + cancel_delayed_work(&(dw)->work) + +#endif /* Linux kernel < 2.6.20 */ + +/* + * device_create()/class_device_create() + * + * device_create() gains a drvdata parameter in 2.6.27. Since all + * users of device_create() in CSR code don't use drvdata just ignore + * it. + * + * device_create() replaces class_device_create() in 2.6.21. + */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21) + +#define device_create(class, parent, devt, drvdata, fmt, args...) \ + class_device_create((class), (parent), (devt), NULL, (fmt), ## args) +#define device_destroy(class, devt) \ + class_device_destroy(class, devt) + +#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) + +#define device_create(class, parent, devt, drvdata, fmt, args...) \ + device_create((class), (parent), (devt), (fmt), ## args) + +#endif /* Linux kernel < 2.6.26 */ + +/* + * dev_name() and dev_set_name() added in 2.6.26. + */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) + +static inline char *dev_name(struct device *dev) +{ + return dev->bus_id; +} + +int dev_set_name(struct device *dev, const char *fmt, ...); + +#endif /* Linux kernel < 2.6.26 */ + +/* + * class_find_device() in 2.6.25 + */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) + +struct device *class_find_device(struct class *class, struct device *start, + void *data, int (*match)(struct device *, void *)); + +#endif /* Linux kernel < 2.6.25 */ + +/* + * list_first_entry in 2.6.22. + */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) + +#define list_first_entry(ptr, type, member) \ + list_entry((ptr)->next, type, member) + +#endif /* Linux kernel < 2.6.22 */ + +/* + * 2.6.19 adds a bool type. + */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) + +typedef _Bool bool; +enum { + false = 0, + true = 1 +}; + +#endif /* Linux kernel < 2.6.19 */ + +/* + * Provide readq() and writeq() if unavailable. + */ +#ifndef readq +static inline __u64 readq(const volatile void __iomem *addr) +{ + const volatile u32 __iomem *p = addr; + u32 low, high; + + low = readl(p); + high = readl(p + 1); + + return low + ((u64)high << 32); +} +#endif + +#ifndef writeq +static inline void writeq(__u64 val, volatile void __iomem *addr) +{ + writel(val, addr); + writel(val >> 32, addr+4); +} +#endif + +/* + * get_unaligned_le16() and friends added in 2.6.26. + */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) +#include + +static inline __u16 get_unaligned_le16(const void *p) +{ + return le16_to_cpu(get_unaligned((__le16 *)p)); +} + +static inline void put_unaligned_le16(__u16 val, const void *p) +{ + put_unaligned(cpu_to_le16(val), (__le16 *)p); +} +#endif /* Linux kernel < 2.6.26 */ + +/* + * Various device or vendor IDs may not exist. + */ +#ifndef PCI_VENDOR_ID_CSR +# define PCI_VENDOR_ID_CSR 0x18e5 +#endif + +#ifndef PCI_DEVICE_ID_JMICRON_JMB38X_SD +# define PCI_DEVICE_ID_JMICRON_JMB38X_SD 0x2381 +#endif + +#endif /* #ifndef __LINUX_KERNEL_COMPAT_H */ diff --git a/drivers/staging/csr/oska/list.c b/drivers/staging/csr/oska/list.c new file mode 100644 index 0000000..b5e884e --- /dev/null +++ b/drivers/staging/csr/oska/list.c @@ -0,0 +1,103 @@ +/* + * Operating system kernel abstraction -- linked lists. + * + * Copyright (C) 2009-2010 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ + +#include + +#include "list.h" +#include "util.h" + +/** + * Initialize an empty list. + * + * @ingroup list + */ +void os_list_init(struct os_list *list) +{ + list->head.next = list->head.prev = &list->head; +} + +/** + * Is the list empty? + * + * @return true iff the list contains no nodes. + * + * @ingroup list + */ +int os_list_empty(struct os_list *list) +{ + return list->head.next == &list->head; +} + +static void os_list_add(struct os_list_node *prev, struct os_list_node *new, + struct os_list_node *next) +{ + OS_ASSERT(new->next == NULL && new->prev == NULL); + + next->prev = new; + new->next = next; + new->prev = prev; + prev->next = new; +} + +/** + * Add a node to the tail of the list. + * + * @param list the list. + * @param node the list node to add. + * + * @ingroup list + */ +void os_list_add_tail(struct os_list *list, struct os_list_node *node) +{ + os_list_add(list->head.prev, node, &list->head); +} + +/** + * Remove a node from a list. + * + * @param node the node to remove. + * + * @ingroup list + */ +void os_list_del(struct os_list_node *node) +{ + node->prev->next = node->next; + node->next->prev = node->prev; + + node->prev = node->next = NULL; +} + +/** + * The node at the head of the list. + * + * @param list the list. + * + * @return the node at the head of the list; or os_list_end() if the + * list is empty. + * + * @ingroup list + */ +struct os_list_node *os_list_head(struct os_list *list) +{ + return list->head.next; +} + +/** + * The node marking the end of a list. + * + * @param list the list. + * + * @return the node that marks the end of the list. + * + * @ingroup list + */ +struct os_list_node *os_list_end(struct os_list *list) +{ + return &list->head; +} diff --git a/drivers/staging/csr/oska/list.h b/drivers/staging/csr/oska/list.h new file mode 100644 index 0000000..a69b3b7 --- /dev/null +++ b/drivers/staging/csr/oska/list.h @@ -0,0 +1,115 @@ +/* + * Operating system kernel abstraction -- linked lists. + * + * Copyright (C) 2009-2010 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef __OSKA_LIST_H +#define __OSKA_LIST_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @defgroup list Linked Lists + * + * Generic linked list implementations suitable for all platforms. + * + * - Circular, doubly-linked list (struct os_list). + */ + +/** + * A list node. + * + * This list node structure should be the first field within any + * structure that is to be stored in a list. + * + * @see struct os_list + * @ingroup list + */ +struct os_list_node { + /** + * The pointer to the previous node in the list, or os_list_end() + * if the end of the list has been reached. + */ + struct os_list_node *prev; + /** + * The pointer to the next node in the list, or os_list_end() if + * the end of the list has been reached. + */ + struct os_list_node *next; +}; + +/** + * A circular, doubly-linked list of nodes. + * + * Structures to be stored in a list should contains a struct + * os_list_node as the \e first field. + * \code + * struct foo { + * struct os_list_node node; + * int bar; + * ... + * }; + * \endcode + * Going to/from a struct foo to a list node is then simple. + * \code + * struct os_list_node *node; + * struct foo *foo; + * [...] + * node = &foo->node; + * foo = (struct foo *)node + * \endcode + * Lists must be initialized with os_list_init() before adding nodes + * with os_list_add_tail(). The node at the head of the list is + * obtained with os_list_head(). Nodes are removed from the list with + * os_list_del(). + * + * A list can be interated from the head to the tail using: + * \code + * struct os_list_node *node; + * for (node = os_list_head(list); node != os_list_end(list); node = node->next) { + * struct foo *foo = (struct foo *)node; + * ... + * } + * \endcode + * + * In the above loop, the current list node cannot be removed (with + * os_list_del()). If this is required use this form of loop: + * \code + * struct os_list_node *node, *next; + * for (node = os_list_head(list), next = node->next; + * node != os_list_end(list); + * node = next, next = node->next) { + * struct foo *foo = (struct foo *)node; + * ... + * os_list_del(node); + * ... + * } + * \endcode + * + * @ingroup list + */ +struct os_list { + /** + * @internal + * The dummy node marking the end of the list. + */ + struct os_list_node head; +}; + +void os_list_init(struct os_list *list); +int os_list_empty(struct os_list *list); +void os_list_add_tail(struct os_list *list, struct os_list_node *node); +void os_list_del(struct os_list_node *node); +struct os_list_node *os_list_head(struct os_list *list); +struct os_list_node *os_list_end(struct os_list *list); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* #ifndef __OSKA_LIST_H */ diff --git a/drivers/staging/csr/oska/mutex.h b/drivers/staging/csr/oska/mutex.h new file mode 100644 index 0000000..9138b28 --- /dev/null +++ b/drivers/staging/csr/oska/mutex.h @@ -0,0 +1,42 @@ +/* + * OSKA Linux implementation -- mutexes + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef __OSKA_LINUX_MUTEX_H +#define __OSKA_LINUX_MUTEX_H + +#include +#include + +#include "kernel-compat.h" + +/* Real mutexes were only added to 2.6.16 so use semaphores + instead. */ +typedef struct semaphore os_mutex_t; + +static inline void os_mutex_init(os_mutex_t *mutex) +{ + //init_MUTEX(mutex); + sema_init(mutex, 1); +} + +static inline void os_mutex_destroy(os_mutex_t *mutex) +{ + /* no op */ +} + +static inline void os_mutex_lock(os_mutex_t *mutex) +{ + down(mutex); +} + +static inline void os_mutex_unlock(os_mutex_t *mutex) +{ + up(mutex); +} + +#endif /* __OSKA_LINUX_MUTEX_H */ diff --git a/drivers/staging/csr/oska/oska_module.c b/drivers/staging/csr/oska/oska_module.c new file mode 100644 index 0000000..da12564 --- /dev/null +++ b/drivers/staging/csr/oska/oska_module.c @@ -0,0 +1,21 @@ +/* + * Linux kernel module support. + * + * Copyright (C) 2010 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#include + +#include "all.h" +#include "refcount.h" + +EXPORT_SYMBOL(os_refcount_init); +EXPORT_SYMBOL(os_refcount_destroy); +EXPORT_SYMBOL(os_refcount_get); +EXPORT_SYMBOL(os_refcount_put); + +MODULE_DESCRIPTION("Operating System Kernel Abstraction"); +MODULE_AUTHOR("Cambridge Silicon Radio Ltd."); +MODULE_LICENSE("GPL and additional rights"); diff --git a/drivers/staging/csr/oska/print.c b/drivers/staging/csr/oska/print.c new file mode 100644 index 0000000..5f5b263 --- /dev/null +++ b/drivers/staging/csr/oska/print.c @@ -0,0 +1,44 @@ +/* + * Linux console printing functions. + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#include + +#include "print.h" + +void os_print(enum os_print_level level, const char *prefix, const char *name, + const char *format, ...) +{ + va_list va_args; + + va_start(va_args, format); + os_vprint(level, prefix, name, format, va_args); + va_end(va_args); +} +EXPORT_SYMBOL(os_print); + +void os_vprint(enum os_print_level level, const char *prefix, const char *name, + const char *format, va_list args) +{ + const char *level_str[] = { + [OS_PRINT_ERROR] = KERN_ERR, + [OS_PRINT_WARNING] = KERN_WARNING, + [OS_PRINT_INFO] = KERN_INFO, + [OS_PRINT_DEBUG] = KERN_DEBUG, + }; + char buf[80]; + int w = 0; + + if (name) { + w += snprintf(buf + w, sizeof(buf) - w, "%s%s%s: ", level_str[level], prefix, name); + } else { + w += snprintf(buf + w, sizeof(buf) - w, "%s%s", level_str[level], prefix); + } + w += vsnprintf(buf + w, sizeof(buf) - w, format, args); + printk("%s\n", buf); +} +EXPORT_SYMBOL(os_vprint); diff --git a/drivers/staging/csr/oska/print.h b/drivers/staging/csr/oska/print.h new file mode 100644 index 0000000..f48bb83 --- /dev/null +++ b/drivers/staging/csr/oska/print.h @@ -0,0 +1,32 @@ +/* + * OSKA Linux implementation -- console printing + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef __OSKA_LINUX_PRINT_H +#define __OSKA_LINUX_PRINT_H + +#include + +/** + * Severity of a console or log message. + * + * @ingroup print + */ +enum os_print_level { + OS_PRINT_ERROR, + OS_PRINT_WARNING, + OS_PRINT_INFO, + OS_PRINT_DEBUG, +}; + +void os_print(enum os_print_level level, const char *prefix, const char *name, + const char *format, ...); +void os_vprint(enum os_print_level level, const char *prefix, const char *name, + const char *format, va_list args); + + +#endif /* #ifndef __OSKA_LINUX_PRINT_H */ diff --git a/drivers/staging/csr/oska/refcount.c b/drivers/staging/csr/oska/refcount.c new file mode 100644 index 0000000..28abb64 --- /dev/null +++ b/drivers/staging/csr/oska/refcount.c @@ -0,0 +1,47 @@ +/* + * OSKA generic implementation -- reference counting. + * + * Copyright (C) 2010 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#include "refcount.h" +#include "types.h" + +void os_refcount_init(os_refcount_t *refcount, os_refcount_callback_f func, void *arg) +{ + os_spinlock_init(&refcount->lock); + refcount->count = 1; + refcount->func = func; + refcount->arg = arg; +} + +void os_refcount_destroy(os_refcount_t *refcount) +{ + os_spinlock_destroy(&refcount->lock); +} + +void os_refcount_get(os_refcount_t *refcount) +{ + os_int_status_t istate; + + os_spinlock_lock_intsave(&refcount->lock, &istate); + refcount->count++; + os_spinlock_unlock_intrestore(&refcount->lock, &istate); +} + +void os_refcount_put(os_refcount_t *refcount) +{ + bool is_zero; + os_int_status_t istate; + + os_spinlock_lock_intsave(&refcount->lock, &istate); + refcount->count--; + is_zero = refcount->count == 0; + os_spinlock_unlock_intrestore(&refcount->lock, &istate); + + if (is_zero) { + refcount->func(refcount->arg); + } +} diff --git a/drivers/staging/csr/oska/refcount.h b/drivers/staging/csr/oska/refcount.h new file mode 100644 index 0000000..741b00a --- /dev/null +++ b/drivers/staging/csr/oska/refcount.h @@ -0,0 +1,86 @@ +/* + * Operating system kernel abstraction -- reference counting. + * + * Copyright (C) 2010 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef __OSKA_REFCOUNT_H +#define __OSKA_REFCOUNT_H + +#include "spinlock.h" + +/** + * @defgroup refcount Reference Counting + * + * A reference count is an atomic counter. A callback function is + * called whenever the count reaches zero. + * + * A generic implementation is provided that is suitable for all + * platforms that support the spinlock API in (see + * \ref spinlock). + */ + +typedef void (*os_refcount_callback_f)(void *arg); + +struct __os_refcount_impl { + unsigned count; + os_spinlock_t lock; + os_refcount_callback_f func; + void *arg; +}; + +/** + * A reference count object. + * + * @ingroup refcount + */ +typedef struct __os_refcount_impl os_refcount_t; + +/** + * Initialize a reference count to 1. + * + * Initialized reference counts must be destroyed by calling + * os_refcount_destroy(). + * + * @param refcount the reference count. + * @param func the function which will be called when the + * reference count reaches 0. + * @param arg an argument to pass to func. + * + * @ingroup refcount + */ +void os_refcount_init(os_refcount_t *refcount, os_refcount_callback_f func, void *arg); + +/** + * Destroy a reference count object. + * + * @param refcount the reference count. + * + * @ingroup refcount + */ +void os_refcount_destroy(os_refcount_t *refcount); + +/** + * Atomically increase the reference count by 1. + * + * @param refcount the reference count. + * + * @ingroup refcount + */ +void os_refcount_get(os_refcount_t *refcount); + +/** + * Atomically decrease the reference count by 1. + * + * The callback function passed to the call to os_refcount_init() is + * called if the count was decreased to zero. + * + * @param refcount the reference count. + * + * @ingroup refcount + */ +void os_refcount_put(os_refcount_t *refcount); + +#endif /* #ifndef __OSKA_REFCOUNT_H */ diff --git a/drivers/staging/csr/oska/semaphore.h b/drivers/staging/csr/oska/semaphore.h new file mode 100644 index 0000000..965bfe8 --- /dev/null +++ b/drivers/staging/csr/oska/semaphore.h @@ -0,0 +1,70 @@ +/* + * OSKA Linux implementation -- semaphores + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef __OSKA_LINUX_SEMAPHORE_H +#define __OSKA_LINUX_SEMAPHORE_H + +#include + +#include + +typedef struct semaphore os_semaphore_t; + +static inline void os_semaphore_init(os_semaphore_t *sem) +{ + sema_init(sem, 0); +} + +static inline void os_semaphore_destroy(os_semaphore_t *sem) +{ +} + +static inline void os_semaphore_wait(os_semaphore_t *sem) +{ + down(sem); +} + +/* + * down_timeout() was added in 2.6.26 with the generic semaphore + * implementation. For now, only support it on recent kernels as + * semaphores may be replaced by an event API that would be + * implemented with wait_event(), and wait_event_timeout(). + */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) + +static inline int os_semaphore_wait_timed(os_semaphore_t *sem, + int time_ms) +{ + if (down_timeout(sem, msecs_to_jiffies(time_ms)) < 0) { + return -ETIMEDOUT; + } + return 0; +} + +#else + +static inline int os_semaphore_wait_timed(os_semaphore_t *sem, int time_ms) +{ + unsigned long now = jiffies; + do{ + if(!down_trylock(sem)) + return 0; + msleep(1); + } while(time_before(jiffies, now + msecs_to_jiffies(time_ms))); + + return -ETIMEDOUT; +} + +#endif + +static inline void os_semaphore_post(os_semaphore_t *sem) +{ + up(sem); +} + +#endif /* __OSKA_LINUX_SEMAPHORE_H */ diff --git a/drivers/staging/csr/oska/spinlock.h b/drivers/staging/csr/oska/spinlock.h new file mode 100644 index 0000000..157b350 --- /dev/null +++ b/drivers/staging/csr/oska/spinlock.h @@ -0,0 +1,43 @@ +/* + * OSKA Linux implementation -- spinlocks + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef __OSKA_LINUX_SPINLOCK_H +#define __OSKA_LINUX_SPINLOCK_H + +#include +#include + +typedef spinlock_t os_spinlock_t; +typedef unsigned long os_int_status_t; + +static inline void os_spinlock_init(os_spinlock_t *lock) +{ + spinlock_t *l = (spinlock_t *)lock; + spin_lock_init(l); +} + +static inline void os_spinlock_destroy(os_spinlock_t *lock) +{ + /* no op */ +} + +static inline void os_spinlock_lock_intsave(os_spinlock_t *lock, + os_int_status_t *int_state) +{ + spinlock_t *l = (spinlock_t *)lock; + spin_lock_irqsave(l, *int_state); +} + +static inline void os_spinlock_unlock_intrestore(os_spinlock_t *lock, + os_int_status_t *int_state) +{ + spinlock_t *l = (spinlock_t *)lock; + spin_unlock_irqrestore(l, *int_state); +} + +#endif /* #ifndef __OSKA_LINUX_SPINLOCK_H */ diff --git a/drivers/staging/csr/oska/thread.c b/drivers/staging/csr/oska/thread.c new file mode 100644 index 0000000..f680cef --- /dev/null +++ b/drivers/staging/csr/oska/thread.c @@ -0,0 +1,66 @@ +/* + * Linux thread functions. + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#include + +#include "thread.h" + +static int thread_func(void *data) +{ + os_thread_t *thread = data; + + thread->func(thread->arg); + + /* + * kthread_stop() cannot handle the thread exiting while + * kthread_should_stop() is false, so sleep until kthread_stop() + * wakes us up. + */ + set_current_state(TASK_INTERRUPTIBLE); + if (!kthread_should_stop()) + schedule(); + + return 0; +} + +int os_thread_create(os_thread_t *thread, const char *name, void (*func)(void *), void *arg) +{ + thread->func = func; + thread->arg = arg; + + thread->stop = 0; + + thread->task = kthread_run(thread_func, thread, name); + if (IS_ERR(thread->task)) { + return PTR_ERR(thread->task); + } + return 0; +} +EXPORT_SYMBOL(os_thread_create); + +void os_thread_stop(os_thread_t *thread, os_event_t *evt) +{ + /* + * Stop flag must be set before the event is raised so + * kthread_should_stop() cannot be used. + */ + thread->stop = 1; + + if (evt) { + os_event_raise(evt, ~0); + } + + kthread_stop(thread->task); +} +EXPORT_SYMBOL(os_thread_stop); + +int os_thread_should_stop(os_thread_t *thread) +{ + return thread->stop; +} +EXPORT_SYMBOL(os_thread_should_stop); diff --git a/drivers/staging/csr/oska/thread.h b/drivers/staging/csr/oska/thread.h new file mode 100644 index 0000000..8816dc8 --- /dev/null +++ b/drivers/staging/csr/oska/thread.h @@ -0,0 +1,39 @@ +/* + * OSKA Linux implementation -- threading + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef __OSKA_LINUX_THREAD_H +#define __OSKA_LINUX_THREAD_H + +#include +#include +#include +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19) +#include +#endif +#include "event.h" + +struct os_thread_lx { + void (*func)(void *); + void *arg; + struct task_struct *task; + int stop; +}; + +typedef struct os_thread_lx os_thread_t; + +int os_thread_create(os_thread_t *thread, const char *name, + void (*func)(void *), void *arg); +void os_thread_stop(os_thread_t *thread, os_event_t *evt); +int os_thread_should_stop(os_thread_t *thread); + +static inline void os_try_suspend_thread(os_thread_t *thread) +{ + try_to_freeze(); +} + +#endif /* __OSKA_LINUX_THREAD_H */ diff --git a/drivers/staging/csr/oska/time.h b/drivers/staging/csr/oska/time.h new file mode 100644 index 0000000..d246ce9 --- /dev/null +++ b/drivers/staging/csr/oska/time.h @@ -0,0 +1,34 @@ +/* + * OSKA Linux implementation -- timing + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef __OSKA_LINUX_TIME_H +#define __OSKA_LINUX_TIME_H + +#include +#include +#include +#include + +static inline unsigned long os_current_time_ms(void) +{ + return jiffies_to_msecs(jiffies); +} + +static inline void os_sleep_ms(unsigned ms) +{ + msleep_interruptible(ms); +} + +static inline void os_delay_us(unsigned us) +{ + udelay(us); +} + +#define os_time_after(a, b) time_after((a), (b)) + +#endif /* __OSKA_LINUX_TIME_H */ diff --git a/drivers/staging/csr/oska/timer.c b/drivers/staging/csr/oska/timer.c new file mode 100644 index 0000000..67d3423 --- /dev/null +++ b/drivers/staging/csr/oska/timer.c @@ -0,0 +1,28 @@ +/* + * OSKA Linux implementation -- timers. + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#include + +#include "timer.h" + +static void timer_func(unsigned long data) +{ + os_timer_t *timer = (os_timer_t *)data; + + timer->func(timer->arg); +} + +void os_timer_init(os_timer_t *timer, os_timer_func_t func, void *arg) +{ + timer->func = func; + timer->arg = arg; + timer->timer.function = timer_func; + timer->timer.data = (unsigned long)timer; + init_timer(&timer->timer); +} +EXPORT_SYMBOL(os_timer_init); diff --git a/drivers/staging/csr/oska/timer.h b/drivers/staging/csr/oska/timer.h new file mode 100644 index 0000000..3045fc3 --- /dev/null +++ b/drivers/staging/csr/oska/timer.h @@ -0,0 +1,40 @@ +/* + * OSKA Linux implementation -- timers. + * + * Copyright (C) 2009 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef __OSKA_LINUX_TIMER_H +#define __OSKA_LINUX_TIMER_H + +#include +#include + +typedef void (*os_timer_func_t)(void *arg); + +typedef struct { + os_timer_func_t func; + void *arg; + struct timer_list timer; +} os_timer_t; + +void os_timer_init(os_timer_t *timer, os_timer_func_t func, void *arg); + +static inline void os_timer_destroy(os_timer_t *timer) +{ + del_timer_sync(&timer->timer); +} + +static inline void os_timer_set(os_timer_t *timer, unsigned long expires_ms) +{ + mod_timer(&timer->timer, jiffies + msecs_to_jiffies(expires_ms)); +} + +static inline void os_timer_cancel(os_timer_t *timer) +{ + del_timer(&timer->timer); +} + +#endif /* #ifndef __OSKA_LINUX_TIMER_H */ diff --git a/drivers/staging/csr/oska/trace.h b/drivers/staging/csr/oska/trace.h new file mode 100644 index 0000000..b28f37d --- /dev/null +++ b/drivers/staging/csr/oska/trace.h @@ -0,0 +1,23 @@ +/* + * OSKA Linux implementation -- tracing messages. + * + * Copyright (C) 2009 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef __OSKA_LINUX_TRACE_H +#define __OSKA_LINUX_TRACE_H + +#include + +#ifndef OS_TRACE_PREFIX +# define OS_TRACE_PREFIX "" +#endif + +#define os_trace_err(format, ...) printk(KERN_ERR OS_TRACE_PREFIX format "\n", ## __VA_ARGS__) +#define os_trace_warn(format, ...) printk(KERN_WARNING OS_TRACE_PREFIX format "\n", ## __VA_ARGS__) +#define os_trace_info(format, ...) printk(KERN_INFO OS_TRACE_PREFIX format "\n", ## __VA_ARGS__) +#define os_trace_dbg(format, ...) printk(KERN_DEBUG OS_TRACE_PREFIX format "\n", ## __VA_ARGS__) + +#endif /* #ifndef __OSKA_LINUX_TRACE_H */ diff --git a/drivers/staging/csr/oska/types.h b/drivers/staging/csr/oska/types.h new file mode 100644 index 0000000..18d7c11 --- /dev/null +++ b/drivers/staging/csr/oska/types.h @@ -0,0 +1,14 @@ +/* + * OSKA Linux implementation -- types + * + * Copyright (C) 2009 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef __OSKA_LINUX_TYPES_H +#define __OSKA_LINUX_TYPES_H + +#include + +#endif /* #ifndef __OSKA_LINUX_TYPES_H */ diff --git a/drivers/staging/csr/oska/util.h b/drivers/staging/csr/oska/util.h new file mode 100644 index 0000000..bf29e2d --- /dev/null +++ b/drivers/staging/csr/oska/util.h @@ -0,0 +1,48 @@ +/* + * OSKA Linux implementation -- misc. utility functions + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef __OSKA_LINUX_UTILS_H +#define __OSKA_LINUX_UTILS_H + +#include +#include +#include + +#define OS_ASSERT(expr) BUG_ON(!(expr)) + +static inline uint16_t os_le16_to_cpu(uint16_t x) +{ + return le16_to_cpu(x); +} + +static inline uint16_t os_cpu_to_le16(uint16_t x) +{ + return cpu_to_le16(x); +} + +static inline uint32_t os_le32_to_cpu(uint32_t x) +{ + return le32_to_cpu(x); +} + +static inline uint32_t os_cpu_to_le32(uint32_t x) +{ + return cpu_to_le32(x); +} + +static inline uint64_t os_le64_to_cpu(uint64_t x) +{ + return le64_to_cpu(x); +} + +static inline uint64_t os_cpu_to_le64(uint64_t x) +{ + return cpu_to_le64(x); +} + +#endif /* __OSKA_LINUX_UTILS_H */ -- cgit v0.10.2 From 635d2b00e5070378e7bf812acf47fb135c6ab928 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 19 Jun 2012 16:15:42 -0700 Subject: Staging: add CSR wifi module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This consists of two modules, the driver, and a "helper" module that is just a wrapper around common kernel functions. The wrapper module will be removed soon, but for now it's needed. These files were based on the csr-linux-wifi-5.0.3-oss.tar.gz package provided by CSR and Blue Giga, and is covered under the license specified in the LICENSE.txt file (basically dual BSD and GPLv2). The files were flattened out of the deep directory mess they were originally in, and a few EXPORT_SYMBOL_GPL() were added in order for everything to link properly with the helper module setup. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/Kconfig b/drivers/staging/csr/Kconfig index 5d7b800..e3a923a 100644 --- a/drivers/staging/csr/Kconfig +++ b/drivers/staging/csr/Kconfig @@ -1,6 +1,6 @@ config CSR_WIFI tristate "CSR wireless driver" - depends on PCI + depends on PCI && MMC help Driver for the CSR wireless SDIO device. diff --git a/drivers/staging/csr/LICENSE.txt b/drivers/staging/csr/LICENSE.txt new file mode 100644 index 0000000..364853e --- /dev/null +++ b/drivers/staging/csr/LICENSE.txt @@ -0,0 +1,39 @@ +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +Except as contained in this notice, the names of above-listed +copyright holders and the names of any contributors shall not be used +in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR +CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +Alternatively, this software may be distributed under the terms of the +GNU General Public License ("GPL") version 2 as published +by the Free Software Foundation. + +As a special exception, if other files instantiate templates or use +macros or inline functions from this file, or you compile this file +and link it with other works to produce a work based on this file, +this file does not by itself cause the resulting work to be covered by +the GNU General Public License. However the source code for this file +must still be made available in accordance with section (3) of the GNU +General Public License. + +This exception does not invalidate any other reasons why a work based +on this file might be covered by the GNU General Public License. diff --git a/drivers/staging/csr/Makefile b/drivers/staging/csr/Makefile index b9ba3b3..27eb4a7 100644 --- a/drivers/staging/csr/Makefile +++ b/drivers/staging/csr/Makefile @@ -1 +1,71 @@ obj-$(CONFIG_CSR_WIFI) += oska/ + +ccflags-y := -DCSR_SME_USERSPACE -DCSR_SUPPORT_SME -DREMOTE_SYS_SAP -DCSR_WIFI_SECURITY_WAPI_ENABLE -DENABLE_SHUTDOWN + +obj-$(CONFIG_CSR_WIFI) += csr_wifi.o +obj-$(CONFIG_CSR_WIFI) += csr_helper.o + +csr_wifi-y := bh.o \ + data_tx.o \ + drv.o \ + firmware.o \ + indications.o \ + inet.o \ + init_hw.o \ + io.o \ + monitor.o \ + netdev.o \ + os.o \ + putest.o \ + sdio_events.o \ + sdio_mmc.o \ + sdio_stubs.o \ + sme_blocking.o \ + ul_int.o \ + unifi_dbg.o \ + unifi_event.o \ + unifi_pdu_processing.o \ + unifi_sme.o \ + csr_formatted_io.o \ + csr_wifi_hip_card_sdio.o \ + csr_wifi_hip_card_sdio_intr.o \ + csr_wifi_hip_card_sdio_mem.o \ + csr_wifi_hip_chiphelper.o \ + csr_wifi_hip_download.o \ + csr_wifi_hip_dump.o \ + csr_wifi_hip_packing.o \ + csr_wifi_hip_send.o \ + csr_wifi_hip_signals.o \ + csr_wifi_hip_ta_sampling.o \ + csr_wifi_hip_udi.o \ + csr_wifi_hip_unifi_signal_names.o \ + csr_wifi_hip_xbv.o \ + csr_wifi_router_ctrl_sef.o \ + csr_wifi_router_sef.o \ + csr_wifi_router_transport.o \ + csr_wifi_sme_sef.o \ + csr_wifi_sme_converter_init.o \ + csr_wifi_sme_free_downstream_contents.o \ + csr_wifi_sme_free_upstream_contents.o \ + csr_wifi_sme_serialize.o \ + csr_wifi_router_ctrl_converter_init.o \ + csr_wifi_router_ctrl_free_downstream_contents.o \ + csr_wifi_router_ctrl_free_upstream_contents.o \ + csr_wifi_router_ctrl_serialize.o \ + csr_wifi_router_converter_init.o \ + csr_wifi_router_free_downstream_contents.o \ + csr_wifi_router_free_upstream_contents.o \ + csr_wifi_router_serialize.o \ + sme_mgt.o \ + sme_sys.o \ + sme_userspace.o + +csr_helper-y := csr_time.o \ + csr_util.o \ + csr_framework_ext.o \ + csr_pmem.o \ + csr_wifi_serialize_primitive_types.o \ + csr_serialize_primitive_types.o \ + csr_utf16.o \ + csr_msgconv.o \ + csr_panic.o diff --git a/drivers/staging/csr/bh.c b/drivers/staging/csr/bh.c new file mode 100644 index 0000000..6af9d29 --- /dev/null +++ b/drivers/staging/csr/bh.c @@ -0,0 +1,391 @@ +/* + * --------------------------------------------------------------------------- + * FILE: bh.c + * + * PURPOSE: + * Provides an implementation for the driver bottom-half. + * It is part of the porting exercise in Linux. + * + * Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * --------------------------------------------------------------------------- + */ +#include "csr_wifi_hip_unifi.h" +#include "unifi_priv.h" + + +/* + * --------------------------------------------------------------------------- + * uf_start_thread + * + * Helper function to start a new thread. + * + * Arguments: + * priv Pointer to OS driver structure for the device. + * thread Pointer to the thread object + * func The thread function + * + * Returns: + * 0 on success or else a Linux error code. + * --------------------------------------------------------------------------- + */ +int +uf_start_thread(unifi_priv_t *priv, struct uf_thread *thread, int (*func)(void *)) +{ + if (thread->thread_task != NULL) { + unifi_error(priv, "%s thread already started\n", thread->name); + return 0; + } + + /* Start the kernel thread that handles all h/w accesses. */ + thread->thread_task = kthread_run(func, priv, "%s", thread->name); + if (IS_ERR(thread->thread_task)) { + return PTR_ERR(thread->thread_task); + } + + /* Module parameter overides the thread priority */ + if (bh_priority != -1) { + if (bh_priority >= 0 && bh_priority <= MAX_RT_PRIO) { + struct sched_param param; + priv->bh_thread.prio = bh_priority; + unifi_trace(priv, UDBG1, "%s thread (RT) priority = %d\n", + thread->name, bh_priority); + param.sched_priority = bh_priority; + sched_setscheduler(thread->thread_task, SCHED_FIFO, ¶m); + } else if (bh_priority > MAX_RT_PRIO && bh_priority <= MAX_PRIO) { + priv->bh_thread.prio = bh_priority; + unifi_trace(priv, UDBG1, "%s thread priority = %d\n", + thread->name, PRIO_TO_NICE(bh_priority)); + set_user_nice(thread->thread_task, PRIO_TO_NICE(bh_priority)); + } else { + priv->bh_thread.prio = DEFAULT_PRIO; + unifi_warning(priv, "%s thread unsupported (%d) priority\n", + thread->name, bh_priority); + } + } else { + priv->bh_thread.prio = DEFAULT_PRIO; + } + unifi_trace(priv, UDBG2, "Started %s thread\n", thread->name); + + return 0; +} /* uf_start_thread() */ + + +/* + * --------------------------------------------------------------------------- + * uf_stop_thread + * + * Helper function to stop a thread. + * + * Arguments: + * priv Pointer to OS driver structure for the device. + * thread Pointer to the thread object + * + * Returns: + * + * --------------------------------------------------------------------------- + */ + void +uf_stop_thread(unifi_priv_t *priv, struct uf_thread *thread) +{ + if (!thread->thread_task) { + unifi_notice(priv, "%s thread is already stopped\n", thread->name); + return; + } + + unifi_trace(priv, UDBG2, "Stopping %s thread\n", thread->name); + + kthread_stop(thread->thread_task); + thread->thread_task = NULL; + +} /* uf_stop_thread() */ + + + +/* + * --------------------------------------------------------------------------- + * uf_wait_for_thread_to_stop + * + * Helper function to wait until a thread is stopped. + * + * Arguments: + * priv Pointer to OS driver structure for the device. + * + * Returns: + * + * --------------------------------------------------------------------------- + */ + void +uf_wait_for_thread_to_stop(unifi_priv_t *priv, struct uf_thread *thread) +{ + /* + * kthread_stop() cannot handle the thread exiting while + * kthread_should_stop() is false, so sleep until kthread_stop() + * wakes us up. + */ + unifi_trace(priv, UDBG2, "%s waiting for the stop signal.\n", thread->name); + set_current_state(TASK_INTERRUPTIBLE); + if (!kthread_should_stop()) { + unifi_trace(priv, UDBG2, "%s schedule....\n", thread->name); + schedule(); + } + + thread->thread_task = NULL; + unifi_trace(priv, UDBG2, "%s exiting....\n", thread->name); +} /* uf_wait_for_thread_to_stop() */ + + +/* + * --------------------------------------------------------------------------- + * handle_bh_error + * + * This function reports an error returned from the HIP core bottom-half. + * Normally, implemented during the porting exercise, passing the error + * to the SME using unifi_sys_wifi_off_ind(). + * The SME will try to reset the device and go through + * the initialisation of the UniFi. + * + * Arguments: + * priv Pointer to OS driver structure for the device. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ + static void +handle_bh_error(unifi_priv_t *priv) +{ + u8 conf_param = CONFIG_IND_ERROR; + CsrUint8 interfaceTag = 0; /* used as a loop counter */ + + + /* Block unifi_run_bh() until the error has been handled. */ + priv->bh_thread.block_thread = 1; + + /* Consider UniFi to be uninitialised */ + priv->init_progress = UNIFI_INIT_NONE; + + /* Stop the network traffic */ + for( interfaceTag =0; interfaceTag interfacePriv[interfaceTag]; + if (interfacePriv->netdev_registered == 1) { + netif_carrier_off(priv->netdev[interfaceTag]); + } + } + +#ifdef CSR_NATIVE_LINUX + /* Force any client waiting on an mlme_wait_for_reply() to abort. */ + uf_abort_mlme(priv); + + /* Cancel any pending workqueue tasks */ + flush_workqueue(priv->unifi_workqueue); + +#endif /* CSR_NATIVE_LINUX */ + + unifi_error(priv, "handle_bh_error: fatal error is reported to the SME.\n"); + /* Notify the clients (SME or unifi_manager) for the error. */ + ul_log_config_ind(priv, &conf_param, sizeof(u8)); + +} /* handle_bh_error() */ + + + +/* + * --------------------------------------------------------------------------- + * bh_thread_function + * + * All hardware access happens in this thread. + * This means there is no need for locks on the hardware and we don't need + * to worry about reentrancy with the SDIO library. + * Provides and example implementation on how to call unifi_bh(), which + * is part of the HIP core API. + * + * It processes the events generated by unifi_run_bh() to serialise calls + * to unifi_bh(). It also demonstrates how the timeout parameter passed in + * and returned from unifi_bh() needs to be handled. + * + * Arguments: + * arg Pointer to OS driver structure for the device. + * + * Returns: + * None. + * + * Notes: + * When the bottom half of the driver needs to process signals, events, + * or simply the host status (i.e sleep mode), it invokes unifi_run_bh(). + * Since we need all SDIO transaction to be in a single thread, the + * unifi_run_bh() will wake up this thread to process it. + * + * --------------------------------------------------------------------------- + */ +static int +bh_thread_function(void *arg) +{ + unifi_priv_t *priv = (unifi_priv_t*)arg; + CsrResult csrResult; + long ret; + CsrUint32 timeout, t; + struct uf_thread *this_thread; + + unifi_trace(priv, UDBG2, "bh_thread_function starting\n"); + + this_thread = &priv->bh_thread; + + t = timeout = 0; + while (!kthread_should_stop()) { + /* wait until an error occurs, or we need to process something. */ + unifi_trace(priv, UDBG3, "bh_thread goes to sleep.\n"); + + if (timeout > 0) { + /* Convert t in ms to jiffies */ + t = msecs_to_jiffies(timeout); + ret = wait_event_interruptible_timeout(this_thread->wakeup_q, + (this_thread->wakeup_flag && !this_thread->block_thread) || + kthread_should_stop(), + t); + timeout = (ret > 0) ? jiffies_to_msecs(ret) : 0; + } else { + ret = wait_event_interruptible(this_thread->wakeup_q, + (this_thread->wakeup_flag && !this_thread->block_thread) || + kthread_should_stop()); + } + + if (kthread_should_stop()) { + unifi_trace(priv, UDBG2, "bh_thread: signalled to exit\n"); + break; + } + + if (ret < 0) { + unifi_notice(priv, + "bh_thread: wait_event returned %d, thread will exit\n", + ret); + uf_wait_for_thread_to_stop(priv, this_thread); + break; + } + + this_thread->wakeup_flag = 0; + + unifi_trace(priv, UDBG3, "bh_thread calls unifi_bh().\n"); + + CsrSdioClaim(priv->sdio); + csrResult = unifi_bh(priv->card, &timeout); + if(csrResult != CSR_RESULT_SUCCESS) { + if (csrResult == CSR_WIFI_HIP_RESULT_NO_DEVICE) { + CsrSdioRelease(priv->sdio); + uf_wait_for_thread_to_stop(priv, this_thread); + break; + } + /* Errors must be delivered to the error task */ + handle_bh_error(priv); + } + CsrSdioRelease(priv->sdio); + } + + /* + * I would normally try to call csr_sdio_remove_irq() here to make sure + * that we do not get any interrupts while this thread is not running. + * However, the MMC/SDIO driver tries to kill its' interrupt thread. + * The kernel threads implementation does not allow to kill threads + * from a signalled to stop thread. + * So, instead call csr_sdio_linux_remove_irq() always after calling + * uf_stop_thread() to kill this thread. + */ + + unifi_trace(priv, UDBG2, "bh_thread exiting....\n"); + return 0; +} /* bh_thread_function() */ + + +/* + * --------------------------------------------------------------------------- + * uf_init_bh + * + * Helper function to start the bottom half of the driver. + * All we need to do here is start the I/O bh thread. + * + * Arguments: + * priv Pointer to OS driver structure for the device. + * + * Returns: + * 0 on success or else a Linux error code. + * --------------------------------------------------------------------------- + */ + int +uf_init_bh(unifi_priv_t *priv) +{ + int r; + + /* Enable mlme interface. */ + priv->io_aborted = 0; + + + /* Start the BH thread */ + r = uf_start_thread(priv, &priv->bh_thread, bh_thread_function); + if (r) { + unifi_error(priv, + "uf_init_bh: failed to start the BH thread.\n"); + return r; + } + + /* Allow interrupts */ + r = csr_sdio_linux_install_irq(priv->sdio); + if (r) { + unifi_error(priv, + "uf_init_bh: failed to install the IRQ.\n"); + + uf_stop_thread(priv, &priv->bh_thread); + } + + return r; +} /* uf_init_bh() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_run_bh + * + * Part of the HIP core lib API, implemented in the porting exercise. + * The bottom half of the driver calls this function when + * it wants to process anything that requires access to unifi. + * We need to call unifi_bh() which in this implementation is done + * by waking up the I/O thread. + * + * Arguments: + * ospriv Pointer to OS driver structure for the device. + * + * Returns: + * 0 on success or else a Linux error code. + * + * Notes: + * --------------------------------------------------------------------------- + */ +CsrResult unifi_run_bh(void *ospriv) +{ + unifi_priv_t *priv = ospriv; + + /* + * If an error has occured, we discard silently all messages from the bh + * until the error has been processed and the unifi has been reinitialised. + */ + if (priv->bh_thread.block_thread == 1) { + unifi_trace(priv, UDBG3, "unifi_run_bh: discard message.\n"); + /* + * Do not try to acknowledge a pending interrupt here. + * This function is called by unifi_send_signal() which in turn can be + * running in an atomic or 'disabled irq' level if a signal is sent + * from a workqueue task (i.e multicass addresses set). + * We can not hold the SDIO lock because it might sleep. + */ + return CSR_RESULT_FAILURE; + } + + priv->bh_thread.wakeup_flag = 1; + /* wake up I/O thread */ + wake_up_interruptible(&priv->bh_thread.wakeup_q); + + return CSR_RESULT_SUCCESS; +} /* unifi_run_bh() */ + diff --git a/drivers/staging/csr/csr_formatted_io.c b/drivers/staging/csr/csr_formatted_io.c new file mode 100644 index 0000000..bd6456b --- /dev/null +++ b/drivers/staging/csr/csr_formatted_io.c @@ -0,0 +1,29 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#include "csr_types.h" +#include "csr_formatted_io.h" +#include "csr_util.h" + +CsrInt32 CsrSnprintf(CsrCharString *dest, CsrSize n, const CsrCharString *fmt, ...) +{ + CsrInt32 r; + va_list args; + va_start(args, fmt); + r = CsrVsnprintf(dest, n, fmt, args); + va_end(args); + + if (dest && (n > 0)) + { + dest[n - 1] = '\0'; + } + + return r; +} diff --git a/drivers/staging/csr/csr_formatted_io.h b/drivers/staging/csr/csr_formatted_io.h new file mode 100644 index 0000000..b458eb5 --- /dev/null +++ b/drivers/staging/csr/csr_formatted_io.h @@ -0,0 +1,25 @@ +#ifndef CSR_FORMATTED_IO_H__ +#define CSR_FORMATTED_IO_H__ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "csr_types.h" + +CsrInt32 CsrSnprintf(CsrCharString *dest, CsrSize n, const CsrCharString *fmt, ...); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/drivers/staging/csr/csr_framework_ext.c b/drivers/staging/csr/csr_framework_ext.c new file mode 100644 index 0000000..0406a4b --- /dev/null +++ b/drivers/staging/csr/csr_framework_ext.c @@ -0,0 +1,213 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#include +#include +#include +#include + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34) +#include +#endif + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 19) +#include +#endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) +#include +#else +#include +#endif + +#include + +#include "csr_types.h" +#include "csr_framework_ext.h" +#include "csr_panic.h" + +/*----------------------------------------------------------------------------* + * NAME + * CsrMutexCreate + * + * DESCRIPTION + * Create a mutex and return a handle to the created mutex. + * + * RETURNS + * Possible values: + * CSR_RESULT_SUCCESS in case of success + * CSR_FE_RESULT_NO_MORE_MUTEXES in case of out of mutex resources + * CSR_FE_RESULT_INVALID_POINTER in case the mutexHandle pointer is invalid + * + *----------------------------------------------------------------------------*/ +CsrResult CsrMutexCreate(CsrMutexHandle *mutexHandle) +{ + if (mutexHandle == NULL) + { + return CSR_FE_RESULT_INVALID_POINTER; + } + + sema_init(mutexHandle, 1); + + return CSR_RESULT_SUCCESS; +} + +/*----------------------------------------------------------------------------* + * NAME + * CsrMutexDestroy + * + * DESCRIPTION + * Destroy the previously created mutex. + * + * RETURNS + * void + * + *----------------------------------------------------------------------------*/ +void CsrMutexDestroy(CsrMutexHandle *mutexHandle) +{ +} + +/*----------------------------------------------------------------------------* + * NAME + * CsrMutexLock + * + * DESCRIPTION + * Lock the mutex refered to by the provided handle. + * + * RETURNS + * Possible values: + * CSR_RESULT_SUCCESS in case of success + * CSR_FE_RESULT_INVALID_HANDLE in case the mutexHandle is invalid + * + *----------------------------------------------------------------------------*/ +CsrResult CsrMutexLock(CsrMutexHandle *mutexHandle) +{ + if (mutexHandle == NULL) + { + return CSR_FE_RESULT_INVALID_POINTER; + } + + if (down_interruptible(mutexHandle)) + { + CsrPanic(CSR_TECH_FW, CSR_PANIC_FW_UNEXPECTED_VALUE, "CsrMutexLock Failed"); + return CSR_FE_RESULT_INVALID_POINTER; + } + + return CSR_RESULT_SUCCESS; +} + +/*----------------------------------------------------------------------------* + * NAME + * CsrMutexUnlock + * + * DESCRIPTION + * Unlock the mutex refered to by the provided handle. + * + * RETURNS + * Possible values: + * CSR_RESULT_SUCCESS in case of success + * CSR_FE_RESULT_INVALID_HANDLE in case the mutexHandle is invalid + * + *----------------------------------------------------------------------------*/ +CsrResult CsrMutexUnlock(CsrMutexHandle *mutexHandle) +{ + if (mutexHandle == NULL) + { + return CSR_FE_RESULT_INVALID_POINTER; + } + + up(mutexHandle); + + return CSR_RESULT_SUCCESS; +} + +/*----------------------------------------------------------------------------* + * NAME + * CsrThreadSleep + * + * DESCRIPTION + * Sleep for a given period. + * + * RETURNS + * void + * + *----------------------------------------------------------------------------*/ +void CsrThreadSleep(CsrUint16 sleepTimeInMs) +{ + unsigned long t; + + /* Convert t in ms to jiffies and round up */ + t = ((sleepTimeInMs * HZ) + 999) / 1000; + schedule_timeout_uninterruptible(t); +} +EXPORT_SYMBOL_GPL(CsrThreadSleep); + +/*----------------------------------------------------------------------------* + * NAME + * CsrMemCalloc + * + * DESCRIPTION + * Allocate dynamic memory of a given size calculated as the + * numberOfElements times the elementSize. + * + * RETURNS + * Pointer to allocated memory, or NULL in case of failure. + * Allocated memory is zero initialised. + * + *----------------------------------------------------------------------------*/ +void *CsrMemCalloc(CsrSize numberOfElements, CsrSize elementSize) +{ + void *buf; + size_t size; + + size = numberOfElements * elementSize; + + buf = kmalloc(size, GFP_KERNEL); + if (buf != NULL) + { + memset(buf, 0, size); + } + + return buf; +} + +/*----------------------------------------------------------------------------* + * NAME + * CsrMemAlloc + * + * DESCRIPTION + * Allocate dynamic memory of a given size. + * + * RETURNS + * Pointer to allocated memory, or NULL in case of failure. + * Allocated memory is not initialised. + * + *----------------------------------------------------------------------------*/ +void *CsrMemAlloc(CsrSize size) +{ + return kmalloc(size, GFP_KERNEL); +} +EXPORT_SYMBOL_GPL(CsrMemAlloc); + +/*----------------------------------------------------------------------------* + * NAME + * CsrMemFree + * + * DESCRIPTION + * Free dynamic allocated memory. + * + * RETURNS + * void + * + *----------------------------------------------------------------------------*/ +void CsrMemFree(void *pointer) +{ + kfree(pointer); +} +EXPORT_SYMBOL_GPL(CsrMemFree); diff --git a/drivers/staging/csr/csr_framework_ext.h b/drivers/staging/csr/csr_framework_ext.h new file mode 100644 index 0000000..401bf2d --- /dev/null +++ b/drivers/staging/csr/csr_framework_ext.h @@ -0,0 +1,354 @@ +#ifndef CSR_FRAMEWORK_EXT_H__ +#define CSR_FRAMEWORK_EXT_H__ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#include "csr_types.h" +#include "csr_result.h" +#include "csr_framework_ext_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Result codes */ +#define CSR_FE_RESULT_NO_MORE_EVENTS ((CsrResult) 0x0001) +#define CSR_FE_RESULT_INVALID_POINTER ((CsrResult) 0x0002) +#define CSR_FE_RESULT_INVALID_HANDLE ((CsrResult) 0x0003) +#define CSR_FE_RESULT_NO_MORE_MUTEXES ((CsrResult) 0x0004) +#define CSR_FE_RESULT_TIMEOUT ((CsrResult) 0x0005) +#define CSR_FE_RESULT_NO_MORE_THREADS ((CsrResult) 0x0006) + +/* Thread priorities */ +#define CSR_THREAD_PRIORITY_HIGHEST ((CsrUint16) 0) +#define CSR_THREAD_PRIORITY_HIGH ((CsrUint16) 1) +#define CSR_THREAD_PRIORITY_NORMAL ((CsrUint16) 2) +#define CSR_THREAD_PRIORITY_LOW ((CsrUint16) 3) +#define CSR_THREAD_PRIORITY_LOWEST ((CsrUint16) 4) + +#define CSR_EVENT_WAIT_INFINITE ((CsrUint16) 0xFFFF) + +/*----------------------------------------------------------------------------* + * NAME + * CsrEventCreate + * + * DESCRIPTION + * Creates an event and returns a handle to the created event. + * + * RETURNS + * Possible values: + * CSR_RESULT_SUCCESS in case of success + * CSR_FE_RESULT_NO_MORE_EVENTS in case of out of event resources + * CSR_FE_RESULT_INVALID_POINTER in case the eventHandle pointer is invalid + * + *----------------------------------------------------------------------------*/ +CsrResult CsrEventCreate(CsrEventHandle *eventHandle); + +/*----------------------------------------------------------------------------* + * NAME + * CsrEventWait + * + * DESCRIPTION + * Wait fore one or more of the event bits to be set. + * + * RETURNS + * Possible values: + * CSR_RESULT_SUCCESS in case of success + * CSR_FE_RESULT_TIMEOUT in case of timeout + * CSR_FE_RESULT_INVALID_HANDLE in case the eventHandle is invalid + * CSR_FE_RESULT_INVALID_POINTER in case the eventBits pointer is invalid + * + *----------------------------------------------------------------------------*/ +CsrResult CsrEventWait(CsrEventHandle *eventHandle, CsrUint16 timeoutInMs, CsrUint32 *eventBits); + +/*----------------------------------------------------------------------------* + * NAME + * CsrEventSet + * + * DESCRIPTION + * Set an event. + * + * RETURNS + * Possible values: + * CSR_RESULT_SUCCESS in case of success + * CSR_FE_RESULT_INVALID_HANDLE in case the eventHandle is invalid + * + *----------------------------------------------------------------------------*/ +CsrResult CsrEventSet(CsrEventHandle *eventHandle, CsrUint32 eventBits); + +/*----------------------------------------------------------------------------* + * NAME + * CsrEventDestroy + * + * DESCRIPTION + * Destroy the event associated. + * + * RETURNS + * void + * + *----------------------------------------------------------------------------*/ +void CsrEventDestroy(CsrEventHandle *eventHandle); + +/*----------------------------------------------------------------------------* + * NAME + * CsrMutexCreate + * + * DESCRIPTION + * Create a mutex and return a handle to the created mutex. + * + * RETURNS + * Possible values: + * CSR_RESULT_SUCCESS in case of success + * CSR_FE_RESULT_NO_MORE_MUTEXES in case of out of mutex resources + * CSR_FE_RESULT_INVALID_POINTER in case the mutexHandle pointer is invalid + * + *----------------------------------------------------------------------------*/ +CsrResult CsrMutexCreate(CsrMutexHandle *mutexHandle); + +/*----------------------------------------------------------------------------* + * NAME + * CsrMutexLock + * + * DESCRIPTION + * Lock the mutex refered to by the provided handle. + * + * RETURNS + * Possible values: + * CSR_RESULT_SUCCESS in case of success + * CSR_FE_RESULT_INVALID_HANDLE in case the mutexHandle is invalid + * + *----------------------------------------------------------------------------*/ +CsrResult CsrMutexLock(CsrMutexHandle *mutexHandle); + +/*----------------------------------------------------------------------------* + * NAME + * CsrMutexUnlock + * + * DESCRIPTION + * Unlock the mutex refered to by the provided handle. + * + * RETURNS + * Possible values: + * CSR_RESULT_SUCCESS in case of success + * CSR_FE_RESULT_INVALID_HANDLE in case the mutexHandle is invalid + * + *----------------------------------------------------------------------------*/ +CsrResult CsrMutexUnlock(CsrMutexHandle *mutexHandle); + +/*----------------------------------------------------------------------------* + * NAME + * CsrMutexDestroy + * + * DESCRIPTION + * Destroy the previously created mutex. + * + * RETURNS + * void + * + *----------------------------------------------------------------------------*/ +void CsrMutexDestroy(CsrMutexHandle *mutexHandle); + +/*----------------------------------------------------------------------------* + * NAME + * CsrGlobalMutexLock + * + * DESCRIPTION + * Lock the global mutex. The global mutex is a single pre-initialised + * shared mutex, spinlock or similar that does not need to be created prior + * to use. The limitation is that there is only one single lock shared + * between all code. Consequently, it must only be used very briefly to + * either protect simple one-time initialisation or to protect the creation + * of a dedicated mutex by calling CsrMutexCreate. + * + *----------------------------------------------------------------------------*/ +void CsrGlobalMutexLock(void); + +/*----------------------------------------------------------------------------* + * NAME + * CsrGlobalMutexUnlock + * + * DESCRIPTION + * Unlock the global mutex. + * + *----------------------------------------------------------------------------*/ +void CsrGlobalMutexUnlock(void); + +/*----------------------------------------------------------------------------* + * NAME + * CsrThreadCreate + * + * DESCRIPTION + * Create thread function and return a handle to the created thread. + * + * RETURNS + * Possible values: + * CSR_RESULT_SUCCESS in case of success + * CSR_FE_RESULT_NO_MORE_THREADS in case of out of thread resources + * CSR_FE_RESULT_INVALID_POINTER in case one of the supplied pointers is invalid + * + *----------------------------------------------------------------------------*/ +CsrResult CsrThreadCreate(void (*threadFunction)(void *pointer), void *pointer, + CsrUint32 stackSize, CsrUint16 priority, + const CsrCharString *threadName, CsrThreadHandle *threadHandle); + +/*----------------------------------------------------------------------------* + * NAME + * CsrThreadGetHandle + * + * DESCRIPTION + * Return thread handle of calling thread. + * + * RETURNS + * Possible values: + * CSR_RESULT_SUCCESS in case of success + * CSR_FE_RESULT_INVALID_POINTER in case the threadHandle pointer is invalid + * + *----------------------------------------------------------------------------*/ +CsrResult CsrThreadGetHandle(CsrThreadHandle *threadHandle); + +/*----------------------------------------------------------------------------* + * NAME + * CsrThreadEqual + * + * DESCRIPTION + * Compare thread handles + * + * RETURNS + * Possible values: + * CSR_RESULT_SUCCESS in case thread handles are identical + * CSR_FE_RESULT_INVALID_POINTER in case either threadHandle pointer is invalid + * CSR_RESULT_FAILURE otherwise + * + *----------------------------------------------------------------------------*/ +CsrResult CsrThreadEqual(CsrThreadHandle *threadHandle1, CsrThreadHandle *threadHandle2); + +/*----------------------------------------------------------------------------* + * NAME + * CsrThreadSleep + * + * DESCRIPTION + * Sleep for a given period. + * + * RETURNS + * void + * + *----------------------------------------------------------------------------*/ +void CsrThreadSleep(CsrUint16 sleepTimeInMs); + +#ifndef CSR_PMEM_DEBUG_ENABLE +/*----------------------------------------------------------------------------* + * NAME + * CsrMemAlloc + * + * DESCRIPTION + * Allocate dynamic memory of a given size. + * + * RETURNS + * Pointer to allocated memory, or NULL in case of failure. + * Allocated memory is not initialised. + * + *----------------------------------------------------------------------------*/ +#ifdef CSR_MEM_DEBUG +void *CsrMemAllocDebug(CsrSize size, + const CsrCharString *file, CsrUint32 line); +#define CsrMemAlloc(sz) CsrMemAllocDebug((sz), __FILE__, __LINE__) +#else +void *CsrMemAlloc(CsrSize size); +#endif + +/*----------------------------------------------------------------------------* + * NAME + * CsrMemCalloc + * + * DESCRIPTION + * Allocate dynamic memory of a given size calculated as the + * numberOfElements times the elementSize. + * + * RETURNS + * Pointer to allocated memory, or NULL in case of failure. + * Allocated memory is zero initialised. + * + *----------------------------------------------------------------------------*/ +#ifdef CSR_MEM_DEBUG +void *CsrMemCallocDebug(CsrSize numberOfElements, CsrSize elementSize, + const CsrCharString *file, CsrUint32 line); +#define CsrMemCalloc(cnt, sz) CsrMemAllocDebug((cnt), (sz), __FILE__, __LINE__) +#else +void *CsrMemCalloc(CsrSize numberOfElements, CsrSize elementSize); +#endif + +/*----------------------------------------------------------------------------* + * NAME + * CsrMemFree + * + * DESCRIPTION + * Free dynamic allocated memory. + * + * RETURNS + * void + * + *----------------------------------------------------------------------------*/ +void CsrMemFree(void *pointer); + +/*----------------------------------------------------------------------------* + * NAME + * CsrMemAllocDma + * + * DESCRIPTION + * Allocate dynamic memory suitable for DMA transfers. + * + * RETURNS + * Pointer to allocated memory, or NULL in case of failure. + * Allocated memory is not initialised. + * + *----------------------------------------------------------------------------*/ +#ifdef CSR_MEM_DEBUG +void *CsrMemAllocDmaDebug(CsrSize size, + const CsrCharString *file, CsrUint32 line); +#define CsrMemAllocDma(sz) CsrMemAllocDmaDebug((sz), __FILE__, __LINE__) +#else +void *CsrMemAllocDma(CsrSize size); +#endif + + +/*----------------------------------------------------------------------------* + * NAME + * CsrMemFreeDma + * + * DESCRIPTION + * Free dynamic memory allocated by CsrMemAllocDma. + * + * RETURNS + * void + * + *----------------------------------------------------------------------------*/ +void CsrMemFreeDma(void *pointer); +#else + +#include "csr_pmem.h" + +#define CsrMemAlloc(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC, __FILE__, __LINE__) + +#define CsrMemCalloc(numberOfElements, elementSize) CsrPmemDebugAlloc((numberOfElements * elementSize), CSR_PMEM_DEBUG_TYPE_MEM_CALLOC, __FILE__, __LINE__) + +#define CsrMemFree(ptr) CsrPmemDebugFree(ptr,CSR_PMEM_DEBUG_TYPE_MEM_ALLOC, __FILE__, __LINE__) + +#define CsrMemAllocDma(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC_DMA, __FILE__, __LINE__) + +#define CsrMemFreeDma(ptr) CsrPmemDebugFree(ptr, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC_DMA, __FILE__, __LINE__) + +#endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/drivers/staging/csr/csr_framework_ext_types.h b/drivers/staging/csr/csr_framework_ext_types.h new file mode 100644 index 0000000..d155a2b --- /dev/null +++ b/drivers/staging/csr/csr_framework_ext_types.h @@ -0,0 +1,65 @@ +#ifndef CSR_FRAMEWORK_EXT_TYPES_H__ +#define CSR_FRAMEWORK_EXT_TYPES_H__ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#include "csr_types.h" + +#ifdef __KERNEL__ +#include +#include +#else +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef __KERNEL__ + +struct CsrThread +{ + struct task_struct *thread_task; + char name[16]; +}; + +struct CsrEvent +{ + /* wait_queue for waking the kernel thread */ + wait_queue_head_t wakeup_q; + unsigned int wakeup_flag; +}; + +typedef struct CsrEvent CsrEventHandle; +typedef struct semaphore CsrMutexHandle; +typedef struct CsrThread CsrThreadHandle; + +#else /* __KERNEL __ */ + +struct CsrEvent +{ + pthread_cond_t event; + pthread_mutex_t mutex; + CsrUint32 eventBits; +}; + +typedef struct CsrEvent CsrEventHandle; +typedef pthread_mutex_t CsrMutexHandle; +typedef pthread_t CsrThreadHandle; + +#endif /* __KERNEL__ */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/drivers/staging/csr/csr_lib.h b/drivers/staging/csr/csr_lib.h new file mode 100644 index 0000000..171f5fe --- /dev/null +++ b/drivers/staging/csr/csr_lib.h @@ -0,0 +1,189 @@ +#ifndef CSR_LIB_H__ +#define CSR_LIB_H__ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#include "csr_types.h" +#include "csr_prim_defs.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct +{ + CsrPrim type; +} CsrEvent; + +/*----------------------------------------------------------------------------* + * CsrEvent_struct + * + * DESCRIPTION + * Generic message creator. + * Allocates and fills in a message with the signature CsrEvent + * + *----------------------------------------------------------------------------*/ +CsrEvent *CsrEvent_struct(CsrUint16 primtype, CsrUint16 msgtype); + +typedef struct +{ + CsrPrim type; + CsrUint8 value; +} CsrEventCsrUint8; + +/*----------------------------------------------------------------------------* + * CsrEventCsrUint8_struct + * + * DESCRIPTION + * Generic message creator. + * Allocates and fills in a message with the signature CsrEventCsrUint8 + * + *----------------------------------------------------------------------------*/ +CsrEventCsrUint8 *CsrEventCsrUint8_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint8 value); + +typedef struct +{ + CsrPrim type; + CsrUint16 value; +} CsrEventCsrUint16; + +/*----------------------------------------------------------------------------* + * CsrEventCsrUint16_struct + * + * DESCRIPTION + * Generic message creator. + * Allocates and fills in a message with the signature CsrEventCsrUint16 + * + *----------------------------------------------------------------------------*/ +CsrEventCsrUint16 *CsrEventCsrUint16_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint16 value); + +typedef struct +{ + CsrPrim type; + CsrUint16 value1; + CsrUint8 value2; +} CsrEventCsrUint16CsrUint8; + +/*----------------------------------------------------------------------------* + * CsrEventCsrUint16CsrUint8_struct + * + * DESCRIPTION + * Generic message creator. + * Allocates and fills in a message with the signature CsrEventCsrUint16CsrUint8 + * + *----------------------------------------------------------------------------*/ +CsrEventCsrUint16CsrUint8 *CsrEventCsrUint16CsrUint8_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint16 value1, CsrUint8 value2); + +typedef struct +{ + CsrPrim type; + CsrUint16 value1; + CsrUint16 value2; +} CsrEventCsrUint16CsrUint16; + +/*----------------------------------------------------------------------------* + * CsrEventCsrUint16CsrUint16_struct + * + * DESCRIPTION + * Generic message creator. + * Allocates and fills in a message with the signature CsrEventCsrUint16CsrUint16 + * + *----------------------------------------------------------------------------*/ +CsrEventCsrUint16CsrUint16 *CsrEventCsrUint16CsrUint16_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint16 value1, CsrUint16 value2); + +typedef struct +{ + CsrPrim type; + CsrUint16 value1; + CsrUint32 value2; +} CsrEventCsrUint16CsrUint32; + +/*----------------------------------------------------------------------------* + * CsrEventCsrUint16_struct + * + * DESCRIPTION + * Generic message creator. + * Allocates and fills in a message with the signature CsrEventCsrUint16 + * + *----------------------------------------------------------------------------*/ +CsrEventCsrUint16CsrUint32 *CsrEventCsrUint16CsrUint32_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint16 value1, CsrUint32 value2); + +typedef struct +{ + CsrPrim type; + CsrUint16 value1; + CsrCharString *value2; +} CsrEventCsrUint16CsrCharString; + +/*----------------------------------------------------------------------------* + * CsrEventCsrUint16CsrCharString_struct + * + * DESCRIPTION + * Generic message creator. + * Allocates and fills in a message with the signature CsrEventCsrUint16CsrCharString + * + *----------------------------------------------------------------------------*/ +CsrEventCsrUint16CsrCharString *CsrEventCsrUint16CsrCharString_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint16 value1, CsrCharString *value2); + +typedef struct +{ + CsrPrim type; + CsrUint32 value; +} CsrEventCsrUint32; + +/*----------------------------------------------------------------------------* + * CsrEventCsrUint32_struct + * + * DESCRIPTION + * Generic message creator. + * Allocates and fills in a message with the signature CsrEventCsrUint32 + * + *----------------------------------------------------------------------------*/ +CsrEventCsrUint32 *CsrEventCsrUint32_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint32 value); + +typedef struct +{ + CsrPrim type; + CsrUint32 value1; + CsrUint16 value2; +} CsrEventCsrUint32CsrUint16; + +/*----------------------------------------------------------------------------* + * CsrEventCsrUint32CsrUint16_struct + * + * DESCRIPTION + * Generic message creator. + * Allocates and fills in a message with the signature CsrEventCsrUint32CsrUint16 + * + *----------------------------------------------------------------------------*/ +CsrEventCsrUint32CsrUint16 *CsrEventCsrUint32CsrUint16_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint32 value1, CsrUint32 value2); + +typedef struct +{ + CsrPrim type; + CsrUint32 value1; + CsrCharString *value2; +} CsrEventCsrUint32CsrCharString; + +/*----------------------------------------------------------------------------* + * CsrEventCsrUint32CsrCharString_struct + * + * DESCRIPTION + * Generic message creator. + * Allocates and fills in a message with the signature CsrEventCsrUint32CsrCharString + * + *----------------------------------------------------------------------------*/ +CsrEventCsrUint32CsrCharString *CsrEventCsrUint32CsrCharString_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint32 value1, CsrCharString *value2); + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_LIB_H__ */ diff --git a/drivers/staging/csr/csr_log.h b/drivers/staging/csr/csr_log.h new file mode 100644 index 0000000..db2653c --- /dev/null +++ b/drivers/staging/csr/csr_log.h @@ -0,0 +1,250 @@ +#ifndef CSR_LOG_H__ +#define CSR_LOG_H__ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#include "csr_types.h" +#include "csr_sched.h" +#include "csr_panic.h" +#include "csr_prim_defs.h" +#include "csr_msgconv.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Log filtering + */ + +/*----------------------------------------------------*/ +/* Filtering on environment specific log levels */ +/*----------------------------------------------------*/ +typedef CsrUint32 CsrLogLevelEnvironment; +#define CSR_LOG_LEVEL_ENVIRONMENT_OFF ((CsrLogLevelEnvironment) 0x00000000) /* No environment data/events are logged */ +#define CSR_LOG_LEVEL_ENVIRONMENT_BCI_ACL ((CsrLogLevelEnvironment) 0x00000001) /* BlueCore Channel Interface HCI Acl data are logged */ +#define CSR_LOG_LEVEL_ENVIRONMENT_BCI_HCI ((CsrLogLevelEnvironment) 0x00000002) /* BlueCore Channel Interface HCI Cmd/Evt data are logged */ +#define CSR_LOG_LEVEL_ENVIRONMENT_BCI_SCO ((CsrLogLevelEnvironment) 0x00000004) /* BlueCore Channel Interface HCI Sco data are logged */ +#define CSR_LOG_LEVEL_ENVIRONMENT_BCI_VENDOR ((CsrLogLevelEnvironment) 0x00000008) /* BlueCore Channel Interface HCI Vendor specific data are logged (This includes BCCMD, HQ, VM etc) */ +#define CSR_LOG_LEVEL_ENVIRONMENT_TRANSPORTS ((CsrLogLevelEnvironment) 0x00000010) /* Transport protocol data is logged (This includes transport protocols like BCSP, H4 etc.) */ +#define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_REG ((CsrLogLevelEnvironment) 0x00000020) /* Background Interrupt registration events are logged */ +#define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_UNREG ((CsrLogLevelEnvironment) 0x00000040) /* Background Interrupt unregistration events are logged */ +#define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_SET ((CsrLogLevelEnvironment) 0x00000080) /* Background Interrupt set events are logged */ +#define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_START ((CsrLogLevelEnvironment) 0x00000100) /* Background Interrupt start events are logged */ +#define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_DONE ((CsrLogLevelEnvironment) 0x00000200) /* Background Interrupt done events are logged */ +#define CSR_LOG_LEVEL_ENVIRONMENT_PROTO ((CsrLogLevelEnvironment) 0x00000400) /* Transport protocol events are logged */ +#define CSR_LOG_LEVEL_ENVIRONMENT_PROTO_LOC ((CsrLogLevelEnvironment) 0x00000800) /* The Location where the transport protocol event occured are logged NB: This is a supplement to CSR_LOG_LEVEL_ENVIRONMENT_PROTO, it has no effect without it */ +/* The bit masks between here are reserved for future usage */ +#define CSR_LOG_LEVEL_ENVIRONMENT_ALL ((CsrLogLevelEnvironment) 0xFFFFFFFF) /* All possible environment data/events are logged WARNING: By using this define the application also accepts future possible environment data/events in the logs */ + +/*----------------------------------------------------*/ +/* Filtering on task specific log levels */ +/*----------------------------------------------------*/ +typedef CsrUint32 CsrLogLevelTask; +#define CSR_LOG_LEVEL_TASK_OFF ((CsrLogLevelTask) 0x00000000) /* No events are logged for this task */ +#define CSR_LOG_LEVEL_TASK_TEXT ((CsrLogLevelTask) 0x00000001) /* Text strings printed by a task are logged NB: This bit does not affect the CSR_LOG_TEXT_LEVEL interface. This has to be configured separately */ +#define CSR_LOG_LEVEL_TASK_TEXT_LOC ((CsrLogLevelTask) 0x00000002) /* The locaction where the text string call occured are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_TEXT, it has no effect without it */ +#define CSR_LOG_LEVEL_TASK_STATE ((CsrLogLevelTask) 0x00000004) /* FSM state transitions in a task are logged */ +#define CSR_LOG_LEVEL_TASK_STATE_NAME ((CsrLogLevelTask) 0x00000008) /* The name of each state in a FSM state transition are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_STATE, it has no effect without it */ +#define CSR_LOG_LEVEL_TASK_STATE_LOC ((CsrLogLevelTask) 0x00000010) /* The location where the FSM state transition occured are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_STATE, it has no effect without it */ +#define CSR_LOG_LEVEL_TASK_TASK_SWITCH ((CsrLogLevelTask) 0x00000020) /* Activation and deactiation of a task are logged */ +#define CSR_LOG_LEVEL_TASK_MESSAGE_PUT ((CsrLogLevelTask) 0x00000080) /* Message put operations are logged */ +#define CSR_LOG_LEVEL_TASK_MESSAGE_PUT_LOC ((CsrLogLevelTask) 0x00000100) /* The location where a message was sent are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_MESSAGE_PUT, it has no effect without it */ +#define CSR_LOG_LEVEL_TASK_MESSAGE_GET ((CsrLogLevelTask) 0x00000200) /* Message get operations are logged */ +#define CSR_LOG_LEVEL_TASK_MESSAGE_QUEUE_PUSH ((CsrLogLevelTask) 0x00000400) /* Message push operations are logged */ +#define CSR_LOG_LEVEL_TASK_MESSAGE_QUEUE_POP ((CsrLogLevelTask) 0x00000800) /* Message pop operations are logged */ +#define CSR_LOG_LEVEL_TASK_PRIM_ONLY_TYPE ((CsrLogLevelTask) 0x00001000) /* Only the type of primitives in messages are logged. By default the entire primitive is serialized and logged */ +#define CSR_LOG_LEVEL_TASK_PRIM_APPLY_LIMIT ((CsrLogLevelTask) 0x00002000) /* An upper limit (defined by CSR_LOG_PRIM_SIZE_UPPER_LIMIT) is applied to how much of a primitive in a message are logged. NB: This limit is only applied if CSR_LOG_LEVEL_TASK_PRIM_ONLY_TYPE is _not_ defined */ +#define CSR_LOG_LEVEL_TASK_TIMER_IN ((CsrLogLevelTask) 0x00004000) /* TimedEventIn events are logged */ +#define CSR_LOG_LEVEL_TASK_TIMER_IN_LOC ((CsrLogLevelTask) 0x00008000) /* The location where a timer was started are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_TIMER_IN, it has no effect without it */ +#define CSR_LOG_LEVEL_TASK_TIMER_CANCEL ((CsrLogLevelTask) 0x00010000) /* TimedEventCancel events are logged */ +#define CSR_LOG_LEVEL_TASK_TIMER_CANCEL_LOC ((CsrLogLevelTask) 0x00020000) /* The location where a timer was cancelled are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_TIMER_CANCEL, it has no effect without it */ +#define CSR_LOG_LEVEL_TASK_TIMER_FIRE ((CsrLogLevelTask) 0x00040000) /* TimedEventFire events are logged */ +#define CSR_LOG_LEVEL_TASK_TIMER_DONE ((CsrLogLevelTask) 0x00080000) /* TimedEventDone events are logged */ +/* The bit masks between here are reserved for future usage */ +#define CSR_LOG_LEVEL_TASK_ALL ((CsrLogLevelTask) 0xFFFFFFFF & ~(CSR_LOG_LEVEL_TASK_PRIM_ONLY_TYPE | CSR_LOG_LEVEL_TASK_PRIM_APPLY_LIMIT)) /* All info possible to log for a task are logged. WARNING: By using this define the application also accepts future possible task data/events in the logs */ + +CsrBool CsrLogEnvironmentIsFiltered(CsrLogLevelEnvironment level); +CsrLogLevelTask CsrLogTaskFilterGet(CsrSchedQid taskId); +CsrBool CsrLogTaskIsFiltered(CsrSchedQid taskId, CsrLogLevelTask level); + +/* + * Logging stuff + */ +#define CSR_LOG_STRINGIFY_REAL(a) #a +#define CSR_LOG_STRINGIFY(a) CSR_LOG_STRINGIFY_REAL(a) + +#ifdef CSR_LOG_ASSERT_ENABLE +#define CSR_LOG_ASSERT(cond) \ + do { \ + if (!(cond)) \ + { \ + CsrCharString *panic_arg = "[" __FILE__ ":" CSR_LOG_STRINGIFY(__LINE__) "] - " CSR_LOG_STRINGIFY(cond); \ + CsrPanic(CSR_TECH_FW, CSR_PANIC_FW_ASSERTION_FAIL, panic_arg); \ + } \ + } while (0) +#else +#define CSR_LOG_ASSERT(cond) +#endif + +typedef struct +{ + CsrUint16 primitiveType; + const CsrCharString *primitiveName; + CsrMsgConvMsgEntry *messageConv; /* Private - do not use */ +} CsrLogPrimitiveInformation; + +typedef struct +{ + const CsrCharString *techVer; + CsrUint32 primitiveInfoCount; + CsrLogPrimitiveInformation *primitiveInfo; +} CsrLogTechInformation; + +/*---------------------------------*/ +/* Tech logging */ +/*---------------------------------*/ +typedef CsrUint8 bitmask8_t; +typedef CsrUint16 bitmask16_t; +typedef CsrUint32 bitmask32_t; + +#ifdef CSR_LOG_ENABLE +#ifdef CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER +/* DEPRECATED - replaced by csr_log_text.h */ +#define CSR_LOG_TEXT(text) \ + do { \ + if (!CsrLogTaskIsFiltered(CsrSchedTaskQueueGet(), CSR_LOG_LEVEL_TASK_TEXT)) \ + { \ + CsrLogTaskText(text, __LINE__, __FILE__); \ + } \ + } while (0) +#else +/* DEPRECATED - replaced by csr_log_text.h */ +#define CSR_LOG_TEXT(text) \ + do { \ + if (!CsrLogTaskIsFiltered(CsrSchedTaskQueueGet(), CSR_LOG_LEVEL_TASK_TEXT)) \ + { \ + CsrLogTaskText(text, 0, NULL); \ + } \ + } while (0) +#endif +#else +#define CSR_LOG_TEXT(text) +#endif + +/* DEPRECATED - replaced by csr_log_text.h */ +void CsrLogTaskText(const CsrCharString *text, + CsrUint32 line, + const CsrCharString *file); + +#define CSR_LOG_STATE_TRANSITION_MASK_FSM_NAME (0x001) +#define CSR_LOG_STATE_TRANSITION_MASK_NEXT_STATE (0x002) +#define CSR_LOG_STATE_TRANSITION_MASK_NEXT_STATE_STR (0x004) +#define CSR_LOG_STATE_TRANSITION_MASK_PREV_STATE (0x008) +#define CSR_LOG_STATE_TRANSITION_MASK_PREV_STATE_STR (0x010) +#define CSR_LOG_STATE_TRANSITION_MASK_EVENT (0x020) +#define CSR_LOG_STATE_TRANSITION_MASK_EVENT_STR (0x040) + +/* DEPRECATED - replaced by csr_log_text.h */ +void CsrLogStateTransition(bitmask16_t mask, + CsrUint32 identifier, + const CsrCharString *fsm_name, + CsrUint32 prev_state, + const CsrCharString *prev_state_str, + CsrUint32 in_event, + const CsrCharString *in_event_str, + CsrUint32 next_state, + const CsrCharString *next_state_str, + CsrUint32 line, + const CsrCharString *file); + +/*---------------------------------*/ +/* BSP logging */ +/*---------------------------------*/ +void CsrLogSchedInit(CsrUint8 thread_id); +void CsrLogSchedDeinit(CsrUint8 thread_id); + +void CsrLogSchedStart(CsrUint8 thread_id); +void CsrLogSchedStop(CsrUint8 thread_id); + +void CsrLogInitTask(CsrUint8 thread_id, CsrSchedQid tskid, const CsrCharString *tskName); +void CsrLogDeinitTask(CsrUint16 task_id); + +void CsrLogActivate(CsrSchedQid tskid); +void CsrLogDeactivate(CsrSchedQid tskid); + +#define SYNERGY_SERIALIZER_TYPE_DUMP (0x000) +#define SYNERGY_SERIALIZER_TYPE_SER (0x001) + +void CsrLogMessagePut(CsrUint32 line, + const CsrCharString *file, + CsrSchedQid src_task_id, + CsrSchedQid dst_taskid, + CsrSchedMsgId msg_id, + CsrUint16 prim_type, + const void *msg); + +void CsrLogMessageGet(CsrSchedQid src_task_id, + CsrSchedQid dst_taskid, + CsrBool get_res, + CsrSchedMsgId msg_id, + CsrUint16 prim_type, + const void *msg); + +void CsrLogTimedEventIn(CsrUint32 line, + const CsrCharString *file, + CsrSchedQid task_id, + CsrSchedTid tid, + CsrTime requested_delay, + CsrUint16 fniarg, + const void *fnvarg); + +void CsrLogTimedEventFire(CsrSchedQid task_id, + CsrSchedTid tid); + +void CsrLogTimedEventDone(CsrSchedQid task_id, + CsrSchedTid tid); + +void CsrLogTimedEventCancel(CsrUint32 line, + const CsrCharString *file, + CsrSchedQid task_id, + CsrSchedTid tid, + CsrBool cancel_res); + +void CsrLogBgintRegister(CsrUint8 thread_id, + CsrSchedBgint irq, + const CsrCharString *callback, + const void *ptr); +void CsrLogBgintUnregister(CsrSchedBgint irq); +void CsrLogBgintSet(CsrSchedBgint irq); +void CsrLogBgintServiceStart(CsrSchedBgint irq); +void CsrLogBgintServiceDone(CsrSchedBgint irq); + +void CsrLogExceptionStateEvent(CsrUint16 prim_type, + CsrPrim msg_type, + CsrUint16 state, + CsrUint32 line, + const CsrCharString *file); +void CsrLogExceptionGeneral(CsrUint16 prim_type, + CsrUint16 state, + const CsrCharString *text, + CsrUint32 line, + const CsrCharString *file); +void CsrLogExceptionWarning(CsrUint16 prim_type, + CsrUint16 state, + const CsrCharString *text, + CsrUint32 line, + const CsrCharString *file); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/drivers/staging/csr/csr_log_configure.h b/drivers/staging/csr/csr_log_configure.h new file mode 100644 index 0000000..3d48bf9 --- /dev/null +++ b/drivers/staging/csr/csr_log_configure.h @@ -0,0 +1,135 @@ +#ifndef CSR_LOG_CONFIGURE_H__ +#define CSR_LOG_CONFIGURE_H__ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#include "csr_types.h" +#include "csr_log.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/*---------------------------------*/ +/* Log init/deinit */ +/*---------------------------------*/ +void CsrLogInit(CsrUint8 size); +void CsrLogDeinit(void); + +/*---------------------------------*/ +/* Log Framework Tech info */ +/*---------------------------------*/ +void CsrLogTechInfoRegister(void); + +/* Set the logging level for the environment outside the scheduler context */ +void CsrLogLevelEnvironmentSet(CsrLogLevelEnvironment environmentLogLevel); + + +/* Set the logging level for all scheduler tasks */ +/* This function call takes precedence over all previous calls to CsrLogLevelTaskSetSpecific() */ +void CsrLogLevelTaskSetAll(CsrLogLevelTask tasksLogLevelMask); + +/* Set the logging level for a given Task */ +/* This function can be used as a complement to CsrLogLevelTaskSetAll() to add more _or_ less log from a given task than what is set +generally with CsrLogLevelTaskSetAll(). */ +void CsrLogLevelTaskSetSpecific(CsrSchedQid taskId, CsrLogLevelTask taskLogLevelMask); + + +/*--------------------------------------------*/ +/* Filtering on log text warning levels */ +/*--------------------------------------------*/ +typedef CsrUint32 CsrLogLevelText; +#define CSR_LOG_LEVEL_TEXT_OFF ((CsrLogLevelText) 0x0000) + +#define CSR_LOG_LEVEL_TEXT_CRITICAL ((CsrLogLevelText) 0x0001) +#define CSR_LOG_LEVEL_TEXT_ERROR ((CsrLogLevelText) 0x0002) +#define CSR_LOG_LEVEL_TEXT_WARNING ((CsrLogLevelText) 0x0004) +#define CSR_LOG_LEVEL_TEXT_INFO ((CsrLogLevelText) 0x0008) +#define CSR_LOG_LEVEL_TEXT_DEBUG ((CsrLogLevelText) 0x0010) + +#define CSR_LOG_LEVEL_TEXT_ALL ((CsrLogLevelText) 0xFFFF) + +/* The log text interface is used by both scheduler tasks and components outside the scheduler context. + * Therefore a CsrLogTextTaskId is introduced. It is effectively considered as two CsrUint16's. The lower + * 16 bits corresponds one2one with the scheduler queueId's (CsrSchedQid) and as such these bits can not be used + * by components outside scheduler tasks. The upper 16 bits are allocated for use of components outside the + * scheduler like drivers etc. Components in this range is defined independently by each technology. To avoid + * clashes the technologies are only allowed to assign values within the same restrictive range as allies to + * primitive identifiers. eg. for the framework components outside the scheduler is only allowed to assign + * taskId's in the range 0x0600xxxx to 0x06FFxxxx. And so on for other technologies. */ +typedef CsrUint32 CsrLogTextTaskId; + +/* Set the text logging level for all Tasks */ +/* This function call takes precedence over all previous calls to CsrLogLevelTextSetTask() and CsrLogLevelTextSetTaskSubOrigin() */ +void CsrLogLevelTextSetAll(CsrLogLevelText warningLevelMask); + +/* Set the text logging level for a given Task */ +/* This function call takes precedence over all previous calls to CsrLogLevelTextSetTaskSubOrigin(), but it can be used as a complement to + * CsrLogLevelTextSetAll() to add more _or_ less log from a given task than what is set generally with CsrLogLevelTextSetAll(). */ +void CsrLogLevelTextSetTask(CsrLogTextTaskId taskId, CsrLogLevelText warningLevelMask); + +/* Set the text logging level for a given tasks subOrigin */ +/* This function can be used as a complement to CsrLogLevelTextSetAll() and CsrLogLevelTextSetTask() to add more _or_ less log from a given + * subOrigin within a task than what is set generally with CsrLogLevelTextSetAll() _or_ CsrLogLevelTextSetTask(). */ +void CsrLogLevelTextSetTaskSubOrigin(CsrLogTextTaskId taskId, CsrUint16 subOrigin, CsrLogLevelText warningLevelMask); + +/******************************************************************************* + + NAME + CsrLogLevelTextSet + + DESCRIPTION + Set the text logging level for a given origin and optionally sub origin + by name. If either string is NULL or zero length, it is interpreted as + all origins and/or all sub origins respectively. If originName is NULL + or zero length, subOriginName is ignored. + + Passing NULL or zero length strings in both originName and subOriginName + is equivalent to calling CsrLogLevelTextSetAll, and overrides all + previous filter configurations for all origins and sub origins. + + Passing NULL or a zero length string in subOriginName overrides all + previous filter configurations for all sub origins of the specified + origin. + + Note: the supplied strings may be accessed after the function returns + and must remain valid and constant until CsrLogDeinit is called. + + Note: when specifying an origin (originName is not NULL and not zero + length), this function can only be used for origins that use the + csr_log_text_2.h interface for registration and logging. Filtering for + origins that use the legacy csr_log_text.h interface must be be + configured using the legacy filter configuration functions that accept + a CsrLogTextTaskId as origin specifier. However, when not specifying an + origin this function also affects origins that have been registered with + the legacy csr_log_text.h interface. Furthermore, using this function + and the legacy filter configuration functions on the same origin is not + allowed. + + PARAMETERS + originName - a string containing the name of the origin. Can be NULL or + zero length to set the log level for all origins. In this case, the + subOriginName parameter will be ignored. + subOriginName - a string containing the name of the sub origin. Can be + NULL or zero length to set the log level for all sub origins of the + specified origin. + warningLevelMask - The desired log level for the specified origin(s) and + sub origin(s). + +*******************************************************************************/ +void CsrLogLevelTextSet(const CsrCharString *originName, + const CsrCharString *subOriginName, + CsrLogLevelText warningLevelMask); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/drivers/staging/csr/csr_log_text.h b/drivers/staging/csr/csr_log_text.h new file mode 100644 index 0000000..6e0df43 --- /dev/null +++ b/drivers/staging/csr/csr_log_text.h @@ -0,0 +1,133 @@ +#ifndef CSR_LOG_TEXT_H__ +#define CSR_LOG_TEXT_H__ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#include "csr_types.h" +#include "csr_log_configure.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct CsrLogSubOrigin +{ + CsrUint16 subOriginNumber; /* Id of the given SubOrigin */ + const CsrCharString *subOriginName; /* Prefix Text for this SubOrigin */ +} CsrLogSubOrigin; + +/* Register a task which is going to use the CSR_LOG_TEXT_XXX interface */ +#ifdef CSR_LOG_ENABLE +void CsrLogTextRegister(CsrLogTextTaskId taskId, const CsrCharString *taskName, CsrUint16 subOriginsLength, const CsrLogSubOrigin *subOrigins); +#else +#define CsrLogTextRegister(taskId, taskName, subOriginsLength, subOrigins) +#endif + +/* CRITICAL: Conditions that are threatening to the integrity/stability of the + system as a whole. */ +#if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_CRITICAL_DISABLE) +void CsrLogTextCritical(CsrLogTextTaskId taskId, CsrUint16 subOrigin, const CsrCharString *formatString, ...); +void CsrLogTextBufferCritical(CsrLogTextTaskId taskId, CsrUint16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...); +#define CSR_LOG_TEXT_CRITICAL(taskId_subOrigin_formatString_varargs) CsrLogTextCritical taskId_subOrigin_formatString_varargs +#define CSR_LOG_TEXT_CONDITIONAL_CRITICAL(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_CRITICAL(logtextargs);}} +#define CSR_LOG_TEXT_BUFFER_CRITICAL(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferCritical taskId_subOrigin_length_buffer_formatString_varargs +#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_CRITICAL(condition, logtextbufferargs) {if (condition) {CSR_LOG_TEXT_BUFFER_CRITICAL(logtextbufferargs);}} +#else +#define CSR_LOG_TEXT_CRITICAL(taskId_subOrigin_formatString_varargs) +#define CSR_LOG_TEXT_CONDITIONAL_CRITICAL(condition, logtextargs) +#define CSR_LOG_TEXT_BUFFER_CRITICAL(taskId_subOrigin_length_buffer_formatString_varargs) +#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_CRITICAL(condition, logtextbufferargs) +#endif + +/* ERROR: Malfunction of a component rendering it unable to operate correctly, + causing lack of functionality but not loss of system integrity/stability. */ +#if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_ERROR_DISABLE) +void CsrLogTextError(CsrLogTextTaskId taskId, CsrUint16 subOrigin, const CsrCharString *formatString, ...); +void CsrLogTextBufferError(CsrLogTextTaskId taskId, CsrUint16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...); +#define CSR_LOG_TEXT_ERROR(taskId_subOrigin_formatString_varargs) CsrLogTextError taskId_subOrigin_formatString_varargs +#define CSR_LOG_TEXT_CONDITIONAL_ERROR(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_ERROR(logtextargs);}} +#define CSR_LOG_TEXT_BUFFER_ERROR(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferError taskId_subOrigin_length_buffer_formatString_varargs +#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_ERROR(condition, logtextbufferargs) {if (condition) {CSR_LOG_TEXT_BUFFER_ERROR(logtextbufferargs);}} +#else +#define CSR_LOG_TEXT_ERROR(taskId_subOrigin_formatString_varargs) +#define CSR_LOG_TEXT_CONDITIONAL_ERROR(condition, logtextargs) +#define CSR_LOG_TEXT_BUFFER_ERROR(taskId_subOrigin_length_buffer_formatString_varargs) +#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_ERROR(condition, logtextbufferargs) +#endif + +/* WARNING: Conditions that are unexpected and indicative of possible problems + or violations of specifications, where the result of such deviations does not + lead to malfunction of the component. */ +#if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_WARNING_DISABLE) +void CsrLogTextWarning(CsrLogTextTaskId taskId, CsrUint16 subOrigin, const CsrCharString *formatString, ...); +void CsrLogTextBufferWarning(CsrLogTextTaskId taskId, CsrUint16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...); +#define CSR_LOG_TEXT_WARNING(taskId_subOrigin_formatString_varargs) CsrLogTextWarning taskId_subOrigin_formatString_varargs +#define CSR_LOG_TEXT_CONDITIONAL_WARNING(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_WARNING(logtextargs);}} +#define CSR_LOG_TEXT_BUFFER_WARNING(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferWarning taskId_subOrigin_length_buffer_formatString_varargs +#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_WARNING(condition, logtextbufferargs) {if (condition) {CSR_LOG_TEXT_BUFFER_WARNING(logtextbufferargs);}} +#else +#define CSR_LOG_TEXT_WARNING(taskId_subOrigin_formatString_varargs) +#define CSR_LOG_TEXT_CONDITIONAL_WARNING(condition, logtextargs) +#define CSR_LOG_TEXT_BUFFER_WARNING(taskId_subOrigin_length_buffer_formatString_varargs) +#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_WARNING(condition, logtextbufferargs) +#endif + +/* INFO: Important events that may aid in determining the conditions under which + the more severe conditions are encountered. */ +#if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_INFO_DISABLE) +void CsrLogTextInfo(CsrLogTextTaskId taskId, CsrUint16 subOrigin, const CsrCharString *formatString, ...); +void CsrLogTextBufferInfo(CsrLogTextTaskId taskId, CsrUint16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...); +#define CSR_LOG_TEXT_INFO(taskId_subOrigin_formatString_varargs) CsrLogTextInfo taskId_subOrigin_formatString_varargs +#define CSR_LOG_TEXT_CONDITIONAL_INFO(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_INFO(logtextargs);}} +#define CSR_LOG_TEXT_BUFFER_INFO(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferInfo taskId_subOrigin_length_buffer_formatString_varargs +#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_INFO(condition, logtextbufferargs) {if (condition) {CSR_LOG_TEXT_BUFFER_INFO(logtextbufferargs);}} +#else +#define CSR_LOG_TEXT_INFO(taskId_subOrigin_formatString_varargs) +#define CSR_LOG_TEXT_CONDITIONAL_INFO(condition, logtextargs) +#define CSR_LOG_TEXT_BUFFER_INFO(taskId_subOrigin_length_buffer_formatString_varargs) +#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_INFO(condition, logtextbufferargs) +#endif + +/* DEBUG: Similar to INFO, but dedicated to events that occur more frequently. */ +#if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_DEBUG_DISABLE) +void CsrLogTextDebug(CsrLogTextTaskId taskId, CsrUint16 subOrigin, const CsrCharString *formatString, ...); +void CsrLogTextBufferDebug(CsrLogTextTaskId taskId, CsrUint16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...); +#define CSR_LOG_TEXT_DEBUG(taskId_subOrigin_formatString_varargs) CsrLogTextDebug taskId_subOrigin_formatString_varargs +#define CSR_LOG_TEXT_CONDITIONAL_DEBUG(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_DEBUG(logtextargs);}} +#define CSR_LOG_TEXT_BUFFER_DEBUG(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferDebug taskId_subOrigin_length_buffer_formatString_varargs +#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_DEBUG(condition, logtextbufferargs) {if (condition) {CSR_LOG_TEXT_BUFFER_DEBUG(logtextbufferargs);}} +#else +#define CSR_LOG_TEXT_DEBUG(taskId_subOrigin_formatString_varargs) +#define CSR_LOG_TEXT_CONDITIONAL_DEBUG(condition, logtextargs) +#define CSR_LOG_TEXT_BUFFER_DEBUG(taskId_subOrigin_length_buffer_formatString_varargs) +#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_DEBUG(condition, logtextbufferargs) +#endif + +/* CSR_LOG_TEXT_ASSERT (CRITICAL) */ +#ifdef CSR_LOG_ENABLE +#define CSR_LOG_TEXT_ASSERT(origin, suborigin, condition) \ + {if (!(condition)) {CSR_LOG_TEXT_CRITICAL((origin, suborigin, "Assertion \"%s\" failed at %s:%u", #condition, __FILE__, __LINE__));}} +#else +#define CSR_LOG_TEXT_ASSERT(origin, suborigin, condition) +#endif + +/* CSR_LOG_TEXT_UNHANDLED_PRIM (CRITICAL) */ +#ifdef CSR_LOG_ENABLE +#define CSR_LOG_TEXT_UNHANDLED_PRIMITIVE(origin, suborigin, primClass, primType) \ + CSR_LOG_TEXT_CRITICAL((origin, suborigin, "Unhandled primitive 0x%04X:0x%04X at %s:%u", primClass, primType, __FILE__, __LINE__)) +#else +#define CSR_LOG_TEXT_UNHANDLED_PRIMITIVE(origin, suborigin, primClass, primType) +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/drivers/staging/csr/csr_macro.h b/drivers/staging/csr/csr_macro.h new file mode 100644 index 0000000..2e3dcac --- /dev/null +++ b/drivers/staging/csr/csr_macro.h @@ -0,0 +1,111 @@ +#ifndef CSR_MACRO_H__ +#define CSR_MACRO_H__ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#include "csr_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/*------------------------------------------------------------------*/ +/* Bits - intended to operate on CsrUint32 values */ +/*------------------------------------------------------------------*/ +#define CSR_MASK_IS_SET(val, mask) (((val) & (mask)) == (mask)) +#define CSR_MASK_IS_UNSET(val, mask) ((((val) & (mask)) ^ mask) == (mask)) +#define CSR_MASK_SET(val, mask) ((val) |= (mask)) +#define CSR_MASK_UNSET(val, mask) ((val) = ((val) ^ (mask)) & (val)) /* Unsets the bits in val that are set in mask */ +#define CSR_BIT_IS_SET(val, bit) ((CsrBool) ((((val) & (1UL << (bit))) != 0))) +#define CSR_BIT_SET(val, bit) ((val) |= (1UL << (bit))) +#define CSR_BIT_UNSET(val, bit) ((val) &= ~(1UL << (bit))) +#define CSR_BIT_TOGGLE(val, bit) ((val) ^= (1UL << (bit))) + +/*------------------------------------------------------------------*/ +/* Endian conversion */ +/*------------------------------------------------------------------*/ +#define CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr) (((CsrUint16) ((CsrUint8 *) (ptr))[0]) | ((CsrUint16) ((CsrUint8 *) (ptr))[1]) << 8) +#define CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr) (((CsrUint32) ((CsrUint8 *) (ptr))[0]) | ((CsrUint32) ((CsrUint8 *) (ptr))[1]) << 8 | \ + ((CsrUint32) ((CsrUint8 *) (ptr))[2]) << 16 | ((CsrUint32) ((CsrUint8 *) (ptr))[3]) << 24) +#define CSR_COPY_UINT16_TO_LITTLE_ENDIAN(uint, ptr) ((CsrUint8 *) (ptr))[0] = ((CsrUint8) ((uint) & 0x00FF)); \ + ((CsrUint8 *) (ptr))[1] = ((CsrUint8) ((uint) >> 8)) +#define CSR_COPY_UINT32_TO_LITTLE_ENDIAN(uint, ptr) ((CsrUint8 *) (ptr))[0] = ((CsrUint8) ((uint) & 0x000000FF)); \ + ((CsrUint8 *) (ptr))[1] = ((CsrUint8) (((uint) >> 8) & 0x000000FF)); \ + ((CsrUint8 *) (ptr))[2] = ((CsrUint8) (((uint) >> 16) & 0x000000FF)); \ + ((CsrUint8 *) (ptr))[3] = ((CsrUint8) (((uint) >> 24) & 0x000000FF)) +#define CSR_GET_UINT16_FROM_BIG_ENDIAN(ptr) (((CsrUint16) ((CsrUint8 *) (ptr))[1]) | ((CsrUint16) ((CsrUint8 *) (ptr))[0]) << 8) +#define CSR_GET_UINT24_FROM_BIG_ENDIAN(ptr) (((CsrUint24) ((CsrUint8 *) (ptr))[2]) | \ + ((CsrUint24) ((CsrUint8 *) (ptr))[1]) << 8 | ((CsrUint24) ((CsrUint8 *) (ptr))[0]) << 16) +#define CSR_GET_UINT32_FROM_BIG_ENDIAN(ptr) (((CsrUint32) ((CsrUint8 *) (ptr))[3]) | ((CsrUint32) ((CsrUint8 *) (ptr))[2]) << 8 | \ + ((CsrUint32) ((CsrUint8 *) (ptr))[1]) << 16 | ((CsrUint32) ((CsrUint8 *) (ptr))[0]) << 24) +#define CSR_COPY_UINT16_TO_BIG_ENDIAN(uint, ptr) ((CsrUint8 *) (ptr))[1] = ((CsrUint8) ((uint) & 0x00FF)); \ + ((CsrUint8 *) (ptr))[0] = ((CsrUint8) ((uint) >> 8)) +#define CSR_COPY_UINT24_TO_BIG_ENDIAN(uint, ptr) ((CsrUint8 *) (ptr))[2] = ((CsrUint8) ((uint) & 0x000000FF)); \ + ((CsrUint8 *) (ptr))[1] = ((CsrUint8) (((uint) >> 8) & 0x000000FF)); \ + ((CsrUint8 *) (ptr))[0] = ((CsrUint8) (((uint) >> 16) & 0x000000FF)) +#define CSR_COPY_UINT32_TO_BIG_ENDIAN(uint, ptr) ((CsrUint8 *) (ptr))[3] = ((CsrUint8) ((uint) & 0x000000FF)); \ + ((CsrUint8 *) (ptr))[2] = ((CsrUint8) (((uint) >> 8) & 0x000000FF)); \ + ((CsrUint8 *) (ptr))[1] = ((CsrUint8) (((uint) >> 16) & 0x000000FF)); \ + ((CsrUint8 *) (ptr))[0] = ((CsrUint8) (((uint) >> 24) & 0x000000FF)) + +/*------------------------------------------------------------------*/ +/* XAP conversion macros */ +/*------------------------------------------------------------------*/ + +#define CSR_LSB16(a) ((CsrUint8) ((a) & 0x00ff)) +#define CSR_MSB16(b) ((CsrUint8) ((b) >> 8)) + +#define CSR_CONVERT_8_FROM_XAP(output, input) \ + (output) = ((CsrUint8) (input));(input) += 2 + +#define CSR_CONVERT_16_FROM_XAP(output, input) \ + (output) = (CsrUint16) ((((CsrUint16) (input)[1]) << 8) | \ + ((CsrUint16) (input)[0]));(input) += 2 + +#define CSR_CONVERT_32_FROM_XAP(output, input) \ + (output) = (((CsrUint32) (input)[1]) << 24) | \ + (((CsrUint32) (input)[0]) << 16) | \ + (((CsrUint32) (input)[3]) << 8) | \ + ((CsrUint32) (input)[2]);input += 4 + +#define CSR_ADD_UINT8_TO_XAP(output, input) \ + (output)[0] = (input); \ + (output)[1] = 0;(output) += 2 + +#define CSR_ADD_UINT16_TO_XAP(output, input) \ + (output)[0] = ((CsrUint8) ((input) & 0x00FF)); \ + (output)[1] = ((CsrUint8) ((input) >> 8));(output) += 2 + +#define CSR_ADD_UINT32_TO_XAP(output, input) \ + (output)[0] = ((CsrUint8) (((input) >> 16) & 0x00FF)); \ + (output)[1] = ((CsrUint8) ((input) >> 24)); \ + (output)[2] = ((CsrUint8) ((input) & 0x00FF)); \ + (output)[3] = ((CsrUint8) (((input) >> 8) & 0x00FF));(output) += 4 + +/*------------------------------------------------------------------*/ +/* Misc */ +/*------------------------------------------------------------------*/ +#define CSRMAX(a, b) (((a) > (b)) ? (a) : (b)) +#define CSRMIN(a, b) (((a) < (b)) ? (a) : (b)) + +/* Use this macro on unused local variables that cannot be removed (such as + unused function parameters). This will quell warnings from certain compilers + and static code analysis tools like Lint and Valgrind. */ +#define CSR_UNUSED(x) ((void) (x)) + +#define CSR_TOUPPER(character) (((character) >= 'a') && ((character) <= 'z') ? ((character) - 0x20) : (character)) +#define CSR_TOLOWER(character) (((character) >= 'A') && ((character) <= 'Z') ? ((character) + 0x20) : (character)) +#define CSR_ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x))) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/drivers/staging/csr/csr_msg_transport.h b/drivers/staging/csr/csr_msg_transport.h new file mode 100644 index 0000000..b0095b0 --- /dev/null +++ b/drivers/staging/csr/csr_msg_transport.h @@ -0,0 +1,25 @@ +#ifndef CSR_MSG_TRANSPORT_H__ +#define CSR_MSG_TRANSPORT_H__ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CsrMsgTransport +#define CsrMsgTransport CsrSchedMessagePut +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_MSG_TRANSPORT */ diff --git a/drivers/staging/csr/csr_msgconv.c b/drivers/staging/csr/csr_msgconv.c new file mode 100644 index 0000000..9f1c946 --- /dev/null +++ b/drivers/staging/csr/csr_msgconv.c @@ -0,0 +1,324 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#include +#include "csr_types.h" +#include "csr_pmem.h" +#include "csr_panic.h" +#include "csr_sched.h" +#include "csr_msgconv.h" +#include "csr_util.h" + +static CsrMsgConvEntry *converter; + +CsrMsgConvPrimEntry *CsrMsgConvFind(CsrUint16 primType) +{ + CsrMsgConvPrimEntry *ptr = NULL; + + if (converter) + { + ptr = converter->profile_converters; + while (ptr) + { + if (ptr->primType == primType) + { + break; + } + else + { + ptr = ptr->next; + } + } + } + + return ptr; +} + +static const CsrMsgConvMsgEntry *find_msg_converter(CsrMsgConvPrimEntry *ptr, CsrUint16 msgType) +{ + const CsrMsgConvMsgEntry *cv = ptr->conv; + if (ptr->lookupFunc) + { + return (const CsrMsgConvMsgEntry *) ptr->lookupFunc((CsrMsgConvMsgEntry *) cv, msgType); + } + + while (cv) + { + if (cv->serFunc == NULL) + { + /* We've reached the end of the chain */ + cv = NULL; + break; + } + + if (cv->msgType == msgType) + { + break; + } + else + { + cv++; + } + } + + return cv; +} + +static void *deserialize_data(CsrUint16 primType, + CsrSize length, + CsrUint8 *data) +{ + CsrMsgConvPrimEntry *ptr; + CsrUint8 *ret; + + ptr = CsrMsgConvFind(primType); + + if (ptr) + { + const CsrMsgConvMsgEntry *cv; + CsrUint16 msgId = 0; + CsrSize offset = 0; + CsrUint16Des(&msgId, data, &offset); + + cv = find_msg_converter(ptr, msgId); + if (cv) + { + ret = cv->deserFunc(data, length); + } + else + { + ret = NULL; + } + } + else + { + ret = NULL; + } + + return ret; +} + +static CsrSize sizeof_message(CsrUint16 primType, void *msg) +{ + CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType); + CsrSize ret; + + if (ptr) + { + const CsrMsgConvMsgEntry *cv; + CsrUint16 msgId = *(CsrUint16 *) msg; + + cv = find_msg_converter(ptr, msgId); + if (cv) + { + ret = cv->sizeofFunc(msg); + } + else + { + ret = 0; + } + } + else + { + ret = 0; + } + + return ret; +} + +static CsrBool free_message(CsrUint16 primType, CsrUint8 *data) +{ + CsrMsgConvPrimEntry *ptr; + CsrBool ret; + + ptr = CsrMsgConvFind(primType); + + if (ptr) + { + const CsrMsgConvMsgEntry *cv; + CsrUint16 msgId = *(CsrUint16 *) data; + + cv = find_msg_converter(ptr, msgId); + if (cv) + { + cv->freeFunc(data); + ret = TRUE; + } + else + { + ret = FALSE; + } + } + else + { + ret = FALSE; + } + + return ret; +} + +static CsrUint8 *serialize_message(CsrUint16 primType, + void *msg, + CsrSize *length, + CsrUint8 *buffer) +{ + CsrMsgConvPrimEntry *ptr; + CsrUint8 *ret; + + ptr = CsrMsgConvFind(primType); + + *length = 0; + + if (ptr) + { + const CsrMsgConvMsgEntry *cv; + + cv = find_msg_converter(ptr, *(CsrUint16 *) msg); + if (cv) + { + ret = cv->serFunc(buffer, length, msg); + } + else + { + ret = NULL; + } + } + else + { + ret = NULL; + } + + return ret; +} + +CsrSize CsrMsgConvSizeof(CsrUint16 primType, void *msg) +{ + return sizeof_message(primType, msg); +} + +CsrUint8 *CsrMsgConvSerialize(CsrUint8 *buffer, CsrSize maxBufferOffset, CsrSize *offset, CsrUint16 primType, void *msg) +{ + if (converter) + { + CsrSize serializedLength; + CsrUint8 *bufSerialized; + CsrUint8 *bufOffset = &buffer[*offset]; + bufSerialized = converter->serialize_message(primType, msg, &serializedLength, bufOffset); + *offset += serializedLength; + return bufSerialized; + } + else + { + return NULL; + } +} + +/* Insert profile converter at head of converter list. */ +void CsrMsgConvInsert(CsrUint16 primType, const CsrMsgConvMsgEntry *ce) +{ + CsrMsgConvPrimEntry *pc; + pc = CsrMsgConvFind(primType); + + if (pc) + { + /* Already registered. Do nothing */ + } + else + { + pc = CsrPmemAlloc(sizeof(*pc)); + pc->primType = primType; + pc->conv = ce; + pc->lookupFunc = NULL; + pc->next = converter->profile_converters; + converter->profile_converters = pc; + } +} +EXPORT_SYMBOL_GPL(CsrMsgConvInsert); + +CsrMsgConvMsgEntry *CsrMsgConvFindEntry(CsrUint16 primType, CsrUint16 msgType) +{ + CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType); + if (ptr) + { + return (CsrMsgConvMsgEntry *) find_msg_converter(ptr, msgType); + } + return NULL; +} +EXPORT_SYMBOL_GPL(CsrMsgConvFindEntry); + +CsrMsgConvMsgEntry *CsrMsgConvFindEntryByMsg(CsrUint16 primType, const void *msg) +{ + CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType); + if (ptr && msg) + { + CsrUint16 msgType = *((CsrUint16 *) msg); + return (CsrMsgConvMsgEntry *) find_msg_converter(ptr, msgType); + } + return NULL; +} + +void CsrMsgConvCustomLookupRegister(CsrUint16 primType, CsrMsgCustomLookupFunc *lookupFunc) +{ + CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType); + if (ptr) + { + ptr->lookupFunc = lookupFunc; + } +} +EXPORT_SYMBOL_GPL(CsrMsgConvCustomLookupRegister); + +CsrMsgConvEntry *CsrMsgConvInit(void) +{ + if (!converter) + { + converter = (CsrMsgConvEntry *) CsrPmemAlloc(sizeof(CsrMsgConvEntry)); + + converter->profile_converters = NULL; + converter->free_message = free_message; + converter->sizeof_message = sizeof_message; + converter->serialize_message = serialize_message; + converter->deserialize_data = deserialize_data; + } + + return converter; +} +EXPORT_SYMBOL_GPL(CsrMsgConvInit); + +CsrMsgConvEntry *CsrMsgConvGet(void) +{ + return converter; +} + +#ifdef ENABLE_SHUTDOWN +void CsrMsgConvDeinit(void) +{ + CsrMsgConvPrimEntry *s; + + if (converter == NULL) + { + return; + } + + /* Walk converter list and free elements. */ + s = converter->profile_converters; + while (s) + { + CsrMsgConvPrimEntry *s_next; + s_next = s->next; + CsrPmemFree(s); + s = s_next; + } + + CsrPmemFree(converter); + converter = NULL; +} +EXPORT_SYMBOL_GPL(CsrMsgConvDeinit); + +#endif /* ENABLE_SHUTDOWN */ diff --git a/drivers/staging/csr/csr_msgconv.h b/drivers/staging/csr/csr_msgconv.h new file mode 100644 index 0000000..2875c8c --- /dev/null +++ b/drivers/staging/csr/csr_msgconv.h @@ -0,0 +1,145 @@ +#ifndef CSR_MSGCONV_H__ +#define CSR_MSGCONV_H__ + +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#include "csr_types.h" +#include "csr_prim_defs.h" +#include "csr_sched.h" +#include "csr_unicode.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef CsrSize (CsrMsgSizeofFunc)(void *msg); +typedef CsrUint8 *(CsrMsgSerializeFunc)(CsrUint8 *buffer, CsrSize *length, void *msg); +typedef void (CsrMsgFreeFunc)(void *msg); +typedef void *(CsrMsgDeserializeFunc)(CsrUint8 *buffer, CsrSize length); + +/* Converter entry for one message type */ +typedef struct CsrMsgConvMsgEntry +{ + CsrUint16 msgType; + CsrMsgSizeofFunc *sizeofFunc; + CsrMsgSerializeFunc *serFunc; + CsrMsgDeserializeFunc *deserFunc; + CsrMsgFreeFunc *freeFunc; +} CsrMsgConvMsgEntry; + +/* Optional lookup function */ +typedef CsrMsgConvMsgEntry *(CsrMsgCustomLookupFunc)(CsrMsgConvMsgEntry *ce, CsrUint16 msgType); + +/* All converter entries for one specific primitive */ +typedef struct CsrMsgConvPrimEntry +{ + CsrUint16 primType; + const CsrMsgConvMsgEntry *conv; + CsrMsgCustomLookupFunc *lookupFunc; + struct CsrMsgConvPrimEntry *next; +} CsrMsgConvPrimEntry; + +typedef struct +{ + CsrMsgConvPrimEntry *profile_converters; + void *(*deserialize_data)(CsrUint16 primType, CsrSize length, CsrUint8 * data); + CsrBool (*free_message)(CsrUint16 primType, CsrUint8 *data); + CsrSize (*sizeof_message)(CsrUint16 primType, void *msg); + CsrUint8 *(*serialize_message)(CsrUint16 primType, void *msg, + CsrSize * length, + CsrUint8 * buffer); +} CsrMsgConvEntry; + +CsrSize CsrMsgConvSizeof(CsrUint16 primType, void *msg); +CsrUint8 *CsrMsgConvSerialize(CsrUint8 *buffer, CsrSize maxBufferOffset, CsrSize *offset, CsrUint16 primType, void *msg); +void CsrMsgConvCustomLookupRegister(CsrUint16 primType, CsrMsgCustomLookupFunc *lookupFunc); +void CsrMsgConvInsert(CsrUint16 primType, const CsrMsgConvMsgEntry *ce); +CsrMsgConvPrimEntry *CsrMsgConvFind(CsrUint16 primType); +CsrMsgConvMsgEntry *CsrMsgConvFindEntry(CsrUint16 primType, CsrUint16 msgType); +CsrMsgConvMsgEntry *CsrMsgConvFindEntryByMsg(CsrUint16 primType, const void *msg); +CsrMsgConvEntry *CsrMsgConvGet(void); +CsrMsgConvEntry *CsrMsgConvInit(void); +#ifdef ENABLE_SHUTDOWN +void CsrMsgConvDeinit(void); +#endif /* ENABLE_SHUTDOWN */ + +/* SHOULD BE INTERNAL TO FRAMEWORK AKA DEPRECATED */ + +CsrUint32 CsrCharStringSerLen(const CsrCharString *str); +CsrUint32 CsrUtf8StringSerLen(const CsrUtf8String *str); +CsrUint32 CsrUtf16StringSerLen(const CsrUtf16String *str); + +/* Prototypes for primitive type serializers */ +void CsrUint8Ser(CsrUint8 *buffer, CsrSize *offset, CsrUint8 value); +void CsrUint16Ser(CsrUint8 *buffer, CsrSize *offset, CsrUint16 value); +void CsrUint32Ser(CsrUint8 *buffer, CsrSize *offset, CsrUint32 value); +void CsrMemCpySer(CsrUint8 *buffer, CsrSize *offset, const void *value, CsrSize length); +void CsrCharStringSer(CsrUint8 *buffer, CsrSize *offset, const CsrCharString *value); +void CsrUtf8StringSer(CsrUint8 *buffer, CsrSize *offset, const CsrUtf8String *value); +void CsrUtf16StringSer(CsrUint8 *buffer, CsrSize *offset, const CsrUtf16String *value); +void CsrVoidPtrSer(CsrUint8 *buffer, CsrSize *offset, void *ptr); +void CsrSizeSer(CsrUint8 *buffer, CsrSize *offset, CsrSize value); + +void CsrUint8Des(CsrUint8 *value, CsrUint8 *buffer, CsrSize *offset); +void CsrUint16Des(CsrUint16 *value, CsrUint8 *buffer, CsrSize *offset); +void CsrUint32Des(CsrUint32 *value, CsrUint8 *buffer, CsrSize *offset); +void CsrMemCpyDes(void *value, CsrUint8 *buffer, CsrSize *offset, CsrSize length); +void CsrCharStringDes(CsrCharString **value, CsrUint8 *buffer, CsrSize *offset); +void CsrUtf8StringDes(CsrUtf8String **value, CsrUint8 *buffer, CsrSize *offset); +void CsrUtf16StringDes(CsrUtf16String **value, CsrUint8 *buffer, CsrSize *offset); +void CsrVoidPtrDes(void **value, CsrUint8 *buffer, CsrSize *offset); +void CsrSizeDes(CsrSize *value, CsrUint8 *buffer, CsrSize *offset); + +CsrSize CsrEventSizeof(void *msg); +CsrUint8 *CsrEventSer(CsrUint8 *ptr, CsrSize *len, void *msg); +void *CsrEventDes(CsrUint8 *buffer, CsrSize length); + +CsrSize CsrEventCsrUint8Sizeof(void *msg); +CsrUint8 *CsrEventCsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg); +void *CsrEventCsrUint8Des(CsrUint8 *buffer, CsrSize length); + +CsrSize CsrEventCsrUint16Sizeof(void *msg); +CsrUint8 *CsrEventCsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg); +void *CsrEventCsrUint16Des(CsrUint8 *buffer, CsrSize length); + +CsrSize CsrEventCsrUint32Sizeof(void *msg); +CsrUint8 *CsrEventCsrUint32Ser(CsrUint8 *ptr, CsrSize *len, void *msg); +void *CsrEventCsrUint32Des(CsrUint8 *buffer, CsrSize length); + +CsrSize CsrEventCsrUint16CsrUint8Sizeof(void *msg); +CsrUint8 *CsrEventCsrUint16CsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg); +void *CsrEventCsrUint16CsrUint8Des(CsrUint8 *buffer, CsrSize length); + +CsrSize CsrEventCsrUint16CsrUint16Sizeof(void *msg); +CsrUint8 *CsrEventCsrUint16CsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg); +void *CsrEventCsrUint16CsrUint16Des(CsrUint8 *buffer, CsrSize length); + +CsrSize CsrEventCsrUint16CsrUint32Sizeof(void *msg); +CsrUint8 *CsrEventCsrUint16CsrUint32Ser(CsrUint8 *ptr, CsrSize *len, void *msg); +void *CsrEventCsrUint16CsrUint32Des(CsrUint8 *buffer, CsrSize length); + +CsrSize CsrEventCsrUint16CsrCharStringSizeof(void *msg); +CsrUint8 *CsrEventCsrUint16CsrCharStringSer(CsrUint8 *ptr, CsrSize *len, void *msg); +void *CsrEventCsrUint16CsrCharStringDes(CsrUint8 *buffer, CsrSize length); + +CsrSize CsrEventCsrUint32CsrUint16Sizeof(void *msg); +CsrUint8 *CsrEventCsrUint32CsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg); +void *CsrEventCsrUint32CsrUint16Des(CsrUint8 *buffer, CsrSize length); + +CsrSize CsrEventCsrUint32CsrCharStringSizeof(void *msg); +CsrUint8 *CsrEventCsrUint32CsrCharStringSer(CsrUint8 *ptr, CsrSize *len, void *msg); +void *CsrEventCsrUint32CsrCharStringDes(CsrUint8 *buffer, CsrSize length); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/drivers/staging/csr/csr_panic.c b/drivers/staging/csr/csr_panic.c new file mode 100644 index 0000000..2564e80 --- /dev/null +++ b/drivers/staging/csr/csr_panic.c @@ -0,0 +1,22 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#include +#include +#include + +#include "csr_types.h" +#include "csr_panic.h" + +void CsrPanic(CsrUint8 tech, CsrUint16 reason, const char *p) +{ + BUG_ON(1); +} +EXPORT_SYMBOL_GPL(CsrPanic); diff --git a/drivers/staging/csr/csr_panic.h b/drivers/staging/csr/csr_panic.h new file mode 100644 index 0000000..6e33f93 --- /dev/null +++ b/drivers/staging/csr/csr_panic.h @@ -0,0 +1,55 @@ +#ifndef CSR_PANIC_H__ +#define CSR_PANIC_H__ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ +#include "csr_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Synergy techonology ID definitions */ +#define CSR_TECH_FW 0 +#define CSR_TECH_BT 1 +#define CSR_TECH_WIFI 2 +#define CSR_TECH_GPS 3 +#define CSR_TECH_NFC 4 + +/* Panic type ID definitions for technology type CSR_TECH_FW */ +#define CSR_PANIC_FW_UNEXPECTED_VALUE 0 +#define CSR_PANIC_FW_HEAP_EXHAUSTION 1 +#define CSR_PANIC_FW_INVALID_PFREE_POINTER 2 +#define CSR_PANIC_FW_EXCEPTION 3 +#define CSR_PANIC_FW_ASSERTION_FAIL 4 +#define CSR_PANIC_FW_NULL_TASK_HANDLER 5 +#define CSR_PANIC_FW_UNKNOWN_TASK 6 +#define CSR_PANIC_FW_QUEUE_ACCESS_VIOLATION 7 +#define CSR_PANIC_FW_TOO_MANY_MESSAGES 8 +#define CSR_PANIC_FW_TOO_MANY_TIMED_EVENTS 9 +#define CSR_PANIC_FW_ABCSP_SYNC_LOST 10 +#define CSR_PANIC_FW_OVERSIZE_ABCSP_PRIM 11 +#define CSR_PANIC_FW_H4_CORRUPTION 12 +#define CSR_PANIC_FW_H4_SYNC_LOST 13 +#define CSR_PANIC_FW_H4_RX_OVERRUN 14 +#define CSR_PANIC_FW_H4_TX_OVERRUN 15 +#define CSR_PANIC_FW_TM_BC_RESTART_FAIL 16 +#define CSR_PANIC_FW_TM_BC_START_FAIL 17 +#define CSR_PANIC_FW_TM_BC_BAD_STATE 18 +#define CSR_PANIC_FW_TM_BC_TRANSPORT_LOST 19 + +/* Panic interface used by technologies */ +/* DEPRECATED - replaced by csr_log_text.h */ +void CsrPanic(CsrUint8 tech, CsrUint16 reason, const char *p); + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_PANIC_H__ */ diff --git a/drivers/staging/csr/csr_pmem.c b/drivers/staging/csr/csr_pmem.c new file mode 100644 index 0000000..a07c449 --- /dev/null +++ b/drivers/staging/csr/csr_pmem.c @@ -0,0 +1,51 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#include +#include +#include + + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33) +#include +#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16) +#include +#endif + +#include + +#include "csr_panic.h" +#include "csr_pmem.h" + +void *CsrPmemAlloc(CsrSize size) +{ + void *ret; + + ret = kmalloc(size, GFP_KERNEL); + if (!ret) + { + CsrPanic(CSR_TECH_FW, CSR_PANIC_FW_HEAP_EXHAUSTION, + "out of memory"); + } + + return ret; +} +EXPORT_SYMBOL_GPL(CsrPmemAlloc); + +void CsrPmemFree(void *ptr) +{ + if (ptr == NULL) + { + return; + } + + kfree(ptr); +} +EXPORT_SYMBOL_GPL(CsrPmemFree); diff --git a/drivers/staging/csr/csr_pmem.h b/drivers/staging/csr/csr_pmem.h new file mode 100644 index 0000000..f1e59ef --- /dev/null +++ b/drivers/staging/csr/csr_pmem.h @@ -0,0 +1,143 @@ +#ifndef CSR_PMEM_H__ +#define CSR_PMEM_H__ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#include "csr_types.h" +#include "csr_util.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CSR_PMEM_DEBUG_ENABLE +/***************************************************************************** + + NAME + CsrPmemAlloc + + DESCRIPTION + This function will allocate a contiguous block of memory of at least + the specified size in bytes and return a pointer to the allocated + memory. This function is not allowed to return NULL. A size of 0 is a + valid request, and a unique and valid (not NULL) pointer must be + returned in this case. + + PARAMETERS + size - Size of memory requested. Note that a size of 0 is valid. + + RETURNS + Pointer to allocated memory. + +*****************************************************************************/ +#ifdef CSR_PMEM_DEBUG +void *CsrPmemAllocDebug(CsrSize size, + const CsrCharString *file, CsrUint32 line); +#define CsrPmemAlloc(sz) CsrPmemAllocDebug((sz), __FILE__, __LINE__) +#else +void *CsrPmemAlloc(CsrSize size); +#endif + + +/***************************************************************************** + + NAME + CsrPmemFree + + DESCRIPTION + This function will deallocate a previously allocated block of memory. + + PARAMETERS + ptr - Pointer to allocated memory. + +*****************************************************************************/ +void CsrPmemFree(void *ptr); +#endif + +/***************************************************************************** + + NAME + CsrPmemZalloc + + DESCRIPTION + This function is equivalent to CsrPmemAlloc, but the allocated memory + is initialised to zero. + + PARAMETERS + size - Size of memory requested. Note that a size of 0 is valid. + + RETURNS + Pointer to allocated memory. + +*****************************************************************************/ +#define CsrPmemZalloc(s) (CsrMemSet(CsrPmemAlloc(s), 0x00, (s))) + + +/***************************************************************************** + + NAME + pnew and zpnew + + DESCRIPTIOM + Type-safe wrappers for CsrPmemAlloc and CsrPmemZalloc, for allocating + single instances of a specified and named type. + + PARAMETERS + t - type to allocate. + +*****************************************************************************/ +#define pnew(t) ((t *) (CsrPmemAlloc(sizeof(t)))) +#define zpnew(t) ((t *) (CsrPmemZalloc(sizeof(t)))) + + +/*----------------------------------------------------------------------------* + * Csr Pmem Debug code. Allows custom callbacks on CsrPmemAlloc and CsrPmemFree + *----------------------------------------------------------------------------*/ +#ifdef CSR_PMEM_DEBUG_ENABLE + +typedef CsrUint8 CsrPmemDebugAllocType; +#define CSR_PMEM_DEBUG_TYPE_PMEM_ALLOC 1 +#define CSR_PMEM_DEBUG_TYPE_MEM_ALLOC 2 +#define CSR_PMEM_DEBUG_TYPE_MEM_CALLOC 3 +#define CSR_PMEM_DEBUG_TYPE_MEM_ALLOC_DMA 4 + +typedef void (CsrPmemDebugOnAlloc)(void *ptr, void *userptr, CsrSize size, CsrPmemDebugAllocType type, const CsrCharString* file, CsrUint32 line); +typedef void (CsrPmemDebugOnFree)(void *ptr, void *userptr, CsrPmemDebugAllocType type, const CsrCharString* file, CsrUint32 line); + +/*----------------------------------------------------------------------------* + * NAME + * CsrPmemInstallHooks + * + * DESCRIPTION + * Install debug hooks for memory allocation + * Use NULL values to uninstall the hooks + * headSize = The number of extra bytes to allocate in the head of the Allocated buffer + * footSize = The number of extra bytes to allocate in the end of the Allocated buffer + * + * RETURNS + * void + * + *----------------------------------------------------------------------------*/ +void CsrPmemDebugInstallHooks(CsrUint8 headSize, CsrUint8 endSize, CsrPmemDebugOnAlloc *onAllocCallback, CsrPmemDebugOnFree *onFreeCallback); + +void *CsrPmemDebugAlloc(CsrSize size, CsrPmemDebugAllocType type, const CsrCharString* file, CsrUint32 line); +#define CsrPmemAlloc(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_PMEM_ALLOC, __FILE__, __LINE__) + +void CsrPmemDebugFree(void *ptr, CsrPmemDebugAllocType type, const CsrCharString* file, CsrUint32 line); +#define CsrPmemFree(ptr) CsrPmemDebugFree(ptr, CSR_PMEM_DEBUG_TYPE_PMEM_ALLOC, __FILE__, __LINE__) + +#endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/drivers/staging/csr/csr_prim_defs.h b/drivers/staging/csr/csr_prim_defs.h new file mode 100644 index 0000000..02ab913 --- /dev/null +++ b/drivers/staging/csr/csr_prim_defs.h @@ -0,0 +1,64 @@ +#ifndef CSR_PRIM_DEFS_H__ +#define CSR_PRIM_DEFS_H__ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ +#include "csr_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/************************************************************************************ + * Segmentation of primitives in upstream and downstream segment + ************************************************************************************/ +typedef CsrUint16 CsrPrim; +#define CSR_PRIM_UPSTREAM ((CsrPrim) (0x8000)) + +/************************************************************************************ + * Primitive definitions for Synergy framework + ************************************************************************************/ +#define CSR_SYNERGY_EVENT_CLASS_BASE ((CsrUint16) (0x0600)) + +#define CSR_HCI_PRIM ((CsrUint16) (0x0000 | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_BCCMD_PRIM ((CsrUint16) (0x0001 | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_HQ_PRIM ((CsrUint16) (0x0002 | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_VM_PRIM ((CsrUint16) (0x0003 | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_TM_BLUECORE_PRIM ((CsrUint16) (0x0004 | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_FP_PRIM ((CsrUint16) (0x0005 | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_IP_SOCKET_PRIM ((CsrUint16) (0x0006 | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_IP_ETHER_PRIM ((CsrUint16) (0x0007 | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_IP_IFCONFIG_PRIM ((CsrUint16) (0x0008 | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_IP_INTERNAL_PRIM ((CsrUint16) (0x0009 | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_FSAL_PRIM ((CsrUint16) (0x000A | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_DATA_STORE_PRIM ((CsrUint16) (0x000B | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_AM_PRIM ((CsrUint16) (0x000C | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_TLS_PRIM ((CsrUint16) (0x000D | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_DHCP_SERVER_PRIM ((CsrUint16) (0x000E | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_TFTP_PRIM ((CsrUint16) (0x000F | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_DSPM_PRIM ((CsrUint16) (0x0010 | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_TLS_INTERNAL_PRIM ((CsrUint16) (0x0011 | CSR_SYNERGY_EVENT_CLASS_BASE)) + +#define NUMBER_OF_CSR_FW_EVENTS (CSR_DSPM_PRIM - CSR_SYNERGY_EVENT_CLASS_BASE + 1) + +#define CSR_SYNERGY_EVENT_CLASS_MISC_BASE ((CsrUint16) (0x06A0)) + +#define CSR_UI_PRIM ((CsrUint16) (0x0000 | CSR_SYNERGY_EVENT_CLASS_MISC_BASE)) +#define CSR_APP_PRIM ((CsrUint16) (0x0001 | CSR_SYNERGY_EVENT_CLASS_MISC_BASE)) +#define CSR_SDIO_PROBE_PRIM ((CsrUint16) (0x0002 | CSR_SYNERGY_EVENT_CLASS_MISC_BASE)) + +#define NUMBER_OF_CSR_FW_MISC_EVENTS (CSR_SDIO_PROBE_PRIM - CSR_SYNERGY_EVENT_CLASS_MISC_BASE + 1) + +#define CSR_ENV_PRIM ((CsrUint16) (0x00FF | CSR_SYNERGY_EVENT_CLASS_MISC_BASE)) + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_PRIM_DEFS_H__ */ diff --git a/drivers/staging/csr/csr_result.h b/drivers/staging/csr/csr_result.h new file mode 100644 index 0000000..249b499 --- /dev/null +++ b/drivers/staging/csr/csr_result.h @@ -0,0 +1,27 @@ +#ifndef CSR_RESULT_H__ +#define CSR_RESULT_H__ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#include "csr_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef CsrUint16 CsrResult; +#define CSR_RESULT_SUCCESS ((CsrResult) 0x0000) +#define CSR_RESULT_FAILURE ((CsrResult) 0xFFFF) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/drivers/staging/csr/csr_sched.h b/drivers/staging/csr/csr_sched.h new file mode 100644 index 0000000..2f982bb --- /dev/null +++ b/drivers/staging/csr/csr_sched.h @@ -0,0 +1,292 @@ +#ifndef CSR_SCHED_H__ +#define CSR_SCHED_H__ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ +#include "csr_types.h" +#include "csr_time.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* An identifier issued by the scheduler. */ +typedef CsrUint32 CsrSchedIdentifier; + +/* A task identifier */ +typedef CsrUint16 CsrSchedTaskId; + +/* A queue identifier */ +typedef CsrUint16 CsrSchedQid; +#define CSR_SCHED_QID_INVALID ((CsrSchedQid) 0xFFFF) + +/* A message identifier */ +typedef CsrSchedIdentifier CsrSchedMsgId; + +/* A timer event identifier */ +typedef CsrSchedIdentifier CsrSchedTid; +#define CSR_SCHED_TID_INVALID ((CsrSchedTid) 0) + +/* Scheduler entry functions share this structure */ +typedef void (*schedEntryFunction_t)(void **inst); + +/* Time constants. */ +#define CSR_SCHED_TIME_MAX ((CsrTime) 0xFFFFFFFF) +#define CSR_SCHED_MILLISECOND ((CsrTime) (1000)) +#define CSR_SCHED_SECOND ((CsrTime) (1000 * CSR_SCHED_MILLISECOND)) +#define CSR_SCHED_MINUTE ((CsrTime) (60 * CSR_SCHED_SECOND)) + +/* Queue and primitive that identifies the environment */ +#define CSR_SCHED_TASK_ID 0xFFFF +#define CSR_SCHED_PRIM (CSR_SCHED_TASK_ID) +#define CSR_SCHED_EXCLUDED_MODULE_QUEUE 0xFFFF + +/* + * Background interrupt definitions + */ +typedef CsrUint16 CsrSchedBgint; +#define CSR_SCHED_BGINT_INVALID ((CsrSchedBgint) 0xFFFF) + +typedef void (*CsrSchedBgintHandler)(void *); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSchedBgintReg + * + * DESCRIPTION + * Register a background interrupt handler function with the scheduler. + * When CsrSchedBgint() is called from the foreground (e.g. an interrupt + * routine) the registered function is called. + * + * If "cb" is null then the interrupt is effectively disabled. If a + * no bgints are available, CSR_SCHED_BGINT_INVALID is returned, otherwise + * a CsrSchedBgint value is returned to be used in subsequent calls to + * CsrSchedBgint(). id is a possibly NULL identifier used for logging + * purposes only. + * + * RETURNS + * CsrSchedBgint -- CSR_SCHED_BGINT_INVALID denotes failure to obtain a CsrSchedBgintSet. + * + *----------------------------------------------------------------------------*/ +CsrSchedBgint CsrSchedBgintReg(CsrSchedBgintHandler cb, + void *context, + const CsrCharString *id); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSchedBgintUnreg + * + * DESCRIPTION + * Unregister a background interrupt handler function. + * + * ``irq'' is a background interrupt handle previously obtained + * from a call to CsrSchedBgintReg(). + * + * RETURNS + * void. + * + *----------------------------------------------------------------------------*/ +void CsrSchedBgintUnreg(CsrSchedBgint bgint); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSchedBgintSet + * + * DESCRIPTION + * Set background interrupt. + * + * RETURNS + * void. + * + *----------------------------------------------------------------------------*/ +void CsrSchedBgintSet(CsrSchedBgint bgint); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSchedMessagePut + * + * DESCRIPTION + * Sends a message consisting of the integer "mi" and the void * pointer + * "mv" to the message queue "q". + * + * "mi" and "mv" are neither inspected nor changed by the scheduler - the + * task that owns "q" is expected to make sense of the values. "mv" may + * be null. + * + * NOTE + * If "mv" is not null then it will typically be a chunk of CsrPmemAlloc()ed + * memory, though there is no need for it to be so. Tasks should normally + * obey the convention that when a message built with CsrPmemAlloc()ed memory + * is given to CsrSchedMessagePut() then ownership of the memory is ceded to the + * scheduler - and eventually to the recipient task. I.e., the receiver of + * the message will be expected to CsrPmemFree() the message storage. + * + * RETURNS + * void. + * + *----------------------------------------------------------------------------*/ +#if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER) +void CsrSchedMessagePutStringLog(CsrSchedQid q, + CsrUint16 mi, + void *mv, + CsrUint32 line, + const CsrCharString *file); +#define CsrSchedMessagePut(q, mi, mv) CsrSchedMessagePutStringLog((q), (mi), (mv), __LINE__, __FILE__) +#else +void CsrSchedMessagePut(CsrSchedQid q, + CsrUint16 mi, + void *mv); +#endif + +/*----------------------------------------------------------------------------* + * NAME + * CsrSchedMessageBroadcast + * + * DESCRIPTION + * Sends a message to all tasks. + * + * The user must supply a "factory function" that is called once + * for every task that exists. The "factory function", msg_build_func, + * must allocate and initialise the message and set the msg_build_ptr + * to point to the message when done. + * + * NOTE + * N/A + * + * RETURNS + * void + * + *----------------------------------------------------------------------------*/ +#if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER) +void CsrSchedMessageBroadcastStringLog(CsrUint16 mi, + void *(*msg_build_func)(void *), + void *msg_build_ptr, + CsrUint32 line, + const CsrCharString *file); +#define CsrSchedMessageBroadcast(mi, fn, ptr) CsrSchedMessageBroadcastStringLog((mi), (fn), (ptr), __LINE__, __FILE__) +#else +void CsrSchedMessageBroadcast(CsrUint16 mi, + void *(*msg_build_func)(void *), + void *msg_build_ptr); +#endif + +/*----------------------------------------------------------------------------* + * NAME + * CsrSchedMessageGet + * + * DESCRIPTION + * Obtains a message from the message queue belonging to the calling task. + * The message consists of one or both of a CsrUint16 and a void *. + * + * RETURNS + * CsrBool - TRUE if a message has been obtained from the queue, else FALSE. + * If a message is taken from the queue, then "*pmi" and "*pmv" are set to + * the "mi" and "mv" passed to CsrSchedMessagePut() respectively. + * + * "pmi" and "pmv" can be null, in which case the corresponding value from + * them message is discarded. + * + *----------------------------------------------------------------------------*/ +CsrBool CsrSchedMessageGet(CsrUint16 *pmi, void **pmv); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSchedTimerSet + * + * DESCRIPTION + * Causes the void function "fn" to be called with the arguments + * "fniarg" and "fnvarg" after "delay" has elapsed. + * + * "delay" must be less than half the range of a CsrTime. + * + * CsrSchedTimerSet() does nothing with "fniarg" and "fnvarg" except + * deliver them via a call to "fn()". (Unless CsrSchedTimerCancel() + * is used to prevent delivery.) + * + * NOTE + * The function will be called at or after "delay"; the actual delay will + * depend on the timing behaviour of the scheduler's tasks. + * + * RETURNS + * CsrSchedTid - A timed event identifier, can be used in CsrSchedTimerCancel(). + * + *----------------------------------------------------------------------------*/ +#if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER) +CsrSchedTid CsrSchedTimerSetStringLog(CsrTime delay, + void (*fn)(CsrUint16 mi, void *mv), + CsrUint16 fniarg, + void *fnvarg, + CsrUint32 line, + const CsrCharString *file); +#define CsrSchedTimerSet(d, fn, fni, fnv) CsrSchedTimerSetStringLog((d), (fn), (fni), (fnv), __LINE__, __FILE__) +#else +CsrSchedTid CsrSchedTimerSet(CsrTime delay, + void (*fn)(CsrUint16 mi, void *mv), + CsrUint16 fniarg, + void *fnvarg); +#endif + +/*----------------------------------------------------------------------------* + * NAME + * CsrSchedTimerCancel + * + * DESCRIPTION + * Attempts to prevent the timed event with identifier "eventid" from + * occurring. + * + * RETURNS + * CsrBool - TRUE if cancelled, FALSE if the event has already occurred. + * + *----------------------------------------------------------------------------*/ +#if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER) +CsrBool CsrSchedTimerCancelStringLog(CsrSchedTid eventid, + CsrUint16 *pmi, + void **pmv, + CsrUint32 line, + const CsrCharString *file); +#define CsrSchedTimerCancel(e, pmi, pmv) CsrSchedTimerCancelStringLog((e), (pmi), (pmv), __LINE__, __FILE__) +#else +CsrBool CsrSchedTimerCancel(CsrSchedTid eventid, + CsrUint16 *pmi, + void **pmv); +#endif + +/*----------------------------------------------------------------------------* + * NAME + * CsrSchedTaskQueueGet + * + * DESCRIPTION + * Return the queue identifier for the currently running queue + * + * RETURNS + * CsrSchedQid - The current task queue identifier, or 0xFFFF if not available. + * + *----------------------------------------------------------------------------*/ +CsrSchedQid CsrSchedTaskQueueGet(void); + + +/*----------------------------------------------------------------------------* + * NAME + * CsrSchedTaskQueueGet + * + * DESCRIPTION + * Return the queue identifier for the currently running queue + * + * RETURNS + * CsrCharString - The current task queue identifier, or 0xFFFF if not available. + * + *----------------------------------------------------------------------------*/ +CsrCharString* CsrSchedTaskNameGet(CsrSchedQid ); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/drivers/staging/csr/csr_sdio.h b/drivers/staging/csr/csr_sdio.h new file mode 100644 index 0000000..d60ef45 --- /dev/null +++ b/drivers/staging/csr/csr_sdio.h @@ -0,0 +1,732 @@ +#ifndef CSR_SDIO_H__ +#define CSR_SDIO_H__ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#include "csr_types.h" +#include "csr_result.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Result Codes */ +#define CSR_SDIO_RESULT_INVALID_VALUE ((CsrResult) 1) /* Invalid argument value */ +#define CSR_SDIO_RESULT_NO_DEVICE ((CsrResult) 2) /* The specified device is no longer present */ +#define CSR_SDIO_RESULT_CRC_ERROR ((CsrResult) 3) /* The transmitted/received data or command response contained a CRC error */ +#define CSR_SDIO_RESULT_TIMEOUT ((CsrResult) 4) /* No command response or data received from device, or function enable/disable did not succeed within timeout period */ +#define CSR_SDIO_RESULT_NOT_RESET ((CsrResult) 5) /* The device was not reset */ + +/* Features (for use in features member of CsrSdioFunction) */ +#define CSR_SDIO_FEATURE_BYTE_MODE 0x00000001 /* Transfer sizes do not have to be a multiple of block size */ +#define CSR_SDIO_FEATURE_DMA_CAPABLE_MEM_REQUIRED 0x00000002 /* Bulk operations require DMA friendly memory */ + +/* CsrSdioFunctionId wildcards (for use in CsrSdioFunctionId members) */ +#define CSR_SDIO_ANY_MANF_ID 0xFFFF +#define CSR_SDIO_ANY_CARD_ID 0xFFFF +#define CSR_SDIO_ANY_SDIO_FUNCTION 0xFF +#define CSR_SDIO_ANY_SDIO_INTERFACE 0xFF + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioFunctionId + * + * DESCRIPTION + * This structure describes one or more functions of a device, based on + * four qualitative measures. The CsrSdioFunctionId wildcard defines can be + * used for making the CsrSdioFunctionId match more than one function. + * + * MEMBERS + * manfId - Vendor ID (or CSR_SDIO_ANY_MANF_ID). + * cardId - Device ID (or CSR_SDIO_ANY_CARD_ID). + * sdioFunction - SDIO Function number (or CSR_SDIO_ANY_SDIO_FUNCTION). + * sdioInterface - SDIO Standard Interface Code (or CSR_SDIO_ANY_SDIO_INTERFACE) + * + *----------------------------------------------------------------------------*/ +typedef struct +{ + CsrUint16 manfId; /* Vendor ID to match or CSR_SDIO_ANY_MANF_ID */ + CsrUint16 cardId; /* Device ID to match or CSR_SDIO_ANY_CARD_ID */ + CsrUint8 sdioFunction; /* SDIO Function number to match or CSR_SDIO_ANY_SDIO_FUNCTION */ + CsrUint8 sdioInterface; /* SDIO Standard Interface Code to match or CSR_SDIO_ANY_SDIO_INTERFACE */ +} CsrSdioFunctionId; + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioFunction + * + * DESCRIPTION + * This structure represents a single function on a device. + * + * MEMBERS + * sdioId - A CsrSdioFunctionId describing this particular function. The + * subfield shall not contain any CsrSdioFunctionId wildcards. The + * subfields shall describe the specific single function + * represented by this structure. + * blockSize - Actual configured block size, or 0 if unconfigured. + * features - Bit mask with any of CSR_SDIO_FEATURE_* set. + * device - Handle of device containing the function. If two functions have + * the same device handle, they reside on the same device. + * driverData - For use by the Function Driver. The SDIO Driver shall not + * attempt to dereference the pointer. + * priv - For use by the SDIO Driver. The Function Driver shall not attempt + * to dereference the pointer. + * + * + *----------------------------------------------------------------------------*/ +typedef struct +{ + CsrSdioFunctionId sdioId; + CsrUint16 blockSize; /* Actual configured block size, or 0 if unconfigured */ + CsrUint32 features; /* Bit mask with any of CSR_SDIO_FEATURE_* set */ + void *device; /* Handle of device containing the function */ + void *driverData; /* For use by the Function Driver */ + void *priv; /* For use by the SDIO Driver */ +} CsrSdioFunction; + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioInsertedCallback, CsrSdioRemovedCallback + * + * DESCRIPTION + * CsrSdioInsertedCallback is called when a function becomes available to + * a registered Function Driver that supports the function. + * CsrSdioRemovedCallback is called when a function is no longer available + * to a Function Driver, either because the device has been removed, or the + * Function Driver has been unregistered. + * + * NOTE: These functions are implemented by the Function Driver, and are + * passed as function pointers in the CsrSdioFunctionDriver struct. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * + *----------------------------------------------------------------------------*/ +typedef void (*CsrSdioInsertedCallback)(CsrSdioFunction *function); +typedef void (*CsrSdioRemovedCallback)(CsrSdioFunction *function); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioInterruptDsrCallback, CsrSdioInterruptCallback + * + * DESCRIPTION + * CsrSdioInterruptCallback is called when an interrupt occurs on the + * the device associated with the specified function. + * + * NOTE: These functions are implemented by the Function Driver, and are + * passed as function pointers in the CsrSdioFunctionDriver struct. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * + * RETURNS (only CsrSdioInterruptCallback) + * A pointer to a CsrSdioInterruptDsrCallback function. + * + *----------------------------------------------------------------------------*/ +typedef void (*CsrSdioInterruptDsrCallback)(CsrSdioFunction *function); +typedef CsrSdioInterruptDsrCallback (*CsrSdioInterruptCallback)(CsrSdioFunction *function); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioSuspendCallback, CsrSdioResumeCallback + * + * DESCRIPTION + * CsrSdioSuspendCallback is called when the system is preparing to go + * into a suspended state. CsrSdioResumeCallback is called when the system + * has entered an active state again. + * + * NOTE: These functions are implemented by the Function Driver, and are + * passed as function pointers in the CsrSdioFunctionDriver struct. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * + *----------------------------------------------------------------------------*/ +typedef void (*CsrSdioSuspendCallback)(CsrSdioFunction *function); +typedef void (*CsrSdioResumeCallback)(CsrSdioFunction *function); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioAsyncCallback, CsrSdioAsyncDsrCallback + * + * DESCRIPTION + * CsrSdioAsyncCallback is called when an asynchronous operation completes. + * + * NOTE: These functions are implemented by the Function Driver, and are + * passed as function pointers in the function calls that initiate + * the operation. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * result - The result of the operation that completed. See the description + * of the initiating function for possible result values. + * + * RETURNS (only CsrSdioAsyncCallback) + * A pointer to a CsrSdioAsyncDsrCallback function. + * + *----------------------------------------------------------------------------*/ +typedef void (*CsrSdioAsyncDsrCallback)(CsrSdioFunction *function, CsrResult result); +typedef CsrSdioAsyncDsrCallback (*CsrSdioAsyncCallback)(CsrSdioFunction *function, CsrResult result); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioFunctionDriver + * + * DESCRIPTION + * Structure representing a Function Driver. + * + * MEMBERS + * inserted - Callback, see description of CsrSdioInsertedCallback. + * removed - Callback, see description of CsrSdioRemovedCallback. + * intr - Callback, see description of CsrSdioInterruptCallback. + * suspend - Callback, see description of CsrSdioSuspendCallback. + * resume - Callback, see description of CsrSdioResumeCallback. + * ids - Array of CsrSdioFunctionId describing one or more functions that + * are supported by the Function Driver. + * idsCount - Length of the ids array. + * priv - For use by the SDIO Driver. The Function Driver may initialise + * it to NULL, but shall otherwise not access the pointer or attempt + * to dereference it. + * + *----------------------------------------------------------------------------*/ +typedef struct +{ + CsrSdioInsertedCallback inserted; + CsrSdioRemovedCallback removed; + CsrSdioInterruptCallback intr; + CsrSdioSuspendCallback suspend; + CsrSdioResumeCallback resume; + CsrSdioFunctionId *ids; + CsrUint8 idsCount; + void *priv; /* For use by the SDIO Driver */ +} CsrSdioFunctionDriver; + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioFunctionDriverRegister + * + * DESCRIPTION + * Register a Function Driver. + * + * PARAMETERS + * functionDriver - Pointer to struct describing the Function Driver. + * + * RETURNS + * CSR_RESULT_SUCCESS - The Function Driver was successfully + * registered. + * CSR_RESULT_FAILURE - Unable to register the function driver, + * because of an unspecified/unknown error. The + * Function Driver has not been registered. + * CSR_SDIO_RESULT_INVALID_VALUE - The specified Function Driver pointer + * does not point at a valid Function + * Driver structure, or some of the members + * contain invalid entries. + * + *----------------------------------------------------------------------------*/ +CsrResult CsrSdioFunctionDriverRegister(CsrSdioFunctionDriver *functionDriver); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioFunctionDriverUnregister + * + * DESCRIPTION + * Unregister a previously registered Function Driver. + * + * PARAMETERS + * functionDriver - pointer to struct describing the Function Driver. + * + *----------------------------------------------------------------------------*/ +void CsrSdioFunctionDriverUnregister(CsrSdioFunctionDriver *functionDriver); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioFunctionEnable, CsrSdioFunctionDisable + * + * DESCRIPTION + * Enable/disable the specified function by setting/clearing the + * corresponding bit in the I/O Enable register in function 0, and then + * periodically reading the related bit in the I/O Ready register until it + * is set/clear, limited by an implementation defined timeout. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * + * RETURNS + * CSR_RESULT_SUCCESS - The specified function was enabled/disabled. + * CSR_RESULT_FAILURE - Unspecified/unknown error. + * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. + * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. The state of the + * related bit in the I/O Enable register is + * undefined. + * CSR_SDIO_RESULT_TIMEOUT - No response from the device, or the related + * bit in the I/O ready register was not + * set/cleared within the timeout period. + * + * NOTE: If the SDIO R5 response is available, and either of the + * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit + * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), + * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and + * COM_CRC_ERROR bits shall be ignored. + * + * If the CSPI response is available, and any of the + * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE will be returned. + * + *----------------------------------------------------------------------------*/ +CsrResult CsrSdioFunctionEnable(CsrSdioFunction *function); +CsrResult CsrSdioFunctionDisable(CsrSdioFunction *function); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioInterruptEnable, CsrSdioInterruptDisable + * + * DESCRIPTION + * Enable/disable the interrupt for the specified function by + * setting/clearing the corresponding bit in the INT Enable register in + * function 0. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * + * RETURNS + * CSR_RESULT_SUCCESS - The specified function was enabled/disabled. + * CSR_RESULT_FAILURE - Unspecified/unknown error. + * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. + * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. The state of the + * related bit in the INT Enable register is + * unchanged. + * CSR_SDIO_RESULT_INVALID_VALUE - The specified function cannot be + * enabled/disabled, because it either + * does not exist or it is not possible to + * individually enable/disable functions. + * CSR_SDIO_RESULT_TIMEOUT - No response from the device. + * + * NOTE: If the SDIO R5 response is available, and either of the + * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit + * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), + * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and + * COM_CRC_ERROR bits shall be ignored. + * + * If the CSPI response is available, and any of the + * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE will be returned. + * + *----------------------------------------------------------------------------*/ +CsrResult CsrSdioInterruptEnable(CsrSdioFunction *function); +CsrResult CsrSdioInterruptDisable(CsrSdioFunction *function); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioInterruptAcknowledge + * + * DESCRIPTION + * Acknowledge that a signalled interrupt has been handled. Shall only + * be called once, and exactly once for each signalled interrupt to the + * corresponding function. + * + * PARAMETERS + * function - Pointer to struct representing the function to which the + * event was signalled. + * + *----------------------------------------------------------------------------*/ +void CsrSdioInterruptAcknowledge(CsrSdioFunction *function); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioInsertedAcknowledge, CsrSdioRemovedAcknowledge + * + * DESCRIPTION + * Acknowledge that a signalled inserted/removed event has been handled. + * Shall only be called once, and exactly once for each signalled event to + * the corresponding function. + * + * PARAMETERS + * function - Pointer to struct representing the function to which the + * inserted was signalled. + * result (CsrSdioInsertedAcknowledge only) + * CSR_RESULT_SUCCESS - The Function Driver has accepted the + * function, and the function is attached to + * the Function Driver until the + * CsrSdioRemovedCallback is called and + * acknowledged. + * CSR_RESULT_FAILURE - Unable to accept the function. The + * function is not attached to the Function + * Driver, and it may be passed to another + * Function Driver which supports the + * function. + * + *----------------------------------------------------------------------------*/ +void CsrSdioInsertedAcknowledge(CsrSdioFunction *function, CsrResult result); +void CsrSdioRemovedAcknowledge(CsrSdioFunction *function); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioSuspendAcknowledge, CsrSdioResumeAcknowledge + * + * DESCRIPTION + * Acknowledge that a signalled suspend event has been handled. Shall only + * be called once, and exactly once for each signalled event to the + * corresponding function. + * + * PARAMETERS + * function - Pointer to struct representing the function to which the + * event was signalled. + * result + * CSR_RESULT_SUCCESS - Successfully suspended/resumed. + * CSR_RESULT_FAILURE - Unspecified/unknown error. + * + *----------------------------------------------------------------------------*/ +void CsrSdioSuspendAcknowledge(CsrSdioFunction *function, CsrResult result); +void CsrSdioResumeAcknowledge(CsrSdioFunction *function, CsrResult result); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioBlockSizeSet + * + * DESCRIPTION + * Set the block size to use for the function. The actual configured block + * size shall be the minimum of: + * 1) Maximum block size supported by the function. + * 2) Maximum block size supported by the host controller. + * 3) The block size specified by the blockSize argument. + * + * When this function returns, the actual configured block size is + * available in the blockSize member of the function struct. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * blockSize - Block size to use for the function. Valid range is 1 to + * 2048. + * + * RETURNS + * CSR_RESULT_SUCCESS - The block size register on the chip + * was updated. + * CSR_RESULT_FAILURE - Unspecified/unknown error. + * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. + * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. + * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. The configured block + * size is undefined. + * CSR_SDIO_RESULT_TIMEOUT - No response from the device. + * + * NOTE: If the SDIO R5 response is available, and the FUNCTION_NUMBER + * bits is set, CSR_SDIO_RESULT_INVALID_VALUE shall be returned. + * If the ERROR bit is set (but not FUNCTION_NUMBER), + * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and + * COM_CRC_ERROR bits shall be ignored. + * + * If the CSPI response is available, and any of the + * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE will be returned. + * + * NOTE: Setting the block size requires two individual operations. The + * implementation shall ignore the OUT_OF_RANGE bit of the SDIO R5 + * response for the first operation, as the partially configured + * block size may be out of range, even if the final block size + * (after the second operation) is in the valid range. + * + *----------------------------------------------------------------------------*/ +CsrResult CsrSdioBlockSizeSet(CsrSdioFunction *function, CsrUint16 blockSize); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioMaxBusClockFrequencySet + * + * DESCRIPTION + * Set the maximum clock frequency to use for the device associated with + * the specified function. The actual configured clock frequency for the + * device shall be the minimum of: + * 1) Maximum clock frequency supported by the device. + * 2) Maximum clock frequency supported by the host controller. + * 3) Maximum clock frequency specified for any function on the same + * device. + * + * If the clock frequency exceeds 25MHz, it is the responsibility of the + * SDIO driver to enable high speed mode on the device, using the standard + * defined procedure, before increasing the frequency beyond the limit. + * + * Note that the clock frequency configured affects all functions on the + * same device. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * maxFrequency - The maximum clock frequency for the function in Hertz. + * + * RETURNS + * CSR_RESULT_SUCCESS - The maximum clock frequency was succesfully + * set for the function. + * CSR_RESULT_FAILURE - Unspecified/unknown error. + * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. + * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. + * + * NOTE: If the SDIO R5 response is available, and the FUNCTION_NUMBER + * bits is set, CSR_SDIO_RESULT_INVALID_VALUE shall be returned. + * If the ERROR bit is set (but not FUNCTION_NUMBER), + * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and + * COM_CRC_ERROR bits shall be ignored. + * + * If the CSPI response is available, and any of the + * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE will be returned. + * + * + *----------------------------------------------------------------------------*/ +CsrResult CsrSdioMaxBusClockFrequencySet(CsrSdioFunction *function, CsrUint32 maxFrequency); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioRead8, CsrSdioWrite8, CsrSdioRead8Async, CsrSdioWrite8Async + * + * DESCRIPTION + * Read/write an 8bit value from/to the specified register address. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * address - Register address within the function. + * data - The data to read/write. + * callback - The function to call on operation completion. + * + * RETURNS + * CSR_RESULT_SUCCESS - The data was successfully read/written. + * CSR_RESULT_FAILURE - Unspecified/unknown error. + * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. + * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. + * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. No data read/written. + * CSR_SDIO_RESULT_TIMEOUT - No response from the device. + * + * NOTE: If the SDIO R5 response is available, and either of the + * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit + * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), + * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and + * COM_CRC_ERROR bits shall be ignored. + * + * If the CSPI response is available, and any of the + * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE will be returned. + * + * NOTE: The CsrSdioRead8Async and CsrSdioWrite8Async functions return + * immediately, and the supplied callback function is called when the + * operation is complete. The result value is given as an argument to + * the callback function. + * + *----------------------------------------------------------------------------*/ +CsrResult CsrSdioRead8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data); +CsrResult CsrSdioWrite8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data); +void CsrSdioRead8Async(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data, CsrSdioAsyncCallback callback); +void CsrSdioWrite8Async(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data, CsrSdioAsyncCallback callback); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioRead16, CsrSdioWrite16, CsrSdioRead16Async, CsrSdioWrite16Async + * + * DESCRIPTION + * Read/write a 16bit value from/to the specified register address. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * address - Register address within the function. + * data - The data to read/write. + * callback - The function to call on operation completion. + * + * RETURNS + * CSR_RESULT_SUCCESS - The data was successfully read/written. + * CSR_RESULT_FAILURE - Unspecified/unknown error. + * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. + * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. + * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. Data may have been + * partially read/written. + * CSR_SDIO_RESULT_TIMEOUT - No response from the device. + * + * NOTE: If the SDIO R5 response is available, and either of the + * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit + * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), + * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and + * COM_CRC_ERROR bits shall be ignored. + * + * If the CSPI response is available, and any of the + * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE will be returned. + * + * NOTE: The CsrSdioRead16Async and CsrSdioWrite16Async functions return + * immediately, and the supplied callback function is called when the + * operation is complete. The result value is given as an argument to + * the callback function. + * + *----------------------------------------------------------------------------*/ +CsrResult CsrSdioRead16(CsrSdioFunction *function, CsrUint32 address, CsrUint16 *data); +CsrResult CsrSdioWrite16(CsrSdioFunction *function, CsrUint32 address, CsrUint16 data); +void CsrSdioRead16Async(CsrSdioFunction *function, CsrUint32 address, CsrUint16 *data, CsrSdioAsyncCallback callback); +void CsrSdioWrite16Async(CsrSdioFunction *function, CsrUint32 address, CsrUint16 data, CsrSdioAsyncCallback callback); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioF0Read8, CsrSdioF0Write8, CsrSdioF0Read8Async, + * CsrSdioF0Write8Async + * + * DESCRIPTION + * Read/write an 8bit value from/to the specified register address in + * function 0. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * address - Register address within the function. + * data - The data to read/write. + * callback - The function to call on operation completion. + * + * RETURNS + * CSR_RESULT_SUCCESS - The data was successfully read/written. + * CSR_RESULT_FAILURE - Unspecified/unknown error. + * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. + * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. + * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. No data read/written. + * CSR_SDIO_RESULT_TIMEOUT - No response from the device. + * + * NOTE: If the SDIO R5 response is available, and either of the + * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit + * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), + * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and + * COM_CRC_ERROR bits shall be ignored. + * + * If the CSPI response is available, and any of the + * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE will be returned. + * + * NOTE: The CsrSdioF0Read8Async and CsrSdioF0Write8Async functions return + * immediately, and the supplied callback function is called when the + * operation is complete. The result value is given as an argument to + * the callback function. + * + *----------------------------------------------------------------------------*/ +CsrResult CsrSdioF0Read8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data); +CsrResult CsrSdioF0Write8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data); +void CsrSdioF0Read8Async(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data, CsrSdioAsyncCallback callback); +void CsrSdioF0Write8Async(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data, CsrSdioAsyncCallback callback); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioRead, CsrSdioWrite, CsrSdioReadAsync, CsrSdioWriteAsync + * + * DESCRIPTION + * Read/write a specified number of bytes from/to the specified register + * address. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * address - Register address within the function. + * data - The data to read/write. + * length - Number of byte to read/write. + * callback - The function to call on operation completion. + * + * RETURNS + * CSR_RESULT_SUCCESS - The data was successfully read/written. + * CSR_RESULT_FAILURE - Unspecified/unknown error. + * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. + * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. + * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. Data may have been + * partially read/written. + * CSR_SDIO_RESULT_TIMEOUT - No response from the device. + * + * NOTE: If the SDIO R5 response is available, and either of the + * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit + * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), + * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and + * COM_CRC_ERROR bits shall be ignored. + * + * If the CSPI response is available, and any of the + * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE will be returned. + * + * NOTE: The CsrSdioF0Read8Async and CsrSdioF0Write8Async functions return + * immediately, and the supplied callback function is called when the + * operation is complete. The result value is given as an argument to + * the callback function. + * + *----------------------------------------------------------------------------*/ +CsrResult CsrSdioRead(CsrSdioFunction *function, CsrUint32 address, void *data, CsrUint32 length); +CsrResult CsrSdioWrite(CsrSdioFunction *function, CsrUint32 address, const void *data, CsrUint32 length); +void CsrSdioReadAsync(CsrSdioFunction *function, CsrUint32 address, void *data, CsrUint32 length, CsrSdioAsyncCallback callback); +void CsrSdioWriteAsync(CsrSdioFunction *function, CsrUint32 address, const void *data, CsrUint32 length, CsrSdioAsyncCallback callback); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioPowerOn, CsrSdioPowerOff + * + * DESCRIPTION + * Power on/off the device. + * + * PARAMETERS + * function - Pointer to struct representing the function that resides on + * the device to power on/off. + * + * RETURNS (only CsrSdioPowerOn) + * CSR_RESULT_SUCCESS - Power was succesfully reapplied and the device + * has been reinitialised. + * CSR_RESULT_FAILURE - Unspecified/unknown error. + * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. + * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured during reinitialisation. + * CSR_SDIO_RESULT_TIMEOUT - No response from the device during + * reinitialisation. + * CSR_SDIO_RESULT_NOT_RESET - The power was not removed by the + * CsrSdioPowerOff call. The state of the + * device is unchanged. + * + *----------------------------------------------------------------------------*/ +CsrResult CsrSdioPowerOn(CsrSdioFunction *function); +void CsrSdioPowerOff(CsrSdioFunction *function); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioHardReset + * + * DESCRIPTION + * Perform a hardware reset of the device. + * + * PARAMETERS + * function - Pointer to struct representing the function that resides on + * the device to hard reset. + * + * RETURNS + * CSR_RESULT_SUCCESS - Reset was succesfully performed and the device + * has been reinitialised. + * CSR_RESULT_FAILURE - Unspecified/unknown error. + * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. + * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured during reinitialisation. + * CSR_SDIO_RESULT_TIMEOUT - No response from the device during + * reinitialisation. + * CSR_SDIO_RESULT_NOT_RESET - The reset was not applied because it is not + * supported. The state of the device is + * unchanged. + * + *----------------------------------------------------------------------------*/ +CsrResult CsrSdioHardReset(CsrSdioFunction *function); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioFunctionActive, CsrSdioFunctionIdle + * + * DESCRIPTION + * + * PARAMETERS + * function - Pointer to struct representing the function. + * + *----------------------------------------------------------------------------*/ +void CsrSdioFunctionActive(CsrSdioFunction *function); +void CsrSdioFunctionIdle(CsrSdioFunction *function); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/drivers/staging/csr/csr_serialize_primitive_types.c b/drivers/staging/csr/csr_serialize_primitive_types.c new file mode 100644 index 0000000..5ea06fc --- /dev/null +++ b/drivers/staging/csr/csr_serialize_primitive_types.c @@ -0,0 +1,472 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#include +#include "csr_types.h" +#include "csr_prim_defs.h" +#include "csr_msgconv.h" +#include "csr_util.h" +#include "csr_pmem.h" +#include "csr_lib.h" + +void CsrUint8Des(CsrUint8 *value, CsrUint8 *buffer, CsrSize *offset) +{ + *value = buffer[*offset]; + *offset += sizeof(*value); +} +EXPORT_SYMBOL_GPL(CsrUint8Des); + +void CsrUint16Des(CsrUint16 *value, CsrUint8 *buffer, CsrSize *offset) +{ + *value = (buffer[*offset + 0] << 0) | + (buffer[*offset + 1] << 8); + *offset += sizeof(*value); +} +EXPORT_SYMBOL_GPL(CsrUint16Des); + +void CsrUint32Des(CsrUint32 *value, CsrUint8 *buffer, CsrSize *offset) +{ + *value = (buffer[*offset + 0] << 0) | + (buffer[*offset + 1] << 8) | + (buffer[*offset + 2] << 16) | + (buffer[*offset + 3] << 24); + *offset += sizeof(*value); +} +EXPORT_SYMBOL_GPL(CsrUint32Des); + +void CsrMemCpyDes(void *value, CsrUint8 *buffer, CsrSize *offset, CsrSize length) +{ + CsrMemCpy(value, &buffer[*offset], length); + *offset += length; +} +EXPORT_SYMBOL_GPL(CsrMemCpyDes); + +void CsrCharStringDes(CsrCharString **value, CsrUint8 *buffer, CsrSize *offset) +{ + *value = CsrStrDup((CsrCharString *) &buffer[*offset]); + *offset += CsrStrLen(*value) + 1; +} +EXPORT_SYMBOL_GPL(CsrCharStringDes); + +void CsrUtf8StringDes(CsrUtf8String **value, CsrUint8 *buffer, CsrSize *offset) +{ + *value = (CsrUtf8String *) CsrStrDup((CsrCharString *) &buffer[*offset]); + *offset += CsrStrLen((CsrCharString *) *value) + 1; +} + +void CsrUtf16StringDes(CsrUtf16String **value, CsrUint8 *buffer, CsrSize *offset) +{ + CsrUint32 length, i; + + CsrUint32Des(&length, buffer, offset); + + *value = CsrPmemAlloc(length * sizeof(**value)); + for (i = 0; i < length; i++) + { + CsrUint16Des(&(*value)[i], buffer, offset); + } +} + +void CsrSizeDes(CsrSize *value, CsrUint8 *buffer, CsrSize *offset) +{ + *value = (buffer[*offset + 0] << 0) | + (buffer[*offset + 1] << 8) | + (buffer[*offset + 2] << 16) | + (buffer[*offset + 3] << 24); + *offset += sizeof(*value); +} + +void CsrVoidPtrDes(void **value, CsrUint8 *buffer, CsrSize *offset) +{ + CsrSizeDes((CsrSize *) value, buffer, offset); +} + +void CsrUint8Ser(CsrUint8 *buffer, CsrSize *offset, CsrUint8 value) +{ + buffer[*offset] = value; + *offset += sizeof(value); +} +EXPORT_SYMBOL_GPL(CsrUint8Ser); + +void CsrUint16Ser(CsrUint8 *buffer, CsrSize *offset, CsrUint16 value) +{ + buffer[*offset + 0] = (CsrUint8) ((value >> 0) & 0xFF); + buffer[*offset + 1] = (CsrUint8) ((value >> 8) & 0xFF); + *offset += sizeof(value); +} +EXPORT_SYMBOL_GPL(CsrUint16Ser); + +void CsrUint32Ser(CsrUint8 *buffer, CsrSize *offset, CsrUint32 value) +{ + buffer[*offset + 0] = (CsrUint8) ((value >> 0) & 0xFF); + buffer[*offset + 1] = (CsrUint8) ((value >> 8) & 0xFF); + buffer[*offset + 2] = (CsrUint8) ((value >> 16) & 0xFF); + buffer[*offset + 3] = (CsrUint8) ((value >> 24) & 0xFF); + *offset += sizeof(value); +} +EXPORT_SYMBOL_GPL(CsrUint32Ser); + +void CsrMemCpySer(CsrUint8 *buffer, CsrSize *offset, const void *value, CsrSize length) +{ + CsrMemCpy(&buffer[*offset], value, length); + *offset += length; +} +EXPORT_SYMBOL_GPL(CsrMemCpySer); + +void CsrCharStringSer(CsrUint8 *buffer, CsrSize *offset, const CsrCharString *value) +{ + if (value) + { + CsrStrCpy(((CsrCharString *) &buffer[*offset]), value); + *offset += CsrStrLen(value) + 1; + } + else + { + CsrUint8Ser(buffer, offset, 0); + } +} +EXPORT_SYMBOL_GPL(CsrCharStringSer); + +void CsrUtf8StringSer(CsrUint8 *buffer, CsrSize *offset, const CsrUtf8String *value) +{ + CsrCharStringSer(buffer, offset, (CsrCharString *) value); +} + +void CsrUtf16StringSer(CsrUint8 *buffer, CsrSize *offset, const CsrUtf16String *value) +{ + if (value) + { + CsrUint32 length = CsrUtf16StrLen(value) + 1; + CsrUint32 i; + + CsrUint32Ser(buffer, offset, length); + + for (i = 0; i < length; i++) + { + CsrUint16Ser(buffer, offset, (CsrUint16) value[i]); + } + } + else + { + CsrUint32Ser(buffer, offset, 0); + } +} + +void CsrSizeSer(CsrUint8 *buffer, CsrSize *offset, CsrSize value) +{ + buffer[*offset + 0] = (CsrUint8) ((value >> 0) & 0xFF); + buffer[*offset + 1] = (CsrUint8) ((value >> 8) & 0xFF); + buffer[*offset + 2] = (CsrUint8) ((value >> 16) & 0xFF); + buffer[*offset + 3] = (CsrUint8) ((value >> 24) & 0xFF); + *offset += sizeof(value); +} + +void CsrVoidPtrSer(CsrUint8 *buffer, CsrSize *offset, void *ptr) +{ + CsrSizeSer(buffer, offset, (CsrSize) ptr); +} + +CsrUint32 CsrCharStringSerLen(const CsrCharString *str) +{ + if (str) + { + return (CsrUint32) (CsrStrLen(str) + sizeof(*str)); + } + else + { + return sizeof(*str); + } +} + +CsrUint32 CsrUtf8StringSerLen(const CsrUtf8String *str) +{ + if (str) + { + return (CsrUint32) (CsrStrLen((CsrCharString *) str) + sizeof(*str)); + } + else + { + return sizeof(*str); + } +} + +CsrUint32 CsrUtf16StringSerLen(const CsrUtf16String *str) +{ + if (str) + { + /* We always write down the length of the string */ + return sizeof(CsrUint32) + (CsrUtf16StrLen(str) + 1) * sizeof(*str); + } + else + { + return sizeof(CsrUint32); + } +} + +CsrSize CsrEventSizeof(void *msg) +{ + return 2; +} + +CsrUint8 *CsrEventSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrEvent *primitive = (CsrEvent *) msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->type); + return ptr; +} + +void *CsrEventDes(CsrUint8 *buffer, CsrSize length) +{ + CsrEvent *primitive = (CsrEvent *) CsrPmemAlloc(sizeof(CsrEvent)); + CsrSize offset = 0; + CsrUint16Des(&primitive->type, buffer, &offset); + + return primitive; +} + +CsrSize CsrEventCsrUint8Sizeof(void *msg) +{ + return 3; +} + +CsrUint8 *CsrEventCsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrEventCsrUint8 *primitive = (CsrEventCsrUint8 *) msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->type); + CsrUint8Ser(ptr, len, primitive->value); + return ptr; +} + +void *CsrEventCsrUint8Des(CsrUint8 *buffer, CsrSize length) +{ + CsrEventCsrUint8 *primitive = (CsrEventCsrUint8 *) CsrPmemAlloc(sizeof(CsrEventCsrUint8)); + + CsrSize offset = 0; + CsrUint16Des(&primitive->type, buffer, &offset); + CsrUint8Des(&primitive->value, buffer, &offset); + + return primitive; +} + +CsrSize CsrEventCsrUint16Sizeof(void *msg) +{ + return 4; +} + +CsrUint8 *CsrEventCsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrEventCsrUint16 *primitive = (CsrEventCsrUint16 *) msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->type); + CsrUint16Ser(ptr, len, primitive->value); + return ptr; +} + +void *CsrEventCsrUint16Des(CsrUint8 *buffer, CsrSize length) +{ + CsrEventCsrUint16 *primitive = (CsrEventCsrUint16 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16)); + + CsrSize offset = 0; + CsrUint16Des(&primitive->type, buffer, &offset); + CsrUint16Des(&primitive->value, buffer, &offset); + + return primitive; +} + +CsrSize CsrEventCsrUint32Sizeof(void *msg) +{ + return 6; +} + +CsrUint8 *CsrEventCsrUint32Ser(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrEventCsrUint32 *primitive = (CsrEventCsrUint32 *) msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->type); + CsrUint32Ser(ptr, len, primitive->value); + return ptr; +} + +void *CsrEventCsrUint32Des(CsrUint8 *buffer, CsrSize length) +{ + CsrEventCsrUint32 *primitive = (CsrEventCsrUint32 *) CsrPmemAlloc(sizeof(CsrEventCsrUint32)); + + CsrSize offset = 0; + CsrUint16Des(&primitive->type, buffer, &offset); + CsrUint32Des(&primitive->value, buffer, &offset); + + return primitive; +} + +CsrSize CsrEventCsrUint16CsrUint8Sizeof(void *msg) +{ + return 5; +} + +CsrUint8 *CsrEventCsrUint16CsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrEventCsrUint16CsrUint8 *primitive = (CsrEventCsrUint16CsrUint8 *) msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->type); + CsrUint16Ser(ptr, len, primitive->value1); + CsrUint8Ser(ptr, len, primitive->value2); + return ptr; +} + +void *CsrEventCsrUint16CsrUint8Des(CsrUint8 *buffer, CsrSize length) +{ + CsrEventCsrUint16CsrUint8 *primitive = (CsrEventCsrUint16CsrUint8 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrUint8)); + + CsrSize offset = 0; + CsrUint16Des(&primitive->type, buffer, &offset); + CsrUint16Des(&primitive->value1, buffer, &offset); + CsrUint8Des(&primitive->value2, buffer, &offset); + + return primitive; +} + +CsrSize CsrEventCsrUint16CsrUint16Sizeof(void *msg) +{ + return 6; +} + +CsrUint8 *CsrEventCsrUint16CsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrEventCsrUint16CsrUint16 *primitive = (CsrEventCsrUint16CsrUint16 *) msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->type); + CsrUint16Ser(ptr, len, primitive->value1); + CsrUint16Ser(ptr, len, primitive->value2); + return ptr; +} + +void *CsrEventCsrUint16CsrUint16Des(CsrUint8 *buffer, CsrSize length) +{ + CsrEventCsrUint16CsrUint16 *primitive = (CsrEventCsrUint16CsrUint16 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrUint16)); + + CsrSize offset = 0; + CsrUint16Des(&primitive->type, buffer, &offset); + CsrUint16Des(&primitive->value1, buffer, &offset); + CsrUint16Des(&primitive->value2, buffer, &offset); + + return primitive; +} + +CsrSize CsrEventCsrUint16CsrUint32Sizeof(void *msg) +{ + return 8; +} + +CsrUint8 *CsrEventCsrUint16CsrUint32Ser(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrEventCsrUint16CsrUint32 *primitive = (CsrEventCsrUint16CsrUint32 *) msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->type); + CsrUint16Ser(ptr, len, primitive->value1); + CsrUint32Ser(ptr, len, primitive->value2); + return ptr; +} + +void *CsrEventCsrUint16CsrUint32Des(CsrUint8 *buffer, CsrSize length) +{ + CsrEventCsrUint16CsrUint32 *primitive = (CsrEventCsrUint16CsrUint32 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrUint32)); + + CsrSize offset = 0; + CsrUint16Des(&primitive->type, buffer, &offset); + CsrUint16Des(&primitive->value1, buffer, &offset); + CsrUint32Des(&primitive->value2, buffer, &offset); + + return primitive; +} + +CsrSize CsrEventCsrUint16CsrCharStringSizeof(void *msg) +{ + CsrEventCsrUint16CsrCharString *primitive = (CsrEventCsrUint16CsrCharString *) msg; + return 4 + CsrStrLen(primitive->value2) + 1; +} + +CsrUint8 *CsrEventCsrUint16CsrCharStringSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrEventCsrUint16CsrCharString *primitive = (CsrEventCsrUint16CsrCharString *) msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->type); + CsrUint16Ser(ptr, len, primitive->value1); + CsrCharStringSer(ptr, len, primitive->value2); + return ptr; +} + +void *CsrEventCsrUint16CsrCharStringDes(CsrUint8 *buffer, CsrSize length) +{ + CsrEventCsrUint16CsrCharString *primitive = (CsrEventCsrUint16CsrCharString *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrCharString)); + + CsrSize offset = 0; + CsrUint16Des(&primitive->type, buffer, &offset); + CsrUint16Des(&primitive->value1, buffer, &offset); + CsrCharStringDes(&primitive->value2, buffer, &offset); + + return primitive; +} + +CsrSize CsrEventCsrUint32CsrUint16Sizeof(void *msg) +{ + return 8; +} + +CsrUint8 *CsrEventCsrUint32CsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrEventCsrUint32CsrUint16 *primitive = (CsrEventCsrUint32CsrUint16 *) msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->type); + CsrUint32Ser(ptr, len, primitive->value1); + CsrUint16Ser(ptr, len, primitive->value2); + return ptr; +} + +void *CsrEventCsrUint32CsrUint16Des(CsrUint8 *buffer, CsrSize length) +{ + CsrEventCsrUint32CsrUint16 *primitive = (CsrEventCsrUint32CsrUint16 *) CsrPmemAlloc(sizeof(CsrEventCsrUint32CsrUint16)); + + CsrSize offset = 0; + CsrUint16Des(&primitive->type, buffer, &offset); + CsrUint32Des(&primitive->value1, buffer, &offset); + CsrUint16Des(&primitive->value2, buffer, &offset); + + return primitive; +} + +CsrSize CsrEventCsrUint32CsrCharStringSizeof(void *msg) +{ + CsrEventCsrUint32CsrCharString *primitive = (CsrEventCsrUint32CsrCharString *) msg; + return 6 + CsrStrLen(primitive->value2) + 1; +} + +CsrUint8 *CsrEventCsrUint32CsrCharStringSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrEventCsrUint32CsrCharString *primitive = (CsrEventCsrUint32CsrCharString *) msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->type); + CsrUint32Ser(ptr, len, primitive->value1); + CsrCharStringSer(ptr, len, primitive->value2); + return ptr; +} + +void *CsrEventCsrUint32CsrCharStringDes(CsrUint8 *buffer, CsrSize length) +{ + CsrEventCsrUint32CsrCharString *primitive = (CsrEventCsrUint32CsrCharString *) CsrPmemAlloc(sizeof(CsrEventCsrUint32CsrCharString)); + + CsrSize offset = 0; + CsrUint16Des(&primitive->type, buffer, &offset); + CsrUint32Des(&primitive->value1, buffer, &offset); + CsrCharStringDes(&primitive->value2, buffer, &offset); + + return primitive; +} diff --git a/drivers/staging/csr/csr_time.c b/drivers/staging/csr/csr_time.c new file mode 100644 index 0000000..1ef61e3 --- /dev/null +++ b/drivers/staging/csr/csr_time.c @@ -0,0 +1,71 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#include +#include + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33) +#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16) +#include +#include +#endif + +#include +#include + +#include "csr_types.h" +#include "csr_time.h" + +CsrTime CsrTimeGet(CsrTime *high) +{ + struct timespec ts; + CsrUint64 time; + CsrTime low; + + ts = current_kernel_time(); + time = (CsrUint64) ts.tv_sec * 1000000 + ts.tv_nsec / 1000; + + if (high != NULL) + { + *high = (CsrTime) ((time >> 32) & 0xFFFFFFFF); + } + + low = (CsrTime) (time & 0xFFFFFFFF); + + return low; +} +EXPORT_SYMBOL_GPL(CsrTimeGet); + +void CsrTimeUtcGet(CsrTimeUtc *tod, CsrTime *low, CsrTime *high) +{ + struct timespec ts; + CsrUint64 time; + + ts = current_kernel_time(); + time = (CsrUint64) ts.tv_sec * 1000000 + ts.tv_nsec / 1000; + + if (high != NULL) + { + *high = (CsrTime) ((time >> 32) & 0xFFFFFFFF); + } + + if (low != NULL) + { + *low = (CsrTime) (time & 0xFFFFFFFF); + } + + if (tod != NULL) + { + struct timeval tv; + do_gettimeofday(&tv); + tod->sec = tv.tv_sec; + tod->msec = tv.tv_usec / 1000; + } +} diff --git a/drivers/staging/csr/csr_time.h b/drivers/staging/csr/csr_time.h new file mode 100644 index 0000000..0ede47e --- /dev/null +++ b/drivers/staging/csr/csr_time.h @@ -0,0 +1,205 @@ +#ifndef CSR_TIME_H__ +#define CSR_TIME_H__ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#include "csr_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/******************************************************************************* + + NAME + CsrTime + + DESCRIPTION + Type to hold a value describing the current system time, which is a + measure of time elapsed since some arbitrarily defined fixed time + reference, usually associated with system startup. + +*******************************************************************************/ +typedef CsrUint32 CsrTime; + + +/******************************************************************************* + + NAME + CsrTimeUtc + + DESCRIPTION + Type to hold a value describing a UTC wallclock time expressed in + seconds and milliseconds elapsed since midnight January 1st 1970. + +*******************************************************************************/ +typedef struct +{ + CsrUint32 sec; + CsrUint16 msec; +} CsrTimeUtc; + + +/******************************************************************************* + + NAME + CsrTimeGet + + DESCRIPTION + Returns the current system time in a low and a high part. The low part + is expressed in microseconds. The high part is incremented when the low + part wraps to provide an extended range. + + The caller may provide a NULL pointer as the high parameter. In this case + the function just returns the low part and ignores the high parameter. + + Although the time is expressed in microseconds the actual resolution is + platform dependent and can be less. It is recommended that the + resolution is at least 10 milliseconds. + + PARAMETERS + high - Pointer to variable that will receive the high part of the + current system time. Passing NULL is valid. + + RETURNS + Low part of current system time in microseconds. + +*******************************************************************************/ +CsrTime CsrTimeGet(CsrTime *high); + + +/******************************************************************************* + + NAME + CsrTimeUtcGet + + DESCRIPTION + Get the current system wallclock time, and optionally the current system + time in a low and a high part as would have been returned by + CsrTimeGet. + + Although CsrTimeUtc is expressed in seconds and milliseconds, the actual + resolution is platform dependent, and can be less. It is recommended + that the resolution is at least 1 second. + + PARAMETERS + tod - Pointer to variable that will receive the current system + wallclock time. + low - The low part of the current system time in microseconds. Passing + NULL is valid. + high - The high part of the current system time in microseconds. Passing + NULL is valid. + +*******************************************************************************/ +void CsrTimeUtcGet(CsrTimeUtc *tod, CsrTime *low, CsrTime *high); + + +/*------------------------------------------------------------------*/ +/* CsrTime Macros */ +/*------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------------* + * NAME + * CsrTimeAdd + * + * DESCRIPTION + * Add two time values. Adding the numbers can overflow the range of a + * CsrTime, so the user must be cautious. + * + * RETURNS + * CsrTime - the sum of "t1" and "t2". + * + *----------------------------------------------------------------------------*/ +#define CsrTimeAdd(t1, t2) ((t1) + (t2)) + +/*----------------------------------------------------------------------------* + * NAME + * CsrTimeSub + * + * DESCRIPTION + * Subtract two time values. Subtracting the numbers can provoke an + * underflow, so the user must be cautious. + * + * RETURNS + * CsrTime - "t1" - "t2". + * + *----------------------------------------------------------------------------*/ +#define CsrTimeSub(t1, t2) ((CsrInt32) (t1) - (CsrInt32) (t2)) + +/*----------------------------------------------------------------------------* + * NAME + * CsrTimeEq + * + * DESCRIPTION + * Compare two time values. + * + * RETURNS + * !0 if "t1" equal "t2", else 0. + * + *----------------------------------------------------------------------------*/ +#define CsrTimeEq(t1, t2) ((t1) == (t2)) + +/*----------------------------------------------------------------------------* + * NAME + * CsrTimeGt + * + * DESCRIPTION + * Compare two time values. + * + * RETURNS + * !0 if "t1" is greater than "t2", else 0. + * + *----------------------------------------------------------------------------*/ +#define CsrTimeGt(t1, t2) (CsrTimeSub((t1), (t2)) > 0) + +/*----------------------------------------------------------------------------* + * NAME + * CsrTimeGe + * + * DESCRIPTION + * Compare two time values. + * + * RETURNS + * !0 if "t1" is greater than, or equal to "t2", else 0. + * + *----------------------------------------------------------------------------*/ +#define CsrTimeGe(t1, t2) (CsrTimeSub((t1), (t2)) >= 0) + +/*----------------------------------------------------------------------------* + * NAME + * CsrTimeLt + * + * DESCRIPTION + * Compare two time values. + * + * RETURNS + * !0 if "t1" is less than "t2", else 0. + * + *----------------------------------------------------------------------------*/ +#define CsrTimeLt(t1, t2) (CsrTimeSub((t1), (t2)) < 0) + +/*----------------------------------------------------------------------------* + * NAME + * CsrTimeLe + * + * DESCRIPTION + * Compare two time values. + * + * RETURNS + * !0 if "t1" is less than, or equal to "t2", else 0. + * + *----------------------------------------------------------------------------*/ +#define CsrTimeLe(t1, t2) (CsrTimeSub((t1), (t2)) <= 0) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/drivers/staging/csr/csr_types.h b/drivers/staging/csr/csr_types.h new file mode 100644 index 0000000..d7d2c5d --- /dev/null +++ b/drivers/staging/csr/csr_types.h @@ -0,0 +1,93 @@ +#ifndef CSR_TYPES_H__ +#define CSR_TYPES_H__ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#ifdef __KERNEL__ +#include +#include +#include +#include +#include +#else +#include +#include +#include +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#undef FALSE +#define FALSE (0) + +#undef TRUE +#define TRUE (1) + +/* Basic types */ +typedef size_t CsrSize; /* Return type of sizeof (ISO/IEC 9899:1990 7.1.6) */ +typedef ptrdiff_t CsrPtrdiff; /* Type of the result of subtracting two pointers (ISO/IEC 9899:1990 7.1.6) */ +typedef uintptr_t CsrUintptr; /* Unsigned integer large enough to hold any pointer (ISO/IEC 9899:1999 7.18.1.4) */ +#ifdef __KERNEL__ +typedef ptrdiff_t CsrIntptr; /* intptr_t is not defined in kernel. Use the equivalent ptrdiff_t. */ +#else +typedef intptr_t CsrIntptr; /* Signed integer large enough to hold any pointer (ISO/IEC 9899:1999 7.18.1.4) */ +#endif + +/* Unsigned fixed width types */ +typedef uint8_t CsrUint8; +typedef uint16_t CsrUint16; +typedef uint32_t CsrUint32; + +/* Signed fixed width types */ +typedef int8_t CsrInt8; +typedef int16_t CsrInt16; +typedef int32_t CsrInt32; + +/* Boolean */ +typedef CsrUint8 CsrBool; + +/* String types */ +typedef char CsrCharString; +typedef CsrUint8 CsrUtf8String; +typedef CsrUint16 CsrUtf16String; /* 16-bit UTF16 strings */ +typedef CsrUint32 CsrUint24; + +/* + * 64-bit integers + * + * Note: If a given compiler does not support 64-bit types, it is + * OK to omit these definitions; 32-bit versions of the code using + * these types may be available. Consult the relevant documentation + * or the customer support group for information on this. + */ +#define CSR_HAVE_64_BIT_INTEGERS +typedef uint64_t CsrUint64; +typedef int64_t CsrInt64; + +/* + * Floating point + * + * Note: If a given compiler does not support floating point, it is + * OK to omit these definitions; alternative versions of the code using + * these types may be available. Consult the relevant documentation + * or the customer support group for information on this. + */ +#define CSR_HAVE_FLOATING_POINT +typedef float CsrFloat; +typedef double CsrDouble; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/drivers/staging/csr/csr_unicode.h b/drivers/staging/csr/csr_unicode.h new file mode 100644 index 0000000..9faf856 --- /dev/null +++ b/drivers/staging/csr/csr_unicode.h @@ -0,0 +1,190 @@ +#ifndef CSR_UNICODE_H__ +#define CSR_UNICODE_H__ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#include "csr_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +CsrUtf16String *CsrUint32ToUtf16String(CsrUint32 number); + +CsrUint32 CsrUtf16StringToUint32(const CsrUtf16String *unicodeString); +CsrUint32 CsrUtf16StrLen(const CsrUtf16String *unicodeString); + +CsrUtf8String *CsrUtf16String2Utf8(const CsrUtf16String *source); + +CsrUtf16String *CsrUtf82Utf16String(const CsrUtf8String *utf8String); + +CsrUtf16String *CsrUtf16StrCpy(CsrUtf16String *target, const CsrUtf16String *source); +CsrUtf16String *CsrUtf16StringDuplicate(const CsrUtf16String *source); + +CsrUint16 CsrUtf16StrICmp(const CsrUtf16String *string1, const CsrUtf16String *string2); +CsrUint16 CsrUtf16StrNICmp(const CsrUtf16String *string1, const CsrUtf16String *string2, CsrUint32 count); + +CsrUtf16String *CsrUtf16MemCpy(CsrUtf16String *dest, const CsrUtf16String *src, CsrUint32 count); +CsrUtf16String *CsrUtf16ConcatenateTexts(const CsrUtf16String *inputText1, const CsrUtf16String *inputText2, + const CsrUtf16String *inputText3, const CsrUtf16String *inputText4); + +CsrUtf16String *CsrUtf16String2XML(CsrUtf16String *str); +CsrUtf16String *CsrXML2Utf16String(CsrUtf16String *str); + +CsrInt32 CsrUtf8StrCmp(const CsrUtf8String *string1, const CsrUtf8String *string2); +CsrInt32 CsrUtf8StrNCmp(const CsrUtf8String *string1, const CsrUtf8String *string2, CsrSize count); +CsrUint32 CsrUtf8StringLengthInBytes(const CsrUtf8String *string); + +/******************************************************************************* + + NAME + CsrUtf8StrTruncate + + DESCRIPTION + In-place truncate a string on a UTF-8 character boundary by writing a + null character somewhere in the range target[count - 3]:target[count]. + + Please note that memory passed must be at least of length count + 1, to + ensure space for a full length string that is terminated at + target[count], in the event that target[count - 1] is the final byte of + a UTF-8 character. + + PARAMETERS + target - Target string to truncate. + count - The desired length, in bytes, of the resulting string. Depending + on the contents, the resulting string length will be between + count - 3 and count. + + RETURNS + Returns target + +*******************************************************************************/ +CsrUtf8String *CsrUtf8StrTruncate(CsrUtf8String *target, CsrSize count); + +/******************************************************************************* + + NAME + CsrUtf8StrCpy + + DESCRIPTION + Copies the null terminated UTF-8 string pointed at by source into the + memory pointed at by target, including the terminating null character. + + To avoid overflows, the size of the memory pointed at by target shall be + long enough to contain the same UTF-8 string as source (including the + terminating null character), and should not overlap in memory with + source. + + PARAMETERS + target - Pointer to the target memory where the content is to be copied. + source - UTF-8 string to be copied. + + RETURNS + Returns target + +*******************************************************************************/ +CsrUtf8String *CsrUtf8StrCpy(CsrUtf8String *target, const CsrUtf8String *source); + +/******************************************************************************* + + NAME + CsrUtf8StrNCpy + + DESCRIPTION + Copies the first count bytes of source to target. If the end of the + source UTF-8 string (which is signaled by a null-character) is found + before count bytes have been copied, target is padded with null + characters until a total of count bytes have been written to it. + + No null-character is implicitly appended to the end of target, so target + will only be null-terminated if the length of the UTF-8 string in source + is less than count. + + PARAMETERS + target - Pointer to the target memory where the content is to be copied. + source - UTF-8 string to be copied. + count - Maximum number of bytes to be written to target. + + RETURNS + Returns target + +*******************************************************************************/ +CsrUtf8String *CsrUtf8StrNCpy(CsrUtf8String *target, const CsrUtf8String *source, CsrSize count); + +/******************************************************************************* + + NAME + CsrUtf8StrNCpyZero + + DESCRIPTION + Equivalent to CsrUtf8StrNCpy, but if the length of source is equal to or + greater than count the target string is truncated on a UTF-8 character + boundary by writing a null character somewhere in the range + target[count - 4]:target[count - 1], leaving the target string + unconditionally null terminated in all cases. + + Please note that if the length of source is shorter than count, no + truncation will be applied, and the target string will be a one to one + copy of source. + + PARAMETERS + target - Pointer to the target memory where the content is to be copied. + source - UTF-8 string to be copied. + count - Maximum number of bytes to be written to target. + + RETURNS + Returns target + +*******************************************************************************/ +CsrUtf8String *CsrUtf8StrNCpyZero(CsrUtf8String *target, const CsrUtf8String *source, CsrSize count); + +/******************************************************************************* + + NAME + CsrUtf8StrDup + + DESCRIPTION + This function will allocate memory and copy the source string into the + allocated memory, which is then returned as a duplicate of the original + string. The memory returned must be freed by calling CsrPmemFree when + the duplicate is no longer needed. + + PARAMETERS + source - UTF-8 string to be duplicated. + + RETURNS + Returns a duplicate of source. + +*******************************************************************************/ +CsrUtf8String *CsrUtf8StrDup(const CsrUtf8String *source); + +CsrUtf8String *CsrUtf8StringConcatenateTexts(const CsrUtf8String *inputText1, const CsrUtf8String *inputText2, const CsrUtf8String *inputText3, const CsrUtf8String *inputText4); + +/* + * UCS2 + * + * D-13157 + */ +typedef CsrUint8 CsrUcs2String; + +CsrSize CsrUcs2ByteStrLen(const CsrUcs2String *ucs2String); +CsrSize CsrConverterUcs2ByteStrLen(const CsrUcs2String *str); + +CsrUint8 *CsrUcs2ByteString2Utf8(const CsrUcs2String *ucs2String); +CsrUcs2String *CsrUtf82Ucs2ByteString(const CsrUint8 *utf8String); + +CsrUint8 *CsrUtf16String2Ucs2ByteString(const CsrUtf16String *source); +CsrUtf16String *CsrUcs2ByteString2Utf16String(const CsrUint8 *source); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c new file mode 100644 index 0000000..9259635 --- /dev/null +++ b/drivers/staging/csr/csr_utf16.c @@ -0,0 +1,1136 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ +#include +#include "csr_types.h" +#include "csr_pmem.h" +#include "csr_unicode.h" +#include "csr_util.h" + +#define UNI_SUR_HIGH_START ((CsrUint32) 0xD800) +#define UNI_SUR_HIGH_END ((CsrUint32) 0xDBFF) +#define UNI_SUR_LOW_START ((CsrUint32) 0xDC00) +#define UNI_SUR_LOW_END ((CsrUint32) 0xDFFF) +#define UNI_REPLACEMENT_CHAR ((CsrUint32) 0xFFFD) +#define UNI_HALF_SHIFT ((CsrUint8) 10) /* used for shifting by 10 bits */ +#define UNI_HALF_BASE ((CsrUint32) 0x00010000) +#define UNI_BYTEMASK ((CsrUint32) 0xBF) +#define UNI_BYTEMARK ((CsrUint32) 0x80) + +#define CAPITAL(x) ((x >= 'a') && (x <= 'z') ? ((x) & 0x00DF) : (x)) + +/* +* Index into the table with the first byte to get the number of trailing bytes in a utf-8 character. +* -1 if the byte has an invalid value. +* +* Legal sequences are: +* +* byte 1st 2nd 3rd 4th +* +* 00-7F +* C2-DF 80-BF +* E0 A0-BF 80-BF +* E1-EC 80-BF 80-BF +* ED 80-9F 80-BF +* EE-EF 80-BF 80-BF +* F0 90-BF 80-BF 80-BF +* F1-F3 80-BF 80-BF 80-BF +* F4 80-8F 80-BF 80-BF +*/ +static const CsrInt8 trailingBytesForUtf8[256] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 - 0x1F */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 - 0x3F */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 - 0x5F */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x7F */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x80 - 0x9F */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xA0 - 0xBF */ + -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xC0 - 0xDF */ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xE0 - 0xFF */ +}; + +/* Values to be substracted from a CsrUint32 when converting from UTF8 to UTF16 */ +static const CsrUint32 offsetsFromUtf8[4] = +{ + 0x00000000, 0x00003080, 0x000E2080, 0x03C82080 +}; + +/******************************************************************************** +* +* Name: CsrUint32ToUtf16String +* +* Description: The function converts an 32 bit number to an UTF-16 string +* that is allocated and 0-terminated. +* +* Input: 32 bit number. +* +* Output: A string of UTF-16 characters. +* +*********************************************************************************/ +CsrUtf16String *CsrUint32ToUtf16String(CsrUint32 number) +{ + CsrUint16 count, noOfDigits; + CsrUtf16String *output; + CsrUint32 tempNumber; + + /* calculate the number of digits in the output */ + tempNumber = number; + noOfDigits = 1; + while (tempNumber >= 10) + { + tempNumber = tempNumber / 10; + noOfDigits++; + } + + output = (CsrUtf16String *) CsrPmemAlloc(sizeof(CsrUtf16String) * (noOfDigits + 1)); /*add space for 0-termination*/ + + tempNumber = number; + for (count = noOfDigits; count > 0; count--) + { + output[count - 1] = (CsrUtf16String) ((tempNumber % 10) + '0'); + tempNumber = tempNumber / 10; + } + output[noOfDigits] = '\0'; + + return output; +} + +/******************************************************************************** +* +* Name: CsrUtf16StringToUint32 +* +* Description: The function converts an UTF-16 string that is +* 0-terminated into a 32 bit number. +* +* Input: A string of UTF-16 characters containig a number. +* +* Output: 32 bit number. +* +*********************************************************************************/ +CsrUint32 CsrUtf16StringToUint32(const CsrUtf16String *unicodeString) +{ + CsrUint16 numLen, count; + CsrUint32 newNumber = 0; + + numLen = (CsrUint16) CsrUtf16StrLen(unicodeString); + + if ((numLen > 10) || (numLen == 0) || (unicodeString == NULL)) /*CSRMAX number is 4.294.967.295 */ + { + return 0; + } + + for (count = 0; count < numLen; count++) + { + CsrUtf16String input = unicodeString[count]; + if ((input < 0x30) || (input > 0x39) || ((newNumber == 0x19999999) && (input > 0x35)) || (newNumber > 0x19999999)) /* chars are present or number is too large now causing number to get to large when *10 */ + { + return 0; + } + + newNumber = (newNumber * 10) + (input - 0x30); + } + return newNumber; +} + +/******************************************************************************** +* +* Name: CsrUtf16MemCpy +* +* Description: The function copies count number of 16 bit data elements +* from srv to dest. +* +* Input: A pointer to an unicoded string. +* +* Output: A pointer to an unicoded string. +* +*********************************************************************************/ +CsrUtf16String *CsrUtf16MemCpy(CsrUtf16String *dest, const CsrUtf16String *src, CsrUint32 count) +{ + return CsrMemCpy((CsrUint8 *) dest, (CsrUint8 *) src, count * sizeof(CsrUtf16String)); +} + +/******************************************************************************** +* +* Name: CsrUtf16ConcatenateTexts +* +* Description: The function merge the contents of 4 unicoded input pointers +* into a new string. +* +* Input: 4 unicoded input strings (UTF-16). +* +* Output: A new unicoded string (UTF-16) containing the combined strings. +* +*********************************************************************************/ +CsrUtf16String *CsrUtf16ConcatenateTexts(const CsrUtf16String *inputText1, const CsrUtf16String *inputText2, + const CsrUtf16String *inputText3, const CsrUtf16String *inputText4) +{ + CsrUtf16String *outputText; + CsrUint32 textLen, textLen1, textLen2, textLen3, textLen4; + + textLen1 = CsrUtf16StrLen(inputText1); + textLen2 = CsrUtf16StrLen(inputText2); + textLen3 = CsrUtf16StrLen(inputText3); + textLen4 = CsrUtf16StrLen(inputText4); + + textLen = textLen1 + textLen2 + textLen3 + textLen4; + + if (textLen == 0) /*stop here is all lengths are 0*/ + { + return NULL; + } + + outputText = (CsrUtf16String *) CsrPmemAlloc((textLen + 1) * sizeof(CsrUtf16String)); /* add space for 0-termination*/ + + + if (inputText1 != NULL) + { + CsrUtf16MemCpy(outputText, inputText1, textLen1); + } + + if (inputText2 != NULL) + { + CsrUtf16MemCpy(&(outputText[textLen1]), inputText2, textLen2); + } + + if (inputText3 != NULL) + { + CsrUtf16MemCpy(&(outputText[textLen1 + textLen2]), inputText3, textLen3); + } + + if (inputText4 != NULL) + { + CsrUtf16MemCpy(&(outputText[textLen1 + textLen2 + textLen3]), inputText4, textLen4); + } + + outputText[textLen] = '\0'; + + return outputText; +} + +/******************************************************************************** +* +* Name: CsrUtf16StrLen +* +* Description: The function returns the number of 16 bit elements present +* in the 0-terminated string. +* +* Input: 0-terminated string of 16 bit unicoded characters. +* +* Output: The number of 16 bit elements in the string. +* +*********************************************************************************/ +CsrUint32 CsrUtf16StrLen(const CsrUtf16String *unicodeString) +{ + CsrUint32 length; + + length = 0; + if (unicodeString != NULL) + { + while (*unicodeString) + { + length++; + unicodeString++; + } + } + return length; +} + +/******************************************************************************** +* +* Name: CsrUtf16String2Utf8 +* +* Description: The function decodes an UTF-16 string into an UTF8 byte +* oriented string. +* +* Input: 0-terminated UTF-16 string characters. +* +* Output: 0-terminated string of byte oriented UTF8 coded characters. +* +*********************************************************************************/ +CsrUtf8String *CsrUtf16String2Utf8(const CsrUtf16String *source) +{ + CsrUtf8String *dest, *destStart = NULL; + CsrUint32 i; + CsrUint32 ch; + CsrUint32 length; + CsrUint32 sourceLength; + CsrUint8 bytes; + CsrBool appendNull = FALSE; + + CsrUint8 firstByteMark[5] = {0x00, 0x00, 0xC0, 0xE0, 0xF0}; + + if (!source) + { + return NULL; + } + + length = 0; + sourceLength = CsrUtf16StrLen(source) + 1; + + for (i = 0; i < sourceLength; i++) + { + ch = source[i]; + if ((ch >= UNI_SUR_HIGH_START) && (ch <= UNI_SUR_HIGH_END)) /* This is a high surrogate */ + { + if (i + 1 < sourceLength) /* The low surrogate is in the source */ + { + CsrUint32 ch2 = source[++i]; + if ((ch2 >= UNI_SUR_LOW_START) && (ch2 <= UNI_SUR_LOW_END)) /* And it is a legal low surrogate */ + { + length += 4; + } + else /* It is not a low surrogate, instead put a Unicode + 'REPLACEMENT CHARACTER' (U+FFFD) */ + { + length += 3; + i--; /* Substract 1 again as the conversion must continue after the ill-formed code unit */ + } + } + else /* The low surrogate does not exist, instead put a Unicode + 'REPLACEMENT CHARACTER' (U+FFFD), and the null terminated character */ + { + length += 4; + } + } + else if ((ch >= UNI_SUR_LOW_START) && (ch <= UNI_SUR_LOW_END)) /* The value of UTF-16 is not allowed to be in this range, instead put + a Unicode 'REPLACEMENT CHARACTER' (U+FFFD) */ + { + length += 3; + } + else /* Figure out how many bytes that are required */ + { + if (ch < 0x0080) + { + length++; + } + else if (ch < 0x0800) + { + length += 2; + } + else + { + length += 3; + } + } + } + + dest = CsrPmemAlloc(length); + destStart = dest; + + for (i = 0; i < sourceLength; i++) + { + ch = source[i]; + if ((ch >= UNI_SUR_HIGH_START) && (ch <= UNI_SUR_HIGH_END)) /* This is a high surrogate */ + { + if (i + 1 < sourceLength) /* The low surrogate is in the source */ + { + CsrUint32 ch2 = source[++i]; + if ((ch2 >= UNI_SUR_LOW_START) && (ch2 <= UNI_SUR_LOW_END)) /* And it is a legal low surrogate, convert to UTF-32 */ + { + ch = ((ch - UNI_SUR_HIGH_START) << UNI_HALF_SHIFT) + (ch2 - UNI_SUR_LOW_START) + UNI_HALF_BASE; + } + else /* It is not a low surrogate, instead put a Unicode + 'REPLACEMENT CHARACTER' (U+FFFD) */ + { + ch = UNI_REPLACEMENT_CHAR; + i--; /* Substract 1 again as the conversion must continue after the ill-formed code unit */ + } + } + else /* The low surrogate does not exist, instead put a Unicode + 'REPLACEMENT CHARACTER' (U+FFFD), and the null terminated character */ + { + ch = UNI_REPLACEMENT_CHAR; + appendNull = TRUE; + } + } + else if ((ch >= UNI_SUR_LOW_START) && (ch <= UNI_SUR_LOW_END)) /* The value of UTF-16 is not allowed to be in this range, instead put + a Unicode 'REPLACEMENT CHARACTER' (U+FFFD) */ + { + ch = UNI_REPLACEMENT_CHAR; + } + + /* Figure out how many bytes that are required */ + if (ch < (CsrUint32) 0x80) + { + bytes = 1; + } + else if (ch < (CsrUint32) 0x800) + { + bytes = 2; + } + else if (ch < (CsrUint32) 0x10000) + { + bytes = 3; + } + else if (ch < (CsrUint32) 0x110000) + { + bytes = 4; + } + else + { + bytes = 3; + ch = UNI_REPLACEMENT_CHAR; + } + + dest += bytes; + + switch (bytes) /* Convert character to UTF-8. Note: everything falls through. */ + { + case 4: + { + *--dest = (CsrUint8) ((ch | UNI_BYTEMARK) & UNI_BYTEMASK); + ch >>= 6; + } + /* FALLTHROUGH */ + case 3: + { + *--dest = (CsrUint8) ((ch | UNI_BYTEMARK) & UNI_BYTEMASK); + ch >>= 6; + } + /* FALLTHROUGH */ + case 2: + { + *--dest = (CsrUint8) ((ch | UNI_BYTEMARK) & UNI_BYTEMASK); + ch >>= 6; + } + /* FALLTHROUGH */ + case 1: + { + *--dest = (CsrUint8) (ch | firstByteMark[bytes]); + } + /* FALLTHROUGH */ + default: + { + break; + } + } + + dest += bytes; + } + + if (appendNull) /* Append the \0 character */ + { + *dest = '\0'; + } + + return destStart; +} + +/***************************************************************************** + + NAME + isLegalUtf8 + + DESCRIPTION + Returns TRUE if the given UFT-8 code unit is legal as defined by the + Unicode standard (see Chapter 3: Conformance, Section 3.9: Unicode + Encoding Forms, UTF-8). + + This function assumes that the length parameter is unconditionally + correct and that the first byte is already validated by looking it up + in the trailingBytesForUtf8 array, which also reveals the number of + trailing bytes. + + Legal code units are composed of one of the following byte sequences: + + 1st 2nd 3rd 4th + -------------------------------- + 00-7F + C2-DF 80-BF + E0 A0-BF 80-BF + E1-EC 80-BF 80-BF + ED 80-9F 80-BF + EE-EF 80-BF 80-BF + F0 90-BF 80-BF 80-BF + F1-F3 80-BF 80-BF 80-BF + F4 80-8F 80-BF 80-BF + + Please note that this function only checks whether the 2nd, 3rd and + 4th bytes fall into the valid ranges. + + PARAMETERS + codeUnit - pointer to the first byte of the byte sequence composing + the code unit to test. + length - the number of bytes in the code unit. Valid range is 1 to 4. + + RETURNS + TRUE if the given code unit is legal. + +*****************************************************************************/ +static CsrBool isLegalUtf8(const CsrUtf8String *codeUnit, CsrUint32 length) +{ + const CsrUtf8String *srcPtr = codeUnit + length; + CsrUint8 byte; + + switch (length) /* Everything falls through except case 1 */ + { + case 4: + { + byte = *--srcPtr; + if ((byte < 0x80) || (byte > 0xBF)) + { + return FALSE; + } + } + /* Fallthrough */ + case 3: + { + byte = *--srcPtr; + if ((byte < 0x80) || (byte > 0xBF)) + { + return FALSE; + } + } + /* Fallthrough */ + case 2: + { + byte = *--srcPtr; + if (byte > 0xBF) + { + return FALSE; + } + + switch (*codeUnit) /* No fallthrough */ + { + case 0xE0: + { + if (byte < 0xA0) + { + return FALSE; + } + break; + } + case 0xED: + { + if ((byte < 0x80) || (byte > 0x9F)) + { + return FALSE; + } + break; + } + case 0xF0: + { + if (byte < 0x90) + { + return FALSE; + } + break; + } + case 0xF4: + { + if ((byte < 0x80) || (byte > 0x8F)) + { + return FALSE; + } + break; + } + default: + { + if (byte < 0x80) + { + return FALSE; + } + break; + } + } + } + /* Fallthrough */ + case 1: + default: + /* The 1st byte and length are assumed correct */ + break; + } + + return TRUE; +} + +/******************************************************************************** +* +* Name: CsrUtf82Utf16String +* +* Description: The function decodes an UTF8 byte oriented string into a +* UTF-16string. +* +* Input: 0-terminated string of byte oriented UTF8 coded characters. +* +* Output: 0-terminated string of UTF-16 characters. +* +*********************************************************************************/ +CsrUtf16String *CsrUtf82Utf16String(const CsrUtf8String *utf8String) +{ + CsrSize i, length = 0; + CsrSize sourceLength; + CsrUtf16String *dest = NULL; + CsrUtf16String *destStart = NULL; + CsrInt8 extraBytes2Read; + + if (!utf8String) + { + return NULL; + } + sourceLength = CsrStrLen((CsrCharString *) utf8String); + + for (i = 0; i < sourceLength; i++) + { + extraBytes2Read = trailingBytesForUtf8[utf8String[i]]; + + if (extraBytes2Read == -1) /* Illegal byte value, instead put a Unicode 'REPLACEMENT CHARACTER' (U+FFFD) */ + { + length += 1; + } + else if (i + extraBytes2Read > sourceLength) /* The extra bytes does not exist, instead put a Unicode 'REPLACEMENT + CHARACTER' (U+FFFD), and the null terminated character */ + { + length += 2; + break; + } + else if (isLegalUtf8(&utf8String[i], extraBytes2Read + 1) == FALSE) /* It is not a legal utf-8 character, instead put a Unicode 'REPLACEMENT + CHARACTER' (U+FFFD) */ + { + length += 1; + } + else + { + if (utf8String[i] > 0xEF) /* Needs a high and a low surrogate */ + { + length += 2; + } + else + { + length += 1; + } + i += extraBytes2Read; + } + } + + /* Create space for the null terminated character */ + dest = (CsrUtf16String *) CsrPmemAlloc((1 + length) * sizeof(CsrUtf16String)); + destStart = dest; + + for (i = 0; i < sourceLength; i++) + { + extraBytes2Read = trailingBytesForUtf8[utf8String[i]]; + + if (extraBytes2Read == -1) /* Illegal byte value, instead put a Unicode 'REPLACEMENT CHARACTER' (U+FFFD) */ + { + *dest++ = UNI_REPLACEMENT_CHAR; + } + else if (i + extraBytes2Read > sourceLength) /* The extra bytes does not exist, instead put a Unicode 'REPLACEMENT + CHARACTER' (U+FFFD), and the null terminated character */ + { + *dest++ = UNI_REPLACEMENT_CHAR; + *dest++ = '\0'; + break; + } + else if (isLegalUtf8(&utf8String[i], extraBytes2Read + 1) == FALSE) /* It is not a legal utf-8 character, instead put a Unicode 'REPLACEMENT + CHARACTER' (U+FFFD) */ + { + *dest++ = UNI_REPLACEMENT_CHAR; + } + else /* It is legal, convert the character to an CsrUint32 */ + { + CsrUint32 ch = 0; + + switch (extraBytes2Read) /* Everything falls through */ + { + case 3: + { + ch += utf8String[i]; + ch <<= 6; + i++; + } + /* FALLTHROUGH */ + case 2: + { + ch += utf8String[i]; + ch <<= 6; + i++; + } + /* FALLTHROUGH */ + case 1: + { + ch += utf8String[i]; + ch <<= 6; + i++; + } + /* FALLTHROUGH */ + case 0: + { + ch += utf8String[i]; + } + /* FALLTHROUGH */ + default: + { + break; + } + } + + ch -= offsetsFromUtf8[extraBytes2Read]; + + if (ch <= 0xFFFF) /* Character can be encoded in one CsrUint16 */ + { + *dest++ = (CsrUint16) ch; + } + else /* The character needs two CsrUint16 */ + { + ch -= UNI_HALF_BASE; + *dest++ = (CsrUint16) ((ch >> UNI_HALF_SHIFT) | UNI_SUR_HIGH_START); + *dest++ = (CsrUint16) ((ch & 0x03FF) | UNI_SUR_LOW_START); + } + } + } + + destStart[length] = 0x00; + + return destStart; +} + +/******************************************************************************** +* +* Name: CsrUtf16StrCpy +* +* Description: The function copies the contents from one UTF-16 string +* to another UTF-16 string. +* +* Input: 0-terminated UTF-16 string. +* +* Output: 0-terminated UTF-16 string. +* +*********************************************************************************/ +CsrUtf16String *CsrUtf16StrCpy(CsrUtf16String *target, const CsrUtf16String *source) +{ + if (source) /* if source is not NULL*/ + { + CsrMemCpy(target, source, (CsrUtf16StrLen(source) + 1) * sizeof(CsrUtf16String)); + return target; + } + else + { + return NULL; + } +} + +/******************************************************************************** +* +* Name: CsrUtf16StringDuplicate +* +* Description: The function allocates a new pointer and copies the input to +* the new pointer. +* +* Input: 0-terminated UTF-16 string. +* +* Output: Allocated variable0-terminated UTF-16 string. +* +*********************************************************************************/ +CsrUtf16String *CsrUtf16StringDuplicate(const CsrUtf16String *source) +{ + CsrUtf16String *target = NULL; + CsrUint32 length; + + if (source) /* if source is not NULL*/ + { + length = (CsrUtf16StrLen(source) + 1) * sizeof(CsrUtf16String); + target = (CsrUtf16String *) CsrPmemAlloc(length); + CsrMemCpy(target, source, length); + } + return target; +} + +/******************************************************************************** +* +* Name: CsrUtf16StrICmp +* +* Description: The function compares two UTF-16 strings. +* +* Input: Two 0-terminated UTF-16 string. +* +* Output: 0: if the strings are identical. +* +*********************************************************************************/ +CsrUint16 CsrUtf16StrICmp(const CsrUtf16String *string1, const CsrUtf16String *string2) +{ + while (*string1 || *string2) + { + if (CAPITAL(*string1) != CAPITAL(*string2)) + { + return *string1 - *string2; + } + string1++; + string2++; + } + + return 0; +} + +/******************************************************************************** +* +* Name: CsrUtf16StrNICmp +* +* Description: The function compares upto count number of elements in the +* two UTF-16 string. +* +* Input: Two 0-terminated UTF-16 string and a maximum +* number of elements to check. +* +* Output: 0: if the strings are identical. +* +*********************************************************************************/ +CsrUint16 CsrUtf16StrNICmp(const CsrUtf16String *string1, const CsrUtf16String *string2, CsrUint32 count) +{ + while ((*string1 || *string2) && count--) + { + if (CAPITAL(*string1) != CAPITAL(*string2)) + { + return *string1 - *string2; + } + string1++; + string2++; + } + + return 0; +} + +/******************************************************************************** +* +* Name: CsrUtf16String2XML +* +* Description: The function converts an unicoded string (UTF-16) into an unicoded XML +* string where some special characters are encoded according to +* the XML spec. +* +* Input: A unicoded string (UTF-16) which is freed. +* +* Output: A new unicoded string (UTF-16) containing the converted output. +* +*********************************************************************************/ +CsrUtf16String *CsrUtf16String2XML(CsrUtf16String *str) +{ + CsrUtf16String *scanString; + CsrUtf16String *outputString = NULL; + CsrUtf16String *resultString = str; + CsrUint32 stringLength = 0; + CsrBool encodeChars = FALSE; + + scanString = str; + if (scanString) + { + while (*scanString) + { + if (*scanString == L'&') + { + stringLength += 5; + encodeChars = TRUE; + } + else if ((*scanString == L'<') || (*scanString == L'>')) + { + stringLength += 4; + encodeChars = TRUE; + } + else + { + stringLength++; + } + + scanString++; + } + + stringLength++; + + if (encodeChars) + { + resultString = outputString = CsrPmemAlloc(stringLength * sizeof(CsrUtf16String)); + + scanString = str; + + while (*scanString) + { + if (*scanString == L'&') + { + *outputString++ = '&'; + *outputString++ = 'a'; + *outputString++ = 'm'; + *outputString++ = 'p'; + *outputString++ = ';'; + } + else if (*scanString == L'<') + { + *outputString++ = '&'; + *outputString++ = 'l'; + *outputString++ = 't'; + *outputString++ = ';'; + } + else if (*scanString == L'>') + { + *outputString++ = '&'; + *outputString++ = 'g'; + *outputString++ = 't'; + *outputString++ = ';'; + } + else + { + *outputString++ = *scanString; + } + + scanString++; + } + + *outputString++ = 0; + + CsrPmemFree(str); + } + } + + return resultString; +} + +/******************************************************************************** +* +* Name: CsrXML2Utf16String +* +* Description: The function converts an unicoded XML string into an unicoded +* string (UTF-16) where some special XML characters are decoded according to +* the XML spec. +* +* Input: A unicoded XML string which is freed. +* +* Output: A new unicoded pointer containing the decoded output. +* +*********************************************************************************/ +CsrUtf16String *CsrXML2Utf16String(CsrUtf16String *str) +{ + CsrUtf16String *scanString; + CsrUtf16String *outputString = NULL; + CsrUtf16String *resultString = str; + CsrUint32 stringLength = 0; + CsrBool encodeChars = FALSE; + + scanString = str; + if (scanString) + { + while (*scanString) + { + if (*scanString == (CsrUtf16String) L'&') + { + scanString++; + + if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"AMP;", 4)) + { + scanString += 3; + encodeChars = TRUE; + } + else if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"LT;", 3)) + { + scanString += 2; + encodeChars = TRUE; + } + else if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"GT;", 3)) + { + scanString += 2; + encodeChars = TRUE; + } + if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"APOS;", 5)) + { + scanString += 4; + encodeChars = TRUE; + } + if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"QUOT;", 5)) + { + scanString += 4; + encodeChars = TRUE; + } + else + { + scanString--; + } + } + + stringLength++; + scanString++; + } + + stringLength++; + + if (encodeChars) + { + resultString = outputString = CsrPmemAlloc(stringLength * sizeof(CsrUtf16String)); + + scanString = str; + + while (*scanString) + { + if (*scanString == L'&') + { + scanString++; + + if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"AMP;", 4)) + { + *outputString++ = L'&'; + scanString += 3; + } + else if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"LT;", 3)) + { + *outputString++ = L'<'; + scanString += 2; + } + else if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"GT;", 3)) + { + *outputString++ = L'>'; + scanString += 2; + } + else if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"APOS;", 5)) + { + *outputString++ = L'\''; + scanString += 4; + } + else if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"QUOT;", 5)) + { + *outputString++ = L'\"'; + scanString += 4; + } + else + { + *outputString++ = L'&'; + scanString--; + } + } + else + { + *outputString++ = *scanString; + } + + scanString++; + } + + *outputString++ = 0; + + CsrPmemFree(str); + } + } + + return resultString; +} + +CsrInt32 CsrUtf8StrCmp(const CsrUtf8String *string1, const CsrUtf8String *string2) +{ + return CsrStrCmp((const CsrCharString *) string1, (const CsrCharString *) string2); +} + +CsrInt32 CsrUtf8StrNCmp(const CsrUtf8String *string1, const CsrUtf8String *string2, CsrSize count) +{ + return CsrStrNCmp((const CsrCharString *) string1, (const CsrCharString *) string2, count); +} + +CsrUint32 CsrUtf8StringLengthInBytes(const CsrUtf8String *string) +{ + CsrSize length = 0; + if (string) + { + length = CsrStrLen((const CsrCharString *) string); + } + return (CsrUint32) length; +} + +CsrUtf8String *CsrUtf8StrCpy(CsrUtf8String *target, const CsrUtf8String *source) +{ + return (CsrUtf8String *) CsrStrCpy((CsrCharString *) target, (const CsrCharString *) source); +} + +CsrUtf8String *CsrUtf8StrTruncate(CsrUtf8String *target, CsrSize count) +{ + CsrSize lastByte = count - 1; + + target[count] = '\0'; + + if (count && (target[lastByte] & 0x80)) + { + /* the last byte contains non-ascii char */ + if (target[lastByte] & 0x40) + { + /* multi-byte char starting just before truncation */ + target[lastByte] = '\0'; + } + else if ((target[lastByte - 1] & 0xE0) == 0xE0) + { + /* 3-byte char starting 2 bytes before truncation */ + target[lastByte - 1] = '\0'; + } + else if ((target[lastByte - 2] & 0xF0) == 0xF0) + { + /* 4-byte char starting 3 bytes before truncation */ + target[lastByte - 2] = '\0'; + } + } + + return target; +} + +CsrUtf8String *CsrUtf8StrNCpy(CsrUtf8String *target, const CsrUtf8String *source, CsrSize count) +{ + return (CsrUtf8String *) CsrStrNCpy((CsrCharString *) target, (const CsrCharString *) source, count); +} + +CsrUtf8String *CsrUtf8StrNCpyZero(CsrUtf8String *target, const CsrUtf8String *source, CsrSize count) +{ + CsrStrNCpy((CsrCharString *) target, (const CsrCharString *) source, count); + if (target[count - 1] != '\0') + { + CsrUtf8StrTruncate(target, count - 1); + } + return target; +} + +CsrUtf8String *CsrUtf8StrDup(const CsrUtf8String *source) +{ + return (CsrUtf8String *) CsrStrDup((const CsrCharString *) source); +} + +CsrUtf8String *CsrUtf8StringConcatenateTexts(const CsrUtf8String *inputText1, const CsrUtf8String *inputText2, const CsrUtf8String *inputText3, const CsrUtf8String *inputText4) +{ + CsrUtf8String *outputText; + CsrUint32 textLen, textLen1, textLen2, textLen3, textLen4; + + textLen1 = CsrUtf8StringLengthInBytes(inputText1); + textLen2 = CsrUtf8StringLengthInBytes(inputText2); + textLen3 = CsrUtf8StringLengthInBytes(inputText3); + textLen4 = CsrUtf8StringLengthInBytes(inputText4); + + textLen = textLen1 + textLen2 + textLen3 + textLen4; + + if (textLen == 0) /*stop here is all lengths are 0*/ + { + return NULL; + } + + outputText = (CsrUtf8String *) CsrPmemAlloc((textLen + 1) * sizeof(CsrUtf8String)); /* add space for 0-termination*/ + + + if (inputText1 != NULL) + { + CsrUtf8StrNCpy(outputText, inputText1, textLen1); + } + + if (inputText2 != NULL) + { + CsrUtf8StrNCpy(&(outputText[textLen1]), inputText2, textLen2); + } + + if (inputText3 != NULL) + { + CsrUtf8StrNCpy(&(outputText[textLen1 + textLen2]), inputText3, textLen3); + } + + if (inputText4 != NULL) + { + CsrUtf8StrNCpy(&(outputText[textLen1 + textLen2 + textLen3]), inputText4, textLen4); + } + + outputText[textLen] = '\0'; + + return outputText; +} diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c new file mode 100644 index 0000000..0ae1153 --- /dev/null +++ b/drivers/staging/csr/csr_util.c @@ -0,0 +1,435 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#include +#include +#include + +#include "csr_types.h" +#include "csr_pmem.h" +#include "csr_util.h" + +/*------------------------------------------------------------------*/ +/* Bits */ +/*------------------------------------------------------------------*/ + +/* Time proportional with the number of 1's */ +CsrUint8 CsrBitCountSparse(CsrUint32 n) +{ + CsrUint8 count = 0; + + while (n) + { + count++; + n &= (n - 1); + } + + return count; +} + +/* Time proportional with the number of 0's */ +CsrUint8 CsrBitCountDense(CsrUint32 n) +{ + CsrUint8 count = 8 * sizeof(CsrUint32); + + n ^= (CsrUint32) (-1); + + while (n) + { + count--; + n &= (n - 1); + } + + return count; +} + +/*------------------------------------------------------------------*/ +/* Base conversion */ +/*------------------------------------------------------------------*/ +CsrBool CsrHexStrToUint8(const CsrCharString *string, CsrUint8 *returnValue) +{ + CsrUint16 currentIndex = 0; + *returnValue = 0; + if ((string[currentIndex] == '0') && (CSR_TOUPPER(string[currentIndex + 1]) == 'X')) + { + string += 2; + } + if (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) || ((CSR_TOUPPER(string[currentIndex]) >= 'A') && (CSR_TOUPPER(string[currentIndex]) <= 'F'))) + { + while (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) || ((CSR_TOUPPER(string[currentIndex]) >= 'A') && (CSR_TOUPPER(string[currentIndex]) <= 'F'))) + { + *returnValue = (CsrUint8) (*returnValue * 16 + (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) ? string[currentIndex] - '0' : CSR_TOUPPER(string[currentIndex]) - 'A' + 10)); + currentIndex++; + if (currentIndex >= 2) + { + break; + } + } + return TRUE; + } + return FALSE; +} + +CsrBool CsrHexStrToUint16(const CsrCharString *string, CsrUint16 *returnValue) +{ + CsrUint16 currentIndex = 0; + *returnValue = 0; + if ((string[currentIndex] == '0') && (CSR_TOUPPER(string[currentIndex + 1]) == 'X')) + { + string += 2; + } + if (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) || ((CSR_TOUPPER(string[currentIndex]) >= 'A') && (CSR_TOUPPER(string[currentIndex]) <= 'F'))) + { + while (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) || ((CSR_TOUPPER(string[currentIndex]) >= 'A') && (CSR_TOUPPER(string[currentIndex]) <= 'F'))) + { + *returnValue = (CsrUint16) (*returnValue * 16 + (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) ? string[currentIndex] - '0' : CSR_TOUPPER(string[currentIndex]) - 'A' + 10)); + currentIndex++; + if (currentIndex >= 4) + { + break; + } + } + return TRUE; + } + return FALSE; +} + +CsrBool CsrHexStrToUint32(const CsrCharString *string, CsrUint32 *returnValue) +{ + CsrUint16 currentIndex = 0; + *returnValue = 0; + if ((string[currentIndex] == '0') && (CSR_TOUPPER(string[currentIndex + 1]) == 'X')) + { + string += 2; + } + if (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) || ((CSR_TOUPPER(string[currentIndex]) >= 'A') && (CSR_TOUPPER(string[currentIndex]) <= 'F'))) + { + while (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) || ((CSR_TOUPPER(string[currentIndex]) >= 'A') && (CSR_TOUPPER(string[currentIndex]) <= 'F'))) + { + *returnValue = *returnValue * 16 + (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) ? string[currentIndex] - '0' : CSR_TOUPPER(string[currentIndex]) - 'A' + 10); + currentIndex++; + if (currentIndex >= 8) + { + break; + } + } + return TRUE; + } + return FALSE; +} + +CsrUint32 CsrPow(CsrUint32 base, CsrUint32 exponent) +{ + if (exponent == 0) + { + return 1; + } + else + { + CsrUint32 i, t = base; + + for (i = 1; i < exponent; i++) + { + t = t * base; + } + return t; + } +} + +/* Convert signed 32 bit (or less) integer to string */ +#define I2B10_MAX 12 +void CsrIntToBase10(CsrInt32 number, CsrCharString *str) +{ + CsrInt32 digit; + CsrUint8 index; + CsrCharString res[I2B10_MAX]; + CsrBool foundDigit = FALSE; + + for (digit = 0; digit < I2B10_MAX; digit++) + { + res[digit] = '\0'; + } + + /* Catch sign - and deal with positive numbers only afterwards */ + index = 0; + if (number < 0) + { + res[index++] = '-'; + number = -1 * number; + } + + digit = 1000000000; + if (number > 0) + { + while ((index < I2B10_MAX - 1) && (digit > 0)) + { + /* If the foundDigit flag is TRUE, this routine should be proceeded. + Otherwise the number which has '0' digit cannot be converted correctly */ + if (((number / digit) > 0) || foundDigit) + { + foundDigit = TRUE; /* set foundDigit flag to TRUE*/ + res[index++] = (char) ('0' + (number / digit)); + number = number % digit; + } + + digit = digit / 10; + } + } + else + { + res[index] = (char) '0'; + } + + CsrStrCpy(str, res); +} + +void CsrUInt16ToHex(CsrUint16 number, CsrCharString *str) +{ + CsrUint16 index; + CsrUint16 currentValue; + + for (index = 0; index < 4; index++) + { + currentValue = (CsrUint16) (number & 0x000F); + number >>= 4; + str[3 - index] = (char) (currentValue > 9 ? currentValue + 55 : currentValue + '0'); + } + str[4] = '\0'; +} + +void CsrUInt32ToHex(CsrUint32 number, CsrCharString *str) +{ + CsrUint16 index; + CsrUint32 currentValue; + + for (index = 0; index < 8; index++) + { + currentValue = (CsrUint32) (number & 0x0000000F); + number >>= 4; + str[7 - index] = (char) (currentValue > 9 ? currentValue + 55 : currentValue + '0'); + } + str[8] = '\0'; +} + +/*------------------------------------------------------------------*/ +/* String */ +/*------------------------------------------------------------------*/ +void *CsrMemCpy(void *dest, const void *src, CsrSize count) +{ + return memcpy(dest, src, count); +} +EXPORT_SYMBOL_GPL(CsrMemCpy); + +void *CsrMemSet(void *dest, CsrUint8 c, CsrSize count) +{ + return memset(dest, c, count); +} +EXPORT_SYMBOL_GPL(CsrMemSet); + +void *CsrMemMove(void *dest, const void *src, CsrSize count) +{ + return memmove(dest, src, count); +} +EXPORT_SYMBOL_GPL(CsrMemMove); + +CsrInt32 CsrMemCmp(const void *buf1, const void *buf2, CsrSize count) +{ + return memcmp(buf1, buf2, count); +} +EXPORT_SYMBOL_GPL(CsrMemCmp); + +void *CsrMemDup(const void *buf1, CsrSize count) +{ + void *buf2 = NULL; + + if (buf1) + { + buf2 = CsrPmemAlloc(count); + CsrMemCpy(buf2, buf1, count); + } + + return buf2; +} + +CsrCharString *CsrStrCpy(CsrCharString *dest, const CsrCharString *src) +{ + return strcpy(dest, src); +} + +CsrCharString *CsrStrNCpy(CsrCharString *dest, const CsrCharString *src, CsrSize count) +{ + return strncpy(dest, src, count); +} + +CsrCharString *CsrStrCat(CsrCharString *dest, const CsrCharString *src) +{ + return strcat(dest, src); +} + +CsrCharString *CsrStrNCat(CsrCharString *dest, const CsrCharString *src, CsrSize count) +{ + return strncat(dest, src, count); +} + +CsrCharString *CsrStrStr(const CsrCharString *string1, const CsrCharString *string2) +{ + return strstr(string1, string2); +} + +CsrSize CsrStrLen(const CsrCharString *string) +{ + return strlen(string); +} +EXPORT_SYMBOL_GPL(CsrStrLen); + +CsrInt32 CsrStrCmp(const CsrCharString *string1, const CsrCharString *string2) +{ + return strcmp(string1, string2); +} + +CsrInt32 CsrStrNCmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count) +{ + return strncmp(string1, string2, count); +} + +CsrCharString *CsrStrChr(const CsrCharString *string, CsrCharString c) +{ + return strchr(string, c); +} + +CsrInt32 CsrVsnprintf(CsrCharString *string, CsrSize count, const CsrCharString *format, va_list args) +{ + return vsnprintf(string, count, format, args); +} +EXPORT_SYMBOL_GPL(CsrVsnprintf); + +CsrCharString *CsrStrNCpyZero(CsrCharString *dest, + const CsrCharString *src, + CsrSize count) +{ + CsrStrNCpy(dest, src, count - 1); + dest[count - 1] = '\0'; + return dest; +} + +/* Convert string with base 10 to integer */ +CsrUint32 CsrStrToInt(const CsrCharString *str) +{ + CsrInt16 i; + CsrUint32 res; + CsrUint32 digit; + + res = 0; + digit = 1; + + /* Start from the string end */ + for (i = (CsrUint16) (CsrStrLen(str) - 1); i >= 0; i--) + { + /* Only convert numbers */ + if ((str[i] >= '0') && (str[i] <= '9')) + { + res += digit * (str[i] - '0'); + digit = digit * 10; + } + } + + return res; +} + +CsrCharString *CsrStrDup(const CsrCharString *string) +{ + CsrCharString *copy; + CsrUint32 len; + + copy = NULL; + if (string != NULL) + { + len = CsrStrLen(string) + 1; + copy = CsrPmemAlloc(len); + CsrMemCpy(copy, string, len); + } + return copy; +} + +int CsrStrNICmp(const CsrCharString *string1, + const CsrCharString *string2, + CsrSize count) +{ + CsrUint32 index; + int returnValue = 0; + + for (index = 0; index < count; index++) + { + if (CSR_TOUPPER(string1[index]) != CSR_TOUPPER(string2[index])) + { + if (CSR_TOUPPER(string1[index]) > CSR_TOUPPER(string2[index])) + { + returnValue = 1; + } + else + { + returnValue = -1; + } + break; + } + if (string1[index] == '\0') + { + break; + } + } + return returnValue; +} + +const CsrCharString *CsrGetBaseName(const CsrCharString *file) +{ + const CsrCharString *pch; + static const CsrCharString dotDir[] = "."; + + if (!file) + { + return NULL; + } + + if (file[0] == '\0') + { + return dotDir; + } + + pch = file + CsrStrLen(file) - 1; + + while (*pch != '\\' && *pch != '/' && *pch != ':') + { + if (pch == file) + { + return pch; + } + --pch; + } + + return ++pch; +} + +/*------------------------------------------------------------------*/ +/* Misc */ +/*------------------------------------------------------------------*/ +CsrBool CsrIsSpace(CsrUint8 c) +{ + switch (c) + { + case '\t': + case '\n': + case '\f': + case '\r': + case ' ': + return TRUE; + default: + return FALSE; + } +} diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h new file mode 100644 index 0000000..a19badd --- /dev/null +++ b/drivers/staging/csr/csr_util.h @@ -0,0 +1,75 @@ +#ifndef CSR_UTIL_H__ +#define CSR_UTIL_H__ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "csr_types.h" +#include "csr_macro.h" + +/*------------------------------------------------------------------*/ +/* Bits - intended to operate on CsrUint32 values */ +/*------------------------------------------------------------------*/ +CsrUint8 CsrBitCountSparse(CsrUint32 n); +CsrUint8 CsrBitCountDense(CsrUint32 n); + +/*------------------------------------------------------------------*/ +/* Base conversion */ +/*------------------------------------------------------------------*/ +CsrBool CsrHexStrToUint8(const CsrCharString *string, CsrUint8 *returnValue); +CsrBool CsrHexStrToUint16(const CsrCharString *string, CsrUint16 *returnValue); +CsrBool CsrHexStrToUint32(const CsrCharString *string, CsrUint32 *returnValue); +CsrUint32 CsrPow(CsrUint32 base, CsrUint32 exponent); +void CsrIntToBase10(CsrInt32 number, CsrCharString *str); +void CsrUInt16ToHex(CsrUint16 number, CsrCharString *str); +void CsrUInt32ToHex(CsrUint32 number, CsrCharString *str); + +/*------------------------------------------------------------------*/ +/* String */ +/*------------------------------------------------------------------*/ +void *CsrMemCpy(void *dest, const void *src, CsrSize count); +void *CsrMemSet(void *dest, CsrUint8 c, CsrSize count); +void *CsrMemMove(void *dest, const void *src, CsrSize count); +CsrInt32 CsrMemCmp(const void *buf1, const void *buf2, CsrSize count); +void *CsrMemDup(const void *buf1, CsrSize count); +CsrCharString *CsrStrCpy(CsrCharString *dest, const CsrCharString *src); +CsrCharString *CsrStrNCpy(CsrCharString *dest, const CsrCharString *src, CsrSize count); +int CsrStrNICmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count); +CsrCharString *CsrStrCat(CsrCharString *dest, const CsrCharString *src); +CsrCharString *CsrStrNCat(CsrCharString *dest, const CsrCharString *src, CsrSize count); +CsrCharString *CsrStrStr(const CsrCharString *string1, const CsrCharString *string2); +CsrSize CsrStrLen(const CsrCharString *string); +CsrInt32 CsrStrCmp(const CsrCharString *string1, const CsrCharString *string2); +CsrInt32 CsrStrNCmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count); +CsrCharString *CsrStrDup(const CsrCharString *string); +CsrCharString *CsrStrChr(const CsrCharString *string, CsrCharString c); +CsrUint32 CsrStrToInt(const CsrCharString *string); +CsrInt32 CsrVsnprintf(CsrCharString *string, CsrSize count, const CsrCharString *format, va_list args); +CsrCharString *CsrStrNCpyZero(CsrCharString *dest, const CsrCharString *src, CsrSize count); + +/*------------------------------------------------------------------*/ +/* Filename */ +/*------------------------------------------------------------------*/ +const CsrCharString *CsrGetBaseName(const CsrCharString *file); + +/*------------------------------------------------------------------*/ +/* Misc */ +/*------------------------------------------------------------------*/ +CsrBool CsrIsSpace(CsrUint8 c); +#define CsrOffsetOf(st, m) ((CsrSize) & ((st *) 0)->m) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/drivers/staging/csr/csr_wifi_common.h b/drivers/staging/csr/csr_wifi_common.h new file mode 100644 index 0000000..1cdde5c --- /dev/null +++ b/drivers/staging/csr/csr_wifi_common.h @@ -0,0 +1,109 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#ifndef CSR_WIFI_COMMON_H__ +#define CSR_WIFI_COMMON_H__ + +#include "csr_types.h" +#include "csr_result.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* MAC address */ +typedef struct +{ + CsrUint8 a[6]; +} CsrWifiMacAddress; + +/* IPv4 address */ +typedef struct +{ + CsrUint8 a[4]; +} CsrWifiIp4Address; + +/* IPv6 address */ +typedef struct +{ + CsrUint8 a[16]; +} CsrWifiIp6Address; + +typedef struct +{ + CsrUint8 ssid[32]; + CsrUint8 length; +} CsrWifiSsid; + +/******************************************************************************* + + DESCRIPTION + Result values used on the Wifi Interfaces + + VALUES + CSR_RESULT_SUCCESS + - The request/procedure succeeded + CSR_RESULT_FAILURE + - The request/procedure did not succeed because of an error + CSR_WIFI_RESULT_NOT_FOUND + - The request did not succeed because some resource was not + found. + CSR_WIFI_RESULT_TIMED_OUT + - The request/procedure did not succeed because of a time out + CSR_WIFI_RESULT_CANCELLED + - The request was canceled due to another conflicting + request that was issued before this one was completed + CSR_WIFI_RESULT_INVALID_PARAMETER + - The request/procedure did not succeed because it had an + invalid parameter + CSR_WIFI_RESULT_NO_ROOM + - The request did not succeed due to a lack of resources, + e.g. out of memory problem. + CSR_WIFI_RESULT_UNSUPPORTED + - The request/procedure did not succeed because the feature + is not supported yet + CSR_WIFI_RESULT_UNAVAILABLE + - The request cannot be processed at this time + CSR_WIFI_RESULT_WIFI_OFF + - The requested action is not available because Wi-Fi is + currently off + CSR_WIFI_RESULT_SECURITY_ERROR + - The request/procedure did not succeed because of a security + error + CSR_WIFI_RESULT_MIB_SET_FAILURE + - MIB Set Failure: either the MIB OID to be written to does + not exist or the MIB Value is invalid. + CSR_WIFI_RESULT_INVALID_INTERFACE_TAG + - The supplied Interface Tag is not valid. + CSR_WIFI_RESULT_P2P_NOA_CONFIG_CONFLICT + - The new NOA configuration conflicts with the existing NOA configuration + hence not accepted" +*******************************************************************************/ +#define CSR_WIFI_RESULT_NOT_FOUND ((CsrResult) 0x0001) +#define CSR_WIFI_RESULT_TIMED_OUT ((CsrResult) 0x0002) +#define CSR_WIFI_RESULT_CANCELLED ((CsrResult) 0x0003) +#define CSR_WIFI_RESULT_INVALID_PARAMETER ((CsrResult) 0x0004) +#define CSR_WIFI_RESULT_NO_ROOM ((CsrResult) 0x0005) +#define CSR_WIFI_RESULT_UNSUPPORTED ((CsrResult) 0x0006) +#define CSR_WIFI_RESULT_UNAVAILABLE ((CsrResult) 0x0007) +#define CSR_WIFI_RESULT_WIFI_OFF ((CsrResult) 0x0008) +#define CSR_WIFI_RESULT_SECURITY_ERROR ((CsrResult) 0x0009) +#define CSR_WIFI_RESULT_MIB_SET_FAILURE ((CsrResult) 0x000A) +#define CSR_WIFI_RESULT_INVALID_INTERFACE_TAG ((CsrResult) 0x000B) +#define CSR_WIFI_RESULT_P2P_NOA_CONFIG_CONFLICT ((CsrResult) 0x000C) + +#define CSR_WIFI_VERSION "5.0.3.0" + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/drivers/staging/csr/csr_wifi_fsm.h b/drivers/staging/csr/csr_wifi_fsm.h new file mode 100644 index 0000000..cfdf082 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_fsm.h @@ -0,0 +1,250 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#ifndef CSR_WIFI_FSM_H +#define CSR_WIFI_FSM_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "csr_types.h" +#include "csr_pmem.h" +#include "csr_prim_defs.h" +#include "csr_log_text.h" +#include "csr_wifi_fsm_event.h" + +/* including this file for CsrWifiInterfaceMode*/ +#include "csr_wifi_common.h" + +#define CSR_WIFI_FSM_ENV (0xFFFF) + +/** + * @brief + * Toplevel FSM context data + * + * @par Description + * Holds ALL FSM static and dynamic data for a FSM + */ +typedef struct CsrWifiFsmContext CsrWifiFsmContext; + +/** + * @brief + * FSM External Wakeup CallbackFunction Pointer + * + * @par Description + * Defines the external wakeup function for the FSM + * to call when an external event is injected into the systen + * + * @param[in] context : External context + * + * @return + * void + */ +typedef void (*CsrWifiFsmExternalWakupCallbackPtr)(void *context); + +/** + * @brief + * Initialises a top level FSM context + * + * @par Description + * Initialises the FSM Context to an initial state and allocates + * space for "maxProcesses" number of instances + * + * @param[in] osaContext : OSA context + * @param[in] applicationContext : Internal fsm application context + * @param[in] externalContext : External context + * @param[in] maxProcesses : Max processes to allocate room for + * + * @return + * CsrWifiFsmContext* fsm context + */ +extern CsrWifiFsmContext* CsrWifiFsmInit(void *applicationContext, void *externalContext, CsrUint16 maxProcesses, CsrLogTextTaskId loggingTaskId); + +/** + * @brief + * Resets the FSM's back to first conditions + * + * @par Description + * This function is used to free any dynamic resources allocated for the + * given context by CsrWifiFsmInit(). + * The FSM's reset function is called to cleanup any fsm specific memory + * The reset funtion does NOT need to free the fsm data pointer as + * CsrWifiFsmShutdown() will do it. + * the FSM's init function is call again to reinitialise the FSM context. + * CsrWifiFsmReset() should NEVER be called when CsrWifiFsmExecute() is running. + * + * @param[in] context : FSM context + * + * @return + * void + */ +extern void CsrWifiFsmReset(CsrWifiFsmContext *context); + +/** + * @brief + * Frees resources allocated by CsrWifiFsmInit + * + * @par Description + * This function is used to free any dynamic resources allocated for the + * given context by CsrWifiFsmInit(), prior to complete termination of + * the program. + * The FSM's reset function is called to cleanup any fsm specific memory. + * The reset funtion does NOT need to free the fsm data pointer as + * CsrWifiFsmShutdown() will do it. + * CsrWifiFsmShutdown() should NEVER be called when CsrWifiFsmExecute() is running. + * + * @param[in] context : FSM context + * + * @return + * void + */ +extern void CsrWifiFsmShutdown(CsrWifiFsmContext *context); + +/** + * @brief + * Executes the fsm context + * + * @par Description + * Executes the FSM context and runs until ALL events in the context are processed. + * When no more events are left to process then CsrWifiFsmExecute() returns to a time + * specifying when to next call the CsrWifiFsmExecute() + * Scheduling, threading, blocking and external event notification are outside + * the scope of the FSM and CsrWifiFsmExecute(). + * + * @param[in] context : FSM context + * + * @return + * CsrUint32 Time in ms until next timeout or 0xFFFFFFFF for no timer set + */ +extern CsrUint32 CsrWifiFsmExecute(CsrWifiFsmContext *context); + +/** + * @brief + * Adds an event to the FSM context's external event queue for processing + * + * @par Description + * Adds an event to the contexts external queue + * This is thread safe and adds an event to the fsm's external event queue. + * + * @param[in] context : FSM context + * @param[in] event : event to add to the event queue + * @param[in] source : source of the event (this can be a synergy task queue or an fsm instance id) + * @param[in] destination : destination of the event (This can be a fsm instance id or CSR_WIFI_FSM_ENV) + * @param[in] id : event id + * + * @return + * void + */ +extern void CsrWifiFsmSendEventExternal(CsrWifiFsmContext *context, CsrWifiFsmEvent *event, CsrUint16 source, CsrUint16 destination, CsrPrim primtype, CsrUint16 id); + +/** + * @brief + * Adds an Alien event to the FSM context's external event queue for processing + * + * @par Description + * Adds an event to the contexts external queue + * This is thread safe and adds an event to the fsm's external event queue. + * + * @param[in] context : FSM context + * @param[in] event : event to add to the event queue + * @param[in] source : source of the event (this can be a synergy task queue or an fsm instance id) + * @param[in] destination : destination of the event (This can be a fsm instance id or CSR_WIFI_FSM_ENV) + * @param[in] id : event id + */ +#define CsrWifiFsmSendAlienEventExternal(_context, _alienEvent, _source, _destination, _primtype, _id) \ + { \ + CsrWifiFsmAlienEvent *_evt = (CsrWifiFsmAlienEvent *)CsrPmemAlloc(sizeof(CsrWifiFsmAlienEvent)); \ + _evt->alienEvent = _alienEvent; \ + CsrWifiFsmSendEventExternal(_context, (CsrWifiFsmEvent *)_evt, _source, _destination, _primtype, _id); \ + } + + +/** + * @brief + * Current time of day in ms + * + * @param[in] context : FSM context + * + * @return + * CsrUint32 32 bit ms tick + */ +extern CsrUint32 CsrWifiFsmGetTimeOfDayMs(CsrWifiFsmContext *context); + +/** + * @brief + * Gets the time until the next FSM timer expiry + * + * @par Description + * Returns the next timeout time or 0 if no timers are set. + * + * @param[in] context : FSM context + * + * @return + * CsrUint32 Time in ms until next timeout or 0xFFFFFFFF for no timer set + */ +extern CsrUint32 CsrWifiFsmGetNextTimeout(CsrWifiFsmContext *context); + +/** + * @brief + * Fast forwards the fsm timers by ms Milliseconds + * + * @param[in] context : FSM context + * @param[in] ms : Milliseconds to fast forward by + * + * @return + * void + */ +extern void CsrWifiFsmFastForward(CsrWifiFsmContext *context, CsrUint16 ms); + +/** + * @brief + * shift the current time of day by ms amount + * + * @par Description + * usefull to speed up tests where time needs to pass + * + * @param[in] context : FSM context + * @param[in] ms : ms to adjust time by + * + * @return + * void + */ +extern void CsrWifiFsmTestAdvanceTime(CsrWifiFsmContext *context, CsrUint32 ms); + +/** + * @brief + * Check if the fsm has events to process + * + * @param[in] context : FSM context + * + * @return + * CsrBool returns TRUE if there are events for the FSM to process + */ +extern CsrBool CsrWifiFsmHasEvents(CsrWifiFsmContext *context); + +/** + * @brief + * function that installs the contexts wakeup function + * + * @param[in] context : FSM context + * @param[in] callback : Callback function pointer + * + * @return + * void + */ +extern void CsrWifiFsmInstallWakeupCallback(CsrWifiFsmContext *context, CsrWifiFsmExternalWakupCallbackPtr callback); + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_FSM_H */ + diff --git a/drivers/staging/csr/csr_wifi_fsm_event.h b/drivers/staging/csr/csr_wifi_fsm_event.h new file mode 100644 index 0000000..ef07d8a --- /dev/null +++ b/drivers/staging/csr/csr_wifi_fsm_event.h @@ -0,0 +1,51 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#ifndef CSR_WIFI_FSM_EVENT_H +#define CSR_WIFI_FSM_EVENT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "csr_types.h" +#include "csr_prim_defs.h" +#include "csr_sched.h" + +/** + * @brief + * FSM event header. + * + * @par Description + * All events MUST have this struct as the FIRST member. + * The next member is used internally for linked lists + */ +typedef struct CsrWifiFsmEvent +{ + CsrPrim type; + CsrUint16 primtype; + CsrSchedQid destination; + CsrSchedQid source; + + /* Private pointer to allow an optimal Event list */ + /* NOTE: Ignore this pointer. + * Do not waste code initializing OR freeing it. + * The pointer is used internally in the CsrWifiFsm code + * to avoid a second malloc when queuing events. + */ + struct CsrWifiFsmEvent *next; +} CsrWifiFsmEvent; + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_FSM_EVENT_H */ + diff --git a/drivers/staging/csr/csr_wifi_fsm_types.h b/drivers/staging/csr/csr_wifi_fsm_types.h new file mode 100644 index 0000000..7c611e3 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_fsm_types.h @@ -0,0 +1,441 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#ifndef CSR_WIFI_FSM_TYPES_H +#define CSR_WIFI_FSM_TYPES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "csr_types.h" +#include "csr_util.h" +#include "csr_pmem.h" +#include "csr_panic.h" +#include "csr_sched.h" + +#ifdef CSR_WIFI_FSM_MUTEX_ENABLE +#include "csr_framework_ext.h" +#endif + +#include "csr_wifi_fsm.h" + +#define CSR_WIFI_FSM_MAX_TRANSITION_HISTORY 10 + +/** + * @brief + * FSM event list header. + * + * @par Description + * Singly linked list of events. + */ +typedef struct CsrWifiFsmEventList +{ + CsrWifiFsmEvent *first; + CsrWifiFsmEvent *last; +} CsrWifiFsmEventList; + + +/** + * @brief + * FSM timer id. + * + * @par Description + * Composite Id made up of the type, dest and a unique id so + * CsrWifiFsmRemoveTimer knows where to look when removing the timer + */ +typedef struct CsrWifiFsmTimerId +{ + CsrPrim type; + CsrUint16 primtype; + CsrSchedQid destination; + CsrUint16 uniqueid; +} CsrWifiFsmTimerId; + +/** + * @brief + * FSM timer header. + * + * @par Description + * All timer MUST have this struct as the FIRST member. + * The first members of the structure MUST remain compatable + * with the CsrWifiFsmEvent so that timers are just specialised events + */ +typedef struct CsrWifiFsmTimer +{ + CsrPrim type; + CsrUint16 primtype; + CsrSchedQid destination; + CsrSchedQid source; + + /* Private pointer to allow an optimal Event list */ + struct CsrWifiFsmTimer *next; + + CsrWifiFsmTimerId timerid; + CsrUint32 timeoutTimeMs; +} CsrWifiFsmTimer; + + +/** + * @brief + * Fsm Alien Event + * + * @par Description + * Allows the wrapping of alien events that do not use CsrWifiFsmEvent + * as the first member of the Event struct + */ +typedef struct +{ + CsrWifiFsmEvent event; + void *alienEvent; +} CsrWifiFsmAlienEvent; + + +/** + * @brief + * FSM timer list header. + * + * @par Description + * Singly linked list of timers. + */ +typedef struct CsrWifiFsmTimerList +{ + CsrWifiFsmTimer *first; + CsrWifiFsmTimer *last; + CsrUint16 nexttimerid; +} CsrWifiFsmTimerList; + +/** + * @brief + * Process Entry Function Pointer + * + * @par Description + * Defines the entry function for a processes. + * Called at process initialisation. + * + * @param[in] context : FSM context + * + * @return + * void + */ +typedef void (*CsrWifiFsmProcEntryFnPtr)(CsrWifiFsmContext *context); + +/** + * @brief + * Process Transition Function Pointer + * + * @par Description + * Defines a transition function for a processes. + * Called when an event causes a transition on a process + * + * @param[in] CsrWifiFsmContext* : FSM context + * @param[in] void* : FSM data (can be NULL) + * @param[in] const CsrWifiFsmEvent* : event to process + * + * @return + * void + */ +typedef void (*CsrWifiFsmTransitionFnPtr)(CsrWifiFsmContext *context, void *fsmData, const CsrWifiFsmEvent *event); + +/** + * @brief + * Process reset/shutdown Function Pointer + * + * @par Description + * Defines the reset/shutdown function for a processes. + * Called to reset or shutdown an fsm. + * + * @param[in] context : FSM context + * + * @return + * void + */ +typedef void (*CsrWifiFsmProcResetFnPtr)(CsrWifiFsmContext *context); + +/** + * @brief + * FSM Default Destination CallbackFunction Pointer + * + * @par Description + * Defines the default destination function for the FSM + * to call when an event does not have a valid destination. + * This + * + * @param[in] context : External context + * + * @return + * CsrUint16 a valid destination OR CSR_WIFI_FSM_ENV + */ +typedef CsrUint16 (*CsrWifiFsmDestLookupCallbackPtr)(void *context, const CsrWifiFsmEvent *event); + + +#ifdef CSR_WIFI_FSM_DUMP_ENABLE +/** + * @brief + * Trace Dump Function Pointer + * + * @par Description + * Called when we want to trace the FSM + * + * @param[in] context : FSM context + * @param[in] id : fsm id + * + * @return + * void + */ +typedef void (*CsrWifiFsmDumpFnPtr)(CsrWifiFsmContext *context, void *fsmData); +#endif + +/** + * @brief + * Event ID to transition function entry + * + * @par Description + * Event ID to Transition Entry in a state table. + */ +typedef struct +{ + CsrUint32 eventid; + CsrWifiFsmTransitionFnPtr transition; +#ifdef CSR_LOG_ENABLE + const CsrCharString *transitionName; +#endif +} CsrWifiFsmEventEntry; + +/** + * @brief + * Single State's Transition Table + * + * @par Description + * Stores Data for a single State's event to + * transition functions mapping + */ +typedef struct +{ + const CsrUint8 numEntries; + const CsrBool saveAll; + const CsrWifiFsmEventEntry *eventEntryArray; /* array of transition function pointers for state */ +#ifdef CSR_LOG_ENABLE + CsrUint16 stateNumber; + const CsrCharString *stateName; +#endif +} CsrWifiFsmTableEntry; + +/** + * @brief + * Process State Transtion table + * + * @par Description + * Stores Data for a processes State to transition table + */ +typedef struct +{ + CsrUint16 numStates; /* number of states */ + const CsrWifiFsmTableEntry *aStateEventMatrix; /* state event matrix */ +} CsrWifiFsmTransitionFunctionTable; + +/** + * @brief + * Const Process definition + * + * @par Description + * Constant process specification. + * This is ALL the non dynamic data that defines + * a process. + */ +typedef struct +{ + const CsrCharString *processName; + const CsrUint32 processId; + const CsrWifiFsmTransitionFunctionTable transitionTable; + const CsrWifiFsmTableEntry unhandledTransitions; + const CsrWifiFsmTableEntry ignoreFunctions; + const CsrWifiFsmProcEntryFnPtr entryFn; + const CsrWifiFsmProcResetFnPtr resetFn; +#ifdef CSR_WIFI_FSM_DUMP_ENABLE + const CsrWifiFsmDumpFnPtr dumpFn; /* Called to dump fsm specific trace if not NULL */ +#endif +} CsrWifiFsmProcessStateMachine; + +#ifdef CSR_WIFI_FSM_DUMP_ENABLE +/** + * @brief + * Storage for state transition info + */ +typedef struct +{ + CsrUint16 transitionNumber; + CsrWifiFsmEvent event; + CsrUint16 fromState; + CsrUint16 toState; + CsrWifiFsmTransitionFnPtr transitionFn; + CsrUint16 transitionCount; /* number consecutive of times this transition was seen */ +#ifdef CSR_LOG_ENABLE + const CsrCharString *transitionName; +#endif +} CsrWifiFsmTransitionRecord; + +/** + * @brief + * Storage for the last state X transitions + */ +typedef struct +{ + CsrUint16 numTransitions; + CsrWifiFsmTransitionRecord records[CSR_WIFI_FSM_MAX_TRANSITION_HISTORY]; +} CsrWifiFsmTransitionRecords; +#endif + +/** + * @brief + * Dynamic Process data + * + * @par Description + * Dynamic process data that is used to keep track of the + * state and data for a process instance + */ +typedef struct +{ + const CsrWifiFsmProcessStateMachine *fsmInfo; /* state machine info that is constant regardless of context */ + CsrUint16 instanceId; /* Runtime process id */ + CsrUint16 state; /* Current state */ + void *params; /* Instance user data */ + CsrWifiFsmEventList savedEventQueue; /* The saved event queue */ + struct CsrWifiFsmInstanceEntry *subFsm; /* Sub Fsm instance data */ + struct CsrWifiFsmInstanceEntry *subFsmCaller; /* The Fsm instance that created the SubFsm and should be used for callbacks*/ +#ifdef CSR_WIFI_FSM_DUMP_ENABLE + CsrWifiFsmTransitionRecords transitionRecords; /* Last X transitions in the FSM */ +#endif +} CsrWifiFsmInstanceEntry; + +/** + * @brief + * OnCreate Callback Function Pointer + * + * @par Description + * Called when an fsm is created. + * + * @param[in] extContext : External context + * @param[in] instance : FSM instance + * + * @return + * void + */ +typedef void (*CsrWifiFsmOnCreateFnPtr)(void *extContext, const CsrWifiFsmInstanceEntry *instance); + +/** + * @brief + * OnTransition Callback Function Pointer + * + * @par Description + * Called when an event is processed by a fsm + * + * @param[in] extContext : External context + * @param[in] eventEntryArray : Entry data + * @param[in] event : Event + * + * @return + * void + */ +typedef void (*CsrWifiFsmOnTransitionFnPtr)(void *extContext, const CsrWifiFsmEventEntry *eventEntryArray, const CsrWifiFsmEvent *event); + +/** + * @brief + * OnStateChange Callback Function Pointer + * + * @par Description + * Called when CsrWifiFsmNextState is called + * + * @param[in] extContext : External context + * + * @return + * void + */ +typedef void (*CsrWifiFsmOnStateChangeFnPtr)(void *extContext, CsrUint16 nextstate); + +/** + * @brief + * OnIgnore,OnError or OnInvalid Callback Function Pointer + * + * @par Description + * Called when an event is processed by a fsm + * + * @param[in] extContext : External context + * @param[in] event : Event + * + * @return + * void + */ +typedef void (*CsrWifiFsmOnEventFnPtr)(void *extContext, const CsrWifiFsmEvent *event); + +/** + * @brief + * Toplevel FSM context data + * + * @par Description + * Holds ALL FSM static and dynamic data for a FSM + */ +struct CsrWifiFsmContext +{ + CsrWifiFsmEventList eventQueue; /* The internal event queue */ + CsrWifiFsmEventList externalEventQueue; /* The external event queue */ +#ifdef CSR_WIFI_FSM_MUTEX_ENABLE + CsrMutexHandle externalEventQueueLock; /* The external event queue mutex */ +#endif + CsrUint32 timeOffset; /* Amount to adjust the TimeOfDayMs by */ + CsrWifiFsmTimerList timerQueue; /* The internal timer queue */ + CsrBool useTempSaveList; /* Should the temp save list be used */ + CsrWifiFsmEventList tempSaveList; /* The temp save event queue */ + CsrWifiFsmEvent *eventForwardedOrSaved; /* The event that was forwarded or Saved */ + CsrUint16 maxProcesses; /* Size of instanceArray */ + CsrUint16 numProcesses; /* Current number allocated in instanceArray */ + CsrWifiFsmInstanceEntry *instanceArray; /* Array of processes for this component */ + CsrWifiFsmInstanceEntry *ownerInstance; /* The Process that owns currentInstance (SubFsm support) */ + CsrWifiFsmInstanceEntry *currentInstance; /* Current Process that is executing */ + CsrWifiFsmExternalWakupCallbackPtr externalEventFn; /* External event Callback */ + CsrWifiFsmOnEventFnPtr appIgnoreCallback; /* Application Ignore event Callback */ + CsrWifiFsmDestLookupCallbackPtr appEvtDstCallback; /* Application Lookup event Destination Function*/ + + void *applicationContext; /* Internal fsm application context */ + void *externalContext; /* External context (set by the user of the fsm)*/ + CsrLogTextTaskId loggingTaskId; /* Task Id to use in any logging output */ + +#ifndef CSR_WIFI_FSM_SCHEDULER_DISABLED + CsrSchedTid schedTimerId; /* Scheduler TimerId for use in Scheduler Tasks */ + CsrUint32 schedTimerNexttimeoutMs; /* Next timeout time for the current timer */ +#endif + +#ifdef CSR_WIFI_FSM_MUTEX_ENABLE +#ifdef CSR_WIFI_FSM_TRANSITION_LOCK + CsrMutexHandle transitionLock; /* Lock when calling transition functions */ +#endif +#endif + +#ifdef CSR_LOG_ENABLE + CsrWifiFsmOnCreateFnPtr onCreate; /* Debug Transition Callback */ + CsrWifiFsmOnTransitionFnPtr onTransition; /* Debug Transition Callback */ + CsrWifiFsmOnTransitionFnPtr onUnhandedCallback; /* Unhanded event Callback */ + CsrWifiFsmOnStateChangeFnPtr onStateChange; /* Debug State Change Callback */ + CsrWifiFsmOnEventFnPtr onIgnoreCallback; /* Ignore event Callback */ + CsrWifiFsmOnEventFnPtr onSaveCallback; /* Save event Callback */ + CsrWifiFsmOnEventFnPtr onErrorCallback; /* Error event Callback */ + CsrWifiFsmOnEventFnPtr onInvalidCallback; /* Invalid event Callback */ +#endif +#ifdef CSR_WIFI_FSM_DUMP_ENABLE + CsrUint16 masterTransitionNumber; /* Increments on every transition */ +#endif +}; + + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_FSM_TYPES_H */ diff --git a/drivers/staging/csr/csr_wifi_hip_card.h b/drivers/staging/csr/csr_wifi_hip_card.h new file mode 100644 index 0000000..8904211 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_card.h @@ -0,0 +1,114 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* + ****************************************************************************** + * FILE : csr_wifi_hip_card.h + * + * PURPOSE : Defines abstract interface for hardware specific functions. + * Note, this is a different file from one of the same name in the + * Windows driver. + * + ***************************************************************************** + */ +#ifndef __CARD_H__ +#define __CARD_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "csr_wifi_hip_card_sdio.h" +#include "csr_wifi_hip_signals.h" +#include "csr_wifi_hip_unifi_udi.h" + + +/***************************************************************************** + * CardEnableInt - + */ +CsrResult CardEnableInt(card_t *card); + +/***************************************************************************** + * CardGenInt - + */ +CsrResult CardGenInt(card_t *card); + +/***************************************************************************** + * CardPendingInt - + */ +CsrResult CardPendingInt(card_t *card, CsrBool *pintr); + +/***************************************************************************** + * CardDisableInt - + */ +CsrResult CardDisableInt(card_t *card); + +/***************************************************************************** + * CardClearInt - + */ +CsrResult CardClearInt(card_t *card); + +/***************************************************************************** + * CardDisable - + */ +void CardDisable(card_t *card); + +/***************************************************************************** + * CardIntEnabled - + */ +CsrResult CardIntEnabled(card_t *card, CsrBool *enabled); + +/***************************************************************************** + * CardGetDataSlotSize + */ +CsrUint16 CardGetDataSlotSize(card_t *card); + +/***************************************************************************** + * CardWriteBulkData - + */ +CsrResult CardWriteBulkData(card_t *card, card_signal_t *csptr, unifi_TrafficQueue queue); + + +/***************************************************************************** + * CardClearFromHostDataSlot - + */ +void CardClearFromHostDataSlot(card_t *card, const CsrInt16 aSlotNum); + +/***************************************************************************** + * CardGetFreeFromHostDataSlots - + */ +CsrUint16 CardGetFreeFromHostDataSlots(card_t *card); + +CsrUint16 CardAreAllFromHostDataSlotsEmpty(card_t *card); + +CsrResult card_start_processor(card_t *card, enum unifi_dbg_processors_select which); + +CsrResult card_wait_for_firmware_to_start(card_t *card, CsrUint32 *paddr); + +CsrResult unifi_dl_firmware(card_t *card, void *arg); +CsrResult unifi_dl_patch(card_t *card, void *arg, CsrUint32 boot_ctrl); +CsrResult unifi_do_loader_op(card_t *card, CsrUint32 op_addr, CsrUint8 opcode); +void* unifi_dl_fw_read_start(card_t *card, CsrInt8 is_fw); + +CsrResult unifi_coredump_handle_request(card_t *card); + +CsrResult ConvertCsrSdioToCsrHipResult(card_t *card, CsrResult csrResult); +#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE +void unifi_debug_log_to_buf(const CsrCharString *fmt, ...); +void unifi_debug_string_to_buf(const CsrCharString *str); +void unifi_debug_hex_to_buf(const CsrCharString *buff, CsrUint16 length); +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* __CARD_H__ */ diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.c b/drivers/staging/csr/csr_wifi_hip_card_sdio.c new file mode 100644 index 0000000..719c608 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.c @@ -0,0 +1,4128 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* + * --------------------------------------------------------------------------- + * FILE: csr_wifi_hip_card_sdio.c + * + * PURPOSE: Implementation of the Card API for SDIO. + * + * NOTES: + * CardInit() is called from the SDIO probe callback when a card is + * inserted. This performs the basic SDIO initialisation, enabling i/o + * etc. + * + * --------------------------------------------------------------------------- + */ +#include "csr_wifi_hip_unifi.h" +#include "csr_wifi_hip_conversions.h" +#include "csr_wifi_hip_unifiversion.h" +#include "csr_wifi_hip_card.h" +#include "csr_wifi_hip_card_sdio.h" +#include "csr_wifi_hip_chiphelper.h" + + +/* Time to wait between attempts to read MAILBOX0 */ +#define MAILBOX1_TIMEOUT 10 /* in millisecs */ +#define MAILBOX1_ATTEMPTS 200 /* 2 seconds */ + +#define MAILBOX2_TIMEOUT 5 /* in millisecs */ +#define MAILBOX2_ATTEMPTS 10 /* 50ms */ + +#define MAILBOX2_RESET_ATTEMPTS 10 +#define MAILBOX2_RESET_TIMEOUT 5 /* in millisecs */ + +#define RESET_SETTLE_DELAY 25 /* in millisecs */ + +static CsrResult card_init_slots(card_t *card); +static CsrResult card_hw_init(card_t *card); +static CsrResult firmware_present_in_flash(card_t *card); +static void bootstrap_chip_hw(card_t *card); +static CsrResult unifi_reset_hardware(card_t *card); +static CsrResult unifi_hip_init(card_t *card); +static CsrResult card_access_panic(card_t *card); +static CsrResult unifi_read_chip_version(card_t *card); + +/* + * --------------------------------------------------------------------------- + * unifi_alloc_card + * + * Allocate and initialise the card context structure. + * + * Arguments: + * sdio Pointer to SDIO context pointer to pass to low + * level i/o functions. + * ospriv Pointer to O/S private struct to pass when calling + * callbacks to the higher level system. + * + * Returns: + * Pointer to card struct, which represents the driver context or + * NULL if the allocation failed. + * --------------------------------------------------------------------------- + */ +card_t* unifi_alloc_card(CsrSdioFunction *sdio, void *ospriv) +{ + card_t *card; + CsrUint32 i; + + func_enter(); + + + card = (card_t *)CsrMemAlloc(sizeof(card_t)); + if (card == NULL) + { + return NULL; + } + CsrMemSet(card, 0, sizeof(card_t)); + + + card->sdio_if = sdio; + card->ospriv = ospriv; + + card->unifi_interrupt_seq = 1; + + /* Make these invalid. */ + card->proc_select = (CsrUint32)(-1); + card->dmem_page = (CsrUint32)(-1); + card->pmem_page = (CsrUint32)(-1); + + card->bh_reason_host = 0; + card->bh_reason_unifi = 0; + + for (i = 0; i < sizeof(card->tx_q_paused_flag) / sizeof(card->tx_q_paused_flag[0]); i++) + { + card->tx_q_paused_flag[i] = 0; + } + card->memory_resources_allocated = 0; + + card->low_power_mode = UNIFI_LOW_POWER_DISABLED; + card->periodic_wake_mode = UNIFI_PERIODIC_WAKE_HOST_DISABLED; + + card->host_state = UNIFI_HOST_STATE_AWAKE; + card->intmode = CSR_WIFI_INTMODE_DEFAULT; + + /* + * Memory resources for buffers are allocated when the chip is initialised + * because we need configuration information from the firmware. + */ + + /* + * Initialise wait queues and lists + */ + card->fh_command_queue.q_body = card->fh_command_q_body; + card->fh_command_queue.q_length = UNIFI_SOFT_COMMAND_Q_LENGTH; + + for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) + { + card->fh_traffic_queue[i].q_body = card->fh_traffic_q_body[i]; + card->fh_traffic_queue[i].q_length = UNIFI_SOFT_TRAFFIC_Q_LENGTH; + } + + + /* Initialise mini-coredump pointers in case no coredump buffers + * are requested by the OS layer. + */ + card->request_coredump_on_reset = 0; + card->dump_next_write = NULL; + card->dump_cur_read = NULL; + card->dump_buf = NULL; + +#ifdef UNIFI_DEBUG + /* Determine offset of LSB in pointer for later alignment sanity check. + * Synergy integer types have specific widths, which cause compiler + * warnings when casting pointer types, e.g. on 64-bit systems. + */ + { + CsrUint32 val = 0x01234567; + + if (*((CsrUint8 *)&val) == 0x01) + { + card->lsb = sizeof(void *) - 1; /* BE */ + } + else + { + card->lsb = 0; /* LE */ + } + } +#endif + func_exit(); + return card; +} /* unifi_alloc_card() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_init_card + * + * Reset the hardware and perform HIP initialization + * + * Arguments: + * card Pointer to card struct + * + * Returns: + * CsrResult code + * CSR_RESULT_SUCCESS if successful + * --------------------------------------------------------------------------- + */ +CsrResult unifi_init_card(card_t *card, CsrInt32 led_mask) +{ + CsrResult r; + + func_enter(); + + if (card == NULL) + { + func_exit_r(CSR_WIFI_HIP_RESULT_INVALID_VALUE); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + r = unifi_init(card); + if (r != CSR_RESULT_SUCCESS) + { + func_exit_r(r); + return r; + } + + r = unifi_hip_init(card); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + func_exit_r(r); + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to start host protocol.\n"); + func_exit_r(r); + return r; + } + + func_exit(); + return CSR_RESULT_SUCCESS; +} + + +/* + * --------------------------------------------------------------------------- + * unifi_init + * + * Init the hardware. + * + * Arguments: + * card Pointer to card struct + * + * Returns: + * CsrResult code + * CSR_RESULT_SUCCESS if successful + * --------------------------------------------------------------------------- + */ +CsrResult unifi_init(card_t *card) +{ + CsrResult r; + CsrResult csrResult; + + func_enter(); + + if (card == NULL) + { + func_exit_r(CSR_WIFI_HIP_RESULT_INVALID_VALUE); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + /* + * Disable the SDIO interrupts while initialising UniFi. + * Re-enable them when f/w is running. + */ + csrResult = CsrSdioInterruptDisable(card->sdio_if); + if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) + { + return CSR_WIFI_HIP_RESULT_NO_DEVICE; + } + + /* + * UniFi's PLL may start with a slow clock (~ 1 MHz) so initially + * set the SDIO bus clock to a similar value or SDIO accesses may + * fail. + */ + csrResult = CsrSdioMaxBusClockFrequencySet(card->sdio_if, UNIFI_SDIO_CLOCK_SAFE_HZ); + if (csrResult != CSR_RESULT_SUCCESS) + { + r = ConvertCsrSdioToCsrHipResult(card, csrResult); + func_exit_r(r); + return r; + } + card->sdio_clock_speed = UNIFI_SDIO_CLOCK_SAFE_HZ; + + /* + * Reset UniFi. Note, this only resets the WLAN function part of the chip, + * the SDIO interface is not reset. + */ + unifi_trace(card->ospriv, UDBG1, "Resetting UniFi\n"); + r = unifi_reset_hardware(card); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to reset UniFi\n"); + func_exit_r(r); + return r; + } + + /* Reset the power save mode, to be active until the MLME-reset is complete */ + r = unifi_configure_low_power_mode(card, + UNIFI_LOW_POWER_DISABLED, UNIFI_PERIODIC_WAKE_HOST_DISABLED); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to set power save mode\n"); + func_exit_r(r); + return r; + } + + /* + * Set initial value of page registers. + * The page registers will be maintained by unifi_read...() and + * unifi_write...(). + */ + card->proc_select = (CsrUint32)(-1); + card->dmem_page = (CsrUint32)(-1); + card->pmem_page = (CsrUint32)(-1); + r = unifi_write_direct16(card, ChipHelper_HOST_WINDOW3_PAGE(card->helper) * 2, 0); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to write SHARED_DMEM_PAGE\n"); + func_exit_r(r); + return r; + } + r = unifi_write_direct16(card, ChipHelper_HOST_WINDOW2_PAGE(card->helper) * 2, 0); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to write PROG_MEM2_PAGE\n"); + func_exit_r(r); + return r; + } + + /* + * If the driver has reset UniFi due to previous SDIO failure, this may + * have been due to a chip watchdog reset. In this case, the driver may + * have requested a mini-coredump which needs to be captured now the + * SDIO interface is alive. + */ + unifi_coredump_handle_request(card); + + /* + * Probe to see if the UniFi has ROM/flash to boot from. CSR6xxx should do. + */ + r = firmware_present_in_flash(card); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r == CSR_WIFI_HIP_RESULT_NOT_FOUND) + { + unifi_error(card->ospriv, "No firmware found\n"); + } + else if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Probe for Flash failed\n"); + } + + func_exit_r(r); + return r; +} /* unifi_init() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_download + * + * Load the firmware. + * + * Arguments: + * card Pointer to card struct + * led_mask Loader LED mask + * + * Returns: + * CSR_RESULT_SUCCESS on success + * CsrResult error code on failure. + * --------------------------------------------------------------------------- + */ +CsrResult unifi_download(card_t *card, CsrInt32 led_mask) +{ + CsrResult r; + void *dlpriv; + + func_enter(); + + if (card == NULL) + { + func_exit_r(CSR_WIFI_HIP_RESULT_INVALID_VALUE); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + /* Set the loader led mask */ + card->loader_led_mask = led_mask; + + /* Get the firmware file information */ + unifi_trace(card->ospriv, UDBG1, "downloading firmware...\n"); + + dlpriv = unifi_dl_fw_read_start(card, UNIFI_FW_STA); + if (dlpriv == NULL) + { + func_exit_r(CSR_WIFI_HIP_RESULT_NOT_FOUND); + return CSR_WIFI_HIP_RESULT_NOT_FOUND; + } + + /* Download the firmware. */ + r = unifi_dl_firmware(card, dlpriv); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to download firmware\n"); + func_exit_r(r); + return r; + } + + /* Free the firmware file information. */ + unifi_fw_read_stop(card->ospriv, dlpriv); + + func_exit(); + + return CSR_RESULT_SUCCESS; +} /* unifi_download() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_hip_init + * + * This function performs the f/w initialisation sequence as described + * in the Unifi Host Interface Protocol Specification. + * It allocates memory for host-side slot data and signal queues. + * + * Arguments: + * card Pointer to card struct + * + * Returns: + * CSR_RESULT_SUCCESS on success or else a CSR error code + * + * Notes: + * The firmware must have been downloaded. + * --------------------------------------------------------------------------- + */ +static CsrResult unifi_hip_init(card_t *card) +{ + CsrResult r; + CsrResult csrResult; + + func_enter(); + + r = card_hw_init(card); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to establish communication with UniFi\n"); + func_exit_r(r); + return r; + } +#ifdef CSR_PRE_ALLOC_NET_DATA + /* if there is any preallocated netdata left from the prev session free it now */ + prealloc_netdata_free(card); +#endif + /* + * Allocate memory for host-side slot data and signal queues. + * We need the config info read from the firmware to know how much + * memory to allocate. + */ + r = card_init_slots(card); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Init slots failed: %d\n", r); + func_exit_r(r); + return r; + } + + unifi_trace(card->ospriv, UDBG2, "Sending first UniFi interrupt\n"); + + r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE); + if (r != CSR_RESULT_SUCCESS) + { + func_exit_r(r); + return r; + } + + /* Enable the SDIO interrupts now that the f/w is running. */ + csrResult = CsrSdioInterruptEnable(card->sdio_if); + if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) + { + return CSR_WIFI_HIP_RESULT_NO_DEVICE; + } + + /* Signal the UniFi to start handling messages */ + r = CardGenInt(card); + if (r != CSR_RESULT_SUCCESS) + { + func_exit_r(r); + return r; + } + + func_exit(); + + return CSR_RESULT_SUCCESS; +} /* unifi_hip_init() */ + + +/* + * --------------------------------------------------------------------------- + * _build_sdio_config_data + * + * Unpack the SDIO configuration information from a buffer read from + * UniFi into a host structure. + * The data is byte-swapped for a big-endian host if necessary by the + * UNPACK... macros. + * + * Arguments: + * card Pointer to card struct + * cfg_data Destination structure to unpack into. + * cfg_data_buf Source buffer to read from. This should be the raw + * data read from UniFi. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +static void _build_sdio_config_data(sdio_config_data_t *cfg_data, + const CsrUint8 *cfg_data_buf) +{ + CsrInt16 offset = 0; + + cfg_data->version = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); + offset += SIZEOF_UINT16; + + cfg_data->sdio_ctrl_offset = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); + offset += SIZEOF_UINT16; + + cfg_data->fromhost_sigbuf_handle = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); + offset += SIZEOF_UINT16; + + cfg_data->tohost_sigbuf_handle = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); + offset += SIZEOF_UINT16; + + cfg_data->num_fromhost_sig_frags = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); + offset += SIZEOF_UINT16; + + cfg_data->num_tohost_sig_frags = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); + offset += SIZEOF_UINT16; + + cfg_data->num_fromhost_data_slots = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); + offset += SIZEOF_UINT16; + + cfg_data->num_tohost_data_slots = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); + offset += SIZEOF_UINT16; + + cfg_data->data_slot_size = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); + offset += SIZEOF_UINT16; + + cfg_data->initialised = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); + offset += SIZEOF_UINT16; + + cfg_data->overlay_size = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); + offset += SIZEOF_UINT32; + + cfg_data->data_slot_round = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); + offset += SIZEOF_UINT16; + + cfg_data->sig_frag_size = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); + offset += SIZEOF_UINT16; + + cfg_data->tohost_signal_padding = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); +} /* _build_sdio_config_data() */ + + +/* + * - Function ---------------------------------------------------------------- + * card_hw_init() + * + * Perform the initialisation procedure described in the UniFi Host + * Interface Protocol document (section 3.3.8) and read the run-time + * configuration information from the UniFi. This is stuff like number + * of bulk data slots etc. + * + * The card enumeration and SD initialisation has already been done by + * the SDIO library, see card_sdio_init(). + * + * The initialisation is done when firmware is ready, i.e. this may need + * to be called after a f/w download operation. + * + * The initialisation procedure goes like this: + * - Wait for UniFi to start-up by polling SHARED_MAILBOX1 + * - Find the symbol table and look up SLT_SDIO_SLOT_CONFIG + * - Read the config structure + * - Check the "SDIO initialised" flag, if not zero do a h/w reset and + * start again + * - Decide the number of bulk data slots to allocate, allocate them and + * set "SDIO initialised" flag (and generate an interrupt) to say so. + * + * Arguments: + * card Pointer to card struct + * + * Returns: + * CSR_RESULT_SUCEESS on success, + * a CSR error code on failure + * + * Notes: + * All data in the f/w is stored in a little endian format, without any + * padding bytes. Every read from this memory has to be transformed in + * host (cpu specific) format, before it is stored in driver's parameters + * or/and structures. Athough unifi_card_read16() and unifi_read32() do perform + * the convertion internally, unifi_readn() does not. + * --------------------------------------------------------------------------- + */ +static CsrResult card_hw_init(card_t *card) +{ + CsrUint32 slut_address; + CsrUint16 initialised; + CsrUint16 finger_print; + symbol_t slut; + sdio_config_data_t *cfg_data; + CsrUint8 cfg_data_buf[SDIO_CONFIG_DATA_SIZE]; + CsrResult r; + void *dlpriv; + CsrInt16 major, minor; + CsrInt16 search_4slut_again; + CsrResult csrResult; + + func_enter(); + + /* + * The device revision from the TPLMID_MANF and TPLMID_CARD fields + * of the CIS are available as + * card->sdio_if->pDevice->ManfID + * card->sdio_if->pDevice->AppID + */ + + /* + * Run in a loop so we can patch. + */ + do + { + /* Reset these each time around the loop. */ + search_4slut_again = 0; + cfg_data = NULL; + + r = card_wait_for_firmware_to_start(card, &slut_address); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Firmware hasn't started\n"); + func_exit_r(r); + return r; + } + unifi_trace(card->ospriv, UDBG4, "SLUT addr 0x%lX\n", slut_address); + + /* + * Firmware has started, but doesn't know full clock configuration yet + * as some of the information may be in the MIB. Therefore we set an + * initial SDIO clock speed, faster than UNIFI_SDIO_CLOCK_SAFE_HZ, for + * the patch download and subsequent firmware initialisation, and + * full speed UNIFI_SDIO_CLOCK_MAX_HZ will be set once the f/w tells us + * that it is ready. + */ + csrResult = CsrSdioMaxBusClockFrequencySet(card->sdio_if, UNIFI_SDIO_CLOCK_INIT_HZ); + if (csrResult != CSR_RESULT_SUCCESS) + { + r = ConvertCsrSdioToCsrHipResult(card, csrResult); + func_exit_r(r); + return r; + } + card->sdio_clock_speed = UNIFI_SDIO_CLOCK_INIT_HZ; + + /* + * Check the SLUT fingerprint. + * The slut_address is a generic pointer so we must use unifi_card_read16(). + */ + unifi_trace(card->ospriv, UDBG4, "Looking for SLUT finger print\n"); + finger_print = 0; + r = unifi_card_read16(card, slut_address, &finger_print); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to read SLUT finger print\n"); + func_exit_r(r); + return r; + } + + if (finger_print != SLUT_FINGERPRINT) + { + unifi_error(card->ospriv, "Failed to find Symbol lookup table fingerprint\n"); + func_exit_r(CSR_RESULT_FAILURE); + return CSR_RESULT_FAILURE; + } + + /* Symbol table starts imedately after the fingerprint */ + slut_address += 2; + + /* Search the table until either the end marker is found, or the + * loading of patch firmware invalidates the current table. + */ + while (!search_4slut_again) + { + CsrUint16 s; + CsrUint32 l; + + r = unifi_card_read16(card, slut_address, &s); + if (r != CSR_RESULT_SUCCESS) + { + func_exit_r(r); + return r; + } + slut_address += 2; + + if (s == CSR_SLT_END) + { + unifi_trace(card->ospriv, UDBG3, " found CSR_SLT_END\n"); + break; + } + + r = unifi_read32(card, slut_address, &l); + if (r != CSR_RESULT_SUCCESS) + { + func_exit_r(r); + return r; + } + slut_address += 4; + + slut.id = s; + slut.obj = l; + + unifi_trace(card->ospriv, UDBG3, " found SLUT id %02d.%08lx\n", slut.id, slut.obj); + switch (slut.id) + { + case CSR_SLT_SDIO_SLOT_CONFIG: + cfg_data = &card->config_data; + /* + * unifi_card_readn reads n bytes from the card, where data is stored + * in a little endian format, without any padding bytes. So, we + * can not just pass the cfg_data pointer or use the + * sizeof(sdio_config_data_t) since the structure in the host can + * be big endian formatted or have padding bytes for alignment. + * We use a char buffer to read the data from the card. + */ + r = unifi_card_readn(card, slut.obj, cfg_data_buf, SDIO_CONFIG_DATA_SIZE); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to read config data\n"); + func_exit_r(r); + return r; + } + /* .. and then we copy the data to the host structure */ + _build_sdio_config_data(cfg_data, cfg_data_buf); + + /* Make sure the from host data slots are what we expect + we reserve 2 for commands and there should be at least + 1 left for each access category */ + if ((cfg_data->num_fromhost_data_slots < UNIFI_RESERVED_COMMAND_SLOTS) + || (cfg_data->num_fromhost_data_slots - UNIFI_RESERVED_COMMAND_SLOTS) / UNIFI_NO_OF_TX_QS == 0) + { + unifi_error(card->ospriv, "From host data slots %d\n", cfg_data->num_fromhost_data_slots); + unifi_error(card->ospriv, "need to be (queues * x + 2) (UNIFI_RESERVED_COMMAND_SLOTS for commands)\n"); + func_exit_r(CSR_RESULT_FAILURE); + return CSR_RESULT_FAILURE; + } + + /* Configure SDIO to-block-size padding */ + if (card->sdio_io_block_pad) + { + /* + * Firmware limits the maximum padding size via data_slot_round. + * Therefore when padding to whole block sizes, the block size + * must be configured correctly by adjusting CSR_WIFI_HIP_SDIO_BLOCK_SIZE. + */ + if (cfg_data->data_slot_round < card->sdio_io_block_size) + { + unifi_error(card->ospriv, + "Configuration error: Block size of %d exceeds f/w data_slot_round of %d\n", + card->sdio_io_block_size, cfg_data->data_slot_round); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + /* + * To force the To-Host signals to be rounded up to the SDIO block + * size, we need to write the To-Host Signal Padding Fragments + * field of the SDIO configuration in UniFi. + */ + if ((card->sdio_io_block_size % cfg_data->sig_frag_size) != 0) + { + unifi_error(card->ospriv, "Configuration error: Can not pad to-host signals.\n"); + func_exit_r(CSR_WIFI_HIP_RESULT_INVALID_VALUE); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + cfg_data->tohost_signal_padding = (CsrUint16) (card->sdio_io_block_size / cfg_data->sig_frag_size); + unifi_info(card->ospriv, "SDIO block size %d requires %d padding chunks\n", + card->sdio_io_block_size, cfg_data->tohost_signal_padding); + r = unifi_card_write16(card, slut.obj + SDIO_TO_HOST_SIG_PADDING_OFFSET, cfg_data->tohost_signal_padding); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to write To-Host Signal Padding Fragments\n"); + func_exit_r(r); + return r; + } + } + + /* Reconstruct the Generic Pointer address of the + * SDIO Control Data Struct. + */ + card->sdio_ctrl_addr = cfg_data->sdio_ctrl_offset | (UNIFI_SH_DMEM << 24); + card->init_flag_addr = slut.obj + SDIO_INIT_FLAG_OFFSET; + break; + + case CSR_SLT_BUILD_ID_NUMBER: + { + CsrUint32 n; + r = unifi_read32(card, slut.obj, &n); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to read build id\n"); + func_exit_r(r); + return r; + } + card->build_id = n; + } + break; + + case CSR_SLT_BUILD_ID_STRING: + r = unifi_readnz(card, slut.obj, card->build_id_string, + sizeof(card->build_id_string)); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to read build string\n"); + func_exit_r(r); + return r; + } + break; + + case CSR_SLT_PERSISTENT_STORE_DB: + break; + + case CSR_SLT_BOOT_LOADER_CONTROL: + + /* This command copies most of the station firmware + * image from ROM into program RAM. It also clears + * out the zerod data and sets up the initialised + * data. */ + r = unifi_do_loader_op(card, slut.obj + 6, UNIFI_BOOT_LOADER_LOAD_STA); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to write loader load image command\n"); + func_exit_r(r); + return r; + } + + dlpriv = unifi_dl_fw_read_start(card, UNIFI_FW_STA); + + /* dlpriv might be NULL, we still need to do the do_loader_op step. */ + if (dlpriv != NULL) + { + /* Download the firmware. */ + r = unifi_dl_patch(card, dlpriv, slut.obj); + + /* Free the firmware file information. */ + unifi_fw_read_stop(card->ospriv, dlpriv); + + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to patch firmware\n"); + func_exit_r(r); + return r; + } + } + + /* This command starts the firmware image that we want (the + * station by default) with any patches required applied. */ + r = unifi_do_loader_op(card, slut.obj + 6, UNIFI_BOOT_LOADER_RESTART); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to write loader restart command\n"); + func_exit_r(r); + return r; + } + + /* The now running patch f/w defines a new SLUT data structure - + * the current one is no longer valid. We must drop out of the + * processing loop and enumerate the new SLUT (which may appear + * at a different offset). + */ + search_4slut_again = 1; + break; + + case CSR_SLT_PANIC_DATA_PHY: + card->panic_data_phy_addr = slut.obj; + break; + + case CSR_SLT_PANIC_DATA_MAC: + card->panic_data_mac_addr = slut.obj; + break; + + default: + /* do nothing */ + break; + } + } /* while */ + } while (search_4slut_again); + + /* Did we find the Config Data ? */ + if (cfg_data == NULL) + { + unifi_error(card->ospriv, "Failed to find SDIO_SLOT_CONFIG Symbol\n"); + func_exit_r(CSR_RESULT_FAILURE); + return CSR_RESULT_FAILURE; + } + + /* + * Has ths card already been initialised? + * If so, return an error so we do a h/w reset and start again. + */ + r = unifi_card_read16(card, card->init_flag_addr, &initialised); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to read init flag at %08lx\n", + card->init_flag_addr); + func_exit_r(r); + return r; + } + if (initialised != 0) + { + func_exit_r(CSR_RESULT_FAILURE); + return CSR_RESULT_FAILURE; + } + + + /* + * Now check the UniFi firmware version + */ + major = (cfg_data->version >> 8) & 0xFF; + minor = cfg_data->version & 0xFF; + unifi_info(card->ospriv, "UniFi f/w protocol version %d.%d (driver %d.%d)\n", + major, minor, + UNIFI_HIP_MAJOR_VERSION, UNIFI_HIP_MINOR_VERSION); + + unifi_info(card->ospriv, "Firmware build %u: %s\n", + card->build_id, card->build_id_string); + + if (major != UNIFI_HIP_MAJOR_VERSION) + { + unifi_error(card->ospriv, "UniFi f/w protocol major version (%d) is different from driver (v%d.%d)\n", + major, UNIFI_HIP_MAJOR_VERSION, UNIFI_HIP_MINOR_VERSION); +#ifndef CSR_WIFI_DISABLE_HIP_VERSION_CHECK + func_exit_r(CSR_RESULT_FAILURE); + return CSR_RESULT_FAILURE; +#endif + } + if (minor < UNIFI_HIP_MINOR_VERSION) + { + unifi_error(card->ospriv, "UniFi f/w protocol version (v%d.%d) is older than minimum required by driver (v%d.%d).\n", + major, minor, + UNIFI_HIP_MAJOR_VERSION, UNIFI_HIP_MINOR_VERSION); +#ifndef CSR_WIFI_DISABLE_HIP_VERSION_CHECK + func_exit_r(CSR_RESULT_FAILURE); + return CSR_RESULT_FAILURE; +#endif + } + + /* Read panic codes from a previous firmware panic. If the firmware has + * not panicked since power was applied (e.g. power-off hard reset) + * the stored panic codes will not be updated. + */ + unifi_read_panic(card); + + func_exit(); + return CSR_RESULT_SUCCESS; +} /* card_hw_init() */ + + +/* + * --------------------------------------------------------------------------- + * card_wait_for_unifi_to_reset + * + * Waits for a reset to complete by polling the WLAN function enable + * bit (which is cleared on reset). + * + * Arguments: + * card Pointer to card struct + * + * Returns: + * CSR_RESULT_SUCCESS on success, CSR error code on failure. + * --------------------------------------------------------------------------- + */ +static CsrResult card_wait_for_unifi_to_reset(card_t *card) +{ + CsrInt16 i; + CsrResult r; + CsrUint8 io_enable; + CsrResult csrResult; + + func_enter(); + + r = CSR_RESULT_SUCCESS; + for (i = 0; i < MAILBOX2_ATTEMPTS; i++) + { + unifi_trace(card->ospriv, UDBG1, "waiting for reset to complete, attempt %d\n", i); + if (card->chip_id > SDIO_CARD_ID_UNIFI_2) + { + /* It's quite likely that this read will timeout for the + * first few tries - especially if we have reset via + * DBG_RESET. + */ +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) + unifi_debug_log_to_buf("m0@%02X=", SDIO_IO_READY); +#endif + csrResult = CsrSdioF0Read8(card->sdio_if, SDIO_IO_READY, &io_enable); +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) + if (csrResult != CSR_RESULT_SUCCESS) + { + unifi_debug_log_to_buf("error=%X\n", csrResult); + } + else + { + unifi_debug_log_to_buf("%X\n", io_enable); + } +#endif + if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) + { + return CSR_WIFI_HIP_RESULT_NO_DEVICE; + } + r = CSR_RESULT_SUCCESS; + if (csrResult != CSR_RESULT_SUCCESS) + { + r = ConvertCsrSdioToCsrHipResult(card, csrResult); + } + } + else + { + r = sdio_read_f0(card, SDIO_IO_ENABLE, &io_enable); + } + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r == CSR_RESULT_SUCCESS) + { + CsrUint16 mbox2; + CsrInt16 enabled = io_enable & (1 << card->function); + + if (!enabled) + { + unifi_trace(card->ospriv, UDBG1, + "Reset complete (function %d is disabled) in ~ %u msecs\n", + card->function, i * MAILBOX2_TIMEOUT); + + /* Enable WLAN function and verify MAILBOX2 is zero'd */ + csrResult = CsrSdioFunctionEnable(card->sdio_if); + if (csrResult != CSR_RESULT_SUCCESS) + { + r = ConvertCsrSdioToCsrHipResult(card, csrResult); + unifi_error(card->ospriv, "CsrSdioFunctionEnable failed %d\n", r); + break; + } + } + + r = unifi_read_direct16(card, ChipHelper_SDIO_HIP_HANDSHAKE(card->helper) * 2, &mbox2); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "read HIP_HANDSHAKE failed %d\n", r); + break; + } + if (mbox2 != 0) + { + unifi_error(card->ospriv, "MAILBOX2 non-zero after reset (mbox2 = %04x)\n", mbox2); + r = CSR_RESULT_FAILURE; + } + break; + } + else + { + if (card->chip_id > SDIO_CARD_ID_UNIFI_2) + { + /* We ignore read failures for the first few reads, + * they are probably benign. */ + if (i > MAILBOX2_ATTEMPTS / 4) + { + unifi_trace(card->ospriv, UDBG1, "Failed to read CCCR IO Ready register while polling for reset\n"); + } + } + else + { + unifi_trace(card->ospriv, UDBG1, "Failed to read CCCR IO Enable register while polling for reset\n"); + } + } + CsrThreadSleep(MAILBOX2_TIMEOUT); + } + + if (r == CSR_RESULT_SUCCESS && i == MAILBOX2_ATTEMPTS) + { + unifi_trace(card->ospriv, UDBG1, "Timeout waiting for UniFi to complete reset\n"); + r = CSR_RESULT_FAILURE; + } + + func_exit(); + return r; +} /* card_wait_for_unifi_to_reset() */ + + +/* + * --------------------------------------------------------------------------- + * card_wait_for_unifi_to_disable + * + * Waits for the function to become disabled by polling the + * IO_READY bit. + * + * Arguments: + * card Pointer to card struct + * + * Returns: + * CSR_RESULT_SUCCESS on success, CSR error code on failure. + * + * Notes: This function can only be used with + * card->chip_id > SDIO_CARD_ID_UNIFI_2 + * --------------------------------------------------------------------------- + */ +static CsrResult card_wait_for_unifi_to_disable(card_t *card) +{ + CsrInt16 i; + CsrResult r; + CsrUint8 io_enable; + CsrResult csrResult; + + func_enter(); + + if (card->chip_id <= SDIO_CARD_ID_UNIFI_2) + { + unifi_error(card->ospriv, + "Function reset method not supported for chip_id=%d\n", + card->chip_id); + func_exit(); + return CSR_RESULT_FAILURE; + } + + r = CSR_RESULT_SUCCESS; + for (i = 0; i < MAILBOX2_ATTEMPTS; i++) + { + unifi_trace(card->ospriv, UDBG1, "waiting for disable to complete, attempt %d\n", i); + + /* + * It's quite likely that this read will timeout for the + * first few tries - especially if we have reset via + * DBG_RESET. + */ +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) + unifi_debug_log_to_buf("r0@%02X=", SDIO_IO_READY); +#endif + csrResult = CsrSdioF0Read8(card->sdio_if, SDIO_IO_READY, &io_enable); +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) + if (csrResult != CSR_RESULT_SUCCESS) + { + unifi_debug_log_to_buf("error=%X\n", csrResult); + } + else + { + unifi_debug_log_to_buf("%X\n", io_enable); + } +#endif + if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) + { + return CSR_WIFI_HIP_RESULT_NO_DEVICE; + } + if (csrResult == CSR_RESULT_SUCCESS) + { + CsrInt16 enabled = io_enable & (1 << card->function); + r = CSR_RESULT_SUCCESS; + if (!enabled) + { + unifi_trace(card->ospriv, UDBG1, + "Disable complete (function %d is disabled) in ~ %u msecs\n", + card->function, i * MAILBOX2_TIMEOUT); + + break; + } + } + else + { + /* + * We ignore read failures for the first few reads, + * they are probably benign. + */ + r = ConvertCsrSdioToCsrHipResult(card, csrResult); + if (i > (MAILBOX2_ATTEMPTS / 4)) + { + unifi_trace(card->ospriv, UDBG1, + "Failed to read CCCR IO Ready register while polling for disable\n"); + } + } + CsrThreadSleep(MAILBOX2_TIMEOUT); + } + + if ((r == CSR_RESULT_SUCCESS) && (i == MAILBOX2_ATTEMPTS)) + { + unifi_trace(card->ospriv, UDBG1, "Timeout waiting for UniFi to complete disable\n"); + r = CSR_RESULT_FAILURE; + } + + func_exit(); + return r; +} /* card_wait_for_unifi_to_reset() */ + + +/* + * --------------------------------------------------------------------------- + * card_wait_for_firmware_to_start + * + * Polls the MAILBOX1 register for a non-zero value. + * Then reads MAILBOX0 and forms the two values into a 32-bit address + * which is returned to the caller. + * + * Arguments: + * card Pointer to card struct + * paddr Pointer to receive the UniFi address formed + * by concatenating MAILBOX1 and MAILBOX0. + * + * Returns: + * CSR_RESULT_SUCCESS on success, CSR error code on failure. + * --------------------------------------------------------------------------- + */ +CsrResult card_wait_for_firmware_to_start(card_t *card, CsrUint32 *paddr) +{ + CsrInt32 i; + CsrUint16 mbox0, mbox1; + CsrResult r; + + func_enter(); + + /* + * Wait for UniFi to initialise its data structures by polling + * the SHARED_MAILBOX1 register. + * Experience shows this is typically 120ms. + */ + CsrThreadSleep(MAILBOX1_TIMEOUT); + + mbox1 = 0; + unifi_trace(card->ospriv, UDBG1, "waiting for MAILBOX1 to be non-zero...\n"); + for (i = 0; i < MAILBOX1_ATTEMPTS; i++) + { + r = unifi_read_direct16(card, ChipHelper_MAILBOX1(card->helper) * 2, &mbox1); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + /* These reads can fail if UniFi isn't up yet, so try again */ + unifi_warning(card->ospriv, "Failed to read UniFi Mailbox1 register\n"); + } + + if ((r == CSR_RESULT_SUCCESS) && (mbox1 != 0)) + { + unifi_trace(card->ospriv, UDBG1, "MAILBOX1 ready (0x%04X) in %u millisecs\n", + mbox1, i * MAILBOX1_TIMEOUT); + + /* Read the MAILBOX1 again in case we caught the value as it + * changed. */ + r = unifi_read_direct16(card, ChipHelper_MAILBOX1(card->helper) * 2, &mbox1); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to read UniFi Mailbox1 register for second time\n"); + func_exit_r(r); + return r; + } + unifi_trace(card->ospriv, UDBG1, "MAILBOX1 value=0x%04X\n", mbox1); + + break; + } + + CsrThreadSleep(MAILBOX1_TIMEOUT); + if ((i % 100) == 99) + { + unifi_trace(card->ospriv, UDBG2, "MAILBOX1 not ready (0x%X), still trying...\n", mbox1); + } + } + + if ((r == CSR_RESULT_SUCCESS) && (mbox1 == 0)) + { + unifi_trace(card->ospriv, UDBG1, "Timeout waiting for firmware to start, Mailbox1 still 0 after %d ms\n", + MAILBOX1_ATTEMPTS * MAILBOX1_TIMEOUT); + func_exit_r(CSR_RESULT_FAILURE); + return CSR_RESULT_FAILURE; + } + + + /* + * Complete the reset handshake by setting MAILBOX2 to 0xFFFF + */ + r = unifi_write_direct16(card, ChipHelper_SDIO_HIP_HANDSHAKE(card->helper) * 2, 0xFFFF); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to write f/w startup handshake to MAILBOX2\n"); + func_exit_r(r); + return r; + } + + + /* + * Read the Symbol Look Up Table (SLUT) offset. + * Top 16 bits are in mbox1, read the lower 16 bits from mbox0. + */ + mbox0 = 0; + r = unifi_read_direct16(card, ChipHelper_MAILBOX0(card->helper) * 2, &mbox0); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to read UniFi Mailbox0 register\n"); + func_exit_r(r); + return r; + } + + *paddr = (((CsrUint32)mbox1 << 16) | mbox0); + + func_exit(); + return CSR_RESULT_SUCCESS; +} /* card_wait_for_firmware_to_start() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_capture_panic + * + * Attempt to capture panic codes from the firmware. This may involve + * warm reset of the chip to regain access following a watchdog reset. + * + * Arguments: + * card Pointer to card struct + * + * Returns: + * CSR_RESULT_SUCCESS if panic codes were captured, or none available + * CSR_RESULT_FAILURE if the driver could not access function 1 + * --------------------------------------------------------------------------- + */ +CsrResult unifi_capture_panic(card_t *card) +{ + func_enter(); + + /* The firmware must have previously initialised to read the panic addresses + * from the SLUT + */ + if (!card->panic_data_phy_addr || !card->panic_data_mac_addr) + { + func_exit(); + return CSR_RESULT_SUCCESS; + } + + /* Ensure we can access function 1 following a panic/watchdog reset */ + if (card_access_panic(card) == CSR_RESULT_SUCCESS) + { + /* Read the panic codes */ + unifi_read_panic(card); + } + else + { + unifi_info(card->ospriv, "Unable to read panic codes"); + } + + func_exit(); + return CSR_RESULT_SUCCESS; +} + + +/* + * --------------------------------------------------------------------------- + * card_access_panic + * Attempt to read the WLAN SDIO function in order to read panic codes + * and perform various reset steps to regain access if the read fails. + * + * Arguments: + * card Pointer to card struct + * + * Returns: + * CSR_RESULT_SUCCESS if panic codes can be read + * CSR error code if panic codes can not be read + * --------------------------------------------------------------------------- + */ +static CsrResult card_access_panic(card_t *card) +{ + CsrUint16 data_u16 = 0; + CsrInt32 i; + CsrResult r, sr; + + func_enter(); + + /* A chip version of zero means that the version never got succesfully read + * during reset. In this case give up because it will not be possible to + * verify the chip version. + */ + if (!card->chip_version) + { + unifi_info(card->ospriv, "Unknown chip version\n"); + return CSR_RESULT_FAILURE; + } + + /* Ensure chip is awake or access to function 1 will fail */ + r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "unifi_set_host_state() failed %d\n", r); + return CSR_RESULT_FAILURE; /* Card is probably unpowered */ + } + CsrThreadSleep(20); + + for (i = 0; i < 3; i++) + { + sr = CsrSdioRead16(card->sdio_if, CHIP_HELPER_UNIFI_GBL_CHIP_VERSION * 2, &data_u16); + if (sr != CSR_RESULT_SUCCESS || data_u16 != card->chip_version) + { + unifi_info(card->ospriv, "Failed to read valid chip version sr=%d (0x%04x want 0x%04x) try %d\n", + sr, data_u16, card->chip_version, i); + + /* Set clock speed low */ + sr = CsrSdioMaxBusClockFrequencySet(card->sdio_if, UNIFI_SDIO_CLOCK_SAFE_HZ); + if (sr != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "CsrSdioMaxBusClockFrequencySet() failed1 %d\n", sr); + r = ConvertCsrSdioToCsrHipResult(card, sr); + } + card->sdio_clock_speed = UNIFI_SDIO_CLOCK_SAFE_HZ; + + /* First try re-enabling function in case a f/w watchdog reset disabled it */ + if (i == 0) + { + unifi_info(card->ospriv, "Try function enable\n"); + sr = CsrSdioFunctionEnable(card->sdio_if); + if (sr != CSR_RESULT_SUCCESS) + { + r = ConvertCsrSdioToCsrHipResult(card, sr); + unifi_error(card->ospriv, "CsrSdioFunctionEnable failed %d (HIP %d)\n", sr, r); + } + continue; + } + + /* Second try, set awake */ + unifi_info(card->ospriv, "Try set awake\n"); + + /* Ensure chip is awake */ + r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "unifi_set_host_state() failed2 %d\n", r); + } + + /* Set clock speed low in case setting the host state raised it, which + * would only happen if host state was previously TORPID + */ + sr = CsrSdioMaxBusClockFrequencySet(card->sdio_if, UNIFI_SDIO_CLOCK_SAFE_HZ); + if (sr != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "CsrSdioMaxBusClockFrequencySet() failed2 %d\n", sr); + } + card->sdio_clock_speed = UNIFI_SDIO_CLOCK_SAFE_HZ; + + if (i == 1) + { + continue; + } + + /* Perform a s/w reset to preserve as much as the card state as possible, + * (mainly the preserve RAM). The context will be lost for coredump - but as we + * were unable to access the WLAN function for panic, the coredump would have + * also failed without a reset. + */ + unifi_info(card->ospriv, "Try s/w reset\n"); + + r = unifi_card_hard_reset(card); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "unifi_card_hard_reset() failed %d\n", r); + } + } + else + { + if (i > 0) + { + unifi_info(card->ospriv, "Read chip version 0x%x after %d retries\n", data_u16, i); + } + break; + } + } + + r = ConvertCsrSdioToCsrHipResult(card, sr); + func_exit_r(r); + return r; +} + + +/* + * --------------------------------------------------------------------------- + * unifi_read_panic + * Reads, saves and prints panic codes stored by the firmware in UniFi's + * preserve RAM by the last panic that occurred since chip was powered. + * Nothing is saved if the panic codes are read as zero. + * + * Arguments: + * card Pointer to card struct + * + * Returns: + * --------------------------------------------------------------------------- + */ +void unifi_read_panic(card_t *card) +{ + CsrResult r; + CsrUint16 p_code, p_arg; + + func_enter(); + + /* The firmware must have previously initialised to read the panic addresses + * from the SLUT + */ + if (!card->panic_data_phy_addr || !card->panic_data_mac_addr) + { + return; + } + + /* Get the panic data from PHY */ + r = unifi_card_read16(card, card->panic_data_phy_addr, &p_code); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "capture_panic: unifi_read16 %08x failed %d\n", card->panic_data_phy_addr, r); + p_code = 0; + } + if (p_code) + { + r = unifi_card_read16(card, card->panic_data_phy_addr + 2, &p_arg); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "capture_panic: unifi_read16 %08x failed %d\n", card->panic_data_phy_addr + 2, r); + } + unifi_error(card->ospriv, "Last UniFi PHY PANIC %04x arg %04x\n", p_code, p_arg); + card->last_phy_panic_code = p_code; + card->last_phy_panic_arg = p_arg; + } + + /* Get the panic data from MAC */ + r = unifi_card_read16(card, card->panic_data_mac_addr, &p_code); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "capture_panic: unifi_read16 %08x failed %d\n", card->panic_data_mac_addr, r); + p_code = 0; + } + if (p_code) + { + r = unifi_card_read16(card, card->panic_data_mac_addr + 2, &p_arg); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "capture_panic: unifi_read16 %08x failed %d\n", card->panic_data_mac_addr + 2, r); + } + unifi_error(card->ospriv, "Last UniFi MAC PANIC %04x arg %04x\n", p_code, p_arg); + card->last_mac_panic_code = p_code; + card->last_mac_panic_arg = p_arg; + } + + func_exit(); +} + + +/* + * --------------------------------------------------------------------------- + * card_allocate_memory_resources + * + * Allocates memory for the from-host, to-host bulk data slots, + * soft queue buffers and bulk data buffers. + * + * Arguments: + * card Pointer to card struct + * + * Returns: + * CSR_RESULT_SUCCESS on success, CSR error code on failure. + * --------------------------------------------------------------------------- + */ +static CsrResult card_allocate_memory_resources(card_t *card) +{ + CsrInt16 n, i, k, r; + sdio_config_data_t *cfg_data; + + func_enter(); + + /* Reset any state carried forward from a previous life */ + card->fh_command_queue.q_rd_ptr = 0; + card->fh_command_queue.q_wr_ptr = 0; + CsrSnprintf(card->fh_command_queue.name, UNIFI_QUEUE_NAME_MAX_LENGTH, + "fh_cmd_q"); + for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) + { + card->fh_traffic_queue[i].q_rd_ptr = 0; + card->fh_traffic_queue[i].q_wr_ptr = 0; + CsrSnprintf(card->fh_traffic_queue[i].name, + UNIFI_QUEUE_NAME_MAX_LENGTH, "fh_data_q%d", i); + } +#ifndef CSR_WIFI_HIP_TA_DISABLE + unifi_ta_sampling_init(card); +#endif + /* Convenience short-cut */ + cfg_data = &card->config_data; + + /* + * Allocate memory for the from-host and to-host signal buffers. + */ + card->fh_buffer.buf = CsrMemAlloc(UNIFI_FH_BUF_SIZE); + if (card->fh_buffer.buf == NULL) + { + unifi_error(card->ospriv, "Failed to allocate memory for F-H signals\n"); + func_exit_r(CSR_WIFI_HIP_RESULT_NO_MEMORY); + return CSR_WIFI_HIP_RESULT_NO_MEMORY; + } + card->fh_buffer.bufsize = UNIFI_FH_BUF_SIZE; + card->fh_buffer.ptr = card->fh_buffer.buf; + card->fh_buffer.count = 0; + + card->th_buffer.buf = CsrMemAlloc(UNIFI_FH_BUF_SIZE); + if (card->th_buffer.buf == NULL) + { + unifi_error(card->ospriv, "Failed to allocate memory for T-H signals\n"); + func_exit_r(CSR_WIFI_HIP_RESULT_NO_MEMORY); + return CSR_WIFI_HIP_RESULT_NO_MEMORY; + } + card->th_buffer.bufsize = UNIFI_FH_BUF_SIZE; + card->th_buffer.ptr = card->th_buffer.buf; + card->th_buffer.count = 0; + + + /* + * Allocate memory for the from-host and to-host bulk data slots. + * This is done as separate CsrPmemAllocs because lots of smaller + * allocations are more likely to succeed than one huge one. + */ + + /* Allocate memory for the array of pointers */ + n = cfg_data->num_fromhost_data_slots; + + unifi_trace(card->ospriv, UDBG3, "Alloc from-host resources, %d slots.\n", n); + card->from_host_data = + (slot_desc_t *)CsrMemAlloc(n * sizeof(slot_desc_t)); + if (card->from_host_data == NULL) + { + unifi_error(card->ospriv, "Failed to allocate memory for F-H bulk data array\n"); + func_exit_r(CSR_WIFI_HIP_RESULT_NO_MEMORY); + return CSR_WIFI_HIP_RESULT_NO_MEMORY; + } + + /* Initialise from-host bulk data slots */ + for (i = 0; i < n; i++) + { + UNIFI_INIT_BULK_DATA(&card->from_host_data[i].bd); + } + + /* Allocate memory for the array used for slot host tag mapping */ + card->fh_slot_host_tag_record = + (CsrUint32 *)CsrMemAlloc(n * sizeof(CsrUint32)); + + if (card->fh_slot_host_tag_record == NULL) + { + unifi_error(card->ospriv, "Failed to allocate memory for F-H slot host tag mapping array\n"); + func_exit_r(CSR_WIFI_HIP_RESULT_NO_MEMORY); + return CSR_WIFI_HIP_RESULT_NO_MEMORY; + } + + + /* Allocate memory for the array of pointers */ + n = cfg_data->num_tohost_data_slots; + + unifi_trace(card->ospriv, UDBG3, "Alloc to-host resources, %d slots.\n", n); + card->to_host_data = + (bulk_data_desc_t *)CsrMemAlloc(n * sizeof(bulk_data_desc_t)); + if (card->to_host_data == NULL) + { + unifi_error(card->ospriv, "Failed to allocate memory for T-H bulk data array\n"); + func_exit_r(CSR_WIFI_HIP_RESULT_NO_MEMORY); + return CSR_WIFI_HIP_RESULT_NO_MEMORY; + } + + /* Initialise to-host bulk data slots */ + for (i = 0; i < n; i++) + { + UNIFI_INIT_BULK_DATA(&card->to_host_data[i]); + } + + /* + * Initialise buffers for soft Q + */ + for (i = 0; i < UNIFI_SOFT_COMMAND_Q_LENGTH; i++) + { + for (r = 0; r < UNIFI_MAX_DATA_REFERENCES; r++) + { + UNIFI_INIT_BULK_DATA(&card->fh_command_q_body[i].bulkdata[r]); + } + } + + for (k = 0; k < UNIFI_NO_OF_TX_QS; k++) + { + for (i = 0; i < UNIFI_SOFT_TRAFFIC_Q_LENGTH; i++) + { + for (r = 0; r < UNIFI_MAX_DATA_REFERENCES; r++) + { + UNIFI_INIT_BULK_DATA(&card->fh_traffic_q_body[k][i].bulkdata[r]); + } + } + } + + card->memory_resources_allocated = 1; + + func_exit(); + return CSR_RESULT_SUCCESS; +} /* card_allocate_memory_resources() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_free_bulk_data + * + * Free the data associated to a bulk data structure. + * + * Arguments: + * card Pointer to card struct + * bulk_data_slot Pointer to bulk data structure + * + * Returns: + * None. + * + * --------------------------------------------------------------------------- + */ +static void unifi_free_bulk_data(card_t *card, bulk_data_desc_t *bulk_data_slot) +{ + if (bulk_data_slot->data_length != 0) + { + unifi_net_data_free(card->ospriv, bulk_data_slot); + } +} /* unifi_free_bulk_data() */ + + +/* + * --------------------------------------------------------------------------- + * card_free_memory_resources + * + * Frees memory allocated for the from-host, to-host bulk data slots, + * soft queue buffers and bulk data buffers. + * + * Arguments: + * card Pointer to card struct + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +static void card_free_memory_resources(card_t *card) +{ + func_enter(); + + unifi_trace(card->ospriv, UDBG1, "Freeing card memory resources.\n"); + + /* Clear our internal queues */ + unifi_cancel_pending_signals(card); + + + if (card->to_host_data) + { + CsrMemFree(card->to_host_data); + card->to_host_data = NULL; + } + + if (card->from_host_data) + { + CsrMemFree(card->from_host_data); + card->from_host_data = NULL; + } + + /* free the memory for slot host tag mapping array */ + if (card->fh_slot_host_tag_record) + { + CsrMemFree(card->fh_slot_host_tag_record); + card->fh_slot_host_tag_record = NULL; + } + + if (card->fh_buffer.buf) + { + CsrMemFree(card->fh_buffer.buf); + } + card->fh_buffer.ptr = card->fh_buffer.buf = NULL; + card->fh_buffer.bufsize = 0; + card->fh_buffer.count = 0; + + if (card->th_buffer.buf) + { + CsrMemFree(card->th_buffer.buf); + } + card->th_buffer.ptr = card->th_buffer.buf = NULL; + card->th_buffer.bufsize = 0; + card->th_buffer.count = 0; + + + card->memory_resources_allocated = 0; + + func_exit(); +} /* card_free_memory_resources() */ + + +static void card_init_soft_queues(card_t *card) +{ + CsrInt16 i; + + func_enter(); + + unifi_trace(card->ospriv, UDBG1, "Initialising internal signal queues.\n"); + /* Reset any state carried forward from a previous life */ + card->fh_command_queue.q_rd_ptr = 0; + card->fh_command_queue.q_wr_ptr = 0; + CsrSnprintf(card->fh_command_queue.name, UNIFI_QUEUE_NAME_MAX_LENGTH, + "fh_cmd_q"); + for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) + { + card->fh_traffic_queue[i].q_rd_ptr = 0; + card->fh_traffic_queue[i].q_wr_ptr = 0; + CsrSnprintf(card->fh_traffic_queue[i].name, + UNIFI_QUEUE_NAME_MAX_LENGTH, "fh_data_q%d", i); + } +#ifndef CSR_WIFI_HIP_TA_DISABLE + unifi_ta_sampling_init(card); +#endif + func_exit(); +} + + +/* + * --------------------------------------------------------------------------- + * unifi_cancel_pending_signals + * + * Free the signals and associated bulk data, pending in the core. + * + * Arguments: + * card Pointer to card struct + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +void unifi_cancel_pending_signals(card_t *card) +{ + CsrInt16 i, n, r; + func_enter(); + + unifi_trace(card->ospriv, UDBG1, "Canceling pending signals.\n"); + + if (card->to_host_data) + { + /* + * Free any bulk data buffers allocated for the t-h slots + * This will clear all buffers that did not make it to + * unifi_receive_event() before cancel was request. + */ + n = card->config_data.num_tohost_data_slots; + unifi_trace(card->ospriv, UDBG3, "Freeing to-host resources, %d slots.\n", n); + for (i = 0; i < n; i++) + { + unifi_free_bulk_data(card, &card->to_host_data[i]); + } + } + + /* + * If any of the from-host bulk data has reached the card->from_host_data + * but not UniFi, we need to free the buffers here. + */ + if (card->from_host_data) + { + /* Free any bulk data buffers allocated for the f-h slots */ + n = card->config_data.num_fromhost_data_slots; + unifi_trace(card->ospriv, UDBG3, "Freeing from-host resources, %d slots.\n", n); + for (i = 0; i < n; i++) + { + unifi_free_bulk_data(card, &card->from_host_data[i].bd); + } + + for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) + { + card->dynamic_slot_data.from_host_used_slots[i] = 0; + card->dynamic_slot_data.from_host_max_slots[i] = 0; + card->dynamic_slot_data.from_host_reserved_slots[i] = 0; + } + } + + /* + * Free any bulk data buffers allocated in the soft queues. + * This covers the case where a bulk data pointer has reached the soft queue + * but not the card->from_host_data. + */ + unifi_trace(card->ospriv, UDBG3, "Freeing cmd q resources.\n"); + for (i = 0; i < UNIFI_SOFT_COMMAND_Q_LENGTH; i++) + { + for (r = 0; r < UNIFI_MAX_DATA_REFERENCES; r++) + { + unifi_free_bulk_data(card, &card->fh_command_q_body[i].bulkdata[r]); + } + } + + unifi_trace(card->ospriv, UDBG3, "Freeing traffic q resources.\n"); + for (n = 0; n < UNIFI_NO_OF_TX_QS; n++) + { + for (i = 0; i < UNIFI_SOFT_TRAFFIC_Q_LENGTH; i++) + { + for (r = 0; r < UNIFI_MAX_DATA_REFERENCES; r++) + { + unifi_free_bulk_data(card, &card->fh_traffic_q_body[n][i].bulkdata[r]); + } + } + } + + card_init_soft_queues(card); + + func_exit(); +} /* unifi_cancel_pending_signals() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_free_card + * + * Free the memory allocated for the card structure and buffers. + * + * Notes: + * The porting layer is responsible for freeing any mini-coredump buffers + * allocated when it called unifi_coredump_init(), by calling + * unifi_coredump_free() before calling this function. + * + * Arguments: + * card Pointer to card struct + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +void unifi_free_card(card_t *card) +{ + func_enter(); +#ifdef CSR_PRE_ALLOC_NET_DATA + prealloc_netdata_free(card); +#endif + /* Free any memory allocated. */ + card_free_memory_resources(card); + + /* Warn if caller didn't free coredump buffers */ + if (card->dump_buf) + { + unifi_error(card->ospriv, "Caller should call unifi_coredump_free()\n"); + unifi_coredump_free(card); /* free anyway to prevent memory leak */ + } + + CsrMemFree(card); + + func_exit(); +} /* unifi_free_card() */ + + +/* + * --------------------------------------------------------------------------- + * card_init_slots + * + * Allocate memory for host-side slot data and signal queues. + * + * Arguments: + * card Pointer to card object + * + * Returns: + * CSR error code. + * --------------------------------------------------------------------------- + */ +static CsrResult card_init_slots(card_t *card) +{ + CsrResult r; + CsrUint8 i; + + func_enter(); + + /* Allocate the buffers we need, only once. */ + if (card->memory_resources_allocated == 1) + { + card_free_memory_resources(card); + } + else + { + /* Initialise our internal command and traffic queues */ + card_init_soft_queues(card); + } + + r = card_allocate_memory_resources(card); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to allocate card memory resources.\n"); + card_free_memory_resources(card); + func_exit_r(r); + return r; + } + + if (card->sdio_ctrl_addr == 0) + { + unifi_error(card->ospriv, "Failed to find config struct!\n"); + func_exit_r(CSR_WIFI_HIP_RESULT_INVALID_VALUE); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + /* + * Set initial counts. + */ + + card->from_host_data_head = 0; + + /* Get initial signal counts from UniFi, in case it has not been reset. */ + { + CsrUint16 s; + + /* Get the from-host-signals-written count */ + r = unifi_card_read16(card, card->sdio_ctrl_addr + 0, &s); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to read from-host sig written count\n"); + func_exit_r(r); + return r; + } + card->from_host_signals_w = (CsrInt16)s; + + /* Get the to-host-signals-written count */ + r = unifi_card_read16(card, card->sdio_ctrl_addr + 6, &s); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to read to-host sig read count\n"); + func_exit_r(r); + return r; + } + card->to_host_signals_r = (CsrInt16)s; + } + + /* Set Initialised flag. */ + r = unifi_card_write16(card, card->init_flag_addr, 0x0001); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to write initialised flag\n"); + func_exit_r(r); + return r; + } + + /* Dynamic queue reservation */ + CsrMemSet(&card->dynamic_slot_data, 0, sizeof(card_dynamic_slot_t)); + + for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) + { + card->dynamic_slot_data.from_host_max_slots[i] = card->config_data.num_fromhost_data_slots - + UNIFI_RESERVED_COMMAND_SLOTS; + card->dynamic_slot_data.queue_stable[i] = FALSE; + } + + card->dynamic_slot_data.packets_interval = UNIFI_PACKETS_INTERVAL; + + func_exit(); + return CSR_RESULT_SUCCESS; +} /* card_init_slots() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_set_udi_hook + * + * Registers the udi hook that reports the sent signals to the core. + * + * Arguments: + * card Pointer to the card context struct + * udi_fn Pointer to the callback function. + * + * Returns: + * CSR_WIFI_HIP_RESULT_INVALID_VALUE if the card pointer is invalid, + * CSR_RESULT_SUCCESS on success. + * --------------------------------------------------------------------------- + */ +CsrResult unifi_set_udi_hook(card_t *card, udi_func_t udi_fn) +{ + if (card == NULL) + { + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + if (card->udi_hook == NULL) + { + card->udi_hook = udi_fn; + } + + return CSR_RESULT_SUCCESS; +} /* unifi_set_udi_hook() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_remove_udi_hook + * + * Removes the udi hook that reports the sent signals from the core. + * + * Arguments: + * card Pointer to the card context struct + * udi_fn Pointer to the callback function. + * + * Returns: + * CSR_WIFI_HIP_RESULT_INVALID_VALUE if the card pointer is invalid, + * CSR_RESULT_SUCCESS on success. + * --------------------------------------------------------------------------- + */ +CsrResult unifi_remove_udi_hook(card_t *card, udi_func_t udi_fn) +{ + if (card == NULL) + { + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + if (card->udi_hook == udi_fn) + { + card->udi_hook = NULL; + } + + return CSR_RESULT_SUCCESS; +} /* unifi_remove_udi_hook() */ + + +static void CardReassignDynamicReservation(card_t *card) +{ + CsrUint8 i; + + func_enter(); + + unifi_trace(card->ospriv, UDBG5, "Packets Txed %d %d %d %d\n", + card->dynamic_slot_data.packets_txed[0], + card->dynamic_slot_data.packets_txed[1], + card->dynamic_slot_data.packets_txed[2], + card->dynamic_slot_data.packets_txed[3]); + + /* Clear reservation and recalculate max slots */ + for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) + { + card->dynamic_slot_data.queue_stable[i] = FALSE; + card->dynamic_slot_data.from_host_reserved_slots[i] = 0; + card->dynamic_slot_data.from_host_max_slots[i] = card->config_data.num_fromhost_data_slots - + UNIFI_RESERVED_COMMAND_SLOTS; + card->dynamic_slot_data.packets_txed[i] = 0; + + unifi_trace(card->ospriv, UDBG5, "CardReassignDynamicReservation: queue %d reserved %d Max %d\n", i, + card->dynamic_slot_data.from_host_reserved_slots[i], + card->dynamic_slot_data.from_host_max_slots[i]); + } + + card->dynamic_slot_data.total_packets_txed = 0; + func_exit(); +} + + +/* Algorithm to dynamically reserve slots. The logic is based mainly on the outstanding queue + * length. Slots are reserved for particular queues during an interval and cleared after the interval. + * Each queue has three associated variables.. a) used slots - the number of slots currently occupied + * by the queue b) reserved slots - number of slots reserved specifically for the queue c) max slots - total + * slots that this queue can actually use (may be higher than reserved slots and is dependent on reserved slots + * for other queues). + * This function is called when there are no slots available for a queue. It checks to see if there are enough + * unreserved slots sufficient for this request. If available these slots are reserved for the queue. + * If there are not enough unreserved slots, a fair share for each queue is calculated based on the total slots + * and the number of active queues (any queue with existing reservation is considered active). Queues needing + * less than their fair share are allowed to have the previously reserved slots. The remaining slots are + * distributed evenly among queues that need more than the fair share + * + * A better scheme would take current bandwidth per AC into consideration when reserving slots. An + * implementation scheme could consider the relative time/service period for slots in an AC. If the firmware + * services other ACs faster than a particular AC (packets wait in the slots longer) then it is fair to reserve + * less slots for the AC + */ +static void CardCheckDynamicReservation(card_t *card, unifi_TrafficQueue queue) +{ + CsrUint16 q_len, active_queues = 0, excess_queue_slots, div_extra_slots, + queue_fair_share, reserved_slots = 0, q, excess_need_queues = 0, unmovable_slots = 0; + CsrInt32 i; + q_t *sigq; + CsrUint16 num_data_slots = card->config_data.num_fromhost_data_slots - UNIFI_RESERVED_COMMAND_SLOTS; + + func_enter(); + + /* Calculate the pending queue length */ + sigq = &card->fh_traffic_queue[queue]; + q_len = CSR_WIFI_HIP_Q_SLOTS_USED(sigq); + + if (q_len <= card->dynamic_slot_data.from_host_reserved_slots[queue]) + { + unifi_trace(card->ospriv, UDBG5, "queue %d q_len %d already has that many reserved slots, exiting\n", queue, q_len); + func_exit(); + return; + } + + /* Upper limit */ + if (q_len > num_data_slots) + { + q_len = num_data_slots; + } + + for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) + { + if (i != (CsrInt32)queue) + { + reserved_slots += card->dynamic_slot_data.from_host_reserved_slots[i]; + } + if ((i == (CsrInt32)queue) || (card->dynamic_slot_data.from_host_reserved_slots[i] > 0)) + { + active_queues++; + } + } + + unifi_trace(card->ospriv, UDBG5, "CardCheckDynamicReservation: queue %d q_len %d\n", queue, q_len); + unifi_trace(card->ospriv, UDBG5, "Active queues %d reserved slots on other queues %d\n", + active_queues, reserved_slots); + + if (reserved_slots + q_len <= num_data_slots) + { + card->dynamic_slot_data.from_host_reserved_slots[queue] = q_len; + if (q_len == num_data_slots) + { + /* This is the common case when just 1 stream is going */ + card->dynamic_slot_data.queue_stable[queue] = TRUE; + } + } + else + { + queue_fair_share = num_data_slots / active_queues; + unifi_trace(card->ospriv, UDBG5, "queue fair share %d\n", queue_fair_share); + + /* Evenly distribute slots among active queues */ + /* Find out the queues that need excess of fair share. Also find slots allocated + * to queues less than their fair share, these slots cannot be reallocated (unmovable slots) */ + + card->dynamic_slot_data.from_host_reserved_slots[queue] = q_len; + + for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) + { + if (card->dynamic_slot_data.from_host_reserved_slots[i] > queue_fair_share) + { + excess_need_queues++; + } + else + { + unmovable_slots += card->dynamic_slot_data.from_host_reserved_slots[i]; + } + } + + unifi_trace(card->ospriv, UDBG5, "Excess need queues %d\n", excess_need_queues); + + /* Now find the slots per excess demand queue */ + excess_queue_slots = (num_data_slots - unmovable_slots) / excess_need_queues; + div_extra_slots = (num_data_slots - unmovable_slots) - excess_queue_slots * excess_need_queues; + for (i = UNIFI_NO_OF_TX_QS - 1; i >= 0; i--) + { + if (card->dynamic_slot_data.from_host_reserved_slots[i] > excess_queue_slots) + { + card->dynamic_slot_data.from_host_reserved_slots[i] = excess_queue_slots; + if (div_extra_slots > 0) + { + card->dynamic_slot_data.from_host_reserved_slots[i]++; + div_extra_slots--; + } + /* No more slots will be allocated to this queue during the current interval */ + card->dynamic_slot_data.queue_stable[i] = TRUE; + unifi_trace(card->ospriv, UDBG5, "queue stable %d\n", i); + } + } + } + + /* Redistribute max slots */ + for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) + { + reserved_slots = 0; + for (q = 0; q < UNIFI_NO_OF_TX_QS; q++) + { + if (i != q) + { + reserved_slots += card->dynamic_slot_data.from_host_reserved_slots[q]; + } + } + + card->dynamic_slot_data.from_host_max_slots[i] = num_data_slots - reserved_slots; + unifi_trace(card->ospriv, UDBG5, "queue %d reserved %d Max %d\n", i, + card->dynamic_slot_data.from_host_reserved_slots[i], + card->dynamic_slot_data.from_host_max_slots[i]); + } + + func_exit(); +} + + +/* + * --------------------------------------------------------------------------- + * CardClearFromHostDataSlot + * + * Clear a the given data slot, making it available again. + * + * Arguments: + * card Pointer to Card object + * slot Index of the signal slot to clear. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +void CardClearFromHostDataSlot(card_t *card, const CsrInt16 slot) +{ + CsrUint8 queue = card->from_host_data[slot].queue; + const void *os_data_ptr = card->from_host_data[slot].bd.os_data_ptr; + + func_enter(); + + if (card->from_host_data[slot].bd.data_length == 0) + { + unifi_warning(card->ospriv, + "Surprise: request to clear an already free FH data slot: %d\n", + slot); + func_exit(); + return; + } + + if (os_data_ptr == NULL) + { + unifi_warning(card->ospriv, + "Clearing FH data slot %d: has null payload, len=%d\n", + slot, card->from_host_data[slot].bd.data_length); + } + + /* Free card->from_host_data[slot].bd.os_net_ptr here. */ + /* Mark slot as free by setting length to 0. */ + unifi_free_bulk_data(card, &card->from_host_data[slot].bd); + if (queue < UNIFI_NO_OF_TX_QS) + { + if (card->dynamic_slot_data.from_host_used_slots[queue] == 0) + { + unifi_error(card->ospriv, "Goofed up used slots q = %d used slots = %d\n", + queue, + card->dynamic_slot_data.from_host_used_slots[queue]); + } + else + { + card->dynamic_slot_data.from_host_used_slots[queue]--; + } + card->dynamic_slot_data.packets_txed[queue]++; + card->dynamic_slot_data.total_packets_txed++; + if (card->dynamic_slot_data.total_packets_txed >= card->dynamic_slot_data.packets_interval) + { + CardReassignDynamicReservation(card); + } + } + + unifi_trace(card->ospriv, UDBG4, "CardClearFromHostDataSlot: slot %d recycled %p\n", slot, os_data_ptr); + + func_exit(); +} /* CardClearFromHostDataSlot() */ + + +CsrUint16 CardGetDataSlotSize(card_t *card) +{ + return card->config_data.data_slot_size; +} /* CardGetDataSlotSize() */ + + +/* + * --------------------------------------------------------------------------- + * CardGetFreeFromHostDataSlots + * + * Retrieve the number of from-host bulk data slots available. + * + * Arguments: + * card Pointer to the card context struct + * + * Returns: + * Number of free from-host bulk data slots. + * --------------------------------------------------------------------------- + */ +CsrUint16 CardGetFreeFromHostDataSlots(card_t *card) +{ + CsrUint16 i, n = 0; + + func_enter(); + + /* First two slots reserved for MLME */ + for (i = 0; i < card->config_data.num_fromhost_data_slots; i++) + { + if (card->from_host_data[i].bd.data_length == 0) + { + /* Free slot */ + n++; + } + } + + func_exit(); + return n; +} /* CardGetFreeFromHostDataSlots() */ + + +/* + * --------------------------------------------------------------------------- + * CardAreAllFromHostDataSlotsEmpty + * + * Returns the state of from-host bulk data slots. + * + * Arguments: + * card Pointer to the card context struct + * + * Returns: + * 1 The from-host bulk data slots are all empty (available). + * 0 Some or all the from-host bulk data slots are in use. + * --------------------------------------------------------------------------- + */ +CsrUint16 CardAreAllFromHostDataSlotsEmpty(card_t *card) +{ + CsrUint16 i; + + for (i = 0; i < card->config_data.num_fromhost_data_slots; i++) + { + if (card->from_host_data[i].bd.data_length != 0) + { + return 0; + } + } + + return 1; +} /* CardGetFreeFromHostDataSlots() */ + + +static CsrResult unifi_identify_hw(card_t *card) +{ + func_enter(); + + card->chip_id = card->sdio_if->sdioId.cardId; + card->function = card->sdio_if->sdioId.sdioFunction; + card->sdio_io_block_size = card->sdio_if->blockSize; + + /* If SDIO controller doesn't support byte mode CMD53, pad transfers to block sizes */ + card->sdio_io_block_pad = (card->sdio_if->features & CSR_SDIO_FEATURE_BYTE_MODE)?FALSE : TRUE; + + /* + * Setup the chip helper so that we can access the registers (and + * also tell what sub-type of HIP we should use). + */ + card->helper = ChipHelper_GetVersionSdio((CsrUint8)card->chip_id); + if (!card->helper) + { + unifi_error(card->ospriv, "Null ChipHelper\n"); + } + + unifi_info(card->ospriv, "Chip ID 0x%02X Function %u Block Size %u Name %s(%s)\n", + card->chip_id, card->function, card->sdio_io_block_size, + ChipHelper_MarketingName(card->helper), + ChipHelper_FriendlyName(card->helper)); + + func_exit(); + return CSR_RESULT_SUCCESS; +} /* unifi_identify_hw() */ + + +static CsrResult unifi_prepare_hw(card_t *card) +{ + CsrResult r; + CsrResult csrResult; + enum unifi_host_state old_state = card->host_state; + + func_enter(); + + r = unifi_identify_hw(card); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to identify hw\n"); + func_exit_r(r); + return r; + } + + unifi_trace(card->ospriv, UDBG1, + "%s mode SDIO\n", card->sdio_io_block_pad?"Block" : "Byte"); + /* + * Chip must be a awake or blocks that are asleep may not get + * reset. We can only do this after we have read the chip_id. + */ + r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + + if (old_state == UNIFI_HOST_STATE_TORPID) + { + /* Ensure the initial clock rate is set; if a reset occured when the chip was + * TORPID, unifi_set_host_state() may have raised it to MAX. + */ + csrResult = CsrSdioMaxBusClockFrequencySet(card->sdio_if, UNIFI_SDIO_CLOCK_INIT_HZ); + if (csrResult != CSR_RESULT_SUCCESS) + { + r = ConvertCsrSdioToCsrHipResult(card, csrResult); + func_exit_r(r); + return r; + } + card->sdio_clock_speed = UNIFI_SDIO_CLOCK_INIT_HZ; + } + + /* + * The WLAN function must be enabled to access MAILBOX2 and DEBUG_RST + * registers. + */ + csrResult = CsrSdioFunctionEnable(card->sdio_if); + if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) + { + return CSR_WIFI_HIP_RESULT_NO_DEVICE; + } + if (csrResult != CSR_RESULT_SUCCESS) + { + r = ConvertCsrSdioToCsrHipResult(card, csrResult); + /* Can't enable WLAN function. Try resetting the SDIO block. */ + unifi_error(card->ospriv, "Failed to re-enable function %d.\n", card->function); + func_exit_r(r); + return r; + } + + /* + * Poke some registers to make sure the PLL has started, + * otherwise memory accesses are likely to fail. + */ + bootstrap_chip_hw(card); + + /* Try to read the chip version from register. */ + r = unifi_read_chip_version(card); + if (r != CSR_RESULT_SUCCESS) + { + func_exit_r(r); + return r; + } + + func_exit(); + return CSR_RESULT_SUCCESS; +} /* unifi_prepare_hw() */ + + +static CsrResult unifi_read_chip_version(card_t *card) +{ + CsrUint32 gbl_chip_version; + CsrResult r; + CsrUint16 ver; + + func_enter(); + + gbl_chip_version = ChipHelper_GBL_CHIP_VERSION(card->helper); + + /* Try to read the chip version from register. */ + if (gbl_chip_version != 0) + { + r = unifi_read_direct16(card, gbl_chip_version * 2, &ver); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to read GBL_CHIP_VERSION\n"); + func_exit_r(r); + return r; + } + card->chip_version = ver; + } + else + { + unifi_info(card->ospriv, "Unknown Chip ID, cannot locate GBL_CHIP_VERSION\n"); + r = CSR_RESULT_FAILURE; + } + + unifi_info(card->ospriv, "Chip Version 0x%04X\n", card->chip_version); + + func_exit_r(r); + return r; +} /* unifi_read_chip_version() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_reset_hardware + * + * Execute the UniFi reset sequence. + * + * Note: This may fail if the chip is going TORPID so retry at + * least once. + * + * Arguments: + * card - pointer to card context structure + * + * Returns: + * CSR_RESULT_SUCCESS on success, CSR error otherwise. + * + * Notes: + * Some platforms (e.g. Windows Vista) do not allow access to registers + * that are necessary for a software soft reset. + * --------------------------------------------------------------------------- + */ +static CsrResult unifi_reset_hardware(card_t *card) +{ + CsrResult r; + CsrUint16 new_block_size = UNIFI_IO_BLOCK_SIZE; + CsrResult csrResult; + + func_enter(); + + /* Errors returned by unifi_prepare_hw() are not critical at this point */ + r = unifi_prepare_hw(card); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + + /* First try SDIO controller reset, which may power cycle the UniFi, assert + * its reset line, or not be implemented depending on the platform. + */ + unifi_info(card->ospriv, "Calling CsrSdioHardReset\n"); + csrResult = CsrSdioHardReset(card->sdio_if); + if (csrResult == CSR_RESULT_SUCCESS) + { + unifi_info(card->ospriv, "CsrSdioHardReset succeeded on reseting UniFi\n"); + r = unifi_prepare_hw(card); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "unifi_prepare_hw failed after hard reset\n"); + func_exit_r(r); + return r; + } + } + else if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) + { + return CSR_WIFI_HIP_RESULT_NO_DEVICE; + } + else + { + /* Falling back to software hard reset methods */ + unifi_info(card->ospriv, "Falling back to software hard reset\n"); + r = unifi_card_hard_reset(card); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "software hard reset failed\n"); + func_exit_r(r); + return r; + } + + /* If we fell back to unifi_card_hard_reset() methods, chip version may + * not have been read. (Note in the unlikely event that it is zero, + * it will be harmlessly read again) + */ + if (card->chip_version == 0) + { + r = unifi_read_chip_version(card); + if (r != CSR_RESULT_SUCCESS) + { + func_exit_r(r); + return r; + } + } + } + +#ifdef CSR_WIFI_HIP_SDIO_BLOCK_SIZE + new_block_size = CSR_WIFI_HIP_SDIO_BLOCK_SIZE; +#endif + + /* After hard reset, we need to restore the SDIO block size */ + csrResult = CsrSdioBlockSizeSet(card->sdio_if, new_block_size); + r = ConvertCsrSdioToCsrHipResult(card, csrResult); + + /* Warn if a different block size was achieved by the transport */ + if (card->sdio_if->blockSize != new_block_size) + { + unifi_info(card->ospriv, + "Actually got block size %d\n", card->sdio_if->blockSize); + } + + /* sdio_io_block_size always needs be updated from the achieved block size, + * as it is used by the OS layer to allocate memory in unifi_net_malloc(). + * Controllers which don't support block mode (e.g. CSPI) will report a + * block size of zero. + */ + if (card->sdio_if->blockSize == 0) + { + unifi_info(card->ospriv, "Block size 0, block mode not available\n"); + + /* Set sdio_io_block_size to 1 so that unifi_net_data_malloc() has a + * sensible rounding value. Elsewhere padding will already be + * disabled because the controller supports byte mode. + */ + card->sdio_io_block_size = 1; + + /* Controller features must declare support for byte mode */ + if (!(card->sdio_if->features & CSR_SDIO_FEATURE_BYTE_MODE)) + { + unifi_error(card->ospriv, "Requires byte mode\n"); + r = CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + } + else + { + /* Padding will be enabled if CSR_SDIO_FEATURE_BYTE_MODE isn't set */ + card->sdio_io_block_size = card->sdio_if->blockSize; + } + + + func_exit_r(r); + return r; +} /* unifi_reset_hardware() */ + + +/* + * --------------------------------------------------------------------------- + * card_reset_method_io_enable + * + * Issue a hard reset to the hw writing the IO_ENABLE. + * + * Arguments: + * card Pointer to Card object + * + * Returns: + * 0 on success, + * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected + * CSR_RESULT_FAILURE if an SDIO error occurred or if a response + * was not seen in the expected time + * --------------------------------------------------------------------------- + */ +static CsrResult card_reset_method_io_enable(card_t *card) +{ + CsrResult r; + CsrResult csrResult; + + func_enter(); + + /* + * This resets only function 1, so should be used in + * preference to the method below (CSR_FUNC_EN) + */ + unifi_trace(card->ospriv, UDBG1, "Hard reset (IO_ENABLE)\n"); + + csrResult = CsrSdioFunctionDisable(card->sdio_if); + if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) + { + return CSR_WIFI_HIP_RESULT_NO_DEVICE; + } + if (csrResult != CSR_RESULT_SUCCESS) + { + r = ConvertCsrSdioToCsrHipResult(card, csrResult); + unifi_warning(card->ospriv, "SDIO error writing IO_ENABLE: %d\n", r); + } + else + { + /* Delay here to let the reset take affect. */ + CsrThreadSleep(RESET_SETTLE_DELAY); + + r = card_wait_for_unifi_to_disable(card); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + + if (r == CSR_RESULT_SUCCESS) + { + r = card_wait_for_unifi_to_reset(card); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + } + } + + if (r != CSR_RESULT_SUCCESS) + { + unifi_trace(card->ospriv, UDBG1, "Hard reset (CSR_FUNC_EN)\n"); + + r = sdio_write_f0(card, SDIO_CSR_FUNC_EN, 0); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_warning(card->ospriv, "SDIO error writing SDIO_CSR_FUNC_EN: %d\n", r); + func_exit_r(r); + return r; + } + else + { + /* Delay here to let the reset take affect. */ + CsrThreadSleep(RESET_SETTLE_DELAY); + + r = card_wait_for_unifi_to_reset(card); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + } + } + + if (r != CSR_RESULT_SUCCESS) + { + unifi_warning(card->ospriv, "card_reset_method_io_enable failed to reset UniFi\n"); + } + + func_exit(); + return r; +} /* card_reset_method_io_enable() */ + + +/* + * --------------------------------------------------------------------------- + * card_reset_method_dbg_reset + * + * Issue a hard reset to the hw writing the DBG_RESET. + * + * Arguments: + * card Pointer to Card object + * + * Returns: + * CSR_RESULT_SUCCESS on success, + * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected + * CSR_RESULT_FAILURE if an SDIO error occurred or if a response + * was not seen in the expected time + * --------------------------------------------------------------------------- + */ +static CsrResult card_reset_method_dbg_reset(card_t *card) +{ + CsrResult r; + + func_enter(); + + /* + * Prepare UniFi for h/w reset + */ + if (card->host_state == UNIFI_HOST_STATE_TORPID) + { + r = unifi_set_host_state(card, UNIFI_HOST_STATE_DROWSY); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to set UNIFI_HOST_STATE_DROWSY\n"); + func_exit_r(r); + return r; + } + CsrThreadSleep(5); + } + + r = unifi_card_stop_processor(card, UNIFI_PROC_BOTH); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Can't stop processors\n"); + func_exit(); + return r; + } + + unifi_trace(card->ospriv, UDBG1, "Hard reset (DBG_RESET)\n"); + + /* + * This register write may fail. The debug reset resets + * parts of the Function 0 sections of the chip, and + * therefore the response cannot be sent back to the host. + */ + r = unifi_write_direct_8_or_16(card, ChipHelper_DBG_RESET(card->helper) * 2, 1); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_warning(card->ospriv, "SDIO error writing DBG_RESET: %d\n", r); + func_exit_r(r); + return r; + } + + /* Delay here to let the reset take affect. */ + CsrThreadSleep(RESET_SETTLE_DELAY); + + r = card_wait_for_unifi_to_reset(card); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_warning(card->ospriv, "card_reset_method_dbg_reset failed to reset UniFi\n"); + } + + func_exit(); + return r; +} /* card_reset_method_dbg_reset() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_card_hard_reset + * + * Issue reset to hardware, by writing to registers on the card. + * Power to the card is preserved. + * + * Arguments: + * card Pointer to Card object + * + * Returns: + * CSR_RESULT_SUCCESS on success, + * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected + * CSR_RESULT_FAILURE if an SDIO error occurred or if a response + * was not seen in the expected time + * --------------------------------------------------------------------------- + */ +CsrResult unifi_card_hard_reset(card_t *card) +{ + CsrResult r; + const struct chip_helper_reset_values *init_data; + CsrUint32 chunks; + + func_enter(); + + /* Clear cache of page registers */ + card->proc_select = (CsrUint32)(-1); + card->dmem_page = (CsrUint32)(-1); + card->pmem_page = (CsrUint32)(-1); + + /* + * We need to have a valid card->helper before we use software hard reset. + * If unifi_identify_hw() fails to get the card ID, it probably means + * that there is no way to talk to the h/w. + */ + r = unifi_identify_hw(card); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "unifi_card_hard_reset failed to identify h/w\n"); + func_exit(); + return r; + } + + /* Search for some reset code. */ + chunks = ChipHelper_HostResetSequence(card->helper, &init_data); + if (chunks != 0) + { + unifi_error(card->ospriv, + "Hard reset (Code download) is unsupported\n"); + + func_exit_r(CSR_RESULT_FAILURE); + return CSR_RESULT_FAILURE; + } + + if (card->chip_id > SDIO_CARD_ID_UNIFI_2) + { + /* The HIP spec considers this a bus-specific reset. + * This resets only function 1, so should be used in + * preference to the method below (CSR_FUNC_EN) + * If this method fails, it means that the f/w is probably + * not running. In this case, try the DBG_RESET method. + */ + r = card_reset_method_io_enable(card); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r == CSR_RESULT_SUCCESS) + { + func_exit(); + return r; + } + } + + /* Software hard reset */ + r = card_reset_method_dbg_reset(card); + + func_exit_r(r); + return r; +} /* unifi_card_hard_reset() */ + + +/* + * --------------------------------------------------------------------------- + * + * CardGenInt + * + * Prod the card. + * This function causes an internal interrupt to be raised in the + * UniFi chip. It is used to signal the firmware that some action has + * been completed. + * The UniFi Host Interface asks that the value used increments for + * debugging purposes. + * + * Arguments: + * card Pointer to Card object + * + * Returns: + * CSR_RESULT_SUCCESS on success, + * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected + * CSR_RESULT_FAILURE if an SDIO error occurred or if a response + * was not seen in the expected time + * --------------------------------------------------------------------------- + */ +CsrResult CardGenInt(card_t *card) +{ + CsrResult r; + + func_enter(); + + if (card->chip_id > SDIO_CARD_ID_UNIFI_2) + { + r = sdio_write_f0(card, SDIO_CSR_FROM_HOST_SCRATCH0, + (CsrUint8)card->unifi_interrupt_seq); + } + else + { + r = unifi_write_direct_8_or_16(card, + ChipHelper_SHARED_IO_INTERRUPT(card->helper) * 2, + (CsrUint8)card->unifi_interrupt_seq); + } + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "SDIO error writing UNIFI_SHARED_IO_INTERRUPT: %d\n", r); + func_exit_r(r); + return r; + } + + card->unifi_interrupt_seq++; + + func_exit(); + return CSR_RESULT_SUCCESS; +} /* CardGenInt() */ + + +/* + * --------------------------------------------------------------------------- + * CardEnableInt + * + * Enable the outgoing SDIO interrupt from UniFi to the host. + * + * Arguments: + * card Pointer to Card object + * + * Returns: + * CSR_RESULT_SUCCESS on success, + * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected + * CSR_RESULT_FAILURE if an SDIO error occurred, + * --------------------------------------------------------------------------- + */ +CsrResult CardEnableInt(card_t *card) +{ + CsrResult r; + CsrUint8 int_enable; + + r = sdio_read_f0(card, SDIO_INT_ENABLE, &int_enable); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "SDIO error reading SDIO_INT_ENABLE\n"); + return r; + } + + int_enable |= (1 << card->function) | UNIFI_SD_INT_ENABLE_IENM; + + r = sdio_write_f0(card, SDIO_INT_ENABLE, int_enable); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "SDIO error writing SDIO_INT_ENABLE\n"); + return r; + } + + return CSR_RESULT_SUCCESS; +} /* CardEnableInt() */ + + +/* + * --------------------------------------------------------------------------- + * CardDisableInt + * + * Disable the outgoing SDIO interrupt from UniFi to the host. + * + * Arguments: + * card Pointer to Card object + * + * Returns: + * CSR_RESULT_SUCCESS on success, + * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected + * CSR_RESULT_FAILURE if an SDIO error occurred, + * --------------------------------------------------------------------------- + */ +CsrResult CardDisableInt(card_t *card) +{ + CsrResult r; + CsrUint8 int_enable; + + r = sdio_read_f0(card, SDIO_INT_ENABLE, &int_enable); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "SDIO error reading SDIO_INT_ENABLE\n"); + return r; + } + + int_enable &= ~(1 << card->function); + + r = sdio_write_f0(card, SDIO_INT_ENABLE, int_enable); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "SDIO error writing SDIO_INT_ENABLE\n"); + return r; + } + + return CSR_RESULT_SUCCESS; +} /* CardDisableInt() */ + + +/* + * --------------------------------------------------------------------------- + * CardPendingInt + * + * Determine whether UniFi is currently asserting the SDIO interrupt + * request. + * + * Arguments: + * card Pointer to Card object + * pintr Pointer to location to write interrupt status, + * TRUE if interrupt pending, + * FALSE if no interrupt pending. + * Returns: + * CSR_RESULT_SUCCESS interrupt status read successfully + * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected + * CSR_RESULT_FAILURE if an SDIO error occurred, + * --------------------------------------------------------------------------- + */ +CsrResult CardPendingInt(card_t *card, CsrBool *pintr) +{ + CsrResult r; + CsrUint8 pending; + + *pintr = FALSE; + + r = sdio_read_f0(card, SDIO_INT_PENDING, &pending); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "SDIO error reading SDIO_INT_PENDING\n"); + return r; + } + + *pintr = (pending & (1 << card->function))?TRUE : FALSE; + + return CSR_RESULT_SUCCESS; +} /* CardPendingInt() */ + + +/* + * --------------------------------------------------------------------------- + * CardClearInt + * + * Clear the UniFi SDIO interrupt request. + * + * Arguments: + * card Pointer to Card object + * + * Returns: + * CSR_RESULT_SUCCESS if pending interrupt was cleared, or no pending interrupt. + * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected + * CSR_RESULT_FAILURE if an SDIO error occurred, + * --------------------------------------------------------------------------- + */ +CsrResult CardClearInt(card_t *card) +{ + CsrResult r; + CsrBool intr; + + if (card->chip_id > SDIO_CARD_ID_UNIFI_2) + { + /* CardPendingInt() sets intr, if there is a pending interrupt */ + r = CardPendingInt(card, &intr); + if (intr == FALSE) + { + return r; + } + + r = sdio_write_f0(card, SDIO_CSR_HOST_INT_CLEAR, 1); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "SDIO error writing SDIO_CSR_HOST_INT_CLEAR\n"); + } + } + else + { + r = unifi_write_direct_8_or_16(card, + ChipHelper_SDIO_HOST_INT(card->helper) * 2, + 0); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "SDIO error writing UNIFI_SDIO_HOST_INT\n"); + } + } + + return r; +} /* CardClearInt() */ + + +/* + * --------------------------------------------------------------------------- + * CardIntEnabled + * + * Determine whether UniFi is currently asserting the SDIO interrupt + * request. + * + * Arguments: + * card Pointer to Card object + * enabled Pointer to location to write interrupt enable status, + * TRUE if interrupts enabled, + * FALSE if interupts disabled. + * + * Returns: + * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected + * CSR_RESULT_FAILURE if an SDIO error occurred, + * --------------------------------------------------------------------------- + */ +CsrResult CardIntEnabled(card_t *card, CsrBool *enabled) +{ + CsrResult r; + CsrUint8 int_enable; + + r = sdio_read_f0(card, SDIO_INT_ENABLE, &int_enable); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "SDIO error reading SDIO_INT_ENABLE\n"); + return r; + } + + *enabled = (int_enable & (1 << card->function))?TRUE : FALSE; + + return CSR_RESULT_SUCCESS; +} /* CardIntEnabled() */ + + +/* + * --------------------------------------------------------------------------- + * CardWriteBulkData + * Allocate slot in the pending bulkdata arrays and assign it to a signal's + * bulkdata reference. The slot is then ready for UniFi's bulkdata commands + * to transfer the data to/from the host. + * + * Arguments: + * card Pointer to Card object + * csptr Pending signal pointer, including bulkdata ref + * queue Traffic queue that this signal is using + * + * Returns: + * CSR_RESULT_SUCCESS if a free slot was assigned + * CSR_RESULT_FAILURE if no slot was available + * --------------------------------------------------------------------------- + */ +CsrResult CardWriteBulkData(card_t *card, card_signal_t *csptr, unifi_TrafficQueue queue) +{ + CsrUint16 i, slots[UNIFI_MAX_DATA_REFERENCES], j = 0; + CsrUint8 *packed_sigptr, num_slots_required = 0; + bulk_data_desc_t *bulkdata = csptr->bulkdata; + CsrInt16 h, nslots; + + func_enter(); + + /* Count the number of slots required */ + for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) + { + if (bulkdata[i].data_length != 0) + { + num_slots_required++; + } + } + + /* Get the slot numbers */ + if (num_slots_required != 0) + { + /* Last 2 slots for MLME */ + if (queue == UNIFI_TRAFFIC_Q_MLME) + { + h = card->config_data.num_fromhost_data_slots - UNIFI_RESERVED_COMMAND_SLOTS; + for (i = 0; i < card->config_data.num_fromhost_data_slots; i++) + { + if (card->from_host_data[h].bd.data_length == 0) + { + /* Free data slot, claim it */ + slots[j++] = h; + if (j == num_slots_required) + { + break; + } + } + + if (++h >= card->config_data.num_fromhost_data_slots) + { + h = 0; + } + } + } + else + { + if (card->dynamic_slot_data.from_host_used_slots[queue] + < card->dynamic_slot_data.from_host_max_slots[queue]) + { + /* Data commands get a free slot only after a few checks */ + nslots = card->config_data.num_fromhost_data_slots - UNIFI_RESERVED_COMMAND_SLOTS; + + h = card->from_host_data_head; + + for (i = 0; i < nslots; i++) + { + if (card->from_host_data[h].bd.data_length == 0) + { + /* Free data slot, claim it */ + slots[j++] = h; + if (j == num_slots_required) + { + break; + } + } + + if (++h >= nslots) + { + h = 0; + } + } + card->from_host_data_head = h; + } + } + + /* Required number of slots are not available, bail out */ + if (j != num_slots_required) + { + unifi_trace(card->ospriv, UDBG5, "CardWriteBulkData: didn't find free slot/s\n"); + + /* If we haven't already reached the stable state we can ask for reservation */ + if ((queue != UNIFI_TRAFFIC_Q_MLME) && (card->dynamic_slot_data.queue_stable[queue] == FALSE)) + { + CardCheckDynamicReservation(card, queue); + } + + for (i = 0; i < card->config_data.num_fromhost_data_slots; i++) + { + unifi_trace(card->ospriv, UDBG5, "fh data slot %d: %d\n", i, card->from_host_data[i].bd.data_length); + } + func_exit(); + return CSR_RESULT_FAILURE; + } + } + + packed_sigptr = csptr->sigbuf; + + /* Fill in the slots with data */ + j = 0; + for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) + { + if (bulkdata[i].data_length == 0) + { + /* Zero-out the DATAREF in the signal */ + SET_PACKED_DATAREF_SLOT(packed_sigptr, i, 0); + SET_PACKED_DATAREF_LEN(packed_sigptr, i, 0); + } + else + { + /* + * Fill in the slot number in the SIGNAL structure but + * preserve the offset already in there + */ + SET_PACKED_DATAREF_SLOT(packed_sigptr, i, slots[j] | (((CsrUint16)packed_sigptr[SIZEOF_SIGNAL_HEADER + (i * SIZEOF_DATAREF) + 1]) << 8)); + SET_PACKED_DATAREF_LEN(packed_sigptr, i, bulkdata[i].data_length); + + /* Do not copy the data, just store the information to them */ + card->from_host_data[slots[j]].bd.os_data_ptr = bulkdata[i].os_data_ptr; + card->from_host_data[slots[j]].bd.os_net_buf_ptr = bulkdata[i].os_net_buf_ptr; + card->from_host_data[slots[j]].bd.data_length = bulkdata[i].data_length; + card->from_host_data[slots[j]].bd.net_buf_length = bulkdata[i].net_buf_length; + card->from_host_data[slots[j]].queue = queue; + + unifi_trace(card->ospriv, UDBG4, "CardWriteBulkData sig=0x%x, fh slot %d = %p\n", + GET_SIGNAL_ID(packed_sigptr), i, bulkdata[i].os_data_ptr); + + /* Sanity-check that the bulk data desc being assigned to the slot + * actually has a payload. + */ + if (!bulkdata[i].os_data_ptr) + { + unifi_error(card->ospriv, "Assign null os_data_ptr (len=%d) fh slot %d, i=%d, q=%d, sig=0x%x", + bulkdata[i].data_length, slots[j], i, queue, GET_SIGNAL_ID(packed_sigptr)); + } + + j++; + if (queue < UNIFI_NO_OF_TX_QS) + { + card->dynamic_slot_data.from_host_used_slots[queue]++; + } + } + } + + func_exit(); + + return CSR_RESULT_SUCCESS; +} /* CardWriteBulkData() */ + + +/* + * --------------------------------------------------------------------------- + * card_find_data_slot + * + * Dereference references to bulk data slots into pointers to real data. + * + * Arguments: + * card Pointer to the card struct. + * slot Slot number from a signal structure + * + * Returns: + * Pointer to entry in bulk_data_slot array. + * --------------------------------------------------------------------------- + */ +bulk_data_desc_t* card_find_data_slot(card_t *card, CsrInt16 slot) +{ + CsrInt16 sn; + bulk_data_desc_t *bd; + + sn = slot & 0x7FFF; + + /* ?? check sanity of slot number ?? */ + + if (slot & SLOT_DIR_TO_HOST) + { + bd = &card->to_host_data[sn]; + } + else + { + bd = &card->from_host_data[sn].bd; + } + + return bd; +} /* card_find_data_slot() */ + + +/* + * --------------------------------------------------------------------------- + * firmware_present_in_flash + * + * Probe for external Flash that looks like it might contain firmware. + * + * If Flash is not present, reads always return 0x0008. + * If Flash is present, but empty, reads return 0xFFFF. + * Anything else is considered to be firmware. + * + * Arguments: + * card Pointer to card struct + * + * Returns: + * CSR_RESULT_SUCCESS firmware is present in ROM or flash + * CSR_WIFI_HIP_RESULT_NOT_FOUND firmware is not present in ROM or flash + * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected + * CSR_RESULT_FAILURE if an SDIO error occurred + * --------------------------------------------------------------------------- + */ +static CsrResult firmware_present_in_flash(card_t *card) +{ + CsrResult r; + CsrUint16 m1, m5; + + if (ChipHelper_HasRom(card->helper)) + { + return CSR_RESULT_SUCCESS; + } + if (!ChipHelper_HasFlash(card->helper)) + { + return CSR_WIFI_HIP_RESULT_NOT_FOUND; + } + + /* + * Examine the Flash locations that are the power-on default reset + * vectors of the XAP processors. + * These are words 1 and 5 in Flash. + */ + r = unifi_card_read16(card, UNIFI_MAKE_GP(EXT_FLASH, 2), &m1); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + + r = unifi_card_read16(card, UNIFI_MAKE_GP(EXT_FLASH, 10), &m5); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + + /* Check for uninitialised/missing flash */ + if ((m1 == 0x0008) || (m1 == 0xFFFF) || + (m1 == 0x0004) || (m5 == 0x0004) || + (m5 == 0x0008) || (m5 == 0xFFFF)) + { + return CSR_WIFI_HIP_RESULT_NOT_FOUND; + } + + return CSR_RESULT_SUCCESS; +} /* firmware_present_in_flash() */ + + +/* + * --------------------------------------------------------------------------- + * bootstrap_chip_hw + * + * Perform chip specific magic to "Get It Working" TM. This will + * increase speed of PLLs in analogue and maybe enable some + * on-chip regulators. + * + * Arguments: + * card Pointer to card struct + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +static void bootstrap_chip_hw(card_t *card) +{ + const struct chip_helper_init_values *vals; + CsrUint32 i, len; + void *sdio = card->sdio_if; + CsrResult csrResult; + + len = ChipHelper_ClockStartupSequence(card->helper, &vals); + if (len != 0) + { + for (i = 0; i < len; i++) + { + csrResult = CsrSdioWrite16(sdio, vals[i].addr * 2, vals[i].value); + if (csrResult != CSR_RESULT_SUCCESS) + { + unifi_warning(card->ospriv, "Failed to write bootstrap value %d\n", i); + /* Might not be fatal */ + } + + CsrThreadSleep(1); + } + } +} /* bootstrap_chip_hw() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_card_stop_processor + * + * Stop the UniFi XAP processors. + * + * Arguments: + * card Pointer to card struct + * which One of UNIFI_PROC_MAC, UNIFI_PROC_PHY, UNIFI_PROC_BOTH + * + * Returns: + * CSR_RESULT_SUCCESS if successful, or CSR error code + * --------------------------------------------------------------------------- + */ +CsrResult unifi_card_stop_processor(card_t *card, enum unifi_dbg_processors_select which) +{ + CsrResult r = CSR_RESULT_SUCCESS; + CsrUint8 status; + CsrInt16 retry = 100; + + while (retry--) + { + /* Select both XAPs */ + r = unifi_set_proc_select(card, which); + if (r != CSR_RESULT_SUCCESS) + { + break; + } + + /* Stop processors */ + r = unifi_write_direct16(card, ChipHelper_DBG_EMU_CMD(card->helper) * 2, 2); + if (r != CSR_RESULT_SUCCESS) + { + break; + } + + /* Read status */ + r = unifi_read_direct_8_or_16(card, + ChipHelper_DBG_HOST_STOP_STATUS(card->helper) * 2, + &status); + if (r != CSR_RESULT_SUCCESS) + { + break; + } + + if ((status & 1) == 1) + { + /* Success! */ + return CSR_RESULT_SUCCESS; + } + + /* Processors didn't stop, try again */ + } + + if (r != CSR_RESULT_SUCCESS) + { + /* An SDIO error occurred */ + unifi_error(card->ospriv, "Failed to stop processors: SDIO error\n"); + } + else + { + /* If we reach here, we didn't the status in time. */ + unifi_error(card->ospriv, "Failed to stop processors: timeout waiting for stopped status\n"); + r = CSR_RESULT_FAILURE; + } + + return r; +} /* unifi_card_stop_processor() */ + + +/* + * --------------------------------------------------------------------------- + * card_start_processor + * + * Start the UniFi XAP processors. + * + * Arguments: + * card Pointer to card struct + * which One of UNIFI_PROC_MAC, UNIFI_PROC_PHY, UNIFI_PROC_BOTH + * + * Returns: + * CSR_RESULT_SUCCESS or CSR error code + * --------------------------------------------------------------------------- + */ +CsrResult card_start_processor(card_t *card, enum unifi_dbg_processors_select which) +{ + CsrResult r; + + /* Select both XAPs */ + r = unifi_set_proc_select(card, which); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "unifi_set_proc_select failed: %d.\n", r); + return r; + } + + + r = unifi_write_direct_8_or_16(card, + ChipHelper_DBG_EMU_CMD(card->helper) * 2, 8); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + + r = unifi_write_direct_8_or_16(card, + ChipHelper_DBG_EMU_CMD(card->helper) * 2, 0); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + + return CSR_RESULT_SUCCESS; +} /* card_start_processor() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_set_interrupt_mode + * + * Configure the interrupt processing mode used by the HIP + * + * Arguments: + * card Pointer to card struct + * mode Interrupt mode to apply + * + * Returns: + * None + * --------------------------------------------------------------------------- + */ +void unifi_set_interrupt_mode(card_t *card, CsrUint32 mode) +{ + if (mode == CSR_WIFI_INTMODE_RUN_BH_ONCE) + { + unifi_info(card->ospriv, "Scheduled interrupt mode"); + } + card->intmode = mode; +} /* unifi_set_interrupt_mode() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_start_processors + * + * Start all UniFi XAP processors. + * + * Arguments: + * card Pointer to card struct + * + * Returns: + * CSR_RESULT_SUCCESS on success, CSR error code on error + * --------------------------------------------------------------------------- + */ +CsrResult unifi_start_processors(card_t *card) +{ + return card_start_processor(card, UNIFI_PROC_BOTH); +} /* unifi_start_processors() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_request_max_sdio_clock + * + * Requests that the maximum SDIO clock rate is set at the next suitable + * opportunity (e.g. when the BH next runs, so as not to interfere with + * any current operation). + * + * Arguments: + * card Pointer to card struct + * + * Returns: + * None + * --------------------------------------------------------------------------- + */ +void unifi_request_max_sdio_clock(card_t *card) +{ + card->request_max_clock = 1; +} /* unifi_request_max_sdio_clock() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_set_host_state + * + * Set the host deep-sleep state. + * + * If transitioning to TORPID, the SDIO driver will be notified + * that the SD bus will be unused (idle) and conversely, when + * transitioning from TORPID that the bus will be used (active). + * + * Arguments: + * card Pointer to card struct + * state New deep-sleep state. + * + * Returns: + * CSR_RESULT_SUCCESS on success + * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected + * CSR_RESULT_FAILURE if an SDIO error occurred + * + * Notes: + * We need to reduce the SDIO clock speed before trying to wake up the + * chip. Actually, in the implementation below we reduce the clock speed + * not just before we try to wake up the chip, but when we put the chip to + * deep sleep. This means that if the f/w wakes up on its' own, we waste + * a reduce/increace cycle. However, trying to eliminate this overhead is + * proved difficult, as the current state machine in the HIP lib does at + * least a CMD52 to disable the interrupts before we configure the host + * state. + * --------------------------------------------------------------------------- + */ +CsrResult unifi_set_host_state(card_t *card, enum unifi_host_state state) +{ + CsrResult r = CSR_RESULT_SUCCESS; + CsrResult csrResult; + static const CsrCharString *const states[] = { + "AWAKE", "DROWSY", "TORPID" + }; + static const CsrUint8 state_csr_host_wakeup[] = { + 1, 3, 0 + }; + static const CsrUint8 state_io_abort[] = { + 0, 2, 3 + }; + + unifi_trace(card->ospriv, UDBG4, "State %s to %s\n", + states[card->host_state], states[state]); + + if (card->host_state == UNIFI_HOST_STATE_TORPID) + { + CsrSdioFunctionActive(card->sdio_if); + } + + /* Write the new state to UniFi. */ + if (card->chip_id > SDIO_CARD_ID_UNIFI_2) + { + r = sdio_write_f0(card, SDIO_CSR_HOST_WAKEUP, + (CsrUint8)((card->function << 4) | state_csr_host_wakeup[state])); + } + else + { + r = sdio_write_f0(card, SDIO_IO_ABORT, state_io_abort[state]); + } + + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to write UniFi deep sleep state\n"); + } + else + { + /* + * If the chip was in state TORPID then we can now increase + * the maximum bus clock speed. + */ + if (card->host_state == UNIFI_HOST_STATE_TORPID) + { + csrResult = CsrSdioMaxBusClockFrequencySet(card->sdio_if, + UNIFI_SDIO_CLOCK_MAX_HZ); + r = ConvertCsrSdioToCsrHipResult(card, csrResult); + /* Non-fatal error */ + if (r != CSR_RESULT_SUCCESS && r != CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + unifi_warning(card->ospriv, + "Failed to increase the SDIO clock speed\n"); + } + else + { + card->sdio_clock_speed = UNIFI_SDIO_CLOCK_MAX_HZ; + } + } + + /* + * Cache the current state in the card structure to avoid + * unnecessary SDIO reads. + */ + card->host_state = state; + + if (state == UNIFI_HOST_STATE_TORPID) + { + /* + * If the chip is now in state TORPID then we must now decrease + * the maximum bus clock speed. + */ + csrResult = CsrSdioMaxBusClockFrequencySet(card->sdio_if, + UNIFI_SDIO_CLOCK_SAFE_HZ); + r = ConvertCsrSdioToCsrHipResult(card, csrResult); + if (r != CSR_RESULT_SUCCESS && r != CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + unifi_warning(card->ospriv, + "Failed to decrease the SDIO clock speed\n"); + } + else + { + card->sdio_clock_speed = UNIFI_SDIO_CLOCK_SAFE_HZ; + } + CsrSdioFunctionIdle(card->sdio_if); + } + } + + return r; +} /* unifi_set_host_state() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_card_info + * + * Update the card information data structure + * + * Arguments: + * card Pointer to card struct + * card_info Pointer to info structure to update + * + * Returns: + * None + * --------------------------------------------------------------------------- + */ +void unifi_card_info(card_t *card, card_info_t *card_info) +{ + card_info->chip_id = card->chip_id; + card_info->chip_version = card->chip_version; + card_info->fw_build = card->build_id; + card_info->fw_hip_version = card->config_data.version; + card_info->sdio_block_size = card->sdio_io_block_size; +} /* unifi_card_info() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_check_io_status + * + * Check UniFi for spontaneous reset and pending interrupt. + * + * Arguments: + * card Pointer to card struct + * status Pointer to location to write chip status: + * 0 if UniFi is running, and no interrupt pending + * 1 if UniFi has spontaneously reset + * 2 if there is a pending interrupt + * Returns: + * CSR_RESULT_SUCCESS if OK, or CSR error + * --------------------------------------------------------------------------- + */ +CsrResult unifi_check_io_status(card_t *card, CsrInt32 *status) +{ + CsrUint8 io_en; + CsrResult r; + CsrBool pending; + + *status = 0; + + r = sdio_read_f0(card, SDIO_IO_ENABLE, &io_en); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to read SDIO_IO_ENABLE to check for spontaneous reset\n"); + return r; + } + + if ((io_en & (1 << card->function)) == 0) + { + CsrInt32 fw_count; + *status = 1; + unifi_error(card->ospriv, "UniFi has spontaneously reset.\n"); + + /* + * These reads are very likely to fail. We want to know if the function is really + * disabled or the SDIO driver just returns rubbish. + */ + fw_count = unifi_read_shared_count(card, card->sdio_ctrl_addr + 4); + if (fw_count < 0) + { + unifi_error(card->ospriv, "Failed to read to-host sig written count\n"); + } + else + { + unifi_error(card->ospriv, "thsw: %u (driver thinks is %u)\n", + fw_count, card->to_host_signals_w); + } + fw_count = unifi_read_shared_count(card, card->sdio_ctrl_addr + 2); + if (fw_count < 0) + { + unifi_error(card->ospriv, "Failed to read from-host sig read count\n"); + } + else + { + unifi_error(card->ospriv, "fhsr: %u (driver thinks is %u)\n", + fw_count, card->from_host_signals_r); + } + + return r; + } + + unifi_info(card->ospriv, "UniFi function %d is enabled.\n", card->function); + + /* See if we missed an SDIO interrupt */ + r = CardPendingInt(card, &pending); + if (pending) + { + unifi_error(card->ospriv, "There is an unhandled pending interrupt.\n"); + *status = 2; + return r; + } + + return r; +} /* unifi_check_io_status() */ + + +void unifi_get_hip_qos_info(card_t *card, unifi_HipQosInfo *hipqosinfo) +{ + CsrInt32 count_fhr; + CsrInt16 t; + CsrUint32 occupied_fh; + + q_t *sigq; + CsrUint16 nslots, i; + + CsrMemSet(hipqosinfo, 0, sizeof(unifi_HipQosInfo)); + + nslots = card->config_data.num_fromhost_data_slots; + + for (i = 0; i < nslots; i++) + { + if (card->from_host_data[i].bd.data_length == 0) + { + hipqosinfo->free_fh_bulkdata_slots++; + } + } + + for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) + { + sigq = &card->fh_traffic_queue[i]; + t = sigq->q_wr_ptr - sigq->q_rd_ptr; + if (t < 0) + { + t += sigq->q_length; + } + hipqosinfo->free_fh_sig_queue_slots[i] = (sigq->q_length - t) - 1; + } + + count_fhr = unifi_read_shared_count(card, card->sdio_ctrl_addr + 2); + if (count_fhr < 0) + { + unifi_error(card->ospriv, "Failed to read from-host sig read count - %d\n", count_fhr); + hipqosinfo->free_fh_fw_slots = 0xfa; + return; + } + + occupied_fh = (card->from_host_signals_w - count_fhr) % 128; + + hipqosinfo->free_fh_fw_slots = (CsrUint16)(card->config_data.num_fromhost_sig_frags - occupied_fh); +} + + + +CsrResult ConvertCsrSdioToCsrHipResult(card_t *card, CsrResult csrResult) +{ + CsrResult r = CSR_RESULT_FAILURE; + + switch (csrResult) + { + case CSR_RESULT_SUCCESS: + r = CSR_RESULT_SUCCESS; + break; + /* Timeout errors */ + case CSR_SDIO_RESULT_TIMEOUT: + /* Integrity errors */ + case CSR_SDIO_RESULT_CRC_ERROR: + r = CSR_RESULT_FAILURE; + break; + case CSR_SDIO_RESULT_NO_DEVICE: + r = CSR_WIFI_HIP_RESULT_NO_DEVICE; + break; + case CSR_SDIO_RESULT_INVALID_VALUE: + r = CSR_WIFI_HIP_RESULT_INVALID_VALUE; + break; + case CSR_RESULT_FAILURE: + r = CSR_RESULT_FAILURE; + break; + default: + unifi_warning(card->ospriv, "Unrecognised csrResult error code: %d\n", csrResult); + break; + } + + return r; +} /* ConvertCsrSdioToCsrHipResult() */ + + diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.h b/drivers/staging/csr/csr_wifi_hip_card_sdio.h new file mode 100644 index 0000000..4481d81 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.h @@ -0,0 +1,702 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* + * --------------------------------------------------------------------------- + * + * FILE: csr_wifi_hip_card_sdio.h + * + * PURPOSE: + * Internal header for Card API for SDIO. + * --------------------------------------------------------------------------- + */ +#ifndef __CARD_SDIO_H__ +#define __CARD_SDIO_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "csr_wifi_hip_unifi.h" +#include "csr_wifi_hip_unifi_udi.h" +#include "csr_wifi_hip_unifihw.h" +#include "csr_wifi_hip_unifiversion.h" +#ifndef CSR_WIFI_HIP_TA_DISABLE +#include "csr_wifi_hip_ta_sampling.h" +#endif +#include "csr_wifi_hip_xbv.h" +#include "csr_wifi_hip_chiphelper.h" + + +/* + * + * Configuration items. + * Which of these should go in a platform unifi_config.h file? + * + */ + +/* + * When the traffic queues contain more signals than there is space for on + * UniFi, a limiting algorithm comes into play. + * If a traffic queue has enough slots free to buffer more traffic from the + * network stack, then the following check is applied. The number of free + * slots is RESUME_XMIT_THRESHOLD. + */ +#define RESUME_XMIT_THRESHOLD 4 + + +/* + * When reading signals from UniFi, the host processes pending all signals + * and then acknowledges them together in a single write to update the + * to-host-chunks-read location. + * When there is more than one bulk data transfer (e.g. one received data + * packet and a request for the payload data of a transmitted packet), the + * update can be delayed significantly. This ties up resources on chip. + * + * To remedy this problem, to-host-chunks-read is updated after processing + * a signal if TO_HOST_FLUSH_THRESHOLD bytes of bulk data have been + * transferred since the last update. + */ +#define TO_HOST_FLUSH_THRESHOLD (500 * 5) + + +/* SDIO Card Common Control Registers */ +#define SDIO_CCCR_SDIO_REVISION (0x00) +#define SDIO_SD_SPEC_REVISION (0x01) +#define SDIO_IO_ENABLE (0x02) +#define SDIO_IO_READY (0x03) +#define SDIO_INT_ENABLE (0x04) +#define SDIO_INT_PENDING (0x05) +#define SDIO_IO_ABORT (0x06) +#define SDIO_BUS_IFACE_CONTROL (0x07) +#define SDIO_CARD_CAPABILOTY (0x08) +#define SDIO_COMMON_CIS_POINTER (0x09) +#define SDIO_BUS_SUSPEND (0x0C) +#define SDIO_FUNCTION_SELECT (0x0D) +#define SDIO_EXEC_FLAGS (0x0E) +#define SDIO_READY_FLAGS (0x0F) +#define SDIO_FN0_BLOCK_SIZE (0x10) +#define SDIO_POWER_CONTROL (0x12) +#define SDIO_VENDOR_START (0xF0) + +#define SDIO_CSR_HOST_WAKEUP (0xf0) +#define SDIO_CSR_HOST_INT_CLEAR (0xf1) +#define SDIO_CSR_FROM_HOST_SCRATCH0 (0xf2) +#define SDIO_CSR_FROM_HOST_SCRATCH1 (0xf3) +#define SDIO_CSR_TO_HOST_SCRATCH0 (0xf4) +#define SDIO_CSR_TO_HOST_SCRATCH1 (0xf5) +#define SDIO_CSR_FUNC_EN (0xf6) +#define SDIO_CSR_CSPI_MODE (0xf7) +#define SDIO_CSR_CSPI_STATUS (0xf8) +#define SDIO_CSR_CSPI_PADDING (0xf9) + + +#define UNIFI_SD_INT_ENABLE_IENM 0x0001 /* Master INT Enable */ + +#ifdef CSR_PRE_ALLOC_NET_DATA +#define BULK_DATA_PRE_ALLOC_NUM 16 +#endif + +/* + * Structure to hold configuration information read from UniFi. + */ +typedef struct +{ + /* + * The version of the SDIO signal queues and bulk data pools + * configuration structure. The MSB is the major version number, used to + * indicate incompatible changes. The LSB gives the minor revision number, + * used to indicate changes that maintain backwards compatibility. + */ + CsrUint16 version; + + /* + * offset from the start of the shared data memory to the SD IO + * control structure. + */ + CsrUint16 sdio_ctrl_offset; + + /* Buffer handle of the from-host signal queue */ + CsrUint16 fromhost_sigbuf_handle; + + /* Buffer handle of the to-host signal queue */ + CsrUint16 tohost_sigbuf_handle; + + /* + * Maximum number of signal primitive or bulk data command fragments that may be + * pending in the to-hw signal queue. + */ + CsrUint16 num_fromhost_sig_frags; + + /* + * Number of signal primitive or bulk data command fragments that must be pending + * in the to-host signal queue before the host will generate an interrupt + * to indicate that it has read a signal. This will usually be the total + * capacity of the to-host signal buffer less the size of the largest signal + * primitive divided by the signal primitive fragment size, but may be set + * to 1 to request interrupts every time that the host read a signal. + * Note that the hw may place more signals in the to-host signal queue + * than indicated by this field. + */ + CsrUint16 num_tohost_sig_frags; + + /* + * Number of to-hw bulk data slots. Slots are numbered from 0 (zero) to + * one less than the value in this field + */ + CsrUint16 num_fromhost_data_slots; + + /* + * Number of frm-hw bulk data slots. Slots are numbered from 0 (zero) to + * one less than the value in this field + */ + CsrUint16 num_tohost_data_slots; + + /* + * Size of the bulk data slots (2 octets) + * The size of the bulk data slots in octets. This will usually be + * the size of the largest MSDU. The value should always be even. + */ + CsrUint16 data_slot_size; + + /* + * Indicates that the host has finished the initialisation sequence. + * Initialised to 0x0000 by the firmware, and set to 0x0001 by us. + */ + CsrUint16 initialised; + + /* Added by protocol version 0x0001 */ + CsrUint32 overlay_size; + + /* Added by protocol version 0x0300 */ + CsrUint16 data_slot_round; + CsrUint16 sig_frag_size; + + /* Added by protocol version 0x0500 */ + CsrUint16 tohost_signal_padding; +} sdio_config_data_t; + +/* + * These values may change with versions of the Host Interface Protocol. + */ +/* + * Size of config info block pointed to by the CSR_SLT_SDIO_SLOT_CONFIG + * entry in the f/w symbol table + */ +#define SDIO_CONFIG_DATA_SIZE 30 + +/* Offset of the INIT flag in the config info block. */ +#define SDIO_INIT_FLAG_OFFSET 0x12 +#define SDIO_TO_HOST_SIG_PADDING_OFFSET 0x1C + + +/* Structure for a bulk data transfer command */ +typedef struct +{ + CsrUint16 cmd_and_len; /* bits 12-15 cmd, bits 0-11 len */ + CsrUint16 data_slot; /* slot number, perhaps OR'd with SLOT_DIR_TO_HOST */ + CsrUint16 offset; + CsrUint16 buffer_handle; +} bulk_data_cmd_t; + + +/* Bulk Data signal command values */ +#define SDIO_CMD_SIGNAL 0x00 +#define SDIO_CMD_TO_HOST_TRANSFER 0x01 +#define SDIO_CMD_TO_HOST_TRANSFER_ACK 0x02 /*deprecated*/ +#define SDIO_CMD_FROM_HOST_TRANSFER 0x03 +#define SDIO_CMD_FROM_HOST_TRANSFER_ACK 0x04 /*deprecated*/ +#define SDIO_CMD_CLEAR_SLOT 0x05 +#define SDIO_CMD_OVERLAY_TRANSFER 0x06 +#define SDIO_CMD_OVERLAY_TRANSFER_ACK 0x07 /*deprecated*/ +#define SDIO_CMD_FROM_HOST_AND_CLEAR 0x08 +#define SDIO_CMD_PADDING 0x0f + +#define SLOT_DIR_TO_HOST 0x8000 + + +/* Initialise bulkdata slot + * params: + * bulk_data_desc_t *bulk_data_slot + */ +#define UNIFI_INIT_BULK_DATA(bulk_data_slot) \ + { \ + (bulk_data_slot)->os_data_ptr = NULL; \ + (bulk_data_slot)->data_length = 0; \ + (bulk_data_slot)->os_net_buf_ptr = NULL; \ + (bulk_data_slot)->net_buf_length = 0; \ + } + +/* + * Structure to contain a SIGNAL datagram. + * This is used to build signal queues between the main driver and the + * i/o thread. + * The fields are: + * sigbuf Contains the HIP signal is wire-format (i.e. packed, + * little-endian) + * bulkdata Contains a copy of any associated bulk data + * signal_length The size of the signal in the sigbuf + */ +typedef struct card_signal +{ + CsrUint8 sigbuf[UNIFI_PACKED_SIGBUF_SIZE]; + + /* Length of the SIGNAL inside sigbuf */ + CsrUint16 signal_length; + + bulk_data_desc_t bulkdata[UNIFI_MAX_DATA_REFERENCES]; +} card_signal_t; + + +/* + * Control structure for a generic ring buffer. + */ +#define UNIFI_QUEUE_NAME_MAX_LENGTH 16 +typedef struct +{ + card_signal_t *q_body; + + /* Num elements in queue (capacity is one less than this!) */ + CsrUint16 q_length; + + CsrUint16 q_wr_ptr; + CsrUint16 q_rd_ptr; + + CsrCharString name[UNIFI_QUEUE_NAME_MAX_LENGTH]; +} q_t; + + +#define UNIFI_RESERVED_COMMAND_SLOTS 2 + +/* Considering approx 500 us per packet giving 0.5 secs */ +#define UNIFI_PACKETS_INTERVAL 1000 + +/* + * Dynamic slot reservation for QoS + */ +typedef struct +{ + CsrUint16 from_host_used_slots[UNIFI_NO_OF_TX_QS]; + CsrUint16 from_host_max_slots[UNIFI_NO_OF_TX_QS]; + CsrUint16 from_host_reserved_slots[UNIFI_NO_OF_TX_QS]; + + /* Parameters to determine if a queue was active. + If number of packets sent is greater than the threshold + for the queue, the queue is considered active and no + re reservation is done, it is important not to keep this + value too low */ + /* Packets sent during this interval */ + CsrUint16 packets_txed[UNIFI_NO_OF_TX_QS]; + CsrUint16 total_packets_txed; + + /* Number of packets to see if slots need to be reassigned */ + CsrUint16 packets_interval; + + /* Once a queue reaches a stable state, avoid processing */ + CsrBool queue_stable[UNIFI_NO_OF_TX_QS]; +} card_dynamic_slot_t; + + +/* These are type-safe and don't write incorrect values to the + * structure. */ + +/* Return queue slots used count + * params: + * const q_t *q + * returns: + * CsrUint16 + */ +#define CSR_WIFI_HIP_Q_SLOTS_USED(q) \ + (((q)->q_wr_ptr - (q)->q_rd_ptr < 0)? \ + ((q)->q_wr_ptr - (q)->q_rd_ptr + (q)->q_length) : ((q)->q_wr_ptr - (q)->q_rd_ptr)) + +/* Return queue slots free count + * params: + * const q_t *q + * returns: + * CsrUint16 + */ +#define CSR_WIFI_HIP_Q_SLOTS_FREE(q) \ + ((q)->q_length - CSR_WIFI_HIP_Q_SLOTS_USED((q)) - 1) + +/* Return slot signal data pointer + * params: + * const q_t *q + * CsrUint16 slot + * returns: + * card_signal_t * + */ +#define CSR_WIFI_HIP_Q_SLOT_DATA(q, slot) \ + ((q)->q_body + slot) + +/* Return queue next read slot + * params: + * const q_t *q + * returns: + * CsrUint16 slot offset + */ +#define CSR_WIFI_HIP_Q_NEXT_R_SLOT(q) \ + ((q)->q_rd_ptr) + +/* Return queue next write slot + * params: + * const q_t *q + * returns: + * CsrUint16 slot offset + */ +#define CSR_WIFI_HIP_Q_NEXT_W_SLOT(q) \ + ((q)->q_wr_ptr) + +/* Return updated queue pointer wrapped around its length + * params: + * const q_t *q + * CsrUint16 x amount to add to queue pointer + * returns: + * CsrUint16 wrapped queue pointer + */ +#define CSR_WIFI_HIP_Q_WRAP(q, x) \ + ((((x) >= (q)->q_length)?((x) % (q)->q_length) : (x))) + +/* Advance queue read pointer + * params: + * const q_t *q + */ +#define CSR_WIFI_HIP_Q_INC_R(q) \ + ((q)->q_rd_ptr = CSR_WIFI_HIP_Q_WRAP((q), (q)->q_rd_ptr + 1)) + +/* Advance queue write pointer + * params: + * const q_t *q + */ +#define CSR_WIFI_HIP_Q_INC_W(q) \ + ((q)->q_wr_ptr = CSR_WIFI_HIP_Q_WRAP((q), (q)->q_wr_ptr + 1)) + +enum unifi_host_state +{ + UNIFI_HOST_STATE_AWAKE = 0, + UNIFI_HOST_STATE_DROWSY = 1, + UNIFI_HOST_STATE_TORPID = 2 +}; + +typedef struct +{ + bulk_data_desc_t bd; + unifi_TrafficQueue queue; /* Used for dynamic slot reservation */ +} slot_desc_t; + +/* + * Structure describing a UniFi SDIO card. + */ +struct card +{ + /* + * Back pointer for the higher level OS code. This is passed as + * an argument to callbacks (e.g. for received data and indications). + */ + void *ospriv; + + /* + * mapping of HIP slot to MA-PACKET.req host tag, the + * array is indexed by slot numbers and each index stores + * information of the last host tag it was used for + */ + CsrUint32 *fh_slot_host_tag_record; + + + /* Info read from Symbol Table during probe */ + CsrUint32 build_id; + CsrCharString build_id_string[128]; + + /* Retrieve from SDIO driver. */ + CsrUint16 chip_id; + + /* Read from GBL_CHIP_VERSION. */ + CsrUint16 chip_version; + + /* From the SDIO driver (probably 1) */ + CsrUint8 function; + + /* This is sused to get the register addresses and things. */ + ChipDescript *helper; + + /* + * Bit mask of PIOs for the loader to waggle during download. + * We assume these are connected to LEDs. The main firmware gets + * the mask from a MIB entry. + */ + CsrInt32 loader_led_mask; + + /* + * Support for flow control. When the from-host queue of signals + * is full, we ask the host upper layer to stop sending packets. When + * the queue drains we tell it that it can send packets again. + * We use this flag to remember the current state. + */ +#define card_is_tx_q_paused(card, q) (card->tx_q_paused_flag[q]) +#define card_tx_q_unpause(card, q) (card->tx_q_paused_flag[q] = 0) +#define card_tx_q_pause(card, q) (card->tx_q_paused_flag[q] = 1) + + CsrUint16 tx_q_paused_flag[UNIFI_TRAFFIC_Q_MAX + 1 + UNIFI_NO_OF_TX_QS]; /* defensive more than big enough */ + + /* UDI callback for logging UniFi interactions */ + udi_func_t udi_hook; + + CsrUint8 bh_reason_host; + CsrUint8 bh_reason_unifi; + + /* SDIO clock speed request from OS layer */ + CsrUint8 request_max_clock; + + /* Last SDIO clock frequency set */ + CsrUint32 sdio_clock_speed; + + /* + * Current host state (copy of value in IOABORT register and + * spinlock to protect it. + */ + enum unifi_host_state host_state; + + enum unifi_low_power_mode low_power_mode; + enum unifi_periodic_wake_mode periodic_wake_mode; + + /* + * Ring buffer of signal structs for a queue of data packets from + * the host. + * The queue is empty when fh_data_q_num_rd == fh_data_q_num_wr. + * To add a packet to the queue, copy it to index given by + * (fh_data_q_num_wr%UNIFI_SOFT_Q_LENGTH) and advance fh_data_q_num_wr. + * To take a packet from the queue, copy data from index given by + * (fh_data_q_num_rd%UNIFI_SOFT_Q_LENGTH) and advance fh_data_q_num_rd. + * fh_data_q_num_rd and fh_data_q_num_rd are both modulo 256. + */ + card_signal_t fh_command_q_body[UNIFI_SOFT_COMMAND_Q_LENGTH]; + q_t fh_command_queue; + + card_signal_t fh_traffic_q_body[UNIFI_NO_OF_TX_QS][UNIFI_SOFT_TRAFFIC_Q_LENGTH]; + q_t fh_traffic_queue[UNIFI_NO_OF_TX_QS]; + + /* + * Signal counts from UniFi SDIO Control Data Structure. + * These are cached and synchronised with the UniFi before and after + * a batch of operations. + * + * These are the modulo-256 count of signals written to or read from UniFi + * The value is incremented for every signal. + */ + CsrInt32 from_host_signals_w; + CsrInt32 from_host_signals_r; + CsrInt32 to_host_signals_r; + CsrInt32 to_host_signals_w; + + + /* Should specify buffer size as a number of signals */ + /* + * Enough for 10 th and 10 fh data slots: + * 1 * 10 * 8 = 80 + * 2 * 10 * 8 = 160 + */ +#define UNIFI_FH_BUF_SIZE 1024 + struct sigbuf + { + CsrUint8 *buf; /* buffer area */ + CsrUint8 *ptr; /* current pos */ + CsrUint16 count; /* signal count */ + CsrUint16 bufsize; + } fh_buffer; + struct sigbuf th_buffer; + + + /* + * Field to use for the incrementing value to write to the UniFi + * SHARED_IO_INTERRUPT register. + * Flag to say we need to generate an interrupt at end of processing. + */ + CsrUint32 unifi_interrupt_seq; + CsrUint8 generate_interrupt; + + + /* Pointers to the bulk data slots */ + slot_desc_t *from_host_data; + bulk_data_desc_t *to_host_data; + + + /* + * Index of the next (hopefully) free data slot. + * This is an optimisation that starts searching at a more likely point + * than the beginning. + */ + CsrInt16 from_host_data_head; + + /* Dynamic slot allocation for queues */ + card_dynamic_slot_t dynamic_slot_data; + + /* + * SDIO specific fields + */ + + /* Interface pointer for the SDIO library */ + CsrSdioFunction *sdio_if; + + /* Copy of config_data struct from the card */ + sdio_config_data_t config_data; + + /* SDIO address of the Initialised flag and Control Data struct */ + CsrUint32 init_flag_addr; + CsrUint32 sdio_ctrl_addr; + + /* The last value written to the Shared Data Memory Page register */ + CsrUint32 proc_select; + CsrUint32 dmem_page; + CsrUint32 pmem_page; + + /* SDIO traffic counters limited to 32 bits for Synergy compatibility */ + CsrUint32 sdio_bytes_read; + CsrUint32 sdio_bytes_written; + + CsrUint8 memory_resources_allocated; + + /* UniFi SDIO I/O Block size. */ + CsrUint16 sdio_io_block_size; + + /* Pad transfer sizes to SDIO block boundaries */ + CsrBool sdio_io_block_pad; + + /* Read from the XBV */ + struct FWOV fwov; + +#ifndef CSR_WIFI_HIP_TA_DISABLE + /* TA sampling */ + ta_data_t ta_sampling; +#endif + + /* Auto-coredump */ + CsrInt16 request_coredump_on_reset; /* request coredump on next reset */ + struct coredump_buf *dump_buf; /* root node */ + struct coredump_buf *dump_next_write; /* node to fill at next dump */ + struct coredump_buf *dump_cur_read; /* valid node to read, or NULL */ + +#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE + struct cmd_profile + { + CsrUint32 cmd52_count; + CsrUint32 cmd53_count; + CsrUint32 tx_count; + CsrUint32 tx_cfm_count; + CsrUint32 rx_count; + CsrUint32 bh_count; + CsrUint32 process_count; + CsrUint32 protocol_count; + + CsrUint32 cmd52_f0_r_count; + CsrUint32 cmd52_f0_w_count; + CsrUint32 cmd52_r8or16_count; + CsrUint32 cmd52_w8or16_count; + CsrUint32 cmd52_r16_count; + CsrUint32 cmd52_w16_count; + CsrUint32 cmd52_r32_count; + + CsrUint32 sdio_cmd_signal; + CsrUint32 sdio_cmd_clear_slot; + CsrUint32 sdio_cmd_to_host; + CsrUint32 sdio_cmd_from_host; + CsrUint32 sdio_cmd_from_host_and_clear; + } hip_prof; + struct cmd_profile cmd_prof; +#endif + + /* Interrupt processing mode flags */ + CsrUint32 intmode; + +#ifdef UNIFI_DEBUG + CsrUint8 lsb; +#endif + + /* Historic firmware panic codes */ + CsrUint32 panic_data_phy_addr; + CsrUint32 panic_data_mac_addr; + CsrUint16 last_phy_panic_code; + CsrUint16 last_phy_panic_arg; + CsrUint16 last_mac_panic_code; + CsrUint16 last_mac_panic_arg; +#ifdef CSR_PRE_ALLOC_NET_DATA + bulk_data_desc_t bulk_data_desc_list[BULK_DATA_PRE_ALLOC_NUM]; + CsrUint16 prealloc_netdata_r; + CsrUint16 prealloc_netdata_w; +#endif +}; /* struct card */ + + +/* Reset types */ +enum unifi_reset_type +{ + UNIFI_COLD_RESET = 1, + UNIFI_WARM_RESET = 2 +}; + +/* + * unifi_set_host_state() implements signalling for waking UniFi from + * deep sleep. The host indicates to UniFi that it is in one of three states: + * Torpid - host has nothing to send, UniFi can go to sleep. + * Drowsy - host has data to send to UniFi. UniFi will respond with an + * SDIO interrupt. When hosts responds it moves to Awake. + * Awake - host has data to transfer, UniFi must stay awake. + * When host has finished, it moves to Torpid. + */ +CsrResult unifi_set_host_state(card_t *card, enum unifi_host_state state); + + +CsrResult unifi_set_proc_select(card_t *card, enum unifi_dbg_processors_select select); +CsrInt32 card_read_signal_counts(card_t *card); +bulk_data_desc_t* card_find_data_slot(card_t *card, CsrInt16 slot); + + +CsrResult unifi_read32(card_t *card, CsrUint32 unifi_addr, CsrUint32 *pdata); +CsrResult unifi_readnz(card_t *card, CsrUint32 unifi_addr, + void *pdata, CsrUint16 len); +CsrInt32 unifi_read_shared_count(card_t *card, CsrUint32 addr); + +CsrResult unifi_writen(card_t *card, CsrUint32 unifi_addr, void *pdata, CsrUint16 len); + +CsrResult unifi_bulk_rw(card_t *card, CsrUint32 handle, + void *pdata, CsrUint32 len, CsrInt16 direction); +CsrResult unifi_bulk_rw_noretry(card_t *card, CsrUint32 handle, + void *pdata, CsrUint32 len, CsrInt16 direction); +#define UNIFI_SDIO_READ 0 +#define UNIFI_SDIO_WRITE 1 + +CsrResult unifi_read_8_or_16(card_t *card, CsrUint32 unifi_addr, CsrUint8 *pdata); +CsrResult unifi_write_8_or_16(card_t *card, CsrUint32 unifi_addr, CsrUint8 data); +CsrResult unifi_read_direct_8_or_16(card_t *card, CsrUint32 addr, CsrUint8 *pdata); +CsrResult unifi_write_direct_8_or_16(card_t *card, CsrUint32 addr, CsrUint8 data); + +CsrResult unifi_read_direct16(card_t *card, CsrUint32 addr, CsrUint16 *pdata); +CsrResult unifi_read_direct32(card_t *card, CsrUint32 addr, CsrUint32 *pdata); +CsrResult unifi_read_directn(card_t *card, CsrUint32 addr, void *pdata, CsrUint16 len); + +CsrResult unifi_write_direct16(card_t *card, CsrUint32 addr, CsrUint16 data); +CsrResult unifi_write_directn(card_t *card, CsrUint32 addr, void *pdata, CsrUint16 len); + +CsrResult sdio_read_f0(card_t *card, CsrUint32 addr, CsrUint8 *pdata); +CsrResult sdio_write_f0(card_t *card, CsrUint32 addr, CsrUint8 data); + +void unifi_read_panic(card_t *card); +#ifdef CSR_PRE_ALLOC_NET_DATA +void prealloc_netdata_free(card_t *card); +CsrResult prealloc_netdata_alloc(card_t *card); +#endif +/* For diagnostic use */ +void dump(void *mem, CsrUint16 len); +void dump16(void *mem, CsrUint16 len); + +#ifdef __cplusplus +} +#endif + +#endif /* __CARD_SDIO_H__ */ diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c new file mode 100644 index 0000000..3d563c1 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c @@ -0,0 +1,2561 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* + * --------------------------------------------------------------------------- + * FILE: csr_wifi_hip_card_sdio_intr.c + * + * PURPOSE: + * Interrupt processing for the UniFi SDIO driver. + * + * We may need another signal queue of responses to UniFi to hold + * bulk data commands generated by read_to_host_signals(). + * + * --------------------------------------------------------------------------- + */ +#undef CSR_WIFI_HIP_NOISY + +#include "csr_wifi_hip_unifi.h" +#include "csr_wifi_hip_conversions.h" +#include "csr_wifi_hip_card.h" +#include "csr_wifi_hip_xbv.h" + + +/* + * If the SDIO link is idle for this time (in milliseconds), + * signal UniFi to go into Deep Sleep. + * Valid return value of unifi_bh(). + */ +#define UNIFI_DEFAULT_HOST_IDLE_TIMEOUT 5 +/* + * If the UniFi has not woken up for this time (in milliseconds), + * signal the bottom half to take action. + * Valid return value of unifi_bh(). + */ +#define UNIFI_DEFAULT_WAKE_TIMEOUT 1000 + + +static CsrResult process_bh(card_t *card); +static CsrResult handle_host_protocol(card_t *card, CsrBool *processed_something); + +static CsrResult flush_fh_buffer(card_t *card); + +static CsrResult check_fh_sig_slots(card_t *card, CsrUint16 needed, CsrInt32 *space); + +static CsrResult read_to_host_signals(card_t *card, CsrInt32 *processed); +static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed); + +static CsrResult process_bulk_data_command(card_t *card, + const CsrUint8 *cmdptr, + CsrInt16 cmd, CsrUint16 len); +static CsrResult process_clear_slot_command(card_t *card, + const CsrUint8 *cmdptr); +static CsrResult process_fh_cmd_queue(card_t *card, CsrInt32 *processed); +static CsrResult process_fh_traffic_queue(card_t *card, CsrInt32 *processed); +static void restart_packet_flow(card_t *card); +static CsrResult process_clock_request(card_t *card); + +#ifdef CSR_WIFI_HIP_NOISY +CsrInt16 dump_fh_buf = 0; +#endif /* CSR_WIFI_HIP_NOISY */ + +#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE + +/* + * The unifi_debug_output buffer can be used to debug the HIP behaviour offline + * i.e. without using the tracing functions that change the timing. + * + * Call unifi_debug_log_to_buf() with printf arguments to store a string into + * unifi_debug_output. When unifi_debug_buf_dump() is called, the contents of the + * buffer are dumped with dump_str() which has to be implemented in the + * OS layer, during the porting exercise. The offset printed, holds the + * offset where the last character is (always a zero). + * + */ + +#define UNIFI_DEBUG_GBUFFER_SIZE 8192 +static CsrCharString unifi_debug_output[UNIFI_DEBUG_GBUFFER_SIZE]; +static CsrCharString *unifi_dbgbuf_ptr = unifi_debug_output; +static CsrCharString *unifi_dbgbuf_start = unifi_debug_output; + +static void append_char(CsrCharString c) +{ + /* write char and advance pointer */ + *unifi_dbgbuf_ptr++ = c; + /* wrap pointer at end of buffer */ + if ((unifi_dbgbuf_ptr - unifi_debug_output) >= UNIFI_DEBUG_GBUFFER_SIZE) + { + unifi_dbgbuf_ptr = unifi_debug_output; + } +} /* append_char() */ + + +void unifi_debug_string_to_buf(const CsrCharString *str) +{ + const CsrCharString *p = str; + while (*p) + { + append_char(*p); + p++; + } + /* Update start-of-buffer pointer */ + unifi_dbgbuf_start = unifi_dbgbuf_ptr + 1; + if ((unifi_dbgbuf_start - unifi_debug_output) >= UNIFI_DEBUG_GBUFFER_SIZE) + { + unifi_dbgbuf_start = unifi_debug_output; + } +} + + +void unifi_debug_log_to_buf(const CsrCharString *fmt, ...) +{ +#define DEBUG_BUFFER_SIZE 80 + static CsrCharString s[DEBUG_BUFFER_SIZE]; + va_list args; + + va_start(args, fmt); + CsrVsnprintf(s, DEBUG_BUFFER_SIZE, fmt, args); + va_end(args); + + unifi_debug_string_to_buf(s); +} /* unifi_debug_log_to_buf() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_debug_hex_to_buf + * + * puts the contents of the passed buffer into the debug buffer as a hex string + * + * Arguments: + * buff buffer to print as hex + * length number of chars to print + * + * Returns: + * None. + * + * --------------------------------------------------------------------------- + */ +void unifi_debug_hex_to_buf(const CsrCharString *buff, CsrUint16 length) +{ + CsrCharString s[5]; + CsrUint16 i; + + for (i = 0; i < length; i++) + { + CsrUInt16ToHex(0xff & buff[i], s); + unifi_debug_string_to_buf(s); + } +} + + +void unifi_debug_buf_dump(void) +{ + CsrInt32 offset = unifi_dbgbuf_ptr - unifi_debug_output; + + unifi_error(NULL, "HIP debug buffer offset=%d\n", offset); + dump_str(unifi_debug_output + offset, UNIFI_DEBUG_GBUFFER_SIZE - offset); + dump_str(unifi_debug_output, offset); +} /* unifi_debug_buf_dump() */ + + +#endif /* CSR_WIFI_HIP_DEBUG_OFFLINE */ + +#ifdef CSR_PRE_ALLOC_NET_DATA +#define NETDATA_PRE_ALLOC_BUF_SIZE 8000 + +void prealloc_netdata_free(card_t *card) +{ + unifi_warning(card->ospriv, "prealloc_netdata_free: IN: w=%d r=%d\n", card->prealloc_netdata_w, card->prealloc_netdata_r); + + while (card->bulk_data_desc_list[card->prealloc_netdata_r].data_length != 0) + { + unifi_warning(card->ospriv, "prealloc_netdata_free: r=%d\n", card->prealloc_netdata_r); + + unifi_net_data_free(card->ospriv, &card->bulk_data_desc_list[card->prealloc_netdata_r]); + card->prealloc_netdata_r++; + card->prealloc_netdata_r %= BULK_DATA_PRE_ALLOC_NUM; + } + card->prealloc_netdata_r = card->prealloc_netdata_w = 0; + + unifi_warning(card->ospriv, "prealloc_netdata_free: OUT: w=%d r=%d\n", card->prealloc_netdata_w, card->prealloc_netdata_r); +} + + +CsrResult prealloc_netdata_alloc(card_t *card) +{ + CsrResult r; + + unifi_trace(card->ospriv, UDBG5, "prealloc_netdata_alloc: IN: w=%d r=%d\n", card->prealloc_netdata_w, card->prealloc_netdata_r); + + while (card->bulk_data_desc_list[card->prealloc_netdata_w].data_length == 0) + { + r = unifi_net_data_malloc(card->ospriv, &card->bulk_data_desc_list[card->prealloc_netdata_w], NETDATA_PRE_ALLOC_BUF_SIZE); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "prealloc_netdata_alloc: Failed to allocate t-h bulk data\n"); + return CSR_RESULT_FAILURE; + } + card->prealloc_netdata_w++; + card->prealloc_netdata_w %= BULK_DATA_PRE_ALLOC_NUM; + } + unifi_trace(card->ospriv, UDBG5, "prealloc_netdata_alloc: OUT: w=%d r=%d\n", card->prealloc_netdata_w, card->prealloc_netdata_r); + + return CSR_RESULT_SUCCESS; +} + + +static CsrResult prealloc_netdata_get(card_t *card, bulk_data_desc_t *bulk_data_slot, CsrUint32 size) +{ + CsrResult r; + + unifi_trace(card->ospriv, UDBG5, "prealloc_netdata_get: IN: w=%d r=%d\n", card->prealloc_netdata_w, card->prealloc_netdata_r); + + if (card->bulk_data_desc_list[card->prealloc_netdata_r].data_length == 0) + { + unifi_error(card->ospriv, "prealloc_netdata_get: data_length = 0\n"); + } + + if ((size > NETDATA_PRE_ALLOC_BUF_SIZE) || (card->bulk_data_desc_list[card->prealloc_netdata_r].data_length == 0)) + { + unifi_warning(card->ospriv, "prealloc_netdata_get: Calling net_data_malloc\n"); + + r = unifi_net_data_malloc(card->ospriv, bulk_data_slot, size); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "prealloc_netdata_get: Failed to allocate t-h bulk data\n"); + return CSR_RESULT_FAILURE; + } + return CSR_RESULT_SUCCESS; + } + + *bulk_data_slot = card->bulk_data_desc_list[card->prealloc_netdata_r]; + card->bulk_data_desc_list[card->prealloc_netdata_r].os_data_ptr = NULL; + card->bulk_data_desc_list[card->prealloc_netdata_r].os_net_buf_ptr = NULL; + card->bulk_data_desc_list[card->prealloc_netdata_r].net_buf_length = 0; + card->bulk_data_desc_list[card->prealloc_netdata_r].data_length = 0; + + card->prealloc_netdata_r++; + card->prealloc_netdata_r %= BULK_DATA_PRE_ALLOC_NUM; + + unifi_trace(card->ospriv, UDBG5, "prealloc_netdata_get: OUT: w=%d r=%d\n", card->prealloc_netdata_w, card->prealloc_netdata_r); + + return CSR_RESULT_SUCCESS; +} + + +#endif + +/* + * --------------------------------------------------------------------------- + * unifi_sdio_interrupt_handler + * + * This function should be called by the OS-dependent code to handle + * an SDIO interrupt from the UniFi. + * + * Arguments: + * card Pointer to card context structure. + * + * Returns: + * None. + * + * Notes: This function may be called in DRS context. In this case, + * tracing with the unifi_trace(), etc, is not allowed. + * --------------------------------------------------------------------------- + */ +void unifi_sdio_interrupt_handler(card_t *card) +{ + /* + * Set the flag to say reason for waking was SDIO interrupt. + * Then ask the OS layer to run the unifi_bh to give attention to the UniFi. + */ + card->bh_reason_unifi = 1; + unifi_run_bh(card->ospriv); +} /* sdio_interrupt_handler() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_configure_low_power_mode + * + * This function should be called by the OS-dependent when + * the deep sleep signaling needs to be enabled or disabled. + * + * Arguments: + * card Pointer to card context structure. + * low_power_mode Disable/Enable the deep sleep signaling + * periodic_wake_mode UniFi wakes host periodically. + * + * Returns: + * CSR_RESULT_SUCCESS on success or a CSR error code. + * --------------------------------------------------------------------------- + */ +CsrResult unifi_configure_low_power_mode(card_t *card, + enum unifi_low_power_mode low_power_mode, + enum unifi_periodic_wake_mode periodic_wake_mode) +{ + card->low_power_mode = low_power_mode; + card->periodic_wake_mode = periodic_wake_mode; + + unifi_trace(card->ospriv, UDBG1, + "unifi_configure_low_power_mode: new mode = %s, wake_host = %s\n", + (low_power_mode == UNIFI_LOW_POWER_DISABLED)?"disabled" : "enabled", + (periodic_wake_mode == UNIFI_PERIODIC_WAKE_HOST_DISABLED)?"FALSE" : "TRUE"); + + unifi_run_bh(card->ospriv); + return CSR_RESULT_SUCCESS; +} /* unifi_configure_low_power_mode() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_force_low_power_mode + * + * This function should be called by the OS-dependent when + * UniFi needs to be set to the low power mode (e.g. on suspend) + * + * Arguments: + * card Pointer to card context structure. + * + * Returns: + * CSR_RESULT_SUCCESS on success or a CSR error code. + * --------------------------------------------------------------------------- + */ +CsrResult unifi_force_low_power_mode(card_t *card) +{ + if (card->low_power_mode == UNIFI_LOW_POWER_DISABLED) + { + unifi_error(card->ospriv, "Attempt to set mode to TORPID when lower power mode is disabled\n"); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + return unifi_set_host_state(card, UNIFI_HOST_STATE_TORPID); +} /* unifi_force_low_power_mode() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_bh + * + * This function should be called by the OS-dependent code when + * host and/or UniFi has requested an exchange of messages. + * + * Arguments: + * card Pointer to card context structure. + * + * Returns: + * CSR_RESULT_SUCCESS on success or a CSR error code. + * --------------------------------------------------------------------------- + */ +CsrResult unifi_bh(card_t *card, CsrUint32 *remaining) +{ + CsrResult r; + CsrResult csrResult; + CsrBool pending; + CsrInt32 iostate, j; + const enum unifi_low_power_mode low_power_mode = card->low_power_mode; + CsrUint16 data_slots_used = 0; + + + /* Process request to raise the maximum SDIO clock */ + r = process_clock_request(card); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Error setting maximum SDIO clock\n"); + goto exit; + } + + /* + * Why was the BH thread woken? + * If it was an SDIO interrupt, UniFi is awake and we need to process it. + * If it was a host process queueing data, then we need to awaken UniFi. + * + * Priority of flags is top down. + * + * ----------------------------------------------------------+ + * \state| AWAKE | DROWSY | TORPID | + * flag\ | | | | + * ---------+--------------+----------------+----------------| + * | do the host | go to AWAKE and| go to AWAKE and| + * unifi | protocol | do the host | do the host | + * | | protocol | protocol | + * ---------+--------------+----------------+----------------| + * | do the host | | | + * host | protocol | do nothing | go to DROWSY | + * | | | | + * ---------+--------------+----------------+----------------| + * | | | should not | + * timeout | go to TORPID | error, unifi | occur | + * | | didn't wake up | do nothing | + * ----------------------------------------------------------+ + * + * Note that if we end up in the AWAKE state we always do the host protocol. + */ + + do + { + /* + * When the host state is set to DROWSY, then we can not disable the + * interrupts as UniFi can generate an interrupt even when the INT_ENABLE + * register has the interrupts disabled. This interrupt will be lost. + */ + if (card->host_state == UNIFI_HOST_STATE_DROWSY || card->host_state == UNIFI_HOST_STATE_TORPID) + { + CsrUint8 reason_unifi; + + /* + * An interrupt may occur while or after we cache the reason. + * This interrupt will cause the unifi_bh() to be scheduled again. + * Any interrupt that has happened before the register is read + * and is considered spurious has to acknowledged. + */ + reason_unifi = card->bh_reason_unifi; + + /* + * If an interrupt is received, check if it was a real one, + * set the host state to AWAKE and run the BH. + */ + r = CardPendingInt(card, &pending); + if (r != CSR_RESULT_SUCCESS) + { + goto exit; + } + + if (pending) + { + unifi_trace(card->ospriv, UDBG5, + "UNIFI_HOST_STATE_%s: Set state to AWAKE.\n", + (card->host_state == UNIFI_HOST_STATE_TORPID)?"TORPID" : "DROWSY"); + + r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE); + if (r == CSR_RESULT_SUCCESS) + { + (*remaining) = 0; + break; + } + } + else if (reason_unifi) + { + CsrSdioInterruptAcknowledge(card->sdio_if); + } + + /* + * If an chip is in TORPID, and the host wants to wake it up, + * set the host state to DROWSY and wait for the wake-up interrupt. + */ + if ((card->host_state == UNIFI_HOST_STATE_TORPID) && card->bh_reason_host) + { + r = unifi_set_host_state(card, UNIFI_HOST_STATE_DROWSY); + if (r == CSR_RESULT_SUCCESS) + { + /* + * set the timeout value to UNIFI_DEFAULT_WAKE_TIMEOUT + * to capture a wake error. + */ + card->bh_reason_host = 0; + (*remaining) = UNIFI_DEFAULT_WAKE_TIMEOUT; + return CSR_RESULT_SUCCESS; + } + + goto exit; + } + + /* + * If the chip is in DROWSY, and the timeout expires, + * we need to reset the chip. This should never occur. + * (If it does, check that the calling thread set "remaining" + * according to the time remaining when unifi_bh() was called). + */ + if ((card->host_state == UNIFI_HOST_STATE_DROWSY) && ((*remaining) == 0)) + { + unifi_error(card->ospriv, "UniFi did not wake up on time...\n"); + + /* + * Check if Function1 has gone away or + * if we missed an SDIO interrupt. + */ + r = unifi_check_io_status(card, &iostate); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + goto exit; + } + /* Need to reset and reboot */ + return CSR_RESULT_FAILURE; + } + } + else + { + if (card->bh_reason_unifi || card->bh_reason_host) + { + break; + } + + if (((*remaining) == 0) && (low_power_mode == UNIFI_LOW_POWER_ENABLED)) + { + r = unifi_set_host_state(card, UNIFI_HOST_STATE_TORPID); + if (r == CSR_RESULT_SUCCESS) + { + (*remaining) = 0; + return CSR_RESULT_SUCCESS; + } + + goto exit; + } + } + + /* No need to run the host protocol */ + return CSR_RESULT_SUCCESS; + } while (0); + + + /* Disable the SDIO interrupts while doing SDIO ops */ + csrResult = CsrSdioInterruptDisable(card->sdio_if); + if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) + { + r = CSR_WIFI_HIP_RESULT_NO_DEVICE; + goto exit; + } + if (csrResult != CSR_RESULT_SUCCESS) + { + r = ConvertCsrSdioToCsrHipResult(card, csrResult); + unifi_error(card->ospriv, "Failed to disable SDIO interrupts. unifi_bh queues error.\n"); + goto exit; + } + + /* Now that the interrupts are disabled, ack the interrupt */ + CsrSdioInterruptAcknowledge(card->sdio_if); + + /* Run the HIP */ + r = process_bh(card); + if (r != CSR_RESULT_SUCCESS) + { + goto exit; + } + + /* + * If host is now idle, schedule a timer for the delay before we + * let UniFi go into deep sleep. + * If the timer goes off, we will move to TORPID state. + * If UniFi raises an interrupt in the meantime, we will cancel + * the timer and start a new one when we become idle. + */ + for (j = 0; j < UNIFI_NO_OF_TX_QS; j++) + { + data_slots_used += CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_traffic_queue[j]); + } + + if ((low_power_mode == UNIFI_LOW_POWER_ENABLED) && (data_slots_used == 0)) + { +#ifndef CSR_WIFI_HIP_TA_DISABLE + if (card->ta_sampling.traffic_type != CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_PERIODIC) + { +#endif + /* return the UNIFI_DEFAULT_HOST_IDLE_TIMEOUT, so we can go to sleep. */ + unifi_trace(card->ospriv, UDBG5, + "Traffic is not periodic, set timer for TORPID.\n"); + (*remaining) = UNIFI_DEFAULT_HOST_IDLE_TIMEOUT; +#ifndef CSR_WIFI_HIP_TA_DISABLE + } + else + { + unifi_trace(card->ospriv, UDBG5, + "Traffic is periodic, set unifi to TORPID immediately.\n"); + if (CardAreAllFromHostDataSlotsEmpty(card) == 1) + { + r = unifi_set_host_state(card, UNIFI_HOST_STATE_TORPID); + if (r != CSR_RESULT_SUCCESS) + { + goto exit; + } + } + } +#endif + } + + csrResult = CsrSdioInterruptEnable(card->sdio_if); + if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) + { + r = CSR_WIFI_HIP_RESULT_NO_DEVICE; + } + if (csrResult != CSR_RESULT_SUCCESS) + { + r = ConvertCsrSdioToCsrHipResult(card, csrResult); + unifi_error(card->ospriv, "Failed to enable SDIO interrupt\n"); + } + +exit: + + unifi_trace(card->ospriv, UDBG4, "New state=%d\n", card->host_state); + + if (r != CSR_RESULT_SUCCESS) + { +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) + unifi_debug_buf_dump(); +#endif + /* If an interrupt has been raised, ack it here */ + if (card->bh_reason_unifi) + { + CsrSdioInterruptAcknowledge(card->sdio_if); + } + + unifi_error(card->ospriv, + "unifi_bh: state=%d %c, clock=%dkHz, interrupt=%d host=%d, power_save=%s\n", + card->host_state, + (card->host_state == UNIFI_HOST_STATE_AWAKE)?'A' : (card->host_state == UNIFI_HOST_STATE_DROWSY)?'D' : 'T', + card->sdio_clock_speed / 1000, + card->bh_reason_unifi, card->bh_reason_host, + (low_power_mode == UNIFI_LOW_POWER_DISABLED)?"disabled" : "enabled"); + + /* Try to capture firmware panic codes */ + unifi_capture_panic(card); + + /* Ask for a mini-coredump when the driver has reset UniFi */ + unifi_coredump_request_at_next_reset(card, 1); + } + + return r; +} /* unifi_bh() */ + + +/* + * --------------------------------------------------------------------------- + * process_clock_request + * + * Handle request from the OS layer to increase the SDIO clock speed. + * The fast clock is limited until the firmware has indicated that it has + * completed initialisation to the OS layer. + * + * Arguments: + * card Pointer to card context structure. + * + * Returns: + * CSR_RESULT_SUCCESS on success or CSR error code. + * --------------------------------------------------------------------------- + */ +static CsrResult process_clock_request(card_t *card) +{ + CsrResult r = CSR_RESULT_SUCCESS; + CsrResult csrResult; + + if (!card->request_max_clock) + { + return CSR_RESULT_SUCCESS; /* No pending request */ + } + + /* + * The SDIO clock speed request from the OS layer is only acted upon if + * the UniFi is awake. If it was in any other state, the clock speed will + * transition through SAFE to MAX while the host wakes it up, and the + * final speed reached will be UNIFI_SDIO_CLOCK_MAX_HZ. + * This assumes that the SME never requests low power mode while the f/w + * initialisation takes place. + */ + if (card->host_state == UNIFI_HOST_STATE_AWAKE) + { + unifi_trace(card->ospriv, UDBG1, "Set SDIO max clock\n"); + csrResult = CsrSdioMaxBusClockFrequencySet(card->sdio_if, UNIFI_SDIO_CLOCK_MAX_HZ); + if (csrResult != CSR_RESULT_SUCCESS) + { + r = ConvertCsrSdioToCsrHipResult(card, csrResult); + } + else + { + card->sdio_clock_speed = UNIFI_SDIO_CLOCK_MAX_HZ; /* log the new freq */ + } + } + else + { + unifi_trace(card->ospriv, UDBG1, "Will set SDIO max clock after wakeup\n"); + } + + /* Cancel the request now that it has been acted upon, or is about to be + * by the wakeup mechanism + */ + card->request_max_clock = 0; + + return r; +} + + +/* + * --------------------------------------------------------------------------- + * process_bh + * + * Exchange messages with UniFi + * + * Arguments: + * card Pointer to card context structure. + * + * Returns: + * CSR_RESULT_SUCCESS on success or CSR error code. + * --------------------------------------------------------------------------- + */ +static CsrResult process_bh(card_t *card) +{ + CsrResult r; + CsrBool more; + more = FALSE; + + /* Process the reasons (interrupt, signals) */ + do + { + /* + * Run in a while loop, to save clearing the interrupts + * every time around the outside loop. + */ + do + { + /* If configured to run the HIP just once, skip first loop */ + if (card->intmode & CSR_WIFI_INTMODE_RUN_BH_ONCE) + { + break; + } + + r = handle_host_protocol(card, &more); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) + unifi_debug_log_to_buf("c52=%d c53=%d tx=%d txc=%d rx=%d s=%d t=%d fc=%d\n", + card->cmd_prof.cmd52_count, + card->cmd_prof.cmd53_count, + card->cmd_prof.tx_count, + card->cmd_prof.tx_cfm_count, + card->cmd_prof.rx_count, + card->cmd_prof.sdio_cmd_signal, + card->cmd_prof.sdio_cmd_to_host, + card->cmd_prof.sdio_cmd_from_host_and_clear + ); + + card->cmd_prof.cmd52_count = card->cmd_prof.cmd53_count = 0; + card->cmd_prof.tx_count = card->cmd_prof.tx_cfm_count = card->cmd_prof.rx_count = 0; + + card->cmd_prof.cmd52_f0_r_count = 0; + card->cmd_prof.cmd52_f0_w_count = 0; + card->cmd_prof.cmd52_r8or16_count = 0; + card->cmd_prof.cmd52_w8or16_count = 0; + card->cmd_prof.cmd52_r16_count = 0; + card->cmd_prof.cmd52_w16_count = 0; + card->cmd_prof.cmd52_r32_count = 0; + + card->cmd_prof.sdio_cmd_signal = 0; + card->cmd_prof.sdio_cmd_clear_slot = 0; + card->cmd_prof.sdio_cmd_to_host = 0; + card->cmd_prof.sdio_cmd_from_host = 0; + card->cmd_prof.sdio_cmd_from_host_and_clear = 0; +#endif + + + } while (more || card->bh_reason_unifi || card->bh_reason_host); + + /* Acknowledge the h/w interrupt */ + r = CardClearInt(card); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to acknowledge interrupt.\n"); + return r; + } + + /* + * UniFi may have tried to generate an interrupt during the + * CardClearInt() was running. So, we need to run the host + * protocol again, to check if there are any pending requests. + */ + r = handle_host_protocol(card, &more); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) + unifi_debug_log_to_buf("c52=%d c53=%d tx=%d txc=%d rx=%d s=%d t=%d fc=%d\n", + card->cmd_prof.cmd52_count, + card->cmd_prof.cmd53_count, + card->cmd_prof.tx_count, + card->cmd_prof.tx_cfm_count, + card->cmd_prof.rx_count, + card->cmd_prof.sdio_cmd_signal, + card->cmd_prof.sdio_cmd_to_host, + card->cmd_prof.sdio_cmd_from_host_and_clear + ); + + card->cmd_prof.cmd52_count = card->cmd_prof.cmd53_count = 0; + card->cmd_prof.tx_count = card->cmd_prof.tx_cfm_count = card->cmd_prof.rx_count = 0; + + card->cmd_prof.cmd52_f0_r_count = 0; + card->cmd_prof.cmd52_f0_w_count = 0; + card->cmd_prof.cmd52_r8or16_count = 0; + card->cmd_prof.cmd52_w8or16_count = 0; + card->cmd_prof.cmd52_r16_count = 0; + card->cmd_prof.cmd52_w16_count = 0; + card->cmd_prof.cmd52_r32_count = 0; + + card->cmd_prof.sdio_cmd_signal = 0; + card->cmd_prof.sdio_cmd_clear_slot = 0; + card->cmd_prof.sdio_cmd_to_host = 0; + card->cmd_prof.sdio_cmd_from_host = 0; + card->cmd_prof.sdio_cmd_from_host_and_clear = 0; +#endif + /* If configured to run the HIP just once, work is now done */ + if (card->intmode & CSR_WIFI_INTMODE_RUN_BH_ONCE) + { + break; + } + + } while (more || card->bh_reason_unifi || card->bh_reason_host); + +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) + if ((card->intmode & CSR_WIFI_INTMODE_RUN_BH_ONCE) == 0) + { + unifi_debug_log_to_buf("proc=%d\n", + card->cmd_prof.process_count); + } +#endif + + return CSR_RESULT_SUCCESS; +} /* process_bh() */ + + +/* + * --------------------------------------------------------------------------- + * handle_host_protocol + * + * This function implements the Host Interface Protocol (HIP) as + * described in the Host Interface Protocol Specification. + * + * Arguments: + * card Pointer to card context structure. + * processed_something Pointer to location to update processing status: + * TRUE when data was transferred + * FALSE when no data was transferred (queues empty) + * + * Returns: + * CSR_RESULT_SUCCESS on success or CSR error code. + * --------------------------------------------------------------------------- + */ +static CsrResult handle_host_protocol(card_t *card, CsrBool *processed_something) +{ + CsrResult r; + CsrInt32 done; + + *processed_something = FALSE; + +#ifdef CSR_WIFI_HIP_NOISY + unifi_error(card->ospriv, " ======================== \n"); +#endif /* CSR_WIFI_HIP_NOISY */ + +#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE + card->cmd_prof.process_count++; +#endif + + card->bh_reason_unifi = card->bh_reason_host = 0; + card->generate_interrupt = 0; + + + /* + * (Re)fill the T-H signal buffer + */ + r = read_to_host_signals(card, &done); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Error occured reading to-host signals\n"); + return r; + } + if (done > 0) + { + *processed_something = TRUE; + } + + /* + * Process any to-host signals. + * Perform any requested CMD53 transfers here, but just queue any + * bulk data command responses. + */ + r = process_to_host_signals(card, &done); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Error occured processing to-host signals\n"); + return r; + } + + /* Now send any signals in the F-H queues */ + /* Give precedence to the command queue */ + r = process_fh_cmd_queue(card, &done); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Error occured processing from-host signals\n"); + return r; + } + if (done > 0) + { + *processed_something = TRUE; + } + + r = process_fh_traffic_queue(card, &done); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Error occured processing from-host data signals\n"); + return r; + } + if (done > 0) + { + *processed_something = TRUE; + } + + /* Flush out the batch of signals to the UniFi. */ + r = flush_fh_buffer(card); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to copy from-host signals to UniFi\n"); + return r; + } + + + /* + * Send the host interrupt to say the queues have been modified. + */ + if (card->generate_interrupt) + { + r = CardGenInt(card); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to notify UniFi that queues have been modified.\n"); + return r; + } + } +#ifdef CSR_WIFI_RX_PATH_SPLIT_DONT_USE_WQ + unifi_rx_queue_flush(card->ospriv); +#endif + /* See if we can re-enable transmission now */ + restart_packet_flow(card); + +#ifdef CSR_PRE_ALLOC_NET_DATA + r = prealloc_netdata_alloc(card); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "prealloc_netdata failed\n"); + return r; + } +#endif + + /* + * Don't put the thread sleep if we just interacted with the chip, + * there might be more to do if we look again. + */ + return r; +} /* handle_host_protocol() */ + + +/* + * Rounds the given signal length in bytes to a whole number + * of sig_frag_size. + */ +#define GET_CHUNKS_FOR(SIG_FRAG_SIZE, LENGTH) (((LENGTH) + ((SIG_FRAG_SIZE)-1)) / (SIG_FRAG_SIZE)) + + +/* + * --------------------------------------------------------------------------- + * read_to_host_signals + * + * Read everything pending in the UniFi TH signal buffer. + * Only do it if the local buffer is empty. + * + * Arguments: + * card Pointer to card context struct + * processed Number of signals read: + * 0 if there were no signals pending, + * 1 if we read at least one signal + * Returns: + * CSR error code if an error occurred. + * --------------------------------------------------------------------------- + */ +static CsrResult read_to_host_signals(card_t *card, CsrInt32 *processed) +{ + CsrInt32 count_thw, count_thr; + CsrInt32 unread_chunks, unread_bytes; + CsrResult r; + + *processed = 0; + + /* Read any pending signals or bulk data commands */ + count_thw = unifi_read_shared_count(card, card->sdio_ctrl_addr + 4); + if (count_thw < 0) + { + unifi_error(card->ospriv, "Failed to read to-host sig written count\n"); + return CSR_RESULT_FAILURE; + } + card->to_host_signals_w = count_thw; /* diag */ + + count_thr = card->to_host_signals_r; + + if (count_thw == count_thr) + { + return CSR_RESULT_SUCCESS; + } + + unread_chunks = + (((count_thw - count_thr) + 128) % 128) - card->th_buffer.count; + + if (unread_chunks == 0) + { + return CSR_RESULT_SUCCESS; + } + + unread_bytes = card->config_data.sig_frag_size * unread_chunks; + + + r = unifi_bulk_rw(card, + card->config_data.tohost_sigbuf_handle, + card->th_buffer.ptr, + unread_bytes, + UNIFI_SDIO_READ); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to read ToHost signal\n"); + return r; + } + + card->th_buffer.ptr += unread_bytes; + card->th_buffer.count += (CsrUint16)unread_chunks; + + *processed = 1; + + return CSR_RESULT_SUCCESS; +} /* read_to_host_signals() */ + + +/* + * --------------------------------------------------------------------------- + * update_to_host_signals_r + * + * Advance the shared-memory count of chunks read from the to-host + * signal buffer. + * Raise a UniFi internal interrupt to tell the firmware that the + * count has changed. + * + * Arguments: + * card Pointer to card context struct + * pending Number of chunks remaining + * + * Returns: + * CSR_RESULT_SUCCESS on success or CSR error code + * --------------------------------------------------------------------------- + */ +static CsrResult update_to_host_signals_r(card_t *card, CsrInt16 pending) +{ + CsrResult r; + + card->to_host_signals_r = + (card->to_host_signals_r + (card->th_buffer.count - pending)) % 128; + card->th_buffer.count = pending; + + /* Update the count of signals read */ + r = unifi_write_8_or_16(card, card->sdio_ctrl_addr + 6, + (CsrUint8)card->to_host_signals_r); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to update to-host signals read\n"); + return r; + } + + r = CardGenInt(card); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to notify UniFi that we processed to-host signals.\n"); + return r; + } + + card->generate_interrupt = 0; + + return CSR_RESULT_SUCCESS; +} /* update_to_host_signals_r() */ + + +/* + * --------------------------------------------------------------------------- + * read_unpack_cmd + * + * Converts a wire-formatted command to the host bulk_data_cmd_t structure. + * + * Arguments: + * ptr Pointer to the command + * bulk_data_cmd Pointer to the host structure + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +static void read_unpack_cmd(const CsrUint8 *ptr, bulk_data_cmd_t *bulk_data_cmd) +{ + CsrInt16 index = 0; + bulk_data_cmd->cmd_and_len = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + bulk_data_cmd->data_slot = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + bulk_data_cmd->offset = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + bulk_data_cmd->buffer_handle = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; +} /* read_unpack_cmd */ + + +/* + * --------------------------------------------------------------------------- + * process_to_host_signals + * + * Read and dispatch signals from the UniFi + * + * Arguments: + * card Pointer to card context struct + * processed Pointer to location to write processing result: + * 0 if there were no signals pending, + * 1 if we read at least one signal + * + * Returns: + * CSR error code if there was an error + * + * Notes: + * Since bulk data transfers can take a long time, if we wait until + * all are done before we acknowledge the signals, the UniFi runs out + * of buffer space. Therefore we keep a count of the bytes transferred + * in bulk data commands, and update the to-host-signals-read count + * if we've done a large transfer. + * + * All data in the f/w is stored in a little endian format, without any + * padding bytes. Every read from the memory has to be transformed in + * host (cpu specific) format, before we can process it. Therefore we + * use read_unpack_cmd() and read_unpack_signal() to convert the raw data + * contained in the card->th_buffer.buf to host structures. + * Important: UDI clients use wire-formatted structures, so we need to + * indicate all data, as we have read it from the device. + * --------------------------------------------------------------------------- + */ +static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed) +{ + CsrInt16 pending; + CsrInt16 remaining; + CsrUint8 *bufptr; + bulk_data_param_t data_ptrs; + CsrInt16 cmd; + CsrUint16 sig_len; + CsrInt16 i; + CsrUint16 chunks_in_buf; + CsrUint16 bytes_transferred = 0; + CsrResult r = CSR_RESULT_SUCCESS; + + *processed = 0; + + pending = card->th_buffer.count; + + /* Are there new to-host signals? */ + unifi_trace(card->ospriv, UDBG4, "handling %d to-host chunks\n", pending); + + if (!pending) + { + return CSR_RESULT_SUCCESS; + } + + /* + * This is a pointer to the raw data we have read from the f/w. + * Can be a signal or a command. Note that we need to convert + * it to a host structure before we process it. + */ + bufptr = card->th_buffer.buf; + + while (pending > 0) + { + CsrInt16 f_flush_count = 0; + + /* + * Command and length are common to signal and bulk data msgs. + * If command == 0 (i.e. a signal), len is number of bytes + * *following* the 2-byte header. + */ + cmd = bufptr[1] >> 4; + sig_len = bufptr[0] + ((bufptr[1] & 0x0F) << 8); + +#ifdef CSR_WIFI_HIP_NOISY + unifi_error(card->ospriv, "Received UniFi msg cmd=%d, len=%d\n", + cmd, sig_len); +#endif /* CSR_WIFI_HIP_NOISY */ + + if ((sig_len == 0) && + ((cmd != SDIO_CMD_CLEAR_SLOT) && (cmd != SDIO_CMD_PADDING))) + { + unifi_error(card->ospriv, "incomplete signal or command: has size zero\n"); + return CSR_RESULT_FAILURE; + } + /* + * Make sure the buffer contains a complete message. + * Signals may occupy multiple chunks, bulk-data commands occupy + * one chunk. + */ + if (cmd == SDIO_CMD_SIGNAL) + { + chunks_in_buf = GET_CHUNKS_FOR(card->config_data.sig_frag_size, (CsrUint16)(sig_len + 2)); + } + else + { + chunks_in_buf = 1; + } + + if (chunks_in_buf > (CsrUint16)pending) + { + unifi_error(card->ospriv, "incomplete signal (0x%x?): need %d chunks, got %d\n", + GET_SIGNAL_ID(bufptr + 2), + chunks_in_buf, pending); + unifi_error(card->ospriv, " thsw=%d, thsr=%d\n", + card->to_host_signals_w, + card->to_host_signals_r); + return CSR_RESULT_FAILURE; + } + + + switch (cmd) + { + case SDIO_CMD_SIGNAL: + /* This is a signal. Read the rest of it and then handle it. */ +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) + card->cmd_prof.sdio_cmd_signal++; +#endif + + for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) + { + /* Retrieve dataRefs[i].DataLength */ + CsrUint16 data_len = GET_PACKED_DATAREF_LEN(bufptr + 2, i); + + /* + * The bulk data length in the signal can not be greater than + * the maximun length allowed by the SDIO config structure. + */ + if (data_len > card->config_data.data_slot_size) + { + unifi_error(card->ospriv, + "Bulk Data length (%d) exceeds Maximum Bulk Data length (%d)\n", + data_len, card->config_data.data_slot_size); + return CSR_RESULT_FAILURE; + } + + /* + * Len here might not be the same as the length in the + * bulk data slot. The slot length will always be even, + * but len could be odd. + */ + if (data_len != 0) + { + /* Retrieve dataRefs[i].SlotNumber */ + CsrInt16 slot = GET_PACKED_DATAREF_SLOT(bufptr + 2, i); + + if (slot >= card->config_data.num_tohost_data_slots) + { + unifi_error(card->ospriv, "!!!bad slot number in to-host signal: %d, sig 0x%X\n", + slot, cmd); + return CSR_RESULT_FAILURE; + } + + data_ptrs.d[i].os_data_ptr = card->to_host_data[slot].os_data_ptr; + data_ptrs.d[i].os_net_buf_ptr = card->to_host_data[slot].os_net_buf_ptr; + data_ptrs.d[i].net_buf_length = card->to_host_data[slot].net_buf_length; + data_ptrs.d[i].data_length = data_len; + } + else + { + UNIFI_INIT_BULK_DATA(&data_ptrs.d[i]); + } + } + + /* + * Log the signal to the UDI, before call unifi_receive_event() as + * it can modify the bulk data. + */ + if (card->udi_hook) + { + (*card->udi_hook)(card->ospriv, bufptr + 2, sig_len, + &data_ptrs, UDI_LOG_TO_HOST); + } + +#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE + if (GET_SIGNAL_ID(bufptr + 2) == CSR_MA_PACKET_CONFIRM_ID) + { + card->cmd_prof.tx_cfm_count++; + } + else if (GET_SIGNAL_ID(bufptr + 2) == CSR_MA_PACKET_INDICATION_ID) + { + if (data_ptrs.d[0].os_data_ptr) + { + if ((*data_ptrs.d[0].os_data_ptr) & 0x08) + { + card->cmd_prof.rx_count++; + } + } + } +#endif + /* + * Check if the signal is MA-PACKET.cfm and if so check the status. + * If the status is failure, search through the slot records to find + * if any slots are occupied for this host tag. This can happen if + * f/w has not downloaded the bulkdata and before that itself it has + * signalled the confirm with failure. If it finds a slot with that + * host tag then, it clears the corresponding slot + */ + + if (GET_SIGNAL_ID(bufptr + 2) == CSR_MA_PACKET_CONFIRM_ID) + { + /* Get host tag and transmission status */ + CsrUint32 host_tag = GET_PACKED_MA_PACKET_CONFIRM_HOST_TAG(bufptr + 2); + CsrUint16 status = GET_PACKED_MA_PACKET_CONFIRM_TRANSMISSION_STATUS(bufptr + 2); + + unifi_trace(card->ospriv, UDBG4, "process_to_host_signals signal ID=%x host Tag=%x status=%x\n", + GET_SIGNAL_ID(bufptr + 2), host_tag, status); + + /* If transmission status is failure then search through the slot records + * and if for any slot records the clear slot is not done then do it now + */ + + if (status && (card->fh_slot_host_tag_record)) + { + CsrUint16 num_fh_slots = card->config_data.num_fromhost_data_slots; + CsrUint16 i = 0; + + /* search through the list of slot records and match with host tag + * If a slot is not yet cleared then clear the slot from here + */ + for (i = 0; i < num_fh_slots; i++) + { + if (card->fh_slot_host_tag_record[i] == host_tag) + { + unifi_trace(card->ospriv, UDBG4, "process_to_host_signals Clear slot=%x host tag=%x\n", i, host_tag); + card->fh_slot_host_tag_record[i] = CSR_WIFI_HIP_RESERVED_HOST_TAG; + + /* Set length field in from_host_data array to 0 */ + CardClearFromHostDataSlot(card, i); + + break; + } + } + } + } + + /* Pass event to OS layer */ + unifi_receive_event(card->ospriv, bufptr + 2, sig_len, &data_ptrs); + + /* Initialise the to_host data, so it can be re-used. */ + for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) + { + /* The slot is only valid if the length is non-zero. */ + if (GET_PACKED_DATAREF_LEN(bufptr + 2, i) != 0) + { + CsrInt16 slot = GET_PACKED_DATAREF_SLOT(bufptr + 2, i); + if (slot < card->config_data.num_tohost_data_slots) + { + UNIFI_INIT_BULK_DATA(&card->to_host_data[slot]); + } + } + } + +#ifndef CSR_WIFI_DEFER_TH_FLUSH + /* + * If we have previously transferred a lot of data, ack + * the signals read so far, so f/w can reclaim the buffer + * memory sooner. + */ + if (bytes_transferred >= TO_HOST_FLUSH_THRESHOLD) + { + f_flush_count = 1; + } +#endif + break; + + + case SDIO_CMD_CLEAR_SLOT: +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) + card->cmd_prof.sdio_cmd_clear_slot++; +#endif + /* This is a clear slot command. */ + if (sig_len != 0) + { + unifi_error(card->ospriv, "process_to_host_signals: clear slot, bad data len: 0x%X at offset %d\n", + sig_len, bufptr - card->th_buffer.buf); + return CSR_RESULT_FAILURE; + } + + r = process_clear_slot_command(card, bufptr); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to process clear slot\n"); + return r; + } + break; + + case SDIO_CMD_TO_HOST_TRANSFER: + case SDIO_CMD_FROM_HOST_TRANSFER: + case SDIO_CMD_FROM_HOST_AND_CLEAR: + case SDIO_CMD_OVERLAY_TRANSFER: + /* This is a bulk data command. */ + if (sig_len & 1) + { + unifi_error(card->ospriv, "process_to_host_signals: bulk data, bad data len: 0x%X at offset %d\n", + sig_len, bufptr - card->th_buffer.buf); + return CSR_RESULT_FAILURE; + } + + r = process_bulk_data_command(card, bufptr, cmd, sig_len); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to process bulk cmd\n"); + return r; + } + /* Count the bytes transferred */ + bytes_transferred += sig_len; + + if (cmd == SDIO_CMD_FROM_HOST_AND_CLEAR) + { +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) + card->cmd_prof.sdio_cmd_from_host_and_clear++; +#endif +#ifndef CSR_WIFI_DEFER_TH_FLUSH + f_flush_count = 1; +#endif + } +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) + else if (cmd == SDIO_CMD_FROM_HOST_TRANSFER) + { + card->cmd_prof.sdio_cmd_from_host++; + } + else if (cmd == SDIO_CMD_TO_HOST_TRANSFER) + { + card->cmd_prof.sdio_cmd_to_host++; + } +#endif + break; + + case SDIO_CMD_PADDING: + break; + + default: + unifi_error(card->ospriv, "Unrecognised to-host command: %d\n", cmd); + break; + } + + bufptr += chunks_in_buf * card->config_data.sig_frag_size; + pending -= chunks_in_buf; + + /* + * Write out the host signal count when a significant + * number of bytes of bulk data have been transferred or + * when we have performed a CopyFromHostAndClear. + */ + if (f_flush_count) + { + r = update_to_host_signals_r(card, pending); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + bytes_transferred = 0; + } + } + + if (pending) + { + unifi_warning(card->ospriv, "proc_th_sigs: %d unprocessed\n", pending); + } + + /* If we processed any signals, write the updated count to UniFi */ + if (card->th_buffer.count != pending) + { + r = update_to_host_signals_r(card, pending); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + } + + /* + * Reset the buffer pointer, copying down any un-processed signals. + * This can happen if we enable the optimisation in read_to_host_signals() + * that limits the length to whole blocks. + */ + remaining = card->th_buffer.ptr - bufptr; + if (remaining < 0) + { + unifi_error(card->ospriv, "Processing TH signals overran the buffer\n"); + return CSR_RESULT_FAILURE; + } + if (remaining > 0) + { + /* Use a safe copy because source and destination may overlap */ + CsrUint8 *d = card->th_buffer.buf; + CsrUint8 *s = bufptr; + CsrInt32 n = remaining; + while (n--) + { + *d++ = *s++; + } + } + card->th_buffer.ptr = card->th_buffer.buf + remaining; + + + /* If we reach here then we processed something */ + *processed = 1; + return CSR_RESULT_SUCCESS; +} /* process_to_host_signals() */ + + +/* + * --------------------------------------------------------------------------- + * process_clear_slot_command + * + * Process a clear slot command fom the UniFi. + * + * Arguments: + * card Pointer to card context struct + * bdcmd Pointer to bulk-data command msg from UniFi + * + * Returns: + * 0 on success, CSR error code on error + * --------------------------------------------------------------------------- + */ +static CsrResult process_clear_slot_command(card_t *card, const CsrUint8 *cmdptr) +{ + CsrUint16 data_slot; + CsrInt16 slot; + + data_slot = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cmdptr + SIZEOF_UINT16); + + unifi_trace(card->ospriv, UDBG4, "Processing clear slot cmd, slot=0x%X\n", + data_slot); + + slot = data_slot & 0x7FFF; + +#ifdef CSR_WIFI_HIP_NOISY + unifi_error(card->ospriv, "CMD clear data slot 0x%04x\n", data_slot); +#endif /* CSR_WIFI_HIP_NOISY */ + + if (data_slot & SLOT_DIR_TO_HOST) + { + if (slot >= card->config_data.num_tohost_data_slots) + { + unifi_error(card->ospriv, + "Invalid to-host data slot in SDIO_CMD_CLEAR_SLOT: %d\n", + slot); + return CSR_RESULT_FAILURE; + } + /* clear to-host data slot */ + unifi_warning(card->ospriv, "Unexpected clear to-host data slot cmd: 0x%04x\n", + data_slot); + } + else + { + if (slot >= card->config_data.num_fromhost_data_slots) + { + unifi_error(card->ospriv, + "Invalid from-host data slot in SDIO_CMD_CLEAR_SLOT: %d\n", + slot); + return CSR_RESULT_FAILURE; + } + + /* + * The driver is the owner to clear all slots now + * Ref - comment in process_fh_traffic_queue + * so it will just ignore the clear slot command from firmware + * and return success + */ + return CSR_RESULT_SUCCESS; + + /* Set length field in from_host_data array to 0 */ + /* CardClearFromHostDataSlot(card, slot); */ + } + + return CSR_RESULT_SUCCESS; +} /* process_clear_slot_command() */ + + +/* + * --------------------------------------------------------------------------- + * process_bulk_data_command + * + * Process a bulk data request from the UniFi. + * + * Arguments: + * card Pointer to card context struct + * bdcmd Pointer to bulk-data command msg from UniFi + * cmd, len Decoded values of command and length from the msg header + * Cmd will only be one of: + * SDIO_CMD_TO_HOST_TRANSFER + * SDIO_CMD_FROM_HOST_TRANSFER + * SDIO_CMD_FROM_HOST_AND_CLEAR + * SDIO_CMD_OVERLAY_TRANSFER + * + * Returns: + * CSR_RESULT_SUCCESS on success, CSR error code on error + * --------------------------------------------------------------------------- + */ +static CsrResult process_bulk_data_command(card_t *card, const CsrUint8 *cmdptr, + CsrInt16 cmd, CsrUint16 len) +{ + bulk_data_desc_t *bdslot; +#ifdef CSR_WIFI_ALIGNMENT_WORKAROUND + CsrUint8 *host_bulk_data_slot; +#endif + bulk_data_cmd_t bdcmd; + CsrInt16 offset; + CsrInt16 slot; + CsrInt16 dir; + CsrResult r; + + read_unpack_cmd(cmdptr, &bdcmd); + + unifi_trace(card->ospriv, UDBG4, "Processing bulk data cmd %d %s, len=%d, slot=0x%X\n", + cmd, lookup_bulkcmd_name(cmd), len, bdcmd.data_slot); + + /* + * Round up the transfer length if required. + * This is useful to force all transfers to be a multiple of the SDIO block + * size, so the SDIO driver won't try to use a byte-mode CMD53. These are + * broken on some hardware platforms. + */ + if (card->sdio_io_block_pad) + { + len = (len + card->sdio_io_block_size - 1) & ~(card->sdio_io_block_size - 1); + unifi_trace(card->ospriv, UDBG4, "Rounded bulk data length up to %d\n", len); + } + + slot = bdcmd.data_slot & 0x7FFF; + + if (cmd == SDIO_CMD_OVERLAY_TRANSFER) + { + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; /* Not used on CSR6xxx */ + } + else + { + if (bdcmd.data_slot & SLOT_DIR_TO_HOST) + { + /* Request is for to-host bulk data */ + + /* Check sanity of slot number */ + if (slot >= card->config_data.num_tohost_data_slots) + { + unifi_error(card->ospriv, + "Invalid to-host data slot in SDIO bulk xfr req: %d\n", + slot); + return CSR_RESULT_FAILURE; + } + + /* Allocate memory for card->to_host_data[slot] bulk data here. */ +#ifdef CSR_PRE_ALLOC_NET_DATA + r = prealloc_netdata_get(card, &card->to_host_data[slot], len); +#else + r = unifi_net_data_malloc(card->ospriv, &card->to_host_data[slot], len); +#endif + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to allocate t-h bulk data\n"); + return CSR_RESULT_FAILURE; + } + + bdslot = &card->to_host_data[slot]; + + /* Make sure that the buffer is 4-bytes aligned */ + r = unifi_net_dma_align(card->ospriv, bdslot); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to align t-h bulk data buffer for DMA\n"); + return CSR_RESULT_FAILURE; + } + } + else + { + /* Request is for from-host bulk data */ + + if (slot >= card->config_data.num_fromhost_data_slots) + { + unifi_error(card->ospriv, + "Invalid from-host data slot in SDIO bulk xfr req: %d\n", + slot); + return CSR_RESULT_FAILURE; + } + bdslot = &card->from_host_data[slot].bd; + } + offset = bdcmd.offset; + } + /* Do the transfer */ + dir = (cmd == SDIO_CMD_TO_HOST_TRANSFER)? + UNIFI_SDIO_READ : UNIFI_SDIO_WRITE; + + unifi_trace(card->ospriv, UDBG4, + "Bulk %c %s len=%d, handle %d - slot=%d %p+(%d)\n", + (dir == UNIFI_SDIO_READ)?'R' : 'W', + lookup_bulkcmd_name(cmd), + len, + bdcmd.buffer_handle, + slot, bdslot->os_data_ptr, offset); +#ifdef CSR_WIFI_HIP_NOISY + unifi_error(card->ospriv, "Bulk %s len=%d, handle %d - slot=%d %p+(%d)\n", + lookup_bulkcmd_name(cmd), + len, + bdcmd.buffer_handle, + slot, bdslot->os_data_ptr, offset); +#endif /* CSR_WIFI_HIP_NOISY */ + + + if (bdslot->os_data_ptr == NULL) + { + unifi_error(card->ospriv, "Null os_data_ptr - Bulk %s handle %d - slot=%d o=(%d)\n", + lookup_bulkcmd_name(cmd), + bdcmd.buffer_handle, + slot, + offset); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + +#ifdef CSR_WIFI_ALIGNMENT_WORKAROUND + /* if os_data_ptr is not 4-byte aligned, then allocate a new buffer and copy data + to new buffer to ensure the address passed to unifi_bulk_rw is 4-byte aligned */ + + if (len != 0 && (dir == UNIFI_SDIO_WRITE) && (((CsrIntptr)bdslot->os_data_ptr + offset) & 3)) + { + host_bulk_data_slot = CsrMemAlloc(len); + + if (!host_bulk_data_slot) + { + unifi_error(card->ospriv, " failed to allocate request_data before unifi_bulk_rw\n"); + return -1; + } + + CsrMemCpy((void *)host_bulk_data_slot, + (void *)(bdslot->os_data_ptr + offset), len); + + r = unifi_bulk_rw(card, + bdcmd.buffer_handle, + (void *)host_bulk_data_slot, + len, + dir); + } + else +#endif + { + r = unifi_bulk_rw(card, + bdcmd.buffer_handle, + (void *)(bdslot->os_data_ptr + offset), + len, + dir); + } + + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, + "Failed: %s hlen=%d, slen=%d, handle %d - slot=%d %p+0x%X\n", + lookup_bulkcmd_name(cmd), + len, /* Header length */ + bdslot->data_length, /* Length stored in slot */ + bdcmd.buffer_handle, + slot, bdslot->os_data_ptr, offset); + return r; + } + + bdslot->data_length = len; + + if (cmd == SDIO_CMD_FROM_HOST_AND_CLEAR) + { + if (slot >= card->config_data.num_fromhost_data_slots) + { + unifi_error(card->ospriv, + "Invalid from-host data slot in SDIO_CMD_FROM_HOST_AND_CLEAR: %d\n", + slot); + return CSR_RESULT_FAILURE; + } + +#ifdef CSR_WIFI_ALIGNMENT_WORKAROUND + /* moving this check before we clear host data slot */ + if ((len != 0) && (dir == UNIFI_SDIO_WRITE) && (((CsrIntptr)bdslot->os_data_ptr + offset) & 3)) + { + CsrMemFree(host_bulk_data_slot); + } +#endif + + if (card->fh_slot_host_tag_record) + { + unifi_trace(card->ospriv, UDBG5, "CopyFromHostAndClearSlot Reset entry for slot=%d\n", slot); + + /* reset the host tag entry for the corresponding slot */ + card->fh_slot_host_tag_record[slot] = CSR_WIFI_HIP_RESERVED_HOST_TAG; + } + + + /* Set length field in from_host_data array to 0 */ + CardClearFromHostDataSlot(card, slot); + } + + return CSR_RESULT_SUCCESS; +} /* process_bulk_data_command() */ + + +/* + * --------------------------------------------------------------------------- + * check_fh_sig_slots + * + * Check whether there are free signal slots available on UniFi. + * This takes into account the signals already batched since the + * from_host_signal counts were last read. + * If the from_host_signal counts indicate not enough space, we read + * the latest count from UniFi to see if some more have been freed. + * + * Arguments: + * None. + * + * Returns: + * CSR_RESULT_SUCCESS, otherwise CSR error code on error. + * --------------------------------------------------------------------------- + */ +static CsrResult check_fh_sig_slots(card_t *card, CsrUint16 needed, CsrInt32 *space_fh) +{ + CsrUint32 count_fhw; + CsrUint32 occupied_fh, slots_fh; + CsrInt32 count_fhr; + + count_fhw = card->from_host_signals_w; + count_fhr = card->from_host_signals_r; + slots_fh = card->config_data.num_fromhost_sig_frags; + + /* Only read the space in from-host queue if necessary */ + occupied_fh = (count_fhw - count_fhr) % 128; + + if (slots_fh < occupied_fh) + { + *space_fh = 0; + } + else + { + *space_fh = slots_fh - occupied_fh; + } + + if ((occupied_fh != 0) && (*space_fh < needed)) + { + count_fhr = unifi_read_shared_count(card, card->sdio_ctrl_addr + 2); + if (count_fhr < 0) + { + unifi_error(card->ospriv, "Failed to read from-host sig read count\n"); + return CSR_RESULT_FAILURE; + } + card->from_host_signals_r = count_fhr; /* diag */ + + occupied_fh = (count_fhw - count_fhr) % 128; + *space_fh = slots_fh - occupied_fh; + } + + return CSR_RESULT_SUCCESS; +} /* check_fh_sig_slots() */ + + +/* +* If we are padding the From-Host signals to the SDIO block size, +* we need to round up the needed_chunks to the SDIO block size. +*/ +#define ROUND_UP_NEEDED_CHUNKS(_card, _needed_chunks) \ + { \ + CsrUint16 _chunks_per_block; \ + CsrUint16 _chunks_in_last_block; \ + \ + if (_card->sdio_io_block_pad) \ + { \ + _chunks_per_block = _card->sdio_io_block_size / _card->config_data.sig_frag_size; \ + _chunks_in_last_block = _needed_chunks % _chunks_per_block; \ + if (_chunks_in_last_block != 0) \ + { \ + _needed_chunks = _needed_chunks + (_chunks_per_block - _chunks_in_last_block); \ + } \ + } \ + } + + +#define ROUND_UP_SPACE_CHUNKS(_card, _space_chunks) \ + { \ + CsrUint16 _chunks_per_block; \ + \ + if (_card->sdio_io_block_pad) \ + { \ + _chunks_per_block = _card->sdio_io_block_size / _card->config_data.sig_frag_size; \ + _space_chunks = ((_space_chunks / _chunks_per_block) * _chunks_per_block); \ + } \ + } + + + + + +/* + * --------------------------------------------------------------------------- + * process_fh_cmd_queue + * + * Take one signal off the from-host queue and copy it to the UniFi. + * Does nothing if the UniFi has no slots free. + * + * Arguments: + * card Pointer to card context struct + * processed Location to write: + * 0 if there is nothing on the queue to process + * 1 if a signal was successfully processed + * + * Returns: + * CSR error code if an error occurred. + * + * Notes: + * The from-host queue contains signal requests from the network driver + * and any UDI clients interspersed. UDI clients' requests have been stored + * in the from-host queue using the wire-format structures, as they arrive. + * All other requests are stored in the from-host queue using the host + * (cpu specific) structures. We use the is_packed member of the card_signal_t + * structure that describes the queue to make the distiction. + * --------------------------------------------------------------------------- + */ +static CsrResult process_fh_cmd_queue(card_t *card, CsrInt32 *processed) +{ + q_t *sigq = &card->fh_command_queue; + + CsrResult r; + CsrUint16 pending_sigs; + CsrUint16 pending_chunks; + CsrUint16 needed_chunks; + CsrInt32 space_chunks; + CsrUint16 q_index; + + *processed = 0; + + /* Get the number of pending signals. */ + pending_sigs = CSR_WIFI_HIP_Q_SLOTS_USED(sigq); + unifi_trace(card->ospriv, UDBG5, "proc_fh: %d pending\n", pending_sigs); + if (pending_sigs == 0) + { + /* Nothing to do */ + return CSR_RESULT_SUCCESS; + } + + /* Work out how many chunks we have waiting to send */ + for (pending_chunks = 0, q_index = CSR_WIFI_HIP_Q_NEXT_R_SLOT(sigq); + q_index != CSR_WIFI_HIP_Q_NEXT_W_SLOT(sigq); + q_index = CSR_WIFI_HIP_Q_WRAP(sigq, q_index + 1)) + { + card_signal_t *csptr = CSR_WIFI_HIP_Q_SLOT_DATA(sigq, q_index); + + /* + * Note that GET_CHUNKS_FOR() needs the size of the packed + * (wire-formatted) structure + */ + pending_chunks += GET_CHUNKS_FOR(card->config_data.sig_frag_size, (CsrUint16)(csptr->signal_length + 2)); + } + + /* + * Check whether UniFi has space for all the buffered bulk-data + * commands and signals as well. + */ + needed_chunks = pending_chunks + card->fh_buffer.count; + + /* Round up to the block size if necessary */ + ROUND_UP_NEEDED_CHUNKS(card, needed_chunks); + + r = check_fh_sig_slots(card, needed_chunks, &space_chunks); + if (r != CSR_RESULT_SUCCESS) + { + /* Error */ + unifi_error(card->ospriv, "Failed to read fh sig count\n"); + return r; + } + +#ifdef CSR_WIFI_HIP_NOISY + unifi_error(card->ospriv, "proc_fh: %d chunks free, need %d\n", + space_chunks, needed_chunks); +#endif /* CSR_WIFI_HIP_NOISY */ + + + /* + * Coalesce as many from-host signals as possible + * into a single block and write using a single CMD53 + */ + if (needed_chunks > (CsrUint16)space_chunks) + { + /* Round up to the block size if necessary */ + ROUND_UP_SPACE_CHUNKS(card, space_chunks); + + /* + * If the f/w has less free chunks than those already pending + * return immediately. + */ + if ((CsrUint16)space_chunks <= card->fh_buffer.count) + { + /* + * No room in UniFi for any signals after the buffered bulk + * data commands have been sent. + */ + unifi_error(card->ospriv, "not enough room to send signals, need %d chunks, %d free\n", + card->fh_buffer.count, space_chunks); + card->generate_interrupt = 1; + return CSR_RESULT_SUCCESS; + } + pending_chunks = (CsrUint16)(space_chunks - card->fh_buffer.count); + } + + while (pending_sigs-- && pending_chunks > 0) + { + card_signal_t *csptr; + CsrInt16 i; + CsrUint16 sig_chunks, total_length, free_chunks_in_fh_buffer; + bulk_data_param_t bulkdata; + CsrUint8 *packed_sigptr; + CsrUint16 signal_length = 0; + + /* Retrieve the entry at the head of the queue */ + q_index = CSR_WIFI_HIP_Q_NEXT_R_SLOT(sigq); + + /* Get a pointer to the containing card_signal_t struct */ + csptr = CSR_WIFI_HIP_Q_SLOT_DATA(sigq, q_index); + + /* Get the new length of the packed signal */ + signal_length = csptr->signal_length; + + if ((signal_length & 1) || (signal_length > UNIFI_PACKED_SIGBUF_SIZE)) + { + unifi_error(card->ospriv, "process_fh_queue: Bad len: %d\n", signal_length); + return CSR_RESULT_FAILURE; + } + + /* Need space for 2-byte SDIO protocol header + signal */ + sig_chunks = GET_CHUNKS_FOR(card->config_data.sig_frag_size, (CsrUint16)(signal_length + 2)); + + free_chunks_in_fh_buffer = GET_CHUNKS_FOR(card->config_data.sig_frag_size, + (CsrUint16)((card->fh_buffer.buf + UNIFI_FH_BUF_SIZE) - card->fh_buffer.ptr)); + if (free_chunks_in_fh_buffer < sig_chunks) + { + /* No more room */ + unifi_notice(card->ospriv, "proc_fh_cmd_q: no room in fh buffer for 0x%.4X, deferring\n", + (CsrUint16)(GET_SIGNAL_ID(csptr->sigbuf))); + break; + } + + packed_sigptr = csptr->sigbuf; + + /* Claim and set up a from-host data slot */ + if (CSR_RESULT_FAILURE == CardWriteBulkData(card, csptr, UNIFI_TRAFFIC_Q_MLME)) + { + unifi_notice(card->ospriv, "proc_fh_cmd_q: no fh data slots for 0x%.4X, deferring\n", + (CsrUint16)(GET_SIGNAL_ID(csptr->sigbuf))); + break; + } + + for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) + { + if (csptr->bulkdata[i].data_length == 0) + { + UNIFI_INIT_BULK_DATA(&bulkdata.d[i]); + } + else + { + bulkdata.d[i].os_data_ptr = csptr->bulkdata[i].os_data_ptr; + bulkdata.d[i].data_length = csptr->bulkdata[i].data_length; + } + + /* Pass the free responsibility to the lower layer. */ + UNIFI_INIT_BULK_DATA(&csptr->bulkdata[i]); + } + + unifi_trace(card->ospriv, UDBG2, "Sending signal 0x%.4X\n", + GET_SIGNAL_ID(packed_sigptr)); +#ifdef CSR_WIFI_HIP_NOISY + unifi_error(card->ospriv, "Sending signal 0x%.4X\n", + GET_SIGNAL_ID(packed_sigptr)); +#endif /* CSR_WIFI_HIP_NOISY */ + + + /* Append packed signal to F-H buffer */ + total_length = sig_chunks * card->config_data.sig_frag_size; + + card->fh_buffer.ptr[0] = (CsrUint8)(signal_length & 0xff); + card->fh_buffer.ptr[1] = + (CsrUint8)(((signal_length >> 8) & 0xf) | (SDIO_CMD_SIGNAL << 4)); + + CsrMemCpy(card->fh_buffer.ptr + 2, packed_sigptr, signal_length); + CsrMemSet(card->fh_buffer.ptr + 2 + signal_length, 0, + total_length - (2 + signal_length)); + +#ifdef CSR_WIFI_HIP_NOISY + unifi_error(card->ospriv, "proc_fh: fh_buffer %d bytes \n", + signal_length + 2); + dump(card->fh_buffer.ptr, signal_length + 2); + unifi_trace(card->ospriv, UDBG1, " \n"); +#endif /* CSR_WIFI_HIP_NOISY */ + + card->fh_buffer.ptr += total_length; + card->fh_buffer.count += sig_chunks; + +#ifdef CSR_WIFI_HIP_NOISY + unifi_error(card->ospriv, "Added %d to fh buf, len now %d, count %d\n", + signal_length, + card->fh_buffer.ptr - card->fh_buffer.buf, + card->fh_buffer.count); +#endif /* CSR_WIFI_HIP_NOISY */ + + (*processed)++; + pending_chunks -= sig_chunks; + + /* Log the signal to the UDI. */ + /* UDI will get the packed structure */ + /* Can not log the unpacked signal, unless we reconstruct it! */ + if (card->udi_hook) + { + (*card->udi_hook)(card->ospriv, packed_sigptr, signal_length, + &bulkdata, UDI_LOG_FROM_HOST); + } + + /* Remove entry from q */ + csptr->signal_length = 0; + CSR_WIFI_HIP_Q_INC_R(sigq); + } + + return CSR_RESULT_SUCCESS; +} /* process_fh_cmd_queue() */ + + +/* + * --------------------------------------------------------------------------- + * process_fh_traffic_queue + * + * Take signals off the from-host queue and copy them to the UniFi. + * Does nothing if the UniFi has no slots free. + * + * Arguments: + * card Pointer to card context struct + * sigq Pointer to the traffic queue + * processed Pointer to location to write: + * 0 if there is nothing on the queue to process + * 1 if a signal was successfully processed + * + * Returns: + * CSR error code if an error occurred. + * + * Notes: + * The from-host queue contains signal requests from the network driver + * and any UDI clients interspersed. + * --------------------------------------------------------------------------- + */ +static CsrResult process_fh_traffic_queue(card_t *card, CsrInt32 *processed) +{ + q_t *sigq = card->fh_traffic_queue; + + CsrResult r; + CsrInt16 n = 0; + CsrInt32 q_no; + CsrUint16 pending_sigs = 0; + CsrUint16 pending_chunks = 0; + CsrUint16 needed_chunks; + CsrInt32 space_chunks; + CsrUint16 q_index; + CsrUint32 host_tag = 0; + CsrUint16 slot_num = 0; + + *processed = 0; + + /* calculate how many signals are in queues and how many chunks are needed. */ + for (n = UNIFI_NO_OF_TX_QS - 1; n >= 0; n--) + { + /* Get the number of pending signals. */ + pending_sigs += CSR_WIFI_HIP_Q_SLOTS_USED(&sigq[n]); + unifi_trace(card->ospriv, UDBG5, "proc_fh%d: %d pending\n", n, pending_sigs); + + /* Work out how many chunks we have waiting to send */ + for (q_index = CSR_WIFI_HIP_Q_NEXT_R_SLOT(&sigq[n]); + q_index != CSR_WIFI_HIP_Q_NEXT_W_SLOT(&sigq[n]); + q_index = CSR_WIFI_HIP_Q_WRAP(&sigq[n], q_index + 1)) + { + card_signal_t *csptr = CSR_WIFI_HIP_Q_SLOT_DATA(&sigq[n], q_index); + + /* + * Note that GET_CHUNKS_FOR() needs the size of the packed + * (wire-formatted) structure + */ + pending_chunks += GET_CHUNKS_FOR(card->config_data.sig_frag_size, (CsrUint16)(csptr->signal_length + 2)); + } + } + + /* If there are no pending signals, just return */ + if (pending_sigs == 0) + { + /* Nothing to do */ + return CSR_RESULT_SUCCESS; + } + + /* + * Check whether UniFi has space for all the buffered bulk-data + * commands and signals as well. + */ + needed_chunks = pending_chunks + card->fh_buffer.count; + + /* Round up to the block size if necessary */ + ROUND_UP_NEEDED_CHUNKS(card, needed_chunks); + + r = check_fh_sig_slots(card, needed_chunks, &space_chunks); + if (r != CSR_RESULT_SUCCESS) + { + /* Error */ + unifi_error(card->ospriv, "Failed to read fh sig count\n"); + return r; + } + +#ifdef CSR_WIFI_HIP_NOISY + unifi_error(card->ospriv, + "process_fh_traffic_queue: %d chunks free, need %d\n", + space_chunks, needed_chunks); + read_fhsr(card); /* debugging only */ +#endif /* CSR_WIFI_HIP_NOISY */ + + /* Coalesce as many from-host signals as possible + into a single block and write using a single CMD53 */ + if (needed_chunks > (CsrUint16)space_chunks) + { + /* Round up to the block size if necessary */ + ROUND_UP_SPACE_CHUNKS(card, space_chunks); + + if ((CsrUint16)space_chunks <= card->fh_buffer.count) + { + /* + * No room in UniFi for any signals after the buffered bulk + * data commands have been sent. + */ + unifi_error(card->ospriv, "not enough room to send signals, need %d chunks, %d free\n", + card->fh_buffer.count, space_chunks); + card->generate_interrupt = 1; + return 0; + } + + pending_chunks = (CsrUint16)space_chunks - card->fh_buffer.count; + } + + q_no = UNIFI_NO_OF_TX_QS - 1; + + /* + * pending_sigs will be exhausted if there are is no restriction to the pending + * signals per queue. pending_chunks may be exhausted if there is a restriction. + * q_no check will be exhausted if there is a restriction and our round-robin + * algorith fails to fill all chunks. + */ + do + { + card_signal_t *csptr; + CsrUint16 sig_chunks, total_length, free_chunks_in_fh_buffer; + bulk_data_param_t bulkdata; + CsrUint8 *packed_sigptr; + CsrUint16 signal_length = 0; + + /* if this queue is empty go to next one. */ + if (CSR_WIFI_HIP_Q_SLOTS_USED(&sigq[q_no]) == 0) + { + q_no--; + continue; + } + + /* Retrieve the entry at the head of the queue */ + q_index = CSR_WIFI_HIP_Q_NEXT_R_SLOT(&sigq[q_no]); + + /* Get a pointer to the containing card_signal_t struct */ + csptr = CSR_WIFI_HIP_Q_SLOT_DATA(&sigq[q_no], q_index); + + /* Get the new length of the packed signal */ + signal_length = csptr->signal_length; + + if ((signal_length & 1) || (signal_length > UNIFI_PACKED_SIGBUF_SIZE)) + { + unifi_error(card->ospriv, "process_fh_traffic_queue: Bad len: %d\n", signal_length); + return CSR_RESULT_FAILURE; + } + + /* Need space for 2-byte SDIO protocol header + signal */ + sig_chunks = GET_CHUNKS_FOR(card->config_data.sig_frag_size, (CsrUint16)(signal_length + 2)); + free_chunks_in_fh_buffer = GET_CHUNKS_FOR(card->config_data.sig_frag_size, + (CsrUint16)((card->fh_buffer.buf + UNIFI_FH_BUF_SIZE) - card->fh_buffer.ptr)); + if (free_chunks_in_fh_buffer < sig_chunks) + { + /* No more room */ + unifi_notice(card->ospriv, "process_fh_traffic_queue: no more chunks.\n"); + break; + } + + packed_sigptr = csptr->sigbuf; + /* Claim and set up a from-host data slot */ + if (CSR_RESULT_FAILURE == CardWriteBulkData(card, csptr, (unifi_TrafficQueue)q_no)) + { + q_no--; + continue; + } + + /* Sanity check: MA-PACKET.req must have a valid bulk data */ + if ((csptr->bulkdata[0].data_length == 0) || (csptr->bulkdata[0].os_data_ptr == NULL)) + { + unifi_error(card->ospriv, "MA-PACKET.req with empty bulk data (%d bytes in %p)\n", + csptr->bulkdata[0].data_length, csptr->bulkdata[0].os_data_ptr); + dump(packed_sigptr, signal_length); + return CSR_RESULT_FAILURE; + } + + bulkdata.d[0].os_data_ptr = csptr->bulkdata[0].os_data_ptr; + bulkdata.d[0].data_length = csptr->bulkdata[0].data_length; + bulkdata.d[0].os_net_buf_ptr = csptr->bulkdata[0].os_net_buf_ptr; + bulkdata.d[0].net_buf_length = csptr->bulkdata[0].net_buf_length; + + /* The driver owns clearing of HIP slots for following scenario + * - driver has requested a MA-PACKET.req signal + * - The f/w after receiving the signal decides it can't send it out due to various reasons + * - So the f/w without downloading the bulk data decides to just send a confirmation with fail + * - and then sends a clear slot signal to HIP + * + * But in some cases the clear slot signal never comes and the slot remains --NOT-- freed for ever + * + * To handle this, HIP will keep the record of host tag for each occupied slot + * and then based on status of that Host tag and slot the driver will decide if the slot is + * cleared by f/w signal or the slot has to be freed by driver + */ + + if (card->fh_slot_host_tag_record) + { + /* Update the f-h slot record for the corresponding host tag */ + host_tag = GET_PACKED_MA_PACKET_REQUEST_HOST_TAG(packed_sigptr); + slot_num = GET_PACKED_DATAREF_SLOT(packed_sigptr, 0) & 0x00FF; + + unifi_trace(card->ospriv, UDBG5, + "process_fh_traffic_queue signal ID =%x fh slot=%x Host tag =%x\n", + GET_SIGNAL_ID(packed_sigptr), slot_num, host_tag); + card->fh_slot_host_tag_record[slot_num] = host_tag; + } + UNIFI_INIT_BULK_DATA(&bulkdata.d[1]); + UNIFI_INIT_BULK_DATA(&csptr->bulkdata[0]); + UNIFI_INIT_BULK_DATA(&csptr->bulkdata[1]); + +#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE + if (bulkdata.d[0].os_data_ptr) + { + if ((*bulkdata.d[0].os_data_ptr) & 0x08) + { + card->cmd_prof.tx_count++; + } + } +#endif + unifi_trace(card->ospriv, UDBG3, "Sending signal 0x%.4X\n", + GET_SIGNAL_ID(packed_sigptr)); +#ifdef CSR_WIFI_HIP_NOISY + unifi_error(card->ospriv, "Sending signal 0x%.4X\n", + GET_SIGNAL_ID(packed_sigptr)); +#endif /* CSR_WIFI_HIP_NOISY */ + + /* Append packed signal to F-H buffer */ + total_length = sig_chunks * card->config_data.sig_frag_size; + + card->fh_buffer.ptr[0] = (CsrUint8)(signal_length & 0xff); + card->fh_buffer.ptr[1] = + (CsrUint8)(((signal_length >> 8) & 0xf) | (SDIO_CMD_SIGNAL << 4)); + + CsrMemCpy(card->fh_buffer.ptr + 2, packed_sigptr, signal_length); + CsrMemSet(card->fh_buffer.ptr + 2 + signal_length, 0, + total_length - (2 + signal_length)); + +#ifdef CSR_WIFI_HIP_NOISY + unifi_error(card->ospriv, "proc_fh: fh_buffer %d bytes \n", + signal_length + 2); + dump(card->fh_buffer.ptr, signal_length + 2); + unifi_trace(card->ospriv, UDBG1, " \n"); +#endif /* CSR_WIFI_HIP_NOISY */ + + card->fh_buffer.ptr += total_length; + card->fh_buffer.count += sig_chunks; + +#ifdef CSR_WIFI_HIP_NOISY + unifi_error(card->ospriv, "Added %d to fh buf, len now %d, count %d\n", + signal_length, + card->fh_buffer.ptr - card->fh_buffer.buf, + card->fh_buffer.count); +#endif /* CSR_WIFI_HIP_NOISY */ + + (*processed)++; + pending_sigs--; + pending_chunks -= sig_chunks; + + /* Log the signal to the UDI. */ + /* UDI will get the packed structure */ + /* Can not log the unpacked signal, unless we reconstruct it! */ + if (card->udi_hook) + { + (*card->udi_hook)(card->ospriv, packed_sigptr, signal_length, + &bulkdata, UDI_LOG_FROM_HOST); + } + + /* Remove entry from q */ + csptr->signal_length = 0; + /* Note that the traffic queue has only one valid bulk data buffer. */ + csptr->bulkdata[0].data_length = 0; + + CSR_WIFI_HIP_Q_INC_R(&sigq[q_no]); + } while ((pending_sigs > 0) && (pending_chunks > 0) && (q_no >= 0)); + + return CSR_RESULT_SUCCESS; +} /* process_fh_traffic_queue() */ + + +/* + * --------------------------------------------------------------------------- + * flush_fh_buffer + * + * Write out the cache from-hosts signals to the UniFi. + * + * Arguments: + * card Pointer to card context struct + * + * Returns: + * CSR error code if an SDIO error occurred. + * --------------------------------------------------------------------------- + */ +static CsrResult flush_fh_buffer(card_t *card) +{ + CsrResult r; + CsrUint16 len; + CsrUint16 sig_units; + CsrUint16 data_round; + CsrUint16 chunks_in_last_block; + CsrUint16 padding_chunks; + CsrUint16 i; + + len = card->fh_buffer.ptr - card->fh_buffer.buf; + +#ifdef CSR_WIFI_HIP_NOISY + unifi_error(card->ospriv, "fh_buffer is at %p, ptr= %p\n", + card->fh_buffer.buf, card->fh_buffer.ptr); +#endif /* CSR_WIFI_HIP_NOISY */ + + if (len == 0) + { + return CSR_RESULT_SUCCESS; + } + +#ifdef CSR_WIFI_HIP_NOISY + if (dump_fh_buf) + { + dump(card->fh_buffer.buf, len); + dump_fh_buf = 0; + } +#endif /* CSR_WIFI_HIP_NOISY */ + + if (card->sdio_io_block_pad) + { + /* Both of these are powers of 2 */ + sig_units = card->config_data.sig_frag_size; + data_round = card->sdio_io_block_size; + + if (data_round > sig_units) + { + chunks_in_last_block = (len % data_round) / sig_units; + + if (chunks_in_last_block != 0) + { + padding_chunks = (data_round / sig_units) - chunks_in_last_block; + + CsrMemSet(card->fh_buffer.ptr, 0, padding_chunks * sig_units); + for (i = 0; i < padding_chunks; i++) + { + card->fh_buffer.ptr[1] = SDIO_CMD_PADDING << 4; + card->fh_buffer.ptr += sig_units; + } + + card->fh_buffer.count += padding_chunks; + len += padding_chunks * sig_units; + } + } + } + + r = unifi_bulk_rw(card, + card->config_data.fromhost_sigbuf_handle, + card->fh_buffer.buf, + len, UNIFI_SDIO_WRITE); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to write fh signals: %u bytes, error %d\n", len, r); + return r; + } + + /* Update from-host-signals-written signal count */ + card->from_host_signals_w = + (card->from_host_signals_w + card->fh_buffer.count) % 128u; + r = unifi_write_8_or_16(card, card->sdio_ctrl_addr + 0, + (CsrUint8)card->from_host_signals_w); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to write fh signal count %u with error %d\n", + card->from_host_signals_w, r); + return r; + } + card->generate_interrupt = 1; + + /* Reset the fh buffer pointer */ + card->fh_buffer.ptr = card->fh_buffer.buf; + card->fh_buffer.count = 0; + +#ifdef CSR_WIFI_HIP_NOISY + unifi_error(card->ospriv, "END flush: fh len %d, count %d\n", + card->fh_buffer.ptr - card->fh_buffer.buf, + card->fh_buffer.count); +#endif /* CSR_WIFI_HIP_NOISY */ + + return CSR_RESULT_SUCCESS; +} /* flush_fh_buffer() */ + + +/* + * --------------------------------------------------------------------------- + * restart_packet_flow + * + * This function is called before the bottom-half thread sleeps. + * It checks whether both data and signal resources are available and + * then calls the OS-layer function to re-enable packet transmission. + * + * Arguments: + * card Pointer to card context struct + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +static void restart_packet_flow(card_t *card) +{ + CsrUint8 q; + + /* + * We only look at the fh_traffic_queue, because that is where packets from + * the network stack are placed. + */ + for (q = 0; q <= UNIFI_TRAFFIC_Q_VO; q++) + { + if (card_is_tx_q_paused(card, q) && + CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_traffic_queue[q]) >= RESUME_XMIT_THRESHOLD) + { +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) + unifi_debug_log_to_buf("U"); +#endif + card_tx_q_unpause(card, q); + unifi_restart_xmit(card->ospriv, (unifi_TrafficQueue)q); + } + } +} /* restart_packet_flow() */ + + diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c new file mode 100644 index 0000000..403641d --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c @@ -0,0 +1,1713 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* + * --------------------------------------------------------------------------- + * FILE: csr_wifi_hip_card_sdio_mem.c + * + * PURPOSE: Implementation of the Card API for SDIO. + * + * --------------------------------------------------------------------------- + */ +#include "csr_wifi_hip_unifi.h" +#include "csr_wifi_hip_card.h" + +#define SDIO_RETRIES 3 +#define CSR_WIFI_HIP_SDIO_TRACE_DATA_LENGTH 16 + + +#define retryable_sdio_error(_csrResult) (((_csrResult) == CSR_SDIO_RESULT_CRC_ERROR) || ((_csrResult) == CSR_SDIO_RESULT_TIMEOUT)) + + +/* + * --------------------------------------------------------------------------- + * retrying_read8 + * retrying_write8 + * + * These functions provide the first level of retry for SDIO operations. + * If an SDIO command fails for reason of a response timeout or CRC + * error, it is retried immediately. If three attempts fail we report a + * failure. + * If the command failed for any other reason, the failure is reported + * immediately. + * + * Arguments: + * card Pointer to card structure. + * funcnum The SDIO function to access. + * Function 0 is the Card Configuration Register space, + * function 1/2 is the UniFi register space. + * addr Address to access + * pdata Pointer in which to return the value read. + * data Value to write. + * + * Returns: + * CSR_RESULT_SUCCESS on success, non-zero error code on error: + * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected + * CSR_RESULT_FAILURE an SDIO error occurred + * --------------------------------------------------------------------------- + */ +static CsrResult retrying_read8(card_t *card, CsrInt16 funcnum, CsrUint32 addr, CsrUint8 *pdata) +{ + CsrSdioFunction *sdio = card->sdio_if; + CsrResult r = CSR_RESULT_SUCCESS; + CsrInt16 retries; + CsrResult csrResult = CSR_RESULT_SUCCESS; + + retries = 0; + while (retries++ < SDIO_RETRIES) + { + if (funcnum == 0) + { +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) + unifi_debug_log_to_buf("r0@%02X", addr); +#endif + csrResult = CsrSdioF0Read8(sdio, addr, pdata); + } + else + { +#ifdef CSR_WIFI_TRANSPORT_CSPI + unifi_error(card->ospriv, + "retrying_read_f0_8: F1 8-bit reads are not allowed.\n"); + return CSR_RESULT_FAILURE; +#else +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) + unifi_debug_log_to_buf("r@%02X", addr); +#endif + csrResult = CsrSdioRead8(sdio, addr, pdata); +#endif + } +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) + if (csrResult != CSR_RESULT_SUCCESS) + { + unifi_debug_log_to_buf("error=%X\n", csrResult); + } + else + { + unifi_debug_log_to_buf("=%X\n", *pdata); + } +#endif + if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) + { + return CSR_WIFI_HIP_RESULT_NO_DEVICE; + } + /* + * Try again for retryable (CRC or TIMEOUT) errors, + * break on success or fatal error + */ + if (!retryable_sdio_error(csrResult)) + { +#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE + card->cmd_prof.cmd52_count++; +#endif + break; + } + unifi_trace(card->ospriv, UDBG2, "retryable SDIO error reading F%d 0x%lX\n", funcnum, addr); + } + + if ((csrResult == CSR_RESULT_SUCCESS) && (retries > 1)) + { + unifi_warning(card->ospriv, "Read succeeded after %d attempts\n", retries); + } + + if (csrResult != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to read from UniFi (addr 0x%lX) after %d tries\n", + addr, retries - 1); + /* Report any SDIO error as a general i/o error */ + r = CSR_RESULT_FAILURE; + } + + return r; +} /* retrying_read8() */ + + +static CsrResult retrying_write8(card_t *card, CsrInt16 funcnum, CsrUint32 addr, CsrUint8 data) +{ + CsrSdioFunction *sdio = card->sdio_if; + CsrResult r = CSR_RESULT_SUCCESS; + CsrInt16 retries; + CsrResult csrResult = CSR_RESULT_SUCCESS; + + retries = 0; + while (retries++ < SDIO_RETRIES) + { + if (funcnum == 0) + { +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) + unifi_debug_log_to_buf("w0@%02X=%X", addr, data); +#endif + csrResult = CsrSdioF0Write8(sdio, addr, data); + } + else + { +#ifdef CSR_WIFI_TRANSPORT_CSPI + unifi_error(card->ospriv, + "retrying_write_f0_8: F1 8-bit writes are not allowed.\n"); + return CSR_RESULT_FAILURE; +#else +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) + unifi_debug_log_to_buf("w@%02X=%X", addr, data); +#endif + csrResult = CsrSdioWrite8(sdio, addr, data); +#endif + } +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) + if (csrResult != CSR_RESULT_SUCCESS) + { + unifi_debug_log_to_buf(",error=%X", csrResult); + } + unifi_debug_string_to_buf("\n"); +#endif + if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) + { + return CSR_WIFI_HIP_RESULT_NO_DEVICE; + } + /* + * Try again for retryable (CRC or TIMEOUT) errors, + * break on success or fatal error + */ + if (!retryable_sdio_error(csrResult)) + { +#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE + card->cmd_prof.cmd52_count++; +#endif + break; + } + unifi_trace(card->ospriv, UDBG2, "retryable SDIO error writing %02X to F%d 0x%lX\n", + data, funcnum, addr); + } + + if ((csrResult == CSR_RESULT_SUCCESS) && (retries > 1)) + { + unifi_warning(card->ospriv, "Write succeeded after %d attempts\n", retries); + } + + if (csrResult != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to write to UniFi (addr 0x%lX) after %d tries\n", + addr, retries - 1); + /* Report any SDIO error as a general i/o error */ + r = CSR_RESULT_FAILURE; + } + + return r; +} /* retrying_write8() */ + + +static CsrResult retrying_read16(card_t *card, CsrInt16 funcnum, + CsrUint32 addr, CsrUint16 *pdata) +{ + CsrSdioFunction *sdio = card->sdio_if; + CsrResult r = CSR_RESULT_SUCCESS; + CsrInt16 retries; + CsrResult csrResult = CSR_RESULT_SUCCESS; + + retries = 0; + while (retries++ < SDIO_RETRIES) + { +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) + unifi_debug_log_to_buf("r@%02X", addr); +#endif + csrResult = CsrSdioRead16(sdio, addr, pdata); +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) + if (csrResult != CSR_RESULT_SUCCESS) + { + unifi_debug_log_to_buf("error=%X\n", csrResult); + } + else + { + unifi_debug_log_to_buf("=%X\n", *pdata); + } +#endif + if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) + { + return CSR_WIFI_HIP_RESULT_NO_DEVICE; + } + + /* + * Try again for retryable (CRC or TIMEOUT) errors, + * break on success or fatal error + */ + if (!retryable_sdio_error(csrResult)) + { +#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE + card->cmd_prof.cmd52_count++; +#endif + break; + } + unifi_trace(card->ospriv, UDBG2, "retryable SDIO error reading F%d 0x%lX\n", funcnum, addr); + } + + if ((csrResult == CSR_RESULT_SUCCESS) && (retries > 1)) + { + unifi_warning(card->ospriv, "Read succeeded after %d attempts\n", retries); + } + + if (csrResult != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to read from UniFi (addr 0x%lX) after %d tries\n", + addr, retries - 1); + /* Report any SDIO error as a general i/o error */ + r = CSR_RESULT_FAILURE; + } + + return r; +} /* retrying_read16() */ + + +static CsrResult retrying_write16(card_t *card, CsrInt16 funcnum, + CsrUint32 addr, CsrUint16 data) +{ + CsrSdioFunction *sdio = card->sdio_if; + CsrResult r = CSR_RESULT_SUCCESS; + CsrInt16 retries; + CsrResult csrResult = CSR_RESULT_SUCCESS; + + retries = 0; + while (retries++ < SDIO_RETRIES) + { +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) + unifi_debug_log_to_buf("w@%02X=%X", addr, data); +#endif + csrResult = CsrSdioWrite16(sdio, addr, data); +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) + if (csrResult != CSR_RESULT_SUCCESS) + { + unifi_debug_log_to_buf(",error=%X", csrResult); + } + unifi_debug_string_to_buf("\n"); +#endif + if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) + { + return CSR_WIFI_HIP_RESULT_NO_DEVICE; + } + + /* + * Try again for retryable (CRC or TIMEOUT) errors, + * break on success or fatal error + */ + if (!retryable_sdio_error(csrResult)) + { +#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE + card->cmd_prof.cmd52_count++; +#endif + break; + } + unifi_trace(card->ospriv, UDBG2, "retryable SDIO error writing %02X to F%d 0x%lX\n", + data, funcnum, addr); + } + + if ((csrResult == CSR_RESULT_SUCCESS) && (retries > 1)) + { + unifi_warning(card->ospriv, "Write succeeded after %d attempts\n", retries); + } + + if (csrResult != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to write to UniFi (addr 0x%lX) after %d tries\n", + addr, retries - 1); + /* Report any SDIO error as a general i/o error */ + r = CSR_RESULT_FAILURE; + } + + return r; +} /* retrying_write16() */ + + +/* + * --------------------------------------------------------------------------- + * sdio_read_f0 + * + * Reads a byte value from the CCCR (func 0) area of UniFi. + * + * Arguments: + * card Pointer to card structure. + * addr Address to read from + * pdata Pointer in which to store the read value. + * + * Returns: + * CSR_RESULT_SUCCESS on success, non-zero error code on error: + * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected + * CSR_RESULT_FAILURE an SDIO error occurred + * --------------------------------------------------------------------------- + */ +CsrResult sdio_read_f0(card_t *card, CsrUint32 addr, CsrUint8 *pdata) +{ +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) + card->cmd_prof.cmd52_f0_r_count++; +#endif + return retrying_read8(card, 0, addr, pdata); +} /* sdio_read_f0() */ + + +/* + * --------------------------------------------------------------------------- + * sdio_write_f0 + * + * Writes a byte value to the CCCR (func 0) area of UniFi. + * + * Arguments: + * card Pointer to card structure. + * addr Address to read from + * data Data value to write. + * + * Returns: + * CSR_RESULT_SUCCESS on success, non-zero error code on error: + * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected + * CSR_RESULT_FAILURE an SDIO error occurred + * --------------------------------------------------------------------------- + */ +CsrResult sdio_write_f0(card_t *card, CsrUint32 addr, CsrUint8 data) +{ +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) + card->cmd_prof.cmd52_f0_w_count++; +#endif + return retrying_write8(card, 0, addr, data); +} /* sdio_write_f0() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_read_direct_8_or_16 + * + * Read a 8-bit value from the UniFi SDIO interface. + * + * Arguments: + * card Pointer to card structure. + * addr Address to read from + * pdata Pointer in which to return data. + * + * Returns: + * CSR_RESULT_SUCCESS on success, non-zero error code on error: + * --------------------------------------------------------------------------- + */ +CsrResult unifi_read_direct_8_or_16(card_t *card, CsrUint32 addr, CsrUint8 *pdata) +{ +#ifdef CSR_WIFI_TRANSPORT_CSPI + CsrUint16 w; + CsrResult r; + + r = retrying_read16(card, card->function, addr, &w); + *pdata = (CsrUint8)(w & 0xFF); + return r; +#else + return retrying_read8(card, card->function, addr, pdata); +#endif +} /* unifi_read_direct_8_or_16() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_write_direct_8_or_16 + * + * Write a byte value to the UniFi SDIO interface. + * + * Arguments: + * card Pointer to card structure. + * addr Address to write to + * data Value to write. + * + * Returns: + * CSR_RESULT_SUCCESS on success, non-zero error code on error + * + * Notes: + * If 8-bit write is used, the even address *must* be written second. + * This is because writes to odd bytes are cached and not committed + * to memory until the preceding even address is written. + * --------------------------------------------------------------------------- + */ +CsrResult unifi_write_direct_8_or_16(card_t *card, CsrUint32 addr, CsrUint8 data) +{ + if (addr & 1) + { + unifi_warning(card->ospriv, + "Warning: Byte write to an odd address (0x%lX) is dangerous\n", + addr); + } + +#ifdef CSR_WIFI_TRANSPORT_CSPI + return retrying_write16(card, card->function, addr, (CsrUint16)data); +#else + return retrying_write8(card, card->function, addr, data); +#endif +} /* unifi_write_direct_8_or_16() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_read_direct16 + * + * Read a 16-bit value from the UniFi SDIO interface. + * + * Arguments: + * card Pointer to card structure. + * addr Address to read from + * pdata Pointer in which to return data. + * + * Returns: + * CSR_RESULT_SUCCESS on success, non-zero error code on error: + * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected + * CSR_RESULT_FAILURE an SDIO error occurred + * + * Notes: + * The even address *must* be read first. This is because reads from + * odd bytes are cached and read from memory when the preceding + * even address is read. + * --------------------------------------------------------------------------- + */ +CsrResult unifi_read_direct16(card_t *card, CsrUint32 addr, CsrUint16 *pdata) +{ + return retrying_read16(card, card->function, addr, pdata); +} /* unifi_read_direct16() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_write_direct16 + * + * Write a 16-bit value to the UniFi SDIO interface. + * + * Arguments: + * card Pointer to card structure. + * addr Address to write to + * data Value to write. + * + * Returns: + * CSR_RESULT_SUCCESS on success, non-zero error code on error: + * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected + * CSR_RESULT_FAILURE an SDIO error occurred + * + * Notes: + * The even address *must* be written second. This is because writes to + * odd bytes are cached and not committed to memory until the preceding + * even address is written. + * --------------------------------------------------------------------------- + */ +CsrResult unifi_write_direct16(card_t *card, CsrUint32 addr, CsrUint16 data) +{ + return retrying_write16(card, card->function, addr, data); +} /* unifi_write_direct16() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_read_direct32 + * + * Read a 32-bit value from the UniFi SDIO interface. + * + * Arguments: + * card Pointer to card structure. + * addr Address to read from + * pdata Pointer in which to return data. + * + * Returns: + * CSR_RESULT_SUCCESS on success, non-zero error code on error: + * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected + * CSR_RESULT_FAILURE an SDIO error occurred + * --------------------------------------------------------------------------- + */ +CsrResult unifi_read_direct32(card_t *card, CsrUint32 addr, CsrUint32 *pdata) +{ + CsrResult r; + CsrUint16 w0, w1; + + r = retrying_read16(card, card->function, addr, &w0); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + + r = retrying_read16(card, card->function, addr + 2, &w1); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + + *pdata = ((CsrUint32)w1 << 16) | (CsrUint32)w0; + + return CSR_RESULT_SUCCESS; +} /* unifi_read_direct32() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_read_directn_match + * + * Read multiple 8-bit values from the UniFi SDIO interface, + * stopping when either we have read 'len' bytes or we have read + * a octet equal to 'match'. If 'match' is not a valid octet + * then this function is the same as 'unifi_read_directn'. + * + * Arguments: + * card Pointer to card structure. + * addr Start address to read from. + * pdata Pointer to which to write data. + * len Maximum umber of bytes to read + * match The value to stop reading at. + * num Pointer to buffer to write number of bytes read + * + * Returns: + * number of octets read on success, negative error code on error: + * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected + * CSR_RESULT_FAILURE an SDIO error occurred + * + * Notes: + * The even address *must* be read first. This is because reads from + * odd bytes are cached and read from memory when the preceding + * even address is read. + * --------------------------------------------------------------------------- + */ +static CsrResult unifi_read_directn_match(card_t *card, CsrUint32 addr, void *pdata, CsrUint16 len, CsrInt8 m, CsrUint32 *num) +{ + CsrResult r; + CsrUint32 i; + CsrUint8 *cptr; + CsrUint16 w; + + *num = 0; + + cptr = (CsrUint8 *)pdata; + for (i = 0; i < len; i += 2) + { + r = retrying_read16(card, card->function, addr, &w); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + + *cptr++ = ((CsrUint8)w & 0xFF); + if ((m >= 0) && (((CsrInt8)w & 0xFF) == m)) + { + break; + } + + if (i + 1 == len) + { + /* The len is odd. Ignore the last high byte */ + break; + } + + *cptr++ = ((CsrUint8)(w >> 8) & 0xFF); + if ((m >= 0) && (((CsrInt8)(w >> 8) & 0xFF) == m)) + { + break; + } + + addr += 2; + } + + *num = (CsrInt32)(cptr - (CsrUint8 *)pdata); + return CSR_RESULT_SUCCESS; +} + + +/* + * --------------------------------------------------------------------------- + * unifi_read_directn + * + * Read multiple 8-bit values from the UniFi SDIO interface. + * + * Arguments: + * card Pointer to card structure. + * addr Start address to read from. + * pdata Pointer to which to write data. + * len Number of bytes to read + * + * Returns: + * 0 on success, non-zero error code on error: + * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected + * CSR_RESULT_FAILURE an SDIO error occurred + * + * Notes: + * The even address *must* be read first. This is because reads from + * odd bytes are cached and read from memory when the preceding + * even address is read. + * --------------------------------------------------------------------------- + */ +CsrResult unifi_read_directn(card_t *card, CsrUint32 addr, void *pdata, CsrUint16 len) +{ + CsrUint32 num; + + return unifi_read_directn_match(card, addr, pdata, len, -1, &num); +} /* unifi_read_directn() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_write_directn + * + * Write multiple 8-bit values to the UniFi SDIO interface. + * + * Arguments: + * card Pointer to card structure. + * addr Start address to write to. + * pdata Source data pointer. + * len Number of bytes to write, must be even. + * + * Returns: + * 0 on success, non-zero error code on error: + * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected + * CSR_RESULT_FAILURE an SDIO error occurred + * + * Notes: + * The UniFi has a peculiar 16-bit bus architecture. Writes are only + * committed to memory when an even address is accessed. Writes to + * odd addresses are cached and only committed if the next write is + * to the preceding address. + * This means we must write data as pairs of bytes in reverse order. + * --------------------------------------------------------------------------- + */ +CsrResult unifi_write_directn(card_t *card, CsrUint32 addr, void *pdata, CsrUint16 len) +{ + CsrResult r; + CsrUint8 *cptr; + CsrInt16 signed_len; + + cptr = (CsrUint8 *)pdata; + signed_len = (CsrInt16)len; + while (signed_len > 0) + { + /* This is UniFi-1 specific code. CSPI not supported so 8-bit write allowed */ + r = retrying_write16(card, card->function, addr, *cptr); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + + cptr += 2; + addr += 2; + signed_len -= 2; + } + + return CSR_RESULT_SUCCESS; +} /* unifi_write_directn() */ + + +/* + * --------------------------------------------------------------------------- + * set_dmem_page + * set_pmem_page + * + * Set up the page register for the shared data memory window or program + * memory window. + * + * Arguments: + * card Pointer to card structure. + * dmem_addr UniFi shared-data-memory address to access. + * pmem_addr UniFi program memory address to access. This includes + * External FLASH memory at 0x000000 + * Processor program memory at 0x200000 + * External SRAM at memory 0x400000 + * paddr Location to write an SDIO address (24-bit) for + * use in a unifi_read_direct or unifi_write_direct call. + * + * Returns: + * CSR_RESULT_SUCCESS on success + * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected + * CSR_RESULT_FAILURE an SDIO error occurred + * --------------------------------------------------------------------------- + */ +static CsrResult set_dmem_page(card_t *card, CsrUint32 dmem_addr, CsrUint32 *paddr) +{ + CsrUint16 page, addr; + CsrUint32 len; + CsrResult r; + + *paddr = 0; + + if (!ChipHelper_DecodeWindow(card->helper, + CHIP_HELPER_WINDOW_3, + CHIP_HELPER_WT_SHARED, + dmem_addr / 2, + &page, &addr, &len)) + { + unifi_error(card->ospriv, "Failed to decode SHARED_DMEM_PAGE %08lx\n", dmem_addr); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + if (page != card->dmem_page) + { + unifi_trace(card->ospriv, UDBG6, "setting dmem page=0x%X, addr=0x%lX\n", page, addr); + + /* change page register */ + r = unifi_write_direct16(card, ChipHelper_HOST_WINDOW3_PAGE(card->helper) * 2, page); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to write SHARED_DMEM_PAGE\n"); + return r; + } + + card->dmem_page = page; + } + + *paddr = ((CsrInt32)addr * 2) + (dmem_addr & 1); + + return CSR_RESULT_SUCCESS; +} /* set_dmem_page() */ + + +static CsrResult set_pmem_page(card_t *card, CsrUint32 pmem_addr, + enum chip_helper_window_type mem_type, CsrUint32 *paddr) +{ + CsrUint16 page, addr; + CsrUint32 len; + CsrResult r; + + *paddr = 0; + + if (!ChipHelper_DecodeWindow(card->helper, + CHIP_HELPER_WINDOW_2, + mem_type, + pmem_addr / 2, + &page, &addr, &len)) + { + unifi_error(card->ospriv, "Failed to decode PROG MEM PAGE %08lx %d\n", pmem_addr, mem_type); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + if (page != card->pmem_page) + { + unifi_trace(card->ospriv, UDBG6, "setting pmem page=0x%X, addr=0x%lX\n", page, addr); + + /* change page register */ + r = unifi_write_direct16(card, ChipHelper_HOST_WINDOW2_PAGE(card->helper) * 2, page); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to write PROG MEM PAGE\n"); + return r; + } + + card->pmem_page = page; + } + + *paddr = ((CsrInt32)addr * 2) + (pmem_addr & 1); + + return CSR_RESULT_SUCCESS; +} /* set_pmem_page() */ + + +/* + * --------------------------------------------------------------------------- + * set_page + * + * Sets up the appropriate page register to access the given address. + * Returns the sdio address at which the unifi address can be accessed. + * + * Arguments: + * card Pointer to card structure. + * generic_addr UniFi internal address to access, in Generic Pointer + * format, i.e. top byte is space indicator. + * paddr Location to write page address + * SDIO address (24-bit) for use in a unifi_read_direct or + * unifi_write_direct call + * + * Returns: + * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected + * CSR_RESULT_FAILURE an SDIO error occurred + * CSR_WIFI_HIP_RESULT_INVALID_VALUE the address is invalid + * --------------------------------------------------------------------------- + */ +static CsrResult set_page(card_t *card, CsrUint32 generic_addr, CsrUint32 *paddr) +{ + CsrInt32 space; + CsrUint32 addr; + CsrResult r = CSR_RESULT_SUCCESS; + + if (!paddr) + { + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + *paddr = 0; + space = UNIFI_GP_SPACE(generic_addr); + addr = UNIFI_GP_OFFSET(generic_addr); + switch (space) + { + case UNIFI_SH_DMEM: + /* Shared Data Memory is accessed via the Shared Data Memory window */ + r = set_dmem_page(card, addr, paddr); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + break; + + case UNIFI_EXT_FLASH: + if (!ChipHelper_HasFlash(card->helper)) + { + unifi_error(card->ospriv, "Bad address space for chip in generic pointer 0x%08lX (helper=0x%x)\n", + generic_addr, card->helper); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + /* External FLASH is accessed via the Program Memory window */ + r = set_pmem_page(card, addr, CHIP_HELPER_WT_FLASH, paddr); + break; + + case UNIFI_EXT_SRAM: + if (!ChipHelper_HasExtSram(card->helper)) + { + unifi_error(card->ospriv, "Bad address space for chip in generic pointer 0x%08l (helper=0x%x)\n", + generic_addr, card->helper); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + /* External SRAM is accessed via the Program Memory window */ + r = set_pmem_page(card, addr, CHIP_HELPER_WT_EXT_SRAM, paddr); + break; + + case UNIFI_REGISTERS: + /* Registers are accessed directly */ + *paddr = addr; + break; + + case UNIFI_PHY_DMEM: + r = unifi_set_proc_select(card, UNIFI_PROC_PHY); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + *paddr = ChipHelper_DATA_MEMORY_RAM_OFFSET(card->helper) * 2 + addr; + break; + + case UNIFI_MAC_DMEM: + r = unifi_set_proc_select(card, UNIFI_PROC_MAC); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + *paddr = ChipHelper_DATA_MEMORY_RAM_OFFSET(card->helper) * 2 + addr; + break; + + case UNIFI_BT_DMEM: + if (!ChipHelper_HasBt(card->helper)) + { + unifi_error(card->ospriv, "Bad address space for chip in generic pointer 0x%08lX (helper=0x%x)\n", + generic_addr, card->helper); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + r = unifi_set_proc_select(card, UNIFI_PROC_BT); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + *paddr = ChipHelper_DATA_MEMORY_RAM_OFFSET(card->helper) * 2 + addr; + break; + + case UNIFI_PHY_PMEM: + r = unifi_set_proc_select(card, UNIFI_PROC_PHY); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + r = set_pmem_page(card, addr, CHIP_HELPER_WT_CODE_RAM, paddr); + break; + + case UNIFI_MAC_PMEM: + r = unifi_set_proc_select(card, UNIFI_PROC_MAC); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + r = set_pmem_page(card, addr, CHIP_HELPER_WT_CODE_RAM, paddr); + break; + + case UNIFI_BT_PMEM: + if (!ChipHelper_HasBt(card->helper)) + { + unifi_error(card->ospriv, "Bad address space for chip in generic pointer 0x%08lX (helper=0x%x)\n", + generic_addr, card->helper); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + r = unifi_set_proc_select(card, UNIFI_PROC_BT); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + r = set_pmem_page(card, addr, CHIP_HELPER_WT_CODE_RAM, paddr); + break; + + case UNIFI_PHY_ROM: + if (!ChipHelper_HasRom(card->helper)) + { + unifi_error(card->ospriv, "Bad address space for chip in generic pointer 0x%08lX (helper=0x%x)\n", + generic_addr, card->helper); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + r = unifi_set_proc_select(card, UNIFI_PROC_PHY); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + r = set_pmem_page(card, addr, CHIP_HELPER_WT_ROM, paddr); + break; + + case UNIFI_MAC_ROM: + if (!ChipHelper_HasRom(card->helper)) + { + unifi_error(card->ospriv, "Bad address space for chip in generic pointer 0x%08lX (helper=0x%x)\n", + generic_addr, card->helper); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + r = unifi_set_proc_select(card, UNIFI_PROC_MAC); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + r = set_pmem_page(card, addr, CHIP_HELPER_WT_ROM, paddr); + break; + + case UNIFI_BT_ROM: + if (!ChipHelper_HasRom(card->helper) || !ChipHelper_HasBt(card->helper)) + { + unifi_error(card->ospriv, "Bad address space for chip in generic pointer 0x%08lX (helper=0x%x)\n", + generic_addr, card->helper); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + r = unifi_set_proc_select(card, UNIFI_PROC_BT); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + r = set_pmem_page(card, addr, CHIP_HELPER_WT_ROM, paddr); + break; + + default: + unifi_error(card->ospriv, "Bad address space %d in generic pointer 0x%08lX (helper=0x%x)\n", + space, generic_addr, card->helper); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + return r; +} /* set_page() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_set_proc_select + * + * + * Arguments: + * card Pointer to card structure. + * select Which XAP core to select + * + * Returns: + * 0 on success, non-zero error code on error: + * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected + * CSR_RESULT_FAILURE an SDIO error occurred + * --------------------------------------------------------------------------- + */ +CsrResult unifi_set_proc_select(card_t *card, enum unifi_dbg_processors_select select) +{ + CsrResult r; + + /* Verify the the select value is allowed. */ + switch (select) + { + case UNIFI_PROC_MAC: + case UNIFI_PROC_PHY: + case UNIFI_PROC_BOTH: + break; + + + default: + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + if (card->proc_select != (CsrUint32)select) + { + r = unifi_write_direct16(card, + ChipHelper_DBG_HOST_PROC_SELECT(card->helper) * 2, + (CsrUint8)select); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to write to Proc Select register\n"); + return r; + } + + card->proc_select = (CsrUint32)select; + } + + return CSR_RESULT_SUCCESS; +} + + +/* + * --------------------------------------------------------------------------- + * unifi_read_8_or_16 + * + * Performs a byte read of the given address in shared data memory. + * Set up the shared data memory page register as required. + * + * Arguments: + * card Pointer to card structure. + * unifi_addr UniFi shared-data-memory address to access. + * pdata Pointer to a byte variable for the value read. + * + * Returns: + * CSR_RESULT_SUCCESS on success, non-zero error code on error: + * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected + * CSR_RESULT_FAILURE an SDIO error occurred + * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified + * --------------------------------------------------------------------------- + */ +CsrResult unifi_read_8_or_16(card_t *card, CsrUint32 unifi_addr, CsrUint8 *pdata) +{ + CsrUint32 sdio_addr; + CsrResult r; +#ifdef CSR_WIFI_TRANSPORT_CSPI + CsrUint16 w; +#endif + + r = set_page(card, unifi_addr, &sdio_addr); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) + card->cmd_prof.cmd52_r8or16_count++; +#endif +#ifdef CSR_WIFI_TRANSPORT_CSPI + r = retrying_read16(card, card->function, sdio_addr, &w); + *pdata = (CsrUint8)(w & 0xFF); + return r; +#else + return retrying_read8(card, card->function, sdio_addr, pdata); +#endif +} /* unifi_read_8_or_16() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_write_8_or_16 + * + * Performs a byte write of the given address in shared data memory. + * Set up the shared data memory page register as required. + * + * Arguments: + * card Pointer to card context struct. + * unifi_addr UniFi shared-data-memory address to access. + * data Value to write. + * + * Returns: + * CSR_RESULT_SUCCESS on success, non-zero error code on error: + * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected + * CSR_RESULT_FAILURE an SDIO error occurred + * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified + * + * Notes: + * Beware using unifi_write8() because byte writes are not safe on UniFi. + * Writes to odd bytes are cached, writes to even bytes perform a 16-bit + * write with the previously cached odd byte. + * --------------------------------------------------------------------------- + */ +CsrResult unifi_write_8_or_16(card_t *card, CsrUint32 unifi_addr, CsrUint8 data) +{ + CsrUint32 sdio_addr; + CsrResult r; +#ifdef CSR_WIFI_TRANSPORT_CSPI + CsrUint16 w; +#endif + + r = set_page(card, unifi_addr, &sdio_addr); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + + if (sdio_addr & 1) + { + unifi_warning(card->ospriv, + "Warning: Byte write to an odd address (0x%lX) is dangerous\n", + sdio_addr); + } + +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) + card->cmd_prof.cmd52_w8or16_count++; +#endif +#ifdef CSR_WIFI_TRANSPORT_CSPI + w = data; + return retrying_write16(card, card->function, sdio_addr, w); +#else + return retrying_write8(card, card->function, sdio_addr, data); +#endif +} /* unifi_write_8_or_16() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_card_read16 + * + * Performs a 16-bit read of the given address in shared data memory. + * Set up the shared data memory page register as required. + * + * Arguments: + * card Pointer to card structure. + * unifi_addr UniFi shared-data-memory address to access. + * pdata Pointer to a 16-bit int variable for the value read. + * + * Returns: + * CSR_RESULT_SUCCESS on success, non-zero error code on error: + * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected + * CSR_RESULT_FAILURE an SDIO error occurred + * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified + * --------------------------------------------------------------------------- + */ +CsrResult unifi_card_read16(card_t *card, CsrUint32 unifi_addr, CsrUint16 *pdata) +{ + CsrUint32 sdio_addr; + CsrResult r; + + r = set_page(card, unifi_addr, &sdio_addr); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) + card->cmd_prof.cmd52_r16_count++; +#endif + return unifi_read_direct16(card, sdio_addr, pdata); +} /* unifi_card_read16() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_card_write16 + * + * Performs a 16-bit write of the given address in shared data memory. + * Set up the shared data memory page register as required. + * + * Arguments: + * card Pointer to card structure. + * unifi_addr UniFi shared-data-memory address to access. + * pdata Pointer to a byte variable for the value write. + * + * Returns: + * CSR_RESULT_SUCCESS on success, non-zero error code on error: + * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected + * CSR_RESULT_FAILURE an SDIO error occurred + * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified + * --------------------------------------------------------------------------- + */ +CsrResult unifi_card_write16(card_t *card, CsrUint32 unifi_addr, CsrUint16 data) +{ + CsrUint32 sdio_addr; + CsrResult r; + + r = set_page(card, unifi_addr, &sdio_addr); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) + card->cmd_prof.cmd52_w16_count++; +#endif + return unifi_write_direct16(card, sdio_addr, data); +} /* unifi_card_write16() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_read32 + * + * Performs a 32-bit read of the given address in shared data memory. + * Set up the shared data memory page register as required. + * + * Arguments: + * card Pointer to card structure. + * unifi_addr UniFi shared-data-memory address to access. + * pdata Pointer to a int variable for the value read. + * + * Returns: + * CSR_RESULT_SUCCESS on success, non-zero error code on error: + * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected + * CSR_RESULT_FAILURE an SDIO error occurred + * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified + * --------------------------------------------------------------------------- + */ +CsrResult unifi_read32(card_t *card, CsrUint32 unifi_addr, CsrUint32 *pdata) +{ + CsrUint32 sdio_addr; + CsrResult r; + + r = set_page(card, unifi_addr, &sdio_addr); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) + card->cmd_prof.cmd52_r32_count++; +#endif + return unifi_read_direct32(card, sdio_addr, pdata); +} /* unifi_read32() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_card_readn + * unifi_readnz + * + * Read multiple 8-bit values from the UniFi SDIO interface. + * This function interprets the address as a GenericPointer as + * defined in the UniFi Host Interface Protocol Specification. + * The readnz version of this function will stop when it reads a + * zero octet. + * + * Arguments: + * card Pointer to card structure. + * unifi_addr UniFi shared-data-memory address to access. + * pdata Pointer to which to write data. + * len Number of bytes to read + * + * Returns: + * CSR_RESULT_SUCCESS on success, non-zero error code on error: + * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected + * CSR_RESULT_FAILURE an SDIO error occurred + * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified + * --------------------------------------------------------------------------- + */ +CsrResult unifi_readn_match(card_t *card, CsrUint32 unifi_addr, void *pdata, CsrUint16 len, CsrInt8 match) +{ + CsrUint32 sdio_addr; + CsrResult r; + CsrUint32 num; + + r = set_page(card, unifi_addr, &sdio_addr); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + + r = unifi_read_directn_match(card, sdio_addr, pdata, len, match, &num); + return r; +} /* unifi_readn_match() */ + + +CsrResult unifi_card_readn(card_t *card, CsrUint32 unifi_addr, void *pdata, CsrUint16 len) +{ + return unifi_readn_match(card, unifi_addr, pdata, len, -1); +} /* unifi_card_readn() */ + + +CsrResult unifi_readnz(card_t *card, CsrUint32 unifi_addr, void *pdata, CsrUint16 len) +{ + return unifi_readn_match(card, unifi_addr, pdata, len, 0); +} /* unifi_readnz() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_read_shared_count + * + * Read signal count locations, checking for an SDIO error. The + * signal count locations only contain a valid number if the + * highest bit isn't set. + * + * Arguments: + * card Pointer to card context structure. + * addr Shared-memory address to read. + * + * Returns: + * Value read from memory (0-127) or -1 on error + * --------------------------------------------------------------------------- + */ +CsrInt32 unifi_read_shared_count(card_t *card, CsrUint32 addr) +{ + CsrUint8 b; + /* I've increased this count, because I have seen cases where + * there were three reads in a row with the top bit set. I'm not + * sure why this might have happened, but I can't see a problem + * with increasing this limit. It's better to take a while to + * recover than to fail. */ +#define SHARED_READ_RETRY_LIMIT 10 + CsrInt32 i; + + /* + * Get the to-host-signals-written count. + * The top-bit will be set if the firmware was in the process of + * changing the value, in which case we read again. + */ + /* Limit the number of repeats so we don't freeze */ + for (i = 0; i < SHARED_READ_RETRY_LIMIT; i++) + { + CsrResult r; + r = unifi_read_8_or_16(card, addr, &b); + if (r != CSR_RESULT_SUCCESS) + { + return -1; + } + if (!(b & 0x80)) + { + /* There is a chance that the MSB may have contained invalid data + * (overflow) at the time it was read. Therefore mask off the MSB. + * This avoids a race between driver read and firmware write of the + * word, the value we need is in the lower 8 bits anway. + */ + return (CsrInt32)(b & 0xff); + } + } + + return -1; /* this function has changed in WMM mods */ +} /* unifi_read_shared_count() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_writen + * + * Write multiple 8-bit values to the UniFi SDIO interface using CMD52 + * This function interprets the address as a GenericPointer as + * defined in the UniFi Host Interface Protocol Specification. + * + * Arguments: + * card Pointer to card structure. + * unifi_addr UniFi shared-data-memory address to access. + * pdata Pointer to which to write data. + * len Number of bytes to write + * + * Returns: + * 0 on success, non-zero error code on error: + * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected + * CSR_RESULT_FAILURE an SDIO error occurred + * CSR_WIFI_HIP_RESULT_INVALID_VALUE an odd length or length too big. + * --------------------------------------------------------------------------- + */ +CsrResult unifi_writen(card_t *card, CsrUint32 unifi_addr, void *pdata, CsrUint16 len) +{ + CsrUint32 sdio_addr; + CsrResult r; + + r = set_page(card, unifi_addr, &sdio_addr); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + + return unifi_write_directn(card, sdio_addr, pdata, len); +} /* unifi_writen() */ + + +static CsrResult csr_sdio_block_rw(card_t *card, CsrInt16 funcnum, + CsrUint32 addr, CsrUint8 *pdata, + CsrUint16 count, CsrInt16 dir_is_write) +{ + CsrResult csrResult; + + if (dir_is_write == UNIFI_SDIO_READ) + { +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) + unifi_debug_log_to_buf("r@%02X#%X=", addr, count); +#endif +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) + unifi_debug_log_to_buf("R"); +#endif + csrResult = CsrSdioRead(card->sdio_if, addr, pdata, count); +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) + unifi_debug_log_to_buf("<"); +#endif + } + else + { +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) + unifi_debug_log_to_buf("w@%02X#%X=", addr, count); + unifi_debug_hex_to_buf(pdata, count > CSR_WIFI_HIP_SDIO_TRACE_DATA_LENGTH?CSR_WIFI_HIP_SDIO_TRACE_DATA_LENGTH : count); +#endif +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) + unifi_debug_log_to_buf("W"); +#endif + csrResult = CsrSdioWrite(card->sdio_if, addr, pdata, count); +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) + unifi_debug_log_to_buf(">"); +#endif + } +#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE + card->cmd_prof.cmd53_count++; +#endif +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) + if (csrResult != CSR_RESULT_SUCCESS) + { + unifi_debug_log_to_buf("error=%X", csrResult); + } + else if (dir_is_write == UNIFI_SDIO_READ) + { + unifi_debug_hex_to_buf(pdata, count > CSR_WIFI_HIP_SDIO_TRACE_DATA_LENGTH?CSR_WIFI_HIP_SDIO_TRACE_DATA_LENGTH : count); + } + unifi_debug_string_to_buf("\n"); +#endif + return csrResult; /* CSR SDIO (not HIP) error code */ +} + + +/* + * --------------------------------------------------------------------------- + * unifi_bulk_rw + * + * Transfer bulk data to or from the UniFi SDIO interface. + * This function is used to read or write signals and bulk data. + * + * Arguments: + * card Pointer to card structure. + * handle Value to put in the Register Address field of the CMD53 req. + * data Pointer to data to write. + * direction One of UNIFI_SDIO_READ or UNIFI_SDIO_WRITE + * + * Returns: + * CSR_RESULT_SUCCESS on success, non-zero error code on error: + * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected + * CSR_RESULT_FAILURE an SDIO error occurred + * + * Notes: + * This function uses SDIO CMD53, which is the block transfer mode. + * --------------------------------------------------------------------------- + */ +CsrResult unifi_bulk_rw(card_t *card, CsrUint32 handle, void *pdata, + CsrUint32 len, CsrInt16 direction) +{ +#define CMD53_RETRIES 3 + /* + * Ideally instead of sleeping, we want to busy wait. + * Currently there is no framework API to do this. When it becomes available, + * we can use it to busy wait using usecs + */ +#define REWIND_RETRIES 15 /* when REWIND_DELAY==1msec, or 250 when REWIND_DELAY==50usecs */ +#define REWIND_POLLING_RETRIES 5 +#define REWIND_DELAY 1 /* msec or 50usecs */ + CsrResult csrResult; /* SDIO error code */ + CsrResult r = CSR_RESULT_SUCCESS; /* HIP error code */ + CsrInt16 retries = CMD53_RETRIES; + CsrInt16 stat_retries; + CsrUint8 stat; + CsrInt16 dump_read; +#ifdef UNIFI_DEBUG + CsrUint8 *pdata_lsb = ((CsrUint8 *)&pdata) + card->lsb; +#endif +#ifdef CSR_WIFI_MAKE_FAKE_CMD53_ERRORS + static CsrInt16 fake_error; +#endif + + dump_read = 0; +#ifdef UNIFI_DEBUG + if (*pdata_lsb & 1) + { + unifi_notice(card->ospriv, "CD53 request on a unaligned buffer (addr: 0x%X) dir %s-Host\n", + pdata, (direction == UNIFI_SDIO_READ)?"To" : "From"); + if (direction == UNIFI_SDIO_WRITE) + { + dump(pdata, (CsrUint16)len); + } + else + { + dump_read = 1; + } + } +#endif + + /* Defensive checks */ + if (!pdata) + { + unifi_error(card->ospriv, "Null pdata for unifi_bulk_rw() len: %d\n", len); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + if ((len & 1) || (len > 0xffff)) + { + unifi_error(card->ospriv, "Impossible CMD53 length requested: %d\n", len); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + while (1) + { + csrResult = csr_sdio_block_rw(card, card->function, handle, + (CsrUint8 *)pdata, (CsrUint16)len, + direction); + if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) + { + return CSR_WIFI_HIP_RESULT_NO_DEVICE; + } +#ifdef CSR_WIFI_MAKE_FAKE_CMD53_ERRORS + if (++fake_error > 100) + { + fake_error = 90; + unifi_warning(card->ospriv, "Faking a CMD53 error,\n"); + if (csrResult == CSR_RESULT_SUCCESS) + { + csrResult = CSR_RESULT_FAILURE; + } + } +#endif + if (csrResult == CSR_RESULT_SUCCESS) + { + if (dump_read) + { + dump(pdata, (CsrUint16)len); + } + break; + } + + /* + * At this point the SDIO driver should have written the I/O Abort + * register to notify UniFi that the command has failed. + * UniFi-1 and UniFi-2 (not UF6xxx) use the same register to store the + * Deep Sleep State. This means we have to restore the Deep Sleep + * State (AWAKE in any case since we can not perform a CD53 in any other + * state) by rewriting the I/O Abort register to its previous value. + */ + if (card->chip_id <= SDIO_CARD_ID_UNIFI_2) + { + unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE); + } + + /* If csr_sdio_block_rw() failed in a non-retryable way, or retries exhausted + * then stop retrying + */ + if (!retryable_sdio_error(csrResult)) + { + unifi_error(card->ospriv, "Fatal error in a CMD53 transfer\n"); + break; + } + + /* + * These happen from time to time, try again + */ + if (--retries == 0) + { + break; + } + + unifi_trace(card->ospriv, UDBG4, + "Error in a CMD53 transfer, retrying (h:%d,l:%u)...\n", + (CsrInt16)handle & 0xff, len); + + /* The transfer failed, rewind and try again */ + r = unifi_write_8_or_16(card, card->sdio_ctrl_addr + 8, + (CsrUint8)(handle & 0xff)); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + /* + * If we can't even do CMD52 (register read/write) then + * stop here. + */ + unifi_error(card->ospriv, "Failed to write REWIND cmd\n"); + return r; + } + + /* Signal the UniFi to look for the rewind request. */ + r = CardGenInt(card); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + + /* Wait for UniFi to acknowledge the rewind */ + stat_retries = REWIND_RETRIES; + while (1) + { + r = unifi_read_8_or_16(card, card->sdio_ctrl_addr + 8, &stat); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to read REWIND status\n"); + return CSR_RESULT_FAILURE; + } + + if (stat == 0) + { + break; + } + if (--stat_retries == 0) + { + unifi_error(card->ospriv, "Timeout waiting for REWIND ready\n"); + return CSR_RESULT_FAILURE; + } + + /* Poll for the ack a few times */ + if (stat_retries < REWIND_RETRIES - REWIND_POLLING_RETRIES) + { + CsrThreadSleep(REWIND_DELAY); + } + } + } + + /* The call to csr_sdio_block_rw() still failed after retrying */ + if (csrResult != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Block %s failed after %d retries\n", + (direction == UNIFI_SDIO_READ)?"read" : "write", + CMD53_RETRIES - retries); + /* Report any SDIO error as a general i/o error */ + return CSR_RESULT_FAILURE; + } + + /* Collect some stats */ + if (direction == UNIFI_SDIO_READ) + { + card->sdio_bytes_read += len; + } + else + { + card->sdio_bytes_written += len; + } + + return CSR_RESULT_SUCCESS; +} /* unifi_bulk_rw() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_bulk_rw_noretry + * + * Transfer bulk data to or from the UniFi SDIO interface. + * This function is used to read or write signals and bulk data. + * + * Arguments: + * card Pointer to card structure. + * handle Value to put in the Register Address field of + * the CMD53 req. + * data Pointer to data to write. + * direction One of UNIFI_SDIO_READ or UNIFI_SDIO_WRITE + * + * Returns: + * 0 on success, non-zero error code on error: + * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected + * CSR_RESULT_FAILURE an SDIO error occurred + * + * Notes: + * This function uses SDIO CMD53, which is the block transfer mode. + * --------------------------------------------------------------------------- + */ +CsrResult unifi_bulk_rw_noretry(card_t *card, CsrUint32 handle, void *pdata, + CsrUint32 len, CsrInt16 direction) +{ + CsrResult csrResult; + + csrResult = csr_sdio_block_rw(card, card->function, handle, + (CsrUint8 *)pdata, (CsrUint16)len, direction); + if (csrResult != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Block %s failed\n", + (direction == UNIFI_SDIO_READ)?"read" : "write"); + return csrResult; + } + + return CSR_RESULT_SUCCESS; +} /* unifi_bulk_rw_noretry() */ + + diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper.c b/drivers/staging/csr/csr_wifi_hip_chiphelper.c new file mode 100644 index 0000000..0e2477f --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_chiphelper.c @@ -0,0 +1,793 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + + +#include "csr_wifi_hip_chiphelper_private.h" + +#ifndef nelem +#define nelem(a) (sizeof(a) / sizeof(a[0])) +#endif + +#define counted(foo) { nelem(foo), foo } +#define null_counted() { 0, NULL } + +/* The init values are a set of register writes that we must + perform when we first connect to the chip to get it working. + They swicth on the correct clocks and possibly set the host + interface as a wkaeup source. They should not be used if + proper HIP opperation is required, but are useful before we + do a code download. */ +static const struct chip_helper_init_values init_vals_v1[] = { + { 0xFDBB, 0xFFFF }, + { 0xFDB6, 0x03FF }, + { 0xFDB1, 0x01E3 }, + { 0xFDB3, 0x0FFF }, + { 0xFEE3, 0x08F0 }, + { 0xFEE7, 0x3C3F }, + { 0xFEE6, 0x0050 }, + { 0xFDBA, 0x0000 } +}; + +static const struct chip_helper_init_values init_vals_v2[] = { + { 0xFDB6, 0x0FFF }, + { 0xF023, 0x3F3F }, + { 0xFDB1, 0x01E3 }, + { 0xFDB3, 0x0FFF }, + { 0xF003, 0x08F0 }, + { 0xF007, 0x3C3F }, + { 0xF006, 0x0050 } +}; + + +static const struct chip_helper_init_values init_vals_v22_v23[] = { + { 0xF81C, 0x00FF }, + /*{ 0x????, 0x???? }, */ + { 0xF80C, 0x1FFF }, + { 0xFA25, 0x001F }, + { 0xF804, 0x00FF }, + { 0xF802, 0x0FFF }, + /*{ 0x????, 0x???? }, + { 0x????, 0x???? }, + { 0x????, 0x???? }*/ +}; + +static const CsrUint16 reset_program_a_v1_or_v2[] = { + 0x0000 +}; +static const CsrUint16 reset_program_b_v1_or_v2[] = { + 0x0010, 0xFE00, 0xA021, 0xFF00, 0x8111, 0x0009, 0x0CA4, 0x0114, + 0x0280, 0x04F8, 0xFE00, 0x6F25, 0x06E0, 0x0010, 0xFC00, 0x0121, + 0xFC00, 0x0225, 0xFE00, 0x7125, 0xFE00, 0x6D11, 0x03F0, 0xFE00, + 0x6E25, 0x0008, 0x00E0 +}; + +static const struct chip_helper_reset_values reset_program_v1_or_v2[] = +{ + { + MAKE_GP(REGISTERS, 0x000C), + nelem(reset_program_a_v1_or_v2), + reset_program_a_v1_or_v2 + }, + { + MAKE_GP(MAC_PMEM, 0x000000), + nelem(reset_program_b_v1_or_v2), + reset_program_b_v1_or_v2 + } +}; + +static const struct chip_map_address_t unifi_map_address_v1_v2[] = +{ + { 0xFE9F, 0xFE7B }, /* PM1_BANK_SELECT */ + { 0xFE9E, 0xFE78 }, /* PM2_BANK_SELECT */ + { 0xFE9D, 0xFE7E }, /* SHARED_DMEM_PAGE */ + { 0xFE91, 0xFE90 }, /* PROC_SELECT */ + { 0xFE8D, 0xFE8C }, /* STOP_STATUS */ +}; + +static const struct chip_map_address_t unifi_map_address_v22_v23[] = +{ + { 0xF8F9, 0xF8AC }, /* GW1_CONFIG */ + { 0xF8FA, 0xF8AD }, /* GW2_CONFIG */ + { 0xF8FB, 0xF8AE }, /* GW3_CONFIG */ + { 0xF830, 0xF81E }, /* PROC_SELECT */ + { 0xF831, 0xF81F }, /* STOP_STATUS */ + { 0xF8FC, 0xF8AF }, /* IO_LOG_ADDRESS */ +}; + +static const struct chip_device_regs_t unifi_device_regs_null = +{ + 0xFE81, /* GBL_CHIP_VERSION */ + 0x0000, /* GBL_MISC_ENABLES */ + 0x0000, /* DBG_EMU_CMD */ + { + 0x0000, /* HOST.DBG_PROC_SELECT */ + 0x0000, /* HOST.DBG_STOP_STATUS */ + 0x0000, /* HOST.WINDOW1_PAGE */ + 0x0000, /* HOST.WINDOW2_PAGE */ + 0x0000, /* HOST.WINDOW3_PAGE */ + 0x0000 /* HOST.IO_LOG_ADDR */ + }, + { + 0x0000, /* SPI.DBG_PROC_SELECT */ + 0x0000, /* SPI.DBG_STOP_STATUS */ + 0x0000, /* SPI.WINDOW1_PAGE */ + 0x0000, /* SPI.WINDOW2_PAGE */ + 0x0000, /* SPI.WINDOW3_PAGE */ + 0x0000 /* SPI.IO_LOG_ADDR */ + }, + 0x0000, /* DBG_RESET */ + 0x0000, /* > DBG_RESET_VALUE */ + 0x0000, /* DBG_RESET_WARN */ + 0x0000, /* DBG_RESET_WARN_VALUE */ + 0x0000, /* DBG_RESET_RESULT */ + 0xFFE9, /* XAP_PCH */ + 0xFFEA, /* XAP_PCL */ + 0x0000, /* PROC_PC_SNOOP */ + 0x0000, /* WATCHDOG_DISABLE */ + 0x0000, /* MAILBOX0 */ + 0x0000, /* MAILBOX1 */ + 0x0000, /* MAILBOX2 */ + 0x0000, /* MAILBOX3 */ + 0x0000, /* SDIO_HOST_INT */ + 0x0000, /* SHARED_IO_INTERRUPT */ + 0x0000, /* SDIO HIP HANDSHAKE */ + 0x0000 /* COEX_STATUS */ +}; + +/* UF105x */ +static const struct chip_device_regs_t unifi_device_regs_v1 = +{ + 0xFE81, /* GBL_CHIP_VERSION */ + 0xFE87, /* GBL_MISC_ENABLES */ + 0xFE9C, /* DBG_EMU_CMD */ + { + 0xFE90, /* HOST.DBG_PROC_SELECT */ + 0xFE8C, /* HOST.DBG_STOP_STATUS */ + 0xFE7B, /* HOST.WINDOW1_PAGE */ + 0xFE78, /* HOST.WINDOW2_PAGE */ + 0xFE7E, /* HOST.WINDOW3_PAGE */ + 0x0000 /* HOST.IO_LOG_ADDR */ + }, + { + 0xFE91, /* SPI.DBG_PROC_SELECT */ + 0xFE8D, /* SPI.DBG_STOP_STATUS */ + 0xFE9F, /* SPI.WINDOW1_PAGE */ + 0xFE9E, /* SPI.WINDOW2_PAGE */ + 0xFE9D, /* SPI.WINDOW3_PAGE */ + 0x0000 /* SPI.IO_LOG_ADDR */ + }, + 0xFE92, /* DBG_RESET */ + 0x0001, /* > DBG_RESET_VALUE */ + 0xFDA0, /* DBG_RESET_WARN (HOST_SELECT) */ + 0x0000, /* DBG_RESET_WARN_VALUE */ + 0xFE92, /* DBG_RESET_RESULT */ + 0xFFE9, /* XAP_PCH */ + 0xFFEA, /* XAP_PCL */ + 0x0051, /* PROC_PC_SNOOP */ + 0xFE70, /* WATCHDOG_DISABLE */ + 0xFE6B, /* MAILBOX0 */ + 0xFE6A, /* MAILBOX1 */ + 0xFE69, /* MAILBOX2 */ + 0xFE68, /* MAILBOX3 */ + 0xFE67, /* SDIO_HOST_INT */ + 0xFE65, /* SHARED_IO_INTERRUPT */ + 0xFDE9, /* SDIO HIP HANDSHAKE */ + 0x0000 /* COEX_STATUS */ +}; + +/* UF2... */ +static const struct chip_device_regs_t unifi_device_regs_v2 = +{ + 0xFE81, /* GBL_CHIP_VERSION */ + 0xFE87, /* GBL_MISC_ENABLES */ + 0xFE9C, /* DBG_EMU_CMD */ + { + 0xFE90, /* HOST.DBG_PROC_SELECT */ + 0xFE8C, /* HOST.DBG_STOP_STATUS */ + 0xFE7B, /* HOST.WINDOW1_PAGE */ + 0xFE78, /* HOST.WINDOW2_PAGE */ + 0xFE7E, /* HOST.WINDOW3_PAGE */ + 0x0000 /* HOST.IO_LOG_ADDR */ + }, + { + 0xFE91, /* SPI.DBG_PROC_SELECT */ + 0xFE8D, /* SPI.DBG_STOP_STATUS */ + 0xFE9F, /* SPI.WINDOW1_PAGE */ + 0xFE9E, /* SPI.WINDOW2_PAGE */ + 0xFE9D, /* SPI.WINDOW3_PAGE */ + 0x0000 /* SPI.IO_LOG_ADDR */ + }, + 0xFE92, /* DBG_RESET */ + 0x0000, /* > DBG_RESET_VALUE */ + 0xFDE9, /* DBG_RESET_WARN (TEST_FLASH_DATA - SHARED_MAILBOX2B) */ + 0xFFFF, /* DBG_RESET_WARN_VALUE */ + 0xFDE9, /* DBG_RESET_RESULT (TEST_FLASH_DATA) */ + 0xFFE9, /* XAP_PCH */ + 0xFFEA, /* XAP_PCL */ + 0x0051, /* PROC_PC_SNOOP */ + 0xFE70, /* WATCHDOG_DISABLE */ + 0xFE6B, /* MAILBOX0 */ + 0xFE6A, /* MAILBOX1 */ + 0xFE69, /* MAILBOX2 */ + 0xFE68, /* MAILBOX3 */ + 0xFE67, /* SDIO_HOST_INT */ + 0xFE65, /* SHARED_IO_INTERRUPT */ + 0xFE69, /* SDIO HIP HANDSHAKE */ + 0x0000 /* COEX_STATUS */ +}; + +/* UF60xx */ +static const struct chip_device_regs_t unifi_device_regs_v22_v23 = +{ + 0xFE81, /* GBL_CHIP_VERSION */ + 0xF84F, /* GBL_MISC_ENABLES */ + 0xF81D, /* DBG_EMU_CMD */ + { + 0xF81E, /* HOST.DBG_PROC_SELECT */ + 0xF81F, /* HOST.DBG_STOP_STATUS */ + 0xF8AC, /* HOST.WINDOW1_PAGE */ + 0xF8AD, /* HOST.WINDOW2_PAGE */ + 0xF8AE, /* HOST.WINDOW3_PAGE */ + 0xF8AF /* HOST.IO_LOG_ADDR */ + }, + { + 0xF830, /* SPI.DBG_PROC_SELECT */ + 0xF831, /* SPI.DBG_STOP_STATUS */ + 0xF8F9, /* SPI.WINDOW1_PAGE */ + 0xF8FA, /* SPI.WINDOW2_PAGE */ + 0xF8FB, /* SPI.WINDOW3_PAGE */ + 0xF8FC /* SPI.IO_LOG_ADDR */ + }, + 0xF82F, /* DBG_RESET */ + 0x0001, /* > DBG_RESET_VALUE */ + 0x0000, /* DBG_RESET_WARN */ + 0x0000, /* DBG_RESET_WARN_VALUE */ + 0xF82F, /* DBG_RESET_RESULT */ + 0xFFE9, /* XAP_PCH */ + 0xFFEA, /* XAP_PCL */ + 0x001B, /* PROC_PC_SNOOP */ + 0x0055, /* WATCHDOG_DISABLE */ + 0xF84B, /* MAILBOX0 */ + 0xF84C, /* MAILBOX1 */ + 0xF84D, /* MAILBOX2 */ + 0xF84E, /* MAILBOX3 */ + 0xF92F, /* SDIO_HOST_INT */ + 0xF92B, /* SDIO_FROMHOST_SCRTACH0 / SHARED_IO_INTERRUPT */ + 0xF84D, /* SDIO HIP HANDSHAKE (MAILBOX2) */ + 0xF9FB /* COEX_STATUS */ +}; + +/* Program memory window on UF105x. */ +static const struct window_shift_info_t prog_window_array_unifi_v1_v2[CHIP_HELPER_WT_COUNT] = +{ + { TRUE, 11, 0x0200 }, /* CODE RAM */ + { TRUE, 11, 0x0000 }, /* FLASH */ + { TRUE, 11, 0x0400 }, /* External SRAM */ + { FALSE, 0, 0 }, /* ROM */ + { FALSE, 0, 0 } /* SHARED */ +}; + +/* Shared memory window on UF105x. */ +static const struct window_shift_info_t shared_window_array_unifi_v1_v2[CHIP_HELPER_WT_COUNT] = +{ + { FALSE, 0, 0 }, /* CODE RAM */ + { FALSE, 0, 0 }, /* FLASH */ + { FALSE, 0, 0 }, /* External SRAM */ + { FALSE, 0, 0 }, /* ROM */ + { TRUE, 11, 0x0000 } /* SHARED */ +}; + +/* One of the Generic Windows on UF60xx and later. */ +static const struct window_shift_info_t generic_window_array_unifi_v22_v23[CHIP_HELPER_WT_COUNT] = +{ + { TRUE, 11, 0x3800 }, /* CODE RAM */ + { FALSE, 0, 0 }, /* FLASH */ + { FALSE, 0, 0 }, /* External SRAM */ + { TRUE, 11, 0x2000 }, /* ROM */ + { TRUE, 11, 0x0000 } /* SHARED */ +}; + +/* The three windows on UF105x. */ +static const struct window_info_t prog1_window_unifi_v1_v2 = { 0x0000, 0x2000, 0x0080, prog_window_array_unifi_v1_v2 }; +static const struct window_info_t prog2_window_unifi_v1_v2 = { 0x2000, 0x2000, 0x0000, prog_window_array_unifi_v1_v2 }; +static const struct window_info_t shared_window_unifi_v1_v2 = { 0x4000, 0x2000, 0x0000, shared_window_array_unifi_v1_v2 }; + +/* The three windows on UF60xx and later. */ +static const struct window_info_t generic1_window_unifi_v22_v23 = { 0x0000, 0x2000, 0x0080, generic_window_array_unifi_v22_v23 }; +static const struct window_info_t generic2_window_unifi_v22_v23 = { 0x2000, 0x2000, 0x0000, generic_window_array_unifi_v22_v23 }; +static const struct window_info_t generic3_window_unifi_v22_v23 = { 0x4000, 0x2000, 0x0000, generic_window_array_unifi_v22_v23 }; + +static const struct chip_device_desc_t chip_device_desc_null = +{ + { FALSE, 0x0000, 0x0000, 0x00 }, + "", + "", + null_counted(), /* init */ + null_counted(), /* reset_prog */ + &unifi_device_regs_null, /* regs */ + { + FALSE, /* has_flash */ + FALSE, /* has_ext_sram */ + FALSE, /* has_rom */ + FALSE, /* has_bt */ + FALSE, /* has_wlan */ + }, + null_counted(), + /* prog_offset */ + { + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000 + }, + /* data_offset */ + { + 0x0000 /* ram */ + }, + /* windows */ + { + NULL, + NULL, + NULL + } +}; + +static const struct chip_device_desc_t unifi_device_desc_v1 = +{ + { FALSE, 0xf0ff, 0x1001, 0x01 }, /* UF105x R01 */ + "UF105x", + "UniFi-1", + counted(init_vals_v1), /* init */ + counted(reset_program_v1_or_v2), /* reset_prog */ + &unifi_device_regs_v1, /* regs */ + { + TRUE, /* has_flash */ + TRUE, /* has_ext_sram */ + FALSE, /* has_rom */ + FALSE, /* has_bt */ + TRUE, /* has_wlan */ + }, + counted(unifi_map_address_v1_v2), /* map */ + /* prog_offset */ + { + 0x00100000, /* ram */ + 0x00000000, /* rom (invalid) */ + 0x00000000, /* flash */ + 0x00200000, /* ext_ram */ + }, + /* data_offset */ + { + 0x8000 /* ram */ + }, + /* windows */ + { + &prog1_window_unifi_v1_v2, + &prog2_window_unifi_v1_v2, + &shared_window_unifi_v1_v2 + } +}; + +static const struct chip_device_desc_t unifi_device_desc_v2 = +{ + { FALSE, 0xf0ff, 0x2001, 0x02 }, /* UF2... R02 */ + "UF2...", + "UniFi-2", + counted(init_vals_v2), /* init */ + counted(reset_program_v1_or_v2), /* reset_prog */ + &unifi_device_regs_v2, /* regs */ + { + TRUE, /* has_flash */ + TRUE, /* has_ext_sram */ + FALSE, /* has_rom */ + FALSE, /* has_bt */ + TRUE, /* has_wlan */ + }, + counted(unifi_map_address_v1_v2), /* map */ + /* prog_offset */ + { + 0x00100000, /* ram */ + 0x00000000, /* rom (invalid) */ + 0x00000000, /* flash */ + 0x00200000, /* ext_ram */ + }, + /* data_offset */ + { + 0x8000 /* ram */ + }, + /* windows */ + { + &prog1_window_unifi_v1_v2, + &prog2_window_unifi_v1_v2, + &shared_window_unifi_v1_v2 + } +}; + +static const struct chip_device_desc_t unifi_device_desc_v3 = +{ + { FALSE, 0xf0ff, 0x3001, 0x02 }, /* UF2... R03 */ + "UF2...", + "UniFi-3", + counted(init_vals_v2), /* init */ + counted(reset_program_v1_or_v2), /* reset_prog */ + &unifi_device_regs_v2, /* regs */ + { + TRUE, /* has_flash */ + TRUE, /* has_ext_sram */ + FALSE, /* has_rom */ + FALSE, /* has_bt */ + TRUE, /* has_wlan */ + }, + counted(unifi_map_address_v1_v2), /* map */ + /* prog_offset */ + { + 0x00100000, /* ram */ + 0x00000000, /* rom (invalid) */ + 0x00000000, /* flash */ + 0x00200000, /* ext_ram */ + }, + /* data_offset */ + { + 0x8000 /* ram */ + }, + /* windows */ + { + &prog1_window_unifi_v1_v2, + &prog2_window_unifi_v1_v2, + &shared_window_unifi_v1_v2 + } +}; + +static const struct chip_device_desc_t unifi_device_desc_v22 = +{ + { FALSE, 0x00ff, 0x0022, 0x07 }, /* UF60xx */ + "UF60xx", + "UniFi-4", + counted(init_vals_v22_v23), /* init */ + null_counted(), /* reset_prog */ + &unifi_device_regs_v22_v23, /* regs */ + { + FALSE, /* has_flash */ + FALSE, /* has_ext_sram */ + TRUE, /* has_rom */ + FALSE, /* has_bt */ + TRUE, /* has_wlan */ + }, + counted(unifi_map_address_v22_v23), /* map */ + /* prog_offset */ + { + 0x00C00000, /* ram */ + 0x00000000, /* rom */ + 0x00000000, /* flash (invalid) */ + 0x00000000, /* ext_ram (invalid) */ + }, + /* data_offset */ + { + 0x8000 /* ram */ + }, + /* windows */ + { + &generic1_window_unifi_v22_v23, + &generic2_window_unifi_v22_v23, + &generic3_window_unifi_v22_v23 + } +}; + +static const struct chip_device_desc_t unifi_device_desc_v23 = +{ + { FALSE, 0x00ff, 0x0023, 0x08 }, /* UF.... */ + "UF....", + "UF.... (5)", + counted(init_vals_v22_v23), /* init */ + null_counted(), /* reset_prog */ + &unifi_device_regs_v22_v23, /* regs */ + { + FALSE, /* has_flash */ + FALSE, /* has_ext_sram */ + TRUE, /* has_rom */ + TRUE, /* has_bt */ + TRUE, /* has_wlan */ + }, + counted(unifi_map_address_v22_v23), + /* prog_offset */ + { + 0x00C00000, /* ram */ + 0x00000000, /* rom */ + 0x00000000, /* flash (invalid) */ + 0x00000000, /* ext_sram (invalid) */ + }, + /* data_offset */ + { + 0x8000 /* ram */ + }, + /* windows */ + { + &generic1_window_unifi_v22_v23, + &generic2_window_unifi_v22_v23, + &generic3_window_unifi_v22_v23 + } +}; + +static const struct chip_device_desc_t hyd_wlan_subsys_desc_v1 = +{ + { FALSE, 0x00ff, 0x0044, 0x00 }, /* UF.... */ + "HYD...", + "HYD... ", + counted(init_vals_v22_v23), /* init */ + null_counted(), /* reset_prog */ + &unifi_device_regs_v22_v23, /* regs */ + { + FALSE, /* has_flash */ + FALSE, /* has_ext_sram */ + TRUE, /* has_rom */ + FALSE, /* has_bt */ + TRUE, /* has_wlan */ + }, + counted(unifi_map_address_v22_v23), + /* prog_offset */ + { + 0x00C00000, /* ram */ + 0x00000000, /* rom */ + 0x00000000, /* flash (invalid) */ + 0x00000000, /* ext_sram (invalid) */ + }, + /* data_offset */ + { + 0x8000 /* ram */ + }, + /* windows */ + { + &generic1_window_unifi_v22_v23, + &generic2_window_unifi_v22_v23, + &generic3_window_unifi_v22_v23 + } +}; + + +/* This is the list of all chips that we know about. I'm + assuming that the order here will be important - we + might have multiple entries witrh the same SDIO id for + instance. The first one in this list will be the one + that is returned if a search is done on only that id. + The client will then have to call GetVersionXXX again + but with more detailed info. + + I don't know if we need to signal this up to the client + in some way? + + (We get the SDIO id before we know anything else about + the chip. We might not be able to read any of the other + registers at first, but we still need to know about the + chip). */ +static const struct chip_device_desc_t *chip_ver_to_desc[] = +{ + &unifi_device_desc_v1, /* UF105x R01 */ + &unifi_device_desc_v2, /* UF2... R02 */ + &unifi_device_desc_v3, /* UF2... R03 */ + &unifi_device_desc_v22, /* UF60xx */ + &unifi_device_desc_v23, /* UF.... */ + &hyd_wlan_subsys_desc_v1 +}; + +ChipDescript* ChipHelper_GetVersionSdio(CsrUint8 sdio_ver) +{ + CsrUint32 i; + + for (i = 0; i < nelem(chip_ver_to_desc); i++) + { + if (chip_ver_to_desc[i]->chip_version.sdio == sdio_ver) + { + return chip_ver_to_desc[i]; + } + } + + return &chip_device_desc_null; +} + + +ChipDescript* ChipHelper_GetVersionAny(CsrUint16 from_FF9A, CsrUint16 from_FE81) +{ + CsrUint32 i; + + if ((from_FF9A & 0xFF00) != 0) + { + for (i = 0; i < nelem(chip_ver_to_desc); i++) + { + if (chip_ver_to_desc[i]->chip_version.pre_bc7 && + ((from_FF9A & chip_ver_to_desc[i]->chip_version.mask) == + chip_ver_to_desc[i]->chip_version.result)) + { + return chip_ver_to_desc[i]; + } + } + } + else + { + for (i = 0; i < nelem(chip_ver_to_desc); i++) + { + if (!chip_ver_to_desc[i]->chip_version.pre_bc7 && + ((from_FE81 & chip_ver_to_desc[i]->chip_version.mask) == + chip_ver_to_desc[i]->chip_version.result)) + { + return chip_ver_to_desc[i]; + } + } + } + + return &chip_device_desc_null; +} + + +ChipDescript* ChipHelper_GetVersionUniFi(CsrUint16 ver) +{ + return ChipHelper_GetVersionAny(0x0000, ver); +} + + +ChipDescript* ChipHelper_Null() +{ + return &chip_device_desc_null; +} + + +ChipDescript* ChipHelper_GetVersionBlueCore(enum chip_helper_bluecore_age bc_age, CsrUint16 version) +{ + if (bc_age == chip_helper_bluecore_pre_bc7) + { + return ChipHelper_GetVersionAny(version, 0x0000); + } + else + { + return ChipHelper_GetVersionAny(0x0000, version); + } +} + + +/* Expand the DEF0 functions into simple code to return the + correct thing. The DEF1 functions expand to nothing in + this X macro expansion. */ +#define CHIP_HELPER_DEF0_C_DEF(ret_type, name, info) \ + ret_type ChipHelper_ ## name(ChipDescript * chip_help) \ + { \ + return chip_help->info; \ + } +#define CHIP_HELPER_DEF1_C_DEF(ret_type, name, type1, name1) + +CHIP_HELPER_LIST(C_DEF) + +/* + * Map register addresses between HOST and SPI access. + */ +CsrUint16 ChipHelper_MapAddress_SPI2HOST(ChipDescript *chip_help, CsrUint16 addr) +{ + CsrUint32 i; + for (i = 0; i < chip_help->map.len; i++) + { + if (chip_help->map.vals[i].spi == addr) + { + return chip_help->map.vals[i].host; + } + } + return addr; +} + + +CsrUint16 ChipHelper_MapAddress_HOST2SPI(ChipDescript *chip_help, CsrUint16 addr) +{ + CsrUint32 i; + for (i = 0; i < chip_help->map.len; i++) + { + if (chip_help->map.vals[i].host == addr) + { + return chip_help->map.vals[i].spi; + } + } + return addr; +} + + +/* The address returned by this function is the start of the + window in the address space, that is where we can start + accessing data from. If a section of the window at the + start is unusable because something else is cluttering up + the address map then that is taken into account and this + function returns that address justt past that. */ +CsrUint16 ChipHelper_WINDOW_ADDRESS(ChipDescript *chip_help, + enum chip_helper_window_index window) +{ + if (window < CHIP_HELPER_WINDOW_COUNT && + chip_help->windows[window] != NULL) + { + return chip_help->windows[window]->address + chip_help->windows[window]->blocked; + } + return 0; +} + + +/* This returns the size of the window minus any blocked section */ +CsrUint16 ChipHelper_WINDOW_SIZE(ChipDescript *chip_help, + enum chip_helper_window_index window) +{ + if (window < CHIP_HELPER_WINDOW_COUNT && + chip_help->windows[window] != NULL) + { + return chip_help->windows[window]->size - chip_help->windows[window]->blocked; + } + return 0; +} + + +/* Get the register writes we should do to make sure that + the chip is running with most clocks on. */ +CsrUint32 ChipHelper_ClockStartupSequence(ChipDescript *chip_help, + const struct chip_helper_init_values **val) +{ + *val = chip_help->init.vals; + return chip_help->init.len; +} + + +/* Get the set of values tat we should write to the chip to perform a reset. */ +CsrUint32 ChipHelper_HostResetSequence(ChipDescript *chip_help, + const struct chip_helper_reset_values **val) +{ + *val = chip_help->reset_prog.vals; + return chip_help->reset_prog.len; +} + + +/* Decode a windowed access to the chip. */ +CsrInt32 ChipHelper_DecodeWindow(ChipDescript *chip_help, + enum chip_helper_window_index window, + enum chip_helper_window_type type, + CsrUint32 offset, + CsrUint16 *page, CsrUint16 *addr, CsrUint32 *len) +{ + const struct window_info_t *win; + const struct window_shift_info_t *mode; + CsrUint16 of, pg; + + if (window >= CHIP_HELPER_WINDOW_COUNT) + { + return FALSE; + } + if ((win = chip_help->windows[window]) == NULL) + { + return FALSE; + } + if (type >= CHIP_HELPER_WT_COUNT) + { + return FALSE; + } + if ((mode = &win->mode[type]) == NULL) + { + return FALSE; + } + if (!mode->allowed) + { + return FALSE; + } + + pg = (CsrUint16)(offset >> mode->page_shift) + mode->page_offset; + of = (CsrUint16)(offset & ((1 << mode->page_shift) - 1)); + /* If 'blocked' is zero this does nothing, else decrease + the page register and increase the offset until we aren't + in the blocked region of the window. */ + while (of < win->blocked) + { + of += 1 << mode->page_shift; + pg--; + } + *page = pg; + *addr = win->address + of; + *len = win->size - of; + return TRUE; +} + + diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper.h b/drivers/staging/csr/csr_wifi_hip_chiphelper.h new file mode 100644 index 0000000..6166d55 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_chiphelper.h @@ -0,0 +1,471 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#ifndef CSR_WIFI_HIP_CHIPHELPER_H__ +#define CSR_WIFI_HIP_CHIPHELPER_H__ + + +#include "csr_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* The age of the BlueCore chip. This is probably not useful, if + you know the age then you can probably work out the version directly. */ +enum chip_helper_bluecore_age +{ + chip_helper_bluecore_pre_bc7, + chip_helper_bluecore_bc7_or_later +}; + +/* We support up to three windowed regions at the moment. + Don't reorder these - they're used to index into an array. */ +enum chip_helper_window_index +{ + CHIP_HELPER_WINDOW_1 = 0, + CHIP_HELPER_WINDOW_2 = 1, + CHIP_HELPER_WINDOW_3 = 2, + CHIP_HELPER_WINDOW_COUNT = 3 +}; + +/* These are the things that we can access through a window. + Don't reorder these - they're used to index into an array. */ +enum chip_helper_window_type +{ + CHIP_HELPER_WT_CODE_RAM = 0, + CHIP_HELPER_WT_FLASH = 1, + CHIP_HELPER_WT_EXT_SRAM = 2, + CHIP_HELPER_WT_ROM = 3, + CHIP_HELPER_WT_SHARED = 4, + CHIP_HELPER_WT_COUNT = 5 +}; + +/* Commands to stop and start the XAP */ +enum chip_helper_dbg_emu_cmd_enum +{ + CHIP_HELPER_DBG_EMU_CMD_XAP_STEP_MASK = 0x0001, + CHIP_HELPER_DBG_EMU_CMD_XAP_RUN_B_MASK = 0x0002, + CHIP_HELPER_DBG_EMU_CMD_XAP_BRK_MASK = 0x0004, + CHIP_HELPER_DBG_EMU_CMD_XAP_WAKEUP_MASK = 0x0008 +}; + +/* Bitmasks for Stop and sleep status: DBG_SPI_STOP_STATUS & DBG_HOST_STOP_STATUS */ +enum chip_helper_dbg_stop_status_enum +{ + CHIP_HELPER_DBG_STOP_STATUS_NONE_MASK = 0x0000, + CHIP_HELPER_DBG_STOP_STATUS_P0_MASK = 0x0001, + CHIP_HELPER_DBG_STOP_STATUS_P1_MASK = 0x0002, + CHIP_HELPER_DBG_STOP_STATUS_P2_MASK = 0x0004, + CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_P0_MASK = 0x0008, + CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_P1_MASK = 0x0010, + CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_P2_MASK = 0x0020, + /* Legacy names/alias */ + CHIP_HELPER_DBG_STOP_STATUS_MAC_MASK = 0x0001, + CHIP_HELPER_DBG_STOP_STATUS_PHY_MASK = 0x0002, + CHIP_HELPER_DBG_STOP_STATUS_BT_MASK = 0x0004, + CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_MAC_MASK = 0x0008, + CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_PHY_MASK = 0x0010, + CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_BT_MASK = 0x0020 +}; + +/* Codes to disable the watchdog */ +enum chip_helper_watchdog_disable_enum +{ + CHIP_HELPER_WATCHDOG_DISABLE_CODE1 = 0x6734, + CHIP_HELPER_WATCHDOG_DISABLE_CODE2 = 0xD6BF, + CHIP_HELPER_WATCHDOG_DISABLE_CODE3 = 0xC31E +}; + +/* Other bits have changed between versions */ +enum chip_helper_gbl_misc_enum +{ + CHIP_HELPER_GBL_MISC_SPI_STOP_OUT_EN_MASK = 0x0001, + CHIP_HELPER_GBL_MISC_MMU_INIT_DONE_MASK = 0x0004 +}; + +/* Coex status register, contains interrupt status and reset pullup status. + * CHIP_HELPER_COEX_STATUS_RST_PULLS_MSB_MASK can be used to check + * for WAPI on R03 chips and later. */ +enum chip_helper_coex_status_mask_enum +{ + CHIP_HELPER_COEX_STATUS_RST_PULLS_LSB_MASK = 0x0001, + CHIP_HELPER_COEX_STATUS_RST_PULLS_MSB_MASK = 0x0008, + CHIP_HELPER_COEX_STATUS_WL_FEC_PINS_LSB_MASK = 0x0010, + CHIP_HELPER_COEX_STATUS_WL_FEC_PINS_MSB_MASK = 0x0080, + CHIP_HELPER_COEX_STATUS_INT_UART_MASK = 0x0100, + CHIP_HELPER_COEX_STATUS_INT_BT_LEG_MASK = 0x0200 +}; + +/* How to select the different CPUs */ +enum chip_helper_dbg_proc_sel_enum +{ + CHIP_HELPER_DBG_PROC_SEL_MAC = 0, + CHIP_HELPER_DBG_PROC_SEL_PHY = 1, + CHIP_HELPER_DBG_PROC_SEL_BT = 2, + CHIP_HELPER_DBG_PROC_SEL_NONE = 2, + CHIP_HELPER_DBG_PROC_SEL_BOTH = 3 +}; + +/* These are the only registers that we have to know the + address of before we know the chip version. */ +enum chip_helper_fixed_registers +{ + /* This is the address of GBL_CHIP_VERISON on BC7, + UF105x, UF60xx and + anything later than that. */ + CHIP_HELPER_UNIFI_GBL_CHIP_VERSION = 0xFE81, + + CHIP_HELPER_OLD_BLUECORE_GBL_CHIP_VERSION = 0xFF9A + + /* This isn't used at the moment (but might be needed + to distinguish the BlueCore sub version?) */ + /* CHIP_HELPER_OLD_BLUECORE_ANA_VERSION_ID = 0xFF7D */ +}; + +/* Address-value pairs for defining initialisation values */ +struct chip_helper_init_values +{ + CsrUint16 addr; + CsrUint16 value; +}; + +/* A block of data that should be written to the device */ +struct chip_helper_reset_values +{ + CsrUint32 gp_address; + CsrUint32 len; + const CsrUint16 *data; +}; + +/* + * This is the C API. + */ + +/* opaque type */ +typedef const struct chip_device_desc_t ChipDescript; + +/* Return a NULL descriptor */ +ChipDescript* ChipHelper_Null(void); + +/* This should get the correct version for any CSR chip. + The two parameters are what is read from addresses + 0xFF9A and 0xFE81 (OLD_BLUECORE_GBL_CHIP_VERSION and + UNIFI_GBL_CHIP_VERSION). These should give a unique identity + for most (all?) chips. + + FF9A is the old GBL_CHIP_VERSION register. If the high + eight bits are zero then the chip is a new (BC7 +) one + and FE81 is the _new_ GBL_CHIP_VERSION register. */ +ChipDescript* ChipHelper_GetVersionAny(CsrUint16 from_FF9A, CsrUint16 from_FE81); + +/* The chip is a UniFi, but we don't know which type + The parameter is the value of UNIFI_GBL_CHIP_VERSION (0xFE81) */ +ChipDescript* ChipHelper_GetVersionUniFi(CsrUint16 version); + +/* This gets the version from the SDIO device id. This only + gives quite a coarse grained version, so we should update once + we hav access to the function N registers. */ +ChipDescript* ChipHelper_GetVersionSdio(CsrUint8 sdio_version); + +/* The chip is some sort of BlueCore. If "age" is "pre_bc7" then + "version" is what was read from FF9A. If "age" is bc7_or_later + then "version" is read from FE81. If we don't know if we're pre + or post BC7 then we should use "GetVersionAny". */ +ChipDescript* ChipHelper_GetVersionBlueCore(enum chip_helper_bluecore_age age, + CsrUint16 version); + +/* The main functions of this class are built with an X macro. This + means we can generate the C and C++ versions from the same source + without the two diverging. + + The DEF0 functions are simple and take no parameters. The first + parameter to the macro is the return type. The second parameter + is the function name and the third parameter is where to get the + info from (this is hidden from the user). + + The DEF1 functions take one parameter. This time the third macro + parameter is the type of this parameter, and the fourth macro + parameter is the name of the parameter. The bodies of these + functions are hand written. */ +#define CHIP_HELPER_LIST(m) \ + CHIP_HELPER_DEF0(m, (const CsrCharString *, FriendlyName, friendly_name)) \ + CHIP_HELPER_DEF0(m, (const CsrCharString *, MarketingName, marketing_name)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, DBG_EMU_CMD, regs->dbg_emu_cmd)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, DBG_HOST_PROC_SELECT, regs->host.dbg_proc_select)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, DBG_HOST_STOP_STATUS, regs->host.dbg_stop_status)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, HOST_WINDOW1_PAGE, regs->host.window1_page)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, HOST_WINDOW2_PAGE, regs->host.window2_page)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, HOST_WINDOW3_PAGE, regs->host.window3_page)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, HOST_IO_LOG_ADDR, regs->host.io_log_addr)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, DBG_SPI_PROC_SELECT, regs->spi.dbg_proc_select)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, DBG_SPI_STOP_STATUS, regs->spi.dbg_stop_status)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, SPI_WINDOW1_PAGE, regs->spi.window1_page)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, SPI_WINDOW2_PAGE, regs->spi.window2_page)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, SPI_WINDOW3_PAGE, regs->spi.window3_page)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, SPI_IO_LOG_ADDR, regs->spi.io_log_addr)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, DBG_RESET, regs->dbg_reset)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, DBG_RESET_VALUE, regs->dbg_reset_value)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, DBG_RESET_WARN, regs->dbg_reset_warn)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, DBG_RESET_WARN_VALUE, regs->dbg_reset_warn_value)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, DBG_RESET_RESULT, regs->dbg_reset_result)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, WATCHDOG_DISABLE, regs->watchdog_disable)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, PROC_PC_SNOOP, regs->proc_pc_snoop)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, GBL_CHIP_VERSION, regs->gbl_chip_version)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, GBL_MISC_ENABLES, regs->gbl_misc_enables)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, XAP_PCH, regs->xap_pch)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, XAP_PCL, regs->xap_pcl)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, MAILBOX0, regs->mailbox0)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, MAILBOX1, regs->mailbox1)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, MAILBOX2, regs->mailbox2)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, MAILBOX3, regs->mailbox3)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, SDIO_HIP_HANDSHAKE, regs->sdio_hip_handshake)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, SDIO_HOST_INT, regs->sdio_host_int)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, COEX_STATUS, regs->coex_status)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, SHARED_IO_INTERRUPT, regs->shared_io_interrupt)) \ + CHIP_HELPER_DEF0(m, (CsrUint32, PROGRAM_MEMORY_RAM_OFFSET, prog_offset.ram)) \ + CHIP_HELPER_DEF0(m, (CsrUint32, PROGRAM_MEMORY_ROM_OFFSET, prog_offset.rom)) \ + CHIP_HELPER_DEF0(m, (CsrUint32, PROGRAM_MEMORY_FLASH_OFFSET, prog_offset.flash)) \ + CHIP_HELPER_DEF0(m, (CsrUint32, PROGRAM_MEMORY_EXT_SRAM_OFFSET, prog_offset.ext_sram)) \ + CHIP_HELPER_DEF0(m, (CsrUint16, DATA_MEMORY_RAM_OFFSET, data_offset.ram)) \ + CHIP_HELPER_DEF0(m, (CsrInt32, HasFlash, bools.has_flash)) \ + CHIP_HELPER_DEF0(m, (CsrInt32, HasExtSram, bools.has_ext_sram)) \ + CHIP_HELPER_DEF0(m, (CsrInt32, HasRom, bools.has_rom)) \ + CHIP_HELPER_DEF0(m, (CsrInt32, HasBt, bools.has_bt)) \ + CHIP_HELPER_DEF0(m, (CsrInt32, HasWLan, bools.has_wlan)) \ + CHIP_HELPER_DEF1(m, (CsrUint16, WINDOW_ADDRESS, enum chip_helper_window_index, window)) \ + CHIP_HELPER_DEF1(m, (CsrUint16, WINDOW_SIZE, enum chip_helper_window_index, window)) \ + CHIP_HELPER_DEF1(m, (CsrUint16, MapAddress_SPI2HOST, CsrUint16, addr)) \ + CHIP_HELPER_DEF1(m, (CsrUint16, MapAddress_HOST2SPI, CsrUint16, addr)) \ + CHIP_HELPER_DEF1(m, (CsrUint32, ClockStartupSequence, const struct chip_helper_init_values **, val)) \ + CHIP_HELPER_DEF1(m, (CsrUint32, HostResetSequence, const struct chip_helper_reset_values **, val)) + +/* Some magic to help the expansion */ +#define CHIP_HELPER_DEF0(a, b) \ + CHIP_HELPER_DEF0_ ## a b +#define CHIP_HELPER_DEF1(a, b) \ + CHIP_HELPER_DEF1_ ## a b + +/* Macros so that when we expand the list we get "C" function prototypes. */ +#define CHIP_HELPER_DEF0_C_DEC(ret_type, name, info) \ + ret_type ChipHelper_ ## name(ChipDescript * chip_help); +#define CHIP_HELPER_DEF1_C_DEC(ret_type, name, type1, name1) \ + ret_type ChipHelper_ ## name(ChipDescript * chip_help, type1 name1); + +CHIP_HELPER_LIST(C_DEC) + +/* FriendlyName + MarketingName + + These two functions return human readable strings that describe + the chip. FriendlyName returns something that a software engineer + at CSR might understand. MarketingName returns something more like + an external name for a CSR chip. +*/ +/* DBG_EMU_CMD + WATCHDOG_DISABLE + PROC_PC_SNOOP + GBL_CHIP_VERSION + XAP_PCH + XAP_PCL + + These registers are used to control the XAPs. +*/ +/* DBG_HOST_PROC_SELECT DBG_HOST_STOP_STATUS + HOST_WINDOW1_PAGE HOST_WINDOW2_PAGE HOST_WINDOW3_PAGE + HOST_IO_LOG_ADDR + DBG_SPI_PROC_SELECT DBG_SPI_STOP_STATUS + SPI_WINDOW1_PAGE SPI_WINDOW2_PAGE SPI_WINDOW3_PAGE + SPI_IO_LOG_ADDR + + These register are used to control the XAPs and the memory + windows, normally while debugging the code on chip. There + are two versons of these registers, one for access via SPI + and another for access via the host interface. +*/ +/* DBG_RESET + DBG_RESET_VALUE + DBG_RESET_WARN + DBG_RESET_WARN_VALUE + DBG_RESET_RESULT + + These registers are used to reset the XAP. This can be + quite complex for some chips. If DBG_RESET_WARN is non + zero the DBG_RESET_WARN_VALUE should be written to address + DBG_RESET_WARN before the reset is perfeormed. DBG_RESET_VALUE + should then be written to DBG_RESET to make the reset happen. + The DBG_RESET_RESULT register should contain 0 if the reset + was successful. +*/ +/* GBL_MISC_ENABLES + + This register controls some special chip features. It + should be used with care is it changes quite a lot between + chip versions. +*/ +/* MAILBOX0 + MAILBOX1 + MAILBOX2 + MAILBOX3 + + The mailbox registers are for communication between the host + and the firmware. There use is described in part by the host + interface protcol specifcation. +*/ +/* SDIO_HIP_HANDSHAKE + + This is one of the more important SDIO HIP registers. On some + chips it has the same value as one of the mailbox registers + and on other chips it is different. +*/ +/* SDIO_HOST_INT + SHARED_IO_INTERRUPT + + These registers are used by some versions of the host interface + protocol specification. Their names should probably be changed + to hide the registers and to expose the functions more. +*/ +/* COEX_STATUS + + Coex status register, contains interrupt status and reset + pullup status. The latter is used to detect WAPI. +*/ +/* PROGRAM_MEMORY_RAM_OFFSET + PROGRAM_MEMORY_ROM_OFFSET + PROGRAM_MEMORY_FLASH_OFFSET + PROGRAM_MEMORY_EXT_SRAM_OFFSET + DATA_MEMORY_RAM_OFFSET + + These are constants that describe the offset of the different + memory types in the two different address spaces. +*/ +/* HasFlash HasExtSram HasRom + HasBt HasWLan + + These are a set of bools describing the chip. +*/ +/* WINDOW_ADDRESS WINDOW_SIZE + + These two functions return the size and address of the windows. + The address is the address of the lowest value in the address + map that is part of the window and the size is the number of + visible words. + + Some of the windows have thier lowest portion covered by + registers. For these windows address is the first address + after the registers and size is the siave excluding the part + covered by registers. +*/ +/* MapAddress_SPI2HOST + MapAddress_HOST2SPI + + The debugging interface is duplicated on UniFi and later chips + so that there are two versions - one over the SPI interaface and + the other over the SDIO interface. These functions map the + registers between these two interfaces. +*/ +/* ClockStartupSequence + + This function returns the list of register value pairs that + should be forced into UniFi to enable SPI communication. This + set of registers is not needed if the firmware is running, but + will be needed if the device is being booted from cold. These + register writes enable the clocks and setup the PLL to a basic + working state. SPI access might be unreliable until these writes + have occured (And they may take mulitple goes). +*/ +/* HostResetSequence + + This returns a number of chunks of data and generic pointers. + All of the XAPs should be stopped. The data should be written + to the generic pointers. The instruction pointer for the MAC + should then be set to the start of program memory and then the + MAC should be "go"d. This will reset the chip in a reliable + and orderly manner without resetting the SDIO interface. It + is therefore not needed if the chip is being accessed by the + SPI interface (the DBG_RESET_ mechanism can be used instead). +*/ + +/* The Decode Window function is more complex. For the window + 'window' it tries to return the address and page register + value needed to see offset 'offset' of memory type 'type'. + + It return 1 on success and 0 on failure. 'page' is what + should be written to the page register. 'addr' is the + address in the XAPs 16 address map to read from. 'len' + is the length that we can read without having to change + the page registers. */ +CsrInt32 ChipHelper_DecodeWindow(ChipDescript *chip_help, + enum chip_helper_window_index window, + enum chip_helper_window_type type, + CsrUint32 offset, + CsrUint16 *page, CsrUint16 *addr, CsrUint32 *len); + +#ifdef __cplusplus +/* Close the extern "C" */ +} + +/* + * This is the C++ API. + */ + +class ChipHelper +{ +public: + /* If this constructor is used then a GetVersionXXX function + should be called next. */ + ChipHelper(); + + /* copy constructor */ + ChipHelper(ChipDescript * desc); + + /* The default constructor assume a BC7 / UF105x series chip + and that the number given is the value of UNIFI_GBL_CHIP_VERSION + (0xFE81) */ + ChipHelper(CsrUint16 version); + + /* This returns the C interface magic token from a C++ instance. */ + ChipDescript* GetDescript() const + { + return m_desc; + } + + + /* Clear out theis class (set it to the null token). */ + void ClearVersion(); + + /* Load this class with data for a specific chip. */ + void GetVersionAny(CsrUint16 from_FF9A, CsrUint16 from_FE81); + void GetVersionUniFi(CsrUint16 version); + void GetVersionBlueCore(chip_helper_bluecore_age age, CsrUint16 version); + void GetVersionSdio(CsrUint8 sdio_version); + + /* Helpers to build the definitions of the member functions. */ +#define CHIP_HELPER_DEF0_CPP_DEC(ret_type, name, info) \ + ret_type name() const; +#define CHIP_HELPER_DEF1_CPP_DEC(ret_type, name, type1, name1) \ + ret_type name(type1 name1) const; + + CHIP_HELPER_LIST(CPP_DEC) + + + /* The DecodeWindow function, see the description of the C version. */ + CsrInt32 DecodeWindow(chip_helper_window_index window, + chip_helper_window_type type, + CsrUint32 offset, + CsrUint16 &page, CsrUint16 &addr, CsrUint32 &len) const; + +private: + ChipDescript *m_desc; +}; + +#endif /* __cplusplus */ + +#endif diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h b/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h new file mode 100644 index 0000000..7ab8173 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h @@ -0,0 +1,208 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#ifndef CSR_WIFI_HIP_CHIPHELPER_PRIVATE_H__ +#define CSR_WIFI_HIP_CHIPHELPER_PRIVATE_H__ + + +#include "csr_wifi_hip_chiphelper.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* This GP stuff should be somewhere else? */ + +/* Memory spaces encoded in top byte of Generic Pointer type */ +#define UNIFI_SH_DMEM 0x01 /* Shared Data Memory */ +#define UNIFI_EXT_FLASH 0x02 /* External FLASH */ +#define UNIFI_EXT_SRAM 0x03 /* External SRAM */ +#define UNIFI_REGISTERS 0x04 /* Registers */ +#define UNIFI_PHY_DMEM 0x10 /* PHY Data Memory */ +#define UNIFI_PHY_PMEM 0x11 /* PHY Program Memory */ +#define UNIFI_PHY_ROM 0x12 /* PHY ROM */ +#define UNIFI_MAC_DMEM 0x20 /* MAC Data Memory */ +#define UNIFI_MAC_PMEM 0x21 /* MAC Program Memory */ +#define UNIFI_MAC_ROM 0x22 /* MAC ROM */ +#define UNIFI_BT_DMEM 0x30 /* BT Data Memory */ +#define UNIFI_BT_PMEM 0x31 /* BT Program Memory */ +#define UNIFI_BT_ROM 0x32 /* BT ROM */ + +#define MAKE_GP(R, O) (((UNIFI_ ## R) << 24) | (O)) +#define GP_OFFSET(GP) ((GP) & 0xFFFFFF) +#define GP_SPACE(GP) (((GP) >> 24) & 0xFF) + + +/* Address value pairs */ +struct val_array_t +{ + CsrUint32 len; + const struct chip_helper_init_values *vals; +}; + +/* Just a (counted) CsrUint16 array */ +struct data_array_t +{ + CsrUint32 len; + const CsrUint16 *vals; +}; + +struct reset_prog_t +{ + CsrUint32 len; + const struct chip_helper_reset_values *vals; +}; + +/* The addresses of registers that are equivalent but on + different host transports. */ +struct chip_map_address_t +{ + CsrUint16 spi, host; +}; + +struct map_array_t +{ + CsrUint32 len; + const struct chip_map_address_t *vals; +}; + +struct chip_device_regs_per_transport_t +{ + CsrUint16 dbg_proc_select; + CsrUint16 dbg_stop_status; + CsrUint16 window1_page; /* PROG_PMEM1 or GW1 */ + CsrUint16 window2_page; /* PROG_PMEM2 or GW2 */ + CsrUint16 window3_page; /* SHARED or GW3 */ + CsrUint16 io_log_addr; +}; + +struct chip_device_regs_t +{ + CsrUint16 gbl_chip_version; + CsrUint16 gbl_misc_enables; + CsrUint16 dbg_emu_cmd; + struct chip_device_regs_per_transport_t host; + struct chip_device_regs_per_transport_t spi; + CsrUint16 dbg_reset; + CsrUint16 dbg_reset_value; + CsrUint16 dbg_reset_warn; + CsrUint16 dbg_reset_warn_value; + CsrUint16 dbg_reset_result; + CsrUint16 xap_pch; + CsrUint16 xap_pcl; + CsrUint16 proc_pc_snoop; + CsrUint16 watchdog_disable; + CsrUint16 mailbox0; + CsrUint16 mailbox1; + CsrUint16 mailbox2; + CsrUint16 mailbox3; + CsrUint16 sdio_host_int; + CsrUint16 shared_io_interrupt; + CsrUint16 sdio_hip_handshake; + CsrUint16 coex_status; /* Allows WAPI detection */ +}; + +/* If allowed is false then this window does not provide this + type of access. + This describes how addresses should be shifted to make the + "page" address. The address is shifted left by 'page_shift' + and then has 'page_offset' added. This value should then be + written to the page register. */ +struct window_shift_info_t +{ + CsrInt32 allowed; + CsrUint32 page_shift; + CsrUint16 page_offset; +}; + +/* Each window has an address and size. These are obvious. It then + has a description for each type of memory that might be accessed + through it. There might also be a start to the offset of the window. + This means that that number of addresses at the start of the window + are unusable. */ +struct window_info_t +{ + CsrUint16 address; + CsrUint16 size; + CsrUint16 blocked; + const struct window_shift_info_t *mode; +}; + +/* If GBL_CHIP_VERSION and'ed with 'mask' and is equal to 'result' + then this is the correct set of info. If pre_bc7 is true then the + address of GBL_CHIP_VERSION is FF9A, else its FE81. */ +struct chip_version_t +{ + CsrInt32 pre_bc7; + CsrUint16 mask; + CsrUint16 result; + CsrUint8 sdio; +}; + +struct chip_device_desc_t +{ + struct chip_version_t chip_version; + + /* This is a text string that a human might find useful (BC02, UF105x) */ + const CsrCharString *friendly_name; + /* This is what we show to customers */ + const CsrCharString *marketing_name; + + /* Initialisation values to write following a reset */ + struct val_array_t init; + + /* Binary sequence for hard reset */ + struct reset_prog_t reset_prog; + + /* The register map */ + const struct chip_device_regs_t *regs; + + /* Some misc. info on the chip */ + struct + { + CsrUint32 has_flash : 1; + CsrUint32 has_ext_sram : 1; + CsrUint32 has_rom : 1; + CsrUint32 has_bt : 1; + CsrUint32 has_wlan : 1; + } bools; + + /* This table is used to remap register addresses depending on what + host interface is used. On the BC7 and later chips there are + multiple sets of memory window registers, on for each host + interafce (SDIO / SPI). The correct one is needed. */ + struct map_array_t map; + + /* The offsets into the program address space of the different types of memory. + The RAM offset is probably the most useful. */ + struct + { + CsrUint32 ram; + CsrUint32 rom; + CsrUint32 flash; + CsrUint32 ext_sram; + } prog_offset; + + /* The offsets into the data address space of interesting things. */ + struct + { + CsrUint16 ram; + /* maybe add shared / page tables? */ + } data_offset; + + /* Information on the different windows */ + const struct window_info_t *windows[CHIP_HELPER_WINDOW_COUNT]; +}; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* CSR_WIFI_HIP_CHIPHELPER_PRIVATE_H__ */ diff --git a/drivers/staging/csr/csr_wifi_hip_conversions.h b/drivers/staging/csr/csr_wifi_hip_conversions.h new file mode 100644 index 0000000..6a4647d --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_conversions.h @@ -0,0 +1,81 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* + * --------------------------------------------------------------------------- + * + * FILE: csr_wifi_hip_conversions.h + * + * PURPOSE: + * This header file provides the macros for converting to and from + * wire format. + * These macros *MUST* work for little-endian AND big-endian hosts. + * + * --------------------------------------------------------------------------- + */ +#ifndef __CSR_WIFI_HIP_CONVERSIONS_H__ +#define __CSR_WIFI_HIP_CONVERSIONS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define SIZEOF_UINT16 2 +#define SIZEOF_UINT32 4 +#define SIZEOF_UINT64 8 + +#define SIZEOF_SIGNAL_HEADER 6 +#define SIZEOF_DATAREF 4 + + +/* + * Macro to retrieve the signal ID from a wire-format signal. + */ +#define GET_SIGNAL_ID(_buf) CSR_GET_UINT16_FROM_LITTLE_ENDIAN((_buf)) + +/* + * Macros to retrieve and set the DATAREF fields in a packed (i.e. wire-format) + * HIP signal. + */ +#define GET_PACKED_DATAREF_SLOT(_buf, _ref) \ + CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 0)) + +#define GET_PACKED_DATAREF_LEN(_buf, _ref) \ + CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 2)) + +#define SET_PACKED_DATAREF_SLOT(_buf, _ref, _slot) \ + CSR_COPY_UINT16_TO_LITTLE_ENDIAN((_slot), ((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 0)) + +#define SET_PACKED_DATAREF_LEN(_buf, _ref, _len) \ + CSR_COPY_UINT16_TO_LITTLE_ENDIAN((_len), ((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 2)) + +#define GET_PACKED_MA_PACKET_REQUEST_FRAME_PRIORITY(_buf) \ + CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 8)) + +#define GET_PACKED_MA_PACKET_REQUEST_HOST_TAG(_buf) \ + CSR_GET_UINT32_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 4)) + +#define GET_PACKED_MA_PACKET_CONFIRM_HOST_TAG(_buf) \ + CSR_GET_UINT32_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 8)) + +#define GET_PACKED_MA_PACKET_CONFIRM_TRANSMISSION_STATUS(_buf) \ + CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 2)) + + +CsrInt32 get_packed_struct_size(const CsrUint8 *buf); +CsrResult read_unpack_signal(const CsrUint8 *ptr, CSR_SIGNAL *sig); +CsrResult write_pack(const CSR_SIGNAL *sig, CsrUint8 *ptr, CsrUint16 *sig_len); + +#ifdef __cplusplus +} +#endif + +#endif /* __CSR_WIFI_HIP_CONVERSIONS_H__ */ + diff --git a/drivers/staging/csr/csr_wifi_hip_download.c b/drivers/staging/csr/csr_wifi_hip_download.c new file mode 100644 index 0000000..fb6f04e --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_download.c @@ -0,0 +1,834 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* + * --------------------------------------------------------------------------- + * FILE: csr_wifi_hip_download.c + * + * PURPOSE: + * Routines for downloading firmware to UniFi. + * + * --------------------------------------------------------------------------- + */ +#include "csr_wifi_hip_unifi.h" +#include "csr_wifi_hip_unifiversion.h" +#include "csr_wifi_hip_card.h" +#include "csr_wifi_hip_xbv.h" + +#undef CSR_WIFI_IGNORE_PATCH_VERSION_MISMATCH + +static CsrResult do_patch_download(card_t *card, void *dlpriv, + xbv1_t *pfwinfo, CsrUint32 boot_ctrl_addr); + +static CsrResult do_patch_convert_download(card_t *card, + void *dlpriv, xbv1_t *pfwinfo); + +/* + * --------------------------------------------------------------------------- + * _find_in_slut + * + * Find the offset of the appropriate object in the SLUT of a card + * + * Arguments: + * card Pointer to card struct + * psym Pointer to symbol object. + * id set up by caller + * obj will be set up by this function + * pslut Pointer to SLUT address, if 0xffffffff then it must be + * read from the chip. + * Returns: + * CSR_RESULT_SUCCESS on success + * Non-zero on error, + * CSR_WIFI_HIP_RESULT_NOT_FOUND if not found + * --------------------------------------------------------------------------- + */ +static CsrResult _find_in_slut(card_t *card, symbol_t *psym, CsrUint32 *pslut) +{ + CsrUint32 slut_address; + CsrUint16 finger_print; + CsrResult r; + CsrResult csrResult; + + /* Get SLUT address */ + if (*pslut == 0xffffffff) + { + r = card_wait_for_firmware_to_start(card, &slut_address); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Firmware hasn't started\n"); + func_exit_r(r); + return r; + } + *pslut = slut_address; + + /* + * Firmware has started so set the SDIO bus clock to the initial speed, + * faster than UNIFI_SDIO_CLOCK_SAFE_HZ, to speed up the f/w download. + */ + csrResult = CsrSdioMaxBusClockFrequencySet(card->sdio_if, UNIFI_SDIO_CLOCK_INIT_HZ); + if (csrResult != CSR_RESULT_SUCCESS) + { + r = ConvertCsrSdioToCsrHipResult(card, csrResult); + func_exit_r(r); + return r; + } + card->sdio_clock_speed = UNIFI_SDIO_CLOCK_INIT_HZ; + } + else + { + slut_address = *pslut; /* Use previously discovered address */ + } + unifi_trace(card->ospriv, UDBG4, "SLUT addr: 0x%lX\n", slut_address); + + /* + * Check the SLUT fingerprint. + * The slut_address is a generic pointer so we must use unifi_card_read16(). + */ + unifi_trace(card->ospriv, UDBG4, "Looking for SLUT finger print\n"); + finger_print = 0; + r = unifi_card_read16(card, slut_address, &finger_print); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to read SLUT finger print\n"); + func_exit_r(r); + return r; + } + + if (finger_print != SLUT_FINGERPRINT) + { + unifi_error(card->ospriv, "Failed to find SLUT fingerprint\n"); + func_exit_r(CSR_RESULT_FAILURE); + return CSR_RESULT_FAILURE; + } + + /* Symbol table starts imedately after the fingerprint */ + slut_address += 2; + + while (1) + { + CsrUint16 id; + CsrUint32 obj; + + r = unifi_card_read16(card, slut_address, &id); + if (r != CSR_RESULT_SUCCESS) + { + func_exit_r(r); + return r; + } + slut_address += 2; + + if (id == CSR_SLT_END) + { + /* End of table reached: not found */ + r = CSR_WIFI_HIP_RESULT_RANGE; + break; + } + + r = unifi_read32(card, slut_address, &obj); + if (r != CSR_RESULT_SUCCESS) + { + func_exit_r(r); + return r; + } + slut_address += 4; + + unifi_trace(card->ospriv, UDBG3, " found SLUT id %02d.%08lx\n", id, obj); + + r = CSR_WIFI_HIP_RESULT_NOT_FOUND; + /* Found search term? */ + if (id == psym->id) + { + unifi_trace(card->ospriv, UDBG1, " matched SLUT id %02d.%08lx\n", id, obj); + psym->obj = obj; + r = CSR_RESULT_SUCCESS; + break; + } + } + + func_exit_r(r); + return r; +} + + +/* + * --------------------------------------------------------------------------- + * do_patch_convert_download + * + * Download the given firmware image to the UniFi, converting from FWDL + * to PTDL XBV format. + * + * Arguments: + * card Pointer to card struct + * dlpriv Pointer to source firmware image + * fwinfo Pointer to source firmware info struct + * + * Returns: + * CSR_RESULT_SUCCESS on success, CSR error code on error + * + * Notes: + * --------------------------------------------------------------------------- + */ +static CsrResult do_patch_convert_download(card_t *card, void *dlpriv, xbv1_t *pfwinfo) +{ + CsrResult r; + CsrUint32 slut_base = 0xffffffff; + void *pfw; + CsrUint32 psize; + symbol_t sym; + + /* Reset the chip to guarantee that the ROM loader is running */ + r = unifi_init(card); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, + "do_patch_convert_download: failed to re-init UniFi\n"); + return r; + } + + /* If no unifi_helper is running, the firmware version must be read */ + if (card->build_id == 0) + { + CsrUint32 ver = 0; + sym.id = CSR_SLT_BUILD_ID_NUMBER; + sym.obj = 0; /* To be updated by _find_in_slut() */ + + unifi_trace(card->ospriv, UDBG1, "Need f/w version\n"); + + /* Find chip build id entry in SLUT */ + r = _find_in_slut(card, &sym, &slut_base); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to find CSR_SLT_BUILD_ID_NUMBER\n"); + return CSR_RESULT_FAILURE; + } + + /* Read running f/w version */ + r = unifi_read32(card, sym.obj, &ver); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to read f/w id\n"); + return CSR_RESULT_FAILURE; + } + card->build_id = ver; + } + + /* Convert the ptest firmware to a patch against the running firmware */ + pfw = xbv_to_patch(card, unifi_fw_read, dlpriv, pfwinfo, &psize); + if (!pfw) + { + unifi_error(card->ospriv, "Failed to convert f/w to patch"); + return CSR_WIFI_HIP_RESULT_NO_MEMORY; + } + else + { + void *desc; + sym.id = CSR_SLT_BOOT_LOADER_CONTROL; + sym.obj = 0; /* To be updated by _find_in_slut() */ + + /* Find boot loader control entry in SLUT */ + r = _find_in_slut(card, &sym, &slut_base); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to find BOOT_LOADER_CONTROL\n"); + return CSR_RESULT_FAILURE; + } + + r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to wake UniFi\n"); + } + + /* Get a dlpriv for the patch buffer so that unifi_fw_read() can + * access it. + */ + desc = unifi_fw_open_buffer(card->ospriv, pfw, psize); + if (!desc) + { + return CSR_WIFI_HIP_RESULT_NO_MEMORY; + } + + /* Download the patch */ + unifi_info(card->ospriv, "Downloading converted f/w as patch\n"); + r = unifi_dl_patch(card, desc, sym.obj); + CsrMemFree(pfw); + unifi_fw_close_buffer(card->ospriv, desc); + + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Converted patch download failed\n"); + func_exit_r(r); + return r; + } + else + { + unifi_trace(card->ospriv, UDBG1, "Converted patch downloaded\n"); + } + + /* This command starts the firmware */ + r = unifi_do_loader_op(card, sym.obj + 6, UNIFI_BOOT_LOADER_RESTART); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to write loader restart cmd\n"); + } + + func_exit_r(r); + return r; + } +} + + +/* + * --------------------------------------------------------------------------- + * unifi_dl_firmware + * + * Download the given firmware image to the UniFi. + * + * Arguments: + * card Pointer to card struct + * dlpriv A context pointer from the calling function to be + * passed when calling unifi_fw_read(). + * + * Returns: + * CSR_RESULT_SUCCESS on success, + * CSR_WIFI_HIP_RESULT_NO_MEMORY memory allocation failed + * CSR_WIFI_HIP_RESULT_INVALID_VALUE error in XBV file + * CSR_RESULT_FAILURE SDIO error + * + * Notes: + * Stops and resets the chip, does the download and runs the new + * firmware. + * --------------------------------------------------------------------------- + */ +CsrResult unifi_dl_firmware(card_t *card, void *dlpriv) +{ + xbv1_t *fwinfo; + CsrResult r; + + func_enter(); + + fwinfo = CsrMemAlloc(sizeof(xbv1_t)); + if (fwinfo == NULL) + { + unifi_error(card->ospriv, "Failed to allocate memory for firmware\n"); + return CSR_WIFI_HIP_RESULT_NO_MEMORY; + } + + /* + * Scan the firmware file to find the TLVs we are interested in. + * These are: + * - check we support the file format version in VERF + * - SLTP Symbol Lookup Table Pointer + * - FWDL firmware download segments + * - FWOV firmware overlay segment + * - VMEQ Register probe tests to verify matching h/w + */ + r = xbv1_parse(card, unifi_fw_read, dlpriv, fwinfo); + if (r != CSR_RESULT_SUCCESS || fwinfo->mode != xbv_firmware) + { + unifi_error(card->ospriv, "File type is %s, expected firmware.\n", + fwinfo->mode == xbv_patch?"patch" : "unknown"); + CsrMemFree(fwinfo); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + /* UF6xxx doesn't accept firmware, only patches. Therefore we convert + * the file to patch format with version numbers matching the current + * running firmware, and then download via the patch mechanism. + * The sole purpose of this is to support production test firmware across + * different ROM releases, the test firmware being provided in non-patch + * format. + */ + if (card->chip_id > SDIO_CARD_ID_UNIFI_2) + { + unifi_info(card->ospriv, "Must convert f/w to patch format\n"); + r = do_patch_convert_download(card, dlpriv, fwinfo); + } + else + { + /* Older UniFi chips allowed firmware to be directly loaded onto the + * chip, which is no longer supported. + */ + unifi_error(card->ospriv, "Only patch downloading supported\n"); + r = CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + CsrMemFree(fwinfo); + func_exit_r(r); + return r; +} /* unifi_dl_firmware() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_dl_patch + * + * Load the given patch set into UniFi. + * + * Arguments: + * card Pointer to card struct + * dlpriv The os specific handle to the firmware file. + * boot_ctrl The address of the boot loader control structure. + * + * Returns: + * CSR_RESULT_SUCCESS on success, + * CSR_WIFI_HIP_RESULT_NO_MEMORY memory allocation failed + * CSR_WIFI_HIP_RESULT_INVALID_VALUE error in XBV file + * CSR_RESULT_FAILURE SDIO error + * + * Notes: + * This ends up telling UniFi to restart. + * --------------------------------------------------------------------------- + */ +CsrResult unifi_dl_patch(card_t *card, void *dlpriv, CsrUint32 boot_ctrl) +{ + xbv1_t *fwinfo; + CsrResult r; + + func_enter(); + + unifi_info(card->ospriv, "unifi_dl_patch %p %08x\n", dlpriv, boot_ctrl); + + fwinfo = CsrMemAlloc(sizeof(xbv1_t)); + if (fwinfo == NULL) + { + unifi_error(card->ospriv, "Failed to allocate memory for patches\n"); + func_exit(); + return CSR_WIFI_HIP_RESULT_NO_MEMORY; + } + + /* + * Scan the firmware file to find the TLVs we are interested in. + * These are: + * - check we support the file format version in VERF + * - FWID The build ID of the ROM that we can patch + * - PTDL patch download segments + */ + r = xbv1_parse(card, unifi_fw_read, dlpriv, fwinfo); + if (r != CSR_RESULT_SUCCESS || fwinfo->mode != xbv_patch) + { + CsrMemFree(fwinfo); + unifi_error(card->ospriv, "Failed to read in patch file\n"); + func_exit(); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + /* + * We have to check the build id read from the SLUT against that + * for the patch file. They have to match exactly. + * "card->build_id" == XBV1.PTCH.FWID + */ + if (card->build_id != fwinfo->build_id) + { + unifi_error(card->ospriv, "Wrong patch file for chip (chip = %lu, file = %lu)\n", + card->build_id, fwinfo->build_id); + CsrMemFree(fwinfo); +#ifndef CSR_WIFI_IGNORE_PATCH_VERSION_MISMATCH + func_exit(); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; +#else + fwinfo = NULL; + dlpriv = NULL; + return CSR_RESULT_SUCCESS; +#endif + } + + r = do_patch_download(card, dlpriv, fwinfo, boot_ctrl); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to patch image\n"); + } + + CsrMemFree(fwinfo); + + func_exit_r(r); + return r; +} /* unifi_dl_patch() */ + + +void* unifi_dl_fw_read_start(card_t *card, CsrInt8 is_fw) +{ + card_info_t card_info; + + unifi_card_info(card, &card_info); + unifi_trace(card->ospriv, UDBG5, + "id=%d, ver=0x%x, fw_build=%u, fw_hip=0x%x, block_size=%d\n", + card_info.chip_id, card_info.chip_version, + card_info.fw_build, card_info.fw_hip_version, + card_info.sdio_block_size); + + return unifi_fw_read_start(card->ospriv, is_fw, &card_info); +} + + +/* + * --------------------------------------------------------------------------- + * safe_read_shared_location + * + * Read a shared memory location repeatedly until we get two readings + * the same. + * + * Arguments: + * card Pointer to card context struct. + * unifi_addr UniFi shared-data-memory address to access. + * pdata Pointer to a byte variable for the value read. + * + * + * Returns: + * CSR_RESULT_SUCCESS on success, CSR error code on failure + * --------------------------------------------------------------------------- + */ +static CsrResult safe_read_shared_location(card_t *card, CsrUint32 address, CsrUint8 *pdata) +{ + CsrResult r; + CsrUint16 limit = 1000; + CsrUint8 b, b2; + + *pdata = 0; + + r = unifi_read_8_or_16(card, address, &b); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + + while (limit--) + { + r = unifi_read_8_or_16(card, address, &b2); + if (r != CSR_RESULT_SUCCESS) + { + return r; + } + + /* When we have a stable value, return it */ + if (b == b2) + { + *pdata = b; + return CSR_RESULT_SUCCESS; + } + + b = b2; + } + + return CSR_RESULT_FAILURE; +} /* safe_read_shared_location() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_do_loader_op + * + * Send a loader / boot_loader command to the UniFi and wait for + * it to complete. + * + * Arguments: + * card Pointer to card context struct. + * op_addr The address of the loader operation control word. + * opcode The operation to perform. + * + * Returns: + * CSR_RESULT_SUCCESS on success + * CSR_RESULT_FAILURE SDIO error or SDIO/XAP timeout + * --------------------------------------------------------------------------- + */ + +/* + * Ideally instead of sleeping, we want to busy wait. + * Currently there is no framework API to do this. When it becomes available, + * we can use it to busy wait using usecs + */ +#define OPERATION_TIMEOUT_LOOPS (100) /* when OPERATION_TIMEOUT_DELAY==1, (500) otherwise */ +#define OPERATION_TIMEOUT_DELAY 1 /* msec, or 200usecs */ + +CsrResult unifi_do_loader_op(card_t *card, CsrUint32 op_addr, CsrUint8 opcode) +{ + CsrResult r; + CsrInt16 op_retries; + + unifi_trace(card->ospriv, UDBG4, "Loader cmd 0x%0x -> 0x%08x\n", opcode, op_addr); + + /* Set the Operation command byte to the opcode */ + r = unifi_write_8_or_16(card, op_addr, opcode); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to write loader copy command\n"); + return r; + } + + /* Wait for Operation command byte to be Idle */ + /* Typically takes ~100us */ + op_retries = 0; + r = CSR_RESULT_SUCCESS; + while (1) + { + CsrUint8 op; + + /* + * Read the memory location until two successive reads give + * the same value. + * Then handle it. + */ + r = safe_read_shared_location(card, op_addr, &op); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to read loader status\n"); + break; + } + + if (op == UNIFI_LOADER_IDLE) + { + /* Success */ + break; + } + + if (op != opcode) + { + unifi_error(card->ospriv, "Error reported by loader: 0x%X\n", op); + r = CSR_RESULT_FAILURE; + break; + } + + /* Allow 500us timeout */ + if (++op_retries >= OPERATION_TIMEOUT_LOOPS) + { + unifi_error(card->ospriv, "Timeout waiting for loader to ack transfer\n"); + /* Stop XAPs to aid post-mortem */ + r = unifi_card_stop_processor(card, UNIFI_PROC_BOTH); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to stop UniFi processors\n"); + } + else + { + r = CSR_RESULT_FAILURE; + } + break; + } + CsrThreadSleep(OPERATION_TIMEOUT_DELAY); + } /* Loop exits with r != CSR_RESULT_SUCCESS on error */ + + return r; +} /* unifi_do_loader_op() */ + + +/* + * --------------------------------------------------------------------------- + * send_ptdl_to_unifi + * + * Copy a patch block from userland to the UniFi. + * This function reads data, 2K at a time, from userland and writes + * it to the UniFi. + * + * Arguments: + * card A pointer to the card structure + * dlpriv The os specific handle for the firmware file + * ptdl A pointer ot the PTDL block + * handle The buffer handle to use for the xfer + * op_addr The address of the loader operation control word + * + * Returns: + * Number of bytes sent (Positive) or negative value indicating + * error code: + * CSR_WIFI_HIP_RESULT_NO_MEMORY memory allocation failed + * CSR_WIFI_HIP_RESULT_INVALID_VALUE error in XBV file + * CSR_RESULT_FAILURE SDIO error + * --------------------------------------------------------------------------- + */ +static CsrResult send_ptdl_to_unifi(card_t *card, void *dlpriv, + const struct PTDL *ptdl, CsrUint32 handle, + CsrUint32 op_addr) +{ + CsrUint32 offset; + CsrUint8 *buf; + CsrInt32 data_len; + CsrUint32 write_len; + CsrResult r; + const CsrUint16 buf_size = 2 * 1024; + + offset = ptdl->dl_offset; + data_len = ptdl->dl_size; + + if (data_len > buf_size) + { + unifi_error(card->ospriv, "PTDL block is too large (%u)\n", + ptdl->dl_size); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + buf = CsrMemAlloc(buf_size); + if (buf == NULL) + { + unifi_error(card->ospriv, "Failed to allocate transfer buffer for firmware download\n"); + return CSR_WIFI_HIP_RESULT_NO_MEMORY; + } + + r = CSR_RESULT_SUCCESS; + + if (unifi_fw_read(card->ospriv, dlpriv, offset, buf, data_len) != data_len) + { + unifi_error(card->ospriv, "Failed to read from file\n"); + } + else + { + /* We can always round these if the host wants to */ + if (card->sdio_io_block_pad) + { + write_len = (data_len + (card->sdio_io_block_size - 1)) & + ~(card->sdio_io_block_size - 1); + + /* Zero out the rest of the buffer (This isn't needed, but it + * makes debugging things later much easier). */ + CsrMemSet(buf + data_len, 0, write_len - data_len); + } + else + { + write_len = data_len; + } + + r = unifi_bulk_rw_noretry(card, handle, buf, write_len, UNIFI_SDIO_WRITE); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "CMD53 failed writing %d bytes to handle %ld\n", + data_len, handle); + } + else + { + /* + * Can change the order of things to overlap read from file + * with copy to unifi + */ + r = unifi_do_loader_op(card, op_addr, UNIFI_BOOT_LOADER_PATCH); + } + } + + CsrMemFree(buf); + + if (r != CSR_RESULT_SUCCESS && r != CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + unifi_error(card->ospriv, "Failed to copy block of %u bytes to UniFi\n", + ptdl->dl_size); + } + + return r; +} /* send_ptdl_to_unifi() */ + + +/* + * --------------------------------------------------------------------------- + * do_patch_download + * + * This function downloads a set of patches to UniFi and then + * causes it to restart. + * + * Arguments: + * card Pointer to card struct. + * dlpriv A context pointer from the calling function to be + * used when reading the XBV file. This can be NULL + * in which case not patches are applied. + * pfwinfo Pointer to a fwinfo struct describing the f/w + * XBV file. + * boot_ctrl_addr The address of the boot loader control structure. + * + * Returns: + * 0 on success, or an error code + * CSR_WIFI_HIP_RESULT_INVALID_VALUE for a bad laoader version number + * --------------------------------------------------------------------------- + */ +static CsrResult do_patch_download(card_t *card, void *dlpriv, xbv1_t *pfwinfo, CsrUint32 boot_ctrl_addr) +{ + CsrResult r; + CsrInt32 i; + CsrUint16 loader_version; + CsrUint16 handle; + CsrUint32 total_bytes; + + /* + * Read info from the SDIO Loader Control Data Structure + */ + /* Check the loader version */ + r = unifi_card_read16(card, boot_ctrl_addr, &loader_version); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Patch download: Failed to read loader version\n"); + return r; + } + unifi_trace(card->ospriv, UDBG2, "Patch download: boot loader version 0x%04X\n", loader_version); + switch (loader_version) + { + case 0x0000: + break; + + default: + unifi_error(card->ospriv, "Patch loader version (0x%04X) is not supported by this driver\n", + loader_version); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + /* Retrieve the handle to use with CMD53 */ + r = unifi_card_read16(card, boot_ctrl_addr + 4, &handle); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Patch download: Failed to read loader handle\n"); + return r; + } + + /* Set the mask of LEDs to flash */ + if (card->loader_led_mask) + { + r = unifi_card_write16(card, boot_ctrl_addr + 2, + (CsrUint16)card->loader_led_mask); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Patch download: Failed to write LED mask\n"); + return r; + } + } + + total_bytes = 0; + + /* Copy download data to UniFi memory */ + for (i = 0; i < pfwinfo->num_ptdl; i++) + { + unifi_trace(card->ospriv, UDBG3, "Patch download: %d Downloading for %d from offset %d\n", + i, + pfwinfo->ptdl[i].dl_size, + pfwinfo->ptdl[i].dl_offset); + + r = send_ptdl_to_unifi(card, dlpriv, &pfwinfo->ptdl[i], + handle, boot_ctrl_addr + 6); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + return r; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Patch failed after %u bytes\n", + total_bytes); + return r; + } + total_bytes += pfwinfo->ptdl[i].dl_size; + } + + return CSR_RESULT_SUCCESS; +} /* do_patch_download() */ + + diff --git a/drivers/staging/csr/csr_wifi_hip_dump.c b/drivers/staging/csr/csr_wifi_hip_dump.c new file mode 100644 index 0000000..c191ea1 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_dump.c @@ -0,0 +1,872 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* + * --------------------------------------------------------------------------- + * FILE: csr_wifi_hip_dump.c + * + * PURPOSE: + * Routines for retrieving and buffering core status from the UniFi + * + * --------------------------------------------------------------------------- + */ +#include "csr_wifi_hip_unifi.h" +#include "csr_wifi_hip_unifiversion.h" +#include "csr_wifi_hip_card.h" + +/* Locations to capture in dump (XAP words) */ +#define HIP_CDUMP_FIRST_CPUREG (0xFFE0) /* First CPU register */ +#define HIP_CDUMP_FIRST_LO (0) /* Start of low address range */ +#define HIP_CDUMP_FIRST_HI_MAC (0x3C00) /* Start of MAC high area */ +#define HIP_CDUMP_FIRST_HI_PHY (0x1C00) /* Start of PHY high area */ +#define HIP_CDUMP_FIRST_SH (0) /* Start of shared memory area */ + +#define HIP_CDUMP_NCPUREGS (10) /* No. of 16-bit XAP registers */ +#define HIP_CDUMP_NWORDS_LO (0x0100) /* Low area size in 16-bit words */ +#define HIP_CDUMP_NWORDS_HI (0x0400) /* High area size in 16-bit words */ +#define HIP_CDUMP_NWORDS_SH (0x0500) /* Shared memory area size, 16-bit words */ + +#define HIP_CDUMP_NUM_ZONES 7 /* Number of UniFi memory areas to capture */ + +/* Mini-coredump state */ +typedef struct coredump_buf +{ + CsrUint16 count; /* serial number of dump */ + CsrTime timestamp; /* host's system time at capture */ + CsrInt16 requestor; /* request: 0=auto dump, 1=manual */ + CsrUint16 chip_ver; + CsrUint32 fw_ver; + CsrUint16 *zone[HIP_CDUMP_NUM_ZONES]; + + struct coredump_buf *next; /* circular list */ + struct coredump_buf *prev; /* circular list */ +} coredump_buffer; + +/* Structure used to describe a zone of chip memory captured by mini-coredump */ +struct coredump_zone +{ + unifi_coredump_space_t space; /* XAP memory space this zone covers */ + enum unifi_dbg_processors_select cpu; /* XAP CPU core selector */ + CsrUint32 gp; /* Generic Pointer to memory zone on XAP */ + CsrUint16 offset; /* 16-bit XAP word offset of zone in memory space */ + CsrUint16 length; /* Length of zone in XAP words */ +}; + +static CsrResult unifi_coredump_from_sdio(card_t *card, coredump_buffer *dump_buf); +static CsrResult unifi_coredump_read_zones(card_t *card, coredump_buffer *dump_buf); +static CsrResult unifi_coredump_read_zone(card_t *card, CsrUint16 *zone, + const struct coredump_zone *def); +static CsrInt32 get_value_from_coredump(const coredump_buffer *dump, + const unifi_coredump_space_t space, const CsrUint16 offset); + +/* Table of chip memory zones we capture on mini-coredump */ +static const struct coredump_zone zonedef_table[HIP_CDUMP_NUM_ZONES] = { + { UNIFI_COREDUMP_MAC_REG, UNIFI_PROC_MAC, UNIFI_MAKE_GP(REGISTERS, HIP_CDUMP_FIRST_CPUREG * 2), HIP_CDUMP_FIRST_CPUREG, HIP_CDUMP_NCPUREGS }, + { UNIFI_COREDUMP_PHY_REG, UNIFI_PROC_PHY, UNIFI_MAKE_GP(REGISTERS, HIP_CDUMP_FIRST_CPUREG * 2), HIP_CDUMP_FIRST_CPUREG, HIP_CDUMP_NCPUREGS }, + { UNIFI_COREDUMP_SH_DMEM, UNIFI_PROC_INVALID, UNIFI_MAKE_GP(SH_DMEM, HIP_CDUMP_FIRST_SH * 2), HIP_CDUMP_FIRST_SH, HIP_CDUMP_NWORDS_SH }, + { UNIFI_COREDUMP_MAC_DMEM, UNIFI_PROC_MAC, UNIFI_MAKE_GP(MAC_DMEM, HIP_CDUMP_FIRST_LO * 2), HIP_CDUMP_FIRST_LO, HIP_CDUMP_NWORDS_LO }, + { UNIFI_COREDUMP_MAC_DMEM, UNIFI_PROC_MAC, UNIFI_MAKE_GP(MAC_DMEM, HIP_CDUMP_FIRST_HI_MAC * 2), HIP_CDUMP_FIRST_HI_MAC, HIP_CDUMP_NWORDS_HI }, + { UNIFI_COREDUMP_PHY_DMEM, UNIFI_PROC_PHY, UNIFI_MAKE_GP(PHY_DMEM, HIP_CDUMP_FIRST_LO * 2), HIP_CDUMP_FIRST_LO, HIP_CDUMP_NWORDS_LO }, + { UNIFI_COREDUMP_PHY_DMEM, UNIFI_PROC_PHY, UNIFI_MAKE_GP(PHY_DMEM, HIP_CDUMP_FIRST_HI_PHY * 2), HIP_CDUMP_FIRST_HI_PHY, HIP_CDUMP_NWORDS_HI }, +}; + +/* + * --------------------------------------------------------------------------- + * unifi_coredump_request_at_next_reset + * + * Request that a mini-coredump is performed when the driver has + * completed resetting the UniFi device. + * + * Arguments: + * card Pointer to card struct + * enable If non-zero, sets the request. + * If zero, cancels any pending request. + * + * Returns: + * CSR_RESULT_SUCCESS or CSR HIP error code + * + * Notes: + * This function is typically called once the driver has detected that + * the UniFi device has become unresponsive due to crash, or internal + * watchdog reset. The driver must reset it to regain communication and, + * immediately after that, the mini-coredump can be captured. + * --------------------------------------------------------------------------- + */ +CsrResult unifi_coredump_request_at_next_reset(card_t *card, CsrInt8 enable) +{ + CsrResult r; + + func_enter(); + + if (enable) + { + unifi_trace(card->ospriv, UDBG2, "Mini-coredump requested after reset\n"); + } + + if (card == NULL) + { + r = CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + else + { + card->request_coredump_on_reset = enable?1 : 0; + r = CSR_RESULT_SUCCESS; + } + + func_exit_r(r); + return r; +} + + +/* + * --------------------------------------------------------------------------- + * unifi_coredump_handle_request + * + * Performs a coredump now, if one was requested, and clears the request. + * + * Arguments: + * card Pointer to card struct + * + * Returns: + * CSR_RESULT_SUCCESS or CSR HIP error code + * + * Notes: + * --------------------------------------------------------------------------- + */ +CsrResult unifi_coredump_handle_request(card_t *card) +{ + CsrResult r = CSR_RESULT_SUCCESS; + + func_enter(); + + if (card == NULL) + { + r = CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + else + { + if (card->request_coredump_on_reset == 1) + { + card->request_coredump_on_reset = 0; + r = unifi_coredump_capture(card, NULL); + } + } + + func_exit_r(r); + return r; +} + + +/* + * --------------------------------------------------------------------------- + * unifi_coredump_capture + * + * Capture the current status of the UniFi device. + * Various registers are buffered for future offline inspection. + * + * Arguments: + * card Pointer to card struct + * req Pointer to request struct, or NULL: + * A coredump requested manually by the user app + * will have a request struct pointer, an automatic + * coredump will have a NULL pointer. + * Returns: + * CSR_RESULT_SUCCESS on success, + * CSR_RESULT_FAILURE SDIO error + * CSR_WIFI_HIP_RESULT_INVALID_VALUE Initialisation not complete + * + * Notes: + * The result is a filled entry in the circular buffer of core dumps, + * values from which can be extracted to userland via an ioctl. + * --------------------------------------------------------------------------- + */ +CsrResult unifi_coredump_capture(card_t *card, struct unifi_coredump_req *req) +{ + CsrResult r = CSR_RESULT_SUCCESS; + static CsrUint16 dump_seq_no = 1; + CsrTime time_of_capture; + + func_enter(); + + if (card->dump_next_write == NULL) + { + r = CSR_RESULT_SUCCESS; + goto done; + } + + /* Reject forced capture before initialisation has happened */ + if (card->helper == NULL) + { + r = CSR_WIFI_HIP_RESULT_INVALID_VALUE; + goto done; + } + + + /* + * Force a mini-coredump capture right now + */ + time_of_capture = CsrTimeGet(NULL); + unifi_info(card->ospriv, "Mini-coredump capture at t=%u\n", time_of_capture); + + /* Wake up the processors so we can talk to them */ + r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to wake UniFi\n"); + goto done; + } + CsrThreadSleep(20); + + /* Stop both XAPs */ + unifi_trace(card->ospriv, UDBG4, "Stopping XAPs for coredump capture\n"); + r = unifi_card_stop_processor(card, UNIFI_PROC_BOTH); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to stop UniFi XAPs\n"); + goto done; + } + + /* Dump core into the next available slot in the circular list */ + r = unifi_coredump_from_sdio(card, card->dump_next_write); + if (r == CSR_RESULT_SUCCESS) + { + /* Record whether the dump was manual or automatic */ + card->dump_next_write->requestor = (req?1 : 0); + card->dump_next_write->timestamp = time_of_capture; + /* Advance to the next buffer */ + card->dump_next_write->count = dump_seq_no++; + card->dump_cur_read = card->dump_next_write; + card->dump_next_write = card->dump_next_write->next; + + /* Sequence no. of zero indicates slot not in use, so handle wrap */ + if (dump_seq_no == 0) + { + dump_seq_no = 1; + } + + unifi_trace(card->ospriv, UDBG3, + "Coredump (%p), SeqNo=%d, cur_read=%p, next_write=%p\n", + req, + card->dump_cur_read->count, + card->dump_cur_read, card->dump_next_write); + } + + /* Start both XAPs */ + unifi_trace(card->ospriv, UDBG4, "Restart XAPs after coredump\n"); + r = card_start_processor(card, UNIFI_PROC_BOTH); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Failed to start UniFi XAPs\n"); + goto done; + } + +done: + func_exit_r(r); + return r; +} /* unifi_coredump_capture() */ + + +/* + * --------------------------------------------------------------------------- + * get_value_from_coredump + * + * + * + * Arguments: + * dump Pointer to buffered coredump data + * offset_in_space XAP memory space to retrieve from the buffer (there + * may be more than one zone covering the same memory + * space, but starting from different offsets). + * offset Offset within the XAP memory space to be retrieved + * + * Returns: + * >=0 Register value on success + * <0 Register out of range of any captured zones + * + * Notes: + * --------------------------------------------------------------------------- + */ +static CsrInt32 get_value_from_coredump(const coredump_buffer *dump, + const unifi_coredump_space_t space, + const CsrUint16 offset_in_space) +{ + CsrInt32 r = -1; + CsrUint16 offset_in_zone; + CsrUint32 zone_end_offset; + CsrInt32 i; + const struct coredump_zone *def = &zonedef_table[0]; + + /* Search zone def table for a match with the requested memory space */ + for (i = 0; i < HIP_CDUMP_NUM_ZONES; i++, def++) + { + if (space == def->space) + { + zone_end_offset = def->offset + def->length; + + /* Is the space offset contained in this zone? */ + if (offset_in_space < zone_end_offset && + offset_in_space >= def->offset) + { + /* Calculate the offset of data within the zone buffer */ + offset_in_zone = offset_in_space - def->offset; + r = (CsrInt32) * (dump->zone[i] + offset_in_zone); + + unifi_trace(NULL, UDBG6, + "sp %d, offs 0x%04x = 0x%04x (in z%d 0x%04x->0x%04x)\n", + space, offset_in_space, r, + i, def->offset, zone_end_offset - 1); + break; + } + } + } + return r; +} + + +/* + * --------------------------------------------------------------------------- + * unifi_coredump_get_value + * + * Retrieve the value of a register buffered from a previous core dump, + * so that it may be reported back to application code. + * + * Arguments: + * card Pointer to card struct + * req_reg Pointer to request parameter partially filled. This + * function puts in the values retrieved from the dump. + * + * Returns: + * CSR_RESULT_SUCCESS on success, or: + * CSR_WIFI_HIP_RESULT_INVALID_VALUE Null parameter error + * CSR_WIFI_HIP_RESULT_RANGE Register out of range + * CSR_WIFI_HIP_RESULT_NOT_FOUND Dump index not (yet) captured + * + * Notes: + * --------------------------------------------------------------------------- + */ +CsrResult unifi_coredump_get_value(card_t *card, struct unifi_coredump_req *req) +{ + CsrResult r; + CsrInt32 i = 0; + coredump_buffer *find_dump = NULL; + + func_enter(); + + if (req == NULL || card == NULL) + { + r = CSR_WIFI_HIP_RESULT_INVALID_VALUE; + goto done; + } + req->value = -1; + if (card->dump_buf == NULL) + { + unifi_trace(card->ospriv, UDBG2, "No coredump buffers\n"); + r = CSR_WIFI_HIP_RESULT_NOT_FOUND; /* Coredumping disabled */ + goto done; + } + if (card->dump_cur_read == NULL) + { + unifi_trace(card->ospriv, UDBG4, "No coredumps captured\n"); + r = CSR_WIFI_HIP_RESULT_NOT_FOUND; /* No coredump yet captured */ + goto done; + } + + /* Find the requested dump buffer */ + switch (req->index) + { + case 0: /* Newest */ + find_dump = card->dump_cur_read; + break; + case -1: /* Oldest: The next used slot forward */ + for (find_dump = card->dump_cur_read->next; + (find_dump->count == 0) && (find_dump != card->dump_cur_read); + find_dump = card->dump_cur_read->next) + { + } + break; + default: /* Number of steps back from current read position */ + for (i = 0, find_dump = card->dump_cur_read; + i < req->index; + i++, find_dump = find_dump->prev) + { + /* Walk the list for the index'th entry, but + * stop when about to wrap. */ + unifi_trace(card->ospriv, UDBG6, + "%d: %d, @%p, p=%p, n=%p, cr=%p, h=%p\n", + i, find_dump->count, find_dump, find_dump->prev, + find_dump->next, card->dump_cur_read, card->dump_buf); + if (find_dump->prev == card->dump_cur_read) + { + /* Wrapped but still not found, index out of range */ + if (i != req->index) + { + unifi_trace(card->ospriv, UDBG6, + "Dump index %d not found %d\n", req->index, i); + r = CSR_WIFI_HIP_RESULT_NOT_FOUND; + goto done; + } + break; + } + } + break; + } + + /* Check if the slot is actually filled with a core dump */ + if (find_dump->count == 0) + { + unifi_trace(card->ospriv, UDBG4, "Not captured %d\n", req->index); + r = CSR_WIFI_HIP_RESULT_NOT_FOUND; + goto done; + } + + unifi_trace(card->ospriv, UDBG6, "Req index %d, found seq %d at step %d\n", + req->index, find_dump->count, i); + + /* Find the appropriate entry in the buffer */ + req->value = get_value_from_coredump(find_dump, req->space, (CsrUint16)req->offset); + if (req->value < 0) + { + r = CSR_WIFI_HIP_RESULT_RANGE; /* Un-captured register */ + unifi_trace(card->ospriv, UDBG4, + "Can't read space %d, reg 0x%x from coredump buffer %d\n", + req->space, req->offset, req->index); + } + else + { + r = CSR_RESULT_SUCCESS; + } + + /* Update the private request structure with the found values */ + req->chip_ver = find_dump->chip_ver; + req->fw_ver = find_dump->fw_ver; + req->timestamp = find_dump->timestamp; + req->requestor = find_dump->requestor; + req->serial = find_dump->count; + +done: + func_exit_r(r); + return r; +} /* unifi_coredump_get_value() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_coredump_read_zone + * + * Captures a UniFi memory zone into a buffer on the host + * + * Arguments: + * card Pointer to card struct + * zonebuf Pointer to on-host buffer to dump the memory zone into + * def Pointer to description of the memory zone to read from UniFi. + * + * Returns: + * CSR_RESULT_SUCCESS on success, or: + * CSR_RESULT_FAILURE SDIO error + * CSR_WIFI_HIP_RESULT_INVALID_VALUE Parameter error + * + * Notes: + * It is assumed that the caller has already stopped the XAPs + * --------------------------------------------------------------------------- + */ +static CsrResult unifi_coredump_read_zone(card_t *card, CsrUint16 *zonebuf, const struct coredump_zone *def) +{ + CsrResult r; + + func_enter(); + + if (zonebuf == NULL || def == NULL) + { + r = CSR_WIFI_HIP_RESULT_INVALID_VALUE; + goto done; + } + + /* Select XAP CPU if necessary */ + if (def->cpu != UNIFI_PROC_INVALID) + { + if (def->cpu != UNIFI_PROC_MAC && def->cpu != UNIFI_PROC_PHY) + { + r = CSR_WIFI_HIP_RESULT_INVALID_VALUE; + goto done; + } + r = unifi_set_proc_select(card, def->cpu); + if (r != CSR_RESULT_SUCCESS) + { + goto done; + } + } + + unifi_trace(card->ospriv, UDBG4, + "Dump sp %d, offs 0x%04x, 0x%04x words @GP=%08x CPU %d\n", + def->space, def->offset, def->length, def->gp, def->cpu); + + /* Read on-chip RAM (byte-wise) */ + r = unifi_card_readn(card, def->gp, zonebuf, (CsrUint16)(def->length * 2)); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + goto done; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Can't read UniFi shared data area\n"); + goto done; + } + +done: + func_exit_r(r); + return r; +} + + +/* + * --------------------------------------------------------------------------- + * unifi_coredump_read_zones + * + * Walks through the table of on-chip memory zones defined in zonedef_table, + * and reads each of them from the UniFi chip + * + * Arguments: + * card Pointer to card struct + * dump_buf Buffer into which register values will be dumped + * + * Returns: + * CSR_RESULT_SUCCESS on success, or: + * CSR_RESULT_FAILURE SDIO error + * CSR_WIFI_HIP_RESULT_INVALID_VALUE Parameter error + * + * Notes: + * It is assumed that the caller has already stopped the XAPs + * --------------------------------------------------------------------------- + */ +static CsrResult unifi_coredump_read_zones(card_t *card, coredump_buffer *dump_buf) +{ + CsrResult r = CSR_RESULT_SUCCESS; + CsrInt32 i; + + func_enter(); + + /* Walk the table of coredump zone definitions and read them from the chip */ + for (i = 0; + (i < HIP_CDUMP_NUM_ZONES) && (r == 0); + i++) + { + r = unifi_coredump_read_zone(card, dump_buf->zone[i], &zonedef_table[i]); + } + + func_exit_r(r); + return r; +} + + +/* + * --------------------------------------------------------------------------- + * unifi_coredump_from_sdio + * + * Capture the status of the UniFi processors, over SDIO + * + * Arguments: + * card Pointer to card struct + * reg_buffer Buffer into which register values will be dumped + * + * Returns: + * CSR_RESULT_SUCCESS on success, or: + * CSR_RESULT_FAILURE SDIO error + * CSR_WIFI_HIP_RESULT_INVALID_VALUE Parameter error + * + * Notes: + * --------------------------------------------------------------------------- + */ +static CsrResult unifi_coredump_from_sdio(card_t *card, coredump_buffer *dump_buf) +{ + CsrUint16 val; + CsrResult r; + CsrUint32 sdio_addr; + + func_enter(); + + if (dump_buf == NULL) + { + r = CSR_WIFI_HIP_RESULT_INVALID_VALUE; + goto done; + } + + + /* Chip and firmware version */ + unifi_trace(card->ospriv, UDBG4, "Get chip version\n"); + sdio_addr = 2 * ChipHelper_GBL_CHIP_VERSION(card->helper); + if (sdio_addr != 0) + { + r = unifi_read_direct16(card, sdio_addr, &val); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + goto done; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Can't read GBL_CHIP_VERSION\n"); + goto done; + } + } + dump_buf->chip_ver = val; + dump_buf->fw_ver = card->build_id; + + unifi_trace(card->ospriv, UDBG4, "chip_ver 0x%04x, fw_ver %u\n", + dump_buf->chip_ver, dump_buf->fw_ver); + + /* Capture the memory zones required from UniFi */ + r = unifi_coredump_read_zones(card, dump_buf); + if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) + { + goto done; + } + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "Can't read UniFi memory areas\n"); + goto done; + } + +done: + func_exit_r(r); + return r; +} /* unifi_coredump_from_sdio() */ + + +#ifndef UNIFI_DISABLE_COREDUMP +/* + * --------------------------------------------------------------------------- + * new_coredump_node + * + * Allocates a coredump linked-list node, and links it to the previous. + * + * Arguments: + * ospriv OS context + * prevnode Previous node to link into + * + * Returns: + * Pointer to valid coredump_buffer on success + * NULL on memory allocation failure + * + * Notes: + * Allocates "all or nothing" + * --------------------------------------------------------------------------- + */ +static +coredump_buffer* new_coredump_node(void *ospriv, coredump_buffer *prevnode) +{ + coredump_buffer *newnode = NULL; + CsrUint16 *newzone = NULL; + CsrInt32 i; + CsrUint32 zone_size; + + /* Allocate node header */ + newnode = (coredump_buffer *)CsrMemAlloc(sizeof(coredump_buffer)); + if (newnode == NULL) + { + return NULL; + } + CsrMemSet(newnode, 0, sizeof(coredump_buffer)); + + /* Allocate chip memory zone capture buffers */ + for (i = 0; i < HIP_CDUMP_NUM_ZONES; i++) + { + zone_size = sizeof(CsrUint16) * zonedef_table[i].length; + newzone = (CsrUint16 *)CsrMemAlloc(zone_size); + newnode->zone[i] = newzone; + if (newzone != NULL) + { + CsrMemSet(newzone, 0, zone_size); + } + else + { + unifi_error(ospriv, "Out of memory on coredump zone %d (%d words)\n", + i, zonedef_table[i].length); + break; + } + } + + /* Clean up if any zone alloc failed */ + if (newzone == NULL) + { + for (i = 0; newnode->zone[i] != NULL; i++) + { + CsrMemFree(newnode->zone[i]); + newnode->zone[i] = NULL; + } + } + + /* Link to previous node */ + newnode->prev = prevnode; + if (prevnode) + { + prevnode->next = newnode; + } + newnode->next = NULL; + + return newnode; +} + + +#endif /* UNIFI_DISABLE_COREDUMP */ + +/* + * --------------------------------------------------------------------------- + * unifi_coredump_init + * + * Allocates buffers for the automatic SDIO core dump + * + * Arguments: + * card Pointer to card struct + * num_dump_buffers Number of buffers to reserve for coredumps + * + * Returns: + * CSR_RESULT_SUCCESS on success, or: + * CSR_WIFI_HIP_RESULT_NO_MEMORY memory allocation failed + * + * Notes: + * Allocates space in advance, to be used for the last n coredump buffers + * the intention being that the size is sufficient for at least one dump, + * probably several. + * It's probably advisable to have at least 2 coredump buffers to allow + * one to be enquired with the unifi_coredump tool, while leaving another + * free for capturing. + * --------------------------------------------------------------------------- + */ +CsrResult unifi_coredump_init(card_t *card, CsrUint16 num_dump_buffers) +{ +#ifndef UNIFI_DISABLE_COREDUMP + void *ospriv = card->ospriv; + coredump_buffer *prev = NULL; + coredump_buffer *newnode = NULL; + CsrUint32 i = 0; +#endif + + func_enter(); + + card->request_coredump_on_reset = 0; + card->dump_next_write = NULL; + card->dump_cur_read = NULL; + card->dump_buf = NULL; + +#ifndef UNIFI_DISABLE_COREDUMP + unifi_trace(ospriv, UDBG1, + "Allocate buffers for %d core dumps\n", num_dump_buffers); + if (num_dump_buffers == 0) + { + goto done; + } + + /* Root node */ + card->dump_buf = new_coredump_node(ospriv, NULL); + if (card->dump_buf == NULL) + { + goto fail; + } + prev = card->dump_buf; + newnode = card->dump_buf; + + /* Add each subsequent node at tail */ + for (i = 1; i < num_dump_buffers; i++) + { + newnode = new_coredump_node(ospriv, prev); + if (newnode == NULL) + { + goto fail; + } + prev = newnode; + } + + /* Link the first and last nodes to make the list circular */ + card->dump_buf->prev = newnode; + newnode->next = card->dump_buf; + + /* Set initial r/w access pointers */ + card->dump_next_write = card->dump_buf; + card->dump_cur_read = NULL; + + unifi_trace(ospriv, UDBG2, "Core dump configured (%d dumps max)\n", i); + +done: +#endif + func_exit(); + return CSR_RESULT_SUCCESS; + +#ifndef UNIFI_DISABLE_COREDUMP +fail: + /* Unwind what we allocated so far */ + unifi_error(ospriv, "Out of memory allocating core dump node %d\n", i); + unifi_coredump_free(card); + func_exit(); + return CSR_WIFI_HIP_RESULT_NO_MEMORY; +#endif +} /* unifi_coreump_init() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_coredump_free + * + * Free all memory dynamically allocated for core dump + * + * Arguments: + * card Pointer to card struct + * + * Returns: + * None + * + * Notes: + * --------------------------------------------------------------------------- + */ +void unifi_coredump_free(card_t *card) +{ + void *ospriv = card->ospriv; + coredump_buffer *node, *del_node; + CsrInt16 i = 0; + CsrInt16 j; + + func_enter(); + unifi_trace(ospriv, UDBG2, "Core dump de-configured\n"); + + if (card->dump_buf == NULL) + { + return; + } + + node = card->dump_buf; + do + { + /* Free payload zones */ + for (j = 0; j < HIP_CDUMP_NUM_ZONES; j++) + { + if (node->zone[j] != NULL) + { + CsrMemFree(node->zone[j]); + node->zone[j] = NULL; + } + } + + /* Detach */ + del_node = node; + node = node->next; + + /* Free header */ + CsrMemFree(del_node); + i++; + } while ((node != NULL) && (node != card->dump_buf)); + + unifi_trace(ospriv, UDBG3, "Freed %d coredump buffers\n", i); + + card->dump_buf = NULL; + card->dump_next_write = NULL; + card->dump_cur_read = NULL; + + func_exit(); +} /* unifi_coredump_free() */ + + diff --git a/drivers/staging/csr/csr_wifi_hip_packing.c b/drivers/staging/csr/csr_wifi_hip_packing.c new file mode 100644 index 0000000..4e98da9 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_packing.c @@ -0,0 +1,4804 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#include "csr_wifi_hip_signals.h" +#include "csr_wifi_hip_unifi.h" +#include "csr_wifi_hip_conversions.h" + + +/* + * --------------------------------------------------------------------------- + * get_packed_struct_size + * + * Examine a buffer containing a UniFi signal in wire-format. + * The first two bytes contain the signal ID, decode the signal ID and + * return the size, in bytes, of the signal, not including any bulk + * data. + * + * WARNING: This function is auto-generated, DO NOT EDIT! + * + * Arguments: + * buf Pointer to buffer to decode. + * + * Returns: + * 0 if the signal ID is not recognised (i.e. zero length), + * otherwise the number of bytes occupied by the signal in the buffer. + * This is useful for stepping past the signal to the object in the buffer. + * --------------------------------------------------------------------------- + */ +CsrInt32 get_packed_struct_size(const CsrUint8 *buf) +{ + CsrInt32 size = 0; + CsrUint16 sig_id; + + sig_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(buf); + + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + switch (sig_id) + { +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SETKEYS_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONFIG_QUEUE_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_BLACKOUT_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_BLACKOUT_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SM_START_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_AGGREGATION_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += 48 / 8; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TSPEC_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif + case CSR_DEBUG_WORD16_INDICATION_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; + case CSR_DEBUG_GENERIC_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; + case CSR_MA_PACKET_INDICATION_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT64; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; + case CSR_MLME_SET_TIM_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONNECTED_INDICATION_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += 48 / 8; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_RX_TRIGGER_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_TRIGGERED_GET_INDICATION_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SCAN_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT32; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DELETEKEYS_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_NEXT_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_CHANNEL_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_START_AGGREGATION_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += 48 / 8; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += 48 / 8; + break; +#endif + case CSR_DEBUG_GENERIC_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_LEAVE_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TRIGGERED_GET_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_RESET_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += 48 / 8; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SCAN_CANCEL_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_PACKET_FILTER_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT32; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONNECT_STATUS_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += 48 / 8; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_LEAVE_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONFIG_QUEUE_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TSPEC_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif + case CSR_MLME_SET_TIM_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MEASURE_INDICATION_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_BLACKOUT_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif + case CSR_DEBUG_GENERIC_INDICATION_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; + case CSR_MA_PACKET_CANCEL_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT32; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif + case CSR_MA_PACKET_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT32; + size += SIZEOF_UINT16; + size += 48 / 8; + size += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += 48 / 8; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_RX_TRIGGER_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif + case CSR_MA_VIF_AVAILABILITY_INDICATION_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_CANCEL_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += 48 / 8; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_BLACKOUT_ENDED_INDICATION_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_KEY_SEQUENCE_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += 48 / 8; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_CHANNEL_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += 48 / 8; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MEASURE_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TRIGGERED_GET_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += 48 / 8; + break; +#endif + case CSR_MA_VIF_AVAILABILITY_RESPONSE_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TEMPLATE_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_POWERMGT_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_PERIODIC_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_NEXT_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_AGGREGATION_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += 48 / 8; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_BLACKOUT_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT32; + size += SIZEOF_UINT32; + size += SIZEOF_UINT32; + size += 48 / 8; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DELETEKEYS_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += 48 / 8; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_RESET_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += 48 / 8; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT32; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SM_START_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += 48 / 8; + size += 48 / 8; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONNECT_STATUS_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_PERIODIC_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SETKEYS_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += 48 / 8; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += 32 / 8; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_POWERMGT_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif + case CSR_MA_PACKET_ERROR_INDICATION_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += 48 / 8; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_PERIODIC_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT32; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TSPEC_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT32; + size += SIZEOF_UINT32; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TSPEC_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SCAN_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif + case CSR_DEBUG_STRING_INDICATION_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TEMPLATE_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_BLOCKACK_ERROR_INDICATION_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += 48 / 8; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MEASURE_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_START_AGGREGATION_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += 48 / 8; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_MEASURE_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif + case CSR_MA_PACKET_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT32; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_PERIODIC_CONFIRM_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_MEASURE_REQUEST_ID: + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + size += SIZEOF_UINT16; + break; +#endif + default: + size = 0; + } + return size; +} /* get_packed_struct_size() */ + + +/* + * --------------------------------------------------------------------------- + * read_unpack_signal + * + * Unpack a wire-format signal into a host-native structure. + * This function handles any necessary conversions for endianness and + * places no restrictions on packing or alignment for the structure + * definition. + * + * WARNING: This function is auto-generated, DO NOT EDIT! + * + * Arguments: + * ptr Signal buffer to unpack. + * sig Pointer to destination structure to populate. + * + * Returns: + * CSR_RESULT_SUCCESS on success, + * CSR_WIFI_HIP_RESULT_INVALID_VALUE if the ID of signal was not recognised. + * --------------------------------------------------------------------------- + */ +CsrResult read_unpack_signal(const CsrUint8 *ptr, CSR_SIGNAL *sig) +{ + CsrInt32 index = 0; + + sig->SignalPrimitiveHeader.SignalId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + + sig->SignalPrimitiveHeader.ReceiverProcessId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + + sig->SignalPrimitiveHeader.SenderProcessId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + + switch (sig->SignalPrimitiveHeader.SignalId) + { +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID: + sig->u.MlmeSetPacketFilterConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetPacketFilterConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetPacketFilterConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetPacketFilterConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetPacketFilterConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetPacketFilterConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SETKEYS_CONFIRM_ID: + sig->u.MlmeSetkeysConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetkeysConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetkeysConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetkeysConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetkeysConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetkeysConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONFIG_QUEUE_CONFIRM_ID: + sig->u.MlmeConfigQueueConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConfigQueueConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConfigQueueConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConfigQueueConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConfigQueueConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID: + sig->u.MlmeAddAutonomousScanConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddAutonomousScanConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddAutonomousScanConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddAutonomousScanConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddAutonomousScanConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddAutonomousScanConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddAutonomousScanConfirm.AutonomousScanId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_BLACKOUT_CONFIRM_ID: + sig->u.MlmeAddBlackoutConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddBlackoutConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddBlackoutConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddBlackoutConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddBlackoutConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddBlackoutConfirm.BlackoutId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddBlackoutConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_BLACKOUT_REQUEST_ID: + sig->u.MlmeDelBlackoutRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelBlackoutRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelBlackoutRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelBlackoutRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelBlackoutRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelBlackoutRequest.BlackoutId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID: + sig->u.MlmeGetKeySequenceConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetKeySequenceConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetKeySequenceConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetKeySequenceConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetKeySequenceConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetKeySequenceConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[0] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[1] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[2] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[3] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[4] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[5] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[6] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[7] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SM_START_CONFIRM_ID: + sig->u.MlmeSmStartConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSmStartConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSmStartConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSmStartConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSmStartConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSmStartConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_AGGREGATION_CONFIRM_ID: + sig->u.MlmeStopAggregationConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStopAggregationConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStopAggregationConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStopAggregationConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStopAggregationConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(sig->u.MlmeStopAggregationConfirm.PeerQstaAddress.x, &ptr[index], 48 / 8); + index += 48 / 8; + sig->u.MlmeStopAggregationConfirm.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStopAggregationConfirm.Direction = (CSR_DIRECTION) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStopAggregationConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TSPEC_REQUEST_ID: + sig->u.MlmeDelTspecRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelTspecRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelTspecRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelTspecRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelTspecRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelTspecRequest.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelTspecRequest.Direction = (CSR_DIRECTION) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif + case CSR_DEBUG_WORD16_INDICATION_ID: + sig->u.DebugWord16Indication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugWord16Indication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugWord16Indication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugWord16Indication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugWord16Indication.DebugWords[0] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugWord16Indication.DebugWords[1] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugWord16Indication.DebugWords[2] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugWord16Indication.DebugWords[3] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugWord16Indication.DebugWords[4] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugWord16Indication.DebugWords[5] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugWord16Indication.DebugWords[6] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugWord16Indication.DebugWords[7] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugWord16Indication.DebugWords[8] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugWord16Indication.DebugWords[9] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugWord16Indication.DebugWords[10] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugWord16Indication.DebugWords[11] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugWord16Indication.DebugWords[12] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugWord16Indication.DebugWords[13] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugWord16Indication.DebugWords[14] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugWord16Indication.DebugWords[15] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; + case CSR_DEBUG_GENERIC_CONFIRM_ID: + sig->u.DebugGenericConfirm.DebugVariable.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericConfirm.DebugVariable.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericConfirm.DebugWords[0] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericConfirm.DebugWords[1] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericConfirm.DebugWords[2] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericConfirm.DebugWords[3] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericConfirm.DebugWords[4] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericConfirm.DebugWords[5] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericConfirm.DebugWords[6] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericConfirm.DebugWords[7] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; + case CSR_MA_PACKET_INDICATION_ID: + sig->u.MaPacketIndication.Data.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketIndication.Data.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(sig->u.MaPacketIndication.LocalTime.x, &ptr[index], 64 / 8); + index += 64 / 8; + sig->u.MaPacketIndication.Ifindex = (CSR_IFINTERFACE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketIndication.Channel = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketIndication.ReceptionStatus = (CSR_RECEPTION_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketIndication.Rssi = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketIndication.Snr = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketIndication.ReceivedRate = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; + case CSR_MLME_SET_TIM_REQUEST_ID: + sig->u.MlmeSetTimRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetTimRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetTimRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetTimRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetTimRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetTimRequest.AssociationId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetTimRequest.TimValue = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONNECTED_INDICATION_ID: + sig->u.MlmeConnectedIndication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConnectedIndication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConnectedIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConnectedIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConnectedIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConnectedIndication.ConnectionStatus = (CSR_CONNECTION_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(sig->u.MlmeConnectedIndication.PeerMacAddress.x, &ptr[index], 48 / 8); + index += 48 / 8; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_RX_TRIGGER_REQUEST_ID: + sig->u.MlmeDelRxTriggerRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelRxTriggerRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelRxTriggerRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelRxTriggerRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelRxTriggerRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelRxTriggerRequest.TriggerId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_TRIGGERED_GET_INDICATION_ID: + sig->u.MlmeTriggeredGetIndication.MibAttributeValue.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeTriggeredGetIndication.MibAttributeValue.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeTriggeredGetIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeTriggeredGetIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeTriggeredGetIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeTriggeredGetIndication.Status = (CSR_MIB_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeTriggeredGetIndication.ErrorIndex = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeTriggeredGetIndication.TriggeredId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SCAN_REQUEST_ID: + sig->u.MlmeScanRequest.ChannelList.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeScanRequest.ChannelList.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeScanRequest.InformationElements.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeScanRequest.InformationElements.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeScanRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeScanRequest.Ifindex = (CSR_IFINTERFACE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeScanRequest.ScanType = (CSR_SCAN_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeScanRequest.ProbeDelay = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT32; + sig->u.MlmeScanRequest.MinChannelTime = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeScanRequest.MaxChannelTime = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DELETEKEYS_CONFIRM_ID: + sig->u.MlmeDeletekeysConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDeletekeysConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDeletekeysConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDeletekeysConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDeletekeysConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDeletekeysConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_NEXT_REQUEST_ID: + sig->u.MlmeGetNextRequest.MibAttribute.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetNextRequest.MibAttribute.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetNextRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetNextRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_CHANNEL_CONFIRM_ID: + sig->u.MlmeSetChannelConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetChannelConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetChannelConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetChannelConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetChannelConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetChannelConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_START_AGGREGATION_REQUEST_ID: + sig->u.MlmeStartAggregationRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStartAggregationRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStartAggregationRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStartAggregationRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStartAggregationRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(sig->u.MlmeStartAggregationRequest.PeerQstaAddress.x, &ptr[index], 48 / 8); + index += 48 / 8; + sig->u.MlmeStartAggregationRequest.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStartAggregationRequest.Direction = (CSR_DIRECTION) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStartAggregationRequest.StartingSequenceNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStartAggregationRequest.BufferSize = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStartAggregationRequest.BlockAckTimeout = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_REQUEST_ID: + sig->u.MlmeHlSyncRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeHlSyncRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeHlSyncRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeHlSyncRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(sig->u.MlmeHlSyncRequest.GroupAddress.x, &ptr[index], 48 / 8); + index += 48 / 8; + break; +#endif + case CSR_DEBUG_GENERIC_REQUEST_ID: + sig->u.DebugGenericRequest.DebugVariable.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericRequest.DebugVariable.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericRequest.DebugWords[0] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericRequest.DebugWords[1] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericRequest.DebugWords[2] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericRequest.DebugWords[3] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericRequest.DebugWords[4] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericRequest.DebugWords[5] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericRequest.DebugWords[6] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericRequest.DebugWords[7] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_LEAVE_CONFIRM_ID: + sig->u.MlmeLeaveConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeLeaveConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeLeaveConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeLeaveConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeLeaveConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeLeaveConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TRIGGERED_GET_REQUEST_ID: + sig->u.MlmeDelTriggeredGetRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelTriggeredGetRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelTriggeredGetRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelTriggeredGetRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelTriggeredGetRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelTriggeredGetRequest.TriggeredId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST_ID: + sig->u.MlmeAddMulticastAddressRequest.Data.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddMulticastAddressRequest.Data.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddMulticastAddressRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddMulticastAddressRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddMulticastAddressRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddMulticastAddressRequest.NumberOfMulticastGroupAddresses = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_RESET_REQUEST_ID: + sig->u.MlmeResetRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeResetRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeResetRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeResetRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(sig->u.MlmeResetRequest.StaAddress.x, &ptr[index], 48 / 8); + index += 48 / 8; + sig->u.MlmeResetRequest.SetDefaultMib = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SCAN_CANCEL_REQUEST_ID: + sig->u.MlmeScanCancelRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeScanCancelRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeScanCancelRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeScanCancelRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeScanCancelRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID: + sig->u.MlmeAddTriggeredGetConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTriggeredGetConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTriggeredGetConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTriggeredGetConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTriggeredGetConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTriggeredGetConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTriggeredGetConfirm.TriggeredId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_PACKET_FILTER_REQUEST_ID: + sig->u.MlmeSetPacketFilterRequest.InformationElements.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetPacketFilterRequest.InformationElements.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetPacketFilterRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetPacketFilterRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetPacketFilterRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetPacketFilterRequest.PacketFilterMode = (CSR_PACKET_FILTER_MODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetPacketFilterRequest.ArpFilterAddress = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT32; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID: + sig->u.MlmeDelRxTriggerConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelRxTriggerConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelRxTriggerConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelRxTriggerConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelRxTriggerConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelRxTriggerConfirm.TriggerId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelRxTriggerConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONNECT_STATUS_REQUEST_ID: + sig->u.MlmeConnectStatusRequest.InformationElements.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConnectStatusRequest.InformationElements.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConnectStatusRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConnectStatusRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConnectStatusRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConnectStatusRequest.ConnectionStatus = (CSR_CONNECTION_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(sig->u.MlmeConnectStatusRequest.StaAddress.x, &ptr[index], 48 / 8); + index += 48 / 8; + sig->u.MlmeConnectStatusRequest.AssociationId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConnectStatusRequest.AssociationCapabilityInformation = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_LEAVE_REQUEST_ID: + sig->u.MlmeLeaveRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeLeaveRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeLeaveRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeLeaveRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeLeaveRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONFIG_QUEUE_REQUEST_ID: + sig->u.MlmeConfigQueueRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConfigQueueRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConfigQueueRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConfigQueueRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConfigQueueRequest.QueueIndex = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConfigQueueRequest.Aifs = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConfigQueueRequest.Cwmin = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConfigQueueRequest.Cwmax = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConfigQueueRequest.TxopLimit = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TSPEC_CONFIRM_ID: + sig->u.MlmeDelTspecConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelTspecConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelTspecConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelTspecConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelTspecConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelTspecConfirm.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelTspecConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif + case CSR_MLME_SET_TIM_CONFIRM_ID: + sig->u.MlmeSetTimConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetTimConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetTimConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetTimConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetTimConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetTimConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MEASURE_INDICATION_ID: + sig->u.MlmeMeasureIndication.MeasurementReportSet.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeMeasureIndication.MeasurementReportSet.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeMeasureIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeMeasureIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeMeasureIndication.DialogToken = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_BLACKOUT_CONFIRM_ID: + sig->u.MlmeDelBlackoutConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelBlackoutConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelBlackoutConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelBlackoutConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelBlackoutConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelBlackoutConfirm.BlackoutId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelBlackoutConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID: + sig->u.MlmeDelTriggeredGetConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelTriggeredGetConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelTriggeredGetConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelTriggeredGetConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelTriggeredGetConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelTriggeredGetConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelTriggeredGetConfirm.TriggeredId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif + case CSR_DEBUG_GENERIC_INDICATION_ID: + sig->u.DebugGenericIndication.DebugVariable.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericIndication.DebugVariable.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericIndication.DebugWords[0] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericIndication.DebugWords[1] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericIndication.DebugWords[2] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericIndication.DebugWords[3] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericIndication.DebugWords[4] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericIndication.DebugWords[5] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericIndication.DebugWords[6] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugGenericIndication.DebugWords[7] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; + case CSR_MA_PACKET_CANCEL_REQUEST_ID: + sig->u.MaPacketCancelRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketCancelRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketCancelRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketCancelRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketCancelRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketCancelRequest.HostTag = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT32; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID: + sig->u.MlmeModifyBssParameterConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeModifyBssParameterConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeModifyBssParameterConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeModifyBssParameterConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeModifyBssParameterConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeModifyBssParameterConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID: + sig->u.MlmePauseAutonomousScanConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePauseAutonomousScanConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePauseAutonomousScanConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePauseAutonomousScanConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePauseAutonomousScanConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePauseAutonomousScanConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePauseAutonomousScanConfirm.AutonomousScanId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif + case CSR_MA_PACKET_REQUEST_ID: + sig->u.MaPacketRequest.Data.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketRequest.Data.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketRequest.TransmitRate = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketRequest.HostTag = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT32; + sig->u.MaPacketRequest.Priority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(sig->u.MaPacketRequest.Ra.x, &ptr[index], 48 / 8); + index += 48 / 8; + sig->u.MaPacketRequest.TransmissionControl = (CSR_TRANSMISSION_CONTROL) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST_ID: + sig->u.MlmeModifyBssParameterRequest.Data.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeModifyBssParameterRequest.Data.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeModifyBssParameterRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeModifyBssParameterRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeModifyBssParameterRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeModifyBssParameterRequest.BeaconPeriod = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeModifyBssParameterRequest.DtimPeriod = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeModifyBssParameterRequest.CapabilityInformation = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(sig->u.MlmeModifyBssParameterRequest.Bssid.x, &ptr[index], 48 / 8); + index += 48 / 8; + sig->u.MlmeModifyBssParameterRequest.RtsThreshold = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_RX_TRIGGER_REQUEST_ID: + sig->u.MlmeAddRxTriggerRequest.InformationElements.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddRxTriggerRequest.InformationElements.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddRxTriggerRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddRxTriggerRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddRxTriggerRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddRxTriggerRequest.TriggerId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddRxTriggerRequest.Priority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif + case CSR_MA_VIF_AVAILABILITY_INDICATION_ID: + sig->u.MaVifAvailabilityIndication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaVifAvailabilityIndication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaVifAvailabilityIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaVifAvailabilityIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaVifAvailabilityIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaVifAvailabilityIndication.Multicast = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_CANCEL_REQUEST_ID: + sig->u.MlmeHlSyncCancelRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeHlSyncCancelRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeHlSyncCancelRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeHlSyncCancelRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(sig->u.MlmeHlSyncCancelRequest.GroupAddress.x, &ptr[index], 48 / 8); + index += 48 / 8; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST_ID: + sig->u.MlmeDelAutonomousScanRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelAutonomousScanRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelAutonomousScanRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelAutonomousScanRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelAutonomousScanRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelAutonomousScanRequest.AutonomousScanId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_BLACKOUT_ENDED_INDICATION_ID: + sig->u.MlmeBlackoutEndedIndication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeBlackoutEndedIndication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeBlackoutEndedIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeBlackoutEndedIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeBlackoutEndedIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeBlackoutEndedIndication.BlackoutId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION_ID: + sig->u.MlmeAutonomousScanDoneIndication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAutonomousScanDoneIndication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAutonomousScanDoneIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAutonomousScanDoneIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAutonomousScanDoneIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAutonomousScanDoneIndication.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAutonomousScanDoneIndication.AutonomousScanId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_KEY_SEQUENCE_REQUEST_ID: + sig->u.MlmeGetKeySequenceRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetKeySequenceRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetKeySequenceRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetKeySequenceRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetKeySequenceRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetKeySequenceRequest.KeyId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetKeySequenceRequest.KeyType = (CSR_KEY_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(sig->u.MlmeGetKeySequenceRequest.Address.x, &ptr[index], 48 / 8); + index += 48 / 8; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_CHANNEL_REQUEST_ID: + sig->u.MlmeSetChannelRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetChannelRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetChannelRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetChannelRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetChannelRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetChannelRequest.Ifindex = (CSR_IFINTERFACE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetChannelRequest.Channel = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(sig->u.MlmeSetChannelRequest.Address.x, &ptr[index], 48 / 8); + index += 48 / 8; + sig->u.MlmeSetChannelRequest.AvailabilityDuration = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetChannelRequest.AvailabilityInterval = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MEASURE_CONFIRM_ID: + sig->u.MlmeMeasureConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeMeasureConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeMeasureConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeMeasureConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeMeasureConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeMeasureConfirm.DialogToken = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TRIGGERED_GET_REQUEST_ID: + sig->u.MlmeAddTriggeredGetRequest.MibAttribute.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTriggeredGetRequest.MibAttribute.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTriggeredGetRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTriggeredGetRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTriggeredGetRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTriggeredGetRequest.TriggeredId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION_ID: + sig->u.MlmeAutonomousScanLossIndication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAutonomousScanLossIndication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAutonomousScanLossIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAutonomousScanLossIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAutonomousScanLossIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(sig->u.MlmeAutonomousScanLossIndication.Bssid.x, &ptr[index], 48 / 8); + index += 48 / 8; + break; +#endif + case CSR_MA_VIF_AVAILABILITY_RESPONSE_ID: + sig->u.MaVifAvailabilityResponse.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaVifAvailabilityResponse.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaVifAvailabilityResponse.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaVifAvailabilityResponse.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaVifAvailabilityResponse.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaVifAvailabilityResponse.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TEMPLATE_REQUEST_ID: + sig->u.MlmeAddTemplateRequest.Data1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTemplateRequest.Data1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTemplateRequest.Data2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTemplateRequest.Data2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTemplateRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTemplateRequest.FrameType = (CSR_FRAME_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTemplateRequest.MinTransmitRate = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_POWERMGT_CONFIRM_ID: + sig->u.MlmePowermgtConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePowermgtConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePowermgtConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePowermgtConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePowermgtConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePowermgtConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_PERIODIC_CONFIRM_ID: + sig->u.MlmeAddPeriodicConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddPeriodicConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddPeriodicConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddPeriodicConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddPeriodicConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddPeriodicConfirm.PeriodicId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddPeriodicConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_CONFIRM_ID: + sig->u.MlmeGetConfirm.MibAttributeValue.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetConfirm.MibAttributeValue.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetConfirm.Status = (CSR_MIB_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetConfirm.ErrorIndex = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_NEXT_CONFIRM_ID: + sig->u.MlmeGetNextConfirm.MibAttributeValue.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetNextConfirm.MibAttributeValue.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetNextConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetNextConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetNextConfirm.Status = (CSR_MIB_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetNextConfirm.ErrorIndex = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_AGGREGATION_REQUEST_ID: + sig->u.MlmeStopAggregationRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStopAggregationRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStopAggregationRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStopAggregationRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStopAggregationRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(sig->u.MlmeStopAggregationRequest.PeerQstaAddress.x, &ptr[index], 48 / 8); + index += 48 / 8; + sig->u.MlmeStopAggregationRequest.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStopAggregationRequest.Direction = (CSR_DIRECTION) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID: + sig->u.MlmeAddRxTriggerConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddRxTriggerConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddRxTriggerConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddRxTriggerConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddRxTriggerConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddRxTriggerConfirm.TriggerId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddRxTriggerConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_BLACKOUT_REQUEST_ID: + sig->u.MlmeAddBlackoutRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddBlackoutRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddBlackoutRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddBlackoutRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddBlackoutRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddBlackoutRequest.BlackoutId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddBlackoutRequest.BlackoutType = (CSR_BLACKOUT_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddBlackoutRequest.BlackoutSource = (CSR_BLACKOUT_SOURCE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddBlackoutRequest.BlackoutStartReference = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT32; + sig->u.MlmeAddBlackoutRequest.BlackoutPeriod = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT32; + sig->u.MlmeAddBlackoutRequest.BlackoutDuration = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT32; + CsrMemCpy(sig->u.MlmeAddBlackoutRequest.PeerStaAddress.x, &ptr[index], 48 / 8); + index += 48 / 8; + sig->u.MlmeAddBlackoutRequest.BlackoutCount = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DELETEKEYS_REQUEST_ID: + sig->u.MlmeDeletekeysRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDeletekeysRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDeletekeysRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDeletekeysRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDeletekeysRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDeletekeysRequest.KeyId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDeletekeysRequest.KeyType = (CSR_KEY_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(sig->u.MlmeDeletekeysRequest.Address.x, &ptr[index], 48 / 8); + index += 48 / 8; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_RESET_CONFIRM_ID: + sig->u.MlmeResetConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeResetConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeResetConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeResetConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeResetConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_CONFIRM_ID: + sig->u.MlmeHlSyncConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeHlSyncConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeHlSyncConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeHlSyncConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(sig->u.MlmeHlSyncConfirm.GroupAddress.x, &ptr[index], 48 / 8); + index += 48 / 8; + sig->u.MlmeHlSyncConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST_ID: + sig->u.MlmeAddAutonomousScanRequest.ChannelList.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddAutonomousScanRequest.ChannelList.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddAutonomousScanRequest.InformationElements.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddAutonomousScanRequest.InformationElements.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddAutonomousScanRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddAutonomousScanRequest.AutonomousScanId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddAutonomousScanRequest.Ifindex = (CSR_IFINTERFACE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddAutonomousScanRequest.ChannelStartingFactor = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddAutonomousScanRequest.ScanType = (CSR_SCAN_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddAutonomousScanRequest.ProbeDelay = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT32; + sig->u.MlmeAddAutonomousScanRequest.MinChannelTime = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddAutonomousScanRequest.MaxChannelTime = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_REQUEST_ID: + sig->u.MlmeSetRequest.MibAttributeValue.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetRequest.MibAttributeValue.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SM_START_REQUEST_ID: + sig->u.MlmeSmStartRequest.Beacon.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSmStartRequest.Beacon.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSmStartRequest.BssParameters.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSmStartRequest.BssParameters.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSmStartRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSmStartRequest.Ifindex = (CSR_IFINTERFACE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSmStartRequest.Channel = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(sig->u.MlmeSmStartRequest.InterfaceAddress.x, &ptr[index], 48 / 8); + index += 48 / 8; + CsrMemCpy(sig->u.MlmeSmStartRequest.Bssid.x, &ptr[index], 48 / 8); + index += 48 / 8; + sig->u.MlmeSmStartRequest.BeaconPeriod = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSmStartRequest.DtimPeriod = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSmStartRequest.CapabilityInformation = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONNECT_STATUS_CONFIRM_ID: + sig->u.MlmeConnectStatusConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConnectStatusConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConnectStatusConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConnectStatusConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConnectStatusConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeConnectStatusConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID: + sig->u.MlmeDelAutonomousScanConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelAutonomousScanConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelAutonomousScanConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelAutonomousScanConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelAutonomousScanConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelAutonomousScanConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelAutonomousScanConfirm.AutonomousScanId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_PERIODIC_REQUEST_ID: + sig->u.MlmeDelPeriodicRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelPeriodicRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelPeriodicRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelPeriodicRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelPeriodicRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelPeriodicRequest.PeriodicId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SETKEYS_REQUEST_ID: + sig->u.MlmeSetkeysRequest.Key.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetkeysRequest.Key.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetkeysRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetkeysRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetkeysRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetkeysRequest.Length = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetkeysRequest.KeyId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetkeysRequest.KeyType = (CSR_KEY_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(sig->u.MlmeSetkeysRequest.Address.x, &ptr[index], 48 / 8); + index += 48 / 8; + sig->u.MlmeSetkeysRequest.SequenceNumber[0] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetkeysRequest.SequenceNumber[1] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetkeysRequest.SequenceNumber[2] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetkeysRequest.SequenceNumber[3] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetkeysRequest.SequenceNumber[4] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetkeysRequest.SequenceNumber[5] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetkeysRequest.SequenceNumber[6] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetkeysRequest.SequenceNumber[7] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(&sig->u.MlmeSetkeysRequest.CipherSuiteSelector, &ptr[index], 32 / 8); + index += 32 / 8; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST_ID: + sig->u.MlmePauseAutonomousScanRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePauseAutonomousScanRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePauseAutonomousScanRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePauseAutonomousScanRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePauseAutonomousScanRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePauseAutonomousScanRequest.AutonomousScanId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePauseAutonomousScanRequest.Pause = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_REQUEST_ID: + sig->u.MlmeGetRequest.MibAttribute.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetRequest.MibAttribute.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeGetRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_POWERMGT_REQUEST_ID: + sig->u.MlmePowermgtRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePowermgtRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePowermgtRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePowermgtRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePowermgtRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePowermgtRequest.PowerManagementMode = (CSR_POWER_MANAGEMENT_MODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePowermgtRequest.ReceiveDtims = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePowermgtRequest.ListenInterval = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmePowermgtRequest.TrafficWindow = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif + case CSR_MA_PACKET_ERROR_INDICATION_ID: + sig->u.MaPacketErrorIndication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketErrorIndication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketErrorIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketErrorIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketErrorIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(sig->u.MaPacketErrorIndication.PeerQstaAddress.x, &ptr[index], 48 / 8); + index += 48 / 8; + sig->u.MaPacketErrorIndication.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketErrorIndication.SequenceNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_PERIODIC_REQUEST_ID: + sig->u.MlmeAddPeriodicRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddPeriodicRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddPeriodicRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddPeriodicRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddPeriodicRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddPeriodicRequest.PeriodicId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddPeriodicRequest.MaximumLatency = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT32; + sig->u.MlmeAddPeriodicRequest.PeriodicSchedulingMode = (CSR_PERIODIC_SCHEDULING_MODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddPeriodicRequest.WakeHost = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddPeriodicRequest.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TSPEC_REQUEST_ID: + sig->u.MlmeAddTspecRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTspecRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTspecRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTspecRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTspecRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTspecRequest.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTspecRequest.Direction = (CSR_DIRECTION) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTspecRequest.PsScheme = (CSR_PS_SCHEME) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTspecRequest.MediumTime = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTspecRequest.ServiceStartTime = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT32; + sig->u.MlmeAddTspecRequest.ServiceInterval = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT32; + sig->u.MlmeAddTspecRequest.MinimumDataRate = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID: + sig->u.MlmeAddMulticastAddressConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddMulticastAddressConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddMulticastAddressConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddMulticastAddressConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddMulticastAddressConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddMulticastAddressConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TSPEC_CONFIRM_ID: + sig->u.MlmeAddTspecConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTspecConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTspecConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTspecConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTspecConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTspecConfirm.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTspecConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID: + sig->u.MlmeHlSyncCancelConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeHlSyncCancelConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeHlSyncCancelConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeHlSyncCancelConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeHlSyncCancelConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SCAN_CONFIRM_ID: + sig->u.MlmeScanConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeScanConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeScanConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeScanConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeScanConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeScanConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif + case CSR_DEBUG_STRING_INDICATION_ID: + sig->u.DebugStringIndication.DebugMessage.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugStringIndication.DebugMessage.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugStringIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.DebugStringIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TEMPLATE_CONFIRM_ID: + sig->u.MlmeAddTemplateConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTemplateConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTemplateConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTemplateConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTemplateConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTemplateConfirm.FrameType = (CSR_FRAME_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeAddTemplateConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_BLOCKACK_ERROR_INDICATION_ID: + sig->u.MlmeBlockackErrorIndication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeBlockackErrorIndication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeBlockackErrorIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeBlockackErrorIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeBlockackErrorIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeBlockackErrorIndication.ResultCode = (CSR_REASON_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(sig->u.MlmeBlockackErrorIndication.PeerQstaAddress.x, &ptr[index], 48 / 8); + index += 48 / 8; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_CONFIRM_ID: + sig->u.MlmeSetConfirm.MibAttributeValue.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetConfirm.MibAttributeValue.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetConfirm.Status = (CSR_MIB_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeSetConfirm.ErrorIndex = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MEASURE_REQUEST_ID: + sig->u.MlmeMeasureRequest.MeasurementRequestSet.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeMeasureRequest.MeasurementRequestSet.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeMeasureRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeMeasureRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeMeasureRequest.DialogToken = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_START_AGGREGATION_CONFIRM_ID: + sig->u.MlmeStartAggregationConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStartAggregationConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStartAggregationConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStartAggregationConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStartAggregationConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(sig->u.MlmeStartAggregationConfirm.PeerQstaAddress.x, &ptr[index], 48 / 8); + index += 48 / 8; + sig->u.MlmeStartAggregationConfirm.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStartAggregationConfirm.Direction = (CSR_DIRECTION) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStartAggregationConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStartAggregationConfirm.SequenceNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_MEASURE_CONFIRM_ID: + sig->u.MlmeStopMeasureConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStopMeasureConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStopMeasureConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStopMeasureConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStopMeasureConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStopMeasureConfirm.DialogToken = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif + case CSR_MA_PACKET_CONFIRM_ID: + sig->u.MaPacketConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketConfirm.TransmissionStatus = (CSR_TRANSMISSION_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketConfirm.RetryCount = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketConfirm.Rate = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MaPacketConfirm.HostTag = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT32; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_PERIODIC_CONFIRM_ID: + sig->u.MlmeDelPeriodicConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelPeriodicConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelPeriodicConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelPeriodicConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelPeriodicConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelPeriodicConfirm.PeriodicId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeDelPeriodicConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_MEASURE_REQUEST_ID: + sig->u.MlmeStopMeasureRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStopMeasureRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStopMeasureRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStopMeasureRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + sig->u.MlmeStopMeasureRequest.DialogToken = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); + index += SIZEOF_UINT16; + break; +#endif + + default: + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + return CSR_RESULT_SUCCESS; +} /* read_unpack_signal() */ + + +/* + * --------------------------------------------------------------------------- + * write_pack + * + * Convert a signal structure, in host-native format, to the + * little-endian wire format specified in the UniFi Host Interface + * Protocol Specification. + * + * WARNING: This function is auto-generated, DO NOT EDIT! + * + * Arguments: + * sig Pointer to signal structure to pack. + * ptr Destination buffer to pack into. + * sig_len Returns the length of the packed signal, i.e. the + * number of bytes written to ptr. + * + * Returns: + * CSR_RESULT_SUCCESS on success, + * CSR_WIFI_HIP_RESULT_INVALID_VALUE if the ID of signal was not recognised. + * --------------------------------------------------------------------------- + */ +CsrResult write_pack(const CSR_SIGNAL *sig, CsrUint8 *ptr, CsrUint16 *sig_len) +{ + CsrInt16 index = 0; + + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->SignalPrimitiveHeader.SignalId, ptr + index); + index += SIZEOF_UINT16; + + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->SignalPrimitiveHeader.ReceiverProcessId, ptr + index); + index += SIZEOF_UINT16; + + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->SignalPrimitiveHeader.SenderProcessId, ptr + index); + index += SIZEOF_UINT16; + + switch (sig->SignalPrimitiveHeader.SignalId) + { +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SETKEYS_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONFIG_QUEUE_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanConfirm.AutonomousScanId, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_BLACKOUT_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutConfirm.BlackoutId, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_BLACKOUT_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutRequest.BlackoutId, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[0], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[1], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[2], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[3], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[4], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[5], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[6], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[7], ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SM_START_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_AGGREGATION_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(ptr + index, sig->u.MlmeStopAggregationConfirm.PeerQstaAddress.x, 48 / 8); + index += 48 / 8; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.UserPriority, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.Direction, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TSPEC_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecRequest.UserPriority, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecRequest.Direction, ptr + index); + index += SIZEOF_UINT16; + break; +#endif + case CSR_DEBUG_WORD16_INDICATION_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[0], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[1], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[2], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[3], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[4], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[5], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[6], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[7], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[8], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[9], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[10], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[11], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[12], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[13], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[14], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[15], ptr + index); + index += SIZEOF_UINT16; + break; + case CSR_DEBUG_GENERIC_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugVariable.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugVariable.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[0], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[1], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[2], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[3], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[4], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[5], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[6], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[7], ptr + index); + index += SIZEOF_UINT16; + break; + case CSR_MA_PACKET_INDICATION_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Data.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Data.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(ptr + index, sig->u.MaPacketIndication.LocalTime.x, 64 / 8); + index += 64 / 8; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Ifindex, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Channel, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.ReceptionStatus, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Rssi, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Snr, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.ReceivedRate, ptr + index); + index += SIZEOF_UINT16; + break; + case CSR_MLME_SET_TIM_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimRequest.AssociationId, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimRequest.TimValue, ptr + index); + index += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONNECTED_INDICATION_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectedIndication.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectedIndication.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectedIndication.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectedIndication.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectedIndication.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectedIndication.ConnectionStatus, ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(ptr + index, sig->u.MlmeConnectedIndication.PeerMacAddress.x, 48 / 8); + index += 48 / 8; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_RX_TRIGGER_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerRequest.TriggerId, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_TRIGGERED_GET_INDICATION_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.MibAttributeValue.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.MibAttributeValue.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.Status, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.ErrorIndex, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.TriggeredId, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SCAN_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.ChannelList.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.ChannelList.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.InformationElements.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.InformationElements.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.Ifindex, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.ScanType, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.ProbeDelay, ptr + index); + index += SIZEOF_UINT32; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.MinChannelTime, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.MaxChannelTime, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DELETEKEYS_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_NEXT_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextRequest.MibAttribute.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextRequest.MibAttribute.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_CHANNEL_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_START_AGGREGATION_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(ptr + index, sig->u.MlmeStartAggregationRequest.PeerQstaAddress.x, 48 / 8); + index += 48 / 8; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.UserPriority, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.Direction, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.StartingSequenceNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.BufferSize, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.BlockAckTimeout, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(ptr + index, sig->u.MlmeHlSyncRequest.GroupAddress.x, 48 / 8); + index += 48 / 8; + break; +#endif + case CSR_DEBUG_GENERIC_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugVariable.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugVariable.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[0], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[1], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[2], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[3], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[4], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[5], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[6], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[7], ptr + index); + index += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_LEAVE_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TRIGGERED_GET_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetRequest.TriggeredId, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressRequest.Data.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressRequest.Data.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressRequest.NumberOfMulticastGroupAddresses, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_RESET_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(ptr + index, sig->u.MlmeResetRequest.StaAddress.x, 48 / 8); + index += 48 / 8; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetRequest.SetDefaultMib, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SCAN_CANCEL_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanCancelRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanCancelRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanCancelRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanCancelRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanCancelRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetConfirm.TriggeredId, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_PACKET_FILTER_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterRequest.InformationElements.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterRequest.InformationElements.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterRequest.PacketFilterMode, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterRequest.ArpFilterAddress, ptr + index); + index += SIZEOF_UINT32; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerConfirm.TriggerId, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONNECT_STATUS_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.InformationElements.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.InformationElements.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.ConnectionStatus, ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(ptr + index, sig->u.MlmeConnectStatusRequest.StaAddress.x, 48 / 8); + index += 48 / 8; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.AssociationId, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.AssociationCapabilityInformation, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_LEAVE_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONFIG_QUEUE_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.QueueIndex, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.Aifs, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.Cwmin, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.Cwmax, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.TxopLimit, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TSPEC_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecConfirm.UserPriority, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif + case CSR_MLME_SET_TIM_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MEASURE_INDICATION_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureIndication.MeasurementReportSet.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureIndication.MeasurementReportSet.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureIndication.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureIndication.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureIndication.DialogToken, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_BLACKOUT_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutConfirm.BlackoutId, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetConfirm.TriggeredId, ptr + index); + index += SIZEOF_UINT16; + break; +#endif + case CSR_DEBUG_GENERIC_INDICATION_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugVariable.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugVariable.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[0], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[1], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[2], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[3], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[4], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[5], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[6], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[7], ptr + index); + index += SIZEOF_UINT16; + break; + case CSR_MA_PACKET_CANCEL_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketCancelRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketCancelRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketCancelRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketCancelRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketCancelRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MaPacketCancelRequest.HostTag, ptr + index); + index += SIZEOF_UINT32; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanConfirm.AutonomousScanId, ptr + index); + index += SIZEOF_UINT16; + break; +#endif + case CSR_MA_PACKET_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.Data.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.Data.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.TransmitRate, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.HostTag, ptr + index); + index += SIZEOF_UINT32; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.Priority, ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(ptr + index, sig->u.MaPacketRequest.Ra.x, 48 / 8); + index += 48 / 8; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.TransmissionControl, ptr + index); + index += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.Data.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.Data.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.BeaconPeriod, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.DtimPeriod, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.CapabilityInformation, ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(ptr + index, sig->u.MlmeModifyBssParameterRequest.Bssid.x, 48 / 8); + index += 48 / 8; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.RtsThreshold, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_RX_TRIGGER_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerRequest.InformationElements.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerRequest.InformationElements.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerRequest.TriggerId, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerRequest.Priority, ptr + index); + index += SIZEOF_UINT16; + break; +#endif + case CSR_MA_VIF_AVAILABILITY_INDICATION_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityIndication.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityIndication.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityIndication.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityIndication.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityIndication.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityIndication.Multicast, ptr + index); + index += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_CANCEL_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(ptr + index, sig->u.MlmeHlSyncCancelRequest.GroupAddress.x, 48 / 8); + index += 48 / 8; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanRequest.AutonomousScanId, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_BLACKOUT_ENDED_INDICATION_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlackoutEndedIndication.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlackoutEndedIndication.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlackoutEndedIndication.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlackoutEndedIndication.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlackoutEndedIndication.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlackoutEndedIndication.BlackoutId, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanDoneIndication.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanDoneIndication.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanDoneIndication.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanDoneIndication.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanDoneIndication.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanDoneIndication.ResultCode, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanDoneIndication.AutonomousScanId, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_KEY_SEQUENCE_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceRequest.KeyId, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceRequest.KeyType, ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(ptr + index, sig->u.MlmeGetKeySequenceRequest.Address.x, 48 / 8); + index += 48 / 8; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_CHANNEL_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.Ifindex, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.Channel, ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(ptr + index, sig->u.MlmeSetChannelRequest.Address.x, 48 / 8); + index += 48 / 8; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.AvailabilityDuration, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.AvailabilityInterval, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MEASURE_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureConfirm.DialogToken, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TRIGGERED_GET_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetRequest.MibAttribute.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetRequest.MibAttribute.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetRequest.TriggeredId, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanLossIndication.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanLossIndication.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanLossIndication.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanLossIndication.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanLossIndication.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(ptr + index, sig->u.MlmeAutonomousScanLossIndication.Bssid.x, 48 / 8); + index += 48 / 8; + break; +#endif + case CSR_MA_VIF_AVAILABILITY_RESPONSE_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityResponse.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityResponse.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityResponse.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityResponse.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityResponse.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityResponse.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TEMPLATE_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateRequest.Data1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateRequest.Data1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateRequest.Data2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateRequest.Data2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateRequest.FrameType, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateRequest.MinTransmitRate, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_POWERMGT_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_PERIODIC_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicConfirm.PeriodicId, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetConfirm.MibAttributeValue.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetConfirm.MibAttributeValue.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetConfirm.Status, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetConfirm.ErrorIndex, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_NEXT_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextConfirm.MibAttributeValue.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextConfirm.MibAttributeValue.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextConfirm.Status, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextConfirm.ErrorIndex, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_AGGREGATION_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(ptr + index, sig->u.MlmeStopAggregationRequest.PeerQstaAddress.x, 48 / 8); + index += 48 / 8; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationRequest.UserPriority, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationRequest.Direction, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerConfirm.TriggerId, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_BLACKOUT_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.BlackoutId, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.BlackoutType, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.BlackoutSource, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.BlackoutStartReference, ptr + index); + index += SIZEOF_UINT32; + CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.BlackoutPeriod, ptr + index); + index += SIZEOF_UINT32; + CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.BlackoutDuration, ptr + index); + index += SIZEOF_UINT32; + CsrMemCpy(ptr + index, sig->u.MlmeAddBlackoutRequest.PeerStaAddress.x, 48 / 8); + index += 48 / 8; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.BlackoutCount, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DELETEKEYS_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysRequest.KeyId, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysRequest.KeyType, ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(ptr + index, sig->u.MlmeDeletekeysRequest.Address.x, 48 / 8); + index += 48 / 8; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_RESET_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(ptr + index, sig->u.MlmeHlSyncConfirm.GroupAddress.x, 48 / 8); + index += 48 / 8; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.ChannelList.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.ChannelList.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.InformationElements.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.InformationElements.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.AutonomousScanId, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.Ifindex, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.ChannelStartingFactor, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.ScanType, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.ProbeDelay, ptr + index); + index += SIZEOF_UINT32; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.MinChannelTime, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.MaxChannelTime, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetRequest.MibAttributeValue.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetRequest.MibAttributeValue.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SM_START_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.Beacon.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.Beacon.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.BssParameters.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.BssParameters.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.Ifindex, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.Channel, ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(ptr + index, sig->u.MlmeSmStartRequest.InterfaceAddress.x, 48 / 8); + index += 48 / 8; + CsrMemCpy(ptr + index, sig->u.MlmeSmStartRequest.Bssid.x, 48 / 8); + index += 48 / 8; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.BeaconPeriod, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.DtimPeriod, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.CapabilityInformation, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONNECT_STATUS_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanConfirm.AutonomousScanId, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_PERIODIC_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicRequest.PeriodicId, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SETKEYS_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.Key.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.Key.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.Length, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.KeyId, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.KeyType, ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(ptr + index, sig->u.MlmeSetkeysRequest.Address.x, 48 / 8); + index += 48 / 8; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[0], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[1], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[2], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[3], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[4], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[5], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[6], ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[7], ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(ptr + index, &sig->u.MlmeSetkeysRequest.CipherSuiteSelector, 32 / 8); + index += 32 / 8; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanRequest.AutonomousScanId, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanRequest.Pause, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetRequest.MibAttribute.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetRequest.MibAttribute.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_POWERMGT_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.PowerManagementMode, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.ReceiveDtims, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.ListenInterval, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.TrafficWindow, ptr + index); + index += SIZEOF_UINT16; + break; +#endif + case CSR_MA_PACKET_ERROR_INDICATION_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketErrorIndication.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketErrorIndication.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketErrorIndication.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketErrorIndication.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketErrorIndication.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(ptr + index, sig->u.MaPacketErrorIndication.PeerQstaAddress.x, 48 / 8); + index += 48 / 8; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketErrorIndication.UserPriority, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketErrorIndication.SequenceNumber, ptr + index); + index += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_PERIODIC_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.PeriodicId, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.MaximumLatency, ptr + index); + index += SIZEOF_UINT32; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.PeriodicSchedulingMode, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.WakeHost, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.UserPriority, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TSPEC_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.UserPriority, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.Direction, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.PsScheme, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.MediumTime, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.ServiceStartTime, ptr + index); + index += SIZEOF_UINT32; + CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.ServiceInterval, ptr + index); + index += SIZEOF_UINT32; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.MinimumDataRate, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TSPEC_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecConfirm.UserPriority, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SCAN_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif + case CSR_DEBUG_STRING_INDICATION_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugStringIndication.DebugMessage.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugStringIndication.DebugMessage.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugStringIndication.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugStringIndication.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TEMPLATE_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateConfirm.FrameType, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_BLOCKACK_ERROR_INDICATION_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlockackErrorIndication.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlockackErrorIndication.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlockackErrorIndication.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlockackErrorIndication.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlockackErrorIndication.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlockackErrorIndication.ResultCode, ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(ptr + index, sig->u.MlmeBlockackErrorIndication.PeerQstaAddress.x, 48 / 8); + index += 48 / 8; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetConfirm.MibAttributeValue.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetConfirm.MibAttributeValue.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetConfirm.Status, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetConfirm.ErrorIndex, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MEASURE_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureRequest.MeasurementRequestSet.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureRequest.MeasurementRequestSet.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureRequest.DialogToken, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_START_AGGREGATION_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CsrMemCpy(ptr + index, sig->u.MlmeStartAggregationConfirm.PeerQstaAddress.x, 48 / 8); + index += 48 / 8; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.UserPriority, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.Direction, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.SequenceNumber, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_MEASURE_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureConfirm.DialogToken, ptr + index); + index += SIZEOF_UINT16; + break; +#endif + case CSR_MA_PACKET_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.TransmissionStatus, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.RetryCount, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.Rate, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.HostTag, ptr + index); + index += SIZEOF_UINT32; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_PERIODIC_CONFIRM_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicConfirm.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicConfirm.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicConfirm.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicConfirm.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicConfirm.VirtualInterfaceIdentifier, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicConfirm.PeriodicId, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicConfirm.ResultCode, ptr + index); + index += SIZEOF_UINT16; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_MEASURE_REQUEST_ID: + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureRequest.Dummydataref1.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureRequest.Dummydataref1.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureRequest.Dummydataref2.SlotNumber, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureRequest.Dummydataref2.DataLength, ptr + index); + index += SIZEOF_UINT16; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureRequest.DialogToken, ptr + index); + index += SIZEOF_UINT16; + break; +#endif + + default: + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + *sig_len = index; + + return CSR_RESULT_SUCCESS; +} /* write_pack() */ + + diff --git a/drivers/staging/csr/csr_wifi_hip_send.c b/drivers/staging/csr/csr_wifi_hip_send.c new file mode 100644 index 0000000..624f3bb --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_send.c @@ -0,0 +1,422 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* + * *************************************************************************** + * + * FILE: csr_wifi_hip_send.c + * + * PURPOSE: + * Code for adding a signal request to the from-host queue. + * When the driver bottom-half is run, it will take requests from the + * queue and pass them to the UniFi. + * + * *************************************************************************** + */ +#include "csr_wifi_hip_unifi.h" +#include "csr_wifi_hip_conversions.h" +#include "csr_wifi_hip_sigs.h" +#include "csr_wifi_hip_card.h" + +unifi_TrafficQueue unifi_frame_priority_to_queue(CSR_PRIORITY priority) +{ + switch (priority) + { + case CSR_QOS_UP0: + case CSR_QOS_UP3: + return UNIFI_TRAFFIC_Q_BE; + case CSR_QOS_UP1: + case CSR_QOS_UP2: + return UNIFI_TRAFFIC_Q_BK; + case CSR_QOS_UP4: + case CSR_QOS_UP5: + return UNIFI_TRAFFIC_Q_VI; + case CSR_QOS_UP6: + case CSR_QOS_UP7: + case CSR_MANAGEMENT: + return UNIFI_TRAFFIC_Q_VO; + default: + return UNIFI_TRAFFIC_Q_BE; + } +} + + +CSR_PRIORITY unifi_get_default_downgrade_priority(unifi_TrafficQueue queue) +{ + switch (queue) + { + case UNIFI_TRAFFIC_Q_BE: + return CSR_QOS_UP0; + case UNIFI_TRAFFIC_Q_BK: + return CSR_QOS_UP1; + case UNIFI_TRAFFIC_Q_VI: + return CSR_QOS_UP5; + case UNIFI_TRAFFIC_Q_VO: + return CSR_QOS_UP6; + default: + return CSR_QOS_UP0; + } +} + + +/* + * --------------------------------------------------------------------------- + * send_signal + * + * This function queues a signal for sending to UniFi. It first checks + * that there is space on the fh_signal_queue for another entry, then + * claims any bulk data slots required and copies data into them. Then + * increments the fh_signal_queue write count. + * + * The fh_signal_queue is later processed by the driver bottom half + * (in unifi_bh()). + * + * This function call unifi_pause_xmit() to pause the flow of data plane + * packets when: + * - the fh_signal_queue ring buffer is full + * - there are less than UNIFI_MAX_DATA_REFERENCES (2) bulk data + * slots available. + * + * Arguments: + * card Pointer to card context structure + * sigptr Pointer to the signal to write to UniFi. + * siglen Number of bytes pointer to by sigptr. + * bulkdata Array of pointers to an associated bulk data. + * sigq To which from-host queue to add the signal. + * + * Returns: + * CSR_RESULT_SUCCESS on success + * CSR_WIFI_HIP_RESULT_NO_SPACE if there were insufficient data slots or + * no free signal queue entry + * + * Notes: + * Calls unifi_pause_xmit() when the last slots are used. + * --------------------------------------------------------------------------- + */ +static CsrResult send_signal(card_t *card, const CsrUint8 *sigptr, CsrUint32 siglen, + const bulk_data_param_t *bulkdata, + q_t *sigq, CsrUint32 priority_q, CsrUint32 run_bh) +{ + CsrUint16 i, data_slot_size; + card_signal_t *csptr; + CsrInt16 qe; + CsrResult r; + CsrInt16 debug_print = 0; + + data_slot_size = CardGetDataSlotSize(card); + + /* Check that the fh_data_queue has a free slot */ + if (!CSR_WIFI_HIP_Q_SLOTS_FREE(sigq)) + { + unifi_trace(card->ospriv, UDBG3, "send_signal: %s full\n", sigq->name); + + return CSR_WIFI_HIP_RESULT_NO_SPACE; + } + + /* + * Now add the signal to the From Host signal queue + */ + /* Get next slot on queue */ + qe = CSR_WIFI_HIP_Q_NEXT_W_SLOT(sigq); + csptr = CSR_WIFI_HIP_Q_SLOT_DATA(sigq, qe); + + /* Make up the card_signal struct */ + csptr->signal_length = (CsrUint16)siglen; + CsrMemCpy((void *)csptr->sigbuf, (void *)sigptr, siglen); + + for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; ++i) + { + if ((bulkdata != NULL) && (bulkdata->d[i].data_length != 0)) + { + CsrUint32 datalen = bulkdata->d[i].data_length; + + /* Make sure data will fit in a bulk data slot */ + if (bulkdata->d[i].os_data_ptr == NULL) + { + unifi_error(card->ospriv, "send_signal - NULL bulkdata[%d]\n", i); + debug_print++; + csptr->bulkdata[i].data_length = 0; + } + else + { + if (datalen > data_slot_size) + { + unifi_error(card->ospriv, + "send_signal - Invalid data length %u (@%p), " + "truncating\n", + datalen, bulkdata->d[i].os_data_ptr); + datalen = data_slot_size; + debug_print++; + } + /* Store the bulk data info in the soft queue. */ + csptr->bulkdata[i].os_data_ptr = (CsrUint8 *)bulkdata->d[i].os_data_ptr; + csptr->bulkdata[i].os_net_buf_ptr = (CsrUint8 *)bulkdata->d[i].os_net_buf_ptr; + csptr->bulkdata[i].net_buf_length = bulkdata->d[i].net_buf_length; + csptr->bulkdata[i].data_length = datalen; + } + } + else + { + UNIFI_INIT_BULK_DATA(&csptr->bulkdata[i]); + } + } + + if (debug_print) + { + const CsrUint8 *sig = sigptr; + + unifi_error(card->ospriv, "Signal(%d): %02x %02x %02x %02x %02x %02x %02x %02x" + " %02x %02x %02x %02x %02x %02x %02x %02x\n", + siglen, + sig[0], sig[1], sig[2], sig[3], + sig[4], sig[5], sig[6], sig[7], + sig[8], sig[9], sig[10], sig[11], + sig[12], sig[13], sig[14], sig[15]); + unifi_error(card->ospriv, "Bulkdata pointer %p(%d), %p(%d)\n", + bulkdata != NULL?bulkdata->d[0].os_data_ptr : NULL, + bulkdata != NULL?bulkdata->d[0].data_length : 0, + bulkdata != NULL?bulkdata->d[1].os_data_ptr : NULL, + bulkdata != NULL?bulkdata->d[1].data_length : 0); + } + + /* Advance the written count to say there is a new entry */ + CSR_WIFI_HIP_Q_INC_W(sigq); + + /* + * Set the flag to say reason for waking was a host request. + * Then ask the OS layer to run the unifi_bh. + */ + if (run_bh == 1) + { + card->bh_reason_host = 1; + r = unifi_run_bh(card->ospriv); + if (r != CSR_RESULT_SUCCESS) + { + unifi_error(card->ospriv, "failed to run bh.\n"); + card->bh_reason_host = 0; + + /* + * The bulk data buffer will be freed by the caller. + * We need to invalidate the description of the bulk data in our + * soft queue, to prevent the core freeing the bulk data again later. + */ + for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; ++i) + { + if (csptr->bulkdata[i].data_length != 0) + { + csptr->bulkdata[i].os_data_ptr = csptr->bulkdata[i].os_net_buf_ptr = NULL; + csptr->bulkdata[i].net_buf_length = csptr->bulkdata[i].data_length = 0; + } + } + return r; + } + } + else + { + unifi_error(card->ospriv, "run_bh=%d, bh not called.\n", run_bh); + } + + /* + * Have we used up all the fh signal list entries? + */ + if (CSR_WIFI_HIP_Q_SLOTS_FREE(sigq) == 0) + { + /* We have filled the queue, so stop the upper layer. The command queue + * is an exception, as suspending due to that being full could delay + * resume/retry until new commands or data are received. + */ + if (sigq != &card->fh_command_queue) + { + /* + * Must call unifi_pause_xmit() *before* setting the paused flag. + * (the unifi_pause_xmit call should not be after setting the flag because of the possibility of being interrupted + * by the bh thread between our setting the flag and the call to unifi_pause_xmit() + * If bh thread then cleared the flag, we would end up paused, but without the flag set) + * Instead, setting it afterwards means that if this thread is interrupted by the bh thread + * the pause flag is still guaranteed to end up set + * However the potential deadlock now is that if bh thread emptied the queue and cleared the flag before this thread's + * call to unifi_pause_xmit(), then bh thread may not run again because it will be waiting for + * a packet to appear in the queue but nothing ever will because xmit is paused. + * So we will end up with the queue paused, and the flag set to say it is paused, but bh never runs to unpause it. + * (Note even this bad situation would not persist long in practice, because something else (eg rx, or tx in different queue) + * is likely to wake bh thread quite soon) + * But to avoid this deadlock completely, after setting the flag we check that there is something left in the queue. + * If there is, we know that bh thread has not emptied the queue yet. + * Since bh thread checks to unpause the queue *after* taking packets from the queue, we know that it is still going to make at + * least one more check to see whether it needs to unpause the queue. So all is well. + * If there are no packets in the queue, then the deadlock described above might happen. To make sure it does not, we + * unpause the queue here. A possible side effect is that unifi_restart_xmit() may (rarely) be called for second time + * unnecessarily, which is harmless + */ + +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) + unifi_debug_log_to_buf("P"); +#endif + unifi_pause_xmit(card->ospriv, (unifi_TrafficQueue)priority_q); + card_tx_q_pause(card, priority_q); + if (CSR_WIFI_HIP_Q_SLOTS_USED(sigq) == 0) + { + card_tx_q_unpause(card, priority_q); + unifi_restart_xmit(card->ospriv, (unifi_TrafficQueue) priority_q); + } + } + else + { + unifi_warning(card->ospriv, + "send_signal: fh_cmd_q full, not pausing (run_bh=%d)\n", + run_bh); + } + } + + func_exit(); + + return CSR_RESULT_SUCCESS; +} /* send_signal() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_send_signal + * + * Invokes send_signal() to queue a signal in the command or traffic queue + * If sigptr pointer is NULL, it pokes the bh to check if UniFi is responsive. + * + * Arguments: + * card Pointer to card context struct + * sigptr Pointer to signal from card. + * siglen Size of the signal + * bulkdata Pointer to the bulk data of the signal + * + * Returns: + * CSR_RESULT_SUCCESS on success + * CSR_WIFI_HIP_RESULT_NO_SPACE if there were insufficient data slots or no free signal queue entry + * + * Notes: + * unifi_send_signal() is used to queue signals, created by the driver, + * to the device. Signals are constructed using the UniFi packed structures. + * --------------------------------------------------------------------------- + */ +CsrResult unifi_send_signal(card_t *card, const CsrUint8 *sigptr, CsrUint32 siglen, + const bulk_data_param_t *bulkdata) +{ + q_t *sig_soft_q; + CsrUint16 signal_id; + CsrResult r; + CsrUint32 run_bh; + CsrUint32 priority_q; + + /* A NULL signal pointer is a request to check if UniFi is responsive */ + if (sigptr == NULL) + { + card->bh_reason_host = 1; + return unifi_run_bh(card->ospriv); + } + + priority_q = 0; + run_bh = 1; + signal_id = GET_SIGNAL_ID(sigptr); + /* + * If the signal is a CSR_MA_PACKET_REQUEST , + * we send it using the traffic soft queue. Else we use the command soft queue. + */ + if (signal_id == CSR_MA_PACKET_REQUEST_ID) + { + CsrUint16 frame_priority; + + if (card->periodic_wake_mode == UNIFI_PERIODIC_WAKE_HOST_ENABLED) + { + run_bh = 0; + } + +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) + unifi_debug_log_to_buf("D"); +#endif + /* Sanity check: MA-PACKET.req must have a valid bulk data */ + if ((bulkdata->d[0].data_length == 0) || (bulkdata->d[0].os_data_ptr == NULL)) + { + unifi_error(card->ospriv, "MA-PACKET.req with empty bulk data (%d bytes in %p)\n", + bulkdata->d[0].data_length, bulkdata->d[0].os_data_ptr); + dump((void *)sigptr, siglen); + return CSR_RESULT_FAILURE; + } + + /* Map the frame priority to a traffic queue index. */ + frame_priority = GET_PACKED_MA_PACKET_REQUEST_FRAME_PRIORITY(sigptr); + priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY)frame_priority); + + sig_soft_q = &card->fh_traffic_queue[priority_q]; + } + else + { + sig_soft_q = &card->fh_command_queue; + } + + r = send_signal(card, sigptr, siglen, bulkdata, sig_soft_q, priority_q, run_bh); + /* On error, the caller must free or requeue bulkdata buffers */ + + return r; +} /* unifi_send_signal() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_send_resources_available + * + * Examines whether there is available space to queue + * a signal in the command or traffic queue + * + * Arguments: + * card Pointer to card context struct + * sigptr Pointer to signal. + * + * Returns: + * CSR_RESULT_SUCCESS if resources available + * CSR_WIFI_HIP_RESULT_NO_SPACE if there was no free signal queue entry + * + * Notes: + * --------------------------------------------------------------------------- + */ +CsrResult unifi_send_resources_available(card_t *card, const CsrUint8 *sigptr) +{ + q_t *sig_soft_q; + CsrUint16 signal_id = GET_SIGNAL_ID(sigptr); + + /* + * If the signal is a CSR_MA_PACKET_REQUEST , + * we send it using the traffic soft queue. Else we use the command soft queue. + */ + if (signal_id == CSR_MA_PACKET_REQUEST_ID) + { + CsrUint16 frame_priority; + CsrUint32 priority_q; + + /* Map the frame priority to a traffic queue index. */ + frame_priority = GET_PACKED_MA_PACKET_REQUEST_FRAME_PRIORITY(sigptr); + priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY)frame_priority); + + sig_soft_q = &card->fh_traffic_queue[priority_q]; + } + else + { + sig_soft_q = &card->fh_command_queue; + } + + /* Check that the fh_data_queue has a free slot */ + if (!CSR_WIFI_HIP_Q_SLOTS_FREE(sig_soft_q)) + { + unifi_notice(card->ospriv, "unifi_send_resources_available: %s full\n", + sig_soft_q->name); + return CSR_WIFI_HIP_RESULT_NO_SPACE; + } + + return CSR_RESULT_SUCCESS; +} /* unifi_send_resources_available() */ + + diff --git a/drivers/staging/csr/csr_wifi_hip_signals.c b/drivers/staging/csr/csr_wifi_hip_signals.c new file mode 100644 index 0000000..5d0be53 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_signals.c @@ -0,0 +1,1313 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + + +/* Generated by hip_dd_l_c_gen.pl */ + +#include "csr_wifi_hip_signals.h" + +#include "csr_wifi_hip_unifi.h" + +CsrInt32 SigGetSize(const CSR_SIGNAL *aSignal) +{ + switch (aSignal->SignalPrimitiveHeader.SignalId) + { + case CSR_MA_PACKET_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_REQUEST); + case CSR_MA_PACKET_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_CONFIRM); + case CSR_MA_PACKET_INDICATION_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_INDICATION); + case CSR_MA_PACKET_CANCEL_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_CANCEL_REQUEST); + case CSR_MA_VIF_AVAILABILITY_RESPONSE_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_VIF_AVAILABILITY_RESPONSE); + case CSR_MA_VIF_AVAILABILITY_INDICATION_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_VIF_AVAILABILITY_INDICATION); + case CSR_MA_PACKET_ERROR_INDICATION_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_ERROR_INDICATION); +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_RESET_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_RESET_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_RESET_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_RESET_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_NEXT_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_NEXT_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_NEXT_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_NEXT_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_POWERMGT_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_POWERMGT_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_POWERMGT_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_POWERMGT_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SCAN_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SCAN_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SCAN_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SCAN_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_HL_SYNC_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_HL_SYNC_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MEASURE_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MEASURE_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MEASURE_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MEASURE_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MEASURE_INDICATION_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MEASURE_INDICATION); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SETKEYS_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SETKEYS_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SETKEYS_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SETKEYS_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DELETEKEYS_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DELETEKEYS_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DELETEKEYS_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DELETEKEYS_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONNECTED_INDICATION_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONNECTED_INDICATION); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SCAN_CANCEL_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SCAN_CANCEL_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_CANCEL_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_HL_SYNC_CANCEL_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_HL_SYNC_CANCEL_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_PERIODIC_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_PERIODIC_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_PERIODIC_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_PERIODIC_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_PERIODIC_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_PERIODIC_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_PERIODIC_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_PERIODIC_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_PACKET_FILTER_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_PACKET_FILTER_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_PACKET_FILTER_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_MEASURE_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_STOP_MEASURE_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_MEASURE_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_STOP_MEASURE_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TRIGGERED_GET_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TRIGGERED_GET_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TRIGGERED_GET_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TRIGGERED_GET_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_TRIGGERED_GET_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_TRIGGERED_GET_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_TRIGGERED_GET_INDICATION_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_TRIGGERED_GET_INDICATION); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_BLACKOUT_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_BLACKOUT_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_BLACKOUT_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_BLACKOUT_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_BLACKOUT_ENDED_INDICATION_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_BLACKOUT_ENDED_INDICATION); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_BLACKOUT_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_BLACKOUT_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_BLACKOUT_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_BLACKOUT_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_RX_TRIGGER_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_RX_TRIGGER_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_RX_TRIGGER_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_RX_TRIGGER_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_RX_TRIGGER_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_RX_TRIGGER_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONNECT_STATUS_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONNECT_STATUS_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONNECT_STATUS_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONNECT_STATUS_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TEMPLATE_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TEMPLATE_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TEMPLATE_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TEMPLATE_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONFIG_QUEUE_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONFIG_QUEUE_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONFIG_QUEUE_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONFIG_QUEUE_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TSPEC_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TSPEC_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TSPEC_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TSPEC_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TSPEC_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_TSPEC_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TSPEC_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_TSPEC_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_START_AGGREGATION_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_START_AGGREGATION_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_START_AGGREGATION_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_START_AGGREGATION_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_BLOCKACK_ERROR_INDICATION_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_BLOCKACK_ERROR_INDICATION); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_AGGREGATION_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_STOP_AGGREGATION_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_AGGREGATION_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_STOP_AGGREGATION_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SM_START_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SM_START_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SM_START_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SM_START_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_LEAVE_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_LEAVE_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_LEAVE_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_LEAVE_CONFIRM); +#endif + case CSR_MLME_SET_TIM_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_TIM_REQUEST); + case CSR_MLME_SET_TIM_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_TIM_CONFIRM); +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_KEY_SEQUENCE_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_KEY_SEQUENCE_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_KEY_SEQUENCE_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_CHANNEL_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_CHANNEL_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_CHANNEL_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_CHANNEL_CONFIRM); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST); +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM); +#endif + case CSR_DEBUG_STRING_INDICATION_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_STRING_INDICATION); + case CSR_DEBUG_WORD16_INDICATION_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_WORD16_INDICATION); + case CSR_DEBUG_GENERIC_REQUEST_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_GENERIC_REQUEST); + case CSR_DEBUG_GENERIC_CONFIRM_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_GENERIC_CONFIRM); + case CSR_DEBUG_GENERIC_INDICATION_ID: + return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_GENERIC_INDICATION); + default: + return 0; + } +} + + +CsrInt32 SigGetDataRefs(CSR_SIGNAL *aSignal, CSR_DATAREF **aDataRef) +{ + CsrInt32 numRefs = 0; + + switch (aSignal->SignalPrimitiveHeader.SignalId) + { + case CSR_MA_PACKET_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MaPacketRequest.Data; + aDataRef[numRefs++] = &aSignal->u.MaPacketRequest.Dummydataref2; + break; + case CSR_MA_PACKET_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MaPacketConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MaPacketConfirm.Dummydataref2; + break; + case CSR_MA_PACKET_INDICATION_ID: + aDataRef[numRefs++] = &aSignal->u.MaPacketIndication.Data; + aDataRef[numRefs++] = &aSignal->u.MaPacketIndication.Dummydataref2; + break; + case CSR_MA_PACKET_CANCEL_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MaPacketCancelRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MaPacketCancelRequest.Dummydataref2; + break; + case CSR_MA_VIF_AVAILABILITY_RESPONSE_ID: + aDataRef[numRefs++] = &aSignal->u.MaVifAvailabilityResponse.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MaVifAvailabilityResponse.Dummydataref2; + break; + case CSR_MA_VIF_AVAILABILITY_INDICATION_ID: + aDataRef[numRefs++] = &aSignal->u.MaVifAvailabilityIndication.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MaVifAvailabilityIndication.Dummydataref2; + break; + case CSR_MA_PACKET_ERROR_INDICATION_ID: + aDataRef[numRefs++] = &aSignal->u.MaPacketErrorIndication.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MaPacketErrorIndication.Dummydataref2; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_RESET_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeResetRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeResetRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_RESET_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeResetConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeResetConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeGetRequest.MibAttribute; + aDataRef[numRefs++] = &aSignal->u.MlmeGetRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeGetConfirm.MibAttributeValue; + aDataRef[numRefs++] = &aSignal->u.MlmeGetConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeSetRequest.MibAttributeValue; + aDataRef[numRefs++] = &aSignal->u.MlmeSetRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeSetConfirm.MibAttributeValue; + aDataRef[numRefs++] = &aSignal->u.MlmeSetConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_NEXT_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeGetNextRequest.MibAttribute; + aDataRef[numRefs++] = &aSignal->u.MlmeGetNextRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_NEXT_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeGetNextConfirm.MibAttributeValue; + aDataRef[numRefs++] = &aSignal->u.MlmeGetNextConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_POWERMGT_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmePowermgtRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmePowermgtRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_POWERMGT_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmePowermgtConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmePowermgtConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SCAN_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeScanRequest.ChannelList; + aDataRef[numRefs++] = &aSignal->u.MlmeScanRequest.InformationElements; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SCAN_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeScanConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeScanConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MEASURE_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeMeasureRequest.MeasurementRequestSet; + aDataRef[numRefs++] = &aSignal->u.MlmeMeasureRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MEASURE_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeMeasureConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeMeasureConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MEASURE_INDICATION_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeMeasureIndication.MeasurementReportSet; + aDataRef[numRefs++] = &aSignal->u.MlmeMeasureIndication.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SETKEYS_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeSetkeysRequest.Key; + aDataRef[numRefs++] = &aSignal->u.MlmeSetkeysRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SETKEYS_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeSetkeysConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeSetkeysConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DELETEKEYS_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeDeletekeysRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeDeletekeysRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DELETEKEYS_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeDeletekeysConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeDeletekeysConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeAutonomousScanLossIndication.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeAutonomousScanLossIndication.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONNECTED_INDICATION_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeConnectedIndication.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeConnectedIndication.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SCAN_CANCEL_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeScanCancelRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeScanCancelRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_CANCEL_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncCancelRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncCancelRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncCancelConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncCancelConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_PERIODIC_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeAddPeriodicRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeAddPeriodicRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_PERIODIC_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeAddPeriodicConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeAddPeriodicConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_PERIODIC_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeDelPeriodicRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeDelPeriodicRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_PERIODIC_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeDelPeriodicConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeDelPeriodicConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeAddAutonomousScanRequest.ChannelList; + aDataRef[numRefs++] = &aSignal->u.MlmeAddAutonomousScanRequest.InformationElements; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeAddAutonomousScanConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeAddAutonomousScanConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeDelAutonomousScanRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeDelAutonomousScanRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeDelAutonomousScanConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeDelAutonomousScanConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_PACKET_FILTER_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeSetPacketFilterRequest.InformationElements; + aDataRef[numRefs++] = &aSignal->u.MlmeSetPacketFilterRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeSetPacketFilterConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeSetPacketFilterConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_MEASURE_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeStopMeasureRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeStopMeasureRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_MEASURE_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeStopMeasureConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeStopMeasureConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmePauseAutonomousScanRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmePauseAutonomousScanRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmePauseAutonomousScanConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmePauseAutonomousScanConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeAutonomousScanDoneIndication.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeAutonomousScanDoneIndication.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TRIGGERED_GET_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeAddTriggeredGetRequest.MibAttribute; + aDataRef[numRefs++] = &aSignal->u.MlmeAddTriggeredGetRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeAddTriggeredGetConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeAddTriggeredGetConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TRIGGERED_GET_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeDelTriggeredGetRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeDelTriggeredGetRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeDelTriggeredGetConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeDelTriggeredGetConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_TRIGGERED_GET_INDICATION_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeTriggeredGetIndication.MibAttributeValue; + aDataRef[numRefs++] = &aSignal->u.MlmeTriggeredGetIndication.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_BLACKOUT_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeAddBlackoutRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeAddBlackoutRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_BLACKOUT_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeAddBlackoutConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeAddBlackoutConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_BLACKOUT_ENDED_INDICATION_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeBlackoutEndedIndication.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeBlackoutEndedIndication.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_BLACKOUT_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeDelBlackoutRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeDelBlackoutRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_BLACKOUT_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeDelBlackoutConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeDelBlackoutConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_RX_TRIGGER_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeAddRxTriggerRequest.InformationElements; + aDataRef[numRefs++] = &aSignal->u.MlmeAddRxTriggerRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeAddRxTriggerConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeAddRxTriggerConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_RX_TRIGGER_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeDelRxTriggerRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeDelRxTriggerRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeDelRxTriggerConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeDelRxTriggerConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONNECT_STATUS_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeConnectStatusRequest.InformationElements; + aDataRef[numRefs++] = &aSignal->u.MlmeConnectStatusRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONNECT_STATUS_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeConnectStatusConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeConnectStatusConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeModifyBssParameterRequest.Data; + aDataRef[numRefs++] = &aSignal->u.MlmeModifyBssParameterRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeModifyBssParameterConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeModifyBssParameterConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TEMPLATE_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeAddTemplateRequest.Data1; + aDataRef[numRefs++] = &aSignal->u.MlmeAddTemplateRequest.Data2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TEMPLATE_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeAddTemplateConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeAddTemplateConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONFIG_QUEUE_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeConfigQueueRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeConfigQueueRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONFIG_QUEUE_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeConfigQueueConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeConfigQueueConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TSPEC_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeAddTspecRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeAddTspecRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TSPEC_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeAddTspecConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeAddTspecConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TSPEC_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeDelTspecRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeDelTspecRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TSPEC_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeDelTspecConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeDelTspecConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_START_AGGREGATION_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeStartAggregationRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeStartAggregationRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_START_AGGREGATION_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeStartAggregationConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeStartAggregationConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_BLOCKACK_ERROR_INDICATION_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeBlockackErrorIndication.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeBlockackErrorIndication.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_AGGREGATION_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeStopAggregationRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeStopAggregationRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_AGGREGATION_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeStopAggregationConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeStopAggregationConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SM_START_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeSmStartRequest.Beacon; + aDataRef[numRefs++] = &aSignal->u.MlmeSmStartRequest.BssParameters; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SM_START_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeSmStartConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeSmStartConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_LEAVE_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeLeaveRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeLeaveRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_LEAVE_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeLeaveConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeLeaveConfirm.Dummydataref2; + break; +#endif + case CSR_MLME_SET_TIM_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeSetTimRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeSetTimRequest.Dummydataref2; + break; + case CSR_MLME_SET_TIM_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeSetTimConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeSetTimConfirm.Dummydataref2; + break; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_KEY_SEQUENCE_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeGetKeySequenceRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeGetKeySequenceRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeGetKeySequenceConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeGetKeySequenceConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_CHANNEL_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeSetChannelRequest.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeSetChannelRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_CHANNEL_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeSetChannelConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeSetChannelConfirm.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeAddMulticastAddressRequest.Data; + aDataRef[numRefs++] = &aSignal->u.MlmeAddMulticastAddressRequest.Dummydataref2; + break; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.MlmeAddMulticastAddressConfirm.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.MlmeAddMulticastAddressConfirm.Dummydataref2; + break; +#endif + case CSR_DEBUG_STRING_INDICATION_ID: + aDataRef[numRefs++] = &aSignal->u.DebugStringIndication.DebugMessage; + aDataRef[numRefs++] = &aSignal->u.DebugStringIndication.Dummydataref2; + break; + case CSR_DEBUG_WORD16_INDICATION_ID: + aDataRef[numRefs++] = &aSignal->u.DebugWord16Indication.Dummydataref1; + aDataRef[numRefs++] = &aSignal->u.DebugWord16Indication.Dummydataref2; + break; + case CSR_DEBUG_GENERIC_REQUEST_ID: + aDataRef[numRefs++] = &aSignal->u.DebugGenericRequest.DebugVariable; + aDataRef[numRefs++] = &aSignal->u.DebugGenericRequest.Dummydataref2; + break; + case CSR_DEBUG_GENERIC_CONFIRM_ID: + aDataRef[numRefs++] = &aSignal->u.DebugGenericConfirm.DebugVariable; + aDataRef[numRefs++] = &aSignal->u.DebugGenericConfirm.Dummydataref2; + break; + case CSR_DEBUG_GENERIC_INDICATION_ID: + aDataRef[numRefs++] = &aSignal->u.DebugGenericIndication.DebugVariable; + aDataRef[numRefs++] = &aSignal->u.DebugGenericIndication.Dummydataref2; + break; + default: + return 0; + } + return numRefs; +} + + +CsrUint32 SigGetFilterPos(CsrUint16 aSigID) +{ + switch (aSigID) + { + case CSR_MA_PACKET_REQUEST_ID: + return 0x00000001; + case CSR_MA_PACKET_CONFIRM_ID: + return 0x00000002; + case CSR_MA_PACKET_INDICATION_ID: + return 0x00000004; + case CSR_MA_PACKET_CANCEL_REQUEST_ID: + return 0x00000008; + case CSR_MA_VIF_AVAILABILITY_RESPONSE_ID: + return 0x00000010; + case CSR_MA_VIF_AVAILABILITY_INDICATION_ID: + return 0x00000020; + case CSR_MA_PACKET_ERROR_INDICATION_ID: + return 0x00000040; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_RESET_REQUEST_ID: + return 0x00000080; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_RESET_CONFIRM_ID: + return 0x00000100; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_REQUEST_ID: + return 0x00000200; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_CONFIRM_ID: + return 0x00000400; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_REQUEST_ID: + return 0x00000800; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_CONFIRM_ID: + return 0x00001000; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_NEXT_REQUEST_ID: + return 0x00002000; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_NEXT_CONFIRM_ID: + return 0x00004000; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_POWERMGT_REQUEST_ID: + return 0x00008000; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_POWERMGT_CONFIRM_ID: + return 0x00010001; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SCAN_REQUEST_ID: + return 0x00010002; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SCAN_CONFIRM_ID: + return 0x00010004; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_REQUEST_ID: + return 0x00010008; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_CONFIRM_ID: + return 0x00010010; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MEASURE_REQUEST_ID: + return 0x00010020; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MEASURE_CONFIRM_ID: + return 0x00010040; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MEASURE_INDICATION_ID: + return 0x00010080; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SETKEYS_REQUEST_ID: + return 0x00010100; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SETKEYS_CONFIRM_ID: + return 0x00010200; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DELETEKEYS_REQUEST_ID: + return 0x00010400; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DELETEKEYS_CONFIRM_ID: + return 0x00010800; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION_ID: + return 0x00011000; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONNECTED_INDICATION_ID: + return 0x00012000; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SCAN_CANCEL_REQUEST_ID: + return 0x00014000; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_CANCEL_REQUEST_ID: + return 0x00018000; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID: + return 0x00020001; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_PERIODIC_REQUEST_ID: + return 0x00020002; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_PERIODIC_CONFIRM_ID: + return 0x00020004; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_PERIODIC_REQUEST_ID: + return 0x00020008; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_PERIODIC_CONFIRM_ID: + return 0x00020010; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST_ID: + return 0x00020020; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID: + return 0x00020040; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST_ID: + return 0x00020080; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID: + return 0x00020100; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_PACKET_FILTER_REQUEST_ID: + return 0x00020200; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID: + return 0x00020400; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_MEASURE_REQUEST_ID: + return 0x00020800; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_MEASURE_CONFIRM_ID: + return 0x00021000; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST_ID: + return 0x00022000; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID: + return 0x00024000; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION_ID: + return 0x00028000; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TRIGGERED_GET_REQUEST_ID: + return 0x00030001; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID: + return 0x00030002; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TRIGGERED_GET_REQUEST_ID: + return 0x00030004; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID: + return 0x00030008; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_TRIGGERED_GET_INDICATION_ID: + return 0x00030010; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_BLACKOUT_REQUEST_ID: + return 0x00030020; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_BLACKOUT_CONFIRM_ID: + return 0x00030040; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_BLACKOUT_ENDED_INDICATION_ID: + return 0x00030080; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_BLACKOUT_REQUEST_ID: + return 0x00030100; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_BLACKOUT_CONFIRM_ID: + return 0x00030200; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_RX_TRIGGER_REQUEST_ID: + return 0x00030400; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID: + return 0x00030800; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_RX_TRIGGER_REQUEST_ID: + return 0x00031000; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID: + return 0x00032000; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONNECT_STATUS_REQUEST_ID: + return 0x00034000; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONNECT_STATUS_CONFIRM_ID: + return 0x00038000; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST_ID: + return 0x00040001; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID: + return 0x00040002; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TEMPLATE_REQUEST_ID: + return 0x00040004; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TEMPLATE_CONFIRM_ID: + return 0x00040008; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONFIG_QUEUE_REQUEST_ID: + return 0x00040010; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_CONFIG_QUEUE_CONFIRM_ID: + return 0x00040020; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TSPEC_REQUEST_ID: + return 0x00040040; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_TSPEC_CONFIRM_ID: + return 0x00040080; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TSPEC_REQUEST_ID: + return 0x00040100; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_DEL_TSPEC_CONFIRM_ID: + return 0x00040200; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_START_AGGREGATION_REQUEST_ID: + return 0x00040400; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_START_AGGREGATION_CONFIRM_ID: + return 0x00040800; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_BLOCKACK_ERROR_INDICATION_ID: + return 0x00041000; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_AGGREGATION_REQUEST_ID: + return 0x00042000; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_STOP_AGGREGATION_CONFIRM_ID: + return 0x00044000; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SM_START_REQUEST_ID: + return 0x00048000; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SM_START_CONFIRM_ID: + return 0x00050001; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_LEAVE_REQUEST_ID: + return 0x00050002; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_LEAVE_CONFIRM_ID: + return 0x00050004; +#endif + case CSR_MLME_SET_TIM_REQUEST_ID: + return 0x00050008; + case CSR_MLME_SET_TIM_CONFIRM_ID: + return 0x00050010; +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_KEY_SEQUENCE_REQUEST_ID: + return 0x00050020; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID: + return 0x00050040; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_CHANNEL_REQUEST_ID: + return 0x00050080; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_SET_CHANNEL_CONFIRM_ID: + return 0x00050100; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST_ID: + return 0x00050200; +#endif +#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET + case CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID: + return 0x00050400; +#endif + case CSR_DEBUG_STRING_INDICATION_ID: + return 0x00050800; + case CSR_DEBUG_WORD16_INDICATION_ID: + return 0x00051000; + case CSR_DEBUG_GENERIC_REQUEST_ID: + return 0x00052000; + case CSR_DEBUG_GENERIC_CONFIRM_ID: + return 0x00054000; + case CSR_DEBUG_GENERIC_INDICATION_ID: + return 0x00058000; + default: + break; + } + return 0xffffffff; +} + + diff --git a/drivers/staging/csr/csr_wifi_hip_signals.h b/drivers/staging/csr/csr_wifi_hip_signals.h new file mode 100644 index 0000000..c48fddd --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_signals.h @@ -0,0 +1,137 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* + ***************************************************************************** + * + * FILE: csr_wifi_hip_signals.h + * + * PURPOSE: + * Header file wrapping the auto-generated code in csr_wifi_hip_sigs.h + * and csr_wifi_hip_signals.c - + * csr_wifi_hip_sigs.h provides structures defining UniFi signals and + * csr_wifi_hip_signals.c provides SigGetSize() and SigGetDataRefs(). + * + ***************************************************************************** + */ +#ifndef __CSR_WIFI_HIP_SIGNALS_H__ +#define __CSR_WIFI_HIP_SIGNALS_H__ + +#include "csr_types.h" +#include "csr_wifi_hip_sigs.h" + + +/****************************************************************************/ +/* INFORMATION ELEMENTS */ +/****************************************************************************/ + +/* Information Element ID's - shouldn't be in here, but nowhere better yet */ +#define IE_SSID_ID 0 +#define IE_SUPPORTED_RATES_ID 1 +#define IE_FH_PARAM_SET_ID 2 +#define IE_DS_PARAM_SET_ID 3 +#define IE_CF_PARAM_SET_ID 4 +#define IE_TIM_ID 5 +#define IE_IBSS_PARAM_SET_ID 6 +#define IE_COUNTRY_ID 7 +#define IE_HOPPING_PATTERN_PARAMS_ID 8 +#define IE_HOPPING_PATTERN_TABLE_ID 9 +#define IE_REQUEST_ID 10 +#define IE_QBSS_LOAD_ID 11 +#define IE_EDCA_PARAM_SET_ID 12 +#define IE_TRAFFIC_SPEC_ID 13 +#define IE_TRAFFIC_CLASS_ID 14 +#define IE_SCHEDULE_ID 15 +#define IE_CHALLENGE_TEXT_ID 16 +#define IE_POWER_CONSTRAINT_ID 32 +#define IE_POWER_CAPABILITY_ID 33 +#define IE_TPC_REQUEST_ID 34 +#define IE_TPC_REPORT_ID 35 +#define IE_SUPPORTED_CHANNELS_ID 36 +#define IE_CHANNEL_SWITCH_ANNOUNCE_ID 37 +#define IE_MEASUREMENT_REQUEST_ID 38 +#define IE_MEASUREMENT_REPORT_ID 39 +#define IE_QUIET_ID 40 +#define IE_IBSS_DFS_ID 41 +#define IE_ERP_INFO_ID 42 +#define IE_TS_DELAY_ID 43 +#define IE_TCLAS_PROCESSING_ID 44 +#define IE_QOS_CAPABILITY_ID 46 +#define IE_RSN_ID 48 +#define IE_EXTENDED_SUPPORTED_RATES_ID 50 +#define IE_AP_CHANNEL_REPORT_ID 52 +#define IE_RCPI_ID 53 +#define IE_WPA_ID 221 + + +/* The maximum number of data references in a signal structure */ +#define UNIFI_MAX_DATA_REFERENCES 2 + +/* The space to allow for a wire-format signal structure */ +#define UNIFI_PACKED_SIGBUF_SIZE 64 + + +/******************************************************************************/ +/* SIGNAL PARAMETER VALUES */ +/******************************************************************************/ + +/* ifIndex */ +#define UNIFI_IF_2G4 1 +#define UNIFI_IF_5G 2 + +/* SendProcessId */ +#define HOST_PROC_ID 0xc000 + +#define SIG_CAP_ESS 0x0001 +#define SIG_CAP_IBSS 0x0002 +#define SIG_CAP_CF_POLLABLE 0x0004 +#define SIG_CAP_CF_POLL_REQUEST 0x0008 +#define SIG_CAP_PRIVACY 0x0010 +#define SIG_CAP_SHORT_PREAMBLE 0x0020 +#define SIG_CAP_DSSSOFDM 0x2000 + +/******************************************************************************/ +/* FUNCTION DECLARATIONS */ +/******************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************** + * SigGetNumDataRefs - Retrieve pointers to data-refs from a signal. + * + * PARAMETERS: + * aSignal - Pointer to signal to retrieve the data refs of. + * aDataRef - Address of a pointer to the structure that the data refs + * pointers will be stored. + * + * RETURNS: + * The number of data-refs in the signal. + */ +CsrInt32 SigGetDataRefs(CSR_SIGNAL *aSignal, CSR_DATAREF **aDataRef); + +/****************************************************************************** + * SigGetSize - Retrieve the size (in bytes) of a given signal. + * + * PARAMETERS: + * aSignal - Pointer to signal to retrieve size of. + * + * RETURNS: + * The size (in bytes) of the given signal. + */ +CsrInt32 SigGetSize(const CSR_SIGNAL *aSignal); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __CSR_WIFI_HIP_SIGNALS_H__ */ diff --git a/drivers/staging/csr/csr_wifi_hip_sigs.h b/drivers/staging/csr/csr_wifi_hip_sigs.h new file mode 100644 index 0000000..c94e2a4 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_sigs.h @@ -0,0 +1,1425 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + + +/* Generated by hip_dd_l_h_gen.pl */ + +#ifndef CSR_WIFI_HIP_SIGS_H +#define CSR_WIFI_HIP_SIGS_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef CsrInt16 csr_place_holding_type; + +typedef CsrUint16 CSR_ASSOCIATION_ID; + +typedef CsrUint16 CSR_AUTONOMOUS_SCAN_ID; + +typedef CsrUint16 CSR_BEACON_PERIODS; + +typedef CsrUint16 CSR_BLACKOUT_ID; + +typedef enum CSR_BLACKOUT_SOURCE +{ + CSR_DOT11_LOCAL = 0x0000, + CSR_DOT11_REMOTE = 0x0001, + CSR_OTHER_RADIO = 0x0002, + CSR_NOT_LINKED = 0x0004 +} CSR_BLACKOUT_SOURCE; + +typedef enum CSR_BLACKOUT_TYPE +{ + CSR_LOCAL_DEVICE_ONLY = 0x0001, + CSR_SPECIFIED_PEER = 0x0002, + CSR_CURRENT_CHANNEL = 0x0004, + CSR_P2P = 0x0008 +} CSR_BLACKOUT_TYPE; + +typedef enum CSR_BOOT_LOADER_OPERATION +{ + CSR_BOOT_LOADER_IDLE = 0x00, + CSR_BOOT_LOADER_RESTART = 0x01, + CSR_BOOT_LOADER_PATCH = 0x02, + CSR_BOOT_LOADER_IMAGE_0 = 0x10, + CSR_BOOT_LOADER_IMAGE_1 = 0x11, + CSR_BOOT_LOADER_IMAGE_2 = 0x12, + CSR_BOOT_LOADER_IMAGE_3 = 0x13 +} CSR_BOOT_LOADER_OPERATION; + +typedef CsrUint16 CSR_CAPABILITY_INFORMATION; + +typedef CsrUint16 CSR_CHANNEL_STARTING_FACTOR; + +typedef CsrUint32 CSR_CIPHER_SUITE_SELECTOR; + +typedef CsrUint32 CSR_CLIENT_TAG; + +typedef enum CSR_CONNECTION_STATUS +{ + CSR_DISCONNECTED = 0x0000, + CSR_CONNECTED_AWAKE = 0x0001 +} CSR_CONNECTION_STATUS; + +typedef CsrInt16 CSR_DECIBELS; + +typedef enum CSR_DIRECTION +{ + CSR_TRANSMIT = 0x0000, + CSR_RECEIVE = 0x0001, + CSR_BIDIRECTIONAL = 0x0003 +} CSR_DIRECTION; + +typedef enum CSR_FRAME_TYPE +{ + CSR_RESERVED = 0x0000, + CSR_BEACON = 0x0001, + CSR_PROBE_RESPONSE = 0x0002, + CSR_BEACON_AND_PROBE_RESPONSE = 0x0003, + CSR_PROBE_REQUEST = 0x0004 +} CSR_FRAME_TYPE; + +typedef CsrUint32 CSR_IPV4_ADDRESS; + +typedef enum CSR_IFINTERFACE +{ + CSR_INDEX_2G4 = 0x0001, + CSR_INDEX_5G = 0x0002 +} CSR_IFINTERFACE; + +typedef enum CSR_KEY_TYPE +{ + CSR_GROUP = 0x0000, + CSR_PAIRWISE = 0x0001, + CSR_PEER_KEY = 0x0002, + CSR_IGTK = 0x0003 +} CSR_KEY_TYPE; + +typedef enum CSR_LOADER_OPERATION +{ + CSR_LOADER_IDLE = 0x0000, + CSR_LOADER_COPY = 0x0001 +} CSR_LOADER_OPERATION; + +typedef struct CSR_MAC_ADDRESS +{ + CsrUint8 x[6]; +} CSR_MACADDRESS; + +typedef enum CSR_MIB_STATUS +{ + CSR_MIB_SUCCESSFUL = 0x0000, + CSR_MIB_INVALID_PARAMETERS = 0x0001, + CSR_MIB_WRITE_ONLY = 0x0002, + CSR_MIB_READ_ONLY = 0x0003 +} CSR_MIB_STATUS; + +typedef enum CSR_MEMORY_SPACE +{ + CSR_NONE = 0x00, + CSR_SHARED_DATA_MEMORY = 0x01, + CSR_EXTERNAL_FLASH_MEMORY = 0x02, + CSR_EXTERNAL_SRAM = 0x03, + CSR_REGISTERS = 0x04, + CSR_PHY_PROCESSOR_DATA_MEMORY = 0x10, + CSR_PHY_PROCESSOR_PROGRAM_MEMORY = 0x11, + CSR_PHY_PROCESSOR_ROM = 0x12, + CSR_MAC_PROCESSOR_DATA_MEMORY = 0x20, + CSR_MAC_PROCESSOR_PROGRAM_MEMORY = 0x21, + CSR_MAC_PROCESSOR_ROM = 0x22, + CSR_BT_PROCESSOR_DATA_MEMORY = 0x30, + CSR_BT_PROCESSOR_PROGRAM_MEMORY = 0x31, + CSR_BT_PROCESSOR_ROM = 0x32 +} CSR_MEMORY_SPACE; + +typedef CsrUint16 CSR_MICROSECONDS16; + +typedef CsrUint32 CSR_MICROSECONDS32; + +typedef CsrUint16 CSR_NATURAL16; + +typedef enum CSR_PS_SCHEME +{ + CSR_LEGACY_PS = 0x0001, + CSR_U_APSD = 0x0002, + CSR_S_APSD = 0x0004 +} CSR_PS_SCHEME; + +typedef enum CSR_PACKET_FILTER_MODE +{ + CSR_PFM_OPT_OUT = 0x0000, + CSR_PFM_OPT_IN = 0x0003 +} CSR_PACKET_FILTER_MODE; + +typedef CsrUint16 CSR_PERIODIC_ID; + +typedef enum CSR_PERIODIC_SCHEDULING_MODE +{ + CSR_PSM_PERIODIC_SCHEDULE_PS_POLL = 0x0001, + CSR_PSM_PERIODIC_SCHEDULE_PM_BIT = 0x0002, + CSR_PSM_PERIODIC_SCHEDULE_UAPSD = 0x0004, + CSR_PSM_PERIODIC_SCHEDULE_SAPSD = 0x0008 +} CSR_PERIODIC_SCHEDULING_MODE; + +typedef enum CSR_POWER_MANAGEMENT_MODE +{ + CSR_PMM_ACTIVE_MODE = 0x0000, + CSR_PMM_POWER_SAVE = 0x0001, + CSR_PMM_FAST_POWER_SAVE = 0x0002 +} CSR_POWER_MANAGEMENT_MODE; + +typedef enum CSR_PRIORITY +{ + CSR_QOS_UP0 = 0x0000, + CSR_QOS_UP1 = 0x0001, + CSR_QOS_UP2 = 0x0002, + CSR_QOS_UP3 = 0x0003, + CSR_QOS_UP4 = 0x0004, + CSR_QOS_UP5 = 0x0005, + CSR_QOS_UP6 = 0x0006, + CSR_QOS_UP7 = 0x0007, + CSR_CONTENTION = 0x8000, + CSR_MANAGEMENT = 0x8010 +} CSR_PRIORITY; + +typedef enum CSR_REASON_CODE +{ + CSR_UNSPECIFIED_REASON = 0x0001, + CSR_INVALID_INFORMATION_ELEMENT = 0x000d, + CSR_QOS_UNSPECIFIED_REASON = 0x0020, + CSR_QOS_EXCESSIVE_NOT_ACK = 0x0022, + CSR_QOS_TXOP_LIMIT_EXCEEDED = 0x0023, + CSR_QSTA_LEAVING = 0x0024, + CSR_UNKNOWN_BA = 0x0026, + CSR_UNKNOWN_TS = 0x0026, + CSR_TIMEOUT = 0x0027 +} CSR_REASON_CODE; + +typedef enum CSR_RECEPTION_STATUS +{ + CSR_RX_SUCCESS = 0x0000, + CSR_RX_FAILURE_UNSPECIFIED = 0x0001, + CSR_MICHAEL_MIC_ERROR = 0x0002, + CSR_DECRYPTION_ERROR = 0x0003, + CSR_NO_TEMPORAL_KEY_AVAILABLE = 0x0004, + CSR_UNSUPPORTED_MODULATION = 0x0011, + CSR_BAD_FCS = 0x0012, + CSR_BAD_SIGNAL = 0x0013 +} CSR_RECEPTION_STATUS; + +typedef enum CSR_RESULT_CODE +{ + CSR_RC_SUCCESS = 0x0000, + CSR_RC_UNSPECIFIED_FAILURE = 0x0001, + CSR_RC_REFUSED = 0x0003, + CSR_RC_INVALID_PARAMETERS = 0x0026, + CSR_RC_REJECTED_INVALID_IE = 0x0028, + CSR_RC_REJECTED_INVALID_GROUP_CIPHER = 0x0029, + CSR_RC_REJECTED_INVALID_PAIRWISE_CIPHER = 0x002a, + CSR_RC_TIMEOUT = 0x8000, + CSR_RC_TOO_MANY_SIMULTANEOUS_REQUESTS = 0x8001, + CSR_RC_BSS_ALREADY_STARTED_OR_JOINED = 0x8002, + CSR_RC_NOT_SUPPORTED = 0x8003, + CSR_RC_TRANSMISSION_FAILURE = 0x8004, + CSR_RC_RESET_REQUIRED_BEFORE_START = 0x8006, + CSR_RC_INSUFFICIENT_RESOURCE = 0x8007, + CSR_RC_NO_BUFFERED_BROADCAST_MULTICAST_FRAMES = 0x8008, + CSR_RC_INVALID_UNICAST_CIPHER = 0xf02f, + CSR_RC_INVALID_MULTICAST_CIPHER = 0xf030 +} CSR_RESULT_CODE; + +typedef enum CSR_SCAN_TYPE +{ + CSR_SC_ACTIVE_SCAN = 0x0000, + CSR_SC_PASSIVE_SCAN = 0x0001 +} CSR_SCAN_TYPE; + +typedef enum CSR_SIGNAL_ID +{ + CSR_MA_PACKET_REQUEST_ID = 0x0110, + CSR_MA_PACKET_CONFIRM_ID = 0x0111, + CSR_MA_PACKET_INDICATION_ID = 0x0113, + CSR_MA_PACKET_CANCEL_REQUEST_ID = 0x0114, + CSR_MA_VIF_AVAILABILITY_RESPONSE_ID = 0x0116, + CSR_MA_VIF_AVAILABILITY_INDICATION_ID = 0x0117, + CSR_MA_PACKET_ERROR_INDICATION_ID = 0x011b, + CSR_MLME_RESET_REQUEST_ID = 0x0200, + CSR_MLME_RESET_CONFIRM_ID = 0x0201, + CSR_MLME_GET_REQUEST_ID = 0x0204, + CSR_MLME_GET_CONFIRM_ID = 0x0205, + CSR_MLME_SET_REQUEST_ID = 0x0208, + CSR_MLME_SET_CONFIRM_ID = 0x0209, + CSR_MLME_GET_NEXT_REQUEST_ID = 0x020c, + CSR_MLME_GET_NEXT_CONFIRM_ID = 0x020d, + CSR_MLME_POWERMGT_REQUEST_ID = 0x0210, + CSR_MLME_POWERMGT_CONFIRM_ID = 0x0211, + CSR_MLME_SCAN_REQUEST_ID = 0x0214, + CSR_MLME_SCAN_CONFIRM_ID = 0x0215, + CSR_MLME_HL_SYNC_REQUEST_ID = 0x0244, + CSR_MLME_HL_SYNC_CONFIRM_ID = 0x0245, + CSR_MLME_MEASURE_REQUEST_ID = 0x0258, + CSR_MLME_MEASURE_CONFIRM_ID = 0x0259, + CSR_MLME_MEASURE_INDICATION_ID = 0x025b, + CSR_MLME_SETKEYS_REQUEST_ID = 0x0268, + CSR_MLME_SETKEYS_CONFIRM_ID = 0x0269, + CSR_MLME_DELETEKEYS_REQUEST_ID = 0x026c, + CSR_MLME_DELETEKEYS_CONFIRM_ID = 0x026d, + CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION_ID = 0x0287, + CSR_MLME_CONNECTED_INDICATION_ID = 0x028b, + CSR_MLME_SCAN_CANCEL_REQUEST_ID = 0x028c, + CSR_MLME_HL_SYNC_CANCEL_REQUEST_ID = 0x0298, + CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID = 0x0299, + CSR_MLME_ADD_PERIODIC_REQUEST_ID = 0x02a0, + CSR_MLME_ADD_PERIODIC_CONFIRM_ID = 0x02a1, + CSR_MLME_DEL_PERIODIC_REQUEST_ID = 0x02a4, + CSR_MLME_DEL_PERIODIC_CONFIRM_ID = 0x02a5, + CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST_ID = 0x02a8, + CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID = 0x02a9, + CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST_ID = 0x02ac, + CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID = 0x02ad, + CSR_MLME_SET_PACKET_FILTER_REQUEST_ID = 0x02b8, + CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID = 0x02b9, + CSR_MLME_STOP_MEASURE_REQUEST_ID = 0x02bc, + CSR_MLME_STOP_MEASURE_CONFIRM_ID = 0x02bd, + CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST_ID = 0x02cc, + CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID = 0x02cd, + CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION_ID = 0x02db, + CSR_MLME_ADD_TRIGGERED_GET_REQUEST_ID = 0x02dc, + CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID = 0x02dd, + CSR_MLME_DEL_TRIGGERED_GET_REQUEST_ID = 0x02e0, + CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID = 0x02e1, + CSR_MLME_TRIGGERED_GET_INDICATION_ID = 0x02e7, + CSR_MLME_ADD_BLACKOUT_REQUEST_ID = 0x02f8, + CSR_MLME_ADD_BLACKOUT_CONFIRM_ID = 0x02f9, + CSR_MLME_BLACKOUT_ENDED_INDICATION_ID = 0x02fb, + CSR_MLME_DEL_BLACKOUT_REQUEST_ID = 0x02fc, + CSR_MLME_DEL_BLACKOUT_CONFIRM_ID = 0x02fd, + CSR_MLME_ADD_RX_TRIGGER_REQUEST_ID = 0x0304, + CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID = 0x0305, + CSR_MLME_DEL_RX_TRIGGER_REQUEST_ID = 0x0308, + CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID = 0x0309, + CSR_MLME_CONNECT_STATUS_REQUEST_ID = 0x0310, + CSR_MLME_CONNECT_STATUS_CONFIRM_ID = 0x0311, + CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST_ID = 0x0314, + CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID = 0x0315, + CSR_MLME_ADD_TEMPLATE_REQUEST_ID = 0x0318, + CSR_MLME_ADD_TEMPLATE_CONFIRM_ID = 0x0319, + CSR_MLME_CONFIG_QUEUE_REQUEST_ID = 0x031c, + CSR_MLME_CONFIG_QUEUE_CONFIRM_ID = 0x031d, + CSR_MLME_ADD_TSPEC_REQUEST_ID = 0x0320, + CSR_MLME_ADD_TSPEC_CONFIRM_ID = 0x0321, + CSR_MLME_DEL_TSPEC_REQUEST_ID = 0x0324, + CSR_MLME_DEL_TSPEC_CONFIRM_ID = 0x0325, + CSR_MLME_START_AGGREGATION_REQUEST_ID = 0x0328, + CSR_MLME_START_AGGREGATION_CONFIRM_ID = 0x0329, + CSR_MLME_BLOCKACK_ERROR_INDICATION_ID = 0x032b, + CSR_MLME_STOP_AGGREGATION_REQUEST_ID = 0x032c, + CSR_MLME_STOP_AGGREGATION_CONFIRM_ID = 0x032d, + CSR_MLME_SM_START_REQUEST_ID = 0x0334, + CSR_MLME_SM_START_CONFIRM_ID = 0x0335, + CSR_MLME_LEAVE_REQUEST_ID = 0x0338, + CSR_MLME_LEAVE_CONFIRM_ID = 0x0339, + CSR_MLME_SET_TIM_REQUEST_ID = 0x033c, + CSR_MLME_SET_TIM_CONFIRM_ID = 0x033d, + CSR_MLME_GET_KEY_SEQUENCE_REQUEST_ID = 0x0340, + CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID = 0x0341, + CSR_MLME_SET_CHANNEL_REQUEST_ID = 0x034c, + CSR_MLME_SET_CHANNEL_CONFIRM_ID = 0x034d, + CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST_ID = 0x040c, + CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID = 0x040d, + CSR_DEBUG_STRING_INDICATION_ID = 0x0803, + CSR_DEBUG_WORD16_INDICATION_ID = 0x0807, + CSR_DEBUG_GENERIC_REQUEST_ID = 0x0808, + CSR_DEBUG_GENERIC_CONFIRM_ID = 0x0809, + CSR_DEBUG_GENERIC_INDICATION_ID = 0x080b +} CSR_SIGNAL_ID; + +typedef CsrUint16 CSR_SIMPLE_POINTER; + +typedef CsrUint16 CSR_STARTING_SEQUENCE_NUMBER; + +typedef enum CSR_SYMBOL_ID +{ + CSR_SLT_END = 0x0000, + CSR_SLT_PCI_SLOT_CONFIG = 0x0001, + CSR_SLT_SDIO_SLOT_CONFIG = 0x0002, + CSR_SLT_BUILD_ID_NUMBER = 0x0003, + CSR_SLT_BUILD_ID_STRING = 0x0004, + CSR_SLT_PERSISTENT_STORE_DB = 0x0005, + CSR_SLT_RESET_VECTOR_PHY = 0x0006, + CSR_SLT_RESET_VECTOR_MAC = 0x0007, + CSR_SLT_SDIO_LOADER_CONTROL = 0x0008, + CSR_SLT_TEST_CMD = 0x0009, + CSR_SLT_TEST_ALIVE_COUNTER = 0x000a, + CSR_SLT_TEST_PARAMETERS = 0x000b, + CSR_SLT_TEST_RESULTS = 0x000c, + CSR_SLT_TEST_VERSION = 0x000d, + CSR_SLT_MIB_PSID_RANGES = 0x000e, + CSR_SLT_KIP_TABLE = 0x000f, + CSR_SLT_PANIC_DATA_PHY = 0x0010, + CSR_SLT_PANIC_DATA_MAC = 0x0011, + CSR_SLT_BOOT_LOADER_CONTROL = 0x0012, + CSR_SLT_SOFT_MAC = 0x0013 +} CSR_SYMBOL_ID; + +typedef struct CSR_TSF_TIME +{ + CsrUint8 x[8]; +} CSR_TSF_TIME; + +typedef CsrUint16 CSR_TIME_UNITS; + +typedef enum CSR_TRANSMISSION_CONTROL +{ + CSR_TRIGGERED = 0x0001, + CSR_END_OF_SERVICE = 0x0002, + CSR_NO_CONFIRM_REQUIRED = 0x0004, + CSR_ALLOW_BA = 0x0008 +} CSR_TRANSMISSION_CONTROL; + +typedef enum CSR_TRANSMISSION_STATUS +{ + CSR_TX_SUCCESSFUL = 0x0000, + CSR_TX_RETRY_LIMIT = 0x0001, + CSR_TX_LIFETIME = 0x0002, + CSR_TX_NO_BSS = 0x0003, + CSR_TX_EXCESSIVE_DATA_LENGTH = 0x0004, + CSR_TX_UNSUPPORTED_PRIORITY = 0x0006, + CSR_TX_UNAVAILABLE_PRIORITY = 0x0007, + CSR_TX_UNAVAILABLE_KEY_MAPPING = 0x000a, + CSR_TX_EDCA_TIMEOUT = 0x000b, + CSR_TX_BLOCK_ACK_TIMEOUT = 0x000c, + CSR_TX_FAIL_TRANSMISSION_VIF_INTERRUPTED = 0x000d, + CSR_TX_REJECTED_PEER_STATION_SLEEPING = 0x000e, + CSR_TX_REJECTED_DTIM_ENDED = 0x000f, + CSR_TX_REJECTED_DTIM_STARTED = 0x0010 +} CSR_TRANSMISSION_STATUS; + +typedef CsrUint16 CSR_TRIGGER_ID; + +typedef CsrUint16 CSR_TRIGGERED_ID; + +typedef enum CSR_HIP_VERSIONS +{ + CSR_HIP_ENG_VERSION = 0x0001, + CSR_HIP_VERSION = 0x0900 +} CSR_HIP_VERSIONS; + +typedef CsrUint16 CSR_BUFFER_HANDLE; + +typedef CsrUint16 CSR_CHANNEL_NUMBER; + +typedef struct CSR_DATA_REFERENCE +{ + CsrUint16 SlotNumber; + CsrUint16 DataLength; +} CSR_DATAREF; + +typedef CsrUint16 CSR_DIALOG_TOKEN; + +typedef struct CSR_GENERIC_POINTER +{ + CsrUint24 MemoryOffset; + CSR_MEMORY_SPACE MemorySpace; +} CSR_GENERIC_POINTER; + +typedef struct CSR_MLME_CONFIG_QUEUE_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_CONFIG_QUEUE_CONFIRM; + +typedef struct CSR_MLME_CONFIG_QUEUE_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_NATURAL16 QueueIndex; + CSR_NATURAL16 Aifs; + CSR_NATURAL16 Cwmin; + CSR_NATURAL16 Cwmax; + CSR_NATURAL16 TxopLimit; +} CSR_MLME_CONFIG_QUEUE_REQUEST; + +typedef struct CSR_MLME_GET_CONFIRM +{ + CSR_DATAREF MibAttributeValue; + CSR_DATAREF Dummydataref2; + CSR_MIB_STATUS Status; + CSR_NATURAL16 ErrorIndex; +} CSR_MLME_GET_CONFIRM; + +typedef struct CSR_MLME_GET_REQUEST +{ + CSR_DATAREF MibAttribute; + CSR_DATAREF Dummydataref2; +} CSR_MLME_GET_REQUEST; + +typedef struct CSR_MLME_GET_NEXT_CONFIRM +{ + CSR_DATAREF MibAttributeValue; + CSR_DATAREF Dummydataref2; + CSR_MIB_STATUS Status; + CSR_NATURAL16 ErrorIndex; +} CSR_MLME_GET_NEXT_CONFIRM; + +typedef struct CSR_MLME_GET_NEXT_REQUEST +{ + CSR_DATAREF MibAttribute; + CSR_DATAREF Dummydataref2; +} CSR_MLME_GET_NEXT_REQUEST; + +typedef struct CSR_MLME_HL_SYNC_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_MACADDRESS GroupAddress; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_HL_SYNC_CONFIRM; + +typedef struct CSR_MLME_HL_SYNC_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_MACADDRESS GroupAddress; +} CSR_MLME_HL_SYNC_REQUEST; + +typedef struct CSR_MLME_HL_SYNC_CANCEL_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_HL_SYNC_CANCEL_CONFIRM; + +typedef struct CSR_MLME_HL_SYNC_CANCEL_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_MACADDRESS GroupAddress; +} CSR_MLME_HL_SYNC_CANCEL_REQUEST; + +typedef struct CSR_MLME_MEASURE_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_RESULT_CODE ResultCode; + CSR_DIALOG_TOKEN DialogToken; +} CSR_MLME_MEASURE_CONFIRM; + +typedef struct CSR_MLME_MEASURE_INDICATION +{ + CSR_DATAREF MeasurementReportSet; + CSR_DATAREF Dummydataref2; + CSR_DIALOG_TOKEN DialogToken; +} CSR_MLME_MEASURE_INDICATION; + +typedef struct CSR_MLME_MEASURE_REQUEST +{ + CSR_DATAREF MeasurementRequestSet; + CSR_DATAREF Dummydataref2; + CSR_DIALOG_TOKEN DialogToken; +} CSR_MLME_MEASURE_REQUEST; + +typedef struct CSR_MLME_RESET_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_RESET_CONFIRM; + +typedef struct CSR_MLME_RESET_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_MACADDRESS StaAddress; + CsrInt16 SetDefaultMib; +} CSR_MLME_RESET_REQUEST; + +typedef struct CSR_MLME_SET_CONFIRM +{ + CSR_DATAREF MibAttributeValue; + CSR_DATAREF Dummydataref2; + CSR_MIB_STATUS Status; + CSR_NATURAL16 ErrorIndex; +} CSR_MLME_SET_CONFIRM; + +typedef struct CSR_MLME_SET_REQUEST +{ + CSR_DATAREF MibAttributeValue; + CSR_DATAREF Dummydataref2; +} CSR_MLME_SET_REQUEST; + +typedef struct CSR_MLME_STOP_MEASURE_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_RESULT_CODE ResultCode; + CSR_DIALOG_TOKEN DialogToken; +} CSR_MLME_STOP_MEASURE_CONFIRM; + +typedef struct CSR_MLME_STOP_MEASURE_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_DIALOG_TOKEN DialogToken; +} CSR_MLME_STOP_MEASURE_REQUEST; + +typedef CsrUint16 CSR_PROCESS_ID; + +typedef CsrUint16 CSR_RATE; + +typedef CsrUint16 CSR_SEQUENCE_NUMBER; + +typedef struct CSR_SIGNAL_PRIMITIVE_HEADER +{ + CsrInt16 SignalId; + CSR_PROCESS_ID ReceiverProcessId; + CSR_PROCESS_ID SenderProcessId; +} CSR_SIGNAL_PRIMITIVE_HEADER; + +typedef CsrUint16 CSR_TRAFFIC_WINDOW; + +typedef CsrUint16 CSR_VIF_IDENTIFIER; + +typedef struct CSR_DEBUG_GENERIC_CONFIRM +{ + CSR_DATAREF DebugVariable; + CSR_DATAREF Dummydataref2; + CSR_NATURAL16 DebugWords[8]; +} CSR_DEBUG_GENERIC_CONFIRM; + +typedef struct CSR_DEBUG_GENERIC_INDICATION +{ + CSR_DATAREF DebugVariable; + CSR_DATAREF Dummydataref2; + CSR_NATURAL16 DebugWords[8]; +} CSR_DEBUG_GENERIC_INDICATION; + +typedef struct CSR_DEBUG_GENERIC_REQUEST +{ + CSR_DATAREF DebugVariable; + CSR_DATAREF Dummydataref2; + CSR_NATURAL16 DebugWords[8]; +} CSR_DEBUG_GENERIC_REQUEST; + +typedef struct CSR_DEBUG_STRING_INDICATION +{ + CSR_DATAREF DebugMessage; + CSR_DATAREF Dummydataref2; +} CSR_DEBUG_STRING_INDICATION; + +typedef struct CSR_DEBUG_WORD16_INDICATION +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_NATURAL16 DebugWords[16]; +} CSR_DEBUG_WORD16_INDICATION; + +typedef struct CSR_MA_PACKET_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_TRANSMISSION_STATUS TransmissionStatus; + CSR_NATURAL16 RetryCount; + CSR_RATE Rate; + CSR_CLIENT_TAG HostTag; +} CSR_MA_PACKET_CONFIRM; + +typedef struct CSR_MA_PACKET_INDICATION +{ + CSR_DATAREF Data; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_TSF_TIME LocalTime; + CSR_IFINTERFACE Ifindex; + CSR_CHANNEL_NUMBER Channel; + CSR_RECEPTION_STATUS ReceptionStatus; + CSR_DECIBELS Rssi; + CSR_DECIBELS Snr; + CSR_RATE ReceivedRate; +} CSR_MA_PACKET_INDICATION; + +typedef struct CSR_MA_PACKET_REQUEST +{ + CSR_DATAREF Data; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_RATE TransmitRate; + CSR_CLIENT_TAG HostTag; + CSR_PRIORITY Priority; + CSR_MACADDRESS Ra; + CSR_TRANSMISSION_CONTROL TransmissionControl; +} CSR_MA_PACKET_REQUEST; + +typedef struct CSR_MA_PACKET_CANCEL_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_CLIENT_TAG HostTag; +} CSR_MA_PACKET_CANCEL_REQUEST; + +typedef struct CSR_MA_PACKET_ERROR_INDICATION +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_MACADDRESS PeerQstaAddress; + CSR_PRIORITY UserPriority; + CSR_SEQUENCE_NUMBER SequenceNumber; +} CSR_MA_PACKET_ERROR_INDICATION; + +typedef struct CSR_MA_VIF_AVAILABILITY_INDICATION +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CsrInt16 Multicast; +} CSR_MA_VIF_AVAILABILITY_INDICATION; + +typedef struct CSR_MA_VIF_AVAILABILITY_RESPONSE +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_RESULT_CODE ResultCode; +} CSR_MA_VIF_AVAILABILITY_RESPONSE; + +typedef struct CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_RESULT_CODE ResultCode; + CSR_AUTONOMOUS_SCAN_ID AutonomousScanId; +} CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM; + +typedef struct CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST +{ + CSR_DATAREF ChannelList; + CSR_DATAREF InformationElements; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_AUTONOMOUS_SCAN_ID AutonomousScanId; + CSR_IFINTERFACE Ifindex; + CSR_CHANNEL_STARTING_FACTOR ChannelStartingFactor; + CSR_SCAN_TYPE ScanType; + CSR_MICROSECONDS32 ProbeDelay; + CSR_TIME_UNITS MinChannelTime; + CSR_TIME_UNITS MaxChannelTime; +} CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST; + +typedef struct CSR_MLME_ADD_BLACKOUT_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_BLACKOUT_ID BlackoutId; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_ADD_BLACKOUT_CONFIRM; + +typedef struct CSR_MLME_ADD_BLACKOUT_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_BLACKOUT_ID BlackoutId; + CSR_BLACKOUT_TYPE BlackoutType; + CSR_BLACKOUT_SOURCE BlackoutSource; + CSR_MICROSECONDS32 BlackoutStartReference; + CSR_MICROSECONDS32 BlackoutPeriod; + CSR_MICROSECONDS32 BlackoutDuration; + CSR_MACADDRESS PeerStaAddress; + CSR_NATURAL16 BlackoutCount; +} CSR_MLME_ADD_BLACKOUT_REQUEST; + +typedef struct CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM; + +typedef struct CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST +{ + CSR_DATAREF Data; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_NATURAL16 NumberOfMulticastGroupAddresses; +} CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST; + +typedef struct CSR_MLME_ADD_PERIODIC_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_PERIODIC_ID PeriodicId; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_ADD_PERIODIC_CONFIRM; + +typedef struct CSR_MLME_ADD_PERIODIC_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_PERIODIC_ID PeriodicId; + CSR_MICROSECONDS32 MaximumLatency; + CSR_PERIODIC_SCHEDULING_MODE PeriodicSchedulingMode; + CsrInt16 WakeHost; + CSR_PRIORITY UserPriority; +} CSR_MLME_ADD_PERIODIC_REQUEST; + +typedef struct CSR_MLME_ADD_RX_TRIGGER_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_TRIGGER_ID TriggerId; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_ADD_RX_TRIGGER_CONFIRM; + +typedef struct CSR_MLME_ADD_RX_TRIGGER_REQUEST +{ + CSR_DATAREF InformationElements; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_TRIGGER_ID TriggerId; + CSR_PRIORITY Priority; +} CSR_MLME_ADD_RX_TRIGGER_REQUEST; + +typedef struct CSR_MLME_ADD_TEMPLATE_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_FRAME_TYPE FrameType; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_ADD_TEMPLATE_CONFIRM; + +typedef struct CSR_MLME_ADD_TEMPLATE_REQUEST +{ + CSR_DATAREF Data1; + CSR_DATAREF Data2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_FRAME_TYPE FrameType; + CSR_RATE MinTransmitRate; +} CSR_MLME_ADD_TEMPLATE_REQUEST; + +typedef struct CSR_MLME_ADD_TRIGGERED_GET_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_RESULT_CODE ResultCode; + CSR_TRIGGERED_ID TriggeredId; +} CSR_MLME_ADD_TRIGGERED_GET_CONFIRM; + +typedef struct CSR_MLME_ADD_TRIGGERED_GET_REQUEST +{ + CSR_DATAREF MibAttribute; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_TRIGGERED_ID TriggeredId; +} CSR_MLME_ADD_TRIGGERED_GET_REQUEST; + +typedef struct CSR_MLME_ADD_TSPEC_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_PRIORITY UserPriority; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_ADD_TSPEC_CONFIRM; + +typedef struct CSR_MLME_ADD_TSPEC_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_PRIORITY UserPriority; + CSR_DIRECTION Direction; + CSR_PS_SCHEME PsScheme; + CSR_NATURAL16 MediumTime; + CSR_MICROSECONDS32 ServiceStartTime; + CSR_MICROSECONDS32 ServiceInterval; + CSR_RATE MinimumDataRate; +} CSR_MLME_ADD_TSPEC_REQUEST; + +typedef struct CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_RESULT_CODE ResultCode; + CSR_AUTONOMOUS_SCAN_ID AutonomousScanId; +} CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION; + +typedef struct CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_MACADDRESS Bssid; +} CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION; + +typedef struct CSR_MLME_BLACKOUT_ENDED_INDICATION +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_BLACKOUT_ID BlackoutId; +} CSR_MLME_BLACKOUT_ENDED_INDICATION; + +typedef struct CSR_MLME_BLOCKACK_ERROR_INDICATION +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_REASON_CODE ResultCode; + CSR_MACADDRESS PeerQstaAddress; +} CSR_MLME_BLOCKACK_ERROR_INDICATION; + +typedef struct CSR_MLME_CONNECTED_INDICATION +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_CONNECTION_STATUS ConnectionStatus; + CSR_MACADDRESS PeerMacAddress; +} CSR_MLME_CONNECTED_INDICATION; + +typedef struct CSR_MLME_CONNECT_STATUS_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_CONNECT_STATUS_CONFIRM; + +typedef struct CSR_MLME_CONNECT_STATUS_REQUEST +{ + CSR_DATAREF InformationElements; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_CONNECTION_STATUS ConnectionStatus; + CSR_MACADDRESS StaAddress; + CSR_ASSOCIATION_ID AssociationId; + CSR_CAPABILITY_INFORMATION AssociationCapabilityInformation; +} CSR_MLME_CONNECT_STATUS_REQUEST; + +typedef struct CSR_MLME_DELETEKEYS_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_DELETEKEYS_CONFIRM; + +typedef struct CSR_MLME_DELETEKEYS_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_NATURAL16 KeyId; + CSR_KEY_TYPE KeyType; + CSR_MACADDRESS Address; +} CSR_MLME_DELETEKEYS_REQUEST; + +typedef struct CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_RESULT_CODE ResultCode; + CSR_AUTONOMOUS_SCAN_ID AutonomousScanId; +} CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM; + +typedef struct CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_AUTONOMOUS_SCAN_ID AutonomousScanId; +} CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST; + +typedef struct CSR_MLME_DEL_BLACKOUT_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_BLACKOUT_ID BlackoutId; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_DEL_BLACKOUT_CONFIRM; + +typedef struct CSR_MLME_DEL_BLACKOUT_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_BLACKOUT_ID BlackoutId; +} CSR_MLME_DEL_BLACKOUT_REQUEST; + +typedef struct CSR_MLME_DEL_PERIODIC_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_PERIODIC_ID PeriodicId; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_DEL_PERIODIC_CONFIRM; + +typedef struct CSR_MLME_DEL_PERIODIC_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_PERIODIC_ID PeriodicId; +} CSR_MLME_DEL_PERIODIC_REQUEST; + +typedef struct CSR_MLME_DEL_RX_TRIGGER_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_TRIGGER_ID TriggerId; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_DEL_RX_TRIGGER_CONFIRM; + +typedef struct CSR_MLME_DEL_RX_TRIGGER_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_TRIGGER_ID TriggerId; +} CSR_MLME_DEL_RX_TRIGGER_REQUEST; + +typedef struct CSR_MLME_DEL_TRIGGERED_GET_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_RESULT_CODE ResultCode; + CSR_TRIGGERED_ID TriggeredId; +} CSR_MLME_DEL_TRIGGERED_GET_CONFIRM; + +typedef struct CSR_MLME_DEL_TRIGGERED_GET_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_TRIGGERED_ID TriggeredId; +} CSR_MLME_DEL_TRIGGERED_GET_REQUEST; + +typedef struct CSR_MLME_DEL_TSPEC_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_PRIORITY UserPriority; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_DEL_TSPEC_CONFIRM; + +typedef struct CSR_MLME_DEL_TSPEC_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_PRIORITY UserPriority; + CSR_DIRECTION Direction; +} CSR_MLME_DEL_TSPEC_REQUEST; + +typedef struct CSR_MLME_GET_KEY_SEQUENCE_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_RESULT_CODE ResultCode; + CSR_NATURAL16 SequenceNumber[8]; +} CSR_MLME_GET_KEY_SEQUENCE_CONFIRM; + +typedef struct CSR_MLME_GET_KEY_SEQUENCE_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_NATURAL16 KeyId; + CSR_KEY_TYPE KeyType; + CSR_MACADDRESS Address; +} CSR_MLME_GET_KEY_SEQUENCE_REQUEST; + +typedef struct CSR_MLME_LEAVE_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_LEAVE_CONFIRM; + +typedef struct CSR_MLME_LEAVE_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; +} CSR_MLME_LEAVE_REQUEST; + +typedef struct CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM; + +typedef struct CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST +{ + CSR_DATAREF Data; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_TIME_UNITS BeaconPeriod; + CSR_BEACON_PERIODS DtimPeriod; + CSR_CAPABILITY_INFORMATION CapabilityInformation; + CSR_MACADDRESS Bssid; + CSR_NATURAL16 RtsThreshold; +} CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST; + +typedef struct CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_RESULT_CODE ResultCode; + CSR_AUTONOMOUS_SCAN_ID AutonomousScanId; +} CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM; + +typedef struct CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_AUTONOMOUS_SCAN_ID AutonomousScanId; + CsrInt16 Pause; +} CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST; + +typedef struct CSR_MLME_POWERMGT_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_POWERMGT_CONFIRM; + +typedef struct CSR_MLME_POWERMGT_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_POWER_MANAGEMENT_MODE PowerManagementMode; + CsrInt16 ReceiveDtims; + CSR_BEACON_PERIODS ListenInterval; + CSR_TRAFFIC_WINDOW TrafficWindow; +} CSR_MLME_POWERMGT_REQUEST; + +typedef struct CSR_MLME_SCAN_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_SCAN_CONFIRM; + +typedef struct CSR_MLME_SCAN_REQUEST +{ + CSR_DATAREF ChannelList; + CSR_DATAREF InformationElements; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_IFINTERFACE Ifindex; + CSR_SCAN_TYPE ScanType; + CSR_MICROSECONDS32 ProbeDelay; + CSR_TIME_UNITS MinChannelTime; + CSR_TIME_UNITS MaxChannelTime; +} CSR_MLME_SCAN_REQUEST; + +typedef struct CSR_MLME_SCAN_CANCEL_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; +} CSR_MLME_SCAN_CANCEL_REQUEST; + +typedef struct CSR_MLME_SETKEYS_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_SETKEYS_CONFIRM; + +typedef struct CSR_MLME_SETKEYS_REQUEST +{ + CSR_DATAREF Key; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_NATURAL16 Length; + CSR_NATURAL16 KeyId; + CSR_KEY_TYPE KeyType; + CSR_MACADDRESS Address; + CSR_NATURAL16 SequenceNumber[8]; + CSR_CIPHER_SUITE_SELECTOR CipherSuiteSelector; +} CSR_MLME_SETKEYS_REQUEST; + +typedef struct CSR_MLME_SET_CHANNEL_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_SET_CHANNEL_CONFIRM; + +typedef struct CSR_MLME_SET_CHANNEL_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_IFINTERFACE Ifindex; + CSR_CHANNEL_NUMBER Channel; + CSR_MACADDRESS Address; + CSR_TIME_UNITS AvailabilityDuration; + CSR_TIME_UNITS AvailabilityInterval; +} CSR_MLME_SET_CHANNEL_REQUEST; + +typedef struct CSR_MLME_SET_PACKET_FILTER_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_SET_PACKET_FILTER_CONFIRM; + +typedef struct CSR_MLME_SET_PACKET_FILTER_REQUEST +{ + CSR_DATAREF InformationElements; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_PACKET_FILTER_MODE PacketFilterMode; + CSR_IPV4_ADDRESS ArpFilterAddress; +} CSR_MLME_SET_PACKET_FILTER_REQUEST; + +typedef struct CSR_MLME_SET_TIM_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_SET_TIM_CONFIRM; + +typedef struct CSR_MLME_SET_TIM_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_ASSOCIATION_ID AssociationId; + CsrInt16 TimValue; +} CSR_MLME_SET_TIM_REQUEST; + +typedef struct CSR_MLME_SM_START_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_SM_START_CONFIRM; + +typedef struct CSR_MLME_SM_START_REQUEST +{ + CSR_DATAREF Beacon; + CSR_DATAREF BssParameters; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_IFINTERFACE Ifindex; + CSR_CHANNEL_NUMBER Channel; + CSR_MACADDRESS InterfaceAddress; + CSR_MACADDRESS Bssid; + CSR_TIME_UNITS BeaconPeriod; + CSR_BEACON_PERIODS DtimPeriod; + CSR_CAPABILITY_INFORMATION CapabilityInformation; +} CSR_MLME_SM_START_REQUEST; + +typedef struct CSR_MLME_START_AGGREGATION_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_MACADDRESS PeerQstaAddress; + CSR_PRIORITY UserPriority; + CSR_DIRECTION Direction; + CSR_RESULT_CODE ResultCode; + CSR_SEQUENCE_NUMBER SequenceNumber; +} CSR_MLME_START_AGGREGATION_CONFIRM; + +typedef struct CSR_MLME_START_AGGREGATION_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_MACADDRESS PeerQstaAddress; + CSR_PRIORITY UserPriority; + CSR_DIRECTION Direction; + CSR_STARTING_SEQUENCE_NUMBER StartingSequenceNumber; + CSR_NATURAL16 BufferSize; + CSR_TIME_UNITS BlockAckTimeout; +} CSR_MLME_START_AGGREGATION_REQUEST; + +typedef struct CSR_MLME_STOP_AGGREGATION_CONFIRM +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_MACADDRESS PeerQstaAddress; + CSR_PRIORITY UserPriority; + CSR_DIRECTION Direction; + CSR_RESULT_CODE ResultCode; +} CSR_MLME_STOP_AGGREGATION_CONFIRM; + +typedef struct CSR_MLME_STOP_AGGREGATION_REQUEST +{ + CSR_DATAREF Dummydataref1; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_MACADDRESS PeerQstaAddress; + CSR_PRIORITY UserPriority; + CSR_DIRECTION Direction; +} CSR_MLME_STOP_AGGREGATION_REQUEST; + +typedef struct CSR_MLME_TRIGGERED_GET_INDICATION +{ + CSR_DATAREF MibAttributeValue; + CSR_DATAREF Dummydataref2; + CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; + CSR_MIB_STATUS Status; + CSR_NATURAL16 ErrorIndex; + CSR_TRIGGERED_ID TriggeredId; +} CSR_MLME_TRIGGERED_GET_INDICATION; + +typedef struct CSR_SIGNAL_PRIMITIVE +{ + CSR_SIGNAL_PRIMITIVE_HEADER SignalPrimitiveHeader; + union + { + CSR_MA_PACKET_REQUEST MaPacketRequest; + CSR_MA_PACKET_CONFIRM MaPacketConfirm; + CSR_MA_PACKET_INDICATION MaPacketIndication; + CSR_MA_PACKET_CANCEL_REQUEST MaPacketCancelRequest; + CSR_MA_VIF_AVAILABILITY_RESPONSE MaVifAvailabilityResponse; + CSR_MA_VIF_AVAILABILITY_INDICATION MaVifAvailabilityIndication; + CSR_MA_PACKET_ERROR_INDICATION MaPacketErrorIndication; + CSR_MLME_RESET_REQUEST MlmeResetRequest; + CSR_MLME_RESET_CONFIRM MlmeResetConfirm; + CSR_MLME_GET_REQUEST MlmeGetRequest; + CSR_MLME_GET_CONFIRM MlmeGetConfirm; + CSR_MLME_SET_REQUEST MlmeSetRequest; + CSR_MLME_SET_CONFIRM MlmeSetConfirm; + CSR_MLME_GET_NEXT_REQUEST MlmeGetNextRequest; + CSR_MLME_GET_NEXT_CONFIRM MlmeGetNextConfirm; + CSR_MLME_POWERMGT_REQUEST MlmePowermgtRequest; + CSR_MLME_POWERMGT_CONFIRM MlmePowermgtConfirm; + CSR_MLME_SCAN_REQUEST MlmeScanRequest; + CSR_MLME_SCAN_CONFIRM MlmeScanConfirm; + CSR_MLME_HL_SYNC_REQUEST MlmeHlSyncRequest; + CSR_MLME_HL_SYNC_CONFIRM MlmeHlSyncConfirm; + CSR_MLME_MEASURE_REQUEST MlmeMeasureRequest; + CSR_MLME_MEASURE_CONFIRM MlmeMeasureConfirm; + CSR_MLME_MEASURE_INDICATION MlmeMeasureIndication; + CSR_MLME_SETKEYS_REQUEST MlmeSetkeysRequest; + CSR_MLME_SETKEYS_CONFIRM MlmeSetkeysConfirm; + CSR_MLME_DELETEKEYS_REQUEST MlmeDeletekeysRequest; + CSR_MLME_DELETEKEYS_CONFIRM MlmeDeletekeysConfirm; + CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION MlmeAutonomousScanLossIndication; + CSR_MLME_CONNECTED_INDICATION MlmeConnectedIndication; + CSR_MLME_SCAN_CANCEL_REQUEST MlmeScanCancelRequest; + CSR_MLME_HL_SYNC_CANCEL_REQUEST MlmeHlSyncCancelRequest; + CSR_MLME_HL_SYNC_CANCEL_CONFIRM MlmeHlSyncCancelConfirm; + CSR_MLME_ADD_PERIODIC_REQUEST MlmeAddPeriodicRequest; + CSR_MLME_ADD_PERIODIC_CONFIRM MlmeAddPeriodicConfirm; + CSR_MLME_DEL_PERIODIC_REQUEST MlmeDelPeriodicRequest; + CSR_MLME_DEL_PERIODIC_CONFIRM MlmeDelPeriodicConfirm; + CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST MlmeAddAutonomousScanRequest; + CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM MlmeAddAutonomousScanConfirm; + CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST MlmeDelAutonomousScanRequest; + CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM MlmeDelAutonomousScanConfirm; + CSR_MLME_SET_PACKET_FILTER_REQUEST MlmeSetPacketFilterRequest; + CSR_MLME_SET_PACKET_FILTER_CONFIRM MlmeSetPacketFilterConfirm; + CSR_MLME_STOP_MEASURE_REQUEST MlmeStopMeasureRequest; + CSR_MLME_STOP_MEASURE_CONFIRM MlmeStopMeasureConfirm; + CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST MlmePauseAutonomousScanRequest; + CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM MlmePauseAutonomousScanConfirm; + CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION MlmeAutonomousScanDoneIndication; + CSR_MLME_ADD_TRIGGERED_GET_REQUEST MlmeAddTriggeredGetRequest; + CSR_MLME_ADD_TRIGGERED_GET_CONFIRM MlmeAddTriggeredGetConfirm; + CSR_MLME_DEL_TRIGGERED_GET_REQUEST MlmeDelTriggeredGetRequest; + CSR_MLME_DEL_TRIGGERED_GET_CONFIRM MlmeDelTriggeredGetConfirm; + CSR_MLME_TRIGGERED_GET_INDICATION MlmeTriggeredGetIndication; + CSR_MLME_ADD_BLACKOUT_REQUEST MlmeAddBlackoutRequest; + CSR_MLME_ADD_BLACKOUT_CONFIRM MlmeAddBlackoutConfirm; + CSR_MLME_BLACKOUT_ENDED_INDICATION MlmeBlackoutEndedIndication; + CSR_MLME_DEL_BLACKOUT_REQUEST MlmeDelBlackoutRequest; + CSR_MLME_DEL_BLACKOUT_CONFIRM MlmeDelBlackoutConfirm; + CSR_MLME_ADD_RX_TRIGGER_REQUEST MlmeAddRxTriggerRequest; + CSR_MLME_ADD_RX_TRIGGER_CONFIRM MlmeAddRxTriggerConfirm; + CSR_MLME_DEL_RX_TRIGGER_REQUEST MlmeDelRxTriggerRequest; + CSR_MLME_DEL_RX_TRIGGER_CONFIRM MlmeDelRxTriggerConfirm; + CSR_MLME_CONNECT_STATUS_REQUEST MlmeConnectStatusRequest; + CSR_MLME_CONNECT_STATUS_CONFIRM MlmeConnectStatusConfirm; + CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST MlmeModifyBssParameterRequest; + CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM MlmeModifyBssParameterConfirm; + CSR_MLME_ADD_TEMPLATE_REQUEST MlmeAddTemplateRequest; + CSR_MLME_ADD_TEMPLATE_CONFIRM MlmeAddTemplateConfirm; + CSR_MLME_CONFIG_QUEUE_REQUEST MlmeConfigQueueRequest; + CSR_MLME_CONFIG_QUEUE_CONFIRM MlmeConfigQueueConfirm; + CSR_MLME_ADD_TSPEC_REQUEST MlmeAddTspecRequest; + CSR_MLME_ADD_TSPEC_CONFIRM MlmeAddTspecConfirm; + CSR_MLME_DEL_TSPEC_REQUEST MlmeDelTspecRequest; + CSR_MLME_DEL_TSPEC_CONFIRM MlmeDelTspecConfirm; + CSR_MLME_START_AGGREGATION_REQUEST MlmeStartAggregationRequest; + CSR_MLME_START_AGGREGATION_CONFIRM MlmeStartAggregationConfirm; + CSR_MLME_BLOCKACK_ERROR_INDICATION MlmeBlockackErrorIndication; + CSR_MLME_STOP_AGGREGATION_REQUEST MlmeStopAggregationRequest; + CSR_MLME_STOP_AGGREGATION_CONFIRM MlmeStopAggregationConfirm; + CSR_MLME_SM_START_REQUEST MlmeSmStartRequest; + CSR_MLME_SM_START_CONFIRM MlmeSmStartConfirm; + CSR_MLME_LEAVE_REQUEST MlmeLeaveRequest; + CSR_MLME_LEAVE_CONFIRM MlmeLeaveConfirm; + CSR_MLME_SET_TIM_REQUEST MlmeSetTimRequest; + CSR_MLME_SET_TIM_CONFIRM MlmeSetTimConfirm; + CSR_MLME_GET_KEY_SEQUENCE_REQUEST MlmeGetKeySequenceRequest; + CSR_MLME_GET_KEY_SEQUENCE_CONFIRM MlmeGetKeySequenceConfirm; + CSR_MLME_SET_CHANNEL_REQUEST MlmeSetChannelRequest; + CSR_MLME_SET_CHANNEL_CONFIRM MlmeSetChannelConfirm; + CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST MlmeAddMulticastAddressRequest; + CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM MlmeAddMulticastAddressConfirm; + CSR_DEBUG_STRING_INDICATION DebugStringIndication; + CSR_DEBUG_WORD16_INDICATION DebugWord16Indication; + CSR_DEBUG_GENERIC_REQUEST DebugGenericRequest; + CSR_DEBUG_GENERIC_CONFIRM DebugGenericConfirm; + CSR_DEBUG_GENERIC_INDICATION DebugGenericIndication; + } u; +} CSR_SIGNAL; + +#define SIG_FILTER_SIZE 6 + +CsrUint32 SigGetFilterPos(CsrUint16 aSigID); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/drivers/staging/csr/csr_wifi_hip_ta_sampling.c b/drivers/staging/csr/csr_wifi_hip_ta_sampling.c new file mode 100644 index 0000000..4fa8f60 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_ta_sampling.c @@ -0,0 +1,535 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* + * --------------------------------------------------------------------------- + * FILE: csr_wifi_hip_ta_sampling.c + * + * PURPOSE: + * The traffic analysis sampling module. + * This gathers data which is sent to the SME and used to analyse + * the traffic behaviour. + * + * Provides: + * unifi_ta_sampling_init - Initialise the internal state + * unifi_ta_sample - Sampling function, call this for every data packet + * + * Calls these external functions which must be provided: + * unifi_ta_indicate_sampling - Pass sample data to the SME. + * unifi_ta_indicate_protocol - Report certain data packet types to the SME. + * --------------------------------------------------------------------------- + */ + +#include "csr_wifi_hip_card_sdio.h" + +/* Maximum number of Tx frames we store each CYCLE_1, for detecting period */ +#define TA_MAX_INTERVALS_IN_C1 100 + +/* Number of intervals in CYCLE_1 (one second), for detecting periodic */ +/* Must match size of unifi_TrafficStats.intervals - 1 */ +#define TA_INTERVALS_NUM 10 + +/* Step (in msecs) between intervals, for detecting periodic */ +/* We are only interested in periods up to 100ms, i.e. between beacons */ +/* This is correct for TA_INTERVALS_NUM=10 */ +#define TA_INTERVALS_STEP 10 + + +enum ta_frame_identity +{ + TA_FRAME_UNKNOWN, + TA_FRAME_ETHERNET_UNINTERESTING, + TA_FRAME_ETHERNET_INTERESTING +}; + + +#define TA_ETHERNET_TYPE_OFFSET 6 +#define TA_LLC_HEADER_SIZE 8 +#define TA_IP_TYPE_OFFSET 17 +#define TA_UDP_SOURCE_PORT_OFFSET 28 +#define TA_UDP_DEST_PORT_OFFSET (TA_UDP_SOURCE_PORT_OFFSET + 2) +#define TA_BOOTP_CLIENT_MAC_ADDR_OFFSET 64 +#define TA_DHCP_MESSAGE_TYPE_OFFSET 278 +#define TA_DHCP_MESSAGE_TYPE_ACK 0x05 +#define TA_PROTO_TYPE_IP 0x0800 +#define TA_PROTO_TYPE_EAP 0x888E +#define TA_PROTO_TYPE_WAI 0x8864 +#define TA_PROTO_TYPE_ARP 0x0806 +#define TA_IP_TYPE_TCP 0x06 +#define TA_IP_TYPE_UDP 0x11 +#define TA_UDP_PORT_BOOTPC 0x0044 +#define TA_UDP_PORT_BOOTPS 0x0043 +#define TA_EAPOL_TYPE_OFFSET 9 +#define TA_EAPOL_TYPE_START 0x01 + +static const CsrUint8 snap_802_2[3] = { 0xAA, 0xAA, 0x03 }; +static const CsrUint8 oui_rfc1042[3] = { 0x00, 0x00, 0x00 }; +static const CsrUint8 oui_8021h[3] = { 0x00, 0x00, 0xf8 }; +static const CsrUint8 aironet_snap[5] = { 0x00, 0x40, 0x96, 0x00, 0x00 }; + + +/* + * --------------------------------------------------------------------------- + * ta_detect_protocol + * + * Internal only. + * Detects a specific protocol in a frame and indicates a TA event. + * + * Arguments: + * ta The pointer to the TA module. + * direction The direction of the frame (tx or rx). + * data Pointer to the structure that contains the data. + * + * Returns: + * None + * --------------------------------------------------------------------------- + */ +static enum ta_frame_identity ta_detect_protocol(card_t *card, CsrWifiRouterCtrlProtocolDirection direction, + const bulk_data_desc_t *data, + const CsrUint8 *saddr, + const CsrUint8 *sta_macaddr) +{ + ta_data_t *tad = &card->ta_sampling; + CsrUint16 proto; + CsrUint16 source_port, dest_port; + CsrWifiMacAddress srcAddress; + + if (data->data_length < TA_LLC_HEADER_SIZE) + { + return TA_FRAME_UNKNOWN; + } + + if (CsrMemCmp(data->os_data_ptr, snap_802_2, 3)) + { + return TA_FRAME_UNKNOWN; + } + + if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM) + { + /* + * Here we would use the custom filter to detect interesting frames. + */ + } + + if (!CsrMemCmp(data->os_data_ptr + 3, oui_rfc1042, 3) || + !CsrMemCmp(data->os_data_ptr + 3, oui_8021h, 3)) + { + proto = (data->os_data_ptr[TA_ETHERNET_TYPE_OFFSET] * 256) + + data->os_data_ptr[TA_ETHERNET_TYPE_OFFSET + 1]; + + /* The only interesting IP frames are the DHCP */ + if (proto == TA_PROTO_TYPE_IP) + { + if (data->data_length > TA_IP_TYPE_OFFSET) + { + if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM) + { + ta_l4stats_t *ta_l4stats = &tad->ta_l4stats; + CsrUint8 l4proto = data->os_data_ptr[TA_IP_TYPE_OFFSET]; + + if (l4proto == TA_IP_TYPE_TCP) + { + if (direction == CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX) + { + ta_l4stats->txTcpBytesCount += data->data_length; + } + else + { + ta_l4stats->rxTcpBytesCount += data->data_length; + } + } + else if (l4proto == TA_IP_TYPE_UDP) + { + if (direction == CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX) + { + ta_l4stats->txUdpBytesCount += data->data_length; + } + else + { + ta_l4stats->rxUdpBytesCount += data->data_length; + } + } + } + + /* detect DHCP frames */ + if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP) + { + /* DHCP frames are UDP frames with BOOTP ports */ + if (data->os_data_ptr[TA_IP_TYPE_OFFSET] == TA_IP_TYPE_UDP) + { + if (data->data_length > TA_UDP_DEST_PORT_OFFSET) + { + source_port = (data->os_data_ptr[TA_UDP_SOURCE_PORT_OFFSET] * 256) + + data->os_data_ptr[TA_UDP_SOURCE_PORT_OFFSET + 1]; + dest_port = (data->os_data_ptr[TA_UDP_DEST_PORT_OFFSET] * 256) + + data->os_data_ptr[TA_UDP_DEST_PORT_OFFSET + 1]; + + if (((source_port == TA_UDP_PORT_BOOTPC) && (dest_port == TA_UDP_PORT_BOOTPS)) || + ((source_port == TA_UDP_PORT_BOOTPS) && (dest_port == TA_UDP_PORT_BOOTPC))) + { + /* The DHCP should have at least a message type (request, ack, nack, etc) */ + if (data->data_length > TA_DHCP_MESSAGE_TYPE_OFFSET + 6) + { + CsrMemCpy(srcAddress.a, saddr, 6); + + if (direction == CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX) + { + unifi_ta_indicate_protocol(card->ospriv, + CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP, + direction, + &srcAddress); + return TA_FRAME_ETHERNET_UNINTERESTING; + } + + /* DHCPACK is a special indication */ + if (!CsrMemCmp(data->os_data_ptr + TA_BOOTP_CLIENT_MAC_ADDR_OFFSET, sta_macaddr, 6)) + { + if (data->os_data_ptr[TA_DHCP_MESSAGE_TYPE_OFFSET] == TA_DHCP_MESSAGE_TYPE_ACK) + { + unifi_ta_indicate_protocol(card->ospriv, + CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP_ACK, + direction, + &srcAddress); + } + else + { + unifi_ta_indicate_protocol(card->ospriv, + CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP, + direction, + &srcAddress); + } + } + } + } + } + } + } + } + + return TA_FRAME_ETHERNET_INTERESTING; + } + + /* detect protocol type EAPOL or WAI (treated as equivalent here) */ + if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_EAPOL) + { + if (TA_PROTO_TYPE_EAP == proto || TA_PROTO_TYPE_WAI == proto) + { + if ((TA_PROTO_TYPE_WAI == proto) || (direction != CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX) || + (data->os_data_ptr[TA_EAPOL_TYPE_OFFSET] == TA_EAPOL_TYPE_START)) + { + CsrMemCpy(srcAddress.a, saddr, 6); + unifi_ta_indicate_protocol(card->ospriv, + CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_EAPOL, + direction, &srcAddress); + } + return TA_FRAME_ETHERNET_UNINTERESTING; + } + } + + /* detect protocol type 0x0806 (ARP) */ + if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_ARP) + { + if (proto == TA_PROTO_TYPE_ARP) + { + CsrMemCpy(srcAddress.a, saddr, 6); + unifi_ta_indicate_protocol(card->ospriv, + CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_ARP, + direction, &srcAddress); + return TA_FRAME_ETHERNET_UNINTERESTING; + } + } + + return TA_FRAME_ETHERNET_INTERESTING; + } + else if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_AIRONET) + { + /* detect Aironet frames */ + if (!CsrMemCmp(data->os_data_ptr + 3, aironet_snap, 5)) + { + CsrMemCpy(srcAddress.a, saddr, 6); + unifi_ta_indicate_protocol(card->ospriv, CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_AIRONET, + direction, &srcAddress); + } + } + + return TA_FRAME_ETHERNET_UNINTERESTING; +} /* ta_detect_protocol() */ + + +static void tas_reset_data(ta_data_t *tad) +{ + CsrInt16 i; + + for (i = 0; i < (TA_INTERVALS_NUM + 1); i++) + { + tad->stats.intervals[i] = 0; + } + + tad->stats.rxFramesNum = 0; + tad->stats.txFramesNum = 0; + tad->stats.rxBytesCount = 0; + tad->stats.txBytesCount = 0; + tad->stats.rxMeanRate = 0; + + tad->rx_sum_rate = 0; + + tad->ta_l4stats.rxTcpBytesCount = 0; + tad->ta_l4stats.txTcpBytesCount = 0; + tad->ta_l4stats.rxUdpBytesCount = 0; + tad->ta_l4stats.txUdpBytesCount = 0; +} /* tas_reset_data() */ + + +/* + * --------------------------------------------------------------------------- + * API. + * unifi_ta_sampling_init + * + * (Re)Initialise the Traffic Analysis sampling module. + * Resets the counters and timestamps. + * + * Arguments: + * tad Pointer to a ta_data_t structure containing the + * context for this device instance. + * drv_priv An opaque pointer that the TA sampling module will + * pass in call-outs. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +void unifi_ta_sampling_init(card_t *card) +{ + (void)unifi_ta_configure(card, CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_RESET, NULL); + + card->ta_sampling.packet_filter = CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_NONE; + card->ta_sampling.traffic_type = CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_OCCASIONAL; +} /* unifi_ta_sampling_init() */ + + +/* + * --------------------------------------------------------------------------- + * API. + * unifi_ta_sample + * + * Sample a data frame for the TA module. + * This function stores all the useful information it can extract from + * the frame and detects any specific protocols. + * + * Arguments: + * tad The pointer to the TA sampling context struct. + * direction The direction of the frame (rx, tx) + * data Pointer to the frame data + * saddr Source MAC address of frame. + * timestamp Time (in msecs) that the frame was received. + * rate Reported data rate for the rx frame (0 for tx frames) + * + * Returns: + * None + * --------------------------------------------------------------------------- + */ +void unifi_ta_sample(card_t *card, + CsrWifiRouterCtrlProtocolDirection direction, + const bulk_data_desc_t *data, + const CsrUint8 *saddr, + const CsrUint8 *sta_macaddr, + CsrUint32 timestamp, + CsrUint16 rate) +{ + ta_data_t *tad = &card->ta_sampling; + enum ta_frame_identity identity; + CsrUint32 time_delta; + + + + /* Step1: Check for specific frames */ + if (tad->packet_filter != CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_NONE) + { + identity = ta_detect_protocol(card, direction, data, saddr, sta_macaddr); + } + else + { + identity = TA_FRAME_ETHERNET_INTERESTING; + } + + + /* Step2: Update the information in the current record */ + if (direction == CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_RX) + { + /* Update the Rx packet count and the throughput count */ + tad->stats.rxFramesNum++; + tad->stats.rxBytesCount += data->data_length; + + /* Accumulate packet Rx rates for later averaging */ + tad->rx_sum_rate += rate; + } + else + { + if (identity == TA_FRAME_ETHERNET_INTERESTING) + { + /* + * Store the period between the last and the current frame. + * There is not point storing more than TA_MAX_INTERVALS_IN_C1 periods, + * the traffic will be bursty or continuous. + */ + if (tad->stats.txFramesNum < TA_MAX_INTERVALS_IN_C1) + { + CsrUint32 interval; + CsrUint32 index_in_intervals; + + interval = timestamp - tad->tx_last_ts; + tad->tx_last_ts = timestamp; + index_in_intervals = (interval + TA_INTERVALS_STEP / 2 - 1) / TA_INTERVALS_STEP; + + /* If the interval is interesting, update the t1_intervals count */ + if (index_in_intervals <= TA_INTERVALS_NUM) + { + unifi_trace(card->ospriv, UDBG5, + "unifi_ta_sample: TX interval=%d index=%d\n", + interval, index_in_intervals); + tad->stats.intervals[index_in_intervals]++; + } + } + } + + /* Update the Tx packet count... */ + tad->stats.txFramesNum++; + /* ... and the number of bytes for throughput. */ + tad->stats.txBytesCount += data->data_length; + } + + /* + * If more than one second has elapsed since the last report, send + * another one. + */ + /* Unsigned subtraction handles wrap-around from 0xFFFFFFFF to 0 */ + time_delta = timestamp - tad->last_indication_time; + if (time_delta >= 1000) + { + /* + * rxFramesNum can be flashed in tas_reset_data() by another thread. + * Use a temp to avoid division by zero. + */ + CsrUint32 temp_rxFramesNum; + temp_rxFramesNum = tad->stats.rxFramesNum; + + /* Calculate this interval's mean frame Rx rate from the sum */ + if (temp_rxFramesNum) + { + tad->stats.rxMeanRate = tad->rx_sum_rate / temp_rxFramesNum; + } + unifi_trace(card->ospriv, UDBG5, + "unifi_ta_sample: RX fr=%lu, r=%u, sum=%lu, av=%lu\n", + tad->stats.rxFramesNum, rate, + tad->rx_sum_rate, tad->stats.rxMeanRate); + + /* + * Send the information collected in the stats struct + * to the SME and reset the counters. + */ + if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM) + { + CsrUint32 rxTcpThroughput = tad->ta_l4stats.rxTcpBytesCount / time_delta; + CsrUint32 txTcpThroughput = tad->ta_l4stats.txTcpBytesCount / time_delta; + CsrUint32 rxUdpThroughput = tad->ta_l4stats.rxUdpBytesCount / time_delta; + CsrUint32 txUdpThroughput = tad->ta_l4stats.txUdpBytesCount / time_delta; + + unifi_ta_indicate_l4stats(card->ospriv, + rxTcpThroughput, + txTcpThroughput, + rxUdpThroughput, + txUdpThroughput + ); + } + unifi_ta_indicate_sampling(card->ospriv, &tad->stats); + tas_reset_data(tad); + tad->last_indication_time = timestamp; + } +} /* unifi_ta_sample() */ + + +/* + * --------------------------------------------------------------------------- + * External API. + * unifi_ta_configure + * + * Configures the TA module parameters. + * + * Arguments: + * ta The pointer to the TA module. + * config_type The type of the configuration request + * config Pointer to the configuration parameters. + * + * Returns: + * CSR_RESULT_SUCCESS on success, CSR error code otherwise + * --------------------------------------------------------------------------- + */ +CsrResult unifi_ta_configure(card_t *card, + CsrWifiRouterCtrlTrafficConfigType config_type, + const CsrWifiRouterCtrlTrafficConfig *config) +{ + ta_data_t *tad = &card->ta_sampling; + + /* Reinitialise our data when we are reset */ + if (config_type == CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_RESET) + { + /* Reset the stats to zero */ + tas_reset_data(tad); + + /* Reset the timer variables */ + tad->tx_last_ts = 0; + tad->last_indication_time = 0; + + return CSR_RESULT_SUCCESS; + } + + if (config_type == CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_FILTER) + { + tad->packet_filter = config->packetFilter; + + if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM) + { + tad->custom_filter = config->customFilter; + } + + return CSR_RESULT_SUCCESS; + } + + return CSR_RESULT_SUCCESS; +} /* unifi_ta_configure() */ + + +/* + * --------------------------------------------------------------------------- + * External API. + * unifi_ta_classification + * + * Configures the current TA classification. + * + * Arguments: + * ta The pointer to the TA module. + * traffic_type The classification type + * period The traffic period if the type is periodic + * + * Returns: + * None + * --------------------------------------------------------------------------- + */ +void unifi_ta_classification(card_t *card, + CsrWifiRouterCtrlTrafficType traffic_type, + CsrUint16 period) +{ + unifi_trace(card->ospriv, UDBG3, + "Changed current ta classification to: %d\n", traffic_type); + + card->ta_sampling.traffic_type = traffic_type; +} + + diff --git a/drivers/staging/csr/csr_wifi_hip_ta_sampling.h b/drivers/staging/csr/csr_wifi_hip_ta_sampling.h new file mode 100644 index 0000000..602943e --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_ta_sampling.h @@ -0,0 +1,75 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* + * --------------------------------------------------------------------------- + * FILE: csr_wifi_hip_ta_sampling.h + * + * PURPOSE: + * This file contains Traffic Analysis definitions common to the + * sampling and analysis modules. + * + * --------------------------------------------------------------------------- + */ +#ifndef __TA_SAMPLING_H__ +#define __TA_SAMPLING_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "csr_wifi_hip_unifi.h" + +typedef struct ta_l4stats +{ + CsrUint32 rxTcpBytesCount; + CsrUint32 txTcpBytesCount; + CsrUint32 rxUdpBytesCount; + CsrUint32 txUdpBytesCount; +} ta_l4stats_t; + +/* + * Context structure to preserve state between calls. + */ + +typedef struct ta_data +{ + /* Current packet filter configuration */ + CsrUint16 packet_filter; + + /* Current packet custom filter configuration */ + CsrWifiRouterCtrlTrafficFilter custom_filter; + + /* The timestamp of the last tx packet processed. */ + CsrUint32 tx_last_ts; + + /* The timestamp of the last packet processed. */ + CsrUint32 last_indication_time; + + /* Statistics */ + CsrWifiRouterCtrlTrafficStats stats; + + /* Current traffic classification */ + CsrWifiRouterCtrlTrafficType traffic_type; + + /* Sum of packet rx rates for this interval used to calculate mean */ + CsrUint32 rx_sum_rate; + ta_l4stats_t ta_l4stats; +} ta_data_t; + + +void unifi_ta_sampling_init(card_t *card); + + +#ifdef __cplusplus +} +#endif + +#endif /* __TA_SAMPLING_H__ */ diff --git a/drivers/staging/csr/csr_wifi_hip_udi.c b/drivers/staging/csr/csr_wifi_hip_udi.c new file mode 100644 index 0000000..2cf0281 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_udi.c @@ -0,0 +1,268 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* + * --------------------------------------------------------------------------- + * FILE: csr_wifi_hip_card_udi.c + * + * PURPOSE: + * Maintain a list of callbacks to log UniFi exchanges to one or more + * debug/monitoring client applications. + * + * NOTES: + * Just call the UDI driver log fn directly for now. + * When done properly, each open() on the UDI device will install + * a log function. We will call all log fns whenever a signal is written + * to or read form the UniFi. + * + * --------------------------------------------------------------------------- + */ +#include "csr_wifi_hip_unifi.h" +#include "csr_wifi_hip_card.h" + + +/* + * --------------------------------------------------------------------------- + * unifi_print_status + * + * Print status info to given character buffer. + * + * Arguments: + * None. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +CsrInt32 unifi_print_status(card_t *card, CsrCharString *str, CsrInt32 *remain) +{ + CsrCharString *p = str; + sdio_config_data_t *cfg; + CsrUint16 i, n; + CsrInt32 remaining = *remain; + CsrInt32 written; +#ifdef CSR_UNSAFE_SDIO_ACCESS + CsrInt32 iostate; + CsrResult r; + static const CsrCharString *const states[] = { + "AWAKE", "DROWSY", "TORPID" + }; + #define SHARED_READ_RETRY_LIMIT 10 + CsrUint8 b; +#endif + + if (remaining <= 0) + { + return 0; + } + + i = n = 0; + written = CsrSnprintf(p, remaining, "Chip ID %u\n", + (CsrUint16)card->chip_id); + UNIFI_SNPRINTF_RET(p, remaining, written); + written = CsrSnprintf(p, remaining, "Chip Version %04X\n", + card->chip_version); + UNIFI_SNPRINTF_RET(p, remaining, written); + written = CsrSnprintf(p, remaining, "HIP v%u.%u\n", + (card->config_data.version >> 8) & 0xFF, + card->config_data.version & 0xFF); + UNIFI_SNPRINTF_RET(p, remaining, written); + written = CsrSnprintf(p, remaining, "Build %lu: %s\n", + card->build_id, card->build_id_string); + UNIFI_SNPRINTF_RET(p, remaining, written); + + cfg = &card->config_data; + + written = CsrSnprintf(p, remaining, "sdio ctrl offset %u\n", + cfg->sdio_ctrl_offset); + UNIFI_SNPRINTF_RET(p, remaining, written); + written = CsrSnprintf(p, remaining, "fromhost sigbuf handle %u\n", + cfg->fromhost_sigbuf_handle); + UNIFI_SNPRINTF_RET(p, remaining, written); + written = CsrSnprintf(p, remaining, "tohost_sigbuf_handle %u\n", + cfg->tohost_sigbuf_handle); + UNIFI_SNPRINTF_RET(p, remaining, written); + written = CsrSnprintf(p, remaining, "num_fromhost_sig_frags %u\n", + cfg->num_fromhost_sig_frags); + UNIFI_SNPRINTF_RET(p, remaining, written); + written = CsrSnprintf(p, remaining, "num_tohost_sig_frags %u\n", + cfg->num_tohost_sig_frags); + UNIFI_SNPRINTF_RET(p, remaining, written); + written = CsrSnprintf(p, remaining, "num_fromhost_data_slots %u\n", + cfg->num_fromhost_data_slots); + UNIFI_SNPRINTF_RET(p, remaining, written); + written = CsrSnprintf(p, remaining, "num_tohost_data_slots %u\n", + cfg->num_tohost_data_slots); + UNIFI_SNPRINTF_RET(p, remaining, written); + written = CsrSnprintf(p, remaining, "data_slot_size %u\n", + cfg->data_slot_size); + UNIFI_SNPRINTF_RET(p, remaining, written); + + /* Added by protocol version 0x0001 */ + written = CsrSnprintf(p, remaining, "overlay_size %u\n", + (CsrUint16)cfg->overlay_size); + UNIFI_SNPRINTF_RET(p, remaining, written); + + /* Added by protocol version 0x0300 */ + written = CsrSnprintf(p, remaining, "data_slot_round %u\n", + cfg->data_slot_round); + UNIFI_SNPRINTF_RET(p, remaining, written); + written = CsrSnprintf(p, remaining, "sig_frag_size %u\n", + cfg->sig_frag_size); + UNIFI_SNPRINTF_RET(p, remaining, written); + + /* Added by protocol version 0x0300 */ + written = CsrSnprintf(p, remaining, "tohost_sig_pad %u\n", + cfg->tohost_signal_padding); + UNIFI_SNPRINTF_RET(p, remaining, written); + + written = CsrSnprintf(p, remaining, "\nInternal state:\n"); + UNIFI_SNPRINTF_RET(p, remaining, written); + + written = CsrSnprintf(p, remaining, "Last PHY PANIC: %04x:%04x\n", + card->last_phy_panic_code, card->last_phy_panic_arg); + UNIFI_SNPRINTF_RET(p, remaining, written); + written = CsrSnprintf(p, remaining, "Last MAC PANIC: %04x:%04x\n", + card->last_mac_panic_code, card->last_mac_panic_arg); + UNIFI_SNPRINTF_RET(p, remaining, written); + + written = CsrSnprintf(p, remaining, "fhsr: %u\n", + (CsrUint16)card->from_host_signals_r); + UNIFI_SNPRINTF_RET(p, remaining, written); + written = CsrSnprintf(p, remaining, "fhsw: %u\n", + (CsrUint16)card->from_host_signals_w); + UNIFI_SNPRINTF_RET(p, remaining, written); + written = CsrSnprintf(p, remaining, "thsr: %u\n", + (CsrUint16)card->to_host_signals_r); + UNIFI_SNPRINTF_RET(p, remaining, written); + written = CsrSnprintf(p, remaining, "thsw: %u\n", + (CsrUint16)card->to_host_signals_w); + UNIFI_SNPRINTF_RET(p, remaining, written); + written = CsrSnprintf(p, remaining, + "fh buffer contains: %u signals, %u bytes\n", + card->fh_buffer.count, + card->fh_buffer.ptr - card->fh_buffer.buf); + UNIFI_SNPRINTF_RET(p, remaining, written); + + written = CsrSnprintf(p, remaining, "paused: "); + UNIFI_SNPRINTF_RET(p, remaining, written); + for (i = 0; i < sizeof(card->tx_q_paused_flag) / sizeof(card->tx_q_paused_flag[0]); i++) + { + written = CsrSnprintf(p, remaining, card->tx_q_paused_flag[i]?"1" : "0"); + UNIFI_SNPRINTF_RET(p, remaining, written); + } + written = CsrSnprintf(p, remaining, "\n"); + UNIFI_SNPRINTF_RET(p, remaining, written); + + written = CsrSnprintf(p, remaining, + "fh command q: %u waiting, %u free of %u:\n", + CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_command_queue), + CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_command_queue), + UNIFI_SOFT_COMMAND_Q_LENGTH); + UNIFI_SNPRINTF_RET(p, remaining, written); + for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) + { + written = CsrSnprintf(p, remaining, + "fh traffic q[%u]: %u waiting, %u free of %u:\n", + i, + CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_traffic_queue[i]), + CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_traffic_queue[i]), + UNIFI_SOFT_TRAFFIC_Q_LENGTH); + UNIFI_SNPRINTF_RET(p, remaining, written); + } + + written = CsrSnprintf(p, remaining, "fh data slots free: %u\n", + card->from_host_data?CardGetFreeFromHostDataSlots(card) : 0); + UNIFI_SNPRINTF_RET(p, remaining, written); + + + written = CsrSnprintf(p, remaining, "From host data slots:"); + UNIFI_SNPRINTF_RET(p, remaining, written); + n = card->config_data.num_fromhost_data_slots; + for (i = 0; i < n && card->from_host_data; i++) + { + written = CsrSnprintf(p, remaining, " %u", + (CsrUint16)card->from_host_data[i].bd.data_length); + UNIFI_SNPRINTF_RET(p, remaining, written); + } + written = CsrSnprintf(p, remaining, "\n"); + UNIFI_SNPRINTF_RET(p, remaining, written); + + written = CsrSnprintf(p, remaining, "To host data slots:"); + UNIFI_SNPRINTF_RET(p, remaining, written); + n = card->config_data.num_tohost_data_slots; + for (i = 0; i < n && card->to_host_data; i++) + { + written = CsrSnprintf(p, remaining, " %u", + (CsrUint16)card->to_host_data[i].data_length); + UNIFI_SNPRINTF_RET(p, remaining, written); + } + + written = CsrSnprintf(p, remaining, "\n"); + UNIFI_SNPRINTF_RET(p, remaining, written); + +#ifdef CSR_UNSAFE_SDIO_ACCESS + written = CsrSnprintf(p, remaining, "Host State: %s\n", states[card->host_state]); + UNIFI_SNPRINTF_RET(p, remaining, written); + + r = unifi_check_io_status(card, &iostate); + if (iostate == 1) + { + written = CsrSnprintf(p, remaining, "I/O Check: F1 disabled\n"); + UNIFI_SNPRINTF_RET(p, remaining, written); + } + else + { + if (iostate == 1) + { + written = CsrSnprintf(p, remaining, "I/O Check: pending interrupt\n"); + UNIFI_SNPRINTF_RET(p, remaining, written); + } + + written = CsrSnprintf(p, remaining, "BH reason interrupt = %d\n", + card->bh_reason_unifi); + UNIFI_SNPRINTF_RET(p, remaining, written); + written = CsrSnprintf(p, remaining, "BH reason host = %d\n", + card->bh_reason_host); + UNIFI_SNPRINTF_RET(p, remaining, written); + + for (i = 0; i < SHARED_READ_RETRY_LIMIT; i++) + { + r = unifi_read_8_or_16(card, card->sdio_ctrl_addr + 2, &b); + if ((r == CSR_RESULT_SUCCESS) && (!(b & 0x80))) + { + written = CsrSnprintf(p, remaining, "fhsr: %u (driver thinks is %u)\n", + b, card->from_host_signals_r); + UNIFI_SNPRINTF_RET(p, remaining, written); + break; + } + } + iostate = unifi_read_shared_count(card, card->sdio_ctrl_addr + 4); + written = CsrSnprintf(p, remaining, "thsw: %u (driver thinks is %u)\n", + iostate, card->to_host_signals_w); + UNIFI_SNPRINTF_RET(p, remaining, written); + } +#endif + + written = CsrSnprintf(p, remaining, "\nStats:\n"); + UNIFI_SNPRINTF_RET(p, remaining, written); + written = CsrSnprintf(p, remaining, "Total SDIO bytes: R=%lu W=%lu\n", + card->sdio_bytes_read, card->sdio_bytes_written); + + UNIFI_SNPRINTF_RET(p, remaining, written); + written = CsrSnprintf(p, remaining, "Interrupts generated on card: %lu\n", + card->unifi_interrupt_seq); + UNIFI_SNPRINTF_RET(p, remaining, written); + + *remain = remaining; + return (p - str); +} /* unifi_print_status() */ + + diff --git a/drivers/staging/csr/csr_wifi_hip_unifi.h b/drivers/staging/csr/csr_wifi_hip_unifi.h new file mode 100644 index 0000000..feda2e0 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_unifi.h @@ -0,0 +1,852 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* + * --------------------------------------------------------------------------- + * + * FILE : csr_wifi_hip_unifi.h + * + * PURPOSE : Public API for the UniFi HIP core library. + * + * --------------------------------------------------------------------------- + */ +#ifndef __CSR_WIFI_HIP_UNIFI_H__ +#define __CSR_WIFI_HIP_UNIFI_H__ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CSR_WIFI_HIP_TA_DISABLE +#include "csr_wifi_router_ctrl_prim.h" +#include "csr_wifi_router_prim.h" +#else +#include "csr_time.h" +#endif + +/* SDIO chip ID numbers */ + +/* Manufacturer id */ +#define SDIO_MANF_ID_CSR 0x032a + +/* Device id */ +#define SDIO_CARD_ID_UNIFI_1 0x0001 +#define SDIO_CARD_ID_UNIFI_2 0x0002 +#define SDIO_CARD_ID_UNIFI_3 0x0007 +#define SDIO_CARD_ID_UNIFI_4 0x0008 + +/* Function number for WLAN */ +#define SDIO_WLAN_FUNC_ID_UNIFI_1 0x0001 +#define SDIO_WLAN_FUNC_ID_UNIFI_2 0x0001 +#define SDIO_WLAN_FUNC_ID_UNIFI_3 0x0001 +#define SDIO_WLAN_FUNC_ID_UNIFI_4 0x0002 + +/* Maximum SDIO bus clock supported. */ +#define UNIFI_SDIO_CLOCK_MAX_HZ 50000000 /* Hz */ + +/* + * Initialisation SDIO bus clock. + * + * The initialisation clock speed should be used from when the chip has been + * reset until the first MLME-reset has been received (i.e. during firmware + * initialisation), unless UNIFI_SDIO_CLOCK_SAFE_HZ applies. + */ +#define UNIFI_SDIO_CLOCK_INIT_HZ 12500000 /* Hz */ + +/* + * Safe SDIO bus clock. + * + * The safe speed should be used when the chip is in deep sleep or + * it's state is unknown (just after reset / power on). + */ +#define UNIFI_SDIO_CLOCK_SAFE_HZ 1000000 /* Hz */ + +/* I/O default block size to use for UniFi. */ +#define UNIFI_IO_BLOCK_SIZE 64 + +#define UNIFI_WOL_OFF 0 +#define UNIFI_WOL_SDIO 1 +#define UNIFI_WOL_PIO 2 + +/* The number of Tx traffic queues */ +#define UNIFI_NO_OF_TX_QS 4 + +#define CSR_WIFI_HIP_RESERVED_HOST_TAG 0xFFFFFFFF + +/* + * The number of slots in the from-host queues. + * + * UNIFI_SOFT_TRAFFIC_Q_LENGTH is the number of slots in the traffic queues + * and there will be UNIFI_NO_OF_TX_QS of them. + * Traffic queues are used for data packets. + * + * UNIFI_SOFT_COMMAND_Q_LENGTH is the number of slots in the command queue. + * The command queue is used for MLME management requests. + * + * Queues are ring buffers and so must always have 1 unused slot. + */ +#define UNIFI_SOFT_TRAFFIC_Q_LENGTH (20 + 1) +#define UNIFI_SOFT_COMMAND_Q_LENGTH (16 + 1) + +#include "csr_types.h" /* from the synergy porting folder */ +#include "csr_framework_ext.h" /* from the synergy porting folder */ +#include "csr_sdio.h" /* from the synergy porting folder */ +#include "csr_pmem.h" /* from the synergy porting folder */ +#include "csr_util.h" /* from the synergy porting folder */ +#include "csr_formatted_io.h" /* from the synergy gsp folder */ +#include "csr_wifi_result.h" + + +/* Traffic queue ordered according to priority + * EAPOL/Uncontrolled port Queue should be the last + */ +typedef enum +{ + UNIFI_TRAFFIC_Q_BK = 0, + UNIFI_TRAFFIC_Q_BE, + UNIFI_TRAFFIC_Q_VI, + UNIFI_TRAFFIC_Q_VO, + UNIFI_TRAFFIC_Q_EAPOL, /* Non existant in HIP */ + UNIFI_TRAFFIC_Q_MAX, /* Non existant */ + UNIFI_TRAFFIC_Q_MLME /* Non existant */ +} unifi_TrafficQueue; + +/* + * Structure describing a bulk data slot. + * This structure is shared between the HIP core library and the OS + * layer. See the definition of unifi_net_data_malloc() for more details. + * + * The data_length field is used to indicate empty/occupied state. + * Needs to be defined before #include "unifi_os.h". + */ +typedef struct _bulk_data_desc +{ + const CsrUint8 *os_data_ptr; + CsrUint32 data_length; + const void *os_net_buf_ptr; + CsrUint32 net_buf_length; +} bulk_data_desc_t; + +/* Structure of an entry in the Symbol Look Up Table (SLUT). */ +typedef struct _symbol +{ + CsrUint16 id; + CsrUint32 obj; +} symbol_t; + +/* + * Header files need to be included from the current directory, + * the SME library, the synergy framework and the OS layer. + * A thin OS layer needs to be implemented in the porting exercise. + * + * Note that unifi_os.h should be included only in unifi.h + */ + +#include "unifi_os.h" + +/* + * Contains the HIP core definitions selected in the porting exercise, such as + * UNIFI_PAD_BULK_DATA_TO_BLOCK_SIZE and UNIFI_PAD_SIGNALS_TO_BLOCK_SIZE. + * Implemented in the OS layer, as part of the porting exersice. + */ +#include "unifi_config.h" + +#include "csr_wifi_hip_signals.h" /* from this dir */ + +/* + * The card structure is an opaque pointer that is used to pass context + * to the upper-edge API functions. + */ +typedef struct card card_t; + + +/* + * This structure describes all of the bulk data that 'might' be + * associated with a signal. + */ +typedef struct _bulk_data_param +{ + bulk_data_desc_t d[UNIFI_MAX_DATA_REFERENCES]; +} bulk_data_param_t; + + +/* + * This structure describes the chip and HIP core lib + * information that exposed to the OS layer. + */ +typedef struct _card_info +{ + CsrUint16 chip_id; + CsrUint16 chip_version; + CsrUint32 fw_build; + CsrUint16 fw_hip_version; + CsrUint32 sdio_block_size; +} card_info_t; + + +/* + * Mini-coredump definitions + */ +/* Definition of XAP memory ranges used by the mini-coredump system. + * Note that, these values are NOT the same as UNIFI_REGISTERS, etc + * in unifihw.h which don't allow selection of register areas for each XAP. + */ +typedef enum unifi_coredump_space +{ + UNIFI_COREDUMP_MAC_REG, + UNIFI_COREDUMP_PHY_REG, + UNIFI_COREDUMP_SH_DMEM, + UNIFI_COREDUMP_MAC_DMEM, + UNIFI_COREDUMP_PHY_DMEM, + UNIFI_COREDUMP_TRIGGER_MAGIC = 0xFEED +} unifi_coredump_space_t; + +/* Structure used to request a register value from a mini-coredump buffer */ +typedef struct unifi_coredump_req +{ + /* From user */ + CsrInt32 index; /* 0=newest, -1=oldest */ + unifi_coredump_space_t space; /* memory space */ + CsrUint32 offset; /* register offset in space */ + /* From driver */ + CsrUint32 drv_build; /* Driver build id */ + CsrUint32 chip_ver; /* Chip version */ + CsrUint32 fw_ver; /* Firmware version */ + CsrInt32 requestor; /* Requestor: 0=auto dump, 1=manual */ + CsrTime timestamp; /* time of capture by driver */ + CsrUint32 serial; /* capture serial number */ + CsrInt32 value; /* register value */ +} unifi_coredump_req_t; /* mini-coredumped reg value request */ + + +/** + * @defgroup upperedge Upper edge API + * + * The following functions are implemented in the HIP core lib. + */ + +/** + * + * Initialise the HIP core lib. + * Note that the OS layer must initialise the SDIO glue layer and obtain + * an SDIO function context, prior to this call. + * + * @param sdiopriv the SDIO function context. + * + * @param ospriv the OS layer context. + * + * @return \p card_t the HIP core lib API context. + * + * @ingroup upperedge + */ +card_t* unifi_alloc_card(CsrSdioFunction *sdiopriv, void *ospriv); + + +/** + * + * Initialise the UniFi chip. + * + * @param card the HIP core lib API context. + * + * @param led_mask the led mask to apply to UniFi. + * + * @return \b 0 if UniFi is initialized. + * + * @return \b -CSR_EIO if an I/O error occured while initializing UniFi + * + * @return \b -CSR_ENODEV if the card is no longer present. + * + * @ingroup upperedge + */ +CsrResult unifi_init_card(card_t *card, CsrInt32 led_mask); + +/** + * + * De-Initialise the HIP core lib. + * + * @param card the HIP core lib API context. + * + * @ingroup upperedge + */ +void unifi_free_card(card_t *card); + +/** + * + * Cancel all the signals pending in the HIP core lib. + * Normally used during a system suspend when the power is retained on UniFi. + * + * @param card the HIP core lib API context. + * + * @ingroup upperedge + */ +void unifi_cancel_pending_signals(card_t *card); + +/** + * + * Send a signal to UniFi. + * Normally it is called from unifi_sys_hip_req() and the OS layer + * Tx data plane. + * + * Note that the bulkdata buffers ownership is passed to the HIP core lib. + * These buffers must be allocated using unifi_net_data_malloc(). + * + * @param card the HIP core lib API context. + * + * @param sigptr pointer to the signal. + * + * @param siglen size of the signal. + * + * @param bulkdata pointer to the bulk data associated with the signal. + * + * @return \b 0 signal is sent. + * + * @return \b -CSR_EIO if an error occured while sending the signal + * + * @return \b -CSR_ENODEV if the card is no longer present. + * + * @ingroup upperedge + */ +CsrResult unifi_send_signal(card_t *card, const CsrUint8 *sigptr, + CsrUint32 siglen, + const bulk_data_param_t *bulkdata); + +/** + * + * Check if the HIP core lib has resources to send a signal. + * Normally there no need to use this function. + * + * @param card the HIP core lib API context. + * + * @param sigptr pointer to the signal. + * + * @return \b 0 if there are resources for the signal. + * + * @return \b -CSR_ENOSPC if there are not enough resources + * + * @ingroup upperedge + */ +CsrResult unifi_send_resources_available(card_t *card, const CsrUint8 *sigptr); + +/** + * + * Read the UniFi chip and the HIP core lib information. + * + * @param card the HIP core lib API context. + * + * @param card_info pointer to save the information. + * + * @ingroup upperedge + */ +void unifi_card_info(card_t *card, card_info_t *card_info); + +/** + * + * Print the UniFi I/O and Interrupt status. + * Normally it is used for debug purposes only. + * + * @param card the HIP core lib API context. + + * @param status buffer for the chip status + * + * @return \b 0 if the check was performed. + * + * @return \b -CSR_EIO if an error occured while checking the status. + * + * @return \b -CSR_ENODEV if the card is no longer present. + * + * @ingroup upperedge + */ +CsrResult unifi_check_io_status(card_t *card, CsrInt32 *status); + + +/** + * + * Run the HIP core lib Botton-Half. + * Whenever the HIP core lib want this function to be called + * by the OS layer, it calls unifi_run_bh(). + * + * @param card the HIP core lib API context. + * + * @param remaining pointer to return the time (in msecs) that this function + * should be re-scheduled. A return value of 0 means that no re-scheduling + * is required. If unifi_bh() is called before the timeout expires, + * the caller must pass in the remaining time. + * + * @return \b 0 if no error occured. + * + * @return \b -CSR_ENODEV if the card is no longer present. + * + * @return \b -CSR_E* if an error occured while running the bottom half. + * + * @ingroup upperedge + */ +CsrResult unifi_bh(card_t *card, CsrUint32 *remaining); + + +/** + * UniFi Low Power Mode (Deep Sleep Signaling) + * + * unifi_low_power_mode defines the UniFi Deep Sleep Signaling status. + * Use with unifi_configure_low_power_mode() to enable/disable + * the Deep Sleep Signaling. + */ +enum unifi_low_power_mode +{ + UNIFI_LOW_POWER_DISABLED, + UNIFI_LOW_POWER_ENABLED +}; + +/** + * Periodic Wake Host Mode + * + * unifi_periodic_wake_mode defines the Periodic Wake Host Mode. + * It can only be set to UNIFI_PERIODIC_WAKE_HOST_ENABLED if + * low_power_mode == UNIFI_LOW_POWER_ENABLED. + */ +enum unifi_periodic_wake_mode +{ + UNIFI_PERIODIC_WAKE_HOST_DISABLED, + UNIFI_PERIODIC_WAKE_HOST_ENABLED +}; + +/** + * + * Run the HIP core lib Botton-Half. + * Whenever the HIP core lib want this function to be called + * by the OS layer, it calls unifi_run_bh(). + * + * Typically, the SME is responsible for configuring these parameters, + * so unifi_sys_configure_power_mode_req() is usually implemented + * as a direct call to unifi_configure_low_power_mode(). + * + * Note: When polling mode is used instead of interrupts, + * low_power_mode must never be set to UNIFI_LOW_POWER_ENABLED. + * + * @param card the HIP core lib API context. + * + * @param low_power_mode the Low Power Mode. + * + * @param periodic_wake_mode the Periodic Wake Mode. + * + * @return \b 0 if no error occured. + * + * @return \b -CSR_E* if the request failed. + * + * @ingroup upperedge + */ +CsrResult unifi_configure_low_power_mode(card_t *card, + enum unifi_low_power_mode low_power_mode, + enum unifi_periodic_wake_mode periodic_wake_mode); + +/** + * + * Forces the UniFi chip to enter a Deep Sleep state. + * This is normally called by the OS layer when the platform suspends. + * + * Note that if the UniFi Low Power Mode is disabled this call fails. + * + * @param card the HIP core lib API context. + * + * @return \b 0 if no error occured. + * + * @return \b -CSR_ENODEV if the card is no longer present. + * + * @return \b -CSR_E* if the request failed. + * + * @ingroup upperedge + */ +CsrResult unifi_force_low_power_mode(card_t *card); + +#ifndef CSR_WIFI_HIP_TA_DISABLE +/** + * Configure the Traffic Analysis sampling + * + * Enable or disable statistics gathering. + * Enable or disable particular packet detection. + * + * @param card the HIP core context + * @param config_type the item to configure + * @param config pointer to struct containing config info + * + * @return \b 0 if configuration was successful + * + * @return \b -CSR_EINVAL if a parameter had an invalid value + * + * @ingroup upperedge + */ +CsrResult unifi_ta_configure(card_t *card, + CsrWifiRouterCtrlTrafficConfigType config_type, + const CsrWifiRouterCtrlTrafficConfig *config); + +/** + * Pass a packet for Traffic Analysis sampling + * + * @param card the HIP core context + * @param direction the direction (Rx or Tx) of the frame. + * @param data pointer to bulkdata struct containing the packet + * @param saddr the source address of the packet + * @param sta_macaddr the MAC address of the UniFi chip + * @param timestamp the current time in msecs + * + * @ingroup upperedge + */ +void unifi_ta_sample(card_t *card, + CsrWifiRouterCtrlProtocolDirection direction, + const bulk_data_desc_t *data, + const CsrUint8 *saddr, + const CsrUint8 *sta_macaddr, + CsrUint32 timestamp, + CsrUint16 rate); + +/** + * Notify the HIP core lib for a detected Traffic Classification. + * Typically, the SME is responsible for configuring these parameters, + * so unifi_sys_traffic_classification_req() is usually implemented + * as a direct call to unifi_ta_classification(). + * + * @param card the HIP core context. + * @param traffic_type the detected traffic type. + * @param period The detected period of the traffic. + * + * @ingroup upperedge + */ +void unifi_ta_classification(card_t *card, + CsrWifiRouterCtrlTrafficType traffic_type, + CsrUint16 period); + +#endif +/** + * Use software to hard reset the chip. + * This is a subset of the unifi_init_card() functionality and should + * only be used only to reset a paniced chip before a coredump is taken. + * + * @param card the HIP core context. + * + * @ingroup upperedge + */ +CsrResult unifi_card_hard_reset(card_t *card); + + +CsrResult unifi_card_readn(card_t *card, CsrUint32 unifi_addr, void *pdata, CsrUint16 len); +CsrResult unifi_card_read16(card_t *card, CsrUint32 unifi_addr, CsrUint16 *pdata); +CsrResult unifi_card_write16(card_t *card, CsrUint32 unifi_addr, CsrUint16 data); + + +enum unifi_dbg_processors_select +{ + UNIFI_PROC_MAC, + UNIFI_PROC_PHY, + UNIFI_PROC_BT, + UNIFI_PROC_BOTH, + UNIFI_PROC_INVALID +}; + +CsrResult unifi_card_stop_processor(card_t *card, enum unifi_dbg_processors_select which); + +/** + * Call-outs from the HIP core lib to the OS layer. + * The following functions need to be implemented during the porting exercise. + */ + +/** + * Selects appropriate queue according to priority + * Helps maintain uniformity in queue selection between the HIP + * and the OS layers. + * + * @param priority priority of the packet + * + * @return \b Traffic queue to which a packet of this priority belongs + * + * @ingroup upperedge + */ +unifi_TrafficQueue +unifi_frame_priority_to_queue(CSR_PRIORITY priority); + +/** + * Returns the priority corresponding to a particular Queue when that is used + * when downgrading a packet to a lower AC. + * Helps maintain uniformity in queue - priority mapping between the HIP + * and the OS layers. + * + * @param queue + * + * @return \b Highest priority corresponding to this queue + * + * @ingroup upperedge + */ +CSR_PRIORITY unifi_get_default_downgrade_priority(unifi_TrafficQueue queue); + +/** + * + * Flow control callbacks. + * unifi_pause_xmit() is called when the HIP core lib does not have any + * resources to store data packets. The OS layer needs to pause + * the Tx data plane until unifi_restart_xmit() is called. + * + * @param ospriv the OS layer context. + * + * @ingroup upperedge + */ +void unifi_pause_xmit(void *ospriv, unifi_TrafficQueue queue); +void unifi_restart_xmit(void *ospriv, unifi_TrafficQueue queue); + +/** + * + * Request to run the Bottom-Half. + * The HIP core lib calls this function to request that unifi_bh() + * needs to be run by the OS layer. It can be called anytime, i.e. + * when the unifi_bh() is running. + * Since unifi_bh() is not re-entrant, usually unifi_run_bh() sets + * an event to a thread that schedules a call to unifi_bh(). + * + * @param ospriv the OS layer context. + * + * @ingroup upperedge + */ +CsrResult unifi_run_bh(void *ospriv); + +/** + * + * Delivers a signal received from UniFi to the OS layer. + * Normally, the data signals should be delivered to the data plane + * and all the rest to the SME (unifi_sys_hip_ind()). + * + * Note that the OS layer is responsible for freeing the bulkdata + * buffers, using unifi_net_data_free(). + * + * @param ospriv the OS layer context. + * + * @param sigptr pointer to the signal. + * + * @param siglen size of the signal. + * + * @param bulkdata pointer to the bulk data associated with the signal. + * + * @ingroup upperedge + */ +void unifi_receive_event(void *ospriv, + CsrUint8 *sigdata, CsrUint32 siglen, + const bulk_data_param_t *bulkdata); + + +typedef struct +{ + CsrUint16 free_fh_sig_queue_slots[UNIFI_NO_OF_TX_QS]; + CsrUint16 free_fh_bulkdata_slots; + CsrUint16 free_fh_fw_slots; +} unifi_HipQosInfo; + +void unifi_get_hip_qos_info(card_t *card, unifi_HipQosInfo *hipqosinfo); + + +/** + * Functions that read a portion of a firmware file. + * + * Note: If the UniFi chip runs the f/w from ROM, the HIP core may never + * call these functions. Also, the HIP core may call these functions even if + * a f/w file is not available. In this case, it is safe to fail the request. + */ +#define UNIFI_FW_STA 1 /* Identify STA firmware file */ + +/** + * + * Ask the OS layer to initialise a read from a f/w file. + * + * @param ospriv the OS layer context. + * + * @param is_fw if 0 the request if for the loader file, if 1 the request + * is for a f/w file. + * + * @param info a card_info_t structure containing versions information. + * Note that some members of the structure may not be initialised. + * + * @return \p NULL if the file is not available, or a pointer which contains + * OS specific information for the file (typically the contents of the file) + * that the HIP core uses when calling unifi_fw_read() and unifi_fw_read_stop() + * + * @ingroup upperedge + */ +void* unifi_fw_read_start(void *ospriv, CsrInt8 is_fw, const card_info_t *info); + +/** + * + * Ask the OS layer to return a portion from a f/w file. + * + * @param ospriv the OS layer context. + * + * @param arg the OS pointer returned by unifi_fw_read_start(). + * + * @param offset the offset in the f/w file to read the read from. + * + * @param buf the buffer to store the returned data. + * + * @param len the size in bytes of the requested read. + * + * @ingroup upperedge + */ +CsrInt32 unifi_fw_read(void *ospriv, void *arg, CsrUint32 offset, void *buf, CsrUint32 len); + +/** + * + * Ask the OS layer to finish reading from a f/w file. + * + * @param ospriv the OS layer context. + * + * @param dlpriv the OS pointer returned by unifi_fw_read_start(). + * + * @ingroup upperedge + */ +void unifi_fw_read_stop(void *ospriv, void *dlpriv); + +/** + * + * Ask OS layer for a handle to a dynamically allocated firmware buffer + * (primarily intended for production test images which may need conversion) + * + * @param ospriv the OS layer context. + * + * @param fwbuf pointer to dynamically allocated buffer + * + * @param len length of provided buffer in bytes + * + * @ingroup upperedge + */ +void* unifi_fw_open_buffer(void *ospriv, void *fwbuf, CsrUint32 len); + +/** + * + * Release a handle to a dynamically allocated firmware buffer + * (primarily intended for production test images which may need conversion) + * + * @param ospriv the OS layer context. + * + * @param fwbuf pointer to dynamically allocated buffer + * + * @ingroup upperedge + */ +void unifi_fw_close_buffer(void *ospriv, void *fwbuf); + +#ifndef CSR_WIFI_HIP_TA_DISABLE +/* + * Driver must provide these. + * + * A simple implementation will just call + * unifi_sys_traffic_protocol_ind() or unifi_sys_traffic_classification_ind() + * respectively. See sme_csr_userspace/sme_userspace.c. + */ +/** + * + * Indicates a detected packet of type packet_type. + * Typically, this information is processed by the SME so + * unifi_ta_indicate_protocol() needs to schedule a call to + * unifi_sys_traffic_protocol_ind(). + * + * @param ospriv the OS layer context. + * + * @param packet_type the detected packet type. + * + * @param direction the direction of the packet (Rx, Tx). + * + * @param src_addr the source address of the packet. + * + * @ingroup upperedge + */ +void unifi_ta_indicate_protocol(void *ospriv, + CsrWifiRouterCtrlTrafficPacketType packet_type, + CsrWifiRouterCtrlProtocolDirection direction, + const CsrWifiMacAddress *src_addr); + +/** + * + * Indicates statistics for the sample data over a period. + * Typically, this information is processed by the SME so + * unifi_ta_indicate_sampling() needs to schedule a call to + * unifi_sys_traffic_sample_ind(). + * + * @param ospriv the OS layer context. + * + * @param stats the pointer to the structure that contains the statistics. + * + * @ingroup upperedge + */ +void unifi_ta_indicate_sampling(void *ospriv, CsrWifiRouterCtrlTrafficStats *stats); +void unifi_ta_indicate_l4stats(void *ospriv, + CsrUint32 rxTcpThroughput, + CsrUint32 txTcpThroughput, + CsrUint32 rxUdpThroughput, + CsrUint32 txUdpThroughput); +#endif + +void unifi_rx_queue_flush(void *ospriv); + +/** + * Call-out from the SDIO glue layer. + * + * The glue layer needs to call unifi_sdio_interrupt_handler() every time + * an interrupts occurs. + * + * @param card the HIP core context. + * + * @ingroup bottomedge + */ +void unifi_sdio_interrupt_handler(card_t *card); + + +/* HELPER FUNCTIONS */ + +/* + * unifi_init() and unifi_download() implement a subset of unifi_init_card functionality + * that excludes HIP initialization. + */ +CsrResult unifi_init(card_t *card); +CsrResult unifi_download(card_t *card, CsrInt32 led_mask); + +/* + * unifi_start_processors() ensures both on-chip processors are running + */ +CsrResult unifi_start_processors(card_t *card); + +CsrResult unifi_capture_panic(card_t *card); + +/* + * Configure HIP interrupt processing mode + */ +#define CSR_WIFI_INTMODE_DEFAULT 0 +#define CSR_WIFI_INTMODE_RUN_BH_ONCE 1 /* Run BH once per interrupt */ + +void unifi_set_interrupt_mode(card_t *card, CsrUint32 mode); + +/* + * unifi_request_max_clock() requests that max SDIO clock speed is set at the + * next suitable opportunity. + */ +void unifi_request_max_sdio_clock(card_t *card); + + +/* Functions to lookup bulk data command names. */ +const CsrCharString* lookup_bulkcmd_name(CsrUint16 id); + +/* Function to log HIP's global debug buffer */ +#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE +void unifi_debug_buf_dump(void); +#endif + +/* Mini-coredump utility functions */ +CsrResult unifi_coredump_get_value(card_t *card, struct unifi_coredump_req *req); +CsrResult unifi_coredump_capture(card_t *card, struct unifi_coredump_req *req); +CsrResult unifi_coredump_request_at_next_reset(card_t *card, CsrInt8 enable); +CsrResult unifi_coredump_init(card_t *card, CsrUint16 num_dump_buffers); +void unifi_coredump_free(card_t *card); + +#ifdef __cplusplus +} +#endif + +#endif /* __CSR_WIFI_HIP_UNIFI_H__ */ diff --git a/drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c b/drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c new file mode 100644 index 0000000..ee1970d --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c @@ -0,0 +1,46 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#include "csr_wifi_hip_unifi.h" + +struct sig_name +{ + CsrInt16 id; + const CsrCharString *name; +}; + +static const struct sig_name Unifi_bulkcmd_names[] = { + { 0, "SignalCmd" }, + { 1, "CopyToHost" }, + { 2, "CopyToHostAck" }, + { 3, "CopyFromHost" }, + { 4, "CopyFromHostAck" }, + { 5, "ClearSlot" }, + { 6, "CopyOverlay" }, + { 7, "CopyOverlayAck" }, + { 8, "CopyFromHostAndClearSlot" }, + { 15, "Padding" } +}; + +const CsrCharString* lookup_bulkcmd_name(CsrUint16 id) +{ + if (id < 9) + { + return Unifi_bulkcmd_names[id].name; + } + if (id == 15) + { + return "Padding"; + } + + return "UNKNOWN"; +} + + diff --git a/drivers/staging/csr/csr_wifi_hip_unifi_udi.h b/drivers/staging/csr/csr_wifi_hip_unifi_udi.h new file mode 100644 index 0000000..0873b7b --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_unifi_udi.h @@ -0,0 +1,76 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* + * --------------------------------------------------------------------------- + * FILE: csr_wifi_hip_unifi_udi.h + * + * PURPOSE: + * Declarations and definitions for the UniFi Debug Interface. + * + * --------------------------------------------------------------------------- + */ +#ifndef __CSR_WIFI_HIP_UNIFI_UDI_H__ +#define __CSR_WIFI_HIP_UNIFI_UDI_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "csr_wifi_hip_unifi.h" +#include "csr_wifi_hip_signals.h" + + +/* + * Support for tracing the wire protocol. + */ +enum udi_log_direction +{ + UDI_LOG_FROM_HOST = 0x0000, + UDI_LOG_TO_HOST = 0x0001 +}; + +typedef void (*udi_func_t)(void *ospriv, CsrUint8 *sigdata, + CsrUint32 signal_len, + const bulk_data_param_t *bulkdata, + enum udi_log_direction dir); + +CsrResult unifi_set_udi_hook(card_t *card, udi_func_t udi_fn); +CsrResult unifi_remove_udi_hook(card_t *card, udi_func_t udi_fn); + + +/* + * Function to print current status info to a string. + * This is used in the linux /proc interface and might be useful + * in other systems. + */ +CsrInt32 unifi_print_status(card_t *card, CsrCharString *str, CsrInt32 *remain); + +#define UNIFI_SNPRINTF_RET(buf_p, remain, written) \ + do { \ + if (written >= remain) { \ + if (remain >= 2) { \ + buf_p[remain - 2] = '\n'; \ + buf_p[remain - 1] = 0; \ + } \ + buf_p += remain; \ + remain = 0; \ + } else if (written > 0) { \ + buf_p += written; \ + remain -= written; \ + } \ + } while (0) + + +#ifdef __cplusplus +} +#endif + +#endif /* __CSR_WIFI_HIP_UNIFI_UDI_H__ */ diff --git a/drivers/staging/csr/csr_wifi_hip_unifihw.h b/drivers/staging/csr/csr_wifi_hip_unifihw.h new file mode 100644 index 0000000..5ffd6ba --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_unifihw.h @@ -0,0 +1,67 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* + * --------------------------------------------------------------------------- + * + * File: csr_wifi_hip_unifihw.h + * + * Definitions of various chip registers, addresses, values etc. + * + * --------------------------------------------------------------------------- + */ +#ifndef __UNIFIHW_H__ +#define __UNIFIHW_H__ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* Symbol Look Up Table fingerprint. IDs are in sigs.h */ +#define SLUT_FINGERPRINT 0xD397 + + +/* Values of LoaderOperation */ +#define UNIFI_LOADER_IDLE 0x00 +#define UNIFI_LOADER_COPY 0x01 +#define UNIFI_LOADER_ERROR_MASK 0xF0 + +/* Values of BootLoaderOperation */ +#define UNIFI_BOOT_LOADER_IDLE 0x00 +#define UNIFI_BOOT_LOADER_RESTART 0x01 +#define UNIFI_BOOT_LOADER_PATCH 0x02 +#define UNIFI_BOOT_LOADER_LOAD_STA 0x10 +#define UNIFI_BOOT_LOADER_LOAD_PTEST 0x11 + + +/* Memory spaces encoded in top byte of Generic Pointer type */ +#define UNIFI_SH_DMEM 0x01 /* Shared Data Memory */ +#define UNIFI_EXT_FLASH 0x02 /* External FLASH */ +#define UNIFI_EXT_SRAM 0x03 /* External SRAM */ +#define UNIFI_REGISTERS 0x04 /* Registers */ +#define UNIFI_PHY_DMEM 0x10 /* PHY Data Memory */ +#define UNIFI_PHY_PMEM 0x11 /* PHY Program Memory */ +#define UNIFI_PHY_ROM 0x12 /* PHY ROM */ +#define UNIFI_MAC_DMEM 0x20 /* MAC Data Memory */ +#define UNIFI_MAC_PMEM 0x21 /* MAC Program Memory */ +#define UNIFI_MAC_ROM 0x22 /* MAC ROM */ +#define UNIFI_BT_DMEM 0x30 /* BT Data Memory */ +#define UNIFI_BT_PMEM 0x31 /* BT Program Memory */ +#define UNIFI_BT_ROM 0x32 /* BT ROM */ + +#define UNIFI_MAKE_GP(R, O) (((UNIFI_ ## R) << 24) | (O)) +#define UNIFI_GP_OFFSET(GP) ((GP) & 0xFFFFFF) +#define UNIFI_GP_SPACE(GP) (((GP) >> 24) & 0xFF) + +#ifdef __cplusplus +} +#endif + +#endif /* __UNIFIHW_H__ */ diff --git a/drivers/staging/csr/csr_wifi_hip_unifiversion.h b/drivers/staging/csr/csr_wifi_hip_unifiversion.h new file mode 100644 index 0000000..e1fdbb2 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_unifiversion.h @@ -0,0 +1,38 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* + * --------------------------------------------------------------------------- + * FILE: unifiversion.h + * + * PURPOSE: + * Version information for the portable UniFi driver. + * + * --------------------------------------------------------------------------- + */ + +#ifndef __UNIFIVERSION_H__ +#define __UNIFIVERSION_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The minimum version of Host Interface Protocol required by the driver. + */ +#define UNIFI_HIP_MAJOR_VERSION 9 +#define UNIFI_HIP_MINOR_VERSION 1 + +#ifdef __cplusplus +} +#endif + +#endif /* __UNIFIVERSION_H__ */ diff --git a/drivers/staging/csr/csr_wifi_hip_xbv.c b/drivers/staging/csr/csr_wifi_hip_xbv.c new file mode 100644 index 0000000..5d0fdcc --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_xbv.c @@ -0,0 +1,1075 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* + * --------------------------------------------------------------------------- + * FILE: csr_wifi_hip_xbv.c + * + * PURPOSE: + * Routines for downloading firmware to UniFi. + * + * UniFi firmware files use a nested TLV (Tag-Length-Value) format. + * + * --------------------------------------------------------------------------- + */ + +#ifdef CSR_WIFI_XBV_TEST +/* Standalone test harness */ +#include "unifi_xbv.h" +#include "csr_wifi_hip_unifihw.h" +#else +/* Normal driver build */ +#include "csr_wifi_hip_unifiversion.h" +#include "csr_wifi_hip_card.h" +#define DBG_TAG(t) +#endif + +#include "csr_wifi_hip_xbv.h" + +#define STREAM_CHECKSUM 0x6d34 /* Sum of uint16s in each patch stream */ + +/* XBV sizes used in patch conversion + */ +#define PTDL_MAX_SIZE 2048 /* Max bytes allowed per PTDL */ +#define PTDL_HDR_SIZE (4 + 2 + 6 + 2) /* sizeof(fw_id, sec_len, patch_cmd, csum) */ + +/* Struct to represent a buffer for reading firmware file */ + +typedef struct +{ + void *dlpriv; + CsrInt32 ioffset; + fwreadfn_t iread; +} ct_t; + +/* Struct to represent a TLV field */ +typedef struct +{ + CsrCharString t_name[4]; + CsrUint32 t_len; +} tag_t; + + +#define TAG_EQ(i, v) (((i)[0] == (v)[0]) && \ + ((i)[1] == (v)[1]) && \ + ((i)[2] == (v)[2]) && \ + ((i)[3] == (v)[3])) + +/* We create a small stack on the stack that contains an enum + * indicating the containing list segments, and the offset at which + * those lists end. This enables a lot more error checking. */ +typedef enum +{ + xbv_xbv1, + /*xbv_info,*/ + xbv_fw, + xbv_vers, + xbv_vand, + xbv_ptch, + xbv_other +} xbv_container; + +#define XBV_STACK_SIZE 6 +#define XBV_MAX_OFFS 0x7fffffff + +typedef struct +{ + struct + { + xbv_container container; + CsrInt32 ioffset_end; + } s[XBV_STACK_SIZE]; + CsrUint32 ptr; +} xbv_stack_t; + +static CsrInt32 read_tag(card_t *card, ct_t *ct, tag_t *tag); +static CsrInt32 read_bytes(card_t *card, ct_t *ct, void *buf, CsrUint32 len); +static CsrInt32 read_uint(card_t *card, ct_t *ct, CsrUint32 *u, CsrUint32 len); +static CsrInt32 xbv_check(xbv1_t *fwinfo, const xbv_stack_t *stack, + xbv_mode new_mode, xbv_container old_cont); +static CsrInt32 xbv_push(xbv1_t *fwinfo, xbv_stack_t *stack, + xbv_mode new_mode, xbv_container old_cont, + xbv_container new_cont, CsrUint32 ioff); + +static CsrUint32 write_uint16(void *buf, const CsrUint32 offset, + const CsrUint16 val); +static CsrUint32 write_uint32(void *buf, const CsrUint32 offset, + const CsrUint32 val); +static CsrUint32 write_bytes(void *buf, const CsrUint32 offset, + const CsrUint8 *data, const CsrUint32 len); +static CsrUint32 write_tag(void *buf, const CsrUint32 offset, + const CsrCharString *tag_str); +static CsrUint32 write_chunk(void *buf, const CsrUint32 offset, + const CsrCharString *tag_str, + const CsrUint32 payload_len); +static CsrUint16 calc_checksum(void *buf, const CsrUint32 offset, + const CsrUint32 bytes_len); +static CsrUint32 calc_patch_size(const xbv1_t *fwinfo); + +static CsrUint32 write_xbv_header(void *buf, const CsrUint32 offset, + const CsrUint32 file_payload_length); +static CsrUint32 write_ptch_header(void *buf, const CsrUint32 offset, + const CsrUint32 fw_id); +static CsrUint32 write_patchcmd(void *buf, const CsrUint32 offset, + const CsrUint32 dst_genaddr, const CsrUint16 len); +static CsrUint32 write_reset_ptdl(void *buf, const CsrUint32 offset, + const xbv1_t *fwinfo, CsrUint32 fw_id); +static CsrUint32 write_fwdl_to_ptdl(void *buf, const CsrUint32 offset, + fwreadfn_t readfn, const struct FWDL *fwdl, + const void *fw_buf, const CsrUint32 fw_id, + void *rdbuf); + +/* + * --------------------------------------------------------------------------- + * parse_xbv1 + * + * Scan the firmware file to find the TLVs we are interested in. + * Actions performed: + * - check we support the file format version in VERF + * Store these TLVs if we have a firmware image: + * - SLTP Symbol Lookup Table Pointer + * - FWDL firmware download segments + * - FWOL firmware overlay segment + * - VMEQ Register probe tests to verify matching h/w + * Store these TLVs if we have a patch file: + * - FWID the firmware build ID that this file patches + * - PTDL The actual patches + * + * The structure pointed to by fwinfo is cleared and + * 'fwinfo->mode' is set to 'unknown'. The 'fwinfo->mode' + * variable is set to 'firmware' or 'patch' once we know which + * sort of XBV file we have. + * + * Arguments: + * readfn Pointer to function to call to read from the file. + * dlpriv Opaque pointer arg to pass to readfn. + * fwinfo Pointer to fwinfo struct to fill in. + * + * Returns: + * CSR_RESULT_SUCCESS on success, CSR error code on failure + * --------------------------------------------------------------------------- + */ +CsrResult xbv1_parse(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo) +{ + ct_t ct; + tag_t tag; + xbv_stack_t stack; + + ct.dlpriv = dlpriv; + ct.ioffset = 0; + ct.iread = readfn; + + CsrMemSet(fwinfo, 0, sizeof(xbv1_t)); + fwinfo->mode = xbv_unknown; + + /* File must start with XBV1 triplet */ + if (read_tag(card, &ct, &tag) <= 0) + { + unifi_error(NULL, "File is not UniFi firmware\n"); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + DBG_TAG(tag.t_name); + + if (!TAG_EQ(tag.t_name, "XBV1")) + { + unifi_error(NULL, "File is not UniFi firmware (%s)\n", tag.t_name); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + stack.ptr = 0; + stack.s[stack.ptr].container = xbv_xbv1; + stack.s[stack.ptr].ioffset_end = XBV_MAX_OFFS; + + /* Now scan the file */ + while (1) + { + CsrInt32 n; + + n = read_tag(card, &ct, &tag); + if (n < 0) + { + unifi_error(NULL, "No tag\n"); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + if (n == 0) + { + /* End of file */ + break; + } + + DBG_TAG(tag.t_name); + + /* File format version */ + if (TAG_EQ(tag.t_name, "VERF")) + { + CsrUint32 version; + + if (xbv_check(fwinfo, &stack, xbv_unknown, xbv_xbv1) || + (tag.t_len != 2) || + read_uint(card, &ct, &version, 2)) + { + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + if (version != 0) + { + unifi_error(NULL, "Unsupported firmware file version: %d.%d\n", + version >> 8, version & 0xFF); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + } + else if (TAG_EQ(tag.t_name, "LIST")) + { + CsrCharString name[4]; + CsrUint32 list_end; + + list_end = ct.ioffset + tag.t_len; + + if (read_bytes(card, &ct, name, 4)) + { + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + DBG_TAG(name); + if (TAG_EQ(name, "FW ")) + { + if (xbv_push(fwinfo, &stack, xbv_firmware, xbv_xbv1, xbv_fw, list_end)) + { + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + } + else if (TAG_EQ(name, "VERS")) + { + if (xbv_push(fwinfo, &stack, xbv_firmware, xbv_fw, xbv_vers, list_end) || + (fwinfo->vers.num_vand != 0)) + { + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + } + else if (TAG_EQ(name, "VAND")) + { + struct VAND *vand; + + if (xbv_push(fwinfo, &stack, xbv_firmware, xbv_vers, xbv_vand, list_end) || + (fwinfo->vers.num_vand >= MAX_VAND)) + { + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + /* Get a new VAND */ + vand = fwinfo->vand + fwinfo->vers.num_vand++; + + /* Fill it in */ + vand->first = fwinfo->num_vmeq; + vand->count = 0; + } + else if (TAG_EQ(name, "PTCH")) + { + if (xbv_push(fwinfo, &stack, xbv_patch, xbv_xbv1, xbv_ptch, list_end)) + { + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + } + else + { + /* Skip over any other lists. We dont bother to push + * the new list type now as we would only pop it at + * the end of the outer loop. */ + ct.ioffset += tag.t_len - 4; + } + } + else if (TAG_EQ(tag.t_name, "SLTP")) + { + CsrUint32 addr; + + if (xbv_check(fwinfo, &stack, xbv_firmware, xbv_fw) || + (tag.t_len != 4) || + (fwinfo->slut_addr != 0) || + read_uint(card, &ct, &addr, 4)) + { + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + fwinfo->slut_addr = addr; + } + else if (TAG_EQ(tag.t_name, "FWDL")) + { + CsrUint32 addr; + struct FWDL *fwdl; + + if (xbv_check(fwinfo, &stack, xbv_firmware, xbv_fw) || + (fwinfo->num_fwdl >= MAX_FWDL) || + (read_uint(card, &ct, &addr, 4))) + { + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + fwdl = fwinfo->fwdl + fwinfo->num_fwdl++; + + fwdl->dl_size = tag.t_len - 4; + fwdl->dl_addr = addr; + fwdl->dl_offset = ct.ioffset; + + ct.ioffset += tag.t_len - 4; + } + else if (TAG_EQ(tag.t_name, "FWOV")) + { + if (xbv_check(fwinfo, &stack, xbv_firmware, xbv_fw) || + (fwinfo->fwov.dl_size != 0) || + (fwinfo->fwov.dl_offset != 0)) + { + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + fwinfo->fwov.dl_size = tag.t_len; + fwinfo->fwov.dl_offset = ct.ioffset; + + ct.ioffset += tag.t_len; + } + else if (TAG_EQ(tag.t_name, "VMEQ")) + { + CsrUint32 temp[3]; + struct VAND *vand; + struct VMEQ *vmeq; + + if (xbv_check(fwinfo, &stack, xbv_firmware, xbv_vand) || + (fwinfo->num_vmeq >= MAX_VMEQ) || + (fwinfo->vers.num_vand == 0) || + (tag.t_len != 8) || + read_uint(card, &ct, &temp[0], 4) || + read_uint(card, &ct, &temp[1], 2) || + read_uint(card, &ct, &temp[2], 2)) + { + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + /* Get the last VAND */ + vand = fwinfo->vand + (fwinfo->vers.num_vand - 1); + + /* Get a new VMEQ */ + vmeq = fwinfo->vmeq + fwinfo->num_vmeq++; + + /* Note that this VAND contains another VMEQ */ + vand->count++; + + /* Fill in the VMEQ */ + vmeq->addr = temp[0]; + vmeq->mask = (CsrUint16)temp[1]; + vmeq->value = (CsrUint16)temp[2]; + } + else if (TAG_EQ(tag.t_name, "FWID")) + { + CsrUint32 build_id; + + if (xbv_check(fwinfo, &stack, xbv_patch, xbv_ptch) || + (tag.t_len != 4) || + (fwinfo->build_id != 0) || + read_uint(card, &ct, &build_id, 4)) + { + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + fwinfo->build_id = build_id; + } + else if (TAG_EQ(tag.t_name, "PTDL")) + { + struct PTDL *ptdl; + + if (xbv_check(fwinfo, &stack, xbv_patch, xbv_ptch) || + (fwinfo->num_ptdl >= MAX_PTDL)) + { + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + /* Allocate a new PTDL */ + ptdl = fwinfo->ptdl + fwinfo->num_ptdl++; + + ptdl->dl_size = tag.t_len; + ptdl->dl_offset = ct.ioffset; + + ct.ioffset += tag.t_len; + } + else + { + /* + * If we get here it is a tag we are not interested in, + * just skip over it. + */ + ct.ioffset += tag.t_len; + } + + /* Check to see if we are at the end of the currently stacked + * segment. We could finish more than one list at a time. */ + while (ct.ioffset >= stack.s[stack.ptr].ioffset_end) + { + if (ct.ioffset > stack.s[stack.ptr].ioffset_end) + { + unifi_error(NULL, + "XBV file has overrun stack'd segment %d (%d > %d)\n", + stack.ptr, ct.ioffset, stack.s[stack.ptr].ioffset_end); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + if (stack.ptr <= 0) + { + unifi_error(NULL, "XBV file has underrun stack pointer\n"); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + stack.ptr--; + } + } + + if (stack.ptr != 0) + { + unifi_error(NULL, "Last list of XBV is not complete.\n"); + return CSR_WIFI_HIP_RESULT_INVALID_VALUE; + } + + return CSR_RESULT_SUCCESS; +} /* xbv1_parse() */ + + +/* Check the the XBV file is of a consistant sort (either firmware or + * patch) and that we are in the correct containing list type. */ +static CsrInt32 xbv_check(xbv1_t *fwinfo, const xbv_stack_t *stack, + xbv_mode new_mode, xbv_container old_cont) +{ + /* If the new file mode is unknown the current packet could be in + * either (any) type of XBV file, and we cant make a decission at + * this time. */ + if (new_mode != xbv_unknown) + { + if (fwinfo->mode == xbv_unknown) + { + fwinfo->mode = new_mode; + } + else if (fwinfo->mode != new_mode) + { + return -1; + } + } + /* If the current stack top doesn't match what we expect then the + * file is corrupt. */ + if (stack->s[stack->ptr].container != old_cont) + { + return -1; + } + return 0; +} + + +/* Make checks as above and then enter a new list */ +static CsrInt32 xbv_push(xbv1_t *fwinfo, xbv_stack_t *stack, + xbv_mode new_mode, xbv_container old_cont, + xbv_container new_cont, CsrUint32 new_ioff) +{ + if (xbv_check(fwinfo, stack, new_mode, old_cont)) + { + return -1; + } + + /* Check that our stack won't overflow. */ + if (stack->ptr >= (XBV_STACK_SIZE - 1)) + { + return -1; + } + + /* Add the new list element to the top of the stack. */ + stack->ptr++; + stack->s[stack->ptr].container = new_cont; + stack->s[stack->ptr].ioffset_end = new_ioff; + + return 0; +} + + +static CsrUint32 xbv2uint(CsrUint8 *ptr, CsrInt32 len) +{ + CsrUint32 u = 0; + CsrInt16 i; + + for (i = 0; i < len; i++) + { + CsrUint32 b; + b = ptr[i]; + u += b << (i * 8); + } + return u; +} + + +static CsrInt32 read_tag(card_t *card, ct_t *ct, tag_t *tag) +{ + CsrUint8 buf[8]; + CsrInt32 n; + + n = (*ct->iread)(card->ospriv, ct->dlpriv, ct->ioffset, buf, 8); + if (n <= 0) + { + return n; + } + + /* read the tag and length */ + if (n != 8) + { + return -1; + } + + /* get section tag */ + CsrMemCpy(tag->t_name, buf, 4); + + /* get section length */ + tag->t_len = xbv2uint(buf + 4, 4); + + ct->ioffset += 8; + + return 8; +} /* read_tag() */ + + +static CsrInt32 read_bytes(card_t *card, ct_t *ct, void *buf, CsrUint32 len) +{ + /* read the tag value */ + if ((*ct->iread)(card->ospriv, ct->dlpriv, ct->ioffset, buf, len) != (CsrInt32)len) + { + return -1; + } + + ct->ioffset += len; + + return 0; +} /* read_bytes() */ + + +static CsrInt32 read_uint(card_t *card, ct_t *ct, CsrUint32 *u, CsrUint32 len) +{ + CsrUint8 buf[4]; + + /* Integer cannot be more than 4 bytes */ + if (len > 4) + { + return -1; + } + + if (read_bytes(card, ct, buf, len)) + { + return -1; + } + + *u = xbv2uint(buf, len); + + return 0; +} /* read_uint() */ + + +static CsrUint32 write_uint16(void *buf, const CsrUint32 offset, const CsrUint16 val) +{ + CsrUint8 *dst = (CsrUint8 *)buf + offset; + *dst++ = (CsrUint8)(val & 0xff); /* LSB first */ + *dst = (CsrUint8)(val >> 8); + return sizeof(CsrUint16); +} + + +static CsrUint32 write_uint32(void *buf, const CsrUint32 offset, const CsrUint32 val) +{ + write_uint16(buf, offset + 0, (CsrUint16)(val & 0xffff)); + write_uint16(buf, offset + 2, (CsrUint16)(val >> 16)); + return sizeof(CsrUint32); +} + + +static CsrUint32 write_bytes(void *buf, const CsrUint32 offset, const CsrUint8 *data, const CsrUint32 len) +{ + CsrUint32 i; + CsrUint8 *dst = (CsrUint8 *)buf + offset; + + for (i = 0; i < len; i++) + { + *dst++ = *((CsrUint8 *)data + i); + } + return len; +} + + +static CsrUint32 write_tag(void *buf, const CsrUint32 offset, const CsrCharString *tag_str) +{ + CsrUint8 *dst = (CsrUint8 *)buf + offset; + CsrMemCpy(dst, tag_str, 4); + return 4; +} + + +static CsrUint32 write_chunk(void *buf, const CsrUint32 offset, const CsrCharString *tag_str, const CsrUint32 payload_len) +{ + CsrUint32 written = 0; + written += write_tag(buf, offset, tag_str); + written += write_uint32(buf, written + offset, (CsrUint32)payload_len); + + return written; +} + + +static CsrUint16 calc_checksum(void *buf, const CsrUint32 offset, const CsrUint32 bytes_len) +{ + CsrUint32 i; + CsrUint8 *src = (CsrUint8 *)buf + offset; + CsrUint16 sum = 0; + CsrUint16 val; + + for (i = 0; i < bytes_len / 2; i++) + { + /* Contents copied to file is LE, host might not be */ + val = (CsrUint16) * src++; /* LSB */ + val += (CsrUint16)(*src++) << 8; /* MSB */ + sum += val; + } + + /* Total of uint16s in the stream plus the stored check value + * should equal STREAM_CHECKSUM when decoded. + */ + return (STREAM_CHECKSUM - sum); +} + + +#define PTDL_RESET_DATA_SIZE 20 /* Size of reset vectors PTDL */ + +static CsrUint32 calc_patch_size(const xbv1_t *fwinfo) +{ + CsrInt16 i; + CsrUint32 size = 0; + + /* + * Work out how big an equivalent patch format file must be for this image. + * This only needs to be approximate, so long as it's large enough. + */ + if (fwinfo->mode != xbv_firmware) + { + return 0; + } + + /* Payload (which will get put into a series of PTDLs) */ + for (i = 0; i < fwinfo->num_fwdl; i++) + { + size += fwinfo->fwdl[i].dl_size; + } + + /* Another PTDL at the end containing reset vectors */ + size += PTDL_RESET_DATA_SIZE; + + /* PTDL headers. Add one for remainder, one for reset vectors */ + size += ((fwinfo->num_fwdl / PTDL_MAX_SIZE) + 2) * PTDL_HDR_SIZE; + + /* Another 1K sufficient to cover miscellaneous headers */ + size += 1024; + + return size; +} + + +static CsrUint32 write_xbv_header(void *buf, const CsrUint32 offset, const CsrUint32 file_payload_length) +{ + CsrUint32 written = 0; + + /* The length value given to the XBV chunk is the length of all subsequent + * contents of the file, excluding the 8 byte size of the XBV1 header itself + * (The added 6 bytes thus accounts for the size of the VERF) + */ + written += write_chunk(buf, offset + written, (CsrCharString *)"XBV1", file_payload_length + 6); + + written += write_chunk(buf, offset + written, (CsrCharString *)"VERF", 2); + written += write_uint16(buf, offset + written, 0); /* File version */ + + return written; +} + + +static CsrUint32 write_ptch_header(void *buf, const CsrUint32 offset, const CsrUint32 fw_id) +{ + CsrUint32 written = 0; + + /* LIST is written with a zero length, to be updated later */ + written += write_chunk(buf, offset + written, (CsrCharString *)"LIST", 0); + written += write_tag(buf, offset + written, (CsrCharString *)"PTCH"); /* List type */ + + written += write_chunk(buf, offset + written, (CsrCharString *)"FWID", 4); + written += write_uint32(buf, offset + written, fw_id); + + + return written; +} + + +#define UF_REGION_PHY 1 +#define UF_REGION_MAC 2 +#define UF_MEMPUT_MAC 0x0000 +#define UF_MEMPUT_PHY 0x1000 + +static CsrUint32 write_patchcmd(void *buf, const CsrUint32 offset, const CsrUint32 dst_genaddr, const CsrUint16 len) +{ + CsrUint32 written = 0; + CsrUint32 region = (dst_genaddr >> 28); + CsrUint16 cmd_and_len = UF_MEMPUT_MAC; + + if (region == UF_REGION_PHY) + { + cmd_and_len = UF_MEMPUT_PHY; + } + else if (region != UF_REGION_MAC) + { + return 0; /* invalid */ + } + + /* Write the command and data length */ + cmd_and_len |= len; + written += write_uint16(buf, offset + written, cmd_and_len); + + /* Write the destination generic address */ + written += write_uint16(buf, offset + written, (CsrUint16)(dst_genaddr >> 16)); + written += write_uint16(buf, offset + written, (CsrUint16)(dst_genaddr & 0xffff)); + + /* The data payload should be appended to the command */ + return written; +} + + +static CsrUint32 write_fwdl_to_ptdl(void *buf, const CsrUint32 offset, fwreadfn_t readfn, + const struct FWDL *fwdl, const void *dlpriv, + const CsrUint32 fw_id, void *fw_buf) +{ + CsrUint32 written = 0; + CsrInt16 chunks = 0; + CsrUint32 left = fwdl->dl_size; /* Bytes left in this fwdl */ + CsrUint32 dl_addr = fwdl->dl_addr; /* Target address of fwdl image on XAP */ + CsrUint32 dl_offs = fwdl->dl_offset; /* Offset of fwdl image data in source */ + CsrUint16 csum; + CsrUint32 csum_start_offs; /* first offset to include in checksum */ + CsrUint32 sec_data_len; /* section data byte count */ + CsrUint32 sec_len; /* section data + header byte count */ + + /* FWDL maps to one or more PTDLs, as max size for a PTDL is 1K words */ + while (left) + { + /* Calculate amount to be transferred */ + sec_data_len = CSRMIN(left, PTDL_MAX_SIZE - PTDL_HDR_SIZE); + sec_len = sec_data_len + PTDL_HDR_SIZE; + + /* Write PTDL header + entire PTDL size */ + written += write_chunk(buf, offset + written, (CsrCharString *)"PTDL", sec_len); + /* bug digest implies 4 bytes of padding here, but that seems wrong */ + + /* Checksum starts here */ + csum_start_offs = offset + written; + + /* Patch-chunk header: fw_id. Note that this is in XAP word order */ + written += write_uint16(buf, offset + written, (CsrUint16)(fw_id >> 16)); + written += write_uint16(buf, offset + written, (CsrUint16)(fw_id & 0xffff)); + + /* Patch-chunk header: section length in uint16s */ + written += write_uint16(buf, offset + written, (CsrUint16)(sec_len / 2)); + + + /* Write the appropriate patch command for the data's destination ptr */ + written += write_patchcmd(buf, offset + written, dl_addr, (CsrUint16)(sec_data_len / 2)); + + /* Write the data itself (limited to the max chunk length) */ + if (readfn(NULL, (void *)dlpriv, dl_offs, fw_buf, sec_data_len) < 0) + { + return 0; + } + + written += write_bytes(buf, + offset + written, + fw_buf, + sec_data_len); + + /* CsrUint16 checksum calculated over data written */ + csum = calc_checksum(buf, csum_start_offs, written - (csum_start_offs - offset)); + written += write_uint16(buf, offset + written, csum); + + left -= sec_data_len; + dl_addr += sec_data_len; + dl_offs += sec_data_len; + chunks++; + } + + return written; +} + + +#define SEC_CMD_LEN ((4 + 2) * 2) /* sizeof(cmd, vector) per XAP */ +#define PTDL_VEC_HDR_SIZE (4 + 2 + 2) /* sizeof(fw_id, sec_len, csum) */ +#define UF_MAC_START_VEC 0x00c00000 /* Start address of image on MAC */ +#define UF_PHY_START_VEC 0x00c00000 /* Start address of image on PHY */ +#define UF_MAC_START_CMD 0x6000 /* MAC "Set start address" command */ +#define UF_PHY_START_CMD 0x7000 /* PHY "Set start address" command */ + +static CsrUint32 write_reset_ptdl(void *buf, const CsrUint32 offset, const xbv1_t *fwinfo, CsrUint32 fw_id) +{ + CsrUint32 written = 0; + CsrUint16 csum; + CsrUint32 csum_start_offs; /* first offset to include in checksum */ + CsrUint32 sec_len; /* section data + header byte count */ + + sec_len = SEC_CMD_LEN + PTDL_VEC_HDR_SIZE; /* Total section byte length */ + + /* Write PTDL header + entire PTDL size */ + written += write_chunk(buf, offset + written, (CsrCharString *)"PTDL", sec_len); + + /* Checksum starts here */ + csum_start_offs = offset + written; + + /* Patch-chunk header: fw_id. Note that this is in XAP word order */ + written += write_uint16(buf, offset + written, (CsrUint16)(fw_id >> 16)); + written += write_uint16(buf, offset + written, (CsrUint16)(fw_id & 0xffff)); + + /* Patch-chunk header: section length in uint16s */ + written += write_uint16(buf, offset + written, (CsrUint16)(sec_len / 2)); + + /* + * Restart addresses to be executed on subsequent loader restart command. + */ + + /* Setup the MAC start address, note word ordering */ + written += write_uint16(buf, offset + written, UF_MAC_START_CMD); + written += write_uint16(buf, offset + written, (UF_MAC_START_VEC >> 16)); + written += write_uint16(buf, offset + written, (UF_MAC_START_VEC & 0xffff)); + + /* Setup the PHY start address, note word ordering */ + written += write_uint16(buf, offset + written, UF_PHY_START_CMD); + written += write_uint16(buf, offset + written, (UF_PHY_START_VEC >> 16)); + written += write_uint16(buf, offset + written, (UF_PHY_START_VEC & 0xffff)); + + /* CsrUint16 checksum calculated over data written */ + csum = calc_checksum(buf, csum_start_offs, written - (csum_start_offs - offset)); + written += write_uint16(buf, offset + written, csum); + + return written; +} + + +/* + * --------------------------------------------------------------------------- + * read_slut + * + * desc + * + * Arguments: + * readfn Pointer to function to call to read from the file. + * dlpriv Opaque pointer arg to pass to readfn. + * addr Offset into firmware image of SLUT. + * fwinfo Pointer to fwinfo struct to fill in. + * + * Returns: + * Number of SLUT entries in the f/w, or -1 if the image was corrupt. + * --------------------------------------------------------------------------- + */ +CsrInt32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo, + symbol_t *slut, CsrUint32 slut_len) +{ + CsrInt16 i; + CsrInt32 offset; + CsrUint32 magic; + CsrUint32 count = 0; + ct_t ct; + + if (fwinfo->mode != xbv_firmware) + { + return -1; + } + + /* Find the d/l segment containing the SLUT */ + /* This relies on the SLUT being entirely contained in one segment */ + offset = -1; + for (i = 0; i < fwinfo->num_fwdl; i++) + { + if ((fwinfo->slut_addr >= fwinfo->fwdl[i].dl_addr) && + (fwinfo->slut_addr < (fwinfo->fwdl[i].dl_addr + fwinfo->fwdl[i].dl_size))) + { + offset = fwinfo->fwdl[i].dl_offset + + (fwinfo->slut_addr - fwinfo->fwdl[i].dl_addr); + } + } + if (offset < 0) + { + return -1; + } + + ct.dlpriv = dlpriv; + ct.ioffset = offset; + ct.iread = readfn; + + if (read_uint(card, &ct, &magic, 2)) + { + return -1; + } + if (magic != SLUT_FINGERPRINT) + { + return -1; + } + + while (count < slut_len) + { + CsrUint32 id, obj; + + /* Read Symbol Id */ + if (read_uint(card, &ct, &id, 2)) + { + return -1; + } + + /* Check for end of table marker */ + if (id == CSR_SLT_END) + { + break; + } + + /* Read Symbol Value */ + if (read_uint(card, &ct, &obj, 4)) + { + return -1; + } + + slut[count].id = (CsrUint16)id; + slut[count].obj = obj; + count++; + } + + return count; +} /* read_slut() */ + + +/* + * --------------------------------------------------------------------------- + * xbv_to_patch + * + * Convert (the relevant parts of) a firmware xbv file into a patch xbv + * + * Arguments: + * card + * fw_buf - pointer to xbv firmware image + * fwinfo - structure describing the firmware image + * size - pointer to location into which size of f/w is written. + * + * Returns: + * Pointer to firmware image, or NULL on error. Caller must free this + * buffer via CsrMemFree() once it's finished with. + * + * Notes: + * The input fw_buf should have been checked via xbv1_parse prior to + * calling this function, so the input image is assumed valid. + * --------------------------------------------------------------------------- + */ +#define PTCH_LIST_SIZE 16 /* sizeof PTCH+FWID chunk in LIST header */ + +void* xbv_to_patch(card_t *card, fwreadfn_t readfn, + const void *fw_buf, const xbv1_t *fwinfo, CsrUint32 *size) +{ + void *patch_buf = NULL; + CsrUint32 patch_buf_size; + CsrUint32 payload_offs = 0; /* Start of XBV payload */ + CsrInt16 i; + CsrUint32 patch_offs = 0; + CsrUint32 list_len_offs = 0; /* Offset of PTDL LIST length parameter */ + CsrUint32 ptdl_start_offs = 0; /* Offset of first PTDL chunk */ + CsrUint32 fw_id; + void *rdbuf; + + if (!fw_buf || !fwinfo || !card) + { + return NULL; + } + + if (fwinfo->mode != xbv_firmware) + { + unifi_error(NULL, "Not a firmware file\n"); + return NULL; + } + + /* Pre-allocate read buffer for chunk conversion */ + rdbuf = CsrMemAlloc(PTDL_MAX_SIZE); + if (!rdbuf) + { + unifi_error(card, "Couldn't alloc conversion buffer\n"); + return NULL; + } + + /* Loader requires patch file's build ID to match the running firmware's */ + fw_id = card->build_id; + + /* Firmware XBV1 contains VERF, optional INFO, SLUT(s), FWDL(s) */ + /* Other chunks should get skipped. */ + /* VERF should be sanity-checked against chip version */ + + /* Patch XBV1 contains VERF, optional INFO, PTCH */ + /* PTCH contains FWID, optional INFO, PTDL(s), PTDL(start_vec) */ + /* Each FWDL is split into PTDLs (each is 1024 XAP words max) */ + /* Each PTDL contains running ROM f/w version, and checksum */ + /* MAC/PHY reset addresses (known) are added into a final PTDL */ + + /* The input image has already been parsed, and loaded into fwinfo, so we + * can use that to build the output image + */ + patch_buf_size = calc_patch_size(fwinfo); + + patch_buf = (void *)CsrMemAlloc(patch_buf_size); + if (!patch_buf) + { + CsrMemFree(rdbuf); + unifi_error(NULL, "Can't malloc buffer for patch conversion\n"); + return NULL; + } + + CsrMemSet(patch_buf, 0xdd, patch_buf_size); + + /* Write XBV + VERF headers */ + patch_offs += write_xbv_header(patch_buf, patch_offs, 0); + payload_offs = patch_offs; + + /* Write patch (LIST) header */ + list_len_offs = patch_offs + 4; /* Save LIST.length offset for later update */ + patch_offs += write_ptch_header(patch_buf, patch_offs, fw_id); + + /* Save start offset of the PTDL chunks */ + ptdl_start_offs = patch_offs; + + /* Write LIST of firmware PTDL blocks */ + for (i = 0; i < fwinfo->num_fwdl; i++) + { + patch_offs += write_fwdl_to_ptdl(patch_buf, + patch_offs, + readfn, + &fwinfo->fwdl[i], + fw_buf, + fw_id, + rdbuf); + } + + /* Write restart-vector PTDL last */ + patch_offs += write_reset_ptdl(patch_buf, patch_offs, fwinfo, fw_id); + + /* Now the length is known, update the LIST.length */ + write_uint32(patch_buf, list_len_offs, + (patch_offs - ptdl_start_offs) + PTCH_LIST_SIZE); + + /* Re write XBV headers just to fill in the correct file size */ + write_xbv_header(patch_buf, 0, (patch_offs - payload_offs)); + + unifi_trace(card->ospriv, UDBG1, "XBV:PTCH size %u, fw_id %u\n", + patch_offs, fw_id); + if (size) + { + *size = patch_offs; + } + CsrMemFree(rdbuf); + + return patch_buf; +} + + diff --git a/drivers/staging/csr/csr_wifi_hip_xbv.h b/drivers/staging/csr/csr_wifi_hip_xbv.h new file mode 100644 index 0000000..fdc4560 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_xbv.h @@ -0,0 +1,127 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* + * --------------------------------------------------------------------------- + * FILE: csr_wifi_hip_xbv.h + * + * PURPOSE: + * Definitions and declarations for code to read XBV files - the UniFi + * firmware download file format. + * + * --------------------------------------------------------------------------- + */ +#ifndef __XBV_H__ +#define __XBV_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CSR_WIFI_XBV_TEST +/* Driver includes */ +#include "csr_wifi_hip_unifi.h" +#endif + + +struct VMEQ +{ + CsrUint32 addr; + CsrUint16 mask; + CsrUint16 value; +}; + +struct VAND +{ + CsrUint32 first; + CsrUint32 count; +}; + +struct VERS +{ + CsrUint32 num_vand; +}; + +struct FWDL +{ + CsrUint32 dl_addr; + CsrUint32 dl_size; + CsrUint32 dl_offset; +}; + +struct FWOV +{ + CsrUint32 dl_size; + CsrUint32 dl_offset; +}; + +struct PTDL +{ + CsrUint32 dl_size; + CsrUint32 dl_offset; +}; + +#define MAX_VMEQ 64 +#define MAX_VAND 64 +#define MAX_FWDL 256 +#define MAX_PTDL 256 + +/* An XBV1 file can either contain firmware or patches (at the + * moment). The 'mode' member of the xbv1_t structure tells us which + * one is the case. */ +typedef enum +{ + xbv_unknown, + xbv_firmware, + xbv_patch +} xbv_mode; + +typedef struct +{ + xbv_mode mode; + + /* Parts of a Firmware XBV1 */ + + struct VMEQ vmeq[MAX_VMEQ]; + CsrUint32 num_vmeq; + struct VAND vand[MAX_VAND]; + struct VERS vers; + + CsrUint32 slut_addr; + + /* F/W download image, possibly more than one part */ + struct FWDL fwdl[MAX_FWDL]; + CsrInt16 num_fwdl; + + /* F/W overlay image, add r not used */ + struct FWOV fwov; + + /* Parts of a Patch XBV1 */ + + CsrUint32 build_id; + + struct PTDL ptdl[MAX_PTDL]; + CsrInt16 num_ptdl; +} xbv1_t; + + +typedef CsrInt32 (*fwreadfn_t)(void *ospriv, void *dlpriv, CsrUint32 offset, void *buf, CsrUint32 len); + +CsrResult xbv1_parse(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo); +CsrInt32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo, + symbol_t *slut, CsrUint32 slut_len); +void* xbv_to_patch(card_t *card, fwreadfn_t readfn, const void *fw_buf, const xbv1_t *fwinfo, + CsrUint32 *size); + +#ifdef __cplusplus +} +#endif + +#endif /* __XBV_H__ */ diff --git a/drivers/staging/csr/csr_wifi_hostio_prim.h b/drivers/staging/csr/csr_wifi_hostio_prim.h new file mode 100644 index 0000000..bf7c55c --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hostio_prim.h @@ -0,0 +1,27 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + + +#ifndef CSR_WIFI_HOSTIO_H +#define CSR_WIFI_HOSTIO_H + +#ifdef __cplusplus +extern "C" { +#endif + + +#define CSR_WIFI_HOSTIO_PRIM 0x0453 + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_HOSTIO_H */ + diff --git a/drivers/staging/csr/csr_wifi_lib.h b/drivers/staging/csr/csr_wifi_lib.h new file mode 100644 index 0000000..4c691fc8 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_lib.h @@ -0,0 +1,113 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ +#ifndef CSR_WIFI_LIB_H__ +#define CSR_WIFI_LIB_H__ + +#include "csr_types.h" +#include "csr_wifi_fsm_event.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/*----------------------------------------------------------------------------* + * CsrWifiFsmEventInit + * + * DESCRIPTION + * Macro to initialise the members of a CsrWifiFsmEvent. + *----------------------------------------------------------------------------*/ +#define CsrWifiFsmEventInit(evt, p_primtype, p_msgtype, p_dst, p_src) \ + (evt)->primtype = p_primtype; \ + (evt)->type = p_msgtype; \ + (evt)->destination = p_dst; \ + (evt)->source = p_src + + +/*----------------------------------------------------------------------------* + * CsrWifiEvent_struct + * + * DESCRIPTION + * Generic message creator. + * Allocates and fills in a message with the signature CsrWifiEvent + * + *----------------------------------------------------------------------------*/ +CsrWifiFsmEvent* CsrWifiEvent_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrSchedQid dst, CsrSchedQid src); + +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint8 value; +} CsrWifiEventCsrUint8; + +/*----------------------------------------------------------------------------* + * CsrWifiEventCsrUint8_struct + * + * DESCRIPTION + * Generic message creator. + * Allocates and fills in a message with the signature CsrWifiEventCsrUint8 + * + *----------------------------------------------------------------------------*/ +CsrWifiEventCsrUint8* CsrWifiEventCsrUint8_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrSchedQid dst, CsrSchedQid src, CsrUint8 value); + +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 value; +} CsrWifiEventCsrUint16; + +/*----------------------------------------------------------------------------* + * CsrWifiEventCsrUint16_struct + * + * DESCRIPTION + * Generic message creator. + * Allocates and fills in a message with the signature CsrWifiEventCsrUint16 + * + *----------------------------------------------------------------------------*/ +CsrWifiEventCsrUint16* CsrWifiEventCsrUint16_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrSchedQid dst, CsrSchedQid src, CsrUint16 value); + +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint32 value; +} CsrWifiEventCsrUint32; + +/*----------------------------------------------------------------------------* + * CsrWifiEventCsrUint32_struct + * + * DESCRIPTION + * Generic message creator. + * Allocates and fills in a message with the signature CsrWifiEventCsrUint32 + * + *----------------------------------------------------------------------------*/ +CsrWifiEventCsrUint32* CsrWifiEventCsrUint32_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrSchedQid dst, CsrSchedQid src, CsrUint32 value); + +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 value16; + CsrUint8 value8; +} CsrWifiEventCsrUint16CsrUint8; + +/*----------------------------------------------------------------------------* + * CsrWifiEventCsrUint16CsrUint8_struct + * + * DESCRIPTION + * Generic message creator. + * Allocates and fills in a message with the signature CsrWifiEventCsrUint16CsrUint8 + * + *----------------------------------------------------------------------------*/ +CsrWifiEventCsrUint16CsrUint8* CsrWifiEventCsrUint16CsrUint8_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrSchedQid dst, CsrSchedQid src, CsrUint16 value16, CsrUint8 value8); + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_LIB_H__ */ diff --git a/drivers/staging/csr/csr_wifi_msgconv.h b/drivers/staging/csr/csr_wifi_msgconv.h new file mode 100644 index 0000000..d74e595 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_msgconv.h @@ -0,0 +1,60 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#ifndef CSR_WIFI_MSGCONV_H__ +#define CSR_WIFI_MSGCONV_H__ + +#include "csr_types.h" +#include "csr_prim_defs.h" +#include "csr_sched.h" +#include "csr_unicode.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +void CsrUint16SerBigEndian(CsrUint8 *ptr, CsrSize *len, CsrUint16 v); +void CsrUint24SerBigEndian(CsrUint8 *ptr, CsrSize *len, CsrUint32 v); +void CsrUint32SerBigEndian(CsrUint8 *ptr, CsrSize *len, CsrUint32 v); + +void CsrUint16DesBigEndian(CsrUint16 *v, CsrUint8 *buffer, CsrSize *offset); +void CsrUint24DesBigEndian(CsrUint32 *v, CsrUint8 *buffer, CsrSize *offset); +void CsrUint32DesBigEndian(CsrUint32 *v, CsrUint8 *buffer, CsrSize *offset); + +void CsrUint24Ser(CsrUint8 *ptr, CsrSize *len, CsrUint32 v); +void CsrUint24Des(CsrUint32 *v, CsrUint8 *buffer, CsrSize *offset); + + +CsrSize CsrWifiEventSizeof(void *msg); +CsrUint8* CsrWifiEventSer(CsrUint8 *ptr, CsrSize *len, void *msg); +void* CsrWifiEventDes(CsrUint8 *buffer, CsrSize length); + +CsrSize CsrWifiEventCsrUint8Sizeof(void *msg); +CsrUint8* CsrWifiEventCsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg); +void* CsrWifiEventCsrUint8Des(CsrUint8 *buffer, CsrSize length); + +CsrSize CsrWifiEventCsrUint16Sizeof(void *msg); +CsrUint8* CsrWifiEventCsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg); +void* CsrWifiEventCsrUint16Des(CsrUint8 *buffer, CsrSize length); + +CsrSize CsrWifiEventCsrUint32Sizeof(void *msg); +CsrUint8* CsrWifiEventCsrUint32Ser(CsrUint8 *ptr, CsrSize *len, void *msg); +void* CsrWifiEventCsrUint32Des(CsrUint8 *buffer, CsrSize length); + +CsrSize CsrWifiEventCsrUint16CsrUint8Sizeof(void *msg); +CsrUint8* CsrWifiEventCsrUint16CsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg); +void* CsrWifiEventCsrUint16CsrUint8Des(CsrUint8 *buffer, CsrSize length); + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_MSGCONV_H__ */ diff --git a/drivers/staging/csr/csr_wifi_nme_ap_converter_init.h b/drivers/staging/csr/csr_wifi_nme_ap_converter_init.h new file mode 100644 index 0000000..4072c06 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_nme_ap_converter_init.h @@ -0,0 +1,49 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_NME_AP_CONVERTER_INIT_H__ +#define CSR_WIFI_NME_AP_CONVERTER_INIT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CSR_WIFI_NME_ENABLE +#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_converter_init.h +#endif +#ifndef CSR_WIFI_AP_ENABLE +#error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_converter_init.h +#endif + +#ifndef EXCLUDE_CSR_WIFI_NME_AP_MODULE + +#include "csr_msgconv.h" + +#ifdef CSR_LOG_ENABLE +#include "csr_log.h" + +extern const CsrLogPrimitiveInformation* CsrWifiNmeApTechInfoGet(void); +#endif /* CSR_LOG_ENABLE */ + +extern void CsrWifiNmeApConverterInit(void); + +#else /* EXCLUDE_CSR_WIFI_NME_AP_MODULE */ + +#define CsrWifiNmeApConverterInit() + +#endif /* EXCLUDE_CSR_WIFI_NME_AP_MODULE */ + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_NME_AP_CONVERTER_INIT_H__ */ diff --git a/drivers/staging/csr/csr_wifi_nme_ap_lib.h b/drivers/staging/csr/csr_wifi_nme_ap_lib.h new file mode 100644 index 0000000..fc56924 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_nme_ap_lib.h @@ -0,0 +1,526 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_NME_AP_LIB_H__ +#define CSR_WIFI_NME_AP_LIB_H__ + +#include "csr_types.h" +#include "csr_pmem.h" +#include "csr_sched.h" +#include "csr_util.h" +#include "csr_msg_transport.h" + +#include "csr_wifi_lib.h" + +#include "csr_wifi_nme_ap_prim.h" +#include "csr_wifi_nme_task.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CSR_WIFI_NME_ENABLE +#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_lib.h +#endif +#ifndef CSR_WIFI_AP_ENABLE +#error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_lib.h +#endif + +/*----------------------------------------------------------------------------* + * CsrWifiNmeApFreeUpstreamMessageContents + * + * DESCRIPTION + * Free the allocated memory in a CSR_WIFI_NME_AP upstream message. Does not + * free the message itself, and can only be used for upstream messages. + * + * PARAMETERS + * Deallocates the resources in a CSR_WIFI_NME_AP upstream message + *----------------------------------------------------------------------------*/ +void CsrWifiNmeApFreeUpstreamMessageContents(CsrUint16 eventClass, void *message); + +/*----------------------------------------------------------------------------* + * CsrWifiNmeApFreeDownstreamMessageContents + * + * DESCRIPTION + * Free the allocated memory in a CSR_WIFI_NME_AP downstream message. Does not + * free the message itself, and can only be used for downstream messages. + * + * PARAMETERS + * Deallocates the resources in a CSR_WIFI_NME_AP downstream message + *----------------------------------------------------------------------------*/ +void CsrWifiNmeApFreeDownstreamMessageContents(CsrUint16 eventClass, void *message); + +/*----------------------------------------------------------------------------* + * Enum to string functions + *----------------------------------------------------------------------------*/ +const CsrCharString* CsrWifiNmeApPersCredentialTypeToString(CsrWifiNmeApPersCredentialType value); + + +/*----------------------------------------------------------------------------* + * CsrPrim Type toString function. + * Converts a message type to the String name of the Message + *----------------------------------------------------------------------------*/ +const CsrCharString* CsrWifiNmeApPrimTypeToString(CsrPrim msgType); + +/*----------------------------------------------------------------------------* + * Lookup arrays for PrimType name Strings + *----------------------------------------------------------------------------*/ +extern const CsrCharString *CsrWifiNmeApUpstreamPrimNames[CSR_WIFI_NME_AP_PRIM_UPSTREAM_COUNT]; +extern const CsrCharString *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_COUNT]; + +/******************************************************************************* + + NAME + CsrWifiNmeApConfigSetReqSend + + DESCRIPTION + This primitive passes AP configuration info for NME. This can be sent at + any time but will be acted upon when the AP is started again. This + information is common to both P2P GO and AP + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + apConfig - AP configuration for the NME. + apMacConfig - MAC configuration to be acted on when + CSR_WIFI_NME_AP_START.request is sent. + +*******************************************************************************/ +#define CsrWifiNmeApConfigSetReqCreate(msg__, dst__, src__, apConfig__, apMacConfig__) \ + msg__ = (CsrWifiNmeApConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApConfigSetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_CONFIG_SET_REQ, dst__, src__); \ + msg__->apConfig = (apConfig__); \ + msg__->apMacConfig = (apMacConfig__); + +#define CsrWifiNmeApConfigSetReqSendTo(dst__, src__, apConfig__, apMacConfig__) \ + { \ + CsrWifiNmeApConfigSetReq *msg__; \ + CsrWifiNmeApConfigSetReqCreate(msg__, dst__, src__, apConfig__, apMacConfig__); \ + CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ + } + +#define CsrWifiNmeApConfigSetReqSend(src__, apConfig__, apMacConfig__) \ + CsrWifiNmeApConfigSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, apConfig__, apMacConfig__) + +/******************************************************************************* + + NAME + CsrWifiNmeApConfigSetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + status - Status of the request. + +*******************************************************************************/ +#define CsrWifiNmeApConfigSetCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiNmeApConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApConfigSetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_CONFIG_SET_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiNmeApConfigSetCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiNmeApConfigSetCfm *msg__; \ + CsrWifiNmeApConfigSetCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ + } + +#define CsrWifiNmeApConfigSetCfmSend(dst__, status__) \ + CsrWifiNmeApConfigSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiNmeApStaRemoveReqSend + + DESCRIPTION + This primitive disconnects a connected station. If keepBlocking is set to + TRUE, the station with the specified MAC address is not allowed to + connect. If the requested station is not already connected,it may be + blocked based on keepBlocking parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + staMacAddress - Mac Address of the station to be disconnected or blocked + keepBlocking - If TRUE, the station is blocked. If FALSE and the station is + connected, disconnect the station. If FALSE and the station + is not connected, no action is taken. + +*******************************************************************************/ +#define CsrWifiNmeApStaRemoveReqCreate(msg__, dst__, src__, interfaceTag__, staMacAddress__, keepBlocking__) \ + msg__ = (CsrWifiNmeApStaRemoveReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStaRemoveReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STA_REMOVE_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->staMacAddress = (staMacAddress__); \ + msg__->keepBlocking = (keepBlocking__); + +#define CsrWifiNmeApStaRemoveReqSendTo(dst__, src__, interfaceTag__, staMacAddress__, keepBlocking__) \ + { \ + CsrWifiNmeApStaRemoveReq *msg__; \ + CsrWifiNmeApStaRemoveReqCreate(msg__, dst__, src__, interfaceTag__, staMacAddress__, keepBlocking__); \ + CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ + } + +#define CsrWifiNmeApStaRemoveReqSend(src__, interfaceTag__, staMacAddress__, keepBlocking__) \ + CsrWifiNmeApStaRemoveReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, staMacAddress__, keepBlocking__) + +/******************************************************************************* + + NAME + CsrWifiNmeApStartReqSend + + DESCRIPTION + This primitive requests NME to started the AP operation. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface identifier; unique identifier of an interface + apType - AP Type specifies the Legacy AP or P2P GO operation + cloakSsid - Indicates whether the SSID should be cloaked (hidden and + not broadcast in beacon) or not + ssid - Service Set Identifier + ifIndex - Radio interface + channel - Channel number of the channel to use + apCredentials - Security credential configuration. + maxConnections - Maximum number of stations/P2P clients allowed + p2pGoParam - P2P specific GO parameters. + NOT USED FOR CURRENT RELEASE + wpsEnabled - Indicates whether WPS should be enabled or not + +*******************************************************************************/ +#define CsrWifiNmeApStartReqCreate(msg__, dst__, src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__) \ + msg__ = (CsrWifiNmeApStartReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStartReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_START_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->apType = (apType__); \ + msg__->cloakSsid = (cloakSsid__); \ + msg__->ssid = (ssid__); \ + msg__->ifIndex = (ifIndex__); \ + msg__->channel = (channel__); \ + msg__->apCredentials = (apCredentials__); \ + msg__->maxConnections = (maxConnections__); \ + msg__->p2pGoParam = (p2pGoParam__); \ + msg__->wpsEnabled = (wpsEnabled__); + +#define CsrWifiNmeApStartReqSendTo(dst__, src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__) \ + { \ + CsrWifiNmeApStartReq *msg__; \ + CsrWifiNmeApStartReqCreate(msg__, dst__, src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__); \ + CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ + } + +#define CsrWifiNmeApStartReqSend(src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__) \ + CsrWifiNmeApStartReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__) + +/******************************************************************************* + + NAME + CsrWifiNmeApStartCfmSend + + DESCRIPTION + This primitive reports the result of CSR_WIFI_NME_AP_START.request. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface identifier; unique identifier of an interface + status - Status of the request. + ssid - Service Set Identifier + +*******************************************************************************/ +#define CsrWifiNmeApStartCfmCreate(msg__, dst__, src__, interfaceTag__, status__, ssid__) \ + msg__ = (CsrWifiNmeApStartCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApStartCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_START_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); \ + msg__->ssid = (ssid__); + +#define CsrWifiNmeApStartCfmSendTo(dst__, src__, interfaceTag__, status__, ssid__) \ + { \ + CsrWifiNmeApStartCfm *msg__; \ + CsrWifiNmeApStartCfmCreate(msg__, dst__, src__, interfaceTag__, status__, ssid__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ + } + +#define CsrWifiNmeApStartCfmSend(dst__, interfaceTag__, status__, ssid__) \ + CsrWifiNmeApStartCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__, ssid__) + +/******************************************************************************* + + NAME + CsrWifiNmeApStationIndSend + + DESCRIPTION + This primitive indicates that a station has joined or a previously joined + station has left the BSS/group + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + mediaStatus - Indicates whether the station is connected or + disconnected + peerMacAddress - MAC address of the station + peerDeviceAddress - P2P Device Address + +*******************************************************************************/ +#define CsrWifiNmeApStationIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__) \ + msg__ = (CsrWifiNmeApStationInd *) CsrPmemAlloc(sizeof(CsrWifiNmeApStationInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STATION_IND, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->mediaStatus = (mediaStatus__); \ + msg__->peerMacAddress = (peerMacAddress__); \ + msg__->peerDeviceAddress = (peerDeviceAddress__); + +#define CsrWifiNmeApStationIndSendTo(dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__) \ + { \ + CsrWifiNmeApStationInd *msg__; \ + CsrWifiNmeApStationIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ + } + +#define CsrWifiNmeApStationIndSend(dst__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__) \ + CsrWifiNmeApStationIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__) + +/******************************************************************************* + + NAME + CsrWifiNmeApStopReqSend + + DESCRIPTION + This primitive requests NME to stop the AP operation. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface identifier; unique identifier of an interface + +*******************************************************************************/ +#define CsrWifiNmeApStopReqCreate(msg__, dst__, src__, interfaceTag__) \ + msg__ = (CsrWifiNmeApStopReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STOP_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); + +#define CsrWifiNmeApStopReqSendTo(dst__, src__, interfaceTag__) \ + { \ + CsrWifiNmeApStopReq *msg__; \ + CsrWifiNmeApStopReqCreate(msg__, dst__, src__, interfaceTag__); \ + CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ + } + +#define CsrWifiNmeApStopReqSend(src__, interfaceTag__) \ + CsrWifiNmeApStopReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__) + +/******************************************************************************* + + NAME + CsrWifiNmeApStopIndSend + + DESCRIPTION + Indicates that AP operation had stopped because of some unrecoverable + error after AP operation was started successfully. NME sends this signal + after failing to restart the AP operation internally following an error + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + apType - Reports AP Type (P2PGO or AP) + status - Error Status + +*******************************************************************************/ +#define CsrWifiNmeApStopIndCreate(msg__, dst__, src__, interfaceTag__, apType__, status__) \ + msg__ = (CsrWifiNmeApStopInd *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STOP_IND, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->apType = (apType__); \ + msg__->status = (status__); + +#define CsrWifiNmeApStopIndSendTo(dst__, src__, interfaceTag__, apType__, status__) \ + { \ + CsrWifiNmeApStopInd *msg__; \ + CsrWifiNmeApStopIndCreate(msg__, dst__, src__, interfaceTag__, apType__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ + } + +#define CsrWifiNmeApStopIndSend(dst__, interfaceTag__, apType__, status__) \ + CsrWifiNmeApStopIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, apType__, status__) + +/******************************************************************************* + + NAME + CsrWifiNmeApStopCfmSend + + DESCRIPTION + This primitive confirms that the AP operation is stopped. NME shall send + this primitive in response to the request even if AP operation has + already been stopped + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface identifier; unique identifier of an interface + status - Status of the request. + +*******************************************************************************/ +#define CsrWifiNmeApStopCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ + msg__ = (CsrWifiNmeApStopCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STOP_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); + +#define CsrWifiNmeApStopCfmSendTo(dst__, src__, interfaceTag__, status__) \ + { \ + CsrWifiNmeApStopCfm *msg__; \ + CsrWifiNmeApStopCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ + } + +#define CsrWifiNmeApStopCfmSend(dst__, interfaceTag__, status__) \ + CsrWifiNmeApStopCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__) + +/******************************************************************************* + + NAME + CsrWifiNmeApWmmParamUpdateReqSend + + DESCRIPTION + Application uses this primitive to update the WMM parameters + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + wmmApParams - WMM Access point parameters per access category. The array + index corresponds to the ACI + wmmApBcParams - WMM station parameters per access category to be advertised + in the beacons and probe response The array index + corresponds to the ACI + +*******************************************************************************/ +#define CsrWifiNmeApWmmParamUpdateReqCreate(msg__, dst__, src__, wmmApParams__, wmmApBcParams__) \ + msg__ = (CsrWifiNmeApWmmParamUpdateReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApWmmParamUpdateReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_REQ, dst__, src__); \ + CsrMemCpy(msg__->wmmApParams, (wmmApParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); \ + CsrMemCpy(msg__->wmmApBcParams, (wmmApBcParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); + +#define CsrWifiNmeApWmmParamUpdateReqSendTo(dst__, src__, wmmApParams__, wmmApBcParams__) \ + { \ + CsrWifiNmeApWmmParamUpdateReq *msg__; \ + CsrWifiNmeApWmmParamUpdateReqCreate(msg__, dst__, src__, wmmApParams__, wmmApBcParams__); \ + CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ + } + +#define CsrWifiNmeApWmmParamUpdateReqSend(src__, wmmApParams__, wmmApBcParams__) \ + CsrWifiNmeApWmmParamUpdateReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, wmmApParams__, wmmApBcParams__) + +/******************************************************************************* + + NAME + CsrWifiNmeApWmmParamUpdateCfmSend + + DESCRIPTION + A confirm for for the WMM parameters update + + PARAMETERS + queue - Destination Task Queue + status - Status of the request. + +*******************************************************************************/ +#define CsrWifiNmeApWmmParamUpdateCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiNmeApWmmParamUpdateCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApWmmParamUpdateCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiNmeApWmmParamUpdateCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiNmeApWmmParamUpdateCfm *msg__; \ + CsrWifiNmeApWmmParamUpdateCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ + } + +#define CsrWifiNmeApWmmParamUpdateCfmSend(dst__, status__) \ + CsrWifiNmeApWmmParamUpdateCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiNmeApWpsRegisterReqSend + + DESCRIPTION + This primitive allows the NME to accept the WPS registration from an + enrollee. Such registration procedure can be cancelled by sending + CSR_WIFI_NME_WPS_CANCEL.request. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an + interface + selectedDevicePasswordId - Selected password type + selectedConfigMethod - Selected WPS configuration method type + pin - PIN value. + Relevant if selected device password ID is PIN.4 + digit pin is passed by sending the pin digits in + pin[0]..pin[3] and rest of the contents filled + with '-'. + +*******************************************************************************/ +#define CsrWifiNmeApWpsRegisterReqCreate(msg__, dst__, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__) \ + msg__ = (CsrWifiNmeApWpsRegisterReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApWpsRegisterReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WPS_REGISTER_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->selectedDevicePasswordId = (selectedDevicePasswordId__); \ + msg__->selectedConfigMethod = (selectedConfigMethod__); \ + CsrMemCpy(msg__->pin, (pin__), sizeof(CsrUint8) * 8); + +#define CsrWifiNmeApWpsRegisterReqSendTo(dst__, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__) \ + { \ + CsrWifiNmeApWpsRegisterReq *msg__; \ + CsrWifiNmeApWpsRegisterReqCreate(msg__, dst__, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__); \ + CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ + } + +#define CsrWifiNmeApWpsRegisterReqSend(src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__) \ + CsrWifiNmeApWpsRegisterReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__) + +/******************************************************************************* + + NAME + CsrWifiNmeApWpsRegisterCfmSend + + DESCRIPTION + This primitive reports the result of WPS procedure. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface identifier; unique identifier of an interface + status - Status of the request. + +*******************************************************************************/ +#define CsrWifiNmeApWpsRegisterCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ + msg__ = (CsrWifiNmeApWpsRegisterCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApWpsRegisterCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WPS_REGISTER_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); + +#define CsrWifiNmeApWpsRegisterCfmSendTo(dst__, src__, interfaceTag__, status__) \ + { \ + CsrWifiNmeApWpsRegisterCfm *msg__; \ + CsrWifiNmeApWpsRegisterCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ + } + +#define CsrWifiNmeApWpsRegisterCfmSend(dst__, interfaceTag__, status__) \ + CsrWifiNmeApWpsRegisterCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__) + + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_NME_AP_LIB_H__ */ diff --git a/drivers/staging/csr/csr_wifi_nme_ap_prim.h b/drivers/staging/csr/csr_wifi_nme_ap_prim.h new file mode 100644 index 0000000..e3b56b4 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_nme_ap_prim.h @@ -0,0 +1,504 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_NME_AP_PRIM_H__ +#define CSR_WIFI_NME_AP_PRIM_H__ + +#include "csr_types.h" +#include "csr_prim_defs.h" +#include "csr_sched.h" +#include "csr_wifi_common.h" +#include "csr_result.h" +#include "csr_wifi_fsm_event.h" +#include "csr_wifi_sme_ap_prim.h" +#include "csr_wifi_nme_prim.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CSR_WIFI_NME_ENABLE +#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_prim.h +#endif +#ifndef CSR_WIFI_AP_ENABLE +#error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_prim.h +#endif + +#define CSR_WIFI_NME_AP_PRIM (0x0426) + +typedef CsrPrim CsrWifiNmeApPrim; + + +/******************************************************************************* + + NAME + CsrWifiNmeApPersCredentialType + + DESCRIPTION + NME Credential Types + + VALUES + CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK + - Use PSK as credential. + CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE + - Use the specified passphrase as credential + +*******************************************************************************/ +typedef CsrUint8 CsrWifiNmeApPersCredentialType; +#define CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK ((CsrWifiNmeApPersCredentialType) 0x00) +#define CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE ((CsrWifiNmeApPersCredentialType) 0x01) + + +/******************************************************************************* + + NAME + CsrWifiNmeApConfig + + DESCRIPTION + Structure holding AP config data. + + MEMBERS + apGroupkeyTimeout - Access point group key timeout. + apStrictGtkRekey - Access point strict GTK rekey flag. If set TRUE, the AP + shall rekey GTK every time a connected STA leaves BSS. + apGmkTimeout - Access point GMK timeout + apResponseTimeout - Response timeout + apRetransLimit - Max allowed retransmissions + +*******************************************************************************/ +typedef struct +{ + CsrUint16 apGroupkeyTimeout; + CsrBool apStrictGtkRekey; + CsrUint16 apGmkTimeout; + CsrUint16 apResponseTimeout; + CsrUint8 apRetransLimit; +} CsrWifiNmeApConfig; + +/******************************************************************************* + + NAME + CsrWifiNmeApAuthPers + + DESCRIPTION + + MEMBERS + authSupport - Credential type value (as defined in the + enumeration type). + rsnCapabilities - RSN capabilities mask + wapiCapabilities - WAPI capabilities mask + pskOrPassphrase - Credential type value (as defined in the + enumeration type). + authPers_credentials - Union containing credentials which depends + on credentialType parameter. + authPers_credentialspsk - + authPers_credentialspassphrase - + +*******************************************************************************/ +typedef struct +{ + CsrWifiSmeApAuthSupportMask authSupport; + CsrWifiSmeApRsnCapabilitiesMask rsnCapabilities; + CsrWifiSmeApWapiCapabilitiesMask wapiCapabilities; + CsrWifiNmeApPersCredentialType pskOrPassphrase; + union { + CsrWifiNmePsk psk; + CsrWifiNmePassphrase passphrase; + } authPers_credentials; +} CsrWifiNmeApAuthPers; + +/******************************************************************************* + + NAME + CsrWifiNmeApCredentials + + DESCRIPTION + Structure containing the Credentials data. + + MEMBERS + authType - Authentication type + nmeAuthType - Authentication parameters + nmeAuthTypeopenSystemEmpty - + nmeAuthTypeauthwep - + nmeAuthTypeauthTypePersonal - + +*******************************************************************************/ +typedef struct +{ + CsrWifiSmeApAuthType authType; + union { + CsrWifiSmeEmpty openSystemEmpty; + CsrWifiSmeWepAuth authwep; + CsrWifiNmeApAuthPers authTypePersonal; + } nmeAuthType; +} CsrWifiNmeApCredentials; + + +/* Downstream */ +#define CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST (0x0000) + +#define CSR_WIFI_NME_AP_CONFIG_SET_REQ ((CsrWifiNmeApPrim) (0x0000 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_NME_AP_WPS_REGISTER_REQ ((CsrWifiNmeApPrim) (0x0001 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_NME_AP_START_REQ ((CsrWifiNmeApPrim) (0x0002 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_NME_AP_STOP_REQ ((CsrWifiNmeApPrim) (0x0003 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_REQ ((CsrWifiNmeApPrim) (0x0004 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_NME_AP_STA_REMOVE_REQ ((CsrWifiNmeApPrim) (0x0005 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST)) + + +#define CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_HIGHEST (0x0005 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST) + +/* Upstream */ +#define CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST (0x0000 + CSR_PRIM_UPSTREAM) + +#define CSR_WIFI_NME_AP_CONFIG_SET_CFM ((CsrWifiNmeApPrim)(0x0000 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_NME_AP_WPS_REGISTER_CFM ((CsrWifiNmeApPrim)(0x0001 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_NME_AP_START_CFM ((CsrWifiNmeApPrim)(0x0002 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_NME_AP_STOP_CFM ((CsrWifiNmeApPrim)(0x0003 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_NME_AP_STOP_IND ((CsrWifiNmeApPrim)(0x0004 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_CFM ((CsrWifiNmeApPrim)(0x0005 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_NME_AP_STATION_IND ((CsrWifiNmeApPrim)(0x0006 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST)) + +#define CSR_WIFI_NME_AP_PRIM_UPSTREAM_HIGHEST (0x0006 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST) + +#define CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_COUNT (CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_HIGHEST + 1 - CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST) +#define CSR_WIFI_NME_AP_PRIM_UPSTREAM_COUNT (CSR_WIFI_NME_AP_PRIM_UPSTREAM_HIGHEST + 1 - CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST) + +/******************************************************************************* + + NAME + CsrWifiNmeApConfigSetReq + + DESCRIPTION + This primitive passes AP configuration info for NME. This can be sent at + any time but will be acted upon when the AP is started again. This + information is common to both P2P GO and AP + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + apConfig - AP configuration for the NME. + apMacConfig - MAC configuration to be acted on when + CSR_WIFI_NME_AP_START.request is sent. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiNmeApConfig apConfig; + CsrWifiSmeApMacConfig apMacConfig; +} CsrWifiNmeApConfigSetReq; + +/******************************************************************************* + + NAME + CsrWifiNmeApWpsRegisterReq + + DESCRIPTION + This primitive allows the NME to accept the WPS registration from an + enrollee. Such registration procedure can be cancelled by sending + CSR_WIFI_NME_WPS_CANCEL.request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an + interface + selectedDevicePasswordId - Selected password type + selectedConfigMethod - Selected WPS configuration method type + pin - PIN value. + Relevant if selected device password ID is PIN.4 + digit pin is passed by sending the pin digits in + pin[0]..pin[3] and rest of the contents filled + with '-'. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeWpsDpid selectedDevicePasswordId; + CsrWifiSmeWpsConfigType selectedConfigMethod; + CsrUint8 pin[8]; +} CsrWifiNmeApWpsRegisterReq; + +/******************************************************************************* + + NAME + CsrWifiNmeApStartReq + + DESCRIPTION + This primitive requests NME to started the AP operation. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface identifier; unique identifier of an interface + apType - AP Type specifies the Legacy AP or P2P GO operation + cloakSsid - Indicates whether the SSID should be cloaked (hidden and + not broadcast in beacon) or not + ssid - Service Set Identifier + ifIndex - Radio interface + channel - Channel number of the channel to use + apCredentials - Security credential configuration. + maxConnections - Maximum number of stations/P2P clients allowed + p2pGoParam - P2P specific GO parameters. + NOT USED FOR CURRENT RELEASE + wpsEnabled - Indicates whether WPS should be enabled or not + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeApType apType; + CsrBool cloakSsid; + CsrWifiSsid ssid; + CsrWifiSmeRadioIF ifIndex; + CsrUint8 channel; + CsrWifiNmeApCredentials apCredentials; + CsrUint8 maxConnections; + CsrWifiSmeApP2pGoConfig p2pGoParam; + CsrBool wpsEnabled; +} CsrWifiNmeApStartReq; + +/******************************************************************************* + + NAME + CsrWifiNmeApStopReq + + DESCRIPTION + This primitive requests NME to stop the AP operation. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface identifier; unique identifier of an interface + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; +} CsrWifiNmeApStopReq; + +/******************************************************************************* + + NAME + CsrWifiNmeApWmmParamUpdateReq + + DESCRIPTION + Application uses this primitive to update the WMM parameters + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + wmmApParams - WMM Access point parameters per access category. The array + index corresponds to the ACI + wmmApBcParams - WMM station parameters per access category to be advertised + in the beacons and probe response The array index + corresponds to the ACI + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiSmeWmmAcParams wmmApParams[4]; + CsrWifiSmeWmmAcParams wmmApBcParams[4]; +} CsrWifiNmeApWmmParamUpdateReq; + +/******************************************************************************* + + NAME + CsrWifiNmeApStaRemoveReq + + DESCRIPTION + This primitive disconnects a connected station. If keepBlocking is set to + TRUE, the station with the specified MAC address is not allowed to + connect. If the requested station is not already connected,it may be + blocked based on keepBlocking parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + staMacAddress - Mac Address of the station to be disconnected or blocked + keepBlocking - If TRUE, the station is blocked. If FALSE and the station is + connected, disconnect the station. If FALSE and the station + is not connected, no action is taken. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiMacAddress staMacAddress; + CsrBool keepBlocking; +} CsrWifiNmeApStaRemoveReq; + +/******************************************************************************* + + NAME + CsrWifiNmeApConfigSetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Status of the request. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiNmeApConfigSetCfm; + +/******************************************************************************* + + NAME + CsrWifiNmeApWpsRegisterCfm + + DESCRIPTION + This primitive reports the result of WPS procedure. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface identifier; unique identifier of an interface + status - Status of the request. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; +} CsrWifiNmeApWpsRegisterCfm; + +/******************************************************************************* + + NAME + CsrWifiNmeApStartCfm + + DESCRIPTION + This primitive reports the result of CSR_WIFI_NME_AP_START.request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface identifier; unique identifier of an interface + status - Status of the request. + ssid - Service Set Identifier + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; + CsrWifiSsid ssid; +} CsrWifiNmeApStartCfm; + +/******************************************************************************* + + NAME + CsrWifiNmeApStopCfm + + DESCRIPTION + This primitive confirms that the AP operation is stopped. NME shall send + this primitive in response to the request even if AP operation has + already been stopped + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface identifier; unique identifier of an interface + status - Status of the request. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; +} CsrWifiNmeApStopCfm; + +/******************************************************************************* + + NAME + CsrWifiNmeApStopInd + + DESCRIPTION + Indicates that AP operation had stopped because of some unrecoverable + error after AP operation was started successfully. NME sends this signal + after failing to restart the AP operation internally following an error + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + apType - Reports AP Type (P2PGO or AP) + status - Error Status + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeApType apType; + CsrResult status; +} CsrWifiNmeApStopInd; + +/******************************************************************************* + + NAME + CsrWifiNmeApWmmParamUpdateCfm + + DESCRIPTION + A confirm for for the WMM parameters update + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Status of the request. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiNmeApWmmParamUpdateCfm; + +/******************************************************************************* + + NAME + CsrWifiNmeApStationInd + + DESCRIPTION + This primitive indicates that a station has joined or a previously joined + station has left the BSS/group + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + mediaStatus - Indicates whether the station is connected or + disconnected + peerMacAddress - MAC address of the station + peerDeviceAddress - P2P Device Address + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeMediaStatus mediaStatus; + CsrWifiMacAddress peerMacAddress; + CsrWifiMacAddress peerDeviceAddress; +} CsrWifiNmeApStationInd; + + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_NME_AP_PRIM_H__ */ + diff --git a/drivers/staging/csr/csr_wifi_nme_ap_sef.c b/drivers/staging/csr/csr_wifi_nme_ap_sef.c new file mode 100644 index 0000000..e048848 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_nme_ap_sef.c @@ -0,0 +1,30 @@ +/***************************************************************************** + + FILE: csr_wifi_nme_sef.c + + (c) Cambridge Silicon Radio Limited 2010 + + Refer to LICENSE.txt included with this source for details + on the license terms. + + *****************************************************************************/ +#include "csr_wifi_nme_ap_sef.h" +#include "unifi_priv.h" + +void CsrWifiNmeApUpstreamStateHandlers(void* drvpriv, CsrWifiFsmEvent* msg) +{ + switch(msg->type) { + case CSR_WIFI_NME_AP_START_CFM: + CsrWifiNmeApStartCfmHandler(drvpriv, msg); + break; + case CSR_WIFI_NME_AP_STOP_CFM: + CsrWifiNmeApStopCfmHandler(drvpriv, msg); + break; + case CSR_WIFI_NME_AP_CONFIG_SET_CFM: + CsrWifiNmeApConfigSetCfmHandler(drvpriv,msg); + break; + default: + unifi_error(drvpriv, "CsrWifiNmeApUpstreamStateHandlers: unhandled NME_AP message type 0x%.4X\n",msg->type); + break; + } +} diff --git a/drivers/staging/csr/csr_wifi_nme_ap_sef.h b/drivers/staging/csr/csr_wifi_nme_ap_sef.h new file mode 100644 index 0000000..3f35363 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_nme_ap_sef.h @@ -0,0 +1,31 @@ +/***************************************************************************** + FILE: csr_wifi_nme_sef.h + (c) Cambridge Silicon Radio Limited 2010 + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ +#ifndef CSR_WIFI_ROUTER_SEF_CSR_WIFI_NME_H__ +#define CSR_WIFI_ROUTER_SEF_CSR_WIFI_NME_H__ + +#include "csr_wifi_nme_prim.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +void CsrWifiNmeApUpstreamStateHandlers(void* drvpriv, CsrWifiFsmEvent* msg); + + +extern void CsrWifiNmeApConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiNmeApStartCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiNmeApStopCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); + + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_ROUTER_SEF_CSR_WIFI_NME_H__ */ diff --git a/drivers/staging/csr/csr_wifi_nme_ap_serialize.h b/drivers/staging/csr/csr_wifi_nme_ap_serialize.h new file mode 100644 index 0000000..d59abf9 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_nme_ap_serialize.h @@ -0,0 +1,105 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_NME_AP_SERIALIZE_H__ +#define CSR_WIFI_NME_AP_SERIALIZE_H__ + +#include "csr_types.h" +#include "csr_pmem.h" +#include "csr_wifi_msgconv.h" + +#include "csr_wifi_nme_ap_prim.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CSR_WIFI_NME_ENABLE +#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_serialize.h +#endif +#ifndef CSR_WIFI_AP_ENABLE +#error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_serialize.h +#endif + +extern void CsrWifiNmeApPfree(void *ptr); + +extern CsrUint8* CsrWifiNmeApConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeApConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeApConfigSetReqSizeof(void *msg); +extern void CsrWifiNmeApConfigSetReqSerFree(void *msg); + +extern CsrUint8* CsrWifiNmeApWpsRegisterReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeApWpsRegisterReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeApWpsRegisterReqSizeof(void *msg); +#define CsrWifiNmeApWpsRegisterReqSerFree CsrWifiNmeApPfree + +extern CsrUint8* CsrWifiNmeApStartReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeApStartReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeApStartReqSizeof(void *msg); +extern void CsrWifiNmeApStartReqSerFree(void *msg); + +#define CsrWifiNmeApStopReqSer CsrWifiEventCsrUint16Ser +#define CsrWifiNmeApStopReqDes CsrWifiEventCsrUint16Des +#define CsrWifiNmeApStopReqSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiNmeApStopReqSerFree CsrWifiNmeApPfree + +extern CsrUint8* CsrWifiNmeApWmmParamUpdateReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeApWmmParamUpdateReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeApWmmParamUpdateReqSizeof(void *msg); +#define CsrWifiNmeApWmmParamUpdateReqSerFree CsrWifiNmeApPfree + +extern CsrUint8* CsrWifiNmeApStaRemoveReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeApStaRemoveReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeApStaRemoveReqSizeof(void *msg); +#define CsrWifiNmeApStaRemoveReqSerFree CsrWifiNmeApPfree + +#define CsrWifiNmeApConfigSetCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiNmeApConfigSetCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiNmeApConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiNmeApConfigSetCfmSerFree CsrWifiNmeApPfree + +extern CsrUint8* CsrWifiNmeApWpsRegisterCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeApWpsRegisterCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeApWpsRegisterCfmSizeof(void *msg); +#define CsrWifiNmeApWpsRegisterCfmSerFree CsrWifiNmeApPfree + +extern CsrUint8* CsrWifiNmeApStartCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeApStartCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeApStartCfmSizeof(void *msg); +#define CsrWifiNmeApStartCfmSerFree CsrWifiNmeApPfree + +extern CsrUint8* CsrWifiNmeApStopCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeApStopCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeApStopCfmSizeof(void *msg); +#define CsrWifiNmeApStopCfmSerFree CsrWifiNmeApPfree + +extern CsrUint8* CsrWifiNmeApStopIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeApStopIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeApStopIndSizeof(void *msg); +#define CsrWifiNmeApStopIndSerFree CsrWifiNmeApPfree + +#define CsrWifiNmeApWmmParamUpdateCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiNmeApWmmParamUpdateCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiNmeApWmmParamUpdateCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiNmeApWmmParamUpdateCfmSerFree CsrWifiNmeApPfree + +extern CsrUint8* CsrWifiNmeApStationIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeApStationIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeApStationIndSizeof(void *msg); +#define CsrWifiNmeApStationIndSerFree CsrWifiNmeApPfree + + +#ifdef __cplusplus +} +#endif +#endif /* CSR_WIFI_NME_AP_SERIALIZE_H__ */ + diff --git a/drivers/staging/csr/csr_wifi_nme_converter_init.h b/drivers/staging/csr/csr_wifi_nme_converter_init.h new file mode 100644 index 0000000..6661914 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_nme_converter_init.h @@ -0,0 +1,46 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_NME_CONVERTER_INIT_H__ +#define CSR_WIFI_NME_CONVERTER_INIT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CSR_WIFI_NME_ENABLE +#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_converter_init.h +#endif + +#ifndef EXCLUDE_CSR_WIFI_NME_MODULE + +#include "csr_msgconv.h" + +#ifdef CSR_LOG_ENABLE +#include "csr_log.h" + +extern const CsrLogPrimitiveInformation* CsrWifiNmeTechInfoGet(void); +#endif /* CSR_LOG_ENABLE */ + +extern void CsrWifiNmeConverterInit(void); + +#else /* EXCLUDE_CSR_WIFI_NME_MODULE */ + +#define CsrWifiNmeConverterInit() + +#endif /* EXCLUDE_CSR_WIFI_NME_MODULE */ + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_NME_CONVERTER_INIT_H__ */ diff --git a/drivers/staging/csr/csr_wifi_nme_lib.h b/drivers/staging/csr/csr_wifi_nme_lib.h new file mode 100644 index 0000000..897afbf --- /dev/null +++ b/drivers/staging/csr/csr_wifi_nme_lib.h @@ -0,0 +1,1056 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_NME_LIB_H__ +#define CSR_WIFI_NME_LIB_H__ + +#include "csr_types.h" +#include "csr_pmem.h" +#include "csr_sched.h" +#include "csr_util.h" +#include "csr_msg_transport.h" + +#include "csr_wifi_lib.h" + +#include "csr_wifi_nme_prim.h" +#include "csr_wifi_nme_task.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CSR_WIFI_NME_ENABLE +#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_lib.h +#endif + +/*----------------------------------------------------------------------------* + * CsrWifiNmeFreeUpstreamMessageContents + * + * DESCRIPTION + * Free the allocated memory in a CSR_WIFI_NME upstream message. Does not + * free the message itself, and can only be used for upstream messages. + * + * PARAMETERS + * Deallocates the resources in a CSR_WIFI_NME upstream message + *----------------------------------------------------------------------------*/ +void CsrWifiNmeFreeUpstreamMessageContents(CsrUint16 eventClass, void *message); + +/*----------------------------------------------------------------------------* + * CsrWifiNmeFreeDownstreamMessageContents + * + * DESCRIPTION + * Free the allocated memory in a CSR_WIFI_NME downstream message. Does not + * free the message itself, and can only be used for downstream messages. + * + * PARAMETERS + * Deallocates the resources in a CSR_WIFI_NME downstream message + *----------------------------------------------------------------------------*/ +void CsrWifiNmeFreeDownstreamMessageContents(CsrUint16 eventClass, void *message); + +/*----------------------------------------------------------------------------* + * Enum to string functions + *----------------------------------------------------------------------------*/ +const CsrCharString* CsrWifiNmeAuthModeToString(CsrWifiNmeAuthMode value); +const CsrCharString* CsrWifiNmeBssTypeToString(CsrWifiNmeBssType value); +const CsrCharString* CsrWifiNmeCcxOptionsMaskToString(CsrWifiNmeCcxOptionsMask value); +const CsrCharString* CsrWifiNmeConfigActionToString(CsrWifiNmeConfigAction value); +const CsrCharString* CsrWifiNmeConnectionStatusToString(CsrWifiNmeConnectionStatus value); +const CsrCharString* CsrWifiNmeCredentialTypeToString(CsrWifiNmeCredentialType value); +const CsrCharString* CsrWifiNmeEapMethodToString(CsrWifiNmeEapMethod value); +const CsrCharString* CsrWifiNmeEncryptionToString(CsrWifiNmeEncryption value); +const CsrCharString* CsrWifiNmeIndicationsToString(CsrWifiNmeIndications value); +const CsrCharString* CsrWifiNmeSecErrorToString(CsrWifiNmeSecError value); +const CsrCharString* CsrWifiNmeSimCardTypeToString(CsrWifiNmeSimCardType value); +const CsrCharString* CsrWifiNmeUmtsAuthResultToString(CsrWifiNmeUmtsAuthResult value); +const CsrCharString* CsrWifiNmeWmmQosInfoToString(CsrWifiNmeWmmQosInfo value); + + +/*----------------------------------------------------------------------------* + * CsrPrim Type toString function. + * Converts a message type to the String name of the Message + *----------------------------------------------------------------------------*/ +const CsrCharString* CsrWifiNmePrimTypeToString(CsrPrim msgType); + +/*----------------------------------------------------------------------------* + * Lookup arrays for PrimType name Strings + *----------------------------------------------------------------------------*/ +extern const CsrCharString *CsrWifiNmeUpstreamPrimNames[CSR_WIFI_NME_PRIM_UPSTREAM_COUNT]; +extern const CsrCharString *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_COUNT]; + +/******************************************************************************* + + NAME + CsrWifiNmeConnectionStatusGetReqSend + + DESCRIPTION + Requests the current connection status of the NME. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + +*******************************************************************************/ +#define CsrWifiNmeConnectionStatusGetReqCreate(msg__, dst__, src__, interfaceTag__) \ + msg__ = (CsrWifiNmeConnectionStatusGetReq *) CsrPmemAlloc(sizeof(CsrWifiNmeConnectionStatusGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_CONNECTION_STATUS_GET_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); + +#define CsrWifiNmeConnectionStatusGetReqSendTo(dst__, src__, interfaceTag__) \ + { \ + CsrWifiNmeConnectionStatusGetReq *msg__; \ + CsrWifiNmeConnectionStatusGetReqCreate(msg__, dst__, src__, interfaceTag__); \ + CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeConnectionStatusGetReqSend(src__, interfaceTag__) \ + CsrWifiNmeConnectionStatusGetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__) + +/******************************************************************************* + + NAME + CsrWifiNmeConnectionStatusGetCfmSend + + DESCRIPTION + Reports the connection status of the NME. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Indicates the success or otherwise of the requested + operation. + connectionStatus - NME current connection status + +*******************************************************************************/ +#define CsrWifiNmeConnectionStatusGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionStatus__) \ + msg__ = (CsrWifiNmeConnectionStatusGetCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeConnectionStatusGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_CONNECTION_STATUS_GET_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); \ + msg__->connectionStatus = (connectionStatus__); + +#define CsrWifiNmeConnectionStatusGetCfmSendTo(dst__, src__, interfaceTag__, status__, connectionStatus__) \ + { \ + CsrWifiNmeConnectionStatusGetCfm *msg__; \ + CsrWifiNmeConnectionStatusGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionStatus__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeConnectionStatusGetCfmSend(dst__, interfaceTag__, status__, connectionStatus__) \ + CsrWifiNmeConnectionStatusGetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__, connectionStatus__) + +/******************************************************************************* + + NAME + CsrWifiNmeEventMaskSetReqSend + + DESCRIPTION + The wireless manager application may register with the NME to receive + notification of interesting events. Indications will be sent only if the + wireless manager explicitly registers to be notified of that event. + indMask is a bit mask of values defined in CsrWifiNmeIndicationsMask. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + indMask - Set mask with values from CsrWifiNmeIndications + +*******************************************************************************/ +#define CsrWifiNmeEventMaskSetReqCreate(msg__, dst__, src__, indMask__) \ + msg__ = (CsrWifiNmeEventMaskSetReq *) CsrPmemAlloc(sizeof(CsrWifiNmeEventMaskSetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_EVENT_MASK_SET_REQ, dst__, src__); \ + msg__->indMask = (indMask__); + +#define CsrWifiNmeEventMaskSetReqSendTo(dst__, src__, indMask__) \ + { \ + CsrWifiNmeEventMaskSetReq *msg__; \ + CsrWifiNmeEventMaskSetReqCreate(msg__, dst__, src__, indMask__); \ + CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeEventMaskSetReqSend(src__, indMask__) \ + CsrWifiNmeEventMaskSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, indMask__) + +/******************************************************************************* + + NAME + CsrWifiNmeEventMaskSetCfmSend + + DESCRIPTION + The NME calls the primitive to report the result of the request + primitive. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiNmeEventMaskSetCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiNmeEventMaskSetCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeEventMaskSetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_EVENT_MASK_SET_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiNmeEventMaskSetCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiNmeEventMaskSetCfm *msg__; \ + CsrWifiNmeEventMaskSetCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeEventMaskSetCfmSend(dst__, status__) \ + CsrWifiNmeEventMaskSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiNmeProfileConnectReqSend + + DESCRIPTION + Requests the NME to attempt to connect to the specified profile. + Overrides any current connection attempt. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + profileIdentity - Identity (BSSID, SSID) of profile to be connected to. + It must match an existing profile in the NME. + +*******************************************************************************/ +#define CsrWifiNmeProfileConnectReqCreate(msg__, dst__, src__, interfaceTag__, profileIdentity__) \ + msg__ = (CsrWifiNmeProfileConnectReq *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileConnectReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_CONNECT_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->profileIdentity = (profileIdentity__); + +#define CsrWifiNmeProfileConnectReqSendTo(dst__, src__, interfaceTag__, profileIdentity__) \ + { \ + CsrWifiNmeProfileConnectReq *msg__; \ + CsrWifiNmeProfileConnectReqCreate(msg__, dst__, src__, interfaceTag__, profileIdentity__); \ + CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeProfileConnectReqSend(src__, interfaceTag__, profileIdentity__) \ + CsrWifiNmeProfileConnectReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, profileIdentity__) + +/******************************************************************************* + + NAME + CsrWifiNmeProfileConnectCfmSend + + DESCRIPTION + Reports the status of the NME PROFILE CONNECT REQ. If unsuccessful the + connectAttempt parameters contain details of the APs that the NME + attempted to connect to before reporting the failure of the request. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an + interface + status - Indicates the success or otherwise of the requested + operation. + connectAttemptsCount - This parameter is relevant only if + status!=CSR_WIFI_NME_STATUS_SUCCESS. + Number of connection attempt elements provided with + this primitive + connectAttempts - This parameter is relevant only if + status!=CSR_WIFI_NME_STATUS_SUCCESS. + Points to the list of connection attempt elements + provided with this primitive + Each element of the list provides information about + an AP on which the connection attempt was made and + the error that occurred during the attempt. + +*******************************************************************************/ +#define CsrWifiNmeProfileConnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__) \ + msg__ = (CsrWifiNmeProfileConnectCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileConnectCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_CONNECT_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); \ + msg__->connectAttemptsCount = (connectAttemptsCount__); \ + msg__->connectAttempts = (connectAttempts__); + +#define CsrWifiNmeProfileConnectCfmSendTo(dst__, src__, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__) \ + { \ + CsrWifiNmeProfileConnectCfm *msg__; \ + CsrWifiNmeProfileConnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeProfileConnectCfmSend(dst__, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__) \ + CsrWifiNmeProfileConnectCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__) + +/******************************************************************************* + + NAME + CsrWifiNmeProfileDeleteAllReqSend + + DESCRIPTION + Deletes all profiles present in the NME, but does NOT modify the + preferred profile list. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + +*******************************************************************************/ +#define CsrWifiNmeProfileDeleteAllReqCreate(msg__, dst__, src__) \ + msg__ = (CsrWifiNmeProfileDeleteAllReq *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileDeleteAllReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_ALL_REQ, dst__, src__); + +#define CsrWifiNmeProfileDeleteAllReqSendTo(dst__, src__) \ + { \ + CsrWifiNmeProfileDeleteAllReq *msg__; \ + CsrWifiNmeProfileDeleteAllReqCreate(msg__, dst__, src__); \ + CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeProfileDeleteAllReqSend(src__) \ + CsrWifiNmeProfileDeleteAllReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__) + +/******************************************************************************* + + NAME + CsrWifiNmeProfileDeleteAllCfmSend + + DESCRIPTION + Reports the status of the CSR_WIFI_NME_PROFILE_DELETE_ALL_REQ. + Returns always CSR_WIFI_NME_STATUS_SUCCESS. + + PARAMETERS + queue - Destination Task Queue + status - Indicates the success or otherwise of the requested operation, but + in this case it always set to success. + +*******************************************************************************/ +#define CsrWifiNmeProfileDeleteAllCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiNmeProfileDeleteAllCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileDeleteAllCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_ALL_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiNmeProfileDeleteAllCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiNmeProfileDeleteAllCfm *msg__; \ + CsrWifiNmeProfileDeleteAllCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeProfileDeleteAllCfmSend(dst__, status__) \ + CsrWifiNmeProfileDeleteAllCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiNmeProfileDeleteReqSend + + DESCRIPTION + Will delete the profile with a matching identity, but does NOT modify the + preferred profile list. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + profileIdentity - Identity (BSSID, SSID) of profile to be deleted. + +*******************************************************************************/ +#define CsrWifiNmeProfileDeleteReqCreate(msg__, dst__, src__, profileIdentity__) \ + msg__ = (CsrWifiNmeProfileDeleteReq *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileDeleteReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_REQ, dst__, src__); \ + msg__->profileIdentity = (profileIdentity__); + +#define CsrWifiNmeProfileDeleteReqSendTo(dst__, src__, profileIdentity__) \ + { \ + CsrWifiNmeProfileDeleteReq *msg__; \ + CsrWifiNmeProfileDeleteReqCreate(msg__, dst__, src__, profileIdentity__); \ + CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeProfileDeleteReqSend(src__, profileIdentity__) \ + CsrWifiNmeProfileDeleteReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, profileIdentity__) + +/******************************************************************************* + + NAME + CsrWifiNmeProfileDeleteCfmSend + + DESCRIPTION + Reports the status of the CSR_WIFI_NME_PROFILE_DELETE_REQ. + Returns CSR_WIFI_NME_STATUS_NOT_FOUND if there is no matching profile. + + PARAMETERS + queue - Destination Task Queue + status - Indicates the success or otherwise of the requested operation. + +*******************************************************************************/ +#define CsrWifiNmeProfileDeleteCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiNmeProfileDeleteCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileDeleteCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiNmeProfileDeleteCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiNmeProfileDeleteCfm *msg__; \ + CsrWifiNmeProfileDeleteCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeProfileDeleteCfmSend(dst__, status__) \ + CsrWifiNmeProfileDeleteCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiNmeProfileDisconnectIndSend + + DESCRIPTION + Indication generated from the NME (if an application subscribes to + receive it) that informs that application that the current profile + connection has disconnected. The indication will contain information + about APs that it attempted to maintain the connection via i.e. in the + case of failed roaming. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an + interface + connectAttemptsCount - Number of connection attempt elements provided with + this primitive + connectAttempts - Points to the list of connection attempt elements + provided with this primitive + Each element of the list provides information about + an AP on which the connection attempt was made and + the error occurred during the attempt. + +*******************************************************************************/ +#define CsrWifiNmeProfileDisconnectIndCreate(msg__, dst__, src__, interfaceTag__, connectAttemptsCount__, connectAttempts__) \ + msg__ = (CsrWifiNmeProfileDisconnectInd *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileDisconnectInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DISCONNECT_IND, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->connectAttemptsCount = (connectAttemptsCount__); \ + msg__->connectAttempts = (connectAttempts__); + +#define CsrWifiNmeProfileDisconnectIndSendTo(dst__, src__, interfaceTag__, connectAttemptsCount__, connectAttempts__) \ + { \ + CsrWifiNmeProfileDisconnectInd *msg__; \ + CsrWifiNmeProfileDisconnectIndCreate(msg__, dst__, src__, interfaceTag__, connectAttemptsCount__, connectAttempts__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeProfileDisconnectIndSend(dst__, interfaceTag__, connectAttemptsCount__, connectAttempts__) \ + CsrWifiNmeProfileDisconnectIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, connectAttemptsCount__, connectAttempts__) + +/******************************************************************************* + + NAME + CsrWifiNmeProfileOrderSetReqSend + + DESCRIPTION + Defines the preferred order that profiles present in the NME should be + used during the NME auto-connect behaviour. + If profileIdentitysCount == 0, it removes any existing preferred profile + list already present in the NME, effectively disabling the auto-connect + behaviour. + NOTE: Profile identities that do not match any profile stored in the NME + are ignored during the auto-connect procedure. + NOTE: during auto-connect the NME will only attempt to join an existing + adhoc network and it will never attempt to host an adhoc network; for + hosting and adhoc network, use CSR_WIFI_NME_PROFILE_CONNECT_REQ + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an + interface + profileIdentitysCount - The number of profiles identities in the list. + profileIdentitys - Points to the list of profile identities. + +*******************************************************************************/ +#define CsrWifiNmeProfileOrderSetReqCreate(msg__, dst__, src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__) \ + msg__ = (CsrWifiNmeProfileOrderSetReq *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileOrderSetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_ORDER_SET_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->profileIdentitysCount = (profileIdentitysCount__); \ + msg__->profileIdentitys = (profileIdentitys__); + +#define CsrWifiNmeProfileOrderSetReqSendTo(dst__, src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__) \ + { \ + CsrWifiNmeProfileOrderSetReq *msg__; \ + CsrWifiNmeProfileOrderSetReqCreate(msg__, dst__, src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__); \ + CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeProfileOrderSetReqSend(src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__) \ + CsrWifiNmeProfileOrderSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__) + +/******************************************************************************* + + NAME + CsrWifiNmeProfileOrderSetCfmSend + + DESCRIPTION + Confirmation to UNIFI_NME_PROFILE_ORDER_SET.request. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Indicates the success or otherwise of the requested + operation. + +*******************************************************************************/ +#define CsrWifiNmeProfileOrderSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ + msg__ = (CsrWifiNmeProfileOrderSetCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileOrderSetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_ORDER_SET_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); + +#define CsrWifiNmeProfileOrderSetCfmSendTo(dst__, src__, interfaceTag__, status__) \ + { \ + CsrWifiNmeProfileOrderSetCfm *msg__; \ + CsrWifiNmeProfileOrderSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeProfileOrderSetCfmSend(dst__, interfaceTag__, status__) \ + CsrWifiNmeProfileOrderSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__) + +/******************************************************************************* + + NAME + CsrWifiNmeProfileSetReqSend + + DESCRIPTION + Creates or updates an existing profile in the NME that matches the unique + identity of the profile. Each profile is identified by the combination of + BSSID and SSID. The profile contains all the required credentials for + attempting to connect to the network. Creating or updating a profile via + the NME PROFILE SET REQ does NOT add the profile to the preferred profile + list within the NME used for the NME auto-connect behaviour. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + profile - Specifies the identity and credentials of the network. + +*******************************************************************************/ +#define CsrWifiNmeProfileSetReqCreate(msg__, dst__, src__, profile__) \ + msg__ = (CsrWifiNmeProfileSetReq *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileSetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_SET_REQ, dst__, src__); \ + msg__->profile = (profile__); + +#define CsrWifiNmeProfileSetReqSendTo(dst__, src__, profile__) \ + { \ + CsrWifiNmeProfileSetReq *msg__; \ + CsrWifiNmeProfileSetReqCreate(msg__, dst__, src__, profile__); \ + CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeProfileSetReqSend(src__, profile__) \ + CsrWifiNmeProfileSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, profile__) + +/******************************************************************************* + + NAME + CsrWifiNmeProfileSetCfmSend + + DESCRIPTION + Reports the status of the NME PROFILE SET REQ; the request will only fail + if the details specified in the profile contains an invalid combination + of parameters for example specifying the profile as cloaked but not + specifying the SSID. The NME doesn't limit the number of profiles that + may be created. The NME assumes that the entity configuring it is aware + of the appropriate limits. + + PARAMETERS + queue - Destination Task Queue + status - Indicates the success or otherwise of the requested operation. + +*******************************************************************************/ +#define CsrWifiNmeProfileSetCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiNmeProfileSetCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileSetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_SET_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiNmeProfileSetCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiNmeProfileSetCfm *msg__; \ + CsrWifiNmeProfileSetCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeProfileSetCfmSend(dst__, status__) \ + CsrWifiNmeProfileSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiNmeProfileUpdateIndSend + + DESCRIPTION + Indication generated from the NME (if an application subscribes to + receive it) that informs that application that the contained profile has + changed. + For example, either the credentials EAP-FAST PAC file or the session data + within the profile has changed. + It is up to the application whether it stores this updated profile or + not. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + profile - The identity and credentials of the network. + +*******************************************************************************/ +#define CsrWifiNmeProfileUpdateIndCreate(msg__, dst__, src__, interfaceTag__, profile__) \ + msg__ = (CsrWifiNmeProfileUpdateInd *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileUpdateInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_UPDATE_IND, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->profile = (profile__); + +#define CsrWifiNmeProfileUpdateIndSendTo(dst__, src__, interfaceTag__, profile__) \ + { \ + CsrWifiNmeProfileUpdateInd *msg__; \ + CsrWifiNmeProfileUpdateIndCreate(msg__, dst__, src__, interfaceTag__, profile__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeProfileUpdateIndSend(dst__, interfaceTag__, profile__) \ + CsrWifiNmeProfileUpdateIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, profile__) + +/******************************************************************************* + + NAME + CsrWifiNmeSimGsmAuthIndSend + + DESCRIPTION + Indication generated from the NME (if an application subscribes to + receive it) that requests the UICC Manager to perform a GSM + authentication on behalf of the NME. This indication is generated when + the NME is attempting to connect to a profile configured for EAP-SIM. An + application MUST register to receive this indication for the NME to + support the EAP-SIM credential types. Otherwise the NME has no route to + obtain the information from the UICC. EAP-SIM authentication requires 2 + or 3 GSM authentication rounds and therefore 2 or 3 RANDS (GSM Random + Challenges) are included. + + PARAMETERS + queue - Destination Task Queue + randsLength - GSM RAND is 16 bytes long hence valid values are 32 (2 RANDS) + or 48 (3 RANDs). + rands - 2 or 3 RANDs values. + +*******************************************************************************/ +#define CsrWifiNmeSimGsmAuthIndCreate(msg__, dst__, src__, randsLength__, rands__) \ + msg__ = (CsrWifiNmeSimGsmAuthInd *) CsrPmemAlloc(sizeof(CsrWifiNmeSimGsmAuthInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_GSM_AUTH_IND, dst__, src__); \ + msg__->randsLength = (randsLength__); \ + msg__->rands = (rands__); + +#define CsrWifiNmeSimGsmAuthIndSendTo(dst__, src__, randsLength__, rands__) \ + { \ + CsrWifiNmeSimGsmAuthInd *msg__; \ + CsrWifiNmeSimGsmAuthIndCreate(msg__, dst__, src__, randsLength__, rands__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeSimGsmAuthIndSend(dst__, randsLength__, rands__) \ + CsrWifiNmeSimGsmAuthIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, randsLength__, rands__) + +/******************************************************************************* + + NAME + CsrWifiNmeSimGsmAuthResSend + + DESCRIPTION + Response from the application that received the NME SIM GSM AUTH IND. For + each GSM authentication round a GSM Ciphering key (Kc) and a signed + response (SRES) are produced. Since 2 or 3 GSM authentication rounds are + used the 2 or 3 Kc's obtained respectively are combined into one buffer + and similarly the 2 or 3 SRES's obtained are combined into another + buffer. The order of Kc values (SRES values respectively) in their buffer + is the same as that of their corresponding RAND values in the incoming + indication. + + PARAMETERS + status - Indicates the outcome of the requested operation: + STATUS_SUCCESS or STATUS_ERROR + kcsLength - Length in Bytes of Kc buffer. Legal values are: 16 or 24. + kcs - Kc buffer holding 2 or 3 Kc values. + sresLength - Length in Bytes of SRES buffer. Legal values are: 8 or 12. + sres - SRES buffer holding 2 or 3 SRES values. + +*******************************************************************************/ +#define CsrWifiNmeSimGsmAuthResCreate(msg__, dst__, src__, status__, kcsLength__, kcs__, sresLength__, sres__) \ + msg__ = (CsrWifiNmeSimGsmAuthRes *) CsrPmemAlloc(sizeof(CsrWifiNmeSimGsmAuthRes)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_GSM_AUTH_RES, dst__, src__); \ + msg__->status = (status__); \ + msg__->kcsLength = (kcsLength__); \ + msg__->kcs = (kcs__); \ + msg__->sresLength = (sresLength__); \ + msg__->sres = (sres__); + +#define CsrWifiNmeSimGsmAuthResSendTo(dst__, src__, status__, kcsLength__, kcs__, sresLength__, sres__) \ + { \ + CsrWifiNmeSimGsmAuthRes *msg__; \ + CsrWifiNmeSimGsmAuthResCreate(msg__, dst__, src__, status__, kcsLength__, kcs__, sresLength__, sres__); \ + CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeSimGsmAuthResSend(src__, status__, kcsLength__, kcs__, sresLength__, sres__) \ + CsrWifiNmeSimGsmAuthResSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, status__, kcsLength__, kcs__, sresLength__, sres__) + +/******************************************************************************* + + NAME + CsrWifiNmeSimImsiGetIndSend + + DESCRIPTION + Indication generated from the NME (if an application subscribes to + receive it) that requests the IMSI and UICC type from the UICC Manager. + This indication is generated when the NME is attempting to connect to a + profile configured for EAP-SIM/AKA. An application MUST register to + receive this indication for the NME to support the EAP-SIM/AKA credential + types. Otherwise the NME has no route to obtain the information from the + UICC. + + PARAMETERS + queue - Destination Task Queue + +*******************************************************************************/ +#define CsrWifiNmeSimImsiGetIndCreate(msg__, dst__, src__) \ + msg__ = (CsrWifiNmeSimImsiGetInd *) CsrPmemAlloc(sizeof(CsrWifiNmeSimImsiGetInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_IMSI_GET_IND, dst__, src__); + +#define CsrWifiNmeSimImsiGetIndSendTo(dst__, src__) \ + { \ + CsrWifiNmeSimImsiGetInd *msg__; \ + CsrWifiNmeSimImsiGetIndCreate(msg__, dst__, src__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeSimImsiGetIndSend(dst__) \ + CsrWifiNmeSimImsiGetIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE) + +/******************************************************************************* + + NAME + CsrWifiNmeSimImsiGetResSend + + DESCRIPTION + Response from the application that received the NME SIM IMSI GET IND. + + PARAMETERS + status - Indicates the outcome of the requested operation: STATUS_SUCCESS + or STATUS_ERROR. + imsi - The value of the IMSI obtained from the UICC. + cardType - The UICC type (GSM only (SIM), UMTS only (USIM), Both). + +*******************************************************************************/ +#define CsrWifiNmeSimImsiGetResCreate(msg__, dst__, src__, status__, imsi__, cardType__) \ + msg__ = (CsrWifiNmeSimImsiGetRes *) CsrPmemAlloc(sizeof(CsrWifiNmeSimImsiGetRes)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_IMSI_GET_RES, dst__, src__); \ + msg__->status = (status__); \ + msg__->imsi = (imsi__); \ + msg__->cardType = (cardType__); + +#define CsrWifiNmeSimImsiGetResSendTo(dst__, src__, status__, imsi__, cardType__) \ + { \ + CsrWifiNmeSimImsiGetRes *msg__; \ + CsrWifiNmeSimImsiGetResCreate(msg__, dst__, src__, status__, imsi__, cardType__); \ + CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeSimImsiGetResSend(src__, status__, imsi__, cardType__) \ + CsrWifiNmeSimImsiGetResSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, status__, imsi__, cardType__) + +/******************************************************************************* + + NAME + CsrWifiNmeSimUmtsAuthIndSend + + DESCRIPTION + Indication generated from the NME (if an application subscribes to + receive it) that requests the UICC Manager to perform a UMTS + authentication on behalf of the NME. This indication is generated when + the NME is attempting to connect to a profile configured for EAP-AKA. An + application MUST register to receive this indication for the NME to + support the EAP-AKA credential types. Otherwise the NME has no route to + obtain the information from the USIM. EAP-AKA requires one UMTS + authentication round and therefore only one RAND and one AUTN values are + included. + + PARAMETERS + queue - Destination Task Queue + rand - UMTS RAND value. + autn - UMTS AUTN value. + +*******************************************************************************/ +#define CsrWifiNmeSimUmtsAuthIndCreate(msg__, dst__, src__, rand__, autn__) \ + msg__ = (CsrWifiNmeSimUmtsAuthInd *) CsrPmemAlloc(sizeof(CsrWifiNmeSimUmtsAuthInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_UMTS_AUTH_IND, dst__, src__); \ + CsrMemCpy(msg__->rand, (rand__), sizeof(CsrUint8) * 16); \ + CsrMemCpy(msg__->autn, (autn__), sizeof(CsrUint8) * 16); + +#define CsrWifiNmeSimUmtsAuthIndSendTo(dst__, src__, rand__, autn__) \ + { \ + CsrWifiNmeSimUmtsAuthInd *msg__; \ + CsrWifiNmeSimUmtsAuthIndCreate(msg__, dst__, src__, rand__, autn__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeSimUmtsAuthIndSend(dst__, rand__, autn__) \ + CsrWifiNmeSimUmtsAuthIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, rand__, autn__) + +/******************************************************************************* + + NAME + CsrWifiNmeSimUmtsAuthResSend + + DESCRIPTION + Response from the application that received the NME SIM UMTS AUTH IND. + The values of umtsCipherKey, umtsIntegrityKey, resParameterLength and + resParameter are only meanigful when result = UMTS_AUTH_RESULT_SUCCESS. + The value of auts is only meaningful when + result=UMTS_AUTH_RESULT_SYNC_FAIL. + + PARAMETERS + status - Indicates the outcome of the requested operation: + STATUS_SUCCESS or STATUS_ERROR. + result - The result of UMTS authentication as performed by the + UICC which could be: Success, Authentication Reject or + Synchronisation Failure. For all these 3 outcomes the + value of status is success. + umtsCipherKey - The UMTS Cipher Key as calculated and returned by the + UICC. + umtsIntegrityKey - The UMTS Integrity Key as calculated and returned by + the UICC. + resParameterLength - The length (in bytes) of the RES parameter (min=4; max + = 16). + resParameter - The RES parameter as calculated and returned by the + UICC. + auts - The AUTS parameter as calculated and returned by the + UICC. + +*******************************************************************************/ +#define CsrWifiNmeSimUmtsAuthResCreate(msg__, dst__, src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__) \ + msg__ = (CsrWifiNmeSimUmtsAuthRes *) CsrPmemAlloc(sizeof(CsrWifiNmeSimUmtsAuthRes)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_UMTS_AUTH_RES, dst__, src__); \ + msg__->status = (status__); \ + msg__->result = (result__); \ + CsrMemCpy(msg__->umtsCipherKey, (umtsCipherKey__), sizeof(CsrUint8) * 16); \ + CsrMemCpy(msg__->umtsIntegrityKey, (umtsIntegrityKey__), sizeof(CsrUint8) * 16); \ + msg__->resParameterLength = (resParameterLength__); \ + msg__->resParameter = (resParameter__); \ + CsrMemCpy(msg__->auts, (auts__), sizeof(CsrUint8) * 14); + +#define CsrWifiNmeSimUmtsAuthResSendTo(dst__, src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__) \ + { \ + CsrWifiNmeSimUmtsAuthRes *msg__; \ + CsrWifiNmeSimUmtsAuthResCreate(msg__, dst__, src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__); \ + CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeSimUmtsAuthResSend(src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__) \ + CsrWifiNmeSimUmtsAuthResSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__) + +/******************************************************************************* + + NAME + CsrWifiNmeWpsCancelReqSend + + DESCRIPTION + Requests the NME to cancel any WPS procedure that it is currently + performing. This includes WPS registrar activities started because of + CSR_WIFI_NME_AP_REGISTER.request + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + +*******************************************************************************/ +#define CsrWifiNmeWpsCancelReqCreate(msg__, dst__, src__, interfaceTag__) \ + msg__ = (CsrWifiNmeWpsCancelReq *) CsrPmemAlloc(sizeof(CsrWifiNmeWpsCancelReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CANCEL_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); + +#define CsrWifiNmeWpsCancelReqSendTo(dst__, src__, interfaceTag__) \ + { \ + CsrWifiNmeWpsCancelReq *msg__; \ + CsrWifiNmeWpsCancelReqCreate(msg__, dst__, src__, interfaceTag__); \ + CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeWpsCancelReqSend(src__, interfaceTag__) \ + CsrWifiNmeWpsCancelReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__) + +/******************************************************************************* + + NAME + CsrWifiNmeWpsCancelCfmSend + + DESCRIPTION + Reports the status of the NME WPS REQ, the request is always SUCCESSFUL. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Only returns CSR_WIFI_NME_STATUS_SUCCESS + +*******************************************************************************/ +#define CsrWifiNmeWpsCancelCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ + msg__ = (CsrWifiNmeWpsCancelCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeWpsCancelCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CANCEL_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); + +#define CsrWifiNmeWpsCancelCfmSendTo(dst__, src__, interfaceTag__, status__) \ + { \ + CsrWifiNmeWpsCancelCfm *msg__; \ + CsrWifiNmeWpsCancelCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeWpsCancelCfmSend(dst__, interfaceTag__, status__) \ + CsrWifiNmeWpsCancelCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__) + +/******************************************************************************* + + NAME + CsrWifiNmeWpsCfmSend + + DESCRIPTION + Reports the status of the NME WPS REQ. + If CSR_WIFI_NME_STATUS_SUCCESS, the profile parameter contains the + identity and credentials of the AP. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Indicates the success or otherwise of the requested + operation. + profile - This parameter is relevant only if + status==CSR_WIFI_NME_STATUS_SUCCESS. + The identity and credentials of the network. + +*******************************************************************************/ +#define CsrWifiNmeWpsCfmCreate(msg__, dst__, src__, interfaceTag__, status__, profile__) \ + msg__ = (CsrWifiNmeWpsCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeWpsCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); \ + msg__->profile = (profile__); + +#define CsrWifiNmeWpsCfmSendTo(dst__, src__, interfaceTag__, status__, profile__) \ + { \ + CsrWifiNmeWpsCfm *msg__; \ + CsrWifiNmeWpsCfmCreate(msg__, dst__, src__, interfaceTag__, status__, profile__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeWpsCfmSend(dst__, interfaceTag__, status__, profile__) \ + CsrWifiNmeWpsCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__, profile__) + +/******************************************************************************* + + NAME + CsrWifiNmeWpsConfigSetReqSend + + DESCRIPTION + This primitive passes the WPS information for the device to NME. This may + be accepted only if no interface is active. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + wpsConfig - WPS config. + +*******************************************************************************/ +#define CsrWifiNmeWpsConfigSetReqCreate(msg__, dst__, src__, wpsConfig__) \ + msg__ = (CsrWifiNmeWpsConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiNmeWpsConfigSetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CONFIG_SET_REQ, dst__, src__); \ + msg__->wpsConfig = (wpsConfig__); + +#define CsrWifiNmeWpsConfigSetReqSendTo(dst__, src__, wpsConfig__) \ + { \ + CsrWifiNmeWpsConfigSetReq *msg__; \ + CsrWifiNmeWpsConfigSetReqCreate(msg__, dst__, src__, wpsConfig__); \ + CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeWpsConfigSetReqSend(src__, wpsConfig__) \ + CsrWifiNmeWpsConfigSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, wpsConfig__) + +/******************************************************************************* + + NAME + CsrWifiNmeWpsConfigSetCfmSend + + DESCRIPTION + Confirm. + + PARAMETERS + queue - Destination Task Queue + status - Status of the request. + +*******************************************************************************/ +#define CsrWifiNmeWpsConfigSetCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiNmeWpsConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeWpsConfigSetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CONFIG_SET_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiNmeWpsConfigSetCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiNmeWpsConfigSetCfm *msg__; \ + CsrWifiNmeWpsConfigSetCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeWpsConfigSetCfmSend(dst__, status__) \ + CsrWifiNmeWpsConfigSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiNmeWpsReqSend + + DESCRIPTION + Requests the NME to look for WPS enabled APs and attempt to perform WPS + to determine the appropriate security credentials to connect to the AP. + If the PIN == '00000000' then 'push button mode' is indicated, otherwise + the PIN has to match that of the AP. 4 digit pin is passed by sending the + pin digits in pin[0]..pin[3] and rest of the contents filled with '-'. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + pin - PIN value. + ssid - Service Set identifier + bssid - ID of Basic Service Set for which a WPS connection attempt is + being made. + +*******************************************************************************/ +#define CsrWifiNmeWpsReqCreate(msg__, dst__, src__, interfaceTag__, pin__, ssid__, bssid__) \ + msg__ = (CsrWifiNmeWpsReq *) CsrPmemAlloc(sizeof(CsrWifiNmeWpsReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + CsrMemCpy(msg__->pin, (pin__), sizeof(CsrUint8) * 8); \ + msg__->ssid = (ssid__); \ + msg__->bssid = (bssid__); + +#define CsrWifiNmeWpsReqSendTo(dst__, src__, interfaceTag__, pin__, ssid__, bssid__) \ + { \ + CsrWifiNmeWpsReq *msg__; \ + CsrWifiNmeWpsReqCreate(msg__, dst__, src__, interfaceTag__, pin__, ssid__, bssid__); \ + CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ + } + +#define CsrWifiNmeWpsReqSend(src__, interfaceTag__, pin__, ssid__, bssid__) \ + CsrWifiNmeWpsReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, pin__, ssid__, bssid__) + + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_NME_LIB_H__ */ diff --git a/drivers/staging/csr/csr_wifi_nme_prim.h b/drivers/staging/csr/csr_wifi_nme_prim.h new file mode 100644 index 0000000..4d77d2f --- /dev/null +++ b/drivers/staging/csr/csr_wifi_nme_prim.h @@ -0,0 +1,1666 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_NME_PRIM_H__ +#define CSR_WIFI_NME_PRIM_H__ + +#include "csr_types.h" +#include "csr_prim_defs.h" +#include "csr_sched.h" +#include "csr_wifi_common.h" +#include "csr_result.h" +#include "csr_wifi_fsm_event.h" +#include "csr_wifi_sme_prim.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CSR_WIFI_NME_ENABLE +#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_prim.h +#endif + +#define CSR_WIFI_NME_PRIM (0x0424) + +typedef CsrPrim CsrWifiNmePrim; + +typedef void (*CsrWifiNmeFrameFreeFunction)(void *frame); + +/******************************************************************************* + + NAME + CsrWifiNmeAuthMode + + DESCRIPTION + WiFi Authentication Mode + + VALUES + CSR_WIFI_NME_AUTH_MODE_80211_OPEN + - Connects to an open system network (i.e. no authentication, + no encryption) or to a WEP enabled network. + CSR_WIFI_NME_AUTH_MODE_80211_SHARED + - Connect to a WEP enabled network. + CSR_WIFI_NME_AUTH_MODE_8021X_WPA + - Connects to a WPA Enterprise enabled network. + CSR_WIFI_NME_AUTH_MODE_8021X_WPAPSK + - Connects to a WPA with Pre-Shared Key enabled network. + CSR_WIFI_NME_AUTH_MODE_8021X_WPA2 + - Connects to a WPA2 Enterprise enabled network. + CSR_WIFI_NME_AUTH_MODE_8021X_WPA2PSK + - Connects to a WPA2 with Pre-Shared Key enabled network. + CSR_WIFI_NME_AUTH_MODE_8021X_CCKM + - Connects to a CCKM enabled network. + CSR_WIFI_NME_AUTH_MODE_WAPI_WAI + - Connects to a WAPI Enterprise enabled network. + CSR_WIFI_NME_AUTH_MODE_WAPI_WAIPSK + - Connects to a WAPI with Pre-Shared Key enabled network. + CSR_WIFI_NME_AUTH_MODE_8021X_OTHER1X + - For future use. + +*******************************************************************************/ +typedef CsrUint16 CsrWifiNmeAuthMode; +#define CSR_WIFI_NME_AUTH_MODE_80211_OPEN ((CsrWifiNmeAuthMode) 0x0001) +#define CSR_WIFI_NME_AUTH_MODE_80211_SHARED ((CsrWifiNmeAuthMode) 0x0002) +#define CSR_WIFI_NME_AUTH_MODE_8021X_WPA ((CsrWifiNmeAuthMode) 0x0004) +#define CSR_WIFI_NME_AUTH_MODE_8021X_WPAPSK ((CsrWifiNmeAuthMode) 0x0008) +#define CSR_WIFI_NME_AUTH_MODE_8021X_WPA2 ((CsrWifiNmeAuthMode) 0x0010) +#define CSR_WIFI_NME_AUTH_MODE_8021X_WPA2PSK ((CsrWifiNmeAuthMode) 0x0020) +#define CSR_WIFI_NME_AUTH_MODE_8021X_CCKM ((CsrWifiNmeAuthMode) 0x0040) +#define CSR_WIFI_NME_AUTH_MODE_WAPI_WAI ((CsrWifiNmeAuthMode) 0x0080) +#define CSR_WIFI_NME_AUTH_MODE_WAPI_WAIPSK ((CsrWifiNmeAuthMode) 0x0100) +#define CSR_WIFI_NME_AUTH_MODE_8021X_OTHER1X ((CsrWifiNmeAuthMode) 0x0200) + +/******************************************************************************* + + NAME + CsrWifiNmeBssType + + DESCRIPTION + Type of BSS + + VALUES + CSR_WIFI_NME_BSS_TYPE_INFRASTRUCTURE + - Infrastructure BSS type where access to the network is via + one or several Access Points. + CSR_WIFI_NME_BSS_TYPE_ADHOC + - Adhoc or Independent BSS Type where one Station acts as a + host and future stations can join the adhoc network without + needing an access point. + CSR_WIFI_NME_BSS_TYPE_RESERVED + - To be in sync with SME.This is not used. + CSR_WIFI_NME_BSS_TYPE_P2P + - P2P mode of operation. + +*******************************************************************************/ +typedef CsrUint8 CsrWifiNmeBssType; +#define CSR_WIFI_NME_BSS_TYPE_INFRASTRUCTURE ((CsrWifiNmeBssType) 0x00) +#define CSR_WIFI_NME_BSS_TYPE_ADHOC ((CsrWifiNmeBssType) 0x01) +#define CSR_WIFI_NME_BSS_TYPE_RESERVED ((CsrWifiNmeBssType) 0x02) +#define CSR_WIFI_NME_BSS_TYPE_P2P ((CsrWifiNmeBssType) 0x03) + +/******************************************************************************* + + NAME + CsrWifiNmeCcxOptionsMask + + DESCRIPTION + Enumeration type defining possible mask values for setting CCX options. + + VALUES + CSR_WIFI_NME_CCX_OPTION_NONE - No CCX option is set. + CSR_WIFI_NME_CCX_OPTION_CCKM - CCX option cckm is set. + +*******************************************************************************/ +typedef CsrUint8 CsrWifiNmeCcxOptionsMask; +#define CSR_WIFI_NME_CCX_OPTION_NONE ((CsrWifiNmeCcxOptionsMask) 0x00) +#define CSR_WIFI_NME_CCX_OPTION_CCKM ((CsrWifiNmeCcxOptionsMask) 0x01) + +/******************************************************************************* + + NAME + CsrWifiNmeConfigAction + + DESCRIPTION + + VALUES + CSR_WIFI_PIN_ENTRY_PUSH_BUTTON - + CSR_WIFI_PIN_ENTRY_DISPLAY_PIN - + CSR_WIFI_PIN_ENTRY_ENTER_PIN - + +*******************************************************************************/ +typedef CsrUint8 CsrWifiNmeConfigAction; +#define CSR_WIFI_PIN_ENTRY_PUSH_BUTTON ((CsrWifiNmeConfigAction) 0x00) +#define CSR_WIFI_PIN_ENTRY_DISPLAY_PIN ((CsrWifiNmeConfigAction) 0x01) +#define CSR_WIFI_PIN_ENTRY_ENTER_PIN ((CsrWifiNmeConfigAction) 0x02) + +/******************************************************************************* + + NAME + CsrWifiNmeConnectionStatus + + DESCRIPTION + Indicate the NME Connection Status when connecting or when disconnecting + + VALUES + CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_DISCONNECTED + - NME is disconnected. + CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_CONNECTING + - NME is in the process of connecting. + CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_AUTHENTICATING + - NME is in the authentication stage of a connection attempt. + CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_CONNECTED + - NME is connected. + CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_DISCONNECTING + - NME is in the process of disconnecting. + +*******************************************************************************/ +typedef CsrUint8 CsrWifiNmeConnectionStatus; +#define CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_DISCONNECTED ((CsrWifiNmeConnectionStatus) 0x00) +#define CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_CONNECTING ((CsrWifiNmeConnectionStatus) 0x01) +#define CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_AUTHENTICATING ((CsrWifiNmeConnectionStatus) 0x02) +#define CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_CONNECTED ((CsrWifiNmeConnectionStatus) 0x03) +#define CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_DISCONNECTING ((CsrWifiNmeConnectionStatus) 0x04) + +/******************************************************************************* + + NAME + CsrWifiNmeCredentialType + + DESCRIPTION + NME Credential Types + + VALUES + CSR_WIFI_NME_CREDENTIAL_TYPE_OPEN_SYSTEM + - Credential Type Open System. + CSR_WIFI_NME_CREDENTIAL_TYPE_WEP64 + - Credential Type WEP-64 + CSR_WIFI_NME_CREDENTIAL_TYPE_WEP128 + - Credential Type WEP-128 + CSR_WIFI_NME_CREDENTIAL_TYPE_WPA_PSK + - Credential Type WPA Pre-Shared Key + CSR_WIFI_NME_CREDENTIAL_TYPE_WPA_PASSPHRASE + - Credential Type WPA pass phrase + CSR_WIFI_NME_CREDENTIAL_TYPE_WPA2_PSK + - Credential Type WPA2 Pre-Shared Key. + CSR_WIFI_NME_CREDENTIAL_TYPE_WPA2_PASSPHRASE + - Credential Type WPA2 pass phrase + CSR_WIFI_NME_CREDENTIAL_TYPE_WAPI_PSK + - Credential Type WAPI Pre-Shared Key. + CSR_WIFI_NME_CREDENTIAL_TYPE_WAPI_PASSPHRASE + - Credential Type WAPI pass phrase + CSR_WIFI_NME_CREDENTIAL_TYPE_WAPI + - Credential Type WAPI certificates + CSR_WIFI_NME_CREDENTIAL_TYPE_8021X + - Credential Type 802.1X: the associated type supports + FAST/LEAP/TLS/TTLS/PEAP/etc. + +*******************************************************************************/ +typedef CsrUint16 CsrWifiNmeCredentialType; +#define CSR_WIFI_NME_CREDENTIAL_TYPE_OPEN_SYSTEM ((CsrWifiNmeCredentialType) 0x0000) +#define CSR_WIFI_NME_CREDENTIAL_TYPE_WEP64 ((CsrWifiNmeCredentialType) 0x0001) +#define CSR_WIFI_NME_CREDENTIAL_TYPE_WEP128 ((CsrWifiNmeCredentialType) 0x0002) +#define CSR_WIFI_NME_CREDENTIAL_TYPE_WPA_PSK ((CsrWifiNmeCredentialType) 0x0003) +#define CSR_WIFI_NME_CREDENTIAL_TYPE_WPA_PASSPHRASE ((CsrWifiNmeCredentialType) 0x0004) +#define CSR_WIFI_NME_CREDENTIAL_TYPE_WPA2_PSK ((CsrWifiNmeCredentialType) 0x0005) +#define CSR_WIFI_NME_CREDENTIAL_TYPE_WPA2_PASSPHRASE ((CsrWifiNmeCredentialType) 0x0006) +#define CSR_WIFI_NME_CREDENTIAL_TYPE_WAPI_PSK ((CsrWifiNmeCredentialType) 0x0007) +#define CSR_WIFI_NME_CREDENTIAL_TYPE_WAPI_PASSPHRASE ((CsrWifiNmeCredentialType) 0x0008) +#define CSR_WIFI_NME_CREDENTIAL_TYPE_WAPI ((CsrWifiNmeCredentialType) 0x0009) +#define CSR_WIFI_NME_CREDENTIAL_TYPE_8021X ((CsrWifiNmeCredentialType) 0x000A) + +/******************************************************************************* + + NAME + CsrWifiNmeEapMethod + + DESCRIPTION + Outer EAP method with possibly inner method. + + VALUES + CSR_WIFI_NME_EAP_METHOD_TLS + - EAP-TLS Method. + CSR_WIFI_NME_EAP_METHOD_TTLS_MSCHAPV2 + - EAP-TTLS Method with MSCHAPV2. + CSR_WIFI_NME_EAP_METHOD_PEAP_GTC + - EAP-PEAP Method with GTC. + CSR_WIFI_NME_EAP_METHOD_PEAP_MSCHAPV2 + - EAP-PEAP Method with MSCHAPV2. + CSR_WIFI_NME_EAP_METHOD_SIM + - EAP-SIM Method. + CSR_WIFI_NME_EAP_METHOD_AKA + - EAP-AKA Method. + CSR_WIFI_NME_EAP_METHOD_FAST_GTC + - EAP-FAST Method with GTC. + CSR_WIFI_NME_EAP_METHOD_FAST_MSCHAPV2 + - EAP-FAST Method with MSCHAPV2. + CSR_WIFI_NME_EAP_METHOD_LEAP + - EAP-LEAP Method. + +*******************************************************************************/ +typedef CsrUint16 CsrWifiNmeEapMethod; +#define CSR_WIFI_NME_EAP_METHOD_TLS ((CsrWifiNmeEapMethod) 0x0001) +#define CSR_WIFI_NME_EAP_METHOD_TTLS_MSCHAPV2 ((CsrWifiNmeEapMethod) 0x0002) +#define CSR_WIFI_NME_EAP_METHOD_PEAP_GTC ((CsrWifiNmeEapMethod) 0x0004) +#define CSR_WIFI_NME_EAP_METHOD_PEAP_MSCHAPV2 ((CsrWifiNmeEapMethod) 0x0008) +#define CSR_WIFI_NME_EAP_METHOD_SIM ((CsrWifiNmeEapMethod) 0x0010) +#define CSR_WIFI_NME_EAP_METHOD_AKA ((CsrWifiNmeEapMethod) 0x0020) +#define CSR_WIFI_NME_EAP_METHOD_FAST_GTC ((CsrWifiNmeEapMethod) 0x0040) +#define CSR_WIFI_NME_EAP_METHOD_FAST_MSCHAPV2 ((CsrWifiNmeEapMethod) 0x0080) +#define CSR_WIFI_NME_EAP_METHOD_LEAP ((CsrWifiNmeEapMethod) 0x0100) + +/******************************************************************************* + + NAME + CsrWifiNmeEncryption + + DESCRIPTION + WiFi Encryption method + + VALUES + CSR_WIFI_NME_ENCRYPTION_CIPHER_NONE + - No encryprion set. + CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_WEP40 + - 40 bytes WEP key for peer to peer communication. + CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_WEP104 + - 104 bytes WEP key for peer to peer communication. + CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_TKIP + - TKIP key for peer to peer communication. + CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_CCMP + - CCMP key for peer to peer communication. + CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_SMS4 + - SMS4 key for peer to peer communication. + CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_WEP40 + - 40 bytes WEP key for broadcast messages. + CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_WEP104 + - 104 bytes WEP key for broadcast messages. + CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_TKIP + - TKIP key for broadcast messages. + CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_CCMP + - CCMP key for broadcast messages + CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_SMS4 + - SMS4 key for broadcast messages. + +*******************************************************************************/ +typedef CsrUint16 CsrWifiNmeEncryption; +#define CSR_WIFI_NME_ENCRYPTION_CIPHER_NONE ((CsrWifiNmeEncryption) 0x0000) +#define CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_WEP40 ((CsrWifiNmeEncryption) 0x0001) +#define CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_WEP104 ((CsrWifiNmeEncryption) 0x0002) +#define CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_TKIP ((CsrWifiNmeEncryption) 0x0004) +#define CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_CCMP ((CsrWifiNmeEncryption) 0x0008) +#define CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_SMS4 ((CsrWifiNmeEncryption) 0x0010) +#define CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_WEP40 ((CsrWifiNmeEncryption) 0x0020) +#define CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_WEP104 ((CsrWifiNmeEncryption) 0x0040) +#define CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_TKIP ((CsrWifiNmeEncryption) 0x0080) +#define CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_CCMP ((CsrWifiNmeEncryption) 0x0100) +#define CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_SMS4 ((CsrWifiNmeEncryption) 0x0200) + +/******************************************************************************* + + NAME + CsrWifiNmeIndications + + DESCRIPTION + NME indications + + VALUES + CSR_WIFI_NME_INDICATIONS_IND_AP_STATION + - NME AP Station Indication. + CSR_WIFI_NME_INDICATIONS_IND_AP_STOP + - NME AP Stop Indication. + CSR_WIFI_NME_INDICATIONS_IND_SIM_UMTS_AUTH + - NME UMTS Authentication Indication. + CSR_WIFI_NME_INDICATIONS_IND_P2P_GROUP_START + - NME P2P Group Start Indication. + CSR_WIFI_NME_INDICATIONS_IND_P2P_GROUP_STATUS + - NME P2P Group Status Indication. + CSR_WIFI_NME_INDICATIONS_IND_P2P_GROUP_ROLE + - NME P2P Group Role Indication. + CSR_WIFI_NME_INDICATIONS_IND_PROFILE_DISCONNECT + - NME Profile Disconnect Indication. + CSR_WIFI_NME_INDICATIONS_IND_PROFILE_UPDATE + - NME Profile Update Indication. + CSR_WIFI_NME_INDICATIONS_IND_SIM_IMSI_GET + - NME GET IMSI Indication. + CSR_WIFI_NME_INDICATIONS_IND_SIM_GSM_AUTH + - NME GSM Authentication Indication. + CSR_WIFI_NME_INDICATIONS_ALL + - Used to register for all available indications + +*******************************************************************************/ +typedef CsrUint32 CsrWifiNmeIndications; +#define CSR_WIFI_NME_INDICATIONS_IND_AP_STATION ((CsrWifiNmeIndications) 0x00100000) +#define CSR_WIFI_NME_INDICATIONS_IND_AP_STOP ((CsrWifiNmeIndications) 0x00200000) +#define CSR_WIFI_NME_INDICATIONS_IND_SIM_UMTS_AUTH ((CsrWifiNmeIndications) 0x01000000) +#define CSR_WIFI_NME_INDICATIONS_IND_P2P_GROUP_START ((CsrWifiNmeIndications) 0x02000000) +#define CSR_WIFI_NME_INDICATIONS_IND_P2P_GROUP_STATUS ((CsrWifiNmeIndications) 0x04000000) +#define CSR_WIFI_NME_INDICATIONS_IND_P2P_GROUP_ROLE ((CsrWifiNmeIndications) 0x08000000) +#define CSR_WIFI_NME_INDICATIONS_IND_PROFILE_DISCONNECT ((CsrWifiNmeIndications) 0x10000000) +#define CSR_WIFI_NME_INDICATIONS_IND_PROFILE_UPDATE ((CsrWifiNmeIndications) 0x20000000) +#define CSR_WIFI_NME_INDICATIONS_IND_SIM_IMSI_GET ((CsrWifiNmeIndications) 0x40000000) +#define CSR_WIFI_NME_INDICATIONS_IND_SIM_GSM_AUTH ((CsrWifiNmeIndications) 0x80000000) +#define CSR_WIFI_NME_INDICATIONS_ALL ((CsrWifiNmeIndications) 0xFFFFFFFF) + +/******************************************************************************* + + NAME + CsrWifiNmeSecError + + DESCRIPTION + NME Security Errors + place holder for the security library abort reason + + VALUES + CSR_WIFI_NME_SEC_ERROR_SEC_ERROR_UNKNOWN + - Unknown Security Error. + +*******************************************************************************/ +typedef CsrUint8 CsrWifiNmeSecError; +#define CSR_WIFI_NME_SEC_ERROR_SEC_ERROR_UNKNOWN ((CsrWifiNmeSecError) 0x00) + +/******************************************************************************* + + NAME + CsrWifiNmeSimCardType + + DESCRIPTION + (U)SIM Card (or UICC) types + + VALUES + CSR_WIFI_NME_SIM_CARD_TYPE_2G - 2G SIM card, capable of performing GSM + authentication only. + CSR_WIFI_NME_SIM_CARD_TYPE_3G - UICC supporting USIM application, capable + of performing UMTS authentication only. + CSR_WIFI_NME_SIM_CARD_TYPE_2G3G - UICC supporting both USIM and SIM + applications, capable of performing both + UMTS and GSM authentications. + +*******************************************************************************/ +typedef CsrUint8 CsrWifiNmeSimCardType; +#define CSR_WIFI_NME_SIM_CARD_TYPE_2G ((CsrWifiNmeSimCardType) 0x01) +#define CSR_WIFI_NME_SIM_CARD_TYPE_3G ((CsrWifiNmeSimCardType) 0x02) +#define CSR_WIFI_NME_SIM_CARD_TYPE_2G3G ((CsrWifiNmeSimCardType) 0x03) + +/******************************************************************************* + + NAME + CsrWifiNmeUmtsAuthResult + + DESCRIPTION + Only relevant for UMTS Authentication. It indicates if the UICC has + successfully authenticated the network or otherwise. + + VALUES + CSR_WIFI_NME_UMTS_AUTH_RESULT_SUCCESS + - Successful outcome from USIM indicating that the card has + successfully authenticated the network. + CSR_WIFI_NME_UMTS_AUTH_RESULT_SYNC_FAIL + - Unsuccessful outcome from USIM indicating that the card is + requesting the network to synchronise and re-try again. If + no further request is received an NME timer will expire and + the authentication is aborted. + CSR_WIFI_NME_UMTS_AUTH_RESULT_REJECT + - Unsuccessful outcome from USIM indicating that the card has + rejected the network and that the authentication is + aborted. + +*******************************************************************************/ +typedef CsrUint8 CsrWifiNmeUmtsAuthResult; +#define CSR_WIFI_NME_UMTS_AUTH_RESULT_SUCCESS ((CsrWifiNmeUmtsAuthResult) 0x00) +#define CSR_WIFI_NME_UMTS_AUTH_RESULT_SYNC_FAIL ((CsrWifiNmeUmtsAuthResult) 0x01) +#define CSR_WIFI_NME_UMTS_AUTH_RESULT_REJECT ((CsrWifiNmeUmtsAuthResult) 0x02) + +/******************************************************************************* + + NAME + CsrWifiNmeWmmQosInfo + + DESCRIPTION + Defines bits for the QoS Info octect as defined in the WMM specification. + The values of this type are used across the NME/SME/Router API's and they + must be kept consistent with the corresponding types in the .xml of the + other interfaces + + VALUES + CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_ALL + - WMM AP may deliver all buffered frames. + CSR_WIFI_NME_WMM_QOS_INFO_AC_VO + - To enable the triggering and delivery of QoS Voice. + CSR_WIFI_NME_WMM_QOS_INFO_AC_VI + - To enable the triggering and delivery of QoS Video. + CSR_WIFI_NME_WMM_QOS_INFO_AC_BK + - To enable the triggering and delivery of QoS Background. + CSR_WIFI_NME_WMM_QOS_INFO_AC_BE + - To enable the triggering and delivery of QoS Best Effort. + CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_TWO + - WMM AP may deliver a maximum of 2 buffered frames per + Unscheduled Service Period (USP). + CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_FOUR + - WMM AP may deliver a maximum of 4 buffered frames per USP. + CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_SIX + - WMM AP may deliver a maximum of 6 buffered frames per USP. + +*******************************************************************************/ +typedef CsrUint8 CsrWifiNmeWmmQosInfo; +#define CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_ALL ((CsrWifiNmeWmmQosInfo) 0x00) +#define CSR_WIFI_NME_WMM_QOS_INFO_AC_VO ((CsrWifiNmeWmmQosInfo) 0x01) +#define CSR_WIFI_NME_WMM_QOS_INFO_AC_VI ((CsrWifiNmeWmmQosInfo) 0x02) +#define CSR_WIFI_NME_WMM_QOS_INFO_AC_BK ((CsrWifiNmeWmmQosInfo) 0x04) +#define CSR_WIFI_NME_WMM_QOS_INFO_AC_BE ((CsrWifiNmeWmmQosInfo) 0x08) +#define CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_TWO ((CsrWifiNmeWmmQosInfo) 0x20) +#define CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_FOUR ((CsrWifiNmeWmmQosInfo) 0x40) +#define CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_SIX ((CsrWifiNmeWmmQosInfo) 0x60) + + +/******************************************************************************* + + NAME + CsrWifiNmeEapMethodMask + + DESCRIPTION + Mask type for use with the values defined by CsrWifiNmeEapMethod. + +*******************************************************************************/ +typedef CsrUint16 CsrWifiNmeEapMethodMask; +/******************************************************************************* + + NAME + CsrWifiNmeEncryptionMask + + DESCRIPTION + Mask type for use with the values defined by CsrWifiNmeEncryption + +*******************************************************************************/ +typedef CsrUint16 CsrWifiNmeEncryptionMask; +/******************************************************************************* + + NAME + CsrWifiNmeIndicationsMask + + DESCRIPTION + Mask type for use with the values defined by CsrWifiNmeIndications + +*******************************************************************************/ +typedef CsrUint32 CsrWifiNmeIndicationsMask; +/******************************************************************************* + + NAME + CsrWifiNmeNmeIndicationsMask + + DESCRIPTION + Mask type for use with the values defined by CsrWifiNmeNmeIndications. + Used to overlap the unused portion of the unifi_IndicationsMask For NME + specific indications + +*******************************************************************************/ +typedef CsrUint32 CsrWifiNmeNmeIndicationsMask; +/******************************************************************************* + + NAME + CsrWifiNmeWmmQosInfoMask + + DESCRIPTION + Mask type for use with the values defined by CsrWifiNmeWmmQosInfo + +*******************************************************************************/ +typedef CsrUint8 CsrWifiNmeWmmQosInfoMask; + + +/******************************************************************************* + + NAME + CsrWifiNmeEmpty + + DESCRIPTION + Empty Structure to indicate that no credentials are available. + + MEMBERS + empty - Only element of the empty structure (always set to 0). + +*******************************************************************************/ +typedef struct +{ + CsrUint8 empty; +} CsrWifiNmeEmpty; + +/******************************************************************************* + + NAME + CsrWifiNmePassphrase + + DESCRIPTION + Structure holding the ASCII Pass Phrase data. + + MEMBERS + encryptionMode - Encryption type as defined in CsrWifiSmeEncryption. + passphrase - Pass phrase ASCII value. + +*******************************************************************************/ +typedef struct +{ + CsrUint16 encryptionMode; + CsrCharString *passphrase; +} CsrWifiNmePassphrase; + +/******************************************************************************* + + NAME + CsrWifiNmePsk + + DESCRIPTION + Structure holding the Pre-Shared Key data. + + MEMBERS + encryptionMode - Encryption type as defined in CsrWifiSmeEncryption. + psk - Pre-Shared Key value. + +*******************************************************************************/ +typedef struct +{ + CsrUint16 encryptionMode; + CsrUint8 psk[32]; +} CsrWifiNmePsk; + +/******************************************************************************* + + NAME + CsrWifiNmeWapiCredentials + + DESCRIPTION + Structure holding WAPI credentials data. + + MEMBERS + certificateLength - Length in bytes of the following client certificate. + certificate - The actual client certificate data (if present). + DER/PEM format supported. + privateKeyLength - Length in bytes of the following private key. + privateKey - The actual private key. DER/PEM format. + caCertificateLength - Length in bytes of the following certificate authority + certificate. + caCertificate - The actual certificate authority certificate data. If + not supplied the received certificate authority + certificate is assumed to be validate, if present the + received certificate is validated against it. DER/PEM + format supported. + +*******************************************************************************/ +typedef struct +{ + CsrUint32 certificateLength; + CsrUint8 *certificate; + CsrUint16 privateKeyLength; + CsrUint8 *privateKey; + CsrUint32 caCertificateLength; + CsrUint8 *caCertificate; +} CsrWifiNmeWapiCredentials; + +/******************************************************************************* + + NAME + CsrWifiNmeConnectAttempt + + DESCRIPTION + Structure holding Connection attempt data. + + MEMBERS + bssid - Id of Basic Service Set connections attempt have been made + to. + status - Status returned to indicate the success or otherwise of the + connection attempt. + securityError - Security error status indicating the nature of the failure + to connect. + +*******************************************************************************/ +typedef struct +{ + CsrWifiMacAddress bssid; + CsrResult status; + CsrWifiNmeSecError securityError; +} CsrWifiNmeConnectAttempt; + +/******************************************************************************* + + NAME + CsrWifiNmeEapCredentials + + DESCRIPTION + Supports the use of multiple EAP methods via a single structure. The + methods required are indicated by the value set in the eapMethodMask + + MEMBERS + eapMethodMask + - Bit mask of supported EAP methods + Currently only supports the setting of one bit. + Required for all the EAP methods. + authMode + - Bit mask representing the authentication types that may be + supported by a suitable AP. An AP must support at least one + of the authentication types specified to be considered for + connection. Required for all EAP methods. + encryptionMode + - Bit mask representing the encryption types that may be + supported by a suitable AP. An AP must support a suitable + mix of the pairwise and group encryption types requested to + be considered for connection. Required for all EAP methods. + userName + - User name. Required for all EAP methods except: SIM or AKA. + userPassword + - User Password. Required for all EAP methods except: TLS, + SIM or AKA. + authServerUserIdentity + - Authentication server user Identity. Required for all EAP + methods except: TLS, SIM, AKA or FAST. + clientCertificateLength + - Length in bytes of the following client certificate (if + present). Only required for TLS. + clientCertificate + - The actual client certificate data (if present). Only + required for TLS. DER/PEM format supported. + certificateAuthorityCertificateLength + - Length in bytes of the following certificate authority + certificate (if present). Optional for TLS, TTLS, PEAP. + certificateAuthorityCertificate + - The actual certificate authority certificate data (if + present). If not supplied the received certificate + authority certificate is assumed to be valid, if present + the received certificate is validated against it. Optional + for TLS, TTLS, PEAP. DER/PEM format supported. + privateKeyLength + - Length in bytes of the following private key (if present). + Only required for TLS. + privateKey + - The actual private key (if present). Only required for TLS. + DER/PEM format, maybe password protected. + privateKeyPassword + - Optional password to protect the private key. + sessionLength + - Length in bytes of the following session field Supported + for all EAP methods except: SIM or AKA. + session + - Session information to support faster re-authentication. + Supported for all EAP methods except: SIM or AKA. + allowPacProvisioning + - If TRUE: PAC provisioning is allowed 'over-the_air'; + If FALSE: a PAC must be supplied. + Only required for FAST. + pacLength + - Length the following PAC field. If allowPacProvisioning is + FALSE then the PAC MUST be supplied (i.e. non-zero). Only + required for FAST. + pac + - The actual PAC data. If allowPacProvisioning is FALSE then + the PAC MUST be supplied. Only required for FAST. + pacPassword + - Optional password to protect the PAC. Only required for + FAST. + +*******************************************************************************/ +typedef struct +{ + CsrWifiNmeEapMethodMask eapMethodMask; + CsrWifiSmeAuthModeMask authMode; + CsrWifiNmeEncryptionMask encryptionMode; + CsrCharString *userName; + CsrCharString *userPassword; + CsrCharString *authServerUserIdentity; + CsrUint32 clientCertificateLength; + CsrUint8 *clientCertificate; + CsrUint32 certificateAuthorityCertificateLength; + CsrUint8 *certificateAuthorityCertificate; + CsrUint16 privateKeyLength; + CsrUint8 *privateKey; + CsrCharString *privateKeyPassword; + CsrUint32 sessionLength; + CsrUint8 *session; + CsrBool allowPacProvisioning; + CsrUint32 pacLength; + CsrUint8 *pac; + CsrCharString *pacPassword; +} CsrWifiNmeEapCredentials; + +/******************************************************************************* + + NAME + CsrWifiNmePeerConfig + + DESCRIPTION + Structure holding Peer Config data. + + MEMBERS + p2pDeviceId - + groupCapabilityMask - + groupOwnerIntent - + +*******************************************************************************/ +typedef struct +{ + CsrWifiMacAddress p2pDeviceId; + CsrWifiSmeP2pGroupCapabilityMask groupCapabilityMask; + CsrUint8 groupOwnerIntent; +} CsrWifiNmePeerConfig; + +/******************************************************************************* + + NAME + CsrWifiNmeProfileIdentity + + DESCRIPTION + The identity of a profile is defined as the unique combination the BSSID + and SSID. + + MEMBERS + bssid - ID of Basic Service Set for or the P2pDevice address of the GO for + which a connection attempt was made. + ssid - Service Set Id. + +*******************************************************************************/ +typedef struct +{ + CsrWifiMacAddress bssid; + CsrWifiSsid ssid; +} CsrWifiNmeProfileIdentity; + +/******************************************************************************* + + NAME + CsrWifiNmeWep128Keys + + DESCRIPTION + Structure holding WEP Authentication Type and WEP keys that can be used + when using WEP128. + + MEMBERS + wepAuthType - Mask to select the WEP authentication type (Open or Shared) + selectedWepKey - Index to one of the four keys below indicating the + currently used WEP key. + key1 - Value for key number 1. + key2 - Value for key number 2. + key3 - Value for key number 3. + key4 - Value for key number 4. + +*******************************************************************************/ +typedef struct +{ + CsrWifiSmeAuthModeMask wepAuthType; + CsrUint8 selectedWepKey; + CsrUint8 key1[13]; + CsrUint8 key2[13]; + CsrUint8 key3[13]; + CsrUint8 key4[13]; +} CsrWifiNmeWep128Keys; + +/******************************************************************************* + + NAME + CsrWifiNmeWep64Keys + + DESCRIPTION + Structure for holding WEP Authentication Type and WEP keys that can be + used when using WEP64. + + MEMBERS + wepAuthType - Mask to select the WEP authentication type (Open or Shared) + selectedWepKey - Index to one of the four keys below indicating the + currently used WEP key. + key1 - Value for key number 1. + key2 - Value for key number 2. + key3 - Value for key number 3. + key4 - Value for key number 4. + +*******************************************************************************/ +typedef struct +{ + CsrWifiSmeAuthModeMask wepAuthType; + CsrUint8 selectedWepKey; + CsrUint8 key1[5]; + CsrUint8 key2[5]; + CsrUint8 key3[5]; + CsrUint8 key4[5]; +} CsrWifiNmeWep64Keys; + +/******************************************************************************* + + NAME + CsrWifiNmeCredentials + + DESCRIPTION + Structure containing the Credentials data. + + MEMBERS + credentialType - Credential type value (as defined in the + enumeration type). + credential - Union containing credentials which depends on + credentialType parameter. + credentialeap - + credentialwapiPassphrase - + credentialwpa2Passphrase - + credentialwpa2Psk - + credentialwapiPsk - + credentialwpaPassphrase - + credentialwapi - + credentialwep128Key - + credentialwpaPsk - + credentialopenSystem - + credentialwep64Key - + +*******************************************************************************/ +typedef struct +{ + CsrWifiNmeCredentialType credentialType; + union { + CsrWifiNmeEapCredentials eap; + CsrWifiNmePassphrase wapiPassphrase; + CsrWifiNmePassphrase wpa2Passphrase; + CsrWifiNmePsk wpa2Psk; + CsrWifiNmePsk wapiPsk; + CsrWifiNmePassphrase wpaPassphrase; + CsrWifiNmeWapiCredentials wapi; + CsrWifiNmeWep128Keys wep128Key; + CsrWifiNmePsk wpaPsk; + CsrWifiNmeEmpty openSystem; + CsrWifiNmeWep64Keys wep64Key; + } credential; +} CsrWifiNmeCredentials; + +/******************************************************************************* + + NAME + CsrWifiNmeProfile + + DESCRIPTION + Structure containing the Profile data. + + MEMBERS + profileIdentity - Profile Identity. + wmmQosInfoMask - Mask for WMM QoS information. + bssType - Type of BSS (Infrastructure or Adhoc). + channelNo - Channel Number. + ccxOptionsMask - Options mask for Cisco Compatible Extentions. + cloakedSsid - Flag to decide whether the SSID is cloaked (not + transmitted) or not. + credentials - Credentials data. + +*******************************************************************************/ +typedef struct +{ + CsrWifiNmeProfileIdentity profileIdentity; + CsrWifiNmeWmmQosInfoMask wmmQosInfoMask; + CsrWifiNmeBssType bssType; + CsrUint8 channelNo; + CsrUint8 ccxOptionsMask; + CsrBool cloakedSsid; + CsrWifiNmeCredentials credentials; +} CsrWifiNmeProfile; + + +/* Downstream */ +#define CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST (0x0000) + +#define CSR_WIFI_NME_PROFILE_SET_REQ ((CsrWifiNmePrim) (0x0000 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_NME_PROFILE_DELETE_REQ ((CsrWifiNmePrim) (0x0001 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_NME_PROFILE_DELETE_ALL_REQ ((CsrWifiNmePrim) (0x0002 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_NME_PROFILE_ORDER_SET_REQ ((CsrWifiNmePrim) (0x0003 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_NME_PROFILE_CONNECT_REQ ((CsrWifiNmePrim) (0x0004 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_NME_WPS_REQ ((CsrWifiNmePrim) (0x0005 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_NME_WPS_CANCEL_REQ ((CsrWifiNmePrim) (0x0006 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_NME_CONNECTION_STATUS_GET_REQ ((CsrWifiNmePrim) (0x0007 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_NME_SIM_IMSI_GET_RES ((CsrWifiNmePrim) (0x0008 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_NME_SIM_GSM_AUTH_RES ((CsrWifiNmePrim) (0x0009 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_NME_SIM_UMTS_AUTH_RES ((CsrWifiNmePrim) (0x000A + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_NME_WPS_CONFIG_SET_REQ ((CsrWifiNmePrim) (0x000B + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_NME_EVENT_MASK_SET_REQ ((CsrWifiNmePrim) (0x000C + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) + + +#define CSR_WIFI_NME_PRIM_DOWNSTREAM_HIGHEST (0x000C + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST) + +/* Upstream */ +#define CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST (0x0000 + CSR_PRIM_UPSTREAM) + +#define CSR_WIFI_NME_PROFILE_SET_CFM ((CsrWifiNmePrim)(0x0000 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_NME_PROFILE_DELETE_CFM ((CsrWifiNmePrim)(0x0001 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_NME_PROFILE_DELETE_ALL_CFM ((CsrWifiNmePrim)(0x0002 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_NME_PROFILE_ORDER_SET_CFM ((CsrWifiNmePrim)(0x0003 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_NME_PROFILE_CONNECT_CFM ((CsrWifiNmePrim)(0x0004 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_NME_WPS_CFM ((CsrWifiNmePrim)(0x0005 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_NME_WPS_CANCEL_CFM ((CsrWifiNmePrim)(0x0006 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_NME_CONNECTION_STATUS_GET_CFM ((CsrWifiNmePrim)(0x0007 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_NME_PROFILE_UPDATE_IND ((CsrWifiNmePrim)(0x0008 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_NME_PROFILE_DISCONNECT_IND ((CsrWifiNmePrim)(0x0009 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_NME_SIM_IMSI_GET_IND ((CsrWifiNmePrim)(0x000A + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_NME_SIM_GSM_AUTH_IND ((CsrWifiNmePrim)(0x000B + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_NME_SIM_UMTS_AUTH_IND ((CsrWifiNmePrim)(0x000C + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_NME_WPS_CONFIG_SET_CFM ((CsrWifiNmePrim)(0x000D + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_NME_EVENT_MASK_SET_CFM ((CsrWifiNmePrim)(0x000E + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) + +#define CSR_WIFI_NME_PRIM_UPSTREAM_HIGHEST (0x000E + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST) + +#define CSR_WIFI_NME_PRIM_DOWNSTREAM_COUNT (CSR_WIFI_NME_PRIM_DOWNSTREAM_HIGHEST + 1 - CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST) +#define CSR_WIFI_NME_PRIM_UPSTREAM_COUNT (CSR_WIFI_NME_PRIM_UPSTREAM_HIGHEST + 1 - CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST) + +/******************************************************************************* + + NAME + CsrWifiNmeProfileSetReq + + DESCRIPTION + Creates or updates an existing profile in the NME that matches the unique + identity of the profile. Each profile is identified by the combination of + BSSID and SSID. The profile contains all the required credentials for + attempting to connect to the network. Creating or updating a profile via + the NME PROFILE SET REQ does NOT add the profile to the preferred profile + list within the NME used for the NME auto-connect behaviour. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + profile - Specifies the identity and credentials of the network. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiNmeProfile profile; +} CsrWifiNmeProfileSetReq; + +/******************************************************************************* + + NAME + CsrWifiNmeProfileDeleteReq + + DESCRIPTION + Will delete the profile with a matching identity, but does NOT modify the + preferred profile list. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + profileIdentity - Identity (BSSID, SSID) of profile to be deleted. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiNmeProfileIdentity profileIdentity; +} CsrWifiNmeProfileDeleteReq; + +/******************************************************************************* + + NAME + CsrWifiNmeProfileDeleteAllReq + + DESCRIPTION + Deletes all profiles present in the NME, but does NOT modify the + preferred profile list. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; +} CsrWifiNmeProfileDeleteAllReq; + +/******************************************************************************* + + NAME + CsrWifiNmeProfileOrderSetReq + + DESCRIPTION + Defines the preferred order that profiles present in the NME should be + used during the NME auto-connect behaviour. + If profileIdentitysCount == 0, it removes any existing preferred profile + list already present in the NME, effectively disabling the auto-connect + behaviour. + NOTE: Profile identities that do not match any profile stored in the NME + are ignored during the auto-connect procedure. + NOTE: during auto-connect the NME will only attempt to join an existing + adhoc network and it will never attempt to host an adhoc network; for + hosting and adhoc network, use CSR_WIFI_NME_PROFILE_CONNECT_REQ + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an + interface + profileIdentitysCount - The number of profiles identities in the list. + profileIdentitys - Points to the list of profile identities. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrUint8 profileIdentitysCount; + CsrWifiNmeProfileIdentity *profileIdentitys; +} CsrWifiNmeProfileOrderSetReq; + +/******************************************************************************* + + NAME + CsrWifiNmeProfileConnectReq + + DESCRIPTION + Requests the NME to attempt to connect to the specified profile. + Overrides any current connection attempt. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + profileIdentity - Identity (BSSID, SSID) of profile to be connected to. + It must match an existing profile in the NME. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiNmeProfileIdentity profileIdentity; +} CsrWifiNmeProfileConnectReq; + +/******************************************************************************* + + NAME + CsrWifiNmeWpsReq + + DESCRIPTION + Requests the NME to look for WPS enabled APs and attempt to perform WPS + to determine the appropriate security credentials to connect to the AP. + If the PIN == '00000000' then 'push button mode' is indicated, otherwise + the PIN has to match that of the AP. 4 digit pin is passed by sending the + pin digits in pin[0]..pin[3] and rest of the contents filled with '-'. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + pin - PIN value. + ssid - Service Set identifier + bssid - ID of Basic Service Set for which a WPS connection attempt is + being made. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrUint8 pin[8]; + CsrWifiSsid ssid; + CsrWifiMacAddress bssid; +} CsrWifiNmeWpsReq; + +/******************************************************************************* + + NAME + CsrWifiNmeWpsCancelReq + + DESCRIPTION + Requests the NME to cancel any WPS procedure that it is currently + performing. This includes WPS registrar activities started because of + CSR_WIFI_NME_AP_REGISTER.request + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; +} CsrWifiNmeWpsCancelReq; + +/******************************************************************************* + + NAME + CsrWifiNmeConnectionStatusGetReq + + DESCRIPTION + Requests the current connection status of the NME. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; +} CsrWifiNmeConnectionStatusGetReq; + +/******************************************************************************* + + NAME + CsrWifiNmeSimImsiGetRes + + DESCRIPTION + Response from the application that received the NME SIM IMSI GET IND. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Indicates the outcome of the requested operation: STATUS_SUCCESS + or STATUS_ERROR. + imsi - The value of the IMSI obtained from the UICC. + cardType - The UICC type (GSM only (SIM), UMTS only (USIM), Both). + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; + CsrCharString *imsi; + CsrWifiNmeSimCardType cardType; +} CsrWifiNmeSimImsiGetRes; + +/******************************************************************************* + + NAME + CsrWifiNmeSimGsmAuthRes + + DESCRIPTION + Response from the application that received the NME SIM GSM AUTH IND. For + each GSM authentication round a GSM Ciphering key (Kc) and a signed + response (SRES) are produced. Since 2 or 3 GSM authentication rounds are + used the 2 or 3 Kc's obtained respectively are combined into one buffer + and similarly the 2 or 3 SRES's obtained are combined into another + buffer. The order of Kc values (SRES values respectively) in their buffer + is the same as that of their corresponding RAND values in the incoming + indication. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Indicates the outcome of the requested operation: + STATUS_SUCCESS or STATUS_ERROR + kcsLength - Length in Bytes of Kc buffer. Legal values are: 16 or 24. + kcs - Kc buffer holding 2 or 3 Kc values. + sresLength - Length in Bytes of SRES buffer. Legal values are: 8 or 12. + sres - SRES buffer holding 2 or 3 SRES values. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; + CsrUint8 kcsLength; + CsrUint8 *kcs; + CsrUint8 sresLength; + CsrUint8 *sres; +} CsrWifiNmeSimGsmAuthRes; + +/******************************************************************************* + + NAME + CsrWifiNmeSimUmtsAuthRes + + DESCRIPTION + Response from the application that received the NME SIM UMTS AUTH IND. + The values of umtsCipherKey, umtsIntegrityKey, resParameterLength and + resParameter are only meanigful when result = UMTS_AUTH_RESULT_SUCCESS. + The value of auts is only meaningful when + result=UMTS_AUTH_RESULT_SYNC_FAIL. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Indicates the outcome of the requested operation: + STATUS_SUCCESS or STATUS_ERROR. + result - The result of UMTS authentication as performed by the + UICC which could be: Success, Authentication Reject or + Synchronisation Failure. For all these 3 outcomes the + value of status is success. + umtsCipherKey - The UMTS Cipher Key as calculated and returned by the + UICC. + umtsIntegrityKey - The UMTS Integrity Key as calculated and returned by + the UICC. + resParameterLength - The length (in bytes) of the RES parameter (min=4; max + = 16). + resParameter - The RES parameter as calculated and returned by the + UICC. + auts - The AUTS parameter as calculated and returned by the + UICC. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; + CsrWifiNmeUmtsAuthResult result; + CsrUint8 umtsCipherKey[16]; + CsrUint8 umtsIntegrityKey[16]; + CsrUint8 resParameterLength; + CsrUint8 *resParameter; + CsrUint8 auts[14]; +} CsrWifiNmeSimUmtsAuthRes; + +/******************************************************************************* + + NAME + CsrWifiNmeWpsConfigSetReq + + DESCRIPTION + This primitive passes the WPS information for the device to NME. This may + be accepted only if no interface is active. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + wpsConfig - WPS config. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiSmeWpsConfig wpsConfig; +} CsrWifiNmeWpsConfigSetReq; + +/******************************************************************************* + + NAME + CsrWifiNmeEventMaskSetReq + + DESCRIPTION + The wireless manager application may register with the NME to receive + notification of interesting events. Indications will be sent only if the + wireless manager explicitly registers to be notified of that event. + indMask is a bit mask of values defined in CsrWifiNmeIndicationsMask. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + indMask - Set mask with values from CsrWifiNmeIndications + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiNmeIndicationsMask indMask; +} CsrWifiNmeEventMaskSetReq; + +/******************************************************************************* + + NAME + CsrWifiNmeProfileSetCfm + + DESCRIPTION + Reports the status of the NME PROFILE SET REQ; the request will only fail + if the details specified in the profile contains an invalid combination + of parameters for example specifying the profile as cloaked but not + specifying the SSID. The NME doesn't limit the number of profiles that + may be created. The NME assumes that the entity configuring it is aware + of the appropriate limits. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Indicates the success or otherwise of the requested operation. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiNmeProfileSetCfm; + +/******************************************************************************* + + NAME + CsrWifiNmeProfileDeleteCfm + + DESCRIPTION + Reports the status of the CSR_WIFI_NME_PROFILE_DELETE_REQ. + Returns CSR_WIFI_NME_STATUS_NOT_FOUND if there is no matching profile. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Indicates the success or otherwise of the requested operation. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiNmeProfileDeleteCfm; + +/******************************************************************************* + + NAME + CsrWifiNmeProfileDeleteAllCfm + + DESCRIPTION + Reports the status of the CSR_WIFI_NME_PROFILE_DELETE_ALL_REQ. + Returns always CSR_WIFI_NME_STATUS_SUCCESS. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Indicates the success or otherwise of the requested operation, but + in this case it always set to success. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiNmeProfileDeleteAllCfm; + +/******************************************************************************* + + NAME + CsrWifiNmeProfileOrderSetCfm + + DESCRIPTION + Confirmation to UNIFI_NME_PROFILE_ORDER_SET.request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Indicates the success or otherwise of the requested + operation. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; +} CsrWifiNmeProfileOrderSetCfm; + +/******************************************************************************* + + NAME + CsrWifiNmeProfileConnectCfm + + DESCRIPTION + Reports the status of the NME PROFILE CONNECT REQ. If unsuccessful the + connectAttempt parameters contain details of the APs that the NME + attempted to connect to before reporting the failure of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an + interface + status - Indicates the success or otherwise of the requested + operation. + connectAttemptsCount - This parameter is relevant only if + status!=CSR_WIFI_NME_STATUS_SUCCESS. + Number of connection attempt elements provided with + this primitive + connectAttempts - This parameter is relevant only if + status!=CSR_WIFI_NME_STATUS_SUCCESS. + Points to the list of connection attempt elements + provided with this primitive + Each element of the list provides information about + an AP on which the connection attempt was made and + the error that occurred during the attempt. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; + CsrUint8 connectAttemptsCount; + CsrWifiNmeConnectAttempt *connectAttempts; +} CsrWifiNmeProfileConnectCfm; + +/******************************************************************************* + + NAME + CsrWifiNmeWpsCfm + + DESCRIPTION + Reports the status of the NME WPS REQ. + If CSR_WIFI_NME_STATUS_SUCCESS, the profile parameter contains the + identity and credentials of the AP. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Indicates the success or otherwise of the requested + operation. + profile - This parameter is relevant only if + status==CSR_WIFI_NME_STATUS_SUCCESS. + The identity and credentials of the network. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; + CsrWifiNmeProfile profile; +} CsrWifiNmeWpsCfm; + +/******************************************************************************* + + NAME + CsrWifiNmeWpsCancelCfm + + DESCRIPTION + Reports the status of the NME WPS REQ, the request is always SUCCESSFUL. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Only returns CSR_WIFI_NME_STATUS_SUCCESS + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; +} CsrWifiNmeWpsCancelCfm; + +/******************************************************************************* + + NAME + CsrWifiNmeConnectionStatusGetCfm + + DESCRIPTION + Reports the connection status of the NME. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Indicates the success or otherwise of the requested + operation. + connectionStatus - NME current connection status + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; + CsrWifiNmeConnectionStatus connectionStatus; +} CsrWifiNmeConnectionStatusGetCfm; + +/******************************************************************************* + + NAME + CsrWifiNmeProfileUpdateInd + + DESCRIPTION + Indication generated from the NME (if an application subscribes to + receive it) that informs that application that the contained profile has + changed. + For example, either the credentials EAP-FAST PAC file or the session data + within the profile has changed. + It is up to the application whether it stores this updated profile or + not. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + profile - The identity and credentials of the network. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiNmeProfile profile; +} CsrWifiNmeProfileUpdateInd; + +/******************************************************************************* + + NAME + CsrWifiNmeProfileDisconnectInd + + DESCRIPTION + Indication generated from the NME (if an application subscribes to + receive it) that informs that application that the current profile + connection has disconnected. The indication will contain information + about APs that it attempted to maintain the connection via i.e. in the + case of failed roaming. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an + interface + connectAttemptsCount - Number of connection attempt elements provided with + this primitive + connectAttempts - Points to the list of connection attempt elements + provided with this primitive + Each element of the list provides information about + an AP on which the connection attempt was made and + the error occurred during the attempt. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrUint8 connectAttemptsCount; + CsrWifiNmeConnectAttempt *connectAttempts; +} CsrWifiNmeProfileDisconnectInd; + +/******************************************************************************* + + NAME + CsrWifiNmeSimImsiGetInd + + DESCRIPTION + Indication generated from the NME (if an application subscribes to + receive it) that requests the IMSI and UICC type from the UICC Manager. + This indication is generated when the NME is attempting to connect to a + profile configured for EAP-SIM/AKA. An application MUST register to + receive this indication for the NME to support the EAP-SIM/AKA credential + types. Otherwise the NME has no route to obtain the information from the + UICC. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; +} CsrWifiNmeSimImsiGetInd; + +/******************************************************************************* + + NAME + CsrWifiNmeSimGsmAuthInd + + DESCRIPTION + Indication generated from the NME (if an application subscribes to + receive it) that requests the UICC Manager to perform a GSM + authentication on behalf of the NME. This indication is generated when + the NME is attempting to connect to a profile configured for EAP-SIM. An + application MUST register to receive this indication for the NME to + support the EAP-SIM credential types. Otherwise the NME has no route to + obtain the information from the UICC. EAP-SIM authentication requires 2 + or 3 GSM authentication rounds and therefore 2 or 3 RANDS (GSM Random + Challenges) are included. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + randsLength - GSM RAND is 16 bytes long hence valid values are 32 (2 RANDS) + or 48 (3 RANDs). + rands - 2 or 3 RANDs values. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint8 randsLength; + CsrUint8 *rands; +} CsrWifiNmeSimGsmAuthInd; + +/******************************************************************************* + + NAME + CsrWifiNmeSimUmtsAuthInd + + DESCRIPTION + Indication generated from the NME (if an application subscribes to + receive it) that requests the UICC Manager to perform a UMTS + authentication on behalf of the NME. This indication is generated when + the NME is attempting to connect to a profile configured for EAP-AKA. An + application MUST register to receive this indication for the NME to + support the EAP-AKA credential types. Otherwise the NME has no route to + obtain the information from the USIM. EAP-AKA requires one UMTS + authentication round and therefore only one RAND and one AUTN values are + included. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + rand - UMTS RAND value. + autn - UMTS AUTN value. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint8 rand[16]; + CsrUint8 autn[16]; +} CsrWifiNmeSimUmtsAuthInd; + +/******************************************************************************* + + NAME + CsrWifiNmeWpsConfigSetCfm + + DESCRIPTION + Confirm. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Status of the request. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiNmeWpsConfigSetCfm; + +/******************************************************************************* + + NAME + CsrWifiNmeEventMaskSetCfm + + DESCRIPTION + The NME calls the primitive to report the result of the request + primitive. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiNmeEventMaskSetCfm; + + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_NME_PRIM_H__ */ + diff --git a/drivers/staging/csr/csr_wifi_nme_serialize.h b/drivers/staging/csr/csr_wifi_nme_serialize.h new file mode 100644 index 0000000..aeca9c8 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_nme_serialize.h @@ -0,0 +1,177 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_NME_SERIALIZE_H__ +#define CSR_WIFI_NME_SERIALIZE_H__ + +#include "csr_types.h" +#include "csr_pmem.h" +#include "csr_wifi_msgconv.h" + +#include "csr_wifi_nme_prim.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CSR_WIFI_NME_ENABLE +#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_serialize.h +#endif + +extern void CsrWifiNmePfree(void *ptr); + +extern CsrUint8* CsrWifiNmeProfileSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeProfileSetReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeProfileSetReqSizeof(void *msg); +extern void CsrWifiNmeProfileSetReqSerFree(void *msg); + +extern CsrUint8* CsrWifiNmeProfileDeleteReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeProfileDeleteReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeProfileDeleteReqSizeof(void *msg); +#define CsrWifiNmeProfileDeleteReqSerFree CsrWifiNmePfree + +#define CsrWifiNmeProfileDeleteAllReqSer CsrWifiEventSer +#define CsrWifiNmeProfileDeleteAllReqDes CsrWifiEventDes +#define CsrWifiNmeProfileDeleteAllReqSizeof CsrWifiEventSizeof +#define CsrWifiNmeProfileDeleteAllReqSerFree CsrWifiNmePfree + +extern CsrUint8* CsrWifiNmeProfileOrderSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeProfileOrderSetReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeProfileOrderSetReqSizeof(void *msg); +extern void CsrWifiNmeProfileOrderSetReqSerFree(void *msg); + +extern CsrUint8* CsrWifiNmeProfileConnectReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeProfileConnectReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeProfileConnectReqSizeof(void *msg); +#define CsrWifiNmeProfileConnectReqSerFree CsrWifiNmePfree + +extern CsrUint8* CsrWifiNmeWpsReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeWpsReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeWpsReqSizeof(void *msg); +#define CsrWifiNmeWpsReqSerFree CsrWifiNmePfree + +#define CsrWifiNmeWpsCancelReqSer CsrWifiEventCsrUint16Ser +#define CsrWifiNmeWpsCancelReqDes CsrWifiEventCsrUint16Des +#define CsrWifiNmeWpsCancelReqSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiNmeWpsCancelReqSerFree CsrWifiNmePfree + +#define CsrWifiNmeConnectionStatusGetReqSer CsrWifiEventCsrUint16Ser +#define CsrWifiNmeConnectionStatusGetReqDes CsrWifiEventCsrUint16Des +#define CsrWifiNmeConnectionStatusGetReqSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiNmeConnectionStatusGetReqSerFree CsrWifiNmePfree + +extern CsrUint8* CsrWifiNmeSimImsiGetResSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeSimImsiGetResDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeSimImsiGetResSizeof(void *msg); +extern void CsrWifiNmeSimImsiGetResSerFree(void *msg); + +extern CsrUint8* CsrWifiNmeSimGsmAuthResSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeSimGsmAuthResDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeSimGsmAuthResSizeof(void *msg); +extern void CsrWifiNmeSimGsmAuthResSerFree(void *msg); + +extern CsrUint8* CsrWifiNmeSimUmtsAuthResSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeSimUmtsAuthResDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeSimUmtsAuthResSizeof(void *msg); +extern void CsrWifiNmeSimUmtsAuthResSerFree(void *msg); + +extern CsrUint8* CsrWifiNmeWpsConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeWpsConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeWpsConfigSetReqSizeof(void *msg); +extern void CsrWifiNmeWpsConfigSetReqSerFree(void *msg); + +#define CsrWifiNmeEventMaskSetReqSer CsrWifiEventCsrUint32Ser +#define CsrWifiNmeEventMaskSetReqDes CsrWifiEventCsrUint32Des +#define CsrWifiNmeEventMaskSetReqSizeof CsrWifiEventCsrUint32Sizeof +#define CsrWifiNmeEventMaskSetReqSerFree CsrWifiNmePfree + +#define CsrWifiNmeProfileSetCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiNmeProfileSetCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiNmeProfileSetCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiNmeProfileSetCfmSerFree CsrWifiNmePfree + +#define CsrWifiNmeProfileDeleteCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiNmeProfileDeleteCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiNmeProfileDeleteCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiNmeProfileDeleteCfmSerFree CsrWifiNmePfree + +#define CsrWifiNmeProfileDeleteAllCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiNmeProfileDeleteAllCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiNmeProfileDeleteAllCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiNmeProfileDeleteAllCfmSerFree CsrWifiNmePfree + +extern CsrUint8* CsrWifiNmeProfileOrderSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeProfileOrderSetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeProfileOrderSetCfmSizeof(void *msg); +#define CsrWifiNmeProfileOrderSetCfmSerFree CsrWifiNmePfree + +extern CsrUint8* CsrWifiNmeProfileConnectCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeProfileConnectCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeProfileConnectCfmSizeof(void *msg); +extern void CsrWifiNmeProfileConnectCfmSerFree(void *msg); + +extern CsrUint8* CsrWifiNmeWpsCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeWpsCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeWpsCfmSizeof(void *msg); +extern void CsrWifiNmeWpsCfmSerFree(void *msg); + +extern CsrUint8* CsrWifiNmeWpsCancelCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeWpsCancelCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeWpsCancelCfmSizeof(void *msg); +#define CsrWifiNmeWpsCancelCfmSerFree CsrWifiNmePfree + +extern CsrUint8* CsrWifiNmeConnectionStatusGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeConnectionStatusGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeConnectionStatusGetCfmSizeof(void *msg); +#define CsrWifiNmeConnectionStatusGetCfmSerFree CsrWifiNmePfree + +extern CsrUint8* CsrWifiNmeProfileUpdateIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeProfileUpdateIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeProfileUpdateIndSizeof(void *msg); +extern void CsrWifiNmeProfileUpdateIndSerFree(void *msg); + +extern CsrUint8* CsrWifiNmeProfileDisconnectIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeProfileDisconnectIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeProfileDisconnectIndSizeof(void *msg); +extern void CsrWifiNmeProfileDisconnectIndSerFree(void *msg); + +#define CsrWifiNmeSimImsiGetIndSer CsrWifiEventSer +#define CsrWifiNmeSimImsiGetIndDes CsrWifiEventDes +#define CsrWifiNmeSimImsiGetIndSizeof CsrWifiEventSizeof +#define CsrWifiNmeSimImsiGetIndSerFree CsrWifiNmePfree + +extern CsrUint8* CsrWifiNmeSimGsmAuthIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeSimGsmAuthIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeSimGsmAuthIndSizeof(void *msg); +extern void CsrWifiNmeSimGsmAuthIndSerFree(void *msg); + +extern CsrUint8* CsrWifiNmeSimUmtsAuthIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeSimUmtsAuthIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiNmeSimUmtsAuthIndSizeof(void *msg); +#define CsrWifiNmeSimUmtsAuthIndSerFree CsrWifiNmePfree + +#define CsrWifiNmeWpsConfigSetCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiNmeWpsConfigSetCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiNmeWpsConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiNmeWpsConfigSetCfmSerFree CsrWifiNmePfree + +#define CsrWifiNmeEventMaskSetCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiNmeEventMaskSetCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiNmeEventMaskSetCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiNmeEventMaskSetCfmSerFree CsrWifiNmePfree + + +#ifdef __cplusplus +} +#endif +#endif /* CSR_WIFI_NME_SERIALIZE_H__ */ + diff --git a/drivers/staging/csr/csr_wifi_nme_task.h b/drivers/staging/csr/csr_wifi_nme_task.h new file mode 100644 index 0000000..2a03a19 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_nme_task.h @@ -0,0 +1,38 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_NME_TASK_H__ +#define CSR_WIFI_NME_TASK_H__ + +#include "csr_types.h" +#include "csr_sched.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CSR_WIFI_NME_ENABLE +#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_task.h +#endif + +#define CSR_WIFI_NME_LOG_ID 0x1203FFFF +extern CsrSchedQid CSR_WIFI_NME_IFACEQUEUE; +void CsrWifiNmeInit(void **gash); +void CsrWifiNmeDeinit(void **gash); +void CsrWifiNmeHandler(void **gash); + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_NME_TASK_H__ */ + diff --git a/drivers/staging/csr/csr_wifi_private_common.h b/drivers/staging/csr/csr_wifi_private_common.h new file mode 100644 index 0000000..b1d1239 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_private_common.h @@ -0,0 +1,91 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#ifndef CSR_WIFI_PRIVATE_COMMON_H__ +#define CSR_WIFI_PRIVATE_COMMON_H__ + +#include "csr_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief maximum number of STAs allowed to be connected + * + * @par Description + * min & max Beacon Interval + */ +#define CSR_WIFI_AP_MAX_ASSOC_STA 8 + +/** Number of only b rates */ +#define CSR_WIFI_SME_AP_MAX_ONLY_B_RATES 4 + + +/** Number of mandatory b rates */ +#define CSR_WIFI_SME_AP_MAX_MANDATORY_B_RATES 2 + + +/** Number of mandatory bg rates */ +#define CSR_WIFI_SME_AP_MAX_MANDATORY_BG_RATES 4 + + +/** Number of bg rates */ +#define CSR_WIFI_SME_AP_MAX_BG_RATES 12 + + +/** Number of no b only g rates */ +#define CSR_WIFI_SME_AP_MAX_NO_B_ONLY_G_RATES 8 + + +/** Number of mandatory g rates */ +#define CSR_WIFI_SME_AP_MAX_MANDATORY_G_RATES 7 + + +/* Number of g mandatory rates */ +#define CSR_WIFI_SME_AP_G_MANDATORY_RATES_NUM 7 + + +/* Number of b mandatory rates */ +#define CSR_WIFI_SME_AP_B_MANDATORY_RATES_NUM 2 + + +/* Number of b/g mandatory rates */ +#define CSR_WIFI_SME_AP_BG_MANDATORY_RATES_NUM 4 + + +/* The maximum allowed length of SSID */ +#define CSR_WIFI_SME_AP_SSID_MAX_LENGTH 32 + +/* Refer 8.4.2.27 RSN element - we support TKIP, WPA2, WAPI and PSK only, no pmkid, group cipher suite */ +#define CSR_WIFI_SME_RSN_PACKED_SIZE (1 + 1 + 2 + 4 + 2 + 4 * 2 + 2 + 4 * 1 + 2 + 24) + +/* Refer 7.3.2.9 (ISO/IEC 8802-11:2006) WAPI element - we support WAPI PSK only, no bkid, group cipher suite */ +#define CSR_WIFI_SME_WAPI_PACKED_SIZE (1 + 1 + 2 + 2 + 4 * 1 + 2 + 4 * 1 + 4 + 2 + 24) + + +/* Common structure for NME and SME to maintain Interface mode*/ +typedef CsrUint8 CsrWifiInterfaceMode; +#define CSR_WIFI_MODE_NONE ((CsrWifiInterfaceMode) 0xFF) +#define CSR_WIFI_MODE_STA ((CsrWifiInterfaceMode) 0x00) +#define CSR_WIFI_MODE_AP ((CsrWifiInterfaceMode) 0x01) +#define CSR_WIFI_MODE_P2P_DEVICE ((CsrWifiInterfaceMode) 0x02) +#define CSR_WIFI_MODE_P2P_CLI ((CsrWifiInterfaceMode) 0x03) +#define CSR_WIFI_MODE_P2P_GO ((CsrWifiInterfaceMode) 0x04) +#define CSR_WIFI_MODE_AMP ((CsrWifiInterfaceMode) 0x05) +#define CSR_WIFI_MODE_WPS_ENROLLEE ((CsrWifiInterfaceMode) 0x06) +#define CSR_WIFI_MODE_IBSS ((CsrWifiInterfaceMode) 0x07) + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/drivers/staging/csr/csr_wifi_result.h b/drivers/staging/csr/csr_wifi_result.h new file mode 100644 index 0000000..95b73a0 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_result.h @@ -0,0 +1,36 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#ifndef CSR_WIFI_RESULT_H__ +#define CSR_WIFI_RESULT_H__ + +#include "csr_types.h" +#include "csr_result.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* THIS FILE SHOULD CONTAIN ONLY RESULT CODES */ + +/* Result Codes */ +#define CSR_WIFI_HIP_RESULT_INVALID_VALUE ((CsrResult) 1) /* Invalid argument value */ +#define CSR_WIFI_HIP_RESULT_NO_DEVICE ((CsrResult) 2) /* The specified device is no longer present */ +#define CSR_WIFI_HIP_RESULT_NO_SPACE ((CsrResult) 3) /* A queue or buffer is full */ +#define CSR_WIFI_HIP_RESULT_NO_MEMORY ((CsrResult) 4) /* Fatal error, no memory */ +#define CSR_WIFI_HIP_RESULT_RANGE ((CsrResult) 5) /* Request exceeds the range of a file or a buffer */ +#define CSR_WIFI_HIP_RESULT_NOT_FOUND ((CsrResult) 6) /* A file (typically a f/w patch) is not found */ + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_RESULT_H__ */ + diff --git a/drivers/staging/csr/csr_wifi_router_converter_init.c b/drivers/staging/csr/csr_wifi_router_converter_init.c new file mode 100644 index 0000000..f7ee3f0 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_router_converter_init.c @@ -0,0 +1,83 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#include "csr_msgconv.h" +#include "csr_pmem.h" +#include "csr_util.h" + + +#ifdef CSR_LOG_ENABLE +#include "csr_log.h" +#endif + +#ifndef EXCLUDE_CSR_WIFI_ROUTER_MODULE +#include "csr_wifi_router_serialize.h" +#include "csr_wifi_router_prim.h" + +static CsrMsgConvMsgEntry csrwifirouter_conv_lut[] = { + { CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_REQ, CsrWifiRouterMaPacketSubscribeReqSizeof, CsrWifiRouterMaPacketSubscribeReqSer, CsrWifiRouterMaPacketSubscribeReqDes, CsrWifiRouterMaPacketSubscribeReqSerFree }, + { CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_REQ, CsrWifiRouterMaPacketUnsubscribeReqSizeof, CsrWifiRouterMaPacketUnsubscribeReqSer, CsrWifiRouterMaPacketUnsubscribeReqDes, CsrWifiRouterMaPacketUnsubscribeReqSerFree }, + { CSR_WIFI_ROUTER_MA_PACKET_REQ, CsrWifiRouterMaPacketReqSizeof, CsrWifiRouterMaPacketReqSer, CsrWifiRouterMaPacketReqDes, CsrWifiRouterMaPacketReqSerFree }, + { CSR_WIFI_ROUTER_MA_PACKET_RES, CsrWifiRouterMaPacketResSizeof, CsrWifiRouterMaPacketResSer, CsrWifiRouterMaPacketResDes, CsrWifiRouterMaPacketResSerFree }, + { CSR_WIFI_ROUTER_MA_PACKET_CANCEL_REQ, CsrWifiRouterMaPacketCancelReqSizeof, CsrWifiRouterMaPacketCancelReqSer, CsrWifiRouterMaPacketCancelReqDes, CsrWifiRouterMaPacketCancelReqSerFree }, + { CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_CFM, CsrWifiRouterMaPacketSubscribeCfmSizeof, CsrWifiRouterMaPacketSubscribeCfmSer, CsrWifiRouterMaPacketSubscribeCfmDes, CsrWifiRouterMaPacketSubscribeCfmSerFree }, + { CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_CFM, CsrWifiRouterMaPacketUnsubscribeCfmSizeof, CsrWifiRouterMaPacketUnsubscribeCfmSer, CsrWifiRouterMaPacketUnsubscribeCfmDes, CsrWifiRouterMaPacketUnsubscribeCfmSerFree }, + { CSR_WIFI_ROUTER_MA_PACKET_CFM, CsrWifiRouterMaPacketCfmSizeof, CsrWifiRouterMaPacketCfmSer, CsrWifiRouterMaPacketCfmDes, CsrWifiRouterMaPacketCfmSerFree }, + { CSR_WIFI_ROUTER_MA_PACKET_IND, CsrWifiRouterMaPacketIndSizeof, CsrWifiRouterMaPacketIndSer, CsrWifiRouterMaPacketIndDes, CsrWifiRouterMaPacketIndSerFree }, + + { 0, NULL, NULL, NULL, NULL }, +}; + +CsrMsgConvMsgEntry* CsrWifiRouterConverterLookup(CsrMsgConvMsgEntry *ce, CsrUint16 msgType) +{ + if (msgType & CSR_PRIM_UPSTREAM) + { + CsrUint16 index = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT; + if (index < (CSR_WIFI_ROUTER_PRIM_UPSTREAM_COUNT + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT) && + csrwifirouter_conv_lut[index].msgType == msgType) + { + return &csrwifirouter_conv_lut[index]; + } + } + else + { + if (msgType < CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT && + csrwifirouter_conv_lut[msgType].msgType == msgType) + { + return &csrwifirouter_conv_lut[msgType]; + } + } + return NULL; +} + + +void CsrWifiRouterConverterInit(void) +{ + CsrMsgConvInsert(CSR_WIFI_ROUTER_PRIM, csrwifirouter_conv_lut); + CsrMsgConvCustomLookupRegister(CSR_WIFI_ROUTER_PRIM, CsrWifiRouterConverterLookup); +} + + +#ifdef CSR_LOG_ENABLE +static const CsrLogPrimitiveInformation csrwifirouter_conv_info = { + CSR_WIFI_ROUTER_PRIM, + (CsrCharString *)"CSR_WIFI_ROUTER_PRIM", + csrwifirouter_conv_lut +}; +const CsrLogPrimitiveInformation* CsrWifiRouterTechInfoGet(void) +{ + return &csrwifirouter_conv_info; +} + + +#endif /* CSR_LOG_ENABLE */ +#endif /* EXCLUDE_CSR_WIFI_ROUTER_MODULE */ diff --git a/drivers/staging/csr/csr_wifi_router_converter_init.h b/drivers/staging/csr/csr_wifi_router_converter_init.h new file mode 100644 index 0000000..2a293e4 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_router_converter_init.h @@ -0,0 +1,42 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_ROUTER_CONVERTER_INIT_H__ +#define CSR_WIFI_ROUTER_CONVERTER_INIT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef EXCLUDE_CSR_WIFI_ROUTER_MODULE + +#include "csr_msgconv.h" + +#ifdef CSR_LOG_ENABLE +#include "csr_log.h" + +extern const CsrLogPrimitiveInformation* CsrWifiRouterTechInfoGet(void); +#endif /* CSR_LOG_ENABLE */ + +extern void CsrWifiRouterConverterInit(void); + +#else /* EXCLUDE_CSR_WIFI_ROUTER_MODULE */ + +#define CsrWifiRouterConverterInit() + +#endif /* EXCLUDE_CSR_WIFI_ROUTER_MODULE */ + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_ROUTER_CONVERTER_INIT_H__ */ diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c b/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c new file mode 100644 index 0000000..36403fc --- /dev/null +++ b/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c @@ -0,0 +1,132 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#include "csr_msgconv.h" +#include "csr_pmem.h" +#include "csr_util.h" + + +#ifdef CSR_LOG_ENABLE +#include "csr_log.h" +#endif + +#ifndef EXCLUDE_CSR_WIFI_ROUTER_CTRL_MODULE +#include "csr_wifi_router_ctrl_serialize.h" +#include "csr_wifi_router_ctrl_prim.h" + +static CsrMsgConvMsgEntry csrwifirouterctrl_conv_lut[] = { + { CSR_WIFI_ROUTER_CTRL_CONFIGURE_POWER_MODE_REQ, CsrWifiRouterCtrlConfigurePowerModeReqSizeof, CsrWifiRouterCtrlConfigurePowerModeReqSer, CsrWifiRouterCtrlConfigurePowerModeReqDes, CsrWifiRouterCtrlConfigurePowerModeReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_HIP_REQ, CsrWifiRouterCtrlHipReqSizeof, CsrWifiRouterCtrlHipReqSer, CsrWifiRouterCtrlHipReqDes, CsrWifiRouterCtrlHipReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_REQ, CsrWifiRouterCtrlMediaStatusReqSizeof, CsrWifiRouterCtrlMediaStatusReqSer, CsrWifiRouterCtrlMediaStatusReqDes, CsrWifiRouterCtrlMediaStatusReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_RES, CsrWifiRouterCtrlMulticastAddressResSizeof, CsrWifiRouterCtrlMulticastAddressResSer, CsrWifiRouterCtrlMulticastAddressResDes, CsrWifiRouterCtrlMulticastAddressResSerFree }, + { CSR_WIFI_ROUTER_CTRL_PORT_CONFIGURE_REQ, CsrWifiRouterCtrlPortConfigureReqSizeof, CsrWifiRouterCtrlPortConfigureReqSer, CsrWifiRouterCtrlPortConfigureReqDes, CsrWifiRouterCtrlPortConfigureReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_REQ, CsrWifiRouterCtrlQosControlReqSizeof, CsrWifiRouterCtrlQosControlReqSer, CsrWifiRouterCtrlQosControlReqDes, CsrWifiRouterCtrlQosControlReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_SUSPEND_RES, CsrWifiRouterCtrlSuspendResSizeof, CsrWifiRouterCtrlSuspendResSer, CsrWifiRouterCtrlSuspendResDes, CsrWifiRouterCtrlSuspendResSerFree }, + { CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_REQ, CsrWifiRouterCtrlTclasAddReqSizeof, CsrWifiRouterCtrlTclasAddReqSer, CsrWifiRouterCtrlTclasAddReqDes, CsrWifiRouterCtrlTclasAddReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_RESUME_RES, CsrWifiRouterCtrlResumeResSizeof, CsrWifiRouterCtrlResumeResSer, CsrWifiRouterCtrlResumeResDes, CsrWifiRouterCtrlResumeResSerFree }, + { CSR_WIFI_ROUTER_CTRL_RAW_SDIO_DEINITIALISE_REQ, CsrWifiRouterCtrlRawSdioDeinitialiseReqSizeof, CsrWifiRouterCtrlRawSdioDeinitialiseReqSer, CsrWifiRouterCtrlRawSdioDeinitialiseReqDes, CsrWifiRouterCtrlRawSdioDeinitialiseReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_RAW_SDIO_INITIALISE_REQ, CsrWifiRouterCtrlRawSdioInitialiseReqSizeof, CsrWifiRouterCtrlRawSdioInitialiseReqSer, CsrWifiRouterCtrlRawSdioInitialiseReqDes, CsrWifiRouterCtrlRawSdioInitialiseReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_REQ, CsrWifiRouterCtrlTclasDelReqSizeof, CsrWifiRouterCtrlTclasDelReqSer, CsrWifiRouterCtrlTclasDelReqDes, CsrWifiRouterCtrlTclasDelReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_TRAFFIC_CLASSIFICATION_REQ, CsrWifiRouterCtrlTrafficClassificationReqSizeof, CsrWifiRouterCtrlTrafficClassificationReqSer, CsrWifiRouterCtrlTrafficClassificationReqDes, CsrWifiRouterCtrlTrafficClassificationReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_REQ, CsrWifiRouterCtrlTrafficConfigReqSizeof, CsrWifiRouterCtrlTrafficConfigReqSer, CsrWifiRouterCtrlTrafficConfigReqDes, CsrWifiRouterCtrlTrafficConfigReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_WIFI_OFF_REQ, CsrWifiRouterCtrlWifiOffReqSizeof, CsrWifiRouterCtrlWifiOffReqSer, CsrWifiRouterCtrlWifiOffReqDes, CsrWifiRouterCtrlWifiOffReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_WIFI_OFF_RES, CsrWifiRouterCtrlWifiOffResSizeof, CsrWifiRouterCtrlWifiOffResSer, CsrWifiRouterCtrlWifiOffResDes, CsrWifiRouterCtrlWifiOffResSerFree }, + { CSR_WIFI_ROUTER_CTRL_WIFI_ON_REQ, CsrWifiRouterCtrlWifiOnReqSizeof, CsrWifiRouterCtrlWifiOnReqSer, CsrWifiRouterCtrlWifiOnReqDes, CsrWifiRouterCtrlWifiOnReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_WIFI_ON_RES, CsrWifiRouterCtrlWifiOnResSizeof, CsrWifiRouterCtrlWifiOnResSer, CsrWifiRouterCtrlWifiOnResDes, CsrWifiRouterCtrlWifiOnResSerFree }, + { CSR_WIFI_ROUTER_CTRL_M4_TRANSMIT_REQ, CsrWifiRouterCtrlM4TransmitReqSizeof, CsrWifiRouterCtrlM4TransmitReqSer, CsrWifiRouterCtrlM4TransmitReqDes, CsrWifiRouterCtrlM4TransmitReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_MODE_SET_REQ, CsrWifiRouterCtrlModeSetReqSizeof, CsrWifiRouterCtrlModeSetReqSer, CsrWifiRouterCtrlModeSetReqDes, CsrWifiRouterCtrlModeSetReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_PEER_ADD_REQ, CsrWifiRouterCtrlPeerAddReqSizeof, CsrWifiRouterCtrlPeerAddReqSer, CsrWifiRouterCtrlPeerAddReqDes, CsrWifiRouterCtrlPeerAddReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_PEER_DEL_REQ, CsrWifiRouterCtrlPeerDelReqSizeof, CsrWifiRouterCtrlPeerDelReqSer, CsrWifiRouterCtrlPeerDelReqDes, CsrWifiRouterCtrlPeerDelReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_PEER_UPDATE_REQ, CsrWifiRouterCtrlPeerUpdateReqSizeof, CsrWifiRouterCtrlPeerUpdateReqSer, CsrWifiRouterCtrlPeerUpdateReqDes, CsrWifiRouterCtrlPeerUpdateReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_CAPABILITIES_REQ, CsrWifiRouterCtrlCapabilitiesReqSizeof, CsrWifiRouterCtrlCapabilitiesReqSer, CsrWifiRouterCtrlCapabilitiesReqDes, CsrWifiRouterCtrlCapabilitiesReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_REQ, CsrWifiRouterCtrlBlockAckEnableReqSizeof, CsrWifiRouterCtrlBlockAckEnableReqSer, CsrWifiRouterCtrlBlockAckEnableReqDes, CsrWifiRouterCtrlBlockAckEnableReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_REQ, CsrWifiRouterCtrlBlockAckDisableReqSizeof, CsrWifiRouterCtrlBlockAckDisableReqSer, CsrWifiRouterCtrlBlockAckDisableReqDes, CsrWifiRouterCtrlBlockAckDisableReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_REQ, CsrWifiRouterCtrlWapiMulticastReqSizeof, CsrWifiRouterCtrlWapiMulticastReqSer, CsrWifiRouterCtrlWapiMulticastReqDes, CsrWifiRouterCtrlWapiMulticastReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_FILTER_REQ, CsrWifiRouterCtrlWapiMulticastFilterReqSizeof, CsrWifiRouterCtrlWapiMulticastFilterReqSer, CsrWifiRouterCtrlWapiMulticastFilterReqDes, CsrWifiRouterCtrlWapiMulticastFilterReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_FILTER_REQ, CsrWifiRouterCtrlWapiUnicastFilterReqSizeof, CsrWifiRouterCtrlWapiUnicastFilterReqSer, CsrWifiRouterCtrlWapiUnicastFilterReqDes, CsrWifiRouterCtrlWapiUnicastFilterReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_HIP_IND, CsrWifiRouterCtrlHipIndSizeof, CsrWifiRouterCtrlHipIndSer, CsrWifiRouterCtrlHipIndDes, CsrWifiRouterCtrlHipIndSerFree }, + { CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_IND, CsrWifiRouterCtrlMulticastAddressIndSizeof, CsrWifiRouterCtrlMulticastAddressIndSer, CsrWifiRouterCtrlMulticastAddressIndDes, CsrWifiRouterCtrlMulticastAddressIndSerFree }, + { CSR_WIFI_ROUTER_CTRL_PORT_CONFIGURE_CFM, CsrWifiRouterCtrlPortConfigureCfmSizeof, CsrWifiRouterCtrlPortConfigureCfmSer, CsrWifiRouterCtrlPortConfigureCfmDes, CsrWifiRouterCtrlPortConfigureCfmSerFree }, + { CSR_WIFI_ROUTER_CTRL_RESUME_IND, CsrWifiRouterCtrlResumeIndSizeof, CsrWifiRouterCtrlResumeIndSer, CsrWifiRouterCtrlResumeIndDes, CsrWifiRouterCtrlResumeIndSerFree }, + { CSR_WIFI_ROUTER_CTRL_SUSPEND_IND, CsrWifiRouterCtrlSuspendIndSizeof, CsrWifiRouterCtrlSuspendIndSer, CsrWifiRouterCtrlSuspendIndDes, CsrWifiRouterCtrlSuspendIndSerFree }, + { CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_CFM, CsrWifiRouterCtrlTclasAddCfmSizeof, CsrWifiRouterCtrlTclasAddCfmSer, CsrWifiRouterCtrlTclasAddCfmDes, CsrWifiRouterCtrlTclasAddCfmSerFree }, + { CSR_WIFI_ROUTER_CTRL_RAW_SDIO_DEINITIALISE_CFM, CsrWifiRouterCtrlRawSdioDeinitialiseCfmSizeof, CsrWifiRouterCtrlRawSdioDeinitialiseCfmSer, CsrWifiRouterCtrlRawSdioDeinitialiseCfmDes, CsrWifiRouterCtrlRawSdioDeinitialiseCfmSerFree }, + { CSR_WIFI_ROUTER_CTRL_RAW_SDIO_INITIALISE_CFM, CsrWifiRouterCtrlRawSdioInitialiseCfmSizeof, CsrWifiRouterCtrlRawSdioInitialiseCfmSer, CsrWifiRouterCtrlRawSdioInitialiseCfmDes, CsrWifiRouterCtrlRawSdioInitialiseCfmSerFree }, + { CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_CFM, CsrWifiRouterCtrlTclasDelCfmSizeof, CsrWifiRouterCtrlTclasDelCfmSer, CsrWifiRouterCtrlTclasDelCfmDes, CsrWifiRouterCtrlTclasDelCfmSerFree }, + { CSR_WIFI_ROUTER_CTRL_TRAFFIC_PROTOCOL_IND, CsrWifiRouterCtrlTrafficProtocolIndSizeof, CsrWifiRouterCtrlTrafficProtocolIndSer, CsrWifiRouterCtrlTrafficProtocolIndDes, CsrWifiRouterCtrlTrafficProtocolIndSerFree }, + { CSR_WIFI_ROUTER_CTRL_TRAFFIC_SAMPLE_IND, CsrWifiRouterCtrlTrafficSampleIndSizeof, CsrWifiRouterCtrlTrafficSampleIndSer, CsrWifiRouterCtrlTrafficSampleIndDes, CsrWifiRouterCtrlTrafficSampleIndSerFree }, + { CSR_WIFI_ROUTER_CTRL_WIFI_OFF_IND, CsrWifiRouterCtrlWifiOffIndSizeof, CsrWifiRouterCtrlWifiOffIndSer, CsrWifiRouterCtrlWifiOffIndDes, CsrWifiRouterCtrlWifiOffIndSerFree }, + { CSR_WIFI_ROUTER_CTRL_WIFI_OFF_CFM, CsrWifiRouterCtrlWifiOffCfmSizeof, CsrWifiRouterCtrlWifiOffCfmSer, CsrWifiRouterCtrlWifiOffCfmDes, CsrWifiRouterCtrlWifiOffCfmSerFree }, + { CSR_WIFI_ROUTER_CTRL_WIFI_ON_IND, CsrWifiRouterCtrlWifiOnIndSizeof, CsrWifiRouterCtrlWifiOnIndSer, CsrWifiRouterCtrlWifiOnIndDes, CsrWifiRouterCtrlWifiOnIndSerFree }, + { CSR_WIFI_ROUTER_CTRL_WIFI_ON_CFM, CsrWifiRouterCtrlWifiOnCfmSizeof, CsrWifiRouterCtrlWifiOnCfmSer, CsrWifiRouterCtrlWifiOnCfmDes, CsrWifiRouterCtrlWifiOnCfmSerFree }, + { CSR_WIFI_ROUTER_CTRL_M4_READY_TO_SEND_IND, CsrWifiRouterCtrlM4ReadyToSendIndSizeof, CsrWifiRouterCtrlM4ReadyToSendIndSer, CsrWifiRouterCtrlM4ReadyToSendIndDes, CsrWifiRouterCtrlM4ReadyToSendIndSerFree }, + { CSR_WIFI_ROUTER_CTRL_M4_TRANSMITTED_IND, CsrWifiRouterCtrlM4TransmittedIndSizeof, CsrWifiRouterCtrlM4TransmittedIndSer, CsrWifiRouterCtrlM4TransmittedIndDes, CsrWifiRouterCtrlM4TransmittedIndSerFree }, + { CSR_WIFI_ROUTER_CTRL_MIC_FAILURE_IND, CsrWifiRouterCtrlMicFailureIndSizeof, CsrWifiRouterCtrlMicFailureIndSer, CsrWifiRouterCtrlMicFailureIndDes, CsrWifiRouterCtrlMicFailureIndSerFree }, + { CSR_WIFI_ROUTER_CTRL_CONNECTED_IND, CsrWifiRouterCtrlConnectedIndSizeof, CsrWifiRouterCtrlConnectedIndSer, CsrWifiRouterCtrlConnectedIndDes, CsrWifiRouterCtrlConnectedIndSerFree }, + { CSR_WIFI_ROUTER_CTRL_PEER_ADD_CFM, CsrWifiRouterCtrlPeerAddCfmSizeof, CsrWifiRouterCtrlPeerAddCfmSer, CsrWifiRouterCtrlPeerAddCfmDes, CsrWifiRouterCtrlPeerAddCfmSerFree }, + { CSR_WIFI_ROUTER_CTRL_PEER_DEL_CFM, CsrWifiRouterCtrlPeerDelCfmSizeof, CsrWifiRouterCtrlPeerDelCfmSer, CsrWifiRouterCtrlPeerDelCfmDes, CsrWifiRouterCtrlPeerDelCfmSerFree }, + { CSR_WIFI_ROUTER_CTRL_UNEXPECTED_FRAME_IND, CsrWifiRouterCtrlUnexpectedFrameIndSizeof, CsrWifiRouterCtrlUnexpectedFrameIndSer, CsrWifiRouterCtrlUnexpectedFrameIndDes, CsrWifiRouterCtrlUnexpectedFrameIndSerFree }, + { CSR_WIFI_ROUTER_CTRL_PEER_UPDATE_CFM, CsrWifiRouterCtrlPeerUpdateCfmSizeof, CsrWifiRouterCtrlPeerUpdateCfmSer, CsrWifiRouterCtrlPeerUpdateCfmDes, CsrWifiRouterCtrlPeerUpdateCfmSerFree }, + { CSR_WIFI_ROUTER_CTRL_CAPABILITIES_CFM, CsrWifiRouterCtrlCapabilitiesCfmSizeof, CsrWifiRouterCtrlCapabilitiesCfmSer, CsrWifiRouterCtrlCapabilitiesCfmDes, CsrWifiRouterCtrlCapabilitiesCfmSerFree }, + { CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_CFM, CsrWifiRouterCtrlBlockAckEnableCfmSizeof, CsrWifiRouterCtrlBlockAckEnableCfmSer, CsrWifiRouterCtrlBlockAckEnableCfmDes, CsrWifiRouterCtrlBlockAckEnableCfmSerFree }, + { CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_CFM, CsrWifiRouterCtrlBlockAckDisableCfmSizeof, CsrWifiRouterCtrlBlockAckDisableCfmSer, CsrWifiRouterCtrlBlockAckDisableCfmDes, CsrWifiRouterCtrlBlockAckDisableCfmSerFree }, + { CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ERROR_IND, CsrWifiRouterCtrlBlockAckErrorIndSizeof, CsrWifiRouterCtrlBlockAckErrorIndSer, CsrWifiRouterCtrlBlockAckErrorIndDes, CsrWifiRouterCtrlBlockAckErrorIndSerFree }, + { CSR_WIFI_ROUTER_CTRL_STA_INACTIVE_IND, CsrWifiRouterCtrlStaInactiveIndSizeof, CsrWifiRouterCtrlStaInactiveIndSer, CsrWifiRouterCtrlStaInactiveIndDes, CsrWifiRouterCtrlStaInactiveIndSerFree }, + { CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_IND, CsrWifiRouterCtrlWapiMulticastIndSizeof, CsrWifiRouterCtrlWapiMulticastIndSer, CsrWifiRouterCtrlWapiMulticastIndDes, CsrWifiRouterCtrlWapiMulticastIndSerFree }, + + { 0, NULL, NULL, NULL, NULL }, +}; + +CsrMsgConvMsgEntry* CsrWifiRouterCtrlConverterLookup(CsrMsgConvMsgEntry *ce, CsrUint16 msgType) +{ + if (msgType & CSR_PRIM_UPSTREAM) + { + CsrUint16 index = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT; + if (index < (CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_COUNT + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT) && + csrwifirouterctrl_conv_lut[index].msgType == msgType) + { + return &csrwifirouterctrl_conv_lut[index]; + } + } + else + { + if (msgType < CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT && + csrwifirouterctrl_conv_lut[msgType].msgType == msgType) + { + return &csrwifirouterctrl_conv_lut[msgType]; + } + } + return NULL; +} + + +void CsrWifiRouterCtrlConverterInit(void) +{ + CsrMsgConvInsert(CSR_WIFI_ROUTER_CTRL_PRIM, csrwifirouterctrl_conv_lut); + CsrMsgConvCustomLookupRegister(CSR_WIFI_ROUTER_CTRL_PRIM, CsrWifiRouterCtrlConverterLookup); +} + + +#ifdef CSR_LOG_ENABLE +static const CsrLogPrimitiveInformation csrwifirouterctrl_conv_info = { + CSR_WIFI_ROUTER_CTRL_PRIM, + (CsrCharString *)"CSR_WIFI_ROUTER_CTRL_PRIM", + csrwifirouterctrl_conv_lut +}; +const CsrLogPrimitiveInformation* CsrWifiRouterCtrlTechInfoGet(void) +{ + return &csrwifirouterctrl_conv_info; +} + + +#endif /* CSR_LOG_ENABLE */ +#endif /* EXCLUDE_CSR_WIFI_ROUTER_CTRL_MODULE */ diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.h b/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.h new file mode 100644 index 0000000..0c9d26b --- /dev/null +++ b/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.h @@ -0,0 +1,42 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_ROUTER_CTRL_CONVERTER_INIT_H__ +#define CSR_WIFI_ROUTER_CTRL_CONVERTER_INIT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef EXCLUDE_CSR_WIFI_ROUTER_CTRL_MODULE + +#include "csr_msgconv.h" + +#ifdef CSR_LOG_ENABLE +#include "csr_log.h" + +extern const CsrLogPrimitiveInformation* CsrWifiRouterCtrlTechInfoGet(void); +#endif /* CSR_LOG_ENABLE */ + +extern void CsrWifiRouterCtrlConverterInit(void); + +#else /* EXCLUDE_CSR_WIFI_ROUTER_CTRL_MODULE */ + +#define CsrWifiRouterCtrlConverterInit() + +#endif /* EXCLUDE_CSR_WIFI_ROUTER_CTRL_MODULE */ + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_ROUTER_CTRL_CONVERTER_INIT_H__ */ diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c new file mode 100644 index 0000000..57aa367 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c @@ -0,0 +1,95 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#include "csr_pmem.h" +#include "csr_wifi_router_ctrl_prim.h" +#include "csr_wifi_router_ctrl_lib.h" + +/*----------------------------------------------------------------------------* + * NAME + * CsrWifiRouterCtrlFreeDownstreamMessageContents + * + * DESCRIPTION + * + * + * PARAMETERS + * eventClass: only the value CSR_WIFI_ROUTER_CTRL_PRIM will be handled + * message: the message to free + *----------------------------------------------------------------------------*/ +void CsrWifiRouterCtrlFreeDownstreamMessageContents(CsrUint16 eventClass, void *message) +{ + if (eventClass != CSR_WIFI_ROUTER_CTRL_PRIM) + { + return; + } + if (NULL == message) + { + return; + } + + switch (*((CsrWifiRouterCtrlPrim *) message)) + { + case CSR_WIFI_ROUTER_CTRL_HIP_REQ: + { + CsrWifiRouterCtrlHipReq *p = (CsrWifiRouterCtrlHipReq *)message; + CsrPmemFree(p->mlmeCommand); + p->mlmeCommand = NULL; + CsrPmemFree(p->dataRef1); + p->dataRef1 = NULL; + CsrPmemFree(p->dataRef2); + p->dataRef2 = NULL; + break; + } + case CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_RES: + { + CsrWifiRouterCtrlMulticastAddressRes *p = (CsrWifiRouterCtrlMulticastAddressRes *)message; + CsrPmemFree(p->getAddresses); + p->getAddresses = NULL; + break; + } + case CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_REQ: + { + CsrWifiRouterCtrlTclasAddReq *p = (CsrWifiRouterCtrlTclasAddReq *)message; + CsrPmemFree(p->tclas); + p->tclas = NULL; + break; + } + case CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_REQ: + { + CsrWifiRouterCtrlTclasDelReq *p = (CsrWifiRouterCtrlTclasDelReq *)message; + CsrPmemFree(p->tclas); + p->tclas = NULL; + break; + } + case CSR_WIFI_ROUTER_CTRL_WIFI_ON_RES: + { + CsrWifiRouterCtrlWifiOnRes *p = (CsrWifiRouterCtrlWifiOnRes *)message; + CsrPmemFree(p->smeVersions.smeBuild); + p->smeVersions.smeBuild = NULL; + break; + } + case CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_REQ: + { + CsrWifiRouterCtrlWapiMulticastReq *p = (CsrWifiRouterCtrlWapiMulticastReq *)message; + CsrPmemFree(p->signal); + p->signal = NULL; + CsrPmemFree(p->data); + p->data = NULL; + break; + } + + default: + break; + } +} + + diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c new file mode 100644 index 0000000..25e3273 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c @@ -0,0 +1,81 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#include "csr_pmem.h" +#include "csr_wifi_router_ctrl_prim.h" +#include "csr_wifi_router_ctrl_lib.h" + +/*----------------------------------------------------------------------------* + * NAME + * CsrWifiRouterCtrlFreeUpstreamMessageContents + * + * DESCRIPTION + * + * + * PARAMETERS + * eventClass: only the value CSR_WIFI_ROUTER_CTRL_PRIM will be handled + * message: the message to free + *----------------------------------------------------------------------------*/ +void CsrWifiRouterCtrlFreeUpstreamMessageContents(CsrUint16 eventClass, void *message) +{ + if (eventClass != CSR_WIFI_ROUTER_CTRL_PRIM) + { + return; + } + if (NULL == message) + { + return; + } + + switch (*((CsrWifiRouterCtrlPrim *) message)) + { + case CSR_WIFI_ROUTER_CTRL_HIP_IND: + { + CsrWifiRouterCtrlHipInd *p = (CsrWifiRouterCtrlHipInd *)message; + CsrPmemFree(p->mlmeCommand); + p->mlmeCommand = NULL; + CsrPmemFree(p->dataRef1); + p->dataRef1 = NULL; + CsrPmemFree(p->dataRef2); + p->dataRef2 = NULL; + break; + } + case CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_IND: + { + CsrWifiRouterCtrlMulticastAddressInd *p = (CsrWifiRouterCtrlMulticastAddressInd *)message; + CsrPmemFree(p->setAddresses); + p->setAddresses = NULL; + break; + } + case CSR_WIFI_ROUTER_CTRL_WIFI_ON_IND: + { + CsrWifiRouterCtrlWifiOnInd *p = (CsrWifiRouterCtrlWifiOnInd *)message; + CsrPmemFree(p->versions.routerBuild); + p->versions.routerBuild = NULL; + break; + } + case CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_IND: + { + CsrWifiRouterCtrlWapiMulticastInd *p = (CsrWifiRouterCtrlWapiMulticastInd *)message; + CsrPmemFree(p->signal); + p->signal = NULL; + CsrPmemFree(p->data); + p->data = NULL; + break; + } + + default: + break; + } +} + + diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_lib.h b/drivers/staging/csr/csr_wifi_router_ctrl_lib.h new file mode 100644 index 0000000..f0ad836 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_router_ctrl_lib.h @@ -0,0 +1,1958 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_ROUTER_CTRL_LIB_H__ +#define CSR_WIFI_ROUTER_CTRL_LIB_H__ + +#include "csr_types.h" +#include "csr_pmem.h" +#include "csr_sched.h" +#include "csr_util.h" +#include "csr_msg_transport.h" + +#include "csr_wifi_lib.h" + +#include "csr_wifi_router_ctrl_prim.h" +#include "csr_wifi_router_task.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/*----------------------------------------------------------------------------* + * CsrWifiRouterCtrlFreeUpstreamMessageContents + * + * DESCRIPTION + * Free the allocated memory in a CSR_WIFI_ROUTER_CTRL upstream message. Does not + * free the message itself, and can only be used for upstream messages. + * + * PARAMETERS + * Deallocates the resources in a CSR_WIFI_ROUTER_CTRL upstream message + *----------------------------------------------------------------------------*/ +void CsrWifiRouterCtrlFreeUpstreamMessageContents(CsrUint16 eventClass, void *message); + +/*----------------------------------------------------------------------------* + * CsrWifiRouterCtrlFreeDownstreamMessageContents + * + * DESCRIPTION + * Free the allocated memory in a CSR_WIFI_ROUTER_CTRL downstream message. Does not + * free the message itself, and can only be used for downstream messages. + * + * PARAMETERS + * Deallocates the resources in a CSR_WIFI_ROUTER_CTRL downstream message + *----------------------------------------------------------------------------*/ +void CsrWifiRouterCtrlFreeDownstreamMessageContents(CsrUint16 eventClass, void *message); + +/*----------------------------------------------------------------------------* + * Enum to string functions + *----------------------------------------------------------------------------*/ +const CsrCharString* CsrWifiRouterCtrlBlockAckRoleToString(CsrWifiRouterCtrlBlockAckRole value); +const CsrCharString* CsrWifiRouterCtrlControlIndicationToString(CsrWifiRouterCtrlControlIndication value); +const CsrCharString* CsrWifiRouterCtrlListActionToString(CsrWifiRouterCtrlListAction value); +const CsrCharString* CsrWifiRouterCtrlLowPowerModeToString(CsrWifiRouterCtrlLowPowerMode value); +const CsrCharString* CsrWifiRouterCtrlMediaStatusToString(CsrWifiRouterCtrlMediaStatus value); +const CsrCharString* CsrWifiRouterCtrlModeToString(CsrWifiRouterCtrlMode value); +const CsrCharString* CsrWifiRouterCtrlPeerStatusToString(CsrWifiRouterCtrlPeerStatus value); +const CsrCharString* CsrWifiRouterCtrlPortActionToString(CsrWifiRouterCtrlPortAction value); +const CsrCharString* CsrWifiRouterCtrlPowersaveTypeToString(CsrWifiRouterCtrlPowersaveType value); +const CsrCharString* CsrWifiRouterCtrlProtocolDirectionToString(CsrWifiRouterCtrlProtocolDirection value); +const CsrCharString* CsrWifiRouterCtrlQoSControlToString(CsrWifiRouterCtrlQoSControl value); +const CsrCharString* CsrWifiRouterCtrlQueueConfigToString(CsrWifiRouterCtrlQueueConfig value); +const CsrCharString* CsrWifiRouterCtrlTrafficConfigTypeToString(CsrWifiRouterCtrlTrafficConfigType value); +const CsrCharString* CsrWifiRouterCtrlTrafficPacketTypeToString(CsrWifiRouterCtrlTrafficPacketType value); +const CsrCharString* CsrWifiRouterCtrlTrafficTypeToString(CsrWifiRouterCtrlTrafficType value); + + +/*----------------------------------------------------------------------------* + * CsrPrim Type toString function. + * Converts a message type to the String name of the Message + *----------------------------------------------------------------------------*/ +const CsrCharString* CsrWifiRouterCtrlPrimTypeToString(CsrPrim msgType); + +/*----------------------------------------------------------------------------* + * Lookup arrays for PrimType name Strings + *----------------------------------------------------------------------------*/ +extern const CsrCharString *CsrWifiRouterCtrlUpstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_COUNT]; +extern const CsrCharString *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT]; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlBlockAckDisableReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + clientData - + macAddress - + trafficStreamID - + role - + +*******************************************************************************/ +#define CsrWifiRouterCtrlBlockAckDisableReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__) \ + msg__ = (CsrWifiRouterCtrlBlockAckDisableReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckDisableReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->clientData = (clientData__); \ + msg__->macAddress = (macAddress__); \ + msg__->trafficStreamID = (trafficStreamID__); \ + msg__->role = (role__); + +#define CsrWifiRouterCtrlBlockAckDisableReqSendTo(dst__, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__) \ + { \ + CsrWifiRouterCtrlBlockAckDisableReq *msg__; \ + CsrWifiRouterCtrlBlockAckDisableReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlBlockAckDisableReqSend(src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__) \ + CsrWifiRouterCtrlBlockAckDisableReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlBlockAckDisableCfmSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + interfaceTag - + status - + +*******************************************************************************/ +#define CsrWifiRouterCtrlBlockAckDisableCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \ + msg__ = (CsrWifiRouterCtrlBlockAckDisableCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckDisableCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_CFM, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); + +#define CsrWifiRouterCtrlBlockAckDisableCfmSendTo(dst__, src__, clientData__, interfaceTag__, status__) \ + { \ + CsrWifiRouterCtrlBlockAckDisableCfm *msg__; \ + CsrWifiRouterCtrlBlockAckDisableCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlBlockAckDisableCfmSend(dst__, clientData__, interfaceTag__, status__) \ + CsrWifiRouterCtrlBlockAckDisableCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, status__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlBlockAckEnableReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + clientData - + macAddress - + trafficStreamID - + role - + bufferSize - + timeout - + ssn - + +*******************************************************************************/ +#define CsrWifiRouterCtrlBlockAckEnableReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__, bufferSize__, timeout__, ssn__) \ + msg__ = (CsrWifiRouterCtrlBlockAckEnableReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckEnableReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->clientData = (clientData__); \ + msg__->macAddress = (macAddress__); \ + msg__->trafficStreamID = (trafficStreamID__); \ + msg__->role = (role__); \ + msg__->bufferSize = (bufferSize__); \ + msg__->timeout = (timeout__); \ + msg__->ssn = (ssn__); + +#define CsrWifiRouterCtrlBlockAckEnableReqSendTo(dst__, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__, bufferSize__, timeout__, ssn__) \ + { \ + CsrWifiRouterCtrlBlockAckEnableReq *msg__; \ + CsrWifiRouterCtrlBlockAckEnableReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__, bufferSize__, timeout__, ssn__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlBlockAckEnableReqSend(src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__, bufferSize__, timeout__, ssn__) \ + CsrWifiRouterCtrlBlockAckEnableReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__, bufferSize__, timeout__, ssn__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlBlockAckEnableCfmSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + interfaceTag - + status - + +*******************************************************************************/ +#define CsrWifiRouterCtrlBlockAckEnableCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \ + msg__ = (CsrWifiRouterCtrlBlockAckEnableCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckEnableCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_CFM, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); + +#define CsrWifiRouterCtrlBlockAckEnableCfmSendTo(dst__, src__, clientData__, interfaceTag__, status__) \ + { \ + CsrWifiRouterCtrlBlockAckEnableCfm *msg__; \ + CsrWifiRouterCtrlBlockAckEnableCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlBlockAckEnableCfmSend(dst__, clientData__, interfaceTag__, status__) \ + CsrWifiRouterCtrlBlockAckEnableCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, status__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlBlockAckErrorIndSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + interfaceTag - + trafficStreamID - + peerMacAddress - + status - + +*******************************************************************************/ +#define CsrWifiRouterCtrlBlockAckErrorIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, trafficStreamID__, peerMacAddress__, status__) \ + msg__ = (CsrWifiRouterCtrlBlockAckErrorInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckErrorInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ERROR_IND, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->trafficStreamID = (trafficStreamID__); \ + msg__->peerMacAddress = (peerMacAddress__); \ + msg__->status = (status__); + +#define CsrWifiRouterCtrlBlockAckErrorIndSendTo(dst__, src__, clientData__, interfaceTag__, trafficStreamID__, peerMacAddress__, status__) \ + { \ + CsrWifiRouterCtrlBlockAckErrorInd *msg__; \ + CsrWifiRouterCtrlBlockAckErrorIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, trafficStreamID__, peerMacAddress__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlBlockAckErrorIndSend(dst__, clientData__, interfaceTag__, trafficStreamID__, peerMacAddress__, status__) \ + CsrWifiRouterCtrlBlockAckErrorIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, trafficStreamID__, peerMacAddress__, status__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlCapabilitiesReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + clientData - + +*******************************************************************************/ +#define CsrWifiRouterCtrlCapabilitiesReqCreate(msg__, dst__, src__, clientData__) \ + msg__ = (CsrWifiRouterCtrlCapabilitiesReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlCapabilitiesReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_CAPABILITIES_REQ, dst__, src__); \ + msg__->clientData = (clientData__); + +#define CsrWifiRouterCtrlCapabilitiesReqSendTo(dst__, src__, clientData__) \ + { \ + CsrWifiRouterCtrlCapabilitiesReq *msg__; \ + CsrWifiRouterCtrlCapabilitiesReqCreate(msg__, dst__, src__, clientData__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlCapabilitiesReqSend(src__, clientData__) \ + CsrWifiRouterCtrlCapabilitiesReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlCapabilitiesCfmSend + + DESCRIPTION + The router sends this primitive to confirm the size of the queues of the + HIP. + + PARAMETERS + queue - Destination Task Queue + clientData - + commandQueueSize - Size of command queue + trafficQueueSize - Size of traffic queue (per AC) + +*******************************************************************************/ +#define CsrWifiRouterCtrlCapabilitiesCfmCreate(msg__, dst__, src__, clientData__, commandQueueSize__, trafficQueueSize__) \ + msg__ = (CsrWifiRouterCtrlCapabilitiesCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlCapabilitiesCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_CAPABILITIES_CFM, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->commandQueueSize = (commandQueueSize__); \ + msg__->trafficQueueSize = (trafficQueueSize__); + +#define CsrWifiRouterCtrlCapabilitiesCfmSendTo(dst__, src__, clientData__, commandQueueSize__, trafficQueueSize__) \ + { \ + CsrWifiRouterCtrlCapabilitiesCfm *msg__; \ + CsrWifiRouterCtrlCapabilitiesCfmCreate(msg__, dst__, src__, clientData__, commandQueueSize__, trafficQueueSize__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlCapabilitiesCfmSend(dst__, clientData__, commandQueueSize__, trafficQueueSize__) \ + CsrWifiRouterCtrlCapabilitiesCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, commandQueueSize__, trafficQueueSize__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlConfigurePowerModeReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + clientData - + mode - + wakeHost - + +*******************************************************************************/ +#define CsrWifiRouterCtrlConfigurePowerModeReqCreate(msg__, dst__, src__, clientData__, mode__, wakeHost__) \ + msg__ = (CsrWifiRouterCtrlConfigurePowerModeReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlConfigurePowerModeReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_CONFIGURE_POWER_MODE_REQ, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->mode = (mode__); \ + msg__->wakeHost = (wakeHost__); + +#define CsrWifiRouterCtrlConfigurePowerModeReqSendTo(dst__, src__, clientData__, mode__, wakeHost__) \ + { \ + CsrWifiRouterCtrlConfigurePowerModeReq *msg__; \ + CsrWifiRouterCtrlConfigurePowerModeReqCreate(msg__, dst__, src__, clientData__, mode__, wakeHost__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlConfigurePowerModeReqSend(src__, clientData__, mode__, wakeHost__) \ + CsrWifiRouterCtrlConfigurePowerModeReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__, mode__, wakeHost__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlConnectedIndSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + interfaceTag - + peerMacAddress - + peerStatus - + +*******************************************************************************/ +#define CsrWifiRouterCtrlConnectedIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, peerStatus__) \ + msg__ = (CsrWifiRouterCtrlConnectedInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlConnectedInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_CONNECTED_IND, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->peerMacAddress = (peerMacAddress__); \ + msg__->peerStatus = (peerStatus__); + +#define CsrWifiRouterCtrlConnectedIndSendTo(dst__, src__, clientData__, interfaceTag__, peerMacAddress__, peerStatus__) \ + { \ + CsrWifiRouterCtrlConnectedInd *msg__; \ + CsrWifiRouterCtrlConnectedIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, peerStatus__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlConnectedIndSend(dst__, clientData__, interfaceTag__, peerMacAddress__, peerStatus__) \ + CsrWifiRouterCtrlConnectedIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, peerMacAddress__, peerStatus__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlHipReqSend + + DESCRIPTION + This primitive is used for transferring MLME messages to the HIP. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + mlmeCommandLength - Length of the MLME signal + mlmeCommand - Pointer to the MLME signal + dataRef1Length - Length of the dataRef1 bulk data + dataRef1 - Pointer to the bulk data 1 + dataRef2Length - Length of the dataRef2 bulk data + dataRef2 - Pointer to the bulk data 2 + +*******************************************************************************/ +#define CsrWifiRouterCtrlHipReqCreate(msg__, dst__, src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) \ + msg__ = (CsrWifiRouterCtrlHipReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlHipReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_HIP_REQ, dst__, src__); \ + msg__->mlmeCommandLength = (mlmeCommandLength__); \ + msg__->mlmeCommand = (mlmeCommand__); \ + msg__->dataRef1Length = (dataRef1Length__); \ + msg__->dataRef1 = (dataRef1__); \ + msg__->dataRef2Length = (dataRef2Length__); \ + msg__->dataRef2 = (dataRef2__); + +#define CsrWifiRouterCtrlHipReqSendTo(dst__, src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) \ + { \ + CsrWifiRouterCtrlHipReq *msg__; \ + CsrWifiRouterCtrlHipReqCreate(msg__, dst__, src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlHipReqSend(src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) \ + CsrWifiRouterCtrlHipReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlHipIndSend + + DESCRIPTION + This primitive is used for transferring MLME messages from the HIP. + + PARAMETERS + queue - Destination Task Queue + mlmeCommandLength - Length of the MLME signal + mlmeCommand - Pointer to the MLME signal + dataRef1Length - Length of the dataRef1 bulk data + dataRef1 - Pointer to the bulk data 1 + dataRef2Length - Length of the dataRef2 bulk data + dataRef2 - Pointer to the bulk data 2 + +*******************************************************************************/ +#define CsrWifiRouterCtrlHipIndCreate(msg__, dst__, src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) \ + msg__ = (CsrWifiRouterCtrlHipInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlHipInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_HIP_IND, dst__, src__); \ + msg__->mlmeCommandLength = (mlmeCommandLength__); \ + msg__->mlmeCommand = (mlmeCommand__); \ + msg__->dataRef1Length = (dataRef1Length__); \ + msg__->dataRef1 = (dataRef1__); \ + msg__->dataRef2Length = (dataRef2Length__); \ + msg__->dataRef2 = (dataRef2__); + +#define CsrWifiRouterCtrlHipIndSendTo(dst__, src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) \ + { \ + CsrWifiRouterCtrlHipInd *msg__; \ + CsrWifiRouterCtrlHipIndCreate(msg__, dst__, src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlHipIndSend(dst__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) \ + CsrWifiRouterCtrlHipIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlM4ReadyToSendIndSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + interfaceTag - + peerMacAddress - + +*******************************************************************************/ +#define CsrWifiRouterCtrlM4ReadyToSendIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__) \ + msg__ = (CsrWifiRouterCtrlM4ReadyToSendInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlM4ReadyToSendInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_M4_READY_TO_SEND_IND, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->peerMacAddress = (peerMacAddress__); + +#define CsrWifiRouterCtrlM4ReadyToSendIndSendTo(dst__, src__, clientData__, interfaceTag__, peerMacAddress__) \ + { \ + CsrWifiRouterCtrlM4ReadyToSendInd *msg__; \ + CsrWifiRouterCtrlM4ReadyToSendIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlM4ReadyToSendIndSend(dst__, clientData__, interfaceTag__, peerMacAddress__) \ + CsrWifiRouterCtrlM4ReadyToSendIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, peerMacAddress__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlM4TransmitReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + clientData - + +*******************************************************************************/ +#define CsrWifiRouterCtrlM4TransmitReqCreate(msg__, dst__, src__, interfaceTag__, clientData__) \ + msg__ = (CsrWifiRouterCtrlM4TransmitReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlM4TransmitReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_M4_TRANSMIT_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->clientData = (clientData__); + +#define CsrWifiRouterCtrlM4TransmitReqSendTo(dst__, src__, interfaceTag__, clientData__) \ + { \ + CsrWifiRouterCtrlM4TransmitReq *msg__; \ + CsrWifiRouterCtrlM4TransmitReqCreate(msg__, dst__, src__, interfaceTag__, clientData__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlM4TransmitReqSend(src__, interfaceTag__, clientData__) \ + CsrWifiRouterCtrlM4TransmitReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlM4TransmittedIndSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + interfaceTag - + peerMacAddress - + status - + +*******************************************************************************/ +#define CsrWifiRouterCtrlM4TransmittedIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, status__) \ + msg__ = (CsrWifiRouterCtrlM4TransmittedInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlM4TransmittedInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_M4_TRANSMITTED_IND, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->peerMacAddress = (peerMacAddress__); \ + msg__->status = (status__); + +#define CsrWifiRouterCtrlM4TransmittedIndSendTo(dst__, src__, clientData__, interfaceTag__, peerMacAddress__, status__) \ + { \ + CsrWifiRouterCtrlM4TransmittedInd *msg__; \ + CsrWifiRouterCtrlM4TransmittedIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlM4TransmittedIndSend(dst__, clientData__, interfaceTag__, peerMacAddress__, status__) \ + CsrWifiRouterCtrlM4TransmittedIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, peerMacAddress__, status__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlMediaStatusReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + clientData - + mediaStatus - + +*******************************************************************************/ +#define CsrWifiRouterCtrlMediaStatusReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, mediaStatus__) \ + msg__ = (CsrWifiRouterCtrlMediaStatusReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMediaStatusReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->clientData = (clientData__); \ + msg__->mediaStatus = (mediaStatus__); + +#define CsrWifiRouterCtrlMediaStatusReqSendTo(dst__, src__, interfaceTag__, clientData__, mediaStatus__) \ + { \ + CsrWifiRouterCtrlMediaStatusReq *msg__; \ + CsrWifiRouterCtrlMediaStatusReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, mediaStatus__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlMediaStatusReqSend(src__, interfaceTag__, clientData__, mediaStatus__) \ + CsrWifiRouterCtrlMediaStatusReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, mediaStatus__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlMicFailureIndSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + interfaceTag - + peerMacAddress - + unicastPdu - + +*******************************************************************************/ +#define CsrWifiRouterCtrlMicFailureIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, unicastPdu__) \ + msg__ = (CsrWifiRouterCtrlMicFailureInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMicFailureInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MIC_FAILURE_IND, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->peerMacAddress = (peerMacAddress__); \ + msg__->unicastPdu = (unicastPdu__); + +#define CsrWifiRouterCtrlMicFailureIndSendTo(dst__, src__, clientData__, interfaceTag__, peerMacAddress__, unicastPdu__) \ + { \ + CsrWifiRouterCtrlMicFailureInd *msg__; \ + CsrWifiRouterCtrlMicFailureIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, unicastPdu__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlMicFailureIndSend(dst__, clientData__, interfaceTag__, peerMacAddress__, unicastPdu__) \ + CsrWifiRouterCtrlMicFailureIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, peerMacAddress__, unicastPdu__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlModeSetReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + clientData - + mode - + bssid - BSSID of the network the device is going to be a part + of + protection - Set to TRUE if encryption is enabled for the + connection/broadcast frames + intraBssDistEnabled - If set to TRUE, intra BSS destribution will be + enabled. If set to FALSE, any unicast PDU which does + not have the RA as the the local MAC address, shall be + ignored. This field is interpreted by the receive if + mode is set to CSR_WIFI_ROUTER_CTRL_MODE_P2PGO + +*******************************************************************************/ +#define CsrWifiRouterCtrlModeSetReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, mode__, bssid__, protection__, intraBssDistEnabled__) \ + msg__ = (CsrWifiRouterCtrlModeSetReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlModeSetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MODE_SET_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->clientData = (clientData__); \ + msg__->mode = (mode__); \ + msg__->bssid = (bssid__); \ + msg__->protection = (protection__); \ + msg__->intraBssDistEnabled = (intraBssDistEnabled__); + +#define CsrWifiRouterCtrlModeSetReqSendTo(dst__, src__, interfaceTag__, clientData__, mode__, bssid__, protection__, intraBssDistEnabled__) \ + { \ + CsrWifiRouterCtrlModeSetReq *msg__; \ + CsrWifiRouterCtrlModeSetReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, mode__, bssid__, protection__, intraBssDistEnabled__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlModeSetReqSend(src__, interfaceTag__, clientData__, mode__, bssid__, protection__, intraBssDistEnabled__) \ + CsrWifiRouterCtrlModeSetReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, mode__, bssid__, protection__, intraBssDistEnabled__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlMulticastAddressIndSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + interfaceTag - + action - + setAddressesCount - + setAddresses - + +*******************************************************************************/ +#define CsrWifiRouterCtrlMulticastAddressIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, action__, setAddressesCount__, setAddresses__) \ + msg__ = (CsrWifiRouterCtrlMulticastAddressInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMulticastAddressInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_IND, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->action = (action__); \ + msg__->setAddressesCount = (setAddressesCount__); \ + msg__->setAddresses = (setAddresses__); + +#define CsrWifiRouterCtrlMulticastAddressIndSendTo(dst__, src__, clientData__, interfaceTag__, action__, setAddressesCount__, setAddresses__) \ + { \ + CsrWifiRouterCtrlMulticastAddressInd *msg__; \ + CsrWifiRouterCtrlMulticastAddressIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, action__, setAddressesCount__, setAddresses__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlMulticastAddressIndSend(dst__, clientData__, interfaceTag__, action__, setAddressesCount__, setAddresses__) \ + CsrWifiRouterCtrlMulticastAddressIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, action__, setAddressesCount__, setAddresses__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlMulticastAddressResSend + + DESCRIPTION + + PARAMETERS + interfaceTag - + clientData - + status - + action - + getAddressesCount - + getAddresses - + +*******************************************************************************/ +#define CsrWifiRouterCtrlMulticastAddressResCreate(msg__, dst__, src__, interfaceTag__, clientData__, status__, action__, getAddressesCount__, getAddresses__) \ + msg__ = (CsrWifiRouterCtrlMulticastAddressRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMulticastAddressRes)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_RES, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->clientData = (clientData__); \ + msg__->status = (status__); \ + msg__->action = (action__); \ + msg__->getAddressesCount = (getAddressesCount__); \ + msg__->getAddresses = (getAddresses__); + +#define CsrWifiRouterCtrlMulticastAddressResSendTo(dst__, src__, interfaceTag__, clientData__, status__, action__, getAddressesCount__, getAddresses__) \ + { \ + CsrWifiRouterCtrlMulticastAddressRes *msg__; \ + CsrWifiRouterCtrlMulticastAddressResCreate(msg__, dst__, src__, interfaceTag__, clientData__, status__, action__, getAddressesCount__, getAddresses__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlMulticastAddressResSend(src__, interfaceTag__, clientData__, status__, action__, getAddressesCount__, getAddresses__) \ + CsrWifiRouterCtrlMulticastAddressResSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, status__, action__, getAddressesCount__, getAddresses__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlPeerAddReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + clientData - + peerMacAddress - + associationId - + staInfo - + +*******************************************************************************/ +#define CsrWifiRouterCtrlPeerAddReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, peerMacAddress__, associationId__, staInfo__) \ + msg__ = (CsrWifiRouterCtrlPeerAddReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerAddReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_ADD_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->clientData = (clientData__); \ + msg__->peerMacAddress = (peerMacAddress__); \ + msg__->associationId = (associationId__); \ + msg__->staInfo = (staInfo__); + +#define CsrWifiRouterCtrlPeerAddReqSendTo(dst__, src__, interfaceTag__, clientData__, peerMacAddress__, associationId__, staInfo__) \ + { \ + CsrWifiRouterCtrlPeerAddReq *msg__; \ + CsrWifiRouterCtrlPeerAddReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, peerMacAddress__, associationId__, staInfo__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlPeerAddReqSend(src__, interfaceTag__, clientData__, peerMacAddress__, associationId__, staInfo__) \ + CsrWifiRouterCtrlPeerAddReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, peerMacAddress__, associationId__, staInfo__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlPeerAddCfmSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + interfaceTag - + peerMacAddress - + peerRecordHandle - + status - + +*******************************************************************************/ +#define CsrWifiRouterCtrlPeerAddCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, peerRecordHandle__, status__) \ + msg__ = (CsrWifiRouterCtrlPeerAddCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerAddCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_ADD_CFM, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->peerMacAddress = (peerMacAddress__); \ + msg__->peerRecordHandle = (peerRecordHandle__); \ + msg__->status = (status__); + +#define CsrWifiRouterCtrlPeerAddCfmSendTo(dst__, src__, clientData__, interfaceTag__, peerMacAddress__, peerRecordHandle__, status__) \ + { \ + CsrWifiRouterCtrlPeerAddCfm *msg__; \ + CsrWifiRouterCtrlPeerAddCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, peerRecordHandle__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlPeerAddCfmSend(dst__, clientData__, interfaceTag__, peerMacAddress__, peerRecordHandle__, status__) \ + CsrWifiRouterCtrlPeerAddCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, peerMacAddress__, peerRecordHandle__, status__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlPeerDelReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + clientData - + peerRecordHandle - + +*******************************************************************************/ +#define CsrWifiRouterCtrlPeerDelReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, peerRecordHandle__) \ + msg__ = (CsrWifiRouterCtrlPeerDelReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerDelReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_DEL_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->clientData = (clientData__); \ + msg__->peerRecordHandle = (peerRecordHandle__); + +#define CsrWifiRouterCtrlPeerDelReqSendTo(dst__, src__, interfaceTag__, clientData__, peerRecordHandle__) \ + { \ + CsrWifiRouterCtrlPeerDelReq *msg__; \ + CsrWifiRouterCtrlPeerDelReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, peerRecordHandle__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlPeerDelReqSend(src__, interfaceTag__, clientData__, peerRecordHandle__) \ + CsrWifiRouterCtrlPeerDelReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, peerRecordHandle__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlPeerDelCfmSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + interfaceTag - + status - + +*******************************************************************************/ +#define CsrWifiRouterCtrlPeerDelCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \ + msg__ = (CsrWifiRouterCtrlPeerDelCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerDelCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_DEL_CFM, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); + +#define CsrWifiRouterCtrlPeerDelCfmSendTo(dst__, src__, clientData__, interfaceTag__, status__) \ + { \ + CsrWifiRouterCtrlPeerDelCfm *msg__; \ + CsrWifiRouterCtrlPeerDelCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlPeerDelCfmSend(dst__, clientData__, interfaceTag__, status__) \ + CsrWifiRouterCtrlPeerDelCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, status__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlPeerUpdateReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + clientData - + peerRecordHandle - + powersaveMode - + +*******************************************************************************/ +#define CsrWifiRouterCtrlPeerUpdateReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, peerRecordHandle__, powersaveMode__) \ + msg__ = (CsrWifiRouterCtrlPeerUpdateReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerUpdateReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_UPDATE_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->clientData = (clientData__); \ + msg__->peerRecordHandle = (peerRecordHandle__); \ + msg__->powersaveMode = (powersaveMode__); + +#define CsrWifiRouterCtrlPeerUpdateReqSendTo(dst__, src__, interfaceTag__, clientData__, peerRecordHandle__, powersaveMode__) \ + { \ + CsrWifiRouterCtrlPeerUpdateReq *msg__; \ + CsrWifiRouterCtrlPeerUpdateReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, peerRecordHandle__, powersaveMode__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlPeerUpdateReqSend(src__, interfaceTag__, clientData__, peerRecordHandle__, powersaveMode__) \ + CsrWifiRouterCtrlPeerUpdateReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, peerRecordHandle__, powersaveMode__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlPeerUpdateCfmSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + interfaceTag - + status - + +*******************************************************************************/ +#define CsrWifiRouterCtrlPeerUpdateCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \ + msg__ = (CsrWifiRouterCtrlPeerUpdateCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerUpdateCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_UPDATE_CFM, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); + +#define CsrWifiRouterCtrlPeerUpdateCfmSendTo(dst__, src__, clientData__, interfaceTag__, status__) \ + { \ + CsrWifiRouterCtrlPeerUpdateCfm *msg__; \ + CsrWifiRouterCtrlPeerUpdateCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlPeerUpdateCfmSend(dst__, clientData__, interfaceTag__, status__) \ + CsrWifiRouterCtrlPeerUpdateCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, status__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlPortConfigureReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + clientData - + uncontrolledPortAction - + controlledPortAction - + macAddress - + setProtection - + +*******************************************************************************/ +#define CsrWifiRouterCtrlPortConfigureReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, uncontrolledPortAction__, controlledPortAction__, macAddress__, setProtection__) \ + msg__ = (CsrWifiRouterCtrlPortConfigureReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPortConfigureReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PORT_CONFIGURE_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->clientData = (clientData__); \ + msg__->uncontrolledPortAction = (uncontrolledPortAction__); \ + msg__->controlledPortAction = (controlledPortAction__); \ + msg__->macAddress = (macAddress__); \ + msg__->setProtection = (setProtection__); + +#define CsrWifiRouterCtrlPortConfigureReqSendTo(dst__, src__, interfaceTag__, clientData__, uncontrolledPortAction__, controlledPortAction__, macAddress__, setProtection__) \ + { \ + CsrWifiRouterCtrlPortConfigureReq *msg__; \ + CsrWifiRouterCtrlPortConfigureReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, uncontrolledPortAction__, controlledPortAction__, macAddress__, setProtection__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlPortConfigureReqSend(src__, interfaceTag__, clientData__, uncontrolledPortAction__, controlledPortAction__, macAddress__, setProtection__) \ + CsrWifiRouterCtrlPortConfigureReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, uncontrolledPortAction__, controlledPortAction__, macAddress__, setProtection__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlPortConfigureCfmSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + interfaceTag - + status - + macAddress - + +*******************************************************************************/ +#define CsrWifiRouterCtrlPortConfigureCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__, macAddress__) \ + msg__ = (CsrWifiRouterCtrlPortConfigureCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPortConfigureCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PORT_CONFIGURE_CFM, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); \ + msg__->macAddress = (macAddress__); + +#define CsrWifiRouterCtrlPortConfigureCfmSendTo(dst__, src__, clientData__, interfaceTag__, status__, macAddress__) \ + { \ + CsrWifiRouterCtrlPortConfigureCfm *msg__; \ + CsrWifiRouterCtrlPortConfigureCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__, macAddress__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlPortConfigureCfmSend(dst__, clientData__, interfaceTag__, status__, macAddress__) \ + CsrWifiRouterCtrlPortConfigureCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, status__, macAddress__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlQosControlReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + clientData - + control - + queueConfig - + +*******************************************************************************/ +#define CsrWifiRouterCtrlQosControlReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, control__, queueConfig__) \ + msg__ = (CsrWifiRouterCtrlQosControlReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlQosControlReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->clientData = (clientData__); \ + msg__->control = (control__); \ + msg__->queueConfig = (queueConfig__); + +#define CsrWifiRouterCtrlQosControlReqSendTo(dst__, src__, interfaceTag__, clientData__, control__, queueConfig__) \ + { \ + CsrWifiRouterCtrlQosControlReq *msg__; \ + CsrWifiRouterCtrlQosControlReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, control__, queueConfig__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlQosControlReqSend(src__, interfaceTag__, clientData__, control__, queueConfig__) \ + CsrWifiRouterCtrlQosControlReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, control__, queueConfig__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlRawSdioDeinitialiseReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + clientData - + +*******************************************************************************/ +#define CsrWifiRouterCtrlRawSdioDeinitialiseReqCreate(msg__, dst__, src__, clientData__) \ + msg__ = (CsrWifiRouterCtrlRawSdioDeinitialiseReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlRawSdioDeinitialiseReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RAW_SDIO_DEINITIALISE_REQ, dst__, src__); \ + msg__->clientData = (clientData__); + +#define CsrWifiRouterCtrlRawSdioDeinitialiseReqSendTo(dst__, src__, clientData__) \ + { \ + CsrWifiRouterCtrlRawSdioDeinitialiseReq *msg__; \ + CsrWifiRouterCtrlRawSdioDeinitialiseReqCreate(msg__, dst__, src__, clientData__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlRawSdioDeinitialiseReqSend(src__, clientData__) \ + CsrWifiRouterCtrlRawSdioDeinitialiseReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlRawSdioDeinitialiseCfmSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + result - + +*******************************************************************************/ +#define CsrWifiRouterCtrlRawSdioDeinitialiseCfmCreate(msg__, dst__, src__, clientData__, result__) \ + msg__ = (CsrWifiRouterCtrlRawSdioDeinitialiseCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlRawSdioDeinitialiseCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RAW_SDIO_DEINITIALISE_CFM, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->result = (result__); + +#define CsrWifiRouterCtrlRawSdioDeinitialiseCfmSendTo(dst__, src__, clientData__, result__) \ + { \ + CsrWifiRouterCtrlRawSdioDeinitialiseCfm *msg__; \ + CsrWifiRouterCtrlRawSdioDeinitialiseCfmCreate(msg__, dst__, src__, clientData__, result__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlRawSdioDeinitialiseCfmSend(dst__, clientData__, result__) \ + CsrWifiRouterCtrlRawSdioDeinitialiseCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, result__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlRawSdioInitialiseReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + clientData - + +*******************************************************************************/ +#define CsrWifiRouterCtrlRawSdioInitialiseReqCreate(msg__, dst__, src__, clientData__) \ + msg__ = (CsrWifiRouterCtrlRawSdioInitialiseReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlRawSdioInitialiseReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RAW_SDIO_INITIALISE_REQ, dst__, src__); \ + msg__->clientData = (clientData__); + +#define CsrWifiRouterCtrlRawSdioInitialiseReqSendTo(dst__, src__, clientData__) \ + { \ + CsrWifiRouterCtrlRawSdioInitialiseReq *msg__; \ + CsrWifiRouterCtrlRawSdioInitialiseReqCreate(msg__, dst__, src__, clientData__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlRawSdioInitialiseReqSend(src__, clientData__) \ + CsrWifiRouterCtrlRawSdioInitialiseReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlRawSdioInitialiseCfmSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + result - + byteRead - + byteWrite - + firmwareDownload - + reset - + coreDumpPrepare - + byteBlockRead - + gpRead16 - + gpWrite16 - + +*******************************************************************************/ +#define CsrWifiRouterCtrlRawSdioInitialiseCfmCreate(msg__, dst__, src__, clientData__, result__, byteRead__, byteWrite__, firmwareDownload__, reset__, coreDumpPrepare__, byteBlockRead__, gpRead16__, gpWrite16__) \ + msg__ = (CsrWifiRouterCtrlRawSdioInitialiseCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlRawSdioInitialiseCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RAW_SDIO_INITIALISE_CFM, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->result = (result__); \ + msg__->byteRead = (byteRead__); \ + msg__->byteWrite = (byteWrite__); \ + msg__->firmwareDownload = (firmwareDownload__); \ + msg__->reset = (reset__); \ + msg__->coreDumpPrepare = (coreDumpPrepare__); \ + msg__->byteBlockRead = (byteBlockRead__); \ + msg__->gpRead16 = (gpRead16__); \ + msg__->gpWrite16 = (gpWrite16__); + +#define CsrWifiRouterCtrlRawSdioInitialiseCfmSendTo(dst__, src__, clientData__, result__, byteRead__, byteWrite__, firmwareDownload__, reset__, coreDumpPrepare__, byteBlockRead__, gpRead16__, gpWrite16__) \ + { \ + CsrWifiRouterCtrlRawSdioInitialiseCfm *msg__; \ + CsrWifiRouterCtrlRawSdioInitialiseCfmCreate(msg__, dst__, src__, clientData__, result__, byteRead__, byteWrite__, firmwareDownload__, reset__, coreDumpPrepare__, byteBlockRead__, gpRead16__, gpWrite16__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlRawSdioInitialiseCfmSend(dst__, clientData__, result__, byteRead__, byteWrite__, firmwareDownload__, reset__, coreDumpPrepare__, byteBlockRead__, gpRead16__, gpWrite16__) \ + CsrWifiRouterCtrlRawSdioInitialiseCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, result__, byteRead__, byteWrite__, firmwareDownload__, reset__, coreDumpPrepare__, byteBlockRead__, gpRead16__, gpWrite16__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlResumeIndSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + powerMaintained - + +*******************************************************************************/ +#define CsrWifiRouterCtrlResumeIndCreate(msg__, dst__, src__, clientData__, powerMaintained__) \ + msg__ = (CsrWifiRouterCtrlResumeInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlResumeInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RESUME_IND, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->powerMaintained = (powerMaintained__); + +#define CsrWifiRouterCtrlResumeIndSendTo(dst__, src__, clientData__, powerMaintained__) \ + { \ + CsrWifiRouterCtrlResumeInd *msg__; \ + CsrWifiRouterCtrlResumeIndCreate(msg__, dst__, src__, clientData__, powerMaintained__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlResumeIndSend(dst__, clientData__, powerMaintained__) \ + CsrWifiRouterCtrlResumeIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, powerMaintained__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlResumeResSend + + DESCRIPTION + + PARAMETERS + clientData - + status - + +*******************************************************************************/ +#define CsrWifiRouterCtrlResumeResCreate(msg__, dst__, src__, clientData__, status__) \ + msg__ = (CsrWifiRouterCtrlResumeRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlResumeRes)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RESUME_RES, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->status = (status__); + +#define CsrWifiRouterCtrlResumeResSendTo(dst__, src__, clientData__, status__) \ + { \ + CsrWifiRouterCtrlResumeRes *msg__; \ + CsrWifiRouterCtrlResumeResCreate(msg__, dst__, src__, clientData__, status__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlResumeResSend(src__, clientData__, status__) \ + CsrWifiRouterCtrlResumeResSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__, status__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlStaInactiveIndSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + interfaceTag - + staAddress - + +*******************************************************************************/ +#define CsrWifiRouterCtrlStaInactiveIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, staAddress__) \ + msg__ = (CsrWifiRouterCtrlStaInactiveInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlStaInactiveInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_STA_INACTIVE_IND, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->staAddress = (staAddress__); + +#define CsrWifiRouterCtrlStaInactiveIndSendTo(dst__, src__, clientData__, interfaceTag__, staAddress__) \ + { \ + CsrWifiRouterCtrlStaInactiveInd *msg__; \ + CsrWifiRouterCtrlStaInactiveIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, staAddress__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlStaInactiveIndSend(dst__, clientData__, interfaceTag__, staAddress__) \ + CsrWifiRouterCtrlStaInactiveIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, staAddress__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlSuspendIndSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + hardSuspend - + d3Suspend - + +*******************************************************************************/ +#define CsrWifiRouterCtrlSuspendIndCreate(msg__, dst__, src__, clientData__, hardSuspend__, d3Suspend__) \ + msg__ = (CsrWifiRouterCtrlSuspendInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlSuspendInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_SUSPEND_IND, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->hardSuspend = (hardSuspend__); \ + msg__->d3Suspend = (d3Suspend__); + +#define CsrWifiRouterCtrlSuspendIndSendTo(dst__, src__, clientData__, hardSuspend__, d3Suspend__) \ + { \ + CsrWifiRouterCtrlSuspendInd *msg__; \ + CsrWifiRouterCtrlSuspendIndCreate(msg__, dst__, src__, clientData__, hardSuspend__, d3Suspend__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlSuspendIndSend(dst__, clientData__, hardSuspend__, d3Suspend__) \ + CsrWifiRouterCtrlSuspendIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, hardSuspend__, d3Suspend__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlSuspendResSend + + DESCRIPTION + + PARAMETERS + clientData - + status - + +*******************************************************************************/ +#define CsrWifiRouterCtrlSuspendResCreate(msg__, dst__, src__, clientData__, status__) \ + msg__ = (CsrWifiRouterCtrlSuspendRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlSuspendRes)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_SUSPEND_RES, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->status = (status__); + +#define CsrWifiRouterCtrlSuspendResSendTo(dst__, src__, clientData__, status__) \ + { \ + CsrWifiRouterCtrlSuspendRes *msg__; \ + CsrWifiRouterCtrlSuspendResCreate(msg__, dst__, src__, clientData__, status__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlSuspendResSend(src__, clientData__, status__) \ + CsrWifiRouterCtrlSuspendResSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__, status__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlTclasAddReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + clientData - + tclasLength - + tclas - + +*******************************************************************************/ +#define CsrWifiRouterCtrlTclasAddReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, tclasLength__, tclas__) \ + msg__ = (CsrWifiRouterCtrlTclasAddReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasAddReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->clientData = (clientData__); \ + msg__->tclasLength = (tclasLength__); \ + msg__->tclas = (tclas__); + +#define CsrWifiRouterCtrlTclasAddReqSendTo(dst__, src__, interfaceTag__, clientData__, tclasLength__, tclas__) \ + { \ + CsrWifiRouterCtrlTclasAddReq *msg__; \ + CsrWifiRouterCtrlTclasAddReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, tclasLength__, tclas__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlTclasAddReqSend(src__, interfaceTag__, clientData__, tclasLength__, tclas__) \ + CsrWifiRouterCtrlTclasAddReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, tclasLength__, tclas__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlTclasAddCfmSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + interfaceTag - + status - + +*******************************************************************************/ +#define CsrWifiRouterCtrlTclasAddCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \ + msg__ = (CsrWifiRouterCtrlTclasAddCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasAddCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_CFM, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); + +#define CsrWifiRouterCtrlTclasAddCfmSendTo(dst__, src__, clientData__, interfaceTag__, status__) \ + { \ + CsrWifiRouterCtrlTclasAddCfm *msg__; \ + CsrWifiRouterCtrlTclasAddCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlTclasAddCfmSend(dst__, clientData__, interfaceTag__, status__) \ + CsrWifiRouterCtrlTclasAddCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, status__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlTclasDelReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + clientData - + tclasLength - + tclas - + +*******************************************************************************/ +#define CsrWifiRouterCtrlTclasDelReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, tclasLength__, tclas__) \ + msg__ = (CsrWifiRouterCtrlTclasDelReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasDelReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->clientData = (clientData__); \ + msg__->tclasLength = (tclasLength__); \ + msg__->tclas = (tclas__); + +#define CsrWifiRouterCtrlTclasDelReqSendTo(dst__, src__, interfaceTag__, clientData__, tclasLength__, tclas__) \ + { \ + CsrWifiRouterCtrlTclasDelReq *msg__; \ + CsrWifiRouterCtrlTclasDelReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, tclasLength__, tclas__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlTclasDelReqSend(src__, interfaceTag__, clientData__, tclasLength__, tclas__) \ + CsrWifiRouterCtrlTclasDelReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, tclasLength__, tclas__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlTclasDelCfmSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + interfaceTag - + status - + +*******************************************************************************/ +#define CsrWifiRouterCtrlTclasDelCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \ + msg__ = (CsrWifiRouterCtrlTclasDelCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasDelCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_CFM, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); + +#define CsrWifiRouterCtrlTclasDelCfmSendTo(dst__, src__, clientData__, interfaceTag__, status__) \ + { \ + CsrWifiRouterCtrlTclasDelCfm *msg__; \ + CsrWifiRouterCtrlTclasDelCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlTclasDelCfmSend(dst__, clientData__, interfaceTag__, status__) \ + CsrWifiRouterCtrlTclasDelCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, status__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlTrafficClassificationReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + clientData - + trafficType - + period - + +*******************************************************************************/ +#define CsrWifiRouterCtrlTrafficClassificationReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, trafficType__, period__) \ + msg__ = (CsrWifiRouterCtrlTrafficClassificationReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficClassificationReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TRAFFIC_CLASSIFICATION_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->clientData = (clientData__); \ + msg__->trafficType = (trafficType__); \ + msg__->period = (period__); + +#define CsrWifiRouterCtrlTrafficClassificationReqSendTo(dst__, src__, interfaceTag__, clientData__, trafficType__, period__) \ + { \ + CsrWifiRouterCtrlTrafficClassificationReq *msg__; \ + CsrWifiRouterCtrlTrafficClassificationReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, trafficType__, period__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlTrafficClassificationReqSend(src__, interfaceTag__, clientData__, trafficType__, period__) \ + CsrWifiRouterCtrlTrafficClassificationReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, trafficType__, period__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlTrafficConfigReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + clientData - + trafficConfigType - + config - + +*******************************************************************************/ +#define CsrWifiRouterCtrlTrafficConfigReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, trafficConfigType__, config__) \ + msg__ = (CsrWifiRouterCtrlTrafficConfigReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficConfigReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->clientData = (clientData__); \ + msg__->trafficConfigType = (trafficConfigType__); \ + msg__->config = (config__); + +#define CsrWifiRouterCtrlTrafficConfigReqSendTo(dst__, src__, interfaceTag__, clientData__, trafficConfigType__, config__) \ + { \ + CsrWifiRouterCtrlTrafficConfigReq *msg__; \ + CsrWifiRouterCtrlTrafficConfigReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, trafficConfigType__, config__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlTrafficConfigReqSend(src__, interfaceTag__, clientData__, trafficConfigType__, config__) \ + CsrWifiRouterCtrlTrafficConfigReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, trafficConfigType__, config__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlTrafficProtocolIndSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + interfaceTag - + packetType - + direction - + srcAddress - + +*******************************************************************************/ +#define CsrWifiRouterCtrlTrafficProtocolIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, packetType__, direction__, srcAddress__) \ + msg__ = (CsrWifiRouterCtrlTrafficProtocolInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficProtocolInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TRAFFIC_PROTOCOL_IND, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->packetType = (packetType__); \ + msg__->direction = (direction__); \ + msg__->srcAddress = (srcAddress__); + +#define CsrWifiRouterCtrlTrafficProtocolIndSendTo(dst__, src__, clientData__, interfaceTag__, packetType__, direction__, srcAddress__) \ + { \ + CsrWifiRouterCtrlTrafficProtocolInd *msg__; \ + CsrWifiRouterCtrlTrafficProtocolIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, packetType__, direction__, srcAddress__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlTrafficProtocolIndSend(dst__, clientData__, interfaceTag__, packetType__, direction__, srcAddress__) \ + CsrWifiRouterCtrlTrafficProtocolIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, packetType__, direction__, srcAddress__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlTrafficSampleIndSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + interfaceTag - + stats - + +*******************************************************************************/ +#define CsrWifiRouterCtrlTrafficSampleIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, stats__) \ + msg__ = (CsrWifiRouterCtrlTrafficSampleInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficSampleInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TRAFFIC_SAMPLE_IND, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->stats = (stats__); + +#define CsrWifiRouterCtrlTrafficSampleIndSendTo(dst__, src__, clientData__, interfaceTag__, stats__) \ + { \ + CsrWifiRouterCtrlTrafficSampleInd *msg__; \ + CsrWifiRouterCtrlTrafficSampleIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, stats__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlTrafficSampleIndSend(dst__, clientData__, interfaceTag__, stats__) \ + CsrWifiRouterCtrlTrafficSampleIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, stats__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlUnexpectedFrameIndSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + interfaceTag - + peerMacAddress - + +*******************************************************************************/ +#define CsrWifiRouterCtrlUnexpectedFrameIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__) \ + msg__ = (CsrWifiRouterCtrlUnexpectedFrameInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlUnexpectedFrameInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_UNEXPECTED_FRAME_IND, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->peerMacAddress = (peerMacAddress__); + +#define CsrWifiRouterCtrlUnexpectedFrameIndSendTo(dst__, src__, clientData__, interfaceTag__, peerMacAddress__) \ + { \ + CsrWifiRouterCtrlUnexpectedFrameInd *msg__; \ + CsrWifiRouterCtrlUnexpectedFrameIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlUnexpectedFrameIndSend(dst__, clientData__, interfaceTag__, peerMacAddress__) \ + CsrWifiRouterCtrlUnexpectedFrameIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, peerMacAddress__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWapiMulticastFilterReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + status - + +*******************************************************************************/ +#define CsrWifiRouterCtrlWapiMulticastFilterReqCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiRouterCtrlWapiMulticastFilterReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiMulticastFilterReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_FILTER_REQ, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiRouterCtrlWapiMulticastFilterReqSendTo(dst__, src__, status__) \ + { \ + CsrWifiRouterCtrlWapiMulticastFilterReq *msg__; \ + CsrWifiRouterCtrlWapiMulticastFilterReqCreate(msg__, dst__, src__, status__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlWapiMulticastFilterReqSend(src__, status__) \ + CsrWifiRouterCtrlWapiMulticastFilterReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, status__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWapiMulticastReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + signalLength - + signal - + dataLength - + data - + +*******************************************************************************/ +#define CsrWifiRouterCtrlWapiMulticastReqCreate(msg__, dst__, src__, signalLength__, signal__, dataLength__, data__) \ + msg__ = (CsrWifiRouterCtrlWapiMulticastReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiMulticastReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_REQ, dst__, src__); \ + msg__->signalLength = (signalLength__); \ + msg__->signal = (signal__); \ + msg__->dataLength = (dataLength__); \ + msg__->data = (data__); + +#define CsrWifiRouterCtrlWapiMulticastReqSendTo(dst__, src__, signalLength__, signal__, dataLength__, data__) \ + { \ + CsrWifiRouterCtrlWapiMulticastReq *msg__; \ + CsrWifiRouterCtrlWapiMulticastReqCreate(msg__, dst__, src__, signalLength__, signal__, dataLength__, data__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlWapiMulticastReqSend(src__, signalLength__, signal__, dataLength__, data__) \ + CsrWifiRouterCtrlWapiMulticastReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, signalLength__, signal__, dataLength__, data__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWapiMulticastIndSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + interfaceTag - + signalLength - + signal - + dataLength - + data - + +*******************************************************************************/ +#define CsrWifiRouterCtrlWapiMulticastIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \ + msg__ = (CsrWifiRouterCtrlWapiMulticastInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiMulticastInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_IND, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->signalLength = (signalLength__); \ + msg__->signal = (signal__); \ + msg__->dataLength = (dataLength__); \ + msg__->data = (data__); + +#define CsrWifiRouterCtrlWapiMulticastIndSendTo(dst__, src__, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \ + { \ + CsrWifiRouterCtrlWapiMulticastInd *msg__; \ + CsrWifiRouterCtrlWapiMulticastIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlWapiMulticastIndSend(dst__, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \ + CsrWifiRouterCtrlWapiMulticastIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWapiUnicastFilterReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + status - + +*******************************************************************************/ +#define CsrWifiRouterCtrlWapiUnicastFilterReqCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiRouterCtrlWapiUnicastFilterReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiUnicastFilterReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_FILTER_REQ, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiRouterCtrlWapiUnicastFilterReqSendTo(dst__, src__, status__) \ + { \ + CsrWifiRouterCtrlWapiUnicastFilterReq *msg__; \ + CsrWifiRouterCtrlWapiUnicastFilterReqCreate(msg__, dst__, src__, status__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlWapiUnicastFilterReqSend(src__, status__) \ + CsrWifiRouterCtrlWapiUnicastFilterReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, status__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWifiOffReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + clientData - + +*******************************************************************************/ +#define CsrWifiRouterCtrlWifiOffReqCreate(msg__, dst__, src__, clientData__) \ + msg__ = (CsrWifiRouterCtrlWifiOffReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOffReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_OFF_REQ, dst__, src__); \ + msg__->clientData = (clientData__); + +#define CsrWifiRouterCtrlWifiOffReqSendTo(dst__, src__, clientData__) \ + { \ + CsrWifiRouterCtrlWifiOffReq *msg__; \ + CsrWifiRouterCtrlWifiOffReqCreate(msg__, dst__, src__, clientData__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlWifiOffReqSend(src__, clientData__) \ + CsrWifiRouterCtrlWifiOffReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWifiOffIndSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + controlIndication - + +*******************************************************************************/ +#define CsrWifiRouterCtrlWifiOffIndCreate(msg__, dst__, src__, clientData__, controlIndication__) \ + msg__ = (CsrWifiRouterCtrlWifiOffInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOffInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_OFF_IND, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->controlIndication = (controlIndication__); + +#define CsrWifiRouterCtrlWifiOffIndSendTo(dst__, src__, clientData__, controlIndication__) \ + { \ + CsrWifiRouterCtrlWifiOffInd *msg__; \ + CsrWifiRouterCtrlWifiOffIndCreate(msg__, dst__, src__, clientData__, controlIndication__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlWifiOffIndSend(dst__, clientData__, controlIndication__) \ + CsrWifiRouterCtrlWifiOffIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, controlIndication__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWifiOffResSend + + DESCRIPTION + + PARAMETERS + clientData - + +*******************************************************************************/ +#define CsrWifiRouterCtrlWifiOffResCreate(msg__, dst__, src__, clientData__) \ + msg__ = (CsrWifiRouterCtrlWifiOffRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOffRes)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_OFF_RES, dst__, src__); \ + msg__->clientData = (clientData__); + +#define CsrWifiRouterCtrlWifiOffResSendTo(dst__, src__, clientData__) \ + { \ + CsrWifiRouterCtrlWifiOffRes *msg__; \ + CsrWifiRouterCtrlWifiOffResCreate(msg__, dst__, src__, clientData__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlWifiOffResSend(src__, clientData__) \ + CsrWifiRouterCtrlWifiOffResSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWifiOffCfmSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + +*******************************************************************************/ +#define CsrWifiRouterCtrlWifiOffCfmCreate(msg__, dst__, src__, clientData__) \ + msg__ = (CsrWifiRouterCtrlWifiOffCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOffCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_OFF_CFM, dst__, src__); \ + msg__->clientData = (clientData__); + +#define CsrWifiRouterCtrlWifiOffCfmSendTo(dst__, src__, clientData__) \ + { \ + CsrWifiRouterCtrlWifiOffCfm *msg__; \ + CsrWifiRouterCtrlWifiOffCfmCreate(msg__, dst__, src__, clientData__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlWifiOffCfmSend(dst__, clientData__) \ + CsrWifiRouterCtrlWifiOffCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWifiOnReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + clientData - + +*******************************************************************************/ +#define CsrWifiRouterCtrlWifiOnReqCreate(msg__, dst__, src__, clientData__) \ + msg__ = (CsrWifiRouterCtrlWifiOnReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_ON_REQ, dst__, src__); \ + msg__->clientData = (clientData__); + +#define CsrWifiRouterCtrlWifiOnReqSendTo(dst__, src__, clientData__) \ + { \ + CsrWifiRouterCtrlWifiOnReq *msg__; \ + CsrWifiRouterCtrlWifiOnReqCreate(msg__, dst__, src__, clientData__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlWifiOnReqSend(src__, clientData__) \ + CsrWifiRouterCtrlWifiOnReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWifiOnIndSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + status - + versions - + +*******************************************************************************/ +#define CsrWifiRouterCtrlWifiOnIndCreate(msg__, dst__, src__, clientData__, status__, versions__) \ + msg__ = (CsrWifiRouterCtrlWifiOnInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_ON_IND, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->status = (status__); \ + msg__->versions = (versions__); + +#define CsrWifiRouterCtrlWifiOnIndSendTo(dst__, src__, clientData__, status__, versions__) \ + { \ + CsrWifiRouterCtrlWifiOnInd *msg__; \ + CsrWifiRouterCtrlWifiOnIndCreate(msg__, dst__, src__, clientData__, status__, versions__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlWifiOnIndSend(dst__, clientData__, status__, versions__) \ + CsrWifiRouterCtrlWifiOnIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, status__, versions__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWifiOnResSend + + DESCRIPTION + + PARAMETERS + clientData - + status - + numInterfaceAddress - + stationMacAddress - array size 1 MUST match CSR_WIFI_NUM_INTERFACES + smeVersions - + scheduledInterrupt - + +*******************************************************************************/ +#define CsrWifiRouterCtrlWifiOnResCreate(msg__, dst__, src__, clientData__, status__, numInterfaceAddress__, stationMacAddress__, smeVersions__, scheduledInterrupt__) \ + msg__ = (CsrWifiRouterCtrlWifiOnRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnRes)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_ON_RES, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->status = (status__); \ + msg__->numInterfaceAddress = (numInterfaceAddress__); \ + CsrMemCpy(msg__->stationMacAddress, (stationMacAddress__), sizeof(CsrWifiMacAddress) * 2); \ + msg__->smeVersions = (smeVersions__); \ + msg__->scheduledInterrupt = (scheduledInterrupt__); + +#define CsrWifiRouterCtrlWifiOnResSendTo(dst__, src__, clientData__, status__, numInterfaceAddress__, stationMacAddress__, smeVersions__, scheduledInterrupt__) \ + { \ + CsrWifiRouterCtrlWifiOnRes *msg__; \ + CsrWifiRouterCtrlWifiOnResCreate(msg__, dst__, src__, clientData__, status__, numInterfaceAddress__, stationMacAddress__, smeVersions__, scheduledInterrupt__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlWifiOnResSend(src__, clientData__, status__, numInterfaceAddress__, stationMacAddress__, smeVersions__, scheduledInterrupt__) \ + CsrWifiRouterCtrlWifiOnResSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__, status__, numInterfaceAddress__, stationMacAddress__, smeVersions__, scheduledInterrupt__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWifiOnCfmSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + status - + +*******************************************************************************/ +#define CsrWifiRouterCtrlWifiOnCfmCreate(msg__, dst__, src__, clientData__, status__) \ + msg__ = (CsrWifiRouterCtrlWifiOnCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_ON_CFM, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->status = (status__); + +#define CsrWifiRouterCtrlWifiOnCfmSendTo(dst__, src__, clientData__, status__) \ + { \ + CsrWifiRouterCtrlWifiOnCfm *msg__; \ + CsrWifiRouterCtrlWifiOnCfmCreate(msg__, dst__, src__, clientData__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlWifiOnCfmSend(dst__, clientData__, status__) \ + CsrWifiRouterCtrlWifiOnCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, status__) + + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_ROUTER_CTRL_LIB_H__ */ diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_prim.h b/drivers/staging/csr/csr_wifi_router_ctrl_prim.h new file mode 100644 index 0000000..954f600 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_router_ctrl_prim.h @@ -0,0 +1,2018 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_ROUTER_CTRL_PRIM_H__ +#define CSR_WIFI_ROUTER_CTRL_PRIM_H__ + +#include "csr_types.h" +#include "csr_prim_defs.h" +#include "csr_sched.h" +#include "csr_wifi_common.h" +#include "csr_result.h" +#include "csr_wifi_fsm_event.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define CSR_WIFI_ROUTER_CTRL_PRIM (0x0401) + +typedef CsrPrim CsrWifiRouterCtrlPrim; + +typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteWrite)(CsrUint8 func, CsrUint32 address, CsrUint8 data); +typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteRead)(CsrUint8 func, CsrUint32 address, CsrUint8 *pdata); +typedef CsrResult (*CsrWifiRouterCtrlRawSdioFirmwareDownload)(CsrUint32 length, const CsrUint8 *pdata); +typedef CsrResult (*CsrWifiRouterCtrlRawSdioReset)(void); +typedef CsrResult (*CsrWifiRouterCtrlRawSdioCoreDumpPrepare)(CsrBool suspendSme); +typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteBlockRead)(CsrUint8 func, CsrUint32 address, CsrUint8 *pdata, CsrUint32 length); +typedef CsrResult (*CsrWifiRouterCtrlRawSdioGpRead16)(CsrUint8 func, CsrUint32 address, CsrUint16 *pdata); +typedef CsrResult (*CsrWifiRouterCtrlRawSdioGpWrite16)(CsrUint8 func, CsrUint32 address, CsrUint16 data); + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlBlockAckRole + + DESCRIPTION + + VALUES + CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR + - + CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT + - + +*******************************************************************************/ +typedef CsrUint8 CsrWifiRouterCtrlBlockAckRole; +#define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR ((CsrWifiRouterCtrlBlockAckRole) 0x00) +#define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT ((CsrWifiRouterCtrlBlockAckRole) 0x01) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlControlIndication + + DESCRIPTION + + VALUES + CSR_WIFI_ROUTER_CTRL_CONTROL_INDICATION_ERROR + - + CSR_WIFI_ROUTER_CTRL_CONTROL_INDICATION_EXIT + - + CSR_WIFI_ROUTER_CTRL_CONTROL_INDICATION_USER_REQUESTED + - + +*******************************************************************************/ +typedef CsrUint8 CsrWifiRouterCtrlControlIndication; +#define CSR_WIFI_ROUTER_CTRL_CONTROL_INDICATION_ERROR ((CsrWifiRouterCtrlControlIndication) 0x01) +#define CSR_WIFI_ROUTER_CTRL_CONTROL_INDICATION_EXIT ((CsrWifiRouterCtrlControlIndication) 0x02) +#define CSR_WIFI_ROUTER_CTRL_CONTROL_INDICATION_USER_REQUESTED ((CsrWifiRouterCtrlControlIndication) 0x03) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlListAction + + DESCRIPTION + + VALUES + CSR_WIFI_ROUTER_CTRL_LIST_ACTION_GET + - + CSR_WIFI_ROUTER_CTRL_LIST_ACTION_ADD + - + CSR_WIFI_ROUTER_CTRL_LIST_ACTION_REMOVE + - + CSR_WIFI_ROUTER_CTRL_LIST_ACTION_FLUSH + - + +*******************************************************************************/ +typedef CsrUint8 CsrWifiRouterCtrlListAction; +#define CSR_WIFI_ROUTER_CTRL_LIST_ACTION_GET ((CsrWifiRouterCtrlListAction) 0x00) +#define CSR_WIFI_ROUTER_CTRL_LIST_ACTION_ADD ((CsrWifiRouterCtrlListAction) 0x01) +#define CSR_WIFI_ROUTER_CTRL_LIST_ACTION_REMOVE ((CsrWifiRouterCtrlListAction) 0x02) +#define CSR_WIFI_ROUTER_CTRL_LIST_ACTION_FLUSH ((CsrWifiRouterCtrlListAction) 0x03) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlLowPowerMode + + DESCRIPTION + + VALUES + CSR_WIFI_ROUTER_CTRL_LOW_POWER_MODE_DISABLED + - + CSR_WIFI_ROUTER_CTRL_LOW_POWER_MODE_ENABLED + - + +*******************************************************************************/ +typedef CsrUint16 CsrWifiRouterCtrlLowPowerMode; +#define CSR_WIFI_ROUTER_CTRL_LOW_POWER_MODE_DISABLED ((CsrWifiRouterCtrlLowPowerMode) 0x0000) +#define CSR_WIFI_ROUTER_CTRL_LOW_POWER_MODE_ENABLED ((CsrWifiRouterCtrlLowPowerMode) 0x0001) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlMediaStatus + + DESCRIPTION + + VALUES + CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_CONNECTED + - + CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_DISCONNECTED + - + +*******************************************************************************/ +typedef CsrUint8 CsrWifiRouterCtrlMediaStatus; +#define CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_CONNECTED ((CsrWifiRouterCtrlMediaStatus) 0x00) +#define CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_DISCONNECTED ((CsrWifiRouterCtrlMediaStatus) 0x01) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlMode + + DESCRIPTION + + VALUES + CSR_WIFI_ROUTER_CTRL_MODE_NONE - + CSR_WIFI_ROUTER_CTRL_MODE_IBSS - + CSR_WIFI_ROUTER_CTRL_MODE_STA - + CSR_WIFI_ROUTER_CTRL_MODE_AP - + CSR_WIFI_ROUTER_CTRL_MODE_MONITOR - + CSR_WIFI_ROUTER_CTRL_MODE_AMP - + CSR_WIFI_ROUTER_CTRL_MODE_P2P - + CSR_WIFI_ROUTER_CTRL_MODE_P2PGO - + CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI - + +*******************************************************************************/ +typedef CsrUint8 CsrWifiRouterCtrlMode; +#define CSR_WIFI_ROUTER_CTRL_MODE_NONE ((CsrWifiRouterCtrlMode) 0x00) +#define CSR_WIFI_ROUTER_CTRL_MODE_IBSS ((CsrWifiRouterCtrlMode) 0x01) +#define CSR_WIFI_ROUTER_CTRL_MODE_STA ((CsrWifiRouterCtrlMode) 0x02) +#define CSR_WIFI_ROUTER_CTRL_MODE_AP ((CsrWifiRouterCtrlMode) 0x03) +#define CSR_WIFI_ROUTER_CTRL_MODE_MONITOR ((CsrWifiRouterCtrlMode) 0x04) +#define CSR_WIFI_ROUTER_CTRL_MODE_AMP ((CsrWifiRouterCtrlMode) 0x05) +#define CSR_WIFI_ROUTER_CTRL_MODE_P2P ((CsrWifiRouterCtrlMode) 0x06) +#define CSR_WIFI_ROUTER_CTRL_MODE_P2PGO ((CsrWifiRouterCtrlMode) 0x07) +#define CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI ((CsrWifiRouterCtrlMode) 0x08) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlPeerStatus + + DESCRIPTION + + VALUES + CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE + - + CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE + - + CSR_WIFI_ROUTER_CTRL_PEER_DISCONNECTED + - + +*******************************************************************************/ +typedef CsrUint8 CsrWifiRouterCtrlPeerStatus; +#define CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE ((CsrWifiRouterCtrlPeerStatus) 0x00) +#define CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE ((CsrWifiRouterCtrlPeerStatus) 0x01) +#define CSR_WIFI_ROUTER_CTRL_PEER_DISCONNECTED ((CsrWifiRouterCtrlPeerStatus) 0x02) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlPortAction + + DESCRIPTION + + VALUES + CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN + - + CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD + - + CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_BLOCK + - + +*******************************************************************************/ +typedef CsrUint16 CsrWifiRouterCtrlPortAction; +#define CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN ((CsrWifiRouterCtrlPortAction) 0x0000) +#define CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD ((CsrWifiRouterCtrlPortAction) 0x0001) +#define CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_BLOCK ((CsrWifiRouterCtrlPortAction) 0x0002) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlPowersaveType + + DESCRIPTION + + VALUES + CSR_WIFI_ROUTER_CTRL_AC_BK_PS_INFO_PRESENT + - If set, AC BK PS info is present in b4 and b5 + CSR_WIFI_ROUTER_CTRL_AC_BE_PS_INFO_PRESENT + - If set, AC BE PS info is present in b6 and b7 + CSR_WIFI_ROUTER_CTRL_AC_VI_PS_INFO_PRESENT + - If set, AC VI PS info is present in b8 and b9 + CSR_WIFI_ROUTER_CTRL_AC_VO_PS_INFO_PRESENT + - If set, AC VO PS info is present in b10 and b11 + CSR_WIFI_ROUTER_CTRL_AC_BK_TRIGGER_ENABLED + - + CSR_WIFI_ROUTER_CTRL_AC_BK_DELIVERY_ENABLED + - + CSR_WIFI_ROUTER_CTRL_AC_BE_TRIGGER_ENABLED + - + CSR_WIFI_ROUTER_CTRL_AC_BE_DELIVERY_ENABLED + - + CSR_WIFI_ROUTER_CTRL_AC_VI_TRIGGER_ENABLED + - + CSR_WIFI_ROUTER_CTRL_AC_VI_DELIVERY_ENABLED + - + CSR_WIFI_ROUTER_CTRL_AC_VO_TRIGGER_ENABLED + - + CSR_WIFI_ROUTER_CTRL_AC_VO_DELIVERY_ENABLED + - + +*******************************************************************************/ +typedef CsrUint16 CsrWifiRouterCtrlPowersaveType; +#define CSR_WIFI_ROUTER_CTRL_AC_BK_PS_INFO_PRESENT ((CsrWifiRouterCtrlPowersaveType) 0x0001) +#define CSR_WIFI_ROUTER_CTRL_AC_BE_PS_INFO_PRESENT ((CsrWifiRouterCtrlPowersaveType) 0x0002) +#define CSR_WIFI_ROUTER_CTRL_AC_VI_PS_INFO_PRESENT ((CsrWifiRouterCtrlPowersaveType) 0x0004) +#define CSR_WIFI_ROUTER_CTRL_AC_VO_PS_INFO_PRESENT ((CsrWifiRouterCtrlPowersaveType) 0x0008) +#define CSR_WIFI_ROUTER_CTRL_AC_BK_TRIGGER_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0010) +#define CSR_WIFI_ROUTER_CTRL_AC_BK_DELIVERY_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0020) +#define CSR_WIFI_ROUTER_CTRL_AC_BE_TRIGGER_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0040) +#define CSR_WIFI_ROUTER_CTRL_AC_BE_DELIVERY_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0080) +#define CSR_WIFI_ROUTER_CTRL_AC_VI_TRIGGER_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0100) +#define CSR_WIFI_ROUTER_CTRL_AC_VI_DELIVERY_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0200) +#define CSR_WIFI_ROUTER_CTRL_AC_VO_TRIGGER_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0400) +#define CSR_WIFI_ROUTER_CTRL_AC_VO_DELIVERY_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0800) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlProtocolDirection + + DESCRIPTION + + VALUES + CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_RX + - + CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX + - + +*******************************************************************************/ +typedef CsrUint16 CsrWifiRouterCtrlProtocolDirection; +#define CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_RX ((CsrWifiRouterCtrlProtocolDirection) 0x0000) +#define CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX ((CsrWifiRouterCtrlProtocolDirection) 0x0001) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlQoSControl + + DESCRIPTION + + VALUES + CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_OFF + - + CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_WMM_ON + - + CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_80211_ON + - + +*******************************************************************************/ +typedef CsrUint16 CsrWifiRouterCtrlQoSControl; +#define CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_OFF ((CsrWifiRouterCtrlQoSControl) 0x0000) +#define CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_WMM_ON ((CsrWifiRouterCtrlQoSControl) 0x0001) +#define CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_80211_ON ((CsrWifiRouterCtrlQoSControl) 0x0002) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlQueueConfig + + DESCRIPTION + Defines which Queues are enabled for use. + + VALUES + CSR_WIFI_ROUTER_CTRL_QUEUE_BE_ENABLE + - + CSR_WIFI_ROUTER_CTRL_QUEUE_BK_ENABLE + - + CSR_WIFI_ROUTER_CTRL_QUEUE_VI_ENABLE + - + CSR_WIFI_ROUTER_CTRL_QUEUE_VO_ENABLE + - + +*******************************************************************************/ +typedef CsrUint8 CsrWifiRouterCtrlQueueConfig; +#define CSR_WIFI_ROUTER_CTRL_QUEUE_BE_ENABLE ((CsrWifiRouterCtrlQueueConfig) 0x01) +#define CSR_WIFI_ROUTER_CTRL_QUEUE_BK_ENABLE ((CsrWifiRouterCtrlQueueConfig) 0x02) +#define CSR_WIFI_ROUTER_CTRL_QUEUE_VI_ENABLE ((CsrWifiRouterCtrlQueueConfig) 0x04) +#define CSR_WIFI_ROUTER_CTRL_QUEUE_VO_ENABLE ((CsrWifiRouterCtrlQueueConfig) 0x08) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlTrafficConfigType + + DESCRIPTION + + VALUES + CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_RESET + - + CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_FILTER + - + CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_CLS + - + +*******************************************************************************/ +typedef CsrUint16 CsrWifiRouterCtrlTrafficConfigType; +#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_RESET ((CsrWifiRouterCtrlTrafficConfigType) 0x0000) +#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_FILTER ((CsrWifiRouterCtrlTrafficConfigType) 0x0001) +#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_CLS ((CsrWifiRouterCtrlTrafficConfigType) 0x0002) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlTrafficPacketType + + DESCRIPTION + + VALUES + CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_NONE + - + CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_EAPOL + - + CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP + - + CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP_ACK + - + CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_ARP + - + CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_AIRONET + - + CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM + - + CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_ALL + - + +*******************************************************************************/ +typedef CsrUint16 CsrWifiRouterCtrlTrafficPacketType; +#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_NONE ((CsrWifiRouterCtrlTrafficPacketType) 0x0000) +#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_EAPOL ((CsrWifiRouterCtrlTrafficPacketType) 0x0001) +#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP ((CsrWifiRouterCtrlTrafficPacketType) 0x0002) +#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP_ACK ((CsrWifiRouterCtrlTrafficPacketType) 0x0004) +#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_ARP ((CsrWifiRouterCtrlTrafficPacketType) 0x0008) +#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_AIRONET ((CsrWifiRouterCtrlTrafficPacketType) 0x0010) +#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM ((CsrWifiRouterCtrlTrafficPacketType) 0x0020) +#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_ALL ((CsrWifiRouterCtrlTrafficPacketType) 0x00FF) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlTrafficType + + DESCRIPTION + + VALUES + CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_OCCASIONAL + - + CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_BURSTY + - + CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_PERIODIC + - + CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_CONTINUOUS + - + +*******************************************************************************/ +typedef CsrUint8 CsrWifiRouterCtrlTrafficType; +#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_OCCASIONAL ((CsrWifiRouterCtrlTrafficType) 0x00) +#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_BURSTY ((CsrWifiRouterCtrlTrafficType) 0x01) +#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_PERIODIC ((CsrWifiRouterCtrlTrafficType) 0x02) +#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_CONTINUOUS ((CsrWifiRouterCtrlTrafficType) 0x03) + + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlPeerRecordHandle + + DESCRIPTION + +*******************************************************************************/ +typedef CsrUint32 CsrWifiRouterCtrlPeerRecordHandle; +/******************************************************************************* + + NAME + CsrWifiRouterCtrlPowersaveTypeMask + + DESCRIPTION + Mask type for use with the values defined by + CsrWifiRouterCtrlPowersaveType + +*******************************************************************************/ +typedef CsrUint16 CsrWifiRouterCtrlPowersaveTypeMask; +/******************************************************************************* + + NAME + CsrWifiRouterCtrlQueueConfigMask + + DESCRIPTION + Mask type for use with the values defined by CsrWifiRouterCtrlQueueConfig + +*******************************************************************************/ +typedef CsrUint8 CsrWifiRouterCtrlQueueConfigMask; +/******************************************************************************* + + NAME + CsrWifiRouterCtrlRequestorInfo + + DESCRIPTION + +*******************************************************************************/ +typedef CsrUint16 CsrWifiRouterCtrlRequestorInfo; +/******************************************************************************* + + NAME + CsrWifiRouterCtrlTrafficStreamId + + DESCRIPTION + +*******************************************************************************/ +typedef CsrUint8 CsrWifiRouterCtrlTrafficStreamId; + + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlSmeVersions + + DESCRIPTION + + MEMBERS + firmwarePatch - + smeBuild - + smeHip - + +*******************************************************************************/ +typedef struct +{ + CsrUint32 firmwarePatch; + CsrCharString *smeBuild; + CsrUint32 smeHip; +} CsrWifiRouterCtrlSmeVersions; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlStaInfo + + DESCRIPTION + + MEMBERS + wmmOrQosEnabled - + powersaveMode - + maxSpLength - + listenIntervalInTus - + +*******************************************************************************/ +typedef struct +{ + CsrBool wmmOrQosEnabled; + CsrWifiRouterCtrlPowersaveTypeMask powersaveMode; + CsrUint8 maxSpLength; + CsrUint16 listenIntervalInTus; +} CsrWifiRouterCtrlStaInfo; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlTrafficFilter + + DESCRIPTION + + MEMBERS + etherType - + ipType - + udpSourcePort - + udpDestPort - + +*******************************************************************************/ +typedef struct +{ + CsrUint32 etherType; + CsrUint8 ipType; + CsrUint32 udpSourcePort; + CsrUint32 udpDestPort; +} CsrWifiRouterCtrlTrafficFilter; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlTrafficStats + + DESCRIPTION + + MEMBERS + rxMeanRate - Mean rx data rate over the interval + rxFramesNum - Keep number of Rx frames per second, for CYCLE_3. + txFramesNum - Keep number of Tx frames per second, for CYCLE_3. + rxBytesCount - Keep calculated Rx throughput per second, for CYCLE_2. + txBytesCount - Keep calculated Tx throughput per second, for CYCLE_2. + intervals - array size 11 MUST match TA_INTERVALS_NUM + +*******************************************************************************/ +typedef struct +{ + CsrUint32 rxMeanRate; + CsrUint32 rxFramesNum; + CsrUint32 txFramesNum; + CsrUint32 rxBytesCount; + CsrUint32 txBytesCount; + CsrUint8 intervals[11]; +} CsrWifiRouterCtrlTrafficStats; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlVersions + + DESCRIPTION + + MEMBERS + chipId - + chipVersion - + firmwareBuild - + firmwareHip - + routerBuild - + routerHip - + +*******************************************************************************/ +typedef struct +{ + CsrUint32 chipId; + CsrUint32 chipVersion; + CsrUint32 firmwareBuild; + CsrUint32 firmwareHip; + CsrCharString *routerBuild; + CsrUint32 routerHip; +} CsrWifiRouterCtrlVersions; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlTrafficConfig + + DESCRIPTION + + MEMBERS + packetFilter - + customFilter - + +*******************************************************************************/ +typedef struct +{ + CsrUint16 packetFilter; + CsrWifiRouterCtrlTrafficFilter customFilter; +} CsrWifiRouterCtrlTrafficConfig; + + +/* Downstream */ +#define CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST (0x0000) + +#define CSR_WIFI_ROUTER_CTRL_CONFIGURE_POWER_MODE_REQ ((CsrWifiRouterCtrlPrim) (0x0000 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_HIP_REQ ((CsrWifiRouterCtrlPrim) (0x0001 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_REQ ((CsrWifiRouterCtrlPrim) (0x0002 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_RES ((CsrWifiRouterCtrlPrim) (0x0003 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_PORT_CONFIGURE_REQ ((CsrWifiRouterCtrlPrim) (0x0004 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_REQ ((CsrWifiRouterCtrlPrim) (0x0005 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_SUSPEND_RES ((CsrWifiRouterCtrlPrim) (0x0006 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_REQ ((CsrWifiRouterCtrlPrim) (0x0007 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_RESUME_RES ((CsrWifiRouterCtrlPrim) (0x0008 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_RAW_SDIO_DEINITIALISE_REQ ((CsrWifiRouterCtrlPrim) (0x0009 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_RAW_SDIO_INITIALISE_REQ ((CsrWifiRouterCtrlPrim) (0x000A + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_REQ ((CsrWifiRouterCtrlPrim) (0x000B + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_CLASSIFICATION_REQ ((CsrWifiRouterCtrlPrim) (0x000C + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_REQ ((CsrWifiRouterCtrlPrim) (0x000D + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_WIFI_OFF_REQ ((CsrWifiRouterCtrlPrim) (0x000E + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_WIFI_OFF_RES ((CsrWifiRouterCtrlPrim) (0x000F + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_WIFI_ON_REQ ((CsrWifiRouterCtrlPrim) (0x0010 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_WIFI_ON_RES ((CsrWifiRouterCtrlPrim) (0x0011 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_M4_TRANSMIT_REQ ((CsrWifiRouterCtrlPrim) (0x0012 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_MODE_SET_REQ ((CsrWifiRouterCtrlPrim) (0x0013 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_PEER_ADD_REQ ((CsrWifiRouterCtrlPrim) (0x0014 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_PEER_DEL_REQ ((CsrWifiRouterCtrlPrim) (0x0015 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_PEER_UPDATE_REQ ((CsrWifiRouterCtrlPrim) (0x0016 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_CAPABILITIES_REQ ((CsrWifiRouterCtrlPrim) (0x0017 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_REQ ((CsrWifiRouterCtrlPrim) (0x0018 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_REQ ((CsrWifiRouterCtrlPrim) (0x0019 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_REQ ((CsrWifiRouterCtrlPrim) (0x001A + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_FILTER_REQ ((CsrWifiRouterCtrlPrim) (0x001B + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_FILTER_REQ ((CsrWifiRouterCtrlPrim) (0x001C + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) + + +#define CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_HIGHEST (0x001C + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST) + +/* Upstream */ +#define CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST (0x0000 + CSR_PRIM_UPSTREAM) + +#define CSR_WIFI_ROUTER_CTRL_HIP_IND ((CsrWifiRouterCtrlPrim)(0x0000 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_IND ((CsrWifiRouterCtrlPrim)(0x0001 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_PORT_CONFIGURE_CFM ((CsrWifiRouterCtrlPrim)(0x0002 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_RESUME_IND ((CsrWifiRouterCtrlPrim)(0x0003 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_SUSPEND_IND ((CsrWifiRouterCtrlPrim)(0x0004 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_CFM ((CsrWifiRouterCtrlPrim)(0x0005 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_RAW_SDIO_DEINITIALISE_CFM ((CsrWifiRouterCtrlPrim)(0x0006 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_RAW_SDIO_INITIALISE_CFM ((CsrWifiRouterCtrlPrim)(0x0007 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_CFM ((CsrWifiRouterCtrlPrim)(0x0008 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PROTOCOL_IND ((CsrWifiRouterCtrlPrim)(0x0009 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_SAMPLE_IND ((CsrWifiRouterCtrlPrim)(0x000A + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_WIFI_OFF_IND ((CsrWifiRouterCtrlPrim)(0x000B + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_WIFI_OFF_CFM ((CsrWifiRouterCtrlPrim)(0x000C + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_WIFI_ON_IND ((CsrWifiRouterCtrlPrim)(0x000D + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_WIFI_ON_CFM ((CsrWifiRouterCtrlPrim)(0x000E + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_M4_READY_TO_SEND_IND ((CsrWifiRouterCtrlPrim)(0x000F + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_M4_TRANSMITTED_IND ((CsrWifiRouterCtrlPrim)(0x0010 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_MIC_FAILURE_IND ((CsrWifiRouterCtrlPrim)(0x0011 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_CONNECTED_IND ((CsrWifiRouterCtrlPrim)(0x0012 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_PEER_ADD_CFM ((CsrWifiRouterCtrlPrim)(0x0013 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_PEER_DEL_CFM ((CsrWifiRouterCtrlPrim)(0x0014 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_UNEXPECTED_FRAME_IND ((CsrWifiRouterCtrlPrim)(0x0015 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_PEER_UPDATE_CFM ((CsrWifiRouterCtrlPrim)(0x0016 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_CAPABILITIES_CFM ((CsrWifiRouterCtrlPrim)(0x0017 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_CFM ((CsrWifiRouterCtrlPrim)(0x0018 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_CFM ((CsrWifiRouterCtrlPrim)(0x0019 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ERROR_IND ((CsrWifiRouterCtrlPrim)(0x001A + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_STA_INACTIVE_IND ((CsrWifiRouterCtrlPrim)(0x001B + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_IND ((CsrWifiRouterCtrlPrim)(0x001C + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) + +#define CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_HIGHEST (0x001C + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST) + +#define CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT (CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_HIGHEST + 1 - CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST) +#define CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_COUNT (CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_HIGHEST + 1 - CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlConfigurePowerModeReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + mode - + wakeHost - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrWifiRouterCtrlLowPowerMode mode; + CsrBool wakeHost; +} CsrWifiRouterCtrlConfigurePowerModeReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlHipReq + + DESCRIPTION + This primitive is used for transferring MLME messages to the HIP. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + mlmeCommandLength - Length of the MLME signal + mlmeCommand - Pointer to the MLME signal + dataRef1Length - Length of the dataRef1 bulk data + dataRef1 - Pointer to the bulk data 1 + dataRef2Length - Length of the dataRef2 bulk data + dataRef2 - Pointer to the bulk data 2 + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 mlmeCommandLength; + CsrUint8 *mlmeCommand; + CsrUint16 dataRef1Length; + CsrUint8 *dataRef1; + CsrUint16 dataRef2Length; + CsrUint8 *dataRef2; +} CsrWifiRouterCtrlHipReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlMediaStatusReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + clientData - + mediaStatus - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrWifiRouterCtrlMediaStatus mediaStatus; +} CsrWifiRouterCtrlMediaStatusReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlMulticastAddressRes + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + clientData - + status - + action - + getAddressesCount - + getAddresses - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrResult status; + CsrWifiRouterCtrlListAction action; + CsrUint8 getAddressesCount; + CsrWifiMacAddress *getAddresses; +} CsrWifiRouterCtrlMulticastAddressRes; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlPortConfigureReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + clientData - + uncontrolledPortAction - + controlledPortAction - + macAddress - + setProtection - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrWifiRouterCtrlPortAction uncontrolledPortAction; + CsrWifiRouterCtrlPortAction controlledPortAction; + CsrWifiMacAddress macAddress; + CsrBool setProtection; +} CsrWifiRouterCtrlPortConfigureReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlQosControlReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + clientData - + control - + queueConfig - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrWifiRouterCtrlQoSControl control; + CsrWifiRouterCtrlQueueConfigMask queueConfig; +} CsrWifiRouterCtrlQosControlReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlSuspendRes + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + status - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrResult status; +} CsrWifiRouterCtrlSuspendRes; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlTclasAddReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + clientData - + tclasLength - + tclas - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 tclasLength; + CsrUint8 *tclas; +} CsrWifiRouterCtrlTclasAddReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlResumeRes + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + status - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrResult status; +} CsrWifiRouterCtrlResumeRes; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlRawSdioDeinitialiseReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; +} CsrWifiRouterCtrlRawSdioDeinitialiseReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlRawSdioInitialiseReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; +} CsrWifiRouterCtrlRawSdioInitialiseReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlTclasDelReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + clientData - + tclasLength - + tclas - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 tclasLength; + CsrUint8 *tclas; +} CsrWifiRouterCtrlTclasDelReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlTrafficClassificationReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + clientData - + trafficType - + period - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrWifiRouterCtrlTrafficType trafficType; + CsrUint16 period; +} CsrWifiRouterCtrlTrafficClassificationReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlTrafficConfigReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + clientData - + trafficConfigType - + config - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrWifiRouterCtrlTrafficConfigType trafficConfigType; + CsrWifiRouterCtrlTrafficConfig config; +} CsrWifiRouterCtrlTrafficConfigReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWifiOffReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; +} CsrWifiRouterCtrlWifiOffReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWifiOffRes + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; +} CsrWifiRouterCtrlWifiOffRes; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWifiOnReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; +} CsrWifiRouterCtrlWifiOnReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWifiOnRes + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + status - + numInterfaceAddress - + stationMacAddress - array size 1 MUST match CSR_WIFI_NUM_INTERFACES + smeVersions - + scheduledInterrupt - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrResult status; + CsrUint16 numInterfaceAddress; + CsrWifiMacAddress stationMacAddress[2]; + CsrWifiRouterCtrlSmeVersions smeVersions; + CsrBool scheduledInterrupt; +} CsrWifiRouterCtrlWifiOnRes; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlM4TransmitReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + clientData - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiRouterCtrlRequestorInfo clientData; +} CsrWifiRouterCtrlM4TransmitReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlModeSetReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + clientData - + mode - + bssid - BSSID of the network the device is going to be a part + of + protection - Set to TRUE if encryption is enabled for the + connection/broadcast frames + intraBssDistEnabled - If set to TRUE, intra BSS destribution will be + enabled. If set to FALSE, any unicast PDU which does + not have the RA as the the local MAC address, shall be + ignored. This field is interpreted by the receive if + mode is set to CSR_WIFI_ROUTER_CTRL_MODE_P2PGO + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrWifiRouterCtrlMode mode; + CsrWifiMacAddress bssid; + CsrBool protection; + CsrBool intraBssDistEnabled; +} CsrWifiRouterCtrlModeSetReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlPeerAddReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + clientData - + peerMacAddress - + associationId - + staInfo - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrWifiMacAddress peerMacAddress; + CsrUint16 associationId; + CsrWifiRouterCtrlStaInfo staInfo; +} CsrWifiRouterCtrlPeerAddReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlPeerDelReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + clientData - + peerRecordHandle - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrWifiRouterCtrlPeerRecordHandle peerRecordHandle; +} CsrWifiRouterCtrlPeerDelReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlPeerUpdateReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + clientData - + peerRecordHandle - + powersaveMode - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrWifiRouterCtrlPeerRecordHandle peerRecordHandle; + CsrWifiRouterCtrlPowersaveTypeMask powersaveMode; +} CsrWifiRouterCtrlPeerUpdateReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlCapabilitiesReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; +} CsrWifiRouterCtrlCapabilitiesReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlBlockAckEnableReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + clientData - + macAddress - + trafficStreamID - + role - + bufferSize - + timeout - + ssn - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrWifiMacAddress macAddress; + CsrWifiRouterCtrlTrafficStreamId trafficStreamID; + CsrWifiRouterCtrlBlockAckRole role; + CsrUint16 bufferSize; + CsrUint16 timeout; + CsrUint16 ssn; +} CsrWifiRouterCtrlBlockAckEnableReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlBlockAckDisableReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + clientData - + macAddress - + trafficStreamID - + role - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrWifiMacAddress macAddress; + CsrWifiRouterCtrlTrafficStreamId trafficStreamID; + CsrWifiRouterCtrlBlockAckRole role; +} CsrWifiRouterCtrlBlockAckDisableReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWapiMulticastReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + signalLength - + signal - + dataLength - + data - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 signalLength; + CsrUint8 *signal; + CsrUint16 dataLength; + CsrUint8 *data; +} CsrWifiRouterCtrlWapiMulticastReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWapiMulticastFilterReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint8 status; +} CsrWifiRouterCtrlWapiMulticastFilterReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWapiUnicastFilterReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint8 status; +} CsrWifiRouterCtrlWapiUnicastFilterReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlHipInd + + DESCRIPTION + This primitive is used for transferring MLME messages from the HIP. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + mlmeCommandLength - Length of the MLME signal + mlmeCommand - Pointer to the MLME signal + dataRef1Length - Length of the dataRef1 bulk data + dataRef1 - Pointer to the bulk data 1 + dataRef2Length - Length of the dataRef2 bulk data + dataRef2 - Pointer to the bulk data 2 + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 mlmeCommandLength; + CsrUint8 *mlmeCommand; + CsrUint16 dataRef1Length; + CsrUint8 *dataRef1; + CsrUint16 dataRef2Length; + CsrUint8 *dataRef2; +} CsrWifiRouterCtrlHipInd; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlMulticastAddressInd + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + interfaceTag - + action - + setAddressesCount - + setAddresses - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 interfaceTag; + CsrWifiRouterCtrlListAction action; + CsrUint8 setAddressesCount; + CsrWifiMacAddress *setAddresses; +} CsrWifiRouterCtrlMulticastAddressInd; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlPortConfigureCfm + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + interfaceTag - + status - + macAddress - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 interfaceTag; + CsrResult status; + CsrWifiMacAddress macAddress; +} CsrWifiRouterCtrlPortConfigureCfm; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlResumeInd + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + powerMaintained - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrBool powerMaintained; +} CsrWifiRouterCtrlResumeInd; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlSuspendInd + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + hardSuspend - + d3Suspend - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrBool hardSuspend; + CsrBool d3Suspend; +} CsrWifiRouterCtrlSuspendInd; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlTclasAddCfm + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + interfaceTag - + status - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 interfaceTag; + CsrResult status; +} CsrWifiRouterCtrlTclasAddCfm; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlRawSdioDeinitialiseCfm + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + result - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrResult result; +} CsrWifiRouterCtrlRawSdioDeinitialiseCfm; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlRawSdioInitialiseCfm + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + result - + byteRead - + byteWrite - + firmwareDownload - + reset - + coreDumpPrepare - + byteBlockRead - + gpRead16 - + gpWrite16 - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrResult result; + CsrWifiRouterCtrlRawSdioByteRead byteRead; + CsrWifiRouterCtrlRawSdioByteWrite byteWrite; + CsrWifiRouterCtrlRawSdioFirmwareDownload firmwareDownload; + CsrWifiRouterCtrlRawSdioReset reset; + CsrWifiRouterCtrlRawSdioCoreDumpPrepare coreDumpPrepare; + CsrWifiRouterCtrlRawSdioByteBlockRead byteBlockRead; + CsrWifiRouterCtrlRawSdioGpRead16 gpRead16; + CsrWifiRouterCtrlRawSdioGpWrite16 gpWrite16; +} CsrWifiRouterCtrlRawSdioInitialiseCfm; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlTclasDelCfm + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + interfaceTag - + status - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 interfaceTag; + CsrResult status; +} CsrWifiRouterCtrlTclasDelCfm; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlTrafficProtocolInd + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + interfaceTag - + packetType - + direction - + srcAddress - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 interfaceTag; + CsrWifiRouterCtrlTrafficPacketType packetType; + CsrWifiRouterCtrlProtocolDirection direction; + CsrWifiMacAddress srcAddress; +} CsrWifiRouterCtrlTrafficProtocolInd; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlTrafficSampleInd + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + interfaceTag - + stats - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 interfaceTag; + CsrWifiRouterCtrlTrafficStats stats; +} CsrWifiRouterCtrlTrafficSampleInd; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWifiOffInd + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + controlIndication - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrWifiRouterCtrlControlIndication controlIndication; +} CsrWifiRouterCtrlWifiOffInd; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWifiOffCfm + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; +} CsrWifiRouterCtrlWifiOffCfm; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWifiOnInd + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + status - + versions - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrResult status; + CsrWifiRouterCtrlVersions versions; +} CsrWifiRouterCtrlWifiOnInd; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWifiOnCfm + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + status - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrResult status; +} CsrWifiRouterCtrlWifiOnCfm; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlM4ReadyToSendInd + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + interfaceTag - + peerMacAddress - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 interfaceTag; + CsrWifiMacAddress peerMacAddress; +} CsrWifiRouterCtrlM4ReadyToSendInd; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlM4TransmittedInd + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + interfaceTag - + peerMacAddress - + status - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 interfaceTag; + CsrWifiMacAddress peerMacAddress; + CsrResult status; +} CsrWifiRouterCtrlM4TransmittedInd; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlMicFailureInd + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + interfaceTag - + peerMacAddress - + unicastPdu - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 interfaceTag; + CsrWifiMacAddress peerMacAddress; + CsrBool unicastPdu; +} CsrWifiRouterCtrlMicFailureInd; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlConnectedInd + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + interfaceTag - + peerMacAddress - + peerStatus - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 interfaceTag; + CsrWifiMacAddress peerMacAddress; + CsrWifiRouterCtrlPeerStatus peerStatus; +} CsrWifiRouterCtrlConnectedInd; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlPeerAddCfm + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + interfaceTag - + peerMacAddress - + peerRecordHandle - + status - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 interfaceTag; + CsrWifiMacAddress peerMacAddress; + CsrWifiRouterCtrlPeerRecordHandle peerRecordHandle; + CsrResult status; +} CsrWifiRouterCtrlPeerAddCfm; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlPeerDelCfm + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + interfaceTag - + status - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 interfaceTag; + CsrResult status; +} CsrWifiRouterCtrlPeerDelCfm; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlUnexpectedFrameInd + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + interfaceTag - + peerMacAddress - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 interfaceTag; + CsrWifiMacAddress peerMacAddress; +} CsrWifiRouterCtrlUnexpectedFrameInd; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlPeerUpdateCfm + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + interfaceTag - + status - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 interfaceTag; + CsrResult status; +} CsrWifiRouterCtrlPeerUpdateCfm; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlCapabilitiesCfm + + DESCRIPTION + The router sends this primitive to confirm the size of the queues of the + HIP. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + commandQueueSize - Size of command queue + trafficQueueSize - Size of traffic queue (per AC) + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 commandQueueSize; + CsrUint16 trafficQueueSize; +} CsrWifiRouterCtrlCapabilitiesCfm; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlBlockAckEnableCfm + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + interfaceTag - + status - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 interfaceTag; + CsrResult status; +} CsrWifiRouterCtrlBlockAckEnableCfm; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlBlockAckDisableCfm + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + interfaceTag - + status - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 interfaceTag; + CsrResult status; +} CsrWifiRouterCtrlBlockAckDisableCfm; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlBlockAckErrorInd + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + interfaceTag - + trafficStreamID - + peerMacAddress - + status - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 interfaceTag; + CsrWifiRouterCtrlTrafficStreamId trafficStreamID; + CsrWifiMacAddress peerMacAddress; + CsrResult status; +} CsrWifiRouterCtrlBlockAckErrorInd; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlStaInactiveInd + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + interfaceTag - + staAddress - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 interfaceTag; + CsrWifiMacAddress staAddress; +} CsrWifiRouterCtrlStaInactiveInd; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWapiMulticastInd + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + interfaceTag - + signalLength - + signal - + dataLength - + data - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 interfaceTag; + CsrUint16 signalLength; + CsrUint8 *signal; + CsrUint16 dataLength; + CsrUint8 *data; +} CsrWifiRouterCtrlWapiMulticastInd; + + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_ROUTER_CTRL_PRIM_H__ */ + diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_sef.c b/drivers/staging/csr/csr_wifi_router_ctrl_sef.c new file mode 100644 index 0000000..b7fa6a1 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_router_ctrl_sef.c @@ -0,0 +1,43 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + Confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + + *****************************************************************************/ +#include "csr_wifi_router_ctrl_sef.h" + +const CsrWifiRouterCtrlStateHandlerType CsrWifiRouterCtrlDownstreamStateHandlers[CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT] = +{ + /* 0x0000 */ CsrWifiRouterCtrlConfigurePowerModeReqHandler, + /* 0x0001 */ CsrWifiRouterCtrlHipReqHandler, + /* 0x0002 */ CsrWifiRouterCtrlMediaStatusReqHandler, + /* 0x0003 */ CsrWifiRouterCtrlMulticastAddressResHandler, + /* 0x0004 */ CsrWifiRouterCtrlPortConfigureReqHandler, + /* 0x0005 */ CsrWifiRouterCtrlQosControlReqHandler, + /* 0x0006 */ CsrWifiRouterCtrlSuspendResHandler, + /* 0x0007 */ CsrWifiRouterCtrlTclasAddReqHandler, + /* 0x0008 */ CsrWifiRouterCtrlResumeResHandler, + /* 0x0009 */ CsrWifiRouterCtrlRawSdioDeinitialiseReqHandler, + /* 0x000A */ CsrWifiRouterCtrlRawSdioInitialiseReqHandler, + /* 0x000B */ CsrWifiRouterCtrlTclasDelReqHandler, + /* 0x000C */ CsrWifiRouterCtrlTrafficClassificationReqHandler, + /* 0x000D */ CsrWifiRouterCtrlTrafficConfigReqHandler, + /* 0x000E */ CsrWifiRouterCtrlWifiOffReqHandler, + /* 0x000F */ CsrWifiRouterCtrlWifiOffResHandler, + /* 0x0010 */ CsrWifiRouterCtrlWifiOnReqHandler, + /* 0x0011 */ CsrWifiRouterCtrlWifiOnResHandler, + /* 0x0012 */ CsrWifiRouterCtrlM4TransmitReqHandler, + /* 0x0013 */ CsrWifiRouterCtrlModeSetReqHandler, + /* 0x0014 */ CsrWifiRouterCtrlPeerAddReqHandler, + /* 0x0015 */ CsrWifiRouterCtrlPeerDelReqHandler, + /* 0x0016 */ CsrWifiRouterCtrlPeerUpdateReqHandler, + /* 0x0017 */ CsrWifiRouterCtrlCapabilitiesReqHandler, + CsrWifiRouterCtrlBlockAckEnableReqHandler, /* 0x0018 */ + CsrWifiRouterCtrlBlockAckDisableReqHandler, /* 0x0019 */ + CsrWifiRouterCtrlWapiMulticastReqHandler, /* 0x001A */ + CsrWifiRouterCtrlWapiMulticastFilterReqHandler, /* 0x001B */ + CsrWifiRouterCtrlWapiUnicastFilterReqHandler, /* 0x001C */ +}; diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_sef.h b/drivers/staging/csr/csr_wifi_router_ctrl_sef.h new file mode 100644 index 0000000..07382ef --- /dev/null +++ b/drivers/staging/csr/csr_wifi_router_ctrl_sef.h @@ -0,0 +1,56 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + Confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + + *****************************************************************************/ +#ifndef CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_CTRL_H__ +#define CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_CTRL_H__ + +#include "csr_wifi_router_ctrl_prim.h" + +#ifdef __cplusplus +extern "C" { +#endif + + typedef void (*CsrWifiRouterCtrlStateHandlerType)(void* drvpriv, CsrWifiFsmEvent* msg); + + extern const CsrWifiRouterCtrlStateHandlerType CsrWifiRouterCtrlDownstreamStateHandlers[CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT]; + + extern void CsrWifiRouterCtrlConfigurePowerModeReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlHipReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlMediaStatusReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlMulticastAddressResHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlPortConfigureReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlQosControlReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlSuspendResHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlTclasAddReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlResumeResHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlRawSdioDeinitialiseReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlRawSdioInitialiseReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlTclasDelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlTrafficClassificationReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlTrafficConfigReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlWifiOffReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlWifiOffResHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlWifiOnReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlWifiOnResHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlM4TransmitReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlModeSetReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlPeerAddReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlPeerDelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlPeerUpdateReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlCapabilitiesReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlBlockAckEnableReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlBlockAckDisableReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlWapiMulticastFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlWapiMulticastReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlWapiUnicastFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_CTRL_H__ */ diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c new file mode 100644 index 0000000..cb1f6dc --- /dev/null +++ b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c @@ -0,0 +1,2369 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#include "csr_pmem.h" +#include "csr_msgconv.h" +#include "csr_unicode.h" + + +#include "csr_wifi_router_ctrl_prim.h" +#include "csr_wifi_router_ctrl_serialize.h" + +void CsrWifiRouterCtrlPfree(void *ptr) +{ + CsrPmemFree(ptr); +} + + +CsrSize CsrWifiRouterCtrlConfigurePowerModeReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrWifiRouterCtrlLowPowerMode primitive->mode */ + bufferSize += 1; /* CsrBool primitive->wakeHost */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlConfigurePowerModeReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlConfigurePowerModeReq *primitive = (CsrWifiRouterCtrlConfigurePowerModeReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->mode); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->wakeHost); + return(ptr); +} + + +void* CsrWifiRouterCtrlConfigurePowerModeReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlConfigurePowerModeReq *primitive = (CsrWifiRouterCtrlConfigurePowerModeReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlConfigurePowerModeReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->mode, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->wakeHost, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlHipReqSizeof(void *msg) +{ + CsrWifiRouterCtrlHipReq *primitive = (CsrWifiRouterCtrlHipReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */ + bufferSize += 2; /* CsrUint16 primitive->mlmeCommandLength */ + bufferSize += primitive->mlmeCommandLength; /* CsrUint8 primitive->mlmeCommand */ + bufferSize += 2; /* CsrUint16 primitive->dataRef1Length */ + bufferSize += primitive->dataRef1Length; /* CsrUint8 primitive->dataRef1 */ + bufferSize += 2; /* CsrUint16 primitive->dataRef2Length */ + bufferSize += primitive->dataRef2Length; /* CsrUint8 primitive->dataRef2 */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlHipReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlHipReq *primitive = (CsrWifiRouterCtrlHipReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->mlmeCommandLength); + if (primitive->mlmeCommandLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->mlmeCommand, ((CsrUint16) (primitive->mlmeCommandLength))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->dataRef1Length); + if (primitive->dataRef1Length) + { + CsrMemCpySer(ptr, len, (const void *) primitive->dataRef1, ((CsrUint16) (primitive->dataRef1Length))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->dataRef2Length); + if (primitive->dataRef2Length) + { + CsrMemCpySer(ptr, len, (const void *) primitive->dataRef2, ((CsrUint16) (primitive->dataRef2Length))); + } + return(ptr); +} + + +void* CsrWifiRouterCtrlHipReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlHipReq *primitive = (CsrWifiRouterCtrlHipReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlHipReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->mlmeCommandLength, buffer, &offset); + if (primitive->mlmeCommandLength) + { + primitive->mlmeCommand = (CsrUint8 *)CsrPmemAlloc(primitive->mlmeCommandLength); + CsrMemCpyDes(primitive->mlmeCommand, buffer, &offset, ((CsrUint16) (primitive->mlmeCommandLength))); + } + else + { + primitive->mlmeCommand = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->dataRef1Length, buffer, &offset); + if (primitive->dataRef1Length) + { + primitive->dataRef1 = (CsrUint8 *)CsrPmemAlloc(primitive->dataRef1Length); + CsrMemCpyDes(primitive->dataRef1, buffer, &offset, ((CsrUint16) (primitive->dataRef1Length))); + } + else + { + primitive->dataRef1 = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->dataRef2Length, buffer, &offset); + if (primitive->dataRef2Length) + { + primitive->dataRef2 = (CsrUint8 *)CsrPmemAlloc(primitive->dataRef2Length); + CsrMemCpyDes(primitive->dataRef2, buffer, &offset, ((CsrUint16) (primitive->dataRef2Length))); + } + else + { + primitive->dataRef2 = NULL; + } + + return primitive; +} + + +void CsrWifiRouterCtrlHipReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiRouterCtrlHipReq *primitive = (CsrWifiRouterCtrlHipReq *) voidPrimitivePointer; + CsrPmemFree(primitive->mlmeCommand); + CsrPmemFree(primitive->dataRef1); + CsrPmemFree(primitive->dataRef2); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiRouterCtrlMediaStatusReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 1; /* CsrWifiRouterCtrlMediaStatus primitive->mediaStatus */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlMediaStatusReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlMediaStatusReq *primitive = (CsrWifiRouterCtrlMediaStatusReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->mediaStatus); + return(ptr); +} + + +void* CsrWifiRouterCtrlMediaStatusReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlMediaStatusReq *primitive = (CsrWifiRouterCtrlMediaStatusReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMediaStatusReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->mediaStatus, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlMulticastAddressResSizeof(void *msg) +{ + CsrWifiRouterCtrlMulticastAddressRes *primitive = (CsrWifiRouterCtrlMulticastAddressRes *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 1; /* CsrWifiRouterCtrlListAction primitive->action */ + bufferSize += 1; /* CsrUint8 primitive->getAddressesCount */ + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->getAddressesCount; i1++) + { + bufferSize += 6; /* CsrUint8 primitive->getAddresses[i1].a[6] */ + } + } + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlMulticastAddressResSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlMulticastAddressRes *primitive = (CsrWifiRouterCtrlMulticastAddressRes *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->action); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->getAddressesCount); + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->getAddressesCount; i1++) + { + CsrMemCpySer(ptr, len, (const void *) primitive->getAddresses[i1].a, ((CsrUint16) (6))); + } + } + return(ptr); +} + + +void* CsrWifiRouterCtrlMulticastAddressResDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlMulticastAddressRes *primitive = (CsrWifiRouterCtrlMulticastAddressRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMulticastAddressRes)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->action, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->getAddressesCount, buffer, &offset); + primitive->getAddresses = NULL; + if (primitive->getAddressesCount) + { + primitive->getAddresses = (CsrWifiMacAddress *)CsrPmemAlloc(sizeof(CsrWifiMacAddress) * primitive->getAddressesCount); + } + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->getAddressesCount; i1++) + { + CsrMemCpyDes(primitive->getAddresses[i1].a, buffer, &offset, ((CsrUint16) (6))); + } + } + + return primitive; +} + + +void CsrWifiRouterCtrlMulticastAddressResSerFree(void *voidPrimitivePointer) +{ + CsrWifiRouterCtrlMulticastAddressRes *primitive = (CsrWifiRouterCtrlMulticastAddressRes *) voidPrimitivePointer; + CsrPmemFree(primitive->getAddresses); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiRouterCtrlPortConfigureReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 18) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrWifiRouterCtrlPortAction primitive->uncontrolledPortAction */ + bufferSize += 2; /* CsrWifiRouterCtrlPortAction primitive->controlledPortAction */ + bufferSize += 6; /* CsrUint8 primitive->macAddress.a[6] */ + bufferSize += 1; /* CsrBool primitive->setProtection */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlPortConfigureReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlPortConfigureReq *primitive = (CsrWifiRouterCtrlPortConfigureReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->uncontrolledPortAction); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->controlledPortAction); + CsrMemCpySer(ptr, len, (const void *) primitive->macAddress.a, ((CsrUint16) (6))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->setProtection); + return(ptr); +} + + +void* CsrWifiRouterCtrlPortConfigureReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlPortConfigureReq *primitive = (CsrWifiRouterCtrlPortConfigureReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPortConfigureReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->uncontrolledPortAction, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->controlledPortAction, buffer, &offset); + CsrMemCpyDes(primitive->macAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint8Des((CsrUint8 *) &primitive->setProtection, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlQosControlReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrWifiRouterCtrlQoSControl primitive->control */ + bufferSize += 1; /* CsrWifiRouterCtrlQueueConfigMask primitive->queueConfig */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlQosControlReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlQosControlReq *primitive = (CsrWifiRouterCtrlQosControlReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->control); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->queueConfig); + return(ptr); +} + + +void* CsrWifiRouterCtrlQosControlReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlQosControlReq *primitive = (CsrWifiRouterCtrlQosControlReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlQosControlReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->control, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->queueConfig, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlSuspendResSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlSuspendResSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlSuspendRes *primitive = (CsrWifiRouterCtrlSuspendRes *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiRouterCtrlSuspendResDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlSuspendRes *primitive = (CsrWifiRouterCtrlSuspendRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlSuspendRes)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlTclasAddReqSizeof(void *msg) +{ + CsrWifiRouterCtrlTclasAddReq *primitive = (CsrWifiRouterCtrlTclasAddReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->tclasLength */ + bufferSize += primitive->tclasLength; /* CsrUint8 primitive->tclas */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlTclasAddReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlTclasAddReq *primitive = (CsrWifiRouterCtrlTclasAddReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->tclasLength); + if (primitive->tclasLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->tclas, ((CsrUint16) (primitive->tclasLength))); + } + return(ptr); +} + + +void* CsrWifiRouterCtrlTclasAddReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlTclasAddReq *primitive = (CsrWifiRouterCtrlTclasAddReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasAddReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->tclasLength, buffer, &offset); + if (primitive->tclasLength) + { + primitive->tclas = (CsrUint8 *)CsrPmemAlloc(primitive->tclasLength); + CsrMemCpyDes(primitive->tclas, buffer, &offset, ((CsrUint16) (primitive->tclasLength))); + } + else + { + primitive->tclas = NULL; + } + + return primitive; +} + + +void CsrWifiRouterCtrlTclasAddReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiRouterCtrlTclasAddReq *primitive = (CsrWifiRouterCtrlTclasAddReq *) voidPrimitivePointer; + CsrPmemFree(primitive->tclas); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiRouterCtrlResumeResSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlResumeResSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlResumeRes *primitive = (CsrWifiRouterCtrlResumeRes *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiRouterCtrlResumeResDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlResumeRes *primitive = (CsrWifiRouterCtrlResumeRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlResumeRes)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlTclasDelReqSizeof(void *msg) +{ + CsrWifiRouterCtrlTclasDelReq *primitive = (CsrWifiRouterCtrlTclasDelReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->tclasLength */ + bufferSize += primitive->tclasLength; /* CsrUint8 primitive->tclas */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlTclasDelReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlTclasDelReq *primitive = (CsrWifiRouterCtrlTclasDelReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->tclasLength); + if (primitive->tclasLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->tclas, ((CsrUint16) (primitive->tclasLength))); + } + return(ptr); +} + + +void* CsrWifiRouterCtrlTclasDelReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlTclasDelReq *primitive = (CsrWifiRouterCtrlTclasDelReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasDelReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->tclasLength, buffer, &offset); + if (primitive->tclasLength) + { + primitive->tclas = (CsrUint8 *)CsrPmemAlloc(primitive->tclasLength); + CsrMemCpyDes(primitive->tclas, buffer, &offset, ((CsrUint16) (primitive->tclasLength))); + } + else + { + primitive->tclas = NULL; + } + + return primitive; +} + + +void CsrWifiRouterCtrlTclasDelReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiRouterCtrlTclasDelReq *primitive = (CsrWifiRouterCtrlTclasDelReq *) voidPrimitivePointer; + CsrPmemFree(primitive->tclas); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiRouterCtrlTrafficClassificationReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 1; /* CsrWifiRouterCtrlTrafficType primitive->trafficType */ + bufferSize += 2; /* CsrUint16 primitive->period */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlTrafficClassificationReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlTrafficClassificationReq *primitive = (CsrWifiRouterCtrlTrafficClassificationReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->trafficType); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->period); + return(ptr); +} + + +void* CsrWifiRouterCtrlTrafficClassificationReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlTrafficClassificationReq *primitive = (CsrWifiRouterCtrlTrafficClassificationReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficClassificationReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->trafficType, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->period, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlTrafficConfigReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 24) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrWifiRouterCtrlTrafficConfigType primitive->trafficConfigType */ + bufferSize += 2; /* CsrUint16 primitive->config.packetFilter */ + bufferSize += 4; /* CsrUint32 primitive->config.customFilter.etherType */ + bufferSize += 1; /* CsrUint8 primitive->config.customFilter.ipType */ + bufferSize += 4; /* CsrUint32 primitive->config.customFilter.udpSourcePort */ + bufferSize += 4; /* CsrUint32 primitive->config.customFilter.udpDestPort */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlTrafficConfigReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlTrafficConfigReq *primitive = (CsrWifiRouterCtrlTrafficConfigReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->trafficConfigType); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->config.packetFilter); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->config.customFilter.etherType); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->config.customFilter.ipType); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->config.customFilter.udpSourcePort); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->config.customFilter.udpDestPort); + return(ptr); +} + + +void* CsrWifiRouterCtrlTrafficConfigReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlTrafficConfigReq *primitive = (CsrWifiRouterCtrlTrafficConfigReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficConfigReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->trafficConfigType, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->config.packetFilter, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->config.customFilter.etherType, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->config.customFilter.ipType, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->config.customFilter.udpSourcePort, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->config.customFilter.udpDestPort, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlWifiOnResSizeof(void *msg) +{ + CsrWifiRouterCtrlWifiOnRes *primitive = (CsrWifiRouterCtrlWifiOnRes *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 30) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 2; /* CsrUint16 primitive->numInterfaceAddress */ + { + CsrUint16 i1; + for (i1 = 0; i1 < 2; i1++) + { + bufferSize += 6; /* CsrUint8 primitive->stationMacAddress[i1].a[6] */ + } + } + bufferSize += 4; /* CsrUint32 primitive->smeVersions.firmwarePatch */ + bufferSize += (primitive->smeVersions.smeBuild?CsrStrLen(primitive->smeVersions.smeBuild) : 0) + 1; /* CsrCharString* primitive->smeVersions.smeBuild (0 byte len + 1 for NULL Term) */ + bufferSize += 4; /* CsrUint32 primitive->smeVersions.smeHip */ + bufferSize += 1; /* CsrBool primitive->scheduledInterrupt */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlWifiOnResSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlWifiOnRes *primitive = (CsrWifiRouterCtrlWifiOnRes *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->numInterfaceAddress); + { + CsrUint16 i1; + for (i1 = 0; i1 < 2; i1++) + { + CsrMemCpySer(ptr, len, (const void *) primitive->stationMacAddress[i1].a, ((CsrUint16) (6))); + } + } + CsrUint32Ser(ptr, len, (CsrUint32) primitive->smeVersions.firmwarePatch); + CsrCharStringSer(ptr, len, primitive->smeVersions.smeBuild); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->smeVersions.smeHip); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scheduledInterrupt); + return(ptr); +} + + +void* CsrWifiRouterCtrlWifiOnResDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlWifiOnRes *primitive = (CsrWifiRouterCtrlWifiOnRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnRes)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->numInterfaceAddress, buffer, &offset); + { + CsrUint16 i1; + for (i1 = 0; i1 < 2; i1++) + { + CsrMemCpyDes(primitive->stationMacAddress[i1].a, buffer, &offset, ((CsrUint16) (6))); + } + } + CsrUint32Des((CsrUint32 *) &primitive->smeVersions.firmwarePatch, buffer, &offset); + CsrCharStringDes(&primitive->smeVersions.smeBuild, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->smeVersions.smeHip, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->scheduledInterrupt, buffer, &offset); + + return primitive; +} + + +void CsrWifiRouterCtrlWifiOnResSerFree(void *voidPrimitivePointer) +{ + CsrWifiRouterCtrlWifiOnRes *primitive = (CsrWifiRouterCtrlWifiOnRes *) voidPrimitivePointer; + CsrPmemFree(primitive->smeVersions.smeBuild); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiRouterCtrlM4TransmitReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlM4TransmitReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlM4TransmitReq *primitive = (CsrWifiRouterCtrlM4TransmitReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + return(ptr); +} + + +void* CsrWifiRouterCtrlM4TransmitReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlM4TransmitReq *primitive = (CsrWifiRouterCtrlM4TransmitReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlM4TransmitReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlModeSetReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 16) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 1; /* CsrWifiRouterCtrlMode primitive->mode */ + bufferSize += 6; /* CsrUint8 primitive->bssid.a[6] */ + bufferSize += 1; /* CsrBool primitive->protection */ + bufferSize += 1; /* CsrBool primitive->intraBssDistEnabled */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlModeSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlModeSetReq *primitive = (CsrWifiRouterCtrlModeSetReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->mode); + CsrMemCpySer(ptr, len, (const void *) primitive->bssid.a, ((CsrUint16) (6))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->protection); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->intraBssDistEnabled); + return(ptr); +} + + +void* CsrWifiRouterCtrlModeSetReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlModeSetReq *primitive = (CsrWifiRouterCtrlModeSetReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlModeSetReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->mode, buffer, &offset); + CsrMemCpyDes(primitive->bssid.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint8Des((CsrUint8 *) &primitive->protection, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->intraBssDistEnabled, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlPeerAddReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 21) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 6; /* CsrUint8 primitive->peerMacAddress.a[6] */ + bufferSize += 2; /* CsrUint16 primitive->associationId */ + bufferSize += 1; /* CsrBool primitive->staInfo.wmmOrQosEnabled */ + bufferSize += 2; /* CsrWifiRouterCtrlPowersaveTypeMask primitive->staInfo.powersaveMode */ + bufferSize += 1; /* CsrUint8 primitive->staInfo.maxSpLength */ + bufferSize += 2; /* CsrUint16 primitive->staInfo.listenIntervalInTus */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlPeerAddReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlPeerAddReq *primitive = (CsrWifiRouterCtrlPeerAddReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->associationId); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->staInfo.wmmOrQosEnabled); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->staInfo.powersaveMode); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->staInfo.maxSpLength); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->staInfo.listenIntervalInTus); + return(ptr); +} + + +void* CsrWifiRouterCtrlPeerAddReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlPeerAddReq *primitive = (CsrWifiRouterCtrlPeerAddReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerAddReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((CsrUint16 *) &primitive->associationId, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->staInfo.wmmOrQosEnabled, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->staInfo.powersaveMode, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->staInfo.maxSpLength, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->staInfo.listenIntervalInTus, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlPeerDelReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 4; /* CsrWifiRouterCtrlPeerRecordHandle primitive->peerRecordHandle */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlPeerDelReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlPeerDelReq *primitive = (CsrWifiRouterCtrlPeerDelReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->peerRecordHandle); + return(ptr); +} + + +void* CsrWifiRouterCtrlPeerDelReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlPeerDelReq *primitive = (CsrWifiRouterCtrlPeerDelReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerDelReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->peerRecordHandle, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlPeerUpdateReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 4; /* CsrWifiRouterCtrlPeerRecordHandle primitive->peerRecordHandle */ + bufferSize += 2; /* CsrWifiRouterCtrlPowersaveTypeMask primitive->powersaveMode */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlPeerUpdateReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlPeerUpdateReq *primitive = (CsrWifiRouterCtrlPeerUpdateReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->peerRecordHandle); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->powersaveMode); + return(ptr); +} + + +void* CsrWifiRouterCtrlPeerUpdateReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlPeerUpdateReq *primitive = (CsrWifiRouterCtrlPeerUpdateReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerUpdateReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->peerRecordHandle, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->powersaveMode, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlBlockAckEnableReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 21) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 6; /* CsrUint8 primitive->macAddress.a[6] */ + bufferSize += 1; /* CsrWifiRouterCtrlTrafficStreamId primitive->trafficStreamID */ + bufferSize += 1; /* CsrWifiRouterCtrlBlockAckRole primitive->role */ + bufferSize += 2; /* CsrUint16 primitive->bufferSize */ + bufferSize += 2; /* CsrUint16 primitive->timeout */ + bufferSize += 2; /* CsrUint16 primitive->ssn */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlBlockAckEnableReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlBlockAckEnableReq *primitive = (CsrWifiRouterCtrlBlockAckEnableReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrMemCpySer(ptr, len, (const void *) primitive->macAddress.a, ((CsrUint16) (6))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->trafficStreamID); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->role); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->bufferSize); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->timeout); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->ssn); + return(ptr); +} + + +void* CsrWifiRouterCtrlBlockAckEnableReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlBlockAckEnableReq *primitive = (CsrWifiRouterCtrlBlockAckEnableReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckEnableReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrMemCpyDes(primitive->macAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint8Des((CsrUint8 *) &primitive->trafficStreamID, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->role, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->bufferSize, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->timeout, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->ssn, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlBlockAckDisableReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 6; /* CsrUint8 primitive->macAddress.a[6] */ + bufferSize += 1; /* CsrWifiRouterCtrlTrafficStreamId primitive->trafficStreamID */ + bufferSize += 1; /* CsrWifiRouterCtrlBlockAckRole primitive->role */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlBlockAckDisableReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlBlockAckDisableReq *primitive = (CsrWifiRouterCtrlBlockAckDisableReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrMemCpySer(ptr, len, (const void *) primitive->macAddress.a, ((CsrUint16) (6))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->trafficStreamID); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->role); + return(ptr); +} + + +void* CsrWifiRouterCtrlBlockAckDisableReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlBlockAckDisableReq *primitive = (CsrWifiRouterCtrlBlockAckDisableReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckDisableReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrMemCpyDes(primitive->macAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint8Des((CsrUint8 *) &primitive->trafficStreamID, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->role, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlWapiMulticastReqSizeof(void *msg) +{ + CsrWifiRouterCtrlWapiMulticastReq *primitive = (CsrWifiRouterCtrlWapiMulticastReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ + bufferSize += 2; /* CsrUint16 primitive->signalLength */ + bufferSize += primitive->signalLength; /* CsrUint8 primitive->signal */ + bufferSize += 2; /* CsrUint16 primitive->dataLength */ + bufferSize += primitive->dataLength; /* CsrUint8 primitive->data */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlWapiMulticastReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlWapiMulticastReq *primitive = (CsrWifiRouterCtrlWapiMulticastReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->signalLength); + if (primitive->signalLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->signal, ((CsrUint16) (primitive->signalLength))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->dataLength); + if (primitive->dataLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->data, ((CsrUint16) (primitive->dataLength))); + } + return(ptr); +} + + +void* CsrWifiRouterCtrlWapiMulticastReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlWapiMulticastReq *primitive = (CsrWifiRouterCtrlWapiMulticastReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiMulticastReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->signalLength, buffer, &offset); + if (primitive->signalLength) + { + primitive->signal = (CsrUint8 *)CsrPmemAlloc(primitive->signalLength); + CsrMemCpyDes(primitive->signal, buffer, &offset, ((CsrUint16) (primitive->signalLength))); + } + else + { + primitive->signal = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->dataLength, buffer, &offset); + if (primitive->dataLength) + { + primitive->data = (CsrUint8 *)CsrPmemAlloc(primitive->dataLength); + CsrMemCpyDes(primitive->data, buffer, &offset, ((CsrUint16) (primitive->dataLength))); + } + else + { + primitive->data = NULL; + } + + return primitive; +} + + +void CsrWifiRouterCtrlWapiMulticastReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiRouterCtrlWapiMulticastReq *primitive = (CsrWifiRouterCtrlWapiMulticastReq *) voidPrimitivePointer; + CsrPmemFree(primitive->signal); + CsrPmemFree(primitive->data); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiRouterCtrlHipIndSizeof(void *msg) +{ + CsrWifiRouterCtrlHipInd *primitive = (CsrWifiRouterCtrlHipInd *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */ + bufferSize += 2; /* CsrUint16 primitive->mlmeCommandLength */ + bufferSize += primitive->mlmeCommandLength; /* CsrUint8 primitive->mlmeCommand */ + bufferSize += 2; /* CsrUint16 primitive->dataRef1Length */ + bufferSize += primitive->dataRef1Length; /* CsrUint8 primitive->dataRef1 */ + bufferSize += 2; /* CsrUint16 primitive->dataRef2Length */ + bufferSize += primitive->dataRef2Length; /* CsrUint8 primitive->dataRef2 */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlHipIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlHipInd *primitive = (CsrWifiRouterCtrlHipInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->mlmeCommandLength); + if (primitive->mlmeCommandLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->mlmeCommand, ((CsrUint16) (primitive->mlmeCommandLength))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->dataRef1Length); + if (primitive->dataRef1Length) + { + CsrMemCpySer(ptr, len, (const void *) primitive->dataRef1, ((CsrUint16) (primitive->dataRef1Length))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->dataRef2Length); + if (primitive->dataRef2Length) + { + CsrMemCpySer(ptr, len, (const void *) primitive->dataRef2, ((CsrUint16) (primitive->dataRef2Length))); + } + return(ptr); +} + + +void* CsrWifiRouterCtrlHipIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlHipInd *primitive = (CsrWifiRouterCtrlHipInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlHipInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->mlmeCommandLength, buffer, &offset); + if (primitive->mlmeCommandLength) + { + primitive->mlmeCommand = (CsrUint8 *)CsrPmemAlloc(primitive->mlmeCommandLength); + CsrMemCpyDes(primitive->mlmeCommand, buffer, &offset, ((CsrUint16) (primitive->mlmeCommandLength))); + } + else + { + primitive->mlmeCommand = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->dataRef1Length, buffer, &offset); + if (primitive->dataRef1Length) + { + primitive->dataRef1 = (CsrUint8 *)CsrPmemAlloc(primitive->dataRef1Length); + CsrMemCpyDes(primitive->dataRef1, buffer, &offset, ((CsrUint16) (primitive->dataRef1Length))); + } + else + { + primitive->dataRef1 = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->dataRef2Length, buffer, &offset); + if (primitive->dataRef2Length) + { + primitive->dataRef2 = (CsrUint8 *)CsrPmemAlloc(primitive->dataRef2Length); + CsrMemCpyDes(primitive->dataRef2, buffer, &offset, ((CsrUint16) (primitive->dataRef2Length))); + } + else + { + primitive->dataRef2 = NULL; + } + + return primitive; +} + + +void CsrWifiRouterCtrlHipIndSerFree(void *voidPrimitivePointer) +{ + CsrWifiRouterCtrlHipInd *primitive = (CsrWifiRouterCtrlHipInd *) voidPrimitivePointer; + CsrPmemFree(primitive->mlmeCommand); + CsrPmemFree(primitive->dataRef1); + CsrPmemFree(primitive->dataRef2); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiRouterCtrlMulticastAddressIndSizeof(void *msg) +{ + CsrWifiRouterCtrlMulticastAddressInd *primitive = (CsrWifiRouterCtrlMulticastAddressInd *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 1; /* CsrWifiRouterCtrlListAction primitive->action */ + bufferSize += 1; /* CsrUint8 primitive->setAddressesCount */ + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->setAddressesCount; i1++) + { + bufferSize += 6; /* CsrUint8 primitive->setAddresses[i1].a[6] */ + } + } + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlMulticastAddressIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlMulticastAddressInd *primitive = (CsrWifiRouterCtrlMulticastAddressInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->action); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->setAddressesCount); + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->setAddressesCount; i1++) + { + CsrMemCpySer(ptr, len, (const void *) primitive->setAddresses[i1].a, ((CsrUint16) (6))); + } + } + return(ptr); +} + + +void* CsrWifiRouterCtrlMulticastAddressIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlMulticastAddressInd *primitive = (CsrWifiRouterCtrlMulticastAddressInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMulticastAddressInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->action, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->setAddressesCount, buffer, &offset); + primitive->setAddresses = NULL; + if (primitive->setAddressesCount) + { + primitive->setAddresses = (CsrWifiMacAddress *)CsrPmemAlloc(sizeof(CsrWifiMacAddress) * primitive->setAddressesCount); + } + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->setAddressesCount; i1++) + { + CsrMemCpyDes(primitive->setAddresses[i1].a, buffer, &offset, ((CsrUint16) (6))); + } + } + + return primitive; +} + + +void CsrWifiRouterCtrlMulticastAddressIndSerFree(void *voidPrimitivePointer) +{ + CsrWifiRouterCtrlMulticastAddressInd *primitive = (CsrWifiRouterCtrlMulticastAddressInd *) voidPrimitivePointer; + CsrPmemFree(primitive->setAddresses); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiRouterCtrlPortConfigureCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 6; /* CsrUint8 primitive->macAddress.a[6] */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlPortConfigureCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlPortConfigureCfm *primitive = (CsrWifiRouterCtrlPortConfigureCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrMemCpySer(ptr, len, (const void *) primitive->macAddress.a, ((CsrUint16) (6))); + return(ptr); +} + + +void* CsrWifiRouterCtrlPortConfigureCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlPortConfigureCfm *primitive = (CsrWifiRouterCtrlPortConfigureCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPortConfigureCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrMemCpyDes(primitive->macAddress.a, buffer, &offset, ((CsrUint16) (6))); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlSuspendIndSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 1; /* CsrBool primitive->hardSuspend */ + bufferSize += 1; /* CsrBool primitive->d3Suspend */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlSuspendIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlSuspendInd *primitive = (CsrWifiRouterCtrlSuspendInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->hardSuspend); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->d3Suspend); + return(ptr); +} + + +void* CsrWifiRouterCtrlSuspendIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlSuspendInd *primitive = (CsrWifiRouterCtrlSuspendInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlSuspendInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->hardSuspend, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->d3Suspend, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlTclasAddCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlTclasAddCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlTclasAddCfm *primitive = (CsrWifiRouterCtrlTclasAddCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiRouterCtrlTclasAddCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlTclasAddCfm *primitive = (CsrWifiRouterCtrlTclasAddCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasAddCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlRawSdioDeinitialiseCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrResult primitive->result */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlRawSdioDeinitialiseCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlRawSdioDeinitialiseCfm *primitive = (CsrWifiRouterCtrlRawSdioDeinitialiseCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->result); + return(ptr); +} + + +void* CsrWifiRouterCtrlRawSdioDeinitialiseCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlRawSdioDeinitialiseCfm *primitive = (CsrWifiRouterCtrlRawSdioDeinitialiseCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlRawSdioDeinitialiseCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->result, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlRawSdioInitialiseCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 39) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrResult primitive->result */ + bufferSize += 4; /* CsrWifiRouterCtrlRawSdioByteRead primitive->byteRead */ + bufferSize += 4; /* CsrWifiRouterCtrlRawSdioByteWrite primitive->byteWrite */ + bufferSize += 4; /* CsrWifiRouterCtrlRawSdioFirmwareDownload primitive->firmwareDownload */ + bufferSize += 4; /* CsrWifiRouterCtrlRawSdioReset primitive->reset */ + bufferSize += 4; /* CsrWifiRouterCtrlRawSdioCoreDumpPrepare primitive->coreDumpPrepare */ + bufferSize += 4; /* CsrWifiRouterCtrlRawSdioByteBlockRead primitive->byteBlockRead */ + bufferSize += 4; /* CsrWifiRouterCtrlRawSdioGpRead16 primitive->gpRead16 */ + bufferSize += 4; /* CsrWifiRouterCtrlRawSdioGpWrite16 primitive->gpWrite16 */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlRawSdioInitialiseCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlRawSdioInitialiseCfm *primitive = (CsrWifiRouterCtrlRawSdioInitialiseCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->result); + CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->byteRead */ + CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->byteWrite */ + CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->firmwareDownload */ + CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->reset */ + CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->coreDumpPrepare */ + CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->byteBlockRead */ + CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->gpRead16 */ + CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->gpWrite16 */ + return(ptr); +} + + +void* CsrWifiRouterCtrlRawSdioInitialiseCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlRawSdioInitialiseCfm *primitive = (CsrWifiRouterCtrlRawSdioInitialiseCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlRawSdioInitialiseCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->result, buffer, &offset); + primitive->byteRead = NULL; /* Special for Function Pointers... */ + offset += 4; + primitive->byteWrite = NULL; /* Special for Function Pointers... */ + offset += 4; + primitive->firmwareDownload = NULL; /* Special for Function Pointers... */ + offset += 4; + primitive->reset = NULL; /* Special for Function Pointers... */ + offset += 4; + primitive->coreDumpPrepare = NULL; /* Special for Function Pointers... */ + offset += 4; + primitive->byteBlockRead = NULL; /* Special for Function Pointers... */ + offset += 4; + primitive->gpRead16 = NULL; /* Special for Function Pointers... */ + offset += 4; + primitive->gpWrite16 = NULL; /* Special for Function Pointers... */ + offset += 4; + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlTclasDelCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlTclasDelCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlTclasDelCfm *primitive = (CsrWifiRouterCtrlTclasDelCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiRouterCtrlTclasDelCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlTclasDelCfm *primitive = (CsrWifiRouterCtrlTclasDelCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasDelCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlTrafficProtocolIndSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrWifiRouterCtrlTrafficPacketType primitive->packetType */ + bufferSize += 2; /* CsrWifiRouterCtrlProtocolDirection primitive->direction */ + bufferSize += 6; /* CsrUint8 primitive->srcAddress.a[6] */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlTrafficProtocolIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlTrafficProtocolInd *primitive = (CsrWifiRouterCtrlTrafficProtocolInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->packetType); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->direction); + CsrMemCpySer(ptr, len, (const void *) primitive->srcAddress.a, ((CsrUint16) (6))); + return(ptr); +} + + +void* CsrWifiRouterCtrlTrafficProtocolIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlTrafficProtocolInd *primitive = (CsrWifiRouterCtrlTrafficProtocolInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficProtocolInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->packetType, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->direction, buffer, &offset); + CsrMemCpyDes(primitive->srcAddress.a, buffer, &offset, ((CsrUint16) (6))); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlTrafficSampleIndSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 38) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 4; /* CsrUint32 primitive->stats.rxMeanRate */ + bufferSize += 4; /* CsrUint32 primitive->stats.rxFramesNum */ + bufferSize += 4; /* CsrUint32 primitive->stats.txFramesNum */ + bufferSize += 4; /* CsrUint32 primitive->stats.rxBytesCount */ + bufferSize += 4; /* CsrUint32 primitive->stats.txBytesCount */ + bufferSize += 11; /* CsrUint8 primitive->stats.intervals[11] */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlTrafficSampleIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlTrafficSampleInd *primitive = (CsrWifiRouterCtrlTrafficSampleInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->stats.rxMeanRate); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->stats.rxFramesNum); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->stats.txFramesNum); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->stats.rxBytesCount); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->stats.txBytesCount); + CsrMemCpySer(ptr, len, (const void *) primitive->stats.intervals, ((CsrUint16) (11))); + return(ptr); +} + + +void* CsrWifiRouterCtrlTrafficSampleIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlTrafficSampleInd *primitive = (CsrWifiRouterCtrlTrafficSampleInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficSampleInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->stats.rxMeanRate, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->stats.rxFramesNum, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->stats.txFramesNum, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->stats.rxBytesCount, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->stats.txBytesCount, buffer, &offset); + CsrMemCpyDes(primitive->stats.intervals, buffer, &offset, ((CsrUint16) (11))); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlWifiOnIndSizeof(void *msg) +{ + CsrWifiRouterCtrlWifiOnInd *primitive = (CsrWifiRouterCtrlWifiOnInd *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 27) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 4; /* CsrUint32 primitive->versions.chipId */ + bufferSize += 4; /* CsrUint32 primitive->versions.chipVersion */ + bufferSize += 4; /* CsrUint32 primitive->versions.firmwareBuild */ + bufferSize += 4; /* CsrUint32 primitive->versions.firmwareHip */ + bufferSize += (primitive->versions.routerBuild?CsrStrLen(primitive->versions.routerBuild) : 0) + 1; /* CsrCharString* primitive->versions.routerBuild (0 byte len + 1 for NULL Term) */ + bufferSize += 4; /* CsrUint32 primitive->versions.routerHip */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlWifiOnIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlWifiOnInd *primitive = (CsrWifiRouterCtrlWifiOnInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.chipId); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.chipVersion); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.firmwareBuild); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.firmwareHip); + CsrCharStringSer(ptr, len, primitive->versions.routerBuild); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.routerHip); + return(ptr); +} + + +void* CsrWifiRouterCtrlWifiOnIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlWifiOnInd *primitive = (CsrWifiRouterCtrlWifiOnInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->versions.chipId, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->versions.chipVersion, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->versions.firmwareBuild, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->versions.firmwareHip, buffer, &offset); + CsrCharStringDes(&primitive->versions.routerBuild, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->versions.routerHip, buffer, &offset); + + return primitive; +} + + +void CsrWifiRouterCtrlWifiOnIndSerFree(void *voidPrimitivePointer) +{ + CsrWifiRouterCtrlWifiOnInd *primitive = (CsrWifiRouterCtrlWifiOnInd *) voidPrimitivePointer; + CsrPmemFree(primitive->versions.routerBuild); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiRouterCtrlWifiOnCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlWifiOnCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlWifiOnCfm *primitive = (CsrWifiRouterCtrlWifiOnCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiRouterCtrlWifiOnCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlWifiOnCfm *primitive = (CsrWifiRouterCtrlWifiOnCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlM4ReadyToSendIndSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 6; /* CsrUint8 primitive->peerMacAddress.a[6] */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlM4ReadyToSendIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlM4ReadyToSendInd *primitive = (CsrWifiRouterCtrlM4ReadyToSendInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); + return(ptr); +} + + +void* CsrWifiRouterCtrlM4ReadyToSendIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlM4ReadyToSendInd *primitive = (CsrWifiRouterCtrlM4ReadyToSendInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlM4ReadyToSendInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlM4TransmittedIndSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 6; /* CsrUint8 primitive->peerMacAddress.a[6] */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlM4TransmittedIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlM4TransmittedInd *primitive = (CsrWifiRouterCtrlM4TransmittedInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiRouterCtrlM4TransmittedIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlM4TransmittedInd *primitive = (CsrWifiRouterCtrlM4TransmittedInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlM4TransmittedInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlMicFailureIndSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 6; /* CsrUint8 primitive->peerMacAddress.a[6] */ + bufferSize += 1; /* CsrBool primitive->unicastPdu */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlMicFailureIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlMicFailureInd *primitive = (CsrWifiRouterCtrlMicFailureInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->unicastPdu); + return(ptr); +} + + +void* CsrWifiRouterCtrlMicFailureIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlMicFailureInd *primitive = (CsrWifiRouterCtrlMicFailureInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMicFailureInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint8Des((CsrUint8 *) &primitive->unicastPdu, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlConnectedIndSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 6; /* CsrUint8 primitive->peerMacAddress.a[6] */ + bufferSize += 1; /* CsrWifiRouterCtrlPeerStatus primitive->peerStatus */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlConnectedIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlConnectedInd *primitive = (CsrWifiRouterCtrlConnectedInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->peerStatus); + return(ptr); +} + + +void* CsrWifiRouterCtrlConnectedIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlConnectedInd *primitive = (CsrWifiRouterCtrlConnectedInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlConnectedInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint8Des((CsrUint8 *) &primitive->peerStatus, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlPeerAddCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 19) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 6; /* CsrUint8 primitive->peerMacAddress.a[6] */ + bufferSize += 4; /* CsrWifiRouterCtrlPeerRecordHandle primitive->peerRecordHandle */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlPeerAddCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlPeerAddCfm *primitive = (CsrWifiRouterCtrlPeerAddCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->peerRecordHandle); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiRouterCtrlPeerAddCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlPeerAddCfm *primitive = (CsrWifiRouterCtrlPeerAddCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerAddCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint32Des((CsrUint32 *) &primitive->peerRecordHandle, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlPeerDelCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlPeerDelCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlPeerDelCfm *primitive = (CsrWifiRouterCtrlPeerDelCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiRouterCtrlPeerDelCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlPeerDelCfm *primitive = (CsrWifiRouterCtrlPeerDelCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerDelCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlUnexpectedFrameIndSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 6; /* CsrUint8 primitive->peerMacAddress.a[6] */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlUnexpectedFrameIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlUnexpectedFrameInd *primitive = (CsrWifiRouterCtrlUnexpectedFrameInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); + return(ptr); +} + + +void* CsrWifiRouterCtrlUnexpectedFrameIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlUnexpectedFrameInd *primitive = (CsrWifiRouterCtrlUnexpectedFrameInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlUnexpectedFrameInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlPeerUpdateCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlPeerUpdateCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlPeerUpdateCfm *primitive = (CsrWifiRouterCtrlPeerUpdateCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiRouterCtrlPeerUpdateCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlPeerUpdateCfm *primitive = (CsrWifiRouterCtrlPeerUpdateCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerUpdateCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlCapabilitiesCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->commandQueueSize */ + bufferSize += 2; /* CsrUint16 primitive->trafficQueueSize */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlCapabilitiesCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlCapabilitiesCfm *primitive = (CsrWifiRouterCtrlCapabilitiesCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->commandQueueSize); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->trafficQueueSize); + return(ptr); +} + + +void* CsrWifiRouterCtrlCapabilitiesCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlCapabilitiesCfm *primitive = (CsrWifiRouterCtrlCapabilitiesCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlCapabilitiesCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->commandQueueSize, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->trafficQueueSize, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlBlockAckEnableCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlBlockAckEnableCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlBlockAckEnableCfm *primitive = (CsrWifiRouterCtrlBlockAckEnableCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiRouterCtrlBlockAckEnableCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlBlockAckEnableCfm *primitive = (CsrWifiRouterCtrlBlockAckEnableCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckEnableCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlBlockAckDisableCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlBlockAckDisableCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlBlockAckDisableCfm *primitive = (CsrWifiRouterCtrlBlockAckDisableCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiRouterCtrlBlockAckDisableCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlBlockAckDisableCfm *primitive = (CsrWifiRouterCtrlBlockAckDisableCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckDisableCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlBlockAckErrorIndSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 16) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 1; /* CsrWifiRouterCtrlTrafficStreamId primitive->trafficStreamID */ + bufferSize += 6; /* CsrUint8 primitive->peerMacAddress.a[6] */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlBlockAckErrorIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlBlockAckErrorInd *primitive = (CsrWifiRouterCtrlBlockAckErrorInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->trafficStreamID); + CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiRouterCtrlBlockAckErrorIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlBlockAckErrorInd *primitive = (CsrWifiRouterCtrlBlockAckErrorInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckErrorInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->trafficStreamID, buffer, &offset); + CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlStaInactiveIndSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 6; /* CsrUint8 primitive->staAddress.a[6] */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlStaInactiveIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlStaInactiveInd *primitive = (CsrWifiRouterCtrlStaInactiveInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrMemCpySer(ptr, len, (const void *) primitive->staAddress.a, ((CsrUint16) (6))); + return(ptr); +} + + +void* CsrWifiRouterCtrlStaInactiveIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlStaInactiveInd *primitive = (CsrWifiRouterCtrlStaInactiveInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlStaInactiveInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrMemCpyDes(primitive->staAddress.a, buffer, &offset, ((CsrUint16) (6))); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlWapiMulticastIndSizeof(void *msg) +{ + CsrWifiRouterCtrlWapiMulticastInd *primitive = (CsrWifiRouterCtrlWapiMulticastInd *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrUint16 primitive->signalLength */ + bufferSize += primitive->signalLength; /* CsrUint8 primitive->signal */ + bufferSize += 2; /* CsrUint16 primitive->dataLength */ + bufferSize += primitive->dataLength; /* CsrUint8 primitive->data */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlWapiMulticastIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlWapiMulticastInd *primitive = (CsrWifiRouterCtrlWapiMulticastInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->signalLength); + if (primitive->signalLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->signal, ((CsrUint16) (primitive->signalLength))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->dataLength); + if (primitive->dataLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->data, ((CsrUint16) (primitive->dataLength))); + } + return(ptr); +} + + +void* CsrWifiRouterCtrlWapiMulticastIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlWapiMulticastInd *primitive = (CsrWifiRouterCtrlWapiMulticastInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiMulticastInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->signalLength, buffer, &offset); + if (primitive->signalLength) + { + primitive->signal = (CsrUint8 *)CsrPmemAlloc(primitive->signalLength); + CsrMemCpyDes(primitive->signal, buffer, &offset, ((CsrUint16) (primitive->signalLength))); + } + else + { + primitive->signal = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->dataLength, buffer, &offset); + if (primitive->dataLength) + { + primitive->data = (CsrUint8 *)CsrPmemAlloc(primitive->dataLength); + CsrMemCpyDes(primitive->data, buffer, &offset, ((CsrUint16) (primitive->dataLength))); + } + else + { + primitive->data = NULL; + } + + return primitive; +} + + +void CsrWifiRouterCtrlWapiMulticastIndSerFree(void *voidPrimitivePointer) +{ + CsrWifiRouterCtrlWapiMulticastInd *primitive = (CsrWifiRouterCtrlWapiMulticastInd *) voidPrimitivePointer; + CsrPmemFree(primitive->signal); + CsrPmemFree(primitive->data); + CsrPmemFree(primitive); +} + + diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h new file mode 100644 index 0000000..5d82f8d --- /dev/null +++ b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h @@ -0,0 +1,323 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_ROUTER_CTRL_SERIALIZE_H__ +#define CSR_WIFI_ROUTER_CTRL_SERIALIZE_H__ + +#include "csr_types.h" +#include "csr_pmem.h" +#include "csr_wifi_msgconv.h" + +#include "csr_wifi_router_ctrl_prim.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern void CsrWifiRouterCtrlPfree(void *ptr); + +extern CsrUint8* CsrWifiRouterCtrlConfigurePowerModeReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlConfigurePowerModeReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlConfigurePowerModeReqSizeof(void *msg); +#define CsrWifiRouterCtrlConfigurePowerModeReqSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlHipReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlHipReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlHipReqSizeof(void *msg); +extern void CsrWifiRouterCtrlHipReqSerFree(void *msg); + +extern CsrUint8* CsrWifiRouterCtrlMediaStatusReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlMediaStatusReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlMediaStatusReqSizeof(void *msg); +#define CsrWifiRouterCtrlMediaStatusReqSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlMulticastAddressResSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlMulticastAddressResDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlMulticastAddressResSizeof(void *msg); +extern void CsrWifiRouterCtrlMulticastAddressResSerFree(void *msg); + +extern CsrUint8* CsrWifiRouterCtrlPortConfigureReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlPortConfigureReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlPortConfigureReqSizeof(void *msg); +#define CsrWifiRouterCtrlPortConfigureReqSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlQosControlReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlQosControlReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlQosControlReqSizeof(void *msg); +#define CsrWifiRouterCtrlQosControlReqSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlSuspendResSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlSuspendResDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlSuspendResSizeof(void *msg); +#define CsrWifiRouterCtrlSuspendResSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlTclasAddReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlTclasAddReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlTclasAddReqSizeof(void *msg); +extern void CsrWifiRouterCtrlTclasAddReqSerFree(void *msg); + +extern CsrUint8* CsrWifiRouterCtrlResumeResSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlResumeResDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlResumeResSizeof(void *msg); +#define CsrWifiRouterCtrlResumeResSerFree CsrWifiRouterCtrlPfree + +#define CsrWifiRouterCtrlRawSdioDeinitialiseReqSer CsrWifiEventCsrUint16Ser +#define CsrWifiRouterCtrlRawSdioDeinitialiseReqDes CsrWifiEventCsrUint16Des +#define CsrWifiRouterCtrlRawSdioDeinitialiseReqSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiRouterCtrlRawSdioDeinitialiseReqSerFree CsrWifiRouterCtrlPfree + +#define CsrWifiRouterCtrlRawSdioInitialiseReqSer CsrWifiEventCsrUint16Ser +#define CsrWifiRouterCtrlRawSdioInitialiseReqDes CsrWifiEventCsrUint16Des +#define CsrWifiRouterCtrlRawSdioInitialiseReqSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiRouterCtrlRawSdioInitialiseReqSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlTclasDelReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlTclasDelReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlTclasDelReqSizeof(void *msg); +extern void CsrWifiRouterCtrlTclasDelReqSerFree(void *msg); + +extern CsrUint8* CsrWifiRouterCtrlTrafficClassificationReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlTrafficClassificationReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlTrafficClassificationReqSizeof(void *msg); +#define CsrWifiRouterCtrlTrafficClassificationReqSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlTrafficConfigReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlTrafficConfigReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlTrafficConfigReqSizeof(void *msg); +#define CsrWifiRouterCtrlTrafficConfigReqSerFree CsrWifiRouterCtrlPfree + +#define CsrWifiRouterCtrlWifiOffReqSer CsrWifiEventCsrUint16Ser +#define CsrWifiRouterCtrlWifiOffReqDes CsrWifiEventCsrUint16Des +#define CsrWifiRouterCtrlWifiOffReqSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiRouterCtrlWifiOffReqSerFree CsrWifiRouterCtrlPfree + +#define CsrWifiRouterCtrlWifiOffResSer CsrWifiEventCsrUint16Ser +#define CsrWifiRouterCtrlWifiOffResDes CsrWifiEventCsrUint16Des +#define CsrWifiRouterCtrlWifiOffResSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiRouterCtrlWifiOffResSerFree CsrWifiRouterCtrlPfree + +#define CsrWifiRouterCtrlWifiOnReqSer CsrWifiEventCsrUint16Ser +#define CsrWifiRouterCtrlWifiOnReqDes CsrWifiEventCsrUint16Des +#define CsrWifiRouterCtrlWifiOnReqSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiRouterCtrlWifiOnReqSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlWifiOnResSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlWifiOnResDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlWifiOnResSizeof(void *msg); +extern void CsrWifiRouterCtrlWifiOnResSerFree(void *msg); + +extern CsrUint8* CsrWifiRouterCtrlM4TransmitReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlM4TransmitReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlM4TransmitReqSizeof(void *msg); +#define CsrWifiRouterCtrlM4TransmitReqSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlModeSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlModeSetReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlModeSetReqSizeof(void *msg); +#define CsrWifiRouterCtrlModeSetReqSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlPeerAddReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlPeerAddReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlPeerAddReqSizeof(void *msg); +#define CsrWifiRouterCtrlPeerAddReqSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlPeerDelReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlPeerDelReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlPeerDelReqSizeof(void *msg); +#define CsrWifiRouterCtrlPeerDelReqSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlPeerUpdateReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlPeerUpdateReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlPeerUpdateReqSizeof(void *msg); +#define CsrWifiRouterCtrlPeerUpdateReqSerFree CsrWifiRouterCtrlPfree + +#define CsrWifiRouterCtrlCapabilitiesReqSer CsrWifiEventCsrUint16Ser +#define CsrWifiRouterCtrlCapabilitiesReqDes CsrWifiEventCsrUint16Des +#define CsrWifiRouterCtrlCapabilitiesReqSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiRouterCtrlCapabilitiesReqSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlBlockAckEnableReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlBlockAckEnableReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlBlockAckEnableReqSizeof(void *msg); +#define CsrWifiRouterCtrlBlockAckEnableReqSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlBlockAckDisableReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlBlockAckDisableReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlBlockAckDisableReqSizeof(void *msg); +#define CsrWifiRouterCtrlBlockAckDisableReqSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlWapiMulticastReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlWapiMulticastReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlWapiMulticastReqSizeof(void *msg); +extern void CsrWifiRouterCtrlWapiMulticastReqSerFree(void *msg); + +#define CsrWifiRouterCtrlWapiMulticastFilterReqSer CsrWifiEventCsrUint8Ser +#define CsrWifiRouterCtrlWapiMulticastFilterReqDes CsrWifiEventCsrUint8Des +#define CsrWifiRouterCtrlWapiMulticastFilterReqSizeof CsrWifiEventCsrUint8Sizeof +#define CsrWifiRouterCtrlWapiMulticastFilterReqSerFree CsrWifiRouterCtrlPfree + +#define CsrWifiRouterCtrlWapiUnicastFilterReqSer CsrWifiEventCsrUint8Ser +#define CsrWifiRouterCtrlWapiUnicastFilterReqDes CsrWifiEventCsrUint8Des +#define CsrWifiRouterCtrlWapiUnicastFilterReqSizeof CsrWifiEventCsrUint8Sizeof +#define CsrWifiRouterCtrlWapiUnicastFilterReqSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlHipIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlHipIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlHipIndSizeof(void *msg); +extern void CsrWifiRouterCtrlHipIndSerFree(void *msg); + +extern CsrUint8* CsrWifiRouterCtrlMulticastAddressIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlMulticastAddressIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlMulticastAddressIndSizeof(void *msg); +extern void CsrWifiRouterCtrlMulticastAddressIndSerFree(void *msg); + +extern CsrUint8* CsrWifiRouterCtrlPortConfigureCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlPortConfigureCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlPortConfigureCfmSizeof(void *msg); +#define CsrWifiRouterCtrlPortConfigureCfmSerFree CsrWifiRouterCtrlPfree + +#define CsrWifiRouterCtrlResumeIndSer CsrWifiEventCsrUint16CsrUint8Ser +#define CsrWifiRouterCtrlResumeIndDes CsrWifiEventCsrUint16CsrUint8Des +#define CsrWifiRouterCtrlResumeIndSizeof CsrWifiEventCsrUint16CsrUint8Sizeof +#define CsrWifiRouterCtrlResumeIndSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlSuspendIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlSuspendIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlSuspendIndSizeof(void *msg); +#define CsrWifiRouterCtrlSuspendIndSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlTclasAddCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlTclasAddCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlTclasAddCfmSizeof(void *msg); +#define CsrWifiRouterCtrlTclasAddCfmSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlRawSdioDeinitialiseCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlRawSdioDeinitialiseCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlRawSdioDeinitialiseCfmSizeof(void *msg); +#define CsrWifiRouterCtrlRawSdioDeinitialiseCfmSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlRawSdioInitialiseCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlRawSdioInitialiseCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlRawSdioInitialiseCfmSizeof(void *msg); +#define CsrWifiRouterCtrlRawSdioInitialiseCfmSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlTclasDelCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlTclasDelCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlTclasDelCfmSizeof(void *msg); +#define CsrWifiRouterCtrlTclasDelCfmSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlTrafficProtocolIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlTrafficProtocolIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlTrafficProtocolIndSizeof(void *msg); +#define CsrWifiRouterCtrlTrafficProtocolIndSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlTrafficSampleIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlTrafficSampleIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlTrafficSampleIndSizeof(void *msg); +#define CsrWifiRouterCtrlTrafficSampleIndSerFree CsrWifiRouterCtrlPfree + +#define CsrWifiRouterCtrlWifiOffIndSer CsrWifiEventCsrUint16CsrUint8Ser +#define CsrWifiRouterCtrlWifiOffIndDes CsrWifiEventCsrUint16CsrUint8Des +#define CsrWifiRouterCtrlWifiOffIndSizeof CsrWifiEventCsrUint16CsrUint8Sizeof +#define CsrWifiRouterCtrlWifiOffIndSerFree CsrWifiRouterCtrlPfree + +#define CsrWifiRouterCtrlWifiOffCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiRouterCtrlWifiOffCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiRouterCtrlWifiOffCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiRouterCtrlWifiOffCfmSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlWifiOnIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlWifiOnIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlWifiOnIndSizeof(void *msg); +extern void CsrWifiRouterCtrlWifiOnIndSerFree(void *msg); + +extern CsrUint8* CsrWifiRouterCtrlWifiOnCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlWifiOnCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlWifiOnCfmSizeof(void *msg); +#define CsrWifiRouterCtrlWifiOnCfmSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlM4ReadyToSendIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlM4ReadyToSendIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlM4ReadyToSendIndSizeof(void *msg); +#define CsrWifiRouterCtrlM4ReadyToSendIndSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlM4TransmittedIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlM4TransmittedIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlM4TransmittedIndSizeof(void *msg); +#define CsrWifiRouterCtrlM4TransmittedIndSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlMicFailureIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlMicFailureIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlMicFailureIndSizeof(void *msg); +#define CsrWifiRouterCtrlMicFailureIndSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlConnectedIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlConnectedIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlConnectedIndSizeof(void *msg); +#define CsrWifiRouterCtrlConnectedIndSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlPeerAddCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlPeerAddCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlPeerAddCfmSizeof(void *msg); +#define CsrWifiRouterCtrlPeerAddCfmSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlPeerDelCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlPeerDelCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlPeerDelCfmSizeof(void *msg); +#define CsrWifiRouterCtrlPeerDelCfmSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlUnexpectedFrameIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlUnexpectedFrameIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlUnexpectedFrameIndSizeof(void *msg); +#define CsrWifiRouterCtrlUnexpectedFrameIndSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlPeerUpdateCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlPeerUpdateCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlPeerUpdateCfmSizeof(void *msg); +#define CsrWifiRouterCtrlPeerUpdateCfmSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlCapabilitiesCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlCapabilitiesCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlCapabilitiesCfmSizeof(void *msg); +#define CsrWifiRouterCtrlCapabilitiesCfmSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlBlockAckEnableCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlBlockAckEnableCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlBlockAckEnableCfmSizeof(void *msg); +#define CsrWifiRouterCtrlBlockAckEnableCfmSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlBlockAckDisableCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlBlockAckDisableCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlBlockAckDisableCfmSizeof(void *msg); +#define CsrWifiRouterCtrlBlockAckDisableCfmSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlBlockAckErrorIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlBlockAckErrorIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlBlockAckErrorIndSizeof(void *msg); +#define CsrWifiRouterCtrlBlockAckErrorIndSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlStaInactiveIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlStaInactiveIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlStaInactiveIndSizeof(void *msg); +#define CsrWifiRouterCtrlStaInactiveIndSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlWapiMulticastIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlWapiMulticastIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlWapiMulticastIndSizeof(void *msg); +extern void CsrWifiRouterCtrlWapiMulticastIndSerFree(void *msg); + + +#ifdef __cplusplus +} +#endif +#endif /* CSR_WIFI_ROUTER_CTRL_SERIALIZE_H__ */ + diff --git a/drivers/staging/csr/csr_wifi_router_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_router_free_downstream_contents.c new file mode 100644 index 0000000..9ae6cff --- /dev/null +++ b/drivers/staging/csr/csr_wifi_router_free_downstream_contents.c @@ -0,0 +1,54 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#include "csr_pmem.h" +#include "csr_wifi_router_prim.h" +#include "csr_wifi_router_lib.h" + +/*----------------------------------------------------------------------------* + * NAME + * CsrWifiRouterFreeDownstreamMessageContents + * + * DESCRIPTION + * + * + * PARAMETERS + * eventClass: only the value CSR_WIFI_ROUTER_PRIM will be handled + * message: the message to free + *----------------------------------------------------------------------------*/ +void CsrWifiRouterFreeDownstreamMessageContents(CsrUint16 eventClass, void *message) +{ + if (eventClass != CSR_WIFI_ROUTER_PRIM) + { + return; + } + if (NULL == message) + { + return; + } + + switch (*((CsrWifiRouterPrim *) message)) + { + case CSR_WIFI_ROUTER_MA_PACKET_REQ: + { + CsrWifiRouterMaPacketReq *p = (CsrWifiRouterMaPacketReq *)message; + CsrPmemFree(p->frame); + p->frame = NULL; + break; + } + + default: + break; + } +} + + diff --git a/drivers/staging/csr/csr_wifi_router_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_router_free_upstream_contents.c new file mode 100644 index 0000000..19d9c23 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_router_free_upstream_contents.c @@ -0,0 +1,54 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#include "csr_pmem.h" +#include "csr_wifi_router_prim.h" +#include "csr_wifi_router_lib.h" + +/*----------------------------------------------------------------------------* + * NAME + * CsrWifiRouterFreeUpstreamMessageContents + * + * DESCRIPTION + * + * + * PARAMETERS + * eventClass: only the value CSR_WIFI_ROUTER_PRIM will be handled + * message: the message to free + *----------------------------------------------------------------------------*/ +void CsrWifiRouterFreeUpstreamMessageContents(CsrUint16 eventClass, void *message) +{ + if (eventClass != CSR_WIFI_ROUTER_PRIM) + { + return; + } + if (NULL == message) + { + return; + } + + switch (*((CsrWifiRouterPrim *) message)) + { + case CSR_WIFI_ROUTER_MA_PACKET_IND: + { + CsrWifiRouterMaPacketInd *p = (CsrWifiRouterMaPacketInd *)message; + CsrPmemFree(p->frame); + p->frame = NULL; + break; + } + + default: + break; + } +} + + diff --git a/drivers/staging/csr/csr_wifi_router_lib.h b/drivers/staging/csr/csr_wifi_router_lib.h new file mode 100644 index 0000000..553e7d3 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_router_lib.h @@ -0,0 +1,429 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_ROUTER_LIB_H__ +#define CSR_WIFI_ROUTER_LIB_H__ + +#include "csr_types.h" +#include "csr_pmem.h" +#include "csr_sched.h" +#include "csr_util.h" +#include "csr_msg_transport.h" + +#include "csr_wifi_lib.h" + +#include "csr_wifi_router_prim.h" +#include "csr_wifi_router_task.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/*----------------------------------------------------------------------------* + * CsrWifiRouterFreeUpstreamMessageContents + * + * DESCRIPTION + * Free the allocated memory in a CSR_WIFI_ROUTER upstream message. Does not + * free the message itself, and can only be used for upstream messages. + * + * PARAMETERS + * Deallocates the resources in a CSR_WIFI_ROUTER upstream message + *----------------------------------------------------------------------------*/ +void CsrWifiRouterFreeUpstreamMessageContents(CsrUint16 eventClass, void *message); + +/*----------------------------------------------------------------------------* + * CsrWifiRouterFreeDownstreamMessageContents + * + * DESCRIPTION + * Free the allocated memory in a CSR_WIFI_ROUTER downstream message. Does not + * free the message itself, and can only be used for downstream messages. + * + * PARAMETERS + * Deallocates the resources in a CSR_WIFI_ROUTER downstream message + *----------------------------------------------------------------------------*/ +void CsrWifiRouterFreeDownstreamMessageContents(CsrUint16 eventClass, void *message); + +/*----------------------------------------------------------------------------* + * Enum to string functions + *----------------------------------------------------------------------------*/ +const CsrCharString* CsrWifiRouterAppTypeToString(CsrWifiRouterAppType value); +const CsrCharString* CsrWifiRouterEncapsulationToString(CsrWifiRouterEncapsulation value); +const CsrCharString* CsrWifiRouterOuiToString(CsrWifiRouterOui value); +const CsrCharString* CsrWifiRouterPriorityToString(CsrWifiRouterPriority value); + + +/*----------------------------------------------------------------------------* + * CsrPrim Type toString function. + * Converts a message type to the String name of the Message + *----------------------------------------------------------------------------*/ +const CsrCharString* CsrWifiRouterPrimTypeToString(CsrPrim msgType); + +/*----------------------------------------------------------------------------* + * Lookup arrays for PrimType name Strings + *----------------------------------------------------------------------------*/ +extern const CsrCharString *CsrWifiRouterUpstreamPrimNames[CSR_WIFI_ROUTER_PRIM_UPSTREAM_COUNT]; +extern const CsrCharString *CsrWifiRouterDownstreamPrimNames[CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT]; + +/******************************************************************************* + + NAME + CsrWifiRouterMaPacketCancelReqSend + + DESCRIPTION + This primitive is used to request cancellation of a previously send + CsrWifiRouterMaPacketReq. + The frame may already have been transmitted so there is no guarantees + that the CsrWifiRouterMaPacketCancelReq actually cancels the transmission + of the frame in question. + If the cancellation fails, the Router will send, if required, + CsrWifiRouterMaPacketCfm. + If the cancellation succeeds, the Router will not send + CsrWifiRouterMaPacketCfm. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + hostTag - The hostTag for the frame, which should be cancelled. + priority - Priority of the frame, which should be cancelled + peerMacAddress - Destination MAC address of the frame, which should be + cancelled + +*******************************************************************************/ +#define CsrWifiRouterMaPacketCancelReqCreate(msg__, dst__, src__, interfaceTag__, hostTag__, priority__, peerMacAddress__) \ + msg__ = (CsrWifiRouterMaPacketCancelReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketCancelReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_CANCEL_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->hostTag = (hostTag__); \ + msg__->priority = (priority__); \ + msg__->peerMacAddress = (peerMacAddress__); + +#define CsrWifiRouterMaPacketCancelReqSendTo(dst__, src__, interfaceTag__, hostTag__, priority__, peerMacAddress__) \ + { \ + CsrWifiRouterMaPacketCancelReq *msg__; \ + CsrWifiRouterMaPacketCancelReqCreate(msg__, dst__, src__, interfaceTag__, hostTag__, priority__, peerMacAddress__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \ + } + +#define CsrWifiRouterMaPacketCancelReqSend(src__, interfaceTag__, hostTag__, priority__, peerMacAddress__) \ + CsrWifiRouterMaPacketCancelReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, hostTag__, priority__, peerMacAddress__) + +/******************************************************************************* + + NAME + CsrWifiRouterMaPacketReqSend + + DESCRIPTION + A task sends this primitive to transmit a frame. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + subscriptionHandle - The handle of the subscription + frameLength - Length of the frame to be sent in bytes + frame - Pointer to the frame to be sent + freeFunction - Pointer to function to be used to free the frame + priority - Priority of the frame, which should be sent + hostTag - An application shall set the bits b31..b28 using one of + the CSR_WIFI_ROUTER_APP_TYPE_* masks. Bits b0..b27 can + be used by the requestor without any restrictions, but + the hostTag shall be unique so the hostTag for + CSR_WIFI_ROUTER_APP _TYPE_OTHER should be constructured + in the following way [ CSR_WIFI_ROUTER_APP_TYPE_OTHER + (4 bits) | SubscriptionHandle (8 bits) | Sequence no. + (20 bits) ]. If the hostTag is not unique, the + behaviour of the system is unpredicatable with respect + to data/management frame transfer. + cfmRequested - Indicates if the requestor needs a confirm for packet + requests sent under this subscription. If set to TRUE, + the router will send a confirm, else it will not send + any confirm + +*******************************************************************************/ +#define CsrWifiRouterMaPacketReqCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, frameLength__, frame__, freeFunction__, priority__, hostTag__, cfmRequested__) \ + msg__ = (CsrWifiRouterMaPacketReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->subscriptionHandle = (subscriptionHandle__); \ + msg__->frameLength = (frameLength__); \ + msg__->frame = (frame__); \ + msg__->freeFunction = (freeFunction__); \ + msg__->priority = (priority__); \ + msg__->hostTag = (hostTag__); \ + msg__->cfmRequested = (cfmRequested__); + +#define CsrWifiRouterMaPacketReqSendTo(dst__, src__, interfaceTag__, subscriptionHandle__, frameLength__, frame__, freeFunction__, priority__, hostTag__, cfmRequested__) \ + { \ + CsrWifiRouterMaPacketReq *msg__; \ + CsrWifiRouterMaPacketReqCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, frameLength__, frame__, freeFunction__, priority__, hostTag__, cfmRequested__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \ + } + +#define CsrWifiRouterMaPacketReqSend(src__, interfaceTag__, subscriptionHandle__, frameLength__, frame__, freeFunction__, priority__, hostTag__, cfmRequested__) \ + CsrWifiRouterMaPacketReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, subscriptionHandle__, frameLength__, frame__, freeFunction__, priority__, hostTag__, cfmRequested__) + +/******************************************************************************* + + NAME + CsrWifiRouterMaPacketIndSend + + DESCRIPTION + The router sends the primitive to a subscribed task when it receives a + frame matching the subscription. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + subscriptionHandle - The handle of the subscription + result - Status of the operation + frameLength - Length of the received frame in bytes + frame - Pointer to the received frame + freeFunction - Pointer to function to be used to free the frame + rssi - Received signal strength indication in dBm + snr - Signal to Noise Ratio + rate - Transmission/Reception rate + +*******************************************************************************/ +#define CsrWifiRouterMaPacketIndCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, result__, frameLength__, frame__, freeFunction__, rssi__, snr__, rate__) \ + msg__ = (CsrWifiRouterMaPacketInd *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_IND, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->subscriptionHandle = (subscriptionHandle__); \ + msg__->result = (result__); \ + msg__->frameLength = (frameLength__); \ + msg__->frame = (frame__); \ + msg__->freeFunction = (freeFunction__); \ + msg__->rssi = (rssi__); \ + msg__->snr = (snr__); \ + msg__->rate = (rate__); + +#define CsrWifiRouterMaPacketIndSendTo(dst__, src__, interfaceTag__, subscriptionHandle__, result__, frameLength__, frame__, freeFunction__, rssi__, snr__, rate__) \ + { \ + CsrWifiRouterMaPacketInd *msg__; \ + CsrWifiRouterMaPacketIndCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, result__, frameLength__, frame__, freeFunction__, rssi__, snr__, rate__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \ + } + +#define CsrWifiRouterMaPacketIndSend(dst__, interfaceTag__, subscriptionHandle__, result__, frameLength__, frame__, freeFunction__, rssi__, snr__, rate__) \ + CsrWifiRouterMaPacketIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, interfaceTag__, subscriptionHandle__, result__, frameLength__, frame__, freeFunction__, rssi__, snr__, rate__) + +/******************************************************************************* + + NAME + CsrWifiRouterMaPacketResSend + + DESCRIPTION + A task send this primitive to confirm the reception of the received + frame. + + PARAMETERS + interfaceTag - Interface Identifier; unique identifier of an interface + subscriptionHandle - The handle of the subscription + result - Status of the operation + +*******************************************************************************/ +#define CsrWifiRouterMaPacketResCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, result__) \ + msg__ = (CsrWifiRouterMaPacketRes *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketRes)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_RES, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->subscriptionHandle = (subscriptionHandle__); \ + msg__->result = (result__); + +#define CsrWifiRouterMaPacketResSendTo(dst__, src__, interfaceTag__, subscriptionHandle__, result__) \ + { \ + CsrWifiRouterMaPacketRes *msg__; \ + CsrWifiRouterMaPacketResCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, result__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \ + } + +#define CsrWifiRouterMaPacketResSend(src__, interfaceTag__, subscriptionHandle__, result__) \ + CsrWifiRouterMaPacketResSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, subscriptionHandle__, result__) + +/******************************************************************************* + + NAME + CsrWifiRouterMaPacketCfmSend + + DESCRIPTION + The router sends the primitive to confirm the result of the transmission + of the packet of the corresponding CSR_WIFI_ROUTER MA_PACKET_REQ request. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + result - Status of the operation + hostTag - The hostTrag will match the hostTag sent in the request. + rate - Transmission/Reception rate + +*******************************************************************************/ +#define CsrWifiRouterMaPacketCfmCreate(msg__, dst__, src__, interfaceTag__, result__, hostTag__, rate__) \ + msg__ = (CsrWifiRouterMaPacketCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->result = (result__); \ + msg__->hostTag = (hostTag__); \ + msg__->rate = (rate__); + +#define CsrWifiRouterMaPacketCfmSendTo(dst__, src__, interfaceTag__, result__, hostTag__, rate__) \ + { \ + CsrWifiRouterMaPacketCfm *msg__; \ + CsrWifiRouterMaPacketCfmCreate(msg__, dst__, src__, interfaceTag__, result__, hostTag__, rate__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \ + } + +#define CsrWifiRouterMaPacketCfmSend(dst__, interfaceTag__, result__, hostTag__, rate__) \ + CsrWifiRouterMaPacketCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, interfaceTag__, result__, hostTag__, rate__) + +/******************************************************************************* + + NAME + CsrWifiRouterMaPacketSubscribeReqSend + + DESCRIPTION + A task can use this primitive to subscribe for a particular OUI/protocol + and transmit and receive frames matching the subscription. + NOTE: Multiple subscriptions for a given protocol and OUI will result in + the first subscription receiving the data and not the subsequent + subscriptions. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + encapsulation - Specifies the encapsulation type, which will be used for the + subscription + protocol - Together with the OUI, specifies the protocol, which a task + wants to subscribe to + oui - Specifies the OUI for the protocol, which a task wants to + subscribe to + +*******************************************************************************/ +#define CsrWifiRouterMaPacketSubscribeReqCreate(msg__, dst__, src__, interfaceTag__, encapsulation__, protocol__, oui__) \ + msg__ = (CsrWifiRouterMaPacketSubscribeReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketSubscribeReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->encapsulation = (encapsulation__); \ + msg__->protocol = (protocol__); \ + msg__->oui = (oui__); + +#define CsrWifiRouterMaPacketSubscribeReqSendTo(dst__, src__, interfaceTag__, encapsulation__, protocol__, oui__) \ + { \ + CsrWifiRouterMaPacketSubscribeReq *msg__; \ + CsrWifiRouterMaPacketSubscribeReqCreate(msg__, dst__, src__, interfaceTag__, encapsulation__, protocol__, oui__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \ + } + +#define CsrWifiRouterMaPacketSubscribeReqSend(src__, interfaceTag__, encapsulation__, protocol__, oui__) \ + CsrWifiRouterMaPacketSubscribeReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, encapsulation__, protocol__, oui__) + +/******************************************************************************* + + NAME + CsrWifiRouterMaPacketSubscribeCfmSend + + DESCRIPTION + The router sends this primitive to confirm the result of the + subscription. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + subscriptionHandle - Handle to the subscription + This handle must be used in all subsequent requests + status - Status of the operation + allocOffset - Size of the offset for the frames of the subscription + +*******************************************************************************/ +#define CsrWifiRouterMaPacketSubscribeCfmCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, status__, allocOffset__) \ + msg__ = (CsrWifiRouterMaPacketSubscribeCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketSubscribeCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->subscriptionHandle = (subscriptionHandle__); \ + msg__->status = (status__); \ + msg__->allocOffset = (allocOffset__); + +#define CsrWifiRouterMaPacketSubscribeCfmSendTo(dst__, src__, interfaceTag__, subscriptionHandle__, status__, allocOffset__) \ + { \ + CsrWifiRouterMaPacketSubscribeCfm *msg__; \ + CsrWifiRouterMaPacketSubscribeCfmCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, status__, allocOffset__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \ + } + +#define CsrWifiRouterMaPacketSubscribeCfmSend(dst__, interfaceTag__, subscriptionHandle__, status__, allocOffset__) \ + CsrWifiRouterMaPacketSubscribeCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, interfaceTag__, subscriptionHandle__, status__, allocOffset__) + +/******************************************************************************* + + NAME + CsrWifiRouterMaPacketUnsubscribeReqSend + + DESCRIPTION + A task sends this primitive to unsubscribe a subscription + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + subscriptionHandle - The handle of the subscription + +*******************************************************************************/ +#define CsrWifiRouterMaPacketUnsubscribeReqCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__) \ + msg__ = (CsrWifiRouterMaPacketUnsubscribeReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketUnsubscribeReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->subscriptionHandle = (subscriptionHandle__); + +#define CsrWifiRouterMaPacketUnsubscribeReqSendTo(dst__, src__, interfaceTag__, subscriptionHandle__) \ + { \ + CsrWifiRouterMaPacketUnsubscribeReq *msg__; \ + CsrWifiRouterMaPacketUnsubscribeReqCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \ + } + +#define CsrWifiRouterMaPacketUnsubscribeReqSend(src__, interfaceTag__, subscriptionHandle__) \ + CsrWifiRouterMaPacketUnsubscribeReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, subscriptionHandle__) + +/******************************************************************************* + + NAME + CsrWifiRouterMaPacketUnsubscribeCfmSend + + DESCRIPTION + The router sends this primitive to confirm the result of the + unsubscription. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Status of the operation + +*******************************************************************************/ +#define CsrWifiRouterMaPacketUnsubscribeCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ + msg__ = (CsrWifiRouterMaPacketUnsubscribeCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketUnsubscribeCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); + +#define CsrWifiRouterMaPacketUnsubscribeCfmSendTo(dst__, src__, interfaceTag__, status__) \ + { \ + CsrWifiRouterMaPacketUnsubscribeCfm *msg__; \ + CsrWifiRouterMaPacketUnsubscribeCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \ + } + +#define CsrWifiRouterMaPacketUnsubscribeCfmSend(dst__, interfaceTag__, status__) \ + CsrWifiRouterMaPacketUnsubscribeCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, interfaceTag__, status__) + + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_ROUTER_LIB_H__ */ diff --git a/drivers/staging/csr/csr_wifi_router_prim.h b/drivers/staging/csr/csr_wifi_router_prim.h new file mode 100644 index 0000000..67b71a4 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_router_prim.h @@ -0,0 +1,430 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_ROUTER_PRIM_H__ +#define CSR_WIFI_ROUTER_PRIM_H__ + +#include "csr_types.h" +#include "csr_prim_defs.h" +#include "csr_sched.h" +#include "csr_wifi_common.h" +#include "csr_result.h" +#include "csr_wifi_fsm_event.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define CSR_WIFI_ROUTER_PRIM (0x0400) + +typedef CsrPrim CsrWifiRouterPrim; + +typedef void (*CsrWifiRouterFrameFreeFunction)(void *frame); + +/******************************************************************************* + + NAME + CsrWifiRouterAppType + + DESCRIPTION + + VALUES + CSR_WIFI_ROUTER_APP_TYPE_SME - + CSR_WIFI_ROUTER_APP_TYPE_PAL - + CSR_WIFI_ROUTER_APP_TYPE_NME - + CSR_WIFI_ROUTER_APP_TYPE_OTHER - + +*******************************************************************************/ +typedef CsrUint8 CsrWifiRouterAppType; +#define CSR_WIFI_ROUTER_APP_TYPE_SME ((CsrWifiRouterAppType) 0x0) +#define CSR_WIFI_ROUTER_APP_TYPE_PAL ((CsrWifiRouterAppType) 0x1) +#define CSR_WIFI_ROUTER_APP_TYPE_NME ((CsrWifiRouterAppType) 0x2) +#define CSR_WIFI_ROUTER_APP_TYPE_OTHER ((CsrWifiRouterAppType) 0x3) + +/******************************************************************************* + + NAME + CsrWifiRouterEncapsulation + + DESCRIPTION + Indicates the type of encapsulation used for the subscription + + VALUES + CSR_WIFI_ROUTER_ENCAPSULATION_ETHERNET + - Ethernet encapsulation + CSR_WIFI_ROUTER_ENCAPSULATION_LLC_SNAP + - LLC/SNAP encapsulation + +*******************************************************************************/ +typedef CsrUint8 CsrWifiRouterEncapsulation; +#define CSR_WIFI_ROUTER_ENCAPSULATION_ETHERNET ((CsrWifiRouterEncapsulation) 0x00) +#define CSR_WIFI_ROUTER_ENCAPSULATION_LLC_SNAP ((CsrWifiRouterEncapsulation) 0x01) + +/******************************************************************************* + + NAME + CsrWifiRouterOui + + DESCRIPTION + + VALUES + CSR_WIFI_ROUTER_OUI_RFC_1042 - + CSR_WIFI_ROUTER_OUI_BT - + +*******************************************************************************/ +typedef CsrUint32 CsrWifiRouterOui; +#define CSR_WIFI_ROUTER_OUI_RFC_1042 ((CsrWifiRouterOui) 0x000000) +#define CSR_WIFI_ROUTER_OUI_BT ((CsrWifiRouterOui) 0x001958) + +/******************************************************************************* + + NAME + CsrWifiRouterPriority + + DESCRIPTION + As defined in the IEEE 802.11 standards + + VALUES + CSR_WIFI_ROUTER_PRIORITY_QOS_UP0 + - See IEEE 802.11 Standard + CSR_WIFI_ROUTER_PRIORITY_QOS_UP1 + - See IEEE 802.11 Standard + CSR_WIFI_ROUTER_PRIORITY_QOS_UP2 + - See IEEE 802.11 Standard + CSR_WIFI_ROUTER_PRIORITY_QOS_UP3 + - See IEEE 802.11 Standard + CSR_WIFI_ROUTER_PRIORITY_QOS_UP4 + - See IEEE 802.11 Standard + CSR_WIFI_ROUTER_PRIORITY_QOS_UP5 + - See IEEE 802.11 Standard + CSR_WIFI_ROUTER_PRIORITY_QOS_UP6 + - See IEEE 802.11 Standard + CSR_WIFI_ROUTER_PRIORITY_QOS_UP7 + - See IEEE 802.11 Standard + CSR_WIFI_ROUTER_PRIORITY_CONTENTION + - See IEEE 802.11 Standard + CSR_WIFI_ROUTER_PRIORITY_MANAGEMENT + - See IEEE 802.11 Standard + +*******************************************************************************/ +typedef CsrUint16 CsrWifiRouterPriority; +#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP0 ((CsrWifiRouterPriority) 0x0000) +#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP1 ((CsrWifiRouterPriority) 0x0001) +#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP2 ((CsrWifiRouterPriority) 0x0002) +#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP3 ((CsrWifiRouterPriority) 0x0003) +#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP4 ((CsrWifiRouterPriority) 0x0004) +#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP5 ((CsrWifiRouterPriority) 0x0005) +#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP6 ((CsrWifiRouterPriority) 0x0006) +#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP7 ((CsrWifiRouterPriority) 0x0007) +#define CSR_WIFI_ROUTER_PRIORITY_CONTENTION ((CsrWifiRouterPriority) 0x8000) +#define CSR_WIFI_ROUTER_PRIORITY_MANAGEMENT ((CsrWifiRouterPriority) 0x8010) + + +/* Downstream */ +#define CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST (0x0000) + +#define CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_REQ ((CsrWifiRouterPrim) (0x0000 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_REQ ((CsrWifiRouterPrim) (0x0001 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_MA_PACKET_REQ ((CsrWifiRouterPrim) (0x0002 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_MA_PACKET_RES ((CsrWifiRouterPrim) (0x0003 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_MA_PACKET_CANCEL_REQ ((CsrWifiRouterPrim) (0x0004 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST)) + + +#define CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_HIGHEST (0x0004 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST) + +/* Upstream */ +#define CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST (0x0000 + CSR_PRIM_UPSTREAM) + +#define CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_CFM ((CsrWifiRouterPrim)(0x0000 + CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_CFM ((CsrWifiRouterPrim)(0x0001 + CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_MA_PACKET_CFM ((CsrWifiRouterPrim)(0x0002 + CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_MA_PACKET_IND ((CsrWifiRouterPrim)(0x0003 + CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST)) + +#define CSR_WIFI_ROUTER_PRIM_UPSTREAM_HIGHEST (0x0003 + CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST) + +#define CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT (CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_HIGHEST + 1 - CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST) +#define CSR_WIFI_ROUTER_PRIM_UPSTREAM_COUNT (CSR_WIFI_ROUTER_PRIM_UPSTREAM_HIGHEST + 1 - CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST) + +/******************************************************************************* + + NAME + CsrWifiRouterMaPacketSubscribeReq + + DESCRIPTION + A task can use this primitive to subscribe for a particular OUI/protocol + and transmit and receive frames matching the subscription. + NOTE: Multiple subscriptions for a given protocol and OUI will result in + the first subscription receiving the data and not the subsequent + subscriptions. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + encapsulation - Specifies the encapsulation type, which will be used for the + subscription + protocol - Together with the OUI, specifies the protocol, which a task + wants to subscribe to + oui - Specifies the OUI for the protocol, which a task wants to + subscribe to + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiRouterEncapsulation encapsulation; + CsrUint16 protocol; + CsrUint32 oui; +} CsrWifiRouterMaPacketSubscribeReq; + +/******************************************************************************* + + NAME + CsrWifiRouterMaPacketUnsubscribeReq + + DESCRIPTION + A task sends this primitive to unsubscribe a subscription + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + subscriptionHandle - The handle of the subscription + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrUint8 subscriptionHandle; +} CsrWifiRouterMaPacketUnsubscribeReq; + +/******************************************************************************* + + NAME + CsrWifiRouterMaPacketReq + + DESCRIPTION + A task sends this primitive to transmit a frame. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + subscriptionHandle - The handle of the subscription + frameLength - Length of the frame to be sent in bytes + frame - Pointer to the frame to be sent + freeFunction - Pointer to function to be used to free the frame + priority - Priority of the frame, which should be sent + hostTag - An application shall set the bits b31..b28 using one of + the CSR_WIFI_ROUTER_APP_TYPE_* masks. Bits b0..b27 can + be used by the requestor without any restrictions, but + the hostTag shall be unique so the hostTag for + CSR_WIFI_ROUTER_APP _TYPE_OTHER should be constructured + in the following way [ CSR_WIFI_ROUTER_APP_TYPE_OTHER + (4 bits) | SubscriptionHandle (8 bits) | Sequence no. + (20 bits) ]. If the hostTag is not unique, the + behaviour of the system is unpredicatable with respect + to data/management frame transfer. + cfmRequested - Indicates if the requestor needs a confirm for packet + requests sent under this subscription. If set to TRUE, + the router will send a confirm, else it will not send + any confirm + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrUint8 subscriptionHandle; + CsrUint16 frameLength; + CsrUint8 *frame; + CsrWifiRouterFrameFreeFunction freeFunction; + CsrWifiRouterPriority priority; + CsrUint32 hostTag; + CsrBool cfmRequested; +} CsrWifiRouterMaPacketReq; + +/******************************************************************************* + + NAME + CsrWifiRouterMaPacketRes + + DESCRIPTION + A task send this primitive to confirm the reception of the received + frame. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + subscriptionHandle - The handle of the subscription + result - Status of the operation + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrUint8 subscriptionHandle; + CsrResult result; +} CsrWifiRouterMaPacketRes; + +/******************************************************************************* + + NAME + CsrWifiRouterMaPacketCancelReq + + DESCRIPTION + This primitive is used to request cancellation of a previously send + CsrWifiRouterMaPacketReq. + The frame may already have been transmitted so there is no guarantees + that the CsrWifiRouterMaPacketCancelReq actually cancels the transmission + of the frame in question. + If the cancellation fails, the Router will send, if required, + CsrWifiRouterMaPacketCfm. + If the cancellation succeeds, the Router will not send + CsrWifiRouterMaPacketCfm. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + hostTag - The hostTag for the frame, which should be cancelled. + priority - Priority of the frame, which should be cancelled + peerMacAddress - Destination MAC address of the frame, which should be + cancelled + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrUint32 hostTag; + CsrWifiRouterPriority priority; + CsrWifiMacAddress peerMacAddress; +} CsrWifiRouterMaPacketCancelReq; + +/******************************************************************************* + + NAME + CsrWifiRouterMaPacketSubscribeCfm + + DESCRIPTION + The router sends this primitive to confirm the result of the + subscription. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + subscriptionHandle - Handle to the subscription + This handle must be used in all subsequent requests + status - Status of the operation + allocOffset - Size of the offset for the frames of the subscription + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrUint8 subscriptionHandle; + CsrResult status; + CsrUint16 allocOffset; +} CsrWifiRouterMaPacketSubscribeCfm; + +/******************************************************************************* + + NAME + CsrWifiRouterMaPacketUnsubscribeCfm + + DESCRIPTION + The router sends this primitive to confirm the result of the + unsubscription. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Status of the operation + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; +} CsrWifiRouterMaPacketUnsubscribeCfm; + +/******************************************************************************* + + NAME + CsrWifiRouterMaPacketCfm + + DESCRIPTION + The router sends the primitive to confirm the result of the transmission + of the packet of the corresponding CSR_WIFI_ROUTER MA_PACKET_REQ request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + result - Status of the operation + hostTag - The hostTrag will match the hostTag sent in the request. + rate - Transmission/Reception rate + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult result; + CsrUint32 hostTag; + CsrUint16 rate; +} CsrWifiRouterMaPacketCfm; + +/******************************************************************************* + + NAME + CsrWifiRouterMaPacketInd + + DESCRIPTION + The router sends the primitive to a subscribed task when it receives a + frame matching the subscription. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + subscriptionHandle - The handle of the subscription + result - Status of the operation + frameLength - Length of the received frame in bytes + frame - Pointer to the received frame + freeFunction - Pointer to function to be used to free the frame + rssi - Received signal strength indication in dBm + snr - Signal to Noise Ratio + rate - Transmission/Reception rate + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrUint8 subscriptionHandle; + CsrResult result; + CsrUint16 frameLength; + CsrUint8 *frame; + CsrWifiRouterFrameFreeFunction freeFunction; + CsrInt16 rssi; + CsrInt16 snr; + CsrUint16 rate; +} CsrWifiRouterMaPacketInd; + + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_ROUTER_PRIM_H__ */ + diff --git a/drivers/staging/csr/csr_wifi_router_sef.c b/drivers/staging/csr/csr_wifi_router_sef.c new file mode 100644 index 0000000..45a10fb --- /dev/null +++ b/drivers/staging/csr/csr_wifi_router_sef.c @@ -0,0 +1,19 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + Confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + + *****************************************************************************/ +#include "csr_wifi_router_sef.h" + +const CsrWifiRouterStateHandlerType CsrWifiRouterDownstreamStateHandlers[CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT] = +{ + /* 0x0000 */ CsrWifiRouterMaPacketSubscribeReqHandler, + /* 0x0001 */ CsrWifiRouterMaPacketUnsubscribeReqHandler, + /* 0x0002 */ CsrWifiRouterMaPacketReqHandler, + /* 0x0003 */ CsrWifiRouterMaPacketResHandler, + /* 0x0004 */ CsrWifiRouterMaPacketCancelReqHandler, +}; diff --git a/drivers/staging/csr/csr_wifi_router_sef.h b/drivers/staging/csr/csr_wifi_router_sef.h new file mode 100644 index 0000000..49dd158 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_router_sef.h @@ -0,0 +1,33 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + Confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + + *****************************************************************************/ +#ifndef CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_H__ +#define CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_H__ + +#include "csr_wifi_router_prim.h" + +#ifdef __cplusplus +extern "C" { +#endif + + typedef void (*CsrWifiRouterStateHandlerType)(void* drvpriv, CsrWifiFsmEvent* msg); + + extern const CsrWifiRouterStateHandlerType CsrWifiRouterDownstreamStateHandlers[CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT]; + + extern void CsrWifiRouterMaPacketSubscribeReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterMaPacketUnsubscribeReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterMaPacketReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterMaPacketResHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterMaPacketCancelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_H__ */ diff --git a/drivers/staging/csr/csr_wifi_router_serialize.c b/drivers/staging/csr/csr_wifi_router_serialize.c new file mode 100644 index 0000000..e1adf8f --- /dev/null +++ b/drivers/staging/csr/csr_wifi_router_serialize.c @@ -0,0 +1,422 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#include "csr_pmem.h" +#include "csr_msgconv.h" +#include "csr_unicode.h" + + +#include "csr_wifi_router_prim.h" +#include "csr_wifi_router_serialize.h" + +void CsrWifiRouterPfree(void *ptr) +{ + CsrPmemFree(ptr); +} + + +CsrSize CsrWifiRouterMaPacketSubscribeReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 1; /* CsrWifiRouterEncapsulation primitive->encapsulation */ + bufferSize += 2; /* CsrUint16 primitive->protocol */ + bufferSize += 4; /* CsrUint32 primitive->oui */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterMaPacketSubscribeReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterMaPacketSubscribeReq *primitive = (CsrWifiRouterMaPacketSubscribeReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->encapsulation); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->protocol); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->oui); + return(ptr); +} + + +void* CsrWifiRouterMaPacketSubscribeReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterMaPacketSubscribeReq *primitive = (CsrWifiRouterMaPacketSubscribeReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketSubscribeReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->encapsulation, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->protocol, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->oui, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterMaPacketReqSizeof(void *msg) +{ + CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 20) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 1; /* CsrUint8 primitive->subscriptionHandle */ + bufferSize += 2; /* CsrUint16 primitive->frameLength */ + bufferSize += primitive->frameLength; /* CsrUint8 primitive->frame */ + bufferSize += 4; /* CsrWifiRouterFrameFreeFunction primitive->freeFunction */ + bufferSize += 2; /* CsrWifiRouterPriority primitive->priority */ + bufferSize += 4; /* CsrUint32 primitive->hostTag */ + bufferSize += 1; /* CsrBool primitive->cfmRequested */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterMaPacketReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->subscriptionHandle); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->frameLength); + if (primitive->frameLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->frame, ((CsrUint16) (primitive->frameLength))); + } + CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->freeFunction */ + CsrUint16Ser(ptr, len, (CsrUint16) primitive->priority); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->hostTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->cfmRequested); + return(ptr); +} + + +void* CsrWifiRouterMaPacketReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->subscriptionHandle, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->frameLength, buffer, &offset); + if (primitive->frameLength) + { + primitive->frame = (CsrUint8 *)CsrPmemAlloc(primitive->frameLength); + CsrMemCpyDes(primitive->frame, buffer, &offset, ((CsrUint16) (primitive->frameLength))); + } + else + { + primitive->frame = NULL; + } + primitive->freeFunction = NULL; /* Special for Function Pointers... */ + offset += 4; + CsrUint16Des((CsrUint16 *) &primitive->priority, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->hostTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->cfmRequested, buffer, &offset); + + return primitive; +} + + +void CsrWifiRouterMaPacketReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *) voidPrimitivePointer; + CsrPmemFree(primitive->frame); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiRouterMaPacketResSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 1; /* CsrUint8 primitive->subscriptionHandle */ + bufferSize += 2; /* CsrResult primitive->result */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterMaPacketResSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterMaPacketRes *primitive = (CsrWifiRouterMaPacketRes *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->subscriptionHandle); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->result); + return(ptr); +} + + +void* CsrWifiRouterMaPacketResDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterMaPacketRes *primitive = (CsrWifiRouterMaPacketRes *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketRes)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->subscriptionHandle, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->result, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterMaPacketCancelReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 4; /* CsrUint32 primitive->hostTag */ + bufferSize += 2; /* CsrWifiRouterPriority primitive->priority */ + bufferSize += 6; /* CsrUint8 primitive->peerMacAddress.a[6] */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterMaPacketCancelReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterMaPacketCancelReq *primitive = (CsrWifiRouterMaPacketCancelReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->hostTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->priority); + CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); + return(ptr); +} + + +void* CsrWifiRouterMaPacketCancelReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterMaPacketCancelReq *primitive = (CsrWifiRouterMaPacketCancelReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketCancelReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->hostTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->priority, buffer, &offset); + CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); + + return primitive; +} + + +CsrSize CsrWifiRouterMaPacketSubscribeCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 1; /* CsrUint8 primitive->subscriptionHandle */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 2; /* CsrUint16 primitive->allocOffset */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterMaPacketSubscribeCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterMaPacketSubscribeCfm *primitive = (CsrWifiRouterMaPacketSubscribeCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->subscriptionHandle); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->allocOffset); + return(ptr); +} + + +void* CsrWifiRouterMaPacketSubscribeCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterMaPacketSubscribeCfm *primitive = (CsrWifiRouterMaPacketSubscribeCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketSubscribeCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->subscriptionHandle, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->allocOffset, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterMaPacketUnsubscribeCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterMaPacketUnsubscribeCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterMaPacketUnsubscribeCfm *primitive = (CsrWifiRouterMaPacketUnsubscribeCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiRouterMaPacketUnsubscribeCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterMaPacketUnsubscribeCfm *primitive = (CsrWifiRouterMaPacketUnsubscribeCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketUnsubscribeCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterMaPacketCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->result */ + bufferSize += 4; /* CsrUint32 primitive->hostTag */ + bufferSize += 2; /* CsrUint16 primitive->rate */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterMaPacketCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterMaPacketCfm *primitive = (CsrWifiRouterMaPacketCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->result); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->hostTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->rate); + return(ptr); +} + + +void* CsrWifiRouterMaPacketCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterMaPacketCfm *primitive = (CsrWifiRouterMaPacketCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->result, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->hostTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->rate, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterMaPacketIndSizeof(void *msg) +{ + CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 21) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 1; /* CsrUint8 primitive->subscriptionHandle */ + bufferSize += 2; /* CsrResult primitive->result */ + bufferSize += 2; /* CsrUint16 primitive->frameLength */ + bufferSize += primitive->frameLength; /* CsrUint8 primitive->frame */ + bufferSize += 4; /* CsrWifiRouterFrameFreeFunction primitive->freeFunction */ + bufferSize += 2; /* CsrInt16 primitive->rssi */ + bufferSize += 2; /* CsrInt16 primitive->snr */ + bufferSize += 2; /* CsrUint16 primitive->rate */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterMaPacketIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->subscriptionHandle); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->result); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->frameLength); + if (primitive->frameLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->frame, ((CsrUint16) (primitive->frameLength))); + } + CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->freeFunction */ + CsrUint16Ser(ptr, len, (CsrUint16) primitive->rssi); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->snr); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->rate); + return(ptr); +} + + +void* CsrWifiRouterMaPacketIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->subscriptionHandle, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->result, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->frameLength, buffer, &offset); + if (primitive->frameLength) + { + primitive->frame = (CsrUint8 *)CsrPmemAlloc(primitive->frameLength); + CsrMemCpyDes(primitive->frame, buffer, &offset, ((CsrUint16) (primitive->frameLength))); + } + else + { + primitive->frame = NULL; + } + primitive->freeFunction = NULL; /* Special for Function Pointers... */ + offset += 4; + CsrUint16Des((CsrUint16 *) &primitive->rssi, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->snr, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->rate, buffer, &offset); + + return primitive; +} + + +void CsrWifiRouterMaPacketIndSerFree(void *voidPrimitivePointer) +{ + CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *) voidPrimitivePointer; + CsrPmemFree(primitive->frame); + CsrPmemFree(primitive); +} + + diff --git a/drivers/staging/csr/csr_wifi_router_serialize.h b/drivers/staging/csr/csr_wifi_router_serialize.h new file mode 100644 index 0000000..183a5a4 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_router_serialize.h @@ -0,0 +1,78 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_ROUTER_SERIALIZE_H__ +#define CSR_WIFI_ROUTER_SERIALIZE_H__ + +#include "csr_types.h" +#include "csr_pmem.h" +#include "csr_wifi_msgconv.h" + +#include "csr_wifi_router_prim.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern void CsrWifiRouterPfree(void *ptr); + +extern CsrUint8* CsrWifiRouterMaPacketSubscribeReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterMaPacketSubscribeReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterMaPacketSubscribeReqSizeof(void *msg); +#define CsrWifiRouterMaPacketSubscribeReqSerFree CsrWifiRouterPfree + +#define CsrWifiRouterMaPacketUnsubscribeReqSer CsrWifiEventCsrUint16CsrUint8Ser +#define CsrWifiRouterMaPacketUnsubscribeReqDes CsrWifiEventCsrUint16CsrUint8Des +#define CsrWifiRouterMaPacketUnsubscribeReqSizeof CsrWifiEventCsrUint16CsrUint8Sizeof +#define CsrWifiRouterMaPacketUnsubscribeReqSerFree CsrWifiRouterPfree + +extern CsrUint8* CsrWifiRouterMaPacketReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterMaPacketReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterMaPacketReqSizeof(void *msg); +extern void CsrWifiRouterMaPacketReqSerFree(void *msg); + +extern CsrUint8* CsrWifiRouterMaPacketResSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterMaPacketResDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterMaPacketResSizeof(void *msg); +#define CsrWifiRouterMaPacketResSerFree CsrWifiRouterPfree + +extern CsrUint8* CsrWifiRouterMaPacketCancelReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterMaPacketCancelReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterMaPacketCancelReqSizeof(void *msg); +#define CsrWifiRouterMaPacketCancelReqSerFree CsrWifiRouterPfree + +extern CsrUint8* CsrWifiRouterMaPacketSubscribeCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterMaPacketSubscribeCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterMaPacketSubscribeCfmSizeof(void *msg); +#define CsrWifiRouterMaPacketSubscribeCfmSerFree CsrWifiRouterPfree + +extern CsrUint8* CsrWifiRouterMaPacketUnsubscribeCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterMaPacketUnsubscribeCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterMaPacketUnsubscribeCfmSizeof(void *msg); +#define CsrWifiRouterMaPacketUnsubscribeCfmSerFree CsrWifiRouterPfree + +extern CsrUint8* CsrWifiRouterMaPacketCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterMaPacketCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterMaPacketCfmSizeof(void *msg); +#define CsrWifiRouterMaPacketCfmSerFree CsrWifiRouterPfree + +extern CsrUint8* CsrWifiRouterMaPacketIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterMaPacketIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterMaPacketIndSizeof(void *msg); +extern void CsrWifiRouterMaPacketIndSerFree(void *msg); + + +#ifdef __cplusplus +} +#endif +#endif /* CSR_WIFI_ROUTER_SERIALIZE_H__ */ + diff --git a/drivers/staging/csr/csr_wifi_router_task.h b/drivers/staging/csr/csr_wifi_router_task.h new file mode 100644 index 0000000..5bc460e --- /dev/null +++ b/drivers/staging/csr/csr_wifi_router_task.h @@ -0,0 +1,34 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_ROUTER_TASK_H__ +#define CSR_WIFI_ROUTER_TASK_H__ + +#include "csr_types.h" +#include "csr_sched.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define CSR_WIFI_ROUTER_LOG_ID 0x1201FFFF +extern CsrSchedQid CSR_WIFI_ROUTER_IFACEQUEUE; +void CsrWifiRouterInit(void **gash); +void CsrWifiRouterDeinit(void **gash); +void CsrWifiRouterHandler(void **gash); + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_ROUTER_TASK_H__ */ + diff --git a/drivers/staging/csr/csr_wifi_router_transport.c b/drivers/staging/csr/csr_wifi_router_transport.c new file mode 100644 index 0000000..ec7e01d --- /dev/null +++ b/drivers/staging/csr/csr_wifi_router_transport.c @@ -0,0 +1,210 @@ +/** @file router_transport.c + * + * + * Copyright (C) Cambridge Silicon Radio Ltd 2006-2010. All rights reserved. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + ****************************************************************************/ + +#include "unifi_priv.h" + +#include "csr_types.h" +#include "csr_sched.h" +#include "csr_msgconv.h" + +#include "sme_userspace.h" + +#include "csr_wifi_hostio_prim.h" +#include "csr_wifi_router_lib.h" +#include "csr_wifi_router_sef.h" +#include "csr_wifi_router_converter_init.h" +#include "csr_wifi_router_ctrl_lib.h" +#include "csr_wifi_router_ctrl_sef.h" +#include "csr_wifi_router_ctrl_converter_init.h" +#include "csr_wifi_sme_prim.h" +#include "csr_wifi_sme_sef.h" +#include "csr_wifi_sme_converter_init.h" +#ifdef CSR_SUPPORT_WEXT +#ifdef CSR_SUPPORT_WEXT_AP +#include "csr_wifi_nme_ap_prim.h" +#include "csr_wifi_nme_ap_sef.h" +#include "csr_wifi_nme_ap_converter_init.h" +#endif +#endif + +static unifi_priv_t *drvpriv = NULL; +void CsrWifiRouterTransportInit(unifi_priv_t *priv) +{ + unifi_trace(priv, UDBG1, "CsrWifiRouterTransportInit: \n"); + + drvpriv = priv; + (void)CsrMsgConvInit(); + CsrWifiRouterConverterInit(); + CsrWifiRouterCtrlConverterInit(); + CsrWifiSmeConverterInit(); +#ifdef CSR_SUPPORT_WEXT +#ifdef CSR_SUPPORT_WEXT_AP + CsrWifiNmeApConverterInit(); +#endif +#endif +} + +void CsrWifiRouterTransportDeinit(unifi_priv_t *priv) +{ + unifi_trace(priv, UDBG1, "CsrWifiRouterTransportDeinit: \n"); + if (priv == drvpriv) + { + CsrMsgConvDeinit(); + drvpriv = NULL; + } +} + +void CsrWifiRouterTransportRecv(unifi_priv_t *priv, CsrUint8* buffer, CsrSize bufferLength) +{ + CsrMsgConvMsgEntry* msgEntry; + CsrUint16 primType; + CsrSchedQid src; + CsrSchedQid dest; + CsrUint16 msgType; + CsrSize offset = 0; + CsrWifiFsmEvent* msg; + + /* Decode the prim and message type */ + CsrUint16Des(&primType, buffer, &offset); + CsrUint16Des(&src, buffer, &offset); + CsrUint16Des(&dest, buffer, &offset); + CsrUint16Des(&msgType, buffer, &offset); + offset -= 2; /* Adjust as the Deserialise Function will read this as well */ + + unifi_trace(priv, UDBG4, "CsrWifiRouterTransportRecv: primType=0x%.4X, msgType=0x%.4X, bufferLength=%d\n", + primType, msgType, bufferLength); + + /* Special handling for HOSTIO messages.... */ + if (primType == CSR_WIFI_HOSTIO_PRIM) + { + CsrWifiRouterCtrlHipReq req = {{CSR_WIFI_ROUTER_CTRL_HIP_REQ, CSR_WIFI_ROUTER_CTRL_PRIM, dest, src, NULL}, 0, NULL, 0, NULL, 0, NULL}; + + req.mlmeCommandLength = bufferLength; + req.mlmeCommand = buffer; + + offset += 8;/* Skip the id, src, dest and slot number */ + CsrUint16Des(&req.dataRef1Length, buffer, &offset); + offset += 2; /* Skip the slot number */ + CsrUint16Des(&req.dataRef2Length, buffer, &offset); + + if (req.dataRef1Length) + { + CsrUint16 dr1Offset = (bufferLength - req.dataRef2Length) - req.dataRef1Length; + req.dataRef1 = &buffer[dr1Offset]; + } + + if (req.dataRef2Length) + { + CsrUint16 dr2Offset = bufferLength - req.dataRef2Length; + req.dataRef2 = &buffer[dr2Offset]; + } + + /* Copy the hip data but strip off the prim type */ + req.mlmeCommandLength -= (req.dataRef1Length + req.dataRef2Length + 6); + req.mlmeCommand = &buffer[6]; + + CsrWifiRouterCtrlHipReqHandler(priv, &req.common); + return; + } + + msgEntry = CsrMsgConvFindEntry(primType, msgType); + if (!msgEntry) + { + unifi_error(priv, "CsrWifiRouterTransportDeserialiseAndSend can not process the message. primType=0x%.4X, msgType=0x%.4X\n", + primType, msgType); + dump(buffer, bufferLength); + return; + } + + msg = (CsrWifiFsmEvent*)(msgEntry->deserFunc)(&buffer[offset], bufferLength - offset); + + msg->primtype = primType; + msg->type = msgType; + msg->source = src; + msg->destination = dest; + + switch(primType) + { + case CSR_WIFI_ROUTER_CTRL_PRIM: + CsrWifiRouterCtrlDownstreamStateHandlers[msg->type - CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST](priv, msg); + CsrWifiRouterCtrlFreeDownstreamMessageContents(CSR_WIFI_ROUTER_CTRL_PRIM, msg); + break; + case CSR_WIFI_ROUTER_PRIM: + CsrWifiRouterDownstreamStateHandlers[msg->type - CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST](priv, msg); + CsrWifiRouterFreeDownstreamMessageContents(CSR_WIFI_ROUTER_PRIM, msg); + break; + case CSR_WIFI_SME_PRIM: + CsrWifiSmeUpstreamStateHandlers[msg->type - CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST](priv, msg); + CsrWifiSmeFreeUpstreamMessageContents(CSR_WIFI_SME_PRIM, msg); + break; +#ifdef CSR_SUPPORT_WEXT +#ifdef CSR_SUPPORT_WEXT_AP + case CSR_WIFI_NME_AP_PRIM: + CsrWifiNmeApUpstreamStateHandlers(priv, msg); + CsrWifiNmeApFreeUpstreamMessageContents(CSR_WIFI_NME_AP_PRIM, msg); + break; +#endif +#endif + default: + unifi_error(priv, "CsrWifiRouterTransportDeserialiseAndSend unhandled prim type 0x%.4X\n", primType); + break; + } + CsrPmemFree(msg); +} + +static void CsrWifiRouterTransportSerialiseAndSend(CsrUint16 primType, void* msg) +{ + CsrWifiFsmEvent* evt = (CsrWifiFsmEvent*)msg; + CsrMsgConvMsgEntry* msgEntry; + CsrSize msgSize; + CsrSize encodeBufferLen = 0; + CsrSize offset = 0; + CsrUint8* encodeBuffer; + + unifi_trace(drvpriv, UDBG4, "CsrWifiRouterTransportSerialiseAndSend: primType=0x%.4X, msgType=0x%.4X\n", + primType, evt->type); + + msgEntry = CsrMsgConvFindEntry(primType, evt->type); + if (!msgEntry) + { + unifi_error(drvpriv, "CsrWifiRouterTransportSerialiseAndSend can not process the message. primType=0x%.4X, msgType=0x%.4X\n", + primType, evt->type); + return; + } + + msgSize = 6 + (msgEntry->sizeofFunc)((void*)msg); + + encodeBuffer = CsrPmemAlloc(msgSize); + + /* Encode PrimType */ + CsrUint16Ser(encodeBuffer, &encodeBufferLen, primType); + CsrUint16Ser(encodeBuffer, &encodeBufferLen, evt->source); + CsrUint16Ser(encodeBuffer, &encodeBufferLen, evt->destination); + + (void)(msgEntry->serFunc)(&encodeBuffer[encodeBufferLen], &offset, msg); + encodeBufferLen += offset; + + uf_sme_queue_message(drvpriv, encodeBuffer, encodeBufferLen); + + /* Do not use msgEntry->freeFunc because the memory is owned by the driver */ + CsrPmemFree(msg); +} + +#if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER) +void CsrSchedMessagePutStringLog(CsrSchedQid q, CsrUint16 mi, void *mv, CsrUint32 line, CsrCharString *file) +#else +void CsrSchedMessagePut(CsrSchedQid q, CsrUint16 mi, void *mv) +#endif +{ + CsrWifiFsmEvent* evt = (CsrWifiFsmEvent*)mv; + evt->destination = q; + CsrWifiRouterTransportSerialiseAndSend(mi, mv); +} + diff --git a/drivers/staging/csr/csr_wifi_serialize_primitive_types.c b/drivers/staging/csr/csr_wifi_serialize_primitive_types.c new file mode 100644 index 0000000..155bf65 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_serialize_primitive_types.c @@ -0,0 +1,257 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#include +#include "csr_types.h" +#include "csr_pmem.h" +#include "csr_util.h" +#include "csr_msgconv.h" +#include "csr_wifi_msgconv.h" +#include "csr_wifi_lib.h" + +void CsrUint24Des(CsrUint32 *v, CsrUint8 *buffer, CsrSize *offset) +{ + CsrUint32 val; + + val = ((buffer[(*offset) + 2] << 16) | + (buffer[(*offset) + 1] << 8) | + (buffer[(*offset)])); + + *offset += 3; + *v = val; +} + + +/* Big endian :e.g WSC, TCLAS */ +void CsrUint16DesBigEndian(CsrUint16 *v, CsrUint8 *buffer, CsrSize *offset) +{ + CsrUint16 val; + + val = (buffer[(*offset)] << 8) | (buffer[(*offset) + 1]); + *offset += 2; + + *v = val; +} + + +void CsrUint24DesBigEndian(CsrUint32 *v, CsrUint8 *buffer, CsrSize *offset) +{ + CsrUint32 val; + + val = ((buffer[(*offset)] << 16) | + (buffer[(*offset) + 1] << 8) | + (buffer[(*offset) + 2])); + + *offset += 3; + *v = val; +} + + +void CsrUint32DesBigEndian(CsrUint32 *v, CsrUint8 *buffer, CsrSize *offset) +{ + CsrUint32 val; + + val = ((buffer[(*offset)] << 24) | + (buffer[(*offset) + 1] << 16) | + (buffer[(*offset) + 2] << 8) | + (buffer[(*offset) + 3])); + + *offset += 4; + *v = val; +} + + +void CsrUint24Ser(CsrUint8 *ptr, CsrSize *len, CsrUint32 v) +{ + ptr[(*len) + 2] = (CsrUint8)((v & 0x00ff0000) >> 16); + ptr[(*len) + 1] = (CsrUint8)((v & 0x0000ff00) >> 8); + ptr[(*len)] = (CsrUint8)((v & 0x000000ff)); + + *len += 3; +} + + +/* Big endian :e.g WSC, TCLAS */ +void CsrUint16SerBigEndian(CsrUint8 *ptr, CsrSize *len, CsrUint16 v) +{ + ptr[(*len)] = (CsrUint8)((v & 0xff00) >> 8); + ptr[(*len) + 1] = (CsrUint8)((v & 0x00ff)); + + *len += 2; +} + + +void CsrUint32SerBigEndian(CsrUint8 *ptr, CsrSize *len, CsrUint32 v) +{ + ptr[(*len)] = (CsrUint8)((v & 0xff000000) >> 24); + ptr[(*len) + 1] = (CsrUint8)((v & 0x00ff0000) >> 16); + ptr[(*len) + 2] = (CsrUint8)((v & 0x0000ff00) >> 8); + ptr[(*len) + 3] = (CsrUint8)((v & 0x000000ff)); + + *len += 4; +} + + +void CsrUint24SerBigEndian(CsrUint8 *ptr, CsrSize *len, CsrUint32 v) +{ + ptr[(*len)] = (CsrUint8)((v & 0x00ff0000) >> 16); + ptr[(*len) + 1] = (CsrUint8)((v & 0x0000ff00) >> 8); + ptr[(*len) + 2] = (CsrUint8)((v & 0x000000ff)); + + *len += 3; +} + + +CsrSize CsrWifiEventSizeof(void *msg) +{ + return 2; +} +EXPORT_SYMBOL_GPL(CsrWifiEventSizeof); + +CsrUint8* CsrWifiEventSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiFsmEvent *primitive = (CsrWifiFsmEvent *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->type); + return(ptr); +} +EXPORT_SYMBOL_GPL(CsrWifiEventSer); + +void* CsrWifiEventDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiFsmEvent *primitive = (CsrWifiFsmEvent *) CsrPmemAlloc(sizeof(CsrWifiFsmEvent)); + CsrSize offset = 0; + CsrUint16Des(&primitive->type, buffer, &offset); + + return primitive; +} +EXPORT_SYMBOL_GPL(CsrWifiEventDes); + +CsrSize CsrWifiEventCsrUint8Sizeof(void *msg) +{ + return 3; +} +EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint8Sizeof); + +CsrUint8* CsrWifiEventCsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiEventCsrUint8 *primitive = (CsrWifiEventCsrUint8 *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint8Ser(ptr, len, primitive->value); + return(ptr); +} +EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint8Ser); + + +void* CsrWifiEventCsrUint8Des(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiEventCsrUint8 *primitive = (CsrWifiEventCsrUint8 *) CsrPmemAlloc(sizeof(CsrWifiEventCsrUint8)); + + CsrSize offset = 0; + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint8Des(&primitive->value, buffer, &offset); + + return primitive; +} +EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint8Des); + + +CsrSize CsrWifiEventCsrUint16Sizeof(void *msg) +{ + return 4; +} +EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16Sizeof); + + +CsrUint8* CsrWifiEventCsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiEventCsrUint16 *primitive = (CsrWifiEventCsrUint16 *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, primitive->value); + return(ptr); +} +EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16Ser); + +void* CsrWifiEventCsrUint16Des(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiEventCsrUint16 *primitive = (CsrWifiEventCsrUint16 *) CsrPmemAlloc(sizeof(CsrWifiEventCsrUint16)); + + CsrSize offset = 0; + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des(&primitive->value, buffer, &offset); + + return primitive; +} +EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16Des); + + +CsrSize CsrWifiEventCsrUint32Sizeof(void *msg) +{ + return 6; +} +EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint32Sizeof); + +CsrUint8* CsrWifiEventCsrUint32Ser(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiEventCsrUint32 *primitive = (CsrWifiEventCsrUint32 *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint32Ser(ptr, len, primitive->value); + return(ptr); +} +EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint32Ser); + + +void* CsrWifiEventCsrUint32Des(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiEventCsrUint32 *primitive = (CsrWifiEventCsrUint32 *) CsrPmemAlloc(sizeof(CsrWifiEventCsrUint32)); + + CsrSize offset = 0; + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint32Des(&primitive->value, buffer, &offset); + + return primitive; +} +EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint32Des); + +CsrSize CsrWifiEventCsrUint16CsrUint8Sizeof(void *msg) +{ + return 5; +} +EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16CsrUint8Sizeof); + +CsrUint8* CsrWifiEventCsrUint16CsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiEventCsrUint16CsrUint8 *primitive = (CsrWifiEventCsrUint16CsrUint8 *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, primitive->value16); + CsrUint8Ser(ptr, len, primitive->value8); + return(ptr); +} +EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16CsrUint8Ser); + + +void* CsrWifiEventCsrUint16CsrUint8Des(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiEventCsrUint16CsrUint8 *primitive = (CsrWifiEventCsrUint16CsrUint8 *) CsrPmemAlloc(sizeof(CsrWifiEventCsrUint16CsrUint8)); + + CsrSize offset = 0; + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des(&primitive->value16, buffer, &offset); + CsrUint8Des(&primitive->value8, buffer, &offset); + + return primitive; +} +EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16CsrUint8Des); + + diff --git a/drivers/staging/csr/csr_wifi_sme_ap_lib.h b/drivers/staging/csr/csr_wifi_sme_ap_lib.h new file mode 100644 index 0000000..edef7c8 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_sme_ap_lib.h @@ -0,0 +1,656 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_SME_AP_LIB_H__ +#define CSR_WIFI_SME_AP_LIB_H__ + +#include "csr_types.h" +#include "csr_pmem.h" +#include "csr_sched.h" +#include "csr_util.h" +#include "csr_msg_transport.h" + +#include "csr_wifi_lib.h" + +#include "csr_wifi_sme_ap_prim.h" +#include "csr_wifi_sme_task.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CSR_WIFI_AP_ENABLE +#error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_sme_ap_lib.h +#endif + +/*----------------------------------------------------------------------------* + * CsrWifiSmeApFreeUpstreamMessageContents + * + * DESCRIPTION + * Free the allocated memory in a CSR_WIFI_SME_AP upstream message. Does not + * free the message itself, and can only be used for upstream messages. + * + * PARAMETERS + * Deallocates the resources in a CSR_WIFI_SME_AP upstream message + *----------------------------------------------------------------------------*/ +void CsrWifiSmeApFreeUpstreamMessageContents(CsrUint16 eventClass, void *message); + +/*----------------------------------------------------------------------------* + * CsrWifiSmeApFreeDownstreamMessageContents + * + * DESCRIPTION + * Free the allocated memory in a CSR_WIFI_SME_AP downstream message. Does not + * free the message itself, and can only be used for downstream messages. + * + * PARAMETERS + * Deallocates the resources in a CSR_WIFI_SME_AP downstream message + *----------------------------------------------------------------------------*/ +void CsrWifiSmeApFreeDownstreamMessageContents(CsrUint16 eventClass, void *message); + +/*----------------------------------------------------------------------------* + * Enum to string functions + *----------------------------------------------------------------------------*/ +const CsrCharString* CsrWifiSmeApAccessTypeToString(CsrWifiSmeApAccessType value); +const CsrCharString* CsrWifiSmeApAuthSupportToString(CsrWifiSmeApAuthSupport value); +const CsrCharString* CsrWifiSmeApAuthTypeToString(CsrWifiSmeApAuthType value); +const CsrCharString* CsrWifiSmeApPhySupportToString(CsrWifiSmeApPhySupport value); +const CsrCharString* CsrWifiSmeApTypeToString(CsrWifiSmeApType value); + + +/*----------------------------------------------------------------------------* + * CsrPrim Type toString function. + * Converts a message type to the String name of the Message + *----------------------------------------------------------------------------*/ +const CsrCharString* CsrWifiSmeApPrimTypeToString(CsrPrim msgType); + +/*----------------------------------------------------------------------------* + * Lookup arrays for PrimType name Strings + *----------------------------------------------------------------------------*/ +extern const CsrCharString *CsrWifiSmeApUpstreamPrimNames[CSR_WIFI_SME_AP_PRIM_UPSTREAM_COUNT]; +extern const CsrCharString *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_COUNT]; + +/******************************************************************************* + + NAME + CsrWifiSmeApBeaconingStartReqSend + + DESCRIPTION + This primitive requests the SME to start AP or GO functionality + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + initialPresence - Set to 0, if Not in a group fomration phase, set to 1 , + during group formation phase + apType - apType : Legacy AP or P2PGO + cloakSsid - cloakSsid flag. + ssid - ssid. + ifIndex - Radio Interface + channel - channel. + maxConnections - Maximum Stations + P2PClients allowed + apCredentials - AP security credeitals used to advertise in beacon /probe + response + smeApConfig - AP configuration + p2pGoParam - P2P specific GO parameters. Ignored if it is a leagacy AP + +*******************************************************************************/ +#define CsrWifiSmeApBeaconingStartReqCreate(msg__, dst__, src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__) \ + msg__ = (CsrWifiSmeApBeaconingStartReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApBeaconingStartReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_START_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->initialPresence = (initialPresence__); \ + msg__->apType = (apType__); \ + msg__->cloakSsid = (cloakSsid__); \ + msg__->ssid = (ssid__); \ + msg__->ifIndex = (ifIndex__); \ + msg__->channel = (channel__); \ + msg__->maxConnections = (maxConnections__); \ + msg__->apCredentials = (apCredentials__); \ + msg__->smeApConfig = (smeApConfig__); \ + msg__->p2pGoParam = (p2pGoParam__); + +#define CsrWifiSmeApBeaconingStartReqSendTo(dst__, src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__) \ + { \ + CsrWifiSmeApBeaconingStartReq *msg__; \ + CsrWifiSmeApBeaconingStartReqCreate(msg__, dst__, src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ + } + +#define CsrWifiSmeApBeaconingStartReqSend(src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__) \ + CsrWifiSmeApBeaconingStartReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__) + +/******************************************************************************* + + NAME + CsrWifiSmeApBeaconingStartCfmSend + + DESCRIPTION + This primitive confirms the completion of the request along with the + status + + PARAMETERS + queue - Destination Task Queue + interfaceTag - + status - + secIeLength - + secIe - + +*******************************************************************************/ +#define CsrWifiSmeApBeaconingStartCfmCreate(msg__, dst__, src__, interfaceTag__, status__, secIeLength__, secIe__) \ + msg__ = (CsrWifiSmeApBeaconingStartCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApBeaconingStartCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_START_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); \ + msg__->secIeLength = (secIeLength__); \ + msg__->secIe = (secIe__); + +#define CsrWifiSmeApBeaconingStartCfmSendTo(dst__, src__, interfaceTag__, status__, secIeLength__, secIe__) \ + { \ + CsrWifiSmeApBeaconingStartCfm *msg__; \ + CsrWifiSmeApBeaconingStartCfmCreate(msg__, dst__, src__, interfaceTag__, status__, secIeLength__, secIe__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ + } + +#define CsrWifiSmeApBeaconingStartCfmSend(dst__, interfaceTag__, status__, secIeLength__, secIe__) \ + CsrWifiSmeApBeaconingStartCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, secIeLength__, secIe__) + +/******************************************************************************* + + NAME + CsrWifiSmeApBeaconingStopReqSend + + DESCRIPTION + This primitive requests the SME to STOP AP or P2PGO operation + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + +*******************************************************************************/ +#define CsrWifiSmeApBeaconingStopReqCreate(msg__, dst__, src__, interfaceTag__) \ + msg__ = (CsrWifiSmeApBeaconingStopReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApBeaconingStopReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_STOP_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); + +#define CsrWifiSmeApBeaconingStopReqSendTo(dst__, src__, interfaceTag__) \ + { \ + CsrWifiSmeApBeaconingStopReq *msg__; \ + CsrWifiSmeApBeaconingStopReqCreate(msg__, dst__, src__, interfaceTag__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ + } + +#define CsrWifiSmeApBeaconingStopReqSend(src__, interfaceTag__) \ + CsrWifiSmeApBeaconingStopReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__) + +/******************************************************************************* + + NAME + CsrWifiSmeApBeaconingStopCfmSend + + DESCRIPTION + This primitive confirms AP or P2PGO operation is terminated + + PARAMETERS + queue - Destination Task Queue + interfaceTag - + status - + +*******************************************************************************/ +#define CsrWifiSmeApBeaconingStopCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ + msg__ = (CsrWifiSmeApBeaconingStopCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApBeaconingStopCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_STOP_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); + +#define CsrWifiSmeApBeaconingStopCfmSendTo(dst__, src__, interfaceTag__, status__) \ + { \ + CsrWifiSmeApBeaconingStopCfm *msg__; \ + CsrWifiSmeApBeaconingStopCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ + } + +#define CsrWifiSmeApBeaconingStopCfmSend(dst__, interfaceTag__, status__) \ + CsrWifiSmeApBeaconingStopCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeApErrorIndSend + + DESCRIPTION + This primitve is sent by SME to indicate some error in AP operationi + after AP operations were started successfully and continuing the AP + operation may lead to undesired behaviour. It is the responsibility of + the upper layers to stop AP operation if needed + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Range 0-1 + apType - + status - Contains the error status + +*******************************************************************************/ +#define CsrWifiSmeApErrorIndCreate(msg__, dst__, src__, interfaceTag__, apType__, status__) \ + msg__ = (CsrWifiSmeApErrorInd *) CsrPmemAlloc(sizeof(CsrWifiSmeApErrorInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_ERROR_IND, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->apType = (apType__); \ + msg__->status = (status__); + +#define CsrWifiSmeApErrorIndSendTo(dst__, src__, interfaceTag__, apType__, status__) \ + { \ + CsrWifiSmeApErrorInd *msg__; \ + CsrWifiSmeApErrorIndCreate(msg__, dst__, src__, interfaceTag__, apType__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ + } + +#define CsrWifiSmeApErrorIndSend(dst__, interfaceTag__, apType__, status__) \ + CsrWifiSmeApErrorIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, apType__, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeApStaConnectStartIndSend + + DESCRIPTION + This primitive indicates that a stations request to join the group/BSS is + accepted + + PARAMETERS + queue - Destination Task Queue + interfaceTag - + peerMacAddress - + +*******************************************************************************/ +#define CsrWifiSmeApStaConnectStartIndCreate(msg__, dst__, src__, interfaceTag__, peerMacAddress__) \ + msg__ = (CsrWifiSmeApStaConnectStartInd *) CsrPmemAlloc(sizeof(CsrWifiSmeApStaConnectStartInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_CONNECT_START_IND, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->peerMacAddress = (peerMacAddress__); + +#define CsrWifiSmeApStaConnectStartIndSendTo(dst__, src__, interfaceTag__, peerMacAddress__) \ + { \ + CsrWifiSmeApStaConnectStartInd *msg__; \ + CsrWifiSmeApStaConnectStartIndCreate(msg__, dst__, src__, interfaceTag__, peerMacAddress__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ + } + +#define CsrWifiSmeApStaConnectStartIndSend(dst__, interfaceTag__, peerMacAddress__) \ + CsrWifiSmeApStaConnectStartIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, peerMacAddress__) + +/******************************************************************************* + + NAME + CsrWifiSmeApStaDisconnectReqSend + + DESCRIPTION + This primitive tells SME to deauth ot disassociate a particular station + within BSS + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + deauthReason - + disassocReason - + peerMacaddress - + keepBlocking - If TRUE, the station is blocked. If FALSE and the station + is connected, disconnect the station. If FALSE and the + station is not connected, no action is taken. + +*******************************************************************************/ +#define CsrWifiSmeApStaDisconnectReqCreate(msg__, dst__, src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__) \ + msg__ = (CsrWifiSmeApStaDisconnectReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApStaDisconnectReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_DISCONNECT_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->deauthReason = (deauthReason__); \ + msg__->disassocReason = (disassocReason__); \ + msg__->peerMacaddress = (peerMacaddress__); \ + msg__->keepBlocking = (keepBlocking__); + +#define CsrWifiSmeApStaDisconnectReqSendTo(dst__, src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__) \ + { \ + CsrWifiSmeApStaDisconnectReq *msg__; \ + CsrWifiSmeApStaDisconnectReqCreate(msg__, dst__, src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ + } + +#define CsrWifiSmeApStaDisconnectReqSend(src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__) \ + CsrWifiSmeApStaDisconnectReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__) + +/******************************************************************************* + + NAME + CsrWifiSmeApStaDisconnectCfmSend + + DESCRIPTION + This primitive confirms the station is disconnected + + PARAMETERS + queue - Destination Task Queue + interfaceTag - + status - + peerMacaddress - + +*******************************************************************************/ +#define CsrWifiSmeApStaDisconnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__, peerMacaddress__) \ + msg__ = (CsrWifiSmeApStaDisconnectCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApStaDisconnectCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_DISCONNECT_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); \ + msg__->peerMacaddress = (peerMacaddress__); + +#define CsrWifiSmeApStaDisconnectCfmSendTo(dst__, src__, interfaceTag__, status__, peerMacaddress__) \ + { \ + CsrWifiSmeApStaDisconnectCfm *msg__; \ + CsrWifiSmeApStaDisconnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__, peerMacaddress__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ + } + +#define CsrWifiSmeApStaDisconnectCfmSend(dst__, interfaceTag__, status__, peerMacaddress__) \ + CsrWifiSmeApStaDisconnectCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, peerMacaddress__) + +/******************************************************************************* + + NAME + CsrWifiSmeApStaNotifyIndSend + + DESCRIPTION + This primitive indicates that a station has joined or a previously joined + station has left the BSS/group + + PARAMETERS + queue - Destination Task Queue + interfaceTag - + mediaStatus - + peerMacAddress - + peerDeviceAddress - + disassocReason - + deauthReason - + WpsRegistration - + secIeLength - + secIe - + groupKeyId - + seqNumber - + +*******************************************************************************/ +#define CsrWifiSmeApStaNotifyIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__) \ + msg__ = (CsrWifiSmeApStaNotifyInd *) CsrPmemAlloc(sizeof(CsrWifiSmeApStaNotifyInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_NOTIFY_IND, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->mediaStatus = (mediaStatus__); \ + msg__->peerMacAddress = (peerMacAddress__); \ + msg__->peerDeviceAddress = (peerDeviceAddress__); \ + msg__->disassocReason = (disassocReason__); \ + msg__->deauthReason = (deauthReason__); \ + msg__->WpsRegistration = (WpsRegistration__); \ + msg__->secIeLength = (secIeLength__); \ + msg__->secIe = (secIe__); \ + msg__->groupKeyId = (groupKeyId__); \ + CsrMemCpy(msg__->seqNumber, (seqNumber__), sizeof(CsrUint16) * 8); + +#define CsrWifiSmeApStaNotifyIndSendTo(dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__) \ + { \ + CsrWifiSmeApStaNotifyInd *msg__; \ + CsrWifiSmeApStaNotifyIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ + } + +#define CsrWifiSmeApStaNotifyIndSend(dst__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__) \ + CsrWifiSmeApStaNotifyIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__) + +/******************************************************************************* + + NAME + CsrWifiSmeApWmmParamUpdateReqSend + + DESCRIPTION + Application uses this primitive to update the WMM parameters on the fly + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + wmmApParams - WMM parameters to be used for local firmware queue + configuration + wmmApBcParams - WMM parameters to be advertised in beacon/probe response + +*******************************************************************************/ +#define CsrWifiSmeApWmmParamUpdateReqCreate(msg__, dst__, src__, interfaceTag__, wmmApParams__, wmmApBcParams__) \ + msg__ = (CsrWifiSmeApWmmParamUpdateReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApWmmParamUpdateReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WMM_PARAM_UPDATE_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + CsrMemCpy(msg__->wmmApParams, (wmmApParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); \ + CsrMemCpy(msg__->wmmApBcParams, (wmmApBcParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); + +#define CsrWifiSmeApWmmParamUpdateReqSendTo(dst__, src__, interfaceTag__, wmmApParams__, wmmApBcParams__) \ + { \ + CsrWifiSmeApWmmParamUpdateReq *msg__; \ + CsrWifiSmeApWmmParamUpdateReqCreate(msg__, dst__, src__, interfaceTag__, wmmApParams__, wmmApBcParams__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ + } + +#define CsrWifiSmeApWmmParamUpdateReqSend(src__, interfaceTag__, wmmApParams__, wmmApBcParams__) \ + CsrWifiSmeApWmmParamUpdateReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, wmmApParams__, wmmApBcParams__) + +/******************************************************************************* + + NAME + CsrWifiSmeApWmmParamUpdateCfmSend + + DESCRIPTION + A confirm for CSR_WIFI_SME_AP_WMM_PARAM_UPDATE.request + + PARAMETERS + queue - Destination Task Queue + interfaceTag - + status - + +*******************************************************************************/ +#define CsrWifiSmeApWmmParamUpdateCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ + msg__ = (CsrWifiSmeApWmmParamUpdateCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApWmmParamUpdateCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WMM_PARAM_UPDATE_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); + +#define CsrWifiSmeApWmmParamUpdateCfmSendTo(dst__, src__, interfaceTag__, status__) \ + { \ + CsrWifiSmeApWmmParamUpdateCfm *msg__; \ + CsrWifiSmeApWmmParamUpdateCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ + } + +#define CsrWifiSmeApWmmParamUpdateCfmSend(dst__, interfaceTag__, status__) \ + CsrWifiSmeApWmmParamUpdateCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeApWpsConfigurationReqSend + + DESCRIPTION + This primitive passes the WPS information for the device to SME. This may + be accepted only if no interface is active. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + wpsConfig - WPS config. + +*******************************************************************************/ +#define CsrWifiSmeApWpsConfigurationReqCreate(msg__, dst__, src__, wpsConfig__) \ + msg__ = (CsrWifiSmeApWpsConfigurationReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApWpsConfigurationReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_CONFIGURATION_REQ, dst__, src__); \ + msg__->wpsConfig = (wpsConfig__); + +#define CsrWifiSmeApWpsConfigurationReqSendTo(dst__, src__, wpsConfig__) \ + { \ + CsrWifiSmeApWpsConfigurationReq *msg__; \ + CsrWifiSmeApWpsConfigurationReqCreate(msg__, dst__, src__, wpsConfig__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ + } + +#define CsrWifiSmeApWpsConfigurationReqSend(src__, wpsConfig__) \ + CsrWifiSmeApWpsConfigurationReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, wpsConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmeApWpsConfigurationCfmSend + + DESCRIPTION + Confirm. + + PARAMETERS + queue - Destination Task Queue + status - Status of the request. + +*******************************************************************************/ +#define CsrWifiSmeApWpsConfigurationCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiSmeApWpsConfigurationCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApWpsConfigurationCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_CONFIGURATION_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiSmeApWpsConfigurationCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiSmeApWpsConfigurationCfm *msg__; \ + CsrWifiSmeApWpsConfigurationCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ + } + +#define CsrWifiSmeApWpsConfigurationCfmSend(dst__, status__) \ + CsrWifiSmeApWpsConfigurationCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeApWpsRegistrationFinishedReqSend + + DESCRIPTION + This primitive tells SME that WPS registration procedure has finished + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + +*******************************************************************************/ +#define CsrWifiSmeApWpsRegistrationFinishedReqCreate(msg__, dst__, src__, interfaceTag__) \ + msg__ = (CsrWifiSmeApWpsRegistrationFinishedReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApWpsRegistrationFinishedReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_FINISHED_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); + +#define CsrWifiSmeApWpsRegistrationFinishedReqSendTo(dst__, src__, interfaceTag__) \ + { \ + CsrWifiSmeApWpsRegistrationFinishedReq *msg__; \ + CsrWifiSmeApWpsRegistrationFinishedReqCreate(msg__, dst__, src__, interfaceTag__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ + } + +#define CsrWifiSmeApWpsRegistrationFinishedReqSend(src__, interfaceTag__) \ + CsrWifiSmeApWpsRegistrationFinishedReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__) + +/******************************************************************************* + + NAME + CsrWifiSmeApWpsRegistrationFinishedCfmSend + + DESCRIPTION + A confirm for UNIFI_MGT_AP_WPS_REGISTRATION_FINISHED.request + + PARAMETERS + queue - Destination Task Queue + interfaceTag - + status - + +*******************************************************************************/ +#define CsrWifiSmeApWpsRegistrationFinishedCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ + msg__ = (CsrWifiSmeApWpsRegistrationFinishedCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApWpsRegistrationFinishedCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_FINISHED_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); + +#define CsrWifiSmeApWpsRegistrationFinishedCfmSendTo(dst__, src__, interfaceTag__, status__) \ + { \ + CsrWifiSmeApWpsRegistrationFinishedCfm *msg__; \ + CsrWifiSmeApWpsRegistrationFinishedCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ + } + +#define CsrWifiSmeApWpsRegistrationFinishedCfmSend(dst__, interfaceTag__, status__) \ + CsrWifiSmeApWpsRegistrationFinishedCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeApWpsRegistrationStartedReqSend + + DESCRIPTION + This primitive tells SME that WPS registration procedure has started + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + SelectedDevicePasswordId - + SelectedconfigMethod - + +*******************************************************************************/ +#define CsrWifiSmeApWpsRegistrationStartedReqCreate(msg__, dst__, src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__) \ + msg__ = (CsrWifiSmeApWpsRegistrationStartedReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApWpsRegistrationStartedReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_STARTED_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->SelectedDevicePasswordId = (SelectedDevicePasswordId__); \ + msg__->SelectedconfigMethod = (SelectedconfigMethod__); + +#define CsrWifiSmeApWpsRegistrationStartedReqSendTo(dst__, src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__) \ + { \ + CsrWifiSmeApWpsRegistrationStartedReq *msg__; \ + CsrWifiSmeApWpsRegistrationStartedReqCreate(msg__, dst__, src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ + } + +#define CsrWifiSmeApWpsRegistrationStartedReqSend(src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__) \ + CsrWifiSmeApWpsRegistrationStartedReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__) + +/******************************************************************************* + + NAME + CsrWifiSmeApWpsRegistrationStartedCfmSend + + DESCRIPTION + A confirm for UNIFI_MGT_AP_WPS_REGISTRATION_STARTED.request + + PARAMETERS + queue - Destination Task Queue + interfaceTag - + status - + +*******************************************************************************/ +#define CsrWifiSmeApWpsRegistrationStartedCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ + msg__ = (CsrWifiSmeApWpsRegistrationStartedCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApWpsRegistrationStartedCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_STARTED_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); + +#define CsrWifiSmeApWpsRegistrationStartedCfmSendTo(dst__, src__, interfaceTag__, status__) \ + { \ + CsrWifiSmeApWpsRegistrationStartedCfm *msg__; \ + CsrWifiSmeApWpsRegistrationStartedCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ + } + +#define CsrWifiSmeApWpsRegistrationStartedCfmSend(dst__, interfaceTag__, status__) \ + CsrWifiSmeApWpsRegistrationStartedCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) + + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_SME_AP_LIB_H__ */ diff --git a/drivers/staging/csr/csr_wifi_sme_ap_prim.h b/drivers/staging/csr/csr_wifi_sme_ap_prim.h new file mode 100644 index 0000000..3310cd2 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_sme_ap_prim.h @@ -0,0 +1,904 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_SME_AP_PRIM_H__ +#define CSR_WIFI_SME_AP_PRIM_H__ + +#include "csr_types.h" +#include "csr_prim_defs.h" +#include "csr_sched.h" +#include "csr_wifi_common.h" +#include "csr_result.h" +#include "csr_wifi_fsm_event.h" +#include "csr_wifi_sme_prim.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CSR_WIFI_AP_ENABLE +#error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_sme_ap_prim.h +#endif + +#define CSR_WIFI_SME_AP_PRIM (0x0407) + +typedef CsrPrim CsrWifiSmeApPrim; + + +/******************************************************************************* + + NAME + CsrWifiSmeApAccessType + + DESCRIPTION + Allow or deny STAs based on MAC address + + VALUES + CSR_WIFI_AP_ACCESS_TYPE_NONE - None + CSR_WIFI_AP_ACCESS_TYPE_ALLOW - Allow only if MAC address is from the list + CSR_WIFI_AP_ACCESS_TYPE_DENY - Disallow if MAC address is from the list + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeApAccessType; +#define CSR_WIFI_AP_ACCESS_TYPE_NONE ((CsrWifiSmeApAccessType) 0x00) +#define CSR_WIFI_AP_ACCESS_TYPE_ALLOW ((CsrWifiSmeApAccessType) 0x01) +#define CSR_WIFI_AP_ACCESS_TYPE_DENY ((CsrWifiSmeApAccessType) 0x02) + +/******************************************************************************* + + NAME + CsrWifiSmeApAuthSupport + + DESCRIPTION + Define bits for AP authentication support + + VALUES + CSR_WIFI_SME_RSN_AUTH_WPAPSK - RSN WPA-PSK Support + CSR_WIFI_SME_RSN_AUTH_WPA2PSK - RSN WPA2-PSK Support + CSR_WIFI_SME_AUTH_WAPIPSK - WAPI-PSK Support + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeApAuthSupport; +#define CSR_WIFI_SME_RSN_AUTH_WPAPSK ((CsrWifiSmeApAuthSupport) 0x01) +#define CSR_WIFI_SME_RSN_AUTH_WPA2PSK ((CsrWifiSmeApAuthSupport) 0x02) +#define CSR_WIFI_SME_AUTH_WAPIPSK ((CsrWifiSmeApAuthSupport) 0x04) + +/******************************************************************************* + + NAME + CsrWifiSmeApAuthType + + DESCRIPTION + Definition of the SME AP Authentication Options + + VALUES + CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM + - Open authentication + CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL + - Personal authentication using a passphrase or a pre-shared + key. + CSR_WIFI_SME_AP_AUTH_TYPE_WEP + - WEP authentication. This can be either open or shared key + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeApAuthType; +#define CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM ((CsrWifiSmeApAuthType) 0x00) +#define CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL ((CsrWifiSmeApAuthType) 0x01) +#define CSR_WIFI_SME_AP_AUTH_TYPE_WEP ((CsrWifiSmeApAuthType) 0x02) + +/******************************************************************************* + + NAME + CsrWifiSmeApPhySupport + + DESCRIPTION + Define bits for CsrWifiSmeApPhySupportMask + + VALUES + CSR_WIFI_SME_AP_PHY_SUPPORT_A - 802.11a. It is not supported in the current + release. + CSR_WIFI_SME_AP_PHY_SUPPORT_B - 802.11b + CSR_WIFI_SME_AP_PHY_SUPPORT_G - 802.11g + CSR_WIFI_SME_AP_PHY_SUPPORT_N - 802.11n + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeApPhySupport; +#define CSR_WIFI_SME_AP_PHY_SUPPORT_A ((CsrWifiSmeApPhySupport) 0x01) +#define CSR_WIFI_SME_AP_PHY_SUPPORT_B ((CsrWifiSmeApPhySupport) 0x02) +#define CSR_WIFI_SME_AP_PHY_SUPPORT_G ((CsrWifiSmeApPhySupport) 0x04) +#define CSR_WIFI_SME_AP_PHY_SUPPORT_N ((CsrWifiSmeApPhySupport) 0x08) + +/******************************************************************************* + + NAME + CsrWifiSmeApType + + DESCRIPTION + Definition of AP types + + VALUES + CSR_WIFI_AP_TYPE_LEGACY - Legacy AP + CSR_WIFI_AP_TYPE_P2P - P2P Group Owner(GO) + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeApType; +#define CSR_WIFI_AP_TYPE_LEGACY ((CsrWifiSmeApType) 0x00) +#define CSR_WIFI_AP_TYPE_P2P ((CsrWifiSmeApType) 0x01) + + +/******************************************************************************* + + NAME + CsrWifiSmeApAuthSupportMask + + DESCRIPTION + See CsrWifiSmeApAuthSupport for bit definitions + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeApAuthSupportMask; +/******************************************************************************* + + NAME + CsrWifiSmeApPhySupportMask + + DESCRIPTION + Mask type for use with the values defined by CsrWifiSmeApPhySupport + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeApPhySupportMask; +/******************************************************************************* + + NAME + CsrWifiSmeApRsnCapabilities + + DESCRIPTION + Set to 0 for the current release + +*******************************************************************************/ +typedef CsrUint16 CsrWifiSmeApRsnCapabilities; +/******************************************************************************* + + NAME + CsrWifiSmeApRsnCapabilitiesMask + + DESCRIPTION + Mask type for use with the values defined by CsrWifiSmeApRsnCapabilities + +*******************************************************************************/ +typedef CsrUint16 CsrWifiSmeApRsnCapabilitiesMask; +/******************************************************************************* + + NAME + CsrWifiSmeApWapiCapabilities + + DESCRIPTION + Ignored by the stack as WAPI is not supported for AP operations in the + current release + +*******************************************************************************/ +typedef CsrUint16 CsrWifiSmeApWapiCapabilities; +/******************************************************************************* + + NAME + CsrWifiSmeApWapiCapabilitiesMask + + DESCRIPTION + Mask type for use with the values defined by CsrWifiSmeApWapiCapabilities + +*******************************************************************************/ +typedef CsrUint16 CsrWifiSmeApWapiCapabilitiesMask; + + +/******************************************************************************* + + NAME + CsrWifiSmeApHtParams + + DESCRIPTION + Structure holding HT parameters + + MEMBERS + greenfieldSupported - Indicates if the AP supports Htgreenfield operation + subject to the chip capability. If the chip does not + support Htgreenfield operation, this parameter will be + ignored. + NOTE: if shortGi20MHz is set to TRUE and the chip + supports short GI operation for 20MHz this field will + be be ignored and the AP will not support Htgreenfield + operation. + NOTE: This field is ignored by the Wi-Fi stack for the + current release. It implies that AP does not support + greenfield operation. + shortGi20MHz - Indicates if the AP support short GI operation for + 20MHz subject to the chip capability.If the chip does + not support short GI for 20MHz, this parameter is + ignored + rxStbc - Support for STBC for receive. 0 => No support for STBC + , 1=> Use STBC for Rx + rifsModeAllowed - RIFS Mode is allowed to protect overlapping non-HT BSS + htProtection - Deprecated + dualCtsProtection - Dual CTS Protection enabled + +*******************************************************************************/ +typedef struct +{ + CsrBool greenfieldSupported; + CsrBool shortGi20MHz; + CsrUint8 rxStbc; + CsrBool rifsModeAllowed; + CsrUint8 htProtection; + CsrBool dualCtsProtection; +} CsrWifiSmeApHtParams; + +/******************************************************************************* + + NAME + CsrWifiSmeApP2pOperatingChanEntry + + DESCRIPTION + + MEMBERS + operatingClass - Channel operating class + operatingChannelCount - Number of channels in this entry + operatingChannel - List of channels + +*******************************************************************************/ +typedef struct +{ + CsrUint8 operatingClass; + CsrUint8 operatingChannelCount; + CsrUint8 *operatingChannel; +} CsrWifiSmeApP2pOperatingChanEntry; + +/******************************************************************************* + + NAME + CsrWifiSmeApP2pOperatingChanList + + DESCRIPTION + This structure contains the lists of P2P operating channels + + MEMBERS + country - Country + channelEntryListCount - Number of entries + channelEntryList - List of entries + +*******************************************************************************/ +typedef struct +{ + CsrUint8 country[3]; + CsrUint8 channelEntryListCount; + CsrWifiSmeApP2pOperatingChanEntry *channelEntryList; +} CsrWifiSmeApP2pOperatingChanList; + +/******************************************************************************* + + NAME + CsrWifiSmeApAuthPers + + DESCRIPTION + + MEMBERS + authSupport - + encryptionModeMask - + rsnCapabilities - + wapiCapabilities - + +*******************************************************************************/ +typedef struct +{ + CsrWifiSmeApAuthSupportMask authSupport; + CsrWifiSmeEncryptionMask encryptionModeMask; + CsrWifiSmeApRsnCapabilitiesMask rsnCapabilities; + CsrWifiSmeApWapiCapabilitiesMask wapiCapabilities; +} CsrWifiSmeApAuthPers; + +/******************************************************************************* + + NAME + CsrWifiSmeApMacConfig + + DESCRIPTION + Structure holding AP MAC configuration. + + MEMBERS + phySupportedBitmap - Indicates supported physical layers + beaconInterval - Beacon interval in terms of TUs + dtimPeriod - DTIM period in terms of number of beacon intervals + maxListenInterval - Maximum allowed listen interval as number of beacon + intervals + supportedRatesCount - Number of supported rates. Range : 0 to 20 + supportedRates - List of supportedRates. A rate is specied in the + units of 500kbps. An entry for a basic rate shall + have the MSB set to 1. + preamble - Preamble to be advertised in beacons and probe + responses + shortSlotTimeEnabled - TRUE indicates the AP shall use short slot time if + all the stations use short slot operation. + ctsProtectionType - CTS protection to be used + wmmEnabled - Indicate whether WMM is enabled or not. If set to + FALSE,the WMM parameters shall be ignored by the + receiver. + wmmApParams - WMM parameters to be used for local firmware queue + configuration. Array index corresponds to the ACI. + wmmApBcParams - WMM parameters to be advertised in beacon/probe + response. Array index corresponds to the ACI + accessType - Specifies whether the MAC addresses from the list + should be allowed or denied + macAddressListCount - Number of MAC addresses + macAddressList - List of MAC addresses + apHtParams - AP HT parameters. The stack shall use these + parameters only if phySupportedBitmap indicates + support for IEEE 802.11n + +*******************************************************************************/ +typedef struct +{ + CsrWifiSmeApPhySupportMask phySupportedBitmap; + CsrUint16 beaconInterval; + CsrUint8 dtimPeriod; + CsrUint16 maxListenInterval; + CsrUint8 supportedRatesCount; + CsrUint8 supportedRates[20]; + CsrWifiSmePreambleType preamble; + CsrBool shortSlotTimeEnabled; + CsrWifiSmeCtsProtectionType ctsProtectionType; + CsrBool wmmEnabled; + CsrWifiSmeWmmAcParams wmmApParams[4]; + CsrWifiSmeWmmAcParams wmmApBcParams[4]; + CsrWifiSmeApAccessType accessType; + CsrUint8 macAddressListCount; + CsrWifiMacAddress *macAddressList; + CsrWifiSmeApHtParams apHtParams; +} CsrWifiSmeApMacConfig; + +/******************************************************************************* + + NAME + CsrWifiSmeApP2pGoConfig + + DESCRIPTION + + MEMBERS + groupCapability - Indicates the P2P group capabilities + operatingChanList - List of operating channels in the order of + decreasing priority. It may contain channel + entry/entries not supported by the wifi stack. + These shall be filtered out by the wifi stack + opPsEnabled - Indicates whether opportunistic power save can + be used. + Note: This parameter is ignored by the WiFi + stack for the current release + ctWindow - Define Client Traffic window to be used in terms + of number of TUs. Range: 0 to 127. + Note: This parameter is ignored by the WiFi + stack for the current release. + noaConfigMethod - Notice of Absence configuration method. + Note: This parameter is ignored by the WiFi + stack for the current release. + allowNoaWithNonP2pDevices - Indicates if NOA should be allowed if non P2P + devices are connected. If allowed the non P2P + devices may suffer in throughput. + Note: This parameter is ignored by the WiFi + stack for the current release. + +*******************************************************************************/ +typedef struct +{ + CsrWifiSmeP2pGroupCapabilityMask groupCapability; + CsrWifiSmeApP2pOperatingChanList operatingChanList; + CsrBool opPsEnabled; + CsrUint8 ctWindow; + CsrWifiSmeP2pNoaConfigMethod noaConfigMethod; + CsrBool allowNoaWithNonP2pDevices; +} CsrWifiSmeApP2pGoConfig; + +/******************************************************************************* + + NAME + CsrWifiSmeApCredentials + + DESCRIPTION + + MEMBERS + authType - + smeAuthType - + smeAuthTypeopenSystemEmpty - + smeAuthTypeauthwep - + smeAuthTypeauthPers - + +*******************************************************************************/ +typedef struct +{ + CsrWifiSmeApAuthType authType; + union { + CsrWifiSmeEmpty openSystemEmpty; + CsrWifiSmeWepAuth authwep; + CsrWifiSmeApAuthPers authPers; + } smeAuthType; +} CsrWifiSmeApCredentials; + +/******************************************************************************* + + NAME + CsrWifiSmeApSecConfig + + DESCRIPTION + + MEMBERS + apCredentials - + wpsEnabled - + +*******************************************************************************/ +typedef struct +{ + CsrWifiSmeApCredentials apCredentials; + CsrBool wpsEnabled; +} CsrWifiSmeApSecConfig; + + +/* Downstream */ +#define CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST (0x0000) + +#define CSR_WIFI_SME_AP_BEACONING_START_REQ ((CsrWifiSmeApPrim) (0x0000 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_AP_BEACONING_STOP_REQ ((CsrWifiSmeApPrim) (0x0001 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_AP_WPS_REGISTRATION_STARTED_REQ ((CsrWifiSmeApPrim) (0x0002 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_AP_WPS_REGISTRATION_FINISHED_REQ ((CsrWifiSmeApPrim) (0x0003 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_AP_WMM_PARAM_UPDATE_REQ ((CsrWifiSmeApPrim) (0x0004 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_AP_STA_DISCONNECT_REQ ((CsrWifiSmeApPrim) (0x0005 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_AP_WPS_CONFIGURATION_REQ ((CsrWifiSmeApPrim) (0x0006 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST)) + + +#define CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_HIGHEST (0x0006 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST) + +/* Upstream */ +#define CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST (0x0000 + CSR_PRIM_UPSTREAM) + +#define CSR_WIFI_SME_AP_BEACONING_START_CFM ((CsrWifiSmeApPrim)(0x0000 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_AP_BEACONING_STOP_CFM ((CsrWifiSmeApPrim)(0x0001 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_AP_STA_NOTIFY_IND ((CsrWifiSmeApPrim)(0x0002 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_AP_STA_CONNECT_START_IND ((CsrWifiSmeApPrim)(0x0003 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_AP_WPS_REGISTRATION_STARTED_CFM ((CsrWifiSmeApPrim)(0x0004 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_AP_WPS_REGISTRATION_FINISHED_CFM ((CsrWifiSmeApPrim)(0x0005 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_AP_WMM_PARAM_UPDATE_CFM ((CsrWifiSmeApPrim)(0x0006 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_AP_STA_DISCONNECT_CFM ((CsrWifiSmeApPrim)(0x0007 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_AP_WPS_CONFIGURATION_CFM ((CsrWifiSmeApPrim)(0x0008 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_AP_ERROR_IND ((CsrWifiSmeApPrim)(0x0009 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) + +#define CSR_WIFI_SME_AP_PRIM_UPSTREAM_HIGHEST (0x0009 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST) + +#define CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_COUNT (CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_HIGHEST + 1 - CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST) +#define CSR_WIFI_SME_AP_PRIM_UPSTREAM_COUNT (CSR_WIFI_SME_AP_PRIM_UPSTREAM_HIGHEST + 1 - CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST) + +/******************************************************************************* + + NAME + CsrWifiSmeApBeaconingStartReq + + DESCRIPTION + This primitive requests the SME to start AP or GO functionality + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + initialPresence - Set to 0, if Not in a group fomration phase, set to 1 , + during group formation phase + apType - apType : Legacy AP or P2PGO + cloakSsid - cloakSsid flag. + ssid - ssid. + ifIndex - Radio Interface + channel - channel. + maxConnections - Maximum Stations + P2PClients allowed + apCredentials - AP security credeitals used to advertise in beacon /probe + response + smeApConfig - AP configuration + p2pGoParam - P2P specific GO parameters. Ignored if it is a leagacy AP + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrUint8 initialPresence; + CsrWifiSmeApType apType; + CsrBool cloakSsid; + CsrWifiSsid ssid; + CsrWifiSmeRadioIF ifIndex; + CsrUint8 channel; + CsrUint8 maxConnections; + CsrWifiSmeApSecConfig apCredentials; + CsrWifiSmeApMacConfig smeApConfig; + CsrWifiSmeApP2pGoConfig p2pGoParam; +} CsrWifiSmeApBeaconingStartReq; + +/******************************************************************************* + + NAME + CsrWifiSmeApBeaconingStopReq + + DESCRIPTION + This primitive requests the SME to STOP AP or P2PGO operation + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; +} CsrWifiSmeApBeaconingStopReq; + +/******************************************************************************* + + NAME + CsrWifiSmeApWpsRegistrationStartedReq + + DESCRIPTION + This primitive tells SME that WPS registration procedure has started + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + SelectedDevicePasswordId - + SelectedconfigMethod - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeWpsDpid SelectedDevicePasswordId; + CsrWifiSmeWpsConfigType SelectedconfigMethod; +} CsrWifiSmeApWpsRegistrationStartedReq; + +/******************************************************************************* + + NAME + CsrWifiSmeApWpsRegistrationFinishedReq + + DESCRIPTION + This primitive tells SME that WPS registration procedure has finished + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; +} CsrWifiSmeApWpsRegistrationFinishedReq; + +/******************************************************************************* + + NAME + CsrWifiSmeApWmmParamUpdateReq + + DESCRIPTION + Application uses this primitive to update the WMM parameters on the fly + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + wmmApParams - WMM parameters to be used for local firmware queue + configuration + wmmApBcParams - WMM parameters to be advertised in beacon/probe response + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeWmmAcParams wmmApParams[4]; + CsrWifiSmeWmmAcParams wmmApBcParams[4]; +} CsrWifiSmeApWmmParamUpdateReq; + +/******************************************************************************* + + NAME + CsrWifiSmeApStaDisconnectReq + + DESCRIPTION + This primitive tells SME to deauth ot disassociate a particular station + within BSS + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + deauthReason - + disassocReason - + peerMacaddress - + keepBlocking - If TRUE, the station is blocked. If FALSE and the station + is connected, disconnect the station. If FALSE and the + station is not connected, no action is taken. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeIEEE80211Reason deauthReason; + CsrWifiSmeIEEE80211Reason disassocReason; + CsrWifiMacAddress peerMacaddress; + CsrBool keepBlocking; +} CsrWifiSmeApStaDisconnectReq; + +/******************************************************************************* + + NAME + CsrWifiSmeApWpsConfigurationReq + + DESCRIPTION + This primitive passes the WPS information for the device to SME. This may + be accepted only if no interface is active. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + wpsConfig - WPS config. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiSmeWpsConfig wpsConfig; +} CsrWifiSmeApWpsConfigurationReq; + +/******************************************************************************* + + NAME + CsrWifiSmeApBeaconingStartCfm + + DESCRIPTION + This primitive confirms the completion of the request along with the + status + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + status - + secIeLength - + secIe - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; + CsrUint16 secIeLength; + CsrUint8 *secIe; +} CsrWifiSmeApBeaconingStartCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeApBeaconingStopCfm + + DESCRIPTION + This primitive confirms AP or P2PGO operation is terminated + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + status - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; +} CsrWifiSmeApBeaconingStopCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeApStaNotifyInd + + DESCRIPTION + This primitive indicates that a station has joined or a previously joined + station has left the BSS/group + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + mediaStatus - + peerMacAddress - + peerDeviceAddress - + disassocReason - + deauthReason - + WpsRegistration - + secIeLength - + secIe - + groupKeyId - + seqNumber - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeMediaStatus mediaStatus; + CsrWifiMacAddress peerMacAddress; + CsrWifiMacAddress peerDeviceAddress; + CsrWifiSmeIEEE80211Reason disassocReason; + CsrWifiSmeIEEE80211Reason deauthReason; + CsrWifiSmeWpsRegistration WpsRegistration; + CsrUint8 secIeLength; + CsrUint8 *secIe; + CsrUint8 groupKeyId; + CsrUint16 seqNumber[8]; +} CsrWifiSmeApStaNotifyInd; + +/******************************************************************************* + + NAME + CsrWifiSmeApStaConnectStartInd + + DESCRIPTION + This primitive indicates that a stations request to join the group/BSS is + accepted + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + peerMacAddress - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiMacAddress peerMacAddress; +} CsrWifiSmeApStaConnectStartInd; + +/******************************************************************************* + + NAME + CsrWifiSmeApWpsRegistrationStartedCfm + + DESCRIPTION + A confirm for UNIFI_MGT_AP_WPS_REGISTRATION_STARTED.request + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + status - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; +} CsrWifiSmeApWpsRegistrationStartedCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeApWpsRegistrationFinishedCfm + + DESCRIPTION + A confirm for UNIFI_MGT_AP_WPS_REGISTRATION_FINISHED.request + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + status - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; +} CsrWifiSmeApWpsRegistrationFinishedCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeApWmmParamUpdateCfm + + DESCRIPTION + A confirm for CSR_WIFI_SME_AP_WMM_PARAM_UPDATE.request + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + status - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; +} CsrWifiSmeApWmmParamUpdateCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeApStaDisconnectCfm + + DESCRIPTION + This primitive confirms the station is disconnected + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + status - + peerMacaddress - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; + CsrWifiMacAddress peerMacaddress; +} CsrWifiSmeApStaDisconnectCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeApWpsConfigurationCfm + + DESCRIPTION + Confirm. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Status of the request. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiSmeApWpsConfigurationCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeApErrorInd + + DESCRIPTION + This primitve is sent by SME to indicate some error in AP operationi + after AP operations were started successfully and continuing the AP + operation may lead to undesired behaviour. It is the responsibility of + the upper layers to stop AP operation if needed + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Range 0-1 + apType - + status - Contains the error status + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeApType apType; + CsrResult status; +} CsrWifiSmeApErrorInd; + + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_SME_AP_PRIM_H__ */ + diff --git a/drivers/staging/csr/csr_wifi_sme_converter_init.c b/drivers/staging/csr/csr_wifi_sme_converter_init.c new file mode 100644 index 0000000..bafd1b4 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_sme_converter_init.c @@ -0,0 +1,201 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#include "csr_msgconv.h" +#include "csr_pmem.h" +#include "csr_util.h" + + +#ifdef CSR_LOG_ENABLE +#include "csr_log.h" +#endif + +#ifndef EXCLUDE_CSR_WIFI_SME_MODULE +#include "csr_wifi_sme_serialize.h" +#include "csr_wifi_sme_prim.h" + +static CsrMsgConvMsgEntry csrwifisme_conv_lut[] = { + { CSR_WIFI_SME_ACTIVATE_REQ, CsrWifiSmeActivateReqSizeof, CsrWifiSmeActivateReqSer, CsrWifiSmeActivateReqDes, CsrWifiSmeActivateReqSerFree }, + { CSR_WIFI_SME_ADHOC_CONFIG_GET_REQ, CsrWifiSmeAdhocConfigGetReqSizeof, CsrWifiSmeAdhocConfigGetReqSer, CsrWifiSmeAdhocConfigGetReqDes, CsrWifiSmeAdhocConfigGetReqSerFree }, + { CSR_WIFI_SME_ADHOC_CONFIG_SET_REQ, CsrWifiSmeAdhocConfigSetReqSizeof, CsrWifiSmeAdhocConfigSetReqSer, CsrWifiSmeAdhocConfigSetReqDes, CsrWifiSmeAdhocConfigSetReqSerFree }, + { CSR_WIFI_SME_BLACKLIST_REQ, CsrWifiSmeBlacklistReqSizeof, CsrWifiSmeBlacklistReqSer, CsrWifiSmeBlacklistReqDes, CsrWifiSmeBlacklistReqSerFree }, + { CSR_WIFI_SME_CALIBRATION_DATA_GET_REQ, CsrWifiSmeCalibrationDataGetReqSizeof, CsrWifiSmeCalibrationDataGetReqSer, CsrWifiSmeCalibrationDataGetReqDes, CsrWifiSmeCalibrationDataGetReqSerFree }, + { CSR_WIFI_SME_CALIBRATION_DATA_SET_REQ, CsrWifiSmeCalibrationDataSetReqSizeof, CsrWifiSmeCalibrationDataSetReqSer, CsrWifiSmeCalibrationDataSetReqDes, CsrWifiSmeCalibrationDataSetReqSerFree }, + { CSR_WIFI_SME_CCX_CONFIG_GET_REQ, CsrWifiSmeCcxConfigGetReqSizeof, CsrWifiSmeCcxConfigGetReqSer, CsrWifiSmeCcxConfigGetReqDes, CsrWifiSmeCcxConfigGetReqSerFree }, + { CSR_WIFI_SME_CCX_CONFIG_SET_REQ, CsrWifiSmeCcxConfigSetReqSizeof, CsrWifiSmeCcxConfigSetReqSer, CsrWifiSmeCcxConfigSetReqDes, CsrWifiSmeCcxConfigSetReqSerFree }, + { CSR_WIFI_SME_COEX_CONFIG_GET_REQ, CsrWifiSmeCoexConfigGetReqSizeof, CsrWifiSmeCoexConfigGetReqSer, CsrWifiSmeCoexConfigGetReqDes, CsrWifiSmeCoexConfigGetReqSerFree }, + { CSR_WIFI_SME_COEX_CONFIG_SET_REQ, CsrWifiSmeCoexConfigSetReqSizeof, CsrWifiSmeCoexConfigSetReqSer, CsrWifiSmeCoexConfigSetReqDes, CsrWifiSmeCoexConfigSetReqSerFree }, + { CSR_WIFI_SME_COEX_INFO_GET_REQ, CsrWifiSmeCoexInfoGetReqSizeof, CsrWifiSmeCoexInfoGetReqSer, CsrWifiSmeCoexInfoGetReqDes, CsrWifiSmeCoexInfoGetReqSerFree }, + { CSR_WIFI_SME_CONNECT_REQ, CsrWifiSmeConnectReqSizeof, CsrWifiSmeConnectReqSer, CsrWifiSmeConnectReqDes, CsrWifiSmeConnectReqSerFree }, + { CSR_WIFI_SME_CONNECTION_CONFIG_GET_REQ, CsrWifiSmeConnectionConfigGetReqSizeof, CsrWifiSmeConnectionConfigGetReqSer, CsrWifiSmeConnectionConfigGetReqDes, CsrWifiSmeConnectionConfigGetReqSerFree }, + { CSR_WIFI_SME_CONNECTION_INFO_GET_REQ, CsrWifiSmeConnectionInfoGetReqSizeof, CsrWifiSmeConnectionInfoGetReqSer, CsrWifiSmeConnectionInfoGetReqDes, CsrWifiSmeConnectionInfoGetReqSerFree }, + { CSR_WIFI_SME_CONNECTION_STATS_GET_REQ, CsrWifiSmeConnectionStatsGetReqSizeof, CsrWifiSmeConnectionStatsGetReqSer, CsrWifiSmeConnectionStatsGetReqDes, CsrWifiSmeConnectionStatsGetReqSerFree }, + { CSR_WIFI_SME_DEACTIVATE_REQ, CsrWifiSmeDeactivateReqSizeof, CsrWifiSmeDeactivateReqSer, CsrWifiSmeDeactivateReqDes, CsrWifiSmeDeactivateReqSerFree }, + { CSR_WIFI_SME_DISCONNECT_REQ, CsrWifiSmeDisconnectReqSizeof, CsrWifiSmeDisconnectReqSer, CsrWifiSmeDisconnectReqDes, CsrWifiSmeDisconnectReqSerFree }, + { CSR_WIFI_SME_EVENT_MASK_SET_REQ, CsrWifiSmeEventMaskSetReqSizeof, CsrWifiSmeEventMaskSetReqSer, CsrWifiSmeEventMaskSetReqDes, CsrWifiSmeEventMaskSetReqSerFree }, + { CSR_WIFI_SME_HOST_CONFIG_GET_REQ, CsrWifiSmeHostConfigGetReqSizeof, CsrWifiSmeHostConfigGetReqSer, CsrWifiSmeHostConfigGetReqDes, CsrWifiSmeHostConfigGetReqSerFree }, + { CSR_WIFI_SME_HOST_CONFIG_SET_REQ, CsrWifiSmeHostConfigSetReqSizeof, CsrWifiSmeHostConfigSetReqSer, CsrWifiSmeHostConfigSetReqDes, CsrWifiSmeHostConfigSetReqSerFree }, + { CSR_WIFI_SME_KEY_REQ, CsrWifiSmeKeyReqSizeof, CsrWifiSmeKeyReqSer, CsrWifiSmeKeyReqDes, CsrWifiSmeKeyReqSerFree }, + { CSR_WIFI_SME_LINK_QUALITY_GET_REQ, CsrWifiSmeLinkQualityGetReqSizeof, CsrWifiSmeLinkQualityGetReqSer, CsrWifiSmeLinkQualityGetReqDes, CsrWifiSmeLinkQualityGetReqSerFree }, + { CSR_WIFI_SME_MIB_CONFIG_GET_REQ, CsrWifiSmeMibConfigGetReqSizeof, CsrWifiSmeMibConfigGetReqSer, CsrWifiSmeMibConfigGetReqDes, CsrWifiSmeMibConfigGetReqSerFree }, + { CSR_WIFI_SME_MIB_CONFIG_SET_REQ, CsrWifiSmeMibConfigSetReqSizeof, CsrWifiSmeMibConfigSetReqSer, CsrWifiSmeMibConfigSetReqDes, CsrWifiSmeMibConfigSetReqSerFree }, + { CSR_WIFI_SME_MIB_GET_NEXT_REQ, CsrWifiSmeMibGetNextReqSizeof, CsrWifiSmeMibGetNextReqSer, CsrWifiSmeMibGetNextReqDes, CsrWifiSmeMibGetNextReqSerFree }, + { CSR_WIFI_SME_MIB_GET_REQ, CsrWifiSmeMibGetReqSizeof, CsrWifiSmeMibGetReqSer, CsrWifiSmeMibGetReqDes, CsrWifiSmeMibGetReqSerFree }, + { CSR_WIFI_SME_MIB_SET_REQ, CsrWifiSmeMibSetReqSizeof, CsrWifiSmeMibSetReqSer, CsrWifiSmeMibSetReqDes, CsrWifiSmeMibSetReqSerFree }, + { CSR_WIFI_SME_MULTICAST_ADDRESS_REQ, CsrWifiSmeMulticastAddressReqSizeof, CsrWifiSmeMulticastAddressReqSer, CsrWifiSmeMulticastAddressReqDes, CsrWifiSmeMulticastAddressReqSerFree }, + { CSR_WIFI_SME_PACKET_FILTER_SET_REQ, CsrWifiSmePacketFilterSetReqSizeof, CsrWifiSmePacketFilterSetReqSer, CsrWifiSmePacketFilterSetReqDes, CsrWifiSmePacketFilterSetReqSerFree }, + { CSR_WIFI_SME_PERMANENT_MAC_ADDRESS_GET_REQ, CsrWifiSmePermanentMacAddressGetReqSizeof, CsrWifiSmePermanentMacAddressGetReqSer, CsrWifiSmePermanentMacAddressGetReqDes, CsrWifiSmePermanentMacAddressGetReqSerFree }, + { CSR_WIFI_SME_PMKID_REQ, CsrWifiSmePmkidReqSizeof, CsrWifiSmePmkidReqSer, CsrWifiSmePmkidReqDes, CsrWifiSmePmkidReqSerFree }, + { CSR_WIFI_SME_POWER_CONFIG_GET_REQ, CsrWifiSmePowerConfigGetReqSizeof, CsrWifiSmePowerConfigGetReqSer, CsrWifiSmePowerConfigGetReqDes, CsrWifiSmePowerConfigGetReqSerFree }, + { CSR_WIFI_SME_POWER_CONFIG_SET_REQ, CsrWifiSmePowerConfigSetReqSizeof, CsrWifiSmePowerConfigSetReqSer, CsrWifiSmePowerConfigSetReqDes, CsrWifiSmePowerConfigSetReqSerFree }, + { CSR_WIFI_SME_REGULATORY_DOMAIN_INFO_GET_REQ, CsrWifiSmeRegulatoryDomainInfoGetReqSizeof, CsrWifiSmeRegulatoryDomainInfoGetReqSer, CsrWifiSmeRegulatoryDomainInfoGetReqDes, CsrWifiSmeRegulatoryDomainInfoGetReqSerFree }, + { CSR_WIFI_SME_ROAMING_CONFIG_GET_REQ, CsrWifiSmeRoamingConfigGetReqSizeof, CsrWifiSmeRoamingConfigGetReqSer, CsrWifiSmeRoamingConfigGetReqDes, CsrWifiSmeRoamingConfigGetReqSerFree }, + { CSR_WIFI_SME_ROAMING_CONFIG_SET_REQ, CsrWifiSmeRoamingConfigSetReqSizeof, CsrWifiSmeRoamingConfigSetReqSer, CsrWifiSmeRoamingConfigSetReqDes, CsrWifiSmeRoamingConfigSetReqSerFree }, + { CSR_WIFI_SME_SCAN_CONFIG_GET_REQ, CsrWifiSmeScanConfigGetReqSizeof, CsrWifiSmeScanConfigGetReqSer, CsrWifiSmeScanConfigGetReqDes, CsrWifiSmeScanConfigGetReqSerFree }, + { CSR_WIFI_SME_SCAN_CONFIG_SET_REQ, CsrWifiSmeScanConfigSetReqSizeof, CsrWifiSmeScanConfigSetReqSer, CsrWifiSmeScanConfigSetReqDes, CsrWifiSmeScanConfigSetReqSerFree }, + { CSR_WIFI_SME_SCAN_FULL_REQ, CsrWifiSmeScanFullReqSizeof, CsrWifiSmeScanFullReqSer, CsrWifiSmeScanFullReqDes, CsrWifiSmeScanFullReqSerFree }, + { CSR_WIFI_SME_SCAN_RESULTS_FLUSH_REQ, CsrWifiSmeScanResultsFlushReqSizeof, CsrWifiSmeScanResultsFlushReqSer, CsrWifiSmeScanResultsFlushReqDes, CsrWifiSmeScanResultsFlushReqSerFree }, + { CSR_WIFI_SME_SCAN_RESULTS_GET_REQ, CsrWifiSmeScanResultsGetReqSizeof, CsrWifiSmeScanResultsGetReqSer, CsrWifiSmeScanResultsGetReqDes, CsrWifiSmeScanResultsGetReqSerFree }, + { CSR_WIFI_SME_SME_STA_CONFIG_GET_REQ, CsrWifiSmeSmeStaConfigGetReqSizeof, CsrWifiSmeSmeStaConfigGetReqSer, CsrWifiSmeSmeStaConfigGetReqDes, CsrWifiSmeSmeStaConfigGetReqSerFree }, + { CSR_WIFI_SME_SME_STA_CONFIG_SET_REQ, CsrWifiSmeSmeStaConfigSetReqSizeof, CsrWifiSmeSmeStaConfigSetReqSer, CsrWifiSmeSmeStaConfigSetReqDes, CsrWifiSmeSmeStaConfigSetReqSerFree }, + { CSR_WIFI_SME_STATION_MAC_ADDRESS_GET_REQ, CsrWifiSmeStationMacAddressGetReqSizeof, CsrWifiSmeStationMacAddressGetReqSer, CsrWifiSmeStationMacAddressGetReqDes, CsrWifiSmeStationMacAddressGetReqSerFree }, + { CSR_WIFI_SME_TSPEC_REQ, CsrWifiSmeTspecReqSizeof, CsrWifiSmeTspecReqSer, CsrWifiSmeTspecReqDes, CsrWifiSmeTspecReqSerFree }, + { CSR_WIFI_SME_VERSIONS_GET_REQ, CsrWifiSmeVersionsGetReqSizeof, CsrWifiSmeVersionsGetReqSer, CsrWifiSmeVersionsGetReqDes, CsrWifiSmeVersionsGetReqSerFree }, + { CSR_WIFI_SME_WIFI_FLIGHTMODE_REQ, CsrWifiSmeWifiFlightmodeReqSizeof, CsrWifiSmeWifiFlightmodeReqSer, CsrWifiSmeWifiFlightmodeReqDes, CsrWifiSmeWifiFlightmodeReqSerFree }, + { CSR_WIFI_SME_WIFI_OFF_REQ, CsrWifiSmeWifiOffReqSizeof, CsrWifiSmeWifiOffReqSer, CsrWifiSmeWifiOffReqDes, CsrWifiSmeWifiOffReqSerFree }, + { CSR_WIFI_SME_WIFI_ON_REQ, CsrWifiSmeWifiOnReqSizeof, CsrWifiSmeWifiOnReqSer, CsrWifiSmeWifiOnReqDes, CsrWifiSmeWifiOnReqSerFree }, + { CSR_WIFI_SME_CLOAKED_SSIDS_SET_REQ, CsrWifiSmeCloakedSsidsSetReqSizeof, CsrWifiSmeCloakedSsidsSetReqSer, CsrWifiSmeCloakedSsidsSetReqDes, CsrWifiSmeCloakedSsidsSetReqSerFree }, + { CSR_WIFI_SME_CLOAKED_SSIDS_GET_REQ, CsrWifiSmeCloakedSsidsGetReqSizeof, CsrWifiSmeCloakedSsidsGetReqSer, CsrWifiSmeCloakedSsidsGetReqDes, CsrWifiSmeCloakedSsidsGetReqSerFree }, + { CSR_WIFI_SME_SME_COMMON_CONFIG_GET_REQ, CsrWifiSmeSmeCommonConfigGetReqSizeof, CsrWifiSmeSmeCommonConfigGetReqSer, CsrWifiSmeSmeCommonConfigGetReqDes, CsrWifiSmeSmeCommonConfigGetReqSerFree }, + { CSR_WIFI_SME_SME_COMMON_CONFIG_SET_REQ, CsrWifiSmeSmeCommonConfigSetReqSizeof, CsrWifiSmeSmeCommonConfigSetReqSer, CsrWifiSmeSmeCommonConfigSetReqDes, CsrWifiSmeSmeCommonConfigSetReqSerFree }, + { CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_REQ, CsrWifiSmeInterfaceCapabilityGetReqSizeof, CsrWifiSmeInterfaceCapabilityGetReqSer, CsrWifiSmeInterfaceCapabilityGetReqDes, CsrWifiSmeInterfaceCapabilityGetReqSerFree }, + { CSR_WIFI_SME_WPS_CONFIGURATION_REQ, CsrWifiSmeWpsConfigurationReqSizeof, CsrWifiSmeWpsConfigurationReqSer, CsrWifiSmeWpsConfigurationReqDes, CsrWifiSmeWpsConfigurationReqSerFree }, + { CSR_WIFI_SME_ACTIVATE_CFM, CsrWifiSmeActivateCfmSizeof, CsrWifiSmeActivateCfmSer, CsrWifiSmeActivateCfmDes, CsrWifiSmeActivateCfmSerFree }, + { CSR_WIFI_SME_ADHOC_CONFIG_GET_CFM, CsrWifiSmeAdhocConfigGetCfmSizeof, CsrWifiSmeAdhocConfigGetCfmSer, CsrWifiSmeAdhocConfigGetCfmDes, CsrWifiSmeAdhocConfigGetCfmSerFree }, + { CSR_WIFI_SME_ADHOC_CONFIG_SET_CFM, CsrWifiSmeAdhocConfigSetCfmSizeof, CsrWifiSmeAdhocConfigSetCfmSer, CsrWifiSmeAdhocConfigSetCfmDes, CsrWifiSmeAdhocConfigSetCfmSerFree }, + { CSR_WIFI_SME_ASSOCIATION_COMPLETE_IND, CsrWifiSmeAssociationCompleteIndSizeof, CsrWifiSmeAssociationCompleteIndSer, CsrWifiSmeAssociationCompleteIndDes, CsrWifiSmeAssociationCompleteIndSerFree }, + { CSR_WIFI_SME_ASSOCIATION_START_IND, CsrWifiSmeAssociationStartIndSizeof, CsrWifiSmeAssociationStartIndSer, CsrWifiSmeAssociationStartIndDes, CsrWifiSmeAssociationStartIndSerFree }, + { CSR_WIFI_SME_BLACKLIST_CFM, CsrWifiSmeBlacklistCfmSizeof, CsrWifiSmeBlacklistCfmSer, CsrWifiSmeBlacklistCfmDes, CsrWifiSmeBlacklistCfmSerFree }, + { CSR_WIFI_SME_CALIBRATION_DATA_GET_CFM, CsrWifiSmeCalibrationDataGetCfmSizeof, CsrWifiSmeCalibrationDataGetCfmSer, CsrWifiSmeCalibrationDataGetCfmDes, CsrWifiSmeCalibrationDataGetCfmSerFree }, + { CSR_WIFI_SME_CALIBRATION_DATA_SET_CFM, CsrWifiSmeCalibrationDataSetCfmSizeof, CsrWifiSmeCalibrationDataSetCfmSer, CsrWifiSmeCalibrationDataSetCfmDes, CsrWifiSmeCalibrationDataSetCfmSerFree }, + { CSR_WIFI_SME_CCX_CONFIG_GET_CFM, CsrWifiSmeCcxConfigGetCfmSizeof, CsrWifiSmeCcxConfigGetCfmSer, CsrWifiSmeCcxConfigGetCfmDes, CsrWifiSmeCcxConfigGetCfmSerFree }, + { CSR_WIFI_SME_CCX_CONFIG_SET_CFM, CsrWifiSmeCcxConfigSetCfmSizeof, CsrWifiSmeCcxConfigSetCfmSer, CsrWifiSmeCcxConfigSetCfmDes, CsrWifiSmeCcxConfigSetCfmSerFree }, + { CSR_WIFI_SME_COEX_CONFIG_GET_CFM, CsrWifiSmeCoexConfigGetCfmSizeof, CsrWifiSmeCoexConfigGetCfmSer, CsrWifiSmeCoexConfigGetCfmDes, CsrWifiSmeCoexConfigGetCfmSerFree }, + { CSR_WIFI_SME_COEX_CONFIG_SET_CFM, CsrWifiSmeCoexConfigSetCfmSizeof, CsrWifiSmeCoexConfigSetCfmSer, CsrWifiSmeCoexConfigSetCfmDes, CsrWifiSmeCoexConfigSetCfmSerFree }, + { CSR_WIFI_SME_COEX_INFO_GET_CFM, CsrWifiSmeCoexInfoGetCfmSizeof, CsrWifiSmeCoexInfoGetCfmSer, CsrWifiSmeCoexInfoGetCfmDes, CsrWifiSmeCoexInfoGetCfmSerFree }, + { CSR_WIFI_SME_CONNECT_CFM, CsrWifiSmeConnectCfmSizeof, CsrWifiSmeConnectCfmSer, CsrWifiSmeConnectCfmDes, CsrWifiSmeConnectCfmSerFree }, + { CSR_WIFI_SME_CONNECTION_CONFIG_GET_CFM, CsrWifiSmeConnectionConfigGetCfmSizeof, CsrWifiSmeConnectionConfigGetCfmSer, CsrWifiSmeConnectionConfigGetCfmDes, CsrWifiSmeConnectionConfigGetCfmSerFree }, + { CSR_WIFI_SME_CONNECTION_INFO_GET_CFM, CsrWifiSmeConnectionInfoGetCfmSizeof, CsrWifiSmeConnectionInfoGetCfmSer, CsrWifiSmeConnectionInfoGetCfmDes, CsrWifiSmeConnectionInfoGetCfmSerFree }, + { CSR_WIFI_SME_CONNECTION_QUALITY_IND, CsrWifiSmeConnectionQualityIndSizeof, CsrWifiSmeConnectionQualityIndSer, CsrWifiSmeConnectionQualityIndDes, CsrWifiSmeConnectionQualityIndSerFree }, + { CSR_WIFI_SME_CONNECTION_STATS_GET_CFM, CsrWifiSmeConnectionStatsGetCfmSizeof, CsrWifiSmeConnectionStatsGetCfmSer, CsrWifiSmeConnectionStatsGetCfmDes, CsrWifiSmeConnectionStatsGetCfmSerFree }, + { CSR_WIFI_SME_DEACTIVATE_CFM, CsrWifiSmeDeactivateCfmSizeof, CsrWifiSmeDeactivateCfmSer, CsrWifiSmeDeactivateCfmDes, CsrWifiSmeDeactivateCfmSerFree }, + { CSR_WIFI_SME_DISCONNECT_CFM, CsrWifiSmeDisconnectCfmSizeof, CsrWifiSmeDisconnectCfmSer, CsrWifiSmeDisconnectCfmDes, CsrWifiSmeDisconnectCfmSerFree }, + { CSR_WIFI_SME_EVENT_MASK_SET_CFM, CsrWifiSmeEventMaskSetCfmSizeof, CsrWifiSmeEventMaskSetCfmSer, CsrWifiSmeEventMaskSetCfmDes, CsrWifiSmeEventMaskSetCfmSerFree }, + { CSR_WIFI_SME_HOST_CONFIG_GET_CFM, CsrWifiSmeHostConfigGetCfmSizeof, CsrWifiSmeHostConfigGetCfmSer, CsrWifiSmeHostConfigGetCfmDes, CsrWifiSmeHostConfigGetCfmSerFree }, + { CSR_WIFI_SME_HOST_CONFIG_SET_CFM, CsrWifiSmeHostConfigSetCfmSizeof, CsrWifiSmeHostConfigSetCfmSer, CsrWifiSmeHostConfigSetCfmDes, CsrWifiSmeHostConfigSetCfmSerFree }, + { CSR_WIFI_SME_IBSS_STATION_IND, CsrWifiSmeIbssStationIndSizeof, CsrWifiSmeIbssStationIndSer, CsrWifiSmeIbssStationIndDes, CsrWifiSmeIbssStationIndSerFree }, + { CSR_WIFI_SME_KEY_CFM, CsrWifiSmeKeyCfmSizeof, CsrWifiSmeKeyCfmSer, CsrWifiSmeKeyCfmDes, CsrWifiSmeKeyCfmSerFree }, + { CSR_WIFI_SME_LINK_QUALITY_GET_CFM, CsrWifiSmeLinkQualityGetCfmSizeof, CsrWifiSmeLinkQualityGetCfmSer, CsrWifiSmeLinkQualityGetCfmDes, CsrWifiSmeLinkQualityGetCfmSerFree }, + { CSR_WIFI_SME_MEDIA_STATUS_IND, CsrWifiSmeMediaStatusIndSizeof, CsrWifiSmeMediaStatusIndSer, CsrWifiSmeMediaStatusIndDes, CsrWifiSmeMediaStatusIndSerFree }, + { CSR_WIFI_SME_MIB_CONFIG_GET_CFM, CsrWifiSmeMibConfigGetCfmSizeof, CsrWifiSmeMibConfigGetCfmSer, CsrWifiSmeMibConfigGetCfmDes, CsrWifiSmeMibConfigGetCfmSerFree }, + { CSR_WIFI_SME_MIB_CONFIG_SET_CFM, CsrWifiSmeMibConfigSetCfmSizeof, CsrWifiSmeMibConfigSetCfmSer, CsrWifiSmeMibConfigSetCfmDes, CsrWifiSmeMibConfigSetCfmSerFree }, + { CSR_WIFI_SME_MIB_GET_CFM, CsrWifiSmeMibGetCfmSizeof, CsrWifiSmeMibGetCfmSer, CsrWifiSmeMibGetCfmDes, CsrWifiSmeMibGetCfmSerFree }, + { CSR_WIFI_SME_MIB_GET_NEXT_CFM, CsrWifiSmeMibGetNextCfmSizeof, CsrWifiSmeMibGetNextCfmSer, CsrWifiSmeMibGetNextCfmDes, CsrWifiSmeMibGetNextCfmSerFree }, + { CSR_WIFI_SME_MIB_SET_CFM, CsrWifiSmeMibSetCfmSizeof, CsrWifiSmeMibSetCfmSer, CsrWifiSmeMibSetCfmDes, CsrWifiSmeMibSetCfmSerFree }, + { CSR_WIFI_SME_MIC_FAILURE_IND, CsrWifiSmeMicFailureIndSizeof, CsrWifiSmeMicFailureIndSer, CsrWifiSmeMicFailureIndDes, CsrWifiSmeMicFailureIndSerFree }, + { CSR_WIFI_SME_MULTICAST_ADDRESS_CFM, CsrWifiSmeMulticastAddressCfmSizeof, CsrWifiSmeMulticastAddressCfmSer, CsrWifiSmeMulticastAddressCfmDes, CsrWifiSmeMulticastAddressCfmSerFree }, + { CSR_WIFI_SME_PACKET_FILTER_SET_CFM, CsrWifiSmePacketFilterSetCfmSizeof, CsrWifiSmePacketFilterSetCfmSer, CsrWifiSmePacketFilterSetCfmDes, CsrWifiSmePacketFilterSetCfmSerFree }, + { CSR_WIFI_SME_PERMANENT_MAC_ADDRESS_GET_CFM, CsrWifiSmePermanentMacAddressGetCfmSizeof, CsrWifiSmePermanentMacAddressGetCfmSer, CsrWifiSmePermanentMacAddressGetCfmDes, CsrWifiSmePermanentMacAddressGetCfmSerFree }, + { CSR_WIFI_SME_PMKID_CANDIDATE_LIST_IND, CsrWifiSmePmkidCandidateListIndSizeof, CsrWifiSmePmkidCandidateListIndSer, CsrWifiSmePmkidCandidateListIndDes, CsrWifiSmePmkidCandidateListIndSerFree }, + { CSR_WIFI_SME_PMKID_CFM, CsrWifiSmePmkidCfmSizeof, CsrWifiSmePmkidCfmSer, CsrWifiSmePmkidCfmDes, CsrWifiSmePmkidCfmSerFree }, + { CSR_WIFI_SME_POWER_CONFIG_GET_CFM, CsrWifiSmePowerConfigGetCfmSizeof, CsrWifiSmePowerConfigGetCfmSer, CsrWifiSmePowerConfigGetCfmDes, CsrWifiSmePowerConfigGetCfmSerFree }, + { CSR_WIFI_SME_POWER_CONFIG_SET_CFM, CsrWifiSmePowerConfigSetCfmSizeof, CsrWifiSmePowerConfigSetCfmSer, CsrWifiSmePowerConfigSetCfmDes, CsrWifiSmePowerConfigSetCfmSerFree }, + { CSR_WIFI_SME_REGULATORY_DOMAIN_INFO_GET_CFM, CsrWifiSmeRegulatoryDomainInfoGetCfmSizeof, CsrWifiSmeRegulatoryDomainInfoGetCfmSer, CsrWifiSmeRegulatoryDomainInfoGetCfmDes, CsrWifiSmeRegulatoryDomainInfoGetCfmSerFree }, + { CSR_WIFI_SME_ROAM_COMPLETE_IND, CsrWifiSmeRoamCompleteIndSizeof, CsrWifiSmeRoamCompleteIndSer, CsrWifiSmeRoamCompleteIndDes, CsrWifiSmeRoamCompleteIndSerFree }, + { CSR_WIFI_SME_ROAM_START_IND, CsrWifiSmeRoamStartIndSizeof, CsrWifiSmeRoamStartIndSer, CsrWifiSmeRoamStartIndDes, CsrWifiSmeRoamStartIndSerFree }, + { CSR_WIFI_SME_ROAMING_CONFIG_GET_CFM, CsrWifiSmeRoamingConfigGetCfmSizeof, CsrWifiSmeRoamingConfigGetCfmSer, CsrWifiSmeRoamingConfigGetCfmDes, CsrWifiSmeRoamingConfigGetCfmSerFree }, + { CSR_WIFI_SME_ROAMING_CONFIG_SET_CFM, CsrWifiSmeRoamingConfigSetCfmSizeof, CsrWifiSmeRoamingConfigSetCfmSer, CsrWifiSmeRoamingConfigSetCfmDes, CsrWifiSmeRoamingConfigSetCfmSerFree }, + { CSR_WIFI_SME_SCAN_CONFIG_GET_CFM, CsrWifiSmeScanConfigGetCfmSizeof, CsrWifiSmeScanConfigGetCfmSer, CsrWifiSmeScanConfigGetCfmDes, CsrWifiSmeScanConfigGetCfmSerFree }, + { CSR_WIFI_SME_SCAN_CONFIG_SET_CFM, CsrWifiSmeScanConfigSetCfmSizeof, CsrWifiSmeScanConfigSetCfmSer, CsrWifiSmeScanConfigSetCfmDes, CsrWifiSmeScanConfigSetCfmSerFree }, + { CSR_WIFI_SME_SCAN_FULL_CFM, CsrWifiSmeScanFullCfmSizeof, CsrWifiSmeScanFullCfmSer, CsrWifiSmeScanFullCfmDes, CsrWifiSmeScanFullCfmSerFree }, + { CSR_WIFI_SME_SCAN_RESULT_IND, CsrWifiSmeScanResultIndSizeof, CsrWifiSmeScanResultIndSer, CsrWifiSmeScanResultIndDes, CsrWifiSmeScanResultIndSerFree }, + { CSR_WIFI_SME_SCAN_RESULTS_FLUSH_CFM, CsrWifiSmeScanResultsFlushCfmSizeof, CsrWifiSmeScanResultsFlushCfmSer, CsrWifiSmeScanResultsFlushCfmDes, CsrWifiSmeScanResultsFlushCfmSerFree }, + { CSR_WIFI_SME_SCAN_RESULTS_GET_CFM, CsrWifiSmeScanResultsGetCfmSizeof, CsrWifiSmeScanResultsGetCfmSer, CsrWifiSmeScanResultsGetCfmDes, CsrWifiSmeScanResultsGetCfmSerFree }, + { CSR_WIFI_SME_SME_STA_CONFIG_GET_CFM, CsrWifiSmeSmeStaConfigGetCfmSizeof, CsrWifiSmeSmeStaConfigGetCfmSer, CsrWifiSmeSmeStaConfigGetCfmDes, CsrWifiSmeSmeStaConfigGetCfmSerFree }, + { CSR_WIFI_SME_SME_STA_CONFIG_SET_CFM, CsrWifiSmeSmeStaConfigSetCfmSizeof, CsrWifiSmeSmeStaConfigSetCfmSer, CsrWifiSmeSmeStaConfigSetCfmDes, CsrWifiSmeSmeStaConfigSetCfmSerFree }, + { CSR_WIFI_SME_STATION_MAC_ADDRESS_GET_CFM, CsrWifiSmeStationMacAddressGetCfmSizeof, CsrWifiSmeStationMacAddressGetCfmSer, CsrWifiSmeStationMacAddressGetCfmDes, CsrWifiSmeStationMacAddressGetCfmSerFree }, + { CSR_WIFI_SME_TSPEC_IND, CsrWifiSmeTspecIndSizeof, CsrWifiSmeTspecIndSer, CsrWifiSmeTspecIndDes, CsrWifiSmeTspecIndSerFree }, + { CSR_WIFI_SME_TSPEC_CFM, CsrWifiSmeTspecCfmSizeof, CsrWifiSmeTspecCfmSer, CsrWifiSmeTspecCfmDes, CsrWifiSmeTspecCfmSerFree }, + { CSR_WIFI_SME_VERSIONS_GET_CFM, CsrWifiSmeVersionsGetCfmSizeof, CsrWifiSmeVersionsGetCfmSer, CsrWifiSmeVersionsGetCfmDes, CsrWifiSmeVersionsGetCfmSerFree }, + { CSR_WIFI_SME_WIFI_FLIGHTMODE_CFM, CsrWifiSmeWifiFlightmodeCfmSizeof, CsrWifiSmeWifiFlightmodeCfmSer, CsrWifiSmeWifiFlightmodeCfmDes, CsrWifiSmeWifiFlightmodeCfmSerFree }, + { CSR_WIFI_SME_WIFI_OFF_IND, CsrWifiSmeWifiOffIndSizeof, CsrWifiSmeWifiOffIndSer, CsrWifiSmeWifiOffIndDes, CsrWifiSmeWifiOffIndSerFree }, + { CSR_WIFI_SME_WIFI_OFF_CFM, CsrWifiSmeWifiOffCfmSizeof, CsrWifiSmeWifiOffCfmSer, CsrWifiSmeWifiOffCfmDes, CsrWifiSmeWifiOffCfmSerFree }, + { CSR_WIFI_SME_WIFI_ON_CFM, CsrWifiSmeWifiOnCfmSizeof, CsrWifiSmeWifiOnCfmSer, CsrWifiSmeWifiOnCfmDes, CsrWifiSmeWifiOnCfmSerFree }, + { CSR_WIFI_SME_CLOAKED_SSIDS_SET_CFM, CsrWifiSmeCloakedSsidsSetCfmSizeof, CsrWifiSmeCloakedSsidsSetCfmSer, CsrWifiSmeCloakedSsidsSetCfmDes, CsrWifiSmeCloakedSsidsSetCfmSerFree }, + { CSR_WIFI_SME_CLOAKED_SSIDS_GET_CFM, CsrWifiSmeCloakedSsidsGetCfmSizeof, CsrWifiSmeCloakedSsidsGetCfmSer, CsrWifiSmeCloakedSsidsGetCfmDes, CsrWifiSmeCloakedSsidsGetCfmSerFree }, + { CSR_WIFI_SME_WIFI_ON_IND, CsrWifiSmeWifiOnIndSizeof, CsrWifiSmeWifiOnIndSer, CsrWifiSmeWifiOnIndDes, CsrWifiSmeWifiOnIndSerFree }, + { CSR_WIFI_SME_SME_COMMON_CONFIG_GET_CFM, CsrWifiSmeSmeCommonConfigGetCfmSizeof, CsrWifiSmeSmeCommonConfigGetCfmSer, CsrWifiSmeSmeCommonConfigGetCfmDes, CsrWifiSmeSmeCommonConfigGetCfmSerFree }, + { CSR_WIFI_SME_SME_COMMON_CONFIG_SET_CFM, CsrWifiSmeSmeCommonConfigSetCfmSizeof, CsrWifiSmeSmeCommonConfigSetCfmSer, CsrWifiSmeSmeCommonConfigSetCfmDes, CsrWifiSmeSmeCommonConfigSetCfmSerFree }, + { CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_CFM, CsrWifiSmeInterfaceCapabilityGetCfmSizeof, CsrWifiSmeInterfaceCapabilityGetCfmSer, CsrWifiSmeInterfaceCapabilityGetCfmDes, CsrWifiSmeInterfaceCapabilityGetCfmSerFree }, + { CSR_WIFI_SME_ERROR_IND, CsrWifiSmeErrorIndSizeof, CsrWifiSmeErrorIndSer, CsrWifiSmeErrorIndDes, CsrWifiSmeErrorIndSerFree }, + { CSR_WIFI_SME_INFO_IND, CsrWifiSmeInfoIndSizeof, CsrWifiSmeInfoIndSer, CsrWifiSmeInfoIndDes, CsrWifiSmeInfoIndSerFree }, + { CSR_WIFI_SME_CORE_DUMP_IND, CsrWifiSmeCoreDumpIndSizeof, CsrWifiSmeCoreDumpIndSer, CsrWifiSmeCoreDumpIndDes, CsrWifiSmeCoreDumpIndSerFree }, + { CSR_WIFI_SME_AMP_STATUS_CHANGE_IND, CsrWifiSmeAmpStatusChangeIndSizeof, CsrWifiSmeAmpStatusChangeIndSer, CsrWifiSmeAmpStatusChangeIndDes, CsrWifiSmeAmpStatusChangeIndSerFree }, + { CSR_WIFI_SME_WPS_CONFIGURATION_CFM, CsrWifiSmeWpsConfigurationCfmSizeof, CsrWifiSmeWpsConfigurationCfmSer, CsrWifiSmeWpsConfigurationCfmDes, CsrWifiSmeWpsConfigurationCfmSerFree }, + + { 0, NULL, NULL, NULL, NULL }, +}; + +CsrMsgConvMsgEntry* CsrWifiSmeConverterLookup(CsrMsgConvMsgEntry *ce, CsrUint16 msgType) +{ + if (msgType & CSR_PRIM_UPSTREAM) + { + CsrUint16 index = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT; + if (index < (CSR_WIFI_SME_PRIM_UPSTREAM_COUNT + CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT) && + csrwifisme_conv_lut[index].msgType == msgType) + { + return &csrwifisme_conv_lut[index]; + } + } + else + { + if (msgType < CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT && + csrwifisme_conv_lut[msgType].msgType == msgType) + { + return &csrwifisme_conv_lut[msgType]; + } + } + return NULL; +} + + +void CsrWifiSmeConverterInit(void) +{ + CsrMsgConvInsert(CSR_WIFI_SME_PRIM, csrwifisme_conv_lut); + CsrMsgConvCustomLookupRegister(CSR_WIFI_SME_PRIM, CsrWifiSmeConverterLookup); +} + + +#ifdef CSR_LOG_ENABLE +static const CsrLogPrimitiveInformation csrwifisme_conv_info = { + CSR_WIFI_SME_PRIM, + (CsrCharString *)"CSR_WIFI_SME_PRIM", + csrwifisme_conv_lut +}; +const CsrLogPrimitiveInformation* CsrWifiSmeTechInfoGet(void) +{ + return &csrwifisme_conv_info; +} + + +#endif /* CSR_LOG_ENABLE */ +#endif /* EXCLUDE_CSR_WIFI_SME_MODULE */ diff --git a/drivers/staging/csr/csr_wifi_sme_converter_init.h b/drivers/staging/csr/csr_wifi_sme_converter_init.h new file mode 100644 index 0000000..8637eb7 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_sme_converter_init.h @@ -0,0 +1,42 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_SME_CONVERTER_INIT_H__ +#define CSR_WIFI_SME_CONVERTER_INIT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef EXCLUDE_CSR_WIFI_SME_MODULE + +#include "csr_msgconv.h" + +#ifdef CSR_LOG_ENABLE +#include "csr_log.h" + +extern const CsrLogPrimitiveInformation* CsrWifiSmeTechInfoGet(void); +#endif /* CSR_LOG_ENABLE */ + +extern void CsrWifiSmeConverterInit(void); + +#else /* EXCLUDE_CSR_WIFI_SME_MODULE */ + +#define CsrWifiSmeConverterInit() + +#endif /* EXCLUDE_CSR_WIFI_SME_MODULE */ + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_SME_CONVERTER_INIT_H__ */ diff --git a/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c new file mode 100644 index 0000000..c8e66be --- /dev/null +++ b/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c @@ -0,0 +1,181 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#include "csr_pmem.h" +#include "csr_wifi_sme_prim.h" +#include "csr_wifi_sme_lib.h" + +/*----------------------------------------------------------------------------* + * NAME + * CsrWifiSmeFreeDownstreamMessageContents + * + * DESCRIPTION + * + * + * PARAMETERS + * eventClass: only the value CSR_WIFI_SME_PRIM will be handled + * message: the message to free + *----------------------------------------------------------------------------*/ +void CsrWifiSmeFreeDownstreamMessageContents(CsrUint16 eventClass, void *message) +{ + if (eventClass != CSR_WIFI_SME_PRIM) + { + return; + } + if (NULL == message) + { + return; + } + + switch (*((CsrWifiSmePrim *) message)) + { + case CSR_WIFI_SME_BLACKLIST_REQ: + { + CsrWifiSmeBlacklistReq *p = (CsrWifiSmeBlacklistReq *)message; + CsrPmemFree(p->setAddresses); + p->setAddresses = NULL; + break; + } + case CSR_WIFI_SME_CALIBRATION_DATA_SET_REQ: + { + CsrWifiSmeCalibrationDataSetReq *p = (CsrWifiSmeCalibrationDataSetReq *)message; + CsrPmemFree(p->calibrationData); + p->calibrationData = NULL; + break; + } + case CSR_WIFI_SME_CONNECT_REQ: + { + CsrWifiSmeConnectReq *p = (CsrWifiSmeConnectReq *)message; + CsrPmemFree(p->connectionConfig.mlmeAssociateReqInformationElements); + p->connectionConfig.mlmeAssociateReqInformationElements = NULL; + break; + } + case CSR_WIFI_SME_MIB_GET_NEXT_REQ: + { + CsrWifiSmeMibGetNextReq *p = (CsrWifiSmeMibGetNextReq *)message; + CsrPmemFree(p->mibAttribute); + p->mibAttribute = NULL; + break; + } + case CSR_WIFI_SME_MIB_GET_REQ: + { + CsrWifiSmeMibGetReq *p = (CsrWifiSmeMibGetReq *)message; + CsrPmemFree(p->mibAttribute); + p->mibAttribute = NULL; + break; + } + case CSR_WIFI_SME_MIB_SET_REQ: + { + CsrWifiSmeMibSetReq *p = (CsrWifiSmeMibSetReq *)message; + CsrPmemFree(p->mibAttribute); + p->mibAttribute = NULL; + break; + } + case CSR_WIFI_SME_MULTICAST_ADDRESS_REQ: + { + CsrWifiSmeMulticastAddressReq *p = (CsrWifiSmeMulticastAddressReq *)message; + CsrPmemFree(p->setAddresses); + p->setAddresses = NULL; + break; + } + case CSR_WIFI_SME_PACKET_FILTER_SET_REQ: + { + CsrWifiSmePacketFilterSetReq *p = (CsrWifiSmePacketFilterSetReq *)message; + CsrPmemFree(p->filter); + p->filter = NULL; + break; + } + case CSR_WIFI_SME_PMKID_REQ: + { + CsrWifiSmePmkidReq *p = (CsrWifiSmePmkidReq *)message; + CsrPmemFree(p->setPmkids); + p->setPmkids = NULL; + break; + } + case CSR_WIFI_SME_SCAN_CONFIG_SET_REQ: + { + CsrWifiSmeScanConfigSetReq *p = (CsrWifiSmeScanConfigSetReq *)message; + CsrPmemFree(p->scanConfig.passiveChannelList); + p->scanConfig.passiveChannelList = NULL; + break; + } + case CSR_WIFI_SME_SCAN_FULL_REQ: + { + CsrWifiSmeScanFullReq *p = (CsrWifiSmeScanFullReq *)message; + CsrPmemFree(p->ssid); + p->ssid = NULL; + CsrPmemFree(p->channelList); + p->channelList = NULL; + CsrPmemFree(p->probeIe); + p->probeIe = NULL; + break; + } + case CSR_WIFI_SME_TSPEC_REQ: + { + CsrWifiSmeTspecReq *p = (CsrWifiSmeTspecReq *)message; + CsrPmemFree(p->tspec); + p->tspec = NULL; + CsrPmemFree(p->tclas); + p->tclas = NULL; + break; + } + case CSR_WIFI_SME_WIFI_FLIGHTMODE_REQ: + { + CsrWifiSmeWifiFlightmodeReq *p = (CsrWifiSmeWifiFlightmodeReq *)message; + { + CsrUint16 i1; + for (i1 = 0; i1 < p->mibFilesCount; i1++) + { + CsrPmemFree(p->mibFiles[i1].data); + p->mibFiles[i1].data = NULL; + } + } + CsrPmemFree(p->mibFiles); + p->mibFiles = NULL; + break; + } + case CSR_WIFI_SME_WIFI_ON_REQ: + { + CsrWifiSmeWifiOnReq *p = (CsrWifiSmeWifiOnReq *)message; + { + CsrUint16 i1; + for (i1 = 0; i1 < p->mibFilesCount; i1++) + { + CsrPmemFree(p->mibFiles[i1].data); + p->mibFiles[i1].data = NULL; + } + } + CsrPmemFree(p->mibFiles); + p->mibFiles = NULL; + break; + } + case CSR_WIFI_SME_CLOAKED_SSIDS_SET_REQ: + { + CsrWifiSmeCloakedSsidsSetReq *p = (CsrWifiSmeCloakedSsidsSetReq *)message; + CsrPmemFree(p->cloakedSsids.cloakedSsids); + p->cloakedSsids.cloakedSsids = NULL; + break; + } + case CSR_WIFI_SME_WPS_CONFIGURATION_REQ: + { + CsrWifiSmeWpsConfigurationReq *p = (CsrWifiSmeWpsConfigurationReq *)message; + CsrPmemFree(p->wpsConfig.secondaryDeviceType); + p->wpsConfig.secondaryDeviceType = NULL; + break; + } + + default: + break; + } +} + + diff --git a/drivers/staging/csr/csr_wifi_sme_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_sme_free_upstream_contents.c new file mode 100644 index 0000000..c32bf68 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_sme_free_upstream_contents.c @@ -0,0 +1,276 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#include "csr_pmem.h" +#include "csr_wifi_sme_prim.h" +#include "csr_wifi_sme_lib.h" + +/*----------------------------------------------------------------------------* + * NAME + * CsrWifiSmeFreeUpstreamMessageContents + * + * DESCRIPTION + * + * + * PARAMETERS + * eventClass: only the value CSR_WIFI_SME_PRIM will be handled + * message: the message to free + *----------------------------------------------------------------------------*/ +void CsrWifiSmeFreeUpstreamMessageContents(CsrUint16 eventClass, void *message) +{ + if (eventClass != CSR_WIFI_SME_PRIM) + { + return; + } + if (NULL == message) + { + return; + } + + switch (*((CsrWifiSmePrim *) message)) + { + case CSR_WIFI_SME_ASSOCIATION_COMPLETE_IND: + { + CsrWifiSmeAssociationCompleteInd *p = (CsrWifiSmeAssociationCompleteInd *)message; + CsrPmemFree(p->connectionInfo.beaconFrame); + p->connectionInfo.beaconFrame = NULL; + CsrPmemFree(p->connectionInfo.associationReqFrame); + p->connectionInfo.associationReqFrame = NULL; + CsrPmemFree(p->connectionInfo.associationRspFrame); + p->connectionInfo.associationRspFrame = NULL; + CsrPmemFree(p->connectionInfo.assocScanInfoElements); + p->connectionInfo.assocScanInfoElements = NULL; + CsrPmemFree(p->connectionInfo.assocReqInfoElements); + p->connectionInfo.assocReqInfoElements = NULL; + CsrPmemFree(p->connectionInfo.assocRspInfoElements); + p->connectionInfo.assocRspInfoElements = NULL; + break; + } + case CSR_WIFI_SME_BLACKLIST_CFM: + { + CsrWifiSmeBlacklistCfm *p = (CsrWifiSmeBlacklistCfm *)message; + CsrPmemFree(p->getAddresses); + p->getAddresses = NULL; + break; + } + case CSR_WIFI_SME_CALIBRATION_DATA_GET_CFM: + { + CsrWifiSmeCalibrationDataGetCfm *p = (CsrWifiSmeCalibrationDataGetCfm *)message; + CsrPmemFree(p->calibrationData); + p->calibrationData = NULL; + break; + } + case CSR_WIFI_SME_CONNECTION_CONFIG_GET_CFM: + { + CsrWifiSmeConnectionConfigGetCfm *p = (CsrWifiSmeConnectionConfigGetCfm *)message; + CsrPmemFree(p->connectionConfig.mlmeAssociateReqInformationElements); + p->connectionConfig.mlmeAssociateReqInformationElements = NULL; + break; + } + case CSR_WIFI_SME_CONNECTION_INFO_GET_CFM: + { + CsrWifiSmeConnectionInfoGetCfm *p = (CsrWifiSmeConnectionInfoGetCfm *)message; + CsrPmemFree(p->connectionInfo.beaconFrame); + p->connectionInfo.beaconFrame = NULL; + CsrPmemFree(p->connectionInfo.associationReqFrame); + p->connectionInfo.associationReqFrame = NULL; + CsrPmemFree(p->connectionInfo.associationRspFrame); + p->connectionInfo.associationRspFrame = NULL; + CsrPmemFree(p->connectionInfo.assocScanInfoElements); + p->connectionInfo.assocScanInfoElements = NULL; + CsrPmemFree(p->connectionInfo.assocReqInfoElements); + p->connectionInfo.assocReqInfoElements = NULL; + CsrPmemFree(p->connectionInfo.assocRspInfoElements); + p->connectionInfo.assocRspInfoElements = NULL; + break; + } + case CSR_WIFI_SME_MEDIA_STATUS_IND: + { + CsrWifiSmeMediaStatusInd *p = (CsrWifiSmeMediaStatusInd *)message; + CsrPmemFree(p->connectionInfo.beaconFrame); + p->connectionInfo.beaconFrame = NULL; + CsrPmemFree(p->connectionInfo.associationReqFrame); + p->connectionInfo.associationReqFrame = NULL; + CsrPmemFree(p->connectionInfo.associationRspFrame); + p->connectionInfo.associationRspFrame = NULL; + CsrPmemFree(p->connectionInfo.assocScanInfoElements); + p->connectionInfo.assocScanInfoElements = NULL; + CsrPmemFree(p->connectionInfo.assocReqInfoElements); + p->connectionInfo.assocReqInfoElements = NULL; + CsrPmemFree(p->connectionInfo.assocRspInfoElements); + p->connectionInfo.assocRspInfoElements = NULL; + break; + } + case CSR_WIFI_SME_MIB_GET_CFM: + { + CsrWifiSmeMibGetCfm *p = (CsrWifiSmeMibGetCfm *)message; + CsrPmemFree(p->mibAttribute); + p->mibAttribute = NULL; + break; + } + case CSR_WIFI_SME_MIB_GET_NEXT_CFM: + { + CsrWifiSmeMibGetNextCfm *p = (CsrWifiSmeMibGetNextCfm *)message; + CsrPmemFree(p->mibAttribute); + p->mibAttribute = NULL; + break; + } + case CSR_WIFI_SME_MULTICAST_ADDRESS_CFM: + { + CsrWifiSmeMulticastAddressCfm *p = (CsrWifiSmeMulticastAddressCfm *)message; + CsrPmemFree(p->getAddresses); + p->getAddresses = NULL; + break; + } + case CSR_WIFI_SME_PMKID_CANDIDATE_LIST_IND: + { + CsrWifiSmePmkidCandidateListInd *p = (CsrWifiSmePmkidCandidateListInd *)message; + CsrPmemFree(p->pmkidCandidates); + p->pmkidCandidates = NULL; + break; + } + case CSR_WIFI_SME_PMKID_CFM: + { + CsrWifiSmePmkidCfm *p = (CsrWifiSmePmkidCfm *)message; + CsrPmemFree(p->getPmkids); + p->getPmkids = NULL; + break; + } + case CSR_WIFI_SME_SCAN_CONFIG_GET_CFM: + { + CsrWifiSmeScanConfigGetCfm *p = (CsrWifiSmeScanConfigGetCfm *)message; + CsrPmemFree(p->scanConfig.passiveChannelList); + p->scanConfig.passiveChannelList = NULL; + break; + } + case CSR_WIFI_SME_SCAN_RESULT_IND: + { + CsrWifiSmeScanResultInd *p = (CsrWifiSmeScanResultInd *)message; + CsrPmemFree(p->result.informationElements); + p->result.informationElements = NULL; + switch (p->result.p2pDeviceRole) + { + case CSR_WIFI_SME_P2P_ROLE_GO: + { + CsrUint16 i4; + for (i4 = 0; i4 < p->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++) + { + CsrPmemFree(p->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType); + p->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL; + } + } + CsrPmemFree(p->result.deviceInfo.groupInfo.p2PClientInfo); + p->result.deviceInfo.groupInfo.p2PClientInfo = NULL; + break; + case CSR_WIFI_SME_P2P_ROLE_STANDALONE: + CsrPmemFree(p->result.deviceInfo.standalonedevInfo.secDeviceType); + p->result.deviceInfo.standalonedevInfo.secDeviceType = NULL; + break; + default: + break; + } + break; + } + case CSR_WIFI_SME_SCAN_RESULTS_GET_CFM: + { + CsrWifiSmeScanResultsGetCfm *p = (CsrWifiSmeScanResultsGetCfm *)message; + { + CsrUint16 i1; + for (i1 = 0; i1 < p->scanResultsCount; i1++) + { + CsrPmemFree(p->scanResults[i1].informationElements); + p->scanResults[i1].informationElements = NULL; + switch (p->scanResults[i1].p2pDeviceRole) + { + case CSR_WIFI_SME_P2P_ROLE_GO: + { + CsrUint16 i4; + for (i4 = 0; i4 < p->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++) + { + CsrPmemFree(p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType); + p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL; + } + } + CsrPmemFree(p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo); + p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo = NULL; + break; + case CSR_WIFI_SME_P2P_ROLE_STANDALONE: + CsrPmemFree(p->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType); + p->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType = NULL; + break; + default: + break; + } + } + } + CsrPmemFree(p->scanResults); + p->scanResults = NULL; + break; + } + case CSR_WIFI_SME_TSPEC_IND: + { + CsrWifiSmeTspecInd *p = (CsrWifiSmeTspecInd *)message; + CsrPmemFree(p->tspec); + p->tspec = NULL; + break; + } + case CSR_WIFI_SME_TSPEC_CFM: + { + CsrWifiSmeTspecCfm *p = (CsrWifiSmeTspecCfm *)message; + CsrPmemFree(p->tspec); + p->tspec = NULL; + break; + } + case CSR_WIFI_SME_VERSIONS_GET_CFM: + { + CsrWifiSmeVersionsGetCfm *p = (CsrWifiSmeVersionsGetCfm *)message; + CsrPmemFree(p->versions.routerBuild); + p->versions.routerBuild = NULL; + CsrPmemFree(p->versions.smeBuild); + p->versions.smeBuild = NULL; + break; + } + case CSR_WIFI_SME_CLOAKED_SSIDS_GET_CFM: + { + CsrWifiSmeCloakedSsidsGetCfm *p = (CsrWifiSmeCloakedSsidsGetCfm *)message; + CsrPmemFree(p->cloakedSsids.cloakedSsids); + p->cloakedSsids.cloakedSsids = NULL; + break; + } + case CSR_WIFI_SME_ERROR_IND: + { + CsrWifiSmeErrorInd *p = (CsrWifiSmeErrorInd *)message; + CsrPmemFree(p->errorMessage); + p->errorMessage = NULL; + break; + } + case CSR_WIFI_SME_INFO_IND: + { + CsrWifiSmeInfoInd *p = (CsrWifiSmeInfoInd *)message; + CsrPmemFree(p->infoMessage); + p->infoMessage = NULL; + break; + } + case CSR_WIFI_SME_CORE_DUMP_IND: + { + CsrWifiSmeCoreDumpInd *p = (CsrWifiSmeCoreDumpInd *)message; + CsrPmemFree(p->data); + p->data = NULL; + break; + } + + default: + break; + } +} + + diff --git a/drivers/staging/csr/csr_wifi_sme_lib.h b/drivers/staging/csr/csr_wifi_sme_lib.h new file mode 100644 index 0000000..16053fb --- /dev/null +++ b/drivers/staging/csr/csr_wifi_sme_lib.h @@ -0,0 +1,4282 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_SME_LIB_H__ +#define CSR_WIFI_SME_LIB_H__ + +#include "csr_types.h" +#include "csr_pmem.h" +#include "csr_sched.h" +#include "csr_util.h" +#include "csr_msg_transport.h" + +#include "csr_wifi_lib.h" + +#include "csr_wifi_sme_prim.h" +#include "csr_wifi_sme_task.h" + + +#ifndef CSR_WIFI_SME_LIB_DESTINATION_QUEUE +# ifdef CSR_WIFI_NME_ENABLE +# include "csr_wifi_nme_task.h" +# define CSR_WIFI_SME_LIB_DESTINATION_QUEUE CSR_WIFI_NME_IFACEQUEUE +# else +# define CSR_WIFI_SME_LIB_DESTINATION_QUEUE CSR_WIFI_SME_IFACEQUEUE +# endif +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + +/*----------------------------------------------------------------------------* + * CsrWifiSmeFreeUpstreamMessageContents + * + * DESCRIPTION + * Free the allocated memory in a CSR_WIFI_SME upstream message. Does not + * free the message itself, and can only be used for upstream messages. + * + * PARAMETERS + * Deallocates the resources in a CSR_WIFI_SME upstream message + *----------------------------------------------------------------------------*/ +void CsrWifiSmeFreeUpstreamMessageContents(CsrUint16 eventClass, void *message); + +/*----------------------------------------------------------------------------* + * CsrWifiSmeFreeDownstreamMessageContents + * + * DESCRIPTION + * Free the allocated memory in a CSR_WIFI_SME downstream message. Does not + * free the message itself, and can only be used for downstream messages. + * + * PARAMETERS + * Deallocates the resources in a CSR_WIFI_SME downstream message + *----------------------------------------------------------------------------*/ +void CsrWifiSmeFreeDownstreamMessageContents(CsrUint16 eventClass, void *message); + +/*----------------------------------------------------------------------------* + * Enum to string functions + *----------------------------------------------------------------------------*/ +const CsrCharString* CsrWifiSme80211NetworkTypeToString(CsrWifiSme80211NetworkType value); +const CsrCharString* CsrWifiSme80211PrivacyModeToString(CsrWifiSme80211PrivacyMode value); +const CsrCharString* CsrWifiSme80211dTrustLevelToString(CsrWifiSme80211dTrustLevel value); +const CsrCharString* CsrWifiSmeAmpStatusToString(CsrWifiSmeAmpStatus value); +const CsrCharString* CsrWifiSmeAuthModeToString(CsrWifiSmeAuthMode value); +const CsrCharString* CsrWifiSmeBasicUsabilityToString(CsrWifiSmeBasicUsability value); +const CsrCharString* CsrWifiSmeBssTypeToString(CsrWifiSmeBssType value); +const CsrCharString* CsrWifiSmeCoexSchemeToString(CsrWifiSmeCoexScheme value); +const CsrCharString* CsrWifiSmeControlIndicationToString(CsrWifiSmeControlIndication value); +const CsrCharString* CsrWifiSmeCtsProtectionTypeToString(CsrWifiSmeCtsProtectionType value); +const CsrCharString* CsrWifiSmeD3AutoScanModeToString(CsrWifiSmeD3AutoScanMode value); +const CsrCharString* CsrWifiSmeEncryptionToString(CsrWifiSmeEncryption value); +const CsrCharString* CsrWifiSmeFirmwareDriverInterfaceToString(CsrWifiSmeFirmwareDriverInterface value); +const CsrCharString* CsrWifiSmeHostPowerModeToString(CsrWifiSmeHostPowerMode value); +const CsrCharString* CsrWifiSmeIEEE80211ReasonToString(CsrWifiSmeIEEE80211Reason value); +const CsrCharString* CsrWifiSmeIEEE80211ResultToString(CsrWifiSmeIEEE80211Result value); +const CsrCharString* CsrWifiSmeIndicationsToString(CsrWifiSmeIndications value); +const CsrCharString* CsrWifiSmeKeyTypeToString(CsrWifiSmeKeyType value); +const CsrCharString* CsrWifiSmeListActionToString(CsrWifiSmeListAction value); +const CsrCharString* CsrWifiSmeMediaStatusToString(CsrWifiSmeMediaStatus value); +const CsrCharString* CsrWifiSmeP2pCapabilityToString(CsrWifiSmeP2pCapability value); +const CsrCharString* CsrWifiSmeP2pGroupCapabilityToString(CsrWifiSmeP2pGroupCapability value); +const CsrCharString* CsrWifiSmeP2pNoaConfigMethodToString(CsrWifiSmeP2pNoaConfigMethod value); +const CsrCharString* CsrWifiSmeP2pRoleToString(CsrWifiSmeP2pRole value); +const CsrCharString* CsrWifiSmeP2pStatusToString(CsrWifiSmeP2pStatus value); +const CsrCharString* CsrWifiSmePacketFilterModeToString(CsrWifiSmePacketFilterMode value); +const CsrCharString* CsrWifiSmePowerSaveLevelToString(CsrWifiSmePowerSaveLevel value); +const CsrCharString* CsrWifiSmePreambleTypeToString(CsrWifiSmePreambleType value); +const CsrCharString* CsrWifiSmeRadioIFToString(CsrWifiSmeRadioIF value); +const CsrCharString* CsrWifiSmeRegulatoryDomainToString(CsrWifiSmeRegulatoryDomain value); +const CsrCharString* CsrWifiSmeRoamReasonToString(CsrWifiSmeRoamReason value); +const CsrCharString* CsrWifiSmeScanTypeToString(CsrWifiSmeScanType value); +const CsrCharString* CsrWifiSmeTrafficTypeToString(CsrWifiSmeTrafficType value); +const CsrCharString* CsrWifiSmeTspecCtrlToString(CsrWifiSmeTspecCtrl value); +const CsrCharString* CsrWifiSmeTspecResultCodeToString(CsrWifiSmeTspecResultCode value); +const CsrCharString* CsrWifiSmeWepAuthModeToString(CsrWifiSmeWepAuthMode value); +const CsrCharString* CsrWifiSmeWepCredentialTypeToString(CsrWifiSmeWepCredentialType value); +const CsrCharString* CsrWifiSmeWmmModeToString(CsrWifiSmeWmmMode value); +const CsrCharString* CsrWifiSmeWmmQosInfoToString(CsrWifiSmeWmmQosInfo value); +const CsrCharString* CsrWifiSmeWpsConfigTypeToString(CsrWifiSmeWpsConfigType value); +const CsrCharString* CsrWifiSmeWpsDeviceCategoryToString(CsrWifiSmeWpsDeviceCategory value); +const CsrCharString* CsrWifiSmeWpsDeviceSubCategoryToString(CsrWifiSmeWpsDeviceSubCategory value); +const CsrCharString* CsrWifiSmeWpsDpidToString(CsrWifiSmeWpsDpid value); +const CsrCharString* CsrWifiSmeWpsRegistrationToString(CsrWifiSmeWpsRegistration value); + + +/*----------------------------------------------------------------------------* + * CsrPrim Type toString function. + * Converts a message type to the String name of the Message + *----------------------------------------------------------------------------*/ +const CsrCharString* CsrWifiSmePrimTypeToString(CsrPrim msgType); + +/*----------------------------------------------------------------------------* + * Lookup arrays for PrimType name Strings + *----------------------------------------------------------------------------*/ +extern const CsrCharString *CsrWifiSmeUpstreamPrimNames[CSR_WIFI_SME_PRIM_UPSTREAM_COUNT]; +extern const CsrCharString *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT]; + +/******************************************************************************* + + NAME + CsrWifiSmeActivateReqSend + + DESCRIPTION + The WMA sends this primitive to activate the SME. + The WMA must activate the SME before it can send any other primitive. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + +*******************************************************************************/ +#define CsrWifiSmeActivateReqCreate(msg__, dst__, src__) \ + msg__ = (CsrWifiSmeActivateReq *) CsrPmemAlloc(sizeof(CsrWifiSmeActivateReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ACTIVATE_REQ, dst__, src__); + +#define CsrWifiSmeActivateReqSendTo(dst__, src__) \ + { \ + CsrWifiSmeActivateReq *msg__; \ + CsrWifiSmeActivateReqCreate(msg__, dst__, src__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeActivateReqSend(src__) \ + CsrWifiSmeActivateReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) + +/******************************************************************************* + + NAME + CsrWifiSmeActivateCfmSend + + DESCRIPTION + The SME sends this primitive when the activation is complete. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiSmeActivateCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiSmeActivateCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeActivateCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ACTIVATE_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiSmeActivateCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiSmeActivateCfm *msg__; \ + CsrWifiSmeActivateCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeActivateCfmSend(dst__, status__) \ + CsrWifiSmeActivateCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeAdhocConfigGetReqSend + + DESCRIPTION + This primitive gets the value of the adHocConfig parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + +*******************************************************************************/ +#define CsrWifiSmeAdhocConfigGetReqCreate(msg__, dst__, src__) \ + msg__ = (CsrWifiSmeAdhocConfigGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeAdhocConfigGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ADHOC_CONFIG_GET_REQ, dst__, src__); + +#define CsrWifiSmeAdhocConfigGetReqSendTo(dst__, src__) \ + { \ + CsrWifiSmeAdhocConfigGetReq *msg__; \ + CsrWifiSmeAdhocConfigGetReqCreate(msg__, dst__, src__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeAdhocConfigGetReqSend(src__) \ + CsrWifiSmeAdhocConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) + +/******************************************************************************* + + NAME + CsrWifiSmeAdhocConfigGetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + adHocConfig - Contains the values used when starting an Ad-hoc (IBSS) + connection. + +*******************************************************************************/ +#define CsrWifiSmeAdhocConfigGetCfmCreate(msg__, dst__, src__, status__, adHocConfig__) \ + msg__ = (CsrWifiSmeAdhocConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeAdhocConfigGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ADHOC_CONFIG_GET_CFM, dst__, src__); \ + msg__->status = (status__); \ + msg__->adHocConfig = (adHocConfig__); + +#define CsrWifiSmeAdhocConfigGetCfmSendTo(dst__, src__, status__, adHocConfig__) \ + { \ + CsrWifiSmeAdhocConfigGetCfm *msg__; \ + CsrWifiSmeAdhocConfigGetCfmCreate(msg__, dst__, src__, status__, adHocConfig__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeAdhocConfigGetCfmSend(dst__, status__, adHocConfig__) \ + CsrWifiSmeAdhocConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, adHocConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmeAdhocConfigSetReqSend + + DESCRIPTION + This primitive sets the value of the adHocConfig parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + adHocConfig - Sets the values to use when starting an ad hoc network. + +*******************************************************************************/ +#define CsrWifiSmeAdhocConfigSetReqCreate(msg__, dst__, src__, adHocConfig__) \ + msg__ = (CsrWifiSmeAdhocConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeAdhocConfigSetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ADHOC_CONFIG_SET_REQ, dst__, src__); \ + msg__->adHocConfig = (adHocConfig__); + +#define CsrWifiSmeAdhocConfigSetReqSendTo(dst__, src__, adHocConfig__) \ + { \ + CsrWifiSmeAdhocConfigSetReq *msg__; \ + CsrWifiSmeAdhocConfigSetReqCreate(msg__, dst__, src__, adHocConfig__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeAdhocConfigSetReqSend(src__, adHocConfig__) \ + CsrWifiSmeAdhocConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, adHocConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmeAdhocConfigSetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiSmeAdhocConfigSetCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiSmeAdhocConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeAdhocConfigSetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ADHOC_CONFIG_SET_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiSmeAdhocConfigSetCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiSmeAdhocConfigSetCfm *msg__; \ + CsrWifiSmeAdhocConfigSetCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeAdhocConfigSetCfmSend(dst__, status__) \ + CsrWifiSmeAdhocConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeAmpStatusChangeIndSend + + DESCRIPTION + Indication of change to AMP activity. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface on which the AMP activity changed. + ampStatus - The new status of AMP activity.Range: {AMP_ACTIVE, + AMP_INACTIVE}. + +*******************************************************************************/ +#define CsrWifiSmeAmpStatusChangeIndCreate(msg__, dst__, src__, interfaceTag__, ampStatus__) \ + msg__ = (CsrWifiSmeAmpStatusChangeInd *) CsrPmemAlloc(sizeof(CsrWifiSmeAmpStatusChangeInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_AMP_STATUS_CHANGE_IND, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->ampStatus = (ampStatus__); + +#define CsrWifiSmeAmpStatusChangeIndSendTo(dst__, src__, interfaceTag__, ampStatus__) \ + { \ + CsrWifiSmeAmpStatusChangeInd *msg__; \ + CsrWifiSmeAmpStatusChangeIndCreate(msg__, dst__, src__, interfaceTag__, ampStatus__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeAmpStatusChangeIndSend(dst__, interfaceTag__, ampStatus__) \ + CsrWifiSmeAmpStatusChangeIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, ampStatus__) + +/******************************************************************************* + + NAME + CsrWifiSmeAssociationCompleteIndSend + + DESCRIPTION + The SME will send this primitive to all the tasks that have registered to + receive it whenever it completes an attempt to associate with an AP. If + the association was successful, status will be set to + CSR_WIFI_SME_STATUS_SUCCESS, otherwise status and deauthReason shall be + set to appropriate error codes. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the association procedure + connectionInfo - This parameter is relevant only if result is + CSR_WIFI_SME_STATUS_SUCCESS: + it points to the connection information for the new network + deauthReason - This parameter is relevant only if result is not + CSR_WIFI_SME_STATUS_SUCCESS: + if the AP deauthorised the station, it gives the reason of + the deauthorization + +*******************************************************************************/ +#define CsrWifiSmeAssociationCompleteIndCreate(msg__, dst__, src__, interfaceTag__, status__, connectionInfo__, deauthReason__) \ + msg__ = (CsrWifiSmeAssociationCompleteInd *) CsrPmemAlloc(sizeof(CsrWifiSmeAssociationCompleteInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ASSOCIATION_COMPLETE_IND, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); \ + msg__->connectionInfo = (connectionInfo__); \ + msg__->deauthReason = (deauthReason__); + +#define CsrWifiSmeAssociationCompleteIndSendTo(dst__, src__, interfaceTag__, status__, connectionInfo__, deauthReason__) \ + { \ + CsrWifiSmeAssociationCompleteInd *msg__; \ + CsrWifiSmeAssociationCompleteIndCreate(msg__, dst__, src__, interfaceTag__, status__, connectionInfo__, deauthReason__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeAssociationCompleteIndSend(dst__, interfaceTag__, status__, connectionInfo__, deauthReason__) \ + CsrWifiSmeAssociationCompleteIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, connectionInfo__, deauthReason__) + +/******************************************************************************* + + NAME + CsrWifiSmeAssociationStartIndSend + + DESCRIPTION + The SME will send this primitive to all the tasks that have registered to + receive it whenever it begins an attempt to associate with an AP. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + address - BSSID of the associating network + ssid - Service Set identifier of the associating network + +*******************************************************************************/ +#define CsrWifiSmeAssociationStartIndCreate(msg__, dst__, src__, interfaceTag__, address__, ssid__) \ + msg__ = (CsrWifiSmeAssociationStartInd *) CsrPmemAlloc(sizeof(CsrWifiSmeAssociationStartInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ASSOCIATION_START_IND, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->address = (address__); \ + msg__->ssid = (ssid__); + +#define CsrWifiSmeAssociationStartIndSendTo(dst__, src__, interfaceTag__, address__, ssid__) \ + { \ + CsrWifiSmeAssociationStartInd *msg__; \ + CsrWifiSmeAssociationStartIndCreate(msg__, dst__, src__, interfaceTag__, address__, ssid__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeAssociationStartIndSend(dst__, interfaceTag__, address__, ssid__) \ + CsrWifiSmeAssociationStartIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, address__, ssid__) + +/******************************************************************************* + + NAME + CsrWifiSmeBlacklistReqSend + + DESCRIPTION + The wireless manager application should call this primitive to notify the + driver of any networks that should not be connected to. The interface + allows the wireless manager application to query, add, remove, and flush + the BSSIDs that the driver may not connect or roam to. + When this primitive adds to the black list the BSSID to which the SME is + currently connected, the SME will try to roam, if applicable, to another + BSSID in the same ESS; if the roaming procedure fails, the SME will + disconnect. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + action - The value of the CsrWifiSmeListAction parameter instructs + the driver to modify or provide the list of blacklisted + networks. + setAddressCount - Number of BSSIDs sent with this primitive + setAddresses - Pointer to the list of BBSIDs sent with the primitive, set + to NULL if none is sent. + +*******************************************************************************/ +#define CsrWifiSmeBlacklistReqCreate(msg__, dst__, src__, interfaceTag__, action__, setAddressCount__, setAddresses__) \ + msg__ = (CsrWifiSmeBlacklistReq *) CsrPmemAlloc(sizeof(CsrWifiSmeBlacklistReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_BLACKLIST_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->action = (action__); \ + msg__->setAddressCount = (setAddressCount__); \ + msg__->setAddresses = (setAddresses__); + +#define CsrWifiSmeBlacklistReqSendTo(dst__, src__, interfaceTag__, action__, setAddressCount__, setAddresses__) \ + { \ + CsrWifiSmeBlacklistReq *msg__; \ + CsrWifiSmeBlacklistReqCreate(msg__, dst__, src__, interfaceTag__, action__, setAddressCount__, setAddresses__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeBlacklistReqSend(src__, interfaceTag__, action__, setAddressCount__, setAddresses__) \ + CsrWifiSmeBlacklistReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, action__, setAddressCount__, setAddresses__) + +/******************************************************************************* + + NAME + CsrWifiSmeBlacklistCfmSend + + DESCRIPTION + The SME will call this primitive when the action on the blacklist has + completed. For a GET action, this primitive also reports the list of + BBSIDs in the blacklist. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + action - Action in the request + getAddressCount - This parameter is only relevant if action is + CSR_WIFI_SME_LIST_ACTION_GET: + number of BSSIDs sent with this primitive + getAddresses - Pointer to the list of BBSIDs sent with the primitive, set + to NULL if none is sent. + +*******************************************************************************/ +#define CsrWifiSmeBlacklistCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getAddressCount__, getAddresses__) \ + msg__ = (CsrWifiSmeBlacklistCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeBlacklistCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_BLACKLIST_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); \ + msg__->action = (action__); \ + msg__->getAddressCount = (getAddressCount__); \ + msg__->getAddresses = (getAddresses__); + +#define CsrWifiSmeBlacklistCfmSendTo(dst__, src__, interfaceTag__, status__, action__, getAddressCount__, getAddresses__) \ + { \ + CsrWifiSmeBlacklistCfm *msg__; \ + CsrWifiSmeBlacklistCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getAddressCount__, getAddresses__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeBlacklistCfmSend(dst__, interfaceTag__, status__, action__, getAddressCount__, getAddresses__) \ + CsrWifiSmeBlacklistCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, action__, getAddressCount__, getAddresses__) + +/******************************************************************************* + + NAME + CsrWifiSmeCalibrationDataGetReqSend + + DESCRIPTION + This primitive retrieves the Wi-Fi radio calibration data. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + +*******************************************************************************/ +#define CsrWifiSmeCalibrationDataGetReqCreate(msg__, dst__, src__) \ + msg__ = (CsrWifiSmeCalibrationDataGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCalibrationDataGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CALIBRATION_DATA_GET_REQ, dst__, src__); + +#define CsrWifiSmeCalibrationDataGetReqSendTo(dst__, src__) \ + { \ + CsrWifiSmeCalibrationDataGetReq *msg__; \ + CsrWifiSmeCalibrationDataGetReqCreate(msg__, dst__, src__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeCalibrationDataGetReqSend(src__) \ + CsrWifiSmeCalibrationDataGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) + +/******************************************************************************* + + NAME + CsrWifiSmeCalibrationDataGetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + calibrationDataLength - Number of bytes in the buffer pointed by + calibrationData + calibrationData - Pointer to a buffer of length calibrationDataLength + containing the calibration data + +*******************************************************************************/ +#define CsrWifiSmeCalibrationDataGetCfmCreate(msg__, dst__, src__, status__, calibrationDataLength__, calibrationData__) \ + msg__ = (CsrWifiSmeCalibrationDataGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCalibrationDataGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CALIBRATION_DATA_GET_CFM, dst__, src__); \ + msg__->status = (status__); \ + msg__->calibrationDataLength = (calibrationDataLength__); \ + msg__->calibrationData = (calibrationData__); + +#define CsrWifiSmeCalibrationDataGetCfmSendTo(dst__, src__, status__, calibrationDataLength__, calibrationData__) \ + { \ + CsrWifiSmeCalibrationDataGetCfm *msg__; \ + CsrWifiSmeCalibrationDataGetCfmCreate(msg__, dst__, src__, status__, calibrationDataLength__, calibrationData__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeCalibrationDataGetCfmSend(dst__, status__, calibrationDataLength__, calibrationData__) \ + CsrWifiSmeCalibrationDataGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, calibrationDataLength__, calibrationData__) + +/******************************************************************************* + + NAME + CsrWifiSmeCalibrationDataSetReqSend + + DESCRIPTION + This primitive sets the Wi-Fi radio calibration data. + The usage of the primitive with proper calibration data will avoid + time-consuming configuration after power-up. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + calibrationDataLength - Number of bytes in the buffer pointed by + calibrationData + calibrationData - Pointer to a buffer of length calibrationDataLength + containing the calibration data + +*******************************************************************************/ +#define CsrWifiSmeCalibrationDataSetReqCreate(msg__, dst__, src__, calibrationDataLength__, calibrationData__) \ + msg__ = (CsrWifiSmeCalibrationDataSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCalibrationDataSetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CALIBRATION_DATA_SET_REQ, dst__, src__); \ + msg__->calibrationDataLength = (calibrationDataLength__); \ + msg__->calibrationData = (calibrationData__); + +#define CsrWifiSmeCalibrationDataSetReqSendTo(dst__, src__, calibrationDataLength__, calibrationData__) \ + { \ + CsrWifiSmeCalibrationDataSetReq *msg__; \ + CsrWifiSmeCalibrationDataSetReqCreate(msg__, dst__, src__, calibrationDataLength__, calibrationData__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeCalibrationDataSetReqSend(src__, calibrationDataLength__, calibrationData__) \ + CsrWifiSmeCalibrationDataSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, calibrationDataLength__, calibrationData__) + +/******************************************************************************* + + NAME + CsrWifiSmeCalibrationDataSetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiSmeCalibrationDataSetCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiSmeCalibrationDataSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCalibrationDataSetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CALIBRATION_DATA_SET_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiSmeCalibrationDataSetCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiSmeCalibrationDataSetCfm *msg__; \ + CsrWifiSmeCalibrationDataSetCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeCalibrationDataSetCfmSend(dst__, status__) \ + CsrWifiSmeCalibrationDataSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeCcxConfigGetReqSend + + DESCRIPTION + This primitive gets the value of the CcxConfig parameter. + CURRENTLY NOT SUPPORTED. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + +*******************************************************************************/ +#define CsrWifiSmeCcxConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \ + msg__ = (CsrWifiSmeCcxConfigGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCcxConfigGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CCX_CONFIG_GET_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); + +#define CsrWifiSmeCcxConfigGetReqSendTo(dst__, src__, interfaceTag__) \ + { \ + CsrWifiSmeCcxConfigGetReq *msg__; \ + CsrWifiSmeCcxConfigGetReqCreate(msg__, dst__, src__, interfaceTag__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeCcxConfigGetReqSend(src__, interfaceTag__) \ + CsrWifiSmeCcxConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__) + +/******************************************************************************* + + NAME + CsrWifiSmeCcxConfigGetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + ccxConfig - Currently not supported + +*******************************************************************************/ +#define CsrWifiSmeCcxConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, ccxConfig__) \ + msg__ = (CsrWifiSmeCcxConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCcxConfigGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CCX_CONFIG_GET_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); \ + msg__->ccxConfig = (ccxConfig__); + +#define CsrWifiSmeCcxConfigGetCfmSendTo(dst__, src__, interfaceTag__, status__, ccxConfig__) \ + { \ + CsrWifiSmeCcxConfigGetCfm *msg__; \ + CsrWifiSmeCcxConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, ccxConfig__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeCcxConfigGetCfmSend(dst__, interfaceTag__, status__, ccxConfig__) \ + CsrWifiSmeCcxConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, ccxConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmeCcxConfigSetReqSend + + DESCRIPTION + This primitive sets the value of the CcxConfig parameter. + CURRENTLY NOT SUPPORTED. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + ccxConfig - Currently not supported + +*******************************************************************************/ +#define CsrWifiSmeCcxConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, ccxConfig__) \ + msg__ = (CsrWifiSmeCcxConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCcxConfigSetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CCX_CONFIG_SET_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->ccxConfig = (ccxConfig__); + +#define CsrWifiSmeCcxConfigSetReqSendTo(dst__, src__, interfaceTag__, ccxConfig__) \ + { \ + CsrWifiSmeCcxConfigSetReq *msg__; \ + CsrWifiSmeCcxConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, ccxConfig__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeCcxConfigSetReqSend(src__, interfaceTag__, ccxConfig__) \ + CsrWifiSmeCcxConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, ccxConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmeCcxConfigSetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiSmeCcxConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ + msg__ = (CsrWifiSmeCcxConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCcxConfigSetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CCX_CONFIG_SET_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); + +#define CsrWifiSmeCcxConfigSetCfmSendTo(dst__, src__, interfaceTag__, status__) \ + { \ + CsrWifiSmeCcxConfigSetCfm *msg__; \ + CsrWifiSmeCcxConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeCcxConfigSetCfmSend(dst__, interfaceTag__, status__) \ + CsrWifiSmeCcxConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeCloakedSsidsGetReqSend + + DESCRIPTION + This primitive gets the value of the CloakedSsids parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + +*******************************************************************************/ +#define CsrWifiSmeCloakedSsidsGetReqCreate(msg__, dst__, src__) \ + msg__ = (CsrWifiSmeCloakedSsidsGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCloakedSsidsGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CLOAKED_SSIDS_GET_REQ, dst__, src__); + +#define CsrWifiSmeCloakedSsidsGetReqSendTo(dst__, src__) \ + { \ + CsrWifiSmeCloakedSsidsGetReq *msg__; \ + CsrWifiSmeCloakedSsidsGetReqCreate(msg__, dst__, src__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeCloakedSsidsGetReqSend(src__) \ + CsrWifiSmeCloakedSsidsGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) + +/******************************************************************************* + + NAME + CsrWifiSmeCloakedSsidsGetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + cloakedSsids - Reports list of cloaked SSIDs that are explicitly scanned for + by the driver + +*******************************************************************************/ +#define CsrWifiSmeCloakedSsidsGetCfmCreate(msg__, dst__, src__, status__, cloakedSsids__) \ + msg__ = (CsrWifiSmeCloakedSsidsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCloakedSsidsGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CLOAKED_SSIDS_GET_CFM, dst__, src__); \ + msg__->status = (status__); \ + msg__->cloakedSsids = (cloakedSsids__); + +#define CsrWifiSmeCloakedSsidsGetCfmSendTo(dst__, src__, status__, cloakedSsids__) \ + { \ + CsrWifiSmeCloakedSsidsGetCfm *msg__; \ + CsrWifiSmeCloakedSsidsGetCfmCreate(msg__, dst__, src__, status__, cloakedSsids__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeCloakedSsidsGetCfmSend(dst__, status__, cloakedSsids__) \ + CsrWifiSmeCloakedSsidsGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, cloakedSsids__) + +/******************************************************************************* + + NAME + CsrWifiSmeCloakedSsidsSetReqSend + + DESCRIPTION + This primitive sets the list of cloaked SSIDs for which the WMA possesses + profiles. + When the driver detects a cloaked AP, the SME will explicitly scan for it + using the list of cloaked SSIDs provided it, and, if the scan succeeds, + it will report the AP to the WMA either via CSR_WIFI_SME_SCAN_RESULT_IND + (if registered) or via CSR_WIFI_SCAN_RESULT_GET_CFM. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + cloakedSsids - Sets the list of cloaked SSIDs + +*******************************************************************************/ +#define CsrWifiSmeCloakedSsidsSetReqCreate(msg__, dst__, src__, cloakedSsids__) \ + msg__ = (CsrWifiSmeCloakedSsidsSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCloakedSsidsSetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CLOAKED_SSIDS_SET_REQ, dst__, src__); \ + msg__->cloakedSsids = (cloakedSsids__); + +#define CsrWifiSmeCloakedSsidsSetReqSendTo(dst__, src__, cloakedSsids__) \ + { \ + CsrWifiSmeCloakedSsidsSetReq *msg__; \ + CsrWifiSmeCloakedSsidsSetReqCreate(msg__, dst__, src__, cloakedSsids__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeCloakedSsidsSetReqSend(src__, cloakedSsids__) \ + CsrWifiSmeCloakedSsidsSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, cloakedSsids__) + +/******************************************************************************* + + NAME + CsrWifiSmeCloakedSsidsSetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiSmeCloakedSsidsSetCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiSmeCloakedSsidsSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCloakedSsidsSetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CLOAKED_SSIDS_SET_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiSmeCloakedSsidsSetCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiSmeCloakedSsidsSetCfm *msg__; \ + CsrWifiSmeCloakedSsidsSetCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeCloakedSsidsSetCfmSend(dst__, status__) \ + CsrWifiSmeCloakedSsidsSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeCoexConfigGetReqSend + + DESCRIPTION + This primitive gets the value of the CoexConfig parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + +*******************************************************************************/ +#define CsrWifiSmeCoexConfigGetReqCreate(msg__, dst__, src__) \ + msg__ = (CsrWifiSmeCoexConfigGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexConfigGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_CONFIG_GET_REQ, dst__, src__); + +#define CsrWifiSmeCoexConfigGetReqSendTo(dst__, src__) \ + { \ + CsrWifiSmeCoexConfigGetReq *msg__; \ + CsrWifiSmeCoexConfigGetReqCreate(msg__, dst__, src__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeCoexConfigGetReqSend(src__) \ + CsrWifiSmeCoexConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) + +/******************************************************************************* + + NAME + CsrWifiSmeCoexConfigGetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + coexConfig - Reports the parameters used to configure the coexistence + behaviour + +*******************************************************************************/ +#define CsrWifiSmeCoexConfigGetCfmCreate(msg__, dst__, src__, status__, coexConfig__) \ + msg__ = (CsrWifiSmeCoexConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexConfigGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_CONFIG_GET_CFM, dst__, src__); \ + msg__->status = (status__); \ + msg__->coexConfig = (coexConfig__); + +#define CsrWifiSmeCoexConfigGetCfmSendTo(dst__, src__, status__, coexConfig__) \ + { \ + CsrWifiSmeCoexConfigGetCfm *msg__; \ + CsrWifiSmeCoexConfigGetCfmCreate(msg__, dst__, src__, status__, coexConfig__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeCoexConfigGetCfmSend(dst__, status__, coexConfig__) \ + CsrWifiSmeCoexConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, coexConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmeCoexConfigSetReqSend + + DESCRIPTION + This primitive sets the value of the CoexConfig parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + coexConfig - Configures the coexistence behaviour + +*******************************************************************************/ +#define CsrWifiSmeCoexConfigSetReqCreate(msg__, dst__, src__, coexConfig__) \ + msg__ = (CsrWifiSmeCoexConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexConfigSetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_CONFIG_SET_REQ, dst__, src__); \ + msg__->coexConfig = (coexConfig__); + +#define CsrWifiSmeCoexConfigSetReqSendTo(dst__, src__, coexConfig__) \ + { \ + CsrWifiSmeCoexConfigSetReq *msg__; \ + CsrWifiSmeCoexConfigSetReqCreate(msg__, dst__, src__, coexConfig__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeCoexConfigSetReqSend(src__, coexConfig__) \ + CsrWifiSmeCoexConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, coexConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmeCoexConfigSetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiSmeCoexConfigSetCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiSmeCoexConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexConfigSetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_CONFIG_SET_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiSmeCoexConfigSetCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiSmeCoexConfigSetCfm *msg__; \ + CsrWifiSmeCoexConfigSetCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeCoexConfigSetCfmSend(dst__, status__) \ + CsrWifiSmeCoexConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeCoexInfoGetReqSend + + DESCRIPTION + This primitive gets the value of the CoexInfo parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + +*******************************************************************************/ +#define CsrWifiSmeCoexInfoGetReqCreate(msg__, dst__, src__) \ + msg__ = (CsrWifiSmeCoexInfoGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexInfoGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_INFO_GET_REQ, dst__, src__); + +#define CsrWifiSmeCoexInfoGetReqSendTo(dst__, src__) \ + { \ + CsrWifiSmeCoexInfoGetReq *msg__; \ + CsrWifiSmeCoexInfoGetReqCreate(msg__, dst__, src__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeCoexInfoGetReqSend(src__) \ + CsrWifiSmeCoexInfoGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) + +/******************************************************************************* + + NAME + CsrWifiSmeCoexInfoGetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + coexInfo - Reports information and state related to coexistence. + +*******************************************************************************/ +#define CsrWifiSmeCoexInfoGetCfmCreate(msg__, dst__, src__, status__, coexInfo__) \ + msg__ = (CsrWifiSmeCoexInfoGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexInfoGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_INFO_GET_CFM, dst__, src__); \ + msg__->status = (status__); \ + msg__->coexInfo = (coexInfo__); + +#define CsrWifiSmeCoexInfoGetCfmSendTo(dst__, src__, status__, coexInfo__) \ + { \ + CsrWifiSmeCoexInfoGetCfm *msg__; \ + CsrWifiSmeCoexInfoGetCfmCreate(msg__, dst__, src__, status__, coexInfo__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeCoexInfoGetCfmSend(dst__, status__, coexInfo__) \ + CsrWifiSmeCoexInfoGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, coexInfo__) + +/******************************************************************************* + + NAME + CsrWifiSmeConnectReqSend + + DESCRIPTION + The wireless manager application calls this primitive to start the + process of joining an 802.11 wireless network or to start an ad hoc + network. + The structure pointed by connectionConfig contains parameters describing + the network to join or, in case of an ad hoc network, to host or join. + The SME will select a network, perform the IEEE 802.11 Join, Authenticate + and Associate exchanges. + The SME selects the networks from the current scan list that match both + the SSID and BSSID, however either or both of these may be the wildcard + value. Using this rule, the following operations are possible: + * To connect to a network by name, specify the SSID and set the BSSID to + 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF. If there are two or more networks visible, + the SME will select the one with the strongest signal. + * To connect to a specific network, specify the BSSID. The SSID is + optional, but if given it must match the SSID of the network. An empty + SSID may be specified by setting the SSID length to zero. Please note + that if the BSSID is specified (i.e. not equal to 0xFF 0xFF 0xFF 0xFF + 0xFF 0xFF), the SME will not attempt to roam if signal conditions become + poor, even if there is an alternative AP with an SSID that matches the + current network SSID. + * To connect to any network matching the other parameters (i.e. security, + etc), set the SSID length to zero and set the BSSID to 0xFF 0xFF 0xFF + 0xFF 0xFF 0xFF. In this case, the SME will order all available networks + by their signal strengths and will iterate through this list until it + successfully connects. + NOTE: Specifying the BSSID will restrict the selection to one specific + network. If SSID and BSSID are given, they must both match the network + for it to be selected. To select a network based on the SSID only, the + wireless manager application must set the BSSID to 0xFF 0xFF 0xFF 0xFF + 0xFF 0xFF. + The SME will try to connect to each network that matches the provided + parameters, one by one, until it succeeds or has tried unsuccessfully + with all the matching networks. + If there is no network that matches the parameters and the request allows + to host an ad hoc network, the SME will advertise a new ad hoc network + instead. + If the SME cannot connect, it will notify the failure in the confirm. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + connectionConfig - Describes the candidate network to join or to host. + +*******************************************************************************/ +#define CsrWifiSmeConnectReqCreate(msg__, dst__, src__, interfaceTag__, connectionConfig__) \ + msg__ = (CsrWifiSmeConnectReq *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECT_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->connectionConfig = (connectionConfig__); + +#define CsrWifiSmeConnectReqSendTo(dst__, src__, interfaceTag__, connectionConfig__) \ + { \ + CsrWifiSmeConnectReq *msg__; \ + CsrWifiSmeConnectReqCreate(msg__, dst__, src__, interfaceTag__, connectionConfig__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeConnectReqSend(src__, interfaceTag__, connectionConfig__) \ + CsrWifiSmeConnectReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, connectionConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmeConnectCfmSend + + DESCRIPTION + The SME calls this primitive when the connection exchange is complete or + all connection attempts fail. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request. + CSR_WIFI_SME_STATUS_NOT_FOUND: all attempts by the SME to + locate the requested AP failed + +*******************************************************************************/ +#define CsrWifiSmeConnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ + msg__ = (CsrWifiSmeConnectCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECT_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); + +#define CsrWifiSmeConnectCfmSendTo(dst__, src__, interfaceTag__, status__) \ + { \ + CsrWifiSmeConnectCfm *msg__; \ + CsrWifiSmeConnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeConnectCfmSend(dst__, interfaceTag__, status__) \ + CsrWifiSmeConnectCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeConnectionConfigGetReqSend + + DESCRIPTION + This primitive gets the value of the ConnectionConfig parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + +*******************************************************************************/ +#define CsrWifiSmeConnectionConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \ + msg__ = (CsrWifiSmeConnectionConfigGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionConfigGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_CONFIG_GET_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); + +#define CsrWifiSmeConnectionConfigGetReqSendTo(dst__, src__, interfaceTag__) \ + { \ + CsrWifiSmeConnectionConfigGetReq *msg__; \ + CsrWifiSmeConnectionConfigGetReqCreate(msg__, dst__, src__, interfaceTag__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeConnectionConfigGetReqSend(src__, interfaceTag__) \ + CsrWifiSmeConnectionConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__) + +/******************************************************************************* + + NAME + CsrWifiSmeConnectionConfigGetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + connectionConfig - Parameters used by the SME for selecting a network + +*******************************************************************************/ +#define CsrWifiSmeConnectionConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionConfig__) \ + msg__ = (CsrWifiSmeConnectionConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionConfigGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_CONFIG_GET_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); \ + msg__->connectionConfig = (connectionConfig__); + +#define CsrWifiSmeConnectionConfigGetCfmSendTo(dst__, src__, interfaceTag__, status__, connectionConfig__) \ + { \ + CsrWifiSmeConnectionConfigGetCfm *msg__; \ + CsrWifiSmeConnectionConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionConfig__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeConnectionConfigGetCfmSend(dst__, interfaceTag__, status__, connectionConfig__) \ + CsrWifiSmeConnectionConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, connectionConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmeConnectionInfoGetReqSend + + DESCRIPTION + This primitive gets the value of the ConnectionInfo parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + +*******************************************************************************/ +#define CsrWifiSmeConnectionInfoGetReqCreate(msg__, dst__, src__, interfaceTag__) \ + msg__ = (CsrWifiSmeConnectionInfoGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionInfoGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_INFO_GET_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); + +#define CsrWifiSmeConnectionInfoGetReqSendTo(dst__, src__, interfaceTag__) \ + { \ + CsrWifiSmeConnectionInfoGetReq *msg__; \ + CsrWifiSmeConnectionInfoGetReqCreate(msg__, dst__, src__, interfaceTag__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeConnectionInfoGetReqSend(src__, interfaceTag__) \ + CsrWifiSmeConnectionInfoGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__) + +/******************************************************************************* + + NAME + CsrWifiSmeConnectionInfoGetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + connectionInfo - Information about the current connection + +*******************************************************************************/ +#define CsrWifiSmeConnectionInfoGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionInfo__) \ + msg__ = (CsrWifiSmeConnectionInfoGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionInfoGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_INFO_GET_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); \ + msg__->connectionInfo = (connectionInfo__); + +#define CsrWifiSmeConnectionInfoGetCfmSendTo(dst__, src__, interfaceTag__, status__, connectionInfo__) \ + { \ + CsrWifiSmeConnectionInfoGetCfm *msg__; \ + CsrWifiSmeConnectionInfoGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionInfo__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeConnectionInfoGetCfmSend(dst__, interfaceTag__, status__, connectionInfo__) \ + CsrWifiSmeConnectionInfoGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, connectionInfo__) + +/******************************************************************************* + + NAME + CsrWifiSmeConnectionQualityIndSend + + DESCRIPTION + The SME sends this primitive to all the tasks that have registered to + receive it whenever the value of the current connection quality + parameters change by more than a certain configurable amount. + The wireless manager application may configure the trigger thresholds for + this indication using the field in smeConfig parameter of + CSR_WIFI_SME_SME_CONFIG_SET_REQ. + Connection quality messages can be suppressed by setting both thresholds + to zero. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + linkQuality - Indicates the quality of the link + +*******************************************************************************/ +#define CsrWifiSmeConnectionQualityIndCreate(msg__, dst__, src__, interfaceTag__, linkQuality__) \ + msg__ = (CsrWifiSmeConnectionQualityInd *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionQualityInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_QUALITY_IND, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->linkQuality = (linkQuality__); + +#define CsrWifiSmeConnectionQualityIndSendTo(dst__, src__, interfaceTag__, linkQuality__) \ + { \ + CsrWifiSmeConnectionQualityInd *msg__; \ + CsrWifiSmeConnectionQualityIndCreate(msg__, dst__, src__, interfaceTag__, linkQuality__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeConnectionQualityIndSend(dst__, interfaceTag__, linkQuality__) \ + CsrWifiSmeConnectionQualityIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, linkQuality__) + +/******************************************************************************* + + NAME + CsrWifiSmeConnectionStatsGetReqSend + + DESCRIPTION + This primitive gets the value of the ConnectionStats parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + +*******************************************************************************/ +#define CsrWifiSmeConnectionStatsGetReqCreate(msg__, dst__, src__, interfaceTag__) \ + msg__ = (CsrWifiSmeConnectionStatsGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionStatsGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_STATS_GET_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); + +#define CsrWifiSmeConnectionStatsGetReqSendTo(dst__, src__, interfaceTag__) \ + { \ + CsrWifiSmeConnectionStatsGetReq *msg__; \ + CsrWifiSmeConnectionStatsGetReqCreate(msg__, dst__, src__, interfaceTag__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeConnectionStatsGetReqSend(src__, interfaceTag__) \ + CsrWifiSmeConnectionStatsGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__) + +/******************************************************************************* + + NAME + CsrWifiSmeConnectionStatsGetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + connectionStats - Statistics for current connection. + +*******************************************************************************/ +#define CsrWifiSmeConnectionStatsGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionStats__) \ + msg__ = (CsrWifiSmeConnectionStatsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionStatsGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_STATS_GET_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); \ + msg__->connectionStats = (connectionStats__); + +#define CsrWifiSmeConnectionStatsGetCfmSendTo(dst__, src__, interfaceTag__, status__, connectionStats__) \ + { \ + CsrWifiSmeConnectionStatsGetCfm *msg__; \ + CsrWifiSmeConnectionStatsGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionStats__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeConnectionStatsGetCfmSend(dst__, interfaceTag__, status__, connectionStats__) \ + CsrWifiSmeConnectionStatsGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, connectionStats__) + +/******************************************************************************* + + NAME + CsrWifiSmeCoreDumpIndSend + + DESCRIPTION + The SME will send this primitive to all the tasks that have registered to + receive Wi-Fi Chip core dump data. + The core dump data may be fragmented and sent using more than one + indication. + To indicate that all the data has been sent, the last indication contains + a 'length' of 0 and 'data' of NULL. + + PARAMETERS + queue - Destination Task Queue + dataLength - Number of bytes in the buffer pointed to by 'data' + data - Pointer to the buffer containing 'dataLength' bytes of core + dump data + +*******************************************************************************/ +#define CsrWifiSmeCoreDumpIndCreate(msg__, dst__, src__, dataLength__, data__) \ + msg__ = (CsrWifiSmeCoreDumpInd *) CsrPmemAlloc(sizeof(CsrWifiSmeCoreDumpInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CORE_DUMP_IND, dst__, src__); \ + msg__->dataLength = (dataLength__); \ + msg__->data = (data__); + +#define CsrWifiSmeCoreDumpIndSendTo(dst__, src__, dataLength__, data__) \ + { \ + CsrWifiSmeCoreDumpInd *msg__; \ + CsrWifiSmeCoreDumpIndCreate(msg__, dst__, src__, dataLength__, data__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeCoreDumpIndSend(dst__, dataLength__, data__) \ + CsrWifiSmeCoreDumpIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, dataLength__, data__) + +/******************************************************************************* + + NAME + CsrWifiSmeDeactivateReqSend + + DESCRIPTION + The WMA sends this primitive to deactivate the SME. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + +*******************************************************************************/ +#define CsrWifiSmeDeactivateReqCreate(msg__, dst__, src__) \ + msg__ = (CsrWifiSmeDeactivateReq *) CsrPmemAlloc(sizeof(CsrWifiSmeDeactivateReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_DEACTIVATE_REQ, dst__, src__); + +#define CsrWifiSmeDeactivateReqSendTo(dst__, src__) \ + { \ + CsrWifiSmeDeactivateReq *msg__; \ + CsrWifiSmeDeactivateReqCreate(msg__, dst__, src__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeDeactivateReqSend(src__) \ + CsrWifiSmeDeactivateReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) + +/******************************************************************************* + + NAME + CsrWifiSmeDeactivateCfmSend + + DESCRIPTION + The SME sends this primitive when the deactivation is complete. + The WMA cannot send any more primitives until it actives the SME again + sending another CSR_WIFI_SME_ACTIVATE_REQ. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiSmeDeactivateCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiSmeDeactivateCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeDeactivateCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_DEACTIVATE_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiSmeDeactivateCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiSmeDeactivateCfm *msg__; \ + CsrWifiSmeDeactivateCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeDeactivateCfmSend(dst__, status__) \ + CsrWifiSmeDeactivateCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeDisconnectReqSend + + DESCRIPTION + The wireless manager application may disconnect from the current network + by calling this primitive + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + +*******************************************************************************/ +#define CsrWifiSmeDisconnectReqCreate(msg__, dst__, src__, interfaceTag__) \ + msg__ = (CsrWifiSmeDisconnectReq *) CsrPmemAlloc(sizeof(CsrWifiSmeDisconnectReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_DISCONNECT_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); + +#define CsrWifiSmeDisconnectReqSendTo(dst__, src__, interfaceTag__) \ + { \ + CsrWifiSmeDisconnectReq *msg__; \ + CsrWifiSmeDisconnectReqCreate(msg__, dst__, src__, interfaceTag__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeDisconnectReqSend(src__, interfaceTag__) \ + CsrWifiSmeDisconnectReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__) + +/******************************************************************************* + + NAME + CsrWifiSmeDisconnectCfmSend + + DESCRIPTION + On reception of CSR_WIFI_SME_DISCONNECT_REQ the SME will perform a + disconnect operation, sending a CsrWifiSmeMediaStatusInd with + CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED and then call this primitive when + disconnection is complete. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiSmeDisconnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ + msg__ = (CsrWifiSmeDisconnectCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeDisconnectCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_DISCONNECT_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); + +#define CsrWifiSmeDisconnectCfmSendTo(dst__, src__, interfaceTag__, status__) \ + { \ + CsrWifiSmeDisconnectCfm *msg__; \ + CsrWifiSmeDisconnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeDisconnectCfmSend(dst__, interfaceTag__, status__) \ + CsrWifiSmeDisconnectCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeErrorIndSend + + DESCRIPTION + Important error message indicating a error of some importance + + PARAMETERS + queue - Destination Task Queue + errorMessage - Contains the error message. + +*******************************************************************************/ +#define CsrWifiSmeErrorIndCreate(msg__, dst__, src__, errorMessage__) \ + msg__ = (CsrWifiSmeErrorInd *) CsrPmemAlloc(sizeof(CsrWifiSmeErrorInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ERROR_IND, dst__, src__); \ + msg__->errorMessage = (errorMessage__); + +#define CsrWifiSmeErrorIndSendTo(dst__, src__, errorMessage__) \ + { \ + CsrWifiSmeErrorInd *msg__; \ + CsrWifiSmeErrorIndCreate(msg__, dst__, src__, errorMessage__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeErrorIndSend(dst__, errorMessage__) \ + CsrWifiSmeErrorIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, errorMessage__) + +/******************************************************************************* + + NAME + CsrWifiSmeEventMaskSetReqSend + + DESCRIPTION + The wireless manager application may register with the SME to receive + notification of interesting events. Indications will be sent only if the + wireless manager explicitly registers to be notified of that event. + indMask is a bit mask of values defined in CsrWifiSmeIndicationsMask. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + indMask - Set mask with values from CsrWifiSmeIndications + +*******************************************************************************/ +#define CsrWifiSmeEventMaskSetReqCreate(msg__, dst__, src__, indMask__) \ + msg__ = (CsrWifiSmeEventMaskSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeEventMaskSetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_EVENT_MASK_SET_REQ, dst__, src__); \ + msg__->indMask = (indMask__); + +#define CsrWifiSmeEventMaskSetReqSendTo(dst__, src__, indMask__) \ + { \ + CsrWifiSmeEventMaskSetReq *msg__; \ + CsrWifiSmeEventMaskSetReqCreate(msg__, dst__, src__, indMask__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeEventMaskSetReqSend(src__, indMask__) \ + CsrWifiSmeEventMaskSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, indMask__) + +/******************************************************************************* + + NAME + CsrWifiSmeEventMaskSetCfmSend + + DESCRIPTION + The SME calls the primitive to report the result of the request + primitive. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiSmeEventMaskSetCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiSmeEventMaskSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeEventMaskSetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_EVENT_MASK_SET_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiSmeEventMaskSetCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiSmeEventMaskSetCfm *msg__; \ + CsrWifiSmeEventMaskSetCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeEventMaskSetCfmSend(dst__, status__) \ + CsrWifiSmeEventMaskSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeHostConfigGetReqSend + + DESCRIPTION + This primitive gets the value of the hostConfig parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + +*******************************************************************************/ +#define CsrWifiSmeHostConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \ + msg__ = (CsrWifiSmeHostConfigGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeHostConfigGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_HOST_CONFIG_GET_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); + +#define CsrWifiSmeHostConfigGetReqSendTo(dst__, src__, interfaceTag__) \ + { \ + CsrWifiSmeHostConfigGetReq *msg__; \ + CsrWifiSmeHostConfigGetReqCreate(msg__, dst__, src__, interfaceTag__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeHostConfigGetReqSend(src__, interfaceTag__) \ + CsrWifiSmeHostConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__) + +/******************************************************************************* + + NAME + CsrWifiSmeHostConfigGetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + hostConfig - Current host power state. + +*******************************************************************************/ +#define CsrWifiSmeHostConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, hostConfig__) \ + msg__ = (CsrWifiSmeHostConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeHostConfigGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_HOST_CONFIG_GET_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); \ + msg__->hostConfig = (hostConfig__); + +#define CsrWifiSmeHostConfigGetCfmSendTo(dst__, src__, interfaceTag__, status__, hostConfig__) \ + { \ + CsrWifiSmeHostConfigGetCfm *msg__; \ + CsrWifiSmeHostConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, hostConfig__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeHostConfigGetCfmSend(dst__, interfaceTag__, status__, hostConfig__) \ + CsrWifiSmeHostConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, hostConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmeHostConfigSetReqSend + + DESCRIPTION + This primitive sets the value of the hostConfig parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + hostConfig - Communicates a change of host power state (for example, on + mains power, on battery power etc) and of the periodicity of + traffic data + +*******************************************************************************/ +#define CsrWifiSmeHostConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, hostConfig__) \ + msg__ = (CsrWifiSmeHostConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeHostConfigSetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_HOST_CONFIG_SET_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->hostConfig = (hostConfig__); + +#define CsrWifiSmeHostConfigSetReqSendTo(dst__, src__, interfaceTag__, hostConfig__) \ + { \ + CsrWifiSmeHostConfigSetReq *msg__; \ + CsrWifiSmeHostConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, hostConfig__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeHostConfigSetReqSend(src__, interfaceTag__, hostConfig__) \ + CsrWifiSmeHostConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, hostConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmeHostConfigSetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiSmeHostConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ + msg__ = (CsrWifiSmeHostConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeHostConfigSetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_HOST_CONFIG_SET_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); + +#define CsrWifiSmeHostConfigSetCfmSendTo(dst__, src__, interfaceTag__, status__) \ + { \ + CsrWifiSmeHostConfigSetCfm *msg__; \ + CsrWifiSmeHostConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeHostConfigSetCfmSend(dst__, interfaceTag__, status__) \ + CsrWifiSmeHostConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeIbssStationIndSend + + DESCRIPTION + The SME will send this primitive to indicate that a station has joined or + left the ad-hoc network. + + PARAMETERS + queue - Destination Task Queue + address - MAC address of the station that has joined or left + isconnected - TRUE if the station joined, FALSE if the station left + +*******************************************************************************/ +#define CsrWifiSmeIbssStationIndCreate(msg__, dst__, src__, address__, isconnected__) \ + msg__ = (CsrWifiSmeIbssStationInd *) CsrPmemAlloc(sizeof(CsrWifiSmeIbssStationInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_IBSS_STATION_IND, dst__, src__); \ + msg__->address = (address__); \ + msg__->isconnected = (isconnected__); + +#define CsrWifiSmeIbssStationIndSendTo(dst__, src__, address__, isconnected__) \ + { \ + CsrWifiSmeIbssStationInd *msg__; \ + CsrWifiSmeIbssStationIndCreate(msg__, dst__, src__, address__, isconnected__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeIbssStationIndSend(dst__, address__, isconnected__) \ + CsrWifiSmeIbssStationIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, address__, isconnected__) + +/******************************************************************************* + + NAME + CsrWifiSmeInfoIndSend + + DESCRIPTION + Message indicating a some info about current activity. Mostly of interest + in testing but may be useful in the field. + + PARAMETERS + queue - Destination Task Queue + infoMessage - Contains the message. + +*******************************************************************************/ +#define CsrWifiSmeInfoIndCreate(msg__, dst__, src__, infoMessage__) \ + msg__ = (CsrWifiSmeInfoInd *) CsrPmemAlloc(sizeof(CsrWifiSmeInfoInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_INFO_IND, dst__, src__); \ + msg__->infoMessage = (infoMessage__); + +#define CsrWifiSmeInfoIndSendTo(dst__, src__, infoMessage__) \ + { \ + CsrWifiSmeInfoInd *msg__; \ + CsrWifiSmeInfoIndCreate(msg__, dst__, src__, infoMessage__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeInfoIndSend(dst__, infoMessage__) \ + CsrWifiSmeInfoIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, infoMessage__) + +/******************************************************************************* + + NAME + CsrWifiSmeInterfaceCapabilityGetReqSend + + DESCRIPTION + The Wireless Manager calls this primitive to ask the SME for the + capabilities of the supported interfaces + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + +*******************************************************************************/ +#define CsrWifiSmeInterfaceCapabilityGetReqCreate(msg__, dst__, src__) \ + msg__ = (CsrWifiSmeInterfaceCapabilityGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeInterfaceCapabilityGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_REQ, dst__, src__); + +#define CsrWifiSmeInterfaceCapabilityGetReqSendTo(dst__, src__) \ + { \ + CsrWifiSmeInterfaceCapabilityGetReq *msg__; \ + CsrWifiSmeInterfaceCapabilityGetReqCreate(msg__, dst__, src__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeInterfaceCapabilityGetReqSend(src__) \ + CsrWifiSmeInterfaceCapabilityGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) + +/******************************************************************************* + + NAME + CsrWifiSmeInterfaceCapabilityGetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + status - Result of the request + numInterfaces - Number of the interfaces supported + capBitmap - Points to the list of capabilities bitmaps provided for each + interface. + The bits represent the following capabilities: + -bits 7 to 4-Reserved + -bit 3-AMP + -bit 2-P2P + -bit 1-AP + -bit 0-STA + +*******************************************************************************/ +#define CsrWifiSmeInterfaceCapabilityGetCfmCreate(msg__, dst__, src__, status__, numInterfaces__, capBitmap__) \ + msg__ = (CsrWifiSmeInterfaceCapabilityGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeInterfaceCapabilityGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_CFM, dst__, src__); \ + msg__->status = (status__); \ + msg__->numInterfaces = (numInterfaces__); \ + CsrMemCpy(msg__->capBitmap, (capBitmap__), sizeof(CsrUint8) * 2); + +#define CsrWifiSmeInterfaceCapabilityGetCfmSendTo(dst__, src__, status__, numInterfaces__, capBitmap__) \ + { \ + CsrWifiSmeInterfaceCapabilityGetCfm *msg__; \ + CsrWifiSmeInterfaceCapabilityGetCfmCreate(msg__, dst__, src__, status__, numInterfaces__, capBitmap__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeInterfaceCapabilityGetCfmSend(dst__, status__, numInterfaces__, capBitmap__) \ + CsrWifiSmeInterfaceCapabilityGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, numInterfaces__, capBitmap__) + +/******************************************************************************* + + NAME + CsrWifiSmeKeyReqSend + + DESCRIPTION + The wireless manager application calls this primitive to add or remove + keys that the chip should use for encryption of data. + The interface allows the wireless manager application to add and remove + keys according to the specified action. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + action - The value of the CsrWifiSmeListAction parameter instructs the + driver to modify or provide the list of keys. + CSR_WIFI_SME_LIST_ACTION_GET is not supported here. + key - Key to be added or removed + +*******************************************************************************/ +#define CsrWifiSmeKeyReqCreate(msg__, dst__, src__, interfaceTag__, action__, key__) \ + msg__ = (CsrWifiSmeKeyReq *) CsrPmemAlloc(sizeof(CsrWifiSmeKeyReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_KEY_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->action = (action__); \ + msg__->key = (key__); + +#define CsrWifiSmeKeyReqSendTo(dst__, src__, interfaceTag__, action__, key__) \ + { \ + CsrWifiSmeKeyReq *msg__; \ + CsrWifiSmeKeyReqCreate(msg__, dst__, src__, interfaceTag__, action__, key__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeKeyReqSend(src__, interfaceTag__, action__, key__) \ + CsrWifiSmeKeyReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, action__, key__) + +/******************************************************************************* + + NAME + CsrWifiSmeKeyCfmSend + + DESCRIPTION + The SME calls the primitive to report the result of the request + primitive. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + action - Action in the request + keyType - Type of the key added/deleted + peerMacAddress - Peer MAC Address of the key added/deleted + +*******************************************************************************/ +#define CsrWifiSmeKeyCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, keyType__, peerMacAddress__) \ + msg__ = (CsrWifiSmeKeyCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeKeyCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_KEY_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); \ + msg__->action = (action__); \ + msg__->keyType = (keyType__); \ + msg__->peerMacAddress = (peerMacAddress__); + +#define CsrWifiSmeKeyCfmSendTo(dst__, src__, interfaceTag__, status__, action__, keyType__, peerMacAddress__) \ + { \ + CsrWifiSmeKeyCfm *msg__; \ + CsrWifiSmeKeyCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, keyType__, peerMacAddress__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeKeyCfmSend(dst__, interfaceTag__, status__, action__, keyType__, peerMacAddress__) \ + CsrWifiSmeKeyCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, action__, keyType__, peerMacAddress__) + +/******************************************************************************* + + NAME + CsrWifiSmeLinkQualityGetReqSend + + DESCRIPTION + This primitive gets the value of the LinkQuality parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + +*******************************************************************************/ +#define CsrWifiSmeLinkQualityGetReqCreate(msg__, dst__, src__, interfaceTag__) \ + msg__ = (CsrWifiSmeLinkQualityGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeLinkQualityGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_LINK_QUALITY_GET_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); + +#define CsrWifiSmeLinkQualityGetReqSendTo(dst__, src__, interfaceTag__) \ + { \ + CsrWifiSmeLinkQualityGetReq *msg__; \ + CsrWifiSmeLinkQualityGetReqCreate(msg__, dst__, src__, interfaceTag__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeLinkQualityGetReqSend(src__, interfaceTag__) \ + CsrWifiSmeLinkQualityGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__) + +/******************************************************************************* + + NAME + CsrWifiSmeLinkQualityGetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + linkQuality - Indicates the quality of the link + +*******************************************************************************/ +#define CsrWifiSmeLinkQualityGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, linkQuality__) \ + msg__ = (CsrWifiSmeLinkQualityGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeLinkQualityGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_LINK_QUALITY_GET_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); \ + msg__->linkQuality = (linkQuality__); + +#define CsrWifiSmeLinkQualityGetCfmSendTo(dst__, src__, interfaceTag__, status__, linkQuality__) \ + { \ + CsrWifiSmeLinkQualityGetCfm *msg__; \ + CsrWifiSmeLinkQualityGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, linkQuality__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeLinkQualityGetCfmSend(dst__, interfaceTag__, status__, linkQuality__) \ + CsrWifiSmeLinkQualityGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, linkQuality__) + +/******************************************************************************* + + NAME + CsrWifiSmeMediaStatusIndSend + + DESCRIPTION + The SME sends this primitive to all the tasks that have registered to + receive it when a network connection is established, lost or has moved to + another AP. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + mediaStatus - Indicates the media status + connectionInfo - This parameter is relevant only if the mediaStatus is + CSR_WIFI_SME_MEDIA_STATUS_CONNECTED: + it points to the connection information for the new network + disassocReason - This parameter is relevant only if the mediaStatus is + CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED: + if a disassociation has occurred it gives the reason of the + disassociation + deauthReason - This parameter is relevant only if the mediaStatus is + CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED: + if a deauthentication has occurred it gives the reason of + the deauthentication + +*******************************************************************************/ +#define CsrWifiSmeMediaStatusIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, connectionInfo__, disassocReason__, deauthReason__) \ + msg__ = (CsrWifiSmeMediaStatusInd *) CsrPmemAlloc(sizeof(CsrWifiSmeMediaStatusInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MEDIA_STATUS_IND, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->mediaStatus = (mediaStatus__); \ + msg__->connectionInfo = (connectionInfo__); \ + msg__->disassocReason = (disassocReason__); \ + msg__->deauthReason = (deauthReason__); + +#define CsrWifiSmeMediaStatusIndSendTo(dst__, src__, interfaceTag__, mediaStatus__, connectionInfo__, disassocReason__, deauthReason__) \ + { \ + CsrWifiSmeMediaStatusInd *msg__; \ + CsrWifiSmeMediaStatusIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, connectionInfo__, disassocReason__, deauthReason__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeMediaStatusIndSend(dst__, interfaceTag__, mediaStatus__, connectionInfo__, disassocReason__, deauthReason__) \ + CsrWifiSmeMediaStatusIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, mediaStatus__, connectionInfo__, disassocReason__, deauthReason__) + +/******************************************************************************* + + NAME + CsrWifiSmeMibConfigGetReqSend + + DESCRIPTION + This primitive gets the value of the MibConfig parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + +*******************************************************************************/ +#define CsrWifiSmeMibConfigGetReqCreate(msg__, dst__, src__) \ + msg__ = (CsrWifiSmeMibConfigGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibConfigGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_CONFIG_GET_REQ, dst__, src__); + +#define CsrWifiSmeMibConfigGetReqSendTo(dst__, src__) \ + { \ + CsrWifiSmeMibConfigGetReq *msg__; \ + CsrWifiSmeMibConfigGetReqCreate(msg__, dst__, src__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeMibConfigGetReqSend(src__) \ + CsrWifiSmeMibConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) + +/******************************************************************************* + + NAME + CsrWifiSmeMibConfigGetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + mibConfig - Reports various IEEE 802.11 attributes as currently configured + +*******************************************************************************/ +#define CsrWifiSmeMibConfigGetCfmCreate(msg__, dst__, src__, status__, mibConfig__) \ + msg__ = (CsrWifiSmeMibConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMibConfigGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_CONFIG_GET_CFM, dst__, src__); \ + msg__->status = (status__); \ + msg__->mibConfig = (mibConfig__); + +#define CsrWifiSmeMibConfigGetCfmSendTo(dst__, src__, status__, mibConfig__) \ + { \ + CsrWifiSmeMibConfigGetCfm *msg__; \ + CsrWifiSmeMibConfigGetCfmCreate(msg__, dst__, src__, status__, mibConfig__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeMibConfigGetCfmSend(dst__, status__, mibConfig__) \ + CsrWifiSmeMibConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, mibConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmeMibConfigSetReqSend + + DESCRIPTION + This primitive sets the value of the MibConfig parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + mibConfig - Conveys the desired value of various IEEE 802.11 attributes as + currently configured + +*******************************************************************************/ +#define CsrWifiSmeMibConfigSetReqCreate(msg__, dst__, src__, mibConfig__) \ + msg__ = (CsrWifiSmeMibConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibConfigSetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_CONFIG_SET_REQ, dst__, src__); \ + msg__->mibConfig = (mibConfig__); + +#define CsrWifiSmeMibConfigSetReqSendTo(dst__, src__, mibConfig__) \ + { \ + CsrWifiSmeMibConfigSetReq *msg__; \ + CsrWifiSmeMibConfigSetReqCreate(msg__, dst__, src__, mibConfig__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeMibConfigSetReqSend(src__, mibConfig__) \ + CsrWifiSmeMibConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, mibConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmeMibConfigSetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiSmeMibConfigSetCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiSmeMibConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMibConfigSetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_CONFIG_SET_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiSmeMibConfigSetCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiSmeMibConfigSetCfm *msg__; \ + CsrWifiSmeMibConfigSetCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeMibConfigSetCfmSend(dst__, status__) \ + CsrWifiSmeMibConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeMibGetCfmSend + + DESCRIPTION + The SME calls this primitive to return the requested MIB variable values. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + mibAttributeLength - Length of mibAttribute + mibAttribute - Points to the VarBind or VarBindList containing the + names and values of the MIB variables requested + +*******************************************************************************/ +#define CsrWifiSmeMibGetCfmCreate(msg__, dst__, src__, status__, mibAttributeLength__, mibAttribute__) \ + msg__ = (CsrWifiSmeMibGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_GET_CFM, dst__, src__); \ + msg__->status = (status__); \ + msg__->mibAttributeLength = (mibAttributeLength__); \ + msg__->mibAttribute = (mibAttribute__); + +#define CsrWifiSmeMibGetCfmSendTo(dst__, src__, status__, mibAttributeLength__, mibAttribute__) \ + { \ + CsrWifiSmeMibGetCfm *msg__; \ + CsrWifiSmeMibGetCfmCreate(msg__, dst__, src__, status__, mibAttributeLength__, mibAttribute__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeMibGetCfmSend(dst__, status__, mibAttributeLength__, mibAttribute__) \ + CsrWifiSmeMibGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, mibAttributeLength__, mibAttribute__) + +/******************************************************************************* + + NAME + CsrWifiSmeMibGetNextReqSend + + DESCRIPTION + To read a sequence of MIB parameters, for example a table, call this + primitive to find the name of the next MIB variable + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + mibAttributeLength - Length of mibAttribute + mibAttribute - Points to a VarBind or VarBindList containing the + name(s) of the MIB variable(s) to search from. + +*******************************************************************************/ +#define CsrWifiSmeMibGetNextReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__) \ + msg__ = (CsrWifiSmeMibGetNextReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetNextReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_GET_NEXT_REQ, dst__, src__); \ + msg__->mibAttributeLength = (mibAttributeLength__); \ + msg__->mibAttribute = (mibAttribute__); + +#define CsrWifiSmeMibGetNextReqSendTo(dst__, src__, mibAttributeLength__, mibAttribute__) \ + { \ + CsrWifiSmeMibGetNextReq *msg__; \ + CsrWifiSmeMibGetNextReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeMibGetNextReqSend(src__, mibAttributeLength__, mibAttribute__) \ + CsrWifiSmeMibGetNextReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, mibAttributeLength__, mibAttribute__) + +/******************************************************************************* + + NAME + CsrWifiSmeMibGetNextCfmSend + + DESCRIPTION + The SME calls this primitive to return the requested MIB name(s). + The wireless manager application can then read the value of the MIB + variable using CSR_WIFI_SME_MIB_GET_REQ, using the names provided. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + mibAttributeLength - Length of mibAttribute + mibAttribute - Points to a VarBind or VarBindList containing the + name(s) of the MIB variable(s) lexicographically + following the name(s) given in the request + +*******************************************************************************/ +#define CsrWifiSmeMibGetNextCfmCreate(msg__, dst__, src__, status__, mibAttributeLength__, mibAttribute__) \ + msg__ = (CsrWifiSmeMibGetNextCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetNextCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_GET_NEXT_CFM, dst__, src__); \ + msg__->status = (status__); \ + msg__->mibAttributeLength = (mibAttributeLength__); \ + msg__->mibAttribute = (mibAttribute__); + +#define CsrWifiSmeMibGetNextCfmSendTo(dst__, src__, status__, mibAttributeLength__, mibAttribute__) \ + { \ + CsrWifiSmeMibGetNextCfm *msg__; \ + CsrWifiSmeMibGetNextCfmCreate(msg__, dst__, src__, status__, mibAttributeLength__, mibAttribute__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeMibGetNextCfmSend(dst__, status__, mibAttributeLength__, mibAttribute__) \ + CsrWifiSmeMibGetNextCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, mibAttributeLength__, mibAttribute__) + +/******************************************************************************* + + NAME + CsrWifiSmeMibGetReqSend + + DESCRIPTION + The wireless manager application calls this primitive to retrieve one or + more MIB variables. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + mibAttributeLength - Length of mibAttribute + mibAttribute - Points to the VarBind or VarBindList containing the + names of the MIB variables to be retrieved + +*******************************************************************************/ +#define CsrWifiSmeMibGetReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__) \ + msg__ = (CsrWifiSmeMibGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_GET_REQ, dst__, src__); \ + msg__->mibAttributeLength = (mibAttributeLength__); \ + msg__->mibAttribute = (mibAttribute__); + +#define CsrWifiSmeMibGetReqSendTo(dst__, src__, mibAttributeLength__, mibAttribute__) \ + { \ + CsrWifiSmeMibGetReq *msg__; \ + CsrWifiSmeMibGetReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeMibGetReqSend(src__, mibAttributeLength__, mibAttribute__) \ + CsrWifiSmeMibGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, mibAttributeLength__, mibAttribute__) + +/******************************************************************************* + + NAME + CsrWifiSmeMibSetReqSend + + DESCRIPTION + The SME provides raw access to the MIB on the chip, which may be used by + some configuration or diagnostic utilities, but is not normally needed by + the wireless manager application. + The MIB access functions use BER encoded names (OID) of the MIB + parameters and BER encoded values, as described in the chip Host + Interface Protocol Specification. + The MIB parameters are described in 'Wi-Fi 5.0.0 Management Information + Base Reference Guide'. + The wireless manager application calls this primitive to set one or more + MIB variables + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + mibAttributeLength - Length of mibAttribute + mibAttribute - Points to the VarBind or VarBindList containing the + names and values of the MIB variables to set + +*******************************************************************************/ +#define CsrWifiSmeMibSetReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__) \ + msg__ = (CsrWifiSmeMibSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibSetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_SET_REQ, dst__, src__); \ + msg__->mibAttributeLength = (mibAttributeLength__); \ + msg__->mibAttribute = (mibAttribute__); + +#define CsrWifiSmeMibSetReqSendTo(dst__, src__, mibAttributeLength__, mibAttribute__) \ + { \ + CsrWifiSmeMibSetReq *msg__; \ + CsrWifiSmeMibSetReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeMibSetReqSend(src__, mibAttributeLength__, mibAttribute__) \ + CsrWifiSmeMibSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, mibAttributeLength__, mibAttribute__) + +/******************************************************************************* + + NAME + CsrWifiSmeMibSetCfmSend + + DESCRIPTION + The SME calls the primitive to report the result of the set primitive. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiSmeMibSetCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiSmeMibSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMibSetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_SET_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiSmeMibSetCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiSmeMibSetCfm *msg__; \ + CsrWifiSmeMibSetCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeMibSetCfmSend(dst__, status__) \ + CsrWifiSmeMibSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeMicFailureIndSend + + DESCRIPTION + The SME sends this primitive to all the tasks that have registered to + receive it whenever the chip firmware reports a MIC failure. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + secondFailure - TRUE if this indication is for a second failure in 60 + seconds + count - The number of MIC failure events since the connection was + established + address - MAC address of the transmitter that caused the MIC failure + keyType - Type of key for which the failure occurred + +*******************************************************************************/ +#define CsrWifiSmeMicFailureIndCreate(msg__, dst__, src__, interfaceTag__, secondFailure__, count__, address__, keyType__) \ + msg__ = (CsrWifiSmeMicFailureInd *) CsrPmemAlloc(sizeof(CsrWifiSmeMicFailureInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIC_FAILURE_IND, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->secondFailure = (secondFailure__); \ + msg__->count = (count__); \ + msg__->address = (address__); \ + msg__->keyType = (keyType__); + +#define CsrWifiSmeMicFailureIndSendTo(dst__, src__, interfaceTag__, secondFailure__, count__, address__, keyType__) \ + { \ + CsrWifiSmeMicFailureInd *msg__; \ + CsrWifiSmeMicFailureIndCreate(msg__, dst__, src__, interfaceTag__, secondFailure__, count__, address__, keyType__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeMicFailureIndSend(dst__, interfaceTag__, secondFailure__, count__, address__, keyType__) \ + CsrWifiSmeMicFailureIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, secondFailure__, count__, address__, keyType__) + +/******************************************************************************* + + NAME + CsrWifiSmeMulticastAddressReqSend + + DESCRIPTION + The wireless manager application calls this primitive to specify the + multicast addresses which the chip should recognise. The interface allows + the wireless manager application to query, add, remove and flush the + multicast addresses for the network interface according to the specified + action. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + action - The value of the CsrWifiSmeListAction parameter + instructs the driver to modify or provide the list of + MAC addresses. + setAddressesCount - Number of MAC addresses sent with the primitive + setAddresses - Pointer to the list of MAC Addresses sent with the + primitive, set to NULL if none is sent. + +*******************************************************************************/ +#define CsrWifiSmeMulticastAddressReqCreate(msg__, dst__, src__, interfaceTag__, action__, setAddressesCount__, setAddresses__) \ + msg__ = (CsrWifiSmeMulticastAddressReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMulticastAddressReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MULTICAST_ADDRESS_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->action = (action__); \ + msg__->setAddressesCount = (setAddressesCount__); \ + msg__->setAddresses = (setAddresses__); + +#define CsrWifiSmeMulticastAddressReqSendTo(dst__, src__, interfaceTag__, action__, setAddressesCount__, setAddresses__) \ + { \ + CsrWifiSmeMulticastAddressReq *msg__; \ + CsrWifiSmeMulticastAddressReqCreate(msg__, dst__, src__, interfaceTag__, action__, setAddressesCount__, setAddresses__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeMulticastAddressReqSend(src__, interfaceTag__, action__, setAddressesCount__, setAddresses__) \ + CsrWifiSmeMulticastAddressReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, action__, setAddressesCount__, setAddresses__) + +/******************************************************************************* + + NAME + CsrWifiSmeMulticastAddressCfmSend + + DESCRIPTION + The SME will call this primitive when the operation is complete. For a + GET action, this primitive reports the current list of MAC addresses. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + action - Action in the request + getAddressesCount - This parameter is only relevant if action is + CSR_WIFI_SME_LIST_ACTION_GET: + number of MAC addresses sent with the primitive + getAddresses - Pointer to the list of MAC Addresses sent with the + primitive, set to NULL if none is sent. + +*******************************************************************************/ +#define CsrWifiSmeMulticastAddressCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getAddressesCount__, getAddresses__) \ + msg__ = (CsrWifiSmeMulticastAddressCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMulticastAddressCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MULTICAST_ADDRESS_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); \ + msg__->action = (action__); \ + msg__->getAddressesCount = (getAddressesCount__); \ + msg__->getAddresses = (getAddresses__); + +#define CsrWifiSmeMulticastAddressCfmSendTo(dst__, src__, interfaceTag__, status__, action__, getAddressesCount__, getAddresses__) \ + { \ + CsrWifiSmeMulticastAddressCfm *msg__; \ + CsrWifiSmeMulticastAddressCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getAddressesCount__, getAddresses__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeMulticastAddressCfmSend(dst__, interfaceTag__, status__, action__, getAddressesCount__, getAddresses__) \ + CsrWifiSmeMulticastAddressCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, action__, getAddressesCount__, getAddresses__) + +/******************************************************************************* + + NAME + CsrWifiSmePacketFilterSetReqSend + + DESCRIPTION + The wireless manager application should call this primitive to enable or + disable filtering of broadcast packets: uninteresting broadcast packets + will be dropped by the Wi-Fi chip, instead of passing them up to the + host. + This has the advantage of saving power in the host application processor + as it removes the need to process unwanted packets. + All broadcast packets are filtered according to the filter and the filter + mode provided, except ARP packets, which are filtered using + arpFilterAddress. + Filters are not cumulative: only the parameters specified in the most + recent successful request are significant. + For more information, see 'UniFi Firmware API Specification'. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + filterLength - Length of the filter in bytes. + filterLength=0 disables the filter previously set + filter - Points to the first byte of the filter provided, if any. + This shall include zero or more instance of the + information elements of one of these types + * Traffic Classification (TCLAS) elements + * WMM-SA TCLAS elements + mode - Specifies whether the filter selects or excludes packets + matching the filter + arpFilterAddress - IPv4 address to be used for filtering the ARP packets. + * If the specified address is the IPv4 broadcast address + (255.255.255.255), all ARP packets are reported to the + host, + * If the specified address is NOT the IPv4 broadcast + address, only ARP packets with the specified address in + the Source or Target Protocol Address fields are reported + to the host + +*******************************************************************************/ +#define CsrWifiSmePacketFilterSetReqCreate(msg__, dst__, src__, interfaceTag__, filterLength__, filter__, mode__, arpFilterAddress__) \ + msg__ = (CsrWifiSmePacketFilterSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmePacketFilterSetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PACKET_FILTER_SET_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->filterLength = (filterLength__); \ + msg__->filter = (filter__); \ + msg__->mode = (mode__); \ + msg__->arpFilterAddress = (arpFilterAddress__); + +#define CsrWifiSmePacketFilterSetReqSendTo(dst__, src__, interfaceTag__, filterLength__, filter__, mode__, arpFilterAddress__) \ + { \ + CsrWifiSmePacketFilterSetReq *msg__; \ + CsrWifiSmePacketFilterSetReqCreate(msg__, dst__, src__, interfaceTag__, filterLength__, filter__, mode__, arpFilterAddress__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmePacketFilterSetReqSend(src__, interfaceTag__, filterLength__, filter__, mode__, arpFilterAddress__) \ + CsrWifiSmePacketFilterSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, filterLength__, filter__, mode__, arpFilterAddress__) + +/******************************************************************************* + + NAME + CsrWifiSmePacketFilterSetCfmSend + + DESCRIPTION + The SME calls the primitive to report the result of the set primitive. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiSmePacketFilterSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ + msg__ = (CsrWifiSmePacketFilterSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePacketFilterSetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PACKET_FILTER_SET_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); + +#define CsrWifiSmePacketFilterSetCfmSendTo(dst__, src__, interfaceTag__, status__) \ + { \ + CsrWifiSmePacketFilterSetCfm *msg__; \ + CsrWifiSmePacketFilterSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmePacketFilterSetCfmSend(dst__, interfaceTag__, status__) \ + CsrWifiSmePacketFilterSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) + +/******************************************************************************* + + NAME + CsrWifiSmePermanentMacAddressGetReqSend + + DESCRIPTION + This primitive retrieves the MAC address stored in EEPROM + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + +*******************************************************************************/ +#define CsrWifiSmePermanentMacAddressGetReqCreate(msg__, dst__, src__) \ + msg__ = (CsrWifiSmePermanentMacAddressGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmePermanentMacAddressGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PERMANENT_MAC_ADDRESS_GET_REQ, dst__, src__); + +#define CsrWifiSmePermanentMacAddressGetReqSendTo(dst__, src__) \ + { \ + CsrWifiSmePermanentMacAddressGetReq *msg__; \ + CsrWifiSmePermanentMacAddressGetReqCreate(msg__, dst__, src__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmePermanentMacAddressGetReqSend(src__) \ + CsrWifiSmePermanentMacAddressGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) + +/******************************************************************************* + + NAME + CsrWifiSmePermanentMacAddressGetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + permanentMacAddress - MAC address stored in the EEPROM + +*******************************************************************************/ +#define CsrWifiSmePermanentMacAddressGetCfmCreate(msg__, dst__, src__, status__, permanentMacAddress__) \ + msg__ = (CsrWifiSmePermanentMacAddressGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePermanentMacAddressGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PERMANENT_MAC_ADDRESS_GET_CFM, dst__, src__); \ + msg__->status = (status__); \ + msg__->permanentMacAddress = (permanentMacAddress__); + +#define CsrWifiSmePermanentMacAddressGetCfmSendTo(dst__, src__, status__, permanentMacAddress__) \ + { \ + CsrWifiSmePermanentMacAddressGetCfm *msg__; \ + CsrWifiSmePermanentMacAddressGetCfmCreate(msg__, dst__, src__, status__, permanentMacAddress__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmePermanentMacAddressGetCfmSend(dst__, status__, permanentMacAddress__) \ + CsrWifiSmePermanentMacAddressGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, permanentMacAddress__) + +/******************************************************************************* + + NAME + CsrWifiSmePmkidCandidateListIndSend + + DESCRIPTION + The SME will send this primitive to all the tasks that have registered to + receive it when a new network supporting preauthentication and/or PMK + caching is seen. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an + interface + pmkidCandidatesCount - Number of PMKID candidates provided + pmkidCandidates - Points to the first PMKID candidate + +*******************************************************************************/ +#define CsrWifiSmePmkidCandidateListIndCreate(msg__, dst__, src__, interfaceTag__, pmkidCandidatesCount__, pmkidCandidates__) \ + msg__ = (CsrWifiSmePmkidCandidateListInd *) CsrPmemAlloc(sizeof(CsrWifiSmePmkidCandidateListInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PMKID_CANDIDATE_LIST_IND, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->pmkidCandidatesCount = (pmkidCandidatesCount__); \ + msg__->pmkidCandidates = (pmkidCandidates__); + +#define CsrWifiSmePmkidCandidateListIndSendTo(dst__, src__, interfaceTag__, pmkidCandidatesCount__, pmkidCandidates__) \ + { \ + CsrWifiSmePmkidCandidateListInd *msg__; \ + CsrWifiSmePmkidCandidateListIndCreate(msg__, dst__, src__, interfaceTag__, pmkidCandidatesCount__, pmkidCandidates__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmePmkidCandidateListIndSend(dst__, interfaceTag__, pmkidCandidatesCount__, pmkidCandidates__) \ + CsrWifiSmePmkidCandidateListIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, pmkidCandidatesCount__, pmkidCandidates__) + +/******************************************************************************* + + NAME + CsrWifiSmePmkidReqSend + + DESCRIPTION + The wireless manager application calls this primitive to request an + operation on the SME PMKID list. + The action argument specifies the operation to perform. + When the connection is complete, the wireless manager application may + then send and receive EAPOL packets to complete WPA or WPA2 + authentication if appropriate. + The wireless manager application can then pass the resulting encryption + keys using this primitive. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + action - The value of the CsrWifiSmeListAction parameter instructs + the driver to modify or provide the list of PMKIDs. + setPmkidsCount - Number of PMKIDs sent with the primitive + setPmkids - Pointer to the list of PMKIDs sent with the primitive, set + to NULL if none is sent. + +*******************************************************************************/ +#define CsrWifiSmePmkidReqCreate(msg__, dst__, src__, interfaceTag__, action__, setPmkidsCount__, setPmkids__) \ + msg__ = (CsrWifiSmePmkidReq *) CsrPmemAlloc(sizeof(CsrWifiSmePmkidReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PMKID_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->action = (action__); \ + msg__->setPmkidsCount = (setPmkidsCount__); \ + msg__->setPmkids = (setPmkids__); + +#define CsrWifiSmePmkidReqSendTo(dst__, src__, interfaceTag__, action__, setPmkidsCount__, setPmkids__) \ + { \ + CsrWifiSmePmkidReq *msg__; \ + CsrWifiSmePmkidReqCreate(msg__, dst__, src__, interfaceTag__, action__, setPmkidsCount__, setPmkids__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmePmkidReqSend(src__, interfaceTag__, action__, setPmkidsCount__, setPmkids__) \ + CsrWifiSmePmkidReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, action__, setPmkidsCount__, setPmkids__) + +/******************************************************************************* + + NAME + CsrWifiSmePmkidCfmSend + + DESCRIPTION + The SME will call this primitive when the operation is complete. For a + GET action, this primitive reports the current list of PMKIDs + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + action - Action in the request + getPmkidsCount - This parameter is only relevant if action is + CSR_WIFI_SME_LIST_ACTION_GET: + number of PMKIDs sent with the primitive + getPmkids - Pointer to the list of PMKIDs sent with the primitive, set + to NULL if none is sent. + +*******************************************************************************/ +#define CsrWifiSmePmkidCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getPmkidsCount__, getPmkids__) \ + msg__ = (CsrWifiSmePmkidCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePmkidCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PMKID_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); \ + msg__->action = (action__); \ + msg__->getPmkidsCount = (getPmkidsCount__); \ + msg__->getPmkids = (getPmkids__); + +#define CsrWifiSmePmkidCfmSendTo(dst__, src__, interfaceTag__, status__, action__, getPmkidsCount__, getPmkids__) \ + { \ + CsrWifiSmePmkidCfm *msg__; \ + CsrWifiSmePmkidCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getPmkidsCount__, getPmkids__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmePmkidCfmSend(dst__, interfaceTag__, status__, action__, getPmkidsCount__, getPmkids__) \ + CsrWifiSmePmkidCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, action__, getPmkidsCount__, getPmkids__) + +/******************************************************************************* + + NAME + CsrWifiSmePowerConfigGetReqSend + + DESCRIPTION + This primitive gets the value of the PowerConfig parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + +*******************************************************************************/ +#define CsrWifiSmePowerConfigGetReqCreate(msg__, dst__, src__) \ + msg__ = (CsrWifiSmePowerConfigGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmePowerConfigGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_POWER_CONFIG_GET_REQ, dst__, src__); + +#define CsrWifiSmePowerConfigGetReqSendTo(dst__, src__) \ + { \ + CsrWifiSmePowerConfigGetReq *msg__; \ + CsrWifiSmePowerConfigGetReqCreate(msg__, dst__, src__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmePowerConfigGetReqSend(src__) \ + CsrWifiSmePowerConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) + +/******************************************************************************* + + NAME + CsrWifiSmePowerConfigGetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + powerConfig - Returns the current parameters for the power configuration of + the firmware + +*******************************************************************************/ +#define CsrWifiSmePowerConfigGetCfmCreate(msg__, dst__, src__, status__, powerConfig__) \ + msg__ = (CsrWifiSmePowerConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePowerConfigGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_POWER_CONFIG_GET_CFM, dst__, src__); \ + msg__->status = (status__); \ + msg__->powerConfig = (powerConfig__); + +#define CsrWifiSmePowerConfigGetCfmSendTo(dst__, src__, status__, powerConfig__) \ + { \ + CsrWifiSmePowerConfigGetCfm *msg__; \ + CsrWifiSmePowerConfigGetCfmCreate(msg__, dst__, src__, status__, powerConfig__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmePowerConfigGetCfmSend(dst__, status__, powerConfig__) \ + CsrWifiSmePowerConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, powerConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmePowerConfigSetReqSend + + DESCRIPTION + This primitive sets the value of the PowerConfig parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + powerConfig - Power saving configuration + +*******************************************************************************/ +#define CsrWifiSmePowerConfigSetReqCreate(msg__, dst__, src__, powerConfig__) \ + msg__ = (CsrWifiSmePowerConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmePowerConfigSetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_POWER_CONFIG_SET_REQ, dst__, src__); \ + msg__->powerConfig = (powerConfig__); + +#define CsrWifiSmePowerConfigSetReqSendTo(dst__, src__, powerConfig__) \ + { \ + CsrWifiSmePowerConfigSetReq *msg__; \ + CsrWifiSmePowerConfigSetReqCreate(msg__, dst__, src__, powerConfig__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmePowerConfigSetReqSend(src__, powerConfig__) \ + CsrWifiSmePowerConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, powerConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmePowerConfigSetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiSmePowerConfigSetCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiSmePowerConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePowerConfigSetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_POWER_CONFIG_SET_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiSmePowerConfigSetCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiSmePowerConfigSetCfm *msg__; \ + CsrWifiSmePowerConfigSetCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmePowerConfigSetCfmSend(dst__, status__) \ + CsrWifiSmePowerConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeRegulatoryDomainInfoGetReqSend + + DESCRIPTION + This primitive gets the value of the RegulatoryDomainInfo parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + +*******************************************************************************/ +#define CsrWifiSmeRegulatoryDomainInfoGetReqCreate(msg__, dst__, src__) \ + msg__ = (CsrWifiSmeRegulatoryDomainInfoGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeRegulatoryDomainInfoGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_REGULATORY_DOMAIN_INFO_GET_REQ, dst__, src__); + +#define CsrWifiSmeRegulatoryDomainInfoGetReqSendTo(dst__, src__) \ + { \ + CsrWifiSmeRegulatoryDomainInfoGetReq *msg__; \ + CsrWifiSmeRegulatoryDomainInfoGetReqCreate(msg__, dst__, src__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeRegulatoryDomainInfoGetReqSend(src__) \ + CsrWifiSmeRegulatoryDomainInfoGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) + +/******************************************************************************* + + NAME + CsrWifiSmeRegulatoryDomainInfoGetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + regDomInfo - Reports information and state related to regulatory domain + operation. + +*******************************************************************************/ +#define CsrWifiSmeRegulatoryDomainInfoGetCfmCreate(msg__, dst__, src__, status__, regDomInfo__) \ + msg__ = (CsrWifiSmeRegulatoryDomainInfoGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeRegulatoryDomainInfoGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_REGULATORY_DOMAIN_INFO_GET_CFM, dst__, src__); \ + msg__->status = (status__); \ + msg__->regDomInfo = (regDomInfo__); + +#define CsrWifiSmeRegulatoryDomainInfoGetCfmSendTo(dst__, src__, status__, regDomInfo__) \ + { \ + CsrWifiSmeRegulatoryDomainInfoGetCfm *msg__; \ + CsrWifiSmeRegulatoryDomainInfoGetCfmCreate(msg__, dst__, src__, status__, regDomInfo__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeRegulatoryDomainInfoGetCfmSend(dst__, status__, regDomInfo__) \ + CsrWifiSmeRegulatoryDomainInfoGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, regDomInfo__) + +/******************************************************************************* + + NAME + CsrWifiSmeRoamCompleteIndSend + + DESCRIPTION + The SME will send this primitive to all the tasks that have registered to + receive it whenever it completes an attempt to roam to an AP. If the roam + attempt was successful, status will be set to CSR_WIFI_SME_SUCCESS, + otherwise it shall be set to the appropriate error code. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the roaming procedure + +*******************************************************************************/ +#define CsrWifiSmeRoamCompleteIndCreate(msg__, dst__, src__, interfaceTag__, status__) \ + msg__ = (CsrWifiSmeRoamCompleteInd *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamCompleteInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAM_COMPLETE_IND, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); + +#define CsrWifiSmeRoamCompleteIndSendTo(dst__, src__, interfaceTag__, status__) \ + { \ + CsrWifiSmeRoamCompleteInd *msg__; \ + CsrWifiSmeRoamCompleteIndCreate(msg__, dst__, src__, interfaceTag__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeRoamCompleteIndSend(dst__, interfaceTag__, status__) \ + CsrWifiSmeRoamCompleteIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeRoamStartIndSend + + DESCRIPTION + The SME will send this primitive to all the tasks that have registered to + receive it whenever it begins an attempt to roam to an AP. + If the wireless manager application connect request specified the SSID + and the BSSID was set to the broadcast address (0xFF 0xFF 0xFF 0xFF 0xFF + 0xFF), the SME monitors the signal quality and maintains a list of + candidates to roam to. When the signal quality of the current connection + falls below a threshold, and there is a candidate with better quality, + the SME will attempt to the candidate AP. + If the roaming procedure succeeds, the SME will also issue a Media + Connect indication to inform the wireless manager application of the + change. + NOTE: to prevent the SME from initiating roaming the WMA must specify the + BSSID in the connection request; this forces the SME to connect only to + that AP. + The wireless manager application can obtain statistics for roaming + purposes using CSR_WIFI_SME_CONNECTION_QUALITY_IND and + CSR_WIFI_SME_CONNECTION_STATS_GET_REQ. + When the wireless manager application wishes to roam to another AP, it + must issue a connection request specifying the BSSID of the desired AP. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + roamReason - Indicates the reason for starting the roaming procedure + reason80211 - Indicates the reason for deauthentication or disassociation + +*******************************************************************************/ +#define CsrWifiSmeRoamStartIndCreate(msg__, dst__, src__, interfaceTag__, roamReason__, reason80211__) \ + msg__ = (CsrWifiSmeRoamStartInd *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamStartInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAM_START_IND, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->roamReason = (roamReason__); \ + msg__->reason80211 = (reason80211__); + +#define CsrWifiSmeRoamStartIndSendTo(dst__, src__, interfaceTag__, roamReason__, reason80211__) \ + { \ + CsrWifiSmeRoamStartInd *msg__; \ + CsrWifiSmeRoamStartIndCreate(msg__, dst__, src__, interfaceTag__, roamReason__, reason80211__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeRoamStartIndSend(dst__, interfaceTag__, roamReason__, reason80211__) \ + CsrWifiSmeRoamStartIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, roamReason__, reason80211__) + +/******************************************************************************* + + NAME + CsrWifiSmeRoamingConfigGetReqSend + + DESCRIPTION + This primitive gets the value of the RoamingConfig parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + +*******************************************************************************/ +#define CsrWifiSmeRoamingConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \ + msg__ = (CsrWifiSmeRoamingConfigGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamingConfigGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAMING_CONFIG_GET_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); + +#define CsrWifiSmeRoamingConfigGetReqSendTo(dst__, src__, interfaceTag__) \ + { \ + CsrWifiSmeRoamingConfigGetReq *msg__; \ + CsrWifiSmeRoamingConfigGetReqCreate(msg__, dst__, src__, interfaceTag__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeRoamingConfigGetReqSend(src__, interfaceTag__) \ + CsrWifiSmeRoamingConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__) + +/******************************************************************************* + + NAME + CsrWifiSmeRoamingConfigGetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + roamingConfig - Reports the roaming behaviour of the driver and firmware + +*******************************************************************************/ +#define CsrWifiSmeRoamingConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, roamingConfig__) \ + msg__ = (CsrWifiSmeRoamingConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamingConfigGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAMING_CONFIG_GET_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); \ + msg__->roamingConfig = (roamingConfig__); + +#define CsrWifiSmeRoamingConfigGetCfmSendTo(dst__, src__, interfaceTag__, status__, roamingConfig__) \ + { \ + CsrWifiSmeRoamingConfigGetCfm *msg__; \ + CsrWifiSmeRoamingConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, roamingConfig__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeRoamingConfigGetCfmSend(dst__, interfaceTag__, status__, roamingConfig__) \ + CsrWifiSmeRoamingConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, roamingConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmeRoamingConfigSetReqSend + + DESCRIPTION + This primitive sets the value of the RoamingConfig parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + roamingConfig - Desired roaming behaviour values + +*******************************************************************************/ +#define CsrWifiSmeRoamingConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, roamingConfig__) \ + msg__ = (CsrWifiSmeRoamingConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamingConfigSetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAMING_CONFIG_SET_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->roamingConfig = (roamingConfig__); + +#define CsrWifiSmeRoamingConfigSetReqSendTo(dst__, src__, interfaceTag__, roamingConfig__) \ + { \ + CsrWifiSmeRoamingConfigSetReq *msg__; \ + CsrWifiSmeRoamingConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, roamingConfig__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeRoamingConfigSetReqSend(src__, interfaceTag__, roamingConfig__) \ + CsrWifiSmeRoamingConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, roamingConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmeRoamingConfigSetCfmSend + + DESCRIPTION + This primitive sets the value of the RoamingConfig parameter. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiSmeRoamingConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ + msg__ = (CsrWifiSmeRoamingConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamingConfigSetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAMING_CONFIG_SET_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); + +#define CsrWifiSmeRoamingConfigSetCfmSendTo(dst__, src__, interfaceTag__, status__) \ + { \ + CsrWifiSmeRoamingConfigSetCfm *msg__; \ + CsrWifiSmeRoamingConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeRoamingConfigSetCfmSend(dst__, interfaceTag__, status__) \ + CsrWifiSmeRoamingConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeScanConfigGetReqSend + + DESCRIPTION + This primitive gets the value of the ScanConfig parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + +*******************************************************************************/ +#define CsrWifiSmeScanConfigGetReqCreate(msg__, dst__, src__) \ + msg__ = (CsrWifiSmeScanConfigGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeScanConfigGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_CONFIG_GET_REQ, dst__, src__); + +#define CsrWifiSmeScanConfigGetReqSendTo(dst__, src__) \ + { \ + CsrWifiSmeScanConfigGetReq *msg__; \ + CsrWifiSmeScanConfigGetReqCreate(msg__, dst__, src__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeScanConfigGetReqSend(src__) \ + CsrWifiSmeScanConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) + +/******************************************************************************* + + NAME + CsrWifiSmeScanConfigGetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + scanConfig - Returns the current parameters for the autonomous scanning + behaviour of the firmware + +*******************************************************************************/ +#define CsrWifiSmeScanConfigGetCfmCreate(msg__, dst__, src__, status__, scanConfig__) \ + msg__ = (CsrWifiSmeScanConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeScanConfigGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_CONFIG_GET_CFM, dst__, src__); \ + msg__->status = (status__); \ + msg__->scanConfig = (scanConfig__); + +#define CsrWifiSmeScanConfigGetCfmSendTo(dst__, src__, status__, scanConfig__) \ + { \ + CsrWifiSmeScanConfigGetCfm *msg__; \ + CsrWifiSmeScanConfigGetCfmCreate(msg__, dst__, src__, status__, scanConfig__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeScanConfigGetCfmSend(dst__, status__, scanConfig__) \ + CsrWifiSmeScanConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, scanConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmeScanConfigSetReqSend + + DESCRIPTION + This primitive sets the value of the ScanConfig parameter. + The SME normally configures the firmware to perform autonomous scanning + without involving the host. + The firmware passes beacon / probe response or indicates loss of beacon + on certain changes of state, for example: + * A new AP is seen for the first time + * An AP is no longer visible + * The signal strength of an AP changes by more than a certain amount, as + configured by the thresholds in the scanConfig parameter + In addition to the autonomous scan, the wireless manager application may + request a scan at any time using CSR_WIFI_SME_SCAN_FULL_REQ. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + scanConfig - Reports the configuration for the autonomous scanning behaviour + of the firmware + +*******************************************************************************/ +#define CsrWifiSmeScanConfigSetReqCreate(msg__, dst__, src__, scanConfig__) \ + msg__ = (CsrWifiSmeScanConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeScanConfigSetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_CONFIG_SET_REQ, dst__, src__); \ + msg__->scanConfig = (scanConfig__); + +#define CsrWifiSmeScanConfigSetReqSendTo(dst__, src__, scanConfig__) \ + { \ + CsrWifiSmeScanConfigSetReq *msg__; \ + CsrWifiSmeScanConfigSetReqCreate(msg__, dst__, src__, scanConfig__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeScanConfigSetReqSend(src__, scanConfig__) \ + CsrWifiSmeScanConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, scanConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmeScanConfigSetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiSmeScanConfigSetCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiSmeScanConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeScanConfigSetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_CONFIG_SET_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiSmeScanConfigSetCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiSmeScanConfigSetCfm *msg__; \ + CsrWifiSmeScanConfigSetCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeScanConfigSetCfmSend(dst__, status__) \ + CsrWifiSmeScanConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeScanFullReqSend + + DESCRIPTION + The wireless manager application should call this primitive to request a + full scan. + Channels are scanned actively or passively according to the requirement + set by regulatory domain. + If the SME receives this primitive while a full scan is going on, the new + request is buffered and it will be served after the current full scan is + completed. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + ssidCount - Number of SSIDs provided. + If it is 0, the SME will attempt to detect any network + ssid - Points to the first SSID provided, if any. + bssid - BSS identifier. + If it is equal to FF-FF-FF-FF-FF, the SME will listen for + messages from any BSS. + If it is different from FF-FF-FF-FF-FF and any SSID is + provided, one SSID must match the network of the BSS. + forceScan - Forces the scan even if the SME is in a state which would + normally prevent it (e.g. autonomous scan is running). + bssType - Type of BSS to scan for + scanType - Type of scan to perform + channelListCount - Number of channels provided. + If it is 0, the SME will initiate a scan of all the + supported channels that are permitted by the current + regulatory domain. + channelList - Points to the first channel , or NULL if channelListCount + is zero. + probeIeLength - Length of the information element in bytes to be sent + with the probe message. + probeIe - Points to the first byte of the information element to be + sent with the probe message. + +*******************************************************************************/ +#define CsrWifiSmeScanFullReqCreate(msg__, dst__, src__, ssidCount__, ssid__, bssid__, forceScan__, bssType__, scanType__, channelListCount__, channelList__, probeIeLength__, probeIe__) \ + msg__ = (CsrWifiSmeScanFullReq *) CsrPmemAlloc(sizeof(CsrWifiSmeScanFullReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_FULL_REQ, dst__, src__); \ + msg__->ssidCount = (ssidCount__); \ + msg__->ssid = (ssid__); \ + msg__->bssid = (bssid__); \ + msg__->forceScan = (forceScan__); \ + msg__->bssType = (bssType__); \ + msg__->scanType = (scanType__); \ + msg__->channelListCount = (channelListCount__); \ + msg__->channelList = (channelList__); \ + msg__->probeIeLength = (probeIeLength__); \ + msg__->probeIe = (probeIe__); + +#define CsrWifiSmeScanFullReqSendTo(dst__, src__, ssidCount__, ssid__, bssid__, forceScan__, bssType__, scanType__, channelListCount__, channelList__, probeIeLength__, probeIe__) \ + { \ + CsrWifiSmeScanFullReq *msg__; \ + CsrWifiSmeScanFullReqCreate(msg__, dst__, src__, ssidCount__, ssid__, bssid__, forceScan__, bssType__, scanType__, channelListCount__, channelList__, probeIeLength__, probeIe__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeScanFullReqSend(src__, ssidCount__, ssid__, bssid__, forceScan__, bssType__, scanType__, channelListCount__, channelList__, probeIeLength__, probeIe__) \ + CsrWifiSmeScanFullReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, ssidCount__, ssid__, bssid__, forceScan__, bssType__, scanType__, channelListCount__, channelList__, probeIeLength__, probeIe__) + +/******************************************************************************* + + NAME + CsrWifiSmeScanFullCfmSend + + DESCRIPTION + The SME calls this primitive when the results from the scan are + available. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiSmeScanFullCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiSmeScanFullCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeScanFullCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_FULL_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiSmeScanFullCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiSmeScanFullCfm *msg__; \ + CsrWifiSmeScanFullCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeScanFullCfmSend(dst__, status__) \ + CsrWifiSmeScanFullCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeScanResultIndSend + + DESCRIPTION + The SME sends this primitive to all the tasks that have registered to + receive it whenever a scan indication is received from the firmware. + + PARAMETERS + queue - Destination Task Queue + result - Points to a buffer containing a scan result. + +*******************************************************************************/ +#define CsrWifiSmeScanResultIndCreate(msg__, dst__, src__, result__) \ + msg__ = (CsrWifiSmeScanResultInd *) CsrPmemAlloc(sizeof(CsrWifiSmeScanResultInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULT_IND, dst__, src__); \ + msg__->result = (result__); + +#define CsrWifiSmeScanResultIndSendTo(dst__, src__, result__) \ + { \ + CsrWifiSmeScanResultInd *msg__; \ + CsrWifiSmeScanResultIndCreate(msg__, dst__, src__, result__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeScanResultIndSend(dst__, result__) \ + CsrWifiSmeScanResultIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, result__) + +/******************************************************************************* + + NAME + CsrWifiSmeScanResultsFlushReqSend + + DESCRIPTION + The Wireless Manager calls this primitive to ask the SME to delete all + scan results from its cache, except for the scan result of any currently + connected network. + As scan results are received by the SME from the firmware, they are + cached in the SME memory. + Any time the Wireless Manager requests scan results, they are returned + from the SME internal cache. + For some applications it may be desirable to clear this cache prior to + requesting that a scan be performed; this will ensure that the cache then + only contains the networks detected in the most recent scan. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + +*******************************************************************************/ +#define CsrWifiSmeScanResultsFlushReqCreate(msg__, dst__, src__) \ + msg__ = (CsrWifiSmeScanResultsFlushReq *) CsrPmemAlloc(sizeof(CsrWifiSmeScanResultsFlushReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULTS_FLUSH_REQ, dst__, src__); + +#define CsrWifiSmeScanResultsFlushReqSendTo(dst__, src__) \ + { \ + CsrWifiSmeScanResultsFlushReq *msg__; \ + CsrWifiSmeScanResultsFlushReqCreate(msg__, dst__, src__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeScanResultsFlushReqSend(src__) \ + CsrWifiSmeScanResultsFlushReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) + +/******************************************************************************* + + NAME + CsrWifiSmeScanResultsFlushCfmSend + + DESCRIPTION + The SME will call this primitive when the cache has been cleared. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiSmeScanResultsFlushCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiSmeScanResultsFlushCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeScanResultsFlushCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULTS_FLUSH_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiSmeScanResultsFlushCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiSmeScanResultsFlushCfm *msg__; \ + CsrWifiSmeScanResultsFlushCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeScanResultsFlushCfmSend(dst__, status__) \ + CsrWifiSmeScanResultsFlushCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeScanResultsGetReqSend + + DESCRIPTION + The wireless manager application calls this primitive to retrieve the + current set of scan results, either after receiving a successful + CSR_WIFI_SME_SCAN_FULL_CFM, or to get autonomous scan results. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + +*******************************************************************************/ +#define CsrWifiSmeScanResultsGetReqCreate(msg__, dst__, src__) \ + msg__ = (CsrWifiSmeScanResultsGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeScanResultsGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULTS_GET_REQ, dst__, src__); + +#define CsrWifiSmeScanResultsGetReqSendTo(dst__, src__) \ + { \ + CsrWifiSmeScanResultsGetReq *msg__; \ + CsrWifiSmeScanResultsGetReqCreate(msg__, dst__, src__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeScanResultsGetReqSend(src__) \ + CsrWifiSmeScanResultsGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) + +/******************************************************************************* + + NAME + CsrWifiSmeScanResultsGetCfmSend + + DESCRIPTION + The SME sends this primitive to provide the current set of scan results. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + scanResultsCount - Number of scan results + scanResults - Points to a buffer containing an array of + CsrWifiSmeScanResult structures. + +*******************************************************************************/ +#define CsrWifiSmeScanResultsGetCfmCreate(msg__, dst__, src__, status__, scanResultsCount__, scanResults__) \ + msg__ = (CsrWifiSmeScanResultsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeScanResultsGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULTS_GET_CFM, dst__, src__); \ + msg__->status = (status__); \ + msg__->scanResultsCount = (scanResultsCount__); \ + msg__->scanResults = (scanResults__); + +#define CsrWifiSmeScanResultsGetCfmSendTo(dst__, src__, status__, scanResultsCount__, scanResults__) \ + { \ + CsrWifiSmeScanResultsGetCfm *msg__; \ + CsrWifiSmeScanResultsGetCfmCreate(msg__, dst__, src__, status__, scanResultsCount__, scanResults__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeScanResultsGetCfmSend(dst__, status__, scanResultsCount__, scanResults__) \ + CsrWifiSmeScanResultsGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, scanResultsCount__, scanResults__) + +/******************************************************************************* + + NAME + CsrWifiSmeSmeCommonConfigGetReqSend + + DESCRIPTION + This primitive gets the value of the Sme common parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + +*******************************************************************************/ +#define CsrWifiSmeSmeCommonConfigGetReqCreate(msg__, dst__, src__) \ + msg__ = (CsrWifiSmeSmeCommonConfigGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeCommonConfigGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_COMMON_CONFIG_GET_REQ, dst__, src__); + +#define CsrWifiSmeSmeCommonConfigGetReqSendTo(dst__, src__) \ + { \ + CsrWifiSmeSmeCommonConfigGetReq *msg__; \ + CsrWifiSmeSmeCommonConfigGetReqCreate(msg__, dst__, src__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeSmeCommonConfigGetReqSend(src__) \ + CsrWifiSmeSmeCommonConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) + +/******************************************************************************* + + NAME + CsrWifiSmeSmeCommonConfigGetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + deviceConfig - Configuration options in the SME + +*******************************************************************************/ +#define CsrWifiSmeSmeCommonConfigGetCfmCreate(msg__, dst__, src__, status__, deviceConfig__) \ + msg__ = (CsrWifiSmeSmeCommonConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeCommonConfigGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_COMMON_CONFIG_GET_CFM, dst__, src__); \ + msg__->status = (status__); \ + msg__->deviceConfig = (deviceConfig__); + +#define CsrWifiSmeSmeCommonConfigGetCfmSendTo(dst__, src__, status__, deviceConfig__) \ + { \ + CsrWifiSmeSmeCommonConfigGetCfm *msg__; \ + CsrWifiSmeSmeCommonConfigGetCfmCreate(msg__, dst__, src__, status__, deviceConfig__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeSmeCommonConfigGetCfmSend(dst__, status__, deviceConfig__) \ + CsrWifiSmeSmeCommonConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, deviceConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmeSmeCommonConfigSetReqSend + + DESCRIPTION + This primitive sets the value of the Sme common. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + deviceConfig - Configuration options in the SME + +*******************************************************************************/ +#define CsrWifiSmeSmeCommonConfigSetReqCreate(msg__, dst__, src__, deviceConfig__) \ + msg__ = (CsrWifiSmeSmeCommonConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeCommonConfigSetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_COMMON_CONFIG_SET_REQ, dst__, src__); \ + msg__->deviceConfig = (deviceConfig__); + +#define CsrWifiSmeSmeCommonConfigSetReqSendTo(dst__, src__, deviceConfig__) \ + { \ + CsrWifiSmeSmeCommonConfigSetReq *msg__; \ + CsrWifiSmeSmeCommonConfigSetReqCreate(msg__, dst__, src__, deviceConfig__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeSmeCommonConfigSetReqSend(src__, deviceConfig__) \ + CsrWifiSmeSmeCommonConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, deviceConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmeSmeCommonConfigSetCfmSend + + DESCRIPTION + Reports the result of the request + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiSmeSmeCommonConfigSetCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiSmeSmeCommonConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeCommonConfigSetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_COMMON_CONFIG_SET_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiSmeSmeCommonConfigSetCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiSmeSmeCommonConfigSetCfm *msg__; \ + CsrWifiSmeSmeCommonConfigSetCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeSmeCommonConfigSetCfmSend(dst__, status__) \ + CsrWifiSmeSmeCommonConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeSmeStaConfigGetReqSend + + DESCRIPTION + This primitive gets the value of the SmeStaConfig parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + +*******************************************************************************/ +#define CsrWifiSmeSmeStaConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \ + msg__ = (CsrWifiSmeSmeStaConfigGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeStaConfigGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_STA_CONFIG_GET_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); + +#define CsrWifiSmeSmeStaConfigGetReqSendTo(dst__, src__, interfaceTag__) \ + { \ + CsrWifiSmeSmeStaConfigGetReq *msg__; \ + CsrWifiSmeSmeStaConfigGetReqCreate(msg__, dst__, src__, interfaceTag__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeSmeStaConfigGetReqSend(src__, interfaceTag__) \ + CsrWifiSmeSmeStaConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__) + +/******************************************************************************* + + NAME + CsrWifiSmeSmeStaConfigGetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + smeConfig - Current SME Station Parameters + +*******************************************************************************/ +#define CsrWifiSmeSmeStaConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, smeConfig__) \ + msg__ = (CsrWifiSmeSmeStaConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeStaConfigGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_STA_CONFIG_GET_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); \ + msg__->smeConfig = (smeConfig__); + +#define CsrWifiSmeSmeStaConfigGetCfmSendTo(dst__, src__, interfaceTag__, status__, smeConfig__) \ + { \ + CsrWifiSmeSmeStaConfigGetCfm *msg__; \ + CsrWifiSmeSmeStaConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, smeConfig__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeSmeStaConfigGetCfmSend(dst__, interfaceTag__, status__, smeConfig__) \ + CsrWifiSmeSmeStaConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, smeConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmeSmeStaConfigSetReqSend + + DESCRIPTION + This primitive sets the value of the SmeConfig parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + smeConfig - SME Station Parameters to be set + +*******************************************************************************/ +#define CsrWifiSmeSmeStaConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, smeConfig__) \ + msg__ = (CsrWifiSmeSmeStaConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeStaConfigSetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_STA_CONFIG_SET_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->smeConfig = (smeConfig__); + +#define CsrWifiSmeSmeStaConfigSetReqSendTo(dst__, src__, interfaceTag__, smeConfig__) \ + { \ + CsrWifiSmeSmeStaConfigSetReq *msg__; \ + CsrWifiSmeSmeStaConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, smeConfig__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeSmeStaConfigSetReqSend(src__, interfaceTag__, smeConfig__) \ + CsrWifiSmeSmeStaConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, smeConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmeSmeStaConfigSetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiSmeSmeStaConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ + msg__ = (CsrWifiSmeSmeStaConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeStaConfigSetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_STA_CONFIG_SET_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); + +#define CsrWifiSmeSmeStaConfigSetCfmSendTo(dst__, src__, interfaceTag__, status__) \ + { \ + CsrWifiSmeSmeStaConfigSetCfm *msg__; \ + CsrWifiSmeSmeStaConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeSmeStaConfigSetCfmSend(dst__, interfaceTag__, status__) \ + CsrWifiSmeSmeStaConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeStationMacAddressGetReqSend + + DESCRIPTION + This primitives is used to retrieve the current MAC address used by the + station. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + +*******************************************************************************/ +#define CsrWifiSmeStationMacAddressGetReqCreate(msg__, dst__, src__) \ + msg__ = (CsrWifiSmeStationMacAddressGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeStationMacAddressGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_STATION_MAC_ADDRESS_GET_REQ, dst__, src__); + +#define CsrWifiSmeStationMacAddressGetReqSendTo(dst__, src__) \ + { \ + CsrWifiSmeStationMacAddressGetReq *msg__; \ + CsrWifiSmeStationMacAddressGetReqCreate(msg__, dst__, src__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeStationMacAddressGetReqSend(src__) \ + CsrWifiSmeStationMacAddressGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) + +/******************************************************************************* + + NAME + CsrWifiSmeStationMacAddressGetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + stationMacAddress - Current MAC address of the station. + +*******************************************************************************/ +#define CsrWifiSmeStationMacAddressGetCfmCreate(msg__, dst__, src__, status__, stationMacAddress__) \ + msg__ = (CsrWifiSmeStationMacAddressGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeStationMacAddressGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_STATION_MAC_ADDRESS_GET_CFM, dst__, src__); \ + msg__->status = (status__); \ + CsrMemCpy(msg__->stationMacAddress, (stationMacAddress__), sizeof(CsrWifiMacAddress) * 2); + +#define CsrWifiSmeStationMacAddressGetCfmSendTo(dst__, src__, status__, stationMacAddress__) \ + { \ + CsrWifiSmeStationMacAddressGetCfm *msg__; \ + CsrWifiSmeStationMacAddressGetCfmCreate(msg__, dst__, src__, status__, stationMacAddress__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeStationMacAddressGetCfmSend(dst__, status__, stationMacAddress__) \ + CsrWifiSmeStationMacAddressGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, stationMacAddress__) + +/******************************************************************************* + + NAME + CsrWifiSmeTspecReqSend + + DESCRIPTION + The wireless manager application should call this primitive to use the + TSPEC feature. + The chip supports the use of TSPECs and TCLAS for the use of IEEE + 802.11/WMM Quality of Service features. + The API allows the wireless manager application to supply a correctly + formatted TSPEC and TCLAS pair to the driver. + After performing basic validation, the driver negotiates the installation + of the TSPEC with the AP as defined by the 802.11 specification. + The driver retains all TSPEC and TCLAS pairs until they are specifically + removed. + It is not compulsory for a TSPEC to have a TCLAS (NULL is used to + indicate that no TCLAS is supplied), while a TCLASS always require a + TSPEC. + The format of the TSPEC element is specified in 'WMM (including WMM Power + Save) Specification - Version 1.1' and 'ANSI/IEEE Std 802.11-REVmb/D3.0'. + For more information, see 'UniFi Configuring WMM and WMM-PS'. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - Interface Identifier; unique identifier of an interface + action - Specifies the action to be carried out on the list of TSPECs. + CSR_WIFI_SME_LIST_ACTION_FLUSH is not applicable here. + transactionId - Unique Transaction ID for the TSPEC, as assigned by the + driver + strict - If it set to false, allows the SME to perform automatic + TSPEC negotiation + ctrlMask - Additional TSPEC configuration for CCX. + Set mask with values from CsrWifiSmeTspecCtrl. + CURRENTLY NOT SUPPORTED + tspecLength - Length of the TSPEC. + tspec - Points to the first byte of the TSPEC + tclasLength - Length of the TCLAS. + If it is equal to 0, no TCLASS is provided for the TSPEC + tclas - Points to the first byte of the TCLAS, if any. + +*******************************************************************************/ +#define CsrWifiSmeTspecReqCreate(msg__, dst__, src__, interfaceTag__, action__, transactionId__, strict__, ctrlMask__, tspecLength__, tspec__, tclasLength__, tclas__) \ + msg__ = (CsrWifiSmeTspecReq *) CsrPmemAlloc(sizeof(CsrWifiSmeTspecReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_TSPEC_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->action = (action__); \ + msg__->transactionId = (transactionId__); \ + msg__->strict = (strict__); \ + msg__->ctrlMask = (ctrlMask__); \ + msg__->tspecLength = (tspecLength__); \ + msg__->tspec = (tspec__); \ + msg__->tclasLength = (tclasLength__); \ + msg__->tclas = (tclas__); + +#define CsrWifiSmeTspecReqSendTo(dst__, src__, interfaceTag__, action__, transactionId__, strict__, ctrlMask__, tspecLength__, tspec__, tclasLength__, tclas__) \ + { \ + CsrWifiSmeTspecReq *msg__; \ + CsrWifiSmeTspecReqCreate(msg__, dst__, src__, interfaceTag__, action__, transactionId__, strict__, ctrlMask__, tspecLength__, tspec__, tclasLength__, tclas__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeTspecReqSend(src__, interfaceTag__, action__, transactionId__, strict__, ctrlMask__, tspecLength__, tspec__, tclasLength__, tclas__) \ + CsrWifiSmeTspecReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, action__, transactionId__, strict__, ctrlMask__, tspecLength__, tspec__, tclasLength__, tclas__) + +/******************************************************************************* + + NAME + CsrWifiSmeTspecIndSend + + DESCRIPTION + The SME will send this primitive to all the task that have registered to + receive it when a status change in the TSPEC occurs. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + transactionId - Unique Transaction ID for the TSPEC, as assigned by the + driver + tspecResultCode - Specifies the TSPEC operation requested by the peer + station + tspecLength - Length of the TSPEC. + tspec - Points to the first byte of the TSPEC + +*******************************************************************************/ +#define CsrWifiSmeTspecIndCreate(msg__, dst__, src__, interfaceTag__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \ + msg__ = (CsrWifiSmeTspecInd *) CsrPmemAlloc(sizeof(CsrWifiSmeTspecInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_TSPEC_IND, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->transactionId = (transactionId__); \ + msg__->tspecResultCode = (tspecResultCode__); \ + msg__->tspecLength = (tspecLength__); \ + msg__->tspec = (tspec__); + +#define CsrWifiSmeTspecIndSendTo(dst__, src__, interfaceTag__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \ + { \ + CsrWifiSmeTspecInd *msg__; \ + CsrWifiSmeTspecIndCreate(msg__, dst__, src__, interfaceTag__, transactionId__, tspecResultCode__, tspecLength__, tspec__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeTspecIndSend(dst__, interfaceTag__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \ + CsrWifiSmeTspecIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, transactionId__, tspecResultCode__, tspecLength__, tspec__) + +/******************************************************************************* + + NAME + CsrWifiSmeTspecCfmSend + + DESCRIPTION + The SME calls the primitive to report the result of the TSpec primitive + request. + + PARAMETERS + queue - Destination Task Queue + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + transactionId - Unique Transaction ID for the TSPEC, as assigned by the + driver + tspecResultCode - Specifies the result of the negotiated TSPEC operation + tspecLength - Length of the TSPEC. + tspec - Points to the first byte of the TSPEC + +*******************************************************************************/ +#define CsrWifiSmeTspecCfmCreate(msg__, dst__, src__, interfaceTag__, status__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \ + msg__ = (CsrWifiSmeTspecCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeTspecCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_TSPEC_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); \ + msg__->transactionId = (transactionId__); \ + msg__->tspecResultCode = (tspecResultCode__); \ + msg__->tspecLength = (tspecLength__); \ + msg__->tspec = (tspec__); + +#define CsrWifiSmeTspecCfmSendTo(dst__, src__, interfaceTag__, status__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \ + { \ + CsrWifiSmeTspecCfm *msg__; \ + CsrWifiSmeTspecCfmCreate(msg__, dst__, src__, interfaceTag__, status__, transactionId__, tspecResultCode__, tspecLength__, tspec__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeTspecCfmSend(dst__, interfaceTag__, status__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \ + CsrWifiSmeTspecCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, transactionId__, tspecResultCode__, tspecLength__, tspec__) + +/******************************************************************************* + + NAME + CsrWifiSmeVersionsGetReqSend + + DESCRIPTION + This primitive gets the value of the Versions parameter. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + +*******************************************************************************/ +#define CsrWifiSmeVersionsGetReqCreate(msg__, dst__, src__) \ + msg__ = (CsrWifiSmeVersionsGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeVersionsGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_VERSIONS_GET_REQ, dst__, src__); + +#define CsrWifiSmeVersionsGetReqSendTo(dst__, src__) \ + { \ + CsrWifiSmeVersionsGetReq *msg__; \ + CsrWifiSmeVersionsGetReqCreate(msg__, dst__, src__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeVersionsGetReqSend(src__) \ + CsrWifiSmeVersionsGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) + +/******************************************************************************* + + NAME + CsrWifiSmeVersionsGetCfmSend + + DESCRIPTION + This primitive reports the result of the request. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + versions - Version IDs of the product + +*******************************************************************************/ +#define CsrWifiSmeVersionsGetCfmCreate(msg__, dst__, src__, status__, versions__) \ + msg__ = (CsrWifiSmeVersionsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeVersionsGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_VERSIONS_GET_CFM, dst__, src__); \ + msg__->status = (status__); \ + msg__->versions = (versions__); + +#define CsrWifiSmeVersionsGetCfmSendTo(dst__, src__, status__, versions__) \ + { \ + CsrWifiSmeVersionsGetCfm *msg__; \ + CsrWifiSmeVersionsGetCfmCreate(msg__, dst__, src__, status__, versions__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeVersionsGetCfmSend(dst__, status__, versions__) \ + CsrWifiSmeVersionsGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, versions__) + +/******************************************************************************* + + NAME + CsrWifiSmeWifiFlightmodeReqSend + + DESCRIPTION + The wireless manager application may call this primitive on boot-up of + the platform to ensure that the chip is placed in a mode that prevents + any emission of RF energy. + This primitive is an alternative to CSR_WIFI_SME_WIFI_ON_REQ. + As in CSR_WIFI_SME_WIFI_ON_REQ, it causes the download of the patch file + (if any) and the programming of the initial MIB settings (if supplied by + the WMA), but it also ensures that the chip is left in its lowest + possible power-mode with the radio subsystems disabled. + This feature is useful on platforms where power cannot be removed from + the chip (leaving the chip not initialised will cause it to consume more + power so calling this function ensures that the chip is initialised into + a low power mode but without entering a state where it could emit any RF + energy). + NOTE: this primitive does not cause the Wi-Fi to change state: Wi-Fi + stays conceptually off. Configuration primitives can be sent after + CSR_WIFI_SME_WIFI_FLIGHTMODE_REQ and the configuration will be maintained. + Requests that require the state of the Wi-Fi to be ON will return + CSR_WIFI_SME_STATUS_WIFI_OFF in their confirms. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + address - Optionally specifies a station MAC address. + In normal use, the manager should set the address to 0xFF + 0xFF 0xFF 0xFF 0xFF 0xFF, which will cause the chip to use + the MAC address in the MIB. + mibFilesCount - Number of provided data blocks with initial MIB values + mibFiles - Points to the first data block with initial MIB values. + These data blocks are typically the contents of the provided + files ufmib.dat and localmib.dat, available from the host + file system, if they exist. + These files typically contain radio tuning and calibration + values. + More values can be created using the Host Tools. + +*******************************************************************************/ +#define CsrWifiSmeWifiFlightmodeReqCreate(msg__, dst__, src__, address__, mibFilesCount__, mibFiles__) \ + msg__ = (CsrWifiSmeWifiFlightmodeReq *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiFlightmodeReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_FLIGHTMODE_REQ, dst__, src__); \ + msg__->address = (address__); \ + msg__->mibFilesCount = (mibFilesCount__); \ + msg__->mibFiles = (mibFiles__); + +#define CsrWifiSmeWifiFlightmodeReqSendTo(dst__, src__, address__, mibFilesCount__, mibFiles__) \ + { \ + CsrWifiSmeWifiFlightmodeReq *msg__; \ + CsrWifiSmeWifiFlightmodeReqCreate(msg__, dst__, src__, address__, mibFilesCount__, mibFiles__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeWifiFlightmodeReqSend(src__, address__, mibFilesCount__, mibFiles__) \ + CsrWifiSmeWifiFlightmodeReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, address__, mibFilesCount__, mibFiles__) + +/******************************************************************************* + + NAME + CsrWifiSmeWifiFlightmodeCfmSend + + DESCRIPTION + The SME calls this primitive when the chip is initialised for low power + mode and with the radio subsystem disabled. To leave flight mode, and + enable Wi-Fi, the wireless manager application should call + CSR_WIFI_SME_WIFI_ON_REQ. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiSmeWifiFlightmodeCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiSmeWifiFlightmodeCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiFlightmodeCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_FLIGHTMODE_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiSmeWifiFlightmodeCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiSmeWifiFlightmodeCfm *msg__; \ + CsrWifiSmeWifiFlightmodeCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeWifiFlightmodeCfmSend(dst__, status__) \ + CsrWifiSmeWifiFlightmodeCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeWifiOffReqSend + + DESCRIPTION + The wireless manager application calls this primitive to turn off the + chip, thus saving power when Wi-Fi is not in use. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + +*******************************************************************************/ +#define CsrWifiSmeWifiOffReqCreate(msg__, dst__, src__) \ + msg__ = (CsrWifiSmeWifiOffReq *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiOffReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_OFF_REQ, dst__, src__); + +#define CsrWifiSmeWifiOffReqSendTo(dst__, src__) \ + { \ + CsrWifiSmeWifiOffReq *msg__; \ + CsrWifiSmeWifiOffReqCreate(msg__, dst__, src__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeWifiOffReqSend(src__) \ + CsrWifiSmeWifiOffReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) + +/******************************************************************************* + + NAME + CsrWifiSmeWifiOffIndSend + + DESCRIPTION + The SME sends this primitive to all the tasks that have registered to + receive it to report that the chip has been turned off. + + PARAMETERS + queue - Destination Task Queue + reason - Indicates the reason why the Wi-Fi has been switched off. + +*******************************************************************************/ +#define CsrWifiSmeWifiOffIndCreate(msg__, dst__, src__, reason__) \ + msg__ = (CsrWifiSmeWifiOffInd *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiOffInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_OFF_IND, dst__, src__); \ + msg__->reason = (reason__); + +#define CsrWifiSmeWifiOffIndSendTo(dst__, src__, reason__) \ + { \ + CsrWifiSmeWifiOffInd *msg__; \ + CsrWifiSmeWifiOffIndCreate(msg__, dst__, src__, reason__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeWifiOffIndSend(dst__, reason__) \ + CsrWifiSmeWifiOffIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, reason__) + +/******************************************************************************* + + NAME + CsrWifiSmeWifiOffCfmSend + + DESCRIPTION + After receiving CSR_WIFI_SME_WIFI_OFF_REQ, if the chip is connected to a + network, the SME will perform a disconnect operation, will send a + CSR_WIFI_SME_MEDIA_STATUS_IND with + CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED, and then will call + CSR_WIFI_SME_WIFI_OFF_CFM when the chip is off. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiSmeWifiOffCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiSmeWifiOffCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiOffCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_OFF_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiSmeWifiOffCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiSmeWifiOffCfm *msg__; \ + CsrWifiSmeWifiOffCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeWifiOffCfmSend(dst__, status__) \ + CsrWifiSmeWifiOffCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeWifiOnReqSend + + DESCRIPTION + The wireless manager application calls this primitive to turn on the + Wi-Fi chip. + If the Wi-Fi chip is currently off, the SME turns the Wi-Fi chip on, + downloads the patch file (if any), and programs the initial MIB settings + (if supplied by the WMA). + The patch file is not provided with the SME API; its downloading is + automatic and handled internally by the system. + The MIB settings, when provided, override the default values that the + firmware loads from EEPROM. + If the Wi-Fi chip is already on, the SME takes no action and returns a + successful status in the confirm. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + address - Optionally specifies a station MAC address. + In normal use, the manager should set the address to 0xFF + 0xFF 0xFF 0xFF 0xFF 0xFF, which will cause the chip to use + the MAC address in the MIB + mibFilesCount - Number of provided data blocks with initial MIB values + mibFiles - Points to the first data block with initial MIB values. + These data blocks are typically the contents of the provided + files ufmib.dat and localmib.dat, available from the host + file system, if they exist. + These files typically contain radio tuning and calibration + values. + More values can be created using the Host Tools. + +*******************************************************************************/ +#define CsrWifiSmeWifiOnReqCreate(msg__, dst__, src__, address__, mibFilesCount__, mibFiles__) \ + msg__ = (CsrWifiSmeWifiOnReq *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiOnReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_ON_REQ, dst__, src__); \ + msg__->address = (address__); \ + msg__->mibFilesCount = (mibFilesCount__); \ + msg__->mibFiles = (mibFiles__); + +#define CsrWifiSmeWifiOnReqSendTo(dst__, src__, address__, mibFilesCount__, mibFiles__) \ + { \ + CsrWifiSmeWifiOnReq *msg__; \ + CsrWifiSmeWifiOnReqCreate(msg__, dst__, src__, address__, mibFilesCount__, mibFiles__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeWifiOnReqSend(src__, address__, mibFilesCount__, mibFiles__) \ + CsrWifiSmeWifiOnReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, address__, mibFilesCount__, mibFiles__) + +/******************************************************************************* + + NAME + CsrWifiSmeWifiOnIndSend + + DESCRIPTION + The SME sends this primitive to all tasks that have registered to receive + it once the chip becomes available and ready to use. + + PARAMETERS + queue - Destination Task Queue + address - Current MAC address + +*******************************************************************************/ +#define CsrWifiSmeWifiOnIndCreate(msg__, dst__, src__, address__) \ + msg__ = (CsrWifiSmeWifiOnInd *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiOnInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_ON_IND, dst__, src__); \ + msg__->address = (address__); + +#define CsrWifiSmeWifiOnIndSendTo(dst__, src__, address__) \ + { \ + CsrWifiSmeWifiOnInd *msg__; \ + CsrWifiSmeWifiOnIndCreate(msg__, dst__, src__, address__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeWifiOnIndSend(dst__, address__) \ + CsrWifiSmeWifiOnIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, address__) + +/******************************************************************************* + + NAME + CsrWifiSmeWifiOnCfmSend + + DESCRIPTION + The SME sends this primitive to the task that has sent the request once + the chip has been initialised and is available for use. + + PARAMETERS + queue - Destination Task Queue + status - Reports the result of the request + +*******************************************************************************/ +#define CsrWifiSmeWifiOnCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiSmeWifiOnCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiOnCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_ON_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiSmeWifiOnCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiSmeWifiOnCfm *msg__; \ + CsrWifiSmeWifiOnCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeWifiOnCfmSend(dst__, status__) \ + CsrWifiSmeWifiOnCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) + +/******************************************************************************* + + NAME + CsrWifiSmeWpsConfigurationReqSend + + DESCRIPTION + This primitive passes the WPS information for the device to SME. This may + be accepted only if no interface is active. + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + wpsConfig - WPS config. + +*******************************************************************************/ +#define CsrWifiSmeWpsConfigurationReqCreate(msg__, dst__, src__, wpsConfig__) \ + msg__ = (CsrWifiSmeWpsConfigurationReq *) CsrPmemAlloc(sizeof(CsrWifiSmeWpsConfigurationReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WPS_CONFIGURATION_REQ, dst__, src__); \ + msg__->wpsConfig = (wpsConfig__); + +#define CsrWifiSmeWpsConfigurationReqSendTo(dst__, src__, wpsConfig__) \ + { \ + CsrWifiSmeWpsConfigurationReq *msg__; \ + CsrWifiSmeWpsConfigurationReqCreate(msg__, dst__, src__, wpsConfig__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeWpsConfigurationReqSend(src__, wpsConfig__) \ + CsrWifiSmeWpsConfigurationReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, wpsConfig__) + +/******************************************************************************* + + NAME + CsrWifiSmeWpsConfigurationCfmSend + + DESCRIPTION + Confirm. + + PARAMETERS + queue - Destination Task Queue + status - Status of the request. + +*******************************************************************************/ +#define CsrWifiSmeWpsConfigurationCfmCreate(msg__, dst__, src__, status__) \ + msg__ = (CsrWifiSmeWpsConfigurationCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeWpsConfigurationCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WPS_CONFIGURATION_CFM, dst__, src__); \ + msg__->status = (status__); + +#define CsrWifiSmeWpsConfigurationCfmSendTo(dst__, src__, status__) \ + { \ + CsrWifiSmeWpsConfigurationCfm *msg__; \ + CsrWifiSmeWpsConfigurationCfmCreate(msg__, dst__, src__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeWpsConfigurationCfmSend(dst__, status__) \ + CsrWifiSmeWpsConfigurationCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) + + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_SME_LIB_H__ */ diff --git a/drivers/staging/csr/csr_wifi_sme_prim.h b/drivers/staging/csr/csr_wifi_sme_prim.h new file mode 100644 index 0000000..4bc8520 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_sme_prim.h @@ -0,0 +1,6494 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_SME_PRIM_H__ +#define CSR_WIFI_SME_PRIM_H__ + +#include "csr_types.h" +#include "csr_prim_defs.h" +#include "csr_sched.h" +#include "csr_wifi_common.h" +#include "csr_result.h" +#include "csr_wifi_fsm_event.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define CSR_WIFI_SME_PRIM (0x0404) + +typedef CsrPrim CsrWifiSmePrim; + + +/******************************************************************************* + + NAME + CsrWifiSme80211NetworkType + + DESCRIPTION + Indicates the physical layer of the network + + VALUES + CSR_WIFI_SME_80211_NETWORK_TYPE_DS + - Direct-sequence spread spectrum + CSR_WIFI_SME_80211_NETWORK_TYPE_OFDM24 + - Orthogonal Frequency Division Multiplexing at 2.4 GHz + CSR_WIFI_SME_80211_NETWORK_TYPE_OFDM5 + - Orthogonal Frequency Division Multiplexing at 5 GHz + CSR_WIFI_SME_80211_NETWORK_TYPE_AUTO + - Automatic + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSme80211NetworkType; +#define CSR_WIFI_SME_80211_NETWORK_TYPE_DS ((CsrWifiSme80211NetworkType) 0x00) +#define CSR_WIFI_SME_80211_NETWORK_TYPE_OFDM24 ((CsrWifiSme80211NetworkType) 0x01) +#define CSR_WIFI_SME_80211_NETWORK_TYPE_OFDM5 ((CsrWifiSme80211NetworkType) 0x02) +#define CSR_WIFI_SME_80211_NETWORK_TYPE_AUTO ((CsrWifiSme80211NetworkType) 0x03) + +/******************************************************************************* + + NAME + CsrWifiSme80211PrivacyMode + + DESCRIPTION + Bits to enable or disable the privacy mode + + VALUES + CSR_WIFI_SME_80211_PRIVACY_MODE_DISABLED + - Privacy mode is enabled: use of WEP for confidentiality is + required. + CSR_WIFI_SME_80211_PRIVACY_MODE_ENABLED + - Privacy mode is disabled + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSme80211PrivacyMode; +#define CSR_WIFI_SME_80211_PRIVACY_MODE_DISABLED ((CsrWifiSme80211PrivacyMode) 0x00) +#define CSR_WIFI_SME_80211_PRIVACY_MODE_ENABLED ((CsrWifiSme80211PrivacyMode) 0x01) + +/******************************************************************************* + + NAME + CsrWifiSme80211dTrustLevel + + DESCRIPTION + Level of trust for the information coming from the network + + VALUES + CSR_WIFI_SME_80211D_TRUST_LEVEL_STRICT + - Start with passive scanning and only accept country IE for + updating channel lists + CSR_WIFI_SME_80211D_TRUST_LEVEL_ADJUNCT + - As above plus accept adjunct technology location + information + CSR_WIFI_SME_80211D_TRUST_LEVEL_BSS + - As above accept plus receiving channel from infrastructure + networks + CSR_WIFI_SME_80211D_TRUST_LEVEL_IBSS + - As above accept plus receiving channel from the ad hoc + networks + CSR_WIFI_SME_80211D_TRUST_LEVEL_MIB + - Start with active scanning with list of active channels + from the MIB and accept as above + CSR_WIFI_SME_80211D_TRUST_LEVEL_DISABLED + - Start with active scanning with list of active channels + from the MIB and ignore any channel information from the + network + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSme80211dTrustLevel; +#define CSR_WIFI_SME_80211D_TRUST_LEVEL_STRICT ((CsrWifiSme80211dTrustLevel) 0x01) +#define CSR_WIFI_SME_80211D_TRUST_LEVEL_ADJUNCT ((CsrWifiSme80211dTrustLevel) 0x02) +#define CSR_WIFI_SME_80211D_TRUST_LEVEL_BSS ((CsrWifiSme80211dTrustLevel) 0x03) +#define CSR_WIFI_SME_80211D_TRUST_LEVEL_IBSS ((CsrWifiSme80211dTrustLevel) 0x04) +#define CSR_WIFI_SME_80211D_TRUST_LEVEL_MIB ((CsrWifiSme80211dTrustLevel) 0x05) +#define CSR_WIFI_SME_80211D_TRUST_LEVEL_DISABLED ((CsrWifiSme80211dTrustLevel) 0x06) + +/******************************************************************************* + + NAME + CsrWifiSmeAmpStatus + + DESCRIPTION + AMP Current Status + + VALUES + CSR_WIFI_SME_AMP_ACTIVE - AMP ACTIVE. + CSR_WIFI_SME_AMP_INACTIVE - AMP INACTIVE + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeAmpStatus; +#define CSR_WIFI_SME_AMP_ACTIVE ((CsrWifiSmeAmpStatus) 0x00) +#define CSR_WIFI_SME_AMP_INACTIVE ((CsrWifiSmeAmpStatus) 0x01) + +/******************************************************************************* + + NAME + CsrWifiSmeAuthMode + + DESCRIPTION + Define bits for CsrWifiSmeAuthMode + + VALUES + CSR_WIFI_SME_AUTH_MODE_80211_OPEN + - Connects to an open system network (i.e. no authentication, + no encryption) or to a WEP enabled network. + CSR_WIFI_SME_AUTH_MODE_80211_SHARED + - Connect to a WEP enabled network. + CSR_WIFI_SME_AUTH_MODE_8021X_WPA + - Connects to a WPA Enterprise enabled network. + CSR_WIFI_SME_AUTH_MODE_8021X_WPAPSK + - Connects to a WPA with Pre-Shared Key enabled network. + CSR_WIFI_SME_AUTH_MODE_8021X_WPA2 + - Connects to a WPA2 Enterprise enabled network. + CSR_WIFI_SME_AUTH_MODE_8021X_WPA2PSK + - Connects to a WPA2 with Pre-Shared Key enabled network. + CSR_WIFI_SME_AUTH_MODE_8021X_CCKM + - Connects to a CCKM enabled network. + CSR_WIFI_SME_AUTH_MODE_WAPI_WAI + - Connects to a WAPI Enterprise enabled network. + CSR_WIFI_SME_AUTH_MODE_WAPI_WAIPSK + - Connects to a WAPI with Pre-Shared Key enabled network. + CSR_WIFI_SME_AUTH_MODE_8021X_OTHER1X + - For future use. + +*******************************************************************************/ +typedef CsrUint16 CsrWifiSmeAuthMode; +#define CSR_WIFI_SME_AUTH_MODE_80211_OPEN ((CsrWifiSmeAuthMode) 0x0001) +#define CSR_WIFI_SME_AUTH_MODE_80211_SHARED ((CsrWifiSmeAuthMode) 0x0002) +#define CSR_WIFI_SME_AUTH_MODE_8021X_WPA ((CsrWifiSmeAuthMode) 0x0004) +#define CSR_WIFI_SME_AUTH_MODE_8021X_WPAPSK ((CsrWifiSmeAuthMode) 0x0008) +#define CSR_WIFI_SME_AUTH_MODE_8021X_WPA2 ((CsrWifiSmeAuthMode) 0x0010) +#define CSR_WIFI_SME_AUTH_MODE_8021X_WPA2PSK ((CsrWifiSmeAuthMode) 0x0020) +#define CSR_WIFI_SME_AUTH_MODE_8021X_CCKM ((CsrWifiSmeAuthMode) 0x0040) +#define CSR_WIFI_SME_AUTH_MODE_WAPI_WAI ((CsrWifiSmeAuthMode) 0x0080) +#define CSR_WIFI_SME_AUTH_MODE_WAPI_WAIPSK ((CsrWifiSmeAuthMode) 0x0100) +#define CSR_WIFI_SME_AUTH_MODE_8021X_OTHER1X ((CsrWifiSmeAuthMode) 0x0200) + +/******************************************************************************* + + NAME + CsrWifiSmeBasicUsability + + DESCRIPTION + Indicates the usability level of a channel + + VALUES + CSR_WIFI_SME_BASIC_USABILITY_UNUSABLE + - Not usable; connection not recommended + CSR_WIFI_SME_BASIC_USABILITY_POOR + - Poor quality; connect only if nothing better is available + CSR_WIFI_SME_BASIC_USABILITY_SATISFACTORY + - Quality is satisfactory + CSR_WIFI_SME_BASIC_USABILITY_NOT_CONNECTED + - Not connected + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeBasicUsability; +#define CSR_WIFI_SME_BASIC_USABILITY_UNUSABLE ((CsrWifiSmeBasicUsability) 0x00) +#define CSR_WIFI_SME_BASIC_USABILITY_POOR ((CsrWifiSmeBasicUsability) 0x01) +#define CSR_WIFI_SME_BASIC_USABILITY_SATISFACTORY ((CsrWifiSmeBasicUsability) 0x02) +#define CSR_WIFI_SME_BASIC_USABILITY_NOT_CONNECTED ((CsrWifiSmeBasicUsability) 0x03) + +/******************************************************************************* + + NAME + CsrWifiSmeBssType + + DESCRIPTION + Indicates the BSS type + + VALUES + CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE + - Infrastructure BSS. + CSR_WIFI_SME_BSS_TYPE_ADHOC + - Ad hoc or Independent BSS. + CSR_WIFI_SME_BSS_TYPE_ANY_BSS + - Specifies any type of BSS + CSR_WIFI_SME_BSS_TYPE_P2P + - Specifies P2P + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeBssType; +#define CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE ((CsrWifiSmeBssType) 0x00) +#define CSR_WIFI_SME_BSS_TYPE_ADHOC ((CsrWifiSmeBssType) 0x01) +#define CSR_WIFI_SME_BSS_TYPE_ANY_BSS ((CsrWifiSmeBssType) 0x02) +#define CSR_WIFI_SME_BSS_TYPE_P2P ((CsrWifiSmeBssType) 0x03) + +/******************************************************************************* + + NAME + CsrWifiSmeCoexScheme + + DESCRIPTION + Options for the coexistence signalling + Same as MibValues + + VALUES + CSR_WIFI_SME_COEX_SCHEME_DISABLED + - The coexistence signalling is disabled + CSR_WIFI_SME_COEX_SCHEME_CSR + - Basic CSR coexistence signalling + CSR_WIFI_SME_COEX_SCHEME_CSR_CHANNEL + - Full CSR coexistence signalling + CSR_WIFI_SME_COEX_SCHEME_PTA + - Packet Traffic Arbitrator coexistence signalling + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeCoexScheme; +#define CSR_WIFI_SME_COEX_SCHEME_DISABLED ((CsrWifiSmeCoexScheme) 0x00) +#define CSR_WIFI_SME_COEX_SCHEME_CSR ((CsrWifiSmeCoexScheme) 0x01) +#define CSR_WIFI_SME_COEX_SCHEME_CSR_CHANNEL ((CsrWifiSmeCoexScheme) 0x02) +#define CSR_WIFI_SME_COEX_SCHEME_PTA ((CsrWifiSmeCoexScheme) 0x03) + +/******************************************************************************* + + NAME + CsrWifiSmeControlIndication + + DESCRIPTION + Indicates the reason why the Wi-Fi has been switched off. + The values of this type are used across the NME/SME/Router API's and they + must be kept consistent with the corresponding types in the .xml of the + ottherinterfaces + + VALUES + CSR_WIFI_SME_CONTROL_INDICATION_ERROR + - An unrecoverable error (for example, an unrecoverable SDIO + error) has occurred. + The wireless manager application should reinitialise the + chip by calling CSR_WIFI_SME_WIFI_ON_REQ. + CSR_WIFI_SME_CONTROL_INDICATION_EXIT + - The chip became unavailable due to an external action, for + example, when a plug-in card is ejected or the driver is + unloaded. + CSR_WIFI_SME_CONTROL_INDICATION_USER_REQUESTED + - The Wi-Fi has been switched off as the wireless manager + application has sent CSR_WIFI_SME_WIFI_OFF_REQ + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeControlIndication; +#define CSR_WIFI_SME_CONTROL_INDICATION_ERROR ((CsrWifiSmeControlIndication) 0x01) +#define CSR_WIFI_SME_CONTROL_INDICATION_EXIT ((CsrWifiSmeControlIndication) 0x02) +#define CSR_WIFI_SME_CONTROL_INDICATION_USER_REQUESTED ((CsrWifiSmeControlIndication) 0x03) + +/******************************************************************************* + + NAME + CsrWifiSmeCtsProtectionType + + DESCRIPTION + SME CTS Protection Types + + VALUES + CSR_WIFI_SME_CTS_PROTECTION_AUTOMATIC + - AP CTS Protection automatic based on non-ERP station in own + BSS or neighbouring BSS on the same channel based on OLBC. + This requires monitoring of beacons from other APs. + CSR_WIFI_SME_CTS_PROTECTION_FORCE_ENABLED + - AP CTS Protection Force enabled + CSR_WIFI_SME_CTS_PROTECTION_FORCE_DISABLED + - AP CTS Protection Force disabled. + CSR_WIFI_SME_CTS_PROTECTION_AUTOMATIC_NO_OLBC + - AP CTS Protection automatic without considering OLBC but + considering non-ERP station in the own BSS Valid only if AP + is configured to work in 802.11bg or 802.11g mode otherwise + this option specifies the same behaviour as AUTOMATIC + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeCtsProtectionType; +#define CSR_WIFI_SME_CTS_PROTECTION_AUTOMATIC ((CsrWifiSmeCtsProtectionType) 0x00) +#define CSR_WIFI_SME_CTS_PROTECTION_FORCE_ENABLED ((CsrWifiSmeCtsProtectionType) 0x01) +#define CSR_WIFI_SME_CTS_PROTECTION_FORCE_DISABLED ((CsrWifiSmeCtsProtectionType) 0x02) +#define CSR_WIFI_SME_CTS_PROTECTION_AUTOMATIC_NO_OLBC ((CsrWifiSmeCtsProtectionType) 0x03) + +/******************************************************************************* + + NAME + CsrWifiSmeD3AutoScanMode + + DESCRIPTION + Autonomous scan status while in D3 suspended period + + VALUES + CSR_WIFI_SME_D3AUTO_SCAN_MODE_PSON + - Autonomous scan stays on + CSR_WIFI_SME_D3AUTO_SCAN_MODE_PSOFF + - Autonomous scan is switched off + CSR_WIFI_SME_D3AUTO_SCAN_MODE_PSAUTO + - Automatically select autoscanning behaviour. + CURRENTLY NOT SUPPORTED + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeD3AutoScanMode; +#define CSR_WIFI_SME_D3AUTO_SCAN_MODE_PSON ((CsrWifiSmeD3AutoScanMode) 0x00) +#define CSR_WIFI_SME_D3AUTO_SCAN_MODE_PSOFF ((CsrWifiSmeD3AutoScanMode) 0x01) +#define CSR_WIFI_SME_D3AUTO_SCAN_MODE_PSAUTO ((CsrWifiSmeD3AutoScanMode) 0x02) + +/******************************************************************************* + + NAME + CsrWifiSmeEncryption + + DESCRIPTION + Defines bits for CsrWifiSmeEncryption + For a WEP enabled network, the caller must specify the correct + combination of flags in the encryptionModeMask. + + VALUES + CSR_WIFI_SME_ENCRYPTION_CIPHER_NONE + - No encryption set + CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP40 + - Selects 40 byte key WEP for unicast communication + CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP104 + - Selects 104 byte key WEP for unicast communication + CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_TKIP + - Selects TKIP for unicast communication + CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_CCMP + - Selects CCMP for unicast communication + CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_SMS4 + - Selects SMS4 for unicast communication + CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP40 + - Selects 40 byte key WEP for broadcast messages + CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP104 + - Selects 104 byte key WEP for broadcast messages + CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_TKIP + - Selects a TKIP for broadcast messages + CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_CCMP + - Selects CCMP for broadcast messages + CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_SMS4 + - Selects SMS4 for broadcast messages + +*******************************************************************************/ +typedef CsrUint16 CsrWifiSmeEncryption; +#define CSR_WIFI_SME_ENCRYPTION_CIPHER_NONE ((CsrWifiSmeEncryption) 0x0000) +#define CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP40 ((CsrWifiSmeEncryption) 0x0001) +#define CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP104 ((CsrWifiSmeEncryption) 0x0002) +#define CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_TKIP ((CsrWifiSmeEncryption) 0x0004) +#define CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_CCMP ((CsrWifiSmeEncryption) 0x0008) +#define CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_SMS4 ((CsrWifiSmeEncryption) 0x0010) +#define CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP40 ((CsrWifiSmeEncryption) 0x0020) +#define CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP104 ((CsrWifiSmeEncryption) 0x0040) +#define CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_TKIP ((CsrWifiSmeEncryption) 0x0080) +#define CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_CCMP ((CsrWifiSmeEncryption) 0x0100) +#define CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_SMS4 ((CsrWifiSmeEncryption) 0x0200) + +/******************************************************************************* + + NAME + CsrWifiSmeFirmwareDriverInterface + + DESCRIPTION + Type of communication between Host and Firmware + + VALUES + CSR_WIFI_SME_FIRMWARE_DRIVER_INTERFACE_UNIT_DATA_INTERFACE + - No preformated header. NOT SUPPORTED in the current release + CSR_WIFI_SME_FIRMWARE_DRIVER_INTERFACE_PACKET_INTERFACE + - Preformated IEEE 802.11 header for user plane + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeFirmwareDriverInterface; +#define CSR_WIFI_SME_FIRMWARE_DRIVER_INTERFACE_UNIT_DATA_INTERFACE ((CsrWifiSmeFirmwareDriverInterface) 0x00) +#define CSR_WIFI_SME_FIRMWARE_DRIVER_INTERFACE_PACKET_INTERFACE ((CsrWifiSmeFirmwareDriverInterface) 0x01) + +/******************************************************************************* + + NAME + CsrWifiSmeHostPowerMode + + DESCRIPTION + Defines the power mode + + VALUES + CSR_WIFI_SME_HOST_POWER_MODE_ACTIVE + - Host device is running on external power. + CSR_WIFI_SME_HOST_POWER_MODE_POWER_SAVE + - Host device is running on (internal) battery power. + CSR_WIFI_SME_HOST_POWER_MODE_FULL_POWER_SAVE + - For future use. + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeHostPowerMode; +#define CSR_WIFI_SME_HOST_POWER_MODE_ACTIVE ((CsrWifiSmeHostPowerMode) 0x00) +#define CSR_WIFI_SME_HOST_POWER_MODE_POWER_SAVE ((CsrWifiSmeHostPowerMode) 0x01) +#define CSR_WIFI_SME_HOST_POWER_MODE_FULL_POWER_SAVE ((CsrWifiSmeHostPowerMode) 0x02) + +/******************************************************************************* + + NAME + CsrWifiSmeIEEE80211Reason + + DESCRIPTION + As definined in the IEEE 802.11 standards + + VALUES + CSR_WIFI_SME_IEEE80211_REASON_SUCCESS + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_UNSPECIFIED_REASON + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_AUTHENTICATION_NOT_VALID + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_DEAUTHENTICATED_LEAVE_BSS + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_INACTIVITY + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_AP_OVERLOAD + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_CLASS_2FRAME_ERROR + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_CLASS_3FRAME_ERROR + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_LEAVE_BSS + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_ASSOCIATION_NOT_AUTHENTICATED + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_POWER_CAPABILITY + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_SUPPORTED_CHANNELS + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_INVALID_INFORMATION_ELEMENT + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_MICHAEL_MIC_FAILURE + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_FOURWAY_HANDSHAKE_TIMEOUT + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_GROUP_KEY_UPDATE_TIMEOUT + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_HANDSHAKE_ELEMENT_DIFFERENT + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_INVALID_GROUP_CIPHER + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_INVALID_PAIRWISE_CIPHER + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_INVALID_AKMP + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_UNSUPPORTED_RSN_IEVERSION + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_INVALID_RSN_IECAPABILITIES + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_DOT1X_AUTH_FAILED + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_CIPHER_REJECTED_BY_POLICY + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_SERVICE_CHANGE_PRECLUDES_TS + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_QOS_UNSPECIFIED_REASON + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_QOS_INSUFFICIENT_BANDWIDTH + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_QOS_EXCESSIVE_NOT_ACK + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_QOS_TXOPLIMIT_EXCEEDED + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_QSTA_LEAVING + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_END_TS + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_END_DLS + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_END_BA + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_UNKNOWN_TS + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_UNKNOWN_BA + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_UNKNOWN_DLS + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_TIMEOUT + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_STAKEY_MISMATCH + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_UNICAST_KEY_NEGOTIATION_TIMEOUT + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_MULTICAST_KEY_ANNOUNCEMENT_TIMEOUT + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_INCOMPATIBLE_UNICAST_KEY_NEGOTIATION_IE + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_INVALID_MULTICAST_CIPHER + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_INVALID_UNICAST_CIPHER + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_UNSUPPORTED_WAPI_IE_VERSION + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_INVALID_WAPI_CAPABILITY_IE + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_REASON_WAI_CERTIFICATE_AUTHENTICATION_FAILED + - See IEEE 802.11 Standard + +*******************************************************************************/ +typedef CsrUint16 CsrWifiSmeIEEE80211Reason; +#define CSR_WIFI_SME_IEEE80211_REASON_SUCCESS ((CsrWifiSmeIEEE80211Reason) 0x0000) +#define CSR_WIFI_SME_IEEE80211_REASON_UNSPECIFIED_REASON ((CsrWifiSmeIEEE80211Reason) 0x0001) +#define CSR_WIFI_SME_IEEE80211_REASON_AUTHENTICATION_NOT_VALID ((CsrWifiSmeIEEE80211Reason) 0x0002) +#define CSR_WIFI_SME_IEEE80211_REASON_DEAUTHENTICATED_LEAVE_BSS ((CsrWifiSmeIEEE80211Reason) 0x0003) +#define CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_INACTIVITY ((CsrWifiSmeIEEE80211Reason) 0x0004) +#define CSR_WIFI_SME_IEEE80211_REASON_AP_OVERLOAD ((CsrWifiSmeIEEE80211Reason) 0x0005) +#define CSR_WIFI_SME_IEEE80211_REASON_CLASS_2FRAME_ERROR ((CsrWifiSmeIEEE80211Reason) 0x0006) +#define CSR_WIFI_SME_IEEE80211_REASON_CLASS_3FRAME_ERROR ((CsrWifiSmeIEEE80211Reason) 0x0007) +#define CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_LEAVE_BSS ((CsrWifiSmeIEEE80211Reason) 0x0008) +#define CSR_WIFI_SME_IEEE80211_REASON_ASSOCIATION_NOT_AUTHENTICATED ((CsrWifiSmeIEEE80211Reason) 0x0009) +#define CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_POWER_CAPABILITY ((CsrWifiSmeIEEE80211Reason) 0x000a) +#define CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_SUPPORTED_CHANNELS ((CsrWifiSmeIEEE80211Reason) 0x000b) +#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_INFORMATION_ELEMENT ((CsrWifiSmeIEEE80211Reason) 0x000d) +#define CSR_WIFI_SME_IEEE80211_REASON_MICHAEL_MIC_FAILURE ((CsrWifiSmeIEEE80211Reason) 0x000e) +#define CSR_WIFI_SME_IEEE80211_REASON_FOURWAY_HANDSHAKE_TIMEOUT ((CsrWifiSmeIEEE80211Reason) 0x000f) +#define CSR_WIFI_SME_IEEE80211_REASON_GROUP_KEY_UPDATE_TIMEOUT ((CsrWifiSmeIEEE80211Reason) 0x0010) +#define CSR_WIFI_SME_IEEE80211_REASON_HANDSHAKE_ELEMENT_DIFFERENT ((CsrWifiSmeIEEE80211Reason) 0x0011) +#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_GROUP_CIPHER ((CsrWifiSmeIEEE80211Reason) 0x0012) +#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_PAIRWISE_CIPHER ((CsrWifiSmeIEEE80211Reason) 0x0013) +#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_AKMP ((CsrWifiSmeIEEE80211Reason) 0x0014) +#define CSR_WIFI_SME_IEEE80211_REASON_UNSUPPORTED_RSN_IEVERSION ((CsrWifiSmeIEEE80211Reason) 0x0015) +#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_RSN_IECAPABILITIES ((CsrWifiSmeIEEE80211Reason) 0x0016) +#define CSR_WIFI_SME_IEEE80211_REASON_DOT1X_AUTH_FAILED ((CsrWifiSmeIEEE80211Reason) 0x0017) +#define CSR_WIFI_SME_IEEE80211_REASON_CIPHER_REJECTED_BY_POLICY ((CsrWifiSmeIEEE80211Reason) 0x0018) +#define CSR_WIFI_SME_IEEE80211_REASON_SERVICE_CHANGE_PRECLUDES_TS ((CsrWifiSmeIEEE80211Reason) 0x001F) +#define CSR_WIFI_SME_IEEE80211_REASON_QOS_UNSPECIFIED_REASON ((CsrWifiSmeIEEE80211Reason) 0x0020) +#define CSR_WIFI_SME_IEEE80211_REASON_QOS_INSUFFICIENT_BANDWIDTH ((CsrWifiSmeIEEE80211Reason) 0x0021) +#define CSR_WIFI_SME_IEEE80211_REASON_QOS_EXCESSIVE_NOT_ACK ((CsrWifiSmeIEEE80211Reason) 0x0022) +#define CSR_WIFI_SME_IEEE80211_REASON_QOS_TXOPLIMIT_EXCEEDED ((CsrWifiSmeIEEE80211Reason) 0x0023) +#define CSR_WIFI_SME_IEEE80211_REASON_QSTA_LEAVING ((CsrWifiSmeIEEE80211Reason) 0x0024) +#define CSR_WIFI_SME_IEEE80211_REASON_END_TS ((CsrWifiSmeIEEE80211Reason) 0x0025) +#define CSR_WIFI_SME_IEEE80211_REASON_END_DLS ((CsrWifiSmeIEEE80211Reason) 0x0025) +#define CSR_WIFI_SME_IEEE80211_REASON_END_BA ((CsrWifiSmeIEEE80211Reason) 0x0025) +#define CSR_WIFI_SME_IEEE80211_REASON_UNKNOWN_TS ((CsrWifiSmeIEEE80211Reason) 0x0026) +#define CSR_WIFI_SME_IEEE80211_REASON_UNKNOWN_BA ((CsrWifiSmeIEEE80211Reason) 0x0026) +#define CSR_WIFI_SME_IEEE80211_REASON_UNKNOWN_DLS ((CsrWifiSmeIEEE80211Reason) 0x0026) +#define CSR_WIFI_SME_IEEE80211_REASON_TIMEOUT ((CsrWifiSmeIEEE80211Reason) 0x0027) +#define CSR_WIFI_SME_IEEE80211_REASON_STAKEY_MISMATCH ((CsrWifiSmeIEEE80211Reason) 0x002d) +#define CSR_WIFI_SME_IEEE80211_REASON_UNICAST_KEY_NEGOTIATION_TIMEOUT ((CsrWifiSmeIEEE80211Reason) 0xf019) +#define CSR_WIFI_SME_IEEE80211_REASON_MULTICAST_KEY_ANNOUNCEMENT_TIMEOUT ((CsrWifiSmeIEEE80211Reason) 0xf01a) +#define CSR_WIFI_SME_IEEE80211_REASON_INCOMPATIBLE_UNICAST_KEY_NEGOTIATION_IE ((CsrWifiSmeIEEE80211Reason) 0xf01b) +#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_MULTICAST_CIPHER ((CsrWifiSmeIEEE80211Reason) 0xf01c) +#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_UNICAST_CIPHER ((CsrWifiSmeIEEE80211Reason) 0xf01d) +#define CSR_WIFI_SME_IEEE80211_REASON_UNSUPPORTED_WAPI_IE_VERSION ((CsrWifiSmeIEEE80211Reason) 0xf01e) +#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_WAPI_CAPABILITY_IE ((CsrWifiSmeIEEE80211Reason) 0xf01f) +#define CSR_WIFI_SME_IEEE80211_REASON_WAI_CERTIFICATE_AUTHENTICATION_FAILED ((CsrWifiSmeIEEE80211Reason) 0xf020) + +/******************************************************************************* + + NAME + CsrWifiSmeIEEE80211Result + + DESCRIPTION + As definined in the IEEE 802.11 standards + + VALUES + CSR_WIFI_SME_IEEE80211_RESULT_SUCCESS + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_UNSPECIFIED_FAILURE + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_CAPABILITIES_MISMATCH + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REASSOCIATION_DENIED_NO_ASSOCIATION + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_EXTERNAL_REASON + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AUTHENTICATION_MISMATCH + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_INVALID_AUTHENTICATION_SEQUENCE_NUMBER + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_CHALLENGE_FAILURE + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AUTHENTICATION_TIMEOUT + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AP_OUT_OF_MEMORY + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_BASIC_RATES_MISMATCH + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SHORT_PREAMBLE_REQUIRED + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_PBCC_MODULATION_REQUIRED + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_CHANNEL_AGILITY_REQUIRED + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SPECTRUM_MANAGEMENT_REQUIRED + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_POWER_CAPABILITY_UNACCEPTABLE + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SUPPORTED_CHANNELS_UNACCEPTABLE + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SHORT_SLOT_REQUIRED + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_DSSS_OFDMREQUIRED + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_NO_HT_SUPPORT + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_R0KH_UNREACHABLE + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_PCO_TRANSITION_SUPPORT + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_ASSOCIATION_REQUEST_REJECTED_TEMPORARILY + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_ROBUST_MANAGEMENT_FRAME_POLICY_VIOLATION + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_FAILURE + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AP_BANDWIDTH_INSUFFICIENT + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_POOR_OPERATING_CHANNEL + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_QOS_REQUIRED + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_REASON_UNSPECIFIED + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_INVALID_PARAMETERS + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_WITH_SUGGESTED_TSPEC_CHANGES + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_IE + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_GROUP_CIPHER + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_PAIRWISE_CIPHER + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_AKMP + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_UNSUPPORTED_RSN_VERSION + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_RSN_CAPABILITY + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_SECURITY_POLICY + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_FOR_DELAY_PERIOD + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_NOT_ALLOWED + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_NOT_PRESENT + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_NOT_QSTA + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_LISTEN_INTERVAL_TOO_LARGE + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_INVALID_FT_ACTION_FRAME_COUNT + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_INVALID_PMKID + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_INVALID_MDIE + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_INVALID_FTIE + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_UNSPECIFIED_QOS_FAILURE + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_WRONG_POLICY + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_INSUFFICIENT_BANDWIDTH + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_INVALID_TSPEC_PARAMETERS + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_TIMEOUT + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_TOO_MANY_SIMULTANEOUS_REQUESTS + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_BSS_ALREADY_STARTED_OR_JOINED + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_NOT_SUPPORTED + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_TRANSMISSION_FAILURE + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_NOT_AUTHENTICATED + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_RESET_REQUIRED_BEFORE_START + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_LM_INFO_UNAVAILABLE + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_INVALID_UNICAST_CIPHER + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_INVALID_MULTICAST_CIPHER + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_UNSUPPORTED_WAPI_IE_VERSION + - See IEEE 802.11 Standard + CSR_WIFI_SME_IEEE80211_RESULT_INVALID_WAPI_CAPABILITY_IE + - See IEEE 802.11 Standard + +*******************************************************************************/ +typedef CsrUint16 CsrWifiSmeIEEE80211Result; +#define CSR_WIFI_SME_IEEE80211_RESULT_SUCCESS ((CsrWifiSmeIEEE80211Result) 0x0000) +#define CSR_WIFI_SME_IEEE80211_RESULT_UNSPECIFIED_FAILURE ((CsrWifiSmeIEEE80211Result) 0x0001) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_CAPABILITIES_MISMATCH ((CsrWifiSmeIEEE80211Result) 0x000a) +#define CSR_WIFI_SME_IEEE80211_RESULT_REASSOCIATION_DENIED_NO_ASSOCIATION ((CsrWifiSmeIEEE80211Result) 0x000b) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_EXTERNAL_REASON ((CsrWifiSmeIEEE80211Result) 0x000c) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AUTHENTICATION_MISMATCH ((CsrWifiSmeIEEE80211Result) 0x000d) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_INVALID_AUTHENTICATION_SEQUENCE_NUMBER ((CsrWifiSmeIEEE80211Result) 0x000e) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_CHALLENGE_FAILURE ((CsrWifiSmeIEEE80211Result) 0x000f) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AUTHENTICATION_TIMEOUT ((CsrWifiSmeIEEE80211Result) 0x0010) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AP_OUT_OF_MEMORY ((CsrWifiSmeIEEE80211Result) 0x0011) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_BASIC_RATES_MISMATCH ((CsrWifiSmeIEEE80211Result) 0x0012) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SHORT_PREAMBLE_REQUIRED ((CsrWifiSmeIEEE80211Result) 0x0013) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_PBCC_MODULATION_REQUIRED ((CsrWifiSmeIEEE80211Result) 0x0014) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_CHANNEL_AGILITY_REQUIRED ((CsrWifiSmeIEEE80211Result) 0x0015) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SPECTRUM_MANAGEMENT_REQUIRED ((CsrWifiSmeIEEE80211Result) 0x0016) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_POWER_CAPABILITY_UNACCEPTABLE ((CsrWifiSmeIEEE80211Result) 0x0017) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SUPPORTED_CHANNELS_UNACCEPTABLE ((CsrWifiSmeIEEE80211Result) 0x0018) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SHORT_SLOT_REQUIRED ((CsrWifiSmeIEEE80211Result) 0x0019) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_DSSS_OFDMREQUIRED ((CsrWifiSmeIEEE80211Result) 0x001a) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_NO_HT_SUPPORT ((CsrWifiSmeIEEE80211Result) 0x001b) +#define CSR_WIFI_SME_IEEE80211_RESULT_R0KH_UNREACHABLE ((CsrWifiSmeIEEE80211Result) 0x001c) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_PCO_TRANSITION_SUPPORT ((CsrWifiSmeIEEE80211Result) 0x001d) +#define CSR_WIFI_SME_IEEE80211_RESULT_ASSOCIATION_REQUEST_REJECTED_TEMPORARILY ((CsrWifiSmeIEEE80211Result) 0x001e) +#define CSR_WIFI_SME_IEEE80211_RESULT_ROBUST_MANAGEMENT_FRAME_POLICY_VIOLATION ((CsrWifiSmeIEEE80211Result) 0x001f) +#define CSR_WIFI_SME_IEEE80211_RESULT_FAILURE ((CsrWifiSmeIEEE80211Result) 0x0020) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AP_BANDWIDTH_INSUFFICIENT ((CsrWifiSmeIEEE80211Result) 0x0021) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_POOR_OPERATING_CHANNEL ((CsrWifiSmeIEEE80211Result) 0x0022) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_QOS_REQUIRED ((CsrWifiSmeIEEE80211Result) 0x0023) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_REASON_UNSPECIFIED ((CsrWifiSmeIEEE80211Result) 0x0025) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED ((CsrWifiSmeIEEE80211Result) 0x0025) +#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_PARAMETERS ((CsrWifiSmeIEEE80211Result) 0x0026) +#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_WITH_SUGGESTED_TSPEC_CHANGES ((CsrWifiSmeIEEE80211Result) 0x0027) +#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_IE ((CsrWifiSmeIEEE80211Result) 0x0028) +#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_GROUP_CIPHER ((CsrWifiSmeIEEE80211Result) 0x0029) +#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_PAIRWISE_CIPHER ((CsrWifiSmeIEEE80211Result) 0x002a) +#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_AKMP ((CsrWifiSmeIEEE80211Result) 0x002b) +#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_UNSUPPORTED_RSN_VERSION ((CsrWifiSmeIEEE80211Result) 0x002c) +#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_RSN_CAPABILITY ((CsrWifiSmeIEEE80211Result) 0x002d) +#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_SECURITY_POLICY ((CsrWifiSmeIEEE80211Result) 0x002e) +#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_FOR_DELAY_PERIOD ((CsrWifiSmeIEEE80211Result) 0x002f) +#define CSR_WIFI_SME_IEEE80211_RESULT_NOT_ALLOWED ((CsrWifiSmeIEEE80211Result) 0x0030) +#define CSR_WIFI_SME_IEEE80211_RESULT_NOT_PRESENT ((CsrWifiSmeIEEE80211Result) 0x0031) +#define CSR_WIFI_SME_IEEE80211_RESULT_NOT_QSTA ((CsrWifiSmeIEEE80211Result) 0x0032) +#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_LISTEN_INTERVAL_TOO_LARGE ((CsrWifiSmeIEEE80211Result) 0x0033) +#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_FT_ACTION_FRAME_COUNT ((CsrWifiSmeIEEE80211Result) 0x0034) +#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_PMKID ((CsrWifiSmeIEEE80211Result) 0x0035) +#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_MDIE ((CsrWifiSmeIEEE80211Result) 0x0036) +#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_FTIE ((CsrWifiSmeIEEE80211Result) 0x0037) +#define CSR_WIFI_SME_IEEE80211_RESULT_UNSPECIFIED_QOS_FAILURE ((CsrWifiSmeIEEE80211Result) 0x00c8) +#define CSR_WIFI_SME_IEEE80211_RESULT_WRONG_POLICY ((CsrWifiSmeIEEE80211Result) 0x00c9) +#define CSR_WIFI_SME_IEEE80211_RESULT_INSUFFICIENT_BANDWIDTH ((CsrWifiSmeIEEE80211Result) 0x00ca) +#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_TSPEC_PARAMETERS ((CsrWifiSmeIEEE80211Result) 0x00cb) +#define CSR_WIFI_SME_IEEE80211_RESULT_TIMEOUT ((CsrWifiSmeIEEE80211Result) 0x8000) +#define CSR_WIFI_SME_IEEE80211_RESULT_TOO_MANY_SIMULTANEOUS_REQUESTS ((CsrWifiSmeIEEE80211Result) 0x8001) +#define CSR_WIFI_SME_IEEE80211_RESULT_BSS_ALREADY_STARTED_OR_JOINED ((CsrWifiSmeIEEE80211Result) 0x8002) +#define CSR_WIFI_SME_IEEE80211_RESULT_NOT_SUPPORTED ((CsrWifiSmeIEEE80211Result) 0x8003) +#define CSR_WIFI_SME_IEEE80211_RESULT_TRANSMISSION_FAILURE ((CsrWifiSmeIEEE80211Result) 0x8004) +#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_NOT_AUTHENTICATED ((CsrWifiSmeIEEE80211Result) 0x8005) +#define CSR_WIFI_SME_IEEE80211_RESULT_RESET_REQUIRED_BEFORE_START ((CsrWifiSmeIEEE80211Result) 0x8006) +#define CSR_WIFI_SME_IEEE80211_RESULT_LM_INFO_UNAVAILABLE ((CsrWifiSmeIEEE80211Result) 0x8007) +#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_UNICAST_CIPHER ((CsrWifiSmeIEEE80211Result) 0xf02f) +#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_MULTICAST_CIPHER ((CsrWifiSmeIEEE80211Result) 0xf030) +#define CSR_WIFI_SME_IEEE80211_RESULT_UNSUPPORTED_WAPI_IE_VERSION ((CsrWifiSmeIEEE80211Result) 0xf031) +#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_WAPI_CAPABILITY_IE ((CsrWifiSmeIEEE80211Result) 0xf032) + +/******************************************************************************* + + NAME + CsrWifiSmeIndications + + DESCRIPTION + Defines bits for CsrWifiSmeIndicationsMask + + VALUES + CSR_WIFI_SME_INDICATIONS_NONE + - Used to cancel the registrations for receiving indications + CSR_WIFI_SME_INDICATIONS_WIFIOFF + - Used to register for CSR_WIFI_SME_WIFI_OFF_IND events + CSR_WIFI_SME_INDICATIONS_SCANRESULT + - Used to register for CSR_WIFI_SME_SCAN_RESULT_IND events + CSR_WIFI_SME_INDICATIONS_CONNECTIONQUALITY + - Used to register for CSR_WIFI_SME_CONNECTION_QUALITY_IND + events + CSR_WIFI_SME_INDICATIONS_MEDIASTATUS + - Used to register for CSR_WIFI_SME_MEDIA_STATUS_IND events + CSR_WIFI_SME_INDICATIONS_MICFAILURE + - Used to register for CSR_WIFI_SME_MICFAILURE_IND events + CSR_WIFI_SME_INDICATIONS_PMKIDCANDIDATELIST + - Used to register for CSR_WIFI_SME_PMKIDCANDIDATE_LIST_IND + events + CSR_WIFI_SME_INDICATIONS_TSPEC + - Used to register for CSR_WIFI_SME_TSPEC_IND events + CSR_WIFI_SME_INDICATIONS_ROAMSTART + - Used to register for CSR_WIFI_SME_ROAM_START_IND events + CSR_WIFI_SME_INDICATIONS_ROAMCOMPLETE + - Used to register for CSR_WIFI_SME_ROAM_COMPLETE_IND events + CSR_WIFI_SME_INDICATIONS_ASSOCIATIONSTART + - Used to register for CSR_WIFI_SME_ASSOCIATION_START_IND + events + CSR_WIFI_SME_INDICATIONS_ASSOCIATIONCOMPLETE + - Used to register for CSR_WIFI_SME_ASSOCIATION_COMPLETE_IND + events + CSR_WIFI_SME_INDICATIONS_IBSSSTATION + - Used to register for CSR_WIFI_SME_IBSS_STATION_IND events + CSR_WIFI_SME_INDICATIONS_WIFION + - Used to register for CSR_WIFI_SME_WIFI_ON_IND events + CSR_WIFI_SME_INDICATIONS_ERROR + - Used to register for CSR_WIFI_SME_ERROR_IND events + CSR_WIFI_SME_INDICATIONS_INFO + - Used to register for CSR_WIFI_SME_INFO_IND events + CSR_WIFI_SME_INDICATIONS_COREDUMP + - Used to register for CSR_WIFI_SME_CORE_DUMP_IND events + CSR_WIFI_SME_INDICATIONS_ALL + - Used to register for all available indications + +*******************************************************************************/ +typedef CsrUint32 CsrWifiSmeIndications; +#define CSR_WIFI_SME_INDICATIONS_NONE ((CsrWifiSmeIndications) 0x00000000) +#define CSR_WIFI_SME_INDICATIONS_WIFIOFF ((CsrWifiSmeIndications) 0x00000001) +#define CSR_WIFI_SME_INDICATIONS_SCANRESULT ((CsrWifiSmeIndications) 0x00000002) +#define CSR_WIFI_SME_INDICATIONS_CONNECTIONQUALITY ((CsrWifiSmeIndications) 0x00000004) +#define CSR_WIFI_SME_INDICATIONS_MEDIASTATUS ((CsrWifiSmeIndications) 0x00000008) +#define CSR_WIFI_SME_INDICATIONS_MICFAILURE ((CsrWifiSmeIndications) 0x00000010) +#define CSR_WIFI_SME_INDICATIONS_PMKIDCANDIDATELIST ((CsrWifiSmeIndications) 0x00000020) +#define CSR_WIFI_SME_INDICATIONS_TSPEC ((CsrWifiSmeIndications) 0x00000040) +#define CSR_WIFI_SME_INDICATIONS_ROAMSTART ((CsrWifiSmeIndications) 0x00000080) +#define CSR_WIFI_SME_INDICATIONS_ROAMCOMPLETE ((CsrWifiSmeIndications) 0x00000100) +#define CSR_WIFI_SME_INDICATIONS_ASSOCIATIONSTART ((CsrWifiSmeIndications) 0x00000200) +#define CSR_WIFI_SME_INDICATIONS_ASSOCIATIONCOMPLETE ((CsrWifiSmeIndications) 0x00000400) +#define CSR_WIFI_SME_INDICATIONS_IBSSSTATION ((CsrWifiSmeIndications) 0x00000800) +#define CSR_WIFI_SME_INDICATIONS_WIFION ((CsrWifiSmeIndications) 0x00001000) +#define CSR_WIFI_SME_INDICATIONS_ERROR ((CsrWifiSmeIndications) 0x00002000) +#define CSR_WIFI_SME_INDICATIONS_INFO ((CsrWifiSmeIndications) 0x00004000) +#define CSR_WIFI_SME_INDICATIONS_COREDUMP ((CsrWifiSmeIndications) 0x00008000) +#define CSR_WIFI_SME_INDICATIONS_ALL ((CsrWifiSmeIndications) 0xFFFFFFFF) + +/******************************************************************************* + + NAME + CsrWifiSmeKeyType + + DESCRIPTION + Indicates the type of the key + + VALUES + CSR_WIFI_SME_KEY_TYPE_GROUP - Key for broadcast communication + CSR_WIFI_SME_KEY_TYPE_PAIRWISE - Key for unicast communication + CSR_WIFI_SME_KEY_TYPE_STAKEY - Key for direct link communication to + another station in infrastructure networks + CSR_WIFI_SME_KEY_TYPE_IGTK - Integrity Group Temporal Key + CSR_WIFI_SME_KEY_TYPE_CCKM - Key for Cisco Centralized Key Management + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeKeyType; +#define CSR_WIFI_SME_KEY_TYPE_GROUP ((CsrWifiSmeKeyType) 0x00) +#define CSR_WIFI_SME_KEY_TYPE_PAIRWISE ((CsrWifiSmeKeyType) 0x01) +#define CSR_WIFI_SME_KEY_TYPE_STAKEY ((CsrWifiSmeKeyType) 0x02) +#define CSR_WIFI_SME_KEY_TYPE_IGTK ((CsrWifiSmeKeyType) 0x03) +#define CSR_WIFI_SME_KEY_TYPE_CCKM ((CsrWifiSmeKeyType) 0x04) + +/******************************************************************************* + + NAME + CsrWifiSmeListAction + + DESCRIPTION + Identifies the type of action to be performed on a list of items + The values of this type are used across the NME/SME/Router API's and they + must be kept consistent with the corresponding types in the .xml of the + ottherinterfaces + + VALUES + CSR_WIFI_SME_LIST_ACTION_GET - Retrieve the current list of items + CSR_WIFI_SME_LIST_ACTION_ADD - Add one or more items + CSR_WIFI_SME_LIST_ACTION_REMOVE - Remove one or more items + CSR_WIFI_SME_LIST_ACTION_FLUSH - Remove all items + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeListAction; +#define CSR_WIFI_SME_LIST_ACTION_GET ((CsrWifiSmeListAction) 0x00) +#define CSR_WIFI_SME_LIST_ACTION_ADD ((CsrWifiSmeListAction) 0x01) +#define CSR_WIFI_SME_LIST_ACTION_REMOVE ((CsrWifiSmeListAction) 0x02) +#define CSR_WIFI_SME_LIST_ACTION_FLUSH ((CsrWifiSmeListAction) 0x03) + +/******************************************************************************* + + NAME + CsrWifiSmeMediaStatus + + DESCRIPTION + Indicates the connection status + The values of this type are used across the NME/SME/Router API's and they + must be kept consistent with the corresponding types in the .xml of the + ottherinterfaces + + VALUES + CSR_WIFI_SME_MEDIA_STATUS_CONNECTED + - Value CSR_WIFI_SME_MEDIA_STATUS_CONNECTED can happen in two + situations: + * A network connection is established. Specifically, this is + when the MLME_ASSOCIATION completes or the first peer + relationship is established in an IBSS. In a WPA/WPA2 + network, this indicates that the stack is ready to perform + the 4-way handshake or 802.1x authentication if CSR NME + security library is not used. If CSR NME security library + is used this indicates, completion of 4way handshake or + 802.1x authentication + * The SME roams to another AP on the same ESS + During the AP operation, it indicates that the peer station + is connected to the AP and is ready for data transfer. + CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED + - Value CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED can happen in + two situations: + * when the connection to a network is lost and there is no + alternative on the same ESS to roam to + * when a CSR_WIFI_SME_DISCONNECT_REQ request is issued + During AP or P2PGO operation, it indicates that the peer + station has disconnected from the AP + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeMediaStatus; +#define CSR_WIFI_SME_MEDIA_STATUS_CONNECTED ((CsrWifiSmeMediaStatus) 0x00) +#define CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED ((CsrWifiSmeMediaStatus) 0x01) + +/******************************************************************************* + + NAME + CsrWifiSmeP2pCapability + + DESCRIPTION + Defines P2P Device Capabilities + + VALUES + CSR_WIFI_SME_P2P_SERVICE_DISCOVERY_CAPABILITY + - This field is set to 1 if the P2P Device supports Service + Discovery, and to 0 otherwise + CSR_WIFI_SME_P2P_CLIENT_DISCOVERABILITY_CAPABILITY + - This field is set to 1 when the P2P Device supports P2P + Client Discoverability, and to 0 otherwise. + CSR_WIFI_SME_P2P_CONCURRENT_OPERATION_CAPABILITY + - This field is set to 1 when the P2P Device supports + Concurrent Operation with WLAN, and to 0 otherwise. + CSR_WIFI_SME_P2P_MANAGED_DEVICE_CAPABILITY + - This field is set to 1 when the P2P interface of the P2P + Device is capable of being managed by the WLAN + (infrastructure network) based on P2P coexistence + parameters, and to 0 otherwise + CSR_WIFI_SME_P2P_INVITAION_CAPABILITY + - This field is set to 1 if the P2P Device is capable of + processing P2P Invitation Procedure signaling, and to 0 + otherwise. + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeP2pCapability; +#define CSR_WIFI_SME_P2P_SERVICE_DISCOVERY_CAPABILITY ((CsrWifiSmeP2pCapability) 0x01) +#define CSR_WIFI_SME_P2P_CLIENT_DISCOVERABILITY_CAPABILITY ((CsrWifiSmeP2pCapability) 0x02) +#define CSR_WIFI_SME_P2P_CONCURRENT_OPERATION_CAPABILITY ((CsrWifiSmeP2pCapability) 0x04) +#define CSR_WIFI_SME_P2P_MANAGED_DEVICE_CAPABILITY ((CsrWifiSmeP2pCapability) 0x08) +#define CSR_WIFI_SME_P2P_INVITAION_CAPABILITY ((CsrWifiSmeP2pCapability) 0x20) + +/******************************************************************************* + + NAME + CsrWifiSmeP2pGroupCapability + + DESCRIPTION + Define bits for P2P Group Capability + + VALUES + CSR_WIFI_P2P_GRP_CAP_GO + - Indicates if the local device has become a GO after GO + negotiation + CSR_WIFI_P2P_GRP_CAP_PERSISTENT + - Persistent group + CSR_WIFI_P2P_GRP_CAP_INTRABSS_DIST + - Intra-BSS data distribution support + CSR_WIFI_P2P_GRP_CAP_CROSS_CONN + - Support of cross connection + CSR_WIFI_P2P_GRP_CAP_PERSISTENT_RECONNECT + - Support of persistent reconnect + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeP2pGroupCapability; +#define CSR_WIFI_P2P_GRP_CAP_GO ((CsrWifiSmeP2pGroupCapability) 0x01) +#define CSR_WIFI_P2P_GRP_CAP_PERSISTENT ((CsrWifiSmeP2pGroupCapability) 0x02) +#define CSR_WIFI_P2P_GRP_CAP_INTRABSS_DIST ((CsrWifiSmeP2pGroupCapability) 0x08) +#define CSR_WIFI_P2P_GRP_CAP_CROSS_CONN ((CsrWifiSmeP2pGroupCapability) 0x10) +#define CSR_WIFI_P2P_GRP_CAP_PERSISTENT_RECONNECT ((CsrWifiSmeP2pGroupCapability) 0x20) + +/******************************************************************************* + + NAME + CsrWifiSmeP2pNoaConfigMethod + + DESCRIPTION + Notice of Absece Configuration + + VALUES + CSR_WIFI_P2P_NOA_NONE - Do not use NOA + CSR_WIFI_P2P_NOA_AUTONOMOUS - NOA based on the traffic analysis + CSR_WIFI_P2P_NOA_USER_DEFINED - NOA as specified by the user + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeP2pNoaConfigMethod; +#define CSR_WIFI_P2P_NOA_NONE ((CsrWifiSmeP2pNoaConfigMethod) 0x00) +#define CSR_WIFI_P2P_NOA_AUTONOMOUS ((CsrWifiSmeP2pNoaConfigMethod) 0x01) +#define CSR_WIFI_P2P_NOA_USER_DEFINED ((CsrWifiSmeP2pNoaConfigMethod) 0x02) + +/******************************************************************************* + + NAME + CsrWifiSmeP2pRole + + DESCRIPTION + Definition of roles for a P2P Device + + VALUES + CSR_WIFI_SME_P2P_ROLE_NONE - A non-P2PDevice device + CSR_WIFI_SME_P2P_ROLE_STANDALONE - A Standalone P2P device + CSR_WIFI_SME_P2P_ROLE_GO - Role Assumed is that of a Group Owner + within a P2P Group + CSR_WIFI_SME_P2P_ROLE_CLI - Role Assumed is that of a P2P Client + within a P2P Group + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeP2pRole; +#define CSR_WIFI_SME_P2P_ROLE_NONE ((CsrWifiSmeP2pRole) 0x00) +#define CSR_WIFI_SME_P2P_ROLE_STANDALONE ((CsrWifiSmeP2pRole) 0x01) +#define CSR_WIFI_SME_P2P_ROLE_GO ((CsrWifiSmeP2pRole) 0x02) +#define CSR_WIFI_SME_P2P_ROLE_CLI ((CsrWifiSmeP2pRole) 0x03) + +/******************************************************************************* + + NAME + CsrWifiSmeP2pStatus + + DESCRIPTION + This data type enumerates the outcome of P2P procedure + + VALUES + CSR_WIFI_SME_P2P_STATUS_SUCCESS + - Success + CSR_WIFI_SME_P2P_STATUS_FAIL_INFO_UNAVAILABLE + - Fail; information is currently unavailable + CSR_WIFI_SME_P2P_STATUS_FAIL_INCOMPATIBLE_PARAM + - Fail; incompatible parameters + CSR_WIFI_SME_P2P_STATUS_FAIL_LIMIT_REACHED + - Fail; limit reached + CSR_WIFI_SME_P2P_STATUS_FAIL_INVALID_PARAM + - Fail; invalid parameters + CSR_WIFI_SME_P2P_STATUS_FAIL_ACCOMODATE + - Fail; unable to accommodate request + CSR_WIFI_SME_P2P_STATUS_FAIL_PREV_ERROR + - Fail; previous protocol error, or disruptive behavior + CSR_WIFI_SME_P2P_STATUS_FAIL_COMMON_CHANNELS + - Fail; no common channels + CSR_WIFI_SME_P2P_STATUS_FAIL_UNKNOWN_GROUP + - Fail; unknown P2P Group + CSR_WIFI_SME_P2P_STATUS_FAIL_GO_INTENT + - Fail: both P2P Devices indicated an Intent of 15 in Group + Owner Negotiation + CSR_WIFI_SME_P2P_STATUS_FAIL_PROVISION_METHOD_INCOMPATIBLE + - Fail; incompatible provisioning method + CSR_WIFI_SME_P2P_STATUS_FAIL_REJECT + - Fail: rejected by user + CSR_WIFI_SME_P2P_STATUS_FAIL_RESERVED + - Fail; Status Reserved + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeP2pStatus; +#define CSR_WIFI_SME_P2P_STATUS_SUCCESS ((CsrWifiSmeP2pStatus) 0x00) +#define CSR_WIFI_SME_P2P_STATUS_FAIL_INFO_UNAVAILABLE ((CsrWifiSmeP2pStatus) 0x01) +#define CSR_WIFI_SME_P2P_STATUS_FAIL_INCOMPATIBLE_PARAM ((CsrWifiSmeP2pStatus) 0x02) +#define CSR_WIFI_SME_P2P_STATUS_FAIL_LIMIT_REACHED ((CsrWifiSmeP2pStatus) 0x03) +#define CSR_WIFI_SME_P2P_STATUS_FAIL_INVALID_PARAM ((CsrWifiSmeP2pStatus) 0x04) +#define CSR_WIFI_SME_P2P_STATUS_FAIL_ACCOMODATE ((CsrWifiSmeP2pStatus) 0x05) +#define CSR_WIFI_SME_P2P_STATUS_FAIL_PREV_ERROR ((CsrWifiSmeP2pStatus) 0x06) +#define CSR_WIFI_SME_P2P_STATUS_FAIL_COMMON_CHANNELS ((CsrWifiSmeP2pStatus) 0x07) +#define CSR_WIFI_SME_P2P_STATUS_FAIL_UNKNOWN_GROUP ((CsrWifiSmeP2pStatus) 0x08) +#define CSR_WIFI_SME_P2P_STATUS_FAIL_GO_INTENT ((CsrWifiSmeP2pStatus) 0x09) +#define CSR_WIFI_SME_P2P_STATUS_FAIL_PROVISION_METHOD_INCOMPATIBLE ((CsrWifiSmeP2pStatus) 0x0A) +#define CSR_WIFI_SME_P2P_STATUS_FAIL_REJECT ((CsrWifiSmeP2pStatus) 0x0B) +#define CSR_WIFI_SME_P2P_STATUS_FAIL_RESERVED ((CsrWifiSmeP2pStatus) 0xFF) + +/******************************************************************************* + + NAME + CsrWifiSmePacketFilterMode + + DESCRIPTION + Options for the filter mode parameter. + The Values here match the HIP interface + + VALUES + CSR_WIFI_SME_PACKET_FILTER_MODE_OPT_OUT + - Broadcast packets are always reported to the host unless + they match at least one of the specified TCLAS IEs. + CSR_WIFI_SME_PACKET_FILTER_MODE_OPT_IN + - Broadcast packets are reported to the host only if they + match at least one of the specified TCLAS IEs. + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmePacketFilterMode; +#define CSR_WIFI_SME_PACKET_FILTER_MODE_OPT_OUT ((CsrWifiSmePacketFilterMode) 0x00) +#define CSR_WIFI_SME_PACKET_FILTER_MODE_OPT_IN ((CsrWifiSmePacketFilterMode) 0x03) + +/******************************************************************************* + + NAME + CsrWifiSmePowerSaveLevel + + DESCRIPTION + Power Save Level options as defined in the IEEE 802.11 standards + First 3 values are set to match the mlme PowerManagementMode + + VALUES + CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW - No power save: the driver will remain + active at all times + CSR_WIFI_SME_POWER_SAVE_LEVEL_HIGH - Enter power save after all packets in + the queues are transmitted and received + CSR_WIFI_SME_POWER_SAVE_LEVEL_MED - Enter power save after all packets in + the queues are transmitted and received + and a further configurable delay + (default 1s) has elapsed + CSR_WIFI_SME_POWER_SAVE_LEVEL_AUTO - The SME will decide when to enter power + save mode according to the traffic + analysis + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmePowerSaveLevel; +#define CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW ((CsrWifiSmePowerSaveLevel) 0x00) +#define CSR_WIFI_SME_POWER_SAVE_LEVEL_HIGH ((CsrWifiSmePowerSaveLevel) 0x01) +#define CSR_WIFI_SME_POWER_SAVE_LEVEL_MED ((CsrWifiSmePowerSaveLevel) 0x02) +#define CSR_WIFI_SME_POWER_SAVE_LEVEL_AUTO ((CsrWifiSmePowerSaveLevel) 0x03) + +/******************************************************************************* + + NAME + CsrWifiSmePreambleType + + DESCRIPTION + SME Preamble Types + + VALUES + CSR_WIFI_SME_USE_LONG_PREAMBLE - Use legacy (long) preamble + CSR_WIFI_SME_USE_SHORT_PREAMBLE - Use short PPDU format + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmePreambleType; +#define CSR_WIFI_SME_USE_LONG_PREAMBLE ((CsrWifiSmePreambleType) 0x00) +#define CSR_WIFI_SME_USE_SHORT_PREAMBLE ((CsrWifiSmePreambleType) 0x01) + +/******************************************************************************* + + NAME + CsrWifiSmeRadioIF + + DESCRIPTION + Indicates the frequency + + VALUES + CSR_WIFI_SME_RADIO_IF_GHZ_2_4 - Indicates the 2.4 GHZ frequency + CSR_WIFI_SME_RADIO_IF_GHZ_5_0 - Future use: currently not supported + CSR_WIFI_SME_RADIO_IF_BOTH - Future use: currently not supported + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeRadioIF; +#define CSR_WIFI_SME_RADIO_IF_GHZ_2_4 ((CsrWifiSmeRadioIF) 0x01) +#define CSR_WIFI_SME_RADIO_IF_GHZ_5_0 ((CsrWifiSmeRadioIF) 0x02) +#define CSR_WIFI_SME_RADIO_IF_BOTH ((CsrWifiSmeRadioIF) 0x03) + +/******************************************************************************* + + NAME + CsrWifiSmeRegulatoryDomain + + DESCRIPTION + Indicates the regulatory domain as defined in IEEE 802.11 standards + + VALUES + CSR_WIFI_SME_REGULATORY_DOMAIN_OTHER + - See IEEE 802.11 Standard + CSR_WIFI_SME_REGULATORY_DOMAIN_FCC + - See IEEE 802.11 Standard + CSR_WIFI_SME_REGULATORY_DOMAIN_IC + - See IEEE 802.11 Standard + CSR_WIFI_SME_REGULATORY_DOMAIN_ETSI + - See IEEE 802.11 Standard + CSR_WIFI_SME_REGULATORY_DOMAIN_SPAIN + - See IEEE 802.11 Standard + CSR_WIFI_SME_REGULATORY_DOMAIN_FRANCE + - See IEEE 802.11 Standard + CSR_WIFI_SME_REGULATORY_DOMAIN_JAPAN + - See IEEE 802.11 Standard + CSR_WIFI_SME_REGULATORY_DOMAIN_JAPANBIS + - See IEEE 802.11 Standard + CSR_WIFI_SME_REGULATORY_DOMAIN_CHINA + - See IEEE 802.11 Standard + CSR_WIFI_SME_REGULATORY_DOMAIN_CHINABIS + - See IEEE 802.11 Standard + CSR_WIFI_SME_REGULATORY_DOMAIN_NONE + - See IEEE 802.11 Standard + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeRegulatoryDomain; +#define CSR_WIFI_SME_REGULATORY_DOMAIN_OTHER ((CsrWifiSmeRegulatoryDomain) 0x00) +#define CSR_WIFI_SME_REGULATORY_DOMAIN_FCC ((CsrWifiSmeRegulatoryDomain) 0x10) +#define CSR_WIFI_SME_REGULATORY_DOMAIN_IC ((CsrWifiSmeRegulatoryDomain) 0x20) +#define CSR_WIFI_SME_REGULATORY_DOMAIN_ETSI ((CsrWifiSmeRegulatoryDomain) 0x30) +#define CSR_WIFI_SME_REGULATORY_DOMAIN_SPAIN ((CsrWifiSmeRegulatoryDomain) 0x31) +#define CSR_WIFI_SME_REGULATORY_DOMAIN_FRANCE ((CsrWifiSmeRegulatoryDomain) 0x32) +#define CSR_WIFI_SME_REGULATORY_DOMAIN_JAPAN ((CsrWifiSmeRegulatoryDomain) 0x40) +#define CSR_WIFI_SME_REGULATORY_DOMAIN_JAPANBIS ((CsrWifiSmeRegulatoryDomain) 0x41) +#define CSR_WIFI_SME_REGULATORY_DOMAIN_CHINA ((CsrWifiSmeRegulatoryDomain) 0x50) +#define CSR_WIFI_SME_REGULATORY_DOMAIN_CHINABIS ((CsrWifiSmeRegulatoryDomain) 0x51) +#define CSR_WIFI_SME_REGULATORY_DOMAIN_NONE ((CsrWifiSmeRegulatoryDomain) 0xFF) + +/******************************************************************************* + + NAME + CsrWifiSmeRoamReason + + DESCRIPTION + Indicates the reason for roaming + + VALUES + CSR_WIFI_SME_ROAM_REASON_BEACONLOST + - The station cannot receive the beacon signal any more + CSR_WIFI_SME_ROAM_REASON_DISASSOCIATED + - The station has been disassociated + CSR_WIFI_SME_ROAM_REASON_DEAUTHENTICATED + - The station has been deauthenticated + CSR_WIFI_SME_ROAM_REASON_BETTERAPFOUND + - A better AP has been found + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeRoamReason; +#define CSR_WIFI_SME_ROAM_REASON_BEACONLOST ((CsrWifiSmeRoamReason) 0x00) +#define CSR_WIFI_SME_ROAM_REASON_DISASSOCIATED ((CsrWifiSmeRoamReason) 0x01) +#define CSR_WIFI_SME_ROAM_REASON_DEAUTHENTICATED ((CsrWifiSmeRoamReason) 0x02) +#define CSR_WIFI_SME_ROAM_REASON_BETTERAPFOUND ((CsrWifiSmeRoamReason) 0x03) + +/******************************************************************************* + + NAME + CsrWifiSmeScanType + + DESCRIPTION + Identifies the type of scan to be performed + + VALUES + CSR_WIFI_SME_SCAN_TYPE_ALL - Scan actively or passively according to the + regulatory domain restrictions + CSR_WIFI_SME_SCAN_TYPE_ACTIVE - Scan actively only: send probes and listen + for answers + CSR_WIFI_SME_SCAN_TYPE_PASSIVE - Scan passively only: listen for beacon + messages + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeScanType; +#define CSR_WIFI_SME_SCAN_TYPE_ALL ((CsrWifiSmeScanType) 0x00) +#define CSR_WIFI_SME_SCAN_TYPE_ACTIVE ((CsrWifiSmeScanType) 0x01) +#define CSR_WIFI_SME_SCAN_TYPE_PASSIVE ((CsrWifiSmeScanType) 0x02) + +/******************************************************************************* + + NAME + CsrWifiSmeTrafficType + + DESCRIPTION + Identifies the type of traffic going on on the connection. + The values of this type are used across the NME/SME/Router API's and they + must be kept consistent with the corresponding types in the .xml of the + ottherinterfaces + + VALUES + CSR_WIFI_SME_TRAFFIC_TYPE_OCCASIONAL + - During the last 30 seconds there were fewer than 20 packets + per seconds in each second in both directions + CSR_WIFI_SME_TRAFFIC_TYPE_BURSTY + - During the last 30 seconds there was at least one second + during which more than 20 packets were received in either + direction + CSR_WIFI_SME_TRAFFIC_TYPE_PERIODIC + - During the last 5 seconds there were at least 10 packets + received each second and a defined period for the traffic + can be recognized + CSR_WIFI_SME_TRAFFIC_TYPE_CONTINUOUS + - During the last 5 seconds there were at least 20 packets + received each second in either direction + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeTrafficType; +#define CSR_WIFI_SME_TRAFFIC_TYPE_OCCASIONAL ((CsrWifiSmeTrafficType) 0x00) +#define CSR_WIFI_SME_TRAFFIC_TYPE_BURSTY ((CsrWifiSmeTrafficType) 0x01) +#define CSR_WIFI_SME_TRAFFIC_TYPE_PERIODIC ((CsrWifiSmeTrafficType) 0x02) +#define CSR_WIFI_SME_TRAFFIC_TYPE_CONTINUOUS ((CsrWifiSmeTrafficType) 0x03) + +/******************************************************************************* + + NAME + CsrWifiSmeTspecCtrl + + DESCRIPTION + Defines bits for CsrWifiSmeTspecCtrlMask for additional CCX configuration. + CURRENTLY NOT SUPPORTED. + + VALUES + CSR_WIFI_SME_TSPEC_CTRL_STRICT + - No automatic negotiation + CSR_WIFI_SME_TSPEC_CTRL_CCX_SIGNALLING + - Signalling TSPEC + CSR_WIFI_SME_TSPEC_CTRL_CCX_VOICE + - Voice traffic TSPEC + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeTspecCtrl; +#define CSR_WIFI_SME_TSPEC_CTRL_STRICT ((CsrWifiSmeTspecCtrl) 0x01) +#define CSR_WIFI_SME_TSPEC_CTRL_CCX_SIGNALLING ((CsrWifiSmeTspecCtrl) 0x02) +#define CSR_WIFI_SME_TSPEC_CTRL_CCX_VOICE ((CsrWifiSmeTspecCtrl) 0x04) + +/******************************************************************************* + + NAME + CsrWifiSmeTspecResultCode + + DESCRIPTION + Defines the result of the TSPEC exchanges with the AP + + VALUES + CSR_WIFI_SME_TSPEC_RESULT_SUCCESS + - TSPEC command has been processed correctly + CSR_WIFI_SME_TSPEC_RESULT_UNSPECIFIED_QOS_FAILURE + - The Access Point reported a failure + CSR_WIFI_SME_TSPEC_RESULT_FAILURE + - Internal failure in the SME + CSR_WIFI_SME_TSPEC_RESULT_INVALID_TSPEC_PARAMETERS + - The TSPEC parameters are invalid + CSR_WIFI_SME_TSPEC_RESULT_INVALID_TCLAS_PARAMETERS + - The TCLASS parameters are invalid + CSR_WIFI_SME_TSPEC_RESULT_INSUFFICIENT_BANDWIDTH + - As specified by the WMM Spec + CSR_WIFI_SME_TSPEC_RESULT_WRONG_POLICY + - As specified by the WMM Spec + CSR_WIFI_SME_TSPEC_RESULT_REJECTED_WITH_SUGGESTED_CHANGES + - As specified by the WMM Spec + CSR_WIFI_SME_TSPEC_RESULT_TIMEOUT + - The TSPEC negotiation timed out + CSR_WIFI_SME_TSPEC_RESULT_NOT_SUPPORTED + - The Access Point does not support the TSPEC + CSR_WIFI_SME_TSPEC_RESULT_IE_LENGTH_INCORRECT + - The length of the TSPEC is not correct + CSR_WIFI_SME_TSPEC_RESULT_INVALID_TRANSACTION_ID + - The TSPEC transaction id is not in the list + CSR_WIFI_SME_TSPEC_RESULT_INSTALLED + - The TSPEC has been installed and it is now active. + CSR_WIFI_SME_TSPEC_RESULT_TID_ALREADY_INSTALLED + - The Traffic ID has already been installed + CSR_WIFI_SME_TSPEC_RESULT_TSPEC_REMOTELY_DELETED + - The AP has deleted the TSPEC + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeTspecResultCode; +#define CSR_WIFI_SME_TSPEC_RESULT_SUCCESS ((CsrWifiSmeTspecResultCode) 0x00) +#define CSR_WIFI_SME_TSPEC_RESULT_UNSPECIFIED_QOS_FAILURE ((CsrWifiSmeTspecResultCode) 0x01) +#define CSR_WIFI_SME_TSPEC_RESULT_FAILURE ((CsrWifiSmeTspecResultCode) 0x02) +#define CSR_WIFI_SME_TSPEC_RESULT_INVALID_TSPEC_PARAMETERS ((CsrWifiSmeTspecResultCode) 0x05) +#define CSR_WIFI_SME_TSPEC_RESULT_INVALID_TCLAS_PARAMETERS ((CsrWifiSmeTspecResultCode) 0x06) +#define CSR_WIFI_SME_TSPEC_RESULT_INSUFFICIENT_BANDWIDTH ((CsrWifiSmeTspecResultCode) 0x07) +#define CSR_WIFI_SME_TSPEC_RESULT_WRONG_POLICY ((CsrWifiSmeTspecResultCode) 0x08) +#define CSR_WIFI_SME_TSPEC_RESULT_REJECTED_WITH_SUGGESTED_CHANGES ((CsrWifiSmeTspecResultCode) 0x09) +#define CSR_WIFI_SME_TSPEC_RESULT_TIMEOUT ((CsrWifiSmeTspecResultCode) 0x0D) +#define CSR_WIFI_SME_TSPEC_RESULT_NOT_SUPPORTED ((CsrWifiSmeTspecResultCode) 0x0E) +#define CSR_WIFI_SME_TSPEC_RESULT_IE_LENGTH_INCORRECT ((CsrWifiSmeTspecResultCode) 0x10) +#define CSR_WIFI_SME_TSPEC_RESULT_INVALID_TRANSACTION_ID ((CsrWifiSmeTspecResultCode) 0x11) +#define CSR_WIFI_SME_TSPEC_RESULT_INSTALLED ((CsrWifiSmeTspecResultCode) 0x12) +#define CSR_WIFI_SME_TSPEC_RESULT_TID_ALREADY_INSTALLED ((CsrWifiSmeTspecResultCode) 0x13) +#define CSR_WIFI_SME_TSPEC_RESULT_TSPEC_REMOTELY_DELETED ((CsrWifiSmeTspecResultCode) 0x14) + +/******************************************************************************* + + NAME + CsrWifiSmeWepAuthMode + + DESCRIPTION + Define bits for CsrWifiSmeWepAuthMode + + VALUES + CSR_WIFI_SME_WEP_AUTH_MODE_OPEN - Open-WEP enabled network + CSR_WIFI_SME_WEP_AUTH_MODE_SHARED - Shared-key WEP enabled network. + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeWepAuthMode; +#define CSR_WIFI_SME_WEP_AUTH_MODE_OPEN ((CsrWifiSmeWepAuthMode) 0x00) +#define CSR_WIFI_SME_WEP_AUTH_MODE_SHARED ((CsrWifiSmeWepAuthMode) 0x01) + +/******************************************************************************* + + NAME + CsrWifiSmeWepCredentialType + + DESCRIPTION + Definition of types of WEP Credentials + + VALUES + CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64 + - WEP 64 credential + CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128 + - WEP 128 credential + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeWepCredentialType; +#define CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64 ((CsrWifiSmeWepCredentialType) 0x00) +#define CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128 ((CsrWifiSmeWepCredentialType) 0x01) + +/******************************************************************************* + + NAME + CsrWifiSmeWmmMode + + DESCRIPTION + Defines bits for wmmModeMask: enable/disable WMM features. + + VALUES + CSR_WIFI_SME_WMM_MODE_DISABLED - Disables the WMM features. + CSR_WIFI_SME_WMM_MODE_AC_ENABLED - Enables support for WMM-AC. + CSR_WIFI_SME_WMM_MODE_PS_ENABLED - Enables support for WMM Power Save. + CSR_WIFI_SME_WMM_MODE_SA_ENABLED - Currently not supported + CSR_WIFI_SME_WMM_MODE_ENABLED - Enables support for all currently + available WMM features. + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeWmmMode; +#define CSR_WIFI_SME_WMM_MODE_DISABLED ((CsrWifiSmeWmmMode) 0x00) +#define CSR_WIFI_SME_WMM_MODE_AC_ENABLED ((CsrWifiSmeWmmMode) 0x01) +#define CSR_WIFI_SME_WMM_MODE_PS_ENABLED ((CsrWifiSmeWmmMode) 0x02) +#define CSR_WIFI_SME_WMM_MODE_SA_ENABLED ((CsrWifiSmeWmmMode) 0x04) +#define CSR_WIFI_SME_WMM_MODE_ENABLED ((CsrWifiSmeWmmMode) 0xFF) + +/******************************************************************************* + + NAME + CsrWifiSmeWmmQosInfo + + DESCRIPTION + Defines bits for the QoS Info Octect as defined in the WMM specification. + The first four values define one bit each that can be set or cleared. + Each of the last four values define all the remaining 4 bits and only one + of them at the time shall be used. + For more information, see 'WMM (including WMM Power Save) Specification - + Version 1.1' and 'UniFi Configuring WMM and WMM-PS, Application Note'. + + VALUES + CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_ALL + - WMM AP may deliver all buffered frames + CSR_WIFI_SME_WMM_QOS_INFO_AC_VO + - Enable UAPSD(both trigger and delivery) for Voice Access + Category + CSR_WIFI_SME_WMM_QOS_INFO_AC_VI + - Enable UAPSD(both trigger and delivery) for Video Access + Category + CSR_WIFI_SME_WMM_QOS_INFO_AC_BK + - Enable UAPSD(both trigger and delivery) for Background + Access Category + CSR_WIFI_SME_WMM_QOS_INFO_AC_BE + - Enable UAPSD(both trigger and delivery) for Best Effort + Access Category + CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_TWO + - WMM AP may deliver a maximum of 2 buffered frames (MSDUs + and MMPDUs) per USP + CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_FOUR + - WMM AP may deliver a maximum of 4 buffered frames (MSDUs + and MMPDUs) per USP + CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_SIX + - WMM AP may deliver a maximum of 6 buffered frames (MSDUs + and MMPDUs) per USP + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeWmmQosInfo; +#define CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_ALL ((CsrWifiSmeWmmQosInfo) 0x00) +#define CSR_WIFI_SME_WMM_QOS_INFO_AC_VO ((CsrWifiSmeWmmQosInfo) 0x01) +#define CSR_WIFI_SME_WMM_QOS_INFO_AC_VI ((CsrWifiSmeWmmQosInfo) 0x02) +#define CSR_WIFI_SME_WMM_QOS_INFO_AC_BK ((CsrWifiSmeWmmQosInfo) 0x04) +#define CSR_WIFI_SME_WMM_QOS_INFO_AC_BE ((CsrWifiSmeWmmQosInfo) 0x08) +#define CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_TWO ((CsrWifiSmeWmmQosInfo) 0x20) +#define CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_FOUR ((CsrWifiSmeWmmQosInfo) 0x40) +#define CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_SIX ((CsrWifiSmeWmmQosInfo) 0x60) + +/******************************************************************************* + + NAME + CsrWifiSmeWpsConfigType + + DESCRIPTION + WPS config methods supported/used by a device + + VALUES + CSR_WIFI_WPS_CONFIG_LABEL + - Label + CSR_WIFI_WPS_CONFIG_DISPLAY + - Display + CSR_WIFI_WPS_CONFIG_EXT_NFC + - External NFC : Not supported in this release + CSR_WIFI_WPS_CONFIG_INT_NFC + - Internal NFC : Not supported in this release + CSR_WIFI_WPS_CONFIG_NFC_IFACE + - NFC interface : Not supported in this release + CSR_WIFI_WPS_CONFIG_PBC + - PBC + CSR_WIFI_WPS_CONFIG_KEYPAD + - KeyPad + CSR_WIFI_WPS_CONFIG_VIRTUAL_PBC + - PBC through software user interface + CSR_WIFI_WPS_CONFIG_PHYSICAL_PBC + - Physical PBC + CSR_WIFI_WPS_CONFIG_VIRTUAL_DISPLAY + - Virtual Display : via html config page etc + CSR_WIFI_WPS_CONFIG_PHYSICAL_DISPLAY + - Physical Display : Attached to the device + +*******************************************************************************/ +typedef CsrUint16 CsrWifiSmeWpsConfigType; +#define CSR_WIFI_WPS_CONFIG_LABEL ((CsrWifiSmeWpsConfigType) 0x0004) +#define CSR_WIFI_WPS_CONFIG_DISPLAY ((CsrWifiSmeWpsConfigType) 0x0008) +#define CSR_WIFI_WPS_CONFIG_EXT_NFC ((CsrWifiSmeWpsConfigType) 0x0010) +#define CSR_WIFI_WPS_CONFIG_INT_NFC ((CsrWifiSmeWpsConfigType) 0x0020) +#define CSR_WIFI_WPS_CONFIG_NFC_IFACE ((CsrWifiSmeWpsConfigType) 0x0040) +#define CSR_WIFI_WPS_CONFIG_PBC ((CsrWifiSmeWpsConfigType) 0x0080) +#define CSR_WIFI_WPS_CONFIG_KEYPAD ((CsrWifiSmeWpsConfigType) 0x0100) +#define CSR_WIFI_WPS_CONFIG_VIRTUAL_PBC ((CsrWifiSmeWpsConfigType) 0x0280) +#define CSR_WIFI_WPS_CONFIG_PHYSICAL_PBC ((CsrWifiSmeWpsConfigType) 0x0480) +#define CSR_WIFI_WPS_CONFIG_VIRTUAL_DISPLAY ((CsrWifiSmeWpsConfigType) 0x2008) +#define CSR_WIFI_WPS_CONFIG_PHYSICAL_DISPLAY ((CsrWifiSmeWpsConfigType) 0x4008) + +/******************************************************************************* + + NAME + CsrWifiSmeWpsDeviceCategory + + DESCRIPTION + Wps Primary Device Types + + VALUES + CSR_WIFI_SME_WPS_CATEGORY_UNSPECIFIED + - Unspecified. + CSR_WIFI_SME_WPS_CATEGORY_COMPUTER + - Computer. + CSR_WIFI_SME_WPS_CATEGORY_INPUT_DEV + - Input device + CSR_WIFI_SME_WPS_CATEGORY_PRT_SCAN_FX_CP + - Printer Scanner Fax Copier etc + CSR_WIFI_SME_WPS_CATEGORY_CAMERA + - Camera + CSR_WIFI_SME_WPS_CATEGORY_STORAGE + - Storage + CSR_WIFI_SME_WPS_CATEGORY_NET_INFRA + - Net Infra + CSR_WIFI_SME_WPS_CATEGORY_DISPLAY + - Display + CSR_WIFI_SME_WPS_CATEGORY_MULTIMEDIA + - Multimedia + CSR_WIFI_SME_WPS_CATEGORY_GAMING + - Gaming. + CSR_WIFI_SME_WPS_CATEGORY_TELEPHONE + - Telephone. + CSR_WIFI_SME_WPS_CATEGORY_AUDIO + - Audio + CSR_WIFI_SME_WPS_CATEOARY_OTHERS + - Others. + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeWpsDeviceCategory; +#define CSR_WIFI_SME_WPS_CATEGORY_UNSPECIFIED ((CsrWifiSmeWpsDeviceCategory) 0x00) +#define CSR_WIFI_SME_WPS_CATEGORY_COMPUTER ((CsrWifiSmeWpsDeviceCategory) 0x01) +#define CSR_WIFI_SME_WPS_CATEGORY_INPUT_DEV ((CsrWifiSmeWpsDeviceCategory) 0x02) +#define CSR_WIFI_SME_WPS_CATEGORY_PRT_SCAN_FX_CP ((CsrWifiSmeWpsDeviceCategory) 0x03) +#define CSR_WIFI_SME_WPS_CATEGORY_CAMERA ((CsrWifiSmeWpsDeviceCategory) 0x04) +#define CSR_WIFI_SME_WPS_CATEGORY_STORAGE ((CsrWifiSmeWpsDeviceCategory) 0x05) +#define CSR_WIFI_SME_WPS_CATEGORY_NET_INFRA ((CsrWifiSmeWpsDeviceCategory) 0x06) +#define CSR_WIFI_SME_WPS_CATEGORY_DISPLAY ((CsrWifiSmeWpsDeviceCategory) 0x07) +#define CSR_WIFI_SME_WPS_CATEGORY_MULTIMEDIA ((CsrWifiSmeWpsDeviceCategory) 0x08) +#define CSR_WIFI_SME_WPS_CATEGORY_GAMING ((CsrWifiSmeWpsDeviceCategory) 0x09) +#define CSR_WIFI_SME_WPS_CATEGORY_TELEPHONE ((CsrWifiSmeWpsDeviceCategory) 0x0A) +#define CSR_WIFI_SME_WPS_CATEGORY_AUDIO ((CsrWifiSmeWpsDeviceCategory) 0x0B) +#define CSR_WIFI_SME_WPS_CATEOARY_OTHERS ((CsrWifiSmeWpsDeviceCategory) 0xFF) + +/******************************************************************************* + + NAME + CsrWifiSmeWpsDeviceSubCategory + + DESCRIPTION + Wps Secondary Device Types + + VALUES + CSR_WIFI_SME_WPS_SUB_CATEGORY_UNSPECIFIED + - Unspecied + CSR_WIFI_SME_WPS_STORAGE_SUB_CATEGORY_NAS + - Network Associated Storage + CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_PRNTR + - Printer or print server + CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_WM + - Windows mobile + CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_TUNER + - Audio tuner/receiver + CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_DIG_STL + - Digital still camera + CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_AP + - Access Point + CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_TV + - TV. + CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_DAR + - DAR. + CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_KEYBD + - Keyboard. + CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_PC + - PC. + CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_XBOX + - Xbox. + CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_SCNR + - Scanner + CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_SERVER + - Server + CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_ROUTER + - Router + CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_PVR + - PVR + CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_SPEAKER + - Speaker + CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_FP_SM + - Feature phone - Single mode + CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_VIDEO + - Video camera + CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_PIC_FRM + - Picture frame + CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_XBOX_360 + - Xbox360 + CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_MOUSE + - Mouse + CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_SWITCH + - Switch + CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_PMP + - Portable music player + CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_JOYSTK + - Joy stick + CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_PLAY_STN + - Play-station + CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_MED_CENT + - Media Center + CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_MCX + - MCX + CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_FP_DM + - Feature phone - Dual mode + CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_WEB + - Web camera + CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_FAX + - Fax + CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_PROJECTOR + - Projector + CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_TRKBL + - Track Ball + CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_ST_BOX + - Set-Top-Box + CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_GATEWAY + - GateWay. + CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_SECURITY + - Security camera + CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_ULTRA_MOB_PC + - Ultra mobile PC. + CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_CONSOLE + - Game console/Game console adapter + CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_CPR + - Copier + CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_HEADSET + - Headset(headphones + microphone) + CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_SP_SM + - Smart phone - Single mode + CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_MONITOR + - Monitor. + CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_GAME_CTRL + - Game control. + CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_ALL + - All-in-One + CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_MEDIA + - Media Server/Media Adapter/Media Extender + CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_SP_DM + - Smart phone - Dual mode + CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_PORT_DEV + - Portable gaming device + CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_HEADPHONE + - Headphone. + CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_NOTEBOOK + - Notebook. + CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_REMOTE + - Remote control + CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_MIC + - Microphone + CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_DESKTOP + - Desktop. + CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_VP + - Portable video player + CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_MID + - Mobile internet device + CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_TOUCH_SCRN + - Touch screen + CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_BIOMET_RDR + - Biometric reader + CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_NETBOOK + - Netbook + CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_BRCD_RDR + - Bar code reader. + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeWpsDeviceSubCategory; +#define CSR_WIFI_SME_WPS_SUB_CATEGORY_UNSPECIFIED ((CsrWifiSmeWpsDeviceSubCategory) 0x00) +#define CSR_WIFI_SME_WPS_STORAGE_SUB_CATEGORY_NAS ((CsrWifiSmeWpsDeviceSubCategory) 0x01) +#define CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_PRNTR ((CsrWifiSmeWpsDeviceSubCategory) 0x01) +#define CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_WM ((CsrWifiSmeWpsDeviceSubCategory) 0x01) +#define CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_TUNER ((CsrWifiSmeWpsDeviceSubCategory) 0x01) +#define CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_DIG_STL ((CsrWifiSmeWpsDeviceSubCategory) 0x01) +#define CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_AP ((CsrWifiSmeWpsDeviceSubCategory) 0x01) +#define CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_TV ((CsrWifiSmeWpsDeviceSubCategory) 0x01) +#define CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_DAR ((CsrWifiSmeWpsDeviceSubCategory) 0x01) +#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_KEYBD ((CsrWifiSmeWpsDeviceSubCategory) 0x01) +#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_PC ((CsrWifiSmeWpsDeviceSubCategory) 0x01) +#define CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_XBOX ((CsrWifiSmeWpsDeviceSubCategory) 0x01) +#define CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_SCNR ((CsrWifiSmeWpsDeviceSubCategory) 0x02) +#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_SERVER ((CsrWifiSmeWpsDeviceSubCategory) 0x02) +#define CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_ROUTER ((CsrWifiSmeWpsDeviceSubCategory) 0x02) +#define CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_PVR ((CsrWifiSmeWpsDeviceSubCategory) 0x02) +#define CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_SPEAKER ((CsrWifiSmeWpsDeviceSubCategory) 0x02) +#define CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_FP_SM ((CsrWifiSmeWpsDeviceSubCategory) 0x02) +#define CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_VIDEO ((CsrWifiSmeWpsDeviceSubCategory) 0x02) +#define CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_PIC_FRM ((CsrWifiSmeWpsDeviceSubCategory) 0x02) +#define CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_XBOX_360 ((CsrWifiSmeWpsDeviceSubCategory) 0x02) +#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_MOUSE ((CsrWifiSmeWpsDeviceSubCategory) 0x02) +#define CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_SWITCH ((CsrWifiSmeWpsDeviceSubCategory) 0x03) +#define CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_PMP ((CsrWifiSmeWpsDeviceSubCategory) 0x03) +#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_JOYSTK ((CsrWifiSmeWpsDeviceSubCategory) 0x03) +#define CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_PLAY_STN ((CsrWifiSmeWpsDeviceSubCategory) 0x03) +#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_MED_CENT ((CsrWifiSmeWpsDeviceSubCategory) 0x03) +#define CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_MCX ((CsrWifiSmeWpsDeviceSubCategory) 0x03) +#define CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_FP_DM ((CsrWifiSmeWpsDeviceSubCategory) 0x03) +#define CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_WEB ((CsrWifiSmeWpsDeviceSubCategory) 0x03) +#define CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_FAX ((CsrWifiSmeWpsDeviceSubCategory) 0x03) +#define CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_PROJECTOR ((CsrWifiSmeWpsDeviceSubCategory) 0x03) +#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_TRKBL ((CsrWifiSmeWpsDeviceSubCategory) 0x04) +#define CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_ST_BOX ((CsrWifiSmeWpsDeviceSubCategory) 0x04) +#define CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_GATEWAY ((CsrWifiSmeWpsDeviceSubCategory) 0x04) +#define CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_SECURITY ((CsrWifiSmeWpsDeviceSubCategory) 0x04) +#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_ULTRA_MOB_PC ((CsrWifiSmeWpsDeviceSubCategory) 0x04) +#define CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_CONSOLE ((CsrWifiSmeWpsDeviceSubCategory) 0x04) +#define CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_CPR ((CsrWifiSmeWpsDeviceSubCategory) 0x04) +#define CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_HEADSET ((CsrWifiSmeWpsDeviceSubCategory) 0x04) +#define CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_SP_SM ((CsrWifiSmeWpsDeviceSubCategory) 0x04) +#define CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_MONITOR ((CsrWifiSmeWpsDeviceSubCategory) 0x04) +#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_GAME_CTRL ((CsrWifiSmeWpsDeviceSubCategory) 0x05) +#define CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_ALL ((CsrWifiSmeWpsDeviceSubCategory) 0x05) +#define CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_MEDIA ((CsrWifiSmeWpsDeviceSubCategory) 0x05) +#define CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_SP_DM ((CsrWifiSmeWpsDeviceSubCategory) 0x05) +#define CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_PORT_DEV ((CsrWifiSmeWpsDeviceSubCategory) 0x05) +#define CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_HEADPHONE ((CsrWifiSmeWpsDeviceSubCategory) 0x05) +#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_NOTEBOOK ((CsrWifiSmeWpsDeviceSubCategory) 0x05) +#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_REMOTE ((CsrWifiSmeWpsDeviceSubCategory) 0x06) +#define CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_MIC ((CsrWifiSmeWpsDeviceSubCategory) 0x06) +#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_DESKTOP ((CsrWifiSmeWpsDeviceSubCategory) 0x06) +#define CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_VP ((CsrWifiSmeWpsDeviceSubCategory) 0x06) +#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_MID ((CsrWifiSmeWpsDeviceSubCategory) 0x07) +#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_TOUCH_SCRN ((CsrWifiSmeWpsDeviceSubCategory) 0x07) +#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_BIOMET_RDR ((CsrWifiSmeWpsDeviceSubCategory) 0x08) +#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_NETBOOK ((CsrWifiSmeWpsDeviceSubCategory) 0x08) +#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_BRCD_RDR ((CsrWifiSmeWpsDeviceSubCategory) 0x09) + +/******************************************************************************* + + NAME + CsrWifiSmeWpsDpid + + DESCRIPTION + Device Password ID for the chosen config method + + VALUES + CSR_WIFI_SME_WPS_DPID_PIN - PIN + CSR_WIFI_SME_WPS_DPID_USER - User specified : Used only during P2P GO + negotiation procedure + CSR_WIFI_SME_WPS_DPID_MACHINE - Machine specified i: Not used in this + release + CSR_WIFI_SME_WPS_DPID_REKEY - Rekey : Not used in this release + CSR_WIFI_SME_WPS_DPID_PBC - PBC + CSR_WIFI_SME_WPS_DPID_REGISTRAR - Registrar specified : Used only in P2P Go + negotiation procedure + +*******************************************************************************/ +typedef CsrUint16 CsrWifiSmeWpsDpid; +#define CSR_WIFI_SME_WPS_DPID_PIN ((CsrWifiSmeWpsDpid) 0x0000) +#define CSR_WIFI_SME_WPS_DPID_USER ((CsrWifiSmeWpsDpid) 0x0001) +#define CSR_WIFI_SME_WPS_DPID_MACHINE ((CsrWifiSmeWpsDpid) 0x0002) +#define CSR_WIFI_SME_WPS_DPID_REKEY ((CsrWifiSmeWpsDpid) 0x0003) +#define CSR_WIFI_SME_WPS_DPID_PBC ((CsrWifiSmeWpsDpid) 0x0004) +#define CSR_WIFI_SME_WPS_DPID_REGISTRAR ((CsrWifiSmeWpsDpid) 0x0005) + +/******************************************************************************* + + NAME + CsrWifiSmeWpsRegistration + + DESCRIPTION + + VALUES + CSR_WIFI_SME_WPS_REG_NOT_REQUIRED - No encryption set + CSR_WIFI_SME_WPS_REG_REQUIRED - No encryption set + CSR_WIFI_SME_WPS_REG_UNKNOWN - No encryption set + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeWpsRegistration; +#define CSR_WIFI_SME_WPS_REG_NOT_REQUIRED ((CsrWifiSmeWpsRegistration) 0x00) +#define CSR_WIFI_SME_WPS_REG_REQUIRED ((CsrWifiSmeWpsRegistration) 0x01) +#define CSR_WIFI_SME_WPS_REG_UNKNOWN ((CsrWifiSmeWpsRegistration) 0x02) + + +/******************************************************************************* + + NAME + CsrWifiSmeAuthModeMask + + DESCRIPTION + Mask type for use with the values defined by CsrWifiSmeAuthMode + +*******************************************************************************/ +typedef CsrUint16 CsrWifiSmeAuthModeMask; +/******************************************************************************* + + NAME + CsrWifiSmeEncryptionMask + + DESCRIPTION + Mask type for use with the values defined by CsrWifiSmeEncryption + +*******************************************************************************/ +typedef CsrUint16 CsrWifiSmeEncryptionMask; +/******************************************************************************* + + NAME + CsrWifiSmeIndicationsMask + + DESCRIPTION + Mask type for use with the values defined by CsrWifiSmeIndications + +*******************************************************************************/ +typedef CsrUint32 CsrWifiSmeIndicationsMask; +/******************************************************************************* + + NAME + CsrWifiSmeP2pCapabilityMask + + DESCRIPTION + Mask type for use with the values defined by CsrWifiSmeP2pCapability + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeP2pCapabilityMask; +/******************************************************************************* + + NAME + CsrWifiSmeP2pGroupCapabilityMask + + DESCRIPTION + Mask type for use with the values defined by CsrWifiSmeP2pGroupCapability + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeP2pGroupCapabilityMask; +/******************************************************************************* + + NAME + CsrWifiSmeTspecCtrlMask + + DESCRIPTION + Mask type for use with the values defined by CsrWifiSmeTspecCtrl + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeTspecCtrlMask; +/******************************************************************************* + + NAME + CsrWifiSmeWmmModeMask + + DESCRIPTION + Mask type for use with the values defined by CsrWifiSmeWmmMode + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeWmmModeMask; +/******************************************************************************* + + NAME + CsrWifiSmeWmmQosInfoMask + + DESCRIPTION + Mask type for use with the values defined by CsrWifiSmeWmmQosInfo + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeWmmQosInfoMask; +/******************************************************************************* + + NAME + CsrWifiSmeWpsConfigTypeMask + + DESCRIPTION + Mask type for use with the values defined by CsrWifiSmeWpsConfigType + +*******************************************************************************/ +typedef CsrUint16 CsrWifiSmeWpsConfigTypeMask; + + +/******************************************************************************* + + NAME + CsrWifiSmeAdHocConfig + + DESCRIPTION + Defines values to use when starting an Ad-hoc (IBSS) network. + + MEMBERS + atimWindowTu - ATIM window specified for IBSS + beaconPeriodTu - Interval between beacon packets + joinOnlyAttempts - Maximum number of attempts to join an ad-hoc network. + The default value is 1. + Set to 0 for infinite attempts. + joinAttemptIntervalMs - Time between scans for joining the requested IBSS. + +*******************************************************************************/ +typedef struct +{ + CsrUint16 atimWindowTu; + CsrUint16 beaconPeriodTu; + CsrUint16 joinOnlyAttempts; + CsrUint16 joinAttemptIntervalMs; +} CsrWifiSmeAdHocConfig; + +/******************************************************************************* + + NAME + CsrWifiSmeAvailabilityConfig + + DESCRIPTION + + MEMBERS + listenChannel - + availabilityDuration - + avalabilityPeriod - + +*******************************************************************************/ +typedef struct +{ + CsrUint8 listenChannel; + CsrUint16 availabilityDuration; + CsrUint16 avalabilityPeriod; +} CsrWifiSmeAvailabilityConfig; + +/******************************************************************************* + + NAME + CsrWifiSmeCcxConfig + + DESCRIPTION + This type is reserved for future use and should not be used. + + MEMBERS + keepAliveTimeMs - NOT USED + apRoamingEnabled - NOT USED + measurementsMask - NOT USED + ccxRadioMgtEnabled - NOT USED + +*******************************************************************************/ +typedef struct +{ + CsrUint8 keepAliveTimeMs; + CsrBool apRoamingEnabled; + CsrUint8 measurementsMask; + CsrBool ccxRadioMgtEnabled; +} CsrWifiSmeCcxConfig; + +/******************************************************************************* + + NAME + CsrWifiSmeCoexConfig + + DESCRIPTION + Parameters for the coexistence behaviour. + + MEMBERS + coexEnableSchemeManagement - Enables the Coexistence Management Scheme + coexPeriodicWakeHost - If TRUE the firmware wakes up the host + periodically according to the traffic + period and latency parameters; the host + will then send the data to transmit only + when woken up. + If FALSE, the firmware does not wake up the + host and the host will send the data to + transmit to the firmware whenever there is + data to transmit + coexTrafficBurstyLatencyMs - Period of awakening for the firmware used + when bursty traffic is detected + coexTrafficContinuousLatencyMs - Period of awakening for the firmware used + when continuous traffic is detected + coexObexBlackoutDurationMs - Blackout Duration when a Obex Connection is + used + coexObexBlackoutPeriodMs - Blackout Period when a Obex Connection is + used + coexA2dpBrBlackoutDurationMs - Blackout Duration when a Basic Rate A2DP + Connection streaming data + coexA2dpBrBlackoutPeriodMs - Blackout Period when a Basic Rate A2DP + Connection streaming data + coexA2dpEdrBlackoutDurationMs - Blackout Duration when an Enhanced Data + Rate A2DP Connection streaming data + coexA2dpEdrBlackoutPeriodMs - Blackout Period when an Enhanced Data Rate + A2DP Connection streaming data + coexPagingBlackoutDurationMs - Blackout Duration when a BT page is active + coexPagingBlackoutPeriodMs - Blackout Period when a BT page is active + coexInquiryBlackoutDurationMs - Blackout Duration when a BT inquiry is + active + coexInquiryBlackoutPeriodMs - Blackout Period when a BT inquiry is active + +*******************************************************************************/ +typedef struct +{ + CsrBool coexEnableSchemeManagement; + CsrBool coexPeriodicWakeHost; + CsrUint16 coexTrafficBurstyLatencyMs; + CsrUint16 coexTrafficContinuousLatencyMs; + CsrUint16 coexObexBlackoutDurationMs; + CsrUint16 coexObexBlackoutPeriodMs; + CsrUint16 coexA2dpBrBlackoutDurationMs; + CsrUint16 coexA2dpBrBlackoutPeriodMs; + CsrUint16 coexA2dpEdrBlackoutDurationMs; + CsrUint16 coexA2dpEdrBlackoutPeriodMs; + CsrUint16 coexPagingBlackoutDurationMs; + CsrUint16 coexPagingBlackoutPeriodMs; + CsrUint16 coexInquiryBlackoutDurationMs; + CsrUint16 coexInquiryBlackoutPeriodMs; +} CsrWifiSmeCoexConfig; + +/******************************************************************************* + + NAME + CsrWifiSmeConnectionStats + + DESCRIPTION + Indicates the statistics of the connection. + The dot11 fields are defined in the Annex D of the IEEE 802.11 standard. + + MEMBERS + unifiTxDataRate + - The bit rate currently in use for transmissions of unicast + data frames; a data rate in units of 500kbit/s. + On an infrastructure BSS, this is the data rate used in + communicating with the associated access point; if there is + none, an error is returned. + On an IBSS, this is the data rate used for the last + transmission of a unicast data frame to any station in the + IBSS. If no such transmission has been made, an error is + returned. + unifiRxDataRate + - As above for receiving data + dot11RetryCount + - See IEEE 802.11 Standard + dot11MultipleRetryCount + - See IEEE 802.11 Standard + dot11AckFailureCount + - See IEEE 802.11 Standard + dot11FrameDuplicateCount + - See IEEE 802.11 Standard + dot11FcsErrorCount + - See IEEE 802.11 Standard + dot11RtsSuccessCount + - See IEEE 802.11 Standard + dot11RtsFailureCount + - See IEEE 802.11 Standard + dot11FailedCount + - See IEEE 802.11 Standard + dot11TransmittedFragmentCount + - See IEEE 802.11 Standard + dot11TransmittedFrameCount + - See IEEE 802.11 Standard + dot11WepExcludedCount + - See IEEE 802.11 Standard + dot11WepIcvErrorCount + - See IEEE 802.11 Standard + dot11WepUndecryptableCount + - See IEEE 802.11 Standard + dot11MulticastReceivedFrameCount + - See IEEE 802.11 Standard + dot11MulticastTransmittedFrameCount + - See IEEE 802.11 Standard + dot11ReceivedFragmentCount + - See IEEE 802.11 Standard + dot11Rsna4WayHandshakeFailures + - See IEEE 802.11 Standard + dot11RsnaTkipCounterMeasuresInvoked + - See IEEE 802.11 Standard + dot11RsnaStatsTkipLocalMicFailures + - See IEEE 802.11 Standard + dot11RsnaStatsTkipReplays + - See IEEE 802.11 Standard + dot11RsnaStatsTkipIcvErrors + - See IEEE 802.11 Standard + dot11RsnaStatsCcmpReplays + - See IEEE 802.11 Standard + dot11RsnaStatsCcmpDecryptErrors + - See IEEE 802.11 Standard + +*******************************************************************************/ +typedef struct +{ + CsrUint8 unifiTxDataRate; + CsrUint8 unifiRxDataRate; + CsrUint32 dot11RetryCount; + CsrUint32 dot11MultipleRetryCount; + CsrUint32 dot11AckFailureCount; + CsrUint32 dot11FrameDuplicateCount; + CsrUint32 dot11FcsErrorCount; + CsrUint32 dot11RtsSuccessCount; + CsrUint32 dot11RtsFailureCount; + CsrUint32 dot11FailedCount; + CsrUint32 dot11TransmittedFragmentCount; + CsrUint32 dot11TransmittedFrameCount; + CsrUint32 dot11WepExcludedCount; + CsrUint32 dot11WepIcvErrorCount; + CsrUint32 dot11WepUndecryptableCount; + CsrUint32 dot11MulticastReceivedFrameCount; + CsrUint32 dot11MulticastTransmittedFrameCount; + CsrUint32 dot11ReceivedFragmentCount; + CsrUint32 dot11Rsna4WayHandshakeFailures; + CsrUint32 dot11RsnaTkipCounterMeasuresInvoked; + CsrUint32 dot11RsnaStatsTkipLocalMicFailures; + CsrUint32 dot11RsnaStatsTkipReplays; + CsrUint32 dot11RsnaStatsTkipIcvErrors; + CsrUint32 dot11RsnaStatsCcmpReplays; + CsrUint32 dot11RsnaStatsCcmpDecryptErrors; +} CsrWifiSmeConnectionStats; + +/******************************************************************************* + + NAME + CsrWifiSmeDataBlock + + DESCRIPTION + Holds a generic data block to be passed through the interface + + MEMBERS + length - Length of the data block + data - Points to the first byte of the data block + +*******************************************************************************/ +typedef struct +{ + CsrUint16 length; + CsrUint8 *data; +} CsrWifiSmeDataBlock; + +/******************************************************************************* + + NAME + CsrWifiSmeEmpty + + DESCRIPTION + Empty Structure to indicate that no parameters are available. + + MEMBERS + empty - Only element of the empty structure (always set to 0). + +*******************************************************************************/ +typedef struct +{ + CsrUint8 empty; +} CsrWifiSmeEmpty; + +/******************************************************************************* + + NAME + CsrWifiSmeLinkQuality + + DESCRIPTION + Indicates the quality of the link + + MEMBERS + unifiRssi - Indicates the received signal strength indication of the link in + dBm + unifiSnr - Indicates the signal to noise ratio of the link in dB + +*******************************************************************************/ +typedef struct +{ + CsrInt16 unifiRssi; + CsrInt16 unifiSnr; +} CsrWifiSmeLinkQuality; + +/******************************************************************************* + + NAME + CsrWifiSmeMibConfig + + DESCRIPTION + Allows low level configuration in the chip. + + MEMBERS + unifiFixMaxTxDataRate - This attribute is used in combination with + unifiFixTxDataRate. If it is FALSE, then + unifiFixTxDataRate specifies a specific data + rate to use. If it is TRUE, unifiFixTxDataRate + instead specifies a maximum data rate. + unifiFixTxDataRate - Transmit rate for unicast data. + See MIB description for more details + dot11RtsThreshold - See IEEE 802.11 Standard + dot11FragmentationThreshold - See IEEE 802.11 Standard + dot11CurrentTxPowerLevel - See IEEE 802.11 Standard + +*******************************************************************************/ +typedef struct +{ + CsrBool unifiFixMaxTxDataRate; + CsrUint8 unifiFixTxDataRate; + CsrUint16 dot11RtsThreshold; + CsrUint16 dot11FragmentationThreshold; + CsrUint16 dot11CurrentTxPowerLevel; +} CsrWifiSmeMibConfig; + +/******************************************************************************* + + NAME + CsrWifiSmeP2pProfileIdentity + + DESCRIPTION + Details to be filled in + + MEMBERS + listenChannel - + availabilityDuration - + avalabilityPeriod - + +*******************************************************************************/ +typedef struct +{ + CsrUint8 listenChannel; + CsrUint16 availabilityDuration; + CsrUint16 avalabilityPeriod; +} CsrWifiSmeP2pProfileIdentity; + +/******************************************************************************* + + NAME + CsrWifiSmePmkid + + DESCRIPTION + Defines a PMKID association with BSS + + MEMBERS + bssid - BSS identifier + pmkid - PMKID + +*******************************************************************************/ +typedef struct +{ + CsrWifiMacAddress bssid; + CsrUint8 pmkid[16]; +} CsrWifiSmePmkid; + +/******************************************************************************* + + NAME + CsrWifiSmePmkidCandidate + + DESCRIPTION + Information for a PMKID candidate + + MEMBERS + bssid - BSS identifier + preAuthAllowed - Indicates whether preauthentication is allowed + +*******************************************************************************/ +typedef struct +{ + CsrWifiMacAddress bssid; + CsrBool preAuthAllowed; +} CsrWifiSmePmkidCandidate; + +/******************************************************************************* + + NAME + CsrWifiSmePmkidList + + DESCRIPTION + NOT USED + Used in the Sync access API + + MEMBERS + pmkidsCount - Number of PMKIDs in the list + pmkids - Points to the first PMKID in the list + +*******************************************************************************/ +typedef struct +{ + CsrUint8 pmkidsCount; + CsrWifiSmePmkid *pmkids; +} CsrWifiSmePmkidList; + +/******************************************************************************* + + NAME + CsrWifiSmeRegulatoryDomainInfo + + DESCRIPTION + Regulatory domain options. + + MEMBERS + dot11MultiDomainCapabilityImplemented + - TRUE is the multi domain capability is implemented + dot11MultiDomainCapabilityEnabled + - TRUE is the multi domain capability is enabled + currentRegulatoryDomain + - Current regulatory domain + currentCountryCode + - Current country code as defined by the IEEE 802.11 + standards + +*******************************************************************************/ +typedef struct +{ + CsrBool dot11MultiDomainCapabilityImplemented; + CsrBool dot11MultiDomainCapabilityEnabled; + CsrWifiSmeRegulatoryDomain currentRegulatoryDomain; + CsrUint8 currentCountryCode[2]; +} CsrWifiSmeRegulatoryDomainInfo; + +/******************************************************************************* + + NAME + CsrWifiSmeRoamingBandData + + DESCRIPTION + Thresholds to define one usability level category for the received signal + + MEMBERS + rssiHighThreshold - Received Signal Strength Indication upper bound in dBm + for the usability level + rssiLowThreshold - Received Signal Strength Indication lower bound in dBm + for the usability level + snrHighThreshold - Signal to Noise Ratio upper bound in dB for the + usability level + snrLowThreshold - Signal to Noise Ratio lower bound in dB for the + usability level + +*******************************************************************************/ +typedef struct +{ + CsrInt16 rssiHighThreshold; + CsrInt16 rssiLowThreshold; + CsrInt16 snrHighThreshold; + CsrInt16 snrLowThreshold; +} CsrWifiSmeRoamingBandData; + +/******************************************************************************* + + NAME + CsrWifiSmeScanConfigData + + DESCRIPTION + Configures the scanning behaviour of the driver and firmware + + MEMBERS + intervalSeconds - All the channels will be scanned once in this time + interval. + If connected, the channel scans are spread across + the interval. + If disconnected, all the channels will be scanned + together + validitySeconds - How long the scan result are cached + minActiveChannelTimeTu - Minimum time of listening on a channel being + actively scanned before leaving if no probe + responses or beacon frames have been received + maxActiveChannelTimeTu - Maximum time of listening on a channel being + actively scanned + minPassiveChannelTimeTu - Minimum time of listening on a channel being + passive scanned before leaving if no beacon frames + have been received + maxPassiveChannelTimeTu - Maximum time of listening on a channel being + passively scanned + +*******************************************************************************/ +typedef struct +{ + CsrUint16 intervalSeconds; + CsrUint16 validitySeconds; + CsrUint16 minActiveChannelTimeTu; + CsrUint16 maxActiveChannelTimeTu; + CsrUint16 minPassiveChannelTimeTu; + CsrUint16 maxPassiveChannelTimeTu; +} CsrWifiSmeScanConfigData; + +/******************************************************************************* + + NAME + CsrWifiSmeStaConfig + + DESCRIPTION + Station configuration options in the SME + + MEMBERS + connectionQualityRssiChangeTrigger - Sets the difference of RSSI + measurements which triggers reports + from the Firmware + connectionQualitySnrChangeTrigger - Sets the difference of SNR measurements + which triggers reports from the + Firmware + wmmModeMask - Mask containing one or more values from + CsrWifiSmeWmmMode + ifIndex - Indicates the band of frequencies used + allowUnicastUseGroupCipher - If TRUE, it allows to use groupwise + keys if no pairwise key is specified + enableOpportunisticKeyCaching - If TRUE, enables the Opportunistic Key + Caching feature + +*******************************************************************************/ +typedef struct +{ + CsrUint8 connectionQualityRssiChangeTrigger; + CsrUint8 connectionQualitySnrChangeTrigger; + CsrUint8 wmmModeMask; + CsrWifiSmeRadioIF ifIndex; + CsrBool allowUnicastUseGroupCipher; + CsrBool enableOpportunisticKeyCaching; +} CsrWifiSmeStaConfig; + +/******************************************************************************* + + NAME + CsrWifiSmeTsfTime + + DESCRIPTION + Time stamp representation + + MEMBERS + data - TSF Bytes + +*******************************************************************************/ +typedef struct +{ + CsrUint8 data[8]; +} CsrWifiSmeTsfTime; + +/******************************************************************************* + + NAME + CsrWifiSmeVersions + + DESCRIPTION + Reports version information for the chip, the firmware and the driver and + the SME. + + MEMBERS + chipId - Chip ID + chipVersion - Chip version ID + firmwareBuild - Firmware Rom build number + firmwarePatch - Firmware Patch build number (if applicable) + firmwareHip - Firmware HIP protocol version number + routerBuild - Router build number + routerHip - Router HIP protocol version number + smeBuild - SME build number + smeHip - SME HIP protocol version number + +*******************************************************************************/ +typedef struct +{ + CsrUint32 chipId; + CsrUint32 chipVersion; + CsrUint32 firmwareBuild; + CsrUint32 firmwarePatch; + CsrUint32 firmwareHip; + CsrCharString *routerBuild; + CsrUint32 routerHip; + CsrCharString *smeBuild; + CsrUint32 smeHip; +} CsrWifiSmeVersions; + +/******************************************************************************* + + NAME + CsrWifiSmeWmmAcParams + + DESCRIPTION + Structure holding WMM AC params data. + + MEMBERS + cwMin - Exponent for the calculation of CWmin. Range: 0 + to 15 + cwMax - Exponent for the calculation of CWmax. Range: 0 + to15 + aifs - Arbitration Inter Frame Spacing in terms of + number of timeslots. Range 2 to 15 + txopLimit - TXOP Limit in the units of 32 microseconds + admissionControlMandatory - Indicates whether the admission control is + mandatory or not. Current release does not + support admission control , hence shall be set + to FALSE. + +*******************************************************************************/ +typedef struct +{ + CsrUint8 cwMin; + CsrUint8 cwMax; + CsrUint8 aifs; + CsrUint16 txopLimit; + CsrBool admissionControlMandatory; +} CsrWifiSmeWmmAcParams; + +/******************************************************************************* + + NAME + CsrWifiSmeWpsDeviceType + + DESCRIPTION + Structure holding AP WPS device type data. + + MEMBERS + deviceDetails - category , sub category etc + +*******************************************************************************/ +typedef struct +{ + CsrUint8 deviceDetails[8]; +} CsrWifiSmeWpsDeviceType; + +/******************************************************************************* + + NAME + CsrWifiSmeWpsDeviceTypeCommon + + DESCRIPTION + + MEMBERS + spportWps - + deviceType - + +*******************************************************************************/ +typedef struct +{ + CsrBool spportWps; + CsrUint8 deviceType; +} CsrWifiSmeWpsDeviceTypeCommon; + +/******************************************************************************* + + NAME + CsrWifiSmeWpsInfo + + DESCRIPTION + + MEMBERS + version - + configMethods - + devicePassworId - + +*******************************************************************************/ +typedef struct +{ + CsrUint16 version; + CsrUint16 configMethods; + CsrUint16 devicePassworId; +} CsrWifiSmeWpsInfo; + +/******************************************************************************* + + NAME + CsrWifiSmeCloakedSsidConfig + + DESCRIPTION + List of cloaked SSIDs . + + MEMBERS + cloakedSsidsCount - Number of cloaked SSID + cloakedSsids - Points to the first byte of the first SSID provided + +*******************************************************************************/ +typedef struct +{ + CsrUint8 cloakedSsidsCount; + CsrWifiSsid *cloakedSsids; +} CsrWifiSmeCloakedSsidConfig; + +/******************************************************************************* + + NAME + CsrWifiSmeCoexInfo + + DESCRIPTION + Information and state related to coexistence. + + MEMBERS + hasTrafficData - TRUE if any Wi-Fi traffic is detected + currentTrafficType - Current type of traffic + currentPeriodMs - Period of the traffic as detected by the traffic + analysis. + If the traffic is not periodic, it is set to 0. + currentPowerSave - Current power save level + currentCoexPeriodMs - Period of awakening for the firmware used when + periodic traffic is detected. + If the traffic is not periodic, it is set to 0. + currentCoexLatencyMs - Period of awakening for the firmware used when + non-periodic traffic is detected + hasBtDevice - TRUE if there is a Bluetooth device connected + currentBlackoutDurationUs - Current blackout duration for protecting + Bluetooth + currentBlackoutPeriodUs - Current blackout period + currentCoexScheme - Defines the scheme for the coexistence + signalling + +*******************************************************************************/ +typedef struct +{ + CsrBool hasTrafficData; + CsrWifiSmeTrafficType currentTrafficType; + CsrUint16 currentPeriodMs; + CsrWifiSmePowerSaveLevel currentPowerSave; + CsrUint16 currentCoexPeriodMs; + CsrUint16 currentCoexLatencyMs; + CsrBool hasBtDevice; + CsrUint32 currentBlackoutDurationUs; + CsrUint32 currentBlackoutPeriodUs; + CsrWifiSmeCoexScheme currentCoexScheme; +} CsrWifiSmeCoexInfo; + +/******************************************************************************* + + NAME + CsrWifiSmeConnectionConfig + + DESCRIPTION + Specifies the parameters that the SME should use in selecting a network. + + MEMBERS + ssid + - Service Set identifier + bssid + - BSS identifier + bssType + - Indicates the type of BSS + ifIndex + - Indicates the radio interface + privacyMode + - Specifies whether the privacy mode is enabled or disabled. + authModeMask + - Sets the authentication options that the SME can use while + associating to the AP + Set mask with values from CsrWifiSmeAuthMode + encryptionModeMask + - Sets the encryption options that the SME can use while + associating to the AP + Set mask with values from CsrWifiSmeEncryption + mlmeAssociateReqInformationElementsLength + - Length in bytes of information elements to be sent in the + Association Request. + mlmeAssociateReqInformationElements + - Points to the first byte of the information elements, if + any. + wmmQosInfo + - This parameter allows the driver's WMM behaviour to be + configured. + To enable support for WMM, use + CSR_WIFI_SME_SME_CONFIG_SET_REQ with the + CSR_WIFI_SME_WMM_MODE_AC_ENABLED bit set in wmmModeMask + field in smeConfig parameter. + Set mask with values from CsrWifiSmeWmmQosInfo + adhocJoinOnly + - This parameter is relevant only if bssType is NOT set to + CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE: + if TRUE the SME will only try to join an ad-hoc network if + there is one already established; + if FALSE the SME will try to join an ad-hoc network if + there is one already established or it will try to + establish a new one + adhocChannel + - This parameter is relevant only if bssType is NOT set to + CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE: + it indicates the channel to use joining an ad hoc network. + Setting this to 0 causes the SME to select a channel from + those permitted in the regulatory domain. + +*******************************************************************************/ +typedef struct +{ + CsrWifiSsid ssid; + CsrWifiMacAddress bssid; + CsrWifiSmeBssType bssType; + CsrWifiSmeRadioIF ifIndex; + CsrWifiSme80211PrivacyMode privacyMode; + CsrWifiSmeAuthModeMask authModeMask; + CsrWifiSmeEncryptionMask encryptionModeMask; + CsrUint16 mlmeAssociateReqInformationElementsLength; + CsrUint8 *mlmeAssociateReqInformationElements; + CsrWifiSmeWmmQosInfoMask wmmQosInfo; + CsrBool adhocJoinOnly; + CsrUint8 adhocChannel; +} CsrWifiSmeConnectionConfig; + +/******************************************************************************* + + NAME + CsrWifiSmeConnectionInfo + + DESCRIPTION + Parameters that the SME should use in selecting a network + + MEMBERS + ssid - Service set identifier + bssid - BSS identifier + networkType80211 - Physical layer used for the connection + channelNumber - Channel number + channelFrequency - Channel frequency + authMode - Authentication mode used for the connection + pairwiseCipher - Encryption type for peer to peer communication + groupCipher - Encryption type for broadcast and multicast + communication + ifIndex - Indicates the radio interface + atimWindowTu - ATIM window specified for IBSS + beaconPeriodTu - Interval between beacon packets + reassociation - Indicates whether a reassociation occurred + beaconFrameLength - Indicates the number of bytes of the beacon + frame + beaconFrame - Points at the first byte of the beacon frame + associationReqFrameLength - Indicates the number of bytes of the + association request frame + associationReqFrame - Points at the first byte of the association + request frame + associationRspFrameLength - Indicates the number of bytes of the + association response frame + associationRspFrame - Points at the first byte of the association + response frame + assocScanInfoElementsLength - Indicates the number of bytes in the buffer + pointed by assocScanInfoElements + assocScanInfoElements - Pointer to the buffer containing the + information elements of the probe response + received after the probe requests sent before + attempting to authenticate to the network + assocReqCapabilities - Reports the content of the Capability + information element as specified in the + association request. + assocReqListenIntervalTu - Listen Interval specified in the association + request + assocReqApAddress - AP address to which the association requests + has been sent + assocReqInfoElementsLength - Indicates the number of bytes of the + association request information elements + assocReqInfoElements - Points at the first byte of the association + request information elements + assocRspResult - Result reported in the association response + assocRspCapabilityInfo - Reports the content of the Capability + information element as received in the + association response. + assocRspAssociationId - Reports the association ID received in the + association response. + assocRspInfoElementsLength - Indicates the number of bytes of the + association response information elements + assocRspInfoElements - Points at the first byte of the association + response information elements + +*******************************************************************************/ +typedef struct +{ + CsrWifiSsid ssid; + CsrWifiMacAddress bssid; + CsrWifiSme80211NetworkType networkType80211; + CsrUint8 channelNumber; + CsrUint16 channelFrequency; + CsrWifiSmeAuthMode authMode; + CsrWifiSmeEncryption pairwiseCipher; + CsrWifiSmeEncryption groupCipher; + CsrWifiSmeRadioIF ifIndex; + CsrUint16 atimWindowTu; + CsrUint16 beaconPeriodTu; + CsrBool reassociation; + CsrUint16 beaconFrameLength; + CsrUint8 *beaconFrame; + CsrUint16 associationReqFrameLength; + CsrUint8 *associationReqFrame; + CsrUint16 associationRspFrameLength; + CsrUint8 *associationRspFrame; + CsrUint16 assocScanInfoElementsLength; + CsrUint8 *assocScanInfoElements; + CsrUint16 assocReqCapabilities; + CsrUint16 assocReqListenIntervalTu; + CsrWifiMacAddress assocReqApAddress; + CsrUint16 assocReqInfoElementsLength; + CsrUint8 *assocReqInfoElements; + CsrWifiSmeIEEE80211Result assocRspResult; + CsrUint16 assocRspCapabilityInfo; + CsrUint16 assocRspAssociationId; + CsrUint16 assocRspInfoElementsLength; + CsrUint8 *assocRspInfoElements; +} CsrWifiSmeConnectionInfo; + +/******************************************************************************* + + NAME + CsrWifiSmeDeviceConfig + + DESCRIPTION + General configuration options in the SME + + MEMBERS + trustLevel - Level of trust of the information coming from the + network + countryCode - Country code as specified by IEEE 802.11 standard + firmwareDriverInterface - Specifies the type of communication between Host + and Firmware + enableStrictDraftN - If TRUE TKIP is disallowed when connecting to + 802.11n enabled access points + +*******************************************************************************/ +typedef struct +{ + CsrWifiSme80211dTrustLevel trustLevel; + CsrUint8 countryCode[2]; + CsrWifiSmeFirmwareDriverInterface firmwareDriverInterface; + CsrBool enableStrictDraftN; +} CsrWifiSmeDeviceConfig; + +/******************************************************************************* + + NAME + CsrWifiSmeDeviceInfo + + DESCRIPTION + P2P Information for a P2P Device + + MEMBERS + deviceAddress - Device Address of the P2P device + configMethods - Supported WPS configuration methods. + p2PDeviceCap - P2P device capabilities + primDeviceType - Primary WPS device type + secondaryDeviceTypeCount - Number of secondary device types + secDeviceType - list of secondary WPS device types + deviceName - Device name without up to 32 characters'\0'. + deviceNameLength - Number of characters of the device name + +*******************************************************************************/ +typedef struct +{ + CsrWifiMacAddress deviceAddress; + CsrWifiSmeWpsConfigTypeMask configMethods; + CsrWifiSmeP2pCapabilityMask p2PDeviceCap; + CsrWifiSmeWpsDeviceType primDeviceType; + CsrUint8 secondaryDeviceTypeCount; + CsrWifiSmeWpsDeviceType *secDeviceType; + CsrUint8 deviceName[32]; + CsrUint8 deviceNameLength; +} CsrWifiSmeDeviceInfo; + +/******************************************************************************* + + NAME + CsrWifiSmeDeviceInfoCommon + + DESCRIPTION + Structure holding device information. + + MEMBERS + p2pDeviceAddress - + primaryDeviceType - + secondaryDeviceTypesCount - + secondaryDeviceTypes - + deviceNameLength - + deviceName - + +*******************************************************************************/ +typedef struct +{ + CsrWifiMacAddress p2pDeviceAddress; + CsrWifiSmeWpsDeviceTypeCommon primaryDeviceType; + CsrUint8 secondaryDeviceTypesCount; + CsrUint8 secondaryDeviceTypes[10]; + CsrUint8 deviceNameLength; + CsrUint8 deviceName[32]; +} CsrWifiSmeDeviceInfoCommon; + +/******************************************************************************* + + NAME + CsrWifiSmeHostConfig + + DESCRIPTION + Defines the host power state (for example, on mains power, on battery + power etc) and the periodicity of the traffic data. + + MEMBERS + powerMode - The wireless manager application should use the + powerMode parameter to inform the SME of the host + power state. + applicationDataPeriodMs - The applicationDataPeriodMs parameter allows a + wireless manager application to inform the SME + that an application is running that generates + periodic network traffic and the period of the + traffic. + An example of such an application is a VoIP client. + The wireless manager application should set + applicationDataPeriodMs to the period in + milliseconds between data packets or zero if no + periodic application is running. + Voip etc 0 = No Periodic Data + +*******************************************************************************/ +typedef struct +{ + CsrWifiSmeHostPowerMode powerMode; + CsrUint16 applicationDataPeriodMs; +} CsrWifiSmeHostConfig; + +/******************************************************************************* + + NAME + CsrWifiSmeKey + + DESCRIPTION + Information for a key to be used for encryption + + MEMBERS + keyType - Specifies whether the key is a pairwise or group key; it + should be set to CSR_WIFI_SME_GROUP_KEY or + CSR_WIFI_SME_PAIRWISE_KEY, as required. + keyIndex - Specifies which WEP key (0-3) to set; it should be set to 0 + for a WPA/WPA2 pairwise key and non-zero for a WPA/WPA2 + group key. + wepTxKey - If wepTxKey is TRUE, and the key is a WEP key, the key will + be selected for encrypting transmitted packets. + To select a previously defined key as the transmit + encryption key, set keyIndex to the required key, wepTxKey + to TRUE and the keyLength to 0. + keyRsc - Key Receive Sequence Counter + authenticator - If TRUE the WMA will act as authenticator. + CURRENTLY NOT SUPPORTED + address - BSS identifier of the AP + keyLength - Length of the key in bytes + key - Points to the first byte of the key + +*******************************************************************************/ +typedef struct +{ + CsrWifiSmeKeyType keyType; + CsrUint8 keyIndex; + CsrBool wepTxKey; + CsrUint16 keyRsc[8]; + CsrBool authenticator; + CsrWifiMacAddress address; + CsrUint8 keyLength; + CsrUint8 key[32]; +} CsrWifiSmeKey; + +/******************************************************************************* + + NAME + CsrWifiSmeP2pClientInfoType + + DESCRIPTION + P2P Information for a P2P Client + + MEMBERS + p2PClientInterfaceAddress - MAC address of the P2P Client + clientDeviceInfo - Device Information + +*******************************************************************************/ +typedef struct +{ + CsrWifiMacAddress p2PClientInterfaceAddress; + CsrWifiSmeDeviceInfo clientDeviceInfo; +} CsrWifiSmeP2pClientInfoType; + +/******************************************************************************* + + NAME + CsrWifiSmeP2pGroupInfo + + DESCRIPTION + P2P Information for a P2P Group + + MEMBERS + groupCapability - P2P group capabilities + p2pDeviceAddress - Device Address of the GO + p2pClientInfoCount - Number of P2P Clients that belong to the group. + p2PClientInfo - Pointer to the list containing client information for + each client in the group + +*******************************************************************************/ +typedef struct +{ + CsrWifiSmeP2pGroupCapabilityMask groupCapability; + CsrWifiMacAddress p2pDeviceAddress; + CsrUint8 p2pClientInfoCount; + CsrWifiSmeP2pClientInfoType *p2PClientInfo; +} CsrWifiSmeP2pGroupInfo; + +/******************************************************************************* + + NAME + CsrWifiSmePowerConfig + + DESCRIPTION + Configures the power-save behaviour of the driver and firmware. + + MEMBERS + powerSaveLevel - Power Save Level option + listenIntervalTu - Interval for waking to receive beacon frames + rxDtims - If TRUE, wake for DTIM every beacon period, to + allow the reception broadcast packets + d3AutoScanMode - Defines whether the autonomous scanning will be + turned off or will stay on during a D3 suspended + period + clientTrafficWindow - Deprecated + opportunisticPowerSave - Deprecated + noticeOfAbsence - Deprecated + +*******************************************************************************/ +typedef struct +{ + CsrWifiSmePowerSaveLevel powerSaveLevel; + CsrUint16 listenIntervalTu; + CsrBool rxDtims; + CsrWifiSmeD3AutoScanMode d3AutoScanMode; + CsrUint8 clientTrafficWindow; + CsrBool opportunisticPowerSave; + CsrBool noticeOfAbsence; +} CsrWifiSmePowerConfig; + +/******************************************************************************* + + NAME + CsrWifiSmeRoamingConfig + + DESCRIPTION + Configures the roaming behaviour of the driver and firmware + + MEMBERS + roamingBands - Defines the thresholds to determine the usability + level of the current connection. + roamingBands is indexed by the first 3 entries of + the CsrWifiSmeBasicUsability enum + disableSmoothRoaming - Disable the RSSI/SNR triggers from the Firmware + that the SME uses to detect the quality of the + connection. + This implicitly disables disableRoamScans + disableRoamScans - Disables the scanning for the roaming operation + reconnectLimit - Maximum number of times SME may reconnect in the + given interval + reconnectLimitIntervalMs - Interval for maximum number of times SME may + reconnect to the same Access Point + roamScanCfg - Scanning behaviour for the specifically aimed at + improving roaming performance. + roamScanCfg is indexed by the first 3 entries of + the CsrWifiSmeBasicUsability enum + +*******************************************************************************/ +typedef struct +{ + CsrWifiSmeRoamingBandData roamingBands[3]; + CsrBool disableSmoothRoaming; + CsrBool disableRoamScans; + CsrUint8 reconnectLimit; + CsrUint16 reconnectLimitIntervalMs; + CsrWifiSmeScanConfigData roamScanCfg[3]; +} CsrWifiSmeRoamingConfig; + +/******************************************************************************* + + NAME + CsrWifiSmeScanConfig + + DESCRIPTION + Parameters for the autonomous scanning behaviour of the system + + MEMBERS + scanCfg - Scan configuration data. + Indexed by the CsrWifiSmeBasicUsability enum + disableAutonomousScans - Enables or disables the autonomous scan + maxResults - Maximum number of results to be cached in the SME + highRssiThreshold - High received signal strength indication threshold + in dBm for an AP above which the system will + report scan indications + lowRssiThreshold - Low received signal strength indication threshold + in dBm for an AP below which the system will + report scan indications + deltaRssiThreshold - Minimum difference for received signal strength + indication in dBm for an AP which trigger a scan + indication to be sent. + highSnrThreshold - High Signal to Noise Ratio threshold in dB for an + AP above which the system will report scan + indications + lowSnrThreshold - Low Signal to Noise Ratio threshold in dB for an + AP below which the system will report scan + indications + deltaSnrThreshold - Minimum difference for Signal to Noise Ratio in dB + for an AP which trigger a scan indication to be + sent. + passiveChannelListCount - Number of channels to be scanned passively. + passiveChannelList - Points to the first channel to be scanned + passively , if any. + +*******************************************************************************/ +typedef struct +{ + CsrWifiSmeScanConfigData scanCfg[4]; + CsrBool disableAutonomousScans; + CsrUint16 maxResults; + CsrInt8 highRssiThreshold; + CsrInt8 lowRssiThreshold; + CsrInt8 deltaRssiThreshold; + CsrInt8 highSnrThreshold; + CsrInt8 lowSnrThreshold; + CsrInt8 deltaSnrThreshold; + CsrUint16 passiveChannelListCount; + CsrUint8 *passiveChannelList; +} CsrWifiSmeScanConfig; + +/******************************************************************************* + + NAME + CsrWifiSmeScanResult + + DESCRIPTION + This structure defines the scan result for each BSS found + + MEMBERS + ssid - Service set identifier + bssid - BSS identifier + rssi - Received signal strength indication in dBm + snr - Signal to noise ratio in dB + ifIndex - Indicates the radio interface + beaconPeriodTu - Interval between beacon frames + timeStamp - Timestamp in the BSS + localTime - Timestamp in the Access Point + channelFrequency - Channel frequency + capabilityInformation - Capabilities of the BSS. + channelNumber - Channel number + usability - Indicates the usability level. + bssType - Type of BSS. + informationElementsLength - Number of bytes of the information elements + received as part of the beacon or probe + response. + informationElements - Points to the first byte of the IEs received + as part of the beacon or probe response. + The format of the IEs is as specified in the + IEEE 802.11 specification. + p2pDeviceRole - Role of the P2P device. + Relevant only if bssType is + CSR_WIFI_SME_BSS_TYPE_P2P + deviceInfo - Union containing P2P device info which + depends on p2pDeviceRole parameter. + deviceInforeservedCli - + deviceInfogroupInfo - + deviceInforeservedNone - + deviceInfostandalonedevInfo - + +*******************************************************************************/ +typedef struct +{ + CsrWifiSsid ssid; + CsrWifiMacAddress bssid; + CsrInt16 rssi; + CsrInt16 snr; + CsrWifiSmeRadioIF ifIndex; + CsrUint16 beaconPeriodTu; + CsrWifiSmeTsfTime timeStamp; + CsrWifiSmeTsfTime localTime; + CsrUint16 channelFrequency; + CsrUint16 capabilityInformation; + CsrUint8 channelNumber; + CsrWifiSmeBasicUsability usability; + CsrWifiSmeBssType bssType; + CsrUint16 informationElementsLength; + CsrUint8 *informationElements; + CsrWifiSmeP2pRole p2pDeviceRole; + union { + CsrWifiSmeEmpty reservedCli; + CsrWifiSmeP2pGroupInfo groupInfo; + CsrWifiSmeEmpty reservedNone; + CsrWifiSmeDeviceInfo standalonedevInfo; + } deviceInfo; +} CsrWifiSmeScanResult; + +/******************************************************************************* + + NAME + CsrWifiSmeWep128Keys + + DESCRIPTION + Structure holding WEP Authentication Type and WEP keys that can be used + when using WEP128. + + MEMBERS + wepAuthType - Mask to select the WEP authentication type (Open or Shared) + selectedWepKey - Index to one of the four keys below indicating the + currently used WEP key. Mapping From SME/User -> firmware. + Key 1 -> Index 0. Key 2 -> Index 1. key 3 -> Index 2. Key + 4-> Index 3. + key1 - Value for key number 1. + key2 - Value for key number 2. + key3 - Value for key number 3. + key4 - Value for key number 4. + +*******************************************************************************/ +typedef struct +{ + CsrWifiSmeWepAuthMode wepAuthType; + CsrUint8 selectedWepKey; + CsrUint8 key1[13]; + CsrUint8 key2[13]; + CsrUint8 key3[13]; + CsrUint8 key4[13]; +} CsrWifiSmeWep128Keys; + +/******************************************************************************* + + NAME + CsrWifiSmeWep64Keys + + DESCRIPTION + Structure holding WEP Authentication Type and WEP keys that can be used + when using WEP64. + + MEMBERS + wepAuthType - Mask to select the WEP authentication type (Open or Shared) + selectedWepKey - Index to one of the four keys below indicating the + currently used WEP key. Mapping From SME/User -> firmware. + Key 1 -> Index 0. Key 2 -> Index 1. key 3 -> Index 2. Key + 4-> Index 3. + key1 - Value for key number 1. + key2 - Value for key number 2. + key3 - Value for key number 3. + key4 - Value for key number 4. + +*******************************************************************************/ +typedef struct +{ + CsrWifiSmeWepAuthMode wepAuthType; + CsrUint8 selectedWepKey; + CsrUint8 key1[5]; + CsrUint8 key2[5]; + CsrUint8 key3[5]; + CsrUint8 key4[5]; +} CsrWifiSmeWep64Keys; + +/******************************************************************************* + + NAME + CsrWifiSmeWepAuth + + DESCRIPTION + WEP authentication parameter structure + + MEMBERS + wepKeyType - WEP key try (128 bit or 64 bit) + wepCredentials - Union containing credentials which depends on + wepKeyType parameter. + wepCredentialswep128Key - + wepCredentialswep64Key - + +*******************************************************************************/ +typedef struct +{ + CsrWifiSmeWepCredentialType wepKeyType; + union { + CsrWifiSmeWep128Keys wep128Key; + CsrWifiSmeWep64Keys wep64Key; + } wepCredentials; +} CsrWifiSmeWepAuth; + +/******************************************************************************* + + NAME + CsrWifiSmeWpsConfig + + DESCRIPTION + Structure holding AP WPS Config data. + + MEMBERS + wpsVersion - wpsVersion should be 0x10 for WPS1.0h or 0x20 for + WSC2.0 + uuid - uuid. + deviceName - Device name upto 32 characters without '\0'. + deviceNameLength - deviceNameLen. + manufacturer - manufacturer: CSR + manufacturerLength - manufacturerLen. + modelName - modelName Unifi + modelNameLength - modelNameLen. + modelNumber - modelNumber + modelNumberLength - modelNumberLen. + serialNumber - serialNumber + primDeviceType - Primary WPS device type + secondaryDeviceTypeCount - Number of secondary device types + secondaryDeviceType - list of secondary WPS device types + configMethods - Supported WPS config methods + rfBands - RfBands. + osVersion - Os version on which the device is running + +*******************************************************************************/ +typedef struct +{ + CsrUint8 wpsVersion; + CsrUint8 uuid[16]; + CsrUint8 deviceName[32]; + CsrUint8 deviceNameLength; + CsrUint8 manufacturer[64]; + CsrUint8 manufacturerLength; + CsrUint8 modelName[32]; + CsrUint8 modelNameLength; + CsrUint8 modelNumber[32]; + CsrUint8 modelNumberLength; + CsrUint8 serialNumber[32]; + CsrWifiSmeWpsDeviceType primDeviceType; + CsrUint8 secondaryDeviceTypeCount; + CsrWifiSmeWpsDeviceType *secondaryDeviceType; + CsrWifiSmeWpsConfigTypeMask configMethods; + CsrUint8 rfBands; + CsrUint8 osVersion[4]; +} CsrWifiSmeWpsConfig; + + +/* Downstream */ +#define CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST (0x0000) + +#define CSR_WIFI_SME_ACTIVATE_REQ ((CsrWifiSmePrim) (0x0000 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_ADHOC_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0001 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_ADHOC_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0002 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_BLACKLIST_REQ ((CsrWifiSmePrim) (0x0003 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_CALIBRATION_DATA_GET_REQ ((CsrWifiSmePrim) (0x0004 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_CALIBRATION_DATA_SET_REQ ((CsrWifiSmePrim) (0x0005 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_CCX_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0006 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_CCX_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0007 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_COEX_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0008 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_COEX_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0009 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_COEX_INFO_GET_REQ ((CsrWifiSmePrim) (0x000A + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_CONNECT_REQ ((CsrWifiSmePrim) (0x000B + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_CONNECTION_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x000C + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_CONNECTION_INFO_GET_REQ ((CsrWifiSmePrim) (0x000D + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_CONNECTION_STATS_GET_REQ ((CsrWifiSmePrim) (0x000E + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_DEACTIVATE_REQ ((CsrWifiSmePrim) (0x000F + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_DISCONNECT_REQ ((CsrWifiSmePrim) (0x0010 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_EVENT_MASK_SET_REQ ((CsrWifiSmePrim) (0x0011 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_HOST_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0012 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_HOST_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0013 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_KEY_REQ ((CsrWifiSmePrim) (0x0014 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_LINK_QUALITY_GET_REQ ((CsrWifiSmePrim) (0x0015 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_MIB_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0016 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_MIB_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0017 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_MIB_GET_NEXT_REQ ((CsrWifiSmePrim) (0x0018 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_MIB_GET_REQ ((CsrWifiSmePrim) (0x0019 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_MIB_SET_REQ ((CsrWifiSmePrim) (0x001A + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_MULTICAST_ADDRESS_REQ ((CsrWifiSmePrim) (0x001B + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_PACKET_FILTER_SET_REQ ((CsrWifiSmePrim) (0x001C + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_PERMANENT_MAC_ADDRESS_GET_REQ ((CsrWifiSmePrim) (0x001D + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_PMKID_REQ ((CsrWifiSmePrim) (0x001E + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_POWER_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x001F + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_POWER_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0020 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_REGULATORY_DOMAIN_INFO_GET_REQ ((CsrWifiSmePrim) (0x0021 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_ROAMING_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0022 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_ROAMING_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0023 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_SCAN_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0024 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_SCAN_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0025 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_SCAN_FULL_REQ ((CsrWifiSmePrim) (0x0026 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_SCAN_RESULTS_FLUSH_REQ ((CsrWifiSmePrim) (0x0027 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_SCAN_RESULTS_GET_REQ ((CsrWifiSmePrim) (0x0028 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_SME_STA_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0029 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_SME_STA_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x002A + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_STATION_MAC_ADDRESS_GET_REQ ((CsrWifiSmePrim) (0x002B + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_TSPEC_REQ ((CsrWifiSmePrim) (0x002C + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_VERSIONS_GET_REQ ((CsrWifiSmePrim) (0x002D + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_WIFI_FLIGHTMODE_REQ ((CsrWifiSmePrim) (0x002E + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_WIFI_OFF_REQ ((CsrWifiSmePrim) (0x002F + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_WIFI_ON_REQ ((CsrWifiSmePrim) (0x0030 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_CLOAKED_SSIDS_SET_REQ ((CsrWifiSmePrim) (0x0031 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_CLOAKED_SSIDS_GET_REQ ((CsrWifiSmePrim) (0x0032 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_SME_COMMON_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0033 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_SME_COMMON_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0034 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_REQ ((CsrWifiSmePrim) (0x0035 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_WPS_CONFIGURATION_REQ ((CsrWifiSmePrim) (0x0036 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) + + +#define CSR_WIFI_SME_PRIM_DOWNSTREAM_HIGHEST (0x0036 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST) + +/* Upstream */ +#define CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST (0x0000 + CSR_PRIM_UPSTREAM) + +#define CSR_WIFI_SME_ACTIVATE_CFM ((CsrWifiSmePrim)(0x0000 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_ADHOC_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x0001 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_ADHOC_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x0002 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_ASSOCIATION_COMPLETE_IND ((CsrWifiSmePrim)(0x0003 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_ASSOCIATION_START_IND ((CsrWifiSmePrim)(0x0004 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_BLACKLIST_CFM ((CsrWifiSmePrim)(0x0005 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_CALIBRATION_DATA_GET_CFM ((CsrWifiSmePrim)(0x0006 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_CALIBRATION_DATA_SET_CFM ((CsrWifiSmePrim)(0x0007 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_CCX_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x0008 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_CCX_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x0009 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_COEX_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x000A + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_COEX_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x000B + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_COEX_INFO_GET_CFM ((CsrWifiSmePrim)(0x000C + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_CONNECT_CFM ((CsrWifiSmePrim)(0x000D + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_CONNECTION_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x000E + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_CONNECTION_INFO_GET_CFM ((CsrWifiSmePrim)(0x000F + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_CONNECTION_QUALITY_IND ((CsrWifiSmePrim)(0x0010 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_CONNECTION_STATS_GET_CFM ((CsrWifiSmePrim)(0x0011 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_DEACTIVATE_CFM ((CsrWifiSmePrim)(0x0012 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_DISCONNECT_CFM ((CsrWifiSmePrim)(0x0013 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_EVENT_MASK_SET_CFM ((CsrWifiSmePrim)(0x0014 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_HOST_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x0015 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_HOST_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x0016 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_IBSS_STATION_IND ((CsrWifiSmePrim)(0x0017 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_KEY_CFM ((CsrWifiSmePrim)(0x0018 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_LINK_QUALITY_GET_CFM ((CsrWifiSmePrim)(0x0019 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_MEDIA_STATUS_IND ((CsrWifiSmePrim)(0x001A + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_MIB_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x001B + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_MIB_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x001C + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_MIB_GET_CFM ((CsrWifiSmePrim)(0x001D + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_MIB_GET_NEXT_CFM ((CsrWifiSmePrim)(0x001E + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_MIB_SET_CFM ((CsrWifiSmePrim)(0x001F + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_MIC_FAILURE_IND ((CsrWifiSmePrim)(0x0020 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_MULTICAST_ADDRESS_CFM ((CsrWifiSmePrim)(0x0021 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_PACKET_FILTER_SET_CFM ((CsrWifiSmePrim)(0x0022 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_PERMANENT_MAC_ADDRESS_GET_CFM ((CsrWifiSmePrim)(0x0023 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_PMKID_CANDIDATE_LIST_IND ((CsrWifiSmePrim)(0x0024 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_PMKID_CFM ((CsrWifiSmePrim)(0x0025 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_POWER_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x0026 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_POWER_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x0027 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_REGULATORY_DOMAIN_INFO_GET_CFM ((CsrWifiSmePrim)(0x0028 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_ROAM_COMPLETE_IND ((CsrWifiSmePrim)(0x0029 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_ROAM_START_IND ((CsrWifiSmePrim)(0x002A + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_ROAMING_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x002B + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_ROAMING_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x002C + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_SCAN_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x002D + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_SCAN_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x002E + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_SCAN_FULL_CFM ((CsrWifiSmePrim)(0x002F + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_SCAN_RESULT_IND ((CsrWifiSmePrim)(0x0030 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_SCAN_RESULTS_FLUSH_CFM ((CsrWifiSmePrim)(0x0031 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_SCAN_RESULTS_GET_CFM ((CsrWifiSmePrim)(0x0032 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_SME_STA_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x0033 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_SME_STA_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x0034 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_STATION_MAC_ADDRESS_GET_CFM ((CsrWifiSmePrim)(0x0035 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_TSPEC_IND ((CsrWifiSmePrim)(0x0036 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_TSPEC_CFM ((CsrWifiSmePrim)(0x0037 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_VERSIONS_GET_CFM ((CsrWifiSmePrim)(0x0038 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_WIFI_FLIGHTMODE_CFM ((CsrWifiSmePrim)(0x0039 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_WIFI_OFF_IND ((CsrWifiSmePrim)(0x003A + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_WIFI_OFF_CFM ((CsrWifiSmePrim)(0x003B + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_WIFI_ON_CFM ((CsrWifiSmePrim)(0x003C + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_CLOAKED_SSIDS_SET_CFM ((CsrWifiSmePrim)(0x003D + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_CLOAKED_SSIDS_GET_CFM ((CsrWifiSmePrim)(0x003E + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_WIFI_ON_IND ((CsrWifiSmePrim)(0x003F + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_SME_COMMON_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x0040 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_SME_COMMON_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x0041 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_CFM ((CsrWifiSmePrim)(0x0042 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_ERROR_IND ((CsrWifiSmePrim)(0x0043 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_INFO_IND ((CsrWifiSmePrim)(0x0044 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_CORE_DUMP_IND ((CsrWifiSmePrim)(0x0045 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_AMP_STATUS_CHANGE_IND ((CsrWifiSmePrim)(0x0046 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_WPS_CONFIGURATION_CFM ((CsrWifiSmePrim)(0x0047 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) + +#define CSR_WIFI_SME_PRIM_UPSTREAM_HIGHEST (0x0047 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST) + +#define CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT (CSR_WIFI_SME_PRIM_DOWNSTREAM_HIGHEST + 1 - CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST) +#define CSR_WIFI_SME_PRIM_UPSTREAM_COUNT (CSR_WIFI_SME_PRIM_UPSTREAM_HIGHEST + 1 - CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST) + +/******************************************************************************* + + NAME + CsrWifiSmeActivateReq + + DESCRIPTION + The WMA sends this primitive to activate the SME. + The WMA must activate the SME before it can send any other primitive. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; +} CsrWifiSmeActivateReq; + +/******************************************************************************* + + NAME + CsrWifiSmeAdhocConfigGetReq + + DESCRIPTION + This primitive gets the value of the adHocConfig parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; +} CsrWifiSmeAdhocConfigGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeAdhocConfigSetReq + + DESCRIPTION + This primitive sets the value of the adHocConfig parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + adHocConfig - Sets the values to use when starting an ad hoc network. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiSmeAdHocConfig adHocConfig; +} CsrWifiSmeAdhocConfigSetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeBlacklistReq + + DESCRIPTION + The wireless manager application should call this primitive to notify the + driver of any networks that should not be connected to. The interface + allows the wireless manager application to query, add, remove, and flush + the BSSIDs that the driver may not connect or roam to. + When this primitive adds to the black list the BSSID to which the SME is + currently connected, the SME will try to roam, if applicable, to another + BSSID in the same ESS; if the roaming procedure fails, the SME will + disconnect. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + action - The value of the CsrWifiSmeListAction parameter instructs + the driver to modify or provide the list of blacklisted + networks. + setAddressCount - Number of BSSIDs sent with this primitive + setAddresses - Pointer to the list of BBSIDs sent with the primitive, set + to NULL if none is sent. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeListAction action; + CsrUint8 setAddressCount; + CsrWifiMacAddress *setAddresses; +} CsrWifiSmeBlacklistReq; + +/******************************************************************************* + + NAME + CsrWifiSmeCalibrationDataGetReq + + DESCRIPTION + This primitive retrieves the Wi-Fi radio calibration data. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; +} CsrWifiSmeCalibrationDataGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeCalibrationDataSetReq + + DESCRIPTION + This primitive sets the Wi-Fi radio calibration data. + The usage of the primitive with proper calibration data will avoid + time-consuming configuration after power-up. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + calibrationDataLength - Number of bytes in the buffer pointed by + calibrationData + calibrationData - Pointer to a buffer of length calibrationDataLength + containing the calibration data + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 calibrationDataLength; + CsrUint8 *calibrationData; +} CsrWifiSmeCalibrationDataSetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeCcxConfigGetReq + + DESCRIPTION + This primitive gets the value of the CcxConfig parameter. + CURRENTLY NOT SUPPORTED. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; +} CsrWifiSmeCcxConfigGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeCcxConfigSetReq + + DESCRIPTION + This primitive sets the value of the CcxConfig parameter. + CURRENTLY NOT SUPPORTED. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + ccxConfig - Currently not supported + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeCcxConfig ccxConfig; +} CsrWifiSmeCcxConfigSetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeCoexConfigGetReq + + DESCRIPTION + This primitive gets the value of the CoexConfig parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; +} CsrWifiSmeCoexConfigGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeCoexConfigSetReq + + DESCRIPTION + This primitive sets the value of the CoexConfig parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + coexConfig - Configures the coexistence behaviour + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiSmeCoexConfig coexConfig; +} CsrWifiSmeCoexConfigSetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeCoexInfoGetReq + + DESCRIPTION + This primitive gets the value of the CoexInfo parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; +} CsrWifiSmeCoexInfoGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeConnectReq + + DESCRIPTION + The wireless manager application calls this primitive to start the + process of joining an 802.11 wireless network or to start an ad hoc + network. + The structure pointed by connectionConfig contains parameters describing + the network to join or, in case of an ad hoc network, to host or join. + The SME will select a network, perform the IEEE 802.11 Join, Authenticate + and Associate exchanges. + The SME selects the networks from the current scan list that match both + the SSID and BSSID, however either or both of these may be the wildcard + value. Using this rule, the following operations are possible: + * To connect to a network by name, specify the SSID and set the BSSID to + 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF. If there are two or more networks visible, + the SME will select the one with the strongest signal. + * To connect to a specific network, specify the BSSID. The SSID is + optional, but if given it must match the SSID of the network. An empty + SSID may be specified by setting the SSID length to zero. Please note + that if the BSSID is specified (i.e. not equal to 0xFF 0xFF 0xFF 0xFF + 0xFF 0xFF), the SME will not attempt to roam if signal conditions become + poor, even if there is an alternative AP with an SSID that matches the + current network SSID. + * To connect to any network matching the other parameters (i.e. security, + etc), set the SSID length to zero and set the BSSID to 0xFF 0xFF 0xFF + 0xFF 0xFF 0xFF. In this case, the SME will order all available networks + by their signal strengths and will iterate through this list until it + successfully connects. + NOTE: Specifying the BSSID will restrict the selection to one specific + network. If SSID and BSSID are given, they must both match the network + for it to be selected. To select a network based on the SSID only, the + wireless manager application must set the BSSID to 0xFF 0xFF 0xFF 0xFF + 0xFF 0xFF. + The SME will try to connect to each network that matches the provided + parameters, one by one, until it succeeds or has tried unsuccessfully + with all the matching networks. + If there is no network that matches the parameters and the request allows + to host an ad hoc network, the SME will advertise a new ad hoc network + instead. + If the SME cannot connect, it will notify the failure in the confirm. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + connectionConfig - Describes the candidate network to join or to host. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeConnectionConfig connectionConfig; +} CsrWifiSmeConnectReq; + +/******************************************************************************* + + NAME + CsrWifiSmeConnectionConfigGetReq + + DESCRIPTION + This primitive gets the value of the ConnectionConfig parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; +} CsrWifiSmeConnectionConfigGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeConnectionInfoGetReq + + DESCRIPTION + This primitive gets the value of the ConnectionInfo parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; +} CsrWifiSmeConnectionInfoGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeConnectionStatsGetReq + + DESCRIPTION + This primitive gets the value of the ConnectionStats parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; +} CsrWifiSmeConnectionStatsGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeDeactivateReq + + DESCRIPTION + The WMA sends this primitive to deactivate the SME. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; +} CsrWifiSmeDeactivateReq; + +/******************************************************************************* + + NAME + CsrWifiSmeDisconnectReq + + DESCRIPTION + The wireless manager application may disconnect from the current network + by calling this primitive + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; +} CsrWifiSmeDisconnectReq; + +/******************************************************************************* + + NAME + CsrWifiSmeEventMaskSetReq + + DESCRIPTION + The wireless manager application may register with the SME to receive + notification of interesting events. Indications will be sent only if the + wireless manager explicitly registers to be notified of that event. + indMask is a bit mask of values defined in CsrWifiSmeIndicationsMask. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + indMask - Set mask with values from CsrWifiSmeIndications + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiSmeIndicationsMask indMask; +} CsrWifiSmeEventMaskSetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeHostConfigGetReq + + DESCRIPTION + This primitive gets the value of the hostConfig parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; +} CsrWifiSmeHostConfigGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeHostConfigSetReq + + DESCRIPTION + This primitive sets the value of the hostConfig parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + hostConfig - Communicates a change of host power state (for example, on + mains power, on battery power etc) and of the periodicity of + traffic data + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeHostConfig hostConfig; +} CsrWifiSmeHostConfigSetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeKeyReq + + DESCRIPTION + The wireless manager application calls this primitive to add or remove + keys that the chip should use for encryption of data. + The interface allows the wireless manager application to add and remove + keys according to the specified action. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + action - The value of the CsrWifiSmeListAction parameter instructs the + driver to modify or provide the list of keys. + CSR_WIFI_SME_LIST_ACTION_GET is not supported here. + key - Key to be added or removed + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeListAction action; + CsrWifiSmeKey key; +} CsrWifiSmeKeyReq; + +/******************************************************************************* + + NAME + CsrWifiSmeLinkQualityGetReq + + DESCRIPTION + This primitive gets the value of the LinkQuality parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; +} CsrWifiSmeLinkQualityGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeMibConfigGetReq + + DESCRIPTION + This primitive gets the value of the MibConfig parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; +} CsrWifiSmeMibConfigGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeMibConfigSetReq + + DESCRIPTION + This primitive sets the value of the MibConfig parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + mibConfig - Conveys the desired value of various IEEE 802.11 attributes as + currently configured + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiSmeMibConfig mibConfig; +} CsrWifiSmeMibConfigSetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeMibGetNextReq + + DESCRIPTION + To read a sequence of MIB parameters, for example a table, call this + primitive to find the name of the next MIB variable + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + mibAttributeLength - Length of mibAttribute + mibAttribute - Points to a VarBind or VarBindList containing the + name(s) of the MIB variable(s) to search from. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 mibAttributeLength; + CsrUint8 *mibAttribute; +} CsrWifiSmeMibGetNextReq; + +/******************************************************************************* + + NAME + CsrWifiSmeMibGetReq + + DESCRIPTION + The wireless manager application calls this primitive to retrieve one or + more MIB variables. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + mibAttributeLength - Length of mibAttribute + mibAttribute - Points to the VarBind or VarBindList containing the + names of the MIB variables to be retrieved + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 mibAttributeLength; + CsrUint8 *mibAttribute; +} CsrWifiSmeMibGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeMibSetReq + + DESCRIPTION + The SME provides raw access to the MIB on the chip, which may be used by + some configuration or diagnostic utilities, but is not normally needed by + the wireless manager application. + The MIB access functions use BER encoded names (OID) of the MIB + parameters and BER encoded values, as described in the chip Host + Interface Protocol Specification. + The MIB parameters are described in 'Wi-Fi 5.0.0 Management Information + Base Reference Guide'. + The wireless manager application calls this primitive to set one or more + MIB variables + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + mibAttributeLength - Length of mibAttribute + mibAttribute - Points to the VarBind or VarBindList containing the + names and values of the MIB variables to set + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 mibAttributeLength; + CsrUint8 *mibAttribute; +} CsrWifiSmeMibSetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeMulticastAddressReq + + DESCRIPTION + The wireless manager application calls this primitive to specify the + multicast addresses which the chip should recognise. The interface allows + the wireless manager application to query, add, remove and flush the + multicast addresses for the network interface according to the specified + action. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + action - The value of the CsrWifiSmeListAction parameter + instructs the driver to modify or provide the list of + MAC addresses. + setAddressesCount - Number of MAC addresses sent with the primitive + setAddresses - Pointer to the list of MAC Addresses sent with the + primitive, set to NULL if none is sent. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeListAction action; + CsrUint8 setAddressesCount; + CsrWifiMacAddress *setAddresses; +} CsrWifiSmeMulticastAddressReq; + +/******************************************************************************* + + NAME + CsrWifiSmePacketFilterSetReq + + DESCRIPTION + The wireless manager application should call this primitive to enable or + disable filtering of broadcast packets: uninteresting broadcast packets + will be dropped by the Wi-Fi chip, instead of passing them up to the + host. + This has the advantage of saving power in the host application processor + as it removes the need to process unwanted packets. + All broadcast packets are filtered according to the filter and the filter + mode provided, except ARP packets, which are filtered using + arpFilterAddress. + Filters are not cumulative: only the parameters specified in the most + recent successful request are significant. + For more information, see 'UniFi Firmware API Specification'. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + filterLength - Length of the filter in bytes. + filterLength=0 disables the filter previously set + filter - Points to the first byte of the filter provided, if any. + This shall include zero or more instance of the + information elements of one of these types + * Traffic Classification (TCLAS) elements + * WMM-SA TCLAS elements + mode - Specifies whether the filter selects or excludes packets + matching the filter + arpFilterAddress - IPv4 address to be used for filtering the ARP packets. + * If the specified address is the IPv4 broadcast address + (255.255.255.255), all ARP packets are reported to the + host, + * If the specified address is NOT the IPv4 broadcast + address, only ARP packets with the specified address in + the Source or Target Protocol Address fields are reported + to the host + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrUint16 filterLength; + CsrUint8 *filter; + CsrWifiSmePacketFilterMode mode; + CsrWifiIp4Address arpFilterAddress; +} CsrWifiSmePacketFilterSetReq; + +/******************************************************************************* + + NAME + CsrWifiSmePermanentMacAddressGetReq + + DESCRIPTION + This primitive retrieves the MAC address stored in EEPROM + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; +} CsrWifiSmePermanentMacAddressGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmePmkidReq + + DESCRIPTION + The wireless manager application calls this primitive to request an + operation on the SME PMKID list. + The action argument specifies the operation to perform. + When the connection is complete, the wireless manager application may + then send and receive EAPOL packets to complete WPA or WPA2 + authentication if appropriate. + The wireless manager application can then pass the resulting encryption + keys using this primitive. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + action - The value of the CsrWifiSmeListAction parameter instructs + the driver to modify or provide the list of PMKIDs. + setPmkidsCount - Number of PMKIDs sent with the primitive + setPmkids - Pointer to the list of PMKIDs sent with the primitive, set + to NULL if none is sent. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeListAction action; + CsrUint8 setPmkidsCount; + CsrWifiSmePmkid *setPmkids; +} CsrWifiSmePmkidReq; + +/******************************************************************************* + + NAME + CsrWifiSmePowerConfigGetReq + + DESCRIPTION + This primitive gets the value of the PowerConfig parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; +} CsrWifiSmePowerConfigGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmePowerConfigSetReq + + DESCRIPTION + This primitive sets the value of the PowerConfig parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + powerConfig - Power saving configuration + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiSmePowerConfig powerConfig; +} CsrWifiSmePowerConfigSetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeRegulatoryDomainInfoGetReq + + DESCRIPTION + This primitive gets the value of the RegulatoryDomainInfo parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; +} CsrWifiSmeRegulatoryDomainInfoGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeRoamingConfigGetReq + + DESCRIPTION + This primitive gets the value of the RoamingConfig parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; +} CsrWifiSmeRoamingConfigGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeRoamingConfigSetReq + + DESCRIPTION + This primitive sets the value of the RoamingConfig parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + roamingConfig - Desired roaming behaviour values + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeRoamingConfig roamingConfig; +} CsrWifiSmeRoamingConfigSetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeScanConfigGetReq + + DESCRIPTION + This primitive gets the value of the ScanConfig parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; +} CsrWifiSmeScanConfigGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeScanConfigSetReq + + DESCRIPTION + This primitive sets the value of the ScanConfig parameter. + The SME normally configures the firmware to perform autonomous scanning + without involving the host. + The firmware passes beacon / probe response or indicates loss of beacon + on certain changes of state, for example: + * A new AP is seen for the first time + * An AP is no longer visible + * The signal strength of an AP changes by more than a certain amount, as + configured by the thresholds in the scanConfig parameter + In addition to the autonomous scan, the wireless manager application may + request a scan at any time using CSR_WIFI_SME_SCAN_FULL_REQ. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + scanConfig - Reports the configuration for the autonomous scanning behaviour + of the firmware + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiSmeScanConfig scanConfig; +} CsrWifiSmeScanConfigSetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeScanFullReq + + DESCRIPTION + The wireless manager application should call this primitive to request a + full scan. + Channels are scanned actively or passively according to the requirement + set by regulatory domain. + If the SME receives this primitive while a full scan is going on, the new + request is buffered and it will be served after the current full scan is + completed. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + ssidCount - Number of SSIDs provided. + If it is 0, the SME will attempt to detect any network + ssid - Points to the first SSID provided, if any. + bssid - BSS identifier. + If it is equal to FF-FF-FF-FF-FF, the SME will listen for + messages from any BSS. + If it is different from FF-FF-FF-FF-FF and any SSID is + provided, one SSID must match the network of the BSS. + forceScan - Forces the scan even if the SME is in a state which would + normally prevent it (e.g. autonomous scan is running). + bssType - Type of BSS to scan for + scanType - Type of scan to perform + channelListCount - Number of channels provided. + If it is 0, the SME will initiate a scan of all the + supported channels that are permitted by the current + regulatory domain. + channelList - Points to the first channel , or NULL if channelListCount + is zero. + probeIeLength - Length of the information element in bytes to be sent + with the probe message. + probeIe - Points to the first byte of the information element to be + sent with the probe message. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint8 ssidCount; + CsrWifiSsid *ssid; + CsrWifiMacAddress bssid; + CsrBool forceScan; + CsrWifiSmeBssType bssType; + CsrWifiSmeScanType scanType; + CsrUint16 channelListCount; + CsrUint8 *channelList; + CsrUint16 probeIeLength; + CsrUint8 *probeIe; +} CsrWifiSmeScanFullReq; + +/******************************************************************************* + + NAME + CsrWifiSmeScanResultsFlushReq + + DESCRIPTION + The Wireless Manager calls this primitive to ask the SME to delete all + scan results from its cache, except for the scan result of any currently + connected network. + As scan results are received by the SME from the firmware, they are + cached in the SME memory. + Any time the Wireless Manager requests scan results, they are returned + from the SME internal cache. + For some applications it may be desirable to clear this cache prior to + requesting that a scan be performed; this will ensure that the cache then + only contains the networks detected in the most recent scan. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; +} CsrWifiSmeScanResultsFlushReq; + +/******************************************************************************* + + NAME + CsrWifiSmeScanResultsGetReq + + DESCRIPTION + The wireless manager application calls this primitive to retrieve the + current set of scan results, either after receiving a successful + CSR_WIFI_SME_SCAN_FULL_CFM, or to get autonomous scan results. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; +} CsrWifiSmeScanResultsGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeSmeStaConfigGetReq + + DESCRIPTION + This primitive gets the value of the SmeStaConfig parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; +} CsrWifiSmeSmeStaConfigGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeSmeStaConfigSetReq + + DESCRIPTION + This primitive sets the value of the SmeConfig parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + smeConfig - SME Station Parameters to be set + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeStaConfig smeConfig; +} CsrWifiSmeSmeStaConfigSetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeStationMacAddressGetReq + + DESCRIPTION + This primitives is used to retrieve the current MAC address used by the + station. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; +} CsrWifiSmeStationMacAddressGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeTspecReq + + DESCRIPTION + The wireless manager application should call this primitive to use the + TSPEC feature. + The chip supports the use of TSPECs and TCLAS for the use of IEEE + 802.11/WMM Quality of Service features. + The API allows the wireless manager application to supply a correctly + formatted TSPEC and TCLAS pair to the driver. + After performing basic validation, the driver negotiates the installation + of the TSPEC with the AP as defined by the 802.11 specification. + The driver retains all TSPEC and TCLAS pairs until they are specifically + removed. + It is not compulsory for a TSPEC to have a TCLAS (NULL is used to + indicate that no TCLAS is supplied), while a TCLASS always require a + TSPEC. + The format of the TSPEC element is specified in 'WMM (including WMM Power + Save) Specification - Version 1.1' and 'ANSI/IEEE Std 802.11-REVmb/D3.0'. + For more information, see 'UniFi Configuring WMM and WMM-PS'. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + action - Specifies the action to be carried out on the list of TSPECs. + CSR_WIFI_SME_LIST_ACTION_FLUSH is not applicable here. + transactionId - Unique Transaction ID for the TSPEC, as assigned by the + driver + strict - If it set to false, allows the SME to perform automatic + TSPEC negotiation + ctrlMask - Additional TSPEC configuration for CCX. + Set mask with values from CsrWifiSmeTspecCtrl. + CURRENTLY NOT SUPPORTED + tspecLength - Length of the TSPEC. + tspec - Points to the first byte of the TSPEC + tclasLength - Length of the TCLAS. + If it is equal to 0, no TCLASS is provided for the TSPEC + tclas - Points to the first byte of the TCLAS, if any. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeListAction action; + CsrUint32 transactionId; + CsrBool strict; + CsrWifiSmeTspecCtrlMask ctrlMask; + CsrUint16 tspecLength; + CsrUint8 *tspec; + CsrUint16 tclasLength; + CsrUint8 *tclas; +} CsrWifiSmeTspecReq; + +/******************************************************************************* + + NAME + CsrWifiSmeVersionsGetReq + + DESCRIPTION + This primitive gets the value of the Versions parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; +} CsrWifiSmeVersionsGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeWifiFlightmodeReq + + DESCRIPTION + The wireless manager application may call this primitive on boot-up of + the platform to ensure that the chip is placed in a mode that prevents + any emission of RF energy. + This primitive is an alternative to CSR_WIFI_SME_WIFI_ON_REQ. + As in CSR_WIFI_SME_WIFI_ON_REQ, it causes the download of the patch file + (if any) and the programming of the initial MIB settings (if supplied by + the WMA), but it also ensures that the chip is left in its lowest + possible power-mode with the radio subsystems disabled. + This feature is useful on platforms where power cannot be removed from + the chip (leaving the chip not initialised will cause it to consume more + power so calling this function ensures that the chip is initialised into + a low power mode but without entering a state where it could emit any RF + energy). + NOTE: this primitive does not cause the Wi-Fi to change state: Wi-Fi + stays conceptually off. Configuration primitives can be sent after + CSR_WIFI_SME_WIFI_FLIGHTMODE_REQ and the configuration will be maintained. + Requests that require the state of the Wi-Fi to be ON will return + CSR_WIFI_SME_STATUS_WIFI_OFF in their confirms. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + address - Optionally specifies a station MAC address. + In normal use, the manager should set the address to 0xFF + 0xFF 0xFF 0xFF 0xFF 0xFF, which will cause the chip to use + the MAC address in the MIB. + mibFilesCount - Number of provided data blocks with initial MIB values + mibFiles - Points to the first data block with initial MIB values. + These data blocks are typically the contents of the provided + files ufmib.dat and localmib.dat, available from the host + file system, if they exist. + These files typically contain radio tuning and calibration + values. + More values can be created using the Host Tools. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiMacAddress address; + CsrUint16 mibFilesCount; + CsrWifiSmeDataBlock *mibFiles; +} CsrWifiSmeWifiFlightmodeReq; + +/******************************************************************************* + + NAME + CsrWifiSmeWifiOffReq + + DESCRIPTION + The wireless manager application calls this primitive to turn off the + chip, thus saving power when Wi-Fi is not in use. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; +} CsrWifiSmeWifiOffReq; + +/******************************************************************************* + + NAME + CsrWifiSmeWifiOnReq + + DESCRIPTION + The wireless manager application calls this primitive to turn on the + Wi-Fi chip. + If the Wi-Fi chip is currently off, the SME turns the Wi-Fi chip on, + downloads the patch file (if any), and programs the initial MIB settings + (if supplied by the WMA). + The patch file is not provided with the SME API; its downloading is + automatic and handled internally by the system. + The MIB settings, when provided, override the default values that the + firmware loads from EEPROM. + If the Wi-Fi chip is already on, the SME takes no action and returns a + successful status in the confirm. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + address - Optionally specifies a station MAC address. + In normal use, the manager should set the address to 0xFF + 0xFF 0xFF 0xFF 0xFF 0xFF, which will cause the chip to use + the MAC address in the MIB + mibFilesCount - Number of provided data blocks with initial MIB values + mibFiles - Points to the first data block with initial MIB values. + These data blocks are typically the contents of the provided + files ufmib.dat and localmib.dat, available from the host + file system, if they exist. + These files typically contain radio tuning and calibration + values. + More values can be created using the Host Tools. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiMacAddress address; + CsrUint16 mibFilesCount; + CsrWifiSmeDataBlock *mibFiles; +} CsrWifiSmeWifiOnReq; + +/******************************************************************************* + + NAME + CsrWifiSmeCloakedSsidsSetReq + + DESCRIPTION + This primitive sets the list of cloaked SSIDs for which the WMA possesses + profiles. + When the driver detects a cloaked AP, the SME will explicitly scan for it + using the list of cloaked SSIDs provided it, and, if the scan succeeds, + it will report the AP to the WMA either via CSR_WIFI_SME_SCAN_RESULT_IND + (if registered) or via CSR_WIFI_SCAN_RESULT_GET_CFM. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + cloakedSsids - Sets the list of cloaked SSIDs + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiSmeCloakedSsidConfig cloakedSsids; +} CsrWifiSmeCloakedSsidsSetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeCloakedSsidsGetReq + + DESCRIPTION + This primitive gets the value of the CloakedSsids parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; +} CsrWifiSmeCloakedSsidsGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeSmeCommonConfigGetReq + + DESCRIPTION + This primitive gets the value of the Sme common parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; +} CsrWifiSmeSmeCommonConfigGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeSmeCommonConfigSetReq + + DESCRIPTION + This primitive sets the value of the Sme common. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + deviceConfig - Configuration options in the SME + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiSmeDeviceConfig deviceConfig; +} CsrWifiSmeSmeCommonConfigSetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeInterfaceCapabilityGetReq + + DESCRIPTION + The Wireless Manager calls this primitive to ask the SME for the + capabilities of the supported interfaces + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; +} CsrWifiSmeInterfaceCapabilityGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeWpsConfigurationReq + + DESCRIPTION + This primitive passes the WPS information for the device to SME. This may + be accepted only if no interface is active. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + wpsConfig - WPS config. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiSmeWpsConfig wpsConfig; +} CsrWifiSmeWpsConfigurationReq; + +/******************************************************************************* + + NAME + CsrWifiSmeActivateCfm + + DESCRIPTION + The SME sends this primitive when the activation is complete. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiSmeActivateCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeAdhocConfigGetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + adHocConfig - Contains the values used when starting an Ad-hoc (IBSS) + connection. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; + CsrWifiSmeAdHocConfig adHocConfig; +} CsrWifiSmeAdhocConfigGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeAdhocConfigSetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiSmeAdhocConfigSetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeAssociationCompleteInd + + DESCRIPTION + The SME will send this primitive to all the tasks that have registered to + receive it whenever it completes an attempt to associate with an AP. If + the association was successful, status will be set to + CSR_WIFI_SME_STATUS_SUCCESS, otherwise status and deauthReason shall be + set to appropriate error codes. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the association procedure + connectionInfo - This parameter is relevant only if result is + CSR_WIFI_SME_STATUS_SUCCESS: + it points to the connection information for the new network + deauthReason - This parameter is relevant only if result is not + CSR_WIFI_SME_STATUS_SUCCESS: + if the AP deauthorised the station, it gives the reason of + the deauthorization + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; + CsrWifiSmeConnectionInfo connectionInfo; + CsrWifiSmeIEEE80211Reason deauthReason; +} CsrWifiSmeAssociationCompleteInd; + +/******************************************************************************* + + NAME + CsrWifiSmeAssociationStartInd + + DESCRIPTION + The SME will send this primitive to all the tasks that have registered to + receive it whenever it begins an attempt to associate with an AP. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + address - BSSID of the associating network + ssid - Service Set identifier of the associating network + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiMacAddress address; + CsrWifiSsid ssid; +} CsrWifiSmeAssociationStartInd; + +/******************************************************************************* + + NAME + CsrWifiSmeBlacklistCfm + + DESCRIPTION + The SME will call this primitive when the action on the blacklist has + completed. For a GET action, this primitive also reports the list of + BBSIDs in the blacklist. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + action - Action in the request + getAddressCount - This parameter is only relevant if action is + CSR_WIFI_SME_LIST_ACTION_GET: + number of BSSIDs sent with this primitive + getAddresses - Pointer to the list of BBSIDs sent with the primitive, set + to NULL if none is sent. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; + CsrWifiSmeListAction action; + CsrUint8 getAddressCount; + CsrWifiMacAddress *getAddresses; +} CsrWifiSmeBlacklistCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeCalibrationDataGetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + calibrationDataLength - Number of bytes in the buffer pointed by + calibrationData + calibrationData - Pointer to a buffer of length calibrationDataLength + containing the calibration data + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; + CsrUint16 calibrationDataLength; + CsrUint8 *calibrationData; +} CsrWifiSmeCalibrationDataGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeCalibrationDataSetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiSmeCalibrationDataSetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeCcxConfigGetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + ccxConfig - Currently not supported + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; + CsrWifiSmeCcxConfig ccxConfig; +} CsrWifiSmeCcxConfigGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeCcxConfigSetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; +} CsrWifiSmeCcxConfigSetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeCoexConfigGetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + coexConfig - Reports the parameters used to configure the coexistence + behaviour + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; + CsrWifiSmeCoexConfig coexConfig; +} CsrWifiSmeCoexConfigGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeCoexConfigSetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiSmeCoexConfigSetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeCoexInfoGetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + coexInfo - Reports information and state related to coexistence. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; + CsrWifiSmeCoexInfo coexInfo; +} CsrWifiSmeCoexInfoGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeConnectCfm + + DESCRIPTION + The SME calls this primitive when the connection exchange is complete or + all connection attempts fail. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request. + CSR_WIFI_SME_STATUS_NOT_FOUND: all attempts by the SME to + locate the requested AP failed + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; +} CsrWifiSmeConnectCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeConnectionConfigGetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + connectionConfig - Parameters used by the SME for selecting a network + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; + CsrWifiSmeConnectionConfig connectionConfig; +} CsrWifiSmeConnectionConfigGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeConnectionInfoGetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + connectionInfo - Information about the current connection + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; + CsrWifiSmeConnectionInfo connectionInfo; +} CsrWifiSmeConnectionInfoGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeConnectionQualityInd + + DESCRIPTION + The SME sends this primitive to all the tasks that have registered to + receive it whenever the value of the current connection quality + parameters change by more than a certain configurable amount. + The wireless manager application may configure the trigger thresholds for + this indication using the field in smeConfig parameter of + CSR_WIFI_SME_SME_CONFIG_SET_REQ. + Connection quality messages can be suppressed by setting both thresholds + to zero. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + linkQuality - Indicates the quality of the link + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeLinkQuality linkQuality; +} CsrWifiSmeConnectionQualityInd; + +/******************************************************************************* + + NAME + CsrWifiSmeConnectionStatsGetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + connectionStats - Statistics for current connection. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; + CsrWifiSmeConnectionStats connectionStats; +} CsrWifiSmeConnectionStatsGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeDeactivateCfm + + DESCRIPTION + The SME sends this primitive when the deactivation is complete. + The WMA cannot send any more primitives until it actives the SME again + sending another CSR_WIFI_SME_ACTIVATE_REQ. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiSmeDeactivateCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeDisconnectCfm + + DESCRIPTION + On reception of CSR_WIFI_SME_DISCONNECT_REQ the SME will perform a + disconnect operation, sending a CsrWifiSmeMediaStatusInd with + CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED and then call this primitive when + disconnection is complete. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; +} CsrWifiSmeDisconnectCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeEventMaskSetCfm + + DESCRIPTION + The SME calls the primitive to report the result of the request + primitive. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiSmeEventMaskSetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeHostConfigGetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + hostConfig - Current host power state. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; + CsrWifiSmeHostConfig hostConfig; +} CsrWifiSmeHostConfigGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeHostConfigSetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; +} CsrWifiSmeHostConfigSetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeIbssStationInd + + DESCRIPTION + The SME will send this primitive to indicate that a station has joined or + left the ad-hoc network. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + address - MAC address of the station that has joined or left + isconnected - TRUE if the station joined, FALSE if the station left + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiMacAddress address; + CsrBool isconnected; +} CsrWifiSmeIbssStationInd; + +/******************************************************************************* + + NAME + CsrWifiSmeKeyCfm + + DESCRIPTION + The SME calls the primitive to report the result of the request + primitive. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + action - Action in the request + keyType - Type of the key added/deleted + peerMacAddress - Peer MAC Address of the key added/deleted + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; + CsrWifiSmeListAction action; + CsrWifiSmeKeyType keyType; + CsrWifiMacAddress peerMacAddress; +} CsrWifiSmeKeyCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeLinkQualityGetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + linkQuality - Indicates the quality of the link + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; + CsrWifiSmeLinkQuality linkQuality; +} CsrWifiSmeLinkQualityGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeMediaStatusInd + + DESCRIPTION + The SME sends this primitive to all the tasks that have registered to + receive it when a network connection is established, lost or has moved to + another AP. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + mediaStatus - Indicates the media status + connectionInfo - This parameter is relevant only if the mediaStatus is + CSR_WIFI_SME_MEDIA_STATUS_CONNECTED: + it points to the connection information for the new network + disassocReason - This parameter is relevant only if the mediaStatus is + CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED: + if a disassociation has occurred it gives the reason of the + disassociation + deauthReason - This parameter is relevant only if the mediaStatus is + CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED: + if a deauthentication has occurred it gives the reason of + the deauthentication + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeMediaStatus mediaStatus; + CsrWifiSmeConnectionInfo connectionInfo; + CsrWifiSmeIEEE80211Reason disassocReason; + CsrWifiSmeIEEE80211Reason deauthReason; +} CsrWifiSmeMediaStatusInd; + +/******************************************************************************* + + NAME + CsrWifiSmeMibConfigGetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + mibConfig - Reports various IEEE 802.11 attributes as currently configured + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; + CsrWifiSmeMibConfig mibConfig; +} CsrWifiSmeMibConfigGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeMibConfigSetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiSmeMibConfigSetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeMibGetCfm + + DESCRIPTION + The SME calls this primitive to return the requested MIB variable values. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + mibAttributeLength - Length of mibAttribute + mibAttribute - Points to the VarBind or VarBindList containing the + names and values of the MIB variables requested + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; + CsrUint16 mibAttributeLength; + CsrUint8 *mibAttribute; +} CsrWifiSmeMibGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeMibGetNextCfm + + DESCRIPTION + The SME calls this primitive to return the requested MIB name(s). + The wireless manager application can then read the value of the MIB + variable using CSR_WIFI_SME_MIB_GET_REQ, using the names provided. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + mibAttributeLength - Length of mibAttribute + mibAttribute - Points to a VarBind or VarBindList containing the + name(s) of the MIB variable(s) lexicographically + following the name(s) given in the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; + CsrUint16 mibAttributeLength; + CsrUint8 *mibAttribute; +} CsrWifiSmeMibGetNextCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeMibSetCfm + + DESCRIPTION + The SME calls the primitive to report the result of the set primitive. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiSmeMibSetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeMicFailureInd + + DESCRIPTION + The SME sends this primitive to all the tasks that have registered to + receive it whenever the chip firmware reports a MIC failure. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + secondFailure - TRUE if this indication is for a second failure in 60 + seconds + count - The number of MIC failure events since the connection was + established + address - MAC address of the transmitter that caused the MIC failure + keyType - Type of key for which the failure occurred + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrBool secondFailure; + CsrUint16 count; + CsrWifiMacAddress address; + CsrWifiSmeKeyType keyType; +} CsrWifiSmeMicFailureInd; + +/******************************************************************************* + + NAME + CsrWifiSmeMulticastAddressCfm + + DESCRIPTION + The SME will call this primitive when the operation is complete. For a + GET action, this primitive reports the current list of MAC addresses. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + action - Action in the request + getAddressesCount - This parameter is only relevant if action is + CSR_WIFI_SME_LIST_ACTION_GET: + number of MAC addresses sent with the primitive + getAddresses - Pointer to the list of MAC Addresses sent with the + primitive, set to NULL if none is sent. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; + CsrWifiSmeListAction action; + CsrUint8 getAddressesCount; + CsrWifiMacAddress *getAddresses; +} CsrWifiSmeMulticastAddressCfm; + +/******************************************************************************* + + NAME + CsrWifiSmePacketFilterSetCfm + + DESCRIPTION + The SME calls the primitive to report the result of the set primitive. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; +} CsrWifiSmePacketFilterSetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmePermanentMacAddressGetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + permanentMacAddress - MAC address stored in the EEPROM + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; + CsrWifiMacAddress permanentMacAddress; +} CsrWifiSmePermanentMacAddressGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmePmkidCandidateListInd + + DESCRIPTION + The SME will send this primitive to all the tasks that have registered to + receive it when a new network supporting preauthentication and/or PMK + caching is seen. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an + interface + pmkidCandidatesCount - Number of PMKID candidates provided + pmkidCandidates - Points to the first PMKID candidate + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrUint8 pmkidCandidatesCount; + CsrWifiSmePmkidCandidate *pmkidCandidates; +} CsrWifiSmePmkidCandidateListInd; + +/******************************************************************************* + + NAME + CsrWifiSmePmkidCfm + + DESCRIPTION + The SME will call this primitive when the operation is complete. For a + GET action, this primitive reports the current list of PMKIDs + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + action - Action in the request + getPmkidsCount - This parameter is only relevant if action is + CSR_WIFI_SME_LIST_ACTION_GET: + number of PMKIDs sent with the primitive + getPmkids - Pointer to the list of PMKIDs sent with the primitive, set + to NULL if none is sent. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; + CsrWifiSmeListAction action; + CsrUint8 getPmkidsCount; + CsrWifiSmePmkid *getPmkids; +} CsrWifiSmePmkidCfm; + +/******************************************************************************* + + NAME + CsrWifiSmePowerConfigGetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + powerConfig - Returns the current parameters for the power configuration of + the firmware + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; + CsrWifiSmePowerConfig powerConfig; +} CsrWifiSmePowerConfigGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmePowerConfigSetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiSmePowerConfigSetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeRegulatoryDomainInfoGetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + regDomInfo - Reports information and state related to regulatory domain + operation. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; + CsrWifiSmeRegulatoryDomainInfo regDomInfo; +} CsrWifiSmeRegulatoryDomainInfoGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeRoamCompleteInd + + DESCRIPTION + The SME will send this primitive to all the tasks that have registered to + receive it whenever it completes an attempt to roam to an AP. If the roam + attempt was successful, status will be set to CSR_WIFI_SME_SUCCESS, + otherwise it shall be set to the appropriate error code. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the roaming procedure + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; +} CsrWifiSmeRoamCompleteInd; + +/******************************************************************************* + + NAME + CsrWifiSmeRoamStartInd + + DESCRIPTION + The SME will send this primitive to all the tasks that have registered to + receive it whenever it begins an attempt to roam to an AP. + If the wireless manager application connect request specified the SSID + and the BSSID was set to the broadcast address (0xFF 0xFF 0xFF 0xFF 0xFF + 0xFF), the SME monitors the signal quality and maintains a list of + candidates to roam to. When the signal quality of the current connection + falls below a threshold, and there is a candidate with better quality, + the SME will attempt to the candidate AP. + If the roaming procedure succeeds, the SME will also issue a Media + Connect indication to inform the wireless manager application of the + change. + NOTE: to prevent the SME from initiating roaming the WMA must specify the + BSSID in the connection request; this forces the SME to connect only to + that AP. + The wireless manager application can obtain statistics for roaming + purposes using CSR_WIFI_SME_CONNECTION_QUALITY_IND and + CSR_WIFI_SME_CONNECTION_STATS_GET_REQ. + When the wireless manager application wishes to roam to another AP, it + must issue a connection request specifying the BSSID of the desired AP. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + roamReason - Indicates the reason for starting the roaming procedure + reason80211 - Indicates the reason for deauthentication or disassociation + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeRoamReason roamReason; + CsrWifiSmeIEEE80211Reason reason80211; +} CsrWifiSmeRoamStartInd; + +/******************************************************************************* + + NAME + CsrWifiSmeRoamingConfigGetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + roamingConfig - Reports the roaming behaviour of the driver and firmware + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; + CsrWifiSmeRoamingConfig roamingConfig; +} CsrWifiSmeRoamingConfigGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeRoamingConfigSetCfm + + DESCRIPTION + This primitive sets the value of the RoamingConfig parameter. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; +} CsrWifiSmeRoamingConfigSetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeScanConfigGetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + scanConfig - Returns the current parameters for the autonomous scanning + behaviour of the firmware + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; + CsrWifiSmeScanConfig scanConfig; +} CsrWifiSmeScanConfigGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeScanConfigSetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiSmeScanConfigSetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeScanFullCfm + + DESCRIPTION + The SME calls this primitive when the results from the scan are + available. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiSmeScanFullCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeScanResultInd + + DESCRIPTION + The SME sends this primitive to all the tasks that have registered to + receive it whenever a scan indication is received from the firmware. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + result - Points to a buffer containing a scan result. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiSmeScanResult result; +} CsrWifiSmeScanResultInd; + +/******************************************************************************* + + NAME + CsrWifiSmeScanResultsFlushCfm + + DESCRIPTION + The SME will call this primitive when the cache has been cleared. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiSmeScanResultsFlushCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeScanResultsGetCfm + + DESCRIPTION + The SME sends this primitive to provide the current set of scan results. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + scanResultsCount - Number of scan results + scanResults - Points to a buffer containing an array of + CsrWifiSmeScanResult structures. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; + CsrUint16 scanResultsCount; + CsrWifiSmeScanResult *scanResults; +} CsrWifiSmeScanResultsGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeSmeStaConfigGetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + smeConfig - Current SME Station Parameters + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; + CsrWifiSmeStaConfig smeConfig; +} CsrWifiSmeSmeStaConfigGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeSmeStaConfigSetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; +} CsrWifiSmeSmeStaConfigSetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeStationMacAddressGetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + stationMacAddress - Current MAC address of the station. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; + CsrWifiMacAddress stationMacAddress[2]; +} CsrWifiSmeStationMacAddressGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeTspecInd + + DESCRIPTION + The SME will send this primitive to all the task that have registered to + receive it when a status change in the TSPEC occurs. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + transactionId - Unique Transaction ID for the TSPEC, as assigned by the + driver + tspecResultCode - Specifies the TSPEC operation requested by the peer + station + tspecLength - Length of the TSPEC. + tspec - Points to the first byte of the TSPEC + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrUint32 transactionId; + CsrWifiSmeTspecResultCode tspecResultCode; + CsrUint16 tspecLength; + CsrUint8 *tspec; +} CsrWifiSmeTspecInd; + +/******************************************************************************* + + NAME + CsrWifiSmeTspecCfm + + DESCRIPTION + The SME calls the primitive to report the result of the TSpec primitive + request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface Identifier; unique identifier of an interface + status - Reports the result of the request + transactionId - Unique Transaction ID for the TSPEC, as assigned by the + driver + tspecResultCode - Specifies the result of the negotiated TSPEC operation + tspecLength - Length of the TSPEC. + tspec - Points to the first byte of the TSPEC + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; + CsrUint32 transactionId; + CsrWifiSmeTspecResultCode tspecResultCode; + CsrUint16 tspecLength; + CsrUint8 *tspec; +} CsrWifiSmeTspecCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeVersionsGetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + versions - Version IDs of the product + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; + CsrWifiSmeVersions versions; +} CsrWifiSmeVersionsGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeWifiFlightmodeCfm + + DESCRIPTION + The SME calls this primitive when the chip is initialised for low power + mode and with the radio subsystem disabled. To leave flight mode, and + enable Wi-Fi, the wireless manager application should call + CSR_WIFI_SME_WIFI_ON_REQ. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiSmeWifiFlightmodeCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeWifiOffInd + + DESCRIPTION + The SME sends this primitive to all the tasks that have registered to + receive it to report that the chip has been turned off. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + reason - Indicates the reason why the Wi-Fi has been switched off. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiSmeControlIndication reason; +} CsrWifiSmeWifiOffInd; + +/******************************************************************************* + + NAME + CsrWifiSmeWifiOffCfm + + DESCRIPTION + After receiving CSR_WIFI_SME_WIFI_OFF_REQ, if the chip is connected to a + network, the SME will perform a disconnect operation, will send a + CSR_WIFI_SME_MEDIA_STATUS_IND with + CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED, and then will call + CSR_WIFI_SME_WIFI_OFF_CFM when the chip is off. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiSmeWifiOffCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeWifiOnCfm + + DESCRIPTION + The SME sends this primitive to the task that has sent the request once + the chip has been initialised and is available for use. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiSmeWifiOnCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeCloakedSsidsSetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiSmeCloakedSsidsSetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeCloakedSsidsGetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + cloakedSsids - Reports list of cloaked SSIDs that are explicitly scanned for + by the driver + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; + CsrWifiSmeCloakedSsidConfig cloakedSsids; +} CsrWifiSmeCloakedSsidsGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeWifiOnInd + + DESCRIPTION + The SME sends this primitive to all tasks that have registered to receive + it once the chip becomes available and ready to use. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + address - Current MAC address + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiMacAddress address; +} CsrWifiSmeWifiOnInd; + +/******************************************************************************* + + NAME + CsrWifiSmeSmeCommonConfigGetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + deviceConfig - Configuration options in the SME + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; + CsrWifiSmeDeviceConfig deviceConfig; +} CsrWifiSmeSmeCommonConfigGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeSmeCommonConfigSetCfm + + DESCRIPTION + Reports the result of the request + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Reports the result of the request + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiSmeSmeCommonConfigSetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeInterfaceCapabilityGetCfm + + DESCRIPTION + This primitive reports the result of the request. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Result of the request + numInterfaces - Number of the interfaces supported + capBitmap - Points to the list of capabilities bitmaps provided for each + interface. + The bits represent the following capabilities: + -bits 7 to 4-Reserved + -bit 3-AMP + -bit 2-P2P + -bit 1-AP + -bit 0-STA + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; + CsrUint16 numInterfaces; + CsrUint8 capBitmap[2]; +} CsrWifiSmeInterfaceCapabilityGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeErrorInd + + DESCRIPTION + Important error message indicating a error of some importance + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + errorMessage - Contains the error message. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrCharString *errorMessage; +} CsrWifiSmeErrorInd; + +/******************************************************************************* + + NAME + CsrWifiSmeInfoInd + + DESCRIPTION + Message indicating a some info about current activity. Mostly of interest + in testing but may be useful in the field. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + infoMessage - Contains the message. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrCharString *infoMessage; +} CsrWifiSmeInfoInd; + +/******************************************************************************* + + NAME + CsrWifiSmeCoreDumpInd + + DESCRIPTION + The SME will send this primitive to all the tasks that have registered to + receive Wi-Fi Chip core dump data. + The core dump data may be fragmented and sent using more than one + indication. + To indicate that all the data has been sent, the last indication contains + a 'length' of 0 and 'data' of NULL. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + dataLength - Number of bytes in the buffer pointed to by 'data' + data - Pointer to the buffer containing 'dataLength' bytes of core + dump data + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint32 dataLength; + CsrUint8 *data; +} CsrWifiSmeCoreDumpInd; + +/******************************************************************************* + + NAME + CsrWifiSmeAmpStatusChangeInd + + DESCRIPTION + Indication of change to AMP activity. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - Interface on which the AMP activity changed. + ampStatus - The new status of AMP activity.Range: {AMP_ACTIVE, + AMP_INACTIVE}. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeAmpStatus ampStatus; +} CsrWifiSmeAmpStatusChangeInd; + +/******************************************************************************* + + NAME + CsrWifiSmeWpsConfigurationCfm + + DESCRIPTION + Confirm. + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + status - Status of the request. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrResult status; +} CsrWifiSmeWpsConfigurationCfm; + + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_SME_PRIM_H__ */ + diff --git a/drivers/staging/csr/csr_wifi_sme_sef.c b/drivers/staging/csr/csr_wifi_sme_sef.c new file mode 100644 index 0000000..cf32254 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_sme_sef.c @@ -0,0 +1,85 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + Confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + + *****************************************************************************/ +#include "csr_wifi_sme_sef.h" + +const CsrWifiSmeStateHandlerType CsrWifiSmeUpstreamStateHandlers[CSR_WIFI_SME_PRIM_UPSTREAM_COUNT] = +{ + /* 0x8000 */ CsrWifiSmeActivateCfmHandler, + /* 0x8001 */ CsrWifiSmeAdhocConfigGetCfmHandler, + /* 0x8002 */ CsrWifiSmeAdhocConfigSetCfmHandler, + /* 0x8003 */ CsrWifiSmeAssociationCompleteIndHandler, + /* 0x8004 */ CsrWifiSmeAssociationStartIndHandler, + /* 0x8005 */ CsrWifiSmeBlacklistCfmHandler, + /* 0x8006 */ CsrWifiSmeCalibrationDataGetCfmHandler, + /* 0x8007 */ CsrWifiSmeCalibrationDataSetCfmHandler, + /* 0x8008 */ CsrWifiSmeCcxConfigGetCfmHandler, + /* 0x8009 */ CsrWifiSmeCcxConfigSetCfmHandler, + /* 0x800A */ CsrWifiSmeCoexConfigGetCfmHandler, + /* 0x800B */ CsrWifiSmeCoexConfigSetCfmHandler, + /* 0x800C */ CsrWifiSmeCoexInfoGetCfmHandler, + /* 0x800D */ CsrWifiSmeConnectCfmHandler, + /* 0x800E */ CsrWifiSmeConnectionConfigGetCfmHandler, + /* 0x800F */ CsrWifiSmeConnectionInfoGetCfmHandler, + /* 0x8010 */ CsrWifiSmeConnectionQualityIndHandler, + /* 0x8011 */ CsrWifiSmeConnectionStatsGetCfmHandler, + /* 0x8012 */ CsrWifiSmeDeactivateCfmHandler, + /* 0x8013 */ CsrWifiSmeDisconnectCfmHandler, + /* 0x8014 */ CsrWifiSmeEventMaskSetCfmHandler, + /* 0x8015 */ CsrWifiSmeHostConfigGetCfmHandler, + /* 0x8016 */ CsrWifiSmeHostConfigSetCfmHandler, + /* 0x8017 */ CsrWifiSmeIbssStationIndHandler, + /* 0x8018 */ CsrWifiSmeKeyCfmHandler, + /* 0x8019 */ CsrWifiSmeLinkQualityGetCfmHandler, + /* 0x801A */ CsrWifiSmeMediaStatusIndHandler, + /* 0x801B */ CsrWifiSmeMibConfigGetCfmHandler, + /* 0x801C */ CsrWifiSmeMibConfigSetCfmHandler, + /* 0x801D */ CsrWifiSmeMibGetCfmHandler, + /* 0x801E */ CsrWifiSmeMibGetNextCfmHandler, + /* 0x801F */ CsrWifiSmeMibSetCfmHandler, + /* 0x8020 */ CsrWifiSmeMicFailureIndHandler, + /* 0x8021 */ CsrWifiSmeMulticastAddressCfmHandler, + /* 0x8022 */ CsrWifiSmePacketFilterSetCfmHandler, + /* 0x8023 */ CsrWifiSmePermanentMacAddressGetCfmHandler, + /* 0x8024 */ CsrWifiSmePmkidCandidateListIndHandler, + /* 0x8025 */ CsrWifiSmePmkidCfmHandler, + /* 0x8026 */ CsrWifiSmePowerConfigGetCfmHandler, + /* 0x8027 */ CsrWifiSmePowerConfigSetCfmHandler, + /* 0x8028 */ CsrWifiSmeRegulatoryDomainInfoGetCfmHandler, + /* 0x8029 */ CsrWifiSmeRoamCompleteIndHandler, + /* 0x802A */ CsrWifiSmeRoamStartIndHandler, + /* 0x802B */ CsrWifiSmeRoamingConfigGetCfmHandler, + /* 0x802C */ CsrWifiSmeRoamingConfigSetCfmHandler, + /* 0x802D */ CsrWifiSmeScanConfigGetCfmHandler, + /* 0x802E */ CsrWifiSmeScanConfigSetCfmHandler, + /* 0x802F */ CsrWifiSmeScanFullCfmHandler, + /* 0x8030 */ CsrWifiSmeScanResultIndHandler, + /* 0x8031 */ CsrWifiSmeScanResultsFlushCfmHandler, + /* 0x8032 */ CsrWifiSmeScanResultsGetCfmHandler, + /* 0x8033 */ CsrWifiSmeSmeStaConfigGetCfmHandler, + /* 0x8034 */ CsrWifiSmeSmeStaConfigSetCfmHandler, + /* 0x8035 */ CsrWifiSmeStationMacAddressGetCfmHandler, + /* 0x8036 */ CsrWifiSmeTspecIndHandler, + /* 0x8037 */ CsrWifiSmeTspecCfmHandler, + /* 0x8038 */ CsrWifiSmeVersionsGetCfmHandler, + /* 0x8039 */ CsrWifiSmeWifiFlightmodeCfmHandler, + /* 0x803A */ CsrWifiSmeWifiOffIndHandler, + /* 0x803B */ CsrWifiSmeWifiOffCfmHandler, + /* 0x803C */ CsrWifiSmeWifiOnCfmHandler, + /* 0x803D */ CsrWifiSmeCloakedSsidsSetCfmHandler, + /* 0x803E */ CsrWifiSmeCloakedSsidsGetCfmHandler, + /* 0x803F */ CsrWifiSmeWifiOnIndHandler, + /* 0x8040 */ CsrWifiSmeSmeCommonConfigGetCfmHandler, + /* 0x8041 */ CsrWifiSmeSmeCommonConfigSetCfmHandler, + /* 0x8042 */ CsrWifiSmeGetInterfaceCapabilityCfmHandler, + /* 0x8043 */ CsrWifiSmeErrorIndHandler, + /* 0x8044 */ CsrWifiSmeInfoIndHandler, + /* 0x8045 */ CsrWifiSmeCoreDumpIndHandler, + /* 0x8046 */ CsrWifiSmeAmpStatusChangeIndHandler, +}; diff --git a/drivers/staging/csr/csr_wifi_sme_sef.h b/drivers/staging/csr/csr_wifi_sme_sef.h new file mode 100644 index 0000000..c874181 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_sme_sef.h @@ -0,0 +1,101 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2010 + Confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ +#ifndef CSR_WIFI_ROUTER_SEF_CSR_WIFI_SME_H__ +#define CSR_WIFI_ROUTER_SEF_CSR_WIFI_SME_H__ + +#include "csr_wifi_sme_prim.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*CsrWifiSmeStateHandlerType)(void* drvpriv, CsrWifiFsmEvent* msg); + +extern const CsrWifiSmeStateHandlerType CsrWifiSmeUpstreamStateHandlers[CSR_WIFI_SME_PRIM_UPSTREAM_COUNT]; + + +extern void CsrWifiSmeActivateCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeAdhocConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeAdhocConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeAssociationCompleteIndHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeAssociationStartIndHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeBlacklistCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeCalibrationDataGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeCalibrationDataSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeCcxConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeCcxConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeCoexConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeCoexConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeCoexInfoGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeConnectCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeConnectionConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeConnectionInfoGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeConnectionQualityIndHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeConnectionStatsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeDeactivateCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeDisconnectCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeEventMaskSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeHostConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeHostConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeIbssStationIndHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeKeyCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeLinkQualityGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeMediaStatusIndHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeMibConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeMibConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeMibGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeMibGetNextCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeMibSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeMicFailureIndHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeMulticastAddressCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmePacketFilterSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmePermanentMacAddressGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmePmkidCandidateListIndHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmePmkidCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmePowerConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmePowerConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeRegulatoryDomainInfoGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeRoamCompleteIndHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeRoamStartIndHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeRoamingConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeRoamingConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeScanConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeScanConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeScanFullCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeScanResultIndHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeScanResultsFlushCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeScanResultsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeSmeStaConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeSmeStaConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeStationMacAddressGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeTspecIndHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeTspecCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeVersionsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeWifiFlightmodeCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeWifiOffIndHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeWifiOffCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeWifiOnCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeCloakedSsidsSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeCloakedSsidsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeWifiOnIndHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeSmeCommonConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeSmeCommonConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeGetInterfaceCapabilityCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeErrorIndHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeInfoIndHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeCoreDumpIndHandler(void* drvpriv, CsrWifiFsmEvent* msg); +extern void CsrWifiSmeAmpStatusChangeIndHandler(void* drvpriv, CsrWifiFsmEvent* msg); + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_ROUTER_SEF_CSR_WIFI_SME_H__ */ diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.c b/drivers/staging/csr/csr_wifi_sme_serialize.c new file mode 100644 index 0000000..489c378 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_sme_serialize.c @@ -0,0 +1,5756 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#include "csr_pmem.h" +#include "csr_msgconv.h" +#include "csr_unicode.h" + + +#include "csr_wifi_sme_prim.h" +#include "csr_wifi_sme_serialize.h" + +void CsrWifiSmePfree(void *ptr) +{ + CsrPmemFree(ptr); +} + + +CsrSize CsrWifiSmeAdhocConfigSetReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ + bufferSize += 2; /* CsrUint16 primitive->adHocConfig.atimWindowTu */ + bufferSize += 2; /* CsrUint16 primitive->adHocConfig.beaconPeriodTu */ + bufferSize += 2; /* CsrUint16 primitive->adHocConfig.joinOnlyAttempts */ + bufferSize += 2; /* CsrUint16 primitive->adHocConfig.joinAttemptIntervalMs */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeAdhocConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeAdhocConfigSetReq *primitive = (CsrWifiSmeAdhocConfigSetReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->adHocConfig.atimWindowTu); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->adHocConfig.beaconPeriodTu); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->adHocConfig.joinOnlyAttempts); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->adHocConfig.joinAttemptIntervalMs); + return(ptr); +} + + +void* CsrWifiSmeAdhocConfigSetReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeAdhocConfigSetReq *primitive = (CsrWifiSmeAdhocConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeAdhocConfigSetReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->adHocConfig.atimWindowTu, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->adHocConfig.beaconPeriodTu, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->adHocConfig.joinOnlyAttempts, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->adHocConfig.joinAttemptIntervalMs, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeBlacklistReqSizeof(void *msg) +{ + CsrWifiSmeBlacklistReq *primitive = (CsrWifiSmeBlacklistReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ + bufferSize += 1; /* CsrUint8 primitive->setAddressCount */ + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->setAddressCount; i1++) + { + bufferSize += 6; /* CsrUint8 primitive->setAddresses[i1].a[6] */ + } + } + return bufferSize; +} + + +CsrUint8* CsrWifiSmeBlacklistReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeBlacklistReq *primitive = (CsrWifiSmeBlacklistReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->action); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->setAddressCount); + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->setAddressCount; i1++) + { + CsrMemCpySer(ptr, len, (const void *) primitive->setAddresses[i1].a, ((CsrUint16) (6))); + } + } + return(ptr); +} + + +void* CsrWifiSmeBlacklistReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeBlacklistReq *primitive = (CsrWifiSmeBlacklistReq *) CsrPmemAlloc(sizeof(CsrWifiSmeBlacklistReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->action, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->setAddressCount, buffer, &offset); + primitive->setAddresses = NULL; + if (primitive->setAddressCount) + { + primitive->setAddresses = (CsrWifiMacAddress *)CsrPmemAlloc(sizeof(CsrWifiMacAddress) * primitive->setAddressCount); + } + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->setAddressCount; i1++) + { + CsrMemCpyDes(primitive->setAddresses[i1].a, buffer, &offset, ((CsrUint16) (6))); + } + } + + return primitive; +} + + +void CsrWifiSmeBlacklistReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeBlacklistReq *primitive = (CsrWifiSmeBlacklistReq *) voidPrimitivePointer; + CsrPmemFree(primitive->setAddresses); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeCalibrationDataSetReqSizeof(void *msg) +{ + CsrWifiSmeCalibrationDataSetReq *primitive = (CsrWifiSmeCalibrationDataSetReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */ + bufferSize += 2; /* CsrUint16 primitive->calibrationDataLength */ + bufferSize += primitive->calibrationDataLength; /* CsrUint8 primitive->calibrationData */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeCalibrationDataSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeCalibrationDataSetReq *primitive = (CsrWifiSmeCalibrationDataSetReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->calibrationDataLength); + if (primitive->calibrationDataLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->calibrationData, ((CsrUint16) (primitive->calibrationDataLength))); + } + return(ptr); +} + + +void* CsrWifiSmeCalibrationDataSetReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeCalibrationDataSetReq *primitive = (CsrWifiSmeCalibrationDataSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCalibrationDataSetReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->calibrationDataLength, buffer, &offset); + if (primitive->calibrationDataLength) + { + primitive->calibrationData = (CsrUint8 *)CsrPmemAlloc(primitive->calibrationDataLength); + CsrMemCpyDes(primitive->calibrationData, buffer, &offset, ((CsrUint16) (primitive->calibrationDataLength))); + } + else + { + primitive->calibrationData = NULL; + } + + return primitive; +} + + +void CsrWifiSmeCalibrationDataSetReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeCalibrationDataSetReq *primitive = (CsrWifiSmeCalibrationDataSetReq *) voidPrimitivePointer; + CsrPmemFree(primitive->calibrationData); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeCcxConfigSetReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 1; /* CsrUint8 primitive->ccxConfig.keepAliveTimeMs */ + bufferSize += 1; /* CsrBool primitive->ccxConfig.apRoamingEnabled */ + bufferSize += 1; /* CsrUint8 primitive->ccxConfig.measurementsMask */ + bufferSize += 1; /* CsrBool primitive->ccxConfig.ccxRadioMgtEnabled */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeCcxConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeCcxConfigSetReq *primitive = (CsrWifiSmeCcxConfigSetReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->ccxConfig.keepAliveTimeMs); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->ccxConfig.apRoamingEnabled); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->ccxConfig.measurementsMask); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->ccxConfig.ccxRadioMgtEnabled); + return(ptr); +} + + +void* CsrWifiSmeCcxConfigSetReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeCcxConfigSetReq *primitive = (CsrWifiSmeCcxConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCcxConfigSetReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->ccxConfig.keepAliveTimeMs, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->ccxConfig.apRoamingEnabled, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->ccxConfig.measurementsMask, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->ccxConfig.ccxRadioMgtEnabled, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeCoexConfigSetReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 29) */ + bufferSize += 1; /* CsrBool primitive->coexConfig.coexEnableSchemeManagement */ + bufferSize += 1; /* CsrBool primitive->coexConfig.coexPeriodicWakeHost */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexTrafficBurstyLatencyMs */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexTrafficContinuousLatencyMs */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexObexBlackoutDurationMs */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexObexBlackoutPeriodMs */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexA2dpBrBlackoutDurationMs */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexA2dpBrBlackoutPeriodMs */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexA2dpEdrBlackoutDurationMs */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexPagingBlackoutDurationMs */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexPagingBlackoutPeriodMs */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexInquiryBlackoutDurationMs */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexInquiryBlackoutPeriodMs */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeCoexConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeCoexConfigSetReq *primitive = (CsrWifiSmeCoexConfigSetReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->coexConfig.coexEnableSchemeManagement); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->coexConfig.coexPeriodicWakeHost); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexTrafficBurstyLatencyMs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexTrafficContinuousLatencyMs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexObexBlackoutDurationMs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexObexBlackoutPeriodMs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexA2dpBrBlackoutDurationMs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexA2dpBrBlackoutPeriodMs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexA2dpEdrBlackoutDurationMs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexPagingBlackoutDurationMs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexPagingBlackoutPeriodMs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexInquiryBlackoutDurationMs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexInquiryBlackoutPeriodMs); + return(ptr); +} + + +void* CsrWifiSmeCoexConfigSetReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeCoexConfigSetReq *primitive = (CsrWifiSmeCoexConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexConfigSetReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->coexConfig.coexEnableSchemeManagement, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->coexConfig.coexPeriodicWakeHost, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexTrafficBurstyLatencyMs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexTrafficContinuousLatencyMs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexObexBlackoutDurationMs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexObexBlackoutPeriodMs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexA2dpBrBlackoutDurationMs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexA2dpBrBlackoutPeriodMs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexA2dpEdrBlackoutDurationMs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexPagingBlackoutDurationMs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexPagingBlackoutPeriodMs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexInquiryBlackoutDurationMs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexInquiryBlackoutPeriodMs, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeConnectReqSizeof(void *msg) +{ + CsrWifiSmeConnectReq *primitive = (CsrWifiSmeConnectReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 57) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 32; /* CsrUint8 primitive->connectionConfig.ssid.ssid[32] */ + bufferSize += 1; /* CsrUint8 primitive->connectionConfig.ssid.length */ + bufferSize += 6; /* CsrUint8 primitive->connectionConfig.bssid.a[6] */ + bufferSize += 1; /* CsrWifiSmeBssType primitive->connectionConfig.bssType */ + bufferSize += 1; /* CsrWifiSmeRadioIF primitive->connectionConfig.ifIndex */ + bufferSize += 1; /* CsrWifiSme80211PrivacyMode primitive->connectionConfig.privacyMode */ + bufferSize += 2; /* CsrWifiSmeAuthModeMask primitive->connectionConfig.authModeMask */ + bufferSize += 2; /* CsrWifiSmeEncryptionMask primitive->connectionConfig.encryptionModeMask */ + bufferSize += 2; /* CsrUint16 primitive->connectionConfig.mlmeAssociateReqInformationElementsLength */ + bufferSize += primitive->connectionConfig.mlmeAssociateReqInformationElementsLength; /* CsrUint8 primitive->connectionConfig.mlmeAssociateReqInformationElements */ + bufferSize += 1; /* CsrWifiSmeWmmQosInfoMask primitive->connectionConfig.wmmQosInfo */ + bufferSize += 1; /* CsrBool primitive->connectionConfig.adhocJoinOnly */ + bufferSize += 1; /* CsrUint8 primitive->connectionConfig.adhocChannel */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeConnectReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeConnectReq *primitive = (CsrWifiSmeConnectReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.ssid.ssid, ((CsrUint16) (32))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.ssid.length); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.bssid.a, ((CsrUint16) (6))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.bssType); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.ifIndex); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.privacyMode); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionConfig.authModeMask); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionConfig.encryptionModeMask); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionConfig.mlmeAssociateReqInformationElementsLength); + if (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.mlmeAssociateReqInformationElements, ((CsrUint16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength))); + } + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.wmmQosInfo); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.adhocJoinOnly); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.adhocChannel); + return(ptr); +} + + +void* CsrWifiSmeConnectReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeConnectReq *primitive = (CsrWifiSmeConnectReq *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrMemCpyDes(primitive->connectionConfig.ssid.ssid, buffer, &offset, ((CsrUint16) (32))); + CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.ssid.length, buffer, &offset); + CsrMemCpyDes(primitive->connectionConfig.bssid.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.bssType, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.ifIndex, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.privacyMode, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionConfig.authModeMask, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionConfig.encryptionModeMask, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionConfig.mlmeAssociateReqInformationElementsLength, buffer, &offset); + if (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength) + { + primitive->connectionConfig.mlmeAssociateReqInformationElements = (CsrUint8 *)CsrPmemAlloc(primitive->connectionConfig.mlmeAssociateReqInformationElementsLength); + CsrMemCpyDes(primitive->connectionConfig.mlmeAssociateReqInformationElements, buffer, &offset, ((CsrUint16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength))); + } + else + { + primitive->connectionConfig.mlmeAssociateReqInformationElements = NULL; + } + CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.wmmQosInfo, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.adhocJoinOnly, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.adhocChannel, buffer, &offset); + + return primitive; +} + + +void CsrWifiSmeConnectReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeConnectReq *primitive = (CsrWifiSmeConnectReq *) voidPrimitivePointer; + CsrPmemFree(primitive->connectionConfig.mlmeAssociateReqInformationElements); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeHostConfigSetReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 1; /* CsrWifiSmeHostPowerMode primitive->hostConfig.powerMode */ + bufferSize += 2; /* CsrUint16 primitive->hostConfig.applicationDataPeriodMs */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeHostConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeHostConfigSetReq *primitive = (CsrWifiSmeHostConfigSetReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->hostConfig.powerMode); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->hostConfig.applicationDataPeriodMs); + return(ptr); +} + + +void* CsrWifiSmeHostConfigSetReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeHostConfigSetReq *primitive = (CsrWifiSmeHostConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeHostConfigSetReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->hostConfig.powerMode, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->hostConfig.applicationDataPeriodMs, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeKeyReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 65) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ + bufferSize += 1; /* CsrWifiSmeKeyType primitive->key.keyType */ + bufferSize += 1; /* CsrUint8 primitive->key.keyIndex */ + bufferSize += 1; /* CsrBool primitive->key.wepTxKey */ + { + CsrUint16 i2; + for (i2 = 0; i2 < 8; i2++) + { + bufferSize += 2; /* CsrUint16 primitive->key.keyRsc[8] */ + } + } + bufferSize += 1; /* CsrBool primitive->key.authenticator */ + bufferSize += 6; /* CsrUint8 primitive->key.address.a[6] */ + bufferSize += 1; /* CsrUint8 primitive->key.keyLength */ + bufferSize += 32; /* CsrUint8 primitive->key.key[32] */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeKeyReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeKeyReq *primitive = (CsrWifiSmeKeyReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->action); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->key.keyType); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->key.keyIndex); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->key.wepTxKey); + { + CsrUint16 i2; + for (i2 = 0; i2 < 8; i2++) + { + CsrUint16Ser(ptr, len, (CsrUint16) primitive->key.keyRsc[i2]); + } + } + CsrUint8Ser(ptr, len, (CsrUint8) primitive->key.authenticator); + CsrMemCpySer(ptr, len, (const void *) primitive->key.address.a, ((CsrUint16) (6))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->key.keyLength); + CsrMemCpySer(ptr, len, (const void *) primitive->key.key, ((CsrUint16) (32))); + return(ptr); +} + + +void* CsrWifiSmeKeyReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeKeyReq *primitive = (CsrWifiSmeKeyReq *) CsrPmemAlloc(sizeof(CsrWifiSmeKeyReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->action, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->key.keyType, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->key.keyIndex, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->key.wepTxKey, buffer, &offset); + { + CsrUint16 i2; + for (i2 = 0; i2 < 8; i2++) + { + CsrUint16Des((CsrUint16 *) &primitive->key.keyRsc[i2], buffer, &offset); + } + } + CsrUint8Des((CsrUint8 *) &primitive->key.authenticator, buffer, &offset); + CsrMemCpyDes(primitive->key.address.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint8Des((CsrUint8 *) &primitive->key.keyLength, buffer, &offset); + CsrMemCpyDes(primitive->key.key, buffer, &offset, ((CsrUint16) (32))); + + return primitive; +} + + +CsrSize CsrWifiSmeMibConfigSetReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ + bufferSize += 1; /* CsrBool primitive->mibConfig.unifiFixMaxTxDataRate */ + bufferSize += 1; /* CsrUint8 primitive->mibConfig.unifiFixTxDataRate */ + bufferSize += 2; /* CsrUint16 primitive->mibConfig.dot11RtsThreshold */ + bufferSize += 2; /* CsrUint16 primitive->mibConfig.dot11FragmentationThreshold */ + bufferSize += 2; /* CsrUint16 primitive->mibConfig.dot11CurrentTxPowerLevel */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeMibConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeMibConfigSetReq *primitive = (CsrWifiSmeMibConfigSetReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->mibConfig.unifiFixMaxTxDataRate); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->mibConfig.unifiFixTxDataRate); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibConfig.dot11RtsThreshold); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibConfig.dot11FragmentationThreshold); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibConfig.dot11CurrentTxPowerLevel); + return(ptr); +} + + +void* CsrWifiSmeMibConfigSetReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeMibConfigSetReq *primitive = (CsrWifiSmeMibConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibConfigSetReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->mibConfig.unifiFixMaxTxDataRate, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->mibConfig.unifiFixTxDataRate, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->mibConfig.dot11RtsThreshold, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->mibConfig.dot11FragmentationThreshold, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->mibConfig.dot11CurrentTxPowerLevel, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeMibGetNextReqSizeof(void *msg) +{ + CsrWifiSmeMibGetNextReq *primitive = (CsrWifiSmeMibGetNextReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */ + bufferSize += 2; /* CsrUint16 primitive->mibAttributeLength */ + bufferSize += primitive->mibAttributeLength; /* CsrUint8 primitive->mibAttribute */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeMibGetNextReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeMibGetNextReq *primitive = (CsrWifiSmeMibGetNextReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibAttributeLength); + if (primitive->mibAttributeLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((CsrUint16) (primitive->mibAttributeLength))); + } + return(ptr); +} + + +void* CsrWifiSmeMibGetNextReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeMibGetNextReq *primitive = (CsrWifiSmeMibGetNextReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetNextReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->mibAttributeLength, buffer, &offset); + if (primitive->mibAttributeLength) + { + primitive->mibAttribute = (CsrUint8 *)CsrPmemAlloc(primitive->mibAttributeLength); + CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((CsrUint16) (primitive->mibAttributeLength))); + } + else + { + primitive->mibAttribute = NULL; + } + + return primitive; +} + + +void CsrWifiSmeMibGetNextReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeMibGetNextReq *primitive = (CsrWifiSmeMibGetNextReq *) voidPrimitivePointer; + CsrPmemFree(primitive->mibAttribute); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeMibGetReqSizeof(void *msg) +{ + CsrWifiSmeMibGetReq *primitive = (CsrWifiSmeMibGetReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */ + bufferSize += 2; /* CsrUint16 primitive->mibAttributeLength */ + bufferSize += primitive->mibAttributeLength; /* CsrUint8 primitive->mibAttribute */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeMibGetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeMibGetReq *primitive = (CsrWifiSmeMibGetReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibAttributeLength); + if (primitive->mibAttributeLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((CsrUint16) (primitive->mibAttributeLength))); + } + return(ptr); +} + + +void* CsrWifiSmeMibGetReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeMibGetReq *primitive = (CsrWifiSmeMibGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->mibAttributeLength, buffer, &offset); + if (primitive->mibAttributeLength) + { + primitive->mibAttribute = (CsrUint8 *)CsrPmemAlloc(primitive->mibAttributeLength); + CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((CsrUint16) (primitive->mibAttributeLength))); + } + else + { + primitive->mibAttribute = NULL; + } + + return primitive; +} + + +void CsrWifiSmeMibGetReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeMibGetReq *primitive = (CsrWifiSmeMibGetReq *) voidPrimitivePointer; + CsrPmemFree(primitive->mibAttribute); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeMibSetReqSizeof(void *msg) +{ + CsrWifiSmeMibSetReq *primitive = (CsrWifiSmeMibSetReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */ + bufferSize += 2; /* CsrUint16 primitive->mibAttributeLength */ + bufferSize += primitive->mibAttributeLength; /* CsrUint8 primitive->mibAttribute */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeMibSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeMibSetReq *primitive = (CsrWifiSmeMibSetReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibAttributeLength); + if (primitive->mibAttributeLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((CsrUint16) (primitive->mibAttributeLength))); + } + return(ptr); +} + + +void* CsrWifiSmeMibSetReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeMibSetReq *primitive = (CsrWifiSmeMibSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibSetReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->mibAttributeLength, buffer, &offset); + if (primitive->mibAttributeLength) + { + primitive->mibAttribute = (CsrUint8 *)CsrPmemAlloc(primitive->mibAttributeLength); + CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((CsrUint16) (primitive->mibAttributeLength))); + } + else + { + primitive->mibAttribute = NULL; + } + + return primitive; +} + + +void CsrWifiSmeMibSetReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeMibSetReq *primitive = (CsrWifiSmeMibSetReq *) voidPrimitivePointer; + CsrPmemFree(primitive->mibAttribute); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeMulticastAddressReqSizeof(void *msg) +{ + CsrWifiSmeMulticastAddressReq *primitive = (CsrWifiSmeMulticastAddressReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ + bufferSize += 1; /* CsrUint8 primitive->setAddressesCount */ + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->setAddressesCount; i1++) + { + bufferSize += 6; /* CsrUint8 primitive->setAddresses[i1].a[6] */ + } + } + return bufferSize; +} + + +CsrUint8* CsrWifiSmeMulticastAddressReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeMulticastAddressReq *primitive = (CsrWifiSmeMulticastAddressReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->action); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->setAddressesCount); + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->setAddressesCount; i1++) + { + CsrMemCpySer(ptr, len, (const void *) primitive->setAddresses[i1].a, ((CsrUint16) (6))); + } + } + return(ptr); +} + + +void* CsrWifiSmeMulticastAddressReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeMulticastAddressReq *primitive = (CsrWifiSmeMulticastAddressReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMulticastAddressReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->action, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->setAddressesCount, buffer, &offset); + primitive->setAddresses = NULL; + if (primitive->setAddressesCount) + { + primitive->setAddresses = (CsrWifiMacAddress *)CsrPmemAlloc(sizeof(CsrWifiMacAddress) * primitive->setAddressesCount); + } + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->setAddressesCount; i1++) + { + CsrMemCpyDes(primitive->setAddresses[i1].a, buffer, &offset, ((CsrUint16) (6))); + } + } + + return primitive; +} + + +void CsrWifiSmeMulticastAddressReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeMulticastAddressReq *primitive = (CsrWifiSmeMulticastAddressReq *) voidPrimitivePointer; + CsrPmemFree(primitive->setAddresses); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmePacketFilterSetReqSizeof(void *msg) +{ + CsrWifiSmePacketFilterSetReq *primitive = (CsrWifiSmePacketFilterSetReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrUint16 primitive->filterLength */ + bufferSize += primitive->filterLength; /* CsrUint8 primitive->filter */ + bufferSize += 1; /* CsrWifiSmePacketFilterMode primitive->mode */ + bufferSize += 4; /* CsrUint8 primitive->arpFilterAddress.a[4] */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmePacketFilterSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmePacketFilterSetReq *primitive = (CsrWifiSmePacketFilterSetReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->filterLength); + if (primitive->filterLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->filter, ((CsrUint16) (primitive->filterLength))); + } + CsrUint8Ser(ptr, len, (CsrUint8) primitive->mode); + CsrMemCpySer(ptr, len, (const void *) primitive->arpFilterAddress.a, ((CsrUint16) (4))); + return(ptr); +} + + +void* CsrWifiSmePacketFilterSetReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmePacketFilterSetReq *primitive = (CsrWifiSmePacketFilterSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmePacketFilterSetReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->filterLength, buffer, &offset); + if (primitive->filterLength) + { + primitive->filter = (CsrUint8 *)CsrPmemAlloc(primitive->filterLength); + CsrMemCpyDes(primitive->filter, buffer, &offset, ((CsrUint16) (primitive->filterLength))); + } + else + { + primitive->filter = NULL; + } + CsrUint8Des((CsrUint8 *) &primitive->mode, buffer, &offset); + CsrMemCpyDes(primitive->arpFilterAddress.a, buffer, &offset, ((CsrUint16) (4))); + + return primitive; +} + + +void CsrWifiSmePacketFilterSetReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmePacketFilterSetReq *primitive = (CsrWifiSmePacketFilterSetReq *) voidPrimitivePointer; + CsrPmemFree(primitive->filter); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmePmkidReqSizeof(void *msg) +{ + CsrWifiSmePmkidReq *primitive = (CsrWifiSmePmkidReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 29) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ + bufferSize += 1; /* CsrUint8 primitive->setPmkidsCount */ + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->setPmkidsCount; i1++) + { + bufferSize += 6; /* CsrUint8 primitive->setPmkids[i1].bssid.a[6] */ + bufferSize += 16; /* CsrUint8 primitive->setPmkids[i1].pmkid[16] */ + } + } + return bufferSize; +} + + +CsrUint8* CsrWifiSmePmkidReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmePmkidReq *primitive = (CsrWifiSmePmkidReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->action); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->setPmkidsCount); + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->setPmkidsCount; i1++) + { + CsrMemCpySer(ptr, len, (const void *) primitive->setPmkids[i1].bssid.a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->setPmkids[i1].pmkid, ((CsrUint16) (16))); + } + } + return(ptr); +} + + +void* CsrWifiSmePmkidReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmePmkidReq *primitive = (CsrWifiSmePmkidReq *) CsrPmemAlloc(sizeof(CsrWifiSmePmkidReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->action, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->setPmkidsCount, buffer, &offset); + primitive->setPmkids = NULL; + if (primitive->setPmkidsCount) + { + primitive->setPmkids = (CsrWifiSmePmkid *)CsrPmemAlloc(sizeof(CsrWifiSmePmkid) * primitive->setPmkidsCount); + } + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->setPmkidsCount; i1++) + { + CsrMemCpyDes(primitive->setPmkids[i1].bssid.a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->setPmkids[i1].pmkid, buffer, &offset, ((CsrUint16) (16))); + } + } + + return primitive; +} + + +void CsrWifiSmePmkidReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmePmkidReq *primitive = (CsrWifiSmePmkidReq *) voidPrimitivePointer; + CsrPmemFree(primitive->setPmkids); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmePowerConfigSetReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ + bufferSize += 1; /* CsrWifiSmePowerSaveLevel primitive->powerConfig.powerSaveLevel */ + bufferSize += 2; /* CsrUint16 primitive->powerConfig.listenIntervalTu */ + bufferSize += 1; /* CsrBool primitive->powerConfig.rxDtims */ + bufferSize += 1; /* CsrWifiSmeD3AutoScanMode primitive->powerConfig.d3AutoScanMode */ + bufferSize += 1; /* CsrUint8 primitive->powerConfig.clientTrafficWindow */ + bufferSize += 1; /* CsrBool primitive->powerConfig.opportunisticPowerSave */ + bufferSize += 1; /* CsrBool primitive->powerConfig.noticeOfAbsence */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmePowerConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmePowerConfigSetReq *primitive = (CsrWifiSmePowerConfigSetReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.powerSaveLevel); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->powerConfig.listenIntervalTu); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.rxDtims); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.d3AutoScanMode); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.clientTrafficWindow); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.opportunisticPowerSave); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.noticeOfAbsence); + return(ptr); +} + + +void* CsrWifiSmePowerConfigSetReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmePowerConfigSetReq *primitive = (CsrWifiSmePowerConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmePowerConfigSetReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->powerConfig.powerSaveLevel, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->powerConfig.listenIntervalTu, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->powerConfig.rxDtims, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->powerConfig.d3AutoScanMode, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->powerConfig.clientTrafficWindow, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->powerConfig.opportunisticPowerSave, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->powerConfig.noticeOfAbsence, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeRoamingConfigSetReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 70) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + { + CsrUint16 i2; + for (i2 = 0; i2 < 3; i2++) + { + bufferSize += 2; /* CsrInt16 primitive->roamingConfig.roamingBands[i2].rssiHighThreshold */ + bufferSize += 2; /* CsrInt16 primitive->roamingConfig.roamingBands[i2].rssiLowThreshold */ + bufferSize += 2; /* CsrInt16 primitive->roamingConfig.roamingBands[i2].snrHighThreshold */ + bufferSize += 2; /* CsrInt16 primitive->roamingConfig.roamingBands[i2].snrLowThreshold */ + } + } + bufferSize += 1; /* CsrBool primitive->roamingConfig.disableSmoothRoaming */ + bufferSize += 1; /* CsrBool primitive->roamingConfig.disableRoamScans */ + bufferSize += 1; /* CsrUint8 primitive->roamingConfig.reconnectLimit */ + bufferSize += 2; /* CsrUint16 primitive->roamingConfig.reconnectLimitIntervalMs */ + { + CsrUint16 i2; + for (i2 = 0; i2 < 3; i2++) + { + bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].intervalSeconds */ + bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].validitySeconds */ + bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu */ + bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu */ + bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu */ + bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu */ + } + } + return bufferSize; +} + + +CsrUint8* CsrWifiSmeRoamingConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeRoamingConfigSetReq *primitive = (CsrWifiSmeRoamingConfigSetReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + { + CsrUint16 i2; + for (i2 = 0; i2 < 3; i2++) + { + CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamingBands[i2].rssiHighThreshold); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamingBands[i2].rssiLowThreshold); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamingBands[i2].snrHighThreshold); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamingBands[i2].snrLowThreshold); + } + } + CsrUint8Ser(ptr, len, (CsrUint8) primitive->roamingConfig.disableSmoothRoaming); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->roamingConfig.disableRoamScans); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->roamingConfig.reconnectLimit); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.reconnectLimitIntervalMs); + { + CsrUint16 i2; + for (i2 = 0; i2 < 3; i2++) + { + CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].intervalSeconds); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].validitySeconds); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu); + } + } + return(ptr); +} + + +void* CsrWifiSmeRoamingConfigSetReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeRoamingConfigSetReq *primitive = (CsrWifiSmeRoamingConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamingConfigSetReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + { + CsrUint16 i2; + for (i2 = 0; i2 < 3; i2++) + { + CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamingBands[i2].rssiHighThreshold, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamingBands[i2].rssiLowThreshold, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamingBands[i2].snrHighThreshold, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamingBands[i2].snrLowThreshold, buffer, &offset); + } + } + CsrUint8Des((CsrUint8 *) &primitive->roamingConfig.disableSmoothRoaming, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->roamingConfig.disableRoamScans, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->roamingConfig.reconnectLimit, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.reconnectLimitIntervalMs, buffer, &offset); + { + CsrUint16 i2; + for (i2 = 0; i2 < 3; i2++) + { + CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].intervalSeconds, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].validitySeconds, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu, buffer, &offset); + } + } + + return primitive; +} + + +CsrSize CsrWifiSmeScanConfigSetReqSizeof(void *msg) +{ + CsrWifiSmeScanConfigSetReq *primitive = (CsrWifiSmeScanConfigSetReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 63) */ + { + CsrUint16 i2; + for (i2 = 0; i2 < 4; i2++) + { + bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].intervalSeconds */ + bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].validitySeconds */ + bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu */ + bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu */ + bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu */ + bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu */ + } + } + bufferSize += 1; /* CsrBool primitive->scanConfig.disableAutonomousScans */ + bufferSize += 2; /* CsrUint16 primitive->scanConfig.maxResults */ + bufferSize += 1; /* CsrInt8 primitive->scanConfig.highRssiThreshold */ + bufferSize += 1; /* CsrInt8 primitive->scanConfig.lowRssiThreshold */ + bufferSize += 1; /* CsrInt8 primitive->scanConfig.deltaRssiThreshold */ + bufferSize += 1; /* CsrInt8 primitive->scanConfig.highSnrThreshold */ + bufferSize += 1; /* CsrInt8 primitive->scanConfig.lowSnrThreshold */ + bufferSize += 1; /* CsrInt8 primitive->scanConfig.deltaSnrThreshold */ + bufferSize += 2; /* CsrUint16 primitive->scanConfig.passiveChannelListCount */ + bufferSize += primitive->scanConfig.passiveChannelListCount; /* CsrUint8 primitive->scanConfig.passiveChannelList */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeScanConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeScanConfigSetReq *primitive = (CsrWifiSmeScanConfigSetReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + { + CsrUint16 i2; + for (i2 = 0; i2 < 4; i2++) + { + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].intervalSeconds); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].validitySeconds); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu); + } + } + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.disableAutonomousScans); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.maxResults); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.highRssiThreshold); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.lowRssiThreshold); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.deltaRssiThreshold); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.highSnrThreshold); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.lowSnrThreshold); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.deltaSnrThreshold); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.passiveChannelListCount); + if (primitive->scanConfig.passiveChannelListCount) + { + CsrMemCpySer(ptr, len, (const void *) primitive->scanConfig.passiveChannelList, ((CsrUint16) (primitive->scanConfig.passiveChannelListCount))); + } + return(ptr); +} + + +void* CsrWifiSmeScanConfigSetReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeScanConfigSetReq *primitive = (CsrWifiSmeScanConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeScanConfigSetReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + { + CsrUint16 i2; + for (i2 = 0; i2 < 4; i2++) + { + CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].intervalSeconds, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].validitySeconds, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu, buffer, &offset); + } + } + CsrUint8Des((CsrUint8 *) &primitive->scanConfig.disableAutonomousScans, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->scanConfig.maxResults, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->scanConfig.highRssiThreshold, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->scanConfig.lowRssiThreshold, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->scanConfig.deltaRssiThreshold, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->scanConfig.highSnrThreshold, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->scanConfig.lowSnrThreshold, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->scanConfig.deltaSnrThreshold, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->scanConfig.passiveChannelListCount, buffer, &offset); + if (primitive->scanConfig.passiveChannelListCount) + { + primitive->scanConfig.passiveChannelList = (CsrUint8 *)CsrPmemAlloc(primitive->scanConfig.passiveChannelListCount); + CsrMemCpyDes(primitive->scanConfig.passiveChannelList, buffer, &offset, ((CsrUint16) (primitive->scanConfig.passiveChannelListCount))); + } + else + { + primitive->scanConfig.passiveChannelList = NULL; + } + + return primitive; +} + + +void CsrWifiSmeScanConfigSetReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeScanConfigSetReq *primitive = (CsrWifiSmeScanConfigSetReq *) voidPrimitivePointer; + CsrPmemFree(primitive->scanConfig.passiveChannelList); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeScanFullReqSizeof(void *msg) +{ + CsrWifiSmeScanFullReq *primitive = (CsrWifiSmeScanFullReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 52) */ + bufferSize += 1; /* CsrUint8 primitive->ssidCount */ + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->ssidCount; i1++) + { + bufferSize += 32; /* CsrUint8 primitive->ssid[i1].ssid[32] */ + bufferSize += 1; /* CsrUint8 primitive->ssid[i1].length */ + } + } + bufferSize += 6; /* CsrUint8 primitive->bssid.a[6] */ + bufferSize += 1; /* CsrBool primitive->forceScan */ + bufferSize += 1; /* CsrWifiSmeBssType primitive->bssType */ + bufferSize += 1; /* CsrWifiSmeScanType primitive->scanType */ + bufferSize += 2; /* CsrUint16 primitive->channelListCount */ + bufferSize += primitive->channelListCount; /* CsrUint8 primitive->channelList */ + bufferSize += 2; /* CsrUint16 primitive->probeIeLength */ + bufferSize += primitive->probeIeLength; /* CsrUint8 primitive->probeIe */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeScanFullReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeScanFullReq *primitive = (CsrWifiSmeScanFullReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->ssidCount); + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->ssidCount; i1++) + { + CsrMemCpySer(ptr, len, (const void *) primitive->ssid[i1].ssid, ((CsrUint16) (32))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->ssid[i1].length); + } + } + CsrMemCpySer(ptr, len, (const void *) primitive->bssid.a, ((CsrUint16) (6))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->forceScan); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->bssType); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanType); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->channelListCount); + if (primitive->channelListCount) + { + CsrMemCpySer(ptr, len, (const void *) primitive->channelList, ((CsrUint16) (primitive->channelListCount))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->probeIeLength); + if (primitive->probeIeLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->probeIe, ((CsrUint16) (primitive->probeIeLength))); + } + return(ptr); +} + + +void* CsrWifiSmeScanFullReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeScanFullReq *primitive = (CsrWifiSmeScanFullReq *) CsrPmemAlloc(sizeof(CsrWifiSmeScanFullReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->ssidCount, buffer, &offset); + primitive->ssid = NULL; + if (primitive->ssidCount) + { + primitive->ssid = (CsrWifiSsid *)CsrPmemAlloc(sizeof(CsrWifiSsid) * primitive->ssidCount); + } + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->ssidCount; i1++) + { + CsrMemCpyDes(primitive->ssid[i1].ssid, buffer, &offset, ((CsrUint16) (32))); + CsrUint8Des((CsrUint8 *) &primitive->ssid[i1].length, buffer, &offset); + } + } + CsrMemCpyDes(primitive->bssid.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint8Des((CsrUint8 *) &primitive->forceScan, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->bssType, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->scanType, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->channelListCount, buffer, &offset); + if (primitive->channelListCount) + { + primitive->channelList = (CsrUint8 *)CsrPmemAlloc(primitive->channelListCount); + CsrMemCpyDes(primitive->channelList, buffer, &offset, ((CsrUint16) (primitive->channelListCount))); + } + else + { + primitive->channelList = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->probeIeLength, buffer, &offset); + if (primitive->probeIeLength) + { + primitive->probeIe = (CsrUint8 *)CsrPmemAlloc(primitive->probeIeLength); + CsrMemCpyDes(primitive->probeIe, buffer, &offset, ((CsrUint16) (primitive->probeIeLength))); + } + else + { + primitive->probeIe = NULL; + } + + return primitive; +} + + +void CsrWifiSmeScanFullReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeScanFullReq *primitive = (CsrWifiSmeScanFullReq *) voidPrimitivePointer; + CsrPmemFree(primitive->ssid); + CsrPmemFree(primitive->channelList); + CsrPmemFree(primitive->probeIe); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeSmeStaConfigSetReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 1; /* CsrUint8 primitive->smeConfig.connectionQualityRssiChangeTrigger */ + bufferSize += 1; /* CsrUint8 primitive->smeConfig.connectionQualitySnrChangeTrigger */ + bufferSize += 1; /* CsrUint8 primitive->smeConfig.wmmModeMask */ + bufferSize += 1; /* CsrWifiSmeRadioIF primitive->smeConfig.ifIndex */ + bufferSize += 1; /* CsrBool primitive->smeConfig.allowUnicastUseGroupCipher */ + bufferSize += 1; /* CsrBool primitive->smeConfig.enableOpportunisticKeyCaching */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeSmeStaConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeSmeStaConfigSetReq *primitive = (CsrWifiSmeSmeStaConfigSetReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.connectionQualityRssiChangeTrigger); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.connectionQualitySnrChangeTrigger); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.wmmModeMask); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.ifIndex); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.allowUnicastUseGroupCipher); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.enableOpportunisticKeyCaching); + return(ptr); +} + + +void* CsrWifiSmeSmeStaConfigSetReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeSmeStaConfigSetReq *primitive = (CsrWifiSmeSmeStaConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeStaConfigSetReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->smeConfig.connectionQualityRssiChangeTrigger, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->smeConfig.connectionQualitySnrChangeTrigger, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->smeConfig.wmmModeMask, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->smeConfig.ifIndex, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->smeConfig.allowUnicastUseGroupCipher, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->smeConfig.enableOpportunisticKeyCaching, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeTspecReqSizeof(void *msg) +{ + CsrWifiSmeTspecReq *primitive = (CsrWifiSmeTspecReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 18) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ + bufferSize += 4; /* CsrUint32 primitive->transactionId */ + bufferSize += 1; /* CsrBool primitive->strict */ + bufferSize += 1; /* CsrWifiSmeTspecCtrlMask primitive->ctrlMask */ + bufferSize += 2; /* CsrUint16 primitive->tspecLength */ + bufferSize += primitive->tspecLength; /* CsrUint8 primitive->tspec */ + bufferSize += 2; /* CsrUint16 primitive->tclasLength */ + bufferSize += primitive->tclasLength; /* CsrUint8 primitive->tclas */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeTspecReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeTspecReq *primitive = (CsrWifiSmeTspecReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->action); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->transactionId); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->strict); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->ctrlMask); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->tspecLength); + if (primitive->tspecLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->tspec, ((CsrUint16) (primitive->tspecLength))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->tclasLength); + if (primitive->tclasLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->tclas, ((CsrUint16) (primitive->tclasLength))); + } + return(ptr); +} + + +void* CsrWifiSmeTspecReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeTspecReq *primitive = (CsrWifiSmeTspecReq *) CsrPmemAlloc(sizeof(CsrWifiSmeTspecReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->action, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->transactionId, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->strict, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->ctrlMask, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->tspecLength, buffer, &offset); + if (primitive->tspecLength) + { + primitive->tspec = (CsrUint8 *)CsrPmemAlloc(primitive->tspecLength); + CsrMemCpyDes(primitive->tspec, buffer, &offset, ((CsrUint16) (primitive->tspecLength))); + } + else + { + primitive->tspec = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->tclasLength, buffer, &offset); + if (primitive->tclasLength) + { + primitive->tclas = (CsrUint8 *)CsrPmemAlloc(primitive->tclasLength); + CsrMemCpyDes(primitive->tclas, buffer, &offset, ((CsrUint16) (primitive->tclasLength))); + } + else + { + primitive->tclas = NULL; + } + + return primitive; +} + + +void CsrWifiSmeTspecReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeTspecReq *primitive = (CsrWifiSmeTspecReq *) voidPrimitivePointer; + CsrPmemFree(primitive->tspec); + CsrPmemFree(primitive->tclas); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeWifiFlightmodeReqSizeof(void *msg) +{ + CsrWifiSmeWifiFlightmodeReq *primitive = (CsrWifiSmeWifiFlightmodeReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */ + bufferSize += 6; /* CsrUint8 primitive->address.a[6] */ + bufferSize += 2; /* CsrUint16 primitive->mibFilesCount */ + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->mibFilesCount; i1++) + { + bufferSize += 2; /* CsrUint16 primitive->mibFiles[i1].length */ + bufferSize += primitive->mibFiles[i1].length; /* CsrUint8 primitive->mibFiles[i1].data */ + } + } + return bufferSize; +} + + +CsrUint8* CsrWifiSmeWifiFlightmodeReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeWifiFlightmodeReq *primitive = (CsrWifiSmeWifiFlightmodeReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibFilesCount); + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->mibFilesCount; i1++) + { + CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibFiles[i1].length); + if (primitive->mibFiles[i1].length) + { + CsrMemCpySer(ptr, len, (const void *) primitive->mibFiles[i1].data, ((CsrUint16) (primitive->mibFiles[i1].length))); + } + } + } + return(ptr); +} + + +void* CsrWifiSmeWifiFlightmodeReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeWifiFlightmodeReq *primitive = (CsrWifiSmeWifiFlightmodeReq *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiFlightmodeReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrMemCpyDes(primitive->address.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((CsrUint16 *) &primitive->mibFilesCount, buffer, &offset); + primitive->mibFiles = NULL; + if (primitive->mibFilesCount) + { + primitive->mibFiles = (CsrWifiSmeDataBlock *)CsrPmemAlloc(sizeof(CsrWifiSmeDataBlock) * primitive->mibFilesCount); + } + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->mibFilesCount; i1++) + { + CsrUint16Des((CsrUint16 *) &primitive->mibFiles[i1].length, buffer, &offset); + if (primitive->mibFiles[i1].length) + { + primitive->mibFiles[i1].data = (CsrUint8 *)CsrPmemAlloc(primitive->mibFiles[i1].length); + CsrMemCpyDes(primitive->mibFiles[i1].data, buffer, &offset, ((CsrUint16) (primitive->mibFiles[i1].length))); + } + else + { + primitive->mibFiles[i1].data = NULL; + } + } + } + + return primitive; +} + + +void CsrWifiSmeWifiFlightmodeReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeWifiFlightmodeReq *primitive = (CsrWifiSmeWifiFlightmodeReq *) voidPrimitivePointer; + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->mibFilesCount; i1++) + { + CsrPmemFree(primitive->mibFiles[i1].data); + } + } + CsrPmemFree(primitive->mibFiles); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeWifiOnReqSizeof(void *msg) +{ + CsrWifiSmeWifiOnReq *primitive = (CsrWifiSmeWifiOnReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */ + bufferSize += 6; /* CsrUint8 primitive->address.a[6] */ + bufferSize += 2; /* CsrUint16 primitive->mibFilesCount */ + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->mibFilesCount; i1++) + { + bufferSize += 2; /* CsrUint16 primitive->mibFiles[i1].length */ + bufferSize += primitive->mibFiles[i1].length; /* CsrUint8 primitive->mibFiles[i1].data */ + } + } + return bufferSize; +} + + +CsrUint8* CsrWifiSmeWifiOnReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeWifiOnReq *primitive = (CsrWifiSmeWifiOnReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibFilesCount); + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->mibFilesCount; i1++) + { + CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibFiles[i1].length); + if (primitive->mibFiles[i1].length) + { + CsrMemCpySer(ptr, len, (const void *) primitive->mibFiles[i1].data, ((CsrUint16) (primitive->mibFiles[i1].length))); + } + } + } + return(ptr); +} + + +void* CsrWifiSmeWifiOnReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeWifiOnReq *primitive = (CsrWifiSmeWifiOnReq *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiOnReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrMemCpyDes(primitive->address.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((CsrUint16 *) &primitive->mibFilesCount, buffer, &offset); + primitive->mibFiles = NULL; + if (primitive->mibFilesCount) + { + primitive->mibFiles = (CsrWifiSmeDataBlock *)CsrPmemAlloc(sizeof(CsrWifiSmeDataBlock) * primitive->mibFilesCount); + } + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->mibFilesCount; i1++) + { + CsrUint16Des((CsrUint16 *) &primitive->mibFiles[i1].length, buffer, &offset); + if (primitive->mibFiles[i1].length) + { + primitive->mibFiles[i1].data = (CsrUint8 *)CsrPmemAlloc(primitive->mibFiles[i1].length); + CsrMemCpyDes(primitive->mibFiles[i1].data, buffer, &offset, ((CsrUint16) (primitive->mibFiles[i1].length))); + } + else + { + primitive->mibFiles[i1].data = NULL; + } + } + } + + return primitive; +} + + +void CsrWifiSmeWifiOnReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeWifiOnReq *primitive = (CsrWifiSmeWifiOnReq *) voidPrimitivePointer; + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->mibFilesCount; i1++) + { + CsrPmemFree(primitive->mibFiles[i1].data); + } + } + CsrPmemFree(primitive->mibFiles); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeCloakedSsidsSetReqSizeof(void *msg) +{ + CsrWifiSmeCloakedSsidsSetReq *primitive = (CsrWifiSmeCloakedSsidsSetReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 37) */ + bufferSize += 1; /* CsrUint8 primitive->cloakedSsids.cloakedSsidsCount */ + { + CsrUint16 i2; + for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) + { + bufferSize += 32; /* CsrUint8 primitive->cloakedSsids.cloakedSsids[i2].ssid[32] */ + bufferSize += 1; /* CsrUint8 primitive->cloakedSsids.cloakedSsids[i2].length */ + } + } + return bufferSize; +} + + +CsrUint8* CsrWifiSmeCloakedSsidsSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeCloakedSsidsSetReq *primitive = (CsrWifiSmeCloakedSsidsSetReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->cloakedSsids.cloakedSsidsCount); + { + CsrUint16 i2; + for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) + { + CsrMemCpySer(ptr, len, (const void *) primitive->cloakedSsids.cloakedSsids[i2].ssid, ((CsrUint16) (32))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->cloakedSsids.cloakedSsids[i2].length); + } + } + return(ptr); +} + + +void* CsrWifiSmeCloakedSsidsSetReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeCloakedSsidsSetReq *primitive = (CsrWifiSmeCloakedSsidsSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCloakedSsidsSetReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->cloakedSsids.cloakedSsidsCount, buffer, &offset); + primitive->cloakedSsids.cloakedSsids = NULL; + if (primitive->cloakedSsids.cloakedSsidsCount) + { + primitive->cloakedSsids.cloakedSsids = (CsrWifiSsid *)CsrPmemAlloc(sizeof(CsrWifiSsid) * primitive->cloakedSsids.cloakedSsidsCount); + } + { + CsrUint16 i2; + for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) + { + CsrMemCpyDes(primitive->cloakedSsids.cloakedSsids[i2].ssid, buffer, &offset, ((CsrUint16) (32))); + CsrUint8Des((CsrUint8 *) &primitive->cloakedSsids.cloakedSsids[i2].length, buffer, &offset); + } + } + + return primitive; +} + + +void CsrWifiSmeCloakedSsidsSetReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeCloakedSsidsSetReq *primitive = (CsrWifiSmeCloakedSsidsSetReq *) voidPrimitivePointer; + CsrPmemFree(primitive->cloakedSsids.cloakedSsids); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeSmeCommonConfigSetReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ + bufferSize += 1; /* CsrWifiSme80211dTrustLevel primitive->deviceConfig.trustLevel */ + bufferSize += 2; /* CsrUint8 primitive->deviceConfig.countryCode[2] */ + bufferSize += 1; /* CsrWifiSmeFirmwareDriverInterface primitive->deviceConfig.firmwareDriverInterface */ + bufferSize += 1; /* CsrBool primitive->deviceConfig.enableStrictDraftN */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeSmeCommonConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeSmeCommonConfigSetReq *primitive = (CsrWifiSmeSmeCommonConfigSetReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->deviceConfig.trustLevel); + CsrMemCpySer(ptr, len, (const void *) primitive->deviceConfig.countryCode, ((CsrUint16) (2))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->deviceConfig.firmwareDriverInterface); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->deviceConfig.enableStrictDraftN); + return(ptr); +} + + +void* CsrWifiSmeSmeCommonConfigSetReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeSmeCommonConfigSetReq *primitive = (CsrWifiSmeSmeCommonConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeCommonConfigSetReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->deviceConfig.trustLevel, buffer, &offset); + CsrMemCpyDes(primitive->deviceConfig.countryCode, buffer, &offset, ((CsrUint16) (2))); + CsrUint8Des((CsrUint8 *) &primitive->deviceConfig.firmwareDriverInterface, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->deviceConfig.enableStrictDraftN, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeWpsConfigurationReqSizeof(void *msg) +{ + CsrWifiSmeWpsConfigurationReq *primitive = (CsrWifiSmeWpsConfigurationReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 240) */ + bufferSize += 1; /* CsrUint8 primitive->wpsConfig.wpsVersion */ + bufferSize += 16; /* CsrUint8 primitive->wpsConfig.uuid[16] */ + bufferSize += 32; /* CsrUint8 primitive->wpsConfig.deviceName[32] */ + bufferSize += 1; /* CsrUint8 primitive->wpsConfig.deviceNameLength */ + bufferSize += 64; /* CsrUint8 primitive->wpsConfig.manufacturer[64] */ + bufferSize += 1; /* CsrUint8 primitive->wpsConfig.manufacturerLength */ + bufferSize += 32; /* CsrUint8 primitive->wpsConfig.modelName[32] */ + bufferSize += 1; /* CsrUint8 primitive->wpsConfig.modelNameLength */ + bufferSize += 32; /* CsrUint8 primitive->wpsConfig.modelNumber[32] */ + bufferSize += 1; /* CsrUint8 primitive->wpsConfig.modelNumberLength */ + bufferSize += 32; /* CsrUint8 primitive->wpsConfig.serialNumber[32] */ + bufferSize += 8; /* CsrUint8 primitive->wpsConfig.primDeviceType.deviceDetails[8] */ + bufferSize += 1; /* CsrUint8 primitive->wpsConfig.secondaryDeviceTypeCount */ + { + CsrUint16 i2; + for (i2 = 0; i2 < primitive->wpsConfig.secondaryDeviceTypeCount; i2++) + { + bufferSize += 8; /* CsrUint8 primitive->wpsConfig.secondaryDeviceType[i2].deviceDetails[8] */ + } + } + bufferSize += 2; /* CsrWifiSmeWpsConfigTypeMask primitive->wpsConfig.configMethods */ + bufferSize += 1; /* CsrUint8 primitive->wpsConfig.rfBands */ + bufferSize += 4; /* CsrUint8 primitive->wpsConfig.osVersion[4] */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeWpsConfigurationReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeWpsConfigurationReq *primitive = (CsrWifiSmeWpsConfigurationReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->wpsConfig.wpsVersion); + CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.uuid, ((CsrUint16) (16))); + CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.deviceName, ((CsrUint16) (32))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->wpsConfig.deviceNameLength); + CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.manufacturer, ((CsrUint16) (64))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->wpsConfig.manufacturerLength); + CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.modelName, ((CsrUint16) (32))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->wpsConfig.modelNameLength); + CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.modelNumber, ((CsrUint16) (32))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->wpsConfig.modelNumberLength); + CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.serialNumber, ((CsrUint16) (32))); + CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.primDeviceType.deviceDetails, ((CsrUint16) (8))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->wpsConfig.secondaryDeviceTypeCount); + { + CsrUint16 i2; + for (i2 = 0; i2 < primitive->wpsConfig.secondaryDeviceTypeCount; i2++) + { + CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.secondaryDeviceType[i2].deviceDetails, ((CsrUint16) (8))); + } + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->wpsConfig.configMethods); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->wpsConfig.rfBands); + CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.osVersion, ((CsrUint16) (4))); + return(ptr); +} + + +void* CsrWifiSmeWpsConfigurationReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeWpsConfigurationReq *primitive = (CsrWifiSmeWpsConfigurationReq *) CsrPmemAlloc(sizeof(CsrWifiSmeWpsConfigurationReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->wpsConfig.wpsVersion, buffer, &offset); + CsrMemCpyDes(primitive->wpsConfig.uuid, buffer, &offset, ((CsrUint16) (16))); + CsrMemCpyDes(primitive->wpsConfig.deviceName, buffer, &offset, ((CsrUint16) (32))); + CsrUint8Des((CsrUint8 *) &primitive->wpsConfig.deviceNameLength, buffer, &offset); + CsrMemCpyDes(primitive->wpsConfig.manufacturer, buffer, &offset, ((CsrUint16) (64))); + CsrUint8Des((CsrUint8 *) &primitive->wpsConfig.manufacturerLength, buffer, &offset); + CsrMemCpyDes(primitive->wpsConfig.modelName, buffer, &offset, ((CsrUint16) (32))); + CsrUint8Des((CsrUint8 *) &primitive->wpsConfig.modelNameLength, buffer, &offset); + CsrMemCpyDes(primitive->wpsConfig.modelNumber, buffer, &offset, ((CsrUint16) (32))); + CsrUint8Des((CsrUint8 *) &primitive->wpsConfig.modelNumberLength, buffer, &offset); + CsrMemCpyDes(primitive->wpsConfig.serialNumber, buffer, &offset, ((CsrUint16) (32))); + CsrMemCpyDes(primitive->wpsConfig.primDeviceType.deviceDetails, buffer, &offset, ((CsrUint16) (8))); + CsrUint8Des((CsrUint8 *) &primitive->wpsConfig.secondaryDeviceTypeCount, buffer, &offset); + primitive->wpsConfig.secondaryDeviceType = NULL; + if (primitive->wpsConfig.secondaryDeviceTypeCount) + { + primitive->wpsConfig.secondaryDeviceType = (CsrWifiSmeWpsDeviceType *)CsrPmemAlloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->wpsConfig.secondaryDeviceTypeCount); + } + { + CsrUint16 i2; + for (i2 = 0; i2 < primitive->wpsConfig.secondaryDeviceTypeCount; i2++) + { + CsrMemCpyDes(primitive->wpsConfig.secondaryDeviceType[i2].deviceDetails, buffer, &offset, ((CsrUint16) (8))); + } + } + CsrUint16Des((CsrUint16 *) &primitive->wpsConfig.configMethods, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->wpsConfig.rfBands, buffer, &offset); + CsrMemCpyDes(primitive->wpsConfig.osVersion, buffer, &offset, ((CsrUint16) (4))); + + return primitive; +} + + +void CsrWifiSmeWpsConfigurationReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeWpsConfigurationReq *primitive = (CsrWifiSmeWpsConfigurationReq *) voidPrimitivePointer; + CsrPmemFree(primitive->wpsConfig.secondaryDeviceType); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeAdhocConfigGetCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 2; /* CsrUint16 primitive->adHocConfig.atimWindowTu */ + bufferSize += 2; /* CsrUint16 primitive->adHocConfig.beaconPeriodTu */ + bufferSize += 2; /* CsrUint16 primitive->adHocConfig.joinOnlyAttempts */ + bufferSize += 2; /* CsrUint16 primitive->adHocConfig.joinAttemptIntervalMs */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeAdhocConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeAdhocConfigGetCfm *primitive = (CsrWifiSmeAdhocConfigGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->adHocConfig.atimWindowTu); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->adHocConfig.beaconPeriodTu); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->adHocConfig.joinOnlyAttempts); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->adHocConfig.joinAttemptIntervalMs); + return(ptr); +} + + +void* CsrWifiSmeAdhocConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeAdhocConfigGetCfm *primitive = (CsrWifiSmeAdhocConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeAdhocConfigGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->adHocConfig.atimWindowTu, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->adHocConfig.beaconPeriodTu, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->adHocConfig.joinOnlyAttempts, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->adHocConfig.joinAttemptIntervalMs, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeAssociationCompleteIndSizeof(void *msg) +{ + CsrWifiSmeAssociationCompleteInd *primitive = (CsrWifiSmeAssociationCompleteInd *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 98) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 32; /* CsrUint8 primitive->connectionInfo.ssid.ssid[32] */ + bufferSize += 1; /* CsrUint8 primitive->connectionInfo.ssid.length */ + bufferSize += 6; /* CsrUint8 primitive->connectionInfo.bssid.a[6] */ + bufferSize += 1; /* CsrWifiSme80211NetworkType primitive->connectionInfo.networkType80211 */ + bufferSize += 1; /* CsrUint8 primitive->connectionInfo.channelNumber */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.channelFrequency */ + bufferSize += 2; /* CsrWifiSmeAuthMode primitive->connectionInfo.authMode */ + bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.pairwiseCipher */ + bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.groupCipher */ + bufferSize += 1; /* CsrWifiSmeRadioIF primitive->connectionInfo.ifIndex */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.atimWindowTu */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.beaconPeriodTu */ + bufferSize += 1; /* CsrBool primitive->connectionInfo.reassociation */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.beaconFrameLength */ + bufferSize += primitive->connectionInfo.beaconFrameLength; /* CsrUint8 primitive->connectionInfo.beaconFrame */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.associationReqFrameLength */ + bufferSize += primitive->connectionInfo.associationReqFrameLength; /* CsrUint8 primitive->connectionInfo.associationReqFrame */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.associationRspFrameLength */ + bufferSize += primitive->connectionInfo.associationRspFrameLength; /* CsrUint8 primitive->connectionInfo.associationRspFrame */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocScanInfoElementsLength */ + bufferSize += primitive->connectionInfo.assocScanInfoElementsLength; /* CsrUint8 primitive->connectionInfo.assocScanInfoElements */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqCapabilities */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqListenIntervalTu */ + bufferSize += 6; /* CsrUint8 primitive->connectionInfo.assocReqApAddress.a[6] */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqInfoElementsLength */ + bufferSize += primitive->connectionInfo.assocReqInfoElementsLength; /* CsrUint8 primitive->connectionInfo.assocReqInfoElements */ + bufferSize += 2; /* CsrWifiSmeIEEE80211Result primitive->connectionInfo.assocRspResult */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspCapabilityInfo */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspAssociationId */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspInfoElementsLength */ + bufferSize += primitive->connectionInfo.assocRspInfoElementsLength; /* CsrUint8 primitive->connectionInfo.assocRspInfoElements */ + bufferSize += 2; /* CsrWifiSmeIEEE80211Reason primitive->deauthReason */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeAssociationCompleteIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeAssociationCompleteInd *primitive = (CsrWifiSmeAssociationCompleteInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.ssid.ssid, ((CsrUint16) (32))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.ssid.length); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.bssid.a, ((CsrUint16) (6))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.networkType80211); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.channelNumber); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.channelFrequency); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.authMode); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.pairwiseCipher); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.groupCipher); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.ifIndex); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.atimWindowTu); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.beaconPeriodTu); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.reassociation); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.beaconFrameLength); + if (primitive->connectionInfo.beaconFrameLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.beaconFrame, ((CsrUint16) (primitive->connectionInfo.beaconFrameLength))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.associationReqFrameLength); + if (primitive->connectionInfo.associationReqFrameLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationReqFrame, ((CsrUint16) (primitive->connectionInfo.associationReqFrameLength))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.associationRspFrameLength); + if (primitive->connectionInfo.associationRspFrameLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationRspFrame, ((CsrUint16) (primitive->connectionInfo.associationRspFrameLength))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocScanInfoElementsLength); + if (primitive->connectionInfo.assocScanInfoElementsLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocScanInfoElements, ((CsrUint16) (primitive->connectionInfo.assocScanInfoElementsLength))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocReqCapabilities); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocReqListenIntervalTu); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqApAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocReqInfoElementsLength); + if (primitive->connectionInfo.assocReqInfoElementsLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqInfoElements, ((CsrUint16) (primitive->connectionInfo.assocReqInfoElementsLength))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspResult); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspCapabilityInfo); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspAssociationId); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspInfoElementsLength); + if (primitive->connectionInfo.assocRspInfoElementsLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocRspInfoElements, ((CsrUint16) (primitive->connectionInfo.assocRspInfoElementsLength))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->deauthReason); + return(ptr); +} + + +void* CsrWifiSmeAssociationCompleteIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeAssociationCompleteInd *primitive = (CsrWifiSmeAssociationCompleteInd *) CsrPmemAlloc(sizeof(CsrWifiSmeAssociationCompleteInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrMemCpyDes(primitive->connectionInfo.ssid.ssid, buffer, &offset, ((CsrUint16) (32))); + CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.ssid.length, buffer, &offset); + CsrMemCpyDes(primitive->connectionInfo.bssid.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.networkType80211, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.channelNumber, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.channelFrequency, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.authMode, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.pairwiseCipher, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.groupCipher, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.ifIndex, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.atimWindowTu, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.beaconPeriodTu, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.reassociation, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.beaconFrameLength, buffer, &offset); + if (primitive->connectionInfo.beaconFrameLength) + { + primitive->connectionInfo.beaconFrame = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.beaconFrameLength); + CsrMemCpyDes(primitive->connectionInfo.beaconFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.beaconFrameLength))); + } + else + { + primitive->connectionInfo.beaconFrame = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.associationReqFrameLength, buffer, &offset); + if (primitive->connectionInfo.associationReqFrameLength) + { + primitive->connectionInfo.associationReqFrame = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.associationReqFrameLength); + CsrMemCpyDes(primitive->connectionInfo.associationReqFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.associationReqFrameLength))); + } + else + { + primitive->connectionInfo.associationReqFrame = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.associationRspFrameLength, buffer, &offset); + if (primitive->connectionInfo.associationRspFrameLength) + { + primitive->connectionInfo.associationRspFrame = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.associationRspFrameLength); + CsrMemCpyDes(primitive->connectionInfo.associationRspFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.associationRspFrameLength))); + } + else + { + primitive->connectionInfo.associationRspFrame = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocScanInfoElementsLength, buffer, &offset); + if (primitive->connectionInfo.assocScanInfoElementsLength) + { + primitive->connectionInfo.assocScanInfoElements = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.assocScanInfoElementsLength); + CsrMemCpyDes(primitive->connectionInfo.assocScanInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocScanInfoElementsLength))); + } + else + { + primitive->connectionInfo.assocScanInfoElements = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocReqCapabilities, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocReqListenIntervalTu, buffer, &offset); + CsrMemCpyDes(primitive->connectionInfo.assocReqApAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocReqInfoElementsLength, buffer, &offset); + if (primitive->connectionInfo.assocReqInfoElementsLength) + { + primitive->connectionInfo.assocReqInfoElements = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.assocReqInfoElementsLength); + CsrMemCpyDes(primitive->connectionInfo.assocReqInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocReqInfoElementsLength))); + } + else + { + primitive->connectionInfo.assocReqInfoElements = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspResult, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspCapabilityInfo, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspAssociationId, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspInfoElementsLength, buffer, &offset); + if (primitive->connectionInfo.assocRspInfoElementsLength) + { + primitive->connectionInfo.assocRspInfoElements = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.assocRspInfoElementsLength); + CsrMemCpyDes(primitive->connectionInfo.assocRspInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocRspInfoElementsLength))); + } + else + { + primitive->connectionInfo.assocRspInfoElements = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->deauthReason, buffer, &offset); + + return primitive; +} + + +void CsrWifiSmeAssociationCompleteIndSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeAssociationCompleteInd *primitive = (CsrWifiSmeAssociationCompleteInd *) voidPrimitivePointer; + CsrPmemFree(primitive->connectionInfo.beaconFrame); + CsrPmemFree(primitive->connectionInfo.associationReqFrame); + CsrPmemFree(primitive->connectionInfo.associationRspFrame); + CsrPmemFree(primitive->connectionInfo.assocScanInfoElements); + CsrPmemFree(primitive->connectionInfo.assocReqInfoElements); + CsrPmemFree(primitive->connectionInfo.assocRspInfoElements); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeAssociationStartIndSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 44) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 6; /* CsrUint8 primitive->address.a[6] */ + bufferSize += 32; /* CsrUint8 primitive->ssid.ssid[32] */ + bufferSize += 1; /* CsrUint8 primitive->ssid.length */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeAssociationStartIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeAssociationStartInd *primitive = (CsrWifiSmeAssociationStartInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->ssid.ssid, ((CsrUint16) (32))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->ssid.length); + return(ptr); +} + + +void* CsrWifiSmeAssociationStartIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeAssociationStartInd *primitive = (CsrWifiSmeAssociationStartInd *) CsrPmemAlloc(sizeof(CsrWifiSmeAssociationStartInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrMemCpyDes(primitive->address.a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->ssid.ssid, buffer, &offset, ((CsrUint16) (32))); + CsrUint8Des((CsrUint8 *) &primitive->ssid.length, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeBlacklistCfmSizeof(void *msg) +{ + CsrWifiSmeBlacklistCfm *primitive = (CsrWifiSmeBlacklistCfm *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ + bufferSize += 1; /* CsrUint8 primitive->getAddressCount */ + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->getAddressCount; i1++) + { + bufferSize += 6; /* CsrUint8 primitive->getAddresses[i1].a[6] */ + } + } + return bufferSize; +} + + +CsrUint8* CsrWifiSmeBlacklistCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeBlacklistCfm *primitive = (CsrWifiSmeBlacklistCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->action); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->getAddressCount); + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->getAddressCount; i1++) + { + CsrMemCpySer(ptr, len, (const void *) primitive->getAddresses[i1].a, ((CsrUint16) (6))); + } + } + return(ptr); +} + + +void* CsrWifiSmeBlacklistCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeBlacklistCfm *primitive = (CsrWifiSmeBlacklistCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeBlacklistCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->action, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->getAddressCount, buffer, &offset); + primitive->getAddresses = NULL; + if (primitive->getAddressCount) + { + primitive->getAddresses = (CsrWifiMacAddress *)CsrPmemAlloc(sizeof(CsrWifiMacAddress) * primitive->getAddressCount); + } + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->getAddressCount; i1++) + { + CsrMemCpyDes(primitive->getAddresses[i1].a, buffer, &offset, ((CsrUint16) (6))); + } + } + + return primitive; +} + + +void CsrWifiSmeBlacklistCfmSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeBlacklistCfm *primitive = (CsrWifiSmeBlacklistCfm *) voidPrimitivePointer; + CsrPmemFree(primitive->getAddresses); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeCalibrationDataGetCfmSizeof(void *msg) +{ + CsrWifiSmeCalibrationDataGetCfm *primitive = (CsrWifiSmeCalibrationDataGetCfm *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 2; /* CsrUint16 primitive->calibrationDataLength */ + bufferSize += primitive->calibrationDataLength; /* CsrUint8 primitive->calibrationData */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeCalibrationDataGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeCalibrationDataGetCfm *primitive = (CsrWifiSmeCalibrationDataGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->calibrationDataLength); + if (primitive->calibrationDataLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->calibrationData, ((CsrUint16) (primitive->calibrationDataLength))); + } + return(ptr); +} + + +void* CsrWifiSmeCalibrationDataGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeCalibrationDataGetCfm *primitive = (CsrWifiSmeCalibrationDataGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCalibrationDataGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->calibrationDataLength, buffer, &offset); + if (primitive->calibrationDataLength) + { + primitive->calibrationData = (CsrUint8 *)CsrPmemAlloc(primitive->calibrationDataLength); + CsrMemCpyDes(primitive->calibrationData, buffer, &offset, ((CsrUint16) (primitive->calibrationDataLength))); + } + else + { + primitive->calibrationData = NULL; + } + + return primitive; +} + + +void CsrWifiSmeCalibrationDataGetCfmSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeCalibrationDataGetCfm *primitive = (CsrWifiSmeCalibrationDataGetCfm *) voidPrimitivePointer; + CsrPmemFree(primitive->calibrationData); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeCcxConfigGetCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 1; /* CsrUint8 primitive->ccxConfig.keepAliveTimeMs */ + bufferSize += 1; /* CsrBool primitive->ccxConfig.apRoamingEnabled */ + bufferSize += 1; /* CsrUint8 primitive->ccxConfig.measurementsMask */ + bufferSize += 1; /* CsrBool primitive->ccxConfig.ccxRadioMgtEnabled */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeCcxConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeCcxConfigGetCfm *primitive = (CsrWifiSmeCcxConfigGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->ccxConfig.keepAliveTimeMs); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->ccxConfig.apRoamingEnabled); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->ccxConfig.measurementsMask); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->ccxConfig.ccxRadioMgtEnabled); + return(ptr); +} + + +void* CsrWifiSmeCcxConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeCcxConfigGetCfm *primitive = (CsrWifiSmeCcxConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCcxConfigGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->ccxConfig.keepAliveTimeMs, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->ccxConfig.apRoamingEnabled, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->ccxConfig.measurementsMask, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->ccxConfig.ccxRadioMgtEnabled, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeCcxConfigSetCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeCcxConfigSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeCcxConfigSetCfm *primitive = (CsrWifiSmeCcxConfigSetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiSmeCcxConfigSetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeCcxConfigSetCfm *primitive = (CsrWifiSmeCcxConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCcxConfigSetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeCoexConfigGetCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 31) */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 1; /* CsrBool primitive->coexConfig.coexEnableSchemeManagement */ + bufferSize += 1; /* CsrBool primitive->coexConfig.coexPeriodicWakeHost */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexTrafficBurstyLatencyMs */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexTrafficContinuousLatencyMs */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexObexBlackoutDurationMs */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexObexBlackoutPeriodMs */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexA2dpBrBlackoutDurationMs */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexA2dpBrBlackoutPeriodMs */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexA2dpEdrBlackoutDurationMs */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexPagingBlackoutDurationMs */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexPagingBlackoutPeriodMs */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexInquiryBlackoutDurationMs */ + bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexInquiryBlackoutPeriodMs */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeCoexConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeCoexConfigGetCfm *primitive = (CsrWifiSmeCoexConfigGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->coexConfig.coexEnableSchemeManagement); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->coexConfig.coexPeriodicWakeHost); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexTrafficBurstyLatencyMs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexTrafficContinuousLatencyMs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexObexBlackoutDurationMs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexObexBlackoutPeriodMs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexA2dpBrBlackoutDurationMs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexA2dpBrBlackoutPeriodMs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexA2dpEdrBlackoutDurationMs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexPagingBlackoutDurationMs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexPagingBlackoutPeriodMs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexInquiryBlackoutDurationMs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexInquiryBlackoutPeriodMs); + return(ptr); +} + + +void* CsrWifiSmeCoexConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeCoexConfigGetCfm *primitive = (CsrWifiSmeCoexConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexConfigGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->coexConfig.coexEnableSchemeManagement, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->coexConfig.coexPeriodicWakeHost, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexTrafficBurstyLatencyMs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexTrafficContinuousLatencyMs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexObexBlackoutDurationMs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexObexBlackoutPeriodMs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexA2dpBrBlackoutDurationMs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexA2dpBrBlackoutPeriodMs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexA2dpEdrBlackoutDurationMs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexPagingBlackoutDurationMs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexPagingBlackoutPeriodMs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexInquiryBlackoutDurationMs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexInquiryBlackoutPeriodMs, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeCoexInfoGetCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 24) */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 1; /* CsrBool primitive->coexInfo.hasTrafficData */ + bufferSize += 1; /* CsrWifiSmeTrafficType primitive->coexInfo.currentTrafficType */ + bufferSize += 2; /* CsrUint16 primitive->coexInfo.currentPeriodMs */ + bufferSize += 1; /* CsrWifiSmePowerSaveLevel primitive->coexInfo.currentPowerSave */ + bufferSize += 2; /* CsrUint16 primitive->coexInfo.currentCoexPeriodMs */ + bufferSize += 2; /* CsrUint16 primitive->coexInfo.currentCoexLatencyMs */ + bufferSize += 1; /* CsrBool primitive->coexInfo.hasBtDevice */ + bufferSize += 4; /* CsrUint32 primitive->coexInfo.currentBlackoutDurationUs */ + bufferSize += 4; /* CsrUint32 primitive->coexInfo.currentBlackoutPeriodUs */ + bufferSize += 1; /* CsrWifiSmeCoexScheme primitive->coexInfo.currentCoexScheme */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeCoexInfoGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeCoexInfoGetCfm *primitive = (CsrWifiSmeCoexInfoGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->coexInfo.hasTrafficData); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->coexInfo.currentTrafficType); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexInfo.currentPeriodMs); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->coexInfo.currentPowerSave); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexInfo.currentCoexPeriodMs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexInfo.currentCoexLatencyMs); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->coexInfo.hasBtDevice); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->coexInfo.currentBlackoutDurationUs); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->coexInfo.currentBlackoutPeriodUs); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->coexInfo.currentCoexScheme); + return(ptr); +} + + +void* CsrWifiSmeCoexInfoGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeCoexInfoGetCfm *primitive = (CsrWifiSmeCoexInfoGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexInfoGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->coexInfo.hasTrafficData, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->coexInfo.currentTrafficType, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexInfo.currentPeriodMs, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->coexInfo.currentPowerSave, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexInfo.currentCoexPeriodMs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->coexInfo.currentCoexLatencyMs, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->coexInfo.hasBtDevice, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->coexInfo.currentBlackoutDurationUs, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->coexInfo.currentBlackoutPeriodUs, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->coexInfo.currentCoexScheme, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeConnectCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeConnectCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeConnectCfm *primitive = (CsrWifiSmeConnectCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiSmeConnectCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeConnectCfm *primitive = (CsrWifiSmeConnectCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeConnectionConfigGetCfmSizeof(void *msg) +{ + CsrWifiSmeConnectionConfigGetCfm *primitive = (CsrWifiSmeConnectionConfigGetCfm *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 59) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 32; /* CsrUint8 primitive->connectionConfig.ssid.ssid[32] */ + bufferSize += 1; /* CsrUint8 primitive->connectionConfig.ssid.length */ + bufferSize += 6; /* CsrUint8 primitive->connectionConfig.bssid.a[6] */ + bufferSize += 1; /* CsrWifiSmeBssType primitive->connectionConfig.bssType */ + bufferSize += 1; /* CsrWifiSmeRadioIF primitive->connectionConfig.ifIndex */ + bufferSize += 1; /* CsrWifiSme80211PrivacyMode primitive->connectionConfig.privacyMode */ + bufferSize += 2; /* CsrWifiSmeAuthModeMask primitive->connectionConfig.authModeMask */ + bufferSize += 2; /* CsrWifiSmeEncryptionMask primitive->connectionConfig.encryptionModeMask */ + bufferSize += 2; /* CsrUint16 primitive->connectionConfig.mlmeAssociateReqInformationElementsLength */ + bufferSize += primitive->connectionConfig.mlmeAssociateReqInformationElementsLength; /* CsrUint8 primitive->connectionConfig.mlmeAssociateReqInformationElements */ + bufferSize += 1; /* CsrWifiSmeWmmQosInfoMask primitive->connectionConfig.wmmQosInfo */ + bufferSize += 1; /* CsrBool primitive->connectionConfig.adhocJoinOnly */ + bufferSize += 1; /* CsrUint8 primitive->connectionConfig.adhocChannel */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeConnectionConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeConnectionConfigGetCfm *primitive = (CsrWifiSmeConnectionConfigGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.ssid.ssid, ((CsrUint16) (32))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.ssid.length); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.bssid.a, ((CsrUint16) (6))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.bssType); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.ifIndex); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.privacyMode); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionConfig.authModeMask); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionConfig.encryptionModeMask); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionConfig.mlmeAssociateReqInformationElementsLength); + if (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.mlmeAssociateReqInformationElements, ((CsrUint16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength))); + } + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.wmmQosInfo); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.adhocJoinOnly); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.adhocChannel); + return(ptr); +} + + +void* CsrWifiSmeConnectionConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeConnectionConfigGetCfm *primitive = (CsrWifiSmeConnectionConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionConfigGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrMemCpyDes(primitive->connectionConfig.ssid.ssid, buffer, &offset, ((CsrUint16) (32))); + CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.ssid.length, buffer, &offset); + CsrMemCpyDes(primitive->connectionConfig.bssid.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.bssType, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.ifIndex, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.privacyMode, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionConfig.authModeMask, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionConfig.encryptionModeMask, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionConfig.mlmeAssociateReqInformationElementsLength, buffer, &offset); + if (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength) + { + primitive->connectionConfig.mlmeAssociateReqInformationElements = (CsrUint8 *)CsrPmemAlloc(primitive->connectionConfig.mlmeAssociateReqInformationElementsLength); + CsrMemCpyDes(primitive->connectionConfig.mlmeAssociateReqInformationElements, buffer, &offset, ((CsrUint16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength))); + } + else + { + primitive->connectionConfig.mlmeAssociateReqInformationElements = NULL; + } + CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.wmmQosInfo, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.adhocJoinOnly, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.adhocChannel, buffer, &offset); + + return primitive; +} + + +void CsrWifiSmeConnectionConfigGetCfmSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeConnectionConfigGetCfm *primitive = (CsrWifiSmeConnectionConfigGetCfm *) voidPrimitivePointer; + CsrPmemFree(primitive->connectionConfig.mlmeAssociateReqInformationElements); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeConnectionInfoGetCfmSizeof(void *msg) +{ + CsrWifiSmeConnectionInfoGetCfm *primitive = (CsrWifiSmeConnectionInfoGetCfm *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 96) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 32; /* CsrUint8 primitive->connectionInfo.ssid.ssid[32] */ + bufferSize += 1; /* CsrUint8 primitive->connectionInfo.ssid.length */ + bufferSize += 6; /* CsrUint8 primitive->connectionInfo.bssid.a[6] */ + bufferSize += 1; /* CsrWifiSme80211NetworkType primitive->connectionInfo.networkType80211 */ + bufferSize += 1; /* CsrUint8 primitive->connectionInfo.channelNumber */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.channelFrequency */ + bufferSize += 2; /* CsrWifiSmeAuthMode primitive->connectionInfo.authMode */ + bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.pairwiseCipher */ + bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.groupCipher */ + bufferSize += 1; /* CsrWifiSmeRadioIF primitive->connectionInfo.ifIndex */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.atimWindowTu */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.beaconPeriodTu */ + bufferSize += 1; /* CsrBool primitive->connectionInfo.reassociation */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.beaconFrameLength */ + bufferSize += primitive->connectionInfo.beaconFrameLength; /* CsrUint8 primitive->connectionInfo.beaconFrame */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.associationReqFrameLength */ + bufferSize += primitive->connectionInfo.associationReqFrameLength; /* CsrUint8 primitive->connectionInfo.associationReqFrame */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.associationRspFrameLength */ + bufferSize += primitive->connectionInfo.associationRspFrameLength; /* CsrUint8 primitive->connectionInfo.associationRspFrame */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocScanInfoElementsLength */ + bufferSize += primitive->connectionInfo.assocScanInfoElementsLength; /* CsrUint8 primitive->connectionInfo.assocScanInfoElements */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqCapabilities */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqListenIntervalTu */ + bufferSize += 6; /* CsrUint8 primitive->connectionInfo.assocReqApAddress.a[6] */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqInfoElementsLength */ + bufferSize += primitive->connectionInfo.assocReqInfoElementsLength; /* CsrUint8 primitive->connectionInfo.assocReqInfoElements */ + bufferSize += 2; /* CsrWifiSmeIEEE80211Result primitive->connectionInfo.assocRspResult */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspCapabilityInfo */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspAssociationId */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspInfoElementsLength */ + bufferSize += primitive->connectionInfo.assocRspInfoElementsLength; /* CsrUint8 primitive->connectionInfo.assocRspInfoElements */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeConnectionInfoGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeConnectionInfoGetCfm *primitive = (CsrWifiSmeConnectionInfoGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.ssid.ssid, ((CsrUint16) (32))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.ssid.length); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.bssid.a, ((CsrUint16) (6))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.networkType80211); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.channelNumber); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.channelFrequency); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.authMode); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.pairwiseCipher); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.groupCipher); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.ifIndex); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.atimWindowTu); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.beaconPeriodTu); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.reassociation); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.beaconFrameLength); + if (primitive->connectionInfo.beaconFrameLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.beaconFrame, ((CsrUint16) (primitive->connectionInfo.beaconFrameLength))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.associationReqFrameLength); + if (primitive->connectionInfo.associationReqFrameLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationReqFrame, ((CsrUint16) (primitive->connectionInfo.associationReqFrameLength))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.associationRspFrameLength); + if (primitive->connectionInfo.associationRspFrameLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationRspFrame, ((CsrUint16) (primitive->connectionInfo.associationRspFrameLength))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocScanInfoElementsLength); + if (primitive->connectionInfo.assocScanInfoElementsLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocScanInfoElements, ((CsrUint16) (primitive->connectionInfo.assocScanInfoElementsLength))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocReqCapabilities); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocReqListenIntervalTu); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqApAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocReqInfoElementsLength); + if (primitive->connectionInfo.assocReqInfoElementsLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqInfoElements, ((CsrUint16) (primitive->connectionInfo.assocReqInfoElementsLength))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspResult); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspCapabilityInfo); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspAssociationId); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspInfoElementsLength); + if (primitive->connectionInfo.assocRspInfoElementsLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocRspInfoElements, ((CsrUint16) (primitive->connectionInfo.assocRspInfoElementsLength))); + } + return(ptr); +} + + +void* CsrWifiSmeConnectionInfoGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeConnectionInfoGetCfm *primitive = (CsrWifiSmeConnectionInfoGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionInfoGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrMemCpyDes(primitive->connectionInfo.ssid.ssid, buffer, &offset, ((CsrUint16) (32))); + CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.ssid.length, buffer, &offset); + CsrMemCpyDes(primitive->connectionInfo.bssid.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.networkType80211, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.channelNumber, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.channelFrequency, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.authMode, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.pairwiseCipher, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.groupCipher, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.ifIndex, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.atimWindowTu, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.beaconPeriodTu, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.reassociation, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.beaconFrameLength, buffer, &offset); + if (primitive->connectionInfo.beaconFrameLength) + { + primitive->connectionInfo.beaconFrame = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.beaconFrameLength); + CsrMemCpyDes(primitive->connectionInfo.beaconFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.beaconFrameLength))); + } + else + { + primitive->connectionInfo.beaconFrame = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.associationReqFrameLength, buffer, &offset); + if (primitive->connectionInfo.associationReqFrameLength) + { + primitive->connectionInfo.associationReqFrame = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.associationReqFrameLength); + CsrMemCpyDes(primitive->connectionInfo.associationReqFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.associationReqFrameLength))); + } + else + { + primitive->connectionInfo.associationReqFrame = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.associationRspFrameLength, buffer, &offset); + if (primitive->connectionInfo.associationRspFrameLength) + { + primitive->connectionInfo.associationRspFrame = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.associationRspFrameLength); + CsrMemCpyDes(primitive->connectionInfo.associationRspFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.associationRspFrameLength))); + } + else + { + primitive->connectionInfo.associationRspFrame = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocScanInfoElementsLength, buffer, &offset); + if (primitive->connectionInfo.assocScanInfoElementsLength) + { + primitive->connectionInfo.assocScanInfoElements = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.assocScanInfoElementsLength); + CsrMemCpyDes(primitive->connectionInfo.assocScanInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocScanInfoElementsLength))); + } + else + { + primitive->connectionInfo.assocScanInfoElements = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocReqCapabilities, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocReqListenIntervalTu, buffer, &offset); + CsrMemCpyDes(primitive->connectionInfo.assocReqApAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocReqInfoElementsLength, buffer, &offset); + if (primitive->connectionInfo.assocReqInfoElementsLength) + { + primitive->connectionInfo.assocReqInfoElements = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.assocReqInfoElementsLength); + CsrMemCpyDes(primitive->connectionInfo.assocReqInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocReqInfoElementsLength))); + } + else + { + primitive->connectionInfo.assocReqInfoElements = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspResult, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspCapabilityInfo, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspAssociationId, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspInfoElementsLength, buffer, &offset); + if (primitive->connectionInfo.assocRspInfoElementsLength) + { + primitive->connectionInfo.assocRspInfoElements = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.assocRspInfoElementsLength); + CsrMemCpyDes(primitive->connectionInfo.assocRspInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocRspInfoElementsLength))); + } + else + { + primitive->connectionInfo.assocRspInfoElements = NULL; + } + + return primitive; +} + + +void CsrWifiSmeConnectionInfoGetCfmSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeConnectionInfoGetCfm *primitive = (CsrWifiSmeConnectionInfoGetCfm *) voidPrimitivePointer; + CsrPmemFree(primitive->connectionInfo.beaconFrame); + CsrPmemFree(primitive->connectionInfo.associationReqFrame); + CsrPmemFree(primitive->connectionInfo.associationRspFrame); + CsrPmemFree(primitive->connectionInfo.assocScanInfoElements); + CsrPmemFree(primitive->connectionInfo.assocReqInfoElements); + CsrPmemFree(primitive->connectionInfo.assocRspInfoElements); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeConnectionQualityIndSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrInt16 primitive->linkQuality.unifiRssi */ + bufferSize += 2; /* CsrInt16 primitive->linkQuality.unifiSnr */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeConnectionQualityIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeConnectionQualityInd *primitive = (CsrWifiSmeConnectionQualityInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->linkQuality.unifiRssi); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->linkQuality.unifiSnr); + return(ptr); +} + + +void* CsrWifiSmeConnectionQualityIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeConnectionQualityInd *primitive = (CsrWifiSmeConnectionQualityInd *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionQualityInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->linkQuality.unifiRssi, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->linkQuality.unifiSnr, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeConnectionStatsGetCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 101) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 1; /* CsrUint8 primitive->connectionStats.unifiTxDataRate */ + bufferSize += 1; /* CsrUint8 primitive->connectionStats.unifiRxDataRate */ + bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11RetryCount */ + bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11MultipleRetryCount */ + bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11AckFailureCount */ + bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11FrameDuplicateCount */ + bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11FcsErrorCount */ + bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11RtsSuccessCount */ + bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11RtsFailureCount */ + bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11FailedCount */ + bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11TransmittedFragmentCount */ + bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11TransmittedFrameCount */ + bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11WepExcludedCount */ + bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11WepIcvErrorCount */ + bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11WepUndecryptableCount */ + bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11MulticastReceivedFrameCount */ + bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11MulticastTransmittedFrameCount */ + bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11ReceivedFragmentCount */ + bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11Rsna4WayHandshakeFailures */ + bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11RsnaTkipCounterMeasuresInvoked */ + bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11RsnaStatsTkipLocalMicFailures */ + bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11RsnaStatsTkipReplays */ + bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11RsnaStatsTkipIcvErrors */ + bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11RsnaStatsCcmpReplays */ + bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11RsnaStatsCcmpDecryptErrors */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeConnectionStatsGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeConnectionStatsGetCfm *primitive = (CsrWifiSmeConnectionStatsGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionStats.unifiTxDataRate); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionStats.unifiRxDataRate); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11RetryCount); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11MultipleRetryCount); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11AckFailureCount); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11FrameDuplicateCount); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11FcsErrorCount); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11RtsSuccessCount); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11RtsFailureCount); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11FailedCount); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11TransmittedFragmentCount); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11TransmittedFrameCount); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11WepExcludedCount); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11WepIcvErrorCount); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11WepUndecryptableCount); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11MulticastReceivedFrameCount); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11MulticastTransmittedFrameCount); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11ReceivedFragmentCount); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11Rsna4WayHandshakeFailures); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11RsnaTkipCounterMeasuresInvoked); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11RsnaStatsTkipLocalMicFailures); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11RsnaStatsTkipReplays); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11RsnaStatsTkipIcvErrors); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11RsnaStatsCcmpReplays); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11RsnaStatsCcmpDecryptErrors); + return(ptr); +} + + +void* CsrWifiSmeConnectionStatsGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeConnectionStatsGetCfm *primitive = (CsrWifiSmeConnectionStatsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionStatsGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->connectionStats.unifiTxDataRate, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->connectionStats.unifiRxDataRate, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11RetryCount, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11MultipleRetryCount, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11AckFailureCount, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11FrameDuplicateCount, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11FcsErrorCount, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11RtsSuccessCount, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11RtsFailureCount, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11FailedCount, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11TransmittedFragmentCount, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11TransmittedFrameCount, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11WepExcludedCount, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11WepIcvErrorCount, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11WepUndecryptableCount, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11MulticastReceivedFrameCount, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11MulticastTransmittedFrameCount, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11ReceivedFragmentCount, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11Rsna4WayHandshakeFailures, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11RsnaTkipCounterMeasuresInvoked, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11RsnaStatsTkipLocalMicFailures, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11RsnaStatsTkipReplays, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11RsnaStatsTkipIcvErrors, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11RsnaStatsCcmpReplays, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11RsnaStatsCcmpDecryptErrors, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeDisconnectCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeDisconnectCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeDisconnectCfm *primitive = (CsrWifiSmeDisconnectCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiSmeDisconnectCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeDisconnectCfm *primitive = (CsrWifiSmeDisconnectCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeDisconnectCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeHostConfigGetCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 1; /* CsrWifiSmeHostPowerMode primitive->hostConfig.powerMode */ + bufferSize += 2; /* CsrUint16 primitive->hostConfig.applicationDataPeriodMs */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeHostConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeHostConfigGetCfm *primitive = (CsrWifiSmeHostConfigGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->hostConfig.powerMode); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->hostConfig.applicationDataPeriodMs); + return(ptr); +} + + +void* CsrWifiSmeHostConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeHostConfigGetCfm *primitive = (CsrWifiSmeHostConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeHostConfigGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->hostConfig.powerMode, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->hostConfig.applicationDataPeriodMs, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeHostConfigSetCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeHostConfigSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeHostConfigSetCfm *primitive = (CsrWifiSmeHostConfigSetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiSmeHostConfigSetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeHostConfigSetCfm *primitive = (CsrWifiSmeHostConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeHostConfigSetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeIbssStationIndSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ + bufferSize += 6; /* CsrUint8 primitive->address.a[6] */ + bufferSize += 1; /* CsrBool primitive->isconnected */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeIbssStationIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeIbssStationInd *primitive = (CsrWifiSmeIbssStationInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((CsrUint16) (6))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->isconnected); + return(ptr); +} + + +void* CsrWifiSmeIbssStationIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeIbssStationInd *primitive = (CsrWifiSmeIbssStationInd *) CsrPmemAlloc(sizeof(CsrWifiSmeIbssStationInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrMemCpyDes(primitive->address.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint8Des((CsrUint8 *) &primitive->isconnected, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeKeyCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ + bufferSize += 1; /* CsrWifiSmeKeyType primitive->keyType */ + bufferSize += 6; /* CsrUint8 primitive->peerMacAddress.a[6] */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeKeyCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeKeyCfm *primitive = (CsrWifiSmeKeyCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->action); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->keyType); + CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); + return(ptr); +} + + +void* CsrWifiSmeKeyCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeKeyCfm *primitive = (CsrWifiSmeKeyCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeKeyCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->action, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->keyType, buffer, &offset); + CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); + + return primitive; +} + + +CsrSize CsrWifiSmeLinkQualityGetCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 2; /* CsrInt16 primitive->linkQuality.unifiRssi */ + bufferSize += 2; /* CsrInt16 primitive->linkQuality.unifiSnr */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeLinkQualityGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeLinkQualityGetCfm *primitive = (CsrWifiSmeLinkQualityGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->linkQuality.unifiRssi); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->linkQuality.unifiSnr); + return(ptr); +} + + +void* CsrWifiSmeLinkQualityGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeLinkQualityGetCfm *primitive = (CsrWifiSmeLinkQualityGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeLinkQualityGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->linkQuality.unifiRssi, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->linkQuality.unifiSnr, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeMediaStatusIndSizeof(void *msg) +{ + CsrWifiSmeMediaStatusInd *primitive = (CsrWifiSmeMediaStatusInd *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 99) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 1; /* CsrWifiSmeMediaStatus primitive->mediaStatus */ + bufferSize += 32; /* CsrUint8 primitive->connectionInfo.ssid.ssid[32] */ + bufferSize += 1; /* CsrUint8 primitive->connectionInfo.ssid.length */ + bufferSize += 6; /* CsrUint8 primitive->connectionInfo.bssid.a[6] */ + bufferSize += 1; /* CsrWifiSme80211NetworkType primitive->connectionInfo.networkType80211 */ + bufferSize += 1; /* CsrUint8 primitive->connectionInfo.channelNumber */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.channelFrequency */ + bufferSize += 2; /* CsrWifiSmeAuthMode primitive->connectionInfo.authMode */ + bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.pairwiseCipher */ + bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.groupCipher */ + bufferSize += 1; /* CsrWifiSmeRadioIF primitive->connectionInfo.ifIndex */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.atimWindowTu */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.beaconPeriodTu */ + bufferSize += 1; /* CsrBool primitive->connectionInfo.reassociation */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.beaconFrameLength */ + bufferSize += primitive->connectionInfo.beaconFrameLength; /* CsrUint8 primitive->connectionInfo.beaconFrame */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.associationReqFrameLength */ + bufferSize += primitive->connectionInfo.associationReqFrameLength; /* CsrUint8 primitive->connectionInfo.associationReqFrame */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.associationRspFrameLength */ + bufferSize += primitive->connectionInfo.associationRspFrameLength; /* CsrUint8 primitive->connectionInfo.associationRspFrame */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocScanInfoElementsLength */ + bufferSize += primitive->connectionInfo.assocScanInfoElementsLength; /* CsrUint8 primitive->connectionInfo.assocScanInfoElements */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqCapabilities */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqListenIntervalTu */ + bufferSize += 6; /* CsrUint8 primitive->connectionInfo.assocReqApAddress.a[6] */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqInfoElementsLength */ + bufferSize += primitive->connectionInfo.assocReqInfoElementsLength; /* CsrUint8 primitive->connectionInfo.assocReqInfoElements */ + bufferSize += 2; /* CsrWifiSmeIEEE80211Result primitive->connectionInfo.assocRspResult */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspCapabilityInfo */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspAssociationId */ + bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspInfoElementsLength */ + bufferSize += primitive->connectionInfo.assocRspInfoElementsLength; /* CsrUint8 primitive->connectionInfo.assocRspInfoElements */ + bufferSize += 2; /* CsrWifiSmeIEEE80211Reason primitive->disassocReason */ + bufferSize += 2; /* CsrWifiSmeIEEE80211Reason primitive->deauthReason */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeMediaStatusIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeMediaStatusInd *primitive = (CsrWifiSmeMediaStatusInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->mediaStatus); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.ssid.ssid, ((CsrUint16) (32))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.ssid.length); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.bssid.a, ((CsrUint16) (6))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.networkType80211); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.channelNumber); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.channelFrequency); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.authMode); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.pairwiseCipher); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.groupCipher); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.ifIndex); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.atimWindowTu); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.beaconPeriodTu); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.reassociation); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.beaconFrameLength); + if (primitive->connectionInfo.beaconFrameLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.beaconFrame, ((CsrUint16) (primitive->connectionInfo.beaconFrameLength))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.associationReqFrameLength); + if (primitive->connectionInfo.associationReqFrameLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationReqFrame, ((CsrUint16) (primitive->connectionInfo.associationReqFrameLength))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.associationRspFrameLength); + if (primitive->connectionInfo.associationRspFrameLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationRspFrame, ((CsrUint16) (primitive->connectionInfo.associationRspFrameLength))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocScanInfoElementsLength); + if (primitive->connectionInfo.assocScanInfoElementsLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocScanInfoElements, ((CsrUint16) (primitive->connectionInfo.assocScanInfoElementsLength))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocReqCapabilities); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocReqListenIntervalTu); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqApAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocReqInfoElementsLength); + if (primitive->connectionInfo.assocReqInfoElementsLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqInfoElements, ((CsrUint16) (primitive->connectionInfo.assocReqInfoElementsLength))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspResult); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspCapabilityInfo); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspAssociationId); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspInfoElementsLength); + if (primitive->connectionInfo.assocRspInfoElementsLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocRspInfoElements, ((CsrUint16) (primitive->connectionInfo.assocRspInfoElementsLength))); + } + CsrUint16Ser(ptr, len, (CsrUint16) primitive->disassocReason); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->deauthReason); + return(ptr); +} + + +void* CsrWifiSmeMediaStatusIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeMediaStatusInd *primitive = (CsrWifiSmeMediaStatusInd *) CsrPmemAlloc(sizeof(CsrWifiSmeMediaStatusInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->mediaStatus, buffer, &offset); + CsrMemCpyDes(primitive->connectionInfo.ssid.ssid, buffer, &offset, ((CsrUint16) (32))); + CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.ssid.length, buffer, &offset); + CsrMemCpyDes(primitive->connectionInfo.bssid.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.networkType80211, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.channelNumber, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.channelFrequency, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.authMode, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.pairwiseCipher, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.groupCipher, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.ifIndex, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.atimWindowTu, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.beaconPeriodTu, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.reassociation, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.beaconFrameLength, buffer, &offset); + if (primitive->connectionInfo.beaconFrameLength) + { + primitive->connectionInfo.beaconFrame = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.beaconFrameLength); + CsrMemCpyDes(primitive->connectionInfo.beaconFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.beaconFrameLength))); + } + else + { + primitive->connectionInfo.beaconFrame = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.associationReqFrameLength, buffer, &offset); + if (primitive->connectionInfo.associationReqFrameLength) + { + primitive->connectionInfo.associationReqFrame = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.associationReqFrameLength); + CsrMemCpyDes(primitive->connectionInfo.associationReqFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.associationReqFrameLength))); + } + else + { + primitive->connectionInfo.associationReqFrame = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.associationRspFrameLength, buffer, &offset); + if (primitive->connectionInfo.associationRspFrameLength) + { + primitive->connectionInfo.associationRspFrame = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.associationRspFrameLength); + CsrMemCpyDes(primitive->connectionInfo.associationRspFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.associationRspFrameLength))); + } + else + { + primitive->connectionInfo.associationRspFrame = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocScanInfoElementsLength, buffer, &offset); + if (primitive->connectionInfo.assocScanInfoElementsLength) + { + primitive->connectionInfo.assocScanInfoElements = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.assocScanInfoElementsLength); + CsrMemCpyDes(primitive->connectionInfo.assocScanInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocScanInfoElementsLength))); + } + else + { + primitive->connectionInfo.assocScanInfoElements = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocReqCapabilities, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocReqListenIntervalTu, buffer, &offset); + CsrMemCpyDes(primitive->connectionInfo.assocReqApAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocReqInfoElementsLength, buffer, &offset); + if (primitive->connectionInfo.assocReqInfoElementsLength) + { + primitive->connectionInfo.assocReqInfoElements = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.assocReqInfoElementsLength); + CsrMemCpyDes(primitive->connectionInfo.assocReqInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocReqInfoElementsLength))); + } + else + { + primitive->connectionInfo.assocReqInfoElements = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspResult, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspCapabilityInfo, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspAssociationId, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspInfoElementsLength, buffer, &offset); + if (primitive->connectionInfo.assocRspInfoElementsLength) + { + primitive->connectionInfo.assocRspInfoElements = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.assocRspInfoElementsLength); + CsrMemCpyDes(primitive->connectionInfo.assocRspInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocRspInfoElementsLength))); + } + else + { + primitive->connectionInfo.assocRspInfoElements = NULL; + } + CsrUint16Des((CsrUint16 *) &primitive->disassocReason, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->deauthReason, buffer, &offset); + + return primitive; +} + + +void CsrWifiSmeMediaStatusIndSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeMediaStatusInd *primitive = (CsrWifiSmeMediaStatusInd *) voidPrimitivePointer; + CsrPmemFree(primitive->connectionInfo.beaconFrame); + CsrPmemFree(primitive->connectionInfo.associationReqFrame); + CsrPmemFree(primitive->connectionInfo.associationRspFrame); + CsrPmemFree(primitive->connectionInfo.assocScanInfoElements); + CsrPmemFree(primitive->connectionInfo.assocReqInfoElements); + CsrPmemFree(primitive->connectionInfo.assocRspInfoElements); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeMibConfigGetCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 1; /* CsrBool primitive->mibConfig.unifiFixMaxTxDataRate */ + bufferSize += 1; /* CsrUint8 primitive->mibConfig.unifiFixTxDataRate */ + bufferSize += 2; /* CsrUint16 primitive->mibConfig.dot11RtsThreshold */ + bufferSize += 2; /* CsrUint16 primitive->mibConfig.dot11FragmentationThreshold */ + bufferSize += 2; /* CsrUint16 primitive->mibConfig.dot11CurrentTxPowerLevel */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeMibConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeMibConfigGetCfm *primitive = (CsrWifiSmeMibConfigGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->mibConfig.unifiFixMaxTxDataRate); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->mibConfig.unifiFixTxDataRate); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibConfig.dot11RtsThreshold); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibConfig.dot11FragmentationThreshold); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibConfig.dot11CurrentTxPowerLevel); + return(ptr); +} + + +void* CsrWifiSmeMibConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeMibConfigGetCfm *primitive = (CsrWifiSmeMibConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMibConfigGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->mibConfig.unifiFixMaxTxDataRate, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->mibConfig.unifiFixTxDataRate, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->mibConfig.dot11RtsThreshold, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->mibConfig.dot11FragmentationThreshold, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->mibConfig.dot11CurrentTxPowerLevel, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeMibGetCfmSizeof(void *msg) +{ + CsrWifiSmeMibGetCfm *primitive = (CsrWifiSmeMibGetCfm *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 2; /* CsrUint16 primitive->mibAttributeLength */ + bufferSize += primitive->mibAttributeLength; /* CsrUint8 primitive->mibAttribute */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeMibGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeMibGetCfm *primitive = (CsrWifiSmeMibGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibAttributeLength); + if (primitive->mibAttributeLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((CsrUint16) (primitive->mibAttributeLength))); + } + return(ptr); +} + + +void* CsrWifiSmeMibGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeMibGetCfm *primitive = (CsrWifiSmeMibGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->mibAttributeLength, buffer, &offset); + if (primitive->mibAttributeLength) + { + primitive->mibAttribute = (CsrUint8 *)CsrPmemAlloc(primitive->mibAttributeLength); + CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((CsrUint16) (primitive->mibAttributeLength))); + } + else + { + primitive->mibAttribute = NULL; + } + + return primitive; +} + + +void CsrWifiSmeMibGetCfmSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeMibGetCfm *primitive = (CsrWifiSmeMibGetCfm *) voidPrimitivePointer; + CsrPmemFree(primitive->mibAttribute); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeMibGetNextCfmSizeof(void *msg) +{ + CsrWifiSmeMibGetNextCfm *primitive = (CsrWifiSmeMibGetNextCfm *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 2; /* CsrUint16 primitive->mibAttributeLength */ + bufferSize += primitive->mibAttributeLength; /* CsrUint8 primitive->mibAttribute */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeMibGetNextCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeMibGetNextCfm *primitive = (CsrWifiSmeMibGetNextCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibAttributeLength); + if (primitive->mibAttributeLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((CsrUint16) (primitive->mibAttributeLength))); + } + return(ptr); +} + + +void* CsrWifiSmeMibGetNextCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeMibGetNextCfm *primitive = (CsrWifiSmeMibGetNextCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetNextCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->mibAttributeLength, buffer, &offset); + if (primitive->mibAttributeLength) + { + primitive->mibAttribute = (CsrUint8 *)CsrPmemAlloc(primitive->mibAttributeLength); + CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((CsrUint16) (primitive->mibAttributeLength))); + } + else + { + primitive->mibAttribute = NULL; + } + + return primitive; +} + + +void CsrWifiSmeMibGetNextCfmSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeMibGetNextCfm *primitive = (CsrWifiSmeMibGetNextCfm *) voidPrimitivePointer; + CsrPmemFree(primitive->mibAttribute); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeMicFailureIndSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 1; /* CsrBool primitive->secondFailure */ + bufferSize += 2; /* CsrUint16 primitive->count */ + bufferSize += 6; /* CsrUint8 primitive->address.a[6] */ + bufferSize += 1; /* CsrWifiSmeKeyType primitive->keyType */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeMicFailureIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeMicFailureInd *primitive = (CsrWifiSmeMicFailureInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->secondFailure); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->count); + CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((CsrUint16) (6))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->keyType); + return(ptr); +} + + +void* CsrWifiSmeMicFailureIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeMicFailureInd *primitive = (CsrWifiSmeMicFailureInd *) CsrPmemAlloc(sizeof(CsrWifiSmeMicFailureInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->secondFailure, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->count, buffer, &offset); + CsrMemCpyDes(primitive->address.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint8Des((CsrUint8 *) &primitive->keyType, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeMulticastAddressCfmSizeof(void *msg) +{ + CsrWifiSmeMulticastAddressCfm *primitive = (CsrWifiSmeMulticastAddressCfm *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ + bufferSize += 1; /* CsrUint8 primitive->getAddressesCount */ + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->getAddressesCount; i1++) + { + bufferSize += 6; /* CsrUint8 primitive->getAddresses[i1].a[6] */ + } + } + return bufferSize; +} + + +CsrUint8* CsrWifiSmeMulticastAddressCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeMulticastAddressCfm *primitive = (CsrWifiSmeMulticastAddressCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->action); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->getAddressesCount); + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->getAddressesCount; i1++) + { + CsrMemCpySer(ptr, len, (const void *) primitive->getAddresses[i1].a, ((CsrUint16) (6))); + } + } + return(ptr); +} + + +void* CsrWifiSmeMulticastAddressCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeMulticastAddressCfm *primitive = (CsrWifiSmeMulticastAddressCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMulticastAddressCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->action, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->getAddressesCount, buffer, &offset); + primitive->getAddresses = NULL; + if (primitive->getAddressesCount) + { + primitive->getAddresses = (CsrWifiMacAddress *)CsrPmemAlloc(sizeof(CsrWifiMacAddress) * primitive->getAddressesCount); + } + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->getAddressesCount; i1++) + { + CsrMemCpyDes(primitive->getAddresses[i1].a, buffer, &offset, ((CsrUint16) (6))); + } + } + + return primitive; +} + + +void CsrWifiSmeMulticastAddressCfmSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeMulticastAddressCfm *primitive = (CsrWifiSmeMulticastAddressCfm *) voidPrimitivePointer; + CsrPmemFree(primitive->getAddresses); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmePacketFilterSetCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmePacketFilterSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmePacketFilterSetCfm *primitive = (CsrWifiSmePacketFilterSetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiSmePacketFilterSetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmePacketFilterSetCfm *primitive = (CsrWifiSmePacketFilterSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePacketFilterSetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmePermanentMacAddressGetCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 6; /* CsrUint8 primitive->permanentMacAddress.a[6] */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmePermanentMacAddressGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmePermanentMacAddressGetCfm *primitive = (CsrWifiSmePermanentMacAddressGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrMemCpySer(ptr, len, (const void *) primitive->permanentMacAddress.a, ((CsrUint16) (6))); + return(ptr); +} + + +void* CsrWifiSmePermanentMacAddressGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmePermanentMacAddressGetCfm *primitive = (CsrWifiSmePermanentMacAddressGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePermanentMacAddressGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrMemCpyDes(primitive->permanentMacAddress.a, buffer, &offset, ((CsrUint16) (6))); + + return primitive; +} + + +CsrSize CsrWifiSmePmkidCandidateListIndSizeof(void *msg) +{ + CsrWifiSmePmkidCandidateListInd *primitive = (CsrWifiSmePmkidCandidateListInd *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 1; /* CsrUint8 primitive->pmkidCandidatesCount */ + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->pmkidCandidatesCount; i1++) + { + bufferSize += 6; /* CsrUint8 primitive->pmkidCandidates[i1].bssid.a[6] */ + bufferSize += 1; /* CsrBool primitive->pmkidCandidates[i1].preAuthAllowed */ + } + } + return bufferSize; +} + + +CsrUint8* CsrWifiSmePmkidCandidateListIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmePmkidCandidateListInd *primitive = (CsrWifiSmePmkidCandidateListInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->pmkidCandidatesCount); + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->pmkidCandidatesCount; i1++) + { + CsrMemCpySer(ptr, len, (const void *) primitive->pmkidCandidates[i1].bssid.a, ((CsrUint16) (6))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->pmkidCandidates[i1].preAuthAllowed); + } + } + return(ptr); +} + + +void* CsrWifiSmePmkidCandidateListIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmePmkidCandidateListInd *primitive = (CsrWifiSmePmkidCandidateListInd *) CsrPmemAlloc(sizeof(CsrWifiSmePmkidCandidateListInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->pmkidCandidatesCount, buffer, &offset); + primitive->pmkidCandidates = NULL; + if (primitive->pmkidCandidatesCount) + { + primitive->pmkidCandidates = (CsrWifiSmePmkidCandidate *)CsrPmemAlloc(sizeof(CsrWifiSmePmkidCandidate) * primitive->pmkidCandidatesCount); + } + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->pmkidCandidatesCount; i1++) + { + CsrMemCpyDes(primitive->pmkidCandidates[i1].bssid.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint8Des((CsrUint8 *) &primitive->pmkidCandidates[i1].preAuthAllowed, buffer, &offset); + } + } + + return primitive; +} + + +void CsrWifiSmePmkidCandidateListIndSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmePmkidCandidateListInd *primitive = (CsrWifiSmePmkidCandidateListInd *) voidPrimitivePointer; + CsrPmemFree(primitive->pmkidCandidates); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmePmkidCfmSizeof(void *msg) +{ + CsrWifiSmePmkidCfm *primitive = (CsrWifiSmePmkidCfm *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 31) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ + bufferSize += 1; /* CsrUint8 primitive->getPmkidsCount */ + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->getPmkidsCount; i1++) + { + bufferSize += 6; /* CsrUint8 primitive->getPmkids[i1].bssid.a[6] */ + bufferSize += 16; /* CsrUint8 primitive->getPmkids[i1].pmkid[16] */ + } + } + return bufferSize; +} + + +CsrUint8* CsrWifiSmePmkidCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmePmkidCfm *primitive = (CsrWifiSmePmkidCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->action); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->getPmkidsCount); + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->getPmkidsCount; i1++) + { + CsrMemCpySer(ptr, len, (const void *) primitive->getPmkids[i1].bssid.a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->getPmkids[i1].pmkid, ((CsrUint16) (16))); + } + } + return(ptr); +} + + +void* CsrWifiSmePmkidCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmePmkidCfm *primitive = (CsrWifiSmePmkidCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePmkidCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->action, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->getPmkidsCount, buffer, &offset); + primitive->getPmkids = NULL; + if (primitive->getPmkidsCount) + { + primitive->getPmkids = (CsrWifiSmePmkid *)CsrPmemAlloc(sizeof(CsrWifiSmePmkid) * primitive->getPmkidsCount); + } + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->getPmkidsCount; i1++) + { + CsrMemCpyDes(primitive->getPmkids[i1].bssid.a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->getPmkids[i1].pmkid, buffer, &offset, ((CsrUint16) (16))); + } + } + + return primitive; +} + + +void CsrWifiSmePmkidCfmSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmePmkidCfm *primitive = (CsrWifiSmePmkidCfm *) voidPrimitivePointer; + CsrPmemFree(primitive->getPmkids); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmePowerConfigGetCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 1; /* CsrWifiSmePowerSaveLevel primitive->powerConfig.powerSaveLevel */ + bufferSize += 2; /* CsrUint16 primitive->powerConfig.listenIntervalTu */ + bufferSize += 1; /* CsrBool primitive->powerConfig.rxDtims */ + bufferSize += 1; /* CsrWifiSmeD3AutoScanMode primitive->powerConfig.d3AutoScanMode */ + bufferSize += 1; /* CsrUint8 primitive->powerConfig.clientTrafficWindow */ + bufferSize += 1; /* CsrBool primitive->powerConfig.opportunisticPowerSave */ + bufferSize += 1; /* CsrBool primitive->powerConfig.noticeOfAbsence */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmePowerConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmePowerConfigGetCfm *primitive = (CsrWifiSmePowerConfigGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.powerSaveLevel); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->powerConfig.listenIntervalTu); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.rxDtims); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.d3AutoScanMode); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.clientTrafficWindow); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.opportunisticPowerSave); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.noticeOfAbsence); + return(ptr); +} + + +void* CsrWifiSmePowerConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmePowerConfigGetCfm *primitive = (CsrWifiSmePowerConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePowerConfigGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->powerConfig.powerSaveLevel, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->powerConfig.listenIntervalTu, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->powerConfig.rxDtims, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->powerConfig.d3AutoScanMode, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->powerConfig.clientTrafficWindow, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->powerConfig.opportunisticPowerSave, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->powerConfig.noticeOfAbsence, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeRegulatoryDomainInfoGetCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 1; /* CsrBool primitive->regDomInfo.dot11MultiDomainCapabilityImplemented */ + bufferSize += 1; /* CsrBool primitive->regDomInfo.dot11MultiDomainCapabilityEnabled */ + bufferSize += 1; /* CsrWifiSmeRegulatoryDomain primitive->regDomInfo.currentRegulatoryDomain */ + bufferSize += 2; /* CsrUint8 primitive->regDomInfo.currentCountryCode[2] */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeRegulatoryDomainInfoGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeRegulatoryDomainInfoGetCfm *primitive = (CsrWifiSmeRegulatoryDomainInfoGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->regDomInfo.dot11MultiDomainCapabilityImplemented); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->regDomInfo.dot11MultiDomainCapabilityEnabled); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->regDomInfo.currentRegulatoryDomain); + CsrMemCpySer(ptr, len, (const void *) primitive->regDomInfo.currentCountryCode, ((CsrUint16) (2))); + return(ptr); +} + + +void* CsrWifiSmeRegulatoryDomainInfoGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeRegulatoryDomainInfoGetCfm *primitive = (CsrWifiSmeRegulatoryDomainInfoGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeRegulatoryDomainInfoGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->regDomInfo.dot11MultiDomainCapabilityImplemented, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->regDomInfo.dot11MultiDomainCapabilityEnabled, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->regDomInfo.currentRegulatoryDomain, buffer, &offset); + CsrMemCpyDes(primitive->regDomInfo.currentCountryCode, buffer, &offset, ((CsrUint16) (2))); + + return primitive; +} + + +CsrSize CsrWifiSmeRoamCompleteIndSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeRoamCompleteIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeRoamCompleteInd *primitive = (CsrWifiSmeRoamCompleteInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiSmeRoamCompleteIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeRoamCompleteInd *primitive = (CsrWifiSmeRoamCompleteInd *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamCompleteInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeRoamStartIndSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 1; /* CsrWifiSmeRoamReason primitive->roamReason */ + bufferSize += 2; /* CsrWifiSmeIEEE80211Reason primitive->reason80211 */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeRoamStartIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeRoamStartInd *primitive = (CsrWifiSmeRoamStartInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->roamReason); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->reason80211); + return(ptr); +} + + +void* CsrWifiSmeRoamStartIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeRoamStartInd *primitive = (CsrWifiSmeRoamStartInd *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamStartInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->roamReason, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->reason80211, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeRoamingConfigGetCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 72) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + { + CsrUint16 i2; + for (i2 = 0; i2 < 3; i2++) + { + bufferSize += 2; /* CsrInt16 primitive->roamingConfig.roamingBands[i2].rssiHighThreshold */ + bufferSize += 2; /* CsrInt16 primitive->roamingConfig.roamingBands[i2].rssiLowThreshold */ + bufferSize += 2; /* CsrInt16 primitive->roamingConfig.roamingBands[i2].snrHighThreshold */ + bufferSize += 2; /* CsrInt16 primitive->roamingConfig.roamingBands[i2].snrLowThreshold */ + } + } + bufferSize += 1; /* CsrBool primitive->roamingConfig.disableSmoothRoaming */ + bufferSize += 1; /* CsrBool primitive->roamingConfig.disableRoamScans */ + bufferSize += 1; /* CsrUint8 primitive->roamingConfig.reconnectLimit */ + bufferSize += 2; /* CsrUint16 primitive->roamingConfig.reconnectLimitIntervalMs */ + { + CsrUint16 i2; + for (i2 = 0; i2 < 3; i2++) + { + bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].intervalSeconds */ + bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].validitySeconds */ + bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu */ + bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu */ + bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu */ + bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu */ + } + } + return bufferSize; +} + + +CsrUint8* CsrWifiSmeRoamingConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeRoamingConfigGetCfm *primitive = (CsrWifiSmeRoamingConfigGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + { + CsrUint16 i2; + for (i2 = 0; i2 < 3; i2++) + { + CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamingBands[i2].rssiHighThreshold); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamingBands[i2].rssiLowThreshold); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamingBands[i2].snrHighThreshold); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamingBands[i2].snrLowThreshold); + } + } + CsrUint8Ser(ptr, len, (CsrUint8) primitive->roamingConfig.disableSmoothRoaming); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->roamingConfig.disableRoamScans); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->roamingConfig.reconnectLimit); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.reconnectLimitIntervalMs); + { + CsrUint16 i2; + for (i2 = 0; i2 < 3; i2++) + { + CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].intervalSeconds); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].validitySeconds); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu); + } + } + return(ptr); +} + + +void* CsrWifiSmeRoamingConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeRoamingConfigGetCfm *primitive = (CsrWifiSmeRoamingConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamingConfigGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + { + CsrUint16 i2; + for (i2 = 0; i2 < 3; i2++) + { + CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamingBands[i2].rssiHighThreshold, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamingBands[i2].rssiLowThreshold, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamingBands[i2].snrHighThreshold, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamingBands[i2].snrLowThreshold, buffer, &offset); + } + } + CsrUint8Des((CsrUint8 *) &primitive->roamingConfig.disableSmoothRoaming, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->roamingConfig.disableRoamScans, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->roamingConfig.reconnectLimit, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.reconnectLimitIntervalMs, buffer, &offset); + { + CsrUint16 i2; + for (i2 = 0; i2 < 3; i2++) + { + CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].intervalSeconds, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].validitySeconds, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu, buffer, &offset); + } + } + + return primitive; +} + + +CsrSize CsrWifiSmeRoamingConfigSetCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeRoamingConfigSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeRoamingConfigSetCfm *primitive = (CsrWifiSmeRoamingConfigSetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiSmeRoamingConfigSetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeRoamingConfigSetCfm *primitive = (CsrWifiSmeRoamingConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamingConfigSetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeScanConfigGetCfmSizeof(void *msg) +{ + CsrWifiSmeScanConfigGetCfm *primitive = (CsrWifiSmeScanConfigGetCfm *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 65) */ + bufferSize += 2; /* CsrResult primitive->status */ + { + CsrUint16 i2; + for (i2 = 0; i2 < 4; i2++) + { + bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].intervalSeconds */ + bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].validitySeconds */ + bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu */ + bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu */ + bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu */ + bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu */ + } + } + bufferSize += 1; /* CsrBool primitive->scanConfig.disableAutonomousScans */ + bufferSize += 2; /* CsrUint16 primitive->scanConfig.maxResults */ + bufferSize += 1; /* CsrInt8 primitive->scanConfig.highRssiThreshold */ + bufferSize += 1; /* CsrInt8 primitive->scanConfig.lowRssiThreshold */ + bufferSize += 1; /* CsrInt8 primitive->scanConfig.deltaRssiThreshold */ + bufferSize += 1; /* CsrInt8 primitive->scanConfig.highSnrThreshold */ + bufferSize += 1; /* CsrInt8 primitive->scanConfig.lowSnrThreshold */ + bufferSize += 1; /* CsrInt8 primitive->scanConfig.deltaSnrThreshold */ + bufferSize += 2; /* CsrUint16 primitive->scanConfig.passiveChannelListCount */ + bufferSize += primitive->scanConfig.passiveChannelListCount; /* CsrUint8 primitive->scanConfig.passiveChannelList */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeScanConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeScanConfigGetCfm *primitive = (CsrWifiSmeScanConfigGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + { + CsrUint16 i2; + for (i2 = 0; i2 < 4; i2++) + { + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].intervalSeconds); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].validitySeconds); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu); + } + } + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.disableAutonomousScans); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.maxResults); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.highRssiThreshold); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.lowRssiThreshold); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.deltaRssiThreshold); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.highSnrThreshold); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.lowSnrThreshold); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.deltaSnrThreshold); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.passiveChannelListCount); + if (primitive->scanConfig.passiveChannelListCount) + { + CsrMemCpySer(ptr, len, (const void *) primitive->scanConfig.passiveChannelList, ((CsrUint16) (primitive->scanConfig.passiveChannelListCount))); + } + return(ptr); +} + + +void* CsrWifiSmeScanConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeScanConfigGetCfm *primitive = (CsrWifiSmeScanConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeScanConfigGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + { + CsrUint16 i2; + for (i2 = 0; i2 < 4; i2++) + { + CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].intervalSeconds, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].validitySeconds, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu, buffer, &offset); + } + } + CsrUint8Des((CsrUint8 *) &primitive->scanConfig.disableAutonomousScans, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->scanConfig.maxResults, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->scanConfig.highRssiThreshold, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->scanConfig.lowRssiThreshold, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->scanConfig.deltaRssiThreshold, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->scanConfig.highSnrThreshold, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->scanConfig.lowSnrThreshold, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->scanConfig.deltaSnrThreshold, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->scanConfig.passiveChannelListCount, buffer, &offset); + if (primitive->scanConfig.passiveChannelListCount) + { + primitive->scanConfig.passiveChannelList = (CsrUint8 *)CsrPmemAlloc(primitive->scanConfig.passiveChannelListCount); + CsrMemCpyDes(primitive->scanConfig.passiveChannelList, buffer, &offset, ((CsrUint16) (primitive->scanConfig.passiveChannelListCount))); + } + else + { + primitive->scanConfig.passiveChannelList = NULL; + } + + return primitive; +} + + +void CsrWifiSmeScanConfigGetCfmSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeScanConfigGetCfm *primitive = (CsrWifiSmeScanConfigGetCfm *) voidPrimitivePointer; + CsrPmemFree(primitive->scanConfig.passiveChannelList); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeScanResultIndSizeof(void *msg) +{ + CsrWifiSmeScanResultInd *primitive = (CsrWifiSmeScanResultInd *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 149) */ + bufferSize += 32; /* CsrUint8 primitive->result.ssid.ssid[32] */ + bufferSize += 1; /* CsrUint8 primitive->result.ssid.length */ + bufferSize += 6; /* CsrUint8 primitive->result.bssid.a[6] */ + bufferSize += 2; /* CsrInt16 primitive->result.rssi */ + bufferSize += 2; /* CsrInt16 primitive->result.snr */ + bufferSize += 1; /* CsrWifiSmeRadioIF primitive->result.ifIndex */ + bufferSize += 2; /* CsrUint16 primitive->result.beaconPeriodTu */ + bufferSize += 8; /* CsrUint8 primitive->result.timeStamp.data[8] */ + bufferSize += 8; /* CsrUint8 primitive->result.localTime.data[8] */ + bufferSize += 2; /* CsrUint16 primitive->result.channelFrequency */ + bufferSize += 2; /* CsrUint16 primitive->result.capabilityInformation */ + bufferSize += 1; /* CsrUint8 primitive->result.channelNumber */ + bufferSize += 1; /* CsrWifiSmeBasicUsability primitive->result.usability */ + bufferSize += 1; /* CsrWifiSmeBssType primitive->result.bssType */ + bufferSize += 2; /* CsrUint16 primitive->result.informationElementsLength */ + bufferSize += primitive->result.informationElementsLength; /* CsrUint8 primitive->result.informationElements */ + bufferSize += 1; /* CsrWifiSmeP2pRole primitive->result.p2pDeviceRole */ + switch (primitive->result.p2pDeviceRole) + { + case CSR_WIFI_SME_P2P_ROLE_CLI: + bufferSize += 1; /* CsrUint8 primitive->result.deviceInfo.reservedCli.empty */ + break; + case CSR_WIFI_SME_P2P_ROLE_GO: + bufferSize += 1; /* CsrWifiSmeP2pGroupCapabilityMask primitive->result.deviceInfo.groupInfo.groupCapability */ + bufferSize += 6; /* CsrUint8 primitive->result.deviceInfo.groupInfo.p2pDeviceAddress.a[6] */ + bufferSize += 1; /* CsrUint8 primitive->result.deviceInfo.groupInfo.p2pClientInfoCount */ + { + CsrUint16 i4; + for (i4 = 0; i4 < primitive->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++) + { + bufferSize += 6; /* CsrUint8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a[6] */ + bufferSize += 6; /* CsrUint8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a[6] */ + bufferSize += 2; /* CsrWifiSmeWpsConfigTypeMask primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods */ + bufferSize += 1; /* CsrWifiSmeP2pCapabilityMask primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap */ + bufferSize += 8; /* CsrUint8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails[8] */ + bufferSize += 1; /* CsrUint8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount */ + { + CsrUint16 i6; + for (i6 = 0; i6 < primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++) + { + bufferSize += 8; /* CsrUint8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails[8] */ + } + } + bufferSize += 32; /* CsrUint8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName[32] */ + bufferSize += 1; /* CsrUint8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength */ + } + } + break; + case CSR_WIFI_SME_P2P_ROLE_NONE: + bufferSize += 1; /* CsrUint8 primitive->result.deviceInfo.reservedNone.empty */ + break; + case CSR_WIFI_SME_P2P_ROLE_STANDALONE: + bufferSize += 6; /* CsrUint8 primitive->result.deviceInfo.standalonedevInfo.deviceAddress.a[6] */ + bufferSize += 2; /* CsrWifiSmeWpsConfigTypeMask primitive->result.deviceInfo.standalonedevInfo.configMethods */ + bufferSize += 1; /* CsrWifiSmeP2pCapabilityMask primitive->result.deviceInfo.standalonedevInfo.p2PDeviceCap */ + bufferSize += 8; /* CsrUint8 primitive->result.deviceInfo.standalonedevInfo.primDeviceType.deviceDetails[8] */ + bufferSize += 1; /* CsrUint8 primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount */ + { + CsrUint16 i4; + for (i4 = 0; i4 < primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++) + { + bufferSize += 8; /* CsrUint8 primitive->result.deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails[8] */ + } + } + bufferSize += 32; /* CsrUint8 primitive->result.deviceInfo.standalonedevInfo.deviceName[32] */ + bufferSize += 1; /* CsrUint8 primitive->result.deviceInfo.standalonedevInfo.deviceNameLength */ + break; + default: + break; + } + return bufferSize; +} + + +CsrUint8* CsrWifiSmeScanResultIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeScanResultInd *primitive = (CsrWifiSmeScanResultInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrMemCpySer(ptr, len, (const void *) primitive->result.ssid.ssid, ((CsrUint16) (32))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.ssid.length); + CsrMemCpySer(ptr, len, (const void *) primitive->result.bssid.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.rssi); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.snr); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.ifIndex); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.beaconPeriodTu); + CsrMemCpySer(ptr, len, (const void *) primitive->result.timeStamp.data, ((CsrUint16) (8))); + CsrMemCpySer(ptr, len, (const void *) primitive->result.localTime.data, ((CsrUint16) (8))); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.channelFrequency); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.capabilityInformation); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.channelNumber); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.usability); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.bssType); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.informationElementsLength); + if (primitive->result.informationElementsLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->result.informationElements, ((CsrUint16) (primitive->result.informationElementsLength))); + } + CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.p2pDeviceRole); + switch (primitive->result.p2pDeviceRole) + { + case CSR_WIFI_SME_P2P_ROLE_CLI: + CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.deviceInfo.reservedCli.empty); + break; + case CSR_WIFI_SME_P2P_ROLE_GO: + CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.deviceInfo.groupInfo.groupCapability); + CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2pDeviceAddress.a, ((CsrUint16) (6))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.deviceInfo.groupInfo.p2pClientInfoCount); + { + CsrUint16 i4; + for (i4 = 0; i4 < primitive->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++) + { + CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap); + CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, ((CsrUint16) (8))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount); + { + CsrUint16 i6; + for (i6 = 0; i6 < primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++) + { + CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails, ((CsrUint16) (8))); + } + } + CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, ((CsrUint16) (32))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength); + } + } + break; + case CSR_WIFI_SME_P2P_ROLE_NONE: + CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.deviceInfo.reservedNone.empty); + break; + case CSR_WIFI_SME_P2P_ROLE_STANDALONE: + CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.standalonedevInfo.deviceAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.deviceInfo.standalonedevInfo.configMethods); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.deviceInfo.standalonedevInfo.p2PDeviceCap); + CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, ((CsrUint16) (8))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount); + { + CsrUint16 i4; + for (i4 = 0; i4 < primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++) + { + CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails, ((CsrUint16) (8))); + } + } + CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.standalonedevInfo.deviceName, ((CsrUint16) (32))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.deviceInfo.standalonedevInfo.deviceNameLength); + break; + default: + break; + } + return(ptr); +} + + +void* CsrWifiSmeScanResultIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeScanResultInd *primitive = (CsrWifiSmeScanResultInd *) CsrPmemAlloc(sizeof(CsrWifiSmeScanResultInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrMemCpyDes(primitive->result.ssid.ssid, buffer, &offset, ((CsrUint16) (32))); + CsrUint8Des((CsrUint8 *) &primitive->result.ssid.length, buffer, &offset); + CsrMemCpyDes(primitive->result.bssid.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((CsrUint16 *) &primitive->result.rssi, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->result.snr, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->result.ifIndex, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->result.beaconPeriodTu, buffer, &offset); + CsrMemCpyDes(primitive->result.timeStamp.data, buffer, &offset, ((CsrUint16) (8))); + CsrMemCpyDes(primitive->result.localTime.data, buffer, &offset, ((CsrUint16) (8))); + CsrUint16Des((CsrUint16 *) &primitive->result.channelFrequency, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->result.capabilityInformation, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->result.channelNumber, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->result.usability, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->result.bssType, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->result.informationElementsLength, buffer, &offset); + if (primitive->result.informationElementsLength) + { + primitive->result.informationElements = (CsrUint8 *)CsrPmemAlloc(primitive->result.informationElementsLength); + CsrMemCpyDes(primitive->result.informationElements, buffer, &offset, ((CsrUint16) (primitive->result.informationElementsLength))); + } + else + { + primitive->result.informationElements = NULL; + } + CsrUint8Des((CsrUint8 *) &primitive->result.p2pDeviceRole, buffer, &offset); + switch (primitive->result.p2pDeviceRole) + { + case CSR_WIFI_SME_P2P_ROLE_CLI: + CsrUint8Des((CsrUint8 *) &primitive->result.deviceInfo.reservedCli.empty, buffer, &offset); + break; + case CSR_WIFI_SME_P2P_ROLE_GO: + CsrUint8Des((CsrUint8 *) &primitive->result.deviceInfo.groupInfo.groupCapability, buffer, &offset); + CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2pDeviceAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint8Des((CsrUint8 *) &primitive->result.deviceInfo.groupInfo.p2pClientInfoCount, buffer, &offset); + primitive->result.deviceInfo.groupInfo.p2PClientInfo = NULL; + if (primitive->result.deviceInfo.groupInfo.p2pClientInfoCount) + { + primitive->result.deviceInfo.groupInfo.p2PClientInfo = (CsrWifiSmeP2pClientInfoType *)CsrPmemAlloc(sizeof(CsrWifiSmeP2pClientInfoType) * primitive->result.deviceInfo.groupInfo.p2pClientInfoCount); + } + { + CsrUint16 i4; + for (i4 = 0; i4 < primitive->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++) + { + CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((CsrUint16 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap, buffer, &offset); + CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, buffer, &offset, ((CsrUint16) (8))); + CsrUint8Des((CsrUint8 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount, buffer, &offset); + primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL; + if (primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount) + { + primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = (CsrWifiSmeWpsDeviceType *)CsrPmemAlloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount); + } + { + CsrUint16 i6; + for (i6 = 0; i6 < primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++) + { + CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails, buffer, &offset, ((CsrUint16) (8))); + } + } + CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, buffer, &offset, ((CsrUint16) (32))); + CsrUint8Des((CsrUint8 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength, buffer, &offset); + } + } + break; + case CSR_WIFI_SME_P2P_ROLE_NONE: + CsrUint8Des((CsrUint8 *) &primitive->result.deviceInfo.reservedNone.empty, buffer, &offset); + break; + case CSR_WIFI_SME_P2P_ROLE_STANDALONE: + CsrMemCpyDes(primitive->result.deviceInfo.standalonedevInfo.deviceAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((CsrUint16 *) &primitive->result.deviceInfo.standalonedevInfo.configMethods, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->result.deviceInfo.standalonedevInfo.p2PDeviceCap, buffer, &offset); + CsrMemCpyDes(primitive->result.deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, buffer, &offset, ((CsrUint16) (8))); + CsrUint8Des((CsrUint8 *) &primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount, buffer, &offset); + primitive->result.deviceInfo.standalonedevInfo.secDeviceType = NULL; + if (primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount) + { + primitive->result.deviceInfo.standalonedevInfo.secDeviceType = (CsrWifiSmeWpsDeviceType *)CsrPmemAlloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount); + } + { + CsrUint16 i4; + for (i4 = 0; i4 < primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++) + { + CsrMemCpyDes(primitive->result.deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails, buffer, &offset, ((CsrUint16) (8))); + } + } + CsrMemCpyDes(primitive->result.deviceInfo.standalonedevInfo.deviceName, buffer, &offset, ((CsrUint16) (32))); + CsrUint8Des((CsrUint8 *) &primitive->result.deviceInfo.standalonedevInfo.deviceNameLength, buffer, &offset); + break; + default: + break; + } + + return primitive; +} + + +void CsrWifiSmeScanResultIndSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeScanResultInd *primitive = (CsrWifiSmeScanResultInd *) voidPrimitivePointer; + CsrPmemFree(primitive->result.informationElements); + switch (primitive->result.p2pDeviceRole) + { + case CSR_WIFI_SME_P2P_ROLE_GO: + { + CsrUint16 i4; + for (i4 = 0; i4 < primitive->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++) + { + CsrPmemFree(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType); + } + } + CsrPmemFree(primitive->result.deviceInfo.groupInfo.p2PClientInfo); + break; + case CSR_WIFI_SME_P2P_ROLE_STANDALONE: + CsrPmemFree(primitive->result.deviceInfo.standalonedevInfo.secDeviceType); + break; + default: + break; + } + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeScanResultsGetCfmSizeof(void *msg) +{ + CsrWifiSmeScanResultsGetCfm *primitive = (CsrWifiSmeScanResultsGetCfm *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 153) */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 2; /* CsrUint16 primitive->scanResultsCount */ + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->scanResultsCount; i1++) + { + bufferSize += 32; /* CsrUint8 primitive->scanResults[i1].ssid.ssid[32] */ + bufferSize += 1; /* CsrUint8 primitive->scanResults[i1].ssid.length */ + bufferSize += 6; /* CsrUint8 primitive->scanResults[i1].bssid.a[6] */ + bufferSize += 2; /* CsrInt16 primitive->scanResults[i1].rssi */ + bufferSize += 2; /* CsrInt16 primitive->scanResults[i1].snr */ + bufferSize += 1; /* CsrWifiSmeRadioIF primitive->scanResults[i1].ifIndex */ + bufferSize += 2; /* CsrUint16 primitive->scanResults[i1].beaconPeriodTu */ + bufferSize += 8; /* CsrUint8 primitive->scanResults[i1].timeStamp.data[8] */ + bufferSize += 8; /* CsrUint8 primitive->scanResults[i1].localTime.data[8] */ + bufferSize += 2; /* CsrUint16 primitive->scanResults[i1].channelFrequency */ + bufferSize += 2; /* CsrUint16 primitive->scanResults[i1].capabilityInformation */ + bufferSize += 1; /* CsrUint8 primitive->scanResults[i1].channelNumber */ + bufferSize += 1; /* CsrWifiSmeBasicUsability primitive->scanResults[i1].usability */ + bufferSize += 1; /* CsrWifiSmeBssType primitive->scanResults[i1].bssType */ + bufferSize += 2; /* CsrUint16 primitive->scanResults[i1].informationElementsLength */ + bufferSize += primitive->scanResults[i1].informationElementsLength; /* CsrUint8 primitive->scanResults[i1].informationElements */ + bufferSize += 1; /* CsrWifiSmeP2pRole primitive->scanResults[i1].p2pDeviceRole */ + switch (primitive->scanResults[i1].p2pDeviceRole) + { + case CSR_WIFI_SME_P2P_ROLE_CLI: + bufferSize += 1; /* CsrUint8 primitive->scanResults[i1].deviceInfo.reservedCli.empty */ + break; + case CSR_WIFI_SME_P2P_ROLE_GO: + bufferSize += 1; /* CsrWifiSmeP2pGroupCapabilityMask primitive->scanResults[i1].deviceInfo.groupInfo.groupCapability */ + bufferSize += 6; /* CsrUint8 primitive->scanResults[i1].deviceInfo.groupInfo.p2pDeviceAddress.a[6] */ + bufferSize += 1; /* CsrUint8 primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount */ + { + CsrUint16 i4; + for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++) + { + bufferSize += 6; /* CsrUint8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a[6] */ + bufferSize += 6; /* CsrUint8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a[6] */ + bufferSize += 2; /* CsrWifiSmeWpsConfigTypeMask primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods */ + bufferSize += 1; /* CsrWifiSmeP2pCapabilityMask primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap */ + bufferSize += 8; /* CsrUint8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails[8] */ + bufferSize += 1; /* CsrUint8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount */ + { + CsrUint16 i6; + for (i6 = 0; i6 < primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++) + { + bufferSize += 8; /* CsrUint8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails[8] */ + } + } + bufferSize += 32; /* CsrUint8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName[32] */ + bufferSize += 1; /* CsrUint8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength */ + } + } + break; + case CSR_WIFI_SME_P2P_ROLE_NONE: + bufferSize += 1; /* CsrUint8 primitive->scanResults[i1].deviceInfo.reservedNone.empty */ + break; + case CSR_WIFI_SME_P2P_ROLE_STANDALONE: + bufferSize += 6; /* CsrUint8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceAddress.a[6] */ + bufferSize += 2; /* CsrWifiSmeWpsConfigTypeMask primitive->scanResults[i1].deviceInfo.standalonedevInfo.configMethods */ + bufferSize += 1; /* CsrWifiSmeP2pCapabilityMask primitive->scanResults[i1].deviceInfo.standalonedevInfo.p2PDeviceCap */ + bufferSize += 8; /* CsrUint8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.primDeviceType.deviceDetails[8] */ + bufferSize += 1; /* CsrUint8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount */ + { + CsrUint16 i4; + for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++) + { + bufferSize += 8; /* CsrUint8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails[8] */ + } + } + bufferSize += 32; /* CsrUint8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceName[32] */ + bufferSize += 1; /* CsrUint8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceNameLength */ + break; + default: + break; + } + } + } + return bufferSize; +} + + +CsrUint8* CsrWifiSmeScanResultsGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeScanResultsGetCfm *primitive = (CsrWifiSmeScanResultsGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResultsCount); + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->scanResultsCount; i1++) + { + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].ssid.ssid, ((CsrUint16) (32))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].ssid.length); + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].bssid.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].rssi); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].snr); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].ifIndex); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].beaconPeriodTu); + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].timeStamp.data, ((CsrUint16) (8))); + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].localTime.data, ((CsrUint16) (8))); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].channelFrequency); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].capabilityInformation); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].channelNumber); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].usability); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].bssType); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].informationElementsLength); + if (primitive->scanResults[i1].informationElementsLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].informationElements, ((CsrUint16) (primitive->scanResults[i1].informationElementsLength))); + } + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].p2pDeviceRole); + switch (primitive->scanResults[i1].p2pDeviceRole) + { + case CSR_WIFI_SME_P2P_ROLE_CLI: + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].deviceInfo.reservedCli.empty); + break; + case CSR_WIFI_SME_P2P_ROLE_GO: + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].deviceInfo.groupInfo.groupCapability); + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2pDeviceAddress.a, ((CsrUint16) (6))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount); + { + CsrUint16 i4; + for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++) + { + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap); + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, ((CsrUint16) (8))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount); + { + CsrUint16 i6; + for (i6 = 0; i6 < primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++) + { + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails, ((CsrUint16) (8))); + } + } + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, ((CsrUint16) (32))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength); + } + } + break; + case CSR_WIFI_SME_P2P_ROLE_NONE: + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].deviceInfo.reservedNone.empty); + break; + case CSR_WIFI_SME_P2P_ROLE_STANDALONE: + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].deviceInfo.standalonedevInfo.configMethods); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].deviceInfo.standalonedevInfo.p2PDeviceCap); + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, ((CsrUint16) (8))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount); + { + CsrUint16 i4; + for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++) + { + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails, ((CsrUint16) (8))); + } + } + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceName, ((CsrUint16) (32))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceNameLength); + break; + default: + break; + } + } + } + return(ptr); +} + + +void* CsrWifiSmeScanResultsGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeScanResultsGetCfm *primitive = (CsrWifiSmeScanResultsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeScanResultsGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->scanResultsCount, buffer, &offset); + primitive->scanResults = NULL; + if (primitive->scanResultsCount) + { + primitive->scanResults = (CsrWifiSmeScanResult *)CsrPmemAlloc(sizeof(CsrWifiSmeScanResult) * primitive->scanResultsCount); + } + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->scanResultsCount; i1++) + { + CsrMemCpyDes(primitive->scanResults[i1].ssid.ssid, buffer, &offset, ((CsrUint16) (32))); + CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].ssid.length, buffer, &offset); + CsrMemCpyDes(primitive->scanResults[i1].bssid.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].rssi, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].snr, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].ifIndex, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].beaconPeriodTu, buffer, &offset); + CsrMemCpyDes(primitive->scanResults[i1].timeStamp.data, buffer, &offset, ((CsrUint16) (8))); + CsrMemCpyDes(primitive->scanResults[i1].localTime.data, buffer, &offset, ((CsrUint16) (8))); + CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].channelFrequency, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].capabilityInformation, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].channelNumber, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].usability, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].bssType, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].informationElementsLength, buffer, &offset); + if (primitive->scanResults[i1].informationElementsLength) + { + primitive->scanResults[i1].informationElements = (CsrUint8 *)CsrPmemAlloc(primitive->scanResults[i1].informationElementsLength); + CsrMemCpyDes(primitive->scanResults[i1].informationElements, buffer, &offset, ((CsrUint16) (primitive->scanResults[i1].informationElementsLength))); + } + else + { + primitive->scanResults[i1].informationElements = NULL; + } + CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].p2pDeviceRole, buffer, &offset); + switch (primitive->scanResults[i1].p2pDeviceRole) + { + case CSR_WIFI_SME_P2P_ROLE_CLI: + CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].deviceInfo.reservedCli.empty, buffer, &offset); + break; + case CSR_WIFI_SME_P2P_ROLE_GO: + CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.groupCapability, buffer, &offset); + CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2pDeviceAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount, buffer, &offset); + primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo = NULL; + if (primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount) + { + primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo = (CsrWifiSmeP2pClientInfoType *)CsrPmemAlloc(sizeof(CsrWifiSmeP2pClientInfoType) * primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount); + } + { + CsrUint16 i4; + for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++) + { + CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap, buffer, &offset); + CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, buffer, &offset, ((CsrUint16) (8))); + CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount, buffer, &offset); + primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL; + if (primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount) + { + primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = (CsrWifiSmeWpsDeviceType *)CsrPmemAlloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount); + } + { + CsrUint16 i6; + for (i6 = 0; i6 < primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++) + { + CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails, buffer, &offset, ((CsrUint16) (8))); + } + } + CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, buffer, &offset, ((CsrUint16) (32))); + CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength, buffer, &offset); + } + } + break; + case CSR_WIFI_SME_P2P_ROLE_NONE: + CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].deviceInfo.reservedNone.empty, buffer, &offset); + break; + case CSR_WIFI_SME_P2P_ROLE_STANDALONE: + CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.configMethods, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.p2PDeviceCap, buffer, &offset); + CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, buffer, &offset, ((CsrUint16) (8))); + CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount, buffer, &offset); + primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType = NULL; + if (primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount) + { + primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType = (CsrWifiSmeWpsDeviceType *)CsrPmemAlloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount); + } + { + CsrUint16 i4; + for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++) + { + CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails, buffer, &offset, ((CsrUint16) (8))); + } + } + CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceName, buffer, &offset, ((CsrUint16) (32))); + CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceNameLength, buffer, &offset); + break; + default: + break; + } + } + } + + return primitive; +} + + +void CsrWifiSmeScanResultsGetCfmSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeScanResultsGetCfm *primitive = (CsrWifiSmeScanResultsGetCfm *) voidPrimitivePointer; + { + CsrUint16 i1; + for (i1 = 0; i1 < primitive->scanResultsCount; i1++) + { + CsrPmemFree(primitive->scanResults[i1].informationElements); + switch (primitive->scanResults[i1].p2pDeviceRole) + { + case CSR_WIFI_SME_P2P_ROLE_GO: + { + CsrUint16 i4; + for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++) + { + CsrPmemFree(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType); + } + } + CsrPmemFree(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo); + break; + case CSR_WIFI_SME_P2P_ROLE_STANDALONE: + CsrPmemFree(primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType); + break; + default: + break; + } + } + } + CsrPmemFree(primitive->scanResults); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeSmeStaConfigGetCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 1; /* CsrUint8 primitive->smeConfig.connectionQualityRssiChangeTrigger */ + bufferSize += 1; /* CsrUint8 primitive->smeConfig.connectionQualitySnrChangeTrigger */ + bufferSize += 1; /* CsrUint8 primitive->smeConfig.wmmModeMask */ + bufferSize += 1; /* CsrWifiSmeRadioIF primitive->smeConfig.ifIndex */ + bufferSize += 1; /* CsrBool primitive->smeConfig.allowUnicastUseGroupCipher */ + bufferSize += 1; /* CsrBool primitive->smeConfig.enableOpportunisticKeyCaching */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeSmeStaConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeSmeStaConfigGetCfm *primitive = (CsrWifiSmeSmeStaConfigGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.connectionQualityRssiChangeTrigger); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.connectionQualitySnrChangeTrigger); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.wmmModeMask); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.ifIndex); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.allowUnicastUseGroupCipher); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.enableOpportunisticKeyCaching); + return(ptr); +} + + +void* CsrWifiSmeSmeStaConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeSmeStaConfigGetCfm *primitive = (CsrWifiSmeSmeStaConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeStaConfigGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->smeConfig.connectionQualityRssiChangeTrigger, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->smeConfig.connectionQualitySnrChangeTrigger, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->smeConfig.wmmModeMask, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->smeConfig.ifIndex, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->smeConfig.allowUnicastUseGroupCipher, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->smeConfig.enableOpportunisticKeyCaching, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeSmeStaConfigSetCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeSmeStaConfigSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeSmeStaConfigSetCfm *primitive = (CsrWifiSmeSmeStaConfigSetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiSmeSmeStaConfigSetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeSmeStaConfigSetCfm *primitive = (CsrWifiSmeSmeStaConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeStaConfigSetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeStationMacAddressGetCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */ + bufferSize += 2; /* CsrResult primitive->status */ + { + CsrUint16 i1; + for (i1 = 0; i1 < 2; i1++) + { + bufferSize += 6; /* CsrUint8 primitive->stationMacAddress[i1].a[6] */ + } + } + return bufferSize; +} + + +CsrUint8* CsrWifiSmeStationMacAddressGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeStationMacAddressGetCfm *primitive = (CsrWifiSmeStationMacAddressGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + { + CsrUint16 i1; + for (i1 = 0; i1 < 2; i1++) + { + CsrMemCpySer(ptr, len, (const void *) primitive->stationMacAddress[i1].a, ((CsrUint16) (6))); + } + } + return(ptr); +} + + +void* CsrWifiSmeStationMacAddressGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeStationMacAddressGetCfm *primitive = (CsrWifiSmeStationMacAddressGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeStationMacAddressGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + { + CsrUint16 i1; + for (i1 = 0; i1 < 2; i1++) + { + CsrMemCpyDes(primitive->stationMacAddress[i1].a, buffer, &offset, ((CsrUint16) (6))); + } + } + + return primitive; +} + + +CsrSize CsrWifiSmeTspecIndSizeof(void *msg) +{ + CsrWifiSmeTspecInd *primitive = (CsrWifiSmeTspecInd *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 4; /* CsrUint32 primitive->transactionId */ + bufferSize += 1; /* CsrWifiSmeTspecResultCode primitive->tspecResultCode */ + bufferSize += 2; /* CsrUint16 primitive->tspecLength */ + bufferSize += primitive->tspecLength; /* CsrUint8 primitive->tspec */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeTspecIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeTspecInd *primitive = (CsrWifiSmeTspecInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->transactionId); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->tspecResultCode); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->tspecLength); + if (primitive->tspecLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->tspec, ((CsrUint16) (primitive->tspecLength))); + } + return(ptr); +} + + +void* CsrWifiSmeTspecIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeTspecInd *primitive = (CsrWifiSmeTspecInd *) CsrPmemAlloc(sizeof(CsrWifiSmeTspecInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->transactionId, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->tspecResultCode, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->tspecLength, buffer, &offset); + if (primitive->tspecLength) + { + primitive->tspec = (CsrUint8 *)CsrPmemAlloc(primitive->tspecLength); + CsrMemCpyDes(primitive->tspec, buffer, &offset, ((CsrUint16) (primitive->tspecLength))); + } + else + { + primitive->tspec = NULL; + } + + return primitive; +} + + +void CsrWifiSmeTspecIndSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeTspecInd *primitive = (CsrWifiSmeTspecInd *) voidPrimitivePointer; + CsrPmemFree(primitive->tspec); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeTspecCfmSizeof(void *msg) +{ + CsrWifiSmeTspecCfm *primitive = (CsrWifiSmeTspecCfm *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 4; /* CsrUint32 primitive->transactionId */ + bufferSize += 1; /* CsrWifiSmeTspecResultCode primitive->tspecResultCode */ + bufferSize += 2; /* CsrUint16 primitive->tspecLength */ + bufferSize += primitive->tspecLength; /* CsrUint8 primitive->tspec */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeTspecCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeTspecCfm *primitive = (CsrWifiSmeTspecCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->transactionId); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->tspecResultCode); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->tspecLength); + if (primitive->tspecLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->tspec, ((CsrUint16) (primitive->tspecLength))); + } + return(ptr); +} + + +void* CsrWifiSmeTspecCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeTspecCfm *primitive = (CsrWifiSmeTspecCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeTspecCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->transactionId, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->tspecResultCode, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->tspecLength, buffer, &offset); + if (primitive->tspecLength) + { + primitive->tspec = (CsrUint8 *)CsrPmemAlloc(primitive->tspecLength); + CsrMemCpyDes(primitive->tspec, buffer, &offset, ((CsrUint16) (primitive->tspecLength))); + } + else + { + primitive->tspec = NULL; + } + + return primitive; +} + + +void CsrWifiSmeTspecCfmSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeTspecCfm *primitive = (CsrWifiSmeTspecCfm *) voidPrimitivePointer; + CsrPmemFree(primitive->tspec); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeVersionsGetCfmSizeof(void *msg) +{ + CsrWifiSmeVersionsGetCfm *primitive = (CsrWifiSmeVersionsGetCfm *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 33) */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 4; /* CsrUint32 primitive->versions.chipId */ + bufferSize += 4; /* CsrUint32 primitive->versions.chipVersion */ + bufferSize += 4; /* CsrUint32 primitive->versions.firmwareBuild */ + bufferSize += 4; /* CsrUint32 primitive->versions.firmwarePatch */ + bufferSize += 4; /* CsrUint32 primitive->versions.firmwareHip */ + bufferSize += (primitive->versions.routerBuild?CsrStrLen(primitive->versions.routerBuild) : 0) + 1; /* CsrCharString* primitive->versions.routerBuild (0 byte len + 1 for NULL Term) */ + bufferSize += 4; /* CsrUint32 primitive->versions.routerHip */ + bufferSize += (primitive->versions.smeBuild?CsrStrLen(primitive->versions.smeBuild) : 0) + 1; /* CsrCharString* primitive->versions.smeBuild (0 byte len + 1 for NULL Term) */ + bufferSize += 4; /* CsrUint32 primitive->versions.smeHip */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeVersionsGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeVersionsGetCfm *primitive = (CsrWifiSmeVersionsGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.chipId); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.chipVersion); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.firmwareBuild); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.firmwarePatch); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.firmwareHip); + CsrCharStringSer(ptr, len, primitive->versions.routerBuild); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.routerHip); + CsrCharStringSer(ptr, len, primitive->versions.smeBuild); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.smeHip); + return(ptr); +} + + +void* CsrWifiSmeVersionsGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeVersionsGetCfm *primitive = (CsrWifiSmeVersionsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeVersionsGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->versions.chipId, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->versions.chipVersion, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->versions.firmwareBuild, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->versions.firmwarePatch, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->versions.firmwareHip, buffer, &offset); + CsrCharStringDes(&primitive->versions.routerBuild, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->versions.routerHip, buffer, &offset); + CsrCharStringDes(&primitive->versions.smeBuild, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->versions.smeHip, buffer, &offset); + + return primitive; +} + + +void CsrWifiSmeVersionsGetCfmSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeVersionsGetCfm *primitive = (CsrWifiSmeVersionsGetCfm *) voidPrimitivePointer; + CsrPmemFree(primitive->versions.routerBuild); + CsrPmemFree(primitive->versions.smeBuild); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeCloakedSsidsGetCfmSizeof(void *msg) +{ + CsrWifiSmeCloakedSsidsGetCfm *primitive = (CsrWifiSmeCloakedSsidsGetCfm *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 39) */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 1; /* CsrUint8 primitive->cloakedSsids.cloakedSsidsCount */ + { + CsrUint16 i2; + for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) + { + bufferSize += 32; /* CsrUint8 primitive->cloakedSsids.cloakedSsids[i2].ssid[32] */ + bufferSize += 1; /* CsrUint8 primitive->cloakedSsids.cloakedSsids[i2].length */ + } + } + return bufferSize; +} + + +CsrUint8* CsrWifiSmeCloakedSsidsGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeCloakedSsidsGetCfm *primitive = (CsrWifiSmeCloakedSsidsGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->cloakedSsids.cloakedSsidsCount); + { + CsrUint16 i2; + for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) + { + CsrMemCpySer(ptr, len, (const void *) primitive->cloakedSsids.cloakedSsids[i2].ssid, ((CsrUint16) (32))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->cloakedSsids.cloakedSsids[i2].length); + } + } + return(ptr); +} + + +void* CsrWifiSmeCloakedSsidsGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeCloakedSsidsGetCfm *primitive = (CsrWifiSmeCloakedSsidsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCloakedSsidsGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->cloakedSsids.cloakedSsidsCount, buffer, &offset); + primitive->cloakedSsids.cloakedSsids = NULL; + if (primitive->cloakedSsids.cloakedSsidsCount) + { + primitive->cloakedSsids.cloakedSsids = (CsrWifiSsid *)CsrPmemAlloc(sizeof(CsrWifiSsid) * primitive->cloakedSsids.cloakedSsidsCount); + } + { + CsrUint16 i2; + for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) + { + CsrMemCpyDes(primitive->cloakedSsids.cloakedSsids[i2].ssid, buffer, &offset, ((CsrUint16) (32))); + CsrUint8Des((CsrUint8 *) &primitive->cloakedSsids.cloakedSsids[i2].length, buffer, &offset); + } + } + + return primitive; +} + + +void CsrWifiSmeCloakedSsidsGetCfmSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeCloakedSsidsGetCfm *primitive = (CsrWifiSmeCloakedSsidsGetCfm *) voidPrimitivePointer; + CsrPmemFree(primitive->cloakedSsids.cloakedSsids); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeWifiOnIndSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ + bufferSize += 6; /* CsrUint8 primitive->address.a[6] */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeWifiOnIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeWifiOnInd *primitive = (CsrWifiSmeWifiOnInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((CsrUint16) (6))); + return(ptr); +} + + +void* CsrWifiSmeWifiOnIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeWifiOnInd *primitive = (CsrWifiSmeWifiOnInd *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiOnInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrMemCpyDes(primitive->address.a, buffer, &offset, ((CsrUint16) (6))); + + return primitive; +} + + +CsrSize CsrWifiSmeSmeCommonConfigGetCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 1; /* CsrWifiSme80211dTrustLevel primitive->deviceConfig.trustLevel */ + bufferSize += 2; /* CsrUint8 primitive->deviceConfig.countryCode[2] */ + bufferSize += 1; /* CsrWifiSmeFirmwareDriverInterface primitive->deviceConfig.firmwareDriverInterface */ + bufferSize += 1; /* CsrBool primitive->deviceConfig.enableStrictDraftN */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeSmeCommonConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeSmeCommonConfigGetCfm *primitive = (CsrWifiSmeSmeCommonConfigGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->deviceConfig.trustLevel); + CsrMemCpySer(ptr, len, (const void *) primitive->deviceConfig.countryCode, ((CsrUint16) (2))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->deviceConfig.firmwareDriverInterface); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->deviceConfig.enableStrictDraftN); + return(ptr); +} + + +void* CsrWifiSmeSmeCommonConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeSmeCommonConfigGetCfm *primitive = (CsrWifiSmeSmeCommonConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeCommonConfigGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->deviceConfig.trustLevel, buffer, &offset); + CsrMemCpyDes(primitive->deviceConfig.countryCode, buffer, &offset, ((CsrUint16) (2))); + CsrUint8Des((CsrUint8 *) &primitive->deviceConfig.firmwareDriverInterface, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->deviceConfig.enableStrictDraftN, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiSmeInterfaceCapabilityGetCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 2; /* CsrUint16 primitive->numInterfaces */ + bufferSize += 2; /* CsrUint8 primitive->capBitmap[2] */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeInterfaceCapabilityGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeInterfaceCapabilityGetCfm *primitive = (CsrWifiSmeInterfaceCapabilityGetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->numInterfaces); + CsrMemCpySer(ptr, len, (const void *) primitive->capBitmap, ((CsrUint16) (2))); + return(ptr); +} + + +void* CsrWifiSmeInterfaceCapabilityGetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeInterfaceCapabilityGetCfm *primitive = (CsrWifiSmeInterfaceCapabilityGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeInterfaceCapabilityGetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->numInterfaces, buffer, &offset); + CsrMemCpyDes(primitive->capBitmap, buffer, &offset, ((CsrUint16) (2))); + + return primitive; +} + + +CsrSize CsrWifiSmeErrorIndSizeof(void *msg) +{ + CsrWifiSmeErrorInd *primitive = (CsrWifiSmeErrorInd *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 3) */ + bufferSize += (primitive->errorMessage?CsrStrLen(primitive->errorMessage) : 0) + 1; /* CsrCharString* primitive->errorMessage (0 byte len + 1 for NULL Term) */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeErrorIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeErrorInd *primitive = (CsrWifiSmeErrorInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrCharStringSer(ptr, len, primitive->errorMessage); + return(ptr); +} + + +void* CsrWifiSmeErrorIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeErrorInd *primitive = (CsrWifiSmeErrorInd *) CsrPmemAlloc(sizeof(CsrWifiSmeErrorInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrCharStringDes(&primitive->errorMessage, buffer, &offset); + + return primitive; +} + + +void CsrWifiSmeErrorIndSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeErrorInd *primitive = (CsrWifiSmeErrorInd *) voidPrimitivePointer; + CsrPmemFree(primitive->errorMessage); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeInfoIndSizeof(void *msg) +{ + CsrWifiSmeInfoInd *primitive = (CsrWifiSmeInfoInd *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 3) */ + bufferSize += (primitive->infoMessage?CsrStrLen(primitive->infoMessage) : 0) + 1; /* CsrCharString* primitive->infoMessage (0 byte len + 1 for NULL Term) */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeInfoIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeInfoInd *primitive = (CsrWifiSmeInfoInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrCharStringSer(ptr, len, primitive->infoMessage); + return(ptr); +} + + +void* CsrWifiSmeInfoIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeInfoInd *primitive = (CsrWifiSmeInfoInd *) CsrPmemAlloc(sizeof(CsrWifiSmeInfoInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrCharStringDes(&primitive->infoMessage, buffer, &offset); + + return primitive; +} + + +void CsrWifiSmeInfoIndSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeInfoInd *primitive = (CsrWifiSmeInfoInd *) voidPrimitivePointer; + CsrPmemFree(primitive->infoMessage); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiSmeCoreDumpIndSizeof(void *msg) +{ + CsrWifiSmeCoreDumpInd *primitive = (CsrWifiSmeCoreDumpInd *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ + bufferSize += 4; /* CsrUint32 primitive->dataLength */ + bufferSize += primitive->dataLength; /* CsrUint8 primitive->data */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeCoreDumpIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeCoreDumpInd *primitive = (CsrWifiSmeCoreDumpInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->dataLength); + if (primitive->dataLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->data, ((CsrUint16) (primitive->dataLength))); + } + return(ptr); +} + + +void* CsrWifiSmeCoreDumpIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeCoreDumpInd *primitive = (CsrWifiSmeCoreDumpInd *) CsrPmemAlloc(sizeof(CsrWifiSmeCoreDumpInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->dataLength, buffer, &offset); + if (primitive->dataLength) + { + primitive->data = (CsrUint8 *)CsrPmemAlloc(primitive->dataLength); + CsrMemCpyDes(primitive->data, buffer, &offset, ((CsrUint16) (primitive->dataLength))); + } + else + { + primitive->data = NULL; + } + + return primitive; +} + + +void CsrWifiSmeCoreDumpIndSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeCoreDumpInd *primitive = (CsrWifiSmeCoreDumpInd *) voidPrimitivePointer; + CsrPmemFree(primitive->data); + CsrPmemFree(primitive); +} + + diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.h b/drivers/staging/csr/csr_wifi_sme_serialize.h new file mode 100644 index 0000000..c2d7fd6 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_sme_serialize.h @@ -0,0 +1,668 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_SME_SERIALIZE_H__ +#define CSR_WIFI_SME_SERIALIZE_H__ + +#include "csr_types.h" +#include "csr_pmem.h" +#include "csr_wifi_msgconv.h" + +#include "csr_wifi_sme_prim.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern void CsrWifiSmePfree(void *ptr); + +#define CsrWifiSmeActivateReqSer CsrWifiEventSer +#define CsrWifiSmeActivateReqDes CsrWifiEventDes +#define CsrWifiSmeActivateReqSizeof CsrWifiEventSizeof +#define CsrWifiSmeActivateReqSerFree CsrWifiSmePfree + +#define CsrWifiSmeAdhocConfigGetReqSer CsrWifiEventSer +#define CsrWifiSmeAdhocConfigGetReqDes CsrWifiEventDes +#define CsrWifiSmeAdhocConfigGetReqSizeof CsrWifiEventSizeof +#define CsrWifiSmeAdhocConfigGetReqSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeAdhocConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeAdhocConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeAdhocConfigSetReqSizeof(void *msg); +#define CsrWifiSmeAdhocConfigSetReqSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeBlacklistReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeBlacklistReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeBlacklistReqSizeof(void *msg); +extern void CsrWifiSmeBlacklistReqSerFree(void *msg); + +#define CsrWifiSmeCalibrationDataGetReqSer CsrWifiEventSer +#define CsrWifiSmeCalibrationDataGetReqDes CsrWifiEventDes +#define CsrWifiSmeCalibrationDataGetReqSizeof CsrWifiEventSizeof +#define CsrWifiSmeCalibrationDataGetReqSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeCalibrationDataSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeCalibrationDataSetReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeCalibrationDataSetReqSizeof(void *msg); +extern void CsrWifiSmeCalibrationDataSetReqSerFree(void *msg); + +#define CsrWifiSmeCcxConfigGetReqSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeCcxConfigGetReqDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeCcxConfigGetReqSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeCcxConfigGetReqSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeCcxConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeCcxConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeCcxConfigSetReqSizeof(void *msg); +#define CsrWifiSmeCcxConfigSetReqSerFree CsrWifiSmePfree + +#define CsrWifiSmeCoexConfigGetReqSer CsrWifiEventSer +#define CsrWifiSmeCoexConfigGetReqDes CsrWifiEventDes +#define CsrWifiSmeCoexConfigGetReqSizeof CsrWifiEventSizeof +#define CsrWifiSmeCoexConfigGetReqSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeCoexConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeCoexConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeCoexConfigSetReqSizeof(void *msg); +#define CsrWifiSmeCoexConfigSetReqSerFree CsrWifiSmePfree + +#define CsrWifiSmeCoexInfoGetReqSer CsrWifiEventSer +#define CsrWifiSmeCoexInfoGetReqDes CsrWifiEventDes +#define CsrWifiSmeCoexInfoGetReqSizeof CsrWifiEventSizeof +#define CsrWifiSmeCoexInfoGetReqSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeConnectReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeConnectReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeConnectReqSizeof(void *msg); +extern void CsrWifiSmeConnectReqSerFree(void *msg); + +#define CsrWifiSmeConnectionConfigGetReqSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeConnectionConfigGetReqDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeConnectionConfigGetReqSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeConnectionConfigGetReqSerFree CsrWifiSmePfree + +#define CsrWifiSmeConnectionInfoGetReqSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeConnectionInfoGetReqDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeConnectionInfoGetReqSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeConnectionInfoGetReqSerFree CsrWifiSmePfree + +#define CsrWifiSmeConnectionStatsGetReqSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeConnectionStatsGetReqDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeConnectionStatsGetReqSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeConnectionStatsGetReqSerFree CsrWifiSmePfree + +#define CsrWifiSmeDeactivateReqSer CsrWifiEventSer +#define CsrWifiSmeDeactivateReqDes CsrWifiEventDes +#define CsrWifiSmeDeactivateReqSizeof CsrWifiEventSizeof +#define CsrWifiSmeDeactivateReqSerFree CsrWifiSmePfree + +#define CsrWifiSmeDisconnectReqSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeDisconnectReqDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeDisconnectReqSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeDisconnectReqSerFree CsrWifiSmePfree + +#define CsrWifiSmeEventMaskSetReqSer CsrWifiEventCsrUint32Ser +#define CsrWifiSmeEventMaskSetReqDes CsrWifiEventCsrUint32Des +#define CsrWifiSmeEventMaskSetReqSizeof CsrWifiEventCsrUint32Sizeof +#define CsrWifiSmeEventMaskSetReqSerFree CsrWifiSmePfree + +#define CsrWifiSmeHostConfigGetReqSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeHostConfigGetReqDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeHostConfigGetReqSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeHostConfigGetReqSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeHostConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeHostConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeHostConfigSetReqSizeof(void *msg); +#define CsrWifiSmeHostConfigSetReqSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeKeyReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeKeyReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeKeyReqSizeof(void *msg); +#define CsrWifiSmeKeyReqSerFree CsrWifiSmePfree + +#define CsrWifiSmeLinkQualityGetReqSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeLinkQualityGetReqDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeLinkQualityGetReqSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeLinkQualityGetReqSerFree CsrWifiSmePfree + +#define CsrWifiSmeMibConfigGetReqSer CsrWifiEventSer +#define CsrWifiSmeMibConfigGetReqDes CsrWifiEventDes +#define CsrWifiSmeMibConfigGetReqSizeof CsrWifiEventSizeof +#define CsrWifiSmeMibConfigGetReqSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeMibConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeMibConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeMibConfigSetReqSizeof(void *msg); +#define CsrWifiSmeMibConfigSetReqSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeMibGetNextReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeMibGetNextReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeMibGetNextReqSizeof(void *msg); +extern void CsrWifiSmeMibGetNextReqSerFree(void *msg); + +extern CsrUint8* CsrWifiSmeMibGetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeMibGetReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeMibGetReqSizeof(void *msg); +extern void CsrWifiSmeMibGetReqSerFree(void *msg); + +extern CsrUint8* CsrWifiSmeMibSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeMibSetReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeMibSetReqSizeof(void *msg); +extern void CsrWifiSmeMibSetReqSerFree(void *msg); + +extern CsrUint8* CsrWifiSmeMulticastAddressReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeMulticastAddressReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeMulticastAddressReqSizeof(void *msg); +extern void CsrWifiSmeMulticastAddressReqSerFree(void *msg); + +extern CsrUint8* CsrWifiSmePacketFilterSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmePacketFilterSetReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmePacketFilterSetReqSizeof(void *msg); +extern void CsrWifiSmePacketFilterSetReqSerFree(void *msg); + +#define CsrWifiSmePermanentMacAddressGetReqSer CsrWifiEventSer +#define CsrWifiSmePermanentMacAddressGetReqDes CsrWifiEventDes +#define CsrWifiSmePermanentMacAddressGetReqSizeof CsrWifiEventSizeof +#define CsrWifiSmePermanentMacAddressGetReqSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmePmkidReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmePmkidReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmePmkidReqSizeof(void *msg); +extern void CsrWifiSmePmkidReqSerFree(void *msg); + +#define CsrWifiSmePowerConfigGetReqSer CsrWifiEventSer +#define CsrWifiSmePowerConfigGetReqDes CsrWifiEventDes +#define CsrWifiSmePowerConfigGetReqSizeof CsrWifiEventSizeof +#define CsrWifiSmePowerConfigGetReqSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmePowerConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmePowerConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmePowerConfigSetReqSizeof(void *msg); +#define CsrWifiSmePowerConfigSetReqSerFree CsrWifiSmePfree + +#define CsrWifiSmeRegulatoryDomainInfoGetReqSer CsrWifiEventSer +#define CsrWifiSmeRegulatoryDomainInfoGetReqDes CsrWifiEventDes +#define CsrWifiSmeRegulatoryDomainInfoGetReqSizeof CsrWifiEventSizeof +#define CsrWifiSmeRegulatoryDomainInfoGetReqSerFree CsrWifiSmePfree + +#define CsrWifiSmeRoamingConfigGetReqSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeRoamingConfigGetReqDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeRoamingConfigGetReqSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeRoamingConfigGetReqSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeRoamingConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeRoamingConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeRoamingConfigSetReqSizeof(void *msg); +#define CsrWifiSmeRoamingConfigSetReqSerFree CsrWifiSmePfree + +#define CsrWifiSmeScanConfigGetReqSer CsrWifiEventSer +#define CsrWifiSmeScanConfigGetReqDes CsrWifiEventDes +#define CsrWifiSmeScanConfigGetReqSizeof CsrWifiEventSizeof +#define CsrWifiSmeScanConfigGetReqSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeScanConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeScanConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeScanConfigSetReqSizeof(void *msg); +extern void CsrWifiSmeScanConfigSetReqSerFree(void *msg); + +extern CsrUint8* CsrWifiSmeScanFullReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeScanFullReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeScanFullReqSizeof(void *msg); +extern void CsrWifiSmeScanFullReqSerFree(void *msg); + +#define CsrWifiSmeScanResultsFlushReqSer CsrWifiEventSer +#define CsrWifiSmeScanResultsFlushReqDes CsrWifiEventDes +#define CsrWifiSmeScanResultsFlushReqSizeof CsrWifiEventSizeof +#define CsrWifiSmeScanResultsFlushReqSerFree CsrWifiSmePfree + +#define CsrWifiSmeScanResultsGetReqSer CsrWifiEventSer +#define CsrWifiSmeScanResultsGetReqDes CsrWifiEventDes +#define CsrWifiSmeScanResultsGetReqSizeof CsrWifiEventSizeof +#define CsrWifiSmeScanResultsGetReqSerFree CsrWifiSmePfree + +#define CsrWifiSmeSmeStaConfigGetReqSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeSmeStaConfigGetReqDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeSmeStaConfigGetReqSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeSmeStaConfigGetReqSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeSmeStaConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeSmeStaConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeSmeStaConfigSetReqSizeof(void *msg); +#define CsrWifiSmeSmeStaConfigSetReqSerFree CsrWifiSmePfree + +#define CsrWifiSmeStationMacAddressGetReqSer CsrWifiEventSer +#define CsrWifiSmeStationMacAddressGetReqDes CsrWifiEventDes +#define CsrWifiSmeStationMacAddressGetReqSizeof CsrWifiEventSizeof +#define CsrWifiSmeStationMacAddressGetReqSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeTspecReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeTspecReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeTspecReqSizeof(void *msg); +extern void CsrWifiSmeTspecReqSerFree(void *msg); + +#define CsrWifiSmeVersionsGetReqSer CsrWifiEventSer +#define CsrWifiSmeVersionsGetReqDes CsrWifiEventDes +#define CsrWifiSmeVersionsGetReqSizeof CsrWifiEventSizeof +#define CsrWifiSmeVersionsGetReqSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeWifiFlightmodeReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeWifiFlightmodeReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeWifiFlightmodeReqSizeof(void *msg); +extern void CsrWifiSmeWifiFlightmodeReqSerFree(void *msg); + +#define CsrWifiSmeWifiOffReqSer CsrWifiEventSer +#define CsrWifiSmeWifiOffReqDes CsrWifiEventDes +#define CsrWifiSmeWifiOffReqSizeof CsrWifiEventSizeof +#define CsrWifiSmeWifiOffReqSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeWifiOnReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeWifiOnReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeWifiOnReqSizeof(void *msg); +extern void CsrWifiSmeWifiOnReqSerFree(void *msg); + +extern CsrUint8* CsrWifiSmeCloakedSsidsSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeCloakedSsidsSetReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeCloakedSsidsSetReqSizeof(void *msg); +extern void CsrWifiSmeCloakedSsidsSetReqSerFree(void *msg); + +#define CsrWifiSmeCloakedSsidsGetReqSer CsrWifiEventSer +#define CsrWifiSmeCloakedSsidsGetReqDes CsrWifiEventDes +#define CsrWifiSmeCloakedSsidsGetReqSizeof CsrWifiEventSizeof +#define CsrWifiSmeCloakedSsidsGetReqSerFree CsrWifiSmePfree + +#define CsrWifiSmeSmeCommonConfigGetReqSer CsrWifiEventSer +#define CsrWifiSmeSmeCommonConfigGetReqDes CsrWifiEventDes +#define CsrWifiSmeSmeCommonConfigGetReqSizeof CsrWifiEventSizeof +#define CsrWifiSmeSmeCommonConfigGetReqSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeSmeCommonConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeSmeCommonConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeSmeCommonConfigSetReqSizeof(void *msg); +#define CsrWifiSmeSmeCommonConfigSetReqSerFree CsrWifiSmePfree + +#define CsrWifiSmeInterfaceCapabilityGetReqSer CsrWifiEventSer +#define CsrWifiSmeInterfaceCapabilityGetReqDes CsrWifiEventDes +#define CsrWifiSmeInterfaceCapabilityGetReqSizeof CsrWifiEventSizeof +#define CsrWifiSmeInterfaceCapabilityGetReqSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeWpsConfigurationReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeWpsConfigurationReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeWpsConfigurationReqSizeof(void *msg); +extern void CsrWifiSmeWpsConfigurationReqSerFree(void *msg); + +#define CsrWifiSmeActivateCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeActivateCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeActivateCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeActivateCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeAdhocConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeAdhocConfigGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeAdhocConfigGetCfmSizeof(void *msg); +#define CsrWifiSmeAdhocConfigGetCfmSerFree CsrWifiSmePfree + +#define CsrWifiSmeAdhocConfigSetCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeAdhocConfigSetCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeAdhocConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeAdhocConfigSetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeAssociationCompleteIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeAssociationCompleteIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeAssociationCompleteIndSizeof(void *msg); +extern void CsrWifiSmeAssociationCompleteIndSerFree(void *msg); + +extern CsrUint8* CsrWifiSmeAssociationStartIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeAssociationStartIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeAssociationStartIndSizeof(void *msg); +#define CsrWifiSmeAssociationStartIndSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeBlacklistCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeBlacklistCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeBlacklistCfmSizeof(void *msg); +extern void CsrWifiSmeBlacklistCfmSerFree(void *msg); + +extern CsrUint8* CsrWifiSmeCalibrationDataGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeCalibrationDataGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeCalibrationDataGetCfmSizeof(void *msg); +extern void CsrWifiSmeCalibrationDataGetCfmSerFree(void *msg); + +#define CsrWifiSmeCalibrationDataSetCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeCalibrationDataSetCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeCalibrationDataSetCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeCalibrationDataSetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeCcxConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeCcxConfigGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeCcxConfigGetCfmSizeof(void *msg); +#define CsrWifiSmeCcxConfigGetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeCcxConfigSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeCcxConfigSetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeCcxConfigSetCfmSizeof(void *msg); +#define CsrWifiSmeCcxConfigSetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeCoexConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeCoexConfigGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeCoexConfigGetCfmSizeof(void *msg); +#define CsrWifiSmeCoexConfigGetCfmSerFree CsrWifiSmePfree + +#define CsrWifiSmeCoexConfigSetCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeCoexConfigSetCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeCoexConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeCoexConfigSetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeCoexInfoGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeCoexInfoGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeCoexInfoGetCfmSizeof(void *msg); +#define CsrWifiSmeCoexInfoGetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeConnectCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeConnectCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeConnectCfmSizeof(void *msg); +#define CsrWifiSmeConnectCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeConnectionConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeConnectionConfigGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeConnectionConfigGetCfmSizeof(void *msg); +extern void CsrWifiSmeConnectionConfigGetCfmSerFree(void *msg); + +extern CsrUint8* CsrWifiSmeConnectionInfoGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeConnectionInfoGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeConnectionInfoGetCfmSizeof(void *msg); +extern void CsrWifiSmeConnectionInfoGetCfmSerFree(void *msg); + +extern CsrUint8* CsrWifiSmeConnectionQualityIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeConnectionQualityIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeConnectionQualityIndSizeof(void *msg); +#define CsrWifiSmeConnectionQualityIndSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeConnectionStatsGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeConnectionStatsGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeConnectionStatsGetCfmSizeof(void *msg); +#define CsrWifiSmeConnectionStatsGetCfmSerFree CsrWifiSmePfree + +#define CsrWifiSmeDeactivateCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeDeactivateCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeDeactivateCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeDeactivateCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeDisconnectCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeDisconnectCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeDisconnectCfmSizeof(void *msg); +#define CsrWifiSmeDisconnectCfmSerFree CsrWifiSmePfree + +#define CsrWifiSmeEventMaskSetCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeEventMaskSetCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeEventMaskSetCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeEventMaskSetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeHostConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeHostConfigGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeHostConfigGetCfmSizeof(void *msg); +#define CsrWifiSmeHostConfigGetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeHostConfigSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeHostConfigSetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeHostConfigSetCfmSizeof(void *msg); +#define CsrWifiSmeHostConfigSetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeIbssStationIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeIbssStationIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeIbssStationIndSizeof(void *msg); +#define CsrWifiSmeIbssStationIndSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeKeyCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeKeyCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeKeyCfmSizeof(void *msg); +#define CsrWifiSmeKeyCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeLinkQualityGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeLinkQualityGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeLinkQualityGetCfmSizeof(void *msg); +#define CsrWifiSmeLinkQualityGetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeMediaStatusIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeMediaStatusIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeMediaStatusIndSizeof(void *msg); +extern void CsrWifiSmeMediaStatusIndSerFree(void *msg); + +extern CsrUint8* CsrWifiSmeMibConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeMibConfigGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeMibConfigGetCfmSizeof(void *msg); +#define CsrWifiSmeMibConfigGetCfmSerFree CsrWifiSmePfree + +#define CsrWifiSmeMibConfigSetCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeMibConfigSetCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeMibConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeMibConfigSetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeMibGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeMibGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeMibGetCfmSizeof(void *msg); +extern void CsrWifiSmeMibGetCfmSerFree(void *msg); + +extern CsrUint8* CsrWifiSmeMibGetNextCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeMibGetNextCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeMibGetNextCfmSizeof(void *msg); +extern void CsrWifiSmeMibGetNextCfmSerFree(void *msg); + +#define CsrWifiSmeMibSetCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeMibSetCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeMibSetCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeMibSetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeMicFailureIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeMicFailureIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeMicFailureIndSizeof(void *msg); +#define CsrWifiSmeMicFailureIndSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeMulticastAddressCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeMulticastAddressCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeMulticastAddressCfmSizeof(void *msg); +extern void CsrWifiSmeMulticastAddressCfmSerFree(void *msg); + +extern CsrUint8* CsrWifiSmePacketFilterSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmePacketFilterSetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmePacketFilterSetCfmSizeof(void *msg); +#define CsrWifiSmePacketFilterSetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmePermanentMacAddressGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmePermanentMacAddressGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmePermanentMacAddressGetCfmSizeof(void *msg); +#define CsrWifiSmePermanentMacAddressGetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmePmkidCandidateListIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmePmkidCandidateListIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmePmkidCandidateListIndSizeof(void *msg); +extern void CsrWifiSmePmkidCandidateListIndSerFree(void *msg); + +extern CsrUint8* CsrWifiSmePmkidCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmePmkidCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmePmkidCfmSizeof(void *msg); +extern void CsrWifiSmePmkidCfmSerFree(void *msg); + +extern CsrUint8* CsrWifiSmePowerConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmePowerConfigGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmePowerConfigGetCfmSizeof(void *msg); +#define CsrWifiSmePowerConfigGetCfmSerFree CsrWifiSmePfree + +#define CsrWifiSmePowerConfigSetCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmePowerConfigSetCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiSmePowerConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmePowerConfigSetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeRegulatoryDomainInfoGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeRegulatoryDomainInfoGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeRegulatoryDomainInfoGetCfmSizeof(void *msg); +#define CsrWifiSmeRegulatoryDomainInfoGetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeRoamCompleteIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeRoamCompleteIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeRoamCompleteIndSizeof(void *msg); +#define CsrWifiSmeRoamCompleteIndSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeRoamStartIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeRoamStartIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeRoamStartIndSizeof(void *msg); +#define CsrWifiSmeRoamStartIndSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeRoamingConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeRoamingConfigGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeRoamingConfigGetCfmSizeof(void *msg); +#define CsrWifiSmeRoamingConfigGetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeRoamingConfigSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeRoamingConfigSetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeRoamingConfigSetCfmSizeof(void *msg); +#define CsrWifiSmeRoamingConfigSetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeScanConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeScanConfigGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeScanConfigGetCfmSizeof(void *msg); +extern void CsrWifiSmeScanConfigGetCfmSerFree(void *msg); + +#define CsrWifiSmeScanConfigSetCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeScanConfigSetCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeScanConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeScanConfigSetCfmSerFree CsrWifiSmePfree + +#define CsrWifiSmeScanFullCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeScanFullCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeScanFullCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeScanFullCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeScanResultIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeScanResultIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeScanResultIndSizeof(void *msg); +extern void CsrWifiSmeScanResultIndSerFree(void *msg); + +#define CsrWifiSmeScanResultsFlushCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeScanResultsFlushCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeScanResultsFlushCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeScanResultsFlushCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeScanResultsGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeScanResultsGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeScanResultsGetCfmSizeof(void *msg); +extern void CsrWifiSmeScanResultsGetCfmSerFree(void *msg); + +extern CsrUint8* CsrWifiSmeSmeStaConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeSmeStaConfigGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeSmeStaConfigGetCfmSizeof(void *msg); +#define CsrWifiSmeSmeStaConfigGetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeSmeStaConfigSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeSmeStaConfigSetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeSmeStaConfigSetCfmSizeof(void *msg); +#define CsrWifiSmeSmeStaConfigSetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeStationMacAddressGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeStationMacAddressGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeStationMacAddressGetCfmSizeof(void *msg); +#define CsrWifiSmeStationMacAddressGetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeTspecIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeTspecIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeTspecIndSizeof(void *msg); +extern void CsrWifiSmeTspecIndSerFree(void *msg); + +extern CsrUint8* CsrWifiSmeTspecCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeTspecCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeTspecCfmSizeof(void *msg); +extern void CsrWifiSmeTspecCfmSerFree(void *msg); + +extern CsrUint8* CsrWifiSmeVersionsGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeVersionsGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeVersionsGetCfmSizeof(void *msg); +extern void CsrWifiSmeVersionsGetCfmSerFree(void *msg); + +#define CsrWifiSmeWifiFlightmodeCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeWifiFlightmodeCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeWifiFlightmodeCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeWifiFlightmodeCfmSerFree CsrWifiSmePfree + +#define CsrWifiSmeWifiOffIndSer CsrWifiEventCsrUint8Ser +#define CsrWifiSmeWifiOffIndDes CsrWifiEventCsrUint8Des +#define CsrWifiSmeWifiOffIndSizeof CsrWifiEventCsrUint8Sizeof +#define CsrWifiSmeWifiOffIndSerFree CsrWifiSmePfree + +#define CsrWifiSmeWifiOffCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeWifiOffCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeWifiOffCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeWifiOffCfmSerFree CsrWifiSmePfree + +#define CsrWifiSmeWifiOnCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeWifiOnCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeWifiOnCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeWifiOnCfmSerFree CsrWifiSmePfree + +#define CsrWifiSmeCloakedSsidsSetCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeCloakedSsidsSetCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeCloakedSsidsSetCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeCloakedSsidsSetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeCloakedSsidsGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeCloakedSsidsGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeCloakedSsidsGetCfmSizeof(void *msg); +extern void CsrWifiSmeCloakedSsidsGetCfmSerFree(void *msg); + +extern CsrUint8* CsrWifiSmeWifiOnIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeWifiOnIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeWifiOnIndSizeof(void *msg); +#define CsrWifiSmeWifiOnIndSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeSmeCommonConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeSmeCommonConfigGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeSmeCommonConfigGetCfmSizeof(void *msg); +#define CsrWifiSmeSmeCommonConfigGetCfmSerFree CsrWifiSmePfree + +#define CsrWifiSmeSmeCommonConfigSetCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeSmeCommonConfigSetCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeSmeCommonConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeSmeCommonConfigSetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeInterfaceCapabilityGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeInterfaceCapabilityGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeInterfaceCapabilityGetCfmSizeof(void *msg); +#define CsrWifiSmeInterfaceCapabilityGetCfmSerFree CsrWifiSmePfree + +extern CsrUint8* CsrWifiSmeErrorIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeErrorIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeErrorIndSizeof(void *msg); +extern void CsrWifiSmeErrorIndSerFree(void *msg); + +extern CsrUint8* CsrWifiSmeInfoIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeInfoIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeInfoIndSizeof(void *msg); +extern void CsrWifiSmeInfoIndSerFree(void *msg); + +extern CsrUint8* CsrWifiSmeCoreDumpIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeCoreDumpIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeCoreDumpIndSizeof(void *msg); +extern void CsrWifiSmeCoreDumpIndSerFree(void *msg); + +#define CsrWifiSmeAmpStatusChangeIndSer CsrWifiEventCsrUint16CsrUint8Ser +#define CsrWifiSmeAmpStatusChangeIndDes CsrWifiEventCsrUint16CsrUint8Des +#define CsrWifiSmeAmpStatusChangeIndSizeof CsrWifiEventCsrUint16CsrUint8Sizeof +#define CsrWifiSmeAmpStatusChangeIndSerFree CsrWifiSmePfree + +#define CsrWifiSmeWpsConfigurationCfmSer CsrWifiEventCsrUint16Ser +#define CsrWifiSmeWpsConfigurationCfmDes CsrWifiEventCsrUint16Des +#define CsrWifiSmeWpsConfigurationCfmSizeof CsrWifiEventCsrUint16Sizeof +#define CsrWifiSmeWpsConfigurationCfmSerFree CsrWifiSmePfree + + +#ifdef __cplusplus +} +#endif +#endif /* CSR_WIFI_SME_SERIALIZE_H__ */ + diff --git a/drivers/staging/csr/csr_wifi_sme_task.h b/drivers/staging/csr/csr_wifi_sme_task.h new file mode 100644 index 0000000..62cc8b7 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_sme_task.h @@ -0,0 +1,34 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#ifndef CSR_WIFI_SME_TASK_H__ +#define CSR_WIFI_SME_TASK_H__ + +#include "csr_types.h" +#include "csr_sched.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define CSR_WIFI_SME_LOG_ID 0x1202FFFF +extern CsrSchedQid CSR_WIFI_SME_IFACEQUEUE; +void CsrWifiSmeInit(void **gash); +void CsrWifiSmeDeinit(void **gash); +void CsrWifiSmeHandler(void **gash); + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_SME_TASK_H__ */ + diff --git a/drivers/staging/csr/csr_wifi_vif_utils.h b/drivers/staging/csr/csr_wifi_vif_utils.h new file mode 100644 index 0000000..c534588 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_vif_utils.h @@ -0,0 +1,108 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2011 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +#ifndef CSR_WIFI_VIF_UTILS_H +#define CSR_WIFI_VIF_UTILS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* STANDARD INCLUDES ********************************************************/ + +/* PROJECT INCLUDES *********************************************************/ +/* including this file for CsrWifiInterfaceMode*/ +#include "csr_wifi_private_common.h" + +/* MACROS *******************************************************************/ + +/* Common macros for NME and SME to be used temporarily until SoftMAC changes are made */ +#define CSR_WIFI_NUM_INTERFACES (CsrUint8)0x1 +#define CSR_WIFI_INTERFACE_IN_USE (CsrUint16)0x0 + +/* This is used at places where interface Id isn't available*/ +#define CSR_WIFI_INTERFACE_ZERO 0 +#define CSR_WIFI_INTERFACE_STA 0 +#define CSR_WIFI_INTERFACE_AMP 0 + + +#define CSR_WIFI_VIF_UTILS_UNDEFINED_TAG 0xFFFF + +/* Extract the Interface Id from the event */ +#define CsrWifiVifUtilsGetVifTagFromEvent(msg) \ + ((CsrUint16) * ((CsrUint16 *) ((CsrUint8 *) (msg) + sizeof(CsrWifiFsmEvent)))) + +/* The HPI Vif combines the type and the interface id */ +#define CsrWifiVifUtilsGetVifTagFromHipEvent(msg) \ + ((msg)->virtualInterfaceIdentifier & 0x00FF) + +#define CsrWifiVifUtilsPackHipEventVif(type, interfaceId) \ + ((CsrUint16)((interfaceId) | ((type) << 8))) + + +/* TYPES DEFINITIONS ********************************************************/ + +/* GLOBAL VARIABLE DECLARATIONS *********************************************/ + +/* PUBLIC FUNCTION PROTOTYPES ***********************************************/ + +/** + * @brief + * First checks if the mode is supported capability bitmap of the interface. + * If this succeeds, then checks if running this mode on this interface is allowed. + * + * @param[in] CsrUint8 : interface capability bitmap + * @param[in] CsrUint8* : pointer to the array of current interface modes + * @param[in] CsrUint16 : interfaceTag + * @param[in] CsrWifiInterfaceMode : mode + * + * @return + * CsrBool : returns true if the interface is allowed to operate in the mode otherwise false. + */ +extern CsrBool CsrWifiVifUtilsCheckCompatibility(CsrUint8 interfaceCapability, + CsrUint8 *currentInterfaceModes, + CsrUint16 interfaceTag, + CsrWifiInterfaceMode mode); + +/** + * @brief + * Checks if the specified interface is supported. + * NOTE: Only checks that the interface is supported, no checks are made to + * determine whether a supported interface may be made active. + * + * @param[in] CsrUint16 : interfaceTag + * + * @return + * CsrBool : returns true if the interface is supported, otherwise false. + */ +extern CsrBool CsrWifiVifUtilsIsSupported(CsrUint16 interfaceTag); + +#ifdef CSR_LOG_ENABLE +/** + * @brief + * Registers the virtual interface utils logging details. + * Should only be called once at initialisation. + * + * @param[in/out] None + * + * @return + * None + */ +void CsrWifiVifUtilsLogTextRegister(void); +#else +#define CsrWifiVifUtilsLogTextRegister() +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* CSR_WIFI_VIF_UTILS_H */ + diff --git a/drivers/staging/csr/data_tx.c b/drivers/staging/csr/data_tx.c new file mode 100644 index 0000000..c5858a5 --- /dev/null +++ b/drivers/staging/csr/data_tx.c @@ -0,0 +1,57 @@ +/* + * --------------------------------------------------------------------------- + * FILE: data_tx.c + * + * PURPOSE: + * This file provides functions to send data requests to the UniFi. + * + * Copyright (C) 2007-2009 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * --------------------------------------------------------------------------- + */ +#include "csr_wifi_hip_unifi.h" +#include "unifi_priv.h" + +int +uf_verify_m4(unifi_priv_t *priv, const unsigned char *packet, unsigned int length) +{ + const unsigned char *p = packet; + CsrUint16 keyinfo; + + + if (length < (4 + 5 + 8 + 32 + 16 + 8 + 8 + 16 + 1 + 8)) { + return 1; + } + + p += 8; + keyinfo = p[5] << 8 | p[6]; /* big-endian */ + if ( + (p[0] == 1 || p[0] == 2) /* protocol version 802.1X-2001 (WPA) or -2004 (WPA2) */ && + p[1] == 3 /* EAPOL-Key */ && + /* don't bother checking p[2] p[3] (hh ll, packet body length) */ + (p[4] == 254 || p[4] == 2) /* descriptor type P802.1i-D3.0 (WPA) or 802.11i-2004 (WPA2) */ && + ((keyinfo & 0x0007) == 1 || (keyinfo & 0x0007) == 2) /* key descriptor version */ && + (keyinfo & ~0x0207U) == 0x0108 && /* key info for 4/4 or 4/2 -- ignore key desc version and sec bit (since varies in WPA 4/4) */ + (p[4 + 5 + 8 + 32 + 16 + 8 + 8 + 16 + 0] == 0 && /* key data length (2 octets) 0 for 4/4 only */ + p[4 + 5 + 8 + 32 + 16 + 8 + 8 + 16 + 1] == 0) + ) { + unifi_trace(priv, UDBG1, "uf_verify_m4: M4 detected \n"); + return 0; + } + else + { + return 1; + } +} + +/* + * --------------------------------------------------------------------------- + * + * Data transport signals. + * + * --------------------------------------------------------------------------- + */ + diff --git a/drivers/staging/csr/drv.c b/drivers/staging/csr/drv.c new file mode 100644 index 0000000..4545fb2 --- /dev/null +++ b/drivers/staging/csr/drv.c @@ -0,0 +1,2150 @@ +/* + * --------------------------------------------------------------------------- + * FILE: drv.c + * + * PURPOSE: + * Conventional device interface for debugging/monitoring of the + * driver and h/w using unicli. This interface is also being used + * by the SME linux implementation and the helper apps. + * + * Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * --------------------------------------------------------------------------- + */ + + + +/* + * Porting Notes: + * Part of this file contains an example for how to glue the OS layer + * with the HIP core lib, the SDIO glue layer, and the SME. + * + * When the unifi_sdio.ko modules loads, the linux kernel calls unifi_load(). + * unifi_load() calls uf_sdio_load() which is exported by the SDIO glue + * layer. uf_sdio_load() registers this driver with the underlying SDIO driver. + * When a card is detected, the SDIO glue layer calls register_unifi_sdio() + * to pass the SDIO function context and ask the OS layer to initialise + * the card. register_unifi_sdio() allocates all the private data of the OS + * layer and calls uf_run_unifihelper() to start the SME. The SME calls + * unifi_sys_wifi_on_req() which uses the HIP core lib to initialise the card. + */ + +#include +#include +#include +#include +#include + +#include "csr_wifi_hip_unifiversion.h" +#include "unifi_priv.h" +#include "csr_wifi_hip_conversions.h" +#include "unifi_native.h" + +/* Module parameter variables */ +int buswidth = 0; /* 0 means use default, values 1,4 */ +int sdio_clock = 50000; /* kHz */ +int unifi_debug = 0; +/* + * fw_init prevents f/w initialisation on error. + * Unless necessary, avoid usage in the CSR_SME_EMB build because it prevents + * UniFi initialisation after getting out of suspend and also leaves + * UniFi powered when the module unloads. + */ +int fw_init[MAX_UNIFI_DEVS] = {-1, -1}; +int use_5g = 0; +int led_mask = 0; /* 0x0c00 for dev-pc-1503c, dev-pc-1528a */ +int disable_hw_reset = 0; +int disable_power_control = 0; +int enable_wol = UNIFI_WOL_OFF; /* 0 for none, 1 for SDIO IRQ, 2 for PIO */ +#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT) +int tl_80211d = (int)CSR_WIFI_SME_80211D_TRUST_LEVEL_MIB; +#endif +int sdio_block_size = -1; /* Override SDIO block size */ +int sdio_byte_mode = 0; /* 0 for block mode + padding, 1 for byte mode */ +int coredump_max = CSR_WIFI_HIP_NUM_COREDUMP_BUFFERS; +int run_bh_once = -1; /* Set for scheduled interrupt mode, -1 = default */ +int bh_priority = -1; + +MODULE_DESCRIPTION("CSR UniFi (SDIO)"); + +module_param(buswidth, int, S_IRUGO|S_IWUSR); +module_param(sdio_clock, int, S_IRUGO|S_IWUSR); +module_param(unifi_debug, int, S_IRUGO|S_IWUSR); +module_param_array(fw_init, int, NULL, S_IRUGO|S_IWUSR); +module_param(use_5g, int, S_IRUGO|S_IWUSR); +module_param(led_mask, int, S_IRUGO|S_IWUSR); +module_param(disable_hw_reset, int, S_IRUGO|S_IWUSR); +module_param(disable_power_control, int, S_IRUGO|S_IWUSR); +module_param(enable_wol, int, S_IRUGO|S_IWUSR); +#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT) +module_param(tl_80211d, int, S_IRUGO|S_IWUSR); +#endif +module_param(sdio_block_size, int, S_IRUGO|S_IWUSR); +module_param(sdio_byte_mode, int, S_IRUGO|S_IWUSR); +module_param(coredump_max, int, S_IRUGO|S_IWUSR); +module_param(run_bh_once, int, S_IRUGO|S_IWUSR); +module_param(bh_priority, int, S_IRUGO|S_IWUSR); + +MODULE_PARM_DESC(buswidth, "SDIO bus width (0=default), set 1 for 1-bit or 4 for 4-bit mode"); +MODULE_PARM_DESC(sdio_clock, "SDIO bus frequency in kHz, (default = 50 MHz)"); +MODULE_PARM_DESC(unifi_debug, "Diagnostic reporting level"); +MODULE_PARM_DESC(fw_init, "Set to 0 to prevent f/w initialization on error"); +MODULE_PARM_DESC(use_5g, "Use the 5G (802.11a) radio band"); +MODULE_PARM_DESC(led_mask, "LED mask flags"); +MODULE_PARM_DESC(disable_hw_reset, "Set to 1 to disable hardware reset"); +MODULE_PARM_DESC(disable_power_control, "Set to 1 to disable SDIO power control"); +MODULE_PARM_DESC(enable_wol, "Enable wake-on-wlan function 0=off, 1=SDIO, 2=PIO"); +#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT) +MODULE_PARM_DESC(tl_80211d, "802.11d Trust Level (1-6, default = 5)"); +#endif +MODULE_PARM_DESC(sdio_block_size, "Set to override SDIO block size"); +MODULE_PARM_DESC(sdio_byte_mode, "Set to 1 for byte mode SDIO"); +MODULE_PARM_DESC(coredump_max, "Number of chip mini-coredump buffers to allocate"); +MODULE_PARM_DESC(run_bh_once, "Run BH only when firmware interrupts"); +MODULE_PARM_DESC(bh_priority, "Modify the BH thread priority"); + +/* Callback for event logging to UDI clients */ +static void udi_log_event(ul_client_t *client, + const u8 *signal, int signal_len, + const bulk_data_param_t *bulkdata, + int dir); + +static void udi_set_log_filter(ul_client_t *pcli, + unifiio_filter_t *udi_filter); + + +/* Mutex to protect access to priv->sme_cli */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) +DEFINE_SEMAPHORE(udi_mutex); +#else +DECLARE_MUTEX(udi_mutex); +#endif + +CsrInt32 CsrHipResultToStatus(CsrResult csrResult) +{ + CsrInt32 r = -EIO; + + switch (csrResult) + { + case CSR_RESULT_SUCCESS: + r = 0; + break; + case CSR_WIFI_HIP_RESULT_RANGE: + r = -ERANGE; + break; + case CSR_WIFI_HIP_RESULT_NO_DEVICE: + r = -ENODEV; + break; + case CSR_WIFI_HIP_RESULT_INVALID_VALUE: + r = -EINVAL; + break; + case CSR_WIFI_HIP_RESULT_NOT_FOUND: + r = -ENOENT; + break; + case CSR_WIFI_HIP_RESULT_NO_SPACE: + r = -ENOSPC; + break; + case CSR_WIFI_HIP_RESULT_NO_MEMORY: + r = -ENOMEM; + break; + case CSR_RESULT_FAILURE: + r = -EIO; + break; + default: + /*unifi_warning(card->ospriv, "CsrHipResultToStatus: Unrecognised csrResult error code: %d\n", csrResult);*/ + r = -EIO; + } + return r; +} + + +static const char* +trace_putest_cmdid(unifi_putest_command_t putest_cmd) +{ + switch (putest_cmd) + { + case UNIFI_PUTEST_START: + return "START"; + case UNIFI_PUTEST_STOP: + return "STOP"; + case UNIFI_PUTEST_SET_SDIO_CLOCK: + return "SET CLOCK"; + case UNIFI_PUTEST_CMD52_READ: + return "CMD52R"; + case UNIFI_PUTEST_CMD52_BLOCK_READ: + return "CMD52BR"; + case UNIFI_PUTEST_CMD52_WRITE: + return "CMD52W"; + case UNIFI_PUTEST_DL_FW: + return "D/L FW"; + case UNIFI_PUTEST_DL_FW_BUFF: + return "D/L FW BUFFER"; + case UNIFI_PUTEST_COREDUMP_PREPARE: + return "PREPARE COREDUMP"; + case UNIFI_PUTEST_GP_READ16: + return "GP16R"; + case UNIFI_PUTEST_GP_WRITE16: + return "GP16W"; + default: + return "ERROR: unrecognised command"; + } + } + + + +/* + * --------------------------------------------------------------------------- + * unifi_open + * unifi_release + * + * Open and release entry points for the UniFi debug driver. + * + * Arguments: + * Normal linux driver args. + * + * Returns: + * Linux error code. + * --------------------------------------------------------------------------- + */ +static int +unifi_open(struct inode *inode, struct file *file) +{ + int devno; + unifi_priv_t *priv; + ul_client_t *udi_cli; + + func_enter(); + + devno = MINOR(inode->i_rdev) >> 1; + + /* + * Increase the ref_count for the char device clients. + * Make sure you call uf_put_instance() to decreace it if + * unifi_open returns an error. + */ + priv = uf_get_instance(devno); + if (priv == NULL) { + unifi_error(NULL, "unifi_open: No device present\n"); + func_exit(); + return -ENODEV; + } + + /* Register this instance in the client's list. */ + /* The minor number determines the nature of the client (Unicli or SME). */ + if (MINOR(inode->i_rdev) & 0x1) { + udi_cli = ul_register_client(priv, CLI_USING_WIRE_FORMAT, udi_log_event); + if (udi_cli == NULL) { + /* Too many clients already using this device */ + unifi_error(priv, "Too many clients already open\n"); + uf_put_instance(devno); + func_exit(); + return -ENOSPC; + } + unifi_trace(priv, UDBG1, "Client is registered to /dev/unifiudi%d\n", devno); + } else { + /* + * Even-numbered device nodes are the control application. + * This is the userspace helper containing SME or + * unifi_manager. + */ + + down(&udi_mutex); + +#ifdef CSR_SME_USERSPACE + /* Check if a config client is already attached */ + if (priv->sme_cli) { + up(&udi_mutex); + uf_put_instance(devno); + + unifi_info(priv, "There is already a configuration client using the character device\n"); + func_exit(); + return -EBUSY; + } +#endif /* CSR_SME_USERSPACE */ + +#ifdef CSR_SUPPORT_SME + udi_cli = ul_register_client(priv, + CLI_USING_WIRE_FORMAT | CLI_SME_USERSPACE, + sme_log_event); +#else + /* Config client for native driver */ + udi_cli = ul_register_client(priv, + 0, + sme_native_log_event); +#endif + if (udi_cli == NULL) { + /* Too many clients already using this device */ + up(&udi_mutex); + uf_put_instance(devno); + + unifi_error(priv, "Too many clients already open\n"); + func_exit(); + return -ENOSPC; + } + + /* + * Fill-in the pointer to the configuration client. + * This is the SME userspace helper or unifi_manager. + * Not used in the SME embedded version. + */ + unifi_trace(priv, UDBG1, "SME client (id:%d s:0x%X) is registered\n", + udi_cli->client_id, udi_cli->sender_id); + /* Store the SME UniFi Linux Client */ + if (priv->sme_cli == NULL) { + priv->sme_cli = udi_cli; + } + + up(&udi_mutex); + } + + + /* + * Store the pointer to the client. + * All char driver's entry points will pass this pointer. + */ + file->private_data = udi_cli; + + func_exit(); + return 0; +} /* unifi_open() */ + + + +static int +unifi_release(struct inode *inode, struct file *filp) +{ + ul_client_t *udi_cli = (void*)filp->private_data; + int devno; + unifi_priv_t *priv; + + func_enter(); + + priv = uf_find_instance(udi_cli->instance); + if (!priv) { + unifi_error(priv, "unifi_close: instance for device not found\n"); + return -ENODEV; + } + + devno = MINOR(inode->i_rdev) >> 1; + + /* Even device nodes are the config client (i.e. SME or unifi_manager) */ + if ((MINOR(inode->i_rdev) & 0x1) == 0) { + + if (priv->sme_cli != udi_cli) { + unifi_notice(priv, "Surprise closing config device: not the sme client\n"); + } + unifi_notice(priv, "SME client close (unifi%d)\n", devno); + + /* + * Clear sme_cli before calling unifi_sys_... so it doesn't try to + * queue a reply to the (now gone) SME. + */ + down(&udi_mutex); + priv->sme_cli = NULL; + up(&udi_mutex); + +#ifdef CSR_SME_USERSPACE + /* Power-down when config client closes */ + { + CsrWifiRouterCtrlWifiOffReq req = {{CSR_WIFI_ROUTER_CTRL_HIP_REQ, 0, 0, 0, NULL}}; + CsrWifiRouterCtrlWifiOffReqHandler(priv, &req.common); + } + + uf_sme_deinit(priv); +#endif /* CSR_SME_USERSPACE */ + } else { + + unifi_trace(priv, UDBG2, "UDI client close (unifiudi%d)\n", devno); + + /* If the pointer matches the logging client, stop logging. */ + down(&priv->udi_logging_mutex); + if (udi_cli == priv->logging_client) { + priv->logging_client = NULL; + } + up(&priv->udi_logging_mutex); + + if (udi_cli == priv->amp_client) { + priv->amp_client = NULL; + } + } + + /* Deregister this instance from the client's list. */ + ul_deregister_client(udi_cli); + + uf_put_instance(devno); + + return 0; +} /* unifi_release() */ + + + +/* + * --------------------------------------------------------------------------- + * unifi_read + * + * The read() driver entry point. + * + * Arguments: + * filp The file descriptor returned by unifi_open() + * p The user space buffer to copy the read data + * len The size of the p buffer + * poff + * + * Returns: + * number of bytes read or an error code on failure + * --------------------------------------------------------------------------- + */ +static ssize_t +unifi_read(struct file *filp, char *p, size_t len, loff_t *poff) +{ + ul_client_t *pcli = (void*)filp->private_data; + unifi_priv_t *priv; + udi_log_t *logptr = NULL; + udi_msg_t *msgptr; + struct list_head *l; + int msglen; + + func_enter(); + + priv = uf_find_instance(pcli->instance); + if (!priv) { + unifi_error(priv, "invalid priv\n"); + return -ENODEV; + } + + if (!pcli->udi_enabled) { + unifi_error(priv, "unifi_read: unknown client."); + return -EINVAL; + } + + if (list_empty(&pcli->udi_log)) { + if (filp->f_flags & O_NONBLOCK) { + /* Non-blocking - just return if the udi_log is empty */ + return 0; + } else { + /* Blocking - wait on the UDI wait queue */ + if (wait_event_interruptible(pcli->udi_wq, + !list_empty(&pcli->udi_log))) + { + unifi_error(priv, "unifi_read: wait_event_interruptible failed."); + return -ERESTARTSYS; + } + } + } + + /* Read entry from list head and remove it from the list */ + if (down_interruptible(&pcli->udi_sem)) { + return -ERESTARTSYS; + } + l = pcli->udi_log.next; + list_del(l); + up(&pcli->udi_sem); + + /* Get a pointer to whole struct */ + logptr = list_entry(l, udi_log_t, q); + if (logptr == NULL) { + unifi_error(priv, "unifi_read: failed to get event.\n"); + return -EINVAL; + } + + /* Get the real message */ + msgptr = &logptr->msg; + msglen = msgptr->length; + if (msglen > len) { + printk(KERN_WARNING "truncated read to %d actual msg len is %lu\n", msglen, (long unsigned int)len); + msglen = len; + } + + /* and pass it to the client (SME or Unicli). */ + if (copy_to_user(p, msgptr, msglen)) + { + printk(KERN_ERR "Failed to copy UDI log to user\n"); + kfree(logptr); + return -EFAULT; + } + + /* It is our resposibility to free the message buffer. */ + kfree(logptr); + + func_exit_r(msglen); + return msglen; + +} /* unifi_read() */ + + + +/* + * --------------------------------------------------------------------------- + * udi_send_signal_unpacked + * + * Sends an unpacked signal to UniFi. + * + * Arguments: + * priv Pointer to private context struct + * data Pointer to request structure and data to send + * data_len Length of data in data pointer. + * + * Returns: + * Number of bytes written, error otherwise. + * + * Notes: + * All clients that use this function to send a signal to the unifi + * must use the host formatted structures. + * --------------------------------------------------------------------------- + */ +static int +udi_send_signal_unpacked(unifi_priv_t *priv, unsigned char* data, uint data_len) +{ + CSR_SIGNAL *sigptr = (CSR_SIGNAL*)data; + CSR_DATAREF *datarefptr; + bulk_data_param_t bulk_data; + uint signal_size, i; + uint bulk_data_offset = 0; + int bytecount, r; + CsrResult csrResult; + + /* Number of bytes in the signal */ + signal_size = SigGetSize(sigptr); + if (!signal_size || (signal_size > data_len)) { + unifi_error(priv, "unifi_sme_mlme_req - Invalid signal 0x%x size should be %d bytes\n", + sigptr->SignalPrimitiveHeader.SignalId, + signal_size); + return -EINVAL; + } + bytecount = signal_size; + + /* Get a pointer to the information of the first data reference */ + datarefptr = (CSR_DATAREF*)&sigptr->u; + + /* Initialize the offset in the data buffer, bulk data is right after the signal. */ + bulk_data_offset = signal_size; + + /* store the references and the size of the bulk data to the bulkdata structure */ + for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { + /* the length of the bulk data is in the signal */ + if ((datarefptr+i)->DataLength) { + void *dest; + + csrResult = unifi_net_data_malloc(priv, &bulk_data.d[i], (datarefptr+i)->DataLength); + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, "udi_send_signal_unpacked: failed to allocate request_data.\n"); + return -EIO; + } + + dest = (void*)bulk_data.d[i].os_data_ptr; + memcpy(dest, data + bulk_data_offset, bulk_data.d[i].data_length); + } else { + bulk_data.d[i].data_length = 0; + } + + bytecount += bulk_data.d[i].data_length; + /* advance the offset, to point the next bulk data */ + bulk_data_offset += bulk_data.d[i].data_length; + } + + + unifi_trace(priv, UDBG3, "SME Send: signal 0x%.4X\n", sigptr->SignalPrimitiveHeader.SignalId); + + /* Send the signal. */ + r = ul_send_signal_unpacked(priv, sigptr, &bulk_data); + if (r < 0) { + unifi_error(priv, "udi_send_signal_unpacked: send failed (%d)\n", r); + for(i=0;i buflen)) { + unifi_error(priv, "udi_send_signal_raw - Couldn't find length of signal 0x%x\n", + sig_id); + func_exit(); + return -EINVAL; + } + unifi_trace(priv, UDBG2, "udi_send_signal_raw: signal 0x%.4X len:%d\n", + sig_id, signal_size); + /* Zero the data ref arrays */ + memset(&data_ptrs, 0, sizeof(data_ptrs)); + + /* + * Find the number of associated bulk data packets. Scan through + * the data refs to check that we have enough data and pick out + * pointers to appended bulk data. + */ + num_data_refs = 0; + bytecount = signal_size; + + for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; ++i) + { + unsigned int len = GET_PACKED_DATAREF_LEN(buf, i); + unifi_trace(priv, UDBG3, "udi_send_signal_raw: data_ref length = %d\n", len); + + if (len != 0) { + void *dest; + + csrResult = unifi_net_data_malloc(priv, &data_ptrs.d[i], len); + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, "udi_send_signal_raw: failed to allocate request_data.\n"); + return -EIO; + } + + dest = (void*)data_ptrs.d[i].os_data_ptr; + memcpy(dest, buf + bytecount, len); + + bytecount += len; + num_data_refs++; + } + data_ptrs.d[i].data_length = len; + } + + unifi_trace(priv, UDBG3, "Queueing signal 0x%.4X from UDI with %u data refs\n", + sig_id, + num_data_refs); + + if (bytecount > buflen) { + unifi_error(priv, "udi_send_signal_raw: Not enough data (%d instead of %d)\n", buflen, bytecount); + func_exit(); + return -EINVAL; + } + + /* Send the signal calling the function that uses the wire-formatted signals. */ + r = ul_send_signal_raw(priv, buf, signal_size, &data_ptrs); + if (r < 0) { + unifi_error(priv, "udi_send_signal_raw: send failed (%d)\n", r); + func_exit(); + return -EIO; + } + +#ifdef CSR_NATIVE_LINUX + if (sig_id == CSR_MLME_POWERMGT_REQUEST_ID) { + int power_mode = CSR_GET_UINT16_FROM_LITTLE_ENDIAN((buf + + SIZEOF_SIGNAL_HEADER + (UNIFI_MAX_DATA_REFERENCES*SIZEOF_DATAREF))); +#ifdef CSR_SUPPORT_WEXT + /* Overide the wext power mode to the new value */ + priv->wext_conf.power_mode = power_mode; +#endif + /* Configure deep sleep signaling */ + if (power_mode || (priv->interfacePriv[0]->connected == UnifiNotConnected)) { + csrResult = unifi_configure_low_power_mode(priv->card, + UNIFI_LOW_POWER_ENABLED, + UNIFI_PERIODIC_WAKE_HOST_DISABLED); + } else { + csrResult = unifi_configure_low_power_mode(priv->card, + UNIFI_LOW_POWER_DISABLED, + UNIFI_PERIODIC_WAKE_HOST_DISABLED); + } + } +#endif + + func_exit_r(bytecount); + + return bytecount; +} /* udi_send_signal_raw */ + +/* + * --------------------------------------------------------------------------- + * unifi_write + * + * The write() driver entry point. + * A UniFi Debug Interface client such as unicli can write a signal + * plus bulk data to the driver for sending to the UniFi chip. + * + * Only one signal may be sent per write operation. + * + * Arguments: + * filp The file descriptor returned by unifi_open() + * p The user space buffer to get the data from + * len The size of the p buffer + * poff + * + * Returns: + * number of bytes written or an error code on failure + * --------------------------------------------------------------------------- + */ +static ssize_t +unifi_write(struct file *filp, const char *p, size_t len, loff_t *poff) +{ + ul_client_t *pcli = (ul_client_t*)filp->private_data; + unifi_priv_t *priv; + unsigned char *buf; + unsigned char *bufptr; + int remaining; + int bytes_written; + int r; + bulk_data_param_t bulkdata; + CsrResult csrResult; + + func_enter(); + + priv = uf_find_instance(pcli->instance); + if (!priv) { + unifi_error(priv, "invalid priv\n"); + return -ENODEV; + } + + unifi_trace(priv, UDBG5, "unifi_write: len = %d\n", len); + + if (!pcli->udi_enabled) { + unifi_error(priv, "udi disabled\n"); + return -EINVAL; + } + + /* + * AMP client sends only one signal at a time, so we can use + * unifi_net_data_malloc to save the extra copy. + */ + if (pcli == priv->amp_client) { + int signal_size; + int sig_id; + unsigned char *signal_buf; + char *user_data_buf; + + csrResult = unifi_net_data_malloc(priv, &bulkdata.d[0], len); + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, "unifi_write: failed to allocate request_data.\n"); + func_exit(); + return -ENOMEM; + } + + user_data_buf = (char*)bulkdata.d[0].os_data_ptr; + + /* Get the data from the AMP client. */ + if (copy_from_user((void*)user_data_buf, p, len)) { + unifi_error(priv, "unifi_write: copy from user failed\n"); + unifi_net_data_free(priv, &bulkdata.d[0]); + func_exit(); + return -EFAULT; + } + + bulkdata.d[1].os_data_ptr = NULL; + bulkdata.d[1].data_length = 0; + + /* Number of bytes in the signal */ + sig_id = GET_SIGNAL_ID(bulkdata.d[0].os_data_ptr); + signal_size = len; + signal_size -= GET_PACKED_DATAREF_LEN(bulkdata.d[0].os_data_ptr, 0); + signal_size -= GET_PACKED_DATAREF_LEN(bulkdata.d[0].os_data_ptr, 1); + if ((signal_size <= 0) || (signal_size > len)) { + unifi_error(priv, "unifi_write - Couldn't find length of signal 0x%x\n", + sig_id); + unifi_net_data_free(priv, &bulkdata.d[0]); + func_exit(); + return -EINVAL; + } + + unifi_trace(priv, UDBG2, "unifi_write: signal 0x%.4X len:%d\n", + sig_id, signal_size); + + /* Allocate a buffer for the signal */ + signal_buf = kmalloc(signal_size, GFP_KERNEL); + if (!signal_buf) { + unifi_net_data_free(priv, &bulkdata.d[0]); + func_exit(); + return -ENOMEM; + } + + /* Get the signal from the os_data_ptr */ + memcpy(signal_buf, bulkdata.d[0].os_data_ptr, signal_size); + signal_buf[5] = (pcli->sender_id >> 8) & 0xff; + + if (signal_size < len) { + /* Remove the signal from the os_data_ptr */ + bulkdata.d[0].data_length -= signal_size; + bulkdata.d[0].os_data_ptr += signal_size; + } else { + bulkdata.d[0].data_length = 0; + bulkdata.d[0].os_data_ptr = NULL; + } + + /* Send the signal calling the function that uses the wire-formatted signals. */ + r = ul_send_signal_raw(priv, signal_buf, signal_size, &bulkdata); + if (r < 0) { + unifi_error(priv, "unifi_write: send failed (%d)\n", r); + if (bulkdata.d[0].os_data_ptr != NULL) { + unifi_net_data_free(priv, &bulkdata.d[0]); + } + } + + /* Free the signal buffer and return */ + kfree(signal_buf); + return len; + } + + buf = kmalloc(len, GFP_KERNEL); + if (!buf) { + return -ENOMEM; + } + + /* Get the data from the client (SME or Unicli). */ + if (copy_from_user((void*)buf, p, len)) { + unifi_error(priv, "copy from user failed\n"); + kfree(buf); + return -EFAULT; + } + + /* + * In SME userspace build read() contains a SYS or MGT message. + * Note that even though the SME sends one signal at a time, we can not + * use unifi_net_data_malloc because in the early stages, before having + * initialised the core, it will fail since the I/O block size is unknown. + */ +#ifdef CSR_SME_USERSPACE + if (pcli->configuration & CLI_SME_USERSPACE) { + CsrWifiRouterTransportRecv(priv, buf, len); + kfree(buf); + return len; + } +#endif + + /* ul_send_signal_raw will do a sanity check of len against signal content */ + + /* + * udi_send_signal_raw() and udi_send_signal_unpacked() return the number of bytes consumed. + * A write call can pass multiple signal concatenated together. + */ + bytes_written = 0; + remaining = len; + bufptr = buf; + while (remaining > 0) + { + int r; + + /* + * Set the SenderProcessId. + * The SignalPrimitiveHeader is the first 3 16-bit words of the signal, + * the SenderProcessId is bytes 4,5. + * The MSB of the sender ID needs to be set to the client ID. + * The LSB is controlled by the SME. + */ + bufptr[5] = (pcli->sender_id >> 8) & 0xff; + + /* use the appropriate interface, depending on the clients' configuration */ + if (pcli->configuration & CLI_USING_WIRE_FORMAT) { + unifi_trace(priv, UDBG1, "unifi_write: call udi_send_signal().\n"); + r = udi_send_signal_raw(priv, bufptr, remaining); + } else { + r = udi_send_signal_unpacked(priv, bufptr, remaining); + } + if (r < 0) { + /* Set the return value to the error code */ + unifi_error(priv, "unifi_write: (udi or sme)_send_signal() returns %d\n", r); + bytes_written = r; + break; + } + bufptr += r; + remaining -= r; + bytes_written += r; + } + + kfree(buf); + + func_exit_r(bytes_written); + + return bytes_written; +} /* unifi_write() */ + + +static const char* build_type_to_string(unsigned char build_type) +{ + switch (build_type) + { + case UNIFI_BUILD_NME: return "NME"; + case UNIFI_BUILD_WEXT: return "WEXT"; + case UNIFI_BUILD_AP: return "AP"; + } + return "unknown"; +} + + +/* + * ---------------------------------------------------------------- + * unifi_ioctl + * + * Ioctl handler for unifi driver. + * + * Arguments: + * inodep Pointer to inode structure. + * filp Pointer to file structure. + * cmd Ioctl cmd passed by user. + * arg Ioctl arg passed by user. + * + * Returns: + * 0 on success, -ve error code on error. + * ---------------------------------------------------------------- + */ +static long +unifi_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) +{ + ul_client_t *pcli = (ul_client_t*)filp->private_data; + unifi_priv_t *priv; + struct net_device *dev; + int r = 0; + int int_param, i; + u8* buf; + CsrResult csrResult; +#if (defined CSR_SUPPORT_SME) + unifi_cfg_command_t cfg_cmd; +#if (defined CSR_SUPPORT_WEXT) + CsrWifiSmeCoexConfig coex_config; + unsigned char uchar_param; + unsigned char varbind[MAX_VARBIND_LENGTH]; + int vblen; +#endif +#endif + unifi_putest_command_t putest_cmd; + + priv = uf_find_instance(pcli->instance); + if (!priv) { + unifi_error(priv, "ioctl error: unknown instance=%d\n", pcli->instance); + r = -ENODEV; + goto out; + } + unifi_trace(priv, UDBG5, "unifi_ioctl: cmd=0x%X, arg=0x%lX\n", cmd, arg); + + switch (cmd) { + + case UNIFI_GET_UDI_ENABLE: + unifi_trace(priv, UDBG4, "UniFi Get UDI Enable\n"); + + down(&priv->udi_logging_mutex); + int_param = (priv->logging_client == NULL) ? 0 : 1; + up(&priv->udi_logging_mutex); + + if (put_user(int_param, (int*)arg)) + { + unifi_error(priv, "UNIFI_GET_UDI_ENABLE: Failed to copy to user\n"); + r = -EFAULT; + goto out; + } + break; + + case UNIFI_SET_UDI_ENABLE: + unifi_trace(priv, UDBG4, "UniFi Set UDI Enable\n"); + if (get_user(int_param, (int*)arg)) + { + unifi_error(priv, "UNIFI_SET_UDI_ENABLE: Failed to copy from user\n"); + r = -EFAULT; + goto out; + } + + down(&priv->udi_logging_mutex); + if (int_param) { + pcli->event_hook = udi_log_event; + unifi_set_udi_hook(priv->card, logging_handler); + /* Log all signals by default */ + for (i = 0; i < SIG_FILTER_SIZE; i++) { + pcli->signal_filter[i] = 0xFFFF; + } + priv->logging_client = pcli; + + } else { + priv->logging_client = NULL; + pcli->event_hook = NULL; + } + up(&priv->udi_logging_mutex); + + break; + + case UNIFI_SET_MIB: + unifi_trace(priv, UDBG4, "UniFi Set MIB\n"); +#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT) + /* Read first 2 bytes and check length */ + if (copy_from_user((void*)varbind, (void*)arg, 2)) { + unifi_error(priv, + "UNIFI_SET_MIB: Failed to copy in varbind header\n"); + r = -EFAULT; + goto out; + } + vblen = varbind[1]; + if ((vblen + 2) > MAX_VARBIND_LENGTH) { + unifi_error(priv, + "UNIFI_SET_MIB: Varbind too long (%d, limit %d)\n", + (vblen+2), MAX_VARBIND_LENGTH); + r = -EINVAL; + goto out; + } + /* Read rest of varbind */ + if (copy_from_user((void*)(varbind+2), (void*)(arg+2), vblen)) { + unifi_error(priv, "UNIFI_SET_MIB: Failed to copy in varbind\n"); + r = -EFAULT; + goto out; + } + + /* send to SME */ + vblen += 2; + r = sme_mgt_mib_set(priv, varbind, vblen); + if (r) { + goto out; + } +#else + unifi_notice(priv, "UNIFI_SET_MIB: Unsupported.\n"); +#endif /* CSR_SUPPORT_WEXT */ + break; + + case UNIFI_GET_MIB: + unifi_trace(priv, UDBG4, "UniFi Get MIB\n"); +#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT) + /* Read first 2 bytes and check length */ + if (copy_from_user((void*)varbind, (void*)arg, 2)) { + unifi_error(priv, "UNIFI_GET_MIB: Failed to copy in varbind header\n"); + r = -EFAULT; + goto out; + } + vblen = varbind[1]; + if ((vblen+2) > MAX_VARBIND_LENGTH) { + unifi_error(priv, "UNIFI_GET_MIB: Varbind too long (%d, limit %d)\n", + (vblen+2), MAX_VARBIND_LENGTH); + r = -EINVAL; + goto out; + } + /* Read rest of varbind */ + if (copy_from_user((void*)(varbind+2), (void*)(arg+2), vblen)) { + unifi_error(priv, "UNIFI_GET_MIB: Failed to copy in varbind\n"); + r = -EFAULT; + goto out; + } + + vblen += 2; + r = sme_mgt_mib_get(priv, varbind, &vblen); + if (r) { + goto out; + } + /* copy out varbind */ + if (vblen > MAX_VARBIND_LENGTH) { + unifi_error(priv, + "UNIFI_GET_MIB: Varbind result too long (%d, limit %d)\n", + vblen, MAX_VARBIND_LENGTH); + r = -EINVAL; + goto out; + } + if (copy_to_user((void*)arg, varbind, vblen)) { + r = -EFAULT; + goto out; + } +#else + unifi_notice(priv, "UNIFI_GET_MIB: Unsupported.\n"); +#endif /* CSR_SUPPORT_WEXT */ + break; + + case UNIFI_CFG: +#if (defined CSR_SUPPORT_SME) + if (get_user(cfg_cmd, (unifi_cfg_command_t*)arg)) + { + unifi_error(priv, "UNIFI_CFG: Failed to get the command\n"); + r = -EFAULT; + goto out; + } + + unifi_trace(priv, UDBG1, "UNIFI_CFG: Command is %d (t=%u) sz=%d\n", + cfg_cmd, jiffies_to_msecs(jiffies), sizeof(unifi_cfg_command_t)); + switch (cfg_cmd) { + case UNIFI_CFG_POWER: + r = unifi_cfg_power(priv, (unsigned char*)arg); + break; + case UNIFI_CFG_POWERSAVE: + r = unifi_cfg_power_save(priv, (unsigned char*)arg); + break; + case UNIFI_CFG_POWERSUPPLY: + r = unifi_cfg_power_supply(priv, (unsigned char*)arg); + break; + case UNIFI_CFG_FILTER: + r = unifi_cfg_packet_filters(priv, (unsigned char*)arg); + break; + case UNIFI_CFG_GET: + r = unifi_cfg_get_info(priv, (unsigned char*)arg); + break; + case UNIFI_CFG_WMM_QOSINFO: + r = unifi_cfg_wmm_qos_info(priv, (unsigned char*)arg); + break; + case UNIFI_CFG_WMM_ADDTS: + r = unifi_cfg_wmm_addts(priv, (unsigned char*)arg); + break; + case UNIFI_CFG_WMM_DELTS: + r = unifi_cfg_wmm_delts(priv, (unsigned char*)arg); + break; + case UNIFI_CFG_STRICT_DRAFT_N: + r = unifi_cfg_strict_draft_n(priv, (unsigned char*)arg); + break; + case UNIFI_CFG_ENABLE_OKC: + r = unifi_cfg_enable_okc(priv, (unsigned char*)arg); + break; +#ifdef CSR_SUPPORT_SME + case UNIFI_CFG_CORE_DUMP: + CsrWifiRouterCtrlWifiOffIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,0,CSR_WIFI_SME_CONTROL_INDICATION_ERROR); + unifi_trace(priv, UDBG2, "UNIFI_CFG_CORE_DUMP: sent wifi off indication\n"); + break; +#endif +#ifdef CSR_SUPPORT_WEXT_AP + case UNIFI_CFG_SET_AP_CONFIG: + r= unifi_cfg_set_ap_config(priv,(unsigned char*)arg); + break; +#endif + default: + unifi_error(priv, "UNIFI_CFG: Unknown Command (%d)\n", cfg_cmd); + r = -EINVAL; + goto out; + } +#endif + + break; + + case UNIFI_PUTEST: + if (get_user(putest_cmd, (unifi_putest_command_t*)arg)) + { + unifi_error(priv, "UNIFI_PUTEST: Failed to get the command\n"); + r = -EFAULT; + goto out; + } + + unifi_trace(priv, UDBG1, "UNIFI_PUTEST: Command is %s\n", + trace_putest_cmdid(putest_cmd)); + switch (putest_cmd) { + case UNIFI_PUTEST_START: + r = unifi_putest_start(priv, (unsigned char*)arg); + break; + case UNIFI_PUTEST_STOP: + r = unifi_putest_stop(priv, (unsigned char*)arg); + break; + case UNIFI_PUTEST_SET_SDIO_CLOCK: + r = unifi_putest_set_sdio_clock(priv, (unsigned char*)arg); + break; + case UNIFI_PUTEST_CMD52_READ: + r = unifi_putest_cmd52_read(priv, (unsigned char*)arg); + break; + case UNIFI_PUTEST_CMD52_BLOCK_READ: + r = unifi_putest_cmd52_block_read(priv, (unsigned char*)arg); + break; + case UNIFI_PUTEST_CMD52_WRITE: + r = unifi_putest_cmd52_write(priv, (unsigned char*)arg); + break; + case UNIFI_PUTEST_DL_FW: + r = unifi_putest_dl_fw(priv, (unsigned char*)arg); + break; + case UNIFI_PUTEST_DL_FW_BUFF: + r = unifi_putest_dl_fw_buff(priv, (unsigned char*)arg); + break; + case UNIFI_PUTEST_COREDUMP_PREPARE: + r = unifi_putest_coredump_prepare(priv, (unsigned char*)arg); + break; + case UNIFI_PUTEST_GP_READ16: + r = unifi_putest_gp_read16(priv, (unsigned char*)arg); + break; + case UNIFI_PUTEST_GP_WRITE16: + r = unifi_putest_gp_write16(priv, (unsigned char*)arg); + break; + default: + unifi_error(priv, "UNIFI_PUTEST: Unknown Command (%d)\n", putest_cmd); + r = -EINVAL; + goto out; + } + + break; + case UNIFI_BUILD_TYPE: + unifi_trace(priv, UDBG2, "UNIFI_BUILD_TYPE userspace=%s\n", build_type_to_string(*(unsigned char*)arg)); +#ifndef CSR_SUPPORT_WEXT_AP + if (UNIFI_BUILD_AP == *(unsigned char*)arg) + { + unifi_error(priv, "Userspace has AP support, which is incompatible\n"); + } +#endif + +#ifndef CSR_SUPPORT_WEXT + if (UNIFI_BUILD_WEXT == *(unsigned char*)arg) + { + unifi_error(priv, "Userspace has WEXT support, which is incompatible\n"); + } +#endif + break; + case UNIFI_INIT_HW: + unifi_trace(priv, UDBG2, "UNIFI_INIT_HW.\n"); + priv->init_progress = UNIFI_INIT_NONE; + +#if defined(CSR_SUPPORT_WEXT) || defined (CSR_NATIVE_LINUX) + /* At this point we are ready to start the SME. */ + r = sme_mgt_wifi_on(priv); + if (r) { + goto out; + } +#endif + + break; + + case UNIFI_INIT_NETDEV: + { + /* get the proper interfaceTagId */ + CsrUint16 interfaceTag=0; + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + + dev = priv->netdev[interfaceTag]; + unifi_trace(priv, UDBG2, "UNIFI_INIT_NETDEV.\n"); + + if (copy_from_user((void*)dev->dev_addr, (void*)arg, 6)) { + r = -EFAULT; + goto out; + } + + /* Attach the network device to the stack */ + if (!interfacePriv->netdev_registered) + { + r = uf_register_netdev(priv,interfaceTag); + if (r) { + unifi_error(priv, "Failed to register the network device.\n"); + goto out; + } + } + + /* Apply scheduled interrupt mode, if requested by module param */ + if (run_bh_once != -1) { + unifi_set_interrupt_mode(priv->card, (CsrUint32)run_bh_once); + } + + priv->init_progress = UNIFI_INIT_COMPLETED; + + /* Firmware initialisation is complete, so let the SDIO bus + * clock be raised when convienent to the core. + */ + unifi_request_max_sdio_clock(priv->card); + +#ifdef CSR_SUPPORT_WEXT + /* Notify the Android wpa_supplicant that we are ready */ + wext_send_started_event(priv); +#endif + + unifi_info(priv, "UniFi ready\n"); + +#ifdef CSR_NATIVE_SOFTMAC /* For softmac dev, force-enable the network interface rather than wait for a connected-ind */ + { + struct net_device *dev = priv->netdev[interfaceTag]; +#ifdef CSR_SUPPORT_WEXT + interfacePriv->wait_netdev_change = TRUE; +#endif + netif_carrier_on(dev); + } +#endif + } + break; + case UNIFI_GET_INIT_STATUS: + unifi_trace(priv, UDBG2, "UNIFI_GET_INIT_STATUS.\n"); + if (put_user(priv->init_progress, (int*)arg)) + { + printk(KERN_ERR "UNIFI_GET_INIT_STATUS: Failed to copy to user\n"); + r = -EFAULT; + goto out; + } + break; + + case UNIFI_KICK: + unifi_trace(priv, UDBG4, "Kick UniFi\n"); + unifi_sdio_interrupt_handler(priv->card); + break; + + case UNIFI_SET_DEBUG: + unifi_debug = arg; + unifi_trace(priv, UDBG4, "unifi_debug set to %d\n", unifi_debug); + break; + + case UNIFI_SET_TRACE: + /* no longer supported */ + r = -EINVAL; + break; + + + case UNIFI_SET_UDI_LOG_MASK: + { + unifiio_filter_t udi_filter; + uint16_t *sig_ids_addr; +#define UF_MAX_SIG_IDS 128 /* Impose a sensible limit */ + + if (copy_from_user((void*)(&udi_filter), (void*)arg, sizeof(udi_filter))) { + r = -EFAULT; + goto out; + } + if ((udi_filter.action < UfSigFil_AllOn) || + (udi_filter.action > UfSigFil_SelectOff)) + { + printk(KERN_WARNING + "UNIFI_SET_UDI_LOG_MASK: Bad action value: %d\n", + udi_filter.action); + r = -EINVAL; + goto out; + } + /* No signal list for "All" actions */ + if ((udi_filter.action == UfSigFil_AllOn) || + (udi_filter.action == UfSigFil_AllOff)) + { + udi_filter.num_sig_ids = 0; + } + + if (udi_filter.num_sig_ids > UF_MAX_SIG_IDS) { + printk(KERN_WARNING + "UNIFI_SET_UDI_LOG_MASK: too many signal ids (%d, max %d)\n", + udi_filter.num_sig_ids, UF_MAX_SIG_IDS); + r = -EINVAL; + goto out; + } + + /* Copy in signal id list if given */ + if (udi_filter.num_sig_ids > 0) { + /* Preserve userspace address of sig_ids array */ + sig_ids_addr = udi_filter.sig_ids; + /* Allocate kernel memory for sig_ids and copy to it */ + udi_filter.sig_ids = + kmalloc(udi_filter.num_sig_ids * sizeof(uint16_t), GFP_KERNEL); + if (!udi_filter.sig_ids) { + r = -ENOMEM; + goto out; + } + if (copy_from_user((void*)udi_filter.sig_ids, + (void*)sig_ids_addr, + udi_filter.num_sig_ids * sizeof(uint16_t))) + { + kfree(udi_filter.sig_ids); + r = -EFAULT; + goto out; + } + } + + udi_set_log_filter(pcli, &udi_filter); + + if (udi_filter.num_sig_ids > 0) { + kfree(udi_filter.sig_ids); + } + } + break; + + case UNIFI_SET_AMP_ENABLE: + unifi_trace(priv, UDBG4, "UniFi Set AMP Enable\n"); + if (get_user(int_param, (int*)arg)) + { + unifi_error(priv, "UNIFI_SET_AMP_ENABLE: Failed to copy from user\n"); + r = -EFAULT; + goto out; + } + + if (int_param) { + priv->amp_client = pcli; + } else { + priv->amp_client = NULL; + } + + int_param = 0; + buf = (u8*)&int_param; + buf[0] = UNIFI_SOFT_COMMAND_Q_LENGTH - 1; + buf[1] = UNIFI_SOFT_TRAFFIC_Q_LENGTH - 1; + if (copy_to_user((void*)arg, &int_param, sizeof(int))) { + r = -EFAULT; + goto out; + } + break; + + case UNIFI_SET_UDI_SNAP_MASK: + { + unifiio_snap_filter_t snap_filter; + + if (copy_from_user((void*)(&snap_filter), (void*)arg, sizeof(snap_filter))) { + r = -EFAULT; + goto out; + } + + if (pcli->snap_filter.count) { + pcli->snap_filter.count = 0; + CsrPmemFree(pcli->snap_filter.protocols); + } + + if (snap_filter.count == 0) { + break; + } + + pcli->snap_filter.protocols = CsrPmemAlloc(snap_filter.count * sizeof(CsrUint16)); + if (!pcli->snap_filter.protocols) { + r = -ENOMEM; + goto out; + } + if (copy_from_user((void*)pcli->snap_filter.protocols, + (void*)snap_filter.protocols, + snap_filter.count * sizeof(CsrUint16))) + { + CsrPmemFree(pcli->snap_filter.protocols); + r = -EFAULT; + goto out; + } + + pcli->snap_filter.count = snap_filter.count; + + } + break; + + case UNIFI_SME_PRESENT: + { + u8 ind; + unifi_trace(priv, UDBG4, "UniFi SME Present IOCTL.\n"); + if (copy_from_user((void*)(&int_param), (void*)arg, sizeof(int))) + { + printk(KERN_ERR "UNIFI_SME_PRESENT: Failed to copy from user\n"); + r = -EFAULT; + goto out; + } + + priv->sme_is_present = int_param; + if (priv->sme_is_present == 1) { + ind = CONFIG_SME_PRESENT; + } else { + ind = CONFIG_SME_NOT_PRESENT; + } + /* Send an indication to the helper app. */ + ul_log_config_ind(priv, &ind, sizeof(u8)); + } + break; + + case UNIFI_CFG_PERIOD_TRAFFIC: + { +#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT) + CsrWifiSmeCoexConfig coexConfig; +#endif /* CSR_SUPPORT_SME && CSR_SUPPORT_WEXT */ + unifi_trace(priv, UDBG4, "UniFi Configure Periodic Traffic.\n"); +#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT) + if (copy_from_user((void*)(&uchar_param), (void*)arg, sizeof(unsigned char))) { + unifi_error(priv, "UNIFI_CFG_PERIOD_TRAFFIC: Failed to copy from user\n"); + r = -EFAULT; + goto out; + } + + if (uchar_param == 0) { + r = sme_mgt_coex_config_get(priv, &coexConfig); + if (r) { + unifi_error(priv, "UNIFI_CFG_PERIOD_TRAFFIC: Get unifi_CoexInfoValue failed.\n"); + goto out; + } + if (copy_to_user((void*)(arg + 1), + (void*)&coexConfig, + sizeof(CsrWifiSmeCoexConfig))) { + r = -EFAULT; + goto out; + } + goto out; + } + + if (copy_from_user((void*)(&coex_config), (void*)(arg + 1), sizeof(CsrWifiSmeCoexConfig))) + { + unifi_error(priv, "UNIFI_CFG_PERIOD_TRAFFIC: Failed to copy from user\n"); + r = -EFAULT; + goto out; + } + + coexConfig = coex_config; + r = sme_mgt_coex_config_set(priv, &coexConfig); + if (r) { + unifi_error(priv, "UNIFI_CFG_PERIOD_TRAFFIC: Set unifi_CoexInfoValue failed.\n"); + goto out; + } + +#endif /* CSR_SUPPORT_SME && CSR_SUPPORT_WEXT */ + break; + } + case UNIFI_CFG_UAPSD_TRAFFIC: + unifi_trace(priv, UDBG4, "UniFi Configure U-APSD Mask.\n"); +#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT) + if (copy_from_user((void*)(&uchar_param), (void*)arg, sizeof(unsigned char))) { + unifi_error(priv, "UNIFI_CFG_UAPSD_TRAFFIC: Failed to copy from user\n"); + r = -EFAULT; + goto out; + } + unifi_trace(priv, UDBG4, "New U-APSD Mask: 0x%x\n", uchar_param); +#endif /* CSR_SUPPORT_SME && CSR_SUPPORT_WEXT */ + break; + +#ifndef UNIFI_DISABLE_COREDUMP + case UNIFI_COREDUMP_GET_REG: + unifi_trace(priv, UDBG4, "Mini-coredump data request\n"); + { + unifiio_coredump_req_t dump_req; /* Public OS layer structure */ + unifi_coredump_req_t priv_req; /* Private HIP structure */ + + if (copy_from_user((void*)(&dump_req), (void*)arg, sizeof(dump_req))) { + r = -EFAULT; + goto out; + } + memset(&priv_req, 0, sizeof(priv_req)); + priv_req.index = dump_req.index; + priv_req.offset = dump_req.offset; + + /* Convert OS-layer's XAP memory space ID to HIP's ID in case they differ */ + switch (dump_req.space) { + case UNIFIIO_COREDUMP_MAC_REG: priv_req.space = UNIFI_COREDUMP_MAC_REG; break; + case UNIFIIO_COREDUMP_PHY_REG: priv_req.space = UNIFI_COREDUMP_PHY_REG; break; + case UNIFIIO_COREDUMP_SH_DMEM: priv_req.space = UNIFI_COREDUMP_SH_DMEM; break; + case UNIFIIO_COREDUMP_MAC_DMEM: priv_req.space = UNIFI_COREDUMP_MAC_DMEM; break; + case UNIFIIO_COREDUMP_PHY_DMEM: priv_req.space = UNIFI_COREDUMP_PHY_DMEM; break; + case UNIFIIO_COREDUMP_TRIGGER_MAGIC: priv_req.space = UNIFI_COREDUMP_TRIGGER_MAGIC; break; + default: + r = -EINVAL; + goto out; + } + + if (priv_req.space == UNIFI_COREDUMP_TRIGGER_MAGIC) { + /* Force a coredump grab now */ + unifi_trace(priv, UDBG2, "UNIFI_COREDUMP_GET_REG: Force capture\n"); + csrResult = unifi_coredump_capture(priv->card, &priv_req); + r = CsrHipResultToStatus(csrResult); + unifi_trace(priv, UDBG5, "UNIFI_COREDUMP_GET_REG: status %d\n", r); + } else { + /* Retrieve the appropriate register entry */ + csrResult = unifi_coredump_get_value(priv->card, &priv_req); + r = CsrHipResultToStatus(csrResult); + if (r) { + unifi_trace(priv, UDBG5, "UNIFI_COREDUMP_GET_REG: Status %d\n", r); + goto out; + } + /* Update the OS-layer structure with values returned in the private */ + dump_req.value = priv_req.value; + dump_req.timestamp = priv_req.timestamp; + dump_req.requestor = priv_req.requestor; + dump_req.serial = priv_req.serial; + dump_req.chip_ver = priv_req.chip_ver; + dump_req.fw_ver = priv_req.fw_ver; + dump_req.drv_build = 0; + + unifi_trace(priv, UDBG6, + "Dump: %d (seq %d): V:0x%04x (%d) @0x%02x:%04x = 0x%04x\n", + dump_req.index, dump_req.serial, + dump_req.chip_ver, dump_req.drv_build, + dump_req.space, dump_req.offset, dump_req.value); + } + if (copy_to_user((void*)arg, (void*)&dump_req, sizeof(dump_req))) { + r = -EFAULT; + goto out; + } + } + break; +#endif + default: + r = -EINVAL; + } + +out: + return (long)r; +} /* unifi_ioctl() */ + + + +static unsigned int +unifi_poll(struct file *filp, poll_table *wait) +{ + ul_client_t *pcli = (ul_client_t*)filp->private_data; + unsigned int mask = 0; + int ready; + + func_enter(); + + ready = !list_empty(&pcli->udi_log); + + poll_wait(filp, &pcli->udi_wq, wait); + + if (ready) { + mask |= POLLIN | POLLRDNORM; /* readable */ + } + + func_exit(); + + return mask; +} /* unifi_poll() */ + + + +/* + * --------------------------------------------------------------------------- + * udi_set_log_filter + * + * Configure the bit mask that determines which signal primitives are + * passed to the logging process. + * + * Arguments: + * pcli Pointer to the client to configure. + * udi_filter Pointer to a unifiio_filter_t containing instructions. + * + * Returns: + * None. + * + * Notes: + * SigGetFilterPos() returns a 32-bit value that contains an index and a + * mask for accessing a signal_filter array. The top 16 bits specify an + * index into a signal_filter, the bottom 16 bits specify a mask to + * apply. + * --------------------------------------------------------------------------- + */ +static void +udi_set_log_filter(ul_client_t *pcli, unifiio_filter_t *udi_filter) +{ + CsrUint32 filter_pos; + int i; + + if (udi_filter->action == UfSigFil_AllOn) + { + for (i = 0; i < SIG_FILTER_SIZE; i++) { + pcli->signal_filter[i] = 0xFFFF; + } + } + else if (udi_filter->action == UfSigFil_AllOff) + { + for (i = 0; i < SIG_FILTER_SIZE; i++) { + pcli->signal_filter[i] = 0; + } + } + else if (udi_filter->action == UfSigFil_SelectOn) + { + for (i = 0; i < udi_filter->num_sig_ids; i++) { + filter_pos = SigGetFilterPos(udi_filter->sig_ids[i]); + if (filter_pos == 0xFFFFFFFF) + { + printk(KERN_WARNING + "Unrecognised signal id (0x%X) specifed in logging filter\n", + udi_filter->sig_ids[i]); + } else { + pcli->signal_filter[filter_pos >> 16] |= (filter_pos & 0xFFFF); + } + } + } + else if (udi_filter->action == UfSigFil_SelectOff) + { + for (i = 0; i < udi_filter->num_sig_ids; i++) { + filter_pos = SigGetFilterPos(udi_filter->sig_ids[i]); + if (filter_pos == 0xFFFFFFFF) + { + printk(KERN_WARNING + "Unrecognised signal id (0x%X) specifed in logging filter\n", + udi_filter->sig_ids[i]); + } else { + pcli->signal_filter[filter_pos >> 16] &= ~(filter_pos & 0xFFFF); + } + } + } + +} /* udi_set_log_filter() */ + + +/* + * --------------------------------------------------------------------------- + * udi_log_event + * + * Callback function to be registered as the UDI hook callback. + * Copies the signal content into a new udi_log_t struct and adds + * it to the read queue for this UDI client. + * + * Arguments: + * pcli A pointer to the client instance. + * signal Pointer to the received signal. + * signal_len Size of the signal structure in bytes. + * bulkdata Pointers to any associated bulk data. + * dir Direction of the signal. Zero means from host, + * non-zero means to host. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +void +udi_log_event(ul_client_t *pcli, + const u8 *signal, int signal_len, + const bulk_data_param_t *bulkdata, + int dir) +{ + udi_log_t *logptr; + u8 *p; + int i; + int total_len; + udi_msg_t *msgptr; + CsrUint32 filter_pos; +#ifdef OMNICLI_LINUX_EXTRA_LOG + static volatile unsigned int printk_cpu = UINT_MAX; + unsigned long long t; + unsigned long nanosec_rem; + unsigned long n_1000; +#endif + + func_enter(); + + /* Just a sanity check */ + if ((signal == NULL) || (signal_len <= 0)) { + return; + } + +#ifdef CSR_NATIVE_LINUX + uf_native_process_udi_signal(pcli, signal, signal_len, bulkdata, dir); +#endif + + /* + * Apply the logging filter - only report signals that have their + * bit set in the filter mask. + */ + filter_pos = SigGetFilterPos(GET_SIGNAL_ID(signal)); + + if ((filter_pos != 0xFFFFFFFF) && + ((pcli->signal_filter[filter_pos >> 16] & (filter_pos & 0xFFFF)) == 0)) + { + /* Signal is not wanted by client */ + return; + } + + + /* Calculate the buffer we need to store signal plus bulk data */ + total_len = signal_len; + for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { + total_len += bulkdata->d[i].data_length; + } + + /* Allocate log structure plus actual signal. */ + logptr = (udi_log_t *)kmalloc(sizeof(udi_log_t) + total_len, GFP_KERNEL); + + if (logptr == NULL) { + printk(KERN_ERR + "Failed to allocate %lu bytes for a UDI log record\n", + (long unsigned int)(sizeof(udi_log_t) + total_len)); + return; + } + + /* Fill in udi_log struct */ + INIT_LIST_HEAD(&logptr->q); + msgptr = &logptr->msg; + msgptr->length = sizeof(udi_msg_t) + total_len; +#ifdef OMNICLI_LINUX_EXTRA_LOG + t = cpu_clock(printk_cpu); + nanosec_rem = do_div(t, 1000000000); + n_1000 = nanosec_rem/1000; + msgptr->timestamp = (t <<10 ) | ((unsigned long)(n_1000 >> 10) & 0x3ff); +#else + msgptr->timestamp = jiffies_to_msecs(jiffies); +#endif + msgptr->direction = dir; + msgptr->signal_length = signal_len; + + /* Copy signal and bulk data to the log */ + p = (u8 *)(msgptr + 1); + memcpy(p, signal, signal_len); + p += signal_len; + + /* Append any bulk data */ + for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { + int len = bulkdata->d[i].data_length; + + /* + * Len here might not be the same as the length in the bulk data slot. + * The slot length will always be even, but len could be odd. + */ + if (len > 0) { + if (bulkdata->d[i].os_data_ptr) { + memcpy(p, bulkdata->d[i].os_data_ptr, len); + } else { + memset(p, 0, len); + } + p += len; + } + } + + /* Add to tail of log queue */ + if (down_interruptible(&pcli->udi_sem)) { + printk(KERN_WARNING "udi_log_event_q: Failed to get udi sem\n"); + kfree(logptr); + func_exit(); + return; + } + list_add_tail(&logptr->q, &pcli->udi_log); + up(&pcli->udi_sem); + + /* Wake any waiting user process */ + wake_up_interruptible(&pcli->udi_wq); + + func_exit(); +} /* udi_log_event() */ + +#ifdef CSR_SME_USERSPACE +int +uf_sme_queue_message(unifi_priv_t *priv, u8 *buffer, int length) +{ + udi_log_t *logptr; + udi_msg_t *msgptr; + u8 *p; + + func_enter(); + + /* Just a sanity check */ + if ((buffer == NULL) || (length <= 0)) { + return -EINVAL; + } + + /* Allocate log structure plus actual signal. */ + logptr = (udi_log_t *)kmalloc(sizeof(udi_log_t) + length, GFP_ATOMIC); + if (logptr == NULL) { + unifi_error(priv, "Failed to allocate %d bytes for an SME message\n", + sizeof(udi_log_t) + length); + CsrPmemFree(buffer); + return -ENOMEM; + } + + /* Fill in udi_log struct */ + INIT_LIST_HEAD(&logptr->q); + msgptr = &logptr->msg; + msgptr->length = sizeof(udi_msg_t) + length; + msgptr->signal_length = length; + + /* Copy signal and bulk data to the log */ + p = (u8 *)(msgptr + 1); + memcpy(p, buffer, length); + + /* Add to tail of log queue */ + down(&udi_mutex); + if (priv->sme_cli == NULL) { + kfree(logptr); + CsrPmemFree(buffer); + up(&udi_mutex); + unifi_info(priv, "Message for the SME dropped, SME has gone away\n"); + return 0; + } + + down(&priv->sme_cli->udi_sem); + list_add_tail(&logptr->q, &priv->sme_cli->udi_log); + up(&priv->sme_cli->udi_sem); + + /* Wake any waiting user process */ + wake_up_interruptible(&priv->sme_cli->udi_wq); + up(&udi_mutex); + + /* It is our responsibility to free the buffer allocated in build_packed_*() */ + CsrPmemFree(buffer); + + func_exit(); + + return 0; + +} /* uf_sme_queue_message() */ +#endif + + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) +#define UF_DEVICE_CREATE(_class, _parent, _devno, _priv, _fmt, _args) \ + device_create(_class, _parent, _devno, _priv, _fmt, _args) +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) +#define UF_DEVICE_CREATE(_class, _parent, _devno, _priv, _fmt, _args) \ + device_create_drvdata(_class, _parent, _devno, _priv, _fmt, _args) +#else +#define UF_DEVICE_CREATE(_class, _parent, _devno, _priv, _fmt, _args) \ + device_create(_class, _parent, _devno, _fmt, _args) +#endif + +/* + **************************************************************************** + * + * Driver instantiation + * + **************************************************************************** + */ +static struct file_operations unifi_fops = { + .owner = THIS_MODULE, + .open = unifi_open, + .release = unifi_release, + .read = unifi_read, + .write = unifi_write, + .unlocked_ioctl = unifi_ioctl, + .poll = unifi_poll, +}; + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) +#define UF_DEVICE_CREATE(_class, _parent, _devno, _priv, _fmt, _args) \ + device_create(_class, _parent, _devno, _priv, _fmt, _args) +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) +#define UF_DEVICE_CREATE(_class, _parent, _devno, _priv, _fmt, _args) \ + device_create_drvdata(_class, _parent, _devno, _priv, _fmt, _args) +#else +#define UF_DEVICE_CREATE(_class, _parent, _devno, _priv, _fmt, _args) \ + device_create(_class, _parent, _devno, _fmt, _args) +#endif + +static dev_t unifi_first_devno; +static struct class *unifi_class; + + +int uf_create_device_nodes(unifi_priv_t *priv, int bus_id) +{ + dev_t devno; + int r; + + cdev_init(&priv->unifi_cdev, &unifi_fops); + + /* cdev_init() should set the cdev owner, but it does not */ + priv->unifi_cdev.owner = THIS_MODULE; + + devno = MKDEV(MAJOR(unifi_first_devno), + MINOR(unifi_first_devno) + (bus_id * 2)); + r = cdev_add(&priv->unifi_cdev, devno, 1); + if (r) { + return r; + } + +#ifdef SDIO_EXPORTS_STRUCT_DEVICE + if (!UF_DEVICE_CREATE(unifi_class, priv->unifi_device, + devno, priv, "unifi%d", bus_id)) { +#else + priv->unifi_device = UF_DEVICE_CREATE(unifi_class, NULL, + devno, priv, "unifi%d", bus_id); + if (priv->unifi_device == NULL) { +#endif /* SDIO_EXPORTS_STRUCT_DEVICE */ + + cdev_del(&priv->unifi_cdev); + return -EINVAL; + } + + cdev_init(&priv->unifiudi_cdev, &unifi_fops); + + /* cdev_init() should set the cdev owner, but it does not */ + priv->unifiudi_cdev.owner = THIS_MODULE; + + devno = MKDEV(MAJOR(unifi_first_devno), + MINOR(unifi_first_devno) + (bus_id * MAX_UNIFI_DEVS) + 1); + r = cdev_add(&priv->unifiudi_cdev, devno, 1); + if (r) { + device_destroy(unifi_class, priv->unifi_cdev.dev); + cdev_del(&priv->unifi_cdev); + return r; + } + + if (!UF_DEVICE_CREATE(unifi_class, +#ifdef SDIO_EXPORTS_STRUCT_DEVICE + priv->unifi_device, +#else + NULL, +#endif /* SDIO_EXPORTS_STRUCT_DEVICE */ + devno, priv, "unifiudi%d", bus_id)) { + device_destroy(unifi_class, priv->unifi_cdev.dev); + cdev_del(&priv->unifiudi_cdev); + cdev_del(&priv->unifi_cdev); + return -EINVAL; + } + + return 0; +} + + +void uf_destroy_device_nodes(unifi_priv_t *priv) +{ + device_destroy(unifi_class, priv->unifiudi_cdev.dev); + device_destroy(unifi_class, priv->unifi_cdev.dev); + cdev_del(&priv->unifiudi_cdev); + cdev_del(&priv->unifi_cdev); +} + + + +/* + * ---------------------------------------------------------------- + * uf_create_debug_device + * + * Allocates device numbers for unifi character device nodes + * and creates a unifi class in sysfs + * + * Arguments: + * fops Pointer to the char device operations structure. + * + * Returns: + * 0 on success, -ve error code on error. + * ---------------------------------------------------------------- + */ +static int +uf_create_debug_device(struct file_operations *fops) +{ + int ret; + + /* Allocate two device numbers for each device. */ + ret = alloc_chrdev_region(&unifi_first_devno, 0, MAX_UNIFI_DEVS*2, UNIFI_NAME); + if (ret) { + unifi_error(NULL, "Failed to add alloc dev numbers: %d\n", ret); + return ret; + } + + /* Create a UniFi class */ + unifi_class = class_create(THIS_MODULE, UNIFI_NAME); + if (IS_ERR(unifi_class)) { + unifi_error(NULL, "Failed to create UniFi class\n"); + + /* Release device numbers */ + unregister_chrdev_region(unifi_first_devno, MAX_UNIFI_DEVS*2); + unifi_first_devno = 0; + return -EINVAL; + } + + return 0; +} /* uf_create_debug_device() */ + + +/* + * ---------------------------------------------------------------- + * uf_remove_debug_device + * + * Destroys the unifi class and releases the allocated + * device numbers for unifi character device nodes. + * + * Arguments: + * + * Returns: + * ---------------------------------------------------------------- + */ +static void +uf_remove_debug_device(void) +{ + /* Destroy the UniFi class */ + class_destroy(unifi_class); + + /* Release device numbers */ + unregister_chrdev_region(unifi_first_devno, MAX_UNIFI_DEVS*2); + unifi_first_devno = 0; + +} /* uf_remove_debug_device() */ + + +/* + * --------------------------------------------------------------------------- + * + * Module loading. + * + * --------------------------------------------------------------------------- + */ +int __init +unifi_load(void) +{ + int r; + + printk("UniFi SDIO Driver: %s %s %s\n", + CSR_WIFI_VERSION, + __DATE__, __TIME__); + +#ifdef CSR_SME_USERSPACE +#ifdef CSR_SUPPORT_WEXT + printk("CSR SME with WEXT support\n"); +#else + printk("CSR SME no WEXT support\n"); +#endif /* CSR_SUPPORT_WEXT */ +#endif /* CSR_SME_USERSPACE */ + +#ifdef CSR_NATIVE_LINUX +#ifdef CSR_SUPPORT_WEXT +#error WEXT unsupported in the native driver +#endif + printk("CSR native no WEXT support\n"); +#endif + + printk("Kernel %d.%d.%d\n", + ((LINUX_VERSION_CODE) >> 16) & 0xff, + ((LINUX_VERSION_CODE) >> 8) & 0xff, + (LINUX_VERSION_CODE) & 0xff); + /* + * Instantiate the /dev/unifi* device nodes. + * We must do this before registering with the SDIO driver because it + * will immediately call the "insert" callback if the card is + * already present. + */ + r = uf_create_debug_device(&unifi_fops); + if (r) { + return r; + } + + /* Now register with the SDIO driver */ + r = uf_sdio_load(); + if (r) { + uf_remove_debug_device(); + return r; + } + + if (sdio_block_size > -1) { + unifi_info(NULL, "sdio_block_size %d\n", sdio_block_size); + } + + if (sdio_byte_mode) { + unifi_info(NULL, "sdio_byte_mode\n"); + } + + if (disable_power_control) { + unifi_info(NULL, "disable_power_control\n"); + } + + if (disable_hw_reset) { + unifi_info(NULL, "disable_hw_reset\n"); + } + + if (enable_wol) { + unifi_info(NULL, "enable_wol %d\n", enable_wol); + } + + if (run_bh_once != -1) { + unifi_info(NULL, "run_bh_once %d\n", run_bh_once); + } + + return 0; +} /* unifi_load() */ + + +void __exit +unifi_unload(void) +{ + /* The SDIO remove hook will call unifi_disconnect(). */ + uf_sdio_unload(); + + uf_remove_debug_device(); + +} /* unifi_unload() */ + +module_init(unifi_load); +module_exit(unifi_unload); + +MODULE_DESCRIPTION("UniFi Device driver"); +MODULE_AUTHOR("Cambridge Silicon Radio Ltd."); +MODULE_LICENSE("GPL and additional rights"); diff --git a/drivers/staging/csr/firmware.c b/drivers/staging/csr/firmware.c new file mode 100644 index 0000000..4ac3c89 --- /dev/null +++ b/drivers/staging/csr/firmware.c @@ -0,0 +1,398 @@ +/* + * --------------------------------------------------------------------------- + * FILE: firmware.c + * + * PURPOSE: + * Implements the f/w related HIP core lib API. + * It is part of the porting exercise in Linux. + * + * Also, it contains example code for reading the loader and f/w files + * from the userspace and starting the SME in Linux. + * + * Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * --------------------------------------------------------------------------- + */ +#include +#include +#include +#include +#include "csr_wifi_hip_unifi.h" +#include "csr_wifi_hip_unifi_udi.h" +#include "unifiio.h" +#include "unifi_priv.h" + +/* + * --------------------------------------------------------------------------- + * + * F/W download. Part of the HIP core API + * + * --------------------------------------------------------------------------- + */ + + +/* + * --------------------------------------------------------------------------- + * unifi_fw_read_start + * + * Returns a structure to be passed in unifi_fw_read(). + * This structure is an OS specific description of the f/w file. + * In the linux implementation it is a buffer with the f/w and its' length. + * The HIP driver calls this functions to request for the loader or + * the firmware file. + * The structure pointer can be freed when unifi_fw_read_stop() is called. + * + * Arguments: + * ospriv Pointer to driver context. + * is_fw Type of firmware to retrieve + * info Versions information. Can be used to determine + * the appropriate f/w file to load. + * + * Returns: + * O on success, non-zero otherwise. + * + * --------------------------------------------------------------------------- + */ +void* +unifi_fw_read_start(void *ospriv, CsrInt8 is_fw, const card_info_t *info) +{ + unifi_priv_t *priv = (unifi_priv_t*)ospriv; + CSR_UNUSED(info); + + func_enter(); + + if (is_fw == UNIFI_FW_STA) { + /* F/w may have been released after a previous successful download. */ + if (priv->fw_sta.dl_data == NULL) { + unifi_trace(priv, UDBG2, "Attempt reload of sta f/w\n"); + uf_request_firmware_files(priv, UNIFI_FW_STA); + } + /* Set up callback struct for readfunc() */ + if (priv->fw_sta.dl_data != NULL) { + func_exit(); + return &priv->fw_sta; + } + + } else { + unifi_error(priv, "downloading firmware... unknown request: %d\n", is_fw); + } + + func_exit(); + return NULL; +} /* unifi_fw_read_start() */ + + + +/* + * --------------------------------------------------------------------------- + * unifi_fw_read_stop + * + * Called when the HIP driver has finished using the loader or + * the firmware file. + * The firmware buffer may be released now. + * + * Arguments: + * ospriv Pointer to driver context. + * dlpriv The pointer returned by unifi_fw_read_start() + * + * --------------------------------------------------------------------------- + */ +void +unifi_fw_read_stop(void *ospriv, void *dlpriv) +{ + unifi_priv_t *priv = (unifi_priv_t*)ospriv; + struct dlpriv *dl_struct = (struct dlpriv *)dlpriv; + func_enter(); + + if (dl_struct != NULL) { + if (dl_struct->dl_data != NULL) { + unifi_trace(priv, UDBG2, "Release f/w buffer %p, %d bytes\n", + dl_struct->dl_data, dl_struct->dl_len); + } + uf_release_firmware(priv, dl_struct); + } + + func_exit(); +} /* unifi_fw_read_stop() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_fw_open_buffer + * + * Returns a handle for a buffer dynamically allocated by the driver, + * e.g. into which a firmware file may have been converted from another format + * which is the case with some production test images. + * + * The handle may then be used by unifi_fw_read() to access the contents of + * the buffer. + * + * Arguments: + * ospriv Pointer to driver context. + * fwbuf Buffer containing firmware image + * len Length of buffer in bytes + * + * Returns + * Handle for buffer, or NULL on error + * --------------------------------------------------------------------------- + */ +void * +unifi_fw_open_buffer(void *ospriv, void *fwbuf, CsrUint32 len) +{ + unifi_priv_t *priv = (unifi_priv_t*)ospriv; + func_enter(); + + if (fwbuf == NULL) { + func_exit(); + return NULL; + } + priv->fw_conv.dl_data = fwbuf; + priv->fw_conv.dl_len = len; + priv->fw_conv.fw_desc = NULL; /* No OS f/w resource is associated */ + + func_exit(); + return &priv->fw_conv; +} + +/* + * --------------------------------------------------------------------------- + * unifi_fw_close_buffer + * + * Releases any handle for a buffer dynamically allocated by the driver, + * e.g. into which a firmware file may have been converted from another format + * which is the case with some production test images. + * + * + * Arguments: + * ospriv Pointer to driver context. + * fwbuf Buffer containing firmware image + * + * Returns + * Handle for buffer, or NULL on error + * --------------------------------------------------------------------------- + */ +void unifi_fw_close_buffer(void *ospriv, void *fwbuf) +{ +} + +/* + * --------------------------------------------------------------------------- + * unifi_fw_read + * + * The HIP driver calls this function to ask for a part of the loader or + * the firmware file. + * + * Arguments: + * ospriv Pointer to driver context. + * arg The pointer returned by unifi_fw_read_start(). + * offset The offset in the file to return from. + * buf A buffer to store the requested data. + * len The size of the buf and the size of the requested data. + * + * Returns + * The number of bytes read from the firmware image, or -ve on error + * --------------------------------------------------------------------------- + */ +CsrInt32 +unifi_fw_read(void *ospriv, void *arg, CsrUint32 offset, void *buf, CsrUint32 len) +{ + const struct dlpriv *dlpriv = arg; + + if (offset >= dlpriv->dl_len) { + /* at end of file */ + return 0; + } + + if ((offset + len) > dlpriv->dl_len) { + /* attempt to read past end of file */ + return -1; + } + + memcpy(buf, dlpriv->dl_data+offset, len); + + return len; + +} /* unifi_fw_read() */ + + + + +#define UNIFIHELPER_INIT_MODE_SMEEMB 0 +#define UNIFIHELPER_INIT_MODE_SMEUSER 2 +#define UNIFIHELPER_INIT_MODE_NATIVE 1 + +/* + * --------------------------------------------------------------------------- + * uf_run_unifihelper + * + * Ask userspace to send us firmware for download by running + * '/usr/sbin/unififw'. + * The same script starts the SME userspace application. + * Derived from net_run_sbin_hotplug(). + * + * Arguments: + * priv Pointer to OS private struct. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +int +uf_run_unifihelper(unifi_priv_t *priv) +{ +#ifdef CONFIG_HOTPLUG + +#ifdef ANDROID_BUILD + char *prog = "/system/bin/unififw"; +#else + char *prog = "/usr/sbin/unififw"; +#endif /* ANDROID_BUILD */ + + char *argv[6], *envp[4]; + char inst_str[8]; + char init_mode[8]; + int i, r; + +#if (defined CSR_SME_USERSPACE) && (!defined CSR_SUPPORT_WEXT) + unifi_trace(priv, UDBG1, "SME userspace build: run unifi_helper manually\n"); + return 0; +#endif + + unifi_trace(priv, UDBG1, "starting %s\n", prog); + + snprintf(inst_str, 8, "%d", priv->instance); +#if (defined CSR_SME_USERSPACE) + snprintf(init_mode, 8, "%d", UNIFIHELPER_INIT_MODE_SMEUSER); +#else + snprintf(init_mode, 8, "%d", UNIFIHELPER_INIT_MODE_NATIVE); +#endif /* CSR_SME_USERSPACE */ + + i = 0; + argv[i++] = prog; + argv[i++] = inst_str; + argv[i++] = init_mode; + argv[i++] = 0; + argv[i] = 0; + /* Don't add more args without making argv bigger */ + + /* minimal command environment */ + i = 0; + envp[i++] = "HOME=/"; + envp[i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin"; + envp[i] = 0; + /* Don't add more without making envp bigger */ + + unifi_trace(priv, UDBG2, "running %s %s %s\n", argv[0], argv[1], argv[2]); + + r = call_usermodehelper(argv[0], argv, envp, 0); + + return r; +#else + unifi_trace(priv, UDBG1, "Can't automatically download firmware because kernel does not have HOTPLUG\n"); + return -1; +#endif +} /* uf_run_unifihelper() */ + + + +/* + * --------------------------------------------------------------------------- + * uf_request_firmware_files + * + * Get the firmware files from userspace. + * + * Arguments: + * priv Pointer to OS private struct. + * is_fw type of firmware to load (UNIFI_FW_STA/LOADER) + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +int uf_request_firmware_files(unifi_priv_t *priv, int is_fw) +{ + /* uses the default method to get the firmware */ + const struct firmware *fw_entry; + int postfix; +#define UNIFI_MAX_FW_PATH_LEN 32 + char fw_name[UNIFI_MAX_FW_PATH_LEN]; + int r; + +#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT) + if (priv->mib_data.length) { + vfree(priv->mib_data.data); + priv->mib_data.data = NULL; + priv->mib_data.length = 0; + } +#endif /* CSR_SUPPORT_SME && CSR_SUPPORT_WEXT*/ + + postfix = priv->instance; + + if (is_fw == UNIFI_FW_STA) { + /* Free kernel buffer and reload */ + uf_release_firmware(priv, &priv->fw_sta); + scnprintf(fw_name, UNIFI_MAX_FW_PATH_LEN, "unifi-sdio-%d/%s", + postfix, "sta.xbv"); + r = request_firmware(&fw_entry, fw_name, priv->unifi_device); + if (r == 0) { + priv->fw_sta.dl_data = fw_entry->data; + priv->fw_sta.dl_len = fw_entry->size; + priv->fw_sta.fw_desc = (void *)fw_entry; + } else { + unifi_trace(priv, UDBG2, "Firmware file not available\n"); + } + } + + return 0; + +} /* uf_request_firmware_files() */ + +/* + * --------------------------------------------------------------------------- + * uf_release_firmware_files + * + * Release all buffers used to store firmware files + * + * Arguments: + * priv Pointer to OS private struct. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +int uf_release_firmware_files(unifi_priv_t *priv) +{ + uf_release_firmware(priv, &priv->fw_sta); + + return 0; +} + +/* + * --------------------------------------------------------------------------- + * uf_release_firmware + * + * Release specific buffer used to store firmware + * + * Arguments: + * priv Pointer to OS private struct. + * to_free Pointer to specific buffer to release + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +int uf_release_firmware(unifi_priv_t *priv, struct dlpriv *to_free) +{ + if (to_free != NULL) { + if (to_free->fw_desc != NULL) { + release_firmware((const struct firmware *)to_free->fw_desc); + } + to_free->fw_desc = NULL; + to_free->dl_data = NULL; + to_free->dl_len = 0; + } + return 0; +} diff --git a/drivers/staging/csr/indications.c b/drivers/staging/csr/indications.c new file mode 100644 index 0000000..834b5f3 --- /dev/null +++ b/drivers/staging/csr/indications.c @@ -0,0 +1,18 @@ +/* + * *************************************************************************** + * FILE: indications.c + * + * PURPOSE: + * Callbacks to process signals sent to us by the UniFi chip. + * + * This file is linux-specific. + * + * Copyright (C) 2005-2008 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * *************************************************************************** + */ +#include "csr_wifi_hip_unifi.h" +#include "unifi_priv.h" diff --git a/drivers/staging/csr/inet.c b/drivers/staging/csr/inet.c new file mode 100644 index 0000000..b4acb54 --- /dev/null +++ b/drivers/staging/csr/inet.c @@ -0,0 +1,106 @@ +/* + * --------------------------------------------------------------------------- + * FILE: inet.c + * + * PURPOSE: + * Routines related to IP address changes. + * Optional part of the porting exercise. It uses system network + * handlers to obtain the UniFi IP address and pass it to the SME + * using the unifi_sys_ip_configured_ind(). + * + * Copyright (C) 2008-2009 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * --------------------------------------------------------------------------- + */ +#include +#include + +#include "unifi_priv.h" +#include "csr_wifi_hip_conversions.h" + +/* + * The inet notifier is global and not per-netdev. To avoid having a + * notifier registered when there are no unifi devices present, it's + * registered after the first unifi network device is registered, and + * unregistered when the last unifi network device is unregistered. + */ + +static atomic_t inet_notif_refs = ATOMIC_INIT(0); + +static int uf_inetaddr_event(struct notifier_block *notif, unsigned long event, void *ifa) +{ + struct net_device *ndev; + unifi_priv_t *priv; + struct in_ifaddr *if_addr; + netInterface_priv_t *InterfacePriv = (netInterface_priv_t *)NULL; + + if (!ifa || !((struct in_ifaddr *)ifa)->ifa_dev) { + unifi_trace(NULL, UDBG1, "uf_inetaddr_event (%lu) ifa=%p\n", event, ifa); + return NOTIFY_DONE; + } + + ndev = ((struct in_ifaddr *)ifa)->ifa_dev->dev; + InterfacePriv = (netInterface_priv_t*) netdev_priv(ndev); + + /* As the notifier is global, the call may be for a non-UniFi netdev. + * Therefore check the netdev_priv to make sure it's a known UniFi one. + */ + if (uf_find_netdev_priv(InterfacePriv) == -1) { + unifi_trace(NULL, UDBG1, "uf_inetaddr_event (%lu) ndev=%p, other netdev_priv=%p\n", + event, ndev, InterfacePriv); + return NOTIFY_DONE; + } + + if (!InterfacePriv->privPtr) { + unifi_error(NULL, "uf_inetaddr_event null priv (%lu) ndev=%p, InterfacePriv=%p\n", + event, ndev, InterfacePriv); + return NOTIFY_DONE; + } + + priv = InterfacePriv->privPtr; + if_addr = (struct in_ifaddr *)ifa; + + /* If this event is for a UniFi device, notify the SME that an IP + * address has been added or removed. */ + if (uf_find_priv(priv) != -1) { + switch (event) { + case NETDEV_UP: + unifi_info(priv, "IP address assigned for %s\n", priv->netdev[InterfacePriv->InterfaceTag]->name); + priv->sta_ip_address = if_addr->ifa_address; +#ifdef CSR_SUPPORT_WEXT + sme_mgt_packet_filter_set(priv); +#endif + break; + case NETDEV_DOWN: + unifi_info(priv, "IP address removed for %s\n", priv->netdev[InterfacePriv->InterfaceTag]->name); + priv->sta_ip_address = 0xFFFFFFFF; +#ifdef CSR_SUPPORT_WEXT + sme_mgt_packet_filter_set(priv); +#endif + break; + } + } + + return NOTIFY_DONE; +} + +static struct notifier_block uf_inetaddr_notifier = { + .notifier_call = uf_inetaddr_event, +}; + +void uf_register_inet_notifier(void) +{ + if (atomic_inc_return(&inet_notif_refs) == 1) { + register_inetaddr_notifier(&uf_inetaddr_notifier); + } +} + +void uf_unregister_inet_notifier(void) +{ + if (atomic_dec_return(&inet_notif_refs) == 0) { + unregister_inetaddr_notifier(&uf_inetaddr_notifier); + } +} diff --git a/drivers/staging/csr/init_hw.c b/drivers/staging/csr/init_hw.c new file mode 100644 index 0000000..3b8a4ba --- /dev/null +++ b/drivers/staging/csr/init_hw.c @@ -0,0 +1,108 @@ +/* + * --------------------------------------------------------------------------- + * FILE: init_hw.c + * + * PURPOSE: + * Use the HIP core lib to initialise the UniFi chip. + * It is part of the porting exercise in Linux. + * + * Copyright (C) 2009 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * --------------------------------------------------------------------------- + */ +#include "csr_wifi_hip_unifi.h" +#include "unifi_priv.h" + + +#define MAX_INIT_ATTEMPTS 4 + +extern int led_mask; + + +/* + * --------------------------------------------------------------------------- + * uf_init_hw + * + * Resets hardware, downloads and initialises f/w. + * This function demonstrates how to use the HIP core lib API + * to implement the SME unifi_sys_wifi_on_req() part of the SYS API. + * + * In a simple implementation, all this function needs to do is call + * unifi_init_card() and then unifi_card_info(). + * In the Linux implementation, it will retry to initialise UniFi or + * try to debug the reasons if unifi_init_card() returns an error. + * + * Arguments: + * ospriv Pointer to OS driver structure for the device. + * + * Returns: + * O on success, non-zero otherwise. + * + * --------------------------------------------------------------------------- + */ +int +uf_init_hw(unifi_priv_t *priv) +{ + int attempts = 0; + int priv_instance; + CsrResult csrResult = CSR_RESULT_FAILURE; + + priv_instance = uf_find_priv(priv); + if (priv_instance == -1) { + unifi_warning(priv, "uf_init_hw: Unknown priv instance, will use fw_init[0]\n"); + priv_instance = 0; + } + + while (1) { + if (attempts > MAX_INIT_ATTEMPTS) { + unifi_error(priv, "Failed to initialise UniFi after %d attempts, " + "giving up.\n", + attempts); + break; + } + attempts++; + + unifi_info(priv, "Initialising UniFi, attempt %d\n", attempts); + + if (fw_init[priv_instance] > 0) { + unifi_notice(priv, "f/w init prevented by module parameter\n"); + break; + } else if (fw_init[priv_instance] == 0) { + fw_init[priv_instance] ++; + } + + /* + * Initialise driver core. This will perform a reset of UniFi + * internals, but not the SDIO CCCR. + */ + CsrSdioClaim(priv->sdio); + csrResult = unifi_init_card(priv->card, led_mask); + CsrSdioRelease(priv->sdio); + + if (csrResult == CSR_WIFI_HIP_RESULT_NO_DEVICE) { + return CsrHipResultToStatus(csrResult); + } + if (csrResult == CSR_WIFI_HIP_RESULT_NOT_FOUND) { + unifi_error(priv, "Firmware file required, but not found.\n"); + return CsrHipResultToStatus(csrResult); + } + if (csrResult != CSR_RESULT_SUCCESS) { + /* failed. Reset h/w and try again */ + unifi_error(priv, "Failed to initialise UniFi chip.\n"); + continue; + } + + /* Get the version information from the lib_hip */ + unifi_card_info(priv->card, &priv->card_info); + + return CsrHipResultToStatus(csrResult); + } + + return CsrHipResultToStatus(csrResult); + +} /* uf_init_hw */ + + diff --git a/drivers/staging/csr/io.c b/drivers/staging/csr/io.c new file mode 100644 index 0000000..fbf1b20 --- /dev/null +++ b/drivers/staging/csr/io.c @@ -0,0 +1,1146 @@ +/* + * --------------------------------------------------------------------------- + * FILE: io.c + * + * PURPOSE: + * This file contains routines that the SDIO driver can call when a + * UniFi card is first inserted (or detected) and removed. + * + * When used with sdioemb, the udev scripts (at least on Ubuntu) don't + * recognise a UniFi being added to the system. This is because sdioemb + * does not register itself as a device_driver, it uses it's own code + * to handle insert and remove. + * To have Ubuntu recognise UniFi, edit /etc/udev/rules.d/85-ifupdown.rules + * to change this line: + * SUBSYSTEM=="net", DRIVERS=="?*", GOTO="net_start" + * to these: + * #SUBSYSTEM=="net", DRIVERS=="?*", GOTO="net_start" + * SUBSYSTEM=="net", GOTO="net_start" + * + * Then you can add a stanza to /etc/network/interfaces like this: + * auto eth1 + * iface eth1 inet dhcp + * wpa-conf /etc/wpa_supplicant.conf + * This will then automatically associate when a car dis inserted. + * + * Copyright (C) 2006-2009 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * --------------------------------------------------------------------------- + */ +#include + +#include "csr_wifi_hip_unifi.h" +#include "csr_wifi_hip_unifiversion.h" +#include "csr_wifi_hip_unifi_udi.h" /* for unifi_print_status() */ +#include "unifiio.h" +#include "unifi_priv.h" + + +/* + * Array of pointers to context structs for unifi devices that are present. + * The index in the array corresponds to the wlan interface number + * (if "wlan*" is used). If "eth*" is used, the eth* numbers are allocated + * after any Ethernet cards. + * + * The Arasan PCI-SDIO controller card supported by this driver has 2 slots, + * hence a max of 2 devices. + */ +static unifi_priv_t *Unifi_instances[MAX_UNIFI_DEVS]; + +/* Array of pointers to netdev objects used by the UniFi driver, as there + * are now many per instance. This is used to determine which netdev events + * are for UniFi as opposed to other net interfaces. + */ +static netInterface_priv_t *Unifi_netdev_instances[MAX_UNIFI_DEVS * CSR_WIFI_NUM_INTERFACES]; + +/* + * Array to hold the status of each unifi device in each slot. + * We only process an insert event when In_use[] for the slot is + * UNIFI_DEV_NOT_IN_USE. Otherwise, it means that the slot is in use or + * we are in the middle of a cleanup (the action on unplug). + */ +#define UNIFI_DEV_NOT_IN_USE 0 +#define UNIFI_DEV_IN_USE 1 +#define UNIFI_DEV_CLEANUP 2 +static int In_use[MAX_UNIFI_DEVS]; +/* + * Mutex to prevent UDI clients to open the character device before the priv + * is created and initialised. + */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) +DEFINE_SEMAPHORE(Unifi_instance_mutex); +#else +DECLARE_MUTEX(Unifi_instance_mutex); +#endif +/* + * When the device is removed, unregister waits on Unifi_cleanup_wq + * until all the UDI clients release the character device. + */ +DECLARE_WAIT_QUEUE_HEAD(Unifi_cleanup_wq); + + +static int uf_read_proc(char *page, char **start, off_t offset, int count, + int *eof, void *data); + +#ifdef CSR_WIFI_RX_PATH_SPLIT + +static CsrResult signal_buffer_init(unifi_priv_t * priv, int size) +{ + int i; + func_enter(); + + priv->rxSignalBuffer.writePointer = + priv->rxSignalBuffer.readPointer = 0; + priv->rxSignalBuffer.size = size; + /* Allocating Memory for Signal primitive pointer */ + for(i=0; irxSignalBuffer.rx_buff[i].sig_len=0; + priv->rxSignalBuffer.rx_buff[i].bufptr = CsrMemAlloc(UNIFI_PACKED_SIGBUF_SIZE); + if (priv->rxSignalBuffer.rx_buff[i].bufptr == NULL) + { + int j; + unifi_error(priv,"signal_buffer_init:Failed to Allocate shared memory for T-H signals \n"); + for(j=0;jrxSignalBuffer.rx_buff[j].sig_len=0; + CsrMemFree(priv->rxSignalBuffer.rx_buff[j].bufptr); + priv->rxSignalBuffer.rx_buff[j].bufptr = NULL; + } + func_exit(); + return -1; + } + } + func_exit(); + return 0; +} + + +static void signal_buffer_free(unifi_priv_t * priv, int size) +{ + int i; + + for(i=0; irxSignalBuffer.rx_buff[i].sig_len=0; + CsrMemFree(priv->rxSignalBuffer.rx_buff[i].bufptr); + priv->rxSignalBuffer.rx_buff[i].bufptr = NULL; + } +} +#endif +/* + * --------------------------------------------------------------------------- + * uf_register_netdev + * + * Registers the network interface, installes the qdisc, + * and registers the inet handler. + * In the porting exercise, register the driver to the network + * stack if necessary. + * + * Arguments: + * priv Pointer to driver context. + * + * Returns: + * O on success, non-zero otherwise. + * + * Notes: + * We will only unregister when the card is ejected, so we must + * only do it once. + * --------------------------------------------------------------------------- + */ +int +uf_register_netdev(unifi_priv_t *priv, int interfaceTag) +{ + int r; + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "uf_register_netdev bad interfaceTag\n"); + return -EINVAL; + } + + /* + * Allocates a device number and registers device with the network + * stack. + */ + unifi_trace(priv, UDBG5, "uf_register_netdev: netdev %d - 0x%p\n", + interfaceTag, priv->netdev[interfaceTag]); + r = register_netdev(priv->netdev[interfaceTag]); + if (r) { + unifi_error(priv, "Failed to register net device\n"); + return -EINVAL; + } + + /* The device is registed */ + interfacePriv->netdev_registered = 1; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) +#ifdef CONFIG_NET_SCHED + /* + * IMPORTANT: + * uf_install_qdisc() holds the network device lock, we can not + * install the qdisk before the network device is registered. + */ + r = uf_install_qdisc(priv->netdev[interfaceTag]); + if (r) { + unifi_error(priv, "Failed to install qdisc\n"); + return r; + } +#endif /* CONFIG_NET_SCHED */ +#endif /* LINUX_VERSION_CODE */ + +#ifdef CSR_SUPPORT_SME + /* + * Register the inet handler; it notifies us for changes in the IP address. + */ + uf_register_inet_notifier(); +#endif /* CSR_SUPPORT_SME */ + + unifi_notice(priv, "unifi%d is %s\n", + priv->instance, priv->netdev[interfaceTag]->name); + + return 0; +} /* uf_register_netdev */ + + +/* + * --------------------------------------------------------------------------- + * uf_unregister_netdev + * + * Unregisters the network interface and the inet handler. + * + * Arguments: + * priv Pointer to driver context. + * + * Returns: + * None. + * + * --------------------------------------------------------------------------- + */ +void +uf_unregister_netdev(unifi_priv_t *priv) +{ + int i=0; + +#ifdef CSR_SUPPORT_SME + /* Unregister the inet handler... */ + uf_unregister_inet_notifier(); +#endif /* CSR_SUPPORT_SME */ + + for (i=0; iinterfacePriv[i]; + if (interfacePriv->netdev_registered) { + unifi_trace(priv, UDBG5, + "uf_unregister_netdev: netdev %d - 0x%p\n", + i, priv->netdev[i]); + + /* ... and the netdev */ + unregister_netdev(priv->netdev[i]); + interfacePriv->netdev_registered = 0; + } + + interfacePriv->interfaceMode = 0; + + /* Enable all queues by default */ + interfacePriv->queueEnabled[0] = 1; + interfacePriv->queueEnabled[1] = 1; + interfacePriv->queueEnabled[2] = 1; + interfacePriv->queueEnabled[3] = 1; + } + + priv->totalInterfaceCount = 0; +} /* uf_unregister_netdev() */ + + +/* + * --------------------------------------------------------------------------- + * register_unifi_sdio + * + * This function is called from the Probe (or equivalent) method of + * the SDIO driver when a UniFi card is detected. + * We allocate the Linux net_device struct, initialise the HIP core + * lib, create the char device nodes and start the userspace helper + * to initialise the device. + * + * Arguments: + * sdio_dev Pointer to SDIO context handle to use for all + * SDIO ops. + * bus_id A small number indicating the SDIO card position on the + * bus. Typically this is the slot number, e.g. 0, 1 etc. + * Valid values are 0 to MAX_UNIFI_DEVS-1. + * dev Pointer to kernel device manager struct. + * + * Returns: + * Pointer to the unifi instance, or NULL on error. + * --------------------------------------------------------------------------- + */ +static unifi_priv_t * +register_unifi_sdio(CsrSdioFunction *sdio_dev, int bus_id, struct device *dev) +{ + unifi_priv_t *priv = NULL; + int r = -1; + CsrResult csrResult; + + func_enter(); + + if ((bus_id < 0) || (bus_id >= MAX_UNIFI_DEVS)) { + unifi_error(priv, "register_unifi_sdio: invalid device %d\n", + bus_id); + return NULL; + } + + down(&Unifi_instance_mutex); + + if (In_use[bus_id] != UNIFI_DEV_NOT_IN_USE) { + unifi_error(priv, "register_unifi_sdio: device %d is already in use\n", + bus_id); + goto failed0; + } + + + /* Allocate device private and net_device structs */ + priv = uf_alloc_netdevice(sdio_dev, bus_id); + if (priv == NULL) { + unifi_error(priv, "Failed to allocate driver private\n"); + goto failed0; + } + + priv->unifi_device = dev; + + SET_NETDEV_DEV(priv->netdev[0], dev); + + /* We are not ready to send data yet. */ + netif_carrier_off(priv->netdev[0]); + + /* Allocate driver context. */ + priv->card = unifi_alloc_card(priv->sdio, priv); + if (priv->card == NULL) { + unifi_error(priv, "Failed to allocate UniFi driver card struct.\n"); + goto failed1; + } + + if (Unifi_instances[bus_id]) { + unifi_error(priv, "Internal error: instance for slot %d is already taken\n", + bus_id); + } + Unifi_instances[bus_id] = priv; + In_use[bus_id] = UNIFI_DEV_IN_USE; + + /* Save the netdev_priv for use by the netdev event callback mechanism */ + Unifi_netdev_instances[bus_id * CSR_WIFI_NUM_INTERFACES] = netdev_priv(priv->netdev[0]); + + /* Initialise the mini-coredump capture buffers */ + csrResult = unifi_coredump_init(priv->card, (CsrUint16)coredump_max); + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, "Couldn't allocate mini-coredump buffers\n"); + } + + /* Create the character device nodes */ + r = uf_create_device_nodes(priv, bus_id); + if (r) { + goto failed1; + } + + /* + * We use the slot number as unifi device index. + */ + snprintf(priv->proc_entry_name, 64, "driver/unifi%d", priv->instance); + /* + * The following complex casting is in place in order to eliminate 64-bit compilation warning + * "cast to/from pointer from/to integer of different size" + */ + if (!create_proc_read_entry(priv->proc_entry_name, 0, 0, + uf_read_proc, (void *)(long)priv->instance)) + { + unifi_error(priv, "unifi: can't create /proc/driver/unifi\n"); + } + + /* Allocate the net_device for interfaces other than 0. */ + { + int i; + priv->totalInterfaceCount =0; + + for(i=1;inetdev[i], dev); + + /* We are not ready to send data yet. */ + netif_carrier_off(priv->netdev[i]); + + /* Save the netdev_priv for use by the netdev event callback mechanism */ + Unifi_netdev_instances[bus_id * CSR_WIFI_NUM_INTERFACES + i] = netdev_priv(priv->netdev[i]); + } + } + + for(i=0;iinterfacePriv[i]; + interfacePriv->netdev_registered=0; + } + } + +#ifdef CSR_WIFI_RX_PATH_SPLIT + if (signal_buffer_init(priv, CSR_WIFI_RX_SIGNAL_BUFFER_SIZE)) + { + unifi_error(priv,"Failed to allocate shared memory for T-H signals\n"); + goto failed2; + } + priv->rx_workqueue = create_singlethread_workqueue("rx_workq"); + if (priv->rx_workqueue == NULL) { + unifi_error(priv,"create_singlethread_workqueue failed \n"); + goto failed3; + } + INIT_WORK(&priv->rx_work_struct, rx_wq_handler); +#endif + + /* Initialise the SME related threads and parameters */ + r = uf_sme_init(priv); + if (r) { + unifi_error(priv, "SME initialisation failed.\n"); + goto failed4; + } + + /* + * Run the userspace helper program (unififw) to perform + * the device initialisation. + */ + unifi_trace(priv, UDBG1, "run UniFi helper app...\n"); + r = uf_run_unifihelper(priv); + if (r) { + unifi_notice(priv, "unable to run UniFi helper app\n"); + /* Not a fatal error. */ + } + + up(&Unifi_instance_mutex); + + func_exit(); + return priv; + +failed4: +#ifdef CSR_WIFI_RX_PATH_SPLIT + flush_workqueue(priv->rx_workqueue); + destroy_workqueue(priv->rx_workqueue); +failed3: + signal_buffer_free(priv,CSR_WIFI_RX_SIGNAL_BUFFER_SIZE); +failed2: +#endif + /* Remove the device nodes */ + uf_destroy_device_nodes(priv); +failed1: + /* Deregister priv->netdev_client */ + ul_deregister_client(priv->netdev_client); + +failed0: + if (priv && priv->card) { + unifi_coredump_free(priv->card); + unifi_free_card(priv->card); + } + if (priv) { + uf_free_netdevice(priv); + } + + up(&Unifi_instance_mutex); + + func_exit(); + return NULL; +} /* register_unifi_sdio() */ + + +/* + * --------------------------------------------------------------------------- + * ask_unifi_sdio_cleanup + * + * We can not free our private context, until all the char device + * clients have closed the file handles. unregister_unifi_sdio() which + * is called when a card is removed, waits on Unifi_cleanup_wq until + * the reference count becomes zero. It is time to wake it up now. + * + * Arguments: + * priv Pointer to driver context. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +static void +ask_unifi_sdio_cleanup(unifi_priv_t *priv) +{ + func_enter(); + + /* + * Now clear the flag that says the old instance is in use. + * This is used to prevent a new instance being started before old + * one has finshed closing down, for example if bounce makes the card + * appear to be ejected and re-inserted quickly. + */ + In_use[priv->instance] = UNIFI_DEV_CLEANUP; + + unifi_trace(NULL, UDBG5, "ask_unifi_sdio_cleanup: wake up cleanup workqueue.\n"); + wake_up(&Unifi_cleanup_wq); + + func_exit(); + +} /* ask_unifi_sdio_cleanup() */ + + +/* + * --------------------------------------------------------------------------- + * cleanup_unifi_sdio + * + * Release any resources owned by a unifi instance. + * + * Arguments: + * priv Pointer to the instance to free. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +static void +cleanup_unifi_sdio(unifi_priv_t *priv) +{ + int priv_instance; + int i; + static const CsrWifiMacAddress broadcast_address = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}}; + + func_enter(); + + /* Remove the device nodes */ + uf_destroy_device_nodes(priv); + + /* Mark this device as gone away by NULLing the entry in Unifi_instances */ + Unifi_instances[priv->instance] = NULL; + + unifi_trace(priv, UDBG5, "cleanup_unifi_sdio: remove_proc_entry\n"); + /* + * Free the children of priv before unifi_free_netdevice() frees + * the priv struct + */ + remove_proc_entry(priv->proc_entry_name, 0); + + + /* Unregister netdev as a client. */ + if (priv->netdev_client) { + unifi_trace(priv, UDBG2, "Netdev client (id:%d s:0x%X) is unregistered\n", + priv->netdev_client->client_id, priv->netdev_client->sender_id); + ul_deregister_client(priv->netdev_client); + } + + /* Destroy the SME related threads and parameters */ + uf_sme_deinit(priv); + +#ifdef CSR_SME_USERSPACE + priv->smepriv = NULL; +#endif + + /* Free any packets left in the Rx queues */ + for(i=0;icard) { + unifi_trace(priv, UDBG5, "cleanup_unifi_sdio: free card\n"); + unifi_coredump_free(priv->card); + unifi_free_card(priv->card); + priv->card = NULL; + } + + /* + * Unregister the network device. + * We can not unregister the netdev before we release + * all pending packets in the core. + */ + uf_unregister_netdev(priv); + priv->totalInterfaceCount = 0; + + /* Clear the table of registered netdev_priv's */ + for (i = 0; i < CSR_WIFI_NUM_INTERFACES; i++) { + Unifi_netdev_instances[priv->instance * CSR_WIFI_NUM_INTERFACES + i] = NULL; + } + + unifi_trace(priv, UDBG5, "cleanup_unifi_sdio: uf_free_netdevice\n"); + /* + * When uf_free_netdevice() returns, the priv is invalid + * so we need to remember the instance to clear the global flag later. + */ + priv_instance = priv->instance; + +#ifdef CSR_WIFI_RX_PATH_SPLIT + flush_workqueue(priv->rx_workqueue); + destroy_workqueue(priv->rx_workqueue); + signal_buffer_free(priv,CSR_WIFI_RX_SIGNAL_BUFFER_SIZE); +#endif + + /* Priv is freed as part of the net_device */ + uf_free_netdevice(priv); + + /* + * Now clear the flag that says the old instance is in use. + * This is used to prevent a new instance being started before old + * one has finshed closing down, for example if bounce makes the card + * appear to be ejected and re-inserted quickly. + */ + In_use[priv_instance] = UNIFI_DEV_NOT_IN_USE; + + unifi_trace(NULL, UDBG5, "cleanup_unifi_sdio: DONE.\n"); + + func_exit(); + +} /* cleanup_unifi_sdio() */ + + +/* + * --------------------------------------------------------------------------- + * unregister_unifi_sdio + * + * Call from SDIO driver when it detects that UniFi has been removed. + * + * Arguments: + * bus_id Number of the card that was ejected. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +static void +unregister_unifi_sdio(int bus_id) +{ + unifi_priv_t *priv; + int interfaceTag=0; + u8 reason = CONFIG_IND_EXIT; + + if ((bus_id < 0) || (bus_id >= MAX_UNIFI_DEVS)) { + unifi_error(NULL, "unregister_unifi_sdio: invalid device %d\n", + bus_id); + return; + } + + priv = Unifi_instances[bus_id]; + if (priv == NULL) { + unifi_error(priv, "unregister_unifi_sdio: device %d is not registered\n", + bus_id); + func_exit(); + return; + } + + /* Stop the network traffic before freeing the core. */ + for(interfaceTag=0;interfaceTagtotalInterfaceCount;interfaceTag++) + { + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + if(interfacePriv->netdev_registered) + { + netif_carrier_off(priv->netdev[interfaceTag]); + UF_NETIF_TX_STOP_ALL_QUEUES(priv->netdev[interfaceTag]); + } + } + +#ifdef CSR_NATIVE_LINUX + /* + * If the unifi thread was started, signal it to stop. This + * should cause any userspace processes with open unifi device to + * close them. + */ + uf_stop_thread(priv, &priv->bh_thread); + + /* Unregister the interrupt handler */ + if (csr_sdio_linux_remove_irq(priv->sdio)) { + unifi_notice(priv, + "csr_sdio_linux_remove_irq failed to talk to card.\n"); + } + + /* Ensure no MLME functions are waiting on a the mlme_event semaphore. */ + uf_abort_mlme(priv); +#endif /* CSR_NATIVE_LINUX */ + + ul_log_config_ind(priv, &reason, sizeof(u8)); + + /* Deregister the UDI hook from the core. */ + unifi_remove_udi_hook(priv->card, logging_handler); + + uf_put_instance(bus_id); + + /* + * Wait until the device is cleaned up. i.e., when all userspace + * processes have closed any open unifi devices. + */ + wait_event(Unifi_cleanup_wq, In_use[bus_id] == UNIFI_DEV_CLEANUP); + unifi_trace(NULL, UDBG5, "Received clean up event\n"); + + /* Now we can free the private context and the char device nodes */ + cleanup_unifi_sdio(priv); + +} /* unregister_unifi_sdio() */ + + +/* + * --------------------------------------------------------------------------- + * uf_find_instance + * + * Find the context structure for a given UniFi device instance. + * + * Arguments: + * inst The instance number to look for. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +unifi_priv_t * +uf_find_instance(int inst) +{ + if ((inst < 0) || (inst >= MAX_UNIFI_DEVS)) { + return NULL; + } + return Unifi_instances[inst]; +} /* uf_find_instance() */ + + +/* + * --------------------------------------------------------------------------- + * uf_find_priv + * + * Find the device instance for a given context structure. + * + * Arguments: + * priv The context structure pointer to look for. + * + * Returns: + * index of instance, -1 otherwise. + * --------------------------------------------------------------------------- + */ +int +uf_find_priv(unifi_priv_t *priv) +{ + int inst; + + if (!priv) { + return -1; + } + + for (inst = 0; inst < MAX_UNIFI_DEVS; inst++) { + if (Unifi_instances[inst] == priv) { + return inst; + } + } + + return -1; +} /* uf_find_priv() */ + +/* + * --------------------------------------------------------------------------- + * uf_find_netdev_priv + * + * Find the device instance for a given netdev context structure. + * + * Arguments: + * priv The context structure pointer to look for. + * + * Returns: + * index of instance, -1 otherwise. + * --------------------------------------------------------------------------- + */ +int +uf_find_netdev_priv(netInterface_priv_t *priv) +{ + int inst; + + if (!priv) { + return -1; + } + + for (inst = 0; inst < MAX_UNIFI_DEVS * CSR_WIFI_NUM_INTERFACES; inst++) { + if (Unifi_netdev_instances[inst] == priv) { + return inst; + } + } + + return -1; +} /* uf_find_netdev_priv() */ + +/* + * --------------------------------------------------------------------------- + * uf_get_instance + * + * Find the context structure for a given UniFi device instance + * and increment the reference count. + * + * Arguments: + * inst The instance number to look for. + * + * Returns: + * Pointer to the instance or NULL if no instance exists. + * --------------------------------------------------------------------------- + */ +unifi_priv_t * +uf_get_instance(int inst) +{ + unifi_priv_t *priv; + + down(&Unifi_instance_mutex); + + priv = uf_find_instance(inst); + if (priv) { + priv->ref_count++; + } + + up(&Unifi_instance_mutex); + + return priv; +} + +/* + * --------------------------------------------------------------------------- + * uf_put_instance + * + * Decrement the context reference count, freeing resources and + * shutting down the driver when the count reaches zero. + * + * Arguments: + * inst The instance number to look for. + * + * Returns: + * Pointer to the instance or NULL if no instance exists. + * --------------------------------------------------------------------------- + */ +void +uf_put_instance(int inst) +{ + unifi_priv_t *priv; + + down(&Unifi_instance_mutex); + + priv = uf_find_instance(inst); + if (priv) { + priv->ref_count--; + if (priv->ref_count == 0) { + ask_unifi_sdio_cleanup(priv); + } + } + + up(&Unifi_instance_mutex); +} + + +/* + * --------------------------------------------------------------------------- + * uf_read_proc + * + * Read method for driver node in /proc/driver/unifi0 + * + * Arguments: + * page + * start + * offset + * count + * eof + * data + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +#ifdef CONFIG_PROC_FS +static int +uf_read_proc(char *page, char **start, off_t offset, int count, + int *eof, void *data) +{ +#define UNIFI_DEBUG_TXT_BUFFER 8*1024 + unifi_priv_t *priv; + int actual_amount_to_copy; + char *p, *orig_p; + CsrInt32 remain = UNIFI_DEBUG_TXT_BUFFER; + CsrInt32 written; + int i; + + /* + * The following complex casting is in place in order to eliminate 64-bit compilation warning + * "cast to/from pointer from/to integer of different size" + */ + priv = uf_find_instance((int)(long)data); + if (!priv) { + return 0; + } + + p = kmalloc( UNIFI_DEBUG_TXT_BUFFER, GFP_KERNEL ); + + orig_p = p; + + written = CsrSnprintf(p, remain, "UniFi SDIO Driver: %s %s %s\n", + CSR_WIFI_VERSION, __DATE__, __TIME__); + UNIFI_SNPRINTF_RET(p, remain, written); +#ifdef CSR_SME_USERSPACE + written = CsrSnprintf(p, remain, "SME: CSR userspace "); + UNIFI_SNPRINTF_RET(p, remain, written); +#ifdef CSR_SUPPORT_WEXT + written = CsrSnprintf(p, remain, "with WEXT support\n"); +#else + written = CsrSnprintf(p, remain, "\n"); +#endif /* CSR_SUPPORT_WEXT */ + UNIFI_SNPRINTF_RET(p, remain, written); +#endif /* CSR_SME_USERSPACE */ +#ifdef CSR_NATIVE_LINUX + written = CsrSnprintf(p, remain, "SME: native\n"); + UNIFI_SNPRINTF_RET(p, remain, written); +#endif + +#ifdef CSR_SUPPORT_SME + written = CsrSnprintf(p, remain, + "Firmware (ROM) build:%lu, Patch:%lu\n", + priv->card_info.fw_build, + priv->sme_versions.firmwarePatch); + UNIFI_SNPRINTF_RET(p, remain, written); +#endif + p += unifi_print_status(priv->card, p, &remain); + + written = CsrSnprintf(p, remain, "Last dbg str: %s\n", + priv->last_debug_string); + UNIFI_SNPRINTF_RET(p, remain, written); + + written = CsrSnprintf(p, remain, "Last dbg16:"); + UNIFI_SNPRINTF_RET(p, remain, written); + for (i = 0; i < 8; i++) { + written = CsrSnprintf(p, remain, " %04X", + priv->last_debug_word16[i]); + UNIFI_SNPRINTF_RET(p, remain, written); + } + written = CsrSnprintf(p, remain, "\n"); + UNIFI_SNPRINTF_RET(p, remain, written); + written = CsrSnprintf(p, remain, " "); + UNIFI_SNPRINTF_RET(p, remain, written); + for (; i < 16; i++) { + written = CsrSnprintf(p, remain, " %04X", + priv->last_debug_word16[i]); + UNIFI_SNPRINTF_RET(p, remain, written); + } + written = CsrSnprintf(p, remain, "\n"); + UNIFI_SNPRINTF_RET(p, remain, written); + *start = page; + + written = UNIFI_DEBUG_TXT_BUFFER - remain; + + if( offset >= written ) + { + *eof = 1; + kfree( orig_p ); + return(0); + } + + if( offset + count > written ) + { + actual_amount_to_copy = written - offset; + *eof = 1; + } + else + { + actual_amount_to_copy = count; + } + + memcpy( page, &(orig_p[offset]), actual_amount_to_copy ); + + kfree( orig_p ); + + return( actual_amount_to_copy ); +} /* uf_read_proc() */ +#endif + + + + +static void +uf_lx_suspend(CsrSdioFunction *sdio_ctx) +{ + unifi_priv_t *priv = sdio_ctx->driverData; + unifi_suspend(priv); + + CsrSdioSuspendAcknowledge(sdio_ctx, CSR_RESULT_SUCCESS); +} + +static void +uf_lx_resume(CsrSdioFunction *sdio_ctx) +{ + unifi_priv_t *priv = sdio_ctx->driverData; + unifi_resume(priv); + + CsrSdioResumeAcknowledge(sdio_ctx, CSR_RESULT_SUCCESS); +} + +static int active_slot = MAX_UNIFI_DEVS; +static struct device *os_devices[MAX_UNIFI_DEVS]; + +void +uf_add_os_device(int bus_id, struct device *os_device) +{ + if ((bus_id < 0) || (bus_id >= MAX_UNIFI_DEVS)) { + unifi_error(NULL, "uf_add_os_device: invalid device %d\n", + bus_id); + return; + } + + active_slot = bus_id; + os_devices[bus_id] = os_device; +} /* uf_add_os_device() */ + +void +uf_remove_os_device(int bus_id) +{ + if ((bus_id < 0) || (bus_id >= MAX_UNIFI_DEVS)) { + unifi_error(NULL, "uf_remove_os_device: invalid device %d\n", + bus_id); + return; + } + + active_slot = bus_id; + os_devices[bus_id] = NULL; +} /* uf_remove_os_device() */ + +static void +uf_sdio_inserted(CsrSdioFunction *sdio_ctx) +{ + unifi_priv_t *priv; + + unifi_trace(NULL, UDBG5, "uf_sdio_inserted(0x%p), slot_id=%d, dev=%p\n", + sdio_ctx, active_slot, os_devices[active_slot]); + + priv = register_unifi_sdio(sdio_ctx, active_slot, os_devices[active_slot]); + if (priv == NULL) { + CsrSdioInsertedAcknowledge(sdio_ctx, CSR_RESULT_FAILURE); + return; + } + + sdio_ctx->driverData = priv; + + CsrSdioInsertedAcknowledge(sdio_ctx, CSR_RESULT_SUCCESS); +} /* uf_sdio_inserted() */ + + +static void +uf_sdio_removed(CsrSdioFunction *sdio_ctx) +{ + unregister_unifi_sdio(active_slot); + CsrSdioRemovedAcknowledge(sdio_ctx); +} /* uf_sdio_removed() */ + + +static void +uf_sdio_dsr_handler(CsrSdioFunction *sdio_ctx) +{ + unifi_priv_t *priv = sdio_ctx->driverData; + + unifi_sdio_interrupt_handler(priv->card); +} /* uf_sdio_dsr_handler() */ + +/* + * --------------------------------------------------------------------------- + * uf_sdio_int_handler + * + * Interrupt callback function for SDIO interrupts. + * This is called in kernel context (i.e. not interrupt context). + * We retrieve the unifi context pointer and call the main UniFi + * interrupt handler. + * + * Arguments: + * fdev SDIO context pointer + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +static CsrSdioInterruptDsrCallback +uf_sdio_int_handler(CsrSdioFunction *sdio_ctx) +{ + return uf_sdio_dsr_handler; +} /* uf_sdio_int_handler() */ + + + + +static CsrSdioFunctionId unifi_ids[] = +{ + { + .manfId = SDIO_MANF_ID_CSR, + .cardId = SDIO_CARD_ID_UNIFI_3, + .sdioFunction = SDIO_WLAN_FUNC_ID_UNIFI_3, + .sdioInterface = CSR_SDIO_ANY_SDIO_INTERFACE, + }, + { + .manfId = SDIO_MANF_ID_CSR, + .cardId = SDIO_CARD_ID_UNIFI_4, + .sdioFunction = SDIO_WLAN_FUNC_ID_UNIFI_4, + .sdioInterface = CSR_SDIO_ANY_SDIO_INTERFACE, + } +}; + + +/* + * Structure to register with the glue layer. + */ +static CsrSdioFunctionDriver unifi_sdioFunction_drv = +{ + .inserted = uf_sdio_inserted, + .removed = uf_sdio_removed, + .intr = uf_sdio_int_handler, + .suspend = uf_lx_suspend, + .resume = uf_lx_resume, + + .ids = unifi_ids, + .idsCount = sizeof(unifi_ids) / sizeof(unifi_ids[0]) +}; + + +/* + * --------------------------------------------------------------------------- + * uf_sdio_load + * uf_sdio_unload + * + * These functions are called from the main module load and unload + * functions. They perform the appropriate operations for the monolithic + * driver. + * + * Arguments: + * None. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +int __init +uf_sdio_load(void) +{ + CsrResult csrResult; + + csrResult = CsrSdioFunctionDriverRegister(&unifi_sdioFunction_drv); + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(NULL, "Failed to register UniFi SDIO driver: csrResult=%d\n", csrResult); + return -EIO; + } + + return 0; +} /* uf_sdio_load() */ + + + +void __exit +uf_sdio_unload(void) +{ + CsrSdioFunctionDriverUnregister(&unifi_sdioFunction_drv); +} /* uf_sdio_unload() */ + diff --git a/drivers/staging/csr/mlme.c b/drivers/staging/csr/mlme.c new file mode 100644 index 0000000..790d5d7 --- /dev/null +++ b/drivers/staging/csr/mlme.c @@ -0,0 +1,441 @@ +/* + * --------------------------------------------------------------------------- + * FILE: mlme.c + * + * PURPOSE: + * This file provides functions to send MLME requests to the UniFi. + * + * Copyright (C) 2007-2008 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * --------------------------------------------------------------------------- + */ +#include "csr_wifi_hip_unifi.h" +#include "unifi_priv.h" + + +/* The additional time taken by the UniFi to do a scan per channel */ +#define SCAN_STARTUP_TIME 300 /* in millisecs */ + + +/* + * --------------------------------------------------------------------------- + * unifi_mlme_wait_for_reply + * + * Wait for a reply after sending a signal. + * + * Arguments: + * priv Pointer to device private context struct + * ul_client Pointer to linux client + * sig_reply_id ID of the expected reply (defined in sigs.h). + * timeout timeout in ms + * + * Returns: + * 0 on success, -ve POSIX code on error. + * + * Notes: + * This function waits for a specific (sig_reply_id) signal from UniFi. + * It also match the sequence number of the received (cfm) signal, with + * the latest sequence number of the signal (req) we have sent. + * These two number match be equal. + * Should only be used for waiting xxx.cfm signals and only after + * we have sent the matching xxx.req signal to UniFi. + * If no response is received within the expected time (timeout), we assume + * that the UniFi is busy and return an error. + * If the wait is aborted by a kernel signal arriving, we stop waiting. + * If a response from UniFi is not what we expected, we discard it and + * wait again. This could be a response from an aborted request. If we + * see several bad responses we assume we have lost synchronisation with + * UniFi. + * --------------------------------------------------------------------------- + */ +static int +unifi_mlme_wait_for_reply(unifi_priv_t *priv, ul_client_t *pcli, int sig_reply_id, int timeout) +{ + int retries = 0; + long r; + long t = timeout; + unsigned int sent_seq_no; + + /* Convert t in ms to jiffies */ + t = msecs_to_jiffies(t); + + do { + /* Wait for the confirm or timeout. */ + r = wait_event_interruptible_timeout(pcli->udi_wq, + (pcli->wake_up_wq_id) || (priv->io_aborted == 1), + t); + /* Check for general i/o error */ + if (priv->io_aborted) { + unifi_error(priv, "MLME operation aborted\n"); + return -EIO; + } + + /* + * If r=0 the request has timed-out. + * If r>0 the request has completed successfully. + * If r=-ERESTARTSYS an event (kill signal) has interrupted the wait_event. + */ + if ((r == 0) && (pcli->wake_up_wq_id == 0)) { + unifi_error(priv, "mlme_wait: timed-out waiting for 0x%.4X, after %lu msec.\n", + sig_reply_id, jiffies_to_msecs(t)); + pcli->wake_up_wq_id = 0; + return -ETIMEDOUT; + } else if (r == -ERESTARTSYS) { + unifi_error(priv, "mlme_wait: waiting for 0x%.4X was aborted.\n", sig_reply_id); + pcli->wake_up_wq_id = 0; + return -EINTR; + } else { + /* Get the sequence number of the signal that we previously set. */ + if (pcli->seq_no != 0) { + sent_seq_no = pcli->seq_no - 1; + } else { + sent_seq_no = 0x0F; + } + + unifi_trace(priv, UDBG5, "Received 0x%.4X, seq: (r:%d, s:%d)\n", + pcli->wake_up_wq_id, + pcli->wake_seq_no, sent_seq_no); + + /* The two sequence ids must match. */ + if (pcli->wake_seq_no == sent_seq_no) { + /* and the signal ids must match. */ + if (sig_reply_id == pcli->wake_up_wq_id) { + /* Found the expected signal */ + break; + } else { + /* This should never happen ... */ + unifi_error(priv, "mlme_wait: mismatching signal id (0x%.4X - exp 0x%.4X) (seq %d)\n", + pcli->wake_up_wq_id, + sig_reply_id, + pcli->wake_seq_no); + pcli->wake_up_wq_id = 0; + return -EIO; + } + } + /* Wait for the next signal. */ + pcli->wake_up_wq_id = 0; + + retries ++; + if (retries >= 3) { + unifi_error(priv, "mlme_wait: confirm wait retries exhausted (0x%.4X - exp 0x%.4X)\n", + pcli->wake_up_wq_id, + sig_reply_id); + pcli->wake_up_wq_id = 0; + return -EIO; + } + } + } while (1); + + pcli->wake_up_wq_id = 0; + + return 0; +} /* unifi_mlme_wait_for_reply() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_mlme_blocking_request + * + * Send a MLME request signal to UniFi. + * + * Arguments: + * priv Pointer to device private context struct + * pcli Pointer to context of calling process + * sig Pointer to the signal to send + * data_ptrs Pointer to the bulk data of the signal + * timeout The request's timeout. + * + * Returns: + * 0 on success, 802.11 result code on error. + * --------------------------------------------------------------------------- + */ +int +unifi_mlme_blocking_request(unifi_priv_t *priv, ul_client_t *pcli, + CSR_SIGNAL *sig, bulk_data_param_t *data_ptrs, + int timeout) +{ + int r; + + func_enter(); + + if (sig->SignalPrimitiveHeader.SignalId == 0) { + unifi_error(priv, "unifi_mlme_blocking_request: Invalid Signal Id (0x%x)\n", + sig->SignalPrimitiveHeader.SignalId); + return -EINVAL; + } + + down(&priv->mlme_blocking_mutex); + + sig->SignalPrimitiveHeader.ReceiverProcessId = 0; + sig->SignalPrimitiveHeader.SenderProcessId = pcli->sender_id | pcli->seq_no; + + unifi_trace(priv, UDBG2, "Send client=%d, S:0x%04X, sig 0x%.4X\n", + pcli->client_id, + sig->SignalPrimitiveHeader.SenderProcessId, + sig->SignalPrimitiveHeader.SignalId); + /* Send the signal to UniFi */ + r = ul_send_signal_unpacked(priv, sig, data_ptrs); + if (r) { + up(&priv->mlme_blocking_mutex); + unifi_error(priv, "Error queueing MLME REQUEST signal\n"); + return r; + } + + unifi_trace(priv, UDBG5, "Send 0x%.4X, seq = %d\n", + sig->SignalPrimitiveHeader.SignalId, pcli->seq_no); + + /* + * Advance the sequence number of the last sent signal, only + * if the signal has been successfully set. + */ + pcli->seq_no++; + if (pcli->seq_no > 0x0F) { + pcli->seq_no = 0; + } + + r = unifi_mlme_wait_for_reply(priv, pcli, (sig->SignalPrimitiveHeader.SignalId + 1), timeout); + up(&priv->mlme_blocking_mutex); + + if (r) { + unifi_error(priv, "Error waiting for MLME CONFIRM signal\n"); + return r; + } + + func_exit(); + return 0; +} /* unifi_mlme_blocking_request() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_mlme_copy_reply_and_wakeup_client + * + * Copy the reply signal from UniFi to the client's structure + * and wake up the waiting client. + * + * Arguments: + * None. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +void +unifi_mlme_copy_reply_and_wakeup_client(ul_client_t *pcli, + CSR_SIGNAL *signal, int signal_len, + const bulk_data_param_t *bulkdata) +{ + int i; + + /* Copy the signal to the reply */ + memcpy(pcli->reply_signal, signal, signal_len); + + /* Get the sequence number of the signal that woke us up. */ + pcli->wake_seq_no = pcli->reply_signal->SignalPrimitiveHeader.ReceiverProcessId & 0x0F; + + /* Append any bulk data */ + for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { + if (bulkdata->d[i].data_length > 0) { + if (bulkdata->d[i].os_data_ptr) { + memcpy(pcli->reply_bulkdata[i]->ptr, bulkdata->d[i].os_data_ptr, bulkdata->d[i].data_length); + pcli->reply_bulkdata[i]->length = bulkdata->d[i].data_length; + } else { + pcli->reply_bulkdata[i]->length = 0; + } + } + } + + /* Wake the requesting MLME function. */ + pcli->wake_up_wq_id = pcli->reply_signal->SignalPrimitiveHeader.SignalId; + wake_up_interruptible(&pcli->udi_wq); + +} /* unifi_mlme_copy_reply_and_wakeup_client() */ + + +/* + * --------------------------------------------------------------------------- + * uf_abort_mlme + * + * Abort any MLME operation in progress. + * This is used in the error recovery mechanism. + * + * Arguments: + * priv Pointer to driver context. + * + * Returns: + * 0 on success. + * --------------------------------------------------------------------------- + */ +int +uf_abort_mlme(unifi_priv_t *priv) +{ + ul_client_t *ul_cli; + + /* Ensure no MLME functions are waiting on a the mlme_event semaphore. */ + priv->io_aborted = 1; + + ul_cli = priv->netdev_client; + if (ul_cli) { + wake_up_interruptible(&ul_cli->udi_wq); + } + + ul_cli = priv->wext_client; + if (ul_cli) { + wake_up_interruptible(&ul_cli->udi_wq); + } + + return 0; +} /* uf_abort_mlme() */ + + + +/* + * --------------------------------------------------------------------------- + * + * Human-readable decoding of Reason and Result codes. + * + * --------------------------------------------------------------------------- + */ + +struct mlme_code { + const char *name; + int id; +}; + +static const struct mlme_code Result_codes[] = { + { "Success", 0x0000 }, + { "Unspecified Failure", 0x0001 }, + /* (Reserved) 0x0002 - 0x0009 */ + { "Refused Capabilities Mismatch", 0x000A }, + /* (Reserved) 0x000B */ + { "Refused External Reason", 0x000C }, + /* (Reserved) 0x000D - 0x0010 */ + { "Refused AP Out Of Memory", 0x0011 }, + { "Refused Basic Rates Mismatch", 0x0012 }, + /* (Reserved) 0x0013 - 0x001F */ + { "Failure", 0x0020 }, + /* (Reserved) 0x0021 - 0x0024 */ + { "Refused Reason Unspecified", 0x0025 }, + { "Invalid Parameters", 0x0026 }, + { "Rejected With Suggested Changes", 0x0027 }, + /* (Reserved) 0x0028 - 0x002E */ + { "Rejected For Delay Period", 0x002F }, + { "Not Allowed", 0x0030 }, + { "Not Present", 0x0031 }, + { "Not QSTA", 0x0032 }, + /* (Reserved) 0x0033 - 0x7FFF */ + { "Timeout", 0x8000 }, + { "Too Many Simultaneous Requests", 0x8001 }, + { "BSS Already Started Or Joined", 0x8002 }, + { "Not Supported", 0x8003 }, + { "Transmission Failure", 0x8004 }, + { "Refused Not Authenticated", 0x8005 }, + { "Reset Required Before Start", 0x8006 }, + { "LM Info Unavailable", 0x8007 }, + { NULL, -1 } +}; + +static const struct mlme_code Reason_codes[] = { + /* (Reserved) 0x0000 */ + { "Unspecified Reason", 0x0001 }, + { "Authentication Not Valid", 0x0002 }, + { "Deauthenticated Leave BSS", 0x0003 }, + { "Disassociated Inactivity", 0x0004 }, + { "AP Overload", 0x0005 }, + { "Class2 Frame Error", 0x0006 }, + { "Class3 Frame Error", 0x0007 }, + { "Disassociated Leave BSS", 0x0008 }, + { "Association Not Authenticated", 0x0009 }, + { "Disassociated Power Capability", 0x000A }, + { "Disassociated Supported Channels", 0x000B }, + /* (Reserved) 0x000C */ + { "Invalid Information Element", 0x000D }, + { "Michael MIC Failure", 0x000E }, + { "Fourway Handshake Timeout", 0x000F }, + { "Group Key Update Timeout", 0x0010 }, + { "Handshake Element Different", 0x0011 }, + { "Invalid Group Cipher", 0x0012 }, + { "Invalid Pairwise Cipher", 0x0013 }, + { "Invalid AKMP", 0x0014 }, + { "Unsupported RSN IE Version", 0x0015 }, + { "Invalid RSN IE Capabilities", 0x0016 }, + { "Dot1X Auth Failed", 0x0017 }, + { "Cipher Rejected By Policy", 0x0018 }, + /* (Reserved) 0x0019 - 0x001F */ + { "QoS Unspecified Reason", 0x0020 }, + { "QoS Insufficient Bandwidth", 0x0021 }, + { "QoS Excessive Not Ack", 0x0022 }, + { "QoS TXOP Limit Exceeded", 0x0023 }, + { "QSTA Leaving", 0x0024 }, + { "End TS, End DLS, End BA", 0x0025 }, + { "Unknown TS, Unknown DLS, Unknown BA", 0x0026 }, + { "Timeout", 0x0027 }, + /* (Reserved) 0x0028 - 0x002C */ + { "STAKey Mismatch", 0x002D }, + { NULL, -1 } +}; + + +static const char * +lookup_something(const struct mlme_code *n, int id) +{ + for (; n->name; n++) { + if (n->id == id) { + return n->name; + } + } + + /* not found */ + return NULL; +} /* lookup_something() */ + + +const char * +lookup_result_code(int result) +{ + static char fallback[16]; + const char *str; + + str = lookup_something(Result_codes, result); + + if (str == NULL) { + snprintf(fallback, 16, "%d", result); + str = fallback; + } + + return str; +} /* lookup_result_code() */ + + +/* + * --------------------------------------------------------------------------- + * lookup_reason + * + * Return a description string for a WiFi MLME ReasonCode. + * + * Arguments: + * reason The ReasonCode to interpret. + * + * Returns: + * Pointer to description string. + * --------------------------------------------------------------------------- + */ +const char * +lookup_reason_code(int reason) +{ + static char fallback[16]; + const char *str; + + str = lookup_something(Reason_codes, reason); + + if (str == NULL) { + snprintf(fallback, 16, "%d", reason); + str = fallback; + } + + return str; +} /* lookup_reason_code() */ + diff --git a/drivers/staging/csr/monitor.c b/drivers/staging/csr/monitor.c new file mode 100644 index 0000000..7648d2b --- /dev/null +++ b/drivers/staging/csr/monitor.c @@ -0,0 +1,458 @@ +/* + * --------------------------------------------------------------------------- + * FILE: monitor.c + * + * Copyright (C) 2006-2008 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * --------------------------------------------------------------------------- + */ + +#include "unifi_priv.h" + +#ifdef UNIFI_SNIFF_ARPHRD + + +#if (UNIFI_SNIFF_ARPHRD == ARPHRD_IEEE80211_RADIOTAP) +#include +#endif + +#ifndef ETH_P_80211_RAW +#define ETH_P_80211_RAW ETH_P_ALL +#endif + + + +/* + * --------------------------------------------------------------------------- + * uf_start_sniff + * + * Start UniFi capture in SNIFF mode, i.e capture everything it hears. + * + * Arguments: + * priv Pointer to device private context struct + * + * Returns: + * 0 on success or kernel error code + * --------------------------------------------------------------------------- + */ +int +uf_start_sniff(unifi_priv_t *priv) +{ + ul_client_t *pcli = priv->wext_client; + CSR_SIGNAL signal; + CSR_MLME_SNIFFJOIN_REQUEST *req = &signal.u.MlmeSniffjoinRequest; + int timeout = 1000; + int r; + + req->Ifindex = priv->if_index; + req->Channel = priv->wext_conf.channel; + req->ChannelStartingFactor = 0; + +#if 0 + printk("SniffJoin: Ifindex=%d, Channel=%d, ChannelStartingFactor=%d\n", + req->Ifindex, + req->Channel, + req->ChannelStartingFactor); +#endif + + signal.SignalPrimitiveHeader.SignalId = CSR_MLME_SNIFFJOIN_REQUEST_ID; + + r = unifi_mlme_blocking_request(priv, pcli, &signal, NULL, timeout); + if (r < 0) { + unifi_error(priv, "failed to send SNIFFJOIN request, error %d\n", r); + return r; + } + + r = pcli->reply_signal->u.MlmeSniffjoinConfirm.Resultcode; + if (r) { + unifi_notice(priv, "SNIFFJOIN request was rejected with result 0x%X (%s)\n", + r, lookup_result_code(r)); + return -EIO; + } + + return 0; +} /* uf_start_sniff() */ + + + +/* + * --------------------------------------------------------------------------- + * netrx_radiotap + * + * Reformat a UniFi SNIFFDATA signal into a radiotap packet. + * + * Arguments: + * priv OS private context pointer. + * ind Pointer to a MA_UNITDATA_INDICATION or + * DS_UNITDATA_INDICATION indication structure. + * + * Notes: + * Radiotap header values are all little-endian, UniFi signals will have + * been converted to host-endian. + * --------------------------------------------------------------------------- + */ +#if (UNIFI_SNIFF_ARPHRD == ARPHRD_IEEE80211_RADIOTAP) +static void +netrx_radiotap(unifi_priv_t *priv, + const CSR_MA_SNIFFDATA_INDICATION *ind, + struct sk_buff *skb_orig) +{ + struct net_device *dev = priv->netdev; + struct sk_buff *skb = NULL; + unsigned char *ptr; + unsigned char *base; + int ind_data_len = skb_orig->len - 2 - ETH_HLEN; + struct unifi_rx_radiotap_header { + struct ieee80211_radiotap_header rt_hdr; + /* IEEE80211_RADIOTAP_TSFT */ + u64 rt_tsft; + /* IEEE80211_RADIOTAP_FLAGS */ + u8 rt_flags; + /* IEEE80211_RADIOTAP_RATE */ + u8 rt_rate; + /* IEEE80211_RADIOTAP_CHANNEL */ + u16 rt_chan; + u16 rt_chan_flags; + /* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */ + u8 rt_dbm_antsignal; + /* IEEE80211_RADIOTAP_DBM_ANTNOISE */ + u8 rt_dbm_antnoise; + /* IEEE80211_RADIOTAP_ANTENNA */ + u8 rt_antenna; + + /* pad to 4-byte boundary */ + u8 pad[3]; + } __attribute__((__packed__)); + + struct unifi_rx_radiotap_header *unifi_rt; + int signal, noise, snr; + + func_enter(); + + if (ind_data_len <= 0) { + unifi_error(priv, "Invalid length in CSR_MA_SNIFFDATA_INDICATION.\n"); + return; + } + + /* + * Allocate a SKB for the received data packet, including radiotap + * header. + */ + skb = dev_alloc_skb(ind_data_len + sizeof(struct unifi_rx_radiotap_header) + 4); + if (! skb) { + unifi_error(priv, "alloc_skb failed.\n"); + priv->stats.rx_errors++; + return; + } + + base = skb->data; + + /* Reserve the radiotap header at the front of skb */ + unifi_rt = (struct unifi_rx_radiotap_header *) + skb_put(skb, sizeof(struct unifi_rx_radiotap_header)); + + /* Copy in the 802.11 frame */ + ptr = skb_put(skb, ind_data_len); + memcpy(ptr, skb_orig->data, ind_data_len); + + unifi_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; + unifi_rt->rt_hdr.it_pad = 0; /* always good to zero */ + unifi_rt->rt_hdr.it_len = sizeof(struct unifi_rx_radiotap_header); + + /* Big bitfield of all the fields we provide in radiotap */ + unifi_rt->rt_hdr.it_present = 0 + | (1 << IEEE80211_RADIOTAP_TSFT) + | (1 << IEEE80211_RADIOTAP_FLAGS) + | (1 << IEEE80211_RADIOTAP_RATE) + | (1 << IEEE80211_RADIOTAP_CHANNEL) + | (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) + | (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) + | (1 << IEEE80211_RADIOTAP_ANTENNA) + ; + + + /* No flags to set */ + unifi_rt->rt_tsft = (((u64)ind->Timestamp.x[7]) | (((u64)ind->Timestamp.x[6]) << 8) | + (((u64)ind->Timestamp.x[5]) << 16) | (((u64)ind->Timestamp.x[4]) << 24) | + (((u64)ind->Timestamp.x[3]) << 32) | (((u64)ind->Timestamp.x[2]) << 40) | + (((u64)ind->Timestamp.x[1]) << 48) | (((u64)ind->Timestamp.x[0]) << 56)); + + unifi_rt->rt_flags = 0; + + unifi_rt->rt_rate = ind->Rate; + + unifi_rt->rt_chan = cpu_to_le16(ieee80211chan2mhz(priv->wext_conf.channel)); + unifi_rt->rt_chan_flags = 0; + + /* Convert signal to dBm */ + signal = (s16)unifi2host_16(ind->Rssi); /* in dBm */ + snr = (s16)unifi2host_16(ind->Snr); /* in dB */ + noise = signal - snr; + + unifi_rt->rt_dbm_antsignal = signal; + unifi_rt->rt_dbm_antnoise = noise; + + unifi_rt->rt_antenna = ind->AntennaId; + + +#if 0 + printk("skb datalen=%d\n", skb->len); + dump(skb->data, 48); +#endif + + skb->dev = dev; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) + skb->mac_header = skb->data; +#else + skb->mac.raw = skb->data; +#endif + skb->pkt_type = PACKET_OTHERHOST; + skb->protocol = __constant_htons(ETH_P_80211_RAW); + memset(skb->cb, 0, sizeof(skb->cb)); + + /* Pass up to Linux network stack */ + netif_rx_ni(skb); + + dev->last_rx = jiffies; + + /* Bump the rx stats */ + priv->stats.rx_packets++; + priv->stats.rx_bytes += ind_data_len; + + func_exit(); +} /* netrx_radiotap() */ +#endif /* RADIOTAP */ + + +/* + * --------------------------------------------------------------------------- + * netrx_prism + * + * Reformat a UniFi SNIFFDATA signal into a Prism format sniff packet. + * + * Arguments: + * priv OS private context pointer. + * ind Pointer to a MA_UNITDATA_INDICATION or + * DS_UNITDATA_INDICATION indication structure. + * + * Notes: + * Radiotap header values are all little-endian, UniFi signals will have + * been converted to host-endian. + * --------------------------------------------------------------------------- + */ +#if (UNIFI_SNIFF_ARPHRD == ARPHRD_IEEE80211_PRISM) +static void +netrx_prism(unifi_priv_t *priv, + const CSR_MA_SNIFFDATA_INDICATION *ind, + struct sk_buff *skb_orig) +{ + struct net_device *dev = priv->netdev; + struct sk_buff *skb = NULL; + unsigned char *ptr; + unsigned char *base; + int ind_data_len = skb_orig->len - 2 - ETH_HLEN; +#define WLANCAP_MAGIC_COOKIE_BASE 0x80211000 +#define WLANCAP_MAGIC_COOKIE_V1 0x80211001 +#define WLANCAP_MAGIC_COOKIE_V2 0x80211002 + struct avs_header_v1 { + uint32 version; + uint32 length; + uint64 mactime; + uint64 hosttime; + uint32 phytype; + uint32 channel; + uint32 datarate; + uint32 antenna; + uint32 priority; + uint32 ssi_type; + int32 ssi_signal; + int32 ssi_noise; + uint32 preamble; + uint32 encoding; + } *avs; + int signal, noise, snr; + + func_enter(); + + if (ind_data_len <= 0) { + unifi_error(priv, "Invalid length in CSR_MA_SNIFFDATA_INDICATION.\n"); + return; + } + +#if 0 + printk("MA-SINFFDATA.ind: DataLen=%d bytes, TSF %02X %02X %02X %02X %02X %02X %02X %02X, Rate=%d, Antenna=%d\n", + ind->Data.DataLength, + ind->Timestamp.x[0], + ind->Timestamp.x[1], + ind->Timestamp.x[2], + ind->Timestamp.x[3], + ind->Timestamp.x[4], + ind->Timestamp.x[5], + ind->Timestamp.x[6], + ind->Timestamp.x[7], + ind->Rate, + ind->Antenna); + + printk("payload, len %d\n", length); + dump((unsigned char *)payload, 32); +#endif + + /* + * Allocate a SKB for the received data packet, including radiotap + * header. + */ + skb = dev_alloc_skb(ind_data_len + sizeof(struct avs_header_v1) + 4); + if (! skb) { + unifi_error(priv, "alloc_skb failed.\n"); + priv->stats.rx_errors++; + return; + } + + base = skb->data; + + /* Reserve the radiotap header at the front of skb */ + avs = (struct avs_header_v1 *)skb_put(skb, sizeof(struct avs_header_v1)); + + /* Copy in the 802.11 frame */ + ptr = skb_put(skb, ind_data_len); + memcpy(ptr, skb_orig->data, ind_data_len); + + /* Convert signal to dBm */ + signal = 0x10000 - ((s16)unifi2host_16(ind->Rssi)); /* in dBm */ + snr = (s16)unifi2host_16(ind->Snr); /* in dB */ + noise = signal - snr; + + avs->version = htonl(WLANCAP_MAGIC_COOKIE_V1); + avs->length = htonl(sizeof(struct avs_header_v1)); + avs->mactime = __cpu_to_be64(ind->Timestamp); + avs->hosttime = __cpu_to_be64(jiffies); + avs->phytype = htonl(9); /* dss_ofdm_dot11_g */ + avs->channel = htonl(priv->wext_conf.channel); + avs->datarate = htonl(ind->Rate * 5); + avs->antenna = htonl(ind->Antenna); + avs->priority = htonl(0); /* unknown */ + avs->ssi_type = htonl(2); /* dBm */ + avs->ssi_signal = htonl(signal); + avs->ssi_noise = htonl(noise); + avs->preamble = htonl(0); /* unknown */ + avs->encoding = htonl(0); /* unknown */ + + +#if 0 + printk("skb datalen=%d\n", skb->len); + dump(skb->data, 48); +#endif + + skb->dev = dev; + skb->mac.raw = skb->data; + skb->pkt_type = PACKET_OTHERHOST; + skb->protocol = __constant_htons(ETH_P_80211_RAW); + memset(skb->cb, 0, sizeof(skb->cb)); + + /* Pass up to Linux network stack */ + netif_rx_ni(skb); + + dev->last_rx = jiffies; + + /* Bump the rx stats */ + priv->stats.rx_packets++; + priv->stats.rx_bytes += ind_data_len; + + func_exit(); +} /* netrx_prism() */ +#endif /* PRISM */ + + +/* + * --------------------------------------------------------------------------- + * ma_sniffdata_ind + * + * Reformat a UniFi SNIFFDATA signal into a network + * + * Arguments: + * ospriv OS private context pointer. + * ind Pointer to a MA_UNITDATA_INDICATION or + * DS_UNITDATA_INDICATION indication structure. + * bulkdata Pointer to a bulk data structure, describing + * the data received. + * + * Notes: + * Radiotap header values are all little-endian, UniFi signals will have + * been converted to host-endian. + * --------------------------------------------------------------------------- + */ +void +ma_sniffdata_ind(void *ospriv, + const CSR_MA_SNIFFDATA_INDICATION *ind, + const bulk_data_param_t *bulkdata) +{ + unifi_priv_t *priv = ospriv; + struct net_device *dev = priv->netdev; + struct sk_buff *skb = (struct sk_buff*)bulkdata->d[0].os_net_buf_ptr; + + func_enter(); + + if (bulkdata->d[0].data_length == 0) { + unifi_warning(priv, "rx: MA-SNIFFDATA indication with zero bulk data\n"); + func_exit(); + return; + } + + skb->len = bulkdata->d[0].data_length; +#if 0 + printk("MA-SNIFFDATA.ind: DataLen=%d bytes, TSF %02X %02X %02X %02X %02X %02X %02X %02X, Rate=%d, Antenna=%d\n", + ind->Data.DataLength, + ind->Timestamp.x[0], + ind->Timestamp.x[1], + ind->Timestamp.x[2], + ind->Timestamp.x[3], + ind->Timestamp.x[4], + ind->Timestamp.x[5], + ind->Timestamp.x[6], + ind->Timestamp.x[7], + ind->Rate, + ind->AntennaId); + + printk("payload, len %lu\n", bulkdata->d[0].data_length); + if (bulkdata->d[0].os_data_ptr && (bulkdata->d[0].data_length >= 32)) { + dump((unsigned char *)bulkdata->d[0].os_data_ptr, 32); + } +#endif + + /* We only process data packets if the interface is open */ + if (unlikely(!netif_running(dev))) { + priv->stats.rx_dropped++; + priv->wext_conf.wireless_stats.discard.misc++; +#if 0 + printk("Dropping packet while interface is not up.\n"); +#endif + dev_kfree_skb(skb); + return; + } + + if (ind->ReceptionStatus) { + priv->stats.rx_dropped++; + priv->wext_conf.wireless_stats.discard.misc++; + printk(KERN_INFO "unifi: Dropping corrupt sniff packet\n"); + dev_kfree_skb(skb); + return; + } + +#if (UNIFI_SNIFF_ARPHRD == ARPHRD_IEEE80211_PRISM) + netrx_prism(priv, ind, skb); +#endif /* PRISM */ + +#if (UNIFI_SNIFF_ARPHRD == ARPHRD_IEEE80211_RADIOTAP) + netrx_radiotap(priv, ind, skb); +#endif /* RADIOTAP */ + + dev_kfree_skb(skb); + +} /* ma_sniffdata_ind() */ + + +#endif /* UNIFI_SNIFF_ARPHRD */ + diff --git a/drivers/staging/csr/netdev.c b/drivers/staging/csr/netdev.c new file mode 100644 index 0000000..b0335f6 --- /dev/null +++ b/drivers/staging/csr/netdev.c @@ -0,0 +1,3902 @@ +/* + * --------------------------------------------------------------------------- + * FILE: netdev.c + * + * PURPOSE: + * This file provides the upper edge interface to the linux netdevice + * and wireless extensions. + * It is part of the porting exercise. + * + * Copyright (C) 2005-2010 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * --------------------------------------------------------------------------- + */ + + +/* + * Porting Notes: + * This file implements the data plane of the UniFi linux driver. + * + * All the Tx packets are passed to the HIP core lib, using the + * unifi_send_signal() API. For EAPOL packets use the MLME-EAPOL.req + * signal, for all other use the MLME-UNITDATA.req. The unifi_send_signal() + * expects the wire-formatted (packed) signal. For convenience, in the OS + * layer we only use the native (unpacked) signal structures. The HIP core lib + * provides the write_pack() helper function to convert to the packed signal. + * The packet is stored in the bulk data of the signal. We do not need to + * allocate new memory to store the packet, because unifi_net_data_malloc() + * is implemented to return a skb, which is the format of packet in Linux. + * The HIP core lib frees the bulk data buffers, so we do not need to do + * this in the OS layer. + * + * All the Rx packets are MLME-UNITDATA.ind signals, passed by the HIP core lib + * in unifi_receive_event(). We do not need to allocate an skb and copy the + * received packet because the HIP core lib has stored in memory allocated by + * unifi_net_data_malloc(). Also, we can perform the 802.11 to Ethernet + * translation in-place because we allocate the extra memory allocated in + * unifi_net_data_malloc(). + * + * If possible, the porting exercise should appropriately implement + * unifi_net_data_malloc() and unifi_net_data_free() to save copies between + * network and driver buffers. + */ + +#include +#include +#include +#include + +#include +#include "csr_wifi_hip_unifi.h" +#include "csr_wifi_hip_conversions.h" +#include "unifi_priv.h" +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) +#include +#endif +#include + + +/* ALLOW_Q_PAUSE: Pre 2.6.28 kernels do not support multiple driver queues (required for QoS). + * In order to support QoS in these kernels, multiple queues are implemented in the driver. But since + * there is only a single queue in the kernel (leading to multiple queues in the driver) there is no possibility + * of stopping a particular queue in the kernel. Stopping the single kernel queue leads to undesirable starvation + * of driver queues. One of the proposals is to not stop the kernel queue but to prevent dequeuing from the + * 'stopped' driver queue. Allow q pause is an experimental implementation of this scheme for pre 2.6.28 kernels. + * When NOT defined, queues are paused locally in the driver and packets are dequeued for transmission only from the + * unpaused queues. When Allow q pause is defined the kernel queue is stopped whenever any driver queue is paused. + */ +#define ALLOW_Q_PAUSE + +#define ieee2host16(n) __le16_to_cpu(n) +#define ieee2host32(n) __le32_to_cpu(n) +#define host2ieee16(n) __cpu_to_le16(n) +#define host2ieee32(n) __cpu_to_le32(n) + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) +#ifdef UNIFI_NET_NAME +#define UF_ALLOC_NETDEV(_dev, _size, _name, _setup, _num_of_queues) \ + do { \ + static char name[8]; \ + sprintf(name, "%s%s", UNIFI_NET_NAME, _name); \ + _dev = alloc_netdev_mq(_size, name, _setup, _num_of_queues); \ + } while (0); +#else +#define UF_ALLOC_NETDEV(_dev, _size, _name, _setup, _num_of_queues) \ + do { \ + _dev = alloc_etherdev_mq(_size, _num_of_queues); \ + } while (0); +#endif /* UNIFI_NET_NAME */ +#else +#ifdef UNIFI_NET_NAME +#define UF_ALLOC_NETDEV(_dev, _size, _name, _setup, _num_of_queues) \ + do { \ + static char name[8]; \ + sprintf(name, "%s%s", UNIFI_NET_NAME, _name); \ + _dev = alloc_netdev(_size, name, _setup); \ + } while (0); +#else +#define UF_ALLOC_NETDEV(_dev, _size, _name, _setup, _num_of_queues) \ + do { \ + _dev = alloc_etherdev(_size); \ + } while (0); +#endif /* UNIFI_NET_NAME */ +#endif /* LINUX_VERSION_CODE */ + + +/* Wext handler is suported only if CSR_SUPPORT_WEXT is defined */ +#ifdef CSR_SUPPORT_WEXT +extern struct iw_handler_def unifi_iw_handler_def; +#endif /* CSR_SUPPORT_WEXT */ +static void check_ba_frame_age_timeout( unifi_priv_t *priv, + netInterface_priv_t *interfacePriv, + ba_session_rx_struct *ba_session); +static void process_ba_frame(unifi_priv_t *priv, + netInterface_priv_t *interfacePriv, + ba_session_rx_struct *ba_session, + frame_desc_struct *frame_desc); +static void process_ba_complete(unifi_priv_t *priv, netInterface_priv_t *interfacePriv); +static void process_ma_packet_error_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata); +static void process_amsdu(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata); +static int uf_net_open(struct net_device *dev); +static int uf_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); +static int uf_net_stop(struct net_device *dev); +static struct net_device_stats *uf_net_get_stats(struct net_device *dev); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) +static u16 uf_net_select_queue(struct net_device *dev, struct sk_buff *skb); +#endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) +static netdev_tx_t uf_net_xmit(struct sk_buff *skb, struct net_device *dev); +#else +static int uf_net_xmit(struct sk_buff *skb, struct net_device *dev); +#ifndef NETDEV_TX_OK +#define NETDEV_TX_OK 0 +#endif +#ifndef NETDEV_TX_BUSY +#define NETDEV_TX_BUSY 1 +#endif +#endif +static void uf_set_multicast_list(struct net_device *dev); + + +typedef int (*tx_signal_handler)(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr *ehdr, CSR_PRIORITY priority); + +#ifdef CONFIG_NET_SCHED +/* + * Queueing Discipline Interface + * Only used if kernel is configured with CONFIG_NET_SCHED + */ + +/* + * The driver uses the qdisc interface to buffer and control all + * outgoing traffic. We create a root qdisc, register our qdisc operations + * and later we create two subsiduary pfifo queues for the uncontrolled + * and controlled ports. + * + * The network stack delivers all outgoing packets in our enqueue handler. + * There, we classify the packet and decide whether to store it or drop it + * (if the controlled port state is set to "discard"). + * If the packet is enqueued, the network stack call our dequeue handler. + * There, we decide whether we can send the packet, delay it or drop it + * (the controlled port configuration might have changed meanwhile). + * If a packet is dequeued, then the network stack calls our hard_start_xmit + * handler where finally we send the packet. + * + * If the hard_start_xmit handler fails to send the packet, we return + * NETDEV_TX_BUSY and the network stack call our requeue handler where + * we put the packet back in the same queue in came from. + * + */ + +struct uf_sched_data +{ + /* Traffic Classifier TBD */ + struct tcf_proto *filter_list; + /* Our two queues */ + struct Qdisc *queues[UNIFI_TRAFFIC_Q_MAX]; +}; + +struct uf_tx_packet_data { + /* Queue the packet is stored in */ + unifi_TrafficQueue queue; + /* QoS Priority determined when enqueing packet */ + CSR_PRIORITY priority; + /* Debug */ + unsigned long host_tag; +}; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) +static int uf_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd); +static int uf_qdiscop_requeue(struct sk_buff *skb, struct Qdisc* qd); +static struct sk_buff *uf_qdiscop_dequeue(struct Qdisc* qd); +static void uf_qdiscop_reset(struct Qdisc* qd); +static void uf_qdiscop_destroy(struct Qdisc* qd); +static int uf_qdiscop_dump(struct Qdisc *qd, struct sk_buff *skb); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) +static int uf_qdiscop_tune(struct Qdisc *qd, struct nlattr *opt); +static int uf_qdiscop_init(struct Qdisc *qd, struct nlattr *opt); +#else +static int uf_qdiscop_tune(struct Qdisc *qd, struct rtattr *opt); +static int uf_qdiscop_init(struct Qdisc *qd, struct rtattr *opt); +#endif +#endif + + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) +/* queueing discipline operations */ +static struct Qdisc_ops uf_qdisc_ops = +{ + .next = NULL, + .cl_ops = NULL, + .id = "UniFi Qdisc", + .priv_size = sizeof(struct uf_sched_data), + + .enqueue = uf_qdiscop_enqueue, + .dequeue = uf_qdiscop_dequeue, + .requeue = uf_qdiscop_requeue, + .drop = NULL, /* drop not needed since we are always the root qdisc */ + + .init = uf_qdiscop_init, + .reset = uf_qdiscop_reset, + .destroy = uf_qdiscop_destroy, + .change = uf_qdiscop_tune, + + .dump = uf_qdiscop_dump, +}; +#endif /* LINUX_VERSION_CODE */ + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) +#define UF_QDISC_CREATE_DFLT(_dev, _ops, _root) +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) +#define UF_QDISC_CREATE_DFLT(_dev, _ops, _root) \ + qdisc_create_dflt(dev, netdev_get_tx_queue(_dev, 0), _ops, _root) +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) +#define UF_QDISC_CREATE_DFLT(_dev, _ops, _root) \ + qdisc_create_dflt(dev, _ops, _root) +#else +#define UF_QDISC_CREATE_DFLT(_dev, _ops, _root) \ + qdisc_create_dflt(dev, _ops) +#endif /* LINUX_VERSION_CODE */ + +#endif /* CONFIG_NET_SCHED */ + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) +static const struct net_device_ops uf_netdev_ops = +{ + .ndo_open = uf_net_open, + .ndo_stop = uf_net_stop, + .ndo_start_xmit = uf_net_xmit, + .ndo_do_ioctl = uf_net_ioctl, + .ndo_get_stats = uf_net_get_stats, /* called by /proc/net/dev */ + .ndo_set_rx_mode = uf_set_multicast_list, + .ndo_select_queue = uf_net_select_queue, +}; +#endif + +static u8 oui_rfc1042[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; +static u8 oui_8021h[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; + + +/* Callback for event logging to blocking clients */ +static void netdev_mlme_event_handler(ul_client_t *client, + const u8 *sig_packed, int sig_len, + const bulk_data_param_t *bulkdata, + int dir); + +#ifdef CSR_SUPPORT_WEXT +/* Declare netdev_notifier block which will contain the state change + * handler callback function + */ +static struct notifier_block uf_netdev_notifier; +#endif + +/* + * --------------------------------------------------------------------------- + * uf_alloc_netdevice + * + * Allocate memory for the net_device and device private structs + * for this interface. + * Fill in the fields, but don't register the interface yet. + * We need to configure the UniFi first. + * + * Arguments: + * sdio_dev Pointer to SDIO context handle to use for all + * SDIO ops. + * bus_id A small number indicating the SDIO card position on the + * bus. Typically this is the slot number, e.g. 0, 1 etc. + * Valid values are 0 to MAX_UNIFI_DEVS-1. + * + * Returns: + * Pointer to device private struct. + * + * Notes: + * The net_device and device private structs are allocated together + * and should be freed by freeing the net_device pointer. + * --------------------------------------------------------------------------- + */ +unifi_priv_t * +uf_alloc_netdevice(CsrSdioFunction *sdio_dev, int bus_id) +{ + struct net_device *dev; + unifi_priv_t *priv; + netInterface_priv_t *interfacePriv; +#ifdef CSR_SUPPORT_WEXT + int rc; +#endif + unsigned char i; /* loop index */ + + /* + * Allocate netdevice struct, assign name template and + * setup as an ethernet device. + * The net_device and private structs are zeroed. Ether_setup() then + * sets up ethernet handlers and values. + * The RedHat 9 redhat-config-network tool doesn't recognise wlan* devices, + * so use "eth*" (like other wireless extns drivers). + */ + UF_ALLOC_NETDEV(dev, sizeof(unifi_priv_t)+sizeof(netInterface_priv_t), "%d", ether_setup, UNIFI_TRAFFIC_Q_MAX); + + if (dev == NULL) { + return NULL; + } + + /* Set up back pointer from priv to netdev */ + interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + priv = (unifi_priv_t *)(interfacePriv + 1); + interfacePriv->privPtr = priv; + interfacePriv->InterfaceTag = 0; + + + /* Initialize all supported netdev interface to be NULL */ + for(i=0; inetdev[i] = NULL; + priv->interfacePriv[i] = NULL; + } + priv->netdev[0] = dev; + priv->interfacePriv[0] = interfacePriv; + + /* Setup / override net_device fields */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) + dev->netdev_ops = &uf_netdev_ops; +#else + dev->open = uf_net_open; + dev->stop = uf_net_stop; + dev->hard_start_xmit = uf_net_xmit; + dev->do_ioctl = uf_net_ioctl; + + /* called by /proc/net/dev */ + dev->get_stats = uf_net_get_stats; + + dev->set_multicast_list = uf_set_multicast_list; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) + dev->select_queue = uf_net_select_queue; +#endif +#endif + +#ifdef CSR_SUPPORT_WEXT + dev->wireless_handlers = &unifi_iw_handler_def; +#if IW_HANDLER_VERSION < 6 + dev->get_wireless_stats = unifi_get_wireless_stats; +#endif /* IW_HANDLER_VERSION */ +#endif /* CSR_SUPPORT_WEXT */ + + /* This gives us enough headroom to add the 802.11 header */ + dev->needed_headroom = 32; + + /* Use bus_id as instance number */ + priv->instance = bus_id; + /* Store SDIO pointer to pass in the core */ + priv->sdio = sdio_dev; + + sdio_dev->driverData = (void*)priv; + /* Consider UniFi to be uninitialised */ + priv->init_progress = UNIFI_INIT_NONE; + + priv->prev_queue = 0; + + /* + * Initialise the clients structure array. + * We do not need protection around ul_init_clients() because + * the character device can not be used until uf_alloc_netdevice() + * returns and Unifi_instances[bus_id]=priv is set, since unifi_open() + * will return -ENODEV. + */ + ul_init_clients(priv); + + /* + * Register a new ul client to send the multicast list signals. + * Note: priv->instance must be set before calling this. + */ + priv->netdev_client = ul_register_client(priv, + 0, + netdev_mlme_event_handler); + if (priv->netdev_client == NULL) { + unifi_error(priv, + "Failed to register a unifi client for background netdev processing\n"); + free_netdev(priv->netdev[0]); + return NULL; + } + unifi_trace(priv, UDBG2, "Netdev %p client (id:%d s:0x%X) is registered\n", + dev, priv->netdev_client->client_id, priv->netdev_client->sender_id); + + priv->sta_wmm_capabilities = 0; + + priv->wapi_multicast_filter = 0; + priv->wapi_unicast_filter = 0; + priv->wapi_unicast_queued_pkt_filter = 0; + + /* Enable all queues by default */ + interfacePriv->queueEnabled[0] = 1; + interfacePriv->queueEnabled[1] = 1; + interfacePriv->queueEnabled[2] = 1; + interfacePriv->queueEnabled[3] = 1; + +#ifdef CSR_SUPPORT_SME + priv->allPeerDozing = 0; +#endif + /* + * Initialise the OS private struct. + */ + /* + * Instead of deciding in advance to use 11bg or 11a, we could do a more + * clever scan on both radios. + */ + if (use_5g) { + priv->if_index = CSR_INDEX_5G; + unifi_info(priv, "Using the 802.11a radio\n"); + } else { + priv->if_index = CSR_INDEX_2G4; + } + + /* Initialise bh thread structure */ + priv->bh_thread.thread_task = NULL; + priv->bh_thread.block_thread = 1; + init_waitqueue_head(&priv->bh_thread.wakeup_q); + priv->bh_thread.wakeup_flag = 0; + sprintf(priv->bh_thread.name, "uf_bh_thread"); + + /* reset the connected state for the interface */ + interfacePriv->connected = UnifiConnectedUnknown; /* -1 unknown, 0 no, 1 yes */ + +#ifdef USE_DRIVER_LOCK +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) + sema_init(&priv->lock, 1); +#else + init_MUTEX(&priv->lock); +#endif +#endif /* USE_DRIVER_LOCK */ + + spin_lock_init(&priv->send_signal_lock); + + spin_lock_init(&priv->m4_lock); + spin_lock_init(&priv->ba_lock); + +#ifdef CSR_SUPPORT_SME + spin_lock_init(&priv->staRecord_lock); + spin_lock_init(&priv->tx_q_lock); +#endif + + /* Create the Traffic Analysis workqueue */ + priv->unifi_workqueue = create_singlethread_workqueue("unifi_workq"); + if (priv->unifi_workqueue == NULL) { + /* Deregister priv->netdev_client */ + ul_deregister_client(priv->netdev_client); + free_netdev(priv->netdev[0]); + return NULL; + } + +#ifdef CSR_SUPPORT_SME + /* Create the Multicast Addresses list work structure */ + INIT_WORK(&priv->multicast_list_task, uf_multicast_list_wq); + + /* Create m4 buffering work structure */ + INIT_WORK(&interfacePriv->send_m4_ready_task, uf_send_m4_ready_wq); +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) +#ifdef CONFIG_NET_SCHED + /* Register the qdisc operations */ + register_qdisc(&uf_qdisc_ops); +#endif /* CONFIG_NET_SCHED */ +#endif /* LINUX_VERSION_CODE */ + + priv->ref_count = 1; + + + priv->amp_client = NULL; + priv->coredump_mode = 0; + priv->ptest_mode = 0; + priv->wol_suspend = FALSE; + INIT_LIST_HEAD(&interfacePriv->rx_uncontrolled_list); + INIT_LIST_HEAD(&interfacePriv->rx_controlled_list); + sema_init(&priv->rx_q_sem, 1); + +#ifdef CSR_SUPPORT_WEXT + interfacePriv->netdev_callback_registered = FALSE; + interfacePriv->wait_netdev_change = FALSE; + /* Register callback for netdevice state changes */ + if ((rc = register_netdevice_notifier(&uf_netdev_notifier)) == 0) { + interfacePriv->netdev_callback_registered = TRUE; + } + else { + unifi_warning(priv, "Failed to register netdevice notifier : %d %p\n", rc, dev); + } +#endif /* CSR_SUPPORT_WEXT */ + + return priv; +} /* uf_alloc_netdevice() */ + +/* + *--------------------------------------------------------------------------- + * uf_alloc_netdevice_for_other_interfaces + * + * Allocate memory for the net_device and device private structs + * for this interface. + * Fill in the fields, but don't register the interface yet. + * We need to configure the UniFi first. + * + * Arguments: + * interfaceTag Interface number. + * sdio_dev Pointer to SDIO context handle to use for all + * SDIO ops. + * bus_id A small number indicating the SDIO card position on the + * bus. Typically this is the slot number, e.g. 0, 1 etc. + * Valid values are 0 to MAX_UNIFI_DEVS-1. + * + * Returns: + * Pointer to device private struct. + * + * Notes: + * The device private structure contains the interfaceTag and pointer to the unifi_priv + * structure created allocated by net_device od interface0. + * The net_device and device private structs are allocated together + * and should be freed by freeing the net_device pointer. + * --------------------------------------------------------------------------- + */ +CsrBool +uf_alloc_netdevice_for_other_interfaces(unifi_priv_t *priv, CsrUint16 interfaceTag) +{ + struct net_device *dev; + netInterface_priv_t *interfacePriv; + + /* + * Allocate netdevice struct, assign name template and + * setup as an ethernet device. + * The net_device and private structs are zeroed. Ether_setup() then + * sets up ethernet handlers and values. + * The RedHat 9 redhat-config-network tool doesn't recognise wlan* devices, + * so use "eth*" (like other wireless extns drivers). + */ + UF_ALLOC_NETDEV(dev, sizeof(netInterface_priv_t), "%d", ether_setup, 1); + if (dev == NULL) { + return FALSE; + } + + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "uf_alloc_netdevice_for_other_interfaces bad interfaceTag\n"); + return FALSE; + } + + /* Set up back pointer from priv to netdev */ + interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + interfacePriv->privPtr = priv; + interfacePriv->InterfaceTag = interfaceTag; + priv->netdev[interfaceTag] = dev; + priv->interfacePriv[interfacePriv->InterfaceTag] = interfacePriv; + + /* reset the connected state for the interface */ + interfacePriv->connected = UnifiConnectedUnknown; /* -1 unknown, 0 no, 1 yes */ + INIT_LIST_HEAD(&interfacePriv->rx_uncontrolled_list); + INIT_LIST_HEAD(&interfacePriv->rx_controlled_list); + + /* Setup / override net_device fields */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) + dev->netdev_ops = &uf_netdev_ops; +#else + dev->open = uf_net_open; + dev->stop = uf_net_stop; + dev->hard_start_xmit = uf_net_xmit; + dev->do_ioctl = uf_net_ioctl; + + /* called by /proc/net/dev */ + dev->get_stats = uf_net_get_stats; + + dev->set_multicast_list = uf_set_multicast_list; +#endif + +#ifdef CSR_SUPPORT_WEXT + dev->wireless_handlers = &unifi_iw_handler_def; +#if IW_HANDLER_VERSION < 6 + dev->get_wireless_stats = unifi_get_wireless_stats; +#endif /* IW_HANDLER_VERSION */ +#endif /* CSR_SUPPORT_WEXT */ + return TRUE; +} /* uf_alloc_netdevice() */ + + + +/* + * --------------------------------------------------------------------------- + * uf_free_netdevice + * + * Unregister the network device and free the memory allocated for it. + * NB This includes the memory for the priv struct. + * + * Arguments: + * priv Device private pointer. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +int +uf_free_netdevice(unifi_priv_t *priv) +{ + int i; + unsigned long flags; + + func_enter(); + + unifi_trace(priv, UDBG1, "uf_free_netdevice\n"); + + if (!priv) { + return -EINVAL; + } + + /* + * Free any buffers used for holding firmware + */ + uf_release_firmware_files(priv); + +#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT) + if (priv->connection_config.mlmeAssociateReqInformationElements) { + kfree(priv->connection_config.mlmeAssociateReqInformationElements); + } + priv->connection_config.mlmeAssociateReqInformationElements = NULL; + priv->connection_config.mlmeAssociateReqInformationElementsLength = 0; + + if (priv->mib_data.length) { + vfree(priv->mib_data.data); + } + priv->mib_data.data = NULL; + priv->mib_data.length = 0; + +#endif /* CSR_SUPPORT_SME && CSR_SUPPORT_WEXT*/ + + /* Free any bulkdata buffers allocated for M4 caching */ + spin_lock_irqsave(&priv->m4_lock, flags); + for (i = 0; i < CSR_WIFI_NUM_INTERFACES; i++) { + netInterface_priv_t *interfacePriv = priv->interfacePriv[i]; + if (interfacePriv->m4_bulk_data.data_length > 0) { + unifi_trace(priv, UDBG5, "uf_free_netdevice: free M4 bulkdata %d\n", i); + unifi_net_data_free(priv, &interfacePriv->m4_bulk_data); + } + } + spin_unlock_irqrestore(&priv->m4_lock, flags); + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) +#ifdef CONFIG_NET_SCHED + /* Unregister the qdisc operations */ + unregister_qdisc(&uf_qdisc_ops); +#endif /* CONFIG_NET_SCHED */ +#endif /* LINUX_VERSION_CODE */ + +#ifdef CSR_SUPPORT_WEXT + /* Unregister callback for netdevice state changes */ + unregister_netdevice_notifier(&uf_netdev_notifier); +#endif /* CSR_SUPPORT_WEXT */ + +#ifdef CSR_SUPPORT_SME + /* Cancel work items and destroy the workqueue */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) + cancel_work_sync(&priv->multicast_list_task); +#endif +#endif +/* Destroy the workqueues. */ + flush_workqueue(priv->unifi_workqueue); + destroy_workqueue(priv->unifi_workqueue); + + /* Free up netdev in reverse order: priv is allocated with netdev[0]. + * So, netdev[0] should be freed after all other netdevs are freed up + */ + for (i=CSR_WIFI_NUM_INTERFACES-1; i>=0; i--) { + /*Free the netdev struct and priv, which are all one lump*/ + if (priv->netdev[i]) { + unifi_error(priv, "uf_free_netdevice: netdev %d %p\n", i, priv->netdev[i]); + free_netdev(priv->netdev[i]); + } + } + + func_exit(); + return 0; +} /* uf_free_netdevice() */ + + +/* + * --------------------------------------------------------------------------- + * uf_net_open + * + * Called when userland does "ifconfig wlan0 up". + * + * Arguments: + * dev Device pointer. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +static int +uf_net_open(struct net_device *dev) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + + func_enter(); + + /* If we haven't finished UniFi initialisation, we can't start */ + if (priv->init_progress != UNIFI_INIT_COMPLETED) { + unifi_warning(priv, "%s: unifi not ready, failing net_open\n", __FUNCTION__); + return -EINVAL; + } + +#if (defined CSR_NATIVE_LINUX) && (defined UNIFI_SNIFF_ARPHRD) && defined(CSR_SUPPORT_WEXT) + /* + * To sniff, the user must do "iwconfig mode monitor", which sets + * priv->wext_conf.mode to IW_MODE_MONITOR. + * Then he/she must do "ifconfig ethn up", which calls this fn. + * There is no point in starting the sniff with SNIFFJOIN until + * this point. + */ + if (priv->wext_conf.mode == IW_MODE_MONITOR) { + int err; + err = uf_start_sniff(priv); + if (err) { + return err; + } + netif_carrier_on(dev); + } +#endif + +#ifdef CSR_SUPPORT_WEXT + if (interfacePriv->wait_netdev_change) { + unifi_trace(priv, UDBG1, "%s: Waiting for NETDEV_CHANGE, assume connected\n", + __FUNCTION__); + interfacePriv->connected = UnifiConnected; + interfacePriv->wait_netdev_change = FALSE; + } +#endif + + UF_NETIF_TX_START_ALL_QUEUES(dev); + + func_exit(); + return 0; +} /* uf_net_open() */ + + +static int +uf_net_stop(struct net_device *dev) +{ +#if defined(CSR_NATIVE_LINUX) && defined(UNIFI_SNIFF_ARPHRD) && defined(CSR_SUPPORT_WEXT) + netInterface_priv_t *interfacePriv = (netInterface_priv_t*)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + + func_enter(); + + /* Stop sniffing if in Monitor mode */ + if (priv->wext_conf.mode == IW_MODE_MONITOR) { + if (priv->card) { + int err; + err = unifi_reset_state(priv, dev->dev_addr, 1); + if (err) { + return err; + } + } + } +#else + func_enter(); +#endif + + UF_NETIF_TX_STOP_ALL_QUEUES(dev); + + func_exit(); + return 0; +} /* uf_net_stop() */ + + +/* This is called after the WE handlers */ +static int +uf_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) +{ + int rc; + + rc = -EOPNOTSUPP; + + return rc; +} /* uf_net_ioctl() */ + + + +static struct net_device_stats * +uf_net_get_stats(struct net_device *dev) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + + return &interfacePriv->stats; +} /* uf_net_get_stats() */ + +static CSR_PRIORITY uf_get_packet_priority(unifi_priv_t *priv, netInterface_priv_t *interfacePriv, struct sk_buff *skb, const int proto) +{ + CSR_PRIORITY priority = CSR_CONTENTION; + + func_enter(); + priority = (CSR_PRIORITY) (skb->priority >> 5); + + if (priority == CSR_QOS_UP0) { /* 0 */ + + unifi_trace(priv, UDBG5, "uf_get_packet_priority: proto = 0x%.4X\n", proto); + + switch (proto) { + case 0x0800: /* IPv4 */ + case 0x814C: /* SNMP */ + case 0x880C: /* GSMP */ + priority = (CSR_PRIORITY) (skb->data[1 + ETH_HLEN] >> 5); + break; + + case 0x8100: /* VLAN */ + priority = (CSR_PRIORITY) (skb->data[0 + ETH_HLEN] >> 5); + break; + + case 0x86DD: /* IPv6 */ + priority = (CSR_PRIORITY) ((skb->data[0 + ETH_HLEN] & 0x0E) >> 1); + break; + + default: + priority = CSR_QOS_UP0; + break; + } + } + + /* Check if we are allowed to transmit on this AC. Because of ACM we may have to downgrade to a lower + * priority */ + if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_STA || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI) { + unifi_TrafficQueue queue; + + /* Keep trying lower priorities until we find a queue + * Priority to queue mapping is 1,2 - BK, 0,3 - BE, 4,5 - VI, 6,7 - VO */ + queue = unifi_frame_priority_to_queue(priority); + + while (queue > UNIFI_TRAFFIC_Q_BK && !interfacePriv->queueEnabled[queue]) { + queue--; + priority = unifi_get_default_downgrade_priority(queue); + } + } + + unifi_trace(priv, UDBG5, "Packet priority = %d\n", priority); + + func_exit(); + return priority; +} + +/* + */ +/* + * --------------------------------------------------------------------------- + * get_packet_priority + * + * Arguments: + * priv private data area of functional driver + * skb socket buffer + * ehdr ethernet header to fetch protocol + * interfacePriv For accessing station record database + * + * + * Returns: + * CSR_PRIORITY. + * --------------------------------------------------------------------------- + */ +CSR_PRIORITY +get_packet_priority(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr *ehdr, netInterface_priv_t *interfacePriv) +{ + CSR_PRIORITY priority = CSR_CONTENTION; + const int proto = ntohs(ehdr->h_proto); + + CsrUint8 interfaceMode = interfacePriv->interfaceMode; + + func_enter(); + + /* Priority Mapping for all the Modes */ + switch(interfaceMode) + { + case CSR_WIFI_ROUTER_CTRL_MODE_STA: + case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI: + unifi_trace(priv, UDBG4, "mode is STA \n"); + if ((priv->sta_wmm_capabilities & QOS_CAPABILITY_WMM_ENABLED) == 1) { + priority = uf_get_packet_priority(priv, interfacePriv, skb, proto); + } else { + priority = CSR_CONTENTION; + } + break; +#ifdef CSR_SUPPORT_SME + case CSR_WIFI_ROUTER_CTRL_MODE_AP: + case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: + case CSR_WIFI_ROUTER_CTRL_MODE_IBSS: + { + CsrWifiRouterCtrlStaInfo_t * dstStaInfo = + CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv,ehdr->h_dest, interfacePriv->InterfaceTag); + unifi_trace(priv, UDBG4, "mode is AP \n"); + if (!(ehdr->h_dest[0] & 0x01) && dstStaInfo && dstStaInfo->wmmOrQosEnabled) { + /* If packet is not Broadcast/multicast */ + priority = uf_get_packet_priority(priv, interfacePriv, skb, proto); + } else { + /* Since packet destination is not QSTA, set priority to CSR_CONTENTION */ + unifi_trace(priv, UDBG4, "Destination is not QSTA or BroadCast/Multicast\n"); + priority = CSR_CONTENTION; + } + } + break; +#endif + default: + unifi_trace(priv, UDBG3, " mode unknown in %s func, mode=%x\n", __FUNCTION__, interfaceMode); + } + unifi_trace(priv, UDBG5, "priority = %x\n", priority); + + func_exit(); + return priority; +} + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) +/* + * --------------------------------------------------------------------------- + * uf_net_select_queue + * + * Called by the kernel to select which queue to put the packet in + * + * Arguments: + * dev Device pointer + * skb Packet + * + * Returns: + * Queue index + * --------------------------------------------------------------------------- + */ +static u16 +uf_net_select_queue(struct net_device *dev, struct sk_buff *skb) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = (unifi_priv_t *)interfacePriv->privPtr; + struct ethhdr ehdr; + unifi_TrafficQueue queue; + int proto; + CSR_PRIORITY priority; + + func_enter(); + + memcpy(&ehdr, skb->data, ETH_HLEN); + proto = ntohs(ehdr.h_proto); + + /* 802.1x - apply controlled/uncontrolled port rules */ + if ((proto != ETH_P_PAE) +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + && (proto != ETH_P_WAI) +#endif + ) { + /* queues 0 - 3 */ + priority = get_packet_priority(priv, skb, &ehdr, interfacePriv); + queue = unifi_frame_priority_to_queue(priority); + } else { + /* queue 4 */ + queue = UNIFI_TRAFFIC_Q_EAPOL; + } + + + func_exit(); + return (u16)queue; +} /* uf_net_select_queue() */ +#endif + +int +skb_add_llc_snap(struct net_device *dev, struct sk_buff *skb, int proto) +{ + llc_snap_hdr_t *snap; + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + int headroom; + + /* get the headroom available in skb */ + headroom = skb_headroom(skb); + /* step 1: classify ether frame, DIX or 802.3? */ + + if (proto < 0x600) { + /* codes <= 1500 reserved for 802.3 lengths */ + /* it's 802.3, pass ether payload unchanged, */ + unifi_trace(priv, UDBG3, "802.3 len: %d\n", skb->len); + + /* leave off any PAD octets. */ + skb_trim(skb, proto); + } else if (proto == ETH_P_8021Q) { + + /* Store the VLAN SNAP (should be 87-65). */ + u16 vlan_snap = *(u16*)skb->data; + /* check for headroom availability before skb_push 14 = (4 + 10) */ + if (headroom < 14) { + unifi_trace(priv, UDBG3, "cant append vlan snap: debug\n"); + return -1; + } + /* Add AA-AA-03-00-00-00 */ + snap = (llc_snap_hdr_t *)skb_push(skb, 4); + snap->dsap = snap->ssap = 0xAA; + snap->ctrl = 0x03; + memcpy(snap->oui, oui_rfc1042, P80211_OUI_LEN); + + /* Add AA-AA-03-00-00-00 */ + snap = (llc_snap_hdr_t *)skb_push(skb, 10); + snap->dsap = snap->ssap = 0xAA; + snap->ctrl = 0x03; + memcpy(snap->oui, oui_rfc1042, P80211_OUI_LEN); + + /* Add the VLAN specific information */ + snap->protocol = htons(proto); + *(u16*)(snap + 1) = vlan_snap; + + } else + { + /* it's DIXII, time for some conversion */ + unifi_trace(priv, UDBG3, "DIXII len: %d\n", skb->len); + + /* check for headroom availability before skb_push */ + if (headroom < sizeof(llc_snap_hdr_t)) { + unifi_trace(priv, UDBG3, "cant append snap: debug\n"); + return -1; + } + /* tack on SNAP */ + snap = (llc_snap_hdr_t *)skb_push(skb, sizeof(llc_snap_hdr_t)); + snap->dsap = snap->ssap = 0xAA; + snap->ctrl = 0x03; + /* Use the appropriate OUI. */ + if ((proto == ETH_P_AARP) || (proto == ETH_P_IPX)) { + memcpy(snap->oui, oui_8021h, P80211_OUI_LEN); + } else { + memcpy(snap->oui, oui_rfc1042, P80211_OUI_LEN); + } + snap->protocol = htons(proto); + } + + return 0; +} /* skb_add_llc_snap() */ + +#ifdef CSR_SUPPORT_SME +static int +_identify_sme_ma_pkt_ind(unifi_priv_t *priv, + const CsrInt8 *oui, CsrUint16 protocol, + const CSR_SIGNAL *signal, + bulk_data_param_t *bulkdata, + const unsigned char *daddr, + const unsigned char *saddr) +{ + CSR_MA_PACKET_INDICATION *pkt_ind = (CSR_MA_PACKET_INDICATION*)&signal->u.MaPacketIndication; + int r; + CsrUint8 i; + + unifi_trace(priv, UDBG5, + "_identify_sme_ma_pkt_ind -->\n"); + for (i = 0; i < MAX_MA_UNIDATA_IND_FILTERS; i++) { + if (priv->sme_unidata_ind_filters[i].in_use) { + if (!memcmp(oui, priv->sme_unidata_ind_filters[i].oui, 3) && + (protocol == priv->sme_unidata_ind_filters[i].protocol)) { + + /* Send to client */ + if (priv->sme_cli) { + /* + * Pass the packet to the SME, using unifi_sys_ma_unitdata_ind(). + * The frame needs to be converted according to the encapsulation. + */ + unifi_trace(priv, UDBG1, + "_identify_sme_ma_pkt_ind: handle=%d, encap=%d, proto=%x\n", + i, priv->sme_unidata_ind_filters[i].encapsulation, + priv->sme_unidata_ind_filters[i].protocol); + if (priv->sme_unidata_ind_filters[i].encapsulation == CSR_WIFI_ROUTER_ENCAPSULATION_ETHERNET) { + struct sk_buff *skb; + /* The translation is performed on skb... */ + skb = (struct sk_buff*)bulkdata->d[0].os_net_buf_ptr; + skb->len = bulkdata->d[0].data_length; + + unifi_trace(priv, UDBG1, + "_identify_sme_ma_pkt_ind: skb_80211_to_ether -->\n"); + r = skb_80211_to_ether(priv, skb, daddr, saddr, + signal, bulkdata); + unifi_trace(priv, UDBG1, + "_identify_sme_ma_pkt_ind: skb_80211_to_ether <--\n"); + if (r) { + return -EINVAL; + } + + /* ... but we indicate buffer and length */ + bulkdata->d[0].os_data_ptr = skb->data; + bulkdata->d[0].data_length = skb->len; + } else { + /* Add the MAC addresses before the SNAP */ + bulkdata->d[0].os_data_ptr -= 2*ETH_ALEN; + bulkdata->d[0].data_length += 2*ETH_ALEN; + memcpy((void*)bulkdata->d[0].os_data_ptr, daddr, ETH_ALEN); + memcpy((void*)bulkdata->d[0].os_data_ptr + ETH_ALEN, saddr, ETH_ALEN); + } + + unifi_trace(priv, UDBG1, + "_identify_sme_ma_pkt_ind: unifi_sys_ma_pkt_ind -->\n"); + CsrWifiRouterMaPacketIndSend(priv->sme_unidata_ind_filters[i].appHandle, + (pkt_ind->VirtualInterfaceIdentifier & 0xff), + i, + pkt_ind->ReceptionStatus, + bulkdata->d[0].data_length, + (CsrUint8*)bulkdata->d[0].os_data_ptr, + NULL, + pkt_ind->Rssi, + pkt_ind->Snr, + pkt_ind->ReceivedRate); + + + unifi_trace(priv, UDBG1, + "_identify_sme_ma_pkt_ind: unifi_sys_ma_pkt_ind <--\n"); + } + + return 1; + } + } + } + + return -1; +} +#endif /* CSR_SUPPORT_SME */ + +/* + * --------------------------------------------------------------------------- + * skb_80211_to_ether + * + * Make sure the received frame is in Ethernet (802.3) form. + * De-encapsulates SNAP if necessary, adds a ethernet header. + * The source buffer should not contain an 802.11 MAC header + * + * Arguments: + * payload Pointer to packet data received from UniFi. + * payload_length Number of bytes of data received from UniFi. + * daddr Destination MAC address. + * saddr Source MAC address. + * + * Returns: + * 0 on success, -1 if the packet is bad and should be dropped, + * 1 if the packet was forwarded to the SME or AMP client. + * --------------------------------------------------------------------------- + */ +int +skb_80211_to_ether(unifi_priv_t *priv, struct sk_buff *skb, + const unsigned char *daddr, const unsigned char *saddr, + const CSR_SIGNAL *signal, + bulk_data_param_t *bulkdata) +{ + unsigned char *payload; + int payload_length; + struct ethhdr *eth; + llc_snap_hdr_t *snap; + int headroom; +#define UF_VLAN_LLC_HEADER_SIZE 18 + static const u8 vlan_inner_snap[] = { 0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00 }; +#if defined(CSR_NATIVE_SOFTMAC) && defined(CSR_SUPPORT_SME) + const CSR_MA_PACKET_INDICATION *pkt_ind = &signal->u.MaPacketIndication; +#endif + + if(skb== NULL || daddr == NULL || saddr == NULL){ + unifi_error(priv,"skb_80211_to_ether: PBC fail\n"); + return 1; + } + + payload = skb->data; + payload_length = skb->len; + + snap = (llc_snap_hdr_t *)payload; + eth = (struct ethhdr *)payload; + + /* get the skb headroom size */ + headroom = skb_headroom(skb); + + /* + * Test for the various encodings + */ + if ((payload_length >= sizeof(llc_snap_hdr_t)) && + (snap->dsap == 0xAA) && + (snap->ssap == 0xAA) && + (snap->ctrl == 0x03) && + (snap->oui[0] == 0) && + (snap->oui[1] == 0) && + ((snap->oui[2] == 0) || (snap->oui[2] == 0xF8))) + { + /* AppleTalk AARP (2) or IPX SNAP */ + if ((snap->oui[2] == 0) && + ((ntohs(snap->protocol) == ETH_P_AARP) || (ntohs(snap->protocol) == ETH_P_IPX))) + { + u16 len; + + unifi_trace(priv, UDBG3, "%s len: %d\n", + (ntohs(snap->protocol) == ETH_P_AARP) ? "ETH_P_AARP" : "ETH_P_IPX", + payload_length); + + /* check for headroom availability before skb_push */ + if (headroom < (2 * ETH_ALEN + 2)) { + unifi_warning(priv, "headroom not available to skb_push ether header\n"); + return -1; + } + + /* Add 802.3 header and leave full payload */ + len = htons(skb->len); + memcpy(skb_push(skb, 2), &len, 2); + memcpy(skb_push(skb, ETH_ALEN), saddr, ETH_ALEN); + memcpy(skb_push(skb, ETH_ALEN), daddr, ETH_ALEN); + + return 0; + } + /* VLAN-tagged IP */ + if ((snap->oui[2] == 0) && (ntohs(snap->protocol) == ETH_P_8021Q)) + { + /* + * The translation doesn't change the packet length, so is done in-place. + * + * Example header (from Std 802.11-2007 Annex M): + * AA-AA-03-00-00-00-81-00-87-65-AA-AA-03-00-00-00-08-06 + * -------SNAP-------p1-p1-ll-ll-------SNAP--------p2-p2 + * dd-dd-dd-dd-dd-dd-aa-aa-aa-aa-aa-aa-p1-p1-ll-ll-p2-p2 + * dd-dd-dd-dd-dd-dd-aa-aa-aa-aa-aa-aa-81-00-87-65-08-06 + */ + u16 vlan_snap; + + if (payload_length < UF_VLAN_LLC_HEADER_SIZE) { + unifi_warning(priv, "VLAN SNAP header too short: %d bytes\n", payload_length); + return -1; + } + + if (memcmp(payload + 10, vlan_inner_snap, 6)) { + unifi_warning(priv, "VLAN malformatted SNAP header.\n"); + return -1; + } + + unifi_trace(priv, UDBG3, "VLAN SNAP: %02x-%02x\n", payload[8], payload[9]); + unifi_trace(priv, UDBG3, "VLAN len: %d\n", payload_length); + + /* Create the 802.3 header */ + + vlan_snap = *((u16*)(payload + 8)); + + /* Create LLC header without byte-swapping */ + eth->h_proto = snap->protocol; + + memcpy(eth->h_dest, daddr, ETH_ALEN); + memcpy(eth->h_source, saddr, ETH_ALEN); + *(u16*)(eth + 1) = vlan_snap; + return 0; + } + + /* it's a SNAP + RFC1042 frame */ + unifi_trace(priv, UDBG3, "SNAP+RFC1042 len: %d\n", payload_length); + + /* chop SNAP+llc header from skb. */ + skb_pull(skb, sizeof(llc_snap_hdr_t)); + + /* Since skb_pull called above to chop snap+llc, no need to check for headroom + * availability before skb_push + */ + /* create 802.3 header at beginning of skb. */ + eth = (struct ethhdr *)skb_push(skb, ETH_HLEN); + memcpy(eth->h_dest, daddr, ETH_ALEN); + memcpy(eth->h_source, saddr, ETH_ALEN); + /* Copy protocol field without byte-swapping */ + eth->h_proto = snap->protocol; + } else { + u16 len; + + /* check for headroom availability before skb_push */ + if (headroom < (2 * ETH_ALEN + 2)) { + unifi_warning(priv, "headroom not available to skb_push ether header\n"); + return -1; + } + /* Add 802.3 header and leave full payload */ + len = htons(skb->len); + memcpy(skb_push(skb, 2), &len, 2); + memcpy(skb_push(skb, ETH_ALEN), saddr, ETH_ALEN); + memcpy(skb_push(skb, ETH_ALEN), daddr, ETH_ALEN); + + return 1; + } + + return 0; +} /* skb_80211_to_ether() */ + + +static CsrWifiRouterCtrlPortAction verify_port(unifi_priv_t *priv, unsigned char *address, int queue, CsrUint16 interfaceTag) +{ +#ifdef CSR_NATIVE_LINUX +#ifdef CSR_SUPPORT_WEXT + if (queue == UF_CONTROLLED_PORT_Q) { + return priv->wext_conf.block_controlled_port; + } else { + return CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN; + } +#else + return CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN; /* default to open for softmac dev */ +#endif +#else + return uf_sme_port_state(priv, address, queue, interfaceTag); +#endif +} + +/* + * --------------------------------------------------------------------------- + * prepare_and_add_macheader + * + * + * These functions adds mac header for packet from netdev + * to UniFi for transmission. + * EAP protocol packets are also appended with Mac header & + * sent using send_ma_pkt_request(). + * + * Arguments: + * priv Pointer to device private context struct + * skb Socket buffer containing data packet to transmit + * newSkb Socket buffer containing data packet + Mac header if no sufficient headroom in skb + * serviceClass to append QOS control header in Mac header + * bulkdata if newSkb allocated then bulkdata updated to send to unifi + * interfaceTag the interfaceID on which activity going on + * daddr destination address + * saddr source address + * protection protection bit set in framce control of mac header + * + * Returns: + * Zero on success or error code. + * --------------------------------------------------------------------------- + */ + +int prepare_and_add_macheader(unifi_priv_t *priv, struct sk_buff *skb, struct sk_buff *newSkb, + CSR_PRIORITY priority, + bulk_data_param_t *bulkdata, + CsrUint16 interfaceTag, + const CsrUint8 *daddr, + const CsrUint8 *saddr, + CsrBool protection) +{ + CsrUint16 fc = 0; + CsrUint8 qc = 0; + CsrUint8 macHeaderLengthInBytes = MAC_HEADER_SIZE, *bufPtr = NULL; + bulk_data_param_t data_ptrs; + CsrResult csrResult; + int headroom =0; + CsrUint8 direction = 0; + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + CsrUint8 *addressOne; + CsrBool bQosNull = false; + + if (skb == NULL) { + unifi_error(priv,"prepare_and_add_macheader: Invalid SKB reference\n"); + return -1; + } + + /* add a MAC header refer: 7.1.3.1 Frame Control field in P802.11REVmb.book */ + if (priority != CSR_CONTENTION) { + /* EAPOL packets don't go as QOS_DATA */ + if (priority == CSR_MANAGEMENT) { + fc |= cpu_to_le16(IEEE802_11_FC_TYPE_DATA); + } else { + /* Qos Control Field */ + macHeaderLengthInBytes += QOS_CONTROL_HEADER_SIZE; + + if (skb->len) { + + fc |= cpu_to_le16(IEEE802_11_FC_TYPE_QOS_DATA); + } else { + fc |= cpu_to_le16(IEEE802_11_FC_TYPE_QOS_NULL); + bQosNull = true; + } + } + } else { + if(skb->len == 0) { + fc |= cpu_to_le16(IEEE802_11_FC_TYPE_NULL); + } else { + fc |= cpu_to_le16(IEEE802_11_FC_TYPE_DATA); + } + } + + switch (interfacePriv->interfaceMode) + { + case CSR_WIFI_ROUTER_CTRL_MODE_STA: + case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI: + direction = 2; + fc |= cpu_to_le16(IEEE802_11_FC_TO_DS_MASK); + break; + case CSR_WIFI_ROUTER_CTRL_MODE_IBSS: + direction = 0; + break; + case CSR_WIFI_ROUTER_CTRL_MODE_AP: + case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: + direction = 1; + fc |= cpu_to_le16(IEEE802_11_FC_FROM_DS_MASK); + break; + case CSR_WIFI_ROUTER_CTRL_MODE_AMP: + if (priority == CSR_MANAGEMENT ) { + + direction = 2; + fc |= cpu_to_le16(IEEE802_11_FC_TO_DS_MASK); + } else { + /* Data frames have to use WDS 4 address frames */ + direction = 3; + fc |= cpu_to_le16(IEEE802_11_FC_TO_DS_MASK | IEEE802_11_FC_FROM_DS_MASK); + macHeaderLengthInBytes += 6; + } + break; + default: + unifi_warning(priv, "prepare_and_add_macheader: Unknown mode %d\n", + interfacePriv->interfaceMode); + } + + + /* If Sta is QOS & HTC is supported then need to set 'order' bit */ + /* We don't support HT Control for now */ + + if(protection) { + fc |= cpu_to_le16(IEEE802_11_FC_PROTECTED_MASK); + } + + /* check the skb headroom before pushing mac header */ + headroom = skb_headroom(skb); + + if (headroom < macHeaderLengthInBytes) { + unifi_trace(priv, UDBG5, + "prepare_and_add_macheader: Allocate headroom extra %d bytes\n", + macHeaderLengthInBytes); + + csrResult = unifi_net_data_malloc(priv, &data_ptrs.d[0], skb->len + macHeaderLengthInBytes); + + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, " failed to allocate request_data. in %s func\n", __FUNCTION__); + return -1; + } + newSkb = (struct sk_buff *)(data_ptrs.d[0].os_net_buf_ptr); + newSkb->len = skb->len + macHeaderLengthInBytes; + + memcpy((void*)data_ptrs.d[0].os_data_ptr + macHeaderLengthInBytes, + skb->data, skb->len); + + bulkdata->d[0].os_data_ptr = newSkb->data; + bulkdata->d[0].os_net_buf_ptr = (unsigned char*)newSkb; + bulkdata->d[0].data_length = newSkb->len; + + bufPtr = (CsrUint8*)data_ptrs.d[0].os_data_ptr; + + /* The old skb will not be used again */ + kfree_skb(skb); + } else { + + /* headroom has sufficient size, so will get proper pointer */ + bufPtr = (CsrUint8*)skb_push(skb, macHeaderLengthInBytes); + bulkdata->d[0].os_data_ptr = skb->data; + bulkdata->d[0].os_net_buf_ptr = (unsigned char*)skb; + bulkdata->d[0].data_length = skb->len; + } + + /* Frame the actual MAC header */ + + memset(bufPtr, 0, macHeaderLengthInBytes); + + /* copy frameControl field */ + memcpy(bufPtr, &fc, sizeof(fc)); + bufPtr += sizeof(fc); + macHeaderLengthInBytes -= sizeof(fc); + + /* Duration/ID field which is 2 bytes */ + bufPtr += 2; + macHeaderLengthInBytes -= 2; + + switch(direction) + { + case 0: + /* Its an Ad-Hoc no need to route it through AP */ + /* Address1: MAC address of the destination from eth header */ + memcpy(bufPtr, daddr, ETH_ALEN); + bufPtr += ETH_ALEN; + macHeaderLengthInBytes -= ETH_ALEN; + + /* Address2: MAC address of the source */ + memcpy(bufPtr, saddr, ETH_ALEN); + bufPtr += ETH_ALEN; + macHeaderLengthInBytes -= ETH_ALEN; + + /* Address3: the BSSID (locally generated in AdHoc (creators Bssid)) */ + memcpy(bufPtr, &interfacePriv->bssid, ETH_ALEN); + bufPtr += ETH_ALEN; + macHeaderLengthInBytes -= ETH_ALEN; + break; + case 1: + /* Address1: MAC address of the actual destination */ + memcpy(bufPtr, daddr, ETH_ALEN); + bufPtr += ETH_ALEN; + macHeaderLengthInBytes -= ETH_ALEN; + /* Address2: The MAC address of the AP */ + memcpy(bufPtr, &interfacePriv->bssid, ETH_ALEN); + bufPtr += ETH_ALEN; + macHeaderLengthInBytes -= ETH_ALEN; + + /* Address3: MAC address of the source from eth header */ + memcpy(bufPtr, saddr, ETH_ALEN); + bufPtr += ETH_ALEN; + macHeaderLengthInBytes -= ETH_ALEN; + break; + case 2: + /* Address1: To AP is the MAC address of the AP to which its associated */ + memcpy(bufPtr, &interfacePriv->bssid, ETH_ALEN); + bufPtr += ETH_ALEN; + macHeaderLengthInBytes -= ETH_ALEN; + + /* Address2: MAC address of the source from eth header */ + memcpy(bufPtr, saddr, ETH_ALEN); + bufPtr += ETH_ALEN; + macHeaderLengthInBytes -= ETH_ALEN; + + /* Address3: MAC address of the actual destination on the distribution system */ + memcpy(bufPtr, daddr, ETH_ALEN); + bufPtr += ETH_ALEN; + macHeaderLengthInBytes -= ETH_ALEN; + break; + case 3: + memcpy(bufPtr, &interfacePriv->bssid, ETH_ALEN); + bufPtr += ETH_ALEN; + macHeaderLengthInBytes -= ETH_ALEN; + + /* Address2: MAC address of the source from eth header */ + memcpy(bufPtr, saddr, ETH_ALEN); + bufPtr += ETH_ALEN; + macHeaderLengthInBytes -= ETH_ALEN; + + /* Address3: MAC address of the actual destination on the distribution system */ + memcpy(bufPtr, daddr, ETH_ALEN); + bufPtr += ETH_ALEN; + macHeaderLengthInBytes -= ETH_ALEN; + break; + default: + unifi_error(priv,"Unknown direction =%d : Not handled now\n",direction); + return -1; + } + /* 2 bytes of frame control field, appended by firmware */ + bufPtr += 2; + macHeaderLengthInBytes -= 2; + + if (3 == direction) { + /* Address4: MAC address of the source */ + memcpy(bufPtr, saddr, ETH_ALEN); + bufPtr += ETH_ALEN; + macHeaderLengthInBytes -= ETH_ALEN; + } + + /* IF Qos Data or Qos Null Data then set QosControl field */ + if ((priority != CSR_CONTENTION) && (macHeaderLengthInBytes >= QOS_CONTROL_HEADER_SIZE)) { + + if (priority >= 7) { + unifi_trace(priv, UDBG1, "data packets priority is more than 7, priority = %x\n", priority); + qc |= 7; + } else { + qc |= priority; + } + /*assigning address1 + * Address1 offset taken fromm bufPtr(currently bufPtr pointing to Qos contorl) variable in reverse direction + * Address4 don't exit + */ + + addressOne = bufPtr- ADDRESS_ONE_OFFSET; + + if (addressOne[0] & 0x1) { + /* multicast/broadcast frames, no acknowledgement needed */ + qc |= 1 << 5; + } + /* non-AP mode only for now */ + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_STA || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_IBSS || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI) { + /* In case of STA and IBSS case eosp and txop limit is 0. */ + } else { + if(bQosNull) { + qc |= 1 << 4; + } + } + + /* append Qos control field to mac header */ + bufPtr[0] = qc; + /* txop limit is 0 */ + bufPtr[1] = 0; + macHeaderLengthInBytes -= QOS_CONTROL_HEADER_SIZE; + } + if (macHeaderLengthInBytes) { + unifi_warning(priv, " Mac header not appended properly\n"); + return -1; + } + return 0; +} + +/* + * --------------------------------------------------------------------------- + * send_ma_pkt_request + * + * These functions send a data packet to UniFi for transmission. + * EAP protocol packets are also sent as send_ma_pkt_request(). + * + * Arguments: + * priv Pointer to device private context struct + * skb Socket buffer containing data packet to transmit + * ehdr Pointer to Ethernet header within skb. + * + * Returns: + * Zero on success or error code. + * --------------------------------------------------------------------------- + */ + +static int +send_ma_pkt_request(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr *ehdr, CSR_PRIORITY priority) +{ + int r; + CsrUint16 i; + CsrBool eapolStore = FALSE; + struct sk_buff *newSkb = NULL; + bulk_data_param_t bulkdata; + const int proto = ntohs(ehdr->h_proto); + CsrUint16 interfaceTag; + CsrWifiMacAddress peerAddress; + CSR_TRANSMISSION_CONTROL transmissionControl = CSR_NO_CONFIRM_REQUIRED; + CsrInt8 protection; + netInterface_priv_t *interfacePriv = NULL; + + unifi_trace(priv, UDBG5, "entering send_ma_pkt_request\n"); + + /* Get the interface Tag by means of source Mac address */ + for (i = 0; i < CSR_WIFI_NUM_INTERFACES; i++) { + if (!memcmp(priv->netdev[i]->dev_addr, ehdr->h_source, ETH_ALEN)) { + interfaceTag = i; + interfacePriv = priv->interfacePriv[interfaceTag]; + break; + } + } + + if (interfacePriv == NULL) { + /* No match found - error */ + interfaceTag = 0; + interfacePriv = priv->interfacePriv[interfaceTag]; + unifi_warning(priv, "Mac address not matching ... debugging needed\n"); + interfacePriv->stats.tx_dropped++; + kfree_skb(skb); + return -1; + } + + /* Add a SNAP header if necessary */ + if (skb_add_llc_snap(priv->netdev[interfaceTag], skb, proto) != 0) { + /* convert failed */ + unifi_error(priv, "skb_add_llc_snap failed.\n"); + kfree_skb(skb); + return -1; + } + + bulkdata.d[0].os_data_ptr = skb->data; + bulkdata.d[0].os_net_buf_ptr = (unsigned char*)skb; + bulkdata.d[0].net_buf_length = bulkdata.d[0].data_length = skb->len; + bulkdata.d[1].os_data_ptr = NULL; + bulkdata.d[1].os_net_buf_ptr = NULL; + bulkdata.d[1].net_buf_length = bulkdata.d[1].data_length = 0; + +#ifdef CSR_SUPPORT_SME + /* Notify the TA module for the Tx frame for non AP/P2PGO mode*/ + if ((interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_AP) && + (interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_P2PGO)) { + unifi_ta_sample(priv->card, CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX, + &bulkdata.d[0], ehdr->h_source, + priv->netdev[interfaceTag]->dev_addr, + jiffies_to_msecs(jiffies), + 0); /* rate is unknown on tx */ + } +#endif /* CSR_SUPPORT_SME */ + + if ((proto == ETH_P_PAE) +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + || (proto == ETH_P_WAI) +#endif + ) + { + /* check for m4 detection */ + if (0 == uf_verify_m4(priv, bulkdata.d[0].os_data_ptr, bulkdata.d[0].data_length)) { + eapolStore = TRUE; + } + } + +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + if (proto == ETH_P_WAI) + { + protection = 0; /*WAI packets always sent unencrypted*/ + } + else + { +#endif +#ifdef CSR_SUPPORT_SME + if ((protection = uf_get_protection_bit_from_interfacemode(priv, interfaceTag, ehdr->h_dest)) < 0) { + unifi_warning(priv, "unicast address, but destination not in station record database\n"); + unifi_net_data_free(priv, &bulkdata.d[0]); + return -1; + } +#else + protection = 0; +#endif +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + } +#endif + + /* append Mac header for Eapol as well as data packet */ + if (prepare_and_add_macheader(priv, skb, newSkb, priority, &bulkdata, interfaceTag, ehdr->h_dest, ehdr->h_source, protection)) { + unifi_error(priv, "failed to create MAC header\n"); + unifi_net_data_free(priv, &bulkdata.d[0]); + return -1; + } + + /* RA adrress must contain the immediate destination MAC address that is similiar to + * the Address 1 field of 802.11 Mac header here 4 is: (sizeof(framecontrol) + sizeof (durationID)) + * which is address 1 field + */ + memcpy(peerAddress.a, ((CsrUint8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN); + + unifi_trace(priv, UDBG5, "RA[0]=%x, RA[1]=%x, RA[2]=%x, RA[3]=%x, RA[4]=%x, RA[5]=%x\n", + peerAddress.a[0],peerAddress.a[1], peerAddress.a[2], peerAddress.a[3], + peerAddress.a[4],peerAddress.a[5]); + + + if ((proto == ETH_P_PAE) +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + || (proto == ETH_P_WAI) +#endif + ) + { + CSR_SIGNAL signal; + CSR_MA_PACKET_REQUEST *req = &signal.u.MaPacketRequest; + + /* initialize signal to zero */ + memset(&signal, 0, sizeof(CSR_SIGNAL)); + + /* Frame MA_PACKET request */ + signal.SignalPrimitiveHeader.SignalId = CSR_MA_PACKET_REQUEST_ID; + signal.SignalPrimitiveHeader.ReceiverProcessId = 0; + signal.SignalPrimitiveHeader.SenderProcessId = priv->netdev_client->sender_id; + + transmissionControl = req->TransmissionControl = 0; +#ifdef CSR_SUPPORT_SME + if (eapolStore) + { + netInterface_priv_t *netpriv = (netInterface_priv_t *)netdev_priv(priv->netdev[interfaceTag]); + + /* Fill the MA-PACKET.req */ + + req->Priority = priority; + unifi_trace(priv, UDBG3, "Tx Frame with Priority: %x\n", req->Priority); + + /* rate selected by firmware */ + req->TransmitRate = 0; + req->HostTag = CSR_WIFI_EAPOL_M4_HOST_TAG; + /* RA address matching with address 1 of Mac header */ + memcpy(req->Ra.x, ((CsrUint8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN); + + spin_lock(&priv->m4_lock); + /* Store the M4-PACKET.req for later */ + interfacePriv->m4_signal = signal; + interfacePriv->m4_bulk_data.net_buf_length = bulkdata.d[0].net_buf_length; + interfacePriv->m4_bulk_data.data_length = bulkdata.d[0].data_length; + interfacePriv->m4_bulk_data.os_data_ptr = bulkdata.d[0].os_data_ptr; + interfacePriv->m4_bulk_data.os_net_buf_ptr = bulkdata.d[0].os_net_buf_ptr; + spin_unlock(&priv->m4_lock); + + /* Signal the workqueue to call CsrWifiRouterCtrlM4ReadyToSendIndSend(). + * It cannot be called directly from the tx path because it + * does a non-atomic kmalloc via the framework's CsrPmemAlloc(). + */ + queue_work(priv->unifi_workqueue, &netpriv->send_m4_ready_task); + + return 0; + } +#endif + } + + /* Send UniFi msg */ + /* Here hostTag is been sent as 0xffffffff, its been appended properly while framing MA-Packet request in pdu_processing.c file */ + r = uf_process_ma_packet_req(priv, + peerAddress.a, + 0xffffffff, /* Ask for a new HostTag */ + interfaceTag, + transmissionControl, + (CSR_RATE)0, + priority, + priv->netdev_client->sender_id, + &bulkdata); + + if (r) { + unifi_trace(priv, UDBG1, "(HIP validation failure) r = %x\n", r); + unifi_net_data_free(priv, &bulkdata.d[0]); + return -1; + } + + unifi_trace(priv, UDBG3, "leaving send_ma_pkt_request, UNITDATA result code = %d\n", r); + + return r; +} /* send_ma_pkt_request() */ + +/* + * --------------------------------------------------------------------------- + * uf_net_xmit + * + * This function is called by the higher level stack to transmit an + * ethernet packet. + * + * Arguments: + * skb Ethernet packet to send. + * dev Pointer to the linux net device. + * + * Returns: + * 0 on success (packet was consumed, not necessarily transmitted) + * 1 if packet was requeued + * -1 on error + * + * + * Notes: + * The controlled port is handled in the qdisc dequeue handler. + * --------------------------------------------------------------------------- + */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) +static netdev_tx_t +#else +static int +#endif +uf_net_xmit(struct sk_buff *skb, struct net_device *dev) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + struct ethhdr ehdr; + int proto, port; + int result; + static tx_signal_handler tx_handler; + CSR_PRIORITY priority; +#if !defined (CONFIG_NET_SCHED) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) + CsrWifiRouterCtrlPortAction port_action; +#endif /* CONFIG_NET_SCHED */ + + func_enter(); + + unifi_trace(priv, UDBG5, "unifi_net_xmit: skb = %x\n", skb); + + memcpy(&ehdr, skb->data, ETH_HLEN); + proto = ntohs(ehdr.h_proto); + priority = get_packet_priority(priv, skb, &ehdr, interfacePriv); + + /* All frames are sent as MA-PACKET.req (EAPOL also) */ + tx_handler = send_ma_pkt_request; + + /* 802.1x - apply controlled/uncontrolled port rules */ + if ((proto != ETH_P_PAE) +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + && (proto != ETH_P_WAI) +#endif + ) { + port = UF_CONTROLLED_PORT_Q; + } else { + /* queue 4 */ + port = UF_UNCONTROLLED_PORT_Q; + } + +#if defined (CONFIG_NET_SCHED) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) + /* Remove the ethernet header */ + skb_pull(skb, ETH_HLEN); + result = tx_handler(priv, skb, &ehdr, priority); +#else + /* Uncontrolled port rules apply */ + port_action = verify_port(priv + , (((CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode)||(CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI== interfacePriv->interfaceMode))? interfacePriv->bssid.a: ehdr.h_dest) + , port + , interfacePriv->InterfaceTag); + + if (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN) { + unifi_trace(priv, UDBG5, + "uf_net_xmit: %s controlled port open\n", + port ? "" : "un"); + /* Remove the ethernet header */ + skb_pull(skb, ETH_HLEN); + result = tx_handler(priv, skb, &ehdr, priority); + } else { + + /* Discard the packet if necessary */ + unifi_trace(priv, UDBG2, + "uf_net_xmit: %s controlled port %s\n", + port ? "" : "un", port_action==CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_BLOCK ? "blocked" : "closed"); + interfacePriv->stats.tx_dropped++; + kfree_skb(skb); + + func_exit(); + return NETDEV_TX_OK; + } +#endif /* CONFIG_NET_SCHED */ + + if (result == NETDEV_TX_OK) { + + dev->trans_start = jiffies; + + /* + * Should really count tx stats in the UNITDATA.status signal but + * that doesn't have the length. + */ + interfacePriv->stats.tx_packets++; + /* count only the packet payload */ + interfacePriv->stats.tx_bytes += skb->len; + + } else if (result < 0) { + + /* Failed to send: fh queue was full, and the skb was discarded. + * Return OK to indicate that the buffer was consumed, to stop the + * kernel re-transmitting the freed buffer. + */ + interfacePriv->stats.tx_dropped++; + unifi_trace(priv, UDBG1, "unifi_net_xmit: (Packet Drop), dropped count = %x\n", interfacePriv->stats.tx_dropped); + result = NETDEV_TX_OK; + } + + /* The skb will have been freed by send_XXX_request() */ + + func_exit(); + return result; +} /* uf_net_xmit() */ + +/* + * --------------------------------------------------------------------------- + * unifi_pause_xmit + * unifi_restart_xmit + * + * These functions are called from the UniFi core to control the flow + * of packets from the upper layers. + * unifi_pause_xmit() is called when the internal queue is full and + * should take action to stop unifi_ma_unitdata() being called. + * When the queue has drained, unifi_restart_xmit() will be called to + * re-enable the flow of packets for transmission. + * + * Arguments: + * ospriv OS private context pointer. + * + * Returns: + * unifi_pause_xmit() is called from interrupt context. + * --------------------------------------------------------------------------- + */ +void +unifi_pause_xmit(void *ospriv, unifi_TrafficQueue queue) +{ + unifi_priv_t *priv = ospriv; + int i; /* used as a loop counter */ + + func_enter(); + unifi_trace(priv, UDBG2, "Stopping queue %d\n", queue); + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) + for(i=0;inetdev[i])) + { + netif_stop_subqueue(priv->netdev[i], (u16)queue); + } + } +#else +#ifdef ALLOW_Q_PAUSE + unifi_trace(priv, UDBG2, "Stopping netif\n"); + /* stop the traffic from all the interfaces. */ + for(i=0;inetdev[i])) { + UF_NETIF_TX_STOP_ALL_QUEUES(priv->netdev[i]); + } + } +#else + if (net_is_tx_q_paused(priv, queue)) { + unifi_trace(priv, UDBG2, "Queue already stopped\n"); + return; + } + net_tx_q_pause(priv, queue); +#endif +#endif + +#ifdef CSR_SUPPORT_SME + if(queue<=3) { + routerStartBuffering(priv,queue); + unifi_trace(priv,UDBG2,"Start buffering %d\n", queue); + } else { + routerStartBuffering(priv,0); + unifi_error(priv, "Start buffering %d defaulting to 0\n", queue); + } +#endif + func_exit(); + +} /* unifi_pause_xmit() */ + +void +unifi_restart_xmit(void *ospriv, unifi_TrafficQueue queue) +{ + unifi_priv_t *priv = ospriv; + int i=0; /* used as a loop counter */ + + func_enter(); + unifi_trace(priv, UDBG2, "Waking queue %d\n", queue); + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) + for(i=0;inetdev[i])) + { + netif_wake_subqueue(priv->netdev[i], (u16)queue); + } + } +#else +#ifdef ALLOW_Q_PAUSE + /* Need to supply queue number depending on Kernel support */ + /* Resume the traffic from all the interfaces */ + for(i=0;inetdev[i])) { + UF_NETIF_TX_WAKE_ALL_QUEUES(priv->netdev[i]); + } + } +#else + if (!(net_is_tx_q_paused(priv, queue))) { + unifi_trace(priv, UDBG2, "Queue already running\n"); + func_exit(); + return; + } + net_tx_q_unpause(priv, queue); +#endif +#endif + +#ifdef CSR_SUPPORT_SME + if(queue <=3) { + routerStopBuffering(priv,queue); + uf_send_buffered_frames(priv,queue); + } else { + routerStopBuffering(priv,0); + uf_send_buffered_frames(priv,0); + } +#endif + func_exit(); +} /* unifi_restart_xmit() */ + + +static void +indicate_rx_skb(unifi_priv_t *priv, CsrUint16 ifTag, CsrUint8* dst_a, CsrUint8* src_a, struct sk_buff *skb, CSR_SIGNAL *signal, + bulk_data_param_t *bulkdata) +{ + int r, sr = 0; + struct net_device *dev; + +#ifdef CSR_SUPPORT_SME + llc_snap_hdr_t *snap; + + snap = (llc_snap_hdr_t *)skb->data; + + sr = _identify_sme_ma_pkt_ind(priv, + snap->oui, ntohs(snap->protocol), + signal, + bulkdata, + dst_a, src_a ); +#endif + + /* + * Decapsulate any SNAP header and + * prepend an ethernet header so that the skb manipulation and ARP + * stuff works. + */ + r = skb_80211_to_ether(priv, skb, dst_a, src_a, + signal, bulkdata); + if (r == -1) { + /* Drop the packet and return */ + priv->interfacePriv[ifTag]->stats.rx_errors++; + priv->interfacePriv[ifTag]->stats.rx_frame_errors++; + unifi_net_data_free(priv, &bulkdata->d[0]); + unifi_notice(priv, "indicate_rx_skb: Discard unknown frame.\n"); + func_exit(); + return; + } + + /* Handle the case where packet is sent up through the subscription + * API but should not be given to the network stack (AMP PAL case) + * LLC header is different from WiFi and the packet has been subscribed for + */ + if (r == 1 && sr == 1) { + unifi_net_data_free(priv, &bulkdata->d[0]); + unifi_trace(priv, UDBG5, "indicate_rx_skb: Data given to subscription" + "API, not being given to kernel\n"); + func_exit(); + return; + } + + dev = priv->netdev[ifTag]; + /* Now we look like a regular ethernet frame */ + /* Fill in SKB meta data */ + skb->dev = dev; + skb->protocol = eth_type_trans(skb, dev); + skb->ip_summed = CHECKSUM_UNNECESSARY; + + /* Test for an overlength frame */ + if (skb->len > (dev->mtu + ETH_HLEN)) { + /* A bogus length ethfrm has been encap'd. */ + /* Is someone trying an oflow attack? */ + unifi_error(priv, "%s: oversize frame (%d > %d)\n", + dev->name, + skb->len, dev->mtu + ETH_HLEN); + + /* Drop the packet and return */ + priv->interfacePriv[ifTag]->stats.rx_errors++; + priv->interfacePriv[ifTag]->stats.rx_length_errors++; + unifi_net_data_free(priv, &bulkdata->d[0]); + func_exit(); + return; + } + + + /* Pass SKB up the stack */ +#ifdef CSR_WIFI_USE_NETIF_RX + netif_rx(skb); +#else + netif_rx_ni(skb); +#endif + + if (dev != NULL) { + dev->last_rx = jiffies; + } + + /* Bump rx stats */ + priv->interfacePriv[ifTag]->stats.rx_packets++; + priv->interfacePriv[ifTag]->stats.rx_bytes += bulkdata->d[0].data_length; + + func_exit(); + return; +} + +void +uf_process_rx_pending_queue(unifi_priv_t *priv, int queue, + CsrWifiMacAddress source_address, + int indicate, CsrUint16 interfaceTag) +{ + rx_buffered_packets_t *rx_q_item; + struct list_head *rx_list; + struct list_head *n; + struct list_head *l_h; + static const CsrWifiMacAddress broadcast_address = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}}; + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "uf_process_rx_pending_queue bad interfaceTag\n"); + return; + } + + if (queue == UF_CONTROLLED_PORT_Q) { + rx_list = &interfacePriv->rx_controlled_list; + } else { + rx_list = &interfacePriv->rx_uncontrolled_list; + } + + down(&priv->rx_q_sem); + list_for_each_safe(l_h, n, rx_list) { + rx_q_item = list_entry(l_h, rx_buffered_packets_t, q); + + /* Validate against the source address */ + if (memcmp(broadcast_address.a, source_address.a, ETH_ALEN) && + memcmp(rx_q_item->sa.a, source_address.a, ETH_ALEN)) { + + unifi_trace(priv, UDBG2, + "uf_process_rx_pending_queue: Skipping sa=%02X%02X%02X%02X%02X%02X skb=%p, bulkdata=%p\n", + rx_q_item->sa.a[0], rx_q_item->sa.a[1], + rx_q_item->sa.a[2], rx_q_item->sa.a[3], + rx_q_item->sa.a[4], rx_q_item->sa.a[5], + rx_q_item->skb, &rx_q_item->bulkdata.d[0]); + continue; + } + + list_del(l_h); + + + unifi_trace(priv, UDBG2, + "uf_process_rx_pending_queue: Was Blocked skb=%p, bulkdata=%p\n", + rx_q_item->skb, &rx_q_item->bulkdata); + + if (indicate) { + indicate_rx_skb(priv, interfaceTag, rx_q_item->da.a, rx_q_item->sa.a, rx_q_item->skb, &rx_q_item->signal, &rx_q_item->bulkdata); + } else { + interfacePriv->stats.rx_dropped++; + unifi_net_data_free(priv, &rx_q_item->bulkdata.d[0]); + } + + /* It is our resposibility to free the Rx structure object. */ + kfree(rx_q_item); + } + up(&priv->rx_q_sem); +} + +/* + * --------------------------------------------------------------------------- + * uf_resume_data_plane + * + * Is called when the (un)controlled port is set to open, + * to notify the network stack to schedule for transmission + * any packets queued in the qdisk while port was closed and + * indicated to the stack any packets buffered in the Rx queues. + * + * Arguments: + * priv Pointer to device private struct + * + * Returns: + * --------------------------------------------------------------------------- + */ +void +uf_resume_data_plane(unifi_priv_t *priv, int queue, + CsrWifiMacAddress peer_address, + CsrUint16 interfaceTag) +{ +#ifdef CSR_SUPPORT_WEXT + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; +#endif + + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "uf_resume_data_plane bad interfaceTag\n"); + return; + } + + unifi_trace(priv, UDBG2, "Resuming netif\n"); + + /* + * If we are waiting for the net device to enter the up state, don't + * process the rx queue yet as it will be done by the callback when + * the device is ready. + */ +#ifdef CSR_SUPPORT_WEXT + if (!interfacePriv->wait_netdev_change) +#endif + { +#ifdef CONFIG_NET_SCHED + if (netif_running(priv->netdev[interfaceTag])) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) + netif_tx_schedule_all(priv->netdev[interfaceTag]); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + netif_schedule_queue(netdev_get_tx_queue(priv->netdev[interfaceTag], 0)); +#else + netif_schedule(priv->netdev[interfaceTag]); +#endif /* LINUX_VERSION_CODE */ + } +#endif + uf_process_rx_pending_queue(priv, queue, peer_address, 1,interfaceTag); + } +} /* uf_resume_data_plane() */ + + +void uf_free_pending_rx_packets(unifi_priv_t *priv, int queue, CsrWifiMacAddress peer_address,CsrUint16 interfaceTag) +{ + uf_process_rx_pending_queue(priv, queue, peer_address, 0,interfaceTag); + +} /* uf_free_pending_rx_packets() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_rx + * + * Reformat a UniFi data received packet into a p80211 packet and + * pass it up the protocol stack. + * + * Arguments: + * None. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +static void +unifi_rx(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata) +{ + CsrUint16 interfaceTag; + bulk_data_desc_t *pData; + const CSR_MA_PACKET_INDICATION *pkt_ind = &signal->u.MaPacketIndication; + struct sk_buff *skb; + CsrWifiRouterCtrlPortAction port_action; + CsrUint8 dataFrameType; + int proto; + int queue; + + CsrUint8 da[ETH_ALEN], sa[ETH_ALEN]; + CsrUint8 toDs, fromDs, frameType, macHeaderLengthInBytes = MAC_HEADER_SIZE; + CsrUint16 frameControl; + netInterface_priv_t *interfacePriv; + struct ethhdr ehdr; + + func_enter(); + + interfaceTag = (pkt_ind->VirtualInterfaceIdentifier & 0xff); + interfacePriv = priv->interfacePriv[interfaceTag]; + + /* Sanity check that the VIF refers to a sensible interface */ + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) + { + unifi_error(priv, "%s: MA-PACKET indication with bad interfaceTag %d\n", __FUNCTION__, interfaceTag); + unifi_net_data_free(priv,&bulkdata->d[0]); + func_exit(); + return; + } + + /* Sanity check that the VIF refers to an allocated netdev */ + if (!interfacePriv->netdev_registered) + { + unifi_error(priv, "%s: MA-PACKET indication with unallocated interfaceTag %d\n", __FUNCTION__, interfaceTag); + unifi_net_data_free(priv, &bulkdata->d[0]); + func_exit(); + return; + } + + if (bulkdata->d[0].data_length == 0) { + unifi_warning(priv, "%s: MA-PACKET indication with zero bulk data\n", __FUNCTION__); + unifi_net_data_free(priv,&bulkdata->d[0]); + func_exit(); + return; + } + + + skb = (struct sk_buff*)bulkdata->d[0].os_net_buf_ptr; + skb->len = bulkdata->d[0].data_length; + + /* Point to the addresses */ + toDs = (skb->data[1] & 0x01) ? 1 : 0; + fromDs = (skb->data[1] & 0x02) ? 1 : 0; + + memcpy(da,(skb->data+4+toDs*12),ETH_ALEN);/* Address1 or 3 */ + memcpy(sa,(skb->data+10+fromDs*(6+toDs*8)),ETH_ALEN); /* Address2, 3 or 4 */ + + + pData = &bulkdata->d[0]; + frameControl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(pData->os_data_ptr); + frameType = ((frameControl & 0x000C) >> 2); + + dataFrameType =((frameControl & 0x00f0) >> 4); + unifi_trace(priv, UDBG6, + "%s: Receive Data Frame Type %d \n", __FUNCTION__,dataFrameType); + + switch(dataFrameType) + { + case QOS_DATA: + case QOS_DATA_NULL: + /* If both are set then the Address4 exists (only for AP) */ + if (fromDs && toDs) + { + /* 6 is the size of Address4 field */ + macHeaderLengthInBytes += (QOS_CONTROL_HEADER_SIZE + 6); + } + else + { + macHeaderLengthInBytes += QOS_CONTROL_HEADER_SIZE; + } + + /* If order bit set then HT control field is the part of MAC header */ + if (frameControl & FRAME_CONTROL_ORDER_BIT) + macHeaderLengthInBytes += HT_CONTROL_HEADER_SIZE; + break; + default: + if (fromDs && toDs) + macHeaderLengthInBytes += 6; + } + + /* Prepare the ethernet header from snap header of skb data */ + switch(dataFrameType) + { + case DATA_NULL: + case QOS_DATA_NULL: + /* This is for only queue info fetching, EAPOL wont come as + * null data so the proto is initialized as zero + */ + proto = 0x0; + break; + default: + { + llc_snap_hdr_t *snap; + /* Fetch a snap header to find protocol (for IPV4/IPV6 packets + * the snap header fetching offset is same) + */ + snap = (llc_snap_hdr_t *) (skb->data + macHeaderLengthInBytes); + + /* prepare the ethernet header from the snap header & addresses */ + ehdr.h_proto = snap->protocol; + memcpy(ehdr.h_dest, da, ETH_ALEN); + memcpy(ehdr.h_source, sa, ETH_ALEN); + } + proto = ntohs(ehdr.h_proto); + } + unifi_trace(priv, UDBG3, "in unifi_rx protocol from snap header = 0x%x\n", proto); + + if ((proto != ETH_P_PAE) +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + && (proto != ETH_P_WAI) +#endif + ) { + queue = UF_CONTROLLED_PORT_Q; + } else { + queue = UF_UNCONTROLLED_PORT_Q; + } + + port_action = verify_port(priv, (unsigned char*)sa, queue, interfaceTag); + unifi_trace(priv, UDBG3, "in unifi_rx port action is = 0x%x & queue = %x\n", port_action, queue); + +#ifdef CSR_SUPPORT_SME + /* Notify the TA module for the Rx frame for non P2PGO and AP cases*/ + if((interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_AP) && + (interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_P2PGO)) + { + /* Remove MAC header of length(macHeaderLengthInBytes) before sampling */ + skb_pull(skb, macHeaderLengthInBytes); + pData->os_data_ptr = skb->data; + pData->data_length -= macHeaderLengthInBytes; + + if (pData->data_length) { + unifi_ta_sample(priv->card, CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_RX, + &bulkdata->d[0], + sa, priv->netdev[interfaceTag]->dev_addr, + jiffies_to_msecs(jiffies), + pkt_ind->ReceivedRate); + } + } else { + + /* AP/P2PGO specific handling here */ + CsrWifiRouterCtrlStaInfo_t * srcStaInfo = + CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv,sa,interfaceTag); + + /* Defensive check only; Source address is already checked in + process_ma_packet_ind and we should have a valid source address here */ + + if(srcStaInfo == NULL) { + CsrWifiMacAddress peerMacAddress; + /* Unknown data PDU */ + memcpy(peerMacAddress.a,sa,ETH_ALEN); + unifi_trace(priv, UDBG1, "%s: Unexpected frame from peer = %x:%x:%x:%x:%x:%x\n", __FUNCTION__, + sa[0], sa[1],sa[2], sa[3], sa[4],sa[5]); + CsrWifiRouterCtrlUnexpectedFrameIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,0,interfaceTag,peerMacAddress); + unifi_net_data_free(priv, &bulkdata->d[0]); + func_exit(); + return; + } + + /* For AP GO mode, don't store the PDUs */ + if (port_action != CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN) { + /* Drop the packet and return */ + CsrWifiMacAddress peerMacAddress; + memcpy(peerMacAddress.a,sa,ETH_ALEN); + unifi_trace(priv, UDBG3, "%s: Port is not open: unexpected frame from peer = %x:%x:%x:%x:%x:%x\n", + __FUNCTION__, sa[0], sa[1],sa[2], sa[3], sa[4],sa[5]); + + CsrWifiRouterCtrlUnexpectedFrameIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,0,interfaceTag,peerMacAddress); + interfacePriv->stats.rx_dropped++; + unifi_net_data_free(priv, &bulkdata->d[0]); + unifi_notice(priv, "%s: Dropping packet, proto=0x%04x, %s port\n", __FUNCTION__, + proto, queue ? "Controlled" : "Un-controlled"); + func_exit(); + return; + } + + /* Qos NULL/Data NULL are freed here and not processed further */ + if((dataFrameType == QOS_DATA_NULL) || (dataFrameType == DATA_NULL)){ + unifi_trace(priv, UDBG5, "%s: Null Frame Received and Freed\n", __FUNCTION__); + unifi_net_data_free(priv, &bulkdata->d[0]); + func_exit(); + return; + } + + /* Now we have done with MAC header so proceed with the real data part*/ + /* This function takes care of appropriate routing for AP/P2PGO case*/ + /* the function hadnles following things + 2. Routing the PDU to appropriate location + 3. Error case handling + */ + if(!(uf_ap_process_data_pdu(priv, skb, &ehdr, srcStaInfo, + signal, + bulkdata, + macHeaderLengthInBytes))) + { + func_exit(); + return; + } + unifi_trace(priv, UDBG5, "unifi_rx: no specific AP handling process as normal frame, MAC Header len %d\n",macHeaderLengthInBytes); + /* Remove the MAC header for subsequent conversion */ + skb_pull(skb, macHeaderLengthInBytes); + pData->os_data_ptr = skb->data; + pData->data_length -= macHeaderLengthInBytes; + pData->os_net_buf_ptr = (unsigned char*)skb; + pData->net_buf_length = skb->len; + } +#endif /* CSR_SUPPORT_SME */ + + + /* Now that the MAC header is removed, null-data frames have zero length + * and can be dropped + */ + if (pData->data_length == 0) { + if (((frameControl & 0x00f0) >> 4) != QOS_DATA_NULL && + ((frameControl & 0x00f0) >> 4) != DATA_NULL) { + unifi_trace(priv, UDBG1, "Zero length frame, but not null-data %04x\n", frameControl); + } + unifi_net_data_free(priv, &bulkdata->d[0]); + func_exit(); + return; + } + + if (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD) { + /* Drop the packet and return */ + interfacePriv->stats.rx_dropped++; + unifi_net_data_free(priv, &bulkdata->d[0]); + unifi_notice(priv, "%s: Dropping packet, proto=0x%04x, %s port\n", + __FUNCTION__, proto, queue ? "controlled" : "uncontrolled"); + func_exit(); + return; + } else if ( (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_BLOCK) || + (interfacePriv->connected != UnifiConnected) ) { + + /* Buffer the packet into the Rx queues */ + rx_buffered_packets_t *rx_q_item; + struct list_head *rx_list; + + rx_q_item = (rx_buffered_packets_t *)kmalloc(sizeof(rx_buffered_packets_t), + GFP_KERNEL); + if (rx_q_item == NULL) { + unifi_error(priv, "%s: Failed to allocate %d bytes for rx packet record\n", + __FUNCTION__, sizeof(rx_buffered_packets_t)); + interfacePriv->stats.rx_dropped++; + unifi_net_data_free(priv, &bulkdata->d[0]); + func_exit(); + return; + } + + INIT_LIST_HEAD(&rx_q_item->q); + rx_q_item->bulkdata = *bulkdata; + rx_q_item->skb = skb; + rx_q_item->signal = *signal; + memcpy(rx_q_item->sa.a, sa, ETH_ALEN); + memcpy(rx_q_item->da.a, da, ETH_ALEN); + unifi_trace(priv, UDBG2, "%s: Blocked skb=%p, bulkdata=%p\n", + __FUNCTION__, rx_q_item->skb, &rx_q_item->bulkdata); + + if (queue == UF_CONTROLLED_PORT_Q) { + rx_list = &interfacePriv->rx_controlled_list; + } else { + rx_list = &interfacePriv->rx_uncontrolled_list; + } + + /* Add to tail of packets queue */ + down(&priv->rx_q_sem); + list_add_tail(&rx_q_item->q, rx_list); + up(&priv->rx_q_sem); + + func_exit(); + return; + + } + + indicate_rx_skb(priv, interfaceTag, da, sa, skb, signal, bulkdata); + + func_exit(); + +} /* unifi_rx() */ + +static void process_ma_packet_cfm(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata) +{ + CsrUint16 interfaceTag; + const CSR_MA_PACKET_CONFIRM *pkt_cfm = &signal->u.MaPacketConfirm; + netInterface_priv_t *interfacePriv; + + func_enter(); + interfaceTag = (pkt_cfm->VirtualInterfaceIdentifier & 0xff); + interfacePriv = priv->interfacePriv[interfaceTag]; + + /* Sanity check that the VIF refers to a sensible interface */ + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) + { + unifi_error(priv, "%s: MA-PACKET confirm with bad interfaceTag %d\n", __FUNCTION__, interfaceTag); + func_exit(); + return; + } +#ifdef CSR_SUPPORT_SME + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + + uf_process_ma_pkt_cfm_for_ap(priv,interfaceTag,pkt_cfm); + } else if (interfacePriv->m4_sent && (pkt_cfm->HostTag == interfacePriv->m4_hostTag)) { + /* Check if this is a confirm for EAPOL M4 frame and we need to send transmistted ind*/ + CsrResult result = pkt_cfm->TransmissionStatus == CSR_TX_SUCCESSFUL?CSR_RESULT_SUCCESS:CSR_RESULT_FAILURE; + CsrWifiMacAddress peerMacAddress; + memcpy(peerMacAddress.a, interfacePriv->m4_signal.u.MaPacketRequest.Ra.x, ETH_ALEN); + + unifi_trace(priv, UDBG1, "%s: Sending M4 Transmit CFM\n", __FUNCTION__); + CsrWifiRouterCtrlM4TransmittedIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, + interfaceTag, + peerMacAddress, + result); + interfacePriv->m4_sent = FALSE; + interfacePriv->m4_hostTag = 0xffffffff; + } +#endif + func_exit(); + return; +} + + +/* + * --------------------------------------------------------------------------- + * unifi_rx + * + * Reformat a UniFi data received packet into a p80211 packet and + * pass it up the protocol stack. + * + * Arguments: + * None. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +static void process_ma_packet_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata) +{ + CsrUint16 interfaceTag; + bulk_data_desc_t *pData; + CSR_MA_PACKET_INDICATION *pkt_ind = (CSR_MA_PACKET_INDICATION*)&signal->u.MaPacketIndication; + struct sk_buff *skb; + CsrUint16 frameControl; + netInterface_priv_t *interfacePriv; + CsrUint8 da[ETH_ALEN], sa[ETH_ALEN]; + CsrUint8 *bssid = NULL, *ba_addr = NULL; + CsrUint8 toDs, fromDs, frameType; + CsrUint8 i =0; + +#ifdef CSR_SUPPORT_SME + CsrUint8 dataFrameType = 0; + CsrBool powerSaveChanged = FALSE; + CsrUint8 pmBit = 0; + CsrWifiRouterCtrlStaInfo_t *srcStaInfo = NULL; + CsrUint16 qosControl; + +#endif + + func_enter(); + + interfaceTag = (pkt_ind->VirtualInterfaceIdentifier & 0xff); + interfacePriv = priv->interfacePriv[interfaceTag]; + + + /* Sanity check that the VIF refers to a sensible interface */ + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) + { + unifi_error(priv, "%s: MA-PACKET indication with bad interfaceTag %d\n", __FUNCTION__, interfaceTag); + unifi_net_data_free(priv,&bulkdata->d[0]); + func_exit(); + return; + } + + /* Sanity check that the VIF refers to an allocated netdev */ + if (!interfacePriv->netdev_registered) + { + unifi_error(priv, "%s: MA-PACKET indication with unallocated interfaceTag %d\n", __FUNCTION__, interfaceTag); + unifi_net_data_free(priv, &bulkdata->d[0]); + func_exit(); + return; + } + + if (bulkdata->d[0].data_length == 0) { + unifi_warning(priv, "%s: MA-PACKET indication with zero bulk data\n", __FUNCTION__); + unifi_net_data_free(priv,&bulkdata->d[0]); + func_exit(); + return; + } + /* For monitor mode we need to pass this indication to the registered application + handle this seperately*/ + /* MIC failure is already taken care of so no need to send the PDUs which are not successfully received in non-monitor mode*/ + if(pkt_ind->ReceptionStatus != CSR_RX_SUCCESS) + { + unifi_warning(priv, "%s: MA-PACKET indication with status = %d\n",__FUNCTION__, pkt_ind->ReceptionStatus); + unifi_net_data_free(priv,&bulkdata->d[0]); + func_exit(); + return; + } + + + skb = (struct sk_buff*)bulkdata->d[0].os_net_buf_ptr; + skb->len = bulkdata->d[0].data_length; + + /* Point to the addresses */ + toDs = (skb->data[1] & 0x01) ? 1 : 0; + fromDs = (skb->data[1] & 0x02) ? 1 : 0; + + memcpy(da,(skb->data+4+toDs*12),ETH_ALEN);/* Address1 or 3 */ + memcpy(sa,(skb->data+10+fromDs*(6+toDs*8)),ETH_ALEN); /* Address2, 3 or 4 */ + + /* Find the BSSID, which will be used to match the BA session */ + if (toDs && fromDs) + { + unifi_trace(priv, UDBG6, "4 address frame - don't try to find BSSID\n"); + bssid = NULL; + } + else + { + bssid = (CsrUint8 *) (skb->data + 4 + 12 - (fromDs * 6) - (toDs * 12)); + } + + pData = &bulkdata->d[0]; + frameControl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(pData->os_data_ptr); + frameType = ((frameControl & 0x000C) >> 2); + + unifi_trace(priv, UDBG3, "Rx Frame Type: %d sn: %d\n",frameType, + (le16_to_cpu(*((CsrUint16*)(bulkdata->d[0].os_data_ptr + IEEE802_11_SEQUENCE_CONTROL_OFFSET))) >> 4) & 0xfff); + if(frameType == IEEE802_11_FRAMETYPE_CONTROL){ +#ifdef CSR_SUPPORT_SME + unifi_trace(priv, UDBG6, "%s: Received Control Frame\n", __FUNCTION__); + + if((frameControl & 0x00f0) == 0x00A0){ + /* This is a PS-POLL request */ + CsrUint8 pmBit = (frameControl & 0x1000)?0x01:0x00; + unifi_trace(priv, UDBG6, "%s: Received PS-POLL Frame\n", __FUNCTION__); + + uf_process_ps_poll(priv,sa,da,pmBit,interfaceTag); + } + else { + unifi_warning(priv, "%s: Non PS-POLL control frame is received\n", __FUNCTION__); + } +#endif + unifi_net_data_free(priv,&bulkdata->d[0]); + func_exit(); + return; + } + if(frameType != IEEE802_11_FRAMETYPE_DATA) { + unifi_warning(priv, "%s: Non control Non Data frame is received\n",__FUNCTION__); + unifi_net_data_free(priv,&bulkdata->d[0]); + func_exit(); + return; + } + +#ifdef CSR_SUPPORT_SME + if((interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP) || + (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO)){ + + srcStaInfo = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv,sa,interfaceTag); + + if(srcStaInfo == NULL) { + CsrWifiMacAddress peerMacAddress; + /* Unknown data PDU */ + memcpy(peerMacAddress.a,sa,ETH_ALEN); + unifi_trace(priv, UDBG1, "%s: Unexpected frame from peer = %x:%x:%x:%x:%x:%x\n", __FUNCTION__, + sa[0], sa[1],sa[2], sa[3], sa[4],sa[5]); + CsrWifiRouterCtrlUnexpectedFrameIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,0,interfaceTag,peerMacAddress); + unifi_net_data_free(priv, &bulkdata->d[0]); + func_exit(); + return; + } + + /* + verify power management bit here so as to ensure host and unifi are always + in sync with power management status of peer. + + If we do it later, it may so happen we have stored the frame in BA re-ordering + buffer and hence host and unifi are out of sync for power management status + */ + + pmBit = (frameControl & 0x1000)?0x01:0x00; + powerSaveChanged = uf_process_pm_bit_for_peer(priv,srcStaInfo,pmBit,interfaceTag); + + /* Update station last activity time */ + srcStaInfo->activity_flag = TRUE; + + /* For Qos Frame if PM bit is toggled to indicate the change in power save state then it shall not be + considered as Trigger Frame. Enter only if WMM STA and peer is in Power save */ + + dataFrameType = ((frameControl & 0x00f0) >> 4); + + if((powerSaveChanged == FALSE)&&(srcStaInfo->wmmOrQosEnabled == TRUE)&& + (srcStaInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE)){ + + if((dataFrameType == QOS_DATA) || (dataFrameType == QOS_DATA_NULL)){ + + /* + QoS control field is offset from frame control by 2 (frame control) + + 2 (duration/ID) + 2 (sequence control) + 3*ETH_ALEN or 4*ETH_ALEN + */ + if((frameControl & IEEE802_11_FC_TO_DS_MASK) && (frameControl & IEEE802_11_FC_FROM_DS_MASK)){ + qosControl= CSR_GET_UINT16_FROM_LITTLE_ENDIAN(pData->os_data_ptr + 30); + } + else{ + qosControl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(pData->os_data_ptr + 24); + } + + if((IS_DTIM_ACTIVE(interfacePriv->dtimActive,interfacePriv->multicastPduHostTag))){ + CSR_PRIORITY priority; + unifi_TrafficQueue priority_q; + priority = (CSR_PRIORITY)(qosControl & IEEE802_11_QC_TID_MASK); + priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY) priority); + if((srcStaInfo->powersaveMode[priority_q]==CSR_WIFI_AC_TRIGGER_ONLY_ENABLED) + ||(srcStaInfo->powersaveMode[priority_q]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)){ + unsigned long lock_flags; + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + srcStaInfo->uapsdSuspended = TRUE; + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + unifi_trace(priv, UDBG3, "%s: qos Trigger Frame received while DTIM Active for staid: 0x%x\n",__FUNCTION__,srcStaInfo->aid); + } + } + else{ + + + unifi_trace(priv, UDBG5, "%s: Check if U-APSD operations are triggered for qosControl: 0x%x\n",__FUNCTION__,qosControl); + uf_process_wmm_deliver_ac_uapsd(priv,srcStaInfo,qosControl,interfaceTag); + } + } + } + } + +#endif + + if( ((frameControl & 0x00f0) >> 4) == QOS_DATA) { + CsrUint8 *qos_control_ptr = (CsrUint8*)bulkdata->d[0].os_data_ptr + (((frameControl & IEEE802_11_FC_TO_DS_MASK) && (frameControl & IEEE802_11_FC_FROM_DS_MASK))?30: 24); + int tID = *qos_control_ptr & IEEE802_11_QC_TID_MASK; /* using ls octet of qos control */ + ba_session_rx_struct *ba_session; + CsrUint8 ba_session_idx = 0; + /* Get the BA originator address */ + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO){ + ba_addr = sa; + }else{ + ba_addr = bssid; + } + + spin_lock(&priv->ba_lock); + for (ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX; ba_session_idx++){ + ba_session = interfacePriv->ba_session_rx[ba_session_idx]; + if (ba_session){ + unifi_trace(priv, UDBG6, "found ba_session=0x%x ba_session_idx=%d", ba_session, ba_session_idx); + if ((!memcmp(ba_session->macAddress.a, ba_addr, ETH_ALEN)) && (ba_session->tID == tID)){ + frame_desc_struct frame_desc; + frame_desc.bulkdata = *bulkdata; + frame_desc.signal = *signal; + frame_desc.sn = (le16_to_cpu(*((CsrUint16*)(bulkdata->d[0].os_data_ptr + IEEE802_11_SEQUENCE_CONTROL_OFFSET))) >> 4) & 0xfff; + frame_desc.active = TRUE; + unifi_trace(priv, UDBG6, "%s: calling process_ba_frame (session=%d)\n", __FUNCTION__, ba_session_idx); + process_ba_frame(priv, interfacePriv, ba_session, &frame_desc); + spin_unlock(&priv->ba_lock); + process_ba_complete(priv, interfacePriv); + break; + } + } + } + if (ba_session_idx == MAX_SUPPORTED_BA_SESSIONS_RX){ + spin_unlock(&priv->ba_lock); + unifi_trace(priv, UDBG6, "%s: calling process_amsdu()", __FUNCTION__); + process_amsdu(priv, signal, bulkdata); + } + } else { + unifi_trace(priv, UDBG6, "calling unifi_rx()"); + unifi_rx(priv, signal, bulkdata); + } + + /* check if the frames in reorder buffer has aged, the check + * is done after receive processing so that if the missing frame + * has arrived in this receive process, then it is handled cleanly. + * + * And also this code here takes care that timeout check is made for all + * the receive indications + */ + spin_lock(&priv->ba_lock); + for (i=0; i < MAX_SUPPORTED_BA_SESSIONS_RX; i++){ + ba_session_rx_struct *ba_session; + ba_session = interfacePriv->ba_session_rx[i]; + if (ba_session){ + check_ba_frame_age_timeout(priv, interfacePriv, ba_session); + } + } + process_ba_complete(priv, interfacePriv); + spin_unlock(&priv->ba_lock); + + func_exit(); +} +/* + * --------------------------------------------------------------------------- + * uf_set_multicast_list + * + * This function is called by the higher level stack to set + * a list of multicast rx addresses. + * + * Arguments: + * dev Network Device pointer. + * + * Returns: + * None. + * + * Notes: + * --------------------------------------------------------------------------- + */ + +static void +uf_set_multicast_list(struct net_device *dev) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + +#ifdef CSR_NATIVE_LINUX + unifi_trace(priv, UDBG3, "uf_set_multicast_list unsupported\n"); + return; +#else + + u8 *mc_list = interfacePriv->mc_list; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,34) + struct netdev_hw_addr *mc_addr; + int mc_addr_count; +#else + struct dev_mc_list *p; /* Pointer to the addresses structure. */ + int i; +#endif + + if (priv->init_progress != UNIFI_INIT_COMPLETED) { + return; + } + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,34) + mc_addr_count = netdev_mc_count(dev); + + unifi_trace(priv, UDBG3, + "uf_set_multicast_list (count=%d)\n", mc_addr_count); + + + /* Not enough space? */ + if (mc_addr_count > UNIFI_MAX_MULTICAST_ADDRESSES) { + return; + } + + /* Store the list to be processed by the work item. */ + interfacePriv->mc_list_count = mc_addr_count; + netdev_hw_addr_list_for_each(mc_addr, &dev->mc) { + memcpy(mc_list, mc_addr->addr, ETH_ALEN); + mc_list += ETH_ALEN; + } + +#else + unifi_trace(priv, UDBG3, + "uf_set_multicast_list (count=%d)\n", dev->mc_count); + + /* Not enough space? */ + if (dev->mc_count > UNIFI_MAX_MULTICAST_ADDRESSES) { + return; + } + + /* Store the list to be processed by the work item. */ + interfacePriv->mc_list_count = dev->mc_count; + p = dev->mc_list; + for (i = 0; i < dev->mc_count; i++) { + memcpy(mc_list, p->dmi_addr, ETH_ALEN); + p = p->next; + mc_list += ETH_ALEN; + } +#endif + + /* Send a message to the workqueue */ + queue_work(priv->unifi_workqueue, &priv->multicast_list_task); +#endif + +} /* uf_set_multicast_list() */ + +/* + * --------------------------------------------------------------------------- + * netdev_mlme_event_handler + * + * Callback function to be used as the udi_event_callback when registering + * as a netdev client. + * To use it, a client specifies this function as the udi_event_callback + * to ul_register_client(). The signal dispatcher in + * unifi_receive_event() will call this function to deliver a signal. + * + * Arguments: + * pcli Pointer to the client instance. + * signal Pointer to the received signal. + * signal_len Size of the signal structure in bytes. + * bulkdata Pointer to structure containing any associated bulk data. + * dir Direction of the signal. Zero means from host, + * non-zero means to host. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +static void +netdev_mlme_event_handler(ul_client_t *pcli, const u8 *sig_packed, int sig_len, + const bulk_data_param_t *bulkdata_o, int dir) +{ + CSR_SIGNAL signal; + unifi_priv_t *priv = uf_find_instance(pcli->instance); + int id, r; + bulk_data_param_t bulkdata; + + func_enter(); + + /* Just a sanity check */ + if (sig_packed == NULL) { + return; + } + + /* + * This copy is to silence a compiler warning about discarding the + * const qualifier. + */ + bulkdata = *bulkdata_o; + + /* Get the unpacked signal */ + r = read_unpack_signal(sig_packed, &signal); + if (r) { + /* + * The CSR_MLME_CONNECTED_INDICATION_ID has a receiverID=0 so will + * fall through this case. It is safe to ignore this signal. + */ + unifi_trace(priv, UDBG1, + "Netdev - Received unknown signal 0x%.4X.\n", + CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sig_packed)); + return; + } + + id = signal.SignalPrimitiveHeader.SignalId; + unifi_trace(priv, UDBG3, "Netdev - Process signal 0x%.4X\n", id); + + /* + * Take the appropriate action for the signal. + */ + switch (id) { + case CSR_MA_PACKET_ERROR_INDICATION_ID: + process_ma_packet_error_ind(priv, &signal, &bulkdata); + break; + case CSR_MA_PACKET_INDICATION_ID: + process_ma_packet_ind(priv, &signal, &bulkdata); + break; + case CSR_MA_PACKET_CONFIRM_ID: + process_ma_packet_cfm(priv, &signal, &bulkdata); + break; +#ifdef CSR_SUPPORT_SME + case CSR_MLME_SET_TIM_CONFIRM_ID: + /* Handle TIM confirms from FW & set the station record's TIM state appropriately, + * In case of failures, tries with max_retransmit limit + */ + uf_handle_tim_cfm(priv, &signal.u.MlmeSetTimConfirm, signal.SignalPrimitiveHeader.ReceiverProcessId); + break; +#endif + case CSR_DEBUG_STRING_INDICATION_ID: + debug_string_indication(priv, bulkdata.d[0].os_data_ptr, bulkdata.d[0].data_length); + break; + + case CSR_DEBUG_WORD16_INDICATION_ID: + debug_word16_indication(priv, &signal); + break; + + case CSR_DEBUG_GENERIC_CONFIRM_ID: + case CSR_DEBUG_GENERIC_INDICATION_ID: + debug_generic_indication(priv, &signal); + break; + default: + break; + } + + func_exit(); +} /* netdev_mlme_event_handler() */ + + +/* + * --------------------------------------------------------------------------- + * uf_net_get_name + * + * Retrieve the name (e.g. eth1) associated with this network device + * + * Arguments: + * dev Pointer to the network device. + * name Buffer to write name + * len Size of buffer in bytes + * + * Returns: + * None + * + * Notes: + * --------------------------------------------------------------------------- + */ +void uf_net_get_name(struct net_device *dev, char *name, int len) +{ + *name = '\0'; + if (dev) { + strlcpy(name, dev->name, (len > IFNAMSIZ) ? IFNAMSIZ : len); + } + +} /* uf_net_get_name */ + + + + + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) +#ifdef CONFIG_NET_SCHED + +/* + * --------------------------------------------------------------------------- + * uf_install_qdisc + * + * Creates a root qdisc, registers our qdisc handlers and + * overrides the device's qdisc_sleeping to prevent the system + * from creating a new one for our network device. + * + * Arguments: + * dev Pointer to the network device. + * + * Returns: + * 0 on success, Linux error code otherwise. + * + * Notes: + * This function holds the qdisk lock so it needs to be called + * after registering the network device in uf_register_netdev(). + * Also, the qdisc_create_dflt() API has changed in 2.6.20 to + * include the parentid. + * --------------------------------------------------------------------------- + */ +int uf_install_qdisc(struct net_device *dev) +{ + struct Qdisc *qdisc; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + struct netdev_queue *queue0; +#endif /* LINUX_VERSION_CODE */ + + + func_enter(); + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) + /* + * check that there is no qdisc currently attached to device + * this ensures that we will be the root qdisc. (I can't find a better + * way to test this explicitly) + */ + if (dev->qdisc_sleeping != &noop_qdisc) { + func_exit_r(-EFAULT); + return -EINVAL; + } +#endif /* LINUX_VERSION_CODE */ + + qdisc = UF_QDISC_CREATE_DFLT(dev, &uf_qdisc_ops, TC_H_ROOT); + if (!qdisc) { + unifi_error(NULL, "%s: qdisc installation failed\n", dev->name); + func_exit_r(-EFAULT); + return -EFAULT; + } + unifi_trace(NULL, UDBG5, "%s: parent qdisc=0x%p\n", + dev->name, qdisc); + + qdisc->handle = 0x80020000; + qdisc->flags = 0x0; + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + queue0 = netdev_get_tx_queue(dev, 0); + if (queue0 == NULL) { + unifi_error(NULL, "%s: netdev_get_tx_queue returned no queue\n", + dev->name); + func_exit_r(-EFAULT); + return -EFAULT; + } + queue0->qdisc = qdisc; + queue0->qdisc_sleeping = qdisc; +#else + qdisc_lock_tree(dev); + list_add_tail(&qdisc->list, &dev->qdisc_list); + dev->qdisc_sleeping = qdisc; + qdisc_unlock_tree(dev); +#endif /* LINUX_VERSION_CODE */ + + func_exit_r(0); + return 0; + +} /* uf_install_qdisc() */ + +static int uf_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd) +{ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(qd->dev_queue->dev); +#else + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(qd->dev); +#endif /* LINUX_VERSION_CODE */ + unifi_priv_t *priv = interfacePriv->privPtr; + struct uf_sched_data *q = qdisc_priv(qd); + struct uf_tx_packet_data *pkt_data = (struct uf_tx_packet_data *) skb->cb; + struct ethhdr ehdr; + struct Qdisc *qdisc; + int r, proto; + + func_enter(); + + memcpy(&ehdr, skb->data, ETH_HLEN); + proto = ntohs(ehdr.h_proto); + + /* 802.1x - apply controlled/uncontrolled port rules */ + if ((proto != ETH_P_PAE) +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + && (proto != ETH_P_WAI) +#endif + ) { + /* queues 0 - 3 */ + pkt_data->priority = get_packet_priority(priv, skb, &ehdr, interfacePriv); + pkt_data->queue = unifi_frame_priority_to_queue(pkt_data->priority); + } else { + pkt_data->queue = UNIFI_TRAFFIC_Q_EAPOL; + } + + qdisc = q->queues[pkt_data->queue]; + r = qdisc->enqueue(skb, qdisc); + if (r == NET_XMIT_SUCCESS) { + qd->q.qlen++; + qd->bstats.bytes += skb->len; + qd->bstats.packets++; + func_exit_r(NET_XMIT_SUCCESS); + return NET_XMIT_SUCCESS; + } + + unifi_error(priv, "uf_qdiscop_enqueue: dropped\n"); + qd->qstats.drops++; + + func_exit_r(r); + return r; + +} /* uf_qdiscop_enqueue() */ + + +static int uf_qdiscop_requeue(struct sk_buff *skb, struct Qdisc* qd) +{ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + netInterface_priv_t *interfacePriv = (netInterface_priv_t*)netdev_priv(qd->dev_queue->dev); +#else + netInterface_priv_t *interfacePriv = (netInterface_priv_t*)netdev_priv(qd->dev); +#endif /* LINUX_VERSION_CODE */ + unifi_priv_t *priv = interfacePriv->privPtr; + struct uf_sched_data *q = qdisc_priv(qd); + struct uf_tx_packet_data *pkt_data = (struct uf_tx_packet_data *) skb->cb; + struct Qdisc *qdisc; + int r; + + func_enter(); + + unifi_trace(priv, UDBG5, "uf_qdiscop_requeue: (q=%d), tag=%u\n", + pkt_data->queue, pkt_data->host_tag); + + /* we recorded which queue to use earlier! */ + qdisc = q->queues[pkt_data->queue]; + + if ((r = qdisc->ops->requeue(skb, qdisc)) == 0) { + qd->q.qlen++; + func_exit_r(0); + return 0; + } + + unifi_error(priv, "uf_qdiscop_requeue: dropped\n"); + qd->qstats.drops++; + + func_exit_r(r); + return r; +} /* uf_qdiscop_requeue() */ + +static struct sk_buff *uf_qdiscop_dequeue(struct Qdisc* qd) +{ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(qd->dev_queue->dev); +#else + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(qd->dev); +#endif /* LINUX_VERSION_CODE */ + unifi_priv_t *priv = interfacePriv->privPtr; + struct uf_sched_data *q = qdisc_priv(qd); + struct sk_buff *skb; + struct Qdisc *qdisc; + int queue, i; + struct ethhdr ehdr; + struct uf_tx_packet_data *pkt_data; + CsrWifiRouterCtrlPortAction port_action; + + func_enter(); + + /* check all the queues */ + for (i = UNIFI_TRAFFIC_Q_MAX - 1; i >= 0; i--) { + + if (i != UNIFI_TRAFFIC_Q_EAPOL) { + queue = priv->prev_queue; + if (++priv->prev_queue >= UNIFI_TRAFFIC_Q_EAPOL) { + priv->prev_queue = 0; + } + } else { + queue = i; + } + +#ifndef ALLOW_Q_PAUSE + /* If queue is paused, do not dequeue */ + if (net_is_tx_q_paused(priv, queue)) { + unifi_trace(priv, UDBG5, + "uf_qdiscop_dequeue: tx queue paused (q=%d)\n", queue); + continue; + } +#endif + + qdisc = q->queues[queue]; + skb = qdisc->dequeue(qdisc); + if (skb) { + /* A packet has been dequeued, decrease the queued packets count */ + qd->q.qlen--; + + pkt_data = (struct uf_tx_packet_data *) skb->cb; + + /* Check the (un)controlled port status */ + memcpy(&ehdr, skb->data, ETH_HLEN); + + port_action = verify_port(priv + , (((CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) ||(CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI == interfacePriv->interfaceMode))? interfacePriv->bssid.a: ehdr.h_dest) + , (UNIFI_TRAFFIC_Q_EAPOL == queue? UF_UNCONTROLLED_PORT_Q: UF_CONTROLLED_PORT_Q) + , interfacePriv->InterfaceTag); + + /* Dequeue packet if port is open */ + if (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN) { + unifi_trace(priv, UDBG5, + "uf_qdiscop_dequeue: new (q=%d), tag=%u\n", + queue, pkt_data->host_tag); + + func_exit(); + return skb; + } + + /* Discard or block the packet if necessary */ + if (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD) { + unifi_trace(priv, UDBG5, + "uf_qdiscop_dequeue: drop (q=%d), tag=%u\n", + queue, pkt_data->host_tag); + kfree_skb(skb); + break; + } + + /* We can not send the packet now, put it back to the queue */ + if (qdisc->ops->requeue(skb, qdisc) != 0) { + unifi_error(priv, + "uf_qdiscop_dequeue: requeue (q=%d) failed, tag=%u, drop it\n", + queue, pkt_data->host_tag); + + /* Requeue failed, drop the packet */ + kfree_skb(skb); + break; + } + /* We requeued the packet, increase the queued packets count */ + qd->q.qlen++; + + unifi_trace(priv, UDBG5, + "uf_qdiscop_dequeue: skip (q=%d), tag=%u\n", + queue, pkt_data->host_tag); + } + } + + func_exit(); + return NULL; +} /* uf_qdiscop_dequeue() */ + + +static void uf_qdiscop_reset(struct Qdisc* qd) +{ + struct uf_sched_data *q = qdisc_priv(qd); + int queue; + func_enter(); + + for (queue = 0; queue < UNIFI_TRAFFIC_Q_MAX; queue++) { + qdisc_reset(q->queues[queue]); + } + qd->q.qlen = 0; + + func_exit(); +} /* uf_qdiscop_reset() */ + + +static void uf_qdiscop_destroy(struct Qdisc* qd) +{ + struct uf_sched_data *q = qdisc_priv(qd); + int queue; + + func_enter(); + + for (queue=0; queue < UNIFI_TRAFFIC_Q_MAX; queue++) { + qdisc_destroy(q->queues[queue]); + q->queues[queue] = &noop_qdisc; + } + + func_exit(); +} /* uf_qdiscop_destroy() */ + + +/* called whenever parameters are updated on existing qdisc */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) +static int uf_qdiscop_tune(struct Qdisc *qd, struct nlattr *opt) +#else +static int uf_qdiscop_tune(struct Qdisc *qd, struct rtattr *opt) +#endif +{ + func_enter(); + func_exit(); + return 0; +} /* uf_qdiscop_tune() */ + + +/* called during initial creation of qdisc on device */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) +static int uf_qdiscop_init(struct Qdisc *qd, struct nlattr *opt) +#else +static int uf_qdiscop_init(struct Qdisc *qd, struct rtattr *opt) +#endif +{ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + struct net_device *dev = qd->dev_queue->dev; +#else + struct net_device *dev = qd->dev; +#endif /* LINUX_VERSION_CODE */ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + struct uf_sched_data *q = qdisc_priv(qd); + int err = 0, i; + + func_enter(); + + /* make sure we do not mess with the ingress qdisc */ + if (qd->flags & TCQ_F_INGRESS) { + func_exit(); + return -EINVAL; + } + + /* if options were passed in, set them */ + if (opt) { + err = uf_qdiscop_tune(qd, opt); + } + + /* create child queues */ + for (i = 0; i < UNIFI_TRAFFIC_Q_MAX; i++) { + q->queues[i] = UF_QDISC_CREATE_DFLT(dev, &pfifo_qdisc_ops, + qd->handle); + if (!q->queues[i]) { + q->queues[i] = &noop_qdisc; + unifi_error(priv, "%s child qdisc %i creation failed\n"); + } + + unifi_trace(priv, UDBG5, "%s: child qdisc=0x%p\n", + dev->name, q->queues[i]); + } + + func_exit_r(err); + return err; +} /* uf_qdiscop_init() */ + + +static int uf_qdiscop_dump(struct Qdisc *qd, struct sk_buff *skb) +{ + func_enter(); + func_exit_r(skb->len); + return skb->len; +} /* uf_qdiscop_dump() */ + +#endif /* CONFIG_NET_SCHED */ +#endif /* LINUX_VERSION_CODE */ + +#ifdef CSR_SUPPORT_WEXT + +/* + * --------------------------------------------------------------------------- + * uf_netdev_event + * + * Callback function to handle netdev state changes + * + * Arguments: + * notif Pointer to a notifier_block. + * event Event prompting notification + * ptr net_device pointer + * + * Returns: + * None + * + * Notes: + * The event handler is global, and may occur on non-UniFi netdevs. + * --------------------------------------------------------------------------- + */ +static int +uf_netdev_event(struct notifier_block *notif, unsigned long event, void* ptr) { + struct net_device *netdev = ptr; + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(netdev); + unifi_priv_t *priv = NULL; + static const CsrWifiMacAddress broadcast_address = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}}; + + /* Check that the event is for a UniFi netdev. If it's not, the netdev_priv + * structure is not safe to use. + */ + if (uf_find_netdev_priv(interfacePriv) == -1) { + unifi_trace(NULL, UDBG1, "uf_netdev_event: ignore e=%d, ptr=%p, priv=%p %s\n", + event, ptr, interfacePriv, netdev->name); + return 0; + } + + switch(event) { + case NETDEV_CHANGE: + priv = interfacePriv->privPtr; + unifi_trace(priv, UDBG1, "NETDEV_CHANGE: %p %s %s waiting for it\n", + ptr, + netdev->name, + interfacePriv->wait_netdev_change ? "" : "not"); + + if (interfacePriv->wait_netdev_change) { + UF_NETIF_TX_WAKE_ALL_QUEUES(priv->netdev[interfacePriv->InterfaceTag]); + interfacePriv->connected = UnifiConnected; + interfacePriv->wait_netdev_change = FALSE; + /* Note: passing the broadcast address here will allow anyone to attempt to join our adhoc network */ + uf_process_rx_pending_queue(priv, UF_UNCONTROLLED_PORT_Q, broadcast_address, 1,interfacePriv->InterfaceTag); + uf_process_rx_pending_queue(priv, UF_CONTROLLED_PORT_Q, broadcast_address, 1,interfacePriv->InterfaceTag); + } + break; + + default: + break; + } + return 0; +} + +static struct notifier_block uf_netdev_notifier = { + .notifier_call = uf_netdev_event, +}; +#endif /* CSR_SUPPORT_WEXT */ + + +static void + process_amsdu(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata) +{ + CsrUint32 offset; + CsrUint32 length = bulkdata->d[0].data_length; + CsrUint32 subframe_length, subframe_body_length, dot11_hdr_size; + CsrUint8 *ptr; + bulk_data_param_t subframe_bulkdata; + CsrUint8 *dot11_hdr_ptr = (CsrUint8*)bulkdata->d[0].os_data_ptr; + CsrResult csrResult; + CsrUint16 frameControl; + CsrUint8 *qos_control_ptr; + + frameControl = le16_to_cpu(*((CsrUint16*)dot11_hdr_ptr)); + qos_control_ptr = dot11_hdr_ptr + (((frameControl & IEEE802_11_FC_TO_DS_MASK) && (frameControl & IEEE802_11_FC_FROM_DS_MASK))?30: 24); + if(!(*qos_control_ptr & IEEE802_11_QC_A_MSDU_PRESENT)) { + unifi_trace(priv, UDBG6, "%s: calling unifi_rx()", __FUNCTION__); + unifi_rx(priv, signal, bulkdata); + return; + } + *qos_control_ptr &= ~(IEEE802_11_QC_A_MSDU_PRESENT); + + ptr = qos_control_ptr + 2; + offset = dot11_hdr_size = ptr - dot11_hdr_ptr; + + while(length > (offset + sizeof(struct ethhdr) + sizeof(llc_snap_hdr_t))) { + subframe_body_length = ntohs(((struct ethhdr*)ptr)->h_proto); + if(subframe_body_length > IEEE802_11_MAX_DATA_LEN) { + unifi_error(priv, "%s: bad subframe_body_length = %d\n", __FUNCTION__, subframe_body_length); + break; + } + subframe_length = sizeof(struct ethhdr) + subframe_body_length; + memset(&subframe_bulkdata, 0, sizeof(bulk_data_param_t)); + + csrResult = unifi_net_data_malloc(priv, &subframe_bulkdata.d[0], dot11_hdr_size + subframe_body_length); + + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, "%s: unifi_net_data_malloc failed\n", __FUNCTION__); + break; + } + + memcpy((CsrUint8*)subframe_bulkdata.d[0].os_data_ptr, dot11_hdr_ptr, dot11_hdr_size); + + + /* When to DS=0 and from DS=0, address 3 will already have BSSID so no need to re-program */ + if ((frameControl & IEEE802_11_FC_TO_DS_MASK) && !(frameControl & IEEE802_11_FC_FROM_DS_MASK)){ + memcpy((CsrUint8*)subframe_bulkdata.d[0].os_data_ptr + IEEE802_11_ADDR3_OFFSET, ((struct ethhdr*)ptr)->h_dest, ETH_ALEN); + } + else if (!(frameControl & IEEE802_11_FC_TO_DS_MASK) && (frameControl & IEEE802_11_FC_FROM_DS_MASK)){ + memcpy((CsrUint8*)subframe_bulkdata.d[0].os_data_ptr + IEEE802_11_ADDR3_OFFSET, + ((struct ethhdr*)ptr)->h_source, + ETH_ALEN); + } + + memcpy((CsrUint8*)subframe_bulkdata.d[0].os_data_ptr + dot11_hdr_size, + ptr + sizeof(struct ethhdr), + subframe_body_length); + unifi_trace(priv, UDBG6, "%s: calling unifi_rx. length = %d subframe_length = %d\n", __FUNCTION__, length, subframe_length); + unifi_rx(priv, signal, &subframe_bulkdata); + + subframe_length = (subframe_length + 3)&(~0x3); + ptr += subframe_length; + offset += subframe_length; + } + unifi_net_data_free(priv, &bulkdata->d[0]); +} + + +#define SN_TO_INDEX(__ba_session, __sn) (((__sn - __ba_session->start_sn) & 0xFFF) % __ba_session->wind_size) + + +#define ADVANCE_EXPECTED_SN(__ba_session) \ +{ \ + __ba_session->expected_sn++; \ + __ba_session->expected_sn &= 0xFFF; \ +} + +#define FREE_BUFFER_SLOT(__ba_session, __index) \ +{ \ + __ba_session->occupied_slots--; \ + __ba_session->buffer[__index].active = FALSE; \ + ADVANCE_EXPECTED_SN(__ba_session); \ +} + +static void add_frame_to_ba_complete(unifi_priv_t *priv, + netInterface_priv_t *interfacePriv, + frame_desc_struct *frame_desc) +{ + interfacePriv->ba_complete[interfacePriv->ba_complete_index] = *frame_desc; + interfacePriv->ba_complete_index++; +} + + +static void update_expected_sn(unifi_priv_t *priv, + netInterface_priv_t *interfacePriv, + ba_session_rx_struct *ba_session, + CsrUint16 sn) +{ + int i, j; + CsrUint16 gap; + + gap = (sn - ba_session->expected_sn) & 0xFFF; + unifi_trace(priv, UDBG6, "%s: proccess the frames up to new_expected_sn = %d gap = %d\n", __FUNCTION__, sn, gap); + for(j = 0; j < gap && j < ba_session->wind_size; j++) { + i = SN_TO_INDEX(ba_session, ba_session->expected_sn); + unifi_trace(priv, UDBG6, "%s: proccess the slot index = %d\n", __FUNCTION__, i); + if(ba_session->buffer[i].active) { + add_frame_to_ba_complete(priv, interfacePriv, &ba_session->buffer[i]); + unifi_trace(priv, UDBG6, "%s: proccess the frame at index = %d expected_sn = %d\n", __FUNCTION__, i, ba_session->expected_sn); + FREE_BUFFER_SLOT(ba_session, i); + } else { + unifi_trace(priv, UDBG6, "%s: empty slot at index = %d\n", __FUNCTION__, i); + ADVANCE_EXPECTED_SN(ba_session); + } + } + ba_session->expected_sn = sn; +} + + +static void complete_ready_sequence(unifi_priv_t *priv, + netInterface_priv_t *interfacePriv, + ba_session_rx_struct *ba_session) +{ + int i; + + i = SN_TO_INDEX(ba_session, ba_session->expected_sn); + while (ba_session->buffer[i].active) { + add_frame_to_ba_complete(priv, interfacePriv, &ba_session->buffer[i]); + unifi_trace(priv, UDBG6, "%s: completed stored frame(expected_sn=%d) at i = %d\n", __FUNCTION__, ba_session->expected_sn, i); + FREE_BUFFER_SLOT(ba_session, i); + i = SN_TO_INDEX(ba_session, ba_session->expected_sn); + } +} + + +void scroll_ba_window(unifi_priv_t *priv, + netInterface_priv_t *interfacePriv, + ba_session_rx_struct *ba_session, + CsrUint16 sn) +{ + if(((sn - ba_session->expected_sn) & 0xFFF) <= 2048) { + update_expected_sn(priv, interfacePriv, ba_session, sn); + complete_ready_sequence(priv, interfacePriv, ba_session); + } +} + + +static int consume_frame_or_get_buffer_index(unifi_priv_t *priv, + netInterface_priv_t *interfacePriv, + ba_session_rx_struct *ba_session, + CsrUint16 sn, + frame_desc_struct *frame_desc) { + int i; + CsrUint16 sn_temp; + + if(((sn - ba_session->expected_sn) & 0xFFF) <= 2048) { + + /* once we are in BA window, set the flag for BA trigger */ + if(!ba_session->trigger_ba_after_ssn){ + ba_session->trigger_ba_after_ssn = TRUE; + } + + sn_temp = ba_session->expected_sn + ba_session->wind_size; + unifi_trace(priv, UDBG6, "%s: new frame: sn=%d\n", __FUNCTION__, sn); + if(!(((sn - sn_temp) & 0xFFF) > 2048)) { + CsrUint16 new_expected_sn; + unifi_trace(priv, UDBG6, "%s: frame is out of window\n", __FUNCTION__); + sn_temp = (sn - ba_session->wind_size) & 0xFFF; + new_expected_sn = (sn_temp + 1) & 0xFFF; + update_expected_sn(priv, interfacePriv, ba_session, new_expected_sn); + } + i = -1; + if (sn == ba_session->expected_sn) { + unifi_trace(priv, UDBG6, "%s: sn = ba_session->expected_sn = %d\n", __FUNCTION__, sn); + ADVANCE_EXPECTED_SN(ba_session); + add_frame_to_ba_complete(priv, interfacePriv, frame_desc); + } else { + i = SN_TO_INDEX(ba_session, sn); + unifi_trace(priv, UDBG6, "%s: sn(%d) != ba_session->expected_sn(%d), i = %d\n", __FUNCTION__, sn, ba_session->expected_sn, i); + if (ba_session->buffer[i].active) { + unifi_trace(priv, UDBG6, "%s: free frame at i = %d\n", __FUNCTION__, i); + i = -1; + unifi_net_data_free(priv, &frame_desc->bulkdata.d[0]); + } + } + } else { + i = -1; + if(!ba_session->trigger_ba_after_ssn){ + unifi_trace(priv, UDBG6, "%s: frame before ssn, pass it up: sn=%d\n", __FUNCTION__, sn); + add_frame_to_ba_complete(priv, interfacePriv, frame_desc); + }else{ + unifi_trace(priv, UDBG6, "%s: old frame, drop: sn=%d, expected_sn=%d\n", __FUNCTION__, sn, ba_session->expected_sn); + unifi_net_data_free(priv, &frame_desc->bulkdata.d[0]); + } + } + return i; +} + + + +static void process_ba_frame(unifi_priv_t *priv, + netInterface_priv_t *interfacePriv, + ba_session_rx_struct *ba_session, + frame_desc_struct *frame_desc) +{ + int i; + CsrUint16 sn = frame_desc->sn; + + if (ba_session->timeout) { + mod_timer(&ba_session->timer, (jiffies + usecs_to_jiffies((ba_session->timeout) * 1024))); + } + unifi_trace(priv, UDBG6, "%s: got frame(sn=%d)\n", __FUNCTION__, sn); + + i = consume_frame_or_get_buffer_index(priv, interfacePriv, ba_session, sn, frame_desc); + if(i >= 0) { + unifi_trace(priv, UDBG6, "%s: store frame(sn=%d) at i = %d\n", __FUNCTION__, sn, i); + ba_session->buffer[i] = *frame_desc; + ba_session->buffer[i].recv_time = CsrTimeGet(NULL); + ba_session->occupied_slots++; + } else { + unifi_trace(priv, UDBG6, "%s: frame consumed - sn = %d\n", __FUNCTION__, sn); + } + complete_ready_sequence(priv, interfacePriv, ba_session); +} + + +static void process_ba_complete(unifi_priv_t *priv, netInterface_priv_t *interfacePriv) +{ + frame_desc_struct *frame_desc; + CsrUint8 i; + + for(i = 0; i < interfacePriv->ba_complete_index; i++) { + frame_desc = &interfacePriv->ba_complete[i]; + unifi_trace(priv, UDBG6, "%s: calling process_amsdu()\n", __FUNCTION__); + process_amsdu(priv, &frame_desc->signal, &frame_desc->bulkdata); + } + interfacePriv->ba_complete_index = 0; + +} + + +/* Check if the frames in BA reoder buffer has aged and + * if so release the frames to upper processes and move + * the window + */ +static void check_ba_frame_age_timeout( unifi_priv_t *priv, + netInterface_priv_t *interfacePriv, + ba_session_rx_struct *ba_session) +{ + CsrTime now; + CsrTime age; + CsrUint8 i, j; + CsrUint16 sn_temp; + + /* gap is started at 1 because we have buffered frames and + * hence a minimum gap of 1 exists + */ + CsrUint8 gap=1; + + now = CsrTimeGet(NULL); + + if (ba_session->occupied_slots) + { + /* expected sequence has not arrived so start searching from next + * sequence number until a frame is available and determine the gap. + * Check if the frame available has timedout, if so advance the + * expected sequence number and release the frames + */ + sn_temp = (ba_session->expected_sn + 1) & 0xFFF; + + for(j = 0; j < ba_session->wind_size; j++) + { + i = SN_TO_INDEX(ba_session, sn_temp); + + if(ba_session->buffer[i].active) + { + unifi_trace(priv, UDBG6, "check age at slot index = %d sn = %d recv_time = %u now = %u\n", + i, + ba_session->buffer[i].sn, + ba_session->buffer[i].recv_time, + now); + + if (ba_session->buffer[i].recv_time > now) + { + /* timer wrap */ + age = CsrTimeAdd((CsrTime)CsrTimeSub(CSR_SCHED_TIME_MAX, ba_session->buffer[i].recv_time), now); + } + else + { + age = (CsrTime)CsrTimeSub(now, ba_session->buffer[i].recv_time); + } + + if (age >= CSR_WIFI_BA_MPDU_FRAME_AGE_TIMEOUT) + { + unifi_trace(priv, UDBG2, "release the frame at index = %d gap = %d expected_sn = %d sn = %d\n", + i, + gap, + ba_session->expected_sn, + ba_session->buffer[i].sn); + + /* if it has timedout don't wait for missing frames, move the window */ + while (gap--) + { + ADVANCE_EXPECTED_SN(ba_session); + } + add_frame_to_ba_complete(priv, interfacePriv, &ba_session->buffer[i]); + FREE_BUFFER_SLOT(ba_session, i); + complete_ready_sequence(priv, interfacePriv, ba_session); + } + break; + + } + else + { + /* advance temp sequence number and frame gap */ + sn_temp = (sn_temp + 1) & 0xFFF; + gap++; + } + } + } +} + + +static void process_ma_packet_error_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata) +{ + CsrUint16 interfaceTag; + const CSR_MA_PACKET_ERROR_INDICATION *pkt_err_ind = &signal->u.MaPacketErrorIndication; + netInterface_priv_t *interfacePriv; + ba_session_rx_struct *ba_session; + CsrUint8 ba_session_idx = 0; + CSR_PRIORITY UserPriority; + CSR_SEQUENCE_NUMBER sn; + + func_enter(); + + interfaceTag = (pkt_err_ind->VirtualInterfaceIdentifier & 0xff); + + + /* Sanity check that the VIF refers to a sensible interface */ + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) + { + unifi_error(priv, "%s: MaPacketErrorIndication indication with bad interfaceTag %d\n", __FUNCTION__, interfaceTag); + func_exit(); + return; + } + + interfacePriv = priv->interfacePriv[interfaceTag]; + UserPriority = pkt_err_ind->UserPriority; + if(UserPriority > 15) { + unifi_error(priv, "%s: MaPacketErrorIndication indication with bad UserPriority=%d\n", __FUNCTION__, UserPriority); + func_exit(); + } + sn = pkt_err_ind->SequenceNumber; + + spin_lock(&priv->ba_lock); + /* To find the right ba_session loop through the BA sessions, compare MAC address and tID */ + for (ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX; ba_session_idx++){ + ba_session = interfacePriv->ba_session_rx[ba_session_idx]; + if (ba_session){ + if ((!memcmp(ba_session->macAddress.a, pkt_err_ind->PeerQstaAddress.x, ETH_ALEN)) && (ba_session->tID == UserPriority)){ + if (ba_session->timeout) { + mod_timer(&ba_session->timer, (jiffies + usecs_to_jiffies((ba_session->timeout) * 1024))); + } + scroll_ba_window(priv, interfacePriv, ba_session, sn); + break; + } + } + } + + spin_unlock(&priv->ba_lock); + process_ba_complete(priv, interfacePriv); + func_exit(); +} + + diff --git a/drivers/staging/csr/os.c b/drivers/staging/csr/os.c new file mode 100644 index 0000000..6dfce42 --- /dev/null +++ b/drivers/staging/csr/os.c @@ -0,0 +1,479 @@ +/* + * --------------------------------------------------------------------------- + * FILE: os.c + * + * PURPOSE: + * Routines to fulfil the OS-abstraction for the HIP lib. + * It is part of the porting exercise. + * + * Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * --------------------------------------------------------------------------- + */ + +/** + * The HIP lib OS abstraction consists of the implementation + * of the functions in this file. It is part of the porting exercise. + */ + +#include "unifi_priv.h" + + +/* + * --------------------------------------------------------------------------- + * unifi_net_data_malloc + * + * Allocate an OS specific net data buffer of "size" bytes. + * The bulk_data_slot.os_data_ptr must be initialised to point + * to the buffer allocated. The bulk_data_slot.length must be + * initialised to the requested size, zero otherwise. + * The bulk_data_slot.os_net_buf_ptr can be initialised to + * an OS specific pointer to be used in the unifi_net_data_free(). + * + * + * Arguments: + * ospriv Pointer to device private context struct. + * bulk_data_slot Pointer to the bulk data structure to initialise. + * size Size of the buffer to be allocated. + * + * Returns: + * CSR_RESULT_SUCCESS on success, CSR_RESULT_FAILURE otherwise. + * --------------------------------------------------------------------------- + */ +CsrResult +unifi_net_data_malloc(void *ospriv, bulk_data_desc_t *bulk_data_slot, unsigned int size) +{ + struct sk_buff *skb; + unifi_priv_t *priv = (unifi_priv_t*)ospriv; + int rounded_length; + + if (priv->card_info.sdio_block_size == 0) { + unifi_error(priv, "unifi_net_data_malloc: Invalid SDIO block size\n"); + return CSR_RESULT_FAILURE; + } + + rounded_length = (size + priv->card_info.sdio_block_size - 1) & ~(priv->card_info.sdio_block_size - 1); + + /* + * (ETH_HLEN + 2) bytes tailroom for header manipulation + * CSR_WIFI_ALIGN_BYTES bytes headroom for alignment manipulation + */ + skb = dev_alloc_skb(rounded_length + 2 + ETH_HLEN + CSR_WIFI_ALIGN_BYTES); + if (! skb) { + unifi_error(ospriv, "alloc_skb failed.\n"); + bulk_data_slot->os_net_buf_ptr = NULL; + bulk_data_slot->net_buf_length = 0; + bulk_data_slot->os_data_ptr = NULL; + bulk_data_slot->data_length = 0; + return CSR_RESULT_FAILURE; + } + + bulk_data_slot->os_net_buf_ptr = (const unsigned char*)skb; + bulk_data_slot->net_buf_length = rounded_length + 2 + ETH_HLEN + CSR_WIFI_ALIGN_BYTES; + bulk_data_slot->os_data_ptr = (const void*)skb->data; + bulk_data_slot->data_length = size; + + return CSR_RESULT_SUCCESS; +} /* unifi_net_data_malloc() */ + +/* + * --------------------------------------------------------------------------- + * unifi_net_data_free + * + * Free an OS specific net data buffer. + * The bulk_data_slot.length must be initialised to 0. + * + * + * Arguments: + * ospriv Pointer to device private context struct. + * bulk_data_slot Pointer to the bulk data structure that + * holds the data to be freed. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +void +unifi_net_data_free(void *ospriv, bulk_data_desc_t *bulk_data_slot) +{ + struct sk_buff *skb; + CSR_UNUSED(ospriv); + + skb = (struct sk_buff *)bulk_data_slot->os_net_buf_ptr; + dev_kfree_skb(skb); + + bulk_data_slot->net_buf_length = 0; + bulk_data_slot->data_length = 0; + bulk_data_slot->os_data_ptr = bulk_data_slot->os_net_buf_ptr = NULL; + +} /* unifi_net_data_free() */ + + +/* +* --------------------------------------------------------------------------- +* unifi_net_dma_align +* +* DMA align an OS specific net data buffer. +* The buffer must be empty. +* +* +* Arguments: +* ospriv Pointer to device private context struct. +* bulk_data_slot Pointer to the bulk data structure that +* holds the data to be aligned. +* +* Returns: +* None. +* --------------------------------------------------------------------------- +*/ +CsrResult +unifi_net_dma_align(void *ospriv, bulk_data_desc_t *bulk_data_slot) +{ + struct sk_buff *skb; + unsigned long buf_address; + int offset; + unifi_priv_t *priv = (unifi_priv_t*)ospriv; + + if ((bulk_data_slot == NULL) || (CSR_WIFI_ALIGN_BYTES == 0)) { + return CSR_RESULT_SUCCESS; + } + + if ((bulk_data_slot->os_data_ptr == NULL) || (bulk_data_slot->data_length == 0)) { + return CSR_RESULT_SUCCESS; + } + + buf_address = (unsigned long)(bulk_data_slot->os_data_ptr) & (CSR_WIFI_ALIGN_BYTES - 1); + + unifi_trace(priv, UDBG5, + "unifi_net_dma_align: Allign buffer (0x%p) by %d bytes\n", + bulk_data_slot->os_data_ptr, buf_address); + + offset = CSR_WIFI_ALIGN_BYTES - buf_address; + if (offset < 0) { + unifi_error(priv, "unifi_net_dma_align: Failed (offset=%d)\n", offset); + return CSR_RESULT_FAILURE; + } + + skb = (struct sk_buff*)(bulk_data_slot->os_net_buf_ptr); + skb_reserve(skb, offset); + bulk_data_slot->os_net_buf_ptr = (const unsigned char*)skb; + bulk_data_slot->os_data_ptr = (const void*)(skb->data); + + return CSR_RESULT_SUCCESS; + +} /* unifi_net_dma_align() */ + +#ifdef ANDROID_TIMESTAMP +static volatile unsigned int printk_cpu = UINT_MAX; +char tbuf[30]; + +char* print_time(void ) +{ + unsigned long long t; + unsigned long nanosec_rem; + + t = cpu_clock(printk_cpu); + nanosec_rem = do_div(t, 1000000000); + sprintf(tbuf, "[%5lu.%06lu] ", + (unsigned long) t, + nanosec_rem / 1000); + + return tbuf; +} +#endif + + +/* Module parameters */ +extern int unifi_debug; + +#ifdef UNIFI_DEBUG +#define DEBUG_BUFFER_SIZE 120 + +#define FORMAT_TRACE(_s, _len, _args, _fmt) \ + do { \ + va_start(_args, _fmt); \ + _len += vsnprintf(&(_s)[_len], \ + (DEBUG_BUFFER_SIZE - _len), \ + _fmt, _args); \ + va_end(_args); \ + if (_len >= DEBUG_BUFFER_SIZE) { \ + (_s)[DEBUG_BUFFER_SIZE - 2] = '\n'; \ + (_s)[DEBUG_BUFFER_SIZE - 1] = 0; \ + } \ + } while (0) +#endif /* UNIFI_DEBUG */ + +void +unifi_error(void* ospriv, const char *fmt, ...) +{ +#ifdef UNIFI_DEBUG + unifi_priv_t *priv = (unifi_priv_t*) ospriv; + char s[DEBUG_BUFFER_SIZE]; + va_list args; + unsigned int len; +#ifdef ANDROID_TIMESTAMP + if (priv != NULL) { + len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "%s unifi%d: ", print_time(), priv->instance); + } else { + len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "%s unifi: ", print_time()); + } +#else + if (priv != NULL) { + len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "unifi%d: ", priv->instance); + } else { + len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "unifi: "); + } +#endif /* ANDROID_TIMESTAMP */ + FORMAT_TRACE(s, len, args, fmt); + + printk("%s", s); +#endif /* UNIFI_DEBUG */ +} + +void +unifi_warning(void* ospriv, const char *fmt, ...) +{ +#ifdef UNIFI_DEBUG + unifi_priv_t *priv = (unifi_priv_t*) ospriv; + char s[DEBUG_BUFFER_SIZE]; + va_list args; + unsigned int len; + +#ifdef ANDROID_TIMESTAMP + if (priv != NULL) { + len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_WARNING "%s unifi%d: ", print_time(), priv->instance); + } else { + len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_WARNING "%s unifi: ", print_time()); + } +#else + if (priv != NULL) { + len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_WARNING "unifi%d: ", priv->instance); + } else { + len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_WARNING "unifi: "); + } +#endif /* ANDROID_TIMESTAMP */ + + FORMAT_TRACE(s, len, args, fmt); + + printk("%s", s); +#endif /* UNIFI_DEBUG */ +} + + +void +unifi_notice(void* ospriv, const char *fmt, ...) +{ +#ifdef UNIFI_DEBUG + unifi_priv_t *priv = (unifi_priv_t*) ospriv; + char s[DEBUG_BUFFER_SIZE]; + va_list args; + unsigned int len; + +#ifdef ANDROID_TIMESTAMP + if (priv != NULL) { + len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_NOTICE "%s unifi%d: ", print_time(), priv->instance); + } else { + len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_NOTICE "%s unifi: ", print_time()); + } +#else + if (priv != NULL) { + len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_NOTICE "unifi%d: ", priv->instance); + } else { + len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_NOTICE "unifi: "); + } +#endif /* ANDROID_TIMESTAMP */ + + FORMAT_TRACE(s, len, args, fmt); + + printk("%s", s); +#endif /* UNIFI_DEBUG */ +} + + +void +unifi_info(void* ospriv, const char *fmt, ...) +{ +#ifdef UNIFI_DEBUG + unifi_priv_t *priv = (unifi_priv_t*) ospriv; + char s[DEBUG_BUFFER_SIZE]; + va_list args; + unsigned int len; + +#ifdef ANDROID_TIMESTAMP + if (priv != NULL) { + len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_INFO "%s unifi%d: ", print_time(), priv->instance); + } else { + len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_INFO "%s unifi: ", print_time()); + } +#else + if (priv != NULL) { + len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_INFO "unifi%d: ", priv->instance); + } else { + len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_INFO "unifi: "); + } +#endif /* ANDROID_TIMESTAMP */ + + FORMAT_TRACE(s, len, args, fmt); + + printk("%s", s); +#endif /* UNIFI_DEBUG */ +} + +/* debugging */ +void +unifi_trace(void* ospriv, int level, const char *fmt, ...) +{ +#ifdef UNIFI_DEBUG + unifi_priv_t *priv = (unifi_priv_t*) ospriv; + char s[DEBUG_BUFFER_SIZE]; + va_list args; + unsigned int len; + + if (unifi_debug >= level) { +#ifdef ANDROID_TIMESTAMP + if (priv != NULL) { + len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "%s unifi%d: ", print_time(), priv->instance); + } else { + len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "%s unifi: ", print_time()); + } +#else + if (priv != NULL) { + len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "unifi%d: ", priv->instance); + } else { + len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "unifi: "); + } +#endif /* ANDROID_TIMESTAMP */ + + FORMAT_TRACE(s, len, args, fmt); + + printk("%s", s); + } +#endif /* UNIFI_DEBUG */ +} + +/* + * --------------------------------------------------------------------------- + * + * Debugging support. + * + * --------------------------------------------------------------------------- + */ + +#ifdef UNIFI_DEBUG + +/* Memory dump with level filter controlled by unifi_debug */ +void +unifi_dump(void *ospriv, int level, const char *msg, void *mem, CsrUint16 len) +{ + unifi_priv_t *priv = (unifi_priv_t*) ospriv; + + if (unifi_debug >= level) { +#ifdef ANDROID_TIMESTAMP + if (priv != NULL) { + printk(KERN_ERR "%s unifi%d: --- dump: %s ---\n", print_time(), priv->instance, msg ? msg : ""); + } else { + printk(KERN_ERR "%s unifi: --- dump: %s ---\n", print_time(), msg ? msg : ""); + } +#else + if (priv != NULL) { + printk(KERN_ERR "unifi%d: --- dump: %s ---\n", priv->instance, msg ? msg : ""); + } else { + printk(KERN_ERR "unifi: --- dump: %s ---\n", msg ? msg : ""); + } +#endif /* ANDROID_TIMESTAMP */ + dump(mem, len); + + if (priv != NULL) { + printk(KERN_ERR "unifi%d: --- end of dump ---\n", priv->instance); + } else { + printk(KERN_ERR "unifi: --- end of dump ---\n"); + } + } +} + +/* Memory dump that appears all the time, use sparingly */ +void +dump(void *mem, CsrUint16 len) +{ + int i, col = 0; + unsigned char *pdata = (unsigned char *)mem; +#ifdef ANDROID_TIMESTAMP + printk("timestamp %s \n", print_time()); +#endif /* ANDROID_TIMESTAMP */ + if (mem == NULL) { + printk("(null dump)\n"); + return; + } + for (i = 0; i < len; i++) { + if (col == 0) { + printk("0x%02X: ", i); + } + + printk(" %02X", pdata[i]); + + if (++col == 16) { + printk("\n"); + col = 0; + } + } + if (col) { + printk("\n"); + } +} /* dump() */ + + +void +dump16(void *mem, CsrUint16 len) +{ + int i, col=0; + unsigned short *p = (unsigned short *)mem; +#ifdef ANDROID_TIMESTAMP + printk("timestamp %s \n", print_time()); +#endif /* ANDROID_TIMESTAMP */ + for (i = 0; i < len; i+=2) { + if (col == 0) { + printk("0x%02X: ", i); + } + + printk(" %04X", *p++); + + if (++col == 8) { + printk("\n"); + col = 0; + } + } + if (col) { + printk("\n"); + } +} + + +#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE +void +dump_str(void *mem, CsrUint16 len) +{ + int i, col = 0; + unsigned char *pdata = (unsigned char *)mem; +#ifdef ANDROID_TIMESTAMP + printk("timestamp %s \n", print_time()); +#endif /* ANDROID_TIMESTAMP */ + for (i = 0; i < len; i++) { + printk("%c", pdata[i]); + } + if (col) { + printk("\n"); + } + +} /* dump_str() */ +#endif /* CSR_ONLY_NOTES */ + + +#endif /* UNIFI_DEBUG */ + + +/* --------------------------------------------------------------------------- + * - End - + * ------------------------------------------------------------------------- */ diff --git a/drivers/staging/csr/putest.c b/drivers/staging/csr/putest.c new file mode 100644 index 0000000..1b2c7c2 --- /dev/null +++ b/drivers/staging/csr/putest.c @@ -0,0 +1,664 @@ +/* + * *************************************************************************** + * FILE: putest.c + * + * PURPOSE: putest related functions. + * + * Copyright (C) 2008-2009 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * *************************************************************************** + */ + +#include +#include + +#include "unifi_priv.h" +#include "csr_wifi_hip_chiphelper.h" + +#define UNIFI_PROC_BOTH 3 + + +int unifi_putest_cmd52_read(unifi_priv_t *priv, unsigned char *arg) +{ + struct unifi_putest_cmd52 cmd52_params; + CsrUint8 *arg_pos; + unsigned int cmd_param_size; + int r; + CsrResult csrResult; + unsigned char ret_buffer[32]; + CsrUint8 *ret_buffer_pos; + CsrUint8 retries; + + arg_pos = (CsrUint8*)(((unifi_putest_command_t*)arg) + 1); + if (get_user(cmd_param_size, (int*)arg_pos)) { + unifi_error(priv, + "unifi_putest_cmd52_read: Failed to get the argument\n"); + return -EFAULT; + } + + if (cmd_param_size != sizeof(struct unifi_putest_cmd52)) { + unifi_error(priv, + "unifi_putest_cmd52_read: cmd52 struct mismatch\n"); + return -EINVAL; + } + + arg_pos += sizeof(unsigned int); + if (copy_from_user(&cmd52_params, + (void*)arg_pos, + sizeof(struct unifi_putest_cmd52))) { + unifi_error(priv, + "unifi_putest_cmd52_read: Failed to get the cmd52 params\n"); + return -EFAULT; + } + + unifi_trace(priv, UDBG2, "cmd52r: func=%d addr=0x%x ", + cmd52_params.funcnum, cmd52_params.addr); + + retries = 3; + CsrSdioClaim(priv->sdio); + do { + if (cmd52_params.funcnum == 0) { + csrResult = CsrSdioF0Read8(priv->sdio, cmd52_params.addr, &cmd52_params.data); + } else { + csrResult = CsrSdioRead8(priv->sdio, cmd52_params.addr, &cmd52_params.data); + } + } while (--retries && ((csrResult == CSR_SDIO_RESULT_CRC_ERROR) || (csrResult == CSR_SDIO_RESULT_TIMEOUT))); + CsrSdioRelease(priv->sdio); + + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, + "\nunifi_putest_cmd52_read: Read8() failed (csrResult=0x%x)\n", csrResult); + return -EFAULT; + } + unifi_trace(priv, UDBG2, "data=%d\n", cmd52_params.data); + + /* Copy the info to the out buffer */ + *(unifi_putest_command_t*)ret_buffer = UNIFI_PUTEST_CMD52_READ; + ret_buffer_pos = (CsrUint8*)(((unifi_putest_command_t*)ret_buffer) + 1); + *(unsigned int*)ret_buffer_pos = sizeof(struct unifi_putest_cmd52); + ret_buffer_pos += sizeof(unsigned int); + memcpy(ret_buffer_pos, &cmd52_params, sizeof(struct unifi_putest_cmd52)); + ret_buffer_pos += sizeof(struct unifi_putest_cmd52); + + r = copy_to_user((void*)arg, + ret_buffer, + ret_buffer_pos - ret_buffer); + if (r) { + unifi_error(priv, + "unifi_putest_cmd52_read: Failed to return the data\n"); + return -EFAULT; + } + + return 0; +} + + +int unifi_putest_cmd52_write(unifi_priv_t *priv, unsigned char *arg) +{ + struct unifi_putest_cmd52 cmd52_params; + CsrUint8 *arg_pos; + unsigned int cmd_param_size; + CsrResult csrResult; + CsrUint8 retries; + + arg_pos = (CsrUint8*)(((unifi_putest_command_t*)arg) + 1); + if (get_user(cmd_param_size, (int*)arg_pos)) { + unifi_error(priv, + "unifi_putest_cmd52_write: Failed to get the argument\n"); + return -EFAULT; + } + + if (cmd_param_size != sizeof(struct unifi_putest_cmd52)) { + unifi_error(priv, + "unifi_putest_cmd52_write: cmd52 struct mismatch\n"); + return -EINVAL; + } + + arg_pos += sizeof(unsigned int); + if (copy_from_user(&cmd52_params, + (void*)(arg_pos), + sizeof(struct unifi_putest_cmd52))) { + unifi_error(priv, + "unifi_putest_cmd52_write: Failed to get the cmd52 params\n"); + return -EFAULT; + } + + unifi_trace(priv, UDBG2, "cmd52w: func=%d addr=0x%x data=%d\n", + cmd52_params.funcnum, cmd52_params.addr, cmd52_params.data); + + retries = 3; + CsrSdioClaim(priv->sdio); + do { + if (cmd52_params.funcnum == 0) { + csrResult = CsrSdioF0Write8(priv->sdio, cmd52_params.addr, cmd52_params.data); + } else { + csrResult = CsrSdioWrite8(priv->sdio, cmd52_params.addr, cmd52_params.data); + } + } while (--retries && ((csrResult == CSR_SDIO_RESULT_CRC_ERROR) || (csrResult == CSR_SDIO_RESULT_TIMEOUT))); + CsrSdioRelease(priv->sdio); + + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, + "unifi_putest_cmd52_write: Write8() failed (csrResult=0x%x)\n", csrResult); + return -EFAULT; + } + + return 0; +} + +int unifi_putest_gp_read16(unifi_priv_t *priv, unsigned char *arg) +{ + struct unifi_putest_gp_rw16 gp_r16_params; + CsrUint8 *arg_pos; + unsigned int cmd_param_size; + int r; + CsrResult csrResult; + unsigned char ret_buffer[32]; + CsrUint8 *ret_buffer_pos; + + arg_pos = (CsrUint8*)(((unifi_putest_command_t*)arg) + 1); + if (get_user(cmd_param_size, (int*)arg_pos)) { + unifi_error(priv, + "unifi_putest_gp_read16: Failed to get the argument\n"); + return -EFAULT; + } + + if (cmd_param_size != sizeof(struct unifi_putest_gp_rw16)) { + unifi_error(priv, + "unifi_putest_gp_read16: struct mismatch\n"); + return -EINVAL; + } + + arg_pos += sizeof(unsigned int); + if (copy_from_user(&gp_r16_params, + (void*)arg_pos, + sizeof(struct unifi_putest_gp_rw16))) { + unifi_error(priv, + "unifi_putest_gp_read16: Failed to get the params\n"); + return -EFAULT; + } + + csrResult = unifi_card_read16(priv->card, gp_r16_params.addr, &gp_r16_params.data); + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, + "unifi_putest_gp_read16: unifi_card_read16() GP=0x%x failed (csrResult=0x%x)\n", gp_r16_params.addr, csrResult); + return -EFAULT; + } + + unifi_trace(priv, UDBG2, "gp_r16: GP=0x%08x, data=0x%04x\n", gp_r16_params.addr, gp_r16_params.data); + + /* Copy the info to the out buffer */ + *(unifi_putest_command_t*)ret_buffer = UNIFI_PUTEST_GP_READ16; + ret_buffer_pos = (CsrUint8*)(((unifi_putest_command_t*)ret_buffer) + 1); + *(unsigned int*)ret_buffer_pos = sizeof(struct unifi_putest_gp_rw16); + ret_buffer_pos += sizeof(unsigned int); + memcpy(ret_buffer_pos, &gp_r16_params, sizeof(struct unifi_putest_gp_rw16)); + ret_buffer_pos += sizeof(struct unifi_putest_gp_rw16); + + r = copy_to_user((void*)arg, + ret_buffer, + ret_buffer_pos - ret_buffer); + if (r) { + unifi_error(priv, + "unifi_putest_gp_read16: Failed to return the data\n"); + return -EFAULT; + } + + return 0; +} + +int unifi_putest_gp_write16(unifi_priv_t *priv, unsigned char *arg) +{ + struct unifi_putest_gp_rw16 gp_w16_params; + CsrUint8 *arg_pos; + unsigned int cmd_param_size; + CsrResult csrResult; + + arg_pos = (CsrUint8*)(((unifi_putest_command_t*)arg) + 1); + if (get_user(cmd_param_size, (int*)arg_pos)) { + unifi_error(priv, + "unifi_putest_gp_write16: Failed to get the argument\n"); + return -EFAULT; + } + + if (cmd_param_size != sizeof(struct unifi_putest_gp_rw16)) { + unifi_error(priv, + "unifi_putest_gp_write16: struct mismatch\n"); + return -EINVAL; + } + + arg_pos += sizeof(unsigned int); + if (copy_from_user(&gp_w16_params, + (void*)(arg_pos), + sizeof(struct unifi_putest_gp_rw16))) { + unifi_error(priv, + "unifi_putest_gp_write16: Failed to get the params\n"); + return -EFAULT; + } + + unifi_trace(priv, UDBG2, "gp_w16: GP=0x%08x, data=0x%04x\n", gp_w16_params.addr, gp_w16_params.data); + + csrResult = unifi_card_write16(priv->card, gp_w16_params.addr, gp_w16_params.data); + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, + "unifi_putest_gp_write16: unifi_card_write16() GP=%x failed (csrResult=0x%x)\n", gp_w16_params.addr, csrResult); + return -EFAULT; + } + + return 0; +} + +int unifi_putest_set_sdio_clock(unifi_priv_t *priv, unsigned char *arg) +{ + int sdio_clock_speed; + CsrResult csrResult; + + if (get_user(sdio_clock_speed, (int*)(((unifi_putest_command_t*)arg) + 1))) { + unifi_error(priv, + "unifi_putest_set_sdio_clock: Failed to get the argument\n"); + return -EFAULT; + } + + unifi_trace(priv, UDBG2, "set sdio clock: %d KHz\n", sdio_clock_speed); + + CsrSdioClaim(priv->sdio); + csrResult = CsrSdioMaxBusClockFrequencySet(priv->sdio, sdio_clock_speed); + CsrSdioRelease(priv->sdio); + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, + "unifi_putest_set_sdio_clock: Set clock failed (csrResult=0x%x)\n", csrResult); + return -EFAULT; + } + + return 0; +} + + +int unifi_putest_start(unifi_priv_t *priv, unsigned char *arg) +{ + int r; + CsrResult csrResult; + int already_in_test = priv->ptest_mode; + + /* Ensure that sme_sys_suspend() doesn't power down the chip because: + * 1) Power is needed anyway for ptest. + * 2) The app code uses the START ioctl as a reset, so it gets called + * multiple times. If the app stops the XAPs, but the power_down/up + * sequence doesn't actually power down the chip, there can be problems + * resetting, because part of the power_up sequence disables function 1 + */ + priv->ptest_mode = 1; + + /* Suspend the SME and UniFi */ + if (priv->sme_cli) { + r = sme_sys_suspend(priv); + if (r) { + unifi_error(priv, + "unifi_putest_start: failed to suspend UniFi\n"); + return r; + } + } + + /* Application may have stopped the XAPs, but they are needed for reset */ + if (already_in_test) { + csrResult = unifi_start_processors(priv->card); + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, "Failed to start XAPs. Hard reset required.\n"); + } + } else { + /* Ensure chip is powered for the case where there's no unifi_helper */ + CsrSdioClaim(priv->sdio); + csrResult = CsrSdioPowerOn(priv->sdio); + CsrSdioRelease(priv->sdio); + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, "CsrSdioPowerOn csrResult = %d\n", csrResult); + } + } + + csrResult = unifi_init(priv->card); + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, + "unifi_putest_start: failed to init UniFi\n"); + return CsrHipResultToStatus(csrResult); + } + + return 0; +} + + +int unifi_putest_stop(unifi_priv_t *priv, unsigned char *arg) +{ + int r = 0; + CsrResult csrResult; + + /* Application may have stopped the XAPs, but they are needed for reset */ + csrResult = unifi_start_processors(priv->card); + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, "Failed to start XAPs. Hard reset required.\n"); + } + + /* PUTEST_STOP is also used to resume the XAPs after SME coredump. + * Don't power off the chip, leave that to the normal wifi-off which is + * about to carry on. No need to resume the SME either, as it wasn't suspended. + */ + if (priv->coredump_mode) { + priv->coredump_mode = 0; + return 0; + } + + /* At this point function 1 is enabled and the XAPs are running, so it is + * safe to let the card power down. Power is restored later, asynchronously, + * during the wifi_on requested by the SME. + */ + CsrSdioClaim(priv->sdio); + CsrSdioPowerOff(priv->sdio); + CsrSdioRelease(priv->sdio); + + /* Resume the SME and UniFi */ + if (priv->sme_cli) { + r = sme_sys_resume(priv); + if (r) { + unifi_error(priv, + "unifi_putest_stop: failed to resume SME\n"); + } + } + priv->ptest_mode = 0; + + return r; +} + + +int unifi_putest_dl_fw(unifi_priv_t *priv, unsigned char *arg) +{ +#define UF_PUTEST_MAX_FW_FILE_NAME 16 +#define UNIFI_MAX_FW_PATH_LEN 32 + unsigned int fw_name_length; + unsigned char fw_name[UF_PUTEST_MAX_FW_FILE_NAME+1]; + unsigned char *name_buffer; + int postfix; + char fw_path[UNIFI_MAX_FW_PATH_LEN]; + const struct firmware *fw_entry; + struct dlpriv temp_fw_sta; + int r; + CsrResult csrResult; + + /* Get the f/w file name length */ + if (get_user(fw_name_length, (unsigned int*)(((unifi_putest_command_t*)arg) + 1))) { + unifi_error(priv, + "unifi_putest_dl_fw: Failed to get the length argument\n"); + return -EFAULT; + } + + unifi_trace(priv, UDBG2, "unifi_putest_dl_fw: file name size = %d\n", fw_name_length); + + /* Sanity check for the f/w file name length */ + if (fw_name_length > UF_PUTEST_MAX_FW_FILE_NAME) { + unifi_error(priv, + "unifi_putest_dl_fw: F/W file name is too long\n"); + return -EINVAL; + } + + /* Get the f/w file name */ + name_buffer = ((unsigned char*)arg) + sizeof(unifi_putest_command_t) + sizeof(unsigned int); + if (copy_from_user(fw_name, (void*)name_buffer, fw_name_length)) { + unifi_error(priv, "unifi_putest_dl_fw: Failed to get the file name\n"); + return -EFAULT; + } + fw_name[fw_name_length] = '\0'; + unifi_trace(priv, UDBG2, "unifi_putest_dl_fw: file = %s\n", fw_name); + + /* Keep the existing f/w to a temp, we need to restore it later */ + temp_fw_sta = priv->fw_sta; + + /* Get the putest f/w */ + postfix = priv->instance; + scnprintf(fw_path, UNIFI_MAX_FW_PATH_LEN, "unifi-sdio-%d/%s", + postfix, fw_name); + r = request_firmware(&fw_entry, fw_path, priv->unifi_device); + if (r == 0) { + priv->fw_sta.fw_desc = (void *)fw_entry; + priv->fw_sta.dl_data = fw_entry->data; + priv->fw_sta.dl_len = fw_entry->size; + } else { + unifi_error(priv, "Firmware file not available\n"); + return -EINVAL; + } + + /* Application may have stopped the XAPs, but they are needed for reset */ + csrResult = unifi_start_processors(priv->card); + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, "Failed to start XAPs. Hard reset required.\n"); + } + + /* Download the f/w. On UF6xxx this will cause the f/w file to convert + * into patch format and download via the ROM boot loader + */ + csrResult = unifi_download(priv->card, 0x0c00); + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, + "unifi_putest_dl_fw: failed to download the f/w\n"); + goto free_fw; + } + + /* Free the putest f/w... */ +free_fw: + uf_release_firmware(priv, &priv->fw_sta); + /* ... and restore the original f/w */ + priv->fw_sta = temp_fw_sta; + + return CsrHipResultToStatus(csrResult); +} + + +int unifi_putest_dl_fw_buff(unifi_priv_t *priv, unsigned char *arg) +{ + unsigned int fw_length; + unsigned char *fw_buf = NULL; + unsigned char *fw_user_ptr; + struct dlpriv temp_fw_sta; + CsrResult csrResult; + + /* Get the f/w buffer length */ + if (get_user(fw_length, (unsigned int*)(((unifi_putest_command_t*)arg) + 1))) { + unifi_error(priv, + "unifi_putest_dl_fw_buff: Failed to get the length arg\n"); + return -EFAULT; + } + + unifi_trace(priv, UDBG2, "unifi_putest_dl_fw_buff: size = %d\n", fw_length); + + /* Sanity check for the buffer length */ + if (fw_length == 0 || fw_length > 0xfffffff) { + unifi_error(priv, + "unifi_putest_dl_fw_buff: buffer length bad %u\n", fw_length); + return -EINVAL; + } + + /* Buffer for kernel copy of the f/w image */ + fw_buf = CsrPmemAlloc(fw_length); + if (!fw_buf) { + unifi_error(priv, "unifi_putest_dl_fw_buff: malloc fail\n"); + return -ENOMEM; + } + + /* Get the f/w image */ + fw_user_ptr = ((unsigned char*)arg) + sizeof(unifi_putest_command_t) + sizeof(unsigned int); + if (copy_from_user(fw_buf, (void*)fw_user_ptr, fw_length)) { + unifi_error(priv, "unifi_putest_dl_fw_buff: Failed to get the buffer\n"); + CsrPmemFree(fw_buf); + return -EFAULT; + } + + /* Save the existing f/w to a temp, we need to restore it later */ + temp_fw_sta = priv->fw_sta; + + /* Setting fw_desc NULL indicates to the core that no f/w file was loaded + * via the kernel request_firmware() mechanism. This indicates to the core + * that it shouldn't call release_firmware() after the download is done. + */ + priv->fw_sta.fw_desc = NULL; /* No OS f/w resource */ + priv->fw_sta.dl_data = fw_buf; + priv->fw_sta.dl_len = fw_length; + + /* Application may have stopped the XAPs, but they are needed for reset */ + csrResult = unifi_start_processors(priv->card); + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, "Failed to start XAPs. Hard reset required.\n"); + } + + /* Download the f/w. On UF6xxx this will cause the f/w file to convert + * into patch format and download via the ROM boot loader + */ + csrResult = unifi_download(priv->card, 0x0c00); + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, + "unifi_putest_dl_fw_buff: failed to download the f/w\n"); + goto free_fw; + } + +free_fw: + /* Finished with the putest f/w, so restore the station f/w */ + priv->fw_sta = temp_fw_sta; + CsrPmemFree(fw_buf); + + return CsrHipResultToStatus(csrResult); +} + + +int unifi_putest_coredump_prepare(unifi_priv_t *priv, unsigned char *arg) +{ + CsrUint16 data_u16; + CsrInt32 i; + CsrResult r; + + unifi_info(priv, "Preparing for SDIO coredump\n"); +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) + unifi_debug_buf_dump(); +#endif + + /* Sanity check that userspace hasn't called a PUTEST_START, because that + * would have reset UniFi, potentially power cycling it and losing context + */ + if (priv->ptest_mode) { + unifi_error(priv, "PUTEST_START shouldn't be used before a coredump\n"); + } + + /* Flag that the userspace has requested coredump. Even if this preparation + * fails, the SME will call PUTEST_STOP to tidy up. + */ + priv->coredump_mode = 1; + + for (i = 0; i < 3; i++) { + CsrSdioClaim(priv->sdio); + r = CsrSdioRead16(priv->sdio, CHIP_HELPER_UNIFI_GBL_CHIP_VERSION*2, &data_u16); + CsrSdioRelease(priv->sdio); + if (r != CSR_RESULT_SUCCESS) { + unifi_info(priv, "Failed to read chip version! Try %d\n", i); + + /* First try, re-enable function which may have been disabled by f/w panic */ + if (i == 0) { + unifi_info(priv, "Try function enable\n"); + CsrSdioClaim(priv->sdio); + r = CsrSdioFunctionEnable(priv->sdio); + CsrSdioRelease(priv->sdio); + if (r != CSR_RESULT_SUCCESS) { + unifi_error(priv, "CsrSdioFunctionEnable failed %d\n", r); + } + continue; + } + + /* Subsequent tries, reset */ + + /* Set clock speed low */ + CsrSdioClaim(priv->sdio); + r = CsrSdioMaxBusClockFrequencySet(priv->sdio, UNIFI_SDIO_CLOCK_SAFE_HZ); + CsrSdioRelease(priv->sdio); + if (r != CSR_RESULT_SUCCESS) { + unifi_error(priv, "CsrSdioMaxBusClockFrequencySet() failed %d\n", r); + } + + /* Card software reset */ + r = unifi_card_hard_reset(priv->card); + if (r != CSR_RESULT_SUCCESS) { + unifi_error(priv, "unifi_card_hard_reset() failed %d\n", r); + } + } else { + unifi_info(priv, "Read chip version of 0x%04x\n", data_u16); + break; + } + } + + if (r != CSR_RESULT_SUCCESS) { + unifi_error(priv, "Failed to prepare chip\n"); + return -EIO; + } + + /* Stop the XAPs for coredump. The PUTEST_STOP must be called, e.g. at + * Raw SDIO deinit, to resume them. + */ + r = unifi_card_stop_processor(priv->card, UNIFI_PROC_BOTH); + if (r != CSR_RESULT_SUCCESS) { + unifi_error(priv, "Failed to stop processors\n"); + } + + return 0; +} + +int unifi_putest_cmd52_block_read(unifi_priv_t *priv, unsigned char *arg) +{ + struct unifi_putest_block_cmd52_r block_cmd52; + CsrUint8 *arg_pos; + unsigned int cmd_param_size; + CsrResult r; + CsrUint8 *block_local_buffer; + + arg_pos = (CsrUint8*)(((unifi_putest_command_t*)arg) + 1); + if (get_user(cmd_param_size, (int*)arg_pos)) { + unifi_error(priv, + "cmd52r_block: Failed to get the argument\n"); + return -EFAULT; + } + + if (cmd_param_size != sizeof(struct unifi_putest_block_cmd52_r)) { + unifi_error(priv, + "cmd52r_block: cmd52 struct mismatch\n"); + return -EINVAL; + } + + arg_pos += sizeof(unsigned int); + if (copy_from_user(&block_cmd52, + (void*)arg_pos, + sizeof(struct unifi_putest_block_cmd52_r))) { + unifi_error(priv, + "cmd52r_block: Failed to get the cmd52 params\n"); + return -EFAULT; + } + + unifi_trace(priv, UDBG2, "cmd52r_block: func=%d addr=0x%x len=0x%x ", + block_cmd52.funcnum, block_cmd52.addr, block_cmd52.length); + + block_local_buffer = vmalloc(block_cmd52.length); + if (block_local_buffer == NULL) { + unifi_error(priv, "cmd52r_block: Failed to allocate buffer\n"); + return -ENOMEM; + } + + r = unifi_card_readn(priv->card, block_cmd52.addr, block_local_buffer, block_cmd52.length); + if (r != CSR_RESULT_SUCCESS) { + unifi_error(priv, "cmd52r_block: unifi_readn failed\n"); + return -EIO; + } + + if (copy_to_user((void*)block_cmd52.data, + block_local_buffer, + block_cmd52.length)) { + unifi_error(priv, + "cmd52r_block: Failed to return the data\n"); + return -EFAULT; + } + + return 0; +} diff --git a/drivers/staging/csr/sdio_emb.c b/drivers/staging/csr/sdio_emb.c new file mode 100644 index 0000000..f61fdb1 --- /dev/null +++ b/drivers/staging/csr/sdio_emb.c @@ -0,0 +1,732 @@ +/* + * --------------------------------------------------------------------------- + * + * FILE: sdio_emb.c + * + * PURPOSE: Driver instantiation and deletion for SDIO on Linux. + * + * This file brings together the SDIO bus interface, the UniFi + * driver core and the Linux net_device stack. + * + * Copyright (C) 2007-2009 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * --------------------------------------------------------------------------- + */ +#include +#include +#include "csr_wifi_hip_unifi.h" +#include "unifi_priv.h" + +#include "sdioemb/sdio_api.h" + +/* The function driver context, i.e the UniFi Driver */ +static CsrSdioFunctionDriver *sdio_func_drv; + + + +/* sdioemb driver uses POSIX error codes */ +static CsrResult +ConvertSdioToCsrSdioResult(int r) +{ + CsrResult csrResult = CSR_RESULT_FAILURE; + + switch (r) { + case 0: + csrResult = CSR_RESULT_SUCCESS; + break; + case -EIO: + csrResult = CSR_SDIO_RESULT_CRC_ERROR; + break; + /* Timeout errors */ + case -ETIMEDOUT: + case -EBUSY: + csrResult = CSR_SDIO_RESULT_TIMEOUT; + break; + case -ENODEV: + case -ENOMEDIUM: + csrResult = CSR_SDIO_RESULT_NO_DEVICE; + break; + case -EINVAL: + csrResult = CSR_SDIO_RESULT_INVALID_VALUE; + break; + case -ENOMEM: + case -ENOSYS: + case -EILSEQ: + case -ERANGE: + case -ENXIO: + csrResult = CSR_RESULT_FAILURE; + break; + default: + unifi_warning(NULL, "Unrecognised SDIO error code: %d\n", r); + break; + } + + return csrResult; +} + + +CsrResult +CsrSdioRead8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data) +{ + struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; + int err; + err = sdioemb_read8(fdev, address, data); + if (err) { + return ConvertSdioToCsrSdioResult(err); + } + return CSR_RESULT_SUCCESS; +} /* CsrSdioRead8() */ + +CsrResult +CsrSdioWrite8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data) +{ + struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; + int err; + err = sdioemb_write8(fdev, address, data); + if (err) { + return ConvertSdioToCsrSdioResult(err); + } + return CSR_RESULT_SUCCESS; +} /* CsrSdioWrite8() */ + +CsrResult +CsrSdioRead16(CsrSdioFunction *function, CsrUint32 address, CsrUint16 *data) +{ + struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; + int r; + + r = sdioemb_read16(fdev, address, data); + if (r) { + return ConvertSdioToCsrSdioResult(r); + } + + return CSR_RESULT_SUCCESS; +} /* CsrSdioRead16() */ + +CsrResult +CsrSdioWrite16(CsrSdioFunction *function, CsrUint32 address, CsrUint16 data) +{ + struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; + int r; + + r = sdioemb_write16(fdev, address, data); + if (r) { + return ConvertSdioToCsrSdioResult(r); + } + + return CSR_RESULT_SUCCESS; +} /* CsrSdioWrite16() */ + + +CsrResult +CsrSdioF0Read8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data) +{ + struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; + int err; + err = sdioemb_f0_read8(fdev, address, data); + if (err) { + return ConvertSdioToCsrSdioResult(err); + } + return CSR_RESULT_SUCCESS; +} /* CsrSdioF0Read8() */ + + +CsrResult +CsrSdioF0Write8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data) +{ + struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; + int err; + err = sdioemb_f0_write8(fdev, address, data); + if (err) { + return ConvertSdioToCsrSdioResult(err); + } + return CSR_RESULT_SUCCESS; +} /* CsrSdioF0Write8() */ + +CsrResult +CsrSdioRead(CsrSdioFunction *function, CsrUint32 address, void *data, CsrUint32 length) +{ + struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; + int err; + err = sdioemb_read(fdev, address, data, length); + if (err) { + return ConvertSdioToCsrSdioResult(err); + } + return CSR_RESULT_SUCCESS; +} /* CsrSdioRead() */ + +CsrResult +CsrSdioWrite(CsrSdioFunction *function, CsrUint32 address, const void *data, CsrUint32 length) +{ + struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; + int err; + err = sdioemb_write(fdev, address, data, length); + if (err) { + return ConvertSdioToCsrSdioResult(err); + } + return CSR_RESULT_SUCCESS; +} /* CsrSdioWrite() */ + + +CsrResult +CsrSdioBlockSizeSet(CsrSdioFunction *function, CsrUint16 blockSize) +{ + struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; + int r = 0; + + /* Module parameter overrides */ + if (sdio_block_size > -1) { + blockSize = sdio_block_size; + } + + unifi_trace(NULL, UDBG1, "Set SDIO function block size to %d\n", + blockSize); + + r = sdioemb_set_block_size(fdev, blockSize); + if (r) { + unifi_error(NULL, "Error %d setting block size\n", r); + } + + /* Determine the achieved block size to report to the core */ + function->blockSize = fdev->blocksize; + + return ConvertSdioToCsrSdioResult(r); +} /* CsrSdioBlockSizeSet() */ + + +/* + * --------------------------------------------------------------------------- + * CsrSdioMaxBusClockFrequencySet + * + * Set the maximum SDIO bus clock speed to use. + * + * Arguments: + * sdio SDIO context pointer + * maxFrequency maximum clock speed in Hz + * + * Returns: + * an error code. + * --------------------------------------------------------------------------- + */ +CsrResult +CsrSdioMaxBusClockFrequencySet(CsrSdioFunction *function, CsrUint32 maxFrequency) +{ + struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; + CsrUint32 max_khz = maxFrequency/1000; + + if (!max_khz || max_khz > sdio_clock) { + max_khz = sdio_clock; + } + unifi_trace(NULL, UDBG1, "Setting SDIO bus clock to %d kHz\n", max_khz); + sdioemb_set_max_bus_freq(fdev, 1000 * max_khz); + + return CSR_RESULT_SUCCESS; +} /* CsrSdioMaxBusClockFrequencySet() */ + + +/* + * --------------------------------------------------------------------------- + * CsrSdioInterruptEnable + * CsrSdioInterruptDisable + * + * Enable or disable the SDIO interrupt. + * + * Arguments: + * sdio SDIO context pointer + * + * Returns: + * Zero on success or a UniFi driver error code. + * --------------------------------------------------------------------------- + */ +CsrResult +CsrSdioInterruptEnable(CsrSdioFunction *function) +{ + struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; + int r; + + r = sdioemb_interrupt_enable(fdev); + if (r) { + return ConvertSdioToCsrSdioResult(r); + } + + return CSR_RESULT_SUCCESS; +} /* CsrSdioInterruptEnable() */ + +CsrResult +CsrSdioInterruptDisable(CsrSdioFunction *function) +{ + struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; + int r; + + r = sdioemb_interrupt_disable(fdev); + if (r) { + return ConvertSdioToCsrSdioResult(r); + } + + return CSR_RESULT_SUCCESS; +} /* CsrSdioInterruptDisable() */ + + +/* + * --------------------------------------------------------------------------- + * CsrSdioInterruptAcknowledge + * + * Acknowledge an SDIO interrupt. + * + * Arguments: + * sdio SDIO context pointer + * + * Returns: + * Zero on success or a UniFi driver error code. + * --------------------------------------------------------------------------- + */ +void CsrSdioInterruptAcknowledge(CsrSdioFunction *function) +{ + struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; + + sdioemb_interrupt_acknowledge(fdev); +} /* CsrSdioInterruptAcknowledge() */ + + +/* + * --------------------------------------------------------------------------- + * CsrSdioFunctionEnable + * + * Enable i/o on this function. + * + * Arguments: + * sdio SDIO context pointer + * + * Returns: + * UniFi driver error code. + * --------------------------------------------------------------------------- + */ +CsrResult +CsrSdioFunctionEnable(CsrSdioFunction *function) +{ + struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; + int r; + + /* Enable UniFi function (the 802.11 part). */ + r = sdioemb_enable_function(fdev); + if (r) { + unifi_error(NULL, "Failed to enable SDIO function %d\n", fdev->function); + return ConvertSdioToCsrSdioResult(r); + } + return CSR_RESULT_SUCCESS; +} /* CsrSdioFunctionEnable() */ + + +/* + * --------------------------------------------------------------------------- + * CsrSdioFunctionDisable + * + * Disable i/o on this function. + * + * Arguments: + * sdio SDIO context pointer + * + * Returns: + * UniFi driver error code. + * --------------------------------------------------------------------------- + */ +CsrResult +CsrSdioFunctionDisable(CsrSdioFunction *function) +{ + struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; + int r; + + /* Disable UniFi function (the 802.11 part). */ + r = sdioemb_disable_function(fdev); + if (r) { + unifi_error(NULL, "Failed to disable SDIO function %d\n", fdev->function); + return ConvertSdioToCsrSdioResult(r); + } + return CSR_RESULT_SUCCESS; +} /* CsrSdioFunctionDisable() */ + + +/* + * --------------------------------------------------------------------------- + * CsrSdioFunctionActive + * + * No-op as the bus goes to an active state at the start of every + * command. + * + * Arguments: + * sdio SDIO context pointer + * --------------------------------------------------------------------------- + */ +void +CsrSdioFunctionActive(CsrSdioFunction *function) +{ +} /* CsrSdioFunctionActive() */ + +/* + * --------------------------------------------------------------------------- + * CsrSdioFunctionIdle + * + * Set the function as idle. + * + * Arguments: + * sdio SDIO context pointer + * --------------------------------------------------------------------------- + */ +void +CsrSdioFunctionIdle(CsrSdioFunction *function) +{ + struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; + + sdioemb_idle_function(fdev); +} /* CsrSdioFunctionIdle() */ + + +CsrResult +CsrSdioPowerOn(CsrSdioFunction *function) +{ + struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; + + if (disable_power_control != 1) { + sdioemb_power_on(fdev); + } + + return CSR_RESULT_SUCCESS; +} /* CsrSdioPowerOn() */ + +void +CsrSdioPowerOff(CsrSdioFunction *function) +{ + struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; + if (disable_power_control != 1) { + sdioemb_power_off(fdev); + } +} /* CsrSdioPowerOff() */ + + +/* + * --------------------------------------------------------------------------- + * CsrSdioHardReset + * + * Hard Resets UniFi is possible. + * + * Arguments: + * sdio SDIO context pointer + * + * Returns: + * 1 if the SDIO driver is not capable of doing a hard reset. + * 0 if a hard reset was successfully performed. + * -CSR_EIO if an I/O error occured while re-initializing the card. + * This is a fatal, non-recoverable error. + * -CSR_ENODEV if the card is no longer present. + * --------------------------------------------------------------------------- + */ +CsrResult +CsrSdioHardReset(CsrSdioFunction *function) +{ + struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; + int r; + + /* Hard reset can be disabled by a module parameter */ + r = 1; + if (disable_hw_reset != 1) { + r = sdioemb_hard_reset(fdev); /* may return 1 if can't reset */ + if (r < 0) { + return ConvertSdioToCsrSdioResult(r); /* fatal error */ + } + } + + /* Set the SDIO bus width after a hard reset */ + if (buswidth == 1) { + unifi_info(NULL, "Setting SDIO bus width to 1\n"); + sdioemb_set_bus_width(fdev, buswidth); + } else if (buswidth == 4) { + unifi_info(NULL, "Setting SDIO bus width to 4\n"); + sdioemb_set_bus_width(fdev, buswidth); + } + + if(r == 1) + { + return CSR_SDIO_RESULT_NOT_RESET; + } + + return ConvertSdioToCsrSdioResult(r); + +} /* CsrSdioHardReset() */ + + +int csr_sdio_linux_remove_irq(CsrSdioFunction *function) +{ + struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; + + return sdioemb_interrupt_disable(fdev); +} + +int csr_sdio_linux_install_irq(CsrSdioFunction *function) +{ + struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; + + return sdioemb_interrupt_enable(fdev); +} + + +/* + * --------------------------------------------------------------------------- + * uf_glue_sdio_int_handler + * Card interrupt callback. + * + * Arguments: + * fdev SDIO context pointer + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +static void +uf_glue_sdio_int_handler(struct sdioemb_dev *fdev) +{ + CsrSdioFunction *sdio_ctx = fdev->drv_data; + CsrSdioInterruptDsrCallback func_dsr_callback; + + /* If the function driver has registered a handler, call it */ + if (sdio_func_drv && sdio_func_drv->intr) { + /* The function driver may return a DSR. */ + func_dsr_callback = sdio_func_drv->intr(sdio_ctx); + /* If it did return a DSR handle, call it */ + if (func_dsr_callback) { + func_dsr_callback(sdio_ctx); + } + } +} + + +/* + * --------------------------------------------------------------------------- + * uf_glue_sdio_probe + * + * Card insert callback. + * + * Arguments: + * fdev SDIO context pointer + * + * Returns: + * UniFi driver error code. + * --------------------------------------------------------------------------- + */ +static int +uf_glue_sdio_probe(struct sdioemb_dev *fdev) +{ + CsrSdioFunction *sdio_ctx; + + unifi_info(NULL, "UniFi card inserted\n"); + + /* Allocate context and private in one lump */ + sdio_ctx = (CsrSdioFunction *)kmalloc(sizeof(CsrSdioFunction), + GFP_KERNEL); + if (sdio_ctx == NULL) { + return -ENOMEM; + } + + + sdio_ctx->sdioId.manfId = fdev->vendor_id; + sdio_ctx->sdioId.cardId = fdev->device_id; + sdio_ctx->sdioId.sdioFunction = fdev->function; + sdio_ctx->sdioId.sdioInterface = 0; + sdio_ctx->blockSize = fdev->blocksize; + sdio_ctx->priv = (void *)fdev; + sdio_ctx->features = 0; + + /* Module parameter enables byte mode */ + if (sdio_byte_mode) { + sdio_ctx->features |= CSR_SDIO_FEATURE_BYTE_MODE; + } + + /* Set up pointer to func_priv in middle of lump */ + fdev->drv_data = sdio_ctx; + + /* Always override default SDIO bus clock */ + unifi_trace(NULL, UDBG1, "Setting SDIO bus clock to %d kHz\n", sdio_clock); + sdioemb_set_max_bus_freq(fdev, 1000 * sdio_clock); + + /* Call the main UniFi driver inserted handler */ + if (sdio_func_drv && sdio_func_drv->inserted) { + uf_add_os_device(fdev->slot_id, fdev->os_device); + sdio_func_drv->inserted(sdio_ctx); + } + + return 0; +} /* uf_glue_sdio_probe() */ + + +/* + * --------------------------------------------------------------------------- + * uf_sdio_remove + * + * Card removal callback. + * + * Arguments: + * fdev SDIO device + * + * Returns: + * UniFi driver error code. + * --------------------------------------------------------------------------- + */ +static void +uf_sdio_remove(struct sdioemb_dev *fdev) +{ + CsrSdioFunction *sdio_ctx = fdev->drv_data; + + unifi_info(NULL, "UniFi card removed\n"); + + /* Clean up the SDIO function driver */ + if (sdio_func_drv && sdio_func_drv->removed) { + sdio_func_drv->removed(sdio_ctx); + } + + kfree(sdio_ctx); + +} /* uf_sdio_remove */ + + +/* + * --------------------------------------------------------------------------- + * uf_glue_sdio_suspend + * + * System suspend callback. + * + * Arguments: + * fdev SDIO device + * + * Returns: + * + * --------------------------------------------------------------------------- + */ +static void +uf_glue_sdio_suspend(struct sdioemb_dev *fdev) +{ + CsrSdioFunction *sdio_ctx = fdev->drv_data; + + unifi_trace(NULL, UDBG3, "Suspending...\n"); + + /* Pass event to UniFi Driver. */ + if (sdio_func_drv && sdio_func_drv->suspend) { + sdio_func_drv->suspend(sdio_ctx); + } + +} /* uf_glue_sdio_suspend() */ + + +/* + * --------------------------------------------------------------------------- + * uf_glue_sdio_resume + * + * System resume callback. + * + * Arguments: + * fdev SDIO device + * + * Returns: + * + * --------------------------------------------------------------------------- + */ +static void +uf_glue_sdio_resume(struct sdioemb_dev *fdev) +{ + CsrSdioFunction *sdio_ctx = fdev->drv_data; + + unifi_trace(NULL, UDBG3, "Resuming...\n"); + + /* Pass event to UniFi Driver. */ + if (sdio_func_drv && sdio_func_drv->resume) { + sdio_func_drv->resume(sdio_ctx); + } +} /* uf_glue_sdio_resume() */ + + + + +static struct sdioemb_func_driver unifi_sdioemb = { + .name = "unifi", + .id_table = NULL, /* Filled in when main driver registers */ + + .probe = uf_glue_sdio_probe, + .remove = uf_sdio_remove, + .card_int_handler = uf_glue_sdio_int_handler, + .suspend = uf_glue_sdio_suspend, + .resume = uf_glue_sdio_resume, +}; + + +/* + * --------------------------------------------------------------------------- + * CsrSdioFunctionDriverRegister + * CsrSdioFunctionDriverUnregister + * + * These functions are called from the main module load and unload + * functions. They perform the appropriate operations for the + * SDIOemb driver. + * + * Arguments: + * None. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +CsrResult +CsrSdioFunctionDriverRegister(CsrSdioFunctionDriver *sdio_drv) +{ + int r; + int i; + + printk("Unifi: Using CSR embedded SDIO driver\n"); + + if (sdio_func_drv) { + unifi_error(NULL, "sdio_emb: UniFi driver already registered\n"); + return CSR_SDIO_RESULT_INVALID_VALUE; + } + + /* Build ID table to pass to sdioemb */ + unifi_sdioemb.id_table = CsrPmemAlloc(sizeof(struct sdioemb_id_table) * (sdio_drv->idsCount + 1)); + if (unifi_sdioemb.id_table == NULL) { + unifi_error(NULL, "sdio_emb: Failed to allocate memory for ID table (%d IDs)\n", sdio_drv->idsCount); + return CSR_RESULT_FAILURE; + } + for (i = 0; i < sdio_drv->idsCount; i++) { + unifi_sdioemb.id_table[i].vendor_id = sdio_drv->ids[i].manfId; + unifi_sdioemb.id_table[i].device_id = sdio_drv->ids[i].cardId; + unifi_sdioemb.id_table[i].function = sdio_drv->ids[i].sdioFunction; + unifi_sdioemb.id_table[i].interface = sdio_drv->ids[i].sdioInterface; + } + unifi_sdioemb.id_table[i].vendor_id = 0; + unifi_sdioemb.id_table[i].device_id = 0; + unifi_sdioemb.id_table[i].function = 0; + unifi_sdioemb.id_table[i].interface = 0; + + /* Save the registered driver description */ + sdio_func_drv = sdio_drv; + + /* Register ourself with sdioemb */ + r = sdioemb_driver_register(&unifi_sdioemb); + if (r) { + unifi_error(NULL, "Failed to register UniFi SDIO driver: %d\n", r); + return ConvertSdioToCsrSdioResult(r); + } + + return CSR_RESULT_SUCCESS; +} /* CsrSdioFunctionDriverRegister() */ + + +void +CsrSdioFunctionDriverUnregister(CsrSdioFunctionDriver *sdio_drv) +{ + sdioemb_driver_unregister(&unifi_sdioemb); + + sdio_func_drv = NULL; + + CsrPmemFree(unifi_sdioemb.id_table); + unifi_sdioemb.id_table = NULL; +} /* CsrSdioFunctionDriverUnregister() */ + diff --git a/drivers/staging/csr/sdio_events.c b/drivers/staging/csr/sdio_events.c new file mode 100644 index 0000000..e4f2d0d --- /dev/null +++ b/drivers/staging/csr/sdio_events.c @@ -0,0 +1,87 @@ +/* + * --------------------------------------------------------------------------- + * FILE: sdio_events.c + * + * PURPOSE: + * Process the events received by the SDIO glue layer. + * Optional part of the porting exercise. + * + * Copyright (C) 2009 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * --------------------------------------------------------------------------- + */ +#include "unifi_priv.h" + + +/* + * Porting Notes: + * There are two ways to support the suspend/resume system events in a driver. + * In some operating systems these events are delivered to the OS driver + * directly from the system. In this case, the OS driver needs to pass these + * events to the API described in the CSR SDIO Abstration API document. + * In Linux, and other embedded operating systems, the suspend/resume events + * come from the SDIO driver. In this case, simply get these events in the + * SDIO glue layer and notify the OS layer. + * + * In either case, typically, the events are processed by the SME. + * Use the unifi_sys_suspend_ind() and unifi_sys_resume_ind() to pass + * the events to the SME. + */ + +/* + * --------------------------------------------------------------------------- + * unifi_suspend + * + * Handles a suspend request from the SDIO driver. + * + * Arguments: + * ospriv Pointer to OS driver context. + * + * --------------------------------------------------------------------------- + */ +void unifi_suspend(void *ospriv) +{ + unifi_priv_t *priv = ospriv; + int interfaceTag=0; + + /* Stop network traffic. */ + /* need to stop all the netdevices*/ + for( interfaceTag=0;interfaceTaginterfacePriv[interfaceTag]; + if (interfacePriv->netdev_registered == 1) + { + netif_carrier_off(priv->netdev[interfaceTag]); + UF_NETIF_TX_STOP_ALL_QUEUES(priv->netdev[interfaceTag]); + } + } + sme_sys_suspend(priv); +} /* unifi_suspend() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_resume + * + * Handles a resume request from the SDIO driver. + * + * Arguments: + * ospriv Pointer to OS driver context. + * + * --------------------------------------------------------------------------- + */ +void unifi_resume(void *ospriv) +{ + unifi_priv_t *priv = ospriv; + int r; + + r = sme_sys_resume(priv); + if (r) { + unifi_error(priv, "Failed to resume UniFi\n"); + } + +} /* unifi_resume() */ + diff --git a/drivers/staging/csr/sdio_mmc.c b/drivers/staging/csr/sdio_mmc.c new file mode 100644 index 0000000..c850834 --- /dev/null +++ b/drivers/staging/csr/sdio_mmc.c @@ -0,0 +1,1165 @@ +/* + * --------------------------------------------------------------------------- + * + * FILE: sdio_mmc.c + * + * PURPOSE: SDIO driver interface for generic MMC stack. + * + * Copyright (C) 2008-2009 by Cambridge Silicon Radio Ltd. + * + * --------------------------------------------------------------------------- + */ +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "unifi_priv.h" + + +static CsrSdioFunctionDriver *sdio_func_drv; + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) +/* + * We need to keep track of the power on/off because we can not call + * mmc_power_restore_host() when the card is already powered. + * Even then, we need to patch the MMC driver to add a power_restore handler + * in the mmc_sdio_ops structure. If the MMC driver is not patched, + * mmc_power_save_host() and mmc_power_restore_host() are no-ops. + */ +static int card_is_powered = 1; +#endif /* 2.6.32 */ + +/* MMC uses ENOMEDIUM to indicate card gone away */ + +static CsrResult +ConvertSdioToCsrSdioResult(int r) +{ + CsrResult csrResult = CSR_RESULT_FAILURE; + + switch (r) { + case 0: + csrResult = CSR_RESULT_SUCCESS; + break; + case -EIO: + case -EILSEQ: + csrResult = CSR_SDIO_RESULT_CRC_ERROR; + break; + /* Timeout errors */ + case -ETIMEDOUT: + case -EBUSY: + csrResult = CSR_SDIO_RESULT_TIMEOUT; + break; + case -ENODEV: + case -ENOMEDIUM: + csrResult = CSR_SDIO_RESULT_NO_DEVICE; + break; + case -EINVAL: + csrResult = CSR_SDIO_RESULT_INVALID_VALUE; + break; + case -ENOMEM: + case -ENOSYS: + case -ERANGE: + case -ENXIO: + csrResult = CSR_RESULT_FAILURE; + break; + default: + unifi_warning(NULL, "Unrecognised SDIO error code: %d\n", r); + break; + } + + return csrResult; +} + + +static int +csr_io_rw_direct(struct mmc_card *card, int write, uint8_t fn, + uint32_t addr, uint8_t in, uint8_t* out) +{ + struct mmc_command cmd; + int err; + + BUG_ON(!card); + BUG_ON(fn > 7); + + memset(&cmd, 0, sizeof(struct mmc_command)); + + cmd.opcode = SD_IO_RW_DIRECT; + cmd.arg = write ? 0x80000000 : 0x00000000; + cmd.arg |= fn << 28; + cmd.arg |= (write && out) ? 0x08000000 : 0x00000000; + cmd.arg |= addr << 9; + cmd.arg |= in; + cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_AC; + + err = mmc_wait_for_cmd(card->host, &cmd, 0); + if (err) + return err; + + /* this function is not exported, so we will need to sort it out here + * for now, lets hard code it to sdio */ + if (0) { + /* old arg (mmc_host_is_spi(card->host)) { */ + /* host driver already reported errors */ + } else { + if (cmd.resp[0] & R5_ERROR) { + printk(KERN_ERR "%s: r5 error 0x%02x\n", + __FUNCTION__, cmd.resp[0]); + return -EIO; + } + if (cmd.resp[0] & R5_FUNCTION_NUMBER) + return -EINVAL; + if (cmd.resp[0] & R5_OUT_OF_RANGE) + return -ERANGE; + } + + if (out) { + if (0) { /* old argument (mmc_host_is_spi(card->host)) */ + *out = (cmd.resp[0] >> 8) & 0xFF; + } + else { + *out = cmd.resp[0] & 0xFF; + } + } + + return CSR_RESULT_SUCCESS; +} + + +CsrResult +CsrSdioRead8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data) +{ + struct sdio_func *func = (struct sdio_func *)function->priv; + int err = 0; + + _sdio_claim_host(func); + *data = sdio_readb(func, address, &err); + _sdio_release_host(func); + + if (err) { + func_exit_r(err); + return ConvertSdioToCsrSdioResult(err); + } + + return CSR_RESULT_SUCCESS; +} /* CsrSdioRead8() */ + +CsrResult +CsrSdioWrite8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data) +{ + struct sdio_func *func = (struct sdio_func *)function->priv; + int err = 0; + + _sdio_claim_host(func); + sdio_writeb(func, data, address, &err); + _sdio_release_host(func); + + if (err) { + func_exit_r(err); + return ConvertSdioToCsrSdioResult(err); + } + + return CSR_RESULT_SUCCESS; +} /* CsrSdioWrite8() */ + +CsrResult +CsrSdioRead16(CsrSdioFunction *function, CsrUint32 address, CsrUint16 *data) +{ + struct sdio_func *func = (struct sdio_func *)function->priv; + int err; + uint8_t b0, b1; + + _sdio_claim_host(func); + b0 = sdio_readb(func, address, &err); + if (err) { + _sdio_release_host(func); + return ConvertSdioToCsrSdioResult(err); + } + + b1 = sdio_readb(func, address+1, &err); + if (err) { + _sdio_release_host(func); + return ConvertSdioToCsrSdioResult(err); + } + _sdio_release_host(func); + + *data = ((uint16_t)b1 << 8) | b0; + + return CSR_RESULT_SUCCESS; +} /* CsrSdioRead16() */ + + +CsrResult +CsrSdioWrite16(CsrSdioFunction *function, CsrUint32 address, CsrUint16 data) +{ + struct sdio_func *func = (struct sdio_func *)function->priv; + int err; + uint8_t b0, b1; + + _sdio_claim_host(func); + b1 = (data >> 8) & 0xFF; + sdio_writeb(func, b1, address+1, &err); + if (err) { + _sdio_release_host(func); + return ConvertSdioToCsrSdioResult(err); + } + + b0 = data & 0xFF; + sdio_writeb(func, b0, address, &err); + if (err) { + _sdio_release_host(func); + return ConvertSdioToCsrSdioResult(err); + } + + _sdio_release_host(func); + return CSR_RESULT_SUCCESS; +} /* CsrSdioWrite16() */ + + +CsrResult +CsrSdioF0Read8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data) +{ + struct sdio_func *func = (struct sdio_func *)function->priv; + int err = 0; + + _sdio_claim_host(func); +#ifdef MMC_QUIRK_LENIENT_FN0 + *data = sdio_f0_readb(func, address, &err); +#else + err = csr_io_rw_direct(func->card, 0, 0, address, 0, data); +#endif + _sdio_release_host(func); + + if (err) { + func_exit_r(err); + return ConvertSdioToCsrSdioResult(err); + } + + return CSR_RESULT_SUCCESS; +} /* CsrSdioF0Read8() */ + +CsrResult +CsrSdioF0Write8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data) +{ + struct sdio_func *func = (struct sdio_func *)function->priv; + int err = 0; + + _sdio_claim_host(func); +#ifdef MMC_QUIRK_LENIENT_FN0 + sdio_f0_writeb(func, data, address, &err); +#else + err = csr_io_rw_direct(func->card, 1, 0, address, data, NULL); +#endif + _sdio_release_host(func); + + if (err) { + func_exit_r(err); + return ConvertSdioToCsrSdioResult(err); + } + + return CSR_RESULT_SUCCESS; +} /* CsrSdioF0Write8() */ + + +CsrResult +CsrSdioRead(CsrSdioFunction *function, CsrUint32 address, void *data, CsrUint32 length) +{ + struct sdio_func *func = (struct sdio_func *)function->priv; + int err; + + _sdio_claim_host(func); + err = sdio_readsb(func, data, address, length); + _sdio_release_host(func); + + if (err) { + func_exit_r(err); + return ConvertSdioToCsrSdioResult(err); + } + + return CSR_RESULT_SUCCESS; +} /* CsrSdioRead() */ + +CsrResult +CsrSdioWrite(CsrSdioFunction *function, CsrUint32 address, const void *data, CsrUint32 length) +{ + struct sdio_func *func = (struct sdio_func *)function->priv; + int err; + + _sdio_claim_host(func); + err = sdio_writesb(func, address, (void*)data, length); + _sdio_release_host(func); + + if (err) { + func_exit_r(err); + return ConvertSdioToCsrSdioResult(err); + } + + return CSR_RESULT_SUCCESS; +} /* CsrSdioWrite() */ + + +static int +csr_sdio_enable_hs(struct mmc_card *card) +{ + int ret; + u8 speed; + + if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED)) + return 0; + + if (!card->cccr.high_speed) + return 0; + + ret = csr_io_rw_direct(card, 0, 0, SDIO_CCCR_SPEED, 0, &speed); + if (ret) + return ret; + + speed |= SDIO_SPEED_EHS; + + ret = csr_io_rw_direct(card, 1, 0, SDIO_CCCR_SPEED, speed, NULL); + if (ret) + return ret; + + mmc_card_set_highspeed(card); + card->host->ios.timing = MMC_TIMING_SD_HS; + card->host->ops->set_ios(card->host, &card->host->ios); + + return 0; +} + +static int +csr_sdio_disable_hs(struct mmc_card *card) +{ + int ret; + u8 speed; + + if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED)) + return 0; + + if (!card->cccr.high_speed) + return 0; + + ret = csr_io_rw_direct(card, 0, 0, SDIO_CCCR_SPEED, 0, &speed); + if (ret) + return ret; + + speed &= ~SDIO_SPEED_EHS; + + ret = csr_io_rw_direct(card, 1, 0, SDIO_CCCR_SPEED, speed, NULL); + if (ret) + return ret; + + card->state &= ~MMC_STATE_HIGHSPEED; + card->host->ios.timing = MMC_TIMING_LEGACY; + card->host->ops->set_ios(card->host, &card->host->ios); + + return 0; +} + + +/* + * --------------------------------------------------------------------------- + * CsrSdioMaxBusClockFrequencySet + * + * Set the maximum SDIO bus clock speed to use. + * + * Arguments: + * sdio SDIO context pointer + * maxFrequency maximum clock speed in Hz + * + * Returns: + * an error code. + * --------------------------------------------------------------------------- + */ +CsrResult +CsrSdioMaxBusClockFrequencySet(CsrSdioFunction *function, CsrUint32 maxFrequency) +{ + struct sdio_func *func = (struct sdio_func *)function->priv; + struct mmc_host *host = func->card->host; + struct mmc_ios *ios = &host->ios; + unsigned int max_hz; + int err; + CsrUint32 max_khz = maxFrequency/1000; + + if (!max_khz || max_khz > sdio_clock) { + max_khz = sdio_clock; + } + + _sdio_claim_host(func); + max_hz = 1000 * max_khz; + if (max_hz > host->f_max) { + max_hz = host->f_max; + } + + if (max_hz > 25000000) { + err = csr_sdio_enable_hs(func->card); + } else { + err = csr_sdio_disable_hs(func->card); + } + if (err) { + printk(KERN_ERR "SDIO warning: Failed to configure SDIO clock mode\n"); + _sdio_release_host(func); + return CSR_RESULT_SUCCESS; + } + + ios->clock = max_hz; + host->ops->set_ios(host, ios); + + _sdio_release_host(func); + + return CSR_RESULT_SUCCESS; +} /* CsrSdioMaxBusClockFrequencySet() */ + + +/* + * --------------------------------------------------------------------------- + * CsrSdioInterruptEnable + * CsrSdioInterruptDisable + * + * Enable or disable the SDIO interrupt. + * The driver disables the SDIO interrupt until the i/o thread can + * process it. + * The SDIO interrupt can be disabled by modifying the SDIO_INT_ENABLE + * register in the Card Common Control Register block, but this requires + * two CMD52 operations. A better solution is to mask the interrupt at + * the host controller. + * + * Arguments: + * sdio SDIO context pointer + * + * Returns: + * Zero on success or a UniFi driver error code. + * + * --------------------------------------------------------------------------- + */ +CsrResult +CsrSdioInterruptEnable(CsrSdioFunction *function) +{ + struct sdio_func *func = (struct sdio_func *)function->priv; + int err = 0; + +#ifdef CSR_CONFIG_MMC_INT_BYPASS_KSOFTIRQD + sdio_unblock_card_irq(func); +#else + _sdio_claim_host(func); + /* Write the Int Enable in CCCR block */ +#ifdef MMC_QUIRK_LENIENT_FN0 + sdio_f0_writeb(func, 0x3, SDIO_CCCR_IENx, &err); +#else + err = csr_io_rw_direct(func->card, 1, 0, SDIO_CCCR_IENx, 0x03, NULL); +#endif + _sdio_release_host(func); + + func_exit(); + if (err) { + return ConvertSdioToCsrSdioResult(err); + } +#endif + return CSR_RESULT_SUCCESS; +} /* CsrSdioInterruptEnable() */ + +CsrResult +CsrSdioInterruptDisable(CsrSdioFunction *function) +{ + struct sdio_func *func = (struct sdio_func *)function->priv; + int err = 0; + +#ifdef CSR_CONFIG_MMC_INT_BYPASS_KSOFTIRQD + sdio_block_card_irq(func); +#else + _sdio_claim_host(func); + /* Write the Int Enable in CCCR block */ +#ifdef MMC_QUIRK_LENIENT_FN0 + sdio_f0_writeb(func, 0, SDIO_CCCR_IENx, &err); +#else + err = csr_io_rw_direct(func->card, 1, 0, SDIO_CCCR_IENx, 0x00, NULL); +#endif + _sdio_release_host(func); + + func_exit(); + if (err) { + return ConvertSdioToCsrSdioResult(err); + } +#endif + return CSR_RESULT_SUCCESS; +} /* CsrSdioInterruptDisable() */ + + +void CsrSdioInterruptAcknowledge(CsrSdioFunction *function) +{ +} + + +/* + * --------------------------------------------------------------------------- + * CsrSdioFunctionEnable + * + * Enable i/o on function 1. + * + * Arguments: + * sdio SDIO context pointer + * + * Returns: + * UniFi driver error code. + * --------------------------------------------------------------------------- + */ +CsrResult +CsrSdioFunctionEnable(CsrSdioFunction *function) +{ + struct sdio_func *func = (struct sdio_func *)function->priv; + int err; + + func_enter(); + + /* Enable UniFi function 1 (the 802.11 part). */ + _sdio_claim_host(func); + err = sdio_enable_func(func); + _sdio_release_host(func); + if (err) { + unifi_error(NULL, "Failed to enable SDIO function %d\n", func->num); + } + + func_exit(); + return ConvertSdioToCsrSdioResult(err); +} /* CsrSdioFunctionEnable() */ + + +/* + * --------------------------------------------------------------------------- + * CsrSdioFunctionDisable + * + * Enable i/o on function 1. + * + * Arguments: + * sdio SDIO context pointer + * + * Returns: + * UniFi driver error code. + * --------------------------------------------------------------------------- + */ +CsrResult +CsrSdioFunctionDisable(CsrSdioFunction *function) +{ + struct sdio_func *func = (struct sdio_func *)function->priv; + int err; + + func_enter(); + + /* Disable UniFi function 1 (the 802.11 part). */ + _sdio_claim_host(func); + err = sdio_disable_func(func); + _sdio_release_host(func); + if (err) { + unifi_error(NULL, "Failed to disable SDIO function %d\n", func->num); + } + + func_exit(); + return ConvertSdioToCsrSdioResult(err); +} /* CsrSdioFunctionDisable() */ + + +/* + * --------------------------------------------------------------------------- + * CsrSdioFunctionActive + * + * No-op as the bus goes to an active state at the start of every + * command. + * + * Arguments: + * sdio SDIO context pointer + * --------------------------------------------------------------------------- + */ +void +CsrSdioFunctionActive(CsrSdioFunction *function) +{ +} /* CsrSdioFunctionActive() */ + +/* + * --------------------------------------------------------------------------- + * CsrSdioFunctionIdle + * + * Set the function as idle. + * + * Arguments: + * sdio SDIO context pointer + * --------------------------------------------------------------------------- + */ +void +CsrSdioFunctionIdle(CsrSdioFunction *function) +{ +} /* CsrSdioFunctionIdle() */ + + +/* + * --------------------------------------------------------------------------- + * CsrSdioPowerOn + * + * Power on UniFi. + * + * Arguments: + * sdio SDIO context pointer + * --------------------------------------------------------------------------- + */ +CsrResult +CsrSdioPowerOn(CsrSdioFunction *function) +{ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) + struct sdio_func *func = (struct sdio_func *)function->priv; + struct mmc_host *host = func->card->host; + + _sdio_claim_host(func); + if (!card_is_powered) { + mmc_power_restore_host(host); + card_is_powered = 1; + } else { + printk(KERN_INFO "SDIO: Skip power on; card is already powered.\n"); + } + _sdio_release_host(func); +#endif /* 2.6.32 */ + + return CSR_RESULT_SUCCESS; +} /* CsrSdioPowerOn() */ + +/* + * --------------------------------------------------------------------------- + * CsrSdioPowerOff + * + * Power off UniFi. + * + * Arguments: + * sdio SDIO context pointer + * --------------------------------------------------------------------------- + */ +void +CsrSdioPowerOff(CsrSdioFunction *function) +{ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) + struct sdio_func *func = (struct sdio_func *)function->priv; + struct mmc_host *host = func->card->host; + + _sdio_claim_host(func); + if (card_is_powered) { + mmc_power_save_host(host); + card_is_powered = 0; + } else { + printk(KERN_INFO "SDIO: Skip power off; card is already powered off.\n"); + } + _sdio_release_host(func); +#endif /* 2.6.32 */ +} /* CsrSdioPowerOff() */ + + +static int +sdio_set_block_size_ignore_first_error(struct sdio_func *func, unsigned blksz) +{ + int ret; + + if (blksz > func->card->host->max_blk_size) + return -EINVAL; + + if (blksz == 0) { + blksz = min(func->max_blksize, func->card->host->max_blk_size); + blksz = min(blksz, 512u); + } + + /* + * Ignore -ERANGE (OUT_OF_RANGE in R5) on the first byte as + * the block size may be invalid until both bytes are written. + */ + ret = csr_io_rw_direct(func->card, 1, 0, + SDIO_FBR_BASE(func->num) + SDIO_FBR_BLKSIZE, + blksz & 0xff, NULL); + if (ret && ret != -ERANGE) + return ret; + ret = csr_io_rw_direct(func->card, 1, 0, + SDIO_FBR_BASE(func->num) + SDIO_FBR_BLKSIZE + 1, + (blksz >> 8) & 0xff, NULL); + if (ret) + return ret; + func->cur_blksize = blksz; + + return 0; +} + +CsrResult +CsrSdioBlockSizeSet(CsrSdioFunction *function, CsrUint16 blockSize) +{ + struct sdio_func *func = (struct sdio_func *)function->priv; + int r = 0; + + /* Module parameter overrides */ + if (sdio_block_size > -1) { + blockSize = sdio_block_size; + } + + unifi_trace(NULL, UDBG1, "Set SDIO function block size to %d\n", + blockSize); + + _sdio_claim_host(func); + r = sdio_set_block_size(func, blockSize); + _sdio_release_host(func); + + /* + * The MMC driver for kernels prior to 2.6.32 may fail this request + * with -ERANGE. In this case use our workaround. + */ + if (r == -ERANGE) { + _sdio_claim_host(func); + r = sdio_set_block_size_ignore_first_error(func, blockSize); + _sdio_release_host(func); + } + if (r) { + unifi_error(NULL, "Error %d setting block size\n", r); + } + + /* Determine the achieved block size to pass to the core */ + function->blockSize = func->cur_blksize; + + return ConvertSdioToCsrSdioResult(r); +} /* CsrSdioBlockSizeSet() */ + + +/* + * --------------------------------------------------------------------------- + * CsrSdioHardReset + * + * Hard Resets UniFi is possible. + * + * Arguments: + * sdio SDIO context pointer + * --------------------------------------------------------------------------- + */ +CsrResult +CsrSdioHardReset(CsrSdioFunction *function) +{ + return CSR_RESULT_FAILURE; +} /* CsrSdioHardReset() */ + + + +/* + * --------------------------------------------------------------------------- + * uf_glue_sdio_int_handler + * + * Interrupt callback function for SDIO interrupts. + * This is called in kernel context (i.e. not interrupt context). + * + * Arguments: + * func SDIO context pointer + * + * Returns: + * None. + * + * Note: Called with host already claimed. + * --------------------------------------------------------------------------- + */ +static void +uf_glue_sdio_int_handler(struct sdio_func *func) +{ + CsrSdioFunction *sdio_ctx; + CsrSdioInterruptDsrCallback func_dsr_callback; + int r; + + sdio_ctx = sdio_get_drvdata(func); + if (!sdio_ctx) { + return; + } +#ifndef CSR_CONFIG_MMC_INT_BYPASS_KSOFTIRQD + /* + * Normally, we are not allowed to do any SDIO commands here. + * However, this is called in a thread context and with the SDIO lock + * so we disable the interrupts here instead of trying to do complicated + * things with the SDIO lock. + */ +#ifdef MMC_QUIRK_LENIENT_FN0 + sdio_f0_writeb(func, 0, SDIO_CCCR_IENx, &r); +#else + r = csr_io_rw_direct(func->card, 1, 0, SDIO_CCCR_IENx, 0x00, NULL); +#endif + if (r) { + printk(KERN_ERR "UniFi MMC Int handler: Failed to disable interrupts\n"); + } +#endif + + /* If the function driver has registered a handler, call it */ + if (sdio_func_drv && sdio_func_drv->intr) { + + func_dsr_callback = sdio_func_drv->intr(sdio_ctx); + + /* If interrupt handle returns a DSR handle, call it */ + if (func_dsr_callback) { + func_dsr_callback(sdio_ctx); + } + } + +} /* uf_glue_sdio_int_handler() */ + + + +/* + * --------------------------------------------------------------------------- + * csr_sdio_linux_remove_irq + * + * Unregister the interrupt handler. + * This means that the linux layer can not process interrupts any more. + * + * Arguments: + * sdio SDIO context pointer + * + * Returns: + * Status of the removal. + * --------------------------------------------------------------------------- + */ +int +csr_sdio_linux_remove_irq(CsrSdioFunction *function) +{ + struct sdio_func *func = (struct sdio_func *)function->priv; + int r; + + sdio_claim_host(func); + r = sdio_release_irq(func); + sdio_release_host(func); + + return r; + +} /* csr_sdio_linux_remove_irq() */ + + +/* + * --------------------------------------------------------------------------- + * csr_sdio_linux_install_irq + * + * Register the interrupt handler. + * This means that the linux layer can process interrupts. + * + * Arguments: + * sdio SDIO context pointer + * + * Returns: + * Status of the removal. + * --------------------------------------------------------------------------- + */ +int +csr_sdio_linux_install_irq(CsrSdioFunction *function) +{ + struct sdio_func *func = (struct sdio_func *)function->priv; + int r; + + /* Register our interrupt handle */ + sdio_claim_host(func); + r = sdio_claim_irq(func, uf_glue_sdio_int_handler); + sdio_release_host(func); + + /* If the interrupt was installed earlier, is fine */ + if (r == -EBUSY) { + r = 0; + } + + return r; +} /* csr_sdio_linux_install_irq() */ + + + +/* + * --------------------------------------------------------------------------- + * uf_glue_sdio_probe + * + * Card insert callback. + * + * Arguments: + * func Our (glue layer) context pointer. + * + * Returns: + * UniFi driver error code. + * --------------------------------------------------------------------------- + */ +static int +uf_glue_sdio_probe(struct sdio_func *func, + const struct sdio_device_id *id) +{ + int instance; + CsrSdioFunction *sdio_ctx; + + func_enter(); + + /* First of all claim the SDIO driver */ + sdio_claim_host(func); + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) + /* Assume that the card is already powered */ + card_is_powered = 1; +#endif + + /* Assumes one card per host, which is true for SDIO */ + instance = func->card->host->index; + printk("sdio bus_id: %16s - UniFi card 0x%X inserted\n", + sdio_func_id(func), instance); + + /* Allocate context */ + sdio_ctx = (CsrSdioFunction *)kmalloc(sizeof(CsrSdioFunction), + GFP_KERNEL); + if (sdio_ctx == NULL) { + sdio_release_host(func); + return -ENOMEM; + } + + /* Initialise the context */ + sdio_ctx->sdioId.manfId = func->vendor; + sdio_ctx->sdioId.cardId = func->device; + sdio_ctx->sdioId.sdioFunction = func->num; + sdio_ctx->sdioId.sdioInterface = func->class; + sdio_ctx->blockSize = func->cur_blksize; + sdio_ctx->priv = (void *)func; + sdio_ctx->features = 0; + + /* Module parameter enables byte mode */ + if (sdio_byte_mode) { + sdio_ctx->features |= CSR_SDIO_FEATURE_BYTE_MODE; + } + +#ifdef MMC_QUIRK_LENIENT_FN0 + func->card->quirks |= MMC_QUIRK_LENIENT_FN0; +#endif + + /* Pass context to the SDIO driver */ + sdio_set_drvdata(func, sdio_ctx); + + /* Register this device with the SDIO function driver */ + /* Call the main UniFi driver inserted handler */ + if (sdio_func_drv && sdio_func_drv->inserted) { + uf_add_os_device(instance, &func->dev); + sdio_func_drv->inserted(sdio_ctx); + } + + /* We have finished, so release the SDIO driver */ + sdio_release_host(func); + + func_exit(); + return 0; +} /* uf_glue_sdio_probe() */ + + +/* + * --------------------------------------------------------------------------- + * uf_glue_sdio_remove + * + * Card removal callback. + * + * Arguments: + * func Our (glue layer) context pointer. + * + * Returns: + * UniFi driver error code. + * --------------------------------------------------------------------------- + */ +static void +uf_glue_sdio_remove(struct sdio_func *func) +{ + CsrSdioFunction *sdio_ctx; + + sdio_ctx = sdio_get_drvdata(func); + if (!sdio_ctx) { + return; + } + + func_enter(); + + unifi_info(NULL, "UniFi card removed\n"); + + /* Clean up the SDIO function driver */ + if (sdio_func_drv && sdio_func_drv->removed) { + uf_remove_os_device(func->card->host->index); + sdio_func_drv->removed(sdio_ctx); + } + + kfree(sdio_ctx); + + func_exit(); + +} /* uf_glue_sdio_remove */ + + +/* + * SDIO ids *must* be statically declared, so we can't take + * them from the list passed in csr_sdio_register_driver(). + */ +static const struct sdio_device_id unifi_ids[] = { + { SDIO_DEVICE(SDIO_MANF_ID_CSR,SDIO_CARD_ID_UNIFI_3) }, + { SDIO_DEVICE(SDIO_MANF_ID_CSR,SDIO_CARD_ID_UNIFI_4) }, + { /* end: all zeroes */ }, +}; + +MODULE_DEVICE_TABLE(sdio, unifi_ids); + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) +#ifdef CONFIG_PM + +/* + * --------------------------------------------------------------------------- + * uf_glue_sdio_suspend + * + * Card suspend callback. + * + * Arguments: + * dev The struct device owned by the MMC driver + * + * Returns: + * None + * --------------------------------------------------------------------------- + */ +static int +uf_glue_sdio_suspend(struct device *dev) +{ + struct sdio_func *func; + CsrSdioFunction *sdio_ctx; + + func_enter(); + + func = dev_to_sdio_func(dev); + WARN_ON(!func); + + sdio_ctx = sdio_get_drvdata(func); + WARN_ON(!sdio_ctx); + + unifi_trace(NULL, UDBG1, "System Suspend...\n"); + + /* Clean up the SDIO function driver */ + if (sdio_func_drv && sdio_func_drv->suspend) { + sdio_func_drv->suspend(sdio_ctx); + } + + func_exit(); + return 0; +} /* uf_glue_sdio_suspend */ + + +/* + * --------------------------------------------------------------------------- + * uf_glue_sdio_resume + * + * Card resume callback. + * + * Arguments: + * dev The struct device owned by the MMC driver + * + * Returns: + * None + * --------------------------------------------------------------------------- + */ +static int +uf_glue_sdio_resume(struct device *dev) +{ + struct sdio_func *func; + CsrSdioFunction *sdio_ctx; + + func_enter(); + + func = dev_to_sdio_func(dev); + WARN_ON(!func); + + sdio_ctx = sdio_get_drvdata(func); + WARN_ON(!sdio_ctx); + + unifi_trace(NULL, UDBG1, "System Resume...\n"); + + /* Clean up the SDIO function driver */ + if (sdio_func_drv && sdio_func_drv->resume) { + sdio_func_drv->resume(sdio_ctx); + } + + func_exit(); + return 0; + +} /* uf_glue_sdio_resume */ + +static struct dev_pm_ops unifi_pm_ops = { + .suspend = uf_glue_sdio_suspend, + .resume = uf_glue_sdio_resume, +}; + +#define UNIFI_PM_OPS (&unifi_pm_ops) + +#else + +#define UNIFI_PM_OPS NULL + +#endif /* CONFIG_PM */ +#endif /* 2.6.32 */ + +static struct sdio_driver unifi_driver = { + .probe = uf_glue_sdio_probe, + .remove = uf_glue_sdio_remove, + .name = "unifi", + .id_table = unifi_ids, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) + .drv.pm = UNIFI_PM_OPS, +#endif /* 2.6.32 */ +}; + + +/* + * --------------------------------------------------------------------------- + * CsrSdioFunctionDriverRegister + * CsrSdioFunctionDriverUnregister + * + * These functions are called from the main module load and unload + * functions. They perform the appropriate operations for the + * linux MMC/SDIO driver. + * + * Arguments: + * sdio_drv Pointer to the function driver's SDIO structure. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +CsrResult +CsrSdioFunctionDriverRegister(CsrSdioFunctionDriver *sdio_drv) +{ + int r; + + printk("UniFi: Using native Linux MMC driver for SDIO.\n"); + + if (sdio_func_drv) { + unifi_error(NULL, "sdio_mmc: UniFi driver already registered\n"); + return CSR_SDIO_RESULT_INVALID_VALUE; + } + + /* Save the registered driver description */ + /* + * FIXME: + * Need a table here to handle a call to register for just one function. + * mmc only allows us to register for the whole device + */ + sdio_func_drv = sdio_drv; + + /* Register ourself with mmc_core */ + r = sdio_register_driver(&unifi_driver); + if (r) { + printk(KERN_ERR "unifi_sdio: Failed to register UniFi SDIO driver: %d\n", r); + return ConvertSdioToCsrSdioResult(r); + } + + return CSR_RESULT_SUCCESS; +} /* CsrSdioFunctionDriverRegister() */ + + + +void +CsrSdioFunctionDriverUnregister(CsrSdioFunctionDriver *sdio_drv) +{ + printk(KERN_INFO "UniFi: unregister from MMC sdio\n"); + sdio_unregister_driver(&unifi_driver); + + sdio_func_drv = NULL; + +} /* CsrSdioFunctionDriverUnregister() */ + diff --git a/drivers/staging/csr/sdio_stubs.c b/drivers/staging/csr/sdio_stubs.c new file mode 100644 index 0000000..bc6a369 --- /dev/null +++ b/drivers/staging/csr/sdio_stubs.c @@ -0,0 +1,82 @@ +/* + * Stubs for some of the bottom edge functions. + * + * These stubs are optional functions in the bottom edge (SDIO driver + * interface) API that not all platforms or SDIO drivers may support. + * + * They're declared as weak symbols so they can be overridden by + * simply providing a non-weak declaration. + * + * Copyright (C) 2007-2008 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + */ +#include "csr_wifi_hip_unifi.h" + +void __attribute__((weak)) CsrSdioFunctionIdle(CsrSdioFunction *function) +{ +} + +void __attribute__((weak)) CsrSdioFunctionActive(CsrSdioFunction *function) +{ +} + +CsrResult __attribute__((weak)) CsrSdioPowerOn(CsrSdioFunction *function) +{ + return CSR_RESULT_SUCCESS; +} + +void __attribute__((weak)) CsrSdioPowerOff(CsrSdioFunction *function) +{ +} + +CsrResult __attribute__((weak)) CsrSdioHardReset(CsrSdioFunction *function) +{ + return CSR_SDIO_RESULT_NOT_RESET; +} + +CsrResult __attribute__((weak)) CsrSdioBlockSizeSet(CsrSdioFunction *function, + CsrUint16 blockSize) +{ + return CSR_RESULT_SUCCESS; +} + +CsrResult __attribute__((weak)) CsrSdioSuspend(CsrSdioFunction *function) +{ + return CSR_RESULT_SUCCESS; +} + +CsrResult __attribute__((weak)) CsrSdioResume(CsrSdioFunction *function) +{ + return CSR_RESULT_SUCCESS; +} + +int __attribute__((weak)) csr_sdio_linux_install_irq(CsrSdioFunction *function) +{ + return 0; +} + +int __attribute__((weak)) csr_sdio_linux_remove_irq(CsrSdioFunction *function) +{ + return 0; +} + +void __attribute__((weak)) CsrSdioInsertedAcknowledge(CsrSdioFunction *function, CsrResult result) +{ +} + +void __attribute__((weak)) CsrSdioRemovedAcknowledge(CsrSdioFunction *function) +{ +} + +void __attribute__((weak)) CsrSdioSuspendAcknowledge(CsrSdioFunction *function, CsrResult result) +{ +} + +void __attribute__((weak)) CsrSdioResumeAcknowledge(CsrSdioFunction *function, CsrResult result) +{ +} + + diff --git a/drivers/staging/csr/sdioemb/cspi.h b/drivers/staging/csr/sdioemb/cspi.h new file mode 100644 index 0000000..b0a2886 --- /dev/null +++ b/drivers/staging/csr/sdioemb/cspi.h @@ -0,0 +1,62 @@ +/* + * CSPI definitions. + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef SDIOEMB_CSPI_H +#define SDIOEMB_CSPI_H + +/** + * @addtogroup sdriver + *@{*/ + +#define CSPI_FUNC(f) (f) +#define CSPI_READ 0x10 +#define CSPI_WRITE 0x20 +#define CSPI_BURST 0x40 +#define CSPI_TYPE_MASK 0x70 + +/** + * CSPI_MODE function 0 register. + * + * Various CSPI mode settings. + * + * @see CSPI specification (CS-110124-SP) + */ +#define CSPI_MODE 0xf7 +# define CSPI_MODE_PADDED_WRITE_HDRS (1 << 7) +# define CSPI_MODE_PADDED_READ_HDRS (1 << 6) +/** + * BigEndianRegisters bit of \ref CSPI_MODE -- enable big-endian CSPI + * register reads and writes. + * + * @warning This bit should never be set as it's not possible to use + * this mode without knowledge of which registers are 8 bit and which + * are 16 bit. + */ +# define CSPI_MODE_BE_REG (1 << 5) +# define CSPI_MODE_BE_BURST (1 << 4) +# define CSPI_MODE_INT_ACTIVE_HIGH (1 << 3) +# define CSPI_MODE_INT_ON_ERR (1 << 2) +# define CSPI_MODE_LEN_FIELD_PRESENT (1 << 1) +# define CSPI_MODE_DRV_MISO_ON_RISING_CLK (1 << 0) + +#define CSPI_STATUS 0xf8 + +#define CSPI_PADDING 0xf9 +# define CSPI_PADDING_REG(p) ((p) << 0) +# define CSPI_PADDING_BURST(p) ((p) << 4) + +#define CSPI_PADDING_MAX 15 +#define CSPI_PADDING_REG_DFLT 0 +#define CSPI_PADDING_BURST_DFLT 2 + +/* cmd byte, 3 byte addr, padding, error byte, data word */ +#define CSPI_REG_TRANSFER_LEN (1 + 3 + CSPI_PADDING_MAX + 1 + 2) + +/*@}*/ + +#endif /* #ifndef SDIOEMB_CSPI_H */ diff --git a/drivers/staging/csr/sdioemb/csr_result.h b/drivers/staging/csr/sdioemb/csr_result.h new file mode 100644 index 0000000..9813f3f --- /dev/null +++ b/drivers/staging/csr/sdioemb/csr_result.h @@ -0,0 +1,16 @@ +/* + * Synergy compatible API -- common result codes. + * + * Copyright (C) 2010 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef CSR_RESULT_H__ +#define CSR_RESULT_H__ + +typedef CsrUint16 CsrResult; +#define CSR_RESULT_SUCCESS ((CsrResult) 0x0000) +#define CSR_RESULT_FAILURE ((CsrResult) 0xffff) + +#endif diff --git a/drivers/staging/csr/sdioemb/csr_sdio.h b/drivers/staging/csr/sdioemb/csr_sdio.h new file mode 100644 index 0000000..5d05d96 --- /dev/null +++ b/drivers/staging/csr/sdioemb/csr_sdio.h @@ -0,0 +1,711 @@ +/* + * Synergy compatible API -- SDIO. + * + * Copyright (C) 2010 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef CSR_SDIO_H__ +#define CSR_SDIO_H__ + +#include "csr_types.h" +#include "csr_result.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Result Codes */ +#define CSR_SDIO_RESULT_INVALID_VALUE ((CsrResult) 1) /* Invalid argument value */ +#define CSR_SDIO_RESULT_NO_DEVICE ((CsrResult) 2) /* The specified device is no longer present */ +#define CSR_SDIO_RESULT_CRC_ERROR ((CsrResult) 3) /* The transmitted/received data or command response contained a CRC error */ +#define CSR_SDIO_RESULT_TIMEOUT ((CsrResult) 4) /* No command response or data received from device, or function enable/disable did not succeed within timeout period */ +#define CSR_SDIO_RESULT_NOT_RESET ((CsrResult) 5) /* The device was not reset */ + +/* Features (for use in features member of CsrSdioFunction) */ +#define CSR_SDIO_FEATURE_BYTE_MODE 0x00000001 /* Transfer sizes do not have to be a multiple of block size */ +#define CSR_SDIO_FEATURE_DMA_CAPABLE_MEM_REQUIRED 0x00000002 /* Bulk operations require DMA friendly memory */ + +/* CsrSdioFunctionId wildcards (for use in CsrSdioFunctionId members) */ +#define CSR_SDIO_ANY_MANF_ID 0xFFFF +#define CSR_SDIO_ANY_CARD_ID 0xFFFF +#define CSR_SDIO_ANY_SDIO_FUNCTION 0xFF +#define CSR_SDIO_ANY_SDIO_INTERFACE 0xFF + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioFunctionId + * + * DESCRIPTION + * This structure describes one or more functions of a device, based on + * four qualitative measures. The CsrSdioFunctionId wildcard defines can be + * used for making the CsrSdioFunctionId match more than one function. + * + * MEMBERS + * manfId - Vendor ID (or CSR_SDIO_ANY_MANF_ID). + * cardId - Device ID (or CSR_SDIO_ANY_CARD_ID). + * sdioFunction - SDIO Function number (or CSR_SDIO_ANY_SDIO_FUNCTION). + * sdioInterface - SDIO Standard Interface Code (or CSR_SDIO_ANY_SDIO_INTERFACE) + * + *----------------------------------------------------------------------------*/ +typedef struct +{ + CsrUint16 manfId; /* Vendor ID to match or CSR_SDIO_ANY_MANF_ID */ + CsrUint16 cardId; /* Device ID to match or CSR_SDIO_ANY_CARD_ID */ + CsrUint8 sdioFunction; /* SDIO Function number to match or CSR_SDIO_ANY_SDIO_FUNCTION */ + CsrUint8 sdioInterface; /* SDIO Standard Interface Code to match or CSR_SDIO_ANY_SDIO_INTERFACE */ +} CsrSdioFunctionId; + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioFunction + * + * DESCRIPTION + * This structure represents a single function on a device. + * + * MEMBERS + * sdioId - A CsrSdioFunctionId describing this particular function. The + * subfield shall not contain any CsrSdioFunctionId wildcards. The + * subfields shall describe the specific single function + * represented by this structure. + * blockSize - Actual configured block size, or 0 if unconfigured. + * features - Bit mask with any of CSR_SDIO_FEATURE_* set. + * driverData - For use by the Function Driver. The SDIO Driver shall not + * attempt to dereference the pointer. + * priv - For use by the SDIO Driver. The Function Driver shall not attempt + * to dereference the pointer. + * + *----------------------------------------------------------------------------*/ +typedef struct +{ + CsrSdioFunctionId sdioId; + CsrUint16 blockSize; /* Actual configured block size, or 0 if unconfigured */ + CsrUint32 features; /* Bit mask with any of CSR_SDIO_FEATURE_* set */ + void *cardHandle; /* An opaque handle for this function's card. */ + void *osDevice; + void *driverData; /* For use by the Function Driver */ + void *priv; /* For use by the SDIO Driver */ +} CsrSdioFunction; + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioInsertedCallback, CsrSdioRemovedCallback + * + * DESCRIPTION + * CsrSdioInsertedCallback is called when a function becomes available to + * a registered Function Driver that supports the function. + * CsrSdioRemovedCallback is called when a function is no longer available + * to a Function Driver, either because the device has been removed, or the + * Function Driver has been unregistered. + * + * NOTE: These functions are implemented by the Function Driver, and are + * passed as function pointers in the CsrSdioFunctionDriver struct. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * + *----------------------------------------------------------------------------*/ +typedef void (*CsrSdioInsertedCallback)(CsrSdioFunction *function); +typedef void (*CsrSdioRemovedCallback)(CsrSdioFunction *function); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioInterruptDsrCallback, CsrSdioInterruptCallback + * + * DESCRIPTION + * CsrSdioInterruptCallback is called when an interrupt occurs on the + * the device associated with the specified function. + * + * NOTE: These functions are implemented by the Function Driver, and are + * passed as function pointers in the CsrSdioFunctionDriver struct. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * + * RETURNS (only CsrSdioInterruptCallback) + * A pointer to a CsrSdioInterruptDsrCallback function. + * + *----------------------------------------------------------------------------*/ +typedef void (*CsrSdioInterruptDsrCallback)(CsrSdioFunction *function); +typedef CsrSdioInterruptDsrCallback (*CsrSdioInterruptCallback)(CsrSdioFunction *function); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioSuspendCallback, CsrSdioResumeCallback + * + * DESCRIPTION + * CsrSdioSuspendCallback is called when the system is preparing to go + * into a suspended state. CsrSdioResumeCallback is called when the system + * has entered an active state again. + * + * NOTE: These functions are implemented by the Function Driver, and are + * passed as function pointers in the CsrSdioFunctionDriver struct. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * + *----------------------------------------------------------------------------*/ +typedef void (*CsrSdioSuspendCallback)(CsrSdioFunction *function); +typedef void (*CsrSdioResumeCallback)(CsrSdioFunction *function); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioAsyncCallback, CsrSdioAsyncDsrCallback + * + * DESCRIPTION + * CsrSdioAsyncCallback is called when an asynchronous operation completes. + * + * NOTE: These functions are implemented by the Function Driver, and are + * passed as function pointers in the function calls that initiate + * the operation. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * result - The result of the operation that completed. See the description + * of the initiating function for possible result values. + * + * RETURNS (only CsrSdioAsyncCallback) + * A pointer to a CsrSdioAsyncDsrCallback function. + * + *----------------------------------------------------------------------------*/ +typedef void (*CsrSdioAsyncDsrCallback)(CsrSdioFunction *function, CsrResult result); +typedef CsrSdioAsyncDsrCallback (*CsrSdioAsyncCallback)(CsrSdioFunction *function, CsrResult result); + +typedef struct +{ + CsrSdioInsertedCallback inserted; + CsrSdioRemovedCallback removed; + CsrSdioInterruptCallback intr; + CsrSdioSuspendCallback suspend; + CsrSdioResumeCallback resume; + CsrSdioFunctionId *ids; + CsrUint8 idsCount; + void *priv; +} CsrSdioFunctionDriver; + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioFunctionDriverRegister + * + * DESCRIPTION + * Register a Function Driver. + * + * PARAMETERS + * functionDriver - Pointer to struct describing the Function Driver. + * + * RETURNS + * CSR_RESULT_SUCCESS - The Function Driver was successfully + * registered. + * CSR_RESULT_FAILURE - Unable to register the function driver, + * because of an unspecified/unknown error. The + * Function Driver has not been registered. + * CSR_SDIO_RESULT_INVALID_VALUE - The specified Function Driver pointer + * does not point at a valid Function + * Driver structure, or some of the members + * contain invalid entries. + * + *----------------------------------------------------------------------------*/ +CsrResult CsrSdioFunctionDriverRegister(CsrSdioFunctionDriver *functionDriver); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioFunctionDriverUnregister + * + * DESCRIPTION + * Unregister a previously registered Function Driver. + * + * PARAMETERS + * functionDriver - pointer to struct describing the Function Driver. + * + *----------------------------------------------------------------------------*/ +void CsrSdioFunctionDriverUnregister(CsrSdioFunctionDriver *functionDriver); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioFunctionEnable, CsrSdioFunctionDisable + * + * DESCRIPTION + * Enable/disable the specified function by setting/clearing the + * corresponding bit in the I/O Enable register in function 0, and then + * periodically reading the related bit in the I/O Ready register until it + * is set/clear, limited by an implementation defined timeout. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * + * RETURNS + * CSR_RESULT_SUCCESS - The specified function was enabled/disabled. + * CSR_RESULT_FAILURE - Unspecified/unknown error. + * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. + * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. The state of the + * related bit in the I/O Enable register is + * undefined. + * CSR_SDIO_RESULT_TIMEOUT - No response from the device, or the related + * bit in the I/O ready register was not + * set/cleared within the timeout period. + * + * NOTE: If the SDIO R5 response is available, and either of the + * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit + * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), + * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and + * COM_CRC_ERROR bits shall be ignored. + * + * If the CSPI response is available, and any of the + * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE will be returned. + * + *----------------------------------------------------------------------------*/ +CsrResult CsrSdioFunctionEnable(CsrSdioFunction *function); +CsrResult CsrSdioFunctionDisable(CsrSdioFunction *function); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioInterruptEnable, CsrSdioInterruptDisable + * + * DESCRIPTION + * Enable/disable the interrupt for the specified function by + * setting/clearing the corresponding bit in the INT Enable register in + * function 0. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * + * RETURNS + * CSR_RESULT_SUCCESS - The specified function was enabled/disabled. + * CSR_RESULT_FAILURE - Unspecified/unknown error. + * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. + * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. The state of the + * related bit in the INT Enable register is + * unchanged. + * CSR_SDIO_RESULT_INVALID_VALUE - The specified function cannot be + * enabled/disabled, because it either + * does not exist or it is not possible to + * individually enable/disable functions. + * CSR_SDIO_RESULT_TIMEOUT - No response from the device. + * + * NOTE: If the SDIO R5 response is available, and either of the + * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit + * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), + * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and + * COM_CRC_ERROR bits shall be ignored. + * + * If the CSPI response is available, and any of the + * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE will be returned. + * + *----------------------------------------------------------------------------*/ +CsrResult CsrSdioInterruptEnable(CsrSdioFunction *function); +CsrResult CsrSdioInterruptDisable(CsrSdioFunction *function); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioInterruptAcknowledge + * + * DESCRIPTION + * Acknowledge that a signalled interrupt has been handled. Shall only + * be called once, and exactly once for each signalled interrupt to the + * corresponding function. + * + * PARAMETERS + * function - Pointer to struct representing the function to which the + * event was signalled. + * + *----------------------------------------------------------------------------*/ +void CsrSdioInterruptAcknowledge(CsrSdioFunction *function); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioInsertedAcknowledge, CsrSdioRemovedAcknowledge + * + * DESCRIPTION + * Acknowledge that a signalled inserted/removed event has been handled. + * Shall only be called once, and exactly once for each signalled event to + * the corresponding function. + * + * PARAMETERS + * function - Pointer to struct representing the function to which the + * inserted was signalled. + * result (CsrSdioInsertedAcknowledge only) + * CSR_RESULT_SUCCESS - The Function Driver has accepted the + * function, and the function is attached to + * the Function Driver until the + * CsrSdioRemovedCallback is called and + * acknowledged. + * CSR_RESULT_FAILURE - Unable to accept the function. The + * function is not attached to the Function + * Driver, and it may be passed to another + * Function Driver which supports the + * function. + * + *----------------------------------------------------------------------------*/ +void CsrSdioInsertedAcknowledge(CsrSdioFunction *function, CsrResult result); +void CsrSdioRemovedAcknowledge(CsrSdioFunction *function); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioSuspendAcknowledge, CsrSdioResumeAcknowledge + * + * DESCRIPTION + * Acknowledge that a signalled suspend event has been handled. Shall only + * be called once, and exactly once for each signalled event to the + * corresponding function. + * + * PARAMETERS + * function - Pointer to struct representing the function to which the + * event was signalled. + * result + * CSR_RESULT_SUCCESS - Successfully suspended/resumed. + * CSR_RESULT_FAILURE - Unspecified/unknown error. + * + *----------------------------------------------------------------------------*/ +void CsrSdioSuspendAcknowledge(CsrSdioFunction *function, CsrResult result); +void CsrSdioResumeAcknowledge(CsrSdioFunction *function, CsrResult result); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioBlockSizeSet + * + * DESCRIPTION + * Set the block size to use for the function. The actual configured block + * size shall be the minimum of: + * 1) Maximum block size supported by the function. + * 2) Maximum block size supported by the host controller. + * 3) The block size specified by the blockSize argument. + * + * When this function returns, the actual configured block size is + * available in the blockSize member of the function struct. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * blockSize - Block size to use for the function. Valid range is 1 to + * 2048. + * + * RETURNS + * CSR_RESULT_SUCCESS - The block size register on the chip + * was updated. + * CSR_RESULT_FAILURE - Unspecified/unknown error. + * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. + * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. + * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. The configured block + * size is undefined. + * CSR_SDIO_RESULT_TIMEOUT - No response from the device. + * + * NOTE: If the SDIO R5 response is available, and the FUNCTION_NUMBER + * bits is set, CSR_SDIO_RESULT_INVALID_VALUE shall be returned. + * If the ERROR bit is set (but not FUNCTION_NUMBER), + * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and + * COM_CRC_ERROR bits shall be ignored. + * + * If the CSPI response is available, and any of the + * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE will be returned. + * + * NOTE: Setting the block size requires two individual operations. The + * implementation shall ignore the OUT_OF_RANGE bit of the SDIO R5 + * response for the first operation, as the partially configured + * block size may be out of range, even if the final block size + * (after the second operation) is in the valid range. + * + *----------------------------------------------------------------------------*/ +CsrResult CsrSdioBlockSizeSet(CsrSdioFunction *function, CsrUint16 blockSize); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioMaxBusClockFrequencySet + * + * DESCRIPTION + * Set the maximum clock frequency to use for the device associated with + * the specified function. The actual configured clock frequency for the + * device shall be the minimum of: + * 1) Maximum clock frequency supported by the device. + * 2) Maximum clock frequency supported by the host controller. + * 3) Maximum clock frequency specified for any function on the same + * device. + * + * If the clock frequency exceeds 25MHz, it is the responsibility of the + * SDIO driver to enable high speed mode on the device, using the standard + * defined procedure, before increasing the frequency beyond the limit. + * + * Note that the clock frequency configured affects all functions on the + * same device. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * maxFrequency - The maximum clock frequency for the function in Hertz. + * + * RETURNS + * CSR_RESULT_SUCCESS - The maximum clock frequency was succesfully + * set for the function. + * CSR_RESULT_FAILURE - Unspecified/unknown error. + * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. + * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. + * + * NOTE: If the SDIO R5 response is available, and the FUNCTION_NUMBER + * bits is set, CSR_SDIO_RESULT_INVALID_VALUE shall be returned. + * If the ERROR bit is set (but not FUNCTION_NUMBER), + * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and + * COM_CRC_ERROR bits shall be ignored. + * + * If the CSPI response is available, and any of the + * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE will be returned. + * + * + *----------------------------------------------------------------------------*/ +CsrResult CsrSdioMaxBusClockFrequencySet(CsrSdioFunction *function, CsrUint32 maxFrequency); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioRead8, CsrSdioWrite8, CsrSdioRead8Async, CsrSdioWrite8Async + * + * DESCRIPTION + * Read/write an 8bit value from/to the specified register address. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * address - Register address within the function. + * data - The data to read/write. + * callback - The function to call on operation completion. + * + * RETURNS + * CSR_RESULT_SUCCESS - The data was successfully read/written. + * CSR_RESULT_FAILURE - Unspecified/unknown error. + * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. + * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. + * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. No data read/written. + * CSR_SDIO_RESULT_TIMEOUT - No response from the device. + * + * NOTE: If the SDIO R5 response is available, and either of the + * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit + * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), + * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and + * COM_CRC_ERROR bits shall be ignored. + * + * If the CSPI response is available, and any of the + * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE will be returned. + * + * NOTE: The CsrSdioRead8Async and CsrSdioWrite8Async functions return + * immediately, and the supplied callback function is called when the + * operation is complete. The result value is given as an argument to + * the callback function. + * + *----------------------------------------------------------------------------*/ +CsrResult CsrSdioRead8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data); +CsrResult CsrSdioWrite8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data); +void CsrSdioRead8Async(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data, CsrSdioAsyncCallback callback); +void CsrSdioWrite8Async(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data, CsrSdioAsyncCallback callback); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioRead16, CsrSdioWrite16, CsrSdioRead16Async, CsrSdioWrite16Async + * + * DESCRIPTION + * Read/write a 16bit value from/to the specified register address. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * address - Register address within the function. + * data - The data to read/write. + * callback - The function to call on operation completion. + * + * RETURNS + * CSR_RESULT_SUCCESS - The data was successfully read/written. + * CSR_RESULT_FAILURE - Unspecified/unknown error. + * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. + * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. + * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. Data may have been + * partially read/written. + * CSR_SDIO_RESULT_TIMEOUT - No response from the device. + * + * NOTE: If the SDIO R5 response is available, and either of the + * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit + * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), + * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and + * COM_CRC_ERROR bits shall be ignored. + * + * If the CSPI response is available, and any of the + * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE will be returned. + * + * NOTE: The CsrSdioRead16Async and CsrSdioWrite16Async functions return + * immediately, and the supplied callback function is called when the + * operation is complete. The result value is given as an argument to + * the callback function. + * + *----------------------------------------------------------------------------*/ +CsrResult CsrSdioRead16(CsrSdioFunction *function, CsrUint32 address, CsrUint16 *data); +CsrResult CsrSdioWrite16(CsrSdioFunction *function, CsrUint32 address, CsrUint16 data); +void CsrSdioRead16Async(CsrSdioFunction *function, CsrUint32 address, CsrUint16 *data, CsrSdioAsyncCallback callback); +void CsrSdioWrite16Async(CsrSdioFunction *function, CsrUint32 address, CsrUint16 data, CsrSdioAsyncCallback callback); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioF0Read8, CsrSdioF0Write8, CsrSdioF0Read8Async, + * CsrSdioF0Write8Async + * + * DESCRIPTION + * Read/write an 8bit value from/to the specified register address in + * function 0. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * address - Register address within the function. + * data - The data to read/write. + * callback - The function to call on operation completion. + * + * RETURNS + * CSR_RESULT_SUCCESS - The data was successfully read/written. + * CSR_RESULT_FAILURE - Unspecified/unknown error. + * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. + * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. + * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. No data read/written. + * CSR_SDIO_RESULT_TIMEOUT - No response from the device. + * + * NOTE: If the SDIO R5 response is available, and either of the + * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit + * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), + * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and + * COM_CRC_ERROR bits shall be ignored. + * + * If the CSPI response is available, and any of the + * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE will be returned. + * + * NOTE: The CsrSdioF0Read8Async and CsrSdioF0Write8Async functions return + * immediately, and the supplied callback function is called when the + * operation is complete. The result value is given as an argument to + * the callback function. + * + *----------------------------------------------------------------------------*/ +CsrResult CsrSdioF0Read8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data); +CsrResult CsrSdioF0Write8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data); +void CsrSdioF0Read8Async(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data, CsrSdioAsyncCallback callback); +void CsrSdioF0Write8Async(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data, CsrSdioAsyncCallback callback); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioRead, CsrSdioWrite, CsrSdioReadAsync, CsrSdioWriteAsync + * + * DESCRIPTION + * Read/write a specified number of bytes from/to the specified register + * address. + * + * PARAMETERS + * function - Pointer to struct representing the function. + * address - Register address within the function. + * data - The data to read/write. + * length - Number of byte to read/write. + * callback - The function to call on operation completion. + * + * RETURNS + * CSR_RESULT_SUCCESS - The data was successfully read/written. + * CSR_RESULT_FAILURE - Unspecified/unknown error. + * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. + * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. + * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. Data may have been + * partially read/written. + * CSR_SDIO_RESULT_TIMEOUT - No response from the device. + * + * NOTE: If the SDIO R5 response is available, and either of the + * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit + * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), + * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and + * COM_CRC_ERROR bits shall be ignored. + * + * If the CSPI response is available, and any of the + * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, + * CSR_SDIO_RESULT_INVALID_VALUE will be returned. + * + * NOTE: The CsrSdioF0Read8Async and CsrSdioF0Write8Async functions return + * immediately, and the supplied callback function is called when the + * operation is complete. The result value is given as an argument to + * the callback function. + * + *----------------------------------------------------------------------------*/ +CsrResult CsrSdioRead(CsrSdioFunction *function, CsrUint32 address, void *data, CsrUint32 length); +CsrResult CsrSdioWrite(CsrSdioFunction *function, CsrUint32 address, const void *data, CsrUint32 length); +void CsrSdioReadAsync(CsrSdioFunction *function, CsrUint32 address, void *data, CsrUint32 length, CsrSdioAsyncCallback callback); +void CsrSdioWriteAsync(CsrSdioFunction *function, CsrUint32 address, const void *data, CsrUint32 length, CsrSdioAsyncCallback callback); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioPowerOn, CsrSdioPowerOff + * + * DESCRIPTION + * Power on/off the device. + * + * PARAMETERS + * function - Pointer to struct representing the function that resides on + * the device to power on/off. + * + * RETURNS (only CsrSdioPowerOn) + * CSR_RESULT_SUCCESS - Power was succesfully reapplied and the device + * has been reinitialised. + * CSR_RESULT_FAILURE - Unspecified/unknown error. + * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. + * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured during reinitialisation. + * CSR_SDIO_RESULT_TIMEOUT - No response from the device during + * reinitialisation. + * CSR_SDIO_RESULT_NOT_RESET - The power was not removed by the + * CsrSdioPowerOff call. The state of the + * device is unchanged. + * + *----------------------------------------------------------------------------*/ +CsrResult CsrSdioPowerOn(CsrSdioFunction *function); +void CsrSdioPowerOff(CsrSdioFunction *function); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioHardReset + * + * DESCRIPTION + * Perform a hardware reset of the device. + * + * PARAMETERS + * function - Pointer to struct representing the function that resides on + * the device to hard reset. + * + * RETURNS + * CSR_RESULT_SUCCESS - Reset was succesfully performed and the device + * has been reinitialised. + * CSR_RESULT_FAILURE - Unspecified/unknown error. + * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. + * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured during reinitialisation. + * CSR_SDIO_RESULT_TIMEOUT - No response from the device during + * reinitialisation. + * CSR_SDIO_RESULT_NOT_RESET - The reset was not applied because it is not + * supported. The state of the device is + * unchanged. + * + *----------------------------------------------------------------------------*/ +CsrResult CsrSdioHardReset(CsrSdioFunction *function); + +/*----------------------------------------------------------------------------* + * NAME + * CsrSdioFunctionActive, CsrSdioFunctionIdle + * + * DESCRIPTION + * + * PARAMETERS + * function - Pointer to struct representing the function. + * + *----------------------------------------------------------------------------*/ +void CsrSdioFunctionActive(CsrSdioFunction *function); +void CsrSdioFunctionIdle(CsrSdioFunction *function); + +void CsrSdioCallbackInhibitEnter(CsrSdioFunction *function); +void CsrSdioCallbackInhibitLeave(CsrSdioFunction *function); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/drivers/staging/csr/sdioemb/csr_sdio_lib.h b/drivers/staging/csr/sdioemb/csr_sdio_lib.h new file mode 100644 index 0000000..15c70f6 --- /dev/null +++ b/drivers/staging/csr/sdioemb/csr_sdio_lib.h @@ -0,0 +1,30 @@ +/* + * Synergy compatible API -- SDIO utility library. + * + * Copyright (C) 2010 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef CSR_SDIO_LIB_H__ +#define CSR_SDIO_LIB_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +CsrResult CsrSdioFunctionReenable(CsrSdioFunction *function); + +typedef int CsrStatus; /* platform specific */ +#define CSR_STATUS_FAILURE(status) ((status) < 0) /* platform specific */ + +CsrResult CsrSdioStatusToResult(CsrStatus status); +CsrStatus CsrSdioResultToStatus(CsrResult result); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* #ifndef CSR_SDIO_LIB_H__ */ diff --git a/drivers/staging/csr/sdioemb/csr_sdio_wdf.h b/drivers/staging/csr/sdioemb/csr_sdio_wdf.h new file mode 100644 index 0000000..6f0d71c --- /dev/null +++ b/drivers/staging/csr/sdioemb/csr_sdio_wdf.h @@ -0,0 +1,22 @@ +/* + * Synergy compatible API -- helpers for Windows Driver Framework drivers. + * + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef CSR_SDIO_WDF_H__ +#define CSR_SDIO_WDF_H__ + +#include + +NTSTATUS CsrSdioWdfDeviceInit(WDFDEVICE device); +void CsrSdioWdfDeviceCleanup(WDFDEVICE device); + +NTSTATUS CsrSdioWdfDeviceAdd(WDFDEVICE device); +void CsrSdioWdfDeviceDel(WDFDEVICE device); + +NTSTATUS CsrSdioWdfDeviceSuspend(WDFDEVICE device); +NTSTATUS CsrSdioWdfDeviceResume(WDFDEVICE device); + +#endif /* #ifndef CSR_SDIO_WDF_H__ */ diff --git a/drivers/staging/csr/sdioemb/csr_types.h b/drivers/staging/csr/sdioemb/csr_types.h new file mode 100644 index 0000000..c0d95b3 --- /dev/null +++ b/drivers/staging/csr/sdioemb/csr_types.h @@ -0,0 +1,53 @@ +/* + * Synergy compatible API -- basic types. + * + * Copyright (C) 2010 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef CSR_TYPES_H__ +#define CSR_TYPES_H__ + +#include + +#ifndef FALSE +#define FALSE false +#endif + +#ifndef TRUE +#define TRUE true +#endif + +/* Data types */ + +typedef size_t CsrSize; + +typedef uint8_t CsrUint8; +typedef uint16_t CsrUint16; +typedef uint32_t CsrUint32; + +typedef int8_t CsrInt8; +typedef int16_t CsrInt16; +typedef int32_t CsrInt32; + +typedef bool CsrBool; + +typedef char CsrCharString; +typedef unsigned char CsrUtf8String; +typedef CsrUint16 CsrUtf16String; /* 16-bit UTF16 strings */ +typedef CsrUint32 CsrUint24; + +/* + * 64-bit integers + * + * Note: If a given compiler does not support 64-bit types, it is + * OK to omit these definitions; 32-bit versions of the code using + * these types may be available. Consult the relevant documentation + * or the customer support group for information on this. + */ +#define CSR_HAVE_64_BIT_INTEGERS +typedef uint64_t CsrUint64; +typedef int64_t CsrInt64; + +#endif diff --git a/drivers/staging/csr/sdioemb/libsdio.h b/drivers/staging/csr/sdioemb/libsdio.h new file mode 100644 index 0000000..29ac411 --- /dev/null +++ b/drivers/staging/csr/sdioemb/libsdio.h @@ -0,0 +1,404 @@ +/* + * SDIO Userspace Interface library. + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef SDIOEMB_LIBSDIO_H +#define SDIOEMB_LIBSDIO_H + +/** + * \defgroup libsdio Userspace SDIO library (libsdio) + * + * \brief \e libsdio is a Linux C library for accessing SDIO cards. + * + * Use of this library requires several \e sdioemb kernel modules to be + * loaded: + * - \c sdio. + * - \c An SDIO slot driver (e.g., \c slot_shc for a standard PCI + * SDIO Host Controller). + * - \c sdio_uif which provides the required character devices + * (/dev/sdio_uif0 for the card in SDIO slot 0 etc.). + */ +/*@{*/ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef WIN32 +# define LIBSDIOAPI __stdcall +#else +# define LIBSDIOAPI +#endif + +struct sdio_uif; + +/** + * Handle to an opened SDIO Userspace Interface device. + */ +typedef struct sdio_uif *sdio_uif_t; + +enum sdio_status { + SDIO_SUCCESS = 0, + SDIO_EAGAIN = -1, + SDIO_EINVAL = -2, + SDIO_EIO = -3, + SDIO_ENODEV = -4, + SDIO_ENOMEM = -5, + SDIO_ENOTSUPP = -6, + SDIO_ENXIO = -7, + SDIO_ETIMEDOUT = -8, +}; + +/** + * Card interrupt handler function. + * + * @param uif handle to the interrupting device. + * @param arg data supplied by the caller of sdio_open(). + */ +typedef void (LIBSDIOAPI *sdio_int_handler_t)(sdio_uif_t uif, void *arg); + +/** + * Asynchronous IO completion callback function. + * + * @param uif handle to the device that completed the IO operation. + * @param arg data supplied by the caller of the asynchronous IO operation. + * @param status status of the IO operation. 0 is success; -EIO, + * -EINVAL, -ETIMEDOUT etc. on an error. + */ +typedef void (LIBSDIOAPI *sdio_io_callback_t)(sdio_uif_t uif, void *arg, int status); + +/** + * Open a SDIO Userspace Interface device and (optionally) register a + * card interrupt handler and enable card interrupts. + * + * Card interrupts are masked before calling int_handler and are + * unmasked when int_handler returns (unless sdio_interrupt_mask() is + * called). + * + * @param dev_filename filename of the device to open. + * @param int_handler card interrupt handler; or NULL if no + * interrupt handler is required. + * @param arg argument to be passed to the interrupt handler. + * + * @return handle to the opened device; or NULL on error with errno + * set. + */ +sdio_uif_t LIBSDIOAPI sdio_open(const char *dev_filename, + sdio_int_handler_t int_handler, void *arg); + +/** + * Mask the SDIO interrupt. + * + * Call this in an interrupt handler to allow the processing of + * interrupts to be deferred until after the interrupt handler has + * returned. + * + * @note \e Must only be called from within the interrupt handler + * registered with sdio_open(). + * + * @param uif device handle. + */ +void LIBSDIOAPI sdio_interrupt_mask(sdio_uif_t uif); + +/** + * Unmask the SDIO interrupt. + * + * Unmasks the SDIO interrupt if it had previously been masked with + * sdio_interrupt_mask(). + * + * @param uif device handle. + */ +void LIBSDIOAPI sdio_interrupt_unmask(sdio_uif_t uif); + +/** + * Close an opened SDIO Userspace Interface device, freeing all + * associated resources. + * + * @param uif handle to the device. + */ +void LIBSDIOAPI sdio_close(sdio_uif_t uif); + +/** + * Return the number of functions the card has. + * + * @param uif device handle. + * + * @return number of card functions. + */ +int LIBSDIOAPI sdio_num_functions(sdio_uif_t uif); + +/** + * Set an SDIO bus to 1 bit or 4 bit wide mode. + * + * The CCCR bus interface control register will be read and rewritten + * with the new bus width. + * + * @param uif device handle. + * @param bus_width bus width (1 or 4). + * + * @return 0 on success; -ve on error with errno set. + * + * @note The card capabilities are \e not checked. The user should + * ensure 4 bit mode is not enabled on a card that does not support + * it. + */ +int LIBSDIOAPI sdio_set_bus_width(sdio_uif_t uif, int bus_width); + +/** + * Limit the frequency of (or stop) the SD bus clock. + * + * The frequency cannot be set greater than that supported by the card + * or the controller. + * + * @note Stopping the bus clock while other device drivers are + * executing commands may result in those commands not completing + * until the bus clock is restarted. + * + * @param uif device handle. + * @param max_freq maximum frequency (Hz) or 0 to stop the bus clock + * until the start of the next command. + */ +void LIBSDIOAPI sdio_set_max_bus_freq(sdio_uif_t uif, int max_freq); + +/** + * Return the card's manufacturer (vendor) ID. + * + * @param uif device handle. + * + * @return manufacturer ID. + */ +uint16_t LIBSDIOAPI sdio_manf_id(sdio_uif_t uif); + +/** + * Return the card's card (device) ID. + * + * @param uif device handle. + * + * @return card ID. + */ +uint16_t LIBSDIOAPI sdio_card_id(sdio_uif_t uif); + +/** + * Return the standard interface code for a function. + * + * @param uif device handle. + * @param func card function to query. + * + * @return the standard interface. + */ +uint8_t LIBSDIOAPI sdio_std_if(sdio_uif_t uif, int func); + +/** + * Return a function's maximum supported block size. + * + * @param uif device handle. + * @param func card function to query. + * + * @return maximum block size. + */ +int LIBSDIOAPI sdio_max_block_size(sdio_uif_t uif, int func); + +/** + * Return a function's current block size. + * + * @note This returns the driver's view of the block size and not the + * value in the function's block size register. + * + * @param uif device handle. + * @param func card function to query. + * + * @return the current block size. + */ +int LIBSDIOAPI sdio_block_size(sdio_uif_t uif, int func); + +/** + * Set a function's block size. + * + * The function's block size registers will be written if necessary. + * + * @param uif device handle. + * @param func function to modify. + * @param blksz the new block size; or 0 for the default size. + * + * @return 0 on success; or -ve on error with errno set. + */ +int LIBSDIOAPI sdio_set_block_size(sdio_uif_t uif, int func, int blksz); + +/** + * Read an 8 bit register. + * + * @param uif device handle. + * @param func card function. + * @param addr register address. + * @param data the data read. + * + * @return 0 on success; or -ve on error with errno set. + */ +int LIBSDIOAPI sdio_read8(sdio_uif_t uif, int func, uint32_t addr, uint8_t *data); + +/** + * Write an 8 bit register. + * + * @param uif device handle. + * @param func card function. + * @param addr register address. + * @param data the data to write. + * + * @return 0 on success; or -ve on error with errno set. + */ +int LIBSDIOAPI sdio_write8(sdio_uif_t uif, int func, uint32_t addr, uint8_t data); + +/** + * Read a buffer from a 8 bit wide register/FIFO. + * + * The buffer read uses a fixed (not incrementing) address. + * + * \a block_size \e must be set to the value writted into \a func's + * I/O block size FBR register. + * + * If \a len % \a block_size == 0, a block mode transfer is used; a + * byte mode transfer is used if \a len < \a block_size. + * + * @param uif device handle. + * @param func card function. + * @param addr register/FIFO address. + * @param data buffer to store the data read. + * @param len length of data to read. + * @param block_size block size to use for this transfer. + * + * @return 0 on success; or -ve on error with errno set. + */ +int LIBSDIOAPI sdio_read(sdio_uif_t uif, int func, uint32_t addr, uint8_t *data, + size_t len, int block_size); + +/** + * Write a buffer to an 8 bit wide register/FIFO. + * + * The buffer write uses a fixed (not incrementing) address. + * + * \a block_size \e must be set to the value writted into \a func's + * I/O block size FBR register. + * + * If \a len % \a block_size == 0, a block mode transfer is used; a + * byte mode transfer is used if \a len < \a block_size. + * + * @param uif device handle. + * @param func card function. + * @param addr register/FIFO address. + * @param data buffer of data to write. + * @param len length of the data to write. + * @param block_size block size to use for this transfer. + * + * @return 0 on success; or -ve on error with errno set. + */ +int LIBSDIOAPI sdio_write(sdio_uif_t uif, int func, uint32_t addr, const uint8_t *data, + size_t len, int block_size); + +/** + * Read an 8 bit register, without waiting for completion. + * + * @param uif device handle. + * @param func card function. + * @param addr register address. + * @param data the data read. + * @param callback function to be called when the read completes. + * @param arg argument to be passed to callback. + * + * @return 0 on success; or -ve on error with errno set. + */ +int LIBSDIOAPI sdio_read8_async(sdio_uif_t uif, int func, uint32_t addr, uint8_t *data, + sdio_io_callback_t callback, void *arg); + +/** + * Write an 8 bit register, without waiting for completion. + * + * @param uif device handle. + * @param func card function. + * @param addr register address. + * @param data the data to write. + * @param callback function to be called when the write completes. + * @param arg argument to be passed to callback. + * + * @return 0 on success; or -ve on error with errno set. + */ +int LIBSDIOAPI sdio_write8_async(sdio_uif_t uif, int func, uint32_t addr, uint8_t data, + sdio_io_callback_t callback, void *arg); + +/** + * Read a buffer from a 8 bit wide register/FIFO, without waiting for + * completion. + * + * The buffer read uses a fixed (not incrementing) address. + * + * \a block_size \e must be set to the value writted into \a func's + * I/O block size FBR register. + * + * If \a len % \a block_size == 0, a block mode transfer is used; a + * byte mode transfer is used if \a len < \a block_size. + * + * @param uif device handle. + * @param func card function. + * @param addr register/FIFO address. + * @param data buffer to store the data read. + * @param len length of data to read. + * @param block_size block size to use for this transfer. + * @param callback function to be called when the read completes. + * @param arg argument to be passed to callback. + * + * @return 0 on success; or -ve on error with errno set. + */ +int LIBSDIOAPI sdio_read_async(sdio_uif_t uif, int func, uint32_t addr, uint8_t *data, + size_t len, int block_size, + sdio_io_callback_t callback, void *arg); + +/** + * Write a buffer to an 8 bit wide register/FIFO, without waiting for + * completion. + * + * The buffer write uses a fixed (not incrementing) address. + * + * \a block_size \e must be set to the value writted into \a func's + * I/O block size FBR register. + * + * If \a len % \a block_size == 0, a block mode transfer is used; a + * byte mode transfer is used if \a len < \a block_size. + * + * @param uif device handle. + * @param func card function. + * @param addr register/FIFO address. + * @param data buffer of data to write. + * @param len length of the data to write. + * @param block_size block size to use for this transfer. + * @param callback function to be called when the write completes. + * @param arg argument to be passed to callback. + * + * @return 0 on success; or -ve on error with errno set. + */ +int LIBSDIOAPI sdio_write_async(sdio_uif_t uif, int func, uint32_t addr, const uint8_t *data, + size_t len, int block_size, + sdio_io_callback_t callback, void *arg); +/** + * Force a card removal and reinsertion. + * + * This will power cycle the card if the slot hardware supports power + * control. + * + * @note The device handle will no longer be valid. + * + * @param uif device handle. + * + * @return 0 on success; or -ve on error with errno set. + */ +int LIBSDIOAPI sdio_reinsert_card(sdio_uif_t uif); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/*@}*/ + +#endif /* #ifndef SDIOEMB_LIBSDIO_H */ diff --git a/drivers/staging/csr/sdioemb/linux.h b/drivers/staging/csr/sdioemb/linux.h new file mode 100644 index 0000000..f574f71 --- /dev/null +++ b/drivers/staging/csr/sdioemb/linux.h @@ -0,0 +1,16 @@ +/* + * Linux helpers for slot drivers. + * + * Copyright (C) 2009 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef SDIOEMB_LINUX_H +#define SDIOEMB_LINUX_H + +#include + +int sdioemb_linux_slot_register(struct sdioemb_slot *slot); + +#endif /* #ifndef SDIOEMB_LINUX_H */ diff --git a/drivers/staging/csr/sdioemb/sdio.h b/drivers/staging/csr/sdioemb/sdio.h new file mode 100644 index 0000000..50bb8fd --- /dev/null +++ b/drivers/staging/csr/sdioemb/sdio.h @@ -0,0 +1,117 @@ +/* + * Standard SDIO definitions. + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef SDIOEMB_SDIO_H +#define SDIOEMB_SDIO_H + +/* Maximum time for VDD to rise to VDD min. */ +#define SDIO_POWER_UP_TIME_MS 250 + +/* Minimum SD bus clock a card must support (Hz). */ +#define SDIO_CLOCK_FREQ_MIN 400000 + +/* Maximum clock frequency for normal mode (Hz). + * + * Although high speed mode should be suitable for all speeds not all + * controller/card combinations are capable of meeting the higher + * tolerances for (e.g.) clock rise/fall times. Therefore, default + * mode is used where possible for improved compatibility. */ +#define SDIO_CLOCK_FREQ_NORMAL_SPD 25000000 + +/* Maximum clock frequency for high speed mode (Hz). */ +#define SDIO_CLOCK_FREQ_HIGH_SPD 50000000 + +#define SDIO_MAX_FUNCTIONS 8 /* incl. F0 */ + +/* Command argument format. */ + +#define SDIO_CMD52_ARG_WRITE 0x80000000 +#define SDIO_CMD52_ARG_FUNC(f) ((f) << 28) +#define SDIO_CMD52_ARG_ADDR(a) ((a) << 9) +#define SDIO_CMD52_ARG_DATA(d) ((d) << 0) + +#define SDIO_CMD53_ARG_WRITE 0x80000000 +#define SDIO_CMD53_ARG_FUNC(f) ((f) << 28) +#define SDIO_CMD53_ARG_BLK_MODE 0x08000000 +#define SDIO_CMD53_ARG_ADDR(a) ((a) << 9) +#define SDIO_CMD53_ARG_CNT(c) ((c) << 0) + +/* Response format. */ + +#define SDIO_R5_DATA(r) (((r) >> 0) & 0xff) +#define SDIO_R5_OUT_OF_RANGE (1 << 8) +#define SDIO_R5_FUNCTION_NUMBER (1 << 9) +#define SDIO_R5_ERROR (1 << 11) + +/* Register offsets and bits. */ + +#define SDIO_OCR_CARD_READY 0x80000000 +#define SDIO_OCR_NUM_FUNCS_MASK 0x70000000 +#define SDIO_OCR_NUM_FUNCS_OFFSET 28 +#define SDIO_OCR_VOLTAGE_3V3 0x00300000 /* 3.2-3.3V & 3.3-3.4V */ + +#define SDIO_CCCR_SDIO_REV 0x00 +#define SDIO_CCCR_SD_REV 0x01 +#define SDIO_CCCR_IO_EN 0x02 +#define SDIO_CCCR_IO_READY 0x03 +#define SDIO_CCCR_INT_EN 0x04 +# define SDIO_CCCR_INT_EN_MIE 0x01 +#define SDIO_CCCR_INT_PENDING 0x05 +#define SDIO_CCCR_IO_ABORT 0x06 +#define SDIO_CCCR_BUS_IFACE_CNTL 0x07 +# define SDIO_CCCR_BUS_IFACE_CNTL_CD_R_DISABLE 0x80 +# define SDIO_CCCR_BUS_IFACE_CNTL_ECSI 0x20 +# define SDIO_CCCR_BUS_IFACE_CNTL_4BIT_BUS 0x02 +#define SDIO_CCCR_CARD_CAPS 0x08 +# define SDIO_CCCR_CARD_CAPS_LSC 0x40 +# define SDIO_CCCR_CARD_CAPS_4BLS 0x80 +#define SDIO_CCCR_CIS_PTR 0x09 +#define SDIO_CCCR_BUS_SUSPEND 0x0c +#define SDIO_CCCR_FUNC_SEL 0x0d +#define SDIO_CCCR_EXEC_FLAGS 0x0e +#define SDIO_CCCR_READY_FLAGS 0x0f +#define SDIO_CCCR_F0_BLK_SIZE 0x10 +#define SDIO_CCCR_PWR_CNTL 0x12 +#define SDIO_CCCR_HIGH_SPEED 0x13 +# define SDIO_CCCR_HIGH_SPEED_SHS 0x01 +# define SDIO_CCCR_HIGH_SPEED_EHS 0x02 + +#define SDIO_FBR_REG(f, r) (0x100*(f) + (r)) + +#define SDIO_FBR_STD_IFACE(f) SDIO_FBR_REG(f, 0x00) +#define SDIO_FBR_STD_IFACE_EXT(f) SDIO_FBR_REG(f, 0x01) +#define SDIO_FBR_CIS_PTR(f) SDIO_FBR_REG(f, 0x09) +#define SDIO_FBR_CSA_PTR(f) SDIO_FBR_REG(f, 0x0c) +#define SDIO_FBR_CSA_DATA(f) SDIO_FBR_REG(f, 0x0f) +#define SDIO_FBR_BLK_SIZE(f) SDIO_FBR_REG(f, 0x10) + +#define SDIO_STD_IFACE_UART 0x01 +#define SDIO_STD_IFACE_BT_TYPE_A 0x02 +#define SDIO_STD_IFACE_BT_TYPE_B 0x03 +#define SDIO_STD_IFACE_GPS 0x04 +#define SDIO_STD_IFACE_CAMERA 0x05 +#define SDIO_STD_IFACE_PHS 0x06 +#define SDIO_STD_IFACE_WLAN 0x07 +#define SDIO_STD_IFACE_BT_TYPE_A_AMP 0x09 + +/* + * Manufacturer and card IDs. + */ +#define SDIO_MANF_ID_CSR 0x032a + +#define SDIO_CARD_ID_CSR_UNIFI_1 0x0001 +#define SDIO_CARD_ID_CSR_UNIFI_2 0x0002 +#define SDIO_CARD_ID_CSR_BC6 0x0004 +#define SDIO_CARD_ID_CSR_DASH_D00 0x0005 +#define SDIO_CARD_ID_CSR_BC7 0x0006 +#define SDIO_CARD_ID_CSR_CINDERELLA 0x0007 +#define SDIO_CARD_ID_CSR_UNIFI_3 0x0007 +#define SDIO_CARD_ID_CSR_UNIFI_4 0x0008 +#define SDIO_CARD_ID_CSR_DASH 0x0010 + +#endif /* #ifndef SDIOEMB_SDIO_H */ diff --git a/drivers/staging/csr/sdioemb/sdio_api.h b/drivers/staging/csr/sdioemb/sdio_api.h new file mode 100644 index 0000000..cd8aded --- /dev/null +++ b/drivers/staging/csr/sdioemb/sdio_api.h @@ -0,0 +1,408 @@ +/* + * SDIO device driver API. + * + * Copyright (C) 2007-2008 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef _SDIO_API_H +#define _SDIO_API_H + +/** + * @defgroup fdriver SDIO function driver API + * + * @brief The SDIO function driver API is used to implement drivers + * for SDIO card functions. + * + * Function drivers register with the SDIO driver core + * (sdio_register_driver()), listing which functions it supports and + * providing callback functions for card inserts, removes and + * interrupts. + * + * @par \anchor card_io_ops Card I/O operations: + * + * - \link sdioemb_read8(struct sdioemb_dev *, uint32_t, uint8_t *) sdioemb_read8()\endlink + * - \link sdioemb_read16(struct sdioemb_dev *, uint32_t, uint16_t *) sdioemb_read16()\endlink + * - \link sdioemb_write8(struct sdioemb_dev *, uint32_t, uint8_t) sdioemb_write8()\endlink + * - \link sdioemb_write16(struct sdioemb_dev *, uint32_t, uint16_t) sdioemb_write16()\endlink + * - \link sdioemb_f0_read8(struct sdioemb_dev *, uint32_t, uint8_t *) sdioemb_f0_read8()\endlink + * - \link sdioemb_f0_write8(struct sdioemb_dev *, uint32_t, uint8_t) sdioemb_f0_write8()\endlink + * - \link sdioemb_read(struct sdioemb_dev *, uint32_t, void *, size_t) sdioemb_read()\endlink + * - \link sdioemb_write(struct sdioemb_dev *, uint32_t, const void *, size_t) sdioemb_write()\endlink + */ + +struct sdioemb_func_driver; +struct sdioemb_dev; +struct sdioemb_dev_priv; + +/** + * An SDIO device. + * + * Each SDIO card will have an sdio_dev for each function. + * + * None of the fields (except for drv_data) should be written. + * + * @ingroup fdriver + */ +struct sdioemb_dev { + struct sdioemb_func_driver *driver; /**< Function driver for this device. */ + uint16_t vendor_id; /**< Vendor ID of the card. */ + uint16_t device_id; /**< Device ID of the card. */ + int function; /**< Function number of this device. */ + uint8_t interface; /**< SDIO standard interface number. */ + uint16_t max_blocksize; /**< Maximum block size supported. */ + uint16_t blocksize; /**< Blocksize in use. */ + int slot_id; /**< ID of the slot this card is inserted into. */ + void * os_device; /**< Pointer to an OS-specific device structure. */ + struct sdioemb_dev_priv *priv; /**< Data private to the SDIO core. */ + void * drv_data; /**< Data private to the function driver. */ +}; + +#define SDIOEMB_ANY_ID 0xffff +#define SDIOEMB_UIF_FUNC 0 +#define SDIOEMB_ANY_FUNC 0xff +#define SDIOEMB_ANY_IFACE 0xff + +/** + * An entry for an SDIO device ID table. + * + * Functions are matched to drivers using any combination of vendor + * ID, device ID, function number or standard interface. + * + * Matching on #function == SDIOEMB_UIF_FUNC is reserved for the SDIO + * Userspace Interface driver. Card management drivers can match on + * #function == 0, these will be probed before any function drivers. + * + * @ingroup fdriver + */ +struct sdioemb_id_table { + uint16_t vendor_id; /**< Vendor ID to match or SDIOEMB_ANY_ID */ + uint16_t device_id; /**< Device ID to match or SDIOEMB_ANY_ID */ + int function; /**< Function number to match or SDIOEMB_ANY_FUNC */ + uint8_t interface; /**< SDIO standard interface to match or SDIOEMB_ANY_IFACE */ +}; + +/** + * A driver for an SDIO function. + * + * @ingroup fdriver + */ +struct sdioemb_func_driver { + /** + * Driver name used in diagnostics. + */ + const char *name; + + /** + * 0 terminated array of functions supported by this device. + * + * The driver may (for example) match on a number of vendor + * ID/device ID/function number triplets or on an SDIO standard + * interface. + */ + struct sdioemb_id_table *id_table; + + /** + * Called by the core when an inserted card has functions which + * match those listed in id_table. + * + * The driver's implementation should (if required): + * + * - perform any additional probing + * - do function specific initialization + * - allocate and register any function/OS specific devices or interfaces. + * + * Called in: thread context. + * + * @param fdev the newly inserted device. + * + * @return 0 on success; -ve on error. + */ + int (*probe)(struct sdioemb_dev *fdev); + + /** + * Called by the core when a card is removed. This is only called + * if the probe() call succeeded. + * + * The driver's implementation should (if required); + * + * - do any function specific shutdown. + * - cleanup any data structures created/registers during probe(). + * + * Called in: thread context. + * + * @param fdev the device being removed. + */ + void (*remove)(struct sdioemb_dev *fdev); + + /** + * Called by the core to signal an SDIO interrupt for this card + * occurs, if interrupts have been enabled with + * sdioemb_interrupt_enable(). + * + * The driver's implementation should signal a thread (or similar) + * to actually handle the interrupt as no card I/O may be + * performed whilst in interrupt context. When the interrupt is + * handled, the driver should call sdioemb_interrupt_acknowledge() to + * enable further interrupts to be signalled. + * + * Called in: interrupt context. + * + * @param fdev the device which may have raised the interrupt. + */ + void (*card_int_handler)(struct sdioemb_dev *fdev); + + /** + * Called by the core to signal a suspend power management + * event occured. + * + * The driver's implementation should (if required) + * set the card to a low power mode and return as soon + * as possible. After this function returns, the + * driver should not start any SDIO commands. + * + * Called in: thread context. + * + * @param fdev the device handler. + */ + void (*suspend)(struct sdioemb_dev *fdev); + + /** + * Called by the core to signal a resume power management + * event occured. + * + * The driver's implementation should (if required) + * initialise the card to an operational mode and return + * as soon as possible. If the card has been powered off + * during suspend, the driver would have to initialise + * the card from scratch (f/w download, h/w initialisation, etc.). + * + * Called in: thread context. + * + * @param fdev the device handler. + */ + void (*resume)(struct sdioemb_dev *fdev); +}; + +int sdioemb_driver_register(struct sdioemb_func_driver *fdriver); +void sdioemb_driver_unregister(struct sdioemb_func_driver *fdriver); + +int sdioemb_driver_probe(struct sdioemb_func_driver *fdriver, struct sdioemb_dev *fdev); +void sdioemb_driver_remove(struct sdioemb_func_driver *fdriver, struct sdioemb_dev *fdev); + +/* For backward compatibility. */ +#define sdio_register_driver sdioemb_driver_register +#define sdio_unregister_driver sdioemb_driver_unregister + +int sdioemb_set_block_size(struct sdioemb_dev *fdev, uint16_t blksz); +void sdioemb_set_max_bus_freq(struct sdioemb_dev *fdev, int max_freq); +int sdioemb_set_bus_width(struct sdioemb_dev *fdev, int bus_width); + +int sdioemb_enable_function(struct sdioemb_dev *fdev); +int sdioemb_disable_function(struct sdioemb_dev *fdev); +int sdioemb_reenable_csr_function(struct sdioemb_dev *dev); +void sdioemb_idle_function(struct sdioemb_dev *fdev); + +int sdioemb_read8(struct sdioemb_dev *fdev, uint32_t addr, uint8_t *val); +int sdioemb_read16(struct sdioemb_dev *fdev, uint32_t addr, uint16_t *val); +int sdioemb_write8(struct sdioemb_dev *fdev, uint32_t addr, uint8_t val); +int sdioemb_write16(struct sdioemb_dev *fdev, uint32_t addr, uint16_t val); +int sdioemb_f0_read8(struct sdioemb_dev *fdev, uint32_t addr, uint8_t *val); +int sdioemb_f0_write8(struct sdioemb_dev *fdev, uint32_t addr, uint8_t val); +int sdioemb_read(struct sdioemb_dev *fdev, uint32_t addr, void *data, size_t len); +int sdioemb_write(struct sdioemb_dev *fdev, uint32_t addr, const void *data, size_t len); + +int sdioemb_hard_reset(struct sdioemb_dev *fdev); + +void sdioemb_power_on(struct sdioemb_dev *fdev); +void sdioemb_power_off(struct sdioemb_dev *fdev); + +int sdioemb_interrupt_enable(struct sdioemb_dev *fdev); +int sdioemb_interrupt_disable(struct sdioemb_dev *fdev); +void sdioemb_interrupt_acknowledge(struct sdioemb_dev *fdev); + +int sdioemb_cis_get_tuple(struct sdioemb_dev *fdev, uint8_t tuple, + void *buf, size_t len); + +void sdioemb_suspend_function(struct sdioemb_dev *fdev); +void sdioemb_resume_function(struct sdioemb_dev *fdev); + +/** + * SDIO command status. + * + * @ingroup fdriver + */ +enum sdioemb_cmd_status { + SDIOEMB_CMD_OK = 0x00, /**< Command successful. */ + + SDIOEMB_CMD_ERR_CMD = 0x01, + SDIOEMB_CMD_ERR_DAT = 0x02, + + SDIOEMB_CMD_ERR_CRC = 0x10, + SDIOEMB_CMD_ERR_TIMEOUT = 0x20, + SDIOEMB_CMD_ERR_OTHER = 0x40, + + SDIOEMB_CMD_ERR_CMD_CRC = SDIOEMB_CMD_ERR_CMD | SDIOEMB_CMD_ERR_CRC, /**< Response CRC error. */ + SDIOEMB_CMD_ERR_CMD_TIMEOUT = SDIOEMB_CMD_ERR_CMD | SDIOEMB_CMD_ERR_TIMEOUT, /**< Response time out. */ + SDIOEMB_CMD_ERR_CMD_OTHER = SDIOEMB_CMD_ERR_CMD | SDIOEMB_CMD_ERR_OTHER, /**< Other response error. */ + SDIOEMB_CMD_ERR_DAT_CRC = SDIOEMB_CMD_ERR_DAT | SDIOEMB_CMD_ERR_CRC, /**< Data CRC error. */ + SDIOEMB_CMD_ERR_DAT_TIMEOUT = SDIOEMB_CMD_ERR_DAT | SDIOEMB_CMD_ERR_TIMEOUT, /**< Data receive time out. */ + SDIOEMB_CMD_ERR_DAT_OTHER = SDIOEMB_CMD_ERR_DAT | SDIOEMB_CMD_ERR_OTHER, /**< Other data error. */ + + SDIOEMB_CMD_ERR_NO_CARD = 0x04, /**< No card present. */ + + SDIOEMB_CMD_IN_PROGRESS = 0xff, /**< Command still in progress. */ +}; + +/** + * A response to an SDIO command. + * + * For R1, R4, R5, and R6 responses only the middle 32 bits of the + * response are stored, the leading octet (start and direction bits + * and command index) and trailing octet (CRC and stop bit) are + * discarded. + * + * @bug R2 and R3 responses are not used by SDIO and are not + * supported. + * + * @ingroup fdriver + */ +union sdioemb_response { + uint32_t r1; + uint32_t r4; + uint32_t r5; + uint32_t r6; +}; + +/** + * SDIO command parameters and response. + */ +struct sdioemb_cmd_resp { + uint8_t cmd; /**< Command index (0 to 63). */ + uint32_t arg; /**< Command argument. */ + union sdioemb_response response; /**< Response to the command. Valid + iff the command has completed and + (sdio_cmd::status & SDIOEMB_CMD_ERR_CMD) == 0.*/ +}; + +/** + * CSPI command parameters and response. + */ +struct cspi_cmd_resp { + unsigned cmd : 8; /**< Command octet (type, and function). */ + unsigned addr: 24; /**< 24 bit address. */ + uint16_t val; /**< Word to write or read from the card (for non-burst commands). */ + uint8_t response; /**< Response octet. Valid iff the command has completed and + (sdio_cmd::status & SDIOEMB_CMD_ERR_CMD) == 0. */ +}; + + +/** + * An SDIO command, its status and response. + * + * sdio_cmd is used to submit SDIO commands to a device and return its + * status and any response or data. + * + * @ingroup fdriver + */ +struct sdioemb_cmd { + /** + * The SDIO device which submitted the command. Set by the + * core. + */ + struct sdioemb_dev *owner; + + /** + * Called by the core when the command has been completed. + * + * Called in: interrupt context. + * + * @param cmd the completed command. + */ + void (*callback)(struct sdioemb_cmd *cmd); + + /** + * Set of flags specifying the response type, data transfer + * direction and other parameters. + * + * For SDIO commands set at least one of the response types: + * - #SDIOEMB_CMD_FLAG_RESP_NONE + * - #SDIOEMB_CMD_FLAG_RESP_R1 + * - #SDIOEMB_CMD_FLAG_RESP_R1B + * - #SDIOEMB_CMD_FLAG_RESP_R2 + * - #SDIOEMB_CMD_FLAG_RESP_R3 + * - #SDIOEMB_CMD_FLAG_RESP_R4 + * - #SDIOEMB_CMD_FLAG_RESP_R5 + * - #SDIOEMB_CMD_FLAG_RESP_R5B + * - #SDIOEMB_CMD_FLAG_RESP_R6 + * + * and any of the additional flags: + * - #SDIOEMB_CMD_FLAG_READ + * + * For CSPI commands set: + * - #SDIOEMB_CMD_FLAG_CSPI + */ + unsigned flags; + + /** + * SDIO command parameters and response. + * + * Valid only if #SDIOEMB_CMD_FLAG_CSPI is \e not set in #flags. + */ + struct sdioemb_cmd_resp sdio; + + /** + * CSPI command parameters and response. + * + * Valid only if #SDIOEMB_CMD_FLAG_CSPI is set in #flags. + */ + struct cspi_cmd_resp cspi; + + /** + * Buffer of data to read or write. + * + * Must be set to NULL if the command is not a data transfer. + */ + uint8_t *data; + + /** + * Length of #data in octets. + * + * len must be either: less than the device's sdio_dev::blocksize; + * or a multiple of the device's sdio_dev::blocksize. + */ + size_t len; + + /** + * Status of the command after it has completed. + */ + enum sdioemb_cmd_status status; + + /** + * Data private to caller of sdioemb_start_cmd(). + */ + void *priv; +}; + +/** @addtogroup fdriver + *@{*/ +#define SDIOEMB_CMD_FLAG_RESP_NONE 0x00 /**< No response. */ +#define SDIOEMB_CMD_FLAG_RESP_R1 0x01 /**< R1 response. */ +#define SDIOEMB_CMD_FLAG_RESP_R1B 0x02 /**< R1b response. */ +#define SDIOEMB_CMD_FLAG_RESP_R2 0x03 /**< R2 response. */ +#define SDIOEMB_CMD_FLAG_RESP_R3 0x04 /**< R3 response. */ +#define SDIOEMB_CMD_FLAG_RESP_R4 0x05 /**< R4 response. */ +#define SDIOEMB_CMD_FLAG_RESP_R5 0x06 /**< R5 response. */ +#define SDIOEMB_CMD_FLAG_RESP_R5B 0x07 /**< R5b response. */ +#define SDIOEMB_CMD_FLAG_RESP_R6 0x08 /**< R6 response. */ +#define SDIOEMB_CMD_FLAG_RESP_MASK 0xff /**< Mask for response type. */ +#define SDIOEMB_CMD_FLAG_RAW 0x0100 /**< @internal Bypass the command queues. */ +#define SDIOEMB_CMD_FLAG_READ 0x0200 /**< Data transfer is a read, not a write. */ +#define SDIOEMB_CMD_FLAG_CSPI 0x0400 /**< CSPI transfer, not SDIO or SDIO-SPI. */ +#define SDIOEMB_CMD_FLAG_ABORT 0x0800 /**< Data transfer abort command. */ +/*@}*/ + +int sdioemb_start_cmd(struct sdioemb_dev *fdev, struct sdioemb_cmd *cmd); + +#endif /* #ifndef _SDIO_API_H */ diff --git a/drivers/staging/csr/sdioemb/sdio_bt_a.h b/drivers/staging/csr/sdioemb/sdio_bt_a.h new file mode 100644 index 0000000..9efe4a3 --- /dev/null +++ b/drivers/staging/csr/sdioemb/sdio_bt_a.h @@ -0,0 +1,143 @@ +/* + * SDIO Bluetooth Type-A interface definitions. + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef SDIOEMB_SDIO_BT_A_H +#define SDIOEMB_SDIO_BT_A_H + +#include +#include + +/* + * Standard SDIO function registers for a Bluetooth Type-A interface. + */ +#define SDIO_BT_A_RD 0x00 +#define SDIO_BT_A_TD 0x00 + +#define SDIO_BT_A_RX_PKT_CTRL 0x10 +# define PC_RRT 0x01 + +#define SDIO_BT_A_TX_PKT_CTRL 0x11 +# define PC_WRT 0x01 + +#define SDIO_BT_A_RETRY_CTRL 0x12 +# define RTC_STAT 0x01 +# define RTC_SET 0x01 + +#define SDIO_BT_A_INTRD 0x13 +# define INTRD 0x01 +# define CL_INTRD 0x01 + +#define SDIO_BT_A_INT_EN 0x14 +# define EN_INTRD 0x01 + +#define SDIO_BT_A_BT_MODE 0x20 +# define MD_STAT 0x01 + +/* + * Length of the Type-A header. + * + * Packet length (3 octets) plus Service ID (1 octet). + */ +#define SDIO_BT_A_HEADER_LEN 4 + +/* + * Maximum length of a Type-A transport packet. + * + * Type-A header length and maximum length of a HCI packet (65535 + * octets). + */ +#define SDIO_BT_A_PACKET_LEN_MAX 65543 + +enum sdioemb_bt_a_service_id { + SDIO_BT_A_SID_CMD = 0x01, + SDIO_BT_A_SID_ACL = 0x02, + SDIO_BT_A_SID_SCO = 0x03, + SDIO_BT_A_SID_EVT = 0x04, + SDIO_BT_A_SID_VENDOR = 0xfe, +}; + +static __inline int sdioemb_bt_a_packet_len(const char *p) +{ + return (p[0] & 0xff) | ((p[1] & 0xff) << 8) | ((p[2] & 0xff) << 16); +} + +static __inline int sdioemb_bt_a_service_id(const char *p) +{ + return p[3]; +} + +/* + * Minimum amount to read (including the Type-A header). This allows + * short packets (e.g., flow control packets) to be read with a single + * command. + */ +#define SDIO_BT_A_MIN_READ 32 + +#define SDIO_BT_A_NAME_LEN 16 + +struct sdioemb_bt_a_dev { + CsrSdioFunction *func; + char name[SDIO_BT_A_NAME_LEN]; + void *drv_data; + + /** + * Get a buffer to receive a packet into. + * + * @param bt the BT device. + * @param header a buffer of length #SDIO_BT_A_MIN_READ containing + * (part of) the packet the buffer is for. It will contain + * the Type-A header and as much of the payload that will + * fit. + * @param buffer_min_len the minimum length of buffer required to + * receive the whole packet. This includes space for padding + * the read to a whole number of blocks (if more than 512 + * octets is still to be read). + * @param buffer returns the buffer. The packet (including the + * Type-A header will be placed at the beginning of this + * buffer. + * @param buffer_handle returns a buffer handle passed to the + * subsequent call of the receive() callback. + * + * @return 0 if a buffer was provided. + * @return -ENOMEM if no buffer could be provided. + */ + int (*get_rx_buffer)(struct sdioemb_bt_a_dev *bt, const uint8_t *header, + size_t buffer_min_len, uint8_t **buffer, void **buffer_handle); + void (*receive)(struct sdioemb_bt_a_dev *bt, void *buffer_handle, int status); + void (*sleep_state_changed)(struct sdioemb_bt_a_dev *bt); + + enum sdio_sleep_state sleep_state; + + uint8_t max_tx_retries; + uint8_t max_rx_retries; + unsigned needs_read_ack:1; + unsigned wait_for_firmware:1; + + unsigned rx_off:1; + + /** + * A buffer to read the packet header into before the real buffer + * is requested with the get_rx_buffer() callback. + * + * @internal + */ + uint8_t *header; +}; + +int sdioemb_bt_a_setup(struct sdioemb_bt_a_dev *bt, CsrSdioFunction *func); +void sdioemb_bt_a_cleanup(struct sdioemb_bt_a_dev *bt); +int sdioemb_bt_a_send(struct sdioemb_bt_a_dev *bt, const uint8_t *packet, size_t len); +void sdioemb_bt_a_handle_interrupt(struct sdioemb_bt_a_dev *bt); +void sdioemb_bt_a_set_sleep_state(struct sdioemb_bt_a_dev *bt, enum sdio_sleep_state state); +int sdioemb_bt_a_check_for_reset(struct sdioemb_bt_a_dev *bt); +void sdioemb_bt_a_start(struct sdioemb_bt_a_dev *bt); +void sdioemb_bt_a_stop(struct sdioemb_bt_a_dev *bt); +void sdioemb_bt_a_rx_on(struct sdioemb_bt_a_dev *bt); +void sdioemb_bt_a_rx_off(struct sdioemb_bt_a_dev *bt); + +#endif /* #ifndef SDIOEMB_SDIO_BT_A_H */ diff --git a/drivers/staging/csr/sdioemb/sdio_cis.h b/drivers/staging/csr/sdioemb/sdio_cis.h new file mode 100644 index 0000000..ec5e8fc --- /dev/null +++ b/drivers/staging/csr/sdioemb/sdio_cis.h @@ -0,0 +1,27 @@ +/* + * SDIO CIS definitions. + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef _SDIO_CIS_H +#define _SDIO_CIS_H + +#define CISTPL_NULL 0x00 +#define CISTPL_CHECKSUM 0x10 +#define CISTPL_VERS_1 0x15 +#define CISTPL_ALTSTR 0x16 +#define CISTPL_MANFID 0x20 +# define CISTPL_MANFID_SIZE 0x04 +#define CISTPL_FUNCID 0x21 +#define CISTPL_FUNCE 0x22 +#define CISTPL_SDIO_STD 0x91 +#define CISTPL_SDIO_EXT 0x92 +#define CISTPL_END 0xff +#define CISTPL_FUNCE 0x22 +# define CISTPL_FUNCE_00_SIZE 0x04 +# define CISTPL_FUNCE_01_SIZE 0x2a + +#endif /* #ifndef _SDIO_CIS_H */ diff --git a/drivers/staging/csr/sdioemb/sdio_csr.h b/drivers/staging/csr/sdioemb/sdio_csr.h new file mode 100644 index 0000000..3b00e46 --- /dev/null +++ b/drivers/staging/csr/sdioemb/sdio_csr.h @@ -0,0 +1,134 @@ +/* + * CSR specific SDIO registers. + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef SDIOEMB_SDIO_CSR_H +#define SDIOEMB_SDIO_CSR_H + +/** + * @defgroup registers CSR specific SDIO registers + * + * Registers at 0xF0 - 0xFF in the CCCR are reserved for vendor + * specific registers. The registers documented here are specific to + * following CSR chips: + * + * - BlueCore (6 and later) + * - UltraCore + *@{ + */ + +/** + * Interrupt status/host wakeup register. + * + * This controls a function's deep sleep state. + * + * @see enum sdio_sleep_state + */ +#define SDIO_CSR_SLEEP_STATE 0xf0 +# define SDIO_CSR_SLEEP_STATE_FUNC(f) ((f) << 4) +# define SDIO_CSR_SLEEP_STATE_RDY_INT_EN 0x02 +# define SDIO_CSR_SLEEP_STATE_WAKE_REQ 0x01 + +/** + * Host interrupt clear register. + * + * Writing a 1 to bit 0 clears an SDIO interrupt raised by a generic + * function. + */ +#define SDIO_CSR_HOST_INT 0xf1 +# define SDIO_CSR_HOST_INT_CL 0x01 + +/** + * From host scratch register 0. + * + * A read/write register that can be used for signalling between the + * host and the chip. + * + * The usage of this register depends on the version of the chip or + * firmware. + */ +#define SDIO_CSR_FROM_HOST_SCRATCH0 0xf2 + +/** + * From host scratch register 1. + * + * @see SDIO_CSR_FROM_HOST_SCRATCH0 + */ +#define SDIO_CSR_FROM_HOST_SCRATCH1 0xf3 + +/** + * To host scratch register 0. + * + * A read only register that may be used for signalling between the + * chip and the host. + * + * The usage of this register depends on the version of the chip or + * firmware. + */ +#define SDIO_CSR_TO_HOST_SCRATCH0 0xf4 + +/** + * To host scratch register 1. + * + * @see SDIO_CSR_TO_HOST_SCRATCH0 + */ +#define SDIO_CSR_TO_HOST_SCRATCH1 0xf5 + +/** + * Extended I/O enable. + * + * Similar to the standard CCCR I/O Enable register, this is used to + * detect if an internal reset of a function has occured and + * (optionally) reenable it. + * + * An internal reset is detected by CCCR I/O Enable bit being set and + * the corresponding EXT_IO_EN bit being clear. + */ +#define SDIO_CSR_EXT_IO_EN 0xf6 + +/** + * Deep sleep states as set via the sleep state register. + * + * These states are used to control when the chip may go into a deep + * sleep (a low power mode). + * + * Since a chip in deep sleep may not respond to SDIO commands, the + * host should ensure that the chip is not in deep sleep before + * attempting SDIO commands to functions 1 to 7. + * + * The available states are: + * + * AWAKE - chip must not enter deep sleep and should exit deep sleep + * if it's currently sleeping. + * + * TORPID - chip may enter deep sleep. + * + * DROWSY - a transition state between TORPID and AWAKE. This is + * AWAKE plus the chip asserts an interrupt when the chip is awake. + * + * @see SDIO_CSR_SLEEP_STATE + */ +enum sdio_sleep_state { + SLEEP_STATE_AWAKE = SDIO_CSR_SLEEP_STATE_WAKE_REQ, + SLEEP_STATE_DROWSY = SDIO_CSR_SLEEP_STATE_WAKE_REQ | SDIO_CSR_SLEEP_STATE_RDY_INT_EN, + SLEEP_STATE_TORPID = 0x00, +}; + +/*@}*/ + +/* + * Generic function registers (with byte addresses). + */ + +/* + * SDIO_MODE is chip dependant, see the sdio_mode table in sdio_cspi.c + * to add support for new chips. + */ +#define SDIO_MODE /* chip dependant */ +# define SDIO_MODE_CSPI_EN 0x40 + +#endif /* SDIOEMB_SDIO_CSR_H */ diff --git a/drivers/staging/csr/sdioemb/slot_api.h b/drivers/staging/csr/sdioemb/slot_api.h new file mode 100644 index 0000000..777bdd4 --- /dev/null +++ b/drivers/staging/csr/sdioemb/slot_api.h @@ -0,0 +1,313 @@ +/* + * Slot driver API. + * + * Copyright (C) 2007-2009 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef _SLOT_API_H +#define _SLOT_API_H + +#include + +struct sdioemb_slot; + +/** + * @defgroup sdriver SDIO slot driver API + * + * @brief The SDIO slot driver API provides an interface for the SDIO + * layer to driver an SDIO slot (socket). + * + * Slot drivers register with the SDIO layer (sdioemb_slot_register()), + * providing functions to starting commands, enabling/disable card + * interrupts, card detection and bus power control. + * + * Functions are provided to notify the SDIO layer when a command has + * completed (sdioemb_cmd_complete()) and when an SDIO card interrupt has + * occurred (sdioemb_interrupt()). + */ + +#define SDIOEMB_BUS_FREQ_OFF 0 +#define SDIOEMB_BUS_FREQ_DEFAULT -1 +#define SDIOEMB_BUS_FREQ_IDLE -2 + +/** + * Valid SDIO bus voltage levels. + * + * @ingroup sdriver + */ +enum sdioemb_power { + SDIOEMB_POWER_OFF = 0, /**< Power switched off. */ + SDIOEMB_POWER_3V3 = 33, /**< Voltage set to 3.3V. */ +}; + +/** + * SDIO slot capabilities. + * + * @ingroup sdriver + */ +struct slot_caps { + int max_bus_freq; /**< Maximum bus frequency (Hz). */ + int max_bus_width; /**< Maximum bus width supported (1 or 4 data lines). */ + uint8_t cspi_mode; /**< CSPI_MODE register value (for CSPI capable slots). */ +}; + +/** + * Controller hardware type. + * + * @ingroup sdriver + */ +enum slot_controller_type { + SDIOEMB_SLOT_TYPE_SD = 0, /**< SD/SDIO controller. */ + SDIOEMB_SLOT_TYPE_SPI, /**< SPI controller. */ + SDIOEMB_SLOT_TYPE_SPI_CSPI, /**< SPI controller capable of CSPI. */ +}; + +/** + * Return values from the add_function() notifier. + * + * @ingroup sdriver + */ +enum sdioemb_add_func_status { + /** + * The core will call sdioemb_add_function(). + */ + SDIOEMB_ADD_FUNC_NOW = 0, + /** + * The slot driver will call sdioemb_add_function() or the + * function driver will call sdioemb_driver_probe() directly. + */ + SDIOEMB_ADD_FUNC_DEFERRED = 1, +}; + +/** + * Slot/card event notifiers. + * + * A slot driver may be notified when certain slot or card events + * occur. + * + * @ingroup sdriver + */ +struct sdioemb_slot_notifiers { + /** + * This is called when a card function has been enumerated + * and initialized but before can be bound to a function driver. + * + * A slot driver may use this to create an OS-specific object for + * the function. The slot driver must either (a) return + * SDIOEMB_ADD_FUNC_NOW; (b) return SDIOEMB_ADD_FUNC_DEFERRED and + * call sdioemb_add_function() later on; (c) return + * SDIOEMB_ADD_FUNC_DEFERRED and pass the fdev to the function + * driver for it to call sdioemb_driver_probe() directly; or (d) + * return an error. + * + * The slot driver may need to get a reference to the fdev with + * sdioemb_get_function() if the lifetime of the OS-specific + * object extends beyond the subsequent return of the + * del_function() callback. + * + * If this is non-NULL the slot driver must also provide + * del_function(). + * + * @param slot the SDIO slot producing the notification. + * @param fdev the SDIO function being added. + * + * @return SDIOEMB_ADD_FUNC_NOW if the function is ready for use. + * @return SDIOEMB_ADD_FUNC_DEFERRED if sdioemb_add_function() or + * sdioemb_driver_probe() will be called later. + * @return -ve on a error. + */ + int (*add_function)(struct sdioemb_slot *slot, struct sdioemb_dev *fdev); + + /** + * This is called when a card function is being removed and after + * any function driver has been unbound. + * + * A slot driver may use this to delete any OS-specific object + * created by the add_function() notifier. + * + * @param slot the SDIO slot producing the notification. + * @param fdev the SDIO function being deleted. + */ + void (*del_function)(struct sdioemb_slot *slot, struct sdioemb_dev *fdev); +}; + +struct sdioemb_slot_priv; + +/** + * An SDIO slot driver. + * + * Allocate and free with sdioemb_slot_alloc() and sdioemb_slot_free(). + * + * @ingroup sdriver + */ +struct sdioemb_slot { + /** + * Name of the slot used in diagnostic messages. + * + * This would typically include the name of the SDIO controller + * and the slot number if the controller has multiple slots. + * + * This will be set by sdioemb_slot_register() if it is left as an + * empty string. + */ + char name[64]; + + /** + * Controller hardware type. + */ + enum slot_controller_type type; + + /** + * Set the SD bus clock frequency. + * + * The driver's implementation should set the SD bus clock to not + * more than \a clk Hz (unless \a clk is equal to + * #SDIOEMB_BUS_FREQ_OFF or #SDIOEMB_BUS_FREQ_IDLE). + * + * If \a clk == SDIOEMB_BUS_FREQ_OFF the clock should be stopped. + * + * \a clk == SDIOEMB_BUS_FREQ_IDLE indicates that the bus is idle + * (currently unused) and the host controller may slow (or stop) + * the SD bus clock to save power on the card. During this idle + * state the host controller must be capable of receiving SDIO + * interrupts (for certain host controllers this may require + * leaving the clock running). + * + * If \a clk is greater than #SDIO_CLOCK_FREQ_NORMAL_SPD (25 MHz) + * subsequent commands should be done with the controller in high + * speed mode. + * + * Called from: interrupt context. + * + * @param slot the slot to configure. + * @param clk new SD bus clock frequency in Hz, SDIOEMB_BUS_FREQ_OFF + * or SDIOEMB_BUS_FREQ_IDLE. + * + * @return The bus frequency actually configured in Hz. + */ + int (*set_bus_freq)(struct sdioemb_slot *slot, int clk); + + /** + * Set the SD bus width. + * + * The driver's implementation should set the width of the SD bus + * for all subsequent data transfers to the specified value. + * + * This may be NULL if the driver sets the bus width when starting + * a command, or the driver is for an SDIO-SPI or CSPI controller. + * + * Called from: thread context. + * + * @param slot the slot to configure. + * @param bus_width new SD bus width (either 1 or 4). + * + * @return 0 on success. + * @return -ve if a low-level error occured when setting the bus width. + */ + int (*set_bus_width)(struct sdioemb_slot *slot, int bus_width); + + /** + * Start an SDIO command. + * + * The driver's implementation should: + * + * - set the controller's bus width to #bus_width, + * - program the controller to start the command. + * + * Called from: interrupt context. + * + * @param slot slot to perform the command. + * @param cmd SDIO command to start. + */ + int (*start_cmd)(struct sdioemb_slot *slot, struct sdioemb_cmd *cmd); + + /** + * Detect if a card is inserted into the slot. + * + * Called from: thread context. + * + * @param slot slot to check. + * + * @return non-zero if a card is inserted; 0 otherwise. + */ + int (*card_present)(struct sdioemb_slot *slot); + + /** + * Switch on/off the SDIO bus power and set the SDIO bus voltage. + * + * Called from: thread context. + * + * @param slot the slot. + * @param power the requested voltage. + * + * @return 0 on success; -ve on error: -EINVAL - requested voltage + * is not supported. + */ + int (*card_power)(struct sdioemb_slot *slot, enum sdioemb_power power); + + /** + * Enable (unmask) the SDIO card interrupt on the controller. + * + * Called from: interrupt context. + * + * @param slot the slot to enable the interrupt on.. + */ + void (*enable_card_int)(struct sdioemb_slot *slot); + + /** + * Disable (mask) the SDIO card interrupt on the controller. + * + * Called from: thread context. + * + * @param slot the slot to disable the interrupt on. + */ + void (*disable_card_int)(struct sdioemb_slot *slot); + + /** + * Perform a hard reset of the card. + * + * Hard resets can be achieved in two ways: + * + * -# Power cycle (if the slot has power control). + * -# Platform-specific assertion of a card/chip reset line. + * + * If hard resets are not supported, either return 0 or set + * hard_reset to NULL. + * + * @param slot the slot for the card to reset. + * + * @return 0 if a hard reset was performed. + * @return 1 if hard resets are not supported. + */ + int (*hard_reset)(struct sdioemb_slot *slot); + + struct slot_caps caps; /**< Slot capabilities. */ + int clock_freq; /**< SD bus frequency requested by the SDIO layer. */ + int bus_width; /**< Bus width requested by the SDIO layer. */ + struct sdioemb_slot_notifiers notifs; /**< Slot event notifiers. */ + int cspi_reg_pad; /**< Padding for CSPI register reads. */ + int cspi_burst_pad; /**< Padding for CSPI burst reads. */ + struct sdioemb_slot_priv *priv; /**< Data private to the SDIO layer. */ + void * drv_data; /**< Data private to the slot driver. */ +}; + +struct sdioemb_slot *sdioemb_slot_alloc(size_t drv_data_size); +void sdioemb_slot_free(struct sdioemb_slot *slot); +int sdioemb_slot_register(struct sdioemb_slot *slot); +void sdioemb_slot_unregister(struct sdioemb_slot *slot); +int sdioemb_card_inserted(struct sdioemb_slot *slot); +void sdioemb_card_removed(struct sdioemb_slot *slot); +void sdioemb_interrupt(struct sdioemb_slot *slot); +void sdioemb_cmd_complete(struct sdioemb_slot *slot, struct sdioemb_cmd *cmd); + +void sdioemb_suspend(struct sdioemb_slot *slot); +void sdioemb_resume(struct sdioemb_slot *slot); + +void sdioemb_add_function(struct sdioemb_dev *fdev); +void sdioemb_del_function(struct sdioemb_dev *fdev); +void sdioemb_get_function(struct sdioemb_dev *fdev); +void sdioemb_put_function(struct sdioemb_dev *fdev); + +#endif /* #ifndef _SLOT_API_H */ diff --git a/drivers/staging/csr/sdioemb/slot_imx27.h b/drivers/staging/csr/sdioemb/slot_imx27.h new file mode 100644 index 0000000..3aa2235 --- /dev/null +++ b/drivers/staging/csr/sdioemb/slot_imx27.h @@ -0,0 +1,86 @@ +/* + * i.MX27 SDHC definitions. + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef _SLOT_IMX27_H +#define _SLOT_IMX27_H + +/* + * i.MX27 SDHC registers. + */ + +#define SDHC_STR_STP_CLK 0x00 +# define STR_STP_CLK_MMCSD_RESET 0x0008 +# define STR_STP_CLK_START_CLK 0x0002 +# define STR_STP_CLK_STOP_CLK 0x0001 + +#define SDHC_STATUS 0x04 +# define STATUS_CARD_PRESENCE 0x8000 +# define STATUS_SDIO_INT_ACTIVE 0x4000 +# define STATUS_END_CMD_RESP 0x2000 +# define STATUS_WRITE_OP_DONE 0x1000 +# define STATUS_READ_OP_DONE 0x0800 +# define STATUS_CARD_BUS_CLK_RUN 0x0100 +# define STATUS_APPL_BUFF_FF 0x0080 +# define STATUS_APPL_BUFF_FE 0x0040 +# define STATUS_RESP_CRC_ERR 0x0020 +# define STATUS_CRC_READ_ERR 0x0008 +# define STATUS_CRC_WRITE_ERR 0x0004 +# define STATUS_TIME_OUT_RESP 0x0002 +# define STATUS_TIME_OUT_READ 0x0001 +# define STATUS_ERR_CMD_MASK (STATUS_RESP_CRC_ERR | STATUS_TIME_OUT_RESP) +# define STATUS_ERR_DATA_MASK (STATUS_CRC_READ_ERR | STATUS_CRC_WRITE_ERR | STATUS_TIME_OUT_READ) +# define STATUS_ERR_MASK (STATUS_ERR_CMD_MASK | STATUS_ERR_DATA_MASK) + +#define SDHC_CLK_RATE 0x08 + +#define SDHC_CMD_DAT_CTRL 0x0c /* CMD_DAT_CONT */ +# define CMD_DAT_CTRL_CMD_RESUME 0x8000 +# define CMD_DAT_CTRL_CMD_RESP_LONG_OFF 0x1000 +# define CMD_DAT_CTRL_STOP_READ_WAIT 0x0800 +# define CMD_DAT_CTRL_START_READ_WAIT 0x0400 +# define CMD_DAT_CTRL_BUS_WIDTH_4 0x0200 +# define CMD_DAT_CTRL_INIT 0x0080 +# define CMD_DAT_CTRL_WRITE 0x0010 +# define CMD_DAT_CTRL_DATA_ENABLE 0x0008 +# define CMD_DAT_CTRL_RESP_NONE 0x0000 +# define CMD_DAT_CTRL_RESP_R1_R5_R6 0x0001 +# define CMD_DAT_CTRL_RESP_R2 0x0002 +# define CMD_DAT_CTRL_RESP_R3_R4 0x0003 + +#define SDHC_RES_TO 0x10 + +#define SDHC_READ_TO 0x14 +# define READ_TO_RECOMMENDED 0x2db4 + +#define SDHC_BLK_LEN 0x18 + +#define SDHC_NOB 0x1c + +#define SDHC_REV_NO 0x20 + +#define SDHC_INT_CTRL 0x24 /* INT_CNTR */ +# define INT_CTRL_CARD_INSERTION_EN 0x8000 +# define INT_CTRL_SDIO_REMOVAL_EN 0x4000 +# define INT_CTRL_SDIO_IRQ_EN 0x2000 +# define INT_CTRL_DAT0_EN 0x1000 +# define INT_CTRL_BUF_READ_EN 0x0010 +# define INT_CTRL_BUF_WRITE_EN 0x0008 +# define INT_CTRL_END_CMD_RES 0x0004 +# define INT_CTRL_WRITE_OP_DONE 0x0002 +# define INT_CTRL_READ_OP_DONE 0x0001 +# define INT_CTRL_INT_EN_MASK 0xe01f + +#define SDHC_CMD 0x28 + +#define SDHC_ARG 0x2c + +#define SDHC_RES_FIFO 0x34 + +#define SDHC_BUFFER_ACCESS 0x38 + +#endif /* #ifndef _SLOT_IMX27_H */ diff --git a/drivers/staging/csr/sdioemb/slot_imx31.h b/drivers/staging/csr/sdioemb/slot_imx31.h new file mode 100644 index 0000000..b11894a --- /dev/null +++ b/drivers/staging/csr/sdioemb/slot_imx31.h @@ -0,0 +1,86 @@ +/* + * i.MX31 SDHC definitions. + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef _SLOT_IMX31_H +#define _SLOT_IMX31_H + +/* + * i.MX31 SDHC registers. + */ + +#define SDHC_STR_STP_CLK 0x00 +# define STR_STP_CLK_MMCSD_RESET 0x0008 +# define STR_STP_CLK_START_CLK 0x0002 +# define STR_STP_CLK_STOP_CLK 0x0001 + +#define SDHC_STATUS 0x04 +# define STATUS_CARD_PRESENCE 0x8000 +# define STATUS_SDIO_INT_ACTIVE 0x4000 +# define STATUS_END_CMD_RESP 0x2000 +# define STATUS_WRITE_OP_DONE 0x1000 +# define STATUS_READ_OP_DONE 0x0800 +# define STATUS_CARD_BUS_CLK_RUN 0x0100 +# define STATUS_APPL_BUFF_FF 0x0080 +# define STATUS_APPL_BUFF_FE 0x0040 +# define STATUS_RESP_CRC_ERR 0x0020 +# define STATUS_CRC_READ_ERR 0x0008 +# define STATUS_CRC_WRITE_ERR 0x0004 +# define STATUS_TIME_OUT_RESP 0x0002 +# define STATUS_TIME_OUT_READ 0x0001 +# define STATUS_ERR_CMD_MASK (STATUS_RESP_CRC_ERR | STATUS_TIME_OUT_RESP) +# define STATUS_ERR_DATA_MASK (STATUS_CRC_READ_ERR | STATUS_CRC_WRITE_ERR | STATUS_TIME_OUT_READ) +# define STATUS_ERR_MASK (STATUS_ERR_CMD_MASK | STATUS_ERR_DATA_MASK) + +#define SDHC_CLK_RATE 0x08 + +#define SDHC_CMD_DAT_CTRL 0x0c /* CMD_DAT_CONT */ +# define CMD_DAT_CTRL_CMD_RESUME 0x8000 +# define CMD_DAT_CTRL_CMD_RESP_LONG_OFF 0x1000 +# define CMD_DAT_CTRL_STOP_READ_WAIT 0x0800 +# define CMD_DAT_CTRL_START_READ_WAIT 0x0400 +# define CMD_DAT_CTRL_BUS_WIDTH_4 0x0200 +# define CMD_DAT_CTRL_INIT 0x0080 +# define CMD_DAT_CTRL_WRITE 0x0010 +# define CMD_DAT_CTRL_DATA_ENABLE 0x0008 +# define CMD_DAT_CTRL_RESP_NONE 0x0000 +# define CMD_DAT_CTRL_RESP_R1_R5_R6 0x0001 +# define CMD_DAT_CTRL_RESP_R2 0x0002 +# define CMD_DAT_CTRL_RESP_R3_R4 0x0003 + +#define SDHC_RES_TO 0x10 + +#define SDHC_READ_TO 0x14 +# define READ_TO_RECOMMENDED 0x2db4 + +#define SDHC_BLK_LEN 0x18 + +#define SDHC_NOB 0x1c + +#define SDHC_REV_NO 0x20 + +#define SDHC_INT_CTRL 0x24 /* INT_CNTR */ +# define INT_CTRL_CARD_INSERTION_EN 0x8000 +# define INT_CTRL_SDIO_REMOVAL_EN 0x4000 +# define INT_CTRL_SDIO_IRQ_EN 0x2000 +# define INT_CTRL_DAT0_EN 0x1000 +# define INT_CTRL_BUF_READ_EN 0x0010 +# define INT_CTRL_BUF_WRITE_EN 0x0008 +# define INT_CTRL_END_CMD_RES 0x0004 +# define INT_CTRL_WRITE_OP_DONE 0x0002 +# define INT_CTRL_READ_OP_DONE 0x0001 +# define INT_CTRL_INT_EN_MASK 0xe01f + +#define SDHC_CMD 0x28 + +#define SDHC_ARG 0x2c + +#define SDHC_RES_FIFO 0x34 + +#define SDHC_BUFFER_ACCESS 0x38 + +#endif /* #ifndef _SLOT_IMX31_H */ diff --git a/drivers/staging/csr/sdioemb/slot_pxa27x.h b/drivers/staging/csr/sdioemb/slot_pxa27x.h new file mode 100644 index 0000000..cca853a --- /dev/null +++ b/drivers/staging/csr/sdioemb/slot_pxa27x.h @@ -0,0 +1,70 @@ +/* + * PXA27x MMC/SD controller definitions. + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef _SLOT_PXA27X_H +#define _SLOT_PXA27X_H + +#define PXA27X_MMC_MMCLK_BASE_FREQ 19500000 +#define PXA27X_MMC_FIFO_SIZE 32 + +#define STOP_CLOCK (1 << 0) +#define START_CLOCK (2 << 0) + +#define STAT_END_CMD_RES (1 << 13) +#define STAT_PRG_DONE (1 << 12) +#define STAT_DATA_TRAN_DONE (1 << 11) +#define STAT_CLK_EN (1 << 8) +#define STAT_RECV_FIFO_FULL (1 << 7) +#define STAT_XMIT_FIFO_EMPTY (1 << 6) +#define STAT_RES_CRC_ERR (1 << 5) +#define STAT_SPI_READ_ERROR_TOKEN (1 << 4) +#define STAT_CRC_READ_ERROR (1 << 3) +#define STAT_CRC_WRITE_ERROR (1 << 2) +#define STAT_TIME_OUT_RESPONSE (1 << 1) +#define STAT_READ_TIME_OUT (1 << 0) + +#define SPI_CS_ADDRESS (1 << 3) +#define SPI_CS_EN (1 << 2) +#define CRC_ON (1 << 1) +#define SPI_EN (1 << 0) + +#define CMDAT_SDIO_INT_EN (1 << 11) +#define CMDAT_STOP_TRAN (1 << 10) +#define CMDAT_SD_4DAT (1 << 8) +#define CMDAT_DMAEN (1 << 7) +#define CMDAT_INIT (1 << 6) +#define CMDAT_BUSY (1 << 5) +#define CMDAT_STREAM (1 << 4) /* 1 = stream */ +#define CMDAT_WRITE (1 << 3) /* 1 = write */ +#define CMDAT_DATAEN (1 << 2) +#define CMDAT_RESP_NONE (0 << 0) +#define CMDAT_RESP_SHORT (1 << 0) +#define CMDAT_RESP_R2 (2 << 0) +#define CMDAT_RESP_R3 (3 << 0) + +#define RDTO_MAX 0xffff + +#define BUF_PART_FULL (1 << 0) + +#define SDIO_SUSPEND_ACK (1 << 12) +#define SDIO_INT (1 << 11) +#define RD_STALLED (1 << 10) +#define RES_ERR (1 << 9) +#define DAT_ERR (1 << 8) +#define TINT (1 << 7) +#define TXFIFO_WR_REQ (1 << 6) +#define RXFIFO_RD_REQ (1 << 5) +#define CLK_IS_OFF (1 << 4) +#define STOP_CMD (1 << 3) +#define END_CMD_RES (1 << 2) +#define PRG_DONE (1 << 1) +#define DATA_TRAN_DONE (1 << 0) + +#define MMC_I_MASK_ALL 0x00001fff + +#endif /* #ifndef _SLOT_PXA27X_H */ diff --git a/drivers/staging/csr/sdioemb/slot_shc.h b/drivers/staging/csr/sdioemb/slot_shc.h new file mode 100644 index 0000000..0eb5e53 --- /dev/null +++ b/drivers/staging/csr/sdioemb/slot_shc.h @@ -0,0 +1,223 @@ +/* + * Standard Host Controller definitions. + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef _SLOT_SHC_H +#define _SLOT_SHC_H + +#include + +/* SHC registers */ +#define SHC_SYSTEM_ADDRESS 0x00 + +#define SHC_BLOCK_SIZE 0x04 +# define SHC_BLOCK_SIZE_DMA_BOUNDARY_4K (0x0 << 12) +# define SHC_BLOCK_SIZE_DMA_BOUNDARY_512K (0x7 << 12) + +#define SHC_BLOCK_COUNT 0x06 +#define SHC_ARG 0x08 + +#define SHC_TRANSFER_MODE 0x0c +# define SHC_TRANSFER_MODE_DMA_EN 0x0001 +# define SHC_TRANSFER_MODE_BLK_CNT_EN 0x0002 +# define SHC_TRANSFER_MODE_AUTO_CMD12_EN 0x0004 +# define SHC_TRANSFER_MODE_DATA_READ 0x0010 +# define SHC_TRANSFER_MODE_MULTI_BLK 0x0020 + +#define SHC_CMD 0x0e +# define SHC_CMD_RESP_NONE 0x0000 +# define SHC_CMD_RESP_136 0x0001 +# define SHC_CMD_RESP_48 0x0002 +# define SHC_CMD_RESP_48B 0x0003 +# define SHC_CMD_RESP_CRC_CHK 0x0008 +# define SHC_CMD_RESP_IDX_CHK 0x0010 +# define SHC_CMD_DATA_PRESENT 0x0020 +# define SHC_CMD_TYPE_ABORT (0x3 << 6) +# define SHC_CMD_IDX(c) ((c) << 8) + +#define SHC_RESPONSE_0_31 0x10 + +#define SHC_BUFFER_DATA_PORT 0x20 + +#define SHC_PRESENT_STATE 0x24 +# define SHC_PRESENT_STATE_CMD_INHIBIT 0x00000001 +# define SHC_PRESENT_STATE_DAT_INHIBIT 0x00000002 +# define SHC_PRESENT_STATE_CARD_PRESENT 0x00010000 + +#define SHC_HOST_CTRL 0x28 +# define SHC_HOST_CTRL_LED_ON 0x01 +# define SHC_HOST_CTRL_4BIT 0x02 +# define SHC_HOST_CTRL_HIGH_SPD_EN 0x04 + + +#define SHC_PWR_CTRL 0x29 +# define SHC_PWR_CTRL_3V3 0x0e +# define SHC_PWR_CTRL_ON 0x01 + +#define SHC_BLOCK_GAP_CTRL 0x2a +#define SHC_WAKEUP_CTRL 0x2b + +#define SHC_CLOCK_CTRL 0x2c +# define SHC_CLOCK_CTRL_INT_CLK_EN 0x01 +# define SHC_CLOCK_CTRL_INT_CLK_STABLE 0x02 +# define SHC_CLOCK_CTRL_SD_CLK_EN 0x04 +# define SHC_CLOCK_CTRL_DIV(d) (((d) >> 1) << 8) /* divisor must be power of 2 */ + +#define SHC_TIMEOUT_CTRL 0x2e +# define SHC_TIMEOUT_CTRL_MAX 0x0e + +#define SHC_SOFTWARE_RST 0x2f +# define SHC_SOFTWARE_RST_ALL 0x01 +# define SHC_SOFTWARE_RST_CMD 0x02 +# define SHC_SOFTWARE_RST_DAT 0x04 + +#define SHC_INT_STATUS 0x30 +#define SHC_INT_STATUS_EN 0x34 +#define SHC_INT_SIGNAL_EN 0x38 +# define SHC_INT_CMD_COMPLETE 0x00000001 +# define SHC_INT_TRANSFER_COMPLETE 0x00000002 +# define SHC_INT_BLOCK_GAP 0x00000004 +# define SHC_INT_DMA 0x00000008 +# define SHC_INT_WR_BUF_RDY 0x00000010 +# define SHC_INT_RD_BUF_RDY 0x00000020 +# define SHC_INT_CARD_INSERTED 0x00000040 +# define SHC_INT_CARD_REMOVED 0x00000080 +# define SHC_INT_CARD_INT 0x00000100 +# define SHC_INT_ERR_ANY 0x00008000 +# define SHC_INT_ERR_CMD_TIMEOUT 0x00010000 +# define SHC_INT_ERR_CMD_CRC 0x00020000 +# define SHC_INT_ERR_CMD_ENDBIT 0x00040000 +# define SHC_INT_ERR_CMD_INDEX 0x00080000 +# define SHC_INT_ERR_CMD_ALL 0x000f0000 +# define SHC_INT_ERR_DAT_TIMEOUT 0x00100000 +# define SHC_INT_ERR_DAT_CRC 0x00200000 +# define SHC_INT_ERR_DAT_ENDBIT 0x00400000 +# define SHC_INT_ERR_DAT_ALL 0x00700000 +# define SHC_INT_ERR_CURRENT_LIMIT 0x00800000 +# define SHC_INT_ERR_AUTO_CMD12 0x01000000 +# define SHC_INT_ERR_ALL 0x01ff0000 +# define SHC_INT_ALL 0x01ff81ff + +#define SHC_AUTO_CMD12_STATUS 0x3c + +#define SHC_CAPS 0x40 +# define SHC_CAPS_TO_BASE_CLK_FREQ(c) (((c) & 0x00003f00) >> 8) +# define SHC_CAPS_PWR_3V3 (1 << 24) + +#define SHC_MAX_CURRENT_CAPS 0x4c + +/* PCI configuration registers. */ +#define PCI_SHC_SLOT_INFO 0x40 + +/* Maximum time to wait for a software reset. */ +#define SHC_RESET_TIMEOUT_MS 100 /* ms */ + +/* Maximum time to wait for internal clock to stabilize */ +#define SHC_INT_CLK_STABLE_TIMEOUT_MS 100 + +/* + * No supported voltages in the capabilities register. + * + * Workaround: Assume 3.3V is supported. + */ +#define SLOT_SHC_QUIRK_NO_VOLTAGE_CAPS (1 << 0) + +/* + * Commands with an R5B (busy) response do not complete. + * + * Workaround: Use R5 instead. This will only work if the busy signal + * is cleared sufficiently quickly before the next command is started. + */ +#define SLOT_SHC_QUIRK_R5B_BROKEN (1 << 1) + +/* + * High speed mode doesn't work. + * + * Workaround: limit maximum bus frequency to 25 MHz. + */ +#define SLOT_SHC_QUIRK_HIGH_SPD_BROKEN (1 << 2) + +/* + * Data timeout (TIMEOUT_CTRL) uses SDCLK and not TMCLK. + * + * Workaround: set TIMEOUT_CTRL using SDCLK. + */ +#define SLOT_SHC_QUIRK_DATA_TIMEOUT_USES_SDCLK (1 << 3) + +/* + * Controller can only start DMA on dword (32 bit) aligned addresses. + * + * Workaround: PIO is used on data transfers with a non-dword aligned + * address. + */ +#define SHC_QUIRK_DMA_NEEDS_DWORD_ALIGNED_ADDR (1 << 4) + +/* + * Controller is unreliable following multiple transfers + * + * Workaround: The controller is reset following every command, not just + * erroneous ones + */ +#define SHC_QUIRK_RESET_EVERY_CMD_COMPLETE (1 << 5) + +/* + * JMicron JMB381 to JMB385 controllers require some non-standard PCI + * config space writes. + */ +#define SHC_QUIRK_JMICRON_JMB38X (1 << 6) + +/* + * Controller can only do DMA if the length is a whole number of + * dwords. + * + * Controller with this quirk probably also need + * SHC_QUIRK_DMA_NEEDS_DWORD_ALIGNED_ADDR. + * + * Workaround: PIO is used on data transfers that don't end on an + * aligned address. + */ +#define SHC_QUIRK_DMA_NEEDS_DWORD_ALIGNED_LEN (1 << 7) + +struct sdioemb_shc { + struct sdioemb_slot *slot; + void (*enable_int)(struct sdioemb_slot *slot, uint32_t ints); + void (*disable_int)(struct sdioemb_slot *slot, uint32_t ints); + void (*cmd_complete)(struct sdioemb_slot *slot, struct sdioemb_cmd *cmd); + uint32_t quirks; + os_io_mem_t addr; + + os_spinlock_t lock; + os_timer_t lockup_timer; + uint32_t base_clk; + struct sdioemb_cmd *current_cmd; + uint8_t *data; + size_t remaining; + size_t block_size; +}; + +void sdioemb_shc_init(struct sdioemb_shc *shc); +void sdioemb_shc_clean_up(struct sdioemb_shc *shc); + +int sdioemb_shc_start(struct sdioemb_shc *shc); +void sdioemb_shc_stop(struct sdioemb_shc *shc); + +bool sdioemb_shc_isr(struct sdioemb_shc *shc, uint32_t *int_stat); +void sdioemb_shc_dsr(struct sdioemb_shc *shc, uint32_t int_stat); + +int sdioemb_shc_set_bus_freq(struct sdioemb_shc *shc, int clk); +int sdioemb_shc_set_bus_width(struct sdioemb_shc *shc, int bus_width); +int sdioemb_shc_start_cmd(struct sdioemb_shc *shc, struct sdioemb_cmd *cmd, + bool use_dma, uint64_t dma_addr); +int sdioemb_shc_card_present(struct sdioemb_shc *shc); +int sdioemb_shc_card_power(struct sdioemb_shc *shc, enum sdioemb_power power); +void sdioemb_shc_enable_card_int(struct sdioemb_shc *shc); +void sdioemb_shc_disable_card_int(struct sdioemb_shc *shc); +int sdioemb_shc_hard_reset(struct sdioemb_shc *shc); + +void sdioemb_shc_show_quirks(struct sdioemb_shc *shc); + +#endif /* #ifndef _SLOT_SHC_H */ diff --git a/drivers/staging/csr/sdioemb/slot_ushc.h b/drivers/staging/csr/sdioemb/slot_ushc.h new file mode 100644 index 0000000..efe3310 --- /dev/null +++ b/drivers/staging/csr/sdioemb/slot_ushc.h @@ -0,0 +1,133 @@ +/* + * USB Standard Host Controller definitions. + * + * Copyright (C) 2010 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef _SLOT_USHC_H +#define _SLOT_USHC_H + +#include + +enum ushc_request +{ + USHC_GET_CAPS = 0x00, + USHC_HOST_CTRL = 0x01, + USHC_PWR_CTRL = 0x02, + USHC_CLK_FREQ = 0x03, + USHC_EXEC_CMD = 0x04, + USHC_READ_RESP = 0x05, + USHC_RESET = 0x06 +}; + +enum ushc_request_recipient +{ + USHC_RECIPIENT_DEVICE = 0x00, + USHC_RECIPIENT_INTERFACE = 0x01, + USHC_RECIPIENT_ENDPOINT = 0x02, + USHC_RECIPIENT_OTHER = 0x03 +}; + +enum ushc_request_direction +{ + USHC_HOST_TO_DEVICE = 0x00, + USHC_DEVICE_TO_HOST = 0x01 +}; + +struct sdioemb_ushc +{ + struct sdioemb_slot *slot; + + void (*enable_int)(struct sdioemb_slot *slot, uint32_t ints); + void (*disable_int)(struct sdioemb_slot *slot, uint32_t ints); + void (*cmd_complete)(struct sdioemb_slot *slot, struct sdioemb_cmd *cmd); + int (*set_host_ctrl)(struct sdioemb_slot *slot, uint16_t controler_state); + int (*submit_vendor_request)(struct sdioemb_slot *slot, + enum ushc_request request, + enum ushc_request_direction direction, + enum ushc_request_recipient recipient, + uint16_t value, + uint16_t index, + void* io_buffer, + uint32_t io_buffer_length); + int (*submit_cbw_request)(struct sdioemb_slot *slot, uint8_t cmd_index, uint16_t block_size, uint32_t cmd_arg); + int (*submit_data_request)(struct sdioemb_slot *slot, + enum ushc_request_direction direction, + void* request_buffer, + uint32_t request_buffer_length); + int (*submit_csw_request)(struct sdioemb_slot *slot); + + os_spinlock_t lock; + + uint32_t base_clock; + uint32_t controler_capabilities; + uint16_t controler_state; + struct sdioemb_cmd* current_cmd; + +#define DISCONNECTED 0 +#define INT_EN 1 +#define IGNORE_NEXT_INT 2 +#define STOP 4 + uint32_t flags; + +#define USHC_INT_STATUS_SDIO_INT (1 << 1) +#define USHC_INT_STATUS_CARD_PRESENT (1 << 0) + uint8_t interrupt_status; + + size_t block_size; +}; + +#define USHC_GET_CAPS_VERSION_MASK 0xff +#define USHC_GET_CAPS_3V3 (1 << 8) +#define USHC_GET_CAPS_3V0 (1 << 9) +#define USHC_GET_CAPS_1V8 (1 << 10) +#define USHC_GET_CAPS_HIGH_SPD (1 << 16) + +#define USHC_PWR_CTRL_OFF 0x00 +#define USHC_PWR_CTRL_3V3 0x01 +#define USHC_PWR_CTRL_3V0 0x02 +#define USHC_PWR_CTRL_1V8 0x03 + +#define USHC_HOST_CTRL_4BIT (1 << 1) +#define USHC_HOST_CTRL_HIGH_SPD (1 << 0) + +#define USHC_READ_RESP_BUSY (1 << 4) +#define USHC_READ_RESP_ERR_TIMEOUT (1 << 3) +#define USHC_READ_RESP_ERR_CRC (1 << 2) +#define USHC_READ_RESP_ERR_DAT (1 << 1) +#define USHC_READ_RESP_ERR_CMD (1 << 0) +#define USHC_READ_RESP_ERR_MASK 0x0f + +void sdioemb_ushc_init(struct sdioemb_ushc* ushc); +void sdioemb_ushc_clean_up(struct sdioemb_ushc* ushc); + +int sdioemb_ushc_start(struct sdioemb_ushc* ushc); +void sdioemb_ushc_stop(struct sdioemb_ushc* ushc); + +bool sdioemb_ushc_isr(struct sdioemb_ushc* ushc, uint8_t int_stat); + +int sdioemb_ushc_set_bus_freq(struct sdioemb_ushc* ushc, int clk); +int sdioemb_ushc_set_bus_width(struct sdioemb_ushc* ushc, int bus_width); +int sdioemb_ushc_start_cmd(struct sdioemb_ushc* ushc, struct sdioemb_cmd *cmd); +int sdioemb_ushc_card_present(struct sdioemb_ushc* ushc); +int sdioemb_ushc_card_power(struct sdioemb_ushc* ushc, enum sdioemb_power power); +void sdioemb_ushc_enable_card_int(struct sdioemb_ushc* ushc); +void sdioemb_ushc_disable_card_int(struct sdioemb_ushc* ushc); +int sdioemb_ushc_hard_reset(struct sdioemb_ushc* ushc); + +void sdioemb_ushc_command_complete(struct sdioemb_ushc* ushc, uint8_t status, uint32_t respones); + +int ushc_hw_get_caps(struct sdioemb_ushc* ushc); +static int ushc_hw_set_host_ctrl(struct sdioemb_ushc* ushc, uint16_t mask, uint16_t val); +static int ushc_hw_submit_vendor_request(struct sdioemb_ushc* ushc, + enum ushc_request request, + enum ushc_request_recipient recipient, + enum ushc_request_direction direction, + uint16_t value, + uint16_t index, + void* io_buffer, + uint32_t io_buffer_length); + +#endif diff --git a/drivers/staging/csr/sdioemb/trace.h b/drivers/staging/csr/sdioemb/trace.h new file mode 100644 index 0000000..57cbb01 --- /dev/null +++ b/drivers/staging/csr/sdioemb/trace.h @@ -0,0 +1,19 @@ +/* + * Sdioemb trace messages. + * + * Copyright (C) 2009 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ + +#ifndef SDIOEMB_TRACE_H +#define SDIOEMB_TRACE_H + +#if defined(__linux__) +# define OS_TRACE_PREFIX "sdioemb: " +#endif + +#include + +#endif /* #ifndef SDIOEMB_TRACE_H */ diff --git a/drivers/staging/csr/sdioemb/uif.h b/drivers/staging/csr/sdioemb/uif.h new file mode 100644 index 0000000..c09357f --- /dev/null +++ b/drivers/staging/csr/sdioemb/uif.h @@ -0,0 +1,41 @@ +/* + * Userspace interface to the SDIO Userspace Interface driver. + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef LINUX_SDIOEMB_UIF_H +#define LINUX_SDIOEMB_UIF_H + +enum sdioemb_uif_cmd_type { + SDIOEMB_UIF_CMD52_READ, SDIOEMB_UIF_CMD52_WRITE, + SDIOEMB_UIF_CMD53_READ, SDIOEMB_UIF_CMD53_WRITE, +}; + +struct sdioemb_uif_cmd { + enum sdioemb_uif_cmd_type type; + int function; + uint32_t address; + uint8_t * data; + size_t len; + int block_size; +}; + +#define SDIOEMB_UIF_IOC_MAGIC 's' + +#define SDIOEMB_UIF_IOCQNUMFUNCS _IO(SDIOEMB_UIF_IOC_MAGIC, 0) +#define SDIOEMB_UIF_IOCCMD _IOWR(SDIOEMB_UIF_IOC_MAGIC, 1, struct sdioemb_uif_cmd) +#define SDIOEMB_UIF_IOCWAITFORINT _IO(SDIOEMB_UIF_IOC_MAGIC, 2) +#define SDIOEMB_UIF_IOCTBUSWIDTH _IO(SDIOEMB_UIF_IOC_MAGIC, 3) +#define SDIOEMB_UIF_IOCREINSERT _IO(SDIOEMB_UIF_IOC_MAGIC, 4) +#define SDIOEMB_UIF_IOCTBUSFREQ _IO(SDIOEMB_UIF_IOC_MAGIC, 5) +#define SDIOEMB_UIF_IOCQMANFID _IO(SDIOEMB_UIF_IOC_MAGIC, 6) +#define SDIOEMB_UIF_IOCQCARDID _IO(SDIOEMB_UIF_IOC_MAGIC, 7) +#define SDIOEMB_UIF_IOCQSTDIF _IO(SDIOEMB_UIF_IOC_MAGIC, 8) +#define SDIOEMB_UIF_IOCQMAXBLKSZ _IO(SDIOEMB_UIF_IOC_MAGIC, 9) +#define SDIOEMB_UIF_IOCQBLKSZ _IO(SDIOEMB_UIF_IOC_MAGIC, 10) +#define SDIOEMB_UIF_IOCTBLKSZ _IO(SDIOEMB_UIF_IOC_MAGIC, 11) + +#endif /* #ifndef LINUX_SDIOEMB_UIF_H */ diff --git a/drivers/staging/csr/sdioemb/version.h b/drivers/staging/csr/sdioemb/version.h new file mode 100644 index 0000000..b88ef6e --- /dev/null +++ b/drivers/staging/csr/sdioemb/version.h @@ -0,0 +1,11 @@ +/* Autogenerated by the sdioemb release procedure. */ +#ifndef SDIOEMB_VERSION_H +#define SDIOEMB_VERSION_H + +#define SDIOEMB_RELEASE 31 + +#ifndef SDIOEMB_RELEASE_EXTRA +#define SDIOEMB_RELEASE_EXTRA "" +#endif + +#endif /* #ifndef SDIOEMB_VERSION_H */ diff --git a/drivers/staging/csr/sme_blocking.c b/drivers/staging/csr/sme_blocking.c new file mode 100644 index 0000000..f30eda9 --- /dev/null +++ b/drivers/staging/csr/sme_blocking.c @@ -0,0 +1,1468 @@ +/* + * --------------------------------------------------------------------------- + * FILE: sme_mgt_blocking.c + * + * PURPOSE: + * This file contains the driver specific implementation of + * the WEXT <==> SME MGT interface for all SME builds that support WEXT. + * + * Copyright (C) 2009 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * --------------------------------------------------------------------------- + */ + +#include "unifi_priv.h" + + +/* + * This file also contains the implementation of the asyncronous + * requests to the SME. + * + * Before calling an asyncronous SME function, we call sme_init_request() + * which gets hold of the SME semaphore and updates the request status. + * The semaphore makes sure that there is only one pending request to + * the SME at a time. + * + * Now we are ready to call the SME function, but only if + * sme_init_request() has returned 0. + * + * When the SME function returns, we need to wait + * for the reply. This is done in sme_wait_for_reply(). + * If the request times-out, the request status is set to SME_REQUEST_TIMEDOUT + * and the sme_wait_for_reply() returns. + * + * If the SME replies in time, we call sme_complete_request(). + * There we change the request status to SME_REQUEST_RECEIVED. This will + * wake up the process waiting on sme_wait_for_reply(). + * It is important that we copy the reply data in priv->sme_reply + * before calling sme_complete_request(). + * + * Handling the wext requests, we need to block + * until the SME sends the response to our request. + * We use the sme_init_request() and sme_wait_for_reply() + * to implement this behavior in the following functions: + * sme_mgt_wifi_on() + * sme_mgt_wifi_off() + * sme_mgt_scan_full() + * sme_mgt_scan_results_get_async() + * sme_mgt_connect() + * unifi_mgt_media_status_ind() + * sme_mgt_disconnect() + * sme_mgt_pmkid() + * sme_mgt_key() + * sme_mgt_mib_get() + * sme_mgt_mib_set() + * sme_mgt_versions_get() + * sme_mgt_set_value() + * sme_mgt_get_value() + * sme_mgt_set_value_async() + * sme_mgt_get_value_async() + * sme_mgt_packet_filter_set() + * sme_mgt_tspec() + */ + + +/* + * Handling the suspend and resume system events, we need to block + * until the SME sends the response to our indication. + * We use the sme_init_request() and sme_wait_for_reply() + * to implement this behavior in the following functions: + * sme_sys_suspend() + * sme_sys_resume() + */ + +#define UNIFI_SME_MGT_SHORT_TIMEOUT 10000 +#define UNIFI_SME_MGT_LONG_TIMEOUT 19000 +#define UNIFI_SME_SYS_LONG_TIMEOUT 10000 + +#ifdef UNIFI_DEBUG +# define sme_wait_for_reply(priv, t) _sme_wait_for_reply(priv, t, __func__) +#else +# define sme_wait_for_reply(priv, t) _sme_wait_for_reply(priv, t, NULL) +#endif + +static int +sme_init_request(unifi_priv_t *priv) +{ + if (priv == NULL) { + unifi_error(priv, "sme_init_request: Invalid priv\n"); + return -EIO; + } + + /* Grab the SME semaphore until the reply comes, or timeout */ + if (down_interruptible(&priv->sme_sem)) { + unifi_error(priv, "sme_init_request: Failed to get SME semaphore\n"); + return -EIO; + } + priv->sme_reply.request_status = SME_REQUEST_PENDING; + + return 0; + +} /* sme_init_request() */ + + +void +uf_sme_complete_request(unifi_priv_t *priv, CsrResult reply_status, const char *func) +{ + if (priv == NULL) { + unifi_error(priv, "sme_complete_request: Invalid priv\n"); + return; + } + + if (priv->sme_reply.request_status != SME_REQUEST_PENDING) { + unifi_notice(priv, + "sme_complete_request: request not pending %s (s:%d)\n", + (func ? func : ""), priv->sme_reply.request_status); + return; + } + priv->sme_reply.request_status = SME_REQUEST_RECEIVED; + priv->sme_reply.reply_status = reply_status; + + wake_up_interruptible(&priv->sme_request_wq); + + return; +} + + +static int +_sme_wait_for_reply(unifi_priv_t *priv, + unsigned long timeout, const char *func) +{ + long r; + + unifi_trace(priv, UDBG5, "sme_wait_for_reply: sleep\n"); + r = wait_event_interruptible_timeout(priv->sme_request_wq, + (priv->sme_reply.request_status != SME_REQUEST_PENDING), + msecs_to_jiffies(timeout)); + unifi_trace(priv, UDBG5, "sme_wait_for_reply: awake\n"); + + if (r == -ERESTARTSYS) { + /* The thread was killed */ + up(&priv->sme_sem); + return r; + } + if ((r == 0) && (priv->sme_reply.request_status != SME_REQUEST_RECEIVED)) { + unifi_notice(priv, "Timeout waiting for SME to reply (%s s:%d, t:%d)\n", + (func ? func : ""), priv->sme_reply.request_status, timeout); + + priv->sme_reply.request_status = SME_REQUEST_TIMEDOUT; + + /* Release the SME semaphore that was downed in sme_init_request() */ + up(&priv->sme_sem); + + return -ETIMEDOUT; + } + + /* Release the SME semaphore that was downed in sme_init_request() */ + up(&priv->sme_sem); + + return 0; +} /* sme_wait_for_reply() */ + + + + +#ifdef CSR_SUPPORT_WEXT +int sme_mgt_wifi_on(unifi_priv_t *priv) +{ + CsrUint16 numElements; + CsrWifiSmeDataBlock* dataList; +#ifdef CSR_SUPPORT_WEXT_AP + int r; +#endif + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_wifi_on: invalid smepriv\n"); + return -EIO; + } + + if (priv->mib_data.length) { + numElements = 1; + dataList = &priv->mib_data; + } else { + numElements = 0; + dataList = NULL; + } + /* Start the SME */ +#ifdef CSR_SUPPORT_WEXT_AP + r = sme_init_request(priv); + if (r) { + return -EIO; + } +#endif + CsrWifiSmeWifiOnReqSend(0, priv->sta_mac_address, numElements, dataList); +#ifdef CSR_SUPPORT_WEXT_AP + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_LONG_TIMEOUT); + unifi_trace(priv, UDBG4, + "sme_mgt_wifi_on: unifi_mgt_wifi_oo_req <-- (r=%d, status=%d)\n", + r, priv->sme_reply.reply_status); + return convert_sme_error(priv->sme_reply.reply_status); +#else + return 0; +#endif +} /* sme_mgt_wifi_on() */ + + +int sme_mgt_wifi_off(unifi_priv_t *priv) +{ + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_wifi_off: invalid smepriv\n"); + return -EIO; + } + + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + /* Stop the SME */ + CsrWifiSmeWifiOffReqSend(0); + + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_LONG_TIMEOUT); + if (r) { + return r; + } + + unifi_trace(priv, UDBG4, + "sme_mgt_wifi_off: unifi_mgt_wifi_off_req <-- (r=%d, status=%d)\n", + r, priv->sme_reply.reply_status); + return convert_sme_error(priv->sme_reply.reply_status); + +} /* sme_mgt_wifi_off */ + +int sme_mgt_key(unifi_priv_t *priv, CsrWifiSmeKey *sme_key, + CsrWifiSmeListAction action) +{ + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_key: invalid smepriv\n"); + return -EIO; + } + + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmeKeyReqSend(0, CSR_WIFI_INTERFACE_IN_USE, action, *sme_key); + + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + return convert_sme_error(priv->sme_reply.reply_status); +} + + +int sme_mgt_scan_full(unifi_priv_t *priv, + CsrWifiSsid *specific_ssid, + int num_channels, + unsigned char *channel_list) +{ + CsrWifiMacAddress bcastAddress = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }}; + CsrBool is_active = (num_channels > 0) ? TRUE : FALSE; + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_scan_full: invalid smepriv\n"); + return -EIO; + } + + unifi_trace(priv, UDBG4, "sme_mgt_scan_full: -->\n"); + + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + /* If a channel list is provided, do an active scan */ + if (is_active) { + unifi_trace(priv, UDBG1, + "channel list - num_channels: %d, active scan\n", + num_channels); + } + + CsrWifiSmeScanFullReqSend(0, + specific_ssid->length?1:0, /* 0 or 1 SSIDS */ + specific_ssid, + bcastAddress, + is_active, + CSR_WIFI_SME_BSS_TYPE_ANY_BSS, + CSR_WIFI_SME_SCAN_TYPE_ALL, + (CsrUint16)num_channels, channel_list, + 0, NULL); + + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_LONG_TIMEOUT); + if (r) { + return r; + } + + unifi_trace(priv, UDBG4, "sme_mgt_scan_full: <-- (status=%d)\n", priv->sme_reply.reply_status); + if (priv->sme_reply.reply_status == CSR_WIFI_RESULT_UNAVAILABLE) { + return 0; /* initial scan already underway */ + } else { + return convert_sme_error(priv->sme_reply.reply_status); + } +} + + +int sme_mgt_scan_results_get_async(unifi_priv_t *priv, + struct iw_request_info *info, + char *scan_results, + long scan_results_len) +{ + CsrUint16 scan_result_list_count; + CsrWifiSmeScanResult *scan_result_list; + CsrWifiSmeScanResult *scan_result; + int r; + int i; + char *current_ev = scan_results; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_scan_results_get_async: invalid smepriv\n"); + return -EIO; + } + + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmeScanResultsGetReqSend(0); + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_LONG_TIMEOUT); + if (r) { + return r; + } + + scan_result_list_count = priv->sme_reply.reply_scan_results_count; + scan_result_list = priv->sme_reply.reply_scan_results; + unifi_trace(priv, UDBG2, + "scan_results: Scan returned %d, numElements=%d\n", + r, scan_result_list_count); + + /* OK, now we have the scan results */ + for (i = 0; i < scan_result_list_count; ++i) { + scan_result = &scan_result_list[i]; + + unifi_trace(priv, UDBG2, "Scan Result: %.*s\n", + scan_result->ssid.length, + scan_result->ssid.ssid); + + r = unifi_translate_scan(priv->netdev[0], info, + current_ev, + scan_results + scan_results_len, + scan_result, i+1); + + if (r < 0) { + CsrPmemFree(scan_result_list); + priv->sme_reply.reply_scan_results_count = 0; + priv->sme_reply.reply_scan_results = NULL; + return r; + } + + current_ev += r; + } + + /* + * Free the scan results allocated in unifi_mgt_scan_results_get_cfm() + * and invalidate the reply_scan_results to avoid re-using + * the freed pointers. + */ + CsrPmemFree(scan_result_list); + priv->sme_reply.reply_scan_results_count = 0; + priv->sme_reply.reply_scan_results = NULL; + + unifi_trace(priv, UDBG2, + "scan_results: Scan translated to %d bytes\n", + current_ev - scan_results); + return (current_ev - scan_results); +} + + +int sme_mgt_connect(unifi_priv_t *priv) +{ + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_connect: invalid smepriv\n"); + return -EIO; + } + + unifi_trace(priv, UDBG2, "sme_mgt_connect: %.*s\n", + priv->connection_config.ssid.length, + priv->connection_config.ssid.ssid); + + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmeConnectReqSend(0, CSR_WIFI_INTERFACE_IN_USE, priv->connection_config); + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + if (priv->sme_reply.reply_status) { + unifi_trace(priv, UDBG1, "sme_mgt_connect: failed with SME status %d\n", + priv->sme_reply.reply_status); + } + + return convert_sme_error(priv->sme_reply.reply_status); +} + + +int sme_mgt_disconnect(unifi_priv_t *priv) +{ + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_disconnect: invalid smepriv\n"); + return -EIO; + } + + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmeDisconnectReqSend(0, CSR_WIFI_INTERFACE_IN_USE); + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + unifi_trace(priv, UDBG4, "sme_mgt_disconnect: <-- (status=%d)\n", priv->sme_reply.reply_status); + return convert_sme_error(priv->sme_reply.reply_status); +} + + +int sme_mgt_pmkid(unifi_priv_t *priv, + CsrWifiSmeListAction action, + CsrWifiSmePmkidList *pmkid_list) +{ + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_pmkid: invalid smepriv\n"); + return -EIO; + } + + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmePmkidReqSend(0, CSR_WIFI_INTERFACE_IN_USE, action, + pmkid_list->pmkidsCount, pmkid_list->pmkids); + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + unifi_trace(priv, UDBG4, "sme_mgt_pmkid: <-- (status=%d)\n", priv->sme_reply.reply_status); + return convert_sme_error(priv->sme_reply.reply_status); +} + + +int sme_mgt_mib_get(unifi_priv_t *priv, + unsigned char *varbind, int *length) +{ + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_mib_get: invalid smepriv\n"); + return -EIO; + } + + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + priv->mib_cfm_buffer = varbind; + priv->mib_cfm_buffer_length = MAX_VARBIND_LENGTH; + + CsrWifiSmeMibGetReqSend(0, *length, varbind); + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + priv->mib_cfm_buffer_length = 0; + priv->mib_cfm_buffer = NULL; + return r; + } + + *length = priv->mib_cfm_buffer_length; + + priv->mib_cfm_buffer_length = 0; + priv->mib_cfm_buffer = NULL; + unifi_trace(priv, UDBG4, "sme_mgt_mib_get: <-- (status=%d)\n", priv->sme_reply.reply_status); + return convert_sme_error(priv->sme_reply.reply_status); +} + +int sme_mgt_mib_set(unifi_priv_t *priv, + unsigned char *varbind, int length) +{ + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_mib_get: invalid smepriv\n"); + return -EIO; + } + + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmeMibSetReqSend(0, length, varbind); + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + unifi_trace(priv, UDBG4, "sme_mgt_mib_set: <-- (status=%d)\n", priv->sme_reply.reply_status); + return convert_sme_error(priv->sme_reply.reply_status); +} + +#endif /* CSR_SUPPORT_WEXT */ + +int sme_mgt_power_config_set(unifi_priv_t *priv, CsrWifiSmePowerConfig *powerConfig) +{ +#ifdef CSR_SME_USERSPACE + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_set_value_async: invalid smepriv\n"); + return -EIO; + } + + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmePowerConfigSetReqSend(0, *powerConfig); + + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + unifi_trace(priv, UDBG4, + "sme_mgt_set_value_async: unifi_mgt_set_value_req <-- (r=%d status=%d)\n", + r, priv->sme_reply.reply_status); + return convert_sme_error(priv->sme_reply.reply_status); +#else + CsrResult status; + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_set_value: invalid smepriv\n"); + return -EIO; + } + CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); + status = CsrWifiSmeMgtPowerConfigSetReq(priv->smepriv, *powerConfig); + CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); + return convert_sme_error(status); +#endif +} + +int sme_mgt_sme_config_set(unifi_priv_t *priv, CsrWifiSmeStaConfig *staConfig, CsrWifiSmeDeviceConfig *deviceConfig) +{ +#ifdef CSR_SME_USERSPACE + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_sme_config_set: invalid smepriv\n"); + return -EIO; + } + + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmeSmeStaConfigSetReqSend(0, CSR_WIFI_INTERFACE_IN_USE, *staConfig); + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + unifi_trace(priv, UDBG4, + "sme_mgt_sme_config_set: CsrWifiSmeSmeStaConfigSetReq <-- (r=%d status=%d)\n", + r, priv->sme_reply.reply_status); + + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmeSmeCommonConfigSetReqSend(0, *deviceConfig); + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + unifi_trace(priv, UDBG4, + "sme_mgt_sme_config_set: CsrWifiSmeSmeCommonConfigSetReq <-- (r=%d status=%d)\n", + r, priv->sme_reply.reply_status); + + return convert_sme_error(priv->sme_reply.reply_status); +#else + CsrResult status; + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_sme_config_set: invalid smepriv\n"); + return -EIO; + } + CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); + status = CsrWifiSmeMgtSmeConfigSetReq(priv->smepriv, *staConfig); + status = CsrWifiSmeMgtDeviceConfigSetReq(priv->smepriv, *deviceConfig); + CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); + return convert_sme_error(status); +#endif +} + +#ifdef CSR_SUPPORT_WEXT + +int sme_mgt_mib_config_set(unifi_priv_t *priv, CsrWifiSmeMibConfig *mibConfig) +{ +#ifdef CSR_SME_USERSPACE + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_mib_config_set: invalid smepriv\n"); + return -EIO; + } + + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmeMibConfigSetReqSend(0, *mibConfig); + + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + unifi_trace(priv, UDBG4, + "sme_mgt_mib_config_set: unifi_mgt_set_mib_config_req <-- (r=%d status=%d)\n", + r, priv->sme_reply.reply_status); + return convert_sme_error(priv->sme_reply.reply_status); +#else + CsrResult status; + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_mib_config_set: invalid smepriv\n"); + return -EIO; + } + CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); + status = CsrWifiSmeMgtMibConfigSetReq(priv->smepriv, *mibConfig); + CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); + return convert_sme_error(status); +#endif +} + +int sme_mgt_coex_config_set(unifi_priv_t *priv, CsrWifiSmeCoexConfig *coexConfig) +{ +#ifdef CSR_SME_USERSPACE + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_coex_config_set: invalid smepriv\n"); + return -EIO; + } + + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmeCoexConfigSetReqSend(0, *coexConfig); + + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + unifi_trace(priv, UDBG4, + "sme_mgt_coex_config_set: unifi_mgt_set_mib_config_req <-- (r=%d status=%d)\n", + r, priv->sme_reply.reply_status); + return convert_sme_error(priv->sme_reply.reply_status); +#else + CsrResult status; + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_coex_config_set: invalid smepriv\n"); + return -EIO; + } + CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); + status = CsrWifiSmeMgtCoexConfigSetReq(priv->smepriv, *coexConfig); + CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); + return convert_sme_error(status); +#endif +} + +#endif /* CSR_SUPPORT_WEXT */ + +int sme_mgt_host_config_set(unifi_priv_t *priv, CsrWifiSmeHostConfig *hostConfig) +{ +#ifdef CSR_SME_USERSPACE + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_host_config_set: invalid smepriv\n"); + return -EIO; + } + + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmeHostConfigSetReqSend(0, CSR_WIFI_INTERFACE_IN_USE, *hostConfig); + + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + unifi_trace(priv, UDBG4, + "sme_mgt_host_config_set: unifi_mgt_set_host_config_req <-- (r=%d status=%d)\n", + r, priv->sme_reply.reply_status); + return convert_sme_error(priv->sme_reply.reply_status); +#else + CsrResult status; + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_host_config_set: invalid smepriv\n"); + return -EIO; + } + CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); + status = CsrWifiSmeMgtHostConfigSetReq(priv->smepriv, *hostConfig); + CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); + return convert_sme_error(status); +#endif +} + +#ifdef CSR_SUPPORT_WEXT + +int sme_mgt_versions_get(unifi_priv_t *priv, CsrWifiSmeVersions *versions) +{ +#ifdef CSR_SME_USERSPACE + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_versions_get: invalid smepriv\n"); + return -EIO; + } + + unifi_trace(priv, UDBG4, "sme_mgt_versions_get: unifi_mgt_versions_get_req -->\n"); + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmeVersionsGetReqSend(0); + + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + /* store the reply */ + if (versions != NULL) { + memcpy((unsigned char*)versions, + (unsigned char*)&priv->sme_reply.versions, + sizeof(CsrWifiSmeVersions)); + } + + unifi_trace(priv, UDBG4, + "sme_mgt_versions_get: unifi_mgt_versions_get_req <-- (r=%d status=%d)\n", + r, priv->sme_reply.reply_status); + + return convert_sme_error(priv->sme_reply.reply_status); +#else + CsrResult status; + CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); + status = CsrWifiSmeMgtVersionsGetReq(priv->smepriv, versions); + CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); + return convert_sme_error(status); +#endif +} + +#endif /* CSR_SUPPORT_WEXT */ + +int sme_mgt_power_config_get(unifi_priv_t *priv, CsrWifiSmePowerConfig *powerConfig) +{ +#ifdef CSR_SME_USERSPACE + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_power_config_get: invalid smepriv\n"); + return -EIO; + } + + unifi_trace(priv, UDBG4, "sme_mgt_power_config_get: unifi_mgt_power_config_req -->\n"); + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmePowerConfigGetReqSend(0); + + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + /* store the reply */ + if (powerConfig != NULL) { + memcpy((unsigned char*)powerConfig, + (unsigned char*)&priv->sme_reply.powerConfig, + sizeof(CsrWifiSmePowerConfig)); + } + + unifi_trace(priv, UDBG4, + "sme_mgt_get_versions: unifi_mgt_power_config_req <-- (r=%d status=%d)\n", + r, priv->sme_reply.reply_status); + + return convert_sme_error(priv->sme_reply.reply_status); +#else + CsrResult status; + CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); + status = CsrWifiSmeMgtPowerConfigGetReq(priv->smepriv, powerConfig); + CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); + return convert_sme_error(status); +#endif +} + +int sme_mgt_host_config_get(unifi_priv_t *priv, CsrWifiSmeHostConfig *hostConfig) +{ +#ifdef CSR_SME_USERSPACE + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_host_config_get: invalid smepriv\n"); + return -EIO; + } + + unifi_trace(priv, UDBG4, "sme_mgt_host_config_get: unifi_mgt_host_config_get_req -->\n"); + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmeHostConfigGetReqSend(0, CSR_WIFI_INTERFACE_IN_USE); + + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + /* store the reply */ + if (hostConfig != NULL) { + memcpy((unsigned char*)hostConfig, + (unsigned char*)&priv->sme_reply.hostConfig, + sizeof(CsrWifiSmeHostConfig)); + } + + unifi_trace(priv, UDBG4, + "sme_mgt_host_config_get: unifi_mgt_host_config_get_req <-- (r=%d status=%d)\n", + r, priv->sme_reply.reply_status); + + return convert_sme_error(priv->sme_reply.reply_status); +#else + CsrResult status; + CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); + status = CsrWifiSmeMgtHostConfigGetReq(priv->smepriv, hostConfig); + CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); + return convert_sme_error(status); +#endif +} + +int sme_mgt_sme_config_get(unifi_priv_t *priv, CsrWifiSmeStaConfig *staConfig, CsrWifiSmeDeviceConfig *deviceConfig) +{ +#ifdef CSR_SME_USERSPACE + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_sme_config_get: invalid smepriv\n"); + return -EIO; + } + + unifi_trace(priv, UDBG4, "sme_mgt_sme_config_get: unifi_mgt_sme_config_get_req -->\n"); + + /* Common device config */ + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmeSmeCommonConfigGetReqSend(0); + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + /* store the reply */ + if (deviceConfig != NULL) { + memcpy((unsigned char*)deviceConfig, + (unsigned char*)&priv->sme_reply.deviceConfig, + sizeof(CsrWifiSmeDeviceConfig)); + } + + /* STA config */ + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmeSmeStaConfigGetReqSend(0, CSR_WIFI_INTERFACE_IN_USE); + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + /* store the reply */ + if (staConfig != NULL) { + memcpy((unsigned char*)staConfig, + (unsigned char*)&priv->sme_reply.staConfig, + sizeof(CsrWifiSmeStaConfig)); + } + + unifi_trace(priv, UDBG4, + "sme_mgt_sme_config_get: unifi_mgt_sme_config_get_req <-- (r=%d status=%d)\n", + r, priv->sme_reply.reply_status); + + return convert_sme_error(priv->sme_reply.reply_status); +#else + CsrResult status; + CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); + status = CsrWifiSmeMgtSmeConfigGetReq(priv->smepriv, staConfig); + status = CsrWifiSmeMgtDeviceConfigGetReq(priv->smepriv, deviceConfig); + CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); + return convert_sme_error(status); +#endif +} + +int sme_mgt_coex_info_get(unifi_priv_t *priv, CsrWifiSmeCoexInfo *coexInfo) +{ +#ifdef CSR_SME_USERSPACE + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_coex_info_get: invalid smepriv\n"); + return -EIO; + } + + unifi_trace(priv, UDBG4, "sme_mgt_coex_info_get: unifi_mgt_coex_info_get_req -->\n"); + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmeCoexInfoGetReqSend(0); + + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + /* store the reply */ + if (coexInfo != NULL) { + memcpy((unsigned char*)coexInfo, + (unsigned char*)&priv->sme_reply.coexInfo, + sizeof(CsrWifiSmeCoexInfo)); + } + + unifi_trace(priv, UDBG4, + "sme_mgt_coex_info_get: unifi_mgt_coex_info_get_req <-- (r=%d status=%d)\n", + r, priv->sme_reply.reply_status); + + return convert_sme_error(priv->sme_reply.reply_status); +#else + CsrResult status; + CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); + status = CsrWifiSmeMgtCoexInfoGetReq(priv->smepriv, coexInfo); + CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); + return convert_sme_error(status); +#endif +} + +#ifdef CSR_SUPPORT_WEXT + +int sme_mgt_coex_config_get(unifi_priv_t *priv, CsrWifiSmeCoexConfig *coexConfig) +{ +#ifdef CSR_SME_USERSPACE + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_coex_config_get: invalid smepriv\n"); + return -EIO; + } + + unifi_trace(priv, UDBG4, "sme_mgt_coex_config_get: unifi_mgt_coex_config_get_req -->\n"); + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmeCoexConfigGetReqSend(0); + + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + /* store the reply */ + if (coexConfig != NULL) { + memcpy((unsigned char*)coexConfig, + (unsigned char*)&priv->sme_reply.coexConfig, + sizeof(CsrWifiSmeCoexConfig)); + } + + unifi_trace(priv, UDBG4, + "sme_mgt_coex_config_get: unifi_mgt_coex_config_get_req <-- (r=%d status=%d)\n", + r, priv->sme_reply.reply_status); + + return convert_sme_error(priv->sme_reply.reply_status); +#else + CsrResult status; + CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); + status = CsrWifiSmeMgtCoexConfigGetReq(priv->smepriv, coexConfig); + CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); + return convert_sme_error(status); +#endif +} + +int sme_mgt_mib_config_get(unifi_priv_t *priv, CsrWifiSmeMibConfig *mibConfig) +{ +#ifdef CSR_SME_USERSPACE + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_mib_config_get: invalid smepriv\n"); + return -EIO; + } + + unifi_trace(priv, UDBG4, "sme_mgt_mib_config_get: unifi_mgt_mib_config_get_req -->\n"); + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmeMibConfigGetReqSend(0); + + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + /* store the reply */ + if (mibConfig != NULL) { + memcpy((unsigned char*)mibConfig, + (unsigned char*)&priv->sme_reply.mibConfig, + sizeof(CsrWifiSmeMibConfig)); + } + + unifi_trace(priv, UDBG4, + "sme_mgt_mib_config_get: unifi_mgt_mib_config_get_req <-- (r=%d status=%d)\n", + r, priv->sme_reply.reply_status); + + return convert_sme_error(priv->sme_reply.reply_status); +#else + CsrResult status; + CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); + status = CsrWifiSmeMgtMibConfigGetReq(priv->smepriv, mibConfig); + CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); + return convert_sme_error(status); +#endif +} + +int sme_mgt_connection_info_get(unifi_priv_t *priv, CsrWifiSmeConnectionInfo *connectionInfo) +{ +#ifdef CSR_SME_USERSPACE + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_connection_info_get: invalid smepriv\n"); + return -EIO; + } + + unifi_trace(priv, UDBG4, "sme_mgt_connection_info_get: unifi_mgt_connection_info_get_req -->\n"); + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmeConnectionInfoGetReqSend(0, CSR_WIFI_INTERFACE_IN_USE); + + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + /* store the reply */ + if (connectionInfo != NULL) { + memcpy((unsigned char*)connectionInfo, + (unsigned char*)&priv->sme_reply.connectionInfo, + sizeof(CsrWifiSmeConnectionInfo)); + } + + unifi_trace(priv, UDBG4, + "sme_mgt_connection_info_get: unifi_mgt_connection_info_get_req <-- (r=%d status=%d)\n", + r, priv->sme_reply.reply_status); + + return convert_sme_error(priv->sme_reply.reply_status); +#else + CsrResult status; + CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); + status = CsrWifiSmeMgtConnectionInfoGetReq(priv->smepriv, connectionInfo); + CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); + return convert_sme_error(status); +#endif +} + +int sme_mgt_connection_config_get(unifi_priv_t *priv, CsrWifiSmeConnectionConfig *connectionConfig) +{ +#ifdef CSR_SME_USERSPACE + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_connection_config_get: invalid smepriv\n"); + return -EIO; + } + + unifi_trace(priv, UDBG4, "sme_mgt_connection_config_get: unifi_mgt_connection_config_get_req -->\n"); + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmeConnectionConfigGetReqSend(0, CSR_WIFI_INTERFACE_IN_USE); + + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + /* store the reply */ + if (connectionConfig != NULL) { + memcpy((unsigned char*)connectionConfig, + (unsigned char*)&priv->sme_reply.connectionConfig, + sizeof(CsrWifiSmeConnectionConfig)); + } + + unifi_trace(priv, UDBG4, + "sme_mgt_connection_config_get: unifi_mgt_connection_config_get_req <-- (r=%d status=%d)\n", + r, priv->sme_reply.reply_status); + + return convert_sme_error(priv->sme_reply.reply_status); +#else + CsrResult status; + CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); + status = CsrWifiSmeMgtConnectionConfigGetReq(priv->smepriv, connectionConfig); + CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); + return convert_sme_error(status); +#endif +} + +int sme_mgt_connection_stats_get(unifi_priv_t *priv, CsrWifiSmeConnectionStats *connectionStats) +{ +#ifdef CSR_SME_USERSPACE + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_connection_stats_get: invalid smepriv\n"); + return -EIO; + } + + unifi_trace(priv, UDBG4, "sme_mgt_connection_stats_get: unifi_mgt_connection_stats_get_req -->\n"); + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmeConnectionStatsGetReqSend(0, CSR_WIFI_INTERFACE_IN_USE); + + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + /* store the reply */ + if (connectionStats != NULL) { + memcpy((unsigned char*)connectionStats, + (unsigned char*)&priv->sme_reply.connectionStats, + sizeof(CsrWifiSmeConnectionStats)); + } + + unifi_trace(priv, UDBG4, + "sme_mgt_connection_stats_get: unifi_mgt_connection_stats_get_req <-- (r=%d status=%d)\n", + r, priv->sme_reply.reply_status); + + return convert_sme_error(priv->sme_reply.reply_status); +#else + CsrResult status; + CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); + status = CsrWifiSmeMgtConnectionStatsGetReq(priv->smepriv, connectionStats); + CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); + return convert_sme_error(status); +#endif +} + +#endif /* CSR_SUPPORT_WEXT */ + +int sme_mgt_packet_filter_set(unifi_priv_t *priv) +{ + CsrWifiIp4Address ipAddress = {{0xFF, 0xFF, 0xFF, 0xFF }}; + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_packet_filter_set: invalid smepriv\n"); + return -EIO; + } + if (priv->packet_filters.arp_filter) { + ipAddress.a[0] = (priv->sta_ip_address ) & 0xFF; + ipAddress.a[1] = (priv->sta_ip_address >> 8) & 0xFF; + ipAddress.a[2] = (priv->sta_ip_address >> 16) & 0xFF; + ipAddress.a[3] = (priv->sta_ip_address >> 24) & 0xFF; + } + + unifi_trace(priv, UDBG5, + "sme_mgt_packet_filter_set: IP address %d.%d.%d.%d\n", + ipAddress.a[0], ipAddress.a[1], + ipAddress.a[2], ipAddress.a[3]); + + /* Doesn't block for a confirm */ + CsrWifiSmePacketFilterSetReqSend(0, CSR_WIFI_INTERFACE_IN_USE, + priv->packet_filters.tclas_ies_length, + priv->filter_tclas_ies, + priv->packet_filters.filter_mode, + ipAddress); + return 0; +} + +int sme_mgt_tspec(unifi_priv_t *priv, CsrWifiSmeListAction action, + CsrUint32 tid, CsrWifiSmeDataBlock *tspec, CsrWifiSmeDataBlock *tclas) +{ + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_mgt_tspec: invalid smepriv\n"); + return -EIO; + } + + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiSmeTspecReqSend(0, CSR_WIFI_INTERFACE_IN_USE, + action, tid, TRUE, 0, + tspec->length, tspec->data, + tclas->length, tclas->data); + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + unifi_trace(priv, UDBG4, "sme_mgt_tspec: <-- (status=%d)\n", priv->sme_reply.reply_status); + return convert_sme_error(priv->sme_reply.reply_status); +} + + + +int sme_sys_suspend(unifi_priv_t *priv) +{ + int r; + CsrResult csrResult; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_sys_suspend: invalid smepriv\n"); + return -EIO; + } + + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + /* For powered suspend, tell the resume's wifi_on() not to reinit UniFi */ + priv->wol_suspend = (enable_wol == UNIFI_WOL_OFF) ? FALSE : TRUE; + + /* Suspend the SME, which will cause it to power down UniFi */ + CsrWifiRouterCtrlSuspendIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,0, 0, priv->wol_suspend); + r = sme_wait_for_reply(priv, UNIFI_SME_SYS_LONG_TIMEOUT); + if (r) { + /* No reply - forcibly power down in case the request wasn't processed */ + unifi_notice(priv, + "suspend: SME did not reply %s, ", + priv->ptest_mode ? "leave powered" : "power off UniFi anyway\n"); + + /* Leave power on for production test, though */ + if (!priv->ptest_mode) { + /* Put UniFi to deep sleep, in case we can not power it off */ + CsrSdioClaim(priv->sdio); + csrResult = unifi_force_low_power_mode(priv->card); + + /* For WOL, the UniFi must stay powered */ + if (!priv->wol_suspend) { + unifi_trace(priv, UDBG1, "Power off\n"); + CsrSdioPowerOff(priv->sdio); + } + CsrSdioRelease(priv->sdio); + } + } + + if (priv->wol_suspend) { + unifi_trace(priv, UDBG1, "UniFi left powered for WOL\n"); + + /* For PIO WOL, disable SDIO interrupt to enable PIO mode in the f/w */ + if (enable_wol == UNIFI_WOL_PIO) { + unifi_trace(priv, UDBG1, "Remove IRQ to enable PIO WOL\n"); + if (csr_sdio_linux_remove_irq(priv->sdio)) { + unifi_notice(priv, "WOL csr_sdio_linux_remove_irq failed\n"); + } + } + } + + /* Consider UniFi to be uninitialised */ + priv->init_progress = UNIFI_INIT_NONE; + + unifi_trace(priv, UDBG1, "sme_sys_suspend: <-- (r=%d status=%d)\n", r, priv->sme_reply.reply_status); + return convert_sme_error(priv->sme_reply.reply_status); +} + + +int sme_sys_resume(unifi_priv_t *priv) +{ + int r; + + unifi_trace(priv, UDBG1, "sme_sys_resume %s\n", priv->wol_suspend ? "warm" : ""); + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_sys_resume: invalid smepriv\n"); + return -EIO; + } + + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiRouterCtrlResumeIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,0, priv->wol_suspend); + + if (priv->ptest_mode == 1) { + r = sme_wait_for_reply(priv, UNIFI_SME_SYS_LONG_TIMEOUT); + if (r) { + /* No reply - forcibly power down in case the request wasn't processed */ + unifi_notice(priv, + "resume: SME did not reply, return success anyway\n"); + } + } else { + + /* + * We are not going to wait for the reply because the SME might be in + * the userspace. In this case the event will reach it when the kernel + * resumes. So, release now the SME semaphore that was downed in + * sme_init_request(). + */ + up(&priv->sme_sem); + } + + return 0; +} + +#ifdef CSR_SUPPORT_WEXT_AP +int sme_ap_stop(unifi_priv_t *priv,CsrUint16 interface_tag) +{ + int r; + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_ap_stop: invalid smepriv\n"); + return -EIO; + } + + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiNmeApStopReqSend(0,interface_tag); + + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + unifi_trace(priv, UDBG4, + "sme_ap_stop <-- (r=%d status=%d)\n", + r, priv->sme_reply.reply_status); + return convert_sme_error(priv->sme_reply.reply_status); + +} + +int sme_ap_start(unifi_priv_t *priv,CsrUint16 interface_tag, + CsrWifiSmeApConfig_t * ap_config) +{ + int r; + CsrWifiSmeApP2pGoConfig p2p_go_param; + memset(&p2p_go_param,0,sizeof(CsrWifiSmeApP2pGoConfig)); + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_ap_start: invalid smepriv\n"); + return -EIO; + } + + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiNmeApStartReqSend(0,interface_tag,CSR_WIFI_AP_TYPE_LEGACY,FALSE, + ap_config->ssid,1,ap_config->channel, + ap_config->credentials,ap_config->max_connections, + p2p_go_param,FALSE); + + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + if (r) { + return r; + } + + unifi_trace(priv, UDBG4, + "sme_ap_start <-- (r=%d status=%d)\n", + r, priv->sme_reply.reply_status); + return convert_sme_error(priv->sme_reply.reply_status); +} + +int sme_ap_config(unifi_priv_t *priv, + CsrWifiSmeApMacConfig *ap_mac_config, + CsrWifiNmeApConfig *group_security_config) +{ + int r; + CsrWifiSmeApP2pGoConfig p2p_go_param; + memset(&p2p_go_param,0,sizeof(CsrWifiSmeApP2pGoConfig)); + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_ap_config: invalid smepriv\n"); + return -EIO; + } + + r = sme_init_request(priv); + if (r) { + return -EIO; + } + + CsrWifiNmeApConfigSetReqSend(0,*group_security_config, + *ap_mac_config); + + r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); + + unifi_trace(priv, UDBG4, + "sme_ap_config <-- (r=%d status=%d)\n", + r, priv->sme_reply.reply_status); + return convert_sme_error(priv->sme_reply.reply_status); +} +#endif diff --git a/drivers/staging/csr/sme_mgt.c b/drivers/staging/csr/sme_mgt.c new file mode 100644 index 0000000..ab70216 --- /dev/null +++ b/drivers/staging/csr/sme_mgt.c @@ -0,0 +1,1018 @@ +/* + * --------------------------------------------------------------------------- + * FILE: sme_mgt.c + * + * PURPOSE: + * This file contains the driver specific implementation of + * the SME MGT SAP. + * It is part of the porting exercise. + * + * Copyright (C) 2008-2009 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * --------------------------------------------------------------------------- + */ + +#include "csr_wifi_hip_unifiversion.h" +#include "unifi_priv.h" +#include "csr_wifi_hip_conversions.h" +/* + * This file implements the SME MGT API. It contains the following functions: + * CsrWifiSmeWifiFlightmodeCfmSend() + * CsrWifiSmeWifiOnCfmSend() + * CsrWifiSmeWifiOffCfmSend() + * CsrWifiSmeWifiOffIndSend() + * CsrWifiSmeScanFullCfmSend() + * CsrWifiSmeScanResultsGetCfmSend() + * CsrWifiSmeScanResultIndSend() + * CsrWifiSmeScanResultsFlushCfmSend() + * CsrWifiSmeConnectCfmSend() + * CsrWifiSmeMediaStatusIndSend() + * CsrWifiSmeDisconnectCfmSend() + * CsrWifiSmeKeyCfmSend() + * CsrWifiSmeMulticastAddressCfmSend() + * CsrWifiSmeSetValueCfmSend() + * CsrWifiSmeGetValueCfmSend() + * CsrWifiSmeMicFailureIndSend() + * CsrWifiSmePmkidCfmSend() + * CsrWifiSmePmkidCandidateListIndSend() + * CsrWifiSmeMibSetCfmSend() + * CsrWifiSmeMibGetCfmSend() + * CsrWifiSmeMibGetNextCfmSend() + * CsrWifiSmeConnectionQualityIndSend() + * CsrWifiSmePacketFilterSetCfmSend() + * CsrWifiSmeTspecCfmSend() + * CsrWifiSmeTspecIndSend() + * CsrWifiSmeBlacklistCfmSend() + * CsrWifiSmeEventMaskSetCfmSend() + * CsrWifiSmeRoamStartIndSend() + * CsrWifiSmeRoamCompleteIndSend() + * CsrWifiSmeAssociationStartIndSend() + * CsrWifiSmeAssociationCompleteIndSend() + * CsrWifiSmeIbssStationIndSend() + */ + + +void CsrWifiSmeMicFailureIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeMicFailureInd* ind = (CsrWifiSmeMicFailureInd*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeMicFailureIndSend: invalid priv\n"); + return; + } + + unifi_trace(priv, UDBG1, + "CsrWifiSmeMicFailureIndSend: count=%d, KeyType=%d\n", + ind->count, ind->keyType); + + wext_send_michaelmicfailure_event(priv, ind->count, ind->address, ind->keyType, ind->interfaceTag); +#endif +} + + +void CsrWifiSmePmkidCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmePmkidCfm* cfm = (CsrWifiSmePmkidCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmePmkidCfmSend: Invalid ospriv.\n"); + return; + } + + /* + * WEXT never does a GET operation the PMKIDs, so we don't need + * handle data returned in pmkids. + */ + + sme_complete_request(priv, cfm->status); +#endif +} + + +void CsrWifiSmePmkidCandidateListIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmePmkidCandidateListInd* ind = (CsrWifiSmePmkidCandidateListInd*)msg; + int i; + + if (priv->smepriv == NULL) { + unifi_error(priv, "CsrWifiSmePmkidCandidateListIndSend: invalid smepriv\n"); + return; + } + + for (i = 0; i < ind->pmkidCandidatesCount; i++) + { + wext_send_pmkid_candidate_event(priv, ind->pmkidCandidates[i].bssid, ind->pmkidCandidates[i].preAuthAllowed, ind->interfaceTag); + } +#endif +} + +void CsrWifiSmeScanResultsFlushCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +void CsrWifiSmeScanResultsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeScanResultsGetCfm* cfm = (CsrWifiSmeScanResultsGetCfm*)msg; + int bytesRequired = cfm->scanResultsCount * sizeof(CsrWifiSmeScanResult); + int i; + CsrUint8* current_buff; + CsrWifiSmeScanResult* scanCopy; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeScanResultsGetCfmSend: Invalid ospriv.\n"); + return; + } + + /* Calc the size of the buffer reuired */ + for (i = 0; i < cfm->scanResultsCount; ++i) { + const CsrWifiSmeScanResult *scan_result = &cfm->scanResults[i]; + bytesRequired += scan_result->informationElementsLength; + } + + /* Take a Copy of the scan Results :-) */ + scanCopy = CsrPmemAlloc(bytesRequired); + memcpy(scanCopy, cfm->scanResults, sizeof(CsrWifiSmeScanResult) * cfm->scanResultsCount); + + /* Take a Copy of the Info Elements AND update the scan result pointers */ + current_buff = (CsrUint8*)&scanCopy[cfm->scanResultsCount]; + for (i = 0; i < cfm->scanResultsCount; ++i) + { + CsrWifiSmeScanResult *scan_result = &scanCopy[i]; + CsrMemCpy(current_buff, scan_result->informationElements, scan_result->informationElementsLength); + scan_result->informationElements = current_buff; + current_buff += scan_result->informationElementsLength; + } + + priv->sme_reply.reply_scan_results_count = cfm->scanResultsCount; + priv->sme_reply.reply_scan_results = scanCopy; + + sme_complete_request(priv, cfm->status); +#endif +} + + +void CsrWifiSmeScanFullCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeScanFullCfm* cfm = (CsrWifiSmeScanFullCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeScanFullCfmSend: Invalid ospriv.\n"); + return; + } + + sme_complete_request(priv, cfm->status); +#endif +} + + +void CsrWifiSmeScanResultIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + +} + + +void CsrWifiSmeConnectCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeConnectCfm* cfm = (CsrWifiSmeConnectCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeConnectCfmSend: Invalid ospriv.\n"); + return; + } + + sme_complete_request(priv, cfm->status); +#endif +} + + +void CsrWifiSmeDisconnectCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeDisconnectCfm* cfm = (CsrWifiSmeDisconnectCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeDisconnectCfmSend: Invalid ospriv.\n"); + return; + } + + sme_complete_request(priv, cfm->status); +#endif +} + + +void CsrWifiSmeKeyCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeKeyCfm* cfm = (CsrWifiSmeKeyCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeKeyCfmSend: Invalid ospriv.\n"); + return; + } + + sme_complete_request(priv, cfm->status); +#endif +} + + +void CsrWifiSmeMulticastAddressCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeMulticastAddressCfm* cfm = (CsrWifiSmeMulticastAddressCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeMulticastAddressCfmSend: Invalid ospriv.\n"); + return; + } + + sme_complete_request(priv, cfm->status); +#endif +} + +void CsrWifiSmeWifiFlightmodeCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeWifiFlightmodeCfm* cfm = (CsrWifiSmeWifiFlightmodeCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeWifiFlightmodeCfmSend: Invalid ospriv.\n"); + return; + } + + sme_complete_request(priv, cfm->status); +#endif +} + +void CsrWifiSmeWifiOnCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeWifiOnCfm* cfm = (CsrWifiSmeWifiOnCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeWifiOnCfmSend: Invalid ospriv.\n"); + return; + } + + unifi_trace(priv, UDBG4, + "CsrWifiSmeWifiOnCfmSend: wake up status %d\n", cfm->status); +#ifdef CSR_SUPPORT_WEXT_AP + sme_complete_request(priv, cfm->status); +#endif + +#endif +} + +void CsrWifiSmeWifiOffCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeWifiOffCfm* cfm = (CsrWifiSmeWifiOffCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeWifiOffCfmSend: Invalid ospriv.\n"); + return; + } + + sme_complete_request(priv, cfm->status); +#endif +} + + +void CsrWifiSmeWifiOffIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeWifiOffInd* ind = (CsrWifiSmeWifiOffInd*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiRouterCtrlStoppedReqSend: Invalid ospriv.\n"); + return; + } + + if (priv->smepriv == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlStoppedReqSend: invalid smepriv\n"); + return; + } + + /* + * If the status indicates an error, the SME is in a stopped state. + * We need to start it again in order to reinitialise UniFi. + */ + switch (ind->reason) { + case CSR_WIFI_SME_CONTROL_INDICATION_ERROR: + unifi_trace(priv, UDBG1, + "CsrWifiRouterCtrlStoppedReqSend: Restarting SME (ind:%d)\n", + ind->reason); + + /* On error, restart the SME */ + sme_mgt_wifi_on(priv); + break; + case CSR_WIFI_SME_CONTROL_INDICATION_EXIT: +#ifdef CSR_SUPPORT_WEXT_AP + sme_complete_request(priv, 0); +#endif + break; + default: + break; + } + +#endif +} + +void CsrWifiSmeVersionsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeVersionsGetCfm* cfm = (CsrWifiSmeVersionsGetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeVersionsGetCfmSend: Invalid ospriv.\n"); + return; + } + + priv->sme_reply.versions = cfm->versions; + sme_complete_request(priv, cfm->status); +#endif +} + +void CsrWifiSmePowerConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmePowerConfigGetCfm* cfm = (CsrWifiSmePowerConfigGetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmePowerConfigGetCfmSend: Invalid ospriv.\n"); + return; + } + + priv->sme_reply.powerConfig = cfm->powerConfig; + sme_complete_request(priv, cfm->status); +} + +void CsrWifiSmeHostConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeHostConfigGetCfm* cfm = (CsrWifiSmeHostConfigGetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeHostConfigGetCfmSend: Invalid ospriv.\n"); + return; + } + + priv->sme_reply.hostConfig = cfm->hostConfig; + sme_complete_request(priv, cfm->status); +} + +void CsrWifiSmeCoexInfoGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeCoexInfoGetCfm* cfm = (CsrWifiSmeCoexInfoGetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeCoexInfoGetCfmSend: Invalid ospriv.\n"); + return; + } + + priv->sme_reply.coexInfo = cfm->coexInfo; + sme_complete_request(priv, cfm->status); +} + +void CsrWifiSmeCoexConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeCoexConfigGetCfm* cfm = (CsrWifiSmeCoexConfigGetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeCoexConfigGetCfmSend: Invalid ospriv.\n"); + return; + } + + priv->sme_reply.coexConfig = cfm->coexConfig; + sme_complete_request(priv, cfm->status); +#endif +} + +void CsrWifiSmeMibConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeMibConfigGetCfm* cfm = (CsrWifiSmeMibConfigGetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeMibConfigGetCfmSend: Invalid ospriv.\n"); + return; + } + + priv->sme_reply.mibConfig = cfm->mibConfig; + sme_complete_request(priv, cfm->status); +#endif +} + +void CsrWifiSmeConnectionInfoGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeConnectionInfoGetCfm* cfm = (CsrWifiSmeConnectionInfoGetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeConnectionInfoGetCfmSend: Invalid ospriv.\n"); + return; + } + + priv->sme_reply.connectionInfo = cfm->connectionInfo; + sme_complete_request(priv, cfm->status); +#endif +} + +void CsrWifiSmeConnectionConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeConnectionConfigGetCfm* cfm = (CsrWifiSmeConnectionConfigGetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeConnectionConfigGetCfmSend: Invalid ospriv.\n"); + return; + } + + priv->sme_reply.connectionConfig = cfm->connectionConfig; + sme_complete_request(priv, cfm->status); +#endif +} + +void CsrWifiSmeConnectionStatsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeConnectionStatsGetCfm* cfm = (CsrWifiSmeConnectionStatsGetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeConnectionStatsGetCfmSend: Invalid ospriv.\n"); + return; + } + + priv->sme_reply.connectionStats = cfm->connectionStats; + sme_complete_request(priv, cfm->status); +#endif +} + +void CsrWifiSmeMibSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeMibSetCfm* cfm = (CsrWifiSmeMibSetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeMibSetCfmSend: Invalid ospriv.\n"); + return; + } + + sme_complete_request(priv, cfm->status); +#endif +} + +void CsrWifiSmeMibGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeMibGetCfm* cfm = (CsrWifiSmeMibGetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeMibGetCfmSend: Invalid ospriv.\n"); + return; + } + + if (cfm->mibAttribute == NULL) { + unifi_error(priv, "CsrWifiSmeMibGetCfmSend: Empty reply.\n"); + sme_complete_request(priv, cfm->status); + return; + } + + if ((priv->mib_cfm_buffer != NULL) && + (priv->mib_cfm_buffer_length >= cfm->mibAttributeLength)) { + memcpy(priv->mib_cfm_buffer, cfm->mibAttribute, cfm->mibAttributeLength); + priv->mib_cfm_buffer_length = cfm->mibAttributeLength; + } else { + unifi_error(priv, + "CsrWifiSmeMibGetCfmSend: No room to store MIB data (have=%d need=%d).\n", + priv->mib_cfm_buffer_length, cfm->mibAttributeLength); + } + + sme_complete_request(priv, cfm->status); +#endif +} + +void CsrWifiSmeMibGetNextCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeMibGetNextCfm* cfm = (CsrWifiSmeMibGetNextCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeMibGetNextCfmSend: Invalid ospriv.\n"); + return; + } + + /* Need to copy MIB data */ + sme_complete_request(priv, cfm->status); +#endif +} + +void CsrWifiSmeConnectionQualityIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeConnectionQualityInd* ind = (CsrWifiSmeConnectionQualityInd*)msg; + int signal, noise, snr; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeConnectionQualityIndSend: Invalid ospriv.\n"); + return; + } + + /* + * level and noise below are mapped into an unsigned 8 bit number, + * ranging from [-192; 63]. The way this is achieved is simply to + * add 0x100 onto the number if it is negative, + * once clipped to the correct range. + */ + signal = ind->linkQuality.unifiRssi; + /* Clip range of snr */ + snr = (ind->linkQuality.unifiSnr > 0) ? ind->linkQuality.unifiSnr : 0; /* In dB relative, from 0 - 255 */ + snr = (snr < 255) ? snr : 255; + noise = signal - snr; + + /* Clip range of signal */ + signal = (signal < 63) ? signal : 63; + signal = (signal > -192) ? signal : -192; + + /* Clip range of noise */ + noise = (noise < 63) ? noise : 63; + noise = (noise > -192) ? noise : -192; + + /* Make u8 */ + signal = ( signal < 0 ) ? signal + 0x100 : signal; + noise = ( noise < 0 ) ? noise + 0x100 : noise; + + priv->wext_wireless_stats.qual.level = (u8)signal; /* -192 : 63 */ + priv->wext_wireless_stats.qual.noise = (u8)noise; /* -192 : 63 */ + priv->wext_wireless_stats.qual.qual = snr; /* 0 : 255 */ + priv->wext_wireless_stats.qual.updated = 0; + +#if WIRELESS_EXT > 16 + priv->wext_wireless_stats.qual.updated |= IW_QUAL_LEVEL_UPDATED | + IW_QUAL_NOISE_UPDATED | + IW_QUAL_QUAL_UPDATED; +#if WIRELESS_EXT > 18 + priv->wext_wireless_stats.qual.updated |= IW_QUAL_DBM; +#endif +#endif +#endif +} + +void CsrWifiSmePacketFilterSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmePacketFilterSetCfmSend: Invalid ospriv.\n"); + return; + } + + /* The packet filter set request does not block for a reply */ +} + +void CsrWifiSmeTspecCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeTspecCfm* cfm = (CsrWifiSmeTspecCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeTspecCfmSend: Invalid ospriv.\n"); + return; + } + + sme_complete_request(priv, cfm->status); +} + +void CsrWifiSmeTspecIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +void CsrWifiSmeBlacklistCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +void CsrWifiSmeEventMaskSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + + +void CsrWifiSmeRoamStartIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +void CsrWifiSmeRoamCompleteIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + /* This is called when the association completes, before any 802.1x authentication */ +} + +void CsrWifiSmeAssociationStartIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +void CsrWifiSmeAssociationCompleteIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +void CsrWifiSmeIbssStationIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +void CsrWifiSmeWifiOnIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +void CsrWifiSmeRestrictedAccessEnableCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +void CsrWifiSmeRestrictedAccessDisableCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + + +void CsrWifiSmeAdhocConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +void CsrWifiSmeAdhocConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeAdhocConfigSetCfm* cfm = (CsrWifiSmeAdhocConfigSetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n"); + return; + } + + sme_complete_request(priv, cfm->status); +#endif +} + +void CsrWifiSmeCalibrationDataGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +void CsrWifiSmeCalibrationDataSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeCalibrationDataSetCfm* cfm = (CsrWifiSmeCalibrationDataSetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n"); + return; + } + + sme_complete_request(priv, cfm->status); +#endif +} + +void CsrWifiSmeCcxConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +void CsrWifiSmeCcxConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeCcxConfigSetCfm* cfm = (CsrWifiSmeCcxConfigSetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n"); + return; + } + + sme_complete_request(priv, cfm->status); +#endif +} + +void CsrWifiSmeCloakedSsidsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +void CsrWifiSmeCloakedSsidsSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeCloakedSsidsSetCfm* cfm = (CsrWifiSmeCloakedSsidsSetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n"); + return; + } + + sme_complete_request(priv, cfm->status); +#endif +} + + +void CsrWifiSmeCoexConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeCoexConfigSetCfm* cfm = (CsrWifiSmeCoexConfigSetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n"); + return; + } + + sme_complete_request(priv, cfm->status); +#endif +} + +void CsrWifiSmeHostConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeHostConfigSetCfm* cfm = (CsrWifiSmeHostConfigSetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n"); + return; + } + + sme_complete_request(priv, cfm->status); +} + +void CsrWifiSmeLinkQualityGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + + +void CsrWifiSmeMibConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeMibConfigSetCfm* cfm = (CsrWifiSmeMibConfigSetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n"); + return; + } + + sme_complete_request(priv, cfm->status); +#endif +} + +void CsrWifiSmePermanentMacAddressGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +void CsrWifiSmePowerConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmePowerConfigSetCfm* cfm = (CsrWifiSmePowerConfigSetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n"); + return; + } + + sme_complete_request(priv, cfm->status); +} + +void CsrWifiSmeRegulatoryDomainInfoGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +void CsrWifiSmeRoamingConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +void CsrWifiSmeMediaStatusIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeMediaStatusInd* ind = (CsrWifiSmeMediaStatusInd*)msg; + + if (priv->smepriv == NULL) { + unifi_error(priv, "CsrWifiSmeMediaStatusIndSend: invalid smepriv\n"); + return; + } + + if (ind->mediaStatus == CSR_WIFI_SME_MEDIA_STATUS_CONNECTED) { + /* + * Send wireless-extension event up to userland to announce + * connection. + */ + wext_send_assoc_event(priv, + (unsigned char *)ind->connectionInfo.bssid.a, + (unsigned char *)ind->connectionInfo.assocReqInfoElements, + ind->connectionInfo.assocReqInfoElementsLength, + (unsigned char *)ind->connectionInfo.assocRspInfoElements, + ind->connectionInfo.assocRspInfoElementsLength, + (unsigned char *)ind->connectionInfo.assocScanInfoElements, + ind->connectionInfo.assocScanInfoElementsLength); + + unifi_trace(priv, UDBG2, + "CsrWifiSmeMediaStatusIndSend: IBSS=%02X:%02X:%02X:%02X:%02X:%02X\n", + ind->connectionInfo.bssid.a[0], + ind->connectionInfo.bssid.a[1], + ind->connectionInfo.bssid.a[2], + ind->connectionInfo.bssid.a[3], + ind->connectionInfo.bssid.a[4], + ind->connectionInfo.bssid.a[5]); + + sme_mgt_packet_filter_set(priv); + + } else { + /* + * Send wireless-extension event up to userland to announce + * connection lost to a BSS. + */ + wext_send_disassoc_event(priv); + } +#endif +} + +void CsrWifiSmeRoamingConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeRoamingConfigSetCfm* cfm = (CsrWifiSmeRoamingConfigSetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeRoamingConfigSetCfmSend: Invalid ospriv.\n"); + return; + } + + sme_complete_request(priv, cfm->status); +} + +void CsrWifiSmeScanConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +void CsrWifiSmeScanConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_SUPPORT_WEXT + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeScanConfigSetCfm* cfm = (CsrWifiSmeScanConfigSetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n"); + return; + } + + sme_complete_request(priv, cfm->status); +#endif +} + +void CsrWifiSmeStationMacAddressGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +void CsrWifiSmeSmeCommonConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeSmeCommonConfigGetCfm* cfm = (CsrWifiSmeSmeCommonConfigGetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeSmeCommonConfigGetCfmSend: Invalid ospriv.\n"); + return; + } + + priv->sme_reply.deviceConfig = cfm->deviceConfig; + sme_complete_request(priv, cfm->status); +} + +void CsrWifiSmeSmeStaConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeSmeStaConfigGetCfm* cfm = (CsrWifiSmeSmeStaConfigGetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeSmeStaConfigGetCfmSend: Invalid ospriv.\n"); + return; + } + + priv->sme_reply.staConfig = cfm->smeConfig; + sme_complete_request(priv, cfm->status); +} + +void CsrWifiSmeSmeCommonConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeSmeCommonConfigSetCfm* cfm = (CsrWifiSmeSmeCommonConfigSetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeSmeCommonConfigGetCfmSend: Invalid ospriv.\n"); + return; + } + + sme_complete_request(priv, cfm->status); +} + +void CsrWifiSmeSmeStaConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiSmeSmeStaConfigSetCfm* cfm = (CsrWifiSmeSmeStaConfigSetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiSmeSmeStaConfigGetCfmSend: Invalid ospriv.\n"); + return; + } + + sme_complete_request(priv, cfm->status); +} + +void CsrWifiSmeGetInterfaceCapabilityCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +void CsrWifiSmeErrorIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +void CsrWifiSmeInfoIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +void CsrWifiSmeCoreDumpIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} +void CsrWifiSmeAmpStatusChangeIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +void CsrWifiSmeActivateCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} +void CsrWifiSmeDeactivateCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +#ifdef CSR_SUPPORT_WEXT +#ifdef CSR_SUPPORT_WEXT_AP +void CsrWifiNmeApStartCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiNmeApStartCfm* cfm = (CsrWifiNmeApStartCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiNmeApStartCfmSend: Invalid ospriv.\n"); + return; + } + + sme_complete_request(priv, cfm->status); +} + +void CsrWifiNmeApStopCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiNmeApStopCfm* cfm = (CsrWifiNmeApStopCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiNmeApStopCfmSend: Invalid ospriv.\n"); + return; + } + + sme_complete_request(priv, cfm->status); +} + +void CsrWifiNmeApConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiNmeApConfigSetCfm* cfm = (CsrWifiNmeApConfigSetCfm*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiNmeApConfigSetCfmSend: Invalid ospriv.\n"); + return; + } + sme_complete_request(priv, cfm->status); +} +#endif +#endif diff --git a/drivers/staging/csr/sme_native.c b/drivers/staging/csr/sme_native.c new file mode 100644 index 0000000..2091109 --- /dev/null +++ b/drivers/staging/csr/sme_native.c @@ -0,0 +1,591 @@ +/* + * *************************************************************************** + * + * FILE: sme_native.c + * + * Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * *************************************************************************** + */ + +#include + +#include "unifi_priv.h" +#include "csr_wifi_hip_unifi.h" +#include "csr_wifi_hip_conversions.h" + +static const unsigned char wildcard_address[ETH_ALEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +int +uf_sme_init(unifi_priv_t *priv) +{ + func_enter(); + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) + sema_init(&priv->mlme_blocking_mutex, 1); +#else + init_MUTEX(&priv->mlme_blocking_mutex); +#endif + +#ifdef CSR_SUPPORT_WEXT + { + int r = uf_init_wext_interface(priv); + if (r != 0) { + func_exit(); + return r; + } + } +#endif + + + + func_exit(); + return 0; +} /* uf_sme_init() */ + + +void +uf_sme_deinit(unifi_priv_t *priv) +{ + + func_enter(); + + /* Free memory allocated for the scan table */ +/* unifi_clear_scan_table(priv); */ + + /* Cancel any pending workqueue tasks */ + flush_workqueue(priv->unifi_workqueue); + +#ifdef CSR_SUPPORT_WEXT + uf_deinit_wext_interface(priv); +#endif + + + func_exit(); +} /* uf_sme_deinit() */ + + +int sme_mgt_wifi_on(unifi_priv_t *priv) +{ + int r,i; + CsrInt32 csrResult; + + if (priv == NULL) { + return -EINVAL; + } + /* Initialize the interface mode to None */ + for (i=0; iinterfacePriv[i]->interfaceMode = 0; + } + + /* Set up interface mode so that get_packet_priority() can + * select the right QOS priority when WMM is enabled. + */ + priv->interfacePriv[0]->interfaceMode = CSR_WIFI_ROUTER_CTRL_MODE_STA; + + r = uf_request_firmware_files(priv, UNIFI_FW_STA); + if (r) { + unifi_error(priv, "sme_mgt_wifi_on: Failed to get f/w\n"); + return r; + } + + /* + * The request to initialise UniFi might come while UniFi is running. + * We need to block all I/O activity until the reset completes, otherwise + * an SDIO error might occur resulting an indication to the SME which + * makes it think that the initialisation has failed. + */ + priv->bh_thread.block_thread = 1; + + /* Power on UniFi */ + CsrSdioClaim(priv->sdio); + csrResult = CsrSdioPowerOn(priv->sdio); + CsrSdioRelease(priv->sdio); + if(csrResult != CSR_RESULT_SUCCESS && csrResult != CSR_SDIO_RESULT_NOT_RESET) { + return -EIO; + } + + if (csrResult == CSR_RESULT_SUCCESS) { + /* Initialise UniFi hardware */ + r = uf_init_hw(priv); + if (r) { + return r; + } + } + + /* Re-enable the I/O thread */ + priv->bh_thread.block_thread = 0; + + /* Disable deep sleep signalling during the firmware initialisation, to + * prevent the wakeup mechanism raising the SDIO clock beyond INIT before + * the first MLME-RESET.ind. It gets re-enabled at the CONNECTED.ind, + * immediately after the MLME-RESET.ind + */ + csrResult = unifi_configure_low_power_mode(priv->card, + UNIFI_LOW_POWER_DISABLED, + UNIFI_PERIODIC_WAKE_HOST_DISABLED); + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_warning(priv, + "sme_mgt_wifi_on: unifi_configure_low_power_mode() returned an error\n"); + } + + + /* Start the I/O thread */ + CsrSdioClaim(priv->sdio); + r = uf_init_bh(priv); + if (r) { + CsrSdioPowerOff(priv->sdio); + CsrSdioRelease(priv->sdio); + return r; + } + CsrSdioRelease(priv->sdio); + + priv->init_progress = UNIFI_INIT_FW_DOWNLOADED; + + return 0; +} + +int +sme_sys_suspend(unifi_priv_t *priv) +{ + const int interfaceNum = 0; /* FIXME */ + CsrResult csrResult; + + /* Abort any pending requests. */ + uf_abort_mlme(priv); + + /* Allow our mlme request to go through. */ + priv->io_aborted = 0; + + /* Send MLME-RESET.req to UniFi. */ + unifi_reset_state(priv, priv->netdev[interfaceNum]->dev_addr, 0); + + /* Stop the network traffic */ + netif_carrier_off(priv->netdev[interfaceNum]); + + /* Put UniFi to deep sleep */ + CsrSdioClaim(priv->sdio); + csrResult = unifi_force_low_power_mode(priv->card); + CsrSdioRelease(priv->sdio); + + return 0; +} /* sme_sys_suspend() */ + + +int +sme_sys_resume(unifi_priv_t *priv) +{ +#ifdef CSR_SUPPORT_WEXT + /* Send disconnect event so clients will re-initialise connection. */ + memset(priv->wext_conf.current_ssid, 0, UNIFI_MAX_SSID_LEN); + memset((void*)priv->wext_conf.current_bssid, 0, ETH_ALEN); + priv->wext_conf.capability = 0; + wext_send_disassoc_event(priv); +#endif + return 0; +} /* sme_sys_resume() */ + + +/* + * --------------------------------------------------------------------------- + * sme_native_log_event + * + * Callback function to be registered as the SME event callback. + * Copies the signal content into a new udi_log_t struct and adds + * it to the read queue for the SME client. + * + * Arguments: + * arg This is the value given to unifi_add_udi_hook, in + * this case a pointer to the client instance. + * signal Pointer to the received signal. + * signal_len Size of the signal structure in bytes. + * bulkdata Pointers to any associated bulk data. + * dir Direction of the signal. Zero means from host, + * non-zero means to host. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +void +sme_native_log_event(ul_client_t *pcli, + const u8 *sig_packed, int sig_len, + const bulk_data_param_t *bulkdata, + int dir) +{ + unifi_priv_t *priv; + udi_log_t *logptr; + u8 *p; + int i, r; + int signal_len; + int total_len; + udi_msg_t *msgptr; + CSR_SIGNAL signal; + ul_client_t *client = pcli; + + func_enter(); + + if (client == NULL) { + unifi_error(NULL, "sme_native_log_event: client has exited\n"); + return; + } + + priv = uf_find_instance(client->instance); + if (!priv) { + unifi_error(priv, "invalid priv\n"); + return; + } + + /* Just a sanity check */ + if ((sig_packed == NULL) || (sig_len <= 0)) { + return; + } + + /* Get the unpacked signal */ + r = read_unpack_signal(sig_packed, &signal); + if (r == 0) { + signal_len = SigGetSize(&signal); + } else { + CsrUint16 receiver_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sig_packed) + sizeof(CsrUint16)) & 0xFF00; + + /* The control indications are 1 byte, pass them to client. */ + if (sig_len == 1) { + unifi_trace(priv, UDBG5, + "Control indication (0x%x) for native SME.\n", + *sig_packed); + + *(u8*)&signal = *sig_packed; + signal_len = sig_len; + } else if (receiver_id == 0) { + /* + * Also "unknown" signals with a ReceiverId of 0 are passed to the client + * without unpacking. (This is a code size optimisation to allow signals + * that the driver not interested in to be dropped from the unpack code). + */ + unifi_trace(priv, UDBG5, + "Signal 0x%.4X with ReceiverId 0 for native SME.\n", + CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sig_packed)); + + *(u8*)&signal = *sig_packed; + signal_len = sig_len; + } else { + unifi_error(priv, + "sme_native_log_event - Received unknown signal 0x%.4X.\n", + CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sig_packed)); + return; + } + } + + unifi_trace(priv, UDBG3, "sme_native_log_event: signal 0x%.4X for %d\n", + signal.SignalPrimitiveHeader.SignalId, + client->client_id); + + total_len = signal_len; + /* Calculate the buffer we need to store signal plus bulk data */ + for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { + total_len += bulkdata->d[i].data_length; + } + + /* Allocate log structure plus actual signal. */ + logptr = (udi_log_t *)kmalloc(sizeof(udi_log_t) + total_len, GFP_KERNEL); + + if (logptr == NULL) { + unifi_error(priv, + "Failed to allocate %d bytes for a UDI log record\n", + sizeof(udi_log_t) + total_len); + return; + } + + /* Fill in udi_log struct */ + INIT_LIST_HEAD(&logptr->q); + msgptr = &logptr->msg; + msgptr->length = sizeof(udi_msg_t) + total_len; + msgptr->timestamp = jiffies_to_msecs(jiffies); + msgptr->direction = dir; + msgptr->signal_length = signal_len; + + /* Copy signal and bulk data to the log */ + p = (u8 *)(msgptr + 1); + memcpy(p, &signal, signal_len); + p += signal_len; + + /* Append any bulk data */ + for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { + int len = bulkdata->d[i].data_length; + + /* + * Len here might not be the same as the length in the bulk data slot. + * The slot length will always be even, but len could be odd. + */ + if (len > 0) { + if (bulkdata->d[i].os_data_ptr) { + memcpy(p, bulkdata->d[i].os_data_ptr, len); + } else { + memset(p, 0, len); + } + p += len; + } + } + + /* Add to tail of log queue */ + down(&client->udi_sem); + list_add_tail(&logptr->q, &client->udi_log); + up(&client->udi_sem); + + /* Wake any waiting user process */ + wake_up_interruptible(&client->udi_wq); + + func_exit(); + +} /* sme_native_log_event() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_ta_indicate_protocol + * + * Report that a packet of a particular type has been seen + * + * Arguments: + * drv_priv The device context pointer passed to ta_init. + * protocol The protocol type enum value. + * direction Whether the packet was a tx or rx. + * src_addr The source MAC address from the data packet. + * + * Returns: + * None. + * + * Notes: + * We defer the actual sending to a background workqueue, + * see uf_ta_ind_wq(). + * --------------------------------------------------------------------------- + */ +void +unifi_ta_indicate_protocol(void *ospriv, + CsrWifiRouterCtrlTrafficPacketType packet_type, + CsrWifiRouterCtrlProtocolDirection direction, + const CsrWifiMacAddress *src_addr) +{ + +} /* unifi_ta_indicate_protocol */ + +/* + * --------------------------------------------------------------------------- + * unifi_ta_indicate_sampling + * + * Send the TA sampling information to the SME. + * + * Arguments: + * drv_priv The device context pointer passed to ta_init. + * stats The TA sampling data to send. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +void +unifi_ta_indicate_sampling(void *ospriv, CsrWifiRouterCtrlTrafficStats *stats) +{ + +} /* unifi_ta_indicate_sampling() */ + + +void +unifi_ta_indicate_l4stats(void *ospriv, + CsrUint32 rxTcpThroughput, + CsrUint32 txTcpThroughput, + CsrUint32 rxUdpThroughput, + CsrUint32 txUdpThroughput) +{ + +} /* unifi_ta_indicate_l4stats() */ + +/* + * --------------------------------------------------------------------------- + * uf_native_process_udi_signal + * + * Process interesting signals from the UDI interface. + * + * Arguments: + * pcli A pointer to the client instance. + * signal Pointer to the received signal. + * signal_len Size of the signal structure in bytes. + * bulkdata Pointers to any associated bulk data. + * dir Direction of the signal. Zero means from host, + * non-zero means to host. + * + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +void +uf_native_process_udi_signal(ul_client_t *pcli, + const u8 *packed_signal, int packed_signal_len, + const bulk_data_param_t *bulkdata, int dir) +{ + +} /* uf_native_process_udi_signal() */ + + +/* + * --------------------------------------------------------------------------- + * sme_native_mlme_event_handler + * + * Callback function to be used as the udi_event_callback when registering + * as a client. + * This function implements a blocking request-reply interface for WEXT. + * To use it, a client specifies this function as the udi_event_callback + * to ul_register_client(). The signal dispatcher in + * unifi_receive_event() will call this function to deliver a signal. + * + * Arguments: + * pcli Pointer to the client instance. + * signal Pointer to the received signal. + * signal_len Size of the signal structure in bytes. + * bulkdata Pointer to structure containing any associated bulk data. + * dir Direction of the signal. Zero means from host, + * non-zero means to host. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +void +sme_native_mlme_event_handler(ul_client_t *pcli, + const u8 *sig_packed, int sig_len, + const bulk_data_param_t *bulkdata, + int dir) +{ + CSR_SIGNAL signal; + int signal_len; + unifi_priv_t *priv = uf_find_instance(pcli->instance); + int id, r; + + func_enter(); + + /* Just a sanity check */ + if ((sig_packed == NULL) || (sig_len <= 0)) { + return; + } + + /* Get the unpacked signal */ + r = read_unpack_signal(sig_packed, &signal); + if (r == 0) { + signal_len = SigGetSize(&signal); + } else { + unifi_error(priv, + "sme_native_mlme_event_handler - Received unknown signal 0x%.4X.\n", + CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sig_packed)); + return; + } + + id = signal.SignalPrimitiveHeader.SignalId; + unifi_trace(priv, UDBG4, "wext - Process signal 0x%.4X\n", id); + + /* + * Take the appropriate action for the signal. + */ + switch (id) { + /* + * Confirm replies from UniFi. + * These all have zero or one CSR_DATAREF member. (FIXME: check this is still true for softmac) + */ + case CSR_MA_PACKET_CONFIRM_ID: + case CSR_MLME_RESET_CONFIRM_ID: + case CSR_MLME_GET_CONFIRM_ID: + case CSR_MLME_SET_CONFIRM_ID: + case CSR_MLME_GET_NEXT_CONFIRM_ID: + case CSR_MLME_POWERMGT_CONFIRM_ID: + case CSR_MLME_SCAN_CONFIRM_ID: + case CSR_MLME_HL_SYNC_CONFIRM_ID: + case CSR_MLME_MEASURE_CONFIRM_ID: + case CSR_MLME_SETKEYS_CONFIRM_ID: + case CSR_MLME_DELETEKEYS_CONFIRM_ID: + case CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID: + case CSR_MLME_ADD_PERIODIC_CONFIRM_ID: + case CSR_MLME_DEL_PERIODIC_CONFIRM_ID: + case CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID: + case CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID: + case CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID: + case CSR_MLME_STOP_MEASURE_CONFIRM_ID: + case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID: + case CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID: + case CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID: + case CSR_MLME_ADD_BLACKOUT_CONFIRM_ID: + case CSR_MLME_DEL_BLACKOUT_CONFIRM_ID: + case CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID: + case CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID: + case CSR_MLME_CONNECT_STATUS_CONFIRM_ID: + case CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID: + case CSR_MLME_ADD_TEMPLATE_CONFIRM_ID: + case CSR_MLME_CONFIG_QUEUE_CONFIRM_ID: + case CSR_MLME_ADD_TSPEC_CONFIRM_ID: + case CSR_MLME_DEL_TSPEC_CONFIRM_ID: + case CSR_MLME_START_AGGREGATION_CONFIRM_ID: + case CSR_MLME_STOP_AGGREGATION_CONFIRM_ID: + case CSR_MLME_SM_START_CONFIRM_ID: + case CSR_MLME_LEAVE_CONFIRM_ID: + case CSR_MLME_SET_TIM_CONFIRM_ID: + case CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID: + case CSR_MLME_SET_CHANNEL_CONFIRM_ID: + case CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID: + case CSR_DEBUG_GENERIC_CONFIRM_ID: + unifi_mlme_copy_reply_and_wakeup_client(pcli, &signal, signal_len, bulkdata); + break; + + case CSR_MLME_CONNECTED_INDICATION_ID: + /* We currently ignore the connected-ind for softmac f/w development */ + unifi_info(priv, "CSR_MLME_CONNECTED_INDICATION_ID ignored\n"); + break; + + default: + break; + } + + func_exit(); +} /* sme_native_mlme_event_handler() */ + + + +/* + * ------------------------------------------------------------------------- + * unifi_reset_state + * + * Ensure that a MAC address has been set. + * Send the MLME-RESET signal. + * This must be called at least once before starting to do any + * network activities (e.g. scan, join etc). + * + * Arguments: + * priv Pointer to device private context struct + * macaddr Pointer to chip MAC address. + * If this is FF:FF:FF:FF:FF:FF it will be replaced + * with the MAC address from the chip. + * set_default_mib 1 if the f/w must reset the MIB to the default values + * 0 otherwise + * + * Returns: + * 0 on success, an error code otherwise. + * ------------------------------------------------------------------------- + */ +int +unifi_reset_state(unifi_priv_t *priv, unsigned char *macaddr, + unsigned char set_default_mib) +{ + int r = 0; + + func_enter(); + +#ifdef CSR_SUPPORT_WEXT + /* The reset clears any 802.11 association. */ + priv->wext_conf.flag_associated = 0; +#endif + + func_exit(); + return r; +} /* unifi_reset_state() */ + diff --git a/drivers/staging/csr/sme_sys.c b/drivers/staging/csr/sme_sys.c new file mode 100644 index 0000000..f576044 --- /dev/null +++ b/drivers/staging/csr/sme_sys.c @@ -0,0 +1,2950 @@ +/* + * --------------------------------------------------------------------------- + * FILE: sme_sys.c + * + * PURPOSE: + * Driver specific implementation of the SME SYS SAP. + * It is part of the porting exercise. + * + * Copyright (C) 2008-2011 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * --------------------------------------------------------------------------- + */ + +#include "csr_wifi_hip_unifiversion.h" +#include "unifi_priv.h" +#include "csr_wifi_hip_conversions.h" +#ifdef CSR_SUPPORT_WEXT_AP +#include "sme_csr/csr_wifi_sme_sef.h" +#endif +/* + * This file implements the SME SYS API and contains the following functions: + * CsrWifiRouterCtrlMediaStatusReqHandler() + * CsrWifiRouterCtrlHipReqHandler() + * CsrWifiRouterCtrlPortConfigureReqHandler() + * CsrWifiRouterCtrlWifiOnReqHandler() + * CsrWifiRouterCtrlWifiOffReqHandler() + * CsrWifiRouterCtrlSuspendResHandler() + * CsrWifiRouterCtrlResumeResHandler() + * CsrWifiRouterCtrlQosControlReqHandler() + * CsrWifiRouterCtrlConfigurePowerModeReqHandler() + * CsrWifiRouterCtrlWifiOnResHandler() + * CsrWifiRouterCtrlWifiOffRspHandler() + * CsrWifiRouterCtrlMulticastAddressResHandler() + * CsrWifiRouterCtrlTrafficConfigReqHandler() + * CsrWifiRouterCtrlTrafficClassificationReqHandler() + * CsrWifiRouterCtrlTclasAddReqHandler() + * CsrWifiRouterCtrlTclasDelReqHandler() + * CsrWifiRouterCtrlSetModeReqHandler() + * CsrWifiRouterCtrlWapiMulticastFilterReqHandler() + * CsrWifiRouterCtrlWapiMulticastReqHandler() + * CsrWifiRouterCtrlWapiUnicastFilterReqHandler() + */ + +#ifdef CSR_SUPPORT_SME +static void check_inactivity_timer_expire_func(unsigned long data); +void uf_send_disconnected_ind_wq(struct work_struct *work); +#endif + +void send_auto_ma_packet_confirm(unifi_priv_t *priv, + netInterface_priv_t *interfacePriv, + struct list_head *buffered_frames_list) +{ + tx_buffered_packets_t *buffered_frame_item = NULL; + struct list_head *listHead; + struct list_head *placeHolder; + int client_id; + + CSR_SIGNAL unpacked_signal; + CsrUint8 sigbuf[UNIFI_PACKED_SIGBUF_SIZE]; + CsrUint16 packed_siglen; + + + list_for_each_safe(listHead, placeHolder, buffered_frames_list) + { + buffered_frame_item = list_entry(listHead, tx_buffered_packets_t, q); + + if(!buffered_frame_item) { + unifi_error(priv, "Entry should exist, otherwise it is a (BUG)\n"); + continue; + } + + if ((interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_NONE) && + (priv->wifi_on_state == wifi_on_done)) + { + + unifi_warning(priv, "Send MA_PACKET_CONFIRM to SenderProcessId = %x for (HostTag = %x TransmissionControl = %x)\n", + (buffered_frame_item->leSenderProcessId), + buffered_frame_item->hostTag, + buffered_frame_item->transmissionControl); + + client_id = buffered_frame_item->leSenderProcessId & 0xFF00; + + if (client_id == priv->sme_cli->sender_id) + { + /* construct a MA-PACKET.confirm message for SME */ + memset(&unpacked_signal, 0, sizeof(unpacked_signal)); + unpacked_signal.SignalPrimitiveHeader.SignalId = CSR_MA_PACKET_CONFIRM_ID; + unpacked_signal.SignalPrimitiveHeader.ReceiverProcessId = buffered_frame_item->leSenderProcessId; + unpacked_signal.SignalPrimitiveHeader.SenderProcessId = CSR_WIFI_ROUTER_IFACEQUEUE; + + unpacked_signal.u.MaPacketConfirm.VirtualInterfaceIdentifier = uf_get_vif_identifier(interfacePriv->interfaceMode, + interfacePriv->InterfaceTag); + unpacked_signal.u.MaPacketConfirm.TransmissionStatus = CSR_RESULT_FAILURE; + unpacked_signal.u.MaPacketConfirm.RetryCount = 0; + unpacked_signal.u.MaPacketConfirm.Rate = buffered_frame_item->rate; + unpacked_signal.u.MaPacketConfirm.HostTag = buffered_frame_item->hostTag; + + write_pack(&unpacked_signal, sigbuf, &packed_siglen); + unifi_warning(priv, "MA_PACKET_CONFIRM for SME (0x%x, 0x%x, 0x%x, 0x%x)\n", + unpacked_signal.SignalPrimitiveHeader.ReceiverProcessId, + unpacked_signal.SignalPrimitiveHeader.SenderProcessId, + unpacked_signal.u.MaPacketConfirm.VirtualInterfaceIdentifier, + unpacked_signal.u.MaPacketConfirm.HostTag); + + CsrWifiRouterCtrlHipIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, + packed_siglen, + (CsrUint8 *)sigbuf, + 0, NULL, + 0, NULL); + } + else if((buffered_frame_item->hostTag & 0x80000000)) + { + /* construct a MA-PACKET.confirm message for NME */ + unifi_warning(priv, "MA_PACKET_CONFIRM for NME (0x%x, 0x%x, 0x%x, 0x%x)\n", + buffered_frame_item->leSenderProcessId, + buffered_frame_item->interfaceTag, + buffered_frame_item->transmissionControl, + (buffered_frame_item->hostTag & 0x3FFFFFFF)); + + CsrWifiRouterMaPacketCfmSend((buffered_frame_item->leSenderProcessId & 0xFF), + buffered_frame_item->interfaceTag, + CSR_RESULT_FAILURE, + (buffered_frame_item->hostTag & 0x3FFFFFFF), + buffered_frame_item->rate); + + } + else + { + unifi_warning(priv, "Buffered packet dropped without sending a confirm\n"); + } + + } + + list_del(listHead); + kfree(buffered_frame_item); + buffered_frame_item = NULL; + } +} + +void CsrWifiRouterCtrlMediaStatusReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterCtrlMediaStatusReq* req = (CsrWifiRouterCtrlMediaStatusReq*)msg; + netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; + unsigned long flags; + + if (priv->smepriv == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlMediaStatusReqHandler: invalid smepriv\n"); + return; + } + if (req->interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "CsrWifiRouterCtrlMediaStatusReqHandler: invalid interfaceTag\n"); + return; + } + unifi_trace(priv, UDBG3, "CsrWifiRouterCtrlMediaStatusReqHandler: Mode = %d req->mediaStatus = %d\n",interfacePriv->interfaceMode,req->mediaStatus); + if (interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_AMP) { + bulk_data_desc_t bulk_data; + + bulk_data.data_length = 0; + + spin_lock_irqsave(&priv->m4_lock, flags); + if (interfacePriv->m4_bulk_data.data_length > 0) { + bulk_data = interfacePriv->m4_bulk_data; + interfacePriv->m4_bulk_data.net_buf_length = 0; + interfacePriv->m4_bulk_data.data_length = 0; + interfacePriv->m4_bulk_data.os_data_ptr = interfacePriv->m4_bulk_data.os_net_buf_ptr = NULL; + } + spin_unlock_irqrestore(&priv->m4_lock, flags); + + if (bulk_data.data_length != 0) { + unifi_trace(priv, UDBG5, "CsrWifiRouterCtrlMediaStatusReqHandler: free M4\n"); + unifi_net_data_free(priv, &bulk_data); + } + + if ((req->mediaStatus == CSR_WIFI_SME_MEDIA_STATUS_CONNECTED) && + (interfacePriv->connected != UnifiConnected)) { + + switch(interfacePriv->interfaceMode){ + case CSR_WIFI_ROUTER_CTRL_MODE_AP: + case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: + interfacePriv->connected = UnifiConnected; + netif_carrier_on(priv->netdev[req->interfaceTag]); +#ifdef CSR_SUPPORT_WEXT + wext_send_started_event(priv); +#endif + unifi_trace(priv, UDBG1, + "CsrWifiRouterCtrlMediaStatusReqHandler: AP/P2PGO setting netif_carrier_on\n"); + UF_NETIF_TX_WAKE_ALL_QUEUES(priv->netdev[req->interfaceTag]); + break; + + default: +#ifdef CSR_SUPPORT_WEXT + /* In the WEXT builds (sme and native), the userspace is not ready + * to process any EAPOL or WAPI packets, until it has been informed + * of the NETDEV_CHANGE. + */ + if (interfacePriv->netdev_callback_registered && (interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI)) { + interfacePriv->wait_netdev_change = TRUE; + unifi_trace(priv, UDBG1, + "CsrWifiRouterCtrlMediaStatusReqHandler: waiting for NETDEV_CHANGE\n"); + /* + * Carrier can go to on, only after wait_netdev_change is set to TRUE. + * Otherwise there can be a race in uf_netdev_event(). + */ + netif_carrier_on(priv->netdev[req->interfaceTag]); + unifi_trace(priv, UDBG1, + "CsrWifiRouterCtrlMediaStatusReqHandler: STA/P2PCLI setting netif_carrier_on\n"); + } + else +#endif + { + /* In the NME build, the userspace does not wait for the NETDEV_CHANGE + * so it is ready to process all the EAPOL or WAPI packets. + * At this point, we enable all the Tx queues, and we indicate any packets + * that are queued (and the respective port is opened). + */ + static const CsrWifiMacAddress broadcast_address = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}}; + interfacePriv->connected = UnifiConnected; + unifi_trace(priv, UDBG1, + "CsrWifiRouterMediaStatusReqHandler: UnifiConnected && netif_carrier_on\n"); + netif_carrier_on(priv->netdev[req->interfaceTag]); + UF_NETIF_TX_WAKE_ALL_QUEUES(priv->netdev[req->interfaceTag]); + uf_process_rx_pending_queue(priv, UF_UNCONTROLLED_PORT_Q, broadcast_address, 1, interfacePriv->InterfaceTag); + uf_process_rx_pending_queue(priv, UF_CONTROLLED_PORT_Q, broadcast_address, 1, interfacePriv->InterfaceTag); + } + break; + } + } + + if (req->mediaStatus == CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED) { +#ifdef CSR_SUPPORT_WEXT + unifi_trace(priv, UDBG1, + "CsrWifiRouterMediaStatusReqHandler: cancel waiting for NETDEV_CHANGE\n"); + interfacePriv->wait_netdev_change = FALSE; +#endif + unifi_trace(priv, UDBG1, + "CsrWifiRouterMediaStatusReqHandler: setting netif_carrier_off\n"); + netif_carrier_off(priv->netdev[req->interfaceTag]); +#ifdef CSR_SUPPORT_WEXT + switch(interfacePriv->interfaceMode){ + case CSR_WIFI_ROUTER_CTRL_MODE_AP: + case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: + wext_send_started_event(priv); + break; + default: + break; + } +#endif + interfacePriv->connected = UnifiNotConnected; + } + } else { + /* For AMP, just update the L2 connected flag */ + if (req->mediaStatus == CSR_WIFI_SME_MEDIA_STATUS_CONNECTED) { + unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlMediaStatusReqHandler: AMP connected\n"); + interfacePriv->connected = UnifiConnected; + } else { + unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlMediaStatusReqHandler: AMP disconnected\n"); + interfacePriv->connected = UnifiNotConnected; + } + } +} + + +void CsrWifiRouterCtrlHipReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterCtrlHipReq* hipreq = (CsrWifiRouterCtrlHipReq*)msg; + bulk_data_param_t bulkdata; + u8 *signal_ptr; + int signal_length; + int r=0; + void *dest; + CsrResult csrResult; + CSR_SIGNAL *signal; + CsrUint16 interfaceTag = 0; + CSR_MA_PACKET_REQUEST *req; + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + + if (priv == NULL) { + return; + } + if (priv->smepriv == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlHipReqHandler: invalid smepriv\n"); + return; + } + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "CsrWifiRouterCtrlHipReqHandler: invalid interfaceTag\n"); + return; + } + + /* Initialize bulkdata to avoid os_net_buf is garbage */ + memset(&bulkdata, 0, sizeof(bulk_data_param_t)); + + signal = (CSR_SIGNAL *)hipreq->mlmeCommand; + + unifi_trace(priv, UDBG4, "CsrWifiRouterCtrlHipReqHandler: 0x04%X ---->\n", + *((CsrUint16*)hipreq->mlmeCommand)); + + /* Construct the signal. */ + signal_ptr = (u8*)hipreq->mlmeCommand; + signal_length = hipreq->mlmeCommandLength; + + /* + * The MSB of the sender ID needs to be set to the client ID. + * The LSB is controlled by the SME. + */ + signal_ptr[5] = (priv->sme_cli->sender_id >> 8) & 0xff; + + /* Allocate buffers for the bulk data. */ + if (hipreq->dataRef1Length) { + csrResult = unifi_net_data_malloc(priv, &bulkdata.d[0], hipreq->dataRef1Length); + if (csrResult == CSR_RESULT_SUCCESS) { + dest = (void*)bulkdata.d[0].os_data_ptr; + memcpy(dest, hipreq->dataRef1, hipreq->dataRef1Length); + bulkdata.d[0].data_length = hipreq->dataRef1Length; + } else { + unifi_warning(priv, "signal not sent down, allocation failed in CsrWifiRouterCtrlHipReqHandler\n"); + return; + } + } else { + bulkdata.d[0].os_data_ptr = NULL; + bulkdata.d[0].data_length = 0; + } + if (hipreq->dataRef2Length) { + csrResult = unifi_net_data_malloc(priv, &bulkdata.d[1], hipreq->dataRef2Length); + if (csrResult == CSR_RESULT_SUCCESS) { + dest = (void*)bulkdata.d[1].os_data_ptr; + memcpy(dest, hipreq->dataRef2, hipreq->dataRef2Length); + bulkdata.d[1].data_length = hipreq->dataRef2Length; + } else { + if (bulkdata.d[0].data_length) + { + unifi_net_data_free(priv, &bulkdata.d[0]); + } + unifi_warning(priv, "signal not sent down, allocation failed in CsrWifiRouterCtrlHipReqHandler\n"); + return; + } + } else { + bulkdata.d[1].os_data_ptr = NULL; + bulkdata.d[1].data_length = 0; + } + + unifi_trace(priv, UDBG3, "SME SEND: Signal 0x%.4X \n", + *((CsrUint16*)signal_ptr)); + if (signal->SignalPrimitiveHeader.SignalId == CSR_MA_PACKET_REQUEST_ID) + { + CSR_SIGNAL unpacked_signal; + read_unpack_signal((u8 *) signal, &unpacked_signal); + req = &unpacked_signal.u.MaPacketRequest; + interfaceTag = req->VirtualInterfaceIdentifier & 0xff; + switch(interfacePriv->interfaceMode) + { + case CSR_WIFI_ROUTER_CTRL_MODE_NONE: + unifi_error(priv, "CsrWifiRouterCtrlHipReqHandler: invalid mode: NONE \n"); + break; + default: + unifi_trace(priv, UDBG5, "mode is %x\n", interfacePriv->interfaceMode); + } + /* While sending ensure that first 2 bits b31 and b30 are 00. These are used for local routing*/ + r = uf_process_ma_packet_req(priv, req->Ra.x, (req->HostTag & 0x3FFFFFFF), interfaceTag, + req->TransmissionControl, req->TransmitRate, + req->Priority, signal->SignalPrimitiveHeader.SenderProcessId, + &bulkdata); + if (r) + { + if (bulkdata.d[0].data_length) + { + unifi_net_data_free(priv, &bulkdata.d[0]); + } + if (bulkdata.d[1].data_length) + { + unifi_net_data_free(priv, &bulkdata.d[1]); + } + } + } else { + /* ul_send_signal_raw frees the bulk data if it fails */ + r = ul_send_signal_raw(priv, signal_ptr, signal_length, &bulkdata); + } + + if (r) { + unifi_error(priv, + "CsrWifiRouterCtrlHipReqHandler: Failed to send signal (0x%.4X - %u)\n", + *((CsrUint16*)signal_ptr), r); + CsrWifiRouterCtrlWifiOffIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,0,CSR_WIFI_SME_CONTROL_INDICATION_ERROR); + } + + unifi_trace(priv, UDBG4, "CsrWifiRouterCtrlHipReqHandler: <----\n"); +} + +#ifdef CSR_WIFI_SEND_GRATUITOUS_ARP +static void +uf_send_gratuitous_arp(unifi_priv_t *priv, CsrUint16 interfaceTag) +{ + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + CSR_PRIORITY priority; + CSR_SIGNAL signal; + bulk_data_param_t bulkdata; + CsrResult csrResult; + struct sk_buff *skb, *newSkb = NULL; + CsrInt8 protection; + int r; + static const CsrUint8 arp_req[36] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, + 0x08, 0x06, 0x00, 0x01, 0x08, 0x00, 0x06, 0x04, 0x00, 0x01, + 0x00, 0x02, 0x5f, 0x20, 0x2f, 0x02, + 0xc0, 0xa8, 0x00, 0x02, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xc0, 0xa8, 0x00, 0x02}; + + func_enter(); + + csrResult = unifi_net_data_malloc(priv, &bulkdata.d[0], sizeof(arp_req)); + if (csrResult != CSR_RESULT_SUCCESS) + { + unifi_error(priv, "Failed to allocate bulk data in CsrWifiSmeRoamCompleteIndHandler()\n"); + return; + } + skb = (struct sk_buff *)(bulkdata.d[0].os_net_buf_ptr); + skb->len = bulkdata.d[0].data_length; + + memcpy(skb->data, arp_req, sizeof(arp_req)); + /* add MAC and IP address */ + memcpy(skb->data + 16, priv->netdev[interfaceTag]->dev_addr, ETH_ALEN); + skb->data[22] = (priv->sta_ip_address ) & 0xFF; + skb->data[23] = (priv->sta_ip_address >> 8) & 0xFF; + skb->data[24] = (priv->sta_ip_address >> 16) & 0xFF; + skb->data[25] = (priv->sta_ip_address >> 24) & 0xFF; + skb->data[32] = (priv->sta_ip_address ) & 0xFF; + skb->data[33] = (priv->sta_ip_address >> 8) & 0xFF; + skb->data[34] = (priv->sta_ip_address >> 16) & 0xFF; + skb->data[35] = (priv->sta_ip_address >> 24) & 0xFF; + + bulkdata.d[1].os_data_ptr = NULL; + bulkdata.d[1].os_net_buf_ptr = NULL; + bulkdata.d[1].net_buf_length = bulkdata.d[1].data_length = 0; + + if ((protection = uf_get_protection_bit_from_interfacemode(priv, interfaceTag, &arp_req[26])) < 0) + { + unifi_error(priv, "CsrWifiSmeRoamCompleteIndHandler: Failed to determine protection mode\n"); + unifi_net_data_free(priv, &bulkdata.d[0]); + return; + } + + if ((priv->sta_wmm_capabilities & QOS_CAPABILITY_WMM_ENABLED) == 1) + { + priority = CSR_QOS_UP0; + } + else + { + priority = CSR_CONTENTION; + } + + if (prepare_and_add_macheader(priv, skb, newSkb, priority, &bulkdata, + interfaceTag, &arp_req[26], + priv->netdev[interfaceTag]->dev_addr, protection)) + { + unifi_error(priv, "CsrWifiSmeRoamCompleteIndHandler: failed to create MAC header\n"); + unifi_net_data_free(priv, &bulkdata.d[0]); + return; + } + bulkdata.d[0].os_data_ptr = skb->data; + bulkdata.d[0].os_net_buf_ptr = skb; + bulkdata.d[0].data_length = skb->len; + + unifi_frame_ma_packet_req(priv, priority, 0, 0xffffffff, interfaceTag, + CSR_NO_CONFIRM_REQUIRED, priv->netdev_client->sender_id, + interfacePriv->bssid.a, &signal); + + r = ul_send_signal_unpacked(priv, &signal, &bulkdata); + if (r) + { + unifi_error(priv, "CsrWifiSmeRoamCompleteIndHandler: failed to send QOS data null packet result: %d\n",r); + unifi_net_data_free(priv, &bulkdata.d[0]); + return; + } + + func_exit(); + +} +#endif /* CSR_WIFI_SEND_GRATUITOUS_ARP */ + +/* + * --------------------------------------------------------------------------- + * configure_data_port + * + * Store the new controlled port configuration. + * + * Arguments: + * priv Pointer to device private context struct + * port_cfg Pointer to the port configuration + * + * Returns: + * An unifi_ControlledPortAction value. + * --------------------------------------------------------------------------- + */ +static int +configure_data_port(unifi_priv_t *priv, + CsrWifiRouterCtrlPortAction port_action, + const CsrWifiMacAddress *macAddress, + const int queue, + CsrUint16 interfaceTag) +{ + const CsrUint8 broadcast_mac_address[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; + unifi_port_config_t *port; + netInterface_priv_t *interfacePriv; + int i; + const char* controlled_string; /* cosmetic "controlled"/"uncontrolled" for trace */ + + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "configure_data_port: bad interfaceTag\n"); + return -EFAULT; + } + + interfacePriv = priv->interfacePriv[interfaceTag]; + + if (queue == UF_CONTROLLED_PORT_Q) { + port = &interfacePriv->controlled_data_port; + controlled_string = "controlled"; + } else { + port = &interfacePriv->uncontrolled_data_port; + controlled_string = "uncontrolled"; + } + + unifi_trace(priv, UDBG2, "port config request %02x:%02x:%02x:%02x:%02x:%02x %s with port_action %d.\n", + macAddress->a[0], macAddress->a[1], macAddress->a[2], + macAddress->a[3], macAddress->a[4], macAddress->a[5], + controlled_string, port_action); + + + /* If the new configuration has the broadcast MAC address or if we are in infrastructure mode then clear the list first and set port overide mode */ + if ((CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI) || + !memcmp(macAddress->a, broadcast_mac_address, ETH_ALEN)) { + + port->port_cfg[0].port_action = port_action; + port->port_cfg[0].mac_address = *macAddress; + port->port_cfg[0].in_use = TRUE; + port->entries_in_use = 1; + port->overide_action = UF_DATA_PORT_OVERIDE; + + unifi_trace(priv, UDBG2, "%s port override on\n", + (queue == UF_CONTROLLED_PORT_Q) ? "Controlled" : "Uncontrolled"); + + /* Discard the remaining entries in the port config table */ + for (i = 1; i < UNIFI_MAX_CONNECTIONS; i++) { + port->port_cfg[i].in_use = FALSE; + } + + if (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN) { + unifi_trace(priv, UDBG1, "%s port broadcast set to open.\n", + (queue == UF_CONTROLLED_PORT_Q) ? "Controlled" : "Uncontrolled"); + + /* + * Ask stack to schedule for transmission any packets queued + * while controlled port was not open. + * Use netif_schedule() instead of netif_wake_queue() because + * transmission should be already enabled at this point. If it + * is not, probably the interface is down and should remain as is. + */ + uf_resume_data_plane(priv, queue, *macAddress, interfaceTag); + +#ifdef CSR_WIFI_SEND_GRATUITOUS_ARP + if ((CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) && + (queue == UF_CONTROLLED_PORT_Q) && (priv->sta_ip_address != 0xFFFFFFFF)) + { + uf_send_gratuitous_arp(priv, interfaceTag); + } +#endif + } else { + unifi_trace(priv, UDBG1, "%s port broadcast set to %s.\n", + (queue == UF_CONTROLLED_PORT_Q) ? "Controlled" : "Uncontrolled", + (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD) ? "discard": "closed"); + + /* If port is closed, discard all the pending Rx packets */ + if (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD) { + uf_free_pending_rx_packets(priv, queue, *macAddress,interfaceTag); + } + } + } else { + /* store the new configuration, either in the entry with matching mac address (if already present), + * otherwise in a new entry + */ + + int found_entry_flag; + int first_free_slot = -1; + + /* If leaving override mode, free the port entry used for override */ + if (port->overide_action == UF_DATA_PORT_OVERIDE) { + port->port_cfg[0].in_use = FALSE; + port->entries_in_use = 0; + port->overide_action = UF_DATA_PORT_NOT_OVERIDE; + + unifi_trace(priv, UDBG2, "%s port override off\n", + (queue == UF_CONTROLLED_PORT_Q) ? "Controlled" : "Uncontrolled"); + } + + found_entry_flag = 0; + for (i = 0; i < UNIFI_MAX_CONNECTIONS; i++) { + if (port->port_cfg[i].in_use) { + if (!memcmp(&port->port_cfg[i].mac_address.a, macAddress->a, ETH_ALEN)) { + /* We've seen this address before, reconfigure it */ + port->port_cfg[i].port_action = port_action; + found_entry_flag = 1; + break; + } + } else if (first_free_slot == -1) { + /* Remember the first free slot on the way past so it can be claimed + * if this turns out to be a new MAC address (to save walking the list again). + */ + first_free_slot = i; + } + } + + /* At this point we found an existing entry and have updated it, or need to + * add a new entry. If all slots are allocated, give up and return an error. + */ + if (!found_entry_flag) { + if (first_free_slot == -1) { + unifi_error(priv, "no free slot found in port config array (%d used)\n", port->entries_in_use); + return -EFAULT; + } else { + port->entries_in_use++; + } + + unifi_trace(priv, UDBG3, "port config index assigned in config_data_port = %d\n", first_free_slot); + port->port_cfg[first_free_slot].in_use = TRUE; + port->port_cfg[first_free_slot].port_action = port_action; + port->port_cfg[first_free_slot].mac_address = *macAddress; + } + + if (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN) { + /* + * Ask stack to schedule for transmission any packets queued + * while controlled port was not open. + * Use netif_schedule() instead of netif_wake_queue() because + * transmission should be already enabled at this point. If it + * is not, probably the interface is down and should remain as is. + */ + uf_resume_data_plane(priv, queue, *macAddress, interfaceTag); + } + + /* + * If port is closed, discard all the pending Rx packets + * coming from the peer station. + */ + if (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD) { + uf_free_pending_rx_packets(priv, queue, *macAddress,interfaceTag); + } + + unifi_trace(priv, UDBG2, "port config %02x:%02x:%02x:%02x:%02x:%02x with port_action %d.\n", + *(macAddress->a+0), *(macAddress->a+1), *(macAddress->a+2), + *(macAddress->a+3), *(macAddress->a+4), *(macAddress->a+5), + port_action); + } + return 0; +} /* configure_data_port() */ + + +void CsrWifiRouterCtrlPortConfigureReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterCtrlPortConfigureReq* req = (CsrWifiRouterCtrlPortConfigureReq*)msg; + netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; + + unifi_trace(priv, UDBG3, "entering CsrWifiRouterCtrlPortConfigureReqHandler\n"); + if (priv->smepriv == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlPortConfigureReqHandler: invalid smepriv\n"); + return; + } + + /* To update the protection status of the peer/station */ + switch(interfacePriv->interfaceMode) + { + case CSR_WIFI_ROUTER_CTRL_MODE_STA: + case CSR_WIFI_ROUTER_CTRL_MODE_AMP: + case CSR_WIFI_ROUTER_CTRL_MODE_IBSS: + case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI: + /* Since for Unifi as a station, the station record not maintained & interfaceID is + * only needed to update the peer protection status + */ + interfacePriv->protect = req->setProtection; + break; + case CSR_WIFI_ROUTER_CTRL_MODE_AP: + case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: + { + CsrUint8 i; + CsrWifiRouterCtrlStaInfo_t *staRecord; + /* Ifscontrolled port is open means, The peer has been added to station record + * so that the protection corresponding to the peer is valid in this req + */ + if (req->controlledPortAction == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN) { + for(i =0; i < UNIFI_MAX_CONNECTIONS; i++) { + staRecord = (CsrWifiRouterCtrlStaInfo_t *) (interfacePriv->staInfo[i]); + if (staRecord) { + /* Find the matching station record & set the protection type */ + if (!memcmp(req->macAddress.a, staRecord->peerMacAddress.a, ETH_ALEN)) { + staRecord->protection = req->setProtection; + break; + } + } + } + } + } + break; + default: + unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlPortConfigureReqHandler(0x%.4X) Uncaught mode %d\n", + msg->source, interfacePriv->interfaceMode); + } + + configure_data_port(priv, req->uncontrolledPortAction, (const CsrWifiMacAddress *)&req->macAddress, + UF_UNCONTROLLED_PORT_Q, req->interfaceTag); + configure_data_port(priv, req->controlledPortAction, (const CsrWifiMacAddress *)&req->macAddress, + UF_CONTROLLED_PORT_Q, req->interfaceTag); + + CsrWifiRouterCtrlPortConfigureCfmSend(msg->source,req->clientData,req->interfaceTag, + CSR_RESULT_SUCCESS, req->macAddress); + unifi_trace(priv, UDBG3, "leaving CsrWifiRouterCtrlPortConfigureReqHandler\n"); +} + + +void CsrWifiRouterCtrlWifiOnReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterCtrlVersions versions; + CsrWifiRouterCtrlWifiOnReq* req = (CsrWifiRouterCtrlWifiOnReq*)msg; + int r,i; + CsrResult csrResult; + + if (priv == NULL) { + return; + } + for (i=0; iinterfacePriv[i]->interfaceMode = 0; + } + unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWifiOnReqHandler(0x%.4X)\n", msg->source); + + /* + * The request to initialise UniFi might come while UniFi is running. + * We need to block all I/O activity until the reset completes, otherwise + * an SDIO error might occur resulting an indication to the SME which + * makes it think that the initialisation has failed. + */ + priv->bh_thread.block_thread = 1; + + /* Update the wifi_on state */ + priv->wifi_on_state = wifi_on_in_progress; + + r = uf_request_firmware_files(priv, UNIFI_FW_STA); + if (r) { + unifi_error(priv, "CsrWifiRouterCtrlWifiOnReqHandler: Failed to get f/w\n"); + CsrWifiRouterCtrlWifiOnCfmSend(msg->source, req->clientData, CSR_RESULT_FAILURE); + return; + } + + /* Power on UniFi (which may not necessarily have been off) */ + CsrSdioClaim(priv->sdio); + csrResult = CsrSdioPowerOn(priv->sdio); + CsrSdioRelease(priv->sdio); + if (csrResult != CSR_RESULT_SUCCESS && csrResult != CSR_SDIO_RESULT_NOT_RESET) { + unifi_error(priv, "CsrWifiRouterCtrlWifiOnReqHandler: Failed to power on UniFi\n"); + CsrWifiRouterCtrlWifiOnCfmSend(msg->source, req->clientData, CSR_RESULT_FAILURE); + return; + } + + /* If CsrSdioPowerOn() returns CSR_RESULT_SUCCESS, it means that we need to initialise UniFi */ + if (csrResult == CSR_RESULT_SUCCESS && !priv->wol_suspend) { + /* Initialise UniFi hardware */ + r = uf_init_hw(priv); + if (r) { + unifi_error(priv, "CsrWifiRouterCtrlWifiOnReqHandler: Failed to initialise h/w, error %d\n", r); + CsrWifiRouterCtrlWifiOnCfmSend(msg->source, req->clientData, CSR_RESULT_FAILURE); + return; + } + } else { + unifi_trace(priv, UDBG1, "UniFi already initialised\n"); + } + + /* Completed handling of wake up from suspend with UniFi powered */ + priv->wol_suspend = FALSE; + + /* Re-enable the I/O thread */ + priv->bh_thread.block_thread = 0; + + /* + * Start the I/O thread. The thread might be already running. + * This fine, just carry on with the request. + */ + r = uf_init_bh(priv); + if (r) { + CsrSdioClaim(priv->sdio); + CsrSdioPowerOff(priv->sdio); + CsrSdioRelease(priv->sdio); + CsrWifiRouterCtrlWifiOnCfmSend(msg->source, req->clientData, CSR_RESULT_FAILURE); + return; + } + + /* Get the version information from the core */ + unifi_card_info(priv->card, &priv->card_info); + + /* Set the sme queue id */ + priv->CSR_WIFI_SME_IFACEQUEUE = msg->source; + CSR_WIFI_SME_IFACEQUEUE = msg->source; + + + /* Copy to the unifiio_card_info structure. */ + versions.chipId = priv->card_info.chip_id; + versions.chipVersion = priv->card_info.chip_version; + versions.firmwareBuild = priv->card_info.fw_build; + versions.firmwareHip = priv->card_info.fw_hip_version; + versions.routerBuild = (CsrCharString*)CSR_WIFI_VERSION; + versions.routerHip = (UNIFI_HIP_MAJOR_VERSION << 8) | UNIFI_HIP_MINOR_VERSION; + + CsrWifiRouterCtrlWifiOnIndSend(msg->source, 0, CSR_RESULT_SUCCESS, versions); + + /* Update the wifi_on state */ + priv->wifi_on_state = wifi_on_done; +} + + +/* + * wifi_off: + * Common code for CsrWifiRouterCtrlWifiOffReqHandler() and + * CsrWifiRouterCtrlWifiOffRspHandler(). + */ +static void +wifi_off(unifi_priv_t *priv) +{ + int power_off; + int priv_instance; + int i; + CsrResult csrResult; + + unifi_trace(priv, UDBG1, "wifi_off\n"); + + /* Destroy the Traffic Analysis Module */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) + cancel_work_sync(&priv->ta_ind_work.task); + cancel_work_sync(&priv->ta_sample_ind_work.task); +#ifdef CSR_SUPPORT_WEXT + cancel_work_sync(&priv->sme_config_task); +#endif + + /* Cancel pending M4 stuff */ + for (i = 0; i < CSR_WIFI_NUM_INTERFACES; i++) { + if (priv->netdev[i]) { + netInterface_priv_t *netpriv = (netInterface_priv_t *) netdev_priv(priv->netdev[i]); + cancel_work_sync(&netpriv->send_m4_ready_task); + } + } +#endif + flush_workqueue(priv->unifi_workqueue); + + /* fw_init parameter can prevent power off UniFi, for debugging */ + priv_instance = uf_find_priv(priv); + if (priv_instance == -1) { + unifi_warning(priv, + "CsrWifiRouterCtrlStopReqHandler: Unknown priv instance, will power off card.\n"); + power_off = 1; + } else { + power_off = (fw_init[priv_instance] > 0) ? 0 : 1; + } + + /* Production test mode requires power to the chip, too */ + if (priv->ptest_mode) { + power_off = 0; + } + + /* Stop the bh_thread */ + uf_stop_thread(priv, &priv->bh_thread); + + /* Read the f/w panic codes, if any. Protect against second wifi_off() call, + * which may happen if SME requests a wifi_off and closes the char device */ + if (priv->init_progress != UNIFI_INIT_NONE) { + CsrSdioClaim(priv->sdio); + unifi_capture_panic(priv->card); + CsrSdioRelease(priv->sdio); + } + + /* Unregister the interrupt handler */ + if (csr_sdio_linux_remove_irq(priv->sdio)) { + unifi_notice(priv, + "csr_sdio_linux_remove_irq failed to talk to card.\n"); + } + + if (power_off) { + unifi_trace(priv, UDBG2, + "Force low power and try to power off\n"); + /* Put UniFi to deep sleep, in case we can not power it off */ + CsrSdioClaim(priv->sdio); + csrResult = unifi_force_low_power_mode(priv->card); + CsrSdioRelease(priv->sdio); + + CsrSdioPowerOff(priv->sdio); + } + + /* Consider UniFi to be uninitialised */ + priv->init_progress = UNIFI_INIT_NONE; + priv->wifi_on_state = wifi_on_unspecified; + + +} /* wifi_off() */ + + +void CsrWifiRouterCtrlWifiOffReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterCtrlWifiOffReq* req = (CsrWifiRouterCtrlWifiOffReq*)msg; + int i = 0; +#ifdef CSR_SUPPORT_WEXT_AP + CsrWifiSmeWifiOffCfm cfm; +#endif + + if (priv == NULL) { + return; + } + + unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWifiOffReqHandler(0x%.4X)\n", msg->source); + + /* Stop the network traffic on all interfaces before freeing the core. */ + for (i=0; iinterfacePriv[i]; + if (interfacePriv->netdev_registered == 1) { + netif_carrier_off(priv->netdev[i]); + UF_NETIF_TX_STOP_ALL_QUEUES(priv->netdev[i]); + } + interfacePriv->interfaceMode = 0; + + /* Enable all queues by default */ + interfacePriv->queueEnabled[0] = 1; + interfacePriv->queueEnabled[1] = 1; + interfacePriv->queueEnabled[2] = 1; + interfacePriv->queueEnabled[3] = 1; + } + wifi_off(priv); + + CsrWifiRouterCtrlWifiOffCfmSend(msg->source,req->clientData); +#ifdef CSR_SUPPORT_WEXT_AP + /* Router is turned off when WifiOffCfm is received + * hence for wext we don't see WifiOffCfm in the wext + * files. So just tell the waiting process that + * Wifi off is successful + */ + cfm.status = CSR_RESULT_SUCCESS; + CsrWifiSmeWifiOffCfmHandler(priv,(CsrWifiFsmEvent*)(&cfm)); +#endif +} + + +void CsrWifiRouterCtrlQosControlReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterCtrlQosControlReq* req = (CsrWifiRouterCtrlQosControlReq*)msg; + netInterface_priv_t *interfacePriv; + + if (priv->smepriv == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlQosControlReqHandler: invalid smepriv\n"); + return; + } + + unifi_trace(priv, UDBG4, "CsrWifiRouterCtrlQosControlReqHandler:scontrol = %d", req->control); + + if (req->interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "CsrWifiRouterCtrlQosControlReqHandler: interfaceID >= CSR_WIFI_NUM_INTERFACES.\n"); + return; + } + interfacePriv = priv->interfacePriv[req->interfaceTag]; + + if (req->control == CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_WMM_ON) { + priv->sta_wmm_capabilities |= QOS_CAPABILITY_WMM_ENABLED; + unifi_trace(priv, UDBG1, "WMM enabled\n"); + + unifi_trace(priv, UDBG1, "Queue Config %x\n", req->queueConfig); + + interfacePriv->queueEnabled[UNIFI_TRAFFIC_Q_BK] = (req->queueConfig & CSR_WIFI_ROUTER_CTRL_QUEUE_BK_ENABLE)?1:0; + interfacePriv->queueEnabled[UNIFI_TRAFFIC_Q_BE] = (req->queueConfig & CSR_WIFI_ROUTER_CTRL_QUEUE_BE_ENABLE)?1:0; + interfacePriv->queueEnabled[UNIFI_TRAFFIC_Q_VI] = (req->queueConfig & CSR_WIFI_ROUTER_CTRL_QUEUE_VI_ENABLE)?1:0; + interfacePriv->queueEnabled[UNIFI_TRAFFIC_Q_VO] = (req->queueConfig & CSR_WIFI_ROUTER_CTRL_QUEUE_VO_ENABLE)?1:0; + + } else { + priv->sta_wmm_capabilities = 0; + unifi_trace(priv, UDBG1, "WMM disabled\n"); + } +} + + +void CsrWifiRouterCtrlTclasAddReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterCtrlTclasAddReq* req = (CsrWifiRouterCtrlTclasAddReq*)msg; + + if (priv == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlTclasAddReqHandler: invalid smepriv\n"); + return; + } + + CsrWifiRouterCtrlTclasAddCfmSend(msg->source, req->clientData, req->interfaceTag , CSR_RESULT_SUCCESS); +} + +void CsrWifiRouterCtrlTclasDelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterCtrlTclasDelReq* req = (CsrWifiRouterCtrlTclasDelReq*)msg; + + if (priv == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlTclasDelReqHandler: invalid smepriv\n"); + return; + } + + CsrWifiRouterCtrlTclasDelCfmSend(msg->source, req->clientData, req->interfaceTag, CSR_RESULT_SUCCESS); +} + + +void CsrWifiRouterCtrlConfigurePowerModeReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterCtrlConfigurePowerModeReq* req = (CsrWifiRouterCtrlConfigurePowerModeReq*)msg; + enum unifi_low_power_mode pm; + CsrResult csrResult; + + if (priv->smepriv == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlConfigurePowerModeReqHandler: invalid smepriv\n"); + return; + } + + if (req->mode == CSR_WIFI_ROUTER_CTRL_LOW_POWER_MODE_DISABLED) { + pm = UNIFI_LOW_POWER_DISABLED; + } else { + pm = UNIFI_LOW_POWER_ENABLED; + } + + unifi_trace(priv, UDBG2, + "CsrWifiRouterCtrlConfigurePowerModeReqHandler (mode=%d, wake=%d)\n", + req->mode, req->wakeHost); + csrResult = unifi_configure_low_power_mode(priv->card, pm, + (req->wakeHost ? UNIFI_PERIODIC_WAKE_HOST_ENABLED : UNIFI_PERIODIC_WAKE_HOST_DISABLED)); +} + + +void CsrWifiRouterCtrlWifiOnResHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterCtrlWifiOnRes* res = (CsrWifiRouterCtrlWifiOnRes*)msg; + + if (priv == NULL) { + unifi_error(NULL, "CsrWifiRouterCtrlWifiOnResHandler: Invalid ospriv.\n"); + return; + } + + unifi_trace(priv, UDBG1, + "CsrWifiRouterCtrlWifiOnResHandler: status %d (patch %u)\n", res->status, res->smeVersions.firmwarePatch); + + if (res->smeVersions.firmwarePatch != 0) { + unifi_info(priv, "Firmware patch %d\n", res->smeVersions.firmwarePatch); + } + + if (res->numInterfaceAddress > CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "WifiOnResHandler bad numInterfaceAddress %d\n", res->numInterfaceAddress); + return; + } + + /* UniFi is now initialised, complete the init. */ + if (res->status == CSR_RESULT_SUCCESS) + { + int i; /* used as a loop counter */ + CsrUint32 intmode = CSR_WIFI_INTMODE_DEFAULT; + + /* Register the UniFi device with the OS network manager */ + unifi_trace(priv, UDBG3, "Card Init Completed Successfully\n"); + + /* Store the MAC address in the netdev */ + for(i=0;inumInterfaceAddress;i++) + { + memcpy(priv->netdev[i]->dev_addr, res->stationMacAddress[i].a, ETH_ALEN); + } + + /* Copy version structure into the private versions field */ + priv->sme_versions = res->smeVersions; + + unifi_trace(priv, UDBG2, "network interfaces count = %d\n", + res->numInterfaceAddress); + + /* Register the netdevs for each interface. */ + for(i=0;inumInterfaceAddress;i++) + { + netInterface_priv_t *interfacePriv = priv->interfacePriv[i]; + if(!interfacePriv->netdev_registered) + { + int r; + unifi_trace(priv, UDBG3, "registering net device %d\n", i); + r = uf_register_netdev(priv, i); + if (r) + { + /* unregister the net_device that are registered in the previous iterations */ + uf_unregister_netdev(priv); + unifi_error(priv, "Failed to register the network device.\n"); + CsrWifiRouterCtrlWifiOnCfmSend(msg->source, res->clientData, CSR_RESULT_FAILURE); + return; + } + } + } + priv->totalInterfaceCount = res->numInterfaceAddress; + + /* If the MIB has selected f/w scheduled interrupt mode, apply it now + * but let module param override. + */ + if (run_bh_once != -1) { + intmode = (CsrUint32)run_bh_once; + } else if (res->scheduledInterrupt) { + intmode = CSR_WIFI_INTMODE_RUN_BH_ONCE; + } + unifi_set_interrupt_mode(priv->card, intmode); + + priv->init_progress = UNIFI_INIT_COMPLETED; + + /* Acknowledge the CsrWifiRouterCtrlWifiOnReq now */ + CsrWifiRouterCtrlWifiOnCfmSend(msg->source, res->clientData, CSR_RESULT_SUCCESS); + + unifi_info(priv, "UniFi ready\n"); + + /* Firmware initialisation is complete, so let the SDIO bus + * clock be raised when convienent to the core. + */ + unifi_request_max_sdio_clock(priv->card); + +#ifdef CSR_SUPPORT_WEXT + /* Notify the Android wpa_supplicant that we are ready */ + wext_send_started_event(priv); + + queue_work(priv->unifi_workqueue, &priv->sme_config_task); +#endif + + } else { + /* Acknowledge the CsrWifiRouterCtrlWifiOnReq now */ + CsrWifiRouterCtrlWifiOnCfmSend(msg->source, res->clientData, CSR_RESULT_FAILURE); + } +} + + +void CsrWifiRouterCtrlWifiOffResHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + + +void CsrWifiRouterCtrlMulticastAddressResHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + + +void CsrWifiRouterMaPacketSubscribeReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterMaPacketSubscribeReq* req = (CsrWifiRouterMaPacketSubscribeReq*)msg; + CsrUint8 i; + CsrResult result; + + if (priv == NULL) { + unifi_error(priv, "CsrWifiRouterMaPacketSubscribeReqHandler: invalid priv\n"); + return; + } + + /* Look for an unused filter */ + + result = CSR_WIFI_RESULT_NO_ROOM; + for (i = 0; i < MAX_MA_UNIDATA_IND_FILTERS; i++) { + + if (!priv->sme_unidata_ind_filters[i].in_use) { + + priv->sme_unidata_ind_filters[i].in_use = 1; + priv->sme_unidata_ind_filters[i].appHandle = msg->source; + priv->sme_unidata_ind_filters[i].encapsulation = req->encapsulation; + priv->sme_unidata_ind_filters[i].protocol = req->protocol; + + priv->sme_unidata_ind_filters[i].oui[2] = (CsrUint8) (req->oui & 0xFF); + priv->sme_unidata_ind_filters[i].oui[1] = (CsrUint8) ((req->oui >> 8) & 0xFF); + priv->sme_unidata_ind_filters[i].oui[0] = (CsrUint8) ((req->oui >> 16) & 0xFF); + + result = CSR_RESULT_SUCCESS; + break; + } + } + + unifi_trace(priv, UDBG1, + "subscribe_req: encap=%d, handle=%d, result=%d\n", + req->encapsulation, i, result); + CsrWifiRouterMaPacketSubscribeCfmSend(msg->source,req->interfaceTag, i, result, 0); +} + + +void CsrWifiRouterMaPacketUnsubscribeReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterMaPacketUnsubscribeReq* req = (CsrWifiRouterMaPacketUnsubscribeReq*)msg; + CsrResult result; + + if (priv == NULL) { + unifi_error(priv, "CsrWifiRouterMaPacketUnsubscribeReqHandler: invalid priv\n"); + return; + } + + result = CSR_WIFI_RESULT_NOT_FOUND; + + if (req->subscriptionHandle < MAX_MA_UNIDATA_IND_FILTERS) { + if (priv->sme_unidata_ind_filters[req->subscriptionHandle].in_use) { + priv->sme_unidata_ind_filters[req->subscriptionHandle].in_use = 0; + result = CSR_RESULT_SUCCESS; + } else { + result = CSR_WIFI_RESULT_NOT_FOUND; + } + } + + unifi_trace(priv, UDBG1, + "unsubscribe_req: handle=%d, result=%d\n", + req->subscriptionHandle, result); + CsrWifiRouterMaPacketUnsubscribeCfmSend(msg->source,req->interfaceTag, result); +} + + +void CsrWifiRouterCtrlCapabilitiesReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterCtrlCapabilitiesReq* req = (CsrWifiRouterCtrlCapabilitiesReq*)msg; + + if (priv == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlCapabilitiesReqHandler: invalid priv\n"); + return; + } + + CsrWifiRouterCtrlCapabilitiesCfmSend(msg->source,req->clientData, + UNIFI_SOFT_COMMAND_Q_LENGTH - 1, + UNIFI_SOFT_TRAFFIC_Q_LENGTH - 1); +} + + +void CsrWifiRouterCtrlSuspendResHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterCtrlSuspendRes* res = (CsrWifiRouterCtrlSuspendRes*)msg; + + if (priv == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlSuspendResHandler: invalid priv\n"); + return; + } + + sme_complete_request(priv, res->status); +} + + +void CsrWifiRouterCtrlResumeResHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterCtrlResumeRes* res = (CsrWifiRouterCtrlResumeRes*)msg; + + if (priv == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlResumeResHandler: invalid priv\n"); + return; + } + + /* + * Unless we are in ptest mode, nothing is waiting for the response. + * Do not call sme_complete_request(), otherwise the driver + * and the SME will be out of step. + */ + if (priv->ptest_mode == 1) { + sme_complete_request(priv, res->status); + } + +} + + +void CsrWifiRouterCtrlTrafficConfigReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterCtrlTrafficConfigReq* req = (CsrWifiRouterCtrlTrafficConfigReq*)msg; + CsrResult csrResult; + + if (priv == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlTrafficConfigReqHandler: invalid smepriv\n"); + return; + } + if (req->trafficConfigType == CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_FILTER) + { + req->config.packetFilter |= CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM; + } + csrResult = unifi_ta_configure(priv->card, req->trafficConfigType, (const CsrWifiRouterCtrlTrafficConfig *)&req->config); +} + +void CsrWifiRouterCtrlTrafficClassificationReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterCtrlTrafficClassificationReq* req = (CsrWifiRouterCtrlTrafficClassificationReq*)msg; + + if (priv == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlTrafficClassificationReqHandler: invalid smepriv\n"); + return; + } + + unifi_ta_classification(priv->card, req->trafficType, req->period); +} + +static int +_sys_packet_req(unifi_priv_t *priv, const CSR_SIGNAL *signal, + CsrUint8 subscriptionHandle, + CsrUint16 frameLength, CsrUint8 *frame, + int proto) +{ + int r; + const sme_ma_unidata_ind_filter_t *subs; + bulk_data_param_t bulkdata; + CSR_MA_PACKET_REQUEST req = signal->u.MaPacketRequest; + struct sk_buff *skb, *newSkb = NULL; + CsrWifiMacAddress peerMacAddress; + CsrResult csrResult; + CsrUint16 interfaceTag = req.VirtualInterfaceIdentifier & 0xff; + CsrBool eapolStore = FALSE; + CsrInt8 protection = 0; + netInterface_priv_t *interfacePriv; + unsigned long flags; + + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "_sys_packet_req: interfaceID >= CSR_WIFI_NUM_INTERFACES.\n"); + return -EINVAL; + } + interfacePriv = priv->interfacePriv[interfaceTag]; + if (!priv->sme_unidata_ind_filters[subscriptionHandle].in_use) { + unifi_error(priv, "_sys_packet_req: unknown subscription.\n"); + return -EINVAL; + } + + subs = &priv->sme_unidata_ind_filters[subscriptionHandle]; + unifi_trace(priv, UDBG1, + "_sys_packet_req: handle=%d, subs=%p, encap=%d\n", + subscriptionHandle, subs, subs->encapsulation); + + csrResult = unifi_net_data_malloc(priv, &bulkdata.d[0], frameLength); + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, "_sys_packet_req: failed to allocate bulkdata.\n"); + return (int)CsrHipResultToStatus(csrResult); + } + + /* get the peer Mac address */ + memcpy(&peerMacAddress, frame, ETH_ALEN); + + /* Determine if we need to add encapsulation header */ + if (subs->encapsulation == CSR_WIFI_ROUTER_ENCAPSULATION_ETHERNET) { + memcpy((void*)bulkdata.d[0].os_data_ptr, frame, frameLength); + + /* The translation is performed on the skb */ + skb = (struct sk_buff*)bulkdata.d[0].os_net_buf_ptr; + + unifi_trace(priv, UDBG1, + "_sys_packet_req: skb_add_llc_snap -->\n"); + r = skb_add_llc_snap(priv->netdev[interfaceTag], skb, proto); + unifi_trace(priv, UDBG1, + "_sys_packet_req: skb_add_llc_snap <--\n"); + if (r) { + unifi_error(priv, + "_sys_packet_req: failed to translate eth frame.\n"); + unifi_net_data_free(priv,&bulkdata.d[0]); + return r; + } + + bulkdata.d[0].data_length = skb->len; + } else { + /* Crop the MAC addresses from the packet */ + memcpy((void*)bulkdata.d[0].os_data_ptr, frame + 2*ETH_ALEN, frameLength - 2*ETH_ALEN); + bulkdata.d[0].data_length = frameLength - 2*ETH_ALEN; + skb = (struct sk_buff*)bulkdata.d[0].os_net_buf_ptr; + skb->len = bulkdata.d[0].data_length; + + } + + bulkdata.d[1].os_data_ptr = NULL; + bulkdata.d[1].os_net_buf_ptr = NULL; + bulkdata.d[1].data_length = 0; + + /* check for m4 detection */ + if (0 == uf_verify_m4(priv, bulkdata.d[0].os_data_ptr, bulkdata.d[0].data_length)) { + eapolStore = TRUE; + } + +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + if (proto == ETH_P_WAI) + { + protection = 0; /*WAI packets always sent unencrypted*/ + } + else + { +#endif + +#ifdef CSR_SUPPORT_SME + if ((protection = uf_get_protection_bit_from_interfacemode(priv, interfaceTag, peerMacAddress.a)) < 0) { + unifi_error(priv, "unicast address, but destination not in station record database\n"); + unifi_net_data_free(priv,&bulkdata.d[0]); + return -1; + } +#else + protection = 0; +#endif + +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + } +#endif + + /* add Mac header */ + if (prepare_and_add_macheader(priv, skb, newSkb, req.Priority, &bulkdata, interfaceTag, frame, frame + ETH_ALEN, protection)) { + unifi_error(priv, "failed to create MAC header\n"); + unifi_net_data_free(priv,&bulkdata.d[0]); + return -1; + } + + if (eapolStore) { + spin_lock_irqsave(&priv->m4_lock, flags); + /* Store the EAPOL M4 packet for later */ + interfacePriv->m4_signal = *signal; + interfacePriv->m4_bulk_data.net_buf_length = bulkdata.d[0].net_buf_length; + interfacePriv->m4_bulk_data.data_length = bulkdata.d[0].data_length; + interfacePriv->m4_bulk_data.os_data_ptr = bulkdata.d[0].os_data_ptr; + interfacePriv->m4_bulk_data.os_net_buf_ptr = bulkdata.d[0].os_net_buf_ptr; + spin_unlock_irqrestore(&priv->m4_lock, flags); + /* Send a signal to SME */ + unifi_trace(priv, UDBG1, "_sys_packet_req: Sending CsrWifiRouterCtrlM4ReadyToSendInd\n"); + CsrWifiRouterCtrlM4ReadyToSendIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, peerMacAddress); + return 0; + } + + /* Send the signal to UniFi */ + /* Set the B31 to 1 for local routing*/ + r= uf_process_ma_packet_req(priv, peerMacAddress.a, (req.HostTag | 0x80000000), interfaceTag, 0, + (CSR_RATE)0, req.Priority, signal->SignalPrimitiveHeader.SenderProcessId, &bulkdata); + if (r) { + unifi_error(priv, + "_sys_packet_req: failed to send signal.\n"); + unifi_net_data_free(priv,&bulkdata.d[0]); + return r; + } + /* The final CsrWifiRouterMaPacketCfmSend() will called when the actual MA-PACKET.cfm is received from the chip */ + + return 0; +} + +void CsrWifiRouterMaPacketReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + int r; + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterMaPacketReq* mareq = (CsrWifiRouterMaPacketReq*)msg; + llc_snap_hdr_t *snap; + CsrUint16 snap_protocol; + CSR_SIGNAL signal; + CSR_MA_PACKET_REQUEST *req = &signal.u.MaPacketRequest; + CsrWifiRouterCtrlPortAction controlPortaction; + CsrUint8 *daddr, *saddr; + CsrUint16 interfaceTag = mareq->interfaceTag & 0x00ff; + int queue; + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + + if (!mareq->frame || !priv || !priv->smepriv) + { + unifi_error(priv, "CsrWifiRouterMaPacketReqHandler: invalid frame/priv/priv->smepriv\n"); + return; + } + + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "CsrWifiRouterMaPacketReqHandler: interfaceID >= CSR_WIFI_NUM_INTERFACES.\n"); + return; + } + /* get a pointer to dest & source Mac address */ + daddr = mareq->frame; + saddr = (mareq->frame + ETH_ALEN); + /* point to the proper position of frame, since frame has MAC header */ + snap = (llc_snap_hdr_t *) (mareq->frame + 2 * ETH_ALEN); + snap_protocol = ntohs(snap->protocol); + if((snap_protocol == ETH_P_PAE) +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + || (snap_protocol == ETH_P_WAI) +#endif + ) + { + queue = UF_UNCONTROLLED_PORT_Q; + } + else + { + queue = UF_CONTROLLED_PORT_Q; + } + + /* Controlled port restrictions apply to the packets */ + controlPortaction = uf_sme_port_state(priv, daddr, queue, interfaceTag); + if (controlPortaction != CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN) + { + unifi_warning(priv, "CsrWifiRouterMaPacketReqHandler: (%s)controlled port is closed.\n", (queue == UF_CONTROLLED_PORT_Q)?"":"un"); + if(mareq->cfmRequested) + { + CsrWifiRouterMaPacketCfmSend(msg->source, + interfaceTag, + CSR_RESULT_FAILURE, + mareq->hostTag, 0); + } + return; + } + + signal.SignalPrimitiveHeader.SignalId = CSR_MA_PACKET_REQUEST_ID; + /* Store the appHandle in the LSB of the SenderId. */ + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(((priv->sme_cli->sender_id & 0xff00) | (unsigned int)msg->source), + (u8*)&signal.SignalPrimitiveHeader.SenderProcessId); + signal.SignalPrimitiveHeader.ReceiverProcessId = 0; + + /* Fill in the MA-PACKET.req signal */ + memcpy(req->Ra.x, daddr, ETH_ALEN); + req->Priority = mareq->priority; + req->TransmitRate = 0; /* Let firmware select the rate*/ + req->VirtualInterfaceIdentifier = uf_get_vif_identifier(interfacePriv->interfaceMode,interfaceTag); + req->HostTag = mareq->hostTag; + + if(mareq->cfmRequested) + req->TransmissionControl = 0; + else + req->TransmissionControl = CSR_NO_CONFIRM_REQUIRED; + + r = _sys_packet_req(priv, &signal, mareq->subscriptionHandle, + mareq->frameLength, mareq->frame, snap_protocol); + +#define MAX_RETRY 2 + if (r && mareq->cfmRequested) + { + CsrWifiRouterMaPacketCfmSend(msg->source,interfaceTag, + CSR_RESULT_FAILURE, + mareq->hostTag, 0); + } + return; +} + +void CsrWifiRouterMaPacketCancelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +void CsrWifiRouterCtrlM4TransmitReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterCtrlM4TransmitReq* req = (CsrWifiRouterCtrlM4TransmitReq*)msg; + int r; + bulk_data_param_t bulkdata; + netInterface_priv_t *interfacePriv; + CSR_SIGNAL m4_signal; + unsigned long flags; + + if (priv == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlM4TransmitReqHandler: invalid smepriv\n"); + return; + } + if (req->interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "M4TransmitReqHandler: interfaceTag >= CSR_WIFI_NUM_INTERFACES\n"); + return; + } + + interfacePriv = priv->interfacePriv[req->interfaceTag]; + spin_lock_irqsave(&priv->m4_lock, flags); + if (interfacePriv->m4_bulk_data.data_length == 0) { + spin_unlock_irqrestore(&priv->m4_lock, flags); + unifi_error(priv, "CsrWifiRouterCtrlM4TransmitReqHandler: invalid buffer\n"); + return; + } + + memcpy(&bulkdata.d[0], &interfacePriv->m4_bulk_data, sizeof(bulk_data_desc_t)); + + interfacePriv->m4_bulk_data.net_buf_length = 0; + interfacePriv->m4_bulk_data.data_length = 0; + interfacePriv->m4_bulk_data.os_data_ptr = interfacePriv->m4_bulk_data.os_net_buf_ptr = NULL; + m4_signal = interfacePriv->m4_signal; + spin_unlock_irqrestore(&priv->m4_lock, flags); + + bulkdata.d[1].os_data_ptr = NULL; + bulkdata.d[1].data_length = 0; + + interfacePriv->m4_sent = TRUE; + m4_signal.u.MaPacketRequest.HostTag |= 0x80000000; + /* Store the hostTag for later varification */ + interfacePriv->m4_hostTag = m4_signal.u.MaPacketRequest.HostTag; + r = ul_send_signal_unpacked(priv, &m4_signal, &bulkdata); + unifi_trace(priv, UDBG1, + "CsrWifiRouterCtrlM4TransmitReqHandler: sent\n"); + if (r) { + unifi_error(priv, + "CsrWifiRouterCtrlM4TransmitReqHandler: failed to send signal.\n"); + unifi_net_data_free(priv, &bulkdata.d[0]); + } +} + +/* reset the station records when the mode is set as CSR_WIFI_ROUTER_CTRL_MODE_NONE */ +static void CsrWifiRouterCtrlResetStationRecordList(unifi_priv_t *priv, CsrUint16 interfaceTag) +{ + CsrUint8 i,j; + CsrWifiRouterCtrlStaInfo_t *staInfo=NULL; + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + unsigned long lock_flags; + + /* create a list for sending confirms of un-delivered packets */ + struct list_head send_cfm_list; + + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "CsrWifiRouterCtrlResetStationRecordList: bad interfaceTag\n"); + return; + } + + INIT_LIST_HEAD(&send_cfm_list); + + /* Reset the station record to NULL if mode is NONE */ + for(i = 0; i < UNIFI_MAX_CONNECTIONS; i++) { + if ((staInfo=interfacePriv->staInfo[i]) != NULL) { + uf_prepare_send_cfm_list_for_queued_pkts(priv, + &send_cfm_list, + &(staInfo->mgtFrames)); + uf_flush_list(priv,&(staInfo->mgtFrames)); + for(j=0;jdataPdu[j])); + uf_flush_list(priv,&(staInfo->dataPdu[j])); + } + + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + /* Removing station record information from port config array */ + memset(staInfo->peerControlledPort, 0, sizeof(unifi_port_cfg_t)); + staInfo->peerControlledPort->port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD; + staInfo->peerControlledPort->in_use = FALSE; + interfacePriv->controlled_data_port.entries_in_use--; + + memset(staInfo->peerUnControlledPort, 0, sizeof(unifi_port_cfg_t)); + staInfo->peerUnControlledPort->port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD; + staInfo->peerUnControlledPort->in_use = FALSE; + interfacePriv->uncontrolled_data_port.entries_in_use--; + + kfree(interfacePriv->staInfo[i]); + interfacePriv->staInfo[i] = NULL; + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + } + } + /* after the critical region process the list of frames that requested cfm + * and send cfm to requestor one by one + */ + send_auto_ma_packet_confirm(priv, interfacePriv, &send_cfm_list); + +#ifdef CSR_SUPPORT_SME + /* Interface Independent, no of packet queued, incase of mode is None or AP set to 0 */ + switch(interfacePriv->interfaceMode) + { + case CSR_WIFI_ROUTER_CTRL_MODE_AP: + case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: + case CSR_WIFI_ROUTER_CTRL_MODE_NONE: + if (priv->noOfPktQueuedInDriver) { + unifi_warning(priv, "After reset the noOfPktQueuedInDriver = %x\n", priv->noOfPktQueuedInDriver); + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + priv->noOfPktQueuedInDriver = 0; + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + } + break; + case CSR_WIFI_ROUTER_CTRL_MODE_IBSS: + break; + default: + unifi_error(priv, "interfacemode is not correct in CsrWifiRouterCtrlResetStationRecordList: debug\n"); + } +#endif + + if (((interfacePriv->controlled_data_port.entries_in_use != 0) || (interfacePriv->uncontrolled_data_port.entries_in_use != 0)) + && (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_NONE)) { + /* Print in case if the value of entries goes to -ve/+ve (apart from 0) + * we expect the entries should be zero here if mode is set as NONE + */ + unifi_trace(priv, UDBG3, "In %s controlled port entries = %d, uncontrolled port entries = %d\n", + __FUNCTION__, interfacePriv->controlled_data_port.entries_in_use, + interfacePriv->uncontrolled_data_port.entries_in_use); + } +} + +void CsrWifiRouterCtrlInterfaceReset(unifi_priv_t *priv, CsrUint16 interfaceTag) +{ + netInterface_priv_t *interfacePriv; + + /* create a list for sending confirms of un-delivered packets */ + struct list_head send_cfm_list; + + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "CsrWifiRouterCtrlInterfaceReset: bad interfaceTag\n"); + return; + } + + interfacePriv = priv->interfacePriv[interfaceTag]; + + INIT_LIST_HEAD(&send_cfm_list); + + /* Enable all queues by default */ + interfacePriv->queueEnabled[0] = 1; + interfacePriv->queueEnabled[1] = 1; + interfacePriv->queueEnabled[2] = 1; + interfacePriv->queueEnabled[3] = 1; + + uf_prepare_send_cfm_list_for_queued_pkts(priv, + &send_cfm_list, + &(interfacePriv->genericMgtFrames)); + uf_flush_list(priv,&(interfacePriv->genericMgtFrames)); + + uf_prepare_send_cfm_list_for_queued_pkts(priv, + &send_cfm_list, + &(interfacePriv->genericMulticastOrBroadCastMgtFrames)); + uf_flush_list(priv,&(interfacePriv->genericMulticastOrBroadCastMgtFrames)); + + uf_prepare_send_cfm_list_for_queued_pkts(priv, + &send_cfm_list, + &(interfacePriv->genericMulticastOrBroadCastFrames)); + + uf_flush_list(priv,&(interfacePriv->genericMulticastOrBroadCastFrames)); + uf_flush_maPktlist(priv,&(interfacePriv->directedMaPktReq)); + + /* process the list of frames that requested cfm + and send cfm to requestor one by one */ + send_auto_ma_packet_confirm(priv, interfacePriv, &send_cfm_list); + + /* Reset the station record to NULL if mode is tried to set as NONE */ + switch(interfacePriv->interfaceMode) + { + case CSR_WIFI_ROUTER_CTRL_MODE_STA: + case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI: + case CSR_WIFI_ROUTER_CTRL_MODE_MONITOR: + case CSR_WIFI_ROUTER_CTRL_MODE_AMP: + /* station records not available in these modes */ + break; + default: + CsrWifiRouterCtrlResetStationRecordList(priv,interfaceTag); + } + + interfacePriv->num_stations_joined = 0; + interfacePriv->sta_activity_check_enabled = FALSE; +} + + +void CsrWifiRouterCtrlModeSetReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterCtrlModeSetReq* req = (CsrWifiRouterCtrlModeSetReq*)msg; + + if (priv == NULL) + { + unifi_error(priv, "CsrWifiRouterCtrlModeSetReqHandler: invalid smepriv\n"); + return; + } + + if (req->interfaceTag < CSR_WIFI_NUM_INTERFACES) + { + netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; + + unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlModeSetReqHandler: interfacePriv->interfaceMode = %d\n", + interfacePriv->interfaceMode); + + /* Cleanup the database first for current existing mode, Then take + * care of setting the new mode (Transition seq: AnyMode->NoneMode->newMode) + * So for Every mode changes, Database Initialization/cleanup needed + */ + CsrWifiRouterCtrlInterfaceReset(priv,req->interfaceTag); + + interfacePriv->interfaceMode = req->mode; + interfacePriv->bssid = req->bssid; + /* For modes other than AP/P2PGO, set below member FALSE */ + interfacePriv->intraBssEnabled = FALSE; + + + if(req->mode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + req->mode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + interfacePriv->protect = req->protection; + interfacePriv->dtimActive=FALSE; + interfacePriv->multicastPduHostTag = 0xffffffff; + /* For AP/P2PGO mode SME sending intraBssDistEnabled + * i.e. for AP: intraBssDistEnabled = TRUE, for P2PGO + * intraBssDistEnabled = TRUE/FALSE on requirement + */ + interfacePriv->intraBssEnabled = req->intraBssDistEnabled; + unifi_trace(priv, UDBG3, "CsrWifiRouterCtrlModeSetReqHandler: IntraBssDisEnabled = %d\n", + req->intraBssDistEnabled); + } else if (req->mode == CSR_WIFI_ROUTER_CTRL_MODE_NONE) { + netif_carrier_off(priv->netdev[req->interfaceTag]); + interfacePriv->connected = UnifiConnectedUnknown; + } + } + else { + unifi_error(priv, "CsrWifiRouterCtrlModeSetReqHandler: invalid interfaceTag :%d\n",req->interfaceTag); + } +} + +void CsrWifiRouterMaPacketResHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +} + +/* delete the station record from the station record data base */ +static int peer_delete_record(unifi_priv_t *priv, CsrWifiRouterCtrlPeerDelReq *req) +{ + CsrUint8 j; + CsrWifiRouterCtrlStaInfo_t *staInfo = NULL; + unifi_port_config_t *controlledPort; + unifi_port_config_t *unControlledPort; + netInterface_priv_t *interfacePriv; + maPktReqList_t *maPktreq; + struct list_head *listHeadMaPktreq,*placeHolderMaPktreq; + + CsrUint8 ba_session_idx = 0; + ba_session_rx_struct *ba_session_rx = NULL; + ba_session_tx_struct *ba_session_tx = NULL; + + /* create a list for sending confirms of un-delivered packets */ + struct list_head send_cfm_list; + + unsigned long lock_flags; + + if ((req->peerRecordHandle >= UNIFI_MAX_CONNECTIONS) || (req->interfaceTag >= CSR_WIFI_NUM_INTERFACES)) { + unifi_error(priv, "handle/interfaceTag is not proper, handle = %d, interfaceTag = %d\n", req->peerRecordHandle, req->interfaceTag); + return CSR_RESULT_FAILURE; + } + + INIT_LIST_HEAD(&send_cfm_list); + + interfacePriv = priv->interfacePriv[req->interfaceTag]; + /* remove the station record & make it NULL */ + if ((staInfo=interfacePriv->staInfo[req->peerRecordHandle])!=NULL) { + + uf_prepare_send_cfm_list_for_queued_pkts(priv, + &send_cfm_list, + &(staInfo->mgtFrames)); + + uf_flush_list(priv,&(staInfo->mgtFrames)); + for(j=0;jdataPdu[j])); + uf_flush_list(priv,&(staInfo->dataPdu[j])); + } + + /* There may be race condition + before getting the ma_packet_cfm from f/w, driver may receive peer del from SME + */ + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_for_each_safe(listHeadMaPktreq, placeHolderMaPktreq, &interfacePriv->directedMaPktReq) { + maPktreq = list_entry(listHeadMaPktreq, maPktReqList_t, q); + if(maPktreq->staHandler== staInfo->assignedHandle){ + dev_kfree_skb(maPktreq->skb); + list_del(listHeadMaPktreq); + kfree(maPktreq); + } + + } + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + /* clear the port configure array info, for the corresponding peer entry */ + controlledPort = &interfacePriv->controlled_data_port; + unControlledPort = &interfacePriv->uncontrolled_data_port; + + unifi_trace(priv, UDBG1, "peer_delete_record: Peer found handle = %d, port in use: cont(%d), unCont(%d)\n", + req->peerRecordHandle, controlledPort->entries_in_use, unControlledPort->entries_in_use); + + memset(staInfo->peerControlledPort, 0, sizeof(unifi_port_cfg_t)); + staInfo->peerControlledPort->port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD; + staInfo->peerControlledPort->in_use = FALSE; + if (controlledPort->entries_in_use) { + controlledPort->entries_in_use--; + } else { + unifi_warning(priv, "number of controlled port entries is zero, trying to decrement: debug\n"); + } + + memset(staInfo->peerUnControlledPort, 0, sizeof(unifi_port_cfg_t)); + staInfo->peerUnControlledPort->port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD; + staInfo->peerUnControlledPort->in_use = FALSE; + if (unControlledPort->entries_in_use) { + unControlledPort->entries_in_use--; + } else { + unifi_warning(priv, "number of uncontrolled port entries is zero, trying to decrement: debug\n"); + } + + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + /* update the TIM with zero */ + if (interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_IBSS && + staInfo->timSet == CSR_WIFI_TIM_SET) { + unifi_trace(priv, UDBG3, "peer is deleted so TIM updated to 0, in firmware\n"); + update_tim(priv,staInfo->aid,0,req->interfaceTag, req->peerRecordHandle); + } + + + /* Stop BA session if it is active, for this peer address all BA sessions + (per tID per role) are closed */ + + spin_lock(&priv->ba_lock); + for(ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX; ba_session_idx++){ + ba_session_rx = priv->interfacePriv[req->interfaceTag]->ba_session_rx[ba_session_idx]; + if(ba_session_rx) { + if(!memcmp(ba_session_rx->macAddress.a, staInfo->peerMacAddress.a, ETH_ALEN)){ + blockack_session_stop(priv, + req->interfaceTag, + CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT, + ba_session_rx->tID, + ba_session_rx->macAddress); + } + } + } + + for(ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_TX; ba_session_idx++){ + ba_session_tx = priv->interfacePriv[req->interfaceTag]->ba_session_tx[ba_session_idx]; + if(ba_session_tx) { + if(!memcmp(ba_session_tx->macAddress.a, staInfo->peerMacAddress.a, ETH_ALEN)){ + blockack_session_stop(priv, + req->interfaceTag, + CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR, + ba_session_tx->tID, + ba_session_tx->macAddress); + } + } + } + + spin_unlock(&priv->ba_lock); + +#ifdef CSR_SUPPORT_SME + unifi_trace(priv, UDBG1, "Canceling work queue for STA with AID: %d\n", staInfo->aid); + cancel_work_sync(&staInfo->send_disconnected_ind_task); +#endif + + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); +#ifdef CSR_SUPPORT_SME + interfacePriv->num_stations_joined--; + + staInfo->nullDataHostTag = INVALID_HOST_TAG; + + if ((interfacePriv->sta_activity_check_enabled) && + (interfacePriv->num_stations_joined < STA_INACTIVE_DETECTION_TRIGGER_THRESHOLD)) + { + unifi_trace(priv, UDBG1, "STOPPING the Inactivity Timer (num of stations = %d)\n", interfacePriv->num_stations_joined); + interfacePriv->sta_activity_check_enabled = FALSE; + del_timer_sync(&interfacePriv->sta_activity_check_timer); + } +#endif + + /* Free the station record for corresponding peer */ + kfree(interfacePriv->staInfo[req->peerRecordHandle]); + interfacePriv->staInfo[req->peerRecordHandle] = NULL; + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + + /* after the critical region process the list of frames that requested cfm + and send cfm to requestor one by one */ + send_auto_ma_packet_confirm(priv, interfacePriv, &send_cfm_list); + + + } + else + { + unifi_trace(priv, UDBG3, " peer not found: Delete request Peer handle[%d]\n", req->peerRecordHandle); + } + + return CSR_RESULT_SUCCESS; +} + +void CsrWifiRouterCtrlPeerDelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + CsrWifiRouterCtrlPeerDelReq* req = (CsrWifiRouterCtrlPeerDelReq*)msg; + CsrResult status = CSR_RESULT_SUCCESS; + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; + + unifi_trace(priv, UDBG2, "entering CsrWifiRouterCtrlPeerDelReqHandler \n"); + if (priv == NULL) + { + unifi_error(priv, "CsrWifiRouterCtrlPeerDelReqHandler: invalid smepriv\n"); + return; + } + + if (req->interfaceTag >= CSR_WIFI_NUM_INTERFACES) + { + unifi_error(priv, "CsrWifiRouterCtrlPeerDelReqHandler: bad interfaceTag\n"); + return; + } + + switch(interfacePriv->interfaceMode) + { + case CSR_WIFI_ROUTER_CTRL_MODE_AP: + case CSR_WIFI_ROUTER_CTRL_MODE_IBSS: + case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: + /* remove the station from station record data base */ + status = peer_delete_record(priv, req); + break; + case CSR_WIFI_ROUTER_CTRL_MODE_STA: + case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI: + default: + /* No station record to maintain in these modes */ + break; + } + + CsrWifiRouterCtrlPeerDelCfmSend(msg->source,req->clientData,req->interfaceTag,status); + unifi_trace(priv, UDBG2, "leaving CsrWifiRouterCtrlPeerDelReqHandler \n"); +} + +/* Add the new station to the station record data base */ +static int peer_add_new_record(unifi_priv_t *priv,CsrWifiRouterCtrlPeerAddReq *req,CsrUint32 *handle) +{ + CsrUint8 i, powerModeTemp = 0; + CsrBool freeSlotFound = FALSE; + CsrWifiRouterCtrlStaInfo_t *newRecord = NULL; + netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; + CsrTime currentTime, currentTimeHi; + unsigned long lock_flags; + + if (req->interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "peer_add_new_record: bad interfaceTag\n"); + return CSR_RESULT_FAILURE; + } + + currentTime = CsrTimeGet(¤tTimeHi); + + for(i = 0; i < UNIFI_MAX_CONNECTIONS; i++) { + if(interfacePriv->staInfo[i] == NULL) { + /* Slot is empty, so can be used for station record */ + freeSlotFound = TRUE; + *handle = i; + + /* Allocate for the new station record , to avoid race condition would happen between ADD_PEER & + * DEL_PEER the allocation made atomic memory rather than kernel memory + */ + newRecord = (CsrWifiRouterCtrlStaInfo_t *) kmalloc(sizeof(CsrWifiRouterCtrlStaInfo_t), GFP_ATOMIC); + if (!newRecord) { + unifi_error(priv, "failed to allocate the %d bytes of mem for station record\n", + sizeof(CsrWifiRouterCtrlStaInfo_t)); + return CSR_RESULT_FAILURE; + } + + unifi_trace(priv, UDBG1, "peer_add_new_record: handle = %d AID = %d addr = %x:%x:%x:%x:%x:%x LI=%u\n", + *handle, req->associationId, req->peerMacAddress.a[0], req->peerMacAddress.a[1], req->peerMacAddress.a[2], + req->peerMacAddress.a[3], req->peerMacAddress.a[4], req->peerMacAddress.a[5], + req->staInfo.listenIntervalInTus); + + /* disable the preemption until station record updated */ + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + + interfacePriv->staInfo[i] = newRecord; + /* Initialize the record*/ + memset(newRecord,0,sizeof(CsrWifiRouterCtrlStaInfo_t)); + /* update the station record */ + memcpy(newRecord->peerMacAddress.a, req->peerMacAddress.a, ETH_ALEN); + newRecord->wmmOrQosEnabled = req->staInfo.wmmOrQosEnabled; + + /* maxSpLength is bit map in qosInfo field, so converting accordingly */ + newRecord->maxSpLength = req->staInfo.maxSpLength * 2; + + /*Max SP 0 mean any number of packets. since we buffer only 512 + packets we are hard coding this to zero for the moment */ + + if(newRecord->maxSpLength == 0) + newRecord->maxSpLength=512; + + newRecord->assignedHandle = i; + + /* copy power save mode of all access catagory (Trigger/Delivery/both enabled/disabled) */ + powerModeTemp = (CsrUint8) ((req->staInfo.powersaveMode >> 4) & 0xff); + + if(!(req->staInfo.powersaveMode & 0x0001)) + newRecord->powersaveMode[UNIFI_TRAFFIC_Q_BK]= CSR_WIFI_AC_LEGACY_POWER_SAVE; + else + newRecord->powersaveMode[UNIFI_TRAFFIC_Q_BK]= powerModeTemp & 0x03; + + if(!(req->staInfo.powersaveMode & 0x0002)) + newRecord->powersaveMode[UNIFI_TRAFFIC_Q_BE]= CSR_WIFI_AC_LEGACY_POWER_SAVE; + else + newRecord->powersaveMode[UNIFI_TRAFFIC_Q_BE]= ((powerModeTemp & 0x0C)>> 2); + + if(!(req->staInfo.powersaveMode & 0x0004)) + newRecord->powersaveMode[UNIFI_TRAFFIC_Q_VI]= CSR_WIFI_AC_LEGACY_POWER_SAVE; + else + newRecord->powersaveMode[UNIFI_TRAFFIC_Q_VI]= ((powerModeTemp & 0x30)>> 4); + + if(!(req->staInfo.powersaveMode & 0x0008)) + newRecord->powersaveMode[UNIFI_TRAFFIC_Q_VO]= CSR_WIFI_AC_LEGACY_POWER_SAVE; + else + newRecord->powersaveMode[UNIFI_TRAFFIC_Q_VO]= ((powerModeTemp & 0xC0)>> 6); + + { + CsrUint8 k; + for(k=0; k< MAX_ACCESS_CATOGORY ;k++) + unifi_trace(priv, UDBG2, "peer_add_new_record: WMM : %d ,AC %d, powersaveMode %x \n", + req->staInfo.wmmOrQosEnabled,k,newRecord->powersaveMode[k]); + } + + unifi_trace(priv, UDBG3, "newRecord->wmmOrQosEnabled : %d , MAX SP : %d\n", + newRecord->wmmOrQosEnabled,newRecord->maxSpLength); + + /* Initialize the mgtFrames & data Pdu list */ + { + CsrUint8 j; + INIT_LIST_HEAD(&newRecord->mgtFrames); + for(j = 0; j < MAX_ACCESS_CATOGORY; j++) { + INIT_LIST_HEAD(&newRecord->dataPdu[j]); + } + } + + newRecord->lastActivity = currentTime; + newRecord->activity_flag = TRUE; + + /* enable the preemption as station record updated */ + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + + /* First time port actions are set for the peer with below information */ + configure_data_port(priv, CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN, &newRecord->peerMacAddress, + UF_UNCONTROLLED_PORT_Q, req->interfaceTag); + + if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_IBSS) { + configure_data_port(priv, CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN, &newRecord->peerMacAddress, + UF_CONTROLLED_PORT_Q, req->interfaceTag); + } else { + configure_data_port(priv, CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD, &newRecord->peerMacAddress, + UF_CONTROLLED_PORT_Q, req->interfaceTag); + } + + + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + /* Port status must be already set before calling the Add Peer request */ + newRecord->peerControlledPort = uf_sme_port_config_handle(priv, newRecord->peerMacAddress.a, + UF_CONTROLLED_PORT_Q, req->interfaceTag); + newRecord->peerUnControlledPort = uf_sme_port_config_handle(priv, newRecord->peerMacAddress.a, + UF_UNCONTROLLED_PORT_Q, req->interfaceTag); + + if (!newRecord->peerControlledPort || !newRecord->peerUnControlledPort) { + /* enable the preemption as station record failed to update */ + unifi_warning(priv, "Un/ControlledPort record not found in port configuration array index = %d\n", i); + kfree(interfacePriv->staInfo[i]); + interfacePriv->staInfo[i] = NULL; + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + return CSR_RESULT_FAILURE; + } + + newRecord->currentPeerState = CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE; + + /* changes done during block ack handling */ + newRecord->txSuspend = FALSE; + + /*U-APSD related data structure*/ + newRecord->uapsdActive = FALSE; + newRecord->noOfSpFramesSent =0; + + /* The protection bit is updated once the port opens for corresponding peer in + * routerPortConfigure request */ + + /* update the association ID */ + newRecord->aid = req->associationId; + +#ifdef CSR_SUPPORT_SME + interfacePriv->num_stations_joined++; + newRecord->interfacePriv = interfacePriv; + newRecord->listenIntervalInTus = req->staInfo.listenIntervalInTus; + newRecord->nullDataHostTag = INVALID_HOST_TAG; + + INIT_WORK(&newRecord->send_disconnected_ind_task, uf_send_disconnected_ind_wq); + + if(!(interfacePriv->sta_activity_check_enabled) && + (interfacePriv->num_stations_joined >= STA_INACTIVE_DETECTION_TRIGGER_THRESHOLD)){ + unifi_trace(priv, UDBG1, + "peer_add_new_record: STARTING the Inactivity Timer (num of stations = %d)", + interfacePriv->num_stations_joined); + + interfacePriv->sta_activity_check_enabled = TRUE; + interfacePriv->sta_activity_check_timer.function = check_inactivity_timer_expire_func; + interfacePriv->sta_activity_check_timer.data = (unsigned long)interfacePriv; + + init_timer(&interfacePriv->sta_activity_check_timer); + mod_timer(&interfacePriv->sta_activity_check_timer, + (jiffies + usecs_to_jiffies(STA_INACTIVE_DETECTION_TIMER_INTERVAL * 1000 * 1000))); + + } +#endif + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + break; + } + } + + if(!freeSlotFound) { + unifi_error(priv, "Limited connectivity, Free slot not found for station record addition\n"); + return CSR_RESULT_FAILURE; + } + return CSR_RESULT_SUCCESS; +} + +#ifdef CSR_SUPPORT_SME +static void check_inactivity_timer_expire_func(unsigned long data) +{ + struct unifi_priv *priv; + CsrWifiRouterCtrlStaInfo_t *sta_record = NULL; + CsrUint8 i = 0; + CsrTime now; + CsrTime inactive_time; + netInterface_priv_t *interfacePriv = (netInterface_priv_t *) data; + + if (!interfacePriv) + { + return; + } + + priv = interfacePriv->privPtr; + + if (interfacePriv->InterfaceTag >= CSR_WIFI_NUM_INTERFACES) + { + unifi_error(priv, "check_inactivity_timer_expire_func: Invalid interfaceTag\n"); + return; + } + + /* RUN Algorithm to check inactivity for each connected station */ + now = CsrTimeGet(NULL); + + for(i = 0; i < UNIFI_MAX_CONNECTIONS; i++) { + if(interfacePriv->staInfo[i] != NULL) { + sta_record = interfacePriv->staInfo[i]; + + if (sta_record->activity_flag == TRUE){ + sta_record->activity_flag = FALSE; + sta_record->lastActivity = now; + continue; + } + + if (sta_record->lastActivity > now) + { + /* simple timer wrap (for 1 wrap) */ + inactive_time = CsrTimeAdd((CsrTime)CsrTimeSub(CSR_SCHED_TIME_MAX, sta_record->lastActivity), now); + } + else + { + inactive_time = (CsrTime)CsrTimeSub(now, sta_record->lastActivity); + } + + if (inactive_time >= STA_INACTIVE_TIMEOUT_VAL) + { + unifi_trace(priv, UDBG1, "STA is Inactive - AID = %d inactive_time = %d\n", + sta_record->aid, + inactive_time); + + /* station is in-active, if it is in active mode send a null frame + * and the station should acknowledge the null frame, if acknowledgement + * is not received throw out the station. + * If the station is in Power Save, update TIM for the station so + * that it wakes up and register some activity through PS-Poll or + * trigger frame. + */ + if (sta_record->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE) + { + unifi_trace(priv, UDBG1, "STA power save state - Active, send a NULL frame to check if it is ALIVE\n"); + uf_send_nulldata ( priv, + sta_record->interfacePriv->InterfaceTag, + sta_record->peerMacAddress.a, + CSR_CONTENTION, + sta_record); + } + else if (sta_record->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE) + { + if((sta_record->timSet == CSR_WIFI_TIM_SET) || + (sta_record->timSet == CSR_WIFI_TIM_SETTING)) + { + unifi_trace(priv, UDBG1, "STA power save state - PS, TIM is already SET\n"); + + /* If TIM is set and we do not have any activity for + * more than 3 listen intervals then send a disconnected + * indication to SME, to delete the station from station + * record list. + * The inactivity is already more than STA_INACTIVE_TIMEOUT_VAL + * and this check ensures if the listen interval is a larger + * value than STA_INACTIVE_TIMEOUT_VAL. + */ + if (inactive_time > (3 * (sta_record->listenIntervalInTus * 1024))) + { + unifi_trace(priv, UDBG1, "STA is inactive for more than 3 listen intervals\n"); + queue_work( priv->unifi_workqueue, + &sta_record->send_disconnected_ind_task); + } + + } + else + { + unifi_trace(priv, UDBG1, "STA power save state - PS, update TIM to see if it is ALIVE\n"); + update_tim(priv, + sta_record->aid, + CSR_WIFI_TIM_SET, + interfacePriv->InterfaceTag, + sta_record->assignedHandle); + } + } + } + } + } + + /* re-run the timer interrupt */ + mod_timer(&interfacePriv->sta_activity_check_timer, + (jiffies + usecs_to_jiffies(STA_INACTIVE_DETECTION_TIMER_INTERVAL * 1000 * 1000))); + +} + + +void uf_send_disconnected_ind_wq(struct work_struct *work) +{ + + CsrWifiRouterCtrlStaInfo_t *staInfo = container_of(work, CsrWifiRouterCtrlStaInfo_t, send_disconnected_ind_task); + unifi_priv_t *priv; + CsrUint16 interfaceTag; + struct list_head send_cfm_list; + CsrUint8 j; + + func_enter(); + + if(!staInfo) { + return; + } + + if(!staInfo->interfacePriv) { + return; + } + + priv = staInfo->interfacePriv->privPtr; + interfaceTag = staInfo->interfacePriv->InterfaceTag; + + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "uf_send_disconnected_ind_wq: invalid interfaceTag\n"); + return; + } + + /* The SME/NME may be waiting for confirmation for requested frames to this station. + * So loop through buffered frames for this station and if confirmation is + * requested, send auto confirmation with failure status. Also flush the frames so + * that these are not processed again in PEER_DEL_REQ handler. + */ + INIT_LIST_HEAD(&send_cfm_list); + + uf_prepare_send_cfm_list_for_queued_pkts(priv, + &send_cfm_list, + &(staInfo->mgtFrames)); + + uf_flush_list(priv, &(staInfo->mgtFrames)); + + for(j = 0; j < MAX_ACCESS_CATOGORY; j++){ + uf_prepare_send_cfm_list_for_queued_pkts(priv, + &send_cfm_list, + &(staInfo->dataPdu[j])); + + uf_flush_list(priv,&(staInfo->dataPdu[j])); + } + + send_auto_ma_packet_confirm(priv, staInfo->interfacePriv, &send_cfm_list); + + unifi_warning(priv, "uf_send_disconnected_ind_wq: Router Disconnected IND Peer (%x-%x-%x-%x-%x-%x)\n", + staInfo->peerMacAddress.a[0], + staInfo->peerMacAddress.a[1], + staInfo->peerMacAddress.a[2], + staInfo->peerMacAddress.a[3], + staInfo->peerMacAddress.a[4], + staInfo->peerMacAddress.a[5]); + + CsrWifiRouterCtrlConnectedIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, + 0, + staInfo->interfacePriv->InterfaceTag, + staInfo->peerMacAddress, + CSR_WIFI_ROUTER_CTRL_PEER_DISCONNECTED); + + + return; +} + + +#endif +void CsrWifiRouterCtrlPeerAddReqHandler(void* drvpriv,CsrWifiFsmEvent* msg) +{ + CsrWifiRouterCtrlPeerAddReq* req = (CsrWifiRouterCtrlPeerAddReq*)msg; + CsrResult status = CSR_RESULT_SUCCESS; + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrUint32 handle = 0; + netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; + + unifi_trace(priv, UDBG2, "entering CsrWifiRouterCtrlPeerAddReqHandler \n"); + if (priv == NULL) + { + unifi_error(priv, "CsrWifiRouterCtrlPeerAddReqHandler: invalid smepriv\n"); + return; + } + + if (req->interfaceTag >= CSR_WIFI_NUM_INTERFACES) + { + unifi_error(priv, "CsrWifiRouterCtrlPeerAddReqHandler: bad interfaceTag\n"); + return; + } + + switch(interfacePriv->interfaceMode) + { + case CSR_WIFI_ROUTER_CTRL_MODE_AP: + case CSR_WIFI_ROUTER_CTRL_MODE_IBSS: + case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: + /* Add station record */ + status = peer_add_new_record(priv,req,&handle); + break; + case CSR_WIFI_ROUTER_CTRL_MODE_STA: + case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI: + default: + /* No station record to maintain in these modes */ + break; + } + + CsrWifiRouterCtrlPeerAddCfmSend(msg->source,req->clientData,req->interfaceTag,req->peerMacAddress,handle,status); + unifi_trace(priv, UDBG2, "leaving CsrWifiRouterCtrlPeerAddReqHandler \n"); +} + +void CsrWifiRouterCtrlPeerUpdateReqHandler(void* drvpriv,CsrWifiFsmEvent* msg) +{ + CsrWifiRouterCtrlPeerUpdateReq* req = (CsrWifiRouterCtrlPeerUpdateReq*)msg; + CsrResult status = CSR_RESULT_SUCCESS; + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + + unifi_trace(priv, UDBG2, "entering CsrWifiRouterCtrlPeerUpdateReqHandler \n"); + if (priv == NULL) + { + unifi_error(priv, "CsrWifiRouterCtrlPeerUpdateReqHandler: invalid smepriv\n"); + return; + } + + CsrWifiRouterCtrlPeerUpdateCfmSend(msg->source,req->clientData,req->interfaceTag,status); + unifi_trace(priv, UDBG2, "leaving CsrWifiRouterCtrlPeerUpdateReqHandler \n"); +} + + + void CsrWifiRouterCtrlRawSdioDeinitialiseReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + /* This will never be called as it is intercepted in the Userspace */ +} + +void CsrWifiRouterCtrlRawSdioInitialiseReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + /* This will never be called as it is intercepted in the Userspace */ +} + +void +uf_send_ba_err_wq(struct work_struct *work) +{ + ba_session_rx_struct *ba_session = container_of(work, ba_session_rx_struct, send_ba_err_task); + unifi_priv_t *priv; + + if(!ba_session) { + return; + } + + if(!ba_session->interfacePriv) { + return; + } + + priv = ba_session->interfacePriv->privPtr; + + if (ba_session->interfacePriv->InterfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "%s: invalid interfaceTag\n", __FUNCTION__); + return; + } + + unifi_warning(priv, "%s: Calling CsrWifiRouterCtrlBlockAckErrorIndSend(%d, %d, %d, %d, %x:%x:%x:%x:%x:%x, %d)\n", + __FUNCTION__, + priv->CSR_WIFI_SME_IFACEQUEUE, + 0, + ba_session->interfacePriv->InterfaceTag, + ba_session->tID, + ba_session->macAddress.a[0], + ba_session->macAddress.a[1], + ba_session->macAddress.a[2], + ba_session->macAddress.a[3], + ba_session->macAddress.a[4], + ba_session->macAddress.a[5], + CSR_RESULT_SUCCESS + ); + CsrWifiRouterCtrlBlockAckErrorIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, + 0, + ba_session->interfacePriv->InterfaceTag, + ba_session->tID, + ba_session->macAddress, + CSR_RESULT_SUCCESS); +} + + +static void ba_session_terminate_timer_func(unsigned long data) +{ + ba_session_rx_struct *ba_session = (ba_session_rx_struct*)data; + struct unifi_priv *priv; + + if(!ba_session) { + return; + } + + if(!ba_session->interfacePriv) { + return; + } + + priv = ba_session->interfacePriv->privPtr; + + if (ba_session->interfacePriv->InterfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "%s: invalid interfaceTag\n", __FUNCTION__); + return; + } + + queue_work(priv->unifi_workqueue, &ba_session->send_ba_err_task); +} + + +CsrBool blockack_session_stop(unifi_priv_t *priv, + CsrUint16 interfaceTag, + CsrWifiRouterCtrlBlockAckRole role, + CsrUint16 tID, + CsrWifiMacAddress macAddress) +{ + netInterface_priv_t *interfacePriv; + ba_session_rx_struct *ba_session_rx = NULL; + ba_session_tx_struct *ba_session_tx = NULL; + CsrUint8 ba_session_idx = 0; + int i; + + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "%s: bad interfaceTag = %d\n", __FUNCTION__, interfaceTag); + return FALSE; + } + + interfacePriv = priv->interfacePriv[interfaceTag]; + + if(!interfacePriv) { + unifi_error(priv, "%s: bad interfacePriv\n", __FUNCTION__); + return FALSE; + } + + if(tID > 15) { + unifi_error(priv, "%s: bad tID = %d\n", __FUNCTION__, tID); + return FALSE; + } + + if((role != CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR) && + (role != CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT)) { + unifi_error(priv, "%s: bad role = %d\n", __FUNCTION__, role); + return FALSE; + } + + unifi_warning(priv, "%s: stopping ba_session for peer = %02x:%02x:%02x:%02x:%02x:%02x role = %d tID = %d\n", __FUNCTION__, + macAddress.a[0], macAddress.a[1], macAddress.a[2], + macAddress.a[3], macAddress.a[4], macAddress.a[5], + role, + tID); + + /* find out the appropriate ba session (/station /tid /role) for which stop is requested */ + if (role == CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT){ + for (ba_session_idx =0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX; ba_session_idx++){ + + ba_session_rx = interfacePriv->ba_session_rx[ba_session_idx]; + + if(ba_session_rx){ + if ((!memcmp(ba_session_rx->macAddress.a, macAddress.a, ETH_ALEN)) && (ba_session_rx->tID == tID)){ + break; + } + } + } + + if (!ba_session_rx || (ba_session_idx == MAX_SUPPORTED_BA_SESSIONS_RX)) { + unifi_error(priv, "%s: bad ba_session for Rx [tID=%d]\n", __FUNCTION__, tID); + return FALSE; + } + + + if(ba_session_rx->timeout) { + del_timer_sync(&ba_session_rx->timer); + } + cancel_work_sync(&ba_session_rx->send_ba_err_task); + for (i = 0; i < ba_session_rx->wind_size; i++) { + if(ba_session_rx->buffer[i].active) { + frame_desc_struct *frame_desc = &ba_session_rx->buffer[i]; + unifi_net_data_free(priv, &frame_desc->bulkdata.d[0]); + } + } + kfree(ba_session_rx->buffer); + + interfacePriv->ba_session_rx[ba_session_idx] = NULL; + kfree(ba_session_rx); + }else if (role == CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR){ + for (ba_session_idx =0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_TX; ba_session_idx++){ + ba_session_tx = interfacePriv->ba_session_tx[ba_session_idx]; + if(ba_session_tx){ + if ((!memcmp(ba_session_tx->macAddress.a, macAddress.a, ETH_ALEN)) && (ba_session_tx->tID == tID)){ + break; + } + } + } + + if (!ba_session_tx || (ba_session_idx == MAX_SUPPORTED_BA_SESSIONS_TX)) { + unifi_error(priv, "%s: bad ba_session for Tx [tID=%d]\n", __FUNCTION__, tID); + return FALSE; + } + interfacePriv->ba_session_tx[ba_session_idx] = NULL; + kfree(ba_session_tx); + + } + + return TRUE; +} + + +void CsrWifiRouterCtrlBlockAckDisableReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + CsrWifiRouterCtrlBlockAckDisableReq* req = (CsrWifiRouterCtrlBlockAckDisableReq*)msg; + CsrBool r; + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + + unifi_trace(priv, UDBG6, "%s: in ok\n", __FUNCTION__); + + spin_lock(&priv->ba_lock); + r = blockack_session_stop(priv, + req->interfaceTag, + req->role, + req->trafficStreamID, + req->macAddress); + spin_unlock(&priv->ba_lock); + + CsrWifiRouterCtrlBlockAckDisableCfmSend(msg->source, + req->clientData, + req->interfaceTag, + r?CSR_RESULT_SUCCESS:CSR_RESULT_FAILURE); + + unifi_trace(priv, UDBG6, "%s: out ok\n", __FUNCTION__); +} + + +CsrBool blockack_session_start(unifi_priv_t *priv, + CsrUint16 interfaceTag, + CsrUint16 tID, + CsrUint16 timeout, + CsrWifiRouterCtrlBlockAckRole role, + CsrUint16 wind_size, + CsrUint16 start_sn, + CsrWifiMacAddress macAddress + ) +{ + netInterface_priv_t *interfacePriv; + ba_session_rx_struct *ba_session_rx = NULL; + ba_session_tx_struct *ba_session_tx = NULL; + CsrUint8 ba_session_idx = 0; + + + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "%s: bad interfaceTag = %d\n", __FUNCTION__, interfaceTag); + return FALSE; + } + + interfacePriv = priv->interfacePriv[interfaceTag]; + + if(!interfacePriv) { + unifi_error(priv, "%s: bad interfacePriv\n", __FUNCTION__); + return FALSE; + } + + if(tID > 15) + { + unifi_error(priv, "%s: bad tID=%d\n", __FUNCTION__, tID); + return FALSE; + } + + if(wind_size > MAX_BA_WIND_SIZE) { + unifi_error(priv, "%s: bad wind_size = %d\n", __FUNCTION__, wind_size); + return FALSE; + } + + if(role != CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR && + role != CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT) { + unifi_error(priv, "%s: bad role = %d\n", __FUNCTION__, role); + return FALSE; + } + + unifi_warning(priv, "%s: ba session with peer= (%02x:%02x:%02x:%02x:%02x:%02x)\n", __FUNCTION__, + macAddress.a[0], macAddress.a[1], macAddress.a[2], + macAddress.a[3], macAddress.a[4], macAddress.a[5]); + + unifi_warning(priv, "%s: ba session for tID=%d timeout=%d role=%d wind_size=%d start_sn=%d\n", __FUNCTION__, + tID, + timeout, + role, + wind_size, + start_sn); + + /* Check if BA session exists for per station, per TID, per role or not. + if BA session exists update parameters and if it does not exist + create a new BA session */ + if (role == CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR){ + for (ba_session_idx =0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_TX; ba_session_idx++){ + ba_session_tx = interfacePriv->ba_session_tx[ba_session_idx]; + if (ba_session_tx) { + if ((!memcmp(ba_session_tx->macAddress.a, macAddress.a, ETH_ALEN)) && (ba_session_tx->tID == tID)){ + unifi_warning(priv, "%s: ba_session for Tx already exists\n", __FUNCTION__); + return TRUE; + } + } + } + + /* we have to create new ba_session_tx struct */ + ba_session_tx = NULL; + + /* loop through until an empty BA session slot is there and save the session there */ + for (ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_TX ; ba_session_idx++){ + if (!(interfacePriv->ba_session_tx[ba_session_idx])){ + break; + } + } + if (ba_session_idx == MAX_SUPPORTED_BA_SESSIONS_TX){ + unifi_error(priv, "%s: All ba_session used for Tx, NO free session available\n", __FUNCTION__); + return FALSE; + } + + /* create and populate the new BA session structure */ + ba_session_tx = kmalloc(sizeof(ba_session_tx_struct), GFP_KERNEL); + if (!ba_session_tx) { + unifi_error(priv, "%s: kmalloc failed for ba_session_tx\n", __FUNCTION__); + return FALSE; + } + memset(ba_session_tx, 0, sizeof(ba_session_tx_struct)); + + ba_session_tx->interfacePriv = interfacePriv; + ba_session_tx->tID = tID; + ba_session_tx->macAddress = macAddress; + + interfacePriv->ba_session_tx[ba_session_idx] = ba_session_tx; + + } else if (role == CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT){ + + for (ba_session_idx =0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX; ba_session_idx++){ + ba_session_rx = interfacePriv->ba_session_rx[ba_session_idx]; + if (ba_session_rx) { + if ((!memcmp(ba_session_rx->macAddress.a, macAddress.a, ETH_ALEN)) && (ba_session_rx->tID == tID)){ + unifi_warning(priv, "%s: ba_session for Rx[tID = %d] already exists\n", __FUNCTION__, tID); + + if(ba_session_rx->wind_size == wind_size && + ba_session_rx->timeout == timeout && + ba_session_rx->expected_sn == start_sn) { + return TRUE; + } + + if(ba_session_rx->timeout) { + del_timer_sync(&ba_session_rx->timer); + ba_session_rx->timeout = 0; + } + + if(ba_session_rx->wind_size != wind_size) { + blockack_session_stop(priv, interfaceTag, role, tID, macAddress); + } else { + if (timeout) { + ba_session_rx->timeout = timeout; + ba_session_rx->timer.function = ba_session_terminate_timer_func; + ba_session_rx->timer.data = (unsigned long)ba_session_rx; + init_timer(&ba_session_rx->timer); + mod_timer(&ba_session_rx->timer, (jiffies + usecs_to_jiffies((ba_session_rx->timeout) * 1024))); + } + return TRUE; + } + } + } + } + + /* we could have a valid BA session pointer here or un-initialized + ba session pointer. but in any case we have to create a new session. + so re-initialize the ba_session pointer */ + ba_session_rx = NULL; + + /* loop through until an empty BA session slot is there and save the session there */ + for (ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX ; ba_session_idx++){ + if (!(interfacePriv->ba_session_rx[ba_session_idx])){ + break; + } + } + if (ba_session_idx == MAX_SUPPORTED_BA_SESSIONS_RX){ + unifi_error(priv, "%s: All ba_session used for Rx, NO free session available\n", __FUNCTION__); + return FALSE; + } + + + ba_session_rx = kmalloc(sizeof(ba_session_rx_struct), GFP_KERNEL); + if (!ba_session_rx) { + unifi_error(priv, "%s: kmalloc failed for ba_session_rx\n", __FUNCTION__); + return FALSE; + } + memset(ba_session_rx, 0, sizeof(ba_session_rx_struct)); + + ba_session_rx->wind_size = wind_size; + ba_session_rx->start_sn = ba_session_rx->expected_sn = start_sn; + ba_session_rx->trigger_ba_after_ssn = FALSE; + + ba_session_rx->buffer = kmalloc(ba_session_rx->wind_size*sizeof(frame_desc_struct), GFP_KERNEL); + if (!ba_session_rx->buffer) { + kfree(ba_session_rx); + unifi_error(priv, "%s: kmalloc failed for buffer\n", __FUNCTION__); + return FALSE; + } + + memset(ba_session_rx->buffer, 0, ba_session_rx->wind_size*sizeof(frame_desc_struct)); + + INIT_WORK(&ba_session_rx->send_ba_err_task, uf_send_ba_err_wq); + if (timeout) { + ba_session_rx->timeout = timeout; + ba_session_rx->timer.function = ba_session_terminate_timer_func; + ba_session_rx->timer.data = (unsigned long)ba_session_rx; + init_timer(&ba_session_rx->timer); + mod_timer(&ba_session_rx->timer, (jiffies + usecs_to_jiffies((ba_session_rx->timeout) * 1024))); + } + + ba_session_rx->interfacePriv = interfacePriv; + ba_session_rx->tID = tID; + ba_session_rx->macAddress = macAddress; + + interfacePriv->ba_session_rx[ba_session_idx] = ba_session_rx; + } + return TRUE; +} + +void CsrWifiRouterCtrlBlockAckEnableReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + CsrWifiRouterCtrlBlockAckEnableReq* req = (CsrWifiRouterCtrlBlockAckEnableReq*)msg; + CsrBool r; + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + + unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__); + spin_lock(&priv->ba_lock); + r = blockack_session_start(priv, + req->interfaceTag, + req->trafficStreamID, + req->timeout, + req->role, + req->bufferSize, + req->ssn, + req->macAddress + ); + spin_unlock(&priv->ba_lock); + + CsrWifiRouterCtrlBlockAckEnableCfmSend(msg->source, + req->clientData, + req->interfaceTag, + r?CSR_RESULT_SUCCESS:CSR_RESULT_FAILURE); + unifi_trace(priv, UDBG6, "<<%s: r=%d\n", __FUNCTION__, r); + +} + +void CsrWifiRouterCtrlWapiMulticastFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterCtrlWapiMulticastFilterReq* req = (CsrWifiRouterCtrlWapiMulticastFilterReq*)msg; + + unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__); + unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWapiMulticastFilterReq: req->status = %d\n", req->status); + + /* status 1 - Filter on + * status 0 - Filter off */ + priv->wapi_multicast_filter = req->status; + + unifi_trace(priv, UDBG6, "<<%s\n", __FUNCTION__); +} + +void CsrWifiRouterCtrlWapiUnicastFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterCtrlWapiUnicastFilterReq* req = (CsrWifiRouterCtrlWapiUnicastFilterReq*)msg; + + unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__); + unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWapiUnicastFilterReq: req->status= %d\n", req->status); + + if ((priv->wapi_unicast_filter == 1) && (req->status == 0)) { + /* When we have successfully re-associated and obtained a new unicast key with keyid = 0 */ + priv->wapi_unicast_queued_pkt_filter = 1; + } + + /* status 1 - Filter ON + * status 0 - Filter OFF */ + priv->wapi_unicast_filter = req->status; + + unifi_trace(priv, UDBG6, "<<%s\n", __FUNCTION__); +} + + +void CsrWifiRouterCtrlWapiMulticastReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterCtrlWapiMulticastReq* req = (CsrWifiRouterCtrlWapiMulticastReq*)msg; + + int client_id, receiver_id; + bulk_data_param_t bulkdata; + CsrResult res; + ul_client_t *client; + + CSR_SIGNAL signal; + CSR_MA_PACKET_INDICATION *pkt_ind; + + unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__); + unifi_trace(priv, UDBG4, "CsrWifiRouterCtrlWapiMulticastReqHandler: \n"); + + if (priv == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlWapiMulticastReqHandler : invalid priv\n",__FUNCTION__); + return; + } + + if (priv->smepriv == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlWapiMulticastReqHandler : invalid sme priv\n",__FUNCTION__); + return; + } + + if (req->dataLength == 0 || req->data == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlWapiMulticastReqHandler: invalid request\n",__FUNCTION__); + return; + } + + res = unifi_net_data_malloc(priv, &bulkdata.d[0], req->dataLength); + if (res != CSR_RESULT_SUCCESS) { + unifi_error(priv, "CsrWifiRouterCtrlWapiMulticastReqHandler: Could not allocate net data\n",__FUNCTION__); + return; + } + + /* This function is expected to be called only when the MIC has been verified by SME to be correct + * So reset the reception status to rx_success */ + res = read_unpack_signal(req->signal, &signal); + if (res) { + unifi_error(priv,"CsrWifiRouterCtrlWapiMulticastReqHandler: Received unknown or corrupted signal.\n"); + return; + } + pkt_ind = (CSR_MA_PACKET_INDICATION*) (&((&signal)->u).MaPacketIndication); + if (pkt_ind->ReceptionStatus != CSR_MICHAEL_MIC_ERROR) { + unifi_error(priv,"CsrWifiRouterCtrlWapiMulticastReqHandler: Unknown signal with reception status = %d\n",pkt_ind->ReceptionStatus); + return; + } + else { + unifi_trace(priv, UDBG4,"CsrWifiRouterCtrlWapiMulticastReqHandler: MIC verified , RX_SUCCESS \n",__FUNCTION__); + pkt_ind->ReceptionStatus = CSR_RX_SUCCESS; + write_pack(&signal, req->signal, &(req->signalLength)); + } + + memcpy((void*)bulkdata.d[0].os_data_ptr, req->data, req->dataLength); + + receiver_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN((req->signal) + sizeof(CsrInt16)) & 0xFFF0; + client_id = (receiver_id & 0x0F00) >> UDI_SENDER_ID_SHIFT; + + client = &priv->ul_clients[client_id]; + + if (client && client->event_hook) { + unifi_trace(priv, UDBG3, + "CsrWifiRouterCtrlWapiMulticastReqHandler: " + "Sending signal to client %d, (s:0x%X, r:0x%X) - Signal 0x%X \n", + client->client_id, client->sender_id, receiver_id, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN(req->signal)); + + client->event_hook(client, req->signal, req->signalLength, &bulkdata, UDI_TO_HOST); + } + else { + unifi_trace(priv, UDBG4, "No client to give the packet to\n"); + unifi_net_data_free(priv, &bulkdata.d[0]); + } + + unifi_trace(priv, UDBG6, "<<%s\n", __FUNCTION__); +} diff --git a/drivers/staging/csr/sme_userspace.c b/drivers/staging/csr/sme_userspace.c new file mode 100644 index 0000000..38df94b6 --- /dev/null +++ b/drivers/staging/csr/sme_userspace.c @@ -0,0 +1,316 @@ +/* + ***************************************************************************** + * + * FILE : sme_userspace.c + * + * PURPOSE : Support functions for userspace SME helper application. + * + * + * Copyright (C) 2008-2011 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + ***************************************************************************** + */ + +#include "unifi_priv.h" + +/* + * Fix Me..... These need to be the correct values... + * Dynamic from the user space. + */ +CsrSchedQid CSR_WIFI_ROUTER_IFACEQUEUE = 0xFFFF; +CsrSchedQid CSR_WIFI_SME_IFACEQUEUE = 0xFFFF; +#ifdef CSR_SUPPORT_WEXT_AP +CsrSchedQid CSR_WIFI_NME_IFACEQUEUE = 0xFFFF; +#endif +int +uf_sme_init(unifi_priv_t *priv) +{ + int i, j; + + CsrWifiRouterTransportInit(priv); + + priv->smepriv = priv; + + init_waitqueue_head(&priv->sme_request_wq); + + priv->filter_tclas_ies = NULL; + memset(&priv->packet_filters, 0, sizeof(uf_cfg_bcast_packet_filter_t)); + +#ifdef CSR_SUPPORT_WEXT + priv->ignore_bssid_join = FALSE; + priv->mib_data.length = 0; + + uf_sme_wext_set_defaults(priv); +#endif /* CSR_SUPPORT_WEXT*/ + + priv->sta_ip_address = 0xFFFFFFFF; + + priv->wifi_on_state = wifi_on_unspecified; + + sema_init(&priv->sme_sem, 1); + memset(&priv->sme_reply, 0, sizeof(sme_reply_t)); + + priv->ta_ind_work.in_use = 0; + priv->ta_sample_ind_work.in_use = 0; + + priv->CSR_WIFI_SME_IFACEQUEUE = 0xFFFF; + + for (i = 0; i < MAX_MA_UNIDATA_IND_FILTERS; i++) { + priv->sme_unidata_ind_filters[i].in_use = 0; + } + + /* Create a work queue item for Traffic Analysis indications to SME */ + INIT_WORK(&priv->ta_ind_work.task, uf_ta_ind_wq); + INIT_WORK(&priv->ta_sample_ind_work.task, uf_ta_sample_ind_wq); +#ifdef CSR_SUPPORT_WEXT + INIT_WORK(&priv->sme_config_task, uf_sme_config_wq); +#endif + + for (i = 0; i < CSR_WIFI_NUM_INTERFACES; i++) { + netInterface_priv_t *interfacePriv = priv->interfacePriv[i]; + interfacePriv->m4_sent = FALSE; + interfacePriv->m4_bulk_data.net_buf_length = 0; + interfacePriv->m4_bulk_data.data_length = 0; + interfacePriv->m4_bulk_data.os_data_ptr = interfacePriv->m4_bulk_data.os_net_buf_ptr = NULL; + + memset(&interfacePriv->controlled_data_port, 0, sizeof(unifi_port_config_t)); + interfacePriv->controlled_data_port.entries_in_use = 1; + interfacePriv->controlled_data_port.port_cfg[0].in_use = TRUE; + interfacePriv->controlled_data_port.port_cfg[0].port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD; + interfacePriv->controlled_data_port.overide_action = UF_DATA_PORT_OVERIDE; + + memset(&interfacePriv->uncontrolled_data_port, 0, sizeof(unifi_port_config_t)); + interfacePriv->uncontrolled_data_port.entries_in_use = 1; + interfacePriv->uncontrolled_data_port.port_cfg[0].in_use = TRUE; + interfacePriv->uncontrolled_data_port.port_cfg[0].port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD; + interfacePriv->uncontrolled_data_port.overide_action = UF_DATA_PORT_OVERIDE; + + /* Mark the remainder of the port config table as unallocated */ + for(j = 1; j < UNIFI_MAX_CONNECTIONS; j++) { + interfacePriv->controlled_data_port.port_cfg[j].in_use = FALSE; + interfacePriv->controlled_data_port.port_cfg[j].port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD; + + interfacePriv->uncontrolled_data_port.port_cfg[j].in_use = FALSE; + interfacePriv->uncontrolled_data_port.port_cfg[j].port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD; + } + + /* intializing the lists */ + INIT_LIST_HEAD(&interfacePriv->genericMgtFrames); + INIT_LIST_HEAD(&interfacePriv->genericMulticastOrBroadCastMgtFrames); + INIT_LIST_HEAD(&interfacePriv->genericMulticastOrBroadCastFrames); + INIT_LIST_HEAD(&interfacePriv->directedMaPktReq); + + for(j = 0; j < UNIFI_MAX_CONNECTIONS; j++) { + interfacePriv->staInfo[j] = NULL; + } + + interfacePriv->num_stations_joined = 0; + interfacePriv->sta_activity_check_enabled = FALSE; + } + + + return 0; +} /* uf_sme_init() */ + + +void +uf_sme_deinit(unifi_priv_t *priv) +{ + int i,j; + CsrUint8 ba_session_idx; + ba_session_rx_struct *ba_session_rx = NULL; + ba_session_tx_struct *ba_session_tx = NULL; + CsrWifiRouterCtrlStaInfo_t *staInfo = NULL; + netInterface_priv_t *interfacePriv = NULL; + + /* Free any TCLASs previously allocated */ + if (priv->packet_filters.tclas_ies_length) { + priv->packet_filters.tclas_ies_length = 0; + CsrPmemFree(priv->filter_tclas_ies); + priv->filter_tclas_ies = NULL; + } + + for (i = 0; i < MAX_MA_UNIDATA_IND_FILTERS; i++) { + priv->sme_unidata_ind_filters[i].in_use = 0; + } + + /* Remove all the Peer database, before going down */ + for (i = 0; i < CSR_WIFI_NUM_INTERFACES; i++) { + spin_lock(&priv->ba_lock); + for(ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX; ba_session_idx++){ + ba_session_rx = priv->interfacePriv[i]->ba_session_rx[ba_session_idx]; + if(ba_session_rx) { + blockack_session_stop(priv, + i, + CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT, + ba_session_rx->tID, + ba_session_rx->macAddress); + } + } + for(ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_TX; ba_session_idx++){ + ba_session_tx = priv->interfacePriv[i]->ba_session_tx[ba_session_idx]; + if(ba_session_tx) { + blockack_session_stop(priv, + i, + CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR, + ba_session_tx->tID, + ba_session_tx->macAddress); + } + } + + spin_unlock(&priv->ba_lock); + interfacePriv = priv->interfacePriv[i]; + if(interfacePriv){ + for(j = 0; j < UNIFI_MAX_CONNECTIONS; j++) { + if ((staInfo=interfacePriv->staInfo[j]) != NULL) { + /* Clear the STA activity parameters before freeing station Record */ + unifi_trace(priv, UDBG1, "uf_sme_deinit: Canceling work queue for STA with AID: %d\n", staInfo->aid); + cancel_work_sync(&staInfo->send_disconnected_ind_task); + staInfo->nullDataHostTag = INVALID_HOST_TAG; + } + } + if (interfacePriv->sta_activity_check_enabled){ + interfacePriv->sta_activity_check_enabled = FALSE; + del_timer_sync(&interfacePriv->sta_activity_check_timer); + } + } + CsrWifiRouterCtrlInterfaceReset(priv, i); + priv->interfacePriv[i]->interfaceMode = CSR_WIFI_ROUTER_CTRL_MODE_NONE; + } + + +} /* uf_sme_deinit() */ + + + + + +/* + * --------------------------------------------------------------------------- + * unifi_ta_indicate_protocol + * + * Report that a packet of a particular type has been seen + * + * Arguments: + * drv_priv The device context pointer passed to ta_init. + * protocol The protocol type enum value. + * direction Whether the packet was a tx or rx. + * src_addr The source MAC address from the data packet. + * + * Returns: + * None. + * + * Notes: + * We defer the actual sending to a background workqueue, + * see uf_ta_ind_wq(). + * --------------------------------------------------------------------------- + */ +void +unifi_ta_indicate_protocol(void *ospriv, + CsrWifiRouterCtrlTrafficPacketType packet_type, + CsrWifiRouterCtrlProtocolDirection direction, + const CsrWifiMacAddress *src_addr) +{ + unifi_priv_t *priv = (unifi_priv_t*)ospriv; + + if (priv->ta_ind_work.in_use) { + unifi_warning(priv, + "unifi_ta_indicate_protocol: workqueue item still in use, not sending\n"); + return; + } + + if (CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_RX == direction) + { + CsrUint16 interfaceTag = 0; + CsrWifiRouterCtrlTrafficProtocolIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,0, + interfaceTag, + packet_type, + direction, + *src_addr); + } + else + { + priv->ta_ind_work.packet_type = packet_type; + priv->ta_ind_work.direction = direction; + priv->ta_ind_work.src_addr = *src_addr; + + queue_work(priv->unifi_workqueue, &priv->ta_ind_work.task); + } + +} /* unifi_ta_indicate_protocol() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_ta_indicate_sampling + * + * Send the TA sampling information to the SME. + * + * Arguments: + * drv_priv The device context pointer passed to ta_init. + * stats The TA sampling data to send. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +void +unifi_ta_indicate_sampling(void *ospriv, CsrWifiRouterCtrlTrafficStats *stats) +{ + unifi_priv_t *priv = (unifi_priv_t*)ospriv; + + if (!priv) { + return; + } + + if (priv->ta_sample_ind_work.in_use) { + unifi_warning(priv, + "unifi_ta_indicate_sampling: workqueue item still in use, not sending\n"); + return; + } + + priv->ta_sample_ind_work.stats = *stats; + + queue_work(priv->unifi_workqueue, &priv->ta_sample_ind_work.task); + +} /* unifi_ta_indicate_sampling() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_ta_indicate_l4stats + * + * Send the TA TCP/UDP throughput information to the driver. + * + * Arguments: + * drv_priv The device context pointer passed to ta_init. + * rxTcpThroughput TCP RX throughput in KiloBytes + * txTcpThroughput TCP TX throughput in KiloBytes + * rxUdpThroughput UDP RX throughput in KiloBytes + * txUdpThroughput UDP TX throughput in KiloBytes + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +void +unifi_ta_indicate_l4stats(void *ospriv, + CsrUint32 rxTcpThroughput, + CsrUint32 txTcpThroughput, + CsrUint32 rxUdpThroughput, + CsrUint32 txUdpThroughput) +{ + unifi_priv_t *priv = (unifi_priv_t*)ospriv; + + if (!priv) { + return; + } + /* Save the info. The actual action will be taken in unifi_ta_indicate_sampling() */ + priv->rxTcpThroughput = rxTcpThroughput; + priv->txTcpThroughput = txTcpThroughput; + priv->rxUdpThroughput = rxUdpThroughput; + priv->txUdpThroughput = txUdpThroughput; +} /* unifi_ta_indicate_l4stats() */ diff --git a/drivers/staging/csr/sme_userspace.h b/drivers/staging/csr/sme_userspace.h new file mode 100644 index 0000000..19f484f --- /dev/null +++ b/drivers/staging/csr/sme_userspace.h @@ -0,0 +1,38 @@ +/* + * *************************************************************************** + * FILE: sme_userspace.h + * + * PURPOSE: SME related definitions. + * + * Copyright (C) 2007-2008 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * *************************************************************************** + */ +#ifndef __LINUX_SME_USERSPACE_H__ +#define __LINUX_SME_USERSPACE_H__ 1 + +#include + +int uf_sme_init(unifi_priv_t *priv); +void uf_sme_deinit(unifi_priv_t *priv); +int uf_sme_queue_message(unifi_priv_t *priv, u8 *buffer, int length); + + +#include "csr_wifi_router_lib.h" +#include "csr_wifi_router_sef.h" +#include "csr_wifi_router_ctrl_lib.h" +#include "csr_wifi_router_ctrl_sef.h" +#include "csr_wifi_sme_task.h" +#ifdef CSR_SUPPORT_WEXT_AP +#include "csr_wifi_nme_ap_lib.h" +#endif +#include "csr_wifi_sme_lib.h" + +void CsrWifiRouterTransportInit(unifi_priv_t *priv); +void CsrWifiRouterTransportRecv(unifi_priv_t *priv, CsrUint8* buffer, CsrSize bufferLength); +void CsrWifiRouterTransportDeInit(unifi_priv_t *priv); + +#endif /* __LINUX_SME_USERSPACE_H__ */ diff --git a/drivers/staging/csr/sme_wext.c b/drivers/staging/csr/sme_wext.c new file mode 100644 index 0000000..384ccd4 --- /dev/null +++ b/drivers/staging/csr/sme_wext.c @@ -0,0 +1,3394 @@ +/* + * --------------------------------------------------------------------------- + * FILE: sme_wext.c + * + * PURPOSE: + * Handlers for ioctls from iwconfig. + * These provide the control plane operations. + * + * Copyright (C) 2007-2009 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * --------------------------------------------------------------------------- + */ +#include +#include +#include +#include +#include +#include "unifi_priv.h" +#include + +#define CHECK_INITED(_priv) \ + do { \ + if (_priv->init_progress != UNIFI_INIT_COMPLETED) { \ + unifi_trace(_priv, UDBG2, "%s unifi not ready, failing wext call\n", __FUNCTION__); \ + return -ENODEV; \ + } \ + } while (0) + +/* Workaround for the wpa_supplicant hanging issue */ +#define CSR_WIFI_WEXT_HANG_WORKAROUND + +#ifdef CSR_WIFI_WEXT_HANG_WORKAROUND +# define UF_RTNL_LOCK() rtnl_lock() +# define UF_RTNL_UNLOCK() rtnl_unlock() +#else +# define UF_RTNL_LOCK() +# define UF_RTNL_UNLOCK() +#endif + + +/* + * --------------------------------------------------------------------------- + * Helper functions + * --------------------------------------------------------------------------- + */ + +/* + * --------------------------------------------------------------------------- + * wext_freq_to_channel + * channel_to_mhz + * + * These functions convert between channel number and frequency. + * + * Arguments: + * ch Channel number, as defined in 802.11 specs + * m, e Mantissa and exponent as provided by wireless extension. + * + * Returns: + * channel or frequency (in MHz) value + * --------------------------------------------------------------------------- + */ +static int +wext_freq_to_channel(int m, int e) +{ + int mhz; + + mhz = m; + while (e < 6) { + mhz /= 10; + e++; + } + while (e > 6) { + mhz *= 10; + e--; + } + + if (mhz >= 5000) { + return ((mhz - 5000) / 5); + } + + if (mhz == 2482) { + return 14; + } + + if (mhz >= 2407) { + return ((mhz - 2407) / 5); + } + + return 0; +} /* wext_freq_to_channel() */ + +static int +channel_to_mhz(int ch, int dot11a) +{ + + if (ch == 0) return 0; + if (ch > 200) return 0; + + /* 5G */ + if (dot11a) { + return (5000 + (5 * ch)); + } + + /* 2.4G */ + if (ch == 14) { + return 2484; + } + + if ((ch < 14) && (ch > 0)) { + return (2407 + (5 * ch)); + } + + return 0; +} +#ifdef CSR_SUPPORT_WEXT_AP +void uf_sme_wext_ap_set_defaults(unifi_priv_t *priv) +{ + memcpy(priv->ap_config.ssid.ssid,"defaultssid",sizeof("defaultssid")); + + priv->ap_config.ssid.length = 8; + priv->ap_config.channel = 6; + priv->ap_config.if_index = 1; + priv->ap_config.credentials.authType = 0; + priv->ap_config.max_connections=8; + + priv->group_sec_config.apGroupkeyTimeout = 0; + priv->group_sec_config.apStrictGtkRekey = 0; + priv->group_sec_config.apGmkTimeout = 0; + priv->group_sec_config.apResponseTimeout = 100; /* Default*/ + priv->group_sec_config.apRetransLimit = 3; /* Default*/ + /* Set default params even if they may not be used*/ + /* Until Here*/ + + priv->ap_mac_config.preamble = CSR_WIFI_SME_USE_LONG_PREAMBLE; + priv->ap_mac_config.shortSlotTimeEnabled = FALSE; + priv->ap_mac_config.ctsProtectionType=CSR_WIFI_SME_CTS_PROTECTION_AUTOMATIC; + + priv->ap_mac_config.wmmEnabled = TRUE; + priv->ap_mac_config.wmmApParams[0].cwMin=4; + priv->ap_mac_config.wmmApParams[0].cwMax=10; + priv->ap_mac_config.wmmApParams[0].aifs=3; + priv->ap_mac_config.wmmApParams[0].txopLimit=0; + priv->ap_mac_config.wmmApParams[0].admissionControlMandatory=FALSE; + priv->ap_mac_config.wmmApParams[1].cwMin=4; + priv->ap_mac_config.wmmApParams[1].cwMax=10; + priv->ap_mac_config.wmmApParams[1].aifs=7; + priv->ap_mac_config.wmmApParams[1].txopLimit=0; + priv->ap_mac_config.wmmApParams[1].admissionControlMandatory=FALSE; + priv->ap_mac_config.wmmApParams[2].cwMin=3; + priv->ap_mac_config.wmmApParams[2].cwMax=4; + priv->ap_mac_config.wmmApParams[2].aifs=1; + priv->ap_mac_config.wmmApParams[2].txopLimit=94; + priv->ap_mac_config.wmmApParams[2].admissionControlMandatory=FALSE; + priv->ap_mac_config.wmmApParams[3].cwMin=2; + priv->ap_mac_config.wmmApParams[3].cwMax=3; + priv->ap_mac_config.wmmApParams[3].aifs=1; + priv->ap_mac_config.wmmApParams[3].txopLimit=47; + priv->ap_mac_config.wmmApParams[3].admissionControlMandatory=FALSE; + + priv->ap_mac_config.wmmApBcParams[0].cwMin=4; + priv->ap_mac_config.wmmApBcParams[0].cwMax=10; + priv->ap_mac_config.wmmApBcParams[0].aifs=3; + priv->ap_mac_config.wmmApBcParams[0].txopLimit=0; + priv->ap_mac_config.wmmApBcParams[0].admissionControlMandatory=FALSE; + priv->ap_mac_config.wmmApBcParams[1].cwMin=4; + priv->ap_mac_config.wmmApBcParams[1].cwMax=10; + priv->ap_mac_config.wmmApBcParams[1].aifs=7; + priv->ap_mac_config.wmmApBcParams[1].txopLimit=0; + priv->ap_mac_config.wmmApBcParams[1].admissionControlMandatory=FALSE; + priv->ap_mac_config.wmmApBcParams[2].cwMin=3; + priv->ap_mac_config.wmmApBcParams[2].cwMax=4; + priv->ap_mac_config.wmmApBcParams[2].aifs=2; + priv->ap_mac_config.wmmApBcParams[2].txopLimit=94; + priv->ap_mac_config.wmmApBcParams[2].admissionControlMandatory=FALSE; + priv->ap_mac_config.wmmApBcParams[3].cwMin=2; + priv->ap_mac_config.wmmApBcParams[3].cwMax=3; + priv->ap_mac_config.wmmApBcParams[3].aifs=2; + priv->ap_mac_config.wmmApBcParams[3].txopLimit=47; + priv->ap_mac_config.wmmApBcParams[3].admissionControlMandatory=FALSE; + + priv->ap_mac_config.accessType=CSR_WIFI_AP_ACCESS_TYPE_NONE; + priv->ap_mac_config.macAddressListCount=0; + priv->ap_mac_config.macAddressList=NULL; + + priv->ap_mac_config.apHtParams.rxStbc=1; + priv->ap_mac_config.apHtParams.rifsModeAllowed=TRUE; + priv->ap_mac_config.apHtParams.greenfieldSupported=FALSE; + priv->ap_mac_config.apHtParams.shortGi20MHz=TRUE; + priv->ap_mac_config.apHtParams.htProtection=0; + priv->ap_mac_config.apHtParams.dualCtsProtection=FALSE; + + priv->ap_mac_config.phySupportedBitmap = + (CSR_WIFI_SME_AP_PHY_SUPPORT_B|CSR_WIFI_SME_AP_PHY_SUPPORT_G|CSR_WIFI_SME_AP_PHY_SUPPORT_N); + priv->ap_mac_config.beaconInterval= 100; + priv->ap_mac_config.dtimPeriod=3; + priv->ap_mac_config.maxListenInterval=0x00ff;/* Set it to a large value + to enable different types of + devices to join us */ + priv->ap_mac_config.supportedRatesCount = + uf_configure_supported_rates(priv->ap_mac_config.supportedRates,priv->ap_mac_config.phySupportedBitmap); +} +#endif +/* + * --------------------------------------------------------------------------- + * uf_sme_wext_set_defaults + * + * Set up power-on defaults for driver config. + * + * Note: The SME Management API *cannot* be used in this function. + * + * Arguments: + * priv Pointer to device private context struct + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +void +uf_sme_wext_set_defaults(unifi_priv_t *priv) +{ + memset(&priv->connection_config, 0, sizeof(CsrWifiSmeConnectionConfig)); + + priv->connection_config.bssType = CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE; + priv->connection_config.authModeMask = CSR_WIFI_SME_AUTH_MODE_80211_OPEN; + priv->connection_config.encryptionModeMask = CSR_WIFI_SME_ENCRYPTION_CIPHER_NONE; + priv->connection_config.privacyMode = CSR_WIFI_SME_80211_PRIVACY_MODE_DISABLED; + priv->connection_config.wmmQosInfo = 0xFF; + priv->connection_config.ifIndex = CSR_WIFI_SME_RADIO_IF_BOTH; + priv->connection_config.adhocJoinOnly = FALSE; + priv->connection_config.adhocChannel = 6; + + priv->wep_tx_key_index = 0; + + priv->wext_wireless_stats.qual.qual = 0; + priv->wext_wireless_stats.qual.level = 0; + priv->wext_wireless_stats.qual.noise = 0; + priv->wext_wireless_stats.qual.updated = 0x70; +#ifdef CSR_SUPPORT_WEXT_AP + /* Initialize the default configuration for AP */ + uf_sme_wext_ap_set_defaults(priv); +#endif + + +} /* uf_sme_wext_set_defaults() */ + + +/* + * --------------------------------------------------------------------------- + * WEXT methods + * --------------------------------------------------------------------------- + */ + +/* + * --------------------------------------------------------------------------- + * unifi_giwname - handler for SIOCGIWNAME + * unifi_siwfreq - handler for SIOCSIWFREQ + * unifi_giwfreq - handler for SIOCGIWFREQ + * unifi_siwmode - handler for SIOCSIWMODE + * unifi_giwmode - handler for SIOCGIWMODE + * unifi_giwrange - handler for SIOCGIWRANGE + * unifi_siwap - handler for SIOCSIWAP + * unifi_giwap - handler for SIOCGIWAP + * unifi_siwscan - handler for SIOCSIWSCAN + * unifi_giwscan - handler for SIOCGIWSCAN + * unifi_siwessid - handler for SIOCSIWESSID + * unifi_giwessid - handler for SIOCGIWESSID + * unifi_siwencode - handler for SIOCSIWENCODE + * unifi_giwencode - handler for SIOCGIWENCODE + * + * Handler functions for IW extensions. + * These are registered via the unifi_iw_handler_def struct below + * and called by the generic IW driver support code. + * See include/net/iw_handler.h. + * + * Arguments: + * None. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +static int +iwprivsdefs(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + int r; + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + CsrWifiSmeMibConfig mibConfig; + CsrWifiSmePowerConfig powerConfig; + + unifi_trace(priv, UDBG1, "iwprivs80211defaults: reload defaults\n"); + + uf_sme_wext_set_defaults(priv); + + /* Get, modify and set the MIB data */ + r = sme_mgt_mib_config_get(priv, &mibConfig); + if (r) { + unifi_error(priv, "iwprivs80211defaults: Get CsrWifiSmeMibConfigValue failed.\n"); + return r; + } + mibConfig.dot11RtsThreshold = 2347; + mibConfig.dot11FragmentationThreshold = 2346; + r = sme_mgt_mib_config_set(priv, &mibConfig); + if (r) { + unifi_error(priv, "iwprivs80211defaults: Set CsrWifiSmeMibConfigValue failed.\n"); + return r; + } + + powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW; + powerConfig.listenIntervalTu = 100; + powerConfig.rxDtims = 1; + + r = sme_mgt_power_config_set(priv, &powerConfig); + if (r) { + unifi_error(priv, "iwprivs80211defaults: Set unifi_PowerConfigValue failed.\n"); + return r; + } + + return 0; +} /* iwprivsdefs() */ + +static int +iwprivs80211ps(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + int r = 0; + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + + int ps_mode = (int)(*extra); + CsrWifiSmePowerConfig powerConfig; + + unifi_trace(priv, UDBG1, "iwprivs80211ps: power save mode = %d\n", ps_mode); + + r = sme_mgt_power_config_get(priv, &powerConfig); + if (r) { + unifi_error(priv, "iwprivs80211ps: Get unifi_PowerConfigValue failed.\n"); + return r; + } + + switch (ps_mode) { + case CSR_PMM_ACTIVE_MODE: + powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW; + break; + case CSR_PMM_POWER_SAVE: + powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_HIGH; + break; + case CSR_PMM_FAST_POWER_SAVE: + powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_MED; + break; + default: + powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_AUTO; + break; + } + + r = sme_mgt_power_config_set(priv, &powerConfig); + if (r) { + unifi_error(priv, "iwprivs80211ps: Set unifi_PowerConfigValue failed.\n"); + } + + return r; +} + +static int +iwprivg80211ps(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + + CsrWifiSmePowerConfig powerConfig; + int r; + + r = sme_mgt_power_config_get(priv, &powerConfig); + if (r) { + unifi_error(priv, "iwprivg80211ps: Get 802.11 power mode failed.\n"); + return r; + } + + switch (powerConfig.powerSaveLevel) { + case CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW: + snprintf(extra, IWPRIV_POWER_SAVE_MAX_STRING, + "Power save mode: %d (Active)", + powerConfig.powerSaveLevel); + break; + case CSR_WIFI_SME_POWER_SAVE_LEVEL_MED: + snprintf(extra, IWPRIV_POWER_SAVE_MAX_STRING, + "Power save mode: %d (Fast)", + powerConfig.powerSaveLevel); + break; + case CSR_WIFI_SME_POWER_SAVE_LEVEL_HIGH: + snprintf(extra, IWPRIV_POWER_SAVE_MAX_STRING, + "Power save mode: %d (Full)", + powerConfig.powerSaveLevel); + break; + case CSR_WIFI_SME_POWER_SAVE_LEVEL_AUTO: + snprintf(extra, IWPRIV_POWER_SAVE_MAX_STRING, + "Power save mode: %d (Auto)", + powerConfig.powerSaveLevel); + break; + default: + snprintf(extra, IWPRIV_POWER_SAVE_MAX_STRING, + "Power save mode: %d (Unknown)", + powerConfig.powerSaveLevel); + break; + } + + wrqu->data.length = strlen(extra) + 1; + + return 0; +} + +static int +iwprivssmedebug(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + /* No longer supported on the API */ +#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) + unifi_debug_buf_dump(); +#endif + + return 0; +} + +#ifdef CSR_SUPPORT_WEXT_AP +#define PARAM_TYPE_INT 0 +#define PARAM_TYPE_STRING 1 +#define CSR_WIFI_MAX_SSID_LEN 32 +#define CSR_WIFI_MAX_SEC_LEN 16 +#define CSR_WIFI_MAX_KEY_LEN 65 + +static int hex_look_up(char x) +{ + if(x>='0' && x<='9') + return (x-48); + if(x>= 'a' && x <= 'f') + return (x-87); + return -1; +} + +static int power (int a, int b) +{ + int i; + int num =1; + for(i=0;i param_max_len) { + unifi_notice(priv,"extracted param len:%d is > MAX:%d\n",param_str_len, param_max_len); + param_str_len = param_max_len; + } + switch (param_type) { + case PARAM_TYPE_INT: + { + CsrUint32 *pdst_int = dst,num =0; + int i,j=0; + if (param_str_len > sizeof(int_str)) { + param_str_len = sizeof(int_str); + } + memcpy(int_str, param_str_begin, param_str_len); + for(i = param_str_len; i>0;i--) { + if(int_str[i-1] >= '0' && int_str[i-1] <='9') { + num += ((int_str[i-1]-'0')*power(10,j)); + j++; + } else { + unifi_error(priv,"decode_parameter_from_string:not a number %c\n",(int_str[i-1])); + return -1; + } + } + *pdst_int = num; + unifi_trace(priv,UDBG2,"decode_parameter_from_string:decoded int = %d\n",*pdst_int); + } + break; + default: + memcpy(dst, param_str_begin, param_str_len); + *((char *)dst + param_str_len) = 0; + unifi_trace(priv,UDBG2,"decode_parameter_from_string:decoded string = %s\n",(char *)dst); + break; + } + } else { + unifi_error(priv,"decode_parameter_from_string: Token:%s not found in %s \n",token,orig_str); + return -1; + } + return 0; +} +static int store_ap_advanced_config_from_string(unifi_priv_t *priv, char *param_str) +{ + char * str_ptr=param_str; + int ret = 0,tmp_var; + char phy_mode[6]; + CsrWifiSmeApMacConfig * ap_mac_config = &priv->ap_mac_config; + + /* Check for BI */ + ret = decode_parameter_from_string(priv, &str_ptr, "BI=", + PARAM_TYPE_INT, &tmp_var, 5); + if(ret) { + unifi_error(priv,"store_ap_advanced_config_from_string: BI not found\n"); + return -1; + } + ap_mac_config->beaconInterval = tmp_var; + ret = decode_parameter_from_string(priv, &str_ptr, "DTIM_PER=", + PARAM_TYPE_INT, &tmp_var, 5); + if(ret) { + unifi_error(priv,"store_ap_advanced_config_from_string: DTIM_PER not found\n"); + return -1; + } + ap_mac_config->dtimPeriod = tmp_var; + ret = decode_parameter_from_string(priv, &str_ptr, "WMM=", + PARAM_TYPE_INT, &tmp_var, 5); + if(ret) { + unifi_error(priv,"store_ap_advanced_config_from_string: WMM not found\n"); + return -1; + } + ap_mac_config->wmmEnabled = tmp_var; + ret = decode_parameter_from_string(priv, &str_ptr, "PHY=", + PARAM_TYPE_STRING, phy_mode, 5); + if(ret) { + unifi_error(priv,"store_ap_advanced_config_from_string: PHY not found\n"); + } else { + if(strstr(phy_mode,"b")){ + ap_mac_config->phySupportedBitmap = CSR_WIFI_SME_AP_PHY_SUPPORT_B; + } + if(strstr(phy_mode,"g")) { + ap_mac_config->phySupportedBitmap |= CSR_WIFI_SME_AP_PHY_SUPPORT_G; + } + if(strstr(phy_mode,"n")) { + ap_mac_config->phySupportedBitmap |= CSR_WIFI_SME_AP_PHY_SUPPORT_N; + } + ap_mac_config->supportedRatesCount = + uf_configure_supported_rates(ap_mac_config->supportedRates, ap_mac_config->phySupportedBitmap); + } + return ret; +} + +static int store_ap_config_from_string( unifi_priv_t * priv,char *param_str) + +{ + char *str_ptr = param_str; + char sub_cmd[16]; + char sec[CSR_WIFI_MAX_SEC_LEN]; + char key[CSR_WIFI_MAX_KEY_LEN]; + int ret = 0,tmp_var; + CsrWifiSmeApConfig_t *ap_config = &priv->ap_config; + CsrWifiSmeApMacConfig * ap_mac_config = &priv->ap_mac_config; + memset(sub_cmd, 0, sizeof(sub_cmd)); + if(!strstr(param_str,"END")) { + unifi_error(priv,"store_ap_config_from_string:Invalid config string:%s\n",param_str); + return -1; + } + if (decode_parameter_from_string(priv,&str_ptr, "ASCII_CMD=", + PARAM_TYPE_STRING, sub_cmd, 6) != 0) { + return -1; + } + if (strncmp(sub_cmd, "AP_CFG", 6)) { + + if(!strncmp(sub_cmd ,"ADVCFG", 6)) { + return store_ap_advanced_config_from_string(priv, str_ptr); + } + unifi_error(priv,"store_ap_config_from_string: sub_cmd:%s != 'AP_CFG or ADVCFG'!\n", sub_cmd); + return -1; + } + memset(ap_config, 0, sizeof(CsrWifiSmeApConfig_t)); + ret = decode_parameter_from_string(priv,&str_ptr, "SSID=", + PARAM_TYPE_STRING, ap_config->ssid.ssid, + CSR_WIFI_MAX_SSID_LEN); + if(ret) { + unifi_error(priv,"store_ap_config_from_string: SSID not found\n"); + return -1; + } + ap_config->ssid.length = strlen(ap_config->ssid.ssid); + + ret = decode_parameter_from_string(priv, &str_ptr, "SEC=", + PARAM_TYPE_STRING, sec, CSR_WIFI_MAX_SEC_LEN); + if(ret) { + unifi_error(priv,"store_ap_config_from_string: SEC not found\n"); + return -1; + } + ret = decode_parameter_from_string(priv,&str_ptr, "KEY=", + PARAM_TYPE_STRING, key, CSR_WIFI_MAX_KEY_LEN); + if(!strcasecmp(sec,"open")) { + unifi_trace(priv,UDBG2,"store_ap_config_from_string: security open"); + ap_config->credentials.authType = CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM; + if(ret) { + unifi_notice(priv,"store_ap_config_from_string: KEY not found:fine with Open\n"); + } + } + else if(!strcasecmp(sec,"wpa2-psk")) { + int i,j=0; + CsrWifiNmeApAuthPers *pers = + ((CsrWifiNmeApAuthPers *)&(ap_config->credentials.nmeAuthType.authTypePersonal)); + CsrUint8 *psk = pers->authPers_credentials.psk.psk; + + unifi_trace(priv,UDBG2,"store_ap_config_from_string: security WPA2"); + if(ret) { + unifi_error(priv,"store_ap_config_from_string: KEY not found for WPA2\n"); + return -1; + } + ap_config->credentials.authType = CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL; + pers->authSupport = CSR_WIFI_SME_RSN_AUTH_WPA2PSK; + pers->rsnCapabilities =0; + pers->wapiCapabilities =0; + pers->pskOrPassphrase=CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK; + pers->authPers_credentials.psk.encryptionMode = + (CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_CCMP |CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_CCMP) ; + for(i=0;i<32;i++){ + psk[i] = (16*hex_look_up(key[j]))+hex_look_up(key[j+1]); + j+=2; + } + + } else { + unifi_notice(priv,"store_ap_config_from_string: Unknown security: Assuming Open"); + ap_config->credentials.authType = CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM; + return -1; + } + /* Get the decoded value in a temp int variable to ensure that other fields within the struct + which are of type other than int are not over written */ + ret = decode_parameter_from_string(priv,&str_ptr, "CHANNEL=", PARAM_TYPE_INT, &tmp_var, 5); + if(ret) + return -1; + ap_config->channel = tmp_var; + ret = decode_parameter_from_string(priv,&str_ptr, "PREAMBLE=", PARAM_TYPE_INT, &tmp_var, 5); + if(ret) + return -1; + ap_mac_config->preamble = tmp_var; + ret = decode_parameter_from_string(priv,&str_ptr, "MAX_SCB=", PARAM_TYPE_INT, &tmp_var, 5); + ap_config->max_connections = tmp_var; + return ret; +} + +static int +iwprivsapstart(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + int r; + + unifi_trace(priv, UDBG1, "iwprivsapstart\n" ); + r = sme_ap_start(priv,interfacePriv->InterfaceTag,&priv->ap_config); + if(r) { + unifi_error(priv,"iwprivsapstart AP START failed : %d\n",-r); + } + return r; +} + +static int +iwprivsapconfig(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + char *cfg_str = NULL; + int r; + + unifi_trace(priv, UDBG1, "iwprivsapconfig\n" ); + if (wrqu->data.length != 0) { + char *str; + if (!(cfg_str = kmalloc(wrqu->data.length+1, GFP_KERNEL))) + { + return -ENOMEM; + } + if (copy_from_user(cfg_str, wrqu->data.pointer, wrqu->data.length)) { + kfree(cfg_str); + return -EFAULT; + } + cfg_str[wrqu->data.length] = 0; + unifi_trace(priv,UDBG2,"length:%d\n",wrqu->data.length); + unifi_trace(priv,UDBG2,"AP configuration string:%s\n",cfg_str); + str = cfg_str; + if ((r = store_ap_config_from_string(priv,str))) { + unifi_error(priv, "iwprivsapconfig:Failed to decode the string %d\n",r); + kfree(cfg_str); + return -EIO; + + } + } else { + unifi_error(priv,"iwprivsapconfig argument length = 0 \n"); + return -EIO; + } + r = sme_ap_config(priv, &priv->ap_mac_config, &priv->group_sec_config); + if(r) { + unifi_error(priv,"iwprivsapstop AP Config failed : %d\n",-r); + } else if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + unifi_trace(priv, UDBG1, "iwprivsapconfig: Starting the AP"); + r = sme_ap_start(priv,interfacePriv->InterfaceTag,&priv->ap_config); + if(r) { + unifi_error(priv,"iwprivsapstart AP START failed : %d\n",-r); + } + } + kfree(cfg_str); + return r; +} + +static int +iwprivsapstop(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + int r; + CsrUint16 interface_tag = interfacePriv->InterfaceTag; + + unifi_trace(priv, UDBG1, "iwprivsapstop\n" ); + r = sme_ap_stop(priv,interface_tag); + if(r) { + unifi_error(priv,"iwprivsapstop AP STOP failed : %d\n",-r); + } + return r; +} + +#ifdef ANDROID_BUILD +static int +iwprivsapfwreload(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + + unifi_trace(priv, UDBG1, "iwprivsapfwreload\n" ); + return 0; +} + +static int +iwprivsstackstart(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + unifi_trace(priv, UDBG1, "iwprivsstackstart\n" ); + return 0; +} + +static int +iwprivsstackstop(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + int r = 0; + CsrUint16 interface_tag = interfacePriv->InterfaceTag; + + unifi_trace(priv, UDBG1, "iwprivsstackstop\n" ); + + switch(interfacePriv->interfaceMode) { + case CSR_WIFI_ROUTER_CTRL_MODE_STA: + case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI: + case CSR_WIFI_ROUTER_CTRL_MODE_IBSS: + r = sme_mgt_disconnect(priv); + break; + case CSR_WIFI_ROUTER_CTRL_MODE_AP: + case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: + r = sme_ap_stop(priv,interface_tag); + break; + default : + break; + } + + if(r) { + unifi_error(priv,"iwprivsstackstop Stack stop failed : %d\n",-r); + } + return 0; +} +#endif /* ANDROID_BUILD */ +#endif /* CSR_SUPPORT_WEXT_AP */ + +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE +static int +iwprivsconfwapi(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + CsrUint8 enable; + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + func_enter(); + + unifi_trace(priv, UDBG1, "iwprivsconfwapi\n" ); + + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + unifi_error(priv, "iwprivsconfwapi: not permitted in Mode %d\n", + interfacePriv->interfaceMode); + return -EPERM; + } + + enable = *(CsrUint8*)(extra); + + if (enable) { + priv->connection_config.authModeMask = CSR_WIFI_SME_AUTH_MODE_80211_OPEN; + priv->connection_config.authModeMask |= (CSR_WIFI_SME_AUTH_MODE_WAPI_WAIPSK | CSR_WIFI_SME_AUTH_MODE_WAPI_WAI); + priv->connection_config.encryptionModeMask |= + CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_SMS4 | CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_SMS4; + } else { + priv->connection_config.authModeMask &= ~(CSR_WIFI_SME_AUTH_MODE_WAPI_WAIPSK | CSR_WIFI_SME_AUTH_MODE_WAPI_WAI); + priv->connection_config.encryptionModeMask &= + ~(CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_SMS4 | CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_SMS4); + } + + func_exit(); + return 0; +} + +static int +iwprivswpikey(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + int r = 0, i; + CsrWifiSmeKey key; + unifiio_wapi_key_t inKey; + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + func_enter(); + + unifi_trace(priv, UDBG1, "iwprivswpikey\n" ); + + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + unifi_error(priv, "iwprivswpikey: not permitted in Mode %d\n", + interfacePriv->interfaceMode); + return -EPERM; + } + + inKey = *(unifiio_wapi_key_t*)(extra); + + if (inKey.unicastKey) { + key.keyType = CSR_WIFI_SME_KEY_TYPE_PAIRWISE; + } else { + key.keyType = CSR_WIFI_SME_KEY_TYPE_GROUP; + } + + key.keyIndex = inKey.keyIndex; + + /* memcpy(key.keyRsc, inKey.keyRsc, 16); */ + for (i = 0; i < 16; i+= 2) + { + key.keyRsc[i/2] = inKey.keyRsc[i+1] << 8 | inKey.keyRsc[i]; + } + + memcpy(key.address.a, inKey.address, 6); + key.keyLength = 32; + memcpy(key.key, inKey.key, 32); + key.authenticator = 0; + key.wepTxKey = 0; + + unifi_trace(priv, UDBG1, "keyType = %d, keyIndex = %d, wepTxKey = %d, keyRsc = %x:%x, auth = %d, address = %x:%x, " + "keylength = %d, key = %x:%x\n", key.keyType, key.keyIndex, key.wepTxKey, + key.keyRsc[0], key.keyRsc[7], key.authenticator, + key.address.a[0], key.address.a[5], key.keyLength, key.key[0], + key.key[15]); + + r = sme_mgt_key(priv, &key, CSR_WIFI_SME_LIST_ACTION_ADD); + if (r) { + unifi_error(priv, "SETKEYS request was rejected with result %d\n", r); + return convert_sme_error(r); + } + + func_exit(); + return r; +} +#endif + + +static int +unifi_giwname(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + char *name = wrqu->name; + unifi_trace(priv, UDBG2, "unifi_giwname\n"); + + if (priv->if_index == CSR_INDEX_5G) { + strcpy(name, "IEEE 802.11-a"); + } else { + strcpy(name, "IEEE 802.11-bgn"); + } + return 0; +} /* unifi_giwname() */ + + +static int +unifi_siwfreq(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + struct iw_freq *freq = (struct iw_freq *)wrqu; + + func_enter(); + unifi_trace(priv, UDBG2, "unifi_siwfreq\n"); + + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + unifi_error(priv, "unifi_siwfreq: not permitted in Mode %d\n", + interfacePriv->interfaceMode); + return -EPERM; + } + + + /* + * Channel is stored in the connection configuration, + * and set later when ask for a connection. + */ + if ((freq->e == 0) && (freq->m <= 1000)) { + priv->connection_config.adhocChannel = freq->m; + } else { + priv->connection_config.adhocChannel = wext_freq_to_channel(freq->m, freq->e); + } + + func_exit(); + return 0; +} /* unifi_siwfreq() */ + + +static int +unifi_giwfreq(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + struct iw_freq *freq = (struct iw_freq *)wrqu; + int err = 0; + CsrWifiSmeConnectionInfo connectionInfo; + + func_enter(); + unifi_trace(priv, UDBG2, "unifi_giwfreq\n"); + CHECK_INITED(priv); + + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + unifi_error(priv, "unifi_giwfreq: not permitted in Mode %d\n", + interfacePriv->interfaceMode); + return -EPERM; + } + + + UF_RTNL_UNLOCK(); + err = sme_mgt_connection_info_get(priv, &connectionInfo); + UF_RTNL_LOCK(); + + freq->m = channel_to_mhz(connectionInfo.channelNumber, + (connectionInfo.networkType80211 == CSR_WIFI_SME_RADIO_IF_GHZ_5_0)); + freq->e = 6; + + func_exit(); + return convert_sme_error(err); +} /* unifi_giwfreq() */ + + +static int +unifi_siwmode(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + + func_enter(); + unifi_trace(priv, UDBG2, "unifi_siwmode\n"); + + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + unifi_error(priv, "unifi_siwmode: not permitted in Mode %d\n", + interfacePriv->interfaceMode); + return -EPERM; + } + + + switch(wrqu->mode) { + case IW_MODE_ADHOC: + priv->connection_config.bssType = CSR_WIFI_SME_BSS_TYPE_ADHOC; + break; + case IW_MODE_INFRA: + priv->connection_config.bssType = CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE; + break; + case IW_MODE_AUTO: + priv->connection_config.bssType = CSR_WIFI_SME_BSS_TYPE_ANY_BSS; + break; + default: + unifi_notice(priv, "Unknown IW MODE value.\n"); + } + + /* Clear the SSID and BSSID configuration */ + priv->connection_config.ssid.length = 0; + memset(priv->connection_config.bssid.a, 0xFF, ETH_ALEN); + + func_exit(); + return 0; +} /* unifi_siwmode() */ + + + +static int +unifi_giwmode(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + int r = 0; + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + CsrWifiSmeConnectionConfig connectionConfig; + + func_enter(); + unifi_trace(priv, UDBG2, "unifi_giwmode\n"); + CHECK_INITED(priv); + + unifi_trace(priv, UDBG2, "unifi_giwmode: Exisitng mode = 0x%x\n", + interfacePriv->interfaceMode); + switch(interfacePriv->interfaceMode) { + case CSR_WIFI_ROUTER_CTRL_MODE_STA: + case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI: + wrqu->mode = IW_MODE_INFRA; + break; + case CSR_WIFI_ROUTER_CTRL_MODE_AP: + case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: + wrqu->mode = IW_MODE_MASTER; + break; + case CSR_WIFI_ROUTER_CTRL_MODE_IBSS: + wrqu->mode = IW_MODE_ADHOC; + break; + case CSR_WIFI_ROUTER_CTRL_MODE_P2P: + case CSR_WIFI_ROUTER_CTRL_MODE_NONE: + UF_RTNL_UNLOCK(); + r = sme_mgt_connection_config_get(priv, &connectionConfig); + UF_RTNL_LOCK(); + if (r == 0) { + switch(connectionConfig.bssType) { + case CSR_WIFI_SME_BSS_TYPE_ADHOC: + wrqu->mode = IW_MODE_ADHOC; + break; + case CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE: + wrqu->mode = IW_MODE_INFRA; + break; + default: + wrqu->mode = IW_MODE_AUTO; + unifi_notice(priv, "Unknown IW MODE value.\n"); + } + } + break; + default: + wrqu->mode = IW_MODE_AUTO; + unifi_notice(priv, "Unknown IW MODE value.\n"); + + } + unifi_trace(priv, UDBG4, "unifi_giwmode: mode = 0x%x\n", wrqu->mode); + func_exit(); + return r; +} /* unifi_giwmode() */ + + + +static int +unifi_giwrange(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct iw_point *dwrq = &wrqu->data; + struct iw_range *range = (struct iw_range *) extra; + int i; + + unifi_trace(NULL, UDBG2, "unifi_giwrange\n"); + + dwrq->length = sizeof(struct iw_range); + memset(range, 0, sizeof(*range)); + range->min_nwid = 0x0000; + range->max_nwid = 0x0000; + + /* + * Don't report the frequency/channel table, then the channel + * number returned elsewhere will be printed as a channel number. + */ + + /* Ranges of values reported in quality structs */ + range->max_qual.qual = 40; /* Max expected qual value */ + range->max_qual.level = -120; /* Noise floor in dBm */ + range->max_qual.noise = -120; /* Noise floor in dBm */ + + + /* space for IW_MAX_BITRATES (8 up to WE15, 32 later) */ + i = 0; +#if WIRELESS_EXT > 15 + range->bitrate[i++] = 2 * 500000; + range->bitrate[i++] = 4 * 500000; + range->bitrate[i++] = 11 * 500000; + range->bitrate[i++] = 22 * 500000; + range->bitrate[i++] = 12 * 500000; + range->bitrate[i++] = 18 * 500000; + range->bitrate[i++] = 24 * 500000; + range->bitrate[i++] = 36 * 500000; + range->bitrate[i++] = 48 * 500000; + range->bitrate[i++] = 72 * 500000; + range->bitrate[i++] = 96 * 500000; + range->bitrate[i++] = 108 * 500000; +#else + range->bitrate[i++] = 2 * 500000; + range->bitrate[i++] = 4 * 500000; + range->bitrate[i++] = 11 * 500000; + range->bitrate[i++] = 22 * 500000; + range->bitrate[i++] = 24 * 500000; + range->bitrate[i++] = 48 * 500000; + range->bitrate[i++] = 96 * 500000; + range->bitrate[i++] = 108 * 500000; +#endif /* WIRELESS_EXT < 16 */ + range->num_bitrates = i; + + range->max_encoding_tokens = NUM_WEPKEYS; + range->num_encoding_sizes = 2; + range->encoding_size[0] = 5; + range->encoding_size[1] = 13; + + range->we_version_source = 20; + range->we_version_compiled = WIRELESS_EXT; + + /* Number of channels available in h/w */ + range->num_channels = 14; + /* Number of entries in freq[] array */ + range->num_frequency = 14; + for (i = 0; (i < range->num_frequency) && (i < IW_MAX_FREQUENCIES); i++) { + int chan = i + 1; + range->freq[i].i = chan; + range->freq[i].m = channel_to_mhz(chan, 0); + range->freq[i].e = 6; + } + if ((i+3) < IW_MAX_FREQUENCIES) { + range->freq[i].i = 36; + range->freq[i].m = channel_to_mhz(36, 1); + range->freq[i].e = 6; + range->freq[i+1].i = 40; + range->freq[i+1].m = channel_to_mhz(40, 1); + range->freq[i+1].e = 6; + range->freq[i+2].i = 44; + range->freq[i+2].m = channel_to_mhz(44, 1); + range->freq[i+2].e = 6; + range->freq[i+3].i = 48; + range->freq[i+3].m = channel_to_mhz(48, 1); + range->freq[i+3].e = 6; + } + +#if WIRELESS_EXT > 16 + /* Event capability (kernel + driver) */ + range->event_capa[0] = (IW_EVENT_CAPA_K_0 | + IW_EVENT_CAPA_MASK(SIOCGIWTHRSPY) | + IW_EVENT_CAPA_MASK(SIOCGIWAP) | + IW_EVENT_CAPA_MASK(SIOCGIWSCAN)); + range->event_capa[1] = IW_EVENT_CAPA_K_1; + range->event_capa[4] = (IW_EVENT_CAPA_MASK(IWEVTXDROP) | + IW_EVENT_CAPA_MASK(IWEVCUSTOM) | + IW_EVENT_CAPA_MASK(IWEVREGISTERED) | + IW_EVENT_CAPA_MASK(IWEVEXPIRED)); +#endif /* WIRELESS_EXT > 16 */ + +#if WIRELESS_EXT > 17 + range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | + IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; +#endif /* WIRELESS_EXT > 17 */ + + + return 0; +} /* unifi_giwrange() */ + + +static int +unifi_siwap(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + int err = 0; + const unsigned char zero_bssid[ETH_ALEN] = {0x00, 0x00, 0x00, + 0x00, 0x00, 0x00}; + + func_enter(); + + CHECK_INITED(priv); + + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + unifi_error(priv, "unifi_siwap: not permitted in Mode %d\n", + interfacePriv->interfaceMode); + return -EPERM; + } + + + if (wrqu->ap_addr.sa_family != ARPHRD_ETHER) { + return -EINVAL; + } + + unifi_trace(priv, UDBG1, "unifi_siwap: asked for %02X:%02X:%02X:%02X:%02X:%02X\n", + (u8)wrqu->ap_addr.sa_data[0], + (u8)wrqu->ap_addr.sa_data[1], + (u8)wrqu->ap_addr.sa_data[2], + (u8)wrqu->ap_addr.sa_data[3], + (u8)wrqu->ap_addr.sa_data[4], + (u8)wrqu->ap_addr.sa_data[5]); + + if (!memcmp(wrqu->ap_addr.sa_data, zero_bssid, ETH_ALEN)) { + priv->ignore_bssid_join = FALSE; + err = sme_mgt_disconnect(priv); + if (err) { + unifi_trace(priv, UDBG4, "unifi_siwap: Disconnect failed, status %d\n", err); + } + return 0; + } + + if (priv->ignore_bssid_join) { + unifi_trace(priv, UDBG4, "unifi_siwap: ignoring second join\n"); + priv->ignore_bssid_join = FALSE; + } else { + memcpy(priv->connection_config.bssid.a, wrqu->ap_addr.sa_data, ETH_ALEN); + unifi_trace(priv, UDBG1, "unifi_siwap: Joining %X:%X:%X:%X:%X:%X\n", + priv->connection_config.bssid.a[0], + priv->connection_config.bssid.a[1], + priv->connection_config.bssid.a[2], + priv->connection_config.bssid.a[3], + priv->connection_config.bssid.a[4], + priv->connection_config.bssid.a[5]); + err = sme_mgt_connect(priv); + if (err) { + unifi_error(priv, "unifi_siwap: Join failed, status %d\n", err); + func_exit(); + return convert_sme_error(err); + } + } + func_exit(); + + return 0; +} /* unifi_siwap() */ + + +static int +unifi_giwap(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + CsrWifiSmeConnectionInfo connectionInfo; + int r = 0; + CsrUint8 *bssid; + + func_enter(); + + CHECK_INITED(priv); + unifi_trace(priv, UDBG2, "unifi_giwap\n"); + + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + unifi_error(priv, "iwprivswpikey: not permitted in Mode %d\n", + interfacePriv->interfaceMode); + return -EPERM; + } + + UF_RTNL_UNLOCK(); + r = sme_mgt_connection_info_get(priv, &connectionInfo); + UF_RTNL_LOCK(); + + if (r == 0) { + bssid = connectionInfo.bssid.a; + wrqu->ap_addr.sa_family = ARPHRD_ETHER; + unifi_trace(priv, UDBG4, + "unifi_giwap: BSSID = %02X:%02X:%02X:%02X:%02X:%02X\n", + bssid[0], bssid[1], bssid[2], + bssid[3], bssid[4], bssid[5]); + + memcpy(wrqu->ap_addr.sa_data, bssid, ETH_ALEN); + } else { + memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); + } + + func_exit(); + return 0; +} /* unifi_giwap() */ + + +static int +unifi_siwscan(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + int scantype; + int r; + CsrWifiSsid scan_ssid; + unsigned char *channel_list = NULL; + int chans_good = 0; +#if WIRELESS_EXT > 17 + struct iw_point *data = &wrqu->data; + struct iw_scan_req *req = (struct iw_scan_req *) extra; +#endif + + func_enter(); + + CHECK_INITED(priv); + + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + unifi_error(priv, "unifi_siwscan: not permitted in Mode %d\n", + interfacePriv->interfaceMode); + return -EPERM; + } + + + scantype = UNIFI_SCAN_ACTIVE; + +#if WIRELESS_EXT > 17 + /* Providing a valid channel list will force an active scan */ + if (req) { + if ((req->num_channels > 0) && (req->num_channels < IW_MAX_FREQUENCIES)) { + channel_list = kmalloc(req->num_channels, GFP_KERNEL); + if (channel_list) { + int i; + for (i = 0; i < req->num_channels; i++) { + /* Convert frequency to channel number */ + int ch = wext_freq_to_channel(req->channel_list[i].m, + req->channel_list[i].e); + if (ch) { + channel_list[chans_good++] = ch; + } + } + unifi_trace(priv, UDBG1, + "SIWSCAN: Scanning %d channels\n", chans_good); + } else { + /* Fall back to scanning all */ + unifi_error(priv, "SIWSCAN: Can't alloc channel_list (%d)\n", + req->num_channels); + } + } + } + + if (req && (data->flags & IW_SCAN_THIS_ESSID)) { + memcpy(scan_ssid.ssid, req->essid, req->essid_len); + scan_ssid.length = req->essid_len; + unifi_trace(priv, UDBG1, + "SIWSCAN: Scanning for %.*s\n", + scan_ssid.length, scan_ssid.ssid); + } else +#endif + { + unifi_trace(priv, UDBG1, "SIWSCAN: Scanning for all APs\n"); + scan_ssid.length = 0; + } + + r = sme_mgt_scan_full(priv, &scan_ssid, chans_good, channel_list); + if (r) { + unifi_error(priv, "SIWSCAN: Scan returned error %d\n", r); + } else { + unifi_trace(priv, UDBG1, "SIWSCAN: Scan done\n"); + wext_send_scan_results_event(priv); + } + + if (channel_list) { + kfree(channel_list); + } + + func_exit(); + return r; + +} /* unifi_siwscan() */ + + +static const unsigned char * +unifi_find_info_element(int id, const unsigned char *info, int len) +{ + const unsigned char *ie = info; + + while (len > 1) + { + int e_id, e_len; + e_id = ie[0]; + e_len = ie[1]; + + /* Return if we find a match */ + if (e_id == id) + { + return ie; + } + + len -= (e_len + 2); + ie += (e_len + 2); + } + + return NULL; +} /* unifi_find_info_element() */ + + +/* + * Translate scan data returned from the card to a card independent + * format that the Wireless Tools will understand - Jean II + */ +int +unifi_translate_scan(struct net_device *dev, + struct iw_request_info *info, + char *current_ev, char *end_buf, + CsrWifiSmeScanResult *scan_data, + int scan_index) +{ + struct iw_event iwe; /* Temporary buffer */ + unsigned char *info_elems; + int info_elem_len; + const unsigned char *elem; + u16 capabilities; + int signal, noise, snr; + char *start_buf = current_ev; + char *current_val; /* For rates */ + int i, r; + + info_elems = scan_data->informationElements; + info_elem_len = scan_data->informationElementsLength; + + if (!scan_data->informationElementsLength || !scan_data->informationElements) { + unifi_error(NULL, "*** NULL SCAN IEs ***\n"); + return -EIO; + } + + /* get capinfo bits */ + capabilities = scan_data->capabilityInformation; + + unifi_trace(NULL, UDBG5, "Capabilities: 0x%x\n", capabilities); + + /* First entry *MUST* be the AP MAC address */ + memset(&iwe, 0, sizeof(iwe)); + iwe.cmd = SIOCGIWAP; + iwe.u.ap_addr.sa_family = ARPHRD_ETHER; + memcpy(iwe.u.ap_addr.sa_data, scan_data->bssid.a, ETH_ALEN); + iwe.len = IW_EV_ADDR_LEN; + r = uf_iwe_stream_add_event(info, start_buf, end_buf, &iwe, IW_EV_ADDR_LEN); + if (r < 0) { + return r; + } + start_buf += r; + + /* Other entries will be displayed in the order we give them */ + + /* Add the ESSID */ + /* find SSID in Info Elems */ + elem = unifi_find_info_element(IE_SSID_ID, info_elems, info_elem_len); + if (elem) { + int e_len = elem[1]; + const unsigned char *e_ptr = elem + 2; + unsigned char buf[33]; + + memset(&iwe, 0, sizeof(iwe)); + iwe.cmd = SIOCGIWESSID; + iwe.u.essid.length = e_len; + if (iwe.u.essid.length > 32) { + iwe.u.essid.length = 32; + } + iwe.u.essid.flags = scan_index; + memcpy(buf, e_ptr, iwe.u.essid.length); + buf[iwe.u.essid.length] = '\0'; + r = uf_iwe_stream_add_point(info, start_buf, end_buf, &iwe, buf); + if (r < 0) { + return r; + } + start_buf += r; + + } + + /* Add mode */ + memset(&iwe, 0, sizeof(iwe)); + iwe.cmd = SIOCGIWMODE; + if (scan_data->bssType == CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE) { + iwe.u.mode = IW_MODE_INFRA; + } else { + iwe.u.mode = IW_MODE_ADHOC; + } + iwe.len = IW_EV_UINT_LEN; + r = uf_iwe_stream_add_event(info, start_buf, end_buf, &iwe, IW_EV_UINT_LEN); + if (r < 0) { + return r; + } + start_buf += r; + + /* Add frequency. iwlist will convert to channel using table given in giwrange */ + memset(&iwe, 0, sizeof(iwe)); + iwe.cmd = SIOCGIWFREQ; + iwe.u.freq.m = scan_data->channelFrequency; + iwe.u.freq.e = 6; + r = uf_iwe_stream_add_event(info, start_buf, end_buf, &iwe, IW_EV_FREQ_LEN); + if (r < 0) { + return r; + } + start_buf += r; + + + /* Add quality statistics */ + iwe.cmd = IWEVQUAL; + /* + * level and noise below are mapped into an unsigned 8 bit number, + * ranging from [-192; 63]. The way this is achieved is simply to + * add 0x100 onto the number if it is negative, + * once clipped to the correct range. + */ + signal = scan_data->rssi; /* This value is in dBm */ + /* Clip range of snr */ + snr = (scan_data->snr > 0) ? scan_data->snr : 0; /* In dB relative, from 0 - 255 */ + snr = (snr < 255) ? snr : 255; + noise = signal - snr; + + /* Clip range of signal */ + signal = (signal < 63) ? signal : 63; + signal = (signal > -192) ? signal : -192; + + /* Clip range of noise */ + noise = (noise < 63) ? noise : 63; + noise = (noise > -192) ? noise : -192; + + /* Make u8 */ + signal = ( signal < 0 ) ? signal + 0x100 : signal; + noise = ( noise < 0 ) ? noise + 0x100 : noise; + + iwe.u.qual.level = (u8)signal; /* -192 : 63 */ + iwe.u.qual.noise = (u8)noise; /* -192 : 63 */ + iwe.u.qual.qual = snr; /* 0 : 255 */ + iwe.u.qual.updated = 0; +#if WIRELESS_EXT > 16 + iwe.u.qual.updated |= IW_QUAL_LEVEL_UPDATED | IW_QUAL_NOISE_UPDATED | + IW_QUAL_QUAL_UPDATED; +#if WIRELESS_EXT > 18 + iwe.u.qual.updated |= IW_QUAL_DBM; +#endif +#endif + r = uf_iwe_stream_add_event(info, start_buf, end_buf, &iwe, IW_EV_QUAL_LEN); + if (r < 0) { + return r; + } + start_buf += r; + + /* Add encryption capability */ + iwe.cmd = SIOCGIWENCODE; + if (capabilities & SIG_CAP_PRIVACY) { + iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; + } else { + iwe.u.data.flags = IW_ENCODE_DISABLED; + } + iwe.u.data.length = 0; + iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; + r = uf_iwe_stream_add_point(info, start_buf, end_buf, &iwe, ""); + if (r < 0) { + return r; + } + start_buf += r; + + + /* + * Rate : stuffing multiple values in a single event require a bit + * more of magic - Jean II + */ + current_val = start_buf + IW_EV_LCP_LEN; + + iwe.cmd = SIOCGIWRATE; + /* Those two flags are ignored... */ + iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; + + elem = unifi_find_info_element(IE_SUPPORTED_RATES_ID, + info_elems, info_elem_len); + if (elem) { + int e_len = elem[1]; + const unsigned char *e_ptr = elem + 2; + + /* + * Count how many rates we have. + * Zero marks the end of the list, if the list is not truncated. + */ + /* Max 8 values */ + for (i = 0; i < e_len; i++) { + if (e_ptr[i] == 0) { + break; + } + /* Bit rate given in 500 kb/s units (+ 0x80) */ + iwe.u.bitrate.value = ((e_ptr[i] & 0x7f) * 500000); + /* Add new value to event */ + r = uf_iwe_stream_add_value(info, start_buf, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); + if (r < 0) { + return r; + } + current_val +=r; + + } + } + elem = unifi_find_info_element(IE_EXTENDED_SUPPORTED_RATES_ID, + info_elems, info_elem_len); + if (elem) { + int e_len = elem[1]; + const unsigned char *e_ptr = elem + 2; + + /* + * Count how many rates we have. + * Zero marks the end of the list, if the list is not truncated. + */ + /* Max 8 values */ + for (i = 0; i < e_len; i++) { + if (e_ptr[i] == 0) { + break; + } + /* Bit rate given in 500 kb/s units (+ 0x80) */ + iwe.u.bitrate.value = ((e_ptr[i] & 0x7f) * 500000); + /* Add new value to event */ + r = uf_iwe_stream_add_value(info, start_buf, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); + if (r < 0) { + return r; + } + current_val +=r; + } + } + /* Check if we added any rates event */ + if ((current_val - start_buf) > IW_EV_LCP_LEN) { + start_buf = current_val; + } + + +#if WIRELESS_EXT > 17 + memset(&iwe, 0, sizeof(iwe)); + iwe.cmd = IWEVGENIE; + iwe.u.data.length = info_elem_len; + + r = uf_iwe_stream_add_point(info, start_buf, end_buf, &iwe, info_elems); + if (r < 0) { + return r; + } + + start_buf += r; +#endif /* WE > 17 */ + + return (start_buf - current_ev); +} /* unifi_translate_scan() */ + + + +static int +unifi_giwscan(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + struct iw_point *dwrq = &wrqu->data; + int r; + + CHECK_INITED(priv); + + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + unifi_error(priv, "unifi_giwscan: not permitted in Mode %d\n", + interfacePriv->interfaceMode); + return -EPERM; + } + + + unifi_trace(priv, UDBG1, + "unifi_giwscan: buffer (%d bytes) \n", + dwrq->length); + UF_RTNL_UNLOCK(); + r = sme_mgt_scan_results_get_async(priv, info, extra, dwrq->length); + UF_RTNL_LOCK(); + if (r < 0) { + unifi_trace(priv, UDBG1, + "unifi_giwscan: buffer (%d bytes) not big enough.\n", + dwrq->length); + return r; + } + + dwrq->length = r; + dwrq->flags = 0; + + return 0; +} /* unifi_giwscan() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_siwessid + * + * Request to join a network or start and AdHoc. + * + * Arguments: + * dev Pointer to network device struct. + * info Pointer to broken-out ioctl request. + * data Pointer to argument data. + * essid Pointer to string giving name of network to join + * or start + * + * Returns: + * 0 on success and everything complete + * -EINPROGRESS to have the higher level call the commit method. + * --------------------------------------------------------------------------- + */ +static int +unifi_siwessid(struct net_device *dev, struct iw_request_info *info, + struct iw_point *data, char *essid) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + int len; + int err = 0; + + func_enter(); + CHECK_INITED(priv); + + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + unifi_error(priv, "unifi_siwessid: not permitted in Mode %d\n", + interfacePriv->interfaceMode); + return -EPERM; + } + + + len = 0; + if (data->flags & 1) { + /* Limit length */ + len = data->length; + if (len > UNIFI_MAX_SSID_LEN) { + len = UNIFI_MAX_SSID_LEN; + } + } + +#ifdef UNIFI_DEBUG + { + char essid_str[UNIFI_MAX_SSID_LEN+1]; + int i; + + for (i = 0; i < len; i++) { + essid_str[i] = (isprint(essid[i]) ? essid[i] : '?'); + } + essid_str[i] = '\0'; + + unifi_trace(priv, UDBG1, "unifi_siwessid: asked for '%*s' (%d)\n", len, essid_str, len); + unifi_trace(priv, UDBG2, " with authModeMask = %d", priv->connection_config.authModeMask); + } +#endif + + memset(priv->connection_config.bssid.a, 0xFF, ETH_ALEN); + if (len) { + if (essid[len - 1] == 0) { + len --; + } + + memcpy(priv->connection_config.ssid.ssid, essid, len); + priv->connection_config.ssid.length = len; + + } else { + priv->connection_config.ssid.length = 0; + } + + UF_RTNL_UNLOCK(); + err = sme_mgt_connect(priv); + UF_RTNL_LOCK(); + if (err) { + unifi_error(priv, "unifi_siwessid: Join failed, status %d\n", err); + func_exit(); + return convert_sme_error(err); + } + + func_exit(); + return 0; +} /* unifi_siwessid() */ + + +static int +unifi_giwessid(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *essid) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + struct iw_point *data = &wrqu->essid; + CsrWifiSmeConnectionInfo connectionInfo; + int r = 0; + + func_enter(); + unifi_trace(priv, UDBG2, "unifi_giwessid\n"); + CHECK_INITED(priv); + + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + unifi_error(priv, "unifi_giwessid: not permitted in Mode %d\n", + interfacePriv->interfaceMode); + return -EPERM; + } + + UF_RTNL_UNLOCK(); + r = sme_mgt_connection_info_get(priv, &connectionInfo); + UF_RTNL_LOCK(); + + if (r == 0) { + data->length = connectionInfo.ssid.length; + strncpy(essid, + connectionInfo.ssid.ssid, + data->length); + data->flags = 1; /* active */ + + unifi_trace(priv, UDBG2, "unifi_giwessid: %.*s\n", + data->length, essid); + } + + func_exit(); + + return 0; +} /* unifi_giwessid() */ + + +static int +unifi_siwrate(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + struct iw_param *args = &wrqu->bitrate; + CsrWifiSmeMibConfig mibConfig; + int r; + + func_enter(); + + CHECK_INITED(priv); + unifi_trace(priv, UDBG2, "unifi_siwrate\n"); + + /* + * If args->fixed == 0, value is max rate or -1 for best + * If args->fixed == 1, value is rate to set or -1 for best + * args->disabled and args->flags are not used in SIOCSIWRATE + */ + + /* Get, modify and set the MIB data */ + UF_RTNL_UNLOCK(); + r = sme_mgt_mib_config_get(priv, &mibConfig); + UF_RTNL_LOCK(); + if (r) { + unifi_error(priv, "unifi_siwrate: Get CsrWifiSmeMibConfigValue failed.\n"); + return r; + } + + /* Default to auto rate algorithm */ + /* in 500Kbit/s, 0 means auto */ + mibConfig.unifiFixTxDataRate = 0; + + if (args->value != -1) { + mibConfig.unifiFixTxDataRate = args->value / 500000; + } + + /* 1 means rate is a maximum, 2 means rate is a set value */ + if (args->fixed == 1) { + mibConfig.unifiFixMaxTxDataRate = 0; + } else { + mibConfig.unifiFixMaxTxDataRate = 1; + } + UF_RTNL_UNLOCK(); + r = sme_mgt_mib_config_set(priv, &mibConfig); + UF_RTNL_LOCK(); + if (r) { + unifi_error(priv, "unifi_siwrate: Set CsrWifiSmeMibConfigValue failed.\n"); + return r; + } + + func_exit(); + + return 0; +} /* unifi_siwrate() */ + + + +static int +unifi_giwrate(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + struct iw_param *args = &wrqu->bitrate; + int r; + int bitrate, flag; + CsrWifiSmeMibConfig mibConfig; + CsrWifiSmeConnectionStats connectionStats; + + func_enter(); + unifi_trace(priv, UDBG2, "unifi_giwrate\n"); + CHECK_INITED(priv); + + flag = 0; + bitrate = 0; + UF_RTNL_UNLOCK(); + r = sme_mgt_mib_config_get(priv, &mibConfig); + UF_RTNL_LOCK(); + if (r) { + unifi_error(priv, "unifi_giwrate: Get CsrWifiSmeMibConfigValue failed.\n"); + return r; + } + + bitrate = mibConfig.unifiFixTxDataRate; + flag = mibConfig.unifiFixMaxTxDataRate; + + /* Used the value returned by the SME if MIB returns 0 */ + if (bitrate == 0) { + UF_RTNL_UNLOCK(); + r = sme_mgt_connection_stats_get(priv, &connectionStats); + UF_RTNL_LOCK(); + /* Ignore errors, we may be disconnected */ + if (r == 0) { + bitrate = connectionStats.unifiTxDataRate; + } + } + + args->value = bitrate * 500000; + args->fixed = !flag; + + func_exit(); + + return 0; +} /* unifi_giwrate() */ + + +static int +unifi_siwrts(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + int val = wrqu->rts.value; + int r = 0; + CsrWifiSmeMibConfig mibConfig; + + unifi_trace(priv, UDBG2, "unifi_siwrts\n"); + CHECK_INITED(priv); + + if (wrqu->rts.disabled) { + val = 2347; + } + + if ( (val < 0) || (val > 2347) ) + { + return -EINVAL; + } + + /* Get, modify and set the MIB data */ + UF_RTNL_UNLOCK(); + r = sme_mgt_mib_config_get(priv, &mibConfig); + UF_RTNL_LOCK(); + if (r) { + unifi_error(priv, "unifi_siwrts: Get CsrWifiSmeMibConfigValue failed.\n"); + return r; + } + mibConfig.dot11RtsThreshold = val; + UF_RTNL_UNLOCK(); + r = sme_mgt_mib_config_set(priv, &mibConfig); + UF_RTNL_LOCK(); + if (r) { + unifi_error(priv, "unifi_siwrts: Set CsrWifiSmeMibConfigValue failed.\n"); + return r; + } + + return 0; +} + + +static int +unifi_giwrts(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + int r; + int rts_thresh; + CsrWifiSmeMibConfig mibConfig; + + unifi_trace(priv, UDBG2, "unifi_giwrts\n"); + CHECK_INITED(priv); + + UF_RTNL_UNLOCK(); + r = sme_mgt_mib_config_get(priv, &mibConfig); + UF_RTNL_LOCK(); + if (r) { + unifi_error(priv, "unifi_giwrts: Get CsrWifiSmeMibConfigValue failed.\n"); + return r; + } + + rts_thresh = mibConfig.dot11RtsThreshold; + if (rts_thresh > 2347) { + rts_thresh = 2347; + } + + wrqu->rts.value = rts_thresh; + wrqu->rts.disabled = (rts_thresh == 2347); + wrqu->rts.fixed = 1; + + return 0; +} + + +static int +unifi_siwfrag(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + int val = wrqu->frag.value; + int r = 0; + CsrWifiSmeMibConfig mibConfig; + + unifi_trace(priv, UDBG2, "unifi_siwfrag\n"); + CHECK_INITED(priv); + + if (wrqu->frag.disabled) + val = 2346; + + if ( (val < 256) || (val > 2347) ) + return -EINVAL; + + /* Get, modify and set the MIB data */ + UF_RTNL_UNLOCK(); + r = sme_mgt_mib_config_get(priv, &mibConfig); + UF_RTNL_LOCK(); + if (r) { + unifi_error(priv, "unifi_siwfrag: Get CsrWifiSmeMibConfigValue failed.\n"); + return r; + } + /* Fragmentation Threashold must be even */ + mibConfig.dot11FragmentationThreshold = (val & ~0x1); + UF_RTNL_UNLOCK(); + r = sme_mgt_mib_config_set(priv, &mibConfig); + UF_RTNL_LOCK(); + if (r) { + unifi_error(priv, "unifi_siwfrag: Set CsrWifiSmeMibConfigValue failed.\n"); + return r; + } + + return 0; +} + + +static int +unifi_giwfrag(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + int r; + int frag_thresh; + CsrWifiSmeMibConfig mibConfig; + + unifi_trace(priv, UDBG2, "unifi_giwfrag\n"); + CHECK_INITED(priv); + + UF_RTNL_UNLOCK(); + r = sme_mgt_mib_config_get(priv, &mibConfig); + UF_RTNL_LOCK(); + if (r) { + unifi_error(priv, "unifi_giwfrag: Get CsrWifiSmeMibConfigValue failed.\n"); + return r; + } + + frag_thresh = mibConfig.dot11FragmentationThreshold; + + /* Build the return structure */ + wrqu->frag.value = frag_thresh; + wrqu->frag.disabled = (frag_thresh >= 2346); + wrqu->frag.fixed = 1; + + return 0; +} + + +static int +unifi_siwencode(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + struct iw_point *erq = &wrqu->encoding; + int index; + int rc = 0; + int privacy = -1; + CsrWifiSmeKey sme_key; + + func_enter(); + unifi_trace(priv, UDBG2, "unifi_siwencode\n"); + + CHECK_INITED(priv); + + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + unifi_error(priv, "unifi_siwencode: not permitted in Mode %d\n", + interfacePriv->interfaceMode); + return -EPERM; + } + + + /* + * Key index is encoded in the flags. + * 0 - use current default, + * 1-4 - if a key value is given set that key + * if not use that key + */ + index = (erq->flags & IW_ENCODE_INDEX); /* key number, 1-4 */ + if ((index < 0) || (index > 4)) { + unifi_error(priv, "unifi_siwencode: Request to set an invalid key (index:%d)", index); + return -EINVAL; + } + + /* + * Basic checking: do we have a key to set ? + * The IW_ENCODE_NOKEY flag is set when no key is present (only change flags), + * but older versions rely on sending a key id 1-4. + */ + if (erq->length > 0) { + + /* Check the size of the key */ + if ((erq->length > LARGE_KEY_SIZE) || (erq->length < SMALL_KEY_SIZE)) { + unifi_error(priv, "unifi_siwencode: Request to set an invalid key (length:%d)", + erq->length); + return -EINVAL; + } + + /* Check the index (none (i.e. 0) means use current) */ + if ((index < 1) || (index > 4)) { + /* If we do not have a previous key, use 1 as default */ + if (!priv->wep_tx_key_index) { + priv->wep_tx_key_index = 1; + } + index = priv->wep_tx_key_index; + } + + /* If we didn't have a key and a valid index is set, we want to remember it*/ + if (!priv->wep_tx_key_index) { + priv->wep_tx_key_index = index; + } + + unifi_trace(priv, UDBG1, "Tx key Index is %d\n", priv->wep_tx_key_index); + + privacy = 1; + + /* Check if the key is not marked as invalid */ + if ((erq->flags & IW_ENCODE_NOKEY) == 0) { + + unifi_trace(priv, UDBG1, "New %s key (len=%d, index=%d)\n", + (priv->wep_tx_key_index == index) ? "tx" : "", + erq->length, index); + + sme_key.wepTxKey = (priv->wep_tx_key_index == index); + if (priv->wep_tx_key_index == index) { + sme_key.keyType = CSR_WIFI_SME_KEY_TYPE_PAIRWISE; + } else { + sme_key.keyType = CSR_WIFI_SME_KEY_TYPE_GROUP; + } + /* Key index is zero based in SME but 1 based in wext */ + sme_key.keyIndex = (index - 1); + sme_key.keyLength = erq->length; + sme_key.authenticator = 0; + memset(sme_key.address.a, 0xFF, ETH_ALEN); + memcpy(sme_key.key, extra, erq->length); + + UF_RTNL_UNLOCK(); + rc = sme_mgt_key(priv, &sme_key, CSR_WIFI_SME_LIST_ACTION_ADD); + UF_RTNL_LOCK(); + if (rc) { + unifi_error(priv, "unifi_siwencode: Set key failed (%d)", rc); + return convert_sme_error(rc); + } + + /* Store the key to be reported by the SIOCGIWENCODE handler */ + priv->wep_keys[index - 1].len = erq->length; + memcpy(priv->wep_keys[index - 1].key, extra, erq->length); + } + } else { + /* + * No additional key data, so it must be a request to change the + * active key. + */ + if (index != 0) { + unifi_trace(priv, UDBG1, "Tx key Index is %d\n", index - 1); + + /* Store the index to be reported by the SIOCGIWENCODE handler */ + priv->wep_tx_key_index = index; + + sme_key.wepTxKey = 1; + sme_key.keyType = CSR_WIFI_SME_KEY_TYPE_PAIRWISE; + + /* Key index is zero based in SME but 1 based in wext */ + sme_key.keyIndex = (index - 1); + sme_key.keyLength = 0; + sme_key.authenticator = 0; + UF_RTNL_UNLOCK(); + rc = sme_mgt_key(priv, &sme_key, CSR_WIFI_SME_LIST_ACTION_ADD); + UF_RTNL_LOCK(); + if (rc) { + unifi_error(priv, "unifi_siwencode: Set key failed (%d)", rc); + return convert_sme_error(rc); + } + + /* Turn on encryption */ + privacy = 1; + } + } + + /* Read the flags */ + if (erq->flags & IW_ENCODE_DISABLED) { + /* disable encryption */ + unifi_trace(priv, UDBG1, "disable WEP encryption\n"); + privacy = 0; + + priv->wep_tx_key_index = 0; + + unifi_trace(priv, UDBG1, "IW_ENCODE_DISABLED: CSR_WIFI_SME_AUTH_MODE_80211_OPEN\n"); + priv->connection_config.authModeMask = CSR_WIFI_SME_AUTH_MODE_80211_OPEN; + } + + if (erq->flags & IW_ENCODE_RESTRICTED) { + /* Use shared key auth */ + unifi_trace(priv, UDBG1, "IW_ENCODE_RESTRICTED: CSR_WIFI_SME_AUTH_MODE_80211_SHARED\n"); + priv->connection_config.authModeMask = CSR_WIFI_SME_AUTH_MODE_80211_SHARED; + + /* Turn on encryption */ + privacy = 1; + } + if (erq->flags & IW_ENCODE_OPEN) { + unifi_trace(priv, UDBG1, "IW_ENCODE_OPEN: CSR_WIFI_SME_AUTH_MODE_80211_OPEN\n"); + priv->connection_config.authModeMask = CSR_WIFI_SME_AUTH_MODE_80211_OPEN; + } + + /* Commit the changes to flags if needed */ + if (privacy != -1) { + priv->connection_config.privacyMode = privacy ? CSR_WIFI_SME_80211_PRIVACY_MODE_ENABLED : CSR_WIFI_SME_80211_PRIVACY_MODE_DISABLED; + priv->connection_config.encryptionModeMask = privacy ? (CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP40 | + CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP104 | + CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP40 | + CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP104) : + CSR_WIFI_SME_ENCRYPTION_CIPHER_NONE; + } + + func_exit_r(rc); + return convert_sme_error(rc); + +} /* unifi_siwencode() */ + + + +static int +unifi_giwencode(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + struct iw_point *erq = &wrqu->encoding; + + unifi_trace(priv, UDBG2, "unifi_giwencode\n"); + + CHECK_INITED(priv); + + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + unifi_error(priv, "unifi_giwencode: not permitted in Mode %d\n", + interfacePriv->interfaceMode); + return -EPERM; + } + + + if (priv->connection_config.authModeMask == CSR_WIFI_SME_AUTH_MODE_80211_SHARED) { + erq->flags = IW_ENCODE_RESTRICTED; + } + else { + if (priv->connection_config.privacyMode == CSR_WIFI_SME_80211_PRIVACY_MODE_DISABLED) { + erq->flags = IW_ENCODE_DISABLED; + } else { + erq->flags = IW_ENCODE_OPEN; + } + } + + erq->length = 0; + + if (erq->flags != IW_ENCODE_DISABLED) { + int index = priv->wep_tx_key_index; + + if ((index > 0) && (index <= NUM_WEPKEYS)) { + erq->flags |= (index & IW_ENCODE_INDEX); + erq->length = priv->wep_keys[index - 1].len; + memcpy(extra, priv->wep_keys[index - 1].key, erq->length); + } else { + unifi_notice(priv, "unifi_giwencode: Surprise, do not have a valid key index (%d)\n", + index); + } + } + + return 0; +} /* unifi_giwencode() */ + + +static int +unifi_siwpower(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct iw_param *args = &wrqu->power; + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + int listen_interval, wake_for_dtim; + int r = 0; + CsrWifiSmePowerConfig powerConfig; + + unifi_trace(priv, UDBG2, "unifi_siwpower\n"); + + CHECK_INITED(priv); + + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + unifi_error(priv, "unifi_siwpower: not permitted in Mode %d\n", + interfacePriv->interfaceMode); + return -EPERM; + } + + UF_RTNL_UNLOCK(); + r = sme_mgt_power_config_get(priv, &powerConfig); + UF_RTNL_LOCK(); + if (r) { + unifi_error(priv, "unifi_siwpower: Get unifi_PowerConfigValue failed.\n"); + return r; + } + + listen_interval = -1; + wake_for_dtim = -1; + if (args->disabled) { + powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW; + } + else + { + powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_HIGH; + + switch (args->flags & IW_POWER_TYPE) { + case 0: + /* not specified */ + break; + case IW_POWER_PERIOD: + listen_interval = args->value / 1000; + break; + default: + return -EINVAL; + } + + switch (args->flags & IW_POWER_MODE) { + case 0: + /* not specified */ + break; + case IW_POWER_UNICAST_R: + /* not interested in broadcast packets */ + wake_for_dtim = 0; + break; + case IW_POWER_ALL_R: + /* yes, we are interested in broadcast packets */ + wake_for_dtim = 1; + break; + default: + return -EINVAL; + } + } + + if (listen_interval > 0) { + powerConfig.listenIntervalTu = listen_interval; + unifi_trace(priv, UDBG4, "unifi_siwpower: new Listen Interval = %d.\n", + powerConfig.listenIntervalTu); + } + + if (wake_for_dtim >= 0) { + powerConfig.rxDtims = wake_for_dtim; + } + UF_RTNL_UNLOCK(); + r = sme_mgt_power_config_set(priv, &powerConfig); + UF_RTNL_LOCK(); + if (r) { + unifi_error(priv, "unifi_siwpower: Set unifi_PowerConfigValue failed.\n"); + return r; + } + + return 0; +} /* unifi_siwpower() */ + + +static int +unifi_giwpower(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct iw_param *args = &wrqu->power; + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + CsrWifiSmePowerConfig powerConfig; + int r; + + unifi_trace(priv, UDBG2, "unifi_giwpower\n"); + + CHECK_INITED(priv); + + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + unifi_error(priv, "unifi_giwpower: not permitted in Mode %d\n", + interfacePriv->interfaceMode); + return -EPERM; + } + + + args->flags = 0; + UF_RTNL_UNLOCK(); + r = sme_mgt_power_config_get(priv, &powerConfig); + UF_RTNL_LOCK(); + if (r) { + unifi_error(priv, "unifi_giwpower: Get unifi_PowerConfigValue failed.\n"); + return r; + } + + unifi_trace(priv, UDBG4, "unifi_giwpower: mode=%d\n", + powerConfig.powerSaveLevel); + + args->disabled = (powerConfig.powerSaveLevel == CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW); + if (args->disabled) { + args->flags = 0; + return 0; + } + + args->value = powerConfig.listenIntervalTu * 1000; + args->flags |= IW_POWER_PERIOD; + + if (powerConfig.rxDtims) { + args->flags |= IW_POWER_ALL_R; + } else { + args->flags |= IW_POWER_UNICAST_R; + } + + return 0; +} /* unifi_giwpower() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_siwcommit - handler for SIOCSIWCOMMIT + * + * Apply all the parameters that have been set. + * In practice this means: + * - do a scan + * - join a network or start an AdHoc + * - authenticate and associate. + * + * Arguments: + * None. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +static int +unifi_siwcommit(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + return 0; +} /* unifi_siwcommit() */ + + + +static int +unifi_siwmlme(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + struct iw_mlme *mlme = (struct iw_mlme *)extra; + func_enter(); + + unifi_trace(priv, UDBG2, "unifi_siwmlme\n"); + CHECK_INITED(priv); + + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + unifi_error(priv, "unifi_siwmlme: not permitted in Mode %d\n", + interfacePriv->interfaceMode); + return -EPERM; + } + + + switch (mlme->cmd) { + case IW_MLME_DEAUTH: + case IW_MLME_DISASSOC: + UF_RTNL_UNLOCK(); + sme_mgt_disconnect(priv); + UF_RTNL_LOCK(); + break; + default: + func_exit_r(-EOPNOTSUPP); + return -EOPNOTSUPP; + } + + func_exit(); + return 0; +} /* unifi_siwmlme() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_siwgenie + * unifi_giwgenie + * + * WPA : Generic IEEE 802.11 information element (e.g., for WPA/RSN/WMM). + * Handlers for SIOCSIWGENIE, SIOCGIWGENIE - set/get generic IE + * + * The host program (e.g. wpa_supplicant) uses this call to set the + * additional IEs to accompany the next (Associate?) request. + * + * Arguments: + * None. + * + * Returns: + * None. + * Notes: + * From wireless.h: + * This ioctl uses struct iw_point and data buffer that includes IE id + * and len fields. More than one IE may be included in the + * request. Setting the generic IE to empty buffer (len=0) removes the + * generic IE from the driver. + * --------------------------------------------------------------------------- + */ +static int +unifi_siwgenie(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + int len; + + func_enter(); + unifi_trace(priv, UDBG2, "unifi_siwgenie\n"); + + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + unifi_error(priv, "unifi_siwgenie: not permitted in Mode %d\n", + interfacePriv->interfaceMode); + return -EPERM; + } + + + if ( priv->connection_config.mlmeAssociateReqInformationElements) { + kfree( priv->connection_config.mlmeAssociateReqInformationElements); + } + priv->connection_config.mlmeAssociateReqInformationElementsLength = 0; + priv->connection_config.mlmeAssociateReqInformationElements = NULL; + + len = wrqu->data.length; + if (len == 0) { + func_exit(); + return 0; + } + + priv->connection_config.mlmeAssociateReqInformationElements = kmalloc(len, GFP_KERNEL); + if (priv->connection_config.mlmeAssociateReqInformationElements == NULL) { + func_exit(); + return -ENOMEM; + } + + priv->connection_config.mlmeAssociateReqInformationElementsLength = len; + memcpy( priv->connection_config.mlmeAssociateReqInformationElements, extra, len); + + func_exit(); + return 0; +} /* unifi_siwgenie() */ + + +static int +unifi_giwgenie(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + int len; + + func_enter(); + unifi_trace(priv, UDBG2, "unifi_giwgenie\n"); + + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + unifi_error(priv, "unifi_giwgenie: not permitted in Mode %d\n", + interfacePriv->interfaceMode); + return -EPERM; + } + + + len = priv->connection_config.mlmeAssociateReqInformationElementsLength; + + if (len == 0) { + wrqu->data.length = 0; + return 0; + } + + if (wrqu->data.length < len) { + return -E2BIG; + } + + wrqu->data.length = len; + memcpy(extra, priv->connection_config.mlmeAssociateReqInformationElements, len); + + func_exit(); + return 0; +} /* unifi_giwgenie() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_siwauth + * unifi_giwauth + * + * Handlers for SIOCSIWAUTH, SIOCGIWAUTH + * Set/get various authentication parameters. + * + * Arguments: + * + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +static int +_unifi_siwauth(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + CsrWifiSmeAuthModeMask new_auth; + + func_enter(); + unifi_trace(priv, UDBG2, "unifi_siwauth\n"); + + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + unifi_error(priv, "unifi_siwauth: not permitted in Mode %d\n", + interfacePriv->interfaceMode); + return -EPERM; + } + + + /* + * This ioctl is safe to call even when UniFi is powered off. + * wpa_supplicant calls it to test whether we support WPA. + */ + + switch (wrqu->param.flags & IW_AUTH_INDEX) { + + case IW_AUTH_WPA_ENABLED: + unifi_trace(priv, UDBG1, "IW_AUTH_WPA_ENABLED: %d\n", wrqu->param.value); + + if (wrqu->param.value == 0) { + unifi_trace(priv, UDBG5, "IW_AUTH_WPA_ENABLED: CSR_WIFI_SME_AUTH_MODE_80211_OPEN\n"); + priv->connection_config.authModeMask = CSR_WIFI_SME_AUTH_MODE_80211_OPEN; + } + break; + + case IW_AUTH_PRIVACY_INVOKED: + unifi_trace(priv, UDBG1, "IW_AUTH_PRIVACY_INVOKED: %d\n", wrqu->param.value); + + priv->connection_config.privacyMode = wrqu->param.value ? CSR_WIFI_SME_80211_PRIVACY_MODE_ENABLED : CSR_WIFI_SME_80211_PRIVACY_MODE_DISABLED; + if (wrqu->param.value == CSR_WIFI_SME_80211_PRIVACY_MODE_DISABLED) + { + priv->connection_config.encryptionModeMask = CSR_WIFI_SME_ENCRYPTION_CIPHER_NONE; + } + break; + + case IW_AUTH_80211_AUTH_ALG: + /* + IW_AUTH_ALG_OPEN_SYSTEM 0x00000001 + IW_AUTH_ALG_SHARED_KEY 0x00000002 + IW_AUTH_ALG_LEAP 0x00000004 + */ + new_auth = 0; + if (wrqu->param.value & IW_AUTH_ALG_OPEN_SYSTEM) { + unifi_trace(priv, UDBG1, "IW_AUTH_80211_AUTH_ALG: %d (IW_AUTH_ALG_OPEN_SYSTEM)\n", wrqu->param.value); + new_auth |= CSR_WIFI_SME_AUTH_MODE_80211_OPEN; + } + if (wrqu->param.value & IW_AUTH_ALG_SHARED_KEY) { + unifi_trace(priv, UDBG1, "IW_AUTH_80211_AUTH_ALG: %d (IW_AUTH_ALG_SHARED_KEY)\n", wrqu->param.value); + new_auth |= CSR_WIFI_SME_AUTH_MODE_80211_SHARED; + } + if (wrqu->param.value & IW_AUTH_ALG_LEAP) { + /* Initial exchanges using open-system to set EAP */ + unifi_trace(priv, UDBG1, "IW_AUTH_80211_AUTH_ALG: %d (IW_AUTH_ALG_LEAP)\n", wrqu->param.value); + new_auth |= CSR_WIFI_SME_AUTH_MODE_8021X_OTHER1X; + } + if (new_auth == 0) { + unifi_trace(priv, UDBG1, "IW_AUTH_80211_AUTH_ALG: invalid value %d\n", + wrqu->param.value); + return -EINVAL; + } else { + priv->connection_config.authModeMask = new_auth; + } + break; + + case IW_AUTH_WPA_VERSION: + unifi_trace(priv, UDBG1, "IW_AUTH_WPA_VERSION: %d\n", wrqu->param.value); + priv->ignore_bssid_join = TRUE; + /* + IW_AUTH_WPA_VERSION_DISABLED 0x00000001 + IW_AUTH_WPA_VERSION_WPA 0x00000002 + IW_AUTH_WPA_VERSION_WPA2 0x00000004 + */ + + if (!(wrqu->param.value & IW_AUTH_WPA_VERSION_DISABLED)) { + + priv->connection_config.authModeMask = CSR_WIFI_SME_AUTH_MODE_80211_OPEN; + + if (wrqu->param.value & IW_AUTH_WPA_VERSION_WPA) { + unifi_trace(priv, UDBG4, "IW_AUTH_WPA_VERSION: WPA, WPA-PSK\n"); + priv->connection_config.authModeMask |= (CSR_WIFI_SME_AUTH_MODE_8021X_WPA | CSR_WIFI_SME_AUTH_MODE_8021X_WPAPSK); + } + if (wrqu->param.value & IW_AUTH_WPA_VERSION_WPA2) { + unifi_trace(priv, UDBG4, "IW_AUTH_WPA_VERSION: WPA2, WPA2-PSK\n"); + priv->connection_config.authModeMask |= (CSR_WIFI_SME_AUTH_MODE_8021X_WPA2 | CSR_WIFI_SME_AUTH_MODE_8021X_WPA2PSK); + } + } + break; + + case IW_AUTH_CIPHER_PAIRWISE: + unifi_trace(priv, UDBG1, "IW_AUTH_CIPHER_PAIRWISE: %d\n", wrqu->param.value); + /* + * one of: + IW_AUTH_CIPHER_NONE 0x00000001 + IW_AUTH_CIPHER_WEP40 0x00000002 + IW_AUTH_CIPHER_TKIP 0x00000004 + IW_AUTH_CIPHER_CCMP 0x00000008 + IW_AUTH_CIPHER_WEP104 0x00000010 + */ + + priv->connection_config.encryptionModeMask = CSR_WIFI_SME_ENCRYPTION_CIPHER_NONE; + + if (wrqu->param.value & IW_AUTH_CIPHER_WEP40) { + priv->connection_config.encryptionModeMask |= + CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP40 | CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP40; + } + if (wrqu->param.value & IW_AUTH_CIPHER_WEP104) { + priv->connection_config.encryptionModeMask |= + CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP104 | CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP104; + } + if (wrqu->param.value & IW_AUTH_CIPHER_TKIP) { + priv->connection_config.encryptionModeMask |= + CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_TKIP | CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_TKIP; + } + if (wrqu->param.value & IW_AUTH_CIPHER_CCMP) { + priv->connection_config.encryptionModeMask |= + CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_CCMP | CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_CCMP; + } + + break; + + case IW_AUTH_CIPHER_GROUP: + unifi_trace(priv, UDBG1, "IW_AUTH_CIPHER_GROUP: %d\n", wrqu->param.value); + /* + * Use the WPA version and the group cipher suite to set the permitted + * group key in the MIB. f/w uses this value to validate WPA and RSN IEs + * in the probe responses from the desired BSS(ID) + */ + + priv->connection_config.encryptionModeMask &= ~(CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP40 | + CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP104 | + CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_TKIP | + CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_CCMP); + if (wrqu->param.value & IW_AUTH_CIPHER_WEP40) { + priv->connection_config.encryptionModeMask |= CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP40; + } + if (wrqu->param.value & IW_AUTH_CIPHER_WEP104) { + priv->connection_config.encryptionModeMask |= CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP104; + } + if (wrqu->param.value & IW_AUTH_CIPHER_TKIP) { + priv->connection_config.encryptionModeMask |= CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_TKIP; + } + if (wrqu->param.value & IW_AUTH_CIPHER_CCMP) { + priv->connection_config.encryptionModeMask |= CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_CCMP; + } + + break; + + case IW_AUTH_KEY_MGMT: + unifi_trace(priv, UDBG1, "IW_AUTH_KEY_MGMT: %d\n", wrqu->param.value); + /* + IW_AUTH_KEY_MGMT_802_1X 1 + IW_AUTH_KEY_MGMT_PSK 2 + */ + if (priv->connection_config.authModeMask & (CSR_WIFI_SME_AUTH_MODE_8021X_WPA | CSR_WIFI_SME_AUTH_MODE_8021X_WPAPSK)) { + /* Check for explicitly set mode. */ + if (wrqu->param.value == IW_AUTH_KEY_MGMT_802_1X) { + priv->connection_config.authModeMask &= ~CSR_WIFI_SME_AUTH_MODE_8021X_WPAPSK; + } + if (wrqu->param.value == IW_AUTH_KEY_MGMT_PSK) { + priv->connection_config.authModeMask &= ~CSR_WIFI_SME_AUTH_MODE_8021X_WPA; + } + unifi_trace(priv, UDBG5, "IW_AUTH_KEY_MGMT: WPA: %d\n", + priv->connection_config.authModeMask); + } + if (priv->connection_config.authModeMask & (CSR_WIFI_SME_AUTH_MODE_8021X_WPA2 | CSR_WIFI_SME_AUTH_MODE_8021X_WPA2PSK)) { + /* Check for explicitly set mode. */ + if (wrqu->param.value == IW_AUTH_KEY_MGMT_802_1X) { + priv->connection_config.authModeMask &= ~CSR_WIFI_SME_AUTH_MODE_8021X_WPA2PSK; + } + if (wrqu->param.value == IW_AUTH_KEY_MGMT_PSK) { + priv->connection_config.authModeMask &= ~CSR_WIFI_SME_AUTH_MODE_8021X_WPA2; + } + unifi_trace(priv, UDBG5, "IW_AUTH_KEY_MGMT: WPA2: %d\n", + priv->connection_config.authModeMask); + } + + break; + case IW_AUTH_TKIP_COUNTERMEASURES: + /* + * Set to true at the start of the 60 second backup-off period + * following 2 MichaelMIC failures within 60s. + */ + unifi_trace(priv, UDBG1, "IW_AUTH_TKIP_COUNTERMEASURES: %d\n", wrqu->param.value); + break; + + case IW_AUTH_DROP_UNENCRYPTED: + /* + * Set to true on init. + * Set to false just before associate if encryption will not be + * required. + * + * Note this is not the same as the 802.1X controlled port + */ + unifi_trace(priv, UDBG1, "IW_AUTH_DROP_UNENCRYPTED: %d\n", wrqu->param.value); + break; + + case IW_AUTH_RX_UNENCRYPTED_EAPOL: + /* + * This is set by wpa_supplicant to allow unencrypted EAPOL messages + * even if pairwise keys are set when not using WPA. IEEE 802.1X + * specifies that these frames are not encrypted, but WPA encrypts + * them when pairwise keys are in use. + * I think the UniFi f/w handles this decision for us. + */ + unifi_trace(priv, UDBG1, "IW_AUTH_RX_UNENCRYPTED_EAPOL: %d\n", wrqu->param.value); + break; + + case IW_AUTH_ROAMING_CONTROL: + unifi_trace(priv, UDBG1, "IW_AUTH_ROAMING_CONTROL: %d\n", wrqu->param.value); + break; + + default: + unifi_trace(priv, UDBG1, "Unsupported auth param %d to 0x%X\n", + wrqu->param.flags & IW_AUTH_INDEX, + wrqu->param.value); + return -EOPNOTSUPP; + } + + unifi_trace(priv, UDBG2, "authModeMask = %d", priv->connection_config.authModeMask); + func_exit(); + + return 0; +} /* _unifi_siwauth() */ + + +static int +unifi_siwauth(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + int err = 0; + + UF_RTNL_UNLOCK(); + err = _unifi_siwauth(dev, info, wrqu, extra); + UF_RTNL_LOCK(); + + return err; +} /* unifi_siwauth() */ + + +static int +unifi_giwauth(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + unifi_trace(NULL, UDBG2, "unifi_giwauth\n"); + return -EOPNOTSUPP; +} /* unifi_giwauth() */ + +/* + * --------------------------------------------------------------------------- + * unifi_siwencodeext + * unifi_giwencodeext + * + * Handlers for SIOCSIWENCODEEXT, SIOCGIWENCODEEXT - set/get + * encoding token & mode + * + * Arguments: + * None. + * + * Returns: + * None. + * + * Notes: + * For WPA/WPA2 we don't take note of the IW_ENCODE_EXT_SET_TX_KEY flag. + * This flag means "use this key to encode transmissions"; we just + * assume only one key will be set and that is the one to use. + * --------------------------------------------------------------------------- + */ +static int +_unifi_siwencodeext(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; + int r = 0; + unsigned char *keydata; + unsigned char tkip_key[32]; + int keyid; + unsigned char *a = (unsigned char *)ext->addr.sa_data; + CsrWifiSmeKey sme_key; + CsrWifiSmeKeyType key_type; + + func_enter(); + + CHECK_INITED(priv); + + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + unifi_error(priv, "unifi_siwencodeext: not permitted in Mode %d\n", + interfacePriv->interfaceMode); + return -EPERM; + } + + + unifi_trace(priv, UDBG1, "siwencodeext: flags=0x%X, alg=%d, ext_flags=0x%X, len=%d, index=%d,\n", + wrqu->encoding.flags, ext->alg, ext->ext_flags, + ext->key_len, (wrqu->encoding.flags & IW_ENCODE_INDEX)); + unifi_trace(priv, UDBG3, " addr=%02X:%02X:%02X:%02X:%02X:%02X\n", + a[0], a[1], a[2], a[3], a[4], a[5]); + + if ((ext->key_len == 0) && (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)) { + /* This means use a different key (given by key_idx) for Tx. */ + /* NYI */ + unifi_trace(priv, UDBG1, KERN_ERR "unifi_siwencodeext: NYI should change tx key id here!!\n"); + return -ENOTSUPP; + } + + memset(&sme_key, 0, sizeof(sme_key)); + + keydata = (unsigned char *)(ext + 1); + keyid = (wrqu->encoding.flags & IW_ENCODE_INDEX); + + /* + * Check for request to delete keys for an address. + */ + /* Pick out request for no privacy. */ + if (ext->alg == IW_ENCODE_ALG_NONE) { + + unifi_trace(priv, UDBG1, "Deleting %s key %d\n", + (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) ? "GROUP" : "PAIRWISE", + keyid); + + if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { + sme_key.keyType = CSR_WIFI_SME_KEY_TYPE_GROUP; + } else { + sme_key.keyType = CSR_WIFI_SME_KEY_TYPE_PAIRWISE; + } + sme_key.keyIndex = (keyid - 1); + sme_key.keyLength = 0; + sme_key.authenticator = 0; + memcpy(sme_key.address.a, a, ETH_ALEN); + UF_RTNL_UNLOCK(); + r = sme_mgt_key(priv, &sme_key, CSR_WIFI_SME_LIST_ACTION_REMOVE); + UF_RTNL_LOCK(); + if (r) { + unifi_error(priv, "Delete key request was rejected with result %d\n", r); + return convert_sme_error(r); + } + + return 0; + } + + /* + * Request is to set a key, not delete + */ + + /* Pick out WEP and use set_wep_key(). */ + if (ext->alg == IW_ENCODE_ALG_WEP) { + /* WEP-40, WEP-104 */ + + /* Check for valid key length */ + if (!((ext->key_len == 5) || (ext->key_len == 13))) { + unifi_trace(priv, UDBG1, KERN_ERR "Invalid length for WEP key: %d\n", ext->key_len); + return -EINVAL; + } + + unifi_trace(priv, UDBG1, "Setting WEP key %d tx:%d\n", + keyid, ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY); + + if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { + sme_key.wepTxKey = TRUE; + sme_key.keyType = CSR_WIFI_SME_KEY_TYPE_PAIRWISE; + } else { + sme_key.wepTxKey = FALSE; + sme_key.keyType = CSR_WIFI_SME_KEY_TYPE_GROUP; + } + sme_key.keyIndex = (keyid - 1); + sme_key.keyLength = ext->key_len; + sme_key.authenticator = 0; + memset(sme_key.address.a, 0xFF, ETH_ALEN); + memcpy(sme_key.key, keydata, ext->key_len); + UF_RTNL_UNLOCK(); + r = sme_mgt_key(priv, &sme_key, CSR_WIFI_SME_LIST_ACTION_ADD); + UF_RTNL_LOCK(); + if (r) { + unifi_error(priv, "siwencodeext: Set key failed (%d)", r); + return convert_sme_error(r); + } + + return 0; + } + + /* + * + * If we reach here, we are dealing with a WPA/WPA2 key + * + */ + if (ext->key_len > 32) { + return -EINVAL; + } + + /* + * TKIP keys from wpa_supplicant need swapping. + * What about other supplicants (when they come along)? + */ + if ((ext->alg == IW_ENCODE_ALG_TKIP) && (ext->key_len == 32)) { + memcpy(tkip_key, keydata, 16); + memcpy(tkip_key + 16, keydata + 24, 8); + memcpy(tkip_key + 24, keydata + 16, 8); + keydata = tkip_key; + } + + key_type = (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) ? + CSR_WIFI_SME_KEY_TYPE_GROUP : /* Group Key */ + CSR_WIFI_SME_KEY_TYPE_PAIRWISE; /* Pairwise Key */ + + sme_key.keyType = key_type; + sme_key.keyIndex = (keyid - 1); + sme_key.keyLength = ext->key_len; + sme_key.authenticator = 0; + memcpy(sme_key.address.a, ext->addr.sa_data, ETH_ALEN); + if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { + + unifi_trace(priv, UDBG5, "RSC first 6 bytes = %02X:%02X:%02X:%02X:%02X:%02X\n", + ext->rx_seq[0], ext->rx_seq[1], ext->rx_seq[2], ext->rx_seq[3], ext->rx_seq[4], ext->rx_seq[5]); + + /* memcpy((u8*)(&sme_key.keyRsc), ext->rx_seq, 8); */ + sme_key.keyRsc[0] = ext->rx_seq[1] << 8 | ext->rx_seq[0]; + sme_key.keyRsc[1] = ext->rx_seq[3] << 8 | ext->rx_seq[2]; + sme_key.keyRsc[2] = ext->rx_seq[5] << 8 | ext->rx_seq[4]; + sme_key.keyRsc[3] = ext->rx_seq[7] << 8 | ext->rx_seq[6]; + + } + + memcpy(sme_key.key, keydata, ext->key_len); + UF_RTNL_UNLOCK(); + r = sme_mgt_key(priv, &sme_key, CSR_WIFI_SME_LIST_ACTION_ADD); + UF_RTNL_LOCK(); + if (r) { + unifi_error(priv, "SETKEYS request was rejected with result %d\n", r); + return convert_sme_error(r); + } + + func_exit(); + return r; +} /* _unifi_siwencodeext() */ + + +static int +unifi_siwencodeext(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + int err = 0; + + err = _unifi_siwencodeext(dev, info, wrqu, extra); + + return err; +} /* unifi_siwencodeext() */ + + +static int +unifi_giwencodeext(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + return -EOPNOTSUPP; +} /* unifi_giwencodeext() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_siwpmksa + * + * SIOCSIWPMKSA - PMKSA cache operation + * The caller passes a pmksa structure: + * - cmd one of ADD, REMOVE, FLUSH + * - bssid MAC address + * - pmkid ID string (16 bytes) + * + * Arguments: + * None. + * + * Returns: + * None. + * + * Notes: + * This is not needed since we provide a siwgenie method. + * --------------------------------------------------------------------------- + */ +#define UNIFI_PMKID_KEY_SIZE 16 +static int +unifi_siwpmksa(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + struct iw_pmksa *pmksa = (struct iw_pmksa *)extra; + CsrResult r = 0; + CsrWifiSmePmkidList pmkid_list; + CsrWifiSmePmkid pmkid; + CsrWifiSmeListAction action; + + CHECK_INITED(priv); + + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + unifi_error(priv, "unifi_siwpmksa: not permitted in Mode %d\n", + interfacePriv->interfaceMode); + return -EPERM; + } + + + unifi_trace(priv, UDBG1, "SIWPMKSA: cmd %d, %02x:%02x:%02x:%02x:%02x:%02x\n", + pmksa->cmd, + pmksa->bssid.sa_data[0], + pmksa->bssid.sa_data[1], + pmksa->bssid.sa_data[2], + pmksa->bssid.sa_data[3], + pmksa->bssid.sa_data[4], + pmksa->bssid.sa_data[5]); + + pmkid_list.pmkids = NULL; + switch (pmksa->cmd) { + case IW_PMKSA_ADD: + pmkid_list.pmkids = &pmkid; + action = CSR_WIFI_SME_LIST_ACTION_ADD; + pmkid_list.pmkidsCount = 1; + memcpy(pmkid.bssid.a, pmksa->bssid.sa_data, ETH_ALEN); + memcpy(pmkid.pmkid, pmksa->pmkid, UNIFI_PMKID_KEY_SIZE); + break; + case IW_PMKSA_REMOVE: + pmkid_list.pmkids = &pmkid; + action = CSR_WIFI_SME_LIST_ACTION_REMOVE; + pmkid_list.pmkidsCount = 1; + memcpy(pmkid.bssid.a, pmksa->bssid.sa_data, ETH_ALEN); + memcpy(pmkid.pmkid, pmksa->pmkid, UNIFI_PMKID_KEY_SIZE); + break; + case IW_PMKSA_FLUSH: + /* Replace current PMKID's with an empty list */ + pmkid_list.pmkidsCount = 0; + action = CSR_WIFI_SME_LIST_ACTION_FLUSH; + break; + default: + unifi_notice(priv, "SIWPMKSA: Unknown command (0x%x)\n", pmksa->cmd); + return -EINVAL; + } + + /* Set the Value the pmkid's will have 1 added OR 1 removed OR be cleared at this point */ + UF_RTNL_UNLOCK(); + r = sme_mgt_pmkid(priv, action, &pmkid_list); + UF_RTNL_LOCK(); + if (r) { + unifi_error(priv, "SIWPMKSA: Set PMKID's Failed.\n"); + } + + return r; + +} /* unifi_siwpmksa() */ + + +/* + * --------------------------------------------------------------------------- + * unifi_get_wireless_stats + * + * get_wireless_stats method for Linux wireless extensions. + * + * Arguments: + * dev Pointer to associated netdevice. + * + * Returns: + * Pointer to iw_statistics struct. + * --------------------------------------------------------------------------- + */ +struct iw_statistics * +unifi_get_wireless_stats(struct net_device *dev) +{ + netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); + unifi_priv_t *priv = interfacePriv->privPtr; + + if (priv->init_progress != UNIFI_INIT_COMPLETED) { + return NULL; + } + + return &priv->wext_wireless_stats; +} /* unifi_get_wireless_stats() */ + + +/* + * Structures to export the Wireless Handlers + */ + +static const struct iw_priv_args unifi_private_args[] = { + /*{ cmd, set_args, get_args, name } */ + { SIOCIWS80211POWERSAVEPRIV, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, + IW_PRIV_TYPE_NONE, "iwprivs80211ps" }, + { SIOCIWG80211POWERSAVEPRIV, IW_PRIV_TYPE_NONE, + IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IWPRIV_POWER_SAVE_MAX_STRING, "iwprivg80211ps" }, + { SIOCIWS80211RELOADDEFAULTSPRIV, IW_PRIV_TYPE_NONE, + IW_PRIV_TYPE_NONE, "iwprivsdefs" }, + { SIOCIWSSMEDEBUGPRIV, IW_PRIV_TYPE_CHAR | IWPRIV_SME_DEBUG_MAX_STRING, IW_PRIV_TYPE_NONE, "iwprivssmedebug" }, +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + { SIOCIWSCONFWAPIPRIV, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, + IW_PRIV_TYPE_NONE, "iwprivsconfwapi" }, + { SIOCIWSWAPIKEYPRIV, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | sizeof(unifiio_wapi_key_t), + IW_PRIV_TYPE_NONE, "iwprivswpikey" }, +#endif +#ifdef CSR_SUPPORT_WEXT_AP + { SIOCIWSAPCFGPRIV, IW_PRIV_TYPE_CHAR | 256, IW_PRIV_TYPE_NONE, "AP_SET_CFG" }, + { SIOCIWSAPSTARTPRIV, 0,IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED|IWPRIV_SME_MAX_STRING,"AP_BSS_START" }, + { SIOCIWSAPSTOPPRIV, IW_PRIV_TYPE_CHAR |IW_PRIV_SIZE_FIXED|0, + IW_PRIV_TYPE_CHAR |IW_PRIV_SIZE_FIXED|0, "AP_BSS_STOP" }, +#ifdef ANDROID_BUILD + { SIOCIWSFWRELOADPRIV, IW_PRIV_TYPE_CHAR |256, + IW_PRIV_TYPE_CHAR |IW_PRIV_SIZE_FIXED|0, "WL_FW_RELOAD" }, + { SIOCIWSSTACKSTART, 0, + IW_PRIV_TYPE_CHAR |IW_PRIV_SIZE_FIXED|IWPRIV_SME_MAX_STRING, "START" }, + { SIOCIWSSTACKSTOP, 0, + IW_PRIV_TYPE_CHAR |IW_PRIV_SIZE_FIXED|IWPRIV_SME_MAX_STRING, "STOP" }, +#endif /* ANDROID_BUILD */ +#endif /* CSR_SUPPORT_WEXT_AP */ +}; + +static const iw_handler unifi_handler[] = +{ + (iw_handler) unifi_siwcommit, /* SIOCSIWCOMMIT */ + (iw_handler) unifi_giwname, /* SIOCGIWNAME */ + (iw_handler) NULL, /* SIOCSIWNWID */ + (iw_handler) NULL, /* SIOCGIWNWID */ + (iw_handler) unifi_siwfreq, /* SIOCSIWFREQ */ + (iw_handler) unifi_giwfreq, /* SIOCGIWFREQ */ + (iw_handler) unifi_siwmode, /* SIOCSIWMODE */ + (iw_handler) unifi_giwmode, /* SIOCGIWMODE */ + (iw_handler) NULL, /* SIOCSIWSENS */ + (iw_handler) NULL, /* SIOCGIWSENS */ + (iw_handler) NULL, /* SIOCSIWRANGE */ + (iw_handler) unifi_giwrange, /* SIOCGIWRANGE */ + (iw_handler) NULL, /* SIOCSIWPRIV */ + (iw_handler) NULL, /* SIOCGIWPRIV */ + (iw_handler) NULL, /* SIOCSIWSTATS */ + (iw_handler) NULL, /* SIOCGIWSTATS */ + (iw_handler) NULL, /* SIOCSIWSPY */ + (iw_handler) NULL, /* SIOCGIWSPY */ + (iw_handler) NULL, /* SIOCSIWTHRSPY */ + (iw_handler) NULL, /* SIOCGIWTHRSPY */ + (iw_handler) unifi_siwap, /* SIOCSIWAP */ + (iw_handler) unifi_giwap, /* SIOCGIWAP */ +#if WIRELESS_EXT > 17 + /* WPA : IEEE 802.11 MLME requests */ + unifi_siwmlme, /* SIOCSIWMLME, request MLME operation */ +#else + (iw_handler) NULL, /* -- hole -- */ +#endif + (iw_handler) NULL, /* SIOCGIWAPLIST */ + (iw_handler) unifi_siwscan, /* SIOCSIWSCAN */ + (iw_handler) unifi_giwscan, /* SIOCGIWSCAN */ + (iw_handler) unifi_siwessid, /* SIOCSIWESSID */ + (iw_handler) unifi_giwessid, /* SIOCGIWESSID */ + (iw_handler) NULL, /* SIOCSIWNICKN */ + (iw_handler) NULL, /* SIOCGIWNICKN */ + (iw_handler) NULL, /* -- hole -- */ + (iw_handler) NULL, /* -- hole -- */ + unifi_siwrate, /* SIOCSIWRATE */ + unifi_giwrate, /* SIOCGIWRATE */ + unifi_siwrts, /* SIOCSIWRTS */ + unifi_giwrts, /* SIOCGIWRTS */ + unifi_siwfrag, /* SIOCSIWFRAG */ + unifi_giwfrag, /* SIOCGIWFRAG */ + (iw_handler) NULL, /* SIOCSIWTXPOW */ + (iw_handler) NULL, /* SIOCGIWTXPOW */ + (iw_handler) NULL, /* SIOCSIWRETRY */ + (iw_handler) NULL, /* SIOCGIWRETRY */ + unifi_siwencode, /* SIOCSIWENCODE */ + unifi_giwencode, /* SIOCGIWENCODE */ + unifi_siwpower, /* SIOCSIWPOWER */ + unifi_giwpower, /* SIOCGIWPOWER */ +#if WIRELESS_EXT > 17 + (iw_handler) NULL, /* -- hole -- */ + (iw_handler) NULL, /* -- hole -- */ + + /* WPA : Generic IEEE 802.11 informatiom element (e.g., for WPA/RSN/WMM). */ + unifi_siwgenie, /* SIOCSIWGENIE */ /* set generic IE */ + unifi_giwgenie, /* SIOCGIWGENIE */ /* get generic IE */ + + /* WPA : Authentication mode parameters */ + unifi_siwauth, /* SIOCSIWAUTH */ /* set authentication mode params */ + unifi_giwauth, /* SIOCGIWAUTH */ /* get authentication mode params */ + + /* WPA : Extended version of encoding configuration */ + unifi_siwencodeext, /* SIOCSIWENCODEEXT */ /* set encoding token & mode */ + unifi_giwencodeext, /* SIOCGIWENCODEEXT */ /* get encoding token & mode */ + + /* WPA2 : PMKSA cache management */ + unifi_siwpmksa, /* SIOCSIWPMKSA */ /* PMKSA cache operation */ + (iw_handler) NULL, /* -- hole -- */ +#endif /* WIRELESS_EXT > 17 */ +}; + + +static const iw_handler unifi_private_handler[] = +{ + iwprivs80211ps, /* SIOCIWFIRSTPRIV */ + iwprivg80211ps, /* SIOCIWFIRSTPRIV + 1 */ + iwprivsdefs, /* SIOCIWFIRSTPRIV + 2 */ + (iw_handler) NULL, +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + iwprivsconfwapi, /* SIOCIWFIRSTPRIV + 4 */ + (iw_handler) NULL, /* SIOCIWFIRSTPRIV + 5 */ + iwprivswpikey, /* SIOCIWFIRSTPRIV + 6 */ +#else + (iw_handler) NULL, + (iw_handler) NULL, + (iw_handler) NULL, +#endif + (iw_handler) NULL, + iwprivssmedebug, /* SIOCIWFIRSTPRIV + 8 */ +#ifdef CSR_SUPPORT_WEXT_AP + (iw_handler) NULL, + iwprivsapconfig, + (iw_handler) NULL, + iwprivsapstart, + (iw_handler) NULL, + iwprivsapstop, + (iw_handler) NULL, +#ifdef ANDROID_BUILD + iwprivsapfwreload, + (iw_handler) NULL, + iwprivsstackstart, + (iw_handler) NULL, + iwprivsstackstop, +#else + (iw_handler) NULL, + (iw_handler) NULL, + (iw_handler) NULL, + (iw_handler) NULL, + (iw_handler) NULL, +#endif /* ANDROID_BUILD */ +#else + (iw_handler) NULL, + (iw_handler) NULL, + (iw_handler) NULL, + (iw_handler) NULL, + (iw_handler) NULL, + (iw_handler) NULL, + (iw_handler) NULL, + (iw_handler) NULL, + (iw_handler) NULL, + (iw_handler) NULL, + (iw_handler) NULL, + (iw_handler) NULL, +#endif /* CSR_SUPPORT_WEXT_AP */ +}; + +struct iw_handler_def unifi_iw_handler_def = +{ + .num_standard = sizeof(unifi_handler) / sizeof(iw_handler), + .num_private = sizeof(unifi_private_handler) / sizeof(iw_handler), + .num_private_args = sizeof(unifi_private_args) / sizeof(struct iw_priv_args), + .standard = (iw_handler *) unifi_handler, + .private = (iw_handler *) unifi_private_handler, + .private_args = (struct iw_priv_args *) unifi_private_args, +#if IW_HANDLER_VERSION >= 6 + .get_wireless_stats = unifi_get_wireless_stats, +#endif +}; + + diff --git a/drivers/staging/csr/ul_int.c b/drivers/staging/csr/ul_int.c new file mode 100644 index 0000000..ae14f23 --- /dev/null +++ b/drivers/staging/csr/ul_int.c @@ -0,0 +1,552 @@ +/* + * *************************************************************************** + * FILE: ul_int.c + * + * PURPOSE: + * Manage list of client applications using UniFi. + * + * Copyright (C) 2006-2009 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * *************************************************************************** + */ +#include "csr_wifi_hip_unifi.h" +#include "csr_wifi_hip_conversions.h" +#include "unifi_priv.h" +#include "unifiio.h" +#include "unifi_os.h" + +static void free_bulkdata_buffers(unifi_priv_t *priv, bulk_data_param_t *bulkdata); +static void reset_driver_status(unifi_priv_t *priv); + +/* + * --------------------------------------------------------------------------- + * ul_init_clients + * + * Initialise the clients array to empty. + * + * Arguments: + * priv Pointer to device private context struct + * + * Returns: + * None. + * + * Notes: + * This function needs to be called before priv is stored in + * Unifi_instances[]. + * --------------------------------------------------------------------------- + */ +void +ul_init_clients(unifi_priv_t *priv) +{ + int id; + ul_client_t *ul_clients; + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) + sema_init(&priv->udi_logging_mutex, 1); +#else + init_MUTEX(&priv->udi_logging_mutex); +#endif + priv->logging_client = NULL; + + ul_clients = priv->ul_clients; + + for (id = 0; id < MAX_UDI_CLIENTS; id++) { + memset(&ul_clients[id], 0, sizeof(ul_client_t)); + + ul_clients[id].client_id = id; + ul_clients[id].sender_id = UDI_SENDER_ID_BASE + (id << UDI_SENDER_ID_SHIFT); + ul_clients[id].instance = -1; + ul_clients[id].event_hook = NULL; + + INIT_LIST_HEAD(&ul_clients[id].udi_log); + init_waitqueue_head(&ul_clients[id].udi_wq); + sema_init(&ul_clients[id].udi_sem, 1); + + ul_clients[id].wake_up_wq_id = 0; + ul_clients[id].seq_no = 0; + ul_clients[id].wake_seq_no = 0; + ul_clients[id].snap_filter.count = 0; + } +} /* ul_init_clients() */ + + +/* + * --------------------------------------------------------------------------- + * ul_register_client + * + * This function registers a new ul client. + * + * Arguments: + * priv Pointer to device private context struct + * configuration Special configuration for the client. + * udi_event_clbk Callback for receiving event from unifi. + * + * Returns: + * 0 if a new clients is registered, -1 otherwise. + * --------------------------------------------------------------------------- + */ +ul_client_t * +ul_register_client(unifi_priv_t *priv, unsigned int configuration, + udi_event_t udi_event_clbk) +{ + unsigned char id, ref; + ul_client_t *ul_clients; + + ul_clients = priv->ul_clients; + + /* check for an unused entry */ + for (id = 0; id < MAX_UDI_CLIENTS; id++) { + if (ul_clients[id].udi_enabled == 0) { + ul_clients[id].instance = priv->instance; + ul_clients[id].udi_enabled = 1; + ul_clients[id].configuration = configuration; + + /* Allocate memory for the reply signal.. */ + ul_clients[id].reply_signal = (CSR_SIGNAL*) CsrPmemAlloc(sizeof(CSR_SIGNAL)); + if (ul_clients[id].reply_signal == NULL) { + unifi_error(priv, "Failed to allocate reply signal for client.\n"); + return NULL; + } + /* .. and the bulk data of the reply signal. */ + for (ref = 0; ref < UNIFI_MAX_DATA_REFERENCES; ref ++) { + ul_clients[id].reply_bulkdata[ref] = + (bulk_data_t*) CsrPmemAlloc(sizeof(bulk_data_t)); + /* If allocation fails, free allocated memory. */ + if (ul_clients[id].reply_bulkdata[ref] == NULL) { + for (; ref > 0; ref --) { + CsrPmemFree(ul_clients[id].reply_bulkdata[ref - 1]); + } + CsrPmemFree(ul_clients[id].reply_signal); + unifi_error(priv, "Failed to allocate bulk data buffers for client.\n"); + return NULL; + } + } + + /* Set the event callback. */ + ul_clients[id].event_hook = udi_event_clbk; + + unifi_trace(priv, UDBG2, "UDI %d (0x%x) registered. configuration = 0x%x\n", + id, &ul_clients[id], configuration); + return &ul_clients[id]; + } + } + return NULL; +} /* ul_register_client() */ + + +/* + * --------------------------------------------------------------------------- + * ul_deregister_client + * + * This function deregisters a blocking UDI client. + * + * Arguments: + * client Pointer to the client we deregister. + * + * Returns: + * 0 if a new clients is deregistered. + * --------------------------------------------------------------------------- + */ +int +ul_deregister_client(ul_client_t *ul_client) +{ + struct list_head *pos, *n; + udi_log_t *logptr; + unifi_priv_t *priv = uf_find_instance(ul_client->instance); + int ref; + + ul_client->instance = -1; + ul_client->event_hook = NULL; + ul_client->udi_enabled = 0; + unifi_trace(priv, UDBG5, "UDI (0x%x) deregistered.\n", ul_client); + + /* Free memory allocated for the reply signal and its bulk data. */ + CsrPmemFree(ul_client->reply_signal); + for (ref = 0; ref < UNIFI_MAX_DATA_REFERENCES; ref ++) { + CsrPmemFree(ul_client->reply_bulkdata[ref]); + } + + if (ul_client->snap_filter.count) { + ul_client->snap_filter.count = 0; + CsrPmemFree(ul_client->snap_filter.protocols); + } + + /* Free anything pending on the udi_log list */ + down(&ul_client->udi_sem); + list_for_each_safe(pos, n, &ul_client->udi_log) + { + logptr = list_entry(pos, udi_log_t, q); + list_del(pos); + kfree(logptr); + } + up(&ul_client->udi_sem); + + return 0; +} /* ul_deregister_client() */ + + + +/* + * --------------------------------------------------------------------------- + * logging_handler + * + * This function is registered with the driver core. + * It is called every time a UniFi HIP Signal is sent. It iterates over + * the list of processes interested in receiving log events and + * delivers the events to them. + * + * Arguments: + * ospriv Pointer to driver's private data. + * sigdata Pointer to the packed signal buffer. + * signal_len Length of the packed signal. + * bulkdata Pointer to the signal's bulk data. + * dir Direction of the signal + * 0 = from-host + * 1 = to-host + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +void +logging_handler(void *ospriv, + CsrUint8 *sigdata, CsrUint32 signal_len, + const bulk_data_param_t *bulkdata, + enum udi_log_direction direction) +{ + unifi_priv_t *priv = (unifi_priv_t*)ospriv; + ul_client_t *client; + int dir; + + dir = (direction == UDI_LOG_FROM_HOST) ? UDI_FROM_HOST : UDI_TO_HOST; + + down(&priv->udi_logging_mutex); + client = priv->logging_client; + if (client != NULL) { + client->event_hook(client, sigdata, signal_len, + bulkdata, dir); + } + up(&priv->udi_logging_mutex); + +} /* logging_handler() */ + + + +/* + * --------------------------------------------------------------------------- + * ul_log_config_ind + * + * This function uses the client's register callback + * to indicate configuration information e.g core errors. + * + * Arguments: + * priv Pointer to driver's private data. + * conf_param Pointer to the configuration data. + * len Length of the configuration data. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +void +ul_log_config_ind(unifi_priv_t *priv, u8 *conf_param, int len) +{ +#ifdef CSR_SUPPORT_SME + if (priv->smepriv == NULL) + { + return; + } + if ((CONFIG_IND_ERROR == (*conf_param)) && (priv->wifi_on_state == wifi_on_in_progress)) { + unifi_notice(priv, "ul_log_config_ind: wifi on in progress, suppress error\n"); + } else { + /* wifi_off_ind (error or exit) */ + CsrWifiRouterCtrlWifiOffIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,0, (CsrWifiRouterCtrlControlIndication)(*conf_param)); + } + +#else + bulk_data_param_t bulkdata; + + /* + * If someone killed unifi_managed before the driver was unloaded + * the g_drvpriv pointer is going to be NULL. In this case it is + * safe to assume that there is no client to get the indication. + */ + if (!priv) { + unifi_notice(NULL, "uf_sme_event_ind: NULL priv\n"); + return; + } + + /* Create a null bulkdata structure. */ + bulkdata.d[0].data_length = 0; + bulkdata.d[1].data_length = 0; + + sme_native_log_event(priv->sme_cli, conf_param, sizeof(CsrUint8), + &bulkdata, UDI_CONFIG_IND); + +#endif /* CSR_SUPPORT_SME */ + +} /* ul_log_config_ind */ + + +/* + * --------------------------------------------------------------------------- + * free_bulkdata_buffers + * + * Free the bulkdata buffers e.g. after a failed unifi_send_signal(). + * + * Arguments: + * priv Pointer to device private struct + * bulkdata Pointer to bulkdata parameter table + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +static void +free_bulkdata_buffers(unifi_priv_t *priv, bulk_data_param_t *bulkdata) +{ + int i; + + if (bulkdata) { + for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; ++i) { + if (bulkdata->d[i].data_length != 0) { + unifi_net_data_free(priv, (bulk_data_desc_t *)(&bulkdata->d[i])); + /* data_length is now 0 */ + } + } + } + +} /* free_bulkdata_buffers */ + +static int +_align_bulk_data_buffers(unifi_priv_t *priv, CsrUint8 *signal, + bulk_data_param_t *bulkdata) +{ + unsigned int i; + + if ((bulkdata == NULL) || (CSR_WIFI_ALIGN_BYTES == 0)) { + return 0; + } + + for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) + { + struct sk_buff *skb; + /* + * The following complex casting is in place in order to eliminate 64-bit compilation warning + * "cast to/from pointer from/to integer of different size" + */ + CsrUint32 align_offset = (CsrUint32)(long)(bulkdata->d[i].os_data_ptr) & (CSR_WIFI_ALIGN_BYTES-1); + if (align_offset) + { + skb = (struct sk_buff*)bulkdata->d[i].os_net_buf_ptr; + if (skb == NULL) { + unifi_warning(priv, + "_align_bulk_data_buffers: Align offset found (%d) but skb is NULL!\n", + align_offset); + return -EINVAL; + } + if (bulkdata->d[i].data_length == 0) { + unifi_warning(priv, + "_align_bulk_data_buffers: Align offset found (%d) but length is zero\n", + align_offset); + return CSR_RESULT_SUCCESS; + } + unifi_trace(priv, UDBG5, + "Align f-h buffer (0x%p) by %d bytes (skb->data: 0x%p)\n", + bulkdata->d[i].os_data_ptr, align_offset, skb->data); + + + /* Check if there is enough headroom... */ + if (unlikely(skb_headroom(skb) < align_offset)) + { + struct sk_buff *tmp = skb; + + unifi_trace(priv, UDBG5, "Headroom not enough - realloc it\n"); + skb = skb_realloc_headroom(skb, align_offset); + if (skb == NULL) { + unifi_error(priv, + "_align_bulk_data_buffers: skb_realloc_headroom failed - signal is dropped\n"); + return -EFAULT; + } + /* Free the old bulk data only if allocation succeeds */ + kfree_skb(tmp); + /* Bulkdata needs to point to the new skb */ + bulkdata->d[i].os_net_buf_ptr = (const unsigned char*)skb; + bulkdata->d[i].os_data_ptr = (const void*)skb->data; + } + /* ... before pushing the data to the right alignment offset */ + skb_push(skb, align_offset); + + } + /* The direction bit is zero for the from-host */ + signal[SIZEOF_SIGNAL_HEADER + (i * SIZEOF_DATAREF) + 1] = align_offset; + + } + return 0; +} /* _align_bulk_data_buffers() */ + + +/* + * --------------------------------------------------------------------------- + * ul_send_signal_unpacked + * + * This function sends a host formatted signal to unifi. + * + * Arguments: + * priv Pointer to driver's private data. + * sigptr Pointer to the signal. + * bulkdata Pointer to the signal's bulk data. + * + * Returns: + * O on success, error code otherwise. + * + * Notes: + * The signals have to be sent in the format described in the host interface + * specification, i.e wire formatted. Certain clients use the host formatted + * structures. The write_pack() transforms the host formatted signal + * into the wired formatted signal. The code is in the core, since the signals + * are defined therefore binded to the host interface specification. + * --------------------------------------------------------------------------- + */ +int +ul_send_signal_unpacked(unifi_priv_t *priv, CSR_SIGNAL *sigptr, + bulk_data_param_t *bulkdata) +{ + CsrUint8 sigbuf[UNIFI_PACKED_SIGBUF_SIZE]; + CsrUint16 packed_siglen; + CsrResult csrResult; + unsigned long lock_flags; + int r; +#ifdef CSR_SUPPORT_SME + netInterface_priv_t *interfacePriv = priv->interfacePriv[0]; + CsrUint32 alignOffset = 0; +#endif + + + csrResult = write_pack(sigptr, sigbuf, &packed_siglen); + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, "Malformed HIP signal in ul_send_signal_unpacked()\n"); + return CsrHipResultToStatus(csrResult); + } +#ifdef CSR_SUPPORT_SME + if (bulkdata != NULL){ + alignOffset = (CsrUint32)(long)(bulkdata->d[0].os_data_ptr) & (CSR_WIFI_ALIGN_BYTES-1); + + } +#endif + r = _align_bulk_data_buffers(priv, sigbuf, (bulk_data_param_t*)bulkdata); + if (r) { + return r; + } + + spin_lock_irqsave(&priv->send_signal_lock, lock_flags); + csrResult = unifi_send_signal(priv->card, sigbuf, packed_siglen, bulkdata); + if (csrResult != CSR_RESULT_SUCCESS) { + /* free_bulkdata_buffers(priv, (bulk_data_param_t *)bulkdata); */ + spin_unlock_irqrestore(&priv->send_signal_lock, lock_flags); + return CsrHipResultToStatus(csrResult); + } +#ifdef CSR_SUPPORT_SME + if (sigptr->SignalPrimitiveHeader.SignalId == CSR_MA_PACKET_REQUEST_ID) { + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + + uf_store_directed_ma_packet_referenece(priv, bulkdata, sigptr,alignOffset); + + } + } +#endif + + spin_unlock_irqrestore(&priv->send_signal_lock, lock_flags); + + return 0; +} /* ul_send_signal_unpacked() */ + + +/* + * --------------------------------------------------------------------------- + * reset_driver_status + * + * This function is called from ul_send_signal_raw() when it detects + * that the SME has sent a MLME-RESET request. + * + * Arguments: + * priv Pointer to device private struct + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +static void +reset_driver_status(unifi_priv_t *priv) +{ + priv->sta_wmm_capabilities = 0; +#ifdef CSR_NATIVE_LINUX +#ifdef CSR_SUPPORT_WEXT + priv->wext_conf.flag_associated = 0; + priv->wext_conf.block_controlled_port = CSR_WIFI_ROUTER_PORT_ACTION_8021X_PORT_OPEN; + priv->wext_conf.bss_wmm_capabilities = 0; + priv->wext_conf.disable_join_on_ssid_set = 0; +#endif +#endif +} /* reset_driver_status() */ + + +/* + * --------------------------------------------------------------------------- + * ul_send_signal_raw + * + * This function sends a wire formatted data signal to unifi. + * + * Arguments: + * priv Pointer to driver's private data. + * sigptr Pointer to the signal. + * siglen Length of the signal. + * bulkdata Pointer to the signal's bulk data. + * + * Returns: + * O on success, error code otherwise. + * --------------------------------------------------------------------------- + */ +int +ul_send_signal_raw(unifi_priv_t *priv, unsigned char *sigptr, int siglen, + bulk_data_param_t *bulkdata) +{ + CsrResult csrResult; + unsigned long lock_flags; + int r; + + /* + * Make sure that the signal is updated with the bulk data + * alignment for DMA. + */ + r = _align_bulk_data_buffers(priv, (CsrUint8*)sigptr, bulkdata); + if (r) { + return r; + } + + spin_lock_irqsave(&priv->send_signal_lock, lock_flags); + csrResult = unifi_send_signal(priv->card, sigptr, siglen, bulkdata); + if (csrResult != CSR_RESULT_SUCCESS) { + free_bulkdata_buffers(priv, bulkdata); + spin_unlock_irqrestore(&priv->send_signal_lock, lock_flags); + return CsrHipResultToStatus(csrResult); + } + spin_unlock_irqrestore(&priv->send_signal_lock, lock_flags); + + /* + * Since this is use by unicli, if we get an MLME reset request + * we need to initialize a few status parameters + * that the driver uses to make decisions. + */ + if (GET_SIGNAL_ID(sigptr) == CSR_MLME_RESET_REQUEST_ID) { + reset_driver_status(priv); + } + + return 0; +} /* ul_send_signal_raw() */ + + diff --git a/drivers/staging/csr/unifi_clients.h b/drivers/staging/csr/unifi_clients.h new file mode 100644 index 0000000..206b8cf --- /dev/null +++ b/drivers/staging/csr/unifi_clients.h @@ -0,0 +1,129 @@ +/* + ***************************************************************************** + * + * FILE : unifi_clients.h + * + * PURPOSE : Private header file for unifi clients. + * + * UDI = UniFi Debug Interface + * + * Copyright (C) 2005-2008 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + ***************************************************************************** + */ +#ifndef __LINUX_UNIFI_CLIENTS_H__ +#define __LINUX_UNIFI_CLIENTS_H__ 1 + +#include + +#define MAX_UDI_CLIENTS 8 + +/* The start of the range of process ids allocated for ul clients */ +#define UDI_SENDER_ID_BASE 0xC000 +#define UDI_SENDER_ID_SHIFT 8 + + +/* Structure to hold a UDI logged signal */ +typedef struct { + + /* List link structure */ + struct list_head q; + + /* The message that will be passed to the user app */ + udi_msg_t msg; + + /* Signal body and data follow */ + +} udi_log_t; + + + +typedef struct ul_client ul_client_t; + +typedef void (*udi_event_t)(ul_client_t *client, + const u8 *sigdata, int signal_len, + const bulk_data_param_t *bulkdata, + int dir); + +void logging_handler(void *ospriv, + CsrUint8 *sigdata, CsrUint32 signal_len, + const bulk_data_param_t *bulkdata, + enum udi_log_direction direction); + + +/* + * Structure describing a bulk data slot. + * The length field is used to indicate empty/occupied state. + */ +typedef struct _bulk_data +{ + unsigned char ptr[2000]; + unsigned int length; +} bulk_data_t; + + +struct ul_client { + /* Index of this client in the ul_clients array. */ + int client_id; + + /* Index of UniFi device to which this client is attached. */ + int instance; + + /* Flag to say whether this client has been enabled. */ + int udi_enabled; + + /* Value to use in signal->SenderProcessId */ + int sender_id; + + /* Configuration flags, e.g blocking, logging, etc. */ + unsigned int configuration; + + udi_event_t event_hook; + + /* A list to hold signals received from UniFi for reading by read() */ + struct list_head udi_log; + + /* Semaphore to protect the udi_log list */ + struct semaphore udi_sem; + + /* + * Linux waitqueue to support blocking read and poll. + * Logging clients should wait on udi_log. while + * blocking clients should wait on wake_up_wq. + */ + wait_queue_head_t udi_wq; + CSR_SIGNAL* reply_signal; + bulk_data_t* reply_bulkdata[UNIFI_MAX_DATA_REFERENCES]; + + CsrUint16 signal_filter[SIG_FILTER_SIZE]; + + + /* ------------------------------------------------------------------- */ + /* Code below here is used by the sme_native configuration only */ + + /* Flag to wake up blocking clients waiting on udi_wq. */ + int wake_up_wq_id; + + /* + * A 0x00 - 0x0F mask to apply in signal->SenderProcessId. + * Every time we do a blocking mlme request we increase this value. + * The mlme_wait_for_reply() will wait for this sequence number. + * Only the MLME blocking functions update this field. + */ + unsigned char seq_no; + + /* + * A 0x00 - 0x0F counter, containing the sequence number of + * the signal that this client has last received. + * Only the MLME blocking functions update this field. + */ + unsigned char wake_seq_no; + + unifiio_snap_filter_t snap_filter; +}; /* struct ul_client */ + + +#endif /* __LINUX_UNIFI_CLIENTS_H__ */ diff --git a/drivers/staging/csr/unifi_config.h b/drivers/staging/csr/unifi_config.h new file mode 100644 index 0000000..fe11970 --- /dev/null +++ b/drivers/staging/csr/unifi_config.h @@ -0,0 +1,34 @@ +/* + * --------------------------------------------------------------------------- + * + * FILE: unifi_config.h + * + * PURPOSE: + * This header file provides parameters that configure the operation + * of the driver. + * + * Copyright (C) 2006-2008 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * --------------------------------------------------------------------------- + */ +#ifndef __UNIFI_CONFIG_H__ +#define __UNIFI_CONFIG_H__ 1 + +/* + * Override for the SDIO function block size on this host. When byte mode CMD53s + * are not used/supported by the SD host controller, transfers are padded up to + * the next block boundary. The 512-byte default on UF6xxx wastes too much space + * on the chip, so the block size is reduced to support this configuration. + */ +#define CSR_WIFI_HIP_SDIO_BLOCK_SIZE 64 + +/* Define the number of mini-coredump buffers to allocate at startup. These are + * used to record chip status for the last n unexpected resets. + */ +#define CSR_WIFI_HIP_NUM_COREDUMP_BUFFERS 5 + + +#endif /* __UNIFI_CONFIG_H__ */ diff --git a/drivers/staging/csr/unifi_dbg.c b/drivers/staging/csr/unifi_dbg.c new file mode 100644 index 0000000..38d5708 --- /dev/null +++ b/drivers/staging/csr/unifi_dbg.c @@ -0,0 +1,110 @@ +/* + * *************************************************************************** + * FILE: unifi_dbg.c + * + * PURPOSE: + * Handle debug signals received from UniFi. + * + * Copyright (C) 2007-2008 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * *************************************************************************** + */ +#include "unifi_priv.h" + +/* + * --------------------------------------------------------------------------- + * debug_string_indication + * debug_word16_indication + * + * Handlers for debug indications. + * + * Arguments: + * priv Pointer to private context structure. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +void +debug_string_indication(unifi_priv_t *priv, const unsigned char *extra, unsigned int extralen) +{ + const unsigned int maxlen = sizeof(priv->last_debug_string) - 1; + + if (extralen > maxlen) { + extralen = maxlen; + } + + strncpy(priv->last_debug_string, extra, extralen); + + /* Make sure the string is terminated */ + priv->last_debug_string[extralen] = '\0'; + + unifi_info(priv, "unifi debug: %s\n", priv->last_debug_string); + +} /* debug_string_indication() */ + + + +void +debug_word16_indication(unifi_priv_t *priv, const CSR_SIGNAL *sigptr) +{ + int i; + + if (priv == NULL) { + unifi_info(priv, "Priv is NULL\n"); + return; + } + + for (i = 0; i < 16; i++) { + priv->last_debug_word16[i] = + sigptr->u.DebugWord16Indication.DebugWords[i]; + } + + if (priv->last_debug_word16[0] == 0xFA11) { + unsigned long ts; + ts = (priv->last_debug_word16[6] << 16) | priv->last_debug_word16[5]; + unifi_info(priv, " %10lu: %s fault %04x, arg %04x (x%d)\n", + ts, + priv->last_debug_word16[3] == 0x8000 ? "MAC" : + priv->last_debug_word16[3] == 0x4000 ? "PHY" : + "???", + priv->last_debug_word16[1], + priv->last_debug_word16[2], + priv->last_debug_word16[4]); + } + else if (priv->last_debug_word16[0] != 0xDBAC) + /* suppress SDL Trace output (note: still available to unicli). */ + { + unifi_info(priv, "unifi debug: %04X %04X %04X %04X %04X %04X %04X %04X\n", + priv->last_debug_word16[0], priv->last_debug_word16[1], + priv->last_debug_word16[2], priv->last_debug_word16[3], + priv->last_debug_word16[4], priv->last_debug_word16[5], + priv->last_debug_word16[6], priv->last_debug_word16[7]); + unifi_info(priv, " %04X %04X %04X %04X %04X %04X %04X %04X\n", + priv->last_debug_word16[8], priv->last_debug_word16[9], + priv->last_debug_word16[10], priv->last_debug_word16[11], + priv->last_debug_word16[12], priv->last_debug_word16[13], + priv->last_debug_word16[14], priv->last_debug_word16[15]); + } + +} /* debug_word16_indication() */ + + +void +debug_generic_indication(unifi_priv_t *priv, const CSR_SIGNAL *sigptr) +{ + unifi_info(priv, "debug: %04X %04X %04X %04X %04X %04X %04X %04X\n", + sigptr->u.DebugGenericIndication.DebugWords[0], + sigptr->u.DebugGenericIndication.DebugWords[1], + sigptr->u.DebugGenericIndication.DebugWords[2], + sigptr->u.DebugGenericIndication.DebugWords[3], + sigptr->u.DebugGenericIndication.DebugWords[4], + sigptr->u.DebugGenericIndication.DebugWords[5], + sigptr->u.DebugGenericIndication.DebugWords[6], + sigptr->u.DebugGenericIndication.DebugWords[7]); + +} /* debug_generic_indication() */ + diff --git a/drivers/staging/csr/unifi_event.c b/drivers/staging/csr/unifi_event.c new file mode 100644 index 0000000..cfc5b32 --- /dev/null +++ b/drivers/staging/csr/unifi_event.c @@ -0,0 +1,794 @@ +/* + * *************************************************************************** + * FILE: unifi_event.c + * + * PURPOSE: + * Process the signals received by UniFi. + * It is part of the porting exercise. + * + * Copyright (C) 2009 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * *************************************************************************** + */ + + +/* + * Porting notes: + * The implementation of unifi_receive_event() in Linux is fairly complicated. + * The linux driver support multiple userspace applications and several + * build configurations, so the received signals are processed by different + * processes and multiple times. + * In a simple implementation, this function needs to deliver: + * - The MLME-UNITDATA.ind signals to the Rx data plane and to the Traffic + * Analysis using unifi_ta_sample(). + * - The MLME-UNITDATA-STATUS.ind signals to the Tx data plane. + * - All the other signals to the SME using unifi_sys_hip_ind(). + */ + +#include "csr_wifi_hip_unifi.h" +#include "csr_wifi_hip_conversions.h" +#include "unifi_priv.h" + + +/* + * --------------------------------------------------------------------------- + * send_to_client + * + * Helper for unifi_receive_event. + * + * This function forwards a signal to one client. + * + * Arguments: + * priv Pointer to driver's private data. + * client Pointer to the client structure. + * receiver_id The reciever id of the signal. + * sigdata Pointer to the packed signal buffer. + * siglen Length of the packed signal. + * bulkdata Pointer to the signal's bulk data. + * + * Returns: + * None. + * + * --------------------------------------------------------------------------- + */ +static void send_to_client(unifi_priv_t *priv, ul_client_t *client, + int receiver_id, + unsigned char *sigdata, int siglen, + const bulk_data_param_t *bulkdata) +{ + if (client && client->event_hook) { + /*unifi_trace(priv, UDBG3, + "Receive: client %d, (s:0x%X, r:0x%X) - Signal 0x%.4X \n", + client->client_id, client->sender_id, receiver_id, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata));*/ + + client->event_hook(client, sigdata, siglen, bulkdata, UDI_TO_HOST); + } +} + +/* + * --------------------------------------------------------------------------- + * process_pkt_data_ind + * + * Dispatcher for received signals. + * + * This function receives the 'to host' signals and forwards + * them to the unifi linux clients. + * + * Arguments: + * priv Context + * sigdata Pointer to the packed signal buffer(Its in form of MA-PACKET.ind). + * bulkdata Pointer to signal's bulkdata + * freeBulkData Pointer to a flag which gets set if the bulkdata needs to + * be freed after calling the logging handlers. If it is not + * set the bulkdata must be freed by the MLME handler or + * passed to the network stack. + * Returns: + * TRUE if the packet should be routed to the SME etc. + * FALSE if the packet is for the driver or network stack + * --------------------------------------------------------------------------- + */ +static CsrBool check_routing_pkt_data_ind(unifi_priv_t *priv, + CsrUint8 *sigdata, + const bulk_data_param_t* bulkdata, + CsrBool *freeBulkData, + netInterface_priv_t *interfacePriv) +{ + CsrUint16 frmCtrl, receptionStatus, frmCtrlSubType; + CsrUint8 *macHdrLocation; + CsrUint8 interfaceTag; + CsrBool isDataFrame; + CsrBool isProtocolVerInvalid = FALSE; + CsrBool isDataFrameSubTypeNoData = FALSE; + +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + static const CsrUint8 wapiProtocolIdSNAPHeader[] = {0x88,0xb4}; + static const CsrUint8 wapiProtocolIdSNAPHeaderOffset = 6; + CsrUint8 *destAddr; + CsrUint8 *srcAddr; + CsrBool isUnicastPkt = FALSE; + + CsrUint8 llcSnapHeaderOffset = 0; + + destAddr = (CsrUint8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR1_OFFSET; + srcAddr = (CsrUint8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR2_OFFSET; + + /*Individual/Group bit - Bit 0 of first byte*/ + isUnicastPkt = (!(destAddr[0] & 0x01)) ? TRUE : FALSE; +#endif + +#define CSR_WIFI_MA_PKT_IND_RECEPTION_STATUS_OFFSET sizeof(CSR_SIGNAL_PRIMITIVE_HEADER) + 22 + + *freeBulkData = FALSE; + + /* Fetch the MAC header location from MA_PKT_IND packet */ + macHdrLocation = (CsrUint8 *) bulkdata->d[0].os_data_ptr; + /* Fetch the Frame Control value from MAC header */ + frmCtrl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(macHdrLocation); + + /* Pull out interface tag from virtual interface identifier */ + interfaceTag = (CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata + 14)) & 0xff; + + /* check for MIC failure before processing the signal */ + receptionStatus = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata + CSR_WIFI_MA_PKT_IND_RECEPTION_STATUS_OFFSET); + + /* To discard any spurious MIC failures that could be reported by the firmware */ + isDataFrame = ((frmCtrl & IEEE80211_FC_TYPE_MASK) == (IEEE802_11_FC_TYPE_DATA & IEEE80211_FC_TYPE_MASK)) ? TRUE : FALSE; + /* 0x00 is the only valid protocol version*/ + isProtocolVerInvalid = (frmCtrl & IEEE80211_FC_PROTO_VERSION_MASK) ? TRUE : FALSE; + frmCtrlSubType = (frmCtrl & IEEE80211_FC_SUBTYPE_MASK) >> FRAME_CONTROL_SUBTYPE_FIELD_OFFSET; + /*Exclude the no data & reserved sub-types from MIC failure processing*/ + isDataFrameSubTypeNoData = (((frmCtrlSubType>0x03)&&(frmCtrlSubType<0x08)) || (frmCtrlSubType>0x0B)) ? TRUE : FALSE; + if ((receptionStatus == CSR_MICHAEL_MIC_ERROR) && + ((!isDataFrame) || isProtocolVerInvalid || (isDataFrame && isDataFrameSubTypeNoData))) { + /* Currently MIC errors are discarded for frames other than data frames. This might need changing when we start + * supporting 802.11w (Protected Management frames) + */ + *freeBulkData = TRUE; + unifi_trace(priv, UDBG4, "Discarding this frame and ignoring the MIC failure as this is a garbage/non-data/no data frame\n"); + return FALSE; + } + +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + + if (receptionStatus == CSR_MICHAEL_MIC_ERROR) { + + if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_STA) { + + /* If this MIC ERROR reported by the firmware is either for + * [1] a WAPI Multicast Packet and the Multicast filter has NOT been set (It is set only when group key index (MSKID) = 1 in Group Rekeying) OR + * [2] a WAPI Unicast Packet and either the CONTROL PORT is open or the WAPI Unicast filter or filter(s) is NOT set + * then report a MIC FAILURE indication to the SME. + */ + if ((priv->wapi_multicast_filter == 0) || isUnicastPkt) { + + /*Discard the frame*/ + *freeBulkData = TRUE; + unifi_trace(priv, UDBG4, "Discarding the contents of the frame with MIC failure \n"); + + if (isUnicastPkt && + ((uf_sme_port_state(priv,srcAddr,UF_CONTROLLED_PORT_Q,interfaceTag) != CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN)|| + (priv->wapi_unicast_filter) || + (priv->wapi_unicast_queued_pkt_filter))) { + + /* Workaround to handle MIC failures reported by the firmware for encrypted packets from the AP + * while we are in the process of re-association induced by unsupported WAPI Unicast key index + * - Discard the packets with MIC failures "until" we have + * a. negotiated a key, + * b. opened the CONTROL PORT and + * c. the AP has started using the new key + */ + unifi_trace(priv, UDBG4, "Ignoring the MIC failure as either a. CONTROL PORT isn't OPEN or b. Unicast filter is set or c. WAPI AP using old key for buffered pkts\n"); + + /*Ignore this MIC failure*/ + return FALSE; + + }/*WAPI re-key specific workaround*/ + + unifi_trace(priv, UDBG6, "check_routing_pkt_data_ind - MIC FAILURE : interfaceTag %x Src Addr %x:%x:%x:%x:%x:%x\n", + interfaceTag, srcAddr[0], srcAddr[1], srcAddr[2], srcAddr[3], srcAddr[4], srcAddr[5]); + unifi_trace(priv, UDBG6, "check_routing_pkt_data_ind - MIC FAILURE : Dest Addr %x:%x:%x:%x:%x:%x\n", + destAddr[0], destAddr[1], destAddr[2], destAddr[3], destAddr[4], destAddr[5]); + unifi_trace(priv, UDBG6, "check_routing_pkt_data_ind - MIC FAILURE : Control Port State - 0x%.4X \n", + uf_sme_port_state(priv,srcAddr,UF_CONTROLLED_PORT_Q,interfaceTag)); + + unifi_error(priv, "MIC failure in %s\n", __FUNCTION__); + + /*Report the MIC failure to the SME*/ + return TRUE; + } + }/* STA mode */ + else { + /* Its AP Mode . Just Return */ + *freeBulkData = TRUE; + unifi_error(priv, "MIC failure in %s\n", __FUNCTION__); + return TRUE; + } /* AP mode */ + }/* MIC error */ +#else + if (receptionStatus == CSR_MICHAEL_MIC_ERROR) { + *freeBulkData = TRUE; + unifi_error(priv, "MIC failure in %s\n", __FUNCTION__); + return TRUE; + } +#endif /*CSR_WIFI_SECURITY_WAPI_ENABLE*/ + + unifi_trace(priv, UDBG4, "frmCtrl = 0x%04x %s\n", + frmCtrl, + (((frmCtrl & 0x000c)>>FRAME_CONTROL_TYPE_FIELD_OFFSET) == IEEE802_11_FRAMETYPE_MANAGEMENT) ? + "Mgt" : "Ctrl/Data"); + +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + /* To ignore MIC failures reported due to the WAPI AP using the old key for queued packets before + * starting to use the new key negotiated as part of unicast re-keying + */ + if (isUnicastPkt && + (receptionStatus == CSR_RX_SUCCESS) && + (priv->wapi_unicast_queued_pkt_filter==1)) { + + unifi_trace(priv, UDBG6, "check_routing_pkt_data_ind(): WAPI unicast pkt received when the (wapi_unicast_queued_pkt_filter) is set\n"); + + if (isDataFrame) { + switch(frmCtrl & IEEE80211_FC_SUBTYPE_MASK) { + case IEEE802_11_FC_TYPE_QOS_DATA & IEEE80211_FC_SUBTYPE_MASK: + llcSnapHeaderOffset = MAC_HEADER_SIZE + 2; + break; + case IEEE802_11_FC_TYPE_QOS_NULL & IEEE80211_FC_SUBTYPE_MASK: + case IEEE802_11_FC_TYPE_NULL & IEEE80211_FC_SUBTYPE_MASK: + break; + default: + llcSnapHeaderOffset = MAC_HEADER_SIZE; + } + } + + if (llcSnapHeaderOffset > 0) { + /* QoS data or Data */ + unifi_trace(priv, UDBG6, "check_routing_pkt_data_ind(): SNAP header found & its offset %d\n",llcSnapHeaderOffset); + if (memcmp((CsrUint8 *)(bulkdata->d[0].os_data_ptr+llcSnapHeaderOffset+wapiProtocolIdSNAPHeaderOffset), + wapiProtocolIdSNAPHeader,sizeof(wapiProtocolIdSNAPHeader))) { + + unifi_trace(priv, UDBG6, "check_routing_pkt_data_ind(): This is a data & NOT a WAI protocol packet\n"); + /* On the first unicast data pkt that is decrypted successfully after re-keying, reset the filter */ + priv->wapi_unicast_queued_pkt_filter = 0; + unifi_trace(priv, UDBG4, "check_routing_pkt_data_ind(): WAPI AP has started using the new unicast key, no more MIC failures expected (reset filter)\n"); + } + else { + unifi_trace(priv, UDBG6, "check_routing_pkt_data_ind(): WAPI - This is a WAI protocol packet\n"); + } + } + } +#endif + + + switch ((frmCtrl & 0x000c)>>FRAME_CONTROL_TYPE_FIELD_OFFSET) { + case IEEE802_11_FRAMETYPE_MANAGEMENT: + *freeBulkData = TRUE; /* Free (after SME handler copies it) */ + + /* In P2P device mode, filter the legacy AP beacons here */ + if((interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2P)&&\ + ((CSR_WIFI_80211_GET_FRAME_SUBTYPE(macHdrLocation)) == CSR_WIFI_80211_FRAME_SUBTYPE_BEACON)){ + + CsrUint8 *pSsid, *pSsidLen; + static CsrUint8 P2PWildCardSsid[CSR_WIFI_P2P_WILDCARD_SSID_LENGTH] = {'D', 'I', 'R', 'E', 'C', 'T', '-'}; + + pSsidLen = macHdrLocation + MAC_HEADER_SIZE + CSR_WIFI_BEACON_FIXED_LENGTH; + pSsid = pSsidLen + 2; + + if(*(pSsidLen + 1) >= CSR_WIFI_P2P_WILDCARD_SSID_LENGTH){ + if(memcmp(pSsid, P2PWildCardSsid, CSR_WIFI_P2P_WILDCARD_SSID_LENGTH) == 0){ + unifi_trace(priv, UDBG6, "Received a P2P Beacon, pass it to SME\n"); + return TRUE; + } + } + unifi_trace(priv, UDBG6, "Received a Legacy AP beacon in P2P mode, drop it\n"); + return FALSE; + } + return TRUE; /* Route to SME */ + case IEEE802_11_FRAMETYPE_DATA: + case IEEE802_11_FRAMETYPE_CONTROL: + *freeBulkData = FALSE; /* Network stack or MLME handler frees */ + return FALSE; + default: + unifi_error(priv, "Unhandled frame type %04x\n", frmCtrl); + *freeBulkData = TRUE; /* Not interested, but must free it */ + return FALSE; + } +} +#ifdef CSR_WIFI_RX_PATH_SPLIT +static CsrBool signal_buffer_is_full(unifi_priv_t* priv) +{ + return (((priv->rxSignalBuffer.writePointer + 1)% priv->rxSignalBuffer.size) == (priv->rxSignalBuffer.readPointer)); + +} +#endif +/* + * --------------------------------------------------------------------------- + * unifi_receive_event + * + * Dispatcher for received signals. + * + * This function receives the 'to host' signals and forwards + * them to the unifi linux clients. + * + * Arguments: + * ospriv Pointer to driver's private data. + * sigdata Pointer to the packed signal buffer. + * siglen Length of the packed signal. + * bulkdata Pointer to the signal's bulk data. + * + * Returns: + * None. + * + * Notes: + * The signals are received in the format described in the host interface + * specification, i.e wire formatted. Certain clients use the same format + * to interpret them and other clients use the host formatted structures. + * Each client has to call read_unpack_signal() to transform the wire + * formatted signal into the host formatted signal, if necessary. + * The code is in the core, since the signals are defined therefore + * binded to the host interface specification. + * --------------------------------------------------------------------------- + */ + + +void +unifi_receive_event(void *ospriv, + CsrUint8 *sigdata, CsrUint32 siglen, + const bulk_data_param_t *bulkdata) +{ +#ifdef CSR_WIFI_RX_PATH_SPLIT + unifi_priv_t *priv = (unifi_priv_t*)ospriv; + CsrUint8 writePointer; + int i; + rx_buff_struct_t * rx_buff; + func_enter(); + + unifi_trace(priv, UDBG5, "unifi_receive_event: " + "%04x %04x %04x %04x %04x %04x %04x %04x (%d)\n", + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*0) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*1) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*2) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*3) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*4) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*5) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*6) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*7) & 0xFFFF, siglen); + if(signal_buffer_is_full(priv)) { + unifi_error(priv,"TO HOST signal queue FULL dropping the PDU\n"); + for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { + if (bulkdata->d[i].data_length != 0) { + unifi_net_data_free(priv, (void *)&bulkdata->d[i]); + } + } + return; + } + writePointer = priv->rxSignalBuffer.writePointer; + rx_buff = &priv->rxSignalBuffer.rx_buff[writePointer]; + memcpy(rx_buff->bufptr,sigdata,siglen); + rx_buff->sig_len = siglen; + rx_buff->data_ptrs = *bulkdata; + writePointer++; + if(writePointer >= priv->rxSignalBuffer.size) { + writePointer =0; + } + unifi_trace(priv, UDBG4, "unifi_receive_event:writePtr = %d\n",priv->rxSignalBuffer.writePointer); + priv->rxSignalBuffer.writePointer = writePointer; + +#ifndef CSR_WIFI_RX_PATH_SPLIT_DONT_USE_WQ + queue_work(priv->rx_workqueue, &priv->rx_work_struct); +#endif + +#else + unifi_priv_t *priv = (unifi_priv_t*)ospriv; + int i, receiver_id; + int client_id; + CsrInt16 signal_id; + CsrBool pktIndToSme = FALSE, freeBulkData = FALSE; + + func_enter(); + + unifi_trace(priv, UDBG5, "unifi_receive_event: " + "%04x %04x %04x %04x %04x %04x %04x %04x (%d)\n", + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*0) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*1) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*2) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*3) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*4) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*5) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*6) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*7) & 0xFFFF, siglen); + + receiver_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)) & 0xFF00; + client_id = (receiver_id & 0x0F00) >> UDI_SENDER_ID_SHIFT; + signal_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata); + + + + /* check for the type of frame received (checks for 802.11 management frames) */ + if (signal_id == CSR_MA_PACKET_INDICATION_ID) + { + CsrUint8 interfaceTag; + netInterface_priv_t *interfacePriv; + + /* Pull out interface tag from virtual interface identifier */ + interfaceTag = (CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata + 14)) & 0xff; + interfacePriv = priv->interfacePriv[interfaceTag]; + + /* Update activity for this station in case of IBSS */ +#ifdef CSR_SUPPORT_SME + + if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_IBSS) { + + CsrUint8 *saddr; + /* Fetch the source address from mac header */ + saddr = (CsrUint8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR2_OFFSET; + unifi_trace(priv, UDBG5, + "Updating sta activity in IBSS interfaceTag %x Src Addr %x:%x:%x:%x:%x:%x\n", + interfaceTag, saddr[0], saddr[1], saddr[2], saddr[3], saddr[4], saddr[5]); + + uf_update_sta_activity(priv, interfaceTag, saddr); + } +#endif + + pktIndToSme = check_routing_pkt_data_ind(priv, sigdata, bulkdata, &freeBulkData, interfacePriv); + + unifi_trace(priv, UDBG6, "RX: packet entry point to driver from HIP,pkt to SME ?(%s) \n", (pktIndToSme)? "YES":"NO"); + } + + if (pktIndToSme) + { + /* Management MA_PACKET_IND for SME */ + if(sigdata != NULL && bulkdata != NULL){ + send_to_client(priv, priv->sme_cli, receiver_id, sigdata, siglen, bulkdata); + } + else{ + unifi_error(priv, "unifi_receive_event: sigdata or Bulkdata is NULL \n"); + } +#ifdef CSR_NATIVE_LINUX + send_to_client(priv, priv->wext_client, + receiver_id, + sigdata, siglen, bulkdata); +#endif + } + else + { + /* Signals with ReceiverId==0 are also reported to SME / WEXT, + * unless they are data/control MA_PACKET_INDs or VIF_AVAILABILITY_INDs + */ + if (!receiver_id) { + if(signal_id == CSR_MA_VIF_AVAILABILITY_INDICATION_ID) + { + uf_process_ma_vif_availibility_ind(priv, sigdata, siglen); + } + else if (signal_id != CSR_MA_PACKET_INDICATION_ID) + { + send_to_client(priv, priv->sme_cli, receiver_id, sigdata, siglen, bulkdata); +#ifdef CSR_NATIVE_LINUX + send_to_client(priv, priv->wext_client, + receiver_id, + sigdata, siglen, bulkdata); +#endif + } + }/*if (receiver_id==0) */ + +#ifdef CSR_SUPPORT_SME +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + /* Send a WAPI Multicast Indication to SME if the filter has been set + * and this is a multicast data packet + */ + if ((priv->wapi_multicast_filter == 1) && (signal_id == CSR_MA_PACKET_INDICATION_ID)) { + CSR_SIGNAL signal; + CsrUint8 *destAddr; + CsrResult res; + CsrUint16 interfaceTag = 0; + + /* Check if it is a multicast packet from the destination address in the MAC header */ + res = read_unpack_signal(sigdata, &signal); + destAddr = (CsrUint8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR1_OFFSET; + if (res) { + unifi_error(priv, "Received unknown or corrupted signal.\n"); + return; + } + /*Individual/Group bit - Bit 0 of first byte*/ + if (destAddr[0] & 0x01) { + unifi_trace(priv, UDBG4, "Received a WAPI multicast packet ind\n"); + + CsrWifiRouterCtrlWapiMulticastIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, siglen, sigdata, bulkdata->d[0].data_length, (CsrUint8*)bulkdata->d[0].os_data_ptr); + + for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { + if (bulkdata->d[i].data_length != 0) { + unifi_net_data_free(priv, (void *)&bulkdata->d[i]); + } + } + func_exit(); + return; + } + } +#endif +#endif + + /* calls the registered clients handler callback func. + * netdev_mlme_event_handler is one of the registered handler used to route + * data packet to network stack or AMP/EAPOL related data to SME + */ + /* The freeBulkData check ensures that, it has received a management frame and + * the frame needs to be freed here. So not to be passed to netdev handler + */ + if(!freeBulkData){ + if ((client_id < MAX_UDI_CLIENTS) && + (&priv->ul_clients[client_id] != priv->logging_client)) { + send_to_client(priv, &priv->ul_clients[client_id], + receiver_id, + sigdata, siglen, bulkdata); + } + } + } + + /* + * Free bulk data buffers here unless it is a CSR_MA_PACKET_INDICATION + */ + switch (signal_id) + { +#ifdef UNIFI_SNIFF_ARPHRD + case CSR_MA_SNIFFDATA_INDICATION_ID: +#endif + break; + + case CSR_MA_PACKET_INDICATION_ID: + if (!freeBulkData) + { + break; + } + /* FALLS THROUGH... */ + default: + for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { + if (bulkdata->d[i].data_length != 0) { + unifi_net_data_free(priv, (void *)&bulkdata->d[i]); + } + } + } +#endif + func_exit(); +} /* unifi_receive_event() */ + +#ifdef CSR_WIFI_RX_PATH_SPLIT +/* + * --------------------------------------------------------------------------- + * unifi_receive_event2 + * + * Dispatcher for received signals. + * + * This function receives the 'to host' signals and forwards + * them to the unifi linux clients. + * + * Arguments: + * ospriv Pointer to driver's private data. + * sigdata Pointer to the packed signal buffer. + * siglen Length of the packed signal. + * bulkdata Pointer to the signal's bulk data. + * + * Returns: + * None. + * + * Notes: + * The signals are received in the format described in the host interface + * specification, i.e wire formatted. Certain clients use the same format + * to interpret them and other clients use the host formatted structures. + * Each client has to call read_unpack_signal() to transform the wire + * formatted signal into the host formatted signal, if necessary. + * The code is in the core, since the signals are defined therefore + * binded to the host interface specification. + * --------------------------------------------------------------------------- + */ +static void +unifi_receive_event2(void *ospriv, + CsrUint8 *sigdata, CsrUint32 siglen, + const bulk_data_param_t *bulkdata) +{ + unifi_priv_t *priv = (unifi_priv_t*)ospriv; + int i, receiver_id; + int client_id; + CsrInt16 signal_id; + CsrBool pktIndToSme = FALSE, freeBulkData = FALSE; + + func_enter(); + + unifi_trace(priv, UDBG5, "unifi_receive_event2: " + "%04x %04x %04x %04x %04x %04x %04x %04x (%d)\n", + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*0) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*1) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*2) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*3) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*4) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*5) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*6) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*7) & 0xFFFF, siglen); + + receiver_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)) & 0xFF00; + client_id = (receiver_id & 0x0F00) >> UDI_SENDER_ID_SHIFT; + signal_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata); + + + + /* check for the type of frame received (checks for 802.11 management frames) */ + if (signal_id == CSR_MA_PACKET_INDICATION_ID) + { + CsrUint8 interfaceTag; + netInterface_priv_t *interfacePriv; + + /* Pull out interface tag from virtual interface identifier */ + interfaceTag = (CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata + 14)) & 0xff; + interfacePriv = priv->interfacePriv[interfaceTag]; + + /* Update activity for this station in case of IBSS */ +#ifdef CSR_SUPPORT_SME + + if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_IBSS) { + + CsrUint8 *saddr; + /* Fetch the source address from mac header */ + saddr = (CsrUint8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR2_OFFSET; + unifi_trace(priv, UDBG5, + "Updating sta activity in IBSS interfaceTag %x Src Addr %x:%x:%x:%x:%x:%x\n", + interfaceTag, saddr[0], saddr[1], saddr[2], saddr[3], saddr[4], saddr[5]); + + uf_update_sta_activity(priv, interfaceTag, saddr); + } +#endif + + pktIndToSme = check_routing_pkt_data_ind(priv, sigdata, bulkdata, &freeBulkData, interfacePriv); + + unifi_trace(priv, UDBG6, "RX: packet entry point to driver from HIP,pkt to SME ?(%s) \n", (pktIndToSme)? "YES":"NO"); + + } + + if (pktIndToSme) + { + /* Management MA_PACKET_IND for SME */ + if(sigdata != NULL && bulkdata != NULL){ + send_to_client(priv, priv->sme_cli, receiver_id, sigdata, siglen, bulkdata); + } + else{ + unifi_error(priv, "unifi_receive_event2: sigdata or Bulkdata is NULL \n"); + } +#ifdef CSR_NATIVE_LINUX + send_to_client(priv, priv->wext_client, + receiver_id, + sigdata, siglen, bulkdata); +#endif + } + else + { + /* Signals with ReceiverId==0 are also reported to SME / WEXT, + * unless they are data/control MA_PACKET_INDs or VIF_AVAILABILITY_INDs + */ + if (!receiver_id) { + if(signal_id == CSR_MA_VIF_AVAILABILITY_INDICATION_ID) + { + uf_process_ma_vif_availibility_ind(priv, sigdata, siglen); + } + else if (signal_id != CSR_MA_PACKET_INDICATION_ID) + { + send_to_client(priv, priv->sme_cli, receiver_id, sigdata, siglen, bulkdata); +#ifdef CSR_NATIVE_LINUX + send_to_client(priv, priv->wext_client, + receiver_id, + sigdata, siglen, bulkdata); +#endif + } + } + +#ifdef CSR_SUPPORT_SME +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + /* Send a WAPI Multicast Indication to SME if the filter has been set + * and this is a multicast data packet + */ + if ((priv->wapi_multicast_filter == 1) && (signal_id == CSR_MA_PACKET_INDICATION_ID)) { + CSR_SIGNAL signal; + CsrUint8 *destAddr; + CsrResult res; + CsrUint16 interfaceTag = 0; + + /* Check if it is a multicast packet from the destination address in the MAC header */ + res = read_unpack_signal(sigdata, &signal); + destAddr = (CsrUint8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR1_OFFSET; + if (res) { + unifi_error(priv, "Received unknown or corrupted signal.\n"); + return; + } + /*Individual/Group bit - Bit 0 of first byte*/ + if (destAddr[0] & 0x01) { + unifi_trace(priv, UDBG4, "Received a WAPI multicast packet ind\n"); + + CsrWifiRouterCtrlWapiMulticastIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, siglen, sigdata, bulkdata->d[0].data_length, (CsrUint8*)bulkdata->d[0].os_data_ptr); + + for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { + if (bulkdata->d[i].data_length != 0) { + unifi_net_data_free(priv, (void *)&bulkdata->d[i]); + } + } + func_exit(); + return; + } + } +#endif +#endif + + /* calls the registered clients handler callback func. + * netdev_mlme_event_handler is one of the registered handler used to route + * data packet to network stack or AMP/EAPOL related data to SME + */ + /* The freeBulkData check ensures that, it has received a management frame and + * the frame needs to be freed here. So not to be passed to netdev handler + */ + if(!freeBulkData){ + if ((client_id < MAX_UDI_CLIENTS) && + (&priv->ul_clients[client_id] != priv->logging_client)) { + send_to_client(priv, &priv->ul_clients[client_id], + receiver_id, + sigdata, siglen, bulkdata); + } + } + } + + /* + * Free bulk data buffers here unless it is a CSR_MA_PACKET_INDICATION + */ + switch (signal_id) + { +#ifdef UNIFI_SNIFF_ARPHRD + case CSR_MA_SNIFFDATA_INDICATION_ID: +#endif + break; + + case CSR_MA_PACKET_INDICATION_ID: + if (!freeBulkData) + { + break; + } + /* FALLS THROUGH... */ + default: + for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { + if (bulkdata->d[i].data_length != 0) { + unifi_net_data_free(priv, (void *)&bulkdata->d[i]); + } + } + } + + func_exit(); +} /* unifi_receive_event2() */ + +void unifi_rx_queue_flush(void *ospriv) +{ + unifi_priv_t *priv = (unifi_priv_t*)ospriv; + + func_enter(); + unifi_trace(priv, UDBG4, "rx_wq_handler: RdPtr = %d WritePtr = %d\n", + priv->rxSignalBuffer.readPointer,priv->rxSignalBuffer.writePointer); + if(priv != NULL) { + CsrUint8 readPointer = priv->rxSignalBuffer.readPointer; + while(readPointer != priv->rxSignalBuffer.writePointer) { + rx_buff_struct_t * buf = &priv->rxSignalBuffer.rx_buff[readPointer]; + unifi_trace(priv, UDBG6, "rx_wq_handler: RdPtr = %d WritePtr = %d\n", + readPointer,priv->rxSignalBuffer.writePointer); + unifi_receive_event2(priv,buf->bufptr,buf->sig_len,&buf->data_ptrs); + readPointer ++; + if(readPointer >= priv->rxSignalBuffer.size) { + readPointer = 0; + } + } + priv->rxSignalBuffer.readPointer = readPointer; + } + func_exit(); +} + +void rx_wq_handler(struct work_struct *work) +{ + unifi_priv_t *priv = container_of(work,unifi_priv_t,rx_work_struct); + unifi_rx_queue_flush(priv); +} + +#endif diff --git a/drivers/staging/csr/unifi_native.h b/drivers/staging/csr/unifi_native.h new file mode 100644 index 0000000..0015ec2 --- /dev/null +++ b/drivers/staging/csr/unifi_native.h @@ -0,0 +1,276 @@ +/* + ***************************************************************************** + * + * FILE : unifi_native.h + * + * PURPOSE : Private header file for unifi driver support to wireless extensions. + * + * UDI = UniFi Debug Interface + * + * Copyright (C) 2005-2008 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + ***************************************************************************** + */ +#ifndef __LINUX_UNIFI_NATIVE_H__ +#define __LINUX_UNIFI_NATIVE_H__ 1 + +#include +#include + + +/* + * scan.c wext.c autojoin.c + */ +/* Structure to hold results of a scan */ +typedef struct scan_info { + +/* CSR_MLME_SCAN_INDICATION msi; */ + + unsigned char *info_elems; + int info_elem_length; + +} scan_info_t; + + +#define IE_VECTOR_MAXLEN 1024 + +#ifdef CSR_SUPPORT_WEXT +/* + * Structre to hold the wireless network configuration info. + */ +struct wext_config { + + /* Requested channel when setting up an adhoc network */ + int channel; + + /* wireless extns mode: IW_MODE_AUTO, ADHOC, INFRA, MASTER ... MONITOR */ + int mode; + + /* The capabilities of the currently joined network */ + int capability; + + /* The interval between beacons if we create an IBSS */ + int beacon_period; + + /* + * Power-save parameters + */ + /* The listen interval to ask for in Associate req. */ + int assoc_listen_interval; + /* Power-mode to put UniFi into */ + + unsigned char desired_ssid[UNIFI_MAX_SSID_LEN]; /* the last ESSID set by SIOCSIWESSID */ + int power_mode; + /* Whether to wake for broadcast packets (using DTIM interval) */ + int wakeup_for_dtims; + + /* Currently selected WEP Key ID (0..3) */ + int wep_key_id; + + wep_key_t wep_keys[NUM_WEPKEYS]; + +/* CSR_AUTHENTICATION_TYPE auth_type; */ + int privacy; + + u32 join_failure_timeout; + u32 auth_failure_timeout; + u32 assoc_failure_timeout; + + unsigned char generic_ie[IE_VECTOR_MAXLEN]; + int generic_ie_len; + + struct iw_statistics wireless_stats; + + + /* the ESSID we are currently associated to */ + unsigned char current_ssid[UNIFI_MAX_SSID_LEN]; + /* the BSSID we are currently associated to */ + unsigned char current_bssid[6]; + + /* + * IW_AUTH_WPA_VERSION_DISABLED 0x00000001 + * IW_AUTH_WPA_VERSION_WPA 0x00000002 + * IW_AUTH_WPA_VERSION_WPA2 0x00000004 + */ + unsigned char wpa_version; + + /* + * cipher selection: + * IW_AUTH_CIPHER_NONE 0x00000001 + * IW_AUTH_CIPHER_WEP40 0x00000002 + * IW_AUTH_CIPHER_TKIP 0x00000004 + * IW_AUTH_CIPHER_CCMP 0x00000008 + * IW_AUTH_CIPHER_WEP104 0x00000010 + */ + unsigned char pairwise_cipher_used; + unsigned char group_cipher_used; + + unsigned int frag_thresh; + unsigned int rts_thresh; + + /* U-APSD value, send with Association Request to WMM Enabled APs */ + unsigned char wmm_bss_uapsd_mask; + /* The WMM capabilities of the selected BSS */ + unsigned int bss_wmm_capabilities; + + /* Flag to prevent a join when the ssid is set */ + int disable_join_on_ssid_set; + + /* Scan info */ +#define UNIFI_MAX_SCANS 32 + scan_info_t scan_list[UNIFI_MAX_SCANS]; + int num_scan_info; + + /* Flag on whether non-802.1x packets are allowed out */ + CsrWifiRouterPortAction block_controlled_port; + + /* Flag on whether we have completed an authenticate/associate process */ + unsigned int flag_associated : 1; +}; /* struct wext_config */ + +#endif /* CSR_SUPPORT_WEXT */ + + +/* + * wext.c + */ +/*int mlme_set_protection(unifi_priv_t *priv, unsigned char *addr, + CSR_PROTECT_TYPE prot, CSR_KEY_TYPE key_type); +*/ + +/* + * scan.c + */ +/* +void unifi_scan_indication_handler(unifi_priv_t *priv, + const CSR_MLME_SCAN_INDICATION *msg, + const unsigned char *extra, + unsigned int len); +*/ +void unifi_clear_scan_table(unifi_priv_t *priv); +scan_info_t *unifi_get_scan_report(unifi_priv_t *priv, int index); + + +/* + * Utility functions + */ +const unsigned char *unifi_find_info_element(int id, + const unsigned char *info, + int len); +int unifi_add_info_element(unsigned char *info, + int ie_id, + const unsigned char *ie_data, + int ie_len); + +/* + * autojoin.c + */ +/* Higher level fns */ +int unifi_autojoin(unifi_priv_t *priv, const char *ssid); +/* +int unifi_do_scan(unifi_priv_t *priv, int scantype, CSR_BSS_TYPE bsstype, + const char *ssid, int ssid_len); +*/ +int unifi_set_powermode(unifi_priv_t *priv); +int unifi_join_ap(unifi_priv_t *priv, scan_info_t *si); +int unifi_join_bss(unifi_priv_t *priv, unsigned char *macaddr); +int unifi_leave(unifi_priv_t *priv); +unsigned int unifi_get_wmm_bss_capabilities(unifi_priv_t *priv, + unsigned char *ie_vector, + int ie_len, int *ap_capabilities); + +/* + * Status and management. + */ +int uf_init_wext_interface(unifi_priv_t *priv); +void uf_deinit_wext_interface(unifi_priv_t *priv); + +/* + * Function to reset UniFi's 802.11 state by sending MLME-RESET.req + */ +int unifi_reset_state(unifi_priv_t *priv, unsigned char *macaddr, unsigned char set_default_mib); + + +/* + * mlme.c + */ +/* Abort an MLME operation - useful in error recovery */ +int uf_abort_mlme(unifi_priv_t *priv); + +int unifi_mlme_blocking_request(unifi_priv_t *priv, ul_client_t *pcli, + CSR_SIGNAL *sig, bulk_data_param_t *data_ptrs, + int timeout); +void unifi_mlme_copy_reply_and_wakeup_client(ul_client_t *pcli, + CSR_SIGNAL *signal, int signal_len, + const bulk_data_param_t *bulkdata); + +/* + * Utility functions + */ +const char *lookup_reason_code(int reason); +const char *lookup_result_code(int result); + + +/* + * sme_native.c + */ +int uf_sme_init(unifi_priv_t *priv); +void uf_sme_deinit(unifi_priv_t *priv); +int sme_sys_suspend(unifi_priv_t *priv); +int sme_sys_resume(unifi_priv_t *priv); +int sme_mgt_wifi_on(unifi_priv_t *priv); + +/* Callback for event logging to SME clients (unifi_manager) */ +void sme_native_log_event(ul_client_t *client, + const u8 *sig_packed, int sig_len, + const bulk_data_param_t *bulkdata, + int dir); + +void sme_native_mlme_event_handler(ul_client_t *pcli, + const u8 *sig_packed, int sig_len, + const bulk_data_param_t *bulkdata, + int dir); + +/* Task to query statistics from the MIB */ +#define UF_SME_STATS_WQ_TIMEOUT 2000 /* in msecs */ +void uf_sme_stats_wq(struct work_struct *work); + +void uf_native_process_udi_signal(ul_client_t *pcli, + const u8 *packed_signal, + int packed_signal_len, + const bulk_data_param_t *bulkdata, int dir); +#if 0 +/* + * Choose one of these if available in linux/if_arp.h: + * #define UNIFI_SNIFF_ARPHRD ARPHRD_IEEE80211_RADIOTAP + * #define UNIFI_SNIFF_ARPHRD ARPHRD_IEEE80211_PRISM + * + * Radiotap is the newer standard for softmac WLAN devices, it works with + * Wireshark but not Ethereal (due to a bug in the Ethereal dissector). + * Prism is an older (less desirable) format but it does work with Ethereal. + */ +#ifdef ARPHRD_IEEE80211_RADIOTAP +#define UNIFI_SNIFF_ARPHRD ARPHRD_IEEE80211_RADIOTAP +#else +#ifdef ARPHRD_IEEE80211_PRISM +#define UNIFI_SNIFF_ARPHRD ARPHRD_IEEE80211_PRISM +#endif +#endif +#endif + +#ifdef UNIFI_SNIFF_ARPHRD +/* + * monitor.c + */ +int uf_start_sniff(unifi_priv_t *priv); +/* +void ma_sniffdata_ind(void *ospriv, + const CSR_MA_SNIFFDATA_INDICATION *ind, + const bulk_data_param_t *bulkdata); +*/ +#endif /* ARPHRD_IEEE80211_PRISM */ + +#endif /* __LINUX_UNIFI_NATIVE_H__ */ diff --git a/drivers/staging/csr/unifi_os.h b/drivers/staging/csr/unifi_os.h new file mode 100644 index 0000000..579c7e0 --- /dev/null +++ b/drivers/staging/csr/unifi_os.h @@ -0,0 +1,137 @@ +/* + * --------------------------------------------------------------------------- + * + * FILE: os_linux/unifi_os.h + * + * PURPOSE: + * This header file provides the OS-dependent facilities for a linux + * environment. + * + * Copyright (C) 2005-2008 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * --------------------------------------------------------------------------- + */ +#ifndef __UNIFI_OS_LINUX_H__ +#define __UNIFI_OS_LINUX_H__ 1 + +#include +#include +#include +#include +#include + +/* + * Needed for core/signals.c + */ +#include + + +/* Define INLINE directive*/ +#define INLINE inline + +/* Malloc and free */ +CsrResult unifi_net_data_malloc(void *ospriv, bulk_data_desc_t *bulk_data_slot, unsigned int size); +void unifi_net_data_free(void *ospriv, bulk_data_desc_t *bulk_data_slot); +#define CSR_WIFI_ALIGN_BYTES 4 +CsrResult unifi_net_dma_align(void *ospriv, bulk_data_desc_t *bulk_data_slot); + +/* + * Byte Order + * Note that __le*_to_cpu and __cpu_to_le* return an unsigned value! + */ +#ifdef __KERNEL__ +#define unifi2host_16(n) (__le16_to_cpu((n))) +#define unifi2host_32(n) (__le32_to_cpu((n))) +#define host2unifi_16(n) (__cpu_to_le16((n))) +#define host2unifi_32(n) (__cpu_to_le32((n))) +#endif + +/* Module parameters */ +extern int unifi_debug; + +/* debugging */ +#ifdef UNIFI_DEBUG +/* + * unifi_debug is a verbosity level for debug messages + * UDBG0 msgs are always printed if UNIFI_DEBUG is defined + * UDBG1 msgs are printed if UNIFI_DEBUG is defined and unifi_debug > 0 + * etc. + */ + +#define func_enter() \ + do { \ + if (unifi_debug >= 5) { \ + printk("unifi: => %s\n", __FUNCTION__); \ + } \ + } while (0) +#define func_exit() \ + do { \ + if (unifi_debug >= 5) { \ + printk("unifi: <= %s\n", __FUNCTION__); \ + } \ + } while (0) +#define func_exit_r(_rc) \ + do { \ + if (unifi_debug >= 5) { \ + printk("unifi: <= %s %d\n", __FUNCTION__, (int)(_rc)); \ + } \ + } while (0) + + +#define ASSERT(cond) \ + do { \ + if (!(cond)) { \ + printk("Assertion failed in %s at %s:%d: %s\n", \ + __FUNCTION__, __FILE__, __LINE__, #cond); \ + } \ + } while (0) + + +void unifi_dump(void *ospriv, int lvl, const char *msg, void *mem, CsrUint16 len); +void dump(void *mem, CsrUint16 len); +void dump16(void *mem, CsrUint16 len); +#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE +void dump_str(void *mem, CsrUint16 len); +#endif /* CSR_WIFI_HIP_DEBUG_OFFLINE */ + +#else + +/* Stubs */ +#define func_enter() +#define func_exit() +#define func_exit_r(_rc) + +#define ASSERT(cond) + +static inline void unifi_dump(void *ospriv, int lvl, const char *msg, void *mem, CsrUint16 len) {} +static inline void dump(void *mem, CsrUint16 len) {} +static inline void dump16(void *mem, CsrUint16 len) {} +#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE +static inline void dump_str(void *mem, CsrUint16 len) {} +#endif /* CSR_WIFI_HIP_DEBUG_OFFLINE */ + +#endif /* UNIFI_DEBUG */ + + +void unifi_error(void* ospriv, const char *fmt, ...); +void unifi_warning(void* ospriv, const char *fmt, ...); +void unifi_notice(void* ospriv, const char *fmt, ...); +void unifi_info(void* ospriv, const char *fmt, ...); + +void unifi_trace(void* ospriv, int level, const char *fmt, ...); + +/* Different levels of diagnostic detail... */ +#define UDBG0 0 /* always prints in debug build */ +#define UDBG1 1 +#define UDBG2 2 +#define UDBG3 3 +#define UDBG4 4 +#define UDBG5 5 +#define UDBG6 6 +#define UDBG7 7 + + +#endif /* __UNIFI_OS_LINUX_H__ */ diff --git a/drivers/staging/csr/unifi_pdu_processing.c b/drivers/staging/csr/unifi_pdu_processing.c new file mode 100644 index 0000000..36b871e --- /dev/null +++ b/drivers/staging/csr/unifi_pdu_processing.c @@ -0,0 +1,3728 @@ +/* + * --------------------------------------------------------------------------- + * FILE: unifi_pdu_processing.c + * + * PURPOSE: + * This file provides the PDU handling functionality before it gets sent to unfi and after + * receiving a PDU from unifi + * + * Copyright (C) 2010 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * --------------------------------------------------------------------------- + */ + + +#include +#include +#include + +#include "csr_wifi_hip_unifi.h" +#include "csr_wifi_hip_conversions.h" +#include "csr_time.h" +#include "unifi_priv.h" +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) +#include +#endif +#include + +#ifdef CSR_SUPPORT_SME +static void _update_buffered_pkt_params_after_alignment(unifi_priv_t *priv, bulk_data_param_t *bulkdata, + tx_buffered_packets_t* buffered_pkt) +{ + + struct sk_buff *skb ; + CsrUint32 align_offset; + + if (priv == NULL || bulkdata == NULL || buffered_pkt == NULL){ + return; + } + skb = (struct sk_buff*)bulkdata->d[0].os_net_buf_ptr; + align_offset = (CsrUint32)(long)(bulkdata->d[0].os_data_ptr) & (CSR_WIFI_ALIGN_BYTES-1); + if(align_offset){ + skb_pull(skb,align_offset); + } + buffered_pkt->bulkdata.os_data_ptr = skb->data; + buffered_pkt->bulkdata.data_length = skb->len; + + +} +#endif + +void +unifi_frame_ma_packet_req(unifi_priv_t *priv, CSR_PRIORITY priority, + CSR_RATE TransmitRate, CSR_CLIENT_TAG hostTag, + CsrUint16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl, + CSR_PROCESS_ID leSenderProcessId, CsrUint8 *peerMacAddress, + CSR_SIGNAL *signal) +{ + + CSR_MA_PACKET_REQUEST *req = &signal->u.MaPacketRequest; + netInterface_priv_t *interfacePriv; + CsrUint8 ba_session_idx = 0; + ba_session_tx_struct *ba_session = NULL; + CsrUint8 *ba_addr = NULL; + + interfacePriv = priv->interfacePriv[interfaceTag]; + + UF_TRACE_MAC(priv, UDBG5, "In unifi_frame_ma_packet_req, Frame for Peer:", peerMacAddress); + signal->SignalPrimitiveHeader.SignalId = CSR_MA_PACKET_REQUEST_ID; + signal->SignalPrimitiveHeader.ReceiverProcessId = 0; + signal->SignalPrimitiveHeader.SenderProcessId = leSenderProcessId; + + /* Fill the MA-PACKET.req */ + req->Priority = priority; + unifi_trace(priv, UDBG3, "Tx Frame with Priority: 0x%x\n", req->Priority); + + /* A value of 0 is used for auto selection of rates. But for P2P GO case + * for action frames the rate is governed by SME. Hence instead of 0, + * the rate is filled in with the value passed here + */ + req->TransmitRate = TransmitRate; + + /* packets from netdev then no confirm required but packets from + * Nme/Sme eapol data frames requires the confirmation + */ + req->TransmissionControl = transmissionControl; + req->VirtualInterfaceIdentifier = + uf_get_vif_identifier(interfacePriv->interfaceMode,interfaceTag); + memcpy(req->Ra.x, peerMacAddress, ETH_ALEN); + + if (hostTag == 0xffffffff) { + req->HostTag = interfacePriv->tag++; + req->HostTag |= 0x40000000; + unifi_trace(priv, UDBG3, "new host tag assigned = 0x%x\n", req->HostTag); + interfacePriv->tag &= 0x0fffffff; + } else { + req->HostTag = hostTag; + unifi_trace(priv, UDBG3, "host tag got from SME = 0x%x\n", req->HostTag); + } + /* check if BA session exists for the peer MAC address on same tID */ + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO){ + ba_addr = peerMacAddress; + }else{ + ba_addr = interfacePriv->bssid.a; + } + for (ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_TX; ba_session_idx++){ + ba_session = interfacePriv->ba_session_tx[ba_session_idx]; + if (ba_session){ + if ((!memcmp(ba_session->macAddress.a, ba_addr, ETH_ALEN)) && (ba_session->tID == priority)){ + req->TransmissionControl |= CSR_ALLOW_BA; + break; + } + } + } + + unifi_trace(priv, UDBG5, "leaving unifi_frame_ma_packet_req\n"); +} + +#ifdef CSR_SUPPORT_SME + +#define TRANSMISSION_CONTROL_TRIGGER_MASK 0x0001 +#define TRANSMISSION_CONTROL_ESOP_MASK 0x0002 + +static +int frame_and_send_queued_pdu(unifi_priv_t* priv,tx_buffered_packets_t* buffered_pkt, + CsrWifiRouterCtrlStaInfo_t *staRecord,CsrBool moreData , CsrBool eosp) +{ + + CSR_SIGNAL signal; + bulk_data_param_t bulkdata; + int result; + CsrUint8 toDs, fromDs, macHeaderLengthInBytes = MAC_HEADER_SIZE; + CsrUint8 *qc; + CsrUint16 *fc = (CsrUint16*)(buffered_pkt->bulkdata.os_data_ptr); + unsigned long lock_flags; + unifi_trace(priv, UDBG3, "frame_and_send_queued_pdu with moreData: %d , EOSP: %d\n",moreData,eosp); + unifi_frame_ma_packet_req(priv, buffered_pkt->priority, buffered_pkt->rate, buffered_pkt->hostTag, + buffered_pkt->interfaceTag, buffered_pkt->transmissionControl, + buffered_pkt->leSenderProcessId, buffered_pkt->peerMacAddress.a, &signal); + bulkdata.d[0].os_data_ptr = buffered_pkt->bulkdata.os_data_ptr; + bulkdata.d[0].data_length = buffered_pkt->bulkdata.data_length; + bulkdata.d[0].os_net_buf_ptr = buffered_pkt->bulkdata.os_net_buf_ptr; + bulkdata.d[0].net_buf_length = buffered_pkt->bulkdata.net_buf_length; + bulkdata.d[1].os_data_ptr = NULL; + bulkdata.d[1].data_length = 0; + bulkdata.d[1].os_net_buf_ptr =0; + bulkdata.d[1].net_buf_length =0; + + if(moreData) { + *fc |= cpu_to_le16(IEEE802_11_FC_MOREDATA_MASK); + } else { + *fc &= cpu_to_le16(~IEEE802_11_FC_MOREDATA_MASK); + } + + if((staRecord != NULL)&& (staRecord->wmmOrQosEnabled == TRUE)) + { + unifi_trace(priv, UDBG3, "frame_and_send_queued_pdu WMM Enabled: %d \n",staRecord->wmmOrQosEnabled); + + toDs = (*fc & cpu_to_le16(IEEE802_11_FC_TO_DS_MASK))?1 : 0; + fromDs = (*fc & cpu_to_le16(IEEE802_11_FC_FROM_DS_MASK))? 1: 0; + + switch(le16_to_cpu(*fc) & IEEE80211_FC_SUBTYPE_MASK) + { + case IEEE802_11_FC_TYPE_QOS_DATA & IEEE80211_FC_SUBTYPE_MASK: + case IEEE802_11_FC_TYPE_QOS_NULL & IEEE80211_FC_SUBTYPE_MASK: + /* If both are set then the Address4 exists (only for AP) */ + if (fromDs && toDs) + { + /* 6 is the size of Address4 field */ + macHeaderLengthInBytes += (QOS_CONTROL_HEADER_SIZE + 6); + } + else + { + macHeaderLengthInBytes += QOS_CONTROL_HEADER_SIZE; + } + + /* If order bit set then HT control field is the part of MAC header */ + if (*fc & cpu_to_le16(IEEE80211_FC_ORDER_MASK)) { + macHeaderLengthInBytes += HT_CONTROL_HEADER_SIZE; + } + break; + default: + if (fromDs && toDs) + macHeaderLengthInBytes += 6; + break; + } + + if (*fc & cpu_to_le16(IEEE80211_FC_ORDER_MASK)) { + qc = (CsrUint8*)(buffered_pkt->bulkdata.os_data_ptr + (macHeaderLengthInBytes-6)); + } else { + qc = (CsrUint8*)(buffered_pkt->bulkdata.os_data_ptr + (macHeaderLengthInBytes-2)); + } + + *qc = eosp ? *qc | (1 << 4) : *qc & (~(1 << 4)); + } + result = ul_send_signal_unpacked(priv, &signal, &bulkdata); + if(result){ + _update_buffered_pkt_params_after_alignment(priv, &bulkdata,buffered_pkt); + } + + /* Decrement the packet counts queued in driver */ + if (result != -ENOSPC) { + /* protect entire counter updation by disabling preemption */ + if (!priv->noOfPktQueuedInDriver) { + unifi_error(priv, "packets queued in driver 0 still decrementing\n"); + } else { + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + priv->noOfPktQueuedInDriver--; + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + } + /* Sta Record is available for all unicast (except genericMgt Frames) & in other case its NULL */ + if (staRecord) { + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + if (!staRecord->noOfPktQueued) { + unifi_error(priv, "packets queued in driver per station is 0 still decrementing\n"); + } else { + staRecord->noOfPktQueued--; + } + /* if the STA alive probe frame has failed then reset the saved host tag */ + if (result){ + if (staRecord->nullDataHostTag == buffered_pkt->hostTag){ + staRecord->nullDataHostTag = INVALID_HOST_TAG; + } + } + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + } + + } + return result; +} +#ifdef CSR_SUPPORT_SME +static +void set_eosp_transmit_ctrl(unifi_priv_t *priv, struct list_head *txList) +{ + /* dequeue the tx data packets from the appropriate queue */ + tx_buffered_packets_t *tx_q_item = NULL; + struct list_head *listHead; + struct list_head *placeHolder; + unsigned long lock_flags; + + + unifi_trace(priv, UDBG5, "entering set_eosp_transmit_ctrl\n"); + /* check for list empty */ + if (list_empty(txList)) { + unifi_warning(priv, "In set_eosp_transmit_ctrl, the list is empty\n"); + return; + } + + /* return the last node , and modify it. */ + + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_for_each_prev_safe(listHead, placeHolder, txList) { + tx_q_item = list_entry(listHead, tx_buffered_packets_t, q); + tx_q_item->transmissionControl |= TRANSMISSION_CONTROL_ESOP_MASK; + tx_q_item->transmissionControl = (tx_q_item->transmissionControl & ~(CSR_NO_CONFIRM_REQUIRED)); + unifi_trace(priv, UDBG1, + "set_eosp_transmit_ctrl Transmission Control = 0x%x hostTag = 0x%x \n",tx_q_item->transmissionControl,tx_q_item->hostTag); + unifi_trace(priv,UDBG3,"in set_eosp_transmit_ctrl no.of buffered frames %d\n",priv->noOfPktQueuedInDriver); + break; + } + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + unifi_trace(priv, UDBG1,"List Empty %d\n",list_empty(txList)); + unifi_trace(priv, UDBG5, "leaving set_eosp_transmit_ctrl\n"); + return; +} + +static +void send_vif_availibility_rsp(unifi_priv_t *priv,CSR_VIF_IDENTIFIER vif,CSR_RESULT_CODE resultCode) +{ + CSR_SIGNAL signal; + CSR_MA_VIF_AVAILABILITY_RESPONSE *rsp; + bulk_data_param_t *bulkdata = NULL; + int r; + + memset(&signal,0,sizeof(CSR_SIGNAL)); + rsp = &signal.u.MaVifAvailabilityResponse; + rsp->VirtualInterfaceIdentifier = vif; + rsp->ResultCode = resultCode; + signal.SignalPrimitiveHeader.SignalId = CSR_MA_VIF_AVAILABILITY_RESPONSE_ID; + signal.SignalPrimitiveHeader.ReceiverProcessId = 0; + signal.SignalPrimitiveHeader.SenderProcessId = priv->netdev_client->sender_id; + + /* Send the signal to UniFi */ + r = ul_send_signal_unpacked(priv, &signal, bulkdata); + if(r) { + unifi_error(priv,"Availibility response sending failed %x status %d\n",vif,r); + } +} +#endif + +static +void verify_and_accomodate_tx_packet(unifi_priv_t *priv) +{ + tx_buffered_packets_t *tx_q_item; + unsigned long lock_flags; + struct list_head *listHead, *list; + struct list_head *placeHolder; + CsrUint8 i, j,eospFramedeleted=0; + CsrBool thresholdExcedeDueToBroadcast = TRUE; + /* it will be made it interface Specific in the future when multi interfaces are supported , + right now interface 0 is considered */ + netInterface_priv_t *interfacePriv = priv->interfacePriv[0]; + CsrWifiRouterCtrlStaInfo_t *staInfo = NULL; + + unifi_trace(priv, UDBG3, "entering verify_and_accomodate_tx_packet\n"); + + for(i = 0; i < UNIFI_MAX_CONNECTIONS; i++) { + staInfo = interfacePriv->staInfo[i]; + if (staInfo && (staInfo->noOfPktQueued >= CSR_WIFI_DRIVER_MAX_PKT_QUEUING_THRESHOLD_PER_PEER)) { + /* remove the first(oldest) packet from the all the access catogory, since data + * packets for station record crossed the threshold limit (64 for AP supporting + * 8 peers) + */ + unifi_trace(priv,UDBG3,"number of station pkts queued= %d for sta id = %d\n", staInfo->noOfPktQueued, staInfo->aid); + for(j = 0; j < MAX_ACCESS_CATOGORY; j++) { + list = &staInfo->dataPdu[j]; + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_for_each_safe(listHead, placeHolder, list) { + tx_q_item = list_entry(listHead, tx_buffered_packets_t, q); + list_del(listHead); + thresholdExcedeDueToBroadcast = FALSE; + unifi_net_data_free(priv, &tx_q_item->bulkdata); + kfree(tx_q_item); + tx_q_item = NULL; + if (!priv->noOfPktQueuedInDriver) { + unifi_error(priv, "packets queued in driver 0 still decrementing in %s\n", __FUNCTION__); + } else { + /* protection provided by spinlock */ + priv->noOfPktQueuedInDriver--; + + } + /* Sta Record is available for all unicast (except genericMgt Frames) & in other case its NULL */ + if (!staInfo->noOfPktQueued) { + unifi_error(priv, "packets queued in driver per station is 0 still decrementing in %s\n", __FUNCTION__); + } else { + spin_lock(&priv->staRecord_lock); + staInfo->noOfPktQueued--; + spin_unlock(&priv->staRecord_lock); + } + break; + } + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + } + } + } + if (thresholdExcedeDueToBroadcast && interfacePriv->noOfbroadcastPktQueued > CSR_WIFI_DRIVER_MINIMUM_BROADCAST_PKT_THRESHOLD ) { + /* Remove the packets from genericMulticastOrBroadCastFrames queue + * (the max packets in driver is reached due to broadcast/multicast frames) + */ + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_for_each_safe(listHead, placeHolder, &interfacePriv->genericMulticastOrBroadCastFrames) { + tx_q_item = list_entry(listHead, tx_buffered_packets_t, q); + if(eospFramedeleted){ + tx_q_item->transmissionControl |= TRANSMISSION_CONTROL_ESOP_MASK; + tx_q_item->transmissionControl = (tx_q_item->transmissionControl & ~(CSR_NO_CONFIRM_REQUIRED)); + unifi_trace(priv, UDBG1,"updating eosp for next packet hostTag:= 0x%x ",tx_q_item->hostTag); + eospFramedeleted =0; + break; + } + + if(tx_q_item->transmissionControl & TRANSMISSION_CONTROL_ESOP_MASK ){ + eospFramedeleted = 1; + } + unifi_trace(priv,UDBG1, "freeing of multicast packets ToC = 0x%x hostTag = 0x%x \n",tx_q_item->transmissionControl,tx_q_item->hostTag); + list_del(listHead); + unifi_net_data_free(priv, &tx_q_item->bulkdata); + kfree(tx_q_item); + priv->noOfPktQueuedInDriver--; + spin_lock(&priv->staRecord_lock); + interfacePriv->noOfbroadcastPktQueued--; + spin_unlock(&priv->staRecord_lock); + if(!eospFramedeleted){ + break; + } + } + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + } + unifi_trace(priv, UDBG3, "leaving verify_and_accomodate_tx_packet\n"); +} + +static +CsrResult enque_tx_data_pdu(unifi_priv_t *priv, bulk_data_param_t *bulkdata, + struct list_head *list, CSR_SIGNAL *signal, + CsrBool requeueOnSamePos) +{ + + /* queue the tx data packets on to appropriate queue */ + CSR_MA_PACKET_REQUEST *req = &signal->u.MaPacketRequest; + tx_buffered_packets_t *tx_q_item; + unsigned long lock_flags; + + unifi_trace(priv, UDBG5, "entering enque_tx_data_pdu\n"); + if(!list) { + unifi_error(priv,"List is not specified\n"); + return CSR_RESULT_FAILURE; + } + + /* Removes aged packets & adds the incoming packet */ + if (priv->noOfPktQueuedInDriver >= CSR_WIFI_DRIVER_SUPPORT_FOR_MAX_PKT_QUEUEING) { + unifi_trace(priv,UDBG3,"number of pkts queued= %d \n", priv->noOfPktQueuedInDriver); + verify_and_accomodate_tx_packet(priv); + } + + + + tx_q_item = (tx_buffered_packets_t *)kmalloc(sizeof(tx_buffered_packets_t), GFP_ATOMIC); + if (tx_q_item == NULL) { + unifi_error(priv, + "Failed to allocate %d bytes for tx packet record\n", + sizeof(tx_buffered_packets_t)); + func_exit(); + return CSR_RESULT_FAILURE; + } + + /* disable the preemption */ + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + INIT_LIST_HEAD(&tx_q_item->q); + /* fill the tx_q structure members */ + tx_q_item->bulkdata.os_data_ptr = bulkdata->d[0].os_data_ptr; + tx_q_item->bulkdata.data_length = bulkdata->d[0].data_length; + tx_q_item->bulkdata.os_net_buf_ptr = bulkdata->d[0].os_net_buf_ptr; + tx_q_item->bulkdata.net_buf_length = bulkdata->d[0].net_buf_length; + tx_q_item->interfaceTag = req->VirtualInterfaceIdentifier & 0xff; + tx_q_item->hostTag = req->HostTag; + tx_q_item->leSenderProcessId = signal->SignalPrimitiveHeader.SenderProcessId; + tx_q_item->transmissionControl = req->TransmissionControl; + tx_q_item->priority = req->Priority; + tx_q_item->rate = req->TransmitRate; + memcpy(tx_q_item->peerMacAddress.a, req->Ra.x, ETH_ALEN); + + + + if (requeueOnSamePos) { + list_add(&tx_q_item->q, list); + } else { + list_add_tail(&tx_q_item->q, list); + } + + /* Count of packet queued in driver */ + priv->noOfPktQueuedInDriver++; + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + unifi_trace(priv, UDBG5, "leaving enque_tx_data_pdu\n"); + return CSR_RESULT_SUCCESS; +} +static +CsrResult enque_direceted_ma_pkt_cfm_data_pdu(unifi_priv_t *priv, bulk_data_param_t *bulkdata, + struct list_head *list, CSR_SIGNAL *signal, + CsrBool requeueOnSamePos) +{ + + /* queue the tx data packets on to appropriate queue */ + CSR_MA_PACKET_REQUEST *req = &signal->u.MaPacketRequest; + tx_buffered_packets_t *tx_q_item; + + + unifi_trace(priv, UDBG5, "entering enque_tx_data_pdu\n"); + if(!list ) { + unifi_error(priv,"List is not specified\n"); + return CSR_RESULT_FAILURE; + } + if(!requeueOnSamePos && !list->prev){ + unifi_error(priv,"List prev is NULL so don't requeu it\n"); + return CSR_RESULT_FAILURE; + + } + + + + tx_q_item = (tx_buffered_packets_t *)kmalloc(sizeof(tx_buffered_packets_t), GFP_ATOMIC); + if (tx_q_item == NULL) { + unifi_error(priv, + "Failed to allocate %d bytes for tx packet record\n", + sizeof(tx_buffered_packets_t)); + func_exit(); + return CSR_RESULT_FAILURE; + } + /* disable the preemption */ + INIT_LIST_HEAD(&tx_q_item->q); + /* fill the tx_q structure members */ + tx_q_item->bulkdata.os_data_ptr = bulkdata->d[0].os_data_ptr; + tx_q_item->bulkdata.data_length = bulkdata->d[0].data_length; + tx_q_item->bulkdata.os_net_buf_ptr = bulkdata->d[0].os_net_buf_ptr; + tx_q_item->bulkdata.net_buf_length = bulkdata->d[0].net_buf_length; + tx_q_item->interfaceTag = req->VirtualInterfaceIdentifier & 0xff; + tx_q_item->hostTag = req->HostTag; + tx_q_item->leSenderProcessId = signal->SignalPrimitiveHeader.SenderProcessId; + tx_q_item->transmissionControl = req->TransmissionControl; + tx_q_item->priority = req->Priority; + tx_q_item->rate = req->TransmitRate; + memcpy(tx_q_item->peerMacAddress.a, req->Ra.x, ETH_ALEN); + + + + if (requeueOnSamePos) { + list_add(&tx_q_item->q, list); + } else { + list_add_tail(&tx_q_item->q, list); + } + + /* Count of packet queued in driver */ + priv->noOfPktQueuedInDriver++; + unifi_trace(priv, UDBG5, "leaving enque_tx_data_pdu\n"); + return CSR_RESULT_SUCCESS; +} + +static void is_all_ac_deliver_enabled_and_moredata(CsrWifiRouterCtrlStaInfo_t *staRecord, CsrUint8 *allDeliveryEnabled, CsrUint8 *dataAvailable) +{ + CsrUint8 i; + *allDeliveryEnabled = TRUE; + for (i = 0 ;i < MAX_ACCESS_CATOGORY; i++) { + if (!IS_DELIVERY_ENABLED(staRecord->powersaveMode[i])) { + /* One is is not Delivery Enabled */ + *allDeliveryEnabled = FALSE; + break; + } + } + if (*allDeliveryEnabled) { + *dataAvailable = (!list_empty(&staRecord->dataPdu[0]) || !list_empty(&staRecord->dataPdu[1]) + ||!list_empty(&staRecord->dataPdu[2]) ||!list_empty(&staRecord->dataPdu[3]) + ||!list_empty(&staRecord->mgtFrames)); + } +} + +/* + * --------------------------------------------------------------------------- + * uf_handle_tim_cfm + * + * + * This function updates tim status in host depending confirm status from firmware + * + * Arguments: + * priv Pointer to device private context struct + * cfm CSR_MLME_SET_TIM_CONFIRM + * receiverProcessId SenderProcessID to fetch handle & timSet status + * + * --------------------------------------------------------------------------- + */ +void uf_handle_tim_cfm(unifi_priv_t *priv, CSR_MLME_SET_TIM_CONFIRM *cfm, CsrUint16 receiverProcessId) +{ + CsrUint8 handle = CSR_WIFI_GET_STATION_HANDLE_FROM_RECEIVER_ID(receiverProcessId); + CsrUint8 timSetStatus = CSR_WIFI_GET_TIMSET_STATE_FROM_RECEIVER_ID(receiverProcessId); + CsrUint16 interfaceTag = (cfm->VirtualInterfaceIdentifier & 0xff); + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + CsrWifiRouterCtrlStaInfo_t *staRecord = NULL; + /* This variable holds what TIM value we wanted to set in firmware */ + CsrUint16 timSetValue = 0; + /* Irrespective of interface the count maintained */ + static CsrUint8 retryCount = 0; + unsigned long lock_flags; + unifi_trace(priv, UDBG3, "entering %s, handle = %x, timSetStatus = %x\n", __FUNCTION__, handle, timSetStatus); + + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_warning(priv, "bad interfaceTag = %x\n", interfaceTag); + return; + } + + if ((handle != CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE) && (handle >= UNIFI_MAX_CONNECTIONS)) { + unifi_warning(priv, "bad station Handle = %x\n", handle); + return; + } + + if (handle != CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE) { + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + if ((staRecord = ((CsrWifiRouterCtrlStaInfo_t *) (interfacePriv->staInfo[handle]))) == NULL) { + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + unifi_warning(priv, "uf_handle_tim_cfm: station record is NULL handle = %x\n", handle); + return; + } + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + } + switch(timSetStatus) + { + case CSR_WIFI_TIM_SETTING: + timSetValue = CSR_WIFI_TIM_SET; + break; + case CSR_WIFI_TIM_RESETTING: + timSetValue = CSR_WIFI_TIM_RESET; + break; + default: + unifi_warning(priv, "timSet state is %x: Debug\n", timSetStatus); + return; + } + + /* check TIM confirm for success/failures */ + switch(cfm->ResultCode) + { + case CSR_RC_SUCCESS: + if (handle != CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE) { + /* Unicast frame & station record available */ + if (timSetStatus == staRecord->timSet) { + staRecord->timSet = timSetValue; + /* fh_cmd_q can also be full at some point of time!, + * resetting count as queue is cleaned by firmware at this point + */ + retryCount = 0; + unifi_trace(priv, UDBG2, "tim (%s) successfully in firmware\n", (timSetValue)?"SET":"RESET"); + } else { + unifi_trace(priv, UDBG3, "receiver processID = %x, success: request & confirm states are not matching in TIM cfm: Debug status = %x, staRecord->timSet = %x, handle = %x\n", + receiverProcessId, timSetStatus, staRecord->timSet, handle); + } + } else { + /* fh_cmd_q can also be full at some point of time!, + * resetting count as queue is cleaned by firmware at this point + */ + retryCount = 0; + unifi_trace(priv, UDBG3, "tim (%s) successfully for broadcast frame in firmware\n", (timSetValue)?"SET":"RESET"); + } + break; + case CSR_RC_INVALID_PARAMETERS: + case CSR_RC_INSUFFICIENT_RESOURCE: + /* check for max retry limit & send again + * MAX_RETRY_LIMIT is not maintained for each set of transactions..Its generic + * If failure crosses this Limit, we have to take a call to FIX + */ + if (retryCount > UNIFI_MAX_RETRY_LIMIT) { + CsrBool moreData = FALSE; + retryCount = 0; + /* Because of continuos traffic in fh_cmd_q the tim set request is failing (exceeding retry limit) + * but if we didn't synchronize our timSet varible state with firmware then it can cause below issues + * cond 1. We want to SET tim in firmware if its fails & max retry limit reached + * -> If host set's the timSet to 1, we wont try to send(as max retry reached) update tim but + * firmware is not updated with queue(TIM) status so it wont set TIM in beacon finally host start piling + * up data & wont try to set tim in firmware (This can cause worser performance) + * cond 2. We want to reset tim in firmware it fails & reaches max retry limit + * -> If host sets the timSet to Zero, it wont try to set a TIM request unless we wont have any packets + * to be queued, so beacon unnecessarily advertizes the TIM + */ + + if(staRecord) { + if(!staRecord->wmmOrQosEnabled) { + moreData = (!list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]) || + !list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]) || + !list_empty(&staRecord->mgtFrames)); + } else { + /* Peer is QSTA */ + CsrUint8 allDeliveryEnabled = 0, dataAvailable = 0; + /* Check if all AC's are Delivery Enabled */ + is_all_ac_deliver_enabled_and_moredata(staRecord, &allDeliveryEnabled, &dataAvailable); + /*check for more data in non-delivery enabled queues*/ + moreData = (uf_is_more_data_for_non_delivery_ac(staRecord) || (allDeliveryEnabled && dataAvailable)); + + } + /* To avoid cond 1 & 2, check internal Queues status, if we have more Data then set RESET the timSet(0), + * so we are trying to be in sync with firmware & next packets before queuing atleast try to + * set TIM in firmware otherwise it SET timSet(1) + */ + if (moreData) { + staRecord->timSet = CSR_WIFI_TIM_RESET; + } else { + staRecord->timSet = CSR_WIFI_TIM_SET; + } + } else { + /* Its a broadcast frames */ + moreData = (!list_empty(&interfacePriv->genericMulticastOrBroadCastMgtFrames) || + !list_empty(&interfacePriv->genericMulticastOrBroadCastFrames)); + if (moreData) { + update_tim(priv, 0, CSR_WIFI_TIM_SET, interfaceTag, 0xFFFFFFFF); + } else { + update_tim(priv, 0, CSR_WIFI_TIM_RESET, interfaceTag, 0xFFFFFFFF); + } + } + + unifi_error(priv, "no of error's for TIM setting crossed the Limit: verify\n"); + return; + } + retryCount++; + + if (handle != CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE) { + if (timSetStatus == staRecord->timSet) { + unifi_warning(priv, "tim request failed, retry for AID = %x\n", staRecord->aid); + update_tim(priv, staRecord->aid, timSetValue, interfaceTag, handle); + } else { + unifi_trace(priv, UDBG1, "failure: request & confirm states are not matching in TIM cfm: Debug status = %x, staRecord->timSet = %x\n", + timSetStatus, staRecord->timSet); + } + } else { + unifi_warning(priv, "tim request failed, retry for broadcast frames\n"); + update_tim(priv, 0, timSetValue, interfaceTag, 0xFFFFFFFF); + } + break; + default: + unifi_warning(priv, "tim update request failed resultcode = %x\n", cfm->ResultCode); + } + unifi_trace(priv, UDBG2, "leaving %s\n", __FUNCTION__); +} + +/* + * --------------------------------------------------------------------------- + * update_tim + * + * + * This function updates tim status in firmware for AID[1 to UNIFI_MAX_CONNECTIONS] or + * AID[0] for broadcast/multicast packets. + * + * NOTE: The LSB (least significant BYTE) of senderId while sending this MLME premitive + * has been modified(utilized) as below + * + * SenderID in signal's SignalPrimitiveHeader is 2 byte the lowe byte bitmap is below + * + * station handle(6 bits) timSet Status (2 bits) + * --------------------- ---------------------- + * 0 0 0 0 0 0 | 0 0 + * + * timSet Status can be one of below: + * + * CSR_WIFI_TIM_RESET + * CSR_WIFI_TIM_RESETTING + * CSR_WIFI_TIM_SET + * CSR_WIFI_TIM_SETTING + * + * Arguments: + * priv Pointer to device private context struct + * aid can be 1 t0 UNIFI_MAX_CONNECTIONS & 0 means multicast/broadcast + * setTim value SET(1) / RESET(0) + * interfaceTag the interfaceID on which activity going on + * handle from (0 <= handle < UNIFI_MAX_CONNECTIONS) + * + * --------------------------------------------------------------------------- + */ +void update_tim(unifi_priv_t * priv, CsrUint16 aid, CsrUint8 setTim, CsrUint16 interfaceTag, CsrUint32 handle) +{ + CSR_SIGNAL signal; + CsrInt32 r; + CSR_MLME_SET_TIM_REQUEST *req = &signal.u.MlmeSetTimRequest; + bulk_data_param_t *bulkdata = NULL; + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + CsrUint8 senderIdLsb = 0; + CsrWifiRouterCtrlStaInfo_t *staRecord = NULL; + CsrUint32 oldTimSetStatus = 0, timSetStatus = 0; + + unifi_trace(priv, UDBG5, "entering the update_tim routine\n"); + + if (handle == 0xFFFFFFFF) { + handle &= CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE; + } else if ((handle != 0xFFFFFFFF) && (handle >= UNIFI_MAX_CONNECTIONS)) { + unifi_warning(priv, "bad station Handle = %x\n", handle); + return; + } + + if (setTim) { + timSetStatus = CSR_WIFI_TIM_SETTING; + } else { + timSetStatus = CSR_WIFI_TIM_RESETTING; + } + + if (handle != CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE) { + if ((staRecord = ((CsrWifiRouterCtrlStaInfo_t *) (interfacePriv->staInfo[handle]))) == NULL) { + unifi_warning(priv, "station record is NULL in update_tim: handle = %x :debug\n", handle); + return; + } + /* In case of signal sending failed, revert back to old state */ + oldTimSetStatus = staRecord->timSet; + staRecord->timSet = timSetStatus; + } + + /* pack senderID LSB */ + senderIdLsb = CSR_WIFI_PACK_SENDER_ID_LSB_FOR_TIM_REQ(handle, timSetStatus); + + /* initialize signal to zero */ + memset(&signal, 0, sizeof(CSR_SIGNAL)); + + /* Frame the MLME-SET-TIM request */ + signal.SignalPrimitiveHeader.SignalId = CSR_MLME_SET_TIM_REQUEST_ID; + signal.SignalPrimitiveHeader.ReceiverProcessId = 0; + CSR_COPY_UINT16_TO_LITTLE_ENDIAN(((priv->netdev_client->sender_id & 0xff00) | senderIdLsb), + (u8*)&signal.SignalPrimitiveHeader.SenderProcessId); + + /* set The virtual interfaceIdentifier, aid, tim value */ + req->VirtualInterfaceIdentifier = uf_get_vif_identifier(interfacePriv->interfaceMode,interfaceTag); + req->AssociationId = aid; + req->TimValue = setTim; + + + unifi_trace(priv, UDBG2, "update_tim:AID %x,senderIdLsb = 0x%x, handle = 0x%x, timSetStatus = %x, sender proceesID = %x \n", + aid,senderIdLsb, handle, timSetStatus, signal.SignalPrimitiveHeader.SenderProcessId); + + /* Send the signal to UniFi */ + r = ul_send_signal_unpacked(priv, &signal, bulkdata); + if (r) { + /* No need to free bulk data, as TIM request doesn't carries any data */ + unifi_error(priv, "Error queueing CSR_MLME_SET_TIM_REQUEST signal\n"); + if (staRecord) { + staRecord->timSet = oldTimSetStatus ; + } + } + unifi_trace(priv, UDBG5, "leaving the update_tim routine\n"); +} + +static +void process_peer_active_transition(unifi_priv_t * priv, + CsrWifiRouterCtrlStaInfo_t *staRecord, + CsrUint16 interfaceTag) +{ + int r,i; + CsrBool spaceAvail[4] = {TRUE,TRUE,TRUE,TRUE}; + tx_buffered_packets_t * buffered_pkt = NULL; + unsigned long lock_flags; + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + + unifi_trace(priv, UDBG5, "entering process_peer_active_transition\n"); + + if(IS_DTIM_ACTIVE(interfacePriv->dtimActive,interfacePriv->multicastPduHostTag)) { + /* giving more priority to multicast packets so delaying unicast packets*/ + unifi_trace(priv,UDBG2," multicast transmission is going on so resume unicast transmission after DTIM over\n"); + return; + } + while((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->mgtFrames))) { + buffered_pkt->transmissionControl &= + ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_ESOP_MASK); + if((r=frame_and_send_queued_pdu(priv,buffered_pkt,staRecord,0,FALSE)) == -ENOSPC) { + unifi_trace(priv, UDBG2, "p_p_a_t:(ENOSPC) Mgt Frame queueing \n"); + /* Enqueue at the head of the queue */ + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_add(&buffered_pkt->q, &staRecord->mgtFrames); + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + priv->pausedStaHandle[3]=(CsrUint8)(staRecord->assignedHandle); + spaceAvail[3] = FALSE; + break; + } else { + if(r){ + unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n"); + /* the PDU failed where we can't do any thing so free the storage */ + unifi_net_data_free(priv, &buffered_pkt->bulkdata); + } + kfree(buffered_pkt); + } + } + if (staRecord->txSuspend) { + if(staRecord->timSet == CSR_WIFI_TIM_SET) { + update_tim(priv,staRecord->aid,0,interfaceTag, staRecord->assignedHandle); + } + return; + } + for(i=3;i>=0;i--) { + if(!spaceAvail[i]) + continue; + unifi_trace(priv, UDBG6, "p_p_a_t:data pkt sending for AC %d \n",i); + while((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->dataPdu[i]))) { + buffered_pkt->transmissionControl &= + ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_ESOP_MASK); + if((r=frame_and_send_queued_pdu(priv,buffered_pkt,staRecord,0,FALSE)) == -ENOSPC) { + /* Clear the trigger bit transmission control*/ + /* Enqueue at the head of the queue */ + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_add(&buffered_pkt->q, &staRecord->dataPdu[i]); + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + priv->pausedStaHandle[i]=(CsrUint8)(staRecord->assignedHandle); + break; + } else { + if(r){ + unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n"); + /* the PDU failed where we can't do any thing so free the storage */ + unifi_net_data_free(priv, &buffered_pkt->bulkdata); + } + kfree(buffered_pkt); + } + } + } + if((staRecord->timSet == CSR_WIFI_TIM_SET) || (staRecord->timSet == CSR_WIFI_TIM_SETTING)){ + unifi_trace(priv, UDBG3, "p_p_a_t:resetting tim .....\n"); + update_tim(priv,staRecord->aid,0,interfaceTag, staRecord->assignedHandle); + } + unifi_trace(priv, UDBG5, "leaving process_peer_active_transition\n"); +} + + + +void uf_process_ma_pkt_cfm_for_ap(unifi_priv_t *priv,CsrUint16 interfaceTag, const CSR_MA_PACKET_CONFIRM *pkt_cfm) +{ + netInterface_priv_t *interfacePriv; + CsrUint8 i; + CsrWifiRouterCtrlStaInfo_t *staRecord = NULL; + struct list_head *listHeadMaPktreq,*listHeadStaQueue; + struct list_head *placeHolderMaPktreq,*placeHolderStaQueue; + unsigned long lock_flags; + unsigned long lock_flags1; + maPktReqList_t *maPktreq = NULL; + tx_buffered_packets_t *tx_q_item = NULL; + bulk_data_param_t bulkdata; + CsrBool entryFound = FALSE; + interfacePriv = priv->interfacePriv[interfaceTag]; + + + if(pkt_cfm->HostTag == interfacePriv->multicastPduHostTag) { + unifi_trace(priv,UDBG2,"CFM for marked Multicast Tag = %x\n",interfacePriv->multicastPduHostTag); + interfacePriv->multicastPduHostTag = 0xffffffff; + resume_suspended_uapsd(priv,interfaceTag); + resume_unicast_buffered_frames(priv,interfaceTag); + if(list_empty(&interfacePriv->genericMulticastOrBroadCastMgtFrames) && + list_empty(&interfacePriv->genericMulticastOrBroadCastFrames)) { + unifi_trace(priv,UDBG1,"Resetting multicastTIM"); + update_tim(priv,0,0,interfaceTag, 0xFFFFFFFF); + } + return; + } + + /* Check if a copy of the same frame (identified by host tag) is queued in driver */ + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_for_each_safe(listHeadMaPktreq, placeHolderMaPktreq, &interfacePriv->directedMaPktReq) { + maPktreq = list_entry(listHeadMaPktreq, maPktReqList_t, q); + if(maPktreq->hostTag == pkt_cfm->HostTag){ + entryFound = TRUE; + break; + } + } + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + + if(entryFound){ + + /* Monitor the time difference between the MA-PACKET.req and MA-PACKET.cfm */ + unsigned long timeout; + timeout = (long)jiffies - (long)maPktreq->jiffeTime; + + /* convert into milliseconds */ + timeout = jiffies_to_msecs(timeout); + unifi_trace(priv, UDBG3, "Jiffies Time: Host Tag(%x) --> Req(%u) Cfm(%u) Diff (in ms): %u\n",maPktreq->hostTag,maPktreq->jiffeTime, jiffies, timeout); + + if( (timeout/1000) > 1) + { + unifi_trace(priv, UDBG1, "Confirm time > 2 Seconds: time = %u Status = %x\n", (timeout/1000), pkt_cfm->TransmissionStatus); + } + + if( CSR_TX_LIFETIME == pkt_cfm->TransmissionStatus || + CSR_TX_BLOCK_ACK_TIMEOUT== pkt_cfm->TransmissionStatus || + CSR_TX_FAIL_TRANSMISSION_VIF_INTERRUPTED== pkt_cfm->TransmissionStatus || + CSR_TX_REJECTED_PEER_STATION_SLEEPING== pkt_cfm->TransmissionStatus || + CSR_TX_REJECTED_DTIM_STARTED== pkt_cfm->TransmissionStatus ){ + + CsrWifiRouterCtrlStaInfo_t *staRecord = interfacePriv->staInfo[maPktreq->staHandler]; + unifi_TrafficQueue priority_q; + struct list_head *list; + CsrResult result; + CSR_MA_PACKET_REQUEST *req = &maPktreq->signal.u.MaPacketRequest; + CsrUint16 ii=0; + CsrBool locationFound = FALSE; + CsrUint8 *sigbuffer; + + sigbuffer = (CsrUint8*)&maPktreq->signal; + if(req->Priority == CSR_MANAGEMENT){ + list = &staRecord->mgtFrames; + unifi_trace(priv,UDBG5,"mgmt list priority %d\n",req->Priority); + } + else{ + priority_q= unifi_frame_priority_to_queue(req->Priority); + list = &staRecord->dataPdu[priority_q]; + unifi_trace(priv,UDBG5,"data list priority %d\n",req->Priority); + } + + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_for_each_safe(listHeadStaQueue, placeHolderStaQueue, list){ + tx_q_item = list_entry(listHeadStaQueue, tx_buffered_packets_t, q); + COMPARE_HOST_TAG_TO_ENQUEUE(tx_q_item->hostTag ,maPktreq->hostTag) + + + } + if(sigbuffer[SIZEOF_SIGNAL_HEADER + 1]){ + skb_pull(maPktreq->skb,sigbuffer[SIZEOF_SIGNAL_HEADER + 1]); + } + + /* enqueue the failed packet sta queue*/ + bulkdata.d[0].os_net_buf_ptr= (unsigned char*)maPktreq->skb; + bulkdata.d[0].os_data_ptr = maPktreq->skb->data; + bulkdata.d[0].data_length = bulkdata.d[0].net_buf_length = maPktreq->skb->len; + bulkdata.d[1].os_data_ptr = NULL; + bulkdata.d[1].os_net_buf_ptr = NULL; + bulkdata.d[1].data_length = bulkdata.d[0].net_buf_length = 0; + unifi_trace(priv,UDBG4,"Cfm Fail for HosTag = %x with status %d so requeue it\n",maPktreq->hostTag,pkt_cfm->TransmissionStatus ); + req->TransmissionControl = 0; + + if(!locationFound){ + + if(list_empty(list)){ + result = enque_direceted_ma_pkt_cfm_data_pdu(priv, &bulkdata, list,&maPktreq->signal,1); + } + else{ + unifi_trace(priv,UDBG4,"did not find location so add to end of list \n"); + result = enque_direceted_ma_pkt_cfm_data_pdu(priv, &bulkdata, list,&maPktreq->signal,0); + } + + + } + + else { + if(ii > 1){ + unifi_trace(priv,UDBG4,"find the location in the middle of list \n"); + result = enque_direceted_ma_pkt_cfm_data_pdu(priv, &bulkdata, listHeadStaQueue,&maPktreq->signal,0); + + } + else{ + unifi_trace(priv,UDBG4," add at begining of list \n"); + result = enque_direceted_ma_pkt_cfm_data_pdu(priv, &bulkdata, list,&maPktreq->signal,1); + } + } + + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + + /* Increment the counter */ + spin_lock_irqsave(&priv->staRecord_lock,lock_flags1); + staRecord->noOfPktQueued++; + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags1); + + + + + /* after enqueuing update the TIM */ + if(CSR_RESULT_SUCCESS == result){ + if(CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE == staRecord->currentPeerState) { + if(staRecord->timSet == CSR_WIFI_TIM_RESET || staRecord->timSet == CSR_WIFI_TIM_RESETTING) { + if(!staRecord->wmmOrQosEnabled) { + unifi_trace(priv, UDBG3, "uf_process_ma_pkt_cfm_for_ap :tim set due to unicast pkt & peer in powersave\n"); + update_tim(priv,staRecord->aid,1,interfaceTag, staRecord->assignedHandle); + } + else { + /* Check for non delivery enable(i.e trigger enable), all delivery enable & legacy AC for TIM update in firmware */ + CsrUint8 allDeliveryEnabled = 0, dataAvailable = 0; + /* Check if all AC's are Delivery Enabled */ + is_all_ac_deliver_enabled_and_moredata(staRecord, &allDeliveryEnabled, &dataAvailable); + if (uf_is_more_data_for_non_delivery_ac(staRecord) || (allDeliveryEnabled && dataAvailable)) { + update_tim(priv,staRecord->aid,1,interfaceTag, staRecord->assignedHandle); + } + } + } + } + } + else{ + dev_kfree_skb(maPktreq->skb); + } + } + else + { + CsrWifiRouterCtrlStaInfo_t *staRecord = interfacePriv->staInfo[maPktreq->staHandler]; + if (CSR_TX_RETRY_LIMIT == pkt_cfm->TransmissionStatus || + CSR_TX_NO_BSS == pkt_cfm->TransmissionStatus) + { + if (staRecord->timSet == CSR_WIFI_TIM_RESET || staRecord->timSet == CSR_WIFI_TIM_RESETTING) + { + unifi_trace(priv, UDBG2, "CFM failed with Retry Limit or No BSS --> update TIM\n"); + update_tim(priv, staRecord->aid, 1, interfaceTag, staRecord->assignedHandle); + } + } + else if (CSR_TX_SUCCESSFUL == pkt_cfm->TransmissionStatus) + { + staRecord->activity_flag = TRUE; + } + unifi_trace(priv, UDBG5, "CFM for HosTag = %x Status = %d, Free SKB reference\n", + maPktreq->hostTag, + pkt_cfm->TransmissionStatus ); + + dev_kfree_skb(maPktreq->skb); + + } + list_del(listHeadMaPktreq); + kfree(maPktreq); + + }else{ + /* Check if it is a Confirm for null data frame used + * for probing station activity + */ + for(i =0; i < UNIFI_MAX_CONNECTIONS; i++) { + staRecord = (CsrWifiRouterCtrlStaInfo_t *) (interfacePriv->staInfo[i]); + if (staRecord && (staRecord->nullDataHostTag == pkt_cfm->HostTag)) { + + unifi_trace(priv, UDBG1, "CFM for Inactive probe Null frame (tag = %x, status = %d)\n", + pkt_cfm->HostTag, + pkt_cfm->TransmissionStatus + ); + staRecord->nullDataHostTag = INVALID_HOST_TAG; + + if(pkt_cfm->TransmissionStatus == CSR_TX_RETRY_LIMIT){ + CsrTime now; + CsrTime inactive_time; + + unifi_trace(priv, UDBG1, "Nulldata to probe STA ALIVE Failed with retry limit\n"); + /* Recheck if there is some activity after null data is sent. + * + * If still there is no activity then send a disconnected indication + * to SME to delete the station record. + */ + if (staRecord->activity_flag){ + return; + } + now = CsrTimeGet(NULL); + + if (staRecord->lastActivity > now) + { + /* simple timer wrap (for 1 wrap) */ + inactive_time = CsrTimeAdd((CsrTime)CsrTimeSub(CSR_SCHED_TIME_MAX, staRecord->lastActivity), + now); + } + else + { + inactive_time = (CsrTime)CsrTimeSub(now, staRecord->lastActivity); + } + + if (inactive_time >= STA_INACTIVE_TIMEOUT_VAL) + { + struct list_head send_cfm_list; + CsrUint8 j; + + /* The SME/NME may be waiting for confirmation for requested frames to this station. + * Though this is --VERY UNLIKELY-- in case of station in active mode. But still as a + * a defensive check, it loops through buffered frames for this station and if confirmation + * is requested, send auto confirmation with failure status. Also flush the frames so + * that these are not processed again in PEER_DEL_REQ handler. + */ + INIT_LIST_HEAD(&send_cfm_list); + + uf_prepare_send_cfm_list_for_queued_pkts(priv, + &send_cfm_list, + &(staRecord->mgtFrames)); + + uf_flush_list(priv, &(staRecord->mgtFrames)); + + for(j = 0; j < MAX_ACCESS_CATOGORY; j++){ + uf_prepare_send_cfm_list_for_queued_pkts(priv, + &send_cfm_list, + &(staRecord->dataPdu[j])); + + uf_flush_list(priv,&(staRecord->dataPdu[j])); + } + + send_auto_ma_packet_confirm(priv, staRecord->interfacePriv, &send_cfm_list); + + + + unifi_warning(priv, "uf_process_ma_pkt_cfm_for_ap: Router Disconnected IND Peer (%x-%x-%x-%x-%x-%x)\n", + staRecord->peerMacAddress.a[0], + staRecord->peerMacAddress.a[1], + staRecord->peerMacAddress.a[2], + staRecord->peerMacAddress.a[3], + staRecord->peerMacAddress.a[4], + staRecord->peerMacAddress.a[5]); + + CsrWifiRouterCtrlConnectedIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, + 0, + staRecord->interfacePriv->InterfaceTag, + staRecord->peerMacAddress, + CSR_WIFI_ROUTER_CTRL_PEER_DISCONNECTED); + } + + } + else if (pkt_cfm->TransmissionStatus == CSR_TX_SUCCESSFUL) + { + staRecord->activity_flag = TRUE; + } + } + } + } +} + +#endif +CsrUint16 uf_get_vif_identifier (CsrWifiRouterCtrlMode mode, CsrUint16 tag) +{ + switch(mode) + { + case CSR_WIFI_ROUTER_CTRL_MODE_STA: + case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI: + return (0x02<<8|tag); + + case CSR_WIFI_ROUTER_CTRL_MODE_AP: + case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: + return (0x03<<8|tag); + + case CSR_WIFI_ROUTER_CTRL_MODE_IBSS: + return (0x01<<8|tag); + + case CSR_WIFI_ROUTER_CTRL_MODE_MONITOR: + return (0x04<<8|tag); + case CSR_WIFI_ROUTER_CTRL_MODE_AMP: + return (0x05<<8|tag); + default: + return tag; + } +} + +#ifdef CSR_SUPPORT_SME + +/* + * --------------------------------------------------------------------------- + * update_macheader + * + * + * These functions updates mac header for intra BSS packet + * routing. + * NOTE: This function always has to be called in rx context which + * is in bh thread context since GFP_KERNEL is used. In soft IRQ/ Interrupt + * context shouldn't be used + * + * Arguments: + * priv Pointer to device private context struct + * skb Socket buffer containing data packet to transmit + * newSkb Socket buffer containing data packet + Mac header if no sufficient headroom in skb + * priority to append QOS control header in Mac header + * bulkdata if newSkb allocated then bulkdata updated to send to unifi + * interfaceTag the interfaceID on which activity going on + * macHeaderLengthInBytes no. of bytes of mac header in received frame + * qosDestination used to append Qos control field + * + * Returns: + * Zero on success or -1 on error. + * --------------------------------------------------------------------------- + */ + +static int update_macheader(unifi_priv_t *priv, struct sk_buff *skb, + struct sk_buff *newSkb, CSR_PRIORITY *priority, + bulk_data_param_t *bulkdata, CsrUint16 interfaceTag, + CsrUint8 macHeaderLengthInBytes, + CsrUint8 qosDestination) +{ + + CsrUint16 *fc = NULL; + CsrUint8 direction = 0, toDs, fromDs; + CsrUint8 *bufPtr = NULL; + CsrUint8 sa[ETH_ALEN], da[ETH_ALEN]; + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + int headroom; + CsrUint8 macHeaderBuf[IEEE802_11_DATA_FRAME_MAC_HEADER_SIZE] = {0}; + + unifi_trace(priv, UDBG5, "entering the update_macheader function\n"); + + /* temporary buffer for the Mac header storage */ + memcpy(macHeaderBuf, skb->data, macHeaderLengthInBytes); + + /* remove the Macheader from the skb */ + skb_pull(skb, macHeaderLengthInBytes); + + /* get the skb headroom for skb_push check */ + headroom = skb_headroom(skb); + + /* pointer to frame control field */ + fc = (CsrUint16*) macHeaderBuf; + + toDs = (*fc & cpu_to_le16(IEEE802_11_FC_TO_DS_MASK))?1 : 0; + fromDs = (*fc & cpu_to_le16(IEEE802_11_FC_FROM_DS_MASK))? 1: 0; + unifi_trace(priv, UDBG5, "In update_macheader function, fromDs = %x, toDs = %x\n", fromDs, toDs); + direction = ((fromDs | (toDs << 1)) & 0x3); + + /* Address1 or 3 from the macheader */ + memcpy(da, macHeaderBuf+4+toDs*12, ETH_ALEN); + /* Address2, 3 or 4 from the mac header */ + memcpy(sa, macHeaderBuf+10+fromDs*(6+toDs*8), ETH_ALEN); + + unifi_trace(priv, UDBG3, "update_macheader:direction = %x\n", direction); + /* update the toDs, fromDs & address fields in Mac header */ + switch(direction) + { + case 2: + /* toDs = 1 & fromDs = 0 , toAp when frames received from peer + * while sending this packet to Destination the Mac header changed + * as fromDs = 1 & toDs = 0, fromAp + */ + *fc &= cpu_to_le16(~IEEE802_11_FC_TO_DS_MASK); + *fc |= cpu_to_le16(IEEE802_11_FC_FROM_DS_MASK); + /* Address1: MAC address of the actual destination (4 = 2+2) */ + memcpy(macHeaderBuf + 4, da, ETH_ALEN); + /* Address2: The MAC address of the AP (10 = 2+2+6) */ + memcpy(macHeaderBuf + 10, &interfacePriv->bssid, ETH_ALEN); + /* Address3: MAC address of the actual source from mac header (16 = 2+2+6+6) */ + memcpy(macHeaderBuf + 16, sa, ETH_ALEN); + break; + case 3: + unifi_trace(priv, UDBG3, "when both the toDs & fromDS set, NOT SUPPORTED\n"); + break; + default: + unifi_trace(priv, UDBG3, "problem in decoding packet in update_macheader \n"); + return -1; + } + + /* frameType is Data always, Validation is done before calling this function */ + + /* check for the souce station type */ + switch(le16_to_cpu(*fc) & IEEE80211_FC_SUBTYPE_MASK) + { + case IEEE802_11_FC_TYPE_QOS_DATA & IEEE80211_FC_SUBTYPE_MASK: + /* No need to modify the qos control field */ + if (!qosDestination) { + + /* If source Sta is QOS enabled & if this bit set, then HTC is supported by + * peer station & htc field present in macHeader + */ + if (*fc & cpu_to_le16(IEEE80211_FC_ORDER_MASK)) { + /* HT control field present in Mac header + * 6 = sizeof(qosControl) + sizeof(htc) + */ + macHeaderLengthInBytes -= 6; + } else { + macHeaderLengthInBytes -= 2; + } + /* Destination STA is non qos so change subtype to DATA */ + *fc &= cpu_to_le16(~IEEE80211_FC_SUBTYPE_MASK); + *fc |= cpu_to_le16(IEEE802_11_FC_TYPE_DATA); + /* remove the qos control field & HTC(if present). new macHeaderLengthInBytes is less than old + * macHeaderLengthInBytes so no need to verify skb headroom + */ + if (headroom < macHeaderLengthInBytes) { + unifi_trace(priv, UDBG1, " sufficient headroom not there to push updated mac header \n"); + return -1; + } + bufPtr = (CsrUint8 *) skb_push(skb, macHeaderLengthInBytes); + + /* update bulk data os_data_ptr */ + bulkdata->d[0].os_data_ptr = skb->data; + bulkdata->d[0].os_net_buf_ptr = (unsigned char*)skb; + bulkdata->d[0].data_length = skb->len; + + } else { + /* pointing to QOS control field */ + CsrUint8 qc; + if (*fc & cpu_to_le16(IEEE80211_FC_ORDER_MASK)) { + qc = *((CsrUint8*)(macHeaderBuf + (macHeaderLengthInBytes - 4 - 2))); + } else { + qc = *((CsrUint8*)(macHeaderBuf + (macHeaderLengthInBytes - 2))); + } + + if ((qc & IEEE802_11_QC_TID_MASK) > 7) { + *priority = 7; + } else { + *priority = qc & IEEE802_11_QC_TID_MASK; + } + + unifi_trace(priv, UDBG1, "Incoming packet priority from QSTA is %x\n", *priority); + + if (headroom < macHeaderLengthInBytes) { + unifi_trace(priv, UDBG3, " sufficient headroom not there to push updated mac header \n"); + return -1; + } + bufPtr = (CsrUint8 *) skb_push(skb, macHeaderLengthInBytes); + } + break; + default: + { + bulk_data_param_t data_ptrs; + CsrResult csrResult; + unifi_trace(priv, UDBG5, "normal Data packet, NO QOS \n"); + + *priority = CSR_CONTENTION; + if (qosDestination) { + CsrUint8 qc = 0; + unifi_trace(priv, UDBG3, "destination is QOS station \n"); + /* prepare the qos control field */ + + qc |= CSR_QOS_UP0; + + /* no Amsdu is in ap buffer so eosp is left 0 */ + + if (da[0] & 0x1) { + /* multicast/broadcast frames, no acknowledgement needed */ + qc |= 1 << 5; + } + + /* update new Mac header Length with 2 = sizeof(qos control) */ + macHeaderLengthInBytes += 2; + + /* received DATA frame but destiantion is QOS station so update subtype to QOS*/ + *fc &= cpu_to_le16(~IEEE80211_FC_SUBTYPE_MASK); + *fc |= cpu_to_le16(IEEE802_11_FC_TYPE_QOS_DATA); + + /* appendQosControlOffset = macHeaderLengthInBytes - 2, since source sta is not QOS */ + macHeaderBuf[macHeaderLengthInBytes - 2] = qc; + /* txopLimit is 0 */ + macHeaderBuf[macHeaderLengthInBytes - 1] = 0; + if (headroom < macHeaderLengthInBytes) { + csrResult = unifi_net_data_malloc(priv, &data_ptrs.d[0], skb->len + macHeaderLengthInBytes); + + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, " failed to allocate request_data. in update_macheader func\n"); + return -1; + } + newSkb = (struct sk_buff *)(data_ptrs.d[0].os_net_buf_ptr); + newSkb->len = skb->len + macHeaderLengthInBytes; + + memcpy((void*)data_ptrs.d[0].os_data_ptr + macHeaderLengthInBytes, + skb->data, skb->len); + + bulkdata->d[0].os_data_ptr = newSkb->data; + bulkdata->d[0].os_net_buf_ptr = (unsigned char*)newSkb; + bulkdata->d[0].data_length = newSkb->len; + + bufPtr = (CsrUint8*)data_ptrs.d[0].os_data_ptr; + + /* The old skb will not be used again */ + kfree_skb(skb); + } else { + /* skb headroom is sufficient to append Macheader */ + bufPtr = (CsrUint8*)skb_push(skb, macHeaderLengthInBytes); + bulkdata->d[0].os_data_ptr = skb->data; + bulkdata->d[0].os_net_buf_ptr = (unsigned char*)skb; + bulkdata->d[0].data_length = skb->len; + } + } else { + unifi_trace(priv, UDBG3, "destination is not a QSTA\n"); + if (headroom < macHeaderLengthInBytes) { + csrResult = unifi_net_data_malloc(priv, &data_ptrs.d[0], skb->len + macHeaderLengthInBytes); + + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, " failed to allocate request_data. in update_macheader func\n"); + return -1; + } + newSkb = (struct sk_buff *)(data_ptrs.d[0].os_net_buf_ptr); + newSkb->len = skb->len + macHeaderLengthInBytes; + + memcpy((void*)data_ptrs.d[0].os_data_ptr + macHeaderLengthInBytes, + skb->data, skb->len); + + bulkdata->d[0].os_data_ptr = newSkb->data; + bulkdata->d[0].os_net_buf_ptr = (unsigned char*)newSkb; + bulkdata->d[0].data_length = newSkb->len; + + bufPtr = (CsrUint8*)data_ptrs.d[0].os_data_ptr; + + /* The old skb will not be used again */ + kfree_skb(skb); + } else { + /* skb headroom is sufficient to append Macheader */ + bufPtr = (CsrUint8*)skb_push(skb, macHeaderLengthInBytes); + bulkdata->d[0].os_data_ptr = skb->data; + bulkdata->d[0].os_net_buf_ptr = (unsigned char*)skb; + bulkdata->d[0].data_length = skb->len; + } + } + } + } + + /* prepare the complete skb, by pushing the MAC header to the begining of the skb->data */ + unifi_trace(priv, UDBG5, "updated Mac Header: %d \n",macHeaderLengthInBytes); + memcpy(bufPtr, macHeaderBuf, macHeaderLengthInBytes); + + unifi_trace(priv, UDBG5, "leaving the update_macheader function\n"); + return 0; +} +/* + * --------------------------------------------------------------------------- + * uf_ap_process_data_pdu + * + * + * Takes care of intra BSS admission control & routing packets within BSS + * + * Arguments: + * priv Pointer to device private context struct + * skb Socket buffer containing data packet to transmit + * ehdr ethernet header to fetch priority of packet + * srcStaInfo source stations record for connection verification + * packed_signal + * signal_len + * signal MA-PACKET.indication signal + * bulkdata if newSkb allocated then bulkdata updated to send to unifi + * macHeaderLengthInBytes no. of bytes of mac header in received frame + * + * Returns: + * Zero on success(ap processing complete) or -1 if packet also have to be sent to NETDEV. + * --------------------------------------------------------------------------- + */ +int +uf_ap_process_data_pdu(unifi_priv_t *priv, struct sk_buff *skb, + struct ethhdr *ehdr, CsrWifiRouterCtrlStaInfo_t * srcStaInfo, + const CSR_SIGNAL *signal, + bulk_data_param_t *bulkdata, + CsrUint8 macHeaderLengthInBytes) +{ + const CSR_MA_PACKET_INDICATION *ind = &(signal->u.MaPacketIndication); + CsrUint16 interfaceTag = (ind->VirtualInterfaceIdentifier & 0x00ff); + struct sk_buff *newSkb = NULL; + /* pointer to skb or private skb created using skb_copy() */ + struct sk_buff *skbPtr = skb; + CsrBool sendToNetdev = FALSE; + CsrBool qosDestination = FALSE; + CSR_PRIORITY priority = CSR_CONTENTION; + CsrWifiRouterCtrlStaInfo_t *dstStaInfo = NULL; + netInterface_priv_t *interfacePriv; + + unifi_trace(priv, UDBG5, "entering uf_ap_process_data_pdu %d\n",macHeaderLengthInBytes); + /* InterfaceTag validation from MA_PACKET.indication */ + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_trace(priv, UDBG1, "Interface Tag is Invalid in uf_ap_process_data_pdu\n"); + unifi_net_data_free(priv, &bulkdata->d[0]); + return 0; + } + interfacePriv = priv->interfacePriv[interfaceTag]; + + if((interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) && + (interfacePriv->intraBssEnabled == FALSE)) { + unifi_trace(priv, UDBG2, "uf_ap_process_data_pdu:P2P GO intrabssEnabled?= %d\n", interfacePriv->intraBssEnabled); + + /*In P2P GO case, if intraBSS distribution Disabled then don't do IntraBSS routing */ + /* If destination in our BSS then drop otherwise give packet to netdev */ + dstStaInfo = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, ehdr->h_dest, interfaceTag); + if (dstStaInfo) { + unifi_net_data_free(priv, &bulkdata->d[0]); + return 0; + } + /* May be associated P2PCLI trying to send the packets on backbone (Netdev) */ + return -1; + } + + if(!memcmp(ehdr->h_dest, interfacePriv->bssid.a, ETH_ALEN)) { + /* This packet will be given to the TCP/IP stack since this packet is for us(AP) + * No routing needed */ + unifi_trace(priv, UDBG4, "destination address is csr_ap\n"); + return -1; + } + + /* fetch the destination record from staion record database */ + dstStaInfo = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, ehdr->h_dest, interfaceTag); + + /* AP mode processing, & if packet is unicast */ + if(!dstStaInfo) { + if (!(ehdr->h_dest[0] & 0x1)) { + /* destination not in station record & its a unicast packet, so pass the packet to network stack */ + unifi_trace(priv, UDBG3, "unicast frame & destination record not exist, send to netdev proto = %x\n", htons(skb->protocol)); + return -1; + } else { + /* packet is multicast/broadcast */ + /* copy the skb to skbPtr, send skb to netdev & skbPtr to multicast/broad cast list */ + unifi_trace(priv, UDBG5, "skb_copy, in uf_ap_process_data_pdu, protocol = %x\n", htons(skb->protocol)); + skbPtr = skb_copy(skb, GFP_KERNEL); + if(skbPtr == NULL) { + /* We don't have memory to don't send the frame in BSS*/ + unifi_notice(priv, "broacast/multicast frame can't be sent in BSS No memeory: proto = %x\n", htons(skb->protocol)); + return -1; + } + sendToNetdev = TRUE; + } + } else { + + /* validate the Peer & Destination Station record */ + if (uf_process_station_records_for_sending_data(priv, interfaceTag, srcStaInfo, dstStaInfo)) { + unifi_notice(priv, "uf_ap_process_data_pdu: station record validation failed \n"); + interfacePriv->stats.rx_errors++; + unifi_net_data_free(priv, &bulkdata->d[0]); + return 0; + } + } + + /* BroadCast packet received and it's been sent as non QOS packets. + * Since WMM spec not mandates broadcast/multicast to be sent as QOS data only, + * if all Peers are QSTA + */ + if(sendToNetdev) { + /* BroadCast packet and it's been sent as non QOS packets */ + qosDestination = FALSE; + } else if(dstStaInfo && (dstStaInfo->wmmOrQosEnabled == TRUE)) { + qosDestination = TRUE; + } + + unifi_trace(priv, UDBG3, "uf_ap_process_data_pdu QoS destination = %s\n", (qosDestination)? "TRUE": "FALSE"); + + /* packet is allowed to send to unifi, update the Mac header */ + if (update_macheader(priv, skbPtr, newSkb, &priority, bulkdata, interfaceTag, macHeaderLengthInBytes, qosDestination)) { + interfacePriv->stats.rx_errors++; + unifi_notice(priv, "(Packet Drop) failed to update the Mac header in uf_ap_process_data_pdu\n"); + if (sendToNetdev) { + /* Free's the skb_copy(skbPtr) data since packet processing failed */ + bulkdata->d[0].os_data_ptr = skbPtr->data; + bulkdata->d[0].os_net_buf_ptr = (unsigned char*)skbPtr; + bulkdata->d[0].data_length = skbPtr->len; + unifi_net_data_free(priv, &bulkdata->d[0]); + } + return -1; + } + + unifi_trace(priv, UDBG3, "Mac Header updated...calling uf_process_ma_packet_req \n"); + + /* Packet is ready to send to unifi ,transmissionControl = 0x0004, confirmation is not needed for data packets */ + if (uf_process_ma_packet_req(priv, ehdr->h_dest, 0xffffffff, interfaceTag, CSR_NO_CONFIRM_REQUIRED, (CSR_RATE)0,priority, priv->netdev_client->sender_id, bulkdata)) { + if (sendToNetdev) { + unifi_trace(priv, UDBG1, "In uf_ap_process_data_pdu, (Packet Drop) uf_process_ma_packet_req failed. freeing skb_copy data (original data sent to Netdev)\n"); + /* Free's the skb_copy(skbPtr) data since packet processing failed */ + bulkdata->d[0].os_data_ptr = skbPtr->data; + bulkdata->d[0].os_net_buf_ptr = (unsigned char*)skbPtr; + bulkdata->d[0].data_length = skbPtr->len; + unifi_net_data_free(priv, &bulkdata->d[0]); + } else { + /* This free's the skb data */ + unifi_trace(priv, UDBG1, "In uf_ap_process_data_pdu, (Packet Drop). Unicast data so freeing original skb \n"); + unifi_net_data_free(priv, &bulkdata->d[0]); + } + } + unifi_trace(priv, UDBG5, "leaving uf_ap_process_data_pdu\n"); + + if (sendToNetdev) { + /* The packet is multicast/broadcast, so after AP processing packet has to + * be sent to netdev, if peer port state is open + */ + unifi_trace(priv, UDBG4, "Packet will be routed to NetDev\n"); + return -1; + } + /* Ap handled the packet & its a unicast packet, no need to send to netdev */ + return 0; +} + +#endif + +CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, + CsrUint8 *peerMacAddress, + CSR_CLIENT_TAG hostTag, + CsrUint16 interfaceTag, + CSR_TRANSMISSION_CONTROL transmissionControl, + CSR_RATE TransmitRate, + CSR_PRIORITY priority, + CSR_PROCESS_ID leSenderProcessId, + bulk_data_param_t *bulkdata) +{ + CsrResult status = CSR_RESULT_SUCCESS; + CSR_SIGNAL signal; + int result; +#ifdef CSR_SUPPORT_SME + CsrWifiRouterCtrlStaInfo_t *staRecord = NULL; + const CsrUint8 *macHdrLocation = bulkdata->d[0].os_data_ptr; + CsrWifiPacketType pktType; + int frameType = 0; + CsrBool queuePacketDozing = FALSE; + CsrUint32 priority_q; + CsrUint16 frmCtrl; + struct list_head * list = NULL; /* List to which buffered PDUs are to be enqueued*/ + CsrBool setBcTim=FALSE; + netInterface_priv_t *interfacePriv; + CsrBool requeueOnSamePos = FALSE; + CsrUint32 handle = 0xFFFFFFFF; + unsigned long lock_flags; + + UF_TRACE_MAC(priv, UDBG5, "entering uf_process_ma_packet_req, peer: ", peerMacAddress); + + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "interfaceTag >= CSR_WIFI_NUM_INTERFACES, interfacetag = %d\n", interfaceTag); + return CSR_RESULT_FAILURE; + } + interfacePriv = priv->interfacePriv[interfaceTag]; + + + /* fetch the station record for corresponding peer mac address */ + if ((staRecord = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, peerMacAddress, interfaceTag))) { + handle = staRecord->assignedHandle; + } + + /* Frame ma-packet.req, this is saved/transmitted depend on queue state */ + unifi_frame_ma_packet_req(priv, priority, TransmitRate, hostTag, + interfaceTag, transmissionControl, leSenderProcessId, + peerMacAddress, &signal); + + /* Since it's common path between STA & AP mode, in case of STA packet + * need not to be queued but in AP case we have to queue PDU's in + * different scenarios + */ + switch(interfacePriv->interfaceMode) + { + case CSR_WIFI_ROUTER_CTRL_MODE_AP: + case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: + /* For this mode processing done below */ + break; + default: + /* In case of STA/IBSS/P2PCLI/AMP, no checks needed send the packet down & return */ + unifi_trace(priv, UDBG5, "In %s, interface mode is %x \n", __FUNCTION__, interfacePriv->interfaceMode); + if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_NONE) { + unifi_warning(priv, "In %s, interface mode NONE \n", __FUNCTION__); + } + if ((result = ul_send_signal_unpacked(priv, &signal, bulkdata))) { + status = CSR_RESULT_FAILURE; + } + return status; + } + + /* -----Only AP/P2pGO mode handling falls below----- */ + + /* convert priority to queue */ + priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY) priority); + + /* check the powersave status of the peer */ + if (staRecord && (staRecord->currentPeerState == + CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE)) { + /* Peer is dozing & packet have to be delivered, so buffer the packet & + * update the TIM + */ + queuePacketDozing = TRUE; + } + + /* find the type of frame unicast or mulicast/broadcast */ + if (*peerMacAddress & 0x1) { + /* Multicast/broadCast data are always triggered by vif_availability.ind + * at the DTIM + */ + pktType = CSR_WIFI_MULTICAST_PDU; + } else { + pktType = CSR_WIFI_UNICAST_PDU; + } + + /* Fetch the frame control field from mac header & check for frame type */ + frmCtrl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(macHdrLocation); + + /* Processing done according to Frame/Packet type */ + frameType = ((frmCtrl & 0x000c) >> FRAME_CONTROL_TYPE_FIELD_OFFSET); + switch(frameType) + { + case IEEE802_11_FRAMETYPE_MANAGEMENT: + + switch(pktType) + { + case CSR_WIFI_UNICAST_PDU: + unifi_trace(priv, UDBG5, "management unicast PDU in uf_process_ma_packet_req \n"); + /* push the packet in to the queue with appropriate mgt list */ + if (!staRecord) { + /* push the packet to the unifi if list is empty (if packet lost how to re-enque) */ + if (list_empty(&interfacePriv->genericMgtFrames)) { +#ifdef CSR_SUPPORT_SME + if(!(IS_DTIM_ACTIVE(interfacePriv->dtimActive,interfacePriv->multicastPduHostTag))) { +#endif + + unifi_trace(priv, UDBG3, "genericMgtFrames list is empty uf_process_ma_packet_req \n"); + result = ul_send_signal_unpacked(priv, &signal, bulkdata); + /* reque only on ENOSPC */ + if(result == -ENOSPC) { + /* requeue the failed packet to genericMgtFrame with same position */ + unifi_trace(priv, UDBG1, "(ENOSPC) Sending genericMgtFrames Failed so buffering\n"); + list = &interfacePriv->genericMgtFrames; + requeueOnSamePos = TRUE; + } +#ifdef CSR_SUPPORT_SME + }else{ + list = &interfacePriv->genericMgtFrames; + unifi_trace(priv, UDBG3, "genericMgtFrames queue empty and dtim started\n hosttag is 0x%x,\n",signal.u.MaPacketRequest.HostTag); + update_eosp_to_head_of_broadcast_list_head(priv,interfaceTag); + } +#endif + } else { + /* Queue the packet to genericMgtFrame of unifi_priv_t data structure */ + list = &interfacePriv->genericMgtFrames; + unifi_trace(priv, UDBG2, "genericMgtFrames queue not empty\n"); + } + } else { + /* check peer power state */ + if (queuePacketDozing || !list_empty(&staRecord->mgtFrames) || IS_DTIM_ACTIVE(interfacePriv->dtimActive,interfacePriv->multicastPduHostTag)) { + /* peer is in dozing mode, so queue packet in mgt frame list of station record */ + /*if multicast traffic is going on, buffer the unicast packets*/ + list = &staRecord->mgtFrames; + + unifi_trace(priv, UDBG1, "staRecord->MgtFrames list empty? = %s, handle = %d, queuePacketDozing = %d\n", + (list_empty(&staRecord->mgtFrames))? "YES": "NO", staRecord->assignedHandle, queuePacketDozing); + if(IS_DTIM_ACTIVE(interfacePriv->dtimActive,interfacePriv->multicastPduHostTag)){ + update_eosp_to_head_of_broadcast_list_head(priv,interfaceTag); + } + + } else { + unifi_trace(priv, UDBG5, "staRecord->mgtFrames list is empty uf_process_ma_packet_req \n"); + result = ul_send_signal_unpacked(priv, &signal, bulkdata); + if(result == -ENOSPC) { + /* requeue the failed packet to staRecord->mgtFrames with same position */ + list = &staRecord->mgtFrames; + requeueOnSamePos = TRUE; + unifi_trace(priv, UDBG1, "(ENOSPC) Sending MgtFrames Failed handle = %d so buffering\n",staRecord->assignedHandle); + priv->pausedStaHandle[0]=(CsrUint8)(staRecord->assignedHandle); + } else if (result) { + status = CSR_RESULT_FAILURE; + } + } + } + break; + case CSR_WIFI_MULTICAST_PDU: + unifi_trace(priv, UDBG5, "management multicast/broadcast PDU in uf_process_ma_packet_req 'QUEUE it' \n"); + /* Queue the packet to genericMulticastOrBroadCastMgtFrames of unifi_priv_t data structure + * will be sent when we receive VIF AVAILABILITY from firmware as part of DTIM + */ + + list = &interfacePriv->genericMulticastOrBroadCastMgtFrames; + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + interfacePriv->noOfbroadcastPktQueued++; + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + if((interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_IBSS) && + (list_empty(&interfacePriv->genericMulticastOrBroadCastMgtFrames))) { + setBcTim=TRUE; + } + break; + default: + unifi_error(priv, "condition never meets: packet type unrecognized\n"); + } + break; + case IEEE802_11_FRAMETYPE_DATA: + switch(pktType) + { + case CSR_WIFI_UNICAST_PDU: + unifi_trace(priv, UDBG5, "data unicast PDU in uf_process_ma_packet_req \n"); + /* check peer power state, list status & peer port status */ + if(!staRecord) { + unifi_error(priv, "In %s unicast but staRecord = NULL\n", __FUNCTION__); + return CSR_RESULT_FAILURE; + } else if (queuePacketDozing || isRouterBufferEnabled(priv,priority_q)|| !list_empty(&staRecord->dataPdu[priority_q]) || IS_DTIM_ACTIVE(interfacePriv->dtimActive,interfacePriv->multicastPduHostTag)) { + /* peer is in dozing mode, so queue packet in mgt frame list of station record */ + /* if multicast traffic is going on, buffet the unicast packets */ + unifi_trace(priv, UDBG2, "Enqueued to staRecord->dataPdu[%d] queuePacketDozing=%d,\ + Buffering enabled = %d \n", priority_q,queuePacketDozing,isRouterBufferEnabled(priv,priority_q)); + signal.u.MaPacketRequest.TransmissionControl &= ~(CSR_NO_CONFIRM_REQUIRED); + list = &staRecord->dataPdu[priority_q]; + } else { + unifi_trace(priv, UDBG5, "staRecord->dataPdu[%d] list is empty uf_process_ma_packet_req \n", priority_q); + signal.u.MaPacketRequest.TransmissionControl &= ~(CSR_NO_CONFIRM_REQUIRED); + /* Pdu allowed to send to unifi */ + result = ul_send_signal_unpacked(priv, &signal, bulkdata); + if(result == -ENOSPC) { + /* requeue the failed packet to staRecord->dataPdu[priority_q] with same position */ + unifi_trace(priv, UDBG1, "(ENOSPC) Sending Unicast DataPDU to queue %d Failed so buffering\n",priority_q); + requeueOnSamePos = TRUE; + list = &staRecord->dataPdu[priority_q]; + priv->pausedStaHandle[priority_q]=(CsrUint8)(staRecord->assignedHandle); + if(!isRouterBufferEnabled(priv,priority_q)) { + unifi_error(priv,"Buffering Not enabled for queue %d \n",priority_q); + } + } else if (result) { + status = CSR_RESULT_FAILURE; + } + } + break; + case CSR_WIFI_MULTICAST_PDU: + unifi_trace(priv, UDBG5, "data multicast/broadcast PDU in uf_process_ma_packet_req \n"); + /* Queue the packet to genericMulticastOrBroadCastFrames list of unifi_priv_t data structure + * will be sent when we receive VIF AVAILABILITY from firmware as part of DTIM + */ + list = &interfacePriv->genericMulticastOrBroadCastFrames; + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + interfacePriv->noOfbroadcastPktQueued++; + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + if(list_empty(&interfacePriv->genericMulticastOrBroadCastFrames)) { + setBcTim = TRUE; + } + break; + default: + unifi_error(priv, "condition never meets: packet type un recognized\n"); + } + break; + default: + unifi_error(priv, "unrecognized frame type\n"); + } + if(list) { + status = enque_tx_data_pdu(priv, bulkdata,list, &signal,requeueOnSamePos); + /* Record no. of packet queued for each peer */ + if (staRecord && (pktType == CSR_WIFI_UNICAST_PDU) && (!status)) { + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + staRecord->noOfPktQueued++; + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + } + } + if(setBcTim) { + unifi_trace(priv, UDBG3, "tim set due to broadcast pkt\n"); + update_tim(priv,0,1,interfaceTag, handle); + } else if(staRecord && staRecord->currentPeerState == + CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE) { + if(staRecord->timSet == CSR_WIFI_TIM_RESET || staRecord->timSet == CSR_WIFI_TIM_RESETTING) { + if(!staRecord->wmmOrQosEnabled) { + if(!list_empty(&staRecord->mgtFrames) || + !list_empty(&staRecord->dataPdu[3]) || + !list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION])) { + unifi_trace(priv, UDBG3, "tim set due to unicast pkt & peer in powersave\n"); + update_tim(priv,staRecord->aid,1,interfaceTag, handle); + } + } else { + /* Check for non delivery enable(i.e trigger enable), all delivery enable & legacy AC for TIM update in firmware */ + CsrUint8 allDeliveryEnabled = 0, dataAvailable = 0; + /* Check if all AC's are Delivery Enabled */ + is_all_ac_deliver_enabled_and_moredata(staRecord, &allDeliveryEnabled, &dataAvailable); + if (uf_is_more_data_for_non_delivery_ac(staRecord) || (allDeliveryEnabled && dataAvailable)) { + update_tim(priv,staRecord->aid,1,interfaceTag, handle); + } + } + } + } + + if((list) && (pktType == CSR_WIFI_UNICAST_PDU && !queuePacketDozing) && !(isRouterBufferEnabled(priv,priority_q)) && !(IS_DTIM_ACTIVE(interfacePriv->dtimActive,interfacePriv->multicastPduHostTag))) { + unifi_trace(priv, UDBG2, "buffering cleared for queue = %d So resending buffered frames\n",priority_q); + uf_send_buffered_frames(priv, priority_q); + } + unifi_trace(priv, UDBG5, "leaving uf_process_ma_packet_req \n"); + return status; +#else +#ifdef CSR_NATIVE_LINUX + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "interfaceTag >= CSR_WIFI_NUM_INTERFACES, interfacetag = %d\n", interfaceTag); + return CSR_RESULT_FAILURE; + } + /* Frame ma-packet.req, this is saved/transmitted depend on queue state */ + unifi_frame_ma_packet_req(priv, priority, TransmitRate, hostTag, interfaceTag, + transmissionControl, leSenderProcessId, + peerMacAddress, &signal); + result = ul_send_signal_unpacked(priv, &signal, bulkdata); + if (result) { + return CSR_RESULT_FAILURE; + } +#endif + return status; +#endif +} + +#ifdef CSR_SUPPORT_SME +CsrInt8 uf_get_protection_bit_from_interfacemode(unifi_priv_t *priv, CsrUint16 interfaceTag, const CsrUint8 *daddr) +{ + CsrInt8 protection = 0; + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + + switch(interfacePriv->interfaceMode) + { + case CSR_WIFI_ROUTER_CTRL_MODE_STA: + case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI: + case CSR_WIFI_ROUTER_CTRL_MODE_AMP: + case CSR_WIFI_ROUTER_CTRL_MODE_IBSS: + protection = interfacePriv->protect; + break; + case CSR_WIFI_ROUTER_CTRL_MODE_AP: + case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: + { + CsrWifiRouterCtrlStaInfo_t *dstStaInfo = NULL; + if (daddr[0] & 0x1) { + unifi_trace(priv, UDBG3, "broadcast/multicast packet in send_ma_pkt_request\n"); + /* In this mode, the protect member of priv structure has an information of how + * AP/P2PGO has started, & the member updated in set mode request for AP/P2PGO + */ + protection = interfacePriv->protect; + } else { + /* fetch the destination record from staion record database */ + dstStaInfo = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, daddr, interfaceTag); + if (!dstStaInfo) { + unifi_trace(priv, UDBG3, "peer not found in station record in send_ma_pkt_request\n"); + return -1; + } + protection = dstStaInfo->protection; + } + } + break; + default: + unifi_trace(priv, UDBG2, "mode unknown in send_ma_pkt_request\n"); + } + return protection; +} +#endif +#ifdef CSR_SUPPORT_SME +CsrUint8 send_multicast_frames(unifi_priv_t *priv, CsrUint16 interfaceTag) +{ + int r; + tx_buffered_packets_t * buffered_pkt = NULL; + CsrBool moreData = FALSE; + CsrUint8 pduSent =0; + unsigned long lock_flags; + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + CsrUint32 hostTag = 0xffffffff; + + func_enter(); + if(!isRouterBufferEnabled(priv,UNIFI_TRAFFIC_Q_VO)) { + while((interfacePriv->dtimActive)&& (buffered_pkt=dequeue_tx_data_pdu(priv,&interfacePriv->genericMulticastOrBroadCastMgtFrames))) { + buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK); + moreData = (buffered_pkt->transmissionControl & TRANSMISSION_CONTROL_ESOP_MASK)?FALSE:TRUE; + + + unifi_trace(priv,UDBG2,"DTIM Occurred for interface:sending Mgt packet %d\n",interfaceTag); + + if((r=frame_and_send_queued_pdu(priv,buffered_pkt,NULL,moreData,FALSE)) == -ENOSPC) { + unifi_trace(priv,UDBG1,"frame_and_send_queued_pdu failed with ENOSPC for host tag = %x\n", buffered_pkt->hostTag); + /* Enqueue at the head of the queue */ + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_add(&buffered_pkt->q, &interfacePriv->genericMulticastOrBroadCastMgtFrames); + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + break; + } else { + unifi_trace(priv,UDBG1,"send_multicast_frames: Send genericMulticastOrBroadCastMgtFrames (%x, %x)\n", + buffered_pkt->hostTag, + r); + if(r) { + unifi_net_data_free(priv, &buffered_pkt->bulkdata); + } + if(!moreData) { + + interfacePriv->dtimActive = FALSE; + if(!r) { + hostTag = buffered_pkt->hostTag; + pduSent++; + } else { + send_vif_availibility_rsp(priv,uf_get_vif_identifier(interfacePriv->interfaceMode,interfaceTag),CSR_RC_UNSPECIFIED_FAILURE); + } + } + /* Buffered frame sent successfully */ + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + interfacePriv->noOfbroadcastPktQueued--; + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + kfree(buffered_pkt); + } + + } + } + if(!isRouterBufferEnabled(priv,UNIFI_TRAFFIC_Q_CONTENTION)) { + while((interfacePriv->dtimActive)&& (buffered_pkt=dequeue_tx_data_pdu(priv,&interfacePriv->genericMulticastOrBroadCastFrames))) { + buffered_pkt->transmissionControl |= TRANSMISSION_CONTROL_TRIGGER_MASK; + moreData = (buffered_pkt->transmissionControl & TRANSMISSION_CONTROL_ESOP_MASK)?FALSE:TRUE; + + + if((r=frame_and_send_queued_pdu(priv,buffered_pkt,NULL,moreData,FALSE)) == -ENOSPC) { + /* Clear the trigger bit transmission control*/ + buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK); + /* Enqueue at the head of the queue */ + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_add(&buffered_pkt->q, &interfacePriv->genericMulticastOrBroadCastFrames); + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + break; + } else { + if(r) { + unifi_trace(priv,UDBG1,"send_multicast_frames: Send genericMulticastOrBroadCastFrame failed (%x, %x)\n", + buffered_pkt->hostTag, + r); + unifi_net_data_free(priv, &buffered_pkt->bulkdata); + } + if(!moreData) { + interfacePriv->dtimActive = FALSE; + if(!r) { + pduSent ++; + hostTag = buffered_pkt->hostTag; + } else { + send_vif_availibility_rsp(priv,uf_get_vif_identifier(interfacePriv->interfaceMode,interfaceTag),CSR_RC_UNSPECIFIED_FAILURE); + } + } + /* Buffered frame sent successfully */ + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + interfacePriv->noOfbroadcastPktQueued--; + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + kfree(buffered_pkt); + } + } + } + if((interfacePriv->dtimActive == FALSE)) { + /* Record the host Tag*/ + unifi_trace(priv,UDBG2,"send_multicast_frames: Recorded hostTag of EOSP packet: = 0x%x\n",hostTag); + interfacePriv->multicastPduHostTag = hostTag; + } + return pduSent; +} +#endif +void uf_process_ma_vif_availibility_ind(unifi_priv_t *priv,CsrUint8 *sigdata, + CsrUint32 siglen) +{ +#ifdef CSR_SUPPORT_SME + CSR_SIGNAL signal; + CSR_MA_VIF_AVAILABILITY_INDICATION *ind; + int r; + CsrUint16 interfaceTag; + CsrUint8 pduSent =0; + CSR_RESULT_CODE resultCode = CSR_RC_SUCCESS; + netInterface_priv_t *interfacePriv; + + func_enter(); + unifi_trace(priv, UDBG3, + "uf_process_ma_vif_availibility_ind: Process signal 0x%.4X\n", + *((CsrUint16*)sigdata)); + + r = read_unpack_signal(sigdata, &signal); + if (r) { + unifi_error(priv, + "uf_process_ma_vif_availibility_ind: Received unknown signal 0x%.4X.\n", + CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata)); + func_exit(); + return; + } + ind = &signal.u.MaVifAvailabilityIndication; + interfaceTag=ind->VirtualInterfaceIdentifier & 0xff; + + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "in vif_availability_ind interfaceTag is wrong\n"); + return; + } + + interfacePriv = priv->interfacePriv[interfaceTag]; + + if(ind->Multicast) { + if(list_empty(&interfacePriv->genericMulticastOrBroadCastFrames) && + list_empty(&interfacePriv->genericMulticastOrBroadCastMgtFrames)) { + /* This condition can occur because of a potential race where the + TIM is not yet reset as host is waiting for confirm but it is sent + by firmware and DTIM occurs*/ + unifi_notice(priv,"ma_vif_availibility_ind recevied for multicast but queues are empty%d\n",interfaceTag); + send_vif_availibility_rsp(priv,ind->VirtualInterfaceIdentifier,CSR_RC_NO_BUFFERED_BROADCAST_MULTICAST_FRAMES); + interfacePriv->dtimActive = FALSE; + if(interfacePriv->multicastPduHostTag == 0xffffffff) { + unifi_notice(priv,"ma_vif_availibility_ind recevied for multicast but queues are empty%d\n",interfaceTag); + /* This may be an extra request in very rare race conditions but it is fine as it would atleast remove the potential lock up */ + update_tim(priv,0,0,interfaceTag, 0xFFFFFFFF); + } + return; + } + if(interfacePriv->dtimActive) { + unifi_trace(priv,UDBG2,"DTIM Occurred for already active DTIM interface %d\n",interfaceTag); + return; + } else { + unifi_trace(priv,UDBG2,"DTIM Occurred for interface %d\n",interfaceTag); + if(list_empty(&interfacePriv->genericMulticastOrBroadCastFrames)) { + set_eosp_transmit_ctrl(priv,&interfacePriv->genericMulticastOrBroadCastMgtFrames); + } else { + set_eosp_transmit_ctrl(priv,&interfacePriv->genericMulticastOrBroadCastFrames); + } + } + interfacePriv->dtimActive = TRUE; + pduSent = send_multicast_frames(priv,interfaceTag); + } + else { + unifi_error(priv,"Interface switching is not supported %d\n",interfaceTag); + resultCode = CSR_RC_NOT_SUPPORTED; + send_vif_availibility_rsp(priv,ind->VirtualInterfaceIdentifier,CSR_RC_NOT_SUPPORTED); + } +#endif +} +#ifdef CSR_SUPPORT_SME + +#define GET_ACTIVE_INTERFACE_TAG(priv) 0 + + +void uf_continue_uapsd(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo) +{ + + CsrInt8 i; + + func_enter(); + + if(((staInfo->powersaveMode[UNIFI_TRAFFIC_Q_VO]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)|| + (staInfo->powersaveMode[UNIFI_TRAFFIC_Q_VO]==CSR_WIFI_AC_DELIVERY_ONLY_ENABLE)) + &&(!list_empty(&staInfo->mgtFrames))){ + + unifi_trace(priv, UDBG5, "uf_continue_uapsd : U-APSD ACTIVE and sending buffered mgt frames\n"); + uf_send_buffered_data_from_delivery_ac(priv, staInfo, UNIFI_TRAFFIC_Q_VO, &staInfo->mgtFrames); + + /*This may happen because U-APSD was completed + with previous AC transfer*/ + + if(staInfo->uapsdActive == FALSE) { + return; + } + } + + for(i=3;i>=0;i--) { + + if(((staInfo->powersaveMode[i]== CSR_WIFI_AC_DELIVERY_ONLY_ENABLE) + ||(staInfo->powersaveMode[i] == CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)) + &&(!list_empty(&staInfo->dataPdu[i]))) { + unifi_trace(priv, UDBG5, "uf_continue_uapsd : U-APSD ACTIVE and sending buffered data frames\n"); + uf_send_buffered_data_from_delivery_ac(priv, staInfo, i, &staInfo->dataPdu[i]); + } + + /*This may happen because U-APSD was completed + with previous AC transfer*/ + if (staInfo->uapsdActive == FALSE) { + return; + } + } + + if (staInfo->uapsdActive && !uf_is_more_data_for_delivery_ac(priv, staInfo, TRUE)) { + /* If last packet not able to transfer due to ENOSPC & buffer management algorithm + * would have removed last packet. Then we wont update staInfo->UapsdActive = FALSE (suppose + * to update as we dont have packet to transfer at this USP) because above if loop fails as list is empty & + * update of UAPSD activity done in uf_send_buffered_data_from_delivery_ac(). + * In this situation we send QOS null & mean time update UapsdActive to FALSE here + */ + staInfo->uapsdActive = FALSE; + uf_send_qos_null(priv, GET_ACTIVE_INTERFACE_TAG(priv), staInfo->peerMacAddress.a, CSR_QOS_UP0 , staInfo); + } + func_exit(); +} + + +void uf_send_buffered_data_from_delivery_ac(unifi_priv_t *priv, + CsrWifiRouterCtrlStaInfo_t * staInfo, + CsrUint8 queue, + struct list_head *txList) +{ + + CsrUint16 interfaceTag = GET_ACTIVE_INTERFACE_TAG(priv); + tx_buffered_packets_t * buffered_pkt = NULL; + unsigned long lock_flags; + CsrBool eosp=FALSE; + CsrInt8 r =0; + CsrBool moreData = FALSE; + + CsrUint8 allDeliveryEnabled = 0, dataAvailable = 0; + netInterface_priv_t *interfacePriv; + interfacePriv = priv->interfacePriv[interfaceTag]; + func_enter(); + + /*Check U-APSD conditions if not met return from here*/ + if((staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE)&& + (staInfo->uapsdActive == TRUE)&& + (!IS_DELIVERY_AND_TRIGGER_ENABLED(staInfo->powersaveMode[queue]))){ + + unifi_trace(priv,UDBG4,"uf_send_buffered_data_from_queue : U-APSD active. %d :Queue NOT delivery enbaled.return %\n",queue); + + return; + } + + while(!isRouterBufferEnabled(priv,queue) && + ((buffered_pkt=dequeue_tx_data_pdu(priv, txList))!=NULL)){ + if((IS_DTIM_ACTIVE(interfacePriv->dtimActive,interfacePriv->multicastPduHostTag))){ + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + staInfo->uapsdSuspended = TRUE; + staInfo->uapsdActive = FALSE; + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + /* re-queueing the packet as DTIM started */ + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_add(&buffered_pkt->q,txList); + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + unifi_trace(priv, UDBG3, "%s: DTIM Active while UAPSD in progress for staId: 0x%x\n",__FUNCTION__,staInfo->aid); + break; + } + + buffered_pkt->transmissionControl &= + ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_ESOP_MASK); + + + if((staInfo->wmmOrQosEnabled == TRUE)&&(staInfo->uapsdActive == TRUE)){ + + moreData = uf_is_more_data_for_delivery_ac(priv,staInfo,TRUE); + + buffered_pkt->transmissionControl = TRANSMISSION_CONTROL_TRIGGER_MASK; + + if(staInfo->noOfSpFramesSent == (staInfo->maxSpLength-1)){ + moreData = FALSE; + } + + if(moreData == FALSE){ + eosp = TRUE; + staInfo->uapsdActive = FALSE; + staInfo->noOfSpFramesSent = FALSE; + buffered_pkt->transmissionControl = + (TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_ESOP_MASK); + + /* Check if all AC's are Delivery Enabled */ + is_all_ac_deliver_enabled_and_moredata(staInfo, &allDeliveryEnabled, &dataAvailable); + if ((allDeliveryEnabled && !dataAvailable)) { + update_tim(priv,staInfo->aid,0,interfaceTag, staInfo->assignedHandle); + } + /* check the moer data for non delivery ac and update accordingly */ + else if(uf_is_more_data_for_non_delivery_ac(staInfo) ) { + update_tim(priv,staInfo->aid,1,interfaceTag, staInfo->assignedHandle); + } + else if(!uf_is_more_data_for_non_delivery_ac(staInfo) ){ + unifi_trace(priv, UDBG3, "more data = NULL, set tim to 0 in uf_send_buffered_data_from_delivery_ac\n"); + update_tim(priv,staInfo->aid,0,interfaceTag, staInfo->assignedHandle); + } + + } + } + else + { + /*Non QoS and non U-APSD.*/ + eosp = FALSE; + moreData = FALSE; + unifi_warning(priv,"uf_send_buffered_data_from_delivery_ac :non U-APSD !!! \n"); + } + + unifi_trace(priv,UDBG2,"uf_send_buffered_data_from_delivery_ac : MoreData:%d, EOSP:%d\n",moreData,eosp); + + if((r=frame_and_send_queued_pdu(priv,buffered_pkt,staInfo,moreData,eosp)) == -ENOSPC) { + /* Enqueue at the head of the queue */ + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_add(&buffered_pkt->q,txList); + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + priv->pausedStaHandle[queue]=(CsrUint8)(staInfo->assignedHandle); + unifi_notice (priv," U-APSD: PDU sending failed .. no space for queue %d \n",queue); + /*Break the loop for this queue.Try for next available Delivery enabled + Queue*/ + break; + } else { + if(r){ + /* the PDU failed where we can't do any thing so free the storage */ + unifi_net_data_free(priv, &buffered_pkt->bulkdata); + } + + kfree(buffered_pkt); + if(staInfo->uapsdActive == TRUE){ + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + staInfo->noOfSpFramesSent = staInfo->noOfSpFramesSent + 1; + if(staInfo->noOfSpFramesSent == staInfo->maxSpLength){ + staInfo->uapsdActive = FALSE; + staInfo->noOfSpFramesSent = FALSE; + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + break; + } + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + } + } + } + + func_exit(); + +} + +void uf_send_buffered_data_from_ac(unifi_priv_t *priv, + CsrWifiRouterCtrlStaInfo_t * staInfo, + CsrUint8 queue, + struct list_head *txList) +{ + tx_buffered_packets_t * buffered_pkt = NULL; + unsigned long lock_flags; + CsrBool eosp=FALSE; + CsrBool moreData = FALSE; + CsrInt8 r =0; + + func_enter(); + + unifi_trace(priv,UDBG2,"uf_send_buffered_data_from_ac :\n"); + + while(!isRouterBufferEnabled(priv,queue) && + ((buffered_pkt=dequeue_tx_data_pdu(priv, txList))!=NULL)){ + + buffered_pkt->transmissionControl &= + ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_ESOP_MASK); + + unifi_trace(priv,UDBG3,"uf_send_buffered_data_from_ac : MoreData:%d, EOSP:%d\n",moreData,eosp); + + if((r=frame_and_send_queued_pdu(priv,buffered_pkt,staInfo,moreData,eosp)) == -ENOSPC) { + /* Enqueue at the head of the queue */ + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_add(&buffered_pkt->q,txList); + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + if(staInfo != NULL){ + priv->pausedStaHandle[queue]=(CsrUint8)(staInfo->assignedHandle); + } + unifi_trace(priv,UDBG3," uf_send_buffered_data_from_ac: PDU sending failed .. no space for queue %d \n",queue); + } else { + if(r){ + /* the PDU failed where we can't do any thing so free the storage */ + unifi_net_data_free(priv, &buffered_pkt->bulkdata); + } + kfree(buffered_pkt); + } + } + + func_exit(); + +} + +void uf_send_buffered_frames(unifi_priv_t *priv,unifi_TrafficQueue q) +{ + CsrUint16 interfaceTag = GET_ACTIVE_INTERFACE_TAG(priv); + CsrUint32 startIndex=0,endIndex=0; + CsrWifiRouterCtrlStaInfo_t * staInfo = NULL; + CsrUint8 queue; + CsrBool moreData = FALSE; + + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + + if(!((interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP) || + (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO))) + return; + func_enter(); + + queue = (q<=3)?q:0; + + if(interfacePriv->dtimActive) { + /* this function updates dtimActive*/ + send_multicast_frames(priv,interfaceTag); + if(!interfacePriv->dtimActive) { + moreData = (!list_empty(&interfacePriv->genericMulticastOrBroadCastMgtFrames) || + !list_empty(&interfacePriv->genericMulticastOrBroadCastFrames)); + if(!moreData) { + update_tim(priv,0,0,interfaceTag, 0XFFFFFFFF); + } + } else { + moreData = (!list_empty(&interfacePriv->genericMulticastOrBroadCastMgtFrames) || + !list_empty(&interfacePriv->genericMulticastOrBroadCastFrames)); + if(!moreData) { + /* This should never happen but if it happens, we need a way out */ + unifi_error(priv,"ERROR: No More Data but DTIM is active sending Response\n"); + send_vif_availibility_rsp(priv,uf_get_vif_identifier(interfacePriv->interfaceMode,interfaceTag),CSR_RC_NO_BUFFERED_BROADCAST_MULTICAST_FRAMES); + interfacePriv->dtimActive = FALSE; + } + } + func_exit(); + return; + } + if(priv->pausedStaHandle[queue] > 7) { + priv->pausedStaHandle[queue] = 0; + } + + if(queue == UNIFI_TRAFFIC_Q_VO) { + + + unifi_trace(priv,UDBG2,"uf_send_buffered_frames : trying mgt from queue=%d\n",queue); + for(startIndex= 0; startIndex < UNIFI_MAX_CONNECTIONS;startIndex++) { + staInfo = CsrWifiRouterCtrlGetStationRecordFromHandle(priv,startIndex,interfaceTag); + if(!staInfo ) { + continue; + } else if((staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE) + &&(staInfo->uapsdActive == FALSE) ) { + continue; + } + + if((staInfo != NULL)&&(staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE) + &&(staInfo->uapsdActive == FALSE)){ + /*Non-UAPSD case push the management frames out*/ + if(!list_empty(&staInfo->mgtFrames)){ + uf_send_buffered_data_from_ac(priv,staInfo, UNIFI_TRAFFIC_Q_VO, &staInfo->mgtFrames); + } + } + else if((staInfo != NULL)&&(staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE) + &&(staInfo->uapsdActive == TRUE)&&(IS_DELIVERY_AND_TRIGGER_ENABLED(staInfo->powersaveMode[UNIFI_TRAFFIC_Q_VO]))){ + + + if(!list_empty(&staInfo->mgtFrames)){ + /*UNIFI_TRAFFIC_Q_VO is delivery enabled push the managment frames out*/ + uf_send_buffered_data_from_delivery_ac(priv, staInfo, UNIFI_TRAFFIC_Q_VO, &staInfo->mgtFrames); + + } + } + + if(isRouterBufferEnabled(priv,queue)) { + unifi_notice(priv,"uf_send_buffered_frames : No space Left for queue = %d\n",queue); + break; + } + } + + + /*push generic management frames out*/ + + if(!list_empty(&interfacePriv->genericMgtFrames)){ + + unifi_trace(priv,UDBG2,"uf_send_buffered_frames : trying generic mgt from queue=%d\n",queue); + uf_send_buffered_data_from_ac(priv,staInfo, UNIFI_TRAFFIC_Q_VO, &interfacePriv->genericMgtFrames); + + } + + } + + + unifi_trace(priv,UDBG2,"uf_send_buffered_frames : Resume called for Queue=%d\n",queue); + unifi_trace(priv,UDBG2,"uf_send_buffered_frames : start=%d end=%d\n",startIndex,endIndex); + + startIndex = priv->pausedStaHandle[queue]; + endIndex = (startIndex + UNIFI_MAX_CONNECTIONS -1) % UNIFI_MAX_CONNECTIONS; + + while(startIndex != endIndex) { + staInfo = CsrWifiRouterCtrlGetStationRecordFromHandle(priv,startIndex,interfaceTag); + if(!staInfo) { + startIndex ++; + if(startIndex >= UNIFI_MAX_CONNECTIONS){ + startIndex = 0; + } + continue; + } else if((staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE) + &&(staInfo->uapsdActive == FALSE)){ + startIndex ++; + if(startIndex >= UNIFI_MAX_CONNECTIONS){ + startIndex = 0; + } + continue; + } + /* Peer is active or U-APSD is active so send PDUs to the peer */ + unifi_trace(priv,UDBG2,"uf_send_buffered_frames : trying data from queue=%d\n",queue); + + + if((staInfo != NULL)&&(staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE) + &&(staInfo->uapsdActive == FALSE)){ + + if(!list_empty(&staInfo->dataPdu[queue])){ + + /*Non-UAPSD case push the AC frames out*/ + uf_send_buffered_data_from_ac(priv, staInfo, queue, (&staInfo->dataPdu[queue])); + } + } + else if((staInfo != NULL)&&(staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE) + &&(staInfo->uapsdActive == TRUE)&&(IS_DELIVERY_AND_TRIGGER_ENABLED(staInfo->powersaveMode[queue]))){ + if(!list_empty(&staInfo->dataPdu[queue])){ + uf_send_buffered_data_from_delivery_ac(priv, staInfo, queue, &staInfo->dataPdu[queue]); + } + } + + startIndex ++; + if(startIndex >= UNIFI_MAX_CONNECTIONS){ + startIndex = 0; + } + } + if(isRouterBufferEnabled(priv,queue)) { + priv->pausedStaHandle[queue] = endIndex; + } else { + priv->pausedStaHandle[queue] = 0; + } + + /*U-APSD might have stopped because of pause.So restart it if U-APSD + was active with any of the station*/ + for(startIndex= 0; startIndex < UNIFI_MAX_CONNECTIONS;startIndex++) { + staInfo = CsrWifiRouterCtrlGetStationRecordFromHandle(priv,startIndex,interfaceTag); + if(!staInfo ) { + continue; + } else if((staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE) + &&(staInfo->uapsdActive == TRUE)) { + + /*U-APSD Still active, it means trigger frame is received,so continue U-APSD by + sending data from remaining delivery enabled queues*/ + uf_continue_uapsd(priv,staInfo); + } + } + func_exit(); +} + +CsrBool uf_is_more_data_for_delivery_ac(unifi_priv_t *priv,CsrWifiRouterCtrlStaInfo_t *staRecord,CsrBool mgtCheck) +{ + CsrUint8 i; + + for(i=0;i<=3;i++) + { + if(((staRecord->powersaveMode[i]==CSR_WIFI_AC_DELIVERY_ONLY_ENABLE) + ||(staRecord->powersaveMode[i]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)) + &&(!list_empty(&staRecord->dataPdu[i]))){ + unifi_trace(priv,UDBG2,"uf_is_more_data_for_delivery_ac: Data Available \n"); + return TRUE; + } + } + if((mgtCheck == TRUE)&&(IS_DELIVERY_AND_TRIGGER_ENABLED(staRecord->powersaveMode[UNIFI_TRAFFIC_Q_VO])) + &&(!list_empty(&staRecord->mgtFrames))){ + + unifi_trace(priv,UDBG2,"uf_is_more_data_for_delivery_ac: Management Data Available \n"); + + return TRUE; + } + + unifi_trace(priv,UDBG2,"uf_is_more_data_for_delivery_ac: Data NOT Available \n"); + return FALSE; +} + +CsrBool uf_is_more_data_for_non_delivery_ac(CsrWifiRouterCtrlStaInfo_t *staRecord) +{ + CsrUint8 i; + + for(i=0;i<=3;i++) + { + if(((staRecord->powersaveMode[i]==CSR_WIFI_AC_TRIGGER_ONLY_ENABLED) + ||(staRecord->powersaveMode[i]==CSR_WIFI_AC_LEGACY_POWER_SAVE)) + &&(!list_empty(&staRecord->dataPdu[i]))){ + + return TRUE; + } + } + + if(((staRecord->powersaveMode[UNIFI_TRAFFIC_Q_VO]==CSR_WIFI_AC_TRIGGER_ONLY_ENABLED) + ||(staRecord->powersaveMode[UNIFI_TRAFFIC_Q_VO]==CSR_WIFI_AC_LEGACY_POWER_SAVE)) + &&(!list_empty(&staRecord->mgtFrames))){ + + return TRUE; + } + + + + return FALSE; +} + + +int uf_process_station_records_for_sending_data(unifi_priv_t *priv,CsrUint16 interfaceTag, + CsrWifiRouterCtrlStaInfo_t *srcStaInfo, + CsrWifiRouterCtrlStaInfo_t *dstStaInfo) +{ + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + + unifi_trace(priv, UDBG5, "entering uf_process_station_records_for_sending_data\n"); + + if (srcStaInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_DISCONNECTED) { + unifi_error(priv, "Peer State not connected AID = %x, handle = %x, control port state = %x\n", + srcStaInfo->aid, srcStaInfo->assignedHandle, srcStaInfo->peerControlledPort->port_action); + return -1; + } + switch (interfacePriv->interfaceMode) + { + case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: + case CSR_WIFI_ROUTER_CTRL_MODE_AP: + unifi_trace(priv, UDBG5, "mode is AP/P2PGO\n"); + break; + default: + unifi_warning(priv, "mode is nor AP neither P2PGO, packet cant be xmit\n"); + return -1; + } + + switch(dstStaInfo->peerControlledPort->port_action) + { + case CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD: + case CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_BLOCK: + unifi_trace(priv, UDBG5, "destination port is closed/blocked, discarding the packet\n"); + return -1; + default: + unifi_trace(priv, UDBG5, "destination port state is open\n"); + } + + /* port state is open, destination station record is valid, Power save state is + * validated in uf_process_ma_packet_req function + */ + unifi_trace(priv, UDBG5, "leaving uf_process_station_records_for_sending_data\n"); + return 0; +} + +void uf_process_wmm_deliver_ac_uapsd(unifi_priv_t * priv, + CsrWifiRouterCtrlStaInfo_t * srcStaInfo, + CsrUint16 qosControl, + CsrUint16 interfaceTag) +{ + + CSR_PRIORITY priority; + CsrInt8 i; + unifi_TrafficQueue priority_q; + unsigned long lock_flags; + + func_enter(); + + /* start the U-APSD operation only if it not active*/ + if(srcStaInfo->uapsdActive == FALSE){ + /*if recceived Frames trigger Frame and Devlivery enabled AC has data + then transmit from High priorty delivery enabled AC*/ + + + priority = (CSR_PRIORITY)(qosControl & IEEE802_11_QC_TID_MASK); + + priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY) priority); + + if((srcStaInfo->powersaveMode[priority_q]==CSR_WIFI_AC_TRIGGER_ONLY_ENABLED) + ||(srcStaInfo->powersaveMode[priority_q]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)){ + + unifi_trace(priv, UDBG3, "uf_process_wmm_deliver_ac_uapsd starting U-APSD operations\n"); + + /*Received Frame is trigger frame*/ + unifi_trace(priv, UDBG5, "uf_process_wmm_deliver_ac_uapsd : Received Frame is trigger frame %d\n",priority_q); + + if(((srcStaInfo->powersaveMode[UNIFI_TRAFFIC_Q_VO]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)|| + (srcStaInfo->powersaveMode[UNIFI_TRAFFIC_Q_VO]==CSR_WIFI_AC_DELIVERY_ONLY_ENABLE)) + &&(!list_empty(&srcStaInfo->mgtFrames))){ + + /*Trigger frame received and Data available in Delivery enabled AC + or in Management queue when UNIFI_TRAFFIC_Q_VO is delivery enabled*/ + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + srcStaInfo->uapsdActive = TRUE; + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + + unifi_trace(priv, UDBG5, "uf_process_wmm_deliver_ac_uapsd : U-APSD ACTIVE and sending buffered mgt frames\n"); + + /* uf_send_buffered_frames(priv, priority_q); */ + uf_send_buffered_data_from_delivery_ac(priv, srcStaInfo, UNIFI_TRAFFIC_Q_VO, &srcStaInfo->mgtFrames); + + + /*This may happen because U-APSD was completed + with previous AC transfer*/ + + if(srcStaInfo->uapsdActive == FALSE){ + return; + } + + } + + + for(i=3;i>=0;i--){ + + if(((srcStaInfo->powersaveMode[i]==CSR_WIFI_AC_DELIVERY_ONLY_ENABLE) + ||(srcStaInfo->powersaveMode[i]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)) + &&(!list_empty(&srcStaInfo->dataPdu[i]))){ + + + /*Trigger frame received and Data available in Delivery enabled AC + or in Management queue when UNIFI_TRAFFIC_Q_VO is delivery enabled*/ + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + srcStaInfo->uapsdActive = TRUE; + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + + unifi_trace(priv, UDBG5, "uf_process_wmm_deliver_ac_uapsd : U-APSD ACTIVE and sending buffered data frames\n"); + + uf_send_buffered_data_from_delivery_ac(priv, srcStaInfo, i, &srcStaInfo->dataPdu[i]); + + /*This may happen because U-APSD was completed + with previous AC transfer*/ + + if(srcStaInfo->uapsdActive == FALSE){ + return; + } + } + + } + if(srcStaInfo->uapsdActive == FALSE && !(uf_is_more_data_for_delivery_ac(priv,srcStaInfo,TRUE))){ + unifi_trace(priv, UDBG3, "uf_process_wmm_deliver_ac_uapsd : No buffer frames so sending QOS Null in response of trigger frame\n"); + uf_send_qos_null(priv,interfaceTag,srcStaInfo->peerMacAddress.a,priority,srcStaInfo); + } + + } + + } + + func_exit(); + +} +void uf_send_qos_null(unifi_priv_t * priv,CsrUint16 interfaceTag, const CsrUint8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo) +{ + bulk_data_param_t bulkdata; + CsrResult csrResult; + struct sk_buff *skb, *newSkb = NULL; + CsrWifiMacAddress peerAddress; + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + CSR_TRANSMISSION_CONTROL transmissionControl = (TRANSMISSION_CONTROL_ESOP_MASK | TRANSMISSION_CONTROL_TRIGGER_MASK); + int r; + CSR_SIGNAL signal; + CsrUint32 priority_q; + CSR_RATE transmitRate = 0; + + + func_enter(); + /* Send a Null Frame to Peer, + * 32= size of mac header */ + csrResult = unifi_net_data_malloc(priv, &bulkdata.d[0], MAC_HEADER_SIZE + QOS_CONTROL_HEADER_SIZE); + + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, " failed to allocate request_data. in uf_send_qos_null func\n"); + return ; + } + skb = (struct sk_buff *)(bulkdata.d[0].os_net_buf_ptr); + skb->len = 0; + bulkdata.d[0].os_data_ptr = skb->data; + bulkdata.d[0].os_net_buf_ptr = (unsigned char*)skb; + bulkdata.d[0].net_buf_length = bulkdata.d[0].data_length = skb->len; + bulkdata.d[1].os_data_ptr = NULL; + bulkdata.d[1].os_net_buf_ptr = NULL; + bulkdata.d[1].net_buf_length = bulkdata.d[1].data_length = 0; + + /* For null frames protection bit should not be set in MAC header, so passing value 0 below for protection field */ + + if (prepare_and_add_macheader(priv, skb, newSkb, priority, &bulkdata, interfaceTag, da, interfacePriv->bssid.a, 0)) { + unifi_error(priv, "failed to create MAC header\n"); + unifi_net_data_free(priv, &bulkdata.d[0]); + return; + } + memcpy(peerAddress.a, ((CsrUint8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN); + /* convert priority to queue */ + priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY) priority); + + /* Frame ma-packet.req, this is saved/transmitted depend on queue state + * send the null frame at data rate of 1 Mb/s for AP or 6 Mb/s for P2PGO + */ + switch (interfacePriv->interfaceMode) + { + case CSR_WIFI_ROUTER_CTRL_MODE_AP: + transmitRate = 2; + break; + case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: + transmitRate = 12; + break; + default: + transmitRate = 0; + } + unifi_frame_ma_packet_req(priv, priority, transmitRate, 0xffffffff, interfaceTag, + transmissionControl, priv->netdev_client->sender_id, + peerAddress.a, &signal); + + r = ul_send_signal_unpacked(priv, &signal, &bulkdata); + if(r) { + unifi_error(priv, "failed to send QOS data null packet result: %d\n",r); + unifi_net_data_free(priv, &bulkdata.d[0]); + } + + func_exit(); + return; + +} +void uf_send_nulldata(unifi_priv_t * priv,CsrUint16 interfaceTag, const CsrUint8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo) +{ + bulk_data_param_t bulkdata; + CsrResult csrResult; + struct sk_buff *skb, *newSkb = NULL; + CsrWifiMacAddress peerAddress; + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + CSR_TRANSMISSION_CONTROL transmissionControl = 0; + int r; + CSR_SIGNAL signal; + CsrUint32 priority_q; + CSR_RATE transmitRate = 0; + CSR_MA_PACKET_REQUEST *req = &signal.u.MaPacketRequest; + unsigned long lock_flags; + + func_enter(); + /* Send a Null Frame to Peer, size = 24 for MAC header */ + csrResult = unifi_net_data_malloc(priv, &bulkdata.d[0], MAC_HEADER_SIZE); + + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, "uf_send_nulldata: Failed to allocate memory for NULL frame\n"); + return ; + } + skb = (struct sk_buff *)(bulkdata.d[0].os_net_buf_ptr); + skb->len = 0; + bulkdata.d[0].os_data_ptr = skb->data; + bulkdata.d[0].os_net_buf_ptr = (unsigned char*)skb; + bulkdata.d[0].net_buf_length = bulkdata.d[0].data_length = skb->len; + bulkdata.d[1].os_data_ptr = NULL; + bulkdata.d[1].os_net_buf_ptr = NULL; + bulkdata.d[1].net_buf_length = bulkdata.d[1].data_length = 0; + + /* For null frames protection bit should not be set in MAC header, so passing value 0 below for protection field */ + if (prepare_and_add_macheader(priv, skb, newSkb, priority, &bulkdata, interfaceTag, da, interfacePriv->bssid.a, 0)) { + unifi_error(priv, "uf_send_nulldata: Failed to create MAC header\n"); + unifi_net_data_free(priv, &bulkdata.d[0]); + return; + } + memcpy(peerAddress.a, ((CsrUint8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN); + /* convert priority to queue */ + priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY) priority); + transmissionControl &= ~(CSR_NO_CONFIRM_REQUIRED); + + /* Frame ma-packet.req, this is saved/transmitted depend on queue state + * send the null frame at data rate of 1 Mb/s for AP or 6 Mb/s for P2PGO + */ + switch (interfacePriv->interfaceMode) + { + case CSR_WIFI_ROUTER_CTRL_MODE_AP: + transmitRate = 2; + break; + case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: + transmitRate = 12; + break; + default: + transmitRate = 0; + } + unifi_frame_ma_packet_req(priv, priority, transmitRate, INVALID_HOST_TAG, interfaceTag, + transmissionControl, priv->netdev_client->sender_id, + peerAddress.a, &signal); + + /* Save host tag to check the status on reception of MA packet confirm */ + srcStaInfo->nullDataHostTag = req->HostTag; + unifi_trace(priv, UDBG1, "uf_send_nulldata: STA AID = %d hostTag = %x\n", srcStaInfo->aid, req->HostTag); + + r = ul_send_signal_unpacked(priv, &signal, &bulkdata); + + if(r == -ENOSPC) { + unifi_trace(priv, UDBG1, "uf_send_nulldata: ENOSPC Requeue the Null frame\n"); + enque_tx_data_pdu(priv, &bulkdata, &srcStaInfo->dataPdu[priority_q], &signal, 1); + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + srcStaInfo->noOfPktQueued++; + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + + + } + if(r && r != -ENOSPC){ + unifi_error(priv, "uf_send_nulldata: Failed to send Null frame Error = %d\n",r); + unifi_net_data_free(priv, &bulkdata.d[0]); + srcStaInfo->nullDataHostTag = INVALID_HOST_TAG; + } + + func_exit(); + return; +} + +CsrBool uf_check_broadcast_bssid(unifi_priv_t *priv, const bulk_data_param_t *bulkdata) +{ + CsrUint8 *bssid = NULL; + static const CsrWifiMacAddress broadcast_address = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}}; + CsrUint8 toDs, fromDs; + + toDs = (((bulkdata->d[0].os_data_ptr)[1]) & 0x01) ? 1 : 0; + fromDs =(((bulkdata->d[0].os_data_ptr)[1]) & 0x02) ? 1 : 0; + + if (toDs && fromDs) + { + unifi_trace(priv, UDBG6, "Address 4 present, Don't try to find BSSID\n"); + bssid = NULL; + } + else if((toDs == 0) && (fromDs ==0)) + { + /* BSSID is Address 3 */ + bssid = (CsrUint8 *) (bulkdata->d[0].os_data_ptr + 4 + (2 * ETH_ALEN)); + } + else if(toDs) + { + /* BSSID is Address 1 */ + bssid = (CsrUint8 *) (bulkdata->d[0].os_data_ptr + 4); + } + else if(fromDs) + { + /* BSSID is Address 2 */ + bssid = (CsrUint8 *) (bulkdata->d[0].os_data_ptr + 4 + ETH_ALEN); + } + + if (memcmp(broadcast_address.a, bssid, ETH_ALEN)== 0) + { + return TRUE; + } + else + { + return FALSE; + } +} + + +CsrBool uf_process_pm_bit_for_peer(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t * srcStaInfo, + CsrUint8 pmBit,CsrUint16 interfaceTag) +{ + CsrBool moreData = FALSE; + CsrBool powerSaveChanged = FALSE; + unsigned long lock_flags; + + unifi_trace(priv, UDBG3, "entering uf_process_pm_bit_for_peer\n"); + if (pmBit) { + priv->allPeerDozing |= (0x01 << (srcStaInfo->assignedHandle)); + } else { + priv->allPeerDozing &= ~(0x01 << (srcStaInfo->assignedHandle)); + } + if(pmBit) { + if(srcStaInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE) { + + /* disable the preemption */ + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + srcStaInfo->currentPeerState =CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE; + powerSaveChanged = TRUE; + /* enable the preemption */ + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + } else { + return powerSaveChanged; + } + } else { + if(srcStaInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE) { + /* disable the preemption */ + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + srcStaInfo->currentPeerState = CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE; + powerSaveChanged = TRUE; + /* enable the preemption */ + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + }else { + return powerSaveChanged; + } + } + + + if(srcStaInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE) { + unifi_trace(priv,UDBG3, "Peer with AID = %d is active now\n",srcStaInfo->aid); + process_peer_active_transition(priv,srcStaInfo,interfaceTag); + } else { + unifi_trace(priv,UDBG3, "Peer with AID = %d is in PS Now\n",srcStaInfo->aid); + /* Set TIM if needed */ + if(!srcStaInfo->wmmOrQosEnabled) { + moreData = (!list_empty(&srcStaInfo->mgtFrames) || + !list_empty(&srcStaInfo->dataPdu[UNIFI_TRAFFIC_Q_VO])|| + !list_empty(&srcStaInfo->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION])); + if(moreData && (srcStaInfo->timSet == CSR_WIFI_TIM_RESET)) { + unifi_trace(priv, UDBG3, "This condition should not occur\n"); + update_tim(priv,srcStaInfo->aid,1,interfaceTag, srcStaInfo->assignedHandle); + } + } else { + CsrUint8 allDeliveryEnabled = 0, dataAvailable = 0; + unifi_trace(priv, UDBG5, "Qos in AP Mode\n"); + /* Check if all AC's are Delivery Enabled */ + is_all_ac_deliver_enabled_and_moredata(srcStaInfo, &allDeliveryEnabled, &dataAvailable); + /*check for more data in non-delivery enabled queues*/ + moreData = (uf_is_more_data_for_non_delivery_ac(srcStaInfo) || (allDeliveryEnabled && dataAvailable)); + + if(moreData && (srcStaInfo->timSet == CSR_WIFI_TIM_RESET)) { + update_tim(priv,srcStaInfo->aid,1,interfaceTag, srcStaInfo->assignedHandle); + } + } + } + unifi_trace(priv, UDBG3, "leaving uf_process_pm_bit_for_peer\n"); + return powerSaveChanged; +} + + + +void uf_process_ps_poll(unifi_priv_t *priv,CsrUint8* sa,CsrUint8* da,CsrUint8 pmBit,CsrUint16 interfaceTag) +{ + CsrWifiRouterCtrlStaInfo_t *staRecord = + CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, sa, interfaceTag); + tx_buffered_packets_t * buffered_pkt = NULL; + CsrWifiMacAddress peerMacAddress; + unsigned long lock_flags; + CsrInt8 r =0; + CsrBool moreData = FALSE; + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + + unifi_trace(priv, UDBG3, "entering uf_process_ps_poll\n"); + if(!staRecord) { + memcpy(peerMacAddress.a,sa,ETH_ALEN); + unifi_trace(priv, UDBG3, "In uf_process_ps_poll, sta record not found:unexpected frame addr = %x:%x:%x:%x:%x:%x\n", + sa[0], sa[1],sa[2], sa[3], sa[4],sa[5]); + CsrWifiRouterCtrlUnexpectedFrameIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,0,interfaceTag,peerMacAddress); + return; + } + + uf_process_pm_bit_for_peer(priv,staRecord,pmBit,interfaceTag); + + /* Update station last activity time */ + staRecord->activity_flag = TRUE; + + /* This should not change the PM bit as PS-POLL has PM bit always set */ + if(!pmBit) { + unifi_notice (priv," PM bit reset in PS-POLL\n"); + return; + } + + if(IS_DTIM_ACTIVE(interfacePriv->dtimActive,interfacePriv->multicastPduHostTag)) { + /* giving more priority to multicast packets so dropping ps-poll*/ + unifi_notice (priv," multicast transmission is going on so don't take action on PS-POLL\n"); + return; + } + + if(!staRecord->wmmOrQosEnabled) { + if((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->mgtFrames))) { + buffered_pkt->transmissionControl |= TRANSMISSION_CONTROL_TRIGGER_MASK; + moreData = (!list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]) || + !list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]) || + !list_empty(&staRecord->mgtFrames)); + + buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); + if((r=frame_and_send_queued_pdu(priv,buffered_pkt,staRecord,moreData,FALSE)) == -ENOSPC) { + /* Clear the trigger bit transmission control*/ + buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); + /* Enqueue at the head of the queue */ + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_add(&buffered_pkt->q, &staRecord->mgtFrames); + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + unifi_trace(priv, UDBG1, "(ENOSPC) PS-POLL received : PDU sending failed \n"); + priv->pausedStaHandle[3]=(CsrUint8)(staRecord->assignedHandle); + } else { + if(r){ + unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n"); + /* the PDU failed where we can't do any thing so free the storage */ + unifi_net_data_free(priv, &buffered_pkt->bulkdata); + } + kfree(buffered_pkt); + } + } else if((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]))) { + buffered_pkt->transmissionControl |= TRANSMISSION_CONTROL_TRIGGER_MASK; + moreData = (!list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]) || + !list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO])); + + buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); + if((r=frame_and_send_queued_pdu(priv,buffered_pkt,staRecord,moreData,FALSE)) == -ENOSPC) { + /* Clear the trigger bit transmission control*/ + buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); + /* Enqueue at the head of the queue */ + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_add(&buffered_pkt->q, &staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]); + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + priv->pausedStaHandle[3]=(CsrUint8)(staRecord->assignedHandle); + unifi_trace(priv, UDBG1, "(ENOSPC) PS-POLL received : PDU sending failed \n"); + } else { + if(r){ + unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n"); + /* the PDU failed where we can't do any thing so free the storage */ + unifi_net_data_free(priv, &buffered_pkt->bulkdata); + } + kfree(buffered_pkt); + } + } else if((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]))) { + buffered_pkt->transmissionControl |= TRANSMISSION_CONTROL_TRIGGER_MASK; + moreData = !list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]); + + buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); + if((r=frame_and_send_queued_pdu(priv,buffered_pkt,staRecord,moreData,FALSE)) == -ENOSPC) { + /* Clear the trigger bit transmission control*/ + buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); + /* Enqueue at the head of the queue */ + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_add(&buffered_pkt->q, &staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]); + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + priv->pausedStaHandle[0]=(CsrUint8)(staRecord->assignedHandle); + unifi_trace(priv, UDBG1, "(ENOSPC) PS-POLL received : PDU sending failed \n"); + } else { + if(r){ + unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n"); + /* the PDU failed where we can't do any thing so free the storage */ + unifi_net_data_free(priv, &buffered_pkt->bulkdata); + } + kfree(buffered_pkt); + } + } else { + /* Actually since we have sent an ACK, there + * there is no need to send a NULL frame*/ + } + moreData = (!list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]) || + !list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]) || + !list_empty(&staRecord->mgtFrames)); + if(!moreData && (staRecord->timSet == CSR_WIFI_TIM_SET)) { + unifi_trace(priv, UDBG3, "more data = NULL, set tim to 0 in uf_process_ps_poll\n"); + update_tim(priv,staRecord->aid,0,interfaceTag, staRecord->assignedHandle); + } + } else { + + CsrUint8 allDeliveryEnabled = 0, dataAvailable = 0; + unifi_trace(priv, UDBG3,"Qos Support station.Processing PS-Poll\n"); + + /*Send Data From Management Frames*/ + /* Priority orders for delivering the buffered packets are + * 1. UNIFI_TRAFFIC_Q_VO, if its non delivery enabled + * 2. management frames + * 3. Other access catagory frames which are non deliver enable + */ + + /* Check if all AC's are Delivery Enabled */ + is_all_ac_deliver_enabled_and_moredata(staRecord, &allDeliveryEnabled, &dataAvailable); + + if (allDeliveryEnabled) { + unifi_trace(priv, UDBG3, "uf_process_ps_poll: All ACs are delivery enable so Sending QOS Null in response of Ps-poll\n"); + uf_send_qos_null(priv,interfaceTag,sa,CSR_QOS_UP0,staRecord); + return; + } + + if ((!IS_DELIVERY_ENABLED(staRecord->powersaveMode[UNIFI_TRAFFIC_Q_VO])) && + (!list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]) || !list_empty(&staRecord->mgtFrames))) { + /* UNIFI_TRAFFIC_Q_VO is non delivery enabled, & check for packets are there to send from this AC */ + if((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]))) { + moreData = uf_is_more_data_for_non_delivery_ac(staRecord); + buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); + + /* Last parameter is EOSP & its false always for PS-POLL processing */ + if((r=frame_and_send_queued_pdu(priv,buffered_pkt,staRecord,moreData,FALSE)) == -ENOSPC) { + /* Clear the trigger bit transmission control*/ + buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); + /* Enqueue at the head of the queue */ + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_add(&buffered_pkt->q, &staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]); + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + priv->pausedStaHandle[0]=(CsrUint8)(staRecord->assignedHandle); + unifi_trace(priv, UDBG1, "(ENOSPC) PS-POLL received : PDU sending failed \n"); + } else { + if(r){ + unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n"); + /* the PDU failed where we can't do any thing so free the storage */ + unifi_net_data_free(priv, &buffered_pkt->bulkdata); + } + kfree(buffered_pkt); + } + } else if ((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->mgtFrames))) { + /* We dont have packets in non delivery enabled UNIFI_TRAFFIC_Q_VO, So we are looking in management + * queue of the station record + */ + moreData = uf_is_more_data_for_non_delivery_ac(staRecord); + buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); + + /* Last parameter is EOSP & its false always for PS-POLL processing */ + if((r=frame_and_send_queued_pdu(priv,buffered_pkt,staRecord,moreData,FALSE)) == -ENOSPC) { + /* Clear the trigger bit transmission control*/ + buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); + /* Enqueue at the head of the queue */ + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_add(&buffered_pkt->q, &staRecord->mgtFrames); + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + priv->pausedStaHandle[0]=(CsrUint8)(staRecord->assignedHandle); + unifi_trace(priv, UDBG1, "(ENOSPC) PS-POLL received : PDU sending failed \n"); + } else { + if(r){ + unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n"); + /* the PDU failed where we can't do any thing so free the storage */ + unifi_net_data_free(priv, &buffered_pkt->bulkdata); + } + kfree(buffered_pkt); + } + } + } else { + CsrInt8 i; + /* We dont have buffered packet in UNIFI_TRAFFIC_Q_VO & mangement frame queue (1 & 2 failed), So proceed with 3 condition + * UNIFI_TRAFFIC_Q_VO is taken care so start with i index = 2 + */ + for(i= 2; i>=0; i--) { + if (!IS_DELIVERY_ENABLED(staRecord->powersaveMode[i])) { + /* Send One packet, if queue is NULL then continue */ + if((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->dataPdu[i]))) { + moreData = uf_is_more_data_for_non_delivery_ac(staRecord); + + buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); + + /* Last parameter is EOSP & its false always for PS-POLL processing */ + if((r=frame_and_send_queued_pdu(priv,buffered_pkt,staRecord,moreData,FALSE)) == -ENOSPC) { + /* Clear the trigger bit transmission control*/ + buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); + /* Enqueue at the head of the queue */ + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_add(&buffered_pkt->q, &staRecord->dataPdu[i]); + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + priv->pausedStaHandle[0]=(CsrUint8)(staRecord->assignedHandle); + unifi_trace(priv, UDBG1, "(ENOSPC) PS-POLL received : PDU sending failed \n"); + } else { + if(r) { + unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n"); + /* the PDU failed where we can't do any thing so free the storage */ + unifi_net_data_free(priv, &buffered_pkt->bulkdata); + } + kfree(buffered_pkt); + } + break; + } + } + } + } + /* Check if all AC's are Delivery Enabled */ + is_all_ac_deliver_enabled_and_moredata(staRecord, &allDeliveryEnabled, &dataAvailable); + /*check for more data in non-delivery enabled queues*/ + moreData = (uf_is_more_data_for_non_delivery_ac(staRecord) || (allDeliveryEnabled && dataAvailable)); + if(!moreData && (staRecord->timSet == CSR_WIFI_TIM_SET)) { + unifi_trace(priv, UDBG3, "more data = NULL, set tim to 0 in uf_process_ps_poll\n"); + update_tim(priv,staRecord->aid,0,interfaceTag, staRecord->assignedHandle); + } + } + + unifi_trace(priv, UDBG3, "leaving uf_process_ps_poll\n"); +} + + + +void add_to_send_cfm_list(unifi_priv_t * priv, + tx_buffered_packets_t *tx_q_item, + struct list_head *frames_need_cfm_list) +{ + tx_buffered_packets_t *send_cfm_list_item = NULL; + + send_cfm_list_item = (tx_buffered_packets_t *) kmalloc(sizeof(tx_buffered_packets_t), GFP_ATOMIC); + + if(send_cfm_list_item == NULL){ + unifi_warning(priv, "%s: Failed to allocate memory for new list item \n"); + return; + } + + INIT_LIST_HEAD(&send_cfm_list_item->q); + + send_cfm_list_item->hostTag = tx_q_item->hostTag; + send_cfm_list_item->interfaceTag = tx_q_item->interfaceTag; + send_cfm_list_item->transmissionControl = tx_q_item->transmissionControl; + send_cfm_list_item->leSenderProcessId = tx_q_item->leSenderProcessId; + send_cfm_list_item->rate = tx_q_item->rate; + memcpy(send_cfm_list_item->peerMacAddress.a, tx_q_item->peerMacAddress.a, ETH_ALEN); + send_cfm_list_item->priority = tx_q_item->priority; + + list_add_tail(&send_cfm_list_item->q, frames_need_cfm_list); +} + +void uf_prepare_send_cfm_list_for_queued_pkts(unifi_priv_t * priv, + struct list_head *frames_need_cfm_list, + struct list_head * list) +{ + tx_buffered_packets_t *tx_q_item = NULL; + struct list_head *listHead; + struct list_head *placeHolder; + unsigned long lock_flags; + + func_enter(); + + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + + /* Search through the list and if confirmation required for any frames, + add it to the send_cfm list */ + list_for_each_safe(listHead, placeHolder, list) { + tx_q_item = list_entry(listHead, tx_buffered_packets_t, q); + + if(!tx_q_item) { + unifi_error(priv, "Entry should exist, otherwise it is a (BUG)\n"); + continue; + } + + /* check if confirmation is requested and if the sender ID + is not netdevice client then save the entry in the list for need cfms */ + if (!(tx_q_item->transmissionControl & CSR_NO_CONFIRM_REQUIRED) && + (tx_q_item->leSenderProcessId != priv->netdev_client->sender_id)){ + unifi_trace(priv, UDBG1, "%s: SenderProcessID=%x host tag=%x transmission control=%x\n", + __FUNCTION__, + tx_q_item->leSenderProcessId, + tx_q_item->hostTag, + tx_q_item->transmissionControl); + + add_to_send_cfm_list(priv, tx_q_item, frames_need_cfm_list); + } + } + + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + + func_exit(); +} + + + +void uf_flush_list(unifi_priv_t * priv, struct list_head * list) +{ + tx_buffered_packets_t *tx_q_item; + struct list_head *listHead; + struct list_head *placeHolder; + unsigned long lock_flags; + + unifi_trace(priv, UDBG5, "entering the uf_flush_list \n"); + + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + /* go through list, delete & free memory */ + list_for_each_safe(listHead, placeHolder, list) { + tx_q_item = list_entry(listHead, tx_buffered_packets_t, q); + + if(!tx_q_item) { + unifi_error(priv, "entry should exists, otherwise crashes (bug)\n"); + } + unifi_trace(priv, UDBG5, + "proccess_tx: in uf_flush_list peerMacAddress=%02X%02X%02X%02X%02X%02X senderProcessId=%x\n", + tx_q_item->peerMacAddress.a[0], tx_q_item->peerMacAddress.a[1], + tx_q_item->peerMacAddress.a[2], tx_q_item->peerMacAddress.a[3], + tx_q_item->peerMacAddress.a[4], tx_q_item->peerMacAddress.a[5], + tx_q_item->leSenderProcessId); + + list_del(listHead); + /* free the allocated memory */ + unifi_net_data_free(priv, &tx_q_item->bulkdata); + kfree(tx_q_item); + tx_q_item = NULL; + if (!priv->noOfPktQueuedInDriver) { + unifi_error(priv, "packets queued in driver 0 still decrementing in %s\n", __FUNCTION__); + } else { + priv->noOfPktQueuedInDriver--; + } + } + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); +} +void uf_flush_maPktlist(unifi_priv_t * priv, struct list_head * list) +{ + struct list_head *listHeadMaPktreq,*placeHolderMaPktreq; + maPktReqList_t *maPktreq; + unsigned long lock_flags; + + unifi_trace(priv, UDBG5, "entering the uf_flush_maPktlist \n"); + + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + /* go through list, delete & free memory */ + list_for_each_safe(listHeadMaPktreq, placeHolderMaPktreq, list) { + maPktreq = list_entry(listHeadMaPktreq, maPktReqList_t, q); + + if(!maPktreq) { + unifi_error(priv, "entry should exists, otherwise crashes (bug)\n"); + } + /* free the allocated memory */ + dev_kfree_skb(maPktreq->skb); + list_del(listHeadMaPktreq); + kfree(maPktreq); + maPktreq = NULL; + + } + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); +} +tx_buffered_packets_t *dequeue_tx_data_pdu(unifi_priv_t *priv, struct list_head *txList) +{ + /* dequeue the tx data packets from the appropriate queue */ + tx_buffered_packets_t *tx_q_item = NULL; + struct list_head *listHead; + struct list_head *placeHolder; + unsigned long lock_flags; + + unifi_trace(priv, UDBG5, "entering dequeue_tx_data_pdu\n"); + /* check for list empty */ + if (list_empty(txList)) { + unifi_trace(priv, UDBG5, "In dequeue_tx_data_pdu, the list is empty\n"); + return NULL; + } + + /* Verification, if packet count is negetive */ + if (priv->noOfPktQueuedInDriver == 0xFFFF) { + unifi_warning(priv, "no packet available in queue: debug"); + return NULL; + } + + /* return first node after header, & delete from the list && atleast one item exist */ + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_for_each_safe(listHead, placeHolder, txList) { + tx_q_item = list_entry(listHead, tx_buffered_packets_t, q); + list_del(listHead); + break; + } + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + + if (tx_q_item) { + unifi_trace(priv, UDBG5, + "proccess_tx: In dequeue_tx_data_pdu peerMacAddress=%02X%02X%02X%02X%02X%02X senderProcessId=%x\n", + tx_q_item->peerMacAddress.a[0], tx_q_item->peerMacAddress.a[1], + tx_q_item->peerMacAddress.a[2], tx_q_item->peerMacAddress.a[3], + tx_q_item->peerMacAddress.a[4], tx_q_item->peerMacAddress.a[5], + tx_q_item->leSenderProcessId); + } + + unifi_trace(priv, UDBG5, "leaving dequeue_tx_data_pdu\n"); + return tx_q_item; +} +/* generic function to get the station record handler */ +CsrWifiRouterCtrlStaInfo_t *CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(unifi_priv_t *priv, + const CsrUint8 *peerMacAddress, + CsrUint16 interfaceTag) +{ + CsrUint8 i; + netInterface_priv_t *interfacePriv; + unsigned long lock_flags; + + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "interfaceTag is not proper, interfaceTag = %d\n", interfaceTag); + return NULL; + } + + interfacePriv = priv->interfacePriv[interfaceTag]; + + /* disable the preemption untill station record is fetched */ + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + + for (i = 0; i < UNIFI_MAX_CONNECTIONS; i++) { + if (interfacePriv->staInfo[i]!= NULL) { + if (!memcmp(((CsrWifiRouterCtrlStaInfo_t *) (interfacePriv->staInfo[i]))->peerMacAddress.a, peerMacAddress, ETH_ALEN)) { + /* enable the preemption as station record is fetched */ + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + unifi_trace(priv, UDBG5, "peer entry found in station record\n"); + return ((CsrWifiRouterCtrlStaInfo_t *) (interfacePriv->staInfo[i])); + } + } + } + /* enable the preemption as station record is fetched */ + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + unifi_trace(priv, UDBG5, "peer entry not found in station record\n"); + return NULL; +} +/* generic function to get the station record handler from the handle */ +CsrWifiRouterCtrlStaInfo_t * CsrWifiRouterCtrlGetStationRecordFromHandle(unifi_priv_t *priv, + CsrUint32 handle, + CsrUint16 interfaceTag) +{ + netInterface_priv_t *interfacePriv; + + if ((handle >= UNIFI_MAX_CONNECTIONS) || (interfaceTag >= CSR_WIFI_NUM_INTERFACES)) { + unifi_error(priv, "handle/interfaceTag is not proper, handle = %d, interfaceTag = %d\n", handle, interfaceTag); + return NULL; + } + interfacePriv = priv->interfacePriv[interfaceTag]; + return ((CsrWifiRouterCtrlStaInfo_t *) (interfacePriv->staInfo[handle])); +} + +/* Function to do inactivity */ +void uf_check_inactivity(unifi_priv_t *priv, CsrUint16 interfaceTag, CsrTime currentTime) +{ + CsrUint32 i; + CsrWifiRouterCtrlStaInfo_t *staInfo; + CsrTime elapsedTime; /* Time in microseconds */ + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + CsrWifiMacAddress peerMacAddress; + unsigned long lock_flags; + + if (interfacePriv == NULL) { + unifi_trace(priv, UDBG3, "uf_check_inactivity: Interface priv is NULL \n"); + return; + } + + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + /* Go through the list of stations to check for inactivity */ + for(i = 0; i < UNIFI_MAX_CONNECTIONS; i++) { + staInfo = CsrWifiRouterCtrlGetStationRecordFromHandle(priv, i, interfaceTag); + if(!staInfo ) { + continue; + } + + unifi_trace(priv, UDBG3, "Running Inactivity handler Time %xus station's last activity %xus\n", + currentTime, staInfo->lastActivity); + + + elapsedTime = (currentTime >= staInfo->lastActivity)? + (currentTime - staInfo->lastActivity): + (~((CsrUint32)0) - staInfo->lastActivity + currentTime); + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + + if (elapsedTime > MAX_INACTIVITY_INTERVAL) { + memcpy((CsrUint8*)&peerMacAddress, (CsrUint8*)&staInfo->peerMacAddress, sizeof(CsrWifiMacAddress)); + + /* Indicate inactivity for the station */ + unifi_trace(priv, UDBG3, "Station %x:%x:%x:%x:%x:%x inactive since %xus\n sending Inactive Ind\n", + peerMacAddress.a[0], peerMacAddress.a[1], + peerMacAddress.a[2], peerMacAddress.a[3], + peerMacAddress.a[4], peerMacAddress.a[5], + elapsedTime); + + CsrWifiRouterCtrlStaInactiveIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, peerMacAddress); + } + } + + interfacePriv->last_inactivity_check = currentTime; +} + +/* Function to update activity of a station */ +void uf_update_sta_activity(unifi_priv_t *priv, CsrUint16 interfaceTag, const CsrUint8 *peerMacAddress) +{ + CsrTime elapsedTime, currentTime; /* Time in microseconds */ + CsrTime timeHi; /* Not used - Time in microseconds */ + CsrWifiRouterCtrlStaInfo_t *staInfo; + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + unsigned long lock_flags; + + if (interfacePriv == NULL) { + unifi_trace(priv, UDBG3, "uf_check_inactivity: Interface priv is NULL \n"); + return; + } + + currentTime = CsrTimeGet(&timeHi); + + + staInfo = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, peerMacAddress, interfaceTag); + + if (staInfo == NULL) { + unifi_trace(priv, UDBG4, "Sta does not exist yet"); + return; + } + + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + /* Update activity */ + staInfo->lastActivity = currentTime; + + /* See if inactivity handler needs to be run + * Here it is theoretically possible that the counter may have wrapped around. But + * since we just want to know when to run the inactivity handler it does not really matter. + * Especially since this is data path it makes sense in keeping it simple and avoiding + * 64 bit handling */ + elapsedTime = (currentTime >= interfacePriv->last_inactivity_check)? + (currentTime - interfacePriv->last_inactivity_check): + (~((CsrUint32)0) - interfacePriv->last_inactivity_check + currentTime); + + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + + /* Check if it is time to run the inactivity handler */ + if (elapsedTime > INACTIVITY_CHECK_INTERVAL) { + uf_check_inactivity(priv, interfaceTag, currentTime); + } +} +void resume_unicast_buffered_frames(unifi_priv_t *priv, CsrUint16 interfaceTag) +{ + + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + CsrUint8 i; + int j; + tx_buffered_packets_t * buffered_pkt = NULL; + CsrBool hipslotFree[4] = {TRUE,TRUE,TRUE,TRUE}; + int r; + unsigned long lock_flags; + + func_enter(); + while(!isRouterBufferEnabled(priv,3) && + ((buffered_pkt=dequeue_tx_data_pdu(priv,&interfacePriv->genericMgtFrames))!=NULL)) { + buffered_pkt->transmissionControl &= + ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_ESOP_MASK); + if((r=frame_and_send_queued_pdu(priv,buffered_pkt,NULL,0,FALSE)) == -ENOSPC) { + /* Enqueue at the head of the queue */ + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_add(&buffered_pkt->q, &interfacePriv->genericMgtFrames); + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + hipslotFree[3]=FALSE; + break; + }else { + if(r){ + unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n"); + /* the PDU failed where we can't do any thing so free the storage */ + unifi_net_data_free(priv, &buffered_pkt->bulkdata); + } + kfree(buffered_pkt); + } + } + for(i = 0; i < UNIFI_MAX_CONNECTIONS; i++) { + CsrWifiRouterCtrlStaInfo_t *staInfo = interfacePriv->staInfo[i]; + if(!hipslotFree[0] && !hipslotFree[1] && !hipslotFree[2] && !hipslotFree[3]) { + unifi_trace(priv, UDBG3, "(ENOSPC) in resume_unicast_buffered_frames:: hip slots are full \n"); + break; + } + if (staInfo && (staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE)) { + while((( TRUE == hipslotFree[3] ) && (buffered_pkt=dequeue_tx_data_pdu(priv, &staInfo->mgtFrames)))) { + buffered_pkt->transmissionControl &= + ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_ESOP_MASK); + if((r=frame_and_send_queued_pdu(priv,buffered_pkt,staInfo,0,FALSE)) == -ENOSPC) { + unifi_trace(priv, UDBG3, "(ENOSPC) in resume_unicast_buffered_frames:: hip slots are full for voice queue\n"); + /* Enqueue at the head of the queue */ + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_add(&buffered_pkt->q, &staInfo->mgtFrames); + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + priv->pausedStaHandle[3]=(CsrUint8)(staInfo->assignedHandle); + hipslotFree[3] = FALSE; + break; + } else { + if(r){ + unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n"); + /* the PDU failed where we can't do any thing so free the storage */ + unifi_net_data_free(priv, &buffered_pkt->bulkdata); + } + kfree(buffered_pkt); + } + } + + for(j=3;j>=0;j--) { + if(!hipslotFree[j]) + continue; + + while((buffered_pkt=dequeue_tx_data_pdu(priv, &staInfo->dataPdu[j]))) { + buffered_pkt->transmissionControl &= + ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_ESOP_MASK); + if((r=frame_and_send_queued_pdu(priv,buffered_pkt,staInfo,0,FALSE)) == -ENOSPC) { + /* Enqueue at the head of the queue */ + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_add(&buffered_pkt->q, &staInfo->dataPdu[j]); + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + priv->pausedStaHandle[j]=(CsrUint8)(staInfo->assignedHandle); + hipslotFree[j]=FALSE; + break; + } else { + if(r){ + unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n"); + /* the PDU failed where we can't do any thing so free the storage */ + unifi_net_data_free(priv, &buffered_pkt->bulkdata); + } + kfree(buffered_pkt); + } + } + } + } + } + func_exit(); +} +void update_eosp_to_head_of_broadcast_list_head(unifi_priv_t *priv,CsrUint16 interfaceTag) +{ + + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + unsigned long lock_flags; + struct list_head *listHead; + struct list_head *placeHolder; + tx_buffered_packets_t *tx_q_item; + + func_enter(); + if (interfacePriv->noOfbroadcastPktQueued) { + + /* Update the EOSP to the HEAD of b/c list + * beacuse we have received any mgmt packet so it should not hold for long time + * peer may time out. + */ + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_for_each_safe(listHead, placeHolder, &interfacePriv->genericMulticastOrBroadCastFrames) { + tx_q_item = list_entry(listHead, tx_buffered_packets_t, q); + tx_q_item->transmissionControl |= TRANSMISSION_CONTROL_ESOP_MASK; + tx_q_item->transmissionControl = (tx_q_item->transmissionControl & ~(CSR_NO_CONFIRM_REQUIRED)); + unifi_trace(priv, UDBG1,"updating eosp for list Head hostTag:= 0x%x ",tx_q_item->hostTag); + break; + } + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + } + func_exit(); +} +void resume_suspended_uapsd(unifi_priv_t* priv,CsrUint16 interfaceTag) +{ + + CsrUint8 startIndex; + CsrWifiRouterCtrlStaInfo_t * staInfo = NULL; + unsigned long lock_flags; + /*U-APSD might have stopped because of multicast. So restart it if U-APSD + was active with any of the station*/ + for(startIndex= 0; startIndex < UNIFI_MAX_CONNECTIONS;startIndex++) { + staInfo = CsrWifiRouterCtrlGetStationRecordFromHandle(priv,startIndex,interfaceTag); + if(!staInfo ) { + continue; + } else if((staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE) + &&(staInfo->uapsdSuspended == TRUE)) { + + /*U-APSD Still active, it means trigger frame is received,so continue U-APSD by + sending data from remaining delivery enabled queues*/ + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + staInfo->uapsdActive = TRUE; + staInfo->uapsdSuspended = FALSE; + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + uf_continue_uapsd(priv,staInfo); + } + } + +} +void uf_store_directed_ma_packet_referenece(unifi_priv_t *priv, bulk_data_param_t *bulkdata, + CSR_SIGNAL *sigptr, CsrUint32 alignOffset) +{ + + maPktReqList_t *maPktreq = NULL; + CSR_MA_PACKET_REQUEST *req = &sigptr->u.MaPacketRequest; + CsrWifiRouterCtrlStaInfo_t *staRecord = NULL; + CsrUint16 frmCtrl,interfaceTag = 0; + const CsrUint8* macHdrLocation; + struct sk_buff *skb ; + unsigned long lock_flags; + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + CsrUint8 *sigbuffer; + CsrUint8 frameType = 0; + func_enter(); + + if(bulkdata == NULL || (0 == bulkdata->d[0].data_length )){ + unifi_trace (priv, UDBG3, "uf_store_directed_ma_packet_referenece:bulk data NULL \n"); + func_exit(); + return; + } + macHdrLocation = bulkdata->d[0].os_data_ptr; + skb = (struct sk_buff*)bulkdata->d[0].os_net_buf_ptr; + /* fectch the frame control value from mac header */ + frmCtrl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(macHdrLocation); + + /* Processing done according to Frame/Packet type */ + frameType = ((frmCtrl & 0x000c) >> FRAME_CONTROL_TYPE_FIELD_OFFSET); + + if( (((frmCtrl & 0xff) == IEEE802_11_FC_TYPE_QOS_NULL) || + ((frmCtrl & 0xff) == IEEE802_11_FC_TYPE_NULL ) ) || + ( IEEE802_11_FRAMETYPE_MANAGEMENT== frameType)){ + + /* if packet is NULL or Qos Null no need of retransmit so dont queue it*/ + unifi_trace (priv, UDBG3, "uf_store_directed_ma_packet_referenece: NULL data Pkt or mgmt\n"); + func_exit(); + return; + } + + /* fetch the station record for corresponding peer mac address */ + if ((staRecord = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, req->Ra.x, interfaceTag))) { + maPktreq = (maPktReqList_t*)kmalloc(sizeof(maPktReqList_t),GFP_ATOMIC); + if(maPktreq == NULL){ + unifi_error(priv, + "uf_store_directed_ma_packet_referenece :: Failed to allocate %d byter for maPktreq\n", + sizeof(maPktReqList_t)); + func_exit(); + return; + } + } + + /* staRecord not present that means packet is multicast or generic mgmt so no need to queue it */ + else{ + unifi_trace (priv, UDBG3, "uf_store_directed_ma_packet_referenece: multicast pkt \n"); + func_exit(); + return ; + } + + /* disbale preemption */ + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + INIT_LIST_HEAD(&maPktreq->q); + maPktreq->staHandler = staRecord->assignedHandle; + memcpy(&maPktreq->signal,sigptr,sizeof(CSR_SIGNAL_PRIMITIVE_HEADER) + sizeof(CSR_MA_PACKET_REQUEST)); + sigbuffer = (CsrUint8*)&maPktreq->signal; + sigbuffer[SIZEOF_SIGNAL_HEADER + 1] = alignOffset; + maPktreq->skb = skb_get(skb); + maPktreq->hostTag = req->HostTag; + maPktreq->jiffeTime = jiffies; + list_add_tail(&maPktreq->q,&interfacePriv->directedMaPktReq); + + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + func_exit(); + +} + +#endif diff --git a/drivers/staging/csr/unifi_priv.h b/drivers/staging/csr/unifi_priv.h new file mode 100644 index 0000000..f687f27 --- /dev/null +++ b/drivers/staging/csr/unifi_priv.h @@ -0,0 +1,1148 @@ +/* + ***************************************************************************** + * + * FILE : unifi_priv.h + * + * PURPOSE : Private header file for unifi driver. + * + * UDI = UniFi Debug Interface + * + * Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + ***************************************************************************** + */ +#ifndef __LINUX_UNIFI_PRIV_H__ +#define __LINUX_UNIFI_PRIV_H__ 1 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19) +#include +#endif + +#ifdef CSR_WIFI_SUPPORT_MMC_DRIVER +#include +#include +#include +#include +#include +#include +#endif /* CSR_WIFI_SUPPORT_MMC_DRIVER */ + +#include + +#include "csr_wifi_hip_unifi.h" +#include "csr_wifi_hip_unifi_udi.h" +#include "csr_wifi_router_lib.h" +#include "unifiio.h" +#ifndef CSR_WIFI_HIP_TA_DISABLE +#include "csr_wifi_vif_utils.h" +#endif + +/* Define the unifi_priv_t before include the unifi_native.h */ +struct unifi_priv; +typedef struct unifi_priv unifi_priv_t; +#ifdef CSR_SUPPORT_WEXT_AP +struct CsrWifiSmeApConfig; +typedef struct CsrWifiSmeApConfig CsrWifiSmeApConfig_t; +#endif +#ifdef CSR_SUPPORT_WEXT +#include "unifi_wext.h" +#endif + +#include "unifi_clients.h" + + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) +#include + +#undef INIT_WORK +#define INIT_WORK(_work, _func) \ + do { \ + INIT_LIST_HEAD(&(_work)->entry); \ + (_work)->pending = 0; \ + PREPARE_WORK((_work), (_func), (_work)); \ + init_timer(&(_work)->timer); \ + } while(0) + +#endif /* Linux kernel < 2.6.20 */ + + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) +#define UF_NETIF_TX_WAKE_ALL_QUEUES(_netdev) netif_tx_wake_all_queues(_netdev) +#define UF_NETIF_TX_START_ALL_QUEUES(_netdev) netif_tx_start_all_queues(_netdev) +#define UF_NETIF_TX_STOP_ALL_QUEUES(_netdev) netif_tx_stop_all_queues(_netdev) +#else +#define UF_NETIF_TX_WAKE_ALL_QUEUES(_netdev) netif_wake_queue(_netdev) +#define UF_NETIF_TX_START_ALL_QUEUES(_netdev) netif_start_queue(_netdev) +#define UF_NETIF_TX_STOP_ALL_QUEUES(_netdev) netif_stop_queue(_netdev) +#endif /* Linux kernel >= 2.6.27 */ + + +#ifdef CSR_NATIVE_LINUX +#include "sme_native/unifi_native.h" +#else +#include "unifi_sme.h" +#endif + +#undef COMPARE_HOST_TAG_TO_ENQUEUE +#define COMPARE_HOST_TAG_TO_ENQUEUE(tx_q_item_hosttag,maPktHostTag) \ + if(tx_q_item_hosttag > maPktHostTag){ \ + locationFound = TRUE; \ + ii++; \ + break; \ + } \ + ii++; \ + + +/* The device major number to use when registering the udi driver */ +#define UNIFI_NAME "unifi" +#define MAX_UNIFI_DEVS 2 + +/* 802.11 Mac header offsets */ +#define MAC_HEADER_SIZE 24 +#define QOS_CONTROL_HEADER_SIZE 2 +#define HT_CONTROL_HEADER_SIZE 4 +#define QOS_DATA 0x8 +#define QOS_DATA_NULL 0xc +#define DATA_NULL 0x04 +#define FRAME_CONTROL_ORDER_BIT 0x8000 +#define FRAME_CONTROL_TYPE_FIELD_OFFSET 2 +#define FRAME_CONTROL_SUBTYPE_FIELD_OFFSET 4 +#define IEEE802_11_FRAMETYPE_DATA 0x02 +#define IEEE802_11_FRAMETYPE_CONTROL 0x01 +#define IEEE802_11_FRAMETYPE_MANAGEMENT 0x00 +#define IEEE802_11_FRAMETYPE_RESERVED 0x03 + +/* octet offset from start of mac header for certain fields */ +#define IEEE802_11_ADDR3_OFFSET 16 +#define IEEE802_11_SEQUENCE_CONTROL_OFFSET 22 +#define IEEE802_11_MAX_DATA_LEN 2304 + +/* frame control (FC) masks, for frame control as 16 bit integer */ +#define IEEE802_11_FC_TO_DS_MASK 0x100 +#define IEEE802_11_FC_FROM_DS_MASK 0x200 +#define IEEE802_11_FC_MOREDATA_MASK 0x2000 +#define IEEE802_11_FC_PROTECTED_MASK 0x4000 +#define IEEE80211_FC_ORDER_MASK 0x8000 +#define IEEE80211_FC_SUBTYPE_MASK 0x00f0 +#define IEEE80211_FC_TYPE_MASK 0x000c +#define IEEE80211_FC_PROTO_VERSION_MASK 0x0003 + +/* selected type and subtype combinations as in 7.1.3.1 table 1 + For frame control as 16 bit integer, or for ls octet +*/ +#define IEEE802_11_FC_TYPE_DATA 0x08 +#define IEEE802_11_FC_TYPE_NULL 0x48 +#define IEEE802_11_FC_TYPE_QOS_NULL 0xc8 +#define IEEE802_11_FC_TYPE_QOS_DATA 0x88 + +#define IEEE802_11_FC_TYPE_DATA_SUBTYPE_RESERVED 0x0D + +/* qos control (QC) masks for qos control as 16 bit integer, or for ls octet */ +#define IEEE802_11_QC_TID_MASK 0x0f +#define IEEE802_11_QC_A_MSDU_PRESENT 0x80 + +#define CSR_WIFI_EAPOL_M4_HOST_TAG 0x50000000 +#define IEEE802_11_DATA_FRAME_MAC_HEADER_SIZE 36 +#define MAX_ACCESS_CATOGORY 4 + +/* Time in us to check for inactivity of stations 5 mins */ +#define INACTIVITY_CHECK_INTERVAL 300000000 +/* Time in us before a station is flagged as inactive */ +#define MAX_INACTIVITY_INTERVAL 300000000 + + +/* Define for maximum BA session */ +#define MAX_SUPPORTED_BA_SESSIONS_TX 1 +#define MAX_SUPPORTED_BA_SESSIONS_RX 4 + +#define MAX_BA_WIND_SIZE 64 +#define MAC_HEADER_ADDR1_OFFSET 4 +#define MAC_HEADER_ADDR2_OFFSET 10 + +/* Define for age (in us) value for frames in MPDU reorder buffer */ +#define CSR_WIFI_BA_MPDU_FRAME_AGE_TIMEOUT 30000 /* 30 milli seconds */ + +/* This macro used in prepare_and_add_macheader*/ +#define ADDRESS_ONE_OFFSET 20 + +/* Defines for STA inactivity detection */ +#define STA_INACTIVE_DETECTION_TRIGGER_THRESHOLD 1 /* in number of stations */ +#define STA_INACTIVE_DETECTION_TIMER_INTERVAL 30 /* in seconds */ +#define STA_INACTIVE_TIMEOUT_VAL 120*1000*1000 /* 120 seconds */ + + +/* Defines used in beacon filtering in case of P2P */ +#define CSR_WIFI_P2P_WILDCARD_SSID_LENGTH 0x7 +#define CSR_WIFI_80211_FRAME_SUBTYPE_BEACON 0x8 +#define CSR_WIFI_BEACON_FIXED_LENGTH 12 +#define CSR_WIFI_FRAME_SUBTYPE_BIT_OFFSET 4 +#define CSR_WIFI_80211_FRAME_SUBTYPE_BIT_MASK ((CsrUint8)(0xF << CSR_WIFI_FRAME_SUBTYPE_BIT_OFFSET)) + +#define CSR_WIFI_80211_GET_FRAME_SUBTYPE(frameBuffer) \ + ((CsrUint8)(((CsrUint8 *)frameBuffer)[0] & CSR_WIFI_80211_FRAME_SUBTYPE_BIT_MASK) >> CSR_WIFI_FRAME_SUBTYPE_BIT_OFFSET) + +/* For M4 request received via netdev*/ + +typedef CsrUint8 CsrWifiPacketType; +#define CSR_WIFI_UNICAST_PDU ((CsrWifiPacketType) 0x00) +#define CSR_WIFI_MULTICAST_PDU ((CsrWifiPacketType) 0x1) +#define CSR_WIFI_BROADCAST_PDU ((CsrWifiPacketType) 0x2) + +#define PRIO_TO_NICE(prio) ((prio) - MAX_RT_PRIO - 20) + +/* Module parameter variables */ +extern int buswidth; +extern int sdio_clock; +extern int use_5g; +extern int disable_hw_reset; +extern int disable_power_control; +extern int enable_wol; +extern int sme_debug; +extern int fw_init[MAX_UNIFI_DEVS]; +extern int tl_80211d; +extern int sdio_byte_mode; +extern int sdio_block_size; +extern int coredump_max; +extern int run_bh_once; +extern int bh_priority; + +struct dlpriv { + const unsigned char *dl_data; + int dl_len; + void *fw_desc; +}; + + +struct uf_thread { + + struct task_struct *thread_task; + + /* wait_queue for waking the unifi_thread kernel thread */ + wait_queue_head_t wakeup_q; + unsigned int wakeup_flag; + + /* + * Use it to block the I/O thread when + * an error occurs or UniFi is reinitialised. + */ + int block_thread; + + char name[16]; + int prio; +}; + +/* + * Link list to hold the received packets for the period the port + * remains closed. + */ +typedef struct rx_buffered_packets { + /* List link structure */ + struct list_head q; + /* Packet to indicate when the port reopens */ + struct sk_buff *skb; + /* Bulkdata to free in case the port closes and need to discard the packet */ + bulk_data_param_t bulkdata; + /* The source address of the packet */ + CsrWifiMacAddress sa; + /* The destination address of the packet */ + CsrWifiMacAddress da; + /* Corresponding signal */ + CSR_SIGNAL signal; +} rx_buffered_packets_t; + + +typedef CsrUint8 CsrWifiAcPowersaveMode; +#define CSR_WIFI_AC_TRIGGER_ONLY_ENABLED 0x00 +#define CSR_WIFI_AC_DELIVERY_ONLY_ENABLE 0X01 +#define CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED 0X03 +#define CSR_WIFI_AC_LEGACY_POWER_SAVE 0X02 + + +#define IS_DELIVERY_ENABLED(mode) (mode & CSR_WIFI_AC_DELIVERY_ONLY_ENABLE)? 1: 0 +#define IS_DELIVERY_AND_TRIGGER_ENABLED(mode) ((mode & CSR_WIFI_AC_DELIVERY_ONLY_ENABLE)||(mode & CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED))? 1: 0 +#define IS_DTIM_ACTIVE(flag,hostTag) ((flag == TRUE || hostTag != INVALID_HOST_TAG)) +#define INVALID_HOST_TAG 0xFFFFFFFF +#define UNIFI_TRAFFIC_Q_CONTENTION UNIFI_TRAFFIC_Q_BE + + + + +/* Queue to be used for contention priority */ + +/* + * Link list to hold the tx packets for the period the peer + * powersave/free slots in unifi + */ +typedef struct tx_buffered_packets { + /* List link structure */ + struct list_head q; + CsrUint16 interfaceTag; + CSR_CLIENT_TAG hostTag; + CSR_PROCESS_ID leSenderProcessId; + CSR_TRANSMISSION_CONTROL transmissionControl; + CSR_RATE rate; + /* Bulkdata to free in case the port closes and need to discard the packet */ + bulk_data_desc_t bulkdata; + /* The source address of the packet */ + CsrWifiMacAddress peerMacAddress; + CSR_PRIORITY priority; +} tx_buffered_packets_t; + +/* station record has this data structure */ +typedef struct CsrWifiRouterCtrlStaInfo_t { + + /* Sme sends these parameters */ + CsrWifiMacAddress peerMacAddress; + CsrUint32 assignedHandle; + CsrBool wmmOrQosEnabled; + CsrWifiAcPowersaveMode powersaveMode[MAX_ACCESS_CATOGORY]; + CsrUint16 maxSpLength; + CsrBool uapsdActive; + CsrUint16 noOfSpFramesSent; + + /* Router/Driver database */ +#ifdef CSR_SUPPORT_SME + unifi_port_cfg_t *peerControlledPort; + unifi_port_cfg_t *peerUnControlledPort; + + /* Inactivity feature parameters */ + struct netInterface_priv *interfacePriv; + struct work_struct send_disconnected_ind_task; + CsrBool activity_flag; + CsrUint16 listenIntervalInTus; + CSR_CLIENT_TAG nullDataHostTag; + + /* Activity timestamps for the station */ + CsrTime lastActivity; + + /* during m/c transmission sp suspended */ + CsrBool uapsdSuspended; +#endif + CsrWifiRouterCtrlPeerStatus currentPeerState; + struct list_head dataPdu[MAX_ACCESS_CATOGORY]; + struct list_head mgtFrames; + CsrUint8 spStatus; + CsrUint8 prevFrmType; + CsrUint8 prevFrmAccessCatogory; + CsrBool protection; + CsrUint16 aid; + CsrBool txSuspend; + CsrUint8 timSet; + /* Dont change the value of below macro for SET & RESET */ +#define CSR_WIFI_TIM_RESET 0 +#define CSR_WIFI_TIM_SET 1 +#define CSR_WIFI_TIM_RESETTING 2 +#define CSR_WIFI_TIM_SETTING 3 + + CsrUint16 noOfPktQueued; +}CsrWifiRouterCtrlStaInfo_t; + +#ifdef CSR_SUPPORT_WEXT_AP +struct CsrWifiSmeApConfig { + CsrWifiSsid ssid; + CsrUint16 channel; + CsrWifiNmeApCredentials credentials; + CsrUint8 max_connections; + CsrUint8 if_index; +}; +#endif + +#ifdef CSR_WIFI_RX_PATH_SPLIT +/* This is a test code and may be removed later*/ +#define CSR_WIFI_RX_SIGNAL_BUFFER_SIZE (60+1) + +typedef struct +{ + CsrUint8 *bufptr; /* Signal Primitive */ + bulk_data_param_t data_ptrs; /* Bulk Data pointers */ + CsrUint16 sig_len; +}rx_buff_struct_t; + +typedef struct +{ + CsrUint8 writePointer; /**< write pointer */ + CsrUint8 readPointer; /**< read pointer */ + CsrUint8 size; /**< size of circular buffer */ + rx_buff_struct_t rx_buff[CSR_WIFI_RX_SIGNAL_BUFFER_SIZE]; /**< Element of ciruclar buffer */ +} rxCircularBuffer_t; + +void rx_wq_handler(struct work_struct *work); +#endif + +struct unifi_priv { + + card_t *card; + CsrSdioFunction *sdio; + + /* Index into Unifi_instances[] for this device. */ + int instance; + /* Reference count for this instance */ + int ref_count; + + /* Firmware images */ + struct dlpriv fw_sta; + struct dlpriv fw_conv; /* used for conversion of production test image */ + + /* Char device related structures */ + struct cdev unifi_cdev; + struct cdev unifiudi_cdev; + struct device *unifi_device; + + /* Which wireless interface to use (1 - 2.4GHz, 2 - 5GHz) */ + CSR_IFINTERFACE if_index; + + /* For multiple interface support */ + struct net_device *netdev[CSR_WIFI_NUM_INTERFACES]; + struct netInterface_priv *interfacePriv[CSR_WIFI_NUM_INTERFACES]; + + CsrUint8 totalInterfaceCount; + + int prev_queue; + + /* Name of node under /proc */ + char proc_entry_name[64]; + + /* + * Flags: + * drop_unencrypted + * - Not used? + * netdev_registered + * - whether the netdev has been registered. + */ + unsigned int drop_unencrypted : 1; + + /* Our list of unifi linux clients. */ + ul_client_t ul_clients[MAX_UDI_CLIENTS]; + + /* Mutex to protect using the logging hook after UDI client is gone */ + struct semaphore udi_logging_mutex; + /* Pointer to the ul_clients[] array */ + ul_client_t *logging_client; + + /* A ul_client_t* used to send the netdev related MIB requests. */ + ul_client_t *netdev_client; + + /* The SME ul_client_t pointer. */ + ul_client_t *sme_cli; + + /* The AMP ul_client_t pointer. */ + ul_client_t *amp_client; + + /* + * Semaphore for locking the top-half to one user process. + * This is necessary to prevent multiple processes calling driver + * operations. This can happen because the network driver entry points + * can be called from multiple processes. + */ +#ifdef USE_DRIVER_LOCK + struct semaphore lock; +#endif /* USE_DRIVER_LOCK */ + + /* Flag to say that an operation was aborted */ + int io_aborted; + + struct uf_thread bh_thread; + +#define UNIFI_INIT_NONE 0x00 +#define UNIFI_INIT_IN_PROGRESS 0x01 +#define UNIFI_INIT_FW_DOWNLOADED 0x02 +#define UNIFI_INIT_COMPLETED 0x04 + unsigned char init_progress; + + int sme_is_present; + + /* The WMM features that UniFi uses in the current BSS */ + unsigned int sta_wmm_capabilities; + + /* Debug only */ + char last_debug_string[256]; + unsigned short last_debug_word16[16]; + +#ifdef CSR_SUPPORT_SME + /* lock to protect the tx queues list */ + spinlock_t tx_q_lock; + CsrUint8 allPeerDozing; + CsrUint8 pausedStaHandle[MAX_ACCESS_CATOGORY]; + /* Max packet the driver can queue, irrespective of interface number */ + CsrUint16 noOfPktQueuedInDriver; +#define CSR_WIFI_DRIVER_SUPPORT_FOR_MAX_PKT_QUEUEING 512 +#define CSR_WIFI_DRIVER_MAX_PKT_QUEUING_THRESHOLD_PER_PEER 64 +#define CSR_WIFI_DRIVER_MINIMUM_BROADCAST_PKT_THRESHOLD 3 + + CsrBool routerBufferEnable[MAX_ACCESS_CATOGORY]; + /* lock to protect stainfo members and priv members*/ + spinlock_t staRecord_lock; +#endif +#ifdef CSR_NATIVE_LINUX +#ifdef CSR_SUPPORT_WEXT + /* wireless config */ + struct wext_config wext_conf; +#endif + + /* Mutex to protect the MLME blocking requests */ + struct semaphore mlme_blocking_mutex; + + /* The ul_client that provides the blocking API for WEXT calls */ + ul_client_t *wext_client; + +#endif /* CSR_NATIVE_LINUX */ + +#ifdef CSR_SUPPORT_SME + wait_queue_head_t sme_request_wq; + /* Semaphore to protect the SME blocking requests */ + struct semaphore sme_sem; + /* Structure to hold the SME blocking requests data*/ + sme_reply_t sme_reply; + + /* Structure to hold a traffic protocol indication */ + struct ta_ind { + struct work_struct task; + CsrWifiRouterCtrlTrafficPacketType packet_type; + CsrWifiRouterCtrlProtocolDirection direction; + CsrWifiMacAddress src_addr; + int in_use; + } ta_ind_work; + + struct ta_sample_ind { + struct work_struct task; + CsrWifiRouterCtrlTrafficStats stats; + int in_use; + } ta_sample_ind_work; + + __be32 sta_ip_address; + CsrWifiRouterCtrlSmeVersions sme_versions; + + /* + * Flag to reflect state of unifi_sys_wifi_on_*() progress. + * This indicates whether we are in an "wifi on" state when we are + * allowed to indication errors with unifi_mgt_wifi_off_ind() + */ + enum { + wifi_on_unspecified = -1, + wifi_on_in_progress = 0, + wifi_on_done = 1, + } wifi_on_state; + + /* Userspace TaskId for the SME Set when a wifi on req is received */ + CsrSchedQid CSR_WIFI_SME_IFACEQUEUE; + + struct work_struct multicast_list_task; + /* + * The SME installs filters to ask for specific MA-UNITDATA.req + * to be passed to different SME components. + */ +#define MAX_MA_UNIDATA_IND_FILTERS 8 + sme_ma_unidata_ind_filter_t sme_unidata_ind_filters[MAX_MA_UNIDATA_IND_FILTERS]; + +/* UNIFI_CFG related parameters */ + uf_cfg_bcast_packet_filter_t packet_filters; + unsigned char *filter_tclas_ies; + /* The structure that holds all the connection configuration. */ + CsrWifiSmeConnectionConfig connection_config; +#ifdef CSR_SUPPORT_WEXT + + int ignore_bssid_join; + struct iw_statistics wext_wireless_stats; + + /* The MIB and MAC address files contents, read from userspace */ + CsrWifiSmeDataBlock mib_data; + CsrWifiMacAddress sta_mac_address; + + int wep_tx_key_index; + wep_key_t wep_keys[NUM_WEPKEYS]; + + +#ifdef CSR_SUPPORT_WEXT_AP + CsrWifiSmeApMacConfig ap_mac_config; + CsrWifiNmeApConfig group_sec_config; + CsrWifiSmeApConfig_t ap_config; +#endif + struct work_struct sme_config_task; + +#endif /* CSR_SUPPORT_WEXT */ + +#endif /* CSR_SUPPORT_SME */ + +#ifdef CSR_SME_USERSPACE + void *smepriv; +#endif /* CSR_SME_USERSPACE */ + + card_info_t card_info; + + /* Mutex to protect unifi_send_signal() */ + spinlock_t send_signal_lock; + + + /* + * The workqueue to offload the TA run + * and the multicast addresses list set + */ + struct workqueue_struct *unifi_workqueue; + + unsigned char *mib_cfm_buffer; + unsigned int mib_cfm_buffer_length; + + int ptest_mode; /* Set when in production test mode */ + int coredump_mode; /* Set when SME has requested a coredump */ + CsrBool wol_suspend; /* Set when suspending with UniFi powered */ + +#define UF_UNCONTROLLED_PORT_Q 0 +#define UF_CONTROLLED_PORT_Q 1 + + /* Semaphore to protect the rx queues list */ + struct semaphore rx_q_sem; + + /* Spinlock to protect M4 data */ + spinlock_t m4_lock; + /* Spinlock to protect BA RX data */ + spinlock_t ba_lock; +#ifndef ALLOW_Q_PAUSE + /* Array to indicate if a particular Tx queue is paused, this may not be + * required in a multiqueue implementation since we can directly stop kernel + * queues */ + CsrUint8 tx_q_paused_flag[UNIFI_TRAFFIC_Q_MAX]; +#endif + +#ifdef CSR_WIFI_RX_PATH_SPLIT + struct workqueue_struct *rx_workqueue; + struct work_struct rx_work_struct; + rxCircularBuffer_t rxSignalBuffer; + +#endif + + CsrUint32 rxTcpThroughput; + CsrUint32 txTcpThroughput; + CsrUint32 rxUdpThroughput; + CsrUint32 txUdpThroughput; + + + CsrUint8 wapi_multicast_filter; + CsrUint8 wapi_unicast_filter; + CsrUint8 wapi_unicast_queued_pkt_filter; +}; + +typedef struct { + CsrUint16 queue_length[4]; + CsrUint8 os_queue_paused; +} unifi_OsQosInfo; + + +typedef struct { + CsrBool active; + bulk_data_param_t bulkdata; + CSR_SIGNAL signal; + CsrUint16 sn; + CsrTime recv_time; +} frame_desc_struct; + +typedef struct { + frame_desc_struct *buffer; + CsrUint16 wind_size; + CsrUint16 occupied_slots; + struct timer_list timer; + CsrUint16 timeout; + CsrUint16 expected_sn; + CsrUint16 start_sn; + CsrBool trigger_ba_after_ssn; + struct netInterface_priv *interfacePriv; + CsrUint16 tID; + CsrWifiMacAddress macAddress; + struct work_struct send_ba_err_task; +} ba_session_rx_struct; + + +typedef struct { + struct netInterface_priv *interfacePriv; + CsrUint16 tID; + CsrWifiMacAddress macAddress; +} ba_session_tx_struct; + +typedef struct netInterface_priv +{ + CsrUint16 InterfaceTag; + struct unifi_priv *privPtr; + ba_session_tx_struct *ba_session_tx[MAX_SUPPORTED_BA_SESSIONS_TX]; + ba_session_rx_struct *ba_session_rx[MAX_SUPPORTED_BA_SESSIONS_RX]; + frame_desc_struct ba_complete[MAX_BA_WIND_SIZE]; + CsrUint8 ba_complete_index; + CsrUint8 queueEnabled[UNIFI_NO_OF_TX_QS]; + struct work_struct send_m4_ready_task; + struct net_device_stats stats; + CsrUint8 interfaceMode; + CsrBool protect; + CsrWifiMacAddress bssid; + /* + * Flag to reflect state of CONNECTED indication signal. + * This indicates whether we are "joined" an Access Point (i.e. have + * nominated an AP and are receiving beacons) but give no indication + * of whether we are authenticated and/or associated. + */ + enum { + UnifiConnectedUnknown = -1, + UnifiNotConnected = 0, + UnifiConnected = 1, + } connected; +#ifdef CSR_SUPPORT_WEXT + /* Tracks when we are waiting for a netdevice state change callback */ + CsrBool wait_netdev_change; + /* True if we have successfully registered for netdev callbacks */ + CsrBool netdev_callback_registered; +#endif /* CSR_SUPPORT_WEXT */ + unsigned int netdev_registered; +#define UNIFI_MAX_MULTICAST_ADDRESSES 10 + /* The multicast addresses list that the thread needs to set. */ + u8 mc_list[UNIFI_MAX_MULTICAST_ADDRESSES*ETH_ALEN]; + /* The multicast addresses count that the thread needs to set. */ + int mc_list_count; + CsrUint32 tag; +#ifdef CSR_SUPPORT_SME + /* (un)controlled port configuration */ + unifi_port_config_t controlled_data_port; + unifi_port_config_t uncontrolled_data_port; + + /* station record maintenance related data structures */ + CsrUint8 num_stations_joined; + CsrWifiRouterCtrlStaInfo_t *(staInfo)[UNIFI_MAX_CONNECTIONS]; + struct list_head genericMgtFrames; + struct list_head genericMulticastOrBroadCastFrames; + struct list_head genericMulticastOrBroadCastMgtFrames; + struct list_head directedMaPktReq; + + /* Timer for detecting station inactivity */ + struct timer_list sta_activity_check_timer; + CsrBool sta_activity_check_enabled; + + /* Timestamp when the last inactivity check was done */ + CsrTime last_inactivity_check; + + /*number of multicast or borad cast packets queued*/ + CsrUint16 noOfbroadcastPktQueued; +#endif + /* A list to hold the buffered uncontrolled port packets */ + struct list_head rx_uncontrolled_list; + /* A list to hold the buffered controlled port packets */ + struct list_head rx_controlled_list; + /* Buffered M4 signal to take care of WPA race condition */ + CSR_SIGNAL m4_signal; + bulk_data_desc_t m4_bulk_data; + /* This should be removed and m4_hostTag should be used for checking*/ + CsrBool m4_sent; + CSR_CLIENT_TAG m4_hostTag; + CsrBool dtimActive; + CsrBool intraBssEnabled; + CsrUint32 multicastPduHostTag; /* Used to set the tim after getting + a confirm for it */ +} netInterface_priv_t; + +typedef struct maPktReqList{ + struct list_head q; + struct sk_buff *skb; + CSR_SIGNAL signal; + CSR_CLIENT_TAG hostTag; + CsrUint32 staHandler; + unsigned long jiffeTime; +}maPktReqList_t; + +#ifndef ALLOW_Q_PAUSE +#define net_is_tx_q_paused(priv, q) (priv->tx_q_paused_flag[q]) +#define net_tx_q_unpause(priv, q) (priv->tx_q_paused_flag[q] = 0) +#define net_tx_q_pause(priv, q) (priv->tx_q_paused_flag[q] = 1) +#endif + +#ifdef CSR_SUPPORT_SME +#define routerStartBuffering(priv,queue) priv->routerBufferEnable[(queue)] = TRUE; +#define routerStopBuffering(priv,queue) priv->routerBufferEnable[(queue)] = FALSE; +#define isRouterBufferEnabled(priv,queue) priv->routerBufferEnable[(queue)] +#endif + +#ifdef USE_DRIVER_LOCK +#define LOCK_DRIVER(_p) down_interruptible(&(_p)->lock) +#define UNLOCK_DRIVER(_p) up(&(_p)->lock) +#else +#define LOCK_DRIVER(_p) (void)(_p); /* as nothing */ +#define UNLOCK_DRIVER(_p) (void)(_p); /* as nothing */ +#endif /* USE_DRIVER_LOCK */ + +CsrInt32 CsrHipResultToStatus(CsrResult csrResult); + + +/* + * SDIO related functions and callbacks + */ +int uf_sdio_load(void); +void uf_sdio_unload(void); +unifi_priv_t *uf_find_instance(int inst); +int uf_find_priv(unifi_priv_t *priv); +int uf_find_netdev_priv(netInterface_priv_t *priv); +unifi_priv_t *uf_get_instance(int inst); +void uf_put_instance(int inst); +int csr_sdio_linux_install_irq(CsrSdioFunction *sdio); +int csr_sdio_linux_remove_irq(CsrSdioFunction *sdio); + +void uf_add_os_device(int bus_id, struct device *os_device); +void uf_remove_os_device(int bus_id); + + + +/* + * Claim/release SDIO + * + * For multifunction cards, we cannot grub the SDIO lock around the unifi_bh() + * as this prevents other functions using SDIO. + * Since some of CSR SDIO API is used regardless of trying to lock unifi_bh() + * we have followed this scheme: + * 1. If a function needs protection only when CSR_WIFI_SINGLE_FUNCTION is defined + * then we call CsrSdioClaim/CsrSdioRelease(). + * 2. If a function needs protection only when CSR_WIFI_SINGLE_FUNCTION is not defined + * then we call _sdio_claim_host/_sdio_claim_host(). Use of this should be restricted + * to the SDIO glue layer only (e.g. sdio_mmc.c). + * 3. If a function needs protection, regardless of the CSR_WIFI_SINGLE_FUNCTION + * then we call directly the sdio_claim_host/sdio_release_host(). + * Use of this must be restricted to the SDIO glue layer only (e.g. sdio_mmc.c). + * + * Note: The _func and function pointers are _not_ the same. + * The former is the (struct sdio_func*) context, which restricts the use to the SDIO glue layer. + * The latter is the (CsrSdioFunction*) context, which allows calls from all layers. + */ + +#ifdef CSR_WIFI_SUPPORT_MMC_DRIVER + +#ifdef CSR_WIFI_SINGLE_FUNCTION +#define CsrSdioClaim(function) sdio_claim_host((function)->priv); +#define CsrSdioRelease(function) sdio_release_host((function)->priv); + +#define _sdio_claim_host(_func) +#define _sdio_release_host(_func) + +#else +#define CsrSdioClaim(function) +#define CsrSdioRelease(function) + +#define _sdio_claim_host(_func) sdio_claim_host(_func) +#define _sdio_release_host(_func) sdio_release_host(_func) + +#endif /* CSR_WIFI_SINGLE_FUNCTION */ + +#else +#define _sdio_claim_host(_func) +#define _sdio_release_host(_func) + +#define CsrSdioClaim(function) +#define CsrSdioRelease(function) + +#endif /* CSR_WIFI_SUPPORT_MMC_DRIVER */ + + +/* + * Functions to allocate and free an ethernet device. + */ +unifi_priv_t *uf_alloc_netdevice(CsrSdioFunction *sdio_dev, int bus_id); +int uf_free_netdevice(unifi_priv_t *priv); + +/* Allocating function for other interfaces */ +CsrBool uf_alloc_netdevice_for_other_interfaces(unifi_priv_t *priv, CsrUint16 interfaceTag); + +/* + * Firmware download related functions. + */ +int uf_run_unifihelper(unifi_priv_t *priv); +int uf_request_firmware_files(unifi_priv_t *priv, int is_fw); +int uf_release_firmware_files(unifi_priv_t *priv); +int uf_release_firmware(unifi_priv_t *priv, struct dlpriv *to_free); + +/* + * Functions to create and delete the device nodes. + */ +int uf_create_device_nodes(unifi_priv_t *priv, int bus_id); +void uf_destroy_device_nodes(unifi_priv_t *priv); + +/* + * Upper Edge Initialisation functions + */ +int uf_init_bh(unifi_priv_t *priv); +int uf_init_hw(unifi_priv_t *priv); + +/* Thread related helper functions */ +int uf_start_thread(unifi_priv_t *priv, struct uf_thread *thread, int (*func)(void *)); +void uf_stop_thread(unifi_priv_t *priv, struct uf_thread *thread); +void uf_wait_for_thread_to_stop(unifi_priv_t *priv, struct uf_thread *thread); + + +/* + * Unifi Linux functions + */ +void ul_init_clients(unifi_priv_t *priv); + +/* Configuration flags */ +#define CLI_USING_WIRE_FORMAT 0x0002 +#define CLI_SME_USERSPACE 0x0020 +ul_client_t *ul_register_client(unifi_priv_t *priv, + unsigned int configuration, + udi_event_t udi_event_clbk); +int ul_deregister_client(ul_client_t *pcli); + +int ul_send_signal_unpacked(unifi_priv_t *priv, + CSR_SIGNAL *sigptr, + bulk_data_param_t *bulkdata); +int ul_send_signal_raw(unifi_priv_t *priv, + unsigned char *sigptr, int siglen, + bulk_data_param_t *bulkdata); + +void ul_log_config_ind(unifi_priv_t *priv, u8 *conf_param, int len); + + +/* + * Data plane operations + */ +/* + * data_tx.c + */ +int uf_verify_m4(unifi_priv_t *priv, const unsigned char *packet, + unsigned int length); + +#ifdef CSR_SUPPORT_SME +CsrBool uf_check_broadcast_bssid(unifi_priv_t *priv, const bulk_data_param_t *bulkdata); +CsrBool uf_process_pm_bit_for_peer(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t * srcStaInfo,CsrUint8 pmBit,CsrUint16 interfaceTag); +void uf_process_ps_poll(unifi_priv_t *priv,CsrUint8* sa,CsrUint8* da,CsrUint8 pmBit,CsrUint16 interfaceTag); +int uf_ap_process_data_pdu(unifi_priv_t *priv, struct sk_buff *skb, + struct ethhdr *ehdr, CsrWifiRouterCtrlStaInfo_t * srcStaInfo, + const CSR_SIGNAL *signal, + bulk_data_param_t *bulkdata, + CsrUint8 macHeaderLengthInBytes); +CsrBool uf_is_more_data_for_non_delivery_ac(CsrWifiRouterCtrlStaInfo_t *staRecord); +CsrBool uf_is_more_data_for_delivery_ac(unifi_priv_t *priv,CsrWifiRouterCtrlStaInfo_t *staRecord,CsrBool mgtCheck); +void uf_process_wmm_deliver_ac_uapsd ( unifi_priv_t * priv, + CsrWifiRouterCtrlStaInfo_t * srcStaInfo, + CsrUint16 qosControl, + CsrUint16 interfaceTag); + +void uf_send_buffered_data_from_ac(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo, CsrUint8 queue, struct list_head *txList); +void uf_send_buffered_data_from_delivery_ac(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo, CsrUint8 queue, struct list_head *txList); + +void uf_continue_uapsd(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo); +void uf_send_qos_null(unifi_priv_t * priv,CsrUint16 interfaceTag, const CsrUint8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo); +void uf_send_nulldata(unifi_priv_t * priv,CsrUint16 interfaceTag, const CsrUint8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo); +void uf_store_directed_ma_packet_referenece(unifi_priv_t *priv, bulk_data_param_t *bulkdata,CSR_SIGNAL *sigptr,CsrUint32 alignOffset); + + + +#endif +CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, CsrUint8 *peerMacAddress, CSR_CLIENT_TAG hostTag, CsrUint16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl, CSR_RATE TransmitRate, CSR_PRIORITY priority, CSR_PROCESS_ID senderId, bulk_data_param_t *bulkdata); +void uf_process_ma_vif_availibility_ind(unifi_priv_t *priv,CsrUint8 *sigdata, CsrUint32 siglen); +#ifdef CSR_SUPPORT_SME +void uf_send_buffered_frames(unifi_priv_t *priv,unifi_TrafficQueue queue); +int uf_process_station_records_for_sending_data(unifi_priv_t *priv,CsrUint16 interfaceTag, + CsrWifiRouterCtrlStaInfo_t *srcStaInfo, + CsrWifiRouterCtrlStaInfo_t *dstStaInfo); +void uf_prepare_send_cfm_list_for_queued_pkts(unifi_priv_t * priv, + struct list_head *frames_need_cfm_list, + struct list_head * list); +void send_auto_ma_packet_confirm(unifi_priv_t *priv, + netInterface_priv_t *interfacePriv, + struct list_head *buffered_frames_list); +void uf_flush_list(unifi_priv_t * priv, struct list_head * list); +void uf_flush_maPktlist(unifi_priv_t * priv, struct list_head * list); +tx_buffered_packets_t *dequeue_tx_data_pdu(unifi_priv_t *priv, struct list_head *txList); +void resume_unicast_buffered_frames(unifi_priv_t *priv, CsrUint16 interfaceTag); +void update_eosp_to_head_of_broadcast_list_head(unifi_priv_t *priv,CsrUint16 interfaceTag); +void resume_suspended_uapsd(unifi_priv_t* priv,CsrUint16 interfaceTag); +#endif +/* + * netdev.c + */ + +#ifndef P80211_OUI_LEN +#define P80211_OUI_LEN 3 +#endif +typedef struct { + u8 dsap; /* always 0xAA */ + u8 ssap; /* always 0xAA */ + u8 ctrl; /* always 0x03 */ + u8 oui[P80211_OUI_LEN]; /* organizational universal id */ + u16 protocol; +} __attribute__ ((packed)) llc_snap_hdr_t; +int skb_add_llc_snap(struct net_device *dev, struct sk_buff *skb, int proto); +int skb_80211_to_ether(unifi_priv_t *priv, struct sk_buff *skb, + const unsigned char *daddr, const unsigned char *saddr, + const CSR_SIGNAL *signal, + bulk_data_param_t *bulkdata); + +const char *result_code_str(int result); + + +/* prepares & appends the Mac header for the payload */ +int prepare_and_add_macheader(unifi_priv_t *priv, + struct sk_buff *skb, + struct sk_buff *newSkb, + CSR_PRIORITY priority, + bulk_data_param_t *bulkdata, + CsrUint16 interfaceTag, + const CsrUint8 *daddr, + const CsrUint8 *saddr, + CsrBool protection); +CSR_PRIORITY +get_packet_priority(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr *ehdr, netInterface_priv_t *interfacePriv); + +void +unifi_frame_ma_packet_req(unifi_priv_t *priv, CSR_PRIORITY priority, + CSR_RATE TransmitRate, CSR_CLIENT_TAG hostTag, + CsrUint16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl, + CSR_PROCESS_ID leSenderProcessId, CsrUint8 *peerMacAddress, + CSR_SIGNAL *signal); + + +/* Pack the LSB to include station handle & status of tim set */ +#define CSR_WIFI_PACK_SENDER_ID_LSB_FOR_TIM_REQ(handle, timState) ((handle << 2) | timState) +/* get the station record handle from the sender ID */ +#define CSR_WIFI_GET_STATION_HANDLE_FROM_RECEIVER_ID(receiverProcessId) (CsrUint8) ((receiverProcessId & 0xff) >> 2) +/* get the timSet status from the sender ID */ +#define CSR_WIFI_GET_TIMSET_STATE_FROM_RECEIVER_ID(receiverProcessId) (CsrUint8) (receiverProcessId & 0x03) + +/* handle is 6 bits to accomodate in senderId LSB (only 64 station can be associated) */ +#define CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE 0x3F + +void update_tim(unifi_priv_t * priv, CsrUint16 aid, CsrUint8 setTim, CsrUint16 interfaceTag, CsrUint32 handle); +void uf_handle_tim_cfm(unifi_priv_t *priv, CSR_MLME_SET_TIM_CONFIRM *cfm, CsrUint16 senderProcessId); + +/* Clear the Peer station Record, in case of wifioff/unexpected card removal */ +void CsrWifiRouterCtrlInterfaceReset(unifi_priv_t *priv, CsrUint16 interfaceTag); + +void scroll_ba_window(unifi_priv_t *priv, + netInterface_priv_t *interfacePriv, + ba_session_rx_struct *ba_session, + CsrUint16 sn); + +CsrBool blockack_session_stop(unifi_priv_t *priv, + CsrUint16 interfaceTag, + CsrWifiRouterCtrlBlockAckRole role, + CsrUint16 tID, + CsrWifiMacAddress macAddress); +#ifdef CSR_SUPPORT_SME +/* Fetch the protection information from interface Mode */ +CsrInt8 uf_get_protection_bit_from_interfacemode(unifi_priv_t *priv, CsrUint16 interfaceTag, const CsrUint8 *daddr); +#endif + +/* Fetch the station record handler from data base for matching Mac address */ +#ifdef CSR_SUPPORT_SME +CsrWifiRouterCtrlStaInfo_t *CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(unifi_priv_t *priv, + const CsrUint8 *peerMacAddress, + CsrUint16 interfaceTag); + +/* Fetch the station record handler from data base for matching handle */ +CsrWifiRouterCtrlStaInfo_t * CsrWifiRouterCtrlGetStationRecordFromHandle(unifi_priv_t *priv, + CsrUint32 handle, + CsrUint16 interfaceTag); + +void uf_update_sta_activity(unifi_priv_t *priv, CsrUint16 interfaceTag, const CsrUint8 *peerMacAddress); +void uf_process_ma_pkt_cfm_for_ap(unifi_priv_t *priv,CsrUint16 interfaceTag, const CSR_MA_PACKET_CONFIRM *pkt_cfm); +#endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) +int uf_install_qdisc(struct net_device *dev); +#endif + +void uf_resume_data_plane(unifi_priv_t *priv, int queue, + CsrWifiMacAddress peer_address, + CsrUint16 interfaceTag); +void uf_free_pending_rx_packets(unifi_priv_t *priv, int queue, + CsrWifiMacAddress peer_address,CsrUint16 interfaceTag); + +int uf_register_netdev(unifi_priv_t *priv, int numOfInterface); +void uf_unregister_netdev(unifi_priv_t *priv); + +void uf_net_get_name(struct net_device *dev, char *name, int len); + +void uf_send_queue_info(unifi_priv_t *priv); +CsrUint16 uf_get_vif_identifier(CsrWifiRouterCtrlMode mode, CsrUint16 tag); + +void uf_process_rx_pending_queue(unifi_priv_t *priv, int queue, + CsrWifiMacAddress source_address, + int indicate, CsrUint16 interfaceTag); + +/* + * inet.c + */ +void uf_register_inet_notifier(void); +void uf_unregister_inet_notifier(void); + + +/* + * Suspend / Resume handlers + */ +void unifi_resume(void *ospriv); +void unifi_suspend(void *ospriv); + + +#define QOS_CAPABILITY_WMM_ENABLED 0x0001 +#define QOS_CAPABILITY_WMM_UAPSD 0x0002 +#define QOS_CAPABILITY_ACM_BE_ENABLED 0x0010 +#define QOS_CAPABILITY_ACM_BK_ENABLED 0x0020 +#define QOS_CAPABILITY_ACM_VI_ENABLED 0x0040 +#define QOS_CAPABILITY_ACM_VO_ENABLED 0x0080 +#define QOS_CAPABILITY_TS_BE_ENABLED 0x0100 +#define QOS_CAPABILITY_TS_BK_ENABLED 0x0200 +#define QOS_CAPABILITY_TS_VI_ENABLED 0x0400 +#define QOS_CAPABILITY_TS_VO_ENABLED 0x0800 + + +/* EAPOL PDUS */ +#ifndef ETH_P_PAE +#define ETH_P_PAE 0x888e +#endif +#ifndef ETH_P_WAI +#define ETH_P_WAI 0x88b4 +#endif +/* + * unifi_dbg.c + */ +void debug_string_indication(unifi_priv_t *priv, + const unsigned char *extra, + unsigned int extralen); +void debug_word16_indication(unifi_priv_t *priv, const CSR_SIGNAL *sigptr); +void debug_generic_indication(unifi_priv_t *priv, const CSR_SIGNAL *sigptr); + + +/* + * putest.c + */ +int unifi_putest_start(unifi_priv_t *priv, unsigned char *arg); +int unifi_putest_cmd52_block_read(unifi_priv_t *priv, unsigned char *arg); +int unifi_putest_stop(unifi_priv_t *priv, unsigned char *arg); +int unifi_putest_set_sdio_clock(unifi_priv_t *priv, unsigned char *arg); +int unifi_putest_cmd52_read(unifi_priv_t *priv, unsigned char *arg); +int unifi_putest_coredump_prepare(unifi_priv_t *priv, unsigned char *arg); +int unifi_putest_cmd52_write(unifi_priv_t *priv, unsigned char *arg); +int unifi_putest_gp_read16(unifi_priv_t *priv, unsigned char *arg); +int unifi_putest_gp_write16(unifi_priv_t *priv, unsigned char *arg); + +int unifi_putest_dl_fw(unifi_priv_t *priv, unsigned char *arg); +int unifi_putest_dl_fw_buff(unifi_priv_t *priv, unsigned char *arg); + + +/* Macro for formatting a MAC address with a prefix string */ +#define UF_TRACE_MAC(priv, lvl, msg, addr) \ + unifi_trace(priv, lvl, \ + "%s %02x-%02x-%02x-%02x-%02x-%02x\n", \ + msg, \ + *(((CsrUint8 *)addr)+0), \ + *(((CsrUint8 *)addr)+1), \ + *(((CsrUint8 *)addr)+2), \ + *(((CsrUint8 *)addr)+3), \ + *(((CsrUint8 *)addr)+4), \ + *(((CsrUint8 *)addr)+5)) + +#endif /* __LINUX_UNIFI_PRIV_H__ */ diff --git a/drivers/staging/csr/unifi_sme.c b/drivers/staging/csr/unifi_sme.c new file mode 100644 index 0000000..4ee663f --- /dev/null +++ b/drivers/staging/csr/unifi_sme.c @@ -0,0 +1,1164 @@ +/* + * *************************************************************************** + * FILE: unifi_sme.c + * + * PURPOSE: SME related functions. + * + * Copyright (C) 2007-2009 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * *************************************************************************** + */ + +#include "unifi_priv.h" +#include "csr_wifi_hip_unifi.h" +#include "csr_wifi_hip_conversions.h" + + + + + int +convert_sme_error(CsrResult error) +{ + switch (error) { + case CSR_RESULT_SUCCESS: + return 0; + case CSR_RESULT_FAILURE: + case CSR_WIFI_RESULT_NOT_FOUND: + case CSR_WIFI_RESULT_TIMED_OUT: + case CSR_WIFI_RESULT_CANCELLED: + case CSR_WIFI_RESULT_UNAVAILABLE: + return -EIO; + case CSR_WIFI_RESULT_NO_ROOM: + return -EBUSY; + case CSR_WIFI_RESULT_INVALID_PARAMETER: + return -EINVAL; + case CSR_WIFI_RESULT_UNSUPPORTED: + return -EOPNOTSUPP; + default: + return -EIO; + } +} + + +/* + * --------------------------------------------------------------------------- + * sme_log_event + * + * Callback function to be registered as the SME event callback. + * Copies the signal content into a new udi_log_t struct and adds + * it to the read queue for the SME client. + * + * Arguments: + * arg This is the value given to unifi_add_udi_hook, in + * this case a pointer to the client instance. + * signal Pointer to the received signal. + * signal_len Size of the signal structure in bytes. + * bulkdata Pointers to any associated bulk data. + * dir Direction of the signal. Zero means from host, + * non-zero means to host. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ + void +sme_log_event(ul_client_t *pcli, + const u8 *signal, int signal_len, + const bulk_data_param_t *bulkdata, + int dir) +{ + unifi_priv_t *priv; + CSR_SIGNAL unpacked_signal; + CsrWifiSmeDataBlock mlmeCommand; + CsrWifiSmeDataBlock dataref1; + CsrWifiSmeDataBlock dataref2; + CsrResult result = CSR_RESULT_SUCCESS; + int r; + + /* Following bits are encoded in hostTag These are there to ensure that hostTags are unique*/ +#define CSR_SME_DATA 0x00000000 /* Frames Sent by SME */ +#define CSR_PAL_DATA 0X10000000 /* Frames Sent by PAL-D*/ +#define CSR_NME_DATA 0x20000000 /* Frames Sent by NME*/ +#define APPLICATION_DATA 0x30000000 /* Frames Sent by Application*/ + + func_enter(); + /* Just a sanity check */ + if ((signal == NULL) || (signal_len <= 0)) { + func_exit(); + return; + } + + priv = uf_find_instance(pcli->instance); + if (!priv) { + unifi_error(priv, "sme_log_event: invalid priv\n"); + func_exit(); + return; + } + + if (priv->smepriv == NULL) { + unifi_error(priv, "sme_log_event: invalid smepriv\n"); + func_exit(); + return; + } + + unifi_trace(priv, UDBG3, + "sme_log_event: Process signal 0x%.4X\n", + CSR_GET_UINT16_FROM_LITTLE_ENDIAN(signal)); + + + /* If the signal is known, then do any filtering required, otherwise it pass it to the SME. */ + r = read_unpack_signal(signal, &unpacked_signal); + if (r == CSR_RESULT_SUCCESS) { + if ((unpacked_signal.SignalPrimitiveHeader.SignalId == CSR_DEBUG_STRING_INDICATION_ID) || + (unpacked_signal.SignalPrimitiveHeader.SignalId == CSR_DEBUG_WORD16_INDICATION_ID)) + { + func_exit(); + return; + } + if (unpacked_signal.SignalPrimitiveHeader.SignalId == CSR_MA_PACKET_INDICATION_ID) + { + CsrUint16 frmCtrl; + CsrBool unicastPdu = TRUE; + CsrUint8 *macHdrLocation; + CsrUint8 *raddr = NULL, *taddr = NULL; + CsrWifiMacAddress peerMacAddress; + /* Check if we need to send CsrWifiRouterCtrlMicFailureInd*/ + CSR_MA_PACKET_INDICATION *ind = &unpacked_signal.u.MaPacketIndication; + + macHdrLocation = (CsrUint8 *) bulkdata->d[0].os_data_ptr; + /* Fetch the frame control value from mac header */ + frmCtrl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(macHdrLocation); + + /* Point to the addresses */ + raddr = macHdrLocation + MAC_HEADER_ADDR1_OFFSET; + taddr = macHdrLocation + MAC_HEADER_ADDR2_OFFSET; + + CsrMemCpy(peerMacAddress.a, taddr, ETH_ALEN); + + if(ind->ReceptionStatus == CSR_MICHAEL_MIC_ERROR) + { + if (*raddr & 0x1) + unicastPdu = FALSE; + + CsrWifiRouterCtrlMicFailureIndSend (priv->CSR_WIFI_SME_IFACEQUEUE, 0, + (ind->VirtualInterfaceIdentifier & 0xff),peerMacAddress, + unicastPdu); + return; + } + else + { + if(ind->ReceptionStatus == CSR_RX_SUCCESS) + { + CsrUint8 pmBit = (frmCtrl & 0x1000)?0x01:0x00; + CsrUint16 interfaceTag = (ind->VirtualInterfaceIdentifier & 0xff); + CsrWifiRouterCtrlStaInfo_t *srcStaInfo = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv,taddr,interfaceTag); + if((srcStaInfo != NULL) && (uf_check_broadcast_bssid(priv, bulkdata)== FALSE)) + { + uf_process_pm_bit_for_peer(priv,srcStaInfo,pmBit,interfaceTag); + + /* Update station last activity flag */ + srcStaInfo->activity_flag = TRUE; + } + } + } + } + + if (unpacked_signal.SignalPrimitiveHeader.SignalId == CSR_MA_PACKET_CONFIRM_ID) + { + CSR_MA_PACKET_CONFIRM *cfm = &unpacked_signal.u.MaPacketConfirm; + CsrUint16 interfaceTag = (cfm->VirtualInterfaceIdentifier & 0xff); + netInterface_priv_t *interfacePriv; + CSR_MA_PACKET_REQUEST *req; + CsrWifiMacAddress peerMacAddress; + + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) + { + unifi_error(priv, "Bad MA_PACKET_CONFIRM interfaceTag %d\n", interfaceTag); + func_exit(); + return; + } + + unifi_trace(priv,UDBG1,"MA-PACKET Confirm (%x, %x)\n", cfm->HostTag, cfm->TransmissionStatus); + + interfacePriv = priv->interfacePriv[interfaceTag]; +#ifdef CSR_SUPPORT_SME + if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || + interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { + + if(cfm->HostTag == interfacePriv->multicastPduHostTag){ + uf_process_ma_pkt_cfm_for_ap(priv ,interfaceTag, cfm); + } + } +#endif + + req = &interfacePriv->m4_signal.u.MaPacketRequest; + + if(cfm->HostTag & 0x80000000) + { + if (cfm->TransmissionStatus != CSR_TX_SUCCESSFUL) + { + result = CSR_RESULT_FAILURE; + } +#ifdef CSR_SUPPORT_SME + memcpy(peerMacAddress.a, req->Ra.x, ETH_ALEN); + /* Check if this is a confirm for EAPOL M4 frame and we need to send transmistted ind*/ + if (interfacePriv->m4_sent && (cfm->HostTag == interfacePriv->m4_hostTag)) + { + unifi_trace(priv, UDBG1, "%s: Sending M4 Transmit CFM\n", __FUNCTION__); + CsrWifiRouterCtrlM4TransmittedIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, + interfaceTag, + peerMacAddress, + result); + interfacePriv->m4_sent = FALSE; + interfacePriv->m4_hostTag = 0xffffffff; + } +#endif + /* If EAPOL was requested via router APIs then send cfm else ignore*/ + if((cfm->HostTag & 0x80000000) != CSR_WIFI_EAPOL_M4_HOST_TAG) { + CsrWifiRouterMaPacketCfmSend((CsrUint16)signal[2], + cfm->VirtualInterfaceIdentifier, + result, + (cfm->HostTag & 0x3fffffff), cfm->Rate); + } else { + unifi_trace(priv, UDBG1, "%s: M4 received from netdevice\n", __FUNCTION__); + } + func_exit(); + return; + } + } + } + + mlmeCommand.length = signal_len; + mlmeCommand.data = (CsrUint8*)signal; + + dataref1.length = bulkdata->d[0].data_length; + if (dataref1.length > 0) { + dataref1.data = (CsrUint8 *) bulkdata->d[0].os_data_ptr; + } else + { + dataref1.data = NULL; + } + + dataref2.length = bulkdata->d[1].data_length; + if (dataref2.length > 0) { + dataref2.data = (CsrUint8 *) bulkdata->d[1].os_data_ptr; + } else + { + dataref2.data = NULL; + } + + CsrWifiRouterCtrlHipIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, mlmeCommand.length, mlmeCommand.data, + dataref1.length, dataref1.data, + dataref2.length, dataref2.data); + + func_exit(); +} /* sme_log_event() */ + + +/* + * --------------------------------------------------------------------------- + * uf_sme_port_state + * + * Return the state of the controlled port. + * + * Arguments: + * priv Pointer to device private context struct + * address Pointer to the destination for tx or sender for rx address + * queue Controlled or uncontrolled queue + * + * Returns: + * An unifi_ControlledPortAction value. + * --------------------------------------------------------------------------- + */ +CsrWifiRouterCtrlPortAction +uf_sme_port_state(unifi_priv_t *priv, unsigned char *address, int queue, CsrUint16 interfaceTag) +{ + int i; + unifi_port_config_t *port; + netInterface_priv_t *interfacePriv; + + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "uf_sme_port_state: bad interfaceTag\n"); + return CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD; + } + + interfacePriv = priv->interfacePriv[interfaceTag]; + + if (queue == UF_CONTROLLED_PORT_Q) { + port = &interfacePriv->controlled_data_port; + } else { + port = &interfacePriv->uncontrolled_data_port; + } + + if (!port->entries_in_use) { + unifi_trace(priv, UDBG5, "No port configurations, return Discard.\n"); + return CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD; + } + + /* If the port configuration is common for all destinations, return it. */ + if (port->overide_action == UF_DATA_PORT_OVERIDE) { + unifi_trace(priv, UDBG5, "Single port configuration (%d).\n", + port->port_cfg[0].port_action); + return port->port_cfg[0].port_action; + } + + unifi_trace(priv, UDBG5, "Multiple (%d) port configurations.\n", port->entries_in_use); + + /* If multiple configurations exist.. */ + for (i = 0; i < UNIFI_MAX_CONNECTIONS; i++) { + /* .. go through the list and match the destination address. */ + if (port->port_cfg[i].in_use && + memcmp(address, port->port_cfg[i].mac_address.a, ETH_ALEN) == 0) { + /* Return the desired action. */ + return port->port_cfg[i].port_action; + } + } + + /* Could not find any information, return Open. */ + unifi_trace(priv, UDBG5, "port configuration not found, return Open.\n"); + return CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN; +} /* uf_sme_port_state() */ + +/* + * --------------------------------------------------------------------------- + * uf_sme_port_config_handle + * + * Return the port config handle of the controlled/uncontrolled port. + * + * Arguments: + * priv Pointer to device private context struct + * address Pointer to the destination for tx or sender for rx address + * queue Controlled or uncontrolled queue + * + * Returns: + * An unifi_port_cfg_t* . + * --------------------------------------------------------------------------- + */ +unifi_port_cfg_t* +uf_sme_port_config_handle(unifi_priv_t *priv, unsigned char *address, int queue, CsrUint16 interfaceTag) +{ + int i; + unifi_port_config_t *port; + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "uf_sme_port_config_handle: bad interfaceTag\n"); + return NULL; + } + + if (queue == UF_CONTROLLED_PORT_Q) { + port = &interfacePriv->controlled_data_port; + } else { + port = &interfacePriv->uncontrolled_data_port; + } + + if (!port->entries_in_use) { + unifi_trace(priv, UDBG5, "No port configurations, return Discard.\n"); + return NULL; + } + + /* If the port configuration is common for all destinations, return it. */ + if (port->overide_action == UF_DATA_PORT_OVERIDE) { + unifi_trace(priv, UDBG5, "Single port configuration (%d).\n", + port->port_cfg[0].port_action); + if (address) { + unifi_trace(priv, UDBG5, "addr[0] = %x, addr[1] = %x, addr[2] = %x, addr[3] = %x\n", address[0], address[1], address[2], address[3]); + } + return &port->port_cfg[0]; + } + + unifi_trace(priv, UDBG5, "Multiple port configurations.\n"); + + /* If multiple configurations exist.. */ + for (i = 0; i < UNIFI_MAX_CONNECTIONS; i++) { + /* .. go through the list and match the destination address. */ + if (port->port_cfg[i].in_use && + memcmp(address, port->port_cfg[i].mac_address.a, ETH_ALEN) == 0) { + /* Return the desired action. */ + return &port->port_cfg[i]; + } + } + + /* Could not find any information, return Open. */ + unifi_trace(priv, UDBG5, "port configuration not found, returning NULL (debug).\n"); + return NULL; +} /* uf_sme_port_config_handle */ + +void +uf_multicast_list_wq(struct work_struct *work) +{ + unifi_priv_t *priv = container_of(work, unifi_priv_t, + multicast_list_task); + int i; + CsrUint16 interfaceTag = 0; + CsrWifiMacAddress* multicast_address_list = NULL; + int mc_count; + u8 *mc_list; + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "uf_multicast_list_wq: bad interfaceTag\n"); + return; + } + + unifi_trace(priv, UDBG5, + "uf_multicast_list_wq: list count = %d\n", + interfacePriv->mc_list_count); + + /* Flush the current list */ + CsrWifiRouterCtrlMulticastAddressIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,0, interfaceTag, CSR_WIFI_SME_LIST_ACTION_FLUSH, 0, NULL); + + mc_count = interfacePriv->mc_list_count; + mc_list = interfacePriv->mc_list; + /* + * Allocate a new list, need to free it later + * in unifi_mgt_multicast_address_cfm(). + */ + multicast_address_list = CsrPmemAlloc(mc_count * sizeof(CsrWifiMacAddress)); + + if (multicast_address_list == NULL) { + return; + } + + for (i = 0; i < mc_count; i++) { + memcpy(multicast_address_list[i].a, mc_list, ETH_ALEN); + mc_list += ETH_ALEN; + } + + if (priv->smepriv == NULL) { + CsrPmemFree(multicast_address_list); + return; + } + + CsrWifiRouterCtrlMulticastAddressIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,0, + interfaceTag, + CSR_WIFI_SME_LIST_ACTION_ADD, + mc_count, multicast_address_list); + + /* The SME will take a copy of the addreses*/ + CsrPmemFree(multicast_address_list); +} + + +int unifi_cfg_power(unifi_priv_t *priv, unsigned char *arg) +{ + unifi_cfg_power_t cfg_power; + int rc; + + if (get_user(cfg_power, (unifi_cfg_power_t*)(((unifi_cfg_command_t*)arg) + 1))) { + unifi_error(priv, "UNIFI_CFG: Failed to get the argument\n"); + return -EFAULT; + } + + switch (cfg_power) { + case UNIFI_CFG_POWER_OFF: + rc = sme_sys_suspend(priv); + if (rc) { + return rc; + } + break; + case UNIFI_CFG_POWER_ON: + rc = sme_sys_resume(priv); + if (rc) { + return rc; + } + break; + default: + unifi_error(priv, "WIFI POWER: Unknown value.\n"); + return -EINVAL; + } + + return 0; +} + + +int unifi_cfg_power_save(unifi_priv_t *priv, unsigned char *arg) +{ + unifi_cfg_powersave_t cfg_power_save; + CsrWifiSmePowerConfig powerConfig; + int rc; + + if (get_user(cfg_power_save, (unifi_cfg_powersave_t*)(((unifi_cfg_command_t*)arg) + 1))) { + unifi_error(priv, "UNIFI_CFG: Failed to get the argument\n"); + return -EFAULT; + } + + /* Get the coex info from the SME */ + rc = sme_mgt_power_config_get(priv, &powerConfig); + if (rc) { + unifi_error(priv, "UNIFI_CFG: Get unifi_PowerConfigValue failed.\n"); + return rc; + } + + switch (cfg_power_save) { + case UNIFI_CFG_POWERSAVE_NONE: + powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW; + break; + case UNIFI_CFG_POWERSAVE_FAST: + powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_MED; + break; + case UNIFI_CFG_POWERSAVE_FULL: + powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_HIGH; + break; + case UNIFI_CFG_POWERSAVE_AUTO: + powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_AUTO; + break; + default: + unifi_error(priv, "POWERSAVE: Unknown value.\n"); + return -EINVAL; + } + + rc = sme_mgt_power_config_set(priv, &powerConfig); + + if (rc) { + unifi_error(priv, "UNIFI_CFG: Set unifi_PowerConfigValue failed.\n"); + } + + return rc; +} + + +int unifi_cfg_power_supply(unifi_priv_t *priv, unsigned char *arg) +{ + unifi_cfg_powersupply_t cfg_power_supply; + CsrWifiSmeHostConfig hostConfig; + int rc; + + if (get_user(cfg_power_supply, (unifi_cfg_powersupply_t*)(((unifi_cfg_command_t*)arg) + 1))) { + unifi_error(priv, "UNIFI_CFG: Failed to get the argument\n"); + return -EFAULT; + } + + /* Get the coex info from the SME */ + rc = sme_mgt_host_config_get(priv, &hostConfig); + if (rc) { + unifi_error(priv, "UNIFI_CFG: Get unifi_HostConfigValue failed.\n"); + return rc; + } + + switch (cfg_power_supply) { + case UNIFI_CFG_POWERSUPPLY_MAINS: + hostConfig.powerMode = CSR_WIFI_SME_HOST_POWER_MODE_ACTIVE; + break; + case UNIFI_CFG_POWERSUPPLY_BATTERIES: + hostConfig.powerMode = CSR_WIFI_SME_HOST_POWER_MODE_POWER_SAVE; + break; + default: + unifi_error(priv, "POWERSUPPLY: Unknown value.\n"); + return -EINVAL; + } + + rc = sme_mgt_host_config_set(priv, &hostConfig); + if (rc) { + unifi_error(priv, "UNIFI_CFG: Set unifi_HostConfigValue failed.\n"); + } + + return rc; +} + + +int unifi_cfg_packet_filters(unifi_priv_t *priv, unsigned char *arg) +{ + unsigned char *tclas_buffer; + unsigned int tclas_buffer_length; + tclas_t *dhcp_tclas; + int rc; + + /* Free any TCLASs previously allocated */ + if (priv->packet_filters.tclas_ies_length) { + CsrPmemFree(priv->filter_tclas_ies); + priv->filter_tclas_ies = NULL; + } + + tclas_buffer = ((unsigned char*)arg) + sizeof(unifi_cfg_command_t) + sizeof(unsigned int); + if (copy_from_user(&priv->packet_filters, (void*)tclas_buffer, + sizeof(uf_cfg_bcast_packet_filter_t))) { + unifi_error(priv, "UNIFI_CFG: Failed to get the filter struct\n"); + return -EFAULT; + } + + tclas_buffer_length = priv->packet_filters.tclas_ies_length; + + /* Allocate TCLASs if necessary */ + if (priv->packet_filters.dhcp_filter) { + priv->packet_filters.tclas_ies_length += sizeof(tclas_t); + } + if (priv->packet_filters.tclas_ies_length > 0) { + priv->filter_tclas_ies = CsrPmemAlloc(priv->packet_filters.tclas_ies_length); + if (priv->filter_tclas_ies == NULL) { + return -ENOMEM; + } + if (tclas_buffer_length) { + tclas_buffer += sizeof(uf_cfg_bcast_packet_filter_t) - sizeof(unsigned char*); + if (copy_from_user(priv->filter_tclas_ies, + tclas_buffer, + tclas_buffer_length)) { + unifi_error(priv, "UNIFI_CFG: Failed to get the TCLAS buffer\n"); + return -EFAULT; + } + } + } + + if(priv->packet_filters.dhcp_filter) + { + /* Append the DHCP tclas IE */ + dhcp_tclas = (tclas_t*)(priv->filter_tclas_ies + tclas_buffer_length); + memset(dhcp_tclas, 0, sizeof(tclas_t)); + dhcp_tclas->element_id = 14; + dhcp_tclas->length = sizeof(tcpip_clsfr_t) + 1; + dhcp_tclas->user_priority = 0; + dhcp_tclas->tcp_ip_cls_fr.cls_fr_type = 1; + dhcp_tclas->tcp_ip_cls_fr.version = 4; + ((CsrUint8*)(&dhcp_tclas->tcp_ip_cls_fr.source_port))[0] = 0x00; + ((CsrUint8*)(&dhcp_tclas->tcp_ip_cls_fr.source_port))[1] = 0x44; + ((CsrUint8*)(&dhcp_tclas->tcp_ip_cls_fr.dest_port))[0] = 0x00; + ((CsrUint8*)(&dhcp_tclas->tcp_ip_cls_fr.dest_port))[1] = 0x43; + dhcp_tclas->tcp_ip_cls_fr.protocol = 0x11; + dhcp_tclas->tcp_ip_cls_fr.cls_fr_mask = 0x58; //bits: 3,4,6 + } + + rc = sme_mgt_packet_filter_set(priv); + + return rc; +} + + +int unifi_cfg_wmm_qos_info(unifi_priv_t *priv, unsigned char *arg) +{ + CsrUint8 wmm_qos_info; + int rc = 0; + + if (get_user(wmm_qos_info, (CsrUint8*)(((unifi_cfg_command_t*)arg) + 1))) { + unifi_error(priv, "UNIFI_CFG: Failed to get the argument\n"); + return -EFAULT; + } + + /* Store the value in the connection info */ + priv->connection_config.wmmQosInfo = wmm_qos_info; + + return rc; +} + + +int unifi_cfg_wmm_addts(unifi_priv_t *priv, unsigned char *arg) +{ + CsrUint32 addts_tid; + CsrUint8 addts_ie_length; + CsrUint8 *addts_ie; + CsrUint8 *addts_params; + CsrWifiSmeDataBlock tspec; + CsrWifiSmeDataBlock tclas; + int rc; + + addts_params = (CsrUint8*)(((unifi_cfg_command_t*)arg) + 1); + if (get_user(addts_tid, (CsrUint32*)addts_params)) { + unifi_error(priv, "unifi_cfg_wmm_addts: Failed to get the argument\n"); + return -EFAULT; + } + + addts_params += sizeof(CsrUint32); + if (get_user(addts_ie_length, (CsrUint8*)addts_params)) { + unifi_error(priv, "unifi_cfg_wmm_addts: Failed to get the argument\n"); + return -EFAULT; + } + + unifi_trace(priv, UDBG4, "addts: tid = 0x%x ie_length = %d\n", + addts_tid, addts_ie_length); + + addts_ie = CsrPmemAlloc(addts_ie_length); + if (addts_ie == NULL) { + unifi_error(priv, + "unifi_cfg_wmm_addts: Failed to malloc %d bytes for addts_ie buffer\n", + addts_ie_length); + return -ENOMEM; + } + + addts_params += sizeof(CsrUint8); + rc = copy_from_user(addts_ie, addts_params, addts_ie_length); + if (rc) { + unifi_error(priv, "unifi_cfg_wmm_addts: Failed to get the addts buffer\n"); + CsrPmemFree(addts_ie); + return -EFAULT; + } + + tspec.data = addts_ie; + tspec.length = addts_ie_length; + tclas.data = NULL; + tclas.length = 0; + + rc = sme_mgt_tspec(priv, CSR_WIFI_SME_LIST_ACTION_ADD, addts_tid, + &tspec, &tclas); + + CsrPmemFree(addts_ie); + return rc; +} + + +int unifi_cfg_wmm_delts(unifi_priv_t *priv, unsigned char *arg) +{ + CsrUint32 delts_tid; + CsrUint8 *delts_params; + CsrWifiSmeDataBlock tspec; + CsrWifiSmeDataBlock tclas; + int rc; + + delts_params = (CsrUint8*)(((unifi_cfg_command_t*)arg) + 1); + if (get_user(delts_tid, (CsrUint32*)delts_params)) { + unifi_error(priv, "unifi_cfg_wmm_delts: Failed to get the argument\n"); + return -EFAULT; + } + + unifi_trace(priv, UDBG4, "delts: tid = 0x%x\n", delts_tid); + + tspec.data = tclas.data = NULL; + tspec.length = tclas.length = 0; + + rc = sme_mgt_tspec(priv, CSR_WIFI_SME_LIST_ACTION_REMOVE, delts_tid, + &tspec, &tclas); + + return rc; +} + +int unifi_cfg_strict_draft_n(unifi_priv_t *priv, unsigned char *arg) +{ + CsrBool strict_draft_n; + CsrUint8 *strict_draft_n_params; + int rc; + + CsrWifiSmeStaConfig staConfig; + CsrWifiSmeDeviceConfig deviceConfig; + + strict_draft_n_params = (CsrUint8*)(((unifi_cfg_command_t*)arg) + 1); + if (get_user(strict_draft_n, (CsrBool*)strict_draft_n_params)) { + unifi_error(priv, "unifi_cfg_strict_draft_n: Failed to get the argument\n"); + return -EFAULT; + } + + unifi_trace(priv, UDBG4, "strict_draft_n: = %s\n", ((strict_draft_n) ? "yes":"no")); + + rc = sme_mgt_sme_config_get(priv, &staConfig, &deviceConfig); + + if (rc) { + unifi_warning(priv, "unifi_cfg_strict_draft_n: Get unifi_SMEConfigValue failed.\n"); + return -EFAULT; + } + + deviceConfig.enableStrictDraftN = strict_draft_n; + + rc = sme_mgt_sme_config_set(priv, &staConfig, &deviceConfig); + if (rc) { + unifi_warning(priv, "unifi_cfg_strict_draft_n: Set unifi_SMEConfigValue failed.\n"); + rc = -EFAULT; + } + + return rc; +} + + +int unifi_cfg_enable_okc(unifi_priv_t *priv, unsigned char *arg) +{ + CsrBool enable_okc; + CsrUint8 *enable_okc_params; + int rc; + + CsrWifiSmeStaConfig staConfig; + CsrWifiSmeDeviceConfig deviceConfig; + + enable_okc_params = (CsrUint8*)(((unifi_cfg_command_t*)arg) + 1); + if (get_user(enable_okc, (CsrBool*)enable_okc_params)) { + unifi_error(priv, "unifi_cfg_enable_okc: Failed to get the argument\n"); + return -EFAULT; + } + + unifi_trace(priv, UDBG4, "enable_okc: = %s\n", ((enable_okc) ? "yes":"no")); + + rc = sme_mgt_sme_config_get(priv, &staConfig, &deviceConfig); + if (rc) { + unifi_warning(priv, "unifi_cfg_enable_okc: Get unifi_SMEConfigValue failed.\n"); + return -EFAULT; + } + + staConfig.enableOpportunisticKeyCaching = enable_okc; + + rc = sme_mgt_sme_config_set(priv, &staConfig, &deviceConfig); + if (rc) { + unifi_warning(priv, "unifi_cfg_enable_okc: Set unifi_SMEConfigValue failed.\n"); + rc = -EFAULT; + } + + return rc; +} + + +int unifi_cfg_get_info(unifi_priv_t *priv, unsigned char *arg) +{ + unifi_cfg_get_t get_cmd; + char inst_name[IFNAMSIZ]; + int rc; + + if (get_user(get_cmd, (unifi_cfg_get_t*)(((unifi_cfg_command_t*)arg) + 1))) { + unifi_error(priv, "UNIFI_CFG: Failed to get the argument\n"); + return -EFAULT; + } + + switch (get_cmd) { + case UNIFI_CFG_GET_COEX: + { + CsrWifiSmeCoexInfo coexInfo; + /* Get the coex info from the SME */ + rc = sme_mgt_coex_info_get(priv, &coexInfo); + if (rc) { + unifi_error(priv, "UNIFI_CFG: Get unifi_CoexInfoValue failed.\n"); + return rc; + } + + /* Copy the info to the out buffer */ + if (copy_to_user((void*)arg, + &coexInfo, + sizeof(CsrWifiSmeCoexInfo))) { + unifi_error(priv, "UNIFI_CFG: Failed to copy the coex info\n"); + return -EFAULT; + } + break; + } + case UNIFI_CFG_GET_POWER_MODE: + { + CsrWifiSmePowerConfig powerConfig; + rc = sme_mgt_power_config_get(priv, &powerConfig); + if (rc) { + unifi_error(priv, "UNIFI_CFG: Get unifi_PowerConfigValue failed.\n"); + return rc; + } + + /* Copy the info to the out buffer */ + if (copy_to_user((void*)arg, + &powerConfig.powerSaveLevel, + sizeof(CsrWifiSmePowerSaveLevel))) { + unifi_error(priv, "UNIFI_CFG: Failed to copy the power save info\n"); + return -EFAULT; + } + break; + } + case UNIFI_CFG_GET_POWER_SUPPLY: + { + CsrWifiSmeHostConfig hostConfig; + rc = sme_mgt_host_config_get(priv, &hostConfig); + if (rc) { + unifi_error(priv, "UNIFI_CFG: Get unifi_HostConfigValue failed.\n"); + return rc; + } + + /* Copy the info to the out buffer */ + if (copy_to_user((void*)arg, + &hostConfig.powerMode, + sizeof(CsrWifiSmeHostPowerMode))) { + unifi_error(priv, "UNIFI_CFG: Failed to copy the host power mode\n"); + return -EFAULT; + } + break; + } + case UNIFI_CFG_GET_VERSIONS: + break; + case UNIFI_CFG_GET_INSTANCE: + { + CsrUint16 InterfaceId=0; + uf_net_get_name(priv->netdev[InterfaceId], &inst_name[0], sizeof(inst_name)); + + /* Copy the info to the out buffer */ + if (copy_to_user((void*)arg, + &inst_name[0], + sizeof(inst_name))) { + unifi_error(priv, "UNIFI_CFG: Failed to copy the instance name\n"); + return -EFAULT; + } + } + break; + + case UNIFI_CFG_GET_AP_CONFIG: + { +#ifdef CSR_SUPPORT_WEXT_AP + uf_cfg_ap_config_t cfg_ap_config; + cfg_ap_config.channel = priv->ap_config.channel; + cfg_ap_config.beaconInterval = priv->ap_mac_config.beaconInterval; + cfg_ap_config.wmmEnabled = priv->ap_mac_config.wmmEnabled; + cfg_ap_config.dtimPeriod = priv->ap_mac_config.dtimPeriod; + cfg_ap_config.phySupportedBitmap = priv->ap_mac_config.phySupportedBitmap; + if (copy_to_user((void*)arg, + &cfg_ap_config, + sizeof(uf_cfg_ap_config_t))) { + unifi_error(priv, "UNIFI_CFG: Failed to copy the AP configuration\n"); + return -EFAULT; + } +#else + return -EPERM; +#endif + } + break; + + + default: + unifi_error(priv, "unifi_cfg_get_info: Unknown value.\n"); + return -EINVAL; + } + + return 0; +} +#ifdef CSR_SUPPORT_WEXT_AP +int + uf_configure_supported_rates(CsrUint8 * supportedRates, CsrUint8 phySupportedBitmap) +{ + int i=0; + CsrBool b=FALSE, g = FALSE, n = FALSE; + b = phySupportedBitmap & CSR_WIFI_SME_AP_PHY_SUPPORT_B; + n = phySupportedBitmap & CSR_WIFI_SME_AP_PHY_SUPPORT_N; + g = phySupportedBitmap & CSR_WIFI_SME_AP_PHY_SUPPORT_G; + if(b || g) { + supportedRates[i++]=0x82; + supportedRates[i++]=0x84; + supportedRates[i++]=0x8b; + supportedRates[i++]=0x96; + } else if(n) { + supportedRates[i++]=0x02; + supportedRates[i++]=0x04; + supportedRates[i++]=0x0b; + supportedRates[i++]=0x16; + } + if(g) { + if(!b) { + supportedRates[i++]=0x8c; + supportedRates[i++]=0x98; + supportedRates[i++]=0xb0; + } else { + supportedRates[i++]=0x0c; + supportedRates[i++]=0x18; + supportedRates[i++]=0x30; + } + supportedRates[i++]=0x48; + supportedRates[i++]=0x12; + supportedRates[i++]=0x24; + supportedRates[i++]=0x60; + supportedRates[i++]=0x6c; + } + return i; +} +int unifi_cfg_set_ap_config(unifi_priv_t * priv,unsigned char* arg) +{ + uf_cfg_ap_config_t cfg_ap_config; + char *buffer; + + buffer = ((unsigned char*)arg) + sizeof(unifi_cfg_command_t) + sizeof(unsigned int); + if (copy_from_user(&cfg_ap_config, (void*)buffer, + sizeof(uf_cfg_ap_config_t))) { + unifi_error(priv, "UNIFI_CFG: Failed to get the ap config struct\n"); + return -EFAULT; + } + priv->ap_config.channel = cfg_ap_config.channel; + priv->ap_mac_config.dtimPeriod = cfg_ap_config.dtimPeriod; + priv->ap_mac_config.beaconInterval = cfg_ap_config.beaconInterval; + priv->group_sec_config.apGroupkeyTimeout = cfg_ap_config.groupkeyTimeout; + priv->group_sec_config.apStrictGtkRekey = cfg_ap_config.strictGtkRekeyEnabled; + priv->group_sec_config.apGmkTimeout = cfg_ap_config.gmkTimeout; + priv->group_sec_config.apResponseTimeout = cfg_ap_config.responseTimeout; + priv->group_sec_config.apRetransLimit = cfg_ap_config.retransLimit; + + priv->ap_mac_config.shortSlotTimeEnabled = cfg_ap_config.shortSlotTimeEnabled; + priv->ap_mac_config.ctsProtectionType=cfg_ap_config.ctsProtectionType; + + priv->ap_mac_config.wmmEnabled = cfg_ap_config.wmmEnabled; + + priv->ap_mac_config.apHtParams.rxStbc=cfg_ap_config.rxStbc; + priv->ap_mac_config.apHtParams.rifsModeAllowed=cfg_ap_config.rifsModeAllowed; + + priv->ap_mac_config.phySupportedBitmap = cfg_ap_config.phySupportedBitmap; + priv->ap_mac_config.maxListenInterval=cfg_ap_config.maxListenInterval; + + priv->ap_mac_config.supportedRatesCount= uf_configure_supported_rates(priv->ap_mac_config.supportedRates,priv->ap_mac_config.phySupportedBitmap); + + return 0; +} + +#endif +#ifdef CSR_SUPPORT_WEXT + + void +uf_sme_config_wq(struct work_struct *work) +{ + CsrWifiSmeStaConfig staConfig; + CsrWifiSmeDeviceConfig deviceConfig; + unifi_priv_t *priv = container_of(work, unifi_priv_t, sme_config_task); + + /* Register to receive indications from the SME */ + CsrWifiSmeEventMaskSetReqSend(0, + CSR_WIFI_SME_INDICATIONS_WIFIOFF | CSR_WIFI_SME_INDICATIONS_CONNECTIONQUALITY | + CSR_WIFI_SME_INDICATIONS_MEDIASTATUS | CSR_WIFI_SME_INDICATIONS_MICFAILURE); + + if (sme_mgt_sme_config_get(priv, &staConfig, &deviceConfig)) { + unifi_warning(priv, "uf_sme_config_wq: Get unifi_SMEConfigValue failed.\n"); + return; + } + + if (priv->if_index == CSR_INDEX_5G) { + staConfig.ifIndex = CSR_WIFI_SME_RADIO_IF_GHZ_5_0; + } else { + staConfig.ifIndex = CSR_WIFI_SME_RADIO_IF_GHZ_2_4; + } + + deviceConfig.trustLevel = (CsrWifiSme80211dTrustLevel)tl_80211d; + if (sme_mgt_sme_config_set(priv, &staConfig, &deviceConfig)) { + unifi_warning(priv, + "SME config for 802.11d Trust Level and Radio Band failed.\n"); + return; + } + +} /* uf_sme_config_wq() */ + +#endif /* CSR_SUPPORT_WEXT */ + + +/* + * --------------------------------------------------------------------------- + * uf_ta_ind_wq + * + * Deferred work queue function to send Traffic Analysis protocols + * indications to the SME. + * These are done in a deferred work queue for two reasons: + * - the CsrWifiRouterCtrl...Send() functions are not safe for atomic context + * - we want to load the main driver data path as lightly as possible + * + * The TA classifications already come from a workqueue. + * + * Arguments: + * work Pointer to work queue item. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ + void +uf_ta_ind_wq(struct work_struct *work) +{ + struct ta_ind *ind = container_of(work, struct ta_ind, task); + unifi_priv_t *priv = container_of(ind, unifi_priv_t, ta_ind_work); + CsrUint16 interfaceTag = 0; + + + CsrWifiRouterCtrlTrafficProtocolIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,0, + interfaceTag, + ind->packet_type, + ind->direction, + ind->src_addr); + ind->in_use = 0; + +} /* uf_ta_ind_wq() */ + + +/* + * --------------------------------------------------------------------------- + * uf_ta_sample_ind_wq + * + * Deferred work queue function to send Traffic Analysis sample + * indications to the SME. + * These are done in a deferred work queue for two reasons: + * - the CsrWifiRouterCtrl...Send() functions are not safe for atomic context + * - we want to load the main driver data path as lightly as possible + * + * The TA classifications already come from a workqueue. + * + * Arguments: + * work Pointer to work queue item. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ + void +uf_ta_sample_ind_wq(struct work_struct *work) +{ + struct ta_sample_ind *ind = container_of(work, struct ta_sample_ind, task); + unifi_priv_t *priv = container_of(ind, unifi_priv_t, ta_sample_ind_work); + CsrUint16 interfaceTag = 0; + + unifi_trace(priv, UDBG5, "rxtcp %d txtcp %d rxudp %d txudp %d prio %d\n", + priv->rxTcpThroughput, + priv->txTcpThroughput, + priv->rxUdpThroughput, + priv->txUdpThroughput, + priv->bh_thread.prio); + + if(priv->rxTcpThroughput > 1000) + { + if (bh_priority == -1 && priv->bh_thread.prio != 1) + { + struct sched_param param; + priv->bh_thread.prio = 1; + unifi_trace(priv, UDBG1, "%s new thread (RT) priority = %d\n", + priv->bh_thread.name, priv->bh_thread.prio); + param.sched_priority = priv->bh_thread.prio; + sched_setscheduler(priv->bh_thread.thread_task, SCHED_FIFO, ¶m); + } + } else + { + if (bh_priority == -1 && priv->bh_thread.prio != DEFAULT_PRIO) + { + struct sched_param param; + param.sched_priority = 0; + sched_setscheduler(priv->bh_thread.thread_task, SCHED_NORMAL, ¶m); + priv->bh_thread.prio = DEFAULT_PRIO; + unifi_trace(priv, UDBG1, "%s new thread priority = %d\n", + priv->bh_thread.name, priv->bh_thread.prio); + set_user_nice(priv->bh_thread.thread_task, PRIO_TO_NICE(priv->bh_thread.prio)); + } + } + + CsrWifiRouterCtrlTrafficSampleIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,0, interfaceTag, ind->stats); + + ind->in_use = 0; + +} /* uf_ta_sample_ind_wq() */ + + +/* + * --------------------------------------------------------------------------- + * uf_send_m4_ready_wq + * + * Deferred work queue function to send M4 ReadyToSend inds to the SME. + * These are done in a deferred work queue for two reasons: + * - the CsrWifiRouterCtrl...Send() functions are not safe for atomic context + * - we want to load the main driver data path as lightly as possible + * + * Arguments: + * work Pointer to work queue item. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +void +uf_send_m4_ready_wq(struct work_struct *work) +{ + netInterface_priv_t *InterfacePriv = container_of(work, netInterface_priv_t, send_m4_ready_task); + CsrUint16 iface = InterfacePriv->InterfaceTag; + unifi_priv_t *priv = InterfacePriv->privPtr; + CSR_MA_PACKET_REQUEST *req = &InterfacePriv->m4_signal.u.MaPacketRequest; + CsrWifiMacAddress peer; + unsigned long flags; + + func_enter(); + + /* The peer address was stored in the signal */ + spin_lock_irqsave(&priv->m4_lock, flags); + memcpy(peer.a, req->Ra.x, sizeof(peer.a)); + spin_unlock_irqrestore(&priv->m4_lock, flags); + + /* Send a signal to SME */ + CsrWifiRouterCtrlM4ReadyToSendIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, iface, peer); + + UF_TRACE_MAC(priv, UDBG1, "M4ReadyToSendInd sent for peer", peer.a); + + func_exit(); + +} /* uf_send_m4_ready_wq() */ + diff --git a/drivers/staging/csr/unifi_sme.h b/drivers/staging/csr/unifi_sme.h new file mode 100644 index 0000000..51ca92e --- /dev/null +++ b/drivers/staging/csr/unifi_sme.h @@ -0,0 +1,236 @@ +/* + * *************************************************************************** + * FILE: unifi_sme.h + * + * PURPOSE: SME related definitions. + * + * Copyright (C) 2007-2011 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * *************************************************************************** + */ +#ifndef __LINUX_UNIFI_SME_H__ +#define __LINUX_UNIFI_SME_H__ 1 + +#include + +#ifdef CSR_SME_USERSPACE +#include "sme_userspace.h" +#endif + +#include "csr_wifi_sme_lib.h" + +typedef int unifi_data_port_action; + +typedef struct unifi_port_cfg +{ + /* TRUE if this port entry is allocated */ + CsrBool in_use; + CsrWifiRouterCtrlPortAction port_action; + CsrWifiMacAddress mac_address; +} unifi_port_cfg_t; + +#define UNIFI_MAX_CONNECTIONS 8 +#define UNIFI_MAX_RETRY_LIMIT 5 +#define UF_DATA_PORT_NOT_OVERIDE 0 +#define UF_DATA_PORT_OVERIDE 1 + +typedef struct unifi_port_config +{ + int entries_in_use; + int overide_action; + unifi_port_cfg_t port_cfg[UNIFI_MAX_CONNECTIONS]; +} unifi_port_config_t; + + +enum sme_request_status { + SME_REQUEST_EMPTY, + SME_REQUEST_PENDING, + SME_REQUEST_RECEIVED, + SME_REQUEST_TIMEDOUT, +}; + +/* Structure to hold a UDI logged signal */ +typedef struct { + + /* The current status of the request */ + enum sme_request_status request_status; + + /* The status the SME has passed to us */ + CsrResult reply_status; + + /* SME's reply to a get request */ + CsrWifiSmeVersions versions; + CsrWifiSmePowerConfig powerConfig; + CsrWifiSmeHostConfig hostConfig; + CsrWifiSmeStaConfig staConfig; + CsrWifiSmeDeviceConfig deviceConfig; + CsrWifiSmeCoexInfo coexInfo; + CsrWifiSmeCoexConfig coexConfig; + CsrWifiSmeMibConfig mibConfig; + CsrWifiSmeConnectionInfo connectionInfo; + CsrWifiSmeConnectionConfig connectionConfig; + CsrWifiSmeConnectionStats connectionStats; + + + /* SME's reply to a scan request */ + CsrUint16 reply_scan_results_count; + CsrWifiSmeScanResult* reply_scan_results; + +} sme_reply_t; + + +typedef struct { + CsrUint16 appHandle; + CsrWifiRouterEncapsulation encapsulation; + CsrUint16 protocol; + CsrUint8 oui[3]; + CsrUint8 in_use; +} sme_ma_unidata_ind_filter_t; + + +CsrWifiRouterCtrlPortAction uf_sme_port_state(unifi_priv_t *priv, + unsigned char *address, + int queue, + CsrUint16 interfaceTag); +unifi_port_cfg_t *uf_sme_port_config_handle(unifi_priv_t *priv, + unsigned char *address, + int queue, + CsrUint16 interfaceTag); + + + +/* Callback for event logging to SME clients */ +void sme_log_event(ul_client_t *client, const u8 *signal, int signal_len, + const bulk_data_param_t *bulkdata, int dir); + +/* The workqueue task to the set the multicast addresses list */ +void uf_multicast_list_wq(struct work_struct *work); + +/* The workqueue task to execute the TA module */ +void uf_ta_wq(struct work_struct *work); + + +/* + * SME blocking helper functions + */ +#ifdef UNIFI_DEBUG +# define sme_complete_request(priv, status) uf_sme_complete_request(priv, status, __func__) +#else +# define sme_complete_request(priv, status) uf_sme_complete_request(priv, status, NULL) +#endif + +void uf_sme_complete_request(unifi_priv_t *priv, CsrResult reply_status, const char *func); + + +/* + * Blocking functions using the SME SYS API. + */ +int sme_sys_suspend(unifi_priv_t *priv); +int sme_sys_resume(unifi_priv_t *priv); + + +/* + * Traffic Analysis workqueue jobs + */ +void uf_ta_ind_wq(struct work_struct *work); +void uf_ta_sample_ind_wq(struct work_struct *work); + +/* + * SME config workqueue job + */ +void uf_sme_config_wq(struct work_struct *work); + +/* + * To send M4 read to send IND + */ +void uf_send_m4_ready_wq(struct work_struct *work); + +int sme_mgt_power_config_set(unifi_priv_t *priv, CsrWifiSmePowerConfig *powerConfig); +int sme_mgt_power_config_get(unifi_priv_t *priv, CsrWifiSmePowerConfig *powerConfig); +int sme_mgt_host_config_set(unifi_priv_t *priv, CsrWifiSmeHostConfig *hostConfig); +int sme_mgt_host_config_get(unifi_priv_t *priv, CsrWifiSmeHostConfig *hostConfig); +int sme_mgt_sme_config_set(unifi_priv_t *priv, CsrWifiSmeStaConfig *staConfig, CsrWifiSmeDeviceConfig *deviceConfig); +int sme_mgt_sme_config_get(unifi_priv_t *priv, CsrWifiSmeStaConfig *staConfig, CsrWifiSmeDeviceConfig *deviceConfig); +int sme_mgt_coex_info_get(unifi_priv_t *priv, CsrWifiSmeCoexInfo *coexInfo); +int sme_mgt_packet_filter_set(unifi_priv_t *priv); +int sme_mgt_tspec(unifi_priv_t *priv, CsrWifiSmeListAction action, + CsrUint32 tid, CsrWifiSmeDataBlock *tspec, CsrWifiSmeDataBlock *tclas); + +#ifdef CSR_SUPPORT_WEXT +/* + * Blocking functions using the SME MGT API. + */ +int sme_mgt_wifi_on(unifi_priv_t *priv); +int sme_mgt_wifi_off(unifi_priv_t *priv); +/*int sme_mgt_set_value_async(unifi_priv_t *priv, unifi_AppValue *app_value); +int sme_mgt_get_value_async(unifi_priv_t *priv, unifi_AppValue *app_value); +int sme_mgt_get_value(unifi_priv_t *priv, unifi_AppValue *app_value); +int sme_mgt_set_value(unifi_priv_t *priv, unifi_AppValue *app_value); +*/ +int sme_mgt_coex_config_set(unifi_priv_t *priv, CsrWifiSmeCoexConfig *coexConfig); +int sme_mgt_coex_config_get(unifi_priv_t *priv, CsrWifiSmeCoexConfig *coexConfig); +int sme_mgt_mib_config_set(unifi_priv_t *priv, CsrWifiSmeMibConfig *mibConfig); +int sme_mgt_mib_config_get(unifi_priv_t *priv, CsrWifiSmeMibConfig *mibConfig); + +int sme_mgt_connection_info_set(unifi_priv_t *priv, CsrWifiSmeConnectionInfo *connectionInfo); +int sme_mgt_connection_info_get(unifi_priv_t *priv, CsrWifiSmeConnectionInfo *connectionInfo); +int sme_mgt_connection_config_set(unifi_priv_t *priv, CsrWifiSmeConnectionConfig *connectionConfig); +int sme_mgt_connection_config_get(unifi_priv_t *priv, CsrWifiSmeConnectionConfig *connectionConfig); +int sme_mgt_connection_stats_get(unifi_priv_t *priv, CsrWifiSmeConnectionStats *connectionStats); + +int sme_mgt_versions_get(unifi_priv_t *priv, CsrWifiSmeVersions *versions); + + +int sme_mgt_scan_full(unifi_priv_t *priv, CsrWifiSsid *specific_ssid, + int num_channels, unsigned char *channel_list); +int sme_mgt_scan_results_get_async(unifi_priv_t *priv, + struct iw_request_info *info, + char *scan_results, + long scan_results_len); +int sme_mgt_disconnect(unifi_priv_t *priv); +int sme_mgt_connect(unifi_priv_t *priv); +int sme_mgt_key(unifi_priv_t *priv, CsrWifiSmeKey *sme_key, + CsrWifiSmeListAction action); +int sme_mgt_pmkid(unifi_priv_t *priv, CsrWifiSmeListAction action, + CsrWifiSmePmkidList *pmkid_list); +int sme_mgt_mib_get(unifi_priv_t *priv, + unsigned char *varbind, int *length); +int sme_mgt_mib_set(unifi_priv_t *priv, + unsigned char *varbind, int length); +#ifdef CSR_SUPPORT_WEXT_AP +int sme_ap_start(unifi_priv_t *priv,CsrUint16 interface_tag,CsrWifiSmeApConfig_t *ap_config); +int sme_ap_stop(unifi_priv_t *priv,CsrUint16 interface_tag); +int sme_ap_config(unifi_priv_t *priv,CsrWifiSmeApMacConfig *ap_mac_config, CsrWifiNmeApConfig *group_security_config); +int uf_configure_supported_rates(CsrUint8 * supportedRates, CsrUint8 phySupportedBitmap); +#endif +int unifi_translate_scan(struct net_device *dev, + struct iw_request_info *info, + char *current_ev, char *end_buf, + CsrWifiSmeScanResult *scan_data, + int scan_index); + +#endif /* CSR_SUPPORT_WEXT */ + +int unifi_cfg_power(unifi_priv_t *priv, unsigned char *arg); +int unifi_cfg_power_save(unifi_priv_t *priv, unsigned char *arg); +int unifi_cfg_power_supply(unifi_priv_t *priv, unsigned char *arg); +int unifi_cfg_packet_filters(unifi_priv_t *priv, unsigned char *arg); +int unifi_cfg_wmm_qos_info(unifi_priv_t *priv, unsigned char *arg); +int unifi_cfg_wmm_addts(unifi_priv_t *priv, unsigned char *arg); +int unifi_cfg_wmm_delts(unifi_priv_t *priv, unsigned char *arg); +int unifi_cfg_get_info(unifi_priv_t *priv, unsigned char *arg); +int unifi_cfg_strict_draft_n(unifi_priv_t *priv, unsigned char *arg); +int unifi_cfg_enable_okc(unifi_priv_t *priv, unsigned char *arg); +#ifdef CSR_SUPPORT_WEXT_AP +int unifi_cfg_set_ap_config(unifi_priv_t * priv,unsigned char* arg); +#endif + + + +int convert_sme_error(CsrResult error); + + +#endif /* __LINUX_UNIFI_SME_H__ */ diff --git a/drivers/staging/csr/unifi_wext.h b/drivers/staging/csr/unifi_wext.h new file mode 100644 index 0000000..ac86df9 --- /dev/null +++ b/drivers/staging/csr/unifi_wext.h @@ -0,0 +1,124 @@ +/* + ***************************************************************************** + * + * FILE : unifi_wext.h + * + * PURPOSE : Private header file for unifi driver support to wireless extensions. + * + * Copyright (C) 2005-2008 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * +***************************************************************************** + */ +#ifndef __LINUX_UNIFI_WEXT_H__ +#define __LINUX_UNIFI_WEXT_H__ 1 + +#include +#include +#include "csr_wifi_sme_prim.h" + +/* + * wext.c + */ +/* A few details needed for WEP (Wireless Equivalent Privacy) */ +#define UNIFI_MAX_KEY_SIZE 16 +#define NUM_WEPKEYS 4 +#define SMALL_KEY_SIZE 5 +#define LARGE_KEY_SIZE 13 +typedef struct wep_key_t { + int len; + unsigned char key[UNIFI_MAX_KEY_SIZE]; /* 40-bit and 104-bit keys */ +} wep_key_t; + +#define UNIFI_SCAN_ACTIVE 0 +#define UNIFI_SCAN_PASSIVE 1 +#define UNIFI_MAX_SSID_LEN 32 + +#define MAX_WPA_IE_LEN 64 +#define MAX_RSN_IE_LEN 255 + +/* + * Function to register in the netdev to report wireless stats. + */ +struct iw_statistics *unifi_get_wireless_stats(struct net_device *dev); + +void uf_sme_wext_set_defaults(unifi_priv_t *priv); + + +/* + * wext_events.c + */ +/* Functions to generate Wireless Extension events */ +void wext_send_scan_results_event(unifi_priv_t *priv); +void wext_send_assoc_event(unifi_priv_t *priv, unsigned char *bssid, + unsigned char *req_ie, int req_ie_len, + unsigned char *resp_ie, int resp_ie_len, + unsigned char *scan_ie, unsigned int scan_ie_len); +void wext_send_disassoc_event(unifi_priv_t *priv); +void wext_send_michaelmicfailure_event(unifi_priv_t *priv, + CsrUint16 count, CsrWifiMacAddress address, + CsrWifiSmeKeyType keyType, CsrUint16 interfaceTag); +void wext_send_pmkid_candidate_event(unifi_priv_t *priv, CsrWifiMacAddress bssid, CsrBool preauth_allowed, CsrUint16 interfaceTag); +void wext_send_started_event(unifi_priv_t *priv); + + +static inline int +uf_iwe_stream_add_point(struct iw_request_info *info, char *start, char *stop, + struct iw_event *piwe, char *extra) +{ + char *new_start; + + new_start = iwe_stream_add_point( +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) || defined (IW_REQUEST_FLAG_COMPAT) + info, +#endif + start, stop, piwe, extra); + if (unlikely(new_start == start)) + { + return -E2BIG; + } + + return (new_start - start); +} + + +static inline int +uf_iwe_stream_add_event(struct iw_request_info *info, char *start, char *stop, + struct iw_event *piwe, int len) +{ + char *new_start; + + new_start = iwe_stream_add_event( +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) || defined(IW_REQUEST_FLAG_COMPAT) + info, +#endif + start, stop, piwe, len); + if (unlikely(new_start == start)) { + return -E2BIG; + } + + return (new_start - start); +} + +static inline int +uf_iwe_stream_add_value(struct iw_request_info *info, char *stream, char *start, + char *stop, struct iw_event *piwe, int len) +{ + char *new_start; + + new_start = iwe_stream_add_value( +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) || defined(IW_REQUEST_FLAG_COMPAT) + info, +#endif + stream, start, stop, piwe, len); + if (unlikely(new_start == start)) { + return -E2BIG; + } + + return (new_start - start); +} + + +#endif /* __LINUX_UNIFI_WEXT_H__ */ diff --git a/drivers/staging/csr/unifiio.h b/drivers/staging/csr/unifiio.h new file mode 100644 index 0000000..e707eed --- /dev/null +++ b/drivers/staging/csr/unifiio.h @@ -0,0 +1,400 @@ +/* + * --------------------------------------------------------------------------- + * + * FILE: unifiio.h + * + * Public definitions for the UniFi linux driver. + * This is mostly ioctl command values and structs. + * + * Include or similar before this file + * + * Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * --------------------------------------------------------------------------- + */ +#ifndef __UNIFIIO_H__ +#define __UNIFIIO_H__ + +#include +#include "csr_types.h" + +#define UNIFI_GET_UDI_ENABLE _IOR('u', 1, int) +#define UNIFI_SET_UDI_ENABLE _IOW('u', 2, int) +/* Values for UDI_ENABLE */ +#define UDI_ENABLE_DATA 0x1 +#define UDI_ENABLE_CONTROL 0x2 + +/* MIB set/get. Arg is a pointer to a varbind */ +#define UNIFI_GET_MIB _IOWR('u', 3, unsigned char *) +#define UNIFI_SET_MIB _IOW ('u', 4, unsigned char *) +#define MAX_VARBIND_LENGTH 127 + +/* Private IOCTLs */ +#define SIOCIWS80211POWERSAVEPRIV SIOCIWFIRSTPRIV +#define SIOCIWG80211POWERSAVEPRIV SIOCIWFIRSTPRIV + 1 +#define SIOCIWS80211RELOADDEFAULTSPRIV SIOCIWFIRSTPRIV + 2 +#define SIOCIWSCONFWAPIPRIV SIOCIWFIRSTPRIV + 4 +#define SIOCIWSWAPIKEYPRIV SIOCIWFIRSTPRIV + 6 +#define SIOCIWSSMEDEBUGPRIV SIOCIWFIRSTPRIV + 8 +#define SIOCIWSAPCFGPRIV SIOCIWFIRSTPRIV + 10 +#define SIOCIWSAPSTARTPRIV SIOCIWFIRSTPRIV + 12 +#define SIOCIWSAPSTOPPRIV SIOCIWFIRSTPRIV + 14 +#define SIOCIWSFWRELOADPRIV SIOCIWFIRSTPRIV + 16 +#define SIOCIWSSTACKSTART SIOCIWFIRSTPRIV + 18 +#define SIOCIWSSTACKSTOP SIOCIWFIRSTPRIV + 20 + + + +#define IWPRIV_POWER_SAVE_MAX_STRING 32 +#define IWPRIV_SME_DEBUG_MAX_STRING 32 +#define IWPRIV_SME_MAX_STRING 120 + + +/* Private configuration commands */ +#define UNIFI_CFG _IOWR('u', 5, unsigned char *) +/* + * <------------------ Read/Write Buffer --------------------> + * _____________________________________________________________ + * | Cmd | Arg | ... Buffer (opt) ... | + * ------------------------------------------------------------- + * <-- uint --><-- uint --><----- unsigned char buffer ------> + * + * Cmd: A unifi_cfg_command_t command. + * Arg: Out:Length if Cmd==UNIFI_CFG_GET + * In:PowerOnOff if Cmd==UNIFI_CFG_POWER + * In:PowerMode if Cmd==UNIFI_CFG_POWERSAVE + * In:Length if Cmd==UNIFI_CFG_FILTER + * In:WMM Qos Info if Cmd==UNIFI_CFG_WMM_QOS_INFO + * Buffer: Out:Data if Cmd==UNIFI_CFG_GET + * NULL if Cmd==UNIFI_CFG_POWER + * NULL if Cmd==UNIFI_CFG_POWERSAVE + * In:Filters if Cmd==UNIFI_CFG_FILTER + * + * where Filters is a uf_cfg_bcast_packet_filter_t structure + * followed by 0 - n tclas_t structures. The length of the tclas_t + * structures is obtained by uf_cfg_bcast_packet_filter_t::tclas_ies_length. + */ + + +#define UNIFI_PUTEST _IOWR('u', 6, unsigned char *) +/* + * <------------------ Read/Write Buffer --------------------> + * _____________________________________________________________ + * | Cmd | Arg | ... Buffer (opt) ... | + * ------------------------------------------------------------- + * <-- uint --><-- uint --><----- unsigned char buffer ------> + * + * Cmd: A unifi_putest_command_t command. + * Arg: N/A if Cmd==UNIFI_PUTEST_START + * N/A if Cmd==UNIFI_PUTEST_STOP + * In:int (Clock Speed) if Cmd==UNIFI_PUTEST_SET_SDIO_CLOCK + * In/Out:sizeof(unifi_putest_cmd52) if Cmd==UNIFI_PUTEST_CMD52_READ + * In:sizeof(unifi_putest_cmd52) if Cmd==UNIFI_PUTEST_CMD52_WRITE + * In:uint (f/w file name length) if Cmd==UNIFI_PUTEST_DL_FW + * Buffer: NULL if Cmd==UNIFI_PUTEST_START + * NULL if Cmd==UNIFI_PUTEST_STOP + * NULL if Cmd==UNIFI_PUTEST_SET_SDIO_CLOCK + * In/Out:unifi_putest_cmd52 if Cmd==UNIFI_PUTEST_CMD52_READ + * In:unifi_putest_cmd52 if Cmd==UNIFI_PUTEST_CMD52_WRITE + * In:f/w file name if Cmd==UNIFI_PUTEST_DL_FW + */ + +#define UNIFI_BUILD_TYPE _IOWR('u', 7, unsigned char) +#define UNIFI_BUILD_NME 1 +#define UNIFI_BUILD_WEXT 2 +#define UNIFI_BUILD_AP 3 + +/* debugging */ +#define UNIFI_KICK _IO ('u', 0x10) +#define UNIFI_SET_DEBUG _IO ('u', 0x11) +#define UNIFI_SET_TRACE _IO ('u', 0x12) + +#define UNIFI_GET_INIT_STATUS _IOR ('u', 0x15, int) +#define UNIFI_SET_UDI_LOG_MASK _IOR('u', 0x18, unifiio_filter_t) +#define UNIFI_SET_UDI_SNAP_MASK _IOW('u', 0x1a, unifiio_snap_filter_t) +#define UNIFI_SET_AMP_ENABLE _IOWR('u', 0x1b, int) + +#define UNIFI_INIT_HW _IOR ('u', 0x13, unsigned char) +#define UNIFI_INIT_NETDEV _IOW ('u', 0x14, unsigned char[6]) +#define UNIFI_SME_PRESENT _IOW ('u', 0x19, int) + +#define UNIFI_CFG_PERIOD_TRAFFIC _IOW ('u', 0x21, unsigned char *) +#define UNIFI_CFG_UAPSD_TRAFFIC _IOW ('u', 0x22, unsigned char) + +#define UNIFI_COREDUMP_GET_REG _IOWR('u', 0x23, unifiio_coredump_req_t) + + +/* + * Following reset, f/w may only be downloaded using CMD52. + * This is slow, so there is a facility to download a secondary + * loader first which supports CMD53. + * If loader_len is > 0, then loader_data is assumed to point to + * a suitable secondary loader that can be used to download the + * main image. + * + * The driver will run the host protocol initialisation sequence + * after downloading the image. + * + * If both lengths are zero, then the f/w is assumed to have been + * booted from Flash and the host protocol initialisation sequence + * is run. + */ +typedef struct { + + /* Number of bytes in the image */ + int img_len; + + /* Pointer to image data. */ + unsigned char *img_data; + + + /* Number of bytes in the loader image */ + int loader_len; + + /* Pointer to loader image data. */ + unsigned char *loader_data; + +} unifiio_img_t; + + +/* Structure of data read from the unifi device. */ +typedef struct +{ + /* Length (in bytes) of entire structure including appended bulk data */ + int length; + + /* System time (in milliseconds) that signal was transferred */ + int timestamp; + + /* Direction in which signal was transferred. */ + int direction; +#define UDI_FROM_HOST 0 +#define UDI_TO_HOST 1 +#define UDI_CONFIG_IND 2 + + /* The length of the signal (in bytes) not including bulk data */ + int signal_length; + + /* Signal body follows, then any bulk data */ + +} udi_msg_t; + + +typedef enum +{ + UfSigFil_AllOn = 0, /* Log all signal IDs */ + UfSigFil_AllOff = 1, /* Don't log any signal IDs */ + UfSigFil_SelectOn = 2, /* Log these signal IDs */ + UfSigFil_SelectOff = 3 /* Don't log these signal IDs */ +} uf_sigfilter_action_t; + +typedef struct { + + /* Number of 16-bit ints in the sig_ids array */ + int num_sig_ids; + /* The action to perform */ + uf_sigfilter_action_t action; + /* List of signal IDs to pass or block */ + unsigned short *sig_ids; + +} unifiio_filter_t; + + +typedef struct { + /* Number of 16-bit ints in the protocols array */ + CsrUint16 count; + /* List of protocol ids to pass */ + CsrUint16 *protocols; +} unifiio_snap_filter_t; + + + +typedef enum unifi_putest_command { + UNIFI_PUTEST_START, + UNIFI_PUTEST_STOP, + UNIFI_PUTEST_SET_SDIO_CLOCK, + UNIFI_PUTEST_CMD52_READ, + UNIFI_PUTEST_CMD52_WRITE, + UNIFI_PUTEST_DL_FW, + UNIFI_PUTEST_DL_FW_BUFF, + UNIFI_PUTEST_CMD52_BLOCK_READ, + UNIFI_PUTEST_COREDUMP_PREPARE, + UNIFI_PUTEST_GP_READ16, + UNIFI_PUTEST_GP_WRITE16 + +} unifi_putest_command_t; + + +struct unifi_putest_cmd52 { + int funcnum; + unsigned long addr; + unsigned char data; +}; + + +struct unifi_putest_block_cmd52_r { + int funcnum; + unsigned long addr; + unsigned int length; + unsigned char *data; +}; + +struct unifi_putest_gp_rw16 { + unsigned long addr; /* generic address */ + unsigned short data; +}; + +typedef enum unifi_cfg_command { + UNIFI_CFG_GET, + UNIFI_CFG_POWER, + UNIFI_CFG_POWERSAVE, + UNIFI_CFG_FILTER, + UNIFI_CFG_POWERSUPPLY, + UNIFI_CFG_WMM_QOSINFO, + UNIFI_CFG_WMM_ADDTS, + UNIFI_CFG_WMM_DELTS, + UNIFI_CFG_STRICT_DRAFT_N, + UNIFI_CFG_ENABLE_OKC, + UNIFI_CFG_SET_AP_CONFIG, + UNIFI_CFG_CORE_DUMP /* request to take a fw core dump */ +} unifi_cfg_command_t; + +typedef enum unifi_cfg_power { + UNIFI_CFG_POWER_UNSPECIFIED, + UNIFI_CFG_POWER_OFF, + UNIFI_CFG_POWER_ON +} unifi_cfg_power_t; + +typedef enum unifi_cfg_powersupply { + UNIFI_CFG_POWERSUPPLY_UNSPECIFIED, + UNIFI_CFG_POWERSUPPLY_MAINS, + UNIFI_CFG_POWERSUPPLY_BATTERIES +} unifi_cfg_powersupply_t; + +typedef enum unifi_cfg_powersave { + UNIFI_CFG_POWERSAVE_UNSPECIFIED, + UNIFI_CFG_POWERSAVE_NONE, + UNIFI_CFG_POWERSAVE_FAST, + UNIFI_CFG_POWERSAVE_FULL, + UNIFI_CFG_POWERSAVE_AUTO +} unifi_cfg_powersave_t; + +typedef enum unifi_cfg_get { + UNIFI_CFG_GET_COEX, + UNIFI_CFG_GET_POWER_MODE, + UNIFI_CFG_GET_VERSIONS, + UNIFI_CFG_GET_POWER_SUPPLY, + UNIFI_CFG_GET_INSTANCE, + UNIFI_CFG_GET_AP_CONFIG +} unifi_cfg_get_t; + +#define UNIFI_CFG_FILTER_NONE 0x0000 +#define UNIFI_CFG_FILTER_DHCP 0x0001 +#define UNIFI_CFG_FILTER_ARP 0x0002 +#define UNIFI_CFG_FILTER_NBNS 0x0004 +#define UNIFI_CFG_FILTER_NBDS 0x0008 +#define UNIFI_CFG_FILTER_CUPS 0x0010 +#define UNIFI_CFG_FILTER_ALL 0xFFFF + + +typedef struct uf_cfg_bcast_packet_filter +{ + unsigned long filter_mode; //as defined by HIP protocol + unsigned char arp_filter; + unsigned char dhcp_filter; + unsigned long tclas_ies_length; // length of tclas_ies in bytes + unsigned char tclas_ies[1]; // variable length depending on above field +} uf_cfg_bcast_packet_filter_t; + +typedef struct uf_cfg_ap_config +{ + CsrUint8 phySupportedBitmap; + CsrUint8 channel; + CsrUint16 beaconInterval; + CsrUint8 dtimPeriod; + CsrBool wmmEnabled; + CsrUint8 shortSlotTimeEnabled; + CsrUint16 groupkeyTimeout; + CsrBool strictGtkRekeyEnabled; + CsrUint16 gmkTimeout; + CsrUint16 responseTimeout; + CsrUint8 retransLimit; + CsrUint8 rxStbc; + CsrBool rifsModeAllowed; + CsrUint8 dualCtsProtection; + CsrUint8 ctsProtectionType; + CsrUint16 maxListenInterval; +}uf_cfg_ap_config_t; + +typedef struct tcpic_clsfr +{ + __u8 cls_fr_type; + __u8 cls_fr_mask; + __u8 version; + __u8 source_ip_addr[4]; + __u8 dest_ip_addr[4]; + __u16 source_port; + __u16 dest_port; + __u8 dscp; + __u8 protocol; + __u8 reserved; +} __attribute__ ((packed)) tcpip_clsfr_t; + +typedef struct tclas { + __u8 element_id; + __u8 length; + __u8 user_priority; + tcpip_clsfr_t tcp_ip_cls_fr; +} __attribute__ ((packed)) tclas_t; + + +#define CONFIG_IND_ERROR 0x01 +#define CONFIG_IND_EXIT 0x02 +#define CONFIG_SME_NOT_PRESENT 0x10 +#define CONFIG_SME_PRESENT 0x20 + +/* WAPI Key */ +typedef struct +{ + CsrUint8 unicastKey; + /* If non zero, then unicast key otherwise group key */ + CsrUint8 keyIndex; + CsrUint8 keyRsc[16]; + CsrUint8 authenticator; + /* If non zero, then authenticator otherwise supplicant */ + CsrUint8 address[6]; + CsrUint8 key[32]; +} unifiio_wapi_key_t; + +/* Values describing XAP memory regions captured by the mini-coredump system */ +typedef enum unifiio_coredump_space { + UNIFIIO_COREDUMP_MAC_REG, + UNIFIIO_COREDUMP_PHY_REG, + UNIFIIO_COREDUMP_SH_DMEM, + UNIFIIO_COREDUMP_MAC_DMEM, + UNIFIIO_COREDUMP_PHY_DMEM, + UNIFIIO_COREDUMP_TRIGGER_MAGIC = 0xFEED +} unifiio_coredump_space_t; + +/* Userspace tool uses this structure to retrieve a register value from a + * mini-coredump buffer previously saved by the HIP + */ +typedef struct unifiio_coredump_req { + /* From user */ + int index; /* 0=newest, -1=oldest */ + unsigned int offset; /* register offset in space */ + unifiio_coredump_space_t space; /* memory space */ + /* Filled by driver */ + unsigned int drv_build; /* driver build id */ + unsigned int chip_ver; /* chip version */ + unsigned int fw_ver; /* firmware version */ + int requestor; /* requestor: 0=auto dump, 1=manual */ + unsigned int timestamp; /* time of capture by driver */ + unsigned int serial; /* capture serial number */ + int value; /* 16 bit register value, -ve for error */ +} unifiio_coredump_req_t; /* Core-dumped register value request */ + +#endif /* __UNIFIIO_H__ */ diff --git a/drivers/staging/csr/wext_events.c b/drivers/staging/csr/wext_events.c new file mode 100644 index 0000000..5674782 --- /dev/null +++ b/drivers/staging/csr/wext_events.c @@ -0,0 +1,285 @@ +/* + * --------------------------------------------------------------------------- + * FILE: wext_events.c + * + * PURPOSE: + * Code to generate iwevents. + * + * Copyright (C) 2006-2008 by Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + * + * --------------------------------------------------------------------------- + */ +#include +#include +#include +#include "csr_wifi_hip_unifi.h" +#include "unifi_priv.h" + + + +/* + * --------------------------------------------------------------------------- + * wext_send_assoc_event + * + * Send wireless-extension events up to userland to announce + * successful association with an AP. + * + * Arguments: + * priv Pointer to driver context. + * bssid MAC address of AP we associated with + * req_ie, req_ie_len IEs in the original request + * resp_ie, resp_ie_len IEs in the response + * + * Returns: + * None. + * + * Notes: + * This is sent on first successful association, and again if we + * roam to another AP. + * --------------------------------------------------------------------------- + */ +void +wext_send_assoc_event(unifi_priv_t *priv, unsigned char *bssid, + unsigned char *req_ie, int req_ie_len, + unsigned char *resp_ie, int resp_ie_len, + unsigned char *scan_ie, unsigned int scan_ie_len) +{ +#if WIRELESS_EXT > 17 + union iwreq_data wrqu; + + if (req_ie_len == 0) req_ie = NULL; + wrqu.data.length = req_ie_len; + wrqu.data.flags = 0; + wireless_send_event(priv->netdev[CSR_WIFI_INTERFACE_IN_USE], IWEVASSOCREQIE, &wrqu, req_ie); + + if (resp_ie_len == 0) resp_ie = NULL; + wrqu.data.length = resp_ie_len; + wrqu.data.flags = 0; + wireless_send_event(priv->netdev[CSR_WIFI_INTERFACE_IN_USE], IWEVASSOCRESPIE, &wrqu, resp_ie); + + if (scan_ie_len > 0) { + wrqu.data.length = scan_ie_len; + wrqu.data.flags = 0; + wireless_send_event(priv->netdev[CSR_WIFI_INTERFACE_IN_USE], IWEVGENIE, &wrqu, scan_ie); + } + + memcpy(&wrqu.ap_addr.sa_data, bssid, ETH_ALEN); + wireless_send_event(priv->netdev[CSR_WIFI_INTERFACE_IN_USE], SIOCGIWAP, &wrqu, NULL); +#endif +} /* wext_send_assoc_event() */ + + + +/* + * --------------------------------------------------------------------------- + * wext_send_disassoc_event + * + * Send a wireless-extension event up to userland to announce + * that we disassociated from an AP. + * + * Arguments: + * priv Pointer to driver context. + * + * Returns: + * None. + * + * Notes: + * The semantics of wpa_supplicant (the userland SME application) are + * that a SIOCGIWAP event with MAC address of all zero means + * disassociate. + * --------------------------------------------------------------------------- + */ +void +wext_send_disassoc_event(unifi_priv_t *priv) +{ +#if WIRELESS_EXT > 17 + union iwreq_data wrqu; + + memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); + wireless_send_event(priv->netdev[CSR_WIFI_INTERFACE_IN_USE], SIOCGIWAP, &wrqu, NULL); +#endif +} /* wext_send_disassoc_event() */ + + + +/* + * --------------------------------------------------------------------------- + * wext_send_scan_results_event + * + * Send wireless-extension events up to userland to announce + * completion of a scan. + * + * Arguments: + * priv Pointer to driver context. + * + * Returns: + * None. + * + * Notes: + * This doesn't actually report the results, they are retrieved + * using the SIOCGIWSCAN ioctl command. + * --------------------------------------------------------------------------- + */ +void +wext_send_scan_results_event(unifi_priv_t *priv) +{ +#if WIRELESS_EXT > 17 + union iwreq_data wrqu; + + wrqu.data.length = 0; + wrqu.data.flags = 0; + wireless_send_event(priv->netdev[CSR_WIFI_INTERFACE_IN_USE], SIOCGIWSCAN, &wrqu, NULL); + +#endif +} /* wext_send_scan_results_event() */ + + + +/* + * --------------------------------------------------------------------------- + * wext_send_michaelmicfailure_event + * + * Send wireless-extension events up to userland to announce + * completion of a scan. + * + * Arguments: + * priv Pointer to driver context. + * count, macaddr, key_type, key_idx, tsc + * Parameters from report from UniFi. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +#if WIRELESS_EXT >= 18 +static inline void +_send_michaelmicfailure_event(struct net_device *dev, + int count, const unsigned char *macaddr, + int key_type, int key_idx, + unsigned char *tsc) +{ + union iwreq_data wrqu; + struct iw_michaelmicfailure mmf; + + memset(&mmf, 0, sizeof(mmf)); + + mmf.flags = key_idx & IW_MICFAILURE_KEY_ID; + if (key_type == CSR_GROUP) { + mmf.flags |= IW_MICFAILURE_GROUP; + } else { + mmf.flags |= IW_MICFAILURE_PAIRWISE; + } + mmf.flags |= ((count << 5) & IW_MICFAILURE_COUNT); + + mmf.src_addr.sa_family = ARPHRD_ETHER; + memcpy(mmf.src_addr.sa_data, macaddr, ETH_ALEN); + + memcpy(mmf.tsc, tsc, IW_ENCODE_SEQ_MAX_SIZE); + + memset(&wrqu, 0, sizeof(wrqu)); + wrqu.data.length = sizeof(mmf); + + wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *)&mmf); +} +#elif WIRELESS_EXT >= 15 +static inline void +_send_michaelmicfailure_event(struct net_device *dev, + int count, const unsigned char *macaddr, + int key_type, int key_idx, + unsigned char *tsc) +{ + union iwreq_data wrqu; + char buf[128]; + + sprintf(buf, + "MLME-MICHAELMICFAILURE.indication(keyid=%d %scast addr=%02x:%02x:%02x:%02x:%02x:%02x)", + key_idx, (key_type == CSR_GROUP) ? "broad" : "uni", + macaddr[0], macaddr[1], macaddr[2], + macaddr[3], macaddr[4], macaddr[5]); + memset(&wrqu, 0, sizeof(wrqu)); + wrqu.data.length = strlen(buf); + wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf); +} +#else /* WIRELESS_EXT >= 15 */ +static inline void +_send_michaelmicfailure_event(struct net_device *dev, + int count, const unsigned char *macaddr, + int key_type, int key_idx, + unsigned char *tsc) +{ + /* Not supported before WEXT 15 */ +} +#endif /* WIRELESS_EXT >= 15 */ + + +void +wext_send_michaelmicfailure_event(unifi_priv_t *priv, + CsrUint16 count, + CsrWifiMacAddress address, + CsrWifiSmeKeyType keyType, + CsrUint16 interfaceTag) +{ + unsigned char tsc[8] = {0}; + + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "wext_send_michaelmicfailure_event bad interfaceTag\n"); + return; + } + + _send_michaelmicfailure_event(priv->netdev[interfaceTag], + count, + address.a, + keyType, + 0, + tsc); +} /* wext_send_michaelmicfailure_event() */ + +void +wext_send_pmkid_candidate_event(unifi_priv_t *priv, CsrWifiMacAddress bssid, CsrBool preauth_allowed, CsrUint16 interfaceTag) +{ +#if WIRELESS_EXT > 17 + union iwreq_data wrqu; + struct iw_pmkid_cand pmkid_cand; + + if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { + unifi_error(priv, "wext_send_pmkid_candidate_event bad interfaceTag\n"); + return; + } + + memset(&pmkid_cand, 0, sizeof(pmkid_cand)); + + if (preauth_allowed) { + pmkid_cand.flags |= IW_PMKID_CAND_PREAUTH; + } + pmkid_cand.bssid.sa_family = ARPHRD_ETHER; + memcpy(pmkid_cand.bssid.sa_data, bssid.a, ETH_ALEN); + /* Used as priority, smaller the number higher the priority, not really used in our case */ + pmkid_cand.index = 1; + + memset(&wrqu, 0, sizeof(wrqu)); + wrqu.data.length = sizeof(pmkid_cand); + + wireless_send_event(priv->netdev[interfaceTag], IWEVPMKIDCAND, &wrqu, (char *)&pmkid_cand); +#endif +} /* wext_send_pmkid_candidate_event() */ + +/* + * Send a custom WEXT event to say we have completed initialisation + * and are now ready for WEXT ioctls. Used by Android wpa_supplicant. + */ +void +wext_send_started_event(unifi_priv_t *priv) +{ +#if WIRELESS_EXT > 17 + union iwreq_data wrqu; + char data[] = "STARTED"; + + wrqu.data.length = sizeof(data); + wrqu.data.flags = 0; + wireless_send_event(priv->netdev[CSR_WIFI_INTERFACE_IN_USE], IWEVCUSTOM, &wrqu, data); +#endif +} /* wext_send_started_event() */ + -- cgit v0.10.2 From 95edd09ec3b15b165e2c7ba1e54cc508eafb2321 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 19 Jun 2012 17:33:16 -0700 Subject: Staging: csr: update to version 5.1.0 of the driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This brings the in-kernel driver up to the level of the csr-linux-wifi-5.1.0-oss.tar.gz tarball. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_framework_ext.c b/drivers/staging/csr/csr_framework_ext.c index 0406a4b..1586b23 100644 --- a/drivers/staging/csr/csr_framework_ext.c +++ b/drivers/staging/csr/csr_framework_ext.c @@ -211,3 +211,38 @@ void CsrMemFree(void *pointer) kfree(pointer); } EXPORT_SYMBOL_GPL(CsrMemFree); + +/*----------------------------------------------------------------------------* + * NAME + * CsrMemAllocDma + * + * DESCRIPTION + * Allocate DMA capable dynamic memory of a given size. + * + * RETURNS + * Pointer to allocated memory, or NULL in case of failure. + * Allocated memory is not initialised. + * + *----------------------------------------------------------------------------*/ +void *CsrMemAllocDma(CsrSize size) +{ + return kmalloc(size, GFP_KERNEL | GFP_DMA); +} +EXPORT_SYMBOL_GPL(CsrMemAllocDma); + +/*----------------------------------------------------------------------------* + * NAME + * CsrMemFreeDma + * + * DESCRIPTION + * Free DMA capable dynamic allocated memory. + * + * RETURNS + * void + * + *----------------------------------------------------------------------------*/ +void CsrMemFreeDma(void *pointer) +{ + kfree(pointer); +} +EXPORT_SYMBOL_GPL(CsrMemFreeDma); diff --git a/drivers/staging/csr/csr_types.h b/drivers/staging/csr/csr_types.h index d7d2c5d..23193ea 100644 --- a/drivers/staging/csr/csr_types.h +++ b/drivers/staging/csr/csr_types.h @@ -21,6 +21,7 @@ #include #include #include +#include #endif #ifdef __cplusplus diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index 0ae1153..939c87c 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -221,6 +221,7 @@ void CsrUInt32ToHex(CsrUint32 number, CsrCharString *str) /*------------------------------------------------------------------*/ /* String */ /*------------------------------------------------------------------*/ +#ifndef CSR_USE_STDC_LIB void *CsrMemCpy(void *dest, const void *src, CsrSize count) { return memcpy(dest, src, count); @@ -257,7 +258,9 @@ void *CsrMemDup(const void *buf1, CsrSize count) return buf2; } +#endif +#ifndef CSR_USE_STDC_LIB CsrCharString *CsrStrCpy(CsrCharString *dest, const CsrCharString *src) { return strcpy(dest, src); @@ -303,6 +306,7 @@ CsrCharString *CsrStrChr(const CsrCharString *string, CsrCharString c) { return strchr(string, c); } +#endif CsrInt32 CsrVsnprintf(CsrCharString *string, CsrSize count, const CsrCharString *format, va_list args) { diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index a19badd..ce39c7e 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -35,26 +35,53 @@ void CsrUInt16ToHex(CsrUint16 number, CsrCharString *str); void CsrUInt32ToHex(CsrUint32 number, CsrCharString *str); /*------------------------------------------------------------------*/ -/* String */ +/* Standard C Library functions */ /*------------------------------------------------------------------*/ +#ifdef CSR_USE_STDC_LIB +#define CsrMemCpy memcpy +#define CsrMemMove memmove +#define CsrStrCpy strcpy +#define CsrStrNCpy strncpy +#define CsrStrCat strcat +#define CsrStrNCat strncat +#define CsrMemCmp(s1, s2, n) ((CsrInt32) memcmp((s1), (s2), (n))) +#define CsrStrCmp(s1, s2) ((CsrInt32) strcmp((s1), (s2))) +#define CsrStrNCmp(s1, s2, n) ((CsrInt32) strncmp((s1), (s2), (n))) +/*#define CsrMemChr memchr*/ +#define CsrStrChr strchr +/*#define CsrStrCSpn strcspn*/ +/*#define CsrStrPBrk strpbrk*/ +/*#define CsrStrRChr strrchr*/ +/*#define CsrStrSpn strspn*/ +#define CsrStrStr strstr +/*#define CsrStrTok strtok*/ +#define CsrMemSet memset +#define CsrStrLen strlen +/*#define CsrVsnprintf(s, n, format, arg) ((CsrInt32) vsnprintf((s), (n), (format), (arg)))*/ +#else /* !CSR_USE_STDC_LIB */ void *CsrMemCpy(void *dest, const void *src, CsrSize count); -void *CsrMemSet(void *dest, CsrUint8 c, CsrSize count); void *CsrMemMove(void *dest, const void *src, CsrSize count); -CsrInt32 CsrMemCmp(const void *buf1, const void *buf2, CsrSize count); -void *CsrMemDup(const void *buf1, CsrSize count); CsrCharString *CsrStrCpy(CsrCharString *dest, const CsrCharString *src); CsrCharString *CsrStrNCpy(CsrCharString *dest, const CsrCharString *src, CsrSize count); -int CsrStrNICmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count); CsrCharString *CsrStrCat(CsrCharString *dest, const CsrCharString *src); CsrCharString *CsrStrNCat(CsrCharString *dest, const CsrCharString *src, CsrSize count); -CsrCharString *CsrStrStr(const CsrCharString *string1, const CsrCharString *string2); -CsrSize CsrStrLen(const CsrCharString *string); +CsrInt32 CsrMemCmp(const void *buf1, const void *buf2, CsrSize count); CsrInt32 CsrStrCmp(const CsrCharString *string1, const CsrCharString *string2); CsrInt32 CsrStrNCmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count); -CsrCharString *CsrStrDup(const CsrCharString *string); CsrCharString *CsrStrChr(const CsrCharString *string, CsrCharString c); -CsrUint32 CsrStrToInt(const CsrCharString *string); +CsrCharString *CsrStrStr(const CsrCharString *string1, const CsrCharString *string2); +void *CsrMemSet(void *dest, CsrUint8 c, CsrSize count); +CsrSize CsrStrLen(const CsrCharString *string); +#endif /* !CSR_USE_STDC_LIB */ CsrInt32 CsrVsnprintf(CsrCharString *string, CsrSize count, const CsrCharString *format, va_list args); + +/*------------------------------------------------------------------*/ +/* Non-standard utility functions */ +/*------------------------------------------------------------------*/ +void *CsrMemDup(const void *buf1, CsrSize count); +int CsrStrNICmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count); +CsrCharString *CsrStrDup(const CsrCharString *string); +CsrUint32 CsrStrToInt(const CsrCharString *string); CsrCharString *CsrStrNCpyZero(CsrCharString *dest, const CsrCharString *src, CsrSize count); /*------------------------------------------------------------------*/ diff --git a/drivers/staging/csr/csr_wifi_common.h b/drivers/staging/csr/csr_wifi_common.h index 1cdde5c..442dcc6 100644 --- a/drivers/staging/csr/csr_wifi_common.h +++ b/drivers/staging/csr/csr_wifi_common.h @@ -99,7 +99,7 @@ typedef struct #define CSR_WIFI_RESULT_INVALID_INTERFACE_TAG ((CsrResult) 0x000B) #define CSR_WIFI_RESULT_P2P_NOA_CONFIG_CONFLICT ((CsrResult) 0x000C) -#define CSR_WIFI_VERSION "5.0.3.0" +#define CSR_WIFI_VERSION "5.1.0.0" #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_wifi_hip_card.h b/drivers/staging/csr/csr_wifi_hip_card.h index 8904211..2ab4784 100644 --- a/drivers/staging/csr/csr_wifi_hip_card.h +++ b/drivers/staging/csr/csr_wifi_hip_card.h @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -81,6 +81,15 @@ CsrResult CardWriteBulkData(card_t *card, card_signal_t *csptr, unifi_TrafficQue */ void CardClearFromHostDataSlot(card_t *card, const CsrInt16 aSlotNum); +#ifdef CSR_WIFI_REQUEUE_PACKET_TO_HAL +/***************************************************************************** + * CardClearFromHostDataSlotWithoutFreeingBulkData - Clear the data stot + * without freeing the bulk data + */ + +void CardClearFromHostDataSlotWithoutFreeingBulkData(card_t *card, const CsrInt16 aSlotNum); +#endif + /***************************************************************************** * CardGetFreeFromHostDataSlots - */ diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.c b/drivers/staging/csr/csr_wifi_hip_card_sdio.c index 719c608..91976b8 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.c @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -323,7 +323,7 @@ CsrResult unifi_init(card_t *card) * have requested a mini-coredump which needs to be captured now the * SDIO interface is alive. */ - unifi_coredump_handle_request(card); + (void)unifi_coredump_handle_request(card); /* * Probe to see if the UniFi has ROM/flash to boot from. CSR6xxx should do. @@ -1616,14 +1616,14 @@ static CsrResult card_allocate_memory_resources(card_t *card) /* Reset any state carried forward from a previous life */ card->fh_command_queue.q_rd_ptr = 0; card->fh_command_queue.q_wr_ptr = 0; - CsrSnprintf(card->fh_command_queue.name, UNIFI_QUEUE_NAME_MAX_LENGTH, - "fh_cmd_q"); + (void)CsrSnprintf(card->fh_command_queue.name, UNIFI_QUEUE_NAME_MAX_LENGTH, + "fh_cmd_q"); for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) { card->fh_traffic_queue[i].q_rd_ptr = 0; card->fh_traffic_queue[i].q_wr_ptr = 0; - CsrSnprintf(card->fh_traffic_queue[i].name, - UNIFI_QUEUE_NAME_MAX_LENGTH, "fh_data_q%d", i); + (void)CsrSnprintf(card->fh_traffic_queue[i].name, + UNIFI_QUEUE_NAME_MAX_LENGTH, "fh_data_q%d", i); } #ifndef CSR_WIFI_HIP_TA_DISABLE unifi_ta_sampling_init(card); @@ -1634,7 +1634,7 @@ static CsrResult card_allocate_memory_resources(card_t *card) /* * Allocate memory for the from-host and to-host signal buffers. */ - card->fh_buffer.buf = CsrMemAlloc(UNIFI_FH_BUF_SIZE); + card->fh_buffer.buf = CsrMemAllocDma(UNIFI_FH_BUF_SIZE); if (card->fh_buffer.buf == NULL) { unifi_error(card->ospriv, "Failed to allocate memory for F-H signals\n"); @@ -1645,7 +1645,7 @@ static CsrResult card_allocate_memory_resources(card_t *card) card->fh_buffer.ptr = card->fh_buffer.buf; card->fh_buffer.count = 0; - card->th_buffer.buf = CsrMemAlloc(UNIFI_FH_BUF_SIZE); + card->th_buffer.buf = CsrMemAllocDma(UNIFI_FH_BUF_SIZE); if (card->th_buffer.buf == NULL) { unifi_error(card->ospriv, "Failed to allocate memory for T-H signals\n"); @@ -1693,6 +1693,12 @@ static CsrResult card_allocate_memory_resources(card_t *card) return CSR_WIFI_HIP_RESULT_NO_MEMORY; } + /* Initialise host tag entries for from-host bulk data slots */ + for (i = 0; i < n; i++) + { + card->fh_slot_host_tag_record[i] = CSR_WIFI_HIP_RESERVED_HOST_TAG; + } + /* Allocate memory for the array of pointers */ n = cfg_data->num_tohost_data_slots; @@ -1811,7 +1817,7 @@ static void card_free_memory_resources(card_t *card) if (card->fh_buffer.buf) { - CsrMemFree(card->fh_buffer.buf); + CsrMemFreeDma(card->fh_buffer.buf); } card->fh_buffer.ptr = card->fh_buffer.buf = NULL; card->fh_buffer.bufsize = 0; @@ -1819,7 +1825,7 @@ static void card_free_memory_resources(card_t *card) if (card->th_buffer.buf) { - CsrMemFree(card->th_buffer.buf); + CsrMemFreeDma(card->th_buffer.buf); } card->th_buffer.ptr = card->th_buffer.buf = NULL; card->th_buffer.bufsize = 0; @@ -1842,14 +1848,14 @@ static void card_init_soft_queues(card_t *card) /* Reset any state carried forward from a previous life */ card->fh_command_queue.q_rd_ptr = 0; card->fh_command_queue.q_wr_ptr = 0; - CsrSnprintf(card->fh_command_queue.name, UNIFI_QUEUE_NAME_MAX_LENGTH, - "fh_cmd_q"); + (void)CsrSnprintf(card->fh_command_queue.name, UNIFI_QUEUE_NAME_MAX_LENGTH, + "fh_cmd_q"); for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) { card->fh_traffic_queue[i].q_rd_ptr = 0; card->fh_traffic_queue[i].q_wr_ptr = 0; - CsrSnprintf(card->fh_traffic_queue[i].name, - UNIFI_QUEUE_NAME_MAX_LENGTH, "fh_data_q%d", i); + (void)CsrSnprintf(card->fh_traffic_queue[i].name, + UNIFI_QUEUE_NAME_MAX_LENGTH, "fh_data_q%d", i); } #ifndef CSR_WIFI_HIP_TA_DISABLE unifi_ta_sampling_init(card); @@ -2399,6 +2405,57 @@ void CardClearFromHostDataSlot(card_t *card, const CsrInt16 slot) } /* CardClearFromHostDataSlot() */ +#ifdef CSR_WIFI_REQUEUE_PACKET_TO_HAL +/* + * --------------------------------------------------------------------------- + * CardClearFromHostDataSlotWithoutFreeingBulkData + * + * Clear the given data slot with out freeing the bulk data. + * + * Arguments: + * card Pointer to Card object + * slot Index of the signal slot to clear. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +void CardClearFromHostDataSlotWithoutFreeingBulkData(card_t *card, const CsrInt16 slot) +{ + CsrUint8 queue = card->from_host_data[slot].queue; + + /* Initialise the from_host data slot so it can be re-used, + * Set length field in from_host_data array to 0. + */ + UNIFI_INIT_BULK_DATA(&card->from_host_data[slot].bd); + + queue = card->from_host_data[slot].queue; + + if (queue < UNIFI_NO_OF_TX_QS) + { + if (card->dynamic_slot_data.from_host_used_slots[queue] == 0) + { + unifi_error(card->ospriv, "Goofed up used slots q = %d used slots = %d\n", + queue, + card->dynamic_slot_data.from_host_used_slots[queue]); + } + else + { + card->dynamic_slot_data.from_host_used_slots[queue]--; + } + card->dynamic_slot_data.packets_txed[queue]++; + card->dynamic_slot_data.total_packets_txed++; + if (card->dynamic_slot_data.total_packets_txed >= + card->dynamic_slot_data.packets_interval) + { + CardReassignDynamicReservation(card); + } + } +} /* CardClearFromHostDataSlotWithoutFreeingBulkData() */ + + +#endif + CsrUint16 CardGetDataSlotSize(card_t *card) { return card->config_data.data_slot_size; diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c index 3d563c1..8fefbdf 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -148,9 +148,9 @@ void unifi_debug_hex_to_buf(const CsrCharString *buff, CsrUint16 length) CsrCharString s[5]; CsrUint16 i; - for (i = 0; i < length; i++) + for (i = 0; i < length; i = i + 2) { - CsrUInt16ToHex(0xff & buff[i], s); + CsrUInt16ToHex(*((CsrUint16 *)(buff + i)), s); unifi_debug_string_to_buf(s); } } @@ -277,7 +277,7 @@ void unifi_sdio_interrupt_handler(card_t *card) * Then ask the OS layer to run the unifi_bh to give attention to the UniFi. */ card->bh_reason_unifi = 1; - unifi_run_bh(card->ospriv); + (void)unifi_run_bh(card->ospriv); } /* sdio_interrupt_handler() */ @@ -309,7 +309,7 @@ CsrResult unifi_configure_low_power_mode(card_t *card, (low_power_mode == UNIFI_LOW_POWER_DISABLED)?"disabled" : "enabled", (periodic_wake_mode == UNIFI_PERIODIC_WAKE_HOST_DISABLED)?"FALSE" : "TRUE"); - unifi_run_bh(card->ospriv); + (void)unifi_run_bh(card->ospriv); return CSR_RESULT_SUCCESS; } /* unifi_configure_low_power_mode() */ @@ -614,10 +614,10 @@ exit: (low_power_mode == UNIFI_LOW_POWER_DISABLED)?"disabled" : "enabled"); /* Try to capture firmware panic codes */ - unifi_capture_panic(card); + (void)unifi_capture_panic(card); /* Ask for a mini-coredump when the driver has reset UniFi */ - unifi_coredump_request_at_next_reset(card, 1); + (void)unifi_coredump_request_at_next_reset(card, 1); } return r; @@ -932,9 +932,13 @@ static CsrResult handle_host_protocol(card_t *card, CsrBool *processed_something return r; } } + +#ifdef CSR_WIFI_RX_PATH_SPLIT #ifdef CSR_WIFI_RX_PATH_SPLIT_DONT_USE_WQ unifi_rx_queue_flush(card->ospriv); #endif +#endif + /* See if we can re-enable transmission now */ restart_packet_flow(card); @@ -1324,7 +1328,6 @@ static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed) if (status && (card->fh_slot_host_tag_record)) { CsrUint16 num_fh_slots = card->config_data.num_fromhost_data_slots; - CsrUint16 i = 0; /* search through the list of slot records and match with host tag * If a slot is not yet cleared then clear the slot from here @@ -1333,12 +1336,27 @@ static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed) { if (card->fh_slot_host_tag_record[i] == host_tag) { +#ifdef CSR_WIFI_REQUEUE_PACKET_TO_HAL + /* Invoke the HAL module function to requeue it back to HAL Queues */ + r = unifi_reque_ma_packet_request(card->ospriv, host_tag, status, &card->from_host_data[i].bd); + card->fh_slot_host_tag_record[i] = CSR_WIFI_HIP_RESERVED_HOST_TAG; + if (CSR_RESULT_SUCCESS != r) + { + unifi_trace(card->ospriv, UDBG5, "process_to_host_signals: Failed to requeue Packet(hTag:%x) back to HAL \n", host_tag); + CardClearFromHostDataSlot(card, i); + } + else + { + CardClearFromHostDataSlotWithoutFreeingBulkData(card, i); + } + +#else unifi_trace(card->ospriv, UDBG4, "process_to_host_signals Clear slot=%x host tag=%x\n", i, host_tag); card->fh_slot_host_tag_record[i] = CSR_WIFI_HIP_RESERVED_HOST_TAG; /* Set length field in from_host_data array to 0 */ CardClearFromHostDataSlot(card, i); - +#endif break; } } @@ -1724,7 +1742,7 @@ static CsrResult process_bulk_data_command(card_t *card, const CsrUint8 *cmdptr, if (len != 0 && (dir == UNIFI_SDIO_WRITE) && (((CsrIntptr)bdslot->os_data_ptr + offset) & 3)) { - host_bulk_data_slot = CsrMemAlloc(len); + host_bulk_data_slot = CsrMemAllocDma(len); if (!host_bulk_data_slot) { @@ -1783,7 +1801,7 @@ static CsrResult process_bulk_data_command(card_t *card, const CsrUint8 *cmdptr, /* moving this check before we clear host data slot */ if ((len != 0) && (dir == UNIFI_SDIO_WRITE) && (((CsrIntptr)bdslot->os_data_ptr + offset) & 3)) { - CsrMemFree(host_bulk_data_slot); + CsrMemFreeDma(host_bulk_data_slot); } #endif diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c index 403641d..8bc2d74 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -1565,7 +1565,7 @@ CsrResult unifi_bulk_rw(card_t *card, CsrUint32 handle, void *pdata, */ if (card->chip_id <= SDIO_CARD_ID_UNIFI_2) { - unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE); + (void)unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE); } /* If csr_sdio_block_rw() failed in a non-retryable way, or retries exhausted diff --git a/drivers/staging/csr/csr_wifi_hip_download.c b/drivers/staging/csr/csr_wifi_hip_download.c index fb6f04e..47178af 100644 --- a/drivers/staging/csr/csr_wifi_hip_download.c +++ b/drivers/staging/csr/csr_wifi_hip_download.c @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -674,7 +674,7 @@ static CsrResult send_ptdl_to_unifi(card_t *card, void *dlpriv, return CSR_WIFI_HIP_RESULT_INVALID_VALUE; } - buf = CsrMemAlloc(buf_size); + buf = CsrMemAllocDma(buf_size); if (buf == NULL) { unifi_error(card->ospriv, "Failed to allocate transfer buffer for firmware download\n"); @@ -720,7 +720,7 @@ static CsrResult send_ptdl_to_unifi(card_t *card, void *dlpriv, } } - CsrMemFree(buf); + CsrMemFreeDma(buf); if (r != CSR_RESULT_SUCCESS && r != CSR_WIFI_HIP_RESULT_NO_DEVICE) { diff --git a/drivers/staging/csr/csr_wifi_hip_dump.c b/drivers/staging/csr/csr_wifi_hip_dump.c index c191ea1..5297f10 100644 --- a/drivers/staging/csr/csr_wifi_hip_dump.c +++ b/drivers/staging/csr/csr_wifi_hip_dump.c @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -293,7 +293,7 @@ done: * Notes: * --------------------------------------------------------------------------- */ -static CsrInt32 get_value_from_coredump(const coredump_buffer *dump, +static CsrInt32 get_value_from_coredump(const coredump_buffer *coreDump, const unifi_coredump_space_t space, const CsrUint16 offset_in_space) { @@ -316,7 +316,7 @@ static CsrInt32 get_value_from_coredump(const coredump_buffer *dump, { /* Calculate the offset of data within the zone buffer */ offset_in_zone = offset_in_space - def->offset; - r = (CsrInt32) * (dump->zone[i] + offset_in_zone); + r = (CsrInt32) * (coreDump->zone[i] + offset_in_zone); unifi_trace(NULL, UDBG6, "sp %d, offs 0x%04x = 0x%04x (in z%d 0x%04x->0x%04x)\n", diff --git a/drivers/staging/csr/csr_wifi_hip_ta_sampling.c b/drivers/staging/csr/csr_wifi_hip_ta_sampling.c index 4fa8f60..7afcd3c 100644 --- a/drivers/staging/csr/csr_wifi_hip_ta_sampling.c +++ b/drivers/staging/csr/csr_wifi_hip_ta_sampling.c @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -69,9 +69,9 @@ enum ta_frame_identity #define TA_EAPOL_TYPE_OFFSET 9 #define TA_EAPOL_TYPE_START 0x01 -static const CsrUint8 snap_802_2[3] = { 0xAA, 0xAA, 0x03 }; -static const CsrUint8 oui_rfc1042[3] = { 0x00, 0x00, 0x00 }; -static const CsrUint8 oui_8021h[3] = { 0x00, 0x00, 0xf8 }; +#define snap_802_2 0xAAAA0300 +#define oui_rfc1042 0x00000000 +#define oui_8021h 0x0000f800 static const CsrUint8 aironet_snap[5] = { 0x00, 0x40, 0x96, 0x00, 0x00 }; @@ -100,13 +100,17 @@ static enum ta_frame_identity ta_detect_protocol(card_t *card, CsrWifiRouterCtrl CsrUint16 proto; CsrUint16 source_port, dest_port; CsrWifiMacAddress srcAddress; + CsrUint32 snap_hdr, oui_hdr; if (data->data_length < TA_LLC_HEADER_SIZE) { return TA_FRAME_UNKNOWN; } - if (CsrMemCmp(data->os_data_ptr, snap_802_2, 3)) + snap_hdr = (((CsrUint32)data->os_data_ptr[0]) << 24) | + (((CsrUint32)data->os_data_ptr[1]) << 16) | + (((CsrUint32)data->os_data_ptr[2]) << 8); + if (snap_hdr != snap_802_2) { return TA_FRAME_UNKNOWN; } @@ -118,8 +122,10 @@ static enum ta_frame_identity ta_detect_protocol(card_t *card, CsrWifiRouterCtrl */ } - if (!CsrMemCmp(data->os_data_ptr + 3, oui_rfc1042, 3) || - !CsrMemCmp(data->os_data_ptr + 3, oui_8021h, 3)) + oui_hdr = (((CsrUint32)data->os_data_ptr[3]) << 24) | + (((CsrUint32)data->os_data_ptr[4]) << 16) | + (((CsrUint32)data->os_data_ptr[5]) << 8); + if ((oui_hdr == oui_rfc1042) || (oui_hdr == oui_8021h)) { proto = (data->os_data_ptr[TA_ETHERNET_TYPE_OFFSET] * 256) + data->os_data_ptr[TA_ETHERNET_TYPE_OFFSET + 1]; @@ -177,7 +183,7 @@ static enum ta_frame_identity ta_detect_protocol(card_t *card, CsrWifiRouterCtrl /* The DHCP should have at least a message type (request, ack, nack, etc) */ if (data->data_length > TA_DHCP_MESSAGE_TYPE_OFFSET + 6) { - CsrMemCpy(srcAddress.a, saddr, 6); + UNIFI_MAC_ADDRESS_COPY(srcAddress.a, saddr); if (direction == CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX) { @@ -189,7 +195,7 @@ static enum ta_frame_identity ta_detect_protocol(card_t *card, CsrWifiRouterCtrl } /* DHCPACK is a special indication */ - if (!CsrMemCmp(data->os_data_ptr + TA_BOOTP_CLIENT_MAC_ADDR_OFFSET, sta_macaddr, 6)) + if (UNIFI_MAC_ADDRESS_CMP(data->os_data_ptr + TA_BOOTP_CLIENT_MAC_ADDR_OFFSET, sta_macaddr) == TRUE) { if (data->os_data_ptr[TA_DHCP_MESSAGE_TYPE_OFFSET] == TA_DHCP_MESSAGE_TYPE_ACK) { @@ -224,7 +230,7 @@ static enum ta_frame_identity ta_detect_protocol(card_t *card, CsrWifiRouterCtrl if ((TA_PROTO_TYPE_WAI == proto) || (direction != CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX) || (data->os_data_ptr[TA_EAPOL_TYPE_OFFSET] == TA_EAPOL_TYPE_START)) { - CsrMemCpy(srcAddress.a, saddr, 6); + UNIFI_MAC_ADDRESS_COPY(srcAddress.a, saddr); unifi_ta_indicate_protocol(card->ospriv, CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_EAPOL, direction, &srcAddress); @@ -238,7 +244,7 @@ static enum ta_frame_identity ta_detect_protocol(card_t *card, CsrWifiRouterCtrl { if (proto == TA_PROTO_TYPE_ARP) { - CsrMemCpy(srcAddress.a, saddr, 6); + UNIFI_MAC_ADDRESS_COPY(srcAddress.a, saddr); unifi_ta_indicate_protocol(card->ospriv, CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_ARP, direction, &srcAddress); @@ -253,7 +259,7 @@ static enum ta_frame_identity ta_detect_protocol(card_t *card, CsrWifiRouterCtrl /* detect Aironet frames */ if (!CsrMemCmp(data->os_data_ptr + 3, aironet_snap, 5)) { - CsrMemCpy(srcAddress.a, saddr, 6); + UNIFI_MAC_ADDRESS_COPY(srcAddress.a, saddr); unifi_ta_indicate_protocol(card->ospriv, CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_AIRONET, direction, &srcAddress); } diff --git a/drivers/staging/csr/csr_wifi_hip_unifi.h b/drivers/staging/csr/csr_wifi_hip_unifi.h index feda2e0..5f1c67b 100644 --- a/drivers/staging/csr/csr_wifi_hip_unifi.h +++ b/drivers/staging/csr/csr_wifi_hip_unifi.h @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -103,6 +103,17 @@ extern "C" { #include "csr_formatted_io.h" /* from the synergy gsp folder */ #include "csr_wifi_result.h" +/* Utility MACROS. Note that UNIFI_MAC_ADDRESS_CMP returns TRUE on success */ +#define UNIFI_MAC_ADDRESS_COPY(dst, src) \ + do { (dst)[0] = (src)[0]; (dst)[1] = (src)[1]; \ + (dst)[2] = (src)[2]; (dst)[3] = (src)[3]; \ + (dst)[4] = (src)[4]; (dst)[5] = (src)[5]; \ + } while (0) + +#define UNIFI_MAC_ADDRESS_CMP(addr1, addr2) \ + (((addr1)[0] == (addr2)[0]) && ((addr1)[1] == (addr2)[1]) && \ + ((addr1)[2] == (addr2)[2]) && ((addr1)[3] == (addr2)[3]) && \ + ((addr1)[4] == (addr2)[4]) && ((addr1)[5] == (addr2)[5])) /* Traffic queue ordered according to priority * EAPOL/Uncontrolled port Queue should be the last @@ -635,7 +646,24 @@ void unifi_receive_event(void *ospriv, CsrUint8 *sigdata, CsrUint32 siglen, const bulk_data_param_t *bulkdata); +#ifdef CSR_WIFI_REQUEUE_PACKET_TO_HAL +/** + * + * Used to reque the failed ma packet request back to hal queues + * + * @param ospriv the OS layer context. + * + * @param host_tag host tag for the packet to requeue. + * + * @param bulkDataDesc pointer to the bulk data. + * + * @ingroup upperedge + */ +CsrResult unifi_reque_ma_packet_request(void *ospriv, CsrUint32 host_tag, + CsrUint16 status, + bulk_data_desc_t *bulkDataDesc); +#endif typedef struct { CsrUint16 free_fh_sig_queue_slots[UNIFI_NO_OF_TX_QS]; @@ -836,6 +864,8 @@ const CsrCharString* lookup_bulkcmd_name(CsrUint16 id); /* Function to log HIP's global debug buffer */ #ifdef CSR_WIFI_HIP_DEBUG_OFFLINE void unifi_debug_buf_dump(void); +void unifi_debug_log_to_buf(const CsrCharString *fmt, ...); +void unifi_debug_hex_to_buf(const CsrCharString *buff, CsrUint16 length); #endif /* Mini-coredump utility functions */ diff --git a/drivers/staging/csr/csr_wifi_hip_xbv.c b/drivers/staging/csr/csr_wifi_hip_xbv.c index 5d0fdcc..5aaec4d 100644 --- a/drivers/staging/csr/csr_wifi_hip_xbv.c +++ b/drivers/staging/csr/csr_wifi_hip_xbv.c @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -579,8 +579,8 @@ static CsrUint32 write_uint16(void *buf, const CsrUint32 offset, const CsrUint16 static CsrUint32 write_uint32(void *buf, const CsrUint32 offset, const CsrUint32 val) { - write_uint16(buf, offset + 0, (CsrUint16)(val & 0xffff)); - write_uint16(buf, offset + 2, (CsrUint16)(val >> 16)); + (void)write_uint16(buf, offset + 0, (CsrUint16)(val & 0xffff)); + (void)write_uint16(buf, offset + 2, (CsrUint16)(val >> 16)); return sizeof(CsrUint32); } @@ -1055,11 +1055,11 @@ void* xbv_to_patch(card_t *card, fwreadfn_t readfn, patch_offs += write_reset_ptdl(patch_buf, patch_offs, fwinfo, fw_id); /* Now the length is known, update the LIST.length */ - write_uint32(patch_buf, list_len_offs, - (patch_offs - ptdl_start_offs) + PTCH_LIST_SIZE); + (void)write_uint32(patch_buf, list_len_offs, + (patch_offs - ptdl_start_offs) + PTCH_LIST_SIZE); /* Re write XBV headers just to fill in the correct file size */ - write_xbv_header(patch_buf, 0, (patch_offs - payload_offs)); + (void)write_xbv_header(patch_buf, 0, (patch_offs - payload_offs)); unifi_trace(card->ospriv, UDBG1, "XBV:PTCH size %u, fw_id %u\n", patch_offs, fw_id); diff --git a/drivers/staging/csr/csr_wifi_nme_ap_lib.h b/drivers/staging/csr/csr_wifi_nme_ap_lib.h index fc56924..aa632d5 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_lib.h +++ b/drivers/staging/csr/csr_wifi_nme_ap_lib.h @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -196,7 +196,6 @@ extern const CsrCharString *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM apCredentials - Security credential configuration. maxConnections - Maximum number of stations/P2P clients allowed p2pGoParam - P2P specific GO parameters. - NOT USED FOR CURRENT RELEASE wpsEnabled - Indicates whether WPS should be enabled or not *******************************************************************************/ diff --git a/drivers/staging/csr/csr_wifi_nme_ap_prim.h b/drivers/staging/csr/csr_wifi_nme_ap_prim.h index e3b56b4..561c2fd 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_prim.h +++ b/drivers/staging/csr/csr_wifi_nme_ap_prim.h @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -248,7 +248,6 @@ typedef struct apCredentials - Security credential configuration. maxConnections - Maximum number of stations/P2P clients allowed p2pGoParam - P2P specific GO parameters. - NOT USED FOR CURRENT RELEASE wpsEnabled - Indicates whether WPS should be enabled or not *******************************************************************************/ diff --git a/drivers/staging/csr/csr_wifi_router_converter_init.c b/drivers/staging/csr/csr_wifi_router_converter_init.c index f7ee3f0..6ff59c0 100644 --- a/drivers/staging/csr/csr_wifi_router_converter_init.c +++ b/drivers/staging/csr/csr_wifi_router_converter_init.c @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -41,11 +41,11 @@ CsrMsgConvMsgEntry* CsrWifiRouterConverterLookup(CsrMsgConvMsgEntry *ce, CsrUint { if (msgType & CSR_PRIM_UPSTREAM) { - CsrUint16 index = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT; - if (index < (CSR_WIFI_ROUTER_PRIM_UPSTREAM_COUNT + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT) && - csrwifirouter_conv_lut[index].msgType == msgType) + CsrUint16 idx = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT; + if (idx < (CSR_WIFI_ROUTER_PRIM_UPSTREAM_COUNT + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT) && + csrwifirouter_conv_lut[idx].msgType == msgType) { - return &csrwifirouter_conv_lut[index]; + return &csrwifirouter_conv_lut[idx]; } } else diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c b/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c index 36403fc..32d0bb6 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -50,9 +50,11 @@ static CsrMsgConvMsgEntry csrwifirouterctrl_conv_lut[] = { { CSR_WIFI_ROUTER_CTRL_CAPABILITIES_REQ, CsrWifiRouterCtrlCapabilitiesReqSizeof, CsrWifiRouterCtrlCapabilitiesReqSer, CsrWifiRouterCtrlCapabilitiesReqDes, CsrWifiRouterCtrlCapabilitiesReqSerFree }, { CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_REQ, CsrWifiRouterCtrlBlockAckEnableReqSizeof, CsrWifiRouterCtrlBlockAckEnableReqSer, CsrWifiRouterCtrlBlockAckEnableReqDes, CsrWifiRouterCtrlBlockAckEnableReqSerFree }, { CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_REQ, CsrWifiRouterCtrlBlockAckDisableReqSizeof, CsrWifiRouterCtrlBlockAckDisableReqSer, CsrWifiRouterCtrlBlockAckDisableReqDes, CsrWifiRouterCtrlBlockAckDisableReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_REQ, CsrWifiRouterCtrlWapiMulticastReqSizeof, CsrWifiRouterCtrlWapiMulticastReqSer, CsrWifiRouterCtrlWapiMulticastReqDes, CsrWifiRouterCtrlWapiMulticastReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_WAPI_RX_PKT_REQ, CsrWifiRouterCtrlWapiRxPktReqSizeof, CsrWifiRouterCtrlWapiRxPktReqSer, CsrWifiRouterCtrlWapiRxPktReqDes, CsrWifiRouterCtrlWapiRxPktReqSerFree }, { CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_FILTER_REQ, CsrWifiRouterCtrlWapiMulticastFilterReqSizeof, CsrWifiRouterCtrlWapiMulticastFilterReqSer, CsrWifiRouterCtrlWapiMulticastFilterReqDes, CsrWifiRouterCtrlWapiMulticastFilterReqSerFree }, { CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_FILTER_REQ, CsrWifiRouterCtrlWapiUnicastFilterReqSizeof, CsrWifiRouterCtrlWapiUnicastFilterReqSer, CsrWifiRouterCtrlWapiUnicastFilterReqDes, CsrWifiRouterCtrlWapiUnicastFilterReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_PKT_REQ, CsrWifiRouterCtrlWapiUnicastTxPktReqSizeof, CsrWifiRouterCtrlWapiUnicastTxPktReqSer, CsrWifiRouterCtrlWapiUnicastTxPktReqDes, CsrWifiRouterCtrlWapiUnicastTxPktReqSerFree }, + { CSR_WIFI_ROUTER_CTRL_WAPI_FILTER_REQ, CsrWifiRouterCtrlWapiFilterReqSizeof, CsrWifiRouterCtrlWapiFilterReqSer, CsrWifiRouterCtrlWapiFilterReqDes, CsrWifiRouterCtrlWapiFilterReqSerFree }, { CSR_WIFI_ROUTER_CTRL_HIP_IND, CsrWifiRouterCtrlHipIndSizeof, CsrWifiRouterCtrlHipIndSer, CsrWifiRouterCtrlHipIndDes, CsrWifiRouterCtrlHipIndSerFree }, { CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_IND, CsrWifiRouterCtrlMulticastAddressIndSizeof, CsrWifiRouterCtrlMulticastAddressIndSer, CsrWifiRouterCtrlMulticastAddressIndDes, CsrWifiRouterCtrlMulticastAddressIndSerFree }, { CSR_WIFI_ROUTER_CTRL_PORT_CONFIGURE_CFM, CsrWifiRouterCtrlPortConfigureCfmSizeof, CsrWifiRouterCtrlPortConfigureCfmSer, CsrWifiRouterCtrlPortConfigureCfmDes, CsrWifiRouterCtrlPortConfigureCfmSerFree }, @@ -81,7 +83,9 @@ static CsrMsgConvMsgEntry csrwifirouterctrl_conv_lut[] = { { CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_CFM, CsrWifiRouterCtrlBlockAckDisableCfmSizeof, CsrWifiRouterCtrlBlockAckDisableCfmSer, CsrWifiRouterCtrlBlockAckDisableCfmDes, CsrWifiRouterCtrlBlockAckDisableCfmSerFree }, { CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ERROR_IND, CsrWifiRouterCtrlBlockAckErrorIndSizeof, CsrWifiRouterCtrlBlockAckErrorIndSer, CsrWifiRouterCtrlBlockAckErrorIndDes, CsrWifiRouterCtrlBlockAckErrorIndSerFree }, { CSR_WIFI_ROUTER_CTRL_STA_INACTIVE_IND, CsrWifiRouterCtrlStaInactiveIndSizeof, CsrWifiRouterCtrlStaInactiveIndSer, CsrWifiRouterCtrlStaInactiveIndDes, CsrWifiRouterCtrlStaInactiveIndSerFree }, - { CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_IND, CsrWifiRouterCtrlWapiMulticastIndSizeof, CsrWifiRouterCtrlWapiMulticastIndSer, CsrWifiRouterCtrlWapiMulticastIndDes, CsrWifiRouterCtrlWapiMulticastIndSerFree }, + { CSR_WIFI_ROUTER_CTRL_WAPI_RX_MIC_CHECK_IND, CsrWifiRouterCtrlWapiRxMicCheckIndSizeof, CsrWifiRouterCtrlWapiRxMicCheckIndSer, CsrWifiRouterCtrlWapiRxMicCheckIndDes, CsrWifiRouterCtrlWapiRxMicCheckIndSerFree }, + { CSR_WIFI_ROUTER_CTRL_MODE_SET_CFM, CsrWifiRouterCtrlModeSetCfmSizeof, CsrWifiRouterCtrlModeSetCfmSer, CsrWifiRouterCtrlModeSetCfmDes, CsrWifiRouterCtrlModeSetCfmSerFree }, + { CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_ENCRYPT_IND, CsrWifiRouterCtrlWapiUnicastTxEncryptIndSizeof, CsrWifiRouterCtrlWapiUnicastTxEncryptIndSer, CsrWifiRouterCtrlWapiUnicastTxEncryptIndDes, CsrWifiRouterCtrlWapiUnicastTxEncryptIndSerFree }, { 0, NULL, NULL, NULL, NULL }, }; @@ -90,11 +94,11 @@ CsrMsgConvMsgEntry* CsrWifiRouterCtrlConverterLookup(CsrMsgConvMsgEntry *ce, Csr { if (msgType & CSR_PRIM_UPSTREAM) { - CsrUint16 index = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT; - if (index < (CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_COUNT + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT) && - csrwifirouterctrl_conv_lut[index].msgType == msgType) + CsrUint16 idx = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT; + if (idx < (CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_COUNT + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT) && + csrwifirouterctrl_conv_lut[idx].msgType == msgType) { - return &csrwifirouterctrl_conv_lut[index]; + return &csrwifirouterctrl_conv_lut[idx]; } } else diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c index 57aa367..d161fad 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -70,6 +70,13 @@ void CsrWifiRouterCtrlFreeDownstreamMessageContents(CsrUint16 eventClass, void * p->tclas = NULL; break; } + case CSR_WIFI_ROUTER_CTRL_WIFI_ON_REQ: + { + CsrWifiRouterCtrlWifiOnReq *p = (CsrWifiRouterCtrlWifiOnReq *)message; + CsrPmemFree(p->data); + p->data = NULL; + break; + } case CSR_WIFI_ROUTER_CTRL_WIFI_ON_RES: { CsrWifiRouterCtrlWifiOnRes *p = (CsrWifiRouterCtrlWifiOnRes *)message; @@ -77,15 +84,22 @@ void CsrWifiRouterCtrlFreeDownstreamMessageContents(CsrUint16 eventClass, void * p->smeVersions.smeBuild = NULL; break; } - case CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_REQ: + case CSR_WIFI_ROUTER_CTRL_WAPI_RX_PKT_REQ: { - CsrWifiRouterCtrlWapiMulticastReq *p = (CsrWifiRouterCtrlWapiMulticastReq *)message; + CsrWifiRouterCtrlWapiRxPktReq *p = (CsrWifiRouterCtrlWapiRxPktReq *)message; CsrPmemFree(p->signal); p->signal = NULL; CsrPmemFree(p->data); p->data = NULL; break; } + case CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_PKT_REQ: + { + CsrWifiRouterCtrlWapiUnicastTxPktReq *p = (CsrWifiRouterCtrlWapiUnicastTxPktReq *)message; + CsrPmemFree(p->data); + p->data = NULL; + break; + } default: break; diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c index 25e3273..b6bf11d 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -63,15 +63,22 @@ void CsrWifiRouterCtrlFreeUpstreamMessageContents(CsrUint16 eventClass, void *me p->versions.routerBuild = NULL; break; } - case CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_IND: + case CSR_WIFI_ROUTER_CTRL_WAPI_RX_MIC_CHECK_IND: { - CsrWifiRouterCtrlWapiMulticastInd *p = (CsrWifiRouterCtrlWapiMulticastInd *)message; + CsrWifiRouterCtrlWapiRxMicCheckInd *p = (CsrWifiRouterCtrlWapiRxMicCheckInd *)message; CsrPmemFree(p->signal); p->signal = NULL; CsrPmemFree(p->data); p->data = NULL; break; } + case CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_ENCRYPT_IND: + { + CsrWifiRouterCtrlWapiUnicastTxEncryptInd *p = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *)message; + CsrPmemFree(p->data); + p->data = NULL; + break; + } default: break; diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_lib.h b/drivers/staging/csr/csr_wifi_router_ctrl_lib.h index f0ad836..6c7e974 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_lib.h +++ b/drivers/staging/csr/csr_wifi_router_ctrl_lib.h @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -661,6 +661,39 @@ extern const CsrCharString *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER /******************************************************************************* NAME + CsrWifiRouterCtrlModeSetCfmSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + interfaceTag - + mode - + status - + +*******************************************************************************/ +#define CsrWifiRouterCtrlModeSetCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, mode__, status__) \ + msg__ = (CsrWifiRouterCtrlModeSetCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlModeSetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MODE_SET_CFM, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->mode = (mode__); \ + msg__->status = (status__); + +#define CsrWifiRouterCtrlModeSetCfmSendTo(dst__, src__, clientData__, interfaceTag__, mode__, status__) \ + { \ + CsrWifiRouterCtrlModeSetCfm *msg__; \ + CsrWifiRouterCtrlModeSetCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, mode__, status__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlModeSetCfmSend(dst__, clientData__, interfaceTag__, mode__, status__) \ + CsrWifiRouterCtrlModeSetCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, mode__, status__) + +/******************************************************************************* + + NAME CsrWifiRouterCtrlMulticastAddressIndSend DESCRIPTION @@ -1597,73 +1630,107 @@ extern const CsrCharString *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER /******************************************************************************* NAME + CsrWifiRouterCtrlWapiFilterReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + isWapiConnected - + +*******************************************************************************/ +#define CsrWifiRouterCtrlWapiFilterReqCreate(msg__, dst__, src__, interfaceTag__, isWapiConnected__) \ + msg__ = (CsrWifiRouterCtrlWapiFilterReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiFilterReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_FILTER_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->isWapiConnected = (isWapiConnected__); + +#define CsrWifiRouterCtrlWapiFilterReqSendTo(dst__, src__, interfaceTag__, isWapiConnected__) \ + { \ + CsrWifiRouterCtrlWapiFilterReq *msg__; \ + CsrWifiRouterCtrlWapiFilterReqCreate(msg__, dst__, src__, interfaceTag__, isWapiConnected__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlWapiFilterReqSend(src__, interfaceTag__, isWapiConnected__) \ + CsrWifiRouterCtrlWapiFilterReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, isWapiConnected__) + +/******************************************************************************* + + NAME CsrWifiRouterCtrlWapiMulticastFilterReqSend DESCRIPTION PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - status - + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + status - *******************************************************************************/ -#define CsrWifiRouterCtrlWapiMulticastFilterReqCreate(msg__, dst__, src__, status__) \ +#define CsrWifiRouterCtrlWapiMulticastFilterReqCreate(msg__, dst__, src__, interfaceTag__, status__) \ msg__ = (CsrWifiRouterCtrlWapiMulticastFilterReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiMulticastFilterReq)); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_FILTER_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); -#define CsrWifiRouterCtrlWapiMulticastFilterReqSendTo(dst__, src__, status__) \ +#define CsrWifiRouterCtrlWapiMulticastFilterReqSendTo(dst__, src__, interfaceTag__, status__) \ { \ CsrWifiRouterCtrlWapiMulticastFilterReq *msg__; \ - CsrWifiRouterCtrlWapiMulticastFilterReqCreate(msg__, dst__, src__, status__); \ + CsrWifiRouterCtrlWapiMulticastFilterReqCreate(msg__, dst__, src__, interfaceTag__, status__); \ CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ } -#define CsrWifiRouterCtrlWapiMulticastFilterReqSend(src__, status__) \ - CsrWifiRouterCtrlWapiMulticastFilterReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, status__) +#define CsrWifiRouterCtrlWapiMulticastFilterReqSend(src__, interfaceTag__, status__) \ + CsrWifiRouterCtrlWapiMulticastFilterReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, status__) /******************************************************************************* NAME - CsrWifiRouterCtrlWapiMulticastReqSend + CsrWifiRouterCtrlWapiRxMicCheckIndSend DESCRIPTION PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) + queue - Destination Task Queue + clientData - + interfaceTag - signalLength - signal - dataLength - data - *******************************************************************************/ -#define CsrWifiRouterCtrlWapiMulticastReqCreate(msg__, dst__, src__, signalLength__, signal__, dataLength__, data__) \ - msg__ = (CsrWifiRouterCtrlWapiMulticastReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiMulticastReq)); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_REQ, dst__, src__); \ +#define CsrWifiRouterCtrlWapiRxMicCheckIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \ + msg__ = (CsrWifiRouterCtrlWapiRxMicCheckInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiRxMicCheckInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_RX_MIC_CHECK_IND, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->interfaceTag = (interfaceTag__); \ msg__->signalLength = (signalLength__); \ msg__->signal = (signal__); \ msg__->dataLength = (dataLength__); \ msg__->data = (data__); -#define CsrWifiRouterCtrlWapiMulticastReqSendTo(dst__, src__, signalLength__, signal__, dataLength__, data__) \ +#define CsrWifiRouterCtrlWapiRxMicCheckIndSendTo(dst__, src__, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \ { \ - CsrWifiRouterCtrlWapiMulticastReq *msg__; \ - CsrWifiRouterCtrlWapiMulticastReqCreate(msg__, dst__, src__, signalLength__, signal__, dataLength__, data__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + CsrWifiRouterCtrlWapiRxMicCheckInd *msg__; \ + CsrWifiRouterCtrlWapiRxMicCheckIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ } -#define CsrWifiRouterCtrlWapiMulticastReqSend(src__, signalLength__, signal__, dataLength__, data__) \ - CsrWifiRouterCtrlWapiMulticastReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, signalLength__, signal__, dataLength__, data__) +#define CsrWifiRouterCtrlWapiRxMicCheckIndSend(dst__, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \ + CsrWifiRouterCtrlWapiRxMicCheckIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__) /******************************************************************************* NAME - CsrWifiRouterCtrlWapiMulticastIndSend + CsrWifiRouterCtrlWapiRxPktReqSend DESCRIPTION PARAMETERS - queue - Destination Task Queue - clientData - + queue - Message Source Task Queue (Cfm's will be sent to this Queue) interfaceTag - signalLength - signal - @@ -1671,25 +1738,24 @@ extern const CsrCharString *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER data - *******************************************************************************/ -#define CsrWifiRouterCtrlWapiMulticastIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \ - msg__ = (CsrWifiRouterCtrlWapiMulticastInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiMulticastInd)); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_IND, dst__, src__); \ - msg__->clientData = (clientData__); \ +#define CsrWifiRouterCtrlWapiRxPktReqCreate(msg__, dst__, src__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \ + msg__ = (CsrWifiRouterCtrlWapiRxPktReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiRxPktReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_RX_PKT_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->signalLength = (signalLength__); \ msg__->signal = (signal__); \ msg__->dataLength = (dataLength__); \ msg__->data = (data__); -#define CsrWifiRouterCtrlWapiMulticastIndSendTo(dst__, src__, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \ +#define CsrWifiRouterCtrlWapiRxPktReqSendTo(dst__, src__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \ { \ - CsrWifiRouterCtrlWapiMulticastInd *msg__; \ - CsrWifiRouterCtrlWapiMulticastIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + CsrWifiRouterCtrlWapiRxPktReq *msg__; \ + CsrWifiRouterCtrlWapiRxPktReqCreate(msg__, dst__, src__, interfaceTag__, signalLength__, signal__, dataLength__, data__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ } -#define CsrWifiRouterCtrlWapiMulticastIndSend(dst__, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \ - CsrWifiRouterCtrlWapiMulticastIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__) +#define CsrWifiRouterCtrlWapiRxPktReqSend(src__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \ + CsrWifiRouterCtrlWapiRxPktReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, signalLength__, signal__, dataLength__, data__) /******************************************************************************* @@ -1699,24 +1765,90 @@ extern const CsrCharString *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER DESCRIPTION PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - status - + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + status - *******************************************************************************/ -#define CsrWifiRouterCtrlWapiUnicastFilterReqCreate(msg__, dst__, src__, status__) \ +#define CsrWifiRouterCtrlWapiUnicastFilterReqCreate(msg__, dst__, src__, interfaceTag__, status__) \ msg__ = (CsrWifiRouterCtrlWapiUnicastFilterReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiUnicastFilterReq)); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_FILTER_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); -#define CsrWifiRouterCtrlWapiUnicastFilterReqSendTo(dst__, src__, status__) \ +#define CsrWifiRouterCtrlWapiUnicastFilterReqSendTo(dst__, src__, interfaceTag__, status__) \ { \ CsrWifiRouterCtrlWapiUnicastFilterReq *msg__; \ - CsrWifiRouterCtrlWapiUnicastFilterReqCreate(msg__, dst__, src__, status__); \ + CsrWifiRouterCtrlWapiUnicastFilterReqCreate(msg__, dst__, src__, interfaceTag__, status__); \ + CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlWapiUnicastFilterReqSend(src__, interfaceTag__, status__) \ + CsrWifiRouterCtrlWapiUnicastFilterReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, status__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWapiUnicastTxEncryptIndSend + + DESCRIPTION + + PARAMETERS + queue - Destination Task Queue + clientData - + interfaceTag - + dataLength - + data - + +*******************************************************************************/ +#define CsrWifiRouterCtrlWapiUnicastTxEncryptIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, dataLength__, data__) \ + msg__ = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxEncryptInd)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_ENCRYPT_IND, dst__, src__); \ + msg__->clientData = (clientData__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->dataLength = (dataLength__); \ + msg__->data = (data__); + +#define CsrWifiRouterCtrlWapiUnicastTxEncryptIndSendTo(dst__, src__, clientData__, interfaceTag__, dataLength__, data__) \ + { \ + CsrWifiRouterCtrlWapiUnicastTxEncryptInd *msg__; \ + CsrWifiRouterCtrlWapiUnicastTxEncryptIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, dataLength__, data__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ + } + +#define CsrWifiRouterCtrlWapiUnicastTxEncryptIndSend(dst__, clientData__, interfaceTag__, dataLength__, data__) \ + CsrWifiRouterCtrlWapiUnicastTxEncryptIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, dataLength__, data__) + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWapiUnicastTxPktReqSend + + DESCRIPTION + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + dataLength - + data - + +*******************************************************************************/ +#define CsrWifiRouterCtrlWapiUnicastTxPktReqCreate(msg__, dst__, src__, interfaceTag__, dataLength__, data__) \ + msg__ = (CsrWifiRouterCtrlWapiUnicastTxPktReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxPktReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_PKT_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->dataLength = (dataLength__); \ + msg__->data = (data__); + +#define CsrWifiRouterCtrlWapiUnicastTxPktReqSendTo(dst__, src__, interfaceTag__, dataLength__, data__) \ + { \ + CsrWifiRouterCtrlWapiUnicastTxPktReq *msg__; \ + CsrWifiRouterCtrlWapiUnicastTxPktReqCreate(msg__, dst__, src__, interfaceTag__, dataLength__, data__); \ CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ } -#define CsrWifiRouterCtrlWapiUnicastFilterReqSend(src__, status__) \ - CsrWifiRouterCtrlWapiUnicastFilterReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, status__) +#define CsrWifiRouterCtrlWapiUnicastTxPktReqSend(src__, interfaceTag__, dataLength__, data__) \ + CsrWifiRouterCtrlWapiUnicastTxPktReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, dataLength__, data__) /******************************************************************************* @@ -1837,22 +1969,26 @@ extern const CsrCharString *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER PARAMETERS queue - Message Source Task Queue (Cfm's will be sent to this Queue) clientData - + dataLength - Number of bytes in the buffer pointed to by 'data' + data - Pointer to the buffer containing 'dataLength' bytes *******************************************************************************/ -#define CsrWifiRouterCtrlWifiOnReqCreate(msg__, dst__, src__, clientData__) \ +#define CsrWifiRouterCtrlWifiOnReqCreate(msg__, dst__, src__, clientData__, dataLength__, data__) \ msg__ = (CsrWifiRouterCtrlWifiOnReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnReq)); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_ON_REQ, dst__, src__); \ - msg__->clientData = (clientData__); + msg__->clientData = (clientData__); \ + msg__->dataLength = (dataLength__); \ + msg__->data = (data__); -#define CsrWifiRouterCtrlWifiOnReqSendTo(dst__, src__, clientData__) \ +#define CsrWifiRouterCtrlWifiOnReqSendTo(dst__, src__, clientData__, dataLength__, data__) \ { \ CsrWifiRouterCtrlWifiOnReq *msg__; \ - CsrWifiRouterCtrlWifiOnReqCreate(msg__, dst__, src__, clientData__); \ + CsrWifiRouterCtrlWifiOnReqCreate(msg__, dst__, src__, clientData__, dataLength__, data__); \ CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ } -#define CsrWifiRouterCtrlWifiOnReqSend(src__, clientData__) \ - CsrWifiRouterCtrlWifiOnReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__) +#define CsrWifiRouterCtrlWifiOnReqSend(src__, clientData__, dataLength__, data__) \ + CsrWifiRouterCtrlWifiOnReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__, dataLength__, data__) /******************************************************************************* diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_prim.h b/drivers/staging/csr/csr_wifi_router_ctrl_prim.h index 954f600..810482a 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_prim.h +++ b/drivers/staging/csr/csr_wifi_router_ctrl_prim.h @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -616,12 +616,14 @@ typedef struct #define CSR_WIFI_ROUTER_CTRL_CAPABILITIES_REQ ((CsrWifiRouterCtrlPrim) (0x0017 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) #define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_REQ ((CsrWifiRouterCtrlPrim) (0x0018 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) #define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_REQ ((CsrWifiRouterCtrlPrim) (0x0019 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_REQ ((CsrWifiRouterCtrlPrim) (0x001A + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_WAPI_RX_PKT_REQ ((CsrWifiRouterCtrlPrim) (0x001A + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) #define CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_FILTER_REQ ((CsrWifiRouterCtrlPrim) (0x001B + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) #define CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_FILTER_REQ ((CsrWifiRouterCtrlPrim) (0x001C + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_PKT_REQ ((CsrWifiRouterCtrlPrim) (0x001D + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_WAPI_FILTER_REQ ((CsrWifiRouterCtrlPrim) (0x001E + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_HIGHEST (0x001C + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST) +#define CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_HIGHEST (0x001E + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST) /* Upstream */ #define CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST (0x0000 + CSR_PRIM_UPSTREAM) @@ -654,9 +656,11 @@ typedef struct #define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_CFM ((CsrWifiRouterCtrlPrim)(0x0019 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) #define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ERROR_IND ((CsrWifiRouterCtrlPrim)(0x001A + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) #define CSR_WIFI_ROUTER_CTRL_STA_INACTIVE_IND ((CsrWifiRouterCtrlPrim)(0x001B + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_IND ((CsrWifiRouterCtrlPrim)(0x001C + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_WAPI_RX_MIC_CHECK_IND ((CsrWifiRouterCtrlPrim)(0x001C + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_MODE_SET_CFM ((CsrWifiRouterCtrlPrim)(0x001D + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_ENCRYPT_IND ((CsrWifiRouterCtrlPrim)(0x001E + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_HIGHEST (0x001C + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST) +#define CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_HIGHEST (0x001E + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST) #define CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT (CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_HIGHEST + 1 - CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST) #define CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_COUNT (CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_HIGHEST + 1 - CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST) @@ -1032,12 +1036,16 @@ typedef struct MEMBERS common - Common header for use with the CsrWifiFsm Module clientData - + dataLength - Number of bytes in the buffer pointed to by 'data' + data - Pointer to the buffer containing 'dataLength' bytes *******************************************************************************/ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint32 dataLength; + CsrUint8 *data; } CsrWifiRouterCtrlWifiOnReq; /******************************************************************************* @@ -1273,12 +1281,13 @@ typedef struct /******************************************************************************* NAME - CsrWifiRouterCtrlWapiMulticastReq + CsrWifiRouterCtrlWapiRxPktReq DESCRIPTION MEMBERS common - Common header for use with the CsrWifiFsm Module + interfaceTag - signalLength - signal - dataLength - @@ -1288,11 +1297,12 @@ typedef struct typedef struct { CsrWifiFsmEvent common; + CsrUint16 interfaceTag; CsrUint16 signalLength; CsrUint8 *signal; CsrUint16 dataLength; CsrUint8 *data; -} CsrWifiRouterCtrlWapiMulticastReq; +} CsrWifiRouterCtrlWapiRxPktReq; /******************************************************************************* @@ -1302,13 +1312,15 @@ typedef struct DESCRIPTION MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + status - *******************************************************************************/ typedef struct { CsrWifiFsmEvent common; + CsrUint16 interfaceTag; CsrUint8 status; } CsrWifiRouterCtrlWapiMulticastFilterReq; @@ -1320,19 +1332,63 @@ typedef struct DESCRIPTION MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + status - *******************************************************************************/ typedef struct { CsrWifiFsmEvent common; + CsrUint16 interfaceTag; CsrUint8 status; } CsrWifiRouterCtrlWapiUnicastFilterReq; /******************************************************************************* NAME + CsrWifiRouterCtrlWapiUnicastTxPktReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + dataLength - + data - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrUint16 dataLength; + CsrUint8 *data; +} CsrWifiRouterCtrlWapiUnicastTxPktReq; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWapiFilterReq + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + isWapiConnected - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrBool isWapiConnected; +} CsrWifiRouterCtrlWapiFilterReq; + +/******************************************************************************* + + NAME CsrWifiRouterCtrlHipInd DESCRIPTION @@ -1984,7 +2040,7 @@ typedef struct /******************************************************************************* NAME - CsrWifiRouterCtrlWapiMulticastInd + CsrWifiRouterCtrlWapiRxMicCheckInd DESCRIPTION @@ -2007,7 +2063,55 @@ typedef struct CsrUint8 *signal; CsrUint16 dataLength; CsrUint8 *data; -} CsrWifiRouterCtrlWapiMulticastInd; +} CsrWifiRouterCtrlWapiRxMicCheckInd; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlModeSetCfm + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + interfaceTag - + mode - + status - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 interfaceTag; + CsrWifiRouterCtrlMode mode; + CsrResult status; +} CsrWifiRouterCtrlModeSetCfm; + +/******************************************************************************* + + NAME + CsrWifiRouterCtrlWapiUnicastTxEncryptInd + + DESCRIPTION + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + clientData - + interfaceTag - + dataLength - + data - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrWifiRouterCtrlRequestorInfo clientData; + CsrUint16 interfaceTag; + CsrUint16 dataLength; + CsrUint8 *data; +} CsrWifiRouterCtrlWapiUnicastTxEncryptInd; #ifdef __cplusplus diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_sef.c b/drivers/staging/csr/csr_wifi_router_ctrl_sef.c index b7fa6a1..33d92b6 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_sef.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_sef.c @@ -35,9 +35,11 @@ const CsrWifiRouterCtrlStateHandlerType CsrWifiRouterCtrlDownstreamStateHandlers /* 0x0015 */ CsrWifiRouterCtrlPeerDelReqHandler, /* 0x0016 */ CsrWifiRouterCtrlPeerUpdateReqHandler, /* 0x0017 */ CsrWifiRouterCtrlCapabilitiesReqHandler, - CsrWifiRouterCtrlBlockAckEnableReqHandler, /* 0x0018 */ - CsrWifiRouterCtrlBlockAckDisableReqHandler, /* 0x0019 */ - CsrWifiRouterCtrlWapiMulticastReqHandler, /* 0x001A */ - CsrWifiRouterCtrlWapiMulticastFilterReqHandler, /* 0x001B */ - CsrWifiRouterCtrlWapiUnicastFilterReqHandler, /* 0x001C */ + /* 0x0018 */ CsrWifiRouterCtrlBlockAckEnableReqHandler, + /* 0x0019 */ CsrWifiRouterCtrlBlockAckDisableReqHandler, + /* 0x001A */ CsrWifiRouterCtrlWapiRxPktReqHandler, + /* 0x001B */ CsrWifiRouterCtrlWapiMulticastFilterReqHandler, + /* 0x001C */ CsrWifiRouterCtrlWapiUnicastFilterReqHandler, + /* 0x001D */ CsrWifiRouterCtrlWapiUnicastTxPktReqHandler, + /* 0x001E */ CsrWifiRouterCtrlWapiFilterReqHandler, }; diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_sef.h b/drivers/staging/csr/csr_wifi_router_ctrl_sef.h index 07382ef..e0ee5cf 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_sef.h +++ b/drivers/staging/csr/csr_wifi_router_ctrl_sef.h @@ -47,8 +47,10 @@ extern "C" { extern void CsrWifiRouterCtrlBlockAckEnableReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); extern void CsrWifiRouterCtrlBlockAckDisableReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); extern void CsrWifiRouterCtrlWapiMulticastFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlWapiMulticastReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlWapiRxPktReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlWapiUnicastTxPktReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); extern void CsrWifiRouterCtrlWapiUnicastFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); + extern void CsrWifiRouterCtrlWapiFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); #ifdef __cplusplus } #endif diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c index cb1f6dc..3239c9b 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -656,6 +656,65 @@ void* CsrWifiRouterCtrlTrafficConfigReqDes(CsrUint8 *buffer, CsrSize length) } +CsrSize CsrWifiRouterCtrlWifiOnReqSizeof(void *msg) +{ + CsrWifiRouterCtrlWifiOnReq *primitive = (CsrWifiRouterCtrlWifiOnReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 4; /* CsrUint32 primitive->dataLength */ + bufferSize += primitive->dataLength; /* CsrUint8 primitive->data */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlWifiOnReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlWifiOnReq *primitive = (CsrWifiRouterCtrlWifiOnReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->dataLength); + if (primitive->dataLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->data, ((CsrUint16) (primitive->dataLength))); + } + return(ptr); +} + + +void* CsrWifiRouterCtrlWifiOnReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlWifiOnReq *primitive = (CsrWifiRouterCtrlWifiOnReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->dataLength, buffer, &offset); + if (primitive->dataLength) + { + primitive->data = (CsrUint8 *)CsrPmemAlloc(primitive->dataLength); + CsrMemCpyDes(primitive->data, buffer, &offset, ((CsrUint16) (primitive->dataLength))); + } + else + { + primitive->data = NULL; + } + + return primitive; +} + + +void CsrWifiRouterCtrlWifiOnReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiRouterCtrlWifiOnReq *primitive = (CsrWifiRouterCtrlWifiOnReq *) voidPrimitivePointer; + CsrPmemFree(primitive->data); + CsrPmemFree(primitive); +} + + CsrSize CsrWifiRouterCtrlWifiOnResSizeof(void *msg) { CsrWifiRouterCtrlWifiOnRes *primitive = (CsrWifiRouterCtrlWifiOnRes *) msg; @@ -1055,12 +1114,13 @@ void* CsrWifiRouterCtrlBlockAckDisableReqDes(CsrUint8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlWapiMulticastReqSizeof(void *msg) +CsrSize CsrWifiRouterCtrlWapiRxPktReqSizeof(void *msg) { - CsrWifiRouterCtrlWapiMulticastReq *primitive = (CsrWifiRouterCtrlWapiMulticastReq *) msg; + CsrWifiRouterCtrlWapiRxPktReq *primitive = (CsrWifiRouterCtrlWapiRxPktReq *) msg; CsrSize bufferSize = 2; - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrUint16 primitive->signalLength */ bufferSize += primitive->signalLength; /* CsrUint8 primitive->signal */ bufferSize += 2; /* CsrUint16 primitive->dataLength */ @@ -1069,11 +1129,12 @@ CsrSize CsrWifiRouterCtrlWapiMulticastReqSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlWapiMulticastReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +CsrUint8* CsrWifiRouterCtrlWapiRxPktReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) { - CsrWifiRouterCtrlWapiMulticastReq *primitive = (CsrWifiRouterCtrlWapiMulticastReq *)msg; + CsrWifiRouterCtrlWapiRxPktReq *primitive = (CsrWifiRouterCtrlWapiRxPktReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (CsrUint16) primitive->signalLength); if (primitive->signalLength) { @@ -1088,13 +1149,14 @@ CsrUint8* CsrWifiRouterCtrlWapiMulticastReqSer(CsrUint8 *ptr, CsrSize *len, void } -void* CsrWifiRouterCtrlWapiMulticastReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlWapiRxPktReqDes(CsrUint8 *buffer, CsrSize length) { - CsrWifiRouterCtrlWapiMulticastReq *primitive = (CsrWifiRouterCtrlWapiMulticastReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiMulticastReq)); + CsrWifiRouterCtrlWapiRxPktReq *primitive = (CsrWifiRouterCtrlWapiRxPktReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiRxPktReq)); CsrSize offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->signalLength, buffer, &offset); if (primitive->signalLength) { @@ -1120,15 +1182,74 @@ void* CsrWifiRouterCtrlWapiMulticastReqDes(CsrUint8 *buffer, CsrSize length) } -void CsrWifiRouterCtrlWapiMulticastReqSerFree(void *voidPrimitivePointer) +void CsrWifiRouterCtrlWapiRxPktReqSerFree(void *voidPrimitivePointer) { - CsrWifiRouterCtrlWapiMulticastReq *primitive = (CsrWifiRouterCtrlWapiMulticastReq *) voidPrimitivePointer; + CsrWifiRouterCtrlWapiRxPktReq *primitive = (CsrWifiRouterCtrlWapiRxPktReq *) voidPrimitivePointer; CsrPmemFree(primitive->signal); CsrPmemFree(primitive->data); CsrPmemFree(primitive); } +CsrSize CsrWifiRouterCtrlWapiUnicastTxPktReqSizeof(void *msg) +{ + CsrWifiRouterCtrlWapiUnicastTxPktReq *primitive = (CsrWifiRouterCtrlWapiUnicastTxPktReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrUint16 primitive->dataLength */ + bufferSize += primitive->dataLength; /* CsrUint8 primitive->data */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlWapiUnicastTxPktReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlWapiUnicastTxPktReq *primitive = (CsrWifiRouterCtrlWapiUnicastTxPktReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->dataLength); + if (primitive->dataLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->data, ((CsrUint16) (primitive->dataLength))); + } + return(ptr); +} + + +void* CsrWifiRouterCtrlWapiUnicastTxPktReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlWapiUnicastTxPktReq *primitive = (CsrWifiRouterCtrlWapiUnicastTxPktReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxPktReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->dataLength, buffer, &offset); + if (primitive->dataLength) + { + primitive->data = (CsrUint8 *)CsrPmemAlloc(primitive->dataLength); + CsrMemCpyDes(primitive->data, buffer, &offset, ((CsrUint16) (primitive->dataLength))); + } + else + { + primitive->data = NULL; + } + + return primitive; +} + + +void CsrWifiRouterCtrlWapiUnicastTxPktReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiRouterCtrlWapiUnicastTxPktReq *primitive = (CsrWifiRouterCtrlWapiUnicastTxPktReq *) voidPrimitivePointer; + CsrPmemFree(primitive->data); + CsrPmemFree(primitive); +} + + CsrSize CsrWifiRouterCtrlHipIndSizeof(void *msg) { CsrWifiRouterCtrlHipInd *primitive = (CsrWifiRouterCtrlHipInd *) msg; @@ -2287,9 +2408,9 @@ void* CsrWifiRouterCtrlStaInactiveIndDes(CsrUint8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlWapiMulticastIndSizeof(void *msg) +CsrSize CsrWifiRouterCtrlWapiRxMicCheckIndSizeof(void *msg) { - CsrWifiRouterCtrlWapiMulticastInd *primitive = (CsrWifiRouterCtrlWapiMulticastInd *) msg; + CsrWifiRouterCtrlWapiRxMicCheckInd *primitive = (CsrWifiRouterCtrlWapiRxMicCheckInd *) msg; CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ @@ -2303,9 +2424,9 @@ CsrSize CsrWifiRouterCtrlWapiMulticastIndSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlWapiMulticastIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +CsrUint8* CsrWifiRouterCtrlWapiRxMicCheckIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) { - CsrWifiRouterCtrlWapiMulticastInd *primitive = (CsrWifiRouterCtrlWapiMulticastInd *)msg; + CsrWifiRouterCtrlWapiRxMicCheckInd *primitive = (CsrWifiRouterCtrlWapiRxMicCheckInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); @@ -2324,9 +2445,9 @@ CsrUint8* CsrWifiRouterCtrlWapiMulticastIndSer(CsrUint8 *ptr, CsrSize *len, void } -void* CsrWifiRouterCtrlWapiMulticastIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlWapiRxMicCheckIndDes(CsrUint8 *buffer, CsrSize length) { - CsrWifiRouterCtrlWapiMulticastInd *primitive = (CsrWifiRouterCtrlWapiMulticastInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiMulticastInd)); + CsrWifiRouterCtrlWapiRxMicCheckInd *primitive = (CsrWifiRouterCtrlWapiRxMicCheckInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiRxMicCheckInd)); CsrSize offset; offset = 0; @@ -2358,12 +2479,116 @@ void* CsrWifiRouterCtrlWapiMulticastIndDes(CsrUint8 *buffer, CsrSize length) } -void CsrWifiRouterCtrlWapiMulticastIndSerFree(void *voidPrimitivePointer) +void CsrWifiRouterCtrlWapiRxMicCheckIndSerFree(void *voidPrimitivePointer) { - CsrWifiRouterCtrlWapiMulticastInd *primitive = (CsrWifiRouterCtrlWapiMulticastInd *) voidPrimitivePointer; + CsrWifiRouterCtrlWapiRxMicCheckInd *primitive = (CsrWifiRouterCtrlWapiRxMicCheckInd *) voidPrimitivePointer; CsrPmemFree(primitive->signal); CsrPmemFree(primitive->data); CsrPmemFree(primitive); } +CsrSize CsrWifiRouterCtrlModeSetCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 1; /* CsrWifiRouterCtrlMode primitive->mode */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlModeSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlModeSetCfm *primitive = (CsrWifiRouterCtrlModeSetCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->mode); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiRouterCtrlModeSetCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlModeSetCfm *primitive = (CsrWifiRouterCtrlModeSetCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlModeSetCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->mode, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiRouterCtrlWapiUnicastTxEncryptIndSizeof(void *msg) +{ + CsrWifiRouterCtrlWapiUnicastTxEncryptInd *primitive = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ + bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrUint16 primitive->dataLength */ + bufferSize += primitive->dataLength; /* CsrUint8 primitive->data */ + return bufferSize; +} + + +CsrUint8* CsrWifiRouterCtrlWapiUnicastTxEncryptIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiRouterCtrlWapiUnicastTxEncryptInd *primitive = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->dataLength); + if (primitive->dataLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->data, ((CsrUint16) (primitive->dataLength))); + } + return(ptr); +} + + +void* CsrWifiRouterCtrlWapiUnicastTxEncryptIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiRouterCtrlWapiUnicastTxEncryptInd *primitive = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxEncryptInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->dataLength, buffer, &offset); + if (primitive->dataLength) + { + primitive->data = (CsrUint8 *)CsrPmemAlloc(primitive->dataLength); + CsrMemCpyDes(primitive->data, buffer, &offset, ((CsrUint16) (primitive->dataLength))); + } + else + { + primitive->data = NULL; + } + + return primitive; +} + + +void CsrWifiRouterCtrlWapiUnicastTxEncryptIndSerFree(void *voidPrimitivePointer) +{ + CsrWifiRouterCtrlWapiUnicastTxEncryptInd *primitive = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *) voidPrimitivePointer; + CsrPmemFree(primitive->data); + CsrPmemFree(primitive); +} + + diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h index 5d82f8d..3b7834d 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h +++ b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -105,10 +105,10 @@ extern CsrSize CsrWifiRouterCtrlTrafficConfigReqSizeof(void *msg); #define CsrWifiRouterCtrlWifiOffResSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiRouterCtrlWifiOffResSerFree CsrWifiRouterCtrlPfree -#define CsrWifiRouterCtrlWifiOnReqSer CsrWifiEventCsrUint16Ser -#define CsrWifiRouterCtrlWifiOnReqDes CsrWifiEventCsrUint16Des -#define CsrWifiRouterCtrlWifiOnReqSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiRouterCtrlWifiOnReqSerFree CsrWifiRouterCtrlPfree +extern CsrUint8* CsrWifiRouterCtrlWifiOnReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlWifiOnReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlWifiOnReqSizeof(void *msg); +extern void CsrWifiRouterCtrlWifiOnReqSerFree(void *msg); extern CsrUint8* CsrWifiRouterCtrlWifiOnResSer(CsrUint8 *ptr, CsrSize *len, void *msg); extern void* CsrWifiRouterCtrlWifiOnResDes(CsrUint8 *buffer, CsrSize len); @@ -155,21 +155,31 @@ extern void* CsrWifiRouterCtrlBlockAckDisableReqDes(CsrUint8 *buffer, CsrSize le extern CsrSize CsrWifiRouterCtrlBlockAckDisableReqSizeof(void *msg); #define CsrWifiRouterCtrlBlockAckDisableReqSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlWapiMulticastReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlWapiMulticastReqDes(CsrUint8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlWapiMulticastReqSizeof(void *msg); -extern void CsrWifiRouterCtrlWapiMulticastReqSerFree(void *msg); +extern CsrUint8* CsrWifiRouterCtrlWapiRxPktReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlWapiRxPktReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlWapiRxPktReqSizeof(void *msg); +extern void CsrWifiRouterCtrlWapiRxPktReqSerFree(void *msg); -#define CsrWifiRouterCtrlWapiMulticastFilterReqSer CsrWifiEventCsrUint8Ser -#define CsrWifiRouterCtrlWapiMulticastFilterReqDes CsrWifiEventCsrUint8Des -#define CsrWifiRouterCtrlWapiMulticastFilterReqSizeof CsrWifiEventCsrUint8Sizeof +#define CsrWifiRouterCtrlWapiMulticastFilterReqSer CsrWifiEventCsrUint16CsrUint8Ser +#define CsrWifiRouterCtrlWapiMulticastFilterReqDes CsrWifiEventCsrUint16CsrUint8Des +#define CsrWifiRouterCtrlWapiMulticastFilterReqSizeof CsrWifiEventCsrUint16CsrUint8Sizeof #define CsrWifiRouterCtrlWapiMulticastFilterReqSerFree CsrWifiRouterCtrlPfree -#define CsrWifiRouterCtrlWapiUnicastFilterReqSer CsrWifiEventCsrUint8Ser -#define CsrWifiRouterCtrlWapiUnicastFilterReqDes CsrWifiEventCsrUint8Des -#define CsrWifiRouterCtrlWapiUnicastFilterReqSizeof CsrWifiEventCsrUint8Sizeof +#define CsrWifiRouterCtrlWapiUnicastFilterReqSer CsrWifiEventCsrUint16CsrUint8Ser +#define CsrWifiRouterCtrlWapiUnicastFilterReqDes CsrWifiEventCsrUint16CsrUint8Des +#define CsrWifiRouterCtrlWapiUnicastFilterReqSizeof CsrWifiEventCsrUint16CsrUint8Sizeof #define CsrWifiRouterCtrlWapiUnicastFilterReqSerFree CsrWifiRouterCtrlPfree +extern CsrUint8* CsrWifiRouterCtrlWapiUnicastTxPktReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlWapiUnicastTxPktReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlWapiUnicastTxPktReqSizeof(void *msg); +extern void CsrWifiRouterCtrlWapiUnicastTxPktReqSerFree(void *msg); + +#define CsrWifiRouterCtrlWapiFilterReqSer CsrWifiEventCsrUint16CsrUint8Ser +#define CsrWifiRouterCtrlWapiFilterReqDes CsrWifiEventCsrUint16CsrUint8Des +#define CsrWifiRouterCtrlWapiFilterReqSizeof CsrWifiEventCsrUint16CsrUint8Sizeof +#define CsrWifiRouterCtrlWapiFilterReqSerFree CsrWifiRouterCtrlPfree + extern CsrUint8* CsrWifiRouterCtrlHipIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); extern void* CsrWifiRouterCtrlHipIndDes(CsrUint8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlHipIndSizeof(void *msg); @@ -310,10 +320,20 @@ extern void* CsrWifiRouterCtrlStaInactiveIndDes(CsrUint8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlStaInactiveIndSizeof(void *msg); #define CsrWifiRouterCtrlStaInactiveIndSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlWapiMulticastIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlWapiMulticastIndDes(CsrUint8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlWapiMulticastIndSizeof(void *msg); -extern void CsrWifiRouterCtrlWapiMulticastIndSerFree(void *msg); +extern CsrUint8* CsrWifiRouterCtrlWapiRxMicCheckIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlWapiRxMicCheckIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlWapiRxMicCheckIndSizeof(void *msg); +extern void CsrWifiRouterCtrlWapiRxMicCheckIndSerFree(void *msg); + +extern CsrUint8* CsrWifiRouterCtrlModeSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlModeSetCfmDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlModeSetCfmSizeof(void *msg); +#define CsrWifiRouterCtrlModeSetCfmSerFree CsrWifiRouterCtrlPfree + +extern CsrUint8* CsrWifiRouterCtrlWapiUnicastTxEncryptIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlWapiUnicastTxEncryptIndDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiRouterCtrlWapiUnicastTxEncryptIndSizeof(void *msg); +extern void CsrWifiRouterCtrlWapiUnicastTxEncryptIndSerFree(void *msg); #ifdef __cplusplus diff --git a/drivers/staging/csr/csr_wifi_sme_ap_lib.h b/drivers/staging/csr/csr_wifi_sme_ap_lib.h index edef7c8..bb9e79f 100644 --- a/drivers/staging/csr/csr_wifi_sme_ap_lib.h +++ b/drivers/staging/csr/csr_wifi_sme_ap_lib.h @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -63,6 +63,7 @@ void CsrWifiSmeApFreeDownstreamMessageContents(CsrUint16 eventClass, void *messa const CsrCharString* CsrWifiSmeApAccessTypeToString(CsrWifiSmeApAccessType value); const CsrCharString* CsrWifiSmeApAuthSupportToString(CsrWifiSmeApAuthSupport value); const CsrCharString* CsrWifiSmeApAuthTypeToString(CsrWifiSmeApAuthType value); +const CsrCharString* CsrWifiSmeApDirectionToString(CsrWifiSmeApDirection value); const CsrCharString* CsrWifiSmeApPhySupportToString(CsrWifiSmeApPhySupport value); const CsrCharString* CsrWifiSmeApTypeToString(CsrWifiSmeApType value); @@ -82,6 +83,134 @@ extern const CsrCharString *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM /******************************************************************************* NAME + CsrWifiSmeApActiveBaGetReqSend + + DESCRIPTION + This primitive used to retrieve information related to the active block + ack sessions + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + +*******************************************************************************/ +#define CsrWifiSmeApActiveBaGetReqCreate(msg__, dst__, src__, interfaceTag__) \ + msg__ = (CsrWifiSmeApActiveBaGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApActiveBaGetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_ACTIVE_BA_GET_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); + +#define CsrWifiSmeApActiveBaGetReqSendTo(dst__, src__, interfaceTag__) \ + { \ + CsrWifiSmeApActiveBaGetReq *msg__; \ + CsrWifiSmeApActiveBaGetReqCreate(msg__, dst__, src__, interfaceTag__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ + } + +#define CsrWifiSmeApActiveBaGetReqSend(src__, interfaceTag__) \ + CsrWifiSmeApActiveBaGetReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__) + +/******************************************************************************* + + NAME + CsrWifiSmeApActiveBaGetCfmSend + + DESCRIPTION + This primitive carries the information related to the active ba sessions + + PARAMETERS + queue - Destination Task Queue + interfaceTag - + status - Reports the result of the request + activeBaCount - Number of active block ack session + activeBaSessions - Points to a buffer containing an array of + CsrWifiSmeApBaSession structures. + +*******************************************************************************/ +#define CsrWifiSmeApActiveBaGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, activeBaCount__, activeBaSessions__) \ + msg__ = (CsrWifiSmeApActiveBaGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApActiveBaGetCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_ACTIVE_BA_GET_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); \ + msg__->activeBaCount = (activeBaCount__); \ + msg__->activeBaSessions = (activeBaSessions__); + +#define CsrWifiSmeApActiveBaGetCfmSendTo(dst__, src__, interfaceTag__, status__, activeBaCount__, activeBaSessions__) \ + { \ + CsrWifiSmeApActiveBaGetCfm *msg__; \ + CsrWifiSmeApActiveBaGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, activeBaCount__, activeBaSessions__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ + } + +#define CsrWifiSmeApActiveBaGetCfmSend(dst__, interfaceTag__, status__, activeBaCount__, activeBaSessions__) \ + CsrWifiSmeApActiveBaGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, activeBaCount__, activeBaSessions__) + +/******************************************************************************* + + NAME + CsrWifiSmeApBaDeleteReqSend + + DESCRIPTION + This primitive is used to delete an active block ack session + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + interfaceTag - + reason - + baSession - BA session to be deleted + +*******************************************************************************/ +#define CsrWifiSmeApBaDeleteReqCreate(msg__, dst__, src__, interfaceTag__, reason__, baSession__) \ + msg__ = (CsrWifiSmeApBaDeleteReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApBaDeleteReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BA_DELETE_REQ, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->reason = (reason__); \ + msg__->baSession = (baSession__); + +#define CsrWifiSmeApBaDeleteReqSendTo(dst__, src__, interfaceTag__, reason__, baSession__) \ + { \ + CsrWifiSmeApBaDeleteReq *msg__; \ + CsrWifiSmeApBaDeleteReqCreate(msg__, dst__, src__, interfaceTag__, reason__, baSession__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ + } + +#define CsrWifiSmeApBaDeleteReqSend(src__, interfaceTag__, reason__, baSession__) \ + CsrWifiSmeApBaDeleteReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, reason__, baSession__) + +/******************************************************************************* + + NAME + CsrWifiSmeApBaDeleteCfmSend + + DESCRIPTION + This primitive confirms the BA is deleted + + PARAMETERS + queue - Destination Task Queue + interfaceTag - + status - Reports the result of the request + baSession - deleted BA session + +*******************************************************************************/ +#define CsrWifiSmeApBaDeleteCfmCreate(msg__, dst__, src__, interfaceTag__, status__, baSession__) \ + msg__ = (CsrWifiSmeApBaDeleteCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApBaDeleteCfm)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BA_DELETE_CFM, dst__, src__); \ + msg__->interfaceTag = (interfaceTag__); \ + msg__->status = (status__); \ + msg__->baSession = (baSession__); + +#define CsrWifiSmeApBaDeleteCfmSendTo(dst__, src__, interfaceTag__, status__, baSession__) \ + { \ + CsrWifiSmeApBaDeleteCfm *msg__; \ + CsrWifiSmeApBaDeleteCfmCreate(msg__, dst__, src__, interfaceTag__, status__, baSession__); \ + CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ + } + +#define CsrWifiSmeApBaDeleteCfmSend(dst__, interfaceTag__, status__, baSession__) \ + CsrWifiSmeApBaDeleteCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, baSession__) + +/******************************************************************************* + + NAME CsrWifiSmeApBeaconingStartReqSend DESCRIPTION diff --git a/drivers/staging/csr/csr_wifi_sme_ap_prim.h b/drivers/staging/csr/csr_wifi_sme_ap_prim.h index 3310cd2..4159439 100644 --- a/drivers/staging/csr/csr_wifi_sme_ap_prim.h +++ b/drivers/staging/csr/csr_wifi_sme_ap_prim.h @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -98,6 +98,23 @@ typedef CsrUint8 CsrWifiSmeApAuthType; /******************************************************************************* NAME + CsrWifiSmeApDirection + + DESCRIPTION + Definition of Direction + + VALUES + CSR_WIFI_AP_DIRECTION_RECEIPIENT - Receipient + CSR_WIFI_AP_DIRECTION_ORIGINATOR - Originator + +*******************************************************************************/ +typedef CsrUint8 CsrWifiSmeApDirection; +#define CSR_WIFI_AP_DIRECTION_RECEIPIENT ((CsrWifiSmeApDirection) 0x00) +#define CSR_WIFI_AP_DIRECTION_ORIGINATOR ((CsrWifiSmeApDirection) 0x01) + +/******************************************************************************* + + NAME CsrWifiSmeApPhySupport DESCRIPTION @@ -305,6 +322,28 @@ typedef struct /******************************************************************************* NAME + CsrWifiSmeApBaSession + + DESCRIPTION + + MEMBERS + peerMacAddress - Indicates MAC address of the peer station + tid - Specifies the TID of the MSDUs for which this Block Ack has + been set up. Range: 0-15 + direction - Specifies if the AP is the originator or the recipient of + the data stream that uses the Block Ack. + +*******************************************************************************/ +typedef struct +{ + CsrWifiMacAddress peerMacAddress; + CsrUint8 tid; + CsrWifiSmeApDirection direction; +} CsrWifiSmeApBaSession; + +/******************************************************************************* + + NAME CsrWifiSmeApMacConfig DESCRIPTION @@ -456,9 +495,11 @@ typedef struct #define CSR_WIFI_SME_AP_WMM_PARAM_UPDATE_REQ ((CsrWifiSmeApPrim) (0x0004 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST)) #define CSR_WIFI_SME_AP_STA_DISCONNECT_REQ ((CsrWifiSmeApPrim) (0x0005 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST)) #define CSR_WIFI_SME_AP_WPS_CONFIGURATION_REQ ((CsrWifiSmeApPrim) (0x0006 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_AP_ACTIVE_BA_GET_REQ ((CsrWifiSmeApPrim) (0x0007 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_AP_BA_DELETE_REQ ((CsrWifiSmeApPrim) (0x0008 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_HIGHEST (0x0006 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST) +#define CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_HIGHEST (0x0008 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST) /* Upstream */ #define CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST (0x0000 + CSR_PRIM_UPSTREAM) @@ -473,8 +514,10 @@ typedef struct #define CSR_WIFI_SME_AP_STA_DISCONNECT_CFM ((CsrWifiSmeApPrim)(0x0007 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) #define CSR_WIFI_SME_AP_WPS_CONFIGURATION_CFM ((CsrWifiSmeApPrim)(0x0008 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) #define CSR_WIFI_SME_AP_ERROR_IND ((CsrWifiSmeApPrim)(0x0009 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_AP_ACTIVE_BA_GET_CFM ((CsrWifiSmeApPrim)(0x000A + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) +#define CSR_WIFI_SME_AP_BA_DELETE_CFM ((CsrWifiSmeApPrim)(0x000B + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_AP_PRIM_UPSTREAM_HIGHEST (0x0009 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST) +#define CSR_WIFI_SME_AP_PRIM_UPSTREAM_HIGHEST (0x000B + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST) #define CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_COUNT (CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_HIGHEST + 1 - CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST) #define CSR_WIFI_SME_AP_PRIM_UPSTREAM_COUNT (CSR_WIFI_SME_AP_PRIM_UPSTREAM_HIGHEST + 1 - CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST) @@ -658,6 +701,49 @@ typedef struct /******************************************************************************* NAME + CsrWifiSmeApActiveBaGetReq + + DESCRIPTION + This primitive used to retrieve information related to the active block + ack sessions + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; +} CsrWifiSmeApActiveBaGetReq; + +/******************************************************************************* + + NAME + CsrWifiSmeApBaDeleteReq + + DESCRIPTION + This primitive is used to delete an active block ack session + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + reason - + baSession - BA session to be deleted + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrWifiSmeIEEE80211Reason reason; + CsrWifiSmeApBaSession baSession; +} CsrWifiSmeApBaDeleteReq; + +/******************************************************************************* + + NAME CsrWifiSmeApBeaconingStartCfm DESCRIPTION @@ -895,6 +981,55 @@ typedef struct CsrResult status; } CsrWifiSmeApErrorInd; +/******************************************************************************* + + NAME + CsrWifiSmeApActiveBaGetCfm + + DESCRIPTION + This primitive carries the information related to the active ba sessions + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + status - Reports the result of the request + activeBaCount - Number of active block ack session + activeBaSessions - Points to a buffer containing an array of + CsrWifiSmeApBaSession structures. + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; + CsrUint16 activeBaCount; + CsrWifiSmeApBaSession *activeBaSessions; +} CsrWifiSmeApActiveBaGetCfm; + +/******************************************************************************* + + NAME + CsrWifiSmeApBaDeleteCfm + + DESCRIPTION + This primitive confirms the BA is deleted + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + interfaceTag - + status - Reports the result of the request + baSession - deleted BA session + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint16 interfaceTag; + CsrResult status; + CsrWifiSmeApBaSession baSession; +} CsrWifiSmeApBaDeleteCfm; + #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_wifi_sme_converter_init.c b/drivers/staging/csr/csr_wifi_sme_converter_init.c index bafd1b4..6897a77 100644 --- a/drivers/staging/csr/csr_wifi_sme_converter_init.c +++ b/drivers/staging/csr/csr_wifi_sme_converter_init.c @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -79,6 +79,7 @@ static CsrMsgConvMsgEntry csrwifisme_conv_lut[] = { { CSR_WIFI_SME_SME_COMMON_CONFIG_SET_REQ, CsrWifiSmeSmeCommonConfigSetReqSizeof, CsrWifiSmeSmeCommonConfigSetReqSer, CsrWifiSmeSmeCommonConfigSetReqDes, CsrWifiSmeSmeCommonConfigSetReqSerFree }, { CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_REQ, CsrWifiSmeInterfaceCapabilityGetReqSizeof, CsrWifiSmeInterfaceCapabilityGetReqSer, CsrWifiSmeInterfaceCapabilityGetReqDes, CsrWifiSmeInterfaceCapabilityGetReqSerFree }, { CSR_WIFI_SME_WPS_CONFIGURATION_REQ, CsrWifiSmeWpsConfigurationReqSizeof, CsrWifiSmeWpsConfigurationReqSer, CsrWifiSmeWpsConfigurationReqDes, CsrWifiSmeWpsConfigurationReqSerFree }, + { CSR_WIFI_SME_SET_REQ, CsrWifiSmeSetReqSizeof, CsrWifiSmeSetReqSer, CsrWifiSmeSetReqDes, CsrWifiSmeSetReqSerFree }, { CSR_WIFI_SME_ACTIVATE_CFM, CsrWifiSmeActivateCfmSizeof, CsrWifiSmeActivateCfmSer, CsrWifiSmeActivateCfmDes, CsrWifiSmeActivateCfmSerFree }, { CSR_WIFI_SME_ADHOC_CONFIG_GET_CFM, CsrWifiSmeAdhocConfigGetCfmSizeof, CsrWifiSmeAdhocConfigGetCfmSer, CsrWifiSmeAdhocConfigGetCfmDes, CsrWifiSmeAdhocConfigGetCfmSerFree }, { CSR_WIFI_SME_ADHOC_CONFIG_SET_CFM, CsrWifiSmeAdhocConfigSetCfmSizeof, CsrWifiSmeAdhocConfigSetCfmSer, CsrWifiSmeAdhocConfigSetCfmDes, CsrWifiSmeAdhocConfigSetCfmSerFree }, @@ -159,11 +160,11 @@ CsrMsgConvMsgEntry* CsrWifiSmeConverterLookup(CsrMsgConvMsgEntry *ce, CsrUint16 { if (msgType & CSR_PRIM_UPSTREAM) { - CsrUint16 index = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT; - if (index < (CSR_WIFI_SME_PRIM_UPSTREAM_COUNT + CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT) && - csrwifisme_conv_lut[index].msgType == msgType) + CsrUint16 idx = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT; + if (idx < (CSR_WIFI_SME_PRIM_UPSTREAM_COUNT + CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT) && + csrwifisme_conv_lut[idx].msgType == msgType) { - return &csrwifisme_conv_lut[index]; + return &csrwifisme_conv_lut[idx]; } } else diff --git a/drivers/staging/csr/csr_wifi_sme_converter_init.h b/drivers/staging/csr/csr_wifi_sme_converter_init.h index 8637eb7..fb895de 100644 --- a/drivers/staging/csr/csr_wifi_sme_converter_init.h +++ b/drivers/staging/csr/csr_wifi_sme_converter_init.h @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details diff --git a/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c index c8e66be..93e75e5 100644 --- a/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c +++ b/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -172,6 +172,13 @@ void CsrWifiSmeFreeDownstreamMessageContents(CsrUint16 eventClass, void *message p->wpsConfig.secondaryDeviceType = NULL; break; } + case CSR_WIFI_SME_SET_REQ: + { + CsrWifiSmeSetReq *p = (CsrWifiSmeSetReq *)message; + CsrPmemFree(p->data); + p->data = NULL; + break; + } default: break; diff --git a/drivers/staging/csr/csr_wifi_sme_lib.h b/drivers/staging/csr/csr_wifi_sme_lib.h index 16053fb..67dcb48 100644 --- a/drivers/staging/csr/csr_wifi_sme_lib.h +++ b/drivers/staging/csr/csr_wifi_sme_lib.h @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -3445,6 +3445,39 @@ extern const CsrCharString *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWN /******************************************************************************* NAME + CsrWifiSmeSetReqSend + + DESCRIPTION + Used to pass custom data to the SME. Format is the same as 802.11 Info + Elements => | Id | Length | Data + 1) Cmanr Test Mode "Id:0 Length:1 Data:0x00 = OFF 0x01 = ON" "0x00 0x01 + (0x00|0x01)" + + PARAMETERS + queue - Message Source Task Queue (Cfm's will be sent to this Queue) + dataLength - Number of bytes in the buffer pointed to by 'data' + data - Pointer to the buffer containing 'dataLength' bytes + +*******************************************************************************/ +#define CsrWifiSmeSetReqCreate(msg__, dst__, src__, dataLength__, data__) \ + msg__ = (CsrWifiSmeSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeSetReq)); \ + CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SET_REQ, dst__, src__); \ + msg__->dataLength = (dataLength__); \ + msg__->data = (data__); + +#define CsrWifiSmeSetReqSendTo(dst__, src__, dataLength__, data__) \ + { \ + CsrWifiSmeSetReq *msg__; \ + CsrWifiSmeSetReqCreate(msg__, dst__, src__, dataLength__, data__); \ + CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ + } + +#define CsrWifiSmeSetReqSend(src__, dataLength__, data__) \ + CsrWifiSmeSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, dataLength__, data__) + +/******************************************************************************* + + NAME CsrWifiSmeSmeCommonConfigGetReqSend DESCRIPTION diff --git a/drivers/staging/csr/csr_wifi_sme_prim.h b/drivers/staging/csr/csr_wifi_sme_prim.h index 4bc8520..8ffa50a 100644 --- a/drivers/staging/csr/csr_wifi_sme_prim.h +++ b/drivers/staging/csr/csr_wifi_sme_prim.h @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -1434,7 +1434,7 @@ typedef CsrUint8 CsrWifiSmeWepCredentialType; CsrWifiSmeWmmMode DESCRIPTION - Defines bits for wmmModeMask: enable/disable WMM features. + Defines bits for CsrWifiSmeWmmModeMask: enable/disable WMM features. VALUES CSR_WIFI_SME_WMM_MODE_DISABLED - Disables the WMM features. @@ -2413,40 +2413,6 @@ typedef struct /******************************************************************************* NAME - CsrWifiSmeStaConfig - - DESCRIPTION - Station configuration options in the SME - - MEMBERS - connectionQualityRssiChangeTrigger - Sets the difference of RSSI - measurements which triggers reports - from the Firmware - connectionQualitySnrChangeTrigger - Sets the difference of SNR measurements - which triggers reports from the - Firmware - wmmModeMask - Mask containing one or more values from - CsrWifiSmeWmmMode - ifIndex - Indicates the band of frequencies used - allowUnicastUseGroupCipher - If TRUE, it allows to use groupwise - keys if no pairwise key is specified - enableOpportunisticKeyCaching - If TRUE, enables the Opportunistic Key - Caching feature - -*******************************************************************************/ -typedef struct -{ - CsrUint8 connectionQualityRssiChangeTrigger; - CsrUint8 connectionQualitySnrChangeTrigger; - CsrUint8 wmmModeMask; - CsrWifiSmeRadioIF ifIndex; - CsrBool allowUnicastUseGroupCipher; - CsrBool enableOpportunisticKeyCaching; -} CsrWifiSmeStaConfig; - -/******************************************************************************* - - NAME CsrWifiSmeTsfTime DESCRIPTION @@ -3200,6 +3166,40 @@ typedef struct /******************************************************************************* NAME + CsrWifiSmeStaConfig + + DESCRIPTION + Station configuration options in the SME + + MEMBERS + connectionQualityRssiChangeTrigger - Sets the difference of RSSI + measurements which triggers reports + from the Firmware + connectionQualitySnrChangeTrigger - Sets the difference of SNR measurements + which triggers reports from the + Firmware + wmmModeMask - Mask containing one or more values from + CsrWifiSmeWmmMode + ifIndex - Indicates the band of frequencies used + allowUnicastUseGroupCipher - If TRUE, it allows to use groupwise + keys if no pairwise key is specified + enableOpportunisticKeyCaching - If TRUE, enables the Opportunistic Key + Caching feature + +*******************************************************************************/ +typedef struct +{ + CsrUint8 connectionQualityRssiChangeTrigger; + CsrUint8 connectionQualitySnrChangeTrigger; + CsrWifiSmeWmmModeMask wmmModeMask; + CsrWifiSmeRadioIF ifIndex; + CsrBool allowUnicastUseGroupCipher; + CsrBool enableOpportunisticKeyCaching; +} CsrWifiSmeStaConfig; + +/******************************************************************************* + + NAME CsrWifiSmeWep128Keys DESCRIPTION @@ -3393,9 +3393,10 @@ typedef struct #define CSR_WIFI_SME_SME_COMMON_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0034 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) #define CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_REQ ((CsrWifiSmePrim) (0x0035 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) #define CSR_WIFI_SME_WPS_CONFIGURATION_REQ ((CsrWifiSmePrim) (0x0036 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) +#define CSR_WIFI_SME_SET_REQ ((CsrWifiSmePrim) (0x0037 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_PRIM_DOWNSTREAM_HIGHEST (0x0036 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST) +#define CSR_WIFI_SME_PRIM_DOWNSTREAM_HIGHEST (0x0037 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST) /* Upstream */ #define CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST (0x0000 + CSR_PRIM_UPSTREAM) @@ -4812,6 +4813,30 @@ typedef struct /******************************************************************************* NAME + CsrWifiSmeSetReq + + DESCRIPTION + Used to pass custom data to the SME. Format is the same as 802.11 Info + Elements => | Id | Length | Data + 1) Cmanr Test Mode "Id:0 Length:1 Data:0x00 = OFF 0x01 = ON" "0x00 0x01 + (0x00|0x01)" + + MEMBERS + common - Common header for use with the CsrWifiFsm Module + dataLength - Number of bytes in the buffer pointed to by 'data' + data - Pointer to the buffer containing 'dataLength' bytes + +*******************************************************************************/ +typedef struct +{ + CsrWifiFsmEvent common; + CsrUint32 dataLength; + CsrUint8 *data; +} CsrWifiSmeSetReq; + +/******************************************************************************* + + NAME CsrWifiSmeActivateCfm DESCRIPTION diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.c b/drivers/staging/csr/csr_wifi_sme_serialize.c index 489c378..5c1bc31 100644 --- a/drivers/staging/csr/csr_wifi_sme_serialize.c +++ b/drivers/staging/csr/csr_wifi_sme_serialize.c @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -1356,7 +1356,7 @@ CsrSize CsrWifiSmeSmeStaConfigSetReqSizeof(void *msg) bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 1; /* CsrUint8 primitive->smeConfig.connectionQualityRssiChangeTrigger */ bufferSize += 1; /* CsrUint8 primitive->smeConfig.connectionQualitySnrChangeTrigger */ - bufferSize += 1; /* CsrUint8 primitive->smeConfig.wmmModeMask */ + bufferSize += 1; /* CsrWifiSmeWmmModeMask primitive->smeConfig.wmmModeMask */ bufferSize += 1; /* CsrWifiSmeRadioIF primitive->smeConfig.ifIndex */ bufferSize += 1; /* CsrBool primitive->smeConfig.allowUnicastUseGroupCipher */ bufferSize += 1; /* CsrBool primitive->smeConfig.enableOpportunisticKeyCaching */ @@ -1898,6 +1898,62 @@ void CsrWifiSmeWpsConfigurationReqSerFree(void *voidPrimitivePointer) } +CsrSize CsrWifiSmeSetReqSizeof(void *msg) +{ + CsrWifiSmeSetReq *primitive = (CsrWifiSmeSetReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ + bufferSize += 4; /* CsrUint32 primitive->dataLength */ + bufferSize += primitive->dataLength; /* CsrUint8 primitive->data */ + return bufferSize; +} + + +CsrUint8* CsrWifiSmeSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiSmeSetReq *primitive = (CsrWifiSmeSetReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint32Ser(ptr, len, (CsrUint32) primitive->dataLength); + if (primitive->dataLength) + { + CsrMemCpySer(ptr, len, (const void *) primitive->data, ((CsrUint16) (primitive->dataLength))); + } + return(ptr); +} + + +void* CsrWifiSmeSetReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiSmeSetReq *primitive = (CsrWifiSmeSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeSetReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint32Des((CsrUint32 *) &primitive->dataLength, buffer, &offset); + if (primitive->dataLength) + { + primitive->data = (CsrUint8 *)CsrPmemAlloc(primitive->dataLength); + CsrMemCpyDes(primitive->data, buffer, &offset, ((CsrUint16) (primitive->dataLength))); + } + else + { + primitive->data = NULL; + } + + return primitive; +} + + +void CsrWifiSmeSetReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiSmeSetReq *primitive = (CsrWifiSmeSetReq *) voidPrimitivePointer; + CsrPmemFree(primitive->data); + CsrPmemFree(primitive); +} + + CsrSize CsrWifiSmeAdhocConfigGetCfmSizeof(void *msg) { CsrSize bufferSize = 2; @@ -5085,7 +5141,7 @@ CsrSize CsrWifiSmeSmeStaConfigGetCfmSizeof(void *msg) bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* CsrUint8 primitive->smeConfig.connectionQualityRssiChangeTrigger */ bufferSize += 1; /* CsrUint8 primitive->smeConfig.connectionQualitySnrChangeTrigger */ - bufferSize += 1; /* CsrUint8 primitive->smeConfig.wmmModeMask */ + bufferSize += 1; /* CsrWifiSmeWmmModeMask primitive->smeConfig.wmmModeMask */ bufferSize += 1; /* CsrWifiSmeRadioIF primitive->smeConfig.ifIndex */ bufferSize += 1; /* CsrBool primitive->smeConfig.allowUnicastUseGroupCipher */ bufferSize += 1; /* CsrBool primitive->smeConfig.enableOpportunisticKeyCaching */ diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.h b/drivers/staging/csr/csr_wifi_sme_serialize.h index c2d7fd6..0080bf4 100644 --- a/drivers/staging/csr/csr_wifi_sme_serialize.h +++ b/drivers/staging/csr/csr_wifi_sme_serialize.h @@ -1,6 +1,6 @@ /***************************************************************************** - (c) Cambridge Silicon Radio Limited 2011 + (c) Cambridge Silicon Radio Limited 2012 All rights reserved and confidential information of CSR Refer to LICENSE.txt included with this source for details @@ -300,6 +300,11 @@ extern void* CsrWifiSmeWpsConfigurationReqDes(CsrUint8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeWpsConfigurationReqSizeof(void *msg); extern void CsrWifiSmeWpsConfigurationReqSerFree(void *msg); +extern CsrUint8* CsrWifiSmeSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeSetReqDes(CsrUint8 *buffer, CsrSize len); +extern CsrSize CsrWifiSmeSetReqSizeof(void *msg); +extern void CsrWifiSmeSetReqSerFree(void *msg); + #define CsrWifiSmeActivateCfmSer CsrWifiEventCsrUint16Ser #define CsrWifiSmeActivateCfmDes CsrWifiEventCsrUint16Des #define CsrWifiSmeActivateCfmSizeof CsrWifiEventCsrUint16Sizeof diff --git a/drivers/staging/csr/drv.c b/drivers/staging/csr/drv.c index 4545fb2..fbe8630 100644 --- a/drivers/staging/csr/drv.c +++ b/drivers/staging/csr/drv.c @@ -47,12 +47,7 @@ int buswidth = 0; /* 0 means use default, values 1,4 */ int sdio_clock = 50000; /* kHz */ int unifi_debug = 0; -/* - * fw_init prevents f/w initialisation on error. - * Unless necessary, avoid usage in the CSR_SME_EMB build because it prevents - * UniFi initialisation after getting out of suspend and also leaves - * UniFi powered when the module unloads. - */ +/* fw_init prevents f/w initialisation on error. */ int fw_init[MAX_UNIFI_DEVS] = {-1, -1}; int use_5g = 0; int led_mask = 0; /* 0x0c00 for dev-pc-1503c, dev-pc-1528a */ @@ -67,6 +62,12 @@ int sdio_byte_mode = 0; /* 0 for block mode + padding, 1 for byte mode */ int coredump_max = CSR_WIFI_HIP_NUM_COREDUMP_BUFFERS; int run_bh_once = -1; /* Set for scheduled interrupt mode, -1 = default */ int bh_priority = -1; +#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE +#define UNIFI_LOG_HIP_SIGNALS_FILTER_SIGNAL (1 << 0) +#define UNIFI_LOG_HIP_SIGNALS_FILTER_BULKDATA (1 << 1) +#define UNIFI_LOG_HIP_SIGNALS_FILTER_TIMESTAMP (1 << 2) +int log_hip_signals = 0; +#endif MODULE_DESCRIPTION("CSR UniFi (SDIO)"); @@ -87,6 +88,9 @@ module_param(sdio_byte_mode, int, S_IRUGO|S_IWUSR); module_param(coredump_max, int, S_IRUGO|S_IWUSR); module_param(run_bh_once, int, S_IRUGO|S_IWUSR); module_param(bh_priority, int, S_IRUGO|S_IWUSR); +#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE +module_param(log_hip_signals, int, S_IRUGO|S_IWUSR); +#endif MODULE_PARM_DESC(buswidth, "SDIO bus width (0=default), set 1 for 1-bit or 4 for 4-bit mode"); MODULE_PARM_DESC(sdio_clock, "SDIO bus frequency in kHz, (default = 50 MHz)"); @@ -105,6 +109,10 @@ MODULE_PARM_DESC(sdio_byte_mode, "Set to 1 for byte mode SDIO"); MODULE_PARM_DESC(coredump_max, "Number of chip mini-coredump buffers to allocate"); MODULE_PARM_DESC(run_bh_once, "Run BH only when firmware interrupts"); MODULE_PARM_DESC(bh_priority, "Modify the BH thread priority"); +#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE +MODULE_PARM_DESC(log_hip_signals, "Set to 1 to enable HIP signal offline logging"); +#endif + /* Callback for event logging to UDI clients */ static void udi_log_event(ul_client_t *client, @@ -193,6 +201,54 @@ trace_putest_cmdid(unifi_putest_command_t putest_cmd) } } +#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE +int uf_register_hip_offline_debug(unifi_priv_t *priv) +{ + ul_client_t *udi_cli; + int i; + + udi_cli = ul_register_client(priv, CLI_USING_WIRE_FORMAT, udi_log_event); + if (udi_cli == NULL) { + /* Too many clients already using this device */ + unifi_error(priv, "Too many UDI clients already open\n"); + return -ENOSPC; + } + unifi_trace(priv, UDBG1, "Offline HIP client is registered\n"); + + down(&priv->udi_logging_mutex); + udi_cli->event_hook = udi_log_event; + unifi_set_udi_hook(priv->card, logging_handler); + /* Log all signals by default */ + for (i = 0; i < SIG_FILTER_SIZE; i++) { + udi_cli->signal_filter[i] = 0xFFFF; + } + priv->logging_client = udi_cli; + up(&priv->udi_logging_mutex); + + return 0; +} + +int uf_unregister_hip_offline_debug(unifi_priv_t *priv) +{ + ul_client_t *udi_cli = priv->logging_client; + if (udi_cli == NULL) + { + unifi_error(priv, "Unknown HIP client unregister request\n"); + return -ERANGE; + } + + unifi_trace(priv, UDBG1, "Offline HIP client is unregistered\n"); + + down(&priv->udi_logging_mutex); + priv->logging_client = NULL; + udi_cli->event_hook = NULL; + up(&priv->udi_logging_mutex); + + ul_deregister_client(udi_cli); + + return 0; +} +#endif /* @@ -312,7 +368,6 @@ unifi_open(struct inode *inode, struct file *file) } /* unifi_open() */ - static int unifi_release(struct inode *inode, struct file *filp) { @@ -354,6 +409,15 @@ unifi_release(struct inode *inode, struct file *filp) } uf_sme_deinit(priv); + + /* It is possible that a blocking SME request was made from another process + * which did not get read by the SME before the WifiOffReq. + * So check for a pending request which will go unanswered and cancel + * the wait for event. As only one blocking request can be in progress at + * a time, up to one event should be completed. + */ + uf_sme_cancel_request(priv, 0); + #endif /* CSR_SME_USERSPACE */ } else { @@ -979,6 +1043,14 @@ unifi_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) goto out; } +#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE + if (log_hip_signals) { + unifi_error(priv, "omnicli cannot be used when log_hip_signals is used\n"); + r = -EFAULT; + goto out; + } +#endif + down(&priv->udi_logging_mutex); if (int_param) { pcli->event_hook = udi_log_event; @@ -1264,6 +1336,11 @@ unifi_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) unifi_info(priv, "UniFi ready\n"); +#ifdef ANDROID_BUILD + /* Release the wakelock */ + unifi_trace(priv, UDBG1, "netdev_init: release wake lock\n"); + wake_unlock(&unifi_sdio_wake_lock); +#endif #ifdef CSR_NATIVE_SOFTMAC /* For softmac dev, force-enable the network interface rather than wait for a connected-ind */ { struct net_device *dev = priv->netdev[interfaceTag]; @@ -1720,6 +1797,40 @@ udi_log_event(ul_client_t *pcli, return; } +#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE + /* When HIP offline signal logging is enabled, omnicli cannot run */ + if (log_hip_signals) + { + /* Add timestamp */ + if (log_hip_signals & UNIFI_LOG_HIP_SIGNALS_FILTER_TIMESTAMP) + { + int timestamp = jiffies_to_msecs(jiffies); + unifi_debug_log_to_buf("T:"); + unifi_debug_log_to_buf("%04X%04X ", *(((CsrUint16*)×tamp) + 1), + *(CsrUint16*)×tamp); + } + + /* Add signal */ + unifi_debug_log_to_buf("S%s:%04X R:%04X D:%04X ", + dir ? "T" : "F", + *(CsrUint16*)signal, + *(CsrUint16*)(signal + 2), + *(CsrUint16*)(signal + 4)); + unifi_debug_hex_to_buf(signal + 6, signal_len - 6); + + /* Add bulk data (assume 1 bulk data per signal) */ + if ((log_hip_signals & UNIFI_LOG_HIP_SIGNALS_FILTER_BULKDATA) && + (bulkdata->d[0].data_length > 0)) + { + unifi_debug_log_to_buf("\nD:"); + unifi_debug_hex_to_buf(bulkdata->d[0].os_data_ptr, bulkdata->d[0].data_length); + } + unifi_debug_log_to_buf("\n"); + + return; + } +#endif + #ifdef CSR_NATIVE_LINUX uf_native_process_udi_signal(pcli, signal, signal_len, bulkdata, dir); #endif @@ -1950,7 +2061,7 @@ int uf_create_device_nodes(unifi_priv_t *priv, int bus_id) priv->unifiudi_cdev.owner = THIS_MODULE; devno = MKDEV(MAJOR(unifi_first_devno), - MINOR(unifi_first_devno) + (bus_id * MAX_UNIFI_DEVS) + 1); + MINOR(unifi_first_devno) + (bus_id * 2) + 1); r = cdev_add(&priv->unifiudi_cdev, devno, 1); if (r) { device_destroy(unifi_class, priv->unifi_cdev.dev); @@ -2081,7 +2192,9 @@ unifi_load(void) #endif printk("CSR native no WEXT support\n"); #endif - +#ifdef CSR_WIFI_SPLIT_PATCH + printk("Split patch support\n"); +#endif printk("Kernel %d.%d.%d\n", ((LINUX_VERSION_CODE) >> 16) & 0xff, ((LINUX_VERSION_CODE) >> 8) & 0xff, diff --git a/drivers/staging/csr/firmware.c b/drivers/staging/csr/firmware.c index 4ac3c89..03da0d5 100644 --- a/drivers/staging/csr/firmware.c +++ b/drivers/staging/csr/firmware.c @@ -296,7 +296,18 @@ uf_run_unifihelper(unifi_priv_t *priv) #endif } /* uf_run_unifihelper() */ +#ifdef CSR_WIFI_SPLIT_PATCH +static CsrBool is_ap_mode(unifi_priv_t *priv) +{ + if (priv == NULL || priv->interfacePriv[0] == NULL) + { + return FALSE; + } + /* Test for mode requiring AP patch */ + return(CSR_WIFI_HIP_IS_AP_FW(priv->interfacePriv[0]->interfaceMode)); +} +#endif /* * --------------------------------------------------------------------------- @@ -334,8 +345,13 @@ int uf_request_firmware_files(unifi_priv_t *priv, int is_fw) if (is_fw == UNIFI_FW_STA) { /* Free kernel buffer and reload */ uf_release_firmware(priv, &priv->fw_sta); +#ifdef CSR_WIFI_SPLIT_PATCH scnprintf(fw_name, UNIFI_MAX_FW_PATH_LEN, "unifi-sdio-%d/%s", - postfix, "sta.xbv"); + postfix, (is_ap_mode(priv) ? "ap.xbv" : "staonly.xbv") ); +#else + scnprintf(fw_name, UNIFI_MAX_FW_PATH_LEN, "unifi-sdio-%d/%s", + postfix, "sta.xbv" ); +#endif r = request_firmware(&fw_entry, fw_name, priv->unifi_device); if (r == 0) { priv->fw_sta.dl_data = fw_entry->data; diff --git a/drivers/staging/csr/io.c b/drivers/staging/csr/io.c index fbf1b20..f489ade 100644 --- a/drivers/staging/csr/io.c +++ b/drivers/staging/csr/io.c @@ -407,6 +407,13 @@ register_unifi_sdio(CsrSdioFunction *sdio_dev, int bus_id, struct device *dev) INIT_WORK(&priv->rx_work_struct, rx_wq_handler); #endif +#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE + if (log_hip_signals) + { + uf_register_hip_offline_debug(priv); + } +#endif + /* Initialise the SME related threads and parameters */ r = uf_sme_init(priv); if (r) { @@ -431,6 +438,12 @@ register_unifi_sdio(CsrSdioFunction *sdio_dev, int bus_id, struct device *dev) return priv; failed4: +#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE +if (log_hip_signals) +{ + uf_unregister_hip_offline_debug(priv); +} +#endif #ifdef CSR_WIFI_RX_PATH_SPLIT flush_workqueue(priv->rx_workqueue); destroy_workqueue(priv->rx_workqueue); @@ -547,6 +560,13 @@ cleanup_unifi_sdio(unifi_priv_t *priv) priv->smepriv = NULL; #endif +#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE + if (log_hip_signals) + { + uf_unregister_hip_offline_debug(priv); + } +#endif + /* Free any packets left in the Rx queues */ for(i=0;ista_wmm_capabilities = 0; +#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_SUPPORT_SME)) priv->wapi_multicast_filter = 0; priv->wapi_unicast_filter = 0; priv->wapi_unicast_queued_pkt_filter = 0; +#ifdef CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND + priv->isWapiConnection = FALSE; +#endif +#endif /* Enable all queues by default */ interfacePriv->queueEnabled[0] = 1; @@ -450,7 +455,15 @@ uf_alloc_netdevice(CsrSdioFunction *sdio_dev, int bus_id) spin_lock_init(&priv->send_signal_lock); spin_lock_init(&priv->m4_lock); - spin_lock_init(&priv->ba_lock); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) + sema_init(&priv->ba_mutex, 1); +#else + init_MUTEX(&priv->ba_mutex); +#endif + +#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION)) + spin_lock_init(&priv->wapi_lock); +#endif #ifdef CSR_SUPPORT_SME spin_lock_init(&priv->staRecord_lock); @@ -472,6 +485,11 @@ uf_alloc_netdevice(CsrSdioFunction *sdio_dev, int bus_id) /* Create m4 buffering work structure */ INIT_WORK(&interfacePriv->send_m4_ready_task, uf_send_m4_ready_wq); + +#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION)) + /* Create work structure to buffer the WAPI data packets to be sent to SME for encryption */ + INIT_WORK(&interfacePriv->send_pkt_to_encrypt, uf_send_pkt_to_encrypt); +#endif #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) @@ -504,6 +522,11 @@ uf_alloc_netdevice(CsrSdioFunction *sdio_dev, int bus_id) } #endif /* CSR_SUPPORT_WEXT */ +#ifdef CSR_WIFI_SPLIT_PATCH + /* set it to some invalid value */ + priv->pending_mode_set.common.destination = 0xaaaa; +#endif + return priv; } /* uf_alloc_netdevice() */ @@ -655,6 +678,19 @@ uf_free_netdevice(unifi_priv_t *priv) } spin_unlock_irqrestore(&priv->m4_lock, flags); +#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION)) + /* Free any bulkdata buffers allocated for M4 caching */ + spin_lock_irqsave(&priv->wapi_lock, flags); + for (i = 0; i < CSR_WIFI_NUM_INTERFACES; i++) { + netInterface_priv_t *interfacePriv = priv->interfacePriv[i]; + if (interfacePriv->wapi_unicast_bulk_data.data_length > 0) { + unifi_trace(priv, UDBG5, "uf_free_netdevice: free WAPI PKT bulk data %d\n", i); + unifi_net_data_free(priv, &interfacePriv->wapi_unicast_bulk_data); + } + } + spin_unlock_irqrestore(&priv->wapi_lock, flags); +#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) #ifdef CONFIG_NET_SCHED /* Unregister the qdisc operations */ @@ -1556,7 +1592,7 @@ int prepare_and_add_macheader(unifi_priv_t *priv, struct sk_buff *skb, struct sk /* IF Qos Data or Qos Null Data then set QosControl field */ if ((priority != CSR_CONTENTION) && (macHeaderLengthInBytes >= QOS_CONTROL_HEADER_SIZE)) { - if (priority >= 7) { + if (priority > 7) { unifi_trace(priv, UDBG1, "data packets priority is more than 7, priority = %x\n", priority); qc |= 7; } else { @@ -1628,6 +1664,7 @@ send_ma_pkt_request(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr CSR_TRANSMISSION_CONTROL transmissionControl = CSR_NO_CONFIRM_REQUIRED; CsrInt8 protection; netInterface_priv_t *interfacePriv = NULL; + CSR_RATE TransmitRate = (CSR_RATE)0; unifi_trace(priv, UDBG5, "entering send_ma_pkt_request\n"); @@ -1780,6 +1817,63 @@ send_ma_pkt_request(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr return 0; } #endif + }/*EAPOL or WAI packet*/ + +#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION)) + if ((CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) && \ + (priv->wapi_unicast_filter) && \ + (proto != ETH_P_PAE) && \ + (proto != ETH_P_WAI) && \ + (skb->len > 0)) + { + CSR_SIGNAL signal; + CSR_MA_PACKET_REQUEST *req = &signal.u.MaPacketRequest; + netInterface_priv_t *netpriv = (netInterface_priv_t *)netdev_priv(priv->netdev[interfaceTag]); + + unifi_trace(priv, UDBG4, "send_ma_pkt_request() - WAPI unicast data packet when USKID = 1 \n"); + + /* initialize signal to zero */ + memset(&signal, 0, sizeof(CSR_SIGNAL)); + /* Frame MA_PACKET request */ + signal.SignalPrimitiveHeader.SignalId = CSR_MA_PACKET_REQUEST_ID; + signal.SignalPrimitiveHeader.ReceiverProcessId = 0; + signal.SignalPrimitiveHeader.SenderProcessId = priv->netdev_client->sender_id; + + /* Fill the MA-PACKET.req */ + req->TransmissionControl = 0; + req->Priority = priority; + unifi_trace(priv, UDBG3, "Tx Frame with Priority: %x\n", req->Priority); + req->TransmitRate = (CSR_RATE) 0; /* rate selected by firmware */ + req->HostTag = 0xffffffff; /* Ask for a new HostTag */ + /* RA address matching with address 1 of Mac header */ + memcpy(req->Ra.x, ((CsrUint8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN); + + /* Store the M4-PACKET.req for later */ + spin_lock(&priv->wapi_lock); + interfacePriv->wapi_unicast_ma_pkt_sig = signal; + interfacePriv->wapi_unicast_bulk_data.net_buf_length = bulkdata.d[0].net_buf_length; + interfacePriv->wapi_unicast_bulk_data.data_length = bulkdata.d[0].data_length; + interfacePriv->wapi_unicast_bulk_data.os_data_ptr = bulkdata.d[0].os_data_ptr; + interfacePriv->wapi_unicast_bulk_data.os_net_buf_ptr = bulkdata.d[0].os_net_buf_ptr; + spin_unlock(&priv->wapi_lock); + + /* Signal the workqueue to call CsrWifiRouterCtrlWapiUnicastTxEncryptIndSend(). + * It cannot be called directly from the tx path because it + * does a non-atomic kmalloc via the framework's CsrPmemAlloc(). + */ + queue_work(priv->unifi_workqueue, &netpriv->send_pkt_to_encrypt); + + return 0; + } +#endif + + if(priv->cmanrTestMode) + { + TransmitRate = priv->cmanrTestModeTransmitRate; + unifi_trace(priv, UDBG2, "send_ma_pkt_request: cmanrTestModeTransmitRate = %d TransmitRate=%d\n", + priv->cmanrTestModeTransmitRate, + TransmitRate + ); } /* Send UniFi msg */ @@ -1789,7 +1883,7 @@ send_ma_pkt_request(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr 0xffffffff, /* Ask for a new HostTag */ interfaceTag, transmissionControl, - (CSR_RATE)0, + TransmitRate, priority, priv->netdev_client->sender_id, &bulkdata); @@ -1900,8 +1994,22 @@ uf_net_xmit(struct sk_buff *skb, struct net_device *dev) #endif /* CONFIG_NET_SCHED */ if (result == NETDEV_TX_OK) { +#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION)) + /* Don't update the tx stats when the pkt is to be sent for sw encryption*/ + if (!((CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) && + (priv->wapi_unicast_filter == 1))) + { + dev->trans_start = jiffies; + /* Should really count tx stats in the UNITDATA.status signal but + * that doesn't have the length. + */ + interfacePriv->stats.tx_packets++; + /* count only the packet payload */ + interfacePriv->stats.tx_bytes += skb->len; - dev->trans_start = jiffies; + } +#else + dev->trans_start = jiffies; /* * Should really count tx stats in the UNITDATA.status signal but @@ -1910,7 +2018,7 @@ uf_net_xmit(struct sk_buff *skb, struct net_device *dev) interfacePriv->stats.tx_packets++; /* count only the packet payload */ interfacePriv->stats.tx_bytes += skb->len; - +#endif } else if (result < 0) { /* Failed to send: fh queue was full, and the skb was discarded. @@ -2118,6 +2226,13 @@ indicate_rx_skb(unifi_priv_t *priv, CsrUint16 ifTag, CsrUint8* dst_a, CsrUint8* } + if(priv->cmanrTestMode) + { + const CSR_MA_PACKET_INDICATION *pkt_ind = &signal->u.MaPacketIndication; + priv->cmanrTestModeTransmitRate = pkt_ind->ReceivedRate; + unifi_trace(priv, UDBG2, "indicate_rx_skb: cmanrTestModeTransmitRate=%d\n", priv->cmanrTestModeTransmitRate); + } + /* Pass SKB up the stack */ #ifdef CSR_WIFI_USE_NETIF_RX netif_rx(skb); @@ -2780,36 +2895,17 @@ static void process_ma_packet_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_d if((dataFrameType == QOS_DATA) || (dataFrameType == QOS_DATA_NULL)){ /* - QoS control field is offset from frame control by 2 (frame control) - + 2 (duration/ID) + 2 (sequence control) + 3*ETH_ALEN or 4*ETH_ALEN - */ + * QoS control field is offset from frame control by 2 (frame control) + * + 2 (duration/ID) + 2 (sequence control) + 3*ETH_ALEN or 4*ETH_ALEN + */ if((frameControl & IEEE802_11_FC_TO_DS_MASK) && (frameControl & IEEE802_11_FC_FROM_DS_MASK)){ qosControl= CSR_GET_UINT16_FROM_LITTLE_ENDIAN(pData->os_data_ptr + 30); } else{ qosControl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(pData->os_data_ptr + 24); } - - if((IS_DTIM_ACTIVE(interfacePriv->dtimActive,interfacePriv->multicastPduHostTag))){ - CSR_PRIORITY priority; - unifi_TrafficQueue priority_q; - priority = (CSR_PRIORITY)(qosControl & IEEE802_11_QC_TID_MASK); - priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY) priority); - if((srcStaInfo->powersaveMode[priority_q]==CSR_WIFI_AC_TRIGGER_ONLY_ENABLED) - ||(srcStaInfo->powersaveMode[priority_q]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)){ - unsigned long lock_flags; - spin_lock_irqsave(&priv->staRecord_lock,lock_flags); - srcStaInfo->uapsdSuspended = TRUE; - spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); - unifi_trace(priv, UDBG3, "%s: qos Trigger Frame received while DTIM Active for staid: 0x%x\n",__FUNCTION__,srcStaInfo->aid); - } - } - else{ - - - unifi_trace(priv, UDBG5, "%s: Check if U-APSD operations are triggered for qosControl: 0x%x\n",__FUNCTION__,qosControl); - uf_process_wmm_deliver_ac_uapsd(priv,srcStaInfo,qosControl,interfaceTag); - } + unifi_trace(priv, UDBG5, "%s: Check if U-APSD operations are triggered for qosControl: 0x%x\n",__FUNCTION__,qosControl); + uf_process_wmm_deliver_ac_uapsd(priv,srcStaInfo,qosControl,interfaceTag); } } } @@ -2829,7 +2925,7 @@ static void process_ma_packet_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_d ba_addr = bssid; } - spin_lock(&priv->ba_lock); + down(&priv->ba_mutex); for (ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX; ba_session_idx++){ ba_session = interfacePriv->ba_session_rx[ba_session_idx]; if (ba_session){ @@ -2842,14 +2938,14 @@ static void process_ma_packet_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_d frame_desc.active = TRUE; unifi_trace(priv, UDBG6, "%s: calling process_ba_frame (session=%d)\n", __FUNCTION__, ba_session_idx); process_ba_frame(priv, interfacePriv, ba_session, &frame_desc); - spin_unlock(&priv->ba_lock); + up(&priv->ba_mutex); process_ba_complete(priv, interfacePriv); break; } } } if (ba_session_idx == MAX_SUPPORTED_BA_SESSIONS_RX){ - spin_unlock(&priv->ba_lock); + up(&priv->ba_mutex); unifi_trace(priv, UDBG6, "%s: calling process_amsdu()", __FUNCTION__); process_amsdu(priv, signal, bulkdata); } @@ -2865,7 +2961,7 @@ static void process_ma_packet_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_d * And also this code here takes care that timeout check is made for all * the receive indications */ - spin_lock(&priv->ba_lock); + down(&priv->ba_mutex); for (i=0; i < MAX_SUPPORTED_BA_SESSIONS_RX; i++){ ba_session_rx_struct *ba_session; ba_session = interfacePriv->ba_session_rx[i]; @@ -2873,8 +2969,8 @@ static void process_ma_packet_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_d check_ba_frame_age_timeout(priv, interfacePriv, ba_session); } } + up(&priv->ba_mutex); process_ba_complete(priv, interfacePriv); - spin_unlock(&priv->ba_lock); func_exit(); } @@ -3879,7 +3975,7 @@ static void process_ma_packet_error_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, } sn = pkt_err_ind->SequenceNumber; - spin_lock(&priv->ba_lock); + down(&priv->ba_mutex); /* To find the right ba_session loop through the BA sessions, compare MAC address and tID */ for (ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX; ba_session_idx++){ ba_session = interfacePriv->ba_session_rx[ba_session_idx]; @@ -3894,7 +3990,7 @@ static void process_ma_packet_error_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, } } - spin_unlock(&priv->ba_lock); + up(&priv->ba_mutex); process_ba_complete(priv, interfacePriv); func_exit(); } diff --git a/drivers/staging/csr/os.c b/drivers/staging/csr/os.c index 6dfce42..f5a9352 100644 --- a/drivers/staging/csr/os.c +++ b/drivers/staging/csr/os.c @@ -204,12 +204,10 @@ extern int unifi_debug; (_s)[DEBUG_BUFFER_SIZE - 1] = 0; \ } \ } while (0) -#endif /* UNIFI_DEBUG */ void unifi_error(void* ospriv, const char *fmt, ...) { -#ifdef UNIFI_DEBUG unifi_priv_t *priv = (unifi_priv_t*) ospriv; char s[DEBUG_BUFFER_SIZE]; va_list args; @@ -230,13 +228,11 @@ unifi_error(void* ospriv, const char *fmt, ...) FORMAT_TRACE(s, len, args, fmt); printk("%s", s); -#endif /* UNIFI_DEBUG */ } void unifi_warning(void* ospriv, const char *fmt, ...) { -#ifdef UNIFI_DEBUG unifi_priv_t *priv = (unifi_priv_t*) ospriv; char s[DEBUG_BUFFER_SIZE]; va_list args; @@ -259,14 +255,12 @@ unifi_warning(void* ospriv, const char *fmt, ...) FORMAT_TRACE(s, len, args, fmt); printk("%s", s); -#endif /* UNIFI_DEBUG */ } void unifi_notice(void* ospriv, const char *fmt, ...) { -#ifdef UNIFI_DEBUG unifi_priv_t *priv = (unifi_priv_t*) ospriv; char s[DEBUG_BUFFER_SIZE]; va_list args; @@ -289,14 +283,12 @@ unifi_notice(void* ospriv, const char *fmt, ...) FORMAT_TRACE(s, len, args, fmt); printk("%s", s); -#endif /* UNIFI_DEBUG */ } void unifi_info(void* ospriv, const char *fmt, ...) { -#ifdef UNIFI_DEBUG unifi_priv_t *priv = (unifi_priv_t*) ospriv; char s[DEBUG_BUFFER_SIZE]; va_list args; @@ -319,14 +311,12 @@ unifi_info(void* ospriv, const char *fmt, ...) FORMAT_TRACE(s, len, args, fmt); printk("%s", s); -#endif /* UNIFI_DEBUG */ } /* debugging */ void unifi_trace(void* ospriv, int level, const char *fmt, ...) { -#ifdef UNIFI_DEBUG unifi_priv_t *priv = (unifi_priv_t*) ospriv; char s[DEBUG_BUFFER_SIZE]; va_list args; @@ -351,9 +341,23 @@ unifi_trace(void* ospriv, int level, const char *fmt, ...) printk("%s", s); } -#endif /* UNIFI_DEBUG */ } +#else + +void +unifi_error_nop(void* ospriv, const char *fmt, ...) +{ +} + +void +unifi_trace_nop(void* ospriv, int level, const char *fmt, ...) +{ +} + +#endif /* UNIFI_DEBUG */ + + /* * --------------------------------------------------------------------------- * diff --git a/drivers/staging/csr/putest.c b/drivers/staging/csr/putest.c index 1b2c7c2..22614e7 100644 --- a/drivers/staging/csr/putest.c +++ b/drivers/staging/csr/putest.c @@ -180,8 +180,9 @@ int unifi_putest_gp_read16(unifi_priv_t *priv, unsigned char *arg) "unifi_putest_gp_read16: Failed to get the params\n"); return -EFAULT; } - + CsrSdioClaim(priv->sdio); csrResult = unifi_card_read16(priv->card, gp_r16_params.addr, &gp_r16_params.data); + CsrSdioRelease(priv->sdio); if (csrResult != CSR_RESULT_SUCCESS) { unifi_error(priv, "unifi_putest_gp_read16: unifi_card_read16() GP=0x%x failed (csrResult=0x%x)\n", gp_r16_params.addr, csrResult); @@ -240,8 +241,9 @@ int unifi_putest_gp_write16(unifi_priv_t *priv, unsigned char *arg) } unifi_trace(priv, UDBG2, "gp_w16: GP=0x%08x, data=0x%04x\n", gp_w16_params.addr, gp_w16_params.data); - + CsrSdioClaim(priv->sdio); csrResult = unifi_card_write16(priv->card, gp_w16_params.addr, gp_w16_params.data); + CsrSdioRelease(priv->sdio); if (csrResult != CSR_RESULT_SUCCESS) { unifi_error(priv, "unifi_putest_gp_write16: unifi_card_write16() GP=%x failed (csrResult=0x%x)\n", gp_w16_params.addr, csrResult); @@ -265,7 +267,7 @@ int unifi_putest_set_sdio_clock(unifi_priv_t *priv, unsigned char *arg) unifi_trace(priv, UDBG2, "set sdio clock: %d KHz\n", sdio_clock_speed); CsrSdioClaim(priv->sdio); - csrResult = CsrSdioMaxBusClockFrequencySet(priv->sdio, sdio_clock_speed); + csrResult = CsrSdioMaxBusClockFrequencySet(priv->sdio, sdio_clock_speed * 1000); CsrSdioRelease(priv->sdio); if (csrResult != CSR_RESULT_SUCCESS) { unifi_error(priv, @@ -304,7 +306,9 @@ int unifi_putest_start(unifi_priv_t *priv, unsigned char *arg) /* Application may have stopped the XAPs, but they are needed for reset */ if (already_in_test) { + CsrSdioClaim(priv->sdio); csrResult = unifi_start_processors(priv->card); + CsrSdioRelease(priv->sdio); if (csrResult != CSR_RESULT_SUCCESS) { unifi_error(priv, "Failed to start XAPs. Hard reset required.\n"); } @@ -317,8 +321,9 @@ int unifi_putest_start(unifi_priv_t *priv, unsigned char *arg) unifi_error(priv, "CsrSdioPowerOn csrResult = %d\n", csrResult); } } - + CsrSdioClaim(priv->sdio); csrResult = unifi_init(priv->card); + CsrSdioRelease(priv->sdio); if (csrResult != CSR_RESULT_SUCCESS) { unifi_error(priv, "unifi_putest_start: failed to init UniFi\n"); @@ -335,7 +340,9 @@ int unifi_putest_stop(unifi_priv_t *priv, unsigned char *arg) CsrResult csrResult; /* Application may have stopped the XAPs, but they are needed for reset */ + CsrSdioClaim(priv->sdio); csrResult = unifi_start_processors(priv->card); + CsrSdioRelease(priv->sdio); if (csrResult != CSR_RESULT_SUCCESS) { unifi_error(priv, "Failed to start XAPs. Hard reset required.\n"); } @@ -428,7 +435,9 @@ int unifi_putest_dl_fw(unifi_priv_t *priv, unsigned char *arg) } /* Application may have stopped the XAPs, but they are needed for reset */ + CsrSdioClaim(priv->sdio); csrResult = unifi_start_processors(priv->card); + CsrSdioRelease(priv->sdio); if (csrResult != CSR_RESULT_SUCCESS) { unifi_error(priv, "Failed to start XAPs. Hard reset required.\n"); } @@ -436,7 +445,9 @@ int unifi_putest_dl_fw(unifi_priv_t *priv, unsigned char *arg) /* Download the f/w. On UF6xxx this will cause the f/w file to convert * into patch format and download via the ROM boot loader */ + CsrSdioClaim(priv->sdio); csrResult = unifi_download(priv->card, 0x0c00); + CsrSdioRelease(priv->sdio); if (csrResult != CSR_RESULT_SUCCESS) { unifi_error(priv, "unifi_putest_dl_fw: failed to download the f/w\n"); @@ -504,7 +515,9 @@ int unifi_putest_dl_fw_buff(unifi_priv_t *priv, unsigned char *arg) priv->fw_sta.dl_len = fw_length; /* Application may have stopped the XAPs, but they are needed for reset */ + CsrSdioClaim(priv->sdio); csrResult = unifi_start_processors(priv->card); + CsrSdioRelease(priv->sdio); if (csrResult != CSR_RESULT_SUCCESS) { unifi_error(priv, "Failed to start XAPs. Hard reset required.\n"); } @@ -512,7 +525,9 @@ int unifi_putest_dl_fw_buff(unifi_priv_t *priv, unsigned char *arg) /* Download the f/w. On UF6xxx this will cause the f/w file to convert * into patch format and download via the ROM boot loader */ + CsrSdioClaim(priv->sdio); csrResult = unifi_download(priv->card, 0x0c00); + CsrSdioRelease(priv->sdio); if (csrResult != CSR_RESULT_SUCCESS) { unifi_error(priv, "unifi_putest_dl_fw_buff: failed to download the f/w\n"); @@ -581,7 +596,9 @@ int unifi_putest_coredump_prepare(unifi_priv_t *priv, unsigned char *arg) } /* Card software reset */ + CsrSdioClaim(priv->sdio); r = unifi_card_hard_reset(priv->card); + CsrSdioRelease(priv->sdio); if (r != CSR_RESULT_SUCCESS) { unifi_error(priv, "unifi_card_hard_reset() failed %d\n", r); } @@ -599,7 +616,9 @@ int unifi_putest_coredump_prepare(unifi_priv_t *priv, unsigned char *arg) /* Stop the XAPs for coredump. The PUTEST_STOP must be called, e.g. at * Raw SDIO deinit, to resume them. */ + CsrSdioClaim(priv->sdio); r = unifi_card_stop_processor(priv->card, UNIFI_PROC_BOTH); + CsrSdioRelease(priv->sdio); if (r != CSR_RESULT_SUCCESS) { unifi_error(priv, "Failed to stop processors\n"); } @@ -646,7 +665,9 @@ int unifi_putest_cmd52_block_read(unifi_priv_t *priv, unsigned char *arg) return -ENOMEM; } + CsrSdioClaim(priv->sdio); r = unifi_card_readn(priv->card, block_cmd52.addr, block_local_buffer, block_cmd52.length); + CsrSdioRelease(priv->sdio); if (r != CSR_RESULT_SUCCESS) { unifi_error(priv, "cmd52r_block: unifi_readn failed\n"); return -EIO; diff --git a/drivers/staging/csr/sdio_emb.c b/drivers/staging/csr/sdio_emb.c index f61fdb1..b6a7d6f 100644 --- a/drivers/staging/csr/sdio_emb.c +++ b/drivers/staging/csr/sdio_emb.c @@ -17,6 +17,7 @@ */ #include #include +#include #include "csr_wifi_hip_unifi.h" #include "unifi_priv.h" @@ -25,7 +26,16 @@ /* The function driver context, i.e the UniFi Driver */ static CsrSdioFunctionDriver *sdio_func_drv; +#ifdef CONFIG_PM +static int uf_sdio_emb_power_event(struct notifier_block *this, unsigned long event, void *ptr); +#endif +/* The Android wakelock is here for completeness. Typically the MMC driver is used + * instead of sdioemb, but sdioemb may be used for CSPI. + */ +#ifdef ANDROID_BUILD +struct wake_lock unifi_sdio_wake_lock; /* wakelock to prevent suspend while resuming */ +#endif /* sdioemb driver uses POSIX error codes */ static CsrResult @@ -501,6 +511,131 @@ uf_glue_sdio_int_handler(struct sdioemb_dev *fdev) } } +#ifdef CONFIG_PM + +/* + * Power Management notifier + */ +struct uf_sdio_emb_pm_notifier +{ + struct list_head list; + + CsrSdioFunction *sdio_ctx; + struct notifier_block pm_notifier; +}; + +/* PM notifier list head */ +static struct uf_sdio_emb_pm_notifier uf_sdio_emb_pm_notifiers = { + .sdio_ctx = NULL, +}; + +/* + * --------------------------------------------------------------------------- + * uf_sdio_emb_register_pm_notifier + * uf_sdio_emb_unregister_pm_notifier + * + * Register/unregister for power management events. A list is used to + * allow multiple card instances to be supported. + * + * Arguments: + * sdio_ctx - CSR SDIO context to associate PM notifier to + * + * Returns: + * Register function returns NULL on error + * --------------------------------------------------------------------------- + */ +static struct uf_sdio_emb_pm_notifier * +uf_sdio_emb_register_pm_notifier(CsrSdioFunction *sdio_ctx) +{ + /* Allocate notifier context for this card instance */ + struct uf_sdio_emb_pm_notifier *notifier_ctx = kmalloc(sizeof(struct uf_sdio_emb_pm_notifier), GFP_KERNEL); + + if (notifier_ctx) + { + notifier_ctx->sdio_ctx = sdio_ctx; + notifier_ctx->pm_notifier.notifier_call = uf_sdio_emb_power_event; + + list_add(¬ifier_ctx->list, &uf_sdio_emb_pm_notifiers.list); + + if (register_pm_notifier(¬ifier_ctx->pm_notifier)) { + printk(KERN_ERR "unifi: register_pm_notifier failed\n"); + } + } + + return notifier_ctx; +} + +static void +uf_sdio_emb_unregister_pm_notifier(CsrSdioFunction *sdio_ctx) +{ + struct uf_sdio_emb_pm_notifier *notifier_ctx; + struct list_head *node, *q; + + list_for_each_safe(node, q, &uf_sdio_emb_pm_notifiers.list) { + notifier_ctx = list_entry(node, struct uf_sdio_emb_pm_notifier, list); + + /* If it matches, unregister and free the notifier context */ + if (notifier_ctx && notifier_ctx->sdio_ctx == sdio_ctx) + { + if (unregister_pm_notifier(¬ifier_ctx->pm_notifier)) { + printk(KERN_ERR "unifi: unregister_pm_notifier failed\n"); + } + + /* Remove from list */ + notifier_ctx->sdio_ctx = NULL; + list_del(node); + kfree(notifier_ctx); + } + } +} + +/* + * --------------------------------------------------------------------------- + * uf_sdio_emb_power_event + * + * Handler for power management events. + * + * We need to handle suspend/resume events while the userspace is unsuspended + * to allow the SME to run its suspend/resume state machines. + * + * Arguments: + * event event ID + * + * Returns: + * Status of the event handling + * --------------------------------------------------------------------------- + */ +static int +uf_sdio_emb_power_event(struct notifier_block *this, unsigned long event, void *ptr) +{ + struct uf_sdio_emb_pm_notifier *notifier_ctx = container_of(this, + struct uf_sdio_emb_pm_notifier, + pm_notifier); + + /* Call the CSR SDIO function driver's suspend/resume method + * while the userspace is unsuspended. + */ + switch (event) { + case PM_POST_HIBERNATION: + case PM_POST_SUSPEND: + printk(KERN_INFO "%s:%d resume\n", __FUNCTION__, __LINE__ ); + if (sdio_func_drv && sdio_func_drv->resume) { + sdio_func_drv->resume(notifier_ctx->sdio_ctx); + } + break; + + case PM_HIBERNATION_PREPARE: + case PM_SUSPEND_PREPARE: + printk(KERN_INFO "%s:%d suspend\n", __FUNCTION__, __LINE__ ); + if (sdio_func_drv && sdio_func_drv->suspend) { + sdio_func_drv->suspend(notifier_ctx->sdio_ctx); + } + break; + } + return NOTIFY_DONE; +} + +#endif /* CONFIG_PM */ /* * --------------------------------------------------------------------------- @@ -550,16 +685,30 @@ uf_glue_sdio_probe(struct sdioemb_dev *fdev) unifi_trace(NULL, UDBG1, "Setting SDIO bus clock to %d kHz\n", sdio_clock); sdioemb_set_max_bus_freq(fdev, 1000 * sdio_clock); +#ifdef CONFIG_PM + /* Register to get PM events */ + if (uf_sdio_emb_register_pm_notifier(sdio_ctx) == NULL) { + unifi_error(NULL, "%s: Failed to register for PM events\n", __FUNCTION__); + } +#endif + /* Call the main UniFi driver inserted handler */ if (sdio_func_drv && sdio_func_drv->inserted) { uf_add_os_device(fdev->slot_id, fdev->os_device); sdio_func_drv->inserted(sdio_ctx); } +#ifdef ANDROID_BUILD + /* Take the wakelock */ + unifi_trace(NULL, UDBG1, "emb probe: take wake lock\n"); + wake_lock(&unifi_sdio_wake_lock); +#endif + return 0; } /* uf_glue_sdio_probe() */ + /* * --------------------------------------------------------------------------- * uf_sdio_remove @@ -585,6 +734,11 @@ uf_sdio_remove(struct sdioemb_dev *fdev) sdio_func_drv->removed(sdio_ctx); } +#ifdef CONFIG_PM + /* Unregister for PM events */ + uf_sdio_emb_unregister_pm_notifier(sdio_ctx); +#endif + kfree(sdio_ctx); } /* uf_sdio_remove */ @@ -606,14 +760,7 @@ uf_sdio_remove(struct sdioemb_dev *fdev) static void uf_glue_sdio_suspend(struct sdioemb_dev *fdev) { - CsrSdioFunction *sdio_ctx = fdev->drv_data; - - unifi_trace(NULL, UDBG3, "Suspending...\n"); - - /* Pass event to UniFi Driver. */ - if (sdio_func_drv && sdio_func_drv->suspend) { - sdio_func_drv->suspend(sdio_ctx); - } + unifi_info(NULL, "Suspending...\n"); } /* uf_glue_sdio_suspend() */ @@ -634,14 +781,13 @@ uf_glue_sdio_suspend(struct sdioemb_dev *fdev) static void uf_glue_sdio_resume(struct sdioemb_dev *fdev) { - CsrSdioFunction *sdio_ctx = fdev->drv_data; + unifi_info(NULL, "Resuming...\n"); - unifi_trace(NULL, UDBG3, "Resuming...\n"); +#ifdef ANDROID_BUILD + unifi_trace(NULL, UDBG1, "emb resume: take wakelock\n"); + wake_lock(&unifi_sdio_wake_lock); +#endif - /* Pass event to UniFi Driver. */ - if (sdio_func_drv && sdio_func_drv->resume) { - sdio_func_drv->resume(sdio_ctx); - } } /* uf_glue_sdio_resume() */ @@ -708,6 +854,15 @@ CsrSdioFunctionDriverRegister(CsrSdioFunctionDriver *sdio_drv) /* Save the registered driver description */ sdio_func_drv = sdio_drv; +#ifdef CONFIG_PM + /* Initialise PM notifier list */ + INIT_LIST_HEAD(&uf_sdio_emb_pm_notifiers.list); +#endif + +#ifdef ANDROID_BUILD + wake_lock_init(&unifi_sdio_wake_lock, WAKE_LOCK_SUSPEND, "unifi_sdio_work"); +#endif + /* Register ourself with sdioemb */ r = sdioemb_driver_register(&unifi_sdioemb); if (r) { @@ -724,6 +879,10 @@ CsrSdioFunctionDriverUnregister(CsrSdioFunctionDriver *sdio_drv) { sdioemb_driver_unregister(&unifi_sdioemb); +#ifdef ANDROID_BUILD + wake_lock_destroy(&unifi_sdio_wake_lock); +#endif + sdio_func_drv = NULL; CsrPmemFree(unifi_sdioemb.id_table); diff --git a/drivers/staging/csr/sdio_events.c b/drivers/staging/csr/sdio_events.c index e4f2d0d..6892c2e 100644 --- a/drivers/staging/csr/sdio_events.c +++ b/drivers/staging/csr/sdio_events.c @@ -47,6 +47,12 @@ void unifi_suspend(void *ospriv) unifi_priv_t *priv = ospriv; int interfaceTag=0; + /* For powered suspend, tell the resume's wifi_on() not to reinit UniFi */ + priv->wol_suspend = (enable_wol == UNIFI_WOL_OFF) ? FALSE : TRUE; + + unifi_trace(priv, UDBG1, "unifi_suspend: wol_suspend %d, enable_wol %d", + priv->wol_suspend, enable_wol ); + /* Stop network traffic. */ /* need to stop all the netdevices*/ for( interfaceTag=0;interfaceTaginterfacePriv[interfaceTag]; if (interfacePriv->netdev_registered == 1) { - netif_carrier_off(priv->netdev[interfaceTag]); + if( priv->wol_suspend ) { + unifi_trace(priv, UDBG1, "unifi_suspend: Don't netif_carrier_off"); + } else { + unifi_trace(priv, UDBG1, "unifi_suspend: netif_carrier_off"); + netif_carrier_off(priv->netdev[interfaceTag]); + } UF_NETIF_TX_STOP_ALL_QUEUES(priv->netdev[interfaceTag]); } } + + unifi_trace(priv, UDBG1, "unifi_suspend: suspend SME"); + sme_sys_suspend(priv); + } /* unifi_suspend() */ @@ -76,12 +91,44 @@ void unifi_suspend(void *ospriv) void unifi_resume(void *ospriv) { unifi_priv_t *priv = ospriv; + int interfaceTag=0; int r; + int wol = priv->wol_suspend; + + unifi_trace(priv, UDBG1, "unifi_resume: resume SME, enable_wol=%d", enable_wol); + /* The resume causes wifi-on which will re-enable the BH and reinstall the ISR */ r = sme_sys_resume(priv); if (r) { unifi_error(priv, "Failed to resume UniFi\n"); } + /* Resume the network interfaces. For the cold resume case, this will + * happen upon reconnection. + */ + if (wol) { + unifi_trace(priv, UDBG1, "unifi_resume: try to enable carrier"); + + /* need to start all the netdevices*/ + for( interfaceTag=0;interfaceTaginterfacePriv[interfaceTag]; + + unifi_trace(priv, UDBG1, "unifi_resume: interfaceTag %d netdev_registered %d mode %d\n", + interfaceTag, interfacePriv->netdev_registered, interfacePriv->interfaceMode); + + if (interfacePriv->netdev_registered == 1) + { + netif_carrier_on(priv->netdev[interfaceTag]); + UF_NETIF_TX_START_ALL_QUEUES(priv->netdev[interfaceTag]); + } + } + + /* Kick the BH thread (with reason=host) to poll for data that may have + * arrived during a powered suspend. This caters for the case where the SME + * doesn't interact with the chip (e.g install autonomous scans) during resume. + */ + unifi_send_signal(priv->card, NULL, 0, NULL); + } + } /* unifi_resume() */ diff --git a/drivers/staging/csr/sdio_mmc.c b/drivers/staging/csr/sdio_mmc.c index c850834..24be087 100644 --- a/drivers/staging/csr/sdio_mmc.c +++ b/drivers/staging/csr/sdio_mmc.c @@ -21,19 +21,28 @@ #include #include #include +#include #include "unifi_priv.h" +#ifdef ANDROID_BUILD +struct wake_lock unifi_sdio_wake_lock; /* wakelock to prevent suspend while resuming */ +#endif static CsrSdioFunctionDriver *sdio_func_drv; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) +#ifdef CONFIG_PM +static int uf_sdio_mmc_power_event(struct notifier_block *this, unsigned long event, void *ptr); +#endif + /* * We need to keep track of the power on/off because we can not call * mmc_power_restore_host() when the card is already powered. * Even then, we need to patch the MMC driver to add a power_restore handler - * in the mmc_sdio_ops structure. If the MMC driver is not patched, - * mmc_power_save_host() and mmc_power_restore_host() are no-ops. + * in the mmc_sdio_ops structure. If the MMC driver before 2.6.37 is not patched, + * mmc_power_save_host() and mmc_power_restore_host() are no-ops in the kernel, + * returning immediately (at least on x86). */ static int card_is_powered = 1; #endif /* 2.6.32 */ @@ -312,17 +321,28 @@ csr_sdio_enable_hs(struct mmc_card *card) int ret; u8 speed; - if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED)) + if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED)) { + /* We've asked for HS clock rates, but controller doesn't + * claim to support it. We should limit the clock + * to 25MHz via module parameter. + */ + printk(KERN_INFO "unifi: request HS but not MMC_CAP_SD_HIGHSPEED"); return 0; + } if (!card->cccr.high_speed) return 0; +#if 1 ret = csr_io_rw_direct(card, 0, 0, SDIO_CCCR_SPEED, 0, &speed); if (ret) return ret; speed |= SDIO_SPEED_EHS; +#else + /* Optimisation: Eliminate read by always assuming SHS and that reserved bits can be zero */ + speed = SDIO_SPEED_EHS | SDIO_SPEED_SHS; +#endif ret = csr_io_rw_direct(card, 1, 0, SDIO_CCCR_SPEED, speed, NULL); if (ret) @@ -346,12 +366,16 @@ csr_sdio_disable_hs(struct mmc_card *card) if (!card->cccr.high_speed) return 0; - +#if 1 ret = csr_io_rw_direct(card, 0, 0, SDIO_CCCR_SPEED, 0, &speed); if (ret) return ret; speed &= ~SDIO_SPEED_EHS; +#else + /* Optimisation: Eliminate read by always assuming SHS and that reserved bits can be zero */ + speed = SDIO_SPEED_SHS; /* clear SDIO_SPEED_EHS */ +#endif ret = csr_io_rw_direct(card, 1, 0, SDIO_CCCR_SPEED, speed, NULL); if (ret) @@ -460,6 +484,7 @@ CsrSdioInterruptEnable(CsrSdioFunction *function) func_exit(); if (err) { + printk(KERN_ERR "unifi: %s: error %d writing IENx\n", __FUNCTION__, err); return ConvertSdioToCsrSdioResult(err); } #endif @@ -486,6 +511,7 @@ CsrSdioInterruptDisable(CsrSdioFunction *function) func_exit(); if (err) { + printk(KERN_ERR "unifi: %s: error %d writing IENx\n", __FUNCTION__, err); return ConvertSdioToCsrSdioResult(err); } #endif @@ -772,6 +798,7 @@ uf_glue_sdio_int_handler(struct sdio_func *func) if (!sdio_ctx) { return; } + #ifndef CSR_CONFIG_MMC_INT_BYPASS_KSOFTIRQD /* * Normally, we are not allowed to do any SDIO commands here. @@ -785,7 +812,7 @@ uf_glue_sdio_int_handler(struct sdio_func *func) r = csr_io_rw_direct(func->card, 1, 0, SDIO_CCCR_IENx, 0x00, NULL); #endif if (r) { - printk(KERN_ERR "UniFi MMC Int handler: Failed to disable interrupts\n"); + printk(KERN_ERR "UniFi MMC Int handler: Failed to disable interrupts %d\n", r); } #endif @@ -824,6 +851,8 @@ csr_sdio_linux_remove_irq(CsrSdioFunction *function) struct sdio_func *func = (struct sdio_func *)function->priv; int r; + unifi_trace(NULL, UDBG1, "csr_sdio_linux_remove_irq\n"); + sdio_claim_host(func); r = sdio_release_irq(func); sdio_release_host(func); @@ -853,6 +882,8 @@ csr_sdio_linux_install_irq(CsrSdioFunction *function) struct sdio_func *func = (struct sdio_func *)function->priv; int r; + unifi_trace(NULL, UDBG1, "csr_sdio_linux_install_irq\n"); + /* Register our interrupt handle */ sdio_claim_host(func); r = sdio_claim_irq(func, uf_glue_sdio_int_handler); @@ -866,7 +897,133 @@ csr_sdio_linux_install_irq(CsrSdioFunction *function) return r; } /* csr_sdio_linux_install_irq() */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) +#ifdef CONFIG_PM + +/* + * Power Management notifier + */ +struct uf_sdio_mmc_pm_notifier +{ + struct list_head list; + + CsrSdioFunction *sdio_ctx; + struct notifier_block pm_notifier; +}; + +/* PM notifier list head */ +static struct uf_sdio_mmc_pm_notifier uf_sdio_mmc_pm_notifiers = { + .sdio_ctx = NULL, +}; + +/* + * --------------------------------------------------------------------------- + * uf_sdio_mmc_register_pm_notifier + * uf_sdio_mmc_unregister_pm_notifier + * + * Register/unregister for power management events. A list is used to + * allow multiple card instances to be supported. + * + * Arguments: + * sdio_ctx - CSR SDIO context to associate PM notifier to + * + * Returns: + * Register function returns NULL on error + * --------------------------------------------------------------------------- + */ +static struct uf_sdio_mmc_pm_notifier * +uf_sdio_mmc_register_pm_notifier(CsrSdioFunction *sdio_ctx) +{ + /* Allocate notifier context for this card instance */ + struct uf_sdio_mmc_pm_notifier *notifier_ctx = kmalloc(sizeof(struct uf_sdio_mmc_pm_notifier), GFP_KERNEL); + + if (notifier_ctx) + { + notifier_ctx->sdio_ctx = sdio_ctx; + notifier_ctx->pm_notifier.notifier_call = uf_sdio_mmc_power_event; + + list_add(¬ifier_ctx->list, &uf_sdio_mmc_pm_notifiers.list); + + if (register_pm_notifier(¬ifier_ctx->pm_notifier)) { + printk(KERN_ERR "unifi: register_pm_notifier failed\n"); + } + } + + return notifier_ctx; +} + +static void +uf_sdio_mmc_unregister_pm_notifier(CsrSdioFunction *sdio_ctx) +{ + struct uf_sdio_mmc_pm_notifier *notifier_ctx; + struct list_head *node, *q; + + list_for_each_safe(node, q, &uf_sdio_mmc_pm_notifiers.list) { + notifier_ctx = list_entry(node, struct uf_sdio_mmc_pm_notifier, list); + + /* If it matches, unregister and free the notifier context */ + if (notifier_ctx && notifier_ctx->sdio_ctx == sdio_ctx) + { + if (unregister_pm_notifier(¬ifier_ctx->pm_notifier)) { + printk(KERN_ERR "unifi: unregister_pm_notifier failed\n"); + } + + /* Remove from list */ + notifier_ctx->sdio_ctx = NULL; + list_del(node); + kfree(notifier_ctx); + } + } +} + +/* + * --------------------------------------------------------------------------- + * uf_sdio_mmc_power_event + * + * Handler for power management events. + * + * We need to handle suspend/resume events while the userspace is unsuspended + * to allow the SME to run its suspend/resume state machines. + * + * Arguments: + * event event ID + * + * Returns: + * Status of the event handling + * --------------------------------------------------------------------------- + */ +static int +uf_sdio_mmc_power_event(struct notifier_block *this, unsigned long event, void *ptr) +{ + struct uf_sdio_mmc_pm_notifier *notifier_ctx = container_of(this, + struct uf_sdio_mmc_pm_notifier, + pm_notifier); + + /* Call the CSR SDIO function driver's suspend/resume method + * while the userspace is unsuspended. + */ + switch (event) { + case PM_POST_HIBERNATION: + case PM_POST_SUSPEND: + printk(KERN_INFO "%s:%d resume\n", __FUNCTION__, __LINE__ ); + if (sdio_func_drv && sdio_func_drv->resume) { + sdio_func_drv->resume(notifier_ctx->sdio_ctx); + } + break; + + case PM_HIBERNATION_PREPARE: + case PM_SUSPEND_PREPARE: + printk(KERN_INFO "%s:%d suspend\n", __FUNCTION__, __LINE__ ); + if (sdio_func_drv && sdio_func_drv->suspend) { + sdio_func_drv->suspend(notifier_ctx->sdio_ctx); + } + break; + } + return NOTIFY_DONE; +} +#endif /* CONFIG_PM */ +#endif /* 2.6.32 */ /* * --------------------------------------------------------------------------- @@ -925,6 +1082,10 @@ uf_glue_sdio_probe(struct sdio_func *func, sdio_ctx->features |= CSR_SDIO_FEATURE_BYTE_MODE; } + if (func->card->host->caps & MMC_CAP_SD_HIGHSPEED) { + unifi_trace(NULL, UDBG1, "MMC_CAP_SD_HIGHSPEED is available\n"); + } + #ifdef MMC_QUIRK_LENIENT_FN0 func->card->quirks |= MMC_QUIRK_LENIENT_FN0; #endif @@ -932,6 +1093,15 @@ uf_glue_sdio_probe(struct sdio_func *func, /* Pass context to the SDIO driver */ sdio_set_drvdata(func, sdio_ctx); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) +#ifdef CONFIG_PM + /* Register to get PM events */ + if (uf_sdio_mmc_register_pm_notifier(sdio_ctx) == NULL) { + unifi_error(NULL, "%s: Failed to register for PM events\n", __FUNCTION__); + } +#endif +#endif + /* Register this device with the SDIO function driver */ /* Call the main UniFi driver inserted handler */ if (sdio_func_drv && sdio_func_drv->inserted) { @@ -942,6 +1112,12 @@ uf_glue_sdio_probe(struct sdio_func *func, /* We have finished, so release the SDIO driver */ sdio_release_host(func); +#ifdef ANDROID_BUILD + /* Take the wakelock */ + unifi_trace(NULL, UDBG1, "probe: take wake lock\n"); + wake_lock(&unifi_sdio_wake_lock); +#endif + func_exit(); return 0; } /* uf_glue_sdio_probe() */ @@ -980,6 +1156,13 @@ uf_glue_sdio_remove(struct sdio_func *func) sdio_func_drv->removed(sdio_ctx); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) +#ifdef CONFIG_PM + /* Unregister for PM events */ + uf_sdio_mmc_unregister_pm_notifier(sdio_ctx); +#endif +#endif + kfree(sdio_ctx); func_exit(); @@ -1006,7 +1189,7 @@ MODULE_DEVICE_TABLE(sdio, unifi_ids); * --------------------------------------------------------------------------- * uf_glue_sdio_suspend * - * Card suspend callback. + * Card suspend callback. The userspace will already be suspended. * * Arguments: * dev The struct device owned by the MMC driver @@ -1018,23 +1201,9 @@ MODULE_DEVICE_TABLE(sdio, unifi_ids); static int uf_glue_sdio_suspend(struct device *dev) { - struct sdio_func *func; - CsrSdioFunction *sdio_ctx; - func_enter(); - func = dev_to_sdio_func(dev); - WARN_ON(!func); - - sdio_ctx = sdio_get_drvdata(func); - WARN_ON(!sdio_ctx); - - unifi_trace(NULL, UDBG1, "System Suspend...\n"); - - /* Clean up the SDIO function driver */ - if (sdio_func_drv && sdio_func_drv->suspend) { - sdio_func_drv->suspend(sdio_ctx); - } + unifi_trace(NULL, UDBG1, "uf_glue_sdio_suspend"); func_exit(); return 0; @@ -1045,7 +1214,7 @@ uf_glue_sdio_suspend(struct device *dev) * --------------------------------------------------------------------------- * uf_glue_sdio_resume * - * Card resume callback. + * Card resume callback. The userspace will still be suspended. * * Arguments: * dev The struct device owned by the MMC driver @@ -1057,23 +1226,14 @@ uf_glue_sdio_suspend(struct device *dev) static int uf_glue_sdio_resume(struct device *dev) { - struct sdio_func *func; - CsrSdioFunction *sdio_ctx; - func_enter(); - func = dev_to_sdio_func(dev); - WARN_ON(!func); - - sdio_ctx = sdio_get_drvdata(func); - WARN_ON(!sdio_ctx); + unifi_trace(NULL, UDBG1, "uf_glue_sdio_resume"); - unifi_trace(NULL, UDBG1, "System Resume...\n"); - - /* Clean up the SDIO function driver */ - if (sdio_func_drv && sdio_func_drv->resume) { - sdio_func_drv->resume(sdio_ctx); - } +#ifdef ANDROID_BUILD + unifi_trace(NULL, UDBG1, "resume: take wakelock\n"); + wake_lock(&unifi_sdio_wake_lock); +#endif func_exit(); return 0; @@ -1133,6 +1293,10 @@ CsrSdioFunctionDriverRegister(CsrSdioFunctionDriver *sdio_drv) return CSR_SDIO_RESULT_INVALID_VALUE; } +#ifdef ANDROID_BUILD + wake_lock_init(&unifi_sdio_wake_lock, WAKE_LOCK_SUSPEND, "unifi_sdio_work"); +#endif + /* Save the registered driver description */ /* * FIXME: @@ -1141,6 +1305,13 @@ CsrSdioFunctionDriverRegister(CsrSdioFunctionDriver *sdio_drv) */ sdio_func_drv = sdio_drv; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) +#ifdef CONFIG_PM + /* Initialise PM notifier list */ + INIT_LIST_HEAD(&uf_sdio_mmc_pm_notifiers.list); +#endif +#endif + /* Register ourself with mmc_core */ r = sdio_register_driver(&unifi_driver); if (r) { @@ -1157,6 +1328,10 @@ void CsrSdioFunctionDriverUnregister(CsrSdioFunctionDriver *sdio_drv) { printk(KERN_INFO "UniFi: unregister from MMC sdio\n"); + +#ifdef ANDROID_BUILD + wake_lock_destroy(&unifi_sdio_wake_lock); +#endif sdio_unregister_driver(&unifi_driver); sdio_func_drv = NULL; diff --git a/drivers/staging/csr/sme_blocking.c b/drivers/staging/csr/sme_blocking.c index f30eda9..8461bac 100644 --- a/drivers/staging/csr/sme_blocking.c +++ b/drivers/staging/csr/sme_blocking.c @@ -92,11 +92,15 @@ sme_init_request(unifi_priv_t *priv) return -EIO; } + unifi_trace(priv, UDBG5, "sme_init_request: wait sem\n"); + /* Grab the SME semaphore until the reply comes, or timeout */ if (down_interruptible(&priv->sme_sem)) { unifi_error(priv, "sme_init_request: Failed to get SME semaphore\n"); return -EIO; } + unifi_trace(priv, UDBG5, "sme_init_request: got sem: pending\n"); + priv->sme_reply.request_status = SME_REQUEST_PENDING; return 0; @@ -118,6 +122,10 @@ uf_sme_complete_request(unifi_priv_t *priv, CsrResult reply_status, const char * (func ? func : ""), priv->sme_reply.request_status); return; } + unifi_trace(priv, UDBG5, + "sme_complete_request: completed %s (s:%d)\n", + (func ? func : ""), priv->sme_reply.request_status); + priv->sme_reply.request_status = SME_REQUEST_RECEIVED; priv->sme_reply.reply_status = reply_status; @@ -127,23 +135,66 @@ uf_sme_complete_request(unifi_priv_t *priv, CsrResult reply_status, const char * } +void +uf_sme_cancel_request(unifi_priv_t *priv, CsrResult reply_status) +{ + /* Check for a blocking SME request in progress, and cancel the wait. + * This should be used when the character device is closed. + */ + + if (priv == NULL) { + unifi_error(priv, "sme_cancel_request: Invalid priv\n"); + return; + } + + /* If no request is pending, nothing to wake up */ + if (priv->sme_reply.request_status != SME_REQUEST_PENDING) { + unifi_trace(priv, UDBG5, + "sme_cancel_request: no request was pending (s:%d)\n", + priv->sme_reply.request_status); + /* Nothing to do */ + return; + } + unifi_trace(priv, UDBG5, + "sme_cancel_request: request cancelled (s:%d)\n", + priv->sme_reply.request_status); + + /* Wake up the wait with an error status */ + priv->sme_reply.request_status = SME_REQUEST_CANCELLED; + priv->sme_reply.reply_status = reply_status; /* unimportant since the CANCELLED state will fail the ioctl */ + + wake_up_interruptible(&priv->sme_request_wq); + + return; +} + + static int _sme_wait_for_reply(unifi_priv_t *priv, unsigned long timeout, const char *func) { long r; - unifi_trace(priv, UDBG5, "sme_wait_for_reply: sleep\n"); + unifi_trace(priv, UDBG5, "sme_wait_for_reply: %s sleep\n", func ? func : ""); r = wait_event_interruptible_timeout(priv->sme_request_wq, (priv->sme_reply.request_status != SME_REQUEST_PENDING), msecs_to_jiffies(timeout)); - unifi_trace(priv, UDBG5, "sme_wait_for_reply: awake\n"); + unifi_trace(priv, UDBG5, "sme_wait_for_reply: %s awake (%d)\n", func ? func : "", r); if (r == -ERESTARTSYS) { /* The thread was killed */ + unifi_info(priv, "ERESTARTSYS in _sme_wait_for_reply\n"); up(&priv->sme_sem); return r; } + if (priv->sme_reply.request_status == SME_REQUEST_CANCELLED) { + unifi_trace(priv, UDBG5, "Cancelled waiting for SME to reply (%s s:%d, t:%d, r:%d)\n", + (func ? func : ""), priv->sme_reply.request_status, timeout, r); + + /* Release the SME semaphore that was downed in sme_init_request() */ + up(&priv->sme_sem); + return -EIO; /* fail the ioctl */ + } if ((r == 0) && (priv->sme_reply.request_status != SME_REQUEST_RECEIVED)) { unifi_notice(priv, "Timeout waiting for SME to reply (%s s:%d, t:%d)\n", (func ? func : ""), priv->sme_reply.request_status, timeout); @@ -156,6 +207,9 @@ _sme_wait_for_reply(unifi_priv_t *priv, return -ETIMEDOUT; } + unifi_trace(priv, UDBG5, "sme_wait_for_reply: %s received (%d)\n", + func ? func : "", r); + /* Release the SME semaphore that was downed in sme_init_request() */ up(&priv->sme_sem); @@ -1289,22 +1343,20 @@ int sme_sys_suspend(unifi_priv_t *priv) return -EIO; } - /* For powered suspend, tell the resume's wifi_on() not to reinit UniFi */ - priv->wol_suspend = (enable_wol == UNIFI_WOL_OFF) ? FALSE : TRUE; - - /* Suspend the SME, which will cause it to power down UniFi */ + /* Suspend the SME, which MAY cause it to power down UniFi */ CsrWifiRouterCtrlSuspendIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,0, 0, priv->wol_suspend); r = sme_wait_for_reply(priv, UNIFI_SME_SYS_LONG_TIMEOUT); if (r) { /* No reply - forcibly power down in case the request wasn't processed */ unifi_notice(priv, "suspend: SME did not reply %s, ", - priv->ptest_mode ? "leave powered" : "power off UniFi anyway\n"); + (priv->ptest_mode | priv->wol_suspend) ? "leave powered" : "power off UniFi anyway\n"); /* Leave power on for production test, though */ if (!priv->ptest_mode) { /* Put UniFi to deep sleep, in case we can not power it off */ CsrSdioClaim(priv->sdio); + unifi_trace(priv, UDBG1, "Force deep sleep"); csrResult = unifi_force_low_power_mode(priv->card); /* For WOL, the UniFi must stay powered */ @@ -1319,13 +1371,40 @@ int sme_sys_suspend(unifi_priv_t *priv) if (priv->wol_suspend) { unifi_trace(priv, UDBG1, "UniFi left powered for WOL\n"); - /* For PIO WOL, disable SDIO interrupt to enable PIO mode in the f/w */ - if (enable_wol == UNIFI_WOL_PIO) { - unifi_trace(priv, UDBG1, "Remove IRQ to enable PIO WOL\n"); - if (csr_sdio_linux_remove_irq(priv->sdio)) { - unifi_notice(priv, "WOL csr_sdio_linux_remove_irq failed\n"); + /* Remove the IRQ, which also disables the card SDIO interrupt. + * Disabling the card SDIO interrupt enables the PIO WOL source. + * Removal of the of the handler ensures that in both SDIO and PIO cases + * the card interrupt only wakes the host. The card will be polled + * after resume to handle any pending data. + */ + if (csr_sdio_linux_remove_irq(priv->sdio)) { + unifi_notice(priv, "WOL csr_sdio_linux_remove_irq failed\n"); + } + + if (enable_wol == UNIFI_WOL_SDIO) { + /* Because csr_sdio_linux_remove_irq() disabled the card SDIO interrupt, + * it must be left enabled to wake-on-SDIO. + */ + unifi_trace(priv, UDBG1, "Enable card SDIO interrupt for SDIO WOL\n"); + + CsrSdioClaim(priv->sdio); + csrResult = CsrSdioInterruptEnable(priv->sdio); + CsrSdioRelease(priv->sdio); + + if (csrResult != CSR_RESULT_SUCCESS) { + unifi_error(priv, "WOL CsrSdioInterruptEnable failed %d\n", csrResult); } + } else { + unifi_trace(priv, UDBG1, "Disabled card SDIO interrupt for PIO WOL\n"); } + + /* Prevent the BH thread from running during the suspend. + * Upon resume, sme_sys_resume() will trigger a wifi-on, this will cause + * the BH thread to be re-enabled and reinstall the ISR. + */ + priv->bh_thread.block_thread = 1; + + unifi_trace(priv, UDBG1, "unifi_suspend: suspended BH"); } /* Consider UniFi to be uninitialised */ @@ -1354,22 +1433,10 @@ int sme_sys_resume(unifi_priv_t *priv) CsrWifiRouterCtrlResumeIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,0, priv->wol_suspend); - if (priv->ptest_mode == 1) { - r = sme_wait_for_reply(priv, UNIFI_SME_SYS_LONG_TIMEOUT); - if (r) { - /* No reply - forcibly power down in case the request wasn't processed */ - unifi_notice(priv, - "resume: SME did not reply, return success anyway\n"); - } - } else { - - /* - * We are not going to wait for the reply because the SME might be in - * the userspace. In this case the event will reach it when the kernel - * resumes. So, release now the SME semaphore that was downed in - * sme_init_request(). - */ - up(&priv->sme_sem); + r = sme_wait_for_reply(priv, UNIFI_SME_SYS_LONG_TIMEOUT); + if (r) { + unifi_notice(priv, + "resume: SME did not reply, return success anyway\n"); } return 0; diff --git a/drivers/staging/csr/sme_sys.c b/drivers/staging/csr/sme_sys.c index f576044..da12807 100644 --- a/drivers/staging/csr/sme_sys.c +++ b/drivers/staging/csr/sme_sys.c @@ -20,6 +20,8 @@ #ifdef CSR_SUPPORT_WEXT_AP #include "sme_csr/csr_wifi_sme_sef.h" #endif + + /* * This file implements the SME SYS API and contains the following functions: * CsrWifiRouterCtrlMediaStatusReqHandler() @@ -40,8 +42,10 @@ * CsrWifiRouterCtrlTclasDelReqHandler() * CsrWifiRouterCtrlSetModeReqHandler() * CsrWifiRouterCtrlWapiMulticastFilterReqHandler() - * CsrWifiRouterCtrlWapiMulticastReqHandler() * CsrWifiRouterCtrlWapiUnicastFilterReqHandler() + * CsrWifiRouterCtrlWapiUnicastTxPktReqHandler() + * CsrWifiRouterCtrlWapiRxPktReqHandler() + * CsrWifiRouterCtrlWapiFilterReqHandler() */ #ifdef CSR_SUPPORT_SME @@ -731,10 +735,31 @@ void CsrWifiRouterCtrlWifiOnReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) if (priv == NULL) { return; } - for (i=0; iinterfacePriv[i]->interfaceMode = 0; + if( priv->wol_suspend ) { + unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWifiOnReqHandler: Don't reset mode\n"); + } else { +#ifdef ANDROID_BUILD + /* Take the wakelock while Wi-Fi On is in progress */ + unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWifiOnReqHandler: take wake lock\n"); + wake_lock(&unifi_sdio_wake_lock); +#endif + for (i=0; iinterfacePriv[i]->interfaceMode = 0; + } + } + unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWifiOnReqHandler(0x%.4X) req->dataLength=%d req->data=0x%x\n", msg->source, req->dataLength, req->data); + + if(req->dataLength==3 && req->data && req->data[0]==0 && req->data[1]==1 && req->data[2]==1) + { + priv->cmanrTestMode = TRUE; + unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWifiOnReqHandler: cmanrTestMode=%d\n", priv->cmanrTestMode); + } + else + { + priv->cmanrTestMode = FALSE; } - unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWifiOnReqHandler(0x%.4X)\n", msg->source); /* * The request to initialise UniFi might come while UniFi is running. @@ -747,11 +772,16 @@ void CsrWifiRouterCtrlWifiOnReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) /* Update the wifi_on state */ priv->wifi_on_state = wifi_on_in_progress; - r = uf_request_firmware_files(priv, UNIFI_FW_STA); - if (r) { - unifi_error(priv, "CsrWifiRouterCtrlWifiOnReqHandler: Failed to get f/w\n"); - CsrWifiRouterCtrlWifiOnCfmSend(msg->source, req->clientData, CSR_RESULT_FAILURE); - return; + /* If UniFi was unpowered, acquire the firmware for download to chip */ + if (!priv->wol_suspend) { + r = uf_request_firmware_files(priv, UNIFI_FW_STA); + if (r) { + unifi_error(priv, "CsrWifiRouterCtrlWifiOnReqHandler: Failed to get f/w\n"); + CsrWifiRouterCtrlWifiOnCfmSend(msg->source, req->clientData, CSR_RESULT_FAILURE); + return; + } + } else { + unifi_trace(priv, UDBG1, "Don't need firmware\n"); } /* Power on UniFi (which may not necessarily have been off) */ @@ -832,6 +862,13 @@ wifi_off(unifi_priv_t *priv) int i; CsrResult csrResult; + + /* Already off? */ + if (priv->wifi_on_state == wifi_on_unspecified) { + unifi_trace(priv, UDBG1, "wifi_off already\n"); + return; + } + unifi_trace(priv, UDBG1, "wifi_off\n"); /* Destroy the Traffic Analysis Module */ @@ -840,6 +877,7 @@ wifi_off(unifi_priv_t *priv) cancel_work_sync(&priv->ta_sample_ind_work.task); #ifdef CSR_SUPPORT_WEXT cancel_work_sync(&priv->sme_config_task); + wext_send_disassoc_event(priv); #endif /* Cancel pending M4 stuff */ @@ -908,9 +946,6 @@ void CsrWifiRouterCtrlWifiOffReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) unifi_priv_t *priv = (unifi_priv_t*)drvpriv; CsrWifiRouterCtrlWifiOffReq* req = (CsrWifiRouterCtrlWifiOffReq*)msg; int i = 0; -#ifdef CSR_SUPPORT_WEXT_AP - CsrWifiSmeWifiOffCfm cfm; -#endif if (priv == NULL) { return; @@ -924,6 +959,7 @@ void CsrWifiRouterCtrlWifiOffReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) if (interfacePriv->netdev_registered == 1) { netif_carrier_off(priv->netdev[i]); UF_NETIF_TX_STOP_ALL_QUEUES(priv->netdev[i]); + interfacePriv->connected = UnifiConnectedUnknown; } interfacePriv->interfaceMode = 0; @@ -936,15 +972,11 @@ void CsrWifiRouterCtrlWifiOffReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) wifi_off(priv); CsrWifiRouterCtrlWifiOffCfmSend(msg->source,req->clientData); -#ifdef CSR_SUPPORT_WEXT_AP - /* Router is turned off when WifiOffCfm is received - * hence for wext we don't see WifiOffCfm in the wext - * files. So just tell the waiting process that - * Wifi off is successful + + /* If this is called in response to closing the character device, the + * caller must use uf_sme_cancel_request() to terminate any pending SME + * blocking request or there will be a delay while the operation times out. */ - cfm.status = CSR_RESULT_SUCCESS; - CsrWifiSmeWifiOffCfmHandler(priv,(CsrWifiFsmEvent*)(&cfm)); -#endif } @@ -1065,7 +1097,9 @@ void CsrWifiRouterCtrlWifiOnResHandler(void* drvpriv, CsrWifiFsmEvent* msg) { int i; /* used as a loop counter */ CsrUint32 intmode = CSR_WIFI_INTMODE_DEFAULT; - +#ifdef CSR_WIFI_SPLIT_PATCH + CsrBool switching_ap_fw = FALSE; +#endif /* Register the UniFi device with the OS network manager */ unifi_trace(priv, UDBG3, "Card Init Completed Successfully\n"); @@ -1099,6 +1133,16 @@ void CsrWifiRouterCtrlWifiOnResHandler(void* drvpriv, CsrWifiFsmEvent* msg) return; } } +#ifdef CSR_WIFI_SPLIT_PATCH + else + { + /* If a netdev is already registered, we have received this WifiOnRes + * in response to switching AP/STA firmware in a ModeSetReq. + * Rememeber this in order to send a ModeSetCfm once + */ + switching_ap_fw = TRUE; + } +#endif } priv->totalInterfaceCount = res->numInterfaceAddress; @@ -1117,8 +1161,27 @@ void CsrWifiRouterCtrlWifiOnResHandler(void* drvpriv, CsrWifiFsmEvent* msg) /* Acknowledge the CsrWifiRouterCtrlWifiOnReq now */ CsrWifiRouterCtrlWifiOnCfmSend(msg->source, res->clientData, CSR_RESULT_SUCCESS); +#ifdef CSR_WIFI_SPLIT_PATCH + if (switching_ap_fw && (priv->pending_mode_set.common.destination != 0xaaaa)) { + unifi_info(priv, "Completed firmware reload with %s patch\n", + CSR_WIFI_HIP_IS_AP_FW(priv->interfacePriv[0]->interfaceMode) ? "AP" : "STA"); + + /* Confirm the ModeSetReq that requested the AP/STA patch switch */ + CsrWifiRouterCtrlModeSetCfmSend(priv->pending_mode_set.common.source, + priv->pending_mode_set.clientData, + priv->pending_mode_set.interfaceTag, + priv->pending_mode_set.mode, + CSR_RESULT_SUCCESS); + priv->pending_mode_set.common.destination = 0xaaaa; + } +#endif unifi_info(priv, "UniFi ready\n"); +#ifdef ANDROID_BUILD + /* Release the wakelock */ + unifi_trace(priv, UDBG1, "ready: release wake lock\n"); + wake_unlock(&unifi_sdio_wake_lock); +#endif /* Firmware initialisation is complete, so let the SDIO bus * clock be raised when convienent to the core. */ @@ -1257,15 +1320,7 @@ void CsrWifiRouterCtrlResumeResHandler(void* drvpriv, CsrWifiFsmEvent* msg) return; } - /* - * Unless we are in ptest mode, nothing is waiting for the response. - * Do not call sme_complete_request(), otherwise the driver - * and the SME will be out of step. - */ - if (priv->ptest_mode == 1) { - sme_complete_request(priv, res->status); - } - + sme_complete_request(priv, res->status); } @@ -1709,7 +1764,6 @@ void CsrWifiRouterCtrlInterfaceReset(unifi_priv_t *priv, CsrUint16 interfaceTag) &(interfacePriv->genericMulticastOrBroadCastFrames)); uf_flush_list(priv,&(interfacePriv->genericMulticastOrBroadCastFrames)); - uf_flush_maPktlist(priv,&(interfacePriv->directedMaPktReq)); /* process the list of frames that requested cfm and send cfm to requestor one by one */ @@ -1747,21 +1801,93 @@ void CsrWifiRouterCtrlModeSetReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) if (req->interfaceTag < CSR_WIFI_NUM_INTERFACES) { netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; - +#ifdef CSR_WIFI_SPLIT_PATCH + CsrUint8 old_mode = interfacePriv->interfaceMode; +#endif unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlModeSetReqHandler: interfacePriv->interfaceMode = %d\n", interfacePriv->interfaceMode); - /* Cleanup the database first for current existing mode, Then take - * care of setting the new mode (Transition seq: AnyMode->NoneMode->newMode) - * So for Every mode changes, Database Initialization/cleanup needed + interfacePriv->interfaceMode = req->mode; + +#ifdef CSR_WIFI_SPLIT_PATCH + /* Detect a change in mode that requires a switch to/from the AP firmware patch. + * This should only happen when transitioning in/out of AP modes. */ - CsrWifiRouterCtrlInterfaceReset(priv,req->interfaceTag); + if (CSR_WIFI_HIP_IS_AP_FW(req->mode) != CSR_WIFI_HIP_IS_AP_FW(old_mode)) + { + CsrWifiRouterCtrlVersions versions; + int r; + +#ifdef ANDROID_BUILD + /* Take the wakelock while switching patch */ + unifi_trace(priv, UDBG1, "patch switch: take wake lock\n"); + wake_lock(&unifi_sdio_wake_lock); +#endif + unifi_info(priv, "Resetting UniFi with %s patch\n", CSR_WIFI_HIP_IS_AP_FW(req->mode) ? "AP" : "STA"); + + r = uf_request_firmware_files(priv, UNIFI_FW_STA); + if (r) { + unifi_error(priv, "CsrWifiRouterCtrlModeSetReqHandler: Failed to get f/w\n"); + CsrWifiRouterCtrlModeSetCfmSend(msg->source, req->clientData, req->interfaceTag, + req->mode, CSR_RESULT_FAILURE); + return; + } + + /* Block the I/O thread */ + priv->bh_thread.block_thread = 1; + + /* Reset and download the new patch */ + r = uf_init_hw(priv); + if (r) { + unifi_error(priv, "CsrWifiRouterCtrlWifiOnReqHandler: Failed to initialise h/w, error %d\n", r); + CsrWifiRouterCtrlModeSetCfmSend(msg->source, req->clientData, req->interfaceTag, + req->mode, CSR_RESULT_FAILURE); + return; + } + + /* Re-enable the I/O thread */ + priv->bh_thread.block_thread = 0; + + /* Get the version information from the core */ + unifi_card_info(priv->card, &priv->card_info); + + /* Copy to the unifiio_card_info structure. */ + versions.chipId = priv->card_info.chip_id; + versions.chipVersion = priv->card_info.chip_version; + versions.firmwareBuild = priv->card_info.fw_build; + versions.firmwareHip = priv->card_info.fw_hip_version; + versions.routerBuild = (CsrCharString*)CSR_WIFI_VERSION; + versions.routerHip = (UNIFI_HIP_MAJOR_VERSION << 8) | UNIFI_HIP_MINOR_VERSION; + + /* Now that new firmware is running, send a WifiOnInd to the NME. This will + * cause it to retransfer the MIB. + */ + CsrWifiRouterCtrlWifiOnIndSend(msg->source, 0, CSR_RESULT_SUCCESS, versions); + + /* Store the request so we know where to send the ModeSetCfm */ + priv->pending_mode_set = *req; + } + else +#endif + { + /* No patch switch, confirm straightaway */ + CsrWifiRouterCtrlModeSetCfmSend(msg->source, req->clientData, req->interfaceTag, + req->mode, CSR_RESULT_SUCCESS); + } - interfacePriv->interfaceMode = req->mode; interfacePriv->bssid = req->bssid; /* For modes other than AP/P2PGO, set below member FALSE */ interfacePriv->intraBssEnabled = FALSE; - + /* Initialise the variable bcTimSet with a value + * other then CSR_WIFI_TIM_SET or CSR_WIFI_TIM_RESET value + */ + interfacePriv->bcTimSet = 0xFF; + interfacePriv->bcTimSetReqPendingFlag = FALSE; + /* Initialise the variable bcTimSetReqQueued with a value + * other then CSR_WIFI_TIM_SET or CSR_WIFI_TIM_RESET value + */ + interfacePriv->bcTimSetReqQueued =0xFF; + CsrWifiRouterCtrlInterfaceReset(priv,req->interfaceTag); if(req->mode == CSR_WIFI_ROUTER_CTRL_MODE_AP || req->mode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { @@ -1797,8 +1923,6 @@ static int peer_delete_record(unifi_priv_t *priv, CsrWifiRouterCtrlPeerDelReq *r unifi_port_config_t *controlledPort; unifi_port_config_t *unControlledPort; netInterface_priv_t *interfacePriv; - maPktReqList_t *maPktreq; - struct list_head *listHeadMaPktreq,*placeHolderMaPktreq; CsrUint8 ba_session_idx = 0; ba_session_rx_struct *ba_session_rx = NULL; @@ -1832,21 +1956,6 @@ static int peer_delete_record(unifi_priv_t *priv, CsrWifiRouterCtrlPeerDelReq *r uf_flush_list(priv,&(staInfo->dataPdu[j])); } - /* There may be race condition - before getting the ma_packet_cfm from f/w, driver may receive peer del from SME - */ - spin_lock_irqsave(&priv->tx_q_lock,lock_flags); - list_for_each_safe(listHeadMaPktreq, placeHolderMaPktreq, &interfacePriv->directedMaPktReq) { - maPktreq = list_entry(listHeadMaPktreq, maPktReqList_t, q); - if(maPktreq->staHandler== staInfo->assignedHandle){ - dev_kfree_skb(maPktreq->skb); - list_del(listHeadMaPktreq); - kfree(maPktreq); - } - - } - spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); - spin_lock_irqsave(&priv->staRecord_lock,lock_flags); /* clear the port configure array info, for the corresponding peer entry */ controlledPort = &interfacePriv->controlled_data_port; @@ -1885,7 +1994,7 @@ static int peer_delete_record(unifi_priv_t *priv, CsrWifiRouterCtrlPeerDelReq *r /* Stop BA session if it is active, for this peer address all BA sessions (per tID per role) are closed */ - spin_lock(&priv->ba_lock); + down(&priv->ba_mutex); for(ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX; ba_session_idx++){ ba_session_rx = priv->interfacePriv[req->interfaceTag]->ba_session_rx[ba_session_idx]; if(ba_session_rx) { @@ -1912,7 +2021,7 @@ static int peer_delete_record(unifi_priv_t *priv, CsrWifiRouterCtrlPeerDelReq *r } } - spin_unlock(&priv->ba_lock); + up(&priv->ba_mutex); #ifdef CSR_SUPPORT_SME unifi_trace(priv, UDBG1, "Canceling work queue for STA with AID: %d\n", staInfo->aid); @@ -2134,8 +2243,16 @@ static int peer_add_new_record(unifi_priv_t *priv,CsrWifiRouterCtrlPeerAddReq *r newRecord->txSuspend = FALSE; /*U-APSD related data structure*/ + newRecord->timRequestPendingFlag = FALSE; + + /* Initialise the variable updateTimReqQueued with a value + * other then CSR_WIFI_TIM_SET or CSR_WIFI_TIM_RESET value + */ + newRecord->updateTimReqQueued = 0xFF; + newRecord->timSet = CSR_WIFI_TIM_RESET; newRecord->uapsdActive = FALSE; newRecord->noOfSpFramesSent =0; + newRecord->triggerFramePriority = CSR_QOS_UP0; /* The protection bit is updated once the port opens for corresponding peer in * routerPortConfigure request */ @@ -2602,13 +2719,13 @@ void CsrWifiRouterCtrlBlockAckDisableReqHandler(void* drvpriv, CsrWifiFsmEvent* unifi_trace(priv, UDBG6, "%s: in ok\n", __FUNCTION__); - spin_lock(&priv->ba_lock); + down(&priv->ba_mutex); r = blockack_session_stop(priv, req->interfaceTag, req->role, req->trafficStreamID, req->macAddress); - spin_unlock(&priv->ba_lock); + up(&priv->ba_mutex); CsrWifiRouterCtrlBlockAckDisableCfmSend(msg->source, req->clientData, @@ -2746,6 +2863,16 @@ CsrBool blockack_session_start(unifi_priv_t *priv, init_timer(&ba_session_rx->timer); mod_timer(&ba_session_rx->timer, (jiffies + usecs_to_jiffies((ba_session_rx->timeout) * 1024))); } + /* + * The starting sequence number shall remain same if the BA + * enable request is issued to update BA parameters only. If + * it is not same, then we scroll our window to the new starting + * sequence number. This could happen if the DELBA frame from + * originator is lost and then we receive ADDBA frame with new SSN. + */ + if(ba_session_rx->start_sn != start_sn) { + scroll_ba_window(priv, interfacePriv, ba_session_rx, start_sn); + } return TRUE; } } @@ -2768,6 +2895,21 @@ CsrBool blockack_session_start(unifi_priv_t *priv, return FALSE; } + /* It is observed that with some devices there is a race between + * EAPOL exchanges and BA session establishment. This results in + * some EAPOL authentication packets getting stuck in BA reorder + * buffer and hence the conection cannot be established. To avoid + * this we check here if the EAPOL authentication is complete and + * if so then only allow the BA session to establish. + * + * It is verified that the peers normally re-establish + * the BA session after the initial rejection. + */ + if (CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN != uf_sme_port_state(priv, macAddress.a, UF_CONTROLLED_PORT_Q, interfacePriv->InterfaceTag)) + { + unifi_warning(priv, "blockack_session_start: Controlled port not opened, Reject BA request\n"); + return FALSE; + } ba_session_rx = kmalloc(sizeof(ba_session_rx_struct), GFP_KERNEL); if (!ba_session_rx) { @@ -2814,7 +2956,7 @@ void CsrWifiRouterCtrlBlockAckEnableReqHandler(void* drvpriv, CsrWifiFsmEvent* m unifi_priv_t *priv = (unifi_priv_t*)drvpriv; unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__); - spin_lock(&priv->ba_lock); + down(&priv->ba_mutex); r = blockack_session_start(priv, req->interfaceTag, req->trafficStreamID, @@ -2824,7 +2966,7 @@ void CsrWifiRouterCtrlBlockAckEnableReqHandler(void* drvpriv, CsrWifiFsmEvent* m req->ssn, req->macAddress ); - spin_unlock(&priv->ba_lock); + up(&priv->ba_mutex); CsrWifiRouterCtrlBlockAckEnableCfmSend(msg->source, req->clientData, @@ -2836,115 +2978,291 @@ void CsrWifiRouterCtrlBlockAckEnableReqHandler(void* drvpriv, CsrWifiFsmEvent* m void CsrWifiRouterCtrlWapiMulticastFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) { +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; CsrWifiRouterCtrlWapiMulticastFilterReq* req = (CsrWifiRouterCtrlWapiMulticastFilterReq*)msg; + netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; - unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__); - unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWapiMulticastFilterReq: req->status = %d\n", req->status); + if (CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) { + + unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__); + + unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWapiMulticastFilterReq: req->status = %d\n", req->status); + + /* status 1 - Filter on + * status 0 - Filter off */ + priv->wapi_multicast_filter = req->status; + + unifi_trace(priv, UDBG6, "<<%s\n", __FUNCTION__); + } else { - /* status 1 - Filter on - * status 0 - Filter off */ - priv->wapi_multicast_filter = req->status; + unifi_warning(priv, "%s is NOT applicable for interface mode - %d\n", __FUNCTION__,interfacePriv->interfaceMode); - unifi_trace(priv, UDBG6, "<<%s\n", __FUNCTION__); + } +#elif defined(UNIFI_DEBUG) + /*WAPI Disabled*/ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + unifi_error(priv,"CsrWifiRouterCtrlWapiMulticastFilterReqHandler: called when WAPI isn't enabled\n"); +#endif } void CsrWifiRouterCtrlWapiUnicastFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) { +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; CsrWifiRouterCtrlWapiUnicastFilterReq* req = (CsrWifiRouterCtrlWapiUnicastFilterReq*)msg; + netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; - unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__); - unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWapiUnicastFilterReq: req->status= %d\n", req->status); + if (CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) { - if ((priv->wapi_unicast_filter == 1) && (req->status == 0)) { - /* When we have successfully re-associated and obtained a new unicast key with keyid = 0 */ - priv->wapi_unicast_queued_pkt_filter = 1; - } + unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__); - /* status 1 - Filter ON - * status 0 - Filter OFF */ - priv->wapi_unicast_filter = req->status; + unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWapiUnicastFilterReq: req->status= %d\n", req->status); - unifi_trace(priv, UDBG6, "<<%s\n", __FUNCTION__); -} + if ((priv->wapi_unicast_filter == 1) && (req->status == 0)) { + /* When we have successfully re-associated and obtained a new unicast key with keyid = 0 */ + priv->wapi_unicast_queued_pkt_filter = 1; + } + /* status 1 - Filter ON + * status 0 - Filter OFF */ + priv->wapi_unicast_filter = req->status; -void CsrWifiRouterCtrlWapiMulticastReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ + unifi_trace(priv, UDBG6, "<<%s\n", __FUNCTION__); + } else { + + unifi_warning(priv, "%s is NOT applicable for interface mode - %d\n", __FUNCTION__,interfacePriv->interfaceMode); + + } +#elif defined(UNIFI_DEBUG) + /*WAPI Disabled*/ unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterCtrlWapiMulticastReq* req = (CsrWifiRouterCtrlWapiMulticastReq*)msg; + unifi_error(priv,"CsrWifiRouterCtrlWapiUnicastFilterReqHandler: called when WAPI isn't enabled\n"); +#endif +} + +void CsrWifiRouterCtrlWapiRxPktReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterCtrlWapiRxPktReq* req = (CsrWifiRouterCtrlWapiRxPktReq*)msg; int client_id, receiver_id; bulk_data_param_t bulkdata; CsrResult res; ul_client_t *client; - CSR_SIGNAL signal; CSR_MA_PACKET_INDICATION *pkt_ind; + netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; - unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__); - unifi_trace(priv, UDBG4, "CsrWifiRouterCtrlWapiMulticastReqHandler: \n"); + if (CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) { - if (priv == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlWapiMulticastReqHandler : invalid priv\n",__FUNCTION__); - return; - } + unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__); - if (priv->smepriv == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlWapiMulticastReqHandler : invalid sme priv\n",__FUNCTION__); - return; - } + if (priv == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlWapiRxPktReq : invalid priv\n",__FUNCTION__); + return; + } - if (req->dataLength == 0 || req->data == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlWapiMulticastReqHandler: invalid request\n",__FUNCTION__); - return; - } + if (priv->smepriv == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlWapiRxPktReq : invalid sme priv\n",__FUNCTION__); + return; + } - res = unifi_net_data_malloc(priv, &bulkdata.d[0], req->dataLength); - if (res != CSR_RESULT_SUCCESS) { - unifi_error(priv, "CsrWifiRouterCtrlWapiMulticastReqHandler: Could not allocate net data\n",__FUNCTION__); - return; - } + if (req->dataLength == 0 || req->data == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlWapiRxPktReq: invalid request\n",__FUNCTION__); + return; + } - /* This function is expected to be called only when the MIC has been verified by SME to be correct - * So reset the reception status to rx_success */ - res = read_unpack_signal(req->signal, &signal); - if (res) { - unifi_error(priv,"CsrWifiRouterCtrlWapiMulticastReqHandler: Received unknown or corrupted signal.\n"); - return; - } - pkt_ind = (CSR_MA_PACKET_INDICATION*) (&((&signal)->u).MaPacketIndication); - if (pkt_ind->ReceptionStatus != CSR_MICHAEL_MIC_ERROR) { - unifi_error(priv,"CsrWifiRouterCtrlWapiMulticastReqHandler: Unknown signal with reception status = %d\n",pkt_ind->ReceptionStatus); - return; - } - else { - unifi_trace(priv, UDBG4,"CsrWifiRouterCtrlWapiMulticastReqHandler: MIC verified , RX_SUCCESS \n",__FUNCTION__); - pkt_ind->ReceptionStatus = CSR_RX_SUCCESS; - write_pack(&signal, req->signal, &(req->signalLength)); + res = unifi_net_data_malloc(priv, &bulkdata.d[0], req->dataLength); + if (res != CSR_RESULT_SUCCESS) { + unifi_error(priv, "CsrWifiRouterCtrlWapiRxPktReq: Could not allocate net data\n",__FUNCTION__); + return; + } + + /* This function is expected to be called only when the MIC has been verified by SME to be correct + * So reset the reception status to rx_success */ + res = read_unpack_signal(req->signal, &signal); + if (res) { + unifi_error(priv,"CsrWifiRouterCtrlWapiRxPktReqHandler: Received unknown or corrupted signal.\n"); + return; + } + pkt_ind = (CSR_MA_PACKET_INDICATION*) (&((&signal)->u).MaPacketIndication); + if (pkt_ind->ReceptionStatus != CSR_MICHAEL_MIC_ERROR) { + unifi_error(priv,"CsrWifiRouterCtrlWapiRxPktReqHandler: Unknown signal with reception status = %d\n",pkt_ind->ReceptionStatus); + return; + } else { + unifi_trace(priv, UDBG4,"CsrWifiRouterCtrlWapiRxPktReqHandler: MIC verified , RX_SUCCESS \n",__FUNCTION__); + pkt_ind->ReceptionStatus = CSR_RX_SUCCESS; + write_pack(&signal, req->signal, &(req->signalLength)); + } + + memcpy((void*)bulkdata.d[0].os_data_ptr, req->data, req->dataLength); + + receiver_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN((req->signal) + sizeof(CsrInt16)) & 0xFFF0; + client_id = (receiver_id & 0x0F00) >> UDI_SENDER_ID_SHIFT; + + client = &priv->ul_clients[client_id]; + + if (client && client->event_hook) { + unifi_trace(priv, UDBG3, + "CsrWifiRouterCtrlWapiRxPktReq: " + "Sending signal to client %d, (s:0x%X, r:0x%X) - Signal 0x%X \n", + client->client_id, client->sender_id, receiver_id, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN(req->signal)); + + client->event_hook(client, req->signal, req->signalLength, &bulkdata, UDI_TO_HOST); + } else { + unifi_trace(priv, UDBG4, "No client to give the packet to\n"); + unifi_net_data_free(priv, &bulkdata.d[0]); + } + + unifi_trace(priv, UDBG6, "<<%s\n", __FUNCTION__); + } else { + unifi_warning(priv, "%s is NOT applicable for interface mode - %d\n", __FUNCTION__,interfacePriv->interfaceMode); } +#elif defined(UNIFI_DEBUG) + /*WAPI Disabled*/ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + unifi_error(priv,"CsrWifiRouterCtrlWapiRxPktReqHandler: called when WAPI isn't enabled\n"); +#endif +} - memcpy((void*)bulkdata.d[0].os_data_ptr, req->data, req->dataLength); +void CsrWifiRouterCtrlWapiUnicastTxPktReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION)) - receiver_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN((req->signal) + sizeof(CsrInt16)) & 0xFFF0; - client_id = (receiver_id & 0x0F00) >> UDI_SENDER_ID_SHIFT; + unifi_priv_t *priv = (unifi_priv_t*) drvpriv; + CsrWifiRouterCtrlWapiUnicastTxPktReq *req = (CsrWifiRouterCtrlWapiUnicastTxPktReq*) msg; + netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; + bulk_data_param_t bulkdata; + CsrUint8 macHeaderLengthInBytes = MAC_HEADER_SIZE; + /*KeyID, Reserved, PN, MIC*/ + CsrUint8 appendedCryptoFields = 1 + 1 + 16 + 16; + CsrResult result; + /* Retrieve the MA PACKET REQ fields from the Signal retained from send_ma_pkt_request() */ + CSR_MA_PACKET_REQUEST *storedSignalMAPktReq = &interfacePriv->wapi_unicast_ma_pkt_sig.u.MaPacketRequest; - client = &priv->ul_clients[client_id]; + if (CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) { + + unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__); + + if (priv == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlWapiUnicastTxPktReqHandler : invalid priv\n",__FUNCTION__); + return; + } + if (priv->smepriv == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlWapiUnicastTxPktReqHandler : invalid sme priv\n",__FUNCTION__); + return; + } + if (req->data == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlWapiUnicastTxPktReqHandler: invalid request\n",__FUNCTION__); + return; + } else { + /* If it is QoS data (type = data subtype = QoS), frame header contains QoS control field */ + if ((req->data[0] & 0x88) == 0x88) { + macHeaderLengthInBytes = macHeaderLengthInBytes + QOS_CONTROL_HEADER_SIZE; + } + } + if ( !(req->dataLength>(macHeaderLengthInBytes+appendedCryptoFields)) ) { + unifi_error(priv, "CsrWifiRouterCtrlWapiUnicastTxPktReqHandler: invalid dataLength\n",__FUNCTION__); + return; + } + + /* Encrypted DATA Packet contained in (req->data) + * ------------------------------------------------------------------- + * |MAC Header| KeyId | Reserved | PN | xxDataxx | xxMICxxx | + * ------------------------------------------------------------------- + * (<-----Encrypted----->) + * ------------------------------------------------------------------- + * |24/26(QoS)| 1 | 1 | 16 | x | 16 | + * ------------------------------------------------------------------- + */ + result = unifi_net_data_malloc(priv, &bulkdata.d[0], req->dataLength); + if (result != CSR_RESULT_SUCCESS) { + unifi_error(priv, "CsrWifiRouterCtrlWapiUnicastTxPktReqHandler: Could not allocate net data\n",__FUNCTION__); + return; + } + memcpy((void*)bulkdata.d[0].os_data_ptr, req->data, req->dataLength); + bulkdata.d[0].data_length = req->dataLength; + bulkdata.d[1].os_data_ptr = NULL; + bulkdata.d[1].data_length = 0; + + /* Send UniFi msg */ + /* Here hostTag is been sent as 0xffffffff, its been appended properly while framing MA-Packet request in pdu_processing.c file */ + result = uf_process_ma_packet_req(priv, + storedSignalMAPktReq->Ra.x, + storedSignalMAPktReq->HostTag,/* Ask for a new HostTag */ + req->interfaceTag, + storedSignalMAPktReq->TransmissionControl, + storedSignalMAPktReq->TransmitRate, + storedSignalMAPktReq->Priority, /* Retained value */ + interfacePriv->wapi_unicast_ma_pkt_sig.SignalPrimitiveHeader.SenderProcessId, /*FIXME AP: VALIDATE ???*/ + &bulkdata); + + if (result == NETDEV_TX_OK) { + (priv->netdev[req->interfaceTag])->trans_start = jiffies; + /* Should really count tx stats in the UNITDATA.status signal but + * that doesn't have the length. + */ + interfacePriv->stats.tx_packets++; + + /* count only the packet payload */ + interfacePriv->stats.tx_bytes += req->dataLength - macHeaderLengthInBytes - appendedCryptoFields; + unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWapiUnicastTxPktReqHandler: (Packet Sent), sent count = %x\n", interfacePriv->stats.tx_packets); + } else { + /* Failed to send: fh queue was full, and the skb was discarded*/ + unifi_trace(priv, UDBG1, "(HIP validation failure) Result = %d\n", result); + unifi_net_data_free(priv, &bulkdata.d[0]); + + interfacePriv->stats.tx_dropped++; + unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWapiUnicastTxPktReqHandler: (Packet Drop), dropped count = %x\n", interfacePriv->stats.tx_dropped); + } - if (client && client->event_hook) { - unifi_trace(priv, UDBG3, - "CsrWifiRouterCtrlWapiMulticastReqHandler: " - "Sending signal to client %d, (s:0x%X, r:0x%X) - Signal 0x%X \n", - client->client_id, client->sender_id, receiver_id, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN(req->signal)); + unifi_trace(priv, UDBG6, "<<%s\n", __FUNCTION__); + + } else { + + unifi_warning(priv, "%s is NOT applicable for interface mode - %d\n", __FUNCTION__,interfacePriv->interfaceMode); - client->event_hook(client, req->signal, req->signalLength, &bulkdata, UDI_TO_HOST); } - else { - unifi_trace(priv, UDBG4, "No client to give the packet to\n"); - unifi_net_data_free(priv, &bulkdata.d[0]); +#elif defined(UNIFI_DEBUG) + /*WAPI Disabled*/ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + unifi_error(priv,"CsrWifiRouterCtrlWapiUnicastTxPktReqHandler: called when WAPI SW ENCRYPTION isn't enabled\n"); +#endif +} + +void CsrWifiRouterCtrlWapiFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) +{ +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + +#ifdef CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + CsrWifiRouterCtrlWapiFilterReq* req = (CsrWifiRouterCtrlWapiFilterReq*)msg; + netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; + + if (CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) { + + unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__); + + unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWapiFilterReq: req->isWapiConnected [0/1] = %d \n",req->isWapiConnected); + + priv->isWapiConnection = req->isWapiConnected; + + unifi_trace(priv, UDBG6, "<<%s\n", __FUNCTION__); + } else { + + unifi_warning(priv, "%s is NOT applicable for interface mode - %d\n", __FUNCTION__,interfacePriv->interfaceMode); + } +#endif - unifi_trace(priv, UDBG6, "<<%s\n", __FUNCTION__); +#elif defined(UNIFI_DEBUG) + /*WAPI Disabled*/ + unifi_priv_t *priv = (unifi_priv_t*)drvpriv; + unifi_error(priv,"CsrWifiRouterCtrlWapiFilterReq: called when WAPI isn't enabled\n"); +#endif } diff --git a/drivers/staging/csr/sme_userspace.c b/drivers/staging/csr/sme_userspace.c index 38df94b6..d87a6e3 100644 --- a/drivers/staging/csr/sme_userspace.c +++ b/drivers/staging/csr/sme_userspace.c @@ -101,7 +101,6 @@ uf_sme_init(unifi_priv_t *priv) INIT_LIST_HEAD(&interfacePriv->genericMgtFrames); INIT_LIST_HEAD(&interfacePriv->genericMulticastOrBroadCastMgtFrames); INIT_LIST_HEAD(&interfacePriv->genericMulticastOrBroadCastFrames); - INIT_LIST_HEAD(&interfacePriv->directedMaPktReq); for(j = 0; j < UNIFI_MAX_CONNECTIONS; j++) { interfacePriv->staInfo[j] = NULL; @@ -139,7 +138,7 @@ uf_sme_deinit(unifi_priv_t *priv) /* Remove all the Peer database, before going down */ for (i = 0; i < CSR_WIFI_NUM_INTERFACES; i++) { - spin_lock(&priv->ba_lock); + down(&priv->ba_mutex); for(ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX; ba_session_idx++){ ba_session_rx = priv->interfacePriv[i]->ba_session_rx[ba_session_idx]; if(ba_session_rx) { @@ -161,7 +160,7 @@ uf_sme_deinit(unifi_priv_t *priv) } } - spin_unlock(&priv->ba_lock); + up(&priv->ba_mutex); interfacePriv = priv->interfacePriv[i]; if(interfacePriv){ for(j = 0; j < UNIFI_MAX_CONNECTIONS; j++) { diff --git a/drivers/staging/csr/sme_wext.c b/drivers/staging/csr/sme_wext.c index 384ccd4..3ba7b4c 100644 --- a/drivers/staging/csr/sme_wext.c +++ b/drivers/staging/csr/sme_wext.c @@ -29,8 +29,10 @@ } \ } while (0) -/* Workaround for the wpa_supplicant hanging issue */ +/* Workaround for the wpa_supplicant hanging issue - disabled on Android */ +#ifndef ANDROID_BUILD #define CSR_WIFI_WEXT_HANG_WORKAROUND +#endif #ifdef CSR_WIFI_WEXT_HANG_WORKAROUND # define UF_RTNL_LOCK() rtnl_lock() diff --git a/drivers/staging/csr/ul_int.c b/drivers/staging/csr/ul_int.c index ae14f23..958b8a1 100644 --- a/drivers/staging/csr/ul_int.c +++ b/drivers/staging/csr/ul_int.c @@ -265,7 +265,9 @@ ul_log_config_ind(unifi_priv_t *priv, u8 *conf_param, int len) /* wifi_off_ind (error or exit) */ CsrWifiRouterCtrlWifiOffIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,0, (CsrWifiRouterCtrlControlIndication)(*conf_param)); } - +#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE + unifi_debug_buf_dump(); +#endif #else bulk_data_param_t bulkdata; @@ -420,10 +422,6 @@ ul_send_signal_unpacked(unifi_priv_t *priv, CSR_SIGNAL *sigptr, CsrResult csrResult; unsigned long lock_flags; int r; -#ifdef CSR_SUPPORT_SME - netInterface_priv_t *interfacePriv = priv->interfacePriv[0]; - CsrUint32 alignOffset = 0; -#endif csrResult = write_pack(sigptr, sigbuf, &packed_siglen); @@ -431,12 +429,6 @@ ul_send_signal_unpacked(unifi_priv_t *priv, CSR_SIGNAL *sigptr, unifi_error(priv, "Malformed HIP signal in ul_send_signal_unpacked()\n"); return CsrHipResultToStatus(csrResult); } -#ifdef CSR_SUPPORT_SME - if (bulkdata != NULL){ - alignOffset = (CsrUint32)(long)(bulkdata->d[0].os_data_ptr) & (CSR_WIFI_ALIGN_BYTES-1); - - } -#endif r = _align_bulk_data_buffers(priv, sigbuf, (bulk_data_param_t*)bulkdata); if (r) { return r; @@ -449,17 +441,6 @@ ul_send_signal_unpacked(unifi_priv_t *priv, CSR_SIGNAL *sigptr, spin_unlock_irqrestore(&priv->send_signal_lock, lock_flags); return CsrHipResultToStatus(csrResult); } -#ifdef CSR_SUPPORT_SME - if (sigptr->SignalPrimitiveHeader.SignalId == CSR_MA_PACKET_REQUEST_ID) { - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - - uf_store_directed_ma_packet_referenece(priv, bulkdata, sigptr,alignOffset); - - } - } -#endif - spin_unlock_irqrestore(&priv->send_signal_lock, lock_flags); return 0; diff --git a/drivers/staging/csr/unifi_event.c b/drivers/staging/csr/unifi_event.c index cfc5b32..8b5d466 100644 --- a/drivers/staging/csr/unifi_event.c +++ b/drivers/staging/csr/unifi_event.c @@ -109,7 +109,11 @@ static CsrBool check_routing_pkt_data_ind(unifi_priv_t *priv, static const CsrUint8 wapiProtocolIdSNAPHeaderOffset = 6; CsrUint8 *destAddr; CsrUint8 *srcAddr; - CsrBool isUnicastPkt = FALSE; + CsrBool isWapiUnicastPkt = FALSE; + +#ifdef CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND + CsrUint16 qosControl; +#endif CsrUint8 llcSnapHeaderOffset = 0; @@ -117,7 +121,7 @@ static CsrBool check_routing_pkt_data_ind(unifi_priv_t *priv, srcAddr = (CsrUint8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR2_OFFSET; /*Individual/Group bit - Bit 0 of first byte*/ - isUnicastPkt = (!(destAddr[0] & 0x01)) ? TRUE : FALSE; + isWapiUnicastPkt = (!(destAddr[0] & 0x01)) ? TRUE : FALSE; #endif #define CSR_WIFI_MA_PKT_IND_RECEPTION_STATUS_OFFSET sizeof(CSR_SIGNAL_PRIMITIVE_HEADER) + 22 @@ -158,20 +162,54 @@ static CsrBool check_routing_pkt_data_ind(unifi_priv_t *priv, if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_STA) { +#ifdef CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND + if ((isDataFrame) && + ((IEEE802_11_FC_TYPE_QOS_DATA & IEEE80211_FC_SUBTYPE_MASK) == (frmCtrl & IEEE80211_FC_SUBTYPE_MASK)) && + (priv->isWapiConnection)) + { + qosControl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(macHdrLocation + (((frmCtrl & IEEE802_11_FC_TO_DS_MASK) && (frmCtrl & IEEE802_11_FC_FROM_DS_MASK)) ? 30 : 24) ); + + unifi_trace(priv, UDBG4, "check_routing_pkt_data_ind() :: Value of the QoS control field - 0x%04x \n", qosControl); + + if (qosControl & IEEE802_11_QC_NON_TID_BITS_MASK) + { + unifi_trace(priv, UDBG4, "Ignore the MIC failure and pass the MPDU to the stack when any of bits [4-15] is set in the QoS control field\n"); + + /*Exclude the MIC [16] and the PN [16] that are appended by the firmware*/ + ((bulk_data_param_t*)bulkdata)->d[0].data_length = bulkdata->d[0].data_length - 32; + + /*Clear the reception status of the signal (CSR_RX_SUCCESS)*/ + *(sigdata + CSR_WIFI_MA_PKT_IND_RECEPTION_STATUS_OFFSET) = 0x00; + *(sigdata + CSR_WIFI_MA_PKT_IND_RECEPTION_STATUS_OFFSET+1) = 0x00; + + *freeBulkData = FALSE; + + return FALSE; + } + } +#endif /* If this MIC ERROR reported by the firmware is either for - * [1] a WAPI Multicast Packet and the Multicast filter has NOT been set (It is set only when group key index (MSKID) = 1 in Group Rekeying) OR - * [2] a WAPI Unicast Packet and either the CONTROL PORT is open or the WAPI Unicast filter or filter(s) is NOT set + * [1] a WAPI Multicast MPDU and the Multicast filter has NOT been set (It is set only when group key index (MSKID) = 1 in Group Rekeying) OR + * [2] a WAPI Unicast MPDU and either the CONTROL PORT is open or the WAPI Unicast filter or filter(s) is NOT set * then report a MIC FAILURE indication to the SME. */ - if ((priv->wapi_multicast_filter == 0) || isUnicastPkt) { - +#ifndef CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION + if ((priv->wapi_multicast_filter == 0) || isWapiUnicastPkt) { +#else + /*When SW encryption is enabled and USKID=1 (wapi_unicast_filter = 1), we are expected + *to receive MIC failure INDs for unicast MPDUs*/ + if ( ((priv->wapi_multicast_filter == 0) && !isWapiUnicastPkt) || + ((priv->wapi_unicast_filter == 0) && isWapiUnicastPkt) ) { +#endif /*Discard the frame*/ *freeBulkData = TRUE; unifi_trace(priv, UDBG4, "Discarding the contents of the frame with MIC failure \n"); - if (isUnicastPkt && + if (isWapiUnicastPkt && ((uf_sme_port_state(priv,srcAddr,UF_CONTROLLED_PORT_Q,interfaceTag) != CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN)|| +#ifndef CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION (priv->wapi_unicast_filter) || +#endif (priv->wapi_unicast_queued_pkt_filter))) { /* Workaround to handle MIC failures reported by the firmware for encrypted packets from the AP @@ -225,7 +263,8 @@ static CsrBool check_routing_pkt_data_ind(unifi_priv_t *priv, /* To ignore MIC failures reported due to the WAPI AP using the old key for queued packets before * starting to use the new key negotiated as part of unicast re-keying */ - if (isUnicastPkt && + if ((interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_STA)&& + isWapiUnicastPkt && (receptionStatus == CSR_RX_SUCCESS) && (priv->wapi_unicast_queued_pkt_filter==1)) { @@ -297,16 +336,10 @@ static CsrBool check_routing_pkt_data_ind(unifi_priv_t *priv, return FALSE; } } -#ifdef CSR_WIFI_RX_PATH_SPLIT -static CsrBool signal_buffer_is_full(unifi_priv_t* priv) -{ - return (((priv->rxSignalBuffer.writePointer + 1)% priv->rxSignalBuffer.size) == (priv->rxSignalBuffer.readPointer)); -} -#endif /* * --------------------------------------------------------------------------- - * unifi_receive_event + * unifi_process_receive_event * * Dispatcher for received signals. * @@ -332,56 +365,11 @@ static CsrBool signal_buffer_is_full(unifi_priv_t* priv) * binded to the host interface specification. * --------------------------------------------------------------------------- */ - - -void -unifi_receive_event(void *ospriv, - CsrUint8 *sigdata, CsrUint32 siglen, - const bulk_data_param_t *bulkdata) +static void +unifi_process_receive_event(void *ospriv, + CsrUint8 *sigdata, CsrUint32 siglen, + const bulk_data_param_t *bulkdata) { -#ifdef CSR_WIFI_RX_PATH_SPLIT - unifi_priv_t *priv = (unifi_priv_t*)ospriv; - CsrUint8 writePointer; - int i; - rx_buff_struct_t * rx_buff; - func_enter(); - - unifi_trace(priv, UDBG5, "unifi_receive_event: " - "%04x %04x %04x %04x %04x %04x %04x %04x (%d)\n", - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*0) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*1) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*2) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*3) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*4) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*5) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*6) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*7) & 0xFFFF, siglen); - if(signal_buffer_is_full(priv)) { - unifi_error(priv,"TO HOST signal queue FULL dropping the PDU\n"); - for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { - if (bulkdata->d[i].data_length != 0) { - unifi_net_data_free(priv, (void *)&bulkdata->d[i]); - } - } - return; - } - writePointer = priv->rxSignalBuffer.writePointer; - rx_buff = &priv->rxSignalBuffer.rx_buff[writePointer]; - memcpy(rx_buff->bufptr,sigdata,siglen); - rx_buff->sig_len = siglen; - rx_buff->data_ptrs = *bulkdata; - writePointer++; - if(writePointer >= priv->rxSignalBuffer.size) { - writePointer =0; - } - unifi_trace(priv, UDBG4, "unifi_receive_event:writePtr = %d\n",priv->rxSignalBuffer.writePointer); - priv->rxSignalBuffer.writePointer = writePointer; - -#ifndef CSR_WIFI_RX_PATH_SPLIT_DONT_USE_WQ - queue_work(priv->rx_workqueue, &priv->rx_work_struct); -#endif - -#else unifi_priv_t *priv = (unifi_priv_t*)ospriv; int i, receiver_id; int client_id; @@ -390,16 +378,17 @@ unifi_receive_event(void *ospriv, func_enter(); - unifi_trace(priv, UDBG5, "unifi_receive_event: " - "%04x %04x %04x %04x %04x %04x %04x %04x (%d)\n", - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*0) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*1) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*2) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*3) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*4) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*5) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*6) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*7) & 0xFFFF, siglen); + unifi_trace(priv, UDBG5, "unifi_process_receive_event: " + "%04x %04x %04x %04x %04x %04x %04x %04x (%d)\n", + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*0) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*1) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*2) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*3) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*4) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*5) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*6) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*7) & 0xFFFF, + siglen); receiver_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)) & 0xFF00; client_id = (receiver_id & 0x0F00) >> UDI_SENDER_ID_SHIFT; @@ -410,18 +399,18 @@ unifi_receive_event(void *ospriv, /* check for the type of frame received (checks for 802.11 management frames) */ if (signal_id == CSR_MA_PACKET_INDICATION_ID) { +#define CSR_MA_PACKET_INDICATION_INTERFACETAG_OFFSET 14 CsrUint8 interfaceTag; netInterface_priv_t *interfacePriv; /* Pull out interface tag from virtual interface identifier */ - interfaceTag = (CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata + 14)) & 0xff; + interfaceTag = (CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata + CSR_MA_PACKET_INDICATION_INTERFACETAG_OFFSET)) & 0xff; interfacePriv = priv->interfacePriv[interfaceTag]; /* Update activity for this station in case of IBSS */ #ifdef CSR_SUPPORT_SME - - if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_IBSS) { - + if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_IBSS) + { CsrUint8 *saddr; /* Fetch the source address from mac header */ saddr = (CsrUint8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR2_OFFSET; @@ -436,6 +425,7 @@ unifi_receive_event(void *ospriv, pktIndToSme = check_routing_pkt_data_ind(priv, sigdata, bulkdata, &freeBulkData, interfacePriv); unifi_trace(priv, UDBG6, "RX: packet entry point to driver from HIP,pkt to SME ?(%s) \n", (pktIndToSme)? "YES":"NO"); + } if (pktIndToSme) @@ -445,7 +435,7 @@ unifi_receive_event(void *ospriv, send_to_client(priv, priv->sme_cli, receiver_id, sigdata, siglen, bulkdata); } else{ - unifi_error(priv, "unifi_receive_event: sigdata or Bulkdata is NULL \n"); + unifi_error(priv, "unifi_receive_event2: sigdata or Bulkdata is NULL \n"); } #ifdef CSR_NATIVE_LINUX send_to_client(priv, priv->wext_client, @@ -459,67 +449,99 @@ unifi_receive_event(void *ospriv, * unless they are data/control MA_PACKET_INDs or VIF_AVAILABILITY_INDs */ if (!receiver_id) { - if(signal_id == CSR_MA_VIF_AVAILABILITY_INDICATION_ID) - { - uf_process_ma_vif_availibility_ind(priv, sigdata, siglen); - } - else if (signal_id != CSR_MA_PACKET_INDICATION_ID) - { - send_to_client(priv, priv->sme_cli, receiver_id, sigdata, siglen, bulkdata); + if(signal_id == CSR_MA_VIF_AVAILABILITY_INDICATION_ID) { + uf_process_ma_vif_availibility_ind(priv, sigdata, siglen); + } + else if (signal_id != CSR_MA_PACKET_INDICATION_ID) { + send_to_client(priv, priv->sme_cli, receiver_id, sigdata, siglen, bulkdata); #ifdef CSR_NATIVE_LINUX - send_to_client(priv, priv->wext_client, - receiver_id, - sigdata, siglen, bulkdata); + send_to_client(priv, priv->wext_client, + receiver_id, + sigdata, siglen, bulkdata); #endif - } - }/*if (receiver_id==0) */ - -#ifdef CSR_SUPPORT_SME -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - /* Send a WAPI Multicast Indication to SME if the filter has been set - * and this is a multicast data packet - */ - if ((priv->wapi_multicast_filter == 1) && (signal_id == CSR_MA_PACKET_INDICATION_ID)) { - CSR_SIGNAL signal; - CsrUint8 *destAddr; - CsrResult res; - CsrUint16 interfaceTag = 0; - - /* Check if it is a multicast packet from the destination address in the MAC header */ - res = read_unpack_signal(sigdata, &signal); - destAddr = (CsrUint8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR1_OFFSET; - if (res) { - unifi_error(priv, "Received unknown or corrupted signal.\n"); - return; - } - /*Individual/Group bit - Bit 0 of first byte*/ - if (destAddr[0] & 0x01) { - unifi_trace(priv, UDBG4, "Received a WAPI multicast packet ind\n"); - - CsrWifiRouterCtrlWapiMulticastIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, siglen, sigdata, bulkdata->d[0].data_length, (CsrUint8*)bulkdata->d[0].os_data_ptr); - - for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { - if (bulkdata->d[i].data_length != 0) { - unifi_net_data_free(priv, (void *)&bulkdata->d[i]); - } - } - func_exit(); - return; - } - } + } + else + { + +#if (defined(CSR_SUPPORT_SME) && defined(CSR_WIFI_SECURITY_WAPI_ENABLE)) + #define CSR_MA_PACKET_INDICATION_RECEPTION_STATUS_OFFSET sizeof(CSR_SIGNAL_PRIMITIVE_HEADER) + 22 + netInterface_priv_t *interfacePriv; + CsrUint8 interfaceTag; + CsrUint16 receptionStatus = CSR_RX_SUCCESS; + + /* Pull out interface tag from virtual interface identifier */ + interfaceTag = (CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata + CSR_MA_PACKET_INDICATION_INTERFACETAG_OFFSET)) & 0xff; + interfacePriv = priv->interfacePriv[interfaceTag]; + + /* check for MIC failure */ + receptionStatus = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata + CSR_MA_PACKET_INDICATION_RECEPTION_STATUS_OFFSET); + + /* Send a WAPI MPDU to SME for re-check MIC if the respective filter has been set*/ + if ((!freeBulkData) && + (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_STA) && + (receptionStatus == CSR_MICHAEL_MIC_ERROR) && + ((priv->wapi_multicast_filter == 1) +#ifdef CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION + || (priv->wapi_unicast_filter == 1) #endif + )) + { + CSR_SIGNAL signal; + CsrUint8 *destAddr; + CsrResult res; + CsrUint16 interfaceTag = 0; + CsrBool isMcastPkt = TRUE; + + unifi_trace(priv, UDBG6, "Received a WAPI data packet when the Unicast/Multicast filter is set\n"); + res = read_unpack_signal(sigdata, &signal); + if (res) { + unifi_error(priv, "Received unknown or corrupted signal (0x%x).\n", + CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata)); + return; + } + + /* Check if the type of MPDU and the respective filter status*/ + destAddr = (CsrUint8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR1_OFFSET; + isMcastPkt = (destAddr[0] & 0x01) ? TRUE : FALSE; + unifi_trace(priv, UDBG6, + "1.MPDU type: (%s), 2.Multicast filter: (%s), 3. Unicast filter: (%s)\n", + ((isMcastPkt) ? "Multiast":"Unicast"), + ((priv->wapi_multicast_filter) ? "Enabled":"Disabled"), + ((priv->wapi_unicast_filter) ? "Enabled":"Disabled")); + + if (((isMcastPkt) && (priv->wapi_multicast_filter == 1)) +#ifdef CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION + || ((!isMcastPkt) && (priv->wapi_unicast_filter == 1)) #endif + ) + { + unifi_trace(priv, UDBG4, "Sending the WAPI MPDU for MIC check\n"); + CsrWifiRouterCtrlWapiRxMicCheckIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, siglen, sigdata, bulkdata->d[0].data_length, (CsrUint8*)bulkdata->d[0].os_data_ptr); + + for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { + if (bulkdata->d[i].data_length != 0) { + unifi_net_data_free(priv, (void *)&bulkdata->d[i]); + } + } + func_exit(); + return; + } + } /* CSR_MA_PACKET_INDICATION_ID */ +#endif /*CSR_SUPPORT_SME && CSR_WIFI_SECURITY_WAPI_ENABLE*/ + } + } /* calls the registered clients handler callback func. * netdev_mlme_event_handler is one of the registered handler used to route * data packet to network stack or AMP/EAPOL related data to SME - */ - /* The freeBulkData check ensures that, it has received a management frame and + * + * The freeBulkData check ensures that, it has received a management frame and * the frame needs to be freed here. So not to be passed to netdev handler */ if(!freeBulkData){ if ((client_id < MAX_UDI_CLIENTS) && (&priv->ul_clients[client_id] != priv->logging_client)) { + unifi_trace(priv, UDBG6, "Call the registered clients handler callback func\n"); send_to_client(priv, &priv->ul_clients[client_id], receiver_id, sigdata, siglen, bulkdata); @@ -550,14 +572,54 @@ unifi_receive_event(void *ospriv, } } } -#endif + func_exit(); -} /* unifi_receive_event() */ +} /* unifi_process_receive_event() */ + #ifdef CSR_WIFI_RX_PATH_SPLIT +static CsrBool signal_buffer_is_full(unifi_priv_t* priv) +{ + return (((priv->rxSignalBuffer.writePointer + 1)% priv->rxSignalBuffer.size) == (priv->rxSignalBuffer.readPointer)); +} + +void unifi_rx_queue_flush(void *ospriv) +{ + unifi_priv_t *priv = (unifi_priv_t*)ospriv; + + func_enter(); + unifi_trace(priv, UDBG4, "rx_wq_handler: RdPtr = %d WritePtr = %d\n", + priv->rxSignalBuffer.readPointer,priv->rxSignalBuffer.writePointer); + if(priv != NULL) { + CsrUint8 readPointer = priv->rxSignalBuffer.readPointer; + while (readPointer != priv->rxSignalBuffer.writePointer) + { + rx_buff_struct_t *buf = &priv->rxSignalBuffer.rx_buff[readPointer]; + unifi_trace(priv, UDBG6, "rx_wq_handler: RdPtr = %d WritePtr = %d\n", + readPointer,priv->rxSignalBuffer.writePointer); + unifi_process_receive_event(priv, buf->bufptr, buf->sig_len, &buf->data_ptrs); + readPointer ++; + if(readPointer >= priv->rxSignalBuffer.size) { + readPointer = 0; + } + } + priv->rxSignalBuffer.readPointer = readPointer; + } + func_exit(); +} + +void rx_wq_handler(struct work_struct *work) +{ + unifi_priv_t *priv = container_of(work, unifi_priv_t, rx_work_struct); + unifi_rx_queue_flush(priv); +} +#endif + + + /* * --------------------------------------------------------------------------- - * unifi_receive_event2 + * unifi_receive_event * * Dispatcher for received signals. * @@ -583,20 +645,19 @@ unifi_receive_event(void *ospriv, * binded to the host interface specification. * --------------------------------------------------------------------------- */ -static void -unifi_receive_event2(void *ospriv, - CsrUint8 *sigdata, CsrUint32 siglen, - const bulk_data_param_t *bulkdata) +void +unifi_receive_event(void *ospriv, + CsrUint8 *sigdata, CsrUint32 siglen, + const bulk_data_param_t *bulkdata) { +#ifdef CSR_WIFI_RX_PATH_SPLIT unifi_priv_t *priv = (unifi_priv_t*)ospriv; - int i, receiver_id; - int client_id; - CsrInt16 signal_id; - CsrBool pktIndToSme = FALSE, freeBulkData = FALSE; - + CsrUint8 writePointer; + int i; + rx_buff_struct_t * rx_buff; func_enter(); - unifi_trace(priv, UDBG5, "unifi_receive_event2: " + unifi_trace(priv, UDBG5, "unifi_receive_event: " "%04x %04x %04x %04x %04x %04x %04x %04x (%d)\n", CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*0) & 0xFFFF, CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*1) & 0xFFFF, @@ -606,189 +667,34 @@ unifi_receive_event2(void *ospriv, CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*5) & 0xFFFF, CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*6) & 0xFFFF, CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*7) & 0xFFFF, siglen); - - receiver_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)) & 0xFF00; - client_id = (receiver_id & 0x0F00) >> UDI_SENDER_ID_SHIFT; - signal_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata); - - - - /* check for the type of frame received (checks for 802.11 management frames) */ - if (signal_id == CSR_MA_PACKET_INDICATION_ID) - { - CsrUint8 interfaceTag; - netInterface_priv_t *interfacePriv; - - /* Pull out interface tag from virtual interface identifier */ - interfaceTag = (CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata + 14)) & 0xff; - interfacePriv = priv->interfacePriv[interfaceTag]; - - /* Update activity for this station in case of IBSS */ -#ifdef CSR_SUPPORT_SME - - if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_IBSS) { - - CsrUint8 *saddr; - /* Fetch the source address from mac header */ - saddr = (CsrUint8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR2_OFFSET; - unifi_trace(priv, UDBG5, - "Updating sta activity in IBSS interfaceTag %x Src Addr %x:%x:%x:%x:%x:%x\n", - interfaceTag, saddr[0], saddr[1], saddr[2], saddr[3], saddr[4], saddr[5]); - - uf_update_sta_activity(priv, interfaceTag, saddr); + if(signal_buffer_is_full(priv)) { + unifi_error(priv,"TO HOST signal queue FULL dropping the PDU\n"); + for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { + if (bulkdata->d[i].data_length != 0) { + unifi_net_data_free(priv, (void *)&bulkdata->d[i]); + } } -#endif - - pktIndToSme = check_routing_pkt_data_ind(priv, sigdata, bulkdata, &freeBulkData, interfacePriv); - - unifi_trace(priv, UDBG6, "RX: packet entry point to driver from HIP,pkt to SME ?(%s) \n", (pktIndToSme)? "YES":"NO"); - + return; } - - if (pktIndToSme) - { - /* Management MA_PACKET_IND for SME */ - if(sigdata != NULL && bulkdata != NULL){ - send_to_client(priv, priv->sme_cli, receiver_id, sigdata, siglen, bulkdata); - } - else{ - unifi_error(priv, "unifi_receive_event2: sigdata or Bulkdata is NULL \n"); - } -#ifdef CSR_NATIVE_LINUX - send_to_client(priv, priv->wext_client, - receiver_id, - sigdata, siglen, bulkdata); -#endif + writePointer = priv->rxSignalBuffer.writePointer; + rx_buff = &priv->rxSignalBuffer.rx_buff[writePointer]; + memcpy(rx_buff->bufptr,sigdata,siglen); + rx_buff->sig_len = siglen; + rx_buff->data_ptrs = *bulkdata; + writePointer++; + if(writePointer >= priv->rxSignalBuffer.size) { + writePointer =0; } - else - { - /* Signals with ReceiverId==0 are also reported to SME / WEXT, - * unless they are data/control MA_PACKET_INDs or VIF_AVAILABILITY_INDs - */ - if (!receiver_id) { - if(signal_id == CSR_MA_VIF_AVAILABILITY_INDICATION_ID) - { - uf_process_ma_vif_availibility_ind(priv, sigdata, siglen); - } - else if (signal_id != CSR_MA_PACKET_INDICATION_ID) - { - send_to_client(priv, priv->sme_cli, receiver_id, sigdata, siglen, bulkdata); -#ifdef CSR_NATIVE_LINUX - send_to_client(priv, priv->wext_client, - receiver_id, - sigdata, siglen, bulkdata); -#endif - } - } - -#ifdef CSR_SUPPORT_SME -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - /* Send a WAPI Multicast Indication to SME if the filter has been set - * and this is a multicast data packet - */ - if ((priv->wapi_multicast_filter == 1) && (signal_id == CSR_MA_PACKET_INDICATION_ID)) { - CSR_SIGNAL signal; - CsrUint8 *destAddr; - CsrResult res; - CsrUint16 interfaceTag = 0; - - /* Check if it is a multicast packet from the destination address in the MAC header */ - res = read_unpack_signal(sigdata, &signal); - destAddr = (CsrUint8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR1_OFFSET; - if (res) { - unifi_error(priv, "Received unknown or corrupted signal.\n"); - return; - } - /*Individual/Group bit - Bit 0 of first byte*/ - if (destAddr[0] & 0x01) { - unifi_trace(priv, UDBG4, "Received a WAPI multicast packet ind\n"); - - CsrWifiRouterCtrlWapiMulticastIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, siglen, sigdata, bulkdata->d[0].data_length, (CsrUint8*)bulkdata->d[0].os_data_ptr); + unifi_trace(priv, UDBG4, "unifi_receive_event:writePtr = %d\n",priv->rxSignalBuffer.writePointer); + priv->rxSignalBuffer.writePointer = writePointer; - for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { - if (bulkdata->d[i].data_length != 0) { - unifi_net_data_free(priv, (void *)&bulkdata->d[i]); - } - } - func_exit(); - return; - } - } -#endif +#ifndef CSR_WIFI_RX_PATH_SPLIT_DONT_USE_WQ + queue_work(priv->rx_workqueue, &priv->rx_work_struct); #endif - /* calls the registered clients handler callback func. - * netdev_mlme_event_handler is one of the registered handler used to route - * data packet to network stack or AMP/EAPOL related data to SME - */ - /* The freeBulkData check ensures that, it has received a management frame and - * the frame needs to be freed here. So not to be passed to netdev handler - */ - if(!freeBulkData){ - if ((client_id < MAX_UDI_CLIENTS) && - (&priv->ul_clients[client_id] != priv->logging_client)) { - send_to_client(priv, &priv->ul_clients[client_id], - receiver_id, - sigdata, siglen, bulkdata); - } - } - } - - /* - * Free bulk data buffers here unless it is a CSR_MA_PACKET_INDICATION - */ - switch (signal_id) - { -#ifdef UNIFI_SNIFF_ARPHRD - case CSR_MA_SNIFFDATA_INDICATION_ID: +#else + unifi_process_receive_event(ospriv, sigdata, siglen, bulkdata); #endif - break; - - case CSR_MA_PACKET_INDICATION_ID: - if (!freeBulkData) - { - break; - } - /* FALLS THROUGH... */ - default: - for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { - if (bulkdata->d[i].data_length != 0) { - unifi_net_data_free(priv, (void *)&bulkdata->d[i]); - } - } - } - func_exit(); -} /* unifi_receive_event2() */ - -void unifi_rx_queue_flush(void *ospriv) -{ - unifi_priv_t *priv = (unifi_priv_t*)ospriv; - - func_enter(); - unifi_trace(priv, UDBG4, "rx_wq_handler: RdPtr = %d WritePtr = %d\n", - priv->rxSignalBuffer.readPointer,priv->rxSignalBuffer.writePointer); - if(priv != NULL) { - CsrUint8 readPointer = priv->rxSignalBuffer.readPointer; - while(readPointer != priv->rxSignalBuffer.writePointer) { - rx_buff_struct_t * buf = &priv->rxSignalBuffer.rx_buff[readPointer]; - unifi_trace(priv, UDBG6, "rx_wq_handler: RdPtr = %d WritePtr = %d\n", - readPointer,priv->rxSignalBuffer.writePointer); - unifi_receive_event2(priv,buf->bufptr,buf->sig_len,&buf->data_ptrs); - readPointer ++; - if(readPointer >= priv->rxSignalBuffer.size) { - readPointer = 0; - } - } - priv->rxSignalBuffer.readPointer = readPointer; - } - func_exit(); -} - -void rx_wq_handler(struct work_struct *work) -{ - unifi_priv_t *priv = container_of(work,unifi_priv_t,rx_work_struct); - unifi_rx_queue_flush(priv); -} +} /* unifi_receive_event() */ -#endif diff --git a/drivers/staging/csr/unifi_os.h b/drivers/staging/csr/unifi_os.h index 579c7e0..0a97494 100644 --- a/drivers/staging/csr/unifi_os.h +++ b/drivers/staging/csr/unifi_os.h @@ -97,6 +97,13 @@ void dump16(void *mem, CsrUint16 len); void dump_str(void *mem, CsrUint16 len); #endif /* CSR_WIFI_HIP_DEBUG_OFFLINE */ +void unifi_error(void* ospriv, const char *fmt, ...); +void unifi_warning(void* ospriv, const char *fmt, ...); +void unifi_notice(void* ospriv, const char *fmt, ...); +void unifi_info(void* ospriv, const char *fmt, ...); + +void unifi_trace(void* ospriv, int level, const char *fmt, ...); + #else /* Stubs */ @@ -113,15 +120,16 @@ static inline void dump16(void *mem, CsrUint16 len) {} static inline void dump_str(void *mem, CsrUint16 len) {} #endif /* CSR_WIFI_HIP_DEBUG_OFFLINE */ -#endif /* UNIFI_DEBUG */ +void unifi_error_nop(void* ospriv, const char *fmt, ...); +void unifi_trace_nop(void* ospriv, int level, const char *fmt, ...); +#define unifi_error if(1);else unifi_error_nop +#define unifi_warning if(1);else unifi_error_nop +#define unifi_notice if(1);else unifi_error_nop +#define unifi_info if(1);else unifi_error_nop +#define unifi_trace if(1);else unifi_trace_nop +#endif /* UNIFI_DEBUG */ -void unifi_error(void* ospriv, const char *fmt, ...); -void unifi_warning(void* ospriv, const char *fmt, ...); -void unifi_notice(void* ospriv, const char *fmt, ...); -void unifi_info(void* ospriv, const char *fmt, ...); - -void unifi_trace(void* ospriv, int level, const char *fmt, ...); /* Different levels of diagnostic detail... */ #define UDBG0 0 /* always prints in debug build */ diff --git a/drivers/staging/csr/unifi_pdu_processing.c b/drivers/staging/csr/unifi_pdu_processing.c index 36b871e..e35747c 100644 --- a/drivers/staging/csr/unifi_pdu_processing.c +++ b/drivers/staging/csr/unifi_pdu_processing.c @@ -32,22 +32,23 @@ static void _update_buffered_pkt_params_after_alignment(unifi_priv_t *priv, bulk_data_param_t *bulkdata, tx_buffered_packets_t* buffered_pkt) { - struct sk_buff *skb ; CsrUint32 align_offset; if (priv == NULL || bulkdata == NULL || buffered_pkt == NULL){ return; } + skb = (struct sk_buff*)bulkdata->d[0].os_net_buf_ptr; align_offset = (CsrUint32)(long)(bulkdata->d[0].os_data_ptr) & (CSR_WIFI_ALIGN_BYTES-1); if(align_offset){ skb_pull(skb,align_offset); } - buffered_pkt->bulkdata.os_data_ptr = skb->data; - buffered_pkt->bulkdata.data_length = skb->len; - + buffered_pkt->bulkdata.os_data_ptr = bulkdata->d[0].os_data_ptr; + buffered_pkt->bulkdata.data_length = bulkdata->d[0].data_length; + buffered_pkt->bulkdata.os_net_buf_ptr = bulkdata->d[0].os_net_buf_ptr; + buffered_pkt->bulkdata.net_buf_length = bulkdata->d[0].net_buf_length; } #endif @@ -122,7 +123,7 @@ unifi_frame_ma_packet_req(unifi_priv_t *priv, CSR_PRIORITY priority, #ifdef CSR_SUPPORT_SME #define TRANSMISSION_CONTROL_TRIGGER_MASK 0x0001 -#define TRANSMISSION_CONTROL_ESOP_MASK 0x0002 +#define TRANSMISSION_CONTROL_EOSP_MASK 0x0002 static int frame_and_send_queued_pdu(unifi_priv_t* priv,tx_buffered_packets_t* buffered_pkt, @@ -167,34 +168,27 @@ int frame_and_send_queued_pdu(unifi_priv_t* priv,tx_buffered_packets_t* buffered case IEEE802_11_FC_TYPE_QOS_DATA & IEEE80211_FC_SUBTYPE_MASK: case IEEE802_11_FC_TYPE_QOS_NULL & IEEE80211_FC_SUBTYPE_MASK: /* If both are set then the Address4 exists (only for AP) */ - if (fromDs && toDs) - { + if (fromDs && toDs) { /* 6 is the size of Address4 field */ macHeaderLengthInBytes += (QOS_CONTROL_HEADER_SIZE + 6); - } - else - { + } else { macHeaderLengthInBytes += QOS_CONTROL_HEADER_SIZE; } /* If order bit set then HT control field is the part of MAC header */ if (*fc & cpu_to_le16(IEEE80211_FC_ORDER_MASK)) { macHeaderLengthInBytes += HT_CONTROL_HEADER_SIZE; + qc = (CsrUint8*)(buffered_pkt->bulkdata.os_data_ptr + (macHeaderLengthInBytes-6)); + } else { + qc = (CsrUint8*)(buffered_pkt->bulkdata.os_data_ptr + (macHeaderLengthInBytes-2)); } + *qc = eosp ? *qc | (1 << 4) : *qc & (~(1 << 4)); break; default: if (fromDs && toDs) macHeaderLengthInBytes += 6; - break; - } - - if (*fc & cpu_to_le16(IEEE80211_FC_ORDER_MASK)) { - qc = (CsrUint8*)(buffered_pkt->bulkdata.os_data_ptr + (macHeaderLengthInBytes-6)); - } else { - qc = (CsrUint8*)(buffered_pkt->bulkdata.os_data_ptr + (macHeaderLengthInBytes-2)); } - *qc = eosp ? *qc | (1 << 4) : *qc & (~(1 << 4)); } result = ul_send_signal_unpacked(priv, &signal, &bulkdata); if(result){ @@ -254,7 +248,7 @@ void set_eosp_transmit_ctrl(unifi_priv_t *priv, struct list_head *txList) spin_lock_irqsave(&priv->tx_q_lock,lock_flags); list_for_each_prev_safe(listHead, placeHolder, txList) { tx_q_item = list_entry(listHead, tx_buffered_packets_t, q); - tx_q_item->transmissionControl |= TRANSMISSION_CONTROL_ESOP_MASK; + tx_q_item->transmissionControl |= TRANSMISSION_CONTROL_EOSP_MASK; tx_q_item->transmissionControl = (tx_q_item->transmissionControl & ~(CSR_NO_CONFIRM_REQUIRED)); unifi_trace(priv, UDBG1, "set_eosp_transmit_ctrl Transmission Control = 0x%x hostTag = 0x%x \n",tx_q_item->transmissionControl,tx_q_item->hostTag); @@ -275,6 +269,8 @@ void send_vif_availibility_rsp(unifi_priv_t *priv,CSR_VIF_IDENTIFIER vif,CSR_RES bulk_data_param_t *bulkdata = NULL; int r; + unifi_trace(priv, UDBG3, "send_vif_availibility_rsp : invoked with resultCode = %d \n", resultCode); + memset(&signal,0,sizeof(CSR_SIGNAL)); rsp = &signal.u.MaVifAvailabilityResponse; rsp->VirtualInterfaceIdentifier = vif; @@ -288,6 +284,9 @@ void send_vif_availibility_rsp(unifi_priv_t *priv,CSR_VIF_IDENTIFIER vif,CSR_RES if(r) { unifi_error(priv,"Availibility response sending failed %x status %d\n",vif,r); } + else { + unifi_trace(priv, UDBG3, "send_vif_availibility_rsp : status = %d \n", r); + } } #endif @@ -354,14 +353,14 @@ void verify_and_accomodate_tx_packet(unifi_priv_t *priv) list_for_each_safe(listHead, placeHolder, &interfacePriv->genericMulticastOrBroadCastFrames) { tx_q_item = list_entry(listHead, tx_buffered_packets_t, q); if(eospFramedeleted){ - tx_q_item->transmissionControl |= TRANSMISSION_CONTROL_ESOP_MASK; + tx_q_item->transmissionControl |= TRANSMISSION_CONTROL_EOSP_MASK; tx_q_item->transmissionControl = (tx_q_item->transmissionControl & ~(CSR_NO_CONFIRM_REQUIRED)); unifi_trace(priv, UDBG1,"updating eosp for next packet hostTag:= 0x%x ",tx_q_item->hostTag); eospFramedeleted =0; break; } - if(tx_q_item->transmissionControl & TRANSMISSION_CONTROL_ESOP_MASK ){ + if(tx_q_item->transmissionControl & TRANSMISSION_CONTROL_EOSP_MASK ){ eospFramedeleted = 1; } unifi_trace(priv,UDBG1, "freeing of multicast packets ToC = 0x%x hostTag = 0x%x \n",tx_q_item->transmissionControl,tx_q_item->hostTag); @@ -445,66 +444,162 @@ CsrResult enque_tx_data_pdu(unifi_priv_t *priv, bulk_data_param_t *bulkdata, unifi_trace(priv, UDBG5, "leaving enque_tx_data_pdu\n"); return CSR_RESULT_SUCCESS; } -static -CsrResult enque_direceted_ma_pkt_cfm_data_pdu(unifi_priv_t *priv, bulk_data_param_t *bulkdata, - struct list_head *list, CSR_SIGNAL *signal, - CsrBool requeueOnSamePos) + +#ifdef CSR_WIFI_REQUEUE_PACKET_TO_HAL +CsrResult unifi_reque_ma_packet_request (void *ospriv, CsrUint32 host_tag, + CsrUint16 txStatus, bulk_data_desc_t *bulkDataDesc) { + CsrResult status = CSR_RESULT_SUCCESS; + unifi_priv_t *priv = (unifi_priv_t*)ospriv; + netInterface_priv_t *interfacePriv; + struct list_head *list = NULL; + CsrWifiRouterCtrlStaInfo_t *staRecord = NULL; + bulk_data_param_t bulkData; + CSR_SIGNAL signal; + CSR_PRIORITY priority = 0; + CsrUint16 interfaceTag = 0; + unifi_TrafficQueue priority_q; + CsrUint16 frameControl = 0, frameType = 0; + unsigned long lock_flags; - /* queue the tx data packets on to appropriate queue */ - CSR_MA_PACKET_REQUEST *req = &signal->u.MaPacketRequest; - tx_buffered_packets_t *tx_q_item; + interfacePriv = priv->interfacePriv[interfaceTag]; + + /* If the current mode is not AP or P2PGO then just return failure + * to clear the hip slot + */ + if(!((interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP) || + (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO))) { + return CSR_RESULT_FAILURE; + } + unifi_trace(priv, UDBG6, "unifi_reque_ma_packet_request: host_tag = 0x%x\n", host_tag); - unifi_trace(priv, UDBG5, "entering enque_tx_data_pdu\n"); - if(!list ) { - unifi_error(priv,"List is not specified\n"); - return CSR_RESULT_FAILURE; + staRecord = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, + (((CsrUint8 *) bulkDataDesc->os_data_ptr) + 4), + interfaceTag); + if (NULL == staRecord) { + unifi_trace(priv, UDBG5, "unifi_reque_ma_packet_request: Invalid STA record \n"); + return CSR_RESULT_FAILURE; } - if(!requeueOnSamePos && !list->prev){ - unifi_error(priv,"List prev is NULL so don't requeu it\n"); - return CSR_RESULT_FAILURE; + /* Update TIM if MA-PACKET.cfm fails with status as Tx-retry-limit or No-BSS and then just return failure + * to clear the hip slot associated with the Packet + */ + if (CSR_TX_RETRY_LIMIT == txStatus || CSR_TX_NO_BSS == txStatus) { + if (staRecord->timSet == CSR_WIFI_TIM_RESET || staRecord->timSet == CSR_WIFI_TIM_RESETTING) + { + unifi_trace(priv, UDBG2, "unifi_reque_ma_packet_request: CFM failed with Retry Limit or No BSS-->update TIM\n"); + if (!staRecord->timRequestPendingFlag) { + update_tim(priv, staRecord->aid, 1, interfaceTag, staRecord->assignedHandle); + } + else { + /* Cache the TimSet value so that it will processed immidiatly after + * completing the current setTim Request + */ + staRecord->updateTimReqQueued = 1; + unifi_trace(priv, UDBG6, "unifi_reque_ma_packet_request: One more UpdateTim Request(:%d)Queued for AID %x\n", + staRecord->updateTimReqQueued, staRecord->aid); + } + } + return CSR_RESULT_FAILURE; } + else if ((CSR_TX_LIFETIME == txStatus) || (CSR_TX_BLOCK_ACK_TIMEOUT == txStatus) || + (CSR_TX_FAIL_TRANSMISSION_VIF_INTERRUPTED == txStatus) || + (CSR_TX_REJECTED_PEER_STATION_SLEEPING == txStatus) || + (CSR_TX_REJECTED_DTIM_STARTED == txStatus)) { + /* Extract the Frame control and the frame type */ + frameControl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(bulkDataDesc->os_data_ptr); + frameType = ((frameControl & IEEE80211_FC_TYPE_MASK) >> FRAME_CONTROL_TYPE_FIELD_OFFSET); + /* Mgmt frames will not be re-queued for Tx + * so just return failure to clear the hip slot + */ + if (IEEE802_11_FRAMETYPE_MANAGEMENT == frameType) { + return CSR_RESULT_FAILURE; + } + else if (IEEE802_11_FRAMETYPE_DATA == frameType) { + /* QOS NULL and DATA NULL frames will not be re-queued for Tx + * so just return failure to clear the hip slot + */ + if ((((frameControl & IEEE80211_FC_SUBTYPE_MASK) >> FRAME_CONTROL_SUBTYPE_FIELD_OFFSET) == QOS_DATA_NULL) || + (((frameControl & IEEE80211_FC_SUBTYPE_MASK) >> FRAME_CONTROL_SUBTYPE_FIELD_OFFSET)== DATA_NULL )) { + return CSR_RESULT_FAILURE; + } + } + /* Extract the Packet priority */ + if (TRUE == staRecord->wmmOrQosEnabled) { + CsrUint16 qosControl = 0; + CsrUint8 dataFrameType = 0; - tx_q_item = (tx_buffered_packets_t *)kmalloc(sizeof(tx_buffered_packets_t), GFP_ATOMIC); - if (tx_q_item == NULL) { - unifi_error(priv, - "Failed to allocate %d bytes for tx packet record\n", - sizeof(tx_buffered_packets_t)); - func_exit(); - return CSR_RESULT_FAILURE; - } - /* disable the preemption */ - INIT_LIST_HEAD(&tx_q_item->q); - /* fill the tx_q structure members */ - tx_q_item->bulkdata.os_data_ptr = bulkdata->d[0].os_data_ptr; - tx_q_item->bulkdata.data_length = bulkdata->d[0].data_length; - tx_q_item->bulkdata.os_net_buf_ptr = bulkdata->d[0].os_net_buf_ptr; - tx_q_item->bulkdata.net_buf_length = bulkdata->d[0].net_buf_length; - tx_q_item->interfaceTag = req->VirtualInterfaceIdentifier & 0xff; - tx_q_item->hostTag = req->HostTag; - tx_q_item->leSenderProcessId = signal->SignalPrimitiveHeader.SenderProcessId; - tx_q_item->transmissionControl = req->TransmissionControl; - tx_q_item->priority = req->Priority; - tx_q_item->rate = req->TransmitRate; - memcpy(tx_q_item->peerMacAddress.a, req->Ra.x, ETH_ALEN); + dataFrameType =((frameControl & IEEE80211_FC_SUBTYPE_MASK) >> 4); + if (dataFrameType == QOS_DATA) { + /* QoS control field is offset from frame control by 2 (frame control) + * + 2 (duration/ID) + 2 (sequence control) + 3*ETH_ALEN or 4*ETH_ALEN + */ + if((frameControl & IEEE802_11_FC_TO_DS_MASK) && (frameControl & IEEE802_11_FC_FROM_DS_MASK)) { + qosControl= CSR_GET_UINT16_FROM_LITTLE_ENDIAN(bulkDataDesc->os_data_ptr + 30); + } + else { + qosControl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(bulkDataDesc->os_data_ptr + 24); + } + } + priority = (CSR_PRIORITY)(qosControl & IEEE802_11_QC_TID_MASK); - if (requeueOnSamePos) { - list_add(&tx_q_item->q, list); - } else { - list_add_tail(&tx_q_item->q, list); + if (priority < CSR_QOS_UP0 || priority > CSR_QOS_UP7) { + unifi_trace(priv, UDBG5, "unifi_reque_ma_packet_request: Invalid priority:%x \n", priority); + return CSR_RESULT_FAILURE; + } + } + else { + priority = CSR_CONTENTION; + } + + /* Frame Bulk data to requeue it back to HAL Queues */ + bulkData.d[0].os_data_ptr = bulkDataDesc->os_data_ptr; + bulkData.d[0].data_length = bulkDataDesc->data_length; + bulkData.d[0].os_net_buf_ptr = bulkDataDesc->os_net_buf_ptr; + bulkData.d[0].net_buf_length = bulkDataDesc->net_buf_length; + + bulkData.d[1].os_data_ptr = NULL; + bulkData.d[1].os_net_buf_ptr = NULL; + bulkData.d[1].data_length = bulkData.d[1].net_buf_length = 0; + + /* Initialize signal to zero */ + memset(&signal, 0, sizeof(CSR_SIGNAL)); + + /* Frame MA Packet Req */ + unifi_frame_ma_packet_req(priv, priority, 0, host_tag, + interfaceTag, CSR_NO_CONFIRM_REQUIRED, + priv->netdev_client->sender_id, + staRecord->peerMacAddress.a, &signal); + + /* Find the Q-Priority */ + priority_q = unifi_frame_priority_to_queue(priority); + list = &staRecord->dataPdu[priority_q]; + + /* Place the Packet on to HAL Queue */ + status = enque_tx_data_pdu(priv, &bulkData, list, &signal, TRUE); + + /* Update the Per-station queued packet counter */ + if (!status) { + spin_lock_irqsave(&priv->staRecord_lock, lock_flags); + staRecord->noOfPktQueued++; + spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); + } + } + else { + /* Packet will not be re-queued for any of the other MA Packet Tx failure + * reasons so just return failure to clear the hip slot + */ + return CSR_RESULT_FAILURE; } - /* Count of packet queued in driver */ - priv->noOfPktQueuedInDriver++; - unifi_trace(priv, UDBG5, "leaving enque_tx_data_pdu\n"); - return CSR_RESULT_SUCCESS; + return status; } +#endif static void is_all_ac_deliver_enabled_and_moredata(CsrWifiRouterCtrlStaInfo_t *staRecord, CsrUint8 *allDeliveryEnabled, CsrUint8 *dataAvailable) { @@ -601,12 +696,53 @@ void uf_handle_tim_cfm(unifi_priv_t *priv, CSR_MLME_SET_TIM_CONFIRM *cfm, CsrUin unifi_trace(priv, UDBG3, "receiver processID = %x, success: request & confirm states are not matching in TIM cfm: Debug status = %x, staRecord->timSet = %x, handle = %x\n", receiverProcessId, timSetStatus, staRecord->timSet, handle); } + + /* Reset TIM pending flag to send next TIM request */ + staRecord->timRequestPendingFlag = FALSE; + + /* Make sure that one more UpdateTim request is queued, if Queued its value + * should be CSR_WIFI_TIM_SET or CSR_WIFI_TIM_RESET + */ + if (0xFF != staRecord->updateTimReqQueued) + { + /* Process the UpdateTim Request which is queued while previous UpdateTim was in progress */ + if (staRecord->timSet != staRecord->updateTimReqQueued) + { + unifi_trace(priv, UDBG2, "uf_handle_tim_cfm : Processing Queued UpdateTimReq \n"); + + update_tim(priv, staRecord->aid, staRecord->updateTimReqQueued, interfaceTag, handle); + + staRecord->updateTimReqQueued = 0xFF; + } + } } else { + + interfacePriv->bcTimSet = timSetValue; /* fh_cmd_q can also be full at some point of time!, * resetting count as queue is cleaned by firmware at this point */ retryCount = 0; unifi_trace(priv, UDBG3, "tim (%s) successfully for broadcast frame in firmware\n", (timSetValue)?"SET":"RESET"); + + /* Reset DTIM pending flag to send next DTIM request */ + interfacePriv->bcTimSetReqPendingFlag = FALSE; + + /* Make sure that one more UpdateDTim request is queued, if Queued its value + * should be CSR_WIFI_TIM_SET or CSR_WIFI_TIM_RESET + */ + if (0xFF != interfacePriv->bcTimSetReqQueued) + { + /* Process the UpdateTim Request which is queued while previous UpdateTim was in progress */ + if (interfacePriv->bcTimSet != interfacePriv->bcTimSetReqQueued) + { + unifi_trace(priv, UDBG2, "uf_handle_tim_cfm : Processing Queued UpdateDTimReq \n"); + + update_tim(priv, 0, interfacePriv->bcTimSetReqQueued, interfaceTag, 0xFFFFFFFF); + + interfacePriv->bcTimSetReqQueued = 0xFF; + } + } + } break; case CSR_RC_INVALID_PARAMETERS: @@ -684,6 +820,7 @@ void uf_handle_tim_cfm(unifi_priv_t *priv, CSR_MLME_SET_TIM_CONFIRM *cfm, CsrUin default: unifi_warning(priv, "tim update request failed resultcode = %x\n", cfm->ResultCode); } + unifi_trace(priv, UDBG2, "leaving %s\n", __FUNCTION__); } @@ -733,8 +870,14 @@ void update_tim(unifi_priv_t * priv, CsrUint16 aid, CsrUint8 setTim, CsrUint16 i unifi_trace(priv, UDBG5, "entering the update_tim routine\n"); + if (handle == 0xFFFFFFFF) { handle &= CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE; + if (setTim == interfacePriv->bcTimSet) + { + unifi_trace(priv, UDBG3, "update_tim, Drop:Hdl=%x, timval=%d, globalTim=%d\n", handle, setTim, interfacePriv->bcTimSet); + return; + } } else if ((handle != 0xFFFFFFFF) && (handle >= UNIFI_MAX_CONNECTIONS)) { unifi_warning(priv, "bad station Handle = %x\n", handle); return; @@ -785,6 +928,25 @@ void update_tim(unifi_priv_t * priv, CsrUint16 aid, CsrUint8 setTim, CsrUint16 i if (staRecord) { staRecord->timSet = oldTimSetStatus ; } + else + { + /* MLME_SET_TIM.req sending failed here for AID0, so revert back our bcTimSet status */ + interfacePriv->bcTimSet = !setTim; + } + } + else { + /* Update tim request pending flag and ensure no more TIM set requests are send + for the same station until TIM confirm is received */ + if (staRecord) { + staRecord->timRequestPendingFlag = TRUE; + } + else + { + /* Update tim request (for AID 0) pending flag and ensure no more DTIM set requests are send + * for the same station until TIM confirm is received + */ + interfacePriv->bcTimSetReqPendingFlag = TRUE; + } } unifi_trace(priv, UDBG5, "leaving the update_tim routine\n"); } @@ -804,12 +966,30 @@ void process_peer_active_transition(unifi_priv_t * priv, if(IS_DTIM_ACTIVE(interfacePriv->dtimActive,interfacePriv->multicastPduHostTag)) { /* giving more priority to multicast packets so delaying unicast packets*/ - unifi_trace(priv,UDBG2," multicast transmission is going on so resume unicast transmission after DTIM over\n"); + unifi_trace(priv,UDBG2, "Multicast transmission is going on so resume unicast transmission after DTIM over\n"); + + /* As station is active now, even though AP is not able to send frames to it + * because of DTIM, it needs to reset the TIM here + */ + if (!staRecord->timRequestPendingFlag){ + if((staRecord->timSet == CSR_WIFI_TIM_SET) || (staRecord->timSet == CSR_WIFI_TIM_SETTING)){ + update_tim(priv, staRecord->aid, 0, interfaceTag, staRecord->assignedHandle); + } + } + else + { + /* Cache the TimSet value so that it will processed immidiatly after + * completing the current setTim Request + */ + staRecord->updateTimReqQueued = 0; + unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", staRecord->updateTimReqQueued, + staRecord->aid); + } return; } while((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->mgtFrames))) { buffered_pkt->transmissionControl &= - ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_ESOP_MASK); + ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_EOSP_MASK); if((r=frame_and_send_queued_pdu(priv,buffered_pkt,staRecord,0,FALSE)) == -ENOSPC) { unifi_trace(priv, UDBG2, "p_p_a_t:(ENOSPC) Mgt Frame queueing \n"); /* Enqueue at the head of the queue */ @@ -828,11 +1008,22 @@ void process_peer_active_transition(unifi_priv_t * priv, kfree(buffered_pkt); } } - if (staRecord->txSuspend) { - if(staRecord->timSet == CSR_WIFI_TIM_SET) { - update_tim(priv,staRecord->aid,0,interfaceTag, staRecord->assignedHandle); + if (!staRecord->timRequestPendingFlag) { + if (staRecord->txSuspend) { + if(staRecord->timSet == CSR_WIFI_TIM_SET) { + update_tim(priv,staRecord->aid,0,interfaceTag, staRecord->assignedHandle); + } + return; } - return; + } + else + { + /* Cache the TimSet value so that it will processed immidiatly after + * completing the current setTim Request + */ + staRecord->updateTimReqQueued = 0; + unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", staRecord->updateTimReqQueued, + staRecord->aid); } for(i=3;i>=0;i--) { if(!spaceAvail[i]) @@ -840,7 +1031,7 @@ void process_peer_active_transition(unifi_priv_t * priv, unifi_trace(priv, UDBG6, "p_p_a_t:data pkt sending for AC %d \n",i); while((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->dataPdu[i]))) { buffered_pkt->transmissionControl &= - ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_ESOP_MASK); + ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_EOSP_MASK); if((r=frame_and_send_queued_pdu(priv,buffered_pkt,staRecord,0,FALSE)) == -ENOSPC) { /* Clear the trigger bit transmission control*/ /* Enqueue at the head of the queue */ @@ -859,9 +1050,20 @@ void process_peer_active_transition(unifi_priv_t * priv, } } } - if((staRecord->timSet == CSR_WIFI_TIM_SET) || (staRecord->timSet == CSR_WIFI_TIM_SETTING)){ - unifi_trace(priv, UDBG3, "p_p_a_t:resetting tim .....\n"); - update_tim(priv,staRecord->aid,0,interfaceTag, staRecord->assignedHandle); + if (!staRecord->timRequestPendingFlag){ + if((staRecord->timSet == CSR_WIFI_TIM_SET) || (staRecord->timSet == CSR_WIFI_TIM_SETTING)) { + unifi_trace(priv, UDBG3, "p_p_a_t:resetting tim .....\n"); + update_tim(priv,staRecord->aid,0,interfaceTag, staRecord->assignedHandle); + } + } + else + { + /* Cache the TimSet value so that it will processed immidiatly after + * completing the current setTim Request + */ + staRecord->updateTimReqQueued = 0; + unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", staRecord->updateTimReqQueued, + staRecord->aid); } unifi_trace(priv, UDBG5, "leaving process_peer_active_transition\n"); } @@ -873,14 +1075,6 @@ void uf_process_ma_pkt_cfm_for_ap(unifi_priv_t *priv,CsrUint16 interfaceTag, con netInterface_priv_t *interfacePriv; CsrUint8 i; CsrWifiRouterCtrlStaInfo_t *staRecord = NULL; - struct list_head *listHeadMaPktreq,*listHeadStaQueue; - struct list_head *placeHolderMaPktreq,*placeHolderStaQueue; - unsigned long lock_flags; - unsigned long lock_flags1; - maPktReqList_t *maPktreq = NULL; - tx_buffered_packets_t *tx_q_item = NULL; - bulk_data_param_t bulkdata; - CsrBool entryFound = FALSE; interfacePriv = priv->interfacePriv[interfaceTag]; @@ -892,260 +1086,113 @@ void uf_process_ma_pkt_cfm_for_ap(unifi_priv_t *priv,CsrUint16 interfaceTag, con if(list_empty(&interfacePriv->genericMulticastOrBroadCastMgtFrames) && list_empty(&interfacePriv->genericMulticastOrBroadCastFrames)) { unifi_trace(priv,UDBG1,"Resetting multicastTIM"); - update_tim(priv,0,0,interfaceTag, 0xFFFFFFFF); - } - return; - } - - /* Check if a copy of the same frame (identified by host tag) is queued in driver */ - spin_lock_irqsave(&priv->tx_q_lock,lock_flags); - list_for_each_safe(listHeadMaPktreq, placeHolderMaPktreq, &interfacePriv->directedMaPktReq) { - maPktreq = list_entry(listHeadMaPktreq, maPktReqList_t, q); - if(maPktreq->hostTag == pkt_cfm->HostTag){ - entryFound = TRUE; - break; - } - } - spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); - - if(entryFound){ - - /* Monitor the time difference between the MA-PACKET.req and MA-PACKET.cfm */ - unsigned long timeout; - timeout = (long)jiffies - (long)maPktreq->jiffeTime; - - /* convert into milliseconds */ - timeout = jiffies_to_msecs(timeout); - unifi_trace(priv, UDBG3, "Jiffies Time: Host Tag(%x) --> Req(%u) Cfm(%u) Diff (in ms): %u\n",maPktreq->hostTag,maPktreq->jiffeTime, jiffies, timeout); - - if( (timeout/1000) > 1) - { - unifi_trace(priv, UDBG1, "Confirm time > 2 Seconds: time = %u Status = %x\n", (timeout/1000), pkt_cfm->TransmissionStatus); - } - - if( CSR_TX_LIFETIME == pkt_cfm->TransmissionStatus || - CSR_TX_BLOCK_ACK_TIMEOUT== pkt_cfm->TransmissionStatus || - CSR_TX_FAIL_TRANSMISSION_VIF_INTERRUPTED== pkt_cfm->TransmissionStatus || - CSR_TX_REJECTED_PEER_STATION_SLEEPING== pkt_cfm->TransmissionStatus || - CSR_TX_REJECTED_DTIM_STARTED== pkt_cfm->TransmissionStatus ){ - - CsrWifiRouterCtrlStaInfo_t *staRecord = interfacePriv->staInfo[maPktreq->staHandler]; - unifi_TrafficQueue priority_q; - struct list_head *list; - CsrResult result; - CSR_MA_PACKET_REQUEST *req = &maPktreq->signal.u.MaPacketRequest; - CsrUint16 ii=0; - CsrBool locationFound = FALSE; - CsrUint8 *sigbuffer; - - sigbuffer = (CsrUint8*)&maPktreq->signal; - if(req->Priority == CSR_MANAGEMENT){ - list = &staRecord->mgtFrames; - unifi_trace(priv,UDBG5,"mgmt list priority %d\n",req->Priority); - } - else{ - priority_q= unifi_frame_priority_to_queue(req->Priority); - list = &staRecord->dataPdu[priority_q]; - unifi_trace(priv,UDBG5,"data list priority %d\n",req->Priority); - } - - spin_lock_irqsave(&priv->tx_q_lock,lock_flags); - list_for_each_safe(listHeadStaQueue, placeHolderStaQueue, list){ - tx_q_item = list_entry(listHeadStaQueue, tx_buffered_packets_t, q); - COMPARE_HOST_TAG_TO_ENQUEUE(tx_q_item->hostTag ,maPktreq->hostTag) - - - } - if(sigbuffer[SIZEOF_SIGNAL_HEADER + 1]){ - skb_pull(maPktreq->skb,sigbuffer[SIZEOF_SIGNAL_HEADER + 1]); - } - - /* enqueue the failed packet sta queue*/ - bulkdata.d[0].os_net_buf_ptr= (unsigned char*)maPktreq->skb; - bulkdata.d[0].os_data_ptr = maPktreq->skb->data; - bulkdata.d[0].data_length = bulkdata.d[0].net_buf_length = maPktreq->skb->len; - bulkdata.d[1].os_data_ptr = NULL; - bulkdata.d[1].os_net_buf_ptr = NULL; - bulkdata.d[1].data_length = bulkdata.d[0].net_buf_length = 0; - unifi_trace(priv,UDBG4,"Cfm Fail for HosTag = %x with status %d so requeue it\n",maPktreq->hostTag,pkt_cfm->TransmissionStatus ); - req->TransmissionControl = 0; - - if(!locationFound){ - - if(list_empty(list)){ - result = enque_direceted_ma_pkt_cfm_data_pdu(priv, &bulkdata, list,&maPktreq->signal,1); - } - else{ - unifi_trace(priv,UDBG4,"did not find location so add to end of list \n"); - result = enque_direceted_ma_pkt_cfm_data_pdu(priv, &bulkdata, list,&maPktreq->signal,0); - } - - - } - - else { - if(ii > 1){ - unifi_trace(priv,UDBG4,"find the location in the middle of list \n"); - result = enque_direceted_ma_pkt_cfm_data_pdu(priv, &bulkdata, listHeadStaQueue,&maPktreq->signal,0); - - } - else{ - unifi_trace(priv,UDBG4," add at begining of list \n"); - result = enque_direceted_ma_pkt_cfm_data_pdu(priv, &bulkdata, list,&maPktreq->signal,1); + if (!interfacePriv->bcTimSetReqPendingFlag) + { + update_tim(priv,0,CSR_WIFI_TIM_RESET,interfaceTag, 0xFFFFFFFF); } - } - - spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); - - /* Increment the counter */ - spin_lock_irqsave(&priv->staRecord_lock,lock_flags1); - staRecord->noOfPktQueued++; - spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags1); - - - - - /* after enqueuing update the TIM */ - if(CSR_RESULT_SUCCESS == result){ - if(CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE == staRecord->currentPeerState) { - if(staRecord->timSet == CSR_WIFI_TIM_RESET || staRecord->timSet == CSR_WIFI_TIM_RESETTING) { - if(!staRecord->wmmOrQosEnabled) { - unifi_trace(priv, UDBG3, "uf_process_ma_pkt_cfm_for_ap :tim set due to unicast pkt & peer in powersave\n"); - update_tim(priv,staRecord->aid,1,interfaceTag, staRecord->assignedHandle); - } - else { - /* Check for non delivery enable(i.e trigger enable), all delivery enable & legacy AC for TIM update in firmware */ - CsrUint8 allDeliveryEnabled = 0, dataAvailable = 0; - /* Check if all AC's are Delivery Enabled */ - is_all_ac_deliver_enabled_and_moredata(staRecord, &allDeliveryEnabled, &dataAvailable); - if (uf_is_more_data_for_non_delivery_ac(staRecord) || (allDeliveryEnabled && dataAvailable)) { - update_tim(priv,staRecord->aid,1,interfaceTag, staRecord->assignedHandle); - } - } - } - } - } - else{ - dev_kfree_skb(maPktreq->skb); - } - } - else - { - CsrWifiRouterCtrlStaInfo_t *staRecord = interfacePriv->staInfo[maPktreq->staHandler]; - if (CSR_TX_RETRY_LIMIT == pkt_cfm->TransmissionStatus || - CSR_TX_NO_BSS == pkt_cfm->TransmissionStatus) - { - if (staRecord->timSet == CSR_WIFI_TIM_RESET || staRecord->timSet == CSR_WIFI_TIM_RESETTING) + else { - unifi_trace(priv, UDBG2, "CFM failed with Retry Limit or No BSS --> update TIM\n"); - update_tim(priv, staRecord->aid, 1, interfaceTag, staRecord->assignedHandle); + /* Cache the DTimSet value so that it will processed immidiatly after + * completing the current setDTim Request + */ + interfacePriv->bcTimSetReqQueued = CSR_WIFI_TIM_RESET; + unifi_trace(priv, UDBG2, "uf_process_ma_pkt_cfm_for_ap : One more UpdateDTim Request(%d) Queued \n", + interfacePriv->bcTimSetReqQueued); } + } - else if (CSR_TX_SUCCESSFUL == pkt_cfm->TransmissionStatus) - { - staRecord->activity_flag = TRUE; - } - unifi_trace(priv, UDBG5, "CFM for HosTag = %x Status = %d, Free SKB reference\n", - maPktreq->hostTag, - pkt_cfm->TransmissionStatus ); + return; + } - dev_kfree_skb(maPktreq->skb); + /* Check if it is a Confirm for null data frame used + * for probing station activity + */ + for(i =0; i < UNIFI_MAX_CONNECTIONS; i++) { + staRecord = (CsrWifiRouterCtrlStaInfo_t *) (interfacePriv->staInfo[i]); + if (staRecord && (staRecord->nullDataHostTag == pkt_cfm->HostTag)) { + + unifi_trace(priv, UDBG1, "CFM for Inactive probe Null frame (tag = %x, status = %d)\n", + pkt_cfm->HostTag, + pkt_cfm->TransmissionStatus + ); + staRecord->nullDataHostTag = INVALID_HOST_TAG; + + if(pkt_cfm->TransmissionStatus == CSR_TX_RETRY_LIMIT){ + CsrTime now; + CsrTime inactive_time; + + unifi_trace(priv, UDBG1, "Nulldata to probe STA ALIVE Failed with retry limit\n"); + /* Recheck if there is some activity after null data is sent. + * + * If still there is no activity then send a disconnected indication + * to SME to delete the station record. + */ + if (staRecord->activity_flag){ + return; + } + now = CsrTimeGet(NULL); - } - list_del(listHeadMaPktreq); - kfree(maPktreq); + if (staRecord->lastActivity > now) + { + /* simple timer wrap (for 1 wrap) */ + inactive_time = CsrTimeAdd((CsrTime)CsrTimeSub(CSR_SCHED_TIME_MAX, staRecord->lastActivity), + now); + } + else + { + inactive_time = (CsrTime)CsrTimeSub(now, staRecord->lastActivity); + } - }else{ - /* Check if it is a Confirm for null data frame used - * for probing station activity - */ - for(i =0; i < UNIFI_MAX_CONNECTIONS; i++) { - staRecord = (CsrWifiRouterCtrlStaInfo_t *) (interfacePriv->staInfo[i]); - if (staRecord && (staRecord->nullDataHostTag == pkt_cfm->HostTag)) { - - unifi_trace(priv, UDBG1, "CFM for Inactive probe Null frame (tag = %x, status = %d)\n", - pkt_cfm->HostTag, - pkt_cfm->TransmissionStatus - ); - staRecord->nullDataHostTag = INVALID_HOST_TAG; - - if(pkt_cfm->TransmissionStatus == CSR_TX_RETRY_LIMIT){ - CsrTime now; - CsrTime inactive_time; - - unifi_trace(priv, UDBG1, "Nulldata to probe STA ALIVE Failed with retry limit\n"); - /* Recheck if there is some activity after null data is sent. - * - * If still there is no activity then send a disconnected indication - * to SME to delete the station record. - */ - if (staRecord->activity_flag){ - return; - } - now = CsrTimeGet(NULL); + if (inactive_time >= STA_INACTIVE_TIMEOUT_VAL) + { + struct list_head send_cfm_list; + CsrUint8 j; + + /* The SME/NME may be waiting for confirmation for requested frames to this station. + * Though this is --VERY UNLIKELY-- in case of station in active mode. But still as a + * a defensive check, it loops through buffered frames for this station and if confirmation + * is requested, send auto confirmation with failure status. Also flush the frames so + * that these are not processed again in PEER_DEL_REQ handler. + */ + INIT_LIST_HEAD(&send_cfm_list); - if (staRecord->lastActivity > now) - { - /* simple timer wrap (for 1 wrap) */ - inactive_time = CsrTimeAdd((CsrTime)CsrTimeSub(CSR_SCHED_TIME_MAX, staRecord->lastActivity), - now); - } - else - { - inactive_time = (CsrTime)CsrTimeSub(now, staRecord->lastActivity); - } + uf_prepare_send_cfm_list_for_queued_pkts(priv, + &send_cfm_list, + &(staRecord->mgtFrames)); - if (inactive_time >= STA_INACTIVE_TIMEOUT_VAL) - { - struct list_head send_cfm_list; - CsrUint8 j; - - /* The SME/NME may be waiting for confirmation for requested frames to this station. - * Though this is --VERY UNLIKELY-- in case of station in active mode. But still as a - * a defensive check, it loops through buffered frames for this station and if confirmation - * is requested, send auto confirmation with failure status. Also flush the frames so - * that these are not processed again in PEER_DEL_REQ handler. - */ - INIT_LIST_HEAD(&send_cfm_list); + uf_flush_list(priv, &(staRecord->mgtFrames)); + for(j = 0; j < MAX_ACCESS_CATOGORY; j++){ uf_prepare_send_cfm_list_for_queued_pkts(priv, &send_cfm_list, - &(staRecord->mgtFrames)); - - uf_flush_list(priv, &(staRecord->mgtFrames)); + &(staRecord->dataPdu[j])); - for(j = 0; j < MAX_ACCESS_CATOGORY; j++){ - uf_prepare_send_cfm_list_for_queued_pkts(priv, - &send_cfm_list, - &(staRecord->dataPdu[j])); - - uf_flush_list(priv,&(staRecord->dataPdu[j])); - } - - send_auto_ma_packet_confirm(priv, staRecord->interfacePriv, &send_cfm_list); + uf_flush_list(priv,&(staRecord->dataPdu[j])); + } + send_auto_ma_packet_confirm(priv, staRecord->interfacePriv, &send_cfm_list); - unifi_warning(priv, "uf_process_ma_pkt_cfm_for_ap: Router Disconnected IND Peer (%x-%x-%x-%x-%x-%x)\n", - staRecord->peerMacAddress.a[0], - staRecord->peerMacAddress.a[1], - staRecord->peerMacAddress.a[2], - staRecord->peerMacAddress.a[3], - staRecord->peerMacAddress.a[4], - staRecord->peerMacAddress.a[5]); - CsrWifiRouterCtrlConnectedIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, - 0, - staRecord->interfacePriv->InterfaceTag, - staRecord->peerMacAddress, - CSR_WIFI_ROUTER_CTRL_PEER_DISCONNECTED); - } + unifi_warning(priv, "uf_process_ma_pkt_cfm_for_ap: Router Disconnected IND Peer (%x-%x-%x-%x-%x-%x)\n", + staRecord->peerMacAddress.a[0], + staRecord->peerMacAddress.a[1], + staRecord->peerMacAddress.a[2], + staRecord->peerMacAddress.a[3], + staRecord->peerMacAddress.a[4], + staRecord->peerMacAddress.a[5]); + CsrWifiRouterCtrlConnectedIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, + 0, + staRecord->interfacePriv->InterfaceTag, + staRecord->peerMacAddress, + CSR_WIFI_ROUTER_CTRL_PEER_DISCONNECTED); } - else if (pkt_cfm->TransmissionStatus == CSR_TX_SUCCESSFUL) - { - staRecord->activity_flag = TRUE; - } + + } + else if (pkt_cfm->TransmissionStatus == CSR_TX_SUCCESSFUL) + { + staRecord->activity_flag = TRUE; } } } @@ -1336,16 +1383,16 @@ static int update_macheader(unifi_priv_t *priv, struct sk_buff *skb, CsrResult csrResult; unifi_trace(priv, UDBG5, "normal Data packet, NO QOS \n"); - *priority = CSR_CONTENTION; if (qosDestination) { CsrUint8 qc = 0; unifi_trace(priv, UDBG3, "destination is QOS station \n"); - /* prepare the qos control field */ - qc |= CSR_QOS_UP0; + /* Set Ma-Packet.req UP to UP0 */ + *priority = CSR_QOS_UP0; + /* prepare the qos control field */ + qc |= CSR_QOS_UP0; /* no Amsdu is in ap buffer so eosp is left 0 */ - if (da[0] & 0x1) { /* multicast/broadcast frames, no acknowledgement needed */ qc |= 1 << 5; @@ -1763,9 +1810,6 @@ CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, */ list = &interfacePriv->genericMulticastOrBroadCastMgtFrames; - spin_lock_irqsave(&priv->staRecord_lock,lock_flags); - interfacePriv->noOfbroadcastPktQueued++; - spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); if((interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_IBSS) && (list_empty(&interfacePriv->genericMulticastOrBroadCastMgtFrames))) { setBcTim=TRUE; @@ -1789,11 +1833,9 @@ CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, /* if multicast traffic is going on, buffet the unicast packets */ unifi_trace(priv, UDBG2, "Enqueued to staRecord->dataPdu[%d] queuePacketDozing=%d,\ Buffering enabled = %d \n", priority_q,queuePacketDozing,isRouterBufferEnabled(priv,priority_q)); - signal.u.MaPacketRequest.TransmissionControl &= ~(CSR_NO_CONFIRM_REQUIRED); list = &staRecord->dataPdu[priority_q]; } else { unifi_trace(priv, UDBG5, "staRecord->dataPdu[%d] list is empty uf_process_ma_packet_req \n", priority_q); - signal.u.MaPacketRequest.TransmissionControl &= ~(CSR_NO_CONFIRM_REQUIRED); /* Pdu allowed to send to unifi */ result = ul_send_signal_unpacked(priv, &signal, bulkdata); if(result == -ENOSPC) { @@ -1816,9 +1858,6 @@ CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, * will be sent when we receive VIF AVAILABILITY from firmware as part of DTIM */ list = &interfacePriv->genericMulticastOrBroadCastFrames; - spin_lock_irqsave(&priv->staRecord_lock,lock_flags); - interfacePriv->noOfbroadcastPktQueued++; - spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); if(list_empty(&interfacePriv->genericMulticastOrBroadCastFrames)) { setBcTim = TRUE; } @@ -1838,10 +1877,30 @@ CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, staRecord->noOfPktQueued++; spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); } + else if ((pktType == CSR_WIFI_MULTICAST_PDU) && (!status)) + { + /* If broadcast Tim is set && queuing is successfull, then only update TIM */ + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + interfacePriv->noOfbroadcastPktQueued++; + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + } } - if(setBcTim) { + /* If broadcast Tim is set && queuing is successfull, then only update TIM */ + if(setBcTim && !status) { unifi_trace(priv, UDBG3, "tim set due to broadcast pkt\n"); - update_tim(priv,0,1,interfaceTag, handle); + if (!interfacePriv->bcTimSetReqPendingFlag) + { + update_tim(priv,0,CSR_WIFI_TIM_SET,interfaceTag, handle); + } + else + { + /* Cache the TimSet value so that it will processed immidiatly after + * completing the current setTim Request + */ + interfacePriv->bcTimSetReqQueued = CSR_WIFI_TIM_SET; + unifi_trace(priv, UDBG2, "uf_process_ma_packet_req : One more UpdateDTim Request(:%d) Queued \n", + interfacePriv->bcTimSetReqQueued); + } } else if(staRecord && staRecord->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE) { if(staRecord->timSet == CSR_WIFI_TIM_RESET || staRecord->timSet == CSR_WIFI_TIM_RESETTING) { @@ -1850,15 +1909,38 @@ CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, !list_empty(&staRecord->dataPdu[3]) || !list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION])) { unifi_trace(priv, UDBG3, "tim set due to unicast pkt & peer in powersave\n"); - update_tim(priv,staRecord->aid,1,interfaceTag, handle); - } - } else { - /* Check for non delivery enable(i.e trigger enable), all delivery enable & legacy AC for TIM update in firmware */ - CsrUint8 allDeliveryEnabled = 0, dataAvailable = 0; + if (!staRecord->timRequestPendingFlag){ + update_tim(priv,staRecord->aid,1,interfaceTag, handle); + } + else + { + /* Cache the TimSet value so that it will processed immidiatly after + * completing the current setTim Request + */ + staRecord->updateTimReqQueued = 1; + unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", staRecord->updateTimReqQueued, + staRecord->aid); + } + } + } else { + /* Check for non delivery enable(i.e trigger enable), all delivery enable & legacy AC for TIM update in firmware */ + CsrUint8 allDeliveryEnabled = 0, dataAvailable = 0; /* Check if all AC's are Delivery Enabled */ is_all_ac_deliver_enabled_and_moredata(staRecord, &allDeliveryEnabled, &dataAvailable); - if (uf_is_more_data_for_non_delivery_ac(staRecord) || (allDeliveryEnabled && dataAvailable)) { - update_tim(priv,staRecord->aid,1,interfaceTag, handle); + if (uf_is_more_data_for_non_delivery_ac(staRecord) || (allDeliveryEnabled && dataAvailable) + || (!list_empty(&staRecord->mgtFrames))) { + if (!staRecord->timRequestPendingFlag) { + update_tim(priv,staRecord->aid,1,interfaceTag, handle); + } + else + { + /* Cache the TimSet value so that it will processed immidiatly after + * completing the current setTim Request + */ + staRecord->updateTimReqQueued = 1; + unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", staRecord->updateTimReqQueued, + staRecord->aid); + } } } } @@ -1945,7 +2027,7 @@ CsrUint8 send_multicast_frames(unifi_priv_t *priv, CsrUint16 interfaceTag) if(!isRouterBufferEnabled(priv,UNIFI_TRAFFIC_Q_VO)) { while((interfacePriv->dtimActive)&& (buffered_pkt=dequeue_tx_data_pdu(priv,&interfacePriv->genericMulticastOrBroadCastMgtFrames))) { buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK); - moreData = (buffered_pkt->transmissionControl & TRANSMISSION_CONTROL_ESOP_MASK)?FALSE:TRUE; + moreData = (buffered_pkt->transmissionControl & TRANSMISSION_CONTROL_EOSP_MASK)?FALSE:TRUE; unifi_trace(priv,UDBG2,"DTIM Occurred for interface:sending Mgt packet %d\n",interfaceTag); @@ -1986,7 +2068,7 @@ CsrUint8 send_multicast_frames(unifi_priv_t *priv, CsrUint16 interfaceTag) if(!isRouterBufferEnabled(priv,UNIFI_TRAFFIC_Q_CONTENTION)) { while((interfacePriv->dtimActive)&& (buffered_pkt=dequeue_tx_data_pdu(priv,&interfacePriv->genericMulticastOrBroadCastFrames))) { buffered_pkt->transmissionControl |= TRANSMISSION_CONTROL_TRIGGER_MASK; - moreData = (buffered_pkt->transmissionControl & TRANSMISSION_CONTROL_ESOP_MASK)?FALSE:TRUE; + moreData = (buffered_pkt->transmissionControl & TRANSMISSION_CONTROL_EOSP_MASK)?FALSE:TRUE; if((r=frame_and_send_queued_pdu(priv,buffered_pkt,NULL,moreData,FALSE)) == -ENOSPC) { @@ -2076,7 +2158,19 @@ void uf_process_ma_vif_availibility_ind(unifi_priv_t *priv,CsrUint8 *sigdata, if(interfacePriv->multicastPduHostTag == 0xffffffff) { unifi_notice(priv,"ma_vif_availibility_ind recevied for multicast but queues are empty%d\n",interfaceTag); /* This may be an extra request in very rare race conditions but it is fine as it would atleast remove the potential lock up */ - update_tim(priv,0,0,interfaceTag, 0xFFFFFFFF); + if (!interfacePriv->bcTimSetReqPendingFlag) + { + update_tim(priv,0,CSR_WIFI_TIM_RESET,interfaceTag, 0xFFFFFFFF); + } + else + { + /* Cache the TimSet value so that it will processed immidiatly after + * completing the current setTim Request + */ + interfacePriv->bcTimSetReqQueued = CSR_WIFI_TIM_RESET; + unifi_trace(priv, UDBG2, "uf_process_ma_vif_availibility_ind : One more UpdateDTim Request(%d) Queued \n", + interfacePriv->bcTimSetReqQueued); + } } return; } @@ -2105,59 +2199,62 @@ void uf_process_ma_vif_availibility_ind(unifi_priv_t *priv,CsrUint8 *sigdata, #define GET_ACTIVE_INTERFACE_TAG(priv) 0 - -void uf_continue_uapsd(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo) +static CsrBool uf_is_more_data_for_delivery_ac(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t *staRecord) { - CsrInt8 i; - func_enter(); - - if(((staInfo->powersaveMode[UNIFI_TRAFFIC_Q_VO]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)|| - (staInfo->powersaveMode[UNIFI_TRAFFIC_Q_VO]==CSR_WIFI_AC_DELIVERY_ONLY_ENABLE)) - &&(!list_empty(&staInfo->mgtFrames))){ - - unifi_trace(priv, UDBG5, "uf_continue_uapsd : U-APSD ACTIVE and sending buffered mgt frames\n"); - uf_send_buffered_data_from_delivery_ac(priv, staInfo, UNIFI_TRAFFIC_Q_VO, &staInfo->mgtFrames); - - /*This may happen because U-APSD was completed - with previous AC transfer*/ - - if(staInfo->uapsdActive == FALSE) { - return; + for(i=UNIFI_TRAFFIC_Q_VO; i >= UNIFI_TRAFFIC_Q_BK; i--) + { + if(((staRecord->powersaveMode[i]==CSR_WIFI_AC_DELIVERY_ONLY_ENABLE) + ||(staRecord->powersaveMode[i]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)) + &&(!list_empty(&staRecord->dataPdu[i]))) { + unifi_trace(priv,UDBG2,"uf_is_more_data_for_delivery_ac: Data Available AC = %d\n", i); + return TRUE; } } - for(i=3;i>=0;i--) { + unifi_trace(priv,UDBG2,"uf_is_more_data_for_delivery_ac: Data NOT Available \n"); + return FALSE; +} - if(((staInfo->powersaveMode[i]== CSR_WIFI_AC_DELIVERY_ONLY_ENABLE) - ||(staInfo->powersaveMode[i] == CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)) - &&(!list_empty(&staInfo->dataPdu[i]))) { - unifi_trace(priv, UDBG5, "uf_continue_uapsd : U-APSD ACTIVE and sending buffered data frames\n"); - uf_send_buffered_data_from_delivery_ac(priv, staInfo, i, &staInfo->dataPdu[i]); - } +static CsrBool uf_is_more_data_for_usp_delivery(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t *staRecord, unifi_TrafficQueue queue) +{ + CsrInt8 i; - /*This may happen because U-APSD was completed - with previous AC transfer*/ - if (staInfo->uapsdActive == FALSE) { - return; + for(i = queue; i >= UNIFI_TRAFFIC_Q_BK; i--) + { + if(((staRecord->powersaveMode[i]==CSR_WIFI_AC_DELIVERY_ONLY_ENABLE) + ||(staRecord->powersaveMode[i]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)) + &&(!list_empty(&staRecord->dataPdu[i]))) { + unifi_trace(priv,UDBG2,"uf_is_more_data_for_usp_delivery: Data Available AC = %d\n", i); + return TRUE; } } - if (staInfo->uapsdActive && !uf_is_more_data_for_delivery_ac(priv, staInfo, TRUE)) { - /* If last packet not able to transfer due to ENOSPC & buffer management algorithm - * would have removed last packet. Then we wont update staInfo->UapsdActive = FALSE (suppose - * to update as we dont have packet to transfer at this USP) because above if loop fails as list is empty & - * update of UAPSD activity done in uf_send_buffered_data_from_delivery_ac(). - * In this situation we send QOS null & mean time update UapsdActive to FALSE here - */ - staInfo->uapsdActive = FALSE; - uf_send_qos_null(priv, GET_ACTIVE_INTERFACE_TAG(priv), staInfo->peerMacAddress.a, CSR_QOS_UP0 , staInfo); - } - func_exit(); + unifi_trace(priv,UDBG2,"uf_is_more_data_for_usp_delivery: Data NOT Available \n"); + return FALSE; } - +/* + * --------------------------------------------------------------------------- + * uf_send_buffered_data_from_delivery_ac + * + * This function takes care of + * -> Parsing the delivery enabled queue & sending frame down to HIP + * -> Setting EOSP=1 when USP to be terminated + * -> Depending on MAX SP length services the USP + * + * NOTE:This function always called from uf_handle_uspframes_delivery(), Dont + * call this function from any other location in code + * + * Arguments: + * priv Pointer to device private context struct + * vif interface specific HIP vif instance + * staInfo peer for which UAPSD to be scheduled + * queue AC from which Data to be sent in USP + * txList access category for processing list + * --------------------------------------------------------------------------- + */ void uf_send_buffered_data_from_delivery_ac(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo, CsrUint8 queue, @@ -2170,117 +2267,94 @@ void uf_send_buffered_data_from_delivery_ac(unifi_priv_t *priv, CsrBool eosp=FALSE; CsrInt8 r =0; CsrBool moreData = FALSE; + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - CsrUint8 allDeliveryEnabled = 0, dataAvailable = 0; - netInterface_priv_t *interfacePriv; - interfacePriv = priv->interfacePriv[interfaceTag]; - func_enter(); - - /*Check U-APSD conditions if not met return from here*/ - if((staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE)&& - (staInfo->uapsdActive == TRUE)&& - (!IS_DELIVERY_AND_TRIGGER_ENABLED(staInfo->powersaveMode[queue]))){ - - unifi_trace(priv,UDBG4,"uf_send_buffered_data_from_queue : U-APSD active. %d :Queue NOT delivery enbaled.return %\n",queue); + unifi_trace(priv, UDBG2, "++uf_send_buffered_data_from_delivery_ac, active=%x\n", staInfo->uapsdActive); + if (queue > UNIFI_TRAFFIC_Q_VO) + { return; - } + } + while((buffered_pkt=dequeue_tx_data_pdu(priv, txList))) { + if((IS_DTIM_ACTIVE(interfacePriv->dtimActive,interfacePriv->multicastPduHostTag))) { + unifi_trace(priv, UDBG2, "uf_send_buffered_data_from_delivery_ac: DTIM Active, suspend UAPSD, staId: 0x%x\n", + staInfo->aid); - while(!isRouterBufferEnabled(priv,queue) && - ((buffered_pkt=dequeue_tx_data_pdu(priv, txList))!=NULL)){ - if((IS_DTIM_ACTIVE(interfacePriv->dtimActive,interfacePriv->multicastPduHostTag))){ + /* Once resume called, the U-APSD delivery operation will resume */ spin_lock_irqsave(&priv->staRecord_lock,lock_flags); - staInfo->uapsdSuspended = TRUE; - staInfo->uapsdActive = FALSE; + staInfo->uspSuspend = TRUE; spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); /* re-queueing the packet as DTIM started */ spin_lock_irqsave(&priv->tx_q_lock,lock_flags); list_add(&buffered_pkt->q,txList); spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); - unifi_trace(priv, UDBG3, "%s: DTIM Active while UAPSD in progress for staId: 0x%x\n",__FUNCTION__,staInfo->aid); break; } buffered_pkt->transmissionControl &= - ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_ESOP_MASK); - + ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); - if((staInfo->wmmOrQosEnabled == TRUE)&&(staInfo->uapsdActive == TRUE)){ - moreData = uf_is_more_data_for_delivery_ac(priv,staInfo,TRUE); + if((staInfo->wmmOrQosEnabled == TRUE)&&(staInfo->uapsdActive == TRUE)) { buffered_pkt->transmissionControl = TRANSMISSION_CONTROL_TRIGGER_MASK; - if(staInfo->noOfSpFramesSent == (staInfo->maxSpLength-1)){ - moreData = FALSE; - } - - if(moreData == FALSE){ - eosp = TRUE; - staInfo->uapsdActive = FALSE; - staInfo->noOfSpFramesSent = FALSE; - buffered_pkt->transmissionControl = - (TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_ESOP_MASK); + /* Check All delivery enables Ac for more data, because caller of this + * function not aware about last packet + * (First check in moreData fetching helps in draining out Mgt frames Q) + */ + moreData = (!list_empty(txList) || uf_is_more_data_for_usp_delivery(priv, staInfo, queue)); - /* Check if all AC's are Delivery Enabled */ - is_all_ac_deliver_enabled_and_moredata(staInfo, &allDeliveryEnabled, &dataAvailable); - if ((allDeliveryEnabled && !dataAvailable)) { - update_tim(priv,staInfo->aid,0,interfaceTag, staInfo->assignedHandle); - } - /* check the moer data for non delivery ac and update accordingly */ - else if(uf_is_more_data_for_non_delivery_ac(staInfo) ) { - update_tim(priv,staInfo->aid,1,interfaceTag, staInfo->assignedHandle); - } - else if(!uf_is_more_data_for_non_delivery_ac(staInfo) ){ - unifi_trace(priv, UDBG3, "more data = NULL, set tim to 0 in uf_send_buffered_data_from_delivery_ac\n"); - update_tim(priv,staInfo->aid,0,interfaceTag, staInfo->assignedHandle); - } + if(staInfo->noOfSpFramesSent == (staInfo->maxSpLength - 1)) { + moreData = FALSE; + } - } - } - else - { - /*Non QoS and non U-APSD.*/ - eosp = FALSE; - moreData = FALSE; - unifi_warning(priv,"uf_send_buffered_data_from_delivery_ac :non U-APSD !!! \n"); + if(moreData == FALSE) { + eosp = TRUE; + buffered_pkt->transmissionControl = + (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); + } + } else { + /* Non QoS and non U-APSD */ + unifi_warning(priv, "uf_send_buffered_data_from_delivery_ac: non U-APSD !!! \n"); } unifi_trace(priv,UDBG2,"uf_send_buffered_data_from_delivery_ac : MoreData:%d, EOSP:%d\n",moreData,eosp); if((r=frame_and_send_queued_pdu(priv,buffered_pkt,staInfo,moreData,eosp)) == -ENOSPC) { - /* Enqueue at the head of the queue */ - spin_lock_irqsave(&priv->tx_q_lock,lock_flags); - list_add(&buffered_pkt->q,txList); - spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); - priv->pausedStaHandle[queue]=(CsrUint8)(staInfo->assignedHandle); - unifi_notice (priv," U-APSD: PDU sending failed .. no space for queue %d \n",queue); - /*Break the loop for this queue.Try for next available Delivery enabled - Queue*/ - break; + + unifi_trace(priv, UDBG2, "uf_send_buffered_data_from_delivery_ac: UASPD suspended, ENOSPC in hipQ=%x\n", queue); + + /* Once resume called, the U-APSD delivery operation will resume */ + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + staInfo->uspSuspend = TRUE; + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + + spin_lock_irqsave(&priv->tx_q_lock,lock_flags); + list_add(&buffered_pkt->q,txList); + spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); + priv->pausedStaHandle[queue]=(CsrUint8)(staInfo->assignedHandle); + break; } else { if(r){ /* the PDU failed where we can't do any thing so free the storage */ unifi_net_data_free(priv, &buffered_pkt->bulkdata); } - kfree(buffered_pkt); - if(staInfo->uapsdActive == TRUE){ - spin_lock_irqsave(&priv->staRecord_lock,lock_flags); - staInfo->noOfSpFramesSent = staInfo->noOfSpFramesSent + 1; - if(staInfo->noOfSpFramesSent == staInfo->maxSpLength){ - staInfo->uapsdActive = FALSE; - staInfo->noOfSpFramesSent = FALSE; - spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); - break; - } + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + staInfo->noOfSpFramesSent++; + if((!moreData) || (staInfo->noOfSpFramesSent == staInfo->maxSpLength)) { + unifi_trace(priv, UDBG2, "uf_send_buffered_data_from_delivery_ac: Terminating USP\n"); + staInfo->uapsdActive = FALSE; + staInfo->uspSuspend = FALSE; + staInfo->noOfSpFramesSent = 0; spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + break; } + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); } } - - func_exit(); - + unifi_trace(priv, UDBG2, "--uf_send_buffered_data_from_delivery_ac, active=%x\n", staInfo->uapsdActive); } void uf_send_buffered_data_from_ac(unifi_priv_t *priv, @@ -2302,7 +2376,7 @@ void uf_send_buffered_data_from_ac(unifi_priv_t *priv, ((buffered_pkt=dequeue_tx_data_pdu(priv, txList))!=NULL)){ buffered_pkt->transmissionControl &= - ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_ESOP_MASK); + ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_EOSP_MASK); unifi_trace(priv,UDBG3,"uf_send_buffered_data_from_ac : MoreData:%d, EOSP:%d\n",moreData,eosp); @@ -2352,7 +2426,19 @@ void uf_send_buffered_frames(unifi_priv_t *priv,unifi_TrafficQueue q) moreData = (!list_empty(&interfacePriv->genericMulticastOrBroadCastMgtFrames) || !list_empty(&interfacePriv->genericMulticastOrBroadCastFrames)); if(!moreData) { - update_tim(priv,0,0,interfaceTag, 0XFFFFFFFF); + if (!interfacePriv->bcTimSetReqPendingFlag) + { + update_tim(priv,0,CSR_WIFI_TIM_RESET,interfaceTag, 0XFFFFFFFF); + } + else + { + /* Cache the TimSet value so that it will processed immidiatly after + * completing the current setTim Request + */ + interfacePriv->bcTimSetReqQueued = CSR_WIFI_TIM_RESET; + unifi_trace(priv, UDBG2, "uf_send_buffered_frames : One more UpdateDTim Request(%d) Queued \n", + interfacePriv->bcTimSetReqQueued); + } } } else { moreData = (!list_empty(&interfacePriv->genericMulticastOrBroadCastMgtFrames) || @@ -2391,33 +2477,17 @@ void uf_send_buffered_frames(unifi_priv_t *priv,unifi_TrafficQueue q) uf_send_buffered_data_from_ac(priv,staInfo, UNIFI_TRAFFIC_Q_VO, &staInfo->mgtFrames); } } - else if((staInfo != NULL)&&(staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE) - &&(staInfo->uapsdActive == TRUE)&&(IS_DELIVERY_AND_TRIGGER_ENABLED(staInfo->powersaveMode[UNIFI_TRAFFIC_Q_VO]))){ - - - if(!list_empty(&staInfo->mgtFrames)){ - /*UNIFI_TRAFFIC_Q_VO is delivery enabled push the managment frames out*/ - uf_send_buffered_data_from_delivery_ac(priv, staInfo, UNIFI_TRAFFIC_Q_VO, &staInfo->mgtFrames); - - } - } if(isRouterBufferEnabled(priv,queue)) { unifi_notice(priv,"uf_send_buffered_frames : No space Left for queue = %d\n",queue); break; } } - - /*push generic management frames out*/ - - if(!list_empty(&interfacePriv->genericMgtFrames)){ - - unifi_trace(priv,UDBG2,"uf_send_buffered_frames : trying generic mgt from queue=%d\n",queue); - uf_send_buffered_data_from_ac(priv,staInfo, UNIFI_TRAFFIC_Q_VO, &interfacePriv->genericMgtFrames); - + if(!list_empty(&interfacePriv->genericMgtFrames)) { + unifi_trace(priv,UDBG2,"uf_send_buffered_frames : trying generic mgt from queue=%d\n",queue); + uf_send_buffered_data_from_ac(priv,staInfo, UNIFI_TRAFFIC_Q_VO, &interfacePriv->genericMgtFrames); } - } @@ -2431,14 +2501,14 @@ void uf_send_buffered_frames(unifi_priv_t *priv,unifi_TrafficQueue q) staInfo = CsrWifiRouterCtrlGetStationRecordFromHandle(priv,startIndex,interfaceTag); if(!staInfo) { startIndex ++; - if(startIndex >= UNIFI_MAX_CONNECTIONS){ + if(startIndex >= UNIFI_MAX_CONNECTIONS) { startIndex = 0; } continue; } else if((staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE) - &&(staInfo->uapsdActive == FALSE)){ + &&(staInfo->uapsdActive == FALSE)) { startIndex ++; - if(startIndex >= UNIFI_MAX_CONNECTIONS){ + if(startIndex >= UNIFI_MAX_CONNECTIONS) { startIndex = 0; } continue; @@ -2448,23 +2518,15 @@ void uf_send_buffered_frames(unifi_priv_t *priv,unifi_TrafficQueue q) if((staInfo != NULL)&&(staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE) - &&(staInfo->uapsdActive == FALSE)){ - - if(!list_empty(&staInfo->dataPdu[queue])){ + &&(staInfo->uapsdActive == FALSE)) { + if(!list_empty(&staInfo->dataPdu[queue])) { - /*Non-UAPSD case push the AC frames out*/ - uf_send_buffered_data_from_ac(priv, staInfo, queue, (&staInfo->dataPdu[queue])); + /*Non-UAPSD case push the AC frames out*/ + uf_send_buffered_data_from_ac(priv, staInfo, queue, (&staInfo->dataPdu[queue])); } } - else if((staInfo != NULL)&&(staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE) - &&(staInfo->uapsdActive == TRUE)&&(IS_DELIVERY_AND_TRIGGER_ENABLED(staInfo->powersaveMode[queue]))){ - if(!list_empty(&staInfo->dataPdu[queue])){ - uf_send_buffered_data_from_delivery_ac(priv, staInfo, queue, &staInfo->dataPdu[queue]); - } - } - startIndex ++; - if(startIndex >= UNIFI_MAX_CONNECTIONS){ + if(startIndex >= UNIFI_MAX_CONNECTIONS) { startIndex = 0; } } @@ -2474,47 +2536,14 @@ void uf_send_buffered_frames(unifi_priv_t *priv,unifi_TrafficQueue q) priv->pausedStaHandle[queue] = 0; } - /*U-APSD might have stopped because of pause.So restart it if U-APSD - was active with any of the station*/ - for(startIndex= 0; startIndex < UNIFI_MAX_CONNECTIONS;startIndex++) { - staInfo = CsrWifiRouterCtrlGetStationRecordFromHandle(priv,startIndex,interfaceTag); - if(!staInfo ) { - continue; - } else if((staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE) - &&(staInfo->uapsdActive == TRUE)) { - - /*U-APSD Still active, it means trigger frame is received,so continue U-APSD by - sending data from remaining delivery enabled queues*/ - uf_continue_uapsd(priv,staInfo); - } - } + /* U-APSD might have stopped because of ENOSPC in lib_hip (pause activity). + * So restart it if U-APSD was active with any of the station + */ + unifi_trace(priv, UDBG4, "csrWifiHipSendBufferedFrames: UAPSD Resume Q=%x\n", queue); + resume_suspended_uapsd(priv, interfaceTag); func_exit(); } -CsrBool uf_is_more_data_for_delivery_ac(unifi_priv_t *priv,CsrWifiRouterCtrlStaInfo_t *staRecord,CsrBool mgtCheck) -{ - CsrUint8 i; - - for(i=0;i<=3;i++) - { - if(((staRecord->powersaveMode[i]==CSR_WIFI_AC_DELIVERY_ONLY_ENABLE) - ||(staRecord->powersaveMode[i]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)) - &&(!list_empty(&staRecord->dataPdu[i]))){ - unifi_trace(priv,UDBG2,"uf_is_more_data_for_delivery_ac: Data Available \n"); - return TRUE; - } - } - if((mgtCheck == TRUE)&&(IS_DELIVERY_AND_TRIGGER_ENABLED(staRecord->powersaveMode[UNIFI_TRAFFIC_Q_VO])) - &&(!list_empty(&staRecord->mgtFrames))){ - - unifi_trace(priv,UDBG2,"uf_is_more_data_for_delivery_ac: Management Data Available \n"); - - return TRUE; - } - - unifi_trace(priv,UDBG2,"uf_is_more_data_for_delivery_ac: Data NOT Available \n"); - return FALSE; -} CsrBool uf_is_more_data_for_non_delivery_ac(CsrWifiRouterCtrlStaInfo_t *staRecord) { @@ -2584,101 +2613,148 @@ int uf_process_station_records_for_sending_data(unifi_priv_t *priv,CsrUint16 int return 0; } -void uf_process_wmm_deliver_ac_uapsd(unifi_priv_t * priv, - CsrWifiRouterCtrlStaInfo_t * srcStaInfo, - CsrUint16 qosControl, - CsrUint16 interfaceTag) + +/* + * --------------------------------------------------------------------------- + * uf_handle_uspframes_delivery + * + * This function takes care of handling USP session for peer, when + * -> trigger frame from peer + * -> suspended USP to be processed (resumed) + * + * NOTE: uf_send_buffered_data_from_delivery_ac() always called from this function, Dont + * make a direct call to uf_send_buffered_data_from_delivery_ac() from any other part of + * code + * + * Arguments: + * priv Pointer to device private context struct + * staInfo peer for which UAPSD to be scheduled + * interfaceTag virtual interface tag + * --------------------------------------------------------------------------- + */ +static void uf_handle_uspframes_delivery(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t *staInfo, CsrUint16 interfaceTag) { - CSR_PRIORITY priority; CsrInt8 i; - unifi_TrafficQueue priority_q; + CsrUint8 allDeliveryEnabled = 0, dataAvailable = 0; + netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; unsigned long lock_flags; - func_enter(); - - /* start the U-APSD operation only if it not active*/ - if(srcStaInfo->uapsdActive == FALSE){ - /*if recceived Frames trigger Frame and Devlivery enabled AC has data - then transmit from High priorty delivery enabled AC*/ + unifi_trace(priv, UDBG2, " ++ uf_handle_uspframes_delivery, uapsd active=%x, suspended?=%x\n", + staInfo->uapsdActive, staInfo->uspSuspend); + /* Check for Buffered frames according to priority order & deliver it + * 1. AC_VO delivery enable & Mgt frames available + * 2. Process remaining Ac's from order AC_VO to AC_BK + */ - priority = (CSR_PRIORITY)(qosControl & IEEE802_11_QC_TID_MASK); - - priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY) priority); - - if((srcStaInfo->powersaveMode[priority_q]==CSR_WIFI_AC_TRIGGER_ONLY_ENABLED) - ||(srcStaInfo->powersaveMode[priority_q]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)){ + /* USP initiated by WMMPS enabled peer & SET the status flag to TRUE */ + if (!staInfo->uspSuspend && staInfo->uapsdActive) + { + unifi_notice(priv, "uf_handle_uspframes_delivery: U-APSD already active! STA=%x:%x:%x:%x:%x:%x\n", + staInfo->peerMacAddress.a[0], staInfo->peerMacAddress.a[1], + staInfo->peerMacAddress.a[2], staInfo->peerMacAddress.a[3], + staInfo->peerMacAddress.a[4], staInfo->peerMacAddress.a[5]); + return; + } - unifi_trace(priv, UDBG3, "uf_process_wmm_deliver_ac_uapsd starting U-APSD operations\n"); + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + staInfo->uapsdActive = TRUE; + staInfo->uspSuspend = FALSE; + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); - /*Received Frame is trigger frame*/ - unifi_trace(priv, UDBG5, "uf_process_wmm_deliver_ac_uapsd : Received Frame is trigger frame %d\n",priority_q); + if(((staInfo->powersaveMode[UNIFI_TRAFFIC_Q_VO]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)|| + (staInfo->powersaveMode[UNIFI_TRAFFIC_Q_VO]==CSR_WIFI_AC_DELIVERY_ONLY_ENABLE)) + && (!list_empty(&staInfo->mgtFrames))) { - if(((srcStaInfo->powersaveMode[UNIFI_TRAFFIC_Q_VO]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)|| - (srcStaInfo->powersaveMode[UNIFI_TRAFFIC_Q_VO]==CSR_WIFI_AC_DELIVERY_ONLY_ENABLE)) - &&(!list_empty(&srcStaInfo->mgtFrames))){ + /* Management queue has data && UNIFI_TRAFFIC_Q_VO is delivery enable */ + unifi_trace(priv, UDBG4, "uf_handle_uspframes_delivery: Sending buffered management frames\n"); + uf_send_buffered_data_from_delivery_ac(priv, staInfo, UNIFI_TRAFFIC_Q_VO, &staInfo->mgtFrames); + } - /*Trigger frame received and Data available in Delivery enabled AC - or in Management queue when UNIFI_TRAFFIC_Q_VO is delivery enabled*/ + if (!uf_is_more_data_for_delivery_ac(priv, staInfo)) { + /* All delivery enable AC's are empty, so QNULL to be sent to terminate the USP + * NOTE: If we have sent Mgt frame also, we must send QNULL followed to terminate USP + */ + if (!staInfo->uspSuspend) { spin_lock_irqsave(&priv->staRecord_lock,lock_flags); - srcStaInfo->uapsdActive = TRUE; + staInfo->uapsdActive = FALSE; spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); - unifi_trace(priv, UDBG5, "uf_process_wmm_deliver_ac_uapsd : U-APSD ACTIVE and sending buffered mgt frames\n"); - - /* uf_send_buffered_frames(priv, priority_q); */ - uf_send_buffered_data_from_delivery_ac(priv, srcStaInfo, UNIFI_TRAFFIC_Q_VO, &srcStaInfo->mgtFrames); - - - /*This may happen because U-APSD was completed - with previous AC transfer*/ - - if(srcStaInfo->uapsdActive == FALSE){ - return; - } - - } - - - for(i=3;i>=0;i--){ - - if(((srcStaInfo->powersaveMode[i]==CSR_WIFI_AC_DELIVERY_ONLY_ENABLE) - ||(srcStaInfo->powersaveMode[i]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)) - &&(!list_empty(&srcStaInfo->dataPdu[i]))){ - - - /*Trigger frame received and Data available in Delivery enabled AC - or in Management queue when UNIFI_TRAFFIC_Q_VO is delivery enabled*/ - spin_lock_irqsave(&priv->staRecord_lock,lock_flags); - srcStaInfo->uapsdActive = TRUE; - spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); - - unifi_trace(priv, UDBG5, "uf_process_wmm_deliver_ac_uapsd : U-APSD ACTIVE and sending buffered data frames\n"); - - uf_send_buffered_data_from_delivery_ac(priv, srcStaInfo, i, &srcStaInfo->dataPdu[i]); + unifi_trace(priv, UDBG2, "uf_handle_uspframes_delivery: sending QNull for trigger\n"); + uf_send_qos_null(priv, interfaceTag, staInfo->peerMacAddress.a, (CSR_PRIORITY) staInfo->triggerFramePriority, staInfo); + staInfo->triggerFramePriority = CSR_QOS_UP0; + } else { + unifi_trace(priv, UDBG2, "uf_handle_uspframes_delivery: MgtQ xfer suspended\n"); + } + } else { + for(i = UNIFI_TRAFFIC_Q_VO; i >= UNIFI_TRAFFIC_Q_BK; i--) { + if(((staInfo->powersaveMode[i]==CSR_WIFI_AC_DELIVERY_ONLY_ENABLE) + ||(staInfo->powersaveMode[i]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)) + && (!list_empty(&staInfo->dataPdu[i]))) { + /* Deliver Data according to AC priority (from VO to BK) as part of USP */ + unifi_trace(priv, UDBG4, "uf_handle_uspframes_delivery: Buffered data frames from Queue (%d) for USP\n", i); + uf_send_buffered_data_from_delivery_ac(priv, staInfo, i, &staInfo->dataPdu[i]); + } - /*This may happen because U-APSD was completed - with previous AC transfer*/ + if ((!staInfo->uapsdActive) || + (staInfo->uspSuspend && IS_DTIM_ACTIVE(interfacePriv->dtimActive,interfacePriv->multicastPduHostTag))) { + /* If DTIM active found on one AC, No need to parse the remaining AC's + * as USP suspended. Break out of loop + */ + unifi_trace(priv, UDBG2, "uf_handle_uspframes_delivery: suspend=%x, DTIM=%x, USP terminated=%s\n", + staInfo->uspSuspend, IS_DTIM_ACTIVE(interfacePriv->dtimActive,interfacePriv->multicastPduHostTag), + staInfo->uapsdActive?"NO":"YES"); + break; + } + } + } - if(srcStaInfo->uapsdActive == FALSE){ - return; - } + /* Depending on the USP status, update the TIM accordingly for delivery enabled AC only + * (since we are not manipulating any Non-delivery list(AC)) + */ + is_all_ac_deliver_enabled_and_moredata(staInfo, &allDeliveryEnabled, &dataAvailable); + if ((allDeliveryEnabled && !dataAvailable)) { + if ((staInfo->timSet != CSR_WIFI_TIM_RESET) || (staInfo->timSet != CSR_WIFI_TIM_RESETTING)) { + staInfo->updateTimReqQueued = (CsrUint8) CSR_WIFI_TIM_RESET; + unifi_trace(priv, UDBG4, " --uf_handle_uspframes_delivery, UAPSD timset\n"); + if (!staInfo->timRequestPendingFlag) { + update_tim(priv, staInfo->aid, 0, interfaceTag, staInfo->assignedHandle); } + } + } + unifi_trace(priv, UDBG2, " --uf_handle_uspframes_delivery, uapsd active=%x, suspend?=%x\n", + staInfo->uapsdActive, staInfo->uspSuspend); +} - } - if(srcStaInfo->uapsdActive == FALSE && !(uf_is_more_data_for_delivery_ac(priv,srcStaInfo,TRUE))){ - unifi_trace(priv, UDBG3, "uf_process_wmm_deliver_ac_uapsd : No buffer frames so sending QOS Null in response of trigger frame\n"); - uf_send_qos_null(priv,interfaceTag,srcStaInfo->peerMacAddress.a,priority,srcStaInfo); - } +void uf_process_wmm_deliver_ac_uapsd(unifi_priv_t * priv, + CsrWifiRouterCtrlStaInfo_t * srcStaInfo, + CsrUint16 qosControl, + CsrUint16 interfaceTag) +{ + CSR_PRIORITY priority; + unifi_TrafficQueue priority_q; + unsigned long lock_flags; - } + unifi_trace(priv, UDBG2, "++uf_process_wmm_deliver_ac_uapsd: uapsdactive?=%x\n", srcStaInfo->uapsdActive); + /* If recceived Frames trigger Frame and Devlivery enabled AC has data + * then transmit from High priorty delivery enabled AC + */ + priority = (CSR_PRIORITY)(qosControl & IEEE802_11_QC_TID_MASK); + priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY) priority); - } + if((srcStaInfo->powersaveMode[priority_q]==CSR_WIFI_AC_TRIGGER_ONLY_ENABLED) + ||(srcStaInfo->powersaveMode[priority_q]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)) { + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + srcStaInfo->triggerFramePriority = priority; + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + unifi_trace(priv, UDBG2, "uf_process_wmm_deliver_ac_uapsd: trigger frame, Begin U-APSD, triggerQ=%x\n", priority_q); + uf_handle_uspframes_delivery(priv, srcStaInfo, interfaceTag); + } + unifi_trace(priv, UDBG2, "--uf_process_wmm_deliver_ac_uapsd: uapsdactive?=%x\n", srcStaInfo->uapsdActive); +} - func_exit(); -} void uf_send_qos_null(unifi_priv_t * priv,CsrUint16 interfaceTag, const CsrUint8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo) { bulk_data_param_t bulkdata; @@ -2686,7 +2762,7 @@ void uf_send_qos_null(unifi_priv_t * priv,CsrUint16 interfaceTag, const CsrUint8 struct sk_buff *skb, *newSkb = NULL; CsrWifiMacAddress peerAddress; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - CSR_TRANSMISSION_CONTROL transmissionControl = (TRANSMISSION_CONTROL_ESOP_MASK | TRANSMISSION_CONTROL_TRIGGER_MASK); + CSR_TRANSMISSION_CONTROL transmissionControl = (TRANSMISSION_CONTROL_EOSP_MASK | TRANSMISSION_CONTROL_TRIGGER_MASK); int r; CSR_SIGNAL signal; CsrUint32 priority_q; @@ -2928,7 +3004,19 @@ CsrBool uf_process_pm_bit_for_peer(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo !list_empty(&srcStaInfo->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION])); if(moreData && (srcStaInfo->timSet == CSR_WIFI_TIM_RESET)) { unifi_trace(priv, UDBG3, "This condition should not occur\n"); - update_tim(priv,srcStaInfo->aid,1,interfaceTag, srcStaInfo->assignedHandle); + if (!srcStaInfo->timRequestPendingFlag){ + update_tim(priv,srcStaInfo->aid,1,interfaceTag, srcStaInfo->assignedHandle); + } + else + { + /* Cache the TimSet value so that it will processed immidiatly after + * completing the current setTim Request + */ + srcStaInfo->updateTimReqQueued = 1; + unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", srcStaInfo->updateTimReqQueued, + srcStaInfo->aid); + } + } } else { CsrUint8 allDeliveryEnabled = 0, dataAvailable = 0; @@ -2939,7 +3027,18 @@ CsrBool uf_process_pm_bit_for_peer(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo moreData = (uf_is_more_data_for_non_delivery_ac(srcStaInfo) || (allDeliveryEnabled && dataAvailable)); if(moreData && (srcStaInfo->timSet == CSR_WIFI_TIM_RESET)) { - update_tim(priv,srcStaInfo->aid,1,interfaceTag, srcStaInfo->assignedHandle); + if (!srcStaInfo->timRequestPendingFlag){ + update_tim(priv,srcStaInfo->aid,1,interfaceTag, srcStaInfo->assignedHandle); + } + else + { + /* Cache the TimSet value so that it will processed immidiatly after + * completing the current setTim Request + */ + srcStaInfo->updateTimReqQueued = 1; + unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", srcStaInfo->updateTimReqQueued, + srcStaInfo->aid); + } } } } @@ -2993,10 +3092,10 @@ void uf_process_ps_poll(unifi_priv_t *priv,CsrUint8* sa,CsrUint8* da,CsrUint8 pm !list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]) || !list_empty(&staRecord->mgtFrames)); - buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); + buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); if((r=frame_and_send_queued_pdu(priv,buffered_pkt,staRecord,moreData,FALSE)) == -ENOSPC) { /* Clear the trigger bit transmission control*/ - buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); + buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); /* Enqueue at the head of the queue */ spin_lock_irqsave(&priv->tx_q_lock,lock_flags); list_add(&buffered_pkt->q, &staRecord->mgtFrames); @@ -3016,10 +3115,10 @@ void uf_process_ps_poll(unifi_priv_t *priv,CsrUint8* sa,CsrUint8* da,CsrUint8 pm moreData = (!list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]) || !list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO])); - buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); + buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); if((r=frame_and_send_queued_pdu(priv,buffered_pkt,staRecord,moreData,FALSE)) == -ENOSPC) { /* Clear the trigger bit transmission control*/ - buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); + buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); /* Enqueue at the head of the queue */ spin_lock_irqsave(&priv->tx_q_lock,lock_flags); list_add(&buffered_pkt->q, &staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]); @@ -3038,10 +3137,10 @@ void uf_process_ps_poll(unifi_priv_t *priv,CsrUint8* sa,CsrUint8* da,CsrUint8 pm buffered_pkt->transmissionControl |= TRANSMISSION_CONTROL_TRIGGER_MASK; moreData = !list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]); - buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); + buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); if((r=frame_and_send_queued_pdu(priv,buffered_pkt,staRecord,moreData,FALSE)) == -ENOSPC) { /* Clear the trigger bit transmission control*/ - buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); + buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); /* Enqueue at the head of the queue */ spin_lock_irqsave(&priv->tx_q_lock,lock_flags); list_add(&buffered_pkt->q, &staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]); @@ -3065,7 +3164,18 @@ void uf_process_ps_poll(unifi_priv_t *priv,CsrUint8* sa,CsrUint8* da,CsrUint8 pm !list_empty(&staRecord->mgtFrames)); if(!moreData && (staRecord->timSet == CSR_WIFI_TIM_SET)) { unifi_trace(priv, UDBG3, "more data = NULL, set tim to 0 in uf_process_ps_poll\n"); - update_tim(priv,staRecord->aid,0,interfaceTag, staRecord->assignedHandle); + if (!staRecord->timRequestPendingFlag){ + update_tim(priv,staRecord->aid,0,interfaceTag, staRecord->assignedHandle); + } + else + { + /* Cache the TimSet value so that it will processed immidiatly after + * completing the current setTim Request + */ + staRecord->updateTimReqQueued = 0; + unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", staRecord->updateTimReqQueued, + staRecord->aid); + } } } else { @@ -3074,9 +3184,9 @@ void uf_process_ps_poll(unifi_priv_t *priv,CsrUint8* sa,CsrUint8* da,CsrUint8 pm /*Send Data From Management Frames*/ /* Priority orders for delivering the buffered packets are - * 1. UNIFI_TRAFFIC_Q_VO, if its non delivery enabled - * 2. management frames - * 3. Other access catagory frames which are non deliver enable + * 1. Deliver the Management frames if there + * 2. Other access catagory frames which are non deliver enable including UNIFI_TRAFFIC_Q_VO + * priority is from VO->BK */ /* Check if all AC's are Delivery Enabled */ @@ -3088,42 +3198,18 @@ void uf_process_ps_poll(unifi_priv_t *priv,CsrUint8* sa,CsrUint8* da,CsrUint8 pm return; } - if ((!IS_DELIVERY_ENABLED(staRecord->powersaveMode[UNIFI_TRAFFIC_Q_VO])) && - (!list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]) || !list_empty(&staRecord->mgtFrames))) { - /* UNIFI_TRAFFIC_Q_VO is non delivery enabled, & check for packets are there to send from this AC */ - if((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]))) { - moreData = uf_is_more_data_for_non_delivery_ac(staRecord); - buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); - - /* Last parameter is EOSP & its false always for PS-POLL processing */ - if((r=frame_and_send_queued_pdu(priv,buffered_pkt,staRecord,moreData,FALSE)) == -ENOSPC) { - /* Clear the trigger bit transmission control*/ - buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); - /* Enqueue at the head of the queue */ - spin_lock_irqsave(&priv->tx_q_lock,lock_flags); - list_add(&buffered_pkt->q, &staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]); - spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); - priv->pausedStaHandle[0]=(CsrUint8)(staRecord->assignedHandle); - unifi_trace(priv, UDBG1, "(ENOSPC) PS-POLL received : PDU sending failed \n"); - } else { - if(r){ - unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n"); - /* the PDU failed where we can't do any thing so free the storage */ - unifi_net_data_free(priv, &buffered_pkt->bulkdata); - } - kfree(buffered_pkt); - } - } else if ((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->mgtFrames))) { + if (!list_empty(&staRecord->mgtFrames)) { + if ((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->mgtFrames))) { /* We dont have packets in non delivery enabled UNIFI_TRAFFIC_Q_VO, So we are looking in management * queue of the station record */ moreData = uf_is_more_data_for_non_delivery_ac(staRecord); - buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); + buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); /* Last parameter is EOSP & its false always for PS-POLL processing */ if((r=frame_and_send_queued_pdu(priv,buffered_pkt,staRecord,moreData,FALSE)) == -ENOSPC) { /* Clear the trigger bit transmission control*/ - buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); + buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); /* Enqueue at the head of the queue */ spin_lock_irqsave(&priv->tx_q_lock,lock_flags); list_add(&buffered_pkt->q, &staRecord->mgtFrames); @@ -3138,24 +3224,27 @@ void uf_process_ps_poll(unifi_priv_t *priv,CsrUint8* sa,CsrUint8* da,CsrUint8 pm } kfree(buffered_pkt); } + } else { + unifi_error(priv, "uf_process_ps_poll: Mgt frame list empty!! \n"); } + } else { CsrInt8 i; - /* We dont have buffered packet in UNIFI_TRAFFIC_Q_VO & mangement frame queue (1 & 2 failed), So proceed with 3 condition - * UNIFI_TRAFFIC_Q_VO is taken care so start with i index = 2 + /* We dont have buffered packet in mangement frame queue (1 failed), So proceed with condition 2 + * UNIFI_TRAFFIC_Q_VO -> VI -> BE -> BK */ - for(i= 2; i>=0; i--) { + for(i= 3; i>=0; i--) { if (!IS_DELIVERY_ENABLED(staRecord->powersaveMode[i])) { /* Send One packet, if queue is NULL then continue */ if((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->dataPdu[i]))) { moreData = uf_is_more_data_for_non_delivery_ac(staRecord); - buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); + buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); /* Last parameter is EOSP & its false always for PS-POLL processing */ if((r=frame_and_send_queued_pdu(priv,buffered_pkt,staRecord,moreData,FALSE)) == -ENOSPC) { /* Clear the trigger bit transmission control*/ - buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_ESOP_MASK); + buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); /* Enqueue at the head of the queue */ spin_lock_irqsave(&priv->tx_q_lock,lock_flags); list_add(&buffered_pkt->q, &staRecord->dataPdu[i]); @@ -3181,7 +3270,19 @@ void uf_process_ps_poll(unifi_priv_t *priv,CsrUint8* sa,CsrUint8* da,CsrUint8 pm moreData = (uf_is_more_data_for_non_delivery_ac(staRecord) || (allDeliveryEnabled && dataAvailable)); if(!moreData && (staRecord->timSet == CSR_WIFI_TIM_SET)) { unifi_trace(priv, UDBG3, "more data = NULL, set tim to 0 in uf_process_ps_poll\n"); - update_tim(priv,staRecord->aid,0,interfaceTag, staRecord->assignedHandle); + if (!staRecord->timRequestPendingFlag){ + update_tim(priv,staRecord->aid,0,interfaceTag, staRecord->assignedHandle); + } + else + { + /* Cache the TimSet value so that it will processed immidiatly after + * completing the current setTim Request + */ + staRecord->updateTimReqQueued = 0; + unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", staRecord->updateTimReqQueued, + staRecord->aid); + } + } } @@ -3297,31 +3398,7 @@ void uf_flush_list(unifi_priv_t * priv, struct list_head * list) } spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); } -void uf_flush_maPktlist(unifi_priv_t * priv, struct list_head * list) -{ - struct list_head *listHeadMaPktreq,*placeHolderMaPktreq; - maPktReqList_t *maPktreq; - unsigned long lock_flags; - unifi_trace(priv, UDBG5, "entering the uf_flush_maPktlist \n"); - - spin_lock_irqsave(&priv->tx_q_lock,lock_flags); - /* go through list, delete & free memory */ - list_for_each_safe(listHeadMaPktreq, placeHolderMaPktreq, list) { - maPktreq = list_entry(listHeadMaPktreq, maPktReqList_t, q); - - if(!maPktreq) { - unifi_error(priv, "entry should exists, otherwise crashes (bug)\n"); - } - /* free the allocated memory */ - dev_kfree_skb(maPktreq->skb); - list_del(listHeadMaPktreq); - kfree(maPktreq); - maPktreq = NULL; - - } - spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); -} tx_buffered_packets_t *dequeue_tx_data_pdu(unifi_priv_t *priv, struct list_head *txList) { /* dequeue the tx data packets from the appropriate queue */ @@ -3521,7 +3598,7 @@ void resume_unicast_buffered_frames(unifi_priv_t *priv, CsrUint16 interfaceTag) while(!isRouterBufferEnabled(priv,3) && ((buffered_pkt=dequeue_tx_data_pdu(priv,&interfacePriv->genericMgtFrames))!=NULL)) { buffered_pkt->transmissionControl &= - ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_ESOP_MASK); + ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_EOSP_MASK); if((r=frame_and_send_queued_pdu(priv,buffered_pkt,NULL,0,FALSE)) == -ENOSPC) { /* Enqueue at the head of the queue */ spin_lock_irqsave(&priv->tx_q_lock,lock_flags); @@ -3547,7 +3624,7 @@ void resume_unicast_buffered_frames(unifi_priv_t *priv, CsrUint16 interfaceTag) if (staInfo && (staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE)) { while((( TRUE == hipslotFree[3] ) && (buffered_pkt=dequeue_tx_data_pdu(priv, &staInfo->mgtFrames)))) { buffered_pkt->transmissionControl &= - ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_ESOP_MASK); + ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_EOSP_MASK); if((r=frame_and_send_queued_pdu(priv,buffered_pkt,staInfo,0,FALSE)) == -ENOSPC) { unifi_trace(priv, UDBG3, "(ENOSPC) in resume_unicast_buffered_frames:: hip slots are full for voice queue\n"); /* Enqueue at the head of the queue */ @@ -3573,7 +3650,7 @@ void resume_unicast_buffered_frames(unifi_priv_t *priv, CsrUint16 interfaceTag) while((buffered_pkt=dequeue_tx_data_pdu(priv, &staInfo->dataPdu[j]))) { buffered_pkt->transmissionControl &= - ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_ESOP_MASK); + ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_EOSP_MASK); if((r=frame_and_send_queued_pdu(priv,buffered_pkt,staInfo,0,FALSE)) == -ENOSPC) { /* Enqueue at the head of the queue */ spin_lock_irqsave(&priv->tx_q_lock,lock_flags); @@ -3615,7 +3692,7 @@ void update_eosp_to_head_of_broadcast_list_head(unifi_priv_t *priv,CsrUint16 int spin_lock_irqsave(&priv->tx_q_lock,lock_flags); list_for_each_safe(listHead, placeHolder, &interfacePriv->genericMulticastOrBroadCastFrames) { tx_q_item = list_entry(listHead, tx_buffered_packets_t, q); - tx_q_item->transmissionControl |= TRANSMISSION_CONTROL_ESOP_MASK; + tx_q_item->transmissionControl |= TRANSMISSION_CONTROL_EOSP_MASK; tx_q_item->transmissionControl = (tx_q_item->transmissionControl & ~(CSR_NO_CONFIRM_REQUIRED)); unifi_trace(priv, UDBG1,"updating eosp for list Head hostTag:= 0x%x ",tx_q_item->hostTag); break; @@ -3624,105 +3701,51 @@ void update_eosp_to_head_of_broadcast_list_head(unifi_priv_t *priv,CsrUint16 int } func_exit(); } + +/* + * --------------------------------------------------------------------------- + * resume_suspended_uapsd + * + * This function takes care processing packets of Unscheduled Service Period, + * which been suspended earlier due to DTIM/HIP ENOSPC scenarios + * + * Arguments: + * priv Pointer to device private context struct + * interfaceTag For which resume should happen + * --------------------------------------------------------------------------- + */ void resume_suspended_uapsd(unifi_priv_t* priv,CsrUint16 interfaceTag) { CsrUint8 startIndex; CsrWifiRouterCtrlStaInfo_t * staInfo = NULL; - unsigned long lock_flags; - /*U-APSD might have stopped because of multicast. So restart it if U-APSD - was active with any of the station*/ + unsigned long lock_flags; + + unifi_trace(priv, UDBG2, "++resume_suspended_uapsd: \n"); for(startIndex= 0; startIndex < UNIFI_MAX_CONNECTIONS;startIndex++) { staInfo = CsrWifiRouterCtrlGetStationRecordFromHandle(priv,startIndex,interfaceTag); - if(!staInfo ) { + + if(!staInfo || !staInfo->wmmOrQosEnabled) { continue; } else if((staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE) - &&(staInfo->uapsdSuspended == TRUE)) { - - /*U-APSD Still active, it means trigger frame is received,so continue U-APSD by - sending data from remaining delivery enabled queues*/ - spin_lock_irqsave(&priv->staRecord_lock,lock_flags); - staInfo->uapsdActive = TRUE; - staInfo->uapsdSuspended = FALSE; - spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); - uf_continue_uapsd(priv,staInfo); - } - } - -} -void uf_store_directed_ma_packet_referenece(unifi_priv_t *priv, bulk_data_param_t *bulkdata, - CSR_SIGNAL *sigptr, CsrUint32 alignOffset) -{ - - maPktReqList_t *maPktreq = NULL; - CSR_MA_PACKET_REQUEST *req = &sigptr->u.MaPacketRequest; - CsrWifiRouterCtrlStaInfo_t *staRecord = NULL; - CsrUint16 frmCtrl,interfaceTag = 0; - const CsrUint8* macHdrLocation; - struct sk_buff *skb ; - unsigned long lock_flags; - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - CsrUint8 *sigbuffer; - CsrUint8 frameType = 0; - func_enter(); - - if(bulkdata == NULL || (0 == bulkdata->d[0].data_length )){ - unifi_trace (priv, UDBG3, "uf_store_directed_ma_packet_referenece:bulk data NULL \n"); - func_exit(); - return; - } - macHdrLocation = bulkdata->d[0].os_data_ptr; - skb = (struct sk_buff*)bulkdata->d[0].os_net_buf_ptr; - /* fectch the frame control value from mac header */ - frmCtrl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(macHdrLocation); - - /* Processing done according to Frame/Packet type */ - frameType = ((frmCtrl & 0x000c) >> FRAME_CONTROL_TYPE_FIELD_OFFSET); - - if( (((frmCtrl & 0xff) == IEEE802_11_FC_TYPE_QOS_NULL) || - ((frmCtrl & 0xff) == IEEE802_11_FC_TYPE_NULL ) ) || - ( IEEE802_11_FRAMETYPE_MANAGEMENT== frameType)){ - - /* if packet is NULL or Qos Null no need of retransmit so dont queue it*/ - unifi_trace (priv, UDBG3, "uf_store_directed_ma_packet_referenece: NULL data Pkt or mgmt\n"); - func_exit(); - return; - } - - /* fetch the station record for corresponding peer mac address */ - if ((staRecord = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, req->Ra.x, interfaceTag))) { - maPktreq = (maPktReqList_t*)kmalloc(sizeof(maPktReqList_t),GFP_ATOMIC); - if(maPktreq == NULL){ - unifi_error(priv, - "uf_store_directed_ma_packet_referenece :: Failed to allocate %d byter for maPktreq\n", - sizeof(maPktReqList_t)); - func_exit(); - return; + &&staInfo->uapsdActive && staInfo->uspSuspend) { + /* U-APSD Still active & previously suspended either ENOSPC of FH queues OR + * due to DTIM activity + */ + uf_handle_uspframes_delivery(priv, staInfo, interfaceTag); + } else { + unifi_trace(priv, UDBG2, "resume_suspended_uapsd: PS state=%x, uapsdActive?=%x, suspend?=%x\n", + staInfo->currentPeerState, staInfo->uapsdActive, staInfo->uspSuspend); + if (staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE) + { + spin_lock_irqsave(&priv->staRecord_lock,lock_flags); + staInfo->uapsdActive = FALSE; + staInfo->uspSuspend = FALSE; + spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); + } } } - - /* staRecord not present that means packet is multicast or generic mgmt so no need to queue it */ - else{ - unifi_trace (priv, UDBG3, "uf_store_directed_ma_packet_referenece: multicast pkt \n"); - func_exit(); - return ; - } - - /* disbale preemption */ - spin_lock_irqsave(&priv->tx_q_lock,lock_flags); - INIT_LIST_HEAD(&maPktreq->q); - maPktreq->staHandler = staRecord->assignedHandle; - memcpy(&maPktreq->signal,sigptr,sizeof(CSR_SIGNAL_PRIMITIVE_HEADER) + sizeof(CSR_MA_PACKET_REQUEST)); - sigbuffer = (CsrUint8*)&maPktreq->signal; - sigbuffer[SIZEOF_SIGNAL_HEADER + 1] = alignOffset; - maPktreq->skb = skb_get(skb); - maPktreq->hostTag = req->HostTag; - maPktreq->jiffeTime = jiffies; - list_add_tail(&maPktreq->q,&interfacePriv->directedMaPktReq); - - spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); - func_exit(); - + unifi_trace(priv, UDBG2, "--resume_suspended_uapsd:\n"); } #endif diff --git a/drivers/staging/csr/unifi_priv.h b/drivers/staging/csr/unifi_priv.h index f687f27..b23c844 100644 --- a/drivers/staging/csr/unifi_priv.h +++ b/drivers/staging/csr/unifi_priv.h @@ -44,6 +44,10 @@ #include +#ifdef ANDROID_BUILD +#include +#endif + #include "csr_wifi_hip_unifi.h" #include "csr_wifi_hip_unifi_udi.h" #include "csr_wifi_router_lib.h" @@ -63,6 +67,10 @@ typedef struct CsrWifiSmeApConfig CsrWifiSmeApConfig_t; #include "unifi_wext.h" #endif +#ifdef ANDROID_BUILD +extern struct wake_lock unifi_sdio_wake_lock; +#endif + #include "unifi_clients.h" @@ -98,18 +106,14 @@ typedef struct CsrWifiSmeApConfig CsrWifiSmeApConfig_t; #include "unifi_sme.h" #endif -#undef COMPARE_HOST_TAG_TO_ENQUEUE -#define COMPARE_HOST_TAG_TO_ENQUEUE(tx_q_item_hosttag,maPktHostTag) \ - if(tx_q_item_hosttag > maPktHostTag){ \ - locationFound = TRUE; \ - ii++; \ - break; \ - } \ - ii++; \ - - /* The device major number to use when registering the udi driver */ #define UNIFI_NAME "unifi" +/* + * MAX_UNIFI_DEVS defines the maximum number of UniFi devices that can be present. + * This number should be set to the number of SDIO slots supported by the SDIO + * host controller on the platform. + * Note: If MAX_UNIFI_DEVS value changes, fw_init[] needs to be corrected in drv.c + */ #define MAX_UNIFI_DEVS 2 /* 802.11 Mac header offsets */ @@ -156,6 +160,10 @@ typedef struct CsrWifiSmeApConfig CsrWifiSmeApConfig_t; #define IEEE802_11_QC_TID_MASK 0x0f #define IEEE802_11_QC_A_MSDU_PRESENT 0x80 +#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND)) +#define IEEE802_11_QC_NON_TID_BITS_MASK 0xFFF0 +#endif + #define CSR_WIFI_EAPOL_M4_HOST_TAG 0x50000000 #define IEEE802_11_DATA_FRAME_MAC_HEADER_SIZE 36 #define MAX_ACCESS_CATOGORY 4 @@ -185,6 +193,9 @@ typedef struct CsrWifiSmeApConfig CsrWifiSmeApConfig_t; #define STA_INACTIVE_DETECTION_TIMER_INTERVAL 30 /* in seconds */ #define STA_INACTIVE_TIMEOUT_VAL 120*1000*1000 /* 120 seconds */ +/* Test for modes requiring AP firmware patch */ +#define CSR_WIFI_HIP_IS_AP_FW(mode) ((((mode) == CSR_WIFI_ROUTER_CTRL_MODE_AP) || \ + ((mode) == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO)) ? TRUE : FALSE) /* Defines used in beacon filtering in case of P2P */ #define CSR_WIFI_P2P_WILDCARD_SSID_LENGTH 0x7 @@ -220,6 +231,9 @@ extern int sdio_block_size; extern int coredump_max; extern int run_bh_once; extern int bh_priority; +#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE +extern int log_hip_signals; +#endif struct dlpriv { const unsigned char *dl_data; @@ -331,7 +345,8 @@ typedef struct CsrWifiRouterCtrlStaInfo_t { CsrTime lastActivity; /* during m/c transmission sp suspended */ - CsrBool uapsdSuspended; + CsrBool uspSuspend; + CSR_PRIORITY triggerFramePriority; #endif CsrWifiRouterCtrlPeerStatus currentPeerState; struct list_head dataPdu[MAX_ACCESS_CATOGORY]; @@ -349,6 +364,8 @@ typedef struct CsrWifiRouterCtrlStaInfo_t { #define CSR_WIFI_TIM_RESETTING 2 #define CSR_WIFI_TIM_SETTING 3 + CsrBool timRequestPendingFlag; + CsrUint8 updateTimReqQueued; CsrUint16 noOfPktQueued; }CsrWifiRouterCtrlStaInfo_t; @@ -609,8 +626,14 @@ struct unifi_priv { /* Spinlock to protect M4 data */ spinlock_t m4_lock; - /* Spinlock to protect BA RX data */ - spinlock_t ba_lock; + /* Mutex to protect BA RX data */ + struct semaphore ba_mutex; + +#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION)) + /* Spinlock to protect the WAPI data */ + spinlock_t wapi_lock; +#endif + #ifndef ALLOW_Q_PAUSE /* Array to indicate if a particular Tx queue is paused, this may not be * required in a multiqueue implementation since we can directly stop kernel @@ -630,10 +653,24 @@ struct unifi_priv { CsrUint32 rxUdpThroughput; CsrUint32 txUdpThroughput; - +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + /*Set if multicast KeyID = 1*/ CsrUint8 wapi_multicast_filter; + /*Set if unicast KeyID = 1*/ CsrUint8 wapi_unicast_filter; CsrUint8 wapi_unicast_queued_pkt_filter; +#ifdef CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND + CsrBool isWapiConnection; +#endif +#endif + +#ifdef CSR_WIFI_SPLIT_PATCH + CsrWifiRouterCtrlModeSetReq pending_mode_set; +#endif + + CsrBool cmanrTestMode; + CSR_RATE cmanrTestModeTransmitRate; + }; typedef struct { @@ -682,6 +719,9 @@ typedef struct netInterface_priv CsrUint8 ba_complete_index; CsrUint8 queueEnabled[UNIFI_NO_OF_TX_QS]; struct work_struct send_m4_ready_task; +#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE + struct work_struct send_pkt_to_encrypt; +#endif struct net_device_stats stats; CsrUint8 interfaceMode; CsrBool protect; @@ -721,7 +761,6 @@ typedef struct netInterface_priv struct list_head genericMgtFrames; struct list_head genericMulticastOrBroadCastFrames; struct list_head genericMulticastOrBroadCastMgtFrames; - struct list_head directedMaPktReq; /* Timer for detecting station inactivity */ struct timer_list sta_activity_check_timer; @@ -740,6 +779,13 @@ typedef struct netInterface_priv /* Buffered M4 signal to take care of WPA race condition */ CSR_SIGNAL m4_signal; bulk_data_desc_t m4_bulk_data; + +#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION)) + /* Buffered WAPI Unicast MA Packet Request for encryption in Sme */ + CSR_SIGNAL wapi_unicast_ma_pkt_sig; + bulk_data_desc_t wapi_unicast_bulk_data; +#endif + /* This should be removed and m4_hostTag should be used for checking*/ CsrBool m4_sent; CSR_CLIENT_TAG m4_hostTag; @@ -747,17 +793,11 @@ typedef struct netInterface_priv CsrBool intraBssEnabled; CsrUint32 multicastPduHostTag; /* Used to set the tim after getting a confirm for it */ + CsrBool bcTimSet; + CsrBool bcTimSetReqPendingFlag; + CsrBool bcTimSetReqQueued; } netInterface_priv_t; -typedef struct maPktReqList{ - struct list_head q; - struct sk_buff *skb; - CSR_SIGNAL signal; - CSR_CLIENT_TAG hostTag; - CsrUint32 staHandler; - unsigned long jiffeTime; -}maPktReqList_t; - #ifndef ALLOW_Q_PAUSE #define net_is_tx_q_paused(priv, q) (priv->tx_q_paused_flag[q]) #define net_tx_q_unpause(priv, q) (priv->tx_q_paused_flag[q] = 0) @@ -925,7 +965,6 @@ int uf_ap_process_data_pdu(unifi_priv_t *priv, struct sk_buff *skb, bulk_data_param_t *bulkdata, CsrUint8 macHeaderLengthInBytes); CsrBool uf_is_more_data_for_non_delivery_ac(CsrWifiRouterCtrlStaInfo_t *staRecord); -CsrBool uf_is_more_data_for_delivery_ac(unifi_priv_t *priv,CsrWifiRouterCtrlStaInfo_t *staRecord,CsrBool mgtCheck); void uf_process_wmm_deliver_ac_uapsd ( unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t * srcStaInfo, CsrUint16 qosControl, @@ -937,7 +976,6 @@ void uf_send_buffered_data_from_delivery_ac(unifi_priv_t *priv, CsrWifiRouterCtr void uf_continue_uapsd(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo); void uf_send_qos_null(unifi_priv_t * priv,CsrUint16 interfaceTag, const CsrUint8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo); void uf_send_nulldata(unifi_priv_t * priv,CsrUint16 interfaceTag, const CsrUint8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo); -void uf_store_directed_ma_packet_referenece(unifi_priv_t *priv, bulk_data_param_t *bulkdata,CSR_SIGNAL *sigptr,CsrUint32 alignOffset); @@ -956,7 +994,6 @@ void send_auto_ma_packet_confirm(unifi_priv_t *priv, netInterface_priv_t *interfacePriv, struct list_head *buffered_frames_list); void uf_flush_list(unifi_priv_t * priv, struct list_head * list); -void uf_flush_maPktlist(unifi_priv_t * priv, struct list_head * list); tx_buffered_packets_t *dequeue_tx_data_pdu(unifi_priv_t *priv, struct list_head *txList); void resume_unicast_buffered_frames(unifi_priv_t *priv, CsrUint16 interfaceTag); void update_eosp_to_head_of_broadcast_list_head(unifi_priv_t *priv,CsrUint16 interfaceTag); @@ -1073,6 +1110,11 @@ void uf_process_rx_pending_queue(unifi_priv_t *priv, int queue, CsrWifiMacAddress source_address, int indicate, CsrUint16 interfaceTag); +#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE +int uf_register_hip_offline_debug(unifi_priv_t *priv); +int uf_unregister_hip_offline_debug(unifi_priv_t *priv); +#endif + /* * inet.c */ diff --git a/drivers/staging/csr/unifi_sme.c b/drivers/staging/csr/unifi_sme.c index 4ee663f..54414ed2e 100644 --- a/drivers/staging/csr/unifi_sme.c +++ b/drivers/staging/csr/unifi_sme.c @@ -447,6 +447,7 @@ int unifi_cfg_power(unifi_priv_t *priv, unsigned char *arg) { unifi_cfg_power_t cfg_power; int rc; + int wol; if (get_user(cfg_power, (unifi_cfg_power_t*)(((unifi_cfg_command_t*)arg) + 1))) { unifi_error(priv, "UNIFI_CFG: Failed to get the argument\n"); @@ -455,16 +456,24 @@ int unifi_cfg_power(unifi_priv_t *priv, unsigned char *arg) switch (cfg_power) { case UNIFI_CFG_POWER_OFF: + priv->wol_suspend = (enable_wol == UNIFI_WOL_OFF) ? FALSE : TRUE; rc = sme_sys_suspend(priv); if (rc) { return rc; } break; case UNIFI_CFG_POWER_ON: + wol = priv->wol_suspend; rc = sme_sys_resume(priv); if (rc) { return rc; } + if (wol) { + /* Kick the BH to ensure pending transfers are handled when + * a suspend happened with card powered. + */ + unifi_send_signal(priv->card, NULL, 0, NULL); + } break; default: unifi_error(priv, "WIFI POWER: Unknown value.\n"); @@ -921,10 +930,19 @@ int supportedRates[i++]=0x8b; supportedRates[i++]=0x96; } else if(n) { + /* For some strange reasons WiFi stack needs both b and g rates*/ supportedRates[i++]=0x02; supportedRates[i++]=0x04; supportedRates[i++]=0x0b; supportedRates[i++]=0x16; + supportedRates[i++]=0x0c; + supportedRates[i++]=0x12; + supportedRates[i++]=0x18; + supportedRates[i++]=0x24; + supportedRates[i++]=0x30; + supportedRates[i++]=0x48; + supportedRates[i++]=0x60; + supportedRates[i++]=0x6c; } if(g) { if(!b) { @@ -1162,3 +1180,65 @@ uf_send_m4_ready_wq(struct work_struct *work) } /* uf_send_m4_ready_wq() */ +#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION)) +/* + * --------------------------------------------------------------------------- + * uf_send_pkt_to_encrypt + * + * Deferred work queue function to send the WAPI data pkts to SME when unicast KeyId = 1 + * These are done in a deferred work queue for two reasons: + * - the CsrWifiRouterCtrl...Send() functions are not safe for atomic context + * - we want to load the main driver data path as lightly as possible + * + * Arguments: + * work Pointer to work queue item. + * + * Returns: + * None. + * --------------------------------------------------------------------------- + */ +void uf_send_pkt_to_encrypt(struct work_struct *work) +{ + netInterface_priv_t *interfacePriv = container_of(work, netInterface_priv_t, send_pkt_to_encrypt); + CsrUint16 interfaceTag = interfacePriv->InterfaceTag; + unifi_priv_t *priv = interfacePriv->privPtr; + + CsrUint32 pktBulkDataLength; + CsrUint8 *pktBulkData; + unsigned long flags; + + if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_STA) { + + func_enter(); + + pktBulkDataLength = interfacePriv->wapi_unicast_bulk_data.data_length; + + if (pktBulkDataLength > 0) { + pktBulkData = (CsrUint8 *)CsrPmemAlloc(pktBulkDataLength); + CsrMemSet(pktBulkData, 0, pktBulkDataLength); + } else { + unifi_error(priv, "uf_send_pkt_to_encrypt() : invalid buffer\n"); + return; + } + + spin_lock_irqsave(&priv->wapi_lock, flags); + /* Copy over the MA PKT REQ bulk data */ + CsrMemCpy(pktBulkData, (CsrUint8*)interfacePriv->wapi_unicast_bulk_data.os_data_ptr, pktBulkDataLength); + /* Free any bulk data buffers allocated for the WAPI Data pkt */ + unifi_net_data_free(priv, &interfacePriv->wapi_unicast_bulk_data); + interfacePriv->wapi_unicast_bulk_data.net_buf_length = 0; + interfacePriv->wapi_unicast_bulk_data.data_length = 0; + interfacePriv->wapi_unicast_bulk_data.os_data_ptr = interfacePriv->wapi_unicast_bulk_data.os_net_buf_ptr = NULL; + spin_unlock_irqrestore(&priv->wapi_lock, flags); + + CsrWifiRouterCtrlWapiUnicastTxEncryptIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, pktBulkDataLength, pktBulkData); + unifi_trace(priv, UDBG1, "WapiUnicastTxEncryptInd sent to SME\n"); + + CsrPmemFree(pktBulkData); /* Would have been copied over by the SME Handler */ + + func_exit(); + } else { + unifi_warning(priv, "uf_send_pkt_to_encrypt() is NOT applicable for interface mode - %d\n",interfacePriv->interfaceMode); + } +}/* uf_send_pkt_to_encrypt() */ +#endif diff --git a/drivers/staging/csr/unifi_sme.h b/drivers/staging/csr/unifi_sme.h index 51ca92e..3cbee81 100644 --- a/drivers/staging/csr/unifi_sme.h +++ b/drivers/staging/csr/unifi_sme.h @@ -50,6 +50,7 @@ enum sme_request_status { SME_REQUEST_PENDING, SME_REQUEST_RECEIVED, SME_REQUEST_TIMEDOUT, + SME_REQUEST_CANCELLED, }; /* Structure to hold a UDI logged signal */ @@ -123,6 +124,7 @@ void uf_ta_wq(struct work_struct *work); #endif void uf_sme_complete_request(unifi_priv_t *priv, CsrResult reply_status, const char *func); +void uf_sme_cancel_request(unifi_priv_t *priv, CsrResult reply_status); /* @@ -148,6 +150,13 @@ void uf_sme_config_wq(struct work_struct *work); */ void uf_send_m4_ready_wq(struct work_struct *work); +#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION)) +/* + * To send data pkt to Sme for encryption + */ +void uf_send_pkt_to_encrypt(struct work_struct *work); +#endif + int sme_mgt_power_config_set(unifi_priv_t *priv, CsrWifiSmePowerConfig *powerConfig); int sme_mgt_power_config_get(unifi_priv_t *priv, CsrWifiSmePowerConfig *powerConfig); int sme_mgt_host_config_set(unifi_priv_t *priv, CsrWifiSmeHostConfig *hostConfig); diff --git a/drivers/staging/csr/unifiio.h b/drivers/staging/csr/unifiio.h index e707eed..4ab050b 100644 --- a/drivers/staging/csr/unifiio.h +++ b/drivers/staging/csr/unifiio.h @@ -212,20 +212,19 @@ typedef struct { -typedef enum unifi_putest_command { - UNIFI_PUTEST_START, - UNIFI_PUTEST_STOP, - UNIFI_PUTEST_SET_SDIO_CLOCK, - UNIFI_PUTEST_CMD52_READ, - UNIFI_PUTEST_CMD52_WRITE, - UNIFI_PUTEST_DL_FW, - UNIFI_PUTEST_DL_FW_BUFF, - UNIFI_PUTEST_CMD52_BLOCK_READ, - UNIFI_PUTEST_COREDUMP_PREPARE, - UNIFI_PUTEST_GP_READ16, - UNIFI_PUTEST_GP_WRITE16 - -} unifi_putest_command_t; +typedef CsrUint8 unifi_putest_command_t; + +#define UNIFI_PUTEST_START 0 +#define UNIFI_PUTEST_STOP 1 +#define UNIFI_PUTEST_SET_SDIO_CLOCK 2 +#define UNIFI_PUTEST_CMD52_READ 3 +#define UNIFI_PUTEST_CMD52_WRITE 4 +#define UNIFI_PUTEST_DL_FW 5 +#define UNIFI_PUTEST_DL_FW_BUFF 6 +#define UNIFI_PUTEST_CMD52_BLOCK_READ 7 +#define UNIFI_PUTEST_COREDUMP_PREPARE 8 +#define UNIFI_PUTEST_GP_READ16 9 +#define UNIFI_PUTEST_GP_WRITE16 10 struct unifi_putest_cmd52 { -- cgit v0.10.2 From 005c3b13e543af4c9d0b5d18473f48184eae6f07 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 20 Jun 2012 12:53:58 -0700 Subject: Staging: csr: provide a MODULE_LICENSE for csr_helper.ko MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I forgot a license for the csr_helper module, so it would not properly load as it depends on other GPL-only symbols. Reported-by: Lauri Hintsala Cc: Mikko Virkkilä Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index 939c87c..ee2d047 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -437,3 +437,7 @@ CsrBool CsrIsSpace(CsrUint8 c) return FALSE; } } + +MODULE_DESCRIPTION("CSR Operating System Kernel Abstraction"); +MODULE_AUTHOR("Cambridge Silicon Radio Ltd."); +MODULE_LICENSE("GPL and additional rights"); -- cgit v0.10.2 From 8cb8aad7d34cdc82fe205905c8dff771efb9604d Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 19 Jun 2012 10:17:43 +0100 Subject: staging: comedi: make class and file operations static A couple of global variables in "comedi_fops.c" are only referenced from that .c file and can be declared 'static'. Also remove them from "comedi_fops.h" where they are declared 'extern'. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index ad86347..3650753 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2182,7 +2182,7 @@ static int comedi_fasync(int fd, struct file *file, int on) return fasync_helper(fd, file, on, &dev->async_queue); } -const struct file_operations comedi_fops = { +static const struct file_operations comedi_fops = { .owner = THIS_MODULE, .unlocked_ioctl = comedi_unlocked_ioctl, .compat_ioctl = comedi_compat_ioctl, @@ -2196,7 +2196,7 @@ const struct file_operations comedi_fops = { .llseek = noop_llseek, }; -struct class *comedi_class; +static struct class *comedi_class; static struct cdev comedi_cdev; static void comedi_cleanup_legacy_minors(void) diff --git a/drivers/staging/comedi/comedi_fops.h b/drivers/staging/comedi/comedi_fops.h index 006cf14..d59a293 100644 --- a/drivers/staging/comedi/comedi_fops.h +++ b/drivers/staging/comedi/comedi_fops.h @@ -3,8 +3,6 @@ #define _COMEDI_FOPS_H #include -extern struct class *comedi_class; -extern const struct file_operations comedi_fops; extern bool comedi_autoconfig; extern struct comedi_driver *comedi_drivers; -- cgit v0.10.2 From 3a5fa27516116352e810b2122afd82c3d5cbcc7e Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 19 Jun 2012 10:17:44 +0100 Subject: staging: comedi: rename internal.h to comedi_internal.h Use a less generic name for this internal header file included by various parts of the comedi core. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 3650753..1079b0e 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -49,7 +49,7 @@ #include #include -#include "internal.h" +#include "comedi_internal.h" MODULE_AUTHOR("http://www.comedi.org"); MODULE_DESCRIPTION("Comedi core module"); diff --git a/drivers/staging/comedi/comedi_internal.h b/drivers/staging/comedi/comedi_internal.h new file mode 100644 index 0000000..7ed20a0 --- /dev/null +++ b/drivers/staging/comedi/comedi_internal.h @@ -0,0 +1,16 @@ +/* + * various internal comedi stuff + */ +int do_rangeinfo_ioctl(struct comedi_device *dev, + struct comedi_rangeinfo __user *arg); +int insn_inval(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data); +int comedi_alloc_board_minor(struct device *hardware_device); +void comedi_free_board_minor(unsigned minor); +int comedi_find_board_minor(struct device *hardware_device); +void comedi_reset_async_buf(struct comedi_async *async); +int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, + unsigned long new_size); + +extern unsigned int comedi_default_buf_size_kb; +extern unsigned int comedi_default_buf_maxsize_kb; diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index bac3bc1..fe455e7 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -45,7 +45,7 @@ #include #include "comedidev.h" -#include "internal.h" +#include "comedi_internal.h" static int postconfig(struct comedi_device *dev); static int insn_rw_emulate_bits(struct comedi_device *dev, diff --git a/drivers/staging/comedi/internal.h b/drivers/staging/comedi/internal.h deleted file mode 100644 index 7ed20a0..0000000 --- a/drivers/staging/comedi/internal.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * various internal comedi stuff - */ -int do_rangeinfo_ioctl(struct comedi_device *dev, - struct comedi_rangeinfo __user *arg); -int insn_inval(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -int comedi_alloc_board_minor(struct device *hardware_device); -void comedi_free_board_minor(unsigned minor); -int comedi_find_board_minor(struct device *hardware_device); -void comedi_reset_async_buf(struct comedi_async *async); -int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, - unsigned long new_size); - -extern unsigned int comedi_default_buf_size_kb; -extern unsigned int comedi_default_buf_maxsize_kb; diff --git a/drivers/staging/comedi/range.c b/drivers/staging/comedi/range.c index 148ec6f..41f9523 100644 --- a/drivers/staging/comedi/range.c +++ b/drivers/staging/comedi/range.c @@ -23,7 +23,7 @@ #include #include "comedidev.h" -#include "internal.h" +#include "comedi_internal.h" const struct comedi_lrange range_bipolar10 = { 1, {BIP_RANGE(10)} }; EXPORT_SYMBOL(range_bipolar10); -- cgit v0.10.2 From 97ce84de8c19823ab0377a7ffc7fa25a8caa6ab8 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 19 Jun 2012 10:17:45 +0100 Subject: staging: comedi: comedi_internal.h inclusion guards Add a multiple inclusion guard macro to "comedi_internal.h". Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/comedi_internal.h b/drivers/staging/comedi/comedi_internal.h index 7ed20a0..b004963 100644 --- a/drivers/staging/comedi/comedi_internal.h +++ b/drivers/staging/comedi/comedi_internal.h @@ -1,3 +1,6 @@ +#ifndef _COMEDI_INTERNAL_H +#define _COMEDI_INTERNAL_H + /* * various internal comedi stuff */ @@ -14,3 +17,5 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, extern unsigned int comedi_default_buf_size_kb; extern unsigned int comedi_default_buf_maxsize_kb; + +#endif /* _COMEDI_INTERNAL_H */ -- cgit v0.10.2 From f286766e4ba899043714471a0a2c9f1474d2ab5c Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 19 Jun 2012 10:17:46 +0100 Subject: staging: comedi: remove comedi_fops.h Move the contents of "comedi_fops.h" into "comedi_internal.h" and delete "comedi_fops.h". It only contains a couple of external variable declarations (and #include ) and one of those isn't even declared in "comedi_fops.c". The other one is an external declaration of a variable used to store a module parameter and some of those are already externally declared in "comedi_internal.h", so they can keep it company! Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 1079b0e..e821264 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -24,7 +24,6 @@ #undef DEBUG #define __NO_VERSION__ -#include "comedi_fops.h" #include "comedi_compat32.h" #include diff --git a/drivers/staging/comedi/comedi_fops.h b/drivers/staging/comedi/comedi_fops.h deleted file mode 100644 index d59a293..0000000 --- a/drivers/staging/comedi/comedi_fops.h +++ /dev/null @@ -1,9 +0,0 @@ - -#ifndef _COMEDI_FOPS_H -#define _COMEDI_FOPS_H -#include - -extern bool comedi_autoconfig; -extern struct comedi_driver *comedi_drivers; - -#endif /* _COMEDI_FOPS_H */ diff --git a/drivers/staging/comedi/comedi_internal.h b/drivers/staging/comedi/comedi_internal.h index b004963..e70ef051 100644 --- a/drivers/staging/comedi/comedi_internal.h +++ b/drivers/staging/comedi/comedi_internal.h @@ -1,6 +1,8 @@ #ifndef _COMEDI_INTERNAL_H #define _COMEDI_INTERNAL_H +#include + /* * various internal comedi stuff */ @@ -17,5 +19,7 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, extern unsigned int comedi_default_buf_size_kb; extern unsigned int comedi_default_buf_maxsize_kb; +extern bool comedi_autoconfig; +extern struct comedi_driver *comedi_drivers; #endif /* _COMEDI_INTERNAL_H */ diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index fe455e7..c0fdb00 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -24,7 +24,6 @@ #define _GNU_SOURCE #define __NO_VERSION__ -#include "comedi_fops.h" #include #include #include diff --git a/drivers/staging/comedi/proc.c b/drivers/staging/comedi/proc.c index 2aa487b..bb7e70e 100644 --- a/drivers/staging/comedi/proc.c +++ b/drivers/staging/comedi/proc.c @@ -30,7 +30,7 @@ #define __NO_VERSION__ #include "comedidev.h" -#include "comedi_fops.h" +#include "comedi_internal.h" #include #include -- cgit v0.10.2 From 00d20c64a19bc57816d85e3e8f72ff0b8d325d5e Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 19 Jun 2012 10:58:16 +0100 Subject: staging: comedi: shrink comedi_compat32.h "comedi_compat32.h" #include's , but that is only needed by "comedi_compat32.c" so move the #include to that file. Also, "comedi_compat.h" doesn't really need the '#include ' just to declare 'struct file' as it only uses it to construct a pointer to that type. Replace that #include with an incomplete declaration of 'struct file' and move that #include into "comedi_compat32.c". Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/comedi_compat32.c b/drivers/staging/comedi/comedi_compat32.c index 41a7a62..0a5057f 100644 --- a/drivers/staging/comedi/comedi_compat32.c +++ b/drivers/staging/comedi/comedi_compat32.c @@ -26,6 +26,8 @@ #define __NO_VERSION__ #include +#include +#include #include "comedi.h" #include "comedi_compat32.h" diff --git a/drivers/staging/comedi/comedi_compat32.h b/drivers/staging/comedi/comedi_compat32.h index c99573b..60cf51c 100644 --- a/drivers/staging/comedi/comedi_compat32.h +++ b/drivers/staging/comedi/comedi_compat32.h @@ -27,11 +27,9 @@ #ifndef _COMEDI_COMPAT32_H #define _COMEDI_COMPAT32_H -#include -#include - #ifdef CONFIG_COMPAT +struct file; extern long comedi_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg); -- cgit v0.10.2 From a3b0eee21be14e1d2b6a7b97c70a94ee76aaf0b3 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 19 Jun 2012 16:20:05 -0700 Subject: staging: comedi: Kconfig: fix drivers that require the 8255 driver Many of the comedi drivers require the 8255 driver for various subdevice support. The Makefile currently uses CONFIG_COMEDI_PCI_DRIVERS to make sure the 8255 driver is compiled. The Kconfig help for that option says that it does not directly affect the kernel. Fix this by adding 'select COMEDI_8255' to the drivers that actually need the support. Also, remove two cases where the drivers don't require the 8255 support. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Cc: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 2ca7f08..03ee2d0 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -672,7 +672,6 @@ config COMEDI_ADDI_APCI_3XXX config COMEDI_ADL_PCI6208 tristate "ADLink PCI-6208A support" - select COMEDI_8255 ---help--- Enable support for ADLink PCI-6208A cards @@ -689,6 +688,7 @@ config COMEDI_ADL_PCI7230 config COMEDI_ADL_PCI7296 tristate "ADLink PCI-7296 96 ch. digital io board support" + select COMEDI_8255 ---help--- Enable support for ADlink PCI-7296 96 ch. digital io board support @@ -1061,7 +1061,6 @@ config COMEDI_NI_PCIMIO config COMEDI_RTD520 tristate "Real Time Devices PCI4520/DM7520 support" - select COMEDI_8255 ---help--- Enable support for Real Time Devices PCI4520/DM7520 diff --git a/drivers/staging/comedi/drivers/Makefile b/drivers/staging/comedi/drivers/Makefile index 170da60..513469d9 100644 --- a/drivers/staging/comedi/drivers/Makefile +++ b/drivers/staging/comedi/drivers/Makefile @@ -55,7 +55,6 @@ obj-$(CONFIG_COMEDI_MULTIQ3) += multiq3.o obj-$(CONFIG_COMEDI_POC) += poc.o # Comedi PCI drivers -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += 8255.o obj-$(CONFIG_COMEDI_ADDI_APCI_035) += addi_apci_035.o obj-$(CONFIG_COMEDI_ADDI_APCI_1032) += addi_apci_1032.o obj-$(CONFIG_COMEDI_ADDI_APCI_1500) += addi_apci_1500.o -- cgit v0.10.2 From d4d3c4e676769dbabb0289f1a893854907950b65 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 19 Jun 2012 16:20:17 -0700 Subject: staging: comedi: remove unused CONFIG_COMEDI_PCMCIA define CONFIG_COMEDI_PCMCIA is not actually a Kconfig option. It is defined in the comedidev.h header based on another Kconfig option being enbled. Just remove it since the define is not used by any of the comedi drivers. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 7363fd8..3bc97ad 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -513,11 +513,5 @@ void comedi_usb_auto_unconfig(struct usb_interface *intf); #ifdef CONFIG_COMEDI_PCI_DRIVERS_MODULE #define CONFIG_COMEDI_PCI #endif -#ifdef CONFIG_COMEDI_PCMCIA_DRIVERS -#define CONFIG_COMEDI_PCMCIA -#endif -#ifdef CONFIG_COMEDI_PCMCIA_DRIVERS_MODULE -#define CONFIG_COMEDI_PCMCIA -#endif #endif /* _COMEDIDEV_H */ -- cgit v0.10.2 From 928ae0956d8a3b26c3908c4bc97973cba36030a3 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 19 Jun 2012 16:20:23 -0700 Subject: staging: comedi: remove CONFIG_COMEDI_PCI define CONFIG_COMEDI_PCI is not actually a Kconfig option. It is defined in the comedidev.h header based on another Kconfig option being enabled. It is only referenced in the skel driver to conditionally compile in the PCI support code. Use the CONFIG_COMEDI_PCI_DRIVERS Kconfig option instead and remove the define. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 3bc97ad..de8c99c 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -507,11 +507,4 @@ int comedi_usb_auto_config(struct usb_interface *intf, struct comedi_driver *driver); void comedi_usb_auto_unconfig(struct usb_interface *intf); -#ifdef CONFIG_COMEDI_PCI_DRIVERS -#define CONFIG_COMEDI_PCI -#endif -#ifdef CONFIG_COMEDI_PCI_DRIVERS_MODULE -#define CONFIG_COMEDI_PCI -#endif - #endif /* _COMEDIDEV_H */ diff --git a/drivers/staging/comedi/drivers/skel.c b/drivers/staging/comedi/drivers/skel.c index 6baac52..9a68eeb 100644 --- a/drivers/staging/comedi/drivers/skel.c +++ b/drivers/staging/comedi/drivers/skel.c @@ -611,7 +611,7 @@ static int skel_dio_insn_config(struct comedi_device *dev, return insn->n; } -#ifdef CONFIG_COMEDI_PCI +#ifdef CONFIG_COMEDI_PCI_DRIVERS static int __devinit driver_skel_pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) { -- cgit v0.10.2 From 64be096d0f32e21b7e6824bb3c937bdf0b56f38c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 19 Jun 2012 16:20:28 -0700 Subject: staging: comedi: Kconfig: menuconfig options should be bool The menuconfig options to enable the various comedi driver types should be bool not tristate. They don't directly affect the building of the kernel, they just allow other options to be selected. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 03ee2d0..974c668 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -33,7 +33,7 @@ config COMEDI_DEFAULT_BUF_MAXSIZE_KB channels running at 100 kHz has 2-4 seconds of buffer. menuconfig COMEDI_MISC_DRIVERS - tristate "Comedi misc drivers" + bool "Comedi misc drivers" ---help--- Enable comedi misc drivers to be built @@ -100,7 +100,7 @@ config COMEDI_SKEL endif # COMEDI_MISC_DRIVERS menuconfig COMEDI_ISA_DRIVERS - tristate "Comedi ISA and PC/104 drivers" + bool "Comedi ISA and PC/104 drivers" depends on ISA ---help--- Enable comedi ISA and PC/104 drivers to be built @@ -540,7 +540,7 @@ config COMEDI_POC endif # COMEDI_ISA_DRIVERS menuconfig COMEDI_PCI_DRIVERS - tristate "Comedi PCI drivers" + bool "Comedi PCI drivers" depends on PCI ---help--- Enable comedi PCI drivers to be built @@ -1095,7 +1095,7 @@ config COMEDI_SSV_DNP endif # COMEDI_PCI_DRIVERS menuconfig COMEDI_PCMCIA_DRIVERS - tristate "Comedi PCMCIA drivers" + bool "Comedi PCMCIA drivers" depends on PCMCIA ---help--- Enable comedi PCMCIA and PCCARD drivers to be built @@ -1178,7 +1178,7 @@ config COMEDI_QUATECH_DAQP_CS endif # COMEDI_PCMCIA_DRIVERS menuconfig COMEDI_USB_DRIVERS - tristate "Comedi USB drivers" + bool "Comedi USB drivers" depends on USB ---help--- Enable comedi USB drivers to be built -- cgit v0.10.2 From 9c3db14239a5d7d813ed12945581378b70271060 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 19 Jun 2012 16:20:31 -0700 Subject: staging: comedi: Kconfig: remove redundant depends on tests The 'depends on COMEDI_ISA_DRIVERS' for COMEDI_AMPLC_DIO200_ISA is not needed. This option is alread in an if/endif block that will satisy the check. The 'depends on COMEDI' for COMEDI_NI_COMMON was missed when all the comedi options were wrapped in an if/endif block. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 974c668..0415520 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -213,7 +213,6 @@ config COMEDI_PCM3730 config COMEDI_AMPLC_DIO200_ISA tristate "Amplicon PC212E/PC214E/PC215E/PC218E/PC272E" select COMEDI_AMPLC_DIO200 - depends on COMEDI_ISA_DRIVERS ---help--- Enable support for Amplicon PC212E, PC214E, PC215E, PC218E and PC272E ISA DIO boards @@ -1236,7 +1235,6 @@ endif # COMEDI_USB_DRIVERS menuconfig COMEDI_NI_COMMON tristate "Comedi National Instruments card support" - depends on COMEDI ---help--- Enable comedi support for National Instruments cards. Modules in this section are used by many comedi NI drivers. -- cgit v0.10.2 From 42318c32f8c968d602d151ad81e567832b72b767 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 20 Jun 2012 12:00:57 -0700 Subject: staging: comedi: usbdux: use module_comedi_usb_driver() Use the module_comedi_usb_driver helper macro to initialize this module. Rename the driver structs to follow the pattern of the other comedi driver types and add some whitespace to improve readability. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 83ee669..586936b 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -317,7 +317,7 @@ static struct usbduxsub usbduxsub[NUMUSBDUX]; static DEFINE_SEMAPHORE(start_stop_sem); -static struct comedi_driver driver_usbdux; /* see below for initializer */ +static struct comedi_driver usbdux_driver; /* see below for initializer */ /* * Stops the data acquision @@ -2323,7 +2323,7 @@ static void usbdux_firmware_request_complete_handler(const struct firmware *fw, "Could not upload firmware (err=%d)\n", ret); goto out; } - comedi_usb_auto_config(uinterf, &driver_usbdux); + comedi_usb_auto_config(uinterf, &usbdux_driver); out: release_firmware(fw); } @@ -2832,12 +2832,12 @@ static void usbdux_detach(struct comedi_device *dev) } /* main driver struct */ -static struct comedi_driver driver_usbdux = { - .driver_name = "usbdux", - .module = THIS_MODULE, - .attach = usbdux_attach, - .detach = usbdux_detach, - .attach_usb = usbdux_attach_usb, +static struct comedi_driver usbdux_driver = { + .driver_name = "usbdux", + .module = THIS_MODULE, + .attach = usbdux_attach, + .detach = usbdux_detach, + .attach_usb = usbdux_attach_usb, }; /* Table with the USB-devices: just now only testing IDs */ @@ -2849,35 +2849,13 @@ static const struct usb_device_id usbduxsub_table[] = { MODULE_DEVICE_TABLE(usb, usbduxsub_table); -/* The usbduxsub-driver */ -static struct usb_driver usbduxsub_driver = { - .name = BOARDNAME, - .probe = usbduxsub_probe, - .disconnect = usbduxsub_disconnect, - .id_table = usbduxsub_table, +static struct usb_driver usbdux_usb_driver = { + .name = BOARDNAME, + .probe = usbduxsub_probe, + .disconnect = usbduxsub_disconnect, + .id_table = usbduxsub_table, }; - -/* Can't use the nice macro as I have also to initialise the USB */ -/* subsystem: */ -/* registering the usb-system _and_ the comedi-driver */ -static int __init init_usbdux(void) -{ - printk(KERN_INFO KBUILD_MODNAME ": " - DRIVER_VERSION ":" DRIVER_DESC "\n"); - usb_register(&usbduxsub_driver); - comedi_driver_register(&driver_usbdux); - return 0; -} - -/* deregistering the comedi driver and the usb-subsystem */ -static void __exit exit_usbdux(void) -{ - comedi_driver_unregister(&driver_usbdux); - usb_deregister(&usbduxsub_driver); -} - -module_init(init_usbdux); -module_exit(exit_usbdux); +module_comedi_usb_driver(usbdux_driver, usbdux_usb_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); -- cgit v0.10.2 From cb9513adb2054c7a769d938cb519a437ad4f2b10 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 20 Jun 2012 12:01:14 -0700 Subject: staging: comedi: usbduxfast: use module_comedi_usb_driver() Use the module_comedi_usb_driver helper macro to initialize this module. Rename the driver structs to follow the pattern of the other comedi driver types and add some whitespace to improve readability. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index c713620..8c8e4ec9 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c @@ -196,7 +196,7 @@ static struct usbduxfastsub_s usbduxfastsub[NUMUSBDUXFAST]; static DEFINE_SEMAPHORE(start_stop_sem); -static struct comedi_driver driver_usbduxfast; /* see below for initializer */ +static struct comedi_driver usbduxfast_driver; /* see below for initializer */ /* * bulk transfers to usbduxfast @@ -1458,7 +1458,7 @@ static void usbduxfast_firmware_request_complete_handler(const struct firmware goto out; } - comedi_usb_auto_config(uinterf, &driver_usbduxfast); + comedi_usb_auto_config(uinterf, &usbduxfast_driver); out: release_firmware(fw); } @@ -1757,12 +1757,12 @@ static void usbduxfast_detach(struct comedi_device *dev) /* * main driver struct */ -static struct comedi_driver driver_usbduxfast = { - .driver_name = "usbduxfast", - .module = THIS_MODULE, - .attach = usbduxfast_attach, - .detach = usbduxfast_detach, - .attach_usb = usbduxfast_attach_usb, +static struct comedi_driver usbduxfast_driver = { + .driver_name = "usbduxfast", + .module = THIS_MODULE, + .attach = usbduxfast_attach, + .detach = usbduxfast_detach, + .attach_usb = usbduxfast_attach_usb, }; /* @@ -1777,43 +1777,16 @@ static const struct usb_device_id usbduxfastsub_table[] = { MODULE_DEVICE_TABLE(usb, usbduxfastsub_table); -/* - * The usbduxfastsub-driver - */ -static struct usb_driver usbduxfastsub_driver = { +static struct usb_driver usbduxfast_usb_driver = { #ifdef COMEDI_HAVE_USB_DRIVER_OWNER - .owner = THIS_MODULE, + .owner = THIS_MODULE, #endif - .name = BOARDNAME, - .probe = usbduxfastsub_probe, - .disconnect = usbduxfastsub_disconnect, - .id_table = usbduxfastsub_table + .name = BOARDNAME, + .probe = usbduxfastsub_probe, + .disconnect = usbduxfastsub_disconnect, + .id_table = usbduxfastsub_table, }; - -/* - * Can't use the nice macro as I have also to initialise the USB subsystem: - * registering the usb-system _and_ the comedi-driver - */ -static int __init init_usbduxfast(void) -{ - printk(KERN_INFO - KBUILD_MODNAME ": " DRIVER_VERSION ":" DRIVER_DESC "\n"); - usb_register(&usbduxfastsub_driver); - comedi_driver_register(&driver_usbduxfast); - return 0; -} - -/* - * deregistering the comedi driver and the usb-subsystem - */ -static void __exit exit_usbduxfast(void) -{ - comedi_driver_unregister(&driver_usbduxfast); - usb_deregister(&usbduxfastsub_driver); -} - -module_init(init_usbduxfast); -module_exit(exit_usbduxfast); +module_comedi_usb_driver(usbduxfast_driver, usbduxfast_usb_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); -- cgit v0.10.2 From b7418f4524a830747a16f41b728075dca6e2cca3 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 20 Jun 2012 12:01:27 -0700 Subject: staging: comedi: usbduxsigma: use module_comedi_usb_driver() Use the module_comedi_usb_driver helper macro to initialize this module. Rename the driver structs to follow the pattern of the other comedi driver types and add some whitespace to improve readability. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index 28f41e9..e430882 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -267,7 +267,7 @@ static struct usbduxsub usbduxsub[NUMUSBDUX]; static DEFINE_SEMAPHORE(start_stop_sem); -static struct comedi_driver driver_usbduxsigma; /* see below for initializer */ +static struct comedi_driver usbduxsigma_driver; /* see below for initializer */ /* * Stops the data acquision @@ -2331,7 +2331,7 @@ static void usbdux_firmware_request_complete_handler(const struct firmware *fw, "Could not upload firmware (err=%d)\n", ret); goto out; } - comedi_usb_auto_config(uinterf, &driver_usbduxsigma); + comedi_usb_auto_config(uinterf, &usbduxsigma_driver); out: release_firmware(fw); } @@ -2828,12 +2828,12 @@ static void usbduxsigma_detach(struct comedi_device *dev) } /* main driver struct */ -static struct comedi_driver driver_usbduxsigma = { - .driver_name = "usbduxsigma", - .module = THIS_MODULE, - .attach = usbduxsigma_attach, - .detach = usbduxsigma_detach, - .attach_usb = usbduxsigma_attach_usb, +static struct comedi_driver usbduxsigma_driver = { + .driver_name = "usbduxsigma", + .module = THIS_MODULE, + .attach = usbduxsigma_attach, + .detach = usbduxsigma_detach, + .attach_usb = usbduxsigma_attach_usb, }; /* Table with the USB-devices */ @@ -2847,34 +2847,13 @@ static const struct usb_device_id usbduxsigma_table[] = { MODULE_DEVICE_TABLE(usb, usbduxsigma_table); /* The usbduxsub-driver */ -static struct usb_driver usbduxsigma_driver = { - .name = BOARDNAME, - .probe = usbduxsigma_probe, - .disconnect = usbduxsigma_disconnect, - .id_table = usbduxsigma_table, +static struct usb_driver usbduxsigma_usb_driver = { + .name = BOARDNAME, + .probe = usbduxsigma_probe, + .disconnect = usbduxsigma_disconnect, + .id_table = usbduxsigma_table, }; - -/* Can't use the nice macro as I have also to initialise the USB */ -/* subsystem: */ -/* registering the usb-system _and_ the comedi-driver */ -static int __init init_usbduxsigma(void) -{ - printk(KERN_INFO KBUILD_MODNAME ": " - DRIVER_VERSION ":" DRIVER_DESC "\n"); - usb_register(&usbduxsigma_driver); - comedi_driver_register(&driver_usbduxsigma); - return 0; -} - -/* deregistering the comedi driver and the usb-subsystem */ -static void __exit exit_usbduxsigma(void) -{ - comedi_driver_unregister(&driver_usbduxsigma); - usb_deregister(&usbduxsigma_driver); -} - -module_init(init_usbduxsigma); -module_exit(exit_usbduxsigma); +module_comedi_usb_driver(usbduxsigma_driver, usbduxsigma_usb_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); -- cgit v0.10.2 From d6cc3ec8e727de15ac59e7a184f9d51bf476147b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 20 Jun 2012 12:01:44 -0700 Subject: staging: comedi: vmk80xx: use module_comedi_usb_driver() Use the module_comedi_usb_driver helper macro to initialize this module. Rename the driver structs to follow the pattern of the other comedi driver types and add some whitespace to improve readability. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c index 7d3cb3a..14fb50a 100644 --- a/drivers/staging/comedi/drivers/vmk80xx.c +++ b/drivers/staging/comedi/drivers/vmk80xx.c @@ -232,7 +232,7 @@ static struct vmk80xx_usb vmb[VMK80XX_MAX_BOARDS]; static DEFINE_MUTEX(glb_mutex); -static struct comedi_driver driver_vmk80xx; /* see below for initializer */ +static struct comedi_driver vmk80xx_driver; /* see below for initializer */ static void vmk80xx_tx_callback(struct urb *urb) { @@ -1410,7 +1410,7 @@ static int vmk80xx_probe(struct usb_interface *intf, mutex_unlock(&glb_mutex); - comedi_usb_auto_config(intf, &driver_vmk80xx); + comedi_usb_auto_config(intf, &vmk80xx_driver); return 0; error: @@ -1449,40 +1449,18 @@ static void vmk80xx_disconnect(struct usb_interface *intf) /* TODO: Add support for suspend, resume, pre_reset, * post_reset and flush */ -static struct usb_driver vmk80xx_driver = { - .name = "vmk80xx", - .probe = vmk80xx_probe, - .disconnect = vmk80xx_disconnect, - .id_table = vmk80xx_id_table +static struct usb_driver vmk80xx_usb_driver = { + .name = "vmk80xx", + .probe = vmk80xx_probe, + .disconnect = vmk80xx_disconnect, + .id_table = vmk80xx_id_table }; -static struct comedi_driver driver_vmk80xx = { - .module = THIS_MODULE, - .driver_name = "vmk80xx", - .attach = vmk80xx_attach, - .detach = vmk80xx_detach, - .attach_usb = vmk80xx_attach_usb, +static struct comedi_driver vmk80xx_driver = { + .module = THIS_MODULE, + .driver_name = "vmk80xx", + .attach = vmk80xx_attach, + .detach = vmk80xx_detach, + .attach_usb = vmk80xx_attach_usb, }; - -static int __init vmk80xx_init(void) -{ - int retval; - - printk(KERN_INFO "vmk80xx: version 0.8.01 " - "Manuel Gebele \n"); - - retval = comedi_driver_register(&driver_vmk80xx); - if (retval < 0) - return retval; - - return usb_register(&vmk80xx_driver); -} - -static void __exit vmk80xx_exit(void) -{ - comedi_driver_unregister(&driver_vmk80xx); - usb_deregister(&vmk80xx_driver); -} - -module_init(vmk80xx_init); -module_exit(vmk80xx_exit); +module_comedi_usb_driver(vmk80xx_driver, vmk80xx_usb_driver); -- cgit v0.10.2 From 007ff2af216090b4c20ebd2b9d94c528102ec135 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 20 Jun 2012 12:01:57 -0700 Subject: staging: comedi: vmk80xx: refactor init code Refactor the usb driver probe/disconnect and comedi driver attach/ detach to follow the style of the other comedi driver types to improve maintainability. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c index 14fb50a..94010fc 100644 --- a/drivers/staging/comedi/drivers/vmk80xx.c +++ b/drivers/staging/comedi/drivers/vmk80xx.c @@ -64,37 +64,11 @@ Changelog: #include "../comedidev.h" -#define BOARDNAME "vmk80xx" - -MODULE_AUTHOR("Manuel Gebele "); -MODULE_DESCRIPTION("Velleman USB Board Low-Level Driver"); -MODULE_SUPPORTED_DEVICE("K8055/K8061 aka VM110/VM140"); -MODULE_VERSION("0.8.01"); -MODULE_LICENSE("GPL"); - enum { DEVICE_VMK8055, DEVICE_VMK8061 }; -static const struct usb_device_id vmk80xx_id_table[] = { - {USB_DEVICE(0x10cf, 0x5500), .driver_info = DEVICE_VMK8055}, - {USB_DEVICE(0x10cf, 0x5501), .driver_info = DEVICE_VMK8055}, - {USB_DEVICE(0x10cf, 0x5502), .driver_info = DEVICE_VMK8055}, - {USB_DEVICE(0x10cf, 0x5503), .driver_info = DEVICE_VMK8055}, - {USB_DEVICE(0x10cf, 0x8061), .driver_info = DEVICE_VMK8061}, - {USB_DEVICE(0x10cf, 0x8062), .driver_info = DEVICE_VMK8061}, - {USB_DEVICE(0x10cf, 0x8063), .driver_info = DEVICE_VMK8061}, - {USB_DEVICE(0x10cf, 0x8064), .driver_info = DEVICE_VMK8061}, - {USB_DEVICE(0x10cf, 0x8065), .driver_info = DEVICE_VMK8061}, - {USB_DEVICE(0x10cf, 0x8066), .driver_info = DEVICE_VMK8061}, - {USB_DEVICE(0x10cf, 0x8067), .driver_info = DEVICE_VMK8061}, - {USB_DEVICE(0x10cf, 0x8068), .driver_info = DEVICE_VMK8061}, - {} /* terminating entry */ -}; - -MODULE_DEVICE_TABLE(usb, vmk80xx_id_table); - #define VMK8055_DI_REG 0x00 #define VMK8055_DO_REG 0x01 #define VMK8055_AO1_REG 0x02 @@ -232,8 +206,6 @@ static struct vmk80xx_usb vmb[VMK80XX_MAX_BOARDS]; static DEFINE_MUTEX(glb_mutex); -static struct comedi_driver vmk80xx_driver; /* see below for initializer */ - static void vmk80xx_tx_callback(struct urb *urb) { struct vmk80xx_usb *dev = urb->context; @@ -1267,8 +1239,16 @@ static void vmk80xx_detach(struct comedi_device *dev) } } -static int vmk80xx_probe(struct usb_interface *intf, - const struct usb_device_id *id) +static struct comedi_driver vmk80xx_driver = { + .module = THIS_MODULE, + .driver_name = "vmk80xx", + .attach = vmk80xx_attach, + .detach = vmk80xx_detach, + .attach_usb = vmk80xx_attach_usb, +}; + +static int vmk80xx_usb_probe(struct usb_interface *intf, + const struct usb_device_id *id) { int i; struct vmk80xx_usb *dev; @@ -1419,7 +1399,7 @@ error: return -ENODEV; } -static void vmk80xx_disconnect(struct usb_interface *intf) +static void vmk80xx_usb_disconnect(struct usb_interface *intf) { struct vmk80xx_usb *dev = usb_get_intfdata(intf); @@ -1447,20 +1427,35 @@ static void vmk80xx_disconnect(struct usb_interface *intf) mutex_unlock(&glb_mutex); } +static const struct usb_device_id vmk80xx_usb_id_table[] = { + { USB_DEVICE(0x10cf, 0x5500), .driver_info = DEVICE_VMK8055 }, + { USB_DEVICE(0x10cf, 0x5501), .driver_info = DEVICE_VMK8055 }, + { USB_DEVICE(0x10cf, 0x5502), .driver_info = DEVICE_VMK8055 }, + { USB_DEVICE(0x10cf, 0x5503), .driver_info = DEVICE_VMK8055 }, + { USB_DEVICE(0x10cf, 0x8061), .driver_info = DEVICE_VMK8061 }, + { USB_DEVICE(0x10cf, 0x8062), .driver_info = DEVICE_VMK8061 }, + { USB_DEVICE(0x10cf, 0x8063), .driver_info = DEVICE_VMK8061 }, + { USB_DEVICE(0x10cf, 0x8064), .driver_info = DEVICE_VMK8061 }, + { USB_DEVICE(0x10cf, 0x8065), .driver_info = DEVICE_VMK8061 }, + { USB_DEVICE(0x10cf, 0x8066), .driver_info = DEVICE_VMK8061 }, + { USB_DEVICE(0x10cf, 0x8067), .driver_info = DEVICE_VMK8061 }, + { USB_DEVICE(0x10cf, 0x8068), .driver_info = DEVICE_VMK8061 }, + { } +}; +MODULE_DEVICE_TABLE(usb, vmk80xx_usb_id_table); + /* TODO: Add support for suspend, resume, pre_reset, * post_reset and flush */ static struct usb_driver vmk80xx_usb_driver = { .name = "vmk80xx", - .probe = vmk80xx_probe, - .disconnect = vmk80xx_disconnect, - .id_table = vmk80xx_id_table -}; - -static struct comedi_driver vmk80xx_driver = { - .module = THIS_MODULE, - .driver_name = "vmk80xx", - .attach = vmk80xx_attach, - .detach = vmk80xx_detach, - .attach_usb = vmk80xx_attach_usb, + .probe = vmk80xx_usb_probe, + .disconnect = vmk80xx_usb_disconnect, + .id_table = vmk80xx_usb_id_table, }; module_comedi_usb_driver(vmk80xx_driver, vmk80xx_usb_driver); + +MODULE_AUTHOR("Manuel Gebele "); +MODULE_DESCRIPTION("Velleman USB Board Low-Level Driver"); +MODULE_SUPPORTED_DEVICE("K8055/K8061 aka VM110/VM140"); +MODULE_VERSION("0.8.01"); +MODULE_LICENSE("GPL"); -- cgit v0.10.2 From ab5455ae2d920b227afbf2f870f3253fc699b132 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 20 Jun 2012 12:02:15 -0700 Subject: staging: comedi: usbduxsigma: refactor init code Refactor the usb driver probe/disconnect and comedi driver attach/ detach to follow the style of the other comedi driver types to improve maintainability. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index e430882..8da8c1c 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -1,6 +1,3 @@ -#define DRIVER_VERSION "v0.6" -#define DRIVER_AUTHOR "Bernd Porr, BerndPorr@f2s.com" -#define DRIVER_DESC "Stirling/ITL USB-DUX SIGMA -- Bernd.Porr@f2s.com" /* comedi/drivers/usbdux.c Copyright (C) 2011 Bernd Porr, Bernd.Porr@f2s.com @@ -62,8 +59,6 @@ Status: testing #include "comedi_fc.h" #include "../comedidev.h" -#define BOARDNAME "usbduxsigma" - /* timeout for the USB-transfer in ms*/ #define BULK_TIMEOUT 1000 @@ -267,8 +262,6 @@ static struct usbduxsub usbduxsub[NUMUSBDUX]; static DEFINE_SEMAPHORE(start_stop_sem); -static struct comedi_driver usbduxsigma_driver; /* see below for initializer */ - /* * Stops the data acquision * It should be safe to call this function from any context @@ -2307,6 +2300,210 @@ static void tidy_up(struct usbduxsub *usbduxsub_tmp) usbduxsub_tmp->pwm_cmd_running = 0; } +/* common part of attach and attach_usb */ +static int usbduxsigma_attach_common(struct comedi_device *dev, + struct usbduxsub *uds, + void *aux_data, int aux_len) +{ + int ret; + struct comedi_subdevice *s; + int n_subdevs; + int offset; + + down(&uds->sem); + /* pointer back to the corresponding comedi device */ + uds->comedidev = dev; + /* trying to upload the firmware into the FX2 */ + if (aux_data) + firmwareUpload(uds, aux_data, aux_len); + dev->board_name = "usbduxsigma"; + /* set number of subdevices */ + if (uds->high_speed) + n_subdevs = 4; /* with pwm */ + else + n_subdevs = 3; /* without pwm */ + ret = comedi_alloc_subdevices(dev, n_subdevs); + if (ret) { + up(&uds->sem); + return ret; + } + /* private structure is also simply the usb-structure */ + dev->private = uds; + /* the first subdevice is the A/D converter */ + s = dev->subdevices + SUBDEV_AD; + /* the URBs get the comedi subdevice */ + /* which is responsible for reading */ + /* this is the subdevice which reads data */ + dev->read_subdev = s; + /* the subdevice receives as private structure the */ + /* usb-structure */ + s->private = NULL; + /* analog input */ + s->type = COMEDI_SUBD_AI; + /* readable and ref is to ground, 32 bit wide data! */ + s->subdev_flags = SDF_READABLE | SDF_GROUND | + SDF_CMD_READ | SDF_LSAMPL; + /* 16 A/D channels */ + s->n_chan = NUMCHANNELS; + /* length of the channellist */ + s->len_chanlist = NUMCHANNELS; + /* callback functions */ + s->insn_read = usbdux_ai_insn_read; + s->do_cmdtest = usbdux_ai_cmdtest; + s->do_cmd = usbdux_ai_cmd; + s->cancel = usbdux_ai_cancel; + /* max value from the A/D converter (24bit) */ + s->maxdata = 0x00FFFFFF; + /* range table to convert to physical units */ + s->range_table = (&range_usbdux_ai_range); + /* analog output subdevice */ + s = dev->subdevices + SUBDEV_DA; + /* analog out */ + s->type = COMEDI_SUBD_AO; + /* backward pointer */ + dev->write_subdev = s; + /* the subdevice receives as private structure the */ + /* usb-structure */ + s->private = NULL; + /* are writable */ + s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_CMD_WRITE; + /* 4 channels */ + s->n_chan = 4; + /* length of the channellist */ + s->len_chanlist = 4; + /* 8 bit resolution */ + s->maxdata = 0x00ff; + /* unipolar range */ + s->range_table = (&range_usbdux_ao_range); + /* callback */ + s->do_cmdtest = usbdux_ao_cmdtest; + s->do_cmd = usbdux_ao_cmd; + s->cancel = usbdux_ao_cancel; + s->insn_read = usbdux_ao_insn_read; + s->insn_write = usbdux_ao_insn_write; + /* digital I/O subdevice */ + s = dev->subdevices + SUBDEV_DIO; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + /* 8 external and 16 internal channels */ + s->n_chan = 24; + s->maxdata = 1; + s->range_table = (&range_digital); + s->insn_bits = usbdux_dio_insn_bits; + s->insn_config = usbdux_dio_insn_config; + /* we don't use it */ + s->private = NULL; + if (uds->high_speed) { + /* timer / pwm subdevice */ + s = dev->subdevices + SUBDEV_PWM; + s->type = COMEDI_SUBD_PWM; + s->subdev_flags = SDF_WRITABLE | SDF_PWM_HBRIDGE; + s->n_chan = 8; + /* this defines the max duty cycle resolution */ + s->maxdata = uds->sizePwmBuf; + s->insn_write = usbdux_pwm_write; + s->insn_read = usbdux_pwm_read; + s->insn_config = usbdux_pwm_config; + usbdux_pwm_period(dev, s, PWM_DEFAULT_PERIOD); + } + /* finally decide that it's attached */ + uds->attached = 1; + up(&uds->sem); + offset = usbdux_getstatusinfo(dev, 0); + if (offset < 0) + dev_err(&uds->interface->dev, + "Communication to USBDUXSIGMA failed! Check firmware and cabling."); + dev_info(&uds->interface->dev, + "comedi%d: attached, ADC_zero = %x\n", dev->minor, offset); + return 0; +} + +/* is called for COMEDI_DEVCONFIG ioctl (when comedi_config is run) */ +static int usbduxsigma_attach(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + int ret; + int index; + int i; + void *aux_data; + int aux_len; + + dev->private = NULL; + + aux_data = comedi_aux_data(it->options, 0); + aux_len = it->options[COMEDI_DEVCONF_AUX_DATA_LENGTH]; + if (aux_data == NULL) + aux_len = 0; + else if (aux_len == 0) + aux_data = NULL; + + down(&start_stop_sem); + /* find a valid device which has been detected by the probe function of + * the usb */ + index = -1; + for (i = 0; i < NUMUSBDUX; i++) { + if ((usbduxsub[i].probed) && (!usbduxsub[i].attached)) { + index = i; + break; + } + } + if (index < 0) { + dev_err(dev->class_dev, + "usbduxsigma: error: attach failed, dev not connected to the usb bus.\n"); + up(&start_stop_sem); + ret = -ENODEV; + } else + ret = usbduxsigma_attach_common(dev, &usbduxsub[index], + aux_data, aux_len); + up(&start_stop_sem); + return ret; +} + +/* is called from comedi_usb_auto_config() */ +static int usbduxsigma_attach_usb(struct comedi_device *dev, + struct usb_interface *uinterf) +{ + int ret; + struct usbduxsub *uds; + + dev->private = NULL; + down(&start_stop_sem); + uds = usb_get_intfdata(uinterf); + if (!uds || !uds->probed) { + dev_err(dev->class_dev, + "usbduxsigma: error: attach_usb failed, not connected\n"); + ret = -ENODEV; + } else if (uds->attached) { + dev_err(dev->class_dev, + "usbduxsigma: error: attach_usb failed, already attached\n"); + ret = -ENODEV; + } else + ret = usbduxsigma_attach_common(dev, uds, NULL, 0); + up(&start_stop_sem); + return ret; +} + +static void usbduxsigma_detach(struct comedi_device *dev) +{ + struct usbduxsub *usb = dev->private; + + if (usb) { + down(&usb->sem); + dev->private = NULL; + usb->attached = 0; + usb->comedidev = NULL; + up(&usb->sem); + } +} + +static struct comedi_driver usbduxsigma_driver = { + .driver_name = "usbduxsigma", + .module = THIS_MODULE, + .attach = usbduxsigma_attach, + .detach = usbduxsigma_detach, + .attach_usb = usbduxsigma_attach_usb, +}; + static void usbdux_firmware_request_complete_handler(const struct firmware *fw, void *context) { @@ -2336,9 +2533,8 @@ out: release_firmware(fw); } -/* allocate memory for the urbs and initialise them */ -static int usbduxsigma_probe(struct usb_interface *uinterf, - const struct usb_device_id *id) +static int usbduxsigma_usb_probe(struct usb_interface *uinterf, + const struct usb_device_id *id) { struct usb_device *udev = interface_to_usbdev(uinterf); struct device *dev = &uinterf->dev; @@ -2602,7 +2798,7 @@ static int usbduxsigma_probe(struct usb_interface *uinterf, return 0; } -static void usbduxsigma_disconnect(struct usb_interface *intf) +static void usbduxsigma_usb_disconnect(struct usb_interface *intf) { struct usbduxsub *usbduxsub_tmp = usb_get_intfdata(intf); struct usb_device *udev = interface_to_usbdev(intf); @@ -2631,230 +2827,22 @@ static void usbduxsigma_disconnect(struct usb_interface *intf) dev_info(&intf->dev, "comedi_: disconnected from the usb\n"); } -/* common part of attach and attach_usb */ -static int usbduxsigma_attach_common(struct comedi_device *dev, - struct usbduxsub *uds, - void *aux_data, int aux_len) -{ - int ret; - struct comedi_subdevice *s; - int n_subdevs; - int offset; - - down(&uds->sem); - /* pointer back to the corresponding comedi device */ - uds->comedidev = dev; - /* trying to upload the firmware into the FX2 */ - if (aux_data) - firmwareUpload(uds, aux_data, aux_len); - dev->board_name = BOARDNAME; - /* set number of subdevices */ - if (uds->high_speed) - n_subdevs = 4; /* with pwm */ - else - n_subdevs = 3; /* without pwm */ - ret = comedi_alloc_subdevices(dev, n_subdevs); - if (ret) { - up(&uds->sem); - return ret; - } - /* private structure is also simply the usb-structure */ - dev->private = uds; - /* the first subdevice is the A/D converter */ - s = dev->subdevices + SUBDEV_AD; - /* the URBs get the comedi subdevice */ - /* which is responsible for reading */ - /* this is the subdevice which reads data */ - dev->read_subdev = s; - /* the subdevice receives as private structure the */ - /* usb-structure */ - s->private = NULL; - /* analog input */ - s->type = COMEDI_SUBD_AI; - /* readable and ref is to ground, 32 bit wide data! */ - s->subdev_flags = SDF_READABLE | SDF_GROUND | - SDF_CMD_READ | SDF_LSAMPL; - /* 16 A/D channels */ - s->n_chan = NUMCHANNELS; - /* length of the channellist */ - s->len_chanlist = NUMCHANNELS; - /* callback functions */ - s->insn_read = usbdux_ai_insn_read; - s->do_cmdtest = usbdux_ai_cmdtest; - s->do_cmd = usbdux_ai_cmd; - s->cancel = usbdux_ai_cancel; - /* max value from the A/D converter (24bit) */ - s->maxdata = 0x00FFFFFF; - /* range table to convert to physical units */ - s->range_table = (&range_usbdux_ai_range); - /* analog output subdevice */ - s = dev->subdevices + SUBDEV_DA; - /* analog out */ - s->type = COMEDI_SUBD_AO; - /* backward pointer */ - dev->write_subdev = s; - /* the subdevice receives as private structure the */ - /* usb-structure */ - s->private = NULL; - /* are writable */ - s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_CMD_WRITE; - /* 4 channels */ - s->n_chan = 4; - /* length of the channellist */ - s->len_chanlist = 4; - /* 8 bit resolution */ - s->maxdata = 0x00ff; - /* unipolar range */ - s->range_table = (&range_usbdux_ao_range); - /* callback */ - s->do_cmdtest = usbdux_ao_cmdtest; - s->do_cmd = usbdux_ao_cmd; - s->cancel = usbdux_ao_cancel; - s->insn_read = usbdux_ao_insn_read; - s->insn_write = usbdux_ao_insn_write; - /* digital I/O subdevice */ - s = dev->subdevices + SUBDEV_DIO; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - /* 8 external and 16 internal channels */ - s->n_chan = 24; - s->maxdata = 1; - s->range_table = (&range_digital); - s->insn_bits = usbdux_dio_insn_bits; - s->insn_config = usbdux_dio_insn_config; - /* we don't use it */ - s->private = NULL; - if (uds->high_speed) { - /* timer / pwm subdevice */ - s = dev->subdevices + SUBDEV_PWM; - s->type = COMEDI_SUBD_PWM; - s->subdev_flags = SDF_WRITABLE | SDF_PWM_HBRIDGE; - s->n_chan = 8; - /* this defines the max duty cycle resolution */ - s->maxdata = uds->sizePwmBuf; - s->insn_write = usbdux_pwm_write; - s->insn_read = usbdux_pwm_read; - s->insn_config = usbdux_pwm_config; - usbdux_pwm_period(dev, s, PWM_DEFAULT_PERIOD); - } - /* finally decide that it's attached */ - uds->attached = 1; - up(&uds->sem); - offset = usbdux_getstatusinfo(dev, 0); - if (offset < 0) - dev_err(&uds->interface->dev, - "Communication to USBDUXSIGMA failed! Check firmware and cabling."); - dev_info(&uds->interface->dev, - "comedi%d: attached, ADC_zero = %x\n", dev->minor, offset); - return 0; -} - -/* is called for COMEDI_DEVCONFIG ioctl (when comedi_config is run) */ -static int usbduxsigma_attach(struct comedi_device *dev, - struct comedi_devconfig *it) -{ - int ret; - int index; - int i; - void *aux_data; - int aux_len; - - dev->private = NULL; - - aux_data = comedi_aux_data(it->options, 0); - aux_len = it->options[COMEDI_DEVCONF_AUX_DATA_LENGTH]; - if (aux_data == NULL) - aux_len = 0; - else if (aux_len == 0) - aux_data = NULL; - - down(&start_stop_sem); - /* find a valid device which has been detected by the probe function of - * the usb */ - index = -1; - for (i = 0; i < NUMUSBDUX; i++) { - if ((usbduxsub[i].probed) && (!usbduxsub[i].attached)) { - index = i; - break; - } - } - if (index < 0) { - dev_err(dev->class_dev, - "usbduxsigma: error: attach failed, dev not connected to the usb bus.\n"); - up(&start_stop_sem); - ret = -ENODEV; - } else - ret = usbduxsigma_attach_common(dev, &usbduxsub[index], - aux_data, aux_len); - up(&start_stop_sem); - return ret; -} - -/* is called from comedi_usb_auto_config() */ -static int usbduxsigma_attach_usb(struct comedi_device *dev, - struct usb_interface *uinterf) -{ - int ret; - struct usbduxsub *uds; - - dev->private = NULL; - down(&start_stop_sem); - uds = usb_get_intfdata(uinterf); - if (!uds || !uds->probed) { - dev_err(dev->class_dev, - "usbduxsigma: error: attach_usb failed, not connected\n"); - ret = -ENODEV; - } else if (uds->attached) { - dev_err(dev->class_dev, - "usbduxsigma: error: attach_usb failed, already attached\n"); - ret = -ENODEV; - } else - ret = usbduxsigma_attach_common(dev, uds, NULL, 0); - up(&start_stop_sem); - return ret; -} - -static void usbduxsigma_detach(struct comedi_device *dev) -{ - struct usbduxsub *usb = dev->private; - - if (usb) { - down(&usb->sem); - dev->private = NULL; - usb->attached = 0; - usb->comedidev = NULL; - up(&usb->sem); - } -} - -/* main driver struct */ -static struct comedi_driver usbduxsigma_driver = { - .driver_name = "usbduxsigma", - .module = THIS_MODULE, - .attach = usbduxsigma_attach, - .detach = usbduxsigma_detach, - .attach_usb = usbduxsigma_attach_usb, +static const struct usb_device_id usbduxsigma_usb_table[] = { + { USB_DEVICE(0x13d8, 0x0020) }, + { USB_DEVICE(0x13d8, 0x0021) }, + { USB_DEVICE(0x13d8, 0x0022) }, + { } }; +MODULE_DEVICE_TABLE(usb, usbduxsigma_usb_table); -/* Table with the USB-devices */ -static const struct usb_device_id usbduxsigma_table[] = { - {USB_DEVICE(0x13d8, 0x0020)}, - {USB_DEVICE(0x13d8, 0x0021)}, - {USB_DEVICE(0x13d8, 0x0022)}, - {} /* Terminating entry */ -}; - -MODULE_DEVICE_TABLE(usb, usbduxsigma_table); - -/* The usbduxsub-driver */ static struct usb_driver usbduxsigma_usb_driver = { - .name = BOARDNAME, - .probe = usbduxsigma_probe, - .disconnect = usbduxsigma_disconnect, - .id_table = usbduxsigma_table, + .name = "usbduxsigma", + .probe = usbduxsigma_usb_probe, + .disconnect = usbduxsigma_usb_disconnect, + .id_table = usbduxsigma_usb_table, }; module_comedi_usb_driver(usbduxsigma_driver, usbduxsigma_usb_driver); -MODULE_AUTHOR(DRIVER_AUTHOR); -MODULE_DESCRIPTION(DRIVER_DESC); +MODULE_AUTHOR("Bernd Porr, BerndPorr@f2s.com"); +MODULE_DESCRIPTION("Stirling/ITL USB-DUX SIGMA -- Bernd.Porr@f2s.com"); MODULE_LICENSE("GPL"); -- cgit v0.10.2 From 4c8ba916b268d25ad5e2cd7ccb1a886831cde659 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 20 Jun 2012 12:02:28 -0700 Subject: staging: comedi: usbduxfast: refactor init code Refactor the usb driver probe/disconnect and comedi driver attach/ detach to follow the style of the other comedi driver types to improve maintainability. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index 8c8e4ec9..d991158 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c @@ -49,11 +49,6 @@ #include "comedi_fc.h" #include "../comedidev.h" -#define DRIVER_VERSION "v1.0" -#define DRIVER_AUTHOR "Bernd Porr, BerndPorr@f2s.com" -#define DRIVER_DESC "USB-DUXfast, BerndPorr@f2s.com" -#define BOARDNAME "usbduxfast" - /* * timeout for the USB-transfer */ @@ -196,8 +191,6 @@ static struct usbduxfastsub_s usbduxfastsub[NUMUSBDUXFAST]; static DEFINE_SEMAPHORE(start_stop_sem); -static struct comedi_driver usbduxfast_driver; /* see below for initializer */ - /* * bulk transfers to usbduxfast */ @@ -1436,6 +1429,149 @@ static void tidy_up(struct usbduxfastsub_s *udfs) udfs->ai_cmd_running = 0; } +/* common part of attach and attach_usb */ +static int usbduxfast_attach_common(struct comedi_device *dev, + struct usbduxfastsub_s *udfs, + void *aux_data, int aux_len) +{ + int ret; + struct comedi_subdevice *s; + + down(&udfs->sem); + /* pointer back to the corresponding comedi device */ + udfs->comedidev = dev; + /* trying to upload the firmware into the chip */ + if (aux_data) + firmwareUpload(udfs, aux_data, aux_len); + dev->board_name = "usbduxfast"; + ret = comedi_alloc_subdevices(dev, 1); + if (ret) { + up(&udfs->sem); + return ret; + } + /* private structure is also simply the usb-structure */ + dev->private = udfs; + /* the first subdevice is the A/D converter */ + s = dev->subdevices + SUBDEV_AD; + /* + * the URBs get the comedi subdevice which is responsible for reading + * this is the subdevice which reads data + */ + dev->read_subdev = s; + /* the subdevice receives as private structure the usb-structure */ + s->private = NULL; + /* analog input */ + s->type = COMEDI_SUBD_AI; + /* readable and ref is to ground */ + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_CMD_READ; + /* 16 channels */ + s->n_chan = 16; + /* length of the channellist */ + s->len_chanlist = 16; + /* callback functions */ + s->insn_read = usbduxfast_ai_insn_read; + s->do_cmdtest = usbduxfast_ai_cmdtest; + s->do_cmd = usbduxfast_ai_cmd; + s->cancel = usbduxfast_ai_cancel; + /* max value from the A/D converter (12bit+1 bit for overflow) */ + s->maxdata = 0x1000; + /* range table to convert to physical units */ + s->range_table = &range_usbduxfast_ai_range; + /* finally decide that it's attached */ + udfs->attached = 1; + up(&udfs->sem); + dev_info(dev->class_dev, "successfully attached to usbduxfast.\n"); + return 0; +} + +/* is called for COMEDI_DEVCONFIG ioctl (when comedi_config is run) */ +static int usbduxfast_attach(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + int ret; + int index; + int i; + void *aux_data; + int aux_len; + + dev->private = NULL; + + aux_data = comedi_aux_data(it->options, 0); + aux_len = it->options[COMEDI_DEVCONF_AUX_DATA_LENGTH]; + if (aux_data == NULL) + aux_len = 0; + else if (aux_len == 0) + aux_data = NULL; + down(&start_stop_sem); + /* + * find a valid device which has been detected by the + * probe function of the usb + */ + index = -1; + for (i = 0; i < NUMUSBDUXFAST; i++) { + if (usbduxfastsub[i].probed && !usbduxfastsub[i].attached) { + index = i; + break; + } + } + if (index < 0) { + dev_err(dev->class_dev, + "usbduxfast: error: attach failed, no usbduxfast devs connected to the usb bus.\n"); + ret = -ENODEV; + } else + ret = usbduxfast_attach_common(dev, &usbduxfastsub[index], + aux_data, aux_len); + up(&start_stop_sem); + return ret; +} + +/* is called from comedi_usb_auto_config() */ +static int usbduxfast_attach_usb(struct comedi_device *dev, + struct usb_interface *uinterf) +{ + int ret; + struct usbduxfastsub_s *udfs; + + dev->private = NULL; + down(&start_stop_sem); + udfs = usb_get_intfdata(uinterf); + if (!udfs || !udfs->probed) { + dev_err(dev->class_dev, + "usbduxfast: error: attach_usb failed, not connected\n"); + ret = -ENODEV; + } else if (udfs->attached) { + dev_err(dev->class_dev, + "usbduxfast: error: attach_usb failed, already attached\n"); + ret = -ENODEV; + } else + ret = usbduxfast_attach_common(dev, udfs, NULL, 0); + up(&start_stop_sem); + return ret; +} + +static void usbduxfast_detach(struct comedi_device *dev) +{ + struct usbduxfastsub_s *usb = dev->private; + + if (usb) { + down(&usb->sem); + down(&start_stop_sem); + dev->private = NULL; + usb->attached = 0; + usb->comedidev = NULL; + up(&start_stop_sem); + up(&usb->sem); + } +} + +static struct comedi_driver usbduxfast_driver = { + .driver_name = "usbduxfast", + .module = THIS_MODULE, + .attach = usbduxfast_attach, + .detach = usbduxfast_detach, + .attach_usb = usbduxfast_attach_usb, +}; + static void usbduxfast_firmware_request_complete_handler(const struct firmware *fw, void *context) { @@ -1463,11 +1599,8 @@ static void usbduxfast_firmware_request_complete_handler(const struct firmware release_firmware(fw); } -/* - * allocate memory for the urbs and initialise them - */ -static int usbduxfastsub_probe(struct usb_interface *uinterf, - const struct usb_device_id *id) +static int usbduxfast_usb_probe(struct usb_interface *uinterf, + const struct usb_device_id *id) { struct usb_device *udev = interface_to_usbdev(uinterf); int i; @@ -1590,7 +1723,7 @@ static int usbduxfastsub_probe(struct usb_interface *uinterf, return 0; } -static void usbduxfastsub_disconnect(struct usb_interface *intf) +static void usbduxfast_usb_disconnect(struct usb_interface *intf) { struct usbduxfastsub_s *udfs = usb_get_intfdata(intf); struct usb_device *udev = interface_to_usbdev(intf); @@ -1619,175 +1752,25 @@ static void usbduxfastsub_disconnect(struct usb_interface *intf) #endif } -/* common part of attach and attach_usb */ -static int usbduxfast_attach_common(struct comedi_device *dev, - struct usbduxfastsub_s *udfs, - void *aux_data, int aux_len) -{ - int ret; - struct comedi_subdevice *s; - - down(&udfs->sem); - /* pointer back to the corresponding comedi device */ - udfs->comedidev = dev; - /* trying to upload the firmware into the chip */ - if (aux_data) - firmwareUpload(udfs, aux_data, aux_len); - dev->board_name = BOARDNAME; - ret = comedi_alloc_subdevices(dev, 1); - if (ret) { - up(&udfs->sem); - return ret; - } - /* private structure is also simply the usb-structure */ - dev->private = udfs; - /* the first subdevice is the A/D converter */ - s = dev->subdevices + SUBDEV_AD; - /* - * the URBs get the comedi subdevice which is responsible for reading - * this is the subdevice which reads data - */ - dev->read_subdev = s; - /* the subdevice receives as private structure the usb-structure */ - s->private = NULL; - /* analog input */ - s->type = COMEDI_SUBD_AI; - /* readable and ref is to ground */ - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_CMD_READ; - /* 16 channels */ - s->n_chan = 16; - /* length of the channellist */ - s->len_chanlist = 16; - /* callback functions */ - s->insn_read = usbduxfast_ai_insn_read; - s->do_cmdtest = usbduxfast_ai_cmdtest; - s->do_cmd = usbduxfast_ai_cmd; - s->cancel = usbduxfast_ai_cancel; - /* max value from the A/D converter (12bit+1 bit for overflow) */ - s->maxdata = 0x1000; - /* range table to convert to physical units */ - s->range_table = &range_usbduxfast_ai_range; - /* finally decide that it's attached */ - udfs->attached = 1; - up(&udfs->sem); - dev_info(dev->class_dev, "successfully attached to usbduxfast.\n"); - return 0; -} - -/* is called for COMEDI_DEVCONFIG ioctl (when comedi_config is run) */ -static int usbduxfast_attach(struct comedi_device *dev, - struct comedi_devconfig *it) -{ - int ret; - int index; - int i; - void *aux_data; - int aux_len; - - dev->private = NULL; - - aux_data = comedi_aux_data(it->options, 0); - aux_len = it->options[COMEDI_DEVCONF_AUX_DATA_LENGTH]; - if (aux_data == NULL) - aux_len = 0; - else if (aux_len == 0) - aux_data = NULL; - down(&start_stop_sem); - /* - * find a valid device which has been detected by the - * probe function of the usb - */ - index = -1; - for (i = 0; i < NUMUSBDUXFAST; i++) { - if (usbduxfastsub[i].probed && !usbduxfastsub[i].attached) { - index = i; - break; - } - } - if (index < 0) { - dev_err(dev->class_dev, - "usbduxfast: error: attach failed, no usbduxfast devs connected to the usb bus.\n"); - ret = -ENODEV; - } else - ret = usbduxfast_attach_common(dev, &usbduxfastsub[index], - aux_data, aux_len); - up(&start_stop_sem); - return ret; -} - -/* is called from comedi_usb_auto_config() */ -static int usbduxfast_attach_usb(struct comedi_device *dev, - struct usb_interface *uinterf) -{ - int ret; - struct usbduxfastsub_s *udfs; - - dev->private = NULL; - down(&start_stop_sem); - udfs = usb_get_intfdata(uinterf); - if (!udfs || !udfs->probed) { - dev_err(dev->class_dev, - "usbduxfast: error: attach_usb failed, not connected\n"); - ret = -ENODEV; - } else if (udfs->attached) { - dev_err(dev->class_dev, - "usbduxfast: error: attach_usb failed, already attached\n"); - ret = -ENODEV; - } else - ret = usbduxfast_attach_common(dev, udfs, NULL, 0); - up(&start_stop_sem); - return ret; -} - -static void usbduxfast_detach(struct comedi_device *dev) -{ - struct usbduxfastsub_s *usb = dev->private; - - if (usb) { - down(&usb->sem); - down(&start_stop_sem); - dev->private = NULL; - usb->attached = 0; - usb->comedidev = NULL; - up(&start_stop_sem); - up(&usb->sem); - } -} - -/* - * main driver struct - */ -static struct comedi_driver usbduxfast_driver = { - .driver_name = "usbduxfast", - .module = THIS_MODULE, - .attach = usbduxfast_attach, - .detach = usbduxfast_detach, - .attach_usb = usbduxfast_attach_usb, -}; - -/* - * Table with the USB-devices: just now only testing IDs - */ -static const struct usb_device_id usbduxfastsub_table[] = { +static const struct usb_device_id usbduxfast_usb_table[] = { /* { USB_DEVICE(0x4b4, 0x8613) }, testing */ - {USB_DEVICE(0x13d8, 0x0010)}, /* real ID */ - {USB_DEVICE(0x13d8, 0x0011)}, /* real ID */ - {} /* Terminating entry */ + { USB_DEVICE(0x13d8, 0x0010) }, /* real ID */ + { USB_DEVICE(0x13d8, 0x0011) }, /* real ID */ + { } }; - -MODULE_DEVICE_TABLE(usb, usbduxfastsub_table); +MODULE_DEVICE_TABLE(usb, usbduxfast_usb_table); static struct usb_driver usbduxfast_usb_driver = { #ifdef COMEDI_HAVE_USB_DRIVER_OWNER .owner = THIS_MODULE, #endif - .name = BOARDNAME, - .probe = usbduxfastsub_probe, - .disconnect = usbduxfastsub_disconnect, - .id_table = usbduxfastsub_table, + .name = "usbduxfast", + .probe = usbduxfast_usb_probe, + .disconnect = usbduxfast_usb_disconnect, + .id_table = usbduxfast_usb_table, }; module_comedi_usb_driver(usbduxfast_driver, usbduxfast_usb_driver); -MODULE_AUTHOR(DRIVER_AUTHOR); -MODULE_DESCRIPTION(DRIVER_DESC); +MODULE_AUTHOR("Bernd Porr, BerndPorr@f2s.com"); +MODULE_DESCRIPTION("USB-DUXfast, BerndPorr@f2s.com"); MODULE_LICENSE("GPL"); -- cgit v0.10.2 From 3403cc0f701db8a3f1082e5b1027265ee1343b20 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 20 Jun 2012 12:02:49 -0700 Subject: staging: comedi: usbdux: refactor init code Refactor the usb driver probe/disconnect and comedi driver attach/ detach to follow the style of the other comedi driver types to improve maintainability. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 586936b..848c7ec 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -1,6 +1,3 @@ -#define DRIVER_VERSION "v2.4" -#define DRIVER_AUTHOR "Bernd Porr, BerndPorr@f2s.com" -#define DRIVER_DESC "Stirling/ITL USB-DUX -- Bernd.Porr@f2s.com" /* comedi/drivers/usbdux.c Copyright (C) 2003-2007 Bernd Porr, Bernd.Porr@f2s.com @@ -101,8 +98,6 @@ sampling rate. If you sample two channels you get 4kHz and so on. #include "../comedidev.h" -#define BOARDNAME "usbdux" - /* timeout for the USB-transfer in ms*/ #define BULK_TIMEOUT 1000 @@ -317,8 +312,6 @@ static struct usbduxsub usbduxsub[NUMUSBDUX]; static DEFINE_SEMAPHORE(start_stop_sem); -static struct comedi_driver usbdux_driver; /* see below for initializer */ - /* * Stops the data acquision * It should be safe to call this function from any context @@ -2299,6 +2292,231 @@ static void tidy_up(struct usbduxsub *usbduxsub_tmp) usbduxsub_tmp->pwm_cmd_running = 0; } +/* common part of attach and attach_usb */ +static int usbdux_attach_common(struct comedi_device *dev, + struct usbduxsub *udev, + void *aux_data, int aux_len) +{ + int ret; + struct comedi_subdevice *s = NULL; + int n_subdevs; + + down(&udev->sem); + /* pointer back to the corresponding comedi device */ + udev->comedidev = dev; + + /* trying to upload the firmware into the chip */ + if (aux_data) + firmwareUpload(udev, aux_data, aux_len); + + dev->board_name = "usbdux"; + + /* set number of subdevices */ + if (udev->high_speed) { + /* with pwm */ + n_subdevs = 5; + } else { + /* without pwm */ + n_subdevs = 4; + } + + ret = comedi_alloc_subdevices(dev, n_subdevs); + if (ret) { + up(&udev->sem); + return ret; + } + + /* private structure is also simply the usb-structure */ + dev->private = udev; + + /* the first subdevice is the A/D converter */ + s = dev->subdevices + SUBDEV_AD; + /* the URBs get the comedi subdevice */ + /* which is responsible for reading */ + /* this is the subdevice which reads data */ + dev->read_subdev = s; + /* the subdevice receives as private structure the */ + /* usb-structure */ + s->private = NULL; + /* analog input */ + s->type = COMEDI_SUBD_AI; + /* readable and ref is to ground */ + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_CMD_READ; + /* 8 channels */ + s->n_chan = 8; + /* length of the channellist */ + s->len_chanlist = 8; + /* callback functions */ + s->insn_read = usbdux_ai_insn_read; + s->do_cmdtest = usbdux_ai_cmdtest; + s->do_cmd = usbdux_ai_cmd; + s->cancel = usbdux_ai_cancel; + /* max value from the A/D converter (12bit) */ + s->maxdata = 0xfff; + /* range table to convert to physical units */ + s->range_table = (&range_usbdux_ai_range); + + /* analog out */ + s = dev->subdevices + SUBDEV_DA; + /* analog out */ + s->type = COMEDI_SUBD_AO; + /* backward pointer */ + dev->write_subdev = s; + /* the subdevice receives as private structure the */ + /* usb-structure */ + s->private = NULL; + /* are writable */ + s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_CMD_WRITE; + /* 4 channels */ + s->n_chan = 4; + /* length of the channellist */ + s->len_chanlist = 4; + /* 12 bit resolution */ + s->maxdata = 0x0fff; + /* bipolar range */ + s->range_table = (&range_usbdux_ao_range); + /* callback */ + s->do_cmdtest = usbdux_ao_cmdtest; + s->do_cmd = usbdux_ao_cmd; + s->cancel = usbdux_ao_cancel; + s->insn_read = usbdux_ao_insn_read; + s->insn_write = usbdux_ao_insn_write; + + /* digital I/O */ + s = dev->subdevices + SUBDEV_DIO; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = (&range_digital); + s->insn_bits = usbdux_dio_insn_bits; + s->insn_config = usbdux_dio_insn_config; + /* we don't use it */ + s->private = NULL; + + /* counter */ + s = dev->subdevices + SUBDEV_COUNTER; + s->type = COMEDI_SUBD_COUNTER; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE; + s->n_chan = 4; + s->maxdata = 0xFFFF; + s->insn_read = usbdux_counter_read; + s->insn_write = usbdux_counter_write; + s->insn_config = usbdux_counter_config; + + if (udev->high_speed) { + /* timer / pwm */ + s = dev->subdevices + SUBDEV_PWM; + s->type = COMEDI_SUBD_PWM; + s->subdev_flags = SDF_WRITABLE | SDF_PWM_HBRIDGE; + s->n_chan = 8; + /* this defines the max duty cycle resolution */ + s->maxdata = udev->sizePwmBuf; + s->insn_write = usbdux_pwm_write; + s->insn_read = usbdux_pwm_read; + s->insn_config = usbdux_pwm_config; + usbdux_pwm_period(dev, s, PWM_DEFAULT_PERIOD); + } + /* finally decide that it's attached */ + udev->attached = 1; + + up(&udev->sem); + + dev_info(&udev->interface->dev, "comedi%d: attached to usbdux.\n", + dev->minor); + + return 0; +} + +/* is called when comedi-config is called */ +static int usbdux_attach(struct comedi_device *dev, struct comedi_devconfig *it) +{ + int ret; + int index; + int i; + void *aux_data; + int aux_len; + + dev->private = NULL; + + aux_data = comedi_aux_data(it->options, 0); + aux_len = it->options[COMEDI_DEVCONF_AUX_DATA_LENGTH]; + if (aux_data == NULL) + aux_len = 0; + else if (aux_len == 0) + aux_data = NULL; + + down(&start_stop_sem); + /* find a valid device which has been detected by the probe function of + * the usb */ + index = -1; + for (i = 0; i < NUMUSBDUX; i++) { + if ((usbduxsub[i].probed) && (!usbduxsub[i].attached)) { + index = i; + break; + } + } + + if (index < 0) { + printk(KERN_ERR + "comedi%d: usbdux: error: attach failed, no usbdux devs connected to the usb bus.\n", + dev->minor); + ret = -ENODEV; + } else + ret = usbdux_attach_common(dev, &usbduxsub[index], + aux_data, aux_len); + up(&start_stop_sem); + return ret; +} + +/* is called from comedi_usb_auto_config() */ +static int usbdux_attach_usb(struct comedi_device *dev, + struct usb_interface *uinterf) +{ + int ret; + struct usbduxsub *this_usbduxsub; + + dev->private = NULL; + + down(&start_stop_sem); + this_usbduxsub = usb_get_intfdata(uinterf); + if (!this_usbduxsub || !this_usbduxsub->probed) { + printk(KERN_ERR + "comedi%d: usbdux: error: attach_usb failed, not connected\n", + dev->minor); + ret = -ENODEV; + } else if (this_usbduxsub->attached) { + printk(KERN_ERR + "comedi%d: usbdux: error: attach_usb failed, already attached\n", + dev->minor); + ret = -ENODEV; + } else + ret = usbdux_attach_common(dev, this_usbduxsub, NULL, 0); + up(&start_stop_sem); + return ret; +} + +static void usbdux_detach(struct comedi_device *dev) +{ + struct usbduxsub *usb = dev->private; + + if (usb) { + down(&usb->sem); + dev->private = NULL; + usb->attached = 0; + usb->comedidev = NULL; + up(&usb->sem); + } +} + +static struct comedi_driver usbdux_driver = { + .driver_name = "usbdux", + .module = THIS_MODULE, + .attach = usbdux_attach, + .detach = usbdux_detach, + .attach_usb = usbdux_attach_usb, +}; + static void usbdux_firmware_request_complete_handler(const struct firmware *fw, void *context) { @@ -2328,9 +2546,8 @@ static void usbdux_firmware_request_complete_handler(const struct firmware *fw, release_firmware(fw); } -/* allocate memory for the urbs and initialise them */ -static int usbduxsub_probe(struct usb_interface *uinterf, - const struct usb_device_id *id) +static int usbdux_usb_probe(struct usb_interface *uinterf, + const struct usb_device_id *id) { struct usb_device *udev = interface_to_usbdev(uinterf); struct device *dev = &uinterf->dev; @@ -2591,7 +2808,7 @@ static int usbduxsub_probe(struct usb_interface *uinterf, return 0; } -static void usbduxsub_disconnect(struct usb_interface *intf) +static void usbdux_usb_disconnect(struct usb_interface *intf) { struct usbduxsub *usbduxsub_tmp = usb_get_intfdata(intf); struct usb_device *udev = interface_to_usbdev(intf); @@ -2614,249 +2831,22 @@ static void usbduxsub_disconnect(struct usb_interface *intf) dev_dbg(&intf->dev, "comedi_: disconnected from the usb\n"); } -/* common part of attach and attach_usb */ -static int usbdux_attach_common(struct comedi_device *dev, - struct usbduxsub *udev, - void *aux_data, int aux_len) -{ - int ret; - struct comedi_subdevice *s = NULL; - int n_subdevs; - - down(&udev->sem); - /* pointer back to the corresponding comedi device */ - udev->comedidev = dev; - - /* trying to upload the firmware into the chip */ - if (aux_data) - firmwareUpload(udev, aux_data, aux_len); - - dev->board_name = BOARDNAME; - - /* set number of subdevices */ - if (udev->high_speed) { - /* with pwm */ - n_subdevs = 5; - } else { - /* without pwm */ - n_subdevs = 4; - } - - ret = comedi_alloc_subdevices(dev, n_subdevs); - if (ret) { - up(&udev->sem); - return ret; - } - - /* private structure is also simply the usb-structure */ - dev->private = udev; - - /* the first subdevice is the A/D converter */ - s = dev->subdevices + SUBDEV_AD; - /* the URBs get the comedi subdevice */ - /* which is responsible for reading */ - /* this is the subdevice which reads data */ - dev->read_subdev = s; - /* the subdevice receives as private structure the */ - /* usb-structure */ - s->private = NULL; - /* analog input */ - s->type = COMEDI_SUBD_AI; - /* readable and ref is to ground */ - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_CMD_READ; - /* 8 channels */ - s->n_chan = 8; - /* length of the channellist */ - s->len_chanlist = 8; - /* callback functions */ - s->insn_read = usbdux_ai_insn_read; - s->do_cmdtest = usbdux_ai_cmdtest; - s->do_cmd = usbdux_ai_cmd; - s->cancel = usbdux_ai_cancel; - /* max value from the A/D converter (12bit) */ - s->maxdata = 0xfff; - /* range table to convert to physical units */ - s->range_table = (&range_usbdux_ai_range); - - /* analog out */ - s = dev->subdevices + SUBDEV_DA; - /* analog out */ - s->type = COMEDI_SUBD_AO; - /* backward pointer */ - dev->write_subdev = s; - /* the subdevice receives as private structure the */ - /* usb-structure */ - s->private = NULL; - /* are writable */ - s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_CMD_WRITE; - /* 4 channels */ - s->n_chan = 4; - /* length of the channellist */ - s->len_chanlist = 4; - /* 12 bit resolution */ - s->maxdata = 0x0fff; - /* bipolar range */ - s->range_table = (&range_usbdux_ao_range); - /* callback */ - s->do_cmdtest = usbdux_ao_cmdtest; - s->do_cmd = usbdux_ao_cmd; - s->cancel = usbdux_ao_cancel; - s->insn_read = usbdux_ao_insn_read; - s->insn_write = usbdux_ao_insn_write; - - /* digital I/O */ - s = dev->subdevices + SUBDEV_DIO; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = (&range_digital); - s->insn_bits = usbdux_dio_insn_bits; - s->insn_config = usbdux_dio_insn_config; - /* we don't use it */ - s->private = NULL; - - /* counter */ - s = dev->subdevices + SUBDEV_COUNTER; - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = 4; - s->maxdata = 0xFFFF; - s->insn_read = usbdux_counter_read; - s->insn_write = usbdux_counter_write; - s->insn_config = usbdux_counter_config; - - if (udev->high_speed) { - /* timer / pwm */ - s = dev->subdevices + SUBDEV_PWM; - s->type = COMEDI_SUBD_PWM; - s->subdev_flags = SDF_WRITABLE | SDF_PWM_HBRIDGE; - s->n_chan = 8; - /* this defines the max duty cycle resolution */ - s->maxdata = udev->sizePwmBuf; - s->insn_write = usbdux_pwm_write; - s->insn_read = usbdux_pwm_read; - s->insn_config = usbdux_pwm_config; - usbdux_pwm_period(dev, s, PWM_DEFAULT_PERIOD); - } - /* finally decide that it's attached */ - udev->attached = 1; - - up(&udev->sem); - - dev_info(&udev->interface->dev, "comedi%d: attached to usbdux.\n", - dev->minor); - - return 0; -} - -/* is called when comedi-config is called */ -static int usbdux_attach(struct comedi_device *dev, struct comedi_devconfig *it) -{ - int ret; - int index; - int i; - void *aux_data; - int aux_len; - - dev->private = NULL; - - aux_data = comedi_aux_data(it->options, 0); - aux_len = it->options[COMEDI_DEVCONF_AUX_DATA_LENGTH]; - if (aux_data == NULL) - aux_len = 0; - else if (aux_len == 0) - aux_data = NULL; - - down(&start_stop_sem); - /* find a valid device which has been detected by the probe function of - * the usb */ - index = -1; - for (i = 0; i < NUMUSBDUX; i++) { - if ((usbduxsub[i].probed) && (!usbduxsub[i].attached)) { - index = i; - break; - } - } - - if (index < 0) { - printk(KERN_ERR - "comedi%d: usbdux: error: attach failed, no usbdux devs connected to the usb bus.\n", - dev->minor); - ret = -ENODEV; - } else - ret = usbdux_attach_common(dev, &usbduxsub[index], - aux_data, aux_len); - up(&start_stop_sem); - return ret; -} - -/* is called from comedi_usb_auto_config() */ -static int usbdux_attach_usb(struct comedi_device *dev, - struct usb_interface *uinterf) -{ - int ret; - struct usbduxsub *this_usbduxsub; - - dev->private = NULL; - - down(&start_stop_sem); - this_usbduxsub = usb_get_intfdata(uinterf); - if (!this_usbduxsub || !this_usbduxsub->probed) { - printk(KERN_ERR - "comedi%d: usbdux: error: attach_usb failed, not connected\n", - dev->minor); - ret = -ENODEV; - } else if (this_usbduxsub->attached) { - printk(KERN_ERR - "comedi%d: usbdux: error: attach_usb failed, already attached\n", - dev->minor); - ret = -ENODEV; - } else - ret = usbdux_attach_common(dev, this_usbduxsub, NULL, 0); - up(&start_stop_sem); - return ret; -} - -static void usbdux_detach(struct comedi_device *dev) -{ - struct usbduxsub *usb = dev->private; - - if (usb) { - down(&usb->sem); - dev->private = NULL; - usb->attached = 0; - usb->comedidev = NULL; - up(&usb->sem); - } -} - -/* main driver struct */ -static struct comedi_driver usbdux_driver = { - .driver_name = "usbdux", - .module = THIS_MODULE, - .attach = usbdux_attach, - .detach = usbdux_detach, - .attach_usb = usbdux_attach_usb, -}; - -/* Table with the USB-devices: just now only testing IDs */ -static const struct usb_device_id usbduxsub_table[] = { - {USB_DEVICE(0x13d8, 0x0001)}, - {USB_DEVICE(0x13d8, 0x0002)}, - {} /* Terminating entry */ +static const struct usb_device_id usbdux_usb_table[] = { + { USB_DEVICE(0x13d8, 0x0001) }, + { USB_DEVICE(0x13d8, 0x0002) }, + { } }; -MODULE_DEVICE_TABLE(usb, usbduxsub_table); +MODULE_DEVICE_TABLE(usb, usbdux_usb_table); static struct usb_driver usbdux_usb_driver = { - .name = BOARDNAME, - .probe = usbduxsub_probe, - .disconnect = usbduxsub_disconnect, - .id_table = usbduxsub_table, + .name = "usbdux", + .probe = usbdux_usb_probe, + .disconnect = usbdux_usb_disconnect, + .id_table = usbdux_usb_table, }; module_comedi_usb_driver(usbdux_driver, usbdux_usb_driver); -MODULE_AUTHOR(DRIVER_AUTHOR); -MODULE_DESCRIPTION(DRIVER_DESC); +MODULE_AUTHOR("Bernd Porr, BerndPorr@f2s.com"); +MODULE_DESCRIPTION("Stirling/ITL USB-DUX -- Bernd.Porr@f2s.com"); MODULE_LICENSE("GPL"); -- cgit v0.10.2 From 33e6ada17fffc54c24607d5acb279363b30ac401 Mon Sep 17 00:00:00 2001 From: Rupesh Gujare Date: Wed, 20 Jun 2012 13:36:06 +0100 Subject: staging: ozwpan: ISOC transfer in triggered mode This patch implements ISOC frame transfer while PD is in triggered mode. Signed-off-by: Rupesh Gujare Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ozwpan/ozmain.c b/drivers/staging/ozwpan/ozmain.c index 7579645..c1ed6b2 100644 --- a/drivers/staging/ozwpan/ozmain.c +++ b/drivers/staging/ozwpan/ozmain.c @@ -59,6 +59,6 @@ module_exit(ozwpan_exit); MODULE_AUTHOR("Chris Kelly"); MODULE_DESCRIPTION("Ozmo Devices USB over WiFi hcd driver"); -MODULE_VERSION("1.0.9"); +MODULE_VERSION("1.0.10"); MODULE_LICENSE("GPL"); diff --git a/drivers/staging/ozwpan/ozpd.c b/drivers/staging/ozwpan/ozpd.c index 04cd57f..6c566f5 100644 --- a/drivers/staging/ozwpan/ozpd.c +++ b/drivers/staging/ozwpan/ozpd.c @@ -24,18 +24,22 @@ /*------------------------------------------------------------------------------ */ #define OZ_MAX_TX_POOL_SIZE 6 -/* Maximum number of uncompleted isoc frames that can be pending. +/* Maximum number of uncompleted isoc frames that can be pending in network. */ #define OZ_MAX_SUBMITTED_ISOC 16 +/* Maximum number of uncompleted isoc frames that can be pending in Tx Queue. + */ +#define OZ_MAX_TX_QUEUE_ISOC 32 /*------------------------------------------------------------------------------ */ static struct oz_tx_frame *oz_tx_frame_alloc(struct oz_pd *pd); static void oz_tx_frame_free(struct oz_pd *pd, struct oz_tx_frame *f); +static void oz_tx_isoc_free(struct oz_pd *pd, struct oz_tx_frame *f); static struct sk_buff *oz_build_frame(struct oz_pd *pd, struct oz_tx_frame *f); static int oz_send_isoc_frame(struct oz_pd *pd); static void oz_retire_frame(struct oz_pd *pd, struct oz_tx_frame *f); static void oz_isoc_stream_free(struct oz_isoc_stream *st); -static int oz_send_next_queued_frame(struct oz_pd *pd, int *more_data); +static int oz_send_next_queued_frame(struct oz_pd *pd, int more_data); static void oz_isoc_destructor(struct sk_buff *skb); static int oz_def_app_init(void); static void oz_def_app_term(void); @@ -208,6 +212,8 @@ void oz_pd_destroy(struct oz_pd *pd) while (e != &pd->tx_queue) { f = container_of(e, struct oz_tx_frame, link); e = e->next; + if (f->skb != NULL) + kfree_skb(f->skb); oz_retire_frame(pd, f); } oz_elt_buf_term(&pd->elt_buff); @@ -375,6 +381,23 @@ static struct oz_tx_frame *oz_tx_frame_alloc(struct oz_pd *pd) /*------------------------------------------------------------------------------ * Context: softirq or process */ +static void oz_tx_isoc_free(struct oz_pd *pd, struct oz_tx_frame *f) +{ + pd->nb_queued_isoc_frames--; + list_del_init(&f->link); + if (pd->tx_pool_count < OZ_MAX_TX_POOL_SIZE) { + f->link.next = pd->tx_pool; + pd->tx_pool = &f->link; + pd->tx_pool_count++; + } else { + kfree(f); + } + oz_trace2(OZ_TRACE_TX_FRAMES, "Releasing ISOC Frame isoc_nb= %d\n", + pd->nb_queued_isoc_frames); +} +/*------------------------------------------------------------------------------ + * Context: softirq or process + */ static void oz_tx_frame_free(struct oz_pd *pd, struct oz_tx_frame *f) { spin_lock_bh(&pd->tx_frame_lock); @@ -389,6 +412,14 @@ static void oz_tx_frame_free(struct oz_pd *pd, struct oz_tx_frame *f) kfree(f); } /*------------------------------------------------------------------------------ + * Context: softirq-serialized + */ +void oz_set_more_bit(struct sk_buff *skb) +{ + struct oz_hdr *oz_hdr = (struct oz_hdr *)skb_network_header(skb); + oz_hdr->control |= OZ_F_MORE_DATA; +} +/*------------------------------------------------------------------------------ * Context: softirq */ int oz_prepare_frame(struct oz_pd *pd, int empty) @@ -403,6 +434,7 @@ int oz_prepare_frame(struct oz_pd *pd, int empty) f = oz_tx_frame_alloc(pd); if (f == 0) return -1; + f->skb = NULL; f->hdr.control = (OZ_PROTOCOL_VERSION<last_tx_pkt_num; @@ -486,24 +518,51 @@ static void oz_retire_frame(struct oz_pd *pd, struct oz_tx_frame *f) /*------------------------------------------------------------------------------ * Context: softirq-serialized */ -static int oz_send_next_queued_frame(struct oz_pd *pd, int *more_data) +static int oz_send_next_queued_frame(struct oz_pd *pd, int more_data) { struct sk_buff *skb; struct oz_tx_frame *f; struct list_head *e; - *more_data = 0; spin_lock(&pd->tx_frame_lock); e = pd->last_sent_frame->next; if (e == &pd->tx_queue) { spin_unlock(&pd->tx_frame_lock); return -1; } - pd->last_sent_frame = e; - if (e->next != &pd->tx_queue) - *more_data = 1; f = container_of(e, struct oz_tx_frame, link); + + if (f->skb != NULL) { + skb = f->skb; + oz_tx_isoc_free(pd, f); + spin_unlock(&pd->tx_frame_lock); + if (more_data) + oz_set_more_bit(skb); + if ((int)atomic_read(&g_submitted_isoc) < + OZ_MAX_SUBMITTED_ISOC) { + if (dev_queue_xmit(skb) < 0) { + oz_trace2(OZ_TRACE_TX_FRAMES, + "Dropping ISOC Frame\n"); + oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, 0, 0); + return -1; + } + atomic_inc(&g_submitted_isoc); + oz_trace2(OZ_TRACE_TX_FRAMES, + "Sending ISOC Frame, nb_isoc= %d\n", + pd->nb_queued_isoc_frames); + return 0; + } else { + kfree_skb(skb); + oz_trace2(OZ_TRACE_TX_FRAMES, "Dropping ISOC Frame>\n"); + oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, 0, 0); + return -1; + } + } + + pd->last_sent_frame = e; skb = oz_build_frame(pd, f); spin_unlock(&pd->tx_frame_lock); + if (more_data) + oz_set_more_bit(skb); oz_trace2(OZ_TRACE_TX_FRAMES, "TX frame PN=0x%x\n", f->hdr.pkt_num); if (skb) { oz_event_log(OZ_EVT_TX_FRAME, @@ -512,6 +571,7 @@ static int oz_send_next_queued_frame(struct oz_pd *pd, int *more_data) 0, f->hdr.pkt_num); if (dev_queue_xmit(skb) < 0) return -1; + } return 0; } @@ -520,21 +580,38 @@ static int oz_send_next_queued_frame(struct oz_pd *pd, int *more_data) */ void oz_send_queued_frames(struct oz_pd *pd, int backlog) { - int more; - if (backlog < OZ_MAX_QUEUED_FRAMES) { - if (oz_send_next_queued_frame(pd, &more) >= 0) { - while (more && oz_send_next_queued_frame(pd, &more)) - ; - } else { - if (((pd->mode & OZ_F_ISOC_ANYTIME) == 0) - || (pd->isoc_sent == 0)) { - if (oz_prepare_frame(pd, 1) >= 0) - oz_send_next_queued_frame(pd, &more); - } + while (oz_prepare_frame(pd, 0) >= 0) + backlog++; + + switch (pd->mode & (OZ_F_ISOC_NO_ELTS | OZ_F_ISOC_ANYTIME)) { + + case OZ_F_ISOC_NO_ELTS: { + backlog += pd->nb_queued_isoc_frames; + if (backlog <= 0) + goto out; + if (backlog > OZ_MAX_SUBMITTED_ISOC) + backlog = OZ_MAX_SUBMITTED_ISOC; + break; } - } else { - oz_send_next_queued_frame(pd, &more); + case OZ_NO_ELTS_ANYTIME: { + if ((backlog <= 0) && (pd->isoc_sent == 0)) + goto out; + break; + } + default: { + if (backlog <= 0) + goto out; + break; + } + } + while (backlog--) { + if (oz_send_next_queued_frame(pd, backlog) < 0) + break; } + return; + +out: oz_prepare_frame(pd, 1); + oz_send_next_queued_frame(pd, 0); } /*------------------------------------------------------------------------------ * Context: softirq @@ -603,8 +680,10 @@ void oz_retire_tx_frames(struct oz_pd *pd, u8 lpn) f = container_of(e, struct oz_tx_frame, link); pkt_num = le32_to_cpu(get_unaligned(&f->hdr.pkt_num)); diff = (lpn - (pkt_num & OZ_LAST_PN_MASK)) & OZ_LAST_PN_MASK; - if (diff > OZ_LAST_PN_HALF_CYCLE) + if ((diff > OZ_LAST_PN_HALF_CYCLE) || (pkt_num == 0)) break; + oz_trace2(OZ_TRACE_TX_FRAMES, "Releasing pkt_num= %u, nb= %d\n", + pkt_num, pd->nb_queued_frames); if (first == 0) first = e; last = e; @@ -756,21 +835,53 @@ int oz_send_isoc_unit(struct oz_pd *pd, u8 ep_num, u8 *data, int len) memcpy(oz_hdr, &oz, sizeof(oz)); memcpy(oz_hdr+1, &iso, sizeof(iso)); if (dev_hard_header(skb, dev, OZ_ETHERTYPE, pd->mac_addr, - dev->dev_addr, skb->len) < 0) { - kfree_skb(skb); - return -1; + dev->dev_addr, skb->len) < 0) + goto out; + + skb->destructor = oz_isoc_destructor; + /*Queue for Xmit if mode is not ANYTIME*/ + if (!(pd->mode & OZ_F_ISOC_ANYTIME)) { + struct oz_tx_frame *isoc_unit = NULL; + int nb = pd->nb_queued_isoc_frames; + if (nb >= OZ_MAX_TX_QUEUE_ISOC) { + oz_trace2(OZ_TRACE_TX_FRAMES, + "Dropping ISOC Unit nb= %d\n", + nb); + goto out; + } + isoc_unit = oz_tx_frame_alloc(pd); + if (isoc_unit == NULL) + goto out; + isoc_unit->hdr = oz; + isoc_unit->skb = skb; + spin_lock_bh(&pd->tx_frame_lock); + list_add_tail(&isoc_unit->link, &pd->tx_queue); + pd->nb_queued_isoc_frames++; + spin_unlock_bh(&pd->tx_frame_lock); + oz_trace2(OZ_TRACE_TX_FRAMES, + "Added ISOC Frame to Tx Queue isoc_nb= %d, nb= %d\n", + pd->nb_queued_isoc_frames, pd->nb_queued_frames); + oz_event_log(OZ_EVT_TX_ISOC, nb_units, iso.frame_number, + skb, atomic_read(&g_submitted_isoc)); + return 0; } + + /*In ANYTIME mode Xmit unit immediately*/ if (atomic_read(&g_submitted_isoc) < OZ_MAX_SUBMITTED_ISOC) { - skb->destructor = oz_isoc_destructor; atomic_inc(&g_submitted_isoc); oz_event_log(OZ_EVT_TX_ISOC, nb_units, iso.frame_number, - skb, atomic_read(&g_submitted_isoc)); - if (dev_queue_xmit(skb) < 0) + skb, atomic_read(&g_submitted_isoc)); + if (dev_queue_xmit(skb) < 0) { + oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, 0, 0); return -1; - } else { - oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, 0, 0); - kfree_skb(skb); + } else + return 0; } + +out: oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, 0, 0); + kfree_skb(skb); + return -1; + } return 0; } diff --git a/drivers/staging/ozwpan/ozpd.h b/drivers/staging/ozwpan/ozpd.h index afc77f0..ddf1341 100644 --- a/drivers/staging/ozwpan/ozpd.h +++ b/drivers/staging/ozwpan/ozpd.h @@ -29,6 +29,7 @@ struct oz_tx_frame { struct list_head link; struct list_head elt_list; struct oz_hdr hdr; + struct sk_buff *skb; int total_size; }; @@ -83,6 +84,7 @@ struct oz_pd { u8 ms_per_isoc; unsigned max_stream_buffering; int nb_queued_frames; + int nb_queued_isoc_frames; struct list_head *tx_pool; int tx_pool_count; spinlock_t tx_frame_lock; @@ -118,4 +120,3 @@ void oz_apps_init(void); void oz_apps_term(void); #endif /* Sentry */ - diff --git a/drivers/staging/ozwpan/ozproto.c b/drivers/staging/ozwpan/ozproto.c index ad857ee..502e18a 100644 --- a/drivers/staging/ozwpan/ozproto.c +++ b/drivers/staging/ozwpan/ozproto.c @@ -217,7 +217,6 @@ static struct oz_pd *oz_connect_req(struct oz_pd *cur_pd, struct oz_elt *elt, pd->mode = body->mode; pd->pd_info = body->pd_info; if (pd->mode & OZ_F_ISOC_NO_ELTS) { - pd->mode |= OZ_F_ISOC_ANYTIME; pd->ms_per_isoc = body->ms_per_isoc; if (!pd->ms_per_isoc) pd->ms_per_isoc = 4; @@ -366,6 +365,7 @@ static void oz_rx_frame(struct sk_buff *skb) } if (pd && !dup && ((pd->mode & OZ_MODE_MASK) == OZ_MODE_TRIGGERED)) { + oz_trace2(OZ_TRACE_RX_FRAMES, "Received TRIGGER Frame\n"); pd->last_sent_frame = &pd->tx_queue; if (oz_hdr->control & OZ_F_ACK) { /* Retire completed frames */ @@ -376,8 +376,6 @@ static void oz_rx_frame(struct sk_buff *skb) int backlog = pd->nb_queued_frames; pd->trigger_pkt_num = pkt_num; /* Send queued frames */ - while (oz_prepare_frame(pd, 0) >= 0) - ; oz_send_queued_frames(pd, backlog); } } diff --git a/drivers/staging/ozwpan/ozprotocol.h b/drivers/staging/ozwpan/ozprotocol.h index b3e7d77..1e4edbe 100644 --- a/drivers/staging/ozwpan/ozprotocol.h +++ b/drivers/staging/ozwpan/ozprotocol.h @@ -89,6 +89,7 @@ struct oz_elt_connect_req { #define OZ_MODE_MASK 0xf #define OZ_F_ISOC_NO_ELTS 0x40 #define OZ_F_ISOC_ANYTIME 0x80 +#define OZ_NO_ELTS_ANYTIME 0xc0 /* Keep alive field. */ -- cgit v0.10.2 From df49093ae499882cb9cfb29f80f6abb10ae51d74 Mon Sep 17 00:00:00 2001 From: Rupesh Gujare Date: Wed, 20 Jun 2012 13:36:07 +0100 Subject: staging: ozwpan: Correct ioctl numbers. ioctl numbers were not in order, rearranging them in ascending order. Signed-off-by: Rupesh Gujare Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ozwpan/ozappif.h b/drivers/staging/ozwpan/ozappif.h index 1b59b07..449a6ba 100644 --- a/drivers/staging/ozwpan/ozappif.h +++ b/drivers/staging/ozwpan/ozappif.h @@ -30,9 +30,9 @@ struct oz_binding_info { #define OZ_IOCTL_GET_PD_LIST _IOR(OZ_IOCTL_MAGIC, 0, struct oz_pd_list) #define OZ_IOCTL_SET_ACTIVE_PD _IOW(OZ_IOCTL_MAGIC, 1, struct oz_mac_addr) #define OZ_IOCTL_GET_ACTIVE_PD _IOR(OZ_IOCTL_MAGIC, 2, struct oz_mac_addr) -#define OZ_IOCTL_ADD_BINDING _IOW(OZ_IOCTL_MAGIC, 5, struct oz_binding_info) -#define OZ_IOCTL_REMOVE_BINDING _IOW(OZ_IOCTL_MAGIC, 8, struct oz_binding_info) -#define OZ_IOCTL_MAX 9 +#define OZ_IOCTL_ADD_BINDING _IOW(OZ_IOCTL_MAGIC, 3, struct oz_binding_info) +#define OZ_IOCTL_REMOVE_BINDING _IOW(OZ_IOCTL_MAGIC, 4, struct oz_binding_info) +#define OZ_IOCTL_MAX 5 #endif /* _OZAPPIF_H */ -- cgit v0.10.2 From fec9f24b6269dc5fb4b1212a970c089461ec7ff2 Mon Sep 17 00:00:00 2001 From: Rupesh Gujare Date: Wed, 20 Jun 2012 13:36:08 +0100 Subject: staging: ozwpan: kmalloc flag Pass right flag as memory is assigned in process context. Signed-off-by: Rupesh Gujare Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ozwpan/ozproto.c b/drivers/staging/ozwpan/ozproto.c index 502e18a..a50ab18 100644 --- a/drivers/staging/ozwpan/ozproto.c +++ b/drivers/staging/ozwpan/ozproto.c @@ -794,7 +794,7 @@ void oz_binding_add(char *net_dev) { struct oz_binding *binding; - binding = kmalloc(sizeof(struct oz_binding), GFP_ATOMIC); + binding = kmalloc(sizeof(struct oz_binding), GFP_KERNEL); if (binding) { binding->ptype.type = __constant_htons(OZ_ETHERTYPE); binding->ptype.func = oz_pkt_recv; -- cgit v0.10.2 From 00ec12b827d2f99202e0c9d804514aef2febf8d6 Mon Sep 17 00:00:00 2001 From: Rupesh Gujare Date: Wed, 20 Jun 2012 13:36:09 +0100 Subject: staging: ozwpan: set last_pkt_nb In case of trigeered ISOC mode set last_pkt_nb only when we are ready to send data. Signed-off-by: Rupesh Gujare Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ozwpan/ozpd.c b/drivers/staging/ozwpan/ozpd.c index 6c566f5..25a8a08 100644 --- a/drivers/staging/ozwpan/ozpd.c +++ b/drivers/staging/ozwpan/ozpd.c @@ -420,6 +420,14 @@ void oz_set_more_bit(struct sk_buff *skb) oz_hdr->control |= OZ_F_MORE_DATA; } /*------------------------------------------------------------------------------ + * Context: softirq-serialized + */ +void oz_set_last_pkt_nb(struct oz_pd *pd, struct sk_buff *skb) +{ + struct oz_hdr *oz_hdr = (struct oz_hdr *)skb_network_header(skb); + oz_hdr->last_pkt_num = pd->trigger_pkt_num & OZ_LAST_PN_MASK; +} +/*------------------------------------------------------------------------------ * Context: softirq */ int oz_prepare_frame(struct oz_pd *pd, int empty) @@ -537,6 +545,7 @@ static int oz_send_next_queued_frame(struct oz_pd *pd, int more_data) spin_unlock(&pd->tx_frame_lock); if (more_data) oz_set_more_bit(skb); + oz_set_last_pkt_nb(pd, skb); if ((int)atomic_read(&g_submitted_isoc) < OZ_MAX_SUBMITTED_ISOC) { if (dev_queue_xmit(skb) < 0) { -- cgit v0.10.2 From 6261c1ee6c84290ff89cc2271b9ec634006e53b7 Mon Sep 17 00:00:00 2001 From: Rupesh Gujare Date: Wed, 20 Jun 2012 13:36:10 +0100 Subject: staging: ozwpan: udev support Register ozmo_wpan class with sysfs & support for udev to create device node. Signed-off-by: Rupesh Gujare Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ozwpan/ozcdev.c b/drivers/staging/ozwpan/ozcdev.c index 27325f7..929756a 100644 --- a/drivers/staging/ozwpan/ozcdev.c +++ b/drivers/staging/ozwpan/ozcdev.c @@ -330,10 +330,12 @@ const struct file_operations oz_fops = { int oz_cdev_register(void) { int err; + struct class *cl; + struct device *dev; memset(&g_cdev, 0, sizeof(g_cdev)); err = alloc_chrdev_region(&g_cdev.devnum, 0, 1, "ozwpan"); if (err < 0) - return err; + goto out3; oz_trace("Alloc dev number %d:%d\n", MAJOR(g_cdev.devnum), MINOR(g_cdev.devnum)); cdev_init(&g_cdev.cdev, &oz_fops); @@ -342,7 +344,27 @@ int oz_cdev_register(void) spin_lock_init(&g_cdev.lock); init_waitqueue_head(&g_cdev.rdq); err = cdev_add(&g_cdev.cdev, g_cdev.devnum, 1); + if (err < 0) { + oz_trace("Failed to add cdev\n"); + goto out2; + } + cl = class_create(THIS_MODULE, "ozmo_wpan"); + if (IS_ERR(cl)) { + oz_trace("Failed to register ozmo_wpan class\n"); + goto out1; + } + dev = device_create(cl, NULL, g_cdev.devnum, NULL, "ozwpan"); + if (IS_ERR(dev)) { + oz_trace("Failed to create sysfs entry for cdev\n"); + goto out1; + } return 0; +out1: + cdev_del(&g_cdev.cdev); +out2: + unregister_chrdev_region(g_cdev.devnum, 1); +out3: + return err; } /*------------------------------------------------------------------------------ * Context: process -- cgit v0.10.2 From 86c948b4416b4c2c064d6c7e15476afbc04e2bf5 Mon Sep 17 00:00:00 2001 From: Rupesh Gujare Date: Wed, 20 Jun 2012 13:36:11 +0100 Subject: staging: ozwpan: Set AC_VO priority Set packet priority to AC_VO for audio data. Signed-off-by: Rupesh Gujare Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ozwpan/ozpd.c b/drivers/staging/ozwpan/ozpd.c index 25a8a08..6c287ac 100644 --- a/drivers/staging/ozwpan/ozpd.c +++ b/drivers/staging/ozwpan/ozpd.c @@ -815,6 +815,8 @@ int oz_send_isoc_unit(struct oz_pd *pd, u8 ep_num, u8 *data, int len) skb_reset_network_header(skb); skb->dev = dev; skb->protocol = htons(OZ_ETHERTYPE); + /* For audio packet set priority to AC_VO */ + skb->priority = 0x7; size = sizeof(struct oz_hdr) + sizeof(struct oz_isoc_large); oz_hdr = (struct oz_hdr *)skb_put(skb, size); } -- cgit v0.10.2 From b10c0b92caf97e0d7f1d76996f73bf07a719aa3e Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Tue, 19 Jun 2012 18:15:25 +0530 Subject: staging/ft1000: Return -ENOMEM if kmalloc fails at ft1000_probe If the kmalloc fails return -ENOMEM , returning 0 is not the proper way if any function fails Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c index 84c38d5..a07c504 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c @@ -71,7 +71,7 @@ static int ft1000_probe(struct usb_interface *interface, if (!ft1000dev) { printk(KERN_ERR "out of memory allocating device structure\n"); - return 0; + return -ENOMEM; } memset(ft1000dev, 0, sizeof(*ft1000dev)); -- cgit v0.10.2 From 42ad4a8da587792df050748cadfb433cd67a1cad Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Tue, 19 Jun 2012 21:52:38 +0530 Subject: staging/ft1000: use kzalloc to allocate the ft1000_device structure with kzalloc the allocate memory is set to zero, so no need of calling memset again on the allocated memory Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c index a07c504..bfead67 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c @@ -67,15 +67,13 @@ static int ft1000_probe(struct usb_interface *interface, struct ft1000_info *pft1000info = NULL; const struct firmware *dsp_fw; - ft1000dev = kmalloc(sizeof(struct ft1000_device), GFP_KERNEL); + ft1000dev = kzalloc(sizeof(struct ft1000_device), GFP_KERNEL); if (!ft1000dev) { printk(KERN_ERR "out of memory allocating device structure\n"); return -ENOMEM; } - memset(ft1000dev, 0, sizeof(*ft1000dev)); - dev = interface_to_usbdev(interface); DEBUG("ft1000_probe: usb device descriptor info:\n"); DEBUG("ft1000_probe: number of configuration is %d\n", -- cgit v0.10.2 From 06e34dfb8567585eed11ab39fc2a39192b66500d Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Tue, 19 Jun 2012 21:53:32 +0530 Subject: staging/ft1000: remove usage of ret in ft1000_open remove the ret and do a simple "return ft1000_submit_rx_urb" Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c index 43b1d36..c1f4f13 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c @@ -1178,7 +1178,6 @@ static int ft1000_open(struct net_device *dev) { struct ft1000_info *pInfo = netdev_priv(dev); struct timeval tv; - int ret; DEBUG("ft1000_open is called for card %d\n", pInfo->CardNumber); @@ -1194,9 +1193,7 @@ static int ft1000_open(struct net_device *dev) netif_carrier_on(dev); - ret = ft1000_submit_rx_urb(pInfo); - - return ret; + return ft1000_submit_rx_urb(pInfo); } //--------------------------------------------------------------------------- -- cgit v0.10.2 From 3a658a47f434aae566fd679c33267e733442ba29 Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Tue, 19 Jun 2012 20:14:52 -0400 Subject: Staging: bcm: Replace INT with int in nvm.c This patch replaces all uppercase INT with lowercase int. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/nvm.c b/drivers/staging/bcm/nvm.c index ed23165..b5b9e93 100644 --- a/drivers/staging/bcm/nvm.c +++ b/drivers/staging/bcm/nvm.c @@ -2,54 +2,54 @@ #define DWORD unsigned int -static INT BcmDoChipSelect(struct bcm_mini_adapter *Adapter, UINT offset); -static INT BcmGetActiveDSD(struct bcm_mini_adapter *Adapter); -static INT BcmGetActiveISO(struct bcm_mini_adapter *Adapter); +static int BcmDoChipSelect(struct bcm_mini_adapter *Adapter, UINT offset); +static int BcmGetActiveDSD(struct bcm_mini_adapter *Adapter); +static int BcmGetActiveISO(struct bcm_mini_adapter *Adapter); static UINT BcmGetEEPROMSize(struct bcm_mini_adapter *Adapter); -static INT BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter); +static int BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter); static UINT BcmGetFlashSectorSize(struct bcm_mini_adapter *Adapter, UINT FlashSectorSizeSig, UINT FlashSectorSize); static VOID BcmValidateNvmType(struct bcm_mini_adapter *Adapter); -static INT BcmGetNvmSize(struct bcm_mini_adapter *Adapter); +static int BcmGetNvmSize(struct bcm_mini_adapter *Adapter); static UINT BcmGetFlashSize(struct bcm_mini_adapter *Adapter); static NVM_TYPE BcmGetNvmType(struct bcm_mini_adapter *Adapter); -static INT BcmGetSectionValEndOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal); +static int BcmGetSectionValEndOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal); static B_UINT8 IsOffsetWritable(struct bcm_mini_adapter *Adapter, UINT uiOffset); -static INT IsSectionWritable(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL Section); -static INT IsSectionExistInVendorInfo(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL section); - -static INT ReadDSDPriority(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL dsd); -static INT ReadDSDSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL dsd); -static INT ReadISOPriority(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL iso); -static INT ReadISOSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL iso); - -static INT CorruptDSDSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal); -static INT CorruptISOSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal); -static INT SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, UINT uiSectAlignAddr); -static INT WriteToFlashWithoutSectorErase(struct bcm_mini_adapter *Adapter, PUINT pBuff, +static int IsSectionWritable(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL Section); +static int IsSectionExistInVendorInfo(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL section); + +static int ReadDSDPriority(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL dsd); +static int ReadDSDSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL dsd); +static int ReadISOPriority(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL iso); +static int ReadISOSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL iso); + +static int CorruptDSDSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal); +static int CorruptISOSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal); +static int SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, UINT uiSectAlignAddr); +static int WriteToFlashWithoutSectorErase(struct bcm_mini_adapter *Adapter, PUINT pBuff, FLASH2X_SECTION_VAL eFlash2xSectionVal, UINT uiOffset, UINT uiNumBytes); static FLASH2X_SECTION_VAL getHighestPriDSD(struct bcm_mini_adapter *Adapter); static FLASH2X_SECTION_VAL getHighestPriISO(struct bcm_mini_adapter *Adapter); -static INT BeceemFlashBulkRead( +static int BeceemFlashBulkRead( struct bcm_mini_adapter *Adapter, PUINT pBuffer, UINT uiOffset, UINT uiNumBytes); -static INT BeceemFlashBulkWrite( +static int BeceemFlashBulkWrite( struct bcm_mini_adapter *Adapter, PUINT pBuffer, UINT uiOffset, UINT uiNumBytes, BOOLEAN bVerify); -static INT GetFlashBaseAddr(struct bcm_mini_adapter *Adapter); +static int GetFlashBaseAddr(struct bcm_mini_adapter *Adapter); -static INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, UINT dwAddress, UINT *pdwData, UINT dwNumData); +static int ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, UINT dwAddress, UINT *pdwData, UINT dwNumData); /* Procedure: ReadEEPROMStatusRegister * @@ -122,7 +122,7 @@ static UCHAR ReadEEPROMStatusRegister(struct bcm_mini_adapter *Adapter) * OSAL_STATUS_CODE: */ -INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, +int ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, DWORD dwAddress, DWORD *pdwData, DWORD dwNumWords) @@ -241,7 +241,7 @@ INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, * OSAL_STATUS_CODE: */ -INT ReadBeceemEEPROM(struct bcm_mini_adapter *Adapter, +int ReadBeceemEEPROM(struct bcm_mini_adapter *Adapter, DWORD uiOffset, DWORD *pBuffer) { @@ -267,9 +267,9 @@ INT ReadBeceemEEPROM(struct bcm_mini_adapter *Adapter, return STATUS_SUCCESS; } /* ReadBeceemEEPROM() */ -INT ReadMacAddressFromNVM(struct bcm_mini_adapter *Adapter) +int ReadMacAddressFromNVM(struct bcm_mini_adapter *Adapter) { - INT Status; + int Status; unsigned char puMacAddr[6]; Status = BeceemNVMRead(Adapter, @@ -299,7 +299,7 @@ INT ReadMacAddressFromNVM(struct bcm_mini_adapter *Adapter) * - if failed. */ -INT BeceemEEPROMBulkRead(struct bcm_mini_adapter *Adapter, +int BeceemEEPROMBulkRead(struct bcm_mini_adapter *Adapter, PUINT pBuffer, UINT uiOffset, UINT uiNumBytes) @@ -391,14 +391,14 @@ INT BeceemEEPROMBulkRead(struct bcm_mini_adapter *Adapter, * - if failed. */ -static INT BeceemFlashBulkRead(struct bcm_mini_adapter *Adapter, +static int BeceemFlashBulkRead(struct bcm_mini_adapter *Adapter, PUINT pBuffer, UINT uiOffset, UINT uiNumBytes) { UINT uiIndex = 0; UINT uiBytesToRead = uiNumBytes; - INT Status = 0; + int Status = 0; UINT uiPartOffset = 0; int bytes; @@ -542,7 +542,7 @@ static UINT BcmGetEEPROMSize(struct bcm_mini_adapter *Adapter) * */ -static INT FlashSectorErase(struct bcm_mini_adapter *Adapter, +static int FlashSectorErase(struct bcm_mini_adapter *Adapter, UINT addr, UINT numOfSectors) { @@ -603,12 +603,12 @@ static INT FlashSectorErase(struct bcm_mini_adapter *Adapter, * */ -static INT flashByteWrite(struct bcm_mini_adapter *Adapter, +static int flashByteWrite(struct bcm_mini_adapter *Adapter, UINT uiOffset, PVOID pData) { UINT uiStatus = 0; - INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; /* 3 */ + int iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; /* 3 */ UINT value; ULONG ulData = *(PUCHAR)pData; int bytes; @@ -680,16 +680,16 @@ static INT flashByteWrite(struct bcm_mini_adapter *Adapter, * */ -static INT flashWrite(struct bcm_mini_adapter *Adapter, +static int flashWrite(struct bcm_mini_adapter *Adapter, UINT uiOffset, PVOID pData) { /* UINT uiStatus = 0; - * INT iRetries = 0; + * int iRetries = 0; * UINT uiReadBack = 0; */ UINT uiStatus = 0; - INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; /* 3 */ + int iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; /* 3 */ UINT value; UINT uiErasePattern[4] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; int bytes; @@ -758,12 +758,12 @@ static INT flashWrite(struct bcm_mini_adapter *Adapter, * OSAL_STATUS_CODE * */ -static INT flashByteWriteStatus(struct bcm_mini_adapter *Adapter, +static int flashByteWriteStatus(struct bcm_mini_adapter *Adapter, UINT uiOffset, PVOID pData) { UINT uiStatus = 0; - INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; /* 3 */ + int iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; /* 3 */ ULONG ulData = *(PUCHAR)pData; UINT value; int bytes; @@ -836,12 +836,12 @@ static INT flashByteWriteStatus(struct bcm_mini_adapter *Adapter, * */ -static INT flashWriteStatus(struct bcm_mini_adapter *Adapter, +static int flashWriteStatus(struct bcm_mini_adapter *Adapter, UINT uiOffset, PVOID pData) { UINT uiStatus = 0; - INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; /* 3 */ + int iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; /* 3 */ /* UINT uiReadBack = 0; */ UINT value; UINT uiErasePattern[4] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; @@ -1030,7 +1030,7 @@ static ULONG BcmFlashUnProtectBlock(struct bcm_mini_adapter *Adapter, UINT uiOff * */ -static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, +static int BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, PUINT pBuffer, UINT uiOffset, UINT uiNumBytes, @@ -1046,7 +1046,7 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, UINT uiNumSectTobeRead = 0; UCHAR ucReadBk[16] = {0}; ULONG ulStatus = 0; - INT Status = STATUS_SUCCESS; + int Status = STATUS_SUCCESS; UINT uiTemp = 0; UINT index = 0; UINT uiPartOffset = 0; @@ -1218,7 +1218,7 @@ BeceemFlashBulkWrite_EXIT: * */ -static INT BeceemFlashBulkWriteStatus(struct bcm_mini_adapter *Adapter, +static int BeceemFlashBulkWriteStatus(struct bcm_mini_adapter *Adapter, PUINT pBuffer, UINT uiOffset, UINT uiNumBytes, @@ -1366,7 +1366,7 @@ BeceemFlashBulkWriteStatus_EXIT: * */ -INT PropagateCalParamsFromEEPROMToMemory(struct bcm_mini_adapter *Adapter) +int PropagateCalParamsFromEEPROMToMemory(struct bcm_mini_adapter *Adapter) { PCHAR pBuff = kmalloc(BUFFER_4K, GFP_KERNEL); UINT uiEepromSize = 0; @@ -1375,7 +1375,7 @@ INT PropagateCalParamsFromEEPROMToMemory(struct bcm_mini_adapter *Adapter) UINT uiCalStartAddr = EEPROM_CALPARAM_START; UINT uiMemoryLoc = EEPROM_CAL_DATA_INTERNAL_LOC; UINT value; - INT Status = 0; + int Status = 0; if (pBuff == NULL) return -ENOMEM; @@ -1427,7 +1427,7 @@ INT PropagateCalParamsFromEEPROMToMemory(struct bcm_mini_adapter *Adapter) * */ -INT PropagateCalParamsFromFlashToMemory(struct bcm_mini_adapter *Adapter) +int PropagateCalParamsFromFlashToMemory(struct bcm_mini_adapter *Adapter) { PCHAR pBuff, pPtr; UINT uiEepromSize = 0; @@ -1436,7 +1436,7 @@ INT PropagateCalParamsFromFlashToMemory(struct bcm_mini_adapter *Adapter) UINT uiCalStartAddr = EEPROM_CALPARAM_START; UINT uiMemoryLoc = EEPROM_CAL_DATA_INTERNAL_LOC; UINT value; - INT Status = 0; + int Status = 0; /* * Write the signature first. This will ensure firmware does not access EEPROM. @@ -1505,7 +1505,7 @@ INT PropagateCalParamsFromFlashToMemory(struct bcm_mini_adapter *Adapter) * */ -static INT BeceemEEPROMReadBackandVerify(struct bcm_mini_adapter *Adapter, +static int BeceemEEPROMReadBackandVerify(struct bcm_mini_adapter *Adapter, PUINT pBuffer, UINT uiOffset, UINT uiNumBytes) @@ -1590,7 +1590,7 @@ static VOID BcmSwapWord(UINT *ptr1) * */ -static INT BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[], UINT uiOffset) +static int BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[], UINT uiOffset) { UINT uiRetries = MAX_EEPROM_RETRIES * RETRIES_PER_DELAY; UINT uiStatus = 0; @@ -1720,7 +1720,7 @@ static INT BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[] * */ -INT BeceemEEPROMBulkWrite(struct bcm_mini_adapter *Adapter, +int BeceemEEPROMBulkWrite(struct bcm_mini_adapter *Adapter, PUCHAR pBuffer, UINT uiOffset, UINT uiNumBytes, @@ -1733,7 +1733,7 @@ INT BeceemEEPROMBulkWrite(struct bcm_mini_adapter *Adapter, UINT uiTempOffset = 0; UINT uiExtraBytes = 0; /* PUINT puiBuffer = (PUINT)pBuffer; - * INT value; + * int value; */ if (uiOffset % MAX_RW_SIZE && uiBytesToCopy) { @@ -1807,12 +1807,12 @@ INT BeceemEEPROMBulkWrite(struct bcm_mini_adapter *Adapter, * - if failed. */ -INT BeceemNVMRead(struct bcm_mini_adapter *Adapter, +int BeceemNVMRead(struct bcm_mini_adapter *Adapter, PUINT pBuffer, UINT uiOffset, UINT uiNumBytes) { - INT Status = 0; + int Status = 0; #if !defined(BCM_SHM_INTERFACE) || defined(FLASH_DIRECT_ACCESS) UINT uiTemp = 0, value; @@ -1866,13 +1866,13 @@ INT BeceemNVMRead(struct bcm_mini_adapter *Adapter, * - if failed. */ -INT BeceemNVMWrite(struct bcm_mini_adapter *Adapter, +int BeceemNVMWrite(struct bcm_mini_adapter *Adapter, PUINT pBuffer, UINT uiOffset, UINT uiNumBytes, BOOLEAN bVerify) { - INT Status = 0; + int Status = 0; UINT uiTemp = 0; UINT uiMemoryLoc = EEPROM_CAL_DATA_INTERNAL_LOC; UINT uiIndex = 0; @@ -1975,9 +1975,9 @@ INT BeceemNVMWrite(struct bcm_mini_adapter *Adapter, * - if failed. */ -INT BcmUpdateSectorSize(struct bcm_mini_adapter *Adapter, UINT uiSectorSize) +int BcmUpdateSectorSize(struct bcm_mini_adapter *Adapter, UINT uiSectorSize) { - INT Status = -1; + int Status = -1; FLASH_CS_INFO sFlashCsInfo = {0}; UINT uiTemp = 0; UINT uiSectorSig = 0; @@ -2089,7 +2089,7 @@ static UINT BcmGetFlashSectorSize(struct bcm_mini_adapter *Adapter, UINT FlashSe * */ -static INT BcmInitEEPROMQueues(struct bcm_mini_adapter *Adapter) +static int BcmInitEEPROMQueues(struct bcm_mini_adapter *Adapter) { UINT value = 0; /* CHIP Bug : Clear the Avail bits on the Read queue. The default @@ -2126,7 +2126,7 @@ static INT BcmInitEEPROMQueues(struct bcm_mini_adapter *Adapter) * */ -INT BcmInitNVM(struct bcm_mini_adapter *ps_adapter) +int BcmInitNVM(struct bcm_mini_adapter *ps_adapter) { BcmValidateNvmType(ps_adapter); BcmInitEEPROMQueues(ps_adapter); @@ -2152,7 +2152,7 @@ INT BcmInitNVM(struct bcm_mini_adapter *ps_adapter) * 0. means success; */ -static INT BcmGetNvmSize(struct bcm_mini_adapter *Adapter) +static int BcmGetNvmSize(struct bcm_mini_adapter *Adapter) { if (Adapter->eNVMType == NVM_EEPROM) Adapter->uiNVMDSDSize = BcmGetEEPROMSize(Adapter); @@ -2222,7 +2222,7 @@ static ULONG BcmReadFlashRDID(struct bcm_mini_adapter *Adapter) return ulRDID >> 8; } -INT BcmAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter) +int BcmAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter) { if (psAdapter == NULL) { BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_PRINTK, 0, 0, "Adapter structure point is NULL"); @@ -2252,7 +2252,7 @@ INT BcmAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter) return STATUS_SUCCESS; } -INT BcmDeAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter) +int BcmDeAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter) { if (psAdapter == NULL) { BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_PRINTK, 0, 0, "Adapter structure point is NULL"); @@ -2264,7 +2264,7 @@ INT BcmDeAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter) return STATUS_SUCCESS; } -static INT BcmDumpFlash2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo, struct bcm_mini_adapter *Adapter) +static int BcmDumpFlash2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo, struct bcm_mini_adapter *Adapter) { UINT Index = 0; @@ -2324,7 +2324,7 @@ static INT BcmDumpFlash2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo, struct bc return STATUS_SUCCESS; } -static INT ConvertEndianOf2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo) +static int ConvertEndianOf2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo) { UINT Index = 0; @@ -2381,7 +2381,7 @@ static INT ConvertEndianOf2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo) return STATUS_SUCCESS; } -static INT ConvertEndianOfCSStructure(PFLASH_CS_INFO psFlashCSInfo) +static int ConvertEndianOfCSStructure(PFLASH_CS_INFO psFlashCSInfo) { /* UINT Index = 0; */ psFlashCSInfo->MagicNumber = ntohl(psFlashCSInfo->MagicNumber); @@ -2413,7 +2413,7 @@ static INT ConvertEndianOfCSStructure(PFLASH_CS_INFO psFlashCSInfo) return STATUS_SUCCESS; } -static INT IsSectionExistInVendorInfo(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL section) +static int IsSectionExistInVendorInfo(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL section) { return (Adapter->uiVendorExtnFlag && (Adapter->psFlash2xVendorInfo->VendorSection[section].AccessFlags & FLASH2X_SECTION_PRESENT) && @@ -2507,7 +2507,7 @@ static VOID UpdateVendorInfo(struct bcm_mini_adapter *Adapter) * */ -static INT BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) +static int BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) { /* FLASH_CS_INFO sFlashCsInfo = {0}; */ @@ -2667,7 +2667,7 @@ static NVM_TYPE BcmGetNvmType(struct bcm_mini_adapter *Adapter) * On Failure -returns STATUS_FAILURE */ -INT BcmGetSectionValStartOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlashSectionVal) +int BcmGetSectionValStartOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlashSectionVal) { /* * Considering all the section for which end offset can be calculated or directly given @@ -2675,7 +2675,7 @@ INT BcmGetSectionValStartOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTIO * endoffset can't be calculated or given in CS Structure. */ - INT SectStartOffset = 0; + int SectStartOffset = 0; SectStartOffset = INVALID_OFFSET; @@ -2759,9 +2759,9 @@ INT BcmGetSectionValStartOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTIO * On Failure -returns STATUS_FAILURE */ -INT BcmGetSectionValEndOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) +int BcmGetSectionValEndOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) { - INT SectEndOffset = 0; + int SectEndOffset = 0; SectEndOffset = INVALID_OFFSET; if (IsSectionExistInVendorInfo(Adapter, eFlash2xSectionVal)) @@ -2845,14 +2845,14 @@ INT BcmGetSectionValEndOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_ * return true on success and STATUS_FAILURE on fail. */ -INT BcmFlash2xBulkRead(struct bcm_mini_adapter *Adapter, +int BcmFlash2xBulkRead(struct bcm_mini_adapter *Adapter, PUINT pBuffer, FLASH2X_SECTION_VAL eFlash2xSectionVal, UINT uiOffsetWithinSectionVal, UINT uiNumBytes) { - INT Status = STATUS_SUCCESS; - INT SectionStartOffset = 0; + int Status = STATUS_SUCCESS; + int SectionStartOffset = 0; UINT uiAbsoluteOffset = 0; UINT uiTemp = 0, value = 0; @@ -2907,14 +2907,14 @@ INT BcmFlash2xBulkRead(struct bcm_mini_adapter *Adapter, * */ -INT BcmFlash2xBulkWrite(struct bcm_mini_adapter *Adapter, +int BcmFlash2xBulkWrite(struct bcm_mini_adapter *Adapter, PUINT pBuffer, FLASH2X_SECTION_VAL eFlash2xSectVal, UINT uiOffset, UINT uiNumBytes, UINT bVerify) { - INT Status = STATUS_SUCCESS; + int Status = STATUS_SUCCESS; UINT FlashSectValStartOffset = 0; UINT uiTemp = 0, value = 0; @@ -2969,7 +2969,7 @@ INT BcmFlash2xBulkWrite(struct bcm_mini_adapter *Adapter, * */ -static INT BcmGetActiveDSD(struct bcm_mini_adapter *Adapter) +static int BcmGetActiveDSD(struct bcm_mini_adapter *Adapter) { FLASH2X_SECTION_VAL uiHighestPriDSD = 0; @@ -3011,9 +3011,9 @@ static INT BcmGetActiveDSD(struct bcm_mini_adapter *Adapter) * */ -static INT BcmGetActiveISO(struct bcm_mini_adapter *Adapter) +static int BcmGetActiveISO(struct bcm_mini_adapter *Adapter) { - INT HighestPriISO = 0; + int HighestPriISO = 0; HighestPriISO = getHighestPriISO(Adapter); @@ -3064,7 +3064,7 @@ B_UINT8 IsOffsetWritable(struct bcm_mini_adapter *Adapter, UINT uiOffset) return FALSE; } -static INT BcmDumpFlash2xSectionBitMap(PFLASH2X_BITMAP psFlash2xBitMap) +static int BcmDumpFlash2xSectionBitMap(PFLASH2X_BITMAP psFlash2xBitMap) { struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); @@ -3099,7 +3099,7 @@ static INT BcmDumpFlash2xSectionBitMap(PFLASH2X_BITMAP psFlash2xBitMap) * Failure:- negative error code */ -INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITMAP psFlash2xBitMap) +int BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITMAP psFlash2xBitMap) { PFLASH2X_CS_INFO psFlash2xCSInfo = Adapter->psFlash2xCSInfo; FLASH2X_SECTION_VAL uiHighestPriDSD = 0; @@ -3349,16 +3349,16 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM * */ -INT BcmSetActiveSection(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectVal) +int BcmSetActiveSection(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectVal) { unsigned int SectImagePriority = 0; - INT Status = STATUS_SUCCESS; + int Status = STATUS_SUCCESS; /* DSD_HEADER sDSD = {0}; * ISO_HEADER sISO = {0}; */ - INT HighestPriDSD = 0 ; - INT HighestPriISO = 0; + int HighestPriDSD = 0 ; + int HighestPriISO = 0; Status = IsSectionWritable(Adapter, eFlash2xSectVal); if (Status != TRUE) { @@ -3529,7 +3529,7 @@ INT BcmSetActiveSection(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eF * */ -INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectStrut) +int BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectStrut) { PCHAR Buff = NULL; FLASH2X_SECTION_VAL eISOReadPart = 0, eISOWritePart = 0; @@ -3813,9 +3813,9 @@ out: * Failure :-Return negative error code */ -INT BcmFlash2xCorruptSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) +int BcmFlash2xCorruptSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) { - INT Status = STATUS_SUCCESS; + int Status = STATUS_SUCCESS; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Section Value :%x\n", eFlash2xSectionVal); @@ -3841,7 +3841,7 @@ INT BcmFlash2xCorruptSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL e * Failure :-Return negative error code */ -INT BcmFlash2xWriteSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlashSectionVal) +int BcmFlash2xWriteSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlashSectionVal) { UINT uiSignature = 0; UINT uiOffset = 0; @@ -3901,7 +3901,7 @@ INT BcmFlash2xWriteSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFl * Return values:-Return TRUE is request is valid else FALSE. */ -INT validateFlash2xReadWrite(struct bcm_mini_adapter *Adapter, PFLASH2X_READWRITE psFlash2xReadWrite) +int validateFlash2xReadWrite(struct bcm_mini_adapter *Adapter, PFLASH2X_READWRITE psFlash2xReadWrite) { UINT uiNumOfBytes = 0; UINT uiSectStartOffset = 0; @@ -3960,7 +3960,7 @@ INT validateFlash2xReadWrite(struct bcm_mini_adapter *Adapter, PFLASH2X_READWRIT * return TRUE if flah2.x of hgher version else return false. */ -INT IsFlash2x(struct bcm_mini_adapter *Adapter) +int IsFlash2x(struct bcm_mini_adapter *Adapter) { if (Adapter->uiFlashLayoutMajorVersion >= FLASH_2X_MAJOR_NUMBER) return TRUE; @@ -3976,7 +3976,7 @@ INT IsFlash2x(struct bcm_mini_adapter *Adapter) * Success :- Base Address of the Flash */ -static INT GetFlashBaseAddr(struct bcm_mini_adapter *Adapter) +static int GetFlashBaseAddr(struct bcm_mini_adapter *Adapter) { UINT uiBaseAddr = 0; @@ -4020,7 +4020,7 @@ static INT GetFlashBaseAddr(struct bcm_mini_adapter *Adapter) * Faillure :- return negative error code */ -INT BcmCopySection(struct bcm_mini_adapter *Adapter, +int BcmCopySection(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL SrcSection, FLASH2X_SECTION_VAL DstSection, UINT offset, @@ -4029,7 +4029,7 @@ INT BcmCopySection(struct bcm_mini_adapter *Adapter, UINT BuffSize = 0; UINT BytesToBeCopied = 0; PUCHAR pBuff = NULL; - INT Status = STATUS_SUCCESS; + int Status = STATUS_SUCCESS; if (SrcSection == DstSection) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Source and Destination should be different ...try again"); @@ -4125,7 +4125,7 @@ INT BcmCopySection(struct bcm_mini_adapter *Adapter, * Faillure :- Return negative error code */ -INT SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, UINT uiOffset) +int SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, UINT uiOffset) { UINT offsetToProtect = 0, HeaderSizeToProtect = 0; BOOLEAN bHasHeader = FALSE; @@ -4190,10 +4190,10 @@ INT SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, UINT uiO * OutPut:- * Select the Appropriate chip and retrn status Success */ -static INT BcmDoChipSelect(struct bcm_mini_adapter *Adapter, UINT offset) +static int BcmDoChipSelect(struct bcm_mini_adapter *Adapter, UINT offset) { UINT FlashConfig = 0; - INT ChipNum = 0; + int ChipNum = 0; UINT GPIOConfig = 0; UINT PartNum = 0; @@ -4264,7 +4264,7 @@ static INT BcmDoChipSelect(struct bcm_mini_adapter *Adapter, UINT offset) return STATUS_SUCCESS; } -INT ReadDSDSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL dsd) +int ReadDSDSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL dsd) { UINT uiDSDsig = 0; /* UINT sigoffsetInMap = 0; @@ -4289,7 +4289,7 @@ INT ReadDSDSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL dsd) return uiDSDsig; } -INT ReadDSDPriority(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL dsd) +int ReadDSDPriority(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL dsd) { /* UINT priOffsetInMap = 0 ; */ unsigned int uiDSDPri = STATUS_FAILURE; @@ -4314,8 +4314,8 @@ INT ReadDSDPriority(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL dsd) FLASH2X_SECTION_VAL getHighestPriDSD(struct bcm_mini_adapter *Adapter) { - INT DSDHighestPri = STATUS_FAILURE; - INT DsdPri = 0; + int DSDHighestPri = STATUS_FAILURE; + int DsdPri = 0; FLASH2X_SECTION_VAL HighestPriDSD = 0; if (IsSectionWritable(Adapter, DSD2)) { @@ -4344,7 +4344,7 @@ FLASH2X_SECTION_VAL getHighestPriDSD(struct bcm_mini_adapter *Adapter) return HighestPriDSD; } -INT ReadISOSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL iso) +int ReadISOSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL iso) { UINT uiISOsig = 0; /* UINT sigoffsetInMap = 0; @@ -4367,7 +4367,7 @@ INT ReadISOSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL iso) return uiISOsig; } -INT ReadISOPriority(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL iso) +int ReadISOPriority(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL iso) { unsigned int ISOPri = STATUS_FAILURE; if (IsSectionWritable(Adapter, iso)) { @@ -4388,8 +4388,8 @@ INT ReadISOPriority(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL iso) FLASH2X_SECTION_VAL getHighestPriISO(struct bcm_mini_adapter *Adapter) { - INT ISOHighestPri = STATUS_FAILURE; - INT ISOPri = 0; + int ISOHighestPri = STATUS_FAILURE; + int ISOPri = 0; FLASH2X_SECTION_VAL HighestPriISO = NO_SECTION_VAL; if (IsSectionWritable(Adapter, ISO_IMAGE2)) { @@ -4410,7 +4410,7 @@ FLASH2X_SECTION_VAL getHighestPriISO(struct bcm_mini_adapter *Adapter) return HighestPriISO; } -INT WriteToFlashWithoutSectorErase(struct bcm_mini_adapter *Adapter, +int WriteToFlashWithoutSectorErase(struct bcm_mini_adapter *Adapter, PUINT pBuff, FLASH2X_SECTION_VAL eFlash2xSectionVal, UINT uiOffset, @@ -4423,7 +4423,7 @@ INT WriteToFlashWithoutSectorErase(struct bcm_mini_adapter *Adapter, #endif UINT uiStartOffset = 0; /* Adding section start address */ - INT Status = STATUS_SUCCESS; + int Status = STATUS_SUCCESS; PUCHAR pcBuff = (PUCHAR)pBuff; if (uiNumBytes % Adapter->ulFlashWriteSize) { @@ -4523,10 +4523,10 @@ BOOLEAN IsSectionExistInFlash(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_ return SectionPresent; } -INT IsSectionWritable(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL Section) +int IsSectionWritable(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL Section) { - INT offset = STATUS_FAILURE; - INT Status = FALSE; + int offset = STATUS_FAILURE; + int Status = FALSE; if (IsSectionExistInFlash(Adapter, Section) == FALSE) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Section <%d> does not exixt", Section); @@ -4546,7 +4546,7 @@ INT IsSectionWritable(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL Sect return Status; } -static INT CorruptDSDSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) +static int CorruptDSDSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) { PUCHAR pBuff = NULL; UINT sig = 0; @@ -4608,7 +4608,7 @@ static INT CorruptDSDSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL e return STATUS_SUCCESS; } -static INT CorruptISOSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) +static int CorruptISOSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) { PUCHAR pBuff = NULL; UINT sig = 0; -- cgit v0.10.2 From 0f20146536ecf6ed901afa2f9a88b8f968175480 Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Tue, 19 Jun 2012 20:14:53 -0400 Subject: Staging: bcm: Replace UINT with "unsigned int" in nvm.c This patch replaces all uppercase UINT with "unsigned int". Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/nvm.c b/drivers/staging/bcm/nvm.c index b5b9e93..14fce10 100644 --- a/drivers/staging/bcm/nvm.c +++ b/drivers/staging/bcm/nvm.c @@ -2,21 +2,21 @@ #define DWORD unsigned int -static int BcmDoChipSelect(struct bcm_mini_adapter *Adapter, UINT offset); +static int BcmDoChipSelect(struct bcm_mini_adapter *Adapter, unsigned int offset); static int BcmGetActiveDSD(struct bcm_mini_adapter *Adapter); static int BcmGetActiveISO(struct bcm_mini_adapter *Adapter); -static UINT BcmGetEEPROMSize(struct bcm_mini_adapter *Adapter); +static unsigned int BcmGetEEPROMSize(struct bcm_mini_adapter *Adapter); static int BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter); -static UINT BcmGetFlashSectorSize(struct bcm_mini_adapter *Adapter, UINT FlashSectorSizeSig, UINT FlashSectorSize); +static unsigned int BcmGetFlashSectorSize(struct bcm_mini_adapter *Adapter, unsigned int FlashSectorSizeSig, unsigned int FlashSectorSize); static VOID BcmValidateNvmType(struct bcm_mini_adapter *Adapter); static int BcmGetNvmSize(struct bcm_mini_adapter *Adapter); -static UINT BcmGetFlashSize(struct bcm_mini_adapter *Adapter); +static unsigned int BcmGetFlashSize(struct bcm_mini_adapter *Adapter); static NVM_TYPE BcmGetNvmType(struct bcm_mini_adapter *Adapter); static int BcmGetSectionValEndOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal); -static B_UINT8 IsOffsetWritable(struct bcm_mini_adapter *Adapter, UINT uiOffset); +static B_UINT8 IsOffsetWritable(struct bcm_mini_adapter *Adapter, unsigned int uiOffset); static int IsSectionWritable(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL Section); static int IsSectionExistInVendorInfo(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL section); @@ -27,29 +27,29 @@ static int ReadISOSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VA static int CorruptDSDSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal); static int CorruptISOSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal); -static int SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, UINT uiSectAlignAddr); +static int SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, unsigned int uiSectAlignAddr); static int WriteToFlashWithoutSectorErase(struct bcm_mini_adapter *Adapter, PUINT pBuff, FLASH2X_SECTION_VAL eFlash2xSectionVal, - UINT uiOffset, UINT uiNumBytes); + unsigned int uiOffset, unsigned int uiNumBytes); static FLASH2X_SECTION_VAL getHighestPriDSD(struct bcm_mini_adapter *Adapter); static FLASH2X_SECTION_VAL getHighestPriISO(struct bcm_mini_adapter *Adapter); static int BeceemFlashBulkRead( struct bcm_mini_adapter *Adapter, PUINT pBuffer, - UINT uiOffset, - UINT uiNumBytes); + unsigned int uiOffset, + unsigned int uiNumBytes); static int BeceemFlashBulkWrite( struct bcm_mini_adapter *Adapter, PUINT pBuffer, - UINT uiOffset, - UINT uiNumBytes, + unsigned int uiOffset, + unsigned int uiNumBytes, BOOLEAN bVerify); static int GetFlashBaseAddr(struct bcm_mini_adapter *Adapter); -static int ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, UINT dwAddress, UINT *pdwData, UINT dwNumData); +static int ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, unsigned int dwAddress, unsigned int *pdwData, unsigned int dwNumData); /* Procedure: ReadEEPROMStatusRegister * @@ -64,9 +64,9 @@ static UCHAR ReadEEPROMStatusRegister(struct bcm_mini_adapter *Adapter) { UCHAR uiData = 0; DWORD dwRetries = MAX_EEPROM_RETRIES * RETRIES_PER_DELAY; - UINT uiStatus = 0; - UINT value = 0; - UINT value1 = 0; + unsigned int uiStatus = 0; + unsigned int value = 0; + unsigned int value1 = 0; /* Read the EEPROM status register */ value = EEPROM_READ_STATUS_REGISTER; @@ -129,9 +129,9 @@ int ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, { DWORD dwIndex = 0; DWORD dwRetries = MAX_EEPROM_RETRIES * RETRIES_PER_DELAY; - UINT uiStatus = 0; - UINT value = 0; - UINT value1 = 0; + unsigned int uiStatus = 0; + unsigned int value = 0; + unsigned int value1 = 0; UCHAR *pvalue; /* Flush the read and cmd queue. */ @@ -245,9 +245,9 @@ int ReadBeceemEEPROM(struct bcm_mini_adapter *Adapter, DWORD uiOffset, DWORD *pBuffer) { - UINT uiData[8] = {0}; - UINT uiByteOffset = 0; - UINT uiTempOffset = 0; + unsigned int uiData[8] = {0}; + unsigned int uiByteOffset = 0; + unsigned int uiTempOffset = 0; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, " ====> "); @@ -301,16 +301,16 @@ int ReadMacAddressFromNVM(struct bcm_mini_adapter *Adapter) int BeceemEEPROMBulkRead(struct bcm_mini_adapter *Adapter, PUINT pBuffer, - UINT uiOffset, - UINT uiNumBytes) + unsigned int uiOffset, + unsigned int uiNumBytes) { - UINT uiData[4] = {0}; - /* UINT uiAddress = 0; */ - UINT uiBytesRemaining = uiNumBytes; - UINT uiIndex = 0; - UINT uiTempOffset = 0; - UINT uiExtraBytes = 0; - UINT uiFailureRetries = 0; + unsigned int uiData[4] = {0}; + /* unsigned int uiAddress = 0; */ + unsigned int uiBytesRemaining = uiNumBytes; + unsigned int uiIndex = 0; + unsigned int uiTempOffset = 0; + unsigned int uiExtraBytes = 0; + unsigned int uiFailureRetries = 0; PUCHAR pcBuff = (PUCHAR)pBuffer; if (uiOffset % MAX_RW_SIZE && uiBytesRemaining) { @@ -393,13 +393,13 @@ int BeceemEEPROMBulkRead(struct bcm_mini_adapter *Adapter, static int BeceemFlashBulkRead(struct bcm_mini_adapter *Adapter, PUINT pBuffer, - UINT uiOffset, - UINT uiNumBytes) + unsigned int uiOffset, + unsigned int uiNumBytes) { - UINT uiIndex = 0; - UINT uiBytesToRead = uiNumBytes; + unsigned int uiIndex = 0; + unsigned int uiBytesToRead = uiNumBytes; int Status = 0; - UINT uiPartOffset = 0; + unsigned int uiPartOffset = 0; int bytes; if (Adapter->device_removed) { @@ -465,11 +465,11 @@ static int BeceemFlashBulkRead(struct bcm_mini_adapter *Adapter, * Adapter - ptr to Adapter object instance * * Returns: - * UINT - size of the FLASH Storage. + * unsigned int - size of the FLASH Storage. * */ -static UINT BcmGetFlashSize(struct bcm_mini_adapter *Adapter) +static unsigned int BcmGetFlashSize(struct bcm_mini_adapter *Adapter) { if (IsFlash2x(Adapter)) return Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER); @@ -486,14 +486,14 @@ static UINT BcmGetFlashSize(struct bcm_mini_adapter *Adapter) * Adapter - ptr to Adapter object instance * * Returns: - * UINT - size of the EEPROM Storage. + * unsigned int - size of the EEPROM Storage. * */ -static UINT BcmGetEEPROMSize(struct bcm_mini_adapter *Adapter) +static unsigned int BcmGetEEPROMSize(struct bcm_mini_adapter *Adapter) { - UINT uiData = 0; - UINT uiIndex = 0; + unsigned int uiData = 0; + unsigned int uiIndex = 0; /* * if EEPROM is present and already Calibrated,it will have @@ -543,12 +543,12 @@ static UINT BcmGetEEPROMSize(struct bcm_mini_adapter *Adapter) */ static int FlashSectorErase(struct bcm_mini_adapter *Adapter, - UINT addr, - UINT numOfSectors) + unsigned int addr, + unsigned int numOfSectors) { - UINT iIndex = 0, iRetries = 0; - UINT uiStatus = 0; - UINT value; + unsigned int iIndex = 0, iRetries = 0; + unsigned int uiStatus = 0; + unsigned int value; int bytes; for (iIndex = 0; iIndex < numOfSectors; iIndex++) { @@ -604,12 +604,12 @@ static int FlashSectorErase(struct bcm_mini_adapter *Adapter, */ static int flashByteWrite(struct bcm_mini_adapter *Adapter, - UINT uiOffset, + unsigned int uiOffset, PVOID pData) { - UINT uiStatus = 0; + unsigned int uiStatus = 0; int iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; /* 3 */ - UINT value; + unsigned int value; ULONG ulData = *(PUCHAR)pData; int bytes; /* @@ -681,17 +681,17 @@ static int flashByteWrite(struct bcm_mini_adapter *Adapter, */ static int flashWrite(struct bcm_mini_adapter *Adapter, - UINT uiOffset, + unsigned int uiOffset, PVOID pData) { - /* UINT uiStatus = 0; + /* unsigned int uiStatus = 0; * int iRetries = 0; - * UINT uiReadBack = 0; + * unsigned int uiReadBack = 0; */ - UINT uiStatus = 0; + unsigned int uiStatus = 0; int iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; /* 3 */ - UINT value; - UINT uiErasePattern[4] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; + unsigned int value; + unsigned int uiErasePattern[4] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; int bytes; /* * need not write 0xFFFFFFFF because write requires an erase and erase will @@ -759,13 +759,13 @@ static int flashWrite(struct bcm_mini_adapter *Adapter, * */ static int flashByteWriteStatus(struct bcm_mini_adapter *Adapter, - UINT uiOffset, + unsigned int uiOffset, PVOID pData) { - UINT uiStatus = 0; + unsigned int uiStatus = 0; int iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; /* 3 */ ULONG ulData = *(PUCHAR)pData; - UINT value; + unsigned int value; int bytes; /* @@ -837,14 +837,14 @@ static int flashByteWriteStatus(struct bcm_mini_adapter *Adapter, */ static int flashWriteStatus(struct bcm_mini_adapter *Adapter, - UINT uiOffset, + unsigned int uiOffset, PVOID pData) { - UINT uiStatus = 0; + unsigned int uiStatus = 0; int iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; /* 3 */ - /* UINT uiReadBack = 0; */ - UINT value; - UINT uiErasePattern[4] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; + /* unsigned int uiReadBack = 0; */ + unsigned int value; + unsigned int uiErasePattern[4] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; int bytes; /* @@ -913,7 +913,7 @@ static int flashWriteStatus(struct bcm_mini_adapter *Adapter, static VOID BcmRestoreBlockProtectStatus(struct bcm_mini_adapter *Adapter, ULONG ulWriteStatus) { - UINT value; + unsigned int value; value = (FLASH_CMD_WRITE_ENABLE << 24); wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)); @@ -936,11 +936,11 @@ static VOID BcmRestoreBlockProtectStatus(struct bcm_mini_adapter *Adapter, ULONG * */ -static ULONG BcmFlashUnProtectBlock(struct bcm_mini_adapter *Adapter, UINT uiOffset, UINT uiLength) +static ULONG BcmFlashUnProtectBlock(struct bcm_mini_adapter *Adapter, unsigned int uiOffset, unsigned int uiLength) { ULONG ulStatus = 0; ULONG ulWriteStatus = 0; - UINT value; + unsigned int value; uiOffset = uiOffset&0x000FFFFF; /* @@ -1032,24 +1032,24 @@ static ULONG BcmFlashUnProtectBlock(struct bcm_mini_adapter *Adapter, UINT uiOff static int BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, PUINT pBuffer, - UINT uiOffset, - UINT uiNumBytes, + unsigned int uiOffset, + unsigned int uiNumBytes, BOOLEAN bVerify) { PCHAR pTempBuff = NULL; PUCHAR pcBuffer = (PUCHAR)pBuffer; - UINT uiIndex = 0; - UINT uiOffsetFromSectStart = 0; - UINT uiSectAlignAddr = 0; - UINT uiCurrSectOffsetAddr = 0; - UINT uiSectBoundary = 0; - UINT uiNumSectTobeRead = 0; + unsigned int uiIndex = 0; + unsigned int uiOffsetFromSectStart = 0; + unsigned int uiSectAlignAddr = 0; + unsigned int uiCurrSectOffsetAddr = 0; + unsigned int uiSectBoundary = 0; + unsigned int uiNumSectTobeRead = 0; UCHAR ucReadBk[16] = {0}; ULONG ulStatus = 0; int Status = STATUS_SUCCESS; - UINT uiTemp = 0; - UINT index = 0; - UINT uiPartOffset = 0; + unsigned int uiTemp = 0; + unsigned int index = 0; + unsigned int uiPartOffset = 0; #if defined(BCM_SHM_INTERFACE) && !defined(FLASH_DIRECT_ACCESS) Status = bcmflash_raw_write((uiOffset / FLASH_PART_SIZE), (uiOffset % FLASH_PART_SIZE), (unsigned char *)pBuffer, uiNumBytes); @@ -1153,7 +1153,7 @@ static int BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, for (uiIndex = 0; uiIndex < Adapter->uiSectorSize; uiIndex += MAX_RW_SIZE) { if (STATUS_SUCCESS == BeceemFlashBulkRead(Adapter, (PUINT)ucReadBk, uiOffsetFromSectStart + uiIndex, MAX_RW_SIZE)) { if (Adapter->ulFlashWriteSize == 1) { - UINT uiReadIndex = 0; + unsigned int uiReadIndex = 0; for (uiReadIndex = 0; uiReadIndex < 16; uiReadIndex++) { if (ucReadBk[uiReadIndex] != pTempBuff[uiIndex + uiReadIndex]) { if (STATUS_SUCCESS != (*Adapter->fpFlashWriteWithStatusCheck)(Adapter, uiPartOffset + uiIndex + uiReadIndex, &pTempBuff[uiIndex+uiReadIndex])) { @@ -1220,24 +1220,24 @@ BeceemFlashBulkWrite_EXIT: static int BeceemFlashBulkWriteStatus(struct bcm_mini_adapter *Adapter, PUINT pBuffer, - UINT uiOffset, - UINT uiNumBytes, + unsigned int uiOffset, + unsigned int uiNumBytes, BOOLEAN bVerify) { PCHAR pTempBuff = NULL; PUCHAR pcBuffer = (PUCHAR)pBuffer; - UINT uiIndex = 0; - UINT uiOffsetFromSectStart = 0; - UINT uiSectAlignAddr = 0; - UINT uiCurrSectOffsetAddr = 0; - UINT uiSectBoundary = 0; - UINT uiNumSectTobeRead = 0; + unsigned int uiIndex = 0; + unsigned int uiOffsetFromSectStart = 0; + unsigned int uiSectAlignAddr = 0; + unsigned int uiCurrSectOffsetAddr = 0; + unsigned int uiSectBoundary = 0; + unsigned int uiNumSectTobeRead = 0; UCHAR ucReadBk[16] = {0}; ULONG ulStatus = 0; - UINT Status = STATUS_SUCCESS; - UINT uiTemp = 0; - UINT index = 0; - UINT uiPartOffset = 0; + unsigned int Status = STATUS_SUCCESS; + unsigned int uiTemp = 0; + unsigned int index = 0; + unsigned int uiPartOffset = 0; uiOffsetFromSectStart = uiOffset & ~(Adapter->uiSectorSize - 1); @@ -1369,12 +1369,12 @@ BeceemFlashBulkWriteStatus_EXIT: int PropagateCalParamsFromEEPROMToMemory(struct bcm_mini_adapter *Adapter) { PCHAR pBuff = kmalloc(BUFFER_4K, GFP_KERNEL); - UINT uiEepromSize = 0; - UINT uiIndex = 0; - UINT uiBytesToCopy = 0; - UINT uiCalStartAddr = EEPROM_CALPARAM_START; - UINT uiMemoryLoc = EEPROM_CAL_DATA_INTERNAL_LOC; - UINT value; + unsigned int uiEepromSize = 0; + unsigned int uiIndex = 0; + unsigned int uiBytesToCopy = 0; + unsigned int uiCalStartAddr = EEPROM_CALPARAM_START; + unsigned int uiMemoryLoc = EEPROM_CAL_DATA_INTERNAL_LOC; + unsigned int value; int Status = 0; if (pBuff == NULL) @@ -1430,12 +1430,12 @@ int PropagateCalParamsFromEEPROMToMemory(struct bcm_mini_adapter *Adapter) int PropagateCalParamsFromFlashToMemory(struct bcm_mini_adapter *Adapter) { PCHAR pBuff, pPtr; - UINT uiEepromSize = 0; - UINT uiBytesToCopy = 0; - /* UINT uiIndex = 0; */ - UINT uiCalStartAddr = EEPROM_CALPARAM_START; - UINT uiMemoryLoc = EEPROM_CAL_DATA_INTERNAL_LOC; - UINT value; + unsigned int uiEepromSize = 0; + unsigned int uiBytesToCopy = 0; + /* unsigned int uiIndex = 0; */ + unsigned int uiCalStartAddr = EEPROM_CALPARAM_START; + unsigned int uiMemoryLoc = EEPROM_CAL_DATA_INTERNAL_LOC; + unsigned int value; int Status = 0; /* @@ -1507,13 +1507,13 @@ int PropagateCalParamsFromFlashToMemory(struct bcm_mini_adapter *Adapter) static int BeceemEEPROMReadBackandVerify(struct bcm_mini_adapter *Adapter, PUINT pBuffer, - UINT uiOffset, - UINT uiNumBytes) + unsigned int uiOffset, + unsigned int uiNumBytes) { - UINT uiRdbk = 0; - UINT uiIndex = 0; - UINT uiData = 0; - UINT auiData[4] = {0}; + unsigned int uiRdbk = 0; + unsigned int uiIndex = 0; + unsigned int uiData = 0; + unsigned int auiData[4] = {0}; while (uiNumBytes) { if (Adapter->device_removed) @@ -1551,7 +1551,7 @@ static int BeceemEEPROMReadBackandVerify(struct bcm_mini_adapter *Adapter, } else { /* Handle the reads less than 4 bytes... */ uiData = 0; - memcpy(&uiData, ((PUCHAR)pBuffer) + (uiIndex * sizeof(UINT)), uiNumBytes); + memcpy(&uiData, ((PUCHAR)pBuffer) + (uiIndex * sizeof(unsigned int)), uiNumBytes); BeceemEEPROMBulkRead(Adapter, &uiRdbk, uiOffset, 4); if (memcmp(&uiData, &uiRdbk, uiNumBytes)) @@ -1564,9 +1564,9 @@ static int BeceemEEPROMReadBackandVerify(struct bcm_mini_adapter *Adapter, return 0; } -static VOID BcmSwapWord(UINT *ptr1) +static VOID BcmSwapWord(unsigned int *ptr1) { - UINT tempval = (UINT)*ptr1; + unsigned int tempval = (unsigned int)*ptr1; char *ptr2 = (char *)&tempval; char *ptr = (char *)ptr1; @@ -1590,12 +1590,12 @@ static VOID BcmSwapWord(UINT *ptr1) * */ -static int BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[], UINT uiOffset) +static int BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, unsigned int uiData[], unsigned int uiOffset) { - UINT uiRetries = MAX_EEPROM_RETRIES * RETRIES_PER_DELAY; - UINT uiStatus = 0; + unsigned int uiRetries = MAX_EEPROM_RETRIES * RETRIES_PER_DELAY; + unsigned int uiStatus = 0; UCHAR uiEpromStatus = 0; - UINT value = 0; + unsigned int value = 0; /* Flush the Write/Read/Cmd queues. */ value = (EEPROM_WRITE_QUEUE_FLUSH | EEPROM_CMD_QUEUE_FLUSH | EEPROM_READ_QUEUE_FLUSH); @@ -1722,16 +1722,16 @@ static int BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[] int BeceemEEPROMBulkWrite(struct bcm_mini_adapter *Adapter, PUCHAR pBuffer, - UINT uiOffset, - UINT uiNumBytes, + unsigned int uiOffset, + unsigned int uiNumBytes, BOOLEAN bVerify) { - UINT uiBytesToCopy = uiNumBytes; - /* UINT uiRdbk = 0; */ - UINT uiData[4] = {0}; - UINT uiIndex = 0; - UINT uiTempOffset = 0; - UINT uiExtraBytes = 0; + unsigned int uiBytesToCopy = uiNumBytes; + /* unsigned int uiRdbk = 0; */ + unsigned int uiData[4] = {0}; + unsigned int uiIndex = 0; + unsigned int uiTempOffset = 0; + unsigned int uiExtraBytes = 0; /* PUINT puiBuffer = (PUINT)pBuffer; * int value; */ @@ -1809,13 +1809,13 @@ int BeceemEEPROMBulkWrite(struct bcm_mini_adapter *Adapter, int BeceemNVMRead(struct bcm_mini_adapter *Adapter, PUINT pBuffer, - UINT uiOffset, - UINT uiNumBytes) + unsigned int uiOffset, + unsigned int uiNumBytes) { int Status = 0; #if !defined(BCM_SHM_INTERFACE) || defined(FLASH_DIRECT_ACCESS) - UINT uiTemp = 0, value; + unsigned int uiTemp = 0, value; #endif if (Adapter->eNVMType == NVM_FLASH) { @@ -1868,20 +1868,20 @@ int BeceemNVMRead(struct bcm_mini_adapter *Adapter, int BeceemNVMWrite(struct bcm_mini_adapter *Adapter, PUINT pBuffer, - UINT uiOffset, - UINT uiNumBytes, + unsigned int uiOffset, + unsigned int uiNumBytes, BOOLEAN bVerify) { int Status = 0; - UINT uiTemp = 0; - UINT uiMemoryLoc = EEPROM_CAL_DATA_INTERNAL_LOC; - UINT uiIndex = 0; + unsigned int uiTemp = 0; + unsigned int uiMemoryLoc = EEPROM_CAL_DATA_INTERNAL_LOC; + unsigned int uiIndex = 0; #if !defined(BCM_SHM_INTERFACE) || defined(FLASH_DIRECT_ACCESS) - UINT value; + unsigned int value; #endif - UINT uiFlashOffset = 0; + unsigned int uiFlashOffset = 0; if (Adapter->eNVMType == NVM_FLASH) { if (IsSectionExistInVendorInfo(Adapter, Adapter->eActiveDSD)) @@ -1975,14 +1975,14 @@ int BeceemNVMWrite(struct bcm_mini_adapter *Adapter, * - if failed. */ -int BcmUpdateSectorSize(struct bcm_mini_adapter *Adapter, UINT uiSectorSize) +int BcmUpdateSectorSize(struct bcm_mini_adapter *Adapter, unsigned int uiSectorSize) { int Status = -1; FLASH_CS_INFO sFlashCsInfo = {0}; - UINT uiTemp = 0; - UINT uiSectorSig = 0; - UINT uiCurrentSectorSize = 0; - UINT value; + unsigned int uiTemp = 0; + unsigned int uiSectorSig = 0; + unsigned int uiCurrentSectorSize = 0; + unsigned int value; rdmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); value = 0; @@ -2032,14 +2032,14 @@ Restore: * Adapter - ptr to Adapter object instance * * Returns: - * UINT - sector size. + * unsigned int - sector size. * */ -static UINT BcmGetFlashSectorSize(struct bcm_mini_adapter *Adapter, UINT FlashSectorSizeSig, UINT FlashSectorSize) +static unsigned int BcmGetFlashSectorSize(struct bcm_mini_adapter *Adapter, unsigned int FlashSectorSizeSig, unsigned int FlashSectorSize) { - UINT uiSectorSize = 0; - UINT uiSectorSig = 0; + unsigned int uiSectorSize = 0; + unsigned int uiSectorSig = 0; if (Adapter->bSectorSizeOverride && (Adapter->uiSectorSizeInCFG <= MAX_SECTOR_SIZE && @@ -2091,7 +2091,7 @@ static UINT BcmGetFlashSectorSize(struct bcm_mini_adapter *Adapter, UINT FlashSe static int BcmInitEEPROMQueues(struct bcm_mini_adapter *Adapter) { - UINT value = 0; + unsigned int value = 0; /* CHIP Bug : Clear the Avail bits on the Read queue. The default * value on this register is supposed to be 0x00001102. * But we get 0x00001122. @@ -2202,7 +2202,7 @@ static VOID BcmValidateNvmType(struct bcm_mini_adapter *Adapter) static ULONG BcmReadFlashRDID(struct bcm_mini_adapter *Adapter) { ULONG ulRDID = 0; - UINT value; + unsigned int value; /* * Read ID Instruction. @@ -2266,7 +2266,7 @@ int BcmDeAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter) static int BcmDumpFlash2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo, struct bcm_mini_adapter *Adapter) { - UINT Index = 0; + unsigned int Index = 0; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "**********************FLASH2X CS Structure *******************"); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Signature is :%x", (psFlash2xCSInfo->MagicNumber)); @@ -2326,7 +2326,7 @@ static int BcmDumpFlash2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo, struct bc static int ConvertEndianOf2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo) { - UINT Index = 0; + unsigned int Index = 0; psFlash2xCSInfo->MagicNumber = ntohl(psFlash2xCSInfo->MagicNumber); psFlash2xCSInfo->FlashLayoutVersion = ntohl(psFlash2xCSInfo->FlashLayoutVersion); @@ -2383,7 +2383,7 @@ static int ConvertEndianOf2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo) static int ConvertEndianOfCSStructure(PFLASH_CS_INFO psFlashCSInfo) { - /* UINT Index = 0; */ + /* unsigned int Index = 0; */ psFlashCSInfo->MagicNumber = ntohl(psFlashCSInfo->MagicNumber); psFlashCSInfo->FlashLayoutVersion = ntohl(psFlashCSInfo->FlashLayoutVersion); psFlashCSInfo->ISOImageVersion = ntohl(psFlashCSInfo->ISOImageVersion); @@ -2423,7 +2423,7 @@ static int IsSectionExistInVendorInfo(struct bcm_mini_adapter *Adapter, FLASH2X_ static VOID UpdateVendorInfo(struct bcm_mini_adapter *Adapter) { B_UINT32 i = 0; - UINT uiSizeSection = 0; + unsigned int uiSizeSection = 0; Adapter->uiVendorExtnFlag = FALSE; @@ -2512,10 +2512,10 @@ static int BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) /* FLASH_CS_INFO sFlashCsInfo = {0}; */ #if !defined(BCM_SHM_INTERFACE) || defined(FLASH_DIRECT_ACCESS) - UINT value; + unsigned int value; #endif - UINT uiFlashLayoutMajorVersion; + unsigned int uiFlashLayoutMajorVersion; Adapter->uiFlashLayoutMinorVersion = 0; Adapter->uiFlashLayoutMajorVersion = 0; Adapter->ulFlashControlSectionStart = FLASH_CS_INFO_START_ADDR; @@ -2631,7 +2631,7 @@ static int BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) static NVM_TYPE BcmGetNvmType(struct bcm_mini_adapter *Adapter) { - UINT uiData = 0; + unsigned int uiData = 0; BeceemEEPROMBulkRead(Adapter, &uiData, 0x0, 4); if (uiData == BECM) @@ -2848,13 +2848,13 @@ int BcmGetSectionValEndOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_ int BcmFlash2xBulkRead(struct bcm_mini_adapter *Adapter, PUINT pBuffer, FLASH2X_SECTION_VAL eFlash2xSectionVal, - UINT uiOffsetWithinSectionVal, - UINT uiNumBytes) + unsigned int uiOffsetWithinSectionVal, + unsigned int uiNumBytes) { int Status = STATUS_SUCCESS; int SectionStartOffset = 0; - UINT uiAbsoluteOffset = 0; - UINT uiTemp = 0, value = 0; + unsigned int uiAbsoluteOffset = 0; + unsigned int uiTemp = 0, value = 0; if (Adapter == NULL) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Adapter structure is NULL"); @@ -2910,13 +2910,13 @@ int BcmFlash2xBulkRead(struct bcm_mini_adapter *Adapter, int BcmFlash2xBulkWrite(struct bcm_mini_adapter *Adapter, PUINT pBuffer, FLASH2X_SECTION_VAL eFlash2xSectVal, - UINT uiOffset, - UINT uiNumBytes, - UINT bVerify) + unsigned int uiOffset, + unsigned int uiNumBytes, + unsigned int bVerify) { int Status = STATUS_SUCCESS; - UINT FlashSectValStartOffset = 0; - UINT uiTemp = 0, value = 0; + unsigned int FlashSectValStartOffset = 0; + unsigned int uiTemp = 0, value = 0; if (Adapter == NULL) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Adapter structure is NULL"); @@ -3040,11 +3040,11 @@ static int BcmGetActiveISO(struct bcm_mini_adapter *Adapter) * */ -B_UINT8 IsOffsetWritable(struct bcm_mini_adapter *Adapter, UINT uiOffset) +B_UINT8 IsOffsetWritable(struct bcm_mini_adapter *Adapter, unsigned int uiOffset) { - UINT uiSectorNum = 0; - UINT uiWordOfSectorPermission = 0; - UINT uiBitofSectorePermission = 0; + unsigned int uiSectorNum = 0; + unsigned int uiWordOfSectorPermission = 0; + unsigned int uiBitofSectorePermission = 0; B_UINT32 permissionBits = 0; uiSectorNum = uiOffset/Adapter->uiSectorSize; @@ -3533,14 +3533,14 @@ int BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS { PCHAR Buff = NULL; FLASH2X_SECTION_VAL eISOReadPart = 0, eISOWritePart = 0; - UINT uiReadOffsetWithinPart = 0, uiWriteOffsetWithinPart = 0; - UINT uiTotalDataToCopy = 0; + unsigned int uiReadOffsetWithinPart = 0, uiWriteOffsetWithinPart = 0; + unsigned int uiTotalDataToCopy = 0; BOOLEAN IsThisHeaderSector = FALSE; - UINT sigOffset = 0; - UINT ISOLength = 0; - UINT Status = STATUS_SUCCESS; - UINT SigBuff[MAX_RW_SIZE]; - UINT i = 0; + unsigned int sigOffset = 0; + unsigned int ISOLength = 0; + unsigned int Status = STATUS_SUCCESS; + unsigned int SigBuff[MAX_RW_SIZE]; + unsigned int i = 0; if (ReadISOSignature(Adapter, sCopySectStrut.SrcSection) != ISO_IMAGE_MAGIC_NUMBER) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "error as Source ISO Section does not have valid signature"); @@ -3843,8 +3843,8 @@ int BcmFlash2xCorruptSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL e int BcmFlash2xWriteSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlashSectionVal) { - UINT uiSignature = 0; - UINT uiOffset = 0; + unsigned int uiSignature = 0; + unsigned int uiOffset = 0; /* DSD_HEADER dsdHeader = {0}; */ if (Adapter->bSigCorrupted == FALSE) { @@ -3903,9 +3903,9 @@ int BcmFlash2xWriteSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFl int validateFlash2xReadWrite(struct bcm_mini_adapter *Adapter, PFLASH2X_READWRITE psFlash2xReadWrite) { - UINT uiNumOfBytes = 0; - UINT uiSectStartOffset = 0; - UINT uiSectEndOffset = 0; + unsigned int uiNumOfBytes = 0; + unsigned int uiSectStartOffset = 0; + unsigned int uiSectEndOffset = 0; uiNumOfBytes = psFlash2xReadWrite->numOfBytes; @@ -3978,7 +3978,7 @@ int IsFlash2x(struct bcm_mini_adapter *Adapter) static int GetFlashBaseAddr(struct bcm_mini_adapter *Adapter) { - UINT uiBaseAddr = 0; + unsigned int uiBaseAddr = 0; if (Adapter->bDDRInitDone) { /* @@ -4023,11 +4023,11 @@ static int GetFlashBaseAddr(struct bcm_mini_adapter *Adapter) int BcmCopySection(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL SrcSection, FLASH2X_SECTION_VAL DstSection, - UINT offset, - UINT numOfBytes) + unsigned int offset, + unsigned int numOfBytes) { - UINT BuffSize = 0; - UINT BytesToBeCopied = 0; + unsigned int BuffSize = 0; + unsigned int BytesToBeCopied = 0; PUCHAR pBuff = NULL; int Status = STATUS_SUCCESS; @@ -4125,13 +4125,13 @@ int BcmCopySection(struct bcm_mini_adapter *Adapter, * Faillure :- Return negative error code */ -int SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, UINT uiOffset) +int SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, unsigned int uiOffset) { - UINT offsetToProtect = 0, HeaderSizeToProtect = 0; + unsigned int offsetToProtect = 0, HeaderSizeToProtect = 0; BOOLEAN bHasHeader = FALSE; PUCHAR pTempBuff = NULL; - UINT uiSectAlignAddr = 0; - UINT sig = 0; + unsigned int uiSectAlignAddr = 0; + unsigned int sig = 0; /* making the offset sector aligned */ uiSectAlignAddr = uiOffset & ~(Adapter->uiSectorSize - 1); @@ -4190,12 +4190,12 @@ int SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, UINT uiO * OutPut:- * Select the Appropriate chip and retrn status Success */ -static int BcmDoChipSelect(struct bcm_mini_adapter *Adapter, UINT offset) +static int BcmDoChipSelect(struct bcm_mini_adapter *Adapter, unsigned int offset) { - UINT FlashConfig = 0; + unsigned int FlashConfig = 0; int ChipNum = 0; - UINT GPIOConfig = 0; - UINT PartNum = 0; + unsigned int GPIOConfig = 0; + unsigned int PartNum = 0; ChipNum = offset / FLASH_PART_SIZE; @@ -4266,8 +4266,8 @@ static int BcmDoChipSelect(struct bcm_mini_adapter *Adapter, UINT offset) int ReadDSDSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL dsd) { - UINT uiDSDsig = 0; - /* UINT sigoffsetInMap = 0; + unsigned int uiDSDsig = 0; + /* unsigned int sigoffsetInMap = 0; * DSD_HEADER dsdHeader = {0}; */ @@ -4291,7 +4291,7 @@ int ReadDSDSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL dsd) int ReadDSDPriority(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL dsd) { - /* UINT priOffsetInMap = 0 ; */ + /* unsigned int priOffsetInMap = 0 ; */ unsigned int uiDSDPri = STATUS_FAILURE; /* DSD_HEADER dsdHeader = {0}; * priOffsetInMap = (PUCHAR)&(dsdHeader.DSDImagePriority) -(PUCHAR)&dsdHeader; @@ -4346,8 +4346,8 @@ FLASH2X_SECTION_VAL getHighestPriDSD(struct bcm_mini_adapter *Adapter) int ReadISOSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL iso) { - UINT uiISOsig = 0; - /* UINT sigoffsetInMap = 0; + unsigned int uiISOsig = 0; + /* unsigned int sigoffsetInMap = 0; * ISO_HEADER ISOHeader = {0}; * sigoffsetInMap =(PUCHAR)&(ISOHeader.ISOImageMagicNumber) -(PUCHAR)&ISOHeader; */ @@ -4413,15 +4413,15 @@ FLASH2X_SECTION_VAL getHighestPriISO(struct bcm_mini_adapter *Adapter) int WriteToFlashWithoutSectorErase(struct bcm_mini_adapter *Adapter, PUINT pBuff, FLASH2X_SECTION_VAL eFlash2xSectionVal, - UINT uiOffset, - UINT uiNumBytes) + unsigned int uiOffset, + unsigned int uiNumBytes) { #if !defined(BCM_SHM_INTERFACE) || defined(FLASH_DIRECT_ACCESS) - UINT uiTemp = 0, value = 0; - UINT i = 0; - UINT uiPartOffset = 0; + unsigned int uiTemp = 0, value = 0; + unsigned int i = 0; + unsigned int uiPartOffset = 0; #endif - UINT uiStartOffset = 0; + unsigned int uiStartOffset = 0; /* Adding section start address */ int Status = STATUS_SUCCESS; PUCHAR pcBuff = (PUCHAR)pBuff; @@ -4549,10 +4549,10 @@ int IsSectionWritable(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL Sect static int CorruptDSDSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) { PUCHAR pBuff = NULL; - UINT sig = 0; - UINT uiOffset = 0; - UINT BlockStatus = 0; - UINT uiSectAlignAddr = 0; + unsigned int sig = 0; + unsigned int uiOffset = 0; + unsigned int BlockStatus = 0; + unsigned int uiSectAlignAddr = 0; Adapter->bSigCorrupted = FALSE; if (Adapter->bAllDSDWriteAllow == FALSE) { @@ -4611,8 +4611,8 @@ static int CorruptDSDSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL e static int CorruptISOSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) { PUCHAR pBuff = NULL; - UINT sig = 0; - UINT uiOffset = 0; + unsigned int sig = 0; + unsigned int uiOffset = 0; Adapter->bSigCorrupted = FALSE; -- cgit v0.10.2 From a2a7ef06de037761dab79e1ed8e62758ddac3201 Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Tue, 19 Jun 2012 20:14:54 -0400 Subject: Staging: bcm: Change conditions that check for NULL in nvm.c This patch changes all conditions that check for NULL from "if (variable == NULL)" or "if (NULL == variable)" to "if (variable)" to make code more readable. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/nvm.c b/drivers/staging/bcm/nvm.c index 14fce10..a85258f 100644 --- a/drivers/staging/bcm/nvm.c +++ b/drivers/staging/bcm/nvm.c @@ -1067,7 +1067,7 @@ static int BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, uiSectBoundary = uiSectAlignAddr + Adapter->uiSectorSize; pTempBuff = kmalloc(Adapter->uiSectorSize, GFP_KERNEL); - if (NULL == pTempBuff) + if (!pTempBuff) goto BeceemFlashBulkWrite_EXIT; /* * check if the data to be written is overlapped across sectors @@ -1250,7 +1250,7 @@ static int BeceemFlashBulkWriteStatus(struct bcm_mini_adapter *Adapter, uiSectBoundary = uiSectAlignAddr + Adapter->uiSectorSize; pTempBuff = kmalloc(Adapter->uiSectorSize, GFP_KERNEL); - if (NULL == pTempBuff) + if (!pTempBuff) goto BeceemFlashBulkWriteStatus_EXIT; /* @@ -1377,7 +1377,7 @@ int PropagateCalParamsFromEEPROMToMemory(struct bcm_mini_adapter *Adapter) unsigned int value; int Status = 0; - if (pBuff == NULL) + if (!pBuff) return -ENOMEM; if (0 != BeceemEEPROMBulkRead(Adapter, &uiEepromSize, EEPROM_SIZE_OFFSET, 4)) { @@ -2224,7 +2224,7 @@ static ULONG BcmReadFlashRDID(struct bcm_mini_adapter *Adapter) int BcmAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter) { - if (psAdapter == NULL) { + if (!psAdapter) { BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_PRINTK, 0, 0, "Adapter structure point is NULL"); return -EINVAL; } @@ -2235,14 +2235,14 @@ int BcmAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter) } psAdapter->psFlash2xCSInfo = (PFLASH2X_CS_INFO)kzalloc(sizeof(FLASH2X_CS_INFO), GFP_KERNEL); - if (psAdapter->psFlash2xCSInfo == NULL) { + if (!psAdapter->psFlash2xCSInfo) { BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_PRINTK, 0, 0, "Can't Allocate memory for Flash 2.x"); kfree(psAdapter->psFlashCSInfo); return -ENOMEM; } psAdapter->psFlash2xVendorInfo = (PFLASH2X_VENDORSPECIFIC_INFO)kzalloc(sizeof(FLASH2X_VENDORSPECIFIC_INFO), GFP_KERNEL); - if (psAdapter->psFlash2xVendorInfo == NULL) { + if (!psAdapter->psFlash2xVendorInfo) { BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_PRINTK, 0, 0, "Can't Allocate Vendor Info Memory for Flash 2.x"); kfree(psAdapter->psFlashCSInfo); kfree(psAdapter->psFlash2xCSInfo); @@ -2254,7 +2254,7 @@ int BcmAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter) int BcmDeAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter) { - if (psAdapter == NULL) { + if (!psAdapter) { BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_PRINTK, 0, 0, "Adapter structure point is NULL"); return -EINVAL; } @@ -2856,7 +2856,7 @@ int BcmFlash2xBulkRead(struct bcm_mini_adapter *Adapter, unsigned int uiAbsoluteOffset = 0; unsigned int uiTemp = 0, value = 0; - if (Adapter == NULL) { + if (!Adapter) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Adapter structure is NULL"); return -EINVAL; } @@ -2918,7 +2918,7 @@ int BcmFlash2xBulkWrite(struct bcm_mini_adapter *Adapter, unsigned int FlashSectValStartOffset = 0; unsigned int uiTemp = 0, value = 0; - if (Adapter == NULL) { + if (!Adapter) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Adapter structure is NULL"); return -EINVAL; } @@ -3565,7 +3565,7 @@ int BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS Buff = kzalloc(Adapter->uiSectorSize, GFP_KERNEL); - if (Buff == NULL) { + if (!Buff) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Memory allocation failed for section size"); return -ENOMEM; } @@ -4074,7 +4074,7 @@ int BcmCopySection(struct bcm_mini_adapter *Adapter, BuffSize = numOfBytes; pBuff = (PCHAR)kzalloc(BuffSize, GFP_KERNEL); - if (pBuff == NULL) { + if (!pBuff) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Memory allocation failed.. "); return -ENOMEM; } @@ -4154,7 +4154,7 @@ int SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, unsigned /* If Header is present overwrite passed buffer with this */ if (bHasHeader && (Adapter->bHeaderChangeAllowed == FALSE)) { pTempBuff = (PUCHAR)kzalloc(HeaderSizeToProtect, GFP_KERNEL); - if (pTempBuff == NULL) { + if (!pTempBuff) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Memory allocation failed"); return -ENOMEM; } @@ -4563,7 +4563,7 @@ static int CorruptDSDSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL e } pBuff = (PUCHAR)kzalloc(MAX_RW_SIZE, GFP_KERNEL); - if (pBuff == NULL) { + if (!pBuff) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Can't allocate memorey"); return -ENOMEM; } @@ -4622,7 +4622,7 @@ static int CorruptISOSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL e } pBuff = (PUCHAR)kzalloc(MAX_RW_SIZE, GFP_KERNEL); - if (pBuff == NULL) { + if (!pBuff) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Can't allocate memorey"); return -ENOMEM; } -- cgit v0.10.2 From 85ba24d395620d8a0769bdaa619b32c458603180 Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Tue, 19 Jun 2012 20:14:55 -0400 Subject: Staging: bcm: Change order in if conditions to make more readable in nvm.c This patch changes the order of several if conditions to make the code more readable. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/nvm.c b/drivers/staging/bcm/nvm.c index a85258f..b179dba 100644 --- a/drivers/staging/bcm/nvm.c +++ b/drivers/staging/bcm/nvm.c @@ -339,7 +339,7 @@ int BeceemEEPROMBulkRead(struct bcm_mini_adapter *Adapter, * read function to make the access faster. * We read 4 Dwords of data */ - if (0 == ReadBeceemEEPROMBulk(Adapter, uiOffset, &uiData[0], 4)) { + if (ReadBeceemEEPROMBulk(Adapter, uiOffset, &uiData[0], 4) == 0) { memcpy(pcBuff + uiIndex, &uiData[0], MAX_RW_SIZE); uiOffset += MAX_RW_SIZE; uiBytesRemaining -= MAX_RW_SIZE; @@ -349,7 +349,7 @@ int BeceemEEPROMBulkRead(struct bcm_mini_adapter *Adapter, mdelay(3); /* sleep for a while before retry... */ } } else if (uiBytesRemaining >= 4) { - if (0 == ReadBeceemEEPROM(Adapter, uiOffset, &uiData[0])) { + if (ReadBeceemEEPROM(Adapter, uiOffset, &uiData[0]) == 0) { memcpy(pcBuff + uiIndex, &uiData[0], 4); uiOffset += 4; uiBytesRemaining -= 4; @@ -362,7 +362,7 @@ int BeceemEEPROMBulkRead(struct bcm_mini_adapter *Adapter, /* Handle the reads less than 4 bytes... */ PUCHAR pCharBuff = (PUCHAR)pBuffer; pCharBuff += uiIndex; - if (0 == ReadBeceemEEPROM(Adapter, uiOffset, &uiData[0])) { + if (ReadBeceemEEPROM(Adapter, uiOffset, &uiData[0]) == 0) { memcpy(pCharBuff, &uiData[0], uiBytesRemaining); /* copy only bytes requested. */ uiBytesRemaining = 0; } else { @@ -515,7 +515,7 @@ static unsigned int BcmGetEEPROMSize(struct bcm_mini_adapter *Adapter) * EEPROM may not be present or not programmed */ uiData = 0xBABEFACE; - if (0 == BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&uiData, 0, 4, TRUE)) { + if (BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&uiData, 0, 4, TRUE) == 0) { uiData = 0; for (uiIndex = 2; uiIndex <= 256; uiIndex *= 2) { BeceemEEPROMBulkRead(Adapter, &uiData, uiIndex * 1024, 4); -- cgit v0.10.2 From 2f0f8e6a219022e4926afeb9d80a52f156c51918 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 20 Jun 2012 13:50:03 -0700 Subject: staging: comedi: ssv_dnp: remove empty private data The private data struct 'dnp_private_data' contains no information. Remove it and the alloc_private() call. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ssv_dnp.c b/drivers/staging/comedi/drivers/ssv_dnp.c index 72dbccc..84b9f2a 100644 --- a/drivers/staging/comedi/drivers/ssv_dnp.c +++ b/drivers/staging/comedi/drivers/ssv_dnp.c @@ -59,14 +59,6 @@ struct dnp_board { int have_dio; }; -/* This structure is for data unique to the DNP driver --------------------- */ -struct dnp_private_data { - -}; - -/* Shorthand macro for faster access to the private data ------------------- */ -#define devpriv ((dnp_private *)dev->private) - /* ------------------------------------------------------------------------- */ /* The insn_bits interface allows packed reading/writing of DIO channels. */ /* The comedi core can convert between insn_bits and insn_read/write, so you */ @@ -189,11 +181,6 @@ static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->board_name = board->name; - /* Allocate the private structure area. alloc_private() is a */ - /* convenient macro defined in comedidev.h. */ - if (alloc_private(dev, sizeof(struct dnp_private_data)) < 0) - return -ENOMEM; - ret = comedi_alloc_subdevices(dev, 1); if (ret) return ret; -- cgit v0.10.2 From 069f101fa463351f528773d73b74e9b606b3f66a Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 20 Jun 2012 02:31:11 +0100 Subject: staging: zsmalloc: Finish conversion to a separate module ZSMALLOC is tristate, but the code has no MODULE_LICENSE and since it depends on GPL-only symbols it cannot be loaded as a module. This in turn breaks zram which now depends on it. I assume it's meant to be Dual BSD/GPL like the other z-stuff. There is also no module_exit, which will make it impossible to unload. Add the appropriate module_init and module_exit declarations suggested by comments. Reported-by: Christian Ohm References: http://bugs.debian.org/677273 Cc: stable@vger.kernel.org # v3.4 Signed-off-by: Ben Hutchings Reviewed-by: Jonathan Nieder Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c index 4af3dd6..10b0d60 100644 --- a/drivers/staging/zsmalloc/zsmalloc-main.c +++ b/drivers/staging/zsmalloc/zsmalloc-main.c @@ -471,12 +471,6 @@ static struct page *find_get_zspage(struct size_class *class) } -/* - * If this becomes a separate module, register zs_init() with - * module_init(), zs_exit with module_exit(), and remove zs_initialized -*/ -static int zs_initialized; - static int zs_cpu_notifier(struct notifier_block *nb, unsigned long action, void *pcpu) { @@ -535,7 +529,7 @@ fail: struct zs_pool *zs_create_pool(const char *name, gfp_t flags) { - int i, error, ovhd_size; + int i, ovhd_size; struct zs_pool *pool; if (!name) @@ -562,28 +556,9 @@ struct zs_pool *zs_create_pool(const char *name, gfp_t flags) } - /* - * If this becomes a separate module, register zs_init with - * module_init, and remove this block - */ - if (!zs_initialized) { - error = zs_init(); - if (error) - goto cleanup; - zs_initialized = 1; - } - pool->flags = flags; pool->name = name; - error = 0; /* Success */ - -cleanup: - if (error) { - zs_destroy_pool(pool); - pool = NULL; - } - return pool; } EXPORT_SYMBOL_GPL(zs_create_pool); @@ -799,3 +774,9 @@ u64 zs_get_total_size_bytes(struct zs_pool *pool) return npages << PAGE_SHIFT; } EXPORT_SYMBOL_GPL(zs_get_total_size_bytes); + +module_init(zs_init); +module_exit(zs_exit); + +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_AUTHOR("Nitin Gupta "); -- cgit v0.10.2 From 62a1efb9f868690d68b11ffb22dc598e547aa184 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Tue, 19 Jun 2012 09:58:54 +0200 Subject: iio: add vcnl4000 combined ALS and proximity sensor minimal driver, no IR current control and proximity/event handling yet v5: * checkpatch warnings * increase msleep() to 20 ms when waiting for data ready as measurement/conversion can take up to 100 ms, 1 ms is too short v4 (address comments by Jonathan Cameron) * remove SENSORS_ prefix in Kconfig * change from IIO_INTENSITY to IIO_LIGHT * move from staging v3 (address comments by Shubhrajyoti Datta) * cleanup Kconfig entry * call I2C read/write functions directly v2 (address comments by Lars-Peter Clausen and Jonathan Cameron) * unify code for reading PS and AL data into parameterized _measure() function * limit wait for data to become ready within 20 tries * drop IIO_LIGHT channel, add SCALE to IIO_INTENSITY * drop extra string arguments used for logging purpose only Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/iio/light/Kconfig b/drivers/iio/light/Kconfig index db5618e..f3ea90d 100644 --- a/drivers/iio/light/Kconfig +++ b/drivers/iio/light/Kconfig @@ -19,4 +19,15 @@ config SENSORS_LM3533 light zone through sysfs. A threshold event can be generated on zone changes. The ALS-control output values can be set per zone for the three current output channels. + +config VCNL4000 + tristate "VCNL4000 combined ALS and proximity sensor" + depends on I2C + help + Say Y here if you want to build a driver for the Vishay VCNL4000 + combined ambient light and proximity sensor. + + To compile this driver as a module, choose M here: the + module will be called vcnl4000. + endmenu diff --git a/drivers/iio/light/Makefile b/drivers/iio/light/Makefile index c1c23a0..06fa4d3 100644 --- a/drivers/iio/light/Makefile +++ b/drivers/iio/light/Makefile @@ -3,3 +3,4 @@ # obj-$(CONFIG_SENSORS_LM3533) += lm3533-als.o +obj-$(CONFIG_VCNL4000) += vcnl4000.o diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c new file mode 100644 index 0000000..e49cb97 --- /dev/null +++ b/drivers/iio/light/vcnl4000.c @@ -0,0 +1,217 @@ +/* + * vcnl4000.c - Support for Vishay VCNL4000 combined ambient light and + * proximity sensor + * + * Copyright 2012 Peter Meerwald + * + * This file is subject to the terms and conditions of version 2 of + * the GNU General Public License. See the file COPYING in the main + * directory of this archive for more details. + * + * IIO driver for VCNL4000 (7-bit I2C slave address 0x13) + * + * TODO: + * allow to adjust IR current + * proximity threshold and event handling + */ + +#include +#include +#include +#include + +#include +#include + +#define VCNL4000_DRV_NAME "vcnl4000" + +#define VCNL4000_COMMAND 0x80 /* Command register */ +#define VCNL4000_PROD_REV 0x81 /* Product ID and Revision ID */ +#define VCNL4000_LED_CURRENT 0x83 /* IR LED current for proximity mode */ +#define VCNL4000_AL_PARAM 0x84 /* Ambient light parameter register */ +#define VCNL4000_AL_RESULT_HI 0x85 /* Ambient light result register, MSB */ +#define VCNL4000_AL_RESULT_LO 0x86 /* Ambient light result register, LSB */ +#define VCNL4000_PS_RESULT_HI 0x87 /* Proximity result register, MSB */ +#define VCNL4000_PS_RESULT_LO 0x88 /* Proximity result register, LSB */ +#define VCNL4000_PS_MEAS_FREQ 0x89 /* Proximity test signal frequency */ +#define VCNL4000_PS_MOD_ADJ 0x8a /* Proximity modulator timing adjustment */ + +/* Bit masks for COMMAND register */ +#define VCNL4000_AL_RDY 0x40 /* ALS data ready? */ +#define VCNL4000_PS_RDY 0x20 /* proximity data ready? */ +#define VCNL4000_AL_OD 0x10 /* start on-demand ALS measurement */ +#define VCNL4000_PS_OD 0x08 /* start on-demand proximity measurement */ + +struct vcnl4000_data { + struct i2c_client *client; +}; + +static const struct i2c_device_id vcnl4000_id[] = { + { "vcnl4000", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, vcnl4000_id); + +static int vcnl4000_measure(struct vcnl4000_data *data, u8 req_mask, + u8 rdy_mask, u8 data_reg, int *val) +{ + int tries = 20; + u16 buf; + int ret; + + ret = i2c_smbus_write_byte_data(data->client, VCNL4000_COMMAND, + req_mask); + if (ret < 0) + return ret; + + /* wait for data to become ready */ + while (tries--) { + ret = i2c_smbus_read_byte_data(data->client, VCNL4000_COMMAND); + if (ret < 0) + return ret; + if (ret & rdy_mask) + break; + msleep(20); /* measurement takes up to 100 ms */ + } + + if (tries < 0) { + dev_err(&data->client->dev, + "vcnl4000_measure() failed, data not ready\n"); + return -EIO; + } + + ret = i2c_smbus_read_i2c_block_data(data->client, + data_reg, sizeof(buf), (u8 *) &buf); + if (ret < 0) + return ret; + + *val = be16_to_cpu(buf); + + return 0; +} + +static const struct iio_chan_spec vcnl4000_channels[] = { + { + .type = IIO_LIGHT, + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | + IIO_CHAN_INFO_SCALE_SEPARATE_BIT, + }, { + .type = IIO_PROXIMITY, + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT, + } +}; + +static int vcnl4000_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, int *val2, long mask) +{ + int ret = -EINVAL; + struct vcnl4000_data *data = iio_priv(indio_dev); + + switch (mask) { + case IIO_CHAN_INFO_RAW: + switch (chan->type) { + case IIO_LIGHT: + ret = vcnl4000_measure(data, + VCNL4000_AL_OD, VCNL4000_AL_RDY, + VCNL4000_AL_RESULT_HI, val); + if (ret < 0) + return ret; + ret = IIO_VAL_INT; + break; + case IIO_PROXIMITY: + ret = vcnl4000_measure(data, + VCNL4000_PS_OD, VCNL4000_PS_RDY, + VCNL4000_PS_RESULT_HI, val); + if (ret < 0) + return ret; + ret = IIO_VAL_INT; + break; + default: + break; + } + break; + case IIO_CHAN_INFO_SCALE: + if (chan->type == IIO_LIGHT) { + *val = 0; + *val2 = 250000; + ret = IIO_VAL_INT_PLUS_MICRO; + } + break; + default: + break; + } + + return ret; +} + +static const struct iio_info vcnl4000_info = { + .read_raw = vcnl4000_read_raw, + .driver_module = THIS_MODULE, +}; + +static int __devinit vcnl4000_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct vcnl4000_data *data; + struct iio_dev *indio_dev; + int ret; + + indio_dev = iio_device_alloc(sizeof(*data)); + if (!indio_dev) + return -ENOMEM; + + data = iio_priv(indio_dev); + i2c_set_clientdata(client, indio_dev); + data->client = client; + + ret = i2c_smbus_read_byte_data(data->client, VCNL4000_PROD_REV); + if (ret < 0) + goto error_free_dev; + + dev_info(&client->dev, "VCNL4000 Ambient light/proximity sensor, Prod %02x, Rev: %02x\n", + ret >> 4, ret & 0xf); + + indio_dev->dev.parent = &client->dev; + indio_dev->info = &vcnl4000_info; + indio_dev->channels = vcnl4000_channels; + indio_dev->num_channels = ARRAY_SIZE(vcnl4000_channels); + indio_dev->name = VCNL4000_DRV_NAME; + indio_dev->modes = INDIO_DIRECT_MODE; + + ret = iio_device_register(indio_dev); + if (ret < 0) + goto error_free_dev; + + return 0; + +error_free_dev: + iio_device_free(indio_dev); + return ret; +} + +static int __devexit vcnl4000_remove(struct i2c_client *client) +{ + struct iio_dev *indio_dev = i2c_get_clientdata(client); + + iio_device_unregister(indio_dev); + iio_device_free(indio_dev); + + return 0; +} + +static struct i2c_driver vcnl4000_driver = { + .driver = { + .name = VCNL4000_DRV_NAME, + .owner = THIS_MODULE, + }, + .probe = vcnl4000_probe, + .remove = __devexit_p(vcnl4000_remove), + .id_table = vcnl4000_id, +}; + +module_i2c_driver(vcnl4000_driver); + +MODULE_AUTHOR("Peter Meerwald "); +MODULE_DESCRIPTION("Vishay VCNL4000 proximity/ambient light sensor driver"); +MODULE_LICENSE("GPL"); -- cgit v0.10.2 From 924d37118f9e18825294b2012a10c6245d6c25e1 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Mon, 18 Jun 2012 19:15:50 -0700 Subject: pstore/ram: Probe as early as possible Registering the platform driver before module_init allows us to log oopses that happen during device probing. This requires changing module_init to postcore_initcall, and switching from platform_driver_probe to platform_driver_register because the platform device is not registered when the platform driver is registered; and because we use driver_register, now can't use create_bundle() (since it will try to register the same driver once again), so we have to switch to platform_device_register_data(). Also, some __init -> __devinit changes were needed. Overall, the registration logic is now much clearer, since we have only one driver registration point, and just an optional dummy device, which is created from the module parameters. Suggested-by: Colin Cross Signed-off-by: Anton Vorontsov Acked-by: Kees Cook Signed-off-by: Greg Kroah-Hartman diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index c7acf94..0b36e91 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -330,7 +330,7 @@ static int ramoops_init_prz(struct device *dev, struct ramoops_context *cxt, return 0; } -static int __init ramoops_probe(struct platform_device *pdev) +static int __devinit ramoops_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct ramoops_platform_data *pdata = pdev->dev.platform_data; @@ -452,6 +452,7 @@ static int __exit ramoops_remove(struct platform_device *pdev) } static struct platform_driver ramoops_driver = { + .probe = ramoops_probe, .remove = __exit_p(ramoops_remove), .driver = { .name = "ramoops", @@ -459,46 +460,46 @@ static struct platform_driver ramoops_driver = { }, }; -static int __init ramoops_init(void) +static void ramoops_register_dummy(void) { - int ret; - ret = platform_driver_probe(&ramoops_driver, ramoops_probe); - if (ret == -ENODEV) { - /* - * If we didn't find a platform device, we use module parameters - * building platform data on the fly. - */ - pr_info("platform device not found, using module parameters\n"); - dummy_data = kzalloc(sizeof(struct ramoops_platform_data), - GFP_KERNEL); - if (!dummy_data) - return -ENOMEM; - dummy_data->mem_size = mem_size; - dummy_data->mem_address = mem_address; - dummy_data->record_size = record_size; - dummy_data->console_size = ramoops_console_size; - dummy_data->dump_oops = dump_oops; - dummy_data->ecc = ramoops_ecc; - dummy = platform_create_bundle(&ramoops_driver, ramoops_probe, - NULL, 0, dummy_data, - sizeof(struct ramoops_platform_data)); - - if (IS_ERR(dummy)) - ret = PTR_ERR(dummy); - else - ret = 0; + if (!mem_size) + return; + + pr_info("using module parameters\n"); + + dummy_data = kzalloc(sizeof(*dummy_data), GFP_KERNEL); + if (!dummy_data) { + pr_info("could not allocate pdata\n"); + return; } - return ret; + dummy_data->mem_size = mem_size; + dummy_data->mem_address = mem_address; + dummy_data->record_size = record_size; + dummy_data->console_size = ramoops_console_size; + dummy_data->dump_oops = dump_oops; + dummy_data->ecc = ramoops_ecc; + + dummy = platform_device_register_data(NULL, "ramoops", -1, + dummy_data, sizeof(struct ramoops_platform_data)); + if (IS_ERR(dummy)) { + pr_info("could not create platform device: %ld\n", + PTR_ERR(dummy)); + } +} + +static int __init ramoops_init(void) +{ + ramoops_register_dummy(); + return platform_driver_register(&ramoops_driver); } +postcore_initcall(ramoops_init); static void __exit ramoops_exit(void) { platform_driver_unregister(&ramoops_driver); kfree(dummy_data); } - -module_init(ramoops_init); module_exit(ramoops_exit); MODULE_LICENSE("GPL"); diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index 0fd8161..2653185 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c @@ -390,7 +390,8 @@ static int persistent_ram_buffer_map(phys_addr_t start, phys_addr_t size, return 0; } -static int __init persistent_ram_post_init(struct persistent_ram_zone *prz, bool ecc) +static int __devinit persistent_ram_post_init(struct persistent_ram_zone *prz, + bool ecc) { int ret; @@ -436,9 +437,9 @@ void persistent_ram_free(struct persistent_ram_zone *prz) kfree(prz); } -struct persistent_ram_zone * __init persistent_ram_new(phys_addr_t start, - size_t size, - bool ecc) +struct persistent_ram_zone * __devinit persistent_ram_new(phys_addr_t start, + size_t size, + bool ecc) { struct persistent_ram_zone *prz; int ret = -ENOMEM; diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h index 2470bb5..e681af9 100644 --- a/include/linux/pstore_ram.h +++ b/include/linux/pstore_ram.h @@ -48,9 +48,9 @@ struct persistent_ram_zone { size_t old_log_size; }; -struct persistent_ram_zone * __init persistent_ram_new(phys_addr_t start, - size_t size, - bool ecc); +struct persistent_ram_zone * __devinit persistent_ram_new(phys_addr_t start, + size_t size, + bool ecc); void persistent_ram_free(struct persistent_ram_zone *prz); void persistent_ram_zap(struct persistent_ram_zone *prz); -- cgit v0.10.2 From 90b58d96907e0a45555429c0d3a79c85cea4b9fc Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Mon, 18 Jun 2012 19:15:51 -0700 Subject: pstore/ram: Fix error handling during przs allocation persistent_ram_new() returns ERR_PTR() value on errors, so during freeing of the przs we should check for both NULL and IS_ERR() entries, otherwise bad things will happen. Signed-off-by: Anton Vorontsov Acked-by: Kees Cook Signed-off-by: Greg Kroah-Hartman diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 0b36e91..58b93fb 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -260,7 +260,7 @@ static void ramoops_free_przs(struct ramoops_context *cxt) if (!cxt->przs) return; - for (i = 0; cxt->przs[i]; i++) + for (i = 0; !IS_ERR_OR_NULL(cxt->przs[i]); i++) persistent_ram_free(cxt->przs[i]); kfree(cxt->przs); } -- cgit v0.10.2 From beeb94321a7a6d493b4a06ff0cd771f09f41c35e Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Mon, 18 Jun 2012 19:15:52 -0700 Subject: pstore/ram_core: Proper checking for post_init errors (e.g. improper ECC size) We will implement variable-sized ECC buffers soon, so post_init routine might fail much more likely, so we'd better check for its errors. To make error handling simple, modify persistent_ram_free() to it be safe at all times. Signed-off-by: Anton Vorontsov Acked-by: Kees Cook Signed-off-by: Greg Kroah-Hartman diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index 2653185..f62ebf2 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c @@ -427,11 +427,17 @@ static int __devinit persistent_ram_post_init(struct persistent_ram_zone *prz, void persistent_ram_free(struct persistent_ram_zone *prz) { - if (pfn_valid(prz->paddr >> PAGE_SHIFT)) { - vunmap(prz->vaddr); - } else { - iounmap(prz->vaddr); - release_mem_region(prz->paddr, prz->size); + if (!prz) + return; + + if (prz->vaddr) { + if (pfn_valid(prz->paddr >> PAGE_SHIFT)) { + vunmap(prz->vaddr); + } else { + iounmap(prz->vaddr); + release_mem_region(prz->paddr, prz->size); + } + prz->vaddr = NULL; } persistent_ram_free_old(prz); kfree(prz); @@ -454,10 +460,12 @@ struct persistent_ram_zone * __devinit persistent_ram_new(phys_addr_t start, if (ret) goto err; - persistent_ram_post_init(prz, ecc); + ret = persistent_ram_post_init(prz, ecc); + if (ret) + goto err; return prz; err: - kfree(prz); + persistent_ram_free(prz); return ERR_PTR(ret); } -- cgit v0.10.2 From 1e6a9e56252399ae8c143f2327b4bb8cd289c3d5 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Mon, 18 Jun 2012 19:15:53 -0700 Subject: pstore/ram_core: Better ECC size checking - Instead of exploiting unsigned overflows (which doesn't work for all sizes), use straightforward checking for ECC total size not exceeding initial buffer size; - Printing overflowed buffer_size is not informative. Instead, print ecc_size and buffer_size; - No need for buffer_size argument in persistent_ram_init_ecc(), we can address prz->buffer_size directly. Signed-off-by: Anton Vorontsov Acked-by: Kees Cook Signed-off-by: Greg Kroah-Hartman diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index f62ebf2..a5a7b13 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c @@ -171,12 +171,12 @@ static void persistent_ram_ecc_old(struct persistent_ram_zone *prz) } } -static int persistent_ram_init_ecc(struct persistent_ram_zone *prz, - size_t buffer_size) +static int persistent_ram_init_ecc(struct persistent_ram_zone *prz) { int numerr; struct persistent_ram_buffer *buffer = prz->buffer; int ecc_blocks; + size_t ecc_total; if (!prz->ecc) return 0; @@ -187,14 +187,14 @@ static int persistent_ram_init_ecc(struct persistent_ram_zone *prz, prz->ecc_poly = 0x11d; ecc_blocks = DIV_ROUND_UP(prz->buffer_size, prz->ecc_block_size); - prz->buffer_size -= (ecc_blocks + 1) * prz->ecc_size; - - if (prz->buffer_size > buffer_size) { - pr_err("persistent_ram: invalid size %zu, non-ecc datasize %zu\n", - buffer_size, prz->buffer_size); + ecc_total = (ecc_blocks + 1) * prz->ecc_size; + if (ecc_total >= prz->buffer_size) { + pr_err("%s: invalid ecc_size %u (total %zu, buffer size %zu)\n", + __func__, prz->ecc_size, ecc_total, prz->buffer_size); return -EINVAL; } + prz->buffer_size -= ecc_total; prz->par_buffer = buffer->data + prz->buffer_size; prz->par_header = prz->par_buffer + ecc_blocks * prz->ecc_size; @@ -397,7 +397,7 @@ static int __devinit persistent_ram_post_init(struct persistent_ram_zone *prz, prz->ecc = ecc; - ret = persistent_ram_init_ecc(prz, prz->buffer_size); + ret = persistent_ram_init_ecc(prz); if (ret) return ret; -- cgit v0.10.2 From cc4fce7f1f3e3aa9fb6b3b242ba268ba3c6272d0 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 20 Jun 2012 19:23:54 -0700 Subject: staging: comedi: s626: local functions should not be exposed globally The 'ResetADC' function is prototyped as a static but is missing the static tag in it's definition. The function is only referenced in this file so add the static tag to the definition. This quiets a sparse warning about: warning: symbol 'ResetADC' was not declared. Should it be static? Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index d5edd9c..440060b 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -1348,7 +1348,7 @@ static void s626_detach(struct comedi_device *dev) /* * this functions build the RPS program for hardware driven acquistion */ -void ResetADC(struct comedi_device *dev, uint8_t * ppl) +static void ResetADC(struct comedi_device *dev, uint8_t *ppl) { register uint32_t *pRPS; uint32_t JmpAdrs; -- cgit v0.10.2 From 0588ea3467e8773ddc98dfccb67b646ead2abd31 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 20 Jun 2012 19:24:19 -0700 Subject: staging: comedi: s626: pointers should be cleared with NULL not 0 pdma->LogicalBase is a void *, NULL should be used to clear it not 0. This quiets a sparse warning about: warning: Using plain integer as NULL pointer Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 440060b..58c9e40 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -2779,7 +2779,7 @@ static void CloseDMAB(struct comedi_device *dev, struct bufferDMA *pdma, vpptr = pdma->PhysicalBase; if (vbptr) { pci_free_consistent(devpriv->pdev, bsize, vbptr, vpptr); - pdma->LogicalBase = 0; + pdma->LogicalBase = NULL; pdma->PhysicalBase = 0; DEBUG("CloseDMAB(): Logical=%p, bsize=%d, Physical=0x%x\n", -- cgit v0.10.2 From 020c44f3ad91b334f907a66eedba68f46dd39d25 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 20 Jun 2012 19:24:47 -0700 Subject: staging: comedi: s626: remove forward declarations 1 Move the s626_attach and s626_detach functions down to match the coding style of the other comedi drivers. Then remove the forward declarations that are no longer needed. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 58c9e40..0886806 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -207,70 +207,22 @@ static struct dio_private *dio_private_word[]={ #define devpriv ((struct s626_private *)dev->private) #define diopriv ((struct dio_private *)s->private) -/* ioctl routines */ -static int s626_ai_insn_config(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -/* static int s626_ai_rinsn(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data); */ -static int s626_ai_insn_read(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s); -static int s626_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd); -static int s626_ai_cancel(struct comedi_device *dev, - struct comedi_subdevice *s); -static int s626_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int s626_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int s626_dio_insn_bits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int s626_dio_insn_config(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); static int s626_dio_set_irq(struct comedi_device *dev, unsigned int chan); static int s626_dio_reset_irq(struct comedi_device *dev, unsigned int gruop, unsigned int mask); static int s626_dio_clear_irq(struct comedi_device *dev); -static int s626_enc_insn_config(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int s626_enc_insn_read(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int s626_enc_insn_write(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); static int s626_ns_to_timer(int *nanosec, int round_mode); -static int s626_ai_load_polllist(uint8_t *ppl, struct comedi_cmd *cmd); -static int s626_ai_inttrig(struct comedi_device *dev, - struct comedi_subdevice *s, unsigned int trignum); -static irqreturn_t s626_irq_handler(int irq, void *d); -static unsigned int s626_ai_reg_to_uint(int data); -/* static unsigned int s626_uint_to_reg(struct comedi_subdevice *s, int data); */ - -/* end ioctl routines */ /* internal routines */ -static void s626_dio_init(struct comedi_device *dev); -static void ResetADC(struct comedi_device *dev, uint8_t * ppl); -static void LoadTrimDACs(struct comedi_device *dev); static void WriteTrimDAC(struct comedi_device *dev, uint8_t LogicalChan, uint8_t DacData); static uint8_t I2Cread(struct comedi_device *dev, uint8_t addr); static uint32_t I2Chandshake(struct comedi_device *dev, uint32_t val); static void SetDAC(struct comedi_device *dev, uint16_t chan, short dacdata); static void SendDAC(struct comedi_device *dev, uint32_t val); -static void WriteMISC2(struct comedi_device *dev, uint16_t NewImage); static void DEBItransfer(struct comedi_device *dev); static uint16_t DEBIread(struct comedi_device *dev, uint16_t addr); static void DEBIwrite(struct comedi_device *dev, uint16_t addr, uint16_t wdata); -static void DEBIreplace(struct comedi_device *dev, uint16_t addr, uint16_t mask, - uint16_t wdata); -static void CloseDMAB(struct comedi_device *dev, struct bufferDMA *pdma, - size_t bsize); /* COUNTER OBJECT ------------------------------------------------ */ struct enc_private { @@ -295,7 +247,6 @@ struct enc_private { #define encpriv ((struct enc_private *)(dev->subdevices+5)->private) -/* counters routines */ static void s626_timer_load(struct comedi_device *dev, struct enc_private *k, int tick); static uint32_t ReadLatch(struct comedi_device *dev, struct enc_private *k); @@ -315,7 +266,6 @@ static uint16_t GetEnable_A(struct comedi_device *dev, struct enc_private *k); static uint16_t GetEnable_B(struct comedi_device *dev, struct enc_private *k); static void SetLatchSource(struct comedi_device *dev, struct enc_private *k, uint16_t value); -/* static uint16_t GetLatchSource(struct comedi_device *dev, struct enc_private *k ); */ static void SetLoadTrig_A(struct comedi_device *dev, struct enc_private *k, uint16_t Trig); static void SetLoadTrig_B(struct comedi_device *dev, struct enc_private *k, @@ -328,20 +278,10 @@ static void SetIntSrc_A(struct comedi_device *dev, struct enc_private *k, uint16_t IntSource); static uint16_t GetIntSrc_A(struct comedi_device *dev, struct enc_private *k); static uint16_t GetIntSrc_B(struct comedi_device *dev, struct enc_private *k); -/* static void SetClkMult(struct comedi_device *dev, struct enc_private *k, uint16_t value ) ; */ -/* static uint16_t GetClkMult(struct comedi_device *dev, struct enc_private *k ) ; */ -/* static void SetIndexPol(struct comedi_device *dev, struct enc_private *k, uint16_t value ); */ -/* static uint16_t GetClkPol(struct comedi_device *dev, struct enc_private *k ) ; */ -/* static void SetIndexSrc( struct comedi_device *dev,struct enc_private *k, uint16_t value ); */ -/* static uint16_t GetClkSrc( struct comedi_device *dev,struct enc_private *k ); */ -/* static void SetIndexSrc( struct comedi_device *dev,struct enc_private *k, uint16_t value ); */ -/* static uint16_t GetIndexSrc( struct comedi_device *dev,struct enc_private *k ); */ static void PulseIndex_A(struct comedi_device *dev, struct enc_private *k); static void PulseIndex_B(struct comedi_device *dev, struct enc_private *k); static void Preload(struct comedi_device *dev, struct enc_private *k, uint32_t value); -static void CountersInit(struct comedi_device *dev); -/* end internal routines */ /* Counter objects constructor. */ @@ -486,2814 +426,2814 @@ static const struct comedi_lrange s626_range_table = { 2, { } }; -static int s626_attach(struct comedi_device *dev, struct comedi_devconfig *it) +static unsigned int s626_ai_reg_to_uint(int data) { -/* uint8_t PollList; */ -/* uint16_t AdcData; */ -/* uint16_t StartVal; */ -/* uint16_t index; */ -/* unsigned int data[16]; */ - int result; - int i; - int ret; - resource_size_t resourceStart; - dma_addr_t appdma; - struct comedi_subdevice *s; - struct pci_dev *pdev = NULL; + unsigned int tempdata; - if (alloc_private(dev, sizeof(struct s626_private)) < 0) - return -ENOMEM; + tempdata = (data >> 18); + if (tempdata & 0x2000) + tempdata &= 0x1fff; + else + tempdata += (1 << 13); - for (i = 0; i < ARRAY_SIZE(s626_boards) && !pdev; i++) { - do { - pdev = pci_get_subsys(s626_boards[i].vendor_id, - s626_boards[i].device_id, - s626_boards[i].subvendor_id, - s626_boards[i].subdevice_id, - pdev); + return tempdata; +} - if ((it->options[0] || it->options[1]) && pdev) { - /* matches requested bus/slot */ - if (pdev->bus->number == it->options[0] && - PCI_SLOT(pdev->devfn) == it->options[1]) - break; - } else - break; - } while (1); - } - devpriv->pdev = pdev; +/* static unsigned int s626_uint_to_reg(struct comedi_subdevice *s, int data){ */ +/* return 0; */ +/* } */ - if (pdev == NULL) { - printk(KERN_ERR "s626_attach: Board not present!!!\n"); - return -ENODEV; - } +static irqreturn_t s626_irq_handler(int irq, void *d) +{ + struct comedi_device *dev = d; + struct comedi_subdevice *s; + struct comedi_cmd *cmd; + struct enc_private *k; + unsigned long flags; + int32_t *readaddr; + uint32_t irqtype, irqstatus; + int i = 0; + short tempdata; + uint8_t group; + uint16_t irqbit; - result = comedi_pci_enable(pdev, "s626"); - if (result < 0) { - printk(KERN_ERR "s626_attach: comedi_pci_enable fails\n"); - return -ENODEV; - } - devpriv->got_regions = 1; + DEBUG("s626_irq_handler: interrupt request received!!!\n"); - resourceStart = pci_resource_start(devpriv->pdev, 0); + if (dev->attached == 0) + return IRQ_NONE; + /* lock to avoid race with comedi_poll */ + spin_lock_irqsave(&dev->spinlock, flags); - devpriv->base_addr = ioremap(resourceStart, SIZEOF_ADDRESS_SPACE); - if (devpriv->base_addr == NULL) { - printk(KERN_ERR "s626_attach: IOREMAP failed\n"); - return -ENODEV; - } + /* save interrupt enable register state */ + irqstatus = readl(devpriv->base_addr + P_IER); - if (devpriv->base_addr) { - /* disable master interrupt */ - writel(0, devpriv->base_addr + P_IER); + /* read interrupt type */ + irqtype = readl(devpriv->base_addr + P_ISR); - /* soft reset */ - writel(MC1_SOFT_RESET, devpriv->base_addr + P_MC1); + /* disable master interrupt */ + writel(0, devpriv->base_addr + P_IER); - /* DMA FIXME DMA// */ - DEBUG("s626_attach: DMA ALLOCATION\n"); + /* clear interrupt */ + writel(irqtype, devpriv->base_addr + P_ISR); - /* adc buffer allocation */ - devpriv->allocatedBuf = 0; + /* do somethings */ + DEBUG("s626_irq_handler: interrupt type %d\n", irqtype); - devpriv->ANABuf.LogicalBase = - pci_alloc_consistent(devpriv->pdev, DMABUF_SIZE, &appdma); + switch (irqtype) { + case IRQ_RPS1: /* end_of_scan occurs */ - if (devpriv->ANABuf.LogicalBase == NULL) { - printk(KERN_ERR "s626_attach: DMA Memory mapping error\n"); - return -ENOMEM; - } + DEBUG("s626_irq_handler: RPS1 irq detected\n"); - devpriv->ANABuf.PhysicalBase = appdma; + /* manage ai subdevice */ + s = dev->subdevices; + cmd = &(s->async->cmd); - DEBUG - ("s626_attach: AllocDMAB ADC Logical=%p, bsize=%d, Physical=0x%x\n", - devpriv->ANABuf.LogicalBase, DMABUF_SIZE, - (uint32_t) devpriv->ANABuf.PhysicalBase); + /* Init ptr to DMA buffer that holds new ADC data. We skip the + * first uint16_t in the buffer because it contains junk data from + * the final ADC of the previous poll list scan. + */ + readaddr = (int32_t *) devpriv->ANABuf.LogicalBase + 1; - devpriv->allocatedBuf++; + /* get the data and hand it over to comedi */ + for (i = 0; i < (s->async->cmd.chanlist_len); i++) { + /* Convert ADC data to 16-bit integer values and copy to application */ + /* buffer. */ + tempdata = s626_ai_reg_to_uint((int)*readaddr); + readaddr++; - devpriv->RPSBuf.LogicalBase = - pci_alloc_consistent(devpriv->pdev, DMABUF_SIZE, &appdma); + /* put data into read buffer */ + /* comedi_buf_put(s->async, tempdata); */ + if (cfc_write_to_buffer(s, tempdata) == 0) + printk + ("s626_irq_handler: cfc_write_to_buffer error!\n"); - if (devpriv->RPSBuf.LogicalBase == NULL) { - printk(KERN_ERR "s626_attach: DMA Memory mapping error\n"); - return -ENOMEM; + DEBUG("s626_irq_handler: ai channel %d acquired: %d\n", + i, tempdata); } - devpriv->RPSBuf.PhysicalBase = appdma; - - DEBUG - ("s626_attach: AllocDMAB RPS Logical=%p, bsize=%d, Physical=0x%x\n", - devpriv->RPSBuf.LogicalBase, DMABUF_SIZE, - (uint32_t) devpriv->RPSBuf.PhysicalBase); + /* end of scan occurs */ + s->async->events |= COMEDI_CB_EOS; - devpriv->allocatedBuf++; + if (!(devpriv->ai_continous)) + devpriv->ai_sample_count--; + if (devpriv->ai_sample_count <= 0) { + devpriv->ai_cmd_running = 0; - } + /* Stop RPS program. */ + MC_DISABLE(P_MC1, MC1_ERPS1); - dev->board_ptr = s626_boards; - dev->board_name = thisboard->name; + /* send end of acquisition */ + s->async->events |= COMEDI_CB_EOA; - ret = comedi_alloc_subdevices(dev, 6); - if (ret) - return ret; + /* disable master interrupt */ + irqstatus = 0; + } - dev->iobase = (unsigned long)devpriv->base_addr; - dev->irq = devpriv->pdev->irq; + if (devpriv->ai_cmd_running && cmd->scan_begin_src == TRIG_EXT) { + DEBUG + ("s626_irq_handler: enable interrupt on dio channel %d\n", + cmd->scan_begin_arg); - /* set up interrupt handler */ - if (dev->irq == 0) { - printk(KERN_ERR " unknown irq (bad)\n"); - } else { - ret = request_irq(dev->irq, s626_irq_handler, IRQF_SHARED, - "s626", dev); + s626_dio_set_irq(dev, cmd->scan_begin_arg); - if (ret < 0) { - printk(KERN_ERR " irq not available\n"); - dev->irq = 0; + DEBUG("s626_irq_handler: External trigger is set!!!\n"); } - } - - DEBUG("s626_attach: -- it opts %d,%d --\n", - it->options[0], it->options[1]); + /* tell comedi that data is there */ + DEBUG("s626_irq_handler: events %d\n", s->async->events); + comedi_event(dev, s); + break; + case IRQ_GPIO3: /* check dio and conter interrupt */ - s = dev->subdevices + 0; - /* analog input subdevice */ - dev->read_subdev = s; - /* we support single-ended (ground) and differential */ - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_DIFF | SDF_CMD_READ; - s->n_chan = thisboard->ai_chans; - s->maxdata = (0xffff >> 2); - s->range_table = &s626_range_table; - s->len_chanlist = thisboard->ai_chans; /* This is the maximum chanlist - length that the board can - handle */ - s->insn_config = s626_ai_insn_config; - s->insn_read = s626_ai_insn_read; - s->do_cmd = s626_ai_cmd; - s->do_cmdtest = s626_ai_cmdtest; - s->cancel = s626_ai_cancel; + DEBUG("s626_irq_handler: GPIO3 irq detected\n"); - s = dev->subdevices + 1; - /* analog output subdevice */ - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = thisboard->ao_chans; - s->maxdata = (0x3fff); - s->range_table = &range_bipolar10; - s->insn_write = s626_ao_winsn; - s->insn_read = s626_ao_rinsn; + /* manage ai subdevice */ + s = dev->subdevices; + cmd = &(s->async->cmd); - s = dev->subdevices + 2; - /* digital I/O subdevice */ - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = S626_DIO_CHANNELS; - s->maxdata = 1; - s->io_bits = 0xffff; - s->private = &dio_private_A; - s->range_table = &range_digital; - s->insn_config = s626_dio_insn_config; - s->insn_bits = s626_dio_insn_bits; + /* s626_dio_clear_irq(dev); */ - s = dev->subdevices + 3; - /* digital I/O subdevice */ - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = 16; - s->maxdata = 1; - s->io_bits = 0xffff; - s->private = &dio_private_B; - s->range_table = &range_digital; - s->insn_config = s626_dio_insn_config; - s->insn_bits = s626_dio_insn_bits; + for (group = 0; group < S626_DIO_BANKS; group++) { + irqbit = 0; + /* read interrupt type */ + irqbit = DEBIread(dev, + ((struct dio_private *)(dev-> + subdevices + + 2 + + group)-> + private)->RDCapFlg); - s = dev->subdevices + 4; - /* digital I/O subdevice */ - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = 16; - s->maxdata = 1; - s->io_bits = 0xffff; - s->private = &dio_private_C; - s->range_table = &range_digital; - s->insn_config = s626_dio_insn_config; - s->insn_bits = s626_dio_insn_bits; + /* check if interrupt is generated from dio channels */ + if (irqbit) { + s626_dio_reset_irq(dev, group, irqbit); + DEBUG + ("s626_irq_handler: check interrupt on dio group %d %d\n", + group, i); + if (devpriv->ai_cmd_running) { + /* check if interrupt is an ai acquisition start trigger */ + if ((irqbit >> (cmd->start_arg - + (16 * group))) + == 1 && cmd->start_src == TRIG_EXT) { + DEBUG + ("s626_irq_handler: Edge capture interrupt received from channel %d\n", + cmd->start_arg); - s = dev->subdevices + 5; - /* encoder (counter) subdevice */ - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE | SDF_LSAMPL; - s->n_chan = thisboard->enc_chans; - s->private = enc_private_data; - s->insn_config = s626_enc_insn_config; - s->insn_read = s626_enc_insn_read; - s->insn_write = s626_enc_insn_write; - s->maxdata = 0xffffff; - s->range_table = &range_unknown; + /* Start executing the RPS program. */ + MC_ENABLE(P_MC1, MC1_ERPS1); - /* stop ai_command */ - devpriv->ai_cmd_running = 0; + DEBUG + ("s626_irq_handler: acquisition start triggered!!!\n"); - if (devpriv->base_addr && (devpriv->allocatedBuf == 2)) { - dma_addr_t pPhysBuf; - uint16_t chan; + if (cmd->scan_begin_src == + TRIG_EXT) { + DEBUG + ("s626_ai_cmd: enable interrupt on dio channel %d\n", + cmd-> + scan_begin_arg); - /* enab DEBI and audio pins, enable I2C interface. */ - MC_ENABLE(P_MC1, MC1_DEBI | MC1_AUDIO | MC1_I2C); - /* Configure DEBI operating mode. */ - WR7146(P_DEBICFG, DEBI_CFG_SLAVE16 /* Local bus is 16 */ - /* bits wide. */ - | (DEBI_TOUT << DEBI_CFG_TOUT_BIT) + s626_dio_set_irq(dev, + cmd->scan_begin_arg); - /* Declare DEBI */ - /* transfer timeout */ - /* interval. */ - |DEBI_SWAP /* Set up byte lane */ - /* steering. */ - | DEBI_CFG_INTEL); /* Intel-compatible */ - /* local bus (DEBI */ - /* never times out). */ - DEBUG("s626_attach: %d debi init -- %d\n", - DEBI_CFG_SLAVE16 | (DEBI_TOUT << DEBI_CFG_TOUT_BIT) | - DEBI_SWAP | DEBI_CFG_INTEL, - DEBI_CFG_INTEL | DEBI_CFG_TOQ | DEBI_CFG_INCQ | - DEBI_CFG_16Q); + DEBUG + ("s626_irq_handler: External scan trigger is set!!!\n"); + } + } + if ((irqbit >> (cmd->scan_begin_arg - + (16 * group))) + == 1 + && cmd->scan_begin_src == + TRIG_EXT) { + DEBUG + ("s626_irq_handler: Edge capture interrupt received from channel %d\n", + cmd->scan_begin_arg); - /* DEBI INIT S626 WR7146( P_DEBICFG, DEBI_CFG_INTEL | DEBI_CFG_TOQ */ - /* | DEBI_CFG_INCQ| DEBI_CFG_16Q); //end */ + /* Trigger ADC scan loop start by setting RPS Signal 0. */ + MC_ENABLE(P_MC2, MC2_ADC_RPS); - /* Paging is disabled. */ - WR7146(P_DEBIPAGE, DEBI_PAGE_DISABLE); /* Disable MMU paging. */ + DEBUG + ("s626_irq_handler: scan triggered!!! %d\n", + devpriv->ai_sample_count); + if (cmd->convert_src == + TRIG_EXT) { - /* Init GPIO so that ADC Start* is negated. */ - WR7146(P_GPIO, GPIO_BASE | GPIO1_HI); + DEBUG + ("s626_ai_cmd: enable interrupt on dio channel %d group %d\n", + cmd->convert_arg - + (16 * group), + group); - /* IsBoardRevA is a boolean that indicates whether the board is RevA. - * - * VERSION 2.01 CHANGE: REV A & B BOARDS NOW SUPPORTED BY DYNAMIC - * EEPROM ADDRESS SELECTION. Initialize the I2C interface, which - * is used to access the onboard serial EEPROM. The EEPROM's I2C - * DeviceAddress is hardwired to a value that is dependent on the - * 626 board revision. On all board revisions, the EEPROM stores - * TrimDAC calibration constants for analog I/O. On RevB and - * higher boards, the DeviceAddress is hardwired to 0 to enable - * the EEPROM to also store the PCI SubVendorID and SubDeviceID; - * this is the address at which the SAA7146 expects a - * configuration EEPROM to reside. On RevA boards, the EEPROM - * device address, which is hardwired to 4, prevents the SAA7146 - * from retrieving PCI sub-IDs, so the SAA7146 uses its built-in - * default values, instead. - */ + devpriv->ai_convert_count + = cmd->chanlist_len; - /* devpriv->I2Cards= IsBoardRevA ? 0xA8 : 0xA0; // Set I2C EEPROM */ - /* DeviceType (0xA0) */ - /* and DeviceAddress<<1. */ + s626_dio_set_irq(dev, + cmd->convert_arg); - devpriv->I2CAdrs = 0xA0; /* I2C device address for onboard */ - /* eeprom(revb) */ + DEBUG + ("s626_irq_handler: External convert trigger is set!!!\n"); + } - /* Issue an I2C ABORT command to halt any I2C operation in */ - /* progress and reset BUSY flag. */ - WR7146(P_I2CSTAT, I2C_CLKSEL | I2C_ABORT); - /* Write I2C control: abort any I2C activity. */ - MC_ENABLE(P_MC2, MC2_UPLD_IIC); - /* Invoke command upload */ - while ((RR7146(P_MC2) & MC2_UPLD_IIC) == 0) - ; - /* and wait for upload to complete. */ + if (cmd->convert_src == + TRIG_TIMER) { + k = &encpriv[5]; + devpriv->ai_convert_count + = cmd->chanlist_len; + k->SetEnable(dev, k, + CLKENAB_ALWAYS); + } + } + if ((irqbit >> (cmd->convert_arg - + (16 * group))) + == 1 + && cmd->convert_src == TRIG_EXT) { + DEBUG + ("s626_irq_handler: Edge capture interrupt received from channel %d\n", + cmd->convert_arg); - /* Per SAA7146 data sheet, write to STATUS reg twice to - * reset all I2C error flags. */ - for (i = 0; i < 2; i++) { - WR7146(P_I2CSTAT, I2C_CLKSEL); - /* Write I2C control: reset error flags. */ - MC_ENABLE(P_MC2, MC2_UPLD_IIC); /* Invoke command upload */ - while (!MC_TEST(P_MC2, MC2_UPLD_IIC)) - ; - /* and wait for upload to complete. */ - } + /* Trigger ADC scan loop start by setting RPS Signal 0. */ + MC_ENABLE(P_MC2, MC2_ADC_RPS); - /* Init audio interface functional attributes: set DAC/ADC - * serial clock rates, invert DAC serial clock so that - * DAC data setup times are satisfied, enable DAC serial - * clock out. - */ + DEBUG + ("s626_irq_handler: adc convert triggered!!!\n"); - WR7146(P_ACON2, ACON2_INIT); + devpriv->ai_convert_count--; - /* Set up TSL1 slot list, which is used to control the - * accumulation of ADC data: RSD1 = shift data in on SD1. - * SIB_A1 = store data uint8_t at next available location in - * FB BUFFER1 register. */ - WR7146(P_TSL1, RSD1 | SIB_A1); - /* Fetch ADC high data uint8_t. */ - WR7146(P_TSL1 + 4, RSD1 | SIB_A1 | EOS); - /* Fetch ADC low data uint8_t; end of TSL1. */ + if (devpriv->ai_convert_count > + 0) { - /* enab TSL1 slot list so that it executes all the time. */ - WR7146(P_ACON1, ACON1_ADCSTART); + DEBUG + ("s626_ai_cmd: enable interrupt on dio channel %d group %d\n", + cmd->convert_arg - + (16 * group), + group); - /* Initialize RPS registers used for ADC. */ + s626_dio_set_irq(dev, + cmd->convert_arg); - /* Physical start of RPS program. */ - WR7146(P_RPSADDR1, (uint32_t) devpriv->RPSBuf.PhysicalBase); + DEBUG + ("s626_irq_handler: External trigger is set!!!\n"); + } + } + } + break; + } + } - WR7146(P_RPSPAGE1, 0); - /* RPS program performs no explicit mem writes. */ - WR7146(P_RPS1_TOUT, 0); /* Disable RPS timeouts. */ + /* read interrupt type */ + irqbit = DEBIread(dev, LP_RDMISC2); - /* SAA7146 BUG WORKAROUND. Initialize SAA7146 ADC interface - * to a known state by invoking ADCs until FB BUFFER 1 - * register shows that it is correctly receiving ADC data. - * This is necessary because the SAA7146 ADC interface does - * not start up in a defined state after a PCI reset. - */ + /* check interrupt on counters */ + DEBUG("s626_irq_handler: check counters interrupt %d\n", + irqbit); -/* PollList = EOPL; // Create a simple polling */ -/* // list for analog input */ -/* // channel 0. */ -/* ResetADC( dev, &PollList ); */ + if (irqbit & IRQ_COINT1A) { + DEBUG + ("s626_irq_handler: interrupt on counter 1A overflow\n"); + k = &encpriv[0]; -/* s626_ai_rinsn(dev,dev->subdevices,NULL,data); //( &AdcData ); // */ -/* //Get initial ADC */ -/* //value. */ + /* clear interrupt capture flag */ + k->ResetCapFlags(dev, k); + } + if (irqbit & IRQ_COINT2A) { + DEBUG + ("s626_irq_handler: interrupt on counter 2A overflow\n"); + k = &encpriv[1]; -/* StartVal = data[0]; */ - -/* // VERSION 2.01 CHANGE: TIMEOUT ADDED TO PREVENT HANGED EXECUTION. */ -/* // Invoke ADCs until the new ADC value differs from the initial */ -/* // value or a timeout occurs. The timeout protects against the */ -/* // possibility that the driver is restarting and the ADC data is a */ -/* // fixed value resulting from the applied ADC analog input being */ -/* // unusually quiet or at the rail. */ + /* clear interrupt capture flag */ + k->ResetCapFlags(dev, k); + } + if (irqbit & IRQ_COINT3A) { + DEBUG + ("s626_irq_handler: interrupt on counter 3A overflow\n"); + k = &encpriv[2]; -/* for ( index = 0; index < 500; index++ ) */ -/* { */ -/* s626_ai_rinsn(dev,dev->subdevices,NULL,data); */ -/* AdcData = data[0]; //ReadADC( &AdcData ); */ -/* if ( AdcData != StartVal ) */ -/* break; */ -/* } */ + /* clear interrupt capture flag */ + k->ResetCapFlags(dev, k); + } + if (irqbit & IRQ_COINT1B) { + DEBUG + ("s626_irq_handler: interrupt on counter 1B overflow\n"); + k = &encpriv[3]; - /* end initADC */ + /* clear interrupt capture flag */ + k->ResetCapFlags(dev, k); + } + if (irqbit & IRQ_COINT2B) { + DEBUG + ("s626_irq_handler: interrupt on counter 2B overflow\n"); + k = &encpriv[4]; - /* init the DAC interface */ + /* clear interrupt capture flag */ + k->ResetCapFlags(dev, k); - /* Init Audio2's output DMAC attributes: burst length = 1 - * DWORD, threshold = 1 DWORD. - */ - WR7146(P_PCI_BT_A, 0); + if (devpriv->ai_convert_count > 0) { + devpriv->ai_convert_count--; + if (devpriv->ai_convert_count == 0) + k->SetEnable(dev, k, CLKENAB_INDEX); - /* Init Audio2's output DMA physical addresses. The protection - * address is set to 1 DWORD past the base address so that a - * single DWORD will be transferred each time a DMA transfer is - * enabled. */ + if (cmd->convert_src == TRIG_TIMER) { + DEBUG + ("s626_irq_handler: conver timer trigger!!! %d\n", + devpriv->ai_convert_count); - pPhysBuf = - devpriv->ANABuf.PhysicalBase + - (DAC_WDMABUF_OS * sizeof(uint32_t)); + /* Trigger ADC scan loop start by setting RPS Signal 0. */ + MC_ENABLE(P_MC2, MC2_ADC_RPS); + } + } + } + if (irqbit & IRQ_COINT3B) { + DEBUG + ("s626_irq_handler: interrupt on counter 3B overflow\n"); + k = &encpriv[5]; - WR7146(P_BASEA2_OUT, (uint32_t) pPhysBuf); /* Buffer base adrs. */ - WR7146(P_PROTA2_OUT, (uint32_t) (pPhysBuf + sizeof(uint32_t))); /* Protection address. */ + /* clear interrupt capture flag */ + k->ResetCapFlags(dev, k); - /* Cache Audio2's output DMA buffer logical address. This is - * where DAC data is buffered for A2 output DMA transfers. */ - devpriv->pDacWBuf = - (uint32_t *) devpriv->ANABuf.LogicalBase + DAC_WDMABUF_OS; + if (cmd->scan_begin_src == TRIG_TIMER) { + DEBUG + ("s626_irq_handler: scan timer trigger!!!\n"); - /* Audio2's output channels does not use paging. The protection - * violation handling bit is set so that the DMAC will - * automatically halt and its PCI address pointer will be reset - * when the protection address is reached. */ + /* Trigger ADC scan loop start by setting RPS Signal 0. */ + MC_ENABLE(P_MC2, MC2_ADC_RPS); + } - WR7146(P_PAGEA2_OUT, 8); + if (cmd->convert_src == TRIG_TIMER) { + DEBUG + ("s626_irq_handler: convert timer trigger is set\n"); + k = &encpriv[4]; + devpriv->ai_convert_count = cmd->chanlist_len; + k->SetEnable(dev, k, CLKENAB_ALWAYS); + } + } + } - /* Initialize time slot list 2 (TSL2), which is used to control - * the clock generation for and serialization of data to be sent - * to the DAC devices. Slot 0 is a NOP that is used to trap TSL - * execution; this permits other slots to be safely modified - * without first turning off the TSL sequencer (which is - * apparently impossible to do). Also, SD3 (which is driven by a - * pull-up resistor) is shifted in and stored to the MSB of - * FB_BUFFER2 to be used as evidence that the slot sequence has - * not yet finished executing. - */ + /* enable interrupt */ + writel(irqstatus, devpriv->base_addr + P_IER); - SETVECT(0, XSD2 | RSD3 | SIB_A2 | EOS); - /* Slot 0: Trap TSL execution, shift 0xFF into FB_BUFFER2. */ + DEBUG("s626_irq_handler: exit interrupt service routine.\n"); - /* Initialize slot 1, which is constant. Slot 1 causes a - * DWORD to be transferred from audio channel 2's output FIFO - * to the FIFO's output buffer so that it can be serialized - * and sent to the DAC during subsequent slots. All remaining - * slots are dynamically populated as required by the target - * DAC device. - */ - SETVECT(1, LF_A2); - /* Slot 1: Fetch DWORD from Audio2's output FIFO. */ + spin_unlock_irqrestore(&dev->spinlock, flags); + return IRQ_HANDLED; +} - /* Start DAC's audio interface (TSL2) running. */ - WR7146(P_ACON1, ACON1_DACSTART); +/* + * this functions build the RPS program for hardware driven acquistion + */ +static void ResetADC(struct comedi_device *dev, uint8_t *ppl) +{ + register uint32_t *pRPS; + uint32_t JmpAdrs; + uint16_t i; + uint16_t n; + uint32_t LocalPPL; + struct comedi_cmd *cmd = &(dev->subdevices->async->cmd); - /* end init DAC interface */ + /* Stop RPS program in case it is currently running. */ + MC_DISABLE(P_MC1, MC1_ERPS1); - /* Init Trim DACs to calibrated values. Do it twice because the - * SAA7146 audio channel does not always reset properly and - * sometimes causes the first few TrimDAC writes to malfunction. - */ + /* Set starting logical address to write RPS commands. */ + pRPS = (uint32_t *) devpriv->RPSBuf.LogicalBase; - LoadTrimDACs(dev); - LoadTrimDACs(dev); /* Insurance. */ + /* Initialize RPS instruction pointer. */ + WR7146(P_RPSADDR1, (uint32_t) devpriv->RPSBuf.PhysicalBase); - /* Manually init all gate array hardware in case this is a soft - * reset (we have no way of determining whether this is a warm - * or cold start). This is necessary because the gate array will - * reset only in response to a PCI hard reset; there is no soft - * reset function. */ + /* Construct RPS program in RPSBuf DMA buffer */ - /* Init all DAC outputs to 0V and init all DAC setpoint and - * polarity images. - */ - for (chan = 0; chan < S626_DAC_CHANNELS; chan++) - SetDAC(dev, chan, 0); + if (cmd != NULL && cmd->scan_begin_src != TRIG_FOLLOW) { + DEBUG("ResetADC: scan_begin pause inserted\n"); + /* Wait for Start trigger. */ + *pRPS++ = RPS_PAUSE | RPS_SIGADC; + *pRPS++ = RPS_CLRSIGNAL | RPS_SIGADC; + } - /* Init image of WRMISC2 Battery Charger Enabled control bit. - * This image is used when the state of the charger control bit, - * which has no direct hardware readback mechanism, is queried. - */ - devpriv->ChargeEnabled = 0; + /* SAA7146 BUG WORKAROUND Do a dummy DEBI Write. This is necessary + * because the first RPS DEBI Write following a non-RPS DEBI write + * seems to always fail. If we don't do this dummy write, the ADC + * gain might not be set to the value required for the first slot in + * the poll list; the ADC gain would instead remain unchanged from + * the previously programmed value. + */ + *pRPS++ = RPS_LDREG | (P_DEBICMD >> 2); + /* Write DEBI Write command and address to shadow RAM. */ - /* Init image of watchdog timer interval in WRMISC2. This image - * maintains the value of the control bits of MISC2 are - * continuously reset to zero as long as the WD timer is disabled. - */ - devpriv->WDInterval = 0; + *pRPS++ = DEBI_CMD_WRWORD | LP_GSEL; + *pRPS++ = RPS_LDREG | (P_DEBIAD >> 2); + /* Write DEBI immediate data to shadow RAM: */ - /* Init Counter Interrupt enab mask for RDMISC2. This mask is - * applied against MISC2 when testing to determine which timer - * events are requesting interrupt service. - */ - devpriv->CounterIntEnabs = 0; + *pRPS++ = GSEL_BIPOLAR5V; + /* arbitrary immediate data value. */ - /* Init counters. */ - CountersInit(dev); + *pRPS++ = RPS_CLRSIGNAL | RPS_DEBI; + /* Reset "shadow RAM uploaded" flag. */ + *pRPS++ = RPS_UPLOAD | RPS_DEBI; /* Invoke shadow RAM upload. */ + *pRPS++ = RPS_PAUSE | RPS_DEBI; /* Wait for shadow upload to finish. */ - /* Without modifying the state of the Battery Backup enab, disable - * the watchdog timer, set DIO channels 0-5 to operate in the - * standard DIO (vs. counter overflow) mode, disable the battery - * charger, and reset the watchdog interval selector to zero. + /* Digitize all slots in the poll list. This is implemented as a + * for loop to limit the slot count to 16 in case the application + * forgot to set the EOPL flag in the final slot. + */ + for (devpriv->AdcItems = 0; devpriv->AdcItems < 16; devpriv->AdcItems++) { + /* Convert application's poll list item to private board class + * format. Each app poll list item is an uint8_t with form + * (EOPL,x,x,RANGE,CHAN<3:0>), where RANGE code indicates 0 = + * +-10V, 1 = +-5V, and EOPL = End of Poll List marker. */ - WriteMISC2(dev, (uint16_t) (DEBIread(dev, - LP_RDMISC2) & - MISC2_BATT_ENABLE)); + LocalPPL = + (*ppl << 8) | (*ppl & 0x10 ? GSEL_BIPOLAR5V : + GSEL_BIPOLAR10V); - /* Initialize the digital I/O subsystem. */ - s626_dio_init(dev); + /* Switch ADC analog gain. */ + *pRPS++ = RPS_LDREG | (P_DEBICMD >> 2); /* Write DEBI command */ + /* and address to */ + /* shadow RAM. */ + *pRPS++ = DEBI_CMD_WRWORD | LP_GSEL; + *pRPS++ = RPS_LDREG | (P_DEBIAD >> 2); /* Write DEBI */ + /* immediate data to */ + /* shadow RAM. */ + *pRPS++ = LocalPPL; + *pRPS++ = RPS_CLRSIGNAL | RPS_DEBI; /* Reset "shadow RAM uploaded" */ + /* flag. */ + *pRPS++ = RPS_UPLOAD | RPS_DEBI; /* Invoke shadow RAM upload. */ + *pRPS++ = RPS_PAUSE | RPS_DEBI; /* Wait for shadow upload to */ + /* finish. */ - /* enable interrupt test */ - /* writel(IRQ_GPIO3 | IRQ_RPS1,devpriv->base_addr+P_IER); */ - } + /* Select ADC analog input channel. */ + *pRPS++ = RPS_LDREG | (P_DEBICMD >> 2); + /* Write DEBI command and address to shadow RAM. */ + *pRPS++ = DEBI_CMD_WRWORD | LP_ISEL; + *pRPS++ = RPS_LDREG | (P_DEBIAD >> 2); + /* Write DEBI immediate data to shadow RAM. */ + *pRPS++ = LocalPPL; + *pRPS++ = RPS_CLRSIGNAL | RPS_DEBI; + /* Reset "shadow RAM uploaded" flag. */ - DEBUG("s626_attach: comedi%d s626 attached %04x\n", dev->minor, - (uint32_t) devpriv->base_addr); + *pRPS++ = RPS_UPLOAD | RPS_DEBI; + /* Invoke shadow RAM upload. */ - return 1; -} + *pRPS++ = RPS_PAUSE | RPS_DEBI; + /* Wait for shadow upload to finish. */ -static unsigned int s626_ai_reg_to_uint(int data) -{ - unsigned int tempdata; + /* Delay at least 10 microseconds for analog input settling. + * Instead of padding with NOPs, we use RPS_JUMP instructions + * here; this allows us to produce a longer delay than is + * possible with NOPs because each RPS_JUMP flushes the RPS' + * instruction prefetch pipeline. + */ + JmpAdrs = + (uint32_t) devpriv->RPSBuf.PhysicalBase + + (uint32_t) ((unsigned long)pRPS - + (unsigned long)devpriv->RPSBuf.LogicalBase); + for (i = 0; i < (10 * RPSCLK_PER_US / 2); i++) { + JmpAdrs += 8; /* Repeat to implement time delay: */ + *pRPS++ = RPS_JUMP; /* Jump to next RPS instruction. */ + *pRPS++ = JmpAdrs; + } - tempdata = (data >> 18); - if (tempdata & 0x2000) - tempdata &= 0x1fff; - else - tempdata += (1 << 13); + if (cmd != NULL && cmd->convert_src != TRIG_NOW) { + DEBUG("ResetADC: convert pause inserted\n"); + /* Wait for Start trigger. */ + *pRPS++ = RPS_PAUSE | RPS_SIGADC; + *pRPS++ = RPS_CLRSIGNAL | RPS_SIGADC; + } + /* Start ADC by pulsing GPIO1. */ + *pRPS++ = RPS_LDREG | (P_GPIO >> 2); /* Begin ADC Start pulse. */ + *pRPS++ = GPIO_BASE | GPIO1_LO; + *pRPS++ = RPS_NOP; + /* VERSION 2.03 CHANGE: STRETCH OUT ADC START PULSE. */ + *pRPS++ = RPS_LDREG | (P_GPIO >> 2); /* End ADC Start pulse. */ + *pRPS++ = GPIO_BASE | GPIO1_HI; - return tempdata; -} + /* Wait for ADC to complete (GPIO2 is asserted high when ADC not + * busy) and for data from previous conversion to shift into FB + * BUFFER 1 register. + */ + *pRPS++ = RPS_PAUSE | RPS_GPIO2; /* Wait for ADC done. */ -/* static unsigned int s626_uint_to_reg(struct comedi_subdevice *s, int data){ */ -/* return 0; */ -/* } */ + /* Transfer ADC data from FB BUFFER 1 register to DMA buffer. */ + *pRPS++ = RPS_STREG | (BUGFIX_STREG(P_FB_BUFFER1) >> 2); + *pRPS++ = + (uint32_t) devpriv->ANABuf.PhysicalBase + + (devpriv->AdcItems << 2); -static irqreturn_t s626_irq_handler(int irq, void *d) -{ - struct comedi_device *dev = d; - struct comedi_subdevice *s; - struct comedi_cmd *cmd; - struct enc_private *k; - unsigned long flags; - int32_t *readaddr; - uint32_t irqtype, irqstatus; - int i = 0; - short tempdata; - uint8_t group; - uint16_t irqbit; + /* If this slot's EndOfPollList flag is set, all channels have */ + /* now been processed. */ + if (*ppl++ & EOPL) { + devpriv->AdcItems++; /* Adjust poll list item count. */ + break; /* Exit poll list processing loop. */ + } + } + DEBUG("ResetADC: ADC items %d\n", devpriv->AdcItems); - DEBUG("s626_irq_handler: interrupt request received!!!\n"); + /* VERSION 2.01 CHANGE: DELAY CHANGED FROM 250NS to 2US. Allow the + * ADC to stabilize for 2 microseconds before starting the final + * (dummy) conversion. This delay is necessary to allow sufficient + * time between last conversion finished and the start of the dummy + * conversion. Without this delay, the last conversion's data value + * is sometimes set to the previous conversion's data value. + */ + for (n = 0; n < (2 * RPSCLK_PER_US); n++) + *pRPS++ = RPS_NOP; - if (dev->attached == 0) - return IRQ_NONE; - /* lock to avoid race with comedi_poll */ - spin_lock_irqsave(&dev->spinlock, flags); + /* Start a dummy conversion to cause the data from the last + * conversion of interest to be shifted in. + */ + *pRPS++ = RPS_LDREG | (P_GPIO >> 2); /* Begin ADC Start pulse. */ + *pRPS++ = GPIO_BASE | GPIO1_LO; + *pRPS++ = RPS_NOP; + /* VERSION 2.03 CHANGE: STRETCH OUT ADC START PULSE. */ + *pRPS++ = RPS_LDREG | (P_GPIO >> 2); /* End ADC Start pulse. */ + *pRPS++ = GPIO_BASE | GPIO1_HI; - /* save interrupt enable register state */ - irqstatus = readl(devpriv->base_addr + P_IER); + /* Wait for the data from the last conversion of interest to arrive + * in FB BUFFER 1 register. + */ + *pRPS++ = RPS_PAUSE | RPS_GPIO2; /* Wait for ADC done. */ - /* read interrupt type */ - irqtype = readl(devpriv->base_addr + P_ISR); + /* Transfer final ADC data from FB BUFFER 1 register to DMA buffer. */ + *pRPS++ = RPS_STREG | (BUGFIX_STREG(P_FB_BUFFER1) >> 2); /* */ + *pRPS++ = + (uint32_t) devpriv->ANABuf.PhysicalBase + (devpriv->AdcItems << 2); - /* disable master interrupt */ - writel(0, devpriv->base_addr + P_IER); + /* Indicate ADC scan loop is finished. */ + /* *pRPS++= RPS_CLRSIGNAL | RPS_SIGADC ; // Signal ReadADC() that scan is done. */ - /* clear interrupt */ - writel(irqtype, devpriv->base_addr + P_ISR); + /* invoke interrupt */ + if (devpriv->ai_cmd_running == 1) { + DEBUG("ResetADC: insert irq in ADC RPS task\n"); + *pRPS++ = RPS_IRQ; + } + /* Restart RPS program at its beginning. */ + *pRPS++ = RPS_JUMP; /* Branch to start of RPS program. */ + *pRPS++ = (uint32_t) devpriv->RPSBuf.PhysicalBase; - /* do somethings */ - DEBUG("s626_irq_handler: interrupt type %d\n", irqtype); + /* End of RPS program build */ +} - switch (irqtype) { - case IRQ_RPS1: /* end_of_scan occurs */ +/* TO COMPLETE, IF NECESSARY */ +static int s626_ai_insn_config(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) +{ - DEBUG("s626_irq_handler: RPS1 irq detected\n"); + return -EINVAL; +} - /* manage ai subdevice */ - s = dev->subdevices; - cmd = &(s->async->cmd); +/* static int s626_ai_rinsn(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) */ +/* { */ +/* register uint8_t i; */ +/* register int32_t *readaddr; */ - /* Init ptr to DMA buffer that holds new ADC data. We skip the - * first uint16_t in the buffer because it contains junk data from - * the final ADC of the previous poll list scan. - */ - readaddr = (int32_t *) devpriv->ANABuf.LogicalBase + 1; +/* DEBUG("as626_ai_rinsn: ai_rinsn enter\n"); */ - /* get the data and hand it over to comedi */ - for (i = 0; i < (s->async->cmd.chanlist_len); i++) { - /* Convert ADC data to 16-bit integer values and copy to application */ - /* buffer. */ - tempdata = s626_ai_reg_to_uint((int)*readaddr); - readaddr++; +/* Trigger ADC scan loop start by setting RPS Signal 0. */ +/* MC_ENABLE( P_MC2, MC2_ADC_RPS ); */ - /* put data into read buffer */ - /* comedi_buf_put(s->async, tempdata); */ - if (cfc_write_to_buffer(s, tempdata) == 0) - printk - ("s626_irq_handler: cfc_write_to_buffer error!\n"); +/* Wait until ADC scan loop is finished (RPS Signal 0 reset). */ +/* while ( MC_TEST( P_MC2, MC2_ADC_RPS ) ); */ - DEBUG("s626_irq_handler: ai channel %d acquired: %d\n", - i, tempdata); - } +/* Init ptr to DMA buffer that holds new ADC data. We skip the + * first uint16_t in the buffer because it contains junk data from + * the final ADC of the previous poll list scan. + */ +/* readaddr = (uint32_t *)devpriv->ANABuf.LogicalBase + 1; */ - /* end of scan occurs */ - s->async->events |= COMEDI_CB_EOS; +/* Convert ADC data to 16-bit integer values and copy to application buffer. */ +/* for ( i = 0; i < devpriv->AdcItems; i++ ) { */ +/* *data = s626_ai_reg_to_uint( *readaddr++ ); */ +/* DEBUG("s626_ai_rinsn: data %d\n",*data); */ +/* data++; */ +/* } */ - if (!(devpriv->ai_continous)) - devpriv->ai_sample_count--; - if (devpriv->ai_sample_count <= 0) { - devpriv->ai_cmd_running = 0; +/* DEBUG("s626_ai_rinsn: ai_rinsn escape\n"); */ +/* return i; */ +/* } */ - /* Stop RPS program. */ - MC_DISABLE(P_MC1, MC1_ERPS1); +static int s626_ai_insn_read(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) +{ + uint16_t chan = CR_CHAN(insn->chanspec); + uint16_t range = CR_RANGE(insn->chanspec); + uint16_t AdcSpec = 0; + uint32_t GpioImage; + int n; - /* send end of acquisition */ - s->async->events |= COMEDI_CB_EOA; + /* interrupt call test */ +/* writel(IRQ_GPIO3,devpriv->base_addr+P_PSR); */ + /* Writing a logical 1 into any of the RPS_PSR bits causes the + * corresponding interrupt to be generated if enabled + */ - /* disable master interrupt */ - irqstatus = 0; - } + DEBUG("s626_ai_insn_read: entering\n"); - if (devpriv->ai_cmd_running && cmd->scan_begin_src == TRIG_EXT) { - DEBUG - ("s626_irq_handler: enable interrupt on dio channel %d\n", - cmd->scan_begin_arg); + /* Convert application's ADC specification into form + * appropriate for register programming. + */ + if (range == 0) + AdcSpec = (chan << 8) | (GSEL_BIPOLAR5V); + else + AdcSpec = (chan << 8) | (GSEL_BIPOLAR10V); - s626_dio_set_irq(dev, cmd->scan_begin_arg); + /* Switch ADC analog gain. */ + DEBIwrite(dev, LP_GSEL, AdcSpec); /* Set gain. */ - DEBUG("s626_irq_handler: External trigger is set!!!\n"); - } - /* tell comedi that data is there */ - DEBUG("s626_irq_handler: events %d\n", s->async->events); - comedi_event(dev, s); - break; - case IRQ_GPIO3: /* check dio and conter interrupt */ + /* Select ADC analog input channel. */ + DEBIwrite(dev, LP_ISEL, AdcSpec); /* Select channel. */ - DEBUG("s626_irq_handler: GPIO3 irq detected\n"); + for (n = 0; n < insn->n; n++) { - /* manage ai subdevice */ - s = dev->subdevices; - cmd = &(s->async->cmd); + /* Delay 10 microseconds for analog input settling. */ + udelay(10); - /* s626_dio_clear_irq(dev); */ + /* Start ADC by pulsing GPIO1 low. */ + GpioImage = RR7146(P_GPIO); + /* Assert ADC Start command */ + WR7146(P_GPIO, GpioImage & ~GPIO1_HI); + /* and stretch it out. */ + WR7146(P_GPIO, GpioImage & ~GPIO1_HI); + WR7146(P_GPIO, GpioImage & ~GPIO1_HI); + /* Negate ADC Start command. */ + WR7146(P_GPIO, GpioImage | GPIO1_HI); - for (group = 0; group < S626_DIO_BANKS; group++) { - irqbit = 0; - /* read interrupt type */ - irqbit = DEBIread(dev, - ((struct dio_private *)(dev-> - subdevices + - 2 + - group)-> - private)->RDCapFlg); - - /* check if interrupt is generated from dio channels */ - if (irqbit) { - s626_dio_reset_irq(dev, group, irqbit); - DEBUG - ("s626_irq_handler: check interrupt on dio group %d %d\n", - group, i); - if (devpriv->ai_cmd_running) { - /* check if interrupt is an ai acquisition start trigger */ - if ((irqbit >> (cmd->start_arg - - (16 * group))) - == 1 && cmd->start_src == TRIG_EXT) { - DEBUG - ("s626_irq_handler: Edge capture interrupt received from channel %d\n", - cmd->start_arg); + /* Wait for ADC to complete (GPIO2 is asserted high when */ + /* ADC not busy) and for data from previous conversion to */ + /* shift into FB BUFFER 1 register. */ - /* Start executing the RPS program. */ - MC_ENABLE(P_MC1, MC1_ERPS1); + /* Wait for ADC done. */ + while (!(RR7146(P_PSR) & PSR_GPIO2)) + ; - DEBUG - ("s626_irq_handler: acquisition start triggered!!!\n"); + /* Fetch ADC data. */ + if (n != 0) + data[n - 1] = s626_ai_reg_to_uint(RR7146(P_FB_BUFFER1)); - if (cmd->scan_begin_src == - TRIG_EXT) { - DEBUG - ("s626_ai_cmd: enable interrupt on dio channel %d\n", - cmd-> - scan_begin_arg); + /* Allow the ADC to stabilize for 4 microseconds before + * starting the next (final) conversion. This delay is + * necessary to allow sufficient time between last + * conversion finished and the start of the next + * conversion. Without this delay, the last conversion's + * data value is sometimes set to the previous + * conversion's data value. + */ + udelay(4); + } - s626_dio_set_irq(dev, - cmd->scan_begin_arg); + /* Start a dummy conversion to cause the data from the + * previous conversion to be shifted in. */ + GpioImage = RR7146(P_GPIO); - DEBUG - ("s626_irq_handler: External scan trigger is set!!!\n"); - } - } - if ((irqbit >> (cmd->scan_begin_arg - - (16 * group))) - == 1 - && cmd->scan_begin_src == - TRIG_EXT) { - DEBUG - ("s626_irq_handler: Edge capture interrupt received from channel %d\n", - cmd->scan_begin_arg); + /* Assert ADC Start command */ + WR7146(P_GPIO, GpioImage & ~GPIO1_HI); + /* and stretch it out. */ + WR7146(P_GPIO, GpioImage & ~GPIO1_HI); + WR7146(P_GPIO, GpioImage & ~GPIO1_HI); + /* Negate ADC Start command. */ + WR7146(P_GPIO, GpioImage | GPIO1_HI); - /* Trigger ADC scan loop start by setting RPS Signal 0. */ - MC_ENABLE(P_MC2, MC2_ADC_RPS); + /* Wait for the data to arrive in FB BUFFER 1 register. */ - DEBUG - ("s626_irq_handler: scan triggered!!! %d\n", - devpriv->ai_sample_count); - if (cmd->convert_src == - TRIG_EXT) { + /* Wait for ADC done. */ + while (!(RR7146(P_PSR) & PSR_GPIO2)) + ; - DEBUG - ("s626_ai_cmd: enable interrupt on dio channel %d group %d\n", - cmd->convert_arg - - (16 * group), - group); + /* Fetch ADC data from audio interface's input shift register. */ - devpriv->ai_convert_count - = cmd->chanlist_len; + /* Fetch ADC data. */ + if (n != 0) + data[n - 1] = s626_ai_reg_to_uint(RR7146(P_FB_BUFFER1)); - s626_dio_set_irq(dev, - cmd->convert_arg); + DEBUG("s626_ai_insn_read: samples %d, data %d\n", n, data[n - 1]); - DEBUG - ("s626_irq_handler: External convert trigger is set!!!\n"); - } + return n; +} - if (cmd->convert_src == - TRIG_TIMER) { - k = &encpriv[5]; - devpriv->ai_convert_count - = cmd->chanlist_len; - k->SetEnable(dev, k, - CLKENAB_ALWAYS); - } - } - if ((irqbit >> (cmd->convert_arg - - (16 * group))) - == 1 - && cmd->convert_src == TRIG_EXT) { - DEBUG - ("s626_irq_handler: Edge capture interrupt received from channel %d\n", - cmd->convert_arg); +static int s626_ai_load_polllist(uint8_t *ppl, struct comedi_cmd *cmd) +{ - /* Trigger ADC scan loop start by setting RPS Signal 0. */ - MC_ENABLE(P_MC2, MC2_ADC_RPS); + int n; - DEBUG - ("s626_irq_handler: adc convert triggered!!!\n"); + for (n = 0; n < cmd->chanlist_len; n++) { + if (CR_RANGE((cmd->chanlist)[n]) == 0) + ppl[n] = (CR_CHAN((cmd->chanlist)[n])) | (RANGE_5V); + else + ppl[n] = (CR_CHAN((cmd->chanlist)[n])) | (RANGE_10V); + } + if (n != 0) + ppl[n - 1] |= EOPL; - devpriv->ai_convert_count--; + return n; +} - if (devpriv->ai_convert_count > - 0) { +static int s626_ai_inttrig(struct comedi_device *dev, + struct comedi_subdevice *s, unsigned int trignum) +{ + if (trignum != 0) + return -EINVAL; - DEBUG - ("s626_ai_cmd: enable interrupt on dio channel %d group %d\n", - cmd->convert_arg - - (16 * group), - group); + DEBUG("s626_ai_inttrig: trigger adc start..."); - s626_dio_set_irq(dev, - cmd->convert_arg); + /* Start executing the RPS program. */ + MC_ENABLE(P_MC1, MC1_ERPS1); - DEBUG - ("s626_irq_handler: External trigger is set!!!\n"); - } - } - } - break; - } - } + s->async->inttrig = NULL; - /* read interrupt type */ - irqbit = DEBIread(dev, LP_RDMISC2); + DEBUG(" done\n"); - /* check interrupt on counters */ - DEBUG("s626_irq_handler: check counters interrupt %d\n", - irqbit); + return 1; +} - if (irqbit & IRQ_COINT1A) { - DEBUG - ("s626_irq_handler: interrupt on counter 1A overflow\n"); - k = &encpriv[0]; +/* TO COMPLETE */ +static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) +{ - /* clear interrupt capture flag */ - k->ResetCapFlags(dev, k); - } - if (irqbit & IRQ_COINT2A) { - DEBUG - ("s626_irq_handler: interrupt on counter 2A overflow\n"); - k = &encpriv[1]; + uint8_t ppl[16]; + struct comedi_cmd *cmd = &s->async->cmd; + struct enc_private *k; + int tick; - /* clear interrupt capture flag */ - k->ResetCapFlags(dev, k); - } - if (irqbit & IRQ_COINT3A) { - DEBUG - ("s626_irq_handler: interrupt on counter 3A overflow\n"); - k = &encpriv[2]; + DEBUG("s626_ai_cmd: entering command function\n"); - /* clear interrupt capture flag */ - k->ResetCapFlags(dev, k); - } - if (irqbit & IRQ_COINT1B) { - DEBUG - ("s626_irq_handler: interrupt on counter 1B overflow\n"); - k = &encpriv[3]; + if (devpriv->ai_cmd_running) { + printk(KERN_ERR "s626_ai_cmd: Another ai_cmd is running %d\n", + dev->minor); + return -EBUSY; + } + /* disable interrupt */ + writel(0, devpriv->base_addr + P_IER); - /* clear interrupt capture flag */ - k->ResetCapFlags(dev, k); - } - if (irqbit & IRQ_COINT2B) { - DEBUG - ("s626_irq_handler: interrupt on counter 2B overflow\n"); - k = &encpriv[4]; + /* clear interrupt request */ + writel(IRQ_RPS1 | IRQ_GPIO3, devpriv->base_addr + P_ISR); - /* clear interrupt capture flag */ - k->ResetCapFlags(dev, k); + /* clear any pending interrupt */ + s626_dio_clear_irq(dev); + /* s626_enc_clear_irq(dev); */ - if (devpriv->ai_convert_count > 0) { - devpriv->ai_convert_count--; - if (devpriv->ai_convert_count == 0) - k->SetEnable(dev, k, CLKENAB_INDEX); + /* reset ai_cmd_running flag */ + devpriv->ai_cmd_running = 0; - if (cmd->convert_src == TRIG_TIMER) { - DEBUG - ("s626_irq_handler: conver timer trigger!!! %d\n", - devpriv->ai_convert_count); + /* test if cmd is valid */ + if (cmd == NULL) { + DEBUG("s626_ai_cmd: NULL command\n"); + return -EINVAL; + } else { + DEBUG("s626_ai_cmd: command received!!!\n"); + } - /* Trigger ADC scan loop start by setting RPS Signal 0. */ - MC_ENABLE(P_MC2, MC2_ADC_RPS); - } - } - } - if (irqbit & IRQ_COINT3B) { - DEBUG - ("s626_irq_handler: interrupt on counter 3B overflow\n"); - k = &encpriv[5]; + if (dev->irq == 0) { + comedi_error(dev, + "s626_ai_cmd: cannot run command without an irq"); + return -EIO; + } - /* clear interrupt capture flag */ - k->ResetCapFlags(dev, k); + s626_ai_load_polllist(ppl, cmd); + devpriv->ai_cmd_running = 1; + devpriv->ai_convert_count = 0; - if (cmd->scan_begin_src == TRIG_TIMER) { - DEBUG - ("s626_irq_handler: scan timer trigger!!!\n"); + switch (cmd->scan_begin_src) { + case TRIG_FOLLOW: + break; + case TRIG_TIMER: + /* set a conter to generate adc trigger at scan_begin_arg interval */ + k = &encpriv[5]; + tick = s626_ns_to_timer((int *)&cmd->scan_begin_arg, + cmd->flags & TRIG_ROUND_MASK); - /* Trigger ADC scan loop start by setting RPS Signal 0. */ - MC_ENABLE(P_MC2, MC2_ADC_RPS); - } + /* load timer value and enable interrupt */ + s626_timer_load(dev, k, tick); + k->SetEnable(dev, k, CLKENAB_ALWAYS); - if (cmd->convert_src == TRIG_TIMER) { - DEBUG - ("s626_irq_handler: convert timer trigger is set\n"); - k = &encpriv[4]; - devpriv->ai_convert_count = cmd->chanlist_len; - k->SetEnable(dev, k, CLKENAB_ALWAYS); - } - } - } + DEBUG("s626_ai_cmd: scan trigger timer is set with value %d\n", + tick); - /* enable interrupt */ - writel(irqstatus, devpriv->base_addr + P_IER); + break; + case TRIG_EXT: + /* set the digital line and interrupt for scan trigger */ + if (cmd->start_src != TRIG_EXT) + s626_dio_set_irq(dev, cmd->scan_begin_arg); - DEBUG("s626_irq_handler: exit interrupt service routine.\n"); + DEBUG("s626_ai_cmd: External scan trigger is set!!!\n"); - spin_unlock_irqrestore(&dev->spinlock, flags); - return IRQ_HANDLED; -} + break; + } -static void s626_detach(struct comedi_device *dev) -{ - if (devpriv) { - /* stop ai_command */ - devpriv->ai_cmd_running = 0; + switch (cmd->convert_src) { + case TRIG_NOW: + break; + case TRIG_TIMER: + /* set a conter to generate adc trigger at convert_arg interval */ + k = &encpriv[4]; + tick = s626_ns_to_timer((int *)&cmd->convert_arg, + cmd->flags & TRIG_ROUND_MASK); - if (devpriv->base_addr) { - /* interrupt mask */ - WR7146(P_IER, 0); /* Disable master interrupt. */ - WR7146(P_ISR, IRQ_GPIO3 | IRQ_RPS1); /* Clear board's IRQ status flag. */ + /* load timer value and enable interrupt */ + s626_timer_load(dev, k, tick); + k->SetEnable(dev, k, CLKENAB_INDEX); - /* Disable the watchdog timer and battery charger. */ - WriteMISC2(dev, 0); + DEBUG + ("s626_ai_cmd: convert trigger timer is set with value %d\n", + tick); + break; + case TRIG_EXT: + /* set the digital line and interrupt for convert trigger */ + if (cmd->scan_begin_src != TRIG_EXT + && cmd->start_src == TRIG_EXT) + s626_dio_set_irq(dev, cmd->convert_arg); - /* Close all interfaces on 7146 device. */ - WR7146(P_MC1, MC1_SHUTDOWN); - WR7146(P_ACON1, ACON1_BASE); + DEBUG("s626_ai_cmd: External convert trigger is set!!!\n"); - CloseDMAB(dev, &devpriv->RPSBuf, DMABUF_SIZE); - CloseDMAB(dev, &devpriv->ANABuf, DMABUF_SIZE); - } + break; + } - if (dev->irq) - free_irq(dev->irq, dev); - if (devpriv->base_addr) - iounmap(devpriv->base_addr); - if (devpriv->pdev) { - if (devpriv->got_regions) - comedi_pci_disable(devpriv->pdev); - pci_dev_put(devpriv->pdev); - } + switch (cmd->stop_src) { + case TRIG_COUNT: + /* data arrives as one packet */ + devpriv->ai_sample_count = cmd->stop_arg; + devpriv->ai_continous = 0; + break; + case TRIG_NONE: + /* continous acquisition */ + devpriv->ai_continous = 1; + devpriv->ai_sample_count = 0; + break; } -} -/* - * this functions build the RPS program for hardware driven acquistion - */ -static void ResetADC(struct comedi_device *dev, uint8_t *ppl) -{ - register uint32_t *pRPS; - uint32_t JmpAdrs; - uint16_t i; - uint16_t n; - uint32_t LocalPPL; - struct comedi_cmd *cmd = &(dev->subdevices->async->cmd); + ResetADC(dev, ppl); - /* Stop RPS program in case it is currently running. */ - MC_DISABLE(P_MC1, MC1_ERPS1); + switch (cmd->start_src) { + case TRIG_NOW: + /* Trigger ADC scan loop start by setting RPS Signal 0. */ + /* MC_ENABLE( P_MC2, MC2_ADC_RPS ); */ - /* Set starting logical address to write RPS commands. */ - pRPS = (uint32_t *) devpriv->RPSBuf.LogicalBase; + /* Start executing the RPS program. */ + MC_ENABLE(P_MC1, MC1_ERPS1); - /* Initialize RPS instruction pointer. */ - WR7146(P_RPSADDR1, (uint32_t) devpriv->RPSBuf.PhysicalBase); + DEBUG("s626_ai_cmd: ADC triggered\n"); + s->async->inttrig = NULL; + break; + case TRIG_EXT: + /* configure DIO channel for acquisition trigger */ + s626_dio_set_irq(dev, cmd->start_arg); - /* Construct RPS program in RPSBuf DMA buffer */ + DEBUG("s626_ai_cmd: External start trigger is set!!!\n"); - if (cmd != NULL && cmd->scan_begin_src != TRIG_FOLLOW) { - DEBUG("ResetADC: scan_begin pause inserted\n"); - /* Wait for Start trigger. */ - *pRPS++ = RPS_PAUSE | RPS_SIGADC; - *pRPS++ = RPS_CLRSIGNAL | RPS_SIGADC; + s->async->inttrig = NULL; + break; + case TRIG_INT: + s->async->inttrig = s626_ai_inttrig; + break; } - /* SAA7146 BUG WORKAROUND Do a dummy DEBI Write. This is necessary - * because the first RPS DEBI Write following a non-RPS DEBI write - * seems to always fail. If we don't do this dummy write, the ADC - * gain might not be set to the value required for the first slot in - * the poll list; the ADC gain would instead remain unchanged from - * the previously programmed value. - */ - *pRPS++ = RPS_LDREG | (P_DEBICMD >> 2); - /* Write DEBI Write command and address to shadow RAM. */ + /* enable interrupt */ + writel(IRQ_GPIO3 | IRQ_RPS1, devpriv->base_addr + P_IER); - *pRPS++ = DEBI_CMD_WRWORD | LP_GSEL; - *pRPS++ = RPS_LDREG | (P_DEBIAD >> 2); - /* Write DEBI immediate data to shadow RAM: */ + DEBUG("s626_ai_cmd: command function terminated\n"); - *pRPS++ = GSEL_BIPOLAR5V; - /* arbitrary immediate data value. */ + return 0; +} - *pRPS++ = RPS_CLRSIGNAL | RPS_DEBI; - /* Reset "shadow RAM uploaded" flag. */ - *pRPS++ = RPS_UPLOAD | RPS_DEBI; /* Invoke shadow RAM upload. */ - *pRPS++ = RPS_PAUSE | RPS_DEBI; /* Wait for shadow upload to finish. */ +static int s626_ai_cmdtest(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_cmd *cmd) +{ + int err = 0; + int tmp; - /* Digitize all slots in the poll list. This is implemented as a - * for loop to limit the slot count to 16 in case the application - * forgot to set the EOPL flag in the final slot. - */ - for (devpriv->AdcItems = 0; devpriv->AdcItems < 16; devpriv->AdcItems++) { - /* Convert application's poll list item to private board class - * format. Each app poll list item is an uint8_t with form - * (EOPL,x,x,RANGE,CHAN<3:0>), where RANGE code indicates 0 = - * +-10V, 1 = +-5V, and EOPL = End of Poll List marker. - */ - LocalPPL = - (*ppl << 8) | (*ppl & 0x10 ? GSEL_BIPOLAR5V : - GSEL_BIPOLAR10V); + /* cmdtest tests a particular command to see if it is valid. Using + * the cmdtest ioctl, a user can create a valid cmd and then have it + * executes by the cmd ioctl. + * + * cmdtest returns 1,2,3,4 or 0, depending on which tests the + * command passes. */ - /* Switch ADC analog gain. */ - *pRPS++ = RPS_LDREG | (P_DEBICMD >> 2); /* Write DEBI command */ - /* and address to */ - /* shadow RAM. */ - *pRPS++ = DEBI_CMD_WRWORD | LP_GSEL; - *pRPS++ = RPS_LDREG | (P_DEBIAD >> 2); /* Write DEBI */ - /* immediate data to */ - /* shadow RAM. */ - *pRPS++ = LocalPPL; - *pRPS++ = RPS_CLRSIGNAL | RPS_DEBI; /* Reset "shadow RAM uploaded" */ - /* flag. */ - *pRPS++ = RPS_UPLOAD | RPS_DEBI; /* Invoke shadow RAM upload. */ - *pRPS++ = RPS_PAUSE | RPS_DEBI; /* Wait for shadow upload to */ - /* finish. */ + /* step 1: make sure trigger sources are trivially valid */ - /* Select ADC analog input channel. */ - *pRPS++ = RPS_LDREG | (P_DEBICMD >> 2); - /* Write DEBI command and address to shadow RAM. */ - *pRPS++ = DEBI_CMD_WRWORD | LP_ISEL; - *pRPS++ = RPS_LDREG | (P_DEBIAD >> 2); - /* Write DEBI immediate data to shadow RAM. */ - *pRPS++ = LocalPPL; - *pRPS++ = RPS_CLRSIGNAL | RPS_DEBI; - /* Reset "shadow RAM uploaded" flag. */ + tmp = cmd->start_src; + cmd->start_src &= TRIG_NOW | TRIG_INT | TRIG_EXT; + if (!cmd->start_src || tmp != cmd->start_src) + err++; - *pRPS++ = RPS_UPLOAD | RPS_DEBI; - /* Invoke shadow RAM upload. */ + tmp = cmd->scan_begin_src; + cmd->scan_begin_src &= TRIG_TIMER | TRIG_EXT | TRIG_FOLLOW; + if (!cmd->scan_begin_src || tmp != cmd->scan_begin_src) + err++; - *pRPS++ = RPS_PAUSE | RPS_DEBI; - /* Wait for shadow upload to finish. */ + tmp = cmd->convert_src; + cmd->convert_src &= TRIG_TIMER | TRIG_EXT | TRIG_NOW; + if (!cmd->convert_src || tmp != cmd->convert_src) + err++; - /* Delay at least 10 microseconds for analog input settling. - * Instead of padding with NOPs, we use RPS_JUMP instructions - * here; this allows us to produce a longer delay than is - * possible with NOPs because each RPS_JUMP flushes the RPS' - * instruction prefetch pipeline. - */ - JmpAdrs = - (uint32_t) devpriv->RPSBuf.PhysicalBase + - (uint32_t) ((unsigned long)pRPS - - (unsigned long)devpriv->RPSBuf.LogicalBase); - for (i = 0; i < (10 * RPSCLK_PER_US / 2); i++) { - JmpAdrs += 8; /* Repeat to implement time delay: */ - *pRPS++ = RPS_JUMP; /* Jump to next RPS instruction. */ - *pRPS++ = JmpAdrs; - } + tmp = cmd->scan_end_src; + cmd->scan_end_src &= TRIG_COUNT; + if (!cmd->scan_end_src || tmp != cmd->scan_end_src) + err++; - if (cmd != NULL && cmd->convert_src != TRIG_NOW) { - DEBUG("ResetADC: convert pause inserted\n"); - /* Wait for Start trigger. */ - *pRPS++ = RPS_PAUSE | RPS_SIGADC; - *pRPS++ = RPS_CLRSIGNAL | RPS_SIGADC; - } - /* Start ADC by pulsing GPIO1. */ - *pRPS++ = RPS_LDREG | (P_GPIO >> 2); /* Begin ADC Start pulse. */ - *pRPS++ = GPIO_BASE | GPIO1_LO; - *pRPS++ = RPS_NOP; - /* VERSION 2.03 CHANGE: STRETCH OUT ADC START PULSE. */ - *pRPS++ = RPS_LDREG | (P_GPIO >> 2); /* End ADC Start pulse. */ - *pRPS++ = GPIO_BASE | GPIO1_HI; + tmp = cmd->stop_src; + cmd->stop_src &= TRIG_COUNT | TRIG_NONE; + if (!cmd->stop_src || tmp != cmd->stop_src) + err++; - /* Wait for ADC to complete (GPIO2 is asserted high when ADC not - * busy) and for data from previous conversion to shift into FB - * BUFFER 1 register. - */ - *pRPS++ = RPS_PAUSE | RPS_GPIO2; /* Wait for ADC done. */ + if (err) + return 1; - /* Transfer ADC data from FB BUFFER 1 register to DMA buffer. */ - *pRPS++ = RPS_STREG | (BUGFIX_STREG(P_FB_BUFFER1) >> 2); - *pRPS++ = - (uint32_t) devpriv->ANABuf.PhysicalBase + - (devpriv->AdcItems << 2); + /* step 2: make sure trigger sources are unique and mutually + compatible */ - /* If this slot's EndOfPollList flag is set, all channels have */ - /* now been processed. */ - if (*ppl++ & EOPL) { - devpriv->AdcItems++; /* Adjust poll list item count. */ - break; /* Exit poll list processing loop. */ - } + /* note that mutual compatibility is not an issue here */ + if (cmd->scan_begin_src != TRIG_TIMER && + cmd->scan_begin_src != TRIG_EXT + && cmd->scan_begin_src != TRIG_FOLLOW) + err++; + if (cmd->convert_src != TRIG_TIMER && + cmd->convert_src != TRIG_EXT && cmd->convert_src != TRIG_NOW) + err++; + if (cmd->stop_src != TRIG_COUNT && cmd->stop_src != TRIG_NONE) + err++; + + if (err) + return 2; + + /* step 3: make sure arguments are trivially compatible */ + + if (cmd->start_src != TRIG_EXT && cmd->start_arg != 0) { + cmd->start_arg = 0; + err++; } - DEBUG("ResetADC: ADC items %d\n", devpriv->AdcItems); - /* VERSION 2.01 CHANGE: DELAY CHANGED FROM 250NS to 2US. Allow the - * ADC to stabilize for 2 microseconds before starting the final - * (dummy) conversion. This delay is necessary to allow sufficient - * time between last conversion finished and the start of the dummy - * conversion. Without this delay, the last conversion's data value - * is sometimes set to the previous conversion's data value. - */ - for (n = 0; n < (2 * RPSCLK_PER_US); n++) - *pRPS++ = RPS_NOP; + if (cmd->start_src == TRIG_EXT && cmd->start_arg > 39) { + cmd->start_arg = 39; + err++; + } - /* Start a dummy conversion to cause the data from the last - * conversion of interest to be shifted in. - */ - *pRPS++ = RPS_LDREG | (P_GPIO >> 2); /* Begin ADC Start pulse. */ - *pRPS++ = GPIO_BASE | GPIO1_LO; - *pRPS++ = RPS_NOP; - /* VERSION 2.03 CHANGE: STRETCH OUT ADC START PULSE. */ - *pRPS++ = RPS_LDREG | (P_GPIO >> 2); /* End ADC Start pulse. */ - *pRPS++ = GPIO_BASE | GPIO1_HI; + if (cmd->scan_begin_src == TRIG_EXT && cmd->scan_begin_arg > 39) { + cmd->scan_begin_arg = 39; + err++; + } - /* Wait for the data from the last conversion of interest to arrive - * in FB BUFFER 1 register. - */ - *pRPS++ = RPS_PAUSE | RPS_GPIO2; /* Wait for ADC done. */ + if (cmd->convert_src == TRIG_EXT && cmd->convert_arg > 39) { + cmd->convert_arg = 39; + err++; + } +#define MAX_SPEED 200000 /* in nanoseconds */ +#define MIN_SPEED 2000000000 /* in nanoseconds */ - /* Transfer final ADC data from FB BUFFER 1 register to DMA buffer. */ - *pRPS++ = RPS_STREG | (BUGFIX_STREG(P_FB_BUFFER1) >> 2); /* */ - *pRPS++ = - (uint32_t) devpriv->ANABuf.PhysicalBase + (devpriv->AdcItems << 2); + if (cmd->scan_begin_src == TRIG_TIMER) { + if (cmd->scan_begin_arg < MAX_SPEED) { + cmd->scan_begin_arg = MAX_SPEED; + err++; + } + if (cmd->scan_begin_arg > MIN_SPEED) { + cmd->scan_begin_arg = MIN_SPEED; + err++; + } + } else { + /* external trigger */ + /* should be level/edge, hi/lo specification here */ + /* should specify multiple external triggers */ +/* if(cmd->scan_begin_arg>9){ */ +/* cmd->scan_begin_arg=9; */ +/* err++; */ +/* } */ + } + if (cmd->convert_src == TRIG_TIMER) { + if (cmd->convert_arg < MAX_SPEED) { + cmd->convert_arg = MAX_SPEED; + err++; + } + if (cmd->convert_arg > MIN_SPEED) { + cmd->convert_arg = MIN_SPEED; + err++; + } + } else { + /* external trigger */ + /* see above */ +/* if(cmd->convert_arg>9){ */ +/* cmd->convert_arg=9; */ +/* err++; */ +/* } */ + } - /* Indicate ADC scan loop is finished. */ - /* *pRPS++= RPS_CLRSIGNAL | RPS_SIGADC ; // Signal ReadADC() that scan is done. */ + if (cmd->scan_end_arg != cmd->chanlist_len) { + cmd->scan_end_arg = cmd->chanlist_len; + err++; + } + if (cmd->stop_src == TRIG_COUNT) { + if (cmd->stop_arg > 0x00ffffff) { + cmd->stop_arg = 0x00ffffff; + err++; + } + } else { + /* TRIG_NONE */ + if (cmd->stop_arg != 0) { + cmd->stop_arg = 0; + err++; + } + } - /* invoke interrupt */ - if (devpriv->ai_cmd_running == 1) { - DEBUG("ResetADC: insert irq in ADC RPS task\n"); - *pRPS++ = RPS_IRQ; + if (err) + return 3; + + /* step 4: fix up any arguments */ + + if (cmd->scan_begin_src == TRIG_TIMER) { + tmp = cmd->scan_begin_arg; + s626_ns_to_timer((int *)&cmd->scan_begin_arg, + cmd->flags & TRIG_ROUND_MASK); + if (tmp != cmd->scan_begin_arg) + err++; + } + if (cmd->convert_src == TRIG_TIMER) { + tmp = cmd->convert_arg; + s626_ns_to_timer((int *)&cmd->convert_arg, + cmd->flags & TRIG_ROUND_MASK); + if (tmp != cmd->convert_arg) + err++; + if (cmd->scan_begin_src == TRIG_TIMER && + cmd->scan_begin_arg < + cmd->convert_arg * cmd->scan_end_arg) { + cmd->scan_begin_arg = + cmd->convert_arg * cmd->scan_end_arg; + err++; + } } - /* Restart RPS program at its beginning. */ - *pRPS++ = RPS_JUMP; /* Branch to start of RPS program. */ - *pRPS++ = (uint32_t) devpriv->RPSBuf.PhysicalBase; - /* End of RPS program build */ + if (err) + return 4; + + return 0; } -/* TO COMPLETE, IF NECESSARY */ -static int s626_ai_insn_config(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int s626_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { + /* Stop RPS program in case it is currently running. */ + MC_DISABLE(P_MC1, MC1_ERPS1); - return -EINVAL; -} - -/* static int s626_ai_rinsn(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) */ -/* { */ -/* register uint8_t i; */ -/* register int32_t *readaddr; */ + /* disable master interrupt */ + writel(0, devpriv->base_addr + P_IER); -/* DEBUG("as626_ai_rinsn: ai_rinsn enter\n"); */ + devpriv->ai_cmd_running = 0; -/* Trigger ADC scan loop start by setting RPS Signal 0. */ -/* MC_ENABLE( P_MC2, MC2_ADC_RPS ); */ + return 0; +} -/* Wait until ADC scan loop is finished (RPS Signal 0 reset). */ -/* while ( MC_TEST( P_MC2, MC2_ADC_RPS ) ); */ +/* This function doesn't require a particular form, this is just what + * happens to be used in some of the drivers. It should convert ns + * nanoseconds to a counter value suitable for programming the device. + * Also, it should adjust ns so that it cooresponds to the actual time + * that the device will use. */ +static int s626_ns_to_timer(int *nanosec, int round_mode) +{ + int divider, base; -/* Init ptr to DMA buffer that holds new ADC data. We skip the - * first uint16_t in the buffer because it contains junk data from - * the final ADC of the previous poll list scan. - */ -/* readaddr = (uint32_t *)devpriv->ANABuf.LogicalBase + 1; */ + base = 500; /* 2MHz internal clock */ -/* Convert ADC data to 16-bit integer values and copy to application buffer. */ -/* for ( i = 0; i < devpriv->AdcItems; i++ ) { */ -/* *data = s626_ai_reg_to_uint( *readaddr++ ); */ -/* DEBUG("s626_ai_rinsn: data %d\n",*data); */ -/* data++; */ -/* } */ + switch (round_mode) { + case TRIG_ROUND_NEAREST: + default: + divider = (*nanosec + base / 2) / base; + break; + case TRIG_ROUND_DOWN: + divider = (*nanosec) / base; + break; + case TRIG_ROUND_UP: + divider = (*nanosec + base - 1) / base; + break; + } -/* DEBUG("s626_ai_rinsn: ai_rinsn escape\n"); */ -/* return i; */ -/* } */ + *nanosec = base * divider; + return divider - 1; +} -static int s626_ai_insn_read(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int s626_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { + + int i; uint16_t chan = CR_CHAN(insn->chanspec); - uint16_t range = CR_RANGE(insn->chanspec); - uint16_t AdcSpec = 0; - uint32_t GpioImage; - int n; + int16_t dacdata; - /* interrupt call test */ -/* writel(IRQ_GPIO3,devpriv->base_addr+P_PSR); */ - /* Writing a logical 1 into any of the RPS_PSR bits causes the - * corresponding interrupt to be generated if enabled - */ - - DEBUG("s626_ai_insn_read: entering\n"); - - /* Convert application's ADC specification into form - * appropriate for register programming. - */ - if (range == 0) - AdcSpec = (chan << 8) | (GSEL_BIPOLAR5V); - else - AdcSpec = (chan << 8) | (GSEL_BIPOLAR10V); + for (i = 0; i < insn->n; i++) { + dacdata = (int16_t) data[i]; + devpriv->ao_readback[CR_CHAN(insn->chanspec)] = data[i]; + dacdata -= (0x1fff); - /* Switch ADC analog gain. */ - DEBIwrite(dev, LP_GSEL, AdcSpec); /* Set gain. */ + SetDAC(dev, chan, dacdata); + } - /* Select ADC analog input channel. */ - DEBIwrite(dev, LP_ISEL, AdcSpec); /* Select channel. */ + return i; +} - for (n = 0; n < insn->n; n++) { +static int s626_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) +{ + int i; - /* Delay 10 microseconds for analog input settling. */ - udelay(10); + for (i = 0; i < insn->n; i++) + data[i] = devpriv->ao_readback[CR_CHAN(insn->chanspec)]; - /* Start ADC by pulsing GPIO1 low. */ - GpioImage = RR7146(P_GPIO); - /* Assert ADC Start command */ - WR7146(P_GPIO, GpioImage & ~GPIO1_HI); - /* and stretch it out. */ - WR7146(P_GPIO, GpioImage & ~GPIO1_HI); - WR7146(P_GPIO, GpioImage & ~GPIO1_HI); - /* Negate ADC Start command. */ - WR7146(P_GPIO, GpioImage | GPIO1_HI); + return i; +} - /* Wait for ADC to complete (GPIO2 is asserted high when */ - /* ADC not busy) and for data from previous conversion to */ - /* shift into FB BUFFER 1 register. */ +/* *************** DIGITAL I/O FUNCTIONS *************** + * All DIO functions address a group of DIO channels by means of + * "group" argument. group may be 0, 1 or 2, which correspond to DIO + * ports A, B and C, respectively. + */ - /* Wait for ADC done. */ - while (!(RR7146(P_PSR) & PSR_GPIO2)) - ; +static void s626_dio_init(struct comedi_device *dev) +{ + uint16_t group; + struct comedi_subdevice *s; - /* Fetch ADC data. */ - if (n != 0) - data[n - 1] = s626_ai_reg_to_uint(RR7146(P_FB_BUFFER1)); + /* Prepare to treat writes to WRCapSel as capture disables. */ + DEBIwrite(dev, LP_MISC1, MISC1_NOEDCAP); - /* Allow the ADC to stabilize for 4 microseconds before - * starting the next (final) conversion. This delay is - * necessary to allow sufficient time between last - * conversion finished and the start of the next - * conversion. Without this delay, the last conversion's - * data value is sometimes set to the previous - * conversion's data value. - */ - udelay(4); + /* For each group of sixteen channels ... */ + for (group = 0; group < S626_DIO_BANKS; group++) { + s = dev->subdevices + 2 + group; + DEBIwrite(dev, diopriv->WRIntSel, 0); /* Disable all interrupts. */ + DEBIwrite(dev, diopriv->WRCapSel, 0xFFFF); /* Disable all event */ + /* captures. */ + DEBIwrite(dev, diopriv->WREdgSel, 0); /* Init all DIOs to */ + /* default edge */ + /* polarity. */ + DEBIwrite(dev, diopriv->WRDOut, 0); /* Program all outputs */ + /* to inactive state. */ } + DEBUG("s626_dio_init: DIO initialized\n"); +} - /* Start a dummy conversion to cause the data from the - * previous conversion to be shifted in. */ - GpioImage = RR7146(P_GPIO); - - /* Assert ADC Start command */ - WR7146(P_GPIO, GpioImage & ~GPIO1_HI); - /* and stretch it out. */ - WR7146(P_GPIO, GpioImage & ~GPIO1_HI); - WR7146(P_GPIO, GpioImage & ~GPIO1_HI); - /* Negate ADC Start command. */ - WR7146(P_GPIO, GpioImage | GPIO1_HI); - - /* Wait for the data to arrive in FB BUFFER 1 register. */ +/* DIO devices are slightly special. Although it is possible to + * implement the insn_read/insn_write interface, it is much more + * useful to applications if you implement the insn_bits interface. + * This allows packed reading/writing of the DIO channels. The comedi + * core can convert between insn_bits and insn_read/write */ - /* Wait for ADC done. */ - while (!(RR7146(P_PSR) & PSR_GPIO2)) - ; +static int s626_dio_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) +{ + /* + * The insn data consists of a mask in data[0] and the new data in + * data[1]. The mask defines which bits we are concerning about. + * The new data must be anded with the mask. Each channel + * corresponds to a bit. + */ + if (data[0]) { + /* Check if requested ports are configured for output */ + if ((s->io_bits & data[0]) != data[0]) + return -EIO; - /* Fetch ADC data from audio interface's input shift register. */ + s->state &= ~data[0]; + s->state |= data[0] & data[1]; - /* Fetch ADC data. */ - if (n != 0) - data[n - 1] = s626_ai_reg_to_uint(RR7146(P_FB_BUFFER1)); + /* Write out the new digital output lines */ - DEBUG("s626_ai_insn_read: samples %d, data %d\n", n, data[n - 1]); + DEBIwrite(dev, diopriv->WRDOut, s->state); + } + data[1] = DEBIread(dev, diopriv->RDDIn); - return n; + return insn->n; } -static int s626_ai_load_polllist(uint8_t *ppl, struct comedi_cmd *cmd) +static int s626_dio_insn_config(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - int n; - - for (n = 0; n < cmd->chanlist_len; n++) { - if (CR_RANGE((cmd->chanlist)[n]) == 0) - ppl[n] = (CR_CHAN((cmd->chanlist)[n])) | (RANGE_5V); - else - ppl[n] = (CR_CHAN((cmd->chanlist)[n])) | (RANGE_10V); + switch (data[0]) { + case INSN_CONFIG_DIO_QUERY: + data[1] = + (s-> + io_bits & (1 << CR_CHAN(insn->chanspec))) ? COMEDI_OUTPUT : + COMEDI_INPUT; + return insn->n; + break; + case COMEDI_INPUT: + s->io_bits &= ~(1 << CR_CHAN(insn->chanspec)); + break; + case COMEDI_OUTPUT: + s->io_bits |= 1 << CR_CHAN(insn->chanspec); + break; + default: + return -EINVAL; + break; } - if (n != 0) - ppl[n - 1] |= EOPL; + DEBIwrite(dev, diopriv->WRDOut, s->io_bits); - return n; + return 1; } -static int s626_ai_inttrig(struct comedi_device *dev, - struct comedi_subdevice *s, unsigned int trignum) +static int s626_dio_set_irq(struct comedi_device *dev, unsigned int chan) { - if (trignum != 0) - return -EINVAL; + unsigned int group; + unsigned int bitmask; + unsigned int status; - DEBUG("s626_ai_inttrig: trigger adc start..."); + /* select dio bank */ + group = chan / 16; + bitmask = 1 << (chan - (16 * group)); + DEBUG("s626_dio_set_irq: enable interrupt on dio channel %d group %d\n", + chan - (16 * group), group); - /* Start executing the RPS program. */ - MC_ENABLE(P_MC1, MC1_ERPS1); + /* set channel to capture positive edge */ + status = DEBIread(dev, + ((struct dio_private *)(dev->subdevices + 2 + + group)->private)->RDEdgSel); + DEBIwrite(dev, + ((struct dio_private *)(dev->subdevices + 2 + + group)->private)->WREdgSel, + bitmask | status); - s->async->inttrig = NULL; + /* enable interrupt on selected channel */ + status = DEBIread(dev, + ((struct dio_private *)(dev->subdevices + 2 + + group)->private)->RDIntSel); + DEBIwrite(dev, + ((struct dio_private *)(dev->subdevices + 2 + + group)->private)->WRIntSel, + bitmask | status); - DEBUG(" done\n"); + /* enable edge capture write command */ + DEBIwrite(dev, LP_MISC1, MISC1_EDCAP); - return 1; + /* enable edge capture on selected channel */ + status = DEBIread(dev, + ((struct dio_private *)(dev->subdevices + 2 + + group)->private)->RDCapSel); + DEBIwrite(dev, + ((struct dio_private *)(dev->subdevices + 2 + + group)->private)->WRCapSel, + bitmask | status); + + return 0; } -/* TO COMPLETE */ -static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) +static int s626_dio_reset_irq(struct comedi_device *dev, unsigned int group, + unsigned int mask) { + DEBUG + ("s626_dio_reset_irq: disable interrupt on dio channel %d group %d\n", + mask, group); - uint8_t ppl[16]; - struct comedi_cmd *cmd = &s->async->cmd; - struct enc_private *k; - int tick; + /* disable edge capture write command */ + DEBIwrite(dev, LP_MISC1, MISC1_NOEDCAP); - DEBUG("s626_ai_cmd: entering command function\n"); + /* enable edge capture on selected channel */ + DEBIwrite(dev, + ((struct dio_private *)(dev->subdevices + 2 + + group)->private)->WRCapSel, mask); - if (devpriv->ai_cmd_running) { - printk(KERN_ERR "s626_ai_cmd: Another ai_cmd is running %d\n", - dev->minor); - return -EBUSY; - } - /* disable interrupt */ - writel(0, devpriv->base_addr + P_IER); + return 0; +} - /* clear interrupt request */ - writel(IRQ_RPS1 | IRQ_GPIO3, devpriv->base_addr + P_ISR); +static int s626_dio_clear_irq(struct comedi_device *dev) +{ + unsigned int group; - /* clear any pending interrupt */ - s626_dio_clear_irq(dev); - /* s626_enc_clear_irq(dev); */ + /* disable edge capture write command */ + DEBIwrite(dev, LP_MISC1, MISC1_NOEDCAP); - /* reset ai_cmd_running flag */ - devpriv->ai_cmd_running = 0; - - /* test if cmd is valid */ - if (cmd == NULL) { - DEBUG("s626_ai_cmd: NULL command\n"); - return -EINVAL; - } else { - DEBUG("s626_ai_cmd: command received!!!\n"); - } - - if (dev->irq == 0) { - comedi_error(dev, - "s626_ai_cmd: cannot run command without an irq"); - return -EIO; + for (group = 0; group < S626_DIO_BANKS; group++) { + /* clear pending events and interrupt */ + DEBIwrite(dev, + ((struct dio_private *)(dev->subdevices + 2 + + group)->private)->WRCapSel, + 0xffff); } - s626_ai_load_polllist(ppl, cmd); - devpriv->ai_cmd_running = 1; - devpriv->ai_convert_count = 0; - - switch (cmd->scan_begin_src) { - case TRIG_FOLLOW: - break; - case TRIG_TIMER: - /* set a conter to generate adc trigger at scan_begin_arg interval */ - k = &encpriv[5]; - tick = s626_ns_to_timer((int *)&cmd->scan_begin_arg, - cmd->flags & TRIG_ROUND_MASK); - - /* load timer value and enable interrupt */ - s626_timer_load(dev, k, tick); - k->SetEnable(dev, k, CLKENAB_ALWAYS); - - DEBUG("s626_ai_cmd: scan trigger timer is set with value %d\n", - tick); + return 0; +} - break; - case TRIG_EXT: - /* set the digital line and interrupt for scan trigger */ - if (cmd->start_src != TRIG_EXT) - s626_dio_set_irq(dev, cmd->scan_begin_arg); +/* Now this function initializes the value of the counter (data[0]) + and set the subdevice. To complete with trigger and interrupt + configuration */ +static int s626_enc_insn_config(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) +{ + uint16_t Setup = (LOADSRC_INDX << BF_LOADSRC) | /* Preload upon */ + /* index. */ + (INDXSRC_SOFT << BF_INDXSRC) | /* Disable hardware index. */ + (CLKSRC_COUNTER << BF_CLKSRC) | /* Operating mode is Counter. */ + (CLKPOL_POS << BF_CLKPOL) | /* Active high clock. */ + /* ( CNTDIR_UP << BF_CLKPOL ) | // Count direction is Down. */ + (CLKMULT_1X << BF_CLKMULT) | /* Clock multiplier is 1x. */ + (CLKENAB_INDEX << BF_CLKENAB); + /* uint16_t DisableIntSrc=TRUE; */ + /* uint32_t Preloadvalue; //Counter initial value */ + uint16_t valueSrclatch = LATCHSRC_AB_READ; + uint16_t enab = CLKENAB_ALWAYS; + struct enc_private *k = &encpriv[CR_CHAN(insn->chanspec)]; - DEBUG("s626_ai_cmd: External scan trigger is set!!!\n"); + DEBUG("s626_enc_insn_config: encoder config\n"); - break; - } + /* (data==NULL) ? (Preloadvalue=0) : (Preloadvalue=data[0]); */ - switch (cmd->convert_src) { - case TRIG_NOW: - break; - case TRIG_TIMER: - /* set a conter to generate adc trigger at convert_arg interval */ - k = &encpriv[4]; - tick = s626_ns_to_timer((int *)&cmd->convert_arg, - cmd->flags & TRIG_ROUND_MASK); + k->SetMode(dev, k, Setup, TRUE); + Preload(dev, k, *(insn->data)); + k->PulseIndex(dev, k); + SetLatchSource(dev, k, valueSrclatch); + k->SetEnable(dev, k, (uint16_t) (enab != 0)); - /* load timer value and enable interrupt */ - s626_timer_load(dev, k, tick); - k->SetEnable(dev, k, CLKENAB_INDEX); + return insn->n; +} - DEBUG - ("s626_ai_cmd: convert trigger timer is set with value %d\n", - tick); - break; - case TRIG_EXT: - /* set the digital line and interrupt for convert trigger */ - if (cmd->scan_begin_src != TRIG_EXT - && cmd->start_src == TRIG_EXT) - s626_dio_set_irq(dev, cmd->convert_arg); +static int s626_enc_insn_read(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) +{ - DEBUG("s626_ai_cmd: External convert trigger is set!!!\n"); + int n; + struct enc_private *k = &encpriv[CR_CHAN(insn->chanspec)]; - break; - } + DEBUG("s626_enc_insn_read: encoder read channel %d\n", + CR_CHAN(insn->chanspec)); - switch (cmd->stop_src) { - case TRIG_COUNT: - /* data arrives as one packet */ - devpriv->ai_sample_count = cmd->stop_arg; - devpriv->ai_continous = 0; - break; - case TRIG_NONE: - /* continous acquisition */ - devpriv->ai_continous = 1; - devpriv->ai_sample_count = 0; - break; - } + for (n = 0; n < insn->n; n++) + data[n] = ReadLatch(dev, k); - ResetADC(dev, ppl); + DEBUG("s626_enc_insn_read: encoder sample %d\n", data[n]); - switch (cmd->start_src) { - case TRIG_NOW: - /* Trigger ADC scan loop start by setting RPS Signal 0. */ - /* MC_ENABLE( P_MC2, MC2_ADC_RPS ); */ + return n; +} - /* Start executing the RPS program. */ - MC_ENABLE(P_MC1, MC1_ERPS1); +static int s626_enc_insn_write(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) +{ - DEBUG("s626_ai_cmd: ADC triggered\n"); - s->async->inttrig = NULL; - break; - case TRIG_EXT: - /* configure DIO channel for acquisition trigger */ - s626_dio_set_irq(dev, cmd->start_arg); + struct enc_private *k = &encpriv[CR_CHAN(insn->chanspec)]; - DEBUG("s626_ai_cmd: External start trigger is set!!!\n"); + DEBUG("s626_enc_insn_write: encoder write channel %d\n", + CR_CHAN(insn->chanspec)); - s->async->inttrig = NULL; - break; - case TRIG_INT: - s->async->inttrig = s626_ai_inttrig; - break; - } + /* Set the preload register */ + Preload(dev, k, data[0]); - /* enable interrupt */ - writel(IRQ_GPIO3 | IRQ_RPS1, devpriv->base_addr + P_IER); + /* Software index pulse forces the preload register to load */ + /* into the counter */ + k->SetLoadTrig(dev, k, 0); + k->PulseIndex(dev, k); + k->SetLoadTrig(dev, k, 2); - DEBUG("s626_ai_cmd: command function terminated\n"); + DEBUG("s626_enc_insn_write: End encoder write\n"); - return 0; + return 1; } -static int s626_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) +static void s626_timer_load(struct comedi_device *dev, struct enc_private *k, + int tick) { - int err = 0; - int tmp; + uint16_t Setup = (LOADSRC_INDX << BF_LOADSRC) | /* Preload upon */ + /* index. */ + (INDXSRC_SOFT << BF_INDXSRC) | /* Disable hardware index. */ + (CLKSRC_TIMER << BF_CLKSRC) | /* Operating mode is Timer. */ + (CLKPOL_POS << BF_CLKPOL) | /* Active high clock. */ + (CNTDIR_DOWN << BF_CLKPOL) | /* Count direction is Down. */ + (CLKMULT_1X << BF_CLKMULT) | /* Clock multiplier is 1x. */ + (CLKENAB_INDEX << BF_CLKENAB); + uint16_t valueSrclatch = LATCHSRC_A_INDXA; + /* uint16_t enab=CLKENAB_ALWAYS; */ - /* cmdtest tests a particular command to see if it is valid. Using - * the cmdtest ioctl, a user can create a valid cmd and then have it - * executes by the cmd ioctl. - * - * cmdtest returns 1,2,3,4 or 0, depending on which tests the - * command passes. */ + k->SetMode(dev, k, Setup, FALSE); - /* step 1: make sure trigger sources are trivially valid */ + /* Set the preload register */ + Preload(dev, k, tick); - tmp = cmd->start_src; - cmd->start_src &= TRIG_NOW | TRIG_INT | TRIG_EXT; - if (!cmd->start_src || tmp != cmd->start_src) - err++; + /* Software index pulse forces the preload register to load */ + /* into the counter */ + k->SetLoadTrig(dev, k, 0); + k->PulseIndex(dev, k); - tmp = cmd->scan_begin_src; - cmd->scan_begin_src &= TRIG_TIMER | TRIG_EXT | TRIG_FOLLOW; - if (!cmd->scan_begin_src || tmp != cmd->scan_begin_src) - err++; + /* set reload on counter overflow */ + k->SetLoadTrig(dev, k, 1); - tmp = cmd->convert_src; - cmd->convert_src &= TRIG_TIMER | TRIG_EXT | TRIG_NOW; - if (!cmd->convert_src || tmp != cmd->convert_src) - err++; + /* set interrupt on overflow */ + k->SetIntSrc(dev, k, INTSRC_OVER); - tmp = cmd->scan_end_src; - cmd->scan_end_src &= TRIG_COUNT; - if (!cmd->scan_end_src || tmp != cmd->scan_end_src) - err++; + SetLatchSource(dev, k, valueSrclatch); + /* k->SetEnable(dev,k,(uint16_t)(enab != 0)); */ +} - tmp = cmd->stop_src; - cmd->stop_src &= TRIG_COUNT | TRIG_NONE; - if (!cmd->stop_src || tmp != cmd->stop_src) - err++; +/* *********** DAC FUNCTIONS *********** */ - if (err) - return 1; +/* Slot 0 base settings. */ +#define VECT0 (XSD2 | RSD3 | SIB_A2) +/* Slot 0 always shifts in 0xFF and store it to FB_BUFFER2. */ - /* step 2: make sure trigger sources are unique and mutually - compatible */ +/* TrimDac LogicalChan-to-PhysicalChan mapping table. */ +static uint8_t trimchan[] = { 10, 9, 8, 3, 2, 7, 6, 1, 0, 5, 4 }; - /* note that mutual compatibility is not an issue here */ - if (cmd->scan_begin_src != TRIG_TIMER && - cmd->scan_begin_src != TRIG_EXT - && cmd->scan_begin_src != TRIG_FOLLOW) - err++; - if (cmd->convert_src != TRIG_TIMER && - cmd->convert_src != TRIG_EXT && cmd->convert_src != TRIG_NOW) - err++; - if (cmd->stop_src != TRIG_COUNT && cmd->stop_src != TRIG_NONE) - err++; +/* TrimDac LogicalChan-to-EepromAdrs mapping table. */ +static uint8_t trimadrs[] = { 0x40, 0x41, 0x42, 0x50, 0x51, 0x52, 0x53, 0x60, 0x61, 0x62, 0x63 }; - if (err) - return 2; +static void LoadTrimDACs(struct comedi_device *dev) +{ + register uint8_t i; - /* step 3: make sure arguments are trivially compatible */ + /* Copy TrimDac setpoint values from EEPROM to TrimDacs. */ + for (i = 0; i < ARRAY_SIZE(trimchan); i++) + WriteTrimDAC(dev, i, I2Cread(dev, trimadrs[i])); +} - if (cmd->start_src != TRIG_EXT && cmd->start_arg != 0) { - cmd->start_arg = 0; - err++; - } - - if (cmd->start_src == TRIG_EXT && cmd->start_arg > 39) { - cmd->start_arg = 39; - err++; - } - - if (cmd->scan_begin_src == TRIG_EXT && cmd->scan_begin_arg > 39) { - cmd->scan_begin_arg = 39; - err++; - } - - if (cmd->convert_src == TRIG_EXT && cmd->convert_arg > 39) { - cmd->convert_arg = 39; - err++; - } -#define MAX_SPEED 200000 /* in nanoseconds */ -#define MIN_SPEED 2000000000 /* in nanoseconds */ - - if (cmd->scan_begin_src == TRIG_TIMER) { - if (cmd->scan_begin_arg < MAX_SPEED) { - cmd->scan_begin_arg = MAX_SPEED; - err++; - } - if (cmd->scan_begin_arg > MIN_SPEED) { - cmd->scan_begin_arg = MIN_SPEED; - err++; - } - } else { - /* external trigger */ - /* should be level/edge, hi/lo specification here */ - /* should specify multiple external triggers */ -/* if(cmd->scan_begin_arg>9){ */ -/* cmd->scan_begin_arg=9; */ -/* err++; */ -/* } */ - } - if (cmd->convert_src == TRIG_TIMER) { - if (cmd->convert_arg < MAX_SPEED) { - cmd->convert_arg = MAX_SPEED; - err++; - } - if (cmd->convert_arg > MIN_SPEED) { - cmd->convert_arg = MIN_SPEED; - err++; - } - } else { - /* external trigger */ - /* see above */ -/* if(cmd->convert_arg>9){ */ -/* cmd->convert_arg=9; */ -/* err++; */ -/* } */ - } +static void WriteTrimDAC(struct comedi_device *dev, uint8_t LogicalChan, + uint8_t DacData) +{ + uint32_t chan; - if (cmd->scan_end_arg != cmd->chanlist_len) { - cmd->scan_end_arg = cmd->chanlist_len; - err++; - } - if (cmd->stop_src == TRIG_COUNT) { - if (cmd->stop_arg > 0x00ffffff) { - cmd->stop_arg = 0x00ffffff; - err++; - } - } else { - /* TRIG_NONE */ - if (cmd->stop_arg != 0) { - cmd->stop_arg = 0; - err++; - } - } + /* Save the new setpoint in case the application needs to read it back later. */ + devpriv->TrimSetpoint[LogicalChan] = (uint8_t) DacData; - if (err) - return 3; + /* Map logical channel number to physical channel number. */ + chan = (uint32_t) trimchan[LogicalChan]; - /* step 4: fix up any arguments */ + /* Set up TSL2 records for TrimDac write operation. All slots shift + * 0xFF in from pulled-up SD3 so that the end of the slot sequence + * can be detected. + */ - if (cmd->scan_begin_src == TRIG_TIMER) { - tmp = cmd->scan_begin_arg; - s626_ns_to_timer((int *)&cmd->scan_begin_arg, - cmd->flags & TRIG_ROUND_MASK); - if (tmp != cmd->scan_begin_arg) - err++; - } - if (cmd->convert_src == TRIG_TIMER) { - tmp = cmd->convert_arg; - s626_ns_to_timer((int *)&cmd->convert_arg, - cmd->flags & TRIG_ROUND_MASK); - if (tmp != cmd->convert_arg) - err++; - if (cmd->scan_begin_src == TRIG_TIMER && - cmd->scan_begin_arg < - cmd->convert_arg * cmd->scan_end_arg) { - cmd->scan_begin_arg = - cmd->convert_arg * cmd->scan_end_arg; - err++; - } - } + SETVECT(2, XSD2 | XFIFO_1 | WS3); + /* Slot 2: Send high uint8_t to target TrimDac. */ + SETVECT(3, XSD2 | XFIFO_0 | WS3); + /* Slot 3: Send low uint8_t to target TrimDac. */ + SETVECT(4, XSD2 | XFIFO_3 | WS1); + /* Slot 4: Send NOP high uint8_t to DAC0 to keep clock running. */ + SETVECT(5, XSD2 | XFIFO_2 | WS1 | EOS); + /* Slot 5: Send NOP low uint8_t to DAC0. */ - if (err) - return 4; + /* Construct and transmit target DAC's serial packet: + * ( 0000 AAAA ), ( DDDD DDDD ),( 0x00 ),( 0x00 ) where A<3:0> is the + * DAC channel's address, and D<7:0> is the DAC setpoint. Append a + * WORD value (that writes a channel 0 NOP command to a non-existent + * main DAC channel) that serves to keep the clock running after the + * packet has been sent to the target DAC. + */ - return 0; + /* Address the DAC channel within the trimdac device. */ + SendDAC(dev, ((uint32_t) chan << 8) + | (uint32_t) DacData); /* Include DAC setpoint data. */ } -static int s626_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) -{ - /* Stop RPS program in case it is currently running. */ - MC_DISABLE(P_MC1, MC1_ERPS1); - - /* disable master interrupt */ - writel(0, devpriv->base_addr + P_IER); +/* ************** EEPROM ACCESS FUNCTIONS ************** */ +/* Read uint8_t from EEPROM. */ - devpriv->ai_cmd_running = 0; +static uint8_t I2Cread(struct comedi_device *dev, uint8_t addr) +{ + uint8_t rtnval; - return 0; -} + /* Send EEPROM target address. */ + if (I2Chandshake(dev, I2C_B2(I2C_ATTRSTART, I2CW) + /* Byte2 = I2C command: write to I2C EEPROM device. */ + | I2C_B1(I2C_ATTRSTOP, addr) + /* Byte1 = EEPROM internal target address. */ + | I2C_B0(I2C_ATTRNOP, 0))) { /* Byte0 = Not sent. */ + /* Abort function and declare error if handshake failed. */ + DEBUG("I2Cread: error handshake I2Cread a\n"); + return 0; + } + /* Execute EEPROM read. */ + if (I2Chandshake(dev, I2C_B2(I2C_ATTRSTART, I2CR) -/* This function doesn't require a particular form, this is just what - * happens to be used in some of the drivers. It should convert ns - * nanoseconds to a counter value suitable for programming the device. - * Also, it should adjust ns so that it cooresponds to the actual time - * that the device will use. */ -static int s626_ns_to_timer(int *nanosec, int round_mode) -{ - int divider, base; + /* Byte2 = I2C */ + /* command: read */ + /* from I2C EEPROM */ + /* device. */ + |I2C_B1(I2C_ATTRSTOP, 0) - base = 500; /* 2MHz internal clock */ + /* Byte1 receives */ + /* uint8_t from */ + /* EEPROM. */ + |I2C_B0(I2C_ATTRNOP, 0))) { /* Byte0 = Not sent. */ - switch (round_mode) { - case TRIG_ROUND_NEAREST: - default: - divider = (*nanosec + base / 2) / base; - break; - case TRIG_ROUND_DOWN: - divider = (*nanosec) / base; - break; - case TRIG_ROUND_UP: - divider = (*nanosec + base - 1) / base; - break; + /* Abort function and declare error if handshake failed. */ + DEBUG("I2Cread: error handshake I2Cread b\n"); + return 0; } - - *nanosec = base * divider; - return divider - 1; + /* Return copy of EEPROM value. */ + rtnval = (uint8_t) (RR7146(P_I2CCTRL) >> 16); + return rtnval; } -static int s626_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static uint32_t I2Chandshake(struct comedi_device *dev, uint32_t val) { + /* Write I2C command to I2C Transfer Control shadow register. */ + WR7146(P_I2CCTRL, val); - int i; - uint16_t chan = CR_CHAN(insn->chanspec); - int16_t dacdata; - - for (i = 0; i < insn->n; i++) { - dacdata = (int16_t) data[i]; - devpriv->ao_readback[CR_CHAN(insn->chanspec)] = data[i]; - dacdata -= (0x1fff); - - SetDAC(dev, chan, dacdata); - } + /* Upload I2C shadow registers into working registers and wait for */ + /* upload confirmation. */ - return i; -} + MC_ENABLE(P_MC2, MC2_UPLD_IIC); + while (!MC_TEST(P_MC2, MC2_UPLD_IIC)) + ; -static int s626_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) -{ - int i; + /* Wait until I2C bus transfer is finished or an error occurs. */ + while ((RR7146(P_I2CCTRL) & (I2C_BUSY | I2C_ERR)) == I2C_BUSY) + ; - for (i = 0; i < insn->n; i++) - data[i] = devpriv->ao_readback[CR_CHAN(insn->chanspec)]; + /* Return non-zero if I2C error occurred. */ + return RR7146(P_I2CCTRL) & I2C_ERR; - return i; } -/* *************** DIGITAL I/O FUNCTIONS *************** - * All DIO functions address a group of DIO channels by means of - * "group" argument. group may be 0, 1 or 2, which correspond to DIO - * ports A, B and C, respectively. - */ +/* Private helper function: Write setpoint to an application DAC channel. */ -static void s626_dio_init(struct comedi_device *dev) +static void SetDAC(struct comedi_device *dev, uint16_t chan, short dacdata) { - uint16_t group; - struct comedi_subdevice *s; + register uint16_t signmask; + register uint32_t WSImage; - /* Prepare to treat writes to WRCapSel as capture disables. */ - DEBIwrite(dev, LP_MISC1, MISC1_NOEDCAP); + /* Adjust DAC data polarity and set up Polarity Control Register */ + /* image. */ + signmask = 1 << chan; + if (dacdata < 0) { + dacdata = -dacdata; + devpriv->Dacpol |= signmask; + } else + devpriv->Dacpol &= ~signmask; - /* For each group of sixteen channels ... */ - for (group = 0; group < S626_DIO_BANKS; group++) { - s = dev->subdevices + 2 + group; - DEBIwrite(dev, diopriv->WRIntSel, 0); /* Disable all interrupts. */ - DEBIwrite(dev, diopriv->WRCapSel, 0xFFFF); /* Disable all event */ - /* captures. */ - DEBIwrite(dev, diopriv->WREdgSel, 0); /* Init all DIOs to */ - /* default edge */ - /* polarity. */ - DEBIwrite(dev, diopriv->WRDOut, 0); /* Program all outputs */ - /* to inactive state. */ - } - DEBUG("s626_dio_init: DIO initialized\n"); -} - -/* DIO devices are slightly special. Although it is possible to - * implement the insn_read/insn_write interface, it is much more - * useful to applications if you implement the insn_bits interface. - * This allows packed reading/writing of the DIO channels. The comedi - * core can convert between insn_bits and insn_read/write */ + /* Limit DAC setpoint value to valid range. */ + if ((uint16_t) dacdata > 0x1FFF) + dacdata = 0x1FFF; -static int s626_dio_insn_bits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) -{ - /* - * The insn data consists of a mask in data[0] and the new data in - * data[1]. The mask defines which bits we are concerning about. - * The new data must be anded with the mask. Each channel - * corresponds to a bit. + /* Set up TSL2 records (aka "vectors") for DAC update. Vectors V2 + * and V3 transmit the setpoint to the target DAC. V4 and V5 send + * data to a non-existent TrimDac channel just to keep the clock + * running after sending data to the target DAC. This is necessary + * to eliminate the clock glitch that would otherwise occur at the + * end of the target DAC's serial data stream. When the sequence + * restarts at V0 (after executing V5), the gate array automatically + * disables gating for the DAC clock and all DAC chip selects. */ - if (data[0]) { - /* Check if requested ports are configured for output */ - if ((s->io_bits & data[0]) != data[0]) - return -EIO; - s->state &= ~data[0]; - s->state |= data[0] & data[1]; - - /* Write out the new digital output lines */ + WSImage = (chan & 2) ? WS1 : WS2; + /* Choose DAC chip select to be asserted. */ + SETVECT(2, XSD2 | XFIFO_1 | WSImage); + /* Slot 2: Transmit high data byte to target DAC. */ + SETVECT(3, XSD2 | XFIFO_0 | WSImage); + /* Slot 3: Transmit low data byte to target DAC. */ + SETVECT(4, XSD2 | XFIFO_3 | WS3); + /* Slot 4: Transmit to non-existent TrimDac channel to keep clock */ + SETVECT(5, XSD2 | XFIFO_2 | WS3 | EOS); + /* Slot 5: running after writing target DAC's low data byte. */ - DEBIwrite(dev, diopriv->WRDOut, s->state); - } - data[1] = DEBIread(dev, diopriv->RDDIn); + /* Construct and transmit target DAC's serial packet: + * ( A10D DDDD ),( DDDD DDDD ),( 0x0F ),( 0x00 ) where A is chan<0>, + * and D<12:0> is the DAC setpoint. Append a WORD value (that writes + * to a non-existent TrimDac channel) that serves to keep the clock + * running after the packet has been sent to the target DAC. + */ + SendDAC(dev, 0x0F000000 + /* Continue clock after target DAC data (write to non-existent trimdac). */ + | 0x00004000 + /* Address the two main dual-DAC devices (TSL's chip select enables + * target device). */ + | ((uint32_t) (chan & 1) << 15) + /* Address the DAC channel within the device. */ + | (uint32_t) dacdata); /* Include DAC setpoint data. */ - return insn->n; } -static int s626_dio_insn_config(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) -{ +/* Private helper function: Transmit serial data to DAC via Audio + * channel 2. Assumes: (1) TSL2 slot records initialized, and (2) + * Dacpol contains valid target image. + */ - switch (data[0]) { - case INSN_CONFIG_DIO_QUERY: - data[1] = - (s-> - io_bits & (1 << CR_CHAN(insn->chanspec))) ? COMEDI_OUTPUT : - COMEDI_INPUT; - return insn->n; - break; - case COMEDI_INPUT: - s->io_bits &= ~(1 << CR_CHAN(insn->chanspec)); - break; - case COMEDI_OUTPUT: - s->io_bits |= 1 << CR_CHAN(insn->chanspec); - break; - default: - return -EINVAL; - break; - } - DEBIwrite(dev, diopriv->WRDOut, s->io_bits); +static void SendDAC(struct comedi_device *dev, uint32_t val) +{ - return 1; -} + /* START THE SERIAL CLOCK RUNNING ------------- */ -static int s626_dio_set_irq(struct comedi_device *dev, unsigned int chan) -{ - unsigned int group; - unsigned int bitmask; - unsigned int status; + /* Assert DAC polarity control and enable gating of DAC serial clock + * and audio bit stream signals. At this point in time we must be + * assured of being in time slot 0. If we are not in slot 0, the + * serial clock and audio stream signals will be disabled; this is + * because the following DEBIwrite statement (which enables signals + * to be passed through the gate array) would execute before the + * trailing edge of WS1/WS3 (which turns off the signals), thus + * causing the signals to be inactive during the DAC write. + */ + DEBIwrite(dev, LP_DACPOL, devpriv->Dacpol); - /* select dio bank */ - group = chan / 16; - bitmask = 1 << (chan - (16 * group)); - DEBUG("s626_dio_set_irq: enable interrupt on dio channel %d group %d\n", - chan - (16 * group), group); + /* TRANSFER OUTPUT DWORD VALUE INTO A2'S OUTPUT FIFO ---------------- */ - /* set channel to capture positive edge */ - status = DEBIread(dev, - ((struct dio_private *)(dev->subdevices + 2 + - group)->private)->RDEdgSel); - DEBIwrite(dev, - ((struct dio_private *)(dev->subdevices + 2 + - group)->private)->WREdgSel, - bitmask | status); + /* Copy DAC setpoint value to DAC's output DMA buffer. */ - /* enable interrupt on selected channel */ - status = DEBIread(dev, - ((struct dio_private *)(dev->subdevices + 2 + - group)->private)->RDIntSel); - DEBIwrite(dev, - ((struct dio_private *)(dev->subdevices + 2 + - group)->private)->WRIntSel, - bitmask | status); + /* WR7146( (uint32_t)devpriv->pDacWBuf, val ); */ + *devpriv->pDacWBuf = val; - /* enable edge capture write command */ - DEBIwrite(dev, LP_MISC1, MISC1_EDCAP); + /* enab the output DMA transfer. This will cause the DMAC to copy + * the DAC's data value to A2's output FIFO. The DMA transfer will + * then immediately terminate because the protection address is + * reached upon transfer of the first DWORD value. + */ + MC_ENABLE(P_MC1, MC1_A2OUT); - /* enable edge capture on selected channel */ - status = DEBIread(dev, - ((struct dio_private *)(dev->subdevices + 2 + - group)->private)->RDCapSel); - DEBIwrite(dev, - ((struct dio_private *)(dev->subdevices + 2 + - group)->private)->WRCapSel, - bitmask | status); + /* While the DMA transfer is executing ... */ - return 0; -} + /* Reset Audio2 output FIFO's underflow flag (along with any other + * FIFO underflow/overflow flags). When set, this flag will + * indicate that we have emerged from slot 0. + */ + WR7146(P_ISR, ISR_AFOU); -static int s626_dio_reset_irq(struct comedi_device *dev, unsigned int group, - unsigned int mask) -{ - DEBUG - ("s626_dio_reset_irq: disable interrupt on dio channel %d group %d\n", - mask, group); + /* Wait for the DMA transfer to finish so that there will be data + * available in the FIFO when time slot 1 tries to transfer a DWORD + * from the FIFO to the output buffer register. We test for DMA + * Done by polling the DMAC enable flag; this flag is automatically + * cleared when the transfer has finished. + */ + while ((RR7146(P_MC1) & MC1_A2OUT) != 0) + ; - /* disable edge capture write command */ - DEBIwrite(dev, LP_MISC1, MISC1_NOEDCAP); + /* START THE OUTPUT STREAM TO THE TARGET DAC -------------------- */ - /* enable edge capture on selected channel */ - DEBIwrite(dev, - ((struct dio_private *)(dev->subdevices + 2 + - group)->private)->WRCapSel, mask); + /* FIFO data is now available, so we enable execution of time slots + * 1 and higher by clearing the EOS flag in slot 0. Note that SD3 + * will be shifted in and stored in FB_BUFFER2 for end-of-slot-list + * detection. + */ + SETVECT(0, XSD2 | RSD3 | SIB_A2); - return 0; -} + /* Wait for slot 1 to execute to ensure that the Packet will be + * transmitted. This is detected by polling the Audio2 output FIFO + * underflow flag, which will be set when slot 1 execution has + * finished transferring the DAC's data DWORD from the output FIFO + * to the output buffer register. + */ + while ((RR7146(P_SSR) & SSR_AF2_OUT) == 0) + ; -static int s626_dio_clear_irq(struct comedi_device *dev) -{ - unsigned int group; + /* Set up to trap execution at slot 0 when the TSL sequencer cycles + * back to slot 0 after executing the EOS in slot 5. Also, + * simultaneously shift out and in the 0x00 that is ALWAYS the value + * stored in the last byte to be shifted out of the FIFO's DWORD + * buffer register. + */ + SETVECT(0, XSD2 | XFIFO_2 | RSD2 | SIB_A2 | EOS); - /* disable edge capture write command */ - DEBIwrite(dev, LP_MISC1, MISC1_NOEDCAP); + /* WAIT FOR THE TRANSACTION TO FINISH ----------------------- */ - for (group = 0; group < S626_DIO_BANKS; group++) { - /* clear pending events and interrupt */ - DEBIwrite(dev, - ((struct dio_private *)(dev->subdevices + 2 + - group)->private)->WRCapSel, - 0xffff); + /* Wait for the TSL to finish executing all time slots before + * exiting this function. We must do this so that the next DAC + * write doesn't start, thereby enabling clock/chip select signals: + * + * 1. Before the TSL sequence cycles back to slot 0, which disables + * the clock/cs signal gating and traps slot // list execution. + * we have not yet finished slot 5 then the clock/cs signals are + * still gated and we have not finished transmitting the stream. + * + * 2. While slots 2-5 are executing due to a late slot 0 trap. In + * this case, the slot sequence is currently repeating, but with + * clock/cs signals disabled. We must wait for slot 0 to trap + * execution before setting up the next DAC setpoint DMA transfer + * and enabling the clock/cs signals. To detect the end of slot 5, + * we test for the FB_BUFFER2 MSB contents to be equal to 0xFF. If + * the TSL has not yet finished executing slot 5 ... + */ + if ((RR7146(P_FB_BUFFER2) & 0xFF000000) != 0) { + /* The trap was set on time and we are still executing somewhere + * in slots 2-5, so we now wait for slot 0 to execute and trap + * TSL execution. This is detected when FB_BUFFER2 MSB changes + * from 0xFF to 0x00, which slot 0 causes to happen by shifting + * out/in on SD2 the 0x00 that is always referenced by slot 5. + */ + while ((RR7146(P_FB_BUFFER2) & 0xFF000000) != 0) + ; } + /* Either (1) we were too late setting the slot 0 trap; the TSL + * sequencer restarted slot 0 before we could set the EOS trap flag, + * or (2) we were not late and execution is now trapped at slot 0. + * In either case, we must now change slot 0 so that it will store + * value 0xFF (instead of 0x00) to FB_BUFFER2 next time it executes. + * In order to do this, we reprogram slot 0 so that it will shift in + * SD3, which is driven only by a pull-up resistor. + */ + SETVECT(0, RSD3 | SIB_A2 | EOS); - return 0; + /* Wait for slot 0 to execute, at which time the TSL is setup for + * the next DAC write. This is detected when FB_BUFFER2 MSB changes + * from 0x00 to 0xFF. + */ + while ((RR7146(P_FB_BUFFER2) & 0xFF000000) == 0) + ; } -/* Now this function initializes the value of the counter (data[0]) - and set the subdevice. To complete with trigger and interrupt - configuration */ -static int s626_enc_insn_config(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static void WriteMISC2(struct comedi_device *dev, uint16_t NewImage) { - uint16_t Setup = (LOADSRC_INDX << BF_LOADSRC) | /* Preload upon */ - /* index. */ - (INDXSRC_SOFT << BF_INDXSRC) | /* Disable hardware index. */ - (CLKSRC_COUNTER << BF_CLKSRC) | /* Operating mode is Counter. */ - (CLKPOL_POS << BF_CLKPOL) | /* Active high clock. */ - /* ( CNTDIR_UP << BF_CLKPOL ) | // Count direction is Down. */ - (CLKMULT_1X << BF_CLKMULT) | /* Clock multiplier is 1x. */ - (CLKENAB_INDEX << BF_CLKENAB); - /* uint16_t DisableIntSrc=TRUE; */ - /* uint32_t Preloadvalue; //Counter initial value */ - uint16_t valueSrclatch = LATCHSRC_AB_READ; - uint16_t enab = CLKENAB_ALWAYS; - struct enc_private *k = &encpriv[CR_CHAN(insn->chanspec)]; + DEBIwrite(dev, LP_MISC1, MISC1_WENABLE); /* enab writes to */ + /* MISC2 register. */ + DEBIwrite(dev, LP_WRMISC2, NewImage); /* Write new image to MISC2. */ + DEBIwrite(dev, LP_MISC1, MISC1_WDISABLE); /* Disable writes to MISC2. */ +} - DEBUG("s626_enc_insn_config: encoder config\n"); +/* Initialize the DEBI interface for all transfers. */ - /* (data==NULL) ? (Preloadvalue=0) : (Preloadvalue=data[0]); */ +static uint16_t DEBIread(struct comedi_device *dev, uint16_t addr) +{ + uint16_t retval; - k->SetMode(dev, k, Setup, TRUE); - Preload(dev, k, *(insn->data)); - k->PulseIndex(dev, k); - SetLatchSource(dev, k, valueSrclatch); - k->SetEnable(dev, k, (uint16_t) (enab != 0)); + /* Set up DEBI control register value in shadow RAM. */ + WR7146(P_DEBICMD, DEBI_CMD_RDWORD | addr); - return insn->n; + /* Execute the DEBI transfer. */ + DEBItransfer(dev); + + /* Fetch target register value. */ + retval = (uint16_t) RR7146(P_DEBIAD); + + /* Return register value. */ + return retval; } -static int s626_enc_insn_read(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +/* Execute a DEBI transfer. This must be called from within a */ +/* critical section. */ +static void DEBItransfer(struct comedi_device *dev) { + /* Initiate upload of shadow RAM to DEBI control register. */ + MC_ENABLE(P_MC2, MC2_UPLD_DEBI); - int n; - struct enc_private *k = &encpriv[CR_CHAN(insn->chanspec)]; + /* Wait for completion of upload from shadow RAM to DEBI control */ + /* register. */ + while (!MC_TEST(P_MC2, MC2_UPLD_DEBI)) + ; - DEBUG("s626_enc_insn_read: encoder read channel %d\n", - CR_CHAN(insn->chanspec)); + /* Wait until DEBI transfer is done. */ + while (RR7146(P_PSR) & PSR_DEBI_S) + ; +} - for (n = 0; n < insn->n; n++) - data[n] = ReadLatch(dev, k); +/* Write a value to a gate array register. */ +static void DEBIwrite(struct comedi_device *dev, uint16_t addr, uint16_t wdata) +{ - DEBUG("s626_enc_insn_read: encoder sample %d\n", data[n]); + /* Set up DEBI control register value in shadow RAM. */ + WR7146(P_DEBICMD, DEBI_CMD_WRWORD | addr); + WR7146(P_DEBIAD, wdata); - return n; + /* Execute the DEBI transfer. */ + DEBItransfer(dev); } -static int s626_enc_insn_write(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +/* Replace the specified bits in a gate array register. Imports: mask + * specifies bits that are to be preserved, wdata is new value to be + * or'd with the masked original. + */ +static void DEBIreplace(struct comedi_device *dev, uint16_t addr, uint16_t mask, + uint16_t wdata) { - struct enc_private *k = &encpriv[CR_CHAN(insn->chanspec)]; + /* Copy target gate array register into P_DEBIAD register. */ + WR7146(P_DEBICMD, DEBI_CMD_RDWORD | addr); + /* Set up DEBI control reg value in shadow RAM. */ + DEBItransfer(dev); /* Execute the DEBI Read transfer. */ - DEBUG("s626_enc_insn_write: encoder write channel %d\n", - CR_CHAN(insn->chanspec)); + /* Write back the modified image. */ + WR7146(P_DEBICMD, DEBI_CMD_WRWORD | addr); + /* Set up DEBI control reg value in shadow RAM. */ - /* Set the preload register */ - Preload(dev, k, data[0]); + WR7146(P_DEBIAD, wdata | ((uint16_t) RR7146(P_DEBIAD) & mask)); + /* Modify the register image. */ + DEBItransfer(dev); /* Execute the DEBI Write transfer. */ +} - /* Software index pulse forces the preload register to load */ - /* into the counter */ - k->SetLoadTrig(dev, k, 0); - k->PulseIndex(dev, k); - k->SetLoadTrig(dev, k, 2); +static void CloseDMAB(struct comedi_device *dev, struct bufferDMA *pdma, + size_t bsize) +{ + void *vbptr; + dma_addr_t vpptr; - DEBUG("s626_enc_insn_write: End encoder write\n"); + DEBUG("CloseDMAB: Entering S626DRV_CloseDMAB():\n"); + if (pdma == NULL) + return; + /* find the matching allocation from the board struct */ - return 1; + vbptr = pdma->LogicalBase; + vpptr = pdma->PhysicalBase; + if (vbptr) { + pci_free_consistent(devpriv->pdev, bsize, vbptr, vpptr); + pdma->LogicalBase = NULL; + pdma->PhysicalBase = 0; + + DEBUG("CloseDMAB(): Logical=%p, bsize=%d, Physical=0x%x\n", + vbptr, bsize, (uint32_t) vpptr); + } } -static void s626_timer_load(struct comedi_device *dev, struct enc_private *k, - int tick) +/* ****** COUNTER FUNCTIONS ******* */ +/* All counter functions address a specific counter by means of the + * "Counter" argument, which is a logical counter number. The Counter + * argument may have any of the following legal values: 0=0A, 1=1A, + * 2=2A, 3=0B, 4=1B, 5=2B. + */ + +/* Forward declarations for functions that are common to both A and B counters: */ + +/* ****** PRIVATE COUNTER FUNCTIONS ****** */ + +/* Read a counter's output latch. */ + +static uint32_t ReadLatch(struct comedi_device *dev, struct enc_private *k) { - uint16_t Setup = (LOADSRC_INDX << BF_LOADSRC) | /* Preload upon */ - /* index. */ - (INDXSRC_SOFT << BF_INDXSRC) | /* Disable hardware index. */ - (CLKSRC_TIMER << BF_CLKSRC) | /* Operating mode is Timer. */ - (CLKPOL_POS << BF_CLKPOL) | /* Active high clock. */ - (CNTDIR_DOWN << BF_CLKPOL) | /* Count direction is Down. */ - (CLKMULT_1X << BF_CLKMULT) | /* Clock multiplier is 1x. */ - (CLKENAB_INDEX << BF_CLKENAB); - uint16_t valueSrclatch = LATCHSRC_A_INDXA; - /* uint16_t enab=CLKENAB_ALWAYS; */ + register uint32_t value; + /* DEBUG FIXME DEBUG("ReadLatch: Read Latch enter\n"); */ - k->SetMode(dev, k, Setup, FALSE); + /* Latch counts and fetch LSW of latched counts value. */ + value = (uint32_t) DEBIread(dev, k->MyLatchLsw); - /* Set the preload register */ - Preload(dev, k, tick); + /* Fetch MSW of latched counts and combine with LSW. */ + value |= ((uint32_t) DEBIread(dev, k->MyLatchLsw + 2) << 16); - /* Software index pulse forces the preload register to load */ - /* into the counter */ - k->SetLoadTrig(dev, k, 0); - k->PulseIndex(dev, k); + /* DEBUG FIXME DEBUG("ReadLatch: Read Latch exit\n"); */ + + /* Return latched counts. */ + return value; +} - /* set reload on counter overflow */ - k->SetLoadTrig(dev, k, 1); +/* Reset a counter's index and overflow event capture flags. */ - /* set interrupt on overflow */ - k->SetIntSrc(dev, k, INTSRC_OVER); +static void ResetCapFlags_A(struct comedi_device *dev, struct enc_private *k) +{ + DEBIreplace(dev, k->MyCRB, (uint16_t) (~CRBMSK_INTCTRL), + CRBMSK_INTRESETCMD | CRBMSK_INTRESET_A); +} - SetLatchSource(dev, k, valueSrclatch); - /* k->SetEnable(dev,k,(uint16_t)(enab != 0)); */ +static void ResetCapFlags_B(struct comedi_device *dev, struct enc_private *k) +{ + DEBIreplace(dev, k->MyCRB, (uint16_t) (~CRBMSK_INTCTRL), + CRBMSK_INTRESETCMD | CRBMSK_INTRESET_B); } -/* *********** DAC FUNCTIONS *********** */ +/* Return counter setup in a format (COUNTER_SETUP) that is consistent */ +/* for both A and B counters. */ -/* Slot 0 base settings. */ -#define VECT0 (XSD2 | RSD3 | SIB_A2) -/* Slot 0 always shifts in 0xFF and store it to FB_BUFFER2. */ +static uint16_t GetMode_A(struct comedi_device *dev, struct enc_private *k) +{ + register uint16_t cra; + register uint16_t crb; + register uint16_t setup; -/* TrimDac LogicalChan-to-PhysicalChan mapping table. */ -static uint8_t trimchan[] = { 10, 9, 8, 3, 2, 7, 6, 1, 0, 5, 4 }; + /* Fetch CRA and CRB register images. */ + cra = DEBIread(dev, k->MyCRA); + crb = DEBIread(dev, k->MyCRB); -/* TrimDac LogicalChan-to-EepromAdrs mapping table. */ -static uint8_t trimadrs[] = { 0x40, 0x41, 0x42, 0x50, 0x51, 0x52, 0x53, 0x60, 0x61, 0x62, 0x63 }; + /* Populate the standardized counter setup bit fields. Note: */ + /* IndexSrc is restricted to ENC_X or IndxPol. */ + setup = ((cra & STDMSK_LOADSRC) /* LoadSrc = LoadSrcA. */ + |((crb << (STDBIT_LATCHSRC - CRBBIT_LATCHSRC)) & STDMSK_LATCHSRC) /* LatchSrc = LatchSrcA. */ + |((cra << (STDBIT_INTSRC - CRABIT_INTSRC_A)) & STDMSK_INTSRC) /* IntSrc = IntSrcA. */ + |((cra << (STDBIT_INDXSRC - (CRABIT_INDXSRC_A + 1))) & STDMSK_INDXSRC) /* IndxSrc = IndxSrcA<1>. */ + |((cra >> (CRABIT_INDXPOL_A - STDBIT_INDXPOL)) & STDMSK_INDXPOL) /* IndxPol = IndxPolA. */ + |((crb >> (CRBBIT_CLKENAB_A - STDBIT_CLKENAB)) & STDMSK_CLKENAB)); /* ClkEnab = ClkEnabA. */ -static void LoadTrimDACs(struct comedi_device *dev) -{ - register uint8_t i; + /* Adjust mode-dependent parameters. */ + if (cra & (2 << CRABIT_CLKSRC_A)) /* If Timer mode (ClkSrcA<1> == 1): */ + setup |= ((CLKSRC_TIMER << STDBIT_CLKSRC) /* Indicate Timer mode. */ + |((cra << (STDBIT_CLKPOL - CRABIT_CLKSRC_A)) & STDMSK_CLKPOL) /* Set ClkPol to indicate count direction (ClkSrcA<0>). */ + |(MULT_X1 << STDBIT_CLKMULT)); /* ClkMult must be 1x in Timer mode. */ - /* Copy TrimDac setpoint values from EEPROM to TrimDacs. */ - for (i = 0; i < ARRAY_SIZE(trimchan); i++) - WriteTrimDAC(dev, i, I2Cread(dev, trimadrs[i])); + else /* If Counter mode (ClkSrcA<1> == 0): */ + setup |= ((CLKSRC_COUNTER << STDBIT_CLKSRC) /* Indicate Counter mode. */ + |((cra >> (CRABIT_CLKPOL_A - STDBIT_CLKPOL)) & STDMSK_CLKPOL) /* Pass through ClkPol. */ + |(((cra & CRAMSK_CLKMULT_A) == (MULT_X0 << CRABIT_CLKMULT_A)) ? /* Force ClkMult to 1x if not legal, else pass through. */ + (MULT_X1 << STDBIT_CLKMULT) : + ((cra >> (CRABIT_CLKMULT_A - + STDBIT_CLKMULT)) & STDMSK_CLKMULT))); + + /* Return adjusted counter setup. */ + return setup; } -static void WriteTrimDAC(struct comedi_device *dev, uint8_t LogicalChan, - uint8_t DacData) +static uint16_t GetMode_B(struct comedi_device *dev, struct enc_private *k) { - uint32_t chan; + register uint16_t cra; + register uint16_t crb; + register uint16_t setup; - /* Save the new setpoint in case the application needs to read it back later. */ - devpriv->TrimSetpoint[LogicalChan] = (uint8_t) DacData; + /* Fetch CRA and CRB register images. */ + cra = DEBIread(dev, k->MyCRA); + crb = DEBIread(dev, k->MyCRB); - /* Map logical channel number to physical channel number. */ - chan = (uint32_t) trimchan[LogicalChan]; + /* Populate the standardized counter setup bit fields. Note: */ + /* IndexSrc is restricted to ENC_X or IndxPol. */ + setup = (((crb << (STDBIT_INTSRC - CRBBIT_INTSRC_B)) & STDMSK_INTSRC) /* IntSrc = IntSrcB. */ + |((crb << (STDBIT_LATCHSRC - CRBBIT_LATCHSRC)) & STDMSK_LATCHSRC) /* LatchSrc = LatchSrcB. */ + |((crb << (STDBIT_LOADSRC - CRBBIT_LOADSRC_B)) & STDMSK_LOADSRC) /* LoadSrc = LoadSrcB. */ + |((crb << (STDBIT_INDXPOL - CRBBIT_INDXPOL_B)) & STDMSK_INDXPOL) /* IndxPol = IndxPolB. */ + |((crb >> (CRBBIT_CLKENAB_B - STDBIT_CLKENAB)) & STDMSK_CLKENAB) /* ClkEnab = ClkEnabB. */ + |((cra >> ((CRABIT_INDXSRC_B + 1) - STDBIT_INDXSRC)) & STDMSK_INDXSRC)); /* IndxSrc = IndxSrcB<1>. */ - /* Set up TSL2 records for TrimDac write operation. All slots shift - * 0xFF in from pulled-up SD3 so that the end of the slot sequence - * can be detected. - */ + /* Adjust mode-dependent parameters. */ + if ((crb & CRBMSK_CLKMULT_B) == (MULT_X0 << CRBBIT_CLKMULT_B)) /* If Extender mode (ClkMultB == MULT_X0): */ + setup |= ((CLKSRC_EXTENDER << STDBIT_CLKSRC) /* Indicate Extender mode. */ + |(MULT_X1 << STDBIT_CLKMULT) /* Indicate multiplier is 1x. */ + |((cra >> (CRABIT_CLKSRC_B - STDBIT_CLKPOL)) & STDMSK_CLKPOL)); /* Set ClkPol equal to Timer count direction (ClkSrcB<0>). */ - SETVECT(2, XSD2 | XFIFO_1 | WS3); - /* Slot 2: Send high uint8_t to target TrimDac. */ - SETVECT(3, XSD2 | XFIFO_0 | WS3); - /* Slot 3: Send low uint8_t to target TrimDac. */ - SETVECT(4, XSD2 | XFIFO_3 | WS1); - /* Slot 4: Send NOP high uint8_t to DAC0 to keep clock running. */ - SETVECT(5, XSD2 | XFIFO_2 | WS1 | EOS); - /* Slot 5: Send NOP low uint8_t to DAC0. */ + else if (cra & (2 << CRABIT_CLKSRC_B)) /* If Timer mode (ClkSrcB<1> == 1): */ + setup |= ((CLKSRC_TIMER << STDBIT_CLKSRC) /* Indicate Timer mode. */ + |(MULT_X1 << STDBIT_CLKMULT) /* Indicate multiplier is 1x. */ + |((cra >> (CRABIT_CLKSRC_B - STDBIT_CLKPOL)) & STDMSK_CLKPOL)); /* Set ClkPol equal to Timer count direction (ClkSrcB<0>). */ - /* Construct and transmit target DAC's serial packet: - * ( 0000 AAAA ), ( DDDD DDDD ),( 0x00 ),( 0x00 ) where A<3:0> is the - * DAC channel's address, and D<7:0> is the DAC setpoint. Append a - * WORD value (that writes a channel 0 NOP command to a non-existent - * main DAC channel) that serves to keep the clock running after the - * packet has been sent to the target DAC. - */ + else /* If Counter mode (ClkSrcB<1> == 0): */ + setup |= ((CLKSRC_COUNTER << STDBIT_CLKSRC) /* Indicate Timer mode. */ + |((crb >> (CRBBIT_CLKMULT_B - STDBIT_CLKMULT)) & STDMSK_CLKMULT) /* Clock multiplier is passed through. */ + |((crb << (STDBIT_CLKPOL - CRBBIT_CLKPOL_B)) & STDMSK_CLKPOL)); /* Clock polarity is passed through. */ - /* Address the DAC channel within the trimdac device. */ - SendDAC(dev, ((uint32_t) chan << 8) - | (uint32_t) DacData); /* Include DAC setpoint data. */ + /* Return adjusted counter setup. */ + return setup; } -/* ************** EEPROM ACCESS FUNCTIONS ************** */ -/* Read uint8_t from EEPROM. */ +/* + * Set the operating mode for the specified counter. The setup + * parameter is treated as a COUNTER_SETUP data type. The following + * parameters are programmable (all other parms are ignored): ClkMult, + * ClkPol, ClkEnab, IndexSrc, IndexPol, LoadSrc. + */ -static uint8_t I2Cread(struct comedi_device *dev, uint8_t addr) +static void SetMode_A(struct comedi_device *dev, struct enc_private *k, + uint16_t Setup, uint16_t DisableIntSrc) { - uint8_t rtnval; - - /* Send EEPROM target address. */ - if (I2Chandshake(dev, I2C_B2(I2C_ATTRSTART, I2CW) - /* Byte2 = I2C command: write to I2C EEPROM device. */ - | I2C_B1(I2C_ATTRSTOP, addr) - /* Byte1 = EEPROM internal target address. */ - | I2C_B0(I2C_ATTRNOP, 0))) { /* Byte0 = Not sent. */ - /* Abort function and declare error if handshake failed. */ - DEBUG("I2Cread: error handshake I2Cread a\n"); - return 0; - } - /* Execute EEPROM read. */ - if (I2Chandshake(dev, I2C_B2(I2C_ATTRSTART, I2CR) + register uint16_t cra; + register uint16_t crb; + register uint16_t setup = Setup; /* Cache the Standard Setup. */ - /* Byte2 = I2C */ - /* command: read */ - /* from I2C EEPROM */ - /* device. */ - |I2C_B1(I2C_ATTRSTOP, 0) + /* Initialize CRA and CRB images. */ + cra = ((setup & CRAMSK_LOADSRC_A) /* Preload trigger is passed through. */ + |((setup & STDMSK_INDXSRC) >> (STDBIT_INDXSRC - (CRABIT_INDXSRC_A + 1)))); /* IndexSrc is restricted to ENC_X or IndxPol. */ - /* Byte1 receives */ - /* uint8_t from */ - /* EEPROM. */ - |I2C_B0(I2C_ATTRNOP, 0))) { /* Byte0 = Not sent. */ + crb = (CRBMSK_INTRESETCMD | CRBMSK_INTRESET_A /* Reset any pending CounterA event captures. */ + | ((setup & STDMSK_CLKENAB) << (CRBBIT_CLKENAB_A - STDBIT_CLKENAB))); /* Clock enable is passed through. */ - /* Abort function and declare error if handshake failed. */ - DEBUG("I2Cread: error handshake I2Cread b\n"); - return 0; - } - /* Return copy of EEPROM value. */ - rtnval = (uint8_t) (RR7146(P_I2CCTRL) >> 16); - return rtnval; -} + /* Force IntSrc to Disabled if DisableIntSrc is asserted. */ + if (!DisableIntSrc) + cra |= ((setup & STDMSK_INTSRC) >> (STDBIT_INTSRC - + CRABIT_INTSRC_A)); -static uint32_t I2Chandshake(struct comedi_device *dev, uint32_t val) -{ - /* Write I2C command to I2C Transfer Control shadow register. */ - WR7146(P_I2CCTRL, val); + /* Populate all mode-dependent attributes of CRA & CRB images. */ + switch ((setup & STDMSK_CLKSRC) >> STDBIT_CLKSRC) { + case CLKSRC_EXTENDER: /* Extender Mode: Force to Timer mode */ + /* (Extender valid only for B counters). */ - /* Upload I2C shadow registers into working registers and wait for */ - /* upload confirmation. */ + case CLKSRC_TIMER: /* Timer Mode: */ + cra |= ((2 << CRABIT_CLKSRC_A) /* ClkSrcA<1> selects system clock */ + |((setup & STDMSK_CLKPOL) >> (STDBIT_CLKPOL - CRABIT_CLKSRC_A)) /* with count direction (ClkSrcA<0>) obtained from ClkPol. */ + |(1 << CRABIT_CLKPOL_A) /* ClkPolA behaves as always-on clock enable. */ + |(MULT_X1 << CRABIT_CLKMULT_A)); /* ClkMult must be 1x. */ + break; - MC_ENABLE(P_MC2, MC2_UPLD_IIC); - while (!MC_TEST(P_MC2, MC2_UPLD_IIC)) - ; + default: /* Counter Mode: */ + cra |= (CLKSRC_COUNTER /* Select ENC_C and ENC_D as clock/direction inputs. */ + | ((setup & STDMSK_CLKPOL) << (CRABIT_CLKPOL_A - STDBIT_CLKPOL)) /* Clock polarity is passed through. */ + |(((setup & STDMSK_CLKMULT) == (MULT_X0 << STDBIT_CLKMULT)) ? /* Force multiplier to x1 if not legal, otherwise pass through. */ + (MULT_X1 << CRABIT_CLKMULT_A) : + ((setup & STDMSK_CLKMULT) << (CRABIT_CLKMULT_A - + STDBIT_CLKMULT)))); + } - /* Wait until I2C bus transfer is finished or an error occurs. */ - while ((RR7146(P_I2CCTRL) & (I2C_BUSY | I2C_ERR)) == I2C_BUSY) - ; + /* Force positive index polarity if IndxSrc is software-driven only, */ + /* otherwise pass it through. */ + if (~setup & STDMSK_INDXSRC) + cra |= ((setup & STDMSK_INDXPOL) << (CRABIT_INDXPOL_A - + STDBIT_INDXPOL)); - /* Return non-zero if I2C error occurred. */ - return RR7146(P_I2CCTRL) & I2C_ERR; + /* If IntSrc has been forced to Disabled, update the MISC2 interrupt */ + /* enable mask to indicate the counter interrupt is disabled. */ + if (DisableIntSrc) + devpriv->CounterIntEnabs &= ~k->MyEventBits[3]; + /* While retaining CounterB and LatchSrc configurations, program the */ + /* new counter operating mode. */ + DEBIreplace(dev, k->MyCRA, CRAMSK_INDXSRC_B | CRAMSK_CLKSRC_B, cra); + DEBIreplace(dev, k->MyCRB, + (uint16_t) (~(CRBMSK_INTCTRL | CRBMSK_CLKENAB_A)), crb); } -/* Private helper function: Write setpoint to an application DAC channel. */ - -static void SetDAC(struct comedi_device *dev, uint16_t chan, short dacdata) +static void SetMode_B(struct comedi_device *dev, struct enc_private *k, + uint16_t Setup, uint16_t DisableIntSrc) { - register uint16_t signmask; - register uint32_t WSImage; + register uint16_t cra; + register uint16_t crb; + register uint16_t setup = Setup; /* Cache the Standard Setup. */ - /* Adjust DAC data polarity and set up Polarity Control Register */ - /* image. */ - signmask = 1 << chan; - if (dacdata < 0) { - dacdata = -dacdata; - devpriv->Dacpol |= signmask; - } else - devpriv->Dacpol &= ~signmask; + /* Initialize CRA and CRB images. */ + cra = ((setup & STDMSK_INDXSRC) << ((CRABIT_INDXSRC_B + 1) - STDBIT_INDXSRC)); /* IndexSrc field is restricted to ENC_X or IndxPol. */ + + crb = (CRBMSK_INTRESETCMD | CRBMSK_INTRESET_B /* Reset event captures and disable interrupts. */ + | ((setup & STDMSK_CLKENAB) << (CRBBIT_CLKENAB_B - STDBIT_CLKENAB)) /* Clock enable is passed through. */ + |((setup & STDMSK_LOADSRC) >> (STDBIT_LOADSRC - CRBBIT_LOADSRC_B))); /* Preload trigger source is passed through. */ + + /* Force IntSrc to Disabled if DisableIntSrc is asserted. */ + if (!DisableIntSrc) + crb |= ((setup & STDMSK_INTSRC) >> (STDBIT_INTSRC - + CRBBIT_INTSRC_B)); + + /* Populate all mode-dependent attributes of CRA & CRB images. */ + switch ((setup & STDMSK_CLKSRC) >> STDBIT_CLKSRC) { + case CLKSRC_TIMER: /* Timer Mode: */ + cra |= ((2 << CRABIT_CLKSRC_B) /* ClkSrcB<1> selects system clock */ + |((setup & STDMSK_CLKPOL) << (CRABIT_CLKSRC_B - STDBIT_CLKPOL))); /* with direction (ClkSrcB<0>) obtained from ClkPol. */ + crb |= ((1 << CRBBIT_CLKPOL_B) /* ClkPolB behaves as always-on clock enable. */ + |(MULT_X1 << CRBBIT_CLKMULT_B)); /* ClkMultB must be 1x. */ + break; - /* Limit DAC setpoint value to valid range. */ - if ((uint16_t) dacdata > 0x1FFF) - dacdata = 0x1FFF; + case CLKSRC_EXTENDER: /* Extender Mode: */ + cra |= ((2 << CRABIT_CLKSRC_B) /* ClkSrcB source is OverflowA (same as "timer") */ + |((setup & STDMSK_CLKPOL) << (CRABIT_CLKSRC_B - STDBIT_CLKPOL))); /* with direction obtained from ClkPol. */ + crb |= ((1 << CRBBIT_CLKPOL_B) /* ClkPolB controls IndexB -- always set to active. */ + |(MULT_X0 << CRBBIT_CLKMULT_B)); /* ClkMultB selects OverflowA as the clock source. */ + break; - /* Set up TSL2 records (aka "vectors") for DAC update. Vectors V2 - * and V3 transmit the setpoint to the target DAC. V4 and V5 send - * data to a non-existent TrimDac channel just to keep the clock - * running after sending data to the target DAC. This is necessary - * to eliminate the clock glitch that would otherwise occur at the - * end of the target DAC's serial data stream. When the sequence - * restarts at V0 (after executing V5), the gate array automatically - * disables gating for the DAC clock and all DAC chip selects. - */ + default: /* Counter Mode: */ + cra |= (CLKSRC_COUNTER << CRABIT_CLKSRC_B); /* Select ENC_C and ENC_D as clock/direction inputs. */ + crb |= (((setup & STDMSK_CLKPOL) >> (STDBIT_CLKPOL - CRBBIT_CLKPOL_B)) /* ClkPol is passed through. */ + |(((setup & STDMSK_CLKMULT) == (MULT_X0 << STDBIT_CLKMULT)) ? /* Force ClkMult to x1 if not legal, otherwise pass through. */ + (MULT_X1 << CRBBIT_CLKMULT_B) : + ((setup & STDMSK_CLKMULT) << (CRBBIT_CLKMULT_B - + STDBIT_CLKMULT)))); + } - WSImage = (chan & 2) ? WS1 : WS2; - /* Choose DAC chip select to be asserted. */ - SETVECT(2, XSD2 | XFIFO_1 | WSImage); - /* Slot 2: Transmit high data byte to target DAC. */ - SETVECT(3, XSD2 | XFIFO_0 | WSImage); - /* Slot 3: Transmit low data byte to target DAC. */ - SETVECT(4, XSD2 | XFIFO_3 | WS3); - /* Slot 4: Transmit to non-existent TrimDac channel to keep clock */ - SETVECT(5, XSD2 | XFIFO_2 | WS3 | EOS); - /* Slot 5: running after writing target DAC's low data byte. */ + /* Force positive index polarity if IndxSrc is software-driven only, */ + /* otherwise pass it through. */ + if (~setup & STDMSK_INDXSRC) + crb |= ((setup & STDMSK_INDXPOL) >> (STDBIT_INDXPOL - + CRBBIT_INDXPOL_B)); - /* Construct and transmit target DAC's serial packet: - * ( A10D DDDD ),( DDDD DDDD ),( 0x0F ),( 0x00 ) where A is chan<0>, - * and D<12:0> is the DAC setpoint. Append a WORD value (that writes - * to a non-existent TrimDac channel) that serves to keep the clock - * running after the packet has been sent to the target DAC. - */ - SendDAC(dev, 0x0F000000 - /* Continue clock after target DAC data (write to non-existent trimdac). */ - | 0x00004000 - /* Address the two main dual-DAC devices (TSL's chip select enables - * target device). */ - | ((uint32_t) (chan & 1) << 15) - /* Address the DAC channel within the device. */ - | (uint32_t) dacdata); /* Include DAC setpoint data. */ + /* If IntSrc has been forced to Disabled, update the MISC2 interrupt */ + /* enable mask to indicate the counter interrupt is disabled. */ + if (DisableIntSrc) + devpriv->CounterIntEnabs &= ~k->MyEventBits[3]; + /* While retaining CounterA and LatchSrc configurations, program the */ + /* new counter operating mode. */ + DEBIreplace(dev, k->MyCRA, + (uint16_t) (~(CRAMSK_INDXSRC_B | CRAMSK_CLKSRC_B)), cra); + DEBIreplace(dev, k->MyCRB, CRBMSK_CLKENAB_A | CRBMSK_LATCHSRC, crb); } -/* Private helper function: Transmit serial data to DAC via Audio - * channel 2. Assumes: (1) TSL2 slot records initialized, and (2) - * Dacpol contains valid target image. - */ +/* Return/set a counter's enable. enab: 0=always enabled, 1=enabled by index. */ -static void SendDAC(struct comedi_device *dev, uint32_t val) +static void SetEnable_A(struct comedi_device *dev, struct enc_private *k, + uint16_t enab) { + DEBUG("SetEnable_A: SetEnable_A enter 3541\n"); + DEBIreplace(dev, k->MyCRB, + (uint16_t) (~(CRBMSK_INTCTRL | CRBMSK_CLKENAB_A)), + (uint16_t) (enab << CRBBIT_CLKENAB_A)); +} - /* START THE SERIAL CLOCK RUNNING ------------- */ - - /* Assert DAC polarity control and enable gating of DAC serial clock - * and audio bit stream signals. At this point in time we must be - * assured of being in time slot 0. If we are not in slot 0, the - * serial clock and audio stream signals will be disabled; this is - * because the following DEBIwrite statement (which enables signals - * to be passed through the gate array) would execute before the - * trailing edge of WS1/WS3 (which turns off the signals), thus - * causing the signals to be inactive during the DAC write. - */ - DEBIwrite(dev, LP_DACPOL, devpriv->Dacpol); +static void SetEnable_B(struct comedi_device *dev, struct enc_private *k, + uint16_t enab) +{ + DEBIreplace(dev, k->MyCRB, + (uint16_t) (~(CRBMSK_INTCTRL | CRBMSK_CLKENAB_B)), + (uint16_t) (enab << CRBBIT_CLKENAB_B)); +} - /* TRANSFER OUTPUT DWORD VALUE INTO A2'S OUTPUT FIFO ---------------- */ +static uint16_t GetEnable_A(struct comedi_device *dev, struct enc_private *k) +{ + return (DEBIread(dev, k->MyCRB) >> CRBBIT_CLKENAB_A) & 1; +} - /* Copy DAC setpoint value to DAC's output DMA buffer. */ +static uint16_t GetEnable_B(struct comedi_device *dev, struct enc_private *k) +{ + return (DEBIread(dev, k->MyCRB) >> CRBBIT_CLKENAB_B) & 1; +} - /* WR7146( (uint32_t)devpriv->pDacWBuf, val ); */ - *devpriv->pDacWBuf = val; +/* Return/set a counter pair's latch trigger source. 0: On read + * access, 1: A index latches A, 2: B index latches B, 3: A overflow + * latches B. + */ - /* enab the output DMA transfer. This will cause the DMAC to copy - * the DAC's data value to A2's output FIFO. The DMA transfer will - * then immediately terminate because the protection address is - * reached upon transfer of the first DWORD value. - */ - MC_ENABLE(P_MC1, MC1_A2OUT); +static void SetLatchSource(struct comedi_device *dev, struct enc_private *k, + uint16_t value) +{ + DEBUG("SetLatchSource: SetLatchSource enter 3550\n"); + DEBIreplace(dev, k->MyCRB, + (uint16_t) (~(CRBMSK_INTCTRL | CRBMSK_LATCHSRC)), + (uint16_t) (value << CRBBIT_LATCHSRC)); - /* While the DMA transfer is executing ... */ + DEBUG("SetLatchSource: SetLatchSource exit\n"); +} - /* Reset Audio2 output FIFO's underflow flag (along with any other - * FIFO underflow/overflow flags). When set, this flag will - * indicate that we have emerged from slot 0. - */ - WR7146(P_ISR, ISR_AFOU); +/* + * static uint16_t GetLatchSource(struct comedi_device *dev, struct enc_private *k ) + * { + * return ( DEBIread( dev, k->MyCRB) >> CRBBIT_LATCHSRC ) & 3; + * } + */ - /* Wait for the DMA transfer to finish so that there will be data - * available in the FIFO when time slot 1 tries to transfer a DWORD - * from the FIFO to the output buffer register. We test for DMA - * Done by polling the DMAC enable flag; this flag is automatically - * cleared when the transfer has finished. - */ - while ((RR7146(P_MC1) & MC1_A2OUT) != 0) - ; +/* + * Return/set the event that will trigger transfer of the preload + * register into the counter. 0=ThisCntr_Index, 1=ThisCntr_Overflow, + * 2=OverflowA (B counters only), 3=disabled. + */ - /* START THE OUTPUT STREAM TO THE TARGET DAC -------------------- */ +static void SetLoadTrig_A(struct comedi_device *dev, struct enc_private *k, + uint16_t Trig) +{ + DEBIreplace(dev, k->MyCRA, (uint16_t) (~CRAMSK_LOADSRC_A), + (uint16_t) (Trig << CRABIT_LOADSRC_A)); +} - /* FIFO data is now available, so we enable execution of time slots - * 1 and higher by clearing the EOS flag in slot 0. Note that SD3 - * will be shifted in and stored in FB_BUFFER2 for end-of-slot-list - * detection. - */ - SETVECT(0, XSD2 | RSD3 | SIB_A2); +static void SetLoadTrig_B(struct comedi_device *dev, struct enc_private *k, + uint16_t Trig) +{ + DEBIreplace(dev, k->MyCRB, + (uint16_t) (~(CRBMSK_LOADSRC_B | CRBMSK_INTCTRL)), + (uint16_t) (Trig << CRBBIT_LOADSRC_B)); +} - /* Wait for slot 1 to execute to ensure that the Packet will be - * transmitted. This is detected by polling the Audio2 output FIFO - * underflow flag, which will be set when slot 1 execution has - * finished transferring the DAC's data DWORD from the output FIFO - * to the output buffer register. - */ - while ((RR7146(P_SSR) & SSR_AF2_OUT) == 0) - ; +static uint16_t GetLoadTrig_A(struct comedi_device *dev, struct enc_private *k) +{ + return (DEBIread(dev, k->MyCRA) >> CRABIT_LOADSRC_A) & 3; +} - /* Set up to trap execution at slot 0 when the TSL sequencer cycles - * back to slot 0 after executing the EOS in slot 5. Also, - * simultaneously shift out and in the 0x00 that is ALWAYS the value - * stored in the last byte to be shifted out of the FIFO's DWORD - * buffer register. - */ - SETVECT(0, XSD2 | XFIFO_2 | RSD2 | SIB_A2 | EOS); +static uint16_t GetLoadTrig_B(struct comedi_device *dev, struct enc_private *k) +{ + return (DEBIread(dev, k->MyCRB) >> CRBBIT_LOADSRC_B) & 3; +} - /* WAIT FOR THE TRANSACTION TO FINISH ----------------------- */ +/* Return/set counter interrupt source and clear any captured + * index/overflow events. IntSource: 0=Disabled, 1=OverflowOnly, + * 2=IndexOnly, 3=IndexAndOverflow. + */ - /* Wait for the TSL to finish executing all time slots before - * exiting this function. We must do this so that the next DAC - * write doesn't start, thereby enabling clock/chip select signals: - * - * 1. Before the TSL sequence cycles back to slot 0, which disables - * the clock/cs signal gating and traps slot // list execution. - * we have not yet finished slot 5 then the clock/cs signals are - * still gated and we have not finished transmitting the stream. - * - * 2. While slots 2-5 are executing due to a late slot 0 trap. In - * this case, the slot sequence is currently repeating, but with - * clock/cs signals disabled. We must wait for slot 0 to trap - * execution before setting up the next DAC setpoint DMA transfer - * and enabling the clock/cs signals. To detect the end of slot 5, - * we test for the FB_BUFFER2 MSB contents to be equal to 0xFF. If - * the TSL has not yet finished executing slot 5 ... - */ - if ((RR7146(P_FB_BUFFER2) & 0xFF000000) != 0) { - /* The trap was set on time and we are still executing somewhere - * in slots 2-5, so we now wait for slot 0 to execute and trap - * TSL execution. This is detected when FB_BUFFER2 MSB changes - * from 0xFF to 0x00, which slot 0 causes to happen by shifting - * out/in on SD2 the 0x00 that is always referenced by slot 5. - */ - while ((RR7146(P_FB_BUFFER2) & 0xFF000000) != 0) - ; - } - /* Either (1) we were too late setting the slot 0 trap; the TSL - * sequencer restarted slot 0 before we could set the EOS trap flag, - * or (2) we were not late and execution is now trapped at slot 0. - * In either case, we must now change slot 0 so that it will store - * value 0xFF (instead of 0x00) to FB_BUFFER2 next time it executes. - * In order to do this, we reprogram slot 0 so that it will shift in - * SD3, which is driven only by a pull-up resistor. - */ - SETVECT(0, RSD3 | SIB_A2 | EOS); +static void SetIntSrc_A(struct comedi_device *dev, struct enc_private *k, + uint16_t IntSource) +{ + /* Reset any pending counter overflow or index captures. */ + DEBIreplace(dev, k->MyCRB, (uint16_t) (~CRBMSK_INTCTRL), + CRBMSK_INTRESETCMD | CRBMSK_INTRESET_A); - /* Wait for slot 0 to execute, at which time the TSL is setup for - * the next DAC write. This is detected when FB_BUFFER2 MSB changes - * from 0x00 to 0xFF. - */ - while ((RR7146(P_FB_BUFFER2) & 0xFF000000) == 0) - ; + /* Program counter interrupt source. */ + DEBIreplace(dev, k->MyCRA, ~CRAMSK_INTSRC_A, + (uint16_t) (IntSource << CRABIT_INTSRC_A)); + + /* Update MISC2 interrupt enable mask. */ + devpriv->CounterIntEnabs = + (devpriv->CounterIntEnabs & ~k-> + MyEventBits[3]) | k->MyEventBits[IntSource]; } -static void WriteMISC2(struct comedi_device *dev, uint16_t NewImage) +static void SetIntSrc_B(struct comedi_device *dev, struct enc_private *k, + uint16_t IntSource) { - DEBIwrite(dev, LP_MISC1, MISC1_WENABLE); /* enab writes to */ - /* MISC2 register. */ - DEBIwrite(dev, LP_WRMISC2, NewImage); /* Write new image to MISC2. */ - DEBIwrite(dev, LP_MISC1, MISC1_WDISABLE); /* Disable writes to MISC2. */ + uint16_t crb; + + /* Cache writeable CRB register image. */ + crb = DEBIread(dev, k->MyCRB) & ~CRBMSK_INTCTRL; + + /* Reset any pending counter overflow or index captures. */ + DEBIwrite(dev, k->MyCRB, + (uint16_t) (crb | CRBMSK_INTRESETCMD | CRBMSK_INTRESET_B)); + + /* Program counter interrupt source. */ + DEBIwrite(dev, k->MyCRB, + (uint16_t) ((crb & ~CRBMSK_INTSRC_B) | (IntSource << + CRBBIT_INTSRC_B))); + + /* Update MISC2 interrupt enable mask. */ + devpriv->CounterIntEnabs = + (devpriv->CounterIntEnabs & ~k-> + MyEventBits[3]) | k->MyEventBits[IntSource]; } -/* Initialize the DEBI interface for all transfers. */ +static uint16_t GetIntSrc_A(struct comedi_device *dev, struct enc_private *k) +{ + return (DEBIread(dev, k->MyCRA) >> CRABIT_INTSRC_A) & 3; +} -static uint16_t DEBIread(struct comedi_device *dev, uint16_t addr) +static uint16_t GetIntSrc_B(struct comedi_device *dev, struct enc_private *k) { - uint16_t retval; + return (DEBIread(dev, k->MyCRB) >> CRBBIT_INTSRC_B) & 3; +} - /* Set up DEBI control register value in shadow RAM. */ - WR7146(P_DEBICMD, DEBI_CMD_RDWORD | addr); +/* Return/set the clock multiplier. */ - /* Execute the DEBI transfer. */ - DEBItransfer(dev); +/* static void SetClkMult(struct comedi_device *dev, struct enc_private *k, uint16_t value ) */ +/* { */ +/* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_CLKMULT ) | ( value << STDBIT_CLKMULT ) ), FALSE ); */ +/* } */ - /* Fetch target register value. */ - retval = (uint16_t) RR7146(P_DEBIAD); +/* static uint16_t GetClkMult(struct comedi_device *dev, struct enc_private *k ) */ +/* { */ +/* return ( k->GetMode(dev, k ) >> STDBIT_CLKMULT ) & 3; */ +/* } */ - /* Return register value. */ - return retval; -} +/* Return/set the clock polarity. */ -/* Execute a DEBI transfer. This must be called from within a */ -/* critical section. */ -static void DEBItransfer(struct comedi_device *dev) -{ - /* Initiate upload of shadow RAM to DEBI control register. */ - MC_ENABLE(P_MC2, MC2_UPLD_DEBI); +/* static void SetClkPol( struct comedi_device *dev,struct enc_private *k, uint16_t value ) */ +/* { */ +/* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_CLKPOL ) | ( value << STDBIT_CLKPOL ) ), FALSE ); */ +/* } */ - /* Wait for completion of upload from shadow RAM to DEBI control */ - /* register. */ - while (!MC_TEST(P_MC2, MC2_UPLD_DEBI)) - ; +/* static uint16_t GetClkPol(struct comedi_device *dev, struct enc_private *k ) */ +/* { */ +/* return ( k->GetMode(dev, k ) >> STDBIT_CLKPOL ) & 1; */ +/* } */ - /* Wait until DEBI transfer is done. */ - while (RR7146(P_PSR) & PSR_DEBI_S) - ; -} +/* Return/set the clock source. */ -/* Write a value to a gate array register. */ -static void DEBIwrite(struct comedi_device *dev, uint16_t addr, uint16_t wdata) -{ +/* static void SetClkSrc( struct comedi_device *dev,struct enc_private *k, uint16_t value ) */ +/* { */ +/* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_CLKSRC ) | ( value << STDBIT_CLKSRC ) ), FALSE ); */ +/* } */ - /* Set up DEBI control register value in shadow RAM. */ - WR7146(P_DEBICMD, DEBI_CMD_WRWORD | addr); - WR7146(P_DEBIAD, wdata); +/* static uint16_t GetClkSrc( struct comedi_device *dev,struct enc_private *k ) */ +/* { */ +/* return ( k->GetMode(dev, k ) >> STDBIT_CLKSRC ) & 3; */ +/* } */ - /* Execute the DEBI transfer. */ - DEBItransfer(dev); -} +/* Return/set the index polarity. */ -/* Replace the specified bits in a gate array register. Imports: mask - * specifies bits that are to be preserved, wdata is new value to be - * or'd with the masked original. - */ -static void DEBIreplace(struct comedi_device *dev, uint16_t addr, uint16_t mask, - uint16_t wdata) -{ +/* static void SetIndexPol(struct comedi_device *dev, struct enc_private *k, uint16_t value ) */ +/* { */ +/* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_INDXPOL ) | ( (value != 0) << STDBIT_INDXPOL ) ), FALSE ); */ +/* } */ - /* Copy target gate array register into P_DEBIAD register. */ - WR7146(P_DEBICMD, DEBI_CMD_RDWORD | addr); - /* Set up DEBI control reg value in shadow RAM. */ - DEBItransfer(dev); /* Execute the DEBI Read transfer. */ +/* static uint16_t GetIndexPol(struct comedi_device *dev, struct enc_private *k ) */ +/* { */ +/* return ( k->GetMode(dev, k ) >> STDBIT_INDXPOL ) & 1; */ +/* } */ - /* Write back the modified image. */ - WR7146(P_DEBICMD, DEBI_CMD_WRWORD | addr); - /* Set up DEBI control reg value in shadow RAM. */ +/* Return/set the index source. */ - WR7146(P_DEBIAD, wdata | ((uint16_t) RR7146(P_DEBIAD) & mask)); - /* Modify the register image. */ - DEBItransfer(dev); /* Execute the DEBI Write transfer. */ -} +/* static void SetIndexSrc(struct comedi_device *dev, struct enc_private *k, uint16_t value ) */ +/* { */ +/* DEBUG("SetIndexSrc: set index src enter 3700\n"); */ +/* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_INDXSRC ) | ( (value != 0) << STDBIT_INDXSRC ) ), FALSE ); */ +/* } */ -static void CloseDMAB(struct comedi_device *dev, struct bufferDMA *pdma, - size_t bsize) -{ - void *vbptr; - dma_addr_t vpptr; +/* static uint16_t GetIndexSrc(struct comedi_device *dev, struct enc_private *k ) */ +/* { */ +/* return ( k->GetMode(dev, k ) >> STDBIT_INDXSRC ) & 1; */ +/* } */ - DEBUG("CloseDMAB: Entering S626DRV_CloseDMAB():\n"); - if (pdma == NULL) - return; - /* find the matching allocation from the board struct */ +/* Generate an index pulse. */ - vbptr = pdma->LogicalBase; - vpptr = pdma->PhysicalBase; - if (vbptr) { - pci_free_consistent(devpriv->pdev, bsize, vbptr, vpptr); - pdma->LogicalBase = NULL; - pdma->PhysicalBase = 0; +static void PulseIndex_A(struct comedi_device *dev, struct enc_private *k) +{ + register uint16_t cra; - DEBUG("CloseDMAB(): Logical=%p, bsize=%d, Physical=0x%x\n", - vbptr, bsize, (uint32_t) vpptr); - } + DEBUG("PulseIndex_A: pulse index enter\n"); + + cra = DEBIread(dev, k->MyCRA); /* Pulse index. */ + DEBIwrite(dev, k->MyCRA, (uint16_t) (cra ^ CRAMSK_INDXPOL_A)); + DEBUG("PulseIndex_A: pulse index step1\n"); + DEBIwrite(dev, k->MyCRA, cra); } -/* ****** COUNTER FUNCTIONS ******* */ -/* All counter functions address a specific counter by means of the - * "Counter" argument, which is a logical counter number. The Counter - * argument may have any of the following legal values: 0=0A, 1=1A, - * 2=2A, 3=0B, 4=1B, 5=2B. - */ +static void PulseIndex_B(struct comedi_device *dev, struct enc_private *k) +{ + register uint16_t crb; -/* Forward declarations for functions that are common to both A and B counters: */ + crb = DEBIread(dev, k->MyCRB) & ~CRBMSK_INTCTRL; /* Pulse index. */ + DEBIwrite(dev, k->MyCRB, (uint16_t) (crb ^ CRBMSK_INDXPOL_B)); + DEBIwrite(dev, k->MyCRB, crb); +} -/* ****** PRIVATE COUNTER FUNCTIONS ****** */ +/* Write value into counter preload register. */ -/* Read a counter's output latch. */ +static void Preload(struct comedi_device *dev, struct enc_private *k, + uint32_t value) +{ + DEBUG("Preload: preload enter\n"); + DEBIwrite(dev, (uint16_t) (k->MyLatchLsw), (uint16_t) value); /* Write value to preload register. */ + DEBUG("Preload: preload step 1\n"); + DEBIwrite(dev, (uint16_t) (k->MyLatchLsw + 2), + (uint16_t) (value >> 16)); +} -static uint32_t ReadLatch(struct comedi_device *dev, struct enc_private *k) +static void CountersInit(struct comedi_device *dev) { - register uint32_t value; - /* DEBUG FIXME DEBUG("ReadLatch: Read Latch enter\n"); */ + int chan; + struct enc_private *k; + uint16_t Setup = (LOADSRC_INDX << BF_LOADSRC) | /* Preload upon */ + /* index. */ + (INDXSRC_SOFT << BF_INDXSRC) | /* Disable hardware index. */ + (CLKSRC_COUNTER << BF_CLKSRC) | /* Operating mode is counter. */ + (CLKPOL_POS << BF_CLKPOL) | /* Active high clock. */ + (CNTDIR_UP << BF_CLKPOL) | /* Count direction is up. */ + (CLKMULT_1X << BF_CLKMULT) | /* Clock multiplier is 1x. */ + (CLKENAB_INDEX << BF_CLKENAB); /* Enabled by index */ - /* Latch counts and fetch LSW of latched counts value. */ - value = (uint32_t) DEBIread(dev, k->MyLatchLsw); + /* Disable all counter interrupts and clear any captured counter events. */ + for (chan = 0; chan < S626_ENCODER_CHANNELS; chan++) { + k = &encpriv[chan]; + k->SetMode(dev, k, Setup, TRUE); + k->SetIntSrc(dev, k, 0); + k->ResetCapFlags(dev, k); + k->SetEnable(dev, k, CLKENAB_ALWAYS); + } + DEBUG("CountersInit: counters initialized\n"); - /* Fetch MSW of latched counts and combine with LSW. */ - value |= ((uint32_t) DEBIread(dev, k->MyLatchLsw + 2) << 16); +} - /* DEBUG FIXME DEBUG("ReadLatch: Read Latch exit\n"); */ +static int s626_attach(struct comedi_device *dev, struct comedi_devconfig *it) +{ +/* uint8_t PollList; */ +/* uint16_t AdcData; */ +/* uint16_t StartVal; */ +/* uint16_t index; */ +/* unsigned int data[16]; */ + int result; + int i; + int ret; + resource_size_t resourceStart; + dma_addr_t appdma; + struct comedi_subdevice *s; + struct pci_dev *pdev = NULL; - /* Return latched counts. */ - return value; -} + if (alloc_private(dev, sizeof(struct s626_private)) < 0) + return -ENOMEM; -/* Reset a counter's index and overflow event capture flags. */ + for (i = 0; i < ARRAY_SIZE(s626_boards) && !pdev; i++) { + do { + pdev = pci_get_subsys(s626_boards[i].vendor_id, + s626_boards[i].device_id, + s626_boards[i].subvendor_id, + s626_boards[i].subdevice_id, + pdev); + + if ((it->options[0] || it->options[1]) && pdev) { + /* matches requested bus/slot */ + if (pdev->bus->number == it->options[0] && + PCI_SLOT(pdev->devfn) == it->options[1]) + break; + } else + break; + } while (1); + } + devpriv->pdev = pdev; -static void ResetCapFlags_A(struct comedi_device *dev, struct enc_private *k) -{ - DEBIreplace(dev, k->MyCRB, (uint16_t) (~CRBMSK_INTCTRL), - CRBMSK_INTRESETCMD | CRBMSK_INTRESET_A); -} + if (pdev == NULL) { + printk(KERN_ERR "s626_attach: Board not present!!!\n"); + return -ENODEV; + } -static void ResetCapFlags_B(struct comedi_device *dev, struct enc_private *k) -{ - DEBIreplace(dev, k->MyCRB, (uint16_t) (~CRBMSK_INTCTRL), - CRBMSK_INTRESETCMD | CRBMSK_INTRESET_B); -} + result = comedi_pci_enable(pdev, "s626"); + if (result < 0) { + printk(KERN_ERR "s626_attach: comedi_pci_enable fails\n"); + return -ENODEV; + } + devpriv->got_regions = 1; -/* Return counter setup in a format (COUNTER_SETUP) that is consistent */ -/* for both A and B counters. */ + resourceStart = pci_resource_start(devpriv->pdev, 0); -static uint16_t GetMode_A(struct comedi_device *dev, struct enc_private *k) -{ - register uint16_t cra; - register uint16_t crb; - register uint16_t setup; + devpriv->base_addr = ioremap(resourceStart, SIZEOF_ADDRESS_SPACE); + if (devpriv->base_addr == NULL) { + printk(KERN_ERR "s626_attach: IOREMAP failed\n"); + return -ENODEV; + } - /* Fetch CRA and CRB register images. */ - cra = DEBIread(dev, k->MyCRA); - crb = DEBIread(dev, k->MyCRB); + if (devpriv->base_addr) { + /* disable master interrupt */ + writel(0, devpriv->base_addr + P_IER); - /* Populate the standardized counter setup bit fields. Note: */ - /* IndexSrc is restricted to ENC_X or IndxPol. */ - setup = ((cra & STDMSK_LOADSRC) /* LoadSrc = LoadSrcA. */ - |((crb << (STDBIT_LATCHSRC - CRBBIT_LATCHSRC)) & STDMSK_LATCHSRC) /* LatchSrc = LatchSrcA. */ - |((cra << (STDBIT_INTSRC - CRABIT_INTSRC_A)) & STDMSK_INTSRC) /* IntSrc = IntSrcA. */ - |((cra << (STDBIT_INDXSRC - (CRABIT_INDXSRC_A + 1))) & STDMSK_INDXSRC) /* IndxSrc = IndxSrcA<1>. */ - |((cra >> (CRABIT_INDXPOL_A - STDBIT_INDXPOL)) & STDMSK_INDXPOL) /* IndxPol = IndxPolA. */ - |((crb >> (CRBBIT_CLKENAB_A - STDBIT_CLKENAB)) & STDMSK_CLKENAB)); /* ClkEnab = ClkEnabA. */ + /* soft reset */ + writel(MC1_SOFT_RESET, devpriv->base_addr + P_MC1); - /* Adjust mode-dependent parameters. */ - if (cra & (2 << CRABIT_CLKSRC_A)) /* If Timer mode (ClkSrcA<1> == 1): */ - setup |= ((CLKSRC_TIMER << STDBIT_CLKSRC) /* Indicate Timer mode. */ - |((cra << (STDBIT_CLKPOL - CRABIT_CLKSRC_A)) & STDMSK_CLKPOL) /* Set ClkPol to indicate count direction (ClkSrcA<0>). */ - |(MULT_X1 << STDBIT_CLKMULT)); /* ClkMult must be 1x in Timer mode. */ + /* DMA FIXME DMA// */ + DEBUG("s626_attach: DMA ALLOCATION\n"); - else /* If Counter mode (ClkSrcA<1> == 0): */ - setup |= ((CLKSRC_COUNTER << STDBIT_CLKSRC) /* Indicate Counter mode. */ - |((cra >> (CRABIT_CLKPOL_A - STDBIT_CLKPOL)) & STDMSK_CLKPOL) /* Pass through ClkPol. */ - |(((cra & CRAMSK_CLKMULT_A) == (MULT_X0 << CRABIT_CLKMULT_A)) ? /* Force ClkMult to 1x if not legal, else pass through. */ - (MULT_X1 << STDBIT_CLKMULT) : - ((cra >> (CRABIT_CLKMULT_A - - STDBIT_CLKMULT)) & STDMSK_CLKMULT))); + /* adc buffer allocation */ + devpriv->allocatedBuf = 0; - /* Return adjusted counter setup. */ - return setup; -} + devpriv->ANABuf.LogicalBase = + pci_alloc_consistent(devpriv->pdev, DMABUF_SIZE, &appdma); -static uint16_t GetMode_B(struct comedi_device *dev, struct enc_private *k) -{ - register uint16_t cra; - register uint16_t crb; - register uint16_t setup; + if (devpriv->ANABuf.LogicalBase == NULL) { + printk(KERN_ERR "s626_attach: DMA Memory mapping error\n"); + return -ENOMEM; + } - /* Fetch CRA and CRB register images. */ - cra = DEBIread(dev, k->MyCRA); - crb = DEBIread(dev, k->MyCRB); + devpriv->ANABuf.PhysicalBase = appdma; - /* Populate the standardized counter setup bit fields. Note: */ - /* IndexSrc is restricted to ENC_X or IndxPol. */ - setup = (((crb << (STDBIT_INTSRC - CRBBIT_INTSRC_B)) & STDMSK_INTSRC) /* IntSrc = IntSrcB. */ - |((crb << (STDBIT_LATCHSRC - CRBBIT_LATCHSRC)) & STDMSK_LATCHSRC) /* LatchSrc = LatchSrcB. */ - |((crb << (STDBIT_LOADSRC - CRBBIT_LOADSRC_B)) & STDMSK_LOADSRC) /* LoadSrc = LoadSrcB. */ - |((crb << (STDBIT_INDXPOL - CRBBIT_INDXPOL_B)) & STDMSK_INDXPOL) /* IndxPol = IndxPolB. */ - |((crb >> (CRBBIT_CLKENAB_B - STDBIT_CLKENAB)) & STDMSK_CLKENAB) /* ClkEnab = ClkEnabB. */ - |((cra >> ((CRABIT_INDXSRC_B + 1) - STDBIT_INDXSRC)) & STDMSK_INDXSRC)); /* IndxSrc = IndxSrcB<1>. */ + DEBUG + ("s626_attach: AllocDMAB ADC Logical=%p, bsize=%d, Physical=0x%x\n", + devpriv->ANABuf.LogicalBase, DMABUF_SIZE, + (uint32_t) devpriv->ANABuf.PhysicalBase); - /* Adjust mode-dependent parameters. */ - if ((crb & CRBMSK_CLKMULT_B) == (MULT_X0 << CRBBIT_CLKMULT_B)) /* If Extender mode (ClkMultB == MULT_X0): */ - setup |= ((CLKSRC_EXTENDER << STDBIT_CLKSRC) /* Indicate Extender mode. */ - |(MULT_X1 << STDBIT_CLKMULT) /* Indicate multiplier is 1x. */ - |((cra >> (CRABIT_CLKSRC_B - STDBIT_CLKPOL)) & STDMSK_CLKPOL)); /* Set ClkPol equal to Timer count direction (ClkSrcB<0>). */ + devpriv->allocatedBuf++; - else if (cra & (2 << CRABIT_CLKSRC_B)) /* If Timer mode (ClkSrcB<1> == 1): */ - setup |= ((CLKSRC_TIMER << STDBIT_CLKSRC) /* Indicate Timer mode. */ - |(MULT_X1 << STDBIT_CLKMULT) /* Indicate multiplier is 1x. */ - |((cra >> (CRABIT_CLKSRC_B - STDBIT_CLKPOL)) & STDMSK_CLKPOL)); /* Set ClkPol equal to Timer count direction (ClkSrcB<0>). */ + devpriv->RPSBuf.LogicalBase = + pci_alloc_consistent(devpriv->pdev, DMABUF_SIZE, &appdma); - else /* If Counter mode (ClkSrcB<1> == 0): */ - setup |= ((CLKSRC_COUNTER << STDBIT_CLKSRC) /* Indicate Timer mode. */ - |((crb >> (CRBBIT_CLKMULT_B - STDBIT_CLKMULT)) & STDMSK_CLKMULT) /* Clock multiplier is passed through. */ - |((crb << (STDBIT_CLKPOL - CRBBIT_CLKPOL_B)) & STDMSK_CLKPOL)); /* Clock polarity is passed through. */ + if (devpriv->RPSBuf.LogicalBase == NULL) { + printk(KERN_ERR "s626_attach: DMA Memory mapping error\n"); + return -ENOMEM; + } - /* Return adjusted counter setup. */ - return setup; -} + devpriv->RPSBuf.PhysicalBase = appdma; -/* - * Set the operating mode for the specified counter. The setup - * parameter is treated as a COUNTER_SETUP data type. The following - * parameters are programmable (all other parms are ignored): ClkMult, - * ClkPol, ClkEnab, IndexSrc, IndexPol, LoadSrc. - */ + DEBUG + ("s626_attach: AllocDMAB RPS Logical=%p, bsize=%d, Physical=0x%x\n", + devpriv->RPSBuf.LogicalBase, DMABUF_SIZE, + (uint32_t) devpriv->RPSBuf.PhysicalBase); -static void SetMode_A(struct comedi_device *dev, struct enc_private *k, - uint16_t Setup, uint16_t DisableIntSrc) -{ - register uint16_t cra; - register uint16_t crb; - register uint16_t setup = Setup; /* Cache the Standard Setup. */ + devpriv->allocatedBuf++; - /* Initialize CRA and CRB images. */ - cra = ((setup & CRAMSK_LOADSRC_A) /* Preload trigger is passed through. */ - |((setup & STDMSK_INDXSRC) >> (STDBIT_INDXSRC - (CRABIT_INDXSRC_A + 1)))); /* IndexSrc is restricted to ENC_X or IndxPol. */ + } - crb = (CRBMSK_INTRESETCMD | CRBMSK_INTRESET_A /* Reset any pending CounterA event captures. */ - | ((setup & STDMSK_CLKENAB) << (CRBBIT_CLKENAB_A - STDBIT_CLKENAB))); /* Clock enable is passed through. */ + dev->board_ptr = s626_boards; + dev->board_name = thisboard->name; - /* Force IntSrc to Disabled if DisableIntSrc is asserted. */ - if (!DisableIntSrc) - cra |= ((setup & STDMSK_INTSRC) >> (STDBIT_INTSRC - - CRABIT_INTSRC_A)); + ret = comedi_alloc_subdevices(dev, 6); + if (ret) + return ret; - /* Populate all mode-dependent attributes of CRA & CRB images. */ - switch ((setup & STDMSK_CLKSRC) >> STDBIT_CLKSRC) { - case CLKSRC_EXTENDER: /* Extender Mode: Force to Timer mode */ - /* (Extender valid only for B counters). */ + dev->iobase = (unsigned long)devpriv->base_addr; + dev->irq = devpriv->pdev->irq; - case CLKSRC_TIMER: /* Timer Mode: */ - cra |= ((2 << CRABIT_CLKSRC_A) /* ClkSrcA<1> selects system clock */ - |((setup & STDMSK_CLKPOL) >> (STDBIT_CLKPOL - CRABIT_CLKSRC_A)) /* with count direction (ClkSrcA<0>) obtained from ClkPol. */ - |(1 << CRABIT_CLKPOL_A) /* ClkPolA behaves as always-on clock enable. */ - |(MULT_X1 << CRABIT_CLKMULT_A)); /* ClkMult must be 1x. */ - break; + /* set up interrupt handler */ + if (dev->irq == 0) { + printk(KERN_ERR " unknown irq (bad)\n"); + } else { + ret = request_irq(dev->irq, s626_irq_handler, IRQF_SHARED, + "s626", dev); - default: /* Counter Mode: */ - cra |= (CLKSRC_COUNTER /* Select ENC_C and ENC_D as clock/direction inputs. */ - | ((setup & STDMSK_CLKPOL) << (CRABIT_CLKPOL_A - STDBIT_CLKPOL)) /* Clock polarity is passed through. */ - |(((setup & STDMSK_CLKMULT) == (MULT_X0 << STDBIT_CLKMULT)) ? /* Force multiplier to x1 if not legal, otherwise pass through. */ - (MULT_X1 << CRABIT_CLKMULT_A) : - ((setup & STDMSK_CLKMULT) << (CRABIT_CLKMULT_A - - STDBIT_CLKMULT)))); + if (ret < 0) { + printk(KERN_ERR " irq not available\n"); + dev->irq = 0; + } } - /* Force positive index polarity if IndxSrc is software-driven only, */ - /* otherwise pass it through. */ - if (~setup & STDMSK_INDXSRC) - cra |= ((setup & STDMSK_INDXPOL) << (CRABIT_INDXPOL_A - - STDBIT_INDXPOL)); + DEBUG("s626_attach: -- it opts %d,%d --\n", + it->options[0], it->options[1]); - /* If IntSrc has been forced to Disabled, update the MISC2 interrupt */ - /* enable mask to indicate the counter interrupt is disabled. */ - if (DisableIntSrc) - devpriv->CounterIntEnabs &= ~k->MyEventBits[3]; + s = dev->subdevices + 0; + /* analog input subdevice */ + dev->read_subdev = s; + /* we support single-ended (ground) and differential */ + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_DIFF | SDF_CMD_READ; + s->n_chan = thisboard->ai_chans; + s->maxdata = (0xffff >> 2); + s->range_table = &s626_range_table; + s->len_chanlist = thisboard->ai_chans; /* This is the maximum chanlist + length that the board can + handle */ + s->insn_config = s626_ai_insn_config; + s->insn_read = s626_ai_insn_read; + s->do_cmd = s626_ai_cmd; + s->do_cmdtest = s626_ai_cmdtest; + s->cancel = s626_ai_cancel; - /* While retaining CounterB and LatchSrc configurations, program the */ - /* new counter operating mode. */ - DEBIreplace(dev, k->MyCRA, CRAMSK_INDXSRC_B | CRAMSK_CLKSRC_B, cra); - DEBIreplace(dev, k->MyCRB, - (uint16_t) (~(CRBMSK_INTCTRL | CRBMSK_CLKENAB_A)), crb); -} + s = dev->subdevices + 1; + /* analog output subdevice */ + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE; + s->n_chan = thisboard->ao_chans; + s->maxdata = (0x3fff); + s->range_table = &range_bipolar10; + s->insn_write = s626_ao_winsn; + s->insn_read = s626_ao_rinsn; -static void SetMode_B(struct comedi_device *dev, struct enc_private *k, - uint16_t Setup, uint16_t DisableIntSrc) -{ - register uint16_t cra; - register uint16_t crb; - register uint16_t setup = Setup; /* Cache the Standard Setup. */ + s = dev->subdevices + 2; + /* digital I/O subdevice */ + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE; + s->n_chan = S626_DIO_CHANNELS; + s->maxdata = 1; + s->io_bits = 0xffff; + s->private = &dio_private_A; + s->range_table = &range_digital; + s->insn_config = s626_dio_insn_config; + s->insn_bits = s626_dio_insn_bits; + + s = dev->subdevices + 3; + /* digital I/O subdevice */ + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE; + s->n_chan = 16; + s->maxdata = 1; + s->io_bits = 0xffff; + s->private = &dio_private_B; + s->range_table = &range_digital; + s->insn_config = s626_dio_insn_config; + s->insn_bits = s626_dio_insn_bits; + + s = dev->subdevices + 4; + /* digital I/O subdevice */ + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE; + s->n_chan = 16; + s->maxdata = 1; + s->io_bits = 0xffff; + s->private = &dio_private_C; + s->range_table = &range_digital; + s->insn_config = s626_dio_insn_config; + s->insn_bits = s626_dio_insn_bits; - /* Initialize CRA and CRB images. */ - cra = ((setup & STDMSK_INDXSRC) << ((CRABIT_INDXSRC_B + 1) - STDBIT_INDXSRC)); /* IndexSrc field is restricted to ENC_X or IndxPol. */ + s = dev->subdevices + 5; + /* encoder (counter) subdevice */ + s->type = COMEDI_SUBD_COUNTER; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE | SDF_LSAMPL; + s->n_chan = thisboard->enc_chans; + s->private = enc_private_data; + s->insn_config = s626_enc_insn_config; + s->insn_read = s626_enc_insn_read; + s->insn_write = s626_enc_insn_write; + s->maxdata = 0xffffff; + s->range_table = &range_unknown; - crb = (CRBMSK_INTRESETCMD | CRBMSK_INTRESET_B /* Reset event captures and disable interrupts. */ - | ((setup & STDMSK_CLKENAB) << (CRBBIT_CLKENAB_B - STDBIT_CLKENAB)) /* Clock enable is passed through. */ - |((setup & STDMSK_LOADSRC) >> (STDBIT_LOADSRC - CRBBIT_LOADSRC_B))); /* Preload trigger source is passed through. */ + /* stop ai_command */ + devpriv->ai_cmd_running = 0; - /* Force IntSrc to Disabled if DisableIntSrc is asserted. */ - if (!DisableIntSrc) - crb |= ((setup & STDMSK_INTSRC) >> (STDBIT_INTSRC - - CRBBIT_INTSRC_B)); + if (devpriv->base_addr && (devpriv->allocatedBuf == 2)) { + dma_addr_t pPhysBuf; + uint16_t chan; - /* Populate all mode-dependent attributes of CRA & CRB images. */ - switch ((setup & STDMSK_CLKSRC) >> STDBIT_CLKSRC) { - case CLKSRC_TIMER: /* Timer Mode: */ - cra |= ((2 << CRABIT_CLKSRC_B) /* ClkSrcB<1> selects system clock */ - |((setup & STDMSK_CLKPOL) << (CRABIT_CLKSRC_B - STDBIT_CLKPOL))); /* with direction (ClkSrcB<0>) obtained from ClkPol. */ - crb |= ((1 << CRBBIT_CLKPOL_B) /* ClkPolB behaves as always-on clock enable. */ - |(MULT_X1 << CRBBIT_CLKMULT_B)); /* ClkMultB must be 1x. */ - break; + /* enab DEBI and audio pins, enable I2C interface. */ + MC_ENABLE(P_MC1, MC1_DEBI | MC1_AUDIO | MC1_I2C); + /* Configure DEBI operating mode. */ + WR7146(P_DEBICFG, DEBI_CFG_SLAVE16 /* Local bus is 16 */ + /* bits wide. */ + | (DEBI_TOUT << DEBI_CFG_TOUT_BIT) - case CLKSRC_EXTENDER: /* Extender Mode: */ - cra |= ((2 << CRABIT_CLKSRC_B) /* ClkSrcB source is OverflowA (same as "timer") */ - |((setup & STDMSK_CLKPOL) << (CRABIT_CLKSRC_B - STDBIT_CLKPOL))); /* with direction obtained from ClkPol. */ - crb |= ((1 << CRBBIT_CLKPOL_B) /* ClkPolB controls IndexB -- always set to active. */ - |(MULT_X0 << CRBBIT_CLKMULT_B)); /* ClkMultB selects OverflowA as the clock source. */ - break; + /* Declare DEBI */ + /* transfer timeout */ + /* interval. */ + |DEBI_SWAP /* Set up byte lane */ + /* steering. */ + | DEBI_CFG_INTEL); /* Intel-compatible */ + /* local bus (DEBI */ + /* never times out). */ + DEBUG("s626_attach: %d debi init -- %d\n", + DEBI_CFG_SLAVE16 | (DEBI_TOUT << DEBI_CFG_TOUT_BIT) | + DEBI_SWAP | DEBI_CFG_INTEL, + DEBI_CFG_INTEL | DEBI_CFG_TOQ | DEBI_CFG_INCQ | + DEBI_CFG_16Q); - default: /* Counter Mode: */ - cra |= (CLKSRC_COUNTER << CRABIT_CLKSRC_B); /* Select ENC_C and ENC_D as clock/direction inputs. */ - crb |= (((setup & STDMSK_CLKPOL) >> (STDBIT_CLKPOL - CRBBIT_CLKPOL_B)) /* ClkPol is passed through. */ - |(((setup & STDMSK_CLKMULT) == (MULT_X0 << STDBIT_CLKMULT)) ? /* Force ClkMult to x1 if not legal, otherwise pass through. */ - (MULT_X1 << CRBBIT_CLKMULT_B) : - ((setup & STDMSK_CLKMULT) << (CRBBIT_CLKMULT_B - - STDBIT_CLKMULT)))); - } + /* DEBI INIT S626 WR7146( P_DEBICFG, DEBI_CFG_INTEL | DEBI_CFG_TOQ */ + /* | DEBI_CFG_INCQ| DEBI_CFG_16Q); //end */ - /* Force positive index polarity if IndxSrc is software-driven only, */ - /* otherwise pass it through. */ - if (~setup & STDMSK_INDXSRC) - crb |= ((setup & STDMSK_INDXPOL) >> (STDBIT_INDXPOL - - CRBBIT_INDXPOL_B)); + /* Paging is disabled. */ + WR7146(P_DEBIPAGE, DEBI_PAGE_DISABLE); /* Disable MMU paging. */ - /* If IntSrc has been forced to Disabled, update the MISC2 interrupt */ - /* enable mask to indicate the counter interrupt is disabled. */ - if (DisableIntSrc) - devpriv->CounterIntEnabs &= ~k->MyEventBits[3]; + /* Init GPIO so that ADC Start* is negated. */ + WR7146(P_GPIO, GPIO_BASE | GPIO1_HI); - /* While retaining CounterA and LatchSrc configurations, program the */ - /* new counter operating mode. */ - DEBIreplace(dev, k->MyCRA, - (uint16_t) (~(CRAMSK_INDXSRC_B | CRAMSK_CLKSRC_B)), cra); - DEBIreplace(dev, k->MyCRB, CRBMSK_CLKENAB_A | CRBMSK_LATCHSRC, crb); -} + /* IsBoardRevA is a boolean that indicates whether the board is RevA. + * + * VERSION 2.01 CHANGE: REV A & B BOARDS NOW SUPPORTED BY DYNAMIC + * EEPROM ADDRESS SELECTION. Initialize the I2C interface, which + * is used to access the onboard serial EEPROM. The EEPROM's I2C + * DeviceAddress is hardwired to a value that is dependent on the + * 626 board revision. On all board revisions, the EEPROM stores + * TrimDAC calibration constants for analog I/O. On RevB and + * higher boards, the DeviceAddress is hardwired to 0 to enable + * the EEPROM to also store the PCI SubVendorID and SubDeviceID; + * this is the address at which the SAA7146 expects a + * configuration EEPROM to reside. On RevA boards, the EEPROM + * device address, which is hardwired to 4, prevents the SAA7146 + * from retrieving PCI sub-IDs, so the SAA7146 uses its built-in + * default values, instead. + */ -/* Return/set a counter's enable. enab: 0=always enabled, 1=enabled by index. */ + /* devpriv->I2Cards= IsBoardRevA ? 0xA8 : 0xA0; // Set I2C EEPROM */ + /* DeviceType (0xA0) */ + /* and DeviceAddress<<1. */ -static void SetEnable_A(struct comedi_device *dev, struct enc_private *k, - uint16_t enab) -{ - DEBUG("SetEnable_A: SetEnable_A enter 3541\n"); - DEBIreplace(dev, k->MyCRB, - (uint16_t) (~(CRBMSK_INTCTRL | CRBMSK_CLKENAB_A)), - (uint16_t) (enab << CRBBIT_CLKENAB_A)); -} + devpriv->I2CAdrs = 0xA0; /* I2C device address for onboard */ + /* eeprom(revb) */ -static void SetEnable_B(struct comedi_device *dev, struct enc_private *k, - uint16_t enab) -{ - DEBIreplace(dev, k->MyCRB, - (uint16_t) (~(CRBMSK_INTCTRL | CRBMSK_CLKENAB_B)), - (uint16_t) (enab << CRBBIT_CLKENAB_B)); -} + /* Issue an I2C ABORT command to halt any I2C operation in */ + /* progress and reset BUSY flag. */ + WR7146(P_I2CSTAT, I2C_CLKSEL | I2C_ABORT); + /* Write I2C control: abort any I2C activity. */ + MC_ENABLE(P_MC2, MC2_UPLD_IIC); + /* Invoke command upload */ + while ((RR7146(P_MC2) & MC2_UPLD_IIC) == 0) + ; + /* and wait for upload to complete. */ -static uint16_t GetEnable_A(struct comedi_device *dev, struct enc_private *k) -{ - return (DEBIread(dev, k->MyCRB) >> CRBBIT_CLKENAB_A) & 1; -} + /* Per SAA7146 data sheet, write to STATUS reg twice to + * reset all I2C error flags. */ + for (i = 0; i < 2; i++) { + WR7146(P_I2CSTAT, I2C_CLKSEL); + /* Write I2C control: reset error flags. */ + MC_ENABLE(P_MC2, MC2_UPLD_IIC); /* Invoke command upload */ + while (!MC_TEST(P_MC2, MC2_UPLD_IIC)) + ; + /* and wait for upload to complete. */ + } -static uint16_t GetEnable_B(struct comedi_device *dev, struct enc_private *k) -{ - return (DEBIread(dev, k->MyCRB) >> CRBBIT_CLKENAB_B) & 1; -} + /* Init audio interface functional attributes: set DAC/ADC + * serial clock rates, invert DAC serial clock so that + * DAC data setup times are satisfied, enable DAC serial + * clock out. + */ -/* Return/set a counter pair's latch trigger source. 0: On read - * access, 1: A index latches A, 2: B index latches B, 3: A overflow - * latches B. - */ + WR7146(P_ACON2, ACON2_INIT); -static void SetLatchSource(struct comedi_device *dev, struct enc_private *k, - uint16_t value) -{ - DEBUG("SetLatchSource: SetLatchSource enter 3550\n"); - DEBIreplace(dev, k->MyCRB, - (uint16_t) (~(CRBMSK_INTCTRL | CRBMSK_LATCHSRC)), - (uint16_t) (value << CRBBIT_LATCHSRC)); + /* Set up TSL1 slot list, which is used to control the + * accumulation of ADC data: RSD1 = shift data in on SD1. + * SIB_A1 = store data uint8_t at next available location in + * FB BUFFER1 register. */ + WR7146(P_TSL1, RSD1 | SIB_A1); + /* Fetch ADC high data uint8_t. */ + WR7146(P_TSL1 + 4, RSD1 | SIB_A1 | EOS); + /* Fetch ADC low data uint8_t; end of TSL1. */ - DEBUG("SetLatchSource: SetLatchSource exit\n"); -} + /* enab TSL1 slot list so that it executes all the time. */ + WR7146(P_ACON1, ACON1_ADCSTART); -/* - * static uint16_t GetLatchSource(struct comedi_device *dev, struct enc_private *k ) - * { - * return ( DEBIread( dev, k->MyCRB) >> CRBBIT_LATCHSRC ) & 3; - * } - */ + /* Initialize RPS registers used for ADC. */ -/* - * Return/set the event that will trigger transfer of the preload - * register into the counter. 0=ThisCntr_Index, 1=ThisCntr_Overflow, - * 2=OverflowA (B counters only), 3=disabled. - */ + /* Physical start of RPS program. */ + WR7146(P_RPSADDR1, (uint32_t) devpriv->RPSBuf.PhysicalBase); -static void SetLoadTrig_A(struct comedi_device *dev, struct enc_private *k, - uint16_t Trig) -{ - DEBIreplace(dev, k->MyCRA, (uint16_t) (~CRAMSK_LOADSRC_A), - (uint16_t) (Trig << CRABIT_LOADSRC_A)); -} + WR7146(P_RPSPAGE1, 0); + /* RPS program performs no explicit mem writes. */ + WR7146(P_RPS1_TOUT, 0); /* Disable RPS timeouts. */ -static void SetLoadTrig_B(struct comedi_device *dev, struct enc_private *k, - uint16_t Trig) -{ - DEBIreplace(dev, k->MyCRB, - (uint16_t) (~(CRBMSK_LOADSRC_B | CRBMSK_INTCTRL)), - (uint16_t) (Trig << CRBBIT_LOADSRC_B)); -} + /* SAA7146 BUG WORKAROUND. Initialize SAA7146 ADC interface + * to a known state by invoking ADCs until FB BUFFER 1 + * register shows that it is correctly receiving ADC data. + * This is necessary because the SAA7146 ADC interface does + * not start up in a defined state after a PCI reset. + */ -static uint16_t GetLoadTrig_A(struct comedi_device *dev, struct enc_private *k) -{ - return (DEBIread(dev, k->MyCRA) >> CRABIT_LOADSRC_A) & 3; -} +/* PollList = EOPL; // Create a simple polling */ +/* // list for analog input */ +/* // channel 0. */ +/* ResetADC( dev, &PollList ); */ -static uint16_t GetLoadTrig_B(struct comedi_device *dev, struct enc_private *k) -{ - return (DEBIread(dev, k->MyCRB) >> CRBBIT_LOADSRC_B) & 3; -} +/* s626_ai_rinsn(dev,dev->subdevices,NULL,data); //( &AdcData ); // */ +/* //Get initial ADC */ +/* //value. */ -/* Return/set counter interrupt source and clear any captured - * index/overflow events. IntSource: 0=Disabled, 1=OverflowOnly, - * 2=IndexOnly, 3=IndexAndOverflow. - */ +/* StartVal = data[0]; */ -static void SetIntSrc_A(struct comedi_device *dev, struct enc_private *k, - uint16_t IntSource) -{ - /* Reset any pending counter overflow or index captures. */ - DEBIreplace(dev, k->MyCRB, (uint16_t) (~CRBMSK_INTCTRL), - CRBMSK_INTRESETCMD | CRBMSK_INTRESET_A); +/* // VERSION 2.01 CHANGE: TIMEOUT ADDED TO PREVENT HANGED EXECUTION. */ +/* // Invoke ADCs until the new ADC value differs from the initial */ +/* // value or a timeout occurs. The timeout protects against the */ +/* // possibility that the driver is restarting and the ADC data is a */ +/* // fixed value resulting from the applied ADC analog input being */ +/* // unusually quiet or at the rail. */ - /* Program counter interrupt source. */ - DEBIreplace(dev, k->MyCRA, ~CRAMSK_INTSRC_A, - (uint16_t) (IntSource << CRABIT_INTSRC_A)); +/* for ( index = 0; index < 500; index++ ) */ +/* { */ +/* s626_ai_rinsn(dev,dev->subdevices,NULL,data); */ +/* AdcData = data[0]; //ReadADC( &AdcData ); */ +/* if ( AdcData != StartVal ) */ +/* break; */ +/* } */ - /* Update MISC2 interrupt enable mask. */ - devpriv->CounterIntEnabs = - (devpriv->CounterIntEnabs & ~k-> - MyEventBits[3]) | k->MyEventBits[IntSource]; -} + /* end initADC */ -static void SetIntSrc_B(struct comedi_device *dev, struct enc_private *k, - uint16_t IntSource) -{ - uint16_t crb; + /* init the DAC interface */ - /* Cache writeable CRB register image. */ - crb = DEBIread(dev, k->MyCRB) & ~CRBMSK_INTCTRL; + /* Init Audio2's output DMAC attributes: burst length = 1 + * DWORD, threshold = 1 DWORD. + */ + WR7146(P_PCI_BT_A, 0); - /* Reset any pending counter overflow or index captures. */ - DEBIwrite(dev, k->MyCRB, - (uint16_t) (crb | CRBMSK_INTRESETCMD | CRBMSK_INTRESET_B)); + /* Init Audio2's output DMA physical addresses. The protection + * address is set to 1 DWORD past the base address so that a + * single DWORD will be transferred each time a DMA transfer is + * enabled. */ - /* Program counter interrupt source. */ - DEBIwrite(dev, k->MyCRB, - (uint16_t) ((crb & ~CRBMSK_INTSRC_B) | (IntSource << - CRBBIT_INTSRC_B))); + pPhysBuf = + devpriv->ANABuf.PhysicalBase + + (DAC_WDMABUF_OS * sizeof(uint32_t)); - /* Update MISC2 interrupt enable mask. */ - devpriv->CounterIntEnabs = - (devpriv->CounterIntEnabs & ~k-> - MyEventBits[3]) | k->MyEventBits[IntSource]; -} + WR7146(P_BASEA2_OUT, (uint32_t) pPhysBuf); /* Buffer base adrs. */ + WR7146(P_PROTA2_OUT, (uint32_t) (pPhysBuf + sizeof(uint32_t))); /* Protection address. */ -static uint16_t GetIntSrc_A(struct comedi_device *dev, struct enc_private *k) -{ - return (DEBIread(dev, k->MyCRA) >> CRABIT_INTSRC_A) & 3; -} + /* Cache Audio2's output DMA buffer logical address. This is + * where DAC data is buffered for A2 output DMA transfers. */ + devpriv->pDacWBuf = + (uint32_t *) devpriv->ANABuf.LogicalBase + DAC_WDMABUF_OS; -static uint16_t GetIntSrc_B(struct comedi_device *dev, struct enc_private *k) -{ - return (DEBIread(dev, k->MyCRB) >> CRBBIT_INTSRC_B) & 3; -} + /* Audio2's output channels does not use paging. The protection + * violation handling bit is set so that the DMAC will + * automatically halt and its PCI address pointer will be reset + * when the protection address is reached. */ -/* Return/set the clock multiplier. */ + WR7146(P_PAGEA2_OUT, 8); -/* static void SetClkMult(struct comedi_device *dev, struct enc_private *k, uint16_t value ) */ -/* { */ -/* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_CLKMULT ) | ( value << STDBIT_CLKMULT ) ), FALSE ); */ -/* } */ + /* Initialize time slot list 2 (TSL2), which is used to control + * the clock generation for and serialization of data to be sent + * to the DAC devices. Slot 0 is a NOP that is used to trap TSL + * execution; this permits other slots to be safely modified + * without first turning off the TSL sequencer (which is + * apparently impossible to do). Also, SD3 (which is driven by a + * pull-up resistor) is shifted in and stored to the MSB of + * FB_BUFFER2 to be used as evidence that the slot sequence has + * not yet finished executing. + */ -/* static uint16_t GetClkMult(struct comedi_device *dev, struct enc_private *k ) */ -/* { */ -/* return ( k->GetMode(dev, k ) >> STDBIT_CLKMULT ) & 3; */ -/* } */ + SETVECT(0, XSD2 | RSD3 | SIB_A2 | EOS); + /* Slot 0: Trap TSL execution, shift 0xFF into FB_BUFFER2. */ -/* Return/set the clock polarity. */ + /* Initialize slot 1, which is constant. Slot 1 causes a + * DWORD to be transferred from audio channel 2's output FIFO + * to the FIFO's output buffer so that it can be serialized + * and sent to the DAC during subsequent slots. All remaining + * slots are dynamically populated as required by the target + * DAC device. + */ + SETVECT(1, LF_A2); + /* Slot 1: Fetch DWORD from Audio2's output FIFO. */ -/* static void SetClkPol( struct comedi_device *dev,struct enc_private *k, uint16_t value ) */ -/* { */ -/* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_CLKPOL ) | ( value << STDBIT_CLKPOL ) ), FALSE ); */ -/* } */ + /* Start DAC's audio interface (TSL2) running. */ + WR7146(P_ACON1, ACON1_DACSTART); -/* static uint16_t GetClkPol(struct comedi_device *dev, struct enc_private *k ) */ -/* { */ -/* return ( k->GetMode(dev, k ) >> STDBIT_CLKPOL ) & 1; */ -/* } */ + /* end init DAC interface */ -/* Return/set the clock source. */ + /* Init Trim DACs to calibrated values. Do it twice because the + * SAA7146 audio channel does not always reset properly and + * sometimes causes the first few TrimDAC writes to malfunction. + */ -/* static void SetClkSrc( struct comedi_device *dev,struct enc_private *k, uint16_t value ) */ -/* { */ -/* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_CLKSRC ) | ( value << STDBIT_CLKSRC ) ), FALSE ); */ -/* } */ + LoadTrimDACs(dev); + LoadTrimDACs(dev); /* Insurance. */ -/* static uint16_t GetClkSrc( struct comedi_device *dev,struct enc_private *k ) */ -/* { */ -/* return ( k->GetMode(dev, k ) >> STDBIT_CLKSRC ) & 3; */ -/* } */ + /* Manually init all gate array hardware in case this is a soft + * reset (we have no way of determining whether this is a warm + * or cold start). This is necessary because the gate array will + * reset only in response to a PCI hard reset; there is no soft + * reset function. */ -/* Return/set the index polarity. */ + /* Init all DAC outputs to 0V and init all DAC setpoint and + * polarity images. + */ + for (chan = 0; chan < S626_DAC_CHANNELS; chan++) + SetDAC(dev, chan, 0); -/* static void SetIndexPol(struct comedi_device *dev, struct enc_private *k, uint16_t value ) */ -/* { */ -/* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_INDXPOL ) | ( (value != 0) << STDBIT_INDXPOL ) ), FALSE ); */ -/* } */ + /* Init image of WRMISC2 Battery Charger Enabled control bit. + * This image is used when the state of the charger control bit, + * which has no direct hardware readback mechanism, is queried. + */ + devpriv->ChargeEnabled = 0; -/* static uint16_t GetIndexPol(struct comedi_device *dev, struct enc_private *k ) */ -/* { */ -/* return ( k->GetMode(dev, k ) >> STDBIT_INDXPOL ) & 1; */ -/* } */ + /* Init image of watchdog timer interval in WRMISC2. This image + * maintains the value of the control bits of MISC2 are + * continuously reset to zero as long as the WD timer is disabled. + */ + devpriv->WDInterval = 0; -/* Return/set the index source. */ + /* Init Counter Interrupt enab mask for RDMISC2. This mask is + * applied against MISC2 when testing to determine which timer + * events are requesting interrupt service. + */ + devpriv->CounterIntEnabs = 0; -/* static void SetIndexSrc(struct comedi_device *dev, struct enc_private *k, uint16_t value ) */ -/* { */ -/* DEBUG("SetIndexSrc: set index src enter 3700\n"); */ -/* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_INDXSRC ) | ( (value != 0) << STDBIT_INDXSRC ) ), FALSE ); */ -/* } */ + /* Init counters. */ + CountersInit(dev); -/* static uint16_t GetIndexSrc(struct comedi_device *dev, struct enc_private *k ) */ -/* { */ -/* return ( k->GetMode(dev, k ) >> STDBIT_INDXSRC ) & 1; */ -/* } */ + /* Without modifying the state of the Battery Backup enab, disable + * the watchdog timer, set DIO channels 0-5 to operate in the + * standard DIO (vs. counter overflow) mode, disable the battery + * charger, and reset the watchdog interval selector to zero. + */ + WriteMISC2(dev, (uint16_t) (DEBIread(dev, + LP_RDMISC2) & + MISC2_BATT_ENABLE)); -/* Generate an index pulse. */ + /* Initialize the digital I/O subsystem. */ + s626_dio_init(dev); -static void PulseIndex_A(struct comedi_device *dev, struct enc_private *k) -{ - register uint16_t cra; + /* enable interrupt test */ + /* writel(IRQ_GPIO3 | IRQ_RPS1,devpriv->base_addr+P_IER); */ + } - DEBUG("PulseIndex_A: pulse index enter\n"); + DEBUG("s626_attach: comedi%d s626 attached %04x\n", dev->minor, + (uint32_t) devpriv->base_addr); - cra = DEBIread(dev, k->MyCRA); /* Pulse index. */ - DEBIwrite(dev, k->MyCRA, (uint16_t) (cra ^ CRAMSK_INDXPOL_A)); - DEBUG("PulseIndex_A: pulse index step1\n"); - DEBIwrite(dev, k->MyCRA, cra); + return 1; } -static void PulseIndex_B(struct comedi_device *dev, struct enc_private *k) +static void s626_detach(struct comedi_device *dev) { - register uint16_t crb; + if (devpriv) { + /* stop ai_command */ + devpriv->ai_cmd_running = 0; - crb = DEBIread(dev, k->MyCRB) & ~CRBMSK_INTCTRL; /* Pulse index. */ - DEBIwrite(dev, k->MyCRB, (uint16_t) (crb ^ CRBMSK_INDXPOL_B)); - DEBIwrite(dev, k->MyCRB, crb); -} + if (devpriv->base_addr) { + /* interrupt mask */ + WR7146(P_IER, 0); /* Disable master interrupt. */ + WR7146(P_ISR, IRQ_GPIO3 | IRQ_RPS1); /* Clear board's IRQ status flag. */ -/* Write value into counter preload register. */ + /* Disable the watchdog timer and battery charger. */ + WriteMISC2(dev, 0); -static void Preload(struct comedi_device *dev, struct enc_private *k, - uint32_t value) -{ - DEBUG("Preload: preload enter\n"); - DEBIwrite(dev, (uint16_t) (k->MyLatchLsw), (uint16_t) value); /* Write value to preload register. */ - DEBUG("Preload: preload step 1\n"); - DEBIwrite(dev, (uint16_t) (k->MyLatchLsw + 2), - (uint16_t) (value >> 16)); -} + /* Close all interfaces on 7146 device. */ + WR7146(P_MC1, MC1_SHUTDOWN); + WR7146(P_ACON1, ACON1_BASE); -static void CountersInit(struct comedi_device *dev) -{ - int chan; - struct enc_private *k; - uint16_t Setup = (LOADSRC_INDX << BF_LOADSRC) | /* Preload upon */ - /* index. */ - (INDXSRC_SOFT << BF_INDXSRC) | /* Disable hardware index. */ - (CLKSRC_COUNTER << BF_CLKSRC) | /* Operating mode is counter. */ - (CLKPOL_POS << BF_CLKPOL) | /* Active high clock. */ - (CNTDIR_UP << BF_CLKPOL) | /* Count direction is up. */ - (CLKMULT_1X << BF_CLKMULT) | /* Clock multiplier is 1x. */ - (CLKENAB_INDEX << BF_CLKENAB); /* Enabled by index */ + CloseDMAB(dev, &devpriv->RPSBuf, DMABUF_SIZE); + CloseDMAB(dev, &devpriv->ANABuf, DMABUF_SIZE); + } - /* Disable all counter interrupts and clear any captured counter events. */ - for (chan = 0; chan < S626_ENCODER_CHANNELS; chan++) { - k = &encpriv[chan]; - k->SetMode(dev, k, Setup, TRUE); - k->SetIntSrc(dev, k, 0); - k->ResetCapFlags(dev, k); - k->SetEnable(dev, k, CLKENAB_ALWAYS); + if (dev->irq) + free_irq(dev->irq, dev); + if (devpriv->base_addr) + iounmap(devpriv->base_addr); + if (devpriv->pdev) { + if (devpriv->got_regions) + comedi_pci_disable(devpriv->pdev); + pci_dev_put(devpriv->pdev); + } } - DEBUG("CountersInit: counters initialized\n"); - } static struct comedi_driver s626_driver = { -- cgit v0.10.2 From 6b387b7095cabbb8bd31c936ed3d47ef758cc595 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 20 Jun 2012 19:25:16 -0700 Subject: staging: comedi: s626: remove forward declarations 2 Move the DEBI* i/o functions up to remove the need for the forward declarations. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 0886806..1efa2f0 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -220,9 +220,6 @@ static uint8_t I2Cread(struct comedi_device *dev, uint8_t addr); static uint32_t I2Chandshake(struct comedi_device *dev, uint32_t val); static void SetDAC(struct comedi_device *dev, uint16_t chan, short dacdata); static void SendDAC(struct comedi_device *dev, uint32_t val); -static void DEBItransfer(struct comedi_device *dev); -static uint16_t DEBIread(struct comedi_device *dev, uint16_t addr); -static void DEBIwrite(struct comedi_device *dev, uint16_t addr, uint16_t wdata); /* COUNTER OBJECT ------------------------------------------------ */ struct enc_private { @@ -426,6 +423,76 @@ static const struct comedi_lrange s626_range_table = { 2, { } }; +/* Execute a DEBI transfer. This must be called from within a */ +/* critical section. */ +static void DEBItransfer(struct comedi_device *dev) +{ + /* Initiate upload of shadow RAM to DEBI control register. */ + MC_ENABLE(P_MC2, MC2_UPLD_DEBI); + + /* Wait for completion of upload from shadow RAM to DEBI control */ + /* register. */ + while (!MC_TEST(P_MC2, MC2_UPLD_DEBI)) + ; + + /* Wait until DEBI transfer is done. */ + while (RR7146(P_PSR) & PSR_DEBI_S) + ; +} + +/* Initialize the DEBI interface for all transfers. */ + +static uint16_t DEBIread(struct comedi_device *dev, uint16_t addr) +{ + uint16_t retval; + + /* Set up DEBI control register value in shadow RAM. */ + WR7146(P_DEBICMD, DEBI_CMD_RDWORD | addr); + + /* Execute the DEBI transfer. */ + DEBItransfer(dev); + + /* Fetch target register value. */ + retval = (uint16_t) RR7146(P_DEBIAD); + + /* Return register value. */ + return retval; +} + +/* Write a value to a gate array register. */ +static void DEBIwrite(struct comedi_device *dev, uint16_t addr, uint16_t wdata) +{ + + /* Set up DEBI control register value in shadow RAM. */ + WR7146(P_DEBICMD, DEBI_CMD_WRWORD | addr); + WR7146(P_DEBIAD, wdata); + + /* Execute the DEBI transfer. */ + DEBItransfer(dev); +} + +/* Replace the specified bits in a gate array register. Imports: mask + * specifies bits that are to be preserved, wdata is new value to be + * or'd with the masked original. + */ +static void DEBIreplace(struct comedi_device *dev, uint16_t addr, uint16_t mask, + uint16_t wdata) +{ + + /* Copy target gate array register into P_DEBIAD register. */ + WR7146(P_DEBICMD, DEBI_CMD_RDWORD | addr); + /* Set up DEBI control reg value in shadow RAM. */ + DEBItransfer(dev); /* Execute the DEBI Read transfer. */ + + /* Write back the modified image. */ + WR7146(P_DEBICMD, DEBI_CMD_WRWORD | addr); + /* Set up DEBI control reg value in shadow RAM. */ + + WR7146(P_DEBIAD, wdata | ((uint16_t) RR7146(P_DEBIAD) & mask)); + /* Modify the register image. */ + DEBItransfer(dev); /* Execute the DEBI Write transfer. */ +} + static unsigned int s626_ai_reg_to_uint(int data) { unsigned int tempdata; @@ -2123,76 +2190,6 @@ static void WriteMISC2(struct comedi_device *dev, uint16_t NewImage) DEBIwrite(dev, LP_MISC1, MISC1_WDISABLE); /* Disable writes to MISC2. */ } -/* Initialize the DEBI interface for all transfers. */ - -static uint16_t DEBIread(struct comedi_device *dev, uint16_t addr) -{ - uint16_t retval; - - /* Set up DEBI control register value in shadow RAM. */ - WR7146(P_DEBICMD, DEBI_CMD_RDWORD | addr); - - /* Execute the DEBI transfer. */ - DEBItransfer(dev); - - /* Fetch target register value. */ - retval = (uint16_t) RR7146(P_DEBIAD); - - /* Return register value. */ - return retval; -} - -/* Execute a DEBI transfer. This must be called from within a */ -/* critical section. */ -static void DEBItransfer(struct comedi_device *dev) -{ - /* Initiate upload of shadow RAM to DEBI control register. */ - MC_ENABLE(P_MC2, MC2_UPLD_DEBI); - - /* Wait for completion of upload from shadow RAM to DEBI control */ - /* register. */ - while (!MC_TEST(P_MC2, MC2_UPLD_DEBI)) - ; - - /* Wait until DEBI transfer is done. */ - while (RR7146(P_PSR) & PSR_DEBI_S) - ; -} - -/* Write a value to a gate array register. */ -static void DEBIwrite(struct comedi_device *dev, uint16_t addr, uint16_t wdata) -{ - - /* Set up DEBI control register value in shadow RAM. */ - WR7146(P_DEBICMD, DEBI_CMD_WRWORD | addr); - WR7146(P_DEBIAD, wdata); - - /* Execute the DEBI transfer. */ - DEBItransfer(dev); -} - -/* Replace the specified bits in a gate array register. Imports: mask - * specifies bits that are to be preserved, wdata is new value to be - * or'd with the masked original. - */ -static void DEBIreplace(struct comedi_device *dev, uint16_t addr, uint16_t mask, - uint16_t wdata) -{ - - /* Copy target gate array register into P_DEBIAD register. */ - WR7146(P_DEBICMD, DEBI_CMD_RDWORD | addr); - /* Set up DEBI control reg value in shadow RAM. */ - DEBItransfer(dev); /* Execute the DEBI Read transfer. */ - - /* Write back the modified image. */ - WR7146(P_DEBICMD, DEBI_CMD_WRWORD | addr); - /* Set up DEBI control reg value in shadow RAM. */ - - WR7146(P_DEBIAD, wdata | ((uint16_t) RR7146(P_DEBIAD) & mask)); - /* Modify the register image. */ - DEBItransfer(dev); /* Execute the DEBI Write transfer. */ -} - static void CloseDMAB(struct comedi_device *dev, struct bufferDMA *pdma, size_t bsize) { -- cgit v0.10.2 From 982e3d11ed2b7a96ee93ef62ab37826da1e75a32 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 20 Jun 2012 19:25:32 -0700 Subject: staging: comedi: s626: remove forward declarations 3 Move the I2C functions up to remove the need for the forward declarations. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 1efa2f0..5fcb43a 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -216,8 +216,6 @@ static int s626_ns_to_timer(int *nanosec, int round_mode); /* internal routines */ static void WriteTrimDAC(struct comedi_device *dev, uint8_t LogicalChan, uint8_t DacData); -static uint8_t I2Cread(struct comedi_device *dev, uint8_t addr); -static uint32_t I2Chandshake(struct comedi_device *dev, uint32_t val); static void SetDAC(struct comedi_device *dev, uint16_t chan, short dacdata); static void SendDAC(struct comedi_device *dev, uint32_t val); @@ -493,6 +491,67 @@ static void DEBIreplace(struct comedi_device *dev, uint16_t addr, uint16_t mask, DEBItransfer(dev); /* Execute the DEBI Write transfer. */ } +/* ************** EEPROM ACCESS FUNCTIONS ************** */ + +static uint32_t I2Chandshake(struct comedi_device *dev, uint32_t val) +{ + /* Write I2C command to I2C Transfer Control shadow register. */ + WR7146(P_I2CCTRL, val); + + /* Upload I2C shadow registers into working registers and wait for */ + /* upload confirmation. */ + + MC_ENABLE(P_MC2, MC2_UPLD_IIC); + while (!MC_TEST(P_MC2, MC2_UPLD_IIC)) + ; + + /* Wait until I2C bus transfer is finished or an error occurs. */ + while ((RR7146(P_I2CCTRL) & (I2C_BUSY | I2C_ERR)) == I2C_BUSY) + ; + + /* Return non-zero if I2C error occurred. */ + return RR7146(P_I2CCTRL) & I2C_ERR; + +} + +/* Read uint8_t from EEPROM. */ +static uint8_t I2Cread(struct comedi_device *dev, uint8_t addr) +{ + uint8_t rtnval; + + /* Send EEPROM target address. */ + if (I2Chandshake(dev, I2C_B2(I2C_ATTRSTART, I2CW) + /* Byte2 = I2C command: write to I2C EEPROM device. */ + | I2C_B1(I2C_ATTRSTOP, addr) + /* Byte1 = EEPROM internal target address. */ + | I2C_B0(I2C_ATTRNOP, 0))) { /* Byte0 = Not sent. */ + /* Abort function and declare error if handshake failed. */ + DEBUG("I2Cread: error handshake I2Cread a\n"); + return 0; + } + /* Execute EEPROM read. */ + if (I2Chandshake(dev, I2C_B2(I2C_ATTRSTART, I2CR) + + /* Byte2 = I2C */ + /* command: read */ + /* from I2C EEPROM */ + /* device. */ + |I2C_B1(I2C_ATTRSTOP, 0) + + /* Byte1 receives */ + /* uint8_t from */ + /* EEPROM. */ + |I2C_B0(I2C_ATTRNOP, 0))) { /* Byte0 = Not sent. */ + + /* Abort function and declare error if handshake failed. */ + DEBUG("I2Cread: error handshake I2Cread b\n"); + return 0; + } + /* Return copy of EEPROM value. */ + rtnval = (uint8_t) (RR7146(P_I2CCTRL) >> 16); + return rtnval; +} + static unsigned int s626_ai_reg_to_uint(int data) { unsigned int tempdata; @@ -1938,67 +1997,6 @@ static void WriteTrimDAC(struct comedi_device *dev, uint8_t LogicalChan, | (uint32_t) DacData); /* Include DAC setpoint data. */ } -/* ************** EEPROM ACCESS FUNCTIONS ************** */ -/* Read uint8_t from EEPROM. */ - -static uint8_t I2Cread(struct comedi_device *dev, uint8_t addr) -{ - uint8_t rtnval; - - /* Send EEPROM target address. */ - if (I2Chandshake(dev, I2C_B2(I2C_ATTRSTART, I2CW) - /* Byte2 = I2C command: write to I2C EEPROM device. */ - | I2C_B1(I2C_ATTRSTOP, addr) - /* Byte1 = EEPROM internal target address. */ - | I2C_B0(I2C_ATTRNOP, 0))) { /* Byte0 = Not sent. */ - /* Abort function and declare error if handshake failed. */ - DEBUG("I2Cread: error handshake I2Cread a\n"); - return 0; - } - /* Execute EEPROM read. */ - if (I2Chandshake(dev, I2C_B2(I2C_ATTRSTART, I2CR) - - /* Byte2 = I2C */ - /* command: read */ - /* from I2C EEPROM */ - /* device. */ - |I2C_B1(I2C_ATTRSTOP, 0) - - /* Byte1 receives */ - /* uint8_t from */ - /* EEPROM. */ - |I2C_B0(I2C_ATTRNOP, 0))) { /* Byte0 = Not sent. */ - - /* Abort function and declare error if handshake failed. */ - DEBUG("I2Cread: error handshake I2Cread b\n"); - return 0; - } - /* Return copy of EEPROM value. */ - rtnval = (uint8_t) (RR7146(P_I2CCTRL) >> 16); - return rtnval; -} - -static uint32_t I2Chandshake(struct comedi_device *dev, uint32_t val) -{ - /* Write I2C command to I2C Transfer Control shadow register. */ - WR7146(P_I2CCTRL, val); - - /* Upload I2C shadow registers into working registers and wait for */ - /* upload confirmation. */ - - MC_ENABLE(P_MC2, MC2_UPLD_IIC); - while (!MC_TEST(P_MC2, MC2_UPLD_IIC)) - ; - - /* Wait until I2C bus transfer is finished or an error occurs. */ - while ((RR7146(P_I2CCTRL) & (I2C_BUSY | I2C_ERR)) == I2C_BUSY) - ; - - /* Return non-zero if I2C error occurred. */ - return RR7146(P_I2CCTRL) & I2C_ERR; - -} - /* Private helper function: Write setpoint to an application DAC channel. */ static void SetDAC(struct comedi_device *dev, uint16_t chan, short dacdata) -- cgit v0.10.2 From 954147296993e1c369f8e1d68d488724e7040dea Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 20 Jun 2012 19:25:49 -0700 Subject: staging: comedi: s626: remove forward declarations 4 Move the DAC functions up to remove the need for the forward declarations. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 5fcb43a..3cdb293 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -213,12 +213,6 @@ static int s626_dio_reset_irq(struct comedi_device *dev, unsigned int gruop, static int s626_dio_clear_irq(struct comedi_device *dev); static int s626_ns_to_timer(int *nanosec, int round_mode); -/* internal routines */ -static void WriteTrimDAC(struct comedi_device *dev, uint8_t LogicalChan, - uint8_t DacData); -static void SetDAC(struct comedi_device *dev, uint16_t chan, short dacdata); -static void SendDAC(struct comedi_device *dev, uint32_t val); - /* COUNTER OBJECT ------------------------------------------------ */ struct enc_private { /* Pointers to functions that differ for A and B counters: */ @@ -552,6 +546,246 @@ static uint8_t I2Cread(struct comedi_device *dev, uint8_t addr) return rtnval; } +/* *********** DAC FUNCTIONS *********** */ + +/* Slot 0 base settings. */ +#define VECT0 (XSD2 | RSD3 | SIB_A2) +/* Slot 0 always shifts in 0xFF and store it to FB_BUFFER2. */ + +/* TrimDac LogicalChan-to-PhysicalChan mapping table. */ +static uint8_t trimchan[] = { 10, 9, 8, 3, 2, 7, 6, 1, 0, 5, 4 }; + +/* TrimDac LogicalChan-to-EepromAdrs mapping table. */ +static uint8_t trimadrs[] = { 0x40, 0x41, 0x42, 0x50, 0x51, 0x52, 0x53, 0x60, 0x61, 0x62, 0x63 }; + +/* Private helper function: Transmit serial data to DAC via Audio + * channel 2. Assumes: (1) TSL2 slot records initialized, and (2) + * Dacpol contains valid target image. + */ +static void SendDAC(struct comedi_device *dev, uint32_t val) +{ + + /* START THE SERIAL CLOCK RUNNING ------------- */ + + /* Assert DAC polarity control and enable gating of DAC serial clock + * and audio bit stream signals. At this point in time we must be + * assured of being in time slot 0. If we are not in slot 0, the + * serial clock and audio stream signals will be disabled; this is + * because the following DEBIwrite statement (which enables signals + * to be passed through the gate array) would execute before the + * trailing edge of WS1/WS3 (which turns off the signals), thus + * causing the signals to be inactive during the DAC write. + */ + DEBIwrite(dev, LP_DACPOL, devpriv->Dacpol); + + /* TRANSFER OUTPUT DWORD VALUE INTO A2'S OUTPUT FIFO ---------------- */ + + /* Copy DAC setpoint value to DAC's output DMA buffer. */ + + /* WR7146( (uint32_t)devpriv->pDacWBuf, val ); */ + *devpriv->pDacWBuf = val; + + /* enab the output DMA transfer. This will cause the DMAC to copy + * the DAC's data value to A2's output FIFO. The DMA transfer will + * then immediately terminate because the protection address is + * reached upon transfer of the first DWORD value. + */ + MC_ENABLE(P_MC1, MC1_A2OUT); + + /* While the DMA transfer is executing ... */ + + /* Reset Audio2 output FIFO's underflow flag (along with any other + * FIFO underflow/overflow flags). When set, this flag will + * indicate that we have emerged from slot 0. + */ + WR7146(P_ISR, ISR_AFOU); + + /* Wait for the DMA transfer to finish so that there will be data + * available in the FIFO when time slot 1 tries to transfer a DWORD + * from the FIFO to the output buffer register. We test for DMA + * Done by polling the DMAC enable flag; this flag is automatically + * cleared when the transfer has finished. + */ + while ((RR7146(P_MC1) & MC1_A2OUT) != 0) + ; + + /* START THE OUTPUT STREAM TO THE TARGET DAC -------------------- */ + + /* FIFO data is now available, so we enable execution of time slots + * 1 and higher by clearing the EOS flag in slot 0. Note that SD3 + * will be shifted in and stored in FB_BUFFER2 for end-of-slot-list + * detection. + */ + SETVECT(0, XSD2 | RSD3 | SIB_A2); + + /* Wait for slot 1 to execute to ensure that the Packet will be + * transmitted. This is detected by polling the Audio2 output FIFO + * underflow flag, which will be set when slot 1 execution has + * finished transferring the DAC's data DWORD from the output FIFO + * to the output buffer register. + */ + while ((RR7146(P_SSR) & SSR_AF2_OUT) == 0) + ; + + /* Set up to trap execution at slot 0 when the TSL sequencer cycles + * back to slot 0 after executing the EOS in slot 5. Also, + * simultaneously shift out and in the 0x00 that is ALWAYS the value + * stored in the last byte to be shifted out of the FIFO's DWORD + * buffer register. + */ + SETVECT(0, XSD2 | XFIFO_2 | RSD2 | SIB_A2 | EOS); + + /* WAIT FOR THE TRANSACTION TO FINISH ----------------------- */ + + /* Wait for the TSL to finish executing all time slots before + * exiting this function. We must do this so that the next DAC + * write doesn't start, thereby enabling clock/chip select signals: + * + * 1. Before the TSL sequence cycles back to slot 0, which disables + * the clock/cs signal gating and traps slot // list execution. + * we have not yet finished slot 5 then the clock/cs signals are + * still gated and we have not finished transmitting the stream. + * + * 2. While slots 2-5 are executing due to a late slot 0 trap. In + * this case, the slot sequence is currently repeating, but with + * clock/cs signals disabled. We must wait for slot 0 to trap + * execution before setting up the next DAC setpoint DMA transfer + * and enabling the clock/cs signals. To detect the end of slot 5, + * we test for the FB_BUFFER2 MSB contents to be equal to 0xFF. If + * the TSL has not yet finished executing slot 5 ... + */ + if ((RR7146(P_FB_BUFFER2) & 0xFF000000) != 0) { + /* The trap was set on time and we are still executing somewhere + * in slots 2-5, so we now wait for slot 0 to execute and trap + * TSL execution. This is detected when FB_BUFFER2 MSB changes + * from 0xFF to 0x00, which slot 0 causes to happen by shifting + * out/in on SD2 the 0x00 that is always referenced by slot 5. + */ + while ((RR7146(P_FB_BUFFER2) & 0xFF000000) != 0) + ; + } + /* Either (1) we were too late setting the slot 0 trap; the TSL + * sequencer restarted slot 0 before we could set the EOS trap flag, + * or (2) we were not late and execution is now trapped at slot 0. + * In either case, we must now change slot 0 so that it will store + * value 0xFF (instead of 0x00) to FB_BUFFER2 next time it executes. + * In order to do this, we reprogram slot 0 so that it will shift in + * SD3, which is driven only by a pull-up resistor. + */ + SETVECT(0, RSD3 | SIB_A2 | EOS); + + /* Wait for slot 0 to execute, at which time the TSL is setup for + * the next DAC write. This is detected when FB_BUFFER2 MSB changes + * from 0x00 to 0xFF. + */ + while ((RR7146(P_FB_BUFFER2) & 0xFF000000) == 0) + ; +} + +/* Private helper function: Write setpoint to an application DAC channel. */ +static void SetDAC(struct comedi_device *dev, uint16_t chan, short dacdata) +{ + register uint16_t signmask; + register uint32_t WSImage; + + /* Adjust DAC data polarity and set up Polarity Control Register */ + /* image. */ + signmask = 1 << chan; + if (dacdata < 0) { + dacdata = -dacdata; + devpriv->Dacpol |= signmask; + } else + devpriv->Dacpol &= ~signmask; + + /* Limit DAC setpoint value to valid range. */ + if ((uint16_t) dacdata > 0x1FFF) + dacdata = 0x1FFF; + + /* Set up TSL2 records (aka "vectors") for DAC update. Vectors V2 + * and V3 transmit the setpoint to the target DAC. V4 and V5 send + * data to a non-existent TrimDac channel just to keep the clock + * running after sending data to the target DAC. This is necessary + * to eliminate the clock glitch that would otherwise occur at the + * end of the target DAC's serial data stream. When the sequence + * restarts at V0 (after executing V5), the gate array automatically + * disables gating for the DAC clock and all DAC chip selects. + */ + + WSImage = (chan & 2) ? WS1 : WS2; + /* Choose DAC chip select to be asserted. */ + SETVECT(2, XSD2 | XFIFO_1 | WSImage); + /* Slot 2: Transmit high data byte to target DAC. */ + SETVECT(3, XSD2 | XFIFO_0 | WSImage); + /* Slot 3: Transmit low data byte to target DAC. */ + SETVECT(4, XSD2 | XFIFO_3 | WS3); + /* Slot 4: Transmit to non-existent TrimDac channel to keep clock */ + SETVECT(5, XSD2 | XFIFO_2 | WS3 | EOS); + /* Slot 5: running after writing target DAC's low data byte. */ + + /* Construct and transmit target DAC's serial packet: + * ( A10D DDDD ),( DDDD DDDD ),( 0x0F ),( 0x00 ) where A is chan<0>, + * and D<12:0> is the DAC setpoint. Append a WORD value (that writes + * to a non-existent TrimDac channel) that serves to keep the clock + * running after the packet has been sent to the target DAC. + */ + SendDAC(dev, 0x0F000000 + /* Continue clock after target DAC data (write to non-existent trimdac). */ + | 0x00004000 + /* Address the two main dual-DAC devices (TSL's chip select enables + * target device). */ + | ((uint32_t) (chan & 1) << 15) + /* Address the DAC channel within the device. */ + | (uint32_t) dacdata); /* Include DAC setpoint data. */ + +} + +static void WriteTrimDAC(struct comedi_device *dev, uint8_t LogicalChan, + uint8_t DacData) +{ + uint32_t chan; + + /* Save the new setpoint in case the application needs to read it back later. */ + devpriv->TrimSetpoint[LogicalChan] = (uint8_t) DacData; + + /* Map logical channel number to physical channel number. */ + chan = (uint32_t) trimchan[LogicalChan]; + + /* Set up TSL2 records for TrimDac write operation. All slots shift + * 0xFF in from pulled-up SD3 so that the end of the slot sequence + * can be detected. + */ + + SETVECT(2, XSD2 | XFIFO_1 | WS3); + /* Slot 2: Send high uint8_t to target TrimDac. */ + SETVECT(3, XSD2 | XFIFO_0 | WS3); + /* Slot 3: Send low uint8_t to target TrimDac. */ + SETVECT(4, XSD2 | XFIFO_3 | WS1); + /* Slot 4: Send NOP high uint8_t to DAC0 to keep clock running. */ + SETVECT(5, XSD2 | XFIFO_2 | WS1 | EOS); + /* Slot 5: Send NOP low uint8_t to DAC0. */ + + /* Construct and transmit target DAC's serial packet: + * ( 0000 AAAA ), ( DDDD DDDD ),( 0x00 ),( 0x00 ) where A<3:0> is the + * DAC channel's address, and D<7:0> is the DAC setpoint. Append a + * WORD value (that writes a channel 0 NOP command to a non-existent + * main DAC channel) that serves to keep the clock running after the + * packet has been sent to the target DAC. + */ + + /* Address the DAC channel within the trimdac device. */ + SendDAC(dev, ((uint32_t) chan << 8) + | (uint32_t) DacData); /* Include DAC setpoint data. */ +} + +static void LoadTrimDACs(struct comedi_device *dev) +{ + register uint8_t i; + + /* Copy TrimDac setpoint values from EEPROM to TrimDacs. */ + for (i = 0; i < ARRAY_SIZE(trimchan); i++) + WriteTrimDAC(dev, i, I2Cread(dev, trimadrs[i])); +} + static unsigned int s626_ai_reg_to_uint(int data) { unsigned int tempdata; @@ -1938,248 +2172,6 @@ static void s626_timer_load(struct comedi_device *dev, struct enc_private *k, /* k->SetEnable(dev,k,(uint16_t)(enab != 0)); */ } -/* *********** DAC FUNCTIONS *********** */ - -/* Slot 0 base settings. */ -#define VECT0 (XSD2 | RSD3 | SIB_A2) -/* Slot 0 always shifts in 0xFF and store it to FB_BUFFER2. */ - -/* TrimDac LogicalChan-to-PhysicalChan mapping table. */ -static uint8_t trimchan[] = { 10, 9, 8, 3, 2, 7, 6, 1, 0, 5, 4 }; - -/* TrimDac LogicalChan-to-EepromAdrs mapping table. */ -static uint8_t trimadrs[] = { 0x40, 0x41, 0x42, 0x50, 0x51, 0x52, 0x53, 0x60, 0x61, 0x62, 0x63 }; - -static void LoadTrimDACs(struct comedi_device *dev) -{ - register uint8_t i; - - /* Copy TrimDac setpoint values from EEPROM to TrimDacs. */ - for (i = 0; i < ARRAY_SIZE(trimchan); i++) - WriteTrimDAC(dev, i, I2Cread(dev, trimadrs[i])); -} - -static void WriteTrimDAC(struct comedi_device *dev, uint8_t LogicalChan, - uint8_t DacData) -{ - uint32_t chan; - - /* Save the new setpoint in case the application needs to read it back later. */ - devpriv->TrimSetpoint[LogicalChan] = (uint8_t) DacData; - - /* Map logical channel number to physical channel number. */ - chan = (uint32_t) trimchan[LogicalChan]; - - /* Set up TSL2 records for TrimDac write operation. All slots shift - * 0xFF in from pulled-up SD3 so that the end of the slot sequence - * can be detected. - */ - - SETVECT(2, XSD2 | XFIFO_1 | WS3); - /* Slot 2: Send high uint8_t to target TrimDac. */ - SETVECT(3, XSD2 | XFIFO_0 | WS3); - /* Slot 3: Send low uint8_t to target TrimDac. */ - SETVECT(4, XSD2 | XFIFO_3 | WS1); - /* Slot 4: Send NOP high uint8_t to DAC0 to keep clock running. */ - SETVECT(5, XSD2 | XFIFO_2 | WS1 | EOS); - /* Slot 5: Send NOP low uint8_t to DAC0. */ - - /* Construct and transmit target DAC's serial packet: - * ( 0000 AAAA ), ( DDDD DDDD ),( 0x00 ),( 0x00 ) where A<3:0> is the - * DAC channel's address, and D<7:0> is the DAC setpoint. Append a - * WORD value (that writes a channel 0 NOP command to a non-existent - * main DAC channel) that serves to keep the clock running after the - * packet has been sent to the target DAC. - */ - - /* Address the DAC channel within the trimdac device. */ - SendDAC(dev, ((uint32_t) chan << 8) - | (uint32_t) DacData); /* Include DAC setpoint data. */ -} - -/* Private helper function: Write setpoint to an application DAC channel. */ - -static void SetDAC(struct comedi_device *dev, uint16_t chan, short dacdata) -{ - register uint16_t signmask; - register uint32_t WSImage; - - /* Adjust DAC data polarity and set up Polarity Control Register */ - /* image. */ - signmask = 1 << chan; - if (dacdata < 0) { - dacdata = -dacdata; - devpriv->Dacpol |= signmask; - } else - devpriv->Dacpol &= ~signmask; - - /* Limit DAC setpoint value to valid range. */ - if ((uint16_t) dacdata > 0x1FFF) - dacdata = 0x1FFF; - - /* Set up TSL2 records (aka "vectors") for DAC update. Vectors V2 - * and V3 transmit the setpoint to the target DAC. V4 and V5 send - * data to a non-existent TrimDac channel just to keep the clock - * running after sending data to the target DAC. This is necessary - * to eliminate the clock glitch that would otherwise occur at the - * end of the target DAC's serial data stream. When the sequence - * restarts at V0 (after executing V5), the gate array automatically - * disables gating for the DAC clock and all DAC chip selects. - */ - - WSImage = (chan & 2) ? WS1 : WS2; - /* Choose DAC chip select to be asserted. */ - SETVECT(2, XSD2 | XFIFO_1 | WSImage); - /* Slot 2: Transmit high data byte to target DAC. */ - SETVECT(3, XSD2 | XFIFO_0 | WSImage); - /* Slot 3: Transmit low data byte to target DAC. */ - SETVECT(4, XSD2 | XFIFO_3 | WS3); - /* Slot 4: Transmit to non-existent TrimDac channel to keep clock */ - SETVECT(5, XSD2 | XFIFO_2 | WS3 | EOS); - /* Slot 5: running after writing target DAC's low data byte. */ - - /* Construct and transmit target DAC's serial packet: - * ( A10D DDDD ),( DDDD DDDD ),( 0x0F ),( 0x00 ) where A is chan<0>, - * and D<12:0> is the DAC setpoint. Append a WORD value (that writes - * to a non-existent TrimDac channel) that serves to keep the clock - * running after the packet has been sent to the target DAC. - */ - SendDAC(dev, 0x0F000000 - /* Continue clock after target DAC data (write to non-existent trimdac). */ - | 0x00004000 - /* Address the two main dual-DAC devices (TSL's chip select enables - * target device). */ - | ((uint32_t) (chan & 1) << 15) - /* Address the DAC channel within the device. */ - | (uint32_t) dacdata); /* Include DAC setpoint data. */ - -} - -/* Private helper function: Transmit serial data to DAC via Audio - * channel 2. Assumes: (1) TSL2 slot records initialized, and (2) - * Dacpol contains valid target image. - */ - -static void SendDAC(struct comedi_device *dev, uint32_t val) -{ - - /* START THE SERIAL CLOCK RUNNING ------------- */ - - /* Assert DAC polarity control and enable gating of DAC serial clock - * and audio bit stream signals. At this point in time we must be - * assured of being in time slot 0. If we are not in slot 0, the - * serial clock and audio stream signals will be disabled; this is - * because the following DEBIwrite statement (which enables signals - * to be passed through the gate array) would execute before the - * trailing edge of WS1/WS3 (which turns off the signals), thus - * causing the signals to be inactive during the DAC write. - */ - DEBIwrite(dev, LP_DACPOL, devpriv->Dacpol); - - /* TRANSFER OUTPUT DWORD VALUE INTO A2'S OUTPUT FIFO ---------------- */ - - /* Copy DAC setpoint value to DAC's output DMA buffer. */ - - /* WR7146( (uint32_t)devpriv->pDacWBuf, val ); */ - *devpriv->pDacWBuf = val; - - /* enab the output DMA transfer. This will cause the DMAC to copy - * the DAC's data value to A2's output FIFO. The DMA transfer will - * then immediately terminate because the protection address is - * reached upon transfer of the first DWORD value. - */ - MC_ENABLE(P_MC1, MC1_A2OUT); - - /* While the DMA transfer is executing ... */ - - /* Reset Audio2 output FIFO's underflow flag (along with any other - * FIFO underflow/overflow flags). When set, this flag will - * indicate that we have emerged from slot 0. - */ - WR7146(P_ISR, ISR_AFOU); - - /* Wait for the DMA transfer to finish so that there will be data - * available in the FIFO when time slot 1 tries to transfer a DWORD - * from the FIFO to the output buffer register. We test for DMA - * Done by polling the DMAC enable flag; this flag is automatically - * cleared when the transfer has finished. - */ - while ((RR7146(P_MC1) & MC1_A2OUT) != 0) - ; - - /* START THE OUTPUT STREAM TO THE TARGET DAC -------------------- */ - - /* FIFO data is now available, so we enable execution of time slots - * 1 and higher by clearing the EOS flag in slot 0. Note that SD3 - * will be shifted in and stored in FB_BUFFER2 for end-of-slot-list - * detection. - */ - SETVECT(0, XSD2 | RSD3 | SIB_A2); - - /* Wait for slot 1 to execute to ensure that the Packet will be - * transmitted. This is detected by polling the Audio2 output FIFO - * underflow flag, which will be set when slot 1 execution has - * finished transferring the DAC's data DWORD from the output FIFO - * to the output buffer register. - */ - while ((RR7146(P_SSR) & SSR_AF2_OUT) == 0) - ; - - /* Set up to trap execution at slot 0 when the TSL sequencer cycles - * back to slot 0 after executing the EOS in slot 5. Also, - * simultaneously shift out and in the 0x00 that is ALWAYS the value - * stored in the last byte to be shifted out of the FIFO's DWORD - * buffer register. - */ - SETVECT(0, XSD2 | XFIFO_2 | RSD2 | SIB_A2 | EOS); - - /* WAIT FOR THE TRANSACTION TO FINISH ----------------------- */ - - /* Wait for the TSL to finish executing all time slots before - * exiting this function. We must do this so that the next DAC - * write doesn't start, thereby enabling clock/chip select signals: - * - * 1. Before the TSL sequence cycles back to slot 0, which disables - * the clock/cs signal gating and traps slot // list execution. - * we have not yet finished slot 5 then the clock/cs signals are - * still gated and we have not finished transmitting the stream. - * - * 2. While slots 2-5 are executing due to a late slot 0 trap. In - * this case, the slot sequence is currently repeating, but with - * clock/cs signals disabled. We must wait for slot 0 to trap - * execution before setting up the next DAC setpoint DMA transfer - * and enabling the clock/cs signals. To detect the end of slot 5, - * we test for the FB_BUFFER2 MSB contents to be equal to 0xFF. If - * the TSL has not yet finished executing slot 5 ... - */ - if ((RR7146(P_FB_BUFFER2) & 0xFF000000) != 0) { - /* The trap was set on time and we are still executing somewhere - * in slots 2-5, so we now wait for slot 0 to execute and trap - * TSL execution. This is detected when FB_BUFFER2 MSB changes - * from 0xFF to 0x00, which slot 0 causes to happen by shifting - * out/in on SD2 the 0x00 that is always referenced by slot 5. - */ - while ((RR7146(P_FB_BUFFER2) & 0xFF000000) != 0) - ; - } - /* Either (1) we were too late setting the slot 0 trap; the TSL - * sequencer restarted slot 0 before we could set the EOS trap flag, - * or (2) we were not late and execution is now trapped at slot 0. - * In either case, we must now change slot 0 so that it will store - * value 0xFF (instead of 0x00) to FB_BUFFER2 next time it executes. - * In order to do this, we reprogram slot 0 so that it will shift in - * SD3, which is driven only by a pull-up resistor. - */ - SETVECT(0, RSD3 | SIB_A2 | EOS); - - /* Wait for slot 0 to execute, at which time the TSL is setup for - * the next DAC write. This is detected when FB_BUFFER2 MSB changes - * from 0x00 to 0xFF. - */ - while ((RR7146(P_FB_BUFFER2) & 0xFF000000) == 0) - ; -} - static void WriteMISC2(struct comedi_device *dev, uint16_t NewImage) { DEBIwrite(dev, LP_MISC1, MISC1_WENABLE); /* enab writes to */ -- cgit v0.10.2 From 6baffbc2a4a11d78325f338a5e4731207ab9ca7d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 20 Jun 2012 19:26:11 -0700 Subject: staging: comedi: s626: remove forward declarations 5 Move the irq set/reset/clear and ns_to_timer helper functions up to remove the need for the forward declarations. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 3cdb293..cc18bf0 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -207,12 +207,6 @@ static struct dio_private *dio_private_word[]={ #define devpriv ((struct s626_private *)dev->private) #define diopriv ((struct dio_private *)s->private) -static int s626_dio_set_irq(struct comedi_device *dev, unsigned int chan); -static int s626_dio_reset_irq(struct comedi_device *dev, unsigned int gruop, - unsigned int mask); -static int s626_dio_clear_irq(struct comedi_device *dev); -static int s626_ns_to_timer(int *nanosec, int round_mode); - /* COUNTER OBJECT ------------------------------------------------ */ struct enc_private { /* Pointers to functions that differ for A and B counters: */ @@ -803,6 +797,87 @@ static unsigned int s626_ai_reg_to_uint(int data) /* return 0; */ /* } */ +static int s626_dio_set_irq(struct comedi_device *dev, unsigned int chan) +{ + unsigned int group; + unsigned int bitmask; + unsigned int status; + + /* select dio bank */ + group = chan / 16; + bitmask = 1 << (chan - (16 * group)); + DEBUG("s626_dio_set_irq: enable interrupt on dio channel %d group %d\n", + chan - (16 * group), group); + + /* set channel to capture positive edge */ + status = DEBIread(dev, + ((struct dio_private *)(dev->subdevices + 2 + + group)->private)->RDEdgSel); + DEBIwrite(dev, + ((struct dio_private *)(dev->subdevices + 2 + + group)->private)->WREdgSel, + bitmask | status); + + /* enable interrupt on selected channel */ + status = DEBIread(dev, + ((struct dio_private *)(dev->subdevices + 2 + + group)->private)->RDIntSel); + DEBIwrite(dev, + ((struct dio_private *)(dev->subdevices + 2 + + group)->private)->WRIntSel, + bitmask | status); + + /* enable edge capture write command */ + DEBIwrite(dev, LP_MISC1, MISC1_EDCAP); + + /* enable edge capture on selected channel */ + status = DEBIread(dev, + ((struct dio_private *)(dev->subdevices + 2 + + group)->private)->RDCapSel); + DEBIwrite(dev, + ((struct dio_private *)(dev->subdevices + 2 + + group)->private)->WRCapSel, + bitmask | status); + + return 0; +} + +static int s626_dio_reset_irq(struct comedi_device *dev, unsigned int group, + unsigned int mask) +{ + DEBUG + ("s626_dio_reset_irq: disable interrupt on dio channel %d group %d\n", + mask, group); + + /* disable edge capture write command */ + DEBIwrite(dev, LP_MISC1, MISC1_NOEDCAP); + + /* enable edge capture on selected channel */ + DEBIwrite(dev, + ((struct dio_private *)(dev->subdevices + 2 + + group)->private)->WRCapSel, mask); + + return 0; +} + +static int s626_dio_clear_irq(struct comedi_device *dev) +{ + unsigned int group; + + /* disable edge capture write command */ + DEBIwrite(dev, LP_MISC1, MISC1_NOEDCAP); + + for (group = 0; group < S626_DIO_BANKS; group++) { + /* clear pending events and interrupt */ + DEBIwrite(dev, + ((struct dio_private *)(dev->subdevices + 2 + + group)->private)->WRCapSel, + 0xffff); + } + + return 0; +} + static irqreturn_t s626_irq_handler(int irq, void *d) { struct comedi_device *dev = d; @@ -1500,6 +1575,34 @@ static int s626_ai_inttrig(struct comedi_device *dev, return 1; } +/* This function doesn't require a particular form, this is just what + * happens to be used in some of the drivers. It should convert ns + * nanoseconds to a counter value suitable for programming the device. + * Also, it should adjust ns so that it cooresponds to the actual time + * that the device will use. */ +static int s626_ns_to_timer(int *nanosec, int round_mode) +{ + int divider, base; + + base = 500; /* 2MHz internal clock */ + + switch (round_mode) { + case TRIG_ROUND_NEAREST: + default: + divider = (*nanosec + base / 2) / base; + break; + case TRIG_ROUND_DOWN: + divider = (*nanosec) / base; + break; + case TRIG_ROUND_UP: + divider = (*nanosec + base - 1) / base; + break; + } + + *nanosec = base * divider; + return divider - 1; +} + /* TO COMPLETE */ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { @@ -1832,34 +1935,6 @@ static int s626_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) return 0; } -/* This function doesn't require a particular form, this is just what - * happens to be used in some of the drivers. It should convert ns - * nanoseconds to a counter value suitable for programming the device. - * Also, it should adjust ns so that it cooresponds to the actual time - * that the device will use. */ -static int s626_ns_to_timer(int *nanosec, int round_mode) -{ - int divider, base; - - base = 500; /* 2MHz internal clock */ - - switch (round_mode) { - case TRIG_ROUND_NEAREST: - default: - divider = (*nanosec + base / 2) / base; - break; - case TRIG_ROUND_DOWN: - divider = (*nanosec) / base; - break; - case TRIG_ROUND_UP: - divider = (*nanosec + base - 1) / base; - break; - } - - *nanosec = base * divider; - return divider - 1; -} - static int s626_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { @@ -1980,87 +2055,6 @@ static int s626_dio_insn_config(struct comedi_device *dev, return 1; } -static int s626_dio_set_irq(struct comedi_device *dev, unsigned int chan) -{ - unsigned int group; - unsigned int bitmask; - unsigned int status; - - /* select dio bank */ - group = chan / 16; - bitmask = 1 << (chan - (16 * group)); - DEBUG("s626_dio_set_irq: enable interrupt on dio channel %d group %d\n", - chan - (16 * group), group); - - /* set channel to capture positive edge */ - status = DEBIread(dev, - ((struct dio_private *)(dev->subdevices + 2 + - group)->private)->RDEdgSel); - DEBIwrite(dev, - ((struct dio_private *)(dev->subdevices + 2 + - group)->private)->WREdgSel, - bitmask | status); - - /* enable interrupt on selected channel */ - status = DEBIread(dev, - ((struct dio_private *)(dev->subdevices + 2 + - group)->private)->RDIntSel); - DEBIwrite(dev, - ((struct dio_private *)(dev->subdevices + 2 + - group)->private)->WRIntSel, - bitmask | status); - - /* enable edge capture write command */ - DEBIwrite(dev, LP_MISC1, MISC1_EDCAP); - - /* enable edge capture on selected channel */ - status = DEBIread(dev, - ((struct dio_private *)(dev->subdevices + 2 + - group)->private)->RDCapSel); - DEBIwrite(dev, - ((struct dio_private *)(dev->subdevices + 2 + - group)->private)->WRCapSel, - bitmask | status); - - return 0; -} - -static int s626_dio_reset_irq(struct comedi_device *dev, unsigned int group, - unsigned int mask) -{ - DEBUG - ("s626_dio_reset_irq: disable interrupt on dio channel %d group %d\n", - mask, group); - - /* disable edge capture write command */ - DEBIwrite(dev, LP_MISC1, MISC1_NOEDCAP); - - /* enable edge capture on selected channel */ - DEBIwrite(dev, - ((struct dio_private *)(dev->subdevices + 2 + - group)->private)->WRCapSel, mask); - - return 0; -} - -static int s626_dio_clear_irq(struct comedi_device *dev) -{ - unsigned int group; - - /* disable edge capture write command */ - DEBIwrite(dev, LP_MISC1, MISC1_NOEDCAP); - - for (group = 0; group < S626_DIO_BANKS; group++) { - /* clear pending events and interrupt */ - DEBIwrite(dev, - ((struct dio_private *)(dev->subdevices + 2 + - group)->private)->WRCapSel, - 0xffff); - } - - return 0; -} - /* Now this function initializes the value of the counter (data[0]) and set the subdevice. To complete with trigger and interrupt configuration */ -- cgit v0.10.2 From 878cf9547f7985dd260dec4a4247840ecb4ba225 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 20 Jun 2012 19:26:31 -0700 Subject: staging: comedi: s626: remove forward declarations 6 Move the enc_private_data definition down to remove the need for the forward declarations. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index cc18bf0..d7d72ac 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -233,36 +233,8 @@ struct enc_private { static void s626_timer_load(struct comedi_device *dev, struct enc_private *k, int tick); static uint32_t ReadLatch(struct comedi_device *dev, struct enc_private *k); -static void ResetCapFlags_A(struct comedi_device *dev, struct enc_private *k); -static void ResetCapFlags_B(struct comedi_device *dev, struct enc_private *k); -static uint16_t GetMode_A(struct comedi_device *dev, struct enc_private *k); -static uint16_t GetMode_B(struct comedi_device *dev, struct enc_private *k); -static void SetMode_A(struct comedi_device *dev, struct enc_private *k, - uint16_t Setup, uint16_t DisableIntSrc); -static void SetMode_B(struct comedi_device *dev, struct enc_private *k, - uint16_t Setup, uint16_t DisableIntSrc); -static void SetEnable_A(struct comedi_device *dev, struct enc_private *k, - uint16_t enab); -static void SetEnable_B(struct comedi_device *dev, struct enc_private *k, - uint16_t enab); -static uint16_t GetEnable_A(struct comedi_device *dev, struct enc_private *k); -static uint16_t GetEnable_B(struct comedi_device *dev, struct enc_private *k); static void SetLatchSource(struct comedi_device *dev, struct enc_private *k, uint16_t value); -static void SetLoadTrig_A(struct comedi_device *dev, struct enc_private *k, - uint16_t Trig); -static void SetLoadTrig_B(struct comedi_device *dev, struct enc_private *k, - uint16_t Trig); -static uint16_t GetLoadTrig_A(struct comedi_device *dev, struct enc_private *k); -static uint16_t GetLoadTrig_B(struct comedi_device *dev, struct enc_private *k); -static void SetIntSrc_B(struct comedi_device *dev, struct enc_private *k, - uint16_t IntSource); -static void SetIntSrc_A(struct comedi_device *dev, struct enc_private *k, - uint16_t IntSource); -static uint16_t GetIntSrc_A(struct comedi_device *dev, struct enc_private *k); -static uint16_t GetIntSrc_B(struct comedi_device *dev, struct enc_private *k); -static void PulseIndex_A(struct comedi_device *dev, struct enc_private *k); -static void PulseIndex_B(struct comedi_device *dev, struct enc_private *k); static void Preload(struct comedi_device *dev, struct enc_private *k, uint32_t value); @@ -276,106 +248,6 @@ static void Preload(struct comedi_device *dev, struct enc_private *k, /* Translation table to map IntSrc into equivalent RDMISC2 event flag bits. */ /* static const uint16_t EventBits[][4] = { EVBITS(0), EVBITS(1), EVBITS(2), EVBITS(3), EVBITS(4), EVBITS(5) }; */ -/* struct enc_private; */ -static struct enc_private enc_private_data[] = { - { - .GetEnable = GetEnable_A, - .GetIntSrc = GetIntSrc_A, - .GetLoadTrig = GetLoadTrig_A, - .GetMode = GetMode_A, - .PulseIndex = PulseIndex_A, - .SetEnable = SetEnable_A, - .SetIntSrc = SetIntSrc_A, - .SetLoadTrig = SetLoadTrig_A, - .SetMode = SetMode_A, - .ResetCapFlags = ResetCapFlags_A, - .MyCRA = LP_CR0A, - .MyCRB = LP_CR0B, - .MyLatchLsw = LP_CNTR0ALSW, - .MyEventBits = EVBITS(0), - }, - { - .GetEnable = GetEnable_A, - .GetIntSrc = GetIntSrc_A, - .GetLoadTrig = GetLoadTrig_A, - .GetMode = GetMode_A, - .PulseIndex = PulseIndex_A, - .SetEnable = SetEnable_A, - .SetIntSrc = SetIntSrc_A, - .SetLoadTrig = SetLoadTrig_A, - .SetMode = SetMode_A, - .ResetCapFlags = ResetCapFlags_A, - .MyCRA = LP_CR1A, - .MyCRB = LP_CR1B, - .MyLatchLsw = LP_CNTR1ALSW, - .MyEventBits = EVBITS(1), - }, - { - .GetEnable = GetEnable_A, - .GetIntSrc = GetIntSrc_A, - .GetLoadTrig = GetLoadTrig_A, - .GetMode = GetMode_A, - .PulseIndex = PulseIndex_A, - .SetEnable = SetEnable_A, - .SetIntSrc = SetIntSrc_A, - .SetLoadTrig = SetLoadTrig_A, - .SetMode = SetMode_A, - .ResetCapFlags = ResetCapFlags_A, - .MyCRA = LP_CR2A, - .MyCRB = LP_CR2B, - .MyLatchLsw = LP_CNTR2ALSW, - .MyEventBits = EVBITS(2), - }, - { - .GetEnable = GetEnable_B, - .GetIntSrc = GetIntSrc_B, - .GetLoadTrig = GetLoadTrig_B, - .GetMode = GetMode_B, - .PulseIndex = PulseIndex_B, - .SetEnable = SetEnable_B, - .SetIntSrc = SetIntSrc_B, - .SetLoadTrig = SetLoadTrig_B, - .SetMode = SetMode_B, - .ResetCapFlags = ResetCapFlags_B, - .MyCRA = LP_CR0A, - .MyCRB = LP_CR0B, - .MyLatchLsw = LP_CNTR0BLSW, - .MyEventBits = EVBITS(3), - }, - { - .GetEnable = GetEnable_B, - .GetIntSrc = GetIntSrc_B, - .GetLoadTrig = GetLoadTrig_B, - .GetMode = GetMode_B, - .PulseIndex = PulseIndex_B, - .SetEnable = SetEnable_B, - .SetIntSrc = SetIntSrc_B, - .SetLoadTrig = SetLoadTrig_B, - .SetMode = SetMode_B, - .ResetCapFlags = ResetCapFlags_B, - .MyCRA = LP_CR1A, - .MyCRB = LP_CR1B, - .MyLatchLsw = LP_CNTR1BLSW, - .MyEventBits = EVBITS(4), - }, - { - .GetEnable = GetEnable_B, - .GetIntSrc = GetIntSrc_B, - .GetLoadTrig = GetLoadTrig_B, - .GetMode = GetMode_B, - .PulseIndex = PulseIndex_B, - .SetEnable = SetEnable_B, - .SetIntSrc = SetIntSrc_B, - .SetLoadTrig = SetLoadTrig_B, - .SetMode = SetMode_B, - .ResetCapFlags = ResetCapFlags_B, - .MyCRA = LP_CR2A, - .MyCRB = LP_CR2B, - .MyLatchLsw = LP_CNTR2BLSW, - .MyEventBits = EVBITS(5), - }, -}; - /* enab/disable a function or test status bit(s) that are accessed */ /* through Main Control Registers 1 or 2. */ #define MC_ENABLE(REGADRS, CTRLWORD) writel(((uint32_t)(CTRLWORD) << 16) | (uint32_t)(CTRLWORD), devpriv->base_addr+(REGADRS)) @@ -2681,6 +2553,100 @@ static void Preload(struct comedi_device *dev, struct enc_private *k, (uint16_t) (value >> 16)); } +static struct enc_private enc_private_data[] = { + { + .GetEnable = GetEnable_A, + .GetIntSrc = GetIntSrc_A, + .GetLoadTrig = GetLoadTrig_A, + .GetMode = GetMode_A, + .PulseIndex = PulseIndex_A, + .SetEnable = SetEnable_A, + .SetIntSrc = SetIntSrc_A, + .SetLoadTrig = SetLoadTrig_A, + .SetMode = SetMode_A, + .ResetCapFlags = ResetCapFlags_A, + .MyCRA = LP_CR0A, + .MyCRB = LP_CR0B, + .MyLatchLsw = LP_CNTR0ALSW, + .MyEventBits = EVBITS(0), + }, { + .GetEnable = GetEnable_A, + .GetIntSrc = GetIntSrc_A, + .GetLoadTrig = GetLoadTrig_A, + .GetMode = GetMode_A, + .PulseIndex = PulseIndex_A, + .SetEnable = SetEnable_A, + .SetIntSrc = SetIntSrc_A, + .SetLoadTrig = SetLoadTrig_A, + .SetMode = SetMode_A, + .ResetCapFlags = ResetCapFlags_A, + .MyCRA = LP_CR1A, + .MyCRB = LP_CR1B, + .MyLatchLsw = LP_CNTR1ALSW, + .MyEventBits = EVBITS(1), + }, { + .GetEnable = GetEnable_A, + .GetIntSrc = GetIntSrc_A, + .GetLoadTrig = GetLoadTrig_A, + .GetMode = GetMode_A, + .PulseIndex = PulseIndex_A, + .SetEnable = SetEnable_A, + .SetIntSrc = SetIntSrc_A, + .SetLoadTrig = SetLoadTrig_A, + .SetMode = SetMode_A, + .ResetCapFlags = ResetCapFlags_A, + .MyCRA = LP_CR2A, + .MyCRB = LP_CR2B, + .MyLatchLsw = LP_CNTR2ALSW, + .MyEventBits = EVBITS(2), + }, { + .GetEnable = GetEnable_B, + .GetIntSrc = GetIntSrc_B, + .GetLoadTrig = GetLoadTrig_B, + .GetMode = GetMode_B, + .PulseIndex = PulseIndex_B, + .SetEnable = SetEnable_B, + .SetIntSrc = SetIntSrc_B, + .SetLoadTrig = SetLoadTrig_B, + .SetMode = SetMode_B, + .ResetCapFlags = ResetCapFlags_B, + .MyCRA = LP_CR0A, + .MyCRB = LP_CR0B, + .MyLatchLsw = LP_CNTR0BLSW, + .MyEventBits = EVBITS(3), + }, { + .GetEnable = GetEnable_B, + .GetIntSrc = GetIntSrc_B, + .GetLoadTrig = GetLoadTrig_B, + .GetMode = GetMode_B, + .PulseIndex = PulseIndex_B, + .SetEnable = SetEnable_B, + .SetIntSrc = SetIntSrc_B, + .SetLoadTrig = SetLoadTrig_B, + .SetMode = SetMode_B, + .ResetCapFlags = ResetCapFlags_B, + .MyCRA = LP_CR1A, + .MyCRB = LP_CR1B, + .MyLatchLsw = LP_CNTR1BLSW, + .MyEventBits = EVBITS(4), + }, { + .GetEnable = GetEnable_B, + .GetIntSrc = GetIntSrc_B, + .GetLoadTrig = GetLoadTrig_B, + .GetMode = GetMode_B, + .PulseIndex = PulseIndex_B, + .SetEnable = SetEnable_B, + .SetIntSrc = SetIntSrc_B, + .SetLoadTrig = SetLoadTrig_B, + .SetMode = SetMode_B, + .ResetCapFlags = ResetCapFlags_B, + .MyCRA = LP_CR2A, + .MyCRB = LP_CR2B, + .MyLatchLsw = LP_CNTR2BLSW, + .MyEventBits = EVBITS(5), + }, +}; + static void CountersInit(struct comedi_device *dev) { int chan; -- cgit v0.10.2 From e3eb08d0f91ff6afab323fa5e3342f3c4a3e4a73 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 20 Jun 2012 19:26:56 -0700 Subject: staging: comedi: s626: remove forward declarations 7 Move up the remaining functions needed to remove the forward declarations. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index d7d72ac..50656a7 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -230,16 +230,6 @@ struct enc_private { #define encpriv ((struct enc_private *)(dev->subdevices+5)->private) -static void s626_timer_load(struct comedi_device *dev, struct enc_private *k, - int tick); -static uint32_t ReadLatch(struct comedi_device *dev, struct enc_private *k); -static void SetLatchSource(struct comedi_device *dev, struct enc_private *k, - uint16_t value); -static void Preload(struct comedi_device *dev, struct enc_private *k, - uint32_t value); - -/* Counter objects constructor. */ - /* Counter overflow/index event flag masks for RDMISC2. */ #define INDXMASK(C) (1 << (((C) > 2) ? ((C) * 2 - 1) : ((C) * 2 + 4))) #define OVERMASK(C) (1 << (((C) > 2) ? ((C) * 2 + 5) : ((C) * 2 + 10))) @@ -652,6 +642,57 @@ static void LoadTrimDACs(struct comedi_device *dev) WriteTrimDAC(dev, i, I2Cread(dev, trimadrs[i])); } +/* ****** COUNTER FUNCTIONS ******* */ +/* All counter functions address a specific counter by means of the + * "Counter" argument, which is a logical counter number. The Counter + * argument may have any of the following legal values: 0=0A, 1=1A, + * 2=2A, 3=0B, 4=1B, 5=2B. + */ + +/* Read a counter's output latch. */ +static uint32_t ReadLatch(struct comedi_device *dev, struct enc_private *k) +{ + register uint32_t value; + /* DEBUG FIXME DEBUG("ReadLatch: Read Latch enter\n"); */ + + /* Latch counts and fetch LSW of latched counts value. */ + value = (uint32_t) DEBIread(dev, k->MyLatchLsw); + + /* Fetch MSW of latched counts and combine with LSW. */ + value |= ((uint32_t) DEBIread(dev, k->MyLatchLsw + 2) << 16); + + /* DEBUG FIXME DEBUG("ReadLatch: Read Latch exit\n"); */ + + /* Return latched counts. */ + return value; +} + +/* Return/set a counter pair's latch trigger source. 0: On read + * access, 1: A index latches A, 2: B index latches B, 3: A overflow + * latches B. + */ +static void SetLatchSource(struct comedi_device *dev, struct enc_private *k, + uint16_t value) +{ + DEBUG("SetLatchSource: SetLatchSource enter 3550\n"); + DEBIreplace(dev, k->MyCRB, + (uint16_t) (~(CRBMSK_INTCTRL | CRBMSK_LATCHSRC)), + (uint16_t) (value << CRBBIT_LATCHSRC)); + + DEBUG("SetLatchSource: SetLatchSource exit\n"); +} + +/* Write value into counter preload register. */ +static void Preload(struct comedi_device *dev, struct enc_private *k, + uint32_t value) +{ + DEBUG("Preload: preload enter\n"); + DEBIwrite(dev, (uint16_t) (k->MyLatchLsw), (uint16_t) value); /* Write value to preload register. */ + DEBUG("Preload: preload step 1\n"); + DEBIwrite(dev, (uint16_t) (k->MyLatchLsw + 2), + (uint16_t) (value >> 16)); +} + static unsigned int s626_ai_reg_to_uint(int data) { unsigned int tempdata; @@ -1475,6 +1516,40 @@ static int s626_ns_to_timer(int *nanosec, int round_mode) return divider - 1; } +static void s626_timer_load(struct comedi_device *dev, struct enc_private *k, + int tick) +{ + uint16_t Setup = (LOADSRC_INDX << BF_LOADSRC) | /* Preload upon */ + /* index. */ + (INDXSRC_SOFT << BF_INDXSRC) | /* Disable hardware index. */ + (CLKSRC_TIMER << BF_CLKSRC) | /* Operating mode is Timer. */ + (CLKPOL_POS << BF_CLKPOL) | /* Active high clock. */ + (CNTDIR_DOWN << BF_CLKPOL) | /* Count direction is Down. */ + (CLKMULT_1X << BF_CLKMULT) | /* Clock multiplier is 1x. */ + (CLKENAB_INDEX << BF_CLKENAB); + uint16_t valueSrclatch = LATCHSRC_A_INDXA; + /* uint16_t enab=CLKENAB_ALWAYS; */ + + k->SetMode(dev, k, Setup, FALSE); + + /* Set the preload register */ + Preload(dev, k, tick); + + /* Software index pulse forces the preload register to load */ + /* into the counter */ + k->SetLoadTrig(dev, k, 0); + k->PulseIndex(dev, k); + + /* set reload on counter overflow */ + k->SetLoadTrig(dev, k, 1); + + /* set interrupt on overflow */ + k->SetIntSrc(dev, k, INTSRC_OVER); + + SetLatchSource(dev, k, valueSrclatch); + /* k->SetEnable(dev,k,(uint16_t)(enab != 0)); */ +} + /* TO COMPLETE */ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { @@ -2004,40 +2079,6 @@ static int s626_enc_insn_write(struct comedi_device *dev, return 1; } -static void s626_timer_load(struct comedi_device *dev, struct enc_private *k, - int tick) -{ - uint16_t Setup = (LOADSRC_INDX << BF_LOADSRC) | /* Preload upon */ - /* index. */ - (INDXSRC_SOFT << BF_INDXSRC) | /* Disable hardware index. */ - (CLKSRC_TIMER << BF_CLKSRC) | /* Operating mode is Timer. */ - (CLKPOL_POS << BF_CLKPOL) | /* Active high clock. */ - (CNTDIR_DOWN << BF_CLKPOL) | /* Count direction is Down. */ - (CLKMULT_1X << BF_CLKMULT) | /* Clock multiplier is 1x. */ - (CLKENAB_INDEX << BF_CLKENAB); - uint16_t valueSrclatch = LATCHSRC_A_INDXA; - /* uint16_t enab=CLKENAB_ALWAYS; */ - - k->SetMode(dev, k, Setup, FALSE); - - /* Set the preload register */ - Preload(dev, k, tick); - - /* Software index pulse forces the preload register to load */ - /* into the counter */ - k->SetLoadTrig(dev, k, 0); - k->PulseIndex(dev, k); - - /* set reload on counter overflow */ - k->SetLoadTrig(dev, k, 1); - - /* set interrupt on overflow */ - k->SetIntSrc(dev, k, INTSRC_OVER); - - SetLatchSource(dev, k, valueSrclatch); - /* k->SetEnable(dev,k,(uint16_t)(enab != 0)); */ -} - static void WriteMISC2(struct comedi_device *dev, uint16_t NewImage) { DEBIwrite(dev, LP_MISC1, MISC1_WENABLE); /* enab writes to */ @@ -2069,36 +2110,8 @@ static void CloseDMAB(struct comedi_device *dev, struct bufferDMA *pdma, } } -/* ****** COUNTER FUNCTIONS ******* */ -/* All counter functions address a specific counter by means of the - * "Counter" argument, which is a logical counter number. The Counter - * argument may have any of the following legal values: 0=0A, 1=1A, - * 2=2A, 3=0B, 4=1B, 5=2B. - */ - -/* Forward declarations for functions that are common to both A and B counters: */ - /* ****** PRIVATE COUNTER FUNCTIONS ****** */ -/* Read a counter's output latch. */ - -static uint32_t ReadLatch(struct comedi_device *dev, struct enc_private *k) -{ - register uint32_t value; - /* DEBUG FIXME DEBUG("ReadLatch: Read Latch enter\n"); */ - - /* Latch counts and fetch LSW of latched counts value. */ - value = (uint32_t) DEBIread(dev, k->MyLatchLsw); - - /* Fetch MSW of latched counts and combine with LSW. */ - value |= ((uint32_t) DEBIread(dev, k->MyLatchLsw + 2) << 16); - - /* DEBUG FIXME DEBUG("ReadLatch: Read Latch exit\n"); */ - - /* Return latched counts. */ - return value; -} - /* Reset a counter's index and overflow event capture flags. */ static void ResetCapFlags_A(struct comedi_device *dev, struct enc_private *k) @@ -2348,22 +2361,6 @@ static uint16_t GetEnable_B(struct comedi_device *dev, struct enc_private *k) return (DEBIread(dev, k->MyCRB) >> CRBBIT_CLKENAB_B) & 1; } -/* Return/set a counter pair's latch trigger source. 0: On read - * access, 1: A index latches A, 2: B index latches B, 3: A overflow - * latches B. - */ - -static void SetLatchSource(struct comedi_device *dev, struct enc_private *k, - uint16_t value) -{ - DEBUG("SetLatchSource: SetLatchSource enter 3550\n"); - DEBIreplace(dev, k->MyCRB, - (uint16_t) (~(CRBMSK_INTCTRL | CRBMSK_LATCHSRC)), - (uint16_t) (value << CRBBIT_LATCHSRC)); - - DEBUG("SetLatchSource: SetLatchSource exit\n"); -} - /* * static uint16_t GetLatchSource(struct comedi_device *dev, struct enc_private *k ) * { @@ -2541,18 +2538,6 @@ static void PulseIndex_B(struct comedi_device *dev, struct enc_private *k) DEBIwrite(dev, k->MyCRB, crb); } -/* Write value into counter preload register. */ - -static void Preload(struct comedi_device *dev, struct enc_private *k, - uint32_t value) -{ - DEBUG("Preload: preload enter\n"); - DEBIwrite(dev, (uint16_t) (k->MyLatchLsw), (uint16_t) value); /* Write value to preload register. */ - DEBUG("Preload: preload step 1\n"); - DEBIwrite(dev, (uint16_t) (k->MyLatchLsw + 2), - (uint16_t) (value >> 16)); -} - static struct enc_private enc_private_data[] = { { .GetEnable = GetEnable_A, -- cgit v0.10.2 From bdf5aa39f7a42fc49903d456baaba11efc4d4243 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 20 Jun 2012 19:27:25 -0700 Subject: staging: comedi: s626: remove private DEBUG macro The private DEBUG macro defined in this driver outputs a lot of function tracing noise. This information might be useful when first developing the driver but should not be in the mainlined code. If any of this is needed in the future it should be added back using the proper dev_printk interface. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 50656a7..779ae7a 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -376,7 +376,6 @@ static uint8_t I2Cread(struct comedi_device *dev, uint8_t addr) /* Byte1 = EEPROM internal target address. */ | I2C_B0(I2C_ATTRNOP, 0))) { /* Byte0 = Not sent. */ /* Abort function and declare error if handshake failed. */ - DEBUG("I2Cread: error handshake I2Cread a\n"); return 0; } /* Execute EEPROM read. */ @@ -394,7 +393,6 @@ static uint8_t I2Cread(struct comedi_device *dev, uint8_t addr) |I2C_B0(I2C_ATTRNOP, 0))) { /* Byte0 = Not sent. */ /* Abort function and declare error if handshake failed. */ - DEBUG("I2Cread: error handshake I2Cread b\n"); return 0; } /* Return copy of EEPROM value. */ @@ -653,7 +651,6 @@ static void LoadTrimDACs(struct comedi_device *dev) static uint32_t ReadLatch(struct comedi_device *dev, struct enc_private *k) { register uint32_t value; - /* DEBUG FIXME DEBUG("ReadLatch: Read Latch enter\n"); */ /* Latch counts and fetch LSW of latched counts value. */ value = (uint32_t) DEBIread(dev, k->MyLatchLsw); @@ -661,8 +658,6 @@ static uint32_t ReadLatch(struct comedi_device *dev, struct enc_private *k) /* Fetch MSW of latched counts and combine with LSW. */ value |= ((uint32_t) DEBIread(dev, k->MyLatchLsw + 2) << 16); - /* DEBUG FIXME DEBUG("ReadLatch: Read Latch exit\n"); */ - /* Return latched counts. */ return value; } @@ -674,21 +669,16 @@ static uint32_t ReadLatch(struct comedi_device *dev, struct enc_private *k) static void SetLatchSource(struct comedi_device *dev, struct enc_private *k, uint16_t value) { - DEBUG("SetLatchSource: SetLatchSource enter 3550\n"); DEBIreplace(dev, k->MyCRB, (uint16_t) (~(CRBMSK_INTCTRL | CRBMSK_LATCHSRC)), (uint16_t) (value << CRBBIT_LATCHSRC)); - - DEBUG("SetLatchSource: SetLatchSource exit\n"); } /* Write value into counter preload register. */ static void Preload(struct comedi_device *dev, struct enc_private *k, uint32_t value) { - DEBUG("Preload: preload enter\n"); - DEBIwrite(dev, (uint16_t) (k->MyLatchLsw), (uint16_t) value); /* Write value to preload register. */ - DEBUG("Preload: preload step 1\n"); + DEBIwrite(dev, (uint16_t) (k->MyLatchLsw), (uint16_t) value); DEBIwrite(dev, (uint16_t) (k->MyLatchLsw + 2), (uint16_t) (value >> 16)); } @@ -719,8 +709,6 @@ static int s626_dio_set_irq(struct comedi_device *dev, unsigned int chan) /* select dio bank */ group = chan / 16; bitmask = 1 << (chan - (16 * group)); - DEBUG("s626_dio_set_irq: enable interrupt on dio channel %d group %d\n", - chan - (16 * group), group); /* set channel to capture positive edge */ status = DEBIread(dev, @@ -758,10 +746,6 @@ static int s626_dio_set_irq(struct comedi_device *dev, unsigned int chan) static int s626_dio_reset_irq(struct comedi_device *dev, unsigned int group, unsigned int mask) { - DEBUG - ("s626_dio_reset_irq: disable interrupt on dio channel %d group %d\n", - mask, group); - /* disable edge capture write command */ DEBIwrite(dev, LP_MISC1, MISC1_NOEDCAP); @@ -805,8 +789,6 @@ static irqreturn_t s626_irq_handler(int irq, void *d) uint8_t group; uint16_t irqbit; - DEBUG("s626_irq_handler: interrupt request received!!!\n"); - if (dev->attached == 0) return IRQ_NONE; /* lock to avoid race with comedi_poll */ @@ -824,14 +806,8 @@ static irqreturn_t s626_irq_handler(int irq, void *d) /* clear interrupt */ writel(irqtype, devpriv->base_addr + P_ISR); - /* do somethings */ - DEBUG("s626_irq_handler: interrupt type %d\n", irqtype); - switch (irqtype) { case IRQ_RPS1: /* end_of_scan occurs */ - - DEBUG("s626_irq_handler: RPS1 irq detected\n"); - /* manage ai subdevice */ s = dev->subdevices; cmd = &(s->async->cmd); @@ -854,9 +830,6 @@ static irqreturn_t s626_irq_handler(int irq, void *d) if (cfc_write_to_buffer(s, tempdata) == 0) printk ("s626_irq_handler: cfc_write_to_buffer error!\n"); - - DEBUG("s626_irq_handler: ai channel %d acquired: %d\n", - i, tempdata); } /* end of scan occurs */ @@ -877,23 +850,12 @@ static irqreturn_t s626_irq_handler(int irq, void *d) irqstatus = 0; } - if (devpriv->ai_cmd_running && cmd->scan_begin_src == TRIG_EXT) { - DEBUG - ("s626_irq_handler: enable interrupt on dio channel %d\n", - cmd->scan_begin_arg); - + if (devpriv->ai_cmd_running && cmd->scan_begin_src == TRIG_EXT) s626_dio_set_irq(dev, cmd->scan_begin_arg); - - DEBUG("s626_irq_handler: External trigger is set!!!\n"); - } /* tell comedi that data is there */ - DEBUG("s626_irq_handler: events %d\n", s->async->events); comedi_event(dev, s); break; case IRQ_GPIO3: /* check dio and conter interrupt */ - - DEBUG("s626_irq_handler: GPIO3 irq detected\n"); - /* manage ai subdevice */ s = dev->subdevices; cmd = &(s->async->cmd); @@ -913,36 +875,18 @@ static irqreturn_t s626_irq_handler(int irq, void *d) /* check if interrupt is generated from dio channels */ if (irqbit) { s626_dio_reset_irq(dev, group, irqbit); - DEBUG - ("s626_irq_handler: check interrupt on dio group %d %d\n", - group, i); if (devpriv->ai_cmd_running) { /* check if interrupt is an ai acquisition start trigger */ if ((irqbit >> (cmd->start_arg - (16 * group))) == 1 && cmd->start_src == TRIG_EXT) { - DEBUG - ("s626_irq_handler: Edge capture interrupt received from channel %d\n", - cmd->start_arg); - /* Start executing the RPS program. */ MC_ENABLE(P_MC1, MC1_ERPS1); - DEBUG - ("s626_irq_handler: acquisition start triggered!!!\n"); - if (cmd->scan_begin_src == TRIG_EXT) { - DEBUG - ("s626_ai_cmd: enable interrupt on dio channel %d\n", - cmd-> - scan_begin_arg); - s626_dio_set_irq(dev, cmd->scan_begin_arg); - - DEBUG - ("s626_irq_handler: External scan trigger is set!!!\n"); } } if ((irqbit >> (cmd->scan_begin_arg - @@ -950,33 +894,16 @@ static irqreturn_t s626_irq_handler(int irq, void *d) == 1 && cmd->scan_begin_src == TRIG_EXT) { - DEBUG - ("s626_irq_handler: Edge capture interrupt received from channel %d\n", - cmd->scan_begin_arg); - /* Trigger ADC scan loop start by setting RPS Signal 0. */ MC_ENABLE(P_MC2, MC2_ADC_RPS); - DEBUG - ("s626_irq_handler: scan triggered!!! %d\n", - devpriv->ai_sample_count); if (cmd->convert_src == TRIG_EXT) { - - DEBUG - ("s626_ai_cmd: enable interrupt on dio channel %d group %d\n", - cmd->convert_arg - - (16 * group), - group); - devpriv->ai_convert_count = cmd->chanlist_len; s626_dio_set_irq(dev, cmd->convert_arg); - - DEBUG - ("s626_irq_handler: External convert trigger is set!!!\n"); } if (cmd->convert_src == @@ -992,32 +919,15 @@ static irqreturn_t s626_irq_handler(int irq, void *d) (16 * group))) == 1 && cmd->convert_src == TRIG_EXT) { - DEBUG - ("s626_irq_handler: Edge capture interrupt received from channel %d\n", - cmd->convert_arg); - /* Trigger ADC scan loop start by setting RPS Signal 0. */ MC_ENABLE(P_MC2, MC2_ADC_RPS); - DEBUG - ("s626_irq_handler: adc convert triggered!!!\n"); - devpriv->ai_convert_count--; if (devpriv->ai_convert_count > 0) { - - DEBUG - ("s626_ai_cmd: enable interrupt on dio channel %d group %d\n", - cmd->convert_arg - - (16 * group), - group); - s626_dio_set_irq(dev, cmd->convert_arg); - - DEBUG - ("s626_irq_handler: External trigger is set!!!\n"); } } } @@ -1029,44 +939,31 @@ static irqreturn_t s626_irq_handler(int irq, void *d) irqbit = DEBIread(dev, LP_RDMISC2); /* check interrupt on counters */ - DEBUG("s626_irq_handler: check counters interrupt %d\n", - irqbit); - if (irqbit & IRQ_COINT1A) { - DEBUG - ("s626_irq_handler: interrupt on counter 1A overflow\n"); k = &encpriv[0]; /* clear interrupt capture flag */ k->ResetCapFlags(dev, k); } if (irqbit & IRQ_COINT2A) { - DEBUG - ("s626_irq_handler: interrupt on counter 2A overflow\n"); k = &encpriv[1]; /* clear interrupt capture flag */ k->ResetCapFlags(dev, k); } if (irqbit & IRQ_COINT3A) { - DEBUG - ("s626_irq_handler: interrupt on counter 3A overflow\n"); k = &encpriv[2]; /* clear interrupt capture flag */ k->ResetCapFlags(dev, k); } if (irqbit & IRQ_COINT1B) { - DEBUG - ("s626_irq_handler: interrupt on counter 1B overflow\n"); k = &encpriv[3]; /* clear interrupt capture flag */ k->ResetCapFlags(dev, k); } if (irqbit & IRQ_COINT2B) { - DEBUG - ("s626_irq_handler: interrupt on counter 2B overflow\n"); k = &encpriv[4]; /* clear interrupt capture flag */ @@ -1078,34 +975,23 @@ static irqreturn_t s626_irq_handler(int irq, void *d) k->SetEnable(dev, k, CLKENAB_INDEX); if (cmd->convert_src == TRIG_TIMER) { - DEBUG - ("s626_irq_handler: conver timer trigger!!! %d\n", - devpriv->ai_convert_count); - /* Trigger ADC scan loop start by setting RPS Signal 0. */ MC_ENABLE(P_MC2, MC2_ADC_RPS); } } } if (irqbit & IRQ_COINT3B) { - DEBUG - ("s626_irq_handler: interrupt on counter 3B overflow\n"); k = &encpriv[5]; /* clear interrupt capture flag */ k->ResetCapFlags(dev, k); if (cmd->scan_begin_src == TRIG_TIMER) { - DEBUG - ("s626_irq_handler: scan timer trigger!!!\n"); - /* Trigger ADC scan loop start by setting RPS Signal 0. */ MC_ENABLE(P_MC2, MC2_ADC_RPS); } if (cmd->convert_src == TRIG_TIMER) { - DEBUG - ("s626_irq_handler: convert timer trigger is set\n"); k = &encpriv[4]; devpriv->ai_convert_count = cmd->chanlist_len; k->SetEnable(dev, k, CLKENAB_ALWAYS); @@ -1116,8 +1002,6 @@ static irqreturn_t s626_irq_handler(int irq, void *d) /* enable interrupt */ writel(irqstatus, devpriv->base_addr + P_IER); - DEBUG("s626_irq_handler: exit interrupt service routine.\n"); - spin_unlock_irqrestore(&dev->spinlock, flags); return IRQ_HANDLED; } @@ -1146,7 +1030,6 @@ static void ResetADC(struct comedi_device *dev, uint8_t *ppl) /* Construct RPS program in RPSBuf DMA buffer */ if (cmd != NULL && cmd->scan_begin_src != TRIG_FOLLOW) { - DEBUG("ResetADC: scan_begin pause inserted\n"); /* Wait for Start trigger. */ *pRPS++ = RPS_PAUSE | RPS_SIGADC; *pRPS++ = RPS_CLRSIGNAL | RPS_SIGADC; @@ -1236,7 +1119,6 @@ static void ResetADC(struct comedi_device *dev, uint8_t *ppl) } if (cmd != NULL && cmd->convert_src != TRIG_NOW) { - DEBUG("ResetADC: convert pause inserted\n"); /* Wait for Start trigger. */ *pRPS++ = RPS_PAUSE | RPS_SIGADC; *pRPS++ = RPS_CLRSIGNAL | RPS_SIGADC; @@ -1268,7 +1150,6 @@ static void ResetADC(struct comedi_device *dev, uint8_t *ppl) break; /* Exit poll list processing loop. */ } } - DEBUG("ResetADC: ADC items %d\n", devpriv->AdcItems); /* VERSION 2.01 CHANGE: DELAY CHANGED FROM 250NS to 2US. Allow the * ADC to stabilize for 2 microseconds before starting the final @@ -1305,7 +1186,6 @@ static void ResetADC(struct comedi_device *dev, uint8_t *ppl) /* invoke interrupt */ if (devpriv->ai_cmd_running == 1) { - DEBUG("ResetADC: insert irq in ADC RPS task\n"); *pRPS++ = RPS_IRQ; } /* Restart RPS program at its beginning. */ @@ -1329,8 +1209,6 @@ static int s626_ai_insn_config(struct comedi_device *dev, /* register uint8_t i; */ /* register int32_t *readaddr; */ -/* DEBUG("as626_ai_rinsn: ai_rinsn enter\n"); */ - /* Trigger ADC scan loop start by setting RPS Signal 0. */ /* MC_ENABLE( P_MC2, MC2_ADC_RPS ); */ @@ -1346,11 +1224,9 @@ static int s626_ai_insn_config(struct comedi_device *dev, /* Convert ADC data to 16-bit integer values and copy to application buffer. */ /* for ( i = 0; i < devpriv->AdcItems; i++ ) { */ /* *data = s626_ai_reg_to_uint( *readaddr++ ); */ -/* DEBUG("s626_ai_rinsn: data %d\n",*data); */ /* data++; */ /* } */ -/* DEBUG("s626_ai_rinsn: ai_rinsn escape\n"); */ /* return i; */ /* } */ @@ -1370,8 +1246,6 @@ static int s626_ai_insn_read(struct comedi_device *dev, * corresponding interrupt to be generated if enabled */ - DEBUG("s626_ai_insn_read: entering\n"); - /* Convert application's ADC specification into form * appropriate for register programming. */ @@ -1448,8 +1322,6 @@ static int s626_ai_insn_read(struct comedi_device *dev, if (n != 0) data[n - 1] = s626_ai_reg_to_uint(RR7146(P_FB_BUFFER1)); - DEBUG("s626_ai_insn_read: samples %d, data %d\n", n, data[n - 1]); - return n; } @@ -1476,15 +1348,11 @@ static int s626_ai_inttrig(struct comedi_device *dev, if (trignum != 0) return -EINVAL; - DEBUG("s626_ai_inttrig: trigger adc start..."); - /* Start executing the RPS program. */ MC_ENABLE(P_MC1, MC1_ERPS1); s->async->inttrig = NULL; - DEBUG(" done\n"); - return 1; } @@ -1559,8 +1427,6 @@ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) struct enc_private *k; int tick; - DEBUG("s626_ai_cmd: entering command function\n"); - if (devpriv->ai_cmd_running) { printk(KERN_ERR "s626_ai_cmd: Another ai_cmd is running %d\n", dev->minor); @@ -1580,12 +1446,8 @@ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ai_cmd_running = 0; /* test if cmd is valid */ - if (cmd == NULL) { - DEBUG("s626_ai_cmd: NULL command\n"); + if (cmd == NULL) return -EINVAL; - } else { - DEBUG("s626_ai_cmd: command received!!!\n"); - } if (dev->irq == 0) { comedi_error(dev, @@ -1609,18 +1471,11 @@ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* load timer value and enable interrupt */ s626_timer_load(dev, k, tick); k->SetEnable(dev, k, CLKENAB_ALWAYS); - - DEBUG("s626_ai_cmd: scan trigger timer is set with value %d\n", - tick); - break; case TRIG_EXT: /* set the digital line and interrupt for scan trigger */ if (cmd->start_src != TRIG_EXT) s626_dio_set_irq(dev, cmd->scan_begin_arg); - - DEBUG("s626_ai_cmd: External scan trigger is set!!!\n"); - break; } @@ -1636,19 +1491,12 @@ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* load timer value and enable interrupt */ s626_timer_load(dev, k, tick); k->SetEnable(dev, k, CLKENAB_INDEX); - - DEBUG - ("s626_ai_cmd: convert trigger timer is set with value %d\n", - tick); break; case TRIG_EXT: /* set the digital line and interrupt for convert trigger */ if (cmd->scan_begin_src != TRIG_EXT && cmd->start_src == TRIG_EXT) s626_dio_set_irq(dev, cmd->convert_arg); - - DEBUG("s626_ai_cmd: External convert trigger is set!!!\n"); - break; } @@ -1675,15 +1523,12 @@ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* Start executing the RPS program. */ MC_ENABLE(P_MC1, MC1_ERPS1); - DEBUG("s626_ai_cmd: ADC triggered\n"); s->async->inttrig = NULL; break; case TRIG_EXT: /* configure DIO channel for acquisition trigger */ s626_dio_set_irq(dev, cmd->start_arg); - DEBUG("s626_ai_cmd: External start trigger is set!!!\n"); - s->async->inttrig = NULL; break; case TRIG_INT: @@ -1694,8 +1539,6 @@ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* enable interrupt */ writel(IRQ_GPIO3 | IRQ_RPS1, devpriv->base_addr + P_IER); - DEBUG("s626_ai_cmd: command function terminated\n"); - return 0; } @@ -1938,7 +1781,6 @@ static void s626_dio_init(struct comedi_device *dev) DEBIwrite(dev, diopriv->WRDOut, 0); /* Program all outputs */ /* to inactive state. */ } - DEBUG("s626_dio_init: DIO initialized\n"); } /* DIO devices are slightly special. Although it is possible to @@ -2023,8 +1865,6 @@ static int s626_enc_insn_config(struct comedi_device *dev, uint16_t enab = CLKENAB_ALWAYS; struct enc_private *k = &encpriv[CR_CHAN(insn->chanspec)]; - DEBUG("s626_enc_insn_config: encoder config\n"); - /* (data==NULL) ? (Preloadvalue=0) : (Preloadvalue=data[0]); */ k->SetMode(dev, k, Setup, TRUE); @@ -2044,14 +1884,9 @@ static int s626_enc_insn_read(struct comedi_device *dev, int n; struct enc_private *k = &encpriv[CR_CHAN(insn->chanspec)]; - DEBUG("s626_enc_insn_read: encoder read channel %d\n", - CR_CHAN(insn->chanspec)); - for (n = 0; n < insn->n; n++) data[n] = ReadLatch(dev, k); - DEBUG("s626_enc_insn_read: encoder sample %d\n", data[n]); - return n; } @@ -2062,9 +1897,6 @@ static int s626_enc_insn_write(struct comedi_device *dev, struct enc_private *k = &encpriv[CR_CHAN(insn->chanspec)]; - DEBUG("s626_enc_insn_write: encoder write channel %d\n", - CR_CHAN(insn->chanspec)); - /* Set the preload register */ Preload(dev, k, data[0]); @@ -2074,8 +1906,6 @@ static int s626_enc_insn_write(struct comedi_device *dev, k->PulseIndex(dev, k); k->SetLoadTrig(dev, k, 2); - DEBUG("s626_enc_insn_write: End encoder write\n"); - return 1; } @@ -2093,7 +1923,6 @@ static void CloseDMAB(struct comedi_device *dev, struct bufferDMA *pdma, void *vbptr; dma_addr_t vpptr; - DEBUG("CloseDMAB: Entering S626DRV_CloseDMAB():\n"); if (pdma == NULL) return; /* find the matching allocation from the board struct */ @@ -2104,9 +1933,6 @@ static void CloseDMAB(struct comedi_device *dev, struct bufferDMA *pdma, pci_free_consistent(devpriv->pdev, bsize, vbptr, vpptr); pdma->LogicalBase = NULL; pdma->PhysicalBase = 0; - - DEBUG("CloseDMAB(): Logical=%p, bsize=%d, Physical=0x%x\n", - vbptr, bsize, (uint32_t) vpptr); } } @@ -2337,7 +2163,6 @@ static void SetMode_B(struct comedi_device *dev, struct enc_private *k, static void SetEnable_A(struct comedi_device *dev, struct enc_private *k, uint16_t enab) { - DEBUG("SetEnable_A: SetEnable_A enter 3541\n"); DEBIreplace(dev, k->MyCRB, (uint16_t) (~(CRBMSK_INTCTRL | CRBMSK_CLKENAB_A)), (uint16_t) (enab << CRBBIT_CLKENAB_A)); @@ -2506,7 +2331,6 @@ static uint16_t GetIntSrc_B(struct comedi_device *dev, struct enc_private *k) /* static void SetIndexSrc(struct comedi_device *dev, struct enc_private *k, uint16_t value ) */ /* { */ -/* DEBUG("SetIndexSrc: set index src enter 3700\n"); */ /* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_INDXSRC ) | ( (value != 0) << STDBIT_INDXSRC ) ), FALSE ); */ /* } */ @@ -2521,11 +2345,8 @@ static void PulseIndex_A(struct comedi_device *dev, struct enc_private *k) { register uint16_t cra; - DEBUG("PulseIndex_A: pulse index enter\n"); - cra = DEBIread(dev, k->MyCRA); /* Pulse index. */ DEBIwrite(dev, k->MyCRA, (uint16_t) (cra ^ CRAMSK_INDXPOL_A)); - DEBUG("PulseIndex_A: pulse index step1\n"); DEBIwrite(dev, k->MyCRA, cra); } @@ -2653,8 +2474,6 @@ static void CountersInit(struct comedi_device *dev) k->ResetCapFlags(dev, k); k->SetEnable(dev, k, CLKENAB_ALWAYS); } - DEBUG("CountersInit: counters initialized\n"); - } static int s626_attach(struct comedi_device *dev, struct comedi_devconfig *it) @@ -2722,7 +2541,6 @@ static int s626_attach(struct comedi_device *dev, struct comedi_devconfig *it) writel(MC1_SOFT_RESET, devpriv->base_addr + P_MC1); /* DMA FIXME DMA// */ - DEBUG("s626_attach: DMA ALLOCATION\n"); /* adc buffer allocation */ devpriv->allocatedBuf = 0; @@ -2737,11 +2555,6 @@ static int s626_attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->ANABuf.PhysicalBase = appdma; - DEBUG - ("s626_attach: AllocDMAB ADC Logical=%p, bsize=%d, Physical=0x%x\n", - devpriv->ANABuf.LogicalBase, DMABUF_SIZE, - (uint32_t) devpriv->ANABuf.PhysicalBase); - devpriv->allocatedBuf++; devpriv->RPSBuf.LogicalBase = @@ -2754,11 +2567,6 @@ static int s626_attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->RPSBuf.PhysicalBase = appdma; - DEBUG - ("s626_attach: AllocDMAB RPS Logical=%p, bsize=%d, Physical=0x%x\n", - devpriv->RPSBuf.LogicalBase, DMABUF_SIZE, - (uint32_t) devpriv->RPSBuf.PhysicalBase); - devpriv->allocatedBuf++; } @@ -2786,9 +2594,6 @@ static int s626_attach(struct comedi_device *dev, struct comedi_devconfig *it) } } - DEBUG("s626_attach: -- it opts %d,%d --\n", - it->options[0], it->options[1]); - s = dev->subdevices + 0; /* analog input subdevice */ dev->read_subdev = s; @@ -2887,11 +2692,6 @@ static int s626_attach(struct comedi_device *dev, struct comedi_devconfig *it) | DEBI_CFG_INTEL); /* Intel-compatible */ /* local bus (DEBI */ /* never times out). */ - DEBUG("s626_attach: %d debi init -- %d\n", - DEBI_CFG_SLAVE16 | (DEBI_TOUT << DEBI_CFG_TOUT_BIT) | - DEBI_SWAP | DEBI_CFG_INTEL, - DEBI_CFG_INTEL | DEBI_CFG_TOQ | DEBI_CFG_INCQ | - DEBI_CFG_16Q); /* DEBI INIT S626 WR7146( P_DEBICFG, DEBI_CFG_INTEL | DEBI_CFG_TOQ */ /* | DEBI_CFG_INCQ| DEBI_CFG_16Q); //end */ @@ -3128,9 +2928,6 @@ static int s626_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* writel(IRQ_GPIO3 | IRQ_RPS1,devpriv->base_addr+P_IER); */ } - DEBUG("s626_attach: comedi%d s626 attached %04x\n", dev->minor, - (uint32_t) devpriv->base_addr); - return 1; } diff --git a/drivers/staging/comedi/drivers/s626.h b/drivers/staging/comedi/drivers/s626.h index 2d1afec..82de03f 100644 --- a/drivers/staging/comedi/drivers/s626.h +++ b/drivers/staging/comedi/drivers/s626.h @@ -62,12 +62,6 @@ comedi_do_insn(cf,&insn); // executing configuration */ -#ifdef _DEBUG_ -#define DEBUG(...); printk(__VA_ARGS__); -#else -#define DEBUG(...) -#endif - #if !defined(TRUE) #define TRUE (1) #endif -- cgit v0.10.2 From 90fd56af25b7835118657833a52bb4c85a911de7 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 20 Jun 2012 19:27:43 -0700 Subject: staging: comedi: s626: remove private INLINE macro The INLINE macro is not used in the code. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/s626.h b/drivers/staging/comedi/drivers/s626.h index 82de03f..1796236 100644 --- a/drivers/staging/comedi/drivers/s626.h +++ b/drivers/staging/comedi/drivers/s626.h @@ -70,10 +70,6 @@ #define FALSE (0) #endif -#if !defined(INLINE) -#define INLINE static __inline -#endif - #include #define S626_SIZE 0x0200 -- cgit v0.10.2 From 9c1f1f12472c5b9808e4465cdf882892b19f2f10 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 20 Jun 2012 19:28:01 -0700 Subject: staging: comedi: s626: factor out the find PCI device code Factor out the code that finds a matching PCI device from attach function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 779ae7a..bef9649 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -2476,6 +2476,35 @@ static void CountersInit(struct comedi_device *dev) } } +static struct pci_dev *s626_find_pci(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + struct pci_dev *pcidev = NULL; + int bus = it->options[0]; + int slot = it->options[1]; + int i; + + for (i = 0; i < ARRAY_SIZE(s626_boards) && !pcidev; i++) { + do { + pcidev = pci_get_subsys(s626_boards[i].vendor_id, + s626_boards[i].device_id, + s626_boards[i].subvendor_id, + s626_boards[i].subdevice_id, + pcidev); + + if ((bus || slot) && pcidev) { + /* matches requested bus/slot */ + if (pcidev->bus->number == bus && + PCI_SLOT(pcidev->devfn) == slot) + break; + } else { + break; + } + } while (1); + } + return pcidev; +} + static int s626_attach(struct comedi_device *dev, struct comedi_devconfig *it) { /* uint8_t PollList; */ @@ -2489,36 +2518,17 @@ static int s626_attach(struct comedi_device *dev, struct comedi_devconfig *it) resource_size_t resourceStart; dma_addr_t appdma; struct comedi_subdevice *s; - struct pci_dev *pdev = NULL; if (alloc_private(dev, sizeof(struct s626_private)) < 0) return -ENOMEM; - for (i = 0; i < ARRAY_SIZE(s626_boards) && !pdev; i++) { - do { - pdev = pci_get_subsys(s626_boards[i].vendor_id, - s626_boards[i].device_id, - s626_boards[i].subvendor_id, - s626_boards[i].subdevice_id, - pdev); - - if ((it->options[0] || it->options[1]) && pdev) { - /* matches requested bus/slot */ - if (pdev->bus->number == it->options[0] && - PCI_SLOT(pdev->devfn) == it->options[1]) - break; - } else - break; - } while (1); - } - devpriv->pdev = pdev; - - if (pdev == NULL) { + devpriv->pdev = s626_find_pci(dev, it); + if (!devpriv->pdev) { printk(KERN_ERR "s626_attach: Board not present!!!\n"); return -ENODEV; } - result = comedi_pci_enable(pdev, "s626"); + result = comedi_pci_enable(devpriv->pdev, "s626"); if (result < 0) { printk(KERN_ERR "s626_attach: comedi_pci_enable fails\n"); return -ENODEV; -- cgit v0.10.2 From 933045a221acab3b17f4e6e5c1c12d6bf87d68ec Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 22 Jun 2012 10:14:59 +0300 Subject: staging: comedi: double unlock in usbduxsigma_attach() There was a double unlock introduced in 60ff461067 ("staging: comedi: usbduxsigma: use attach_usb() hook"). Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index 8da8c1c..543e604 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -2450,7 +2450,6 @@ static int usbduxsigma_attach(struct comedi_device *dev, if (index < 0) { dev_err(dev->class_dev, "usbduxsigma: error: attach failed, dev not connected to the usb bus.\n"); - up(&start_stop_sem); ret = -ENODEV; } else ret = usbduxsigma_attach_common(dev, &usbduxsub[index], -- cgit v0.10.2 From 088dc173a1ca029b1ec239bb4b3dec0da03242c5 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:12:42 -0700 Subject: staging: comedi: ni_daq_700: remove exported symbols This driver exports a number of functions with EXPORT_SYMBOL() but nothing actually uses them. They also are not declared in any header for use outside this module. As stated in the comments, this driver was based on the 8255 driver so these exports are most likely the result of cut-and- paste from the 8255 driver. Remove all the EXPORT_SYMBOL() lines. If the exported function is not used in the driver, remove the entire function as well. If the function is used, make it static. Also, make the dio700_cs_driver variable static since it's only referenced in this file. This quiets the following sparse warnings: warning: symbol 'subdev_700_interrupt' was not declared. Should it be static? warning: symbol 'subdev_700_init' was not declared. Should it be static? warning: symbol 'subdev_700_init_irq' was not declared. Should it be static? warning: symbol 'subdev_700_cleanup' was not declared. Should it be static? warning: symbol 'dio700_cs_driver' was not declared. Should it be static? Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 4b42809..fd1acf0 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -132,19 +132,6 @@ struct subdev_700_struct { static void do_config(struct comedi_device *dev, struct comedi_subdevice *s); -void subdev_700_interrupt(struct comedi_device *dev, struct comedi_subdevice *s) -{ - short d; - - d = CALLBACK_FUNC(0, _700_DATA, 0, CALLBACK_ARG); - - comedi_buf_put(s->async, d); - s->async->events |= COMEDI_CB_EOS; - - comedi_event(dev, s); -} -EXPORT_SYMBOL(subdev_700_interrupt); - static int subdev_700_cb(int dir, int port, int data, unsigned long arg) { /* port is always A for output and B for input (8255 emu) */ @@ -206,99 +193,10 @@ static void do_config(struct comedi_device *dev, struct comedi_subdevice *s) return; } -static int subdev_700_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_cmd *cmd) -{ - int err = 0; - unsigned int tmp; - - /* step 1 */ - - tmp = cmd->start_src; - cmd->start_src &= TRIG_NOW; - if (!cmd->start_src || tmp != cmd->start_src) - err++; - - tmp = cmd->scan_begin_src; - cmd->scan_begin_src &= TRIG_EXT; - if (!cmd->scan_begin_src || tmp != cmd->scan_begin_src) - err++; - - tmp = cmd->convert_src; - cmd->convert_src &= TRIG_FOLLOW; - if (!cmd->convert_src || tmp != cmd->convert_src) - err++; - - tmp = cmd->scan_end_src; - cmd->scan_end_src &= TRIG_COUNT; - if (!cmd->scan_end_src || tmp != cmd->scan_end_src) - err++; - - tmp = cmd->stop_src; - cmd->stop_src &= TRIG_NONE; - if (!cmd->stop_src || tmp != cmd->stop_src) - err++; - - if (err) - return 1; - - /* step 2 */ - - if (err) - return 2; - - /* step 3 */ - - if (cmd->start_arg != 0) { - cmd->start_arg = 0; - err++; - } - if (cmd->scan_begin_arg != 0) { - cmd->scan_begin_arg = 0; - err++; - } - if (cmd->convert_arg != 0) { - cmd->convert_arg = 0; - err++; - } - if (cmd->scan_end_arg != 1) { - cmd->scan_end_arg = 1; - err++; - } - if (cmd->stop_arg != 0) { - cmd->stop_arg = 0; - err++; - } - - if (err) - return 3; - - /* step 4 */ - - if (err) - return 4; - - return 0; -} - -static int subdev_700_cmd(struct comedi_device *dev, struct comedi_subdevice *s) -{ - /* FIXME */ - - return 0; -} - -static int subdev_700_cancel(struct comedi_device *dev, - struct comedi_subdevice *s) -{ - /* FIXME */ - - return 0; -} - -int subdev_700_init(struct comedi_device *dev, struct comedi_subdevice *s, - int (*cb) (int, int, int, unsigned long), unsigned long arg) +static int subdev_700_init(struct comedi_device *dev, + struct comedi_subdevice *s, + int (*cb) (int, int, int, unsigned long), + unsigned long arg) { s->type = COMEDI_SUBD_DIO; s->subdev_flags = SDF_READABLE | SDF_WRITABLE; @@ -325,36 +223,15 @@ int subdev_700_init(struct comedi_device *dev, struct comedi_subdevice *s, return 0; } -EXPORT_SYMBOL(subdev_700_init); - -int subdev_700_init_irq(struct comedi_device *dev, struct comedi_subdevice *s, - int (*cb) (int, int, int, unsigned long), - unsigned long arg) -{ - int ret; - - ret = subdev_700_init(dev, s, cb, arg); - if (ret < 0) - return ret; - - s->do_cmdtest = subdev_700_cmdtest; - s->do_cmd = subdev_700_cmd; - s->cancel = subdev_700_cancel; - - subdevpriv->have_irq = 1; - - return 0; -} -EXPORT_SYMBOL(subdev_700_init_irq); -void subdev_700_cleanup(struct comedi_device *dev, struct comedi_subdevice *s) +static void subdev_700_cleanup(struct comedi_device *dev, + struct comedi_subdevice *s) { if (s->private) if (subdevpriv->have_irq) kfree(s->private); } -EXPORT_SYMBOL(subdev_700_cleanup); static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) { @@ -556,7 +433,7 @@ MODULE_DESCRIPTION("Comedi driver for National Instruments " "PCMCIA DAQCard-700 DIO"); MODULE_LICENSE("GPL"); -struct pcmcia_driver dio700_cs_driver = { +static struct pcmcia_driver dio700_cs_driver = { .probe = dio700_cs_attach, .remove = dio700_cs_detach, .suspend = dio700_cs_suspend, -- cgit v0.10.2 From c0a97efc59c675e10390f61ba62ca2f0474c5206 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:13:00 -0700 Subject: staging: comedi: ni_daq_700: move the MODULE_* stuff to the EOF Move the MODULE_* declarations to the end of the file. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index fd1acf0..e75bdd0 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -428,10 +428,6 @@ static const struct pcmcia_device_id dio700_cs_ids[] = { MODULE_DEVICE_TABLE(pcmcia, dio700_cs_ids); -MODULE_AUTHOR("Fred Brooks "); -MODULE_DESCRIPTION("Comedi driver for National Instruments " - "PCMCIA DAQCard-700 DIO"); -MODULE_LICENSE("GPL"); static struct pcmcia_driver dio700_cs_driver = { .probe = dio700_cs_attach, @@ -471,3 +467,8 @@ void __exit cleanup_module(void) exit_dio700_cs(); comedi_driver_unregister(&driver_dio700); } + +MODULE_AUTHOR("Fred Brooks "); +MODULE_DESCRIPTION( + "Comedi driver for National Instruments PCMCIA DAQCard-700 DIO"); +MODULE_LICENSE("GPL"); -- cgit v0.10.2 From 113f7021497e5203dec3fba05294a6f184852db9 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:13:26 -0700 Subject: staging: comedi: ni_daq_700: add the module_{init, exit} declarations The init and exit functions for this module were being declared as global symbols. Add the module_{init,exit} declarations and make the functions static. Also, rename the functions so they have namespace associated with the module. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index e75bdd0..052a051 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -451,7 +451,7 @@ static void __exit exit_dio700_cs(void) pcmcia_unregister_driver(&dio700_cs_driver); } -int __init init_module(void) +static int __init dio700_cs_init(void) { int ret; @@ -461,12 +461,14 @@ int __init init_module(void) return comedi_driver_register(&driver_dio700); } +module_init(dio700_cs_init); -void __exit cleanup_module(void) +static void __exit dio700_cs_exit(void) { exit_dio700_cs(); comedi_driver_unregister(&driver_dio700); } +module_exit(dio700_cs_exit); MODULE_AUTHOR("Fred Brooks "); MODULE_DESCRIPTION( -- cgit v0.10.2 From 5fe9b247cc5dd6d39d9252fc0b51700e438a65fd Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:14:30 -0700 Subject: staging: comedi: ni_daq_700: consolidate the init and exit functions The register/unregister of the pcmcia driver is done is separate functions that are called by the module_{init,exit} routines. Simplify the code a bit by moving the register/unregister into the module_{init,exit} routines. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 052a051..b06792b 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -439,23 +439,11 @@ static struct pcmcia_driver dio700_cs_driver = { .name = "ni_daq_700", }; -static int __init init_dio700_cs(void) -{ - pcmcia_register_driver(&dio700_cs_driver); - return 0; -} - -static void __exit exit_dio700_cs(void) -{ - pr_debug("ni_daq_700: unloading\n"); - pcmcia_unregister_driver(&dio700_cs_driver); -} - static int __init dio700_cs_init(void) { int ret; - ret = init_dio700_cs(); + ret = pcmcia_register_driver(&dio700_cs_driver); if (ret < 0) return ret; @@ -465,7 +453,7 @@ module_init(dio700_cs_init); static void __exit dio700_cs_exit(void) { - exit_dio700_cs(); + pcmcia_unregister_driver(&dio700_cs_driver); comedi_driver_unregister(&driver_dio700); } module_exit(dio700_cs_exit); -- cgit v0.10.2 From f90398294753b3f88570af1c2a68032f6ae6bfbe Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:15:16 -0700 Subject: staging: comedi: ni_daq_700: change driver registration order As done with the other comedi driver types, register the comedi_driver first then the pcmcia_driver. Also, make sure the pcmcia_driver registration succeeds and unregister the comedi_driver it it fails. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index b06792b..af4f10f 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -443,11 +443,17 @@ static int __init dio700_cs_init(void) { int ret; - ret = pcmcia_register_driver(&dio700_cs_driver); + ret = comedi_driver_register(&driver_dio700); if (ret < 0) return ret; - return comedi_driver_register(&driver_dio700); + ret = pcmcia_register_driver(&dio700_cs_driver); + if (ret < 0) { + comedi_driver_unregister(&driver_dio700); + return ret; + } + + return 0; } module_init(dio700_cs_init); -- cgit v0.10.2 From 2f485d93cb6f870f2f19fb9a18656a372583eab1 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:16:00 -0700 Subject: staging: comedi: ni_daq_700: cleanup to the pcmcia_driver declaration For aesthetic reasons, add some whitespace to the declaration of the pcmcia_driver and reorder it a bit. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index af4f10f..30eeb9d 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -430,13 +430,13 @@ static const struct pcmcia_device_id dio700_cs_ids[] = { MODULE_DEVICE_TABLE(pcmcia, dio700_cs_ids); static struct pcmcia_driver dio700_cs_driver = { - .probe = dio700_cs_attach, - .remove = dio700_cs_detach, - .suspend = dio700_cs_suspend, - .resume = dio700_cs_resume, - .id_table = dio700_cs_ids, - .owner = THIS_MODULE, - .name = "ni_daq_700", + .name = "ni_daq_700", + .owner = THIS_MODULE, + .probe = dio700_cs_attach, + .remove = dio700_cs_detach, + .suspend = dio700_cs_suspend, + .resume = dio700_cs_resume, + .id_table = dio700_cs_ids, }; static int __init dio700_cs_init(void) -- cgit v0.10.2 From 59c9c00234fbadc8c479c89ec517e2e4f964029c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:16:41 -0700 Subject: staging: comedi: ni_daq_700: remove some useless comments Remove some useless comments and whitespace. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 30eeb9d..1059297 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -111,8 +111,6 @@ static struct comedi_driver driver_dio700 = { .offset = sizeof(struct dio700_board), }; -/* the real driver routines */ - #define _700_SIZE 8 #define _700_DATA 0 @@ -342,7 +340,7 @@ static int dio700_cs_attach(struct pcmcia_device *link) dio700_config(link); return 0; -} /* dio700_cs_attach */ +} static void dio700_cs_detach(struct pcmcia_device *link) { @@ -392,14 +390,14 @@ failed: printk(KERN_INFO "ni_daq_700 cs failed"); dio700_release(link); -} /* dio700_config */ +} static void dio700_release(struct pcmcia_device *link) { dev_dbg(&link->dev, "dio700_release\n"); pcmcia_disable_device(link); -} /* dio700_release */ +} static int dio700_cs_suspend(struct pcmcia_device *link) { @@ -408,7 +406,7 @@ static int dio700_cs_suspend(struct pcmcia_device *link) /* Mark the device as stopped, to block IO until later */ local->stop = 1; return 0; -} /* dio700_cs_suspend */ +} static int dio700_cs_resume(struct pcmcia_device *link) { @@ -416,17 +414,12 @@ static int dio700_cs_resume(struct pcmcia_device *link) local->stop = 0; return 0; -} /* dio700_cs_resume */ - -/*====================================================================*/ +} static const struct pcmcia_device_id dio700_cs_ids[] = { - /* N.B. These IDs should match those in dio700_boards */ - PCMCIA_DEVICE_MANF_CARD(0x010b, 0x4743), /* daqcard-700 */ + PCMCIA_DEVICE_MANF_CARD(0x010b, 0x4743), PCMCIA_DEVICE_NULL }; - - MODULE_DEVICE_TABLE(pcmcia, dio700_cs_ids); static struct pcmcia_driver dio700_cs_driver = { -- cgit v0.10.2 From 1a4d5b17c331b7a086a49720b1d7911caa075e3b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:17:20 -0700 Subject: staging: comedi: ni_daq_700: refactor the pcmcia support code Refactor the pcmcia support code to remove the need for the forward declarations. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 1059297..f9b0d67 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -306,49 +306,11 @@ static void dio700_detach(struct comedi_device *dev) free_irq(dev->irq, dev); }; -static void dio700_config(struct pcmcia_device *link); -static void dio700_release(struct pcmcia_device *link); -static int dio700_cs_suspend(struct pcmcia_device *p_dev); -static int dio700_cs_resume(struct pcmcia_device *p_dev); - -static int dio700_cs_attach(struct pcmcia_device *); -static void dio700_cs_detach(struct pcmcia_device *); - -struct local_info_t { - struct pcmcia_device *link; - int stop; - struct bus_operations *bus; -}; - -static int dio700_cs_attach(struct pcmcia_device *link) -{ - struct local_info_t *local; - - printk(KERN_INFO "ni_daq_700: cs-attach\n"); - - dev_dbg(&link->dev, "dio700_cs_attach()\n"); - - /* Allocate space for private device-specific data */ - local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); - if (!local) - return -ENOMEM; - local->link = link; - link->priv = local; - - pcmcia_cur_dev = link; - - dio700_config(link); - - return 0; -} - -static void dio700_cs_detach(struct pcmcia_device *link) +static void dio700_release(struct pcmcia_device *link) { - ((struct local_info_t *)link->priv)->stop = 1; - dio700_release(link); + dev_dbg(&link->dev, "dio700_release\n"); - /* This points to the parent struct local_info_t struct */ - kfree(link->priv); + pcmcia_disable_device(link); } static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev, @@ -392,11 +354,41 @@ failed: } -static void dio700_release(struct pcmcia_device *link) +struct local_info_t { + struct pcmcia_device *link; + int stop; + struct bus_operations *bus; +}; + +static int dio700_cs_attach(struct pcmcia_device *link) { - dev_dbg(&link->dev, "dio700_release\n"); + struct local_info_t *local; - pcmcia_disable_device(link); + printk(KERN_INFO "ni_daq_700: cs-attach\n"); + + dev_dbg(&link->dev, "dio700_cs_attach()\n"); + + /* Allocate space for private device-specific data */ + local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); + if (!local) + return -ENOMEM; + local->link = link; + link->priv = local; + + pcmcia_cur_dev = link; + + dio700_config(link); + + return 0; +} + +static void dio700_cs_detach(struct pcmcia_device *link) +{ + ((struct local_info_t *)link->priv)->stop = 1; + dio700_release(link); + + /* This points to the parent struct local_info_t struct */ + kfree(link->priv); } static int dio700_cs_suspend(struct pcmcia_device *link) -- cgit v0.10.2 From 1ac53c027bb6be5a82b080a1320bfd6f7fba641b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:17:52 -0700 Subject: staging: comedi: ni_daq_700: Move the comedi_driver variable Move the comedi_driver variable to remove the need for the forward declarations. Add some whitespace to the declaration for aesthetic reasons. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index f9b0d67..b851e2e 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -55,10 +55,6 @@ static struct pcmcia_device *pcmcia_cur_dev; #define DIO700_SIZE 8 /* size of io region used by board */ -static int dio700_attach(struct comedi_device *dev, - struct comedi_devconfig *it); -static void dio700_detach(struct comedi_device *dev); - enum dio700_bustype { pcmcia_bustype }; struct dio700_board { @@ -101,16 +97,6 @@ struct dio700_private { #define devpriv ((struct dio700_private *)dev->private) -static struct comedi_driver driver_dio700 = { - .driver_name = "ni_daq_700", - .module = THIS_MODULE, - .attach = dio700_attach, - .detach = dio700_detach, - .num_names = ARRAY_SIZE(dio700_boards), - .board_name = &dio700_boards[0].name, - .offset = sizeof(struct dio700_board), -}; - #define _700_SIZE 8 #define _700_DATA 0 @@ -306,6 +292,16 @@ static void dio700_detach(struct comedi_device *dev) free_irq(dev->irq, dev); }; +static struct comedi_driver driver_dio700 = { + .driver_name = "ni_daq_700", + .module = THIS_MODULE, + .attach = dio700_attach, + .detach = dio700_detach, + .board_name = &dio700_boards[0].name, + .num_names = ARRAY_SIZE(dio700_boards), + .offset = sizeof(struct dio700_board), +}; + static void dio700_release(struct pcmcia_device *link) { dev_dbg(&link->dev, "dio700_release\n"); -- cgit v0.10.2 From c7949bbbfcf3e6b76384b191cd472ccc31742002 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:18:51 -0700 Subject: staging: comedi: ni_daq_700: Remove the unused private data struct The private data struct in this driver is not used for anything. Remove the struct definition and the alloc_private() call. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index b851e2e..7ad5465 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -90,13 +90,6 @@ static const struct dio700_board dio700_boards[] = { */ #define thisboard ((const struct dio700_board *)dev->board_ptr) -struct dio700_private { - - int data; /* number of data points left to be taken */ -}; - -#define devpriv ((struct dio700_private *)dev->private) - #define _700_SIZE 8 #define _700_DATA 0 @@ -227,10 +220,6 @@ static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) struct pcmcia_device *link; int ret; - /* allocate and initialize dev->private */ - if (alloc_private(dev, sizeof(struct dio700_private)) < 0) - return -ENOMEM; - /* get base address, irq etc. based on bustype */ switch (thisboard->bustype) { case pcmcia_bustype: -- cgit v0.10.2 From c0c33f69c08721d775fb0cf2d935ce5436314c68 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:19:47 -0700 Subject: staging: comedi: ni_daq_700: Remove a "do nothing" function stub The function do_config() doesn't do anything. Just remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 7ad5465..99ce234d 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -107,8 +107,6 @@ struct subdev_700_struct { #define CALLBACK_FUNC (((struct subdev_700_struct *)s->private)->cb_func) #define subdevpriv ((struct subdev_700_struct *)s->private) -static void do_config(struct comedi_device *dev, struct comedi_subdevice *s); - static int subdev_700_cb(int dir, int port, int data, unsigned long arg) { /* port is always A for output and B for input (8255 emu) */ @@ -165,11 +163,6 @@ static int subdev_700_insn_config(struct comedi_device *dev, return 1; } -static void do_config(struct comedi_device *dev, struct comedi_subdevice *s) -{ /* use powerup defaults */ - return; -} - static int subdev_700_init(struct comedi_device *dev, struct comedi_subdevice *s, int (*cb) (int, int, int, unsigned long), @@ -196,7 +189,6 @@ static int subdev_700_init(struct comedi_device *dev, s->state = 0; s->io_bits = 0x00ff; - do_config(dev, s); return 0; } -- cgit v0.10.2 From 5956703960aceff6340ca569d4dcc80f2045bf20 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:20:56 -0700 Subject: staging: comedi: ni_daq_700: Remove unused variables from the boardinfo The 'read_byte' and 'write_byte' function pointers in the boardinfo struct are not referenced in the driver. Just remove them. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 99ce234d..749bc5a 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -62,10 +62,6 @@ struct dio700_board { int device_id; /* device id for pcmcia board */ enum dio700_bustype bustype; /* PCMCIA */ int have_dio; /* have daqcard-700 dio */ - /* function pointers so we can use inb/outb or readb/writeb */ - /* as appropriate */ - unsigned int (*read_byte) (unsigned int address); - void (*write_byte) (unsigned int byte, unsigned int address); }; static const struct dio700_board dio700_boards[] = { -- cgit v0.10.2 From ba0333ead10246535134cb4a552c79b56e6a4894 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:21:55 -0700 Subject: staging: comedi: ni_daq_700: Remove unneeded variables from the boardinfo The 'device_id' and 'have_dio' variables in the boardinfo struct are initialized but not referenced in the driver. Just remove them. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 749bc5a..47e8cf4 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -59,25 +59,17 @@ enum dio700_bustype { pcmcia_bustype }; struct dio700_board { const char *name; - int device_id; /* device id for pcmcia board */ enum dio700_bustype bustype; /* PCMCIA */ - int have_dio; /* have daqcard-700 dio */ }; static const struct dio700_board dio700_boards[] = { { .name = "daqcard-700", - /* 0x10b is manufacturer id, 0x4743 is device id */ - .device_id = 0x4743, .bustype = pcmcia_bustype, - .have_dio = 1, }, { .name = "ni_daq_700", - /* 0x10b is manufacturer id, 0x4743 is device id */ - .device_id = 0x4743, .bustype = pcmcia_bustype, - .have_dio = 1, }, }; -- cgit v0.10.2 From 726288e4aadbe53ed8f43483eb3b02c4a5385bd4 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:23:04 -0700 Subject: staging: comedi: ni_daq_700: Remove bustype variable from the boardinfo This driver is only used for pcmcia type devices. There is no need for the 'bustype' check. Remove the variable from the boardinfo and refactor the code based on it's removal. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 47e8cf4..106da08 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -55,21 +55,16 @@ static struct pcmcia_device *pcmcia_cur_dev; #define DIO700_SIZE 8 /* size of io region used by board */ -enum dio700_bustype { pcmcia_bustype }; - struct dio700_board { const char *name; - enum dio700_bustype bustype; /* PCMCIA */ }; static const struct dio700_board dio700_boards[] = { { .name = "daqcard-700", - .bustype = pcmcia_bustype, }, { .name = "ni_daq_700", - .bustype = pcmcia_bustype, }, }; @@ -200,22 +195,14 @@ static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) struct pcmcia_device *link; int ret; - /* get base address, irq etc. based on bustype */ - switch (thisboard->bustype) { - case pcmcia_bustype: - link = pcmcia_cur_dev; /* XXX hack */ - if (!link) - return -EIO; - iobase = link->resource[0]->start; + link = pcmcia_cur_dev; /* XXX hack */ + if (!link) + return -EIO; + iobase = link->resource[0]->start; #ifdef incomplete - irq = link->irq; + irq = link->irq; #endif - break; - default: - printk(KERN_ERR "bug! couldn't determine board type\n"); - return -EINVAL; - break; - } + printk(KERN_ERR "comedi%d: ni_daq_700: %s, io 0x%lx", dev->minor, thisboard->name, iobase); #ifdef incomplete @@ -255,8 +242,6 @@ static void dio700_detach(struct comedi_device *dev) { if (dev->subdevices) subdev_700_cleanup(dev, dev->subdevices + 0); - if (thisboard->bustype != pcmcia_bustype && dev->iobase) - release_region(dev->iobase, DIO700_SIZE); if (dev->irq) free_irq(dev->irq, dev); }; -- cgit v0.10.2 From 79820c9cec076bd839a076fcb06fb6bfb79b1614 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:24:06 -0700 Subject: staging: comedi: ni_daq_700: move the boardinfo variable For aesthetic reasons, move the boardinfo declaration down so it's next to the comedi_driver. That's the only place in the driver where it's referenced directly. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 106da08..864bef7 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -59,15 +59,6 @@ struct dio700_board { const char *name; }; -static const struct dio700_board dio700_boards[] = { - { - .name = "daqcard-700", - }, - { - .name = "ni_daq_700", - }, -}; - /* * Useful for shorthand access to the particular board structure */ @@ -246,6 +237,14 @@ static void dio700_detach(struct comedi_device *dev) free_irq(dev->irq, dev); }; +static const struct dio700_board dio700_boards[] = { + { + .name = "daqcard-700", + }, { + .name = "ni_daq_700", + }, +}; + static struct comedi_driver driver_dio700 = { .driver_name = "ni_daq_700", .module = THIS_MODULE, -- cgit v0.10.2 From 109d5d54e0e5d93d1fcc4acb186981459d152977 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:25:26 -0700 Subject: staging: comedi: ni_daq_700: remove thisboard macro The 'thisboard' macro relies on a local variable having a specific name and yields a pointer derived from that local variable. Replace the macro with local variables and use the comedi_board() helper to get the pointer. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 864bef7..2f84934 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -59,11 +59,6 @@ struct dio700_board { const char *name; }; -/* - * Useful for shorthand access to the particular board structure - */ -#define thisboard ((const struct dio700_board *)dev->board_ptr) - #define _700_SIZE 8 #define _700_DATA 0 @@ -178,6 +173,7 @@ static void subdev_700_cleanup(struct comedi_device *dev, static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct dio700_board *thisboard = comedi_board(dev); struct comedi_subdevice *s; unsigned long iobase = 0; #ifdef incomplete -- cgit v0.10.2 From 54be9353682914693074078d203407806f8f3f34 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:26:46 -0700 Subject: staging: comedi: ni_daq_700: remove unused private data variable The 'have_irq' variable is not needed since this driver doesn't use interrupts. Remove it. The kfree(s->private) needs to remain to free the memory allocated in subdev_700_init(). Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 2f84934..525f076 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -69,7 +69,6 @@ struct dio700_board { struct subdev_700_struct { unsigned long cb_arg; int (*cb_func) (int, int, int, unsigned long); - int have_irq; }; #define CALLBACK_ARG (((struct subdev_700_struct *)s->private)->cb_arg) @@ -166,9 +165,7 @@ static void subdev_700_cleanup(struct comedi_device *dev, struct comedi_subdevice *s) { if (s->private) - if (subdevpriv->have_irq) - - kfree(s->private); + kfree(s->private); } static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) -- cgit v0.10.2 From 1de02225358988e8fd48d1dc3fd12336bbae258a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:28:33 -0700 Subject: staging: comedi: ni_daq_700: remove the CALLBACK_* code This driver was originally copied from the 8255 driver. The 8255 uses a callback function to handle the io operations to the device. In this driver, the callback adds unneeded complexity. The CALLBACK_ARG for this driver is always 'dev->iobase' and the CALLBACK_FUNC is always 'subdev_700_cb'. The callback function is also overly complex for this driver. It takes a 'dir' parameter to determine if the io is a write or read, a 'port' parameter that is not used, a 'data' parameter that is only used for writes, and an 'arg' which is the iobase of the device. Unwind all of it and just put the outb()/inb() call in the code where needed. This allows getting rid of the private data completely. Refactor the code based on it's removal. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 525f076..59f7632 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -66,28 +66,6 @@ struct dio700_board { #define DIO_W 0x04 #define DIO_R 0x05 -struct subdev_700_struct { - unsigned long cb_arg; - int (*cb_func) (int, int, int, unsigned long); -}; - -#define CALLBACK_ARG (((struct subdev_700_struct *)s->private)->cb_arg) -#define CALLBACK_FUNC (((struct subdev_700_struct *)s->private)->cb_func) -#define subdevpriv ((struct subdev_700_struct *)s->private) - -static int subdev_700_cb(int dir, int port, int data, unsigned long arg) -{ - /* port is always A for output and B for input (8255 emu) */ - unsigned long iobase = arg; - - if (dir) { - outb(data, iobase + DIO_W); - return 0; - } else { - return inb(iobase + DIO_R); - } -} - static int subdev_700_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -97,12 +75,11 @@ static int subdev_700_insn(struct comedi_device *dev, s->state |= (data[0] & data[1]); if (data[0] & 0xff) - CALLBACK_FUNC(1, _700_DATA, s->state & 0xff, - CALLBACK_ARG); + outb(s->state & 0xff, dev->iobase + DIO_W); } data[1] = s->state & 0xff; - data[1] |= CALLBACK_FUNC(0, _700_DATA, 0, CALLBACK_ARG) << 8; + data[1] |= inb(dev->iobase + DIO_R); return insn->n; } @@ -142,16 +119,6 @@ static int subdev_700_init(struct comedi_device *dev, s->range_table = &range_digital; s->maxdata = 1; - s->private = kmalloc(sizeof(struct subdev_700_struct), GFP_KERNEL); - if (!s->private) - return -ENOMEM; - - CALLBACK_ARG = arg; - if (cb == NULL) - CALLBACK_FUNC = subdev_700_cb; - else - CALLBACK_FUNC = cb; - s->insn_bits = subdev_700_insn; s->insn_config = subdev_700_insn_config; @@ -161,13 +128,6 @@ static int subdev_700_init(struct comedi_device *dev, return 0; } -static void subdev_700_cleanup(struct comedi_device *dev, - struct comedi_subdevice *s) -{ - if (s->private) - kfree(s->private); -} - static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) { const struct dio700_board *thisboard = comedi_board(dev); @@ -224,8 +184,6 @@ static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) static void dio700_detach(struct comedi_device *dev) { - if (dev->subdevices) - subdev_700_cleanup(dev, dev->subdevices + 0); if (dev->irq) free_irq(dev->irq, dev); }; -- cgit v0.10.2 From 797a9e782ae2922451cf9aa6d66dd5eaa0987626 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:29:19 -0700 Subject: staging: comedi: ni_daq_700: remove a couple unused defines These defines are not referenced in the driver. Remove them. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 59f7632..dbc5fc6 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -53,16 +53,10 @@ IRQ is assigned but not used. static struct pcmcia_device *pcmcia_cur_dev; -#define DIO700_SIZE 8 /* size of io region used by board */ - struct dio700_board { const char *name; }; -#define _700_SIZE 8 - -#define _700_DATA 0 - #define DIO_W 0x04 #define DIO_R 0x05 -- cgit v0.10.2 From be7085ae31fa062b82a4f0614998cbc9066debfc Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:30:13 -0700 Subject: staging: comedi: ni_daq_700: remove the subdev_700_init function Move the contents of subdev_700_init into the attach function. For aesthetic reasone, add some whitespace to the initialization of the subdevice. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index dbc5fc6..206a0c4 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -102,26 +102,6 @@ static int subdev_700_insn_config(struct comedi_device *dev, return 1; } -static int subdev_700_init(struct comedi_device *dev, - struct comedi_subdevice *s, - int (*cb) (int, int, int, unsigned long), - unsigned long arg) -{ - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 16; - s->range_table = &range_digital; - s->maxdata = 1; - - s->insn_bits = subdev_700_insn; - s->insn_config = subdev_700_insn_config; - - s->state = 0; - s->io_bits = 0x00ff; - - return 0; -} - static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) { const struct dio700_board *thisboard = comedi_board(dev); @@ -171,7 +151,16 @@ static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* DAQCard-700 dio */ s = dev->subdevices + 0; - subdev_700_init(dev, s, NULL, dev->iobase); + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 16; + s->range_table = &range_digital; + s->maxdata = 1; + s->insn_bits = subdev_700_insn; + s->insn_config = subdev_700_insn_config; + + s->state = 0; + s->io_bits = 0x00ff; return 0; }; -- cgit v0.10.2 From 40cfdb9505c253c0dac4a1a8a8d9bdf551a38649 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:31:15 -0700 Subject: staging: comedi: ni_daq_700: remove the #ifdef'ed out irq code The irq code is not compiled in due to the '#ifdef incomplete'. And, as stated, it's not even complete. Just remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 206a0c4..94cb346 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -37,8 +37,6 @@ port, bit 0; channel 8 corresponds to the input port, bit 0. Direction configuration: channels 0-7 output, 8-15 input (8225 device emu as port A output, port B input, port C N/A). - -IRQ is assigned but not used. */ #include @@ -107,9 +105,6 @@ static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) const struct dio700_board *thisboard = comedi_board(dev); struct comedi_subdevice *s; unsigned long iobase = 0; -#ifdef incomplete - unsigned int irq = 0; -#endif struct pcmcia_device *link; int ret; @@ -117,19 +112,9 @@ static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (!link) return -EIO; iobase = link->resource[0]->start; -#ifdef incomplete - irq = link->irq; -#endif - printk(KERN_ERR "comedi%d: ni_daq_700: %s, io 0x%lx", dev->minor, + printk(KERN_ERR "comedi%d: ni_daq_700: %s, io 0x%lx\n", dev->minor, thisboard->name, iobase); -#ifdef incomplete - if (irq) - printk(", irq %u", irq); - -#endif - - printk("\n"); if (iobase == 0) { printk(KERN_ERR "io base address is zero!\n"); @@ -138,11 +123,6 @@ static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->iobase = iobase; -#ifdef incomplete - /* grab our IRQ */ - dev->irq = irq; -#endif - dev->board_name = thisboard->name; ret = comedi_alloc_subdevices(dev, 1); @@ -167,8 +147,7 @@ static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) static void dio700_detach(struct comedi_device *dev) { - if (dev->irq) - free_irq(dev->irq, dev); + /* nothing to cleanup */ }; static const struct dio700_board dio700_boards[] = { -- cgit v0.10.2 From b88c59972db3117996913d8e74fdfe9df3ac601b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:32:19 -0700 Subject: staging: comedi: ni_daq_700: change the 'attach' printk's to dev_printk's Use the dev_printk() routines to output the kernel messages in the attach routine. The main 'attach' message had a level of KERN_ERR, I believe it should have been KERN_INFO. Also, move that message to the end of the attach so it only gets displayed if the attach is successful. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 94cb346..50fad12 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -113,11 +113,8 @@ static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) return -EIO; iobase = link->resource[0]->start; - printk(KERN_ERR "comedi%d: ni_daq_700: %s, io 0x%lx\n", dev->minor, - thisboard->name, iobase); - if (iobase == 0) { - printk(KERN_ERR "io base address is zero!\n"); + dev_err(dev->class_dev, "io base address is zero!\n"); return -EINVAL; } @@ -142,6 +139,11 @@ static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->state = 0; s->io_bits = 0x00ff; + dev_info(dev->class_dev, "%s: %s, io 0x%lx\n", + dev->driver->driver_name, + dev->board_name, + dev->iobase); + return 0; }; -- cgit v0.10.2 From 7448fcd3b8caee05c6e5a7dc965b5845affbb2e8 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:33:10 -0700 Subject: staging: comedi: ni_daq_700: remove local variable in the 'attach' function There is no need for the local variable 'iobase' in the attach function. If it's '0' the attach fails otherwise the value is just stored in dev->iobase. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 50fad12..5c60df8 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -104,22 +104,19 @@ static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) { const struct dio700_board *thisboard = comedi_board(dev); struct comedi_subdevice *s; - unsigned long iobase = 0; struct pcmcia_device *link; int ret; link = pcmcia_cur_dev; /* XXX hack */ if (!link) return -EIO; - iobase = link->resource[0]->start; - if (iobase == 0) { + dev->iobase = link->resource[0]->start; + if (!dev->iobase) { dev_err(dev->class_dev, "io base address is zero!\n"); return -EINVAL; } - dev->iobase = iobase; - dev->board_name = thisboard->name; ret = comedi_alloc_subdevices(dev, 1); -- cgit v0.10.2 From 4fb209a56960bad241b41b0e0e451b6346b6aee4 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:33:52 -0700 Subject: staging: comedi: ni_daq_700: remove some dangling ';' Functions don't need the ';' at the end. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 5c60df8..4978cd3 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -142,12 +142,12 @@ static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->iobase); return 0; -}; +} static void dio700_detach(struct comedi_device *dev) { /* nothing to cleanup */ -}; +} static const struct dio700_board dio700_boards[] = { { -- cgit v0.10.2 From c11a1ea71bf2ce9a75a7071c785220a42f4c922a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:34:57 -0700 Subject: staging: comedi: ni_daq_700: use a local var to fix a > 80 char line issue The 'data[1] = ...' line is currently kept < 80 chars by breaking a pointer access after the '->'. This makes the code a bit confusing to follow. Use a local variable to shorten the line and make it clearer. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 4978cd3..2ea3c8d 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -80,6 +80,7 @@ static int subdev_700_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + unsigned int chan = 1 << CR_CHAN(insn->chanspec); switch (data[0]) { case INSN_CONFIG_DIO_INPUT: @@ -87,10 +88,7 @@ static int subdev_700_insn_config(struct comedi_device *dev, case INSN_CONFIG_DIO_OUTPUT: break; case INSN_CONFIG_DIO_QUERY: - data[1] = - (s-> - io_bits & (1 << CR_CHAN(insn->chanspec))) ? COMEDI_OUTPUT : - COMEDI_INPUT; + data[1] = (s->io_bits & chan) ? COMEDI_OUTPUT : COMEDI_INPUT; return insn->n; break; default: -- cgit v0.10.2 From 740b48be40761c0345a3c5e7ad077b7e4616bd13 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:35:57 -0700 Subject: staging: comedi: ni_daq_700: fix return for insn_config function The comedi insn_config functions should return < 0 for errors or the number of data elements used to perform the command, this value is available as 'insn->n'. Return that instead of the open coded number to better indicate what the return means. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 2ea3c8d..cc46948 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -89,13 +89,12 @@ static int subdev_700_insn_config(struct comedi_device *dev, break; case INSN_CONFIG_DIO_QUERY: data[1] = (s->io_bits & chan) ? COMEDI_OUTPUT : COMEDI_INPUT; - return insn->n; break; default: return -EINVAL; } - return 1; + return insn->n; } static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) -- cgit v0.10.2 From 9c1eb8e1a04acb27da21d461db2b015ac33a0d25 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:36:58 -0700 Subject: staging: comedi: ni_daq_700: cleanup pcmcia debug output messages These messages should probably just be removed. For now just clean then up. Remove a couple redundant KERN_INFO messages in the pcmcia support code and leave the dev_dbg() ones. Change the dev_dgb() messages to use __func__ instead of the open coded string. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index cc46948..bb857ac 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -166,7 +166,7 @@ static struct comedi_driver driver_dio700 = { static void dio700_release(struct pcmcia_device *link) { - dev_dbg(&link->dev, "dio700_release\n"); + dev_dbg(&link->dev, "%s\n", __func__); pcmcia_disable_device(link); } @@ -184,9 +184,7 @@ static void dio700_config(struct pcmcia_device *link) { int ret; - printk(KERN_INFO "ni_daq_700: cs-config\n"); - - dev_dbg(&link->dev, "dio700_config\n"); + dev_dbg(&link->dev, "%s\n", __func__); link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_AUDIO | CONF_AUTO_SET_IO; @@ -207,7 +205,7 @@ static void dio700_config(struct pcmcia_device *link) return; failed: - printk(KERN_INFO "ni_daq_700 cs failed"); + dev_dbg(&link->dev, "%s failed\n", __func__); dio700_release(link); } @@ -222,9 +220,7 @@ static int dio700_cs_attach(struct pcmcia_device *link) { struct local_info_t *local; - printk(KERN_INFO "ni_daq_700: cs-attach\n"); - - dev_dbg(&link->dev, "dio700_cs_attach()\n"); + dev_dbg(&link->dev, "%s\n", __func__); /* Allocate space for private device-specific data */ local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); -- cgit v0.10.2 From 919f6077f26937455d8ce2a2987063c6111e1609 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:37:56 -0700 Subject: staging: comedi: ni_daq_700: remove unused pcmcia 'stop' logic The pcmcia support code in this driver appears to be cut-and- paste from some other driver. It has code in it to stop the device during suspend but nothing in the main comedi_driver uses it. Remove the 'stop' variable from the pcmcia private data and all the logic that deals with it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index bb857ac..b02ed37 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -212,7 +212,6 @@ failed: struct local_info_t { struct pcmcia_device *link; - int stop; struct bus_operations *bus; }; @@ -238,7 +237,6 @@ static int dio700_cs_attach(struct pcmcia_device *link) static void dio700_cs_detach(struct pcmcia_device *link) { - ((struct local_info_t *)link->priv)->stop = 1; dio700_release(link); /* This points to the parent struct local_info_t struct */ @@ -247,18 +245,11 @@ static void dio700_cs_detach(struct pcmcia_device *link) static int dio700_cs_suspend(struct pcmcia_device *link) { - struct local_info_t *local = link->priv; - - /* Mark the device as stopped, to block IO until later */ - local->stop = 1; return 0; } static int dio700_cs_resume(struct pcmcia_device *link) { - struct local_info_t *local = link->priv; - - local->stop = 0; return 0; } -- cgit v0.10.2 From d2d2a6f27564d101192610abaae94177471c755b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:38:45 -0700 Subject: staging: comedi: ni_daq_700: remove unneeded pcmcia private data The pcmcia device-specific data is not longer needed by this driver. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index b02ed37..f8465a2 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -210,24 +210,10 @@ failed: } -struct local_info_t { - struct pcmcia_device *link; - struct bus_operations *bus; -}; - static int dio700_cs_attach(struct pcmcia_device *link) { - struct local_info_t *local; - dev_dbg(&link->dev, "%s\n", __func__); - /* Allocate space for private device-specific data */ - local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); - if (!local) - return -ENOMEM; - local->link = link; - link->priv = local; - pcmcia_cur_dev = link; dio700_config(link); @@ -238,9 +224,6 @@ static int dio700_cs_attach(struct pcmcia_device *link) static void dio700_cs_detach(struct pcmcia_device *link) { dio700_release(link); - - /* This points to the parent struct local_info_t struct */ - kfree(link->priv); } static int dio700_cs_suspend(struct pcmcia_device *link) -- cgit v0.10.2 From cc04ac0fee72d55e59c2d9db19969bc2d74a9097 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:39:42 -0700 Subject: staging: comedi: ni_daq_700: remove the pcmcia suspend/resume The pcmcia suspend/resume callbacks don't do anything. Remove them. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index f8465a2..c57300f 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -226,16 +226,6 @@ static void dio700_cs_detach(struct pcmcia_device *link) dio700_release(link); } -static int dio700_cs_suspend(struct pcmcia_device *link) -{ - return 0; -} - -static int dio700_cs_resume(struct pcmcia_device *link) -{ - return 0; -} - static const struct pcmcia_device_id dio700_cs_ids[] = { PCMCIA_DEVICE_MANF_CARD(0x010b, 0x4743), PCMCIA_DEVICE_NULL @@ -247,8 +237,6 @@ static struct pcmcia_driver dio700_cs_driver = { .owner = THIS_MODULE, .probe = dio700_cs_attach, .remove = dio700_cs_detach, - .suspend = dio700_cs_suspend, - .resume = dio700_cs_resume, .id_table = dio700_cs_ids, }; -- cgit v0.10.2 From 6e891af85b4b697679f72c77ddbe19f853379f02 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 22 Jun 2012 16:40:40 -0700 Subject: staging: comedi: ni_daq_700: refactor the pcmcia attach/detach Move the pcmcia_disable_device() call where needed in the pcmcia attach/detach and delete the dio700_release() function. Move the logic of dio700_config() directly into the attach function and properly return an error code when the config fails. Only set the pcmcia_cur_dev, used by the comedi_driver, if the pcmcia attach is successful. Also, make sure to NULL it in the detach. Remove all the kernel messages in the pcmcia support code. They are just added noise. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index c57300f..83016b4 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -164,13 +164,6 @@ static struct comedi_driver driver_dio700 = { .offset = sizeof(struct dio700_board), }; -static void dio700_release(struct pcmcia_device *link) -{ - dev_dbg(&link->dev, "%s\n", __func__); - - pcmcia_disable_device(link); -} - static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev, void *priv_data) { @@ -180,50 +173,36 @@ static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev, return pcmcia_request_io(p_dev); } -static void dio700_config(struct pcmcia_device *link) +static int dio700_cs_attach(struct pcmcia_device *link) { int ret; - dev_dbg(&link->dev, "%s\n", __func__); - link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_AUDIO | CONF_AUTO_SET_IO; ret = pcmcia_loop_config(link, dio700_pcmcia_config_loop, NULL); - if (ret) { - dev_warn(&link->dev, "no configuration found\n"); + if (ret) goto failed; - } if (!link->irq) goto failed; ret = pcmcia_enable_device(link); - if (ret != 0) + if (ret) goto failed; - return; - -failed: - dev_dbg(&link->dev, "%s failed\n", __func__); - dio700_release(link); - -} - -static int dio700_cs_attach(struct pcmcia_device *link) -{ - dev_dbg(&link->dev, "%s\n", __func__); - pcmcia_cur_dev = link; - - dio700_config(link); - return 0; + +failed: + pcmcia_disable_device(link); + return ret; } static void dio700_cs_detach(struct pcmcia_device *link) { - dio700_release(link); + pcmcia_disable_device(link); + pcmcia_cur_dev = NULL; } static const struct pcmcia_device_id dio700_cs_ids[] = { -- cgit v0.10.2 From 3852587ac62d249f26f89e3fef28c0474cc25729 Mon Sep 17 00:00:00 2001 From: Erik Jones Date: Wed, 20 Jun 2012 23:17:03 -0400 Subject: staging: rts5139: rts51x_chip: fixed brace coding style issue Fixed a coding style issue. Signed-off-by: Erik Jones Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/rts5139/rts51x_chip.c b/drivers/staging/rts5139/rts51x_chip.c index db88d7a..08dcae8 100644 --- a/drivers/staging/rts5139/rts51x_chip.c +++ b/drivers/staging/rts5139/rts51x_chip.c @@ -363,11 +363,10 @@ void rts51x_polling_func(struct rts51x_chip *chip) break; } - if (chip->option.auto_delink_en && !chip->card_ready) { + if (chip->option.auto_delink_en && !chip->card_ready) rts51x_auto_delink(chip); - } else { + else chip->auto_delink_counter = 0; - } } void rts51x_add_cmd(struct rts51x_chip *chip, -- cgit v0.10.2 From b15297e912afb6a2a5bf592bb006fd705c12ab1c Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Fri, 22 Jun 2012 01:00:41 +0200 Subject: staging: rts5139: Remove duplicate include of rts51x.h The header "rts51x.h" is included unconditionally at the start of the file and then again once more under "#ifdef SUPPORT_FILE_OP". Once is enough, so remove the conditional include and just keep the unconditional one. Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/rts5139/rts51x_fop.c b/drivers/staging/rts5139/rts51x_fop.c index ef893c8..e1200fe8 100644 --- a/drivers/staging/rts5139/rts51x_fop.c +++ b/drivers/staging/rts5139/rts51x_fop.c @@ -36,7 +36,6 @@ #include "rts51x_card.h" #include "rts51x_fop.h" #include "sd_cprm.h" -#include "rts51x.h" #define RTS5139_IOC_MAGIC 0x39 -- cgit v0.10.2 From 70b3fd34a9b2e06b2702d691d406ef2ec1d2f0df Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Fri, 22 Jun 2012 02:28:12 +0200 Subject: staging: vt6656: Correct a few assignments to be compares in iwctl_siwencodeext() The result of "foo = bar" is true, so in statements such as ... if((pDevice->bwextstep0 = TRUE)&&(param->u.wpa_key.key_index ==1)) ... an assignment is most likely not what was intended - a comparison was. As in: ... if ((pDevice->bwextstep0 == TRUE) && (param->u.wpa_key.key_index == 1)) ... There are a 3 such mistakes in the iwctl_siwencodeext() function. This patch fixes them all. Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index b24e531..5740438 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -1708,15 +1708,15 @@ if(param->u.wpa_key.alg_name == WPA_ALG_NONE) { if(param->u.wpa_key.key_index ==0) { pDevice->bwextstep0 = TRUE; } - if((pDevice->bwextstep0 = TRUE)&&(param->u.wpa_key.key_index ==1)) { + if ((pDevice->bwextstep0 == TRUE) && (param->u.wpa_key.key_index == 1)) { pDevice->bwextstep0 = FALSE; pDevice->bwextstep1 = TRUE; } - if((pDevice->bwextstep1 = TRUE)&&(param->u.wpa_key.key_index ==2)) { + if ((pDevice->bwextstep1 == TRUE) && (param->u.wpa_key.key_index == 2)) { pDevice->bwextstep1 = FALSE; pDevice->bwextstep2 = TRUE; } - if((pDevice->bwextstep2 = TRUE)&&(param->u.wpa_key.key_index ==3)) { + if ((pDevice->bwextstep2 == TRUE)&&(param->u.wpa_key.key_index == 3)) { pDevice->bwextstep2 = FALSE; pDevice->bwextstep3 = TRUE; } -- cgit v0.10.2 From 4bf8172772254a38741de139a355e36eabbb5cb8 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Thu, 21 Jun 2012 19:10:59 +0200 Subject: staging:iio:trigger: Use to_iio_trigger() instead of dev_get_drvdata() Use to_iio_trigger(dev) instead of dev_get_drvdata(dev). Both will return the trigger which belongs to the device, but the the first on is a bit more lightweight. Also this will eventually free up the drvdata pointer of the device for driver specific data. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/trigger/iio-trig-bfin-timer.c b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c index f85734d..ce6a7b1 100644 --- a/drivers/staging/iio/trigger/iio-trig-bfin-timer.c +++ b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c @@ -60,7 +60,7 @@ struct bfin_tmr_state { static ssize_t iio_bfin_tmr_frequency_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct iio_trigger *trig = dev_get_drvdata(dev); + struct iio_trigger *trig = to_iio_trigger(dev); struct bfin_tmr_state *st = trig->private_data; long val; int ret; @@ -97,7 +97,7 @@ static ssize_t iio_bfin_tmr_frequency_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct iio_trigger *trig = dev_get_drvdata(dev); + struct iio_trigger *trig = to_iio_trigger(dev); struct bfin_tmr_state *st = trig->private_data; return sprintf(buf, "%lu\n", diff --git a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c index 9f2d055..4ceaa18 100644 --- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c +++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c @@ -41,7 +41,7 @@ static ssize_t iio_trig_periodic_read_freq(struct device *dev, struct device_attribute *attr, char *buf) { - struct iio_trigger *trig = dev_get_drvdata(dev); + struct iio_trigger *trig = to_iio_trigger(dev); struct iio_prtc_trigger_info *trig_info = trig->private_data; return sprintf(buf, "%u\n", trig_info->frequency); } @@ -51,7 +51,7 @@ static ssize_t iio_trig_periodic_write_freq(struct device *dev, const char *buf, size_t len) { - struct iio_trigger *trig = dev_get_drvdata(dev); + struct iio_trigger *trig = to_iio_trigger(dev); struct iio_prtc_trigger_info *trig_info = trig->private_data; unsigned long val; int ret; diff --git a/drivers/staging/iio/trigger/iio-trig-sysfs.c b/drivers/staging/iio/trigger/iio-trig-sysfs.c index 552763b..fee4746 100644 --- a/drivers/staging/iio/trigger/iio-trig-sysfs.c +++ b/drivers/staging/iio/trigger/iio-trig-sysfs.c @@ -92,7 +92,7 @@ static struct device iio_sysfs_trig_dev = { static ssize_t iio_sysfs_trigger_poll(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct iio_trigger *trig = dev_get_drvdata(dev); + struct iio_trigger *trig = to_iio_trigger(dev); iio_trigger_poll_chained(trig, 0); return count; -- cgit v0.10.2 From 971ff1db41b0f16f34cfdeb9e0460d7dc598e68e Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Thu, 21 Jun 2012 19:11:00 +0200 Subject: iio:trigger: Use to_iio_trigger() instead of dev_get_drvdata() Use to_iio_trigger(dev) instead of dev_get_drvdata(dev). Both will return the trigger which belongs to the device, but the the first on is a bit more lightweight. Since this is the last location where we used dev_get_drvdata() for retrieving the trigger there is no need anymore to assign the the trigger to the devices drvdata, so we can remove that as well. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c index 0f582df..ec653fb 100644 --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c @@ -45,7 +45,7 @@ static ssize_t iio_trigger_read_name(struct device *dev, struct device_attribute *attr, char *buf) { - struct iio_trigger *trig = dev_get_drvdata(dev); + struct iio_trigger *trig = to_iio_trigger(dev); return sprintf(buf, "%s\n", trig->name); } @@ -436,7 +436,6 @@ struct iio_trigger *iio_trigger_alloc(const char *fmt, ...) trig->dev.type = &iio_trig_type; trig->dev.bus = &iio_bus_type; device_initialize(&trig->dev); - dev_set_drvdata(&trig->dev, (void *)trig); mutex_init(&trig->pool_lock); trig->subirq_base -- cgit v0.10.2 From 708706ff290545decbb7f43b533cb247e8ff64fd Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Fri, 22 Jun 2012 09:47:41 +0200 Subject: staging: iio: fix trigger handler of iio_simple_dummy driver accessing first and last channel fails: fakedata[0] is never accessed, out-of-bound access for last channel Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/iio_simple_dummy_buffer.c b/drivers/staging/iio/iio_simple_dummy_buffer.c index fa4939c..d911960 100644 --- a/drivers/staging/iio/iio_simple_dummy_buffer.c +++ b/drivers/staging/iio/iio_simple_dummy_buffer.c @@ -75,9 +75,9 @@ static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p) for (i = 0, j = 0; i < bitmap_weight(indio_dev->active_scan_mask, indio_dev->masklength); - i++) { + i++, j++) { j = find_next_bit(buffer->scan_mask, - indio_dev->masklength, j + 1); + indio_dev->masklength, j); /* random access read from the 'device' */ data[i] = fakedata[j]; len += 2; -- cgit v0.10.2 From 970689f10e7447225eef39ceabd1898daec99553 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Fri, 22 Jun 2012 09:47:42 +0200 Subject: staging: iio: simplify timestamp alignment in iio_simple_dummy Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/iio_simple_dummy_buffer.c b/drivers/staging/iio/iio_simple_dummy_buffer.c index d911960..f4415da 100644 --- a/drivers/staging/iio/iio_simple_dummy_buffer.c +++ b/drivers/staging/iio/iio_simple_dummy_buffer.c @@ -85,8 +85,7 @@ static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p) } /* Store a timestampe at an 8 byte boundary */ if (indio_dev->scan_timestamp) - *(s64 *)(((phys_addr_t)data + len - + sizeof(s64) - 1) & ~(sizeof(s64) - 1)) + *(s64 *)((phys_addr_t)data + ALIGN(len, sizeof(s64))) = iio_get_time_ns(); buffer->access->store_to(buffer, (u8 *)data, pf->timestamp); -- cgit v0.10.2 From 8b32b11c2eb800c636975dbc37e4e11f36790493 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Fri, 22 Jun 2012 09:47:43 +0200 Subject: staging: iio: fix typo, improve timestamp alignment comment Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/iio_simple_dummy_buffer.c b/drivers/staging/iio/iio_simple_dummy_buffer.c index f4415da..b9e6093 100644 --- a/drivers/staging/iio/iio_simple_dummy_buffer.c +++ b/drivers/staging/iio/iio_simple_dummy_buffer.c @@ -83,7 +83,7 @@ static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p) len += 2; } } - /* Store a timestampe at an 8 byte boundary */ + /* Store the timestamp at an 8 byte aligned offset */ if (indio_dev->scan_timestamp) *(s64 *)((phys_addr_t)data + ALIGN(len, sizeof(s64))) = iio_get_time_ns(); -- cgit v0.10.2 From 1c1b86215730ef07d8851c2247b9ecf73038d05d Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Fri, 22 Jun 2012 11:26:04 -0500 Subject: staging: r8712u: Remove useless driver version info This driver contains version information that is outdated, has no real value in terms of the Linux update process, and tends to confuse users. Signed-off-by: Larry Finger Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c index 9bd18e2..f9c32ca 100644 --- a/drivers/staging/rtl8712/usb_intf.c +++ b/drivers/staging/rtl8712/usb_intf.c @@ -41,8 +41,6 @@ #include "usb_ops.h" #include "usb_osintf.h" -#define DRVER "v7_0.20100831" - static struct usb_interface *pintf; static int r871xu_drv_init(struct usb_interface *pusb_intf, @@ -372,7 +370,7 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf, struct net_device *pnetdev; struct usb_device *udev; - printk(KERN_INFO "r8712u: DriverVersion: %s\n", DRVER); + printk(KERN_INFO "r8712u: Staging version\n"); /* In this probe function, O.S. will provide the usb interface pointer * to driver. We have to increase the reference count of the usb device * structure by using the usb_get_dev function. -- cgit v0.10.2 From c90e3e80b9751335cc98934ae32188fa7de6bccd Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Sun, 24 Jun 2012 21:35:29 -0700 Subject: staging: reduce stack usage in prism2fw.c Fix frame size (stack usage) warning by allocating and freeing pointers to the data. drivers/staging/wlan-ng/prism2fw.c:1115:1: warning: the frame size of 4288 bytes is larger than 2048 bytes Signed-off-by: Randy Dunlap Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/wlan-ng/prism2fw.c b/drivers/staging/wlan-ng/prism2fw.c index f13cdc9..66c9aa9 100644 --- a/drivers/staging/wlan-ng/prism2fw.c +++ b/drivers/staging/wlan-ng/prism2fw.c @@ -982,9 +982,8 @@ int writeimage(wlandevice_t *wlandev, struct imgchunk *fchunk, unsigned int nfchunks) { int result = 0; - struct p80211msg_p2req_ramdl_state rstatemsg; - struct p80211msg_p2req_ramdl_write rwritemsg; - struct p80211msg *msgp; + struct p80211msg_p2req_ramdl_state *rstmsg; + struct p80211msg_p2req_ramdl_write *rwrmsg; u32 resultcode; int i; int j; @@ -993,57 +992,68 @@ int writeimage(wlandevice_t *wlandev, struct imgchunk *fchunk, u32 currlen; u32 currdaddr; + rstmsg = kmalloc(sizeof(*rstmsg), GFP_KERNEL); + rwrmsg = kmalloc(sizeof(*rwrmsg), GFP_KERNEL); + if (!rstmsg || !rwrmsg) { + kfree(rstmsg); + kfree(rwrmsg); + printk(KERN_ERR + "writeimage: no memory for firmware download, " + "aborting download\n"); + return -ENOMEM; + } + /* Initialize the messages */ - memset(&rstatemsg, 0, sizeof(rstatemsg)); - strcpy(rstatemsg.devname, wlandev->name); - rstatemsg.msgcode = DIDmsg_p2req_ramdl_state; - rstatemsg.msglen = sizeof(rstatemsg); - rstatemsg.enable.did = DIDmsg_p2req_ramdl_state_enable; - rstatemsg.exeaddr.did = DIDmsg_p2req_ramdl_state_exeaddr; - rstatemsg.resultcode.did = DIDmsg_p2req_ramdl_state_resultcode; - rstatemsg.enable.status = P80211ENUM_msgitem_status_data_ok; - rstatemsg.exeaddr.status = P80211ENUM_msgitem_status_data_ok; - rstatemsg.resultcode.status = P80211ENUM_msgitem_status_no_value; - rstatemsg.enable.len = sizeof(u32); - rstatemsg.exeaddr.len = sizeof(u32); - rstatemsg.resultcode.len = sizeof(u32); - - memset(&rwritemsg, 0, sizeof(rwritemsg)); - strcpy(rwritemsg.devname, wlandev->name); - rwritemsg.msgcode = DIDmsg_p2req_ramdl_write; - rwritemsg.msglen = sizeof(rwritemsg); - rwritemsg.addr.did = DIDmsg_p2req_ramdl_write_addr; - rwritemsg.len.did = DIDmsg_p2req_ramdl_write_len; - rwritemsg.data.did = DIDmsg_p2req_ramdl_write_data; - rwritemsg.resultcode.did = DIDmsg_p2req_ramdl_write_resultcode; - rwritemsg.addr.status = P80211ENUM_msgitem_status_data_ok; - rwritemsg.len.status = P80211ENUM_msgitem_status_data_ok; - rwritemsg.data.status = P80211ENUM_msgitem_status_data_ok; - rwritemsg.resultcode.status = P80211ENUM_msgitem_status_no_value; - rwritemsg.addr.len = sizeof(u32); - rwritemsg.len.len = sizeof(u32); - rwritemsg.data.len = WRITESIZE_MAX; - rwritemsg.resultcode.len = sizeof(u32); + memset(rstmsg, 0, sizeof(*rstmsg)); + strcpy(rstmsg->devname, wlandev->name); + rstmsg->msgcode = DIDmsg_p2req_ramdl_state; + rstmsg->msglen = sizeof(*rstmsg); + rstmsg->enable.did = DIDmsg_p2req_ramdl_state_enable; + rstmsg->exeaddr.did = DIDmsg_p2req_ramdl_state_exeaddr; + rstmsg->resultcode.did = DIDmsg_p2req_ramdl_state_resultcode; + rstmsg->enable.status = P80211ENUM_msgitem_status_data_ok; + rstmsg->exeaddr.status = P80211ENUM_msgitem_status_data_ok; + rstmsg->resultcode.status = P80211ENUM_msgitem_status_no_value; + rstmsg->enable.len = sizeof(u32); + rstmsg->exeaddr.len = sizeof(u32); + rstmsg->resultcode.len = sizeof(u32); + + memset(rwrmsg, 0, sizeof(*rwrmsg)); + strcpy(rwrmsg->devname, wlandev->name); + rwrmsg->msgcode = DIDmsg_p2req_ramdl_write; + rwrmsg->msglen = sizeof(*rwrmsg); + rwrmsg->addr.did = DIDmsg_p2req_ramdl_write_addr; + rwrmsg->len.did = DIDmsg_p2req_ramdl_write_len; + rwrmsg->data.did = DIDmsg_p2req_ramdl_write_data; + rwrmsg->resultcode.did = DIDmsg_p2req_ramdl_write_resultcode; + rwrmsg->addr.status = P80211ENUM_msgitem_status_data_ok; + rwrmsg->len.status = P80211ENUM_msgitem_status_data_ok; + rwrmsg->data.status = P80211ENUM_msgitem_status_data_ok; + rwrmsg->resultcode.status = P80211ENUM_msgitem_status_no_value; + rwrmsg->addr.len = sizeof(u32); + rwrmsg->len.len = sizeof(u32); + rwrmsg->data.len = WRITESIZE_MAX; + rwrmsg->resultcode.len = sizeof(u32); /* Send xxx_state(enable) */ pr_debug("Sending dl_state(enable) message.\n"); - rstatemsg.enable.data = P80211ENUM_truth_true; - rstatemsg.exeaddr.data = startaddr; + rstmsg->enable.data = P80211ENUM_truth_true; + rstmsg->exeaddr.data = startaddr; - msgp = (struct p80211msg *) &rstatemsg; - result = prism2mgmt_ramdl_state(wlandev, msgp); + result = prism2mgmt_ramdl_state(wlandev, rstmsg); if (result) { printk(KERN_ERR "writeimage state enable failed w/ result=%d, " "aborting download\n", result); - return result; + goto free_result; } - resultcode = rstatemsg.resultcode.data; + resultcode = rstmsg->resultcode.data; if (resultcode != P80211ENUM_resultcode_success) { printk(KERN_ERR "writeimage()->xxxdl_state msg indicates failure, " "w/ resultcode=%d, aborting download.\n", resultcode); - return 1; + result = 1; + goto free_result; } /* Now, loop through the data chunks and send WRITESIZE_MAX data */ @@ -1061,9 +1071,9 @@ int writeimage(wlandevice_t *wlandev, struct imgchunk *fchunk, curroff = j * WRITESIZE_MAX; currdaddr = fchunk[i].addr + curroff; /* Setup the message */ - rwritemsg.addr.data = currdaddr; - rwritemsg.len.data = currlen; - memcpy(rwritemsg.data.data, + rwrmsg->addr.data = currdaddr; + rwrmsg->len.data = currlen; + memcpy(rwrmsg->data.data, fchunk[i].data + curroff, currlen); /* Send flashdl_write(pda) */ @@ -1071,23 +1081,23 @@ int writeimage(wlandevice_t *wlandev, struct imgchunk *fchunk, ("Sending xxxdl_write message addr=%06x len=%d.\n", currdaddr, currlen); - msgp = (struct p80211msg *) &rwritemsg; - result = prism2mgmt_ramdl_write(wlandev, msgp); + result = prism2mgmt_ramdl_write(wlandev, rwrmsg); /* Check the results */ if (result) { printk(KERN_ERR "writeimage chunk write failed w/ result=%d, " "aborting download\n", result); - return result; + goto free_result; } - resultcode = rstatemsg.resultcode.data; + resultcode = rstmsg->resultcode.data; if (resultcode != P80211ENUM_resultcode_success) { printk(KERN_ERR "writeimage()->xxxdl_write msg indicates failure, " "w/ resultcode=%d, aborting download.\n", resultcode); - return 1; + result = 1; + goto free_result; } } @@ -1095,24 +1105,28 @@ int writeimage(wlandevice_t *wlandev, struct imgchunk *fchunk, /* Send xxx_state(disable) */ pr_debug("Sending dl_state(disable) message.\n"); - rstatemsg.enable.data = P80211ENUM_truth_false; - rstatemsg.exeaddr.data = 0; + rstmsg->enable.data = P80211ENUM_truth_false; + rstmsg->exeaddr.data = 0; - msgp = (struct p80211msg *) &rstatemsg; - result = prism2mgmt_ramdl_state(wlandev, msgp); + result = prism2mgmt_ramdl_state(wlandev, rstmsg); if (result) { printk(KERN_ERR "writeimage state disable failed w/ result=%d, " "aborting download\n", result); - return result; + goto free_result; } - resultcode = rstatemsg.resultcode.data; + resultcode = rstmsg->resultcode.data; if (resultcode != P80211ENUM_resultcode_success) { printk(KERN_ERR "writeimage()->xxxdl_state msg indicates failure, " "w/ resultcode=%d, aborting download.\n", resultcode); - return 1; + result = 1; + goto free_result; } + +free_result: + kfree(rstmsg); + kfree(rwrmsg); return result; } -- cgit v0.10.2 From 6e2361720b9da9ec830d407da058ca1827e62b12 Mon Sep 17 00:00:00 2001 From: Seth Jennings Date: Mon, 25 Jun 2012 11:14:36 -0500 Subject: staging: zram/zcache: swtich Kconfig dependency from X86 to ZSMALLOC This patch switches zcache and zram dependency to ZSMALLOC rather than X86. There is no net change since ZSMALLOC depends on X86, however, this prevent further changes to these files as zsmalloc dependencies change. Signed-off-by: Seth Jennings Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/zcache/Kconfig b/drivers/staging/zcache/Kconfig index 7048e01..4881839 100644 --- a/drivers/staging/zcache/Kconfig +++ b/drivers/staging/zcache/Kconfig @@ -1,9 +1,6 @@ config ZCACHE bool "Dynamic compression of swap pages and clean pagecache pages" - # X86 dependency is because zsmalloc uses non-portable pte/tlb - # functions - depends on (CLEANCACHE || FRONTSWAP) && CRYPTO=y && X86 - select ZSMALLOC + depends on (CLEANCACHE || FRONTSWAP) && CRYPTO=y && ZSMALLOC=y select CRYPTO_LZO default n help diff --git a/drivers/staging/zram/Kconfig b/drivers/staging/zram/Kconfig index 9d11a4c..be5abe8 100644 --- a/drivers/staging/zram/Kconfig +++ b/drivers/staging/zram/Kconfig @@ -1,9 +1,6 @@ config ZRAM tristate "Compressed RAM block device support" - # X86 dependency is because zsmalloc uses non-portable pte/tlb - # functions - depends on BLOCK && SYSFS && X86 - select ZSMALLOC + depends on BLOCK && SYSFS && ZSMALLOC select LZO_COMPRESS select LZO_DECOMPRESS default n -- cgit v0.10.2 From 7756d3e8b0acff580aab1f60c30e066e20a9900e Mon Sep 17 00:00:00 2001 From: "Justin P. Mattock" Date: Mon, 25 Jun 2012 07:28:25 -0700 Subject: staging: sm7xxfb: Fix typos in sm7xxfb The below patch fixes some typos found in staging "sm7xxfb" while reading through. Signed-off-by: Justin P. Mattock Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index 21dab34..32111a0 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -351,7 +351,7 @@ static int smtc_setcolreg(unsigned regno, unsigned red, unsigned green, case FB_VISUAL_DIRECTCOLOR: case FB_VISUAL_TRUECOLOR: /* - * 16/32 bit true-colour, use pseuo-palette for 16 base color + * 16/32 bit true-colour, use pseudo-palette for 16 base color */ if (regno < 16) { if (sfb->fb.var.bits_per_pixel == 16) { @@ -996,7 +996,7 @@ static int smtcfb_pci_suspend(struct device *device) sfb = pci_get_drvdata(pdev); - /* set the hw in sleep mode use externel clock and self memory refresh + /* set the hw in sleep mode use external clock and self memory refresh * so that we can turn off internal PLLs later on */ smtc_seqw(0x20, (smtc_seqr(0x20) | 0xc0)); -- cgit v0.10.2 From db1db294d9366e95a76f4ca7e6442240eba67a0a Mon Sep 17 00:00:00 2001 From: Samuel Iglesias Gonsalvez Date: Mon, 25 Jun 2012 17:15:44 +0200 Subject: Staging: ipack/devices/ipoctal: fix oops when accessing "buffer" The buffer[][] field was replaced by tty_port->xmit_buf field but there was some places that "buffer" was still accessed, giving a kernel oops because it was uninitialized. Signed-off-by: Samuel Iglesias Gonsalvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/devices/ipoctal.c b/drivers/staging/ipack/devices/ipoctal.c index 2921467..7fe1c93 100644 --- a/drivers/staging/ipack/devices/ipoctal.c +++ b/drivers/staging/ipack/devices/ipoctal.c @@ -46,7 +46,6 @@ struct ipoctal { struct scc2698_channel *chan_regs; struct scc2698_block *block_regs; struct ipoctal_stats chan_stats[NR_CHANNELS]; - char *buffer[NR_CHANNELS]; unsigned int nb_bytes[NR_CHANNELS]; unsigned int count_wr[NR_CHANNELS]; wait_queue_head_t queue[NR_CHANNELS]; @@ -305,7 +304,7 @@ static int ipoctal_irq_handler(void *arg) continue; } spin_lock(&ipoctal->lock[channel]); - value = ipoctal->buffer[channel][*pointer_write]; + value = ipoctal->tty_port[channel].xmit_buf[*pointer_write]; ipoctal_write_io_reg(ipoctal, &ipoctal->chan_regs[channel].u.w.thr, value); -- cgit v0.10.2 From 55c0a6f470517918a996a525325db6a88435c298 Mon Sep 17 00:00:00 2001 From: Samuel Iglesias Gonsalvez Date: Mon, 25 Jun 2012 17:15:45 +0200 Subject: Staging: ipack/devices/ipoctal: remove unneeded includes Signed-off-by: Samuel Iglesias Gonsalvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/devices/ipoctal.c b/drivers/staging/ipack/devices/ipoctal.c index 7fe1c93..b11126d 100644 --- a/drivers/staging/ipack/devices/ipoctal.c +++ b/drivers/staging/ipack/devices/ipoctal.c @@ -13,16 +13,12 @@ #include #include -#include #include -#include -#include #include #include #include #include #include -#include #include #include "../ipack.h" #include "ipoctal.h" -- cgit v0.10.2 From bae8bd165ae3fee0573eb7eb377a479cf26e4277 Mon Sep 17 00:00:00 2001 From: Samuel Iglesias Gonsalvez Date: Mon, 25 Jun 2012 17:15:46 +0200 Subject: Staging: ipack/bridges/tpci200: remove unneeded lock in irq handler Signed-off-by: Samuel Iglesias Gonsalvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c index ae9f803..2b83fa8 100644 --- a/drivers/staging/ipack/bridges/tpci200.c +++ b/drivers/staging/ipack/bridges/tpci200.c @@ -302,13 +302,10 @@ static irqreturn_t tpci200_interrupt(int irq, void *dev_id) { struct tpci200_board *tpci200 = (struct tpci200_board *) dev_id; int i; - unsigned long flags; unsigned short status_reg, reg_value; unsigned short unhandled_ints = 0; irqreturn_t ret = IRQ_NONE; - spin_lock_irqsave(&tpci200->info->access_lock, flags); - /* Read status register */ status_reg = readw(tpci200->info->interface_regs + TPCI200_STATUS_REG); @@ -351,7 +348,6 @@ static irqreturn_t tpci200_interrupt(int irq, void *dev_id) } } - spin_unlock_irqrestore(&tpci200->info->access_lock, flags); return ret; } @@ -414,7 +410,6 @@ static int tpci200_register(struct tpci200_board *tpci200) TPCI200_MEM8_SPACE_BAR), TPCI200_MEM8_SIZE); - spin_lock_init(&tpci200->info->access_lock); ioidint_base = pci_resource_start(tpci200->info->pdev, TPCI200_IO_ID_INT_SPACES_BAR); mem_base = pci_resource_start(tpci200->info->pdev, diff --git a/drivers/staging/ipack/bridges/tpci200.h b/drivers/staging/ipack/bridges/tpci200.h index 97ff0d6..d04510a 100644 --- a/drivers/staging/ipack/bridges/tpci200.h +++ b/drivers/staging/ipack/bridges/tpci200.h @@ -136,7 +136,6 @@ struct tpci200_slot { * @interface_regs Pointer to IP interface space (Bar 2) * @ioidint_space Pointer to IP ID, IO and INT space (Bar 3) * @mem8_space Pointer to MEM space (Bar 4) - * @access_lock Mutex lock for simultaneous access * */ struct tpci200_infos { @@ -145,7 +144,6 @@ struct tpci200_infos { void __iomem *interface_regs; void __iomem *ioidint_space; void __iomem *mem8_space; - spinlock_t access_lock; struct ipack_bus_device *ipack_bus; }; struct tpci200_board { -- cgit v0.10.2 From 59d6a29e554d891a513476c13a6657825f8be270 Mon Sep 17 00:00:00 2001 From: Samuel Iglesias Gonsalvez Date: Mon, 25 Jun 2012 17:15:47 +0200 Subject: Staging: ipack/devices/ipoctal: remove unneeded lock in IRQ handler In the rest of the code, the data is protected with spin_lock_irqsave(). Signed-off-by: Samuel Iglesias Gonsalvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/devices/ipoctal.c b/drivers/staging/ipack/devices/ipoctal.c index b11126d..ec7b2f9 100644 --- a/drivers/staging/ipack/devices/ipoctal.c +++ b/drivers/staging/ipack/devices/ipoctal.c @@ -299,7 +299,7 @@ static int ipoctal_irq_handler(void *arg) ipoctal->nb_bytes[channel] = 0; continue; } - spin_lock(&ipoctal->lock[channel]); + value = ipoctal->tty_port[channel].xmit_buf[*pointer_write]; ipoctal_write_io_reg(ipoctal, &ipoctal->chan_regs[channel].u.w.thr, @@ -309,7 +309,6 @@ static int ipoctal_irq_handler(void *arg) (*pointer_write)++; *pointer_write = *pointer_write % PAGE_SIZE; ipoctal->nb_bytes[channel]--; - spin_unlock(&ipoctal->lock[channel]); if ((ipoctal->nb_bytes[channel] == 0) && (waitqueue_active(&ipoctal->queue[channel]))) { -- cgit v0.10.2 From f5e3352e5185ef37700da9a51c333559381fe8fd Mon Sep 17 00:00:00 2001 From: Marc Dietrich Date: Sun, 24 Jun 2012 23:25:16 +0200 Subject: staging: nvec: convert to devm_ functions This patch cleanups the nvec and its childs by replacing calls to resource allocations by their devm_* equivalents. Signed-off-by: Marc Dietrich Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index 3c60088..47ffdb8 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c @@ -719,10 +719,9 @@ static int __devinit tegra_nvec_probe(struct platform_device *pdev) struct nvec_chip *nvec; struct nvec_msg *msg; struct resource *res; - struct resource *iomem; void __iomem *base; - nvec = kzalloc(sizeof(struct nvec_chip), GFP_KERNEL); + nvec = devm_kzalloc(&pdev->dev, sizeof(struct nvec_chip), GFP_KERNEL); if (nvec == NULL) { dev_err(&pdev->dev, "failed to reserve memory\n"); return -ENOMEM; @@ -737,15 +736,15 @@ static int __devinit tegra_nvec_probe(struct platform_device *pdev) nvec->gpio = of_get_named_gpio(nvec->dev->of_node, "request-gpios", 0); if (nvec->gpio < 0) { dev_err(&pdev->dev, "no gpio specified"); - goto failed; + return -ENODEV; } if (of_property_read_u32(nvec->dev->of_node, "slave-addr", &nvec->i2c_addr)) { dev_err(&pdev->dev, "no i2c address specified"); - goto failed; + return -ENODEV; } } else { dev_err(&pdev->dev, "no platform data\n"); - goto failed; + return -ENODEV; } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -754,13 +753,7 @@ static int __devinit tegra_nvec_probe(struct platform_device *pdev) return -ENODEV; } - iomem = request_mem_region(res->start, resource_size(res), pdev->name); - if (!iomem) { - dev_err(&pdev->dev, "I2C region already claimed\n"); - return -EBUSY; - } - - base = ioremap(iomem->start, resource_size(iomem)); + base = devm_request_and_ioremap(&pdev->dev, res); if (!base) { dev_err(&pdev->dev, "Can't ioremap I2C region\n"); return -ENOMEM; @@ -769,14 +762,13 @@ static int __devinit tegra_nvec_probe(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (!res) { dev_err(&pdev->dev, "no irq resource?\n"); - ret = -ENODEV; - goto err_iounmap; + return -ENODEV; } i2c_clk = clk_get_sys("tegra-i2c.2", NULL); if (IS_ERR(i2c_clk)) { dev_err(nvec->dev, "failed to get controller clock\n"); - goto err_iounmap; + return -ENODEV; } nvec->base = base; @@ -797,16 +789,20 @@ static int __devinit tegra_nvec_probe(struct platform_device *pdev) INIT_WORK(&nvec->tx_work, nvec_request_master); nvec->wq = alloc_workqueue("nvec", WQ_NON_REENTRANT, 2); - err = gpio_request_one(nvec->gpio, GPIOF_OUT_INIT_HIGH, "nvec gpio"); + err = devm_gpio_request_one(&pdev->dev, nvec->gpio, GPIOF_OUT_INIT_HIGH, + "nvec gpio"); if (err < 0) { dev_err(nvec->dev, "couldn't request gpio\n"); - goto failed; + destroy_workqueue(nvec->wq); + return -ENODEV; } - err = request_irq(nvec->irq, nvec_interrupt, 0, "nvec", nvec); + err = devm_request_irq(&pdev->dev, nvec->irq, nvec_interrupt, 0, + "nvec", nvec); if (err) { dev_err(nvec->dev, "couldn't request irq\n"); - goto failed; + destroy_workqueue(nvec->wq); + return -ENODEV; } disable_irq(nvec->irq); @@ -851,12 +847,6 @@ static int __devinit tegra_nvec_probe(struct platform_device *pdev) nvec_write_async(nvec, "\x01\x01\x01\x00\x00\x80\x00", 7); return 0; - -err_iounmap: - iounmap(base); -failed: - kfree(nvec); - return -ENOMEM; } static int __devexit tegra_nvec_remove(struct platform_device *pdev) @@ -865,11 +855,7 @@ static int __devexit tegra_nvec_remove(struct platform_device *pdev) nvec_write_async(nvec, EC_DISABLE_EVENT_REPORTING, 3); mfd_remove_devices(nvec->dev); - free_irq(nvec->irq, &nvec_interrupt); - iounmap(nvec->base); - gpio_free(nvec->gpio); destroy_workqueue(nvec->wq); - kfree(nvec); return 0; } diff --git a/drivers/staging/nvec/nvec_leds.c b/drivers/staging/nvec/nvec_leds.c index f4cbcd6..91947fb 100644 --- a/drivers/staging/nvec/nvec_leds.c +++ b/drivers/staging/nvec/nvec_leds.c @@ -49,7 +49,7 @@ static int __devinit nvec_led_probe(struct platform_device *pdev) struct nvec_led *led; int ret = 0; - led = kzalloc(sizeof(*led), GFP_KERNEL); + led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL); if (led == NULL) return -ENOMEM; @@ -64,16 +64,12 @@ static int __devinit nvec_led_probe(struct platform_device *pdev) ret = led_classdev_register(&pdev->dev, &led->cdev); if (ret < 0) - goto err_led; + return ret; /* to expose the default value to userspace */ led->cdev.brightness = 0; return 0; - -err_led: - kfree(led); - return ret; } static int __devexit nvec_led_remove(struct platform_device *pdev) @@ -81,7 +77,7 @@ static int __devexit nvec_led_remove(struct platform_device *pdev) struct nvec_led *led = platform_get_drvdata(pdev); led_classdev_unregister(&led->cdev); - kfree(led); + return 0; } diff --git a/drivers/staging/nvec/nvec_power.c b/drivers/staging/nvec/nvec_power.c index dfa966f..a23e548 100644 --- a/drivers/staging/nvec/nvec_power.c +++ b/drivers/staging/nvec/nvec_power.c @@ -371,10 +371,13 @@ static void nvec_power_poll(struct work_struct *work) static int __devinit nvec_power_probe(struct platform_device *pdev) { struct power_supply *psy; - struct nvec_power *power = - kzalloc(sizeof(struct nvec_power), GFP_NOWAIT); + struct nvec_power *power; struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); + power = devm_kzalloc(&pdev->dev, sizeof(struct nvec_power), GFP_NOWAIT); + if (power == NULL) + return -ENOMEM; + dev_set_drvdata(&pdev->dev, power); power->nvec = nvec; @@ -393,7 +396,6 @@ static int __devinit nvec_power_probe(struct platform_device *pdev) power->notifier.notifier_call = nvec_power_bat_notifier; break; default: - kfree(power); return -ENODEV; } diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c index 14a6f68..d6ceff9 100644 --- a/drivers/staging/nvec/nvec_ps2.c +++ b/drivers/staging/nvec/nvec_ps2.c @@ -96,7 +96,11 @@ static int nvec_ps2_notifier(struct notifier_block *nb, static int __devinit nvec_mouse_probe(struct platform_device *pdev) { struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); - struct serio *ser_dev = kzalloc(sizeof(struct serio), GFP_KERNEL); + struct serio *ser_dev; + + ser_dev = devm_kzalloc(&pdev->dev, sizeof(struct serio), GFP_KERNEL); + if (ser_dev == NULL) + return -ENOMEM; ser_dev->id.type = SERIO_PS_PSTHRU; ser_dev->write = ps2_sendcommand; -- cgit v0.10.2 From 50d4656a2304e48917a8e2b9df99f69d50b8a0aa Mon Sep 17 00:00:00 2001 From: Marc Dietrich Date: Sun, 24 Jun 2012 23:25:17 +0200 Subject: staging: nvec: use dev_warn instead of printk Replace a printk in nvec core driver with dev_warn. Signed-off-by: Marc Dietrich Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index 47ffdb8..39dbaa0 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c @@ -127,12 +127,14 @@ EXPORT_SYMBOL_GPL(nvec_register_notifier); static int nvec_status_notifier(struct notifier_block *nb, unsigned long event_type, void *data) { + struct nvec_chip *nvec = container_of(nb, struct nvec_chip, + nvec_status_notifier); unsigned char *msg = (unsigned char *)data; if (event_type != NVEC_CNTL) return NOTIFY_DONE; - printk(KERN_WARNING "unhandled msg type %ld\n", event_type); + dev_warn(nvec->dev, "unhandled msg type %ld\n", event_type); print_hex_dump(KERN_WARNING, "payload: ", DUMP_PREFIX_NONE, 16, 1, msg, msg[1] + 2, true); -- cgit v0.10.2 From 9891b1ce6276912c54f66b7b0c8c1bcc42ca75eb Mon Sep 17 00:00:00 2001 From: Marc Dietrich Date: Sun, 24 Jun 2012 23:25:18 +0200 Subject: staging: nvec: cleanup driver registration This patch simplifies code by using the module_platform_driver macro. Signed-off-by: Marc Dietrich Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index 39dbaa0..09b7e12 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c @@ -917,12 +917,7 @@ static struct platform_driver nvec_device_driver = { } }; -static int __init tegra_nvec_init(void) -{ - return platform_driver_register(&nvec_device_driver); -} - -module_init(tegra_nvec_init); +module_platform_driver(nvec_device_driver); MODULE_ALIAS("platform:nvec"); MODULE_DESCRIPTION("NVIDIA compliant embedded controller interface"); diff --git a/drivers/staging/nvec/nvec_kbd.c b/drivers/staging/nvec/nvec_kbd.c index a4ce5a7..36ef6a6 100644 --- a/drivers/staging/nvec/nvec_kbd.c +++ b/drivers/staging/nvec/nvec_kbd.c @@ -167,12 +167,7 @@ static struct platform_driver nvec_kbd_driver = { }, }; -static int __init nvec_kbd_init(void) -{ - return platform_driver_register(&nvec_kbd_driver); -} - -module_init(nvec_kbd_init); +module_platform_driver(nvec_kbd_driver); MODULE_AUTHOR("Marc Dietrich "); MODULE_DESCRIPTION("NVEC keyboard driver"); diff --git a/drivers/staging/nvec/nvec_leds.c b/drivers/staging/nvec/nvec_leds.c index 91947fb..53cb5711 100644 --- a/drivers/staging/nvec/nvec_leds.c +++ b/drivers/staging/nvec/nvec_leds.c @@ -90,19 +90,7 @@ static struct platform_driver nvec_led_driver = { }, }; -static int __init nvec_led_init(void) -{ - return platform_driver_register(&nvec_led_driver); -} - -module_init(nvec_led_init); - -static void __exit nvec_led_exit(void) -{ - platform_driver_unregister(&nvec_led_driver); -} - -module_exit(nvec_led_exit); +module_platform_driver(nvec_led_driver); MODULE_AUTHOR("Ilya Petrov "); MODULE_DESCRIPTION("Tegra NVEC LED driver"); diff --git a/drivers/staging/nvec/nvec_power.c b/drivers/staging/nvec/nvec_power.c index a23e548..063f6d5 100644 --- a/drivers/staging/nvec/nvec_power.c +++ b/drivers/staging/nvec/nvec_power.c @@ -415,12 +415,7 @@ static struct platform_driver nvec_power_driver = { } }; -static int __init nvec_power_init(void) -{ - return platform_driver_register(&nvec_power_driver); -} - -module_init(nvec_power_init); +module_platform_driver(nvec_power_driver); MODULE_AUTHOR("Ilya Petrov "); MODULE_LICENSE("GPL"); diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c index d6ceff9..441dd76 100644 --- a/drivers/staging/nvec/nvec_ps2.c +++ b/drivers/staging/nvec/nvec_ps2.c @@ -158,12 +158,7 @@ static struct platform_driver nvec_mouse_driver = { }, }; -static int __init nvec_mouse_init(void) -{ - return platform_driver_register(&nvec_mouse_driver); -} - -module_init(nvec_mouse_init); +module_platform_driver(nvec_mouse_driver); MODULE_DESCRIPTION("NVEC mouse driver"); MODULE_AUTHOR("Marc Dietrich "); -- cgit v0.10.2 From ebefae28cea729cb1fa9c944179f62d7dd65b10f Mon Sep 17 00:00:00 2001 From: Marc Dietrich Date: Sun, 24 Jun 2012 23:25:19 +0200 Subject: staging: nvec: cleanup powermanagement callbacks Simplify powermanagement initialization by using pm_ops macro. Signed-off-by: Marc Dietrich Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index 09b7e12..221bc05 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c @@ -700,12 +700,14 @@ static void tegra_init_i2c_slave(struct nvec_chip *nvec) clk_disable(nvec->i2c_clk); } +#ifdef CONFIG_PM_SLEEP static void nvec_disable_i2c_slave(struct nvec_chip *nvec) { disable_irq(nvec->irq); writel(I2C_SL_NEWSL | I2C_SL_NACK, nvec->base + I2C_SL_CNFG); clk_disable(nvec->i2c_clk); } +#endif static void nvec_power_off(void) { @@ -862,10 +864,10 @@ static int __devexit tegra_nvec_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM - -static int tegra_nvec_suspend(struct platform_device *pdev, pm_message_t state) +#ifdef CONFIG_PM_SLEEP +static int nvec_suspend(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); struct nvec_chip *nvec = platform_get_drvdata(pdev); struct nvec_msg *msg; @@ -882,8 +884,9 @@ static int tegra_nvec_suspend(struct platform_device *pdev, pm_message_t state) return 0; } -static int tegra_nvec_resume(struct platform_device *pdev) +static int nvec_resume(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); struct nvec_chip *nvec = platform_get_drvdata(pdev); dev_dbg(nvec->dev, "resuming\n"); @@ -892,12 +895,10 @@ static int tegra_nvec_resume(struct platform_device *pdev) return 0; } - -#else -#define tegra_nvec_suspend NULL -#define tegra_nvec_resume NULL #endif +static const SIMPLE_DEV_PM_OPS(nvec_pm_ops, nvec_suspend, nvec_resume); + /* Match table for of_platform binding */ static const struct of_device_id nvidia_nvec_of_match[] __devinitconst = { { .compatible = "nvidia,nvec", }, @@ -908,11 +909,10 @@ MODULE_DEVICE_TABLE(of, nvidia_nvec_of_match); static struct platform_driver nvec_device_driver = { .probe = tegra_nvec_probe, .remove = __devexit_p(tegra_nvec_remove), - .suspend = tegra_nvec_suspend, - .resume = tegra_nvec_resume, .driver = { .name = "nvec", .owner = THIS_MODULE, + .pm = &nvec_pm_ops, .of_match_table = nvidia_nvec_of_match, } }; diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c index 441dd76..2481df2 100644 --- a/drivers/staging/nvec/nvec_ps2.c +++ b/drivers/staging/nvec/nvec_ps2.c @@ -123,8 +123,10 @@ static int __devinit nvec_mouse_probe(struct platform_device *pdev) return 0; } -static int nvec_mouse_suspend(struct platform_device *pdev, pm_message_t state) +#ifdef CONFIG_PM_SLEEP +static int nvec_mouse_suspend(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); /* disable mouse */ @@ -136,8 +138,9 @@ static int nvec_mouse_suspend(struct platform_device *pdev, pm_message_t state) return 0; } -static int nvec_mouse_resume(struct platform_device *pdev) +static int nvec_mouse_resume(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); ps2_startstreaming(ps2_dev.ser_dev); @@ -147,14 +150,17 @@ static int nvec_mouse_resume(struct platform_device *pdev) return 0; } +#endif + +static const SIMPLE_DEV_PM_OPS(nvec_mouse_pm_ops, nvec_mouse_suspend, + nvec_mouse_resume); static struct platform_driver nvec_mouse_driver = { .probe = nvec_mouse_probe, - .suspend = nvec_mouse_suspend, - .resume = nvec_mouse_resume, .driver = { .name = "nvec-mouse", .owner = THIS_MODULE, + .pm = &nvec_mouse_pm_ops, }, }; -- cgit v0.10.2 From ac562680577a28fa98ebecebff5e5097ccf9a9d2 Mon Sep 17 00:00:00 2001 From: Marc Dietrich Date: Sun, 24 Jun 2012 23:25:20 +0200 Subject: staging: nvec: rename led driver to board specific paz00 driver The led driver used OEM commands which are not part of the nvec protocol definition. Therefore it is renamed to nvec_paz00 to reflect that it only applies to PAZ00 board based devices. Signed-off-by: Marc Dietrich Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/nvec/Kconfig b/drivers/staging/nvec/Kconfig index 731301f..43048e9 100644 --- a/drivers/staging/nvec/Kconfig +++ b/drivers/staging/nvec/Kconfig @@ -26,8 +26,9 @@ config NVEC_POWER Say Y to enable support for battery and charger interface for nVidia compliant embedded controllers. -config NVEC_LEDS - bool "NVEC leds" - depends on MFD_NVEC && LEDS_CLASS +config NVEC_PAZ00 + bool "Support for OEM specific functions on Compal PAZ00 based devices" + depends on MFD_NVEC && LEDS_CLASS && MACH_PAZ00 help - Say Y to enable yellow side leds on AC100 or other nVidia tegra nvec leds + Say Y to enable control of the yellow side leds on Compal PAZ00 based + devices, e.g. Toshbia AC100 and Dynabooks AZ netbooks. diff --git a/drivers/staging/nvec/Makefile b/drivers/staging/nvec/Makefile index b844d60..0db0e1f 100644 --- a/drivers/staging/nvec/Makefile +++ b/drivers/staging/nvec/Makefile @@ -2,4 +2,4 @@ obj-$(CONFIG_SERIO_NVEC_PS2) += nvec_ps2.o obj-$(CONFIG_MFD_NVEC) += nvec.o obj-$(CONFIG_NVEC_POWER) += nvec_power.o obj-$(CONFIG_KEYBOARD_NVEC) += nvec_kbd.o -obj-$(CONFIG_NVEC_LEDS) += nvec_leds.o +obj-$(CONFIG_NVEC_PAZ00) += nvec_paz00.o diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index 221bc05..0f2b541 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c @@ -97,7 +97,7 @@ static struct mfd_cell nvec_devices[] = { .id = 2, }, { - .name = "nvec-leds", + .name = "nvec-paz00", .id = 1, }, }; diff --git a/drivers/staging/nvec/nvec_leds.c b/drivers/staging/nvec/nvec_leds.c deleted file mode 100644 index 53cb5711..0000000 --- a/drivers/staging/nvec/nvec_leds.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * nvec_leds: LED driver for a NVIDIA compliant embedded controller - * - * Copyright (C) 2011 The AC100 Kernel Team - * - * Authors: Ilya Petrov - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - */ - -#include -#include -#include -#include -#include -#include "nvec.h" - -#define to_nvec_led(led_cdev) \ - container_of(led_cdev, struct nvec_led, cdev) - -#define NVEC_LED_REQ {'\x0d', '\x10', '\x45', '\x10', '\x00'} - -#define NVEC_LED_MAX 8 - -struct nvec_led { - struct led_classdev cdev; - struct nvec_chip *nvec; -}; - -static void nvec_led_brightness_set(struct led_classdev *led_cdev, - enum led_brightness value) -{ - struct nvec_led *led = to_nvec_led(led_cdev); - unsigned char buf[] = NVEC_LED_REQ; - buf[4] = value; - - nvec_write_async(led->nvec, buf, sizeof(buf)); - - led->cdev.brightness = value; - -} - -static int __devinit nvec_led_probe(struct platform_device *pdev) -{ - struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); - struct nvec_led *led; - int ret = 0; - - led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL); - if (led == NULL) - return -ENOMEM; - - led->cdev.max_brightness = NVEC_LED_MAX; - - led->cdev.brightness_set = nvec_led_brightness_set; - led->cdev.name = "nvec-led"; - led->cdev.flags |= LED_CORE_SUSPENDRESUME; - led->nvec = nvec; - - platform_set_drvdata(pdev, led); - - ret = led_classdev_register(&pdev->dev, &led->cdev); - if (ret < 0) - return ret; - - /* to expose the default value to userspace */ - led->cdev.brightness = 0; - - return 0; -} - -static int __devexit nvec_led_remove(struct platform_device *pdev) -{ - struct nvec_led *led = platform_get_drvdata(pdev); - - led_classdev_unregister(&led->cdev); - - return 0; -} - -static struct platform_driver nvec_led_driver = { - .probe = nvec_led_probe, - .remove = __devexit_p(nvec_led_remove), - .driver = { - .name = "nvec-leds", - .owner = THIS_MODULE, - }, -}; - -module_platform_driver(nvec_led_driver); - -MODULE_AUTHOR("Ilya Petrov "); -MODULE_DESCRIPTION("Tegra NVEC LED driver"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:nvec-leds"); diff --git a/drivers/staging/nvec/nvec_paz00.c b/drivers/staging/nvec/nvec_paz00.c new file mode 100644 index 0000000..b747e39 --- /dev/null +++ b/drivers/staging/nvec/nvec_paz00.c @@ -0,0 +1,98 @@ +/* + * nvec_paz00: OEM specific driver for Compal PAZ00 based devices + * + * Copyright (C) 2011 The AC100 Kernel Team + * + * Authors: Ilya Petrov + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + */ + +#include +#include +#include +#include +#include +#include "nvec.h" + +#define to_nvec_led(led_cdev) \ + container_of(led_cdev, struct nvec_led, cdev) + +#define NVEC_LED_REQ {'\x0d', '\x10', '\x45', '\x10', '\x00'} + +#define NVEC_LED_MAX 8 + +struct nvec_led { + struct led_classdev cdev; + struct nvec_chip *nvec; +}; + +static void nvec_led_brightness_set(struct led_classdev *led_cdev, + enum led_brightness value) +{ + struct nvec_led *led = to_nvec_led(led_cdev); + unsigned char buf[] = NVEC_LED_REQ; + buf[4] = value; + + nvec_write_async(led->nvec, buf, sizeof(buf)); + + led->cdev.brightness = value; + +} + +static int __devinit nvec_paz00_probe(struct platform_device *pdev) +{ + struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); + struct nvec_led *led; + int ret = 0; + + led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL); + if (led == NULL) + return -ENOMEM; + + led->cdev.max_brightness = NVEC_LED_MAX; + + led->cdev.brightness_set = nvec_led_brightness_set; + led->cdev.name = "paz00-led"; + led->cdev.flags |= LED_CORE_SUSPENDRESUME; + led->nvec = nvec; + + platform_set_drvdata(pdev, led); + + ret = led_classdev_register(&pdev->dev, &led->cdev); + if (ret < 0) + return ret; + + /* to expose the default value to userspace */ + led->cdev.brightness = 0; + + return 0; +} + +static int __devexit nvec_paz00_remove(struct platform_device *pdev) +{ + struct nvec_led *led = platform_get_drvdata(pdev); + + led_classdev_unregister(&led->cdev); + + return 0; +} + +static struct platform_driver nvec_paz00_driver = { + .probe = nvec_paz00_probe, + .remove = __devexit_p(nvec_paz00_remove), + .driver = { + .name = "nvec-paz00", + .owner = THIS_MODULE, + }, +}; + +module_platform_driver(nvec_paz00_driver); + +MODULE_AUTHOR("Ilya Petrov "); +MODULE_DESCRIPTION("Tegra NVEC PAZ00 driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:nvec-paz00"); -- cgit v0.10.2 From 3cdde3a3d55e64e6d1ae3465701c8d9f226775f3 Mon Sep 17 00:00:00 2001 From: Marc Dietrich Date: Sun, 24 Jun 2012 23:25:21 +0200 Subject: staging: nvec: add remove function to nvec childs This patch cleanups registered devices on remove. Signed-off-by: Marc Dietrich Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/nvec/nvec_kbd.c b/drivers/staging/nvec/nvec_kbd.c index 36ef6a6..6cc30dc 100644 --- a/drivers/staging/nvec/nvec_kbd.c +++ b/drivers/staging/nvec/nvec_kbd.c @@ -159,8 +159,17 @@ fail: return err; } +static int __devexit nvec_kbd_remove(struct platform_device *pdev) +{ + input_unregister_device(keys_dev.input); + input_free_device(keys_dev.input); + + return 0; +} + static struct platform_driver nvec_kbd_driver = { .probe = nvec_kbd_probe, + .remove = __devexit_p(nvec_kbd_remove), .driver = { .name = "nvec-kbd", .owner = THIS_MODULE, diff --git a/drivers/staging/nvec/nvec_power.c b/drivers/staging/nvec/nvec_power.c index 063f6d5..cc8ccd7 100644 --- a/drivers/staging/nvec/nvec_power.c +++ b/drivers/staging/nvec/nvec_power.c @@ -407,8 +407,25 @@ static int __devinit nvec_power_probe(struct platform_device *pdev) return power_supply_register(&pdev->dev, psy); } +static int __devexit nvec_power_remove(struct platform_device *pdev) +{ + struct nvec_power *power = platform_get_drvdata(pdev); + + cancel_delayed_work_sync(&power->poller); + switch (pdev->id) { + case AC: + power_supply_unregister(&nvec_psy); + break; + case BAT: + power_supply_unregister(&nvec_bat_psy); + } + + return 0; +} + static struct platform_driver nvec_power_driver = { .probe = nvec_power_probe, + .remove = __devexit_p(nvec_power_remove), .driver = { .name = "nvec-power", .owner = THIS_MODULE, diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c index 2481df2..d7c6511 100644 --- a/drivers/staging/nvec/nvec_ps2.c +++ b/drivers/staging/nvec/nvec_ps2.c @@ -123,6 +123,13 @@ static int __devinit nvec_mouse_probe(struct platform_device *pdev) return 0; } +static int __devexit nvec_mouse_remove(struct platform_device *pdev) +{ + serio_unregister_port(ps2_dev.ser_dev); + + return 0; +} + #ifdef CONFIG_PM_SLEEP static int nvec_mouse_suspend(struct device *dev) { @@ -157,6 +164,7 @@ static const SIMPLE_DEV_PM_OPS(nvec_mouse_pm_ops, nvec_mouse_suspend, static struct platform_driver nvec_mouse_driver = { .probe = nvec_mouse_probe, + .remove = __devexit_p(nvec_mouse_remove), .driver = { .name = "nvec-mouse", .owner = THIS_MODULE, -- cgit v0.10.2 From 4c0ad72f01e358a8fa9ece655e9918d7c864e1a6 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Mon, 25 Jun 2012 01:55:54 +0200 Subject: staging: vt6656: iwctl: Remove redundant blank lines There are a number of excessive blank lines in iwctl.c - this patch gets rid of most of those that I personally considered the most obvious ones. Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index 5740438..9a49fa9 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -81,14 +81,12 @@ struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev) pDevice->wstats.discard.retries = pDevice->scStatistic.dwTsrErr; pDevice->wstats.discard.misc = 0; pDevice->wstats.miss.beacon = 0; - return &pDevice->wstats; } /* * Wireless Handler : get protocol name */ - int iwctl_giwname(struct net_device *dev, struct iw_request_info *info, char *wrq, @@ -101,7 +99,6 @@ int iwctl_giwname(struct net_device *dev, /* * Wireless Handler : set scan */ - int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, @@ -176,7 +173,6 @@ if(pDevice->byReAssocCount > 0) { //reject scan when re-associating! /* * Wireless Handler : get scan results */ - int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, @@ -320,17 +316,13 @@ int iwctl_giwscan(struct net_device *dev, } }// for - wrq->length = current_ev - extra; return 0; - } - /* * Wireless Handler : set frequence or channel */ - int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *wrq, @@ -373,7 +365,6 @@ int iwctl_siwfreq(struct net_device *dev, /* * Wireless Handler : get frequence or channel */ - int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *wrq, @@ -396,14 +387,12 @@ int iwctl_giwfreq(struct net_device *dev, wrq->e = 1; } #endif - return 0; } /* * Wireless Handler : set operation mode */ - int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, __u32 *wmode, @@ -470,7 +459,6 @@ int iwctl_siwmode(struct net_device *dev, /* * Wireless Handler : get operation mode */ - void iwctl_giwmode(struct net_device *dev, struct iw_request_info *info, __u32 *wmode, @@ -500,11 +488,9 @@ void iwctl_giwmode(struct net_device *dev, } } - /* * Wireless Handler : get capability range */ - void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, @@ -556,7 +542,6 @@ void iwctl_giwrange(struct net_device *dev, range->min_frag = 256; range->max_frag = 2312; - // the encoding capabilities range->num_encoding_sizes = 3; // 64(40) bits WEP @@ -580,7 +565,6 @@ void iwctl_giwrange(struct net_device *dev, range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_ALL_R; // Transmit Power - values are in mW - range->txpower[0] = 100; range->num_txpower = 1; range->txpower_capa = IW_TXPOW_MWATT; @@ -602,11 +586,9 @@ void iwctl_giwrange(struct net_device *dev, } } - /* * Wireless Handler : set ap mac address */ - int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *wrq, @@ -623,7 +605,6 @@ int iwctl_siwap(struct net_device *dev, rc = -EINVAL; else { memcpy(pMgmt->abyDesireBSSID, wrq->sa_data, 6); - //mike :add if ((is_broadcast_ether_addr(pMgmt->abyDesireBSSID)) || (memcmp(pMgmt->abyDesireBSSID, ZeroBSSID, 6) == 0)){ @@ -657,7 +638,6 @@ int iwctl_siwap(struct net_device *dev, /* * Wireless Handler : get ap mac address */ - int iwctl_giwap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *wrq, @@ -666,7 +646,6 @@ int iwctl_giwap(struct net_device *dev, PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP \n"); memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6); @@ -679,16 +658,12 @@ int iwctl_giwap(struct net_device *dev, } wrq->sa_family = ARPHRD_ETHER; - return 0; - } - /* * Wireless Handler : get ap list */ - int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, @@ -700,7 +675,6 @@ int iwctl_giwaplist(struct net_device *dev, PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAPLIST \n"); // Only super-user can see AP list @@ -710,7 +684,6 @@ int iwctl_giwaplist(struct net_device *dev, } if (wrq->pointer) { - PKnownBSS pBSS = &(pMgmt->sBSSList[0]); for (ii = 0, jj= 0; ii < MAX_BSS_NUM; ii++) { @@ -732,11 +705,9 @@ int iwctl_giwaplist(struct net_device *dev, memcpy(extra, sock, sizeof(struct sockaddr)*jj); memcpy(extra + sizeof(struct sockaddr)*jj, qual, sizeof(struct iw_quality)*jj); } - return rc; } - /* * Wireless Handler : set essid */ @@ -847,12 +818,9 @@ int iwctl_siwessid(struct net_device *dev, if (pDevice->flags & DEVICE_FLAGS_OPENED) { pDevice->bCommit = TRUE; } - - return 0; } - /* * Wireless Handler : get essid */ @@ -861,7 +829,6 @@ void iwctl_giwessid(struct net_device *dev, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PWLAN_IE_SSID pItemSSID; @@ -883,7 +850,6 @@ void iwctl_giwessid(struct net_device *dev, /* * Wireless Handler : set data rate */ - int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, @@ -1005,8 +971,6 @@ void iwctl_giwrate(struct net_device *dev, } } - - /* * Wireless Handler : set rts threshold */ @@ -1020,7 +984,6 @@ int iwctl_siwrts(struct net_device *dev, else if (wrq->disabled) pDevice->wRTSThreshold = 2312; - else pDevice->wRTSThreshold = wrq->value; @@ -1030,7 +993,6 @@ int iwctl_siwrts(struct net_device *dev, /* * Wireless Handler : get rts */ - int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, @@ -1049,7 +1011,6 @@ int iwctl_giwrts(struct net_device *dev, /* * Wireless Handler : set fragment threshold */ - int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, @@ -1059,10 +1020,8 @@ int iwctl_siwfrag(struct net_device *dev, int rc = 0; int fthr = wrq->value; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFRAG \n"); - if (wrq->disabled) fthr = 2312; if((fthr < 256) || (fthr > 2312)) { @@ -1071,7 +1030,6 @@ int iwctl_siwfrag(struct net_device *dev, fthr &= ~0x1; // Get an even value pDevice->wFragmentationThreshold = (u16)fthr; } - return rc; } @@ -1094,8 +1052,6 @@ int iwctl_giwfrag(struct net_device *dev, return 0; } - - /* * Wireless Handler : set retry threshold */ @@ -1107,7 +1063,6 @@ int iwctl_siwretry(struct net_device *dev, PSDevice pDevice = (PSDevice)netdev_priv(dev); int rc = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRETRY \n"); if (wrq->disabled) { @@ -1129,8 +1084,6 @@ int iwctl_siwretry(struct net_device *dev, if (wrq->flags & IW_RETRY_LIFETIME) { pDevice->wMaxTransmitMSDULifetime = wrq->value; } - - return rc; } @@ -1160,11 +1113,9 @@ int iwctl_giwretry(struct net_device *dev, wrq->flags |= IW_RETRY_MIN; } - return 0; } - /* * Wireless Handler : set encode mode */ @@ -1179,7 +1130,6 @@ int iwctl_siwencode(struct net_device *dev, int ii,uu, rc = 0; int index = (wrq->flags & IW_ENCODE_INDEX); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE \n"); // Check the size of the key @@ -1268,7 +1218,6 @@ int iwctl_siwencode(struct net_device *dev, #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT memset(pMgmt->abyDesireBSSID, 0xFF,6); #endif - return rc; } @@ -1326,11 +1275,9 @@ int iwctl_giwencode(struct net_device *dev, } wrq->flags |= index+1; - return 0; } - /* * Wireless Handler : set power mode */ @@ -1393,10 +1340,8 @@ int iwctl_giwpower(struct net_device *dev, PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int mode = pDevice->ePSMode; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER \n"); - if ((wrq->disabled = (mode == WMAC_POWER_CAM))) return 0; @@ -1408,11 +1353,9 @@ int iwctl_giwpower(struct net_device *dev, wrq->flags = IW_POWER_PERIOD; } wrq->flags |= IW_POWER_ALL_R; - return 0; } - /* * Wireless Handler : get Sensitivity */ @@ -1434,8 +1377,6 @@ int iwctl_giwsens(struct net_device *dev, }; wrq->disabled = (wrq->value == 0); wrq->fixed = 1; - - return 0; } @@ -1506,7 +1447,6 @@ int iwctl_siwauth(struct net_device *dev, pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK; else pMgmt->eAuthenMode = WMAC_AUTH_WPA; } - break; case IW_AUTH_TKIP_COUNTERMEASURES: break; /* FIXME */ @@ -1537,7 +1477,6 @@ int iwctl_siwauth(struct net_device *dev, pMgmt->eAuthenMode = WMAC_AUTH_OPEN; PRINT_K("iwctl_siwauth:set WPADEV to disaable at 2?????\n"); } - break; default: ret = -EOPNOTSUPP; @@ -1546,7 +1485,6 @@ int iwctl_siwauth(struct net_device *dev, return ret; } - int iwctl_giwauth(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, @@ -1555,8 +1493,6 @@ int iwctl_giwauth(struct net_device *dev, return -EOPNOTSUPP; } - - int iwctl_siwgenie(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, @@ -1610,11 +1546,9 @@ int iwctl_giwgenie(struct net_device *dev, }else ret = -E2BIG; } - return ret; } - int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, @@ -1681,7 +1615,6 @@ if(ext->key_len) { key_len=ext->key_len; memcpy(key, &ext->key[0], key_len); } - memset(key_array, 0, 64); if ( key_len > 0) { memcpy(key_array, key, key_len); @@ -1732,7 +1665,6 @@ if(pDevice->bwextstep3 == TRUE) { KeyvInitTable(pDevice,&pDevice->sKey); } //****** - spin_lock_irq(&pDevice->lock); ret = wpa_set_keys(pDevice, param, TRUE); spin_unlock_irq(&pDevice->lock); @@ -1742,8 +1674,6 @@ kfree(param); return ret; } - - int iwctl_giwencodeext(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, @@ -1779,9 +1709,7 @@ int iwctl_siwmlme(struct net_device *dev, default: ret = -EOPNOTSUPP; } - return ret; - } #endif @@ -1846,21 +1774,17 @@ static const iw_handler iwctl_handler[] = (iw_handler) NULL, // -- hole -- }; - static const iw_handler iwctl_private_handler[] = { NULL, // SIOCIWFIRSTPRIV }; - struct iw_priv_args iwctl_private_args[] = { { IOCTL_CMD_SET, IW_PRIV_TYPE_CHAR | 1024, 0, "set"}, }; - - const struct iw_handler_def iwctl_handler_def = { .get_wireless_stats = &iwctl_get_wireless_stats, -- cgit v0.10.2 From 921cd68b671d277bab8956e066a0f765ce0defb3 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Mon, 25 Jun 2012 01:56:05 +0200 Subject: staging: vt6656: iwctl: fix up function declarations/prototypes The way function prototypes/declarations are written in iwctl.[ch] is an inconsistent mess. This patch makes the whole thing consistent by putting the first function arguments (op to a column width of at most 80) on the same line as the function name and the remaining ones on the following line indented by two tabs. Besides getting rid of the current tabs vs spaces mess it also shortens the files quite a bit and puts them more in line with most other kernel files. Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index 9a49fa9..3ac41bb 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -87,10 +87,8 @@ struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev) /* * Wireless Handler : get protocol name */ -int iwctl_giwname(struct net_device *dev, - struct iw_request_info *info, - char *wrq, - char *extra) +int iwctl_giwname(struct net_device *dev, struct iw_request_info *info, + char *wrq, char *extra) { strcpy(wrq, "802.11-a/b/g"); return 0; @@ -99,10 +97,8 @@ int iwctl_giwname(struct net_device *dev, /* * Wireless Handler : set scan */ -int iwctl_siwscan(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra) +int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -173,10 +169,8 @@ if(pDevice->byReAssocCount > 0) { //reject scan when re-associating! /* * Wireless Handler : get scan results */ -int iwctl_giwscan(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra) +int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra) { int ii, jj, kk; PSDevice pDevice = (PSDevice)netdev_priv(dev); @@ -323,10 +317,8 @@ int iwctl_giwscan(struct net_device *dev, /* * Wireless Handler : set frequence or channel */ -int iwctl_siwfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *wrq, - char *extra) +int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info, + struct iw_freq *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); int rc = 0; @@ -365,10 +357,8 @@ int iwctl_siwfreq(struct net_device *dev, /* * Wireless Handler : get frequence or channel */ -int iwctl_giwfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *wrq, - char *extra) +int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info, + struct iw_freq *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -393,10 +383,8 @@ int iwctl_giwfreq(struct net_device *dev, /* * Wireless Handler : set operation mode */ -int iwctl_siwmode(struct net_device *dev, - struct iw_request_info *info, - __u32 *wmode, - char *extra) +int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, + __u32 *wmode, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -459,10 +447,8 @@ int iwctl_siwmode(struct net_device *dev, /* * Wireless Handler : get operation mode */ -void iwctl_giwmode(struct net_device *dev, - struct iw_request_info *info, - __u32 *wmode, - char *extra) +void iwctl_giwmode(struct net_device *dev, struct iw_request_info *info, + __u32 *wmode, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -491,10 +477,8 @@ void iwctl_giwmode(struct net_device *dev, /* * Wireless Handler : get capability range */ -void iwctl_giwrange(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra) +void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra) { struct iw_range *range = (struct iw_range *) extra; int i,k; @@ -589,10 +573,8 @@ void iwctl_giwrange(struct net_device *dev, /* * Wireless Handler : set ap mac address */ -int iwctl_siwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *wrq, - char *extra) +int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, + struct sockaddr *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -638,10 +620,8 @@ int iwctl_siwap(struct net_device *dev, /* * Wireless Handler : get ap mac address */ -int iwctl_giwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *wrq, - char *extra) +int iwctl_giwap(struct net_device *dev, struct iw_request_info *info, + struct sockaddr *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -664,10 +644,8 @@ int iwctl_giwap(struct net_device *dev, /* * Wireless Handler : get ap list */ -int iwctl_giwaplist(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra) +int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra) { int ii,jj, rc = 0; struct sockaddr sock[IW_MAX_AP]; @@ -711,11 +689,8 @@ int iwctl_giwaplist(struct net_device *dev, /* * Wireless Handler : set essid */ - -int iwctl_siwessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra) +int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -824,10 +799,8 @@ int iwctl_siwessid(struct net_device *dev, /* * Wireless Handler : get essid */ -void iwctl_giwessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra) +void iwctl_giwessid(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -850,10 +823,8 @@ void iwctl_giwessid(struct net_device *dev, /* * Wireless Handler : set data rate */ -int iwctl_siwrate(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra) +int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); int rc = 0; @@ -931,10 +902,8 @@ int iwctl_siwrate(struct net_device *dev, /* * Wireless Handler : get data rate */ -void iwctl_giwrate(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra) +void iwctl_giwrate(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -974,8 +943,7 @@ void iwctl_giwrate(struct net_device *dev, /* * Wireless Handler : set rts threshold */ -int iwctl_siwrts(struct net_device *dev, - struct iw_param *wrq) +int iwctl_siwrts(struct net_device *dev, struct iw_param *wrq) { PSDevice pDevice = (PSDevice)netdev_priv(dev); @@ -993,10 +961,8 @@ int iwctl_siwrts(struct net_device *dev, /* * Wireless Handler : get rts */ -int iwctl_giwrts(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra) +int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); @@ -1011,10 +977,8 @@ int iwctl_giwrts(struct net_device *dev, /* * Wireless Handler : set fragment threshold */ -int iwctl_siwfrag(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra) +int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); int rc = 0; @@ -1036,11 +1000,8 @@ int iwctl_siwfrag(struct net_device *dev, /* * Wireless Handler : get fragment threshold */ - -int iwctl_giwfrag(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra) +int iwctl_giwfrag(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); @@ -1055,10 +1016,8 @@ int iwctl_giwfrag(struct net_device *dev, /* * Wireless Handler : set retry threshold */ -int iwctl_siwretry(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra) +int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); int rc = 0; @@ -1090,10 +1049,8 @@ int iwctl_siwretry(struct net_device *dev, /* * Wireless Handler : get retry threshold */ -int iwctl_giwretry(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra) +int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY \n"); @@ -1119,10 +1076,8 @@ int iwctl_giwretry(struct net_device *dev, /* * Wireless Handler : set encode mode */ -int iwctl_siwencode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra) +int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -1221,10 +1176,8 @@ int iwctl_siwencode(struct net_device *dev, return rc; } -int iwctl_giwencode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra) +int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -1281,10 +1234,8 @@ int iwctl_giwencode(struct net_device *dev, /* * Wireless Handler : set power mode */ -int iwctl_siwpower(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra) +int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -1331,10 +1282,8 @@ int iwctl_siwpower(struct net_device *dev, /* * Wireless Handler : get power mode */ -int iwctl_giwpower(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra) +int iwctl_giwpower(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -1359,10 +1308,8 @@ int iwctl_giwpower(struct net_device *dev, /* * Wireless Handler : get Sensitivity */ -int iwctl_giwsens(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra) +int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); long ldBm; @@ -1382,10 +1329,8 @@ int iwctl_giwsens(struct net_device *dev, #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT -int iwctl_siwauth(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra) +int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -1485,18 +1430,14 @@ int iwctl_siwauth(struct net_device *dev, return ret; } -int iwctl_giwauth(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra) +int iwctl_giwauth(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra) { return -EOPNOTSUPP; } -int iwctl_siwgenie(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra) +int iwctl_siwgenie(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -1526,10 +1467,8 @@ int iwctl_siwgenie(struct net_device *dev, return ret; } -int iwctl_giwgenie(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra) +int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -1549,10 +1488,8 @@ int iwctl_giwgenie(struct net_device *dev, return ret; } -int iwctl_siwencodeext(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra) +int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -1674,18 +1611,14 @@ kfree(param); return ret; } -int iwctl_giwencodeext(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra) +int iwctl_giwencodeext(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra) { return -EOPNOTSUPP; } -int iwctl_siwmlme(struct net_device *dev, - struct iw_request_info * info, - struct iw_point *wrq, - char *extra) +int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); diff --git a/drivers/staging/vt6656/iwctl.h b/drivers/staging/vt6656/iwctl.h index 0c6e049..96fd043 100644 --- a/drivers/staging/vt6656/iwctl.h +++ b/drivers/staging/vt6656/iwctl.h @@ -41,170 +41,104 @@ struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev); -int iwctl_siwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *wrq, - char *extra); - -void iwctl_giwrange(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra); - - -void iwctl_giwmode(struct net_device *dev, - struct iw_request_info *info, - __u32 *wmode, - char *extra); - -int iwctl_siwmode(struct net_device *dev, - struct iw_request_info *info, - __u32 *wmode, - char *extra); - -int iwctl_giwfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *wrq, - char *extra); - -int iwctl_siwfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *wrq, - char *extra); - -int iwctl_giwname(struct net_device *dev, - struct iw_request_info *info, - char *wrq, - char *extra); - -int iwctl_giwsens(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra); - -int iwctl_giwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *wrq, - char *extra); - -int iwctl_giwaplist(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra); - -int iwctl_siwessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra); - -void iwctl_giwessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra); - -int iwctl_siwrate(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra); - -void iwctl_giwrate(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra); - -int iwctl_siwrts(struct net_device *dev, - struct iw_param *wrq); - -int iwctl_giwrts(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra); - -int iwctl_siwfrag(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra); - -int iwctl_giwfrag(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra); - -int iwctl_siwretry(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra); - -int iwctl_giwretry(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra); - -int iwctl_siwencode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra); - -int iwctl_giwencode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra); - -int iwctl_siwpower(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra); - -int iwctl_giwpower(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra); - -int iwctl_giwscan(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra); - -int iwctl_siwscan(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra); +int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, + struct sockaddr *wrq, char *extra); + +void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra); + +void iwctl_giwmode(struct net_device *dev, struct iw_request_info *info, + __u32 *wmode, char *extra); + +int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, + __u32 *wmode, char *extra); + +int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info, + struct iw_freq *wrq, char *extra); + +int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info, + struct iw_freq *wrq, char *extra); + +int iwctl_giwname(struct net_device *dev, struct iw_request_info *info, + char *wrq, char *extra); + +int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra); + +int iwctl_giwap(struct net_device *dev, struct iw_request_info *info, + struct sockaddr *wrq, char *extra); + +int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra); + +int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra); + +void iwctl_giwessid(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra); + +int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra); + +void iwctl_giwrate(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra); + +int iwctl_siwrts(struct net_device *dev, struct iw_param *wrq); + +int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra); + +int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra); + +int iwctl_giwfrag(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra); + +int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra); + +int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra); + +int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra); + +int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra); + +int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra); + +int iwctl_giwpower(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra); + +int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra); + +int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra); #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT -int iwctl_siwauth(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra); - -int iwctl_giwauth(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, - char *extra); - -int iwctl_siwgenie(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra); - -int iwctl_giwgenie(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra); - -int iwctl_siwencodeext(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra); - -int iwctl_giwencodeext(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *wrq, - char *extra); - -int iwctl_siwmlme(struct net_device *dev, - struct iw_request_info * info, - struct iw_point *wrq, - char *extra); +int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra); + +int iwctl_giwauth(struct net_device *dev, struct iw_request_info *info, + struct iw_param *wrq, char *extra); + +int iwctl_siwgenie(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra); + +int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra); + +int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra); + +int iwctl_giwencodeext(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra); + +int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info, + struct iw_point *wrq, char *extra); #endif // #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT extern const struct iw_handler_def iwctl_handler_def; -- cgit v0.10.2 From 48746d7f4d9a821e547e2c1e6623a8e20a0a70a7 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Mon, 25 Jun 2012 01:56:15 +0200 Subject: staging: vt6656: iwctl: Fix indentation Fix indentation for the entire files to use tabs rather than spaces and also make sure everything is indented to the proper depth according to context. Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index 3ac41bb..7618fb9 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -53,12 +53,12 @@ #endif static const long frequency_list[] = { - 2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484, - 4915, 4920, 4925, 4935, 4940, 4945, 4960, 4980, - 5035, 5040, 5045, 5055, 5060, 5080, 5170, 5180, 5190, 5200, 5210, 5220, 5230, 5240, - 5260, 5280, 5300, 5320, 5500, 5520, 5540, 5560, 5580, 5600, 5620, 5640, 5660, 5680, - 5700, 5745, 5765, 5785, 5805, 5825 - }; + 2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484, + 4915, 4920, 4925, 4935, 4940, 4945, 4960, 4980, + 5035, 5040, 5045, 5055, 5060, 5080, 5170, 5180, 5190, 5200, 5210, 5220, 5230, 5240, + 5260, 5280, 5300, 5320, 5500, 5520, 5540, 5560, 5580, 5600, 5620, 5640, 5660, 5680, + 5700, 5745, 5765, 5785, 5805, 5825 +}; static int msglevel =MSG_LEVEL_INFO; @@ -68,9 +68,9 @@ struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev) long ldBm; pDevice->wstats.status = pDevice->eOPMode; - if(pDevice->scStatistic.LinkQuality > 100) - pDevice->scStatistic.LinkQuality = 100; - pDevice->wstats.qual.qual =(BYTE) pDevice->scStatistic.LinkQuality; + if(pDevice->scStatistic.LinkQuality > 100) + pDevice->scStatistic.LinkQuality = 100; + pDevice->wstats.qual.qual =(BYTE) pDevice->scStatistic.LinkQuality; RFvRSSITodBm(pDevice, (BYTE)(pDevice->uCurrRSSI), &ldBm); pDevice->wstats.qual.level = ldBm; pDevice->wstats.qual.noise = 0; @@ -101,65 +101,65 @@ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); struct iw_scan_req *req = (struct iw_scan_req *)extra; BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; PWLAN_IE_SSID pItemSSID=NULL; - if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) - return -EINVAL; + if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) + return -EINVAL; - PRINT_K(" SIOCSIWSCAN \n"); + PRINT_K(" SIOCSIWSCAN \n"); -if (pMgmt->eScanState == WMAC_IS_SCANNING) { - // In scanning.. - PRINT_K("SIOCSIWSCAN(overlap??)-->In scanning...\n"); - return -EAGAIN; - } + if (pMgmt->eScanState == WMAC_IS_SCANNING) { + // In scanning.. + PRINT_K("SIOCSIWSCAN(overlap??)-->In scanning...\n"); + return -EAGAIN; + } -if(pDevice->byReAssocCount > 0) { //reject scan when re-associating! + if(pDevice->byReAssocCount > 0) { //reject scan when re-associating! //send scan event to wpa_Supplicant - union iwreq_data wrqu; - PRINT_K("wireless_send_event--->SIOCGIWSCAN(scan done)\n"); - memset(&wrqu, 0, sizeof(wrqu)); - wireless_send_event(pDevice->dev, SIOCGIWSCAN, &wrqu, NULL); - return 0; -} + union iwreq_data wrqu; + PRINT_K("wireless_send_event--->SIOCGIWSCAN(scan done)\n"); + memset(&wrqu, 0, sizeof(wrqu)); + wireless_send_event(pDevice->dev, SIOCGIWSCAN, &wrqu, NULL); + return 0; + } spin_lock_irq(&pDevice->lock); BSSvClearBSSList((void *) pDevice, pDevice->bLinkPass); //mike add: active scan OR passive scan OR desire_ssid scan - if(wrq->length == sizeof(struct iw_scan_req)) { - if (wrq->flags & IW_SCAN_THIS_ESSID) { //desire_ssid scan - memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - pItemSSID = (PWLAN_IE_SSID)abyScanSSID; - pItemSSID->byElementID = WLAN_EID_SSID; - memcpy(pItemSSID->abySSID, req->essid, (int)req->essid_len); - if (pItemSSID->abySSID[req->essid_len - 1] == '\0') { - if(req->essid_len>0) - pItemSSID->len = req->essid_len - 1; - } - else - pItemSSID->len = req->essid_len; - pMgmt->eScanType = WMAC_SCAN_PASSIVE; - PRINT_K("SIOCSIWSCAN:[desired_ssid=%s,len=%d]\n",((PWLAN_IE_SSID)abyScanSSID)->abySSID, - ((PWLAN_IE_SSID)abyScanSSID)->len); - bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID); - spin_unlock_irq(&pDevice->lock); + if(wrq->length == sizeof(struct iw_scan_req)) { + if (wrq->flags & IW_SCAN_THIS_ESSID) { //desire_ssid scan + memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); + pItemSSID = (PWLAN_IE_SSID)abyScanSSID; + pItemSSID->byElementID = WLAN_EID_SSID; + memcpy(pItemSSID->abySSID, req->essid, (int)req->essid_len); + if (pItemSSID->abySSID[req->essid_len - 1] == '\0') { + if(req->essid_len>0) + pItemSSID->len = req->essid_len - 1; + } + else + pItemSSID->len = req->essid_len; + pMgmt->eScanType = WMAC_SCAN_PASSIVE; + PRINT_K("SIOCSIWSCAN:[desired_ssid=%s,len=%d]\n",((PWLAN_IE_SSID)abyScanSSID)->abySSID, + ((PWLAN_IE_SSID)abyScanSSID)->len); + bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID); + spin_unlock_irq(&pDevice->lock); + + return 0; + } + else if(req->scan_type == IW_SCAN_TYPE_PASSIVE) { //passive scan + pMgmt->eScanType = WMAC_SCAN_PASSIVE; + } + } + else { //active scan + pMgmt->eScanType = WMAC_SCAN_ACTIVE; + } - return 0; - } - else if(req->scan_type == IW_SCAN_TYPE_PASSIVE) { //passive scan - pMgmt->eScanType = WMAC_SCAN_PASSIVE; - } - } - else { //active scan - pMgmt->eScanType = WMAC_SCAN_ACTIVE; - } - - pMgmt->eScanType = WMAC_SCAN_PASSIVE; + pMgmt->eScanType = WMAC_SCAN_PASSIVE; bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL); spin_unlock_irq(&pDevice->lock); @@ -172,12 +172,12 @@ if(pDevice->byReAssocCount > 0) { //reject scan when re-associating! int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - int ii, jj, kk; + int ii, jj, kk; PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - PKnownBSS pBSS; - PWLAN_IE_SSID pItemSSID; - PWLAN_IE_SUPP_RATES pSuppRates, pExtSuppRates; + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PKnownBSS pBSS; + PWLAN_IE_SSID pItemSSID; + PWLAN_IE_SUPP_RATES pSuppRates, pExtSuppRates; char *current_ev = extra; char *end_buf = extra + IW_SCAN_MAX_DATA; char *current_val = NULL; @@ -185,131 +185,131 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, long ldBm; char buf[MAX_WPA_IE_LEN * 2 + 30]; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSCAN\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSCAN\n"); - if (pMgmt->eScanState == WMAC_IS_SCANNING) { - // In scanning.. + if (pMgmt->eScanState == WMAC_IS_SCANNING) { + // In scanning.. return -EAGAIN; } pBSS = &(pMgmt->sBSSList[0]); - for (ii = 0, jj = 0; jj < MAX_BSS_NUM ; jj++) { + for (ii = 0, jj = 0; jj < MAX_BSS_NUM ; jj++) { if (current_ev >= end_buf) break; - pBSS = &(pMgmt->sBSSList[jj]); - if (pBSS->bActive) { - //ADD mac address - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWAP; - iwe.u.ap_addr.sa_family = ARPHRD_ETHER; + pBSS = &(pMgmt->sBSSList[jj]); + if (pBSS->bActive) { + //ADD mac address + memset(&iwe, 0, sizeof(iwe)); + iwe.cmd = SIOCGIWAP; + iwe.u.ap_addr.sa_family = ARPHRD_ETHER; memcpy(iwe.u.ap_addr.sa_data, pBSS->abyBSSID, WLAN_BSSID_LEN); - current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_ADDR_LEN); - //ADD ssid - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWESSID; - pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID; - iwe.u.data.length = pItemSSID->len; - iwe.u.data.flags = 1; - current_ev = iwe_stream_add_point(info,current_ev,end_buf, &iwe, pItemSSID->abySSID); - //ADD mode - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWMODE; - if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo)) { - iwe.u.mode = IW_MODE_INFRA; - } - else { - iwe.u.mode = IW_MODE_ADHOC; - } - iwe.len = IW_EV_UINT_LEN; - current_ev = iwe_stream_add_event(info,current_ev, end_buf, &iwe, IW_EV_UINT_LEN); - //ADD frequency - pSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abySuppRates; - pExtSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abyExtSuppRates; - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWFREQ; - iwe.u.freq.m = pBSS->uChannel; - iwe.u.freq.e = 0; - iwe.u.freq.i = 0; - current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN); + current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_ADDR_LEN); + //ADD ssid + memset(&iwe, 0, sizeof(iwe)); + iwe.cmd = SIOCGIWESSID; + pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID; + iwe.u.data.length = pItemSSID->len; + iwe.u.data.flags = 1; + current_ev = iwe_stream_add_point(info,current_ev,end_buf, &iwe, pItemSSID->abySSID); + //ADD mode + memset(&iwe, 0, sizeof(iwe)); + iwe.cmd = SIOCGIWMODE; + if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo)) { + iwe.u.mode = IW_MODE_INFRA; + } + else { + iwe.u.mode = IW_MODE_ADHOC; + } + iwe.len = IW_EV_UINT_LEN; + current_ev = iwe_stream_add_event(info,current_ev, end_buf, &iwe, IW_EV_UINT_LEN); + //ADD frequency + pSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abySuppRates; + pExtSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abyExtSuppRates; + memset(&iwe, 0, sizeof(iwe)); + iwe.cmd = SIOCGIWFREQ; + iwe.u.freq.m = pBSS->uChannel; + iwe.u.freq.e = 0; + iwe.u.freq.i = 0; + current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN); { - int f = (int)pBSS->uChannel - 1; - if(f < 0)f = 0; - iwe.u.freq.m = frequency_list[f] * 100000; - iwe.u.freq.e = 1; + int f = (int)pBSS->uChannel - 1; + if(f < 0)f = 0; + iwe.u.freq.m = frequency_list[f] * 100000; + iwe.u.freq.e = 1; } - current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN); - //ADD quality - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVQUAL; - RFvRSSITodBm(pDevice, (BYTE)(pBSS->uRSSI), &ldBm); - iwe.u.qual.level = ldBm; - iwe.u.qual.noise = 0; + current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN); + //ADD quality + memset(&iwe, 0, sizeof(iwe)); + iwe.cmd = IWEVQUAL; + RFvRSSITodBm(pDevice, (BYTE)(pBSS->uRSSI), &ldBm); + iwe.u.qual.level = ldBm; + iwe.u.qual.noise = 0; if(-ldBm<50){ iwe.u.qual.qual = 100; }else if(-ldBm > 90) { - iwe.u.qual.qual = 0; + iwe.u.qual.qual = 0; }else { iwe.u.qual.qual=(40-(-ldBm-50))*100/40; } iwe.u.qual.updated=7; - current_ev = iwe_stream_add_event(info,current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); - //ADD encryption - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWENCODE; - iwe.u.data.length = 0; - if (WLAN_GET_CAP_INFO_PRIVACY(pBSS->wCapInfo)) { - iwe.u.data.flags =IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; - }else { - iwe.u.data.flags = IW_ENCODE_DISABLED; - } - current_ev = iwe_stream_add_point(info,current_ev,end_buf, &iwe, pItemSSID->abySSID); - - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWRATE; - iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; - current_val = current_ev + IW_EV_LCP_LEN; - - for (kk = 0 ; kk < 12 ; kk++) { - if (pSuppRates->abyRates[kk] == 0) - break; - // Bit rate given in 500 kb/s units (+ 0x80) - iwe.u.bitrate.value = ((pSuppRates->abyRates[kk] & 0x7f) * 500000); - current_val = iwe_stream_add_value(info,current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); - } - for (kk = 0 ; kk < 8 ; kk++) { - if (pExtSuppRates->abyRates[kk] == 0) - break; - // Bit rate given in 500 kb/s units (+ 0x80) - iwe.u.bitrate.value = ((pExtSuppRates->abyRates[kk] & 0x7f) * 500000); - current_val = iwe_stream_add_value(info,current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); - } - - if((current_val - current_ev) > IW_EV_LCP_LEN) - current_ev = current_val; - - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVCUSTOM; - sprintf(buf, "bcn_int=%d", pBSS->wBeaconInterval); - iwe.u.data.length = strlen(buf); - current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, buf); - - if ((pBSS->wWPALen > 0) && (pBSS->wWPALen <= MAX_WPA_IE_LEN)) { - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = pBSS->wWPALen; - current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, pBSS->byWPAIE); - } - - if ((pBSS->wRSNLen > 0) && (pBSS->wRSNLen <= MAX_WPA_IE_LEN)) { - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = pBSS->wRSNLen; - current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, pBSS->byRSNIE); - } - - } - }// for + current_ev = iwe_stream_add_event(info,current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); + //ADD encryption + memset(&iwe, 0, sizeof(iwe)); + iwe.cmd = SIOCGIWENCODE; + iwe.u.data.length = 0; + if (WLAN_GET_CAP_INFO_PRIVACY(pBSS->wCapInfo)) { + iwe.u.data.flags =IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; + }else { + iwe.u.data.flags = IW_ENCODE_DISABLED; + } + current_ev = iwe_stream_add_point(info,current_ev,end_buf, &iwe, pItemSSID->abySSID); + + memset(&iwe, 0, sizeof(iwe)); + iwe.cmd = SIOCGIWRATE; + iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; + current_val = current_ev + IW_EV_LCP_LEN; + + for (kk = 0 ; kk < 12 ; kk++) { + if (pSuppRates->abyRates[kk] == 0) + break; + // Bit rate given in 500 kb/s units (+ 0x80) + iwe.u.bitrate.value = ((pSuppRates->abyRates[kk] & 0x7f) * 500000); + current_val = iwe_stream_add_value(info,current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); + } + for (kk = 0 ; kk < 8 ; kk++) { + if (pExtSuppRates->abyRates[kk] == 0) + break; + // Bit rate given in 500 kb/s units (+ 0x80) + iwe.u.bitrate.value = ((pExtSuppRates->abyRates[kk] & 0x7f) * 500000); + current_val = iwe_stream_add_value(info,current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); + } + + if((current_val - current_ev) > IW_EV_LCP_LEN) + current_ev = current_val; + + memset(&iwe, 0, sizeof(iwe)); + iwe.cmd = IWEVCUSTOM; + sprintf(buf, "bcn_int=%d", pBSS->wBeaconInterval); + iwe.u.data.length = strlen(buf); + current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, buf); + + if ((pBSS->wWPALen > 0) && (pBSS->wWPALen <= MAX_WPA_IE_LEN)) { + memset(&iwe, 0, sizeof(iwe)); + iwe.cmd = IWEVGENIE; + iwe.u.data.length = pBSS->wWPALen; + current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, pBSS->byWPAIE); + } + + if ((pBSS->wRSNLen > 0) && (pBSS->wRSNLen <= MAX_WPA_IE_LEN)) { + memset(&iwe, 0, sizeof(iwe)); + iwe.cmd = IWEVGENIE; + iwe.u.data.length = pBSS->wRSNLen; + current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, pBSS->byRSNIE); + } + + } + }// for wrq->length = current_ev - extra; return 0; } @@ -323,12 +323,12 @@ int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info, PSDevice pDevice = (PSDevice)netdev_priv(dev); int rc = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n"); // If setting by frequency, convert to a channel if((wrq->e == 1) && - (wrq->m >= (int) 2.412e8) && - (wrq->m <= (int) 2.487e8)) { + (wrq->m >= (int) 2.412e8) && + (wrq->m <= (int) 2.487e8)) { int f = wrq->m / 100000; int c = 0; while((c < 14) && (f != frequency_list[c])) @@ -345,9 +345,9 @@ int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: New channel value of %d is invalid!\n", dev->name, wrq->m); rc = -EINVAL; } else { - // Yes ! We can set it !!! - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set to channel = %d\n", channel); - pDevice->uChannel = channel; + // Yes ! We can set it !!! + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set to channel = %d\n", channel); + pDevice->uChannel = channel; } } @@ -361,9 +361,9 @@ int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ \n"); #ifdef WEXT_USECHANNELS wrq->m = (int)pMgmt->uCurrChannel; @@ -372,7 +372,7 @@ int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info, { int f = (int)pMgmt->uCurrChannel - 1; if(f < 0) - f = 0; + f = 0; wrq->m = frequency_list[f] * 100000; wrq->e = 1; } @@ -387,54 +387,54 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, __u32 *wmode, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - int rc = 0; + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + int rc = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMODE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMODE \n"); - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP && pDevice->bEnableHostapd) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Can't set operation mode, hostapd is running \n"); - return rc; - } + if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP && pDevice->bEnableHostapd) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Can't set operation mode, hostapd is running \n"); + return rc; + } switch(*wmode) { case IW_MODE_ADHOC: - if (pMgmt->eConfigMode != WMAC_CONFIG_IBSS_STA) { - pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA; - if (pDevice->flags & DEVICE_FLAGS_OPENED) { - pDevice->bCommit = TRUE; - } + if (pMgmt->eConfigMode != WMAC_CONFIG_IBSS_STA) { + pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA; + if (pDevice->flags & DEVICE_FLAGS_OPENED) { + pDevice->bCommit = TRUE; + } } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc \n"); break; case IW_MODE_AUTO: case IW_MODE_INFRA: - if (pMgmt->eConfigMode != WMAC_CONFIG_ESS_STA) { - pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA; - if (pDevice->flags & DEVICE_FLAGS_OPENED) { - pDevice->bCommit = TRUE; - } + if (pMgmt->eConfigMode != WMAC_CONFIG_ESS_STA) { + pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA; + if (pDevice->flags & DEVICE_FLAGS_OPENED) { + pDevice->bCommit = TRUE; + } } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure \n"); break; case IW_MODE_MASTER: - pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA; + pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA; rc = -EOPNOTSUPP; break; - if (pMgmt->eConfigMode != WMAC_CONFIG_AP) { - pMgmt->eConfigMode = WMAC_CONFIG_AP; - if (pDevice->flags & DEVICE_FLAGS_OPENED) { - pDevice->bCommit = TRUE; - } + if (pMgmt->eConfigMode != WMAC_CONFIG_AP) { + pMgmt->eConfigMode = WMAC_CONFIG_AP; + if (pDevice->flags & DEVICE_FLAGS_OPENED) { + pDevice->bCommit = TRUE; + } } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point \n"); break; case IW_MODE_REPEAT: - pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA; + pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA; rc = -EOPNOTSUPP; break; default: @@ -451,17 +451,17 @@ void iwctl_giwmode(struct net_device *dev, struct iw_request_info *info, __u32 *wmode, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE \n"); // If not managed, assume it's ad-hoc switch (pMgmt->eConfigMode) { case WMAC_CONFIG_ESS_STA: *wmode = IW_MODE_INFRA; break; case WMAC_CONFIG_IBSS_STA: - *wmode = IW_MODE_ADHOC; + *wmode = IW_MODE_ADHOC; break; case WMAC_CONFIG_AUTO: *wmode = IW_MODE_INFRA; @@ -482,9 +482,9 @@ void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info, { struct iw_range *range = (struct iw_range *) extra; int i,k; - BYTE abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90}; + BYTE abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90}; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRANGE\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRANGE\n"); if (wrq->pointer) { wrq->length = sizeof(struct iw_range); memset(range, 0, sizeof(struct iw_range)); @@ -501,7 +501,7 @@ void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info, } range->num_frequency = k; // Hum... Should put the right values there - range->max_qual.qual = 100; + range->max_qual.qual = 100; range->max_qual.level = 0; range->max_qual.noise = 0; range->sensitivity = 255; @@ -526,19 +526,19 @@ void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info, range->min_frag = 256; range->max_frag = 2312; - // the encoding capabilities - range->num_encoding_sizes = 3; - // 64(40) bits WEP - range->encoding_size[0] = 5; - // 128(104) bits WEP - range->encoding_size[1] = 13; - // 256 bits for WPA-PSK - range->encoding_size[2] = 32; - // 4 keys are allowed - range->max_encoding_tokens = 4; + // the encoding capabilities + range->num_encoding_sizes = 3; + // 64(40) bits WEP + range->encoding_size[0] = 5; + // 128(104) bits WEP + range->encoding_size[1] = 13; + // 256 bits for WPA-PSK + range->encoding_size[2] = 32; + // 4 keys are allowed + range->max_encoding_tokens = 4; - range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | - IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; + range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | + IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; range->min_pmp = 0; range->max_pmp = 1000000;// 1 secs @@ -549,7 +549,7 @@ void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info, range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_ALL_R; // Transmit Power - values are in mW - range->txpower[0] = 100; + range->txpower[0] = 100; range->num_txpower = 1; range->txpower_capa = IW_TXPOW_MWATT; range->we_version_source = SUPPORTED_WIRELESS_EXT; @@ -577,41 +577,41 @@ int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - int rc = 0; - BYTE ZeroBSSID[WLAN_BSSID_LEN]={0x00,0x00,0x00,0x00,0x00,0x00}; + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + int rc = 0; + BYTE ZeroBSSID[WLAN_BSSID_LEN]={0x00,0x00,0x00,0x00,0x00,0x00}; - PRINT_K(" SIOCSIWAP \n"); + PRINT_K(" SIOCSIWAP \n"); if (wrq->sa_family != ARPHRD_ETHER) rc = -EINVAL; else { memcpy(pMgmt->abyDesireBSSID, wrq->sa_data, 6); - //mike :add - if ((is_broadcast_ether_addr(pMgmt->abyDesireBSSID)) || - (memcmp(pMgmt->abyDesireBSSID, ZeroBSSID, 6) == 0)){ - PRINT_K("SIOCSIWAP:invalid desired BSSID return!\n"); - return rc; - } - //mike add: if desired AP is hidden ssid(there are two same BSSID in list), - // then ignore,because you don't known which one to be connect with?? - { - unsigned int ii, uSameBssidNum = 0; - for (ii = 0; ii < MAX_BSS_NUM; ii++) { - if (pMgmt->sBSSList[ii].bActive && - !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, - pMgmt->abyDesireBSSID)) { - uSameBssidNum++; - } - } - if(uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!! - PRINT_K("SIOCSIWAP:ignore for desired AP in hidden mode\n"); - return rc; - } - } - - if (pDevice->flags & DEVICE_FLAGS_OPENED) { - pDevice->bCommit = TRUE; + //mike :add + if ((is_broadcast_ether_addr(pMgmt->abyDesireBSSID)) || + (memcmp(pMgmt->abyDesireBSSID, ZeroBSSID, 6) == 0)){ + PRINT_K("SIOCSIWAP:invalid desired BSSID return!\n"); + return rc; + } + //mike add: if desired AP is hidden ssid(there are two same BSSID in list), + // then ignore,because you don't known which one to be connect with?? + { + unsigned int ii, uSameBssidNum = 0; + for (ii = 0; ii < MAX_BSS_NUM; ii++) { + if (pMgmt->sBSSList[ii].bActive && + !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, + pMgmt->abyDesireBSSID)) { + uSameBssidNum++; + } + } + if(uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!! + PRINT_K("SIOCSIWAP:ignore for desired AP in hidden mode\n"); + return rc; + } + } + + if (pDevice->flags & DEVICE_FLAGS_OPENED) { + pDevice->bCommit = TRUE; } } return rc; @@ -624,18 +624,18 @@ int iwctl_giwap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP \n"); - memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6); + memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6); - if ((pDevice->bLinkPass == FALSE) && (pMgmt->eCurrMode != WMAC_MODE_ESS_AP)) - memset(wrq->sa_data, 0, 6); + if ((pDevice->bLinkPass == FALSE) && (pMgmt->eCurrMode != WMAC_MODE_ESS_AP)) + memset(wrq->sa_data, 0, 6); - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { - memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6); - } + if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { + memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6); + } wrq->sa_family = ARPHRD_ETHER; return 0; @@ -651,9 +651,9 @@ int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info, struct sockaddr sock[IW_MAX_AP]; struct iw_quality qual[IW_MAX_AP]; PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAPLIST \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAPLIST \n"); // Only super-user can see AP list if (!capable(CAP_NET_ADMIN)) { @@ -665,11 +665,11 @@ int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info, PKnownBSS pBSS = &(pMgmt->sBSSList[0]); for (ii = 0, jj= 0; ii < MAX_BSS_NUM; ii++) { - pBSS = &(pMgmt->sBSSList[ii]); - if (!pBSS->bActive) - continue; - if ( jj >= IW_MAX_AP) - break; + pBSS = &(pMgmt->sBSSList[ii]); + if (!pBSS->bActive) + continue; + if ( jj >= IW_MAX_AP) + break; memcpy(sock[jj].sa_data, pBSS->abyBSSID, 6); sock[jj].sa_family = ARPHRD_ETHER; qual[jj].level = pBSS->uRSSI; @@ -693,105 +693,105 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - PWLAN_IE_SSID pItemSSID; + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PWLAN_IE_SSID pItemSSID; - if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) - return -EINVAL; + if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) + return -EINVAL; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID :\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID :\n"); - pDevice->fWPA_Authened = FALSE; + pDevice->fWPA_Authened = FALSE; // Check if we asked for `any' if(wrq->flags == 0) { // Just send an empty SSID list memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - memset(pMgmt->abyDesireBSSID, 0xFF,6); - PRINT_K("set essid to 'any' \n"); - #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT - //Unknown desired AP,so here need not associate?? - return 0; - #endif + memset(pMgmt->abyDesireBSSID, 0xFF,6); + PRINT_K("set essid to 'any' \n"); +#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT + //Unknown desired AP,so here need not associate?? + return 0; +#endif } else { // Set the SSID memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; - pItemSSID->byElementID = WLAN_EID_SSID; + pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; + pItemSSID->byElementID = WLAN_EID_SSID; memcpy(pItemSSID->abySSID, extra, wrq->length); - if (pItemSSID->abySSID[wrq->length - 1] == '\0') { - if(wrq->length>0) - pItemSSID->len = wrq->length - 1; - } - else - pItemSSID->len = wrq->length; - PRINT_K("set essid to %s \n",pItemSSID->abySSID); + if (pItemSSID->abySSID[wrq->length - 1] == '\0') { + if(wrq->length>0) + pItemSSID->len = wrq->length - 1; + } + else + pItemSSID->len = wrq->length; + PRINT_K("set essid to %s \n",pItemSSID->abySSID); - //mike:need clear desiredBSSID - if(pItemSSID->len==0) { - memset(pMgmt->abyDesireBSSID, 0xFF,6); - return 0; - } + //mike:need clear desiredBSSID + if(pItemSSID->len==0) { + memset(pMgmt->abyDesireBSSID, 0xFF,6); + return 0; + } #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT - //Wext wil order another command of siwap to link with desired AP, - //so here need not associate?? - if(pDevice->bWPASuppWextEnabled == TRUE) { - /*******search if in hidden ssid mode ****/ - { - PKnownBSS pCurr = NULL; - BYTE abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; - unsigned int ii, uSameBssidNum = 0; - - memcpy(abyTmpDesireSSID,pMgmt->abyDesireSSID,sizeof(abyTmpDesireSSID)); - pCurr = BSSpSearchBSSList(pDevice, - NULL, - abyTmpDesireSSID, - pDevice->eConfigPHYMode - ); - - if (pCurr == NULL){ - PRINT_K("SIOCSIWESSID:hidden ssid site survey before associate.......\n"); - vResetCommandTimer((void *) pDevice); - pMgmt->eScanType = WMAC_SCAN_ACTIVE; - bScheduleCommand((void *) pDevice, - WLAN_CMD_BSSID_SCAN, - pMgmt->abyDesireSSID); - bScheduleCommand((void *) pDevice, - WLAN_CMD_SSID, - pMgmt->abyDesireSSID); - } - else { //mike:to find out if that desired SSID is a hidden-ssid AP , - // by means of judging if there are two same BSSID exist in list ? - for (ii = 0; ii < MAX_BSS_NUM; ii++) { - if (pMgmt->sBSSList[ii].bActive && - !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, - pCurr->abyBSSID)) { - uSameBssidNum++; - } - } - if(uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!! - PRINT_K("SIOCSIWESSID:hidden ssid directly associate.......\n"); - vResetCommandTimer((void *) pDevice); - pMgmt->eScanType = WMAC_SCAN_PASSIVE; //this scan type,you'll submit scan result! - bScheduleCommand((void *) pDevice, - WLAN_CMD_BSSID_SCAN, - pMgmt->abyDesireSSID); - bScheduleCommand((void *) pDevice, - WLAN_CMD_SSID, - pMgmt->abyDesireSSID); - } - } - } - return 0; - } - #endif - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s \n", pItemSSID->abySSID); + //Wext wil order another command of siwap to link with desired AP, + //so here need not associate?? + if(pDevice->bWPASuppWextEnabled == TRUE) { + /*******search if in hidden ssid mode ****/ + { + PKnownBSS pCurr = NULL; + BYTE abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; + unsigned int ii, uSameBssidNum = 0; + + memcpy(abyTmpDesireSSID,pMgmt->abyDesireSSID,sizeof(abyTmpDesireSSID)); + pCurr = BSSpSearchBSSList(pDevice, + NULL, + abyTmpDesireSSID, + pDevice->eConfigPHYMode + ); + + if (pCurr == NULL){ + PRINT_K("SIOCSIWESSID:hidden ssid site survey before associate.......\n"); + vResetCommandTimer((void *) pDevice); + pMgmt->eScanType = WMAC_SCAN_ACTIVE; + bScheduleCommand((void *) pDevice, + WLAN_CMD_BSSID_SCAN, + pMgmt->abyDesireSSID); + bScheduleCommand((void *) pDevice, + WLAN_CMD_SSID, + pMgmt->abyDesireSSID); + } + else { //mike:to find out if that desired SSID is a hidden-ssid AP , + // by means of judging if there are two same BSSID exist in list ? + for (ii = 0; ii < MAX_BSS_NUM; ii++) { + if (pMgmt->sBSSList[ii].bActive && + !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, + pCurr->abyBSSID)) { + uSameBssidNum++; + } + } + if(uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!! + PRINT_K("SIOCSIWESSID:hidden ssid directly associate.......\n"); + vResetCommandTimer((void *) pDevice); + pMgmt->eScanType = WMAC_SCAN_PASSIVE; //this scan type,you'll submit scan result! + bScheduleCommand((void *) pDevice, + WLAN_CMD_BSSID_SCAN, + pMgmt->abyDesireSSID); + bScheduleCommand((void *) pDevice, + WLAN_CMD_SSID, + pMgmt->abyDesireSSID); + } + } + } + return 0; + } +#endif + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s \n", pItemSSID->abySSID); } - if (pDevice->flags & DEVICE_FLAGS_OPENED) { - pDevice->bCommit = TRUE; + if (pDevice->flags & DEVICE_FLAGS_OPENED) { + pDevice->bCommit = TRUE; } return 0; } @@ -803,16 +803,16 @@ void iwctl_giwessid(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PWLAN_IE_SSID pItemSSID; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWESSID \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWESSID \n"); // Note : if wrq->u.data.flags != 0, we should // get the relevant SSID from the SSID list... // Get the current SSID - pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; + pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; memcpy(extra, pItemSSID->abySSID , pItemSSID->len); extra[pItemSSID->len] = '\0'; @@ -827,23 +827,23 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); - int rc = 0; + int rc = 0; u8 brate = 0; int i; BYTE abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90}; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE \n"); - if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) { - rc = -EINVAL; - return rc; - } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE \n"); + if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) { + rc = -EINVAL; + return rc; + } // First : get a valid bit rate value // Which type of value if((wrq->value < 13) && - (wrq->value >= 0)) { + (wrq->value >= 0)) { // Setting by rate index // Find value in the magic rate table brate = wrq->value; @@ -882,19 +882,19 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, // Fixed mode // One rate, fixed pDevice->bFixRate = TRUE; - if ((pDevice->byBBType == BB_TYPE_11B)&& (brate > 3)) { - pDevice->uConnectionRate = 3; - } - else { - pDevice->uConnectionRate = brate; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d \n", pDevice->uConnectionRate); - } + if ((pDevice->byBBType == BB_TYPE_11B)&& (brate > 3)) { + pDevice->uConnectionRate = 3; + } + else { + pDevice->uConnectionRate = brate; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d \n", pDevice->uConnectionRate); + } } else { - pDevice->bFixRate = FALSE; - pDevice->uConnectionRate = 13; - } + pDevice->bFixRate = FALSE; + pDevice->uConnectionRate = 13; + } return rc; } @@ -906,38 +906,38 @@ void iwctl_giwrate(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE \n"); - { - BYTE abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90}; - int brate = 0; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE \n"); + { + BYTE abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90}; + int brate = 0; if (pDevice->uConnectionRate < 13) { - brate = abySupportedRates[pDevice->uConnectionRate]; - }else { - if (pDevice->byBBType == BB_TYPE_11B) - brate = 0x16; - if (pDevice->byBBType == BB_TYPE_11G) - brate = 0x6C; - if (pDevice->byBBType == BB_TYPE_11A) - brate = 0x6C; - } - - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { - if (pDevice->byBBType == BB_TYPE_11B) - brate = 0x16; - if (pDevice->byBBType == BB_TYPE_11G) - brate = 0x6C; - if (pDevice->byBBType == BB_TYPE_11A) - brate = 0x6C; - } + brate = abySupportedRates[pDevice->uConnectionRate]; + }else { + if (pDevice->byBBType == BB_TYPE_11B) + brate = 0x16; + if (pDevice->byBBType == BB_TYPE_11G) + brate = 0x6C; + if (pDevice->byBBType == BB_TYPE_11A) + brate = 0x6C; + } + + if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { + if (pDevice->byBBType == BB_TYPE_11B) + brate = 0x16; + if (pDevice->byBBType == BB_TYPE_11G) + brate = 0x6C; + if (pDevice->byBBType == BB_TYPE_11A) + brate = 0x6C; + } if (pDevice->uConnectionRate == 13) - brate = abySupportedRates[pDevice->wCurrentRate]; - wrq->value = brate * 500000; - // If more than one rate, set auto - if (pDevice->bFixRate == TRUE) - wrq->fixed = TRUE; - } + brate = abySupportedRates[pDevice->wCurrentRate]; + wrq->value = brate * 500000; + // If more than one rate, set auto + if (pDevice->bFixRate == TRUE) + wrq->fixed = TRUE; + } } /* @@ -966,7 +966,7 @@ int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info, { PSDevice pDevice = (PSDevice)netdev_priv(dev); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS \n"); wrq->value = pDevice->wRTSThreshold; wrq->disabled = (wrq->value >= 2312); wrq->fixed = 1; @@ -980,20 +980,20 @@ int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info, int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - int rc = 0; - int fthr = wrq->value; + PSDevice pDevice = (PSDevice)netdev_priv(dev); + int rc = 0; + int fthr = wrq->value; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFRAG \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFRAG \n"); - if (wrq->disabled) + if (wrq->disabled) fthr = 2312; - if((fthr < 256) || (fthr > 2312)) { + if((fthr < 256) || (fthr > 2312)) { rc = -EINVAL; - }else { - fthr &= ~0x1; // Get an even value - pDevice->wFragmentationThreshold = (u16)fthr; - } + }else { + fthr &= ~0x1; // Get an even value + pDevice->wFragmentationThreshold = (u16)fthr; + } return rc; } @@ -1003,9 +1003,9 @@ int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info, int iwctl_giwfrag(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = (PSDevice)netdev_priv(dev); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG \n"); wrq->value = pDevice->wFragmentationThreshold; wrq->disabled = (wrq->value >= 2312); wrq->fixed = 1; @@ -1019,10 +1019,10 @@ int iwctl_giwfrag(struct net_device *dev, struct iw_request_info *info, int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - int rc = 0; + PSDevice pDevice = (PSDevice)netdev_priv(dev); + int rc = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRETRY \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRETRY \n"); if (wrq->disabled) { rc = -EINVAL; @@ -1052,8 +1052,8 @@ int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info, int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY \n"); + PSDevice pDevice = (PSDevice)netdev_priv(dev); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY \n"); wrq->disabled = 0; // Can't be disabled // Note : by default, display the min retry number @@ -1079,99 +1079,99 @@ int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info, int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); DWORD dwKeyIndex = (DWORD)(wrq->flags & IW_ENCODE_INDEX); int ii,uu, rc = 0; int index = (wrq->flags & IW_ENCODE_INDEX); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE \n"); // Check the size of the key if (wrq->length > WLAN_WEP232_KEYLEN) { rc = -EINVAL; - return rc; + return rc; } if (dwKeyIndex > WLAN_WEP_NKEYS) { rc = -EINVAL; - return rc; - } + return rc; + } - if (dwKeyIndex > 0) + if (dwKeyIndex > 0) dwKeyIndex--; // Send the key to the card if (wrq->length > 0) { - if (wrq->length == WLAN_WEP232_KEYLEN) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n"); - } - else if (wrq->length == WLAN_WEP104_KEYLEN) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n"); - } - else if (wrq->length == WLAN_WEP40_KEYLEN) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex); - } - memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN); - memcpy(pDevice->abyKey, extra, wrq->length); - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyKey: "); - for (ii = 0; ii < wrq->length; ii++) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]); - } - - if (pDevice->flags & DEVICE_FLAGS_OPENED) { - spin_lock_irq(&pDevice->lock); - KeybSetDefaultKey( pDevice, - &(pDevice->sKey), - dwKeyIndex | (1 << 31), - wrq->length, - NULL, - pDevice->abyKey, - KEY_CTL_WEP - ); - spin_unlock_irq(&pDevice->lock); - } - pDevice->byKeyIndex = (BYTE)dwKeyIndex; - pDevice->uKeyLength = wrq->length; - pDevice->bTransmitKey = TRUE; - pDevice->bEncryptionEnable = TRUE; - pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; + if (wrq->length == WLAN_WEP232_KEYLEN) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n"); + } + else if (wrq->length == WLAN_WEP104_KEYLEN) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n"); + } + else if (wrq->length == WLAN_WEP40_KEYLEN) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex); + } + memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN); + memcpy(pDevice->abyKey, extra, wrq->length); + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyKey: "); + for (ii = 0; ii < wrq->length; ii++) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]); + } + + if (pDevice->flags & DEVICE_FLAGS_OPENED) { + spin_lock_irq(&pDevice->lock); + KeybSetDefaultKey( pDevice, + &(pDevice->sKey), + dwKeyIndex | (1 << 31), + wrq->length, + NULL, + pDevice->abyKey, + KEY_CTL_WEP + ); + spin_unlock_irq(&pDevice->lock); + } + pDevice->byKeyIndex = (BYTE)dwKeyIndex; + pDevice->uKeyLength = wrq->length; + pDevice->bTransmitKey = TRUE; + pDevice->bEncryptionEnable = TRUE; + pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; // Do we want to just set the transmit key index ? if ( index < 4 ) { - pDevice->byKeyIndex = index; + pDevice->byKeyIndex = index; } else if (!(wrq->flags & IW_ENCODE_MODE)) { - rc = -EINVAL; - return rc; - } + rc = -EINVAL; + return rc; + } } // Read the flags if(wrq->flags & IW_ENCODE_DISABLED){ - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n"); pMgmt->bShareKeyAlgorithm = FALSE; - pDevice->bEncryptionEnable = FALSE; - pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; - if (pDevice->flags & DEVICE_FLAGS_OPENED) { - spin_lock_irq(&pDevice->lock); - for (uu = 0; uu < MAX_KEY_TABLE; uu++) - MACvDisableKeyEntry(pDevice, uu); - spin_unlock_irq(&pDevice->lock); - } + pDevice->bEncryptionEnable = FALSE; + pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; + if (pDevice->flags & DEVICE_FLAGS_OPENED) { + spin_lock_irq(&pDevice->lock); + for (uu = 0; uu < MAX_KEY_TABLE; uu++) + MACvDisableKeyEntry(pDevice, uu); + spin_unlock_irq(&pDevice->lock); + } } if(wrq->flags & IW_ENCODE_RESTRICTED) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & ShareKey System\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & ShareKey System\n"); pMgmt->bShareKeyAlgorithm = TRUE; } if(wrq->flags & IW_ENCODE_OPEN) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & Open System\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & Open System\n"); pMgmt->bShareKeyAlgorithm = FALSE; } #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT - memset(pMgmt->abyDesireBSSID, 0xFF,6); + memset(pMgmt->abyDesireBSSID, 0xFF,6); #endif return rc; } @@ -1195,9 +1195,9 @@ int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, if(pDevice->byKeyIndexbyKeyIndex; } else - index=0; + index=0; }else - index--; + index--; memset(abyKey, 0, WLAN_WEP232_KEYLEN); // Check encryption mode @@ -1212,18 +1212,18 @@ int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, wrq->flags |= IW_ENCODE_RESTRICTED; else wrq->flags |= IW_ENCODE_OPEN; - wrq->length=0; + wrq->length=0; if((index==0)&&(pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled|| - pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)){//get wpa pairwise key - if (KeybGetKey(&(pDevice->sKey),pMgmt->abyCurrBSSID, 0xffffffff, &pKey)){ - wrq->length = pKey->uKeyLength; - memcpy(abyKey, pKey->abyKey, pKey->uKeyLength); - memcpy(extra, abyKey, WLAN_WEP232_KEYLEN); - } - }else if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (BYTE)index , &pKey)){ + pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)){//get wpa pairwise key + if (KeybGetKey(&(pDevice->sKey),pMgmt->abyCurrBSSID, 0xffffffff, &pKey)){ wrq->length = pKey->uKeyLength; - memcpy(abyKey, pKey->abyKey, pKey->uKeyLength); + memcpy(abyKey, pKey->abyKey, pKey->uKeyLength); + memcpy(extra, abyKey, WLAN_WEP232_KEYLEN); + } + }else if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (BYTE)index , &pKey)){ + wrq->length = pKey->uKeyLength; + memcpy(abyKey, pKey->abyKey, pKey->uKeyLength); memcpy(extra, abyKey, WLAN_WEP232_KEYLEN); } @@ -1237,15 +1237,15 @@ int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - int rc = 0; + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + int rc = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER \n"); - if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) { - rc = -EINVAL; - return rc; + if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) { + rc = -EINVAL; + return rc; } if (wrq->disabled) { @@ -1254,23 +1254,23 @@ int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info, return rc; } if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { - pDevice->ePSMode = WMAC_POWER_FAST; - PSvEnablePowerSaving((void *) pDevice, pMgmt->wListenInterval); + pDevice->ePSMode = WMAC_POWER_FAST; + PSvEnablePowerSaving((void *) pDevice, pMgmt->wListenInterval); } else if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) { - pDevice->ePSMode = WMAC_POWER_FAST; - PSvEnablePowerSaving((void *) pDevice, pMgmt->wListenInterval); + pDevice->ePSMode = WMAC_POWER_FAST; + PSvEnablePowerSaving((void *) pDevice, pMgmt->wListenInterval); } switch (wrq->flags & IW_POWER_MODE) { case IW_POWER_UNICAST_R: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R \n"); rc = -EINVAL; break; case IW_POWER_ALL_R: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ALL_R \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ALL_R \n"); rc = -EINVAL; case IW_POWER_ON: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ON \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ON \n"); break; default: rc = -EINVAL; @@ -1285,14 +1285,14 @@ int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info, int iwctl_giwpower(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - int mode = pDevice->ePSMode; + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + int mode = pDevice->ePSMode; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER \n"); if ((wrq->disabled = (mode == WMAC_POWER_CAM))) - return 0; + return 0; if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { wrq->value = (int)((pMgmt->wListenInterval * pMgmt->wCurrBeaconPeriod) << 10); @@ -1311,17 +1311,17 @@ int iwctl_giwpower(struct net_device *dev, struct iw_request_info *info, int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - long ldBm; + PSDevice pDevice = (PSDevice)netdev_priv(dev); + long ldBm; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS \n"); - if (pDevice->bLinkPass == TRUE) { - RFvRSSITodBm(pDevice, (BYTE)(pDevice->uCurrRSSI), &ldBm); - wrq->value = ldBm; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS \n"); + if (pDevice->bLinkPass == TRUE) { + RFvRSSITodBm(pDevice, (BYTE)(pDevice->uCurrRSSI), &ldBm); + wrq->value = ldBm; } else { - wrq->value = 0; - }; + wrq->value = 0; + }; wrq->disabled = (wrq->value == 0); wrq->fixed = 1; return 0; @@ -1338,29 +1338,29 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, static int wpa_version=0; //must be static to save the last value,einsn liu static int pairwise=0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH \n"); switch (wrq->flags & IW_AUTH_INDEX) { case IW_AUTH_WPA_VERSION: wpa_version = wrq->value; if(wrq->value == IW_AUTH_WPA_VERSION_DISABLED) { - PRINT_K("iwctl_siwauth:set WPADEV to disable at 1??????\n"); + PRINT_K("iwctl_siwauth:set WPADEV to disable at 1??????\n"); } else if(wrq->value == IW_AUTH_WPA_VERSION_WPA) { - PRINT_K("iwctl_siwauth:set WPADEV to WPA1******\n"); + PRINT_K("iwctl_siwauth:set WPADEV to WPA1******\n"); } else { - PRINT_K("iwctl_siwauth:set WPADEV to WPA2******\n"); + PRINT_K("iwctl_siwauth:set WPADEV to WPA2******\n"); } break; case IW_AUTH_CIPHER_PAIRWISE: pairwise = wrq->value; - PRINT_K("iwctl_siwauth:set pairwise=%d\n",pairwise); + PRINT_K("iwctl_siwauth:set pairwise=%d\n",pairwise); if(pairwise == IW_AUTH_CIPHER_CCMP){ pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; }else if(pairwise == IW_AUTH_CIPHER_TKIP){ pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; } else if (pairwise == IW_AUTH_CIPHER_WEP40 || - pairwise == IW_AUTH_CIPHER_WEP104) { + pairwise == IW_AUTH_CIPHER_WEP104) { pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; }else if(pairwise == IW_AUTH_CIPHER_NONE){ //do nothing,einsn liu @@ -1368,7 +1368,7 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, break; case IW_AUTH_CIPHER_GROUP: - PRINT_K("iwctl_siwauth:set GROUP=%d\n",wrq->value); + PRINT_K("iwctl_siwauth:set GROUP=%d\n",wrq->value); if(wpa_version == IW_AUTH_WPA_VERSION_DISABLED) break; if(pairwise == IW_AUTH_CIPHER_NONE){ @@ -1380,7 +1380,7 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, } break; case IW_AUTH_KEY_MGMT: - PRINT_K("iwctl_siwauth(wpa_version=%d):set KEY_MGMT=%d\n",wpa_version,wrq->value); + PRINT_K("iwctl_siwauth(wpa_version=%d):set KEY_MGMT=%d\n",wpa_version,wrq->value); if(wpa_version == IW_AUTH_WPA_VERSION_WPA2){ if(wrq->value == IW_AUTH_KEY_MGMT_PSK) pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK; @@ -1398,7 +1398,7 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, case IW_AUTH_DROP_UNENCRYPTED: break; case IW_AUTH_80211_AUTH_ALG: - PRINT_K("iwctl_siwauth:set AUTH_ALG=%d\n",wrq->value); + PRINT_K("iwctl_siwauth:set AUTH_ALG=%d\n",wrq->value); if(wrq->value==IW_AUTH_ALG_OPEN_SYSTEM){ pMgmt->bShareKeyAlgorithm=FALSE; }else if(wrq->value==IW_AUTH_ALG_SHARED_KEY){ @@ -1420,14 +1420,14 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; pMgmt->bShareKeyAlgorithm = FALSE; pMgmt->eAuthenMode = WMAC_AUTH_OPEN; - PRINT_K("iwctl_siwauth:set WPADEV to disaable at 2?????\n"); + PRINT_K("iwctl_siwauth:set WPADEV to disaable at 2?????\n"); } break; default: ret = -EOPNOTSUPP; break; } - return ret; + return ret; } int iwctl_giwauth(struct net_device *dev, struct iw_request_info *info, @@ -1463,12 +1463,12 @@ int iwctl_siwgenie(struct net_device *dev, struct iw_request_info *info, pMgmt->wWPAIELen = 0; } - out://not completely ...not necessary in wpa_supplicant 0.5.8 +out://not completely ...not necessary in wpa_supplicant 0.5.8 return ret; } int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info, - struct iw_point *wrq, char *extra) + struct iw_point *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -1489,132 +1489,132 @@ int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info, } int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, - struct iw_point *wrq, char *extra) + struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); struct iw_encode_ext *ext = (struct iw_encode_ext*)extra; - struct viawget_wpa_param *param=NULL; + struct viawget_wpa_param *param=NULL; //original member - wpa_alg alg_name; - u8 addr[6]; - int key_idx, set_tx=0; - u8 seq[IW_ENCODE_SEQ_MAX_SIZE]; - u8 key[64]; - size_t seq_len=0,key_len=0; - u8 *buf; - size_t blen; - u8 key_array[64]; - int ret=0; - -PRINT_K("SIOCSIWENCODEEXT...... \n"); - -blen = sizeof(*param); -buf = kmalloc((int)blen, (int)GFP_KERNEL); -if (buf == NULL) - return -ENOMEM; -memset(buf, 0, blen); -param = (struct viawget_wpa_param *) buf; + wpa_alg alg_name; + u8 addr[6]; + int key_idx, set_tx=0; + u8 seq[IW_ENCODE_SEQ_MAX_SIZE]; + u8 key[64]; + size_t seq_len=0,key_len=0; + u8 *buf; + size_t blen; + u8 key_array[64]; + int ret=0; + + PRINT_K("SIOCSIWENCODEEXT...... \n"); + + blen = sizeof(*param); + buf = kmalloc((int)blen, (int)GFP_KERNEL); + if (buf == NULL) + return -ENOMEM; + memset(buf, 0, blen); + param = (struct viawget_wpa_param *) buf; //recover alg_name -switch (ext->alg) { - case IW_ENCODE_ALG_NONE: - alg_name = WPA_ALG_NONE; + switch (ext->alg) { + case IW_ENCODE_ALG_NONE: + alg_name = WPA_ALG_NONE; break; - case IW_ENCODE_ALG_WEP: - alg_name = WPA_ALG_WEP; + case IW_ENCODE_ALG_WEP: + alg_name = WPA_ALG_WEP; break; - case IW_ENCODE_ALG_TKIP: - alg_name = WPA_ALG_TKIP; + case IW_ENCODE_ALG_TKIP: + alg_name = WPA_ALG_TKIP; break; - case IW_ENCODE_ALG_CCMP: - alg_name = WPA_ALG_CCMP; + case IW_ENCODE_ALG_CCMP: + alg_name = WPA_ALG_CCMP; break; - default: + default: PRINT_K("Unknown alg = %d\n",ext->alg); ret= -ENOMEM; goto error; - } + } //recover addr - memcpy(addr, ext->addr.sa_data, ETH_ALEN); + memcpy(addr, ext->addr.sa_data, ETH_ALEN); //recover key_idx - key_idx = (wrq->flags&IW_ENCODE_INDEX) - 1; + key_idx = (wrq->flags&IW_ENCODE_INDEX) - 1; //recover set_tx -if(ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) - set_tx = 1; + if(ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) + set_tx = 1; //recover seq,seq_len if(ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { - seq_len=IW_ENCODE_SEQ_MAX_SIZE; - memcpy(seq, ext->rx_seq, seq_len); - } -//recover key,key_len -if(ext->key_len) { - key_len=ext->key_len; - memcpy(key, &ext->key[0], key_len); + seq_len=IW_ENCODE_SEQ_MAX_SIZE; + memcpy(seq, ext->rx_seq, seq_len); } -memset(key_array, 0, 64); -if ( key_len > 0) { - memcpy(key_array, key, key_len); - if (key_len == 32) { - // notice ! the oder - memcpy(&key_array[16], &key[24], 8); - memcpy(&key_array[24], &key[16], 8); +//recover key,key_len + if(ext->key_len) { + key_len=ext->key_len; + memcpy(key, &ext->key[0], key_len); } + memset(key_array, 0, 64); + if ( key_len > 0) { + memcpy(key_array, key, key_len); + if (key_len == 32) { + // notice ! the oder + memcpy(&key_array[16], &key[24], 8); + memcpy(&key_array[24], &key[16], 8); + } } /**************Translate iw_encode_ext to viawget_wpa_param****************/ -memcpy(param->addr, addr, ETH_ALEN); -param->u.wpa_key.alg_name = (int)alg_name; -param->u.wpa_key.set_tx = set_tx; -param->u.wpa_key.key_index = key_idx; -param->u.wpa_key.key_len = key_len; -param->u.wpa_key.key = (u8 *)key_array; -param->u.wpa_key.seq = (u8 *)seq; -param->u.wpa_key.seq_len = seq_len; + memcpy(param->addr, addr, ETH_ALEN); + param->u.wpa_key.alg_name = (int)alg_name; + param->u.wpa_key.set_tx = set_tx; + param->u.wpa_key.key_index = key_idx; + param->u.wpa_key.key_len = key_len; + param->u.wpa_key.key = (u8 *)key_array; + param->u.wpa_key.seq = (u8 *)seq; + param->u.wpa_key.seq_len = seq_len; //****set if current action is Network Manager count?? //****this method is so foolish,but there is no other way??? -if(param->u.wpa_key.alg_name == WPA_ALG_NONE) { - if(param->u.wpa_key.key_index ==0) { - pDevice->bwextstep0 = TRUE; - } - if ((pDevice->bwextstep0 == TRUE) && (param->u.wpa_key.key_index == 1)) { - pDevice->bwextstep0 = FALSE; - pDevice->bwextstep1 = TRUE; - } - if ((pDevice->bwextstep1 == TRUE) && (param->u.wpa_key.key_index == 2)) { - pDevice->bwextstep1 = FALSE; - pDevice->bwextstep2 = TRUE; + if(param->u.wpa_key.alg_name == WPA_ALG_NONE) { + if(param->u.wpa_key.key_index ==0) { + pDevice->bwextstep0 = TRUE; + } + if ((pDevice->bwextstep0 == TRUE) && (param->u.wpa_key.key_index == 1)) { + pDevice->bwextstep0 = FALSE; + pDevice->bwextstep1 = TRUE; + } + if ((pDevice->bwextstep1 == TRUE) && (param->u.wpa_key.key_index == 2)) { + pDevice->bwextstep1 = FALSE; + pDevice->bwextstep2 = TRUE; + } + if ((pDevice->bwextstep2 == TRUE)&&(param->u.wpa_key.key_index == 3)) { + pDevice->bwextstep2 = FALSE; + pDevice->bwextstep3 = TRUE; + } + } + if(pDevice->bwextstep3 == TRUE) { + PRINT_K("SIOCSIWENCODEEXT:Enable WPA WEXT SUPPORT!!!!!\n"); + pDevice->bwextstep0 = FALSE; + pDevice->bwextstep1 = FALSE; + pDevice->bwextstep2 = FALSE; + pDevice->bwextstep3 = FALSE; + pDevice->bWPASuppWextEnabled = TRUE; + memset(pMgmt->abyDesireBSSID, 0xFF,6); + KeyvInitTable(pDevice,&pDevice->sKey); } - if ((pDevice->bwextstep2 == TRUE)&&(param->u.wpa_key.key_index == 3)) { - pDevice->bwextstep2 = FALSE; - pDevice->bwextstep3 = TRUE; - } - } -if(pDevice->bwextstep3 == TRUE) { - PRINT_K("SIOCSIWENCODEEXT:Enable WPA WEXT SUPPORT!!!!!\n"); - pDevice->bwextstep0 = FALSE; - pDevice->bwextstep1 = FALSE; - pDevice->bwextstep2 = FALSE; - pDevice->bwextstep3 = FALSE; - pDevice->bWPASuppWextEnabled = TRUE; - memset(pMgmt->abyDesireBSSID, 0xFF,6); - KeyvInitTable(pDevice,&pDevice->sKey); - } //****** - spin_lock_irq(&pDevice->lock); - ret = wpa_set_keys(pDevice, param, TRUE); - spin_unlock_irq(&pDevice->lock); + spin_lock_irq(&pDevice->lock); + ret = wpa_set_keys(pDevice, param, TRUE); + spin_unlock_irq(&pDevice->lock); error: -kfree(param); + kfree(param); return ret; } int iwctl_giwencodeext(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - return -EOPNOTSUPP; + return -EOPNOTSUPP; } int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info, @@ -1633,10 +1633,10 @@ int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info, case IW_MLME_DEAUTH: case IW_MLME_DISASSOC: if(pDevice->bLinkPass == TRUE){ - PRINT_K("iwctl_siwmlme--->send DISASSOCIATE\n"); - bScheduleCommand((void *) pDevice, - WLAN_CMD_DISASSOCIATE, - NULL); + PRINT_K("iwctl_siwmlme--->send DISASSOCIATE\n"); + bScheduleCommand((void *) pDevice, + WLAN_CMD_DISASSOCIATE, + NULL); } break; default: @@ -1665,7 +1665,7 @@ static const iw_handler iwctl_handler[] = (iw_handler) NULL, // SIOCGIWPRIV (iw_handler) NULL, // SIOCSIWSTATS (iw_handler) NULL, // SIOCGIWSTATS - (iw_handler) NULL, // SIOCSIWSPY + (iw_handler) NULL, // SIOCSIWSPY (iw_handler) NULL, // SIOCGIWSPY (iw_handler) NULL, // -- hole -- (iw_handler) NULL, // -- hole -- @@ -1713,9 +1713,9 @@ static const iw_handler iwctl_private_handler[] = }; struct iw_priv_args iwctl_private_args[] = { -{ IOCTL_CMD_SET, - IW_PRIV_TYPE_CHAR | 1024, 0, - "set"}, + { IOCTL_CMD_SET, + IW_PRIV_TYPE_CHAR | 1024, 0, + "set"}, }; const struct iw_handler_def iwctl_handler_def = -- cgit v0.10.2 From bb6ec004c153792d7fc1bb2d8cab333c04287680 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Mon, 25 Jun 2012 01:56:35 +0200 Subject: staging: vt6656: iwctl: remove redundant ';' else clauses don't need to be terminated with ';'. Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index 7618fb9..ca4e7f0 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -1321,7 +1321,7 @@ int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info, } else { wrq->value = 0; - }; + } wrq->disabled = (wrq->value == 0); wrq->fixed = 1; return 0; -- cgit v0.10.2 From c91a8d5a7b03ac6801c92087e26dadd968f0e0e7 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Mon, 25 Jun 2012 01:56:43 +0200 Subject: staging: vt6656: iwctl: Fix up variable declarations (whitespace and 'one-per-line') Ensure that we have only one variable declaration per line and for each of those lines we have one space between type and variable name and if there's assignment, then we have one space on each side of the equals sign (and no more than 80 characters per line). Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index ca4e7f0..9fc9059 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -60,7 +60,7 @@ static const long frequency_list[] = { 5700, 5745, 5765, 5785, 5805, 5825 }; -static int msglevel =MSG_LEVEL_INFO; +static int msglevel = MSG_LEVEL_INFO; struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev) { @@ -100,11 +100,11 @@ int iwctl_giwname(struct net_device *dev, struct iw_request_info *info, int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - struct iw_scan_req *req = (struct iw_scan_req *)extra; - BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; - PWLAN_IE_SSID pItemSSID=NULL; + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct iw_scan_req *req = (struct iw_scan_req *)extra; + BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; + PWLAN_IE_SSID pItemSSID=NULL; if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) return -EINVAL; @@ -172,12 +172,15 @@ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - int ii, jj, kk; - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - PKnownBSS pBSS; - PWLAN_IE_SSID pItemSSID; - PWLAN_IE_SUPP_RATES pSuppRates, pExtSuppRates; + int ii; + int jj; + int kk; + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PKnownBSS pBSS; + PWLAN_IE_SSID pItemSSID; + PWLAN_IE_SUPP_RATES pSuppRates; + PWLAN_IE_SUPP_RATES pExtSuppRates; char *current_ev = extra; char *end_buf = extra + IW_SCAN_MAX_DATA; char *current_val = NULL; @@ -320,7 +323,7 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = (PSDevice)netdev_priv(dev); int rc = 0; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n"); @@ -360,8 +363,8 @@ int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info, int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ \n"); @@ -386,8 +389,8 @@ int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info, int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, __u32 *wmode, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int rc = 0; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMODE \n"); @@ -450,8 +453,8 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, void iwctl_giwmode(struct net_device *dev, struct iw_request_info *info, __u32 *wmode, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE \n"); @@ -481,8 +484,12 @@ void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { struct iw_range *range = (struct iw_range *) extra; - int i,k; - BYTE abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90}; + int i; + int k; + BYTE abySupportedRates[13] = { + 0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, + 0x60, 0x6C, 0x90 + }; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRANGE\n"); if (wrq->pointer) { @@ -576,10 +583,10 @@ void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info, int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int rc = 0; - BYTE ZeroBSSID[WLAN_BSSID_LEN]={0x00,0x00,0x00,0x00,0x00,0x00}; + BYTE ZeroBSSID[WLAN_BSSID_LEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; PRINT_K(" SIOCSIWAP \n"); @@ -596,7 +603,8 @@ int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, //mike add: if desired AP is hidden ssid(there are two same BSSID in list), // then ignore,because you don't known which one to be connect with?? { - unsigned int ii, uSameBssidNum = 0; + unsigned ii; + unsigned uSameBssidNum = 0; for (ii = 0; ii < MAX_BSS_NUM; ii++) { if (pMgmt->sBSSList[ii].bActive && !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, @@ -623,8 +631,8 @@ int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, int iwctl_giwap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP \n"); @@ -647,11 +655,13 @@ int iwctl_giwap(struct net_device *dev, struct iw_request_info *info, int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - int ii,jj, rc = 0; + int ii; + int jj; + int rc = 0; struct sockaddr sock[IW_MAX_AP]; struct iw_quality qual[IW_MAX_AP]; - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAPLIST \n"); // Only super-user can see AP list @@ -692,9 +702,9 @@ int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info, int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - PWLAN_IE_SSID pItemSSID; + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PWLAN_IE_SSID pItemSSID; if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) return -EINVAL; @@ -739,9 +749,10 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, if(pDevice->bWPASuppWextEnabled == TRUE) { /*******search if in hidden ssid mode ****/ { - PKnownBSS pCurr = NULL; - BYTE abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; - unsigned int ii, uSameBssidNum = 0; + PKnownBSS pCurr = NULL; + BYTE abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; + unsigned ii; + unsigned uSameBssidNum = 0; memcpy(abyTmpDesireSSID,pMgmt->abyDesireSSID,sizeof(abyTmpDesireSSID)); pCurr = BSSpSearchBSSList(pDevice, @@ -802,9 +813,9 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, void iwctl_giwessid(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - PWLAN_IE_SSID pItemSSID; + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PWLAN_IE_SSID pItemSSID; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWESSID \n"); @@ -826,11 +837,14 @@ void iwctl_giwessid(struct net_device *dev, struct iw_request_info *info, int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = (PSDevice)netdev_priv(dev); int rc = 0; - u8 brate = 0; - int i; - BYTE abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90}; + u8 brate = 0; + int i; + BYTE abySupportedRates[13] = { + 0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, + 0x60, 0x6C, 0x90 + }; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE \n"); @@ -849,7 +863,7 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, brate = wrq->value; } else { // Setting by frequency value - u8 normvalue = (u8) (wrq->value/500000); + u8 normvalue = (u8) (wrq->value/500000); // Check if rate is valid for (i = 0 ; i < 13 ; i++) { @@ -905,13 +919,17 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, void iwctl_giwrate(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE \n"); { - BYTE abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90}; + BYTE abySupportedRates[13] = { + 0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, + 0x48, 0x60, 0x6C, 0x90 + }; int brate = 0; + if (pDevice->uConnectionRate < 13) { brate = abySupportedRates[pDevice->uConnectionRate]; }else { @@ -964,7 +982,7 @@ int iwctl_siwrts(struct net_device *dev, struct iw_param *wrq) int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = (PSDevice)netdev_priv(dev); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS \n"); wrq->value = pDevice->wRTSThreshold; @@ -980,7 +998,7 @@ int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info, int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = (PSDevice)netdev_priv(dev); int rc = 0; int fthr = wrq->value; @@ -1003,7 +1021,7 @@ int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info, int iwctl_giwfrag(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = (PSDevice)netdev_priv(dev); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG \n"); wrq->value = pDevice->wFragmentationThreshold; @@ -1019,7 +1037,7 @@ int iwctl_giwfrag(struct net_device *dev, struct iw_request_info *info, int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = (PSDevice)netdev_priv(dev); int rc = 0; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRETRY \n"); @@ -1052,7 +1070,7 @@ int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info, int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = (PSDevice)netdev_priv(dev); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY \n"); wrq->disabled = 0; // Can't be disabled @@ -1079,10 +1097,12 @@ int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info, int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); DWORD dwKeyIndex = (DWORD)(wrq->flags & IW_ENCODE_INDEX); - int ii,uu, rc = 0; + int ii; + int uu; + int rc = 0; int index = (wrq->flags & IW_ENCODE_INDEX); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE \n"); @@ -1179,12 +1199,12 @@ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); char abyKey[WLAN_WEP232_KEYLEN]; - unsigned int index = (unsigned int)(wrq->flags & IW_ENCODE_INDEX); - PSKeyItem pKey = NULL; + unsigned index = (unsigned)(wrq->flags & IW_ENCODE_INDEX); + PSKeyItem pKey = NULL; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODE\n"); @@ -1237,8 +1257,8 @@ int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int rc = 0; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER \n"); @@ -1285,8 +1305,8 @@ int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info, int iwctl_giwpower(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int mode = pDevice->ePSMode; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER \n"); @@ -1311,7 +1331,7 @@ int iwctl_giwpower(struct net_device *dev, struct iw_request_info *info, int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = (PSDevice)netdev_priv(dev); long ldBm; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS \n"); @@ -1332,11 +1352,11 @@ int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info, int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - int ret=0; - static int wpa_version=0; //must be static to save the last value,einsn liu - static int pairwise=0; + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + int ret = 0; + static int wpa_version = 0; //must be static to save the last value,einsn liu + static int pairwise = 0; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH \n"); switch (wrq->flags & IW_AUTH_INDEX) { @@ -1439,9 +1459,9 @@ int iwctl_giwauth(struct net_device *dev, struct iw_request_info *info, int iwctl_siwgenie(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - int ret=0; + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + int ret = 0; if(wrq->length){ if ((wrq->length < 2) || (extra[1]+2 != wrq->length)) { @@ -1470,9 +1490,9 @@ out://not completely ...not necessary in wpa_supplicant 0.5.8 int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - int ret=0; + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + int ret = 0; int space = wrq->length; wrq->length = 0; @@ -1491,21 +1511,23 @@ int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info, int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); struct iw_encode_ext *ext = (struct iw_encode_ext*)extra; struct viawget_wpa_param *param=NULL; //original member wpa_alg alg_name; - u8 addr[6]; - int key_idx, set_tx=0; - u8 seq[IW_ENCODE_SEQ_MAX_SIZE]; + u8 addr[6]; + int key_idx; + int set_tx=0; + u8 seq[IW_ENCODE_SEQ_MAX_SIZE]; u8 key[64]; - size_t seq_len=0,key_len=0; + size_t seq_len = 0; + size_t key_len = 0; u8 *buf; size_t blen; u8 key_array[64]; - int ret=0; + int ret = 0; PRINT_K("SIOCSIWENCODEEXT...... \n"); @@ -1620,8 +1642,8 @@ int iwctl_giwencodeext(struct net_device *dev, struct iw_request_info *info, int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); struct iw_mlme *mlme = (struct iw_mlme *)extra; int ret = 0; @@ -1647,8 +1669,7 @@ int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info, #endif -static const iw_handler iwctl_handler[] = -{ +static const iw_handler iwctl_handler[] = { (iw_handler) NULL, /* SIOCSIWCOMMIT */ (iw_handler) NULL, // SIOCGIWNAME (iw_handler) NULL, // SIOCSIWNWID @@ -1707,8 +1728,7 @@ static const iw_handler iwctl_handler[] = (iw_handler) NULL, // -- hole -- }; -static const iw_handler iwctl_private_handler[] = -{ +static const iw_handler iwctl_private_handler[] = { NULL, // SIOCIWFIRSTPRIV }; @@ -1718,8 +1738,7 @@ struct iw_priv_args iwctl_private_args[] = { "set"}, }; -const struct iw_handler_def iwctl_handler_def = -{ +const struct iw_handler_def iwctl_handler_def = { .get_wireless_stats = &iwctl_get_wireless_stats, .num_standard = sizeof(iwctl_handler)/sizeof(iw_handler), .num_private = 0, diff --git a/drivers/staging/vt6656/iwctl.h b/drivers/staging/vt6656/iwctl.h index 96fd043..d056f83 100644 --- a/drivers/staging/vt6656/iwctl.h +++ b/drivers/staging/vt6656/iwctl.h @@ -141,7 +141,7 @@ int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra); #endif // #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT -extern const struct iw_handler_def iwctl_handler_def; -extern const struct iw_priv_args iwctl_private_args; +extern const struct iw_handler_def iwctl_handler_def; +extern const struct iw_priv_args iwctl_private_args; #endif /* __IWCTL_H__ */ -- cgit v0.10.2 From c5a415cab5f88e7b527a40ab992c06316a59a8af Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Mon, 25 Jun 2012 01:56:50 +0200 Subject: staging: vt6656: iwctl: ensure one space between defined name and value Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index 9fc9059..218e146 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -47,9 +47,9 @@ #include #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT -#define SUPPORTED_WIRELESS_EXT 18 +#define SUPPORTED_WIRELESS_EXT 18 #else -#define SUPPORTED_WIRELESS_EXT 17 +#define SUPPORTED_WIRELESS_EXT 17 #endif static const long frequency_list[] = { -- cgit v0.10.2 From 1a6dd0da0fefe0217f0c3a15dbbf3cfaf6909bc4 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Mon, 25 Jun 2012 01:56:59 +0200 Subject: staging: vt6656: iwctl: remove redundant cast (to PSDevice) netdev_priv() returns a void*, so there is no reason to explicitly cast to (PSDevice) when assigning to a variable of type PSDevice. The cast is done implicitly. Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index 218e146..eeaee59 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -100,7 +100,7 @@ int iwctl_giwname(struct net_device *dev, struct iw_request_info *info, int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); struct iw_scan_req *req = (struct iw_scan_req *)extra; BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; @@ -175,7 +175,7 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, int ii; int jj; int kk; - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PKnownBSS pBSS; PWLAN_IE_SSID pItemSSID; @@ -323,7 +323,7 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); int rc = 0; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n"); @@ -363,7 +363,7 @@ int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info, int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ \n"); @@ -389,7 +389,7 @@ int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info, int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, __u32 *wmode, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int rc = 0; @@ -453,7 +453,7 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, void iwctl_giwmode(struct net_device *dev, struct iw_request_info *info, __u32 *wmode, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -583,7 +583,7 @@ void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info, int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int rc = 0; BYTE ZeroBSSID[WLAN_BSSID_LEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -631,7 +631,7 @@ int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, int iwctl_giwap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP \n"); @@ -660,7 +660,7 @@ int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info, int rc = 0; struct sockaddr sock[IW_MAX_AP]; struct iw_quality qual[IW_MAX_AP]; - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAPLIST \n"); @@ -702,7 +702,7 @@ int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info, int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PWLAN_IE_SSID pItemSSID; @@ -813,7 +813,7 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, void iwctl_giwessid(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PWLAN_IE_SSID pItemSSID; @@ -837,7 +837,7 @@ void iwctl_giwessid(struct net_device *dev, struct iw_request_info *info, int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); int rc = 0; u8 brate = 0; int i; @@ -919,7 +919,7 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, void iwctl_giwrate(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE \n"); @@ -963,7 +963,7 @@ void iwctl_giwrate(struct net_device *dev, struct iw_request_info *info, */ int iwctl_siwrts(struct net_device *dev, struct iw_param *wrq) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); if ((wrq->value < 0 || wrq->value > 2312) && !wrq->disabled) return -EINVAL; @@ -982,7 +982,7 @@ int iwctl_siwrts(struct net_device *dev, struct iw_param *wrq) int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS \n"); wrq->value = pDevice->wRTSThreshold; @@ -998,7 +998,7 @@ int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info, int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); int rc = 0; int fthr = wrq->value; @@ -1021,7 +1021,7 @@ int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info, int iwctl_giwfrag(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG \n"); wrq->value = pDevice->wFragmentationThreshold; @@ -1037,7 +1037,7 @@ int iwctl_giwfrag(struct net_device *dev, struct iw_request_info *info, int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); int rc = 0; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRETRY \n"); @@ -1070,7 +1070,7 @@ int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info, int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY \n"); wrq->disabled = 0; // Can't be disabled @@ -1097,7 +1097,7 @@ int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info, int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); DWORD dwKeyIndex = (DWORD)(wrq->flags & IW_ENCODE_INDEX); int ii; @@ -1199,7 +1199,7 @@ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); char abyKey[WLAN_WEP232_KEYLEN]; @@ -1257,7 +1257,7 @@ int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int rc = 0; @@ -1305,7 +1305,7 @@ int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info, int iwctl_giwpower(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int mode = pDevice->ePSMode; @@ -1331,7 +1331,7 @@ int iwctl_giwpower(struct net_device *dev, struct iw_request_info *info, int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); long ldBm; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS \n"); @@ -1352,7 +1352,7 @@ int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info, int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int ret = 0; static int wpa_version = 0; //must be static to save the last value,einsn liu @@ -1459,7 +1459,7 @@ int iwctl_giwauth(struct net_device *dev, struct iw_request_info *info, int iwctl_siwgenie(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int ret = 0; @@ -1490,7 +1490,7 @@ out://not completely ...not necessary in wpa_supplicant 0.5.8 int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int ret = 0; int space = wrq->length; @@ -1511,7 +1511,7 @@ int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info, int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); struct iw_encode_ext *ext = (struct iw_encode_ext*)extra; struct viawget_wpa_param *param=NULL; @@ -1642,7 +1642,7 @@ int iwctl_giwencodeext(struct net_device *dev, struct iw_request_info *info, int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + PSDevice pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); struct iw_mlme *mlme = (struct iw_mlme *)extra; int ret = 0; -- cgit v0.10.2 From da06f7dbdb0ac4eb0cbf70b8d08b6f921e14d745 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Mon, 25 Jun 2012 01:57:07 +0200 Subject: staging: vt6656: iwctl: remove unneeded scope block in iwctl_siwessid() Reduce indentation by removing completely redundant scope block in the iwctl_siwessid() function. Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index eeaee59..3249a01 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -748,23 +748,41 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, //so here need not associate?? if(pDevice->bWPASuppWextEnabled == TRUE) { /*******search if in hidden ssid mode ****/ - { - PKnownBSS pCurr = NULL; - BYTE abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; - unsigned ii; - unsigned uSameBssidNum = 0; - - memcpy(abyTmpDesireSSID,pMgmt->abyDesireSSID,sizeof(abyTmpDesireSSID)); - pCurr = BSSpSearchBSSList(pDevice, - NULL, - abyTmpDesireSSID, - pDevice->eConfigPHYMode - ); - - if (pCurr == NULL){ - PRINT_K("SIOCSIWESSID:hidden ssid site survey before associate.......\n"); + PKnownBSS pCurr = NULL; + BYTE abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; + unsigned ii; + unsigned uSameBssidNum = 0; + + memcpy(abyTmpDesireSSID,pMgmt->abyDesireSSID,sizeof(abyTmpDesireSSID)); + pCurr = BSSpSearchBSSList(pDevice, NULL, + abyTmpDesireSSID, + pDevice->eConfigPHYMode + ); + + if (pCurr == NULL){ + PRINT_K("SIOCSIWESSID:hidden ssid site survey before associate.......\n"); + vResetCommandTimer((void *) pDevice); + pMgmt->eScanType = WMAC_SCAN_ACTIVE; + bScheduleCommand((void *) pDevice, + WLAN_CMD_BSSID_SCAN, + pMgmt->abyDesireSSID); + bScheduleCommand((void *) pDevice, + WLAN_CMD_SSID, + pMgmt->abyDesireSSID); + } + else { //mike:to find out if that desired SSID is a hidden-ssid AP , + // by means of judging if there are two same BSSID exist in list ? + for (ii = 0; ii < MAX_BSS_NUM; ii++) { + if (pMgmt->sBSSList[ii].bActive && + !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, + pCurr->abyBSSID)) { + uSameBssidNum++; + } + } + if(uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!! + PRINT_K("SIOCSIWESSID:hidden ssid directly associate.......\n"); vResetCommandTimer((void *) pDevice); - pMgmt->eScanType = WMAC_SCAN_ACTIVE; + pMgmt->eScanType = WMAC_SCAN_PASSIVE; //this scan type,you'll submit scan result! bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); @@ -772,27 +790,6 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, WLAN_CMD_SSID, pMgmt->abyDesireSSID); } - else { //mike:to find out if that desired SSID is a hidden-ssid AP , - // by means of judging if there are two same BSSID exist in list ? - for (ii = 0; ii < MAX_BSS_NUM; ii++) { - if (pMgmt->sBSSList[ii].bActive && - !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, - pCurr->abyBSSID)) { - uSameBssidNum++; - } - } - if(uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!! - PRINT_K("SIOCSIWESSID:hidden ssid directly associate.......\n"); - vResetCommandTimer((void *) pDevice); - pMgmt->eScanType = WMAC_SCAN_PASSIVE; //this scan type,you'll submit scan result! - bScheduleCommand((void *) pDevice, - WLAN_CMD_BSSID_SCAN, - pMgmt->abyDesireSSID); - bScheduleCommand((void *) pDevice, - WLAN_CMD_SSID, - pMgmt->abyDesireSSID); - } - } } return 0; } -- cgit v0.10.2 From bd4208e9225c8b4a0b52ed0f41956c41cdb1cd56 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Mon, 25 Jun 2012 01:57:13 +0200 Subject: staging: vt6656: iwctl: remove spaces between casts and variables We do not usually write a space between a cast and the variable being converted. this patch removes such spaces where they occour in iwctl.c Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index 3249a01..9b7d752 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -70,7 +70,7 @@ struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev) pDevice->wstats.status = pDevice->eOPMode; if(pDevice->scStatistic.LinkQuality > 100) pDevice->scStatistic.LinkQuality = 100; - pDevice->wstats.qual.qual =(BYTE) pDevice->scStatistic.LinkQuality; + pDevice->wstats.qual.qual =(BYTE)pDevice->scStatistic.LinkQuality; RFvRSSITodBm(pDevice, (BYTE)(pDevice->uCurrRSSI), &ldBm); pDevice->wstats.qual.level = ldBm; pDevice->wstats.qual.noise = 0; @@ -128,7 +128,7 @@ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, spin_lock_irq(&pDevice->lock); - BSSvClearBSSList((void *) pDevice, pDevice->bLinkPass); + BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass); //mike add: active scan OR passive scan OR desire_ssid scan if(wrq->length == sizeof(struct iw_scan_req)) { @@ -146,7 +146,7 @@ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, pMgmt->eScanType = WMAC_SCAN_PASSIVE; PRINT_K("SIOCSIWSCAN:[desired_ssid=%s,len=%d]\n",((PWLAN_IE_SSID)abyScanSSID)->abySSID, ((PWLAN_IE_SSID)abyScanSSID)->len); - bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID); + bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID); spin_unlock_irq(&pDevice->lock); return 0; @@ -160,7 +160,7 @@ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, } pMgmt->eScanType = WMAC_SCAN_PASSIVE; - bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL); + bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, NULL); spin_unlock_irq(&pDevice->lock); return 0; @@ -330,8 +330,8 @@ int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info, // If setting by frequency, convert to a channel if((wrq->e == 1) && - (wrq->m >= (int) 2.412e8) && - (wrq->m <= (int) 2.487e8)) { + (wrq->m >= (int)2.412e8) && + (wrq->m <= (int)2.487e8)) { int f = wrq->m / 100000; int c = 0; while((c < 14) && (f != frequency_list[c])) @@ -483,7 +483,7 @@ void iwctl_giwmode(struct net_device *dev, struct iw_request_info *info, void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { - struct iw_range *range = (struct iw_range *) extra; + struct iw_range *range = (struct iw_range *)extra; int i; int k; BYTE abySupportedRates[13] = { @@ -761,12 +761,12 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, if (pCurr == NULL){ PRINT_K("SIOCSIWESSID:hidden ssid site survey before associate.......\n"); - vResetCommandTimer((void *) pDevice); + vResetCommandTimer((void *)pDevice); pMgmt->eScanType = WMAC_SCAN_ACTIVE; - bScheduleCommand((void *) pDevice, + bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); - bScheduleCommand((void *) pDevice, + bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID); } @@ -781,12 +781,12 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, } if(uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!! PRINT_K("SIOCSIWESSID:hidden ssid directly associate.......\n"); - vResetCommandTimer((void *) pDevice); + vResetCommandTimer((void *)pDevice); pMgmt->eScanType = WMAC_SCAN_PASSIVE; //this scan type,you'll submit scan result! - bScheduleCommand((void *) pDevice, + bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); - bScheduleCommand((void *) pDevice, + bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID); } @@ -1272,11 +1272,11 @@ int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info, } if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { pDevice->ePSMode = WMAC_POWER_FAST; - PSvEnablePowerSaving((void *) pDevice, pMgmt->wListenInterval); + PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval); } else if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) { pDevice->ePSMode = WMAC_POWER_FAST; - PSvEnablePowerSaving((void *) pDevice, pMgmt->wListenInterval); + PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval); } switch (wrq->flags & IW_POWER_MODE) { case IW_POWER_UNICAST_R: @@ -1533,7 +1533,7 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, if (buf == NULL) return -ENOMEM; memset(buf, 0, blen); - param = (struct viawget_wpa_param *) buf; + param = (struct viawget_wpa_param *)buf; //recover alg_name switch (ext->alg) { @@ -1653,7 +1653,7 @@ int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info, case IW_MLME_DISASSOC: if(pDevice->bLinkPass == TRUE){ PRINT_K("iwctl_siwmlme--->send DISASSOCIATE\n"); - bScheduleCommand((void *) pDevice, + bScheduleCommand((void *)pDevice, WLAN_CMD_DISASSOCIATE, NULL); } @@ -1667,62 +1667,62 @@ int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info, #endif static const iw_handler iwctl_handler[] = { - (iw_handler) NULL, /* SIOCSIWCOMMIT */ - (iw_handler) NULL, // SIOCGIWNAME - (iw_handler) NULL, // SIOCSIWNWID - (iw_handler) NULL, // SIOCGIWNWID - (iw_handler) NULL, // SIOCSIWFREQ - (iw_handler) NULL, // SIOCGIWFREQ - (iw_handler) NULL, // SIOCSIWMODE - (iw_handler) NULL, // SIOCGIWMODE - (iw_handler) NULL, // SIOCSIWSENS - (iw_handler) NULL, // SIOCGIWSENS - (iw_handler) NULL, // SIOCSIWRANGE - (iw_handler) iwctl_giwrange, // SIOCGIWRANGE - (iw_handler) NULL, // SIOCSIWPRIV - (iw_handler) NULL, // SIOCGIWPRIV - (iw_handler) NULL, // SIOCSIWSTATS - (iw_handler) NULL, // SIOCGIWSTATS - (iw_handler) NULL, // SIOCSIWSPY - (iw_handler) NULL, // SIOCGIWSPY - (iw_handler) NULL, // -- hole -- - (iw_handler) NULL, // -- hole -- - (iw_handler) NULL, // SIOCSIWAP - (iw_handler) NULL, // SIOCGIWAP - (iw_handler) NULL, // -- hole -- 0x16 - (iw_handler) NULL, // SIOCGIWAPLIST - (iw_handler) iwctl_siwscan, // SIOCSIWSCAN - (iw_handler) iwctl_giwscan, // SIOCGIWSCAN - (iw_handler) NULL, // SIOCSIWESSID - (iw_handler) NULL, // SIOCGIWESSID - (iw_handler) NULL, // SIOCSIWNICKN - (iw_handler) NULL, // SIOCGIWNICKN - (iw_handler) NULL, // -- hole -- - (iw_handler) NULL, // -- hole -- - (iw_handler) NULL, // SIOCSIWRATE 0x20 - (iw_handler) NULL, // SIOCGIWRATE - (iw_handler) NULL, // SIOCSIWRTS - (iw_handler) NULL, // SIOCGIWRTS - (iw_handler) NULL, // SIOCSIWFRAG - (iw_handler) NULL, // SIOCGIWFRAG - (iw_handler) NULL, // SIOCSIWTXPOW - (iw_handler) NULL, // SIOCGIWTXPOW - (iw_handler) NULL, // SIOCSIWRETRY - (iw_handler) NULL, // SIOCGIWRETRY - (iw_handler) NULL, // SIOCSIWENCODE - (iw_handler) NULL, // SIOCGIWENCODE - (iw_handler) NULL, // SIOCSIWPOWER - (iw_handler) NULL, // SIOCGIWPOWER - (iw_handler) NULL, // -- hole -- - (iw_handler) NULL, // -- hole -- - (iw_handler) NULL, // SIOCSIWGENIE - (iw_handler) NULL, // SIOCGIWGENIE - (iw_handler) NULL, // SIOCSIWAUTH - (iw_handler) NULL, // SIOCGIWAUTH - (iw_handler) NULL, // SIOCSIWENCODEEXT - (iw_handler) NULL, // SIOCGIWENCODEEXT - (iw_handler) NULL, // SIOCSIWPMKSA - (iw_handler) NULL, // -- hole -- + (iw_handler)NULL, /* SIOCSIWCOMMIT */ + (iw_handler)NULL, // SIOCGIWNAME + (iw_handler)NULL, // SIOCSIWNWID + (iw_handler)NULL, // SIOCGIWNWID + (iw_handler)NULL, // SIOCSIWFREQ + (iw_handler)NULL, // SIOCGIWFREQ + (iw_handler)NULL, // SIOCSIWMODE + (iw_handler)NULL, // SIOCGIWMODE + (iw_handler)NULL, // SIOCSIWSENS + (iw_handler)NULL, // SIOCGIWSENS + (iw_handler)NULL, // SIOCSIWRANGE + (iw_handler)iwctl_giwrange, // SIOCGIWRANGE + (iw_handler)NULL, // SIOCSIWPRIV + (iw_handler)NULL, // SIOCGIWPRIV + (iw_handler)NULL, // SIOCSIWSTATS + (iw_handler)NULL, // SIOCGIWSTATS + (iw_handler)NULL, // SIOCSIWSPY + (iw_handler)NULL, // SIOCGIWSPY + (iw_handler)NULL, // -- hole -- + (iw_handler)NULL, // -- hole -- + (iw_handler)NULL, // SIOCSIWAP + (iw_handler)NULL, // SIOCGIWAP + (iw_handler)NULL, // -- hole -- 0x16 + (iw_handler)NULL, // SIOCGIWAPLIST + (iw_handler)iwctl_siwscan, // SIOCSIWSCAN + (iw_handler)iwctl_giwscan, // SIOCGIWSCAN + (iw_handler)NULL, // SIOCSIWESSID + (iw_handler)NULL, // SIOCGIWESSID + (iw_handler)NULL, // SIOCSIWNICKN + (iw_handler)NULL, // SIOCGIWNICKN + (iw_handler)NULL, // -- hole -- + (iw_handler)NULL, // -- hole -- + (iw_handler)NULL, // SIOCSIWRATE 0x20 + (iw_handler)NULL, // SIOCGIWRATE + (iw_handler)NULL, // SIOCSIWRTS + (iw_handler)NULL, // SIOCGIWRTS + (iw_handler)NULL, // SIOCSIWFRAG + (iw_handler)NULL, // SIOCGIWFRAG + (iw_handler)NULL, // SIOCSIWTXPOW + (iw_handler)NULL, // SIOCGIWTXPOW + (iw_handler)NULL, // SIOCSIWRETRY + (iw_handler)NULL, // SIOCGIWRETRY + (iw_handler)NULL, // SIOCSIWENCODE + (iw_handler)NULL, // SIOCGIWENCODE + (iw_handler)NULL, // SIOCSIWPOWER + (iw_handler)NULL, // SIOCGIWPOWER + (iw_handler)NULL, // -- hole -- + (iw_handler)NULL, // -- hole -- + (iw_handler)NULL, // SIOCSIWGENIE + (iw_handler)NULL, // SIOCGIWGENIE + (iw_handler)NULL, // SIOCSIWAUTH + (iw_handler)NULL, // SIOCGIWAUTH + (iw_handler)NULL, // SIOCSIWENCODEEXT + (iw_handler)NULL, // SIOCGIWENCODEEXT + (iw_handler)NULL, // SIOCSIWPMKSA + (iw_handler)NULL, // -- hole -- }; static const iw_handler iwctl_private_handler[] = { @@ -1740,7 +1740,7 @@ const struct iw_handler_def iwctl_handler_def = { .num_standard = sizeof(iwctl_handler)/sizeof(iw_handler), .num_private = 0, .num_private_args = 0, - .standard = (iw_handler *) iwctl_handler, + .standard = (iw_handler *)iwctl_handler, .private = NULL, .private_args = NULL, }; -- cgit v0.10.2 From f269d1c2a728767c5ba152b2fcb60387d902d259 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Mon, 25 Jun 2012 01:57:20 +0200 Subject: staging: vt6656: iwctl: space after if/for/while/switch Our coding style dictates a space after if/for/while/switch and the opening parenthesis. Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index 9b7d752..4254455 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -68,7 +68,7 @@ struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev) long ldBm; pDevice->wstats.status = pDevice->eOPMode; - if(pDevice->scStatistic.LinkQuality > 100) + if (pDevice->scStatistic.LinkQuality > 100) pDevice->scStatistic.LinkQuality = 100; pDevice->wstats.qual.qual =(BYTE)pDevice->scStatistic.LinkQuality; RFvRSSITodBm(pDevice, (BYTE)(pDevice->uCurrRSSI), &ldBm); @@ -117,7 +117,7 @@ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, return -EAGAIN; } - if(pDevice->byReAssocCount > 0) { //reject scan when re-associating! + if (pDevice->byReAssocCount > 0) { //reject scan when re-associating! //send scan event to wpa_Supplicant union iwreq_data wrqu; PRINT_K("wireless_send_event--->SIOCGIWSCAN(scan done)\n"); @@ -131,14 +131,14 @@ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass); //mike add: active scan OR passive scan OR desire_ssid scan - if(wrq->length == sizeof(struct iw_scan_req)) { + if (wrq->length == sizeof(struct iw_scan_req)) { if (wrq->flags & IW_SCAN_THIS_ESSID) { //desire_ssid scan memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); pItemSSID = (PWLAN_IE_SSID)abyScanSSID; pItemSSID->byElementID = WLAN_EID_SSID; memcpy(pItemSSID->abySSID, req->essid, (int)req->essid_len); if (pItemSSID->abySSID[req->essid_len - 1] == '\0') { - if(req->essid_len>0) + if (req->essid_len>0) pItemSSID->len = req->essid_len - 1; } else @@ -151,7 +151,7 @@ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, return 0; } - else if(req->scan_type == IW_SCAN_TYPE_PASSIVE) { //passive scan + else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { //passive scan pMgmt->eScanType = WMAC_SCAN_PASSIVE; } } @@ -235,7 +235,7 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN); { int f = (int)pBSS->uChannel - 1; - if(f < 0)f = 0; + if (f < 0)f = 0; iwe.u.freq.m = frequency_list[f] * 100000; iwe.u.freq.e = 1; } @@ -247,9 +247,9 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, iwe.u.qual.level = ldBm; iwe.u.qual.noise = 0; - if(-ldBm<50){ + if (-ldBm<50){ iwe.u.qual.qual = 100; - }else if(-ldBm > 90) { + }else if (-ldBm > 90) { iwe.u.qual.qual = 0; }else { iwe.u.qual.qual=(40-(-ldBm-50))*100/40; @@ -288,7 +288,7 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, current_val = iwe_stream_add_value(info,current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); } - if((current_val - current_ev) > IW_EV_LCP_LEN) + if ((current_val - current_ev) > IW_EV_LCP_LEN) current_ev = current_val; memset(&iwe, 0, sizeof(iwe)); @@ -329,22 +329,22 @@ int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n"); // If setting by frequency, convert to a channel - if((wrq->e == 1) && + if ((wrq->e == 1) && (wrq->m >= (int)2.412e8) && (wrq->m <= (int)2.487e8)) { int f = wrq->m / 100000; int c = 0; - while((c < 14) && (f != frequency_list[c])) + while ((c < 14) && (f != frequency_list[c])) c++; wrq->e = 0; wrq->m = c + 1; } // Setting by channel number - if((wrq->m > 14) || (wrq->e > 0)) + if ((wrq->m > 14) || (wrq->e > 0)) rc = -EOPNOTSUPP; else { int channel = wrq->m; - if((channel < 1) || (channel > 14)) { + if ((channel < 1) || (channel > 14)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: New channel value of %d is invalid!\n", dev->name, wrq->m); rc = -EINVAL; } else { @@ -374,7 +374,7 @@ int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info, #else { int f = (int)pMgmt->uCurrChannel - 1; - if(f < 0) + if (f < 0) f = 0; wrq->m = frequency_list[f] * 100000; wrq->e = 1; @@ -400,7 +400,7 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, return rc; } - switch(*wmode) { + switch (*wmode) { case IW_MODE_ADHOC: if (pMgmt->eConfigMode != WMAC_CONFIG_IBSS_STA) { @@ -515,7 +515,7 @@ void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info, for (i = 0 ; i < 13 ; i++) { range->bitrate[i] = abySupportedRates[i] * 500000; - if(range->bitrate[i] == 0) + if (range->bitrate[i] == 0) break; } range->num_bitrates = i; @@ -523,7 +523,7 @@ void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info, // Set an indication of the max TCP throughput // in bit/s that we can expect using this interface. // May be use for QoS stuff... Jean II - if(i > 2) + if (i > 2) range->throughput = 5 * 1000 * 1000; else range->throughput = 1.5 * 1000 * 1000; @@ -612,7 +612,7 @@ int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, uSameBssidNum++; } } - if(uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!! + if (uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!! PRINT_K("SIOCSIWAP:ignore for desired AP in hidden mode\n"); return rc; } @@ -713,7 +713,7 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, pDevice->fWPA_Authened = FALSE; // Check if we asked for `any' - if(wrq->flags == 0) { + if (wrq->flags == 0) { // Just send an empty SSID list memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); memset(pMgmt->abyDesireBSSID, 0xFF,6); @@ -730,7 +730,7 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, memcpy(pItemSSID->abySSID, extra, wrq->length); if (pItemSSID->abySSID[wrq->length - 1] == '\0') { - if(wrq->length>0) + if (wrq->length>0) pItemSSID->len = wrq->length - 1; } else @@ -738,7 +738,7 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, PRINT_K("set essid to %s \n",pItemSSID->abySSID); //mike:need clear desiredBSSID - if(pItemSSID->len==0) { + if (pItemSSID->len==0) { memset(pMgmt->abyDesireBSSID, 0xFF,6); return 0; } @@ -746,7 +746,7 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT //Wext wil order another command of siwap to link with desired AP, //so here need not associate?? - if(pDevice->bWPASuppWextEnabled == TRUE) { + if (pDevice->bWPASuppWextEnabled == TRUE) { /*******search if in hidden ssid mode ****/ PKnownBSS pCurr = NULL; BYTE abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; @@ -779,7 +779,7 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, uSameBssidNum++; } } - if(uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!! + if (uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!! PRINT_K("SIOCSIWESSID:hidden ssid directly associate.......\n"); vResetCommandTimer((void *)pDevice); pMgmt->eScanType = WMAC_SCAN_PASSIVE; //this scan type,you'll submit scan result! @@ -853,7 +853,7 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, // First : get a valid bit rate value // Which type of value - if((wrq->value < 13) && + if ((wrq->value < 13) && (wrq->value >= 0)) { // Setting by rate index // Find value in the magic rate table @@ -864,32 +864,32 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, // Check if rate is valid for (i = 0 ; i < 13 ; i++) { - if(normvalue == abySupportedRates[i]) { + if (normvalue == abySupportedRates[i]) { brate = i; break; } } } // -1 designed the max rate (mostly auto mode) - if(wrq->value == -1) { + if (wrq->value == -1) { // Get the highest available rate for (i = 0 ; i < 13 ; i++) { - if(abySupportedRates[i] == 0) + if (abySupportedRates[i] == 0) break; } - if(i != 0) + if (i != 0) brate = i - 1; } // Check that it is valid // brate is index of abySupportedRates[] - if(brate > 13 ) { + if (brate > 13 ) { rc = -EINVAL; return rc; } // Now, check if we want a fixed or auto value - if(wrq->fixed != 0) { + if (wrq->fixed != 0) { // Fixed mode // One rate, fixed pDevice->bFixRate = TRUE; @@ -1003,7 +1003,7 @@ int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info, if (wrq->disabled) fthr = 2312; - if((fthr < 256) || (fthr > 2312)) { + if ((fthr < 256) || (fthr > 2312)) { rc = -EINVAL; }else { fthr &= ~0x1; // Get an even value @@ -1045,7 +1045,7 @@ int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info, } if (wrq->flags & IW_RETRY_LIMIT) { - if(wrq->flags & IW_RETRY_MAX) + if (wrq->flags & IW_RETRY_MAX) pDevice->byLongRetryLimit = wrq->value; else if (wrq->flags & IW_RETRY_MIN) pDevice->byShortRetryLimit = wrq->value; @@ -1072,16 +1072,16 @@ int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info, wrq->disabled = 0; // Can't be disabled // Note : by default, display the min retry number - if((wrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { + if ((wrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { wrq->flags = IW_RETRY_LIFETIME; wrq->value = (int)pDevice->wMaxTransmitMSDULifetime; //ms - } else if((wrq->flags & IW_RETRY_MAX)) { + } else if ((wrq->flags & IW_RETRY_MAX)) { wrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX; wrq->value = (int)pDevice->byLongRetryLimit; } else { wrq->flags = IW_RETRY_LIMIT; wrq->value = (int)pDevice->byShortRetryLimit; - if((int)pDevice->byShortRetryLimit != (int)pDevice->byLongRetryLimit) + if ((int)pDevice->byShortRetryLimit != (int)pDevice->byLongRetryLimit) wrq->flags |= IW_RETRY_MIN; } @@ -1165,7 +1165,7 @@ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, } } // Read the flags - if(wrq->flags & IW_ENCODE_DISABLED){ + if (wrq->flags & IW_ENCODE_DISABLED){ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n"); pMgmt->bShareKeyAlgorithm = FALSE; @@ -1178,11 +1178,11 @@ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, spin_unlock_irq(&pDevice->lock); } } - if(wrq->flags & IW_ENCODE_RESTRICTED) { + if (wrq->flags & IW_ENCODE_RESTRICTED) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & ShareKey System\n"); pMgmt->bShareKeyAlgorithm = TRUE; } - if(wrq->flags & IW_ENCODE_OPEN) { + if (wrq->flags & IW_ENCODE_OPEN) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & Open System\n"); pMgmt->bShareKeyAlgorithm = FALSE; } @@ -1208,8 +1208,8 @@ int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, if (index > WLAN_WEP_NKEYS) { return -EINVAL; } - if(index<1){//get default key - if(pDevice->byKeyIndexbyKeyIndexbyKeyIndex; } else index=0; @@ -1231,7 +1231,7 @@ int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, wrq->flags |= IW_ENCODE_OPEN; wrq->length=0; - if((index==0)&&(pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled|| + if ((index==0)&&(pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled|| pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)){//get wpa pairwise key if (KeybGetKey(&(pDevice->sKey),pMgmt->abyCurrBSSID, 0xffffffff, &pKey)){ wrq->length = pKey->uKeyLength; @@ -1359,10 +1359,10 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, switch (wrq->flags & IW_AUTH_INDEX) { case IW_AUTH_WPA_VERSION: wpa_version = wrq->value; - if(wrq->value == IW_AUTH_WPA_VERSION_DISABLED) { + if (wrq->value == IW_AUTH_WPA_VERSION_DISABLED) { PRINT_K("iwctl_siwauth:set WPADEV to disable at 1??????\n"); } - else if(wrq->value == IW_AUTH_WPA_VERSION_WPA) { + else if (wrq->value == IW_AUTH_WPA_VERSION_WPA) { PRINT_K("iwctl_siwauth:set WPADEV to WPA1******\n"); } else { @@ -1372,24 +1372,24 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, case IW_AUTH_CIPHER_PAIRWISE: pairwise = wrq->value; PRINT_K("iwctl_siwauth:set pairwise=%d\n",pairwise); - if(pairwise == IW_AUTH_CIPHER_CCMP){ + if (pairwise == IW_AUTH_CIPHER_CCMP){ pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; - }else if(pairwise == IW_AUTH_CIPHER_TKIP){ + }else if (pairwise == IW_AUTH_CIPHER_TKIP){ pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; } else if (pairwise == IW_AUTH_CIPHER_WEP40 || pairwise == IW_AUTH_CIPHER_WEP104) { pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; - }else if(pairwise == IW_AUTH_CIPHER_NONE){ + }else if (pairwise == IW_AUTH_CIPHER_NONE){ //do nothing,einsn liu }else pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; break; case IW_AUTH_CIPHER_GROUP: PRINT_K("iwctl_siwauth:set GROUP=%d\n",wrq->value); - if(wpa_version == IW_AUTH_WPA_VERSION_DISABLED) + if (wpa_version == IW_AUTH_WPA_VERSION_DISABLED) break; - if(pairwise == IW_AUTH_CIPHER_NONE){ - if(wrq->value == IW_AUTH_CIPHER_CCMP){ + if (pairwise == IW_AUTH_CIPHER_NONE){ + if (wrq->value == IW_AUTH_CIPHER_CCMP){ pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; }else { pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; @@ -1398,14 +1398,14 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, break; case IW_AUTH_KEY_MGMT: PRINT_K("iwctl_siwauth(wpa_version=%d):set KEY_MGMT=%d\n",wpa_version,wrq->value); - if(wpa_version == IW_AUTH_WPA_VERSION_WPA2){ - if(wrq->value == IW_AUTH_KEY_MGMT_PSK) + if (wpa_version == IW_AUTH_WPA_VERSION_WPA2){ + if (wrq->value == IW_AUTH_KEY_MGMT_PSK) pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK; else pMgmt->eAuthenMode = WMAC_AUTH_WPA2; - }else if(wpa_version == IW_AUTH_WPA_VERSION_WPA){ - if(wrq->value == 0){ + }else if (wpa_version == IW_AUTH_WPA_VERSION_WPA){ + if (wrq->value == 0){ pMgmt->eAuthenMode = WMAC_AUTH_WPANONE; - }else if(wrq->value == IW_AUTH_KEY_MGMT_PSK) + }else if (wrq->value == IW_AUTH_KEY_MGMT_PSK) pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK; else pMgmt->eAuthenMode = WMAC_AUTH_WPA; } @@ -1416,9 +1416,9 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, break; case IW_AUTH_80211_AUTH_ALG: PRINT_K("iwctl_siwauth:set AUTH_ALG=%d\n",wrq->value); - if(wrq->value==IW_AUTH_ALG_OPEN_SYSTEM){ + if (wrq->value==IW_AUTH_ALG_OPEN_SYSTEM){ pMgmt->bShareKeyAlgorithm=FALSE; - }else if(wrq->value==IW_AUTH_ALG_SHARED_KEY){ + }else if (wrq->value==IW_AUTH_ALG_SHARED_KEY){ pMgmt->bShareKeyAlgorithm=TRUE; } break; @@ -1431,7 +1431,7 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, break; case IW_AUTH_PRIVACY_INVOKED: pDevice->bEncryptionEnable = !!wrq->value; - if(pDevice->bEncryptionEnable == FALSE){ + if (pDevice->bEncryptionEnable == FALSE){ wpa_version = 0; pairwise = 0; pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; @@ -1460,17 +1460,17 @@ int iwctl_siwgenie(struct net_device *dev, struct iw_request_info *info, PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int ret = 0; - if(wrq->length){ + if (wrq->length){ if ((wrq->length < 2) || (extra[1]+2 != wrq->length)) { ret = -EINVAL; goto out; } - if(wrq->length > MAX_WPA_IE_LEN){ + if (wrq->length > MAX_WPA_IE_LEN){ ret = -ENOMEM; goto out; } memset(pMgmt->abyWPAIE, 0, MAX_WPA_IE_LEN); - if(copy_from_user(pMgmt->abyWPAIE, extra, wrq->length)){ + if (copy_from_user(pMgmt->abyWPAIE, extra, wrq->length)){ ret = -EFAULT; goto out; } @@ -1493,10 +1493,10 @@ int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info, int space = wrq->length; wrq->length = 0; - if(pMgmt->wWPAIELen > 0){ + if (pMgmt->wWPAIELen > 0){ wrq->length = pMgmt->wWPAIELen; - if(pMgmt->wWPAIELen <= space){ - if(copy_to_user(extra, pMgmt->abyWPAIE, pMgmt->wWPAIELen)){ + if (pMgmt->wWPAIELen <= space){ + if (copy_to_user(extra, pMgmt->abyWPAIE, pMgmt->wWPAIELen)){ ret = -EFAULT; } }else @@ -1559,15 +1559,15 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, //recover key_idx key_idx = (wrq->flags&IW_ENCODE_INDEX) - 1; //recover set_tx - if(ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) + if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) set_tx = 1; //recover seq,seq_len - if(ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { + if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { seq_len=IW_ENCODE_SEQ_MAX_SIZE; memcpy(seq, ext->rx_seq, seq_len); } //recover key,key_len - if(ext->key_len) { + if (ext->key_len) { key_len=ext->key_len; memcpy(key, &ext->key[0], key_len); } @@ -1593,8 +1593,8 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, //****set if current action is Network Manager count?? //****this method is so foolish,but there is no other way??? - if(param->u.wpa_key.alg_name == WPA_ALG_NONE) { - if(param->u.wpa_key.key_index ==0) { + if (param->u.wpa_key.alg_name == WPA_ALG_NONE) { + if (param->u.wpa_key.key_index ==0) { pDevice->bwextstep0 = TRUE; } if ((pDevice->bwextstep0 == TRUE) && (param->u.wpa_key.key_index == 1)) { @@ -1610,7 +1610,7 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, pDevice->bwextstep3 = TRUE; } } - if(pDevice->bwextstep3 == TRUE) { + if (pDevice->bwextstep3 == TRUE) { PRINT_K("SIOCSIWENCODEEXT:Enable WPA WEXT SUPPORT!!!!!\n"); pDevice->bwextstep0 = FALSE; pDevice->bwextstep1 = FALSE; @@ -1644,14 +1644,14 @@ int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info, struct iw_mlme *mlme = (struct iw_mlme *)extra; int ret = 0; - if(memcmp(pMgmt->abyCurrBSSID, mlme->addr.sa_data, ETH_ALEN)){ + if (memcmp(pMgmt->abyCurrBSSID, mlme->addr.sa_data, ETH_ALEN)){ ret = -EINVAL; return ret; } - switch(mlme->cmd){ + switch (mlme->cmd){ case IW_MLME_DEAUTH: case IW_MLME_DISASSOC: - if(pDevice->bLinkPass == TRUE){ + if (pDevice->bLinkPass == TRUE){ PRINT_K("iwctl_siwmlme--->send DISASSOCIATE\n"); bScheduleCommand((void *)pDevice, WLAN_CMD_DISASSOCIATE, -- cgit v0.10.2 From 5a67363792715dd69e106762645ed2c41fcd37b0 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Mon, 25 Jun 2012 01:57:27 +0200 Subject: staging: vt6656: iwctl: comment cleanup All comments now have one space between the code they follow and the comment start chars and one space after the comment start chars and the comment text. Also cleaned up some spacing within comments - mostly removed space before ':' and added space after ',' etc. Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index 4254455..c639a3c 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -85,7 +85,7 @@ struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev) } /* - * Wireless Handler : get protocol name + * Wireless Handler: get protocol name */ int iwctl_giwname(struct net_device *dev, struct iw_request_info *info, char *wrq, char *extra) @@ -95,7 +95,7 @@ int iwctl_giwname(struct net_device *dev, struct iw_request_info *info, } /* - * Wireless Handler : set scan + * Wireless Handler: set scan */ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) @@ -117,8 +117,8 @@ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, return -EAGAIN; } - if (pDevice->byReAssocCount > 0) { //reject scan when re-associating! -//send scan event to wpa_Supplicant + if (pDevice->byReAssocCount > 0) { // reject scan when re-associating! + // send scan event to wpa_Supplicant union iwreq_data wrqu; PRINT_K("wireless_send_event--->SIOCGIWSCAN(scan done)\n"); memset(&wrqu, 0, sizeof(wrqu)); @@ -130,9 +130,9 @@ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass); -//mike add: active scan OR passive scan OR desire_ssid scan + // mike add: active scan OR passive scan OR desire_ssid scan if (wrq->length == sizeof(struct iw_scan_req)) { - if (wrq->flags & IW_SCAN_THIS_ESSID) { //desire_ssid scan + if (wrq->flags & IW_SCAN_THIS_ESSID) { // desire_ssid scan memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); pItemSSID = (PWLAN_IE_SSID)abyScanSSID; pItemSSID->byElementID = WLAN_EID_SSID; @@ -151,11 +151,11 @@ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, return 0; } - else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { //passive scan + else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { // passive scan pMgmt->eScanType = WMAC_SCAN_PASSIVE; } } - else { //active scan + else { // active scan pMgmt->eScanType = WMAC_SCAN_ACTIVE; } @@ -200,20 +200,20 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, break; pBSS = &(pMgmt->sBSSList[jj]); if (pBSS->bActive) { - //ADD mac address + // ADD mac address memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWAP; iwe.u.ap_addr.sa_family = ARPHRD_ETHER; memcpy(iwe.u.ap_addr.sa_data, pBSS->abyBSSID, WLAN_BSSID_LEN); current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_ADDR_LEN); - //ADD ssid + // ADD ssid memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWESSID; pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID; iwe.u.data.length = pItemSSID->len; iwe.u.data.flags = 1; current_ev = iwe_stream_add_point(info,current_ev,end_buf, &iwe, pItemSSID->abySSID); - //ADD mode + // ADD mode memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWMODE; if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo)) { @@ -224,7 +224,7 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, } iwe.len = IW_EV_UINT_LEN; current_ev = iwe_stream_add_event(info,current_ev, end_buf, &iwe, IW_EV_UINT_LEN); - //ADD frequency + // ADD frequency pSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abySuppRates; pExtSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abyExtSuppRates; memset(&iwe, 0, sizeof(iwe)); @@ -240,7 +240,7 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, iwe.u.freq.e = 1; } current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN); - //ADD quality + // ADD quality memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVQUAL; RFvRSSITodBm(pDevice, (BYTE)(pBSS->uRSSI), &ldBm); @@ -257,7 +257,7 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, iwe.u.qual.updated=7; current_ev = iwe_stream_add_event(info,current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); - //ADD encryption + // ADD encryption memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWENCODE; iwe.u.data.length = 0; @@ -312,13 +312,13 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, } } - }// for + } // for wrq->length = current_ev - extra; return 0; } /* - * Wireless Handler : set frequence or channel + * Wireless Handler: set frequence or channel */ int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *wrq, char *extra) @@ -358,7 +358,7 @@ int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info, } /* - * Wireless Handler : get frequence or channel + * Wireless Handler: get frequence or channel */ int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *wrq, char *extra) @@ -384,7 +384,7 @@ int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info, } /* - * Wireless Handler : set operation mode + * Wireless Handler: set operation mode */ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, __u32 *wmode, char *extra) @@ -448,7 +448,7 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, } /* - * Wireless Handler : get operation mode + * Wireless Handler: get operation mode */ void iwctl_giwmode(struct net_device *dev, struct iw_request_info *info, __u32 *wmode, char *extra) @@ -478,7 +478,7 @@ void iwctl_giwmode(struct net_device *dev, struct iw_request_info *info, } /* - * Wireless Handler : get capability range + * Wireless Handler: get capability range */ void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) @@ -499,7 +499,7 @@ void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info, range->max_nwid = 0x0000; range->num_channels = 14; // Should be based on cap_rid.country to give only - // what the current card support + // what the current card support k = 0; for (i = 0; i < 14; i++) { range->freq[k].i = i + 1; // List index @@ -548,9 +548,9 @@ void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info, IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; range->min_pmp = 0; - range->max_pmp = 1000000;// 1 secs + range->max_pmp = 1000000; // 1 secs range->min_pmt = 0; - range->max_pmt = 1000000;// 1 secs + range->max_pmt = 1000000; // 1 secs range->pmp_flags = IW_POWER_PERIOD; range->pmt_flags = IW_POWER_TIMEOUT; range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_ALL_R; @@ -572,7 +572,7 @@ void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info, // Note : with or without the (local->rssi), results // are somewhat different. - Jean II range->avg_qual.qual = 6; - range->avg_qual.level = 176; // -80 dBm + range->avg_qual.level = 176; // -80 dBm range->avg_qual.noise = 0; } } @@ -594,14 +594,15 @@ int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, rc = -EINVAL; else { memcpy(pMgmt->abyDesireBSSID, wrq->sa_data, 6); - //mike :add + // mike: add if ((is_broadcast_ether_addr(pMgmt->abyDesireBSSID)) || (memcmp(pMgmt->abyDesireBSSID, ZeroBSSID, 6) == 0)){ PRINT_K("SIOCSIWAP:invalid desired BSSID return!\n"); return rc; } - //mike add: if desired AP is hidden ssid(there are two same BSSID in list), - // then ignore,because you don't known which one to be connect with?? + // mike add: if desired AP is hidden ssid(there are + // two same BSSID in list), then ignore,because you + // don't known which one to be connect with?? { unsigned ii; unsigned uSameBssidNum = 0; @@ -626,7 +627,7 @@ int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, } /* - * Wireless Handler : get ap mac address + * Wireless Handler: get ap mac address */ int iwctl_giwap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *wrq, char *extra) @@ -650,7 +651,7 @@ int iwctl_giwap(struct net_device *dev, struct iw_request_info *info, } /* - * Wireless Handler : get ap list + * Wireless Handler: get ap list */ int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) @@ -697,7 +698,7 @@ int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info, } /* - * Wireless Handler : set essid + * Wireless Handler: set essid */ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) @@ -737,15 +738,15 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, pItemSSID->len = wrq->length; PRINT_K("set essid to %s \n",pItemSSID->abySSID); - //mike:need clear desiredBSSID + // mike: need clear desiredBSSID if (pItemSSID->len==0) { memset(pMgmt->abyDesireBSSID, 0xFF,6); return 0; } #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT - //Wext wil order another command of siwap to link with desired AP, - //so here need not associate?? + // Wext wil order another command of siwap to link + // with desired AP, so here need not associate?? if (pDevice->bWPASuppWextEnabled == TRUE) { /*******search if in hidden ssid mode ****/ PKnownBSS pCurr = NULL; @@ -770,8 +771,9 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, WLAN_CMD_SSID, pMgmt->abyDesireSSID); } - else { //mike:to find out if that desired SSID is a hidden-ssid AP , - // by means of judging if there are two same BSSID exist in list ? + else { // mike: to find out if that desired SSID is a + // hidden-ssid AP, by means of judging if there + // are two same BSSID exist in list ? for (ii = 0; ii < MAX_BSS_NUM; ii++) { if (pMgmt->sBSSList[ii].bActive && !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, @@ -779,10 +781,10 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, uSameBssidNum++; } } - if (uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!! + if (uSameBssidNum >= 2) { // hit: desired AP is in hidden ssid mode!!! PRINT_K("SIOCSIWESSID:hidden ssid directly associate.......\n"); vResetCommandTimer((void *)pDevice); - pMgmt->eScanType = WMAC_SCAN_PASSIVE; //this scan type,you'll submit scan result! + pMgmt->eScanType = WMAC_SCAN_PASSIVE; // this scan type, you'll submit scan result! bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); @@ -805,7 +807,7 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, } /* - * Wireless Handler : get essid + * Wireless Handler: get essid */ void iwctl_giwessid(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) @@ -816,8 +818,8 @@ void iwctl_giwessid(struct net_device *dev, struct iw_request_info *info, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWESSID \n"); - // Note : if wrq->u.data.flags != 0, we should - // get the relevant SSID from the SSID list... + // Note: if wrq->u.data.flags != 0, we should get the relevant + // SSID from the SSID list... // Get the current SSID pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; @@ -829,7 +831,7 @@ void iwctl_giwessid(struct net_device *dev, struct iw_request_info *info, } /* - * Wireless Handler : set data rate + * Wireless Handler: set data rate */ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) @@ -843,14 +845,13 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, 0x60, 0x6C, 0x90 }; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE \n"); if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) { rc = -EINVAL; return rc; } - // First : get a valid bit rate value + // First: get a valid bit rate value // Which type of value if ((wrq->value < 13) && @@ -911,7 +912,7 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, } /* - * Wireless Handler : get data rate + * Wireless Handler: get data rate */ void iwctl_giwrate(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) @@ -956,7 +957,7 @@ void iwctl_giwrate(struct net_device *dev, struct iw_request_info *info, } /* - * Wireless Handler : set rts threshold + * Wireless Handler: set rts threshold */ int iwctl_siwrts(struct net_device *dev, struct iw_param *wrq) { @@ -974,7 +975,7 @@ int iwctl_siwrts(struct net_device *dev, struct iw_param *wrq) } /* - * Wireless Handler : get rts + * Wireless Handler: get rts */ int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) @@ -990,7 +991,7 @@ int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info, } /* - * Wireless Handler : set fragment threshold + * Wireless Handler: set fragment threshold */ int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) @@ -1006,14 +1007,14 @@ int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info, if ((fthr < 256) || (fthr > 2312)) { rc = -EINVAL; }else { - fthr &= ~0x1; // Get an even value + fthr &= ~0x1; // Get an even value pDevice->wFragmentationThreshold = (u16)fthr; } return rc; } /* - * Wireless Handler : get fragment threshold + * Wireless Handler: get fragment threshold */ int iwctl_giwfrag(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) @@ -1029,7 +1030,7 @@ int iwctl_giwfrag(struct net_device *dev, struct iw_request_info *info, } /* - * Wireless Handler : set retry threshold + * Wireless Handler: set retry threshold */ int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) @@ -1062,19 +1063,19 @@ int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info, } /* - * Wireless Handler : get retry threshold + * Wireless Handler: get retry threshold */ int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) { PSDevice pDevice = netdev_priv(dev); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY \n"); - wrq->disabled = 0; // Can't be disabled + wrq->disabled = 0; // Can't be disabled - // Note : by default, display the min retry number + // Note: by default, display the min retry number if ((wrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { wrq->flags = IW_RETRY_LIFETIME; - wrq->value = (int)pDevice->wMaxTransmitMSDULifetime; //ms + wrq->value = (int)pDevice->wMaxTransmitMSDULifetime; // ms } else if ((wrq->flags & IW_RETRY_MAX)) { wrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX; wrq->value = (int)pDevice->byLongRetryLimit; @@ -1089,7 +1090,7 @@ int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info, } /* - * Wireless Handler : set encode mode + * Wireless Handler: set encode mode */ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) @@ -1156,7 +1157,7 @@ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, pDevice->bEncryptionEnable = TRUE; pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; - // Do we want to just set the transmit key index ? + // Do we want to just set the transmit key index? if ( index < 4 ) { pDevice->byKeyIndex = index; } else if (!(wrq->flags & IW_ENCODE_MODE)) { @@ -1208,7 +1209,7 @@ int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, if (index > WLAN_WEP_NKEYS) { return -EINVAL; } - if (index<1){//get default key + if (index<1){ // get default key if (pDevice->byKeyIndexbyKeyIndex; } else @@ -1232,7 +1233,7 @@ int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, wrq->length=0; if ((index==0)&&(pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled|| - pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)){//get wpa pairwise key + pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)){ // get wpa pairwise key if (KeybGetKey(&(pDevice->sKey),pMgmt->abyCurrBSSID, 0xffffffff, &pKey)){ wrq->length = pKey->uKeyLength; memcpy(abyKey, pKey->abyKey, pKey->uKeyLength); @@ -1249,7 +1250,7 @@ int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, } /* - * Wireless Handler : set power mode + * Wireless Handler: set power mode */ int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) @@ -1297,7 +1298,7 @@ int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info, } /* - * Wireless Handler : get power mode + * Wireless Handler: get power mode */ int iwctl_giwpower(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) @@ -1323,7 +1324,7 @@ int iwctl_giwpower(struct net_device *dev, struct iw_request_info *info, } /* - * Wireless Handler : get Sensitivity + * Wireless Handler: get Sensitivity */ int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) @@ -1352,7 +1353,7 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, PSDevice pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int ret = 0; - static int wpa_version = 0; //must be static to save the last value,einsn liu + static int wpa_version = 0; // must be static to save the last value, einsn liu static int pairwise = 0; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH \n"); @@ -1380,7 +1381,7 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, pairwise == IW_AUTH_CIPHER_WEP104) { pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; }else if (pairwise == IW_AUTH_CIPHER_NONE){ - //do nothing,einsn liu + // do nothing, einsn liu }else pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; break; @@ -1411,7 +1412,7 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, } break; case IW_AUTH_TKIP_COUNTERMEASURES: - break; /* FIXME */ + break; /* FIXME */ case IW_AUTH_DROP_UNENCRYPTED: break; case IW_AUTH_80211_AUTH_ALG: @@ -1480,7 +1481,7 @@ int iwctl_siwgenie(struct net_device *dev, struct iw_request_info *info, pMgmt->wWPAIELen = 0; } -out://not completely ...not necessary in wpa_supplicant 0.5.8 +out: // not completely ...not necessary in wpa_supplicant 0.5.8 return ret; } @@ -1512,7 +1513,7 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, PSMgmtObject pMgmt = &(pDevice->sMgmtObj); struct iw_encode_ext *ext = (struct iw_encode_ext*)extra; struct viawget_wpa_param *param=NULL; -//original member +// original member wpa_alg alg_name; u8 addr[6]; int key_idx; @@ -1535,7 +1536,7 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, memset(buf, 0, blen); param = (struct viawget_wpa_param *)buf; -//recover alg_name +// recover alg_name switch (ext->alg) { case IW_ENCODE_ALG_NONE: alg_name = WPA_ALG_NONE; @@ -1554,19 +1555,19 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, ret= -ENOMEM; goto error; } -//recover addr +// recover addr memcpy(addr, ext->addr.sa_data, ETH_ALEN); -//recover key_idx +// recover key_idx key_idx = (wrq->flags&IW_ENCODE_INDEX) - 1; -//recover set_tx +// recover set_tx if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) set_tx = 1; -//recover seq,seq_len +// recover seq,seq_len if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { seq_len=IW_ENCODE_SEQ_MAX_SIZE; memcpy(seq, ext->rx_seq, seq_len); } -//recover key,key_len +// recover key,key_len if (ext->key_len) { key_len=ext->key_len; memcpy(key, &ext->key[0], key_len); @@ -1591,8 +1592,8 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, param->u.wpa_key.seq = (u8 *)seq; param->u.wpa_key.seq_len = seq_len; -//****set if current action is Network Manager count?? -//****this method is so foolish,but there is no other way??? +/****set if current action is Network Manager count?? */ +/****this method is so foolish,but there is no other way??? */ if (param->u.wpa_key.alg_name == WPA_ALG_NONE) { if (param->u.wpa_key.key_index ==0) { pDevice->bwextstep0 = TRUE; @@ -1620,7 +1621,7 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, memset(pMgmt->abyDesireBSSID, 0xFF,6); KeyvInitTable(pDevice,&pDevice->sKey); } -//****** +/*******/ spin_lock_irq(&pDevice->lock); ret = wpa_set_keys(pDevice, param, TRUE); spin_unlock_irq(&pDevice->lock); @@ -1667,66 +1668,66 @@ int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info, #endif static const iw_handler iwctl_handler[] = { - (iw_handler)NULL, /* SIOCSIWCOMMIT */ - (iw_handler)NULL, // SIOCGIWNAME - (iw_handler)NULL, // SIOCSIWNWID - (iw_handler)NULL, // SIOCGIWNWID - (iw_handler)NULL, // SIOCSIWFREQ - (iw_handler)NULL, // SIOCGIWFREQ - (iw_handler)NULL, // SIOCSIWMODE - (iw_handler)NULL, // SIOCGIWMODE - (iw_handler)NULL, // SIOCSIWSENS - (iw_handler)NULL, // SIOCGIWSENS - (iw_handler)NULL, // SIOCSIWRANGE - (iw_handler)iwctl_giwrange, // SIOCGIWRANGE - (iw_handler)NULL, // SIOCSIWPRIV - (iw_handler)NULL, // SIOCGIWPRIV - (iw_handler)NULL, // SIOCSIWSTATS - (iw_handler)NULL, // SIOCGIWSTATS - (iw_handler)NULL, // SIOCSIWSPY - (iw_handler)NULL, // SIOCGIWSPY - (iw_handler)NULL, // -- hole -- - (iw_handler)NULL, // -- hole -- - (iw_handler)NULL, // SIOCSIWAP - (iw_handler)NULL, // SIOCGIWAP - (iw_handler)NULL, // -- hole -- 0x16 - (iw_handler)NULL, // SIOCGIWAPLIST - (iw_handler)iwctl_siwscan, // SIOCSIWSCAN - (iw_handler)iwctl_giwscan, // SIOCGIWSCAN - (iw_handler)NULL, // SIOCSIWESSID - (iw_handler)NULL, // SIOCGIWESSID - (iw_handler)NULL, // SIOCSIWNICKN - (iw_handler)NULL, // SIOCGIWNICKN - (iw_handler)NULL, // -- hole -- - (iw_handler)NULL, // -- hole -- - (iw_handler)NULL, // SIOCSIWRATE 0x20 - (iw_handler)NULL, // SIOCGIWRATE - (iw_handler)NULL, // SIOCSIWRTS - (iw_handler)NULL, // SIOCGIWRTS - (iw_handler)NULL, // SIOCSIWFRAG - (iw_handler)NULL, // SIOCGIWFRAG - (iw_handler)NULL, // SIOCSIWTXPOW - (iw_handler)NULL, // SIOCGIWTXPOW - (iw_handler)NULL, // SIOCSIWRETRY - (iw_handler)NULL, // SIOCGIWRETRY - (iw_handler)NULL, // SIOCSIWENCODE - (iw_handler)NULL, // SIOCGIWENCODE - (iw_handler)NULL, // SIOCSIWPOWER - (iw_handler)NULL, // SIOCGIWPOWER - (iw_handler)NULL, // -- hole -- - (iw_handler)NULL, // -- hole -- - (iw_handler)NULL, // SIOCSIWGENIE - (iw_handler)NULL, // SIOCGIWGENIE - (iw_handler)NULL, // SIOCSIWAUTH - (iw_handler)NULL, // SIOCGIWAUTH - (iw_handler)NULL, // SIOCSIWENCODEEXT - (iw_handler)NULL, // SIOCGIWENCODEEXT - (iw_handler)NULL, // SIOCSIWPMKSA - (iw_handler)NULL, // -- hole -- + (iw_handler)NULL, // SIOCSIWCOMMIT + (iw_handler)NULL, // SIOCGIWNAME + (iw_handler)NULL, // SIOCSIWNWID + (iw_handler)NULL, // SIOCGIWNWID + (iw_handler)NULL, // SIOCSIWFREQ + (iw_handler)NULL, // SIOCGIWFREQ + (iw_handler)NULL, // SIOCSIWMODE + (iw_handler)NULL, // SIOCGIWMODE + (iw_handler)NULL, // SIOCSIWSENS + (iw_handler)NULL, // SIOCGIWSENS + (iw_handler)NULL, // SIOCSIWRANGE + (iw_handler)iwctl_giwrange, // SIOCGIWRANGE + (iw_handler)NULL, // SIOCSIWPRIV + (iw_handler)NULL, // SIOCGIWPRIV + (iw_handler)NULL, // SIOCSIWSTATS + (iw_handler)NULL, // SIOCGIWSTATS + (iw_handler)NULL, // SIOCSIWSPY + (iw_handler)NULL, // SIOCGIWSPY + (iw_handler)NULL, // -- hole -- + (iw_handler)NULL, // -- hole -- + (iw_handler)NULL, // SIOCSIWAP + (iw_handler)NULL, // SIOCGIWAP + (iw_handler)NULL, // -- hole -- 0x16 + (iw_handler)NULL, // SIOCGIWAPLIST + (iw_handler)iwctl_siwscan, // SIOCSIWSCAN + (iw_handler)iwctl_giwscan, // SIOCGIWSCAN + (iw_handler)NULL, // SIOCSIWESSID + (iw_handler)NULL, // SIOCGIWESSID + (iw_handler)NULL, // SIOCSIWNICKN + (iw_handler)NULL, // SIOCGIWNICKN + (iw_handler)NULL, // -- hole -- + (iw_handler)NULL, // -- hole -- + (iw_handler)NULL, // SIOCSIWRATE 0x20 + (iw_handler)NULL, // SIOCGIWRATE + (iw_handler)NULL, // SIOCSIWRTS + (iw_handler)NULL, // SIOCGIWRTS + (iw_handler)NULL, // SIOCSIWFRAG + (iw_handler)NULL, // SIOCGIWFRAG + (iw_handler)NULL, // SIOCSIWTXPOW + (iw_handler)NULL, // SIOCGIWTXPOW + (iw_handler)NULL, // SIOCSIWRETRY + (iw_handler)NULL, // SIOCGIWRETRY + (iw_handler)NULL, // SIOCSIWENCODE + (iw_handler)NULL, // SIOCGIWENCODE + (iw_handler)NULL, // SIOCSIWPOWER + (iw_handler)NULL, // SIOCGIWPOWER + (iw_handler)NULL, // -- hole -- + (iw_handler)NULL, // -- hole -- + (iw_handler)NULL, // SIOCSIWGENIE + (iw_handler)NULL, // SIOCGIWGENIE + (iw_handler)NULL, // SIOCSIWAUTH + (iw_handler)NULL, // SIOCGIWAUTH + (iw_handler)NULL, // SIOCSIWENCODEEXT + (iw_handler)NULL, // SIOCGIWENCODEEXT + (iw_handler)NULL, // SIOCSIWPMKSA + (iw_handler)NULL, // -- hole -- }; static const iw_handler iwctl_private_handler[] = { - NULL, // SIOCIWFIRSTPRIV + NULL, // SIOCIWFIRSTPRIV }; struct iw_priv_args iwctl_private_args[] = { -- cgit v0.10.2 From aeadd58d2dbed0fa61962766c93e80bcdf4a8d69 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Mon, 25 Jun 2012 01:57:32 +0200 Subject: staging: vt6656: iwctl: one statement per line (if) Statement following 'if' should be on its own line. Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index c639a3c..dd3c1ac 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -235,7 +235,8 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN); { int f = (int)pBSS->uChannel - 1; - if (f < 0)f = 0; + if (f < 0) + f = 0; iwe.u.freq.m = frequency_list[f] * 100000; iwe.u.freq.e = 1; } -- cgit v0.10.2 From 37f0777fb134794b39ce6d7f7443d5a932b87ab8 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Mon, 25 Jun 2012 01:57:39 +0200 Subject: staging: vt6656: iwctl: Cleanup spacing around operators (mostly) This cleans up spacing around operators according to CodingStyle. (A few deletions of empty lines that were missed by a previous patch are also included. A few bits and pieces broken on multiple lines were put one one line as well). Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index dd3c1ac..6307c6a 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -138,13 +138,13 @@ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, pItemSSID->byElementID = WLAN_EID_SSID; memcpy(pItemSSID->abySSID, req->essid, (int)req->essid_len); if (pItemSSID->abySSID[req->essid_len - 1] == '\0') { - if (req->essid_len>0) + if (req->essid_len > 0) pItemSSID->len = req->essid_len - 1; } else pItemSSID->len = req->essid_len; pMgmt->eScanType = WMAC_SCAN_PASSIVE; - PRINT_K("SIOCSIWSCAN:[desired_ssid=%s,len=%d]\n",((PWLAN_IE_SSID)abyScanSSID)->abySSID, + PRINT_K("SIOCSIWSCAN:[desired_ssid=%s,len=%d]\n", ((PWLAN_IE_SSID)abyScanSSID)->abySSID, ((PWLAN_IE_SSID)abyScanSSID)->len); bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID); spin_unlock_irq(&pDevice->lock); @@ -212,7 +212,7 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID; iwe.u.data.length = pItemSSID->len; iwe.u.data.flags = 1; - current_ev = iwe_stream_add_point(info,current_ev,end_buf, &iwe, pItemSSID->abySSID); + current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pItemSSID->abySSID); // ADD mode memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWMODE; @@ -223,7 +223,7 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, iwe.u.mode = IW_MODE_ADHOC; } iwe.len = IW_EV_UINT_LEN; - current_ev = iwe_stream_add_event(info,current_ev, end_buf, &iwe, IW_EV_UINT_LEN); + current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_UINT_LEN); // ADD frequency pSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abySuppRates; pExtSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abyExtSuppRates; @@ -232,7 +232,7 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, iwe.u.freq.m = pBSS->uChannel; iwe.u.freq.e = 0; iwe.u.freq.i = 0; - current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN); + current_ev = iwe_stream_add_event(info, current_ev,end_buf, &iwe, IW_EV_FREQ_LEN); { int f = (int)pBSS->uChannel - 1; if (f < 0) @@ -240,7 +240,7 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, iwe.u.freq.m = frequency_list[f] * 100000; iwe.u.freq.e = 1; } - current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN); + current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_FREQ_LEN); // ADD quality memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVQUAL; @@ -253,40 +253,40 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, }else if (-ldBm > 90) { iwe.u.qual.qual = 0; }else { - iwe.u.qual.qual=(40-(-ldBm-50))*100/40; + iwe.u.qual.qual = (40 - (-ldBm - 50)) * 100 / 40; } - iwe.u.qual.updated=7; + iwe.u.qual.updated = 7; - current_ev = iwe_stream_add_event(info,current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); + current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); // ADD encryption memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWENCODE; iwe.u.data.length = 0; if (WLAN_GET_CAP_INFO_PRIVACY(pBSS->wCapInfo)) { - iwe.u.data.flags =IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; + iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; }else { iwe.u.data.flags = IW_ENCODE_DISABLED; } - current_ev = iwe_stream_add_point(info,current_ev,end_buf, &iwe, pItemSSID->abySSID); + current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pItemSSID->abySSID); memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWRATE; iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; current_val = current_ev + IW_EV_LCP_LEN; - for (kk = 0 ; kk < 12 ; kk++) { + for (kk = 0; kk < 12; kk++) { if (pSuppRates->abyRates[kk] == 0) break; // Bit rate given in 500 kb/s units (+ 0x80) iwe.u.bitrate.value = ((pSuppRates->abyRates[kk] & 0x7f) * 500000); - current_val = iwe_stream_add_value(info,current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); + current_val = iwe_stream_add_value(info, current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); } - for (kk = 0 ; kk < 8 ; kk++) { + for (kk = 0; kk < 8; kk++) { if (pExtSuppRates->abyRates[kk] == 0) break; // Bit rate given in 500 kb/s units (+ 0x80) iwe.u.bitrate.value = ((pExtSuppRates->abyRates[kk] & 0x7f) * 500000); - current_val = iwe_stream_add_value(info,current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); + current_val = iwe_stream_add_value(info, current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); } if ((current_val - current_ev) > IW_EV_LCP_LEN) @@ -296,22 +296,21 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, iwe.cmd = IWEVCUSTOM; sprintf(buf, "bcn_int=%d", pBSS->wBeaconInterval); iwe.u.data.length = strlen(buf); - current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, buf); + current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, buf); if ((pBSS->wWPALen > 0) && (pBSS->wWPALen <= MAX_WPA_IE_LEN)) { memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVGENIE; iwe.u.data.length = pBSS->wWPALen; - current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, pBSS->byWPAIE); + current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pBSS->byWPAIE); } if ((pBSS->wRSNLen > 0) && (pBSS->wRSNLen <= MAX_WPA_IE_LEN)) { memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVGENIE; iwe.u.data.length = pBSS->wRSNLen; - current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, pBSS->byRSNIE); + current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pBSS->byRSNIE); } - } } // for wrq->length = current_ev - extra; @@ -402,7 +401,6 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, } switch (*wmode) { - case IW_MODE_ADHOC: if (pMgmt->eConfigMode != WMAC_CONFIG_IBSS_STA) { pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA; @@ -457,7 +455,6 @@ void iwctl_giwmode(struct net_device *dev, struct iw_request_info *info, PSDevice pDevice = netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE \n"); // If not managed, assume it's ad-hoc switch (pMgmt->eConfigMode) { @@ -514,7 +511,7 @@ void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info, range->max_qual.noise = 0; range->sensitivity = 255; - for (i = 0 ; i < 13 ; i++) { + for (i = 0; i < 13; i++) { range->bitrate[i] = abySupportedRates[i] * 500000; if (range->bitrate[i] == 0) break; @@ -597,7 +594,7 @@ int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, memcpy(pMgmt->abyDesireBSSID, wrq->sa_data, 6); // mike: add if ((is_broadcast_ether_addr(pMgmt->abyDesireBSSID)) || - (memcmp(pMgmt->abyDesireBSSID, ZeroBSSID, 6) == 0)){ + (memcmp(pMgmt->abyDesireBSSID, ZeroBSSID, 6) == 0)) { PRINT_K("SIOCSIWAP:invalid desired BSSID return!\n"); return rc; } @@ -680,7 +677,7 @@ int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info, pBSS = &(pMgmt->sBSSList[ii]); if (!pBSS->bActive) continue; - if ( jj >= IW_MAX_AP) + if (jj >= IW_MAX_AP) break; memcpy(sock[jj].sa_data, pBSS->abyBSSID, 6); sock[jj].sa_family = ARPHRD_ETHER; @@ -692,8 +689,8 @@ int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info, wrq->flags = 1; // Should be define'd wrq->length = jj; - memcpy(extra, sock, sizeof(struct sockaddr)*jj); - memcpy(extra + sizeof(struct sockaddr)*jj, qual, sizeof(struct iw_quality)*jj); + memcpy(extra, sock, sizeof(struct sockaddr) * jj); + memcpy(extra + sizeof(struct sockaddr) * jj, qual, sizeof(struct iw_quality) * jj); } return rc; } @@ -721,7 +718,7 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, memset(pMgmt->abyDesireBSSID, 0xFF,6); PRINT_K("set essid to 'any' \n"); #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT - //Unknown desired AP,so here need not associate?? + // Unknown desired AP, so here need not associate?? return 0; #endif } else { @@ -737,11 +734,11 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, } else pItemSSID->len = wrq->length; - PRINT_K("set essid to %s \n",pItemSSID->abySSID); + PRINT_K("set essid to %s \n", pItemSSID->abySSID); // mike: need clear desiredBSSID if (pItemSSID->len==0) { - memset(pMgmt->abyDesireBSSID, 0xFF,6); + memset(pMgmt->abyDesireBSSID, 0xFF, 6); return 0; } @@ -755,13 +752,12 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, unsigned ii; unsigned uSameBssidNum = 0; - memcpy(abyTmpDesireSSID,pMgmt->abyDesireSSID,sizeof(abyTmpDesireSSID)); + memcpy(abyTmpDesireSSID, pMgmt->abyDesireSSID, sizeof(abyTmpDesireSSID)); pCurr = BSSpSearchBSSList(pDevice, NULL, abyTmpDesireSSID, - pDevice->eConfigPHYMode - ); + pDevice->eConfigPHYMode); - if (pCurr == NULL){ + if (pCurr == NULL) { PRINT_K("SIOCSIWESSID:hidden ssid site survey before associate.......\n"); vResetCommandTimer((void *)pDevice); pMgmt->eScanType = WMAC_SCAN_ACTIVE; @@ -824,7 +820,7 @@ void iwctl_giwessid(struct net_device *dev, struct iw_request_info *info, // Get the current SSID pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; - memcpy(extra, pItemSSID->abySSID , pItemSSID->len); + memcpy(extra, pItemSSID->abySSID, pItemSSID->len); extra[pItemSSID->len] = '\0'; wrq->length = pItemSSID->len; @@ -855,17 +851,16 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, // First: get a valid bit rate value // Which type of value - if ((wrq->value < 13) && - (wrq->value >= 0)) { + if ((wrq->value < 13) && (wrq->value >= 0)) { // Setting by rate index // Find value in the magic rate table brate = wrq->value; } else { // Setting by frequency value - u8 normvalue = (u8) (wrq->value/500000); + u8 normvalue = (u8)(wrq->value/500000); // Check if rate is valid - for (i = 0 ; i < 13 ; i++) { + for (i = 0; i < 13; i++) { if (normvalue == abySupportedRates[i]) { brate = i; break; @@ -875,7 +870,7 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, // -1 designed the max rate (mostly auto mode) if (wrq->value == -1) { // Get the highest available rate - for (i = 0 ; i < 13 ; i++) { + for (i = 0; i < 13; i++) { if (abySupportedRates[i] == 0) break; } @@ -895,14 +890,13 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, // Fixed mode // One rate, fixed pDevice->bFixRate = TRUE; - if ((pDevice->byBBType == BB_TYPE_11B)&& (brate > 3)) { + if ((pDevice->byBBType == BB_TYPE_11B) && (brate > 3)) { pDevice->uConnectionRate = 3; } else { pDevice->uConnectionRate = brate; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d \n", pDevice->uConnectionRate); } - } else { pDevice->bFixRate = FALSE; @@ -1086,7 +1080,6 @@ int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info, if ((int)pDevice->byShortRetryLimit != (int)pDevice->byLongRetryLimit) wrq->flags |= IW_RETRY_MIN; } - return 0; } @@ -1142,11 +1135,10 @@ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, if (pDevice->flags & DEVICE_FLAGS_OPENED) { spin_lock_irq(&pDevice->lock); - KeybSetDefaultKey( pDevice, + KeybSetDefaultKey(pDevice, &(pDevice->sKey), dwKeyIndex | (1 << 31), - wrq->length, - NULL, + wrq->length, NULL, pDevice->abyKey, KEY_CTL_WEP ); @@ -1190,7 +1182,7 @@ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, } #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT - memset(pMgmt->abyDesireBSSID, 0xFF,6); + memset(pMgmt->abyDesireBSSID, 0xFF, 6); #endif return rc; } @@ -1210,11 +1202,11 @@ int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, if (index > WLAN_WEP_NKEYS) { return -EINVAL; } - if (index<1){ // get default key - if (pDevice->byKeyIndexbyKeyIndex; + if (index < 1) { // get default key + if (pDevice->byKeyIndex < WLAN_WEP_NKEYS){ + index = pDevice->byKeyIndex; } else - index=0; + index = 0; }else index--; @@ -1223,30 +1215,30 @@ int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, wrq->flags = IW_ENCODE_NOKEY; // Is WEP enabled ??? if (pDevice->bEncryptionEnable) - wrq->flags |= IW_ENCODE_ENABLED; + wrq->flags |= IW_ENCODE_ENABLED; else - wrq->flags |= IW_ENCODE_DISABLED; + wrq->flags |= IW_ENCODE_DISABLED; if (pMgmt->bShareKeyAlgorithm) - wrq->flags |= IW_ENCODE_RESTRICTED; + wrq->flags |= IW_ENCODE_RESTRICTED; else - wrq->flags |= IW_ENCODE_OPEN; - wrq->length=0; + wrq->flags |= IW_ENCODE_OPEN; + wrq->length = 0; - if ((index==0)&&(pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled|| + if ((index == 0) && (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled || pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)){ // get wpa pairwise key - if (KeybGetKey(&(pDevice->sKey),pMgmt->abyCurrBSSID, 0xffffffff, &pKey)){ + if (KeybGetKey(&(pDevice->sKey), pMgmt->abyCurrBSSID, 0xffffffff, &pKey)) { wrq->length = pKey->uKeyLength; memcpy(abyKey, pKey->abyKey, pKey->uKeyLength); memcpy(extra, abyKey, WLAN_WEP232_KEYLEN); } - }else if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (BYTE)index , &pKey)){ + } else if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (BYTE)index, &pKey)){ wrq->length = pKey->uKeyLength; - memcpy(abyKey, pKey->abyKey, pKey->uKeyLength); - memcpy(extra, abyKey, WLAN_WEP232_KEYLEN); + memcpy(abyKey, pKey->abyKey, pKey->uKeyLength); + memcpy(extra, abyKey, WLAN_WEP232_KEYLEN); } - wrq->flags |= index+1; + wrq->flags |= index + 1; return 0; } @@ -1373,7 +1365,7 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, break; case IW_AUTH_CIPHER_PAIRWISE: pairwise = wrq->value; - PRINT_K("iwctl_siwauth:set pairwise=%d\n",pairwise); + PRINT_K("iwctl_siwauth:set pairwise=%d\n", pairwise); if (pairwise == IW_AUTH_CIPHER_CCMP){ pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; }else if (pairwise == IW_AUTH_CIPHER_TKIP){ @@ -1383,11 +1375,11 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; }else if (pairwise == IW_AUTH_CIPHER_NONE){ // do nothing, einsn liu - }else pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; + } else pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; break; case IW_AUTH_CIPHER_GROUP: - PRINT_K("iwctl_siwauth:set GROUP=%d\n",wrq->value); + PRINT_K("iwctl_siwauth:set GROUP=%d\n", wrq->value); if (wpa_version == IW_AUTH_WPA_VERSION_DISABLED) break; if (pairwise == IW_AUTH_CIPHER_NONE){ @@ -1399,12 +1391,12 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, } break; case IW_AUTH_KEY_MGMT: - PRINT_K("iwctl_siwauth(wpa_version=%d):set KEY_MGMT=%d\n",wpa_version,wrq->value); + PRINT_K("iwctl_siwauth(wpa_version=%d):set KEY_MGMT=%d\n", wpa_version,wrq->value); if (wpa_version == IW_AUTH_WPA_VERSION_WPA2){ if (wrq->value == IW_AUTH_KEY_MGMT_PSK) pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK; else pMgmt->eAuthenMode = WMAC_AUTH_WPA2; - }else if (wpa_version == IW_AUTH_WPA_VERSION_WPA){ + } else if (wpa_version == IW_AUTH_WPA_VERSION_WPA) { if (wrq->value == 0){ pMgmt->eAuthenMode = WMAC_AUTH_WPANONE; }else if (wrq->value == IW_AUTH_KEY_MGMT_PSK) @@ -1417,10 +1409,10 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, case IW_AUTH_DROP_UNENCRYPTED: break; case IW_AUTH_80211_AUTH_ALG: - PRINT_K("iwctl_siwauth:set AUTH_ALG=%d\n",wrq->value); + PRINT_K("iwctl_siwauth:set AUTH_ALG=%d\n", wrq->value); if (wrq->value==IW_AUTH_ALG_OPEN_SYSTEM){ - pMgmt->bShareKeyAlgorithm=FALSE; - }else if (wrq->value==IW_AUTH_ALG_SHARED_KEY){ + pMgmt->bShareKeyAlgorithm = FALSE; + } else if (wrq->value==IW_AUTH_ALG_SHARED_KEY) { pMgmt->bShareKeyAlgorithm=TRUE; } break; @@ -1463,7 +1455,7 @@ int iwctl_siwgenie(struct net_device *dev, struct iw_request_info *info, int ret = 0; if (wrq->length){ - if ((wrq->length < 2) || (extra[1]+2 != wrq->length)) { + if ((wrq->length < 2) || (extra[1] + 2 != wrq->length)) { ret = -EINVAL; goto out; } @@ -1497,11 +1489,11 @@ int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info, wrq->length = 0; if (pMgmt->wWPAIELen > 0){ wrq->length = pMgmt->wWPAIELen; - if (pMgmt->wWPAIELen <= space){ - if (copy_to_user(extra, pMgmt->abyWPAIE, pMgmt->wWPAIELen)){ + if (pMgmt->wWPAIELen <= space) { + if (copy_to_user(extra, pMgmt->abyWPAIE, pMgmt->wWPAIELen)) { ret = -EFAULT; } - }else + } else ret = -E2BIG; } return ret; @@ -1518,7 +1510,7 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, wpa_alg alg_name; u8 addr[6]; int key_idx; - int set_tx=0; + int set_tx = 0; u8 seq[IW_ENCODE_SEQ_MAX_SIZE]; u8 key[64]; size_t seq_len = 0; @@ -1570,11 +1562,11 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, } // recover key,key_len if (ext->key_len) { - key_len=ext->key_len; + key_len = ext->key_len; memcpy(key, &ext->key[0], key_len); } memset(key_array, 0, 64); - if ( key_len > 0) { + if (key_len > 0) { memcpy(key_array, key, key_len); if (key_len == 32) { // notice ! the oder @@ -1607,7 +1599,7 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, pDevice->bwextstep1 = FALSE; pDevice->bwextstep2 = TRUE; } - if ((pDevice->bwextstep2 == TRUE)&&(param->u.wpa_key.key_index == 3)) { + if ((pDevice->bwextstep2 == TRUE) && (param->u.wpa_key.key_index == 3)) { pDevice->bwextstep2 = FALSE; pDevice->bwextstep3 = TRUE; } @@ -1619,8 +1611,8 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, pDevice->bwextstep2 = FALSE; pDevice->bwextstep3 = FALSE; pDevice->bWPASuppWextEnabled = TRUE; - memset(pMgmt->abyDesireBSSID, 0xFF,6); - KeyvInitTable(pDevice,&pDevice->sKey); + memset(pMgmt->abyDesireBSSID, 0xFF, 6); + KeyvInitTable(pDevice, &pDevice->sKey); } /*******/ spin_lock_irq(&pDevice->lock); @@ -1732,17 +1724,15 @@ static const iw_handler iwctl_private_handler[] = { }; struct iw_priv_args iwctl_private_args[] = { - { IOCTL_CMD_SET, - IW_PRIV_TYPE_CHAR | 1024, 0, - "set"}, + { IOCTL_CMD_SET, IW_PRIV_TYPE_CHAR | 1024, 0, "set" }, }; const struct iw_handler_def iwctl_handler_def = { - .get_wireless_stats = &iwctl_get_wireless_stats, - .num_standard = sizeof(iwctl_handler)/sizeof(iw_handler), - .num_private = 0, - .num_private_args = 0, - .standard = (iw_handler *)iwctl_handler, - .private = NULL, - .private_args = NULL, + .get_wireless_stats = &iwctl_get_wireless_stats, + .num_standard = sizeof(iwctl_handler) / sizeof(iw_handler), + .num_private = 0, + .num_private_args = 0, + .standard = (iw_handler *)iwctl_handler, + .private = NULL, + .private_args = NULL, }; -- cgit v0.10.2 From 8c3337fec4c78f796767459de6429eecf2dc35c9 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Mon, 25 Jun 2012 01:57:48 +0200 Subject: staging: vt6656: iwctl: Clean up braces on 'if' statements Clean up braces on 'if' statements to (mostly) match coding style. A few other bits, like removing a few blank lines and such may have snug in. Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index 6307c6a..dc24096 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -132,7 +132,7 @@ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, // mike add: active scan OR passive scan OR desire_ssid scan if (wrq->length == sizeof(struct iw_scan_req)) { - if (wrq->flags & IW_SCAN_THIS_ESSID) { // desire_ssid scan + if (wrq->flags & IW_SCAN_THIS_ESSID) { // desire_ssid scan memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); pItemSSID = (PWLAN_IE_SSID)abyScanSSID; pItemSSID->byElementID = WLAN_EID_SSID; @@ -150,12 +150,10 @@ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, spin_unlock_irq(&pDevice->lock); return 0; - } - else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { // passive scan + } else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { // passive scan pMgmt->eScanType = WMAC_SCAN_PASSIVE; } - } - else { // active scan + } else { // active scan pMgmt->eScanType = WMAC_SCAN_ACTIVE; } @@ -216,12 +214,10 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, // ADD mode memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWMODE; - if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo)) { + if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo)) iwe.u.mode = IW_MODE_INFRA; - } - else { + else iwe.u.mode = IW_MODE_ADHOC; - } iwe.len = IW_EV_UINT_LEN; current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_UINT_LEN); // ADD frequency @@ -248,13 +244,12 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, iwe.u.qual.level = ldBm; iwe.u.qual.noise = 0; - if (-ldBm<50){ + if (-ldBm<50) iwe.u.qual.qual = 100; - }else if (-ldBm > 90) { + else if (-ldBm > 90) iwe.u.qual.qual = 0; - }else { + else iwe.u.qual.qual = (40 - (-ldBm - 50)) * 100 / 40; - } iwe.u.qual.updated = 7; current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); @@ -262,11 +257,10 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWENCODE; iwe.u.data.length = 0; - if (WLAN_GET_CAP_INFO_PRIVACY(pBSS->wCapInfo)) { + if (WLAN_GET_CAP_INFO_PRIVACY(pBSS->wCapInfo)) iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; - }else { + else iwe.u.data.flags = IW_ENCODE_DISABLED; - } current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pItemSSID->abySSID); memset(&iwe, 0, sizeof(iwe)); @@ -329,8 +323,7 @@ int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n"); // If setting by frequency, convert to a channel - if ((wrq->e == 1) && - (wrq->m >= (int)2.412e8) && + if ((wrq->e == 1) && (wrq->m >= (int)2.412e8) && (wrq->m <= (int)2.487e8)) { int f = wrq->m / 100000; int c = 0; @@ -340,9 +333,9 @@ int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info, wrq->m = c + 1; } // Setting by channel number - if ((wrq->m > 14) || (wrq->e > 0)) + if ((wrq->m > 14) || (wrq->e > 0)) { rc = -EOPNOTSUPP; - else { + } else { int channel = wrq->m; if ((channel < 1) || (channel > 14)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: New channel value of %d is invalid!\n", dev->name, wrq->m); @@ -353,7 +346,6 @@ int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info, pDevice->uChannel = channel; } } - return rc; } @@ -404,9 +396,8 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, case IW_MODE_ADHOC: if (pMgmt->eConfigMode != WMAC_CONFIG_IBSS_STA) { pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA; - if (pDevice->flags & DEVICE_FLAGS_OPENED) { + if (pDevice->flags & DEVICE_FLAGS_OPENED) pDevice->bCommit = TRUE; - } } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc \n"); break; @@ -414,9 +405,8 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, case IW_MODE_INFRA: if (pMgmt->eConfigMode != WMAC_CONFIG_ESS_STA) { pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA; - if (pDevice->flags & DEVICE_FLAGS_OPENED) { + if (pDevice->flags & DEVICE_FLAGS_OPENED) pDevice->bCommit = TRUE; - } } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure \n"); break; @@ -428,9 +418,8 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, if (pMgmt->eConfigMode != WMAC_CONFIG_AP) { pMgmt->eConfigMode = WMAC_CONFIG_AP; - if (pDevice->flags & DEVICE_FLAGS_OPENED) { + if (pDevice->flags & DEVICE_FLAGS_OPENED) pDevice->bCommit = TRUE; - } } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point \n"); break; @@ -617,9 +606,8 @@ int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, } } - if (pDevice->flags & DEVICE_FLAGS_OPENED) { + if (pDevice->flags & DEVICE_FLAGS_OPENED) pDevice->bCommit = TRUE; - } } return rc; } @@ -640,9 +628,8 @@ int iwctl_giwap(struct net_device *dev, struct iw_request_info *info, if ((pDevice->bLinkPass == FALSE) && (pMgmt->eCurrMode != WMAC_MODE_ESS_AP)) memset(wrq->sa_data, 0, 6); - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { + if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6); - } wrq->sa_family = ARPHRD_ETHER; return 0; @@ -731,9 +718,9 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, if (pItemSSID->abySSID[wrq->length - 1] == '\0') { if (wrq->length>0) pItemSSID->len = wrq->length - 1; - } - else + } else { pItemSSID->len = wrq->length; + } PRINT_K("set essid to %s \n", pItemSSID->abySSID); // mike: need clear desiredBSSID @@ -767,8 +754,7 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID); - } - else { // mike: to find out if that desired SSID is a + } else { // mike: to find out if that desired SSID is a // hidden-ssid AP, by means of judging if there // are two same BSSID exist in list ? for (ii = 0; ii < MAX_BSS_NUM; ii++) { @@ -797,9 +783,9 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s \n", pItemSSID->abySSID); } - if (pDevice->flags & DEVICE_FLAGS_OPENED) { + if (pDevice->flags & DEVICE_FLAGS_OPENED) pDevice->bCommit = TRUE; - } + return 0; } @@ -892,8 +878,7 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, pDevice->bFixRate = TRUE; if ((pDevice->byBBType == BB_TYPE_11B) && (brate > 3)) { pDevice->uConnectionRate = 3; - } - else { + } else { pDevice->uConnectionRate = brate; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d \n", pDevice->uConnectionRate); } @@ -925,7 +910,7 @@ void iwctl_giwrate(struct net_device *dev, struct iw_request_info *info, if (pDevice->uConnectionRate < 13) { brate = abySupportedRates[pDevice->uConnectionRate]; - }else { + } else { if (pDevice->byBBType == BB_TYPE_11B) brate = 0x16; if (pDevice->byBBType == BB_TYPE_11G) @@ -933,7 +918,6 @@ void iwctl_giwrate(struct net_device *dev, struct iw_request_info *info, if (pDevice->byBBType == BB_TYPE_11A) brate = 0x6C; } - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { if (pDevice->byBBType == BB_TYPE_11B) brate = 0x16; @@ -1001,7 +985,7 @@ int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info, fthr = 2312; if ((fthr < 256) || (fthr > 2312)) { rc = -EINVAL; - }else { + } else { fthr &= ~0x1; // Get an even value pDevice->wFragmentationThreshold = (u16)fthr; } @@ -1041,19 +1025,18 @@ int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info, } if (wrq->flags & IW_RETRY_LIMIT) { - if (wrq->flags & IW_RETRY_MAX) + if (wrq->flags & IW_RETRY_MAX) { pDevice->byLongRetryLimit = wrq->value; - else if (wrq->flags & IW_RETRY_MIN) + } else if (wrq->flags & IW_RETRY_MIN) { pDevice->byShortRetryLimit = wrq->value; - else { + } else { // No modifier : set both pDevice->byShortRetryLimit = wrq->value; pDevice->byLongRetryLimit = wrq->value; } } - if (wrq->flags & IW_RETRY_LIFETIME) { + if (wrq->flags & IW_RETRY_LIFETIME) pDevice->wMaxTransmitMSDULifetime = wrq->value; - } return rc; } @@ -1118,20 +1101,17 @@ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, if (wrq->length == WLAN_WEP232_KEYLEN) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n"); - } - else if (wrq->length == WLAN_WEP104_KEYLEN) { + } else if (wrq->length == WLAN_WEP104_KEYLEN) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n"); - } - else if (wrq->length == WLAN_WEP40_KEYLEN) { + } else if (wrq->length == WLAN_WEP40_KEYLEN) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex); } memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN); memcpy(pDevice->abyKey, extra, wrq->length); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyKey: "); - for (ii = 0; ii < wrq->length; ii++) { + for (ii = 0; ii < wrq->length; ii++) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]); - } if (pDevice->flags & DEVICE_FLAGS_OPENED) { spin_lock_irq(&pDevice->lock); @@ -1151,7 +1131,7 @@ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; // Do we want to just set the transmit key index? - if ( index < 4 ) { + if (index < 4) { pDevice->byKeyIndex = index; } else if (!(wrq->flags & IW_ENCODE_MODE)) { rc = -EINVAL; @@ -1159,8 +1139,7 @@ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, } } // Read the flags - if (wrq->flags & IW_ENCODE_DISABLED){ - + if (wrq->flags & IW_ENCODE_DISABLED) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n"); pMgmt->bShareKeyAlgorithm = FALSE; pDevice->bEncryptionEnable = FALSE; @@ -1199,16 +1178,16 @@ int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODE\n"); - if (index > WLAN_WEP_NKEYS) { + if (index > WLAN_WEP_NKEYS) return -EINVAL; - } if (index < 1) { // get default key - if (pDevice->byKeyIndex < WLAN_WEP_NKEYS){ + if (pDevice->byKeyIndex < WLAN_WEP_NKEYS) index = pDevice->byKeyIndex; - } else + else index = 0; - }else + } else { index--; + } memset(abyKey, 0, WLAN_WEP232_KEYLEN); // Check encryption mode @@ -1232,7 +1211,7 @@ int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, memcpy(abyKey, pKey->abyKey, pKey->uKeyLength); memcpy(extra, abyKey, WLAN_WEP232_KEYLEN); } - } else if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (BYTE)index, &pKey)){ + } else if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (BYTE)index, &pKey)) { wrq->length = pKey->uKeyLength; memcpy(abyKey, pKey->abyKey, pKey->uKeyLength); memcpy(extra, abyKey, WLAN_WEP232_KEYLEN); @@ -1329,8 +1308,7 @@ int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info, if (pDevice->bLinkPass == TRUE) { RFvRSSITodBm(pDevice, (BYTE)(pDevice->uCurrRSSI), &ldBm); wrq->value = ldBm; - } - else { + } else { wrq->value = 0; } wrq->disabled = (wrq->value == 0); @@ -1355,11 +1333,9 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, wpa_version = wrq->value; if (wrq->value == IW_AUTH_WPA_VERSION_DISABLED) { PRINT_K("iwctl_siwauth:set WPADEV to disable at 1??????\n"); - } - else if (wrq->value == IW_AUTH_WPA_VERSION_WPA) { + } else if (wrq->value == IW_AUTH_WPA_VERSION_WPA) { PRINT_K("iwctl_siwauth:set WPADEV to WPA1******\n"); - } - else { + } else { PRINT_K("iwctl_siwauth:set WPADEV to WPA2******\n"); } break; @@ -1368,22 +1344,23 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, PRINT_K("iwctl_siwauth:set pairwise=%d\n", pairwise); if (pairwise == IW_AUTH_CIPHER_CCMP){ pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; - }else if (pairwise == IW_AUTH_CIPHER_TKIP){ + } else if (pairwise == IW_AUTH_CIPHER_TKIP) { pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; } else if (pairwise == IW_AUTH_CIPHER_WEP40 || pairwise == IW_AUTH_CIPHER_WEP104) { pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; - }else if (pairwise == IW_AUTH_CIPHER_NONE){ + } else if (pairwise == IW_AUTH_CIPHER_NONE) { // do nothing, einsn liu - } else pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; - + } else { + pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; + } break; case IW_AUTH_CIPHER_GROUP: PRINT_K("iwctl_siwauth:set GROUP=%d\n", wrq->value); if (wpa_version == IW_AUTH_WPA_VERSION_DISABLED) break; - if (pairwise == IW_AUTH_CIPHER_NONE){ - if (wrq->value == IW_AUTH_CIPHER_CCMP){ + if (pairwise == IW_AUTH_CIPHER_NONE) { + if (wrq->value == IW_AUTH_CIPHER_CCMP) { pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; }else { pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; @@ -1399,9 +1376,10 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, } else if (wpa_version == IW_AUTH_WPA_VERSION_WPA) { if (wrq->value == 0){ pMgmt->eAuthenMode = WMAC_AUTH_WPANONE; - }else if (wrq->value == IW_AUTH_KEY_MGMT_PSK) + } else if (wrq->value == IW_AUTH_KEY_MGMT_PSK) pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK; - else pMgmt->eAuthenMode = WMAC_AUTH_WPA; + } else { + pMgmt->eAuthenMode = WMAC_AUTH_WPA; } break; case IW_AUTH_TKIP_COUNTERMEASURES: @@ -1410,11 +1388,10 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, break; case IW_AUTH_80211_AUTH_ALG: PRINT_K("iwctl_siwauth:set AUTH_ALG=%d\n", wrq->value); - if (wrq->value==IW_AUTH_ALG_OPEN_SYSTEM){ + if (wrq->value == IW_AUTH_ALG_OPEN_SYSTEM) pMgmt->bShareKeyAlgorithm = FALSE; - } else if (wrq->value==IW_AUTH_ALG_SHARED_KEY) { - pMgmt->bShareKeyAlgorithm=TRUE; - } + else if (wrq->value == IW_AUTH_ALG_SHARED_KEY) + pMgmt->bShareKeyAlgorithm = TRUE; break; case IW_AUTH_WPA_ENABLED: break; @@ -1425,7 +1402,7 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, break; case IW_AUTH_PRIVACY_INVOKED: pDevice->bEncryptionEnable = !!wrq->value; - if (pDevice->bEncryptionEnable == FALSE){ + if (pDevice->bEncryptionEnable == FALSE) { wpa_version = 0; pairwise = 0; pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; @@ -1487,7 +1464,7 @@ int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info, int space = wrq->length; wrq->length = 0; - if (pMgmt->wWPAIELen > 0){ + if (pMgmt->wWPAIELen > 0) { wrq->length = pMgmt->wWPAIELen; if (pMgmt->wWPAIELen <= space) { if (copy_to_user(extra, pMgmt->abyWPAIE, pMgmt->wWPAIELen)) { @@ -1638,14 +1615,14 @@ int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info, struct iw_mlme *mlme = (struct iw_mlme *)extra; int ret = 0; - if (memcmp(pMgmt->abyCurrBSSID, mlme->addr.sa_data, ETH_ALEN)){ + if (memcmp(pMgmt->abyCurrBSSID, mlme->addr.sa_data, ETH_ALEN)) { ret = -EINVAL; return ret; } switch (mlme->cmd){ case IW_MLME_DEAUTH: case IW_MLME_DISASSOC: - if (pDevice->bLinkPass == TRUE){ + if (pDevice->bLinkPass == TRUE) { PRINT_K("iwctl_siwmlme--->send DISASSOCIATE\n"); bScheduleCommand((void *)pDevice, WLAN_CMD_DISASSOCIATE, -- cgit v0.10.2 From fa6173a0be1844ccea58afb2247f71abab1e53c5 Mon Sep 17 00:00:00 2001 From: Lauri Hintsala Date: Thu, 21 Jun 2012 13:29:12 +0300 Subject: Staging: csr: add WEXT and AP mode support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Mikko Virkkilä Cc: Veli-Pekka Peltola Signed-off-by: Lauri Hintsala Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/Kconfig b/drivers/staging/csr/Kconfig index e3a923a..bd86fb9 100644 --- a/drivers/staging/csr/Kconfig +++ b/drivers/staging/csr/Kconfig @@ -1,6 +1,8 @@ config CSR_WIFI tristate "CSR wireless driver" - depends on PCI && MMC + depends on PCI && MMC && CFG80211_WEXT + select WIRELESS_EXT + select WEXT_PRIV help Driver for the CSR wireless SDIO device. diff --git a/drivers/staging/csr/Makefile b/drivers/staging/csr/Makefile index 27eb4a7..e0e7bab 100644 --- a/drivers/staging/csr/Makefile +++ b/drivers/staging/csr/Makefile @@ -1,6 +1,8 @@ obj-$(CONFIG_CSR_WIFI) += oska/ -ccflags-y := -DCSR_SME_USERSPACE -DCSR_SUPPORT_SME -DREMOTE_SYS_SAP -DCSR_WIFI_SECURITY_WAPI_ENABLE -DENABLE_SHUTDOWN +ccflags-y := -DCSR_SME_USERSPACE -DCSR_SUPPORT_SME -DREMOTE_SYS_SAP -DCSR_WIFI_SECURITY_WAPI_ENABLE -DENABLE_SHUTDOWN -DUNIFI_DEBUG +ccflags-y += -DSDIO_EXPORTS_STRUCT_DEVICE -DCSR_WIFI_SUPPORT_MMC_DRIVER -DCSR_WIFI_SINGLE_FUNCTION -DCSR_WIFI_SPLIT_PATCH +ccflags-y += -DCSR_SUPPORT_WEXT -DREMOTE_SYS_SAP -DREMOTE_MGT_SAP -DCSR_WIFI_SECURITY_WAPI_ENABLE -DCSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND -DENABLE_SHUTDOWN -DCSR_WIFI_NME_ENABLE -DCSR_WIFI_AP_ENABLE -DCSR_SUPPORT_WEXT_AP -DCSR_WIFI_REQUEUE_PACKET_TO_HAL obj-$(CONFIG_CSR_WIFI) += csr_wifi.o obj-$(CONFIG_CSR_WIFI) += csr_helper.o @@ -40,6 +42,11 @@ csr_wifi-y := bh.o \ csr_wifi_hip_udi.o \ csr_wifi_hip_unifi_signal_names.o \ csr_wifi_hip_xbv.o \ + csr_wifi_nme_ap_converter_init.o \ + csr_wifi_nme_ap_free_downstream_contents.o \ + csr_wifi_nme_ap_free_upstream_contents.o \ + csr_wifi_nme_ap_serialize.o \ + csr_wifi_nme_ap_sef.o \ csr_wifi_router_ctrl_sef.o \ csr_wifi_router_sef.o \ csr_wifi_router_transport.o \ @@ -58,7 +65,9 @@ csr_wifi-y := bh.o \ csr_wifi_router_serialize.o \ sme_mgt.o \ sme_sys.o \ - sme_userspace.o + sme_userspace.o \ + sme_wext.o \ + wext_events.o csr_helper-y := csr_time.o \ csr_util.o \ diff --git a/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c b/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c new file mode 100644 index 0000000..83b3727 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c @@ -0,0 +1,91 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2012 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#include "csr_msgconv.h" +#include "csr_pmem.h" +#include "csr_util.h" + +#ifdef CSR_WIFI_NME_ENABLE +#ifdef CSR_WIFI_AP_ENABLE + +#ifdef CSR_LOG_ENABLE +#include "csr_log.h" +#endif + +#ifndef EXCLUDE_CSR_WIFI_NME_AP_MODULE +#include "csr_wifi_nme_ap_serialize.h" +#include "csr_wifi_nme_ap_prim.h" + +static CsrMsgConvMsgEntry csrwifinmeap_conv_lut[] = { + { CSR_WIFI_NME_AP_CONFIG_SET_REQ, CsrWifiNmeApConfigSetReqSizeof, CsrWifiNmeApConfigSetReqSer, CsrWifiNmeApConfigSetReqDes, CsrWifiNmeApConfigSetReqSerFree }, + { CSR_WIFI_NME_AP_WPS_REGISTER_REQ, CsrWifiNmeApWpsRegisterReqSizeof, CsrWifiNmeApWpsRegisterReqSer, CsrWifiNmeApWpsRegisterReqDes, CsrWifiNmeApWpsRegisterReqSerFree }, + { CSR_WIFI_NME_AP_START_REQ, CsrWifiNmeApStartReqSizeof, CsrWifiNmeApStartReqSer, CsrWifiNmeApStartReqDes, CsrWifiNmeApStartReqSerFree }, + { CSR_WIFI_NME_AP_STOP_REQ, CsrWifiNmeApStopReqSizeof, CsrWifiNmeApStopReqSer, CsrWifiNmeApStopReqDes, CsrWifiNmeApStopReqSerFree }, + { CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_REQ, CsrWifiNmeApWmmParamUpdateReqSizeof, CsrWifiNmeApWmmParamUpdateReqSer, CsrWifiNmeApWmmParamUpdateReqDes, CsrWifiNmeApWmmParamUpdateReqSerFree }, + { CSR_WIFI_NME_AP_STA_REMOVE_REQ, CsrWifiNmeApStaRemoveReqSizeof, CsrWifiNmeApStaRemoveReqSer, CsrWifiNmeApStaRemoveReqDes, CsrWifiNmeApStaRemoveReqSerFree }, + { CSR_WIFI_NME_AP_CONFIG_SET_CFM, CsrWifiNmeApConfigSetCfmSizeof, CsrWifiNmeApConfigSetCfmSer, CsrWifiNmeApConfigSetCfmDes, CsrWifiNmeApConfigSetCfmSerFree }, + { CSR_WIFI_NME_AP_WPS_REGISTER_CFM, CsrWifiNmeApWpsRegisterCfmSizeof, CsrWifiNmeApWpsRegisterCfmSer, CsrWifiNmeApWpsRegisterCfmDes, CsrWifiNmeApWpsRegisterCfmSerFree }, + { CSR_WIFI_NME_AP_START_CFM, CsrWifiNmeApStartCfmSizeof, CsrWifiNmeApStartCfmSer, CsrWifiNmeApStartCfmDes, CsrWifiNmeApStartCfmSerFree }, + { CSR_WIFI_NME_AP_STOP_CFM, CsrWifiNmeApStopCfmSizeof, CsrWifiNmeApStopCfmSer, CsrWifiNmeApStopCfmDes, CsrWifiNmeApStopCfmSerFree }, + { CSR_WIFI_NME_AP_STOP_IND, CsrWifiNmeApStopIndSizeof, CsrWifiNmeApStopIndSer, CsrWifiNmeApStopIndDes, CsrWifiNmeApStopIndSerFree }, + { CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_CFM, CsrWifiNmeApWmmParamUpdateCfmSizeof, CsrWifiNmeApWmmParamUpdateCfmSer, CsrWifiNmeApWmmParamUpdateCfmDes, CsrWifiNmeApWmmParamUpdateCfmSerFree }, + { CSR_WIFI_NME_AP_STATION_IND, CsrWifiNmeApStationIndSizeof, CsrWifiNmeApStationIndSer, CsrWifiNmeApStationIndDes, CsrWifiNmeApStationIndSerFree }, + + { 0, NULL, NULL, NULL, NULL }, +}; + +CsrMsgConvMsgEntry* CsrWifiNmeApConverterLookup(CsrMsgConvMsgEntry *ce, CsrUint16 msgType) +{ + if (msgType & CSR_PRIM_UPSTREAM) + { + CsrUint16 idx = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_COUNT; + if (idx < (CSR_WIFI_NME_AP_PRIM_UPSTREAM_COUNT + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_COUNT) && + csrwifinmeap_conv_lut[idx].msgType == msgType) + { + return &csrwifinmeap_conv_lut[idx]; + } + } + else + { + if (msgType < CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_COUNT && + csrwifinmeap_conv_lut[msgType].msgType == msgType) + { + return &csrwifinmeap_conv_lut[msgType]; + } + } + return NULL; +} + + +void CsrWifiNmeApConverterInit(void) +{ + CsrMsgConvInsert(CSR_WIFI_NME_AP_PRIM, csrwifinmeap_conv_lut); + CsrMsgConvCustomLookupRegister(CSR_WIFI_NME_AP_PRIM, CsrWifiNmeApConverterLookup); +} + + +#ifdef CSR_LOG_ENABLE +static const CsrLogPrimitiveInformation csrwifinmeap_conv_info = { + CSR_WIFI_NME_AP_PRIM, + (CsrCharString *)"CSR_WIFI_NME_AP_PRIM", + csrwifinmeap_conv_lut +}; +const CsrLogPrimitiveInformation* CsrWifiNmeApTechInfoGet(void) +{ + return &csrwifinmeap_conv_info; +} + + +#endif /* CSR_LOG_ENABLE */ +#endif /* EXCLUDE_CSR_WIFI_NME_AP_MODULE */ +#endif /* CSR_WIFI_NME_ENABLE */ +#endif /* CSR_WIFI_AP_ENABLE */ diff --git a/drivers/staging/csr/csr_wifi_nme_ap_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_nme_ap_free_downstream_contents.c new file mode 100644 index 0000000..8a95f3c --- /dev/null +++ b/drivers/staging/csr/csr_wifi_nme_ap_free_downstream_contents.c @@ -0,0 +1,85 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2012 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#include "csr_pmem.h" +#include "csr_wifi_nme_ap_prim.h" +#include "csr_wifi_nme_ap_lib.h" + +/*----------------------------------------------------------------------------* + * NAME + * CsrWifiNmeApFreeDownstreamMessageContents + * + * DESCRIPTION + * + * + * PARAMETERS + * eventClass: only the value CSR_WIFI_NME_AP_PRIM will be handled + * message: the message to free + *----------------------------------------------------------------------------*/ +void CsrWifiNmeApFreeDownstreamMessageContents(CsrUint16 eventClass, void *message) +{ + if (eventClass != CSR_WIFI_NME_AP_PRIM) + { + return; + } + if (NULL == message) + { + return; + } + + switch (*((CsrWifiNmeApPrim *) message)) + { + case CSR_WIFI_NME_AP_CONFIG_SET_REQ: + { + CsrWifiNmeApConfigSetReq *p = (CsrWifiNmeApConfigSetReq *)message; + CsrPmemFree(p->apMacConfig.macAddressList); + p->apMacConfig.macAddressList = NULL; + break; + } + case CSR_WIFI_NME_AP_START_REQ: + { + CsrWifiNmeApStartReq *p = (CsrWifiNmeApStartReq *)message; + switch (p->apCredentials.authType) + { + case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL: + switch (p->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase) + { + case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: + CsrPmemFree(p->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase); + p->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase = NULL; + break; + default: + break; + } + break; + default: + break; + } + { + CsrUint16 i3; + for (i3 = 0; i3 < p->p2pGoParam.operatingChanList.channelEntryListCount; i3++) + { + CsrPmemFree(p->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel); + p->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel = NULL; + } + } + CsrPmemFree(p->p2pGoParam.operatingChanList.channelEntryList); + p->p2pGoParam.operatingChanList.channelEntryList = NULL; + break; + } + + default: + break; + } +} + + diff --git a/drivers/staging/csr/csr_wifi_nme_ap_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_nme_ap_free_upstream_contents.c new file mode 100644 index 0000000..7740dc3 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_nme_ap_free_upstream_contents.c @@ -0,0 +1,40 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2012 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#include "csr_pmem.h" +#include "csr_wifi_nme_ap_prim.h" +#include "csr_wifi_nme_ap_lib.h" + +/*----------------------------------------------------------------------------* + * NAME + * CsrWifiNmeApFreeUpstreamMessageContents + * + * DESCRIPTION + * + * + * PARAMETERS + * eventClass: only the value CSR_WIFI_NME_AP_PRIM will be handled + * message: the message to free + *----------------------------------------------------------------------------*/ +void CsrWifiNmeApFreeUpstreamMessageContents(CsrUint16 eventClass, void *message) +{ + if (eventClass != CSR_WIFI_NME_AP_PRIM) + { + return; + } + if (NULL == message) + { + return; + } +} + + diff --git a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c new file mode 100644 index 0000000..947f86a --- /dev/null +++ b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c @@ -0,0 +1,910 @@ +/***************************************************************************** + + (c) Cambridge Silicon Radio Limited 2012 + All rights reserved and confidential information of CSR + + Refer to LICENSE.txt included with this source for details + on the license terms. + +*****************************************************************************/ + +/* Note: this is an auto-generated file. */ + +#include "csr_pmem.h" +#include "csr_msgconv.h" +#include "csr_unicode.h" + +#ifdef CSR_WIFI_NME_ENABLE +#ifdef CSR_WIFI_AP_ENABLE + +#include "csr_wifi_nme_ap_prim.h" +#include "csr_wifi_nme_ap_serialize.h" + +void CsrWifiNmeApPfree(void *ptr) +{ + CsrPmemFree(ptr); +} + + +CsrSize CsrWifiNmeApConfigSetReqSizeof(void *msg) +{ + CsrWifiNmeApConfigSetReq *primitive = (CsrWifiNmeApConfigSetReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 104) */ + bufferSize += 2; /* CsrUint16 primitive->apConfig.apGroupkeyTimeout */ + bufferSize += 1; /* CsrBool primitive->apConfig.apStrictGtkRekey */ + bufferSize += 2; /* CsrUint16 primitive->apConfig.apGmkTimeout */ + bufferSize += 2; /* CsrUint16 primitive->apConfig.apResponseTimeout */ + bufferSize += 1; /* CsrUint8 primitive->apConfig.apRetransLimit */ + bufferSize += 1; /* CsrWifiSmeApPhySupportMask primitive->apMacConfig.phySupportedBitmap */ + bufferSize += 2; /* CsrUint16 primitive->apMacConfig.beaconInterval */ + bufferSize += 1; /* CsrUint8 primitive->apMacConfig.dtimPeriod */ + bufferSize += 2; /* CsrUint16 primitive->apMacConfig.maxListenInterval */ + bufferSize += 1; /* CsrUint8 primitive->apMacConfig.supportedRatesCount */ + bufferSize += 20; /* CsrUint8 primitive->apMacConfig.supportedRates[20] */ + bufferSize += 1; /* CsrWifiSmePreambleType primitive->apMacConfig.preamble */ + bufferSize += 1; /* CsrBool primitive->apMacConfig.shortSlotTimeEnabled */ + bufferSize += 1; /* CsrWifiSmeCtsProtectionType primitive->apMacConfig.ctsProtectionType */ + bufferSize += 1; /* CsrBool primitive->apMacConfig.wmmEnabled */ + { + CsrUint16 i2; + for (i2 = 0; i2 < 4; i2++) + { + bufferSize += 1; /* CsrUint8 primitive->apMacConfig.wmmApParams[i2].cwMin */ + bufferSize += 1; /* CsrUint8 primitive->apMacConfig.wmmApParams[i2].cwMax */ + bufferSize += 1; /* CsrUint8 primitive->apMacConfig.wmmApParams[i2].aifs */ + bufferSize += 2; /* CsrUint16 primitive->apMacConfig.wmmApParams[i2].txopLimit */ + bufferSize += 1; /* CsrBool primitive->apMacConfig.wmmApParams[i2].admissionControlMandatory */ + } + } + { + CsrUint16 i2; + for (i2 = 0; i2 < 4; i2++) + { + bufferSize += 1; /* CsrUint8 primitive->apMacConfig.wmmApBcParams[i2].cwMin */ + bufferSize += 1; /* CsrUint8 primitive->apMacConfig.wmmApBcParams[i2].cwMax */ + bufferSize += 1; /* CsrUint8 primitive->apMacConfig.wmmApBcParams[i2].aifs */ + bufferSize += 2; /* CsrUint16 primitive->apMacConfig.wmmApBcParams[i2].txopLimit */ + bufferSize += 1; /* CsrBool primitive->apMacConfig.wmmApBcParams[i2].admissionControlMandatory */ + } + } + bufferSize += 1; /* CsrWifiSmeApAccessType primitive->apMacConfig.accessType */ + bufferSize += 1; /* CsrUint8 primitive->apMacConfig.macAddressListCount */ + { + CsrUint16 i2; + for (i2 = 0; i2 < primitive->apMacConfig.macAddressListCount; i2++) + { + bufferSize += 6; /* CsrUint8 primitive->apMacConfig.macAddressList[i2].a[6] */ + } + } + bufferSize += 1; /* CsrBool primitive->apMacConfig.apHtParams.greenfieldSupported */ + bufferSize += 1; /* CsrBool primitive->apMacConfig.apHtParams.shortGi20MHz */ + bufferSize += 1; /* CsrUint8 primitive->apMacConfig.apHtParams.rxStbc */ + bufferSize += 1; /* CsrBool primitive->apMacConfig.apHtParams.rifsModeAllowed */ + bufferSize += 1; /* CsrUint8 primitive->apMacConfig.apHtParams.htProtection */ + bufferSize += 1; /* CsrBool primitive->apMacConfig.apHtParams.dualCtsProtection */ + return bufferSize; +} + + +CsrUint8* CsrWifiNmeApConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiNmeApConfigSetReq *primitive = (CsrWifiNmeApConfigSetReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->apConfig.apGroupkeyTimeout); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apConfig.apStrictGtkRekey); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->apConfig.apGmkTimeout); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->apConfig.apResponseTimeout); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apConfig.apRetransLimit); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.phySupportedBitmap); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->apMacConfig.beaconInterval); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.dtimPeriod); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->apMacConfig.maxListenInterval); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.supportedRatesCount); + CsrMemCpySer(ptr, len, (const void *) primitive->apMacConfig.supportedRates, ((CsrUint16) (20))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.preamble); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.shortSlotTimeEnabled); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.ctsProtectionType); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.wmmEnabled); + { + CsrUint16 i2; + for (i2 = 0; i2 < 4; i2++) + { + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.wmmApParams[i2].cwMin); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.wmmApParams[i2].cwMax); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.wmmApParams[i2].aifs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->apMacConfig.wmmApParams[i2].txopLimit); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.wmmApParams[i2].admissionControlMandatory); + } + } + { + CsrUint16 i2; + for (i2 = 0; i2 < 4; i2++) + { + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.wmmApBcParams[i2].cwMin); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.wmmApBcParams[i2].cwMax); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.wmmApBcParams[i2].aifs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->apMacConfig.wmmApBcParams[i2].txopLimit); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.wmmApBcParams[i2].admissionControlMandatory); + } + } + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.accessType); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.macAddressListCount); + { + CsrUint16 i2; + for (i2 = 0; i2 < primitive->apMacConfig.macAddressListCount; i2++) + { + CsrMemCpySer(ptr, len, (const void *) primitive->apMacConfig.macAddressList[i2].a, ((CsrUint16) (6))); + } + } + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.apHtParams.greenfieldSupported); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.apHtParams.shortGi20MHz); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.apHtParams.rxStbc); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.apHtParams.rifsModeAllowed); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.apHtParams.htProtection); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.apHtParams.dualCtsProtection); + return(ptr); +} + + +void* CsrWifiNmeApConfigSetReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiNmeApConfigSetReq *primitive = (CsrWifiNmeApConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApConfigSetReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->apConfig.apGroupkeyTimeout, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apConfig.apStrictGtkRekey, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->apConfig.apGmkTimeout, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->apConfig.apResponseTimeout, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apConfig.apRetransLimit, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.phySupportedBitmap, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->apMacConfig.beaconInterval, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.dtimPeriod, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->apMacConfig.maxListenInterval, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.supportedRatesCount, buffer, &offset); + CsrMemCpyDes(primitive->apMacConfig.supportedRates, buffer, &offset, ((CsrUint16) (20))); + CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.preamble, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.shortSlotTimeEnabled, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.ctsProtectionType, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.wmmEnabled, buffer, &offset); + { + CsrUint16 i2; + for (i2 = 0; i2 < 4; i2++) + { + CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.wmmApParams[i2].cwMin, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.wmmApParams[i2].cwMax, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.wmmApParams[i2].aifs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->apMacConfig.wmmApParams[i2].txopLimit, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.wmmApParams[i2].admissionControlMandatory, buffer, &offset); + } + } + { + CsrUint16 i2; + for (i2 = 0; i2 < 4; i2++) + { + CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.wmmApBcParams[i2].cwMin, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.wmmApBcParams[i2].cwMax, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.wmmApBcParams[i2].aifs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->apMacConfig.wmmApBcParams[i2].txopLimit, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.wmmApBcParams[i2].admissionControlMandatory, buffer, &offset); + } + } + CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.accessType, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.macAddressListCount, buffer, &offset); + primitive->apMacConfig.macAddressList = NULL; + if (primitive->apMacConfig.macAddressListCount) + { + primitive->apMacConfig.macAddressList = (CsrWifiMacAddress *)CsrPmemAlloc(sizeof(CsrWifiMacAddress) * primitive->apMacConfig.macAddressListCount); + } + { + CsrUint16 i2; + for (i2 = 0; i2 < primitive->apMacConfig.macAddressListCount; i2++) + { + CsrMemCpyDes(primitive->apMacConfig.macAddressList[i2].a, buffer, &offset, ((CsrUint16) (6))); + } + } + CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.apHtParams.greenfieldSupported, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.apHtParams.shortGi20MHz, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.apHtParams.rxStbc, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.apHtParams.rifsModeAllowed, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.apHtParams.htProtection, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.apHtParams.dualCtsProtection, buffer, &offset); + + return primitive; +} + + +void CsrWifiNmeApConfigSetReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiNmeApConfigSetReq *primitive = (CsrWifiNmeApConfigSetReq *) voidPrimitivePointer; + CsrPmemFree(primitive->apMacConfig.macAddressList); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiNmeApWpsRegisterReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrWifiSmeWpsDpid primitive->selectedDevicePasswordId */ + bufferSize += 2; /* CsrWifiSmeWpsConfigType primitive->selectedConfigMethod */ + bufferSize += 8; /* CsrUint8 primitive->pin[8] */ + return bufferSize; +} + + +CsrUint8* CsrWifiNmeApWpsRegisterReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiNmeApWpsRegisterReq *primitive = (CsrWifiNmeApWpsRegisterReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->selectedDevicePasswordId); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->selectedConfigMethod); + CsrMemCpySer(ptr, len, (const void *) primitive->pin, ((CsrUint16) (8))); + return(ptr); +} + + +void* CsrWifiNmeApWpsRegisterReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiNmeApWpsRegisterReq *primitive = (CsrWifiNmeApWpsRegisterReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApWpsRegisterReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->selectedDevicePasswordId, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->selectedConfigMethod, buffer, &offset); + CsrMemCpyDes(primitive->pin, buffer, &offset, ((CsrUint16) (8))); + + return primitive; +} + + +CsrSize CsrWifiNmeApStartReqSizeof(void *msg) +{ + CsrWifiNmeApStartReq *primitive = (CsrWifiNmeApStartReq *) msg; + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 112) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 1; /* CsrWifiSmeApType primitive->apType */ + bufferSize += 1; /* CsrBool primitive->cloakSsid */ + bufferSize += 32; /* CsrUint8 primitive->ssid.ssid[32] */ + bufferSize += 1; /* CsrUint8 primitive->ssid.length */ + bufferSize += 1; /* CsrWifiSmeRadioIF primitive->ifIndex */ + bufferSize += 1; /* CsrUint8 primitive->channel */ + bufferSize += 1; /* CsrWifiSmeApAuthType primitive->apCredentials.authType */ + switch (primitive->apCredentials.authType) + { + case CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM: + bufferSize += 1; /* CsrUint8 primitive->apCredentials.nmeAuthType.openSystemEmpty.empty */ + break; + case CSR_WIFI_SME_AP_AUTH_TYPE_WEP: + bufferSize += 1; /* CsrWifiSmeWepCredentialType primitive->apCredentials.nmeAuthType.authwep.wepKeyType */ + switch (primitive->apCredentials.nmeAuthType.authwep.wepKeyType) + { + case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128: + bufferSize += 1; /* CsrWifiSmeWepAuthMode primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.wepAuthType */ + bufferSize += 1; /* CsrUint8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.selectedWepKey */ + bufferSize += 13; /* CsrUint8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key1[13] */ + bufferSize += 13; /* CsrUint8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key2[13] */ + bufferSize += 13; /* CsrUint8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key3[13] */ + bufferSize += 13; /* CsrUint8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key4[13] */ + break; + case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64: + bufferSize += 1; /* CsrWifiSmeWepAuthMode primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.wepAuthType */ + bufferSize += 1; /* CsrUint8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.selectedWepKey */ + bufferSize += 5; /* CsrUint8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key1[5] */ + bufferSize += 5; /* CsrUint8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key2[5] */ + bufferSize += 5; /* CsrUint8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key3[5] */ + bufferSize += 5; /* CsrUint8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key4[5] */ + break; + default: + break; + } + break; + case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL: + bufferSize += 1; /* CsrWifiSmeApAuthSupportMask primitive->apCredentials.nmeAuthType.authTypePersonal.authSupport */ + bufferSize += 2; /* CsrWifiSmeApRsnCapabilitiesMask primitive->apCredentials.nmeAuthType.authTypePersonal.rsnCapabilities */ + bufferSize += 2; /* CsrWifiSmeApWapiCapabilitiesMask primitive->apCredentials.nmeAuthType.authTypePersonal.wapiCapabilities */ + bufferSize += 1; /* CsrWifiNmeApPersCredentialType primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase */ + switch (primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase) + { + case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK: + bufferSize += 2; /* CsrUint16 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.encryptionMode */ + bufferSize += 32; /* CsrUint8 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.psk[32] */ + break; + case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: + bufferSize += 2; /* CsrUint16 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.encryptionMode */ + bufferSize += (primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase?CsrStrLen(primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase) : 0) + 1; /* CsrCharString* primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase (0 byte len + 1 for NULL Term) */ + break; + default: + break; + } + break; + default: + break; + } + bufferSize += 1; /* CsrUint8 primitive->maxConnections */ + bufferSize += 1; /* CsrWifiSmeP2pGroupCapabilityMask primitive->p2pGoParam.groupCapability */ + bufferSize += 3; /* CsrUint8 primitive->p2pGoParam.operatingChanList.country[3] */ + bufferSize += 1; /* CsrUint8 primitive->p2pGoParam.operatingChanList.channelEntryListCount */ + { + CsrUint16 i3; + for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++) + { + bufferSize += 1; /* CsrUint8 primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingClass */ + bufferSize += 1; /* CsrUint8 primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount */ + bufferSize += primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount; /* CsrUint8 primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel */ + } + } + bufferSize += 1; /* CsrBool primitive->p2pGoParam.opPsEnabled */ + bufferSize += 1; /* CsrUint8 primitive->p2pGoParam.ctWindow */ + bufferSize += 1; /* CsrWifiSmeP2pNoaConfigMethod primitive->p2pGoParam.noaConfigMethod */ + bufferSize += 1; /* CsrBool primitive->p2pGoParam.allowNoaWithNonP2pDevices */ + bufferSize += 1; /* CsrBool primitive->wpsEnabled */ + return bufferSize; +} + + +CsrUint8* CsrWifiNmeApStartReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiNmeApStartReq *primitive = (CsrWifiNmeApStartReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apType); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->cloakSsid); + CsrMemCpySer(ptr, len, (const void *) primitive->ssid.ssid, ((CsrUint16) (32))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->ssid.length); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->ifIndex); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->channel); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apCredentials.authType); + switch (primitive->apCredentials.authType) + { + case CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM: + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apCredentials.nmeAuthType.openSystemEmpty.empty); + break; + case CSR_WIFI_SME_AP_AUTH_TYPE_WEP: + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apCredentials.nmeAuthType.authwep.wepKeyType); + switch (primitive->apCredentials.nmeAuthType.authwep.wepKeyType) + { + case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128: + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.wepAuthType); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.selectedWepKey); + CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key1, ((CsrUint16) (13))); + CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key2, ((CsrUint16) (13))); + CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key3, ((CsrUint16) (13))); + CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key4, ((CsrUint16) (13))); + break; + case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64: + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.wepAuthType); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.selectedWepKey); + CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key1, ((CsrUint16) (5))); + CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key2, ((CsrUint16) (5))); + CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key3, ((CsrUint16) (5))); + CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key4, ((CsrUint16) (5))); + break; + default: + break; + } + break; + case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL: + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apCredentials.nmeAuthType.authTypePersonal.authSupport); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->apCredentials.nmeAuthType.authTypePersonal.rsnCapabilities); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->apCredentials.nmeAuthType.authTypePersonal.wapiCapabilities); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase); + switch (primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase) + { + case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK: + CsrUint16Ser(ptr, len, (CsrUint16) primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.encryptionMode); + CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.psk, ((CsrUint16) (32))); + break; + case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: + CsrUint16Ser(ptr, len, (CsrUint16) primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.encryptionMode); + CsrCharStringSer(ptr, len, primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase); + break; + default: + break; + } + break; + default: + break; + } + CsrUint8Ser(ptr, len, (CsrUint8) primitive->maxConnections); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->p2pGoParam.groupCapability); + CsrMemCpySer(ptr, len, (const void *) primitive->p2pGoParam.operatingChanList.country, ((CsrUint16) (3))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->p2pGoParam.operatingChanList.channelEntryListCount); + { + CsrUint16 i3; + for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++) + { + CsrUint8Ser(ptr, len, (CsrUint8) primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingClass); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount); + if (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount) + { + CsrMemCpySer(ptr, len, (const void *) primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel, ((CsrUint16) (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount))); + } + } + } + CsrUint8Ser(ptr, len, (CsrUint8) primitive->p2pGoParam.opPsEnabled); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->p2pGoParam.ctWindow); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->p2pGoParam.noaConfigMethod); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->p2pGoParam.allowNoaWithNonP2pDevices); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->wpsEnabled); + return(ptr); +} + + +void* CsrWifiNmeApStartReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiNmeApStartReq *primitive = (CsrWifiNmeApStartReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStartReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apType, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->cloakSsid, buffer, &offset); + CsrMemCpyDes(primitive->ssid.ssid, buffer, &offset, ((CsrUint16) (32))); + CsrUint8Des((CsrUint8 *) &primitive->ssid.length, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->ifIndex, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->channel, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apCredentials.authType, buffer, &offset); + switch (primitive->apCredentials.authType) + { + case CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM: + CsrUint8Des((CsrUint8 *) &primitive->apCredentials.nmeAuthType.openSystemEmpty.empty, buffer, &offset); + break; + case CSR_WIFI_SME_AP_AUTH_TYPE_WEP: + CsrUint8Des((CsrUint8 *) &primitive->apCredentials.nmeAuthType.authwep.wepKeyType, buffer, &offset); + switch (primitive->apCredentials.nmeAuthType.authwep.wepKeyType) + { + case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128: + CsrUint8Des((CsrUint8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.wepAuthType, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.selectedWepKey, buffer, &offset); + CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key1, buffer, &offset, ((CsrUint16) (13))); + CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key2, buffer, &offset, ((CsrUint16) (13))); + CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key3, buffer, &offset, ((CsrUint16) (13))); + CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key4, buffer, &offset, ((CsrUint16) (13))); + break; + case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64: + CsrUint8Des((CsrUint8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.wepAuthType, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.selectedWepKey, buffer, &offset); + CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key1, buffer, &offset, ((CsrUint16) (5))); + CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key2, buffer, &offset, ((CsrUint16) (5))); + CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key3, buffer, &offset, ((CsrUint16) (5))); + CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key4, buffer, &offset, ((CsrUint16) (5))); + break; + default: + break; + } + break; + case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL: + CsrUint8Des((CsrUint8 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.authSupport, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.rsnCapabilities, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.wapiCapabilities, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase, buffer, &offset); + switch (primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase) + { + case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK: + CsrUint16Des((CsrUint16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.encryptionMode, buffer, &offset); + CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.psk, buffer, &offset, ((CsrUint16) (32))); + break; + case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: + CsrUint16Des((CsrUint16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.encryptionMode, buffer, &offset); + CsrCharStringDes(&primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase, buffer, &offset); + break; + default: + break; + } + break; + default: + break; + } + CsrUint8Des((CsrUint8 *) &primitive->maxConnections, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->p2pGoParam.groupCapability, buffer, &offset); + CsrMemCpyDes(primitive->p2pGoParam.operatingChanList.country, buffer, &offset, ((CsrUint16) (3))); + CsrUint8Des((CsrUint8 *) &primitive->p2pGoParam.operatingChanList.channelEntryListCount, buffer, &offset); + primitive->p2pGoParam.operatingChanList.channelEntryList = NULL; + if (primitive->p2pGoParam.operatingChanList.channelEntryListCount) + { + primitive->p2pGoParam.operatingChanList.channelEntryList = (CsrWifiSmeApP2pOperatingChanEntry *)CsrPmemAlloc(sizeof(CsrWifiSmeApP2pOperatingChanEntry) * primitive->p2pGoParam.operatingChanList.channelEntryListCount); + } + { + CsrUint16 i3; + for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++) + { + CsrUint8Des((CsrUint8 *) &primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingClass, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount, buffer, &offset); + if (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount) + { + primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel = (CsrUint8 *)CsrPmemAlloc(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount); + CsrMemCpyDes(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel, buffer, &offset, ((CsrUint16) (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount))); + } + else + { + primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel = NULL; + } + } + } + CsrUint8Des((CsrUint8 *) &primitive->p2pGoParam.opPsEnabled, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->p2pGoParam.ctWindow, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->p2pGoParam.noaConfigMethod, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->p2pGoParam.allowNoaWithNonP2pDevices, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->wpsEnabled, buffer, &offset); + + return primitive; +} + + +void CsrWifiNmeApStartReqSerFree(void *voidPrimitivePointer) +{ + CsrWifiNmeApStartReq *primitive = (CsrWifiNmeApStartReq *) voidPrimitivePointer; + switch (primitive->apCredentials.authType) + { + case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL: + switch (primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase) + { + case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: + CsrPmemFree(primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase); + break; + default: + break; + } + break; + default: + break; + } + { + CsrUint16 i3; + for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++) + { + CsrPmemFree(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel); + } + } + CsrPmemFree(primitive->p2pGoParam.operatingChanList.channelEntryList); + CsrPmemFree(primitive); +} + + +CsrSize CsrWifiNmeApWmmParamUpdateReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 51) */ + { + CsrUint16 i1; + for (i1 = 0; i1 < 4; i1++) + { + bufferSize += 1; /* CsrUint8 primitive->wmmApParams[i1].cwMin */ + bufferSize += 1; /* CsrUint8 primitive->wmmApParams[i1].cwMax */ + bufferSize += 1; /* CsrUint8 primitive->wmmApParams[i1].aifs */ + bufferSize += 2; /* CsrUint16 primitive->wmmApParams[i1].txopLimit */ + bufferSize += 1; /* CsrBool primitive->wmmApParams[i1].admissionControlMandatory */ + } + } + { + CsrUint16 i1; + for (i1 = 0; i1 < 4; i1++) + { + bufferSize += 1; /* CsrUint8 primitive->wmmApBcParams[i1].cwMin */ + bufferSize += 1; /* CsrUint8 primitive->wmmApBcParams[i1].cwMax */ + bufferSize += 1; /* CsrUint8 primitive->wmmApBcParams[i1].aifs */ + bufferSize += 2; /* CsrUint16 primitive->wmmApBcParams[i1].txopLimit */ + bufferSize += 1; /* CsrBool primitive->wmmApBcParams[i1].admissionControlMandatory */ + } + } + return bufferSize; +} + + +CsrUint8* CsrWifiNmeApWmmParamUpdateReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiNmeApWmmParamUpdateReq *primitive = (CsrWifiNmeApWmmParamUpdateReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + { + CsrUint16 i1; + for (i1 = 0; i1 < 4; i1++) + { + CsrUint8Ser(ptr, len, (CsrUint8) primitive->wmmApParams[i1].cwMin); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->wmmApParams[i1].cwMax); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->wmmApParams[i1].aifs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->wmmApParams[i1].txopLimit); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->wmmApParams[i1].admissionControlMandatory); + } + } + { + CsrUint16 i1; + for (i1 = 0; i1 < 4; i1++) + { + CsrUint8Ser(ptr, len, (CsrUint8) primitive->wmmApBcParams[i1].cwMin); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->wmmApBcParams[i1].cwMax); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->wmmApBcParams[i1].aifs); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->wmmApBcParams[i1].txopLimit); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->wmmApBcParams[i1].admissionControlMandatory); + } + } + return(ptr); +} + + +void* CsrWifiNmeApWmmParamUpdateReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiNmeApWmmParamUpdateReq *primitive = (CsrWifiNmeApWmmParamUpdateReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApWmmParamUpdateReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + { + CsrUint16 i1; + for (i1 = 0; i1 < 4; i1++) + { + CsrUint8Des((CsrUint8 *) &primitive->wmmApParams[i1].cwMin, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->wmmApParams[i1].cwMax, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->wmmApParams[i1].aifs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->wmmApParams[i1].txopLimit, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->wmmApParams[i1].admissionControlMandatory, buffer, &offset); + } + } + { + CsrUint16 i1; + for (i1 = 0; i1 < 4; i1++) + { + CsrUint8Des((CsrUint8 *) &primitive->wmmApBcParams[i1].cwMin, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->wmmApBcParams[i1].cwMax, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->wmmApBcParams[i1].aifs, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->wmmApBcParams[i1].txopLimit, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->wmmApBcParams[i1].admissionControlMandatory, buffer, &offset); + } + } + + return primitive; +} + + +CsrSize CsrWifiNmeApStaRemoveReqSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 6; /* CsrUint8 primitive->staMacAddress.a[6] */ + bufferSize += 1; /* CsrBool primitive->keepBlocking */ + return bufferSize; +} + + +CsrUint8* CsrWifiNmeApStaRemoveReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiNmeApStaRemoveReq *primitive = (CsrWifiNmeApStaRemoveReq *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrMemCpySer(ptr, len, (const void *) primitive->staMacAddress.a, ((CsrUint16) (6))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->keepBlocking); + return(ptr); +} + + +void* CsrWifiNmeApStaRemoveReqDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiNmeApStaRemoveReq *primitive = (CsrWifiNmeApStaRemoveReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStaRemoveReq)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrMemCpyDes(primitive->staMacAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint8Des((CsrUint8 *) &primitive->keepBlocking, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiNmeApWpsRegisterCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiNmeApWpsRegisterCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiNmeApWpsRegisterCfm *primitive = (CsrWifiNmeApWpsRegisterCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiNmeApWpsRegisterCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiNmeApWpsRegisterCfm *primitive = (CsrWifiNmeApWpsRegisterCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApWpsRegisterCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiNmeApStartCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 40) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + bufferSize += 32; /* CsrUint8 primitive->ssid.ssid[32] */ + bufferSize += 1; /* CsrUint8 primitive->ssid.length */ + return bufferSize; +} + + +CsrUint8* CsrWifiNmeApStartCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiNmeApStartCfm *primitive = (CsrWifiNmeApStartCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrMemCpySer(ptr, len, (const void *) primitive->ssid.ssid, ((CsrUint16) (32))); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->ssid.length); + return(ptr); +} + + +void* CsrWifiNmeApStartCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiNmeApStartCfm *primitive = (CsrWifiNmeApStartCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApStartCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrMemCpyDes(primitive->ssid.ssid, buffer, &offset, ((CsrUint16) (32))); + CsrUint8Des((CsrUint8 *) &primitive->ssid.length, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiNmeApStopCfmSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiNmeApStopCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiNmeApStopCfm *primitive = (CsrWifiNmeApStopCfm *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiNmeApStopCfmDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiNmeApStopCfm *primitive = (CsrWifiNmeApStopCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopCfm)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiNmeApStopIndSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 1; /* CsrWifiSmeApType primitive->apType */ + bufferSize += 2; /* CsrResult primitive->status */ + return bufferSize; +} + + +CsrUint8* CsrWifiNmeApStopIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiNmeApStopInd *primitive = (CsrWifiNmeApStopInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->apType); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + return(ptr); +} + + +void* CsrWifiNmeApStopIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiNmeApStopInd *primitive = (CsrWifiNmeApStopInd *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->apType, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + + return primitive; +} + + +CsrSize CsrWifiNmeApStationIndSizeof(void *msg) +{ + CsrSize bufferSize = 2; + + /* Calculate the Size of the Serialised Data. Could be more efficient (Try 18) */ + bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 1; /* CsrWifiSmeMediaStatus primitive->mediaStatus */ + bufferSize += 6; /* CsrUint8 primitive->peerMacAddress.a[6] */ + bufferSize += 6; /* CsrUint8 primitive->peerDeviceAddress.a[6] */ + return bufferSize; +} + + +CsrUint8* CsrWifiNmeApStationIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +{ + CsrWifiNmeApStationInd *primitive = (CsrWifiNmeApStationInd *)msg; + *len = 0; + CsrUint16Ser(ptr, len, primitive->common.type); + CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint8Ser(ptr, len, (CsrUint8) primitive->mediaStatus); + CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->peerDeviceAddress.a, ((CsrUint16) (6))); + return(ptr); +} + + +void* CsrWifiNmeApStationIndDes(CsrUint8 *buffer, CsrSize length) +{ + CsrWifiNmeApStationInd *primitive = (CsrWifiNmeApStationInd *) CsrPmemAlloc(sizeof(CsrWifiNmeApStationInd)); + CsrSize offset; + offset = 0; + + CsrUint16Des(&primitive->common.type, buffer, &offset); + CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint8Des((CsrUint8 *) &primitive->mediaStatus, buffer, &offset); + CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->peerDeviceAddress.a, buffer, &offset, ((CsrUint16) (6))); + + return primitive; +} + + +#endif /* CSR_WIFI_NME_ENABLE */ +#endif /* CSR_WIFI_AP_ENABLE */ diff --git a/drivers/staging/csr/sme_sys.c b/drivers/staging/csr/sme_sys.c index da12807..283e302 100644 --- a/drivers/staging/csr/sme_sys.c +++ b/drivers/staging/csr/sme_sys.c @@ -18,7 +18,7 @@ #include "unifi_priv.h" #include "csr_wifi_hip_conversions.h" #ifdef CSR_SUPPORT_WEXT_AP -#include "sme_csr/csr_wifi_sme_sef.h" +#include "csr_wifi_sme_sef.h" #endif diff --git a/drivers/staging/csr/unifi_native.h b/drivers/staging/csr/unifi_native.h index 0015ec2..a480c9e 100644 --- a/drivers/staging/csr/unifi_native.h +++ b/drivers/staging/csr/unifi_native.h @@ -125,7 +125,7 @@ struct wext_config { int num_scan_info; /* Flag on whether non-802.1x packets are allowed out */ - CsrWifiRouterPortAction block_controlled_port; +/* CsrWifiRouterPortAction block_controlled_port;*/ /* Flag on whether we have completed an authenticate/associate process */ unsigned int flag_associated : 1; -- cgit v0.10.2 From 1d633fd153844c8e954b0b72789279bf588cd025 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Mon, 25 Jun 2012 23:12:11 +0200 Subject: staging: iio: fix generic_buffer print2byte() drop extra argument, move cast Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c index bf55335..361e481 100644 --- a/drivers/staging/iio/Documentation/generic_buffer.c +++ b/drivers/staging/iio/Documentation/generic_buffer.c @@ -72,8 +72,7 @@ void print2byte(int input, struct iio_channel_info *info) val &= (1 << info->bits_used) - 1; val = (int16_t)(val << (16 - info->bits_used)) >> (16 - info->bits_used); - printf("%05f ", val, - (float)(val + info->offset)*info->scale); + printf("%05f ", ((float)val + info->offset)*info->scale); } else { uint16_t val = input; val &= (1 << info->bits_used) - 1; -- cgit v0.10.2 From 109379210eb57a252e245363659168a1f1ab8691 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Mon, 25 Jun 2012 23:12:12 +0200 Subject: staging: iio: remove unused variable Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c index 361e481..7b2a12c 100644 --- a/drivers/staging/iio/Documentation/generic_buffer.c +++ b/drivers/staging/iio/Documentation/generic_buffer.c @@ -131,8 +131,6 @@ int main(int argc, char **argv) int ret, c, i, j, toread; - - FILE *fp_ev; int fp; int num_channels; diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h index 6f3a392..6fe8540 100644 --- a/drivers/staging/iio/Documentation/iio_utils.h +++ b/drivers/staging/iio/Documentation/iio_utils.h @@ -280,7 +280,7 @@ inline int build_channel_array(const char *device_dir, { DIR *dp; FILE *sysfsfp; - int count, temp, i; + int count, i; struct iio_channel_info *current; int ret; const struct dirent *ent; -- cgit v0.10.2 From b42f2a0c65e7325674711dcda99c4e93ed9e4698 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Mon, 25 Jun 2012 23:12:13 +0200 Subject: staging: iio: move comment Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h index 6fe8540..d9439f8 100644 --- a/drivers/staging/iio/Documentation/iio_utils.h +++ b/drivers/staging/iio/Documentation/iio_utils.h @@ -7,7 +7,6 @@ * the Free Software Foundation. */ -/* Made up value to limit allocation sizes */ #include #include #include @@ -15,6 +14,7 @@ #include #include +/* Made up value to limit allocation sizes */ #define IIO_MAX_NAME_LENGTH 30 #define FORMAT_SCAN_ELEMENTS_DIR "%s/scan_elements" -- cgit v0.10.2 From d8da0eeed738dbbe9d9ff793bb8f047c2cc474b7 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Mon, 25 Jun 2012 23:12:14 +0200 Subject: staging: iio: generic_buffer cleanup Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c index 7b2a12c..b89b7218 100644 --- a/drivers/staging/iio/Documentation/generic_buffer.c +++ b/drivers/staging/iio/Documentation/generic_buffer.c @@ -33,8 +33,8 @@ /** * size_from_channelarray() - calculate the storage size of a scan - * @channels: the channel info array - * @num_channels: size of the channel info array + * @channels: the channel info array + * @num_channels: number of channels * * Has the side effect of filling the channels[i].location values used * in processing the buffer output. @@ -58,14 +58,15 @@ int size_from_channelarray(struct iio_channel_info *channels, int num_channels) void print2byte(int input, struct iio_channel_info *info) { /* First swap if incorrect endian */ - if (info->be) input = be16toh((uint16_t)input); else input = le16toh((uint16_t)input); - /* shift before conversion to avoid sign extension - of left aligned data */ + /* + * Shift before conversion to avoid sign extension + * of left aligned data + */ input = input >> info->shift; if (info->is_signed) { int16_t val = input; @@ -82,39 +83,39 @@ void print2byte(int input, struct iio_channel_info *info) /** * process_scan() - print out the values in SI units * @data: pointer to the start of the scan - * @infoarray: information about the channels. Note + * @channels: information about the channels. Note * size_from_channelarray must have been called first to fill the * location offsets. - * @num_channels: the number of active channels + * @num_channels: number of channels **/ void process_scan(char *data, - struct iio_channel_info *infoarray, + struct iio_channel_info *channels, int num_channels) { int k; for (k = 0; k < num_channels; k++) - switch (infoarray[k].bytes) { + switch (channels[k].bytes) { /* only a few cases implemented so far */ case 2: - print2byte(*(uint16_t *)(data + infoarray[k].location), - &infoarray[k]); + print2byte(*(uint16_t *)(data + channels[k].location), + &channels[k]); break; case 8: - if (infoarray[k].is_signed) { + if (channels[k].is_signed) { int64_t val = *(int64_t *) (data + - infoarray[k].location); - if ((val >> infoarray[k].bits_used) & 1) - val = (val & infoarray[k].mask) | - ~infoarray[k].mask; + channels[k].location); + if ((val >> channels[k].bits_used) & 1) + val = (val & channels[k].mask) | + ~channels[k].mask; /* special case for timestamp */ - if (infoarray[k].scale == 1.0f && - infoarray[k].offset == 0.0f) + if (channels[k].scale == 1.0f && + channels[k].offset == 0.0f) printf(" %lld", val); else printf("%05f ", ((float)val + - infoarray[k].offset)* - infoarray[k].scale); + channels[k].offset)* + channels[k].scale); } break; default: @@ -129,7 +130,6 @@ int main(int argc, char **argv) unsigned long timedelay = 1000000; unsigned long buf_len = 128; - int ret, c, i, j, toread; int fp; @@ -146,7 +146,7 @@ int main(int argc, char **argv) int noevents = 0; char *dummy; - struct iio_channel_info *infoarray; + struct iio_channel_info *channels; while ((c = getopt(argc, argv, "l:w:c:et:n:")) != -1) { switch (c) { @@ -189,7 +189,7 @@ int main(int argc, char **argv) asprintf(&dev_dir_name, "%siio:device%d", iio_dir, dev_num); if (trigger_name == NULL) { /* - * Build the trigger name. If it is device associated it's + * Build the trigger name. If it is device associated its * name is _dev[n] where n matches the device * number found above */ @@ -214,7 +214,7 @@ int main(int argc, char **argv) * Parse the files in scan_elements to identify what channels are * present */ - ret = build_channel_array(dev_dir_name, &infoarray, &num_channels); + ret = build_channel_array(dev_dir_name, &channels, &num_channels); if (ret) { printf("Problem reading scan element information\n"); printf("diag %s\n", dev_dir_name); @@ -233,7 +233,7 @@ int main(int argc, char **argv) goto error_free_triggername; } printf("%s %s\n", dev_dir_name, trigger_name); - /* Set the device trigger to be the data rdy trigger found above */ + /* Set the device trigger to be the data ready trigger found above */ ret = write_sysfs_string_and_verify("trigger/current_trigger", dev_dir_name, trigger_name); @@ -251,7 +251,7 @@ int main(int argc, char **argv) ret = write_sysfs_int("enable", buf_dir_name, 1); if (ret < 0) goto error_free_buf_dir_name; - scan_size = size_from_channelarray(infoarray, num_channels); + scan_size = size_from_channelarray(channels, num_channels); data = malloc(scan_size*buf_len); if (!data) { ret = -ENOMEM; @@ -266,7 +266,7 @@ int main(int argc, char **argv) /* Attempt to open non blocking the access dev */ fp = open(buffer_access, O_RDONLY | O_NONBLOCK); - if (fp == -1) { /*If it isn't there make the node */ + if (fp == -1) { /* If it isn't there make the node */ printf("Failed to open %s\n", buffer_access); ret = -errno; goto error_free_buffer_access; @@ -297,16 +297,16 @@ int main(int argc, char **argv) } for (i = 0; i < read_size/scan_size; i++) process_scan(data + scan_size*i, - infoarray, + channels, num_channels); } - /* Stop the ring buffer */ + /* Stop the buffer */ ret = write_sysfs_int("enable", buf_dir_name, 0); if (ret < 0) goto error_close_buffer_access; - /* Disconnect from the trigger - just write a dummy name.*/ + /* Disconnect the trigger - just write a dummy name. */ write_sysfs_string("trigger/current_trigger", dev_dir_name, "NULL"); -- cgit v0.10.2 From 42196d396378f4e4658dbe157d78fd23bce6bbbd Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Mon, 25 Jun 2012 23:12:15 +0200 Subject: staging: iio: fix warning 'static but used in inline function' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit iio_utils.h:367:10: warning: ‘iioutils_break_up_name’ is static but used in inline function ‘build_channel_array’ which is not static [enabled by default] Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h index d9439f8..9c7a5aa 100644 --- a/drivers/staging/iio/Documentation/iio_utils.h +++ b/drivers/staging/iio/Documentation/iio_utils.h @@ -27,7 +27,7 @@ const char *iio_dir = "/sys/bus/iio/devices/"; * @full_name: the full channel name * @generic_name: the output generic channel name **/ -static int iioutils_break_up_name(const char *full_name, +inline int iioutils_break_up_name(const char *full_name, char **generic_name) { char *current; -- cgit v0.10.2 From 1bcdfbcf7599a42f7aa0e41c88df178fecebc909 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Mon, 25 Jun 2012 23:12:16 +0200 Subject: staging: iio: use PRId64 format specifier for int64_t Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c index b89b7218..b16c4b2 100644 --- a/drivers/staging/iio/Documentation/generic_buffer.c +++ b/drivers/staging/iio/Documentation/generic_buffer.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "iio_utils.h" /** @@ -111,7 +112,7 @@ void process_scan(char *data, /* special case for timestamp */ if (channels[k].scale == 1.0f && channels[k].offset == 0.0f) - printf(" %lld", val); + printf("%" PRId64 " ", val); else printf("%05f ", ((float)val + channels[k].offset)* -- cgit v0.10.2 From bb23378c0b1c9a410d40adea74276544a00fb94e Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Mon, 25 Jun 2012 23:12:17 +0200 Subject: staging: iio: quell asprintf() warning, missing #includes Signed-off-by: Peter Meerwald Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c index b16c4b2..827e92d 100644 --- a/drivers/staging/iio/Documentation/generic_buffer.c +++ b/drivers/staging/iio/Documentation/generic_buffer.c @@ -18,6 +18,8 @@ * */ +#define _GNU_SOURCE + #include #include #include @@ -29,6 +31,7 @@ #include #include #include +#include #include #include "iio_utils.h" diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h index 9c7a5aa..c0448b3 100644 --- a/drivers/staging/iio/Documentation/iio_utils.h +++ b/drivers/staging/iio/Documentation/iio_utils.h @@ -13,6 +13,7 @@ #include #include #include +#include /* Made up value to limit allocation sizes */ #define IIO_MAX_NAME_LENGTH 30 -- cgit v0.10.2 From 90e6dc7c274dca8a9198e3525488ea991719a799 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Tue, 26 Jun 2012 10:43:05 +0200 Subject: iio:adc:at91: Relase mutex on error path in at91_adc_read_raw This issue was reported by the mini_lock.cocci coccinelle semantic patch. Signed-off-by: Lars-Peter Clausen Acked-by: Maxime Ripard Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index 6a08469..f61780a 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c @@ -349,9 +349,11 @@ static int at91_adc_read_raw(struct iio_dev *idev, st->done, msecs_to_jiffies(1000)); if (ret == 0) - return -ETIMEDOUT; - else if (ret < 0) + ret = -ETIMEDOUT; + if (ret < 0) { + mutex_unlock(&st->lock); return ret; + } *val = st->last_value; -- cgit v0.10.2 From 779c0c4619f57ab0d573468baa7a791db402e9f9 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Tue, 26 Jun 2012 10:45:43 +0200 Subject: iio:dac:ad5446: Add support for the AD5450/51/52/53 This patch adds support for the Analog Devices AD5450/51/52/53 Digital-to-Analog converters. The AD5452 and AD5453 are software compatible to the existing AD5444 and AD5446. The AD5450 and AD5451 are similar but have a smaller resolution. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig index 92fb3a0..afd207e 100644 --- a/drivers/iio/dac/Kconfig +++ b/drivers/iio/dac/Kconfig @@ -59,9 +59,9 @@ config AD5446 tristate "Analog Devices AD5446 and similar single channel DACs driver" depends on SPI help - Say yes here to build support for Analog Devices AD5444, AD5446, - AD5512A, AD5541A, AD5542A, AD5543, AD5553, AD5601, AD5611, AD5620, - AD5621, AD5640, AD5660, AD5662 DACs. + Say yes here to build support for Analog Devices AD5444, AD5446, AD5450, + AD5451, AD5452, AD5453, AD5512A, AD5541A, AD5542A, AD5543, AD5553, AD5601, + AD5611, AD5620, AD5621, AD5640, AD5660, AD5662 DACs. To compile this driver as a module, choose M here: the module will be called ad5446. diff --git a/drivers/iio/dac/ad5446.c b/drivers/iio/dac/ad5446.c index 49f557f..2ca5059 100644 --- a/drivers/iio/dac/ad5446.c +++ b/drivers/iio/dac/ad5446.c @@ -147,6 +147,14 @@ static const struct ad5446_chip_info ad5446_chip_info_tbl[] = { .channel = AD5446_CHANNEL(14, 16, 0), .write = ad5446_write, }, + [ID_AD5450] = { + .channel = AD5446_CHANNEL(8, 16, 6), + .write = ad5446_write, + }, + [ID_AD5451] = { + .channel = AD5446_CHANNEL(10, 16, 4), + .write = ad5446_write, + }, [ID_AD5541A] = { .channel = AD5446_CHANNEL(16, 16, 0), .write = ad5446_write, @@ -346,6 +354,10 @@ static int ad5446_remove(struct spi_device *spi) static const struct spi_device_id ad5446_id[] = { {"ad5444", ID_AD5444}, {"ad5446", ID_AD5446}, + {"ad5450", ID_AD5450}, + {"ad5451", ID_AD5451}, + {"ad5452", ID_AD5444}, /* ad5452 is compatible to the ad5444 */ + {"ad5453", ID_AD5446}, /* ad5453 is compatible to the ad5446 */ {"ad5512a", ID_AD5512A}, {"ad5541a", ID_AD5541A}, {"ad5542a", ID_AD5541A}, /* ad5541a and ad5542a are compatible */ diff --git a/drivers/iio/dac/ad5446.h b/drivers/iio/dac/ad5446.h index dfd68ce..2934269 100644 --- a/drivers/iio/dac/ad5446.h +++ b/drivers/iio/dac/ad5446.h @@ -71,6 +71,8 @@ struct ad5446_chip_info { enum ad5446_supported_device_ids { ID_AD5444, ID_AD5446, + ID_AD5450, + ID_AD5451, ID_AD5541A, ID_AD5512A, ID_AD5553, -- cgit v0.10.2 From 258767fed9da230553d92e2d53f5f872d55795b1 Mon Sep 17 00:00:00 2001 From: Sherwin Soltani Date: Tue, 26 Jun 2012 02:00:30 -0400 Subject: drivers: staging: android: binder.c: fix printk macros Change printk() messages to pr_* macros. Signed-off-by: Sherwin Soltani Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c index c283212..574e992 100644 --- a/drivers/staging/android/binder.c +++ b/drivers/staging/android/binder.c @@ -124,13 +124,13 @@ module_param_call(stop_on_user_error, binder_set_stop_on_user_error, #define binder_debug(mask, x...) \ do { \ if (binder_debug_mask & mask) \ - printk(KERN_INFO x); \ + pr_info(x); \ } while (0) #define binder_user_error(x...) \ do { \ if (binder_debug_mask & BINDER_DEBUG_USER_ERROR) \ - printk(KERN_INFO x); \ + pr_info(x); \ if (binder_stop_on_user_error) \ binder_stop_on_user_error = 2; \ } while (0) @@ -418,7 +418,7 @@ repeat: #if 1 /* Sanity check */ if (fdt->fd[fd] != NULL) { - printk(KERN_WARNING "get_unused_fd: slot %d not NULL!\n", fd); + pr_warn("get_unused_fd: slot %d not NULL!\n", fd); fdt->fd[fd] = NULL; } #endif @@ -644,7 +644,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate, goto free_range; if (vma == NULL) { - printk(KERN_ERR "binder: %d: binder_alloc_buf failed to " + pr_err("binder: %d: binder_alloc_buf failed to " "map pages in userspace, no vma\n", proc->pid); goto err_no_vma; } @@ -657,7 +657,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate, BUG_ON(*page); *page = alloc_page(GFP_KERNEL | __GFP_ZERO); if (*page == NULL) { - printk(KERN_ERR "binder: %d: binder_alloc_buf failed " + pr_err("binder: %d: binder_alloc_buf failed " "for page at %p\n", proc->pid, page_addr); goto err_alloc_page_failed; } @@ -666,7 +666,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate, page_array_ptr = page; ret = map_vm_area(&tmp_area, PAGE_KERNEL, &page_array_ptr); if (ret) { - printk(KERN_ERR "binder: %d: binder_alloc_buf failed " + pr_err("binder: %d: binder_alloc_buf failed " "to map page at %p in kernel\n", proc->pid, page_addr); goto err_map_kernel_failed; @@ -675,7 +675,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate, (uintptr_t)page_addr + proc->user_buffer_offset; ret = vm_insert_page(vma, user_page_addr, page[0]); if (ret) { - printk(KERN_ERR "binder: %d: binder_alloc_buf failed " + pr_err("binder: %d: binder_alloc_buf failed " "to map page at %lx in userspace\n", proc->pid, user_page_addr); goto err_vm_insert_page_failed; @@ -724,7 +724,7 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc, size_t size; if (proc->vma == NULL) { - printk(KERN_ERR "binder: %d: binder_alloc_buf, no vma\n", + pr_err("binder: %d: binder_alloc_buf, no vma\n", proc->pid); return NULL; } @@ -762,7 +762,7 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc, } } if (best_fit == NULL) { - printk(KERN_ERR "binder: %d: binder_alloc_buf size %zd failed, " + pr_err("binder: %d: binder_alloc_buf size %zd failed, " "no address space\n", proc->pid, size); return NULL; } @@ -997,7 +997,7 @@ static int binder_inc_node(struct binder_node *node, int strong, int internal, node->internal_strong_refs == 0 && !(node == binder_context_mgr_node && node->has_strong_ref)) { - printk(KERN_ERR "binder: invalid inc strong " + pr_err("binder: invalid inc strong " "node for %d\n", node->debug_id); return -EINVAL; } @@ -1013,7 +1013,7 @@ static int binder_inc_node(struct binder_node *node, int strong, int internal, node->local_weak_refs++; if (!node->has_weak_ref && list_empty(&node->work.entry)) { if (target_list == NULL) { - printk(KERN_ERR "binder: invalid inc weak node " + pr_err("binder: invalid inc weak node " "for %d\n", node->debug_id); return -EINVAL; } @@ -1276,7 +1276,7 @@ static void binder_send_failed_reply(struct binder_transaction *t, target_thread->return_error = error_code; wake_up_interruptible(&target_thread->wait); } else { - printk(KERN_ERR "binder: reply failed, target " + pr_err("binder: reply failed, target " "thread, %d:%d, has error code %d " "already\n", target_thread->proc->pid, target_thread->pid, @@ -1331,7 +1331,7 @@ static void binder_transaction_buffer_release(struct binder_proc *proc, if (*offp > buffer->data_size - sizeof(*fp) || buffer->data_size < sizeof(*fp) || !IS_ALIGNED(*offp, sizeof(void *))) { - printk(KERN_ERR "binder: transaction release %d bad" + pr_err("binder: transaction release %d bad" "offset %zd, size %zd\n", debug_id, *offp, buffer->data_size); continue; @@ -1342,7 +1342,7 @@ static void binder_transaction_buffer_release(struct binder_proc *proc, case BINDER_TYPE_WEAK_BINDER: { struct binder_node *node = binder_get_node(proc, fp->binder); if (node == NULL) { - printk(KERN_ERR "binder: transaction release %d" + pr_err("binder: transaction release %d" " bad node %p\n", debug_id, fp->binder); break; } @@ -1355,7 +1355,7 @@ static void binder_transaction_buffer_release(struct binder_proc *proc, case BINDER_TYPE_WEAK_HANDLE: { struct binder_ref *ref = binder_get_ref(proc, fp->handle); if (ref == NULL) { - printk(KERN_ERR "binder: transaction release %d" + pr_err("binder: transaction release %d" " bad handle %ld\n", debug_id, fp->handle); break; @@ -1374,7 +1374,7 @@ static void binder_transaction_buffer_release(struct binder_proc *proc, break; default: - printk(KERN_ERR "binder: transaction release %d bad " + pr_err("binder: transaction release %d bad " "object type %lx\n", debug_id, fp->type); break; } @@ -1925,10 +1925,10 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, break; } case BC_ATTEMPT_ACQUIRE: - printk(KERN_ERR "binder: BC_ATTEMPT_ACQUIRE not supported\n"); + pr_err("binder: BC_ATTEMPT_ACQUIRE not supported\n"); return -EINVAL; case BC_ACQUIRE_RESULT: - printk(KERN_ERR "binder: BC_ACQUIRE_RESULT not supported\n"); + pr_err("binder: BC_ACQUIRE_RESULT not supported\n"); return -EINVAL; case BC_FREE_BUFFER: { @@ -2165,7 +2165,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, } break; default: - printk(KERN_ERR "binder: %d:%d unknown command %d\n", + pr_err("binder: %d:%d unknown command %d\n", proc->pid, thread->pid, cmd); return -EINVAL; } @@ -2635,7 +2635,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) unsigned int size = _IOC_SIZE(cmd); void __user *ubuf = (void __user *)arg; - /*printk(KERN_INFO "binder_ioctl: %d:%d %x %lx\n", proc->pid, current->pid, cmd, arg);*/ + /*pr_info("binder_ioctl: %d:%d %x %lx\n", proc->pid, current->pid, cmd, arg);*/ ret = wait_event_interruptible(binder_user_error_wait, binder_stop_on_user_error < 2); if (ret) @@ -2701,13 +2701,13 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) break; case BINDER_SET_CONTEXT_MGR: if (binder_context_mgr_node != NULL) { - printk(KERN_ERR "binder: BINDER_SET_CONTEXT_MGR already set\n"); + pr_err("binder: BINDER_SET_CONTEXT_MGR already set\n"); ret = -EBUSY; goto err; } if (binder_context_mgr_uid != -1) { if (binder_context_mgr_uid != current->cred->euid) { - printk(KERN_ERR "binder: BINDER_SET_" + pr_err("binder: BINDER_SET_" "CONTEXT_MGR bad uid %d != %d\n", current->cred->euid, binder_context_mgr_uid); @@ -2753,7 +2753,7 @@ err: mutex_unlock(&binder_lock); wait_event_interruptible(binder_user_error_wait, binder_stop_on_user_error < 2); if (ret && ret != -ERESTARTSYS) - printk(KERN_INFO "binder: %d:%d ioctl %x %lx returned %d\n", proc->pid, current->pid, cmd, arg, ret); + pr_info("binder: %d:%d ioctl %x %lx returned %d\n", proc->pid, current->pid, cmd, arg, ret); return ret; } @@ -2829,7 +2829,7 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma) #ifdef CONFIG_CPU_CACHE_VIPT if (cache_is_vipt_aliasing()) { while (CACHE_COLOUR((vma->vm_start ^ (uint32_t)proc->buffer))) { - printk(KERN_INFO "binder_mmap: %d %lx-%lx maps %p bad alignment\n", proc->pid, vma->vm_start, vma->vm_end, proc->buffer); + pr_info("binder_mmap: %d %lx-%lx maps %p bad alignment\n", proc->pid, vma->vm_start, vma->vm_end, proc->buffer); vma->vm_start += PAGE_SIZE; } } @@ -2861,7 +2861,7 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma) proc->vma = vma; proc->vma_vm_mm = vma->vm_mm; - /*printk(KERN_INFO "binder_mmap: %d %lx-%lx maps %p\n", + /*pr_info("binder_mmap: %d %lx-%lx maps %p\n", proc->pid, vma->vm_start, vma->vm_end, proc->buffer);*/ return 0; @@ -2876,7 +2876,7 @@ err_get_vm_area_failed: err_already_mapped: mutex_unlock(&binder_mmap_lock); err_bad_arg: - printk(KERN_ERR "binder_mmap: %d %lx-%lx %s failed %d\n", + pr_err("binder_mmap: %d %lx-%lx %s failed %d\n", proc->pid, vma->vm_start, vma->vm_end, failure_string, ret); return ret; } @@ -3031,7 +3031,7 @@ static void binder_deferred_release(struct binder_proc *proc) if (t) { t->buffer = NULL; buffer->transaction = NULL; - printk(KERN_ERR "binder: release proc %d, " + pr_err("binder: release proc %d, " "transaction %d, not freed\n", proc->pid, t->debug_id); /*BUG();*/ -- cgit v0.10.2 From 9b1904c7cf2ff7e69ff2bbf2e0308a231e8064c2 Mon Sep 17 00:00:00 2001 From: "Javier M. Mellid" Date: Tue, 26 Jun 2012 06:00:14 +0200 Subject: staging: sm7xxfb: dead code removal This patch removes dead code. Tested with SM712. Signed-off-by: Javier M. Mellid Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sm7xxfb/sm7xx.h b/drivers/staging/sm7xxfb/sm7xx.h index 43d86f8..333f33c 100644 --- a/drivers/staging/sm7xxfb/sm7xx.h +++ b/drivers/staging/sm7xxfb/sm7xx.h @@ -14,7 +14,6 @@ */ #define NR_PALETTE 256 -#define NR_RGB 2 #define FB_ACCEL_SMI_LYNX 88 diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index 32111a0..4c741e2af 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -42,10 +42,6 @@ struct screen_info smtc_screen_info; struct smtcfb_info { struct fb_info fb; struct pci_dev *pdev; - struct { - u8 red, green, blue; - } palette[NR_RGB]; - u_int palette_size; u16 chipID; unsigned char __iomem *m_pMMIO; -- cgit v0.10.2 From 50b238b186d4ac77da07a0fa0261467f9431581b Mon Sep 17 00:00:00 2001 From: "Javier M. Mellid" Date: Tue, 26 Jun 2012 06:00:15 +0200 Subject: staging: sm7xxfb: dead code removal This patch removes dead code related to BaseAddressInVRAM. It fixes comment on RAM control bits too. Tested with SM712. Signed-off-by: Javier M. Mellid Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index 4c741e2af..78da779 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -53,7 +53,7 @@ struct smtcfb_info { u_int width; u_int height; u_int hz; - u_long BaseAddressInVRAM; + u8 chipRevID; }; @@ -220,17 +220,9 @@ static void sm712_set_timing(struct smtcfb_info *sfb) static void sm712_setpalette(int regno, unsigned red, unsigned green, unsigned blue, struct fb_info *info) { - struct smtcfb_info *sfb = info->par; + /* set bit 5:4 = 01 (write LCD RAM only) */ + smtc_seqw(0x66, (smtc_seqr(0x66) & 0xC3) | 0x10); - if (sfb->BaseAddressInVRAM) - /* - * second display palette for dual head. Enable CRT RAM, 6-bit - * RAM - */ - smtc_seqw(0x66, (smtc_seqr(0x66) & 0xC3) | 0x20); - else - /* primary display palette. Enable LCD RAM only, 6-bit RAM */ - smtc_seqw(0x66, (smtc_seqr(0x66) & 0xC3) | 0x10); smtc_mmiowb(regno, dac_reg); smtc_mmiowb(red >> 10, dac_val); smtc_mmiowb(green >> 10, dac_val); @@ -932,8 +924,6 @@ static int __devinit smtcfb_pci_probe(struct pci_dev *pdev, goto failed; smtcfb_setmode(sfb); - /* Primary display starting from 0 position */ - sfb->BaseAddressInVRAM = 0; err = register_framebuffer(&sfb->fb); if (err < 0) -- cgit v0.10.2 From 128e8616faff1a863ad9f8e865e255ee4d36bed4 Mon Sep 17 00:00:00 2001 From: "Javier M. Mellid" Date: Tue, 26 Jun 2012 06:00:16 +0200 Subject: staging: sm7xxfb: delete unnecessary color map allocation This patchs erases fb_alloc_cmap call in smtc_free_fb_info. In the future, when needed, the required function to call here should be fb_dealloc_cmap. Tested with SM712. Signed-off-by: Javier M. Mellid Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index 78da779..e5d016b 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -697,6 +697,14 @@ static struct smtcfb_info *smtc_alloc_fb_info(struct pci_dev *pdev, char *name) } /* + * free struct smtcfb_info + */ +static void smtc_free_fb_info(struct smtcfb_info *sfb) +{ + kfree(sfb); +} + +/* * Unmap in the memory mapped IO registers */ @@ -755,14 +763,6 @@ static inline void sm7xx_init_hw(void) outb_p(0x11, 0x3c5); } -static void smtc_free_fb_info(struct smtcfb_info *sfb) -{ - if (sfb) { - fb_alloc_cmap(&sfb->fb.cmap, 0, 0); - kfree(sfb); - } -} - /* * sm712vga_setup - process command line options, get vga parameter * @options: string of options -- cgit v0.10.2 From f204739736fecee77280c7743b5409dd158a49a6 Mon Sep 17 00:00:00 2001 From: "Javier M. Mellid" Date: Tue, 26 Jun 2012 06:00:17 +0200 Subject: staging: sm7xxfb: code cleanup on smtcfb_setmode Code cleanup on smtcfb_setmode. Tested with SM712. Signed-off-by: Javier M. Mellid Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index e5d016b..16d2b5e 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -557,55 +557,49 @@ void smtcfb_setmode(struct smtcfb_info *sfb) { switch (sfb->fb.var.bits_per_pixel) { case 32: - sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR; - sfb->fb.fix.line_length = sfb->fb.var.xres * 4; - sfb->fb.var.red.length = 8; + sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR; + sfb->fb.fix.line_length = sfb->fb.var.xres * 4; + sfb->fb.var.red.length = 8; sfb->fb.var.green.length = 8; - sfb->fb.var.blue.length = 8; - sfb->fb.var.red.offset = 16; + sfb->fb.var.blue.length = 8; + sfb->fb.var.red.offset = 16; sfb->fb.var.green.offset = 8; - sfb->fb.var.blue.offset = 0; - - break; - case 8: - sfb->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR; - sfb->fb.fix.line_length = sfb->fb.var.xres; - sfb->fb.var.red.offset = 5; - sfb->fb.var.red.length = 3; - sfb->fb.var.green.offset = 2; - sfb->fb.var.green.length = 3; - sfb->fb.var.blue.offset = 0; - sfb->fb.var.blue.length = 2; + sfb->fb.var.blue.offset = 0; break; case 24: - sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR; - sfb->fb.fix.line_length = sfb->fb.var.xres * 3; - sfb->fb.var.red.length = 8; + sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR; + sfb->fb.fix.line_length = sfb->fb.var.xres * 3; + sfb->fb.var.red.length = 8; sfb->fb.var.green.length = 8; - sfb->fb.var.blue.length = 8; - - sfb->fb.var.red.offset = 16; + sfb->fb.var.blue.length = 8; + sfb->fb.var.red.offset = 16; sfb->fb.var.green.offset = 8; - sfb->fb.var.blue.offset = 0; - + sfb->fb.var.blue.offset = 0; + break; + case 8: + sfb->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR; + sfb->fb.fix.line_length = sfb->fb.var.xres; + sfb->fb.var.red.length = 3; + sfb->fb.var.green.length = 3; + sfb->fb.var.blue.length = 2; + sfb->fb.var.red.offset = 5; + sfb->fb.var.green.offset = 2; + sfb->fb.var.blue.offset = 0; break; case 16: default: - sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR; - sfb->fb.fix.line_length = sfb->fb.var.xres * 2; - - sfb->fb.var.red.length = 5; + sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR; + sfb->fb.fix.line_length = sfb->fb.var.xres * 2; + sfb->fb.var.red.length = 5; sfb->fb.var.green.length = 6; - sfb->fb.var.blue.length = 5; - - sfb->fb.var.red.offset = 11; + sfb->fb.var.blue.length = 5; + sfb->fb.var.red.offset = 11; sfb->fb.var.green.offset = 5; - sfb->fb.var.blue.offset = 0; - + sfb->fb.var.blue.offset = 0; break; } - sfb->width = sfb->fb.var.xres; + sfb->width = sfb->fb.var.xres; sfb->height = sfb->fb.var.yres; sfb->hz = 60; smtc_set_timing(sfb); -- cgit v0.10.2 From ba0a7ae713c89c7be204646d9a34c7f612743f51 Mon Sep 17 00:00:00 2001 From: Rupesh Gujare Date: Tue, 26 Jun 2012 13:03:39 +0100 Subject: staging: ozwpan: Unregister with sysfs while unloading. Destroy device node & unregister device class from sysfs while unloading driver Signed-off-by: Rupesh Gujare Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ozwpan/ozcdev.c b/drivers/staging/ozwpan/ozcdev.c index 929756a..d983219 100644 --- a/drivers/staging/ozwpan/ozcdev.c +++ b/drivers/staging/ozwpan/ozcdev.c @@ -42,6 +42,7 @@ struct oz_serial_ctx { /*------------------------------------------------------------------------------ */ static struct oz_cdev g_cdev; +struct class *g_oz_class; /*------------------------------------------------------------------------------ * Context: process and softirq */ @@ -330,7 +331,6 @@ const struct file_operations oz_fops = { int oz_cdev_register(void) { int err; - struct class *cl; struct device *dev; memset(&g_cdev, 0, sizeof(g_cdev)); err = alloc_chrdev_region(&g_cdev.devnum, 0, 1, "ozwpan"); @@ -348,12 +348,12 @@ int oz_cdev_register(void) oz_trace("Failed to add cdev\n"); goto out2; } - cl = class_create(THIS_MODULE, "ozmo_wpan"); - if (IS_ERR(cl)) { + g_oz_class = class_create(THIS_MODULE, "ozmo_wpan"); + if (IS_ERR(g_oz_class)) { oz_trace("Failed to register ozmo_wpan class\n"); goto out1; } - dev = device_create(cl, NULL, g_cdev.devnum, NULL, "ozwpan"); + dev = device_create(g_oz_class, NULL, g_cdev.devnum, NULL, "ozwpan"); if (IS_ERR(dev)) { oz_trace("Failed to create sysfs entry for cdev\n"); goto out1; @@ -373,6 +373,10 @@ int oz_cdev_deregister(void) { cdev_del(&g_cdev.cdev); unregister_chrdev_region(g_cdev.devnum, 1); + if (g_oz_class) { + device_destroy(g_oz_class, g_cdev.devnum); + class_destroy(g_oz_class); + } return 0; } /*------------------------------------------------------------------------------ -- cgit v0.10.2 From 4b29a3058c080fe6f76ae90e0e792e21000deb16 Mon Sep 17 00:00:00 2001 From: Rupesh Gujare Date: Tue, 26 Jun 2012 13:03:41 +0100 Subject: staging: ozwpan: Update TODO file Update TODO file. Signed-off-by: Rupesh Gujare Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ozwpan/TODO b/drivers/staging/ozwpan/TODO index c2d30a7..b5db245 100644 --- a/drivers/staging/ozwpan/TODO +++ b/drivers/staging/ozwpan/TODO @@ -1,10 +1,11 @@ TODO: - - review user mode interface and determine if ioctls can be replaced - with something better. correctly export data structures to user mode - if ioctls are still required and allocate ioctl numbers from - ioctl-number.txt. + - Convert event tracing code to in-kernel tracing infrastructure + - Check for remaining ioctl & check if that can be converted into + sysfs entries + - Convert debug prints to appropriate dev_debug or something better + - Modify Kconfig to add CONFIG option for enabling/disabling event + tracing. - check USB HCD implementation is complete and correct. - - remove any debug and trace code. - code review by USB developer community. - testing with as many devices as possible. -- cgit v0.10.2 From ea8d385436d956984ab5875c778a13a91033e0d3 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Mon, 25 Jun 2012 19:49:35 +0100 Subject: staging: comedi: split CONFIG_COMEDI_NI_TIO option Selecting the CONFIG_COMEDI_NI_TIO config option causes the 'ni_tio' and 'ni_tiocmd' modules to be built. CONFIG_COMEDI_NI_TIO depends on CONFIG_COMEDI_MITE which in turn depends on CONFIG_PCI. However, not all the drivers that need the 'ni_tio' module also need the 'ni_tiocmd' module. Specifically, the ISA and PCMCIA drivers do not need the 'ni_tiocmd' module. Add a new config option CONFIG_COMEDI_NI_TIOCMD to control building of the 'ni_tiocmd' module. It depends on CONFIG_COMEDI_NI_TIO and CONFIG_COMEDI_MITE. The existing CONFIG_COMEDI_NI_TIO option no longer needs to depend on CONFIG_COMEDI_MITE. Make CONFIG_COMEDI_NI_660X ('ni_660x' module) and CONFIG_COMEDI_NI_PCIMIO ('ni_pcimio' module) depend on CONFIG_COMEDI_NI_TIOCMD instead of CONFIG_COMEDI_NI_TIO. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 0415520..2ffbc35 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -1007,7 +1007,7 @@ config COMEDI_NI_65XX config COMEDI_NI_660X tristate "NI 660x counter/timer PCI card support" - depends on COMEDI_NI_TIO && COMEDI_NI_COMMON + depends on COMEDI_NI_TIOCMD && COMEDI_NI_COMMON ---help--- Enable support for National Instruments PCI-6601 (ni_660x), PCI-6602, PXI-6602 and PXI-6608. @@ -1040,7 +1040,7 @@ config COMEDI_NI_PCIDIO config COMEDI_NI_PCIMIO tristate "NI PCI-MIO-E series and M series support" - depends on COMEDI_NI_TIO && COMEDI_NI_COMMON + depends on COMEDI_NI_TIOCMD && COMEDI_NI_COMMON select COMEDI_8255 select COMEDI_FC ---help--- @@ -1256,15 +1256,26 @@ config COMEDI_MITE config COMEDI_NI_TIO tristate "NI general purpose counter support" - depends on COMEDI_MITE ---help--- Enable support for National Instruments general purpose counters. This module is not used directly by end-users. Rather, it is used by other drivers (for example ni_660x and ni_pcimio) to provide support for NI's general purpose counters. - To compile this driver as a modules, choose M here: two modules will - be build: ni_tio and ni_tiocmd. + To compile this driver as a module, choose M here: the module will + be called ni_tio. + +config COMEDI_NI_TIOCMD + tristate "NI streaming acquisition for general purpose counters" + depends on COMEDI_NI_TIO && COMEDI_MITE + ---help--- + Enable streaming acquisition command support for National Instruments + general purpose counters. This module is not used directly by + end-users. It is used by some NI PCI card drivers (ni_660x and + ni_pcimio). + + To compile this driver as a module, choose M here: the module will + be called ni_tiocmd. config COMEDI_NI_LABPC tristate "NI Lab-PC and compatibles ISA and PCI support" diff --git a/drivers/staging/comedi/drivers/Makefile b/drivers/staging/comedi/drivers/Makefile index 513469d9..57b19e4 100644 --- a/drivers/staging/comedi/drivers/Makefile +++ b/drivers/staging/comedi/drivers/Makefile @@ -131,7 +131,7 @@ obj-$(CONFIG_COMEDI_VMK80XX) += vmk80xx.o # Comedi NI drivers obj-$(CONFIG_COMEDI_MITE) += mite.o obj-$(CONFIG_COMEDI_NI_TIO) += ni_tio.o -obj-$(CONFIG_COMEDI_NI_TIO) += ni_tiocmd.o +obj-$(CONFIG_COMEDI_NI_TIOCMD) += ni_tiocmd.o obj-$(CONFIG_COMEDI_NI_LABPC) += ni_labpc.o obj-$(CONFIG_COMEDI_8255) += 8255.o -- cgit v0.10.2 From 2f2ac8ec08ae9e2d3f8ef24f40064a938a86b6f1 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Mon, 25 Jun 2012 19:49:36 +0100 Subject: staging: comedi: Move COMEDI_NI_LABPC config option Move the CONFIG_COMEDI_NI_LABPC option ("NI Lab-PC and compatibles ISA and PCI support") from the CONFIG_COMEDI_NI_COMMON menu ("Comedi National Instruments card support --->") to the CONFIG_COMEDI_PCI_DRIVERS menu ("Comedi PCI drivers --->"). It currently depends on PCI but should be split up into separate ISA and PCI config options eventually as was done for the "das08" driver. For now, the PCI card menu seems the best place for it and I plan to get rid of the CONFIG_COMEDI_NI_COMMON menu altogether. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 2ffbc35..2d1e47d 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -1024,6 +1024,21 @@ config COMEDI_NI_670X To compile this driver as a module, choose M here: the module will be called ni_670x. +config COMEDI_NI_LABPC + tristate "NI Lab-PC and compatibles ISA and PCI support" + depends on COMEDI_MITE + select COMEDI_8255 + select COMEDI_FC + depends on VIRT_TO_BUS + ---help--- + Enable support for National Instruments Lab-PC and compatibles + Lab-PC-1200, Lab-PC-1200AI, Lab-PC+ and PCI-1200. + Kernel-level ISA plug-and-play support for the lab-pc-1200 boards has + not yet been added to the driver. + + To compile this driver as a module, choose M here: the module will be + called ni_labpc. + config COMEDI_NI_PCIDIO tristate "NI PCI-DIO32HS, PCI-DIO96, PCI-6533, PCI-6503 support" depends on COMEDI_MITE @@ -1277,21 +1292,6 @@ config COMEDI_NI_TIOCMD To compile this driver as a module, choose M here: the module will be called ni_tiocmd. -config COMEDI_NI_LABPC - tristate "NI Lab-PC and compatibles ISA and PCI support" - depends on COMEDI_MITE - select COMEDI_8255 - select COMEDI_FC - depends on VIRT_TO_BUS - ---help--- - Enable support for National Instruments Lab-PC and compatibles - Lab-PC-1200, Lab-PC-1200AI, Lab-PC+ and PCI-1200. - Kernel-level ISA plug-and-play support for the lab-pc-1200 boards has - not yet been added to the driver. - - To compile this driver as a module, choose M here: the module will be - called ni_labpc. - endif # COMEDI_NI_COMMON config COMEDI_8255 -- cgit v0.10.2 From 7ac21b82be42b6414ba9fa170263376ee2326925 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Mon, 25 Jun 2012 19:49:37 +0100 Subject: staging: comedi: Simplify NI driver configuration At the moment, the options to select drivers for various National Instruments boards in the "Comedi PCI drivers", "Comedi ISA and PC/104 drivers" and "Comedi PCMCIA drivers" menus do not appear unless you first enable and enter the "Comedi National Instruments card support" menu and possibly select some of the options in there. This is pretty confusing for the user. Get rid of the "Comedi National Instruments card support" menu (CONFIG_COMEDI_NI_COMMON) and make the CONFIG_COMEDI_MITE, CONFIG_COMEDI_NI_TIO and CONFIG_COMEDI_NI_TIOCMD options selectable by other options instead of dependencies of those other options. We lose the ability to build the 'mite', 'ni_tio' and 'ni_tiocmd' modules independently of other modules, but they are not useful on their own anyway. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 2d1e47d..9ff3f4d 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -444,7 +444,6 @@ config COMEDI_ADQ12B config COMEDI_NI_AT_A2150 tristate "NI AT-A2150 ISA card support" - depends on COMEDI_NI_COMMON depends on VIRT_TO_BUS ---help--- Enable support for National Instruments AT-A2150 cards @@ -454,7 +453,6 @@ config COMEDI_NI_AT_A2150 config COMEDI_NI_AT_AO tristate "NI AT-AO-6/10 EISA card support" - depends on COMEDI_NI_COMMON ---help--- Enable support for National Instruments AT-AO-6/10 cards @@ -463,8 +461,9 @@ config COMEDI_NI_AT_AO config COMEDI_NI_ATMIO tristate "NI AT-MIO E series ISA-PNP card support" - depends on ISAPNP && COMEDI_NI_TIO && COMEDI_NI_COMMON + depends on ISAPNP select COMEDI_8255 + select COMEDI_NI_TIO ---help--- Enable support for National Instruments AT-MIO E series cards National Instruments AT-MIO-16E-1 (ni_atmio), @@ -476,7 +475,7 @@ config COMEDI_NI_ATMIO config COMEDI_NI_ATMIO16D tristate "NI AT-MIO16/AT-MIO16D series ISA-PNP card support" - depends on ISAPNP && COMEDI_NI_COMMON + depends on ISAPNP select COMEDI_8255 ---help--- Enable support for National Instruments AT-MIO16/AT-MIO16D cards. @@ -985,7 +984,7 @@ config COMEDI_ME_DAQ config COMEDI_NI_6527 tristate "NI 6527 support" - depends on COMEDI_MITE + select COMEDI_MITE ---help--- Enable support for the National Instruments 6527 PCI card @@ -994,7 +993,7 @@ config COMEDI_NI_6527 config COMEDI_NI_65XX tristate "NI 65xx static dio PCI card support" - depends on COMEDI_MITE + select COMEDI_MITE ---help--- Enable support for National Instruments 65xx static dio boards. Supported devices: National Instruments PCI-6509 (ni_65xx), @@ -1007,7 +1006,7 @@ config COMEDI_NI_65XX config COMEDI_NI_660X tristate "NI 660x counter/timer PCI card support" - depends on COMEDI_NI_TIOCMD && COMEDI_NI_COMMON + select COMEDI_NI_TIOCMD ---help--- Enable support for National Instruments PCI-6601 (ni_660x), PCI-6602, PXI-6602 and PXI-6608. @@ -1017,7 +1016,7 @@ config COMEDI_NI_660X config COMEDI_NI_670X tristate "NI 670x PCI card support" - depends on COMEDI_MITE + select COMEDI_MITE ---help--- Enable support for National Instruments PCI-6703 and PCI-6704 @@ -1026,7 +1025,7 @@ config COMEDI_NI_670X config COMEDI_NI_LABPC tristate "NI Lab-PC and compatibles ISA and PCI support" - depends on COMEDI_MITE + select COMEDI_MITE select COMEDI_8255 select COMEDI_FC depends on VIRT_TO_BUS @@ -1041,7 +1040,7 @@ config COMEDI_NI_LABPC config COMEDI_NI_PCIDIO tristate "NI PCI-DIO32HS, PCI-DIO96, PCI-6533, PCI-6503 support" - depends on COMEDI_MITE + select COMEDI_MITE select COMEDI_8255 ---help--- Enable support for National Instruments PCI-DIO-32HS, PXI-6533, @@ -1055,7 +1054,7 @@ config COMEDI_NI_PCIDIO config COMEDI_NI_PCIMIO tristate "NI PCI-MIO-E series and M series support" - depends on COMEDI_NI_TIOCMD && COMEDI_NI_COMMON + select COMEDI_NI_TIOCMD select COMEDI_8255 select COMEDI_FC ---help--- @@ -1141,7 +1140,6 @@ config COMEDI_DAS08_CS config COMEDI_NI_DAQ_700_CS tristate "NI DAQCard-700 PCMCIA support" - depends on COMEDI_NI_COMMON ---help--- Enable support for the National Instruments PCMCIA DAQCard-700 DIO @@ -1150,7 +1148,6 @@ config COMEDI_NI_DAQ_700_CS config COMEDI_NI_DAQ_DIO24_CS tristate "NI DAQ-Card DIO-24 PCMCIA support" - depends on COMEDI_NI_COMMON select COMEDI_8255 ---help--- Enable support for the National Instruments PCMCIA DAQ-Card DIO-24 @@ -1169,7 +1166,7 @@ config COMEDI_NI_LABPC_CS config COMEDI_NI_MIO_CS tristate "NI DAQCard E series PCMCIA support" - depends on COMEDI_NI_TIO && COMEDI_NI_COMMON + select COMEDI_NI_TIO select COMEDI_8255 select COMEDI_FC ---help--- @@ -1248,51 +1245,17 @@ config COMEDI_VMK80XX endif # COMEDI_USB_DRIVERS -menuconfig COMEDI_NI_COMMON - tristate "Comedi National Instruments card support" - ---help--- - Enable comedi support for National Instruments cards. - Modules in this section are used by many comedi NI drivers. - - Note that the answer to this question won't directly affect the - kernel: saying N will just cause the configurator to skip all - the questions about National Instruments cards. - -if COMEDI_NI_COMMON - config COMEDI_MITE - tristate "NI Mite PCI interface chip support" + tristate depends on PCI - ---help--- - Enable support for National Instruments Mite PCI interface chip - - To compile this driver as a module, choose M here: the module will be - called mite. config COMEDI_NI_TIO - tristate "NI general purpose counter support" - ---help--- - Enable support for National Instruments general purpose counters. - This module is not used directly by end-users. Rather, it - is used by other drivers (for example ni_660x and ni_pcimio) - to provide support for NI's general purpose counters. - - To compile this driver as a module, choose M here: the module will - be called ni_tio. + tristate config COMEDI_NI_TIOCMD - tristate "NI streaming acquisition for general purpose counters" - depends on COMEDI_NI_TIO && COMEDI_MITE - ---help--- - Enable streaming acquisition command support for National Instruments - general purpose counters. This module is not used directly by - end-users. It is used by some NI PCI card drivers (ni_660x and - ni_pcimio). - - To compile this driver as a module, choose M here: the module will - be called ni_tiocmd. - -endif # COMEDI_NI_COMMON + tristate + select COMEDI_NI_TIO + select COMEDI_MITE config COMEDI_8255 tristate "Generic 8255 support" -- cgit v0.10.2 From a77198816e193a88b9c10ce13f0d2e172df0c6b5 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Mon, 25 Jun 2012 19:49:38 +0100 Subject: staging: comedi: Move COMEDI_MITE and COMEDI_NI_TIOCMD Move the CONFIG_COMEDI_MITE config options into the `if COMEDI_PCI_DRIVERS` block so that the `depends on PCI` condition can be omitted. Move the CONFIG_COMEDI_NI_TIOCMD config option to the same block as it selects COMEDI_MITE. Move the CONFIG_COEMDI_NI_TIO config option slightly for aesthetic reasons without changing its conditions. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 9ff3f4d..6cee785 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -1105,6 +1105,14 @@ config COMEDI_SSV_DNP To compile this driver as a module, choose M here: the module will be called ssv_dnp. +config COMEDI_MITE + tristate + +config COMEDI_NI_TIOCMD + tristate + select COMEDI_NI_TIO + select COMEDI_MITE + endif # COMEDI_PCI_DRIVERS menuconfig COMEDI_PCMCIA_DRIVERS @@ -1245,18 +1253,6 @@ config COMEDI_VMK80XX endif # COMEDI_USB_DRIVERS -config COMEDI_MITE - tristate - depends on PCI - -config COMEDI_NI_TIO - tristate - -config COMEDI_NI_TIOCMD - tristate - select COMEDI_NI_TIO - select COMEDI_MITE - config COMEDI_8255 tristate "Generic 8255 support" ---help--- @@ -1290,4 +1286,7 @@ config COMEDI_DAS08 tristate select COMEDI_8255 +config COMEDI_NI_TIO + tristate + endif # COMEDI -- cgit v0.10.2 From 726dd505511d7be7234f3a2135b82b37d9026992 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 15:15:58 -0700 Subject: staging: comedi: cb_das16_cs: remove CONFIG_PCMCIA check The Kconfig ensures that this driver can only be build it PCMCIA is enabled. Remove the unneeded '#if defined (CONFIG_PCMCIA) ,,,' and the '#else' code. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 6866e25..1fd4460 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -629,8 +629,6 @@ static int das16cs_timer_insn_config(struct comedi_device *dev, ======================================================================*/ -#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) - static void das16cs_pcmcia_config(struct pcmcia_device *link); static void das16cs_pcmcia_release(struct pcmcia_device *link); static int das16cs_pcmcia_suspend(struct pcmcia_device *p_dev); @@ -813,18 +811,3 @@ void __exit cleanup_module(void) exit_das16cs_pcmcia_cs(); comedi_driver_unregister(&driver_das16cs); } - -#else -static int __init driver_das16cs_init_module(void) -{ - return comedi_driver_register(&driver_das16cs); -} - -static void __exit driver_das16cs_cleanup_module(void) -{ - comedi_driver_unregister(&driver_das16cs); -} - -module_init(driver_das16cs_init_module); -module_exit(driver_das16cs_cleanup_module); -#endif /* CONFIG_PCMCIA */ -- cgit v0.10.2 From 16920671cd157c8ab2e431b4c612888d3085220e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 15:17:20 -0700 Subject: staging: comedi: cb_das16_cs: move the MODULE_* stuff to the EOF Move the MODULE_* declarations to the end of the file. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 1fd4460..76833d0 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -769,9 +769,6 @@ static const struct pcmcia_device_id das16cs_id_table[] = { }; MODULE_DEVICE_TABLE(pcmcia, das16cs_id_table); -MODULE_AUTHOR("David A. Schleef "); -MODULE_DESCRIPTION("Comedi driver for Computer Boards PC-CARD DAS16/16"); -MODULE_LICENSE("GPL"); struct pcmcia_driver das16cs_driver = { .probe = das16cs_pcmcia_attach, @@ -811,3 +808,7 @@ void __exit cleanup_module(void) exit_das16cs_pcmcia_cs(); comedi_driver_unregister(&driver_das16cs); } + +MODULE_AUTHOR("David A. Schleef "); +MODULE_DESCRIPTION("Comedi driver for Computer Boards PC-CARD DAS16/16"); +MODULE_LICENSE("GPL"); -- cgit v0.10.2 From 3bbb82c4b4150d4eb88bf3123bfb9ec51700730f Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 15:18:17 -0700 Subject: staging: comedi: cb_das16_cs: add module_{init, exit} declarations The init and exit functions for this module were being declared as global symbols. Add the module_{init,exit} declarations and make the functions static. Also, rename the functions so they have namespace associated with the module. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 76833d0..bca4cbe 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -792,7 +792,7 @@ static void __exit exit_das16cs_pcmcia_cs(void) pcmcia_unregister_driver(&das16cs_driver); } -int __init init_module(void) +static int __init das16cs_init(void) { int ret; @@ -802,12 +802,14 @@ int __init init_module(void) return comedi_driver_register(&driver_das16cs); } +module_init(das16cs_init); -void __exit cleanup_module(void) +static void __exit das16cs_exit(void) { exit_das16cs_pcmcia_cs(); comedi_driver_unregister(&driver_das16cs); } +module_exit(das16cs_exit); MODULE_AUTHOR("David A. Schleef "); MODULE_DESCRIPTION("Comedi driver for Computer Boards PC-CARD DAS16/16"); -- cgit v0.10.2 From 6f47503dcca489144384e09a6fa0848b46434fd0 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 15:20:13 -0700 Subject: staging: comedi: cb_das16_cs: consolidate the init and exit functions The register/unregister of the pcmcia driver is done is separate functions that are called by the module_{init,exit} routines. Simplify the code a bit by moving the register/unregister into the module_{init,exit} routines. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index bca4cbe..624e005 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -780,23 +780,11 @@ struct pcmcia_driver das16cs_driver = { .name = "cb_das16_cs", }; -static int __init init_das16cs_pcmcia_cs(void) -{ - pcmcia_register_driver(&das16cs_driver); - return 0; -} - -static void __exit exit_das16cs_pcmcia_cs(void) -{ - pr_debug("das16cs_pcmcia_cs: unloading\n"); - pcmcia_unregister_driver(&das16cs_driver); -} - static int __init das16cs_init(void) { int ret; - ret = init_das16cs_pcmcia_cs(); + ret = pcmcia_register_driver(&das16cs_driver); if (ret < 0) return ret; @@ -806,7 +794,7 @@ module_init(das16cs_init); static void __exit das16cs_exit(void) { - exit_das16cs_pcmcia_cs(); + pcmcia_unregister_driver(&das16cs_driver); comedi_driver_unregister(&driver_das16cs); } module_exit(das16cs_exit); -- cgit v0.10.2 From 64c205f99790798fdcf42ea5093df1393a867e30 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 15:20:53 -0700 Subject: staging: comedi: cb_das13_cs: change driver registration order As done with the other comedi driver types, register the comedi_driver first then the pcmcia_driver. Also, make sure the pcmcia_driver registration succeeds and unregister the comedi_driver it it fails. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 624e005..625134f 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -784,11 +784,17 @@ static int __init das16cs_init(void) { int ret; - ret = pcmcia_register_driver(&das16cs_driver); + ret = comedi_driver_register(&driver_das16cs); if (ret < 0) return ret; - return comedi_driver_register(&driver_das16cs); + ret = pcmcia_register_driver(&das16cs_driver); + if (ret < 0) { + comedi_driver_unregister(&driver_das16cs); + return ret; + } + + return 0; } module_init(das16cs_init); -- cgit v0.10.2 From e8bed9c6f46893c7d1fc43539058346fd4fbbaf1 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 15:57:49 -0700 Subject: staging: comedi: cb_das16_cs: cleanup the pcmcia_driver declaration For aesthetic reasons, add some whitespace to the declaration of the pcmcia_driver and reorder it a bit. Also, the symbol 'das16cs_driver' is only referenced in this file, make it static. This quiets the following sparse warning: warning: symbol 'das16cs_driver' was not declared. Should it be static? Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 625134f..2ac30f4 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -770,14 +770,14 @@ static const struct pcmcia_device_id das16cs_id_table[] = { MODULE_DEVICE_TABLE(pcmcia, das16cs_id_table); -struct pcmcia_driver das16cs_driver = { - .probe = das16cs_pcmcia_attach, - .remove = das16cs_pcmcia_detach, - .suspend = das16cs_pcmcia_suspend, - .resume = das16cs_pcmcia_resume, - .id_table = das16cs_id_table, - .owner = THIS_MODULE, - .name = "cb_das16_cs", +static struct pcmcia_driver das16cs_driver = { + .name = "cb_das16_cs", + .owner = THIS_MODULE, + .probe = das16cs_pcmcia_attach, + .remove = das16cs_pcmcia_detach, + .suspend = das16cs_pcmcia_suspend, + .resume = das16cs_pcmcia_resume, + .id_table = das16cs_id_table, }; static int __init das16cs_init(void) -- cgit v0.10.2 From 1b19f53e377a3e28ff3eaa2b041acbc74923189e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 16:10:37 -0700 Subject: staging: comedi: cb_das16_cs: remove some useless comments Remove some useless comments and whitespace. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 2ac30f4..2063215 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -19,6 +19,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + PCMCIA support code for the is adapted from the dummy_cs.c driver + of the Linux PCMCIA Card Services package. + + The initial developer of the original code is David A. Hinds + . Portions created by David A. Hinds + are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + */ /* Driver: cb_das16_cs @@ -616,58 +623,20 @@ static int das16cs_timer_insn_config(struct comedi_device *dev, return -EINVAL; } -/* PCMCIA stuff */ - -/*====================================================================== - - The following pcmcia code for the pcm-das08 is adapted from the - dummy_cs.c driver of the Linux PCMCIA Card Services package. - - The initial developer of the original code is David A. Hinds - . Portions created by David A. Hinds - are Copyright (C) 1999 David A. Hinds. All Rights Reserved. - -======================================================================*/ - static void das16cs_pcmcia_config(struct pcmcia_device *link); static void das16cs_pcmcia_release(struct pcmcia_device *link); static int das16cs_pcmcia_suspend(struct pcmcia_device *p_dev); static int das16cs_pcmcia_resume(struct pcmcia_device *p_dev); -/* - The attach() and detach() entry points are used to create and destroy - "instances" of the driver, where each instance represents everything - needed to manage one actual PCMCIA card. -*/ - static int das16cs_pcmcia_attach(struct pcmcia_device *); static void das16cs_pcmcia_detach(struct pcmcia_device *); -/* - You'll also need to prototype all the functions that will actually - be used to talk to your device. See 'memory_cs' for a good example - of a fully self-sufficient driver; the other drivers rely more or - less on other parts of the kernel. -*/ - struct local_info_t { struct pcmcia_device *link; int stop; struct bus_operations *bus; }; -/*====================================================================== - - das16cs_pcmcia_attach() creates an "instance" of the driver, allocating - local data structures for one device. The device is registered - with Card Services. - - The dev_link structure is initialized, but we don't actually - configure the card at this point -- we wait until we receive a - card insertion event. - -======================================================================*/ - static int das16cs_pcmcia_attach(struct pcmcia_device *link) { struct local_info_t *local; @@ -686,7 +655,7 @@ static int das16cs_pcmcia_attach(struct pcmcia_device *link) das16cs_pcmcia_config(link); return 0; -} /* das16cs_pcmcia_attach */ +} static void das16cs_pcmcia_detach(struct pcmcia_device *link) { @@ -696,8 +665,7 @@ static void das16cs_pcmcia_detach(struct pcmcia_device *link) das16cs_pcmcia_release(link); /* This points to the parent struct local_info_t struct */ kfree(link->priv); -} /* das16cs_pcmcia_detach */ - +} static int das16cs_pcmcia_config_loop(struct pcmcia_device *p_dev, void *priv_data) @@ -734,13 +702,13 @@ static void das16cs_pcmcia_config(struct pcmcia_device *link) failed: das16cs_pcmcia_release(link); -} /* das16cs_pcmcia_config */ +} static void das16cs_pcmcia_release(struct pcmcia_device *link) { dev_dbg(&link->dev, "das16cs_pcmcia_release\n"); pcmcia_disable_device(link); -} /* das16cs_pcmcia_release */ +} static int das16cs_pcmcia_suspend(struct pcmcia_device *link) { @@ -750,7 +718,7 @@ static int das16cs_pcmcia_suspend(struct pcmcia_device *link) local->stop = 1; return 0; -} /* das16cs_pcmcia_suspend */ +} static int das16cs_pcmcia_resume(struct pcmcia_device *link) { @@ -758,16 +726,13 @@ static int das16cs_pcmcia_resume(struct pcmcia_device *link) local->stop = 0; return 0; -} /* das16cs_pcmcia_resume */ - -/*====================================================================*/ +} static const struct pcmcia_device_id das16cs_id_table[] = { PCMCIA_DEVICE_MANF_CARD(0x01c5, 0x0039), PCMCIA_DEVICE_MANF_CARD(0x01c5, 0x4009), PCMCIA_DEVICE_NULL }; - MODULE_DEVICE_TABLE(pcmcia, das16cs_id_table); static struct pcmcia_driver das16cs_driver = { -- cgit v0.10.2 From f19d8578fd4c1ed23e951d26f5f56392aaf202a1 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 16:15:40 -0700 Subject: staging: comedi: cb_das16_cs: refactor the pcmcia support code Refactor the pcmcia support code to remove the need for the forward declarations. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 2063215..dc9c823 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -623,48 +623,16 @@ static int das16cs_timer_insn_config(struct comedi_device *dev, return -EINVAL; } -static void das16cs_pcmcia_config(struct pcmcia_device *link); -static void das16cs_pcmcia_release(struct pcmcia_device *link); -static int das16cs_pcmcia_suspend(struct pcmcia_device *p_dev); -static int das16cs_pcmcia_resume(struct pcmcia_device *p_dev); - -static int das16cs_pcmcia_attach(struct pcmcia_device *); -static void das16cs_pcmcia_detach(struct pcmcia_device *); - struct local_info_t { struct pcmcia_device *link; int stop; struct bus_operations *bus; }; -static int das16cs_pcmcia_attach(struct pcmcia_device *link) -{ - struct local_info_t *local; - - dev_dbg(&link->dev, "das16cs_pcmcia_attach()\n"); - - /* Allocate space for private device-specific data */ - local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); - if (!local) - return -ENOMEM; - local->link = link; - link->priv = local; - - cur_dev = link; - - das16cs_pcmcia_config(link); - - return 0; -} - -static void das16cs_pcmcia_detach(struct pcmcia_device *link) +static void das16cs_pcmcia_release(struct pcmcia_device *link) { - dev_dbg(&link->dev, "das16cs_pcmcia_detach\n"); - - ((struct local_info_t *)link->priv)->stop = 1; - das16cs_pcmcia_release(link); - /* This points to the parent struct local_info_t struct */ - kfree(link->priv); + dev_dbg(&link->dev, "das16cs_pcmcia_release\n"); + pcmcia_disable_device(link); } static int das16cs_pcmcia_config_loop(struct pcmcia_device *p_dev, @@ -704,10 +672,34 @@ failed: das16cs_pcmcia_release(link); } -static void das16cs_pcmcia_release(struct pcmcia_device *link) +static int das16cs_pcmcia_attach(struct pcmcia_device *link) { - dev_dbg(&link->dev, "das16cs_pcmcia_release\n"); - pcmcia_disable_device(link); + struct local_info_t *local; + + dev_dbg(&link->dev, "das16cs_pcmcia_attach()\n"); + + /* Allocate space for private device-specific data */ + local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); + if (!local) + return -ENOMEM; + local->link = link; + link->priv = local; + + cur_dev = link; + + das16cs_pcmcia_config(link); + + return 0; +} + +static void das16cs_pcmcia_detach(struct pcmcia_device *link) +{ + dev_dbg(&link->dev, "das16cs_pcmcia_detach\n"); + + ((struct local_info_t *)link->priv)->stop = 1; + das16cs_pcmcia_release(link); + /* This points to the parent struct local_info_t struct */ + kfree(link->priv); } static int das16cs_pcmcia_suspend(struct pcmcia_device *link) -- cgit v0.10.2 From c2107ff46d58a9db6d8cadcbe18fa631fb4f7cd9 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 16:19:32 -0700 Subject: staging: comedi: cb_das16_cs: refactor the pcmcia attach/detach Move the pcmcia_disable_device() call where needed in the pcmcia attach/detach and delete the das16cs_pcmcia_release() function. Move the logic of das16cs_pcmcia_config() directly into the attach function and properly return an error code when the config fails. Only set the cur_dev, used by the comedi_driver, if the pcmcia attach is successful. Also, make sure to NULL it in the detach. Remove all the kernel messages in the pcmcia support code. They are just added noise. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index dc9c823..5171cfe 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -629,12 +629,6 @@ struct local_info_t { struct bus_operations *bus; }; -static void das16cs_pcmcia_release(struct pcmcia_device *link) -{ - dev_dbg(&link->dev, "das16cs_pcmcia_release\n"); - pcmcia_disable_device(link); -} - static int das16cs_pcmcia_config_loop(struct pcmcia_device *p_dev, void *priv_data) { @@ -644,20 +638,24 @@ static int das16cs_pcmcia_config_loop(struct pcmcia_device *p_dev, return pcmcia_request_io(p_dev); } -static void das16cs_pcmcia_config(struct pcmcia_device *link) +static int das16cs_pcmcia_attach(struct pcmcia_device *link) { + struct local_info_t *local; int ret; - dev_dbg(&link->dev, "das16cs_pcmcia_config\n"); + /* Allocate space for private device-specific data */ + local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); + if (!local) + return -ENOMEM; + local->link = link; + link->priv = local; /* Do we need to allocate an interrupt? */ link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; ret = pcmcia_loop_config(link, das16cs_pcmcia_config_loop, NULL); - if (ret) { - dev_warn(&link->dev, "no configuration found\n"); + if (ret) goto failed; - } if (!link->irq) goto failed; @@ -666,40 +664,21 @@ static void das16cs_pcmcia_config(struct pcmcia_device *link) if (ret) goto failed; - return; - -failed: - das16cs_pcmcia_release(link); -} - -static int das16cs_pcmcia_attach(struct pcmcia_device *link) -{ - struct local_info_t *local; - - dev_dbg(&link->dev, "das16cs_pcmcia_attach()\n"); - - /* Allocate space for private device-specific data */ - local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); - if (!local) - return -ENOMEM; - local->link = link; - link->priv = local; - cur_dev = link; - - das16cs_pcmcia_config(link); - return 0; + +failed: + pcmcia_disable_device(link); + return ret; } static void das16cs_pcmcia_detach(struct pcmcia_device *link) { - dev_dbg(&link->dev, "das16cs_pcmcia_detach\n"); - ((struct local_info_t *)link->priv)->stop = 1; - das16cs_pcmcia_release(link); + pcmcia_disable_device(link); /* This points to the parent struct local_info_t struct */ kfree(link->priv); + cur_dev = NULL; } static int das16cs_pcmcia_suspend(struct pcmcia_device *link) -- cgit v0.10.2 From c8b2ae2b98bad7870ec6be24e517bacffd76ea8e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 16:20:36 -0700 Subject: staging: comedi: cb_das16_cs: remove unused pcmcia 'stop' logic The pcmcia support code in this driver appears to be cut-and- paste from some other driver. It has code in it to stop the device during suspend but nothing in the main comedi_driver uses it. Remove the 'stop' variable from the pcmcia private data and all the logic that deals with it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 5171cfe..151a559 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -625,7 +625,6 @@ static int das16cs_timer_insn_config(struct comedi_device *dev, struct local_info_t { struct pcmcia_device *link; - int stop; struct bus_operations *bus; }; @@ -674,7 +673,6 @@ failed: static void das16cs_pcmcia_detach(struct pcmcia_device *link) { - ((struct local_info_t *)link->priv)->stop = 1; pcmcia_disable_device(link); /* This points to the parent struct local_info_t struct */ kfree(link->priv); @@ -683,19 +681,11 @@ static void das16cs_pcmcia_detach(struct pcmcia_device *link) static int das16cs_pcmcia_suspend(struct pcmcia_device *link) { - struct local_info_t *local = link->priv; - - /* Mark the device as stopped, to block IO until later */ - local->stop = 1; - return 0; } static int das16cs_pcmcia_resume(struct pcmcia_device *link) { - struct local_info_t *local = link->priv; - - local->stop = 0; return 0; } -- cgit v0.10.2 From 2b5f548082d8b6442a4a76ff92276c4606441ada Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 16:21:47 -0700 Subject: staging: comedi: cb_das16_cs: remove the pcmcia suspend/resume The pcmcia suspend/resume callbacks don't do anything. Remove them. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 151a559..df9b075 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -679,16 +679,6 @@ static void das16cs_pcmcia_detach(struct pcmcia_device *link) cur_dev = NULL; } -static int das16cs_pcmcia_suspend(struct pcmcia_device *link) -{ - return 0; -} - -static int das16cs_pcmcia_resume(struct pcmcia_device *link) -{ - return 0; -} - static const struct pcmcia_device_id das16cs_id_table[] = { PCMCIA_DEVICE_MANF_CARD(0x01c5, 0x0039), PCMCIA_DEVICE_MANF_CARD(0x01c5, 0x4009), @@ -701,8 +691,6 @@ static struct pcmcia_driver das16cs_driver = { .owner = THIS_MODULE, .probe = das16cs_pcmcia_attach, .remove = das16cs_pcmcia_detach, - .suspend = das16cs_pcmcia_suspend, - .resume = das16cs_pcmcia_resume, .id_table = das16cs_id_table, }; -- cgit v0.10.2 From bc314fb53f1557716bdb2bdae8bf6b898b0f8ab9 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 16:22:52 -0700 Subject: staging: comedi: cb_das16_cs: remove unneeded pcmcia private data The pcmcia device-specific data is not longer needed by this driver. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index df9b075..8661e13 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -623,11 +623,6 @@ static int das16cs_timer_insn_config(struct comedi_device *dev, return -EINVAL; } -struct local_info_t { - struct pcmcia_device *link; - struct bus_operations *bus; -}; - static int das16cs_pcmcia_config_loop(struct pcmcia_device *p_dev, void *priv_data) { @@ -639,16 +634,8 @@ static int das16cs_pcmcia_config_loop(struct pcmcia_device *p_dev, static int das16cs_pcmcia_attach(struct pcmcia_device *link) { - struct local_info_t *local; int ret; - /* Allocate space for private device-specific data */ - local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); - if (!local) - return -ENOMEM; - local->link = link; - link->priv = local; - /* Do we need to allocate an interrupt? */ link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; @@ -674,8 +661,6 @@ failed: static void das16cs_pcmcia_detach(struct pcmcia_device *link) { pcmcia_disable_device(link); - /* This points to the parent struct local_info_t struct */ - kfree(link->priv); cur_dev = NULL; } -- cgit v0.10.2 From 2f01826783c95d7056304408c0046198d25e71b6 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 16:23:38 -0700 Subject: staging: comedi: cb_das16_cs: Move the comedi_driver variable Move the comedi_driver variable to remove the need for the forward declarations. Add some whitespace to the declaration for aesthetic reasons. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 8661e13..92c774d 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -96,16 +96,6 @@ struct das16cs_private { }; #define devpriv ((struct das16cs_private *)dev->private) -static int das16cs_attach(struct comedi_device *dev, - struct comedi_devconfig *it); -static void das16cs_detach(struct comedi_device *dev); -static struct comedi_driver driver_das16cs = { - .driver_name = "cb_das16_cs", - .module = THIS_MODULE, - .attach = das16cs_attach, - .detach = das16cs_detach, -}; - static struct pcmcia_device *cur_dev; static const struct comedi_lrange das16cs_ai_range = { 4, { @@ -623,6 +613,13 @@ static int das16cs_timer_insn_config(struct comedi_device *dev, return -EINVAL; } +static struct comedi_driver driver_das16cs = { + .driver_name = "cb_das16_cs", + .module = THIS_MODULE, + .attach = das16cs_attach, + .detach = das16cs_detach, +}; + static int das16cs_pcmcia_config_loop(struct pcmcia_device *p_dev, void *priv_data) { -- cgit v0.10.2 From ae7df43422cc0afdd5a808638dd7935ad752c62e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 16:36:20 -0700 Subject: staging: comedi: cb_das16_cs: refactor the comedi attach/detach Move the comedi_driver attach/detach functions, as well as the probe function used during the attach. This removes the need for all the forward declarations. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 92c774d..e0821b9b 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -106,159 +106,6 @@ static const struct comedi_lrange das16cs_ai_range = { 4, { } }; -static irqreturn_t das16cs_interrupt(int irq, void *d); -static int das16cs_ai_rinsn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int das16cs_ai_cmd(struct comedi_device *dev, - struct comedi_subdevice *s); -static int das16cs_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_cmd *cmd); -static int das16cs_ao_winsn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int das16cs_ao_rinsn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int das16cs_dio_insn_bits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int das16cs_dio_insn_config(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data); -static int das16cs_timer_insn_read(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data); -static int das16cs_timer_insn_config(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data); - -static const struct das16cs_board *das16cs_probe(struct comedi_device *dev, - struct pcmcia_device *link) -{ - int i; - - for (i = 0; i < n_boards; i++) { - if (das16cs_boards[i].device_id == link->card_id) - return das16cs_boards + i; - } - - dev_dbg(dev->class_dev, "unknown board!\n"); - - return NULL; -} - -static int das16cs_attach(struct comedi_device *dev, - struct comedi_devconfig *it) -{ - struct pcmcia_device *link; - struct comedi_subdevice *s; - int ret; - int i; - - dev_dbg(dev->class_dev, "cb_das16_cs: attach\n"); - - link = cur_dev; /* XXX hack */ - if (!link) - return -EIO; - - dev->iobase = link->resource[0]->start; - dev_dbg(dev->class_dev, "I/O base=0x%04lx\n", dev->iobase); - - dev_dbg(dev->class_dev, "fingerprint:\n"); - for (i = 0; i < 48; i += 2) - dev_dbg(dev->class_dev, "%04x\n", inw(dev->iobase + i)); - - - ret = request_irq(link->irq, das16cs_interrupt, - IRQF_SHARED, "cb_das16_cs", dev); - if (ret < 0) - return ret; - - dev->irq = link->irq; - - dev_dbg(dev->class_dev, "irq=%u\n", dev->irq); - - dev->board_ptr = das16cs_probe(dev, link); - if (!dev->board_ptr) - return -EIO; - - dev->board_name = thisboard->name; - - if (alloc_private(dev, sizeof(struct das16cs_private)) < 0) - return -ENOMEM; - - ret = comedi_alloc_subdevices(dev, 4); - if (ret) - return ret; - - s = dev->subdevices + 0; - dev->read_subdev = s; - /* analog input subdevice */ - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF | SDF_CMD_READ; - s->n_chan = 16; - s->maxdata = 0xffff; - s->range_table = &das16cs_ai_range; - s->len_chanlist = 16; - s->insn_read = das16cs_ai_rinsn; - s->do_cmd = das16cs_ai_cmd; - s->do_cmdtest = das16cs_ai_cmdtest; - - s = dev->subdevices + 1; - /* analog output subdevice */ - if (thisboard->n_ao_chans) { - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = thisboard->n_ao_chans; - s->maxdata = 0xffff; - s->range_table = &range_bipolar10; - s->insn_write = &das16cs_ao_winsn; - s->insn_read = &das16cs_ao_rinsn; - } - - s = dev->subdevices + 2; - /* digital i/o subdevice */ - if (1) { - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = das16cs_dio_insn_bits; - s->insn_config = das16cs_dio_insn_config; - } else { - s->type = COMEDI_SUBD_UNUSED; - } - - s = dev->subdevices + 3; - /* timer subdevice */ - if (0) { - s->type = COMEDI_SUBD_TIMER; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 1; - s->maxdata = 0xff; - s->range_table = &range_unknown; - s->insn_read = das16cs_timer_insn_read; - s->insn_config = das16cs_timer_insn_config; - } else { - s->type = COMEDI_SUBD_UNUSED; - } - - - return 1; -} - -static void das16cs_detach(struct comedi_device *dev) -{ - if (dev->irq) - free_irq(dev->irq, dev); -} - static irqreturn_t das16cs_interrupt(int irq, void *d) { /* struct comedi_device *dev = d; */ @@ -613,6 +460,128 @@ static int das16cs_timer_insn_config(struct comedi_device *dev, return -EINVAL; } +static const struct das16cs_board *das16cs_probe(struct comedi_device *dev, + struct pcmcia_device *link) +{ + int i; + + for (i = 0; i < n_boards; i++) { + if (das16cs_boards[i].device_id == link->card_id) + return das16cs_boards + i; + } + + dev_dbg(dev->class_dev, "unknown board!\n"); + + return NULL; +} + +static int das16cs_attach(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + struct pcmcia_device *link; + struct comedi_subdevice *s; + int ret; + int i; + + dev_dbg(dev->class_dev, "cb_das16_cs: attach\n"); + + link = cur_dev; /* XXX hack */ + if (!link) + return -EIO; + + dev->iobase = link->resource[0]->start; + dev_dbg(dev->class_dev, "I/O base=0x%04lx\n", dev->iobase); + + dev_dbg(dev->class_dev, "fingerprint:\n"); + for (i = 0; i < 48; i += 2) + dev_dbg(dev->class_dev, "%04x\n", inw(dev->iobase + i)); + + + ret = request_irq(link->irq, das16cs_interrupt, + IRQF_SHARED, "cb_das16_cs", dev); + if (ret < 0) + return ret; + + dev->irq = link->irq; + + dev_dbg(dev->class_dev, "irq=%u\n", dev->irq); + + dev->board_ptr = das16cs_probe(dev, link); + if (!dev->board_ptr) + return -EIO; + + dev->board_name = thisboard->name; + + if (alloc_private(dev, sizeof(struct das16cs_private)) < 0) + return -ENOMEM; + + ret = comedi_alloc_subdevices(dev, 4); + if (ret) + return ret; + + s = dev->subdevices + 0; + dev->read_subdev = s; + /* analog input subdevice */ + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF | SDF_CMD_READ; + s->n_chan = 16; + s->maxdata = 0xffff; + s->range_table = &das16cs_ai_range; + s->len_chanlist = 16; + s->insn_read = das16cs_ai_rinsn; + s->do_cmd = das16cs_ai_cmd; + s->do_cmdtest = das16cs_ai_cmdtest; + + s = dev->subdevices + 1; + /* analog output subdevice */ + if (thisboard->n_ao_chans) { + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = thisboard->n_ao_chans; + s->maxdata = 0xffff; + s->range_table = &range_bipolar10; + s->insn_write = &das16cs_ao_winsn; + s->insn_read = &das16cs_ao_rinsn; + } + + s = dev->subdevices + 2; + /* digital i/o subdevice */ + if (1) { + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = das16cs_dio_insn_bits; + s->insn_config = das16cs_dio_insn_config; + } else { + s->type = COMEDI_SUBD_UNUSED; + } + + s = dev->subdevices + 3; + /* timer subdevice */ + if (0) { + s->type = COMEDI_SUBD_TIMER; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 1; + s->maxdata = 0xff; + s->range_table = &range_unknown; + s->insn_read = das16cs_timer_insn_read; + s->insn_config = das16cs_timer_insn_config; + } else { + s->type = COMEDI_SUBD_UNUSED; + } + + + return 1; +} + +static void das16cs_detach(struct comedi_device *dev) +{ + if (dev->irq) + free_irq(dev->irq, dev); +} + static struct comedi_driver driver_das16cs = { .driver_name = "cb_das16_cs", .module = THIS_MODULE, -- cgit v0.10.2 From 16a8cdfc13526983f6c55e35c09bbe091ac11e96 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 16:37:10 -0700 Subject: staging: comedi: cb_das16_cs: remove thisboard and devpriv macros The 'thisboard' and 'devpriv' macros rely on a local variable having a specific name and yield pointers derived from that local variable. Replace the macro with local variables where used. Use the comedi_board() helper to get the 'thisboard' pointer. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index e0821b9b..496c331 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -85,7 +85,6 @@ static const struct das16cs_board das16cs_boards[] = { }; #define n_boards ARRAY_SIZE(das16cs_boards) -#define thisboard ((const struct das16cs_board *)dev->board_ptr) struct das16cs_private { struct pcmcia_device *link; @@ -94,7 +93,6 @@ struct das16cs_private { unsigned short status1; unsigned short status2; }; -#define devpriv ((struct das16cs_private *)dev->private) static struct pcmcia_device *cur_dev; @@ -120,6 +118,7 @@ static int das16cs_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct das16cs_private *devpriv = dev->private; int i; int to; int aref; @@ -328,6 +327,7 @@ static int das16cs_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct das16cs_private *devpriv = dev->private; int i; int chan = CR_CHAN(insn->chanspec); unsigned short status1; @@ -375,6 +375,7 @@ static int das16cs_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct das16cs_private *devpriv = dev->private; int i; int chan = CR_CHAN(insn->chanspec); @@ -411,6 +412,7 @@ static int das16cs_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct das16cs_private *devpriv = dev->private; int chan = CR_CHAN(insn->chanspec); int bits; @@ -478,6 +480,7 @@ static const struct das16cs_board *das16cs_probe(struct comedi_device *dev, static int das16cs_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct das16cs_board *thisboard; struct pcmcia_device *link; struct comedi_subdevice *s; int ret; @@ -509,6 +512,7 @@ static int das16cs_attach(struct comedi_device *dev, dev->board_ptr = das16cs_probe(dev, link); if (!dev->board_ptr) return -EIO; + thisboard = comedi_board(dev); dev->board_name = thisboard->name; -- cgit v0.10.2 From 1efc5d53b7c1355a3491061587153c8f89613aaa Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 16:57:36 -0700 Subject: staging: comedi: cb_das16_cs: remove n_boards define The 'n_boards' define is only used one place in the driver. Just put the ARRAY_SIZE() where used and remove the define. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 496c331..e1e3ff0 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -84,8 +84,6 @@ static const struct das16cs_board das16cs_boards[] = { }, }; -#define n_boards ARRAY_SIZE(das16cs_boards) - struct das16cs_private { struct pcmcia_device *link; @@ -467,7 +465,7 @@ static const struct das16cs_board *das16cs_probe(struct comedi_device *dev, { int i; - for (i = 0; i < n_boards; i++) { + for (i = 0; i < ARRAY_SIZE(das16cs_boards); i++) { if (das16cs_boards[i].device_id == link->card_id) return das16cs_boards + i; } -- cgit v0.10.2 From adb2d69b0c6b803d197c4f3fad80ffebaba2ec4d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 16:58:34 -0700 Subject: staging: comedi: cb_das16_cs: remove skel driver cut-and-paste comments There are a number of comments in this driver that are cut-and-paste from the skel driver. They are not needed in "real" drivers. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index e1e3ff0..36fd3e6 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -108,10 +108,6 @@ static irqreturn_t das16cs_interrupt(int irq, void *d) return IRQ_HANDLED; } -/* - * "instructions" read/write data in "one-shot" or "software-triggered" - * mode. - */ static int das16cs_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -168,13 +164,6 @@ static int das16cs_ai_cmdtest(struct comedi_device *dev, int err = 0; int tmp; - /* cmdtest tests a particular command to see if it is valid. - * Using the cmdtest ioctl, a user can create a valid cmd - * and then have it executes by the cmd ioctl. - * - * cmdtest returns 1,2,3,4 or 0, depending on which tests - * the command passes. */ - /* step 1: make sure trigger sources are trivially valid */ tmp = cmd->start_src; @@ -367,8 +356,6 @@ static int das16cs_ao_winsn(struct comedi_device *dev, return i; } -/* AO subdevices should have a read insn as well as a write insn. - * Usually this means copying a value stored in devpriv. */ static int das16cs_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -383,11 +370,6 @@ static int das16cs_ao_rinsn(struct comedi_device *dev, return i; } -/* DIO devices are slightly special. Although it is possible to - * implement the insn_read/insn_write interface, it is much more - * useful to applications if you implement the insn_bits interface. - * This allows packed reading/writing of the DIO channels. The - * comedi core can convert between insn_bits and insn_read/write */ static int das16cs_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -399,8 +381,6 @@ static int das16cs_dio_insn_bits(struct comedi_device *dev, outw(s->state, dev->iobase + 16); } - /* on return, data[1] contains the value of the digital - * input and output lines. */ data[1] = inw(dev->iobase + 16); return insn->n; -- cgit v0.10.2 From 5c416ef3f67e9f524ac3ab07c071323f66616373 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 16:59:26 -0700 Subject: staging: comedi: cb_das16_cs: remove unused timer subdevice The timer subdevice is never initialized due to the 'if (0)'. The comedi callbacks also don't do anything and just return -EINVAL. Remove the subdevice and associated code. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 36fd3e6..b0a2223 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -425,21 +425,6 @@ static int das16cs_dio_insn_config(struct comedi_device *dev, return insn->n; } -static int das16cs_timer_insn_read(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) -{ - return -EINVAL; -} - -static int das16cs_timer_insn_config(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) -{ - return -EINVAL; -} - static const struct das16cs_board *das16cs_probe(struct comedi_device *dev, struct pcmcia_device *link) { @@ -497,7 +482,7 @@ static int das16cs_attach(struct comedi_device *dev, if (alloc_private(dev, sizeof(struct das16cs_private)) < 0) return -ENOMEM; - ret = comedi_alloc_subdevices(dev, 4); + ret = comedi_alloc_subdevices(dev, 3); if (ret) return ret; @@ -540,21 +525,6 @@ static int das16cs_attach(struct comedi_device *dev, s->type = COMEDI_SUBD_UNUSED; } - s = dev->subdevices + 3; - /* timer subdevice */ - if (0) { - s->type = COMEDI_SUBD_TIMER; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 1; - s->maxdata = 0xff; - s->range_table = &range_unknown; - s->insn_read = das16cs_timer_insn_read; - s->insn_config = das16cs_timer_insn_config; - } else { - s->type = COMEDI_SUBD_UNUSED; - } - - return 1; } -- cgit v0.10.2 From f87a7e5bf50d83d9dca0e87d10eac7226e0ac61d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 17:00:19 -0700 Subject: staging: comedi: cb_das16_cs: cleanup dio subdevice initialization The digital i/o subdevice is always initialized due to the 'if (1)'. Simplify the attach by removing the test. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index b0a2223..f3d5ca0 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -513,17 +513,13 @@ static int das16cs_attach(struct comedi_device *dev, s = dev->subdevices + 2; /* digital i/o subdevice */ - if (1) { - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = das16cs_dio_insn_bits; - s->insn_config = das16cs_dio_insn_config; - } else { - s->type = COMEDI_SUBD_UNUSED; - } + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = das16cs_dio_insn_bits; + s->insn_config = das16cs_dio_insn_config; return 1; } -- cgit v0.10.2 From da7fde2bc902db1133f591b826124c9369857d38 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 17:10:30 -0700 Subject: staging: comedi: cb_das16_cs: fix analog output subdevice init The analog output subdevice is only available on the -AO version of the DAS16/16 device and the number of channels is provided in the boardinfo. Make sure the subdevice is marked as unused for devices that do not support the analog out. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index f3d5ca0..acee550 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -509,6 +509,8 @@ static int das16cs_attach(struct comedi_device *dev, s->range_table = &range_bipolar10; s->insn_write = &das16cs_ao_winsn; s->insn_read = &das16cs_ao_rinsn; + } else { + s->type = COMEDI_SUBD_UNUSED; } s = dev->subdevices + 2; -- cgit v0.10.2 From 8c50aa15329c6fc93e9de2780e3d8b5e4cb0dc16 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 17:11:13 -0700 Subject: staging: comedi: cb_das16_cs: remove unneeded include This driver is not for a pci device. Remove the unneeded include of the pci.h header. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index acee550..2d8ec68 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -42,7 +42,6 @@ Status: experimental #include #include "../comedidev.h" #include -#include #include #include -- cgit v0.10.2 From 9a4d21154796136b87f841746fbdceec37bf48ee Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 17:11:56 -0700 Subject: staging: comedi: cb_das16_cs: probe for the device first During the attach of the comedi_driver, the device type probe can fail. We should do the probe before requesting the irq for the driver. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 2d8ec68..20d77cf 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -454,6 +454,13 @@ static int das16cs_attach(struct comedi_device *dev, if (!link) return -EIO; + dev->board_ptr = das16cs_probe(dev, link); + if (!dev->board_ptr) + return -EIO; + thisboard = comedi_board(dev); + + dev->board_name = thisboard->name; + dev->iobase = link->resource[0]->start; dev_dbg(dev->class_dev, "I/O base=0x%04lx\n", dev->iobase); @@ -461,23 +468,14 @@ static int das16cs_attach(struct comedi_device *dev, for (i = 0; i < 48; i += 2) dev_dbg(dev->class_dev, "%04x\n", inw(dev->iobase + i)); - ret = request_irq(link->irq, das16cs_interrupt, IRQF_SHARED, "cb_das16_cs", dev); if (ret < 0) return ret; - dev->irq = link->irq; dev_dbg(dev->class_dev, "irq=%u\n", dev->irq); - dev->board_ptr = das16cs_probe(dev, link); - if (!dev->board_ptr) - return -EIO; - thisboard = comedi_board(dev); - - dev->board_name = thisboard->name; - if (alloc_private(dev, sizeof(struct das16cs_private)) < 0) return -ENOMEM; -- cgit v0.10.2 From 8b3bfe9b4491947cdaabd1f01065b49aab49881d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 17:12:41 -0700 Subject: staging: comedi: cb_das16_cs: remove the debug output of the "fingerprint" During the attach, all of the device i/o registers are read and the data is output as a dev_dbg() "fingerprint". This just adds a bunch of noise during the loading of the driver. Remove the output. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 20d77cf..2690228 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -446,7 +446,6 @@ static int das16cs_attach(struct comedi_device *dev, struct pcmcia_device *link; struct comedi_subdevice *s; int ret; - int i; dev_dbg(dev->class_dev, "cb_das16_cs: attach\n"); @@ -464,10 +463,6 @@ static int das16cs_attach(struct comedi_device *dev, dev->iobase = link->resource[0]->start; dev_dbg(dev->class_dev, "I/O base=0x%04lx\n", dev->iobase); - dev_dbg(dev->class_dev, "fingerprint:\n"); - for (i = 0; i < 48; i += 2) - dev_dbg(dev->class_dev, "%04x\n", inw(dev->iobase + i)); - ret = request_irq(link->irq, das16cs_interrupt, IRQF_SHARED, "cb_das16_cs", dev); if (ret < 0) -- cgit v0.10.2 From 13ab179c69769bb5be811b28fd6eeaeea2440359 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 17:13:23 -0700 Subject: staging: comedi: cb_das16_cs: cleanup the boardinfo For aesthetic reasons, reorder the boardinfo to match the MODULE_DEVICE_TABLE. Also reorder the data to match the struct definition and add some whitespace to improve readability. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 2690228..f90c12b 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -65,22 +65,21 @@ struct das16cs_board { int device_id; int n_ao_chans; }; + static const struct das16cs_board das16cs_boards[] = { { - .device_id = 0x0000, /* unknown */ - .name = "PC-CARD DAS16/16", - .n_ao_chans = 0, - }, - { - .device_id = 0x0039, - .name = "PC-CARD DAS16/16-AO", - .n_ao_chans = 2, - }, - { - .device_id = 0x4009, - .name = "PCM-DAS16s/16", - .n_ao_chans = 0, - }, + .name = "PC-CARD DAS16/16-AO", + .device_id = 0x0039, + .n_ao_chans = 2, + }, { + .name = "PCM-DAS16s/16", + .device_id = 0x4009, + .n_ao_chans = 0, + }, { + .name = "PC-CARD DAS16/16", + .device_id = 0x0000, /* unknown */ + .n_ao_chans = 0, + }, }; struct das16cs_private { -- cgit v0.10.2 From 1fce3034f63c22392d1d8bc22b5e80b575b00df6 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 17:15:21 -0700 Subject: staging: comedi: cb_das16_cs: consolidate the attach messages Consolidate all the attach messages into one dev_info() output at the end of the successful attach. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index f90c12b..155f742 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -446,8 +446,6 @@ static int das16cs_attach(struct comedi_device *dev, struct comedi_subdevice *s; int ret; - dev_dbg(dev->class_dev, "cb_das16_cs: attach\n"); - link = cur_dev; /* XXX hack */ if (!link) return -EIO; @@ -460,7 +458,6 @@ static int das16cs_attach(struct comedi_device *dev, dev->board_name = thisboard->name; dev->iobase = link->resource[0]->start; - dev_dbg(dev->class_dev, "I/O base=0x%04lx\n", dev->iobase); ret = request_irq(link->irq, das16cs_interrupt, IRQF_SHARED, "cb_das16_cs", dev); @@ -468,8 +465,6 @@ static int das16cs_attach(struct comedi_device *dev, return ret; dev->irq = link->irq; - dev_dbg(dev->class_dev, "irq=%u\n", dev->irq); - if (alloc_private(dev, sizeof(struct das16cs_private)) < 0) return -ENOMEM; @@ -514,6 +509,10 @@ static int das16cs_attach(struct comedi_device *dev, s->insn_bits = das16cs_dio_insn_bits; s->insn_config = das16cs_dio_insn_config; + dev_info(dev->class_dev, "%s: %s, I/O base=0x%04lx, irq=%u\n", + dev->driver->driver_name, dev->board_name, + dev->iobase, dev->irq); + return 1; } -- cgit v0.10.2 From a659643a6b504189e899e56901c760f89eb4bb13 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 17:16:04 -0700 Subject: staging: comedi: cb_das16_cs: return '0' for successful attach The comedi core expects a < 0 value during the attach to indicate an error. The normal 'success' return to the kernel is '0' so use that here. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 155f742..c92e232 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -513,7 +513,7 @@ static int das16cs_attach(struct comedi_device *dev, dev->driver->driver_name, dev->board_name, dev->iobase, dev->irq); - return 1; + return 0; } static void das16cs_detach(struct comedi_device *dev) -- cgit v0.10.2 From cf2592d06a4e37f98eba17d1abe32af7fe521d19 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 17:16:53 -0700 Subject: staging: comedi: cb_das16_cs: add whitespace to the subdev init Add some whitespace to the subdev initialization to improve readability. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index c92e232..11dc9b1 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -475,39 +475,39 @@ static int das16cs_attach(struct comedi_device *dev, s = dev->subdevices + 0; dev->read_subdev = s; /* analog input subdevice */ - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF | SDF_CMD_READ; - s->n_chan = 16; - s->maxdata = 0xffff; - s->range_table = &das16cs_ai_range; - s->len_chanlist = 16; - s->insn_read = das16cs_ai_rinsn; - s->do_cmd = das16cs_ai_cmd; - s->do_cmdtest = das16cs_ai_cmdtest; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF | SDF_CMD_READ; + s->n_chan = 16; + s->maxdata = 0xffff; + s->range_table = &das16cs_ai_range; + s->len_chanlist = 16; + s->insn_read = das16cs_ai_rinsn; + s->do_cmd = das16cs_ai_cmd; + s->do_cmdtest = das16cs_ai_cmdtest; s = dev->subdevices + 1; /* analog output subdevice */ if (thisboard->n_ao_chans) { - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = thisboard->n_ao_chans; - s->maxdata = 0xffff; - s->range_table = &range_bipolar10; - s->insn_write = &das16cs_ao_winsn; - s->insn_read = &das16cs_ao_rinsn; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = thisboard->n_ao_chans; + s->maxdata = 0xffff; + s->range_table = &range_bipolar10; + s->insn_write = &das16cs_ao_winsn; + s->insn_read = &das16cs_ao_rinsn; } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } s = dev->subdevices + 2; /* digital i/o subdevice */ - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = das16cs_dio_insn_bits; - s->insn_config = das16cs_dio_insn_config; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = das16cs_dio_insn_bits; + s->insn_config = das16cs_dio_insn_config; dev_info(dev->class_dev, "%s: %s, I/O base=0x%04lx, irq=%u\n", dev->driver->driver_name, dev->board_name, -- cgit v0.10.2 From e05b98b6425d46e7a0f77d16499407f6df35427f Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 17:17:52 -0700 Subject: staging: comedi: cb_das16_cs: cleanup das16cs_ai_rinsn() Cleanup to analog input read function. 1) Initialize the chan, range, and aref locale variables when they are declared. 2) Remove need for the static local variable. 3) Remove the unnecessary cast of inw()'s return value. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 11dc9b1..80e3540 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -111,16 +111,11 @@ static int das16cs_ai_rinsn(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { struct das16cs_private *devpriv = dev->private; + int chan = CR_CHAN(insn->chanspec); + int range = CR_RANGE(insn->chanspec); + int aref = CR_AREF(insn->chanspec); int i; int to; - int aref; - int range; - int chan; - static int range_bits[] = { 0x800, 0x000, 0x100, 0x200 }; - - chan = CR_CHAN(insn->chanspec); - aref = CR_AREF(insn->chanspec); - range = CR_RANGE(insn->chanspec); outw(chan, dev->iobase + 2); @@ -129,7 +124,22 @@ static int das16cs_ai_rinsn(struct comedi_device *dev, outw(devpriv->status1, dev->iobase + 4); devpriv->status2 &= ~0xff00; - devpriv->status2 |= range_bits[range]; + switch (range) { + case 0: + devpriv->status2 |= 0x800; + break; + case 1: + devpriv->status2 |= 0x000; + break; + case 2: + devpriv->status2 |= 0x100; + break; + case 3: + devpriv->status2 |= 0x200; + break; + default: + return -EINVAL; + } outw(devpriv->status2, dev->iobase + 6); for (i = 0; i < insn->n; i++) { @@ -144,7 +154,7 @@ static int das16cs_ai_rinsn(struct comedi_device *dev, dev_dbg(dev->class_dev, "cb_das16_cs: ai timeout\n"); return -ETIME; } - data[i] = (unsigned short)inw(dev->iobase + 0); + data[i] = inw(dev->iobase + 0); } return i; -- cgit v0.10.2 From ae1a400029aa9624386b198904aedc46de855ba6 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 17:18:43 -0700 Subject: staging: comedi: cb_das16_cs: use #define'd io reg offsets Instead of open coding the 'dev->iobase + n' for each io register in the device, use the provided #define's for the offsets. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 80e3540..f717840 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -117,11 +117,11 @@ static int das16cs_ai_rinsn(struct comedi_device *dev, int i; int to; - outw(chan, dev->iobase + 2); + outw(chan, dev->iobase + DAS16CS_DIO_MUX); devpriv->status1 &= ~0xf320; devpriv->status1 |= (aref == AREF_DIFF) ? 0 : 0x0020; - outw(devpriv->status1, dev->iobase + 4); + outw(devpriv->status1, dev->iobase + DAS16CS_MISC1); devpriv->status2 &= ~0xff00; switch (range) { @@ -140,21 +140,21 @@ static int das16cs_ai_rinsn(struct comedi_device *dev, default: return -EINVAL; } - outw(devpriv->status2, dev->iobase + 6); + outw(devpriv->status2, dev->iobase + DAS16CS_MISC2); for (i = 0; i < insn->n; i++) { - outw(0, dev->iobase); + outw(0, dev->iobase + DAS16CS_ADC_DATA); #define TIMEOUT 1000 for (to = 0; to < TIMEOUT; to++) { - if (inw(dev->iobase + 4) & 0x0080) + if (inw(dev->iobase + DAS16CS_MISC1) & 0x0080) break; } if (to == TIMEOUT) { dev_dbg(dev->class_dev, "cb_das16_cs: ai timeout\n"); return -ETIME; } - data[i] = inw(dev->iobase + 0); + data[i] = inw(dev->iobase + DAS16CS_ADC_DATA); } return i; @@ -333,7 +333,7 @@ static int das16cs_ao_winsn(struct comedi_device *dev, devpriv->ao_readback[chan] = data[i]; d = data[i]; - outw(devpriv->status1, dev->iobase + 4); + outw(devpriv->status1, dev->iobase + DAS16CS_MISC1); udelay(1); status1 = devpriv->status1 & ~0xf; @@ -343,22 +343,22 @@ static int das16cs_ao_winsn(struct comedi_device *dev, status1 |= 0x0008; /* printk("0x%04x\n",status1);*/ - outw(status1, dev->iobase + 4); + outw(status1, dev->iobase + DAS16CS_MISC1); udelay(1); for (bit = 15; bit >= 0; bit--) { int b = (d >> bit) & 0x1; b <<= 1; /* printk("0x%04x\n",status1 | b | 0x0000);*/ - outw(status1 | b | 0x0000, dev->iobase + 4); + outw(status1 | b | 0x0000, dev->iobase + DAS16CS_MISC1); udelay(1); /* printk("0x%04x\n",status1 | b | 0x0004);*/ - outw(status1 | b | 0x0004, dev->iobase + 4); + outw(status1 | b | 0x0004, dev->iobase + DAS16CS_MISC1); udelay(1); } /* make high both DAC0CS and DAC1CS to load new data and update analog output*/ - outw(status1 | 0x9, dev->iobase + 4); + outw(status1 | 0x9, dev->iobase + DAS16CS_MISC1); } return i; @@ -386,10 +386,10 @@ static int das16cs_dio_insn_bits(struct comedi_device *dev, s->state &= ~data[0]; s->state |= data[0] & data[1]; - outw(s->state, dev->iobase + 16); + outw(s->state, dev->iobase + DAS16CS_DIO); } - data[1] = inw(dev->iobase + 16); + data[1] = inw(dev->iobase + DAS16CS_DIO); return insn->n; } @@ -428,7 +428,7 @@ static int das16cs_dio_insn_config(struct comedi_device *dev, devpriv->status2 |= (s->io_bits & 0xf0) ? 0x0080 : 0; devpriv->status2 |= (s->io_bits & 0x0f) ? 0x0040 : 0; - outw(devpriv->status2, dev->iobase + 6); + outw(devpriv->status2, dev->iobase + DAS16CS_MISC2); return insn->n; } -- cgit v0.10.2 From 857670c3e49cf915547652591fce77f3873614e7 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 17:21:17 -0700 Subject: staging: comedi: cb_das16_cs: remove unused variable in private data The 'link' variable in the private data struct is not used by the driver. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index f717840..68e6436 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -83,8 +83,6 @@ static const struct das16cs_board das16cs_boards[] = { }; struct das16cs_private { - struct pcmcia_device *link; - unsigned int ao_readback[2]; unsigned short status1; unsigned short status2; -- cgit v0.10.2 From 443bbedbbef9df3884a93d1200fd087a966aa9c6 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 17:22:18 -0700 Subject: staging: comedi: cb_das16_cs: use the BIP_RANGE helper macro The BIP_RANGE(a) macro can be used instead of the RANGE(a,b) macro when -a == b. And it's a bit clearer that this is a bipolar range. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 68e6436..0d303d1 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -90,12 +90,13 @@ struct das16cs_private { static struct pcmcia_device *cur_dev; -static const struct comedi_lrange das16cs_ai_range = { 4, { - RANGE(-10, 10), - RANGE(-5, 5), - RANGE(-2.5, 2.5), - RANGE(-1.25, 1.25), - } +static const struct comedi_lrange das16cs_ai_range = { + 4, { + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + } }; static irqreturn_t das16cs_interrupt(int irq, void *d) -- cgit v0.10.2 From aebdf3b714d5c1ebc6103a026e2aeed9131ea675 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 17:23:06 -0700 Subject: staging: comedi: cb_das16_cs: remove some commented out debug The das16cs_ao_winsn() function has a couple commented out debug messages. Just remove them. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 0d303d1..791bf11 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -341,17 +341,14 @@ static int das16cs_ao_winsn(struct comedi_device *dev, else status1 |= 0x0008; -/* printk("0x%04x\n",status1);*/ outw(status1, dev->iobase + DAS16CS_MISC1); udelay(1); for (bit = 15; bit >= 0; bit--) { int b = (d >> bit) & 0x1; b <<= 1; -/* printk("0x%04x\n",status1 | b | 0x0000);*/ outw(status1 | b | 0x0000, dev->iobase + DAS16CS_MISC1); udelay(1); -/* printk("0x%04x\n",status1 | b | 0x0004);*/ outw(status1 | b | 0x0004, dev->iobase + DAS16CS_MISC1); udelay(1); } -- cgit v0.10.2 From 0a77678cae47fbfdd30aa1479175e5cc47457dca Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 25 Jun 2012 17:23:44 -0700 Subject: staging: comedi: cb_das16_cs: fix a multi-line comment Fix a multi-line comment to follow the kernel CodingStyle. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 791bf11..f82db298 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -352,8 +352,10 @@ static int das16cs_ao_winsn(struct comedi_device *dev, outw(status1 | b | 0x0004, dev->iobase + DAS16CS_MISC1); udelay(1); } -/* make high both DAC0CS and DAC1CS to load - new data and update analog output*/ + /* + * Make both DAC0CS and DAC1CS high to load + * the new data and update analog the output + */ outw(status1 | 0x9, dev->iobase + DAS16CS_MISC1); } -- cgit v0.10.2 From cd1a76fb6fbd477689ca2d0fdf7db7171c35e5d8 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 10:07:23 -0700 Subject: staging: comedi: cb_das16_cs: reword the comment about PCMCIA support The original comment about the PCMCIA support code was wrong in that it said this driver was for the "pcm-das08". When it was moved the comment was reworded badly. Fix the comment so it makes sense. Signed-off-by: H Hartley Sweeten Reported-by: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index f82db298..95fa7e2 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -19,8 +19,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - PCMCIA support code for the is adapted from the dummy_cs.c driver - of the Linux PCMCIA Card Services package. + PCMCIA support code for this driver is adapted from the dummy_cs.c + driver of the Linux PCMCIA Card Services package. The initial developer of the original code is David A. Hinds . Portions created by David A. Hinds -- cgit v0.10.2 From e8abca1f30239f6c979f60df49305a602672cb94 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 10:08:52 -0700 Subject: staging: comedi: cb_das16_cs: remove unneeded default case in analog in read The default (return -EINVAL) case is not needed when working out the correct value to set the analog input range. As pointed out by Ian Abbott, the comedi core checks the range in comedi_check_chanlist() before calling the insn_read() function. Signed-off-by: H Hartley Sweeten Reported-by: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 95fa7e2..58d4529 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -136,8 +136,6 @@ static int das16cs_ai_rinsn(struct comedi_device *dev, case 3: devpriv->status2 |= 0x200; break; - default: - return -EINVAL; } outw(devpriv->status2, dev->iobase + DAS16CS_MISC2); -- cgit v0.10.2 From 2da049bd5f9b0dbd688519fdb6688a4895fe8395 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 27 Jun 2012 00:22:20 +0200 Subject: staging: gdm72xx: fix an skb memory leak The NLMSG_PUT() macro contains a hidden goto that jumps to the nlmsg_failure label. Since the sk_buff was allocated before the macro, jumping to the nlmsg_failure label leaks the memory allocated for it. Calling kfree() before returning would fix it, but is better to avoid using this error prone macro and use nlmsg_put() instead. Also, use nlmsg_data() instead of NLMSG_DATA() to check type. Signed-off-by: Javier Martinez Canillas Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/gdm72xx/netlink_k.c b/drivers/staging/gdm72xx/netlink_k.c index 9fa432d..064815b 100644 --- a/drivers/staging/gdm72xx/netlink_k.c +++ b/drivers/staging/gdm72xx/netlink_k.c @@ -126,8 +126,13 @@ int netlink_send(struct sock *sock, int group, u16 type, void *msg, int len) } seq++; - nlh = NLMSG_PUT(skb, 0, seq, type, len); - memcpy(NLMSG_DATA(nlh), msg, len); + nlh = nlmsg_put(skb, 0, seq, type, len, 0); + if (!nlh) { + kfree_skb(skb); + return -EMSGSIZE; + } + + memcpy(nlmsg_data(nlh), msg, len); NETLINK_CB(skb).pid = 0; NETLINK_CB(skb).dst_group = 0; @@ -144,6 +149,5 @@ int netlink_send(struct sock *sock, int group, u16 type, void *msg, int len) ret = 0; } -nlmsg_failure: return ret; } -- cgit v0.10.2 From 578f737dd36989121412cf947a5b534e7b8a0ac5 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Mon, 25 Jun 2012 23:13:24 +0200 Subject: iio staging: fix potential resource leak in generic_buffer Signed-off-by: Peter Meerwald Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h index 6f3a392..ab78859 100644 --- a/drivers/staging/iio/Documentation/iio_utils.h +++ b/drivers/staging/iio/Documentation/iio_utils.h @@ -157,7 +157,8 @@ inline int iioutils_get_type(unsigned *is_signed, &padint, shift); if (ret < 0) { printf("failed to pass scan type description\n"); - return ret; + ret = -errno; + goto error_close_sysfsfp; } *be = (endianchar == 'b'); *bytes = padint / 8; @@ -173,7 +174,11 @@ inline int iioutils_get_type(unsigned *is_signed, free(filename); filename = 0; + sysfsfp = 0; } +error_close_sysfsfp: + if (sysfsfp) + fclose(sysfsfp); error_free_filename: if (filename) free(filename); -- cgit v0.10.2 From a4d429e362d873414046c78724f3d6a7978bc2fd Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Mon, 25 Jun 2012 23:13:25 +0200 Subject: iio staging: fix potential memory/resource leaks in find_type_by_name() Signed-off-by: Peter Meerwald Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h index ab78859..81a6289 100644 --- a/drivers/staging/iio/Documentation/iio_utils.h +++ b/drivers/staging/iio/Documentation/iio_utils.h @@ -472,23 +472,30 @@ inline int find_type_by_name(const char *name, const char *type) + strlen(type) + numstrlen + 6); - if (filename == NULL) + if (filename == NULL) { + closedir(dp); return -ENOMEM; + } sprintf(filename, "%s%s%d/name", iio_dir, type, number); nameFile = fopen(filename, "r"); - if (!nameFile) + if (!nameFile) { + free(filename); continue; + } free(filename); fscanf(nameFile, "%s", thisname); - if (strcmp(name, thisname) == 0) - return number; fclose(nameFile); + if (strcmp(name, thisname) == 0) { + closedir(dp); + return number; + } } } } + closedir(dp); return -ENODEV; } -- cgit v0.10.2 From ce7b04c629254b884baa338730021b01298be921 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Mon, 25 Jun 2012 23:13:26 +0200 Subject: iio staging: fix resource leak in _write_sysfs_int() Signed-off-by: Peter Meerwald Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h index 81a6289..b38e81f 100644 --- a/drivers/staging/iio/Documentation/iio_utils.h +++ b/drivers/staging/iio/Documentation/iio_utils.h @@ -524,6 +524,7 @@ inline int _write_sysfs_int(char *filename, char *basedir, int val, int verify) goto error_free; } fscanf(sysfsfp, "%d", &test); + fclose(sysfsfp); if (test != val) { printf("Possible failure in int write %d to %s%s\n", val, @@ -573,6 +574,7 @@ int _write_sysfs_string(char *filename, char *basedir, char *val, int verify) goto error_free; } fscanf(sysfsfp, "%s", temp); + fclose(sysfsfp); if (strcmp(temp, val) != 0) { printf("Possible failure in string write of %s " "Should be %s " -- cgit v0.10.2 From 05eda67d2c31f3e8d815c3fc14f4dbb612363eab Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 27 Jun 2012 10:58:27 +0200 Subject: staging:iio:ad7793: Fix scan index for the "shorted" channel The code expects the scan index to match the offset of the channel into the channel array. For the "shorted" the offset is 3, but the scan index is set to 2. Also the scan index 2 is already taken by the previous channel. As a result the "shorted" channel will appear to be selected if the previous channel is selected and vice versa and it is not possible to sample the "shorted" channel in buffered mode. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/adc/ad7793.c b/drivers/staging/iio/adc/ad7793.c index b36556f..92d8c25 100644 --- a/drivers/staging/iio/adc/ad7793.c +++ b/drivers/staging/iio/adc/ad7793.c @@ -786,7 +786,7 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = { .address = AD7793_CH_AIN1M_AIN1M, .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | IIO_CHAN_INFO_SCALE_SHARED_BIT, - .scan_index = 2, + .scan_index = 3, .scan_type = IIO_ST('s', 24, 32, 0) }, .channel[4] = { @@ -859,7 +859,7 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = { .address = AD7793_CH_AIN1M_AIN1M, .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | IIO_CHAN_INFO_SCALE_SHARED_BIT, - .scan_index = 2, + .scan_index = 3, .scan_type = IIO_ST('s', 16, 32, 0) }, .channel[4] = { -- cgit v0.10.2 From 467d0becaf52add767e51a6de92c52a91cf546ac Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Sat, 5 May 2012 10:41:25 +0100 Subject: staging:iio:accel:adis16204 fix bug in channel modifier handling Will result in the correct scale value for the x axis. Signed-off-by: Jonathan Cameron Acked-by: Michael Hennerich diff --git a/drivers/staging/iio/accel/adis16204_core.c b/drivers/staging/iio/accel/adis16204_core.c index ac9d95e..457982b 100644 --- a/drivers/staging/iio/accel/adis16204_core.c +++ b/drivers/staging/iio/accel/adis16204_core.c @@ -381,7 +381,7 @@ static int adis16204_read_raw(struct iio_dev *indio_dev, return IIO_VAL_INT_PLUS_MICRO; case IIO_ACCEL: *val = 0; - if (chan->channel == 'x') + if (chan->channel2 == IIO_MOD_X) *val2 = 17125; else *val2 = 8407; -- cgit v0.10.2 From 06d5199d4c53615338d0453b62458cd82fb88f33 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Sat, 12 May 2012 10:01:01 +0100 Subject: staging:iio: Add some missing peak elements to the info_mask These are supported by raw_read but not actually there. Signed-off-by: Jonathan Cameron Acked-by: Michael Hennerich diff --git a/drivers/staging/iio/accel/adis16240_core.c b/drivers/staging/iio/accel/adis16240_core.c index 8b15eae..4ba9b1c 100644 --- a/drivers/staging/iio/accel/adis16240_core.c +++ b/drivers/staging/iio/accel/adis16240_core.c @@ -500,7 +500,8 @@ static struct iio_chan_spec adis16240_channels[] = { .channel2 = IIO_MOD_X, .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | IIO_CHAN_INFO_SCALE_SHARED_BIT | - IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT, + IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT | + IIO_CHAN_INFO_PEAK_SEPARATE_BIT, .address = accel_x, .scan_index = ADIS16240_SCAN_ACC_X, .scan_type = { @@ -514,7 +515,8 @@ static struct iio_chan_spec adis16240_channels[] = { .channel2 = IIO_MOD_Y, .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | IIO_CHAN_INFO_SCALE_SHARED_BIT | - IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT, + IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT | + IIO_CHAN_INFO_PEAK_SEPARATE_BIT, .address = accel_y, .scan_index = ADIS16240_SCAN_ACC_Y, .scan_type = { @@ -528,7 +530,8 @@ static struct iio_chan_spec adis16240_channels[] = { .channel2 = IIO_MOD_Z, .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | IIO_CHAN_INFO_SCALE_SHARED_BIT | - IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT, + IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT | + IIO_CHAN_INFO_PEAK_SEPARATE_BIT, .address = accel_z, .scan_index = ADIS16240_SCAN_ACC_Z, .scan_type = { -- cgit v0.10.2 From 8ec4cf5303e03941fa5fd91bbb9c85bd4ae88c47 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 25 Jun 2012 14:52:49 +0200 Subject: iio:adc: Add AD7265/AD7266 support This patch adds support for the Analog Devices AD7265 and AD7266 Analog-to-Digital converters. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 4f7f584..8a78b4f 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -3,6 +3,16 @@ # menu "Analog to digital converters" +config AD7266 + tristate "Analog Devices AD7265/AD7266 ADC driver" + depends on SPI_MASTER + select IIO_BUFFER + select IIO_TRIGGER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for Analog Devices AD7265 and AD7266 + ADCs. + config AT91_ADC tristate "Atmel AT91 ADC" depends on ARCH_AT91 diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 175c8d4..52eec25 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -2,4 +2,5 @@ # Makefile for IIO ADC drivers # +obj-$(CONFIG_AD7266) += ad7266.o obj-$(CONFIG_AT91_ADC) += at91_adc.o diff --git a/drivers/iio/adc/ad7266.c b/drivers/iio/adc/ad7266.c new file mode 100644 index 0000000..5c3f1ba --- /dev/null +++ b/drivers/iio/adc/ad7266.c @@ -0,0 +1,536 @@ +/* + * AD7266/65 SPI ADC driver + * + * Copyright 2012 Analog Devices Inc. + * + * Licensed under the GPL-2. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include + +struct ad7266_state { + struct spi_device *spi; + struct regulator *reg; + unsigned long vref_uv; + + struct spi_transfer single_xfer[3]; + struct spi_message single_msg; + + enum ad7266_range range; + enum ad7266_mode mode; + bool fixed_addr; + struct gpio gpios[3]; + + /* + * DMA (thus cache coherency maintenance) requires the + * transfer buffers to live in their own cache lines. + * The buffer needs to be large enough to hold two samples (4 bytes) and + * the naturally aligned timestamp (8 bytes). + */ + uint8_t data[ALIGN(4, sizeof(s64)) + sizeof(s64)] ____cacheline_aligned; +}; + +static int ad7266_wakeup(struct ad7266_state *st) +{ + /* Any read with >= 2 bytes will wake the device */ + return spi_read(st->spi, st->data, 2); +} + +static int ad7266_powerdown(struct ad7266_state *st) +{ + /* Any read with < 2 bytes will powerdown the device */ + return spi_read(st->spi, st->data, 1); +} + +static int ad7266_preenable(struct iio_dev *indio_dev) +{ + struct ad7266_state *st = iio_priv(indio_dev); + int ret; + + ret = ad7266_wakeup(st); + if (ret) + return ret; + + ret = iio_sw_buffer_preenable(indio_dev); + if (ret) + ad7266_powerdown(st); + + return ret; +} + +static int ad7266_postdisable(struct iio_dev *indio_dev) +{ + struct ad7266_state *st = iio_priv(indio_dev); + return ad7266_powerdown(st); +} + +static const struct iio_buffer_setup_ops iio_triggered_buffer_setup_ops = { + .preenable = &ad7266_preenable, + .postenable = &iio_triggered_buffer_postenable, + .predisable = &iio_triggered_buffer_predisable, + .postdisable = &ad7266_postdisable, +}; + +static irqreturn_t ad7266_trigger_handler(int irq, void *p) +{ + struct iio_poll_func *pf = p; + struct iio_dev *indio_dev = pf->indio_dev; + struct iio_buffer *buffer = indio_dev->buffer; + struct ad7266_state *st = iio_priv(indio_dev); + int ret; + + ret = spi_read(st->spi, st->data, 4); + if (ret == 0) { + if (indio_dev->scan_timestamp) + ((s64 *)st->data)[1] = pf->timestamp; + iio_push_to_buffer(buffer, (u8 *)st->data, pf->timestamp); + } + + iio_trigger_notify_done(indio_dev->trig); + + return IRQ_HANDLED; +} + +static void ad7266_select_input(struct ad7266_state *st, unsigned int nr) +{ + unsigned int i; + + if (st->fixed_addr) + return; + + switch (st->mode) { + case AD7266_MODE_SINGLE_ENDED: + nr >>= 1; + break; + case AD7266_MODE_PSEUDO_DIFF: + nr |= 1; + break; + case AD7266_MODE_DIFF: + nr &= ~1; + break; + } + + for (i = 0; i < 3; ++i) + gpio_set_value(st->gpios[i].gpio, (bool)(nr & BIT(i))); +} + +static int ad7266_update_scan_mode(struct iio_dev *indio_dev, + const unsigned long *scan_mask) +{ + struct ad7266_state *st = iio_priv(indio_dev); + unsigned int nr = find_first_bit(scan_mask, indio_dev->masklength); + + ad7266_select_input(st, nr); + + return 0; +} + +static int ad7266_read_single(struct ad7266_state *st, int *val, + unsigned int address) +{ + int ret; + + ad7266_select_input(st, address); + + ret = spi_sync(st->spi, &st->single_msg); + *val = be16_to_cpu(st->data[address % 2]); + + return ret; +} + +static int ad7266_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int *val, int *val2, long m) +{ + struct ad7266_state *st = iio_priv(indio_dev); + unsigned long scale_uv; + int ret; + + switch (m) { + case IIO_CHAN_INFO_RAW: + if (iio_buffer_enabled(indio_dev)) + return -EBUSY; + + ret = ad7266_read_single(st, val, chan->address); + if (ret) + return ret; + + *val = (*val >> 2) & 0xfff; + if (chan->scan_type.sign == 's') + *val = sign_extend32(*val, 11); + + return IIO_VAL_INT; + case IIO_CHAN_INFO_SCALE: + scale_uv = (st->vref_uv * 100); + if (st->mode == AD7266_MODE_DIFF) + scale_uv *= 2; + if (st->range == AD7266_RANGE_2VREF) + scale_uv *= 2; + + scale_uv >>= chan->scan_type.realbits; + *val = scale_uv / 100000; + *val2 = (scale_uv % 100000) * 10; + return IIO_VAL_INT_PLUS_MICRO; + case IIO_CHAN_INFO_OFFSET: + if (st->range == AD7266_RANGE_2VREF && + st->mode != AD7266_MODE_DIFF) + *val = 2048; + else + *val = 0; + return IIO_VAL_INT; + } + return -EINVAL; +} + +#define AD7266_CHAN(_chan, _sign) { \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .channel = (_chan), \ + .address = (_chan), \ + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT \ + | IIO_CHAN_INFO_SCALE_SHARED_BIT \ + | IIO_CHAN_INFO_OFFSET_SHARED_BIT, \ + .scan_index = (_chan), \ + .scan_type = { \ + .sign = (_sign), \ + .realbits = 12, \ + .storagebits = 16, \ + .shift = 2, \ + .endianness = IIO_BE, \ + }, \ +} + +#define AD7266_DECLARE_SINGLE_ENDED_CHANNELS(_name, _sign) \ +const struct iio_chan_spec ad7266_channels_##_name[] = { \ + AD7266_CHAN(0, (_sign)), \ + AD7266_CHAN(1, (_sign)), \ + AD7266_CHAN(2, (_sign)), \ + AD7266_CHAN(3, (_sign)), \ + AD7266_CHAN(4, (_sign)), \ + AD7266_CHAN(5, (_sign)), \ + AD7266_CHAN(6, (_sign)), \ + AD7266_CHAN(7, (_sign)), \ + AD7266_CHAN(8, (_sign)), \ + AD7266_CHAN(9, (_sign)), \ + AD7266_CHAN(10, (_sign)), \ + AD7266_CHAN(11, (_sign)), \ + IIO_CHAN_SOFT_TIMESTAMP(13), \ +} + +#define AD7266_DECLARE_SINGLE_ENDED_CHANNELS_FIXED(_name, _sign) \ +const struct iio_chan_spec ad7266_channels_##_name##_fixed[] = { \ + AD7266_CHAN(0, (_sign)), \ + AD7266_CHAN(1, (_sign)), \ + IIO_CHAN_SOFT_TIMESTAMP(2), \ +} + +static AD7266_DECLARE_SINGLE_ENDED_CHANNELS(u, 'u'); +static AD7266_DECLARE_SINGLE_ENDED_CHANNELS(s, 's'); +static AD7266_DECLARE_SINGLE_ENDED_CHANNELS_FIXED(u, 'u'); +static AD7266_DECLARE_SINGLE_ENDED_CHANNELS_FIXED(s, 's'); + +#define AD7266_CHAN_DIFF(_chan, _sign) { \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .channel = (_chan) * 2, \ + .channel2 = (_chan) * 2 + 1, \ + .address = (_chan), \ + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT \ + | IIO_CHAN_INFO_SCALE_SHARED_BIT \ + | IIO_CHAN_INFO_OFFSET_SHARED_BIT, \ + .scan_index = (_chan), \ + .scan_type = { \ + .sign = _sign, \ + .realbits = 12, \ + .storagebits = 16, \ + .shift = 2, \ + .endianness = IIO_BE, \ + }, \ + .differential = 1, \ +} + +#define AD7266_DECLARE_DIFF_CHANNELS(_name, _sign) \ +const struct iio_chan_spec ad7266_channels_diff_##_name[] = { \ + AD7266_CHAN_DIFF(0, (_sign)), \ + AD7266_CHAN_DIFF(1, (_sign)), \ + AD7266_CHAN_DIFF(2, (_sign)), \ + AD7266_CHAN_DIFF(3, (_sign)), \ + AD7266_CHAN_DIFF(4, (_sign)), \ + AD7266_CHAN_DIFF(5, (_sign)), \ + IIO_CHAN_SOFT_TIMESTAMP(6), \ +} + +static AD7266_DECLARE_DIFF_CHANNELS(s, 's'); +static AD7266_DECLARE_DIFF_CHANNELS(u, 'u'); + +#define AD7266_DECLARE_DIFF_CHANNELS_FIXED(_name, _sign) \ +const struct iio_chan_spec ad7266_channels_diff_fixed_##_name[] = { \ + AD7266_CHAN_DIFF(0, (_sign)), \ + AD7266_CHAN_DIFF(1, (_sign)), \ + IIO_CHAN_SOFT_TIMESTAMP(2), \ +} + +static AD7266_DECLARE_DIFF_CHANNELS_FIXED(s, 's'); +static AD7266_DECLARE_DIFF_CHANNELS_FIXED(u, 'u'); + +static const struct iio_info ad7266_info = { + .read_raw = &ad7266_read_raw, + .update_scan_mode = &ad7266_update_scan_mode, + .driver_module = THIS_MODULE, +}; + +static unsigned long ad7266_available_scan_masks[] = { + 0x003, + 0x00c, + 0x030, + 0x0c0, + 0x300, + 0xc00, + 0x000, +}; + +static unsigned long ad7266_available_scan_masks_diff[] = { + 0x003, + 0x00c, + 0x030, + 0x000, +}; + +static unsigned long ad7266_available_scan_masks_fixed[] = { + 0x003, + 0x000, +}; + +struct ad7266_chan_info { + const struct iio_chan_spec *channels; + unsigned int num_channels; + unsigned long *scan_masks; +}; + +#define AD7266_CHAN_INFO_INDEX(_differential, _signed, _fixed) \ + (((_differential) << 2) | ((_signed) << 1) | ((_fixed) << 0)) + +static const struct ad7266_chan_info ad7266_chan_infos[] = { + [AD7266_CHAN_INFO_INDEX(0, 0, 0)] = { + .channels = ad7266_channels_u, + .num_channels = ARRAY_SIZE(ad7266_channels_u), + .scan_masks = ad7266_available_scan_masks, + }, + [AD7266_CHAN_INFO_INDEX(0, 0, 1)] = { + .channels = ad7266_channels_u_fixed, + .num_channels = ARRAY_SIZE(ad7266_channels_u_fixed), + .scan_masks = ad7266_available_scan_masks_fixed, + }, + [AD7266_CHAN_INFO_INDEX(0, 1, 0)] = { + .channels = ad7266_channels_s, + .num_channels = ARRAY_SIZE(ad7266_channels_s), + .scan_masks = ad7266_available_scan_masks, + }, + [AD7266_CHAN_INFO_INDEX(0, 1, 1)] = { + .channels = ad7266_channels_s_fixed, + .num_channels = ARRAY_SIZE(ad7266_channels_s_fixed), + .scan_masks = ad7266_available_scan_masks_fixed, + }, + [AD7266_CHAN_INFO_INDEX(1, 0, 0)] = { + .channels = ad7266_channels_diff_u, + .num_channels = ARRAY_SIZE(ad7266_channels_diff_u), + .scan_masks = ad7266_available_scan_masks_diff, + }, + [AD7266_CHAN_INFO_INDEX(1, 0, 1)] = { + .channels = ad7266_channels_diff_fixed_u, + .num_channels = ARRAY_SIZE(ad7266_channels_diff_fixed_u), + .scan_masks = ad7266_available_scan_masks_fixed, + }, + [AD7266_CHAN_INFO_INDEX(1, 1, 0)] = { + .channels = ad7266_channels_diff_s, + .num_channels = ARRAY_SIZE(ad7266_channels_diff_s), + .scan_masks = ad7266_available_scan_masks_diff, + }, + [AD7266_CHAN_INFO_INDEX(1, 1, 1)] = { + .channels = ad7266_channels_diff_fixed_s, + .num_channels = ARRAY_SIZE(ad7266_channels_diff_fixed_s), + .scan_masks = ad7266_available_scan_masks_fixed, + }, +}; + +static void __devinit ad7266_init_channels(struct iio_dev *indio_dev) +{ + struct ad7266_state *st = iio_priv(indio_dev); + bool is_differential, is_signed; + const struct ad7266_chan_info *chan_info; + int i; + + is_differential = st->mode != AD7266_MODE_SINGLE_ENDED; + is_signed = (st->range == AD7266_RANGE_2VREF) | + (st->mode == AD7266_MODE_DIFF); + + i = AD7266_CHAN_INFO_INDEX(is_differential, is_signed, st->fixed_addr); + chan_info = &ad7266_chan_infos[i]; + + indio_dev->channels = chan_info->channels; + indio_dev->num_channels = chan_info->num_channels; + indio_dev->available_scan_masks = chan_info->scan_masks; + indio_dev->masklength = chan_info->num_channels - 1; +} + +static const char * const ad7266_gpio_labels[] = { + "AD0", "AD1", "AD2", +}; + +static int __devinit ad7266_probe(struct spi_device *spi) +{ + struct ad7266_platform_data *pdata = spi->dev.platform_data; + struct iio_dev *indio_dev; + struct ad7266_state *st; + unsigned int i; + int ret; + + indio_dev = iio_device_alloc(sizeof(*st)); + if (indio_dev == NULL) + return -ENOMEM; + + st = iio_priv(indio_dev); + + st->reg = regulator_get(&spi->dev, "vref"); + if (!IS_ERR_OR_NULL(st->reg)) { + ret = regulator_enable(st->reg); + if (ret) + goto error_put_reg; + + st->vref_uv = regulator_get_voltage(st->reg); + } else { + /* Use internal reference */ + st->vref_uv = 2500000; + } + + if (pdata) { + st->fixed_addr = pdata->fixed_addr; + st->mode = pdata->mode; + st->range = pdata->range; + + if (!st->fixed_addr) { + for (i = 0; i < ARRAY_SIZE(st->gpios); ++i) { + st->gpios[i].gpio = pdata->addr_gpios[i]; + st->gpios[i].flags = GPIOF_OUT_INIT_LOW; + st->gpios[i].label = ad7266_gpio_labels[i]; + } + ret = gpio_request_array(st->gpios, + ARRAY_SIZE(st->gpios)); + if (ret) + goto error_disable_reg; + } + } else { + st->fixed_addr = true; + st->range = AD7266_RANGE_VREF; + st->mode = AD7266_MODE_DIFF; + } + + spi_set_drvdata(spi, indio_dev); + st->spi = spi; + + indio_dev->dev.parent = &spi->dev; + indio_dev->name = spi_get_device_id(spi)->name; + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->info = &ad7266_info; + + ad7266_init_channels(indio_dev); + + /* wakeup */ + st->single_xfer[0].rx_buf = &st->data; + st->single_xfer[0].len = 2; + st->single_xfer[0].cs_change = 1; + /* conversion */ + st->single_xfer[1].rx_buf = &st->data; + st->single_xfer[1].len = 4; + st->single_xfer[1].cs_change = 1; + /* powerdown */ + st->single_xfer[2].tx_buf = &st->data; + st->single_xfer[2].len = 1; + + spi_message_init(&st->single_msg); + spi_message_add_tail(&st->single_xfer[0], &st->single_msg); + spi_message_add_tail(&st->single_xfer[1], &st->single_msg); + spi_message_add_tail(&st->single_xfer[2], &st->single_msg); + + ret = iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time, + &ad7266_trigger_handler, &iio_triggered_buffer_setup_ops); + if (ret) + goto error_free_gpios; + + ret = iio_device_register(indio_dev); + if (ret) + goto error_buffer_cleanup; + + return 0; + +error_buffer_cleanup: + iio_triggered_buffer_cleanup(indio_dev); +error_free_gpios: + if (!st->fixed_addr) + gpio_free_array(st->gpios, ARRAY_SIZE(st->gpios)); +error_disable_reg: + if (!IS_ERR_OR_NULL(st->reg)) + regulator_disable(st->reg); +error_put_reg: + if (!IS_ERR_OR_NULL(st->reg)) + regulator_put(st->reg); + + iio_device_free(indio_dev); + + return ret; +} + +static int __devexit ad7266_remove(struct spi_device *spi) +{ + struct iio_dev *indio_dev = spi_get_drvdata(spi); + struct ad7266_state *st = iio_priv(indio_dev); + + iio_device_unregister(indio_dev); + iio_triggered_buffer_cleanup(indio_dev); + if (!st->fixed_addr) + gpio_free_array(st->gpios, ARRAY_SIZE(st->gpios)); + if (!IS_ERR_OR_NULL(st->reg)) { + regulator_disable(st->reg); + regulator_put(st->reg); + } + iio_device_free(indio_dev); + + return 0; +} + +static const struct spi_device_id ad7266_id[] = { + {"ad7265", 0}, + {"ad7266", 0}, + { } +}; +MODULE_DEVICE_TABLE(spi, ad7266_id); + +static struct spi_driver ad7266_driver = { + .driver = { + .name = "ad7266", + .owner = THIS_MODULE, + }, + .probe = ad7266_probe, + .remove = __devexit_p(ad7266_remove), + .id_table = ad7266_id, +}; +module_spi_driver(ad7266_driver); + +MODULE_AUTHOR("Lars-Peter Clausen "); +MODULE_DESCRIPTION("Analog Devices AD7266/65 ADC"); +MODULE_LICENSE("GPL v2"); diff --git a/include/linux/platform_data/ad7266.h b/include/linux/platform_data/ad7266.h new file mode 100644 index 0000000..eabfdcb --- /dev/null +++ b/include/linux/platform_data/ad7266.h @@ -0,0 +1,54 @@ +/* + * AD7266/65 SPI ADC driver + * + * Copyright 2012 Analog Devices Inc. + * + * Licensed under the GPL-2. + */ + +#ifndef __IIO_ADC_AD7266_H__ +#define __IIO_ADC_AD7266_H__ + +/** + * enum ad7266_range - AD7266 reference voltage range + * @AD7266_RANGE_VREF: Device is configured for input range 0V - VREF + * (RANGE pin set to low) + * @AD7266_RANGE_2VREF: Device is configured for input range 0V - 2VREF + * (RANGE pin set to high) + */ +enum ad7266_range { + AD7266_RANGE_VREF, + AD7266_RANGE_2VREF, +}; + +/** + * enum ad7266_mode - AD7266 sample mode + * @AD7266_MODE_DIFF: Device is configured for full differential mode + * (SGL/DIFF pin set to low, AD0 pin set to low) + * @AD7266_MODE_PSEUDO_DIFF: Device is configured for pseudo differential mode + * (SGL/DIFF pin set to low, AD0 pin set to high) + * @AD7266_MODE_SINGLE_ENDED: Device is configured for single-ended mode + * (SGL/DIFF pin set to high) + */ +enum ad7266_mode { + AD7266_MODE_DIFF, + AD7266_MODE_PSEUDO_DIFF, + AD7266_MODE_SINGLE_ENDED, +}; + +/** + * struct ad7266_platform_data - Platform data for the AD7266 driver + * @range: Reference voltage range the device is configured for + * @mode: Sample mode the device is configured for + * @fixed_addr: Whether the address pins are hard-wired + * @addr_gpios: GPIOs used for controlling the address pins, only used if + * fixed_addr is set to false. + */ +struct ad7266_platform_data { + enum ad7266_range range; + enum ad7266_mode mode; + bool fixed_addr; + unsigned int addr_gpios[3]; +}; + +#endif -- cgit v0.10.2 From 6a17a0768f77626046aa441843b318a00bac3800 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Tue, 26 Jun 2012 11:04:36 +0200 Subject: iio:dac:ad5064: Add support for the ad5629r and ad5669r The ad5629r and ad5669r are the I2C variants of the ad5628 and ad5668. Since the ad5064 driver currently only supports SPI based devices the major part of this patch focuses on adding support for I2C based devices. Adding support for the actual parts boils down to adding entries for them to the device id table. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig index afd207e..1be15fa 100644 --- a/drivers/iio/dac/Kconfig +++ b/drivers/iio/dac/Kconfig @@ -4,12 +4,12 @@ menu "Digital to analog converters" config AD5064 - tristate "Analog Devices AD5064/64-1/65/44/45/24/25, AD5628/48/66/68 DAC driver" - depends on SPI + tristate "Analog Devices AD5064 and similar multi-channel DAC driver" + depends on (SPI_MASTER || I2C) help Say yes here to build support for Analog Devices AD5024, AD5025, AD5044, - AD5045, AD5064, AD5064-1, AD5065, AD5628, AD5648, AD5666, AD5668 Digital - to Analog Converter. + AD5045, AD5064, AD5064-1, AD5065, AD5628, AD5629R, AD5648, AD5666, AD5668, + AD5669R Digital to Analog Converter. To compile this driver as a module, choose M here: the module will be called ad5064. diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c index 276af02..aa739c4 100644 --- a/drivers/iio/dac/ad5064.c +++ b/drivers/iio/dac/ad5064.c @@ -1,6 +1,6 @@ /* - * AD5024, AD5025, AD5044, AD5045, AD5064, AD5064-1, AD5065, AD5628, AD5648, - * AD5666, AD5668 Digital to analog converters driver + * AD5024, AD5025, AD5044, AD5045, AD5064, AD5064-1, AD5065, AD5628, AD5629R, + * AD5648, AD5666, AD5668, AD5669R Digital to analog converters driver * * Copyright 2011 Analog Devices Inc. * @@ -12,9 +12,11 @@ #include #include #include +#include #include #include #include +#include #include #include @@ -62,9 +64,14 @@ struct ad5064_chip_info { unsigned int num_channels; }; +struct ad5064_state; + +typedef int (*ad5064_write_func)(struct ad5064_state *st, unsigned int cmd, + unsigned int addr, unsigned int val); + /** * struct ad5064_state - driver instance specific data - * @spi: spi_device + * @dev: the device for this driver instance * @chip_info: chip model specific constants, available modes etc * @vref_reg: vref supply regulators * @pwr_down: whether channel is powered down @@ -72,11 +79,12 @@ struct ad5064_chip_info { * @dac_cache: current DAC raw value (chip does not support readback) * @use_internal_vref: set to true if the internal reference voltage should be * used. - * @data: spi transfer buffers + * @write: register write callback + * @data: i2c/spi transfer buffers */ struct ad5064_state { - struct spi_device *spi; + struct device *dev; const struct ad5064_chip_info *chip_info; struct regulator_bulk_data vref_reg[AD5064_MAX_VREFS]; bool pwr_down[AD5064_MAX_DAC_CHANNELS]; @@ -84,11 +92,16 @@ struct ad5064_state { unsigned int dac_cache[AD5064_MAX_DAC_CHANNELS]; bool use_internal_vref; + ad5064_write_func write; + /* * DMA (thus cache coherency maintenance) requires the * transfer buffers to live in their own cache lines. */ - __be32 data ____cacheline_aligned; + union { + u8 i2c[3]; + __be32 spi; + } data ____cacheline_aligned; }; enum ad5064_type { @@ -109,14 +122,31 @@ enum ad5064_type { ID_AD5668_2, }; +static int ad5064_i2c_write(struct ad5064_state *st, unsigned int cmd, + unsigned int addr, unsigned int val) +{ + struct i2c_client *i2c = to_i2c_client(st->dev); + + st->data.i2c[0] = (cmd << 4) | addr; + put_unaligned_be16(val, &st->data.i2c[1]); + return i2c_master_send(i2c, st->data.i2c, 3); +} + static int ad5064_spi_write(struct ad5064_state *st, unsigned int cmd, + unsigned int addr, unsigned int val) +{ + struct spi_device *spi = to_spi_device(st->dev); + + st->data.spi = cpu_to_be32(AD5064_CMD(cmd) | AD5064_ADDR(addr) | val); + return spi_write(spi, &st->data.spi, sizeof(st->data.spi)); +} + +static int ad5064_write(struct ad5064_state *st, unsigned int cmd, unsigned int addr, unsigned int val, unsigned int shift) { val <<= shift; - st->data = cpu_to_be32(AD5064_CMD(cmd) | AD5064_ADDR(addr) | val); - - return spi_write(st->spi, &st->data, sizeof(st->data)); + return st->write(st, cmd, addr, val); } static int ad5064_sync_powerdown_mode(struct ad5064_state *st, @@ -130,7 +160,7 @@ static int ad5064_sync_powerdown_mode(struct ad5064_state *st, if (st->pwr_down[channel]) val |= st->pwr_down_mode[channel] << 8; - ret = ad5064_spi_write(st, AD5064_CMD_POWERDOWN_DAC, 0, val, 0); + ret = ad5064_write(st, AD5064_CMD_POWERDOWN_DAC, 0, val, 0); return ret; } @@ -251,7 +281,7 @@ static int ad5064_write_raw(struct iio_dev *indio_dev, return -EINVAL; mutex_lock(&indio_dev->mlock); - ret = ad5064_spi_write(st, AD5064_CMD_WRITE_INPUT_N_UPDATE_N, + ret = ad5064_write(st, AD5064_CMD_WRITE_INPUT_N_UPDATE_N, chan->address, val, chan->scan_type.shift); if (ret == 0) st->dac_cache[chan->channel] = val; @@ -413,9 +443,9 @@ static const char * const ad5064_vref_name(struct ad5064_state *st, return st->chip_info->shared_vref ? "vref" : ad5064_vref_names[vref]; } -static int __devinit ad5064_probe(struct spi_device *spi) +static int __devinit ad5064_probe(struct device *dev, enum ad5064_type type, + const char *name, ad5064_write_func write) { - enum ad5064_type type = spi_get_device_id(spi)->driver_data; struct iio_dev *indio_dev; struct ad5064_state *st; unsigned int i; @@ -426,24 +456,25 @@ static int __devinit ad5064_probe(struct spi_device *spi) return -ENOMEM; st = iio_priv(indio_dev); - spi_set_drvdata(spi, indio_dev); + dev_set_drvdata(dev, indio_dev); st->chip_info = &ad5064_chip_info_tbl[type]; - st->spi = spi; + st->dev = dev; + st->write = write; for (i = 0; i < ad5064_num_vref(st); ++i) st->vref_reg[i].supply = ad5064_vref_name(st, i); - ret = regulator_bulk_get(&st->spi->dev, ad5064_num_vref(st), + ret = regulator_bulk_get(dev, ad5064_num_vref(st), st->vref_reg); if (ret) { if (!st->chip_info->internal_vref) goto error_free; st->use_internal_vref = true; - ret = ad5064_spi_write(st, AD5064_CMD_CONFIG, 0, + ret = ad5064_write(st, AD5064_CMD_CONFIG, 0, AD5064_CONFIG_INT_VREF_ENABLE, 0); if (ret) { - dev_err(&spi->dev, "Failed to enable internal vref: %d\n", + dev_err(dev, "Failed to enable internal vref: %d\n", ret); goto error_free; } @@ -458,8 +489,8 @@ static int __devinit ad5064_probe(struct spi_device *spi) st->dac_cache[i] = 0x8000; } - indio_dev->dev.parent = &spi->dev; - indio_dev->name = spi_get_device_id(spi)->name; + indio_dev->dev.parent = dev; + indio_dev->name = name; indio_dev->info = &ad5064_info; indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->channels = st->chip_info->channels; @@ -483,10 +514,9 @@ error_free: return ret; } - -static int __devexit ad5064_remove(struct spi_device *spi) +static int __devexit ad5064_remove(struct device *dev) { - struct iio_dev *indio_dev = spi_get_drvdata(spi); + struct iio_dev *indio_dev = dev_get_drvdata(dev); struct ad5064_state *st = iio_priv(indio_dev); iio_device_unregister(indio_dev); @@ -501,7 +531,22 @@ static int __devexit ad5064_remove(struct spi_device *spi) return 0; } -static const struct spi_device_id ad5064_id[] = { +#if IS_ENABLED(CONFIG_SPI_MASTER) + +static int __devinit ad5064_spi_probe(struct spi_device *spi) +{ + const struct spi_device_id *id = spi_get_device_id(spi); + + return ad5064_probe(&spi->dev, id->driver_data, id->name, + ad5064_spi_write); +} + +static int __devexit ad5064_spi_remove(struct spi_device *spi) +{ + return ad5064_remove(&spi->dev); +} + +static const struct spi_device_id ad5064_spi_ids[] = { {"ad5024", ID_AD5024}, {"ad5025", ID_AD5025}, {"ad5044", ID_AD5044}, @@ -520,19 +565,112 @@ static const struct spi_device_id ad5064_id[] = { {"ad5668-3", ID_AD5668_2}, /* similar enough to ad5668-2 */ {} }; -MODULE_DEVICE_TABLE(spi, ad5064_id); +MODULE_DEVICE_TABLE(spi, ad5064_spi_ids); -static struct spi_driver ad5064_driver = { +static struct spi_driver ad5064_spi_driver = { .driver = { .name = "ad5064", .owner = THIS_MODULE, }, - .probe = ad5064_probe, - .remove = __devexit_p(ad5064_remove), - .id_table = ad5064_id, + .probe = ad5064_spi_probe, + .remove = __devexit_p(ad5064_spi_remove), + .id_table = ad5064_spi_ids, }; -module_spi_driver(ad5064_driver); + +static int __init ad5064_spi_register_driver(void) +{ + return spi_register_driver(&ad5064_spi_driver); +} + +static void __exit ad5064_spi_unregister_driver(void) +{ + spi_unregister_driver(&ad5064_spi_driver); +} + +#else + +static inline int ad5064_spi_register_driver(void) { return 0; } +static inline void ad5064_spi_unregister_driver(void) { } + +#endif + +#if IS_ENABLED(CONFIG_I2C) + +static int __devinit ad5064_i2c_probe(struct i2c_client *i2c, + const struct i2c_device_id *id) +{ + return ad5064_probe(&i2c->dev, id->driver_data, id->name, + ad5064_i2c_write); +} + +static int __devexit ad5064_i2c_remove(struct i2c_client *i2c) +{ + return ad5064_remove(&i2c->dev); +} + +static const struct i2c_device_id ad5064_i2c_ids[] = { + {"ad5629-1", ID_AD5628_1}, + {"ad5629-2", ID_AD5628_2}, + {"ad5629-3", ID_AD5628_2}, /* similar enough to ad5629-2 */ + {"ad5669-1", ID_AD5668_1}, + {"ad5669-2", ID_AD5668_2}, + {"ad5669-3", ID_AD5668_2}, /* similar enough to ad5669-2 */ + {} +}; +MODULE_DEVICE_TABLE(i2c, ad5064_i2c_ids); + +static struct i2c_driver ad5064_i2c_driver = { + .driver = { + .name = "ad5064", + .owner = THIS_MODULE, + }, + .probe = ad5064_i2c_probe, + .remove = __devexit_p(ad5064_i2c_remove), + .id_table = ad5064_i2c_ids, +}; + +static int __init ad5064_i2c_register_driver(void) +{ + return i2c_add_driver(&ad5064_i2c_driver); +} + +static void __exit ad5064_i2c_unregister_driver(void) +{ + i2c_del_driver(&ad5064_i2c_driver); +} + +#else + +static inline int ad5064_i2c_register_driver(void) { return 0; } +static inline void ad5064_i2c_unregister_driver(void) { } + +#endif + +static int __init ad5064_init(void) +{ + int ret; + + ret = ad5064_spi_register_driver(); + if (ret) + return ret; + + ret = ad5064_i2c_register_driver(); + if (ret) { + ad5064_spi_unregister_driver(); + return ret; + } + + return 0; +} +module_init(ad5064_init); + +static void __exit ad5064_exit(void) +{ + ad5064_i2c_unregister_driver(); + ad5064_spi_unregister_driver(); +} +module_exit(ad5064_exit); MODULE_AUTHOR("Lars-Peter Clausen "); -MODULE_DESCRIPTION("Analog Devices AD5024/25/44/45/64/64-1/65, AD5628/48/66/68 DAC"); +MODULE_DESCRIPTION("Analog Devices AD5024 and similar multi-channel DACs"); MODULE_LICENSE("GPL v2"); -- cgit v0.10.2 From 314be14bb89369b2164125b0ec3b24d85b407b62 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Tue, 1 May 2012 21:04:24 +0100 Subject: iio: Rename _st_ functions to loose the bit that meant the staging version. These were originally introduced when the plan was to have parallel IIO cores in and out of staging with a slow move between them. Now we have reached the point where the whole core has moved, they need clearing up! Signed-off-by: Jonathan Cameron diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index d4760bd..9a46ca6 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c @@ -92,8 +92,7 @@ error_ret: EXPORT_SYMBOL_GPL(iio_map_array_unregister); static const struct iio_chan_spec -*iio_chan_spec_from_name(const struct iio_dev *indio_dev, - const char *name) +*iio_chan_spec_from_name(const struct iio_dev *indio_dev, const char *name) { int i; const struct iio_chan_spec *chan = NULL; @@ -108,8 +107,7 @@ static const struct iio_chan_spec } -struct iio_channel *iio_st_channel_get(const char *name, - const char *channel_name) +struct iio_channel *iio_channel_get(const char *name, const char *channel_name) { struct iio_map_internal *c_i = NULL, *c = NULL; struct iio_channel *channel; @@ -145,16 +143,16 @@ struct iio_channel *iio_st_channel_get(const char *name, return channel; } -EXPORT_SYMBOL_GPL(iio_st_channel_get); +EXPORT_SYMBOL_GPL(iio_channel_get); -void iio_st_channel_release(struct iio_channel *channel) +void iio_channel_release(struct iio_channel *channel) { iio_device_put(channel->indio_dev); kfree(channel); } -EXPORT_SYMBOL_GPL(iio_st_channel_release); +EXPORT_SYMBOL_GPL(iio_channel_release); -struct iio_channel *iio_st_channel_get_all(const char *name) +struct iio_channel *iio_channel_get_all(const char *name) { struct iio_channel *chans; struct iio_map_internal *c = NULL; @@ -217,9 +215,9 @@ error_ret: return ERR_PTR(ret); } -EXPORT_SYMBOL_GPL(iio_st_channel_get_all); +EXPORT_SYMBOL_GPL(iio_channel_get_all); -void iio_st_channel_release_all(struct iio_channel *channels) +void iio_channel_release_all(struct iio_channel *channels) { struct iio_channel *chan = &channels[0]; @@ -229,9 +227,9 @@ void iio_st_channel_release_all(struct iio_channel *channels) } kfree(channels); } -EXPORT_SYMBOL_GPL(iio_st_channel_release_all); +EXPORT_SYMBOL_GPL(iio_channel_release_all); -int iio_st_read_channel_raw(struct iio_channel *chan, int *val) +int iio_read_channel_raw(struct iio_channel *chan, int *val) { int val2, ret; @@ -248,9 +246,9 @@ err_unlock: return ret; } -EXPORT_SYMBOL_GPL(iio_st_read_channel_raw); +EXPORT_SYMBOL_GPL(iio_read_channel_raw); -int iio_st_read_channel_scale(struct iio_channel *chan, int *val, int *val2) +int iio_read_channel_scale(struct iio_channel *chan, int *val, int *val2) { int ret; @@ -269,10 +267,9 @@ err_unlock: return ret; } -EXPORT_SYMBOL_GPL(iio_st_read_channel_scale); +EXPORT_SYMBOL_GPL(iio_read_channel_scale); -int iio_st_get_channel_type(struct iio_channel *chan, - enum iio_chan_type *type) +int iio_get_channel_type(struct iio_channel *chan, enum iio_chan_type *type) { int ret = 0; /* Need to verify underlying driver has not gone away */ @@ -289,4 +286,4 @@ err_unlock: return ret; } -EXPORT_SYMBOL_GPL(iio_st_get_channel_type); +EXPORT_SYMBOL_GPL(iio_get_channel_type); diff --git a/drivers/staging/iio/iio_hwmon.c b/drivers/staging/iio/iio_hwmon.c index b03554f..27d27ec 100644 --- a/drivers/staging/iio/iio_hwmon.c +++ b/drivers/staging/iio/iio_hwmon.c @@ -51,12 +51,12 @@ static ssize_t iio_hwmon_read_val(struct device *dev, * No locking between this pair, so theoretically possible * the scale has changed. */ - ret = iio_st_read_channel_raw(&state->channels[sattr->index], + ret = iio_read_channel_raw(&state->channels[sattr->index], &val); if (ret < 0) return ret; - ret = iio_st_read_channel_scale(&state->channels[sattr->index], + ret = iio_read_channel_scale(&state->channels[sattr->index], &scaleint, &scalepart); if (ret < 0) return ret; @@ -106,7 +106,7 @@ static int __devinit iio_hwmon_probe(struct platform_device *pdev) goto error_ret; } - st->channels = iio_st_channel_get_all(dev_name(&pdev->dev)); + st->channels = iio_channel_get_all(dev_name(&pdev->dev)); if (IS_ERR(st->channels)) { ret = PTR_ERR(st->channels); goto error_free_state; @@ -130,7 +130,7 @@ static int __devinit iio_hwmon_probe(struct platform_device *pdev) } sysfs_attr_init(&a->dev_attr.attr); - ret = iio_st_get_channel_type(&st->channels[i], &type); + ret = iio_get_channel_type(&st->channels[i], &type); if (ret < 0) { kfree(a); goto error_free_attrs; @@ -186,7 +186,7 @@ error_free_attrs: iio_hwmon_free_attrs(st); kfree(st->attrs); error_release_channels: - iio_st_channel_release_all(st->channels); + iio_channel_release_all(st->channels); error_free_state: kfree(st); error_ret: @@ -201,7 +201,7 @@ static int __devexit iio_hwmon_remove(struct platform_device *pdev) sysfs_remove_group(&pdev->dev.kobj, &st->attr_group); iio_hwmon_free_attrs(st); kfree(st->attrs); - iio_st_channel_release_all(st->channels); + iio_channel_release_all(st->channels); return 0; } diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h index 1a15e560..e2657e6 100644 --- a/include/linux/iio/consumer.h +++ b/include/linux/iio/consumer.h @@ -33,17 +33,17 @@ struct iio_channel { * side. This typically describes the channels use within * the consumer. E.g. 'battery_voltage' */ -struct iio_channel *iio_st_channel_get(const char *name, - const char *consumer_channel); +struct iio_channel *iio_channel_get(const char *name, + const char *consumer_channel); /** - * iio_st_channel_release() - release channels obtained via iio_st_channel_get + * iio_channel_release() - release channels obtained via iio_channel_get * @chan: The channel to be released. */ -void iio_st_channel_release(struct iio_channel *chan); +void iio_channel_release(struct iio_channel *chan); /** - * iio_st_channel_get_all() - get all channels associated with a client + * iio_channel_get_all() - get all channels associated with a client * @name: name of consumer device. * * Returns an array of iio_channel structures terminated with one with @@ -51,37 +51,37 @@ void iio_st_channel_release(struct iio_channel *chan); * This function is used by fairly generic consumers to get all the * channels registered as having this consumer. */ -struct iio_channel *iio_st_channel_get_all(const char *name); +struct iio_channel *iio_channel_get_all(const char *name); /** - * iio_st_channel_release_all() - reverse iio_st_get_all + * iio_channel_release_all() - reverse iio_channel_get_all * @chan: Array of channels to be released. */ -void iio_st_channel_release_all(struct iio_channel *chan); +void iio_channel_release_all(struct iio_channel *chan); /** - * iio_st_read_channel_raw() - read from a given channel + * iio_read_channel_raw() - read from a given channel * @channel: The channel being queried. * @val: Value read back. * * Note raw reads from iio channels are in adc counts and hence * scale will need to be applied if standard units required. */ -int iio_st_read_channel_raw(struct iio_channel *chan, - int *val); +int iio_read_channel_raw(struct iio_channel *chan, + int *val); /** - * iio_st_get_channel_type() - get the type of a channel + * iio_get_channel_type() - get the type of a channel * @channel: The channel being queried. * @type: The type of the channel. * * returns the enum iio_chan_type of the channel */ -int iio_st_get_channel_type(struct iio_channel *channel, - enum iio_chan_type *type); +int iio_get_channel_type(struct iio_channel *channel, + enum iio_chan_type *type); /** - * iio_st_read_channel_scale() - read the scale value for a channel + * iio_read_channel_scale() - read the scale value for a channel * @channel: The channel being queried. * @val: First part of value read back. * @val2: Second part of value read back. @@ -90,7 +90,7 @@ int iio_st_get_channel_type(struct iio_channel *channel, * as IIO_VAL_INT_PLUS_MICRO telling us we have a value of val * + val2/1e6 */ -int iio_st_read_channel_scale(struct iio_channel *chan, int *val, - int *val2); +int iio_read_channel_scale(struct iio_channel *chan, int *val, + int *val2); #endif -- cgit v0.10.2 From 13d947db1c8e4e5c2114e809beef97ddf41b7006 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Sat, 5 May 2012 09:16:08 +0100 Subject: staging:iio:accel drop sysfs interface for resetting devices. There is no reason why userspace should want to do this manually. Hence, lets drop this abi. Signed-off-by: Jonathan Cameron Acked-by: Michael Hennerich diff --git a/drivers/staging/iio/accel/adis16201_core.c b/drivers/staging/iio/accel/adis16201_core.c index 02b3409..204106b 100644 --- a/drivers/staging/iio/accel/adis16201_core.c +++ b/drivers/staging/iio/accel/adis16201_core.c @@ -159,21 +159,6 @@ static int adis16201_reset(struct iio_dev *indio_dev) return ret; } -static ssize_t adis16201_write_reset(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) -{ - int ret; - bool res; - - if (len < 1) - return -EINVAL; - ret = strtobool(buf, &res); - if (ret || !res) - return ret; - return adis16201_reset(dev_to_iio_dev(dev)); -} - int adis16201_set_irq(struct iio_dev *indio_dev, bool enable) { int ret = 0; @@ -507,19 +492,7 @@ static struct iio_chan_spec adis16201_channels[] = { IIO_CHAN_SOFT_TIMESTAMP(7) }; -static IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, adis16201_write_reset, 0); - -static struct attribute *adis16201_attributes[] = { - &iio_dev_attr_reset.dev_attr.attr, - NULL -}; - -static const struct attribute_group adis16201_attribute_group = { - .attrs = adis16201_attributes, -}; - static const struct iio_info adis16201_info = { - .attrs = &adis16201_attribute_group, .read_raw = &adis16201_read_raw, .write_raw = &adis16201_write_raw, .driver_module = THIS_MODULE, diff --git a/drivers/staging/iio/accel/adis16203_core.c b/drivers/staging/iio/accel/adis16203_core.c index 15d46bf..22085e9 100644 --- a/drivers/staging/iio/accel/adis16203_core.c +++ b/drivers/staging/iio/accel/adis16203_core.c @@ -178,22 +178,6 @@ static int adis16203_reset(struct iio_dev *indio_dev) return ret; } -static ssize_t adis16203_write_reset(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) -{ - struct iio_dev *indio_dev = dev_to_iio_dev(dev); - if (len < 1) - return -EINVAL; - switch (buf[0]) { - case '1': - case 'y': - case 'Y': - return adis16203_reset(indio_dev); - } - return -EINVAL; -} - int adis16203_set_irq(struct iio_dev *indio_dev, bool enable) { int ret = 0; @@ -444,19 +428,7 @@ static struct iio_chan_spec adis16203_channels[] = { IIO_CHAN_SOFT_TIMESTAMP(5), }; -static IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, adis16203_write_reset, 0); - -static struct attribute *adis16203_attributes[] = { - &iio_dev_attr_reset.dev_attr.attr, - NULL -}; - -static const struct attribute_group adis16203_attribute_group = { - .attrs = adis16203_attributes, -}; - static const struct iio_info adis16203_info = { - .attrs = &adis16203_attribute_group, .read_raw = &adis16203_read_raw, .write_raw = &adis16203_write_raw, .driver_module = THIS_MODULE, diff --git a/drivers/staging/iio/accel/adis16204_core.c b/drivers/staging/iio/accel/adis16204_core.c index 457982b..685fa92 100644 --- a/drivers/staging/iio/accel/adis16204_core.c +++ b/drivers/staging/iio/accel/adis16204_core.c @@ -207,23 +207,6 @@ static int adis16204_reset(struct iio_dev *indio_dev) return ret; } -static ssize_t adis16204_write_reset(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) -{ - struct iio_dev *indio_dev = dev_to_iio_dev(dev); - - if (len < 1) - return -EINVAL; - switch (buf[0]) { - case '1': - case 'y': - case 'Y': - return adis16204_reset(indio_dev); - } - return -EINVAL; -} - int adis16204_set_irq(struct iio_dev *indio_dev, bool enable) { int ret = 0; @@ -310,8 +293,6 @@ static IIO_DEV_ATTR_ACCEL_XYPEAK(adis16204_read_14bit_signed, ADIS16204_XY_PEAK_OUT); static IIO_CONST_ATTR(in_accel_xy_scale, "0.017125"); -static IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, adis16204_write_reset, 0); - enum adis16204_channel { in_supply, in_aux, @@ -520,7 +501,6 @@ static struct iio_chan_spec adis16204_channels[] = { }; static struct attribute *adis16204_attributes[] = { - &iio_dev_attr_reset.dev_attr.attr, &iio_dev_attr_in_accel_xy.dev_attr.attr, &iio_dev_attr_in_accel_xypeak.dev_attr.attr, &iio_const_attr_in_accel_xy_scale.dev_attr.attr, diff --git a/drivers/staging/iio/accel/adis16209_core.c b/drivers/staging/iio/accel/adis16209_core.c index 6fc426e..4945705 100644 --- a/drivers/staging/iio/accel/adis16209_core.c +++ b/drivers/staging/iio/accel/adis16209_core.c @@ -153,23 +153,6 @@ static int adis16209_reset(struct iio_dev *indio_dev) return ret; } -static ssize_t adis16209_write_reset(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) -{ - struct iio_dev *indio_dev = dev_to_iio_dev(dev); - - if (len < 1) - return -EINVAL; - switch (buf[0]) { - case '1': - case 'y': - case 'Y': - return adis16209_reset(indio_dev); - } - return -EINVAL; -} - int adis16209_set_irq(struct iio_dev *indio_dev, bool enable) { int ret = 0; @@ -519,19 +502,7 @@ static struct iio_chan_spec adis16209_channels[] = { IIO_CHAN_SOFT_TIMESTAMP(8) }; -static IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, adis16209_write_reset, 0); - -static struct attribute *adis16209_attributes[] = { - &iio_dev_attr_reset.dev_attr.attr, - NULL -}; - -static const struct attribute_group adis16209_attribute_group = { - .attrs = adis16209_attributes, -}; - static const struct iio_info adis16209_info = { - .attrs = &adis16209_attribute_group, .read_raw = &adis16209_read_raw, .write_raw = &adis16209_write_raw, .driver_module = THIS_MODULE, diff --git a/drivers/staging/iio/accel/adis16220_core.c b/drivers/staging/iio/accel/adis16220_core.c index af5c576..575f1af 100644 --- a/drivers/staging/iio/accel/adis16220_core.c +++ b/drivers/staging/iio/accel/adis16220_core.c @@ -204,26 +204,6 @@ static int adis16220_reset(struct iio_dev *indio_dev) return ret; } -static ssize_t adis16220_write_reset(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) -{ - struct iio_dev *indio_dev = dev_to_iio_dev(dev); - bool val; - int ret; - - ret = strtobool(buf, &val); - if (ret) - return ret; - if (!val) - return -EINVAL; - - ret = adis16220_reset(indio_dev); - if (ret) - return ret; - return len; -} - static ssize_t adis16220_write_capture(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) @@ -454,9 +434,6 @@ static struct bin_attribute adc2_bin = { .size = ADIS16220_CAPTURE_SIZE, }; -static IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, - adis16220_write_reset, 0); - #define IIO_DEV_ATTR_CAPTURE(_store) \ IIO_DEVICE_ATTR(capture, S_IWUSR, NULL, _store, 0) @@ -611,7 +588,6 @@ static const struct iio_chan_spec adis16220_channels[] = { }; static struct attribute *adis16220_attributes[] = { - &iio_dev_attr_reset.dev_attr.attr, &iio_dev_attr_capture.dev_attr.attr, &iio_dev_attr_capture_count.dev_attr.attr, NULL diff --git a/drivers/staging/iio/accel/adis16240_core.c b/drivers/staging/iio/accel/adis16240_core.c index 1a51f03..b30b787 100644 --- a/drivers/staging/iio/accel/adis16240_core.c +++ b/drivers/staging/iio/accel/adis16240_core.c @@ -199,23 +199,6 @@ static int adis16240_reset(struct iio_dev *indio_dev) return ret; } -static ssize_t adis16240_write_reset(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) -{ - struct iio_dev *indio_dev = dev_to_iio_dev(dev); - - if (len < 1) - return -EINVAL; - switch (buf[0]) { - case '1': - case 'y': - case 'Y': - return adis16240_reset(indio_dev); - } - return -EINVAL; -} - int adis16240_set_irq(struct iio_dev *indio_dev, bool enable) { int ret = 0; @@ -329,8 +312,6 @@ static IIO_DEVICE_ATTR(in_accel_xyz_squared_peak_raw, S_IRUGO, adis16240_read_12bit_signed, NULL, ADIS16240_XYZPEAK_OUT); -static IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, adis16240_write_reset, 0); - static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("4096"); enum adis16240_chan { @@ -559,7 +540,6 @@ static struct iio_chan_spec adis16240_channels[] = { static struct attribute *adis16240_attributes[] = { &iio_dev_attr_in_accel_xyz_squared_peak_raw.dev_attr.attr, &iio_const_attr_sampling_frequency_available.dev_attr.attr, - &iio_dev_attr_reset.dev_attr.attr, NULL }; -- cgit v0.10.2 From 15a1a7530c3c411adbd9aed05f7bb43fbe9816c4 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Sat, 5 May 2012 09:19:09 +0100 Subject: staging:iio:gyro:adis16260 drop sysfs interface for manual device reset. There is no reason for userspace to do this, so lets drop this abi. Signed-off-by: Jonathan Cameron Acked-by: Michael Hennerich diff --git a/drivers/staging/iio/gyro/adis16260_core.c b/drivers/staging/iio/gyro/adis16260_core.c index fdb84cc..f16b393 100644 --- a/drivers/staging/iio/gyro/adis16260_core.c +++ b/drivers/staging/iio/gyro/adis16260_core.c @@ -233,22 +233,6 @@ static int adis16260_reset(struct iio_dev *indio_dev) return ret; } -static ssize_t adis16260_write_reset(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) -{ - struct iio_dev *indio_dev = dev_to_iio_dev(dev); - if (len < 1) - return -EINVAL; - switch (buf[0]) { - case '1': - case 'y': - case 'Y': - return adis16260_reset(indio_dev); - } - return -EINVAL; -} - int adis16260_set_irq(struct iio_dev *indio_dev, bool enable) { int ret; @@ -375,8 +359,6 @@ static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO, adis16260_read_frequency, adis16260_write_frequency); -static IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, adis16260_write_reset, 0); - static IIO_DEVICE_ATTR(sampling_frequency_available, S_IRUGO, adis16260_read_frequency_available, NULL, 0); @@ -604,7 +586,6 @@ static int adis16260_write_raw(struct iio_dev *indio_dev, static struct attribute *adis16260_attributes[] = { &iio_dev_attr_sampling_frequency.dev_attr.attr, &iio_dev_attr_sampling_frequency_available.dev_attr.attr, - &iio_dev_attr_reset.dev_attr.attr, NULL }; -- cgit v0.10.2 From 07c7f79ee1c7e6288c614ba88005a8de6dbaadff Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Sat, 5 May 2012 09:17:12 +0100 Subject: staging:iio:imu:adis16400 drop sysfs interface for manual device reset. There is no reason for userspace to do this, so lets drop this abi. Signed-off-by: Jonathan Cameron Acked-by: Michael Hennerich diff --git a/drivers/staging/iio/imu/adis16400_core.c b/drivers/staging/iio/imu/adis16400_core.c index 3873014..1f4c177 100644 --- a/drivers/staging/iio/imu/adis16400_core.c +++ b/drivers/staging/iio/imu/adis16400_core.c @@ -268,25 +268,6 @@ static int adis16400_reset(struct iio_dev *indio_dev) return ret; } -static ssize_t adis16400_write_reset(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) -{ - bool val; - int ret; - - ret = strtobool(buf, &val); - if (ret < 0) - return ret; - if (val) { - ret = adis16400_reset(dev_to_iio_dev(dev)); - if (ret < 0) - return ret; - } - - return len; -} - int adis16400_set_irq(struct iio_dev *indio_dev, bool enable) { int ret; @@ -454,8 +435,6 @@ static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO, adis16400_read_frequency, adis16400_write_frequency); -static IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, adis16400_write_reset, 0); - static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("409 546 819 1638"); enum adis16400_chan { @@ -1066,7 +1045,6 @@ static const struct iio_chan_spec adis16334_channels[] = { static struct attribute *adis16400_attributes[] = { &iio_dev_attr_sampling_frequency.dev_attr.attr, &iio_const_attr_sampling_frequency_available.dev_attr.attr, - &iio_dev_attr_reset.dev_attr.attr, NULL }; -- cgit v0.10.2 From 8f5879b20be7f918cdc4b3d831cfd8f3dc02c74c Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Sat, 5 May 2012 10:39:22 +0100 Subject: IIO: Add a modifier for sqrt(x^2+y^2) There will probably be a number of such modifiers eventually but this one is used in the adis16204 accelerometer driver. Signed-off-by: Jonathan Cameron diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index a5a446b..e42749e 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -70,6 +70,7 @@ static const char * const iio_modifier_names[] = { [IIO_MOD_X] = "x", [IIO_MOD_Y] = "y", [IIO_MOD_Z] = "z", + [IIO_MOD_ROOT_SUM_SQUARED_X_Y] = "sqrt(x^2+y^2)", [IIO_MOD_LIGHT_BOTH] = "both", [IIO_MOD_LIGHT_IR] = "ir", }; diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h index d086736..210559d 100644 --- a/include/linux/iio/types.h +++ b/include/linux/iio/types.h @@ -44,6 +44,7 @@ enum iio_modifier { IIO_MOD_X_OR_Y_OR_Z, IIO_MOD_LIGHT_BOTH, IIO_MOD_LIGHT_IR, + IIO_MOD_ROOT_SUM_SQUARED_X_Y, }; #define IIO_VAL_INT 1 -- cgit v0.10.2 From f699d10202d50a764614ff9191b5c4b9dd75e36c Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Sat, 5 May 2012 10:47:12 +0100 Subject: staging:iio:accel:adis16204 support the rss channel via chan spec. Reduces code and makes this channel available within the kernel. Note that it is not added to the buffer, thus maintaining the previous functionality of this driver. Signed-off-by: Jonathan Cameron Acked-by: Michael Hennerich diff --git a/drivers/staging/iio/accel/adis16204_core.c b/drivers/staging/iio/accel/adis16204_core.c index 685fa92..5f2e5f1 100644 --- a/drivers/staging/iio/accel/adis16204_core.c +++ b/drivers/staging/iio/accel/adis16204_core.c @@ -169,32 +169,6 @@ error_ret: return ret; } -static ssize_t adis16204_read_14bit_signed(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct iio_dev *indio_dev = dev_to_iio_dev(dev); - struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); - s16 val = 0; - ssize_t ret; - - mutex_lock(&indio_dev->mlock); - - ret = adis16204_spi_read_reg_16(indio_dev, - this_attr->address, (u16 *)&val); - if (!ret) { - if (val & ADIS16204_ERROR_ACTIVE) - adis16204_check_status(indio_dev); - - val = ((s16)(val << 2) >> 2); - ret = sprintf(buf, "%d\n", val); - } - - mutex_unlock(&indio_dev->mlock); - - return ret; -} - static int adis16204_reset(struct iio_dev *indio_dev) { int ret; @@ -282,16 +256,6 @@ err_ret: } /* Unique to this driver currently */ -#define IIO_DEV_ATTR_ACCEL_XY(_show, _addr) \ - IIO_DEVICE_ATTR(in_accel_xy, S_IRUGO, _show, NULL, _addr) -#define IIO_DEV_ATTR_ACCEL_XYPEAK(_show, _addr) \ - IIO_DEVICE_ATTR(in_accel_xypeak, S_IRUGO, _show, NULL, _addr) - -static IIO_DEV_ATTR_ACCEL_XY(adis16204_read_14bit_signed, - ADIS16204_XY_RSS_OUT); -static IIO_DEV_ATTR_ACCEL_XYPEAK(adis16204_read_14bit_signed, - ADIS16204_XY_PEAK_OUT); -static IIO_CONST_ATTR(in_accel_xy_scale, "0.017125"); enum adis16204_channel { in_supply, @@ -299,9 +263,10 @@ enum adis16204_channel { temp, accel_x, accel_y, + accel_xy, }; -static u8 adis16204_addresses[5][3] = { +static u8 adis16204_addresses[6][3] = { [in_supply] = { ADIS16204_SUPPLY_OUT }, [in_aux] = { ADIS16204_AUX_ADC }, [temp] = { ADIS16204_TEMP_OUT }, @@ -309,6 +274,8 @@ static u8 adis16204_addresses[5][3] = { ADIS16204_X_PEAK_OUT }, [accel_y] = { ADIS16204_XACCL_OUT, ADIS16204_YACCL_NULL, ADIS16204_Y_PEAK_OUT }, + [accel_xy] = { ADIS16204_XY_RSS_OUT, 0, + ADIS16204_XY_PEAK_OUT }, }; static int adis16204_read_raw(struct iio_dev *indio_dev, @@ -362,10 +329,16 @@ static int adis16204_read_raw(struct iio_dev *indio_dev, return IIO_VAL_INT_PLUS_MICRO; case IIO_ACCEL: *val = 0; - if (chan->channel2 == IIO_MOD_X) + switch (chan->channel2) { + case IIO_MOD_X: + case IIO_MOD_ROOT_SUM_SQUARED_X_Y: *val2 = 17125; - else + break; + case IIO_MOD_Y: + case IIO_MOD_Z: *val2 = 8407; + break; + } return IIO_VAL_INT_PLUS_MICRO; default: return -EINVAL; @@ -498,21 +471,23 @@ static struct iio_chan_spec adis16204_channels[] = { }, }, IIO_CHAN_SOFT_TIMESTAMP(5), -}; - -static struct attribute *adis16204_attributes[] = { - &iio_dev_attr_in_accel_xy.dev_attr.attr, - &iio_dev_attr_in_accel_xypeak.dev_attr.attr, - &iio_const_attr_in_accel_xy_scale.dev_attr.attr, - NULL -}; - -static const struct attribute_group adis16204_attribute_group = { - .attrs = adis16204_attributes, + { + .type = IIO_ACCEL, + .modified = 1, + .channel2 = IIO_MOD_ROOT_SUM_SQUARED_X_Y, + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | + IIO_CHAN_INFO_SCALE_SEPARATE_BIT | + IIO_CHAN_INFO_PEAK_SEPARATE_BIT, + .address = accel_xy, + .scan_type = { + .sign = 'u', + .realbits = 14, + .storagebits = 16, + }, + } }; static const struct iio_info adis16204_info = { - .attrs = &adis16204_attribute_group, .read_raw = &adis16204_read_raw, .write_raw = &adis16204_write_raw, .driver_module = THIS_MODULE, @@ -549,7 +524,7 @@ static int __devinit adis16204_probe(struct spi_device *spi) ret = iio_buffer_register(indio_dev, adis16204_channels, - ARRAY_SIZE(adis16204_channels)); + 6); if (ret) { printk(KERN_ERR "failed to initialize the ring\n"); goto error_unreg_ring_funcs; -- cgit v0.10.2 From cf82cb8128496955a38fa62e1819ceb1d596e2eb Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Sat, 5 May 2012 10:56:41 +0100 Subject: IIO: Add a modifier for x^2+y^2+z^2 There will probably be a number of such modifiers eventually but this one is used in the adis16240 accelerometer driver. Signed-off-by: Jonathan Cameron diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index e42749e..bb3c692 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -71,6 +71,7 @@ static const char * const iio_modifier_names[] = { [IIO_MOD_Y] = "y", [IIO_MOD_Z] = "z", [IIO_MOD_ROOT_SUM_SQUARED_X_Y] = "sqrt(x^2+y^2)", + [IIO_MOD_SUM_SQUARED_X_Y_Z] = "x^2+y^2+z^2", [IIO_MOD_LIGHT_BOTH] = "both", [IIO_MOD_LIGHT_IR] = "ir", }; diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h index 210559d..e250401 100644 --- a/include/linux/iio/types.h +++ b/include/linux/iio/types.h @@ -45,6 +45,7 @@ enum iio_modifier { IIO_MOD_LIGHT_BOTH, IIO_MOD_LIGHT_IR, IIO_MOD_ROOT_SUM_SQUARED_X_Y, + IIO_MOD_SUM_SQUARED_X_Y_Z, }; #define IIO_VAL_INT 1 -- cgit v0.10.2 From e74f209ca99568865dfca5a456a114734cb7ef8c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 17:46:44 -0700 Subject: staging: comedi: cb_pcidas: remove forward declarations 1 Move the attach/detach functions to remove the need for some of the forward declarations. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index e2bf222..5460410 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -447,37 +447,9 @@ struct cb_pcidas_private { */ #define devpriv ((struct cb_pcidas_private *)dev->private) -static int cb_pcidas_ai_rinsn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int ai_config_insn(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int cb_pcidas_ao_nofifo_winsn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data); -static int cb_pcidas_ao_fifo_winsn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data); -static int cb_pcidas_ao_readback_insn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data); -static int cb_pcidas_ai_cmd(struct comedi_device *dev, - struct comedi_subdevice *s); -static int cb_pcidas_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_cmd *cmd); -static int cb_pcidas_ao_cmd(struct comedi_device *dev, - struct comedi_subdevice *s); static int cb_pcidas_ao_inttrig(struct comedi_device *dev, struct comedi_subdevice *subdev, unsigned int trig_num); -static int cb_pcidas_ao_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_cmd *cmd); -static irqreturn_t cb_pcidas_interrupt(int irq, void *d); static void handle_ao_interrupt(struct comedi_device *dev, unsigned int status); static int cb_pcidas_cancel(struct comedi_device *dev, struct comedi_subdevice *s); @@ -485,30 +457,6 @@ static int cb_pcidas_ao_cancel(struct comedi_device *dev, struct comedi_subdevice *s); static void cb_pcidas_load_counters(struct comedi_device *dev, unsigned int *ns, int round_flags); -static int eeprom_read_insn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int caldac_read_insn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int caldac_write_insn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int trimpot_read_insn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int cb_pcidas_trimpot_write(struct comedi_device *dev, - unsigned int channel, unsigned int value); -static int trimpot_write_insn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int dac08_read_insn(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, - unsigned int *data); -static int dac08_write(struct comedi_device *dev, unsigned int value); -static int dac08_write_insn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); static int caldac_8800_write(struct comedi_device *dev, unsigned int address, uint8_t value); static int trimpot_7376_write(struct comedi_device *dev, uint8_t value); @@ -523,229 +471,6 @@ static inline unsigned int cal_enable_bits(struct comedi_device *dev) } /* - * Attach is called by the Comedi core to configure the driver - * for a particular board. - */ -static int cb_pcidas_attach(struct comedi_device *dev, - struct comedi_devconfig *it) -{ - struct comedi_subdevice *s; - struct pci_dev *pcidev = NULL; - int index; - int i; - int ret; - -/* - * Allocate the private structure area. - */ - if (alloc_private(dev, sizeof(struct cb_pcidas_private)) < 0) - return -ENOMEM; - -/* - * Probe the device to determine what device in the series it is. - */ - - for_each_pci_dev(pcidev) { - /* is it not a computer boards card? */ - if (pcidev->vendor != PCI_VENDOR_ID_CB) - continue; - /* loop through cards supported by this driver */ - for (index = 0; index < ARRAY_SIZE(cb_pcidas_boards); index++) { - if (cb_pcidas_boards[index].device_id != pcidev->device) - continue; - /* was a particular bus/slot requested? */ - if (it->options[0] || it->options[1]) { - /* are we on the wrong bus/slot? */ - if (pcidev->bus->number != it->options[0] || - PCI_SLOT(pcidev->devfn) != it->options[1]) { - continue; - } - } - devpriv->pci_dev = pcidev; - dev->board_ptr = cb_pcidas_boards + index; - goto found; - } - } - - dev_err(dev->class_dev, - "No supported ComputerBoards/MeasurementComputing card found on requested position\n"); - return -EIO; - -found: - - dev_dbg(dev->class_dev, "Found %s on bus %i, slot %i\n", - cb_pcidas_boards[index].name, pcidev->bus->number, - PCI_SLOT(pcidev->devfn)); - - /* - * Enable PCI device and reserve I/O ports. - */ - if (comedi_pci_enable(pcidev, "cb_pcidas")) { - dev_err(dev->class_dev, - "Failed to enable PCI device and request regions\n"); - return -EIO; - } - /* - * Initialize devpriv->control_status and devpriv->adc_fifo to point to - * their base address. - */ - devpriv->s5933_config = - pci_resource_start(devpriv->pci_dev, S5933_BADRINDEX); - devpriv->control_status = - pci_resource_start(devpriv->pci_dev, CONT_STAT_BADRINDEX); - devpriv->adc_fifo = - pci_resource_start(devpriv->pci_dev, ADC_FIFO_BADRINDEX); - devpriv->pacer_counter_dio = - pci_resource_start(devpriv->pci_dev, PACER_BADRINDEX); - if (thisboard->ao_nchan) { - devpriv->ao_registers = - pci_resource_start(devpriv->pci_dev, AO_BADRINDEX); - } - /* disable and clear interrupts on amcc s5933 */ - outl(INTCSR_INBOX_INTR_STATUS, - devpriv->s5933_config + AMCC_OP_REG_INTCSR); - - /* get irq */ - if (request_irq(devpriv->pci_dev->irq, cb_pcidas_interrupt, - IRQF_SHARED, "cb_pcidas", dev)) { - dev_dbg(dev->class_dev, "unable to allocate irq %d\n", - devpriv->pci_dev->irq); - return -EINVAL; - } - dev->irq = devpriv->pci_dev->irq; - - /* Initialize dev->board_name */ - dev->board_name = thisboard->name; - - ret = comedi_alloc_subdevices(dev, 7); - if (ret) - return ret; - - s = dev->subdevices + 0; - /* analog input subdevice */ - dev->read_subdev = s; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF | SDF_CMD_READ; - /* WARNING: Number of inputs in differential mode is ignored */ - s->n_chan = thisboard->ai_se_chans; - s->len_chanlist = thisboard->ai_se_chans; - s->maxdata = (1 << thisboard->ai_bits) - 1; - s->range_table = thisboard->ranges; - s->insn_read = cb_pcidas_ai_rinsn; - s->insn_config = ai_config_insn; - s->do_cmd = cb_pcidas_ai_cmd; - s->do_cmdtest = cb_pcidas_ai_cmdtest; - s->cancel = cb_pcidas_cancel; - - /* analog output subdevice */ - s = dev->subdevices + 1; - if (thisboard->ao_nchan) { - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_GROUND; - s->n_chan = thisboard->ao_nchan; - /* analog out resolution is the same as analog input resolution, so use ai_bits */ - s->maxdata = (1 << thisboard->ai_bits) - 1; - s->range_table = &cb_pcidas_ao_ranges; - s->insn_read = cb_pcidas_ao_readback_insn; - if (thisboard->has_ao_fifo) { - dev->write_subdev = s; - s->subdev_flags |= SDF_CMD_WRITE; - s->insn_write = cb_pcidas_ao_fifo_winsn; - s->do_cmdtest = cb_pcidas_ao_cmdtest; - s->do_cmd = cb_pcidas_ao_cmd; - s->cancel = cb_pcidas_ao_cancel; - } else { - s->insn_write = cb_pcidas_ao_nofifo_winsn; - } - } else { - s->type = COMEDI_SUBD_UNUSED; - } - - /* 8255 */ - s = dev->subdevices + 2; - subdev_8255_init(dev, s, NULL, devpriv->pacer_counter_dio + DIO_8255); - - /* serial EEPROM, */ - s = dev->subdevices + 3; - s->type = COMEDI_SUBD_MEMORY; - s->subdev_flags = SDF_READABLE | SDF_INTERNAL; - s->n_chan = 256; - s->maxdata = 0xff; - s->insn_read = eeprom_read_insn; - - /* 8800 caldac */ - s = dev->subdevices + 4; - s->type = COMEDI_SUBD_CALIB; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; - s->n_chan = NUM_CHANNELS_8800; - s->maxdata = 0xff; - s->insn_read = caldac_read_insn; - s->insn_write = caldac_write_insn; - for (i = 0; i < s->n_chan; i++) - caldac_8800_write(dev, i, s->maxdata / 2); - - /* trim potentiometer */ - s = dev->subdevices + 5; - s->type = COMEDI_SUBD_CALIB; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; - if (thisboard->trimpot == AD7376) { - s->n_chan = NUM_CHANNELS_7376; - s->maxdata = 0x7f; - } else { - s->n_chan = NUM_CHANNELS_8402; - s->maxdata = 0xff; - } - s->insn_read = trimpot_read_insn; - s->insn_write = trimpot_write_insn; - for (i = 0; i < s->n_chan; i++) - cb_pcidas_trimpot_write(dev, i, s->maxdata / 2); - - /* dac08 caldac */ - s = dev->subdevices + 6; - if (thisboard->has_dac08) { - s->type = COMEDI_SUBD_CALIB; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; - s->n_chan = NUM_CHANNELS_DAC08; - s->insn_read = dac08_read_insn; - s->insn_write = dac08_write_insn; - s->maxdata = 0xff; - dac08_write(dev, s->maxdata / 2); - } else - s->type = COMEDI_SUBD_UNUSED; - - /* make sure mailbox 4 is empty */ - inl(devpriv->s5933_config + AMCC_OP_REG_IMB4); - /* Set bits to enable incoming mailbox interrupts on amcc s5933. */ - devpriv->s5933_intcsr_bits = - INTCSR_INBOX_BYTE(3) | INTCSR_INBOX_SELECT(3) | - INTCSR_INBOX_FULL_INT; - /* clear and enable interrupt on amcc s5933 */ - outl(devpriv->s5933_intcsr_bits | INTCSR_INBOX_INTR_STATUS, - devpriv->s5933_config + AMCC_OP_REG_INTCSR); - - return 1; -} - -static void cb_pcidas_detach(struct comedi_device *dev) -{ - if (devpriv) { - if (devpriv->s5933_config) { - outl(INTCSR_INBOX_INTR_STATUS, - devpriv->s5933_config + AMCC_OP_REG_INTCSR); - } - } - if (dev->irq) - free_irq(dev->irq, dev); - if (dev->subdevices) - subdev_8255_cleanup(dev, dev->subdevices + 2); - if (devpriv && devpriv->pci_dev) { - if (devpriv->s5933_config) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); - } -} - -/* * "instructions" read/write data in "one-shot" or "software-triggered" * mode. */ @@ -1872,6 +1597,225 @@ static int nvram_read(struct comedi_device *dev, unsigned int address, return 0; } +static int cb_pcidas_attach(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + struct comedi_subdevice *s; + struct pci_dev *pcidev = NULL; + int index; + int i; + int ret; + +/* + * Allocate the private structure area. + */ + if (alloc_private(dev, sizeof(struct cb_pcidas_private)) < 0) + return -ENOMEM; + +/* + * Probe the device to determine what device in the series it is. + */ + + for_each_pci_dev(pcidev) { + /* is it not a computer boards card? */ + if (pcidev->vendor != PCI_VENDOR_ID_CB) + continue; + /* loop through cards supported by this driver */ + for (index = 0; index < ARRAY_SIZE(cb_pcidas_boards); index++) { + if (cb_pcidas_boards[index].device_id != pcidev->device) + continue; + /* was a particular bus/slot requested? */ + if (it->options[0] || it->options[1]) { + /* are we on the wrong bus/slot? */ + if (pcidev->bus->number != it->options[0] || + PCI_SLOT(pcidev->devfn) != it->options[1]) { + continue; + } + } + devpriv->pci_dev = pcidev; + dev->board_ptr = cb_pcidas_boards + index; + goto found; + } + } + + dev_err(dev->class_dev, + "No supported ComputerBoards/MeasurementComputing card found on requested position\n"); + return -EIO; + +found: + + dev_dbg(dev->class_dev, "Found %s on bus %i, slot %i\n", + cb_pcidas_boards[index].name, pcidev->bus->number, + PCI_SLOT(pcidev->devfn)); + + /* + * Enable PCI device and reserve I/O ports. + */ + if (comedi_pci_enable(pcidev, "cb_pcidas")) { + dev_err(dev->class_dev, + "Failed to enable PCI device and request regions\n"); + return -EIO; + } + /* + * Initialize devpriv->control_status and devpriv->adc_fifo to point to + * their base address. + */ + devpriv->s5933_config = + pci_resource_start(devpriv->pci_dev, S5933_BADRINDEX); + devpriv->control_status = + pci_resource_start(devpriv->pci_dev, CONT_STAT_BADRINDEX); + devpriv->adc_fifo = + pci_resource_start(devpriv->pci_dev, ADC_FIFO_BADRINDEX); + devpriv->pacer_counter_dio = + pci_resource_start(devpriv->pci_dev, PACER_BADRINDEX); + if (thisboard->ao_nchan) { + devpriv->ao_registers = + pci_resource_start(devpriv->pci_dev, AO_BADRINDEX); + } + /* disable and clear interrupts on amcc s5933 */ + outl(INTCSR_INBOX_INTR_STATUS, + devpriv->s5933_config + AMCC_OP_REG_INTCSR); + + /* get irq */ + if (request_irq(devpriv->pci_dev->irq, cb_pcidas_interrupt, + IRQF_SHARED, "cb_pcidas", dev)) { + dev_dbg(dev->class_dev, "unable to allocate irq %d\n", + devpriv->pci_dev->irq); + return -EINVAL; + } + dev->irq = devpriv->pci_dev->irq; + + /* Initialize dev->board_name */ + dev->board_name = thisboard->name; + + ret = comedi_alloc_subdevices(dev, 7); + if (ret) + return ret; + + s = dev->subdevices + 0; + /* analog input subdevice */ + dev->read_subdev = s; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF | SDF_CMD_READ; + /* WARNING: Number of inputs in differential mode is ignored */ + s->n_chan = thisboard->ai_se_chans; + s->len_chanlist = thisboard->ai_se_chans; + s->maxdata = (1 << thisboard->ai_bits) - 1; + s->range_table = thisboard->ranges; + s->insn_read = cb_pcidas_ai_rinsn; + s->insn_config = ai_config_insn; + s->do_cmd = cb_pcidas_ai_cmd; + s->do_cmdtest = cb_pcidas_ai_cmdtest; + s->cancel = cb_pcidas_cancel; + + /* analog output subdevice */ + s = dev->subdevices + 1; + if (thisboard->ao_nchan) { + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_GROUND; + s->n_chan = thisboard->ao_nchan; + /* analog out resolution is the same as analog input resolution, so use ai_bits */ + s->maxdata = (1 << thisboard->ai_bits) - 1; + s->range_table = &cb_pcidas_ao_ranges; + s->insn_read = cb_pcidas_ao_readback_insn; + if (thisboard->has_ao_fifo) { + dev->write_subdev = s; + s->subdev_flags |= SDF_CMD_WRITE; + s->insn_write = cb_pcidas_ao_fifo_winsn; + s->do_cmdtest = cb_pcidas_ao_cmdtest; + s->do_cmd = cb_pcidas_ao_cmd; + s->cancel = cb_pcidas_ao_cancel; + } else { + s->insn_write = cb_pcidas_ao_nofifo_winsn; + } + } else { + s->type = COMEDI_SUBD_UNUSED; + } + + /* 8255 */ + s = dev->subdevices + 2; + subdev_8255_init(dev, s, NULL, devpriv->pacer_counter_dio + DIO_8255); + + /* serial EEPROM, */ + s = dev->subdevices + 3; + s->type = COMEDI_SUBD_MEMORY; + s->subdev_flags = SDF_READABLE | SDF_INTERNAL; + s->n_chan = 256; + s->maxdata = 0xff; + s->insn_read = eeprom_read_insn; + + /* 8800 caldac */ + s = dev->subdevices + 4; + s->type = COMEDI_SUBD_CALIB; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; + s->n_chan = NUM_CHANNELS_8800; + s->maxdata = 0xff; + s->insn_read = caldac_read_insn; + s->insn_write = caldac_write_insn; + for (i = 0; i < s->n_chan; i++) + caldac_8800_write(dev, i, s->maxdata / 2); + + /* trim potentiometer */ + s = dev->subdevices + 5; + s->type = COMEDI_SUBD_CALIB; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; + if (thisboard->trimpot == AD7376) { + s->n_chan = NUM_CHANNELS_7376; + s->maxdata = 0x7f; + } else { + s->n_chan = NUM_CHANNELS_8402; + s->maxdata = 0xff; + } + s->insn_read = trimpot_read_insn; + s->insn_write = trimpot_write_insn; + for (i = 0; i < s->n_chan; i++) + cb_pcidas_trimpot_write(dev, i, s->maxdata / 2); + + /* dac08 caldac */ + s = dev->subdevices + 6; + if (thisboard->has_dac08) { + s->type = COMEDI_SUBD_CALIB; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; + s->n_chan = NUM_CHANNELS_DAC08; + s->insn_read = dac08_read_insn; + s->insn_write = dac08_write_insn; + s->maxdata = 0xff; + dac08_write(dev, s->maxdata / 2); + } else + s->type = COMEDI_SUBD_UNUSED; + + /* make sure mailbox 4 is empty */ + inl(devpriv->s5933_config + AMCC_OP_REG_IMB4); + /* Set bits to enable incoming mailbox interrupts on amcc s5933. */ + devpriv->s5933_intcsr_bits = + INTCSR_INBOX_BYTE(3) | INTCSR_INBOX_SELECT(3) | + INTCSR_INBOX_FULL_INT; + /* clear and enable interrupt on amcc s5933 */ + outl(devpriv->s5933_intcsr_bits | INTCSR_INBOX_INTR_STATUS, + devpriv->s5933_config + AMCC_OP_REG_INTCSR); + + return 1; +} + +static void cb_pcidas_detach(struct comedi_device *dev) +{ + if (devpriv) { + if (devpriv->s5933_config) { + outl(INTCSR_INBOX_INTR_STATUS, + devpriv->s5933_config + AMCC_OP_REG_INTCSR); + } + } + if (dev->irq) + free_irq(dev->irq, dev); + if (dev->subdevices) + subdev_8255_cleanup(dev, dev->subdevices + 2); + if (devpriv && devpriv->pci_dev) { + if (devpriv->s5933_config) + comedi_pci_disable(devpriv->pci_dev); + pci_dev_put(devpriv->pci_dev); + } +} + static struct comedi_driver cb_pcidas_driver = { .driver_name = "cb_pcidas", .module = THIS_MODULE, -- cgit v0.10.2 From 1706fcc18b8e27f2e8895b6ced83112ab8a0ad20 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 17:47:28 -0700 Subject: staging: comedi: cb_pcidas: remove forward declarations 2 Move the cb_pcidas_ao_inttrig function to remove the need for the forward declaration. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 5460410..e94a6b1 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -447,9 +447,6 @@ struct cb_pcidas_private { */ #define devpriv ((struct cb_pcidas_private *)dev->private) -static int cb_pcidas_ao_inttrig(struct comedi_device *dev, - struct comedi_subdevice *subdev, - unsigned int trig_num); static void handle_ao_interrupt(struct comedi_device *dev, unsigned int status); static int cb_pcidas_cancel(struct comedi_device *dev, struct comedi_subdevice *s); @@ -1132,6 +1129,56 @@ static int cb_pcidas_ao_cmdtest(struct comedi_device *dev, return 0; } +static int cb_pcidas_ao_inttrig(struct comedi_device *dev, + struct comedi_subdevice *s, + unsigned int trig_num) +{ + unsigned int num_bytes, num_points = thisboard->fifo_size; + struct comedi_async *async = s->async; + struct comedi_cmd *cmd = &s->async->cmd; + unsigned long flags; + + if (trig_num != 0) + return -EINVAL; + + /* load up fifo */ + if (cmd->stop_src == TRIG_COUNT && devpriv->ao_count < num_points) + num_points = devpriv->ao_count; + + num_bytes = cfc_read_array_from_buffer(s, devpriv->ao_buffer, + num_points * sizeof(short)); + num_points = num_bytes / sizeof(short); + + if (cmd->stop_src == TRIG_COUNT) + devpriv->ao_count -= num_points; + /* write data to board's fifo */ + outsw(devpriv->ao_registers + DACDATA, devpriv->ao_buffer, num_bytes); + + /* enable dac half-full and empty interrupts */ + spin_lock_irqsave(&dev->spinlock, flags); + devpriv->adc_fifo_bits |= DAEMIE | DAHFIE; +#ifdef CB_PCIDAS_DEBUG + dev_dbg(dev->class_dev, "adc_fifo_bits are 0x%x\n", + devpriv->adc_fifo_bits); +#endif + /* enable and clear interrupts */ + outw(devpriv->adc_fifo_bits | DAEMI | DAHFI, + devpriv->control_status + INT_ADCFIFO); + + /* start dac */ + devpriv->ao_control_bits |= DAC_START | DACEN | DAC_EMPTY; + outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR); +#ifdef CB_PCIDAS_DEBUG + dev_dbg(dev->class_dev, "sent 0x%x to dac control\n", + devpriv->ao_control_bits); +#endif + spin_unlock_irqrestore(&dev->spinlock, flags); + + async->inttrig = NULL; + + return 0; +} + static int cb_pcidas_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { @@ -1198,56 +1245,6 @@ static int cb_pcidas_ao_cmd(struct comedi_device *dev, return 0; } -static int cb_pcidas_ao_inttrig(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned int trig_num) -{ - unsigned int num_bytes, num_points = thisboard->fifo_size; - struct comedi_async *async = s->async; - struct comedi_cmd *cmd = &s->async->cmd; - unsigned long flags; - - if (trig_num != 0) - return -EINVAL; - - /* load up fifo */ - if (cmd->stop_src == TRIG_COUNT && devpriv->ao_count < num_points) - num_points = devpriv->ao_count; - - num_bytes = cfc_read_array_from_buffer(s, devpriv->ao_buffer, - num_points * sizeof(short)); - num_points = num_bytes / sizeof(short); - - if (cmd->stop_src == TRIG_COUNT) - devpriv->ao_count -= num_points; - /* write data to board's fifo */ - outsw(devpriv->ao_registers + DACDATA, devpriv->ao_buffer, num_bytes); - - /* enable dac half-full and empty interrupts */ - spin_lock_irqsave(&dev->spinlock, flags); - devpriv->adc_fifo_bits |= DAEMIE | DAHFIE; -#ifdef CB_PCIDAS_DEBUG - dev_dbg(dev->class_dev, "adc_fifo_bits are 0x%x\n", - devpriv->adc_fifo_bits); -#endif - /* enable and clear interrupts */ - outw(devpriv->adc_fifo_bits | DAEMI | DAHFI, - devpriv->control_status + INT_ADCFIFO); - - /* start dac */ - devpriv->ao_control_bits |= DAC_START | DACEN | DAC_EMPTY; - outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR); -#ifdef CB_PCIDAS_DEBUG - dev_dbg(dev->class_dev, "sent 0x%x to dac control\n", - devpriv->ao_control_bits); -#endif - spin_unlock_irqrestore(&dev->spinlock, flags); - - async->inttrig = NULL; - - return 0; -} - static irqreturn_t cb_pcidas_interrupt(int irq, void *d) { struct comedi_device *dev = (struct comedi_device *)d; -- cgit v0.10.2 From 9e11d05f89b44e5f2672a74e5fe0f7eced7a4cad Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 17:48:05 -0700 Subject: staging: comedi: cb_pcidas: remove forward declarations 3 Move the handle_ao_interrupt function to remove the need for the forward declaration. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index e94a6b1..584f85b 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -447,7 +447,6 @@ struct cb_pcidas_private { */ #define devpriv ((struct cb_pcidas_private *)dev->private) -static void handle_ao_interrupt(struct comedi_device *dev, unsigned int status); static int cb_pcidas_cancel(struct comedi_device *dev, struct comedi_subdevice *s); static int cb_pcidas_ao_cancel(struct comedi_device *dev, @@ -1245,6 +1244,61 @@ static int cb_pcidas_ao_cmd(struct comedi_device *dev, return 0; } +static void handle_ao_interrupt(struct comedi_device *dev, unsigned int status) +{ + struct comedi_subdevice *s = dev->write_subdev; + struct comedi_async *async = s->async; + struct comedi_cmd *cmd = &async->cmd; + unsigned int half_fifo = thisboard->fifo_size / 2; + unsigned int num_points; + unsigned long flags; + + async->events = 0; + + if (status & DAEMI) { + /* clear dac empty interrupt latch */ + spin_lock_irqsave(&dev->spinlock, flags); + outw(devpriv->adc_fifo_bits | DAEMI, + devpriv->control_status + INT_ADCFIFO); + spin_unlock_irqrestore(&dev->spinlock, flags); + if (inw(devpriv->ao_registers + DAC_CSR) & DAC_EMPTY) { + if (cmd->stop_src == TRIG_NONE || + (cmd->stop_src == TRIG_COUNT + && devpriv->ao_count)) { + comedi_error(dev, "dac fifo underflow"); + cb_pcidas_ao_cancel(dev, s); + async->events |= COMEDI_CB_ERROR; + } + async->events |= COMEDI_CB_EOA; + } + } else if (status & DAHFI) { + unsigned int num_bytes; + + /* figure out how many points we are writing to fifo */ + num_points = half_fifo; + if (cmd->stop_src == TRIG_COUNT && + devpriv->ao_count < num_points) + num_points = devpriv->ao_count; + num_bytes = + cfc_read_array_from_buffer(s, devpriv->ao_buffer, + num_points * sizeof(short)); + num_points = num_bytes / sizeof(short); + + if (async->cmd.stop_src == TRIG_COUNT) + devpriv->ao_count -= num_points; + /* write data to board's fifo */ + outsw(devpriv->ao_registers + DACDATA, devpriv->ao_buffer, + num_points); + /* clear half-full interrupt latch */ + spin_lock_irqsave(&dev->spinlock, flags); + outw(devpriv->adc_fifo_bits | DAHFI, + devpriv->control_status + INT_ADCFIFO); + spin_unlock_irqrestore(&dev->spinlock, flags); + } + + comedi_event(dev, s); +} + static irqreturn_t cb_pcidas_interrupt(int irq, void *d) { struct comedi_device *dev = (struct comedi_device *)d; @@ -1355,61 +1409,6 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d) return IRQ_HANDLED; } -static void handle_ao_interrupt(struct comedi_device *dev, unsigned int status) -{ - struct comedi_subdevice *s = dev->write_subdev; - struct comedi_async *async = s->async; - struct comedi_cmd *cmd = &async->cmd; - unsigned int half_fifo = thisboard->fifo_size / 2; - unsigned int num_points; - unsigned long flags; - - async->events = 0; - - if (status & DAEMI) { - /* clear dac empty interrupt latch */ - spin_lock_irqsave(&dev->spinlock, flags); - outw(devpriv->adc_fifo_bits | DAEMI, - devpriv->control_status + INT_ADCFIFO); - spin_unlock_irqrestore(&dev->spinlock, flags); - if (inw(devpriv->ao_registers + DAC_CSR) & DAC_EMPTY) { - if (cmd->stop_src == TRIG_NONE || - (cmd->stop_src == TRIG_COUNT - && devpriv->ao_count)) { - comedi_error(dev, "dac fifo underflow"); - cb_pcidas_ao_cancel(dev, s); - async->events |= COMEDI_CB_ERROR; - } - async->events |= COMEDI_CB_EOA; - } - } else if (status & DAHFI) { - unsigned int num_bytes; - - /* figure out how many points we are writing to fifo */ - num_points = half_fifo; - if (cmd->stop_src == TRIG_COUNT && - devpriv->ao_count < num_points) - num_points = devpriv->ao_count; - num_bytes = - cfc_read_array_from_buffer(s, devpriv->ao_buffer, - num_points * sizeof(short)); - num_points = num_bytes / sizeof(short); - - if (async->cmd.stop_src == TRIG_COUNT) - devpriv->ao_count -= num_points; - /* write data to board's fifo */ - outsw(devpriv->ao_registers + DACDATA, devpriv->ao_buffer, - num_points); - /* clear half-full interrupt latch */ - spin_lock_irqsave(&dev->spinlock, flags); - outw(devpriv->adc_fifo_bits | DAHFI, - devpriv->control_status + INT_ADCFIFO); - spin_unlock_irqrestore(&dev->spinlock, flags); - } - - comedi_event(dev, s); -} - /* cancel analog input command */ static int cb_pcidas_cancel(struct comedi_device *dev, struct comedi_subdevice *s) -- cgit v0.10.2 From 9a0f7631f26cd9d9fc9f8fd1513427e13912a63c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 17:48:43 -0700 Subject: staging: comedi: cb_pcidas: remove forward declarations 4 Move the cb_pcida_cancel function to remove the need for the forward declaration. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 584f85b..fa3ed0e 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -447,8 +447,6 @@ struct cb_pcidas_private { */ #define devpriv ((struct cb_pcidas_private *)dev->private) -static int cb_pcidas_cancel(struct comedi_device *dev, - struct comedi_subdevice *s); static int cb_pcidas_ao_cancel(struct comedi_device *dev, struct comedi_subdevice *s); static void cb_pcidas_load_counters(struct comedi_device *dev, unsigned int *ns, @@ -1128,6 +1126,26 @@ static int cb_pcidas_ao_cmdtest(struct comedi_device *dev, return 0; } +/* cancel analog input command */ +static int cb_pcidas_cancel(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + unsigned long flags; + + spin_lock_irqsave(&dev->spinlock, flags); + /* disable interrupts */ + devpriv->adc_fifo_bits &= ~INTE & ~EOAIE; + outw(devpriv->adc_fifo_bits, devpriv->control_status + INT_ADCFIFO); + spin_unlock_irqrestore(&dev->spinlock, flags); + + /* disable start trigger source and burst mode */ + outw(0, devpriv->control_status + TRIG_CONTSTAT); + /* software pacer source */ + outw(0, devpriv->control_status + ADCMUX_CONT); + + return 0; +} + static int cb_pcidas_ao_inttrig(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int trig_num) @@ -1409,26 +1427,6 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d) return IRQ_HANDLED; } -/* cancel analog input command */ -static int cb_pcidas_cancel(struct comedi_device *dev, - struct comedi_subdevice *s) -{ - unsigned long flags; - - spin_lock_irqsave(&dev->spinlock, flags); - /* disable interrupts */ - devpriv->adc_fifo_bits &= ~INTE & ~EOAIE; - outw(devpriv->adc_fifo_bits, devpriv->control_status + INT_ADCFIFO); - spin_unlock_irqrestore(&dev->spinlock, flags); - - /* disable start trigger source and burst mode */ - outw(0, devpriv->control_status + TRIG_CONTSTAT); - /* software pacer source */ - outw(0, devpriv->control_status + ADCMUX_CONT); - - return 0; -} - /* cancel analog output command */ static int cb_pcidas_ao_cancel(struct comedi_device *dev, struct comedi_subdevice *s) -- cgit v0.10.2 From 0aa2030467e4dfad59aef42211728221a973c329 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 17:49:22 -0700 Subject: staging: comedi: cb_pcidas: remove forward declarations 5 Move the cb_pcida_ao_cancel function to remove the need for the forward declaration. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index fa3ed0e..2457408 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -447,8 +447,6 @@ struct cb_pcidas_private { */ #define devpriv ((struct cb_pcidas_private *)dev->private) -static int cb_pcidas_ao_cancel(struct comedi_device *dev, - struct comedi_subdevice *s); static void cb_pcidas_load_counters(struct comedi_device *dev, unsigned int *ns, int round_flags); static int caldac_8800_write(struct comedi_device *dev, unsigned int address, @@ -1262,6 +1260,25 @@ static int cb_pcidas_ao_cmd(struct comedi_device *dev, return 0; } +/* cancel analog output command */ +static int cb_pcidas_ao_cancel(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + unsigned long flags; + + spin_lock_irqsave(&dev->spinlock, flags); + /* disable interrupts */ + devpriv->adc_fifo_bits &= ~DAHFIE & ~DAEMIE; + outw(devpriv->adc_fifo_bits, devpriv->control_status + INT_ADCFIFO); + + /* disable output */ + devpriv->ao_control_bits &= ~DACEN & ~DAC_PACER_MASK; + outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR); + spin_unlock_irqrestore(&dev->spinlock, flags); + + return 0; +} + static void handle_ao_interrupt(struct comedi_device *dev, unsigned int status) { struct comedi_subdevice *s = dev->write_subdev; @@ -1427,25 +1444,6 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d) return IRQ_HANDLED; } -/* cancel analog output command */ -static int cb_pcidas_ao_cancel(struct comedi_device *dev, - struct comedi_subdevice *s) -{ - unsigned long flags; - - spin_lock_irqsave(&dev->spinlock, flags); - /* disable interrupts */ - devpriv->adc_fifo_bits &= ~DAHFIE & ~DAEMIE; - outw(devpriv->adc_fifo_bits, devpriv->control_status + INT_ADCFIFO); - - /* disable output */ - devpriv->ao_control_bits &= ~DACEN & ~DAC_PACER_MASK; - outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR); - spin_unlock_irqrestore(&dev->spinlock, flags); - - return 0; -} - static void cb_pcidas_load_counters(struct comedi_device *dev, unsigned int *ns, int rounding_flags) { -- cgit v0.10.2 From bb03694323561da47fb6a15d977a0b5275134cdd Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 17:49:58 -0700 Subject: staging: comedi: cb_pcidas: remove forward declarations 6 Move the cb_pcidas_load_counters function to remove the need for the forward declaration. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 2457408..1e5616e 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -447,8 +447,6 @@ struct cb_pcidas_private { */ #define devpriv ((struct cb_pcidas_private *)dev->private) -static void cb_pcidas_load_counters(struct comedi_device *dev, unsigned int *ns, - int round_flags); static int caldac_8800_write(struct comedi_device *dev, unsigned int address, uint8_t value); static int trimpot_7376_write(struct comedi_device *dev, uint8_t value); @@ -915,6 +913,20 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device *dev, return 0; } +static void cb_pcidas_load_counters(struct comedi_device *dev, unsigned int *ns, + int rounding_flags) +{ + i8253_cascade_ns_to_timer_2div(TIMER_BASE, &(devpriv->divisor1), + &(devpriv->divisor2), ns, + rounding_flags & TRIG_ROUND_MASK); + + /* Write the values of ctr1 and ctr2 into counters 1 and 2 */ + i8254_load(devpriv->pacer_counter_dio + ADC8254, 0, 1, + devpriv->divisor1, 2); + i8254_load(devpriv->pacer_counter_dio + ADC8254, 0, 2, + devpriv->divisor2, 2); +} + static int cb_pcidas_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { @@ -1444,20 +1456,6 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d) return IRQ_HANDLED; } -static void cb_pcidas_load_counters(struct comedi_device *dev, unsigned int *ns, - int rounding_flags) -{ - i8253_cascade_ns_to_timer_2div(TIMER_BASE, &(devpriv->divisor1), - &(devpriv->divisor2), ns, - rounding_flags & TRIG_ROUND_MASK); - - /* Write the values of ctr1 and ctr2 into counters 1 and 2 */ - i8254_load(devpriv->pacer_counter_dio + ADC8254, 0, 1, - devpriv->divisor1, 2); - i8254_load(devpriv->pacer_counter_dio + ADC8254, 0, 2, - devpriv->divisor2, 2); -} - static void write_calibration_bitstream(struct comedi_device *dev, unsigned int register_bits, unsigned int bitstream, -- cgit v0.10.2 From 0c15d553252657d895492252203bcccdbe4a9b21 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 17:50:36 -0700 Subject: staging: comedi: cb_pcidas: remove forward declarations 7 Move the caldac_8800_write function, and it's helper, to remove the need for the forward declaration. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 1e5616e..28bcb64 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -447,8 +447,6 @@ struct cb_pcidas_private { */ #define devpriv ((struct cb_pcidas_private *)dev->private) -static int caldac_8800_write(struct comedi_device *dev, unsigned int address, - uint8_t value); static int trimpot_7376_write(struct comedi_device *dev, uint8_t value); static int trimpot_8402_write(struct comedi_device *dev, unsigned int channel, uint8_t value); @@ -638,6 +636,54 @@ static int eeprom_read_insn(struct comedi_device *dev, return 1; } +static void write_calibration_bitstream(struct comedi_device *dev, + unsigned int register_bits, + unsigned int bitstream, + unsigned int bitstream_length) +{ + static const int write_delay = 1; + unsigned int bit; + + for (bit = 1 << (bitstream_length - 1); bit; bit >>= 1) { + if (bitstream & bit) + register_bits |= SERIAL_DATA_IN_BIT; + else + register_bits &= ~SERIAL_DATA_IN_BIT; + udelay(write_delay); + outw(register_bits, devpriv->control_status + CALIBRATION_REG); + } +} + +static int caldac_8800_write(struct comedi_device *dev, unsigned int address, + uint8_t value) +{ + static const int num_caldac_channels = 8; + static const int bitstream_length = 11; + unsigned int bitstream = ((address & 0x7) << 8) | value; + static const int caldac_8800_udelay = 1; + + if (address >= num_caldac_channels) { + comedi_error(dev, "illegal caldac channel"); + return -1; + } + + if (value == devpriv->caldac_value[address]) + return 1; + + devpriv->caldac_value[address] = value; + + write_calibration_bitstream(dev, cal_enable_bits(dev), bitstream, + bitstream_length); + + udelay(caldac_8800_udelay); + outw(cal_enable_bits(dev) | SELECT_8800_BIT, + devpriv->control_status + CALIBRATION_REG); + udelay(caldac_8800_udelay); + outw(cal_enable_bits(dev), devpriv->control_status + CALIBRATION_REG); + + return 1; +} + static int caldac_write_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -1456,54 +1502,6 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d) return IRQ_HANDLED; } -static void write_calibration_bitstream(struct comedi_device *dev, - unsigned int register_bits, - unsigned int bitstream, - unsigned int bitstream_length) -{ - static const int write_delay = 1; - unsigned int bit; - - for (bit = 1 << (bitstream_length - 1); bit; bit >>= 1) { - if (bitstream & bit) - register_bits |= SERIAL_DATA_IN_BIT; - else - register_bits &= ~SERIAL_DATA_IN_BIT; - udelay(write_delay); - outw(register_bits, devpriv->control_status + CALIBRATION_REG); - } -} - -static int caldac_8800_write(struct comedi_device *dev, unsigned int address, - uint8_t value) -{ - static const int num_caldac_channels = 8; - static const int bitstream_length = 11; - unsigned int bitstream = ((address & 0x7) << 8) | value; - static const int caldac_8800_udelay = 1; - - if (address >= num_caldac_channels) { - comedi_error(dev, "illegal caldac channel"); - return -1; - } - - if (value == devpriv->caldac_value[address]) - return 1; - - devpriv->caldac_value[address] = value; - - write_calibration_bitstream(dev, cal_enable_bits(dev), bitstream, - bitstream_length); - - udelay(caldac_8800_udelay); - outw(cal_enable_bits(dev) | SELECT_8800_BIT, - devpriv->control_status + CALIBRATION_REG); - udelay(caldac_8800_udelay); - outw(cal_enable_bits(dev), devpriv->control_status + CALIBRATION_REG); - - return 1; -} - static int trimpot_7376_write(struct comedi_device *dev, uint8_t value) { static const int bitstream_length = 7; -- cgit v0.10.2 From 20535c1f3c010fffd84e1d9dc24ac352a0b9ad36 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 17:51:14 -0700 Subject: staging: comedi: cb_pcidas: remove forward declarations 8 Move the trimpot_{7376,8402}_write functions to remove the need for the forward declarations. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 28bcb64..9c7f24a 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -447,9 +447,6 @@ struct cb_pcidas_private { */ #define devpriv ((struct cb_pcidas_private *)dev->private) -static int trimpot_7376_write(struct comedi_device *dev, uint8_t value); -static int trimpot_8402_write(struct comedi_device *dev, unsigned int channel, - uint8_t value); static int nvram_read(struct comedi_device *dev, unsigned int address, uint8_t *data); @@ -739,6 +736,50 @@ static int dac08_read_insn(struct comedi_device *dev, return 1; } +static int trimpot_7376_write(struct comedi_device *dev, uint8_t value) +{ + static const int bitstream_length = 7; + unsigned int bitstream = value & 0x7f; + unsigned int register_bits; + static const int ad7376_udelay = 1; + + register_bits = cal_enable_bits(dev) | SELECT_TRIMPOT_BIT; + udelay(ad7376_udelay); + outw(register_bits, devpriv->control_status + CALIBRATION_REG); + + write_calibration_bitstream(dev, register_bits, bitstream, + bitstream_length); + + udelay(ad7376_udelay); + outw(cal_enable_bits(dev), devpriv->control_status + CALIBRATION_REG); + + return 0; +} + +/* For 1602/16 only + * ch 0 : adc gain + * ch 1 : adc postgain offset */ +static int trimpot_8402_write(struct comedi_device *dev, unsigned int channel, + uint8_t value) +{ + static const int bitstream_length = 10; + unsigned int bitstream = ((channel & 0x3) << 8) | (value & 0xff); + unsigned int register_bits; + static const int ad8402_udelay = 1; + + register_bits = cal_enable_bits(dev) | SELECT_TRIMPOT_BIT; + udelay(ad8402_udelay); + outw(register_bits, devpriv->control_status + CALIBRATION_REG); + + write_calibration_bitstream(dev, register_bits, bitstream, + bitstream_length); + + udelay(ad8402_udelay); + outw(cal_enable_bits(dev), devpriv->control_status + CALIBRATION_REG); + + return 0; +} + static int cb_pcidas_trimpot_write(struct comedi_device *dev, unsigned int channel, unsigned int value) { @@ -1502,50 +1543,6 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d) return IRQ_HANDLED; } -static int trimpot_7376_write(struct comedi_device *dev, uint8_t value) -{ - static const int bitstream_length = 7; - unsigned int bitstream = value & 0x7f; - unsigned int register_bits; - static const int ad7376_udelay = 1; - - register_bits = cal_enable_bits(dev) | SELECT_TRIMPOT_BIT; - udelay(ad7376_udelay); - outw(register_bits, devpriv->control_status + CALIBRATION_REG); - - write_calibration_bitstream(dev, register_bits, bitstream, - bitstream_length); - - udelay(ad7376_udelay); - outw(cal_enable_bits(dev), devpriv->control_status + CALIBRATION_REG); - - return 0; -} - -/* For 1602/16 only - * ch 0 : adc gain - * ch 1 : adc postgain offset */ -static int trimpot_8402_write(struct comedi_device *dev, unsigned int channel, - uint8_t value) -{ - static const int bitstream_length = 10; - unsigned int bitstream = ((channel & 0x3) << 8) | (value & 0xff); - unsigned int register_bits; - static const int ad8402_udelay = 1; - - register_bits = cal_enable_bits(dev) | SELECT_TRIMPOT_BIT; - udelay(ad8402_udelay); - outw(register_bits, devpriv->control_status + CALIBRATION_REG); - - write_calibration_bitstream(dev, register_bits, bitstream, - bitstream_length); - - udelay(ad8402_udelay); - outw(cal_enable_bits(dev), devpriv->control_status + CALIBRATION_REG); - - return 0; -} - static int wait_for_nvram_ready(unsigned long s5933_base_addr) { static const int timeout = 1000; -- cgit v0.10.2 From 536af69e90b03966928ed59448f5ccd95ebd13ea Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 17:51:53 -0700 Subject: staging: comedi: cb_pcidas: remove forward declarations 9 Move the nvram_read function, and its helper, to remove the need for the last of the forward declarations. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 9c7f24a..5c3758c 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -447,9 +447,6 @@ struct cb_pcidas_private { */ #define devpriv ((struct cb_pcidas_private *)dev->private) -static int nvram_read(struct comedi_device *dev, unsigned int address, - uint8_t *data); - static inline unsigned int cal_enable_bits(struct comedi_device *dev) { return CAL_EN_BIT | CAL_SRC_BITS(devpriv->calibration_source); @@ -617,6 +614,45 @@ static int cb_pcidas_ao_readback_insn(struct comedi_device *dev, return 1; } +static int wait_for_nvram_ready(unsigned long s5933_base_addr) +{ + static const int timeout = 1000; + unsigned int i; + + for (i = 0; i < timeout; i++) { + if ((inb(s5933_base_addr + + AMCC_OP_REG_MCSR_NVCMD) & MCSR_NV_BUSY) + == 0) + return 0; + udelay(1); + } + return -1; +} + +static int nvram_read(struct comedi_device *dev, unsigned int address, + uint8_t *data) +{ + unsigned long iobase = devpriv->s5933_config; + + if (wait_for_nvram_ready(iobase) < 0) + return -ETIMEDOUT; + + outb(MCSR_NV_ENABLE | MCSR_NV_LOAD_LOW_ADDR, + iobase + AMCC_OP_REG_MCSR_NVCMD); + outb(address & 0xff, iobase + AMCC_OP_REG_MCSR_NVDATA); + outb(MCSR_NV_ENABLE | MCSR_NV_LOAD_HIGH_ADDR, + iobase + AMCC_OP_REG_MCSR_NVCMD); + outb((address >> 8) & 0xff, iobase + AMCC_OP_REG_MCSR_NVDATA); + outb(MCSR_NV_ENABLE | MCSR_NV_READ, iobase + AMCC_OP_REG_MCSR_NVCMD); + + if (wait_for_nvram_ready(iobase) < 0) + return -ETIMEDOUT; + + *data = inb(iobase + AMCC_OP_REG_MCSR_NVDATA); + + return 0; +} + static int eeprom_read_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -1543,45 +1579,6 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d) return IRQ_HANDLED; } -static int wait_for_nvram_ready(unsigned long s5933_base_addr) -{ - static const int timeout = 1000; - unsigned int i; - - for (i = 0; i < timeout; i++) { - if ((inb(s5933_base_addr + - AMCC_OP_REG_MCSR_NVCMD) & MCSR_NV_BUSY) - == 0) - return 0; - udelay(1); - } - return -1; -} - -static int nvram_read(struct comedi_device *dev, unsigned int address, - uint8_t *data) -{ - unsigned long iobase = devpriv->s5933_config; - - if (wait_for_nvram_ready(iobase) < 0) - return -ETIMEDOUT; - - outb(MCSR_NV_ENABLE | MCSR_NV_LOAD_LOW_ADDR, - iobase + AMCC_OP_REG_MCSR_NVCMD); - outb(address & 0xff, iobase + AMCC_OP_REG_MCSR_NVDATA); - outb(MCSR_NV_ENABLE | MCSR_NV_LOAD_HIGH_ADDR, - iobase + AMCC_OP_REG_MCSR_NVCMD); - outb((address >> 8) & 0xff, iobase + AMCC_OP_REG_MCSR_NVDATA); - outb(MCSR_NV_ENABLE | MCSR_NV_READ, iobase + AMCC_OP_REG_MCSR_NVCMD); - - if (wait_for_nvram_ready(iobase) < 0) - return -ETIMEDOUT; - - *data = inb(iobase + AMCC_OP_REG_MCSR_NVDATA); - - return 0; -} - static int cb_pcidas_attach(struct comedi_device *dev, struct comedi_devconfig *it) { -- cgit v0.10.2 From 82d8c74dcc75235740db3ed947267bfa5baa3117 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 17:52:29 -0700 Subject: staging: comedi: cb_pcidas: remove thisboard and devpriv macros The 'thisboard' and 'devpriv' macros rely on a local variable having a specific name and yield pointers derived from that local variable. Replace the macros with local variables where used. use the comedi_board() helper to get the 'thisboard' pointer. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 5c3758c..146d078 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -404,11 +404,6 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { }, }; -/* - * Useful for shorthand access to the particular board structure - */ -#define thisboard ((const struct cb_pcidas_board *)dev->board_ptr) - /* this structure is for data unique to this hardware driver. If several hardware drivers keep similar information in this structure, feel free to suggest moving the variable to the struct comedi_device struct. */ @@ -441,14 +436,10 @@ struct cb_pcidas_private { unsigned int calibration_source; }; -/* - * most drivers define the following macro to make it easy to - * access the private structure. - */ -#define devpriv ((struct cb_pcidas_private *)dev->private) - static inline unsigned int cal_enable_bits(struct comedi_device *dev) { + struct cb_pcidas_private *devpriv = dev->private; + return CAL_EN_BIT | CAL_SRC_BITS(devpriv->calibration_source); } @@ -460,6 +451,7 @@ static int cb_pcidas_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct cb_pcidas_private *devpriv = dev->private; int n, i; unsigned int bits; static const int timeout = 10000; @@ -512,6 +504,7 @@ static int cb_pcidas_ai_rinsn(struct comedi_device *dev, static int ai_config_calibration_source(struct comedi_device *dev, unsigned int *data) { + struct cb_pcidas_private *devpriv = dev->private; static const int num_calibration_sources = 8; unsigned int source = data[1]; @@ -548,6 +541,7 @@ static int cb_pcidas_ao_nofifo_winsn(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { + struct cb_pcidas_private *devpriv = dev->private; int channel; unsigned long flags; @@ -574,6 +568,7 @@ static int cb_pcidas_ao_fifo_winsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct cb_pcidas_private *devpriv = dev->private; int channel; unsigned long flags; @@ -609,6 +604,8 @@ static int cb_pcidas_ao_readback_insn(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { + struct cb_pcidas_private *devpriv = dev->private; + data[0] = devpriv->ao_value[CR_CHAN(insn->chanspec)]; return 1; @@ -632,6 +629,7 @@ static int wait_for_nvram_ready(unsigned long s5933_base_addr) static int nvram_read(struct comedi_device *dev, unsigned int address, uint8_t *data) { + struct cb_pcidas_private *devpriv = dev->private; unsigned long iobase = devpriv->s5933_config; if (wait_for_nvram_ready(iobase) < 0) @@ -674,6 +672,7 @@ static void write_calibration_bitstream(struct comedi_device *dev, unsigned int bitstream, unsigned int bitstream_length) { + struct cb_pcidas_private *devpriv = dev->private; static const int write_delay = 1; unsigned int bit; @@ -690,6 +689,7 @@ static void write_calibration_bitstream(struct comedi_device *dev, static int caldac_8800_write(struct comedi_device *dev, unsigned int address, uint8_t value) { + struct cb_pcidas_private *devpriv = dev->private; static const int num_caldac_channels = 8; static const int bitstream_length = 11; unsigned int bitstream = ((address & 0x7) << 8) | value; @@ -730,6 +730,8 @@ static int caldac_read_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct cb_pcidas_private *devpriv = dev->private; + data[0] = devpriv->caldac_value[CR_CHAN(insn->chanspec)]; return 1; @@ -738,6 +740,8 @@ static int caldac_read_insn(struct comedi_device *dev, /* 1602/16 pregain offset */ static int dac08_write(struct comedi_device *dev, unsigned int value) { + struct cb_pcidas_private *devpriv = dev->private; + if (devpriv->dac08_value == value) return 1; @@ -767,6 +771,8 @@ static int dac08_read_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct cb_pcidas_private *devpriv = dev->private; + data[0] = devpriv->dac08_value; return 1; @@ -774,6 +780,7 @@ static int dac08_read_insn(struct comedi_device *dev, static int trimpot_7376_write(struct comedi_device *dev, uint8_t value) { + struct cb_pcidas_private *devpriv = dev->private; static const int bitstream_length = 7; unsigned int bitstream = value & 0x7f; unsigned int register_bits; @@ -798,6 +805,7 @@ static int trimpot_7376_write(struct comedi_device *dev, uint8_t value) static int trimpot_8402_write(struct comedi_device *dev, unsigned int channel, uint8_t value) { + struct cb_pcidas_private *devpriv = dev->private; static const int bitstream_length = 10; unsigned int bitstream = ((channel & 0x3) << 8) | (value & 0xff); unsigned int register_bits; @@ -819,6 +827,9 @@ static int trimpot_8402_write(struct comedi_device *dev, unsigned int channel, static int cb_pcidas_trimpot_write(struct comedi_device *dev, unsigned int channel, unsigned int value) { + const struct cb_pcidas_board *thisboard = comedi_board(dev); + struct cb_pcidas_private *devpriv = dev->private; + if (devpriv->trimpot_value[channel] == value) return 1; @@ -852,6 +863,7 @@ static int trimpot_read_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct cb_pcidas_private *devpriv = dev->private; unsigned int channel = CR_CHAN(insn->chanspec); data[0] = devpriv->trimpot_value[channel]; @@ -863,6 +875,8 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { + const struct cb_pcidas_board *thisboard = comedi_board(dev); + struct cb_pcidas_private *devpriv = dev->private; int err = 0; int tmp; int i, gain, start_chan; @@ -1039,6 +1053,8 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device *dev, static void cb_pcidas_load_counters(struct comedi_device *dev, unsigned int *ns, int rounding_flags) { + struct cb_pcidas_private *devpriv = dev->private; + i8253_cascade_ns_to_timer_2div(TIMER_BASE, &(devpriv->divisor1), &(devpriv->divisor2), ns, rounding_flags & TRIG_ROUND_MASK); @@ -1053,6 +1069,8 @@ static void cb_pcidas_load_counters(struct comedi_device *dev, unsigned int *ns, static int cb_pcidas_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { + const struct cb_pcidas_board *thisboard = comedi_board(dev); + struct cb_pcidas_private *devpriv = dev->private; struct comedi_async *async = s->async; struct comedi_cmd *cmd = &async->cmd; unsigned int bits; @@ -1147,6 +1165,8 @@ static int cb_pcidas_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { + const struct cb_pcidas_board *thisboard = comedi_board(dev); + struct cb_pcidas_private *devpriv = dev->private; int err = 0; int tmp; @@ -1263,6 +1283,7 @@ static int cb_pcidas_ao_cmdtest(struct comedi_device *dev, static int cb_pcidas_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { + struct cb_pcidas_private *devpriv = dev->private; unsigned long flags; spin_lock_irqsave(&dev->spinlock, flags); @@ -1283,6 +1304,8 @@ static int cb_pcidas_ao_inttrig(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int trig_num) { + const struct cb_pcidas_board *thisboard = comedi_board(dev); + struct cb_pcidas_private *devpriv = dev->private; unsigned int num_bytes, num_points = thisboard->fifo_size; struct comedi_async *async = s->async; struct comedi_cmd *cmd = &s->async->cmd; @@ -1332,6 +1355,7 @@ static int cb_pcidas_ao_inttrig(struct comedi_device *dev, static int cb_pcidas_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { + struct cb_pcidas_private *devpriv = dev->private; struct comedi_async *async = s->async; struct comedi_cmd *cmd = &async->cmd; unsigned int i; @@ -1399,6 +1423,7 @@ static int cb_pcidas_ao_cmd(struct comedi_device *dev, static int cb_pcidas_ao_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { + struct cb_pcidas_private *devpriv = dev->private; unsigned long flags; spin_lock_irqsave(&dev->spinlock, flags); @@ -1416,6 +1441,8 @@ static int cb_pcidas_ao_cancel(struct comedi_device *dev, static void handle_ao_interrupt(struct comedi_device *dev, unsigned int status) { + const struct cb_pcidas_board *thisboard = comedi_board(dev); + struct cb_pcidas_private *devpriv = dev->private; struct comedi_subdevice *s = dev->write_subdev; struct comedi_async *async = s->async; struct comedi_cmd *cmd = &async->cmd; @@ -1472,6 +1499,8 @@ static void handle_ao_interrupt(struct comedi_device *dev, unsigned int status) static irqreturn_t cb_pcidas_interrupt(int irq, void *d) { struct comedi_device *dev = (struct comedi_device *)d; + const struct cb_pcidas_board *thisboard = comedi_board(dev); + struct cb_pcidas_private *devpriv = dev->private; struct comedi_subdevice *s = dev->read_subdev; struct comedi_async *async; int status, s5933_status; @@ -1582,6 +1611,8 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d) static int cb_pcidas_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct cb_pcidas_board *thisboard; + struct cb_pcidas_private *devpriv; struct comedi_subdevice *s; struct pci_dev *pcidev = NULL; int index; @@ -1593,6 +1624,7 @@ static int cb_pcidas_attach(struct comedi_device *dev, */ if (alloc_private(dev, sizeof(struct cb_pcidas_private)) < 0) return -ENOMEM; + devpriv = dev->private; /* * Probe the device to determine what device in the series it is. @@ -1625,7 +1657,7 @@ static int cb_pcidas_attach(struct comedi_device *dev, return -EIO; found: - + thisboard = comedi_board(dev); dev_dbg(dev->class_dev, "Found %s on bus %i, slot %i\n", cb_pcidas_boards[index].name, pcidev->bus->number, PCI_SLOT(pcidev->devfn)); @@ -1781,6 +1813,8 @@ found: static void cb_pcidas_detach(struct comedi_device *dev) { + struct cb_pcidas_private *devpriv = dev->private; + if (devpriv) { if (devpriv->s5933_config) { outl(INTCSR_INBOX_INTR_STATUS, -- cgit v0.10.2 From 327be979c1819d4404927af4b6e3ba8f22a4fa07 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 17:53:08 -0700 Subject: staging: comedi: cb_pcidas: factor out the find pci device code Factor the "find pci device" code out of the attach function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 146d078..051c94c 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -1608,64 +1608,70 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d) return IRQ_HANDLED; } -static int cb_pcidas_attach(struct comedi_device *dev, - struct comedi_devconfig *it) +static struct pci_dev *cb_pcidas_find_pci_device(struct comedi_device *dev, + struct comedi_devconfig *it) { const struct cb_pcidas_board *thisboard; - struct cb_pcidas_private *devpriv; - struct comedi_subdevice *s; struct pci_dev *pcidev = NULL; - int index; + int bus = it->options[0]; + int slot = it->options[1]; int i; - int ret; - -/* - * Allocate the private structure area. - */ - if (alloc_private(dev, sizeof(struct cb_pcidas_private)) < 0) - return -ENOMEM; - devpriv = dev->private; - -/* - * Probe the device to determine what device in the series it is. - */ for_each_pci_dev(pcidev) { /* is it not a computer boards card? */ if (pcidev->vendor != PCI_VENDOR_ID_CB) continue; /* loop through cards supported by this driver */ - for (index = 0; index < ARRAY_SIZE(cb_pcidas_boards); index++) { - if (cb_pcidas_boards[index].device_id != pcidev->device) + for (i = 0; i < ARRAY_SIZE(cb_pcidas_boards); i++) { + thisboard = &cb_pcidas_boards[i]; + if (thisboard->device_id != pcidev->device) continue; /* was a particular bus/slot requested? */ - if (it->options[0] || it->options[1]) { + if (bus || slot) { /* are we on the wrong bus/slot? */ - if (pcidev->bus->number != it->options[0] || - PCI_SLOT(pcidev->devfn) != it->options[1]) { + if (pcidev->bus->number != bus || + PCI_SLOT(pcidev->devfn) != slot) { continue; } } - devpriv->pci_dev = pcidev; - dev->board_ptr = cb_pcidas_boards + index; - goto found; + dev->board_ptr = thisboard; + return pcidev; } } + return NULL; +} + +static int cb_pcidas_attach(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + const struct cb_pcidas_board *thisboard; + struct cb_pcidas_private *devpriv; + struct comedi_subdevice *s; + int i; + int ret; - dev_err(dev->class_dev, - "No supported ComputerBoards/MeasurementComputing card found on requested position\n"); - return -EIO; +/* + * Allocate the private structure area. + */ + if (alloc_private(dev, sizeof(struct cb_pcidas_private)) < 0) + return -ENOMEM; + devpriv = dev->private; + + devpriv->pci_dev = cb_pcidas_find_pci_device(dev, it); + if (!devpriv->pci_dev) { + dev_err(dev->class_dev, "No supported card found\n"); + return -EIO; + } -found: thisboard = comedi_board(dev); dev_dbg(dev->class_dev, "Found %s on bus %i, slot %i\n", - cb_pcidas_boards[index].name, pcidev->bus->number, - PCI_SLOT(pcidev->devfn)); + thisboard->name, devpriv->pci_dev->bus->number, + PCI_SLOT(devpriv->pci_dev->devfn)); /* * Enable PCI device and reserve I/O ports. */ - if (comedi_pci_enable(pcidev, "cb_pcidas")) { + if (comedi_pci_enable(devpriv->pci_dev, "cb_pcidas")) { dev_err(dev->class_dev, "Failed to enable PCI device and request regions\n"); return -EIO; -- cgit v0.10.2 From 9795f562bd72387da8c9e5bc99e2cce869aa1bc1 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 17:53:55 -0700 Subject: staging: comedi: cb_pcidas: remove some obvious comments in the attach These comments are unnecessary. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 051c94c..990e6ab 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -1650,9 +1650,6 @@ static int cb_pcidas_attach(struct comedi_device *dev, int i; int ret; -/* - * Allocate the private structure area. - */ if (alloc_private(dev, sizeof(struct cb_pcidas_private)) < 0) return -ENOMEM; devpriv = dev->private; @@ -1668,9 +1665,6 @@ static int cb_pcidas_attach(struct comedi_device *dev, thisboard->name, devpriv->pci_dev->bus->number, PCI_SLOT(devpriv->pci_dev->devfn)); - /* - * Enable PCI device and reserve I/O ports. - */ if (comedi_pci_enable(devpriv->pci_dev, "cb_pcidas")) { dev_err(dev->class_dev, "Failed to enable PCI device and request regions\n"); @@ -1696,7 +1690,6 @@ static int cb_pcidas_attach(struct comedi_device *dev, outl(INTCSR_INBOX_INTR_STATUS, devpriv->s5933_config + AMCC_OP_REG_INTCSR); - /* get irq */ if (request_irq(devpriv->pci_dev->irq, cb_pcidas_interrupt, IRQF_SHARED, "cb_pcidas", dev)) { dev_dbg(dev->class_dev, "unable to allocate irq %d\n", @@ -1705,7 +1698,6 @@ static int cb_pcidas_attach(struct comedi_device *dev, } dev->irq = devpriv->pci_dev->irq; - /* Initialize dev->board_name */ dev->board_name = thisboard->name; ret = comedi_alloc_subdevices(dev, 7); -- cgit v0.10.2 From 7302abef2ef3c6aae739f578a67504bb84974199 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 17:54:38 -0700 Subject: staging: comedi: cb_pcidas: remove the PCI BAR index defines The defines for the "indices of the base address regions" don't add much to the readability of the code. They are only used in the pci_resource_start() calls to get the base address for the various io regions and the names of the variables provide adequate documentation. Remove the defines and just use the open-coded values for the BARs. Also, remove the incomplete comment above the initialization of the variables. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 990e6ab..4e5f1ba 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -92,14 +92,6 @@ analog triggering on 1602 series #define NUM_CHANNELS_8402 2 #define NUM_CHANNELS_DAC08 1 -/* PCI-DAS base addresses */ - -/* indices of base address regions */ -#define S5933_BADRINDEX 0 -#define CONT_STAT_BADRINDEX 1 -#define ADC_FIFO_BADRINDEX 2 -#define PACER_BADRINDEX 3 -#define AO_BADRINDEX 4 /* sizes of io regions */ #define CONT_STAT_SIZE 10 #define ADC_FIFO_SIZE 4 @@ -1670,22 +1662,14 @@ static int cb_pcidas_attach(struct comedi_device *dev, "Failed to enable PCI device and request regions\n"); return -EIO; } - /* - * Initialize devpriv->control_status and devpriv->adc_fifo to point to - * their base address. - */ - devpriv->s5933_config = - pci_resource_start(devpriv->pci_dev, S5933_BADRINDEX); - devpriv->control_status = - pci_resource_start(devpriv->pci_dev, CONT_STAT_BADRINDEX); - devpriv->adc_fifo = - pci_resource_start(devpriv->pci_dev, ADC_FIFO_BADRINDEX); - devpriv->pacer_counter_dio = - pci_resource_start(devpriv->pci_dev, PACER_BADRINDEX); - if (thisboard->ao_nchan) { - devpriv->ao_registers = - pci_resource_start(devpriv->pci_dev, AO_BADRINDEX); - } + + devpriv->s5933_config = pci_resource_start(devpriv->pci_dev, 0); + devpriv->control_status = pci_resource_start(devpriv->pci_dev, 1); + devpriv->adc_fifo = pci_resource_start(devpriv->pci_dev, 2); + devpriv->pacer_counter_dio = pci_resource_start(devpriv->pci_dev, 3); + if (thisboard->ao_nchan) + devpriv->ao_registers = pci_resource_start(devpriv->pci_dev, 4); + /* disable and clear interrupts on amcc s5933 */ outl(INTCSR_INBOX_INTR_STATUS, devpriv->s5933_config + AMCC_OP_REG_INTCSR); -- cgit v0.10.2 From 193debd1987656a33773395e38c8427d2f02fbbc Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 17:55:21 -0700 Subject: staging: comedi: cb_pcidas: remove CB_PCIDAS_DEBUG define This define enables some debug code that output a number of dev_dbg() messages. These might be useful for development but should not be in the final driver. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 4e5f1ba..e790ab0 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -79,9 +79,6 @@ analog triggering on 1602 series #include "amcc_s5933.h" #include "comedi_fc.h" -#undef CB_PCIDAS_DEBUG /* disable debugging code */ -/* #define CB_PCIDAS_DEBUG enable debugging code */ - /* PCI vendor number of ComputerBoards/MeasurementComputing */ #define PCI_VENDOR_ID_CB 0x1307 #define TIMER_BASE 100 /* 10MHz master clock */ @@ -1092,10 +1089,6 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, bits |= PACER_INT; outw(bits, devpriv->control_status + ADCMUX_CONT); -#ifdef CB_PCIDAS_DEBUG - dev_dbg(dev->class_dev, "sent 0x%x to adcmux control\n", bits); -#endif - /* load counters */ if (cmd->convert_src == TRIG_TIMER) cb_pcidas_load_counters(dev, &cmd->convert_arg, @@ -1119,10 +1112,7 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, } else { devpriv->adc_fifo_bits |= INT_FHF; /* interrupt fifo half full */ } -#ifdef CB_PCIDAS_DEBUG - dev_dbg(dev->class_dev, "adc_fifo_bits are 0x%x\n", - devpriv->adc_fifo_bits); -#endif + /* enable (and clear) interrupts */ outw(devpriv->adc_fifo_bits | EOAI | INT | LADFUL, devpriv->control_status + INT_ADCFIFO); @@ -1146,9 +1136,6 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, if (cmd->convert_src == TRIG_NOW && cmd->chanlist_len > 1) bits |= BURSTE; outw(bits, devpriv->control_status + TRIG_CONTSTAT); -#ifdef CB_PCIDAS_DEBUG - dev_dbg(dev->class_dev, "sent 0x%x to trig control\n", bits); -#endif return 0; } @@ -1322,10 +1309,7 @@ static int cb_pcidas_ao_inttrig(struct comedi_device *dev, /* enable dac half-full and empty interrupts */ spin_lock_irqsave(&dev->spinlock, flags); devpriv->adc_fifo_bits |= DAEMIE | DAHFIE; -#ifdef CB_PCIDAS_DEBUG - dev_dbg(dev->class_dev, "adc_fifo_bits are 0x%x\n", - devpriv->adc_fifo_bits); -#endif + /* enable and clear interrupts */ outw(devpriv->adc_fifo_bits | DAEMI | DAHFI, devpriv->control_status + INT_ADCFIFO); @@ -1333,10 +1317,7 @@ static int cb_pcidas_ao_inttrig(struct comedi_device *dev, /* start dac */ devpriv->ao_control_bits |= DAC_START | DACEN | DAC_EMPTY; outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR); -#ifdef CB_PCIDAS_DEBUG - dev_dbg(dev->class_dev, "sent 0x%x to dac control\n", - devpriv->ao_control_bits); -#endif + spin_unlock_irqrestore(&dev->spinlock, flags); async->inttrig = NULL; @@ -1508,11 +1489,6 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d) async->events = 0; s5933_status = inl(devpriv->s5933_config + AMCC_OP_REG_INTCSR); -#ifdef CB_PCIDAS_DEBUG - dev_dbg(dev->class_dev, "intcsr 0x%x\n", s5933_status); - dev_dbg(dev->class_dev, "mbef 0x%x\n", - inl(devpriv->s5933_config + AMCC_OP_REG_MBEF)); -#endif if ((INTCSR_INTR_ASSERTED & s5933_status) == 0) return IRQ_NONE; @@ -1524,10 +1500,6 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d) devpriv->s5933_config + AMCC_OP_REG_INTCSR); status = inw(devpriv->control_status + INT_ADCFIFO); -#ifdef CB_PCIDAS_DEBUG - if ((status & (INT | EOAI | LADFUL | DAHFI | DAEMI)) == 0) - comedi_error(dev, "spurious interrupt"); -#endif /* check for analog output interrupt */ if (status & (DAHFI | DAEMI)) -- cgit v0.10.2 From 4466fc45007c346971ae537cc64e82a8a4961160 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 17:56:04 -0700 Subject: staging: comedi: cb_pcidas: remove unused io region size defines The defines for the size of the io regions are not used in the driver. Also, this information can be found using the pci helper pci_resource_len(). Remove the defines. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index e790ab0..4b653c5 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -89,12 +89,6 @@ analog triggering on 1602 series #define NUM_CHANNELS_8402 2 #define NUM_CHANNELS_DAC08 1 -/* sizes of io regions */ -#define CONT_STAT_SIZE 10 -#define ADC_FIFO_SIZE 4 -#define PACER_SIZE 12 -#define AO_SIZE 4 - /* Control/Status registers */ #define INT_ADCFIFO 0 /* INTERRUPT / ADC FIFO register */ #define INT_EOS 0x1 /* interrupt end of scan */ -- cgit v0.10.2 From 23e3cce3270b5f0d9c094c9bcb34d919713e02eb Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 17:56:43 -0700 Subject: staging: comedi: cb_pcidas: simplify the boardinfo The boardinfo values 'has_ai_trig_gated' and 'has_ai_trig_invert' are both only set for the "1602" versions of the boards supported by this driver. Simplify the boardinfo, and the code, by replacing these two variables with one "is_1602" variable. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 4b653c5..0c14582 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -250,8 +250,7 @@ struct cb_pcidas_board { const struct comedi_lrange *ranges; enum trimpot_model trimpot; unsigned has_dac08:1; - unsigned has_ai_trig_gated:1; /* Tells if the AI trigger can be gated */ - unsigned has_ai_trig_invert:1; /* Tells if the AI trigger can be inverted */ + unsigned is_1602:1; }; static const struct cb_pcidas_board cb_pcidas_boards[] = { @@ -269,8 +268,7 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .ranges = &cb_pcidas_ranges, .trimpot = AD8402, .has_dac08 = 1, - .has_ai_trig_gated = 1, - .has_ai_trig_invert = 1, + .is_1602 = 1, }, { .name = "pci-das1200", @@ -285,8 +283,7 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .ranges = &cb_pcidas_ranges, .trimpot = AD7376, .has_dac08 = 0, - .has_ai_trig_gated = 0, - .has_ai_trig_invert = 0, + .is_1602 = 0, }, { .name = "pci-das1602/12", @@ -302,8 +299,7 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .ranges = &cb_pcidas_ranges, .trimpot = AD7376, .has_dac08 = 0, - .has_ai_trig_gated = 1, - .has_ai_trig_invert = 1, + .is_1602 = 1, }, { .name = "pci-das1200/jr", @@ -318,8 +314,7 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .ranges = &cb_pcidas_ranges, .trimpot = AD7376, .has_dac08 = 0, - .has_ai_trig_gated = 0, - .has_ai_trig_invert = 0, + .is_1602 = 0, }, { .name = "pci-das1602/16/jr", @@ -334,8 +329,7 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .ranges = &cb_pcidas_ranges, .trimpot = AD8402, .has_dac08 = 1, - .has_ai_trig_gated = 1, - .has_ai_trig_invert = 1, + .is_1602 = 1, }, { .name = "pci-das1000", @@ -350,8 +344,7 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .ranges = &cb_pcidas_ranges, .trimpot = AD7376, .has_dac08 = 0, - .has_ai_trig_gated = 0, - .has_ai_trig_invert = 0, + .is_1602 = 0, }, { .name = "pci-das1001", @@ -366,8 +359,7 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .ranges = &cb_pcidas_alt_ranges, .trimpot = AD7376, .has_dac08 = 0, - .has_ai_trig_gated = 0, - .has_ai_trig_invert = 0, + .is_1602 = 0, }, { .name = "pci-das1002", @@ -382,8 +374,7 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .ranges = &cb_pcidas_ranges, .trimpot = AD7376, .has_dac08 = 0, - .has_ai_trig_gated = 0, - .has_ai_trig_invert = 0, + .is_1602 = 0, }, }; @@ -938,8 +929,7 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device *dev, ~(CR_FLAGS_MASK & ~(CR_EDGE | CR_INVERT)); err++; } - if (!thisboard->has_ai_trig_invert && - (cmd->start_arg & CR_INVERT)) { + if (!thisboard->is_1602 && (cmd->start_arg & CR_INVERT)) { cmd->start_arg &= (CR_FLAGS_MASK & ~CR_INVERT); err++; } @@ -1118,11 +1108,12 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, bits |= SW_TRIGGER; else if (cmd->start_src == TRIG_EXT) { bits |= EXT_TRIGGER | TGEN | XTRCL; - if (thisboard->has_ai_trig_invert - && (cmd->start_arg & CR_INVERT)) - bits |= TGPOL; - if (thisboard->has_ai_trig_gated && (cmd->start_arg & CR_EDGE)) - bits |= TGSEL; + if (thisboard->is_1602) { + if (cmd->start_arg & CR_INVERT) + bits |= TGPOL; + if (cmd->start_arg & CR_EDGE) + bits |= TGSEL; + } } else { comedi_error(dev, "bug!"); return -1; -- cgit v0.10.2 From 17883d63b32390098e42cb1a0739d361e38b528e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 17:57:20 -0700 Subject: staging: comedi: cb_pcidas: cleanup the boardinfo 1 For aesthetic reasons, add whitespace to the boardinfo to improve readability. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 0c14582..a5b3659 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -255,127 +255,120 @@ struct cb_pcidas_board { static const struct cb_pcidas_board cb_pcidas_boards[] = { { - .name = "pci-das1602/16", - .device_id = 0x1, - .ai_se_chans = 16, - .ai_diff_chans = 8, - .ai_bits = 16, - .ai_speed = 5000, - .ao_nchan = 2, - .has_ao_fifo = 1, - .ao_scan_speed = 10000, - .fifo_size = 512, - .ranges = &cb_pcidas_ranges, - .trimpot = AD8402, - .has_dac08 = 1, - .is_1602 = 1, - }, - { - .name = "pci-das1200", - .device_id = 0xF, - .ai_se_chans = 16, - .ai_diff_chans = 8, - .ai_bits = 12, - .ai_speed = 3200, - .ao_nchan = 2, - .has_ao_fifo = 0, - .fifo_size = 1024, - .ranges = &cb_pcidas_ranges, - .trimpot = AD7376, - .has_dac08 = 0, - .is_1602 = 0, - }, - { - .name = "pci-das1602/12", - .device_id = 0x10, - .ai_se_chans = 16, - .ai_diff_chans = 8, - .ai_bits = 12, - .ai_speed = 3200, - .ao_nchan = 2, - .has_ao_fifo = 1, - .ao_scan_speed = 4000, - .fifo_size = 1024, - .ranges = &cb_pcidas_ranges, - .trimpot = AD7376, - .has_dac08 = 0, - .is_1602 = 1, - }, - { - .name = "pci-das1200/jr", - .device_id = 0x19, - .ai_se_chans = 16, - .ai_diff_chans = 8, - .ai_bits = 12, - .ai_speed = 3200, - .ao_nchan = 0, - .has_ao_fifo = 0, - .fifo_size = 1024, - .ranges = &cb_pcidas_ranges, - .trimpot = AD7376, - .has_dac08 = 0, - .is_1602 = 0, - }, - { - .name = "pci-das1602/16/jr", - .device_id = 0x1C, - .ai_se_chans = 16, - .ai_diff_chans = 8, - .ai_bits = 16, - .ai_speed = 5000, - .ao_nchan = 0, - .has_ao_fifo = 0, - .fifo_size = 512, - .ranges = &cb_pcidas_ranges, - .trimpot = AD8402, - .has_dac08 = 1, - .is_1602 = 1, - }, - { - .name = "pci-das1000", - .device_id = 0x4C, - .ai_se_chans = 16, - .ai_diff_chans = 8, - .ai_bits = 12, - .ai_speed = 4000, - .ao_nchan = 0, - .has_ao_fifo = 0, - .fifo_size = 1024, - .ranges = &cb_pcidas_ranges, - .trimpot = AD7376, - .has_dac08 = 0, - .is_1602 = 0, - }, - { - .name = "pci-das1001", - .device_id = 0x1a, - .ai_se_chans = 16, - .ai_diff_chans = 8, - .ai_bits = 12, - .ai_speed = 6800, - .ao_nchan = 2, - .has_ao_fifo = 0, - .fifo_size = 1024, - .ranges = &cb_pcidas_alt_ranges, - .trimpot = AD7376, - .has_dac08 = 0, - .is_1602 = 0, - }, - { - .name = "pci-das1002", - .device_id = 0x1b, - .ai_se_chans = 16, - .ai_diff_chans = 8, - .ai_bits = 12, - .ai_speed = 6800, - .ao_nchan = 2, - .has_ao_fifo = 0, - .fifo_size = 1024, - .ranges = &cb_pcidas_ranges, - .trimpot = AD7376, - .has_dac08 = 0, - .is_1602 = 0, - }, + .name = "pci-das1602/16", + .device_id = 0x1, + .ai_se_chans = 16, + .ai_diff_chans = 8, + .ai_bits = 16, + .ai_speed = 5000, + .ao_nchan = 2, + .has_ao_fifo = 1, + .ao_scan_speed = 10000, + .fifo_size = 512, + .ranges = &cb_pcidas_ranges, + .trimpot = AD8402, + .has_dac08 = 1, + .is_1602 = 1, + }, { + .name = "pci-das1200", + .device_id = 0xF, + .ai_se_chans = 16, + .ai_diff_chans = 8, + .ai_bits = 12, + .ai_speed = 3200, + .ao_nchan = 2, + .has_ao_fifo = 0, + .fifo_size = 1024, + .ranges = &cb_pcidas_ranges, + .trimpot = AD7376, + .has_dac08 = 0, + .is_1602 = 0, + }, { + .name = "pci-das1602/12", + .device_id = 0x10, + .ai_se_chans = 16, + .ai_diff_chans = 8, + .ai_bits = 12, + .ai_speed = 3200, + .ao_nchan = 2, + .has_ao_fifo = 1, + .ao_scan_speed = 4000, + .fifo_size = 1024, + .ranges = &cb_pcidas_ranges, + .trimpot = AD7376, + .has_dac08 = 0, + .is_1602 = 1, + }, { + .name = "pci-das1200/jr", + .device_id = 0x19, + .ai_se_chans = 16, + .ai_diff_chans = 8, + .ai_bits = 12, + .ai_speed = 3200, + .ao_nchan = 0, + .has_ao_fifo = 0, + .fifo_size = 1024, + .ranges = &cb_pcidas_ranges, + .trimpot = AD7376, + .has_dac08 = 0, + .is_1602 = 0, + }, { + .name = "pci-das1602/16/jr", + .device_id = 0x1C, + .ai_se_chans = 16, + .ai_diff_chans = 8, + .ai_bits = 16, + .ai_speed = 5000, + .ao_nchan = 0, + .has_ao_fifo = 0, + .fifo_size = 512, + .ranges = &cb_pcidas_ranges, + .trimpot = AD8402, + .has_dac08 = 1, + .is_1602 = 1, + }, { + .name = "pci-das1000", + .device_id = 0x4C, + .ai_se_chans = 16, + .ai_diff_chans = 8, + .ai_bits = 12, + .ai_speed = 4000, + .ao_nchan = 0, + .has_ao_fifo = 0, + .fifo_size = 1024, + .ranges = &cb_pcidas_ranges, + .trimpot = AD7376, + .has_dac08 = 0, + .is_1602 = 0, + }, { + .name = "pci-das1001", + .device_id = 0x1a, + .ai_se_chans = 16, + .ai_diff_chans = 8, + .ai_bits = 12, + .ai_speed = 6800, + .ao_nchan = 2, + .has_ao_fifo = 0, + .fifo_size = 1024, + .ranges = &cb_pcidas_alt_ranges, + .trimpot = AD7376, + .has_dac08 = 0, + .is_1602 = 0, + }, { + .name = "pci-das1002", + .device_id = 0x1b, + .ai_se_chans = 16, + .ai_diff_chans = 8, + .ai_bits = 12, + .ai_speed = 6800, + .ao_nchan = 2, + .has_ao_fifo = 0, + .fifo_size = 1024, + .ranges = &cb_pcidas_ranges, + .trimpot = AD7376, + .has_dac08 = 0, + .is_1602 = 0, + }, }; /* this structure is for data unique to this hardware driver. If -- cgit v0.10.2 From 0c5ecbb0b77833e8ac5c90b7652684ae5f16480f Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 17:58:27 -0700 Subject: staging: comedi: cb_pcidas: cleanup the boardinfo 2 Remove all the boardinfo values that are = 0. They will default to that value. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index a5b3659..f7090de 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -277,12 +277,9 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .ai_bits = 12, .ai_speed = 3200, .ao_nchan = 2, - .has_ao_fifo = 0, .fifo_size = 1024, .ranges = &cb_pcidas_ranges, .trimpot = AD7376, - .has_dac08 = 0, - .is_1602 = 0, }, { .name = "pci-das1602/12", .device_id = 0x10, @@ -296,7 +293,6 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .fifo_size = 1024, .ranges = &cb_pcidas_ranges, .trimpot = AD7376, - .has_dac08 = 0, .is_1602 = 1, }, { .name = "pci-das1200/jr", @@ -305,13 +301,9 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .ai_diff_chans = 8, .ai_bits = 12, .ai_speed = 3200, - .ao_nchan = 0, - .has_ao_fifo = 0, .fifo_size = 1024, .ranges = &cb_pcidas_ranges, .trimpot = AD7376, - .has_dac08 = 0, - .is_1602 = 0, }, { .name = "pci-das1602/16/jr", .device_id = 0x1C, @@ -319,8 +311,6 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .ai_diff_chans = 8, .ai_bits = 16, .ai_speed = 5000, - .ao_nchan = 0, - .has_ao_fifo = 0, .fifo_size = 512, .ranges = &cb_pcidas_ranges, .trimpot = AD8402, @@ -333,13 +323,9 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .ai_diff_chans = 8, .ai_bits = 12, .ai_speed = 4000, - .ao_nchan = 0, - .has_ao_fifo = 0, .fifo_size = 1024, .ranges = &cb_pcidas_ranges, .trimpot = AD7376, - .has_dac08 = 0, - .is_1602 = 0, }, { .name = "pci-das1001", .device_id = 0x1a, @@ -348,12 +334,9 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .ai_bits = 12, .ai_speed = 6800, .ao_nchan = 2, - .has_ao_fifo = 0, .fifo_size = 1024, .ranges = &cb_pcidas_alt_ranges, .trimpot = AD7376, - .has_dac08 = 0, - .is_1602 = 0, }, { .name = "pci-das1002", .device_id = 0x1b, @@ -362,12 +345,9 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .ai_bits = 12, .ai_speed = 6800, .ao_nchan = 2, - .has_ao_fifo = 0, .fifo_size = 1024, .ranges = &cb_pcidas_ranges, .trimpot = AD7376, - .has_dac08 = 0, - .is_1602 = 0, }, }; -- cgit v0.10.2 From a605be0c68f4c7585255bdb5a8ddbc1782d829ad Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 17:59:17 -0700 Subject: staging: comedi: cb_pcidas: cleanup the boardinfo 3 Remove the ai_diff_chans variable. This option is not used in the driver. If it is used later, the value can be easily found by using ai_se_chans/2. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index f7090de..59b0f91 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -240,7 +240,6 @@ struct cb_pcidas_board { const char *name; unsigned short device_id; int ai_se_chans; /* Inputs in single-ended mode */ - int ai_diff_chans; /* Inputs in differential mode */ int ai_bits; /* analog input resolution */ int ai_speed; /* fastest conversion period in ns */ int ao_nchan; /* number of analog out channels */ @@ -258,7 +257,6 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .name = "pci-das1602/16", .device_id = 0x1, .ai_se_chans = 16, - .ai_diff_chans = 8, .ai_bits = 16, .ai_speed = 5000, .ao_nchan = 2, @@ -273,7 +271,6 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .name = "pci-das1200", .device_id = 0xF, .ai_se_chans = 16, - .ai_diff_chans = 8, .ai_bits = 12, .ai_speed = 3200, .ao_nchan = 2, @@ -284,7 +281,6 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .name = "pci-das1602/12", .device_id = 0x10, .ai_se_chans = 16, - .ai_diff_chans = 8, .ai_bits = 12, .ai_speed = 3200, .ao_nchan = 2, @@ -298,7 +294,6 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .name = "pci-das1200/jr", .device_id = 0x19, .ai_se_chans = 16, - .ai_diff_chans = 8, .ai_bits = 12, .ai_speed = 3200, .fifo_size = 1024, @@ -308,7 +303,6 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .name = "pci-das1602/16/jr", .device_id = 0x1C, .ai_se_chans = 16, - .ai_diff_chans = 8, .ai_bits = 16, .ai_speed = 5000, .fifo_size = 512, @@ -320,7 +314,6 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .name = "pci-das1000", .device_id = 0x4C, .ai_se_chans = 16, - .ai_diff_chans = 8, .ai_bits = 12, .ai_speed = 4000, .fifo_size = 1024, @@ -330,7 +323,6 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .name = "pci-das1001", .device_id = 0x1a, .ai_se_chans = 16, - .ai_diff_chans = 8, .ai_bits = 12, .ai_speed = 6800, .ao_nchan = 2, @@ -341,7 +333,6 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .name = "pci-das1002", .device_id = 0x1b, .ai_se_chans = 16, - .ai_diff_chans = 8, .ai_bits = 12, .ai_speed = 6800, .ao_nchan = 2, -- cgit v0.10.2 From 8f608fc8eefc9bff17a7139801eb4b4f571f262d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 18:00:19 -0700 Subject: staging: comedi: cb_pcidas: cleanup the boardinfo 4 For aesthetic reasons, rename the ai_se_chans variable to ai_nchan. It's a bit shorter and provides the necessary information about the variable. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 59b0f91..3cdd026 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -239,7 +239,7 @@ enum trimpot_model { struct cb_pcidas_board { const char *name; unsigned short device_id; - int ai_se_chans; /* Inputs in single-ended mode */ + int ai_nchan; /* Inputs in single-ended mode */ int ai_bits; /* analog input resolution */ int ai_speed; /* fastest conversion period in ns */ int ao_nchan; /* number of analog out channels */ @@ -256,7 +256,7 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { { .name = "pci-das1602/16", .device_id = 0x1, - .ai_se_chans = 16, + .ai_nchan = 16, .ai_bits = 16, .ai_speed = 5000, .ao_nchan = 2, @@ -270,7 +270,7 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { }, { .name = "pci-das1200", .device_id = 0xF, - .ai_se_chans = 16, + .ai_nchan = 16, .ai_bits = 12, .ai_speed = 3200, .ao_nchan = 2, @@ -280,7 +280,7 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { }, { .name = "pci-das1602/12", .device_id = 0x10, - .ai_se_chans = 16, + .ai_nchan = 16, .ai_bits = 12, .ai_speed = 3200, .ao_nchan = 2, @@ -293,7 +293,7 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { }, { .name = "pci-das1200/jr", .device_id = 0x19, - .ai_se_chans = 16, + .ai_nchan = 16, .ai_bits = 12, .ai_speed = 3200, .fifo_size = 1024, @@ -302,7 +302,7 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { }, { .name = "pci-das1602/16/jr", .device_id = 0x1C, - .ai_se_chans = 16, + .ai_nchan = 16, .ai_bits = 16, .ai_speed = 5000, .fifo_size = 512, @@ -313,7 +313,7 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { }, { .name = "pci-das1000", .device_id = 0x4C, - .ai_se_chans = 16, + .ai_nchan = 16, .ai_bits = 12, .ai_speed = 4000, .fifo_size = 1024, @@ -322,7 +322,7 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { }, { .name = "pci-das1001", .device_id = 0x1a, - .ai_se_chans = 16, + .ai_nchan = 16, .ai_bits = 12, .ai_speed = 6800, .ao_nchan = 2, @@ -332,7 +332,7 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { }, { .name = "pci-das1002", .device_id = 0x1b, - .ai_se_chans = 16, + .ai_nchan = 16, .ai_bits = 12, .ai_speed = 6800, .ao_nchan = 2, @@ -1615,8 +1615,8 @@ static int cb_pcidas_attach(struct comedi_device *dev, s->type = COMEDI_SUBD_AI; s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF | SDF_CMD_READ; /* WARNING: Number of inputs in differential mode is ignored */ - s->n_chan = thisboard->ai_se_chans; - s->len_chanlist = thisboard->ai_se_chans; + s->n_chan = thisboard->ai_nchan; + s->len_chanlist = thisboard->ai_nchan; s->maxdata = (1 << thisboard->ai_bits) - 1; s->range_table = thisboard->ranges; s->insn_read = cb_pcidas_ai_rinsn; -- cgit v0.10.2 From f3c34b2fc6ccc36f171633fa86b3d59a36792c25 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 18:01:05 -0700 Subject: staging: comedi: cb_pcidas: cleanup ai_config_insn() Absorb the helper function ai_config_calibration_source() into ai_config_insn() and remove the static const variable that was in the helper function. Return an error code (-EINVAL) when appropriate and the number of data values used (insn->n) for success. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 3cdd026..a2901bb 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -439,38 +439,28 @@ static int cb_pcidas_ai_rinsn(struct comedi_device *dev, return n; } -static int ai_config_calibration_source(struct comedi_device *dev, - unsigned int *data) -{ - struct cb_pcidas_private *devpriv = dev->private; - static const int num_calibration_sources = 8; - unsigned int source = data[1]; - - if (source >= num_calibration_sources) { - dev_err(dev->class_dev, "invalid calibration source: %i\n", - source); - return -EINVAL; - } - - devpriv->calibration_source = source; - - return 2; -} - static int ai_config_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct cb_pcidas_private *devpriv = dev->private; int id = data[0]; + unsigned int source = data[1]; switch (id) { case INSN_CONFIG_ALT_SOURCE: - return ai_config_calibration_source(dev, data); + if (source >= 8) { + dev_err(dev->class_dev, + "invalid calibration source: %i\n", + source); + return -EINVAL; + } + devpriv->calibration_source = source; break; default: return -EINVAL; break; } - return -EINVAL; + return insn->n; } /* analog output insn for pcidas-1000 and 1200 series */ -- cgit v0.10.2 From b8ac8c63429e8b354067e3dcaa549dc0b53be5d4 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 18:01:51 -0700 Subject: staging: comedi: cb_pcidas: move the "find pci" dev_printk messages Move the dev_printk messages associated with the "find pci device" from the *attach function into the *find_pci_device function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index a2901bb..9f883dd 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -1537,10 +1537,15 @@ static struct pci_dev *cb_pcidas_find_pci_device(struct comedi_device *dev, continue; } } + dev_dbg(dev->class_dev, + "Found %s on bus %i, slot %i\n", + thisboard->name, + pcidev->bus->number, PCI_SLOT(pcidev->devfn)); dev->board_ptr = thisboard; return pcidev; } } + dev_err(dev->class_dev, "No supported card found\n"); return NULL; } @@ -1558,15 +1563,9 @@ static int cb_pcidas_attach(struct comedi_device *dev, devpriv = dev->private; devpriv->pci_dev = cb_pcidas_find_pci_device(dev, it); - if (!devpriv->pci_dev) { - dev_err(dev->class_dev, "No supported card found\n"); + if (!devpriv->pci_dev) return -EIO; - } - thisboard = comedi_board(dev); - dev_dbg(dev->class_dev, "Found %s on bus %i, slot %i\n", - thisboard->name, devpriv->pci_dev->bus->number, - PCI_SLOT(devpriv->pci_dev->devfn)); if (comedi_pci_enable(devpriv->pci_dev, "cb_pcidas")) { dev_err(dev->class_dev, -- cgit v0.10.2 From 0a5aed487645b13531b876775c1390afd20296a5 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 18:02:40 -0700 Subject: staging: comedi: cb_pcidas: use the driver_name for the resource name Use the dev->driver->driver_name for the resource name passed to pci_request_regions(), by way of comedi_pci_enable(), and to request_irq() instead of the open coded "cb_pcidas". Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 9f883dd..9379d25 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -1567,7 +1567,7 @@ static int cb_pcidas_attach(struct comedi_device *dev, return -EIO; thisboard = comedi_board(dev); - if (comedi_pci_enable(devpriv->pci_dev, "cb_pcidas")) { + if (comedi_pci_enable(devpriv->pci_dev, dev->driver->driver_name)) { dev_err(dev->class_dev, "Failed to enable PCI device and request regions\n"); return -EIO; @@ -1585,7 +1585,7 @@ static int cb_pcidas_attach(struct comedi_device *dev, devpriv->s5933_config + AMCC_OP_REG_INTCSR); if (request_irq(devpriv->pci_dev->irq, cb_pcidas_interrupt, - IRQF_SHARED, "cb_pcidas", dev)) { + IRQF_SHARED, dev->driver->driver_name, dev)) { dev_dbg(dev->class_dev, "unable to allocate irq %d\n", devpriv->pci_dev->irq); return -EINVAL; -- cgit v0.10.2 From 4f0036ef09387a49b709d9b319ad93492e53d790 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 18:03:34 -0700 Subject: staging: comedi: cb_pcidas: check for failure of subdev_8255_init It's possible for subdev_8255_init() to fail due to its kzalloc(). Make sure to check for this failure and pass on the error code. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 9379d25..a033071 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -1640,7 +1640,10 @@ static int cb_pcidas_attach(struct comedi_device *dev, /* 8255 */ s = dev->subdevices + 2; - subdev_8255_init(dev, s, NULL, devpriv->pacer_counter_dio + DIO_8255); + ret = subdev_8255_init(dev, s, NULL, + devpriv->pacer_counter_dio + DIO_8255); + if (ret) + return ret; /* serial EEPROM, */ s = dev->subdevices + 3; -- cgit v0.10.2 From 93c58378b5498f6810a2f269dc3c9a13731c3cf7 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 18:04:26 -0700 Subject: staging: comedi: cb_pcidas: fix a space before tab issue As reported by checkpatch.pl, spaces should not be used before tabs. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index a033071..ff08f9e 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -1063,7 +1063,7 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, else if (cmd->start_src == TRIG_EXT) { bits |= EXT_TRIGGER | TGEN | XTRCL; if (thisboard->is_1602) { - if (cmd->start_arg & CR_INVERT) + if (cmd->start_arg & CR_INVERT) bits |= TGPOL; if (cmd->start_arg & CR_EDGE) bits |= TGSEL; -- cgit v0.10.2 From 55acaf2d10d268d7db59877615955f910add5b1b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 18:05:12 -0700 Subject: staging: comedi: cb_pcidas: fix some > 80 char lines Fix some of the comments that cause checkpatch.pl to complain about WARNING: line over 80 characters. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index ff08f9e..12fb087 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -1043,12 +1043,16 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, devpriv->adc_fifo_bits |= INTE; devpriv->adc_fifo_bits &= ~INT_MASK; if (cmd->flags & TRIG_WAKE_EOS) { - if (cmd->convert_src == TRIG_NOW && cmd->chanlist_len > 1) - devpriv->adc_fifo_bits |= INT_EOS; /* interrupt end of burst */ - else - devpriv->adc_fifo_bits |= INT_FNE; /* interrupt fifo not empty */ + if (cmd->convert_src == TRIG_NOW && cmd->chanlist_len > 1) { + /* interrupt end of burst */ + devpriv->adc_fifo_bits |= INT_EOS; + } else { + /* interrupt fifo not empty */ + devpriv->adc_fifo_bits |= INT_FNE; + } } else { - devpriv->adc_fifo_bits |= INT_FHF; /* interrupt fifo half full */ + /* interrupt fifo half full */ + devpriv->adc_fifo_bits |= INT_FHF; } /* enable (and clear) interrupts */ @@ -1474,7 +1478,9 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d) INT_ADCFIFO)) == 0) break; cfc_write_to_buffer(s, inw(devpriv->adc_fifo)); - if (async->cmd.stop_src == TRIG_COUNT && --devpriv->count == 0) { /* end of acquisition */ + if (async->cmd.stop_src == TRIG_COUNT && + --devpriv->count == 0) { + /* end of acquisition */ cb_pcidas_cancel(dev, s); async->events |= COMEDI_CB_EOA; break; @@ -1620,7 +1626,10 @@ static int cb_pcidas_attach(struct comedi_device *dev, s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_GROUND; s->n_chan = thisboard->ao_nchan; - /* analog out resolution is the same as analog input resolution, so use ai_bits */ + /* + * analog out resolution is the same as + * analog input resolution, so use ai_bits + */ s->maxdata = (1 << thisboard->ai_bits) - 1; s->range_table = &cb_pcidas_ao_ranges; s->insn_read = cb_pcidas_ao_readback_insn; -- cgit v0.10.2 From 0c4ef0b90c4f77bb397e30c408118a1e0edbaddb Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 18:06:08 -0700 Subject: staging: comedi: cb_pcidas: fix comments in *_cmdtest functions Remove some cut-and-paste comments from the skel driver in the *_cmdtest functions. Shorten some others to fix the checkpatch.pl complaints about WARNING: line over 80 characters. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 12fb087..95ce546 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -809,14 +809,7 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device *dev, int tmp; int i, gain, start_chan; - /* cmdtest tests a particular command to see if it is valid. - * Using the cmdtest ioctl, a user can create a valid cmd - * and then have it executes by the cmd ioctl. - * - * cmdtest returns 1,2,3,4 or 0, depending on which tests - * the command passes. */ - - /* step 1: make sure trigger sources are trivially valid */ + /* step 1: trigger sources are trivially valid */ tmp = cmd->start_src; cmd->start_src &= TRIG_NOW | TRIG_EXT; @@ -846,7 +839,7 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device *dev, if (err) return 1; - /* step 2: make sure trigger sources are unique and mutually compatible */ + /* step 2: trigger sources are unique and mutually compatible */ if (cmd->start_src != TRIG_NOW && cmd->start_src != TRIG_EXT) err++; @@ -872,7 +865,7 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device *dev, if (err) return 2; - /* step 3: make sure arguments are trivially compatible */ + /* step 3: arguments are trivially compatible */ switch (cmd->start_src) { case TRIG_EXT: @@ -1092,14 +1085,7 @@ static int cb_pcidas_ao_cmdtest(struct comedi_device *dev, int err = 0; int tmp; - /* cmdtest tests a particular command to see if it is valid. - * Using the cmdtest ioctl, a user can create a valid cmd - * and then have it executes by the cmd ioctl. - * - * cmdtest returns 1,2,3,4 or 0, depending on which tests - * the command passes. */ - - /* step 1: make sure trigger sources are trivially valid */ + /* step 1: trigger sources are trivially valid */ tmp = cmd->start_src; cmd->start_src &= TRIG_INT; @@ -1129,7 +1115,7 @@ static int cb_pcidas_ao_cmdtest(struct comedi_device *dev, if (err) return 1; - /* step 2: make sure trigger sources are unique and mutually compatible */ + /* step 2: trigger sources are unique and mutually compatible */ if (cmd->scan_begin_src != TRIG_TIMER && cmd->scan_begin_src != TRIG_EXT) @@ -1140,7 +1126,7 @@ static int cb_pcidas_ao_cmdtest(struct comedi_device *dev, if (err) return 2; - /* step 3: make sure arguments are trivially compatible */ + /* step 3: arguments are trivially compatible */ if (cmd->start_arg != 0) { cmd->start_arg = 0; -- cgit v0.10.2 From f6cf9a02600aa23780bc75da6ee7d315ce027db0 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 18:06:52 -0700 Subject: staging: comedi: cb_pcidas: remove 'volatile' on private data variables As indicated by checkpatch.pl, "WARNING: Use of volatile is usually wrong: ...". The variables in the private data that are marked volatile don't need to be. Remove the volatile. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 95ce546..eba39b4 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -357,16 +357,16 @@ struct cb_pcidas_private { /* divisors of master clock for analog input pacing */ unsigned int divisor1; unsigned int divisor2; - volatile unsigned int count; /* number of analog input samples remaining */ - volatile unsigned int adc_fifo_bits; /* bits to write to interrupt/adcfifo register */ - volatile unsigned int s5933_intcsr_bits; /* bits to write to amcc s5933 interrupt control/status register */ - volatile unsigned int ao_control_bits; /* bits to write to ao control and status register */ + unsigned int count; /* number of analog input samples remaining */ + unsigned int adc_fifo_bits; /* bits to write to interrupt/adcfifo register */ + unsigned int s5933_intcsr_bits; /* bits to write to amcc s5933 interrupt control/status register */ + unsigned int ao_control_bits; /* bits to write to ao control and status register */ short ai_buffer[AI_BUFFER_SIZE]; short ao_buffer[AO_BUFFER_SIZE]; /* divisors of master clock for analog output pacing */ unsigned int ao_divisor1; unsigned int ao_divisor2; - volatile unsigned int ao_count; /* number of analog output samples remaining */ + unsigned int ao_count; /* number of analog output samples remaining */ int ao_value[2]; /* remember what the analog outputs are set to, to allow readback */ unsigned int caldac_value[NUM_CHANNELS_8800]; /* for readback of caldac */ unsigned int trimpot_value[NUM_CHANNELS_8402]; /* for readback of trimpot */ -- cgit v0.10.2 From 0cdfbe157cd2244951568e6d3ffe3423ce7f2f50 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 18:07:32 -0700 Subject: staging: comedi: cb_pcidas: fix comments in private data struct A number of the comments in the private data struct definition are causing checkpatch.pl to complain about "WARNING: line over 80 characters". Fix the comments. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index eba39b4..9e21e68 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -342,34 +342,35 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { }, }; -/* this structure is for data unique to this hardware driver. If - several hardware drivers keep similar information in this structure, - feel free to suggest moving the variable to the struct comedi_device struct. */ struct cb_pcidas_private { - /* would be useful for a PCI device */ struct pci_dev *pci_dev; - /* base addresses */ + /* base addresses */ unsigned long s5933_config; unsigned long control_status; unsigned long adc_fifo; unsigned long pacer_counter_dio; unsigned long ao_registers; - /* divisors of master clock for analog input pacing */ + /* divisors of master clock for analog input pacing */ unsigned int divisor1; unsigned int divisor2; - unsigned int count; /* number of analog input samples remaining */ - unsigned int adc_fifo_bits; /* bits to write to interrupt/adcfifo register */ - unsigned int s5933_intcsr_bits; /* bits to write to amcc s5933 interrupt control/status register */ - unsigned int ao_control_bits; /* bits to write to ao control and status register */ + /* number of analog input samples remaining */ + unsigned int count; + /* bits to write to registers */ + unsigned int adc_fifo_bits; + unsigned int s5933_intcsr_bits; + unsigned int ao_control_bits; + /* fifo buffers */ short ai_buffer[AI_BUFFER_SIZE]; short ao_buffer[AO_BUFFER_SIZE]; - /* divisors of master clock for analog output pacing */ + /* divisors of master clock for analog output pacing */ unsigned int ao_divisor1; unsigned int ao_divisor2; - unsigned int ao_count; /* number of analog output samples remaining */ - int ao_value[2]; /* remember what the analog outputs are set to, to allow readback */ - unsigned int caldac_value[NUM_CHANNELS_8800]; /* for readback of caldac */ - unsigned int trimpot_value[NUM_CHANNELS_8402]; /* for readback of trimpot */ + /* number of analog output samples remaining */ + unsigned int ao_count; + /* cached values for readback */ + int ao_value[2]; + unsigned int caldac_value[NUM_CHANNELS_8800]; + unsigned int trimpot_value[NUM_CHANNELS_8402]; unsigned int dac08_value; unsigned int calibration_source; }; -- cgit v0.10.2 From 7368348ccb51f652fea3f2554874ad11456fb9fc Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 18:08:17 -0700 Subject: staging: comedi: cb_pcidas: change dac bit enums into defines The 'bits' for the DAC_CSR register are currently defined as enums. All the other registers use defines for the bit definitions. Change the dac bit enums to defines to follow the other registers. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 9e21e68..0188cf1 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -140,11 +140,10 @@ analog triggering on 1602 series #define CAL_EN_BIT 0x4000 /* read calibration source instead of analog input channel 0 */ #define SERIAL_DATA_IN_BIT 0x8000 /* serial data stream going to 8800 and 7376 */ -#define DAC_CSR 0x8 /* dac control and status register */ -enum dac_csr_bits { - DACEN = 0x2, /* dac enable */ - DAC_MODE_UPDATE_BOTH = 0x80, /* update both dacs when dac0 is written */ -}; +#define DAC_CSR 0x8 /* dac control and status register */ +#define DACEN 0x02 /* dac enable */ +#define DAC_MODE_UPDATE_BOTH 0x80 /* update both dacs */ + static inline unsigned int DAC_RANGE(unsigned int channel, unsigned int range) { return (range & 0x3) << (8 + 2 * (channel & 0x1)); @@ -156,14 +155,13 @@ static inline unsigned int DAC_RANGE_MASK(unsigned int channel) }; /* bits for 1602 series only */ -enum dac_csr_bits_1602 { - DAC_EMPTY = 0x1, /* dac fifo empty, read, write clear */ - DAC_START = 0x4, /* start/arm dac fifo operations */ - DAC_PACER_MASK = 0x18, /* bits that set dac pacer source */ - DAC_PACER_INT = 0x8, /* dac internal pacing */ - DAC_PACER_EXT_FALL = 0x10, /* dac external pacing, falling edge */ - DAC_PACER_EXT_RISE = 0x18, /* dac external pacing, rising edge */ -}; +#define DAC_EMPTY 0x1 /* fifo empty, read, write clear */ +#define DAC_START 0x4 /* start/arm fifo operations */ +#define DAC_PACER_MASK 0x18 /* bits that set pacer source */ +#define DAC_PACER_INT 0x8 /* int. pacing */ +#define DAC_PACER_EXT_FALL 0x10 /* ext. pacing, falling edge */ +#define DAC_PACER_EXT_RISE 0x18 /* ext. pacing, rising edge */ + static inline unsigned int DAC_CHAN_EN(unsigned int channel) { return 1 << (5 + (channel & 0x1)); /* enable channel 0 or 1 */ -- cgit v0.10.2 From 6993197b75686f79a2b6107d51ba57180ba33212 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 18:09:01 -0700 Subject: staging: comedi: cb_pcidas: add whitespace to all the #define's Add whitespace to all the #define's in the driver in order to improve the readability. Fix all the comments that are, or already were, > 80 characters. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 0188cf1..c0d9340 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -81,64 +81,65 @@ analog triggering on 1602 series /* PCI vendor number of ComputerBoards/MeasurementComputing */ #define PCI_VENDOR_ID_CB 0x1307 -#define TIMER_BASE 100 /* 10MHz master clock */ -#define AI_BUFFER_SIZE 1024 /* maximum fifo size of any supported board */ -#define AO_BUFFER_SIZE 1024 /* maximum fifo size of any supported board */ -#define NUM_CHANNELS_8800 8 -#define NUM_CHANNELS_7376 1 -#define NUM_CHANNELS_8402 2 -#define NUM_CHANNELS_DAC08 1 + +#define TIMER_BASE 100 /* 10MHz master clock */ +#define AI_BUFFER_SIZE 1024 /* max ai fifo size */ +#define AO_BUFFER_SIZE 1024 /* max ao fifo size */ +#define NUM_CHANNELS_8800 8 +#define NUM_CHANNELS_7376 1 +#define NUM_CHANNELS_8402 2 +#define NUM_CHANNELS_DAC08 1 /* Control/Status registers */ -#define INT_ADCFIFO 0 /* INTERRUPT / ADC FIFO register */ -#define INT_EOS 0x1 /* interrupt end of scan */ -#define INT_FHF 0x2 /* interrupt fifo half full */ -#define INT_FNE 0x3 /* interrupt fifo not empty */ -#define INT_MASK 0x3 /* mask of interrupt select bits */ -#define INTE 0x4 /* interrupt enable */ -#define DAHFIE 0x8 /* dac half full interrupt enable */ -#define EOAIE 0x10 /* end of acquisition interrupt enable */ -#define DAHFI 0x20 /* dac half full read status / write interrupt clear */ -#define EOAI 0x40 /* read end of acq. interrupt status / write clear */ -#define INT 0x80 /* read interrupt status / write clear */ -#define EOBI 0x200 /* read end of burst interrupt status */ -#define ADHFI 0x400 /* read half-full interrupt status */ -#define ADNEI 0x800 /* read fifo not empty interrupt latch status */ -#define ADNE 0x1000 /* read, fifo not empty (realtime, not latched) status */ -#define DAEMIE 0x1000 /* write, dac empty interrupt enable */ -#define LADFUL 0x2000 /* read fifo overflow / write clear */ -#define DAEMI 0x4000 /* dac fifo empty interrupt status / write clear */ - -#define ADCMUX_CONT 2 /* ADC CHANNEL MUX AND CONTROL register */ -#define BEGIN_SCAN(x) ((x) & 0xf) -#define END_SCAN(x) (((x) & 0xf) << 4) -#define GAIN_BITS(x) (((x) & 0x3) << 8) -#define UNIP 0x800 /* Analog front-end unipolar for range */ -#define SE 0x400 /* Inputs in single-ended mode */ -#define PACER_MASK 0x3000 /* pacer source bits */ -#define PACER_INT 0x1000 /* internal pacer */ -#define PACER_EXT_FALL 0x2000 /* external falling edge */ -#define PACER_EXT_RISE 0x3000 /* external rising edge */ -#define EOC 0x4000 /* adc not busy */ - -#define TRIG_CONTSTAT 4 /* TRIGGER CONTROL/STATUS register */ -#define SW_TRIGGER 0x1 /* software start trigger */ -#define EXT_TRIGGER 0x2 /* external start trigger */ -#define ANALOG_TRIGGER 0x3 /* external analog trigger */ -#define TRIGGER_MASK 0x3 /* mask of bits that determine start trigger */ -#define TGPOL 0x04 /* invert the edge/level of the external trigger (1602 only) */ -#define TGSEL 0x08 /* if set edge triggered, otherwise level trigerred (1602 only) */ -#define TGEN 0x10 /* enable external start trigger */ -#define BURSTE 0x20 /* burst mode enable */ -#define XTRCL 0x80 /* clear external trigger */ - -#define CALIBRATION_REG 6 /* CALIBRATION register */ -#define SELECT_8800_BIT 0x100 /* select 8800 caldac */ -#define SELECT_TRIMPOT_BIT 0x200 /* select ad7376 trim pot */ -#define SELECT_DAC08_BIT 0x400 /* select dac08 caldac */ +#define INT_ADCFIFO 0 /* INTERRUPT / ADC FIFO register */ +#define INT_EOS 0x1 /* int end of scan */ +#define INT_FHF 0x2 /* int fifo half full */ +#define INT_FNE 0x3 /* int fifo not empty */ +#define INT_MASK 0x3 /* mask of int select bits */ +#define INTE 0x4 /* int enable */ +#define DAHFIE 0x8 /* dac half full int enable */ +#define EOAIE 0x10 /* end of acq. int enable */ +#define DAHFI 0x20 /* dac half full status / clear */ +#define EOAI 0x40 /* end of acq. int status / clear */ +#define INT 0x80 /* int status / clear */ +#define EOBI 0x200 /* end of burst int status */ +#define ADHFI 0x400 /* half-full int status */ +#define ADNEI 0x800 /* fifo not empty int status (latch) */ +#define ADNE 0x1000 /* fifo not empty status (realtime) */ +#define DAEMIE 0x1000 /* dac empty int enable */ +#define LADFUL 0x2000 /* fifo overflow / clear */ +#define DAEMI 0x4000 /* dac fifo empty int status / clear */ + +#define ADCMUX_CONT 2 /* ADC CHANNEL MUX AND CONTROL reg */ +#define BEGIN_SCAN(x) ((x) & 0xf) +#define END_SCAN(x) (((x) & 0xf) << 4) +#define GAIN_BITS(x) (((x) & 0x3) << 8) +#define UNIP 0x800 /* Analog front-end unipolar mode */ +#define SE 0x400 /* Inputs in single-ended mode */ +#define PACER_MASK 0x3000 /* pacer source bits */ +#define PACER_INT 0x1000 /* int. pacer */ +#define PACER_EXT_FALL 0x2000 /* ext. falling edge */ +#define PACER_EXT_RISE 0x3000 /* ext. rising edge */ +#define EOC 0x4000 /* adc not busy */ + +#define TRIG_CONTSTAT 4 /* TRIGGER CONTROL/STATUS register */ +#define SW_TRIGGER 0x1 /* software start trigger */ +#define EXT_TRIGGER 0x2 /* ext. start trigger */ +#define ANALOG_TRIGGER 0x3 /* ext. analog trigger */ +#define TRIGGER_MASK 0x3 /* start trigger mask */ +#define TGPOL 0x04 /* invert trigger (1602 only) */ +#define TGSEL 0x08 /* edge/level trigerred (1602 only) */ +#define TGEN 0x10 /* enable external start trigger */ +#define BURSTE 0x20 /* burst mode enable */ +#define XTRCL 0x80 /* clear external trigger */ + +#define CALIBRATION_REG 6 /* CALIBRATION register */ +#define SELECT_8800_BIT 0x100 /* select 8800 caldac */ +#define SELECT_TRIMPOT_BIT 0x200 /* select ad7376 trim pot */ +#define SELECT_DAC08_BIT 0x400 /* select dac08 caldac */ #define CAL_SRC_BITS(x) (((x) & 0x7) << 11) -#define CAL_EN_BIT 0x4000 /* read calibration source instead of analog input channel 0 */ -#define SERIAL_DATA_IN_BIT 0x8000 /* serial data stream going to 8800 and 7376 */ +#define CAL_EN_BIT 0x4000 /* calibration source enable */ +#define SERIAL_DATA_IN_BIT 0x8000 /* serial data bit going to caldac */ #define DAC_CSR 0x8 /* dac control and status register */ #define DACEN 0x02 /* dac enable */ @@ -155,12 +156,12 @@ static inline unsigned int DAC_RANGE_MASK(unsigned int channel) }; /* bits for 1602 series only */ -#define DAC_EMPTY 0x1 /* fifo empty, read, write clear */ -#define DAC_START 0x4 /* start/arm fifo operations */ -#define DAC_PACER_MASK 0x18 /* bits that set pacer source */ -#define DAC_PACER_INT 0x8 /* int. pacing */ -#define DAC_PACER_EXT_FALL 0x10 /* ext. pacing, falling edge */ -#define DAC_PACER_EXT_RISE 0x18 /* ext. pacing, rising edge */ +#define DAC_EMPTY 0x1 /* fifo empty, read, write clear */ +#define DAC_START 0x4 /* start/arm fifo operations */ +#define DAC_PACER_MASK 0x18 /* bits that set pacer source */ +#define DAC_PACER_INT 0x8 /* int. pacing */ +#define DAC_PACER_EXT_FALL 0x10 /* ext. pacing, falling edge */ +#define DAC_PACER_EXT_RISE 0x18 /* ext. pacing, rising edge */ static inline unsigned int DAC_CHAN_EN(unsigned int channel) { @@ -168,13 +169,13 @@ static inline unsigned int DAC_CHAN_EN(unsigned int channel) }; /* analog input fifo */ -#define ADCDATA 0 /* ADC DATA register */ -#define ADCFIFOCLR 2 /* ADC FIFO CLEAR */ +#define ADCDATA 0 /* ADC DATA register */ +#define ADCFIFOCLR 2 /* ADC FIFO CLEAR */ /* pacer, counter, dio registers */ -#define ADC8254 0 -#define DIO_8255 4 -#define DAC8254 8 +#define ADC8254 0 +#define DIO_8255 4 +#define DAC8254 8 /* analog output registers for 100x, 1200 series */ static inline unsigned int DAC_DATA_REG(unsigned int channel) @@ -183,11 +184,11 @@ static inline unsigned int DAC_DATA_REG(unsigned int channel) } /* analog output registers for 1602 series*/ -#define DACDATA 0 /* DAC DATA register */ -#define DACFIFOCLR 2 /* DAC FIFO CLEAR */ +#define DACDATA 0 /* DAC DATA register */ +#define DACFIFOCLR 2 /* DAC FIFO CLEAR */ + +#define IS_UNIPOLAR 0x4 /* unipolar range mask */ -/* bit in hexadecimal representation of range index that indicates unipolar input range */ -#define IS_UNIPOLAR 0x4 /* analog input ranges for most boards */ static const struct comedi_lrange cb_pcidas_ranges = { 8, -- cgit v0.10.2 From d478b5f6f4d48a130533efb8da98b5526772f219 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 18:09:40 -0700 Subject: staging: comedi: cb_pcidas: fix remaining checkpatch.pl issues Fix the remaining three "WARNING: line over 80 characters" issues reported by checkpatch.pl. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index c0d9340..2a282d3 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -28,7 +28,8 @@ */ /* Driver: cb_pcidas -Description: MeasurementComputing PCI-DAS series with the AMCC S5933 PCI controller +Description: MeasurementComputing PCI-DAS series + with the AMCC S5933 PCI controller Author: Ivan Martinez , Frank Mori Hess Updated: 2003-3-11 @@ -243,7 +244,7 @@ struct cb_pcidas_board { int ai_speed; /* fastest conversion period in ns */ int ao_nchan; /* number of analog out channels */ int has_ao_fifo; /* analog output has fifo */ - int ao_scan_speed; /* analog output speed for 1602 series (for a scan, not conversion) */ + int ao_scan_speed; /* analog output scan speed for 1602 series */ int fifo_size; /* number of samples fifo can hold */ const struct comedi_lrange *ranges; enum trimpot_model trimpot; @@ -525,8 +526,6 @@ static int cb_pcidas_ao_fifo_winsn(struct comedi_device *dev, return 1; } -/* analog output readback insn */ -/* XXX loses track of analog output value back after an analog ouput command is executed */ static int cb_pcidas_ao_readback_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, -- cgit v0.10.2 From b78332daf47b624bef6220f1acf64ee49d38c1ad Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 18:10:22 -0700 Subject: staging: comedi: cb_pcidas: cleanup cb_pcidas_ao_fifo_winsn() Create local variables for the channel and range in order to cleanup to mask/set of the ao_control_bits. Remove the extra space in all the comments. Return the number of data parameters used (insn->n) to indicate success instead of the open coded '1'. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 2a282d3..bbbb9e4 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -498,32 +498,29 @@ static int cb_pcidas_ao_fifo_winsn(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { struct cb_pcidas_private *devpriv = dev->private; - int channel; + unsigned int chan = CR_CHAN(insn->chanspec); + unsigned int range = CR_RANGE(insn->chanspec); unsigned long flags; - /* clear dac fifo */ + /* clear dac fifo */ outw(0, devpriv->ao_registers + DACFIFOCLR); - /* set channel and range */ - channel = CR_CHAN(insn->chanspec); + /* set channel and range */ spin_lock_irqsave(&dev->spinlock, flags); - devpriv->ao_control_bits &= - ~DAC_CHAN_EN(0) & ~DAC_CHAN_EN(1) & ~DAC_RANGE_MASK(channel) & - ~DAC_PACER_MASK; - devpriv->ao_control_bits |= - DACEN | DAC_RANGE(channel, - CR_RANGE(insn-> - chanspec)) | DAC_CHAN_EN(channel) | - DAC_START; + devpriv->ao_control_bits &= (~DAC_CHAN_EN(0) & ~DAC_CHAN_EN(1) & + ~DAC_RANGE_MASK(chan) & ~DAC_PACER_MASK); + devpriv->ao_control_bits |= (DACEN | DAC_RANGE(chan, range) | + DAC_CHAN_EN(chan) | DAC_START); outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR); spin_unlock_irqrestore(&dev->spinlock, flags); - /* remember value for readback */ - devpriv->ao_value[channel] = data[0]; - /* send data */ + /* remember value for readback */ + devpriv->ao_value[chan] = data[0]; + + /* send data */ outw(data[0], devpriv->ao_registers + DACDATA); - return 1; + return insn->n; } static int cb_pcidas_ao_readback_insn(struct comedi_device *dev, -- cgit v0.10.2 From 7671896c4f7f66116798d7314a03995eddac4134 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 18:10:59 -0700 Subject: staging: comedi: cb_pcidas: cleanup cb_pcidas_ao_nofifo_winsn() Create local variables for the channel and range in order to cleanup to mask/set of the ao_control_bits. Remove the extra space in all the comments. Return the number of data parameters used (insn->n) to indicate success instead of the open coded '1'. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index bbbb9e4..b00ccad 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -471,25 +471,25 @@ static int cb_pcidas_ao_nofifo_winsn(struct comedi_device *dev, unsigned int *data) { struct cb_pcidas_private *devpriv = dev->private; - int channel; + unsigned int chan = CR_CHAN(insn->chanspec); + unsigned int range = CR_RANGE(insn->chanspec); unsigned long flags; - /* set channel and range */ - channel = CR_CHAN(insn->chanspec); + /* set channel and range */ spin_lock_irqsave(&dev->spinlock, flags); - devpriv->ao_control_bits &= - ~DAC_MODE_UPDATE_BOTH & ~DAC_RANGE_MASK(channel); - devpriv->ao_control_bits |= - DACEN | DAC_RANGE(channel, CR_RANGE(insn->chanspec)); + devpriv->ao_control_bits &= (~DAC_MODE_UPDATE_BOTH & + ~DAC_RANGE_MASK(chan)); + devpriv->ao_control_bits |= (DACEN | DAC_RANGE(chan, range)); outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR); spin_unlock_irqrestore(&dev->spinlock, flags); - /* remember value for readback */ - devpriv->ao_value[channel] = data[0]; - /* send data */ - outw(data[0], devpriv->ao_registers + DAC_DATA_REG(channel)); + /* remember value for readback */ + devpriv->ao_value[chan] = data[0]; + + /* send data */ + outw(data[0], devpriv->ao_registers + DAC_DATA_REG(chan)); - return 1; + return insn->n; } /* analog output insn for pcidas-1602 series */ -- cgit v0.10.2 From f66faa576f084bed49d4a34e0bc2289ff0d07a70 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 18:11:38 -0700 Subject: staging: comedi: cb_pcidas: cleanup cb_pcidas_ai_rinsn() Create local variables for the channel, range, and aref in order to make the remaining code a bit cleaner. Remove the extra space in all the comments. Remove the 'static const int timeout' and just use the open coded value in the loop. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index b00ccad..1479325 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -382,36 +382,33 @@ static inline unsigned int cal_enable_bits(struct comedi_device *dev) return CAL_EN_BIT | CAL_SRC_BITS(devpriv->calibration_source); } -/* - * "instructions" read/write data in "one-shot" or "software-triggered" - * mode. - */ static int cb_pcidas_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { struct cb_pcidas_private *devpriv = dev->private; - int n, i; + unsigned int chan = CR_CHAN(insn->chanspec); + unsigned int range = CR_RANGE(insn->chanspec); + unsigned int aref = CR_AREF(insn->chanspec); unsigned int bits; - static const int timeout = 10000; - int channel; - /* enable calibration input if appropriate */ + int n, i; + + /* enable calibration input if appropriate */ if (insn->chanspec & CR_ALT_SOURCE) { outw(cal_enable_bits(dev), devpriv->control_status + CALIBRATION_REG); - channel = 0; + chan = 0; } else { outw(0, devpriv->control_status + CALIBRATION_REG); - channel = CR_CHAN(insn->chanspec); } - /* set mux limits and gain */ - bits = BEGIN_SCAN(channel) | - END_SCAN(channel) | GAIN_BITS(CR_RANGE(insn->chanspec)); - /* set unipolar/bipolar */ - if (CR_RANGE(insn->chanspec) & IS_UNIPOLAR) + + /* set mux limits and gain */ + bits = BEGIN_SCAN(chan) | END_SCAN(chan) | GAIN_BITS(range); + /* set unipolar/bipolar */ + if (range & IS_UNIPOLAR) bits |= UNIP; - /* set singleended/differential */ - if (CR_AREF(insn->chanspec) != AREF_DIFF) + /* set single-ended/differential */ + if (aref != AREF_DIFF) bits |= SE; outw(bits, devpriv->control_status + ADCMUX_CONT); @@ -425,11 +422,11 @@ static int cb_pcidas_ai_rinsn(struct comedi_device *dev, /* wait for conversion to end */ /* return -ETIMEDOUT if there is a timeout */ - for (i = 0; i < timeout; i++) { + for (i = 0; i < 10000; i++) { if (inw(devpriv->control_status + ADCMUX_CONT) & EOC) break; } - if (i == timeout) + if (i == 10000) return -ETIMEDOUT; /* read data */ -- cgit v0.10.2 From b436356dcc67a665da07441ab113e9a5652073e5 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 26 Jun 2012 18:12:15 -0700 Subject: staging: comedi: cb_pcidas: cleanup dac08_write() Reverse the logic of the test against the cached value so that the function only has one exit point. Make the logic of the dac write a bit clearer by create a local variable for the address used in the outw() calls and masking the value to write and setting the enable bits before doing the outw() calls. Add a comment just to make sure it's clear. Also, add a comment about the 'return 1;'. This should be insn->n which is the number of data parameters used to do the dac08_write_insn() but the insn is not a parameter to this function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 1479325..3ba75af 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -662,23 +662,25 @@ static int caldac_read_insn(struct comedi_device *dev, static int dac08_write(struct comedi_device *dev, unsigned int value) { struct cb_pcidas_private *devpriv = dev->private; + unsigned long cal_reg; - if (devpriv->dac08_value == value) - return 1; + if (devpriv->dac08_value != value) { + devpriv->dac08_value = value; - devpriv->dac08_value = value; + cal_reg = devpriv->control_status + CALIBRATION_REG; - outw(cal_enable_bits(dev) | (value & 0xff), - devpriv->control_status + CALIBRATION_REG); - udelay(1); - outw(cal_enable_bits(dev) | SELECT_DAC08_BIT | (value & 0xff), - devpriv->control_status + CALIBRATION_REG); - udelay(1); - outw(cal_enable_bits(dev) | (value & 0xff), - devpriv->control_status + CALIBRATION_REG); - udelay(1); + value &= 0xff; + value |= cal_enable_bits(dev); - return 1; + /* latch the new value into the caldac */ + outw(value, cal_reg); + udelay(1); + outw(value | SELECT_DAC08_BIT, cal_reg); + udelay(1); + outw(value, cal_reg); + udelay(1); + } + return 1; /* insn->n */ } static int dac08_write_insn(struct comedi_device *dev, -- cgit v0.10.2 From ac55ca32ca40de3cb52a1ca73ca4a9250e07eefd Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 27 Jun 2012 09:17:17 -0700 Subject: staging: comedi: cb_pcidas: fix dac08_write_insn() As pointed out by Ian Abbott, the comedi INSN_WRITE instructions are meant to iterate over, and write, all the data[] passed from the comedi core. Modify dac08_write_insn() to work as intended. Since doc08_write_insn() now returns the proper response to the core, make the dac08_write() helper return void. Signed-off-by: H Hartley Sweeten Reported-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 3ba75af..301444e 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -659,7 +659,7 @@ static int caldac_read_insn(struct comedi_device *dev, } /* 1602/16 pregain offset */ -static int dac08_write(struct comedi_device *dev, unsigned int value) +static void dac08_write(struct comedi_device *dev, unsigned int value) { struct cb_pcidas_private *devpriv = dev->private; unsigned long cal_reg; @@ -680,14 +680,18 @@ static int dac08_write(struct comedi_device *dev, unsigned int value) outw(value, cal_reg); udelay(1); } - return 1; /* insn->n */ } static int dac08_write_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - return dac08_write(dev, data[0]); + int i; + + for (i = 0; i < insn->n; i++) + dac08_write(dev, data[i]); + + return insn->n; } static int dac08_read_insn(struct comedi_device *dev, -- cgit v0.10.2 From 949a18d39d75e92f516d562befe5447d368ab67d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 27 Jun 2012 14:53:28 -0700 Subject: staging: comedi: adl_pci6208: remove thisboard and devpriv macros The 'thisboard' and 'devpriv' macros rely on a local variable having a specific name and yield pointers derived from that local variable. Replace the macros with local variables where used. Use the comedi_board() helper to get the 'thisboard' pointer. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index 79f6765..720f870 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -82,21 +82,17 @@ static const struct pci6208_board pci6208_boards[] = { } }; -/* Will be initialized in pci6208_find device(). */ -#define thisboard ((const struct pci6208_board *)dev->board_ptr) - struct pci6208_private { int data; struct pci_dev *pci_dev; /* for a PCI device */ unsigned int ao_readback[2]; /* Used for AO readback */ }; -#define devpriv ((struct pci6208_private *)dev->private) - static int pci6208_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct pci6208_private *devpriv = dev->private; int i = 0, Data_Read; unsigned short chan = CR_CHAN(insn->chanspec); unsigned long invert = 1 << (16 - 1); @@ -123,6 +119,7 @@ static int pci6208_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct pci6208_private *devpriv = dev->private; int i; int chan = CR_CHAN(insn->chanspec); @@ -183,6 +180,7 @@ static int pci6208_ao_rinsn(struct comedi_device *dev, static int pci6208_find_device(struct comedi_device *dev, int bus, int slot) { + struct pci6208_private *devpriv = dev->private; struct pci_dev *pci_dev = NULL; int i; @@ -278,19 +276,23 @@ pci6208_pci_setup(struct pci_dev *pci_dev, unsigned long *io_base_ptr, static int pci6208_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct pci6208_board *thisboard; + struct pci6208_private *devpriv; struct comedi_subdevice *s; int retval; unsigned long io_base; printk(KERN_INFO "comedi%d: pci6208: ", dev->minor); - retval = alloc_private(dev, sizeof(struct pci6208_private)); + retval = alloc_private(dev, sizeof(*devpriv)); if (retval < 0) return retval; + devpriv = dev->private; retval = pci6208_find_device(dev, it->options[0], it->options[1]); if (retval < 0) return retval; + thisboard = comedi_board(dev); retval = pci6208_pci_setup(devpriv->pci_dev, &io_base, dev->minor); if (retval < 0) @@ -330,6 +332,8 @@ static int pci6208_attach(struct comedi_device *dev, static void pci6208_detach(struct comedi_device *dev) { + struct pci6208_private *devpriv = dev->private; + if (devpriv && devpriv->pci_dev) { if (dev->iobase) comedi_pci_disable(devpriv->pci_dev); -- cgit v0.10.2 From cde6f08a5e28e2f0c08ecadd98465bfb48e01472 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 27 Jun 2012 14:55:19 -0700 Subject: staging: comedi: adl_pci6208: refactor pci6208_find_device() Make the "find pci device" functions consistent in the comedi drivers. Hopefully well be able to move it into the core... Refactor the "find pci device" function to return a pointer to the found struct pci_dev instead of an error code. Also, change some of the tests to reduce the indent level of the code. Pass the struct comedi_devconfig pointer to the function instead of the bus/slot numbers. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index 720f870..5f073c5 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -178,60 +178,43 @@ static int pci6208_ao_rinsn(struct comedi_device *dev, /* return 1; */ /* } */ -static int pci6208_find_device(struct comedi_device *dev, int bus, int slot) +static struct pci_dev *pci6208_find_device(struct comedi_device *dev, + struct comedi_devconfig *it) { - struct pci6208_private *devpriv = dev->private; + const struct pci6208_board *thisboard; struct pci_dev *pci_dev = NULL; + int bus = it->options[0]; + int slot = it->options[1]; int i; for_each_pci_dev(pci_dev) { - if (pci_dev->vendor == PCI_VENDOR_ID_ADLINK) { - for (i = 0; i < ARRAY_SIZE(pci6208_boards); i++) { - if (pci6208_boards[i].dev_id == - pci_dev->device) { - /* - * was a particular bus/slot requested? - */ - if ((bus != 0) || (slot != 0)) { - /* - * are we on the - * wrong bus/slot? - */ - if (pci_dev->bus->number - != bus || - PCI_SLOT(pci_dev->devfn) - != slot) { - continue; - } - } - dev->board_ptr = pci6208_boards + i; - goto found; - } + if (pci_dev->vendor != PCI_VENDOR_ID_ADLINK) + continue; + for (i = 0; i < ARRAY_SIZE(pci6208_boards); i++) { + thisboard = &pci6208_boards[i]; + if (thisboard->dev_id != pci_dev->device) + continue; + /* was a particular bus/slot requested? */ + if (bus || slot) { + /* are we on the wrong bus/slot? */ + if (pci_dev->bus->number != bus || + PCI_SLOT(pci_dev->devfn) != slot) + continue; } + dev_dbg(dev->class_dev, + "Found %s on bus %d, slot, %d, irq=%d\n", + thisboard->name, + pci_dev->bus->number, + PCI_SLOT(pci_dev->devfn), + pci_dev->irq); + dev->board_ptr = thisboard; + return pci_dev; } } - - printk(KERN_ERR "comedi%d: no supported board found! " - "(req. bus/slot : %d/%d)\n", - dev->minor, bus, slot); - return -EIO; - -found: - printk("comedi%d: found %s (b:s:f=%d:%d:%d) , irq=%d\n", - dev->minor, - pci6208_boards[i].name, - pci_dev->bus->number, - PCI_SLOT(pci_dev->devfn), - PCI_FUNC(pci_dev->devfn), pci_dev->irq); - - /* TODO: Warn about non-tested boards. */ - /* switch(board->device_id) */ - /* { */ - /* }; */ - - devpriv->pci_dev = pci_dev; - - return 0; + dev_err(dev->class_dev, + "No supported board found! (req. bus %d, slot %d)\n", + bus, slot); + return NULL; } static int @@ -289,9 +272,9 @@ static int pci6208_attach(struct comedi_device *dev, return retval; devpriv = dev->private; - retval = pci6208_find_device(dev, it->options[0], it->options[1]); - if (retval < 0) - return retval; + devpriv->pci_dev = pci6208_find_device(dev, it); + if (!devpriv->pci_dev) + return -EIO; thisboard = comedi_board(dev); retval = pci6208_pci_setup(devpriv->pci_dev, &io_base, dev->minor); -- cgit v0.10.2 From 745c22a016b28912fdc802656186da59121edbb1 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 27 Jun 2012 14:56:03 -0700 Subject: staging: comedi: adl_pci6208: remove the boardinfo 'ao_bits' All the boards supported by this driver have 16-bit DACs. The ao_bits variable in the boardinfo is commented out anyway. Just remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index 5f073c5..f949d20 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -58,7 +58,6 @@ struct pci6208_board { const char *name; unsigned short dev_id; /* `lspci` will show you this */ int ao_chans; - /* int ao_bits; */ }; static const struct pci6208_board pci6208_boards[] = { @@ -66,19 +65,16 @@ static const struct pci6208_board pci6208_boards[] = { .name = "pci6208v", .dev_id = 0x6208, // not sure .ao_chans = 8 - // , .ao_bits = 16 }, { .name = "pci6216v", .dev_id = 0x6208, // not sure .ao_chans = 16 - // , .ao_bits = 16 }, */ { .name = "pci6208a", .dev_id = 0x6208, .ao_chans = 8 - /* , .ao_bits = 16 */ } }; -- cgit v0.10.2 From 7b6afad100f50130e6c5a347760e83b83aaa7cc7 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 27 Jun 2012 14:56:43 -0700 Subject: staging: comedi: adl_pci6208: document the register map of the device Add defines for the register map of the device. These will be used to clarify the code. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index f949d20..b6a8439 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -53,6 +53,18 @@ References: */ #include "../comedidev.h" +/* + * PCI-6208/6216-GL register map + */ +#define PCI6208_AO_CONTROL(x) (0x00 + (2 * (x))) +#define PCI6208_AO_STATUS 0x00 +#define PCI6208_AO_STATUS_DATA_SEND (1 << 0) +#define PCI6208_DIO 0x40 +#define PCI6208_DIO_DO_MASK (0x0f) +#define PCI6208_DIO_DO_SHIFT (0) +#define PCI6208_DIO_DI_MASK (0xf0) +#define PCI6208_DIO_DI_SHIFT (4) + /* Board descriptions */ struct pci6208_board { const char *name; -- cgit v0.10.2 From a28c98524c2634a5d84151de253ee7e99e38564d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 27 Jun 2012 14:57:22 -0700 Subject: staging: comedi: adl_pci6208: cleanup pci6208_pci_setup() The "local configuration register" stuff is not required. The io base/range are only queried for use in a kernel message that it just added noise. Similar with the io range for the actual io base used by the driver. Remove both printk's and all the unnecessary code. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index b6a8439..a96fac4 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -229,7 +229,7 @@ static int pci6208_pci_setup(struct pci_dev *pci_dev, unsigned long *io_base_ptr, int dev_minor) { - unsigned long io_base, io_range, lcr_io_base, lcr_io_range; + unsigned long io_base; /* Enable PCI device and request regions */ if (comedi_pci_enable(pci_dev, "adl_pci6208") < 0) { @@ -238,28 +238,11 @@ pci6208_pci_setup(struct pci_dev *pci_dev, unsigned long *io_base_ptr, dev_minor); return -EIO; } - /* Read local configuration register - * base address [PCI_BASE_ADDRESS #1]. - */ - lcr_io_base = pci_resource_start(pci_dev, 1); - lcr_io_range = pci_resource_len(pci_dev, 1); - - printk(KERN_INFO "comedi%d: local config registers at address" - " 0x%4lx [0x%4lx]\n", - dev_minor, lcr_io_base, lcr_io_range); /* Read PCI6208 register base address [PCI_BASE_ADDRESS #2]. */ io_base = pci_resource_start(pci_dev, 2); - io_range = pci_resource_end(pci_dev, 2) - io_base + 1; - - printk("comedi%d: 6208 registers at address 0x%4lx [0x%4lx]\n", - dev_minor, io_base, io_range); *io_base_ptr = io_base; - /* devpriv->io_range = io_range; */ - /* devpriv->is_valid=0; */ - /* devpriv->lcr_io_base=lcr_io_base; */ - /* devpriv->lcr_io_range=lcr_io_range; */ return 0; } -- cgit v0.10.2 From db7c275d9ffd2c58648b1bf023ab62cf993ddfac Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 27 Jun 2012 14:58:03 -0700 Subject: staging: comedi: adl_pci6208: remove pci6208_pci_setup() Refactor pci6208_pci_setup() into the attach function. This function simply enables the pci device and gets the PCI iobase address used by the driver. There's no need for a separate function to handle this. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index a96fac4..e2ca685 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -225,28 +225,6 @@ static struct pci_dev *pci6208_find_device(struct comedi_device *dev, return NULL; } -static int -pci6208_pci_setup(struct pci_dev *pci_dev, unsigned long *io_base_ptr, - int dev_minor) -{ - unsigned long io_base; - - /* Enable PCI device and request regions */ - if (comedi_pci_enable(pci_dev, "adl_pci6208") < 0) { - printk(KERN_ERR "comedi%d: Failed to enable PCI device " - "and request regions\n", - dev_minor); - return -EIO; - } - - /* Read PCI6208 register base address [PCI_BASE_ADDRESS #2]. */ - io_base = pci_resource_start(pci_dev, 2); - - *io_base_ptr = io_base; - - return 0; -} - static int pci6208_attach(struct comedi_device *dev, struct comedi_devconfig *it) { @@ -254,7 +232,6 @@ static int pci6208_attach(struct comedi_device *dev, struct pci6208_private *devpriv; struct comedi_subdevice *s; int retval; - unsigned long io_base; printk(KERN_INFO "comedi%d: pci6208: ", dev->minor); @@ -268,11 +245,14 @@ static int pci6208_attach(struct comedi_device *dev, return -EIO; thisboard = comedi_board(dev); - retval = pci6208_pci_setup(devpriv->pci_dev, &io_base, dev->minor); - if (retval < 0) - return retval; + if (comedi_pci_enable(devpriv->pci_dev, "adl_pci6208") < 0) { + dev_err(dev->class_dev, + "Failed to enable PCI device and request regions\n"); + return -EIO; + } + + dev->iobase = pci_resource_start(devpriv->pci_dev, 2); - dev->iobase = io_base; dev->board_name = thisboard->name; retval = comedi_alloc_subdevices(dev, 2); -- cgit v0.10.2 From 9d639b6b252759e6333aa576645f25624c4b9a99 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 27 Jun 2012 14:59:19 -0700 Subject: staging: comedi: adl_pci6208: pass on the error code from comedi_pci_enable Return the actual error code from comedi_pci_enable instead of assuming -EIO on failure. Also, shorten the local variable name 'retval' to 'ret'. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index e2ca685..8ec2660 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -231,13 +231,13 @@ static int pci6208_attach(struct comedi_device *dev, const struct pci6208_board *thisboard; struct pci6208_private *devpriv; struct comedi_subdevice *s; - int retval; + int ret; printk(KERN_INFO "comedi%d: pci6208: ", dev->minor); - retval = alloc_private(dev, sizeof(*devpriv)); - if (retval < 0) - return retval; + ret = alloc_private(dev, sizeof(*devpriv)); + if (ret < 0) + return ret; devpriv = dev->private; devpriv->pci_dev = pci6208_find_device(dev, it); @@ -245,19 +245,20 @@ static int pci6208_attach(struct comedi_device *dev, return -EIO; thisboard = comedi_board(dev); - if (comedi_pci_enable(devpriv->pci_dev, "adl_pci6208") < 0) { + ret = comedi_pci_enable(devpriv->pci_dev, "adl_pci6208"); + if (ret) { dev_err(dev->class_dev, "Failed to enable PCI device and request regions\n"); - return -EIO; + return ret; } dev->iobase = pci_resource_start(devpriv->pci_dev, 2); dev->board_name = thisboard->name; - retval = comedi_alloc_subdevices(dev, 2); - if (retval) - return retval; + ret = comedi_alloc_subdevices(dev, 2); + if (ret) + return ret; s = dev->subdevices + 0; /* analog output subdevice */ -- cgit v0.10.2 From b4dda059056a9be086fc95abe2a7410b87e6c33f Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 27 Jun 2012 15:00:02 -0700 Subject: staging: comedi: adl_pci6208: consolidate the attach messages Consolidate the attach messages into one dev_info() output at the end of a successful attach. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index 8ec2660..13cdbcc 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -233,8 +233,6 @@ static int pci6208_attach(struct comedi_device *dev, struct comedi_subdevice *s; int ret; - printk(KERN_INFO "comedi%d: pci6208: ", dev->minor); - ret = alloc_private(dev, sizeof(*devpriv)); if (ret < 0) return ret; @@ -280,7 +278,8 @@ static int pci6208_attach(struct comedi_device *dev, /* s->insn_bits = pci6208_dio_insn_bits; */ /* s->insn_config = pci6208_dio_insn_config; */ - printk(KERN_INFO "attached\n"); + dev_info(dev->class_dev, "%s: %s, I/O base=0x%04lx\n", + dev->driver->driver_name, dev->board_name, dev->iobase); return 1; } -- cgit v0.10.2 From fc2536fd814ea1e4399ccbfc913b5742e467320a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 27 Jun 2012 15:00:50 -0700 Subject: staging: comedi: adl_pci6208: fix the digital i/o subdevice The PCI-6208 board has 4 digital outputs and 4 digital inputs. The support for the digital i/o subdevice was commented out and the code was just cut-and-paste from the skel driver. Enable the digital i/o subdevice by uncommenting the code and fixing the insn_bits and insn_config functions. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index 13cdbcc..e3f459b 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -137,54 +137,45 @@ static int pci6208_ao_rinsn(struct comedi_device *dev, return i; } -/* DIO devices are slightly special. Although it is possible to - * implement the insn_read/insn_write interface, it is much more - * useful to applications if you implement the insn_bits interface. - * This allows packed reading/writing of the DIO channels. The - * comedi core can convert between insn_bits and insn_read/write */ -/* static int pci6208_dio_insn_bits(struct comedi_device *dev, - * struct comedi_subdevice *s, */ -/* struct comedi_insn *insn,unsigned int *data) */ -/* { */ - /* The insn data is a mask in data[0] and the new data - * in data[1], each channel cooresponding to a bit. */ -/* if(data[0]){ */ -/* s->state &= ~data[0]; */ -/* s->state |= data[0]&data[1]; */ - /* Write out the new digital output lines */ - /* outw(s->state,dev->iobase + SKEL_DIO); */ -/* } */ - - /* on return, data[1] contains the value of the digital - * input and output lines. */ - /* data[1]=inw(dev->iobase + SKEL_DIO); */ - /* or we could just return the software copy of the output values if - * it was a purely digital output subdevice */ - /* data[1]=s->state; */ - -/* return insn->n; */ -/* } */ - -/* static int pci6208_dio_insn_config(struct comedi_device *dev, - * struct comedi_subdevice *s, */ -/* struct comedi_insn *insn,unsigned int *data) */ -/* { */ -/* int chan=CR_CHAN(insn->chanspec); */ - - /* The input or output configuration of each digital line is - * configured by a special insn_config instruction. chanspec - * contains the channel to be changed, and data[0] contains the - * value COMEDI_INPUT or COMEDI_OUTPUT. */ - -/* if(data[0]==COMEDI_OUTPUT){ */ -/* s->io_bits |= 1<io_bits &= ~(1<io_bits,dev->iobase + SKEL_DIO_CONFIG); */ - -/* return 1; */ -/* } */ +static int pci6208_dio_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + unsigned int mask = data[0] & PCI6208_DIO_DO_MASK; + unsigned int bits = data[1]; + + if (mask) { + s->state &= ~mask; + s->state |= bits & mask; + + outw(s->state, dev->iobase + PCI6208_DIO); + } + + s->state = inw(dev->iobase + PCI6208_DIO); + data[1] = s->state; + + return insn->n; +} + +static int pci6208_dio_insn_config(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + int chan = CR_CHAN(insn->chanspec); + unsigned int mask = 1 << chan; + + switch (data[0]) { + case INSN_CONFIG_DIO_QUERY: + data[1] = (s->io_bits & mask) ? COMEDI_OUTPUT : COMEDI_INPUT; + break; + default: + return -EINVAL; + } + + return insn->n; +} static struct pci_dev *pci6208_find_device(struct comedi_device *dev, struct comedi_devconfig *it) @@ -268,15 +259,18 @@ static int pci6208_attach(struct comedi_device *dev, s->insn_write = pci6208_ao_winsn; s->insn_read = pci6208_ao_rinsn; - /* s=dev->subdevices+1; */ + s = dev->subdevices + 1; /* digital i/o subdevice */ - /* s->type=COMEDI_SUBD_DIO; */ - /* s->subdev_flags=SDF_READABLE|SDF_WRITABLE; */ - /* s->n_chan=16; */ - /* s->maxdata=1; */ - /* s->range_table=&range_digital; */ - /* s->insn_bits = pci6208_dio_insn_bits; */ - /* s->insn_config = pci6208_dio_insn_config; */ + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pci6208_dio_insn_bits; + s->insn_config = pci6208_dio_insn_config; + + s->io_bits = 0x0f; + s->state = inw(dev->iobase + PCI6208_DIO); dev_info(dev->class_dev, "%s: %s, I/O base=0x%04lx\n", dev->driver->driver_name, dev->board_name, dev->iobase); -- cgit v0.10.2 From 111b62e48139767a42fc87b422f39b5909c27ac6 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 27 Jun 2012 15:01:26 -0700 Subject: staging: comedi: adl_pci6208: add whitespace to the subdev init Add whitespace to the subdev initialization and remove the unnecessary comments to improve readability. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index e3f459b..b65fed7 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -251,26 +251,26 @@ static int pci6208_attach(struct comedi_device *dev, s = dev->subdevices + 0; /* analog output subdevice */ - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; /* anything else to add here?? */ - s->n_chan = thisboard->ao_chans; - s->maxdata = 0xffff; /* 16-bit DAC */ - s->range_table = &range_bipolar10; /* this needs to be checked. */ - s->insn_write = pci6208_ao_winsn; - s->insn_read = pci6208_ao_rinsn; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = thisboard->ao_chans; + s->maxdata = 0xffff; + s->range_table = &range_bipolar10; + s->insn_write = pci6208_ao_winsn; + s->insn_read = pci6208_ao_rinsn; s = dev->subdevices + 1; /* digital i/o subdevice */ - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pci6208_dio_insn_bits; - s->insn_config = pci6208_dio_insn_config; - - s->io_bits = 0x0f; - s->state = inw(dev->iobase + PCI6208_DIO); + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pci6208_dio_insn_bits; + s->insn_config = pci6208_dio_insn_config; + + s->io_bits = 0x0f; + s->state = inw(dev->iobase + PCI6208_DIO); dev_info(dev->class_dev, "%s: %s, I/O base=0x%04lx\n", dev->driver->driver_name, dev->board_name, dev->iobase); -- cgit v0.10.2 From 98bcf9119cbcab67768a548bcb6dfc2b9464cb96 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 27 Jun 2012 15:01:58 -0700 Subject: staging: comedi: adl_pci6208: return '0' for successful attach The comedi core expects a < 0 value during the attach to indicate an error. The normal 'success' return for the kernel is '0' so use that here. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index b65fed7..39bdf32 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -275,7 +275,7 @@ static int pci6208_attach(struct comedi_device *dev, dev_info(dev->class_dev, "%s: %s, I/O base=0x%04lx\n", dev->driver->driver_name, dev->board_name, dev->iobase); - return 1; + return 0; } static void pci6208_detach(struct comedi_device *dev) -- cgit v0.10.2 From dcff1681cb49b2b2be3a3cddee620a81fc81e8e6 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 27 Jun 2012 15:02:53 -0700 Subject: staging: comedi: adl_pci6208: remove the bogus pci devices Remove the commented out pci device entries in the MODULE_DEVICE_TABLE as well as the associated boardinfo, which is also commented out. Add some whitespace to the boardinfo to improve readability. This driver should also support the pci-6216 card which has an additional 8 analog outputs (16 total). But the device id needs to be determined. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index 39bdf32..fe97db2 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -73,21 +73,11 @@ struct pci6208_board { }; static const struct pci6208_board pci6208_boards[] = { - /*{ - .name = "pci6208v", - .dev_id = 0x6208, // not sure - .ao_chans = 8 - }, - { - .name = "pci6216v", - .dev_id = 0x6208, // not sure - .ao_chans = 16 - }, */ { - .name = "pci6208a", - .dev_id = 0x6208, - .ao_chans = 8 - } + .name = "pci6208a", + .dev_id = 0x6208, + .ao_chans = 8, + }, }; struct pci6208_private { @@ -307,11 +297,7 @@ static void __devexit adl_pci6208_pci_remove(struct pci_dev *dev) comedi_pci_auto_unconfig(dev); } -/* This is used by modprobe to translate PCI IDs to drivers. Should - * only be used for PCI and ISA-PnP devices */ static DEFINE_PCI_DEVICE_TABLE(adl_pci6208_pci_table) = { - /* { PCI_VENDOR_ID_ADLINK, 0x6208, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, */ - /* { PCI_VENDOR_ID_ADLINK, 0x6208, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, */ { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, 0x6208) }, { 0 } }; -- cgit v0.10.2 From a7c6de4cf6712771155778c454a762cc2b38e12d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 27 Jun 2012 15:03:31 -0700 Subject: staging: comedi: adl_pci6208: remove some useless comments Remove a number of useless comments that are cut-and-paste from the skel driver. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index fe97db2..18ca400 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -41,16 +41,7 @@ References: - adl_pci9111.c copied the entire pci setup section - adl_pci9118.c */ -/* - * These headers should be followed by a blank line, and any comments - * you wish to say about the driver. The comment area is the place - * to put any known bugs, limitations, unsupported features, supported - * command triggers, whether or not commands are supported on particular - * subdevices, etc. - * - * Somewhere in the comment should be information about configuration - * options that are used with comedi_config. - */ + #include "../comedidev.h" /* @@ -65,10 +56,9 @@ References: #define PCI6208_DIO_DI_MASK (0xf0) #define PCI6208_DIO_DI_SHIFT (4) -/* Board descriptions */ struct pci6208_board { const char *name; - unsigned short dev_id; /* `lspci` will show you this */ + unsigned short dev_id; int ao_chans; }; @@ -82,8 +72,8 @@ static const struct pci6208_board pci6208_boards[] = { struct pci6208_private { int data; - struct pci_dev *pci_dev; /* for a PCI device */ - unsigned int ao_readback[2]; /* Used for AO readback */ + struct pci_dev *pci_dev; + unsigned int ao_readback[2]; }; static int pci6208_ao_winsn(struct comedi_device *dev, @@ -95,11 +85,9 @@ static int pci6208_ao_winsn(struct comedi_device *dev, unsigned short chan = CR_CHAN(insn->chanspec); unsigned long invert = 1 << (16 - 1); unsigned long out_value; - /* Writing a list of values to an AO channel is probably not - * very useful, but that's how the interface is defined. */ + for (i = 0; i < insn->n; i++) { out_value = data[i] ^ invert; - /* a typical programming sequence */ do { Data_Read = (inw(dev->iobase) & 1); } while (Data_Read); @@ -107,12 +95,9 @@ static int pci6208_ao_winsn(struct comedi_device *dev, devpriv->ao_readback[chan] = out_value; } - /* return the number of samples read/written */ return i; } -/* AO subdevices should have a read insn as well as a write insn. - * Usually this means copying a value stored in devpriv. */ static int pci6208_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) -- cgit v0.10.2 From 149b98d1ea4e5d798cd7f954a239ed512c3bf7e5 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 27 Jun 2012 15:04:04 -0700 Subject: staging: comedi: adl_pci6208: remove unused variable in the private data The 'data' variable in the private data struct is not used by the driver. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index 18ca400..dcaebfc 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -71,7 +71,6 @@ static const struct pci6208_board pci6208_boards[] = { }; struct pci6208_private { - int data; struct pci_dev *pci_dev; unsigned int ao_readback[2]; }; -- cgit v0.10.2 From 5c67df8b98316fbfede8d4d6bac64d52d4327357 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 27 Jun 2012 15:04:47 -0700 Subject: staging: comedi: adl_pci6208: fix the ao_readback variable size The 'ao_readback' variable in the private data struct is used to cache the last value written to the analog output DAC channels. The PCI-6208 has 8 analog output channels but the variable only allowed space to cache 2 values. Since the PCI-6216 board could be supported by this driver and it has 16 analog outputs, create a define for the maximum number of channels and use that to set the size of 'ao_readback'. For now, set the max to 8 to save space since the PCI-6216 is not currently supported. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index dcaebfc..d15f0cb 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -56,6 +56,8 @@ References: #define PCI6208_DIO_DI_MASK (0xf0) #define PCI6208_DIO_DI_SHIFT (4) +#define PCI6208_MAX_AO_CHANNELS 8 + struct pci6208_board { const char *name; unsigned short dev_id; @@ -72,7 +74,7 @@ static const struct pci6208_board pci6208_boards[] = { struct pci6208_private { struct pci_dev *pci_dev; - unsigned int ao_readback[2]; + unsigned int ao_readback[PCI6208_MAX_AO_CHANNELS]; }; static int pci6208_ao_winsn(struct comedi_device *dev, -- cgit v0.10.2 From 8366404bf1c034d902af06a6a6d88fe77a2cc7fb Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 27 Jun 2012 15:06:14 -0700 Subject: staging: comedi: adl_pci6208: cleanup pci6208_ao_winsn() Use the defines for the register map to make the code a bit clearer. Shorten or rename some of the local variables for the same reason. Only the last value written to the DAC needs to be cached in the ao_readback variable. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index d15f0cb..7120878 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -82,21 +82,24 @@ static int pci6208_ao_winsn(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { struct pci6208_private *devpriv = dev->private; - int i = 0, Data_Read; - unsigned short chan = CR_CHAN(insn->chanspec); + int chan = CR_CHAN(insn->chanspec); unsigned long invert = 1 << (16 - 1); - unsigned long out_value; + unsigned long value = 0; + unsigned short status; + int i; for (i = 0; i < insn->n; i++) { - out_value = data[i] ^ invert; + value = data[i] ^ invert; + do { - Data_Read = (inw(dev->iobase) & 1); - } while (Data_Read); - outw(out_value, dev->iobase + (0x02 * chan)); - devpriv->ao_readback[chan] = out_value; + status = inw(dev->iobase + PCI6208_AO_STATUS); + } while (status & PCI6208_AO_STATUS_DATA_SEND); + + outw(value, dev->iobase + PCI6208_AO_CONTROL(chan)); } + devpriv->ao_readback[chan] = value; - return i; + return insn->n; } static int pci6208_ao_rinsn(struct comedi_device *dev, -- cgit v0.10.2 From 7c1e5bc7544db67985fed627cba206fc5dee6405 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 27 Jun 2012 15:07:05 -0700 Subject: staging: comedi: adl_pci6208: cleanup pci6208_ao_rinsn() For aesthetic reasons, reorder the local variables and change the return value to 'insn->n'. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index 7120878..aa2db5d 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -107,13 +107,13 @@ static int pci6208_ao_rinsn(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { struct pci6208_private *devpriv = dev->private; - int i; int chan = CR_CHAN(insn->chanspec); + int i; for (i = 0; i < insn->n; i++) data[i] = devpriv->ao_readback[chan]; - return i; + return insn->n; } static int pci6208_dio_insn_bits(struct comedi_device *dev, -- cgit v0.10.2 From 2d993c242fea1dc41395a40fd7001127afa3b090 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 27 Jun 2012 15:07:56 -0700 Subject: staging: comedi: adl_pci6208: cleanup pci6208_attach() For aesthetic reasons, set the dev->board_name as soon as the thisboard pointer is available. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index aa2db5d..cb14ffd 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -213,17 +213,16 @@ static int pci6208_attach(struct comedi_device *dev, return -EIO; thisboard = comedi_board(dev); + dev->board_name = thisboard->name; + ret = comedi_pci_enable(devpriv->pci_dev, "adl_pci6208"); if (ret) { dev_err(dev->class_dev, "Failed to enable PCI device and request regions\n"); return ret; } - dev->iobase = pci_resource_start(devpriv->pci_dev, 2); - dev->board_name = thisboard->name; - ret = comedi_alloc_subdevices(dev, 2); if (ret) return ret; -- cgit v0.10.2 From 404f99910eb06b92e034112533bab997569dc0d4 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 27 Jun 2012 15:08:39 -0700 Subject: staging: comedi: adl_pci6208: use the driver_name for the resource name Use the dev->driver->driver_name for the resource name passed to pci_request_regions(), by way of comedi_pci_enable(), instead of the open coded string "adl_pci6208". Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index cb14ffd..487fd4a 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -215,7 +215,7 @@ static int pci6208_attach(struct comedi_device *dev, dev->board_name = thisboard->name; - ret = comedi_pci_enable(devpriv->pci_dev, "adl_pci6208"); + ret = comedi_pci_enable(devpriv->pci_dev, dev->driver->driver_name); if (ret) { dev_err(dev->class_dev, "Failed to enable PCI device and request regions\n"); -- cgit v0.10.2 From 6f37e28821c38ea1981cef26ca6187cf307ea612 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 29 Jun 2012 17:35:26 -0700 Subject: staging: comedi: ni_670x: use module_comedi_pci_driver Refactor the driver to use the module_comedi_pci_driver() helper. This gets rid of some of the module boilerplate code. For aesthetic reasons, rename the comedi_driver and pci_driver to follow the convention of the other comedi pci drivers. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index 9032bac..cea43de 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -88,14 +88,6 @@ static const struct ni_670x_board ni_670x_boards[] = { }, }; -static DEFINE_PCI_DEVICE_TABLE(ni_670x_pci_table) = { - {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2c90)}, - {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1920)}, - {0} -}; - -MODULE_DEVICE_TABLE(pci, ni_670x_pci_table); - #define thisboard ((struct ni_670x_board *)dev->board_ptr) struct ni_670x_private { @@ -109,55 +101,6 @@ struct ni_670x_private { #define devpriv ((struct ni_670x_private *)dev->private) #define n_ni_670x_boards ARRAY_SIZE(ni_670x_boards) -static int ni_670x_attach(struct comedi_device *dev, - struct comedi_devconfig *it); -static void ni_670x_detach(struct comedi_device *dev); - -static struct comedi_driver driver_ni_670x = { - .driver_name = "ni_670x", - .module = THIS_MODULE, - .attach = ni_670x_attach, - .detach = ni_670x_detach, -}; - -static int __devinit driver_ni_670x_pci_probe(struct pci_dev *dev, - const struct pci_device_id *ent) -{ - return comedi_pci_auto_config(dev, &driver_ni_670x); -} - -static void __devexit driver_ni_670x_pci_remove(struct pci_dev *dev) -{ - comedi_pci_auto_unconfig(dev); -} - -static struct pci_driver driver_ni_670x_pci_driver = { - .id_table = ni_670x_pci_table, - .probe = &driver_ni_670x_pci_probe, - .remove = __devexit_p(&driver_ni_670x_pci_remove) -}; - -static int __init driver_ni_670x_init_module(void) -{ - int retval; - - retval = comedi_driver_register(&driver_ni_670x); - if (retval < 0) - return retval; - - driver_ni_670x_pci_driver.name = (char *)driver_ni_670x.driver_name; - return pci_register_driver(&driver_ni_670x_pci_driver); -} - -static void __exit driver_ni_670x_cleanup_module(void) -{ - pci_unregister_driver(&driver_ni_670x_pci_driver); - comedi_driver_unregister(&driver_ni_670x); -} - -module_init(driver_ni_670x_init_module); -module_exit(driver_ni_670x_cleanup_module); - static struct comedi_lrange range_0_20mA = { 1, {RANGE_mA(0, 20)} }; static int ni_670x_find_device(struct comedi_device *dev, int bus, int slot); @@ -377,6 +320,39 @@ static int ni_670x_find_device(struct comedi_device *dev, int bus, int slot) return -EIO; } +static struct comedi_driver ni_670x_driver = { + .driver_name = "ni_670x", + .module = THIS_MODULE, + .attach = ni_670x_attach, + .detach = ni_670x_detach, +}; + +static int __devinit ni_670x_pci_probe(struct pci_dev *dev, + const struct pci_device_id *ent) +{ + return comedi_pci_auto_config(dev, &ni_670x_driver); +} + +static void __devexit ni_670x_pci_remove(struct pci_dev *dev) +{ + comedi_pci_auto_unconfig(dev); +} + +static DEFINE_PCI_DEVICE_TABLE(ni_670x_pci_table) = { + { PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2c90) }, + { PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1920) }, + { 0 } +}; +MODULE_DEVICE_TABLE(pci, ni_670x_pci_table); + +static struct pci_driver ni_670x_pci_driver = { + .name ="ni_670x", + .id_table = ni_670x_pci_table, + .probe = ni_670x_pci_probe, + .remove = __devexit_p(ni_670x_pci_remove), +}; +module_comedi_pci_driver(ni_670x_driver, ni_670x_pci_driver); + MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_DESCRIPTION("Comedi low-level driver"); MODULE_LICENSE("GPL"); -- cgit v0.10.2 From 944a2f111f5cb82c46b75a4990aa3afa4b243b35 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 29 Jun 2012 17:36:09 -0700 Subject: staging: comedi: ni_670x: remove forward declarations Move the attach and detach functions to remove the need for the forward declarations. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index cea43de..e9270af 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -103,105 +103,6 @@ struct ni_670x_private { static struct comedi_lrange range_0_20mA = { 1, {RANGE_mA(0, 20)} }; -static int ni_670x_find_device(struct comedi_device *dev, int bus, int slot); - -static int ni_670x_ao_winsn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int ni_670x_ao_rinsn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int ni_670x_dio_insn_bits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int ni_670x_dio_insn_config(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data); - -static int ni_670x_attach(struct comedi_device *dev, - struct comedi_devconfig *it) -{ - struct comedi_subdevice *s; - int ret; - int i; - - printk(KERN_INFO "comedi%d: ni_670x: ", dev->minor); - - ret = alloc_private(dev, sizeof(struct ni_670x_private)); - if (ret < 0) - return ret; - - ret = ni_670x_find_device(dev, it->options[0], it->options[1]); - if (ret < 0) - return ret; - - ret = mite_setup(devpriv->mite); - if (ret < 0) { - printk(KERN_WARNING "error setting up mite\n"); - return ret; - } - dev->board_name = thisboard->name; - dev->irq = mite_irq(devpriv->mite); - printk(KERN_INFO " %s", dev->board_name); - - ret = comedi_alloc_subdevices(dev, 2); - if (ret) - return ret; - - s = dev->subdevices + 0; - /* analog output subdevice */ - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = thisboard->ao_chans; - s->maxdata = 0xffff; - if (s->n_chan == 32) { - const struct comedi_lrange **range_table_list; - - range_table_list = kmalloc(sizeof(struct comedi_lrange *) * 32, - GFP_KERNEL); - if (!range_table_list) - return -ENOMEM; - s->range_table_list = range_table_list; - for (i = 0; i < 16; i++) { - range_table_list[i] = &range_bipolar10; - range_table_list[16 + i] = &range_0_20mA; - } - } else { - s->range_table = &range_bipolar10; - } - s->insn_write = &ni_670x_ao_winsn; - s->insn_read = &ni_670x_ao_rinsn; - - s = dev->subdevices + 1; - /* digital i/o subdevice */ - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = ni_670x_dio_insn_bits; - s->insn_config = ni_670x_dio_insn_config; - - /* Config of misc registers */ - writel(0x10, devpriv->mite->daq_io_addr + MISC_CONTROL_OFFSET); - /* Config of ao registers */ - writel(0x00, devpriv->mite->daq_io_addr + AO_CONTROL_OFFSET); - - printk(KERN_INFO "attached\n"); - - return 1; -} - -static void ni_670x_detach(struct comedi_device *dev) -{ - kfree(dev->subdevices[0].range_table_list); - if (dev->private && devpriv->mite) - mite_unsetup(devpriv->mite); - if (dev->irq) - free_irq(dev->irq, dev); -} - static int ni_670x_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -320,6 +221,89 @@ static int ni_670x_find_device(struct comedi_device *dev, int bus, int slot) return -EIO; } +static int ni_670x_attach(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + struct comedi_subdevice *s; + int ret; + int i; + + printk(KERN_INFO "comedi%d: ni_670x: ", dev->minor); + + ret = alloc_private(dev, sizeof(struct ni_670x_private)); + if (ret < 0) + return ret; + + ret = ni_670x_find_device(dev, it->options[0], it->options[1]); + if (ret < 0) + return ret; + + ret = mite_setup(devpriv->mite); + if (ret < 0) { + printk(KERN_WARNING "error setting up mite\n"); + return ret; + } + dev->board_name = thisboard->name; + dev->irq = mite_irq(devpriv->mite); + printk(KERN_INFO " %s", dev->board_name); + + ret = comedi_alloc_subdevices(dev, 2); + if (ret) + return ret; + + s = dev->subdevices + 0; + /* analog output subdevice */ + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = thisboard->ao_chans; + s->maxdata = 0xffff; + if (s->n_chan == 32) { + const struct comedi_lrange **range_table_list; + + range_table_list = kmalloc(sizeof(struct comedi_lrange *) * 32, + GFP_KERNEL); + if (!range_table_list) + return -ENOMEM; + s->range_table_list = range_table_list; + for (i = 0; i < 16; i++) { + range_table_list[i] = &range_bipolar10; + range_table_list[16 + i] = &range_0_20mA; + } + } else { + s->range_table = &range_bipolar10; + } + s->insn_write = &ni_670x_ao_winsn; + s->insn_read = &ni_670x_ao_rinsn; + + s = dev->subdevices + 1; + /* digital i/o subdevice */ + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = ni_670x_dio_insn_bits; + s->insn_config = ni_670x_dio_insn_config; + + /* Config of misc registers */ + writel(0x10, devpriv->mite->daq_io_addr + MISC_CONTROL_OFFSET); + /* Config of ao registers */ + writel(0x00, devpriv->mite->daq_io_addr + AO_CONTROL_OFFSET); + + printk(KERN_INFO "attached\n"); + + return 1; +} + +static void ni_670x_detach(struct comedi_device *dev) +{ + kfree(dev->subdevices[0].range_table_list); + if (dev->private && devpriv->mite) + mite_unsetup(devpriv->mite); + if (dev->irq) + free_irq(dev->irq, dev); +} + static struct comedi_driver ni_670x_driver = { .driver_name = "ni_670x", .module = THIS_MODULE, -- cgit v0.10.2 From 289a40339149300c42308afd917a5c9dbbc9bcd9 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 29 Jun 2012 17:36:45 -0700 Subject: staging: comedi: ni_670x: remove thisboard and devpriv macros The 'thisboard' and 'devpriv' macros rely on a local variable having a specific name and yield pointers derived from that local variable. Replace the macros with local variables where used. Use the comedi_board() helper to get the 'thisboard' pointer. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index e9270af..b75eed4 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -88,8 +88,6 @@ static const struct ni_670x_board ni_670x_boards[] = { }, }; -#define thisboard ((struct ni_670x_board *)dev->board_ptr) - struct ni_670x_private { struct mite_struct *mite; @@ -98,7 +96,6 @@ struct ni_670x_private { unsigned int ao_readback[32]; }; -#define devpriv ((struct ni_670x_private *)dev->private) #define n_ni_670x_boards ARRAY_SIZE(ni_670x_boards) static struct comedi_lrange range_0_20mA = { 1, {RANGE_mA(0, 20)} }; @@ -107,6 +104,7 @@ static int ni_670x_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct ni_670x_private *devpriv = dev->private; int i; int chan = CR_CHAN(insn->chanspec); @@ -137,6 +135,7 @@ static int ni_670x_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct ni_670x_private *devpriv = dev->private; int i; int chan = CR_CHAN(insn->chanspec); @@ -150,6 +149,8 @@ static int ni_670x_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct ni_670x_private *devpriv = dev->private; + /* The insn data is a mask in data[0] and the new data * in data[1], each channel cooresponding to a bit. */ if (data[0]) { @@ -170,6 +171,7 @@ static int ni_670x_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct ni_670x_private *devpriv = dev->private; int chan = CR_CHAN(insn->chanspec); switch (data[0]) { @@ -195,6 +197,7 @@ static int ni_670x_dio_insn_config(struct comedi_device *dev, static int ni_670x_find_device(struct comedi_device *dev, int bus, int slot) { + struct ni_670x_private *devpriv = dev->private; struct mite_struct *mite; int i; @@ -224,19 +227,23 @@ static int ni_670x_find_device(struct comedi_device *dev, int bus, int slot) static int ni_670x_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct ni_670x_board *thisboard; + struct ni_670x_private *devpriv; struct comedi_subdevice *s; int ret; int i; printk(KERN_INFO "comedi%d: ni_670x: ", dev->minor); - ret = alloc_private(dev, sizeof(struct ni_670x_private)); + ret = alloc_private(dev, sizeof(*devpriv)); if (ret < 0) return ret; + devpriv = dev->private; ret = ni_670x_find_device(dev, it->options[0], it->options[1]); if (ret < 0) return ret; + thisboard = comedi_board(dev); ret = mite_setup(devpriv->mite); if (ret < 0) { @@ -297,8 +304,10 @@ static int ni_670x_attach(struct comedi_device *dev, static void ni_670x_detach(struct comedi_device *dev) { + struct ni_670x_private *devpriv = dev->private; + kfree(dev->subdevices[0].range_table_list); - if (dev->private && devpriv->mite) + if (devpriv && devpriv->mite) mite_unsetup(devpriv->mite); if (dev->irq) free_irq(dev->irq, dev); -- cgit v0.10.2 From 2be036653663f809d1034d365f8285a967e589da Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 29 Jun 2012 17:37:25 -0700 Subject: staging: comedi: ni_670x: remove n_ni_670x_boards macro This macro is simply the ARRAY_SIZE() of the boardinfo. Just use the ARRAY_SIZE and remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index b75eed4..d53d20c 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -96,8 +96,6 @@ struct ni_670x_private { unsigned int ao_readback[32]; }; -#define n_ni_670x_boards ARRAY_SIZE(ni_670x_boards) - static struct comedi_lrange range_0_20mA = { 1, {RANGE_mA(0, 20)} }; static int ni_670x_ao_winsn(struct comedi_device *dev, @@ -210,7 +208,7 @@ static int ni_670x_find_device(struct comedi_device *dev, int bus, int slot) continue; } - for (i = 0; i < n_ni_670x_boards; i++) { + for (i = 0; i < ARRAY_SIZE(ni_670x_boards); i++) { if (mite_device_id(mite) == ni_670x_boards[i].dev_id) { dev->board_ptr = ni_670x_boards + i; devpriv->mite = mite; -- cgit v0.10.2 From b48ad330d56a6cce7897132d9cb68cc2f19358e8 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 29 Jun 2012 17:38:18 -0700 Subject: staging: comedi: ni_670x: change printk's to cleaned up dev_printk's Convert all the prink's in this file to dev_prink's. Change the INFO message in ni_670x_find_device into a dev_warn(). This message is only displayed if a matching device was not found. A warning is more appropriate here than info. Consolidate the attach messages into one dev_info() output after the successful attach. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index d53d20c..c9c72c5 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -217,7 +217,7 @@ static int ni_670x_find_device(struct comedi_device *dev, int bus, int slot) } } } - printk(KERN_INFO "no device found\n"); + dev_warn(dev->class_dev, "no device found\n"); mite_list_devices(); return -EIO; } @@ -231,8 +231,6 @@ static int ni_670x_attach(struct comedi_device *dev, int ret; int i; - printk(KERN_INFO "comedi%d: ni_670x: ", dev->minor); - ret = alloc_private(dev, sizeof(*devpriv)); if (ret < 0) return ret; @@ -245,12 +243,11 @@ static int ni_670x_attach(struct comedi_device *dev, ret = mite_setup(devpriv->mite); if (ret < 0) { - printk(KERN_WARNING "error setting up mite\n"); + dev_warn(dev->class_dev, "error setting up mite\n"); return ret; } dev->board_name = thisboard->name; dev->irq = mite_irq(devpriv->mite); - printk(KERN_INFO " %s", dev->board_name); ret = comedi_alloc_subdevices(dev, 2); if (ret) @@ -295,7 +292,8 @@ static int ni_670x_attach(struct comedi_device *dev, /* Config of ao registers */ writel(0x00, devpriv->mite->daq_io_addr + AO_CONTROL_OFFSET); - printk(KERN_INFO "attached\n"); + dev_info(dev->class_dev, "%s: %s attached\n", + dev->driver->driver_name, dev->board_name); return 1; } -- cgit v0.10.2 From 464c94514c703bc61c3f85db397582aa8f17cf9d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 29 Jun 2012 17:38:54 -0700 Subject: staging: comedi: ni_670x: return '0' for successful attach The comedi core expects a < 0 value during the attach to indicate an error. The normal 'success' return for the kernel is '0' so use that here. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index c9c72c5..bab9644 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -295,7 +295,7 @@ static int ni_670x_attach(struct comedi_device *dev, dev_info(dev->class_dev, "%s: %s attached\n", dev->driver->driver_name, dev->board_name); - return 1; + return 0; } static void ni_670x_detach(struct comedi_device *dev) -- cgit v0.10.2 From 70fcd1b7a6be4f4f60f4d05beeb3976bb0eaf6a2 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 29 Jun 2012 17:39:45 -0700 Subject: staging: comedi: ni_670x: fix dereference of an invalid pointer The attach if this driver can fail before the subdevices are allocated. If the attach fails the comedi core will call the detach routine to allow the driver to do it's cleanup. We need to make sure that the subdevice allocation was successful before trying to dereference subdevice[0] to free the allocated range table list. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index bab9644..46f373a 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -301,8 +301,13 @@ static int ni_670x_attach(struct comedi_device *dev, static void ni_670x_detach(struct comedi_device *dev) { struct ni_670x_private *devpriv = dev->private; + struct comedi_subdevice *s; - kfree(dev->subdevices[0].range_table_list); + if (dev->n_subdevices) { + s = dev->subdevices + 0; + if (s) + kfree(s->range_table_list); + } if (devpriv && devpriv->mite) mite_unsetup(devpriv->mite); if (dev->irq) -- cgit v0.10.2 From 04b136b68d3c46480d0297efae56d736cd4ac379 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 29 Jun 2012 17:40:23 -0700 Subject: staging: comedi: ni_670x: cleanup the boardinfo For aesthetic reasons, reorder the boardinfo struct so that the 'name' pointer is first. Also, add some whitespace to the boardinfo to improve readability. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index 46f373a..1d3590e 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -61,31 +61,29 @@ Commands are not supported. /* Board description*/ struct ni_670x_board { - unsigned short dev_id; const char *name; + unsigned short dev_id; unsigned short ao_chans; unsigned short ao_bits; }; static const struct ni_670x_board ni_670x_boards[] = { { - .dev_id = 0x2c90, - .name = "PCI-6703", - .ao_chans = 16, - .ao_bits = 16, - }, - { - .dev_id = 0x1920, - .name = "PXI-6704", - .ao_chans = 32, - .ao_bits = 16, - }, - { - .dev_id = 0x1290, - .name = "PCI-6704", - .ao_chans = 32, - .ao_bits = 16, - }, + .name = "PCI-6703", + .dev_id = 0x2c90, + .ao_chans = 16, + .ao_bits = 16, + }, { + .name = "PXI-6704", + .dev_id = 0x1920, + .ao_chans = 32, + .ao_bits = 16, + }, { + .name = "PCI-6704", + .dev_id = 0x1290, + .ao_chans = 32, + .ao_bits = 16, + }, }; struct ni_670x_private { -- cgit v0.10.2 From ebbc09797ee5caf3e3bb5419a4ed930d2781e23b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 29 Jun 2012 17:41:10 -0700 Subject: staging: comedi: ni_670x: cleanup ni_670x_dio_insn_bits() Add local variable for the io_addr, mask. and bits used in this function so that the comments are not needed and the writel/readl calls are a bit cleaner. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index 1d3590e..86e9e70 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -146,19 +146,19 @@ static int ni_670x_dio_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { struct ni_670x_private *devpriv = dev->private; + void __iomem *io_addr = devpriv->mite->daq_io_addr + + DIO_PORT0_DATA_OFFSET; + unsigned int mask = data[0]; + unsigned int bits = data[1]; - /* The insn data is a mask in data[0] and the new data - * in data[1], each channel cooresponding to a bit. */ - if (data[0]) { - s->state &= ~data[0]; - s->state |= data[0] & data[1]; - writel(s->state, - devpriv->mite->daq_io_addr + DIO_PORT0_DATA_OFFSET); + if (mask) { + s->state &= ~mask; + s->state |= (bits & mask); + + writel(s->state, io_addr); } - /* on return, data[1] contains the value of the digital - * input lines. */ - data[1] = readl(devpriv->mite->daq_io_addr + DIO_PORT0_DATA_OFFSET); + data[1] = readl(io_addr); return insn->n; } -- cgit v0.10.2 From 442bcd237296bc2ffcfcf9c1f243385674bef285 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 29 Jun 2012 17:41:47 -0700 Subject: staging: comedi: ni_670x: removve unused 'ao_bits' All the NI 670x boards have 16-bit anaolog output DACs. The 'ao_bits' in the boardinfo is not used so remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index 86e9e70..9c57618 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -64,7 +64,6 @@ struct ni_670x_board { const char *name; unsigned short dev_id; unsigned short ao_chans; - unsigned short ao_bits; }; static const struct ni_670x_board ni_670x_boards[] = { @@ -72,17 +71,14 @@ static const struct ni_670x_board ni_670x_boards[] = { .name = "PCI-6703", .dev_id = 0x2c90, .ao_chans = 16, - .ao_bits = 16, }, { .name = "PXI-6704", .dev_id = 0x1920, .ao_chans = 32, - .ao_bits = 16, }, { .name = "PCI-6704", .dev_id = 0x1290, .ao_chans = 32, - .ao_bits = 16, }, }; -- cgit v0.10.2 From c952e019b99d9d8fb486f843c6225fb659dcd40b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 29 Jun 2012 10:58:41 -0700 Subject: staging: comedi: das_08: use the 8253 helper functions Instead of open-coding the 8254 timer io, use the helper functions provided by 8253.h. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index d0128e0..036953e 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -56,6 +56,7 @@ #include #include "8255.h" +#include "8253.h" #include "das08.h" #define DRV_NAME "das08" @@ -434,38 +435,13 @@ das08ao_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, static unsigned int i8254_read_channel_low(unsigned int base, int chan) { - unsigned int msb, lsb; - - /* The following instructions must be in order. - We must avoid other process reading the counter's value in the - middle. - The spin_lock isn't needed since ioctl calls grab the big kernel - lock automatically */ - /*spin_lock(sp); */ - outb(chan << 6, base + I8254_CTRL); - base += chan; - lsb = inb(base); - msb = inb(base); - /*spin_unlock(sp); */ - - return lsb | (msb << 8); + return i8254_read(base, 0, chan); } static void i8254_write_channel_low(unsigned int base, int chan, unsigned int value) { - unsigned int msb, lsb; - - lsb = value & 0xFF; - msb = value >> 8; - - /* write lsb, then msb */ - base += chan; - /* See comments in i8254_read_channel_low */ - /*spin_lock(sp); */ - outb(lsb, base); - outb(msb, base); - /*spin_unlock(sp); */ + i8254_write(base, 0, chan, value); } static unsigned int i8254_read_channel(struct i8254_struct *st, int channel) @@ -486,10 +462,10 @@ static void i8254_write_channel(struct i8254_struct *st, int channel, static void i8254_set_mode_low(unsigned int base, int channel, unsigned int mode) { - outb((channel << 6) | 0x30 | (mode & 0x0F), base + I8254_CTRL); + i8254_set_mode(base, 0, channel, mode); } -static void i8254_set_mode(struct i8254_struct *st, int channel, +static void __i8254_set_mode(struct i8254_struct *st, int channel, unsigned int mode) { int chan = st->logic2phys[channel]; @@ -500,8 +476,7 @@ static void i8254_set_mode(struct i8254_struct *st, int channel, static unsigned int i8254_read_status_low(unsigned int base, int channel) { - outb(0xE0 | (2 << channel), base + I8254_CTRL); - return inb(base + channel); + return i8254_status(base, 0, channel); } static unsigned int i8254_read_status(struct i8254_struct *st, int channel) @@ -550,7 +525,7 @@ static int das08_counter_config(struct comedi_device *dev, switch (data[0]) { case INSN_CONFIG_SET_COUNTER_MODE: - i8254_set_mode(&devpriv->i8254, chan, data[1]); + __i8254_set_mode(&devpriv->i8254, chan, data[1]); break; case INSN_CONFIG_8254_READ_STATUS: data[1] = i8254_read_status(&devpriv->i8254, chan); -- cgit v0.10.2 From afdd107c054ca135559a331f08630fdf76dacbfe Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 29 Jun 2012 10:59:21 -0700 Subject: staging: comedi: das_08: unwind the 8254 timer support Refactor the 8254 timer support by removing the various functions that handle the io and consolidating the logic into the initialize, read, write, and config functions used by the driver. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index 036953e..78c3314 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -433,64 +433,12 @@ das08ao_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, return n; } -static unsigned int i8254_read_channel_low(unsigned int base, int chan) -{ - return i8254_read(base, 0, chan); -} - -static void i8254_write_channel_low(unsigned int base, int chan, - unsigned int value) -{ - i8254_write(base, 0, chan, value); -} - -static unsigned int i8254_read_channel(struct i8254_struct *st, int channel) -{ - int chan = st->logic2phys[channel]; - - return i8254_read_channel_low(st->iobase, chan); -} - -static void i8254_write_channel(struct i8254_struct *st, int channel, - unsigned int value) -{ - int chan = st->logic2phys[channel]; - - i8254_write_channel_low(st->iobase, chan, value); -} - -static void i8254_set_mode_low(unsigned int base, int channel, - unsigned int mode) -{ - i8254_set_mode(base, 0, channel, mode); -} - -static void __i8254_set_mode(struct i8254_struct *st, int channel, - unsigned int mode) -{ - int chan = st->logic2phys[channel]; - - st->mode[chan] = mode; - return i8254_set_mode_low(st->iobase, chan, mode); -} - -static unsigned int i8254_read_status_low(unsigned int base, int channel) -{ - return i8254_status(base, 0, channel); -} - -static unsigned int i8254_read_status(struct i8254_struct *st, int channel) -{ - int chan = st->logic2phys[channel]; - - return i8254_read_status_low(st->iobase, chan); -} - static void i8254_initialize(struct i8254_struct *st) { int i; + for (i = 0; i < 3; ++i) - i8254_set_mode_low(st->iobase, i, st->mode[i]); + i8254_set_mode(st->iobase, 0, i, st->mode[i]); } static int das08_counter_read(struct comedi_device *dev, @@ -498,8 +446,10 @@ static int das08_counter_read(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { struct das08_private_struct *devpriv = dev->private; - int chan = insn->chanspec; - data[0] = i8254_read_channel(&devpriv->i8254, chan); + struct i8254_struct *st = &devpriv->i8254; + int chan = st->logic2phys[insn->chanspec]; + + data[0] = i8254_read(st->iobase, 0, chan); return 1; } @@ -508,8 +458,10 @@ static int das08_counter_write(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { struct das08_private_struct *devpriv = dev->private; - int chan = insn->chanspec; - i8254_write_channel(&devpriv->i8254, chan, data[0]); + struct i8254_struct *st = &devpriv->i8254; + int chan = st->logic2phys[insn->chanspec]; + + i8254_write(st->iobase, 0, chan, data[0]); return 1; } @@ -518,17 +470,19 @@ static int das08_counter_config(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { struct das08_private_struct *devpriv = dev->private; - int chan = insn->chanspec; + struct i8254_struct *st = &devpriv->i8254; + int chan = st->logic2phys[insn->chanspec]; if (insn->n != 2) return -EINVAL; switch (data[0]) { case INSN_CONFIG_SET_COUNTER_MODE: - __i8254_set_mode(&devpriv->i8254, chan, data[1]); + st->mode[chan] = data[1]; + i8254_set_mode(st->iobase, 0, chan, data[1]); break; case INSN_CONFIG_8254_READ_STATUS: - data[1] = i8254_read_status(&devpriv->i8254, chan); + data[1] = i8254_status(st->iobase, 0, chan); break; default: return -EINVAL; -- cgit v0.10.2 From cba9d4aa4e55547894d4625bc3f99bab2016a6c8 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 29 Jun 2012 10:59:55 -0700 Subject: staging: comedi: das_08: remove the cached 8254 'mode' The driver initially sets all the cached 'mode' values for the 8254 timers to (I8254_MODE0 | I8254_BINARY). It then sets the timers to that 'mode'. Configuring the counters with the comedi INSN_CONFIG_SET_COUNTER_MODE updates the 'mode' and then sets the timers to the 'mode'. The cached value is never read or used other than for storage. Just remove the 'mode' usage as it serves no purpose. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index 78c3314..c0c93ea 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -435,10 +435,11 @@ das08ao_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, static void i8254_initialize(struct i8254_struct *st) { + unsigned int mode = I8254_MODE0 | I8254_BINARY; int i; for (i = 0; i < 3; ++i) - i8254_set_mode(st->iobase, 0, i, st->mode[i]); + i8254_set_mode(st->iobase, 0, i, mode); } static int das08_counter_read(struct comedi_device *dev, @@ -478,7 +479,6 @@ static int das08_counter_config(struct comedi_device *dev, switch (data[0]) { case INSN_CONFIG_SET_COUNTER_MODE: - st->mode[chan] = data[1]; i8254_set_mode(st->iobase, 0, chan, data[1]); break; case INSN_CONFIG_8254_READ_STATUS: @@ -852,9 +852,6 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) devpriv->i8254.logic2phys[1] = 1; devpriv->i8254.logic2phys[2] = 2; devpriv->i8254.iobase = iobase + thisboard->i8254_offset; - devpriv->i8254.mode[0] = - devpriv->i8254.mode[1] = - devpriv->i8254.mode[2] = I8254_MODE0 | I8254_BINARY; i8254_initialize(&devpriv->i8254); } else { s->type = COMEDI_SUBD_UNUSED; -- cgit v0.10.2 From 6daf1e0547ab6b9797a45ea9f45a035a5abb7821 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 29 Jun 2012 11:00:40 -0700 Subject: staging: comedi: das_08: remove the 8254 'logic2phys' usage The three 8254 timers have a 1:1 relationship to the comedi channels. The 'logic2phys' usage just makes the driver more complex. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index c0c93ea..2ad66f2 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -448,7 +448,7 @@ static int das08_counter_read(struct comedi_device *dev, { struct das08_private_struct *devpriv = dev->private; struct i8254_struct *st = &devpriv->i8254; - int chan = st->logic2phys[insn->chanspec]; + int chan = insn->chanspec; data[0] = i8254_read(st->iobase, 0, chan); return 1; @@ -460,7 +460,7 @@ static int das08_counter_write(struct comedi_device *dev, { struct das08_private_struct *devpriv = dev->private; struct i8254_struct *st = &devpriv->i8254; - int chan = st->logic2phys[insn->chanspec]; + int chan = insn->chanspec; i8254_write(st->iobase, 0, chan, data[0]); return 1; @@ -472,7 +472,7 @@ static int das08_counter_config(struct comedi_device *dev, { struct das08_private_struct *devpriv = dev->private; struct i8254_struct *st = &devpriv->i8254; - int chan = st->logic2phys[insn->chanspec]; + int chan = insn->chanspec; if (insn->n != 2) return -EINVAL; @@ -848,9 +848,6 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) s->insn_config = das08_counter_config; /* Set-up the 8254 structure */ devpriv->i8254.channels = 3; - devpriv->i8254.logic2phys[0] = 0; - devpriv->i8254.logic2phys[1] = 1; - devpriv->i8254.logic2phys[2] = 2; devpriv->i8254.iobase = iobase + thisboard->i8254_offset; i8254_initialize(&devpriv->i8254); } else { -- cgit v0.10.2 From f97733d9885ece037f44dbb8083eeb772f549415 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 29 Jun 2012 11:01:22 -0700 Subject: staging: comedi: das_08: remove the 8254 'channels' usage The internal 8254 'channels' count is the same as the comedi subdevice 'n_chan'. There is no need to keep the internal count. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index 2ad66f2..20f79b7 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -847,7 +847,6 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) s->insn_write = das08_counter_write; s->insn_config = das08_counter_config; /* Set-up the 8254 structure */ - devpriv->i8254.channels = 3; devpriv->i8254.iobase = iobase + thisboard->i8254_offset; i8254_initialize(&devpriv->i8254); } else { -- cgit v0.10.2 From b47e30a9e5970dea1a75a4f88bc6eb1c4a5dc941 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 29 Jun 2012 11:02:02 -0700 Subject: staging: comedi: das_08: remove the unneeded 8254 variables and defines Now that the driver is using the 8253 helper functions, remove the unused variables in the i8254_struct as well as the unused defines for the 8254 register offsets. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08.h b/drivers/staging/comedi/drivers/das08.h index 0b92f24..ee3cf4b 100644 --- a/drivers/staging/comedi/drivers/das08.h +++ b/drivers/staging/comedi/drivers/das08.h @@ -50,17 +50,9 @@ struct das08_board_struct { }; struct i8254_struct { - int channels; /* available channels. Some could be used internally. */ - int logic2phys[3]; /* to know which physical channel is. */ - int mode[3]; /* the index is the real counter. */ unsigned int iobase; }; -#define I8254_CNT0 0 -#define I8254_CNT1 1 -#define I8254_CNT2 2 -#define I8254_CTRL 3 - struct das08_private_struct { unsigned int do_mux_bits; /* bits for do/mux register on boards without separate do register */ unsigned int do_bits; /* bits for do register on boards with register dedicated to digital out only */ -- cgit v0.10.2 From 807271462037e47b9a053a6547f3efc569bb7596 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 29 Jun 2012 11:02:59 -0700 Subject: staging: comedi: das_08: absorb i8254_struct into the private data The i8254_struct now only contains the iobase address used to read/write the 8254 timer device. Move that variable into the das08 private data struct and remove the i8254_struct. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index 20f79b7..874e02e 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -433,13 +433,14 @@ das08ao_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, return n; } -static void i8254_initialize(struct i8254_struct *st) +static void i8254_initialize(struct comedi_device *dev) { + struct das08_private_struct *devpriv = dev->private; unsigned int mode = I8254_MODE0 | I8254_BINARY; int i; for (i = 0; i < 3; ++i) - i8254_set_mode(st->iobase, 0, i, mode); + i8254_set_mode(devpriv->i8254_iobase, 0, i, mode); } static int das08_counter_read(struct comedi_device *dev, @@ -447,10 +448,9 @@ static int das08_counter_read(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { struct das08_private_struct *devpriv = dev->private; - struct i8254_struct *st = &devpriv->i8254; int chan = insn->chanspec; - data[0] = i8254_read(st->iobase, 0, chan); + data[0] = i8254_read(devpriv->i8254_iobase, 0, chan); return 1; } @@ -459,10 +459,9 @@ static int das08_counter_write(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { struct das08_private_struct *devpriv = dev->private; - struct i8254_struct *st = &devpriv->i8254; int chan = insn->chanspec; - i8254_write(st->iobase, 0, chan, data[0]); + i8254_write(devpriv->i8254_iobase, 0, chan, data[0]); return 1; } @@ -471,7 +470,6 @@ static int das08_counter_config(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { struct das08_private_struct *devpriv = dev->private; - struct i8254_struct *st = &devpriv->i8254; int chan = insn->chanspec; if (insn->n != 2) @@ -479,10 +477,10 @@ static int das08_counter_config(struct comedi_device *dev, switch (data[0]) { case INSN_CONFIG_SET_COUNTER_MODE: - i8254_set_mode(st->iobase, 0, chan, data[1]); + i8254_set_mode(devpriv->i8254_iobase, 0, chan, data[1]); break; case INSN_CONFIG_8254_READ_STATUS: - data[1] = i8254_status(st->iobase, 0, chan); + data[1] = i8254_status(devpriv->i8254_iobase, 0, chan); break; default: return -EINVAL; @@ -846,9 +844,9 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) s->insn_read = das08_counter_read; s->insn_write = das08_counter_write; s->insn_config = das08_counter_config; - /* Set-up the 8254 structure */ - devpriv->i8254.iobase = iobase + thisboard->i8254_offset; - i8254_initialize(&devpriv->i8254); + + devpriv->i8254_iobase = iobase + thisboard->i8254_offset; + i8254_initialize(dev); } else { s->type = COMEDI_SUBD_UNUSED; } diff --git a/drivers/staging/comedi/drivers/das08.h b/drivers/staging/comedi/drivers/das08.h index ee3cf4b..27b6d4e 100644 --- a/drivers/staging/comedi/drivers/das08.h +++ b/drivers/staging/comedi/drivers/das08.h @@ -49,17 +49,13 @@ struct das08_board_struct { unsigned int iosize; /* number of ioports used */ }; -struct i8254_struct { - unsigned int iobase; -}; - struct das08_private_struct { unsigned int do_mux_bits; /* bits for do/mux register on boards without separate do register */ unsigned int do_bits; /* bits for do register on boards with register dedicated to digital out only */ const unsigned int *pg_gainlist; struct pci_dev *pdev; /* struct for pci-das08 */ unsigned int pci_iobase; /* additional base address for pci-das08 */ - struct i8254_struct i8254; + unsigned int i8254_iobase; }; #define NUM_DAS08_CS_BOARDS 2 -- cgit v0.10.2 From 3a36ad17c6709efb353f25f3b57b2443acb6bcd7 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 2 Jul 2012 15:42:41 -0700 Subject: staging: comedi: das08_cs: move the MODULE_* stuff to the EOF Move the MODULE_* declarations to the end of the file. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index 8bf6ec2..f62e5f8 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -224,10 +224,6 @@ static const struct pcmcia_device_id das08_cs_id_table[] = { }; MODULE_DEVICE_TABLE(pcmcia, das08_cs_id_table); -MODULE_AUTHOR("David A. Schleef , " - "Frank Mori Hess "); -MODULE_DESCRIPTION("Comedi driver for ComputerBoards DAS-08 PCMCIA boards"); -MODULE_LICENSE("GPL"); struct pcmcia_driver das08_cs_driver = { .probe = das08_pcmcia_attach, @@ -270,3 +266,8 @@ static void __exit das08_cs_exit_module(void) module_init(das08_cs_init_module); module_exit(das08_cs_exit_module); + +MODULE_AUTHOR("David A. Schleef , " + "Frank Mori Hess "); +MODULE_DESCRIPTION("Comedi driver for ComputerBoards DAS-08 PCMCIA boards"); +MODULE_LICENSE("GPL"); -- cgit v0.10.2 From 468777024e3f635c78cc7b0370f447978669431d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 2 Jul 2012 15:43:19 -0700 Subject: staging: comedi: das08_cs: consolidate the init and exit functions The register/unregister of the pcmcia driver is done in separate functions that are called by the module_{init,exit} routines. Simplify the code a bit by moving the register/unregister into the module_{init,exit} routines. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index f62e5f8..14dfc81 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -235,36 +235,23 @@ struct pcmcia_driver das08_cs_driver = { .name = "pcm-das08", }; -static int __init init_das08_pcmcia_cs(void) -{ - pcmcia_register_driver(&das08_cs_driver); - return 0; -} - -static void __exit exit_das08_pcmcia_cs(void) -{ - pr_debug("das08_pcmcia_cs: unloading\n"); - pcmcia_unregister_driver(&das08_cs_driver); -} - static int __init das08_cs_init_module(void) { int ret; - ret = init_das08_pcmcia_cs(); + ret = pcmcia_register_driver(&das08_cs_driver); if (ret < 0) return ret; return comedi_driver_register(&driver_das08_cs); } +module_init(das08_cs_init_module); static void __exit das08_cs_exit_module(void) { - exit_das08_pcmcia_cs(); + pcmcia_unregister_driver(&das08_cs_driver); comedi_driver_unregister(&driver_das08_cs); } - -module_init(das08_cs_init_module); module_exit(das08_cs_exit_module); MODULE_AUTHOR("David A. Schleef , " -- cgit v0.10.2 From 36061c842be56f62bf77d7339bc4581a38e03846 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 2 Jul 2012 15:43:52 -0700 Subject: staging: comedi: das08_cs: change driver registration order As done with the other comedi driver types, register the comedi_driver first then the pcmcia_driver. Also, make sure the pcmcia_driver registration succeeds and unregister the comedi_driver if it fails. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index 14dfc81..493078a 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -239,11 +239,18 @@ static int __init das08_cs_init_module(void) { int ret; - ret = pcmcia_register_driver(&das08_cs_driver); + ret = comedi_driver_register(&driver_das08_cs); if (ret < 0) return ret; - return comedi_driver_register(&driver_das08_cs); + ret = pcmcia_register_driver(&das08_cs_driver); + if (ret < 0) { + comedi_driver_unregister(&driver_das08_cs); + return ret; + } + + return 0; + } module_init(das08_cs_init_module); -- cgit v0.10.2 From 27fa05bc3726430c5b369a3ffbe63d38ac7196d7 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 2 Jul 2012 15:44:30 -0700 Subject: staging: comedi: das08_cs: cleanup the pcmcia_driver declaration For aesthetic reasons, add some whitespace to the declaration of the pcmcia_driver and reorder it a bit. Also, the symbol 'das08_cs_driver' is only referenced in this file, make it static. This quiets the following sparse warning: warning: symbol 'das08_cs_driver' was not declared. Should it be static? Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index 493078a..de094ad 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -225,14 +225,14 @@ static const struct pcmcia_device_id das08_cs_id_table[] = { MODULE_DEVICE_TABLE(pcmcia, das08_cs_id_table); -struct pcmcia_driver das08_cs_driver = { - .probe = das08_pcmcia_attach, - .remove = das08_pcmcia_detach, - .suspend = das08_pcmcia_suspend, - .resume = das08_pcmcia_resume, - .id_table = das08_cs_id_table, - .owner = THIS_MODULE, - .name = "pcm-das08", +static struct pcmcia_driver das08_cs_driver = { + .name = "pcm-das08", + .owner = THIS_MODULE, + .probe = das08_pcmcia_attach, + .remove = das08_pcmcia_detach, + .suspend = das08_pcmcia_suspend, + .resume = das08_pcmcia_resume, + .id_table = das08_cs_id_table, }; static int __init das08_cs_init_module(void) -- cgit v0.10.2 From c332d969e4874c00bcf3d37fc69157558e1ca04b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 2 Jul 2012 15:45:03 -0700 Subject: staging: comedi: das08_cs: cleanup and remove useless comments Move the comment about the PCMCIA support and reword it a bit because of the move. Remove a number of useless comments. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index de094ad..f56fd40 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -20,6 +20,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + PCMCIA support code for this driver is adapted from the dummy_cs.c + driver of the Linux PCMCIA Card Services package. + + The initial developer of the original code is David A. Hinds + . Portions created by David A. Hinds + are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + ***************************************************************** */ @@ -97,17 +104,6 @@ static int das08_cs_attach(struct comedi_device *dev, return das08_common_attach(dev, iobase); } -/*====================================================================== - - The following pcmcia code for the pcm-das08 is adapted from the - dummy_cs.c driver of the Linux PCMCIA Card Services package. - - The initial developer of the original code is David A. Hinds - . Portions created by David A. Hinds - are Copyright (C) 1999 David A. Hinds. All Rights Reserved. - -======================================================================*/ - static void das08_pcmcia_config(struct pcmcia_device *link); static void das08_pcmcia_release(struct pcmcia_device *link); static int das08_pcmcia_suspend(struct pcmcia_device *p_dev); @@ -140,7 +136,7 @@ static int das08_pcmcia_attach(struct pcmcia_device *link) das08_pcmcia_config(link); return 0; -} /* das08_pcmcia_attach */ +} static void das08_pcmcia_detach(struct pcmcia_device *link) { @@ -153,7 +149,7 @@ static void das08_pcmcia_detach(struct pcmcia_device *link) /* This points to the parent struct local_info_t struct */ kfree(link->priv); -} /* das08_pcmcia_detach */ +} static int das08_pcmcia_config_loop(struct pcmcia_device *p_dev, @@ -191,13 +187,13 @@ static void das08_pcmcia_config(struct pcmcia_device *link) failed: das08_pcmcia_release(link); -} /* das08_pcmcia_config */ +} static void das08_pcmcia_release(struct pcmcia_device *link) { dev_dbg(&link->dev, "das08_pcmcia_release\n"); pcmcia_disable_device(link); -} /* das08_pcmcia_release */ +} static int das08_pcmcia_suspend(struct pcmcia_device *link) { @@ -206,7 +202,7 @@ static int das08_pcmcia_suspend(struct pcmcia_device *link) local->stop = 1; return 0; -} /* das08_pcmcia_suspend */ +} static int das08_pcmcia_resume(struct pcmcia_device *link) { @@ -214,15 +210,12 @@ static int das08_pcmcia_resume(struct pcmcia_device *link) local->stop = 0; return 0; -} /* das08_pcmcia_resume */ - -/*====================================================================*/ +} static const struct pcmcia_device_id das08_cs_id_table[] = { PCMCIA_DEVICE_MANF_CARD(0x01c5, 0x4001), PCMCIA_DEVICE_NULL }; - MODULE_DEVICE_TABLE(pcmcia, das08_cs_id_table); static struct pcmcia_driver das08_cs_driver = { -- cgit v0.10.2 From fb795746195bb8566ecfb50dec9f63676fc29575 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 2 Jul 2012 15:45:34 -0700 Subject: staging: comedi: das08_cs: refactor the pcmcia support code Refactor the pcmcia support code to remove the need for the forward declarations. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index f56fd40..43322c3 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -104,54 +104,12 @@ static int das08_cs_attach(struct comedi_device *dev, return das08_common_attach(dev, iobase); } -static void das08_pcmcia_config(struct pcmcia_device *link); -static void das08_pcmcia_release(struct pcmcia_device *link); -static int das08_pcmcia_suspend(struct pcmcia_device *p_dev); -static int das08_pcmcia_resume(struct pcmcia_device *p_dev); - -static int das08_pcmcia_attach(struct pcmcia_device *); -static void das08_pcmcia_detach(struct pcmcia_device *); - -struct local_info_t { - struct pcmcia_device *link; - int stop; - struct bus_operations *bus; -}; - -static int das08_pcmcia_attach(struct pcmcia_device *link) -{ - struct local_info_t *local; - - dev_dbg(&link->dev, "das08_pcmcia_attach()\n"); - - /* Allocate space for private device-specific data */ - local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); - if (!local) - return -ENOMEM; - local->link = link; - link->priv = local; - - cur_dev = link; - - das08_pcmcia_config(link); - - return 0; -} - -static void das08_pcmcia_detach(struct pcmcia_device *link) +static void das08_pcmcia_release(struct pcmcia_device *link) { - - dev_dbg(&link->dev, "das08_pcmcia_detach\n"); - - ((struct local_info_t *)link->priv)->stop = 1; - das08_pcmcia_release(link); - - /* This points to the parent struct local_info_t struct */ - kfree(link->priv); - + dev_dbg(&link->dev, "das08_pcmcia_release\n"); + pcmcia_disable_device(link); } - static int das08_pcmcia_config_loop(struct pcmcia_device *p_dev, void *priv_data) { @@ -189,10 +147,43 @@ failed: } -static void das08_pcmcia_release(struct pcmcia_device *link) +struct local_info_t { + struct pcmcia_device *link; + int stop; + struct bus_operations *bus; +}; + +static int das08_pcmcia_attach(struct pcmcia_device *link) { - dev_dbg(&link->dev, "das08_pcmcia_release\n"); - pcmcia_disable_device(link); + struct local_info_t *local; + + dev_dbg(&link->dev, "das08_pcmcia_attach()\n"); + + /* Allocate space for private device-specific data */ + local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); + if (!local) + return -ENOMEM; + local->link = link; + link->priv = local; + + cur_dev = link; + + das08_pcmcia_config(link); + + return 0; +} + +static void das08_pcmcia_detach(struct pcmcia_device *link) +{ + + dev_dbg(&link->dev, "das08_pcmcia_detach\n"); + + ((struct local_info_t *)link->priv)->stop = 1; + das08_pcmcia_release(link); + + /* This points to the parent struct local_info_t struct */ + kfree(link->priv); + } static int das08_pcmcia_suspend(struct pcmcia_device *link) -- cgit v0.10.2 From 44378f65f1b528d3a368a515598e44a73a9c3a76 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 2 Jul 2012 15:46:08 -0700 Subject: staging: comedi: das08_cs: remove unused pcmcia 'stop' logic The pcmcia support code in this driver is cut-and-paste from the dummy_cs.c driver of the Linux PCMCIA Card Services package. It has code in it to stop the device during suspend but nothing in the main comedi_driver uses it. Remove the 'stop' variable from the pcmcia private data and all the logic that deals with it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index 43322c3..044c586 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -149,7 +149,6 @@ failed: struct local_info_t { struct pcmcia_device *link; - int stop; struct bus_operations *bus; }; @@ -178,7 +177,6 @@ static void das08_pcmcia_detach(struct pcmcia_device *link) dev_dbg(&link->dev, "das08_pcmcia_detach\n"); - ((struct local_info_t *)link->priv)->stop = 1; das08_pcmcia_release(link); /* This points to the parent struct local_info_t struct */ @@ -188,18 +186,11 @@ static void das08_pcmcia_detach(struct pcmcia_device *link) static int das08_pcmcia_suspend(struct pcmcia_device *link) { - struct local_info_t *local = link->priv; - /* Mark the device as stopped, to block IO until later */ - local->stop = 1; - return 0; } static int das08_pcmcia_resume(struct pcmcia_device *link) { - struct local_info_t *local = link->priv; - - local->stop = 0; return 0; } -- cgit v0.10.2 From eb97e08e04048d47d5a16a9c6428cda5dda8c4f1 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 2 Jul 2012 15:46:40 -0700 Subject: staging: comedi: das08_cs: remove the pcmcia suspend/resume The pcmcia suspend/resume callbacks don't do anything. Remove them. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index 044c586..b7efcb4 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -184,16 +184,6 @@ static void das08_pcmcia_detach(struct pcmcia_device *link) } -static int das08_pcmcia_suspend(struct pcmcia_device *link) -{ - return 0; -} - -static int das08_pcmcia_resume(struct pcmcia_device *link) -{ - return 0; -} - static const struct pcmcia_device_id das08_cs_id_table[] = { PCMCIA_DEVICE_MANF_CARD(0x01c5, 0x4001), PCMCIA_DEVICE_NULL @@ -205,8 +195,6 @@ static struct pcmcia_driver das08_cs_driver = { .owner = THIS_MODULE, .probe = das08_pcmcia_attach, .remove = das08_pcmcia_detach, - .suspend = das08_pcmcia_suspend, - .resume = das08_pcmcia_resume, .id_table = das08_cs_id_table, }; -- cgit v0.10.2 From 6d4ef6d6360193c6acd0d41a88ddd7034af286f3 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 2 Jul 2012 15:47:14 -0700 Subject: staging: comedi: das08_cs: remove unneeded pcmcia private data The pcmcia device-specific data is no longer needed by this driver. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index b7efcb4..d02250e 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -147,24 +147,10 @@ failed: } -struct local_info_t { - struct pcmcia_device *link; - struct bus_operations *bus; -}; - static int das08_pcmcia_attach(struct pcmcia_device *link) { - struct local_info_t *local; - dev_dbg(&link->dev, "das08_pcmcia_attach()\n"); - /* Allocate space for private device-specific data */ - local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); - if (!local) - return -ENOMEM; - local->link = link; - link->priv = local; - cur_dev = link; das08_pcmcia_config(link); @@ -178,10 +164,6 @@ static void das08_pcmcia_detach(struct pcmcia_device *link) dev_dbg(&link->dev, "das08_pcmcia_detach\n"); das08_pcmcia_release(link); - - /* This points to the parent struct local_info_t struct */ - kfree(link->priv); - } static const struct pcmcia_device_id das08_cs_id_table[] = { -- cgit v0.10.2 From ae6eba84efd2ccc214ed50e8b35bbc54cb50121b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 2 Jul 2012 15:47:47 -0700 Subject: staging: comedi: das08_cs: refactor the pcmcia probe/remove Move the pcmcia_disable_device() call where needed in the pcmcia probe/remove and delete the das08_pcmcia_release() function. Move the logic of the das08_pcmcia_config() directly into the probe function and properly return an error code when the config fails. Only set cur_dev, used by the comedi_driver, if the pcmcia probe is successful. Also, make sure to NULL it in the remove. Remove all the kernel messages in the pcmcia support code. They are just added noise. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index d02250e..f2f33e1 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -104,12 +104,6 @@ static int das08_cs_attach(struct comedi_device *dev, return das08_common_attach(dev, iobase); } -static void das08_pcmcia_release(struct pcmcia_device *link) -{ - dev_dbg(&link->dev, "das08_pcmcia_release\n"); - pcmcia_disable_device(link); -} - static int das08_pcmcia_config_loop(struct pcmcia_device *p_dev, void *priv_data) { @@ -119,19 +113,15 @@ static int das08_pcmcia_config_loop(struct pcmcia_device *p_dev, return pcmcia_request_io(p_dev); } -static void das08_pcmcia_config(struct pcmcia_device *link) +static int das08_pcmcia_attach(struct pcmcia_device *link) { int ret; - dev_dbg(&link->dev, "das08_pcmcia_config\n"); - link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; ret = pcmcia_loop_config(link, das08_pcmcia_config_loop, NULL); - if (ret) { - dev_warn(&link->dev, "no configuration found\n"); + if (ret) goto failed; - } if (!link->irq) goto failed; @@ -140,30 +130,18 @@ static void das08_pcmcia_config(struct pcmcia_device *link) if (ret) goto failed; - return; - -failed: - das08_pcmcia_release(link); - -} - -static int das08_pcmcia_attach(struct pcmcia_device *link) -{ - dev_dbg(&link->dev, "das08_pcmcia_attach()\n"); - cur_dev = link; - - das08_pcmcia_config(link); - return 0; + +failed: + pcmcia_disable_device(link); + return ret; } static void das08_pcmcia_detach(struct pcmcia_device *link) { - - dev_dbg(&link->dev, "das08_pcmcia_detach\n"); - - das08_pcmcia_release(link); + pcmcia_disable_device(link); + cur_dev = NULL; } static const struct pcmcia_device_id das08_cs_id_table[] = { -- cgit v0.10.2 From 6b7de35e32882226654ea3ac28620e8c82f8cb0f Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 2 Jul 2012 15:48:26 -0700 Subject: staging: comedi: das08_cs: move the comedi_driver variable Move the comedi_driver variable to remove the need for the forward declarations. Add some whitespace to the declaration for aesthetic reasons. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index f2f33e1..9ec9b12 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -63,19 +63,6 @@ static struct pcmcia_device *cur_dev; #define thisboard ((const struct das08_board_struct *)dev->board_ptr) static int das08_cs_attach(struct comedi_device *dev, - struct comedi_devconfig *it); - -static struct comedi_driver driver_das08_cs = { - .driver_name = "das08_cs", - .module = THIS_MODULE, - .attach = das08_cs_attach, - .detach = das08_common_detach, - .board_name = &das08_cs_boards[0].name, - .num_names = ARRAY_SIZE(das08_cs_boards), - .offset = sizeof(struct das08_board_struct), -}; - -static int das08_cs_attach(struct comedi_device *dev, struct comedi_devconfig *it) { int ret; @@ -104,6 +91,16 @@ static int das08_cs_attach(struct comedi_device *dev, return das08_common_attach(dev, iobase); } +static struct comedi_driver driver_das08_cs = { + .driver_name = "das08_cs", + .module = THIS_MODULE, + .attach = das08_cs_attach, + .detach = das08_common_detach, + .board_name = &das08_cs_boards[0].name, + .num_names = ARRAY_SIZE(das08_cs_boards), + .offset = sizeof(struct das08_board_struct), +}; + static int das08_pcmcia_config_loop(struct pcmcia_device *p_dev, void *priv_data) { -- cgit v0.10.2 From 6f88a20a7ff0b8724b9832c139fc06095e71b9bf Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 2 Jul 2012 15:48:58 -0700 Subject: staging: comedi: das08_cs: remove thisboard macro The 'thisboard' macro relies on a local variable having a specific name and yields a pointer derived from that local variable. Replace the macro with a local variable where used. Use the comedi_board() helper to get the pointer. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index 9ec9b12..f5700de 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -60,11 +60,10 @@ Command support does not exist, but could be added for this board. static struct pcmcia_device *cur_dev; -#define thisboard ((const struct das08_board_struct *)dev->board_ptr) - static int das08_cs_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct das08_board_struct *thisboard = comedi_board(dev); int ret; unsigned long iobase; struct pcmcia_device *link = cur_dev; /* XXX hack */ -- cgit v0.10.2 From 17f49dd46c5db2912d2dd985f400f6237fd30255 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 2 Jul 2012 18:10:46 -0700 Subject: staging: comedi: dmm32at: use module_comedi_driver Convert driver to use the module_comedi_driver() macro to remove some of the boilerplate. Move the comedi_driver variable to the end of the file to keep it with the module_comedi_driver() macro. This also removes the need for some of the forward declarations. While moving the variable: 1) strip out the unnecessary cut-and-paste skel driver comments 2) add whitespace to improve the readability 3) rename the variable from driver* to *driver Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c index af353167..ad7fef9 100644 --- a/drivers/staging/comedi/drivers/dmm32at.c +++ b/drivers/staging/comedi/drivers/dmm32at.c @@ -211,43 +211,6 @@ struct dmm32at_private { */ #define devpriv ((struct dmm32at_private *)dev->private) -/* - * The struct comedi_driver structure tells the Comedi core module - * which functions to call to configure/deconfigure (attach/detach) - * the board, and also about the kernel module that contains - * the device code. - */ -static int dmm32at_attach(struct comedi_device *dev, - struct comedi_devconfig *it); -static void dmm32at_detach(struct comedi_device *dev); -static struct comedi_driver driver_dmm32at = { - .driver_name = "dmm32at", - .module = THIS_MODULE, - .attach = dmm32at_attach, - .detach = dmm32at_detach, -/* It is not necessary to implement the following members if you are - * writing a driver for a ISA PnP or PCI card */ -/* Most drivers will support multiple types of boards by - * having an array of board structures. These were defined - * in dmm32at_boards[] above. Note that the element 'name' - * was first in the structure -- Comedi uses this fact to - * extract the name of the board without knowing any details - * about the structure except for its length. - * When a device is attached (by comedi_config), the name - * of the device is given to Comedi, and Comedi tries to - * match it by going through the list of board names. If - * there is a match, the address of the pointer is put - * into dev->board_ptr and driver->attach() is called. - * - * Note that these are not necessary if you can determine - * the type of board in software. ISA PnP, PCI, and PCMCIA - * devices are such boards. - */ - .board_name = &dmm32at_boards[0].name, - .offset = sizeof(struct dmm32at_board), - .num_names = ARRAY_SIZE(dmm32at_boards), -}; - /* prototypes for driver functions below */ static int dmm32at_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, @@ -1027,22 +990,16 @@ void dmm32at_setaitimer(struct comedi_device *dev, unsigned int nansec) } -/* - * A convenient macro that defines init_module() and cleanup_module(), - * as necessary. - */ -static int __init driver_dmm32at_init_module(void) -{ - return comedi_driver_register(&driver_dmm32at); -} - -static void __exit driver_dmm32at_cleanup_module(void) -{ - comedi_driver_unregister(&driver_dmm32at); -} - -module_init(driver_dmm32at_init_module); -module_exit(driver_dmm32at_cleanup_module); +static struct comedi_driver dmm32at_driver = { + .driver_name = "dmm32at", + .module = THIS_MODULE, + .attach = dmm32at_attach, + .detach = dmm32at_detach, + .board_name = &dmm32at_boards[0].name, + .offset = sizeof(struct dmm32at_board), + .num_names = ARRAY_SIZE(dmm32at_boards), +}; +module_comedi_driver(dmm32at_driver); MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_DESCRIPTION("Comedi low-level driver"); -- cgit v0.10.2 From 4f793db33dc3bab1b77a540386a662fbfd595e08 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 2 Jul 2012 18:11:23 -0700 Subject: staging: comedi: dmm32at: remove forward declarations 1 Move the attach/detach functions as well as the boardinfo variable to remove the need to most of the forward declarations. Add some whitespace to the boardinfo during the move. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c index ad7fef9..9c3d322 100644 --- a/drivers/staging/comedi/drivers/dmm32at.c +++ b/drivers/staging/comedi/drivers/dmm32at.c @@ -175,19 +175,6 @@ struct dmm32at_board { int have_dio; int dio_chans; }; -static const struct dmm32at_board dmm32at_boards[] = { - { - .name = "dmm32at", - .ai_chans = 32, - .ai_bits = 16, - .ai_ranges = &dmm32at_airanges, - .ao_chans = 4, - .ao_bits = 12, - .ao_ranges = &dmm32at_aoranges, - .have_dio = 1, - .dio_chans = 24, - }, -}; /* this structure is for data unique to this hardware driver. If * several hardware drivers keep similar information in this structure, @@ -212,198 +199,10 @@ struct dmm32at_private { #define devpriv ((struct dmm32at_private *)dev->private) /* prototypes for driver functions below */ -static int dmm32at_ai_rinsn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int dmm32at_ao_winsn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int dmm32at_ao_rinsn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int dmm32at_dio_insn_bits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); -static int dmm32at_dio_insn_config(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data); -static int dmm32at_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_cmd *cmd); -static int dmm32at_ai_cmd(struct comedi_device *dev, - struct comedi_subdevice *s); -static int dmm32at_ai_cancel(struct comedi_device *dev, - struct comedi_subdevice *s); static int dmm32at_ns_to_timer(unsigned int *ns, int round); -static irqreturn_t dmm32at_isr(int irq, void *d); void dmm32at_setaitimer(struct comedi_device *dev, unsigned int nansec); /* - * Attach is called by the Comedi core to configure the driver - * for a particular board. If you specified a board_name array - * in the driver structure, dev->board_ptr contains that - * address. - */ -static int dmm32at_attach(struct comedi_device *dev, - struct comedi_devconfig *it) -{ - const struct dmm32at_board *board = comedi_board(dev); - int ret; - struct comedi_subdevice *s; - unsigned char aihi, ailo, fifostat, aistat, intstat, airback; - unsigned long iobase; - unsigned int irq; - - iobase = it->options[0]; - irq = it->options[1]; - - printk(KERN_INFO "comedi%d: dmm32at: attaching\n", dev->minor); - printk(KERN_DEBUG "dmm32at: probing at address 0x%04lx, irq %u\n", - iobase, irq); - - /* register address space */ - if (!request_region(iobase, DMM32AT_MEMSIZE, board->name)) { - printk(KERN_ERR "comedi%d: dmm32at: I/O port conflict\n", - dev->minor); - return -EIO; - } - dev->iobase = iobase; - - /* the following just makes sure the board is there and gets - it to a known state */ - - /* reset the board */ - dmm_outb(dev, DMM32AT_CNTRL, DMM32AT_RESET); - - /* allow a millisecond to reset */ - udelay(1000); - - /* zero scan and fifo control */ - dmm_outb(dev, DMM32AT_FIFOCNTRL, 0x0); - - /* zero interrupt and clock control */ - dmm_outb(dev, DMM32AT_INTCLOCK, 0x0); - - /* write a test channel range, the high 3 bits should drop */ - dmm_outb(dev, DMM32AT_AILOW, 0x80); - dmm_outb(dev, DMM32AT_AIHIGH, 0xff); - - /* set the range at 10v unipolar */ - dmm_outb(dev, DMM32AT_AICONF, DMM32AT_RANGE_U10); - - /* should take 10 us to settle, here's a hundred */ - udelay(100); - - /* read back the values */ - ailo = dmm_inb(dev, DMM32AT_AILOW); - aihi = dmm_inb(dev, DMM32AT_AIHIGH); - fifostat = dmm_inb(dev, DMM32AT_FIFOSTAT); - aistat = dmm_inb(dev, DMM32AT_AISTAT); - intstat = dmm_inb(dev, DMM32AT_INTCLOCK); - airback = dmm_inb(dev, DMM32AT_AIRBACK); - - printk(KERN_DEBUG "dmm32at: lo=0x%02x hi=0x%02x fifostat=0x%02x\n", - ailo, aihi, fifostat); - printk(KERN_DEBUG - "dmm32at: aistat=0x%02x intstat=0x%02x airback=0x%02x\n", - aistat, intstat, airback); - - if ((ailo != 0x00) || (aihi != 0x1f) || (fifostat != 0x80) || - (aistat != 0x60 || (intstat != 0x00) || airback != 0x0c)) { - printk(KERN_ERR "dmmat32: board detection failed\n"); - return -EIO; - } - - /* board is there, register interrupt */ - if (irq) { - ret = request_irq(irq, dmm32at_isr, 0, board->name, dev); - if (ret < 0) { - printk(KERN_ERR "dmm32at: irq conflict\n"); - return ret; - } - dev->irq = irq; - } - - dev->board_name = board->name; - -/* - * Allocate the private structure area. alloc_private() is a - * convenient macro defined in comedidev.h. - */ - if (alloc_private(dev, sizeof(struct dmm32at_private)) < 0) - return -ENOMEM; - - ret = comedi_alloc_subdevices(dev, 3); - if (ret) - return ret; - - s = dev->subdevices + 0; - dev->read_subdev = s; - /* analog input subdevice */ - s->type = COMEDI_SUBD_AI; - /* we support single-ended (ground) and differential */ - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF | SDF_CMD_READ; - s->n_chan = board->ai_chans; - s->maxdata = (1 << board->ai_bits) - 1; - s->range_table = board->ai_ranges; - s->len_chanlist = 32; /* This is the maximum chanlist length that - the board can handle */ - s->insn_read = dmm32at_ai_rinsn; - s->do_cmd = dmm32at_ai_cmd; - s->do_cmdtest = dmm32at_ai_cmdtest; - s->cancel = dmm32at_ai_cancel; - - s = dev->subdevices + 1; - /* analog output subdevice */ - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = board->ao_chans; - s->maxdata = (1 << board->ao_bits) - 1; - s->range_table = board->ao_ranges; - s->insn_write = dmm32at_ao_winsn; - s->insn_read = dmm32at_ao_rinsn; - - s = dev->subdevices + 2; - /* digital i/o subdevice */ - if (board->have_dio) { - - /* get access to the DIO regs */ - dmm_outb(dev, DMM32AT_CNTRL, DMM32AT_DIOACC); - /* set the DIO's to the defualt input setting */ - devpriv->dio_config = DMM32AT_DIRA | DMM32AT_DIRB | - DMM32AT_DIRCL | DMM32AT_DIRCH | DMM32AT_DIENABLE; - dmm_outb(dev, DMM32AT_DIOCONF, devpriv->dio_config); - - /* set up the subdevice */ - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = board->dio_chans; - s->maxdata = 1; - s->state = 0; - s->range_table = &range_digital; - s->insn_bits = dmm32at_dio_insn_bits; - s->insn_config = dmm32at_dio_insn_config; - } else { - s->type = COMEDI_SUBD_UNUSED; - } - - /* success */ - printk(KERN_INFO "comedi%d: dmm32at: attached\n", dev->minor); - - return 1; - -} - -static void dmm32at_detach(struct comedi_device *dev) -{ - if (dev->irq) - free_irq(dev->irq, dev); - if (dev->iobase) - release_region(dev->iobase, DMM32AT_MEMSIZE); -} - -/* * "instructions" read/write data in "one-shot" or "software-triggered" * mode. */ @@ -990,6 +789,178 @@ void dmm32at_setaitimer(struct comedi_device *dev, unsigned int nansec) } +static int dmm32at_attach(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + const struct dmm32at_board *board = comedi_board(dev); + int ret; + struct comedi_subdevice *s; + unsigned char aihi, ailo, fifostat, aistat, intstat, airback; + unsigned long iobase; + unsigned int irq; + + iobase = it->options[0]; + irq = it->options[1]; + + printk(KERN_INFO "comedi%d: dmm32at: attaching\n", dev->minor); + printk(KERN_DEBUG "dmm32at: probing at address 0x%04lx, irq %u\n", + iobase, irq); + + /* register address space */ + if (!request_region(iobase, DMM32AT_MEMSIZE, board->name)) { + printk(KERN_ERR "comedi%d: dmm32at: I/O port conflict\n", + dev->minor); + return -EIO; + } + dev->iobase = iobase; + + /* the following just makes sure the board is there and gets + it to a known state */ + + /* reset the board */ + dmm_outb(dev, DMM32AT_CNTRL, DMM32AT_RESET); + + /* allow a millisecond to reset */ + udelay(1000); + + /* zero scan and fifo control */ + dmm_outb(dev, DMM32AT_FIFOCNTRL, 0x0); + + /* zero interrupt and clock control */ + dmm_outb(dev, DMM32AT_INTCLOCK, 0x0); + + /* write a test channel range, the high 3 bits should drop */ + dmm_outb(dev, DMM32AT_AILOW, 0x80); + dmm_outb(dev, DMM32AT_AIHIGH, 0xff); + + /* set the range at 10v unipolar */ + dmm_outb(dev, DMM32AT_AICONF, DMM32AT_RANGE_U10); + + /* should take 10 us to settle, here's a hundred */ + udelay(100); + + /* read back the values */ + ailo = dmm_inb(dev, DMM32AT_AILOW); + aihi = dmm_inb(dev, DMM32AT_AIHIGH); + fifostat = dmm_inb(dev, DMM32AT_FIFOSTAT); + aistat = dmm_inb(dev, DMM32AT_AISTAT); + intstat = dmm_inb(dev, DMM32AT_INTCLOCK); + airback = dmm_inb(dev, DMM32AT_AIRBACK); + + printk(KERN_DEBUG "dmm32at: lo=0x%02x hi=0x%02x fifostat=0x%02x\n", + ailo, aihi, fifostat); + printk(KERN_DEBUG + "dmm32at: aistat=0x%02x intstat=0x%02x airback=0x%02x\n", + aistat, intstat, airback); + + if ((ailo != 0x00) || (aihi != 0x1f) || (fifostat != 0x80) || + (aistat != 0x60 || (intstat != 0x00) || airback != 0x0c)) { + printk(KERN_ERR "dmmat32: board detection failed\n"); + return -EIO; + } + + /* board is there, register interrupt */ + if (irq) { + ret = request_irq(irq, dmm32at_isr, 0, board->name, dev); + if (ret < 0) { + printk(KERN_ERR "dmm32at: irq conflict\n"); + return ret; + } + dev->irq = irq; + } + + dev->board_name = board->name; + +/* + * Allocate the private structure area. alloc_private() is a + * convenient macro defined in comedidev.h. + */ + if (alloc_private(dev, sizeof(struct dmm32at_private)) < 0) + return -ENOMEM; + + ret = comedi_alloc_subdevices(dev, 3); + if (ret) + return ret; + + s = dev->subdevices + 0; + dev->read_subdev = s; + /* analog input subdevice */ + s->type = COMEDI_SUBD_AI; + /* we support single-ended (ground) and differential */ + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF | SDF_CMD_READ; + s->n_chan = board->ai_chans; + s->maxdata = (1 << board->ai_bits) - 1; + s->range_table = board->ai_ranges; + s->len_chanlist = 32; /* This is the maximum chanlist length that + the board can handle */ + s->insn_read = dmm32at_ai_rinsn; + s->do_cmd = dmm32at_ai_cmd; + s->do_cmdtest = dmm32at_ai_cmdtest; + s->cancel = dmm32at_ai_cancel; + + s = dev->subdevices + 1; + /* analog output subdevice */ + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = board->ao_chans; + s->maxdata = (1 << board->ao_bits) - 1; + s->range_table = board->ao_ranges; + s->insn_write = dmm32at_ao_winsn; + s->insn_read = dmm32at_ao_rinsn; + + s = dev->subdevices + 2; + /* digital i/o subdevice */ + if (board->have_dio) { + + /* get access to the DIO regs */ + dmm_outb(dev, DMM32AT_CNTRL, DMM32AT_DIOACC); + /* set the DIO's to the defualt input setting */ + devpriv->dio_config = DMM32AT_DIRA | DMM32AT_DIRB | + DMM32AT_DIRCL | DMM32AT_DIRCH | DMM32AT_DIENABLE; + dmm_outb(dev, DMM32AT_DIOCONF, devpriv->dio_config); + + /* set up the subdevice */ + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = board->dio_chans; + s->maxdata = 1; + s->state = 0; + s->range_table = &range_digital; + s->insn_bits = dmm32at_dio_insn_bits; + s->insn_config = dmm32at_dio_insn_config; + } else { + s->type = COMEDI_SUBD_UNUSED; + } + + /* success */ + printk(KERN_INFO "comedi%d: dmm32at: attached\n", dev->minor); + + return 1; + +} + +static void dmm32at_detach(struct comedi_device *dev) +{ + if (dev->irq) + free_irq(dev->irq, dev); + if (dev->iobase) + release_region(dev->iobase, DMM32AT_MEMSIZE); +} + +static const struct dmm32at_board dmm32at_boards[] = { + { + .name = "dmm32at", + .ai_chans = 32, + .ai_bits = 16, + .ai_ranges = &dmm32at_airanges, + .ao_chans = 4, + .ao_bits = 12, + .ao_ranges = &dmm32at_aoranges, + .have_dio = 1, + .dio_chans = 24, + }, +}; + static struct comedi_driver dmm32at_driver = { .driver_name = "dmm32at", .module = THIS_MODULE, -- cgit v0.10.2 From 47ae6a72597c29745fc18d693fe00bc8a537cfdf Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 2 Jul 2012 18:11:56 -0700 Subject: staging: comedi: dmm32at: remove forward declarations 2 Move the dmm32at_ns_to_timer() and dmm32at_setaitimer() functions to remove the need for the remaining forward declarations. Also, make dmm32at_setaitimer() static, it's only referenced in this file. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c index 9c3d322..c139eff 100644 --- a/drivers/staging/comedi/drivers/dmm32at.c +++ b/drivers/staging/comedi/drivers/dmm32at.c @@ -198,10 +198,6 @@ struct dmm32at_private { */ #define devpriv ((struct dmm32at_private *)dev->private) -/* prototypes for driver functions below */ -static int dmm32at_ns_to_timer(unsigned int *ns, int round); -void dmm32at_setaitimer(struct comedi_device *dev, unsigned int nansec); - /* * "instructions" read/write data in "one-shot" or "software-triggered" * mode. @@ -279,6 +275,23 @@ static int dmm32at_ai_rinsn(struct comedi_device *dev, return n; } +/* This function doesn't require a particular form, this is just + * what happens to be used in some of the drivers. It should + * convert ns nanoseconds to a counter value suitable for programming + * the device. Also, it should adjust ns so that it cooresponds to + * the actual time that the device will use. */ +static int dmm32at_ns_to_timer(unsigned int *ns, int round) +{ + /* trivial timer */ + /* if your timing is done through two cascaded timers, the + * i8253_cascade_ns_to_timer() function in 8253.h can be + * very helpful. There are also i8254_load() and i8254_mm_load() + * which can be used to load values into the ubiquitous 8254 counters + */ + + return *ns; +} + static int dmm32at_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) @@ -465,6 +478,37 @@ static int dmm32at_ai_cmdtest(struct comedi_device *dev, return 0; } +static void dmm32at_setaitimer(struct comedi_device *dev, unsigned int nansec) +{ + unsigned char lo1, lo2, hi2; + unsigned short both2; + + /* based on 10mhz clock */ + lo1 = 200; + both2 = nansec / 20000; + hi2 = (both2 & 0xff00) >> 8; + lo2 = both2 & 0x00ff; + + /* set the counter frequency to 10mhz */ + dmm_outb(dev, DMM32AT_CNTRDIO, 0); + + /* get access to the clock regs */ + dmm_outb(dev, DMM32AT_CNTRL, DMM32AT_CLKACC); + + /* write the counter 1 control word and low byte to counter */ + dmm_outb(dev, DMM32AT_CLKCT, DMM32AT_CLKCT1); + dmm_outb(dev, DMM32AT_CLK1, lo1); + + /* write the counter 2 control word and low byte then to counter */ + dmm_outb(dev, DMM32AT_CLKCT, DMM32AT_CLKCT2); + dmm_outb(dev, DMM32AT_CLK2, lo2); + dmm_outb(dev, DMM32AT_CLK2, hi2); + + /* enable the ai conversion interrupt and the clock to start scans */ + dmm_outb(dev, DMM32AT_INTCLOCK, DMM32AT_ADINT | DMM32AT_CLKSEL); + +} + static int dmm32at_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { struct comedi_cmd *cmd = &s->async->cmd; @@ -591,23 +635,6 @@ static irqreturn_t dmm32at_isr(int irq, void *d) return IRQ_HANDLED; } -/* This function doesn't require a particular form, this is just - * what happens to be used in some of the drivers. It should - * convert ns nanoseconds to a counter value suitable for programming - * the device. Also, it should adjust ns so that it cooresponds to - * the actual time that the device will use. */ -static int dmm32at_ns_to_timer(unsigned int *ns, int round) -{ - /* trivial timer */ - /* if your timing is done through two cascaded timers, the - * i8253_cascade_ns_to_timer() function in 8253.h can be - * very helpful. There are also i8254_load() and i8254_mm_load() - * which can be used to load values into the ubiquitous 8254 counters - */ - - return *ns; -} - static int dmm32at_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -758,37 +785,6 @@ static int dmm32at_dio_insn_config(struct comedi_device *dev, return 1; } -void dmm32at_setaitimer(struct comedi_device *dev, unsigned int nansec) -{ - unsigned char lo1, lo2, hi2; - unsigned short both2; - - /* based on 10mhz clock */ - lo1 = 200; - both2 = nansec / 20000; - hi2 = (both2 & 0xff00) >> 8; - lo2 = both2 & 0x00ff; - - /* set the counter frequency to 10mhz */ - dmm_outb(dev, DMM32AT_CNTRDIO, 0); - - /* get access to the clock regs */ - dmm_outb(dev, DMM32AT_CNTRL, DMM32AT_CLKACC); - - /* write the counter 1 control word and low byte to counter */ - dmm_outb(dev, DMM32AT_CLKCT, DMM32AT_CLKCT1); - dmm_outb(dev, DMM32AT_CLK1, lo1); - - /* write the counter 2 control word and low byte then to counter */ - dmm_outb(dev, DMM32AT_CLKCT, DMM32AT_CLKCT2); - dmm_outb(dev, DMM32AT_CLK2, lo2); - dmm_outb(dev, DMM32AT_CLK2, hi2); - - /* enable the ai conversion interrupt and the clock to start scans */ - dmm_outb(dev, DMM32AT_INTCLOCK, DMM32AT_ADINT | DMM32AT_CLKSEL); - -} - static int dmm32at_attach(struct comedi_device *dev, struct comedi_devconfig *it) { -- cgit v0.10.2 From 99953ea1ec780c22bacf065fc7c9750f0182c0f4 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 2 Jul 2012 18:12:35 -0700 Subject: staging: comedi: dmm32at: remove dmm_inb macro The macro is just a wrapper for inb(). Just use the inb() directly. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c index c139eff..ee4e8ab 100644 --- a/drivers/staging/comedi/drivers/dmm32at.c +++ b/drivers/staging/comedi/drivers/dmm32at.c @@ -78,7 +78,6 @@ Configuration Options: #define DMM32AT_DIOC 0x0e #define DMM32AT_DIOCONF 0x0f -#define dmm_inb(cdev, reg) inb((cdev->iobase)+reg) #define dmm_outb(cdev, reg, valu) outb(valu, (cdev->iobase)+reg) /* Board register values. */ @@ -232,7 +231,7 @@ static int dmm32at_ai_rinsn(struct comedi_device *dev, /* wait for circuit to settle */ for (i = 0; i < 40000; i++) { - status = dmm_inb(dev, DMM32AT_AIRBACK); + status = inb(dev->iobase + DMM32AT_AIRBACK); if ((status & DMM32AT_STATUS) == 0) break; } @@ -247,7 +246,7 @@ static int dmm32at_ai_rinsn(struct comedi_device *dev, dmm_outb(dev, DMM32AT_CONV, 0xff); /* wait for conversion to end */ for (i = 0; i < 40000; i++) { - status = dmm_inb(dev, DMM32AT_AISTAT); + status = inb(dev->iobase + DMM32AT_AISTAT); if ((status & DMM32AT_STATUS) == 0) break; } @@ -257,8 +256,8 @@ static int dmm32at_ai_rinsn(struct comedi_device *dev, } /* read data */ - lsb = dmm_inb(dev, DMM32AT_AILSB); - msb = dmm_inb(dev, DMM32AT_AIMSB); + lsb = inb(dev->iobase + DMM32AT_AILSB); + msb = inb(dev->iobase + DMM32AT_AIMSB); /* invert sign bit to make range unsigned, this is an idiosyncrasy of the diamond board, it return @@ -550,7 +549,7 @@ static int dmm32at_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* wait for circuit to settle */ for (i = 0; i < 40000; i++) { - status = dmm_inb(dev, DMM32AT_AIRBACK); + status = inb(dev->iobase + DMM32AT_AIRBACK); if ((status & DMM32AT_STATUS) == 0) break; } @@ -600,7 +599,7 @@ static irqreturn_t dmm32at_isr(int irq, void *d) return IRQ_HANDLED; } - intstat = dmm_inb(dev, DMM32AT_INTCLOCK); + intstat = inb(dev->iobase + DMM32AT_INTCLOCK); if (intstat & DMM32AT_ADINT) { struct comedi_subdevice *s = dev->read_subdev; @@ -608,8 +607,8 @@ static irqreturn_t dmm32at_isr(int irq, void *d) for (i = 0; i < cmd->chanlist_len; i++) { /* read data */ - lsb = dmm_inb(dev, DMM32AT_AILSB); - msb = dmm_inb(dev, DMM32AT_AIMSB); + lsb = inb(dev->iobase + DMM32AT_AILSB); + msb = inb(dev->iobase + DMM32AT_AIMSB); /* invert sign bit to make range unsigned */ samp = ((msb ^ 0x0080) << 8) + lsb; @@ -660,7 +659,7 @@ static int dmm32at_ao_winsn(struct comedi_device *dev, /* wait for circuit to settle */ for (i = 0; i < 40000; i++) { - status = dmm_inb(dev, DMM32AT_DACSTAT); + status = inb(dev->iobase + DMM32AT_DACSTAT); if ((status & DMM32AT_DACBUSY) == 0) break; } @@ -669,7 +668,7 @@ static int dmm32at_ao_winsn(struct comedi_device *dev, return -ETIMEDOUT; } /* dummy read to update trigger the output */ - status = dmm_inb(dev, DMM32AT_DACMSB); + status = inb(dev->iobase + DMM32AT_DACMSB); } @@ -731,11 +730,11 @@ static int dmm32at_dio_insn_bits(struct comedi_device *dev, } /* now read the state back in */ - s->state = dmm_inb(dev, DMM32AT_DIOC); + s->state = inb(dev->iobase + DMM32AT_DIOC); s->state <<= 8; - s->state |= dmm_inb(dev, DMM32AT_DIOB); + s->state |= inb(dev->iobase + DMM32AT_DIOB); s->state <<= 8; - s->state |= dmm_inb(dev, DMM32AT_DIOA); + s->state |= inb(dev->iobase + DMM32AT_DIOA); data[1] = s->state; /* on return, data[1] contains the value of the digital @@ -836,12 +835,12 @@ static int dmm32at_attach(struct comedi_device *dev, udelay(100); /* read back the values */ - ailo = dmm_inb(dev, DMM32AT_AILOW); - aihi = dmm_inb(dev, DMM32AT_AIHIGH); - fifostat = dmm_inb(dev, DMM32AT_FIFOSTAT); - aistat = dmm_inb(dev, DMM32AT_AISTAT); - intstat = dmm_inb(dev, DMM32AT_INTCLOCK); - airback = dmm_inb(dev, DMM32AT_AIRBACK); + ailo = inb(dev->iobase + DMM32AT_AILOW); + aihi = inb(dev->iobase + DMM32AT_AIHIGH); + fifostat = inb(dev->iobase + DMM32AT_FIFOSTAT); + aistat = inb(dev->iobase + DMM32AT_AISTAT); + intstat = inb(dev->iobase + DMM32AT_INTCLOCK); + airback = inb(dev->iobase + DMM32AT_AIRBACK); printk(KERN_DEBUG "dmm32at: lo=0x%02x hi=0x%02x fifostat=0x%02x\n", ailo, aihi, fifostat); -- cgit v0.10.2 From 29f747c21e4318cc41efa82dac217da9ee8d5533 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 2 Jul 2012 18:13:11 -0700 Subject: staging: comedi: dmm32at: remove dmm_outb macro The macro is just a wrapper for outb(). Just use the outb() directly. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c index ee4e8ab..2ae31e8 100644 --- a/drivers/staging/comedi/drivers/dmm32at.c +++ b/drivers/staging/comedi/drivers/dmm32at.c @@ -78,8 +78,6 @@ Configuration Options: #define DMM32AT_DIOC 0x0e #define DMM32AT_DIOCONF 0x0f -#define dmm_outb(cdev, reg, valu) outb(valu, (cdev->iobase)+reg) - /* Board register values. */ /* DMM32AT_DACSTAT 0x04 */ @@ -221,13 +219,13 @@ static int dmm32at_ai_rinsn(struct comedi_device *dev, /* printk("channel=0x%02x, range=%d\n",chan,range); */ /* zero scan and fifo control and reset fifo */ - dmm_outb(dev, DMM32AT_FIFOCNTRL, DMM32AT_FIFORESET); + outb(DMM32AT_FIFORESET, dev->iobase + DMM32AT_FIFOCNTRL); /* write the ai channel range regs */ - dmm_outb(dev, DMM32AT_AILOW, chan); - dmm_outb(dev, DMM32AT_AIHIGH, chan); + outb(chan, dev->iobase + DMM32AT_AILOW); + outb(chan, dev->iobase + DMM32AT_AIHIGH); /* set the range bits */ - dmm_outb(dev, DMM32AT_AICONF, dmm32at_rangebits[range]); + outb(dmm32at_rangebits[range], dev->iobase + DMM32AT_AICONF); /* wait for circuit to settle */ for (i = 0; i < 40000; i++) { @@ -243,7 +241,7 @@ static int dmm32at_ai_rinsn(struct comedi_device *dev, /* convert n samples */ for (n = 0; n < insn->n; n++) { /* trigger conversion */ - dmm_outb(dev, DMM32AT_CONV, 0xff); + outb(0xff, dev->iobase + DMM32AT_CONV); /* wait for conversion to end */ for (i = 0; i < 40000; i++) { status = inb(dev->iobase + DMM32AT_AISTAT); @@ -489,23 +487,22 @@ static void dmm32at_setaitimer(struct comedi_device *dev, unsigned int nansec) lo2 = both2 & 0x00ff; /* set the counter frequency to 10mhz */ - dmm_outb(dev, DMM32AT_CNTRDIO, 0); + outb(0, dev->iobase + DMM32AT_CNTRDIO); /* get access to the clock regs */ - dmm_outb(dev, DMM32AT_CNTRL, DMM32AT_CLKACC); + outb(DMM32AT_CLKACC, dev->iobase + DMM32AT_CNTRL); /* write the counter 1 control word and low byte to counter */ - dmm_outb(dev, DMM32AT_CLKCT, DMM32AT_CLKCT1); - dmm_outb(dev, DMM32AT_CLK1, lo1); + outb(DMM32AT_CLKCT1, dev->iobase + DMM32AT_CLKCT); + outb(lo1, dev->iobase + DMM32AT_CLK1); /* write the counter 2 control word and low byte then to counter */ - dmm_outb(dev, DMM32AT_CLKCT, DMM32AT_CLKCT2); - dmm_outb(dev, DMM32AT_CLK2, lo2); - dmm_outb(dev, DMM32AT_CLK2, hi2); + outb(DMM32AT_CLKCT2, dev->iobase + DMM32AT_CLKCT); + outb(lo2, dev->iobase + DMM32AT_CLK2); + outb(hi2, dev->iobase + DMM32AT_CLK2); /* enable the ai conversion interrupt and the clock to start scans */ - dmm_outb(dev, DMM32AT_INTCLOCK, DMM32AT_ADINT | DMM32AT_CLKSEL); - + outb(DMM32AT_ADINT | DMM32AT_CLKSEL, dev->iobase + DMM32AT_INTCLOCK); } static int dmm32at_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) @@ -525,20 +522,20 @@ static int dmm32at_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) range = CR_RANGE(cmd->chanlist[0]); /* reset fifo */ - dmm_outb(dev, DMM32AT_FIFOCNTRL, DMM32AT_FIFORESET); + outb(DMM32AT_FIFORESET, dev->iobase + DMM32AT_FIFOCNTRL); /* set scan enable */ - dmm_outb(dev, DMM32AT_FIFOCNTRL, DMM32AT_SCANENABLE); + outb(DMM32AT_SCANENABLE, dev->iobase + DMM32AT_FIFOCNTRL); /* write the ai channel range regs */ - dmm_outb(dev, DMM32AT_AILOW, chanlo); - dmm_outb(dev, DMM32AT_AIHIGH, chanhi); + outb(chanlo, dev->iobase + DMM32AT_AILOW); + outb(chanhi, dev->iobase + DMM32AT_AIHIGH); /* set the range bits */ - dmm_outb(dev, DMM32AT_AICONF, dmm32at_rangebits[range]); + outb(dmm32at_rangebits[range], dev->iobase + DMM32AT_AICONF); /* reset the interrupt just in case */ - dmm_outb(dev, DMM32AT_CNTRL, DMM32AT_INTRESET); + outb(DMM32AT_INTRESET, dev->iobase + DMM32AT_CNTRL); if (cmd->stop_src == TRIG_COUNT) devpriv->ai_scans_left = cmd->stop_arg; @@ -563,8 +560,8 @@ static int dmm32at_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) dmm32at_setaitimer(dev, cmd->scan_begin_arg); } else { /* start the interrups and initiate a single scan */ - dmm_outb(dev, DMM32AT_INTCLOCK, DMM32AT_ADINT); - dmm_outb(dev, DMM32AT_CONV, 0xff); + outb(DMM32AT_ADINT, dev->iobase + DMM32AT_INTCLOCK); + outb(0xff, dev->iobase + DMM32AT_CONV); } /* printk("dmmat32 in command\n"); */ @@ -619,7 +616,7 @@ static irqreturn_t dmm32at_isr(int irq, void *d) devpriv->ai_scans_left--; if (devpriv->ai_scans_left == 0) { /* disable further interrupts and clocks */ - dmm_outb(dev, DMM32AT_INTCLOCK, 0x0); + outb(0x0, dev->iobase + DMM32AT_INTCLOCK); /* set the buffer to be flushed with an EOF */ s->async->events |= COMEDI_CB_EOA; } @@ -630,7 +627,7 @@ static irqreturn_t dmm32at_isr(int irq, void *d) } /* reset the interrupt */ - dmm_outb(dev, DMM32AT_CNTRL, DMM32AT_INTRESET); + outb(DMM32AT_INTRESET, dev->iobase + DMM32AT_CNTRL); return IRQ_HANDLED; } @@ -654,8 +651,8 @@ static int dmm32at_ao_winsn(struct comedi_device *dev, hi = (data[i] >> 8) + chan * (1 << 6); /* printk("writing 0x%02x 0x%02x\n",hi,lo); */ /* write the low and high values to the board */ - dmm_outb(dev, DMM32AT_DACLSB, lo); - dmm_outb(dev, DMM32AT_DACMSB, hi); + outb(lo, dev->iobase + DMM32AT_DACLSB); + outb(hi, dev->iobase + DMM32AT_DACMSB); /* wait for circuit to settle */ for (i = 0; i < 40000; i++) { @@ -712,21 +709,21 @@ static int dmm32at_dio_insn_bits(struct comedi_device *dev, } /* get access to the DIO regs */ - dmm_outb(dev, DMM32AT_CNTRL, DMM32AT_DIOACC); + outb(DMM32AT_DIOACC, dev->iobase + DMM32AT_CNTRL); /* if either part of dio is set for output */ if (((devpriv->dio_config & DMM32AT_DIRCL) == 0) || ((devpriv->dio_config & DMM32AT_DIRCH) == 0)) { diobits = (s->state & 0x00ff0000) >> 16; - dmm_outb(dev, DMM32AT_DIOC, diobits); + outb(diobits, dev->iobase + DMM32AT_DIOC); } if ((devpriv->dio_config & DMM32AT_DIRB) == 0) { diobits = (s->state & 0x0000ff00) >> 8; - dmm_outb(dev, DMM32AT_DIOB, diobits); + outb(diobits, dev->iobase + DMM32AT_DIOB); } if ((devpriv->dio_config & DMM32AT_DIRA) == 0) { diobits = (s->state & 0x000000ff); - dmm_outb(dev, DMM32AT_DIOA, diobits); + outb(diobits, dev->iobase + DMM32AT_DIOA); } /* now read the state back in */ @@ -777,9 +774,9 @@ static int dmm32at_dio_insn_config(struct comedi_device *dev, else devpriv->dio_config |= chanbit; /* get access to the DIO regs */ - dmm_outb(dev, DMM32AT_CNTRL, DMM32AT_DIOACC); + outb(DMM32AT_DIOACC, dev->iobase + DMM32AT_CNTRL); /* set the DIO's to the new configuration setting */ - dmm_outb(dev, DMM32AT_DIOCONF, devpriv->dio_config); + outb(devpriv->dio_config, dev->iobase + DMM32AT_DIOCONF); return 1; } @@ -813,23 +810,23 @@ static int dmm32at_attach(struct comedi_device *dev, it to a known state */ /* reset the board */ - dmm_outb(dev, DMM32AT_CNTRL, DMM32AT_RESET); + outb(DMM32AT_RESET, dev->iobase + DMM32AT_CNTRL); /* allow a millisecond to reset */ udelay(1000); /* zero scan and fifo control */ - dmm_outb(dev, DMM32AT_FIFOCNTRL, 0x0); + outb(0x0, dev->iobase + DMM32AT_FIFOCNTRL); /* zero interrupt and clock control */ - dmm_outb(dev, DMM32AT_INTCLOCK, 0x0); + outb(0x0, dev->iobase + DMM32AT_INTCLOCK); /* write a test channel range, the high 3 bits should drop */ - dmm_outb(dev, DMM32AT_AILOW, 0x80); - dmm_outb(dev, DMM32AT_AIHIGH, 0xff); + outb(0x80, dev->iobase + DMM32AT_AILOW); + outb(0xff, dev->iobase + DMM32AT_AIHIGH); /* set the range at 10v unipolar */ - dmm_outb(dev, DMM32AT_AICONF, DMM32AT_RANGE_U10); + outb(DMM32AT_RANGE_U10, dev->iobase + DMM32AT_AICONF); /* should take 10 us to settle, here's a hundred */ udelay(100); @@ -908,11 +905,11 @@ static int dmm32at_attach(struct comedi_device *dev, if (board->have_dio) { /* get access to the DIO regs */ - dmm_outb(dev, DMM32AT_CNTRL, DMM32AT_DIOACC); + outb(DMM32AT_DIOACC, dev->iobase + DMM32AT_CNTRL); /* set the DIO's to the defualt input setting */ devpriv->dio_config = DMM32AT_DIRA | DMM32AT_DIRB | DMM32AT_DIRCL | DMM32AT_DIRCH | DMM32AT_DIENABLE; - dmm_outb(dev, DMM32AT_DIOCONF, devpriv->dio_config); + outb(devpriv->dio_config, dev->iobase + DMM32AT_DIOCONF); /* set up the subdevice */ s->type = COMEDI_SUBD_DIO; -- cgit v0.10.2 From 2792182816be376391c2cfc142bfd32f3ab8c5cd Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 2 Jul 2012 18:13:53 -0700 Subject: staging: comedi: dmm32at: remove unneeded boardinfo variables Like most of the comedi drivers, this one appears to have been started based on the skel driver. Cut-and-paste from that driver has resulted in an unnecessarily complex boardinfo struct. Remove everything from the boardinfo struct, except the 'name', and just use the open coded values in the attach function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c index 2ae31e8..1d21e22 100644 --- a/drivers/staging/comedi/drivers/dmm32at.c +++ b/drivers/staging/comedi/drivers/dmm32at.c @@ -156,21 +156,8 @@ static const struct comedi_lrange dmm32at_aoranges = { } }; -/* - * Board descriptions for two imaginary boards. Describing the - * boards in this way is optional, and completely driver-dependent. - * Some drivers use arrays such as this, other do not. - */ struct dmm32at_board { const char *name; - int ai_chans; - int ai_bits; - const struct comedi_lrange *ai_ranges; - int ao_chans; - int ao_bits; - const struct comedi_lrange *ao_ranges; - int have_dio; - int dio_chans; }; /* this structure is for data unique to this hardware driver. If @@ -880,9 +867,9 @@ static int dmm32at_attach(struct comedi_device *dev, s->type = COMEDI_SUBD_AI; /* we support single-ended (ground) and differential */ s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF | SDF_CMD_READ; - s->n_chan = board->ai_chans; - s->maxdata = (1 << board->ai_bits) - 1; - s->range_table = board->ai_ranges; + s->n_chan = 32; + s->maxdata = 0xffff; + s->range_table = &dmm32at_airanges; s->len_chanlist = 32; /* This is the maximum chanlist length that the board can handle */ s->insn_read = dmm32at_ai_rinsn; @@ -894,35 +881,31 @@ static int dmm32at_attach(struct comedi_device *dev, /* analog output subdevice */ s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_WRITABLE; - s->n_chan = board->ao_chans; - s->maxdata = (1 << board->ao_bits) - 1; - s->range_table = board->ao_ranges; + s->n_chan = 4; + s->maxdata = 0x0fff; + s->range_table = &dmm32at_aoranges; s->insn_write = dmm32at_ao_winsn; s->insn_read = dmm32at_ao_rinsn; s = dev->subdevices + 2; /* digital i/o subdevice */ - if (board->have_dio) { - - /* get access to the DIO regs */ - outb(DMM32AT_DIOACC, dev->iobase + DMM32AT_CNTRL); - /* set the DIO's to the defualt input setting */ - devpriv->dio_config = DMM32AT_DIRA | DMM32AT_DIRB | - DMM32AT_DIRCL | DMM32AT_DIRCH | DMM32AT_DIENABLE; - outb(devpriv->dio_config, dev->iobase + DMM32AT_DIOCONF); - - /* set up the subdevice */ - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = board->dio_chans; - s->maxdata = 1; - s->state = 0; - s->range_table = &range_digital; - s->insn_bits = dmm32at_dio_insn_bits; - s->insn_config = dmm32at_dio_insn_config; - } else { - s->type = COMEDI_SUBD_UNUSED; - } + + /* get access to the DIO regs */ + outb(DMM32AT_DIOACC, dev->iobase + DMM32AT_CNTRL); + /* set the DIO's to the defualt input setting */ + devpriv->dio_config = DMM32AT_DIRA | DMM32AT_DIRB | + DMM32AT_DIRCL | DMM32AT_DIRCH | DMM32AT_DIENABLE; + outb(devpriv->dio_config, dev->iobase + DMM32AT_DIOCONF); + + /* set up the subdevice */ + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 24; + s->maxdata = 1; + s->state = 0; + s->range_table = &range_digital; + s->insn_bits = dmm32at_dio_insn_bits; + s->insn_config = dmm32at_dio_insn_config; /* success */ printk(KERN_INFO "comedi%d: dmm32at: attached\n", dev->minor); @@ -942,14 +925,6 @@ static void dmm32at_detach(struct comedi_device *dev) static const struct dmm32at_board dmm32at_boards[] = { { .name = "dmm32at", - .ai_chans = 32, - .ai_bits = 16, - .ai_ranges = &dmm32at_airanges, - .ao_chans = 4, - .ao_bits = 12, - .ao_ranges = &dmm32at_aoranges, - .have_dio = 1, - .dio_chans = 24, }, }; -- cgit v0.10.2 From 3eff01744009de100f03a1dc2e3d5f98da2235e5 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 2 Jul 2012 18:14:27 -0700 Subject: staging: comedi: dmm32at: remove devpriv macro The 'devpriv' macro relies on a local variable having a specific name and yields a pointer derived from that local variable. Replace the macro with a local variable where used. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c index 1d21e22..f0221e9 100644 --- a/drivers/staging/comedi/drivers/dmm32at.c +++ b/drivers/staging/comedi/drivers/dmm32at.c @@ -177,12 +177,6 @@ struct dmm32at_private { }; /* - * most drivers define the following macro to make it easy to - * access the private structure. - */ -#define devpriv ((struct dmm32at_private *)dev->private) - -/* * "instructions" read/write data in "one-shot" or "software-triggered" * mode. */ @@ -494,6 +488,7 @@ static void dmm32at_setaitimer(struct comedi_device *dev, unsigned int nansec) static int dmm32at_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { + struct dmm32at_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; int i, range; unsigned char chanlo, chanhi, status; @@ -566,17 +561,20 @@ static int dmm32at_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) static int dmm32at_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { + struct dmm32at_private *devpriv = dev->private; + devpriv->ai_scans_left = 1; return 0; } static irqreturn_t dmm32at_isr(int irq, void *d) { + struct comedi_device *dev = d; + struct dmm32at_private *devpriv = dev->private; unsigned char intstat; unsigned int samp; unsigned short msb, lsb; int i; - struct comedi_device *dev = d; if (!dev->attached) { comedi_error(dev, "spurious interrupt"); @@ -622,6 +620,7 @@ static int dmm32at_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct dmm32at_private *devpriv = dev->private; int i; int chan = CR_CHAN(insn->chanspec); unsigned char hi, lo, status; @@ -666,6 +665,7 @@ static int dmm32at_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct dmm32at_private *devpriv = dev->private; int i; int chan = CR_CHAN(insn->chanspec); @@ -684,6 +684,7 @@ static int dmm32at_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct dmm32at_private *devpriv = dev->private; unsigned char diobits; /* The insn data is a mask in data[0] and the new data @@ -735,6 +736,7 @@ static int dmm32at_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct dmm32at_private *devpriv = dev->private; unsigned char chanbit; int chan = CR_CHAN(insn->chanspec); @@ -772,6 +774,7 @@ static int dmm32at_attach(struct comedi_device *dev, struct comedi_devconfig *it) { const struct dmm32at_board *board = comedi_board(dev); + struct dmm32at_private *devpriv; int ret; struct comedi_subdevice *s; unsigned char aihi, ailo, fifostat, aistat, intstat, airback; @@ -854,8 +857,9 @@ static int dmm32at_attach(struct comedi_device *dev, * Allocate the private structure area. alloc_private() is a * convenient macro defined in comedidev.h. */ - if (alloc_private(dev, sizeof(struct dmm32at_private)) < 0) + if (alloc_private(dev, sizeof(*devpriv)) < 0) return -ENOMEM; + devpriv = dev->private; ret = comedi_alloc_subdevices(dev, 3); if (ret) -- cgit v0.10.2 From f4ce61a0ca021d9226da9c3269899ae75725468a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 2 Jul 2012 18:15:02 -0700 Subject: staging: comedi: dmm32at: remove skel driver cut-and-paste comments Remove the cut-and-paste comments from the skel driver. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c index f0221e9..7107f59 100644 --- a/drivers/staging/comedi/drivers/dmm32at.c +++ b/drivers/staging/comedi/drivers/dmm32at.c @@ -160,10 +160,6 @@ struct dmm32at_board { const char *name; }; -/* this structure is for data unique to this hardware driver. If - * several hardware drivers keep similar information in this structure, - * feel free to suggest moving the variable to the struct comedi_device struct. - */ struct dmm32at_private { int data; @@ -176,11 +172,6 @@ struct dmm32at_private { }; -/* - * "instructions" read/write data in "one-shot" or "software-triggered" - * mode. - */ - static int dmm32at_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -253,20 +244,9 @@ static int dmm32at_ai_rinsn(struct comedi_device *dev, return n; } -/* This function doesn't require a particular form, this is just - * what happens to be used in some of the drivers. It should - * convert ns nanoseconds to a counter value suitable for programming - * the device. Also, it should adjust ns so that it cooresponds to - * the actual time that the device will use. */ static int dmm32at_ns_to_timer(unsigned int *ns, int round) { /* trivial timer */ - /* if your timing is done through two cascaded timers, the - * i8253_cascade_ns_to_timer() function in 8253.h can be - * very helpful. There are also i8254_load() and i8254_mm_load() - * which can be used to load values into the ubiquitous 8254 counters - */ - return *ns; } @@ -278,15 +258,6 @@ static int dmm32at_ai_cmdtest(struct comedi_device *dev, int tmp; int start_chan, gain, i; - /* printk("dmmat32 in command test\n"); */ - - /* cmdtest tests a particular command to see if it is valid. - * Using the cmdtest ioctl, a user can create a valid cmd - * and then have it executes by the cmd ioctl. - * - * cmdtest returns 1,2,3,4 or 0, depending on which tests - * the command passes. */ - /* step 1: make sure trigger sources are trivially valid */ tmp = cmd->start_src; @@ -659,8 +630,6 @@ static int dmm32at_ao_winsn(struct comedi_device *dev, return i; } -/* AO subdevices should have a read insn as well as a write insn. - * Usually this means copying a value stored in devpriv. */ static int dmm32at_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -675,11 +644,6 @@ static int dmm32at_ao_rinsn(struct comedi_device *dev, return i; } -/* DIO devices are slightly special. Although it is possible to - * implement the insn_read/insn_write interface, it is much more - * useful to applications if you implement the insn_bits interface. - * This allows packed reading/writing of the DIO channels. The - * comedi core can convert between insn_bits and insn_read/write */ static int dmm32at_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -853,10 +817,6 @@ static int dmm32at_attach(struct comedi_device *dev, dev->board_name = board->name; -/* - * Allocate the private structure area. alloc_private() is a - * convenient macro defined in comedidev.h. - */ if (alloc_private(dev, sizeof(*devpriv)) < 0) return -ENOMEM; devpriv = dev->private; -- cgit v0.10.2 From c14d1769ba81ed084adb450d2fa1bacaee3cd2c7 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 2 Jul 2012 14:26:24 -0700 Subject: staging: comedi: s626: fix the number of dio channels The first digital i/o subdevice has its n_chan set to S626_DIO_CHANNELS which is defined as 48. This is actually the total number of channels provided by all three digital i/o subdevices. Each subdevice only has 16 channels. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index bef9649..f90578e 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -2636,7 +2636,7 @@ static int s626_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* digital I/O subdevice */ s->type = COMEDI_SUBD_DIO; s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = S626_DIO_CHANNELS; + s->n_chan = 16; s->maxdata = 1; s->io_bits = 0xffff; s->private = &dio_private_A; -- cgit v0.10.2 From 3ec50be588d773b408e82643c87c5a681b0354ad Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Wed, 27 Jun 2012 22:28:55 +0200 Subject: Staging: echo: One variable per line Our convention is one (statement and) variable per line. Enforce this in drivers/staging/echo/echo.[ch] . Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/echo/echo.c b/drivers/staging/echo/echo.c index afbf544..ca87ce9 100644 --- a/drivers/staging/echo/echo.c +++ b/drivers/staging/echo/echo.c @@ -118,7 +118,8 @@ #ifdef __bfin__ static inline void lms_adapt_bg(struct oslec_state *ec, int clean, int shift) { - int i, j; + int i; + int j; int offset1; int offset2; int factor; @@ -335,7 +336,8 @@ int16_t oslec_update(struct oslec_state *ec, int16_t tx, int16_t rx) { int32_t echo_value; int clean_bg; - int tmp, tmp1; + int tmp; + int tmp1; /* * Input scaling was found be required to prevent problems when tx @@ -624,7 +626,8 @@ EXPORT_SYMBOL_GPL(oslec_update); int16_t oslec_hpf_tx(struct oslec_state *ec, int16_t tx) { - int tmp, tmp1; + int tmp; + int tmp1; if (ec->adaption_mode & ECHO_CAN_USE_TX_HPF) { tmp = tx << 15; diff --git a/drivers/staging/echo/echo.h b/drivers/staging/echo/echo.h index 754e66d..32ca9de 100644 --- a/drivers/staging/echo/echo.h +++ b/drivers/staging/echo/echo.h @@ -36,7 +36,6 @@ What does it do? This module aims to provide G.168-2002 compliant echo cancellation, to remove electrical echoes (e.g. from 2-4 wire hybrids) from voice calls. - How does it work? The heart of the echo cancellor is FIR filter. This is adapted to match the @@ -128,7 +127,8 @@ a minor burden. echo canceller. */ struct oslec_state { - int16_t tx, rx; + int16_t tx; + int16_t rx; int16_t clean; int16_t clean_nlp; @@ -145,11 +145,18 @@ struct oslec_state { int16_t shift; /* Average levels and averaging filter states */ - int Ltxacc, Lrxacc, Lcleanacc, Lclean_bgacc; - int Ltx, Lrx; + int Ltxacc; + int Lrxacc; + int Lcleanacc; + int Lclean_bgacc; + int Ltx; + int Lrx; int Lclean; int Lclean_bg; - int Lbgn, Lbgn_acc, Lbgn_upper, Lbgn_upper_acc; + int Lbgn; + int Lbgn_acc; + int Lbgn_upper; + int Lbgn_upper_acc; /* foreground and background filter states */ struct fir16_state_t fir_state; @@ -157,11 +164,16 @@ struct oslec_state { int16_t *fir_taps16[2]; /* DC blocking filter states */ - int tx_1, tx_2, rx_1, rx_2; + int tx_1; + int tx_2; + int rx_1; + int rx_2; /* optional High Pass Filter states */ - int32_t xvtx[5], yvtx[5]; - int32_t xvrx[5], yvrx[5]; + int32_t xvtx[5]; + int32_t yvtx[5]; + int32_t xvrx[5]; + int32_t yvrx[5]; /* Parameters for the optional Hoth noise generator */ int cng_level; -- cgit v0.10.2 From 7813296d2259dd5056278bcf8b2fdeaaf8499f1f Mon Sep 17 00:00:00 2001 From: "Javier M. Mellid" Date: Wed, 27 Jun 2012 14:10:14 +0200 Subject: staging: sm7xxfb: rename vars holding device and revision ids This patch fixes CamelCase var names in smtcfb_info holding device and revision identifiers. Tested with SM712. Signed-off-by: Javier M. Mellid Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index 16d2b5e..c603e8c 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -42,8 +42,9 @@ struct screen_info smtc_screen_info; struct smtcfb_info { struct fb_info fb; struct pci_dev *pdev; + u16 chip_id; + u8 chip_rev_id; - u16 chipID; unsigned char __iomem *m_pMMIO; char __iomem *m_pLFB; char *m_pDPR; @@ -53,8 +54,6 @@ struct smtcfb_info { u_int width; u_int height; u_int hz; - - u8 chipRevID; }; struct vesa_mode_table { @@ -231,7 +230,7 @@ static void sm712_setpalette(int regno, unsigned red, unsigned green, static void smtc_set_timing(struct smtcfb_info *sfb) { - switch (sfb->chipID) { + switch (sfb->chip_id) { case 0x710: case 0x712: case 0x720: @@ -812,8 +811,8 @@ static int __devinit smtcfb_pci_probe(struct pci_dev *pdev, if (!sfb) goto failed_free; - sfb->chipID = ent->device; - sprintf(name, "sm%Xfb", sfb->chipID); + sfb->chip_id = ent->device; + sprintf(name, "sm%Xfb", sfb->chip_id); pci_set_drvdata(pdev, sfb); @@ -837,9 +836,9 @@ static int __devinit smtcfb_pci_probe(struct pci_dev *pdev, #endif /* Map address and memory detection */ pFramebufferPhysical = pci_resource_start(pdev, 0); - pci_read_config_byte(pdev, PCI_REVISION_ID, &sfb->chipRevID); + pci_read_config_byte(pdev, PCI_REVISION_ID, &sfb->chip_rev_id); - switch (sfb->chipID) { + switch (sfb->chip_id) { case 0x710: case 0x712: sfb->fb.fix.mmio_start = pFramebufferPhysical + 0x00400000; @@ -925,7 +924,7 @@ static int __devinit smtcfb_pci_probe(struct pci_dev *pdev, dev_info(&pdev->dev, "Silicon Motion SM%X Rev%X primary display mode %dx%d-%d Init Complete.", - sfb->chipID, sfb->chipRevID, sfb->fb.var.xres, + sfb->chip_id, sfb->chip_rev_id, sfb->fb.var.xres, sfb->fb.var.yres, sfb->fb.var.bits_per_pixel); return 0; @@ -1001,7 +1000,7 @@ static int smtcfb_pci_resume(struct device *device) /* reinit hardware */ sm7xx_init_hw(); - switch (sfb->chipID) { + switch (sfb->chip_id) { case 0x710: case 0x712: /* set MCLK = 14.31818 * (0x16 / 0x2) */ -- cgit v0.10.2 From 501b02e4d6a3c29ce4e7cef9a5a1a21f236c3c63 Mon Sep 17 00:00:00 2001 From: "Javier M. Mellid" Date: Wed, 27 Jun 2012 14:10:15 +0200 Subject: staging: sm7xxfb: erase hardcode cast between smtcfb_info and fb_info This patch erases hardcode cast between smtcfb_info and fb_info in order to get a more robust and less rigid smtcfb_info structure. fb_info doesn't need to be the first field in smtcfb_info after this patch. Tested with SM712. Signed-off-by: Javier M. Mellid Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index c603e8c..e3511ec 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -40,8 +40,8 @@ struct screen_info smtc_screen_info; * Private structure */ struct smtcfb_info { - struct fb_info fb; struct pci_dev *pdev; + struct fb_info fb; u16 chip_id; u8 chip_rev_id; @@ -328,9 +328,11 @@ static int smtc_blank(int blank_mode, struct fb_info *info) static int smtc_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned trans, struct fb_info *info) { - struct smtcfb_info *sfb = (struct smtcfb_info *)info; + struct smtcfb_info *sfb; u32 val; + sfb = info->par; + if (regno > 255) return 1; @@ -623,9 +625,7 @@ static int smtc_check_var(struct fb_var_screeninfo *var, struct fb_info *info) static int smtc_set_par(struct fb_info *info) { - struct smtcfb_info *sfb = (struct smtcfb_info *)info; - - smtcfb_setmode(sfb); + smtcfb_setmode(info->par); return 0; } -- cgit v0.10.2 From fec3c80da1abfb4c66ba0adf77f3c7a97a8162da Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Wed, 27 Jun 2012 22:00:14 +0200 Subject: staging: vt6656: int: Redundant blank line removal This trivial cleanup patch removes some completely redundant blank lines from drivers/staging/vt6656/int.[ch] Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c index 0a11423..36ed234 100644 --- a/drivers/staging/vt6656/int.c +++ b/drivers/staging/vt6656/int.c @@ -44,7 +44,6 @@ /* static int msglevel = MSG_LEVEL_DEBUG; */ static int msglevel = MSG_LEVEL_INFO; - /*--------------------- Static Classes ----------------------------*/ /*--------------------- Static Variables --------------------------*/ @@ -53,10 +52,8 @@ static int msglevel = MSG_LEVEL_INFO; /*--------------------- Export Variables --------------------------*/ - /*--------------------- Export Functions --------------------------*/ - /*+ * * Function: InterruptPollingThread @@ -202,7 +199,6 @@ void INTnsProcessData(PSDevice pDevice) pINTData->byISR0, pINTData->byISR1); } - if (pINTData->byISR1 != 0) if (pINTData->byISR1 & ISR_GPIO3) bScheduleCommand((void *) pDevice, diff --git a/drivers/staging/vt6656/int.h b/drivers/staging/vt6656/int.h index a5d96b9..3098630 100644 --- a/drivers/staging/vt6656/int.h +++ b/drivers/staging/vt6656/int.h @@ -60,7 +60,6 @@ typedef struct tagSINTData { } __attribute__ ((__packed__)) SINTData, *PSINTData; - /*--------------------- Export Classes ----------------------------*/ /*--------------------- Export Variables --------------------------*/ -- cgit v0.10.2 From c6058cb3c7f1e2204aca958a0f91473b2cd14684 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Wed, 27 Jun 2012 22:00:41 +0200 Subject: staging: vt6656: int.h: Fix indentation and spacing We use tabs for indentation and once space between variable types and variable name. Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/int.h b/drivers/staging/vt6656/int.h index 3098630..3734e2c 100644 --- a/drivers/staging/vt6656/int.h +++ b/drivers/staging/vt6656/int.h @@ -36,27 +36,27 @@ /*--------------------- Export Definitions -------------------------*/ #pragma pack(1) typedef struct tagSINTData { - BYTE byTSR0; - BYTE byPkt0; - WORD wTime0; - BYTE byTSR1; - BYTE byPkt1; - WORD wTime1; - BYTE byTSR2; - BYTE byPkt2; - WORD wTime2; - BYTE byTSR3; - BYTE byPkt3; - WORD wTime3; - DWORD dwLoTSF; - DWORD dwHiTSF; - BYTE byISR0; - BYTE byISR1; - BYTE byRTSSuccess; - BYTE byRTSFail; - BYTE byACKFail; - BYTE byFCSErr; - BYTE abySW[2]; + BYTE byTSR0; + BYTE byPkt0; + WORD wTime0; + BYTE byTSR1; + BYTE byPkt1; + WORD wTime1; + BYTE byTSR2; + BYTE byPkt2; + WORD wTime2; + BYTE byTSR3; + BYTE byPkt3; + WORD wTime3; + DWORD dwLoTSF; + DWORD dwHiTSF; + BYTE byISR0; + BYTE byISR1; + BYTE byRTSSuccess; + BYTE byRTSFail; + BYTE byACKFail; + BYTE byFCSErr; + BYTE abySW[2]; } __attribute__ ((__packed__)) SINTData, *PSINTData; -- cgit v0.10.2 From ea15b7b219b19c9ddb668ab3d5d727f46900605e Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Wed, 27 Jun 2012 22:01:18 +0200 Subject: staging: vt6656: int.c: Put comment about DEBUG print define on same line as code A small comment at the end of the line, mentioning the debug level, is enough - no need to repeat the entire line of code just for that. Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c index 36ed234..286ac3e 100644 --- a/drivers/staging/vt6656/int.c +++ b/drivers/staging/vt6656/int.c @@ -41,8 +41,7 @@ #include "usbpipe.h" /*--------------------- Static Definitions -------------------------*/ -/* static int msglevel = MSG_LEVEL_DEBUG; */ -static int msglevel = MSG_LEVEL_INFO; +static int msglevel = MSG_LEVEL_INFO; /* MSG_LEVEL_DEBUG */ /*--------------------- Static Classes ----------------------------*/ -- cgit v0.10.2 From 92fa8971f31b25e041a74a1913bca8f7f3d6e48d Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Wed, 27 Jun 2012 22:01:47 +0200 Subject: staging: vt6656: int.c: Remove unneeded cast When assigning a void* to a variable , the value is cast implicitly - there's no need for explicit cast. Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c index 286ac3e..e7f6624 100644 --- a/drivers/staging/vt6656/int.c +++ b/drivers/staging/vt6656/int.c @@ -77,7 +77,7 @@ static int msglevel = MSG_LEVEL_INFO; /* MSG_LEVEL_DEBUG */ -*/ void INTvWorkItem(void *Context) { - PSDevice pDevice = (PSDevice) Context; + PSDevice pDevice = Context; int ntStatus; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Interrupt Polling Thread\n"); -- cgit v0.10.2 From 0d12698671e6d6e39804cdadc6e65a40e5d0f491 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Wed, 27 Jun 2012 22:02:19 +0200 Subject: staging: vt6656: int.c: Use one space between variable type and name The style of most kernel code is that there is 1 *space* between the type of a variable and its name. This patch enforces that in drivers/staging/vt6656/int.c . Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c index e7f6624..40605c8 100644 --- a/drivers/staging/vt6656/int.c +++ b/drivers/staging/vt6656/int.c @@ -90,8 +90,8 @@ void INTvWorkItem(void *Context) void INTnsProcessData(PSDevice pDevice) { - PSINTData pINTData; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSINTData pINTData; + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); struct net_device_stats *pStats = &pDevice->stats; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsInterruptProcessData\n"); -- cgit v0.10.2 From 7b4cabb658fdf9171ecea4e10fb14ee76d14cb37 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Wed, 27 Jun 2012 22:02:48 +0200 Subject: staging: vt6656: int.c: We don't use spaces between a cast and the variable being converted Remove spaces between casts and variables from drivers/staging/vt6656/int.c . Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c index 40605c8..e9fab45 100644 --- a/drivers/staging/vt6656/int.c +++ b/drivers/staging/vt6656/int.c @@ -99,8 +99,8 @@ void INTnsProcessData(PSDevice pDevice) pINTData = (PSINTData) pDevice->intBuf.pDataBuf; if (pINTData->byTSR0 & TSR_VALID) { STAvUpdateTDStatCounter(&(pDevice->scStatistic), - (BYTE) (pINTData->byPkt0 & 0x0F), - (BYTE) (pINTData->byPkt0>>4), + (BYTE)(pINTData->byPkt0 & 0x0F), + (BYTE)(pINTData->byPkt0>>4), pINTData->byTSR0); BSSvUpdateNodeTxCounter(pDevice, &(pDevice->scStatistic), @@ -110,8 +110,8 @@ void INTnsProcessData(PSDevice pDevice) } if (pINTData->byTSR1 & TSR_VALID) { STAvUpdateTDStatCounter(&(pDevice->scStatistic), - (BYTE) (pINTData->byPkt1 & 0x0F), - (BYTE) (pINTData->byPkt1>>4), + (BYTE)(pINTData->byPkt1 & 0x0F), + (BYTE)(pINTData->byPkt1>>4), pINTData->byTSR1); BSSvUpdateNodeTxCounter(pDevice, &(pDevice->scStatistic), @@ -121,8 +121,8 @@ void INTnsProcessData(PSDevice pDevice) } if (pINTData->byTSR2 & TSR_VALID) { STAvUpdateTDStatCounter(&(pDevice->scStatistic), - (BYTE) (pINTData->byPkt2 & 0x0F), - (BYTE) (pINTData->byPkt2>>4), + (BYTE)(pINTData->byPkt2 & 0x0F), + (BYTE)(pINTData->byPkt2>>4), pINTData->byTSR2); BSSvUpdateNodeTxCounter(pDevice, &(pDevice->scStatistic), @@ -132,8 +132,8 @@ void INTnsProcessData(PSDevice pDevice) } if (pINTData->byTSR3 & TSR_VALID) { STAvUpdateTDStatCounter(&(pDevice->scStatistic), - (BYTE) (pINTData->byPkt3 & 0x0F), - (BYTE) (pINTData->byPkt3>>4), + (BYTE)(pINTData->byPkt3 & 0x0F), + (BYTE)(pINTData->byPkt3>>4), pINTData->byTSR3); BSSvUpdateNodeTxCounter(pDevice, &(pDevice->scStatistic), -- cgit v0.10.2 From ce3eaedfc0df2f115051b19d303e4c7ff1e0aaaa Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Wed, 27 Jun 2012 22:03:30 +0200 Subject: staging: vt6656: int.c: correct indentation to use tabs rather than spaces Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c index e9fab45..eba4b50 100644 --- a/drivers/staging/vt6656/int.c +++ b/drivers/staging/vt6656/int.c @@ -182,11 +182,11 @@ void INTnsProcessData(PSDevice pDevice) LODWORD(pDevice->qwCurrTSF) = pINTData->dwLoTSF; HIDWORD(pDevice->qwCurrTSF) = pINTData->dwHiTSF; /*DBG_PRN_GRP01(("ISR0 = %02x , - LoTsf = %08x, - HiTsf = %08x\n", - pINTData->byISR0, - pINTData->dwLoTSF, - pINTData->dwHiTSF)); */ + LoTsf = %08x, + HiTsf = %08x\n", + pINTData->byISR0, + pINTData->dwLoTSF, + pINTData->dwHiTSF)); */ STAvUpdate802_11Counter(&pDevice->s802_11Counter, &pDevice->scStatistic, @@ -208,8 +208,8 @@ void INTnsProcessData(PSDevice pDevice) pStats->tx_packets = pDevice->scStatistic.ullTsrOK; pStats->tx_bytes = pDevice->scStatistic.ullTxDirectedBytes + - pDevice->scStatistic.ullTxMulticastBytes + - pDevice->scStatistic.ullTxBroadcastBytes; + pDevice->scStatistic.ullTxMulticastBytes + + pDevice->scStatistic.ullTxBroadcastBytes; pStats->tx_errors = pDevice->scStatistic.dwTsrErr; pStats->tx_dropped = pDevice->scStatistic.dwTsrErr; } -- cgit v0.10.2 From 50836770601d3cc8408367de34fa5ece23e7e9b8 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Wed, 27 Jun 2012 15:11:38 -0500 Subject: staging: drm/omap: update TODO Update TODO file, which had been neglected. Signed-off-by: Rob Clark Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/omapdrm/TODO b/drivers/staging/omapdrm/TODO index 55b1837..938c788 100644 --- a/drivers/staging/omapdrm/TODO +++ b/drivers/staging/omapdrm/TODO @@ -1,9 +1,7 @@ TODO -. check error handling/cleanup paths -. add drm_plane / overlay support . add video decode/encode support (via syslink3 + codec-engine) -. still some rough edges with flipping.. event back to userspace should - really come after VSYNC interrupt + . NOTE: with dmabuf this probably could be split into different driver + so perhaps this TODO doesn't belong here . where should we do eviction (detatch_pages())? We aren't necessarily accessing the pages via a GART, so maybe we need some other threshold to put a cap on the # of pages that can be pin'd. (It is mostly only @@ -27,7 +25,6 @@ TODO CRTC's should be disabled, and on resume the LUT should be reprogrammed before CRTC's are re-enabled, to prevent DSS from trying to DMA from a buffer mapped in DMM/TILER before LUT is reloaded. -. Add debugfs information for DMM/TILER Userspace: . git://github.com/robclark/xf86-video-omap.git -- cgit v0.10.2 From 2471c0933988eede8040d58cefd6be4fbef9c057 Mon Sep 17 00:00:00 2001 From: Johannes Thumshirn Date: Wed, 27 Jun 2012 21:25:55 +0200 Subject: staging: line6: changed interface of line6_transmit_parameter() Interface of line6_transmit_parameter() adjusted to clarify internal workings Signed-off-by: Johannes Thumshirn Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c index 4513f78..d861230 100644 --- a/drivers/staging/line6/driver.c +++ b/drivers/staging/line6/driver.c @@ -526,7 +526,7 @@ int line6_send_program(struct usb_line6 *line6, int value) /* Transmit Line6 control parameter. */ -int line6_transmit_parameter(struct usb_line6 *line6, int param, int value) +int line6_transmit_parameter(struct usb_line6 *line6, int param, u8 value) { int retval; unsigned char *buffer; diff --git a/drivers/staging/line6/driver.h b/drivers/staging/line6/driver.h index 117bf99..140ccfe 100644 --- a/drivers/staging/line6/driver.h +++ b/drivers/staging/line6/driver.h @@ -224,7 +224,7 @@ extern void line6_start_timer(struct timer_list *timer, unsigned int msecs, void (*function) (unsigned long), unsigned long data); extern int line6_transmit_parameter(struct usb_line6 *line6, int param, - int value); + u8 value); extern int line6_version_request_async(struct usb_line6 *line6); extern int line6_write_data(struct usb_line6 *line6, int address, void *data, size_t datalen); -- cgit v0.10.2 From 1383ec4dad392a1c316820e9afb27b5fb95a6f57 Mon Sep 17 00:00:00 2001 From: Johannes Thumshirn Date: Wed, 27 Jun 2012 21:25:56 +0200 Subject: staging: line6: Changed some strict_strtouls to kstrtou8 Adjusted strict_strtoul calls to kstrtou8 in order to take the changes of line6_transmit_parameter() into account. Signed-off-by: Johannes Thumshirn Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/line6/variax.c b/drivers/staging/line6/variax.c index d366222..bb99ee4 100644 --- a/drivers/staging/line6/variax.c +++ b/drivers/staging/line6/variax.c @@ -319,10 +319,10 @@ static ssize_t variax_set_volume(struct device *dev, { struct usb_line6_variax *variax = usb_get_intfdata(to_usb_interface(dev)); - unsigned long value; + u8 value; int ret; - ret = strict_strtoul(buf, 10, &value); + ret = kstrtou8(buf, 10, &value); if (ret) return ret; @@ -418,10 +418,10 @@ static ssize_t variax_set_tone(struct device *dev, { struct usb_line6_variax *variax = usb_get_intfdata(to_usb_interface(dev)); - unsigned long value; + u8 value; int ret; - ret = strict_strtoul(buf, 10, &value); + ret = kstrtou8(buf, 10, &value); if (ret) return ret; -- cgit v0.10.2 From 5b9bd2ad5116c735cf8e4fa1689319849086a55e Mon Sep 17 00:00:00 2001 From: Johannes Thumshirn Date: Wed, 27 Jun 2012 21:25:57 +0200 Subject: staging: line6: changed interface of line6_pod_transmit_parameter() Adjusted interface of line6_pod_transmit_parameter() to take changes of line6_transmit_parameter() into account Signed-off-by: Johannes Thumshirn Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/line6/pod.c b/drivers/staging/line6/pod.c index 4dadc57..8667aaf 100644 --- a/drivers/staging/line6/pod.c +++ b/drivers/staging/line6/pod.c @@ -419,7 +419,7 @@ static void pod_send_channel(struct usb_line6_pod *pod, int value) Transmit PODxt Pro control parameter. */ void line6_pod_transmit_parameter(struct usb_line6_pod *pod, int param, - int value) + u8 value) { if (line6_transmit_parameter(&pod->line6, param, value) == 0) pod_store_parameter(pod, param, value); diff --git a/drivers/staging/line6/pod.h b/drivers/staging/line6/pod.h index 18b9d08..47e0d1a 100644 --- a/drivers/staging/line6/pod.h +++ b/drivers/staging/line6/pod.h @@ -200,6 +200,6 @@ extern void line6_pod_midi_postprocess(struct usb_line6_pod *pod, unsigned char *data, int length); extern void line6_pod_process_message(struct usb_line6_pod *pod); extern void line6_pod_transmit_parameter(struct usb_line6_pod *pod, int param, - int value); + u8 value); #endif -- cgit v0.10.2 From 317e188b2d48b7bc8537619b6c01208e1b03001a Mon Sep 17 00:00:00 2001 From: Johannes Thumshirn Date: Wed, 27 Jun 2012 21:25:58 +0200 Subject: staging: line6: adjusted interface of line6_send_program() Adjusted interface of line6_send_program() to clarify internal working Signed-off-by: Johannes Thumshirn Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c index d861230..b8358ca7 100644 --- a/drivers/staging/line6/driver.c +++ b/drivers/staging/line6/driver.c @@ -490,7 +490,7 @@ static void line6_data_received(struct urb *urb) /* Send channel number (i.e., switch to a different sound). */ -int line6_send_program(struct usb_line6 *line6, int value) +int line6_send_program(struct usb_line6 *line6, u8 value) { int retval; unsigned char *buffer; diff --git a/drivers/staging/line6/driver.h b/drivers/staging/line6/driver.h index 140ccfe..a3029eb 100644 --- a/drivers/staging/line6/driver.h +++ b/drivers/staging/line6/driver.h @@ -209,7 +209,7 @@ extern int line6_read_data(struct usb_line6 *line6, int address, void *data, size_t datalen); extern int line6_read_serial_number(struct usb_line6 *line6, int *serial_number); -extern int line6_send_program(struct usb_line6 *line6, int value); +extern int line6_send_program(struct usb_line6 *line6, u8 value); extern int line6_send_raw_message(struct usb_line6 *line6, const char *buffer, int size); extern int line6_send_raw_message_async(struct usb_line6 *line6, -- cgit v0.10.2 From 8d6b7f7c9b3c346f2fef496827c3fbbc2ebef1a9 Mon Sep 17 00:00:00 2001 From: Johannes Thumshirn Date: Wed, 27 Jun 2012 21:25:59 +0200 Subject: staging: line6: changed interface of pod_send_channel() Adjusted interface of pod_send_channel() in order to take changes of line6_send_program() into account. Signed-off-by: Johannes Thumshirn Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/line6/pod.c b/drivers/staging/line6/pod.c index 8667aaf..459f325 100644 --- a/drivers/staging/line6/pod.c +++ b/drivers/staging/line6/pod.c @@ -405,7 +405,7 @@ void line6_pod_midi_postprocess(struct usb_line6_pod *pod, unsigned char *data, /* Send channel number (i.e., switch to a different sound). */ -static void pod_send_channel(struct usb_line6_pod *pod, int value) +static void pod_send_channel(struct usb_line6_pod *pod, u8 value) { line6_invalidate_current(&pod->dumpreq); -- cgit v0.10.2 From 336cab9afa2567fd41d2813d3f0f9249371219cb Mon Sep 17 00:00:00 2001 From: Johannes Thumshirn Date: Wed, 27 Jun 2012 21:26:00 +0200 Subject: staging: line6: control.c eliminate strict_strtoul() in pod_set_param_int() Exchange strict_strtoul() with kstrtou8() and make "value" a u8 instead of a unsigned long. This is also needed for the changed line6_pod_transmit_parameter(). Signed-off-by: Johannes Thumshirn Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/line6/control.c b/drivers/staging/line6/control.c index 67e23b6..f8326f5 100644 --- a/drivers/staging/line6/control.c +++ b/drivers/staging/line6/control.c @@ -55,10 +55,10 @@ static ssize_t pod_set_param_int(struct device *dev, const char *buf, { struct usb_interface *interface = to_usb_interface(dev); struct usb_line6_pod *pod = usb_get_intfdata(interface); - unsigned long value; + u8 value; int retval; - retval = strict_strtoul(buf, 10, &value); + retval = kstrtou8(buf, 10, &value); if (retval) return retval; -- cgit v0.10.2 From 1d0e834d62c6810385c2f0673cf6bd97a59aae68 Mon Sep 17 00:00:00 2001 From: Johannes Thumshirn Date: Wed, 27 Jun 2012 21:26:01 +0200 Subject: staging: line6: Exchanged strict_strtoul with kstrtou8() in pod.c:pod_resolve() Exchanged call to strict_strtoul() with kstrtou8() in pod_resolve(). Signed-off-by: Johannes Thumshirn Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/line6/pod.c b/drivers/staging/line6/pod.c index 459f325..4c81914 100644 --- a/drivers/staging/line6/pod.c +++ b/drivers/staging/line6/pod.c @@ -434,11 +434,11 @@ void line6_pod_transmit_parameter(struct usb_line6_pod *pod, int param, static int pod_resolve(const char *buf, short block0, short block1, unsigned char *location) { - unsigned long value; + u8 value; short block; int ret; - ret = strict_strtoul(buf, 10, &value); + ret = kstrtou8(buf, 10, &value); if (ret) return ret; -- cgit v0.10.2 From a4fb7d53869f848fcef91fc6b571e0e8f6e835ce Mon Sep 17 00:00:00 2001 From: Johannes Thumshirn Date: Wed, 27 Jun 2012 21:26:02 +0200 Subject: staging: line6: Changed strict_strtoul() to kstrtou8() in pod_set_channel() Changed strict_strtoul() to kstrtou() in pod_set_channel() to take changes in pod_send_channel() into account. Signed-off-by: Johannes Thumshirn Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/line6/pod.c b/drivers/staging/line6/pod.c index 4c81914..2a85ec3 100644 --- a/drivers/staging/line6/pod.c +++ b/drivers/staging/line6/pod.c @@ -560,10 +560,10 @@ static ssize_t pod_set_channel(struct device *dev, { struct usb_interface *interface = to_usb_interface(dev); struct usb_line6_pod *pod = usb_get_intfdata(interface); - unsigned long value; + u8 value; int ret; - ret = strict_strtoul(buf, 10, &value); + ret = kstrtou8(buf, 10, &value); if (ret) return ret; -- cgit v0.10.2 From 06501787d843608c83864cc241f4fd464ce385ca Mon Sep 17 00:00:00 2001 From: Johannes Thumshirn Date: Wed, 27 Jun 2012 21:26:03 +0200 Subject: staging: line6: Changed strict_strtoul() to kstrtou8() in pod_set_midi_postprocess() Changed a call to strict_strtoul() into kstrtou8() in pod_set_midi_postprocess(). Signed-off-by: Johannes Thumshirn Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/line6/pod.c b/drivers/staging/line6/pod.c index 2a85ec3..9edd053 100644 --- a/drivers/staging/line6/pod.c +++ b/drivers/staging/line6/pod.c @@ -892,10 +892,10 @@ static ssize_t pod_set_midi_postprocess(struct device *dev, { struct usb_interface *interface = to_usb_interface(dev); struct usb_line6_pod *pod = usb_get_intfdata(interface); - unsigned long value; + u8 value; int ret; - ret = strict_strtoul(buf, 10, &value); + ret = kstrtou8(buf, 10, &value); if (ret) return ret; -- cgit v0.10.2 From 68cacda10dc0fd1e57153055473c4030873bcea1 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Fri, 29 Jun 2012 01:19:22 -0300 Subject: staging: sep: sep_crypto.c: Remove useless function crypto_sep_dump_message The function crypto_sep_dump_message don't have any use in this driver. So remove it. Signed-off-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sep/sep_crypto.c b/drivers/staging/sep/sep_crypto.c index 045493b..4138056 100644 --- a/drivers/staging/sep/sep_crypto.c +++ b/drivers/staging/sep/sep_crypto.c @@ -85,28 +85,6 @@ static void sep_dequeuer(void *data); /* TESTING */ /** - * crypto_sep_dump_message - dump the message that is pending - * @sep: SEP device - * This will only print dump if DEBUG is set; it does - * follow kernel debug print enabling - */ -static void crypto_sep_dump_message(struct sep_device *sep, void *msg) -{ -#if 0 - u32 *p; - u32 *i; - int count; - - p = sep->shared_addr; - i = (u32 *)msg; - for (count = 0; count < 10 * 4; count += 4) - dev_dbg(&sep->pdev->dev, - "[PID%d] Word %d of the message is %x (local)%x\n", - current->pid, count/4, *p++, *i++); -#endif -} - -/** * sep_do_callback * @work: pointer to work_struct * This is what is called by the queue; it is generic so that it @@ -1646,7 +1624,6 @@ static u32 crypto_post_op(struct sep_device *sep) dev_dbg(&ta_ctx->sep_used->pdev->dev, "crypto post_op\n"); dev_dbg(&ta_ctx->sep_used->pdev->dev, "crypto post_op message dump\n"); - crypto_sep_dump_message(ta_ctx->sep_used, ta_ctx->msg); /* first bring msg from shared area to local area */ memcpy(ta_ctx->msg, sep->shared_addr, -- cgit v0.10.2 From 0e7e10fe49213ba4e9dc8a74615b81dd8a57ba2a Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Fri, 29 Jun 2012 01:19:23 -0300 Subject: staging: sep: sep_crypto.c: Remove useless functions sep_dump and sep_dump_sg These two functions only has commented code, so remove it. Signed-off-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sep/sep_crypto.c b/drivers/staging/sep/sep_crypto.c index 4138056..3c06116 100644 --- a/drivers/staging/sep/sep_crypto.c +++ b/drivers/staging/sep/sep_crypto.c @@ -465,55 +465,6 @@ static int partial_overlap(void *src_ptr, void *dst_ptr, u32 nbytes) return 0; } -/* Debug - prints only if DEBUG is defined; follows kernel debug model */ -static void sep_dump(struct sep_device *sep, char *stg, void *start, int len) -{ -#if 0 - int ct1; - u8 *ptt; - - dev_dbg(&sep->pdev->dev, - "Dump of %s starting at %08lx for %08x bytes\n", - stg, (unsigned long)start, len); - for (ct1 = 0; ct1 < len; ct1 += 1) { - ptt = (u8 *)(start + ct1); - dev_dbg(&sep->pdev->dev, "%02x ", *ptt); - if (ct1 % 16 == 15) - dev_dbg(&sep->pdev->dev, "\n"); - } - dev_dbg(&sep->pdev->dev, "\n"); -#endif -} - -/* Debug - prints only if DEBUG is defined; follows kernel debug model */ -static void sep_dump_sg(struct sep_device *sep, char *stg, - struct scatterlist *sg) -{ -#if 0 - int ct1, ct2; - u8 *ptt; - - dev_dbg(&sep->pdev->dev, "Dump of scatterlist %s\n", stg); - - ct1 = 0; - while (sg) { - dev_dbg(&sep->pdev->dev, "page %x\n size %x", ct1, - sg->length); - dev_dbg(&sep->pdev->dev, "phys addr is %lx", - (unsigned long)sg_phys(sg)); - ptt = sg_virt(sg); - for (ct2 = 0; ct2 < sg->length; ct2 += 1) { - dev_dbg(&sep->pdev->dev, "byte %x is %02x\n", - ct2, (unsigned char)*(ptt + ct2)); - } - - ct1 += 1; - sg = sg_next(sg); - } - dev_dbg(&sep->pdev->dev, "\n"); -#endif -} - /* Debug - prints only if DEBUG is defined */ static void sep_dump_ivs(struct ablkcipher_request *req, char *reason) @@ -1216,9 +1167,6 @@ static int sep_crypto_block_data(struct ablkcipher_request *req) /* Key already done; this is for data */ dev_dbg(&ta_ctx->sep_used->pdev->dev, "sending data\n"); - sep_dump_sg(ta_ctx->sep_used, - "block sg in", ta_ctx->src_sg); - /* check for valid data and proper spacing */ src_ptr = sg_virt(ta_ctx->src_sg); dst_ptr = sg_virt(ta_ctx->dst_sg); @@ -1340,14 +1288,10 @@ static int sep_crypto_block_data(struct ablkcipher_request *req) sep_write_context(ta_ctx, &msg_offset, &sctx->des_private_ctx, sizeof(struct sep_des_private_context)); - sep_dump(ta_ctx->sep_used, "ctx to block des", - &sctx->des_private_ctx, 40); } else { sep_write_context(ta_ctx, &msg_offset, &sctx->aes_private_ctx, sizeof(struct sep_aes_private_context)); - sep_dump(ta_ctx->sep_used, "ctx to block aes", - &sctx->aes_private_ctx, 20); } /* conclude message */ @@ -1404,8 +1348,6 @@ static int sep_crypto_send_key(struct ablkcipher_request *req) } memcpy(ta_ctx->iv, ta_ctx->walk.iv, SEP_DES_IV_SIZE_BYTES); - sep_dump(ta_ctx->sep_used, "iv", - ta_ctx->iv, SEP_DES_IV_SIZE_BYTES); } if ((ta_ctx->current_request == AES_CBC) && @@ -1416,8 +1358,6 @@ static int sep_crypto_send_key(struct ablkcipher_request *req) } memcpy(ta_ctx->iv, ta_ctx->walk.iv, SEP_AES_IV_SIZE_BYTES); - sep_dump(ta_ctx->sep_used, "iv", - ta_ctx->iv, SEP_AES_IV_SIZE_BYTES); } /* put together message to SEP */ @@ -1430,8 +1370,6 @@ static int sep_crypto_send_key(struct ablkcipher_request *req) sep_write_msg(ta_ctx, ta_ctx->iv, SEP_DES_IV_SIZE_BYTES, sizeof(u32) * 4, &msg_offset, 1); - sep_dump(ta_ctx->sep_used, "initial IV", - ta_ctx->walk.iv, SEP_DES_IV_SIZE_BYTES); } else { /* Skip if ECB */ msg_offset += 4 * sizeof(u32); @@ -1443,8 +1381,6 @@ static int sep_crypto_send_key(struct ablkcipher_request *req) sep_write_msg(ta_ctx, ta_ctx->iv, SEP_AES_IV_SIZE_BYTES, max_length, &msg_offset, 1); - sep_dump(ta_ctx->sep_used, "initial IV", - ta_ctx->walk.iv, SEP_AES_IV_SIZE_BYTES); } else { /* Skip if ECB */ msg_offset += max_length; @@ -1647,16 +1583,10 @@ static u32 crypto_post_op(struct sep_device *sep) sep_read_context(ta_ctx, &msg_offset, &sctx->des_private_ctx, sizeof(struct sep_des_private_context)); - - sep_dump(ta_ctx->sep_used, "ctx init des", - &sctx->des_private_ctx, 40); } else { sep_read_context(ta_ctx, &msg_offset, &sctx->aes_private_ctx, sizeof(struct sep_aes_private_context)); - - sep_dump(ta_ctx->sep_used, "ctx init aes", - &sctx->aes_private_ctx, 20); } sep_dump_ivs(req, "after sending key to sep\n"); @@ -1735,9 +1665,6 @@ static u32 crypto_post_op(struct sep_device *sep) sizeof(struct sep_aes_private_context)); } - sep_dump_sg(ta_ctx->sep_used, - "block sg out", ta_ctx->dst_sg); - /* Copy to correct sg if this block had oddball pages */ if (ta_ctx->dst_sg_hold) sep_copy_sg(ta_ctx->sep_used, @@ -2251,8 +2178,6 @@ static void sep_hash_update(void *data) src_ptr = NULL; } - sep_dump_sg(ta_ctx->sep_used, "hash block sg in", ta_ctx->src_sg); - ta_ctx->dcb_input_data.app_in_address = src_ptr; ta_ctx->dcb_input_data.data_in_size = req->nbytes - (head_len + tail_len); @@ -2484,8 +2409,6 @@ static void sep_hash_digest(void *data) src_ptr = NULL; } - sep_dump_sg(ta_ctx->sep_used, "hash block sg in", ta_ctx->src_sg); - ta_ctx->dcb_input_data.app_in_address = src_ptr; ta_ctx->dcb_input_data.data_in_size = req->nbytes - tail_len; ta_ctx->dcb_input_data.app_out_address = NULL; -- cgit v0.10.2 From a454ad15e015526ca84f15460bf8a56fccfffeea Mon Sep 17 00:00:00 2001 From: Omar Ramirez Luna Date: Fri, 29 Jun 2012 13:49:17 -0500 Subject: staging: tidspbridge: add pud code And fix the following warning for passing an incorrect variable type. ../tiomap3430.c: In function 'user_va2_pa': ../tiomap3430.c:1555: warning: passing argument 1 of 'pmd_offset' from incompatible pointer type arch/arm/include/asm/pgtable-2level.h:156: note: expected 'struct pud_t *' but argument is of type 'pmdval_t (*)[2]' While at it, eliminate 'if' nesting to increase readability. Signed-off-by: Omar Ramirez Luna Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c b/drivers/staging/tidspbridge/core/tiomap3430.c index 9cf29fc..f9609ce 100644 --- a/drivers/staging/tidspbridge/core/tiomap3430.c +++ b/drivers/staging/tidspbridge/core/tiomap3430.c @@ -1547,20 +1547,27 @@ EXIT_LOOP: static u32 user_va2_pa(struct mm_struct *mm, u32 address) { pgd_t *pgd; + pud_t *pud; pmd_t *pmd; pte_t *ptep, pte; pgd = pgd_offset(mm, address); - if (!(pgd_none(*pgd) || pgd_bad(*pgd))) { - pmd = pmd_offset(pgd, address); - if (!(pmd_none(*pmd) || pmd_bad(*pmd))) { - ptep = pte_offset_map(pmd, address); - if (ptep) { - pte = *ptep; - if (pte_present(pte)) - return pte & PAGE_MASK; - } - } + if (pgd_none(*pgd) || pgd_bad(*pgd)) + return 0; + + pud = pud_offset(pgd, address); + if (pud_none(*pud) || pud_bad(*pud)) + return 0; + + pmd = pmd_offset(pud, address); + if (pmd_none(*pmd) || pmd_bad(*pmd)) + return 0; + + ptep = pte_offset_map(pmd, address); + if (ptep) { + pte = *ptep; + if (pte_present(pte)) + return pte & PAGE_MASK; } return 0; -- cgit v0.10.2 From e8cfe4116de12c1e0b815af0da6187e7b4695eb1 Mon Sep 17 00:00:00 2001 From: Omar Ramirez Luna Date: Fri, 29 Jun 2012 13:49:18 -0500 Subject: staging: tidspbridge: split bridge_io_on_loaded Due to its size, this function declares too many variables, to split it a new structure has been declared to hold values as they are read from the baseimage. While at it, indentation was reduced by renaming variables and reducing blocks of code with the following structure: if (success) { ... if (success) ... } This fixes the following warning: drivers/staging/tidspbridge/core/io_sm.c: In function 'bridge_io_on_loaded': drivers/staging/tidspbridge/core/io_sm.c:777: warning: the frame size of 1032 bytes is larger than 1024 bytes Signed-off-by: Omar Ramirez Luna Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/tidspbridge/core/io_sm.c b/drivers/staging/tidspbridge/core/io_sm.c index c51f651..480a384 100644 --- a/drivers/staging/tidspbridge/core/io_sm.c +++ b/drivers/staging/tidspbridge/core/io_sm.c @@ -128,6 +128,16 @@ struct io_mgr { }; +struct shm_symbol_val { + u32 shm_base; + u32 shm_lim; + u32 msg_base; + u32 msg_lim; + u32 shm0_end; + u32 dyn_ext; + u32 ext_end; +}; + /* Function Prototypes */ static void io_dispatch_pm(struct io_mgr *pio_mgr); static void notify_chnl_complete(struct chnl_object *pchnl, @@ -256,6 +266,75 @@ int bridge_io_destroy(struct io_mgr *hio_mgr) return status; } +struct shm_symbol_val *_get_shm_symbol_values(struct io_mgr *hio_mgr) +{ + struct shm_symbol_val *s; + struct cod_manager *cod_man; + int status; + + s = kzalloc(sizeof(*s), GFP_KERNEL); + if (!s) + return ERR_PTR(-ENOMEM); + + status = dev_get_cod_mgr(hio_mgr->dev_obj, &cod_man); + if (status) + goto free_symbol; + + /* Get start and length of channel part of shared memory */ + status = cod_get_sym_value(cod_man, CHNL_SHARED_BUFFER_BASE_SYM, + &s->shm_base); + if (status) + goto free_symbol; + + status = cod_get_sym_value(cod_man, CHNL_SHARED_BUFFER_LIMIT_SYM, + &s->shm_lim); + if (status) + goto free_symbol; + + if (s->shm_lim <= s->shm_base) { + status = -EINVAL; + goto free_symbol; + } + + /* Get start and length of message part of shared memory */ + status = cod_get_sym_value(cod_man, MSG_SHARED_BUFFER_BASE_SYM, + &s->msg_base); + if (status) + goto free_symbol; + + status = cod_get_sym_value(cod_man, MSG_SHARED_BUFFER_LIMIT_SYM, + &s->msg_lim); + if (status) + goto free_symbol; + + if (s->msg_lim <= s->msg_base) { + status = -EINVAL; + goto free_symbol; + } + +#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE + status = cod_get_sym_value(cod_man, DSP_TRACESEC_END, &s->shm0_end); +#else + status = cod_get_sym_value(cod_man, SHM0_SHARED_END_SYM, &s->shm0_end); +#endif + if (status) + goto free_symbol; + + status = cod_get_sym_value(cod_man, DYNEXTBASE, &s->dyn_ext); + if (status) + goto free_symbol; + + status = cod_get_sym_value(cod_man, EXTEND, &s->ext_end); + if (status) + goto free_symbol; + + return s; + +free_symbol: + kfree(s); + return ERR_PTR(status); +} + /* * ======== bridge_io_on_loaded ======== * Purpose: @@ -265,193 +344,112 @@ int bridge_io_destroy(struct io_mgr *hio_mgr) */ int bridge_io_on_loaded(struct io_mgr *hio_mgr) { + struct bridge_dev_context *dc = hio_mgr->bridge_context; + struct cfg_hostres *cfg_res = dc->resources; + struct bridge_ioctl_extproc *eproc; struct cod_manager *cod_man; struct chnl_mgr *hchnl_mgr; struct msg_mgr *hmsg_mgr; - u32 ul_shm_base; - u32 ul_shm_base_offset; - u32 ul_shm_limit; - u32 ul_shm_length = -1; - u32 ul_mem_length = -1; - u32 ul_msg_base; - u32 ul_msg_limit; - u32 ul_msg_length = -1; - u32 ul_ext_end; - u32 ul_gpp_pa = 0; - u32 ul_gpp_va = 0; - u32 ul_dsp_va = 0; - u32 ul_seg_size = 0; - u32 ul_pad_size = 0; + struct shm_symbol_val *s; + int status; + u8 num_procs; + s32 ndx; u32 i; - int status = 0; - u8 num_procs = 0; - s32 ndx = 0; - /* DSP MMU setup table */ - struct bridge_ioctl_extproc ae_proc[BRDIOCTL_NUMOFMMUTLB]; - struct cfg_hostres *host_res; - struct bridge_dev_context *pbridge_context; - u32 map_attrs; - u32 shm0_end; - u32 ul_dyn_ext_base; - u32 ul_seg1_size = 0; - u32 pa_curr = 0; - u32 va_curr = 0; - u32 gpp_va_curr = 0; - u32 num_bytes = 0; + u32 mem_sz, msg_sz, pad_sz, shm_sz, shm_base_offs; + u32 seg0_sz, seg1_sz; + u32 pa, va, da; + u32 pa_curr, va_curr, da_curr; + u32 bytes; u32 all_bits = 0; - u32 page_size[] = { HW_PAGE_SIZE16MB, HW_PAGE_SIZE1MB, + u32 page_size[] = { + HW_PAGE_SIZE16MB, HW_PAGE_SIZE1MB, HW_PAGE_SIZE64KB, HW_PAGE_SIZE4KB }; + u32 map_attrs = DSP_MAPLITTLEENDIAN | DSP_MAPPHYSICALADDR | + DSP_MAPELEMSIZE32 | DSP_MAPDONOTLOCK; - status = dev_get_bridge_context(hio_mgr->dev_obj, &pbridge_context); - if (!pbridge_context) { - status = -EFAULT; - goto func_end; - } - - host_res = pbridge_context->resources; - if (!host_res) { - status = -EFAULT; - goto func_end; - } status = dev_get_cod_mgr(hio_mgr->dev_obj, &cod_man); - if (!cod_man) { - status = -EFAULT; - goto func_end; - } + if (status) + return status; + hchnl_mgr = hio_mgr->chnl_mgr; - /* The message manager is destroyed when the board is stopped. */ + + /* The message manager is destroyed when the board is stopped */ dev_get_msg_mgr(hio_mgr->dev_obj, &hio_mgr->msg_mgr); hmsg_mgr = hio_mgr->msg_mgr; - if (!hchnl_mgr || !hmsg_mgr) { - status = -EFAULT; - goto func_end; - } + if (!hchnl_mgr || !hmsg_mgr) + return -EFAULT; + if (hio_mgr->shared_mem) hio_mgr->shared_mem = NULL; - /* Get start and length of channel part of shared memory */ - status = cod_get_sym_value(cod_man, CHNL_SHARED_BUFFER_BASE_SYM, - &ul_shm_base); - if (status) { - status = -EFAULT; - goto func_end; - } - status = cod_get_sym_value(cod_man, CHNL_SHARED_BUFFER_LIMIT_SYM, - &ul_shm_limit); - if (status) { - status = -EFAULT; - goto func_end; - } - if (ul_shm_limit <= ul_shm_base) { - status = -EINVAL; - goto func_end; - } + s = _get_shm_symbol_values(hio_mgr); + if (IS_ERR(s)) + return PTR_ERR(s); + /* Get total length in bytes */ - ul_shm_length = (ul_shm_limit - ul_shm_base + 1) * hio_mgr->word_size; + shm_sz = (s->shm_lim - s->shm_base + 1) * hio_mgr->word_size; + /* Calculate size of a PROCCOPY shared memory region */ dev_dbg(bridge, "%s: (proc)proccopy shmmem size: 0x%x bytes\n", - __func__, (ul_shm_length - sizeof(struct shm))); + __func__, shm_sz - sizeof(struct shm)); - /* Get start and length of message part of shared memory */ - status = cod_get_sym_value(cod_man, MSG_SHARED_BUFFER_BASE_SYM, - &ul_msg_base); - if (!status) { - status = cod_get_sym_value(cod_man, MSG_SHARED_BUFFER_LIMIT_SYM, - &ul_msg_limit); - if (!status) { - if (ul_msg_limit <= ul_msg_base) { - status = -EINVAL; - } else { - /* - * Length (bytes) of messaging part of shared - * memory. - */ - ul_msg_length = - (ul_msg_limit - ul_msg_base + - 1) * hio_mgr->word_size; - /* - * Total length (bytes) of shared memory: - * chnl + msg. - */ - ul_mem_length = ul_shm_length + ul_msg_length; - } - } else { - status = -EFAULT; - } - } else { - status = -EFAULT; - } - if (!status) { -#if defined(CONFIG_TIDSPBRIDGE_BACKTRACE) - status = - cod_get_sym_value(cod_man, DSP_TRACESEC_END, &shm0_end); -#else - status = cod_get_sym_value(cod_man, SHM0_SHARED_END_SYM, - &shm0_end); -#endif - if (status) - status = -EFAULT; - } - if (!status) { - status = - cod_get_sym_value(cod_man, DYNEXTBASE, &ul_dyn_ext_base); - if (status) - status = -EFAULT; - } - if (!status) { - status = cod_get_sym_value(cod_man, EXTEND, &ul_ext_end); - if (status) - status = -EFAULT; + /* Length (bytes) of messaging part of shared memory */ + msg_sz = (s->msg_lim - s->msg_base + 1) * hio_mgr->word_size; + + /* Total length (bytes) of shared memory: chnl + msg */ + mem_sz = shm_sz + msg_sz; + + /* Get memory reserved in host resources */ + (void)mgr_enum_processor_info(0, + (struct dsp_processorinfo *) + &hio_mgr->ext_proc_info, + sizeof(struct mgr_processorextinfo), + &num_procs); + + /* IO supports only one DSP for now */ + if (num_procs != 1) { + status = -EINVAL; + goto free_symbol; } - if (!status) { - /* Get memory reserved in host resources */ - (void)mgr_enum_processor_info(0, (struct dsp_processorinfo *) - &hio_mgr->ext_proc_info, - sizeof(struct - mgr_processorextinfo), - &num_procs); - - /* The first MMU TLB entry(TLB_0) in DCD is ShmBase. */ - ndx = 0; - ul_gpp_pa = host_res->mem_phys[1]; - ul_gpp_va = host_res->mem_base[1]; - /* This is the virtual uncached ioremapped address!!! */ - /* Why can't we directly take the DSPVA from the symbols? */ - ul_dsp_va = hio_mgr->ext_proc_info.ty_tlb[0].dsp_virt; - ul_seg_size = (shm0_end - ul_dsp_va) * hio_mgr->word_size; - ul_seg1_size = - (ul_ext_end - ul_dyn_ext_base) * hio_mgr->word_size; - /* 4K align */ - ul_seg1_size = (ul_seg1_size + 0xFFF) & (~0xFFFUL); - /* 64K align */ - ul_seg_size = (ul_seg_size + 0xFFFF) & (~0xFFFFUL); - ul_pad_size = UL_PAGE_ALIGN_SIZE - ((ul_gpp_pa + ul_seg1_size) % - UL_PAGE_ALIGN_SIZE); - if (ul_pad_size == UL_PAGE_ALIGN_SIZE) - ul_pad_size = 0x0; - - dev_dbg(bridge, "%s: ul_gpp_pa %x, ul_gpp_va %x, ul_dsp_va %x, " - "shm0_end %x, ul_dyn_ext_base %x, ul_ext_end %x, " - "ul_seg_size %x ul_seg1_size %x \n", __func__, - ul_gpp_pa, ul_gpp_va, ul_dsp_va, shm0_end, - ul_dyn_ext_base, ul_ext_end, ul_seg_size, ul_seg1_size); - - if ((ul_seg_size + ul_seg1_size + ul_pad_size) > - host_res->mem_length[1]) { - pr_err("%s: shm Error, reserved 0x%x required 0x%x\n", - __func__, host_res->mem_length[1], - ul_seg_size + ul_seg1_size + ul_pad_size); - status = -ENOMEM; - } + + /* The first MMU TLB entry(TLB_0) in DCD is ShmBase */ + pa = cfg_res->mem_phys[1]; + va = cfg_res->mem_base[1]; + + /* This is the virtual uncached ioremapped address!!! */ + /* Why can't we directly take the DSPVA from the symbols? */ + da = hio_mgr->ext_proc_info.ty_tlb[0].dsp_virt; + seg0_sz = (s->shm0_end - da) * hio_mgr->word_size; + seg1_sz = (s->ext_end - s->dyn_ext) * hio_mgr->word_size; + + /* 4K align */ + seg1_sz = (seg1_sz + 0xFFF) & (~0xFFFUL); + + /* 64K align */ + seg0_sz = (seg0_sz + 0xFFFF) & (~0xFFFFUL); + + pad_sz = UL_PAGE_ALIGN_SIZE - ((pa + seg1_sz) % UL_PAGE_ALIGN_SIZE); + if (pad_sz == UL_PAGE_ALIGN_SIZE) + pad_sz = 0x0; + + dev_dbg(bridge, "%s: pa %x, va %x, da %x\n", __func__, pa, va, da); + dev_dbg(bridge, + "shm0_end %x, dyn_ext %x, ext_end %x, seg0_sz %x seg1_sz %x\n", + s->shm0_end, s->dyn_ext, s->ext_end, seg0_sz, seg1_sz); + + if ((seg0_sz + seg1_sz + pad_sz) > cfg_res->mem_length[1]) { + pr_err("%s: shm Error, reserved 0x%x required 0x%x\n", + __func__, cfg_res->mem_length[1], + seg0_sz + seg1_sz + pad_sz); + status = -ENOMEM; + goto free_symbol; } - if (status) - goto func_end; - pa_curr = ul_gpp_pa; - va_curr = ul_dyn_ext_base * hio_mgr->word_size; - gpp_va_curr = ul_gpp_va; - num_bytes = ul_seg1_size; + pa_curr = pa; + va_curr = s->dyn_ext * hio_mgr->word_size; + da_curr = va; + bytes = seg1_sz; /* * Try to fit into TLB entries. If not possible, push them to page @@ -459,37 +457,30 @@ int bridge_io_on_loaded(struct io_mgr *hio_mgr) * bigger page boundary, we may end up making several small pages. * So, push them onto page tables, if that is the case. */ - map_attrs = 0x00000000; - map_attrs = DSP_MAPLITTLEENDIAN; - map_attrs |= DSP_MAPPHYSICALADDR; - map_attrs |= DSP_MAPELEMSIZE32; - map_attrs |= DSP_MAPDONOTLOCK; - - while (num_bytes) { + while (bytes) { /* * To find the max. page size with which both PA & VA are * aligned. */ all_bits = pa_curr | va_curr; - dev_dbg(bridge, "all_bits %x, pa_curr %x, va_curr %x, " - "num_bytes %x\n", all_bits, pa_curr, va_curr, - num_bytes); + dev_dbg(bridge, + "seg all_bits %x, pa_curr %x, va_curr %x, bytes %x\n", + all_bits, pa_curr, va_curr, bytes); + for (i = 0; i < 4; i++) { - if ((num_bytes >= page_size[i]) && ((all_bits & - (page_size[i] - - 1)) == 0)) { - status = - hio_mgr->intf_fxns-> - brd_mem_map(hio_mgr->bridge_context, - pa_curr, va_curr, - page_size[i], map_attrs, - NULL); + if ((bytes >= page_size[i]) && + ((all_bits & (page_size[i] - 1)) == 0)) { + status = hio_mgr->intf_fxns->brd_mem_map(dc, + pa_curr, va_curr, + page_size[i], map_attrs, + NULL); if (status) - goto func_end; + goto free_symbol; + pa_curr += page_size[i]; va_curr += page_size[i]; - gpp_va_curr += page_size[i]; - num_bytes -= page_size[i]; + da_curr += page_size[i]; + bytes -= page_size[i]; /* * Don't try smaller sizes. Hopefully we have * reached an address aligned to a bigger page @@ -499,71 +490,75 @@ int bridge_io_on_loaded(struct io_mgr *hio_mgr) } } } - pa_curr += ul_pad_size; - va_curr += ul_pad_size; - gpp_va_curr += ul_pad_size; + pa_curr += pad_sz; + va_curr += pad_sz; + da_curr += pad_sz; + bytes = seg0_sz; + va_curr = da * hio_mgr->word_size; + + eproc = kzalloc(sizeof(*eproc) * BRDIOCTL_NUMOFMMUTLB, GFP_KERNEL); + if (!eproc) { + status = -ENOMEM; + goto free_symbol; + } + + ndx = 0; /* Configure the TLB entries for the next cacheable segment */ - num_bytes = ul_seg_size; - va_curr = ul_dsp_va * hio_mgr->word_size; - while (num_bytes) { + while (bytes) { /* * To find the max. page size with which both PA & VA are * aligned. */ all_bits = pa_curr | va_curr; - dev_dbg(bridge, "all_bits for Seg1 %x, pa_curr %x, " - "va_curr %x, num_bytes %x\n", all_bits, pa_curr, - va_curr, num_bytes); + dev_dbg(bridge, + "seg1 all_bits %x, pa_curr %x, va_curr %x, bytes %x\n", + all_bits, pa_curr, va_curr, bytes); + for (i = 0; i < 4; i++) { - if (!(num_bytes >= page_size[i]) || + if (!(bytes >= page_size[i]) || !((all_bits & (page_size[i] - 1)) == 0)) continue; - if (ndx < MAX_LOCK_TLB_ENTRIES) { - /* - * This is the physical address written to - * DSP MMU. - */ - ae_proc[ndx].gpp_pa = pa_curr; - /* - * This is the virtual uncached ioremapped - * address!!! - */ - ae_proc[ndx].gpp_va = gpp_va_curr; - ae_proc[ndx].dsp_va = - va_curr / hio_mgr->word_size; - ae_proc[ndx].size = page_size[i]; - ae_proc[ndx].endianism = HW_LITTLE_ENDIAN; - ae_proc[ndx].elem_size = HW_ELEM_SIZE16BIT; - ae_proc[ndx].mixed_mode = HW_MMU_CPUES; - dev_dbg(bridge, "shm MMU TLB entry PA %x" - " VA %x DSP_VA %x Size %x\n", - ae_proc[ndx].gpp_pa, - ae_proc[ndx].gpp_va, - ae_proc[ndx].dsp_va * - hio_mgr->word_size, page_size[i]); - ndx++; - } else { - status = - hio_mgr->intf_fxns-> - brd_mem_map(hio_mgr->bridge_context, - pa_curr, va_curr, - page_size[i], map_attrs, - NULL); + + if (ndx >= MAX_LOCK_TLB_ENTRIES) { + status = hio_mgr->intf_fxns->brd_mem_map(dc, + pa_curr, va_curr, + page_size[i], map_attrs, + NULL); dev_dbg(bridge, - "shm MMU PTE entry PA %x" - " VA %x DSP_VA %x Size %x\n", - ae_proc[ndx].gpp_pa, - ae_proc[ndx].gpp_va, - ae_proc[ndx].dsp_va * + "PTE pa %x va %x dsp_va %x sz %x\n", + eproc[ndx].gpp_pa, + eproc[ndx].gpp_va, + eproc[ndx].dsp_va * hio_mgr->word_size, page_size[i]); if (status) - goto func_end; + goto free_eproc; } + + /* This is the physical address written to DSP MMU */ + eproc[ndx].gpp_pa = pa_curr; + + /* + * This is the virtual uncached ioremapped + * address!!! + */ + eproc[ndx].gpp_va = da_curr; + eproc[ndx].dsp_va = va_curr / hio_mgr->word_size; + eproc[ndx].size = page_size[i]; + eproc[ndx].endianism = HW_LITTLE_ENDIAN; + eproc[ndx].elem_size = HW_ELEM_SIZE16BIT; + eproc[ndx].mixed_mode = HW_MMU_CPUES; + dev_dbg(bridge, "%s: tlb pa %x va %x dsp_va %x sz %x\n", + __func__, eproc[ndx].gpp_pa, + eproc[ndx].gpp_va, + eproc[ndx].dsp_va * hio_mgr->word_size, + page_size[i]); + ndx++; + pa_curr += page_size[i]; va_curr += page_size[i]; - gpp_va_curr += page_size[i]; - num_bytes -= page_size[i]; + da_curr += page_size[i]; + bytes -= page_size[i]; /* * Don't try smaller sizes. Hopefully we have reached * an address aligned to a bigger page size. @@ -577,146 +572,127 @@ int bridge_io_on_loaded(struct io_mgr *hio_mgr) * should not conflict with shm entries on MPU or DSP side. */ for (i = 3; i < 7 && ndx < BRDIOCTL_NUMOFMMUTLB; i++) { - if (hio_mgr->ext_proc_info.ty_tlb[i].gpp_phys == 0) + struct mgr_processorextinfo *ep = &hio_mgr->ext_proc_info; + u32 word_sz = hio_mgr->word_size; + + if (ep->ty_tlb[i].gpp_phys == 0) continue; - if ((hio_mgr->ext_proc_info.ty_tlb[i].gpp_phys > - ul_gpp_pa - 0x100000 - && hio_mgr->ext_proc_info.ty_tlb[i].gpp_phys <= - ul_gpp_pa + ul_seg_size) - || (hio_mgr->ext_proc_info.ty_tlb[i].dsp_virt > - ul_dsp_va - 0x100000 / hio_mgr->word_size - && hio_mgr->ext_proc_info.ty_tlb[i].dsp_virt <= - ul_dsp_va + ul_seg_size / hio_mgr->word_size)) { + if ((ep->ty_tlb[i].gpp_phys > pa - 0x100000 && + ep->ty_tlb[i].gpp_phys <= pa + seg0_sz) || + (ep->ty_tlb[i].dsp_virt > da - 0x100000 / word_sz && + ep->ty_tlb[i].dsp_virt <= da + seg0_sz / word_sz)) { dev_dbg(bridge, - "CDB MMU entry %d conflicts with " - "shm.\n\tCDB: GppPa %x, DspVa %x.\n\tSHM: " - "GppPa %x, DspVa %x, Bytes %x.\n", i, - hio_mgr->ext_proc_info.ty_tlb[i].gpp_phys, - hio_mgr->ext_proc_info.ty_tlb[i].dsp_virt, - ul_gpp_pa, ul_dsp_va, ul_seg_size); + "err cdb%d pa %x da %x shm pa %x da %x sz %x\n", + i, ep->ty_tlb[i].gpp_phys, + ep->ty_tlb[i].dsp_virt, pa, da, seg0_sz); status = -EPERM; - } else { - if (ndx < MAX_LOCK_TLB_ENTRIES) { - ae_proc[ndx].dsp_va = - hio_mgr->ext_proc_info.ty_tlb[i]. - dsp_virt; - ae_proc[ndx].gpp_pa = - hio_mgr->ext_proc_info.ty_tlb[i]. - gpp_phys; - ae_proc[ndx].gpp_va = 0; - /* 1 MB */ - ae_proc[ndx].size = 0x100000; - dev_dbg(bridge, "shm MMU entry PA %x " - "DSP_VA 0x%x\n", ae_proc[ndx].gpp_pa, - ae_proc[ndx].dsp_va); - ndx++; - } else { - status = hio_mgr->intf_fxns->brd_mem_map - (hio_mgr->bridge_context, - hio_mgr->ext_proc_info.ty_tlb[i]. - gpp_phys, - hio_mgr->ext_proc_info.ty_tlb[i]. - dsp_virt, 0x100000, map_attrs, - NULL); - } + goto free_eproc; + } + + if (ndx >= MAX_LOCK_TLB_ENTRIES) { + status = hio_mgr->intf_fxns->brd_mem_map(dc, + ep->ty_tlb[i].gpp_phys, + ep->ty_tlb[i].dsp_virt, + 0x100000, map_attrs, NULL); + if (status) + goto free_eproc; } - if (status) - goto func_end; - } - map_attrs = 0x00000000; - map_attrs = DSP_MAPLITTLEENDIAN; - map_attrs |= DSP_MAPPHYSICALADDR; - map_attrs |= DSP_MAPELEMSIZE32; - map_attrs |= DSP_MAPDONOTLOCK; + eproc[ndx].dsp_va = ep->ty_tlb[i].dsp_virt; + eproc[ndx].gpp_pa = ep->ty_tlb[i].gpp_phys; + eproc[ndx].gpp_va = 0; + + /* 1 MB */ + eproc[ndx].size = 0x100000; + dev_dbg(bridge, "shm MMU entry pa %x da 0x%x\n", + eproc[ndx].gpp_pa, eproc[ndx].dsp_va); + ndx++; + } /* Map the L4 peripherals */ i = 0; while (l4_peripheral_table[i].phys_addr) { - status = hio_mgr->intf_fxns->brd_mem_map - (hio_mgr->bridge_context, l4_peripheral_table[i].phys_addr, - l4_peripheral_table[i].dsp_virt_addr, HW_PAGE_SIZE4KB, - map_attrs, NULL); + status = hio_mgr->intf_fxns->brd_mem_map(dc, + l4_peripheral_table[i].phys_addr, + l4_peripheral_table[i].dsp_virt_addr, + HW_PAGE_SIZE4KB, map_attrs, NULL); if (status) - goto func_end; + goto free_eproc; i++; } for (i = ndx; i < BRDIOCTL_NUMOFMMUTLB; i++) { - ae_proc[i].dsp_va = 0; - ae_proc[i].gpp_pa = 0; - ae_proc[i].gpp_va = 0; - ae_proc[i].size = 0; + eproc[i].dsp_va = 0; + eproc[i].gpp_pa = 0; + eproc[i].gpp_va = 0; + eproc[i].size = 0; } + /* * Set the shm physical address entry (grayed out in CDB file) * to the virtual uncached ioremapped address of shm reserved * on MPU. */ hio_mgr->ext_proc_info.ty_tlb[0].gpp_phys = - (ul_gpp_va + ul_seg1_size + ul_pad_size); + (va + seg1_sz + pad_sz); /* * Need shm Phys addr. IO supports only one DSP for now: * num_procs = 1. */ - if (!hio_mgr->ext_proc_info.ty_tlb[0].gpp_phys || num_procs != 1) { - status = -EFAULT; - goto func_end; - } else { - if (ae_proc[0].dsp_va > ul_shm_base) { - status = -EPERM; - goto func_end; - } - /* ul_shm_base may not be at ul_dsp_va address */ - ul_shm_base_offset = (ul_shm_base - ae_proc[0].dsp_va) * + if (!hio_mgr->ext_proc_info.ty_tlb[0].gpp_phys) + return -EFAULT; + + if (eproc[0].dsp_va > s->shm_base) + return -EPERM; + + /* shm_base may not be at ul_dsp_va address */ + shm_base_offs = (s->shm_base - eproc[0].dsp_va) * hio_mgr->word_size; - /* - * bridge_dev_ctrl() will set dev context dsp-mmu info. In - * bridge_brd_start() the MMU will be re-programed with MMU - * DSPVa-GPPPa pair info while DSP is in a known - * (reset) state. - */ + /* + * bridge_dev_ctrl() will set dev context dsp-mmu info. In + * bridge_brd_start() the MMU will be re-programed with MMU + * DSPVa-GPPPa pair info while DSP is in a known + * (reset) state. + */ + status = hio_mgr->intf_fxns->dev_cntrl(hio_mgr->bridge_context, + BRDIOCTL_SETMMUCONFIG, eproc); + if (status) + goto free_eproc; - status = - hio_mgr->intf_fxns->dev_cntrl(hio_mgr->bridge_context, - BRDIOCTL_SETMMUCONFIG, - ae_proc); - if (status) - goto func_end; - ul_shm_base = hio_mgr->ext_proc_info.ty_tlb[0].gpp_phys; - ul_shm_base += ul_shm_base_offset; - ul_shm_base = (u32) MEM_LINEAR_ADDRESS((void *)ul_shm_base, - ul_mem_length); - if (ul_shm_base == 0) { - status = -EFAULT; - goto func_end; - } - /* Register SM */ - status = - register_shm_segs(hio_mgr, cod_man, ae_proc[0].gpp_pa); + s->shm_base = hio_mgr->ext_proc_info.ty_tlb[0].gpp_phys; + s->shm_base += shm_base_offs; + s->shm_base = (u32) MEM_LINEAR_ADDRESS((void *)s->shm_base, + mem_sz); + if (!s->shm_base) { + status = -EFAULT; + goto free_eproc; } - hio_mgr->shared_mem = (struct shm *)ul_shm_base; + /* Register SM */ + status = register_shm_segs(hio_mgr, cod_man, eproc[0].gpp_pa); + + hio_mgr->shared_mem = (struct shm *)s->shm_base; hio_mgr->input = (u8 *) hio_mgr->shared_mem + sizeof(struct shm); - hio_mgr->output = hio_mgr->input + (ul_shm_length - + hio_mgr->output = hio_mgr->input + (shm_sz - sizeof(struct shm)) / 2; hio_mgr->sm_buf_size = hio_mgr->output - hio_mgr->input; - /* Set up Shared memory addresses for messaging. */ - hio_mgr->msg_input_ctrl = (struct msg_ctrl *)((u8 *) hio_mgr->shared_mem - + ul_shm_length); + /* Set up Shared memory addresses for messaging */ + hio_mgr->msg_input_ctrl = + (struct msg_ctrl *)((u8 *) hio_mgr->shared_mem + shm_sz); hio_mgr->msg_input = - (u8 *) hio_mgr->msg_input_ctrl + sizeof(struct msg_ctrl); + (u8 *) hio_mgr->msg_input_ctrl + sizeof(struct msg_ctrl); hio_mgr->msg_output_ctrl = - (struct msg_ctrl *)((u8 *) hio_mgr->msg_input_ctrl + - ul_msg_length / 2); + (struct msg_ctrl *)((u8 *) hio_mgr->msg_input_ctrl + + msg_sz / 2); hio_mgr->msg_output = - (u8 *) hio_mgr->msg_output_ctrl + sizeof(struct msg_ctrl); + (u8 *) hio_mgr->msg_output_ctrl + sizeof(struct msg_ctrl); hmsg_mgr->max_msgs = - ((u8 *) hio_mgr->msg_output_ctrl - hio_mgr->msg_input) - / sizeof(struct msg_dspmsg); + ((u8 *) hio_mgr->msg_output_ctrl - hio_mgr->msg_input) / + sizeof(struct msg_dspmsg); + dev_dbg(bridge, "IO MGR shm details: shared_mem %p, input %p, " "output %p, msg_input_ctrl %p, msg_input %p, " "msg_output_ctrl %p, msg_output %p\n", @@ -732,47 +708,53 @@ int bridge_io_on_loaded(struct io_mgr *hio_mgr) /* Get the start address of trace buffer */ status = cod_get_sym_value(cod_man, SYS_PUTCBEG, &hio_mgr->trace_buffer_begin); - if (status) { - status = -EFAULT; - goto func_end; - } + if (status) + goto free_eproc; + + hio_mgr->gpp_read_pointer = + hio_mgr->trace_buffer_begin = + (va + seg1_sz + pad_sz) + + (hio_mgr->trace_buffer_begin - da); - hio_mgr->gpp_read_pointer = hio_mgr->trace_buffer_begin = - (ul_gpp_va + ul_seg1_size + ul_pad_size) + - (hio_mgr->trace_buffer_begin - ul_dsp_va); /* Get the end address of trace buffer */ status = cod_get_sym_value(cod_man, SYS_PUTCEND, &hio_mgr->trace_buffer_end); - if (status) { - status = -EFAULT; - goto func_end; - } + if (status) + goto free_eproc; + hio_mgr->trace_buffer_end = - (ul_gpp_va + ul_seg1_size + ul_pad_size) + - (hio_mgr->trace_buffer_end - ul_dsp_va); + (va + seg1_sz + pad_sz) + + (hio_mgr->trace_buffer_end - da); + /* Get the current address of DSP write pointer */ status = cod_get_sym_value(cod_man, BRIDGE_SYS_PUTC_CURRENT, &hio_mgr->trace_buffer_current); - if (status) { - status = -EFAULT; - goto func_end; - } + if (status) + goto free_eproc; + hio_mgr->trace_buffer_current = - (ul_gpp_va + ul_seg1_size + ul_pad_size) + - (hio_mgr->trace_buffer_current - ul_dsp_va); + (va + seg1_sz + pad_sz) + + (hio_mgr->trace_buffer_current - da); + /* Calculate the size of trace buffer */ kfree(hio_mgr->msg); hio_mgr->msg = kmalloc(((hio_mgr->trace_buffer_end - hio_mgr->trace_buffer_begin) * hio_mgr->word_size) + 2, GFP_KERNEL); - if (!hio_mgr->msg) + if (!hio_mgr->msg) { status = -ENOMEM; + goto free_eproc; + } - hio_mgr->dsp_va = ul_dsp_va; - hio_mgr->gpp_va = (ul_gpp_va + ul_seg1_size + ul_pad_size); - + hio_mgr->dsp_va = da; + hio_mgr->gpp_va = (va + seg1_sz + pad_sz); #endif -func_end: + +free_eproc: + kfree(eproc); +free_symbol: + kfree(s); + return status; } -- cgit v0.10.2 From a2fa68fd769647b114829ba2a198a062cdb1c686 Mon Sep 17 00:00:00 2001 From: Omar Ramirez Luna Date: Fri, 29 Jun 2012 13:49:19 -0500 Subject: staging: tidspbridge: dynamically allocate ibuf in dload_data Dynamically allocate ibuf to silence the following warning: drivers/staging/tidspbridge/dynload/cload.c: In function 'dload_data': drivers/staging/tidspbridge/dynload/cload.c:1337: warning: the frame size of 1216 bytes is larger than 1024 bytes Signed-off-by: Omar Ramirez Luna Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/tidspbridge/dynload/cload.c b/drivers/staging/tidspbridge/dynload/cload.c index fe1ef0a..3a12b43 100644 --- a/drivers/staging/tidspbridge/dynload/cload.c +++ b/drivers/staging/tidspbridge/dynload/cload.c @@ -14,6 +14,8 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ +#include + #include "header.h" #include "module_list.h" @@ -1116,6 +1118,11 @@ static int relocate_packet(struct dload_state *dlthis, /* VERY dangerous */ static const char imagepak[] = { "image packet" }; +struct img_buffer { + struct image_packet_t ipacket; + u8 bufr[BYTE_TO_HOST(IMAGE_PACKET_SIZE)]; +}; + /************************************************************************* * Procedure dload_data * @@ -1131,16 +1138,16 @@ static void dload_data(struct dload_state *dlthis) u16 curr_sect; struct doff_scnhdr_t *sptr = dlthis->sect_hdrs; struct ldr_section_info *lptr = dlthis->ldr_sections; + struct img_buffer *ibuf; u8 *dest; - struct { - struct image_packet_t ipacket; - u8 bufr[BYTE_TO_HOST(IMAGE_PACKET_SIZE)]; - } ibuf; - /* Indicates whether CINIT processing has occurred */ bool cinit_processed = false; + ibuf = kzalloc(sizeof(*ibuf), GFP_KERNEL); + if (!ibuf) + return; + /* Loop through the sections and load them one at a time. */ for (curr_sect = 0; curr_sect < dlthis->dfile_hdr.df_no_scns; @@ -1168,37 +1175,37 @@ static void dload_data(struct dload_state *dlthis) /* get the fixed header bits */ if (dlthis->strm->read_buffer(dlthis->strm, - &ibuf.ipacket, + &ibuf->ipacket, IPH_SIZE) != IPH_SIZE) { DL_ERROR(readstrm, imagepak); - return; + goto free_ibuf; } /* reorder the header if need be */ if (dlthis->reorder_map) { - dload_reorder(&ibuf.ipacket, IPH_SIZE, + dload_reorder(&ibuf->ipacket, IPH_SIZE, dlthis->reorder_map); } /* now read the rest of the packet */ ipsize = BYTE_TO_HOST(DOFF_ALIGN - (ibuf.ipacket.packet_size)); + (ibuf->ipacket.packet_size)); if (ipsize > BYTE_TO_HOST(IMAGE_PACKET_SIZE)) { DL_ERROR("Bad image packet size %d", ipsize); - return; + goto free_ibuf; } - dest = ibuf.bufr; + dest = ibuf->bufr; /* End of determination */ if (dlthis->strm->read_buffer(dlthis->strm, - ibuf.bufr, + ibuf->bufr, ipsize) != ipsize) { DL_ERROR(readstrm, imagepak); - return; + goto free_ibuf; } - ibuf.ipacket.img_data = dest; + ibuf->ipacket.img_data = dest; /* reorder the bytes if need be */ #if !defined(_BIG_ENDIAN) || (TARGET_AU_BITS > 16) @@ -1225,16 +1232,16 @@ static void dload_data(struct dload_state *dlthis) #endif #endif - checks += dload_checksum(&ibuf.ipacket, + checks += dload_checksum(&ibuf->ipacket, IPH_SIZE); /* relocate the image bits as needed */ - if (ibuf.ipacket.num_relocs) { + if (ibuf->ipacket.num_relocs) { dlthis->image_offset = image_offset; if (!relocate_packet(dlthis, - &ibuf.ipacket, + &ibuf->ipacket, &checks, &tramp_generated)) - return; /* serious error */ + goto free_ibuf; /* error */ } if (~checks) DL_ERROR(err_checksum, imagepak); @@ -1249,20 +1256,20 @@ static void dload_data(struct dload_state *dlthis) if (dload_check_type(sptr, DLOAD_CINIT)) { cload_cinit(dlthis, - &ibuf.ipacket); + &ibuf->ipacket); cinit_processed = true; } else { /* FIXME */ if (!dlthis->myio-> writemem(dlthis-> myio, - ibuf.bufr, + ibuf->bufr, lptr-> load_addr + image_offset, lptr, BYTE_TO_HOST - (ibuf. + (ibuf-> ipacket. packet_size))) { DL_ERROR @@ -1276,7 +1283,7 @@ static void dload_data(struct dload_state *dlthis) } } image_offset += - BYTE_TO_TADDR(ibuf.ipacket.packet_size); + BYTE_TO_TADDR(ibuf->ipacket.packet_size); } /* process packets */ /* if this is a BSS section, we may want to fill it */ if (!dload_check_type(sptr, DLOAD_BSS)) @@ -1334,6 +1341,9 @@ loop_cont: DL_ERROR("Finalization of auto-trampolines (size = " FMT_UI32 ") failed", dlthis->tramp.tramp_sect_next_addr); } +free_ibuf: + kfree(ibuf); + return; } /* dload_data */ /************************************************************************* -- cgit v0.10.2 From ec4c6675230402384976d34d38e2b828be6ad0d9 Mon Sep 17 00:00:00 2001 From: Omar Ramirez Luna Date: Fri, 29 Jun 2012 13:49:20 -0500 Subject: staging: tidspbridge: dynamically allocate my_sym_buf in dload_symbols Dynamically allocate my_sym_buf to silence the following warning: drivers/staging/tidspbridge/dynload/cload.c: In function 'dload_symbols': drivers/staging/tidspbridge/dynload/cload.c:890: warning: the frame size of 1040 bytes is larger than 1024 bytes Signed-off-by: Omar Ramirez Luna Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/tidspbridge/dynload/cload.c b/drivers/staging/tidspbridge/dynload/cload.c index 3a12b43..9d54744 100644 --- a/drivers/staging/tidspbridge/dynload/cload.c +++ b/drivers/staging/tidspbridge/dynload/cload.c @@ -708,6 +708,7 @@ static void dload_symbols(struct dload_state *dlthis) struct local_symbol *sp; struct dynload_symbol *symp; struct dynload_symbol *newsym; + struct doff_syment_t *my_sym_buf; sym_count = dlthis->dfile_hdr.df_no_syms; if (sym_count == 0) @@ -741,13 +742,18 @@ static void dload_symbols(struct dload_state *dlthis) become defined from the global symbol table */ checks = dlthis->verify.dv_sym_tab_checksum; symbols_left = sym_count; + + my_sym_buf = kzalloc(sizeof(*my_sym_buf) * MY_SYM_BUF_SIZ, GFP_KERNEL); + if (!my_sym_buf) + return; + do { /* read all symbols */ char *sname; u32 val; s32 delta; struct doff_syment_t *input_sym; unsigned syms_in_buf; - struct doff_syment_t my_sym_buf[MY_SYM_BUF_SIZ]; + input_sym = my_sym_buf; syms_in_buf = symbols_left > MY_SYM_BUF_SIZ ? MY_SYM_BUF_SIZ : symbols_left; @@ -755,7 +761,7 @@ static void dload_symbols(struct dload_state *dlthis) if (dlthis->strm->read_buffer(dlthis->strm, input_sym, siz) != siz) { DL_ERROR(readstrm, sym_errid); - return; + goto free_sym_buf; } if (dlthis->reorder_map) dload_reorder(input_sym, siz, dlthis->reorder_map); @@ -858,7 +864,7 @@ static void dload_symbols(struct dload_state *dlthis) DL_ERROR("Absolute symbol %s is " "defined multiple times with " "different values", sname); - return; + goto free_sym_buf; } } loop_itr: @@ -889,6 +895,9 @@ loop_cont: if (~checks) dload_error(dlthis, "Checksum of symbols failed"); +free_sym_buf: + kfree(my_sym_buf); + return; } /* dload_symbols */ /***************************************************************************** -- cgit v0.10.2 From aab048923955ca2fa050a06b5a54568b4e6c5f4c Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Sun, 1 Jul 2012 23:31:35 +0530 Subject: staging/ft1000: fix minor coding style problem this following warn is fixed up drivers/staging/ft1000/ft1000-usb/ft1000_hw.c:1754: ERROR: open brace '{' following function declarations go on the next line Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c index c1f4f13..31929ef 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c @@ -1751,8 +1751,8 @@ out: return status; } -int ft1000_poll(void* dev_id) { - +int ft1000_poll(void* dev_id) +{ struct ft1000_device *dev = (struct ft1000_device *)dev_id; struct ft1000_info *info = netdev_priv(dev->net); -- cgit v0.10.2 From 599e6b2e90b4c152a633a2bcd7c583b0dff9bf98 Mon Sep 17 00:00:00 2001 From: "Justin P. Mattock" Date: Mon, 2 Jul 2012 07:44:41 -0700 Subject: staging "telephony" Fix typos. Signed-off-by: Justin P. Mattock Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/telephony/ixj.c b/drivers/staging/telephony/ixj.c index fd7757a..b303c91 100644 --- a/drivers/staging/telephony/ixj.c +++ b/drivers/staging/telephony/ixj.c @@ -7094,7 +7094,7 @@ static int ixj_selfprobe(IXJ *j) for (cnt = 0; cnt < 35; cnt++) j->ixj_signals[cnt] = SIGIO; - /* Set the excetion signal enable flags */ + /* Set the exception signal enable flags */ j->ex_sig.bits.dtmf_ready = j->ex_sig.bits.hookstate = j->ex_sig.bits.flash = j->ex_sig.bits.pstn_ring = j->ex_sig.bits.caller_id = j->ex_sig.bits.pstn_wink = j->ex_sig.bits.f0 = j->ex_sig.bits.f1 = j->ex_sig.bits.f2 = j->ex_sig.bits.f3 = j->ex_sig.bits.fc0 = j->ex_sig.bits.fc1 = j->ex_sig.bits.fc2 = j->ex_sig.bits.fc3 = 1; @@ -7132,7 +7132,7 @@ IXJ *ixj_pcmcia_probe(unsigned long dsp, unsigned long xilinx) return j; } -EXPORT_SYMBOL(ixj_pcmcia_probe); /* Fpr PCMCIA */ +EXPORT_SYMBOL(ixj_pcmcia_probe); /* For PCMCIA */ static int ixj_get_status_proc(char *buf) { -- cgit v0.10.2 From 24b46f9e4b3e0aa33e5fada23284e14a15dfa487 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Mon, 2 Jul 2012 23:59:30 -0300 Subject: staging: vt6656: main_usb.c: Remove useless macros All these macros are not used. So, remove this all. Signed-off-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index ee5261a..5048341 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -92,22 +92,14 @@ MODULE_DESCRIPTION(DEVICE_FULL_DRV_NAM); module_param_array(N, int, NULL, 0);\ MODULE_PARM_DESC(N, D); -#define RX_DESC_MIN0 16 -#define RX_DESC_MAX0 128 #define RX_DESC_DEF0 64 DEVICE_PARAM(RxDescriptors0,"Number of receive usb desc buffer"); -#define TX_DESC_MIN0 16 -#define TX_DESC_MAX0 128 #define TX_DESC_DEF0 64 DEVICE_PARAM(TxDescriptors0,"Number of transmit usb desc buffer"); - -#define CHANNEL_MIN 1 -#define CHANNEL_MAX 14 #define CHANNEL_DEF 6 - DEVICE_PARAM(Channel, "Channel number"); @@ -120,23 +112,13 @@ DEVICE_PARAM(Channel, "Channel number"); DEVICE_PARAM(PreambleType, "Preamble Type"); - -#define RTS_THRESH_MIN 512 -#define RTS_THRESH_MAX 2347 #define RTS_THRESH_DEF 2347 - DEVICE_PARAM(RTSThreshold, "RTS threshold"); - -#define FRAG_THRESH_MIN 256 -#define FRAG_THRESH_MAX 2346 #define FRAG_THRESH_DEF 2346 - DEVICE_PARAM(FragThreshold, "Fragmentation threshold"); -#define DATA_RATE_MIN 0 -#define DATA_RATE_MAX 13 #define DATA_RATE_DEF 13 /* datarate[] index 0: indicate 1 Mbps 0x02 @@ -157,10 +139,7 @@ DEVICE_PARAM(FragThreshold, "Fragmentation threshold"); DEVICE_PARAM(ConnectionRate, "Connection data rate"); -#define OP_MODE_MAX 2 #define OP_MODE_DEF 0 -#define OP_MODE_MIN 0 - DEVICE_PARAM(OPMode, "Infrastruct, adhoc, AP mode "); /* OpMode[] is used for transmit. @@ -176,34 +155,22 @@ DEVICE_PARAM(OPMode, "Infrastruct, adhoc, AP mode "); */ #define PS_MODE_DEF 0 - DEVICE_PARAM(PSMode, "Power saving mode"); -#define SHORT_RETRY_MIN 0 -#define SHORT_RETRY_MAX 31 #define SHORT_RETRY_DEF 8 - - DEVICE_PARAM(ShortRetryLimit, "Short frame retry limits"); -#define LONG_RETRY_MIN 0 -#define LONG_RETRY_MAX 15 #define LONG_RETRY_DEF 4 - - DEVICE_PARAM(LongRetryLimit, "long frame retry limits"); - /* BasebandType[] baseband type selected 0: indicate 802.11a type 1: indicate 802.11b type 2: indicate 802.11g type */ -#define BBP_TYPE_MIN 0 -#define BBP_TYPE_MAX 2 -#define BBP_TYPE_DEF 2 +#define BBP_TYPE_DEF 2 DEVICE_PARAM(BasebandType, "baseband type"); -- cgit v0.10.2 From 7183f337fef677165d3dbd09a42ee9578c94f890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Iglesias=20Gons=C3=A1lvez?= Date: Wed, 4 Jul 2012 16:11:10 +0200 Subject: Staging: ipack/devices/ipoctal: save IRQ vector in MEM space MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The IRQ vector should be saved in MEM space base address according to the datasheet. Signed-off-by: Samuel Iglesias Gonsálvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/devices/ipoctal.c b/drivers/staging/ipack/devices/ipoctal.c index ec7b2f9..a5af423 100644 --- a/drivers/staging/ipack/devices/ipoctal.c +++ b/drivers/staging/ipack/devices/ipoctal.c @@ -435,7 +435,8 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, */ ipoctal->dev->bus->ops->request_irq(ipoctal->dev, vector, ipoctal_irq_handler, ipoctal); - ipoctal->dev->bus->ops->write8(ipoctal->dev, IPACK_ID_SPACE, 0, vector); + ipoctal->dev->bus->ops->write8(ipoctal->dev, IPACK_MEM_SPACE, 0, + vector); /* Register the TTY device */ -- cgit v0.10.2 From e97e6c4f9a5d23a1bd7141b6fa73e2f96282c03d Mon Sep 17 00:00:00 2001 From: David Murray Date: Fri, 6 Jul 2012 09:20:43 -0500 Subject: Drivers: Staging: ccg: Made checkpatch.pl clean Fixed a tiny checkpatch.pl warning. Signed-off-by: David Murray Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ccg/ccg.c b/drivers/staging/ccg/ccg.c index a5b36a9..c50fa02 100644 --- a/drivers/staging/ccg/ccg.c +++ b/drivers/staging/ccg/ccg.c @@ -1143,7 +1143,7 @@ static int ccg_bind(struct usb_composite_dev *cdev) if (gcnum >= 0) device_desc.bcdDevice = cpu_to_le16(0x0200 + gcnum); else { - pr_warning("%s: controller '%s' not recognized\n", + pr_warn("%s: controller '%s' not recognized\n", longname, gadget->name); device_desc.bcdDevice = __constant_cpu_to_le16(0x9999); } -- cgit v0.10.2 From a7f3943cd055f73e82e1b57468286f3d7cf9fb27 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 6 Jul 2012 11:21:49 +0300 Subject: Staging: vme: silence a Sparse warning Sparse complains that "arg" is not a __user pointer. The "argp" and "arg" variables are equivalent but argp is declared as a __user pointer. Signed-off-by: Dan Carpenter Acked-By: Martyn Welch Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index e24a6f9..0c2479e 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -474,7 +474,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, case CONTROL_MINOR: switch (cmd) { case VME_IRQ_GEN: - copied = copy_from_user(&irq_req, (char *)arg, + copied = copy_from_user(&irq_req, argp, sizeof(struct vme_irq_id)); if (copied != 0) { printk(KERN_WARNING "Partial copy from userspace\n"); -- cgit v0.10.2 From 2c27d008c856a65eeb0612108127240d05a66bdb Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Fri, 6 Jul 2012 18:28:13 +0300 Subject: staging: bcm: use %pM to print MAC addresses Signed-off-by: Andy Shevchenko Cc: Kevin McKinney Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 189d243..9c8c9b1 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -967,24 +967,18 @@ static VOID DumpCmControlPacket(PVOID pvBuffer) BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8EthernetDestMacAddressLength: 0x%02X ", psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8EthernetDestMacAddress[6]: 0x %02X %02X %02X %02X %02X %02X", - psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[0], - psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[1], - psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[2], - psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[3], - psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[4], - psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[5]); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, "u8EthernetDestMacAddress[6]: %pM", + psfCSType->cCPacketClassificationRule. + u8EthernetDestMacAddress); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8EthernetSourceMACAddressLength: 0x%02X ", psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8EthernetSourceMACAddress[6]: 0x %02X %02X %02X %02X %02X %02X", - psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[0], - psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[1], - psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[2], - psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[3], - psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[4], - psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[5]); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, "u8EthernetSourceMACAddress[6]: " + "%pM", psfCSType->cCPacketClassificationRule. + u8EthernetSourceMACAddress); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8EthertypeLength: 0x%02X ", psfCSType->cCPacketClassificationRule.u8EthertypeLength); @@ -1123,24 +1117,18 @@ static VOID DumpCmControlPacket(PVOID pvBuffer) BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8EthernetDestMacAddressLength: 0x%02X ", psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8EthernetDestMacAddress[6]: 0x %02X %02X %02X %02X %02X %02X", - psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[0], - psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[1], - psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[2], - psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[3], - psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[4], - psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[5]); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, "u8EthernetDestMacAddress[6]: %pM", + psfCSType->cCPacketClassificationRule. + u8EthernetDestMacAddress); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8EthernetSourceMACAddressLength: 0x%02X ", psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8EthernetSourceMACAddress[6]: 0x %02X %02X %02X %02X %02X %02X", - psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[0], - psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[1], - psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[2], - psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[3], - psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[4], - psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[5]); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, "u8EthernetSourceMACAddress[6]: " + "%pM", psfCSType->cCPacketClassificationRule. + u8EthernetSourceMACAddress); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8EthertypeLength: 0x%02X ", psfCSType->cCPacketClassificationRule.u8EthertypeLength); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8Ethertype[3]: 0x%02X %02X %02X", -- cgit v0.10.2 From a6737c738c327b982a4251ad6be06153220da722 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Fri, 6 Jul 2012 18:28:14 +0300 Subject: staging: csr: print MAC addresses via %pM Signed-off-by: Andy Shevchenko Cc: Lauri Hintsala Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/sme_mgt.c b/drivers/staging/csr/sme_mgt.c index ab70216..c27c0a7 100644 --- a/drivers/staging/csr/sme_mgt.c +++ b/drivers/staging/csr/sme_mgt.c @@ -838,14 +838,8 @@ void CsrWifiSmeMediaStatusIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) (unsigned char *)ind->connectionInfo.assocScanInfoElements, ind->connectionInfo.assocScanInfoElementsLength); - unifi_trace(priv, UDBG2, - "CsrWifiSmeMediaStatusIndSend: IBSS=%02X:%02X:%02X:%02X:%02X:%02X\n", - ind->connectionInfo.bssid.a[0], - ind->connectionInfo.bssid.a[1], - ind->connectionInfo.bssid.a[2], - ind->connectionInfo.bssid.a[3], - ind->connectionInfo.bssid.a[4], - ind->connectionInfo.bssid.a[5]); + unifi_trace(priv, UDBG2, "CsrWifiSmeMediaStatusIndSend: IBSS=%pM\n", + ind->connectionInfo.bssid.a); sme_mgt_packet_filter_set(priv); diff --git a/drivers/staging/csr/sme_sys.c b/drivers/staging/csr/sme_sys.c index 283e302..9c3aa74 100644 --- a/drivers/staging/csr/sme_sys.c +++ b/drivers/staging/csr/sme_sys.c @@ -527,11 +527,9 @@ configure_data_port(unifi_priv_t *priv, controlled_string = "uncontrolled"; } - unifi_trace(priv, UDBG2, "port config request %02x:%02x:%02x:%02x:%02x:%02x %s with port_action %d.\n", - macAddress->a[0], macAddress->a[1], macAddress->a[2], - macAddress->a[3], macAddress->a[4], macAddress->a[5], - controlled_string, port_action); - + unifi_trace(priv, UDBG2, + "port config request %pM %s with port_action %d.\n", + macAddress->a, controlled_string, port_action); /* If the new configuration has the broadcast MAC address or if we are in infrastructure mode then clear the list first and set port overide mode */ if ((CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode || @@ -653,10 +651,9 @@ configure_data_port(unifi_priv_t *priv, uf_free_pending_rx_packets(priv, queue, *macAddress,interfaceTag); } - unifi_trace(priv, UDBG2, "port config %02x:%02x:%02x:%02x:%02x:%02x with port_action %d.\n", - *(macAddress->a+0), *(macAddress->a+1), *(macAddress->a+2), - *(macAddress->a+3), *(macAddress->a+4), *(macAddress->a+5), - port_action); + unifi_trace(priv, UDBG2, + "port config %pM with port_action %d.\n", + macAddress->a, port_action); } return 0; } /* configure_data_port() */ @@ -2649,11 +2646,9 @@ CsrBool blockack_session_stop(unifi_priv_t *priv, return FALSE; } - unifi_warning(priv, "%s: stopping ba_session for peer = %02x:%02x:%02x:%02x:%02x:%02x role = %d tID = %d\n", __FUNCTION__, - macAddress.a[0], macAddress.a[1], macAddress.a[2], - macAddress.a[3], macAddress.a[4], macAddress.a[5], - role, - tID); + unifi_warning(priv, + "%s: stopping ba_session for peer = %pM role = %d tID = %d\n", + __func__, macAddress.a, role, tID); /* find out the appropriate ba session (/station /tid /role) for which stop is requested */ if (role == CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT){ @@ -2781,9 +2776,9 @@ CsrBool blockack_session_start(unifi_priv_t *priv, return FALSE; } - unifi_warning(priv, "%s: ba session with peer= (%02x:%02x:%02x:%02x:%02x:%02x)\n", __FUNCTION__, - macAddress.a[0], macAddress.a[1], macAddress.a[2], - macAddress.a[3], macAddress.a[4], macAddress.a[5]); + unifi_warning(priv, + "%s: ba session with peer= (%pM)\n", __func__, + macAddress.a); unifi_warning(priv, "%s: ba session for tID=%d timeout=%d role=%d wind_size=%d start_sn=%d\n", __FUNCTION__, tID, diff --git a/drivers/staging/csr/sme_wext.c b/drivers/staging/csr/sme_wext.c index 3ba7b4c..cdc72db 100644 --- a/drivers/staging/csr/sme_wext.c +++ b/drivers/staging/csr/sme_wext.c @@ -1210,13 +1210,8 @@ unifi_siwap(struct net_device *dev, struct iw_request_info *info, return -EINVAL; } - unifi_trace(priv, UDBG1, "unifi_siwap: asked for %02X:%02X:%02X:%02X:%02X:%02X\n", - (u8)wrqu->ap_addr.sa_data[0], - (u8)wrqu->ap_addr.sa_data[1], - (u8)wrqu->ap_addr.sa_data[2], - (u8)wrqu->ap_addr.sa_data[3], - (u8)wrqu->ap_addr.sa_data[4], - (u8)wrqu->ap_addr.sa_data[5]); + unifi_trace(priv, UDBG1, "unifi_siwap: asked for %pM\n", + wrqu->ap_addr.sa_data); if (!memcmp(wrqu->ap_addr.sa_data, zero_bssid, ETH_ALEN)) { priv->ignore_bssid_join = FALSE; @@ -1281,10 +1276,7 @@ unifi_giwap(struct net_device *dev, struct iw_request_info *info, if (r == 0) { bssid = connectionInfo.bssid.a; wrqu->ap_addr.sa_family = ARPHRD_ETHER; - unifi_trace(priv, UDBG4, - "unifi_giwap: BSSID = %02X:%02X:%02X:%02X:%02X:%02X\n", - bssid[0], bssid[1], bssid[2], - bssid[3], bssid[4], bssid[5]); + unifi_trace(priv, UDBG4, "unifi_giwap: BSSID = %pM\n", bssid); memcpy(wrqu->ap_addr.sa_data, bssid, ETH_ALEN); } else { @@ -2936,8 +2928,7 @@ _unifi_siwencodeext(struct net_device *dev, struct iw_request_info *info, unifi_trace(priv, UDBG1, "siwencodeext: flags=0x%X, alg=%d, ext_flags=0x%X, len=%d, index=%d,\n", wrqu->encoding.flags, ext->alg, ext->ext_flags, ext->key_len, (wrqu->encoding.flags & IW_ENCODE_INDEX)); - unifi_trace(priv, UDBG3, " addr=%02X:%02X:%02X:%02X:%02X:%02X\n", - a[0], a[1], a[2], a[3], a[4], a[5]); + unifi_trace(priv, UDBG3, " addr=%pM\n", a); if ((ext->key_len == 0) && (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)) { /* This means use a different key (given by key_idx) for Tx. */ @@ -3140,14 +3131,8 @@ unifi_siwpmksa(struct net_device *dev, struct iw_request_info *info, } - unifi_trace(priv, UDBG1, "SIWPMKSA: cmd %d, %02x:%02x:%02x:%02x:%02x:%02x\n", - pmksa->cmd, - pmksa->bssid.sa_data[0], - pmksa->bssid.sa_data[1], - pmksa->bssid.sa_data[2], - pmksa->bssid.sa_data[3], - pmksa->bssid.sa_data[4], - pmksa->bssid.sa_data[5]); + unifi_trace(priv, UDBG1, "SIWPMKSA: cmd %d, %pM\n", pmksa->cmd, + pmksa->bssid.sa_data); pmkid_list.pmkids = NULL; switch (pmksa->cmd) { diff --git a/drivers/staging/csr/unifi_pdu_processing.c b/drivers/staging/csr/unifi_pdu_processing.c index e35747c..45c69a9 100644 --- a/drivers/staging/csr/unifi_pdu_processing.c +++ b/drivers/staging/csr/unifi_pdu_processing.c @@ -68,7 +68,9 @@ unifi_frame_ma_packet_req(unifi_priv_t *priv, CSR_PRIORITY priority, interfacePriv = priv->interfacePriv[interfaceTag]; - UF_TRACE_MAC(priv, UDBG5, "In unifi_frame_ma_packet_req, Frame for Peer:", peerMacAddress); + unifi_trace(priv, UDBG5, + "In unifi_frame_ma_packet_req, Frame for Peer: %pMF\n", + peerMacAddress); signal->SignalPrimitiveHeader.SignalId = CSR_MA_PACKET_REQUEST_ID; signal->SignalPrimitiveHeader.ReceiverProcessId = 0; signal->SignalPrimitiveHeader.SenderProcessId = leSenderProcessId; @@ -1668,7 +1670,9 @@ CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, CsrUint32 handle = 0xFFFFFFFF; unsigned long lock_flags; - UF_TRACE_MAC(priv, UDBG5, "entering uf_process_ma_packet_req, peer: ", peerMacAddress); + unifi_trace(priv, UDBG5, + "entering uf_process_ma_packet_req, peer: %pMF\n", + peerMacAddress); if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { unifi_error(priv, "interfaceTag >= CSR_WIFI_NUM_INTERFACES, interfacetag = %d\n", interfaceTag); diff --git a/drivers/staging/csr/unifi_priv.h b/drivers/staging/csr/unifi_priv.h index b23c844..7e940ef 100644 --- a/drivers/staging/csr/unifi_priv.h +++ b/drivers/staging/csr/unifi_priv.h @@ -1174,17 +1174,4 @@ int unifi_putest_gp_write16(unifi_priv_t *priv, unsigned char *arg); int unifi_putest_dl_fw(unifi_priv_t *priv, unsigned char *arg); int unifi_putest_dl_fw_buff(unifi_priv_t *priv, unsigned char *arg); - -/* Macro for formatting a MAC address with a prefix string */ -#define UF_TRACE_MAC(priv, lvl, msg, addr) \ - unifi_trace(priv, lvl, \ - "%s %02x-%02x-%02x-%02x-%02x-%02x\n", \ - msg, \ - *(((CsrUint8 *)addr)+0), \ - *(((CsrUint8 *)addr)+1), \ - *(((CsrUint8 *)addr)+2), \ - *(((CsrUint8 *)addr)+3), \ - *(((CsrUint8 *)addr)+4), \ - *(((CsrUint8 *)addr)+5)) - #endif /* __LINUX_UNIFI_PRIV_H__ */ diff --git a/drivers/staging/csr/unifi_sme.c b/drivers/staging/csr/unifi_sme.c index 54414ed2e..6e7cbbf 100644 --- a/drivers/staging/csr/unifi_sme.c +++ b/drivers/staging/csr/unifi_sme.c @@ -1174,7 +1174,8 @@ uf_send_m4_ready_wq(struct work_struct *work) /* Send a signal to SME */ CsrWifiRouterCtrlM4ReadyToSendIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, iface, peer); - UF_TRACE_MAC(priv, UDBG1, "M4ReadyToSendInd sent for peer", peer.a); + unifi_trace(priv, UDBG1, "M4ReadyToSendInd sent for peer %pMF\n", + peer.a); func_exit(); -- cgit v0.10.2 From d3cc13a24beb9cda3d56f5cfd4cc894b8df454ff Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Fri, 6 Jul 2012 18:28:17 +0300 Subject: staging: vt6656: use %pM for the BSSID Signed-off-by: Andy Shevchenko Acked-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c index 619c257..0999367 100644 --- a/drivers/staging/vt6656/bssdb.c +++ b/drivers/staging/vt6656/bssdb.c @@ -129,9 +129,8 @@ PKnownBSS BSSpSearchBSSList(void *hDeviceContext, unsigned int ii = 0; unsigned int jj = 0; if (pbyDesireBSSID != NULL) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSSpSearchBSSList BSSID[%02X %02X %02X-%02X %02X %02X]\n", - *pbyDesireBSSID,*(pbyDesireBSSID+1),*(pbyDesireBSSID+2), - *(pbyDesireBSSID+3),*(pbyDesireBSSID+4),*(pbyDesireBSSID+5)); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO + "BSSpSearchBSSList BSSID[%pM]\n", pbyDesireBSSID); if ((!is_broadcast_ether_addr(pbyDesireBSSID)) && (memcmp(pbyDesireBSSID, ZeroBSSID, 6)!= 0)){ pbyBSSID = pbyDesireBSSID; @@ -218,7 +217,9 @@ PKnownBSS BSSpSearchBSSList(void *hDeviceContext, } pMgmt->pSameBSS[jj].uChannel = pCurrBSS->uChannel; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSSpSearchBSSList pSelect1[%02X %02X %02X-%02X %02X %02X]\n",*pCurrBSS->abyBSSID,*(pCurrBSS->abyBSSID+1),*(pCurrBSS->abyBSSID+2),*(pCurrBSS->abyBSSID+3),*(pCurrBSS->abyBSSID+4),*(pCurrBSS->abyBSSID+5)); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO + "BSSpSearchBSSList pSelect1[%pM]\n", + pCurrBSS->abyBSSID); jj++; -- cgit v0.10.2 From 075fb4b7243c90f936049d07761f1cffd2577928 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Fri, 6 Jul 2012 18:28:16 +0300 Subject: staging: vt6655: use %pM for BSSID Signed-off-by: Andy Shevchenko Cc: Forest Bond Cc: Masanari Iida Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6655/bssdb.c b/drivers/staging/vt6655/bssdb.c index 1368e8c..f4f108f 100644 --- a/drivers/staging/vt6655/bssdb.c +++ b/drivers/staging/vt6655/bssdb.c @@ -142,9 +142,8 @@ BSSpSearchBSSList( unsigned int ii = 0; if (pbyDesireBSSID != NULL) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSSpSearchBSSList BSSID[%02X %02X %02X-%02X %02X %02X]\n", - *pbyDesireBSSID,*(pbyDesireBSSID+1),*(pbyDesireBSSID+2), - *(pbyDesireBSSID+3),*(pbyDesireBSSID+4),*(pbyDesireBSSID+5)); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO + "BSSpSearchBSSList BSSID[%pM]\n", pbyDesireBSSID); if ((!is_broadcast_ether_addr(pbyDesireBSSID)) && (memcmp(pbyDesireBSSID, ZeroBSSID, 6)!= 0)){ pbyBSSID = pbyDesireBSSID; -- cgit v0.10.2 From e7ecb0fb40a5358646888720848787da34cfa33d Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Fri, 6 Jul 2012 18:28:15 +0300 Subject: staging: gdm72xx: use %pM for MAC Signed-off-by: Andy Shevchenko Cc: Ben Chan Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/gdm72xx/gdm_wimax.c b/drivers/staging/gdm72xx/gdm_wimax.c index 110bdbc..e616de1 100644 --- a/drivers/staging/gdm72xx/gdm_wimax.c +++ b/drivers/staging/gdm72xx/gdm_wimax.c @@ -744,13 +744,8 @@ static int gdm_wimax_get_prepared_info(struct net_device *dev, char *buf, "[%x/%d]\n", __func__, T, L); return -1; } - printk(KERN_INFO - "MAC change [%02x:%02x:%02x:%02x:%02x:%02x]" - "->[%02x:%02x:%02x:%02x:%02x:%02x]\n", - dev->dev_addr[0], dev->dev_addr[1], - dev->dev_addr[2], dev->dev_addr[3], - dev->dev_addr[4], dev->dev_addr[5], - V[0], V[1], V[2], V[3], V[4], V[5]); + printk(KERN_INFO "MAC change [%pM]->[%pM]\n", + dev->dev_addr, V); memcpy(dev->dev_addr, V, dev->addr_len); return 1; } -- cgit v0.10.2 From 0932966b1ca03217c6e0c18375867b1a99ee5af0 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Fri, 6 Jul 2012 18:39:47 +0300 Subject: staging: ccg: print MAC addresses via %pM Signed-off-by: Andy Shevchenko Acked-by: Kyungmin Park Cc: Andrzej Pietrasiewicz Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ccg/ccg.c b/drivers/staging/ccg/ccg.c index c50fa02..6a7aab8 100644 --- a/drivers/staging/ccg/ccg.c +++ b/drivers/staging/ccg/ccg.c @@ -564,9 +564,7 @@ static int rndis_function_bind_config(struct ccg_usb_function *f, return -1; } - pr_info("%s MAC: %02X:%02X:%02X:%02X:%02X:%02X\n", __func__, - rndis->ethaddr[0], rndis->ethaddr[1], rndis->ethaddr[2], - rndis->ethaddr[3], rndis->ethaddr[4], rndis->ethaddr[5]); + pr_info("%s MAC: %pM\n", __func__, rndis->ethaddr); ret = gether_setup_name(c->cdev->gadget, rndis->ethaddr, "rndis"); if (ret) { @@ -654,9 +652,7 @@ static ssize_t rndis_ethaddr_show(struct device *dev, { struct ccg_usb_function *f = dev_get_drvdata(dev); struct rndis_function_config *rndis = f->config; - return sprintf(buf, "%02x:%02x:%02x:%02x:%02x:%02x\n", - rndis->ethaddr[0], rndis->ethaddr[1], rndis->ethaddr[2], - rndis->ethaddr[3], rndis->ethaddr[4], rndis->ethaddr[5]); + return sprintf(buf, "%pM\n", rndis->ethaddr); } static ssize_t rndis_ethaddr_store(struct device *dev, -- cgit v0.10.2 From c866ffc72541296b8d31c109fbdb69643d2d18a6 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Sun, 1 Jul 2012 00:47:41 +0200 Subject: iio staging: missing newline in printf Signed-off-by: Peter Meerwald Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h index 5244fa0..cf32ae0 100644 --- a/drivers/staging/iio/Documentation/iio_utils.h +++ b/drivers/staging/iio/Documentation/iio_utils.h @@ -453,7 +453,7 @@ inline int find_type_by_name(const char *name, const char *type) dp = opendir(iio_dir); if (dp == NULL) { - printf("No industrialio devices available"); + printf("No industrialio devices available\n"); return -ENODEV; } -- cgit v0.10.2 From 3bdff937827da04b487f0a0ac6e1f3a9a1296878 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Sun, 1 Jul 2012 00:47:43 +0200 Subject: iio: cleanup buffer.h comments Signed-off-by: Peter Meerwald Signed-off-by: Jonathan Cameron diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h index ad4fb1a..2a2b6b4 100644 --- a/include/linux/iio/buffer.h +++ b/include/linux/iio/buffer.h @@ -85,7 +85,7 @@ struct iio_buffer { /** * iio_buffer_init() - Initialize the buffer structure - * @buffer: buffer to be initialized + * @buffer: buffer to be initialized **/ void iio_buffer_init(struct iio_buffer *buffer); @@ -107,8 +107,9 @@ int iio_scan_mask_query(struct iio_dev *indio_dev, /** * iio_scan_mask_set() - set particular bit in the scan mask - * @buffer: the buffer whose scan mask we are interested in - * @bit: the bit to be set. + * @indio_dev IIO device structure + * @buffer: the buffer whose scan mask we are interested in + * @bit: the bit to be set. **/ int iio_scan_mask_set(struct iio_dev *indio_dev, struct iio_buffer *buffer, int bit); @@ -116,8 +117,8 @@ int iio_scan_mask_set(struct iio_dev *indio_dev, /** * iio_push_to_buffer() - push to a registered buffer. * @buffer: IIO buffer structure for device - * @scan: Full scan. - * @timestamp: + * @data: the data to push to the buffer + * @timestamp: timestamp to associate with the data */ int iio_push_to_buffer(struct iio_buffer *buffer, unsigned char *data, s64 timestamp); @@ -126,7 +127,9 @@ int iio_update_demux(struct iio_dev *indio_dev); /** * iio_buffer_register() - register the buffer with IIO core - * @indio_dev: device with the buffer to be registered + * @indio_dev: device with the buffer to be registered + * @channels: the channel descriptions used to construct buffer + * @num_channels: the number of channels **/ int iio_buffer_register(struct iio_dev *indio_dev, const struct iio_chan_spec *channels, @@ -134,7 +137,7 @@ int iio_buffer_register(struct iio_dev *indio_dev, /** * iio_buffer_unregister() - unregister the buffer from IIO core - * @indio_dev: the device with the buffer to be unregistered + * @indio_dev: the device with the buffer to be unregistered **/ void iio_buffer_unregister(struct iio_dev *indio_dev); -- cgit v0.10.2 From 034bd7b5d926816285deb71c41a230b912524f8b Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Mon, 2 Jul 2012 23:43:47 +0200 Subject: iio: fix spelling of detach in static func Signed-off-by: Peter Meerwald Signed-off-by: Jonathan Cameron diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c index ec653fb..2ef36d1 100644 --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c @@ -234,7 +234,7 @@ static int iio_trigger_attach_poll_func(struct iio_trigger *trig, return ret; } -static int iio_trigger_dettach_poll_func(struct iio_trigger *trig, +static int iio_trigger_detach_poll_func(struct iio_trigger *trig, struct iio_poll_func *pf) { int ret = 0; @@ -502,7 +502,7 @@ EXPORT_SYMBOL(iio_triggered_buffer_postenable); int iio_triggered_buffer_predisable(struct iio_dev *indio_dev) { - return iio_trigger_dettach_poll_func(indio_dev->trig, + return iio_trigger_detach_poll_func(indio_dev->trig, indio_dev->pollfunc); } EXPORT_SYMBOL(iio_triggered_buffer_predisable); -- cgit v0.10.2 From da4db94080f0c54929a031f37e550001d0068930 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Sun, 1 Jul 2012 12:20:13 +0200 Subject: iio staging: add recently added modifiers to iio_event_monitor maybe iio_modifier_names and iio_chan_type_name_spec should be exported from industrialio-core instead? Signed-off-by: Peter Meerwald Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/Documentation/iio_event_monitor.c b/drivers/staging/iio/Documentation/iio_event_monitor.c index 4326e9e..3a9b000 100644 --- a/drivers/staging/iio/Documentation/iio_event_monitor.c +++ b/drivers/staging/iio/Documentation/iio_event_monitor.c @@ -68,6 +68,12 @@ static const char * const iio_modifier_names[] = { [IIO_MOD_Z] = "z", [IIO_MOD_LIGHT_BOTH] = "both", [IIO_MOD_LIGHT_IR] = "ir", + [IIO_MOD_ROOT_SUM_SQUARED_X_Y] = "sqrt(x^2+y^2)", + [IIO_MOD_SUM_SQUARED_X_Y_Z] = "x^2+y^2+z^2", + [IIO_MOD_LIGHT_CLEAR] = "clear", + [IIO_MOD_LIGHT_RED] = "red", + [IIO_MOD_LIGHT_GREEN] = "green", + [IIO_MOD_LIGHT_BLUE] = "blue", }; static bool event_is_known(struct iio_event_data *event) @@ -106,6 +112,12 @@ static bool event_is_known(struct iio_event_data *event) case IIO_MOD_Z: case IIO_MOD_LIGHT_BOTH: case IIO_MOD_LIGHT_IR: + case IIO_MOD_ROOT_SUM_SQUARED_X_Y: + case IIO_MOD_SUM_SQUARED_X_Y_Z: + case IIO_MOD_LIGHT_CLEAR: + case IIO_MOD_LIGHT_RED: + case IIO_MOD_LIGHT_GREEN: + case IIO_MOD_LIGHT_BLUE: break; default: return false; -- cgit v0.10.2 From cf09fe9c873ca0f4e2ca83e7bea03e2599a62d58 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Sun, 1 Jul 2012 12:20:11 +0200 Subject: iio: kernel version typo in sysfs-bus-iio Signed-off-by: Peter Meerwald Signed-off-by: Jonathan Cameron diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio index a3774a7..2f06d40 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -275,7 +275,7 @@ What: /sys/.../iio:deviceX/in_voltage-voltage_scale_available What: /sys/.../iio:deviceX/out_voltageX_scale_available What: /sys/.../iio:deviceX/out_altvoltageX_scale_available What: /sys/.../iio:deviceX/in_capacitance_scale_available -KernelVersion: 2.635 +KernelVersion: 2.6.35 Contact: linux-iio@vger.kernel.org Description: If a discrete set of scale values is available, they -- cgit v0.10.2 From 6d459aa011cb087ed1f5c17836b032fcc670e306 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Thu, 5 Jul 2012 10:57:06 +0200 Subject: iio:trigger: Register sysfs file statically The name sysfs attribute is the same for all triggers, so there is no need to register them dynamically at runtime. Create a attribute group for it and set it up for the bus attribute group. This also avoids a possible race condition where the uevent for the device is sent before the name sysfs attribute has been added. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c index 2ef36d1..4fe0ead 100644 --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c @@ -51,25 +51,19 @@ static ssize_t iio_trigger_read_name(struct device *dev, static DEVICE_ATTR(name, S_IRUGO, iio_trigger_read_name, NULL); -/** - * iio_trigger_register_sysfs() - create a device for this trigger - * @trig_info: the trigger - * - * Also adds any control attribute registered by the trigger driver - **/ -static int iio_trigger_register_sysfs(struct iio_trigger *trig_info) -{ - return sysfs_add_file_to_group(&trig_info->dev.kobj, - &dev_attr_name.attr, - NULL); -} +static struct attribute *iio_trig_dev_attrs[] = { + &dev_attr_name.attr, + NULL, +}; -static void iio_trigger_unregister_sysfs(struct iio_trigger *trig_info) -{ - sysfs_remove_file_from_group(&trig_info->dev.kobj, - &dev_attr_name.attr, - NULL); -} +static struct attribute_group iio_trig_attr_group = { + .attrs = iio_trig_dev_attrs, +}; + +static const struct attribute_group *iio_trig_attr_groups[] = { + &iio_trig_attr_group, + NULL +}; int iio_trigger_register(struct iio_trigger *trig_info) { @@ -88,10 +82,6 @@ int iio_trigger_register(struct iio_trigger *trig_info) if (ret) goto error_unregister_id; - ret = iio_trigger_register_sysfs(trig_info); - if (ret) - goto error_device_del; - /* Add to list of available triggers held by the IIO core */ mutex_lock(&iio_trigger_list_lock); list_add_tail(&trig_info->list, &iio_trigger_list); @@ -99,8 +89,6 @@ int iio_trigger_register(struct iio_trigger *trig_info) return 0; -error_device_del: - device_del(&trig_info->dev); error_unregister_id: ida_simple_remove(&iio_trigger_ida, trig_info->id); error_ret: @@ -114,7 +102,6 @@ void iio_trigger_unregister(struct iio_trigger *trig_info) list_del(&trig_info->list); mutex_unlock(&iio_trigger_list_lock); - iio_trigger_unregister_sysfs(trig_info); ida_simple_remove(&iio_trigger_ida, trig_info->id); /* Possible issue in here */ device_unregister(&trig_info->dev); @@ -406,6 +393,7 @@ static void iio_trig_release(struct device *device) static struct device_type iio_trig_type = { .release = iio_trig_release, + .groups = iio_trig_attr_groups, }; static void iio_trig_subirqmask(struct irq_data *d) -- cgit v0.10.2 From d297b9bdad044a732223b44c19e8223d93fd3aa0 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 3 Jul 2012 11:21:28 +0200 Subject: staging iio adt7410: make 16bit mode default In 13bit mode the lower three bits of the adc value contain flags. The driver does not use these flags at all, so make 16bit mode the default. Signed-off-by: Sascha Hauer Acked-by: Sonic Zhang Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/adc/adt7410.c b/drivers/staging/iio/adc/adt7410.c index 917b692..1a41970 100644 --- a/drivers/staging/iio/adc/adt7410.c +++ b/drivers/staging/iio/adc/adt7410.c @@ -761,13 +761,15 @@ static int __devinit adt7410_probe(struct i2c_client *client, goto error_unreg_ct_irq; } - if (client->irq && adt7410_platform_data[0]) { + ret = adt7410_i2c_read_byte(chip, ADT7410_CONFIG, &chip->config); + if (ret) { + ret = -EIO; + goto error_unreg_int_irq; + } - ret = adt7410_i2c_read_byte(chip, ADT7410_CONFIG, &chip->config); - if (ret) { - ret = -EIO; - goto error_unreg_int_irq; - } + chip->config |= ADT7410_RESOLUTION; + + if (client->irq && adt7410_platform_data[0]) { /* set irq polarity low level */ chip->config &= ~ADT7410_CT_POLARITY; @@ -776,12 +778,12 @@ static int __devinit adt7410_probe(struct i2c_client *client, chip->config |= ADT7410_INT_POLARITY; else chip->config &= ~ADT7410_INT_POLARITY; + } - ret = adt7410_i2c_write_byte(chip, ADT7410_CONFIG, chip->config); - if (ret) { - ret = -EIO; - goto error_unreg_int_irq; - } + ret = adt7410_i2c_write_byte(chip, ADT7410_CONFIG, chip->config); + if (ret) { + ret = -EIO; + goto error_unreg_int_irq; } ret = iio_device_register(indio_dev); if (ret) -- cgit v0.10.2 From c732a24c5a9392cf3738f5957e0d97d37c09e6e1 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 3 Jul 2012 11:27:53 +0200 Subject: staging:iio:adt7410: use local platformdata if none is specified The adt7410 expects information about an irq in platform_data. The driver can work without an irq, so make platform_data optional by specifying a dummy platform_data if the device has none. Signed-off-by: Sascha Hauer Acked-by: Sonic Zhang Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/adc/adt7410.c b/drivers/staging/iio/adc/adt7410.c index 1a41970..42fe2c8 100644 --- a/drivers/staging/iio/adc/adt7410.c +++ b/drivers/staging/iio/adc/adt7410.c @@ -720,6 +720,7 @@ static int __devinit adt7410_probe(struct i2c_client *client, struct iio_dev *indio_dev; int ret = 0; unsigned long *adt7410_platform_data = client->dev.platform_data; + unsigned long local_pdata[] = {0, 0}; indio_dev = iio_device_alloc(sizeof(*chip)); if (indio_dev == NULL) { @@ -737,6 +738,9 @@ static int __devinit adt7410_probe(struct i2c_client *client, indio_dev->info = &adt7410_info; indio_dev->modes = INDIO_DIRECT_MODE; + if (!adt7410_platform_data) + adt7410_platform_data = local_pdata; + /* CT critcal temperature event. line 0 */ if (client->irq) { ret = request_threaded_irq(client->irq, -- cgit v0.10.2 From e1dc7bee745f74b42685b4b0b0a24895966e545e Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 2 Jul 2012 14:52:56 +0200 Subject: iio: iio_buffer_register: Use correct channel when calculating masklength The channel set assigned to the iio device is not necessarily the same has the channel set passed to iio_buffer_register. So to avoid possible complications always work with the channel set pass to iio_buffer_register and ignore the channel set assigned to the iio device. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index 3d8d187..096a6bf 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -292,7 +292,7 @@ int iio_buffer_register(struct iio_dev *indio_dev, if (channels[i].scan_index > (int)indio_dev->masklength - 1) indio_dev->masklength - = indio_dev->channels[i].scan_index + 1; + = channels[i].scan_index + 1; ret = iio_buffer_add_channel_sysfs(indio_dev, &channels[i]); -- cgit v0.10.2 From a91aff1c09fc41a55ccaa115763ff77e36b527d3 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 2 Jul 2012 10:54:45 +0200 Subject: staging:iio: Request threaded-only IRQs with IRQF_ONESHOT Since commit 1c6c69525b ("genirq: Reject bogus threaded irq requests") threaded IRQs without a primary handler need to be requested with IRQF_ONESHOT, otherwise the request will fail. This patch adds the IRQF_ONESHOT to IIO drivers where it is missing. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/accel/sca3000_core.c b/drivers/staging/iio/accel/sca3000_core.c index 6ec5c20..c218d71 100644 --- a/drivers/staging/iio/accel/sca3000_core.c +++ b/drivers/staging/iio/accel/sca3000_core.c @@ -1189,7 +1189,7 @@ static int __devinit sca3000_probe(struct spi_device *spi) ret = request_threaded_irq(spi->irq, NULL, &sca3000_event_handler, - IRQF_TRIGGER_FALLING, + IRQF_TRIGGER_FALLING | IRQF_ONESHOT, "sca3000", indio_dev); if (ret) diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c index 5356b09..c5fb947 100644 --- a/drivers/staging/iio/adc/ad7816.c +++ b/drivers/staging/iio/adc/ad7816.c @@ -402,7 +402,7 @@ static int __devinit ad7816_probe(struct spi_device *spi_dev) ret = request_threaded_irq(spi_dev->irq, NULL, &ad7816_event_handler, - IRQF_TRIGGER_LOW, + IRQF_TRIGGER_LOW | IRQF_ONESHOT, indio_dev->name, indio_dev); if (ret) diff --git a/drivers/staging/iio/adc/adt7310.c b/drivers/staging/iio/adc/adt7310.c index e5f1ed7..44dcf63 100644 --- a/drivers/staging/iio/adc/adt7310.c +++ b/drivers/staging/iio/adc/adt7310.c @@ -778,7 +778,7 @@ static int __devinit adt7310_probe(struct spi_device *spi_dev) ret = request_threaded_irq(spi_dev->irq, NULL, &adt7310_event_handler, - irq_flags, + irq_flags | IRQF_ONESHOT, indio_dev->name, indio_dev); if (ret) @@ -790,7 +790,8 @@ static int __devinit adt7310_probe(struct spi_device *spi_dev) ret = request_threaded_irq(adt7310_platform_data[0], NULL, &adt7310_event_handler, - adt7310_platform_data[1], + adt7310_platform_data[1] | + IRQF_ONESHOT, indio_dev->name, indio_dev); if (ret) diff --git a/drivers/staging/iio/adc/adt7410.c b/drivers/staging/iio/adc/adt7410.c index 917b692..a2defe6 100644 --- a/drivers/staging/iio/adc/adt7410.c +++ b/drivers/staging/iio/adc/adt7410.c @@ -742,7 +742,7 @@ static int __devinit adt7410_probe(struct i2c_client *client, ret = request_threaded_irq(client->irq, NULL, &adt7410_event_handler, - IRQF_TRIGGER_LOW, + IRQF_TRIGGER_LOW | IRQF_ONESHOT, id->name, indio_dev); if (ret) @@ -754,7 +754,8 @@ static int __devinit adt7410_probe(struct i2c_client *client, ret = request_threaded_irq(adt7410_platform_data[0], NULL, &adt7410_event_handler, - adt7410_platform_data[1], + adt7410_platform_data[1] | + IRQF_ONESHOT, id->name, indio_dev); if (ret) diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c index a16d1a2..6a40414 100644 --- a/drivers/staging/iio/cdc/ad7150.c +++ b/drivers/staging/iio/cdc/ad7150.c @@ -585,7 +585,8 @@ static int __devinit ad7150_probe(struct i2c_client *client, NULL, &ad7150_event_handler, IRQF_TRIGGER_RISING | - IRQF_TRIGGER_FALLING, + IRQF_TRIGGER_FALLING | + IRQF_ONESHOT, "ad7150_irq1", indio_dev); if (ret) @@ -598,7 +599,8 @@ static int __devinit ad7150_probe(struct i2c_client *client, NULL, &ad7150_event_handler, IRQF_TRIGGER_RISING | - IRQF_TRIGGER_FALLING, + IRQF_TRIGGER_FALLING | + IRQF_ONESHOT, "ad7150_irq2", indio_dev); if (ret) -- cgit v0.10.2 From 46b24311ccc8b37da9e6e006c6158229a5354268 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 3 Jul 2012 10:55:40 +0200 Subject: iio: Fix unitialized use of list The dev_attr list is initialized in __iio_add_event_config_attrs which is called only when indio_dev->channels is true. Nevertheless the list is used unconditionally later in iio_device_register_eventset which results in a NULL pointer exception. To fix this unconditionally initialize the list in iio_device_register_eventset. Signed-off-by: Sascha Hauer Signed-off-by: Jonathan Cameron diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c index b49059d..fa6543b 100644 --- a/drivers/iio/industrialio-event.c +++ b/drivers/iio/industrialio-event.c @@ -345,7 +345,6 @@ static inline int __iio_add_event_config_attrs(struct iio_dev *indio_dev) { int j, ret, attrcount = 0; - INIT_LIST_HEAD(&indio_dev->event_interface->dev_attr_list); /* Dynically created from the channels array */ for (j = 0; j < indio_dev->num_channels; j++) { ret = iio_device_add_event_sysfs(indio_dev, @@ -396,6 +395,8 @@ int iio_device_register_eventset(struct iio_dev *indio_dev) goto error_ret; } + INIT_LIST_HEAD(&indio_dev->event_interface->dev_attr_list); + iio_setup_ev_int(indio_dev->event_interface); if (indio_dev->info->event_attrs != NULL) { attr = indio_dev->info->event_attrs->attrs; -- cgit v0.10.2 From 3a427d184f22e0ebfbed1eb82114ece8fb58bd95 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 3 Jul 2012 11:21:26 +0200 Subject: staging iio adt7410: sysfs store function must return length Otherwise a write to the resolution entry never returns. Signed-off-by: Sascha Hauer Acked-by: Sonic Zhang Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/adc/adt7410.c b/drivers/staging/iio/adc/adt7410.c index a2defe6..9025161 100644 --- a/drivers/staging/iio/adc/adt7410.c +++ b/drivers/staging/iio/adc/adt7410.c @@ -257,7 +257,7 @@ static ssize_t adt7410_store_resolution(struct device *dev, chip->config = config; - return ret; + return len; } static IIO_DEVICE_ATTR(resolution, S_IRUGO | S_IWUSR, -- cgit v0.10.2 From 1764eff7d5d644310b87d7040c83fe5208c155f7 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 3 Jul 2012 11:21:27 +0200 Subject: staging iio adt7410: fix 13bit mode The driver assumes that in 13bit mode the 16bit value has to be shifted to the right by 3 bits. This is not true, in both 16bit and 13bit mode the MSB is at the same position. Currently the driver returns a temperature of 194 degrees Celsius in 13bit mode and 24 degrees Celsius in 16bit mode. Fix this by using the same algorithm for 16bit and 13bit mode and by just masking out the lower three bits in 13bit mode. Signed-off-by: Sascha Hauer Acked-by: Sonic Zhang Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/adc/adt7410.c b/drivers/staging/iio/adc/adt7410.c index 9025161..f87992c 100644 --- a/drivers/staging/iio/adc/adt7410.c +++ b/drivers/staging/iio/adc/adt7410.c @@ -293,26 +293,17 @@ static ssize_t adt7410_convert_temperature(struct adt7410_chip_info *chip, { char sign = ' '; - if (chip->config & ADT7410_RESOLUTION) { - if (data & ADT7410_T16_VALUE_SIGN) { - /* convert supplement to positive value */ - data = (u16)((ADT7410_T16_VALUE_SIGN << 1) - (u32)data); - sign = '-'; - } - return sprintf(buf, "%c%d.%.7d\n", sign, - (data >> ADT7410_T16_VALUE_FLOAT_OFFSET), - (data & ADT7410_T16_VALUE_FLOAT_MASK) * 78125); - } else { - if (data & ADT7410_T13_VALUE_SIGN) { - /* convert supplement to positive value */ - data >>= ADT7410_T13_VALUE_OFFSET; - data = (ADT7410_T13_VALUE_SIGN << 1) - data; - sign = '-'; - } - return sprintf(buf, "%c%d.%.4d\n", sign, - (data >> ADT7410_T13_VALUE_FLOAT_OFFSET), - (data & ADT7410_T13_VALUE_FLOAT_MASK) * 625); + if (!(chip->config & ADT7410_RESOLUTION)) + data &= ~0x7; + + if (data & ADT7410_T16_VALUE_SIGN) { + /* convert supplement to positive value */ + data = (u16)((ADT7410_T16_VALUE_SIGN << 1) - (u32)data); + sign = '-'; } + return sprintf(buf, "%c%d.%.7d\n", sign, + (data >> ADT7410_T16_VALUE_FLOAT_OFFSET), + (data & ADT7410_T16_VALUE_FLOAT_MASK) * 78125); } static ssize_t adt7410_show_value(struct device *dev, -- cgit v0.10.2 From abad65cbb2b53be39e8f55f9511cc53756860b1c Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 4 Jul 2012 17:09:00 +0100 Subject: staging:iio:ad7298: Do not return error code in interrupt handler The interrupt handler should only ever return one of the three irqreturn_t constants and not an error code. Also make sure to always call iio_trigger_notify_done before leaving the trigger handler. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/adc/ad7298_ring.c b/drivers/staging/iio/adc/ad7298_ring.c index cd3e9cb..fd1d855 100644 --- a/drivers/staging/iio/adc/ad7298_ring.c +++ b/drivers/staging/iio/adc/ad7298_ring.c @@ -82,7 +82,7 @@ static irqreturn_t ad7298_trigger_handler(int irq, void *p) b_sent = spi_sync(st->spi, &st->ring_msg); if (b_sent) - return b_sent; + goto done; if (indio_dev->scan_timestamp) { time_ns = iio_get_time_ns(); @@ -95,6 +95,8 @@ static irqreturn_t ad7298_trigger_handler(int irq, void *p) buf[i] = be16_to_cpu(st->rx_buf[i]); indio_dev->buffer->access->store_to(ring, (u8 *)buf, time_ns); + +done: iio_trigger_notify_done(indio_dev->trig); return IRQ_HANDLED; -- cgit v0.10.2 From a4eef3057dff597099673c42f8e3d0455deb9fe1 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 4 Jul 2012 17:09:00 +0100 Subject: staging:iio:adt7310: Do not return error code in interrupt handler The interrupt handler should only ever return one of the three irqreturn_t constants and not an error code. Also make sure to always call iio_trigger_notify_done before leaving the trigger handler. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/adc/adt7310.c b/drivers/staging/iio/adc/adt7310.c index 44dcf63..72460b6 100644 --- a/drivers/staging/iio/adc/adt7310.c +++ b/drivers/staging/iio/adc/adt7310.c @@ -397,7 +397,7 @@ static irqreturn_t adt7310_event_handler(int irq, void *private) ret = adt7310_spi_read_byte(chip, ADT7310_STATUS, &status); if (ret) - return ret; + goto done; if (status & ADT7310_STAT_T_HIGH) iio_push_event(indio_dev, @@ -417,6 +417,8 @@ static irqreturn_t adt7310_event_handler(int irq, void *private) IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING), timestamp); + +done: return IRQ_HANDLED; } -- cgit v0.10.2 From a1bdeefd7bccabb265fa9c74811008a8582c1c7d Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 4 Jul 2012 17:09:00 +0100 Subject: staging:iio:dummy driver: Do not return error code in interrupt handler The interrupt handler should only ever return one of the three irqreturn_t constants and not an error code. Also make sure to always call iio_trigger_notify_done before leaving the trigger handler. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/iio_simple_dummy_buffer.c b/drivers/staging/iio/iio_simple_dummy_buffer.c index b9e6093..c0951f9 100644 --- a/drivers/staging/iio/iio_simple_dummy_buffer.c +++ b/drivers/staging/iio/iio_simple_dummy_buffer.c @@ -52,7 +52,7 @@ static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p) data = kmalloc(indio_dev->scan_bytes, GFP_KERNEL); if (data == NULL) - return -ENOMEM; + goto done; if (!bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength)) { /* @@ -91,6 +91,7 @@ static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p) kfree(data); +done: /* * Tell the core we are done with this trigger and ready for the * next one. -- cgit v0.10.2 From f654a7e2b2106aec324f931fb802ffe191a460dd Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 4 Jul 2012 17:09:00 +0100 Subject: staging:iio:ad799x: Do not return error code in interrupt handler The interrupt handler should only ever return one of the three irqreturn_t constants and not an error code. Also make sure to always call iio_trigger_notify_done before leaving the trigger handler. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/adc/ad799x_core.c b/drivers/staging/iio/adc/ad799x_core.c index 2d4bda9..9900507 100644 --- a/drivers/staging/iio/adc/ad799x_core.c +++ b/drivers/staging/iio/adc/ad799x_core.c @@ -350,10 +350,10 @@ static irqreturn_t ad799x_event_handler(int irq, void *private) ret = ad799x_i2c_read8(st, AD7998_ALERT_STAT_REG, &status); if (ret) - return ret; + goto done; if (!status) - return -EIO; + goto done; ad799x_i2c_write8(st, AD7998_ALERT_STAT_REG, AD7998_ALERT_STAT_CLEAR); @@ -372,6 +372,7 @@ static irqreturn_t ad799x_event_handler(int irq, void *private) iio_get_time_ns()); } +done: return IRQ_HANDLED; } diff --git a/drivers/staging/iio/adc/ad799x_ring.c b/drivers/staging/iio/adc/ad799x_ring.c index 0882c9e..858a685 100644 --- a/drivers/staging/iio/adc/ad799x_ring.c +++ b/drivers/staging/iio/adc/ad799x_ring.c @@ -81,8 +81,6 @@ static irqreturn_t ad799x_trigger_handler(int irq, void *p) ring->access->store_to(indio_dev->buffer, rxbuf, time_ns); done: kfree(rxbuf); - if (b_sent < 0) - return b_sent; out: iio_trigger_notify_done(indio_dev->trig); -- cgit v0.10.2 From 9c586a4ce57b0ac1fbfbc378cd61c7274b703393 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 4 Jul 2012 17:09:00 +0100 Subject: staging:iio:ad7476: Do not return error code in interrupt handler The interrupt handler should only ever return one of the three irqreturn_t constants and not an error code. Also make sure to always call iio_trigger_notify_done before leaving the trigger handler. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/adc/ad7476_ring.c b/drivers/staging/iio/adc/ad7476_ring.c index 10f8b8d..d087b21 100644 --- a/drivers/staging/iio/adc/ad7476_ring.c +++ b/drivers/staging/iio/adc/ad7476_ring.c @@ -31,7 +31,7 @@ static irqreturn_t ad7476_trigger_handler(int irq, void *p) rxbuf = kzalloc(indio_dev->scan_bytes, GFP_KERNEL); if (rxbuf == NULL) - return -ENOMEM; + goto done; b_sent = spi_read(st->spi, rxbuf, st->chip_info->channel[0].scan_type.storagebits / 8); -- cgit v0.10.2 From 46b2495cc79484769e6c9364bf8f2e8b8e9de1aa Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 4 Jul 2012 17:09:00 +0100 Subject: staging:iio:ad7887: Do not return error code in interrupt handler The interrupt handler should only ever return one of the three irqreturn_t constants and not an error code. Also make sure to always call iio_trigger_notify_done before leaving the trigger handler. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/adc/ad7887_ring.c b/drivers/staging/iio/adc/ad7887_ring.c index 1c406da..c76fdb5 100644 --- a/drivers/staging/iio/adc/ad7887_ring.c +++ b/drivers/staging/iio/adc/ad7887_ring.c @@ -82,7 +82,7 @@ static irqreturn_t ad7887_trigger_handler(int irq, void *p) buf = kzalloc(indio_dev->scan_bytes, GFP_KERNEL); if (buf == NULL) - return -ENOMEM; + goto done; b_sent = spi_sync(st->spi, st->ring_msg); if (b_sent) -- cgit v0.10.2 From da0f01e1ed88b4ac650d884e4e2ee11c9cd4d83b Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 4 Jul 2012 17:09:00 +0100 Subject: staging:iio:max1363: Do not return error code in interrupt handler The interrupt handler should only ever return one of the three irqreturn_t constants and not an error code. Also make sure to always call iio_trigger_notify_done before leaving the trigger handler. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/adc/max1363_ring.c b/drivers/staging/iio/adc/max1363_ring.c index b302013..bf6b0c2 100644 --- a/drivers/staging/iio/adc/max1363_ring.c +++ b/drivers/staging/iio/adc/max1363_ring.c @@ -64,11 +64,11 @@ static irqreturn_t max1363_trigger_handler(int irq, void *p) * no harm. */ if (numvals == 0) - return IRQ_HANDLED; + goto done; rxbuf = kmalloc(d_size, GFP_KERNEL); if (rxbuf == NULL) - return -ENOMEM; + goto done; if (st->chip_info->bits != 8) b_sent = i2c_master_recv(st->client, rxbuf, numvals*2); else -- cgit v0.10.2 From 0b30246ef17c2e37819068aec3d5eac4ac06b562 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 4 Jul 2012 17:09:00 +0100 Subject: staging:iio:lis3l02dq: Do not return error code in interrupt handler The interrupt handler should only ever return one of the three irqreturn_t constants and not an error code. Also make sure to always call iio_trigger_notify_done before leaving the trigger handler. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c index 51b00df..d7f8af7 100644 --- a/drivers/staging/iio/accel/lis3l02dq_ring.c +++ b/drivers/staging/iio/accel/lis3l02dq_ring.c @@ -143,7 +143,7 @@ static irqreturn_t lis3l02dq_trigger_handler(int irq, void *p) if (data == NULL) { dev_err(indio_dev->dev.parent, "memory alloc failed in buffer bh"); - return -ENOMEM; + goto done; } if (!bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength)) @@ -156,8 +156,9 @@ static irqreturn_t lis3l02dq_trigger_handler(int irq, void *p) = pf->timestamp; buffer->access->store_to(buffer, (u8 *)data, pf->timestamp); - iio_trigger_notify_done(indio_dev->trig); kfree(data); +done: + iio_trigger_notify_done(indio_dev->trig); return IRQ_HANDLED; } -- cgit v0.10.2 From 67bd5e26d44a5282d46719325b25deedebc39b2e Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 4 Jul 2012 17:09:00 +0100 Subject: staging:iio:accel:adis16xxx: Do not return error code in the interrupt handler The interrupt handler should only ever return one of the three irqreturn_t constants and not an error code. Also make sure to always call iio_trigger_notify_done before leaving the trigger handler. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/accel/adis16201_ring.c b/drivers/staging/iio/accel/adis16201_ring.c index 247602a..03fcf6e 100644 --- a/drivers/staging/iio/accel/adis16201_ring.c +++ b/drivers/staging/iio/accel/adis16201_ring.c @@ -70,7 +70,7 @@ static irqreturn_t adis16201_trigger_handler(int irq, void *p) data = kmalloc(indio_dev->scan_bytes, GFP_KERNEL); if (data == NULL) { dev_err(&st->us->dev, "memory alloc failed in ring bh"); - return -ENOMEM; + goto done; } if (!bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength) @@ -85,8 +85,9 @@ static irqreturn_t adis16201_trigger_handler(int irq, void *p) ring->access->store_to(ring, (u8 *)data, pf->timestamp); - iio_trigger_notify_done(indio_dev->trig); kfree(data); +done: + iio_trigger_notify_done(indio_dev->trig); return IRQ_HANDLED; } diff --git a/drivers/staging/iio/accel/adis16203_ring.c b/drivers/staging/iio/accel/adis16203_ring.c index 7bbd2c2..c16b2b7 100644 --- a/drivers/staging/iio/accel/adis16203_ring.c +++ b/drivers/staging/iio/accel/adis16203_ring.c @@ -69,7 +69,7 @@ static irqreturn_t adis16203_trigger_handler(int irq, void *p) data = kmalloc(indio_dev->scan_bytes, GFP_KERNEL); if (data == NULL) { dev_err(&st->us->dev, "memory alloc failed in ring bh"); - return -ENOMEM; + goto done; } if (!bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength) && @@ -86,8 +86,9 @@ static irqreturn_t adis16203_trigger_handler(int irq, void *p) (u8 *)data, pf->timestamp); - iio_trigger_notify_done(indio_dev->trig); kfree(data); +done: + iio_trigger_notify_done(indio_dev->trig); return IRQ_HANDLED; } diff --git a/drivers/staging/iio/accel/adis16204_ring.c b/drivers/staging/iio/accel/adis16204_ring.c index f73518b..1d2b31c 100644 --- a/drivers/staging/iio/accel/adis16204_ring.c +++ b/drivers/staging/iio/accel/adis16204_ring.c @@ -66,7 +66,7 @@ static irqreturn_t adis16204_trigger_handler(int irq, void *p) data = kmalloc(indio_dev->scan_bytes, GFP_KERNEL); if (data == NULL) { dev_err(&st->us->dev, "memory alloc failed in ring bh"); - return -ENOMEM; + goto done; } if (!bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength) && @@ -81,8 +81,9 @@ static irqreturn_t adis16204_trigger_handler(int irq, void *p) ring->access->store_to(ring, (u8 *)data, pf->timestamp); - iio_trigger_notify_done(indio_dev->trig); kfree(data); +done: + iio_trigger_notify_done(indio_dev->trig); return IRQ_HANDLED; } diff --git a/drivers/staging/iio/accel/adis16209_ring.c b/drivers/staging/iio/accel/adis16209_ring.c index 0906075..1a4a55c 100644 --- a/drivers/staging/iio/accel/adis16209_ring.c +++ b/drivers/staging/iio/accel/adis16209_ring.c @@ -66,7 +66,7 @@ static irqreturn_t adis16209_trigger_handler(int irq, void *p) data = kmalloc(indio_dev->scan_bytes, GFP_KERNEL); if (data == NULL) { dev_err(&st->us->dev, "memory alloc failed in ring bh"); - return -ENOMEM; + goto done; } if (!bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength) && @@ -81,8 +81,9 @@ static irqreturn_t adis16209_trigger_handler(int irq, void *p) ring->access->store_to(ring, (u8 *)data, pf->timestamp); - iio_trigger_notify_done(indio_dev->trig); kfree(data); +done: + iio_trigger_notify_done(indio_dev->trig); return IRQ_HANDLED; } diff --git a/drivers/staging/iio/accel/adis16240_ring.c b/drivers/staging/iio/accel/adis16240_ring.c index 86a2a47..360dfed 100644 --- a/drivers/staging/iio/accel/adis16240_ring.c +++ b/drivers/staging/iio/accel/adis16240_ring.c @@ -64,7 +64,7 @@ static irqreturn_t adis16240_trigger_handler(int irq, void *p) data = kmalloc(indio_dev->scan_bytes, GFP_KERNEL); if (data == NULL) { dev_err(&st->us->dev, "memory alloc failed in ring bh"); - return -ENOMEM; + goto done; } if (!bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength) && @@ -79,8 +79,9 @@ static irqreturn_t adis16240_trigger_handler(int irq, void *p) ring->access->store_to(ring, (u8 *)data, pf->timestamp); - iio_trigger_notify_done(indio_dev->trig); kfree(data); +done: + iio_trigger_notify_done(indio_dev->trig); return IRQ_HANDLED; } -- cgit v0.10.2 From b82ed7d6805ef2a31503999edc80787083d4426f Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 4 Jul 2012 17:09:00 +0100 Subject: staging:iio:adis16260: Do not return error code in the interrupt handler The interrupt handler should only ever return one of the three irqreturn_t constants and not an error code. Also make sure to always call iio_trigger_notify_done before leaving the trigger handler. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/gyro/adis16260_ring.c b/drivers/staging/iio/gyro/adis16260_ring.c index 0fe2d9d..eeee8e7 100644 --- a/drivers/staging/iio/gyro/adis16260_ring.c +++ b/drivers/staging/iio/gyro/adis16260_ring.c @@ -69,7 +69,7 @@ static irqreturn_t adis16260_trigger_handler(int irq, void *p) data = kmalloc(indio_dev->scan_bytes, GFP_KERNEL); if (data == NULL) { dev_err(&st->us->dev, "memory alloc failed in ring bh"); - return -ENOMEM; + goto done; } if (!bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength) && @@ -84,8 +84,9 @@ static irqreturn_t adis16260_trigger_handler(int irq, void *p) ring->access->store_to(ring, (u8 *)data, pf->timestamp); - iio_trigger_notify_done(indio_dev->trig); kfree(data); +done: + iio_trigger_notify_done(indio_dev->trig); return IRQ_HANDLED; } -- cgit v0.10.2 From 462c8d27940d1d41f76091544245b0af11b64c81 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 4 Jul 2012 17:09:00 +0100 Subject: staging:iio:adis16400: Do not return error code in the interrupt handler The interrupt handler should only ever return one of the three irqreturn_t constants and not an error code. Also make sure to always call iio_trigger_notify_done before leaving the trigger handler. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/imu/adis16400_ring.c b/drivers/staging/iio/imu/adis16400_ring.c index 809e2c4..beec650 100644 --- a/drivers/staging/iio/imu/adis16400_ring.c +++ b/drivers/staging/iio/imu/adis16400_ring.c @@ -125,20 +125,20 @@ static irqreturn_t adis16400_trigger_handler(int irq, void *p) data = kmalloc(indio_dev->scan_bytes, GFP_KERNEL); if (data == NULL) { dev_err(&st->us->dev, "memory alloc failed in ring bh"); - return -ENOMEM; + goto done; } if (scan_count) { if (st->variant->flags & ADIS16400_NO_BURST) { ret = adis16350_spi_read_all(indio_dev, st->rx); if (ret < 0) - goto err; + goto done; for (; i < scan_count; i++) data[i] = *(s16 *)(st->rx + i*2); } else { ret = adis16400_spi_read_burst(indio_dev, st->rx); if (ret < 0) - goto err; + goto done; for (; i < scan_count; i++) { j = __ffs(mask); mask &= ~(1 << j); @@ -152,14 +152,11 @@ static irqreturn_t adis16400_trigger_handler(int irq, void *p) *((s64 *)(data + ((i + 3)/4)*4)) = pf->timestamp; ring->access->store_to(indio_dev->buffer, (u8 *) data, pf->timestamp); +done: + kfree(data); iio_trigger_notify_done(indio_dev->trig); - kfree(data); return IRQ_HANDLED; - -err: - kfree(data); - return ret; } void adis16400_unconfigure_ring(struct iio_dev *indio_dev) -- cgit v0.10.2 From 7b7627410e2c211f24787f61e6419e16d259aa13 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Sat, 30 Jun 2012 13:55:23 +0100 Subject: iio: Fix inkern remove incorrect put of device The device_get is after this point so on error we should not be removing it. Signed-off-by: Jonathan Cameron diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index 9a46ca6..e2aded0 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c @@ -193,7 +193,6 @@ struct iio_channel *iio_channel_get_all(const char *name) c->map->adc_channel_label); if (chans[mapind].channel == NULL) { ret = -EINVAL; - iio_device_put(chans[mapind].indio_dev); goto error_free_chans; } iio_device_get(chans[mapind].indio_dev); -- cgit v0.10.2 From 939546d1a9f47ed169554c711e1e05965b84ffe1 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 9 Jul 2012 10:00:00 +0100 Subject: iio: Add callback to check whether a scan mask is valid This is useful for cases where the number of valid scan masks grows exponentially, but it is rather easy to check whether a mask is valid or not programmatically. An example of such a case is a device with multiple ADCs where each ADC has a upstream MUX, which allows to select from a number of physical channels. +-------+ +-------+ | | | | --- Channel 1 | ADC 1 |---| MUX 1 | --- ... | | | | --- Channel M +-------+ +-------+ . . . . . . . . . +-------+ +-------+ | | | | --- Channel M * N + 1 | ADC N |---| MUX N | --- ... | | | | --- Channel M * N + M +-------+ +-------+ The number of necessary scan masks for this case is (M+1)**N - 1, on the other hand it is easy to check whether subsets for each ADC of the scanmask have only one bit set. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index 3d8d187..cc5db36 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -570,6 +570,15 @@ int iio_sw_buffer_preenable(struct iio_dev *indio_dev) } EXPORT_SYMBOL(iio_sw_buffer_preenable); +static bool iio_validate_scan_mask(struct iio_dev *indio_dev, + const unsigned long *mask) +{ + if (!indio_dev->setup_ops->validate_scan_mask) + return true; + + return indio_dev->setup_ops->validate_scan_mask(indio_dev, mask); +} + /** * iio_scan_mask_set() - set particular bit in the scan mask * @buffer: the buffer whose scan mask we are interested in @@ -589,27 +598,31 @@ int iio_scan_mask_set(struct iio_dev *indio_dev, return -ENOMEM; if (!indio_dev->masklength) { WARN_ON("trying to set scanmask prior to registering buffer\n"); - kfree(trialmask); - return -EINVAL; + goto err_invalid_mask; } bitmap_copy(trialmask, buffer->scan_mask, indio_dev->masklength); set_bit(bit, trialmask); + if (!iio_validate_scan_mask(indio_dev, trialmask)) + goto err_invalid_mask; + if (indio_dev->available_scan_masks) { mask = iio_scan_mask_match(indio_dev->available_scan_masks, indio_dev->masklength, trialmask); - if (!mask) { - kfree(trialmask); - return -EINVAL; - } + if (!mask) + goto err_invalid_mask; } bitmap_copy(buffer->scan_mask, trialmask, indio_dev->masklength); kfree(trialmask); return 0; -}; + +err_invalid_mask: + kfree(trialmask); + return -EINVAL; +} EXPORT_SYMBOL_GPL(iio_scan_mask_set); int iio_scan_mask_query(struct iio_dev *indio_dev, diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index 2afbb6f..be82936 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h @@ -363,12 +363,16 @@ struct iio_info { * @predisable: [DRIVER] function to run prior to marking buffer * disabled * @postdisable: [DRIVER] function to run after marking buffer disabled + * @validate_scan_mask: [DRIVER] function callback to check whether a given + * scan mask is valid for the device. */ struct iio_buffer_setup_ops { int (*preenable)(struct iio_dev *); int (*postenable)(struct iio_dev *); int (*predisable)(struct iio_dev *); int (*postdisable)(struct iio_dev *); + bool (*validate_scan_mask)(struct iio_dev *indio_dev, + const unsigned long *scan_mask); }; /** -- cgit v0.10.2 From 81636632057cc1bece2531220dd5803036f95ea9 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 9 Jul 2012 10:00:00 +0100 Subject: iio: Introduce iio_validate_scan_mask_onehot Add a helper function for validating a scan mask for devices where exactly one channel must be selected during sampling. This is a common case among devices which have scan mask restrictions so it makes sense to provide this function in the core. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index cc5db36..8c1dc9a 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -570,6 +570,22 @@ int iio_sw_buffer_preenable(struct iio_dev *indio_dev) } EXPORT_SYMBOL(iio_sw_buffer_preenable); +/** + * iio_validate_scan_mask_onehot() - Validates that exactly one channel is selected + * @indio_dev: the iio device + * @mask: scan mask to be checked + * + * Return true if exactly one bit is set in the scan mask, false otherwise. It + * can be used for devices where only one channel can be active for sampling at + * a time. + */ +bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev, + const unsigned long *mask) +{ + return bitmap_weight(mask, indio_dev->masklength) == 1; +} +EXPORT_SYMBOL_GPL(iio_validate_scan_mask_onehot); + static bool iio_validate_scan_mask(struct iio_dev *indio_dev, const unsigned long *mask) { diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h index 2a2b6b4..8ba516f 100644 --- a/include/linux/iio/buffer.h +++ b/include/linux/iio/buffer.h @@ -177,6 +177,9 @@ ssize_t iio_buffer_show_enable(struct device *dev, int iio_sw_buffer_preenable(struct iio_dev *indio_dev); +bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev, + const unsigned long *mask); + #else /* CONFIG_IIO_BUFFER */ static inline int iio_buffer_register(struct iio_dev *indio_dev, -- cgit v0.10.2 From f6aea5543021c341f0397b191243fecca98ac595 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 9 Jul 2012 10:00:00 +0100 Subject: staging:iio:ad7192: Use iio_validate_scan_mask_onehot Only one of the channels of the ad7192 may be sampled at a time. Use the new validate_scan_mask callback and the iio_validate_scan_mask_onehot function to implement this restriction. Previously this was implemented using available_scan_masks, but this requires a individual scan mask for each channel. Also the previous code was adding the scan index of the timestamp channel to each available scan mask, this is not required though since the timestamp channel is not restricted by the available scan masks and can be enabled or disabled independently. So the new code does not have to take care of this. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c index 839f17c4..22c3923 100644 --- a/drivers/staging/iio/adc/ad7192.c +++ b/drivers/staging/iio/adc/ad7192.c @@ -146,7 +146,6 @@ struct ad7192_state { u32 mode; u32 conf; u32 scale_avail[8][2]; - long available_scan_masks[9]; u8 gpocon; u8 devid; /* @@ -538,6 +537,7 @@ static const struct iio_buffer_setup_ops ad7192_ring_setup_ops = { .postenable = &iio_triggered_buffer_postenable, .predisable = &iio_triggered_buffer_predisable, .postdisable = &ad7192_ring_postdisable, + .validate_scan_mask = &iio_validate_scan_mask_onehot, }; static int ad7192_register_ring_funcs_and_init(struct iio_dev *indio_dev) @@ -984,7 +984,7 @@ static int __devinit ad7192_probe(struct spi_device *spi) struct ad7192_platform_data *pdata = spi->dev.platform_data; struct ad7192_state *st; struct iio_dev *indio_dev; - int ret, i , voltage_uv = 0; + int ret , voltage_uv = 0; if (!pdata) { dev_err(&spi->dev, "no platform data?\n"); @@ -1028,17 +1028,11 @@ static int __devinit ad7192_probe(struct spi_device *spi) indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->channels = ad7192_channels; indio_dev->num_channels = ARRAY_SIZE(ad7192_channels); - indio_dev->available_scan_masks = st->available_scan_masks; if (st->devid == ID_AD7195) indio_dev->info = &ad7195_info; else indio_dev->info = &ad7192_info; - for (i = 0; i < indio_dev->num_channels; i++) - st->available_scan_masks[i] = (1 << i) | (1 << - indio_dev->channels[indio_dev->num_channels - 1]. - scan_index); - init_waitqueue_head(&st->wq_data_avail); ret = ad7192_register_ring_funcs_and_init(indio_dev); -- cgit v0.10.2 From 8c2c6ba6aa8f187b465fab13627566311a0c03fb Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 9 Jul 2012 10:00:00 +0100 Subject: staging:iio:ad7793: Use iio_validate_scan_mask_onehot Only one of the channels of the ad7793 may be sampled at a time. Use the new validate_scan_mask callback and the iio_validate_scan_mask_onehot function to implement this restriction. Previously this was implemented using available_scan_masks, but this requires a individual scan mask for each channel. Also the previous code was adding the scan index of the timestamp channel to each available scan mask, this is not required though since the timestamp channel is not restricted by the available scan masks and can be enabled or disabled independently. So the new code does not have to take care of this. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/adc/ad7793.c b/drivers/staging/iio/adc/ad7793.c index eaa0cc9..76fdd71 100644 --- a/drivers/staging/iio/adc/ad7793.c +++ b/drivers/staging/iio/adc/ad7793.c @@ -52,8 +52,7 @@ struct ad7793_state { u16 mode; u16 conf; u32 scale_avail[8][2]; - /* Note this uses fact that 8 the mask always fits in a long */ - unsigned long available_scan_masks[7]; + /* * DMA (thus cache coherency maintenance) requires the * transfer buffers to live in their own cache lines. @@ -403,6 +402,7 @@ static const struct iio_buffer_setup_ops ad7793_ring_setup_ops = { .postenable = &iio_triggered_buffer_postenable, .predisable = &iio_triggered_buffer_predisable, .postdisable = &ad7793_ring_postdisable, + .validate_scan_mask = &iio_validate_scan_mask_onehot, }; static int ad7793_register_ring_funcs_and_init(struct iio_dev *indio_dev) @@ -864,7 +864,7 @@ static int __devinit ad7793_probe(struct spi_device *spi) struct ad7793_platform_data *pdata = spi->dev.platform_data; struct ad7793_state *st; struct iio_dev *indio_dev; - int ret, i, voltage_uv = 0; + int ret, voltage_uv = 0; if (!pdata) { dev_err(&spi->dev, "no platform data?\n"); @@ -910,17 +910,9 @@ static int __devinit ad7793_probe(struct spi_device *spi) indio_dev->name = spi_get_device_id(spi)->name; indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->channels = st->chip_info->channel; - indio_dev->available_scan_masks = st->available_scan_masks; indio_dev->num_channels = 7; indio_dev->info = &ad7793_info; - for (i = 0; i < indio_dev->num_channels; i++) { - set_bit(i, &st->available_scan_masks[i]); - set_bit(indio_dev-> - channels[indio_dev->num_channels - 1].scan_index, - &st->available_scan_masks[i]); - } - init_waitqueue_head(&st->wq_data_avail); ret = ad7793_register_ring_funcs_and_init(indio_dev); -- cgit v0.10.2 From ee0312a05ddceb0fc871f39b8f56b4cabc5176aa Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 9 Jul 2012 10:00:00 +0100 Subject: staging:iio:ade7758: Use iio_validate_scan_mask_onehot Only one of the channels of the ade7758 may be sampled at a time. Use the new validate_scan_mask callback and the iio_validate_scan_mask_onehot function to implement this restriction. Previously this was implemented using available_scan_masks, but this requires a individual scan mask for each channel. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/meter/ade7758.h b/drivers/staging/iio/meter/ade7758.h index bdd1b05..ec202b4 100644 --- a/drivers/staging/iio/meter/ade7758.h +++ b/drivers/staging/iio/meter/ade7758.h @@ -122,7 +122,6 @@ struct ade7758_state { u8 *tx; u8 *rx; struct mutex buf_lock; - unsigned long available_scan_masks[AD7758_NUM_WAVESRC]; struct iio_chan_spec *ade7758_ring_channels; struct spi_transfer ring_xfer[4]; struct spi_message ring_msg; diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c index 96d6114..7014a00 100644 --- a/drivers/staging/iio/meter/ade7758_core.c +++ b/drivers/staging/iio/meter/ade7758_core.c @@ -883,7 +883,7 @@ static const struct iio_info ade7758_info = { static int __devinit ade7758_probe(struct spi_device *spi) { - int i, ret; + int ret; struct ade7758_state *st; struct iio_dev *indio_dev = iio_device_alloc(sizeof(*st)); @@ -916,11 +916,6 @@ static int __devinit ade7758_probe(struct spi_device *spi) indio_dev->info = &ade7758_info; indio_dev->modes = INDIO_DIRECT_MODE; - for (i = 0; i < AD7758_NUM_WAVESRC; i++) - set_bit(i, &st->available_scan_masks[i]); - - indio_dev->available_scan_masks = st->available_scan_masks; - ret = ade7758_configure_ring(indio_dev); if (ret) goto error_free_tx; diff --git a/drivers/staging/iio/meter/ade7758_ring.c b/drivers/staging/iio/meter/ade7758_ring.c index 92159f2..1ce10b2 100644 --- a/drivers/staging/iio/meter/ade7758_ring.c +++ b/drivers/staging/iio/meter/ade7758_ring.c @@ -114,6 +114,7 @@ static const struct iio_buffer_setup_ops ade7758_ring_setup_ops = { .preenable = &ade7758_ring_preenable, .postenable = &iio_triggered_buffer_postenable, .predisable = &iio_triggered_buffer_predisable, + .validate_scan_mask = &iio_validate_scan_mask_onehot, }; void ade7758_unconfigure_ring(struct iio_dev *indio_dev) -- cgit v0.10.2 From 47ec4ed2d23ff3a93f9f575295f17bdaf3d2cec9 Mon Sep 17 00:00:00 2001 From: Emil Goode Date: Sat, 7 Jul 2012 20:44:49 +0200 Subject: staging: CSR: fix function declaration warnings Sparse is warning about non-ANSI function declaration. Add void to the parameterless function. drivers/staging/csr/csr_wifi_hip_chiphelper.c:633:31: warning: non-ANSI function declaration of function 'ChipHelper_Null' I also fixed this checkpatch error: ERROR: "foo* bar" should be "foo *bar" Signed-off-by: Emil Goode Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper.c b/drivers/staging/csr/csr_wifi_hip_chiphelper.c index 0e2477f..a3148d8 100644 --- a/drivers/staging/csr/csr_wifi_hip_chiphelper.c +++ b/drivers/staging/csr/csr_wifi_hip_chiphelper.c @@ -630,7 +630,7 @@ ChipDescript* ChipHelper_GetVersionUniFi(CsrUint16 ver) } -ChipDescript* ChipHelper_Null() +ChipDescript *ChipHelper_Null(void) { return &chip_device_desc_null; } -- cgit v0.10.2 From 30453529bc17161fd863093ebf7a4bfce9820159 Mon Sep 17 00:00:00 2001 From: Xiao Guangrong Date: Tue, 26 Jun 2012 16:49:46 +0800 Subject: staging: zcache: fix refcount leak In zcache_get_pool_by_id, the refcount of zcache_host is not increased, but it is always decreased in zcache_put_pool Acked-by: Seth Jennings Signed-off-by: Xiao Guangrong Acked-by: Konrad Rzeszutek Wilk Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index c9e08bb..55fbe3d 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c @@ -946,8 +946,9 @@ static struct tmem_pool *zcache_get_pool_by_id(uint16_t cli_id, uint16_t poolid) cli = &zcache_clients[cli_id]; if (cli == NULL) goto out; - atomic_inc(&cli->refcount); } + + atomic_inc(&cli->refcount); pool = idr_find(&cli->tmem_pools, poolid); if (pool != NULL) atomic_inc(&pool->refcount); -- cgit v0.10.2 From a16554474f772ea857bf193608231a735e01cccc Mon Sep 17 00:00:00 2001 From: Xiao Guangrong Date: Tue, 26 Jun 2012 16:50:10 +0800 Subject: staging: zcache: fix a compile warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix: drivers/staging/zcache/zcache-main.c: In function ‘zcache_comp_op’: drivers/staging/zcache/zcache-main.c:112:2: warning: ‘ret’ may be used uninitial Signed-off-by: Xiao Guangrong Acked-by: Konrad Rzeszutek Wilk Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index 55fbe3d..58e7bd4 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c @@ -109,6 +109,8 @@ static inline int zcache_comp_op(enum comp_op op, case ZCACHE_COMPOP_DECOMPRESS: ret = crypto_comp_decompress(tfm, src, slen, dst, dlen); break; + default: + ret = -EINVAL; } put_cpu(); return ret; -- cgit v0.10.2 From f64d94f9f7536842a120f6eef4cfd4cfcd516f5e Mon Sep 17 00:00:00 2001 From: Xiao Guangrong Date: Tue, 26 Jun 2012 16:50:31 +0800 Subject: staging: zcache: remove unnecessary config option dependence zcache is enabled only if one of CONFIG_CLEANCACHE and CONFIG_FRONTSWAP is enabled, see the Kconfig: depends on (CLEANCACHE || FRONTSWAP) && CRYPTO=y && X86 So, we can remove the check in the source code Acked-by: Seth Jennings Signed-off-by: Xiao Guangrong Acked-by: Konrad Rzeszutek Wilk Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index 58e7bd4..36c3b05 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c @@ -36,9 +36,6 @@ #include "../zsmalloc/zsmalloc.h" -#if (!defined(CONFIG_CLEANCACHE) && !defined(CONFIG_FRONTSWAP)) -#error "zcache is useless without CONFIG_CLEANCACHE or CONFIG_FRONTSWAP" -#endif #ifdef CONFIG_CLEANCACHE #include #endif @@ -2028,7 +2025,7 @@ static int __init zcache_init(void) goto out; } #endif /* CONFIG_SYSFS */ -#if defined(CONFIG_CLEANCACHE) || defined(CONFIG_FRONTSWAP) + if (zcache_enabled) { unsigned int cpu; @@ -2059,7 +2056,7 @@ static int __init zcache_init(void) pr_err("zcache: can't create client\n"); goto out; } -#endif + #ifdef CONFIG_CLEANCACHE if (zcache_enabled && use_cleancache) { struct cleancache_ops old_ops; -- cgit v0.10.2 From 2ad0f81c588a7a4e0fb685cbd2246b4907401784 Mon Sep 17 00:00:00 2001 From: Xiao Guangrong Date: Tue, 26 Jun 2012 16:50:50 +0800 Subject: staging: zcache: mark zbud_init/zcache_comp_init as __init These functions are called only when system is initializing, so mark __init for them to free memory Acked-by: Seth Jennings Signed-off-by: Xiao Guangrong Acked-by: Konrad Rzeszutek Wilk Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index 36c3b05..a77cacb 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c @@ -600,7 +600,7 @@ out: return; } -static void zbud_init(void) +static void __init zbud_init(void) { int i; @@ -1985,7 +1985,7 @@ static int __init enable_zcache_compressor(char *s) __setup("zcache=", enable_zcache_compressor); -static int zcache_comp_init(void) +static int __init zcache_comp_init(void) { int ret = 0; -- cgit v0.10.2 From dc2f9a5d3d0a7a6c0e1a891c70ed2171869dd78d Mon Sep 17 00:00:00 2001 From: Xiao Guangrong Date: Tue, 26 Jun 2012 16:51:10 +0800 Subject: staging: zcache: cleanup zbud_init Need not set global parameters to 0 Acked-by: Seth Jennings Signed-off-by: Xiao Guangrong Acked-by: Konrad Rzeszutek Wilk Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index a77cacb..0529b46 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c @@ -605,11 +605,9 @@ static void __init zbud_init(void) int i; INIT_LIST_HEAD(&zbud_buddied_list); - zcache_zbud_buddied_count = 0; - for (i = 0; i < NCHUNKS; i++) { + + for (i = 0; i < NCHUNKS; i++) INIT_LIST_HEAD(&zbud_unbuddied[i].list); - zbud_unbuddied[i].count = 0; - } } #ifdef CONFIG_SYSFS -- cgit v0.10.2 From 79c0d92c5b6175c1462fbe38bf44180f325aa478 Mon Sep 17 00:00:00 2001 From: Xiao Guangrong Date: Tue, 26 Jun 2012 16:51:34 +0800 Subject: staging: zcache: optimize zcache_do_preload zcache_do_preload is called in zcache_put_page where IRQ is disabled, so, need not care preempt Acked-by: Seth Jennings Signed-off-by: Xiao Guangrong Acked-by: Konrad Rzeszutek Wilk Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index 0529b46..57e25fc 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c @@ -1031,45 +1031,43 @@ static int zcache_do_preload(struct tmem_pool *pool) goto out; if (unlikely(zcache_obj_cache == NULL)) goto out; - preempt_disable(); + + /* IRQ has already been disabled. */ kp = &__get_cpu_var(zcache_preloads); while (kp->nr < ARRAY_SIZE(kp->objnodes)) { - preempt_enable_no_resched(); objnode = kmem_cache_alloc(zcache_objnode_cache, ZCACHE_GFP_MASK); if (unlikely(objnode == NULL)) { zcache_failed_alloc++; goto out; } - preempt_disable(); - kp = &__get_cpu_var(zcache_preloads); - if (kp->nr < ARRAY_SIZE(kp->objnodes)) - kp->objnodes[kp->nr++] = objnode; - else - kmem_cache_free(zcache_objnode_cache, objnode); + + kp->objnodes[kp->nr++] = objnode; } - preempt_enable_no_resched(); + obj = kmem_cache_alloc(zcache_obj_cache, ZCACHE_GFP_MASK); if (unlikely(obj == NULL)) { zcache_failed_alloc++; goto out; } + page = (void *)__get_free_page(ZCACHE_GFP_MASK); if (unlikely(page == NULL)) { zcache_failed_get_free_pages++; kmem_cache_free(zcache_obj_cache, obj); goto out; } - preempt_disable(); - kp = &__get_cpu_var(zcache_preloads); + if (kp->obj == NULL) kp->obj = obj; else kmem_cache_free(zcache_obj_cache, obj); + if (kp->page == NULL) kp->page = page; else free_page((unsigned long)page); + ret = 0; out: return ret; @@ -1580,7 +1578,6 @@ static int zcache_put_page(int cli_id, int pool_id, struct tmem_oid *oidp, zcache_failed_pers_puts++; } zcache_put_pool(pool); - preempt_enable_no_resched(); } else { zcache_put_to_flush++; if (atomic_read(&pool->obj_count) > 0) -- cgit v0.10.2 From b71f3bcc5ab5e76a22d7ad82b3795602fcf0e0af Mon Sep 17 00:00:00 2001 From: Xiao Guangrong Date: Tue, 26 Jun 2012 16:51:55 +0800 Subject: staging: zcache: cleanup zcache_do_preload and zcache_put_page Cleanup the code for zcache_do_preload and zcache_put_page Acked-by: Seth Jennings Signed-off-by: Xiao Guangrong Acked-by: Konrad Rzeszutek Wilk Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index 57e25fc..fbd9bcf 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c @@ -1045,29 +1045,24 @@ static int zcache_do_preload(struct tmem_pool *pool) kp->objnodes[kp->nr++] = objnode; } - obj = kmem_cache_alloc(zcache_obj_cache, ZCACHE_GFP_MASK); - if (unlikely(obj == NULL)) { - zcache_failed_alloc++; - goto out; + if (!kp->obj) { + obj = kmem_cache_alloc(zcache_obj_cache, ZCACHE_GFP_MASK); + if (unlikely(obj == NULL)) { + zcache_failed_alloc++; + goto out; + } + kp->obj = obj; } - page = (void *)__get_free_page(ZCACHE_GFP_MASK); - if (unlikely(page == NULL)) { - zcache_failed_get_free_pages++; - kmem_cache_free(zcache_obj_cache, obj); - goto out; + if (!kp->page) { + page = (void *)__get_free_page(ZCACHE_GFP_MASK); + if (unlikely(page == NULL)) { + zcache_failed_get_free_pages++; + goto out; + } + kp->page = page; } - if (kp->obj == NULL) - kp->obj = obj; - else - kmem_cache_free(zcache_obj_cache, obj); - - if (kp->page == NULL) - kp->page = page; - else - free_page((unsigned long)page); - ret = 0; out: return ret; @@ -1577,14 +1572,14 @@ static int zcache_put_page(int cli_id, int pool_id, struct tmem_oid *oidp, else zcache_failed_pers_puts++; } - zcache_put_pool(pool); } else { zcache_put_to_flush++; if (atomic_read(&pool->obj_count) > 0) /* the put fails whether the flush succeeds or not */ (void)tmem_flush_page(pool, oidp, index); - zcache_put_pool(pool); } + + zcache_put_pool(pool); out: return ret; } -- cgit v0.10.2 From 08b0b50048cea27437e06a5544b4ecc443a32f7d Mon Sep 17 00:00:00 2001 From: Xiao Guangrong Date: Tue, 26 Jun 2012 16:52:17 +0800 Subject: staging: zcache: introduce get_zcache_client Introduce get_zcache_client to remove the common code Acked-by: Seth Jennings Signed-off-by: Xiao Guangrong Acked-by: Konrad Rzeszutek Wilk Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index fbd9bcf..2b5c73c 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c @@ -74,6 +74,17 @@ static inline uint16_t get_client_id_from_client(struct zcache_client *cli) return cli - &zcache_clients[0]; } +static struct zcache_client *get_zcache_client(uint16_t cli_id) +{ + if (cli_id == LOCAL_CLIENT) + return &zcache_host; + + if ((unsigned int)cli_id < MAX_CLIENTS) + return &zcache_clients[cli_id]; + + return NULL; +} + static inline bool is_local_client(struct zcache_client *cli) { return cli == &zcache_host; @@ -935,15 +946,9 @@ static struct tmem_pool *zcache_get_pool_by_id(uint16_t cli_id, uint16_t poolid) struct tmem_pool *pool = NULL; struct zcache_client *cli = NULL; - if (cli_id == LOCAL_CLIENT) - cli = &zcache_host; - else { - if (cli_id >= MAX_CLIENTS) - goto out; - cli = &zcache_clients[cli_id]; - if (cli == NULL) - goto out; - } + cli = get_zcache_client(cli_id); + if (!cli) + goto out; atomic_inc(&cli->refcount); pool = idr_find(&cli->tmem_pools, poolid); @@ -966,13 +971,11 @@ static void zcache_put_pool(struct tmem_pool *pool) int zcache_new_client(uint16_t cli_id) { - struct zcache_client *cli = NULL; + struct zcache_client *cli; int ret = -1; - if (cli_id == LOCAL_CLIENT) - cli = &zcache_host; - else if ((unsigned int)cli_id < MAX_CLIENTS) - cli = &zcache_clients[cli_id]; + cli = get_zcache_client(cli_id); + if (cli == NULL) goto out; if (cli->allocated) @@ -1649,17 +1652,16 @@ static int zcache_flush_object(int cli_id, int pool_id, static int zcache_destroy_pool(int cli_id, int pool_id) { struct tmem_pool *pool = NULL; - struct zcache_client *cli = NULL; + struct zcache_client *cli; int ret = -1; if (pool_id < 0) goto out; - if (cli_id == LOCAL_CLIENT) - cli = &zcache_host; - else if ((unsigned int)cli_id < MAX_CLIENTS) - cli = &zcache_clients[cli_id]; + + cli = get_zcache_client(cli_id); if (cli == NULL) goto out; + atomic_inc(&cli->refcount); pool = idr_find(&cli->tmem_pools, pool_id); if (pool == NULL) @@ -1686,12 +1688,10 @@ static int zcache_new_pool(uint16_t cli_id, uint32_t flags) struct zcache_client *cli = NULL; int r; - if (cli_id == LOCAL_CLIENT) - cli = &zcache_host; - else if ((unsigned int)cli_id < MAX_CLIENTS) - cli = &zcache_clients[cli_id]; + cli = get_zcache_client(cli_id); if (cli == NULL) goto out; + atomic_inc(&cli->refcount); pool = kmalloc(sizeof(struct tmem_pool), GFP_ATOMIC); if (pool == NULL) { -- cgit v0.10.2 From c666e636ac9915f33fe175c75bc01ab994e5afa6 Mon Sep 17 00:00:00 2001 From: Xiao Guangrong Date: Tue, 26 Jun 2012 16:52:50 +0800 Subject: staging: zcache: cleanup the code between tmem_obj_init and tmem_obj_find tmem_obj_find and insertion tmem-obj have the some logic, we can integrate the code Signed-off-by: Xiao Guangrong Acked-by: Konrad Rzeszutek Wilk Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/zcache/tmem.c b/drivers/staging/zcache/tmem.c index 1ca66ea..eaa9021 100644 --- a/drivers/staging/zcache/tmem.c +++ b/drivers/staging/zcache/tmem.c @@ -72,33 +72,49 @@ void tmem_register_pamops(struct tmem_pamops *m) * the hashbucket lock must be held. */ -/* searches for object==oid in pool, returns locked object if found */ -static struct tmem_obj *tmem_obj_find(struct tmem_hashbucket *hb, - struct tmem_oid *oidp) +static struct tmem_obj +*__tmem_obj_find(struct tmem_hashbucket*hb, struct tmem_oid *oidp, + struct rb_node **parent, struct rb_node ***link) { - struct rb_node *rbnode; - struct tmem_obj *obj; - - rbnode = hb->obj_rb_root.rb_node; - while (rbnode) { - BUG_ON(RB_EMPTY_NODE(rbnode)); - obj = rb_entry(rbnode, struct tmem_obj, rb_tree_node); + struct rb_node *_parent = NULL, **rbnode; + struct tmem_obj *obj = NULL; + + rbnode = &hb->obj_rb_root.rb_node; + while (*rbnode) { + BUG_ON(RB_EMPTY_NODE(*rbnode)); + _parent = *rbnode; + obj = rb_entry(*rbnode, struct tmem_obj, + rb_tree_node); switch (tmem_oid_compare(oidp, &obj->oid)) { case 0: /* equal */ goto out; case -1: - rbnode = rbnode->rb_left; + rbnode = &(*rbnode)->rb_left; break; case 1: - rbnode = rbnode->rb_right; + rbnode = &(*rbnode)->rb_right; break; } } + + if (parent) + *parent = _parent; + if (link) + *link = rbnode; + obj = NULL; out: return obj; } + +/* searches for object==oid in pool, returns locked object if found */ +static struct tmem_obj *tmem_obj_find(struct tmem_hashbucket *hb, + struct tmem_oid *oidp) +{ + return __tmem_obj_find(hb, oidp, NULL, NULL); +} + static void tmem_pampd_destroy_all_in_obj(struct tmem_obj *); /* free an object that has no more pampds in it */ @@ -131,8 +147,7 @@ static void tmem_obj_init(struct tmem_obj *obj, struct tmem_hashbucket *hb, struct tmem_oid *oidp) { struct rb_root *root = &hb->obj_rb_root; - struct rb_node **new = &(root->rb_node), *parent = NULL; - struct tmem_obj *this; + struct rb_node **new = NULL, *parent = NULL; BUG_ON(pool == NULL); atomic_inc(&pool->obj_count); @@ -144,22 +159,10 @@ static void tmem_obj_init(struct tmem_obj *obj, struct tmem_hashbucket *hb, obj->pampd_count = 0; (*tmem_pamops.new_obj)(obj); SET_SENTINEL(obj, OBJ); - while (*new) { - BUG_ON(RB_EMPTY_NODE(*new)); - this = rb_entry(*new, struct tmem_obj, rb_tree_node); - parent = *new; - switch (tmem_oid_compare(oidp, &this->oid)) { - case 0: - BUG(); /* already present; should never happen! */ - break; - case -1: - new = &(*new)->rb_left; - break; - case 1: - new = &(*new)->rb_right; - break; - } - } + + if (__tmem_obj_find(hb, oidp, &parent, &new)) + BUG(); + rb_link_node(&obj->rb_tree_node, parent, new); rb_insert_color(&obj->rb_tree_node, root); } -- cgit v0.10.2 From 5f601902c61e6cda627ec71c10609021067ed0fa Mon Sep 17 00:00:00 2001 From: Seth Jennings Date: Mon, 2 Jul 2012 16:15:49 -0500 Subject: staging: zsmalloc: remove x86 dependency This patch replaces the page table assisted object mapping method, which has x86 dependencies, with a arch-independent method that does a simple copy into a temporary per-cpu buffer. While a copy seems like it would be worse than mapping the pages, tests demonstrate the copying is always faster and, in the case of running inside a KVM guest, roughly 4x faster. Signed-off-by: Seth Jennings Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/zsmalloc/Kconfig b/drivers/staging/zsmalloc/Kconfig index a5ab720..9084565 100644 --- a/drivers/staging/zsmalloc/Kconfig +++ b/drivers/staging/zsmalloc/Kconfig @@ -1,9 +1,5 @@ config ZSMALLOC tristate "Memory allocator for compressed pages" - # X86 dependency is because of the use of __flush_tlb_one and set_pte - # in zsmalloc-main.c. - # TODO: convert these to portable functions - depends on X86 default n help zsmalloc is a slab-based memory allocator designed to store diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c index 10b0d60..a7a6f22 100644 --- a/drivers/staging/zsmalloc/zsmalloc-main.c +++ b/drivers/staging/zsmalloc/zsmalloc-main.c @@ -470,6 +470,57 @@ static struct page *find_get_zspage(struct size_class *class) return page; } +static void zs_copy_map_object(char *buf, struct page *firstpage, + int off, int size) +{ + struct page *pages[2]; + int sizes[2]; + void *addr; + + pages[0] = firstpage; + pages[1] = get_next_page(firstpage); + BUG_ON(!pages[1]); + + sizes[0] = PAGE_SIZE - off; + sizes[1] = size - sizes[0]; + + /* disable page faults to match kmap_atomic() return conditions */ + pagefault_disable(); + + /* copy object to per-cpu buffer */ + addr = kmap_atomic(pages[0]); + memcpy(buf, addr + off, sizes[0]); + kunmap_atomic(addr); + addr = kmap_atomic(pages[1]); + memcpy(buf + sizes[0], addr, sizes[1]); + kunmap_atomic(addr); +} + +static void zs_copy_unmap_object(char *buf, struct page *firstpage, + int off, int size) +{ + struct page *pages[2]; + int sizes[2]; + void *addr; + + pages[0] = firstpage; + pages[1] = get_next_page(firstpage); + BUG_ON(!pages[1]); + + sizes[0] = PAGE_SIZE - off; + sizes[1] = size - sizes[0]; + + /* copy per-cpu buffer to object */ + addr = kmap_atomic(pages[0]); + memcpy(addr + off, buf, sizes[0]); + kunmap_atomic(addr); + addr = kmap_atomic(pages[1]); + memcpy(addr, buf + sizes[0], sizes[1]); + kunmap_atomic(addr); + + /* enable page faults to match kunmap_atomic() return conditions */ + pagefault_enable(); +} static int zs_cpu_notifier(struct notifier_block *nb, unsigned long action, void *pcpu) @@ -480,18 +531,23 @@ static int zs_cpu_notifier(struct notifier_block *nb, unsigned long action, switch (action) { case CPU_UP_PREPARE: area = &per_cpu(zs_map_area, cpu); - if (area->vm) - break; - area->vm = alloc_vm_area(2 * PAGE_SIZE, area->vm_ptes); - if (!area->vm) - return notifier_from_errno(-ENOMEM); + /* + * Make sure we don't leak memory if a cpu UP notification + * and zs_init() race and both call zs_cpu_up() on the same cpu + */ + if (area->vm_buf) + return 0; + area->vm_buf = (char *)__get_free_page(GFP_KERNEL); + if (!area->vm_buf) + return -ENOMEM; + return 0; break; case CPU_DEAD: case CPU_UP_CANCELED: area = &per_cpu(zs_map_area, cpu); - if (area->vm) - free_vm_area(area->vm); - area->vm = NULL; + if (area->vm_buf) + free_page((unsigned long)area->vm_buf); + area->vm_buf = NULL; break; } @@ -714,22 +770,11 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle) if (off + class->size <= PAGE_SIZE) { /* this object is contained entirely within a page */ area->vm_addr = kmap_atomic(page); - } else { - /* this object spans two pages */ - struct page *nextp; - - nextp = get_next_page(page); - BUG_ON(!nextp); - - - set_pte(area->vm_ptes[0], mk_pte(page, PAGE_KERNEL)); - set_pte(area->vm_ptes[1], mk_pte(nextp, PAGE_KERNEL)); - - /* We pre-allocated VM area so mapping can never fail */ - area->vm_addr = area->vm->addr; + return area->vm_addr + off; } - return area->vm_addr + off; + zs_copy_map_object(area->vm_buf, page, off, class->size); + return area->vm_buf; } EXPORT_SYMBOL_GPL(zs_map_object); @@ -751,14 +796,10 @@ void zs_unmap_object(struct zs_pool *pool, unsigned long handle) off = obj_idx_to_offset(page, obj_idx, class->size); area = &__get_cpu_var(zs_map_area); - if (off + class->size <= PAGE_SIZE) { + if (off + class->size <= PAGE_SIZE) kunmap_atomic(area->vm_addr); - } else { - set_pte(area->vm_ptes[0], __pte(0)); - set_pte(area->vm_ptes[1], __pte(0)); - __flush_tlb_one((unsigned long)area->vm_addr); - __flush_tlb_one((unsigned long)area->vm_addr + PAGE_SIZE); - } + else + zs_copy_unmap_object(area->vm_buf, page, off, class->size); put_cpu_var(zs_map_area); } EXPORT_SYMBOL_GPL(zs_unmap_object); diff --git a/drivers/staging/zsmalloc/zsmalloc_int.h b/drivers/staging/zsmalloc/zsmalloc_int.h index 6fd32a9..f760dae 100644 --- a/drivers/staging/zsmalloc/zsmalloc_int.h +++ b/drivers/staging/zsmalloc/zsmalloc_int.h @@ -110,9 +110,8 @@ enum fullness_group { static const int fullness_threshold_frac = 4; struct mapping_area { - struct vm_struct *vm; - pte_t *vm_ptes[2]; - char *vm_addr; + char *vm_buf; /* copy buffer for objects that span pages */ + char *vm_addr; /* address of kmap_atomic()'ed pages */ }; struct size_class { -- cgit v0.10.2 From 103123305c4f695cbb11555d51a32ea14d6bed05 Mon Sep 17 00:00:00 2001 From: Seth Jennings Date: Mon, 2 Jul 2012 16:15:50 -0500 Subject: staging: zsmalloc: add single-page object fastpath in unmap Improve zs_unmap_object() performance by adding a fast path for objects that don't span pages. Signed-off-by: Seth Jennings Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c index a7a6f22..4942d41 100644 --- a/drivers/staging/zsmalloc/zsmalloc-main.c +++ b/drivers/staging/zsmalloc/zsmalloc-main.c @@ -774,6 +774,7 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle) } zs_copy_map_object(area->vm_buf, page, off, class->size); + area->vm_addr = NULL; return area->vm_buf; } EXPORT_SYMBOL_GPL(zs_map_object); @@ -788,6 +789,14 @@ void zs_unmap_object(struct zs_pool *pool, unsigned long handle) struct size_class *class; struct mapping_area *area; + area = &__get_cpu_var(zs_map_area); + if (area->vm_addr) { + /* single-page object fastpath */ + kunmap_atomic(area->vm_addr); + put_cpu_var(zs_map_area); + return; + } + BUG_ON(!handle); obj_handle_to_location(handle, &page, &obj_idx); @@ -795,11 +804,7 @@ void zs_unmap_object(struct zs_pool *pool, unsigned long handle) class = &pool->size_class[class_idx]; off = obj_idx_to_offset(page, obj_idx, class->size); - area = &__get_cpu_var(zs_map_area); - if (off + class->size <= PAGE_SIZE) - kunmap_atomic(area->vm_addr); - else - zs_copy_unmap_object(area->vm_buf, page, off, class->size); + zs_copy_unmap_object(area->vm_buf, page, off, class->size); put_cpu_var(zs_map_area); } EXPORT_SYMBOL_GPL(zs_unmap_object); -- cgit v0.10.2 From 166cfda752ca22eb6912614993b85f9a997dbd8f Mon Sep 17 00:00:00 2001 From: Seth Jennings Date: Mon, 2 Jul 2012 16:15:51 -0500 Subject: staging: zsmalloc: add details to zs_map_object boiler plate Add information on the usage limits of zs_map_object() Signed-off-by: Seth Jennings Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c index 4942d41..abf7c13 100644 --- a/drivers/staging/zsmalloc/zsmalloc-main.c +++ b/drivers/staging/zsmalloc/zsmalloc-main.c @@ -747,7 +747,12 @@ EXPORT_SYMBOL_GPL(zs_free); * * Before using an object allocated from zs_malloc, it must be mapped using * this function. When done with the object, it must be unmapped using - * zs_unmap_object + * zs_unmap_object. + * + * Only one object can be mapped per cpu at a time. There is no protection + * against nested mappings. + * + * This function returns with preemption and page faults disabled. */ void *zs_map_object(struct zs_pool *pool, unsigned long handle) { -- cgit v0.10.2 From b74185108668ef966e663878adbad65e03bfcb43 Mon Sep 17 00:00:00 2001 From: Seth Jennings Date: Mon, 2 Jul 2012 16:15:52 -0500 Subject: staging: zsmalloc: add mapping modes This patch improves mapping performance in zsmalloc by getting usage information from the user in the form of a "mapping mode" and using it to avoid unnecessary copying for objects that span pages. Signed-off-by: Seth Jennings Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index 2b5c73c..c214977 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c @@ -716,7 +716,7 @@ static unsigned long zv_create(struct zs_pool *pool, uint32_t pool_id, goto out; atomic_inc(&zv_curr_dist_counts[chunks]); atomic_inc(&zv_cumul_dist_counts[chunks]); - zv = zs_map_object(pool, handle); + zv = zs_map_object(pool, handle, ZS_MM_WO); zv->index = index; zv->oid = *oid; zv->pool_id = pool_id; @@ -735,7 +735,7 @@ static void zv_free(struct zs_pool *pool, unsigned long handle) uint16_t size; int chunks; - zv = zs_map_object(pool, handle); + zv = zs_map_object(pool, handle, ZS_MM_RW); ASSERT_SENTINEL(zv, ZVH); size = zv->size + sizeof(struct zv_hdr); INVERT_SENTINEL(zv, ZVH); @@ -757,7 +757,7 @@ static void zv_decompress(struct page *page, unsigned long handle) int ret; struct zv_hdr *zv; - zv = zs_map_object(zcache_host.zspool, handle); + zv = zs_map_object(zcache_host.zspool, handle, ZS_MM_RO); BUG_ON(zv->size == 0); ASSERT_SENTINEL(zv, ZVH); to_va = kmap_atomic(page); diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c index 706cb62..653b074 100644 --- a/drivers/staging/zram/zram_drv.c +++ b/drivers/staging/zram/zram_drv.c @@ -220,7 +220,8 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec, uncmem = user_mem; clen = PAGE_SIZE; - cmem = zs_map_object(zram->mem_pool, zram->table[index].handle); + cmem = zs_map_object(zram->mem_pool, zram->table[index].handle, + ZS_MM_RO); ret = lzo1x_decompress_safe(cmem, zram->table[index].size, uncmem, &clen); @@ -258,7 +259,7 @@ static int zram_read_before_write(struct zram *zram, char *mem, u32 index) return 0; } - cmem = zs_map_object(zram->mem_pool, handle); + cmem = zs_map_object(zram->mem_pool, handle, ZS_MM_RO); ret = lzo1x_decompress_safe(cmem, zram->table[index].size, mem, &clen); zs_unmap_object(zram->mem_pool, handle); @@ -351,7 +352,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, ret = -ENOMEM; goto out; } - cmem = zs_map_object(zram->mem_pool, handle); + cmem = zs_map_object(zram->mem_pool, handle, ZS_MM_WO); memcpy(cmem, src, clen); diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c index abf7c13..8b0bcb6 100644 --- a/drivers/staging/zsmalloc/zsmalloc-main.c +++ b/drivers/staging/zsmalloc/zsmalloc-main.c @@ -484,9 +484,6 @@ static void zs_copy_map_object(char *buf, struct page *firstpage, sizes[0] = PAGE_SIZE - off; sizes[1] = size - sizes[0]; - /* disable page faults to match kmap_atomic() return conditions */ - pagefault_disable(); - /* copy object to per-cpu buffer */ addr = kmap_atomic(pages[0]); memcpy(buf, addr + off, sizes[0]); @@ -517,9 +514,6 @@ static void zs_copy_unmap_object(char *buf, struct page *firstpage, addr = kmap_atomic(pages[1]); memcpy(addr, buf + sizes[0], sizes[1]); kunmap_atomic(addr); - - /* enable page faults to match kunmap_atomic() return conditions */ - pagefault_enable(); } static int zs_cpu_notifier(struct notifier_block *nb, unsigned long action, @@ -754,7 +748,8 @@ EXPORT_SYMBOL_GPL(zs_free); * * This function returns with preemption and page faults disabled. */ -void *zs_map_object(struct zs_pool *pool, unsigned long handle) +void *zs_map_object(struct zs_pool *pool, unsigned long handle, + enum zs_mapmode mm) { struct page *page; unsigned long obj_idx, off; @@ -778,7 +773,11 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle) return area->vm_addr + off; } - zs_copy_map_object(area->vm_buf, page, off, class->size); + /* disable page faults to match kmap_atomic() return conditions */ + pagefault_disable(); + + if (mm != ZS_MM_WO) + zs_copy_map_object(area->vm_buf, page, off, class->size); area->vm_addr = NULL; return area->vm_buf; } @@ -795,13 +794,16 @@ void zs_unmap_object(struct zs_pool *pool, unsigned long handle) struct mapping_area *area; area = &__get_cpu_var(zs_map_area); + /* single-page object fastpath */ if (area->vm_addr) { - /* single-page object fastpath */ kunmap_atomic(area->vm_addr); - put_cpu_var(zs_map_area); - return; + goto out; } + /* no write fastpath */ + if (area->vm_mm == ZS_MM_RO) + goto pfenable; + BUG_ON(!handle); obj_handle_to_location(handle, &page, &obj_idx); @@ -810,6 +812,11 @@ void zs_unmap_object(struct zs_pool *pool, unsigned long handle) off = obj_idx_to_offset(page, obj_idx, class->size); zs_copy_unmap_object(area->vm_buf, page, off, class->size); + +pfenable: + /* enable page faults to match kunmap_atomic() return conditions */ + pagefault_enable(); +out: put_cpu_var(zs_map_area); } EXPORT_SYMBOL_GPL(zs_unmap_object); diff --git a/drivers/staging/zsmalloc/zsmalloc.h b/drivers/staging/zsmalloc/zsmalloc.h index 485cbb1..de2e8bf 100644 --- a/drivers/staging/zsmalloc/zsmalloc.h +++ b/drivers/staging/zsmalloc/zsmalloc.h @@ -15,6 +15,17 @@ #include +/* + * zsmalloc mapping modes + * + * NOTE: These only make a difference when a mapped object spans pages +*/ +enum zs_mapmode { + ZS_MM_RW, /* normal read-write mapping */ + ZS_MM_RO, /* read-only (no copy-out at unmap time) */ + ZS_MM_WO /* write-only (no copy-in at map time) */ +}; + struct zs_pool; struct zs_pool *zs_create_pool(const char *name, gfp_t flags); @@ -23,7 +34,8 @@ void zs_destroy_pool(struct zs_pool *pool); unsigned long zs_malloc(struct zs_pool *pool, size_t size); void zs_free(struct zs_pool *pool, unsigned long obj); -void *zs_map_object(struct zs_pool *pool, unsigned long handle); +void *zs_map_object(struct zs_pool *pool, unsigned long handle, + enum zs_mapmode mm); void zs_unmap_object(struct zs_pool *pool, unsigned long handle); u64 zs_get_total_size_bytes(struct zs_pool *pool); diff --git a/drivers/staging/zsmalloc/zsmalloc_int.h b/drivers/staging/zsmalloc/zsmalloc_int.h index f760dae..52805176 100644 --- a/drivers/staging/zsmalloc/zsmalloc_int.h +++ b/drivers/staging/zsmalloc/zsmalloc_int.h @@ -112,6 +112,7 @@ static const int fullness_threshold_frac = 4; struct mapping_area { char *vm_buf; /* copy buffer for objects that span pages */ char *vm_addr; /* address of kmap_atomic()'ed pages */ + enum zs_mapmode vm_mm; /* mapping mode */ }; struct size_class { -- cgit v0.10.2 From 4063d060431b11da3ac2e255e0d8b3c62a0b5f9f Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Mon, 9 Jul 2012 00:58:36 +0200 Subject: staging: vt6656: iwctl: fix up spacing around operators A few cases were missed in my previous cleanup, this takes care of the last cases of missing space (or too much space (as in a newline)) around operators ('=', '==', ',', '<'). Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index dc24096..f8ea662 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -104,7 +104,7 @@ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, PSMgmtObject pMgmt = &(pDevice->sMgmtObj); struct iw_scan_req *req = (struct iw_scan_req *)extra; BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; - PWLAN_IE_SSID pItemSSID=NULL; + PWLAN_IE_SSID pItemSSID = NULL; if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) return -EINVAL; @@ -203,7 +203,7 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, iwe.cmd = SIOCGIWAP; iwe.u.ap_addr.sa_family = ARPHRD_ETHER; memcpy(iwe.u.ap_addr.sa_data, pBSS->abyBSSID, WLAN_BSSID_LEN); - current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_ADDR_LEN); + current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_ADDR_LEN); // ADD ssid memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWESSID; @@ -244,7 +244,7 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, iwe.u.qual.level = ldBm; iwe.u.qual.noise = 0; - if (-ldBm<50) + if (-ldBm < 50) iwe.u.qual.qual = 100; else if (-ldBm > 90) iwe.u.qual.qual = 0; @@ -1099,9 +1099,9 @@ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, // Send the key to the card if (wrq->length > 0) { - if (wrq->length == WLAN_WEP232_KEYLEN) { + if (wrq->length == WLAN_WEP232_KEYLEN) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n"); - } else if (wrq->length == WLAN_WEP104_KEYLEN) { + } else if (wrq->length == WLAN_WEP104_KEYLEN) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n"); } else if (wrq->length == WLAN_WEP40_KEYLEN) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex); @@ -1624,8 +1624,7 @@ int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info, case IW_MLME_DISASSOC: if (pDevice->bLinkPass == TRUE) { PRINT_K("iwctl_siwmlme--->send DISASSOCIATE\n"); - bScheduleCommand((void *)pDevice, - WLAN_CMD_DISASSOCIATE, + bScheduleCommand((void *)pDevice, WLAN_CMD_DISASSOCIATE, NULL); } break; -- cgit v0.10.2 From 0c5c79010950afee602436f85864d0ad3f195029 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Mon, 9 Jul 2012 00:58:52 +0200 Subject: staging: vt6656: iwctl: Fix up a few remaining brace issues My previous cleanup patches missed a few cases of redundant/missing/replaced curly braces. This should fix up the last ones. Signed-off-by: Jesper Juhl Acked-by : Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index f8ea662..13ad62c 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -140,9 +140,9 @@ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, if (pItemSSID->abySSID[req->essid_len - 1] == '\0') { if (req->essid_len > 0) pItemSSID->len = req->essid_len - 1; - } - else + } else { pItemSSID->len = req->essid_len; + } pMgmt->eScanType = WMAC_SCAN_PASSIVE; PRINT_K("SIOCSIWSCAN:[desired_ssid=%s,len=%d]\n", ((PWLAN_IE_SSID)abyScanSSID)->abySSID, ((PWLAN_IE_SSID)abyScanSSID)->len); @@ -577,9 +577,9 @@ int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, PRINT_K(" SIOCSIWAP \n"); - if (wrq->sa_family != ARPHRD_ETHER) + if (wrq->sa_family != ARPHRD_ETHER) { rc = -EINVAL; - else { + } else { memcpy(pMgmt->abyDesireBSSID, wrq->sa_data, 6); // mike: add if ((is_broadcast_ether_addr(pMgmt->abyDesireBSSID)) || @@ -882,8 +882,7 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, pDevice->uConnectionRate = brate; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d \n", pDevice->uConnectionRate); } - } - else { + } else { pDevice->bFixRate = FALSE; pDevice->uConnectionRate = 13; } @@ -1205,7 +1204,7 @@ int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, wrq->length = 0; if ((index == 0) && (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled || - pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)){ // get wpa pairwise key + pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)) { // get wpa pairwise key if (KeybGetKey(&(pDevice->sKey), pMgmt->abyCurrBSSID, 0xffffffff, &pKey)) { wrq->length = pKey->uKeyLength; memcpy(abyKey, pKey->abyKey, pKey->uKeyLength); @@ -1360,11 +1359,10 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, if (wpa_version == IW_AUTH_WPA_VERSION_DISABLED) break; if (pairwise == IW_AUTH_CIPHER_NONE) { - if (wrq->value == IW_AUTH_CIPHER_CCMP) { + if (wrq->value == IW_AUTH_CIPHER_CCMP) pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; - }else { + else pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; - } } break; case IW_AUTH_KEY_MGMT: @@ -1446,7 +1444,7 @@ int iwctl_siwgenie(struct net_device *dev, struct iw_request_info *info, goto out; } pMgmt->wWPAIELen = wrq->length; - }else { + } else { memset(pMgmt->abyWPAIE, 0, MAX_WPA_IE_LEN); pMgmt->wWPAIELen = 0; } @@ -1470,8 +1468,9 @@ int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info, if (copy_to_user(extra, pMgmt->abyWPAIE, pMgmt->wWPAIELen)) { ret = -EFAULT; } - } else + } else { ret = -E2BIG; + } } return ret; } -- cgit v0.10.2 From 9a671f886f156e67d984057074c6241621961a21 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Mon, 9 Jul 2012 00:59:30 +0200 Subject: staging: vt6656: iwctl: remove a few remaining redundant newlines I missed a few redundant newlines the first time. Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index 13ad62c..8b9894b 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -964,7 +964,6 @@ int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info, wrq->value = pDevice->wRTSThreshold; wrq->disabled = (wrq->value >= 2312); wrq->fixed = 1; - return 0; } @@ -1003,7 +1002,6 @@ int iwctl_giwfrag(struct net_device *dev, struct iw_request_info *info, wrq->value = pDevice->wFragmentationThreshold; wrq->disabled = (wrq->value >= 2312); wrq->fixed = 1; - return 0; } @@ -1097,7 +1095,6 @@ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, // Send the key to the card if (wrq->length > 0) { - if (wrq->length == WLAN_WEP232_KEYLEN) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n"); } else if (wrq->length == WLAN_WEP104_KEYLEN) { @@ -1119,8 +1116,7 @@ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, dwKeyIndex | (1 << 31), wrq->length, NULL, pDevice->abyKey, - KEY_CTL_WEP - ); + KEY_CTL_WEP); spin_unlock_irq(&pDevice->lock); } pDevice->byKeyIndex = (BYTE)dwKeyIndex; -- cgit v0.10.2 From 0d3de9b01419ff1f2c776b2683586c2f269d3607 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Sat, 7 Jul 2012 11:32:15 +0530 Subject: staging/rts_pstor: fix the no brace needed warning for if else statements having single block no braces are needed fixed the following checkpatch warning drivers/staging/rts_pstor/sd.c:140: WARNING: braces {} are not necessary for any arm of this statement Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/rts_pstor/sd.c b/drivers/staging/rts_pstor/sd.c index b9474a8..ff9bf0f 100644 --- a/drivers/staging/rts_pstor/sd.c +++ b/drivers/staging/rts_pstor/sd.c @@ -137,11 +137,10 @@ static int sd_check_data0_status(struct rtsx_chip *chip) { u8 stat; - if (CHECK_PID(chip, 0x5209)) { + if (CHECK_PID(chip, 0x5209)) RTSX_READ_REG(chip, REG_SD_BUS_STAT, &stat); - } else { + else RTSX_READ_REG(chip, REG_SD_STAT1, &stat); - } if (!(stat & SD_DAT0_STATUS)) { sd_set_err_code(chip, SD_BUSY); -- cgit v0.10.2 From 9e76b9dfa383894d4807947bed282f024b519565 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Sat, 7 Jul 2012 11:33:04 +0530 Subject: staging/rts_pstor: fix single statements block warning The following warning is fixed up. drivers/staging/rts_pstor/sd.c:190: WARNING: braces {} are not necessary for single statement blocks Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/rts_pstor/sd.c b/drivers/staging/rts_pstor/sd.c index ff9bf0f..3cc9a48 100644 --- a/drivers/staging/rts_pstor/sd.c +++ b/drivers/staging/rts_pstor/sd.c @@ -187,9 +187,9 @@ RTY_SEND_CMD: SD_TRANSFER_END | SD_STAT_IDLE, SD_TRANSFER_END | SD_STAT_IDLE); if (rsp_type == SD_RSP_TYPE_R2) { - for (reg_addr = PPBUF_BASE2; reg_addr < PPBUF_BASE2 + 16; reg_addr++) { + for (reg_addr = PPBUF_BASE2; reg_addr < PPBUF_BASE2 + 16; reg_addr++) rtsx_add_cmd(chip, READ_REG_CMD, reg_addr, 0, 0); - } + stat_idx = 16; } else if (rsp_type != SD_RSP_TYPE_R0) { for (reg_addr = REG_SD_CMD0; reg_addr <= REG_SD_CMD4; reg_addr++) { -- cgit v0.10.2 From 64cab4e27648d358842fbf16e0f0c6572458eb20 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Sat, 7 Jul 2012 17:35:12 +0530 Subject: staging/ft1000: fix the no brace needed warning in ft1000_interrupt as the if statement encloses only one line braces around it are not needed. The following warn fixed, WARNING: braces {} are not necessary for single statement blocks Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c index c4a8a0a..0bd080c 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c @@ -1998,9 +1998,8 @@ static irqreturn_t ft1000_interrupt(int irq, void *dev_id) // Make sure we process all interrupt before leaving the ISR due to the edge trigger interrupt type while (inttype) { - if (inttype & ISR_DOORBELL_PEND) { - ft1000_parse_dpram_msg(dev); - } + if (inttype & ISR_DOORBELL_PEND) + ft1000_parse_dpram_msg(dev); if (inttype & ISR_RCV) { DEBUG(1, "Data in FIFO\n"); -- cgit v0.10.2 From 3a0ccb0db9a113a1ab6a8d60213ea86e9a53ec57 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Sat, 7 Jul 2012 17:35:14 +0530 Subject: staging/ft1000: fix sparse warning sparse warns about having 0 assigned to a pointer, fix it up by using NULL. The following sparse warning is fixed drivers/staging/ft1000/ft1000-usb/ft1000_debug.c:170:52: warning: Using plain integer as NULL pointer Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c index 19db23f..6d911fd 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c @@ -167,7 +167,7 @@ int ft1000_create_dev(struct ft1000_device *dev) goto fail; } - dir = debugfs_create_dir(info->DeviceName, 0); + dir = debugfs_create_dir(info->DeviceName, NULL); if (IS_ERR(dir)) { result = PTR_ERR(dir); goto debug_dir_fail; -- cgit v0.10.2 From 3bc2311e32daef1b62f45bc5d1da936f4cb31111 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Sat, 7 Jul 2012 17:35:15 +0530 Subject: staging/ft1000: fix sparse warning about the kernel thread handler function sparse throws warning about the ft1000_poll_thread as drivers/staging/ft1000/ft1000-usb/ft1000_usb.c:40:5: warning: symbol 'ft1000_poll_thread' was not declared. Should it be static? Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c index bfead67..e434d33 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c @@ -37,7 +37,7 @@ static struct usb_device_id id_table[] = { MODULE_DEVICE_TABLE(usb, id_table); static bool gPollingfailed = FALSE; -int ft1000_poll_thread(void *arg) +static int ft1000_poll_thread(void *arg) { int ret = STATUS_SUCCESS; -- cgit v0.10.2 From b3a87c3767b476a2115a8d9c7aa5496c153d1dc5 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Sat, 7 Jul 2012 17:35:16 +0530 Subject: staging/ft1000: fix the no brace needed warning in ft1000_read_fifo_len as the if else statements enclose only one line, so braces around them are not needed. The following warning is fixed drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c:100: WARNING: braces {} are not necessary for any arm of this statement Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c index 0bd080c..4a8d642 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c @@ -97,11 +97,10 @@ static inline u16 ft1000_read_fifo_len(struct net_device *dev) { struct ft1000_info *info = netdev_priv(dev); - if (info->AsicID == ELECTRABUZZ_ID) { + if (info->AsicID == ELECTRABUZZ_ID) return (ft1000_read_reg(dev, FT1000_REG_UFIFO_STAT) - 16); - } else { + else return (ft1000_read_reg(dev, FT1000_REG_MAG_UFSR) - 16); - } } //--------------------------------------------------------------------------- -- cgit v0.10.2 From cfe116c2c03d2c09b86edb5b5870bd169caec5cd Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Sat, 7 Jul 2012 17:35:17 +0530 Subject: staging/ft1000: fix the foo * bar warning Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c index 4a8d642..0059cac 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c @@ -115,7 +115,7 @@ static inline u16 ft1000_read_fifo_len(struct net_device *dev) // value - value of dpram // //--------------------------------------------------------------------------- -u16 ft1000_read_dpram(struct net_device * dev, int offset) +u16 ft1000_read_dpram(struct net_device *dev, int offset) { struct ft1000_info *info = netdev_priv(dev); unsigned long flags; -- cgit v0.10.2 From 95f2825d3b1b562f4a95ffe64f80f331eeeded6e Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Sat, 7 Jul 2012 17:35:18 +0530 Subject: staging/ft1000-pcmcia: fix checkpatch warnings The below checkpatch warns fixed, drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c:38: ERROR: that open brace { should be on the previous line drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c:45: ERROR: that open brace { should be on the previous line drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c:57: ERROR: that open brace { should be on the previous line Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c index 71aaad3..72727c6 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c @@ -34,16 +34,14 @@ #define PUTX_TO_PAGE(len, page, message, size, var) \ len += snprintf(page+len, PAGE_SIZE - len, message); \ - for(i = 0; i < (size - 1); i++) \ - { \ + for(i = 0; i < (size - 1); i++) { \ len += snprintf(page+len, PAGE_SIZE - len, "%02x:", var[i]); \ } \ len += snprintf(page+len, PAGE_SIZE - len, "%02x\n", var[i]) #define PUTD_TO_PAGE(len, page, message, size, var) \ len += snprintf(page+len, PAGE_SIZE - len, message); \ - for(i = 0; i < (size - 1); i++) \ - { \ + for(i = 0; i < (size - 1); i++) { \ len += snprintf(page+len, PAGE_SIZE - len, "%d.", var[i]); \ } \ len += snprintf(page+len, PAGE_SIZE - len, "%d\n", var[i]) @@ -55,8 +53,8 @@ static int ft1000ReadProc(char *page, char **start, off_t off, int len; int i; struct ft1000_info *info; - char *status[] = - { "Idle (Disconnect)", "Searching", "Active (Connected)", + char *status[] = { + "Idle (Disconnect)", "Searching", "Active (Connected)", "Waiting for L2", "Sleep", "No Coverage", "", "" }; char *signal[] = { "", "*", "**", "***", "****" }; -- cgit v0.10.2 From b7c5a774b0f516fed3a38367eb2aeb5ad4d6e234 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Sat, 7 Jul 2012 17:35:19 +0530 Subject: staging/ft1000: remove unnecessary assignment of ret with STATUS_SUCCESS as ret is assigned to the return of ft1000_poll, we dont need to initialise ret with STATUS_SUCCESS. Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c index e434d33..7bd7fb2 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c @@ -39,7 +39,7 @@ MODULE_DEVICE_TABLE(usb, id_table); static bool gPollingfailed = FALSE; static int ft1000_poll_thread(void *arg) { - int ret = STATUS_SUCCESS; + int ret; while (!kthread_should_stop()) { msleep(10); -- cgit v0.10.2 From 485b34c2dfb933592f211aa416ad4c1d2bed895a Mon Sep 17 00:00:00 2001 From: Cruz Julian Bishop Date: Sun, 8 Jul 2012 17:00:56 +1000 Subject: staging: Fixes some checkpatch warnings in asus_oled/asus_oled.c This fixes the following warnings: 1: Changes a printk(KERN_ERR) call to a pr_err call in line 785 2: Changes a printk(KERN_ERR) call to a pr_err call in line 791 3: Changes a printk(KERN_ERR) call to a pr_err call in line 798 4: Reduces line length below 80 at line 785 (Not intended) 5: Reduces line length below 80 at line 798 (Not intended) Signed-off-by: Cruz Julian Bishop Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/asus_oled/asus_oled.c b/drivers/staging/asus_oled/asus_oled.c index 510d796..f63c1d3 100644 --- a/drivers/staging/asus_oled/asus_oled.c +++ b/drivers/staging/asus_oled/asus_oled.c @@ -782,20 +782,20 @@ static int __init asus_oled_init(void) oled_class = class_create(THIS_MODULE, ASUS_OLED_UNDERSCORE_NAME); if (IS_ERR(oled_class)) { - printk(KERN_ERR "Error creating " ASUS_OLED_UNDERSCORE_NAME " class\n"); + pr_err("Error creating " ASUS_OLED_UNDERSCORE_NAME " class\n"); return PTR_ERR(oled_class); } retval = class_create_file(oled_class, &class_attr_version.attr); if (retval) { - printk(KERN_ERR "Error creating class version file\n"); + pr_err("Error creating class version file\n"); goto error; } retval = usb_register(&oled_driver); if (retval) { - printk(KERN_ERR "usb_register failed. Error number %d\n", retval); + pr_err("usb_register failed. Error number %d\n", retval); goto error; } -- cgit v0.10.2 From 728a9ca3cb390bc7d4aca53328fe272140025864 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Sun, 8 Jul 2012 22:55:46 -0300 Subject: staging: vt6656: desc.h: Remove commented macros and useless comments The commented macros are reported by forgotten-macros tool(https://github.com/marcosps/forgotten_macros). Signed-off-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/desc.h b/drivers/staging/vt6656/desc.h index 767112b..b68b2ec 100644 --- a/drivers/staging/vt6656/desc.h +++ b/drivers/staging/vt6656/desc.h @@ -36,8 +36,6 @@ #include "ttype.h" #include "tether.h" -/*--------------------- Export Definitions -------------------------*/ - // max transmit or receive buffer size #define CB_MAX_BUF_SIZE 2900U // max buffer size // NOTE: must be multiple of 4 @@ -120,17 +118,11 @@ #define FRAGCTL_TKIP 0x0200 // 0000 0010 0000 0000 #define FRAGCTL_LEGACY 0x0100 // 0000 0001 0000 0000 #define FRAGCTL_NONENCRYPT 0x0000 // 0000 0000 0000 0000 -//#define FRAGCTL_AC3 0x000C // 0000 0000 0000 1100 -//#define FRAGCTL_AC2 0x0008 // 0000 0000 0000 1000 -//#define FRAGCTL_AC1 0x0004 // 0000 0000 0000 0100 -//#define FRAGCTL_AC0 0x0000 // 0000 0000 0000 0000 #define FRAGCTL_ENDFRAG 0x0003 // 0000 0000 0000 0011 #define FRAGCTL_MIDFRAG 0x0002 // 0000 0000 0000 0010 #define FRAGCTL_STAFRAG 0x0001 // 0000 0000 0000 0001 #define FRAGCTL_NONFRAG 0x0000 // 0000 0000 0000 0000 -//#define TYPE_AC0DMA 0 -//#define TYPE_TXDMA0 1 #define TYPE_TXDMA0 0 #define TYPE_AC0DMA 1 #define TYPE_ATIMDMA 2 @@ -147,9 +139,6 @@ #define TD_FLAGS_NETIF_SKB 0x01 // check if need release skb #define TD_FLAGS_PRIV_SKB 0x02 // check if called from private skb(hostap) #define TD_FLAGS_PS_RETRY 0x04 // check if PS STA frame re-transmit -//#define TD_FLAGS_NETIF_SKB 0x04 - -/*--------------------- Export Types ------------------------------*/ // // RsvTime buffer header @@ -268,7 +257,6 @@ SRTS_a_FB, *PSRTS_a_FB; typedef const SRTS_a_FB *PCSRTS_a_FB; - // // CTS buffer header // @@ -421,12 +409,5 @@ typedef struct tagSKeyEntry { DWORD dwKey4[4]; } __attribute__ ((__packed__)) SKeyEntry; -/*--------------------- Export Macros ------------------------------*/ - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ #endif /* __DESC_H__ */ -- cgit v0.10.2 From 7f289dae41f45d163b8d82edb549083caf023e6a Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Sun, 8 Jul 2012 22:55:47 -0300 Subject: staging: vt6656: hostap.c: Remove unused macros and some useless comments The unused macros were reporteds by forgotten-macros tool(https://github.com/marcosps/forgotten_macros). Signed-off-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c index 51b5adf..f578095 100644 --- a/drivers/staging/vt6656/hostap.c +++ b/drivers/staging/vt6656/hostap.c @@ -41,31 +41,11 @@ #define VIAWGET_HOSTAPD_MAX_BUF_SIZE 1024 #define HOSTAP_CRYPT_FLAG_SET_TX_KEY BIT0 -#define HOSTAP_CRYPT_FLAG_PERMANENT BIT1 -#define HOSTAP_CRYPT_ERR_UNKNOWN_ALG 2 #define HOSTAP_CRYPT_ERR_UNKNOWN_ADDR 3 -#define HOSTAP_CRYPT_ERR_CRYPT_INIT_FAILED 4 #define HOSTAP_CRYPT_ERR_KEY_SET_FAILED 5 -#define HOSTAP_CRYPT_ERR_TX_KEY_SET_FAILED 6 -#define HOSTAP_CRYPT_ERR_CARD_CONF_FAILED 7 - -/*--------------------- Static Definitions -------------------------*/ - -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ -//static int msglevel =MSG_LEVEL_DEBUG; static int msglevel =MSG_LEVEL_INFO; -/*--------------------- Static Functions --------------------------*/ - - - - -/*--------------------- Export Variables --------------------------*/ - - /* * Description: * register net_device (AP) for hostap deamon -- cgit v0.10.2 From a6fadf5c53c0d31e23e1800fd2d2cd14e2fff744 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Sun, 8 Jul 2012 22:55:48 -0300 Subject: staging: vt6656: hostap.c: Remove commented code Signed-off-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c index f578095..682002a 100644 --- a/drivers/staging/vt6656/hostap.c +++ b/drivers/staging/vt6656/hostap.c @@ -294,37 +294,6 @@ static int hostap_get_info_sta(PSDevice pDevice, return 0; } -/* - * Description: - * reset txexec - * - * Parameters: - * In: - * pDevice - - * param - - * Out: - * TURE, FALSE - * - * Return Value: - * - */ -/* -static int hostap_reset_txexc_sta(PSDevice pDevice, - struct viawget_hostapd_param *param) -{ - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - unsigned int uNodeIndex; - - if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &uNodeIndex)) { - pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts = 0; - } - else { - return -ENOENT; - } - - return 0; -} -*/ /* * Description: @@ -459,12 +428,6 @@ static int hostap_set_encryption(PSDevice pDevice, param->u.crypt.err = 0; -/* - if (param_len != - (int) ((char *) param->u.crypt.key - (char *) param) + - param->u.crypt.key_len) - return -EINVAL; -*/ if (param->u.crypt.alg > WPA_ALG_CCMP) return -EINVAL; @@ -794,12 +757,6 @@ int vt6656_hostap_ioctl(PSDevice pDevice, struct iw_point *p) ret = hostap_get_info_sta(pDevice, param); ap_ioctl = 1; break; -/* - case VIAWGET_HOSTAPD_RESET_TXEXC_STA: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_RESET_TXEXC_STA \n"); - ret = hostap_reset_txexc_sta(pDevice, param); - break; -*/ case VIAWGET_HOSTAPD_SET_FLAGS_STA: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_FLAGS_STA \n"); ret = hostap_set_flags_sta(pDevice, param); -- cgit v0.10.2 From 1acc0d62d0e9607a35f1e7a7500c22bb49d8fab3 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Sun, 8 Jul 2012 22:55:49 -0300 Subject: staging: vt6656: Remove all commented macros These macros were reported by forgotten-macros tool (https://github.com/marcosps/forgotten_macros). Signed-off-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/80211hdr.h b/drivers/staging/vt6656/80211hdr.h index 15c6ef1..b87d543 100644 --- a/drivers/staging/vt6656/80211hdr.h +++ b/drivers/staging/vt6656/80211hdr.h @@ -78,7 +78,6 @@ #define WLAN_HDR_ADDR4_LEN 30 #define WLAN_IEHDR_LEN 2 #define WLAN_SSID_MAXLEN 32 -/* #define WLAN_RATES_MAXLEN 255 */ #define WLAN_RATES_MAXLEN 16 #define WLAN_RATES_MAXLEN_11B 4 #define WLAN_RSN_MAXLEN 32 @@ -104,7 +103,6 @@ #define WLAN_WEP40_KEYLEN 5 #define WLAN_WEP104_KEYLEN 13 #define WLAN_WEP232_KEYLEN 29 -/* #define WLAN_WEPMAX_KEYLEN 29 */ #define WLAN_WEPMAX_KEYLEN 32 #define WLAN_CHALLENGE_IE_MAXLEN 255 #define WLAN_CHALLENGE_IE_LEN 130 diff --git a/drivers/staging/vt6656/bssdb.h b/drivers/staging/vt6656/bssdb.h index a8f97eb..6b2ec39 100644 --- a/drivers/staging/vt6656/bssdb.h +++ b/drivers/staging/vt6656/bssdb.h @@ -64,8 +64,6 @@ // send and receive non-IEEE 802.1X frames #define WLAN_STA_AUTHORIZED BIT5 -//#define MAX_RATE 12 - #define MAX_WPA_IE_LEN 64 diff --git a/drivers/staging/vt6656/card.h b/drivers/staging/vt6656/card.h index 9cf71a3..55962b1 100644 --- a/drivers/staging/vt6656/card.h +++ b/drivers/staging/vt6656/card.h @@ -52,7 +52,6 @@ typedef enum _CARD_OP_MODE { } CARD_OP_MODE, *PCARD_OP_MODE; #define CB_MAX_CHANNEL_24G 14 -/* #define CB_MAX_CHANNEL_5G 24 */ #define CB_MAX_CHANNEL_5G 42 /* add channel9(5045MHz), 41==>42 */ #define CB_MAX_CHANNEL (CB_MAX_CHANNEL_24G+CB_MAX_CHANNEL_5G) diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index f1496ec..171dd68 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -106,10 +106,6 @@ #define MAX_MULTICAST_ADDRESS_NUM 32 #define MULTICAST_ADDRESS_LIST_SIZE (MAX_MULTICAST_ADDRESS_NUM * ETH_ALEN) -//#define OP_MODE_INFRASTRUCTURE 0 -//#define OP_MODE_ADHOC 1 -//#define OP_MODE_AP 2 - #define DUPLICATE_RX_CACHE_LENGTH 5 #define NUM_KEY_ENTRY 11 diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 5048341..b06fd5b 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -205,11 +205,6 @@ static const long frequency_list[] = { }; -#ifndef IW_ENCODE_NOKEY -#define IW_ENCODE_NOKEY 0x0800 -#define IW_ENCODE_MODE (IW_ENCODE_DISABLED | IW_ENCODE_RESTRICTED | IW_ENCODE_OPEN) -#endif - static const struct iw_handler_def iwctl_handler_def; */ diff --git a/drivers/staging/vt6656/mib.h b/drivers/staging/vt6656/mib.h index a89cca0..82d69a9 100644 --- a/drivers/staging/vt6656/mib.h +++ b/drivers/staging/vt6656/mib.h @@ -113,7 +113,6 @@ typedef struct tagSMib2Counter { } SMib2Counter, *PSMib2Counter; // Value in the ifType entry -//#define ETHERNETCSMACD 6 // #define WIRELESSLANIEEE80211b 6 // // Value in the ifAdminStatus/ifOperStatus entry diff --git a/drivers/staging/vt6656/tether.h b/drivers/staging/vt6656/tether.h index 4ec0523..8c1f5d2 100644 --- a/drivers/staging/vt6656/tether.h +++ b/drivers/staging/vt6656/tether.h @@ -72,7 +72,6 @@ #define TYPE_CTL_ACK 0xd400 -//#define WEP_IV_MASK 0xFFFFFF00 #else //if LITTLE_ENDIAN // @@ -111,7 +110,6 @@ #define TYPE_CTL_ACK 0x00d4 -//#define WEP_IV_MASK 0x00FFFFFF #endif //#ifdef __BIG_ENDIAN diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c index c612ab5..609e8fa 100644 --- a/drivers/staging/vt6656/usbpipe.c +++ b/drivers/staging/vt6656/usbpipe.c @@ -52,9 +52,6 @@ //endpoint 2: read bulk //endpoint 3: write bulk -//RequestType: -//#define REQUEST_OUT (USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE) // 0x40 -//#define REQUEST_IN (USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE ) //0xc0 //static int msglevel =MSG_LEVEL_DEBUG; static int msglevel =MSG_LEVEL_INFO; -- cgit v0.10.2 From 5328b9ccfc4db5c03aeb05bf0d205625d67dd911 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Sun, 8 Jul 2012 22:55:50 -0300 Subject: staging: vt6656: Remove unsed macros These macros were reported by forgotten-macros tool (https://github.com/marcosps/forgotten_macros). Signed-off-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c index 9d09e9f..e3ddc0b 100644 --- a/drivers/staging/vt6656/card.c +++ b/drivers/staging/vt6656/card.c @@ -66,7 +66,6 @@ static int msglevel =MSG_LEVEL_INFO; /*--------------------- Static Definitions -------------------------*/ -#define CB_TXPOWER_LEVEL 6 /*--------------------- Static Classes ----------------------------*/ diff --git a/drivers/staging/vt6656/channel.c b/drivers/staging/vt6656/channel.c index 99e054d2..6502176 100644 --- a/drivers/staging/vt6656/channel.c +++ b/drivers/staging/vt6656/channel.c @@ -368,8 +368,6 @@ static struct /* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 */ }; -#define NUM_RULES ARRAY_SIZE(ChannelRuleTab) - /*--------------------- Export function -------------------------*/ /************************************************************************ * Country Channel Valid diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index 9b64b10..bb46452 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -73,8 +73,6 @@ static int msglevel = MSG_LEVEL_INFO; /*--------------------- Static Functions --------------------------*/ /*--------------------- Static Definitions -------------------------*/ -#define CRITICAL_PACKET_LEN 256 // if packet size < 256 -> in-direct send - // packet size >= 256 -> direct send const WORD wTimeStampOff[2][MAX_RATE] = { {384, 288, 226, 209, 54, 43, 37, 31, 28, 25, 24, 23}, // Long Preamble -- cgit v0.10.2 From 2478ef577c1d6b39863a51d2622e74f912d9b3f8 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Sun, 8 Jul 2012 23:51:21 -0300 Subject: staging: vt6655: Remove all "if 0" blocks from driver This commit removes code that will never be executed by vt6655 driver. Was the forgotten-macros tool(https://github.com/marcosps/forgotten_macros) who reported these blocks for us. Signed-off-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 3e8283c..d0fefb1 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -1086,15 +1086,6 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) device_free_info(pDevice); return -ENODEV; } -//2008-07-21-01by MikeLiu -//register wpadev -#if 0 - if(wpa_set_wpadev(pDevice, 1)!=0) { - printk("Fail to Register WPADEV?\n"); - unregister_netdev(pDevice->dev); - free_netdev(dev); - } -#endif device_print_info(pDevice); pci_set_drvdata(pcid, pDevice); return 0; @@ -1948,15 +1939,6 @@ device_init_rd0_ring(pDevice); -#if 0 - pDevice->MLMEThr_pid = kernel_thread(MlmeThread, pDevice, CLONE_VM); - if (pDevice->MLMEThr_pid <0 ) - { - printk("unable start thread MlmeThread\n"); - return -1; - } -#endif - //printk("thread id is %d\n",pDevice->MLMEThr_pid); //printk("Create thread time is %x\n",jiffies); //wait_for_completion(&pDevice->notify); @@ -2493,21 +2475,6 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { &(pDevice->byTopCCKBasicRate), &(pDevice->byTopOFDMBasicRate)); -#if 0 -printk("auto rate:Rate : %d,AckRate:%d,TopCCKRate:%d,TopOFDMRate:%d\n", -pDevice->wCurrentRate,pDevice->byACKRate, -pDevice->byTopCCKBasicRate,pDevice->byTopOFDMBasicRate); - -#endif - -#if 0 - - pDevice->wCurrentRate = 11; - pDevice->byACKRate = 8; - pDevice->byTopCCKBasicRate = 3; - pDevice->byTopOFDMBasicRate = 8; -#endif - } } diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c index 87288db..77aad7f 100644 --- a/drivers/staging/vt6655/iwctl.c +++ b/drivers/staging/vt6655/iwctl.c @@ -84,24 +84,6 @@ struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev) pDevice->wstats.status = pDevice->eOPMode; #ifdef Calcu_LinkQual - #if 0 - if(pDevice->byBBType == BB_TYPE_11B) { - if(pDevice->byCurrSQ > 120) - pDevice->scStatistic.LinkQuality = 100; - else - pDevice->scStatistic.LinkQuality = pDevice->byCurrSQ*100/120; - } - else if(pDevice->byBBType == BB_TYPE_11G) { - if(pDevice->byCurrSQ < 20) - pDevice->scStatistic.LinkQuality = 100; - else if(pDevice->byCurrSQ >96) - pDevice->scStatistic.LinkQuality = 0; - else - pDevice->scStatistic.LinkQuality = (96-pDevice->byCurrSQ)*100/76; - } - if(pDevice->bLinkPass !=true) - pDevice->scStatistic.LinkQuality = 0; - #endif if(pDevice->scStatistic.LinkQuality > 100) pDevice->scStatistic.LinkQuality = 100; pDevice->wstats.qual.qual =(unsigned char) pDevice->scStatistic.LinkQuality; @@ -2004,24 +1986,6 @@ param->u.wpa_key.key = (u8 *)key_array; param->u.wpa_key.seq = (u8 *)seq; param->u.wpa_key.seq_len = seq_len; -#if 0 -printk("param->u.wpa_key.alg_name =%d\n",param->u.wpa_key.alg_name); -printk(KERN_DEBUG "param->addr=%pM\n", param->addr); -printk("param->u.wpa_key.set_tx =%d\n",param->u.wpa_key.set_tx); -printk("param->u.wpa_key.key_index =%d\n",param->u.wpa_key.key_index); -printk("param->u.wpa_key.key_len =%d\n",param->u.wpa_key.key_len); -printk("param->u.wpa_key.key ="); -for(ii=0;iiu.wpa_key.key_len;ii++) - printk("%02x:",param->u.wpa_key.key[ii]); - printk("\n"); -printk("param->u.wpa_key.seq_len =%d\n",param->u.wpa_key.seq_len); -printk("param->u.wpa_key.seq ="); -for(ii=0;iiu.wpa_key.seq_len;ii++) - printk("%02x:",param->u.wpa_key.seq[ii]); - printk("\n"); - -printk("...........\n"); -#endif //****set if current action is Network Manager count?? //****this method is so foolish,but there is no other way??? if(param->u.wpa_key.alg_name == WPA_ALG_NONE) { diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c index b8ec783..a2db0ff 100644 --- a/drivers/staging/vt6655/rf.c +++ b/drivers/staging/vt6655/rf.c @@ -1067,48 +1067,6 @@ unsigned char byPwrdBm = 0; break; } -#if 0 - - // 802.11h TPC - if (pDevice->bLinkPass == true) { - // do not over local constraint - if (byPwrdBm > pDevice->abyLocalPwr[uCH]) { - pDevice->byCurPwrdBm = pDevice->abyLocalPwr[uCH]; - byDec = byPwrdBm - pDevice->abyLocalPwr[uCH]; - if (pDevice->byRFType == RF_UW2452) { - byDec *= 3; - } else { - byDec <<= 1; - } - if (byPwr > byDec) { - byPwr -= byDec; - } else { - byPwr = 0; - } - } else { - pDevice->byCurPwrdBm = byPwrdBm; - } - } else { - // do not over regulatory constraint - if (byPwrdBm > pDevice->abyRegPwr[uCH]) { - pDevice->byCurPwrdBm = pDevice->abyRegPwr[uCH]; - byDec = byPwrdBm - pDevice->abyRegPwr[uCH]; - if (pDevice->byRFType == RF_UW2452) { - byDec *= 3; - } else { - byDec <<= 1; - } - if (byPwr > byDec) { - byPwr -= byDec; - } else { - byPwr = 0; - } - } else { - pDevice->byCurPwrdBm = byPwrdBm; - } - } -#endif - // if (pDevice->byLocalID <= REV_ID_VT3253_B1) { if (pDevice->byCurPwr == byPwr) { return true; diff --git a/drivers/staging/vt6655/wcmd.c b/drivers/staging/vt6655/wcmd.c index bab3b01..7b5b99c 100644 --- a/drivers/staging/vt6655/wcmd.c +++ b/drivers/staging/vt6655/wcmd.c @@ -684,18 +684,6 @@ printk("chester-abyDesireSSID=%s\n",((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySS return; } pDevice->byLinkWaitCount = 0; - #if 0 - #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT - // if(pDevice->bWPASuppWextEnabled == true) - { - union iwreq_data wrqu; - memset(&wrqu, 0, sizeof (wrqu)); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - printk("wireless_send_event--->SIOCGIWAP(disassociated:AUTHENTICATE_WAIT_timeout)\n"); - wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); - } - #endif - #endif s_bCommandComplete(pDevice); break; @@ -748,18 +736,6 @@ printk("chester-abyDesireSSID=%s\n",((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySS return; } pDevice->byLinkWaitCount = 0; - #if 0 - #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT - // if(pDevice->bWPASuppWextEnabled == true) - { - union iwreq_data wrqu; - memset(&wrqu, 0, sizeof (wrqu)); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - printk("wireless_send_event--->SIOCGIWAP(disassociated:ASSOCIATE_WAIT_timeout)\n"); - wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); - } - #endif - #endif s_bCommandComplete(pDevice); break; -- cgit v0.10.2 From 9deff1d7975f79dd4564980e9a563bb86c6a64b4 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Sun, 8 Jul 2012 23:51:22 -0300 Subject: staging: vt6655: mac.h: Remove all commented macros These macros were reported by forgotten-macros tool (https://github.com/marcosps/forgotten_macros). Signed-off-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6655/mac.h b/drivers/staging/vt6655/mac.h index b96d27e..e3ccfee 100644 --- a/drivers/staging/vt6655/mac.h +++ b/drivers/staging/vt6655/mac.h @@ -292,19 +292,11 @@ // #define EnCFG_BarkerPream 0x00020000 #define EnCFG_NXTBTTCFPSTR 0x00010000 -//#define EnCFG_TXLMT3UPDATE 0x00008000 -//#define EnCFG_TXLMT2UPDATE 0x00004000 -//#define EnCFG_TXLMT1UPDATE 0x00002000 -//#define EnCFG_TXLMT3EN 0x00001000 -//#define EnCFG_TXLMT2EN 0x00000800 -//#define EnCFG_TXLMT1EN 0x00000400 #define EnCFG_BcnSusClr 0x00000200 #define EnCFG_BcnSusInd 0x00000100 -//#define EnCFG_CWOFF1 0x00000080 #define EnCFG_CFP_ProtectEn 0x00000040 #define EnCFG_ProtectMd 0x00000020 #define EnCFG_HwParCFP 0x00000010 -//#define EnCFG_QOS 0x00000008 #define EnCFG_CFNULRSP 0x00000004 #define EnCFG_BBType_MASK 0x00000003 #define EnCFG_BBType_g 0x00000002 @@ -392,14 +384,6 @@ #define IMR_RADARDETECT 0x10000000 // #define IMR_MEASUREEND 0x08000000 // #define IMR_SOFTTIMER1 0x00200000 // -//#define IMR_SYNCFLUSHOK 0x00100000 // -//#define IMR_ATIMEND 0x00080000 //0000 1000 0000 0000 0000 0000 -//#define IMR_CFPEND 0x00040000 //0000 0100 0000 0000 0000 0000 -//#define IMR_AC3DMA 0x00020000 //0000 0010 0000 0000 0000 0000 -//#define IMR_AC2DMA 0x00010000 //0000 0001 0000 0000 0000 0000 -//#define IMR_AC1DMA 0x00008000 //0000 0000 1000 0000 0000 0000 -//#define IMR_SYNCTX 0x00004000 //0000 0000 0100 0000 0000 0000 -//#define IMR_ATIMTX 0x00002000 //0000 0000 0010 0000 0000 0000 #define IMR_RXDMA1 0x00001000 //0000 0000 0001 0000 0000 0000 #define IMR_RXNOBUF 0x00000800 // #define IMR_MIBNEARFULL 0x00000400 // @@ -424,14 +408,6 @@ #define ISR_RADARDETECT 0x10000000 // #define ISR_MEASUREEND 0x08000000 // #define ISR_SOFTTIMER1 0x00200000 // -//#define ISR_SYNCFLUSHOK 0x00100000 //0001 0000 0000 0000 0000 0000 -//#define ISR_ATIMEND 0x00080000 //0000 1000 0000 0000 0000 0000 -//#define ISR_CFPEND 0x00040000 //0000 0100 0000 0000 0000 0000 -//#define ISR_AC3DMA 0x00020000 //0000 0010 0000 0000 0000 0000 -//#define ISR_AC2DMA 0x00010000 //0000 0001 0000 0000 0000 0000 -//#define ISR_AC1DMA 0x00008000 //0000 0000 1000 0000 0000 0000 -//#define ISR_SYNCTX 0x00004000 //0000 0000 0100 0000 0000 0000 -//#define ISR_ATIMTX 0x00002000 //0000 0000 0010 0000 0000 0000 #define ISR_RXDMA1 0x00001000 //0000 0000 0001 0000 0000 0000 #define ISR_RXNOBUF 0x00000800 //0000 0000 0000 1000 0000 0000 #define ISR_MIBNEARFULL 0x00000400 //0000 0000 0000 0100 0000 0000 -- cgit v0.10.2 From f4621f2cededa3f7679d9d689bb918111c7b5a9c Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Sun, 8 Jul 2012 23:51:23 -0300 Subject: staging: vt6655: rf.c: Remove all unused macros These macros were reported by forgotte-macros tool (https://github.com/marcosps/forgotten_macros). Signed-off-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c index a2db0ff..aa69665 100644 --- a/drivers/staging/vt6655/rf.c +++ b/drivers/staging/vt6655/rf.c @@ -41,52 +41,16 @@ //static int msglevel =MSG_LEVEL_INFO; -#define BY_RF2959_REG_LEN 23 //24bits -#define CB_RF2959_INIT_SEQ 15 -#define SWITCH_CHANNEL_DELAY_RF2959 200 //us -#define RF2959_PWR_IDX_LEN 32 - -#define BY_MA2825_REG_LEN 23 //24bit -#define CB_MA2825_INIT_SEQ 13 -#define SWITCH_CHANNEL_DELAY_MA2825 200 //us -#define MA2825_PWR_IDX_LEN 31 - #define BY_AL2230_REG_LEN 23 //24bit #define CB_AL2230_INIT_SEQ 15 #define SWITCH_CHANNEL_DELAY_AL2230 200 //us #define AL2230_PWR_IDX_LEN 64 -#define BY_UW2451_REG_LEN 23 -#define CB_UW2451_INIT_SEQ 6 -#define SWITCH_CHANNEL_DELAY_UW2451 200 //us -#define UW2451_PWR_IDX_LEN 25 - -//{{ RobertYu: 20041118 -#define BY_MA2829_REG_LEN 23 //24bit -#define CB_MA2829_INIT_SEQ 13 -#define SWITCH_CHANNEL_DELAY_MA2829 200 //us -#define MA2829_PWR_IDX_LEN 64 -//}} RobertYu - -//{{ RobertYu:20050103 #define BY_AL7230_REG_LEN 23 //24bit #define CB_AL7230_INIT_SEQ 16 #define SWITCH_CHANNEL_DELAY_AL7230 200 //us #define AL7230_PWR_IDX_LEN 64 -//}} RobertYu - -//{{ RobertYu: 20041210 -#define BY_UW2452_REG_LEN 23 -#define CB_UW2452_INIT_SEQ 5 //RoberYu:20050113, Rev0.2 Programming Guide(remove R3, so 6-->5) -#define SWITCH_CHANNEL_DELAY_UW2452 100 //us -#define UW2452_PWR_IDX_LEN 64 -//}} RobertYu - -#define BY_VT3226_REG_LEN 23 -#define CB_VT3226_INIT_SEQ 12 -#define SWITCH_CHANNEL_DELAY_VT3226 200 //us -#define VT3226_PWR_IDX_LEN 16 /*--------------------- Static Classes ----------------------------*/ -- cgit v0.10.2 From 3abe0584122fff0db84d584238972e678e4d7c33 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Sun, 8 Jul 2012 23:51:24 -0300 Subject: staging: vt6655: baseband.h: Remove all unused macros These macros were reported by forgotten-macros tool (https://github.com/marcosps/forgotten_macros). Signed-off-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6655/baseband.h b/drivers/staging/vt6655/baseband.h index 8294bdb..be2d689 100644 --- a/drivers/staging/vt6655/baseband.h +++ b/drivers/staging/vt6655/baseband.h @@ -46,36 +46,6 @@ // Baseband RF pair definition in eeprom (Bits 6..0) // -/* -#define RATE_1M 0 -#define RATE_2M 1 -#define RATE_5M 2 -#define RATE_11M 3 -#define RATE_6M 4 -#define RATE_9M 5 -#define RATE_12M 6 -#define RATE_18M 7 -#define RATE_24M 8 -#define RATE_36M 9 -#define RATE_48M 10 -#define RATE_54M 11 -#define RATE_AUTO 12 -#define MAX_RATE 12 - - -//0:11A 1:11B 2:11G -#define BB_TYPE_11A 0 -#define BB_TYPE_11B 1 -#define BB_TYPE_11G 2 - -//0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate) -#define PK_TYPE_11A 0 -#define PK_TYPE_11B 1 -#define PK_TYPE_11GB 2 -#define PK_TYPE_11GA 3 -*/ - - #define PREAMBLE_LONG 0 #define PREAMBLE_SHORT 1 -- cgit v0.10.2 From 27e3b90153c52f79beede1dd5eb51db326a5d8a9 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Sun, 8 Jul 2012 23:51:25 -0300 Subject: staging: vt6655: Remove all commented macros These macros were reported by forgotten-macros tool (https://github.com/marcosps/forgotten_macros). Signed-off-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6655/80211hdr.h b/drivers/staging/vt6655/80211hdr.h index f55283b..c4d2349 100644 --- a/drivers/staging/vt6655/80211hdr.h +++ b/drivers/staging/vt6655/80211hdr.h @@ -80,7 +80,6 @@ #define WLAN_HDR_ADDR4_LEN 30 #define WLAN_IEHDR_LEN 2 #define WLAN_SSID_MAXLEN 32 -/*#define WLAN_RATES_MAXLEN 255*/ #define WLAN_RATES_MAXLEN 16 #define WLAN_RATES_MAXLEN_11B 4 #define WLAN_RSN_MAXLEN 32 @@ -106,7 +105,6 @@ #define WLAN_WEP40_KEYLEN 5 #define WLAN_WEP104_KEYLEN 13 #define WLAN_WEP232_KEYLEN 29 -/*#define WLAN_WEPMAX_KEYLEN 29*/ #define WLAN_WEPMAX_KEYLEN 32 #define WLAN_CHALLENGE_IE_MAXLEN 255 #define WLAN_CHALLENGE_IE_LEN 130 diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c index 1e1c6e3..e7b93a2 100644 --- a/drivers/staging/vt6655/baseband.c +++ b/drivers/staging/vt6655/baseband.c @@ -60,8 +60,6 @@ //static int msglevel =MSG_LEVEL_DEBUG; static int msglevel =MSG_LEVEL_INFO; -//#define PLICE_DEBUG - /*--------------------- Static Classes ----------------------------*/ /*--------------------- Static Variables --------------------------*/ diff --git a/drivers/staging/vt6655/bssdb.c b/drivers/staging/vt6655/bssdb.c index f4f108f..fcffa4f 100644 --- a/drivers/staging/vt6655/bssdb.c +++ b/drivers/staging/vt6655/bssdb.c @@ -58,7 +58,6 @@ #include "wpa2.h" #include "iowpa.h" -//#define PLICE_DEBUG /*--------------------- Static Definitions -------------------------*/ diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h index 138897a..084a1a5 100644 --- a/drivers/staging/vt6655/desc.h +++ b/drivers/staging/vt6655/desc.h @@ -152,10 +152,6 @@ #define FRAGCTL_TKIP 0x0002 // 0000 0010 0000 0000 #define FRAGCTL_LEGACY 0x0001 // 0000 0001 0000 0000 #define FRAGCTL_NONENCRYPT 0x0000 // 0000 0000 0000 0000 -//#define FRAGCTL_AC3 0x0C00 // 0000 0000 0000 1100 -//#define FRAGCTL_AC2 0x0800 // 0000 0000 0000 1000 -//#define FRAGCTL_AC1 0x0400 // 0000 0000 0000 0100 -//#define FRAGCTL_AC0 0x0000 // 0000 0000 0000 0000 #define FRAGCTL_ENDFRAG 0x0300 // 0000 0000 0000 0011 #define FRAGCTL_MIDFRAG 0x0200 // 0000 0000 0000 0010 #define FRAGCTL_STAFRAG 0x0100 // 0000 0000 0000 0001 @@ -184,10 +180,6 @@ #define FRAGCTL_TKIP 0x0200 // 0000 0010 0000 0000 #define FRAGCTL_LEGACY 0x0100 // 0000 0001 0000 0000 #define FRAGCTL_NONENCRYPT 0x0000 // 0000 0000 0000 0000 -//#define FRAGCTL_AC3 0x000C // 0000 0000 0000 1100 -//#define FRAGCTL_AC2 0x0008 // 0000 0000 0000 1000 -//#define FRAGCTL_AC1 0x0004 // 0000 0000 0000 0100 -//#define FRAGCTL_AC0 0x0000 // 0000 0000 0000 0000 #define FRAGCTL_ENDFRAG 0x0003 // 0000 0000 0000 0011 #define FRAGCTL_MIDFRAG 0x0002 // 0000 0000 0000 0010 #define FRAGCTL_STAFRAG 0x0001 // 0000 0000 0000 0001 @@ -195,8 +187,6 @@ #endif // #ifdef __BIG_ENDIAN -//#define TYPE_AC0DMA 0 -//#define TYPE_TXDMA0 1 #define TYPE_TXDMA0 0 #define TYPE_AC0DMA 1 #define TYPE_ATIMDMA 2 @@ -215,7 +205,6 @@ #define TD_FLAGS_NETIF_SKB 0x01 // check if need release skb #define TD_FLAGS_PRIV_SKB 0x02 // check if called from private skb(hostap) #define TD_FLAGS_PS_RETRY 0x04 // check if PS STA frame re-transmit -//#define TD_FLAGS_NETIF_SKB 0x04 /*--------------------- Export Types ------------------------------*/ diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h index 780205c..c5e6b98 100644 --- a/drivers/staging/vt6655/device.h +++ b/drivers/staging/vt6655/device.h @@ -69,10 +69,6 @@ #ifndef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT #define WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT #endif -//2008-4-14 by chester for led issue -//#define FOR_LED_ON_NOTEBOOK -// - // // device specific @@ -91,12 +87,6 @@ #include "key.h" #include "mac.h" -//PLICE_DEBUG-> -//#define THREAD - -//#define TASK_LET -//PLICE_DEBUG<- - /*--------------------- Export Definitions -------------------------*/ @@ -105,11 +95,6 @@ #define MAX_MULTICAST_ADDRESS_NUM 32 #define MULTICAST_ADDRESS_LIST_SIZE (MAX_MULTICAST_ADDRESS_NUM * ETH_ALEN) - -//#define OP_MODE_INFRASTRUCTURE 0 -//#define OP_MODE_ADHOC 1 -//#define OP_MODE_AP 2 - #define DUPLICATE_RX_CACHE_LENGTH 5 #define NUM_KEY_ENTRY 11 diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index d0fefb1..89d1c22 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -87,12 +87,10 @@ #include #include -//#define DEBUG /*--------------------- Static Definitions -------------------------*/ //static int msglevel =MSG_LEVEL_DEBUG; static int msglevel = MSG_LEVEL_INFO; -//#define PLICE_DEBUG // // Define module options // @@ -100,10 +98,8 @@ MODULE_AUTHOR("VIA Networking Technologies, Inc., "); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("VIA Networking Solomon-A/B/G Wireless LAN Adapter Driver"); -//PLICE_DEBUG -> static int mlme_kill; //static struct task_struct * mlme_task; -//PLICE_DEBUG <- #define DEVICE_PARAM(N,D) /* diff --git a/drivers/staging/vt6655/dpc.c b/drivers/staging/vt6655/dpc.c index c0fab4b..e8a71ba 100644 --- a/drivers/staging/vt6655/dpc.c +++ b/drivers/staging/vt6655/dpc.c @@ -55,7 +55,6 @@ #include "iowpa.h" #include "aes_ccmp.h" -//#define PLICE_DEBUG /*--------------------- Static Definitions -------------------------*/ diff --git a/drivers/staging/vt6655/mib.h b/drivers/staging/vt6655/mib.h index 009f3a4..5cd697a 100644 --- a/drivers/staging/vt6655/mib.h +++ b/drivers/staging/vt6655/mib.h @@ -98,7 +98,6 @@ typedef struct tagSMib2Counter { } SMib2Counter, *PSMib2Counter; // Value in the ifType entry -//#define ETHERNETCSMACD 6 // #define WIRELESSLANIEEE80211b 6 // // Value in the ifAdminStatus/ifOperStatus entry @@ -210,7 +209,6 @@ typedef struct tagSISRCounters { #define UNDER_CREATION 3 // #define INVALID 4 // -//#define MAX_RATE 12 // // statistic counter // diff --git a/drivers/staging/vt6655/rf.h b/drivers/staging/vt6655/rf.h index 1f8d82e..73f0969 100644 --- a/drivers/staging/vt6655/rf.h +++ b/drivers/staging/vt6655/rf.h @@ -41,7 +41,6 @@ #define RF_MAXIMAG 0x02 #define RF_AIROHA 0x03 -//#define RF_GCT5103 0x04 #define RF_UW2451 0x05 #define RF_MAXIMG 0x06 #define RF_MAXIM2829 0x07 // RobertYu: 20041118 diff --git a/drivers/staging/vt6655/tether.h b/drivers/staging/vt6655/tether.h index 787d885..6a68f97 100644 --- a/drivers/staging/vt6655/tether.h +++ b/drivers/staging/vt6655/tether.h @@ -90,8 +90,6 @@ #define TYPE_CTL_ACK 0xd400 -//#define WEP_IV_MASK 0xFFFFFF00 - #else //if LITTLE_ENDIAN // // wType field in the SEthernetHeader @@ -143,7 +141,6 @@ #define TYPE_CTL_ACK 0x00d4 -//#define WEP_IV_MASK 0x00FFFFFF #endif //#ifdef __BIG_ENDIAN diff --git a/drivers/staging/vt6655/vntwifi.c b/drivers/staging/vt6655/vntwifi.c index 0491d0b..d645ecd 100644 --- a/drivers/staging/vt6655/vntwifi.c +++ b/drivers/staging/vt6655/vntwifi.c @@ -38,8 +38,6 @@ #include "wmgr.h" #include "datarate.h" -//#define PLICE_DEBUG - /*--------------------- Static Definitions -------------------------*/ //static int msglevel =MSG_LEVEL_DEBUG; //static int msglevel =MSG_LEVEL_INFO; -- cgit v0.10.2 From 4b733a1b0f7b83caef204b1d3cbee2c85b00a055 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Sun, 8 Jul 2012 23:51:26 -0300 Subject: staging: vt6655: hostap.c: Remove all unused macros All these macros were reported by forgotten-macros tool (https://github.com/marcosps/forgotten_macros). Signed-off-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6655/hostap.c b/drivers/staging/vt6655/hostap.c index 7735027..6ac6f45 100644 --- a/drivers/staging/vt6655/hostap.c +++ b/drivers/staging/vt6655/hostap.c @@ -40,14 +40,8 @@ #define VIAWGET_HOSTAPD_MAX_BUF_SIZE 1024 #define HOSTAP_CRYPT_FLAG_SET_TX_KEY BIT0 -#define HOSTAP_CRYPT_FLAG_PERMANENT BIT1 -#define HOSTAP_CRYPT_ERR_UNKNOWN_ALG 2 #define HOSTAP_CRYPT_ERR_UNKNOWN_ADDR 3 -#define HOSTAP_CRYPT_ERR_CRYPT_INIT_FAILED 4 #define HOSTAP_CRYPT_ERR_KEY_SET_FAILED 5 -#define HOSTAP_CRYPT_ERR_TX_KEY_SET_FAILED 6 -#define HOSTAP_CRYPT_ERR_CARD_CONF_FAILED 7 - /*--------------------- Static Definitions -------------------------*/ -- cgit v0.10.2 From 83414d528d2f97d6574c14afb892879c11bbcc7c Mon Sep 17 00:00:00 2001 From: "Justin P. Mattock" Date: Mon, 9 Jul 2012 07:30:27 -0700 Subject: staging "speakup" Fix typos. Signed-off-by: Justin P. Mattock Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/speakup/i18n.c b/drivers/staging/speakup/i18n.c index c211943..ca01734 100644 --- a/drivers/staging/speakup/i18n.c +++ b/drivers/staging/speakup/i18n.c @@ -71,7 +71,7 @@ static char *speakup_default_msgs[MSG_LAST_INDEX] = { [MSG_CTL_SHIFT] = "shift", [MSG_CTL_ALTGR] = "altgr", [MSG_CTL_CONTROL] = "control", - [MSG_CTL_ALT] = "ault", + [MSG_CTL_ALT] = "alt", [MSG_CTL_LSHIFT] = "l shift", [MSG_CTL_SPEAKUP] = "speakup", [MSG_CTL_LCONTROL] = "l control", diff --git a/drivers/staging/speakup/speakup_acnt.h b/drivers/staging/speakup/speakup_acnt.h index 2d88365..6376fca 100644 --- a/drivers/staging/speakup/speakup_acnt.h +++ b/drivers/staging/speakup/speakup_acnt.h @@ -12,5 +12,5 @@ to accept a byte of data. */ #define SYNTH_QUIET 'S' /* synth is not speaking */ #define SYNTH_FULL 'F' /* synth is full. */ -#define SYNTH_ALMOST_EMPTY 'M' /* synth has les than 2 seconds of text left */ +#define SYNTH_ALMOST_EMPTY 'M' /* synth has less than 2 seconds of text left */ #define SYNTH_SPEAKING 's' /* synth is speaking and has a fare way to go */ diff --git a/drivers/staging/speakup/speakup_decpc.c b/drivers/staging/speakup/speakup_decpc.c index de25527..a09a0c9 100644 --- a/drivers/staging/speakup/speakup_decpc.c +++ b/drivers/staging/speakup/speakup_decpc.c @@ -66,7 +66,7 @@ #define CMD_null 0x0000 /* post status */ #define CMD_control 0x1000 /* hard control command */ #define CTRL_mask 0x0F00 /* mask off control nibble */ -#define CTRL_data 0x00FF /* madk to get data byte */ +#define CTRL_data 0x00FF /* mask to get data byte */ #define CTRL_null 0x0000 /* null control */ #define CTRL_vol_up 0x0100 /* increase volume */ #define CTRL_vol_down 0x0200 /* decrease volume */ diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c index 331eae7..df95337 100644 --- a/drivers/staging/speakup/synth.c +++ b/drivers/staging/speakup/synth.c @@ -64,7 +64,7 @@ EXPORT_SYMBOL_GPL(serial_synth_probe); /* Main loop of the progression thread: keep eating from the buffer * and push to the serial port, waiting as needed * - * For devices that have a "full" notification mecanism, the driver can + * For devices that have a "full" notification mechanism, the driver can * adapt the loop the way they prefer. */ void spk_do_catch_up(struct spk_synth *synth) -- cgit v0.10.2 From 2add5f4661ce822fe16afabf925a0133d6b274fb Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Mon, 9 Jul 2012 23:04:18 +0530 Subject: staging/slicoss: remove not-needed ASSERT As the private pointer is valid at the remove of driver, and remove wont' be called if probe fails, so no point for checking of ASSERT Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index d2b82a7..a511a2b 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -3196,7 +3196,6 @@ static void __devexit slic_entry_remove(struct pci_dev *pcidev) struct sliccard *card; struct mcast_address *mcaddr, *mlist; - ASSERT(adapter); slic_adapter_freeresources(adapter); slic_unmap_mmio_space(adapter); unregister_netdev(dev); -- cgit v0.10.2 From 0ab1900539d46a3a8b7a006819ef5ec0e3288e5b Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Mon, 9 Jul 2012 23:04:20 +0530 Subject: staging/slicoss: return -ENODEV if no devid matches if no case matches we are simply asserting and doing break. and i think we may need to return that -ENODEV , no device is present, rather assert'ing. Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index a511a2b..785e4c5 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -3745,8 +3745,7 @@ static u32 slic_card_locate(struct adapter *adapter) rdhostid_offset = SLIC_RDHOSTID_1GB; break; default: - ASSERT(0); - break; + return -ENODEV; } hostid_reg = -- cgit v0.10.2 From 21cd1fab058671313f7c178b640999fcd0d8de21 Mon Sep 17 00:00:00 2001 From: Jon Brenner Date: Wed, 16 May 2012 10:46:42 -0500 Subject: IIO channel type and modifiers for CCT and RGBC data Add iio channel type and modifiers for Correlated Color Temperature (CCT) and RGBC (red/green/blue/clear) data. Add CCT and RGBC descriptions to documentation. Changes: Revised/condensed RGBC descriptions. Merge and trivial fix done by Jonathan Cameron. Signed-off-by: Jon Brenner Signed-off-by: Jonathan Cameron diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index bb3c692..2ec266e 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -64,6 +64,7 @@ static const char * const iio_chan_type_name_spec[] = { [IIO_TIMESTAMP] = "timestamp", [IIO_CAPACITANCE] = "capacitance", [IIO_ALTVOLTAGE] = "altvoltage", + [IIO_CCT] = "cct", }; static const char * const iio_modifier_names[] = { @@ -74,6 +75,10 @@ static const char * const iio_modifier_names[] = { [IIO_MOD_SUM_SQUARED_X_Y_Z] = "x^2+y^2+z^2", [IIO_MOD_LIGHT_BOTH] = "both", [IIO_MOD_LIGHT_IR] = "ir", + [IIO_MOD_LIGHT_CLEAR] = "clear", + [IIO_MOD_LIGHT_RED] = "red", + [IIO_MOD_LIGHT_GREEN] = "green", + [IIO_MOD_LIGHT_BLUE] = "blue", }; /* relies on pairs of these shared then separate */ diff --git a/drivers/staging/iio/Documentation/sysfs-bus-iio-light b/drivers/staging/iio/Documentation/sysfs-bus-iio-light index d52be03..a28919d 100644 --- a/drivers/staging/iio/Documentation/sysfs-bus-iio-light +++ b/drivers/staging/iio/Documentation/sysfs-bus-iio-light @@ -82,3 +82,26 @@ Contact: linux-iio@vger.kernel.org Description: This property gets/sets the table of coefficients used in calculating illuminance in lux. + +What: /sys/bus/iio/devices/device[n]/in_intensity_clear[_input|_raw] +What: /sys/bus/iio/devices/device[n]/in_intensity_red[_input|_raw] +What: /sys/bus/iio/devices/device[n]/in_intensity_green[_input|_raw] +What: /sys/bus/iio/devices/device[n]/in_intensity_blue[_input|_raw] +KernelVersion: 3.4.0 +Contact: linux-iio@vger.kernel.org +Description: + This property is supported by sensors that have a RGBC + sensing mode. This value should be the output from a reading + and if expressed in SI units, should include _input. If this + value is not in SI units (irradiance, uW/mm^2), then it should + include _raw. + +What: /sys/bus/iio/devices/device[n]/in_cct0[_input|_raw] +KernelVersion: 3.4.0 +Contact: linux-iio@vger.kernel.org +Description: + This should return the correlated color temperature from the + light sensor. If it comes back in SI units, it should also + include _input else it should include _raw to signify it is not + in SI units. + diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h index e250401..44e3977 100644 --- a/include/linux/iio/types.h +++ b/include/linux/iio/types.h @@ -27,6 +27,7 @@ enum iio_chan_type { IIO_TIMESTAMP, IIO_CAPACITANCE, IIO_ALTVOLTAGE, + IIO_CCT, }; enum iio_modifier { @@ -46,6 +47,10 @@ enum iio_modifier { IIO_MOD_LIGHT_IR, IIO_MOD_ROOT_SUM_SQUARED_X_Y, IIO_MOD_SUM_SQUARED_X_Y_Z, + IIO_MOD_LIGHT_CLEAR, + IIO_MOD_LIGHT_RED, + IIO_MOD_LIGHT_GREEN, + IIO_MOD_LIGHT_BLUE, }; #define IIO_VAL_INT 1 -- cgit v0.10.2 From d05b2fe037d0a6996a357af85b8e18229e534568 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Tue, 10 Jul 2012 20:30:55 +0100 Subject: iio: Trivial documentation fix to correct kernel version info in 21cd1fab058671313f7c178b640999fcd0d8de21 Signed-off-by: Jonathan Cameron Reported-by: Peter Meerwald diff --git a/drivers/staging/iio/Documentation/sysfs-bus-iio-light b/drivers/staging/iio/Documentation/sysfs-bus-iio-light index a28919d..17e5c9c 100644 --- a/drivers/staging/iio/Documentation/sysfs-bus-iio-light +++ b/drivers/staging/iio/Documentation/sysfs-bus-iio-light @@ -87,7 +87,7 @@ What: /sys/bus/iio/devices/device[n]/in_intensity_clear[_input|_raw] What: /sys/bus/iio/devices/device[n]/in_intensity_red[_input|_raw] What: /sys/bus/iio/devices/device[n]/in_intensity_green[_input|_raw] What: /sys/bus/iio/devices/device[n]/in_intensity_blue[_input|_raw] -KernelVersion: 3.4.0 +KernelVersion: 3.6.0 Contact: linux-iio@vger.kernel.org Description: This property is supported by sensors that have a RGBC @@ -97,7 +97,7 @@ Description: include _raw. What: /sys/bus/iio/devices/device[n]/in_cct0[_input|_raw] -KernelVersion: 3.4.0 +KernelVersion: 3.6.0 Contact: linux-iio@vger.kernel.org Description: This should return the correlated color temperature from the -- cgit v0.10.2 From 949eb0aeb939f5c7022c02358f98ffd235b45ac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Fri, 6 Jul 2012 12:40:36 +0200 Subject: Staging: xgifb: Comment cleaning. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove commented code and useless comments. Leave only those with relevant hints to the code. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/XGI_main.h b/drivers/staging/xgifb/XGI_main.h index be6bb7d..1686c5a 100644 --- a/drivers/staging/xgifb/XGI_main.h +++ b/drivers/staging/xgifb/XGI_main.h @@ -68,9 +68,6 @@ static int XGIfb_crt2type = -1; /* PR: Tv plug type (for overriding autodetection) */ static int XGIfb_tvplug = -1; -/* TW: For ioctl XGIFB_GET_INFO */ -/* XGIfb_info XGIfbinfo; */ - #define MD_XGI315 1 /* mode table */ @@ -240,7 +237,6 @@ static const struct _chswtable { { 0, 0, "" , "" } }; -/* Eden Chen */ static const struct _XGI_TV_filter { u8 filter[9][4]; } XGI_TV_filter[] = { diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index fe9061d..b226458 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -36,36 +36,6 @@ static void dumpVGAReg(void) u8 i, reg; xgifb_reg_set(XGISR, 0x05, 0x86); - /* - xgifb_reg_set(XGISR, 0x08, 0x4f); - xgifb_reg_set(XGISR, 0x0f, 0x20); - xgifb_reg_set(XGISR, 0x11, 0x4f); - xgifb_reg_set(XGISR, 0x13, 0x45); - xgifb_reg_set(XGISR, 0x14, 0x51); - xgifb_reg_set(XGISR, 0x1e, 0x41); - xgifb_reg_set(XGISR, 0x1f, 0x0); - xgifb_reg_set(XGISR, 0x20, 0xa1); - xgifb_reg_set(XGISR, 0x22, 0xfb); - xgifb_reg_set(XGISR, 0x26, 0x22); - xgifb_reg_set(XGISR, 0x3e, 0x07); - */ - - /* xgifb_reg_set(XGICR, 0x19, 0x00); */ - /* xgifb_reg_set(XGICR, 0x1a, 0x3C); */ - /* xgifb_reg_set(XGICR, 0x22, 0xff); */ - /* xgifb_reg_set(XGICR, 0x3D, 0x10); */ - - /* xgifb_reg_set(XGICR, 0x4a, 0xf3); */ - - /* xgifb_reg_set(XGICR, 0x57, 0x0); */ - /* xgifb_reg_set(XGICR, 0x7a, 0x2c); */ - - /* xgifb_reg_set(XGICR, 0x82, 0xcc); */ - /* xgifb_reg_set(XGICR, 0x8c, 0x0); */ - /* - xgifb_reg_set(XGICR, 0x99, 0x1); - xgifb_reg_set(XGICR, 0x41, 0x40); - */ for (i = 0; i < 0x4f; i++) { reg = xgifb_reg_get(XGISR, i); @@ -78,30 +48,6 @@ static void dumpVGAReg(void) pr_debug("\no 3d4 %x", i); pr_debug("\ni 3d5 => %x", reg); } - /* - xgifb_reg_set(XGIPART1,0x2F,1); - for (i=1; i < 0x50; i++) { - reg = xgifb_reg_get(XGIPART1, i); - pr_debug("\no d004 %x", i); - pr_debug("\ni d005 => %x", reg); - } - - for (i=0; i < 0x50; i++) { - reg = xgifb_reg_get(XGIPART2, i); - pr_debug("\no d010 %x", i); - pr_debug("\ni d011 => %x", reg); - } - for (i=0; i < 0x50; i++) { - reg = xgifb_reg_get(XGIPART3, i); - pr_debug("\no d012 %x",i); - pr_debug("\ni d013 => %x",reg); - } - for (i=0; i < 0x50; i++) { - reg = xgifb_reg_get(XGIPART4, i); - pr_debug("\no d014 %x",i); - pr_debug("\ni d015 => %x",reg); - } - */ } #else static inline void dumpVGAReg(void) @@ -215,15 +161,6 @@ static int XGIfb_mode_rate_to_ddata(struct vb_device_info *XGI_Pr, | ((unsigned short) (sr_data & 0x01) << 10); A = VT + 2; - /* cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[10]; */ - - /* Vertical display enable end */ - /* - VDE = (cr_data & 0xff) | - ((unsigned short) (cr_data2 & 0x02) << 7) | - ((unsigned short) (cr_data2 & 0x40) << 3) | - ((unsigned short) (sr_data & 0x02) << 9); - */ VDE = XGI_Pr->RefIndex[RefreshRateTableIndex].YRes - 1; E = VDE + 1; @@ -590,7 +527,7 @@ static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex) if (XGIbios_mode[myindex].yres != 576) return -1; } - /* TW: LVDS/CHRONTEL does not support 720 */ + /* LVDS/CHRONTEL does not support 720 */ if (xgifb_info->hasVB == HASVB_LVDS_CHRONTEL || xgifb_info->hasVB == HASVB_CHRONTEL) { return -1; @@ -794,26 +731,25 @@ static void XGIfb_post_setmode(struct xgifb_video_info *xgifb_info) { u8 reg; unsigned char doit = 1; - /* - xgifb_reg_set(XGISR,IND_SIS_PASSWORD,SIS_PASSWORD); - xgifb_reg_set(XGICR, 0x13, 0x00); - xgifb_reg_and_or(XGISR,0x0E, 0xF0, 0x01); - *test* - */ + if (xgifb_info->video_bpp == 8) { - /* TW: We can't switch off CRT1 on LVDS/Chrontel - * in 8bpp Modes */ + /* + * We can't switch off CRT1 on LVDS/Chrontel + * in 8bpp Modes + */ if ((xgifb_info->hasVB == HASVB_LVDS) || (xgifb_info->hasVB == HASVB_LVDS_CHRONTEL)) { doit = 0; } - /* TW: We can't switch off CRT1 on 301B-DH - * in 8bpp Modes if using LCD */ + /* + * We can't switch off CRT1 on 301B-DH + * in 8bpp Modes if using LCD + */ if (xgifb_info->display2 == XGIFB_DISP_LCD) doit = 0; } - /* TW: We can't switch off CRT1 if bridge is in slave mode */ + /* We can't switch off CRT1 if bridge is in slave mode */ if (xgifb_info->hasVB != HASVB_NONE) { reg = xgifb_reg_get(XGIPART1, 0x00); @@ -1038,7 +974,6 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, unsigned int drate = 0, hrate = 0; int found_mode = 0; int old_mode; - /* unsigned char reg, reg1; */ info->var.xres_virtual = var->xres_virtual; info->var.yres_virtual = var->yres_virtual; @@ -1049,8 +984,6 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE) vtotal <<= 2; else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) { - /* vtotal <<= 1; */ - /* var->yres <<= 1; */ } if (!htotal || !vtotal) { @@ -1388,16 +1321,7 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) xgifb_info->refresh_rate = 60; } - /* - if ((var->pixclock) && (htotal)) { - drate = 1E12 / var->pixclock; - hrate = drate / htotal; - refresh_rate = (unsigned int) (hrate / vtotal * 2 + 0.5); - } else { - refresh_rate = 60; - } - */ - /* TW: Calculation wrong for 1024x600 - force it to 60Hz */ + /* Calculation wrong for 1024x600 - force it to 60Hz */ if ((var->xres == 1024) && (var->yres == 600)) refresh_rate = 60; @@ -1446,8 +1370,6 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) } } - /* TW: TODO: Check the refresh rate */ - /* Adapt RGB settings */ XGIfb_bpp_to_var(xgifb_info, var); @@ -1462,16 +1384,7 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) var->xres_virtual = var->xres; if (var->yres != var->yres_virtual) var->yres_virtual = var->yres; - } /* else { */ - /* TW: Now patch yres_virtual if we use panning */ - /* May I do this? */ - /* var->yres_virtual = xgifb_info->heapstart / - (var->xres * (var->bits_per_pixel >> 3)); */ - /* if (var->yres_virtual <= var->yres) { */ - /* TW: Paranoia check */ - /* var->yres_virtual = var->yres; */ - /* } */ - /* } */ + } /* Truncate offsets to maximum if too high */ if (var->xoffset > var->xres_virtual - var->xres) @@ -1553,7 +1466,6 @@ static struct fb_ops XGIfb_ops = { .fb_fillrect = cfb_fillrect, .fb_copyarea = cfb_copyarea, .fb_imageblit = cfb_imageblit, - /* .fb_mmap = XGIfb_mmap, */ }; /* ---------------- Chip generation dependent routines ---------------- */ @@ -1630,9 +1542,6 @@ static int XGIfb_get_dram_size(struct xgifb_video_info *xgifb_info) } xgifb_info->video_size = xgifb_info->video_size * ChannelNum; - /* PLiad fixed for benchmarking and fb set */ - /* xgifb_info->video_size = 0x200000; */ /* 1024x768x16 */ - /* xgifb_info->video_size = 0x1000000; */ /* benchmark */ pr_info("SR14=%x DramSzie %x ChannelNum %x\n", reg, @@ -1680,7 +1589,7 @@ static void XGIfb_detect_VB(struct xgifb_video_info *xgifb_info) } if (XGIfb_tvplug != -1) - /* PR/TW: Override with option */ + /* Override with option */ xgifb_info->TV_plug = XGIfb_tvplug; else if (cr32 & SIS_VB_HIVISION) { xgifb_info->TV_type = TVMODE_HIVISION; @@ -1700,7 +1609,7 @@ static void XGIfb_detect_VB(struct xgifb_video_info *xgifb_info) xgifb_info->TV_type = TVMODE_NTSC; } - /* TW: Copy forceCRT1 option to CRT1off if option is given */ + /* Copy forceCRT1 option to CRT1off if option is given */ if (XGIfb_forcecrt1 != -1) { if (XGIfb_forcecrt1) XGIfb_crt1off = 0; @@ -1794,7 +1703,7 @@ static int __init XGIfb_setup(char *options) XGIfb_search_tvstd(this_opt + 7); } else if (!strncmp(this_opt, "dstn", 4)) { enable_dstn = 1; - /* TW: DSTN overrules forcecrt2type */ + /* DSTN overrules forcecrt2type */ XGIfb_crt2type = XGIFB_DISP_LCD; } else if (!strncmp(this_opt, "noypan", 6)) { XGIfb_ypan = 0; @@ -1981,13 +1890,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, dev_info(&pdev->dev, "XGI301LV bridge detected (revision 0x%02x)\n", reg); - } - /* else if (reg >= 0xB0) { - hw_info->ujVBChipID = VB_CHIP_301B; - reg1 = xgifb_reg_get(XGIPART4, 0x23); - pr_debug("XGIfb: XGI301B bridge detected\n"); - } */ - else { + } else { hw_info->ujVBChipID = VB_CHIP_301; dev_info(&pdev->dev, "XGI301 bridge detected\n"); } @@ -2104,7 +2007,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, goto error_1; } - /* yilin set default refresh rate */ + /* set default refresh rate */ xgifb_info->refresh_rate = refresh_rate; if (xgifb_info->refresh_rate == 0) xgifb_info->refresh_rate = 60; diff --git a/drivers/staging/xgifb/XGIfb.h b/drivers/staging/xgifb/XGIfb.h index 741bba3..8054798 100644 --- a/drivers/staging/xgifb/XGIfb.h +++ b/drivers/staging/xgifb/XGIfb.h @@ -30,13 +30,13 @@ enum xgi_tvtype { TVMODE_NTSC = 0, TVMODE_PAL, TVMODE_HIVISION, - TVTYPE_PALM, /* vicki@030226 */ - TVTYPE_PALN, /* vicki@030226 */ - TVTYPE_NTSCJ, /* vicki@030226 */ + TVTYPE_PALM, + TVTYPE_PALN, + TVTYPE_NTSCJ, TVMODE_TOTAL }; -enum xgi_tv_plug { /* vicki@030226 */ +enum xgi_tv_plug { TVPLUG_UNKNOWN = 0, TVPLUG_COMPOSITE = 1, TVPLUG_SVIDEO = 2, diff --git a/drivers/staging/xgifb/vb_def.h b/drivers/staging/xgifb/vb_def.h index 5b987a6..69078d9 100644 --- a/drivers/staging/xgifb/vb_def.h +++ b/drivers/staging/xgifb/vb_def.h @@ -1,5 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/xgi/initdef.h - * ,v 1.4 2000/12/02 01:16:17 dawes Exp $*/ #ifndef _VB_DEF_ #define _VB_DEF_ #include "../../video/sis/initdef.h" @@ -12,7 +10,6 @@ #define SetCHTVOverScan 0x8000 #define Panel_320x480 0x07 /*fstn*/ -/* [ycchen] 02/12/03 Modify for Multi-Sync. LCD Support */ #define PanelResInfo 0x1F /* CR36 Panel Type/LCDResInfo */ #define Panel_1024x768x75 0x22 #define Panel_1280x1024x75 0x23 diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c index 7c555a7..6bb0206 100644 --- a/drivers/staging/xgifb/vb_init.c +++ b/drivers/staging/xgifb/vb_init.c @@ -1,4 +1,4 @@ -#include /* udelay */ +#include #include #include "XGIfb.h" @@ -132,10 +132,8 @@ static void XGINew_SetMemoryClock(struct xgi_hw_device_info *HwDeviceExtension, 0x30, pVBInfo->ECLKData[pVBInfo->ram_type].SR30); - /* [Vicent] 2004/07/07, - * When XG42 ECLK = MCLK = 207MHz, Set SR32 D[1:0] = 10b */ - /* [Hsuan] 2004/08/20, - * Modify SR32 value, when MCLK=207MHZ, ELCK=250MHz, + /* When XG42 ECLK = MCLK = 207MHz, Set SR32 D[1:0] = 10b */ + /* Modify SR32 value, when MCLK=207MHZ, ELCK=250MHz, * Set SR32 D[1:0] = 10b */ if (HwDeviceExtension->jChipType == XG42) { if ((pVBInfo->MCLKData[pVBInfo->ram_type].SR28 == 0x1C) && @@ -160,7 +158,6 @@ static void XGINew_DDRII_Bootup_XG27( XGINew_SetMemoryClock(HwDeviceExtension, pVBInfo); /* Set Double Frequency */ - /* xgifb_reg_set(P3d4, 0x97, 0x11); *//* CR97 */ xgifb_reg_set(P3d4, 0x97, pVBInfo->XGINew_CR97); /* CR97 */ udelay(200); @@ -192,7 +189,6 @@ static void XGINew_DDRII_Bootup_XG27( udelay(30); xgifb_reg_set(P3c4, 0x16, 0x00); /* Set SR16 */ xgifb_reg_set(P3c4, 0x16, 0x80); /* Set SR16 */ - /* udelay(15); */ xgifb_reg_set(P3c4, 0x1B, 0x04); /* Set SR1B */ udelay(60); @@ -252,7 +248,6 @@ static void XGINew_DDR2_MRS_XG20(struct xgi_hw_device_info *HwDeviceExtension, xgifb_reg_set(P3c4, 0x16, 0x05); xgifb_reg_set(P3c4, 0x16, 0x85); - /* xgifb_reg_set(P3c4, 0x18, 0x52); */ /* MRS1 */ xgifb_reg_set(P3c4, 0x18, 0x42); /* MRS1 */ xgifb_reg_set(P3c4, 0x19, 0x02); xgifb_reg_set(P3c4, 0x16, 0x05); @@ -264,7 +259,6 @@ static void XGINew_DDR2_MRS_XG20(struct xgi_hw_device_info *HwDeviceExtension, xgifb_reg_set(P3c4, 0x1B, 0x00); /* SR1B */ udelay(100); - /* xgifb_reg_set(P3c4 ,0x18, 0x52); */ /* MRS2 */ xgifb_reg_set(P3c4, 0x18, 0x42); /* MRS1 */ xgifb_reg_set(P3c4, 0x19, 0x00); xgifb_reg_set(P3c4, 0x16, 0x05); @@ -290,14 +284,12 @@ static void XGINew_DDR1x_MRS_XG20(unsigned long P3c4, xgifb_reg_set(P3c4, 0x18, pVBInfo->SR15[2][pVBInfo->ram_type]); /* SR18 */ - /* xgifb_reg_set(P3c4, 0x18, 0x31); */ xgifb_reg_set(P3c4, 0x19, 0x01); xgifb_reg_set(P3c4, 0x16, 0x03); xgifb_reg_set(P3c4, 0x16, 0x83); mdelay(1); xgifb_reg_set(P3c4, 0x1B, 0x03); udelay(500); - /* xgifb_reg_set(P3c4, 0x18, 0x31); */ xgifb_reg_set(P3c4, 0x18, pVBInfo->SR15[2][pVBInfo->ram_type]); /* SR18 */ @@ -546,7 +538,6 @@ static void XGINew_SetDRAMDefaultRegister340( xgifb_reg_set(P3d4, 0x87, 0x00); /* CR87 */ xgifb_reg_set(P3d4, 0xCF, XG40_CRCF); /* CRCF */ if (pVBInfo->ram_type) { - /* xgifb_reg_set(P3c4, 0x17, 0xC0); */ /* SR17 DDRII */ xgifb_reg_set(P3c4, 0x17, 0x80); /* SR17 DDRII */ if (HwDeviceExtension->jChipType == XG27) xgifb_reg_set(P3c4, 0x17, 0x02); /* SR17 DDRII */ @@ -597,19 +588,12 @@ static unsigned short XGINew_SetDRAMSize20Reg( memsize = data >> 4; - /* [2004/03/25] Vicent, Fix DRAM Sizing Error */ + /* Fix DRAM Sizing Error */ xgifb_reg_set(pVBInfo->P3c4, 0x14, (xgifb_reg_get(pVBInfo->P3c4, 0x14) & 0x0F) | (data & 0xF0)); udelay(15); - - /* data |= pVBInfo->ram_channel << 2; */ - /* data |= (pVBInfo->ram_bus / 64) << 1; */ - /* xgifb_reg_set(pVBInfo->P3c4, 0x14, data); */ - - /* should delay */ - /* XGINew_SetDRAMModeRegister340(pVBInfo); */ } return memsize; } @@ -628,8 +612,7 @@ static int XGINew_ReadWriteRest(unsigned short StopAddr, writel(Position, fbaddr + Position); } - udelay(500); /* [Vicent] 2004/04/16. - Fix #1759 Memory Size error in Multi-Adapter. */ + udelay(500); /* Fix #1759 Memory Size error in Multi-Adapter. */ Position = 0; @@ -925,9 +908,6 @@ static void XGINew_SetDRAMSize_340(struct xgifb_video_info *xgifb_info, xgifb_reg_set(pVBInfo->P3c4, 0x21, (unsigned short) (data & 0xDF)); XGI_DisplayOff(xgifb_info, HwDeviceExtension, pVBInfo); - /* data = xgifb_reg_get(pVBInfo->P3c4, 0x1); */ - /* data |= 0x20 ; */ - /* xgifb_reg_set(pVBInfo->P3c4, 0x01, data); *//* Turn OFF Display */ XGINew_DDRSizing340(HwDeviceExtension, pVBInfo); data = xgifb_reg_get(pVBInfo->P3c4, 0x21); /* enable read cache */ @@ -1308,16 +1288,11 @@ unsigned char XGIInitNew(struct pci_dev *pdev) struct vb_device_info VBINF; struct vb_device_info *pVBInfo = &VBINF; unsigned char i, temp = 0, temp1; - /* VBIOSVersion[5]; */ - - /* unsigned long j, k; */ pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress; pVBInfo->BaseAddr = xgifb_info->vga_base; - /* Newdebugcode(0x99); */ - if (pVBInfo->FBAddr == NULL) { dev_dbg(&pdev->dev, "pVBInfo->FBAddr == 0\n"); return 0; @@ -1331,10 +1306,6 @@ unsigned char XGIInitNew(struct pci_dev *pdev) pVBInfo->ISXPDOS = 0; - /* VBIOSVersion[4] = 0x0; */ - - /* 09/07/99 modify by domao */ - pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14; pVBInfo->P3d4 = pVBInfo->BaseAddr + 0x24; pVBInfo->P3c0 = pVBInfo->BaseAddr + 0x10; @@ -1353,7 +1324,7 @@ unsigned char XGIInitNew(struct pci_dev *pdev) pVBInfo->Part4Port = pVBInfo->BaseAddr + SIS_CRT2_PORT_14; pVBInfo->Part5Port = pVBInfo->BaseAddr + SIS_CRT2_PORT_14 + 2; - if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 */ + if (HwDeviceExtension->jChipType < XG20) /* Run XGI_GetVBType before InitTo330Pointer */ XGI_GetVBType(pVBInfo); @@ -1361,7 +1332,7 @@ unsigned char XGIInitNew(struct pci_dev *pdev) xgifb_read_vbios(pdev, pVBInfo); - /* 1.Openkey */ + /* Openkey */ xgifb_reg_set(pVBInfo->P3c4, 0x05, 0x86); /* GetXG21Sense (GPIO) */ @@ -1371,7 +1342,7 @@ unsigned char XGIInitNew(struct pci_dev *pdev) if (HwDeviceExtension->jChipType == XG27) XGINew_GetXG27Sense(HwDeviceExtension, pVBInfo); - /* 2.Reset Extended register */ + /* Reset Extended register */ for (i = 0x06; i < 0x20; i++) xgifb_reg_set(pVBInfo->P3c4, i, 0); @@ -1379,31 +1350,20 @@ unsigned char XGIInitNew(struct pci_dev *pdev) for (i = 0x21; i <= 0x27; i++) xgifb_reg_set(pVBInfo->P3c4, i, 0); - /* for(i = 0x06; i <= 0x27; i++) */ - /* xgifb_reg_set(pVBInfo->P3c4, i, 0); */ - for (i = 0x31; i <= 0x3B; i++) xgifb_reg_set(pVBInfo->P3c4, i, 0); - /* [Hsuan] 2004/08/20 Auto over driver for XG42 */ + /* Auto over driver for XG42 */ if (HwDeviceExtension->jChipType == XG42) xgifb_reg_set(pVBInfo->P3c4, 0x3B, 0xC0); - /* for (i = 0x30; i <= 0x3F; i++) */ - /* xgifb_reg_set(pVBInfo->P3d4, i, 0); */ - for (i = 0x79; i <= 0x7C; i++) - xgifb_reg_set(pVBInfo->P3d4, i, 0); /* shampoo 0208 */ + xgifb_reg_set(pVBInfo->P3d4, i, 0); if (HwDeviceExtension->jChipType >= XG20) xgifb_reg_set(pVBInfo->P3d4, 0x97, pVBInfo->XGINew_CR97); - /* 3.SetMemoryClock - - pVBInfo->ram_type = XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo); - */ - - /* 4.SetDefExt1Regs begin */ + /* SetDefExt1Regs begin */ xgifb_reg_set(pVBInfo->P3c4, 0x07, XGI330_SR07); if (HwDeviceExtension->jChipType == XG27) { xgifb_reg_set(pVBInfo->P3c4, 0x40, XG27_SR40); @@ -1411,62 +1371,16 @@ unsigned char XGIInitNew(struct pci_dev *pdev) } xgifb_reg_set(pVBInfo->P3c4, 0x11, 0x0F); xgifb_reg_set(pVBInfo->P3c4, 0x1F, XGI330_SR1F); - /* xgifb_reg_set(pVBInfo->P3c4, 0x20, 0x20); */ - /* alan, 2001/6/26 Frame buffer can read/write SR20 */ + /* Frame buffer can read/write SR20 */ xgifb_reg_set(pVBInfo->P3c4, 0x20, 0xA0); - /* Hsuan, 2006/01/01 H/W request for slow corner chip */ + /* H/W request for slow corner chip */ xgifb_reg_set(pVBInfo->P3c4, 0x36, 0x70); - if (HwDeviceExtension->jChipType == XG27) /* Alan 12/07/2006 */ + if (HwDeviceExtension->jChipType == XG27) xgifb_reg_set(pVBInfo->P3c4, 0x36, XG27_SR36); - /* SR11 = 0x0F; */ - /* xgifb_reg_set(pVBInfo->P3c4, 0x11, SR11); */ - - if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */ + if (HwDeviceExtension->jChipType < XG20) { u32 Temp; - /* Set AGP Rate */ - /* - temp1 = xgifb_reg_get(pVBInfo->P3c4, 0x3B); - temp1 &= 0x02; - if (temp1 == 0x02) { - outl(0x80000000, 0xcf8); - ChipsetID = inl(0x0cfc); - outl(0x8000002C, 0xcf8); - VendorID = inl(0x0cfc); - VendorID &= 0x0000FFFF; - outl(0x8001002C, 0xcf8); - GraphicVendorID = inl(0x0cfc); - GraphicVendorID &= 0x0000FFFF; - - if (ChipsetID == 0x7301039) - xgifb_reg_set(pVBInfo->P3d4, 0x5F, 0x09); - - ChipsetID &= 0x0000FFFF; - - if ((ChipsetID == 0x700E) || - (ChipsetID == 0x1022) || - (ChipsetID == 0x1106) || - (ChipsetID == 0x10DE)) { - if (ChipsetID == 0x1106) { - if ((VendorID == 0x1019) && - (GraphicVendorID == 0x1019)) - xgifb_reg_set(pVBInfo->P3d4, - 0x5F, - 0x0D); - else - xgifb_reg_set(pVBInfo->P3d4, - 0x5F, - 0x0B); - } else { - xgifb_reg_set(pVBInfo->P3d4, - 0x5F, - 0x0B); - } - } - } - */ - /* Set AGP customize registers (in SetDefAGPRegs) Start */ for (i = 0x47; i <= 0x4C; i++) xgifb_reg_set(pVBInfo->P3d4, @@ -1482,12 +1396,6 @@ unsigned char XGIInitNew(struct pci_dev *pdev) xgifb_reg_set(pVBInfo->P3d4, i, pVBInfo->AGPReg[8 + i - 0x74]); - /* Set AGP customize registers (in SetDefAGPRegs) End */ - /* [Hsuan]2004/12/14 AGP Input Delay Adjustment on 850 */ - /* outl(0x80000000, 0xcf8); */ - /* ChipsetID = inl(0x0cfc); */ - /* if (ChipsetID == 0x25308086) */ - /* xgifb_reg_set(pVBInfo->P3d4, 0x77, 0xF0); */ pci_read_config_dword(pdev, 0x50, &Temp); Temp >>= 20; @@ -1502,10 +1410,10 @@ unsigned char XGIInitNew(struct pci_dev *pdev) xgifb_reg_set(pVBInfo->P3c4, 0x24, XGI330_SR24); xgifb_reg_set(pVBInfo->P3c4, 0x25, XGI330_SR25); - if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */ + if (HwDeviceExtension->jChipType < XG20) { /* Set VB */ XGI_UnLockCRT2(HwDeviceExtension, pVBInfo); - /* alan, disable VideoCapture */ + /* disable VideoCapture */ xgifb_reg_and_or(pVBInfo->Part0Port, 0x3F, 0xEF, 0x00); xgifb_reg_set(pVBInfo->Part1Port, 0x00, 0x00); /* chk if BCLK>=100MHz */ @@ -1535,10 +1443,7 @@ unsigned char XGIInitNew(struct pci_dev *pdev) } xgifb_reg_set(pVBInfo->P3c4, 0x33, XGI330_SR33); - /* - SetPowerConsume (HwDeviceExtension, pVBInfo->P3c4); */ - - if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */ + if (HwDeviceExtension->jChipType < XG20) { if (XGI_BridgeIsOn(pVBInfo) == 1) { if (pVBInfo->IF_DEF_LVDS == 0) { xgifb_reg_set(pVBInfo->Part2Port, 0x00, 0x1C); @@ -1557,7 +1462,6 @@ unsigned char XGIInitNew(struct pci_dev *pdev) XGI_SenseCRT1(pVBInfo); - /* XGINew_DetectMonitor(HwDeviceExtension); */ if (HwDeviceExtension->jChipType == XG21) { xgifb_reg_and_or(pVBInfo->P3d4, @@ -1585,32 +1489,9 @@ unsigned char XGIInitNew(struct pci_dev *pdev) XGINew_SetDRAMSize_340(xgifb_info, HwDeviceExtension, pVBInfo); - /* SetDefExt2Regs begin */ - /* - AGP = 1; - temp = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x3A); - temp &= 0x30; - if (temp == 0x30) - AGP = 0; - - if (AGP == 0) - pVBInfo->SR21 &= 0xEF; - - xgifb_reg_set(pVBInfo->P3c4, 0x21, pVBInfo->SR21); - if (AGP == 1) - pVBInfo->SR22 &= 0x20; - xgifb_reg_set(pVBInfo->P3c4, 0x22, pVBInfo->SR22); - */ - /* base = 0x80000000; */ - /* OutPortLong(0xcf8, base); */ - /* Temp = (InPortLong(0xcfc) & 0xFFFF); */ - /* if (Temp == 0x1039) { */ xgifb_reg_set(pVBInfo->P3c4, 0x22, (unsigned char) ((pVBInfo->SR22) & 0xFE)); - /* } else { */ - /* xgifb_reg_set(pVBInfo->P3c4, 0x22, pVBInfo->SR22); */ - /* } */ xgifb_reg_set(pVBInfo->P3c4, 0x21, pVBInfo->SR21); diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index 479362e..3ba3c48 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -1859,7 +1859,6 @@ static void *XGI_GetTVPtr(unsigned short BX, unsigned short ModeNo, i++; } - /* 07/05/22 */ if (table == 0x04) { switch (tempdi[i].DATAPTR) { case 0: @@ -2519,7 +2518,7 @@ static void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension, temp &= 0x0f; if (!(temp == 0x08)) { - /* Check ChannelA by Part1_13 [2003/10/03] */ + /* Check ChannelA */ tempax = xgifb_reg_get(pVBInfo->Part1Port, 0x13); if (tempax & 0x04) tempcl = tempcl | ActiveLCD; @@ -2675,7 +2674,6 @@ static void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex, } if (pVBInfo->IF_DEF_YPbPr == 1) { - /* [Billy] 07/05/04 */ if (((pVBInfo->IF_DEF_LVDS == 0) && ((pVBInfo->VBType & VB_SIS301LV) || (pVBInfo->VBType & VB_SIS302LV) || @@ -2927,7 +2925,7 @@ static unsigned char XGI_GetLCDInfo(unsigned short ModeNo, if (tempbx == 0) tempbx = Panel_1024x768; /* default */ - /* LCD75 [2003/8/22] Vicent */ + /* LCD75 */ if ((tempbx == Panel_1024x768) || (tempbx == Panel_1280x1024)) { if (pVBInfo->VBInfo & DriverMode) { tempax = xgifb_reg_get(pVBInfo->P3d4, 0x33); @@ -4591,7 +4589,7 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, } } - /* [ycchen] 01/14/03 Modify for 301C PALM Support */ + /* Modify for 301C PALM Support */ if (pVBInfo->VBType & VB_XGI301C) { if (pVBInfo->TVInfo & TVSetPALM) xgifb_reg_and_or(pVBInfo->Part2Port, 0x4E, ~0x08, @@ -6245,8 +6243,7 @@ unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE, (pVBInfo->RefIndex[RefreshRateTableIndex].YRes == 600)) { index++; } - /* Alan 10/19/2007; - * do the similar adjustment like XGISearchCRT1Rate() */ + /* do the similar adjustment like XGISearchCRT1Rate() */ if ((pVBInfo->RefIndex[RefreshRateTableIndex].XRes == 1024) && (pVBInfo->RefIndex[RefreshRateTableIndex].YRes == 768)) { index++; @@ -6354,7 +6351,7 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo) int i; xgifb_reg_set(pVBInfo->P3c4, 0x05, 0x86); - /* [2004/05/06] Vicent to fix XG42 single LCD sense to CRT+LCD */ + /* to fix XG42 single LCD sense to CRT+LCD */ xgifb_reg_set(pVBInfo->P3d4, 0x57, 0x4A); xgifb_reg_set(pVBInfo->P3d4, 0x53, (unsigned char) (xgifb_reg_get( pVBInfo->P3d4, 0x53) | 0x02)); @@ -6419,7 +6416,7 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo) else xgifb_reg_and_or(pVBInfo->P3d4, 0x32, 0xDF, 0x00); - /* alan, avoid display something, set BLACK DAC if not restore DAC */ + /* avoid display something, set BLACK DAC if not restore DAC */ outb(0x00, pVBInfo->P3c8); for (i = 0; i < 256; i++) { @@ -6432,7 +6429,6 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo) xgifb_reg_set(pVBInfo->P3d4, 0x63, CR63); xgifb_reg_set(pVBInfo->P3c4, 0x31, SR31); - /* [2004/05/11] Vicent */ xgifb_reg_set(pVBInfo->P3d4, 0x53, (unsigned char) (xgifb_reg_get( pVBInfo->P3d4, 0x53) & 0xFD)); xgifb_reg_set(pVBInfo->P3c4, 0x1F, (unsigned char) SR1F); @@ -6653,7 +6649,7 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info, pVBInfo->IF_DEF_LVDS = 0; pVBInfo->IF_DEF_LCDA = 1; - if (HwDeviceExtension->jChipType >= XG20) { /* kuku 2004/06/25 */ + if (HwDeviceExtension->jChipType >= XG20) { pVBInfo->IF_DEF_YPbPr = 0; pVBInfo->IF_DEF_HiVision = 0; pVBInfo->IF_DEF_CRT2Monitor = 0; @@ -6695,7 +6691,7 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info, } } - if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 */ + if (HwDeviceExtension->jChipType < XG20) XGI_GetVBType(pVBInfo); InitTo330Pointer(HwDeviceExtension->jChipType, pVBInfo); @@ -6703,12 +6699,12 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info, ModeNo = ModeNo & 0x7F; xgifb_reg_set(pVBInfo->P3c4, 0x05, 0x86); - if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 1.Openkey */ + if (HwDeviceExtension->jChipType < XG20) XGI_UnLockCRT2(HwDeviceExtension, pVBInfo); XGI_SearchModeID(ModeNo, &ModeIdIndex, pVBInfo); - if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */ + if (HwDeviceExtension->jChipType < XG20) { XGI_GetVBInfo(ModeNo, ModeIdIndex, HwDeviceExtension, pVBInfo); XGI_GetTVInfo(ModeNo, ModeIdIndex, pVBInfo); XGI_GetLCDInfo(ModeNo, ModeIdIndex, pVBInfo); @@ -6779,7 +6775,7 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info, XGI_UpdateModeInfo(HwDeviceExtension, pVBInfo); - if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */ + if (HwDeviceExtension->jChipType < XG20) { XGI_LockCRT2(HwDeviceExtension, pVBInfo); } diff --git a/drivers/staging/xgifb/vb_struct.h b/drivers/staging/xgifb/vb_struct.h index aea760a..22c8eb9 100644 --- a/drivers/staging/xgifb/vb_struct.h +++ b/drivers/staging/xgifb/vb_struct.h @@ -28,7 +28,6 @@ struct XGI_Ext2Struct { unsigned char ModeID; unsigned short XRes; unsigned short YRes; - /* unsigned short ROM_OFFSET; */ }; struct XGI_ECLKDataStruct { @@ -167,7 +166,6 @@ struct vb_device_info { unsigned short LCDHRS, LCDVRS, LCDHDES, LCDVDES; unsigned short ModeType; - /* ,IF_DEF_FSTN; add for dstn */ unsigned short IF_DEF_LVDS, IF_DEF_TRUMPION, IF_DEF_DSTN; unsigned short IF_DEF_CRT2Monitor; unsigned short IF_DEF_LCDA, IF_DEF_YPbPr; @@ -225,7 +223,6 @@ struct vb_device_info { struct SiS_StandTable_S *StandTable; struct XGI_ExtStruct *EModeIDTable; struct XGI_Ext2Struct *RefIndex; - /* XGINew_CRT1TableStruct *CRT1Table; */ struct XGI_CRT1TableStruct *XGINEWUB_CRT1Table; struct SiS_VCLKData *VCLKData; struct SiS_VBVCLKData *VBVCLKData; diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h index 75da7c3..ca8c68d 100644 --- a/drivers/staging/xgifb/vb_table.h +++ b/drivers/staging/xgifb/vb_table.h @@ -1,6 +1,5 @@ #ifndef _VB_TABLE_ #define _VB_TABLE_ -/* yilin modify for xgi20 */ static struct SiS_MCLKData XGI340New_MCLKData[] = { {0x16, 0x01, 0x01, 166}, {0x19, 0x02, 0x01, 124}, @@ -23,7 +22,6 @@ static struct SiS_MCLKData XGI27New_MCLKData[] = { {0x5c, 0x23, 0x01, 166} }; -/* yilin modify for xgi20 */ static struct XGI_ECLKDataStruct XGI340_ECLKData[] = { {0x5c, 0x23, 0x01, 166}, {0x55, 0x84, 0x01, 123}, @@ -424,13 +422,9 @@ static struct SiS_LCDData XGI_StLCD1024x768Data[] = { }; static struct SiS_LCDData XGI_ExtLCD1024x768Data[] = { - /* { 12, 5, 896, 512,1344, 806}, // alan 09/12/2003 */ {42, 25, 1536, 419, 1344, 806}, - /* { 12, 5, 896, 510,1344, 806}, // alan 09/12/2003 */ {48, 25, 1536, 369, 1344, 806}, - /* { 32, 15,1008, 505,1344, 806}, // alan 09/12/2003 */ {42, 25, 1536, 419, 1344, 806}, - /* { 32, 15,1008, 514,1344, 806}, // alan 09/12/2003 */ {48, 25, 1536, 369, 1344, 806}, {12, 5, 896, 500, 1344, 806}, {42, 25, 1024, 625, 1344, 806}, @@ -504,14 +498,10 @@ static struct SiS_LCDData xgifb_lcd_1400x1050[] = { }; static struct SiS_LCDData XGI_ExtLCD1600x1200Data[] = { - {4, 1, 1620, 420, 2160, 1250}, /* { 3,1,2160,425,2160,1250 }, - // 00 (320x200,320x400, - // 640x200,640x400) - // // alan 10/14/2003 */ + {4, 1, 1620, 420, 2160, 1250}, /* 00 (320x200,320x400, + 640x200,640x400)*/ {27, 7, 1920, 375, 2160, 1250}, /* 01 (320x350,640x350) */ - {4, 1, 1620, 420, 2160, 1250}, /* { 3,1,2160,425,2160,1250 }, - // 02 (360x400,720x400) - // // alan 10/14/2003 */ + {4, 1, 1620, 420, 2160, 1250}, /* 02 (360x400,720x400)*/ {27, 7, 1920, 375, 2160, 1250}, /* 03 (720x350) */ {27, 4, 800, 500, 2160, 1250}, /* 04 (640x480x60Hz) */ {4, 1, 1080, 625, 2160, 1250}, /* 05 (800x600x60Hz) */ @@ -615,8 +605,7 @@ static struct SiS_LCDData XGI_NoScalingDatax75[] = { {1, 1, 1056, 625, 1056, 625}, /* ; 05 (800x600x75Hz) */ {1, 1, 1312, 800, 1312, 800}, /* ; 06 (1024x768x75Hz) */ {1, 1, 1688, 1066, 1688, 1066}, /* ; 07 (1280x1024x75Hz) */ - {1, 1, 1688, 1066, 1688, 1066}, /* ; 08 (1400x1050x75Hz) - ;;[ycchen] 12/19/02 */ + {1, 1, 1688, 1066, 1688, 1066}, /* ; 08 (1400x1050x75Hz)*/ {1, 1, 2160, 1250, 2160, 1250}, /* ; 09 (1600x1200x75Hz) */ {1, 1, 1688, 806, 1688, 806} /* ; 0A (1280x768x75Hz) */ }; @@ -823,8 +812,7 @@ static struct XGI330_LCDDataDesStruct2 XGI_NoScalingDesData[] = { {9, 849, 627, 600, 128, 4}, /* 05 (800x600x60Hz) */ {9, 1057, 805, 770, 0136, 6}, /* 06 (1024x768x60Hz) */ {9, 1337, 0, 1025, 112, 3}, /* 07 (1280x1024x60Hz) */ - {9, 1457, 0, 1051, 112, 3}, /* 08 (1400x1050x60Hz) }, - //;[ycchen] 12/19/02 */ + {9, 1457, 0, 1051, 112, 3}, /* 08 (1400x1050x60Hz)*/ {9, 1673, 0, 1201, 192, 3}, /* 09 (1600x1200x60Hz) */ {9, 1337, 0, 771, 112, 6} /* 0A (1280x768x60Hz) */ }; @@ -910,8 +898,7 @@ static struct XGI330_LCDDataDesStruct2 XGI_NoScalingDesDatax75[] = { {9, 825, 0, 601, 80, 3}, /* ; 05 (800x600x75Hz) */ {9, 1049, 0, 769, 96, 3}, /* ; 06 (1024x768x75Hz) */ {9, 1305, 0, 1025, 144, 3}, /* ; 07 (1280x1024x75Hz) */ - {9, 1457, 0, 1051, 112, 3}, /* ; 08 (1400x1050x60Hz) - ;;[ycchen] 12/19/02 */ + {9, 1457, 0, 1051, 112, 3}, /* ; 08 (1400x1050x60Hz)*/ {9, 1673, 0, 1201, 192, 3}, /* ; 09 (1600x1200x75Hz) */ {9, 1337, 0, 771, 112, 6} /* ; 0A (1280x768x60Hz) */ }; @@ -1308,7 +1295,7 @@ static struct SiS_LVDSData XGI_LVDSNoScalingData[] = { {1056, 628, 1056, 628}, /* 05 (800x600x60Hz) */ {1344, 806, 1344, 806}, /* 06 (1024x768x60Hz) */ {1688, 1066, 1688, 1066}, /* 07 (1280x1024x60Hz) */ - {1688, 1066, 1688, 1066}, /* 08 (1400x1050x60Hz) ;;[ycchen] 12/19/02 */ + {1688, 1066, 1688, 1066}, /* 08 (1400x1050x60Hz) */ {2160, 1250, 2160, 1250}, /* 09 (1600x1200x60Hz) */ {1688, 806, 1688, 806} /* 0A (1280x768x60Hz) */ }; @@ -1469,8 +1456,7 @@ static struct XGI330_LCDDataDesStruct2 XGI_LVDSNoScalingDesData[] = { {0, 840, 627, 600, 128, 4}, /* 05 (800x600x60Hz) */ {0, 1048, 805, 770, 136, 6}, /* 06 (1024x768x60Hz) */ {0, 1328, 0, 1025, 112, 3}, /* 07 (1280x1024x60Hz) */ - {0, 1438, 0, 1051, 112, 3}, /* 08 (1400x1050x60Hz) - ;;[ycchen] 12/19/02 */ + {0, 1438, 0, 1051, 112, 3}, /* 08 (1400x1050x60Hz)*/ {0, 1664, 0, 1201, 192, 3}, /* 09 (1600x1200x60Hz) */ {0, 1328, 0, 0771, 112, 6} /* 0A (1280x768x60Hz) */ }; @@ -1518,7 +1504,7 @@ static struct SiS_LVDSData XGI_LVDS1280x1024Des_1x75[] = { }; /* The Display setting for DE Mode Panel */ -/* [ycchen] 02/18/03 Set DE as default */ +/* Set DE as default */ static struct SiS_LVDSData XGI_LVDS1280x1024Des_2x75[] = { {1368, 976, 752, 711}, /* ; 00 (320x200,320x400,640x200,640x400) */ {1368, 976, 729, 688}, /* ; 01 (320x350,640x350) */ @@ -1541,8 +1527,7 @@ static struct XGI330_LCDDataDesStruct2 XGI_LVDSNoScalingDesDatax75[] = { {0, 816, 0, 601, 80, 3}, /* ; 05 (800x600x75Hz) */ {0, 1040, 0, 769, 96, 3}, /* ; 06 (1024x768x75Hz) */ {0, 1296, 0, 1025, 144, 3}, /* ; 07 (1280x1024x75Hz) */ - {0, 1448, 0, 1051, 112, 3}, /* ; 08 (1400x1050x75Hz) - ;;[ycchen] 12/19/02 */ + {0, 1448, 0, 1051, 112, 3}, /* ; 08 (1400x1050x75Hz) */ {0, 1664, 0, 1201, 192, 3}, /* ; 09 (1600x1200x75Hz) */ {0, 1328, 0, 771, 112, 6} /* ; 0A (1280x768x75Hz) */ }; -- cgit v0.10.2 From c2dd691eed6356610a7ce9836d36d1aba3145b7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Fri, 6 Jul 2012 12:40:37 +0200 Subject: Staging: xgifb: Remove unneeded XGI_LCD_TYPE enumeration. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit LCD_TYPEs are taken from drivers/video/sis/sis.h, so this enumeration is not needed. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/vgatypes.h b/drivers/staging/xgifb/vgatypes.h index 7fc0719..ddf7776 100644 --- a/drivers/staging/xgifb/vgatypes.h +++ b/drivers/staging/xgifb/vgatypes.h @@ -21,40 +21,6 @@ enum XGI_VB_CHIP_TYPE { }; #endif - -#define XGI_LCD_TYPE -/* Since the merge with video/sis the LCD_TYPEs are used from - drivers/video/sis/sis.h . Nevertheless we keep this (for the moment) for - future reference until the code is merged completely and we are sure - nothing of this should be added to the sis.h header */ -#ifndef XGI_LCD_TYPE -enum XGI_LCD_TYPE { - LCD_INVALID = 0, - LCD_320x480, /* FSTN, DSTN */ - LCD_640x480, - LCD_640x480_2, /* FSTN, DSTN */ - LCD_640x480_3, /* FSTN, DSTN */ - LCD_800x600, - LCD_848x480, - LCD_1024x600, - LCD_1024x768, - LCD_1152x768, - LCD_1152x864, - LCD_1280x720, - LCD_1280x768, - LCD_1280x800, - LCD_1280x960, - LCD_1280x1024, - LCD_1400x1050, - LCD_1600x1200, - LCD_1680x1050, - LCD_1920x1440, - LCD_2048x1536, - LCD_CUSTOM, - LCD_UNKNOWN -}; -#endif - struct xgi_hw_device_info { unsigned long ulExternalChip; /* NO VB or other video bridge*/ /* if ujVBChipID = VB_CHIP_UNKNOWN, */ -- cgit v0.10.2 From 469b43c0a67d14c3c87fa87907999d1894156015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Fri, 6 Jul 2012 12:40:38 +0200 Subject: Staging: xgifb: Remove LCDA detection in xgifb_probe(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The piece of code that checks for LCDA in xgifb_probe() just checks for some register values but doesn't really do anything in response to them (the actions that should be executed are commented). As nothing is really being done, the code can be safely removed. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index b226458..0307eca 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -1952,36 +1952,6 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, } } - if ((hw_info->ujVBChipID == VB_CHIP_302B) || - (hw_info->ujVBChipID == VB_CHIP_301LV) || - (hw_info->ujVBChipID == VB_CHIP_302LV)) { - int tmp; - tmp = xgifb_reg_get(XGICR, 0x34); - if (tmp <= 0x13) { - /* Currently on LCDA? - *(Some BIOSes leave CR38) */ - tmp = xgifb_reg_get(XGICR, 0x38); - if ((tmp & 0x03) == 0x03) { - /* XGI_Pr.XGI_UseLCDA = 1; */ - } else { - /* Currently on LCDA? - *(Some newer BIOSes set D0 in CR35) */ - tmp = xgifb_reg_get(XGICR, 0x35); - if (tmp & 0x01) { - /* XGI_Pr.XGI_UseLCDA = 1; */ - } else { - tmp = xgifb_reg_get(XGICR, - 0x30); - if (tmp & 0x20) { - tmp = xgifb_reg_get( - XGIPART1, 0x13); - } - } - } - } - - } - xgifb_info->mode_idx = -1; if (mode) -- cgit v0.10.2 From 61439fa873d98654a9f985854c634896384ee3b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Fri, 6 Jul 2012 12:40:39 +0200 Subject: Staging: xgifb: Remove unused struct _chswtable. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Struct _chswtable and the variable mychswtable are not used anywhere, so remove them. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/XGI_main.h b/drivers/staging/xgifb/XGI_main.h index 1686c5a..c033da4 100644 --- a/drivers/staging/xgifb/XGI_main.h +++ b/drivers/staging/xgifb/XGI_main.h @@ -227,16 +227,6 @@ static const struct _XGI_vrate { {0, 0, 0, 0} }; -static const struct _chswtable { - int subsysVendor; - int subsysCard; - char *vendorName; - char *cardName; -} mychswtable[] = { - { 0x1631, 0x1002, "Mitachi", "0x1002" }, - { 0, 0, "" , "" } -}; - static const struct _XGI_TV_filter { u8 filter[9][4]; } XGI_TV_filter[] = { -- cgit v0.10.2 From be25aef0ca638ea798fdb836291b2d5e5fe555ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Fri, 6 Jul 2012 12:40:40 +0200 Subject: Staging: xgifb: Improve debug strings. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 0307eca..d5c87ea 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -39,14 +39,14 @@ static void dumpVGAReg(void) for (i = 0; i < 0x4f; i++) { reg = xgifb_reg_get(XGISR, i); - pr_debug("\no 3c4 %x", i); - pr_debug("\ni 3c5 => %x", reg); + pr_debug("o 3c4 %x\n", i); + pr_debug("i 3c5 => %x\n", reg); } for (i = 0; i < 0xF0; i++) { reg = xgifb_reg_get(XGICR, i); - pr_debug("\no 3d4 %x", i); - pr_debug("\ni 3d5 => %x", reg); + pr_debug("o 3d4 %x\n", i); + pr_debug("i 3d5 => %x\n", reg); } } #else @@ -591,7 +591,7 @@ static u8 XGIfb_search_refresh_rate(struct xgifb_video_info *xgifb_info, break; } else if (XGIfb_vrate[i].refresh > rate) { if ((XGIfb_vrate[i].refresh - rate) <= 3) { - pr_debug("XGIfb: Adjusting rate from %d up to %d\n", + pr_debug("Adjusting rate from %d up to %d\n", rate, XGIfb_vrate[i].refresh); xgifb_info->rate_idx = XGIfb_vrate[i].idx; @@ -600,7 +600,7 @@ static u8 XGIfb_search_refresh_rate(struct xgifb_video_info *xgifb_info, } else if (((rate - XGIfb_vrate[i - 1].refresh) <= 2) && (XGIfb_vrate[i].idx != 1)) { - pr_debug("XGIfb: Adjusting rate from %d down to %d\n", + pr_debug("Adjusting rate from %d down to %d\n", rate, XGIfb_vrate[i-1].refresh); xgifb_info->rate_idx = XGIfb_vrate[i - 1].idx; @@ -609,7 +609,7 @@ static u8 XGIfb_search_refresh_rate(struct xgifb_video_info *xgifb_info, } break; } else if ((rate - XGIfb_vrate[i].refresh) <= 2) { - pr_debug("XGIfb: Adjusting rate from %d down to %d\n", + pr_debug("Adjusting rate from %d down to %d\n", rate, XGIfb_vrate[i].refresh); xgifb_info->rate_idx = XGIfb_vrate[i].idx; break; @@ -987,7 +987,7 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, } if (!htotal || !vtotal) { - pr_debug("XGIfb: Invalid 'var' information\n"); + pr_debug("Invalid 'var' information\n"); return -EINVAL; } pr_debug("var->pixclock=%d, htotal=%d, vtotal=%d\n", var->pixclock, htotal, vtotal); @@ -1063,7 +1063,7 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, XGIfb_post_setmode(xgifb_info); - pr_debug("XGIfb: Set new mode: %dx%dx%d-%d\n", + pr_debug("Set new mode: %dx%dx%d-%d\n", XGIbios_mode[xgifb_info->mode_idx].xres, XGIbios_mode[xgifb_info->mode_idx].yres, XGIbios_mode[xgifb_info->mode_idx].bpp, @@ -1109,7 +1109,7 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, break; default: xgifb_info->video_cmap_len = 16; - pr_err("Unsupported depth %d", + pr_err("Unsupported depth %d\n", xgifb_info->video_bpp); break; } @@ -1303,7 +1303,7 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) + var->vsync_len; if (!(htotal) || !(vtotal)) { - pr_debug("XGIfb: no valid timing data\n"); + pr_debug("No valid timing data\n"); return -EINVAL; } @@ -1661,7 +1661,7 @@ static int __init xgifb_optval(char *fullopt, int validx) unsigned long lres; if (kstrtoul(fullopt + validx, 0, &lres) < 0 || lres > INT_MAX) { - pr_err("xgifb: invalid value for option: %s\n", fullopt); + pr_err("Invalid value for option: %s\n", fullopt); return 0; } return lres; @@ -1674,7 +1674,7 @@ static int __init XGIfb_setup(char *options) if (!options || !*options) return 0; - pr_info("xgifb: options: %s\n", options); + pr_info("Options: %s\n", options); while ((this_opt = strsep(&options, ",")) != NULL) { @@ -1767,7 +1767,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, reg1 = xgifb_reg_get(XGISR, IND_SIS_PASSWORD); if (reg1 != 0xa1) { /*I/O error */ - dev_err(&pdev->dev, "I/O error!!!"); + dev_err(&pdev->dev, "I/O error\n"); ret = -EIO; goto error_disable; } @@ -1817,7 +1817,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, if (!request_mem_region(xgifb_info->video_base, xgifb_info->video_size, "XGIfb FB")) { - dev_err(&pdev->dev, "unable request memory size %x\n", + dev_err(&pdev->dev, "Unable request memory size %x\n", xgifb_info->video_size); dev_err(&pdev->dev, "Fatal error: Unable to reserve frame buffer memory. " @@ -1973,7 +1973,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, } if (xgifb_info->mode_idx < 0) { - dev_err(&pdev->dev, "no supported video mode found\n"); + dev_err(&pdev->dev, "No supported video mode found\n"); goto error_1; } @@ -2085,7 +2085,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, xgifb_info->mtrr = mtrr_add(xgifb_info->video_base, xgifb_info->video_size, MTRR_TYPE_WRCOMB, 1); if (xgifb_info->mtrr >= 0) - dev_info(&pdev->dev, "added MTRR\n"); + dev_info(&pdev->dev, "Added MTRR\n"); #endif if (register_framebuffer(fb_info) < 0) { diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c index 6bb0206..64935fa 100644 --- a/drivers/staging/xgifb/vb_init.c +++ b/drivers/staging/xgifb/vb_init.c @@ -951,7 +951,7 @@ static void xgifb_read_vbios(struct pci_dev *pdev, pVBInfo->IF_DEF_LVDS = 0; vbios = xgifb_copy_rom(pdev, &vbios_size); if (vbios == NULL) { - dev_err(&pdev->dev, "video BIOS not available\n"); + dev_err(&pdev->dev, "Video BIOS not available\n"); return; } if (vbios_size <= 0x65) @@ -1006,7 +1006,7 @@ static void xgifb_read_vbios(struct pci_dev *pdev, pVBInfo->IF_DEF_LVDS = 1; return; error: - dev_err(&pdev->dev, "video BIOS corrupted\n"); + dev_err(&pdev->dev, "Video BIOS corrupted\n"); vfree(vbios); } -- cgit v0.10.2 From 1cd17030813007578e7b5eb0aa7dec13d6ed9a09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Fri, 6 Jul 2012 12:40:41 +0200 Subject: Staging: xgifb: Remove useless switch in XGIfb_detect_VB(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The switch performs no action so it can be removed. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index d5c87ea..788d141 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -1556,16 +1556,6 @@ static void XGIfb_detect_VB(struct xgifb_video_info *xgifb_info) xgifb_info->TV_plug = xgifb_info->TV_type = 0; - switch (xgifb_info->hasVB) { - case HASVB_LVDS_CHRONTEL: - case HASVB_CHRONTEL: - break; - case HASVB_301: - case HASVB_302: - /* XGI_Sense30x(); */ /* Yi-Lin TV Sense? */ - break; - } - cr32 = xgifb_reg_get(XGICR, IND_XGI_SCRATCH_REG_CR32); if ((cr32 & SIS_CRT1) && !XGIfb_crt1off) -- cgit v0.10.2 From 791fef1b30861d1125222780d4eaae00cb3a4563 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Fri, 6 Jul 2012 12:40:42 +0200 Subject: Staging: xgifb: Simplify XGIfb_GetXG21DefaultLVDSModeIdx(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simplify the code and make it more readable. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 788d141..c1aa037 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -262,28 +262,19 @@ static void XGIRegInit(struct vb_device_info *XGI_Pr, unsigned long BaseAddr) static int XGIfb_GetXG21DefaultLVDSModeIdx(struct xgifb_video_info *xgifb_info) { + int i = 0; - int found_mode = 0; - int XGIfb_mode_idx = 0; - - found_mode = 0; - while ((XGIbios_mode[XGIfb_mode_idx].mode_no != 0) - && (XGIbios_mode[XGIfb_mode_idx].xres - <= xgifb_info->lvds_data.LVDSHDE)) { - if ((XGIbios_mode[XGIfb_mode_idx].xres - == xgifb_info->lvds_data.LVDSHDE) - && (XGIbios_mode[XGIfb_mode_idx].yres - == xgifb_info->lvds_data.LVDSVDE) - && (XGIbios_mode[XGIfb_mode_idx].bpp == 8)) { - found_mode = 1; - break; + while ((XGIbios_mode[i].mode_no != 0) + && (XGIbios_mode[i].xres <= xgifb_info->lvds_data.LVDSHDE)) { + if ((XGIbios_mode[i].xres == xgifb_info->lvds_data.LVDSHDE) + && (XGIbios_mode[i].yres == xgifb_info->lvds_data.LVDSVDE) + && (XGIbios_mode[i].bpp == 8)) { + return i; } - XGIfb_mode_idx++; + i++; } - if (!found_mode) - XGIfb_mode_idx = -1; - return XGIfb_mode_idx; + return -1; } static void XGIfb_search_mode(struct xgifb_video_info *xgifb_info, -- cgit v0.10.2 From 4362f5becde07b43ec9d57a6a713c955dd2703e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Fri, 6 Jul 2012 12:40:43 +0200 Subject: Staging: xgifb: Remove unneeded var and condition in XGIfb_search_vesamode(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index c1aa037..e5657ff 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -305,7 +305,7 @@ invalid_mode: static void XGIfb_search_vesamode(struct xgifb_video_info *xgifb_info, unsigned int vesamode) { - int i = 0, j = 0; + int i = 0; if (vesamode == 0) goto invalid; @@ -316,15 +316,13 @@ static void XGIfb_search_vesamode(struct xgifb_video_info *xgifb_info, if ((XGIbios_mode[i].vesa_mode_no_1 == vesamode) || (XGIbios_mode[i].vesa_mode_no_2 == vesamode)) { xgifb_info->mode_idx = i; - j = 1; - break; + return; } i++; } invalid: - if (!j) - pr_info("Invalid VESA mode 0x%x'\n", vesamode); + pr_info("Invalid VESA mode 0x%x'\n", vesamode); } static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex) -- cgit v0.10.2 From 8afb7d3528444a8a6d6032ce04f7cc1a19b30ef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Fri, 6 Jul 2012 12:40:44 +0200 Subject: Staging: xgifb: Remove useless always true condition. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c index 64935fa..ae10153 100644 --- a/drivers/staging/xgifb/vb_init.c +++ b/drivers/staging/xgifb/vb_init.c @@ -1185,13 +1185,11 @@ static void XGINew_GetXG21Sense(struct xgi_hw_device_info *HwDeviceExtension, { unsigned char Temp; -#if 1 if (pVBInfo->IF_DEF_LVDS) { /* For XG21 LVDS */ xgifb_reg_or(pVBInfo->P3d4, 0x32, LCDSense); /* LVDS on chip */ xgifb_reg_and_or(pVBInfo->P3d4, 0x38, ~0xE0, 0xC0); } else { -#endif /* Enable GPIOA/B read */ xgifb_reg_and_or(pVBInfo->P3d4, 0x4A, ~0x03, 0x03); Temp = xgifb_reg_get(pVBInfo->P3d4, 0x48) & 0xC0; @@ -1214,9 +1212,7 @@ static void XGINew_GetXG21Sense(struct xgi_hw_device_info *HwDeviceExtension, /* Disable read GPIOF */ xgifb_reg_and(pVBInfo->P3d4, 0x4A, ~0x20); } -#if 1 } -#endif } static void XGINew_GetXG27Sense(struct xgi_hw_device_info *HwDeviceExtension, -- cgit v0.10.2 From 661a6384f85fd2229b4e14229d5479ab1a1c1322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Fri, 6 Jul 2012 12:40:45 +0200 Subject: Staging: xgifb: Rework conditions in XGI_SetATTRegs(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rework some conditions to reduce indentation and fix style warnings. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index 3ba3c48..4b49705 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -161,18 +161,15 @@ static void XGI_SetATTRegs(unsigned short ModeNo, for (i = 0; i <= 0x13; i++) { ARdata = pVBInfo->StandTable->ATTR[i]; - if (modeflag & Charx8Dot) { /* ifndef Dot9 */ - if (i == 0x13) { - if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) { + + if ((modeflag & Charx8Dot) && i == 0x13) { /* ifndef Dot9 */ + if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) { + ARdata = 0; + } else { + if ((pVBInfo->VBInfo & + (SetCRT2ToTV | SetCRT2ToLCD)) && + (pVBInfo->VBInfo & SetInSlaveMode)) ARdata = 0; - } else { - if (pVBInfo->VBInfo & (SetCRT2ToTV - | SetCRT2ToLCD)) { - if (pVBInfo->VBInfo & - SetInSlaveMode) - ARdata = 0; - } - } } } -- cgit v0.10.2 From 3b175621a217a354a0f38172381f8f88fe7a59be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Fri, 6 Jul 2012 12:40:46 +0200 Subject: Staging: xgifb: Refactor XGI_AjustCRT2Rate(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactor some conditions to reduce indentation and fix style warnings. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index 4b49705..03edf36 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -250,48 +250,30 @@ static unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo, if (pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) { tempax |= SupportLCD; - if (pVBInfo->LCDResInfo != Panel_1280x1024) { - if (pVBInfo->LCDResInfo != Panel_1280x960) { - if (pVBInfo->LCDInfo & - LCDNonExpanding) { - if (resinfo >= 9) { - tempax = 0; - return 0; - } - } - } - } + if (pVBInfo->LCDResInfo != Panel_1280x1024 && + pVBInfo->LCDResInfo != Panel_1280x960 && + (pVBInfo->LCDInfo & LCDNonExpanding) && + resinfo >= 9) + return 0; } if (pVBInfo->VBInfo & SetCRT2ToHiVision) { /* for HiTV */ if ((pVBInfo->VBType & VB_SIS301LV) && (pVBInfo->VBExtInfo == VB_YPbPr1080i)) { tempax |= SupportYPbPr750p; - if (pVBInfo->VBInfo & SetInSlaveMode) { - if (resinfo == 4) - return 0; - - if (resinfo == 3) - return 0; - - if (resinfo > 7) - return 0; - } + if ((pVBInfo->VBInfo & SetInSlaveMode) && + ((resinfo == 3) || + (resinfo == 4) || + (resinfo > 7))) + return 0; } else { tempax |= SupportHiVision; - if (pVBInfo->VBInfo & SetInSlaveMode) { - if (resinfo == 4) + if ((pVBInfo->VBInfo & SetInSlaveMode) && + ((resinfo == 4) || + (resinfo == 3 && + (pVBInfo->SetFlag & TVSimuMode)) || + (resinfo > 7))) return 0; - - if (resinfo == 3) { - if (pVBInfo->SetFlag - & TVSimuMode) - return 0; - } - - if (resinfo > 7) - return 0; - } } } else { if (pVBInfo->VBInfo & (SetCRT2ToAVIDEO | @@ -301,23 +283,18 @@ static unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo, SetCRT2ToHiVision)) { tempax |= SupportTV; - if (pVBInfo->VBType & (VB_SIS301B | VB_SIS302B - | VB_SIS301LV | VB_SIS302LV - | VB_XGI301C)) { + if (pVBInfo->VBType & (VB_SIS301B | + VB_SIS302B | + VB_SIS301LV | + VB_SIS302LV | + VB_XGI301C)) tempax |= SupportTV1024; - } - if (!(pVBInfo->VBInfo & TVSetPAL)) { - if (modeflag & NoSupportSimuTV) { - if (pVBInfo->VBInfo & - SetInSlaveMode) { - if (!(pVBInfo->VBInfo & - SetNotSimuMode)) { - return 0; - } - } - } - } + if (!(pVBInfo->VBInfo & TVSetPAL) && + (modeflag & NoSupportSimuTV) && + (pVBInfo->VBInfo & SetInSlaveMode) && + (!(pVBInfo->VBInfo & SetNotSimuMode))) + return 0; } } } else { /* for LVDS */ -- cgit v0.10.2 From 7eec23a7b3dd0bcb9b64c0627b317464765e2426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Fri, 6 Jul 2012 12:40:47 +0200 Subject: Staging: xgifb: Refactor XGI_GetVBType(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactor XGI_GetVBType() to reduce indentation and fix style warnings. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index 03edf36..251145e 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -2559,42 +2559,45 @@ void XGI_GetVBType(struct vb_device_info *pVBInfo) { unsigned short flag, tempbx, tempah; - if (pVBInfo->IF_DEF_LVDS == 0) { - tempbx = VB_SIS302B; - flag = xgifb_reg_get(pVBInfo->Part4Port, 0x00); - if (flag != 0x02) { - tempbx = VB_SIS301; - flag = xgifb_reg_get(pVBInfo->Part4Port, 0x01); - if (flag >= 0xB0) { - tempbx = VB_SIS301B; - if (flag >= 0xC0) { - tempbx = VB_XGI301C; - if (flag >= 0xD0) { - tempbx = VB_SIS301LV; - if (flag >= 0xE0) { - tempbx = VB_SIS302LV; - tempah = xgifb_reg_get( - pVBInfo->Part4Port, - 0x39); - if (tempah != 0xFF) - tempbx = - VB_XGI301C; - } - } - } + if (pVBInfo->IF_DEF_LVDS != 0) + return; - if (tempbx & (VB_SIS301B | VB_SIS302B)) { - flag = xgifb_reg_get( - pVBInfo->Part4Port, - 0x23); + tempbx = VB_SIS302B; + flag = xgifb_reg_get(pVBInfo->Part4Port, 0x00); + if (flag == 0x02) + goto finish; - if (!(flag & 0x02)) - tempbx = tempbx | VB_NoLCD; - } - } - } - pVBInfo->VBType = tempbx; + tempbx = VB_SIS301; + flag = xgifb_reg_get(pVBInfo->Part4Port, 0x01); + if (flag < 0xB0) + goto finish; + + tempbx = VB_SIS301B; + if (flag < 0xC0) + goto bigger_than_0xB0; + + tempbx = VB_XGI301C; + if (flag < 0xD0) + goto bigger_than_0xB0; + + tempbx = VB_SIS301LV; + if (flag < 0xE0) + goto bigger_than_0xB0; + + tempbx = VB_SIS302LV; + tempah = xgifb_reg_get(pVBInfo->Part4Port, 0x39); + if (tempah != 0xFF) + tempbx = VB_XGI301C; + +bigger_than_0xB0: + if (tempbx & (VB_SIS301B | VB_SIS302B)) { + flag = xgifb_reg_get(pVBInfo->Part4Port, 0x23); + if (!(flag & 0x02)) + tempbx = tempbx | VB_NoLCD; } + +finish: + pVBInfo->VBType = tempbx; } static void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex, -- cgit v0.10.2 From f93173515f809fbcf251a3b1742e8659cc75dd74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Fri, 6 Jul 2012 12:40:48 +0200 Subject: Staging: xgifb: Rework conditions in XGI_GetVBInfo(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rework some conditions to reduce indentation and fix style warnings. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index 251145e..9dfc2de 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -2611,186 +2611,183 @@ static void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex, pVBInfo->ModeType = modeflag & ModeTypeMask; tempbx = 0; - if (pVBInfo->VBType & 0xFFFF) { - /* Check Display Device */ - temp = xgifb_reg_get(pVBInfo->P3d4, 0x30); - tempbx = tempbx | temp; - temp = xgifb_reg_get(pVBInfo->P3d4, 0x31); - push = temp; - push = push << 8; - tempax = temp << 8; - tempbx = tempbx | tempax; - temp = (SetCRT2ToDualEdge | SetCRT2ToYPbPr525750 | XGI_SetCRT2ToLCDA - | SetInSlaveMode | DisableCRT2Display); - temp = 0xFFFF ^ temp; - tempbx &= temp; - - temp = xgifb_reg_get(pVBInfo->P3d4, 0x38); + if (!(pVBInfo->VBType & 0xFFFF)) + return; - if (pVBInfo->IF_DEF_LCDA == 1) { - - if ((HwDeviceExtension->jChipType >= XG20) || - (HwDeviceExtension->jChipType >= XG40)) { - if (pVBInfo->IF_DEF_LVDS == 0) { - if (pVBInfo->VBType & - (VB_SIS302B | - VB_SIS301LV | - VB_SIS302LV | - VB_XGI301C)) { - if (temp & EnableDualEdge) { - tempbx |= - SetCRT2ToDualEdge; - - if (temp & SetToLCDA) - tempbx |= - XGI_SetCRT2ToLCDA; - } - } + /* Check Display Device */ + temp = xgifb_reg_get(pVBInfo->P3d4, 0x30); + tempbx = tempbx | temp; + temp = xgifb_reg_get(pVBInfo->P3d4, 0x31); + push = temp; + push = push << 8; + tempax = temp << 8; + tempbx = tempbx | tempax; + temp = (SetCRT2ToDualEdge | SetCRT2ToYPbPr525750 | XGI_SetCRT2ToLCDA + | SetInSlaveMode | DisableCRT2Display); + temp = 0xFFFF ^ temp; + tempbx &= temp; + + temp = xgifb_reg_get(pVBInfo->P3d4, 0x38); + + if (pVBInfo->IF_DEF_LCDA == 1) { + + if (((HwDeviceExtension->jChipType >= XG20) || + (HwDeviceExtension->jChipType >= XG40)) && + (pVBInfo->IF_DEF_LVDS == 0)) { + if (pVBInfo->VBType & + (VB_SIS302B | + VB_SIS301LV | + VB_SIS302LV | + VB_XGI301C)) { + if (temp & EnableDualEdge) { + tempbx |= SetCRT2ToDualEdge; + if (temp & SetToLCDA) + tempbx |= XGI_SetCRT2ToLCDA; } } } + } - if (pVBInfo->IF_DEF_YPbPr == 1) { - if (((pVBInfo->IF_DEF_LVDS == 0) && - ((pVBInfo->VBType & VB_SIS301LV) || - (pVBInfo->VBType & VB_SIS302LV) || - (pVBInfo->VBType & VB_XGI301C)))) { - if (temp & SetYPbPr) { - if (pVBInfo->IF_DEF_HiVision == 1) { - /* shampoo add for new - * scratch */ - temp = xgifb_reg_get( - pVBInfo->P3d4, - 0x35); - temp &= YPbPrMode; - tempbx |= SetCRT2ToHiVision; - - if (temp != YPbPrMode1080i) { - tempbx &= - (~SetCRT2ToHiVision); - tempbx |= - SetCRT2ToYPbPr525750; - } + if (pVBInfo->IF_DEF_YPbPr == 1) { + if (((pVBInfo->IF_DEF_LVDS == 0) && + ((pVBInfo->VBType & VB_SIS301LV) || + (pVBInfo->VBType & VB_SIS302LV) || + (pVBInfo->VBType & VB_XGI301C)))) { + if (temp & SetYPbPr) { + if (pVBInfo->IF_DEF_HiVision == 1) { + /* shampoo add for new + * scratch */ + temp = xgifb_reg_get( + pVBInfo->P3d4, + 0x35); + temp &= YPbPrMode; + tempbx |= SetCRT2ToHiVision; + + if (temp != YPbPrMode1080i) { + tempbx &= + (~SetCRT2ToHiVision); + tempbx |= + SetCRT2ToYPbPr525750; } } } } + } - tempax = push; /* restore CR31 */ + tempax = push; /* restore CR31 */ - if (pVBInfo->IF_DEF_LVDS == 0) { - if (pVBInfo->IF_DEF_YPbPr == 1) { - if (pVBInfo->IF_DEF_HiVision == 1) - temp = 0x09FC; - else - temp = 0x097C; - } else { - if (pVBInfo->IF_DEF_HiVision == 1) - temp = 0x01FC; - else - temp = 0x017C; - } - } else { /* 3nd party chip */ - temp = SetCRT2ToLCD; - } - - if (!(tempbx & temp)) { - tempax |= DisableCRT2Display; - tempbx = 0; - } - - if (pVBInfo->IF_DEF_LCDA == 1) { /* Select Display Device */ - if (!(pVBInfo->VBType & VB_NoLCD)) { - if (tempbx & XGI_SetCRT2ToLCDA) { - if (tempbx & SetSimuScanMode) - tempbx &= (~(SetCRT2ToLCD | - SetCRT2ToRAMDAC | - SwitchCRT2)); - else - tempbx &= (~(SetCRT2ToLCD | - SetCRT2ToRAMDAC | - SetCRT2ToTV | - SwitchCRT2)); - } - } + if (pVBInfo->IF_DEF_LVDS == 0) { + if (pVBInfo->IF_DEF_YPbPr == 1) { + if (pVBInfo->IF_DEF_HiVision == 1) + temp = 0x09FC; + else + temp = 0x097C; + } else { + if (pVBInfo->IF_DEF_HiVision == 1) + temp = 0x01FC; + else + temp = 0x017C; } + } else { /* 3nd party chip */ + temp = SetCRT2ToLCD; + } - /* shampoo add */ - /* for driver abnormal */ - if (!(tempbx & (SwitchCRT2 | SetSimuScanMode))) { - if (pVBInfo->IF_DEF_CRT2Monitor == 1) { - if (tempbx & SetCRT2ToRAMDAC) { - tempbx &= (0xFF00 | - SetCRT2ToRAMDAC | - SwitchCRT2 | - SetSimuScanMode); - tempbx &= (0x00FF | (~SetCRT2ToYPbPr525750)); - } - } else { - tempbx &= (~(SetCRT2ToRAMDAC | - SetCRT2ToLCD | - SetCRT2ToTV)); + if (!(tempbx & temp)) { + tempax |= DisableCRT2Display; + tempbx = 0; + } + + if (pVBInfo->IF_DEF_LCDA == 1) { /* Select Display Device */ + if (!(pVBInfo->VBType & VB_NoLCD)) { + if (tempbx & XGI_SetCRT2ToLCDA) { + if (tempbx & SetSimuScanMode) + tempbx &= (~(SetCRT2ToLCD | + SetCRT2ToRAMDAC | + SwitchCRT2)); + else + tempbx &= (~(SetCRT2ToLCD | + SetCRT2ToRAMDAC | + SetCRT2ToTV | + SwitchCRT2)); } } + } - if (!(pVBInfo->VBType & VB_NoLCD)) { - if (tempbx & SetCRT2ToLCD) { + /* shampoo add */ + /* for driver abnormal */ + if (!(tempbx & (SwitchCRT2 | SetSimuScanMode))) { + if (pVBInfo->IF_DEF_CRT2Monitor == 1) { + if (tempbx & SetCRT2ToRAMDAC) { tempbx &= (0xFF00 | - SetCRT2ToLCD | + SetCRT2ToRAMDAC | SwitchCRT2 | SetSimuScanMode); tempbx &= (0x00FF | (~SetCRT2ToYPbPr525750)); } + } else { + tempbx &= (~(SetCRT2ToRAMDAC | + SetCRT2ToLCD | + SetCRT2ToTV)); } + } - if (tempbx & SetCRT2ToSCART) { + if (!(pVBInfo->VBType & VB_NoLCD)) { + if (tempbx & SetCRT2ToLCD) { tempbx &= (0xFF00 | - SetCRT2ToSCART | + SetCRT2ToLCD | SwitchCRT2 | SetSimuScanMode); tempbx &= (0x00FF | (~SetCRT2ToYPbPr525750)); } + } - if (pVBInfo->IF_DEF_YPbPr == 1) { - if (tempbx & SetCRT2ToYPbPr525750) - tempbx &= (0xFF00 | - SwitchCRT2 | - SetSimuScanMode); - } + if (tempbx & SetCRT2ToSCART) { + tempbx &= (0xFF00 | + SetCRT2ToSCART | + SwitchCRT2 | + SetSimuScanMode); + tempbx &= (0x00FF | (~SetCRT2ToYPbPr525750)); + } - if (pVBInfo->IF_DEF_HiVision == 1) { - if (tempbx & SetCRT2ToHiVision) - tempbx &= (0xFF00 | - SetCRT2ToHiVision | - SwitchCRT2 | - SetSimuScanMode); - } + if (pVBInfo->IF_DEF_YPbPr == 1) { + if (tempbx & SetCRT2ToYPbPr525750) + tempbx &= (0xFF00 | + SwitchCRT2 | + SetSimuScanMode); + } - if (tempax & DisableCRT2Display) { /* Set Display Device Info */ - if (!(tempbx & (SwitchCRT2 | SetSimuScanMode))) - tempbx = DisableCRT2Display; - } + if (pVBInfo->IF_DEF_HiVision == 1) { + if (tempbx & SetCRT2ToHiVision) + tempbx &= (0xFF00 | + SetCRT2ToHiVision | + SwitchCRT2 | + SetSimuScanMode); + } - if (!(tempbx & DisableCRT2Display)) { - if ((!(tempbx & DriverMode)) || - (!(modeflag & CRT2Mode))) { - if (pVBInfo->IF_DEF_LCDA == 1) { - if (!(tempbx & XGI_SetCRT2ToLCDA)) - tempbx |= (SetInSlaveMode | - SetSimuScanMode); - } - } + if (tempax & DisableCRT2Display) { /* Set Display Device Info */ + if (!(tempbx & (SwitchCRT2 | SetSimuScanMode))) + tempbx = DisableCRT2Display; + } - /* LCD+TV can't support in slave mode - * (Force LCDA+TV->LCDB) */ - if ((tempbx & SetInSlaveMode) && - (tempbx & XGI_SetCRT2ToLCDA)) { - tempbx ^= (SetCRT2ToLCD | - XGI_SetCRT2ToLCDA | - SetCRT2ToDualEdge); - pVBInfo->SetFlag |= ReserveTVOption; + if (!(tempbx & DisableCRT2Display)) { + if ((!(tempbx & DriverMode)) || + (!(modeflag & CRT2Mode))) { + if (pVBInfo->IF_DEF_LCDA == 1) { + if (!(tempbx & XGI_SetCRT2ToLCDA)) + tempbx |= (SetInSlaveMode | + SetSimuScanMode); } } + + /* LCD+TV can't support in slave mode + * (Force LCDA+TV->LCDB) */ + if ((tempbx & SetInSlaveMode) && + (tempbx & XGI_SetCRT2ToLCDA)) { + tempbx ^= (SetCRT2ToLCD | + XGI_SetCRT2ToLCDA | + SetCRT2ToDualEdge); + pVBInfo->SetFlag |= ReserveTVOption; + } } pVBInfo->VBInfo = tempbx; -- cgit v0.10.2 From 3339db8a0c0182b6be7dcece9647f2d4307576b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Fri, 6 Jul 2012 12:40:49 +0200 Subject: Staging: xgifb: Refactor XGI_GetCRT2ResInfo(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use a goto to remove one level of indentation, fixing style warnings. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index 9dfc2de..a7ba99f 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -3263,46 +3263,47 @@ static void XGI_GetCRT2ResInfo(unsigned short ModeNo, if (modeflag & DoubleScanMode) yres *= 2; - if (pVBInfo->VBInfo & SetCRT2ToLCD) { - if (pVBInfo->IF_DEF_LVDS == 0) { - if (pVBInfo->LCDResInfo == Panel_1600x1200) { - if (!(pVBInfo->LCDInfo & XGI_LCDVESATiming)) { - if (yres == 1024) - yres = 1056; - } + if (!(pVBInfo->VBInfo & SetCRT2ToLCD)) + goto exit; + + if (pVBInfo->IF_DEF_LVDS == 0) { + if (pVBInfo->LCDResInfo == Panel_1600x1200) { + if (!(pVBInfo->LCDInfo & XGI_LCDVESATiming)) { + if (yres == 1024) + yres = 1056; } + } - if (pVBInfo->LCDResInfo == Panel_1280x1024) { - if (yres == 400) - yres = 405; - else if (yres == 350) - yres = 360; + if (pVBInfo->LCDResInfo == Panel_1280x1024) { + if (yres == 400) + yres = 405; + else if (yres == 350) + yres = 360; - if (pVBInfo->LCDInfo & XGI_LCDVESATiming) { - if (yres == 360) - yres = 375; - } + if (pVBInfo->LCDInfo & XGI_LCDVESATiming) { + if (yres == 360) + yres = 375; } + } - if (pVBInfo->LCDResInfo == Panel_1024x768) { - if (!(pVBInfo->LCDInfo & XGI_LCDVESATiming)) { - if (!(pVBInfo->LCDInfo - & LCDNonExpanding)) { - if (yres == 350) - yres = 357; - else if (yres == 400) - yres = 420; - else if (yres == 480) - yres = 525; - } + if (pVBInfo->LCDResInfo == Panel_1024x768) { + if (!(pVBInfo->LCDInfo & XGI_LCDVESATiming)) { + if (!(pVBInfo->LCDInfo & LCDNonExpanding)) { + if (yres == 350) + yres = 357; + else if (yres == 400) + yres = 420; + else if (yres == 480) + yres = 525; } } } - - if (xres == 720) - xres = 640; } + if (xres == 720) + xres = 640; + +exit: pVBInfo->VGAHDE = xres; pVBInfo->HDE = xres; pVBInfo->VGAVDE = yres; -- cgit v0.10.2 From 470c533896e540b2848d4e0a9d7a1cf56634f565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Fri, 6 Jul 2012 12:40:50 +0200 Subject: Staging: xgifb: Rework conditions in XGI_SetLockRegs(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rework some conditions to reduce indentation and fix style warnings. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index a7ba99f..5b2c35a 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -4039,24 +4039,16 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, } if (pVBInfo->VBInfo & SetCRT2ToHiVision) { - if (pVBInfo->VBType & VB_SIS301LV) { - if (pVBInfo->TVInfo & TVSetHiVision) { - tempbx -= 10; - } else { - if (pVBInfo->TVInfo & TVSimuMode) { - if (pVBInfo->TVInfo & TVSetPAL) { - if (pVBInfo->VBType & - VB_SIS301LV) { - if (!(pVBInfo->TVInfo & - (TVSetYPbPr525p | - TVSetYPbPr750p | - TVSetHiVision))) - tempbx += 40; - } else { - tempbx += 40; - } - } - } + if ((pVBInfo->VBType & VB_SIS301LV) && + !(pVBInfo->TVInfo & TVSetHiVision)) { + if ((pVBInfo->TVInfo & TVSimuMode) && + (pVBInfo->TVInfo & TVSetPAL)) { + if (!(pVBInfo->VBType & VB_SIS301LV) || + !(pVBInfo->TVInfo & + (TVSetYPbPr525p | + TVSetYPbPr750p | + TVSetHiVision))) + tempbx += 40; } } else { tempbx -= 10; -- cgit v0.10.2 From b1bf998c67e37dba950293029bc2872e3cdb3b33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Fri, 6 Jul 2012 12:40:51 +0200 Subject: Staging: xgifb: Rework conditions in XGI_EnableBridge(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rework some conditions to reduce indentation and fix style warnings. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index 5b2c35a..53135c5 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -6472,32 +6472,24 @@ static void XGI_EnableBridge(struct xgifb_video_info *xgifb_info, if (!(pVBInfo->VBInfo & DisableCRT2Display)) { tempah = 0xc0; - if (!(pVBInfo->VBInfo & SetSimuScanMode)) { - if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) { - if (pVBInfo->VBInfo & - SetCRT2ToDualEdge) { - tempah = tempah & 0x40; - if (pVBInfo->VBInfo & - XGI_SetCRT2ToLCDA) - tempah = tempah ^ 0xC0; - - if (pVBInfo->SetFlag & - DisableChB) - tempah &= 0xBF; - - if (pVBInfo->SetFlag & - DisableChA) - tempah &= 0x7F; - - if (pVBInfo->SetFlag & - EnableChB) - tempah |= 0x40; - - if (pVBInfo->SetFlag & - EnableChA) - tempah |= 0x80; - } - } + if (!(pVBInfo->VBInfo & SetSimuScanMode) && + (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) && + (pVBInfo->VBInfo & SetCRT2ToDualEdge)) { + tempah = tempah & 0x40; + if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) + tempah = tempah ^ 0xC0; + + if (pVBInfo->SetFlag & DisableChB) + tempah &= 0xBF; + + if (pVBInfo->SetFlag & DisableChA) + tempah &= 0x7F; + + if (pVBInfo->SetFlag & EnableChB) + tempah |= 0x40; + + if (pVBInfo->SetFlag & EnableChA) + tempah |= 0x80; } } -- cgit v0.10.2 From e123e46630d0dec5d16d392bb83a8fa40d2e773d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Fri, 6 Jul 2012 12:40:52 +0200 Subject: Staging: xgifb: Rework some conditions in XGI_SetCRT2ModeRegs(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rework some conditions to reduce indentation and fix style warnings. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index 53135c5..01a3ef3 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -5990,60 +5990,49 @@ static void XGI_SetCRT2ModeRegs(unsigned short ModeNo, tempah = 0x08; tempbl = 0xf0; - if (pVBInfo->VBInfo & DisableCRT2Display) { - xgifb_reg_and_or(pVBInfo->Part1Port, 0x2e, tempbl, tempah); - } else { - tempah = 0x00; - tempbl = 0xff; + if (pVBInfo->VBInfo & DisableCRT2Display) + goto reg_and_or; - if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV - | SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) { - if ((pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) && - (!(pVBInfo->VBInfo & SetSimuScanMode))) { - tempbl &= 0xf7; - tempah |= 0x01; - xgifb_reg_and_or(pVBInfo->Part1Port, 0x2e, - tempbl, tempah); - } else { - if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) { - tempbl &= 0xf7; - tempah |= 0x01; - } + tempah = 0x00; + tempbl = 0xff; - if (pVBInfo->VBInfo & - (SetCRT2ToRAMDAC | - SetCRT2ToTV | - SetCRT2ToLCD)) { - tempbl &= 0xf8; - tempah = 0x01; + if (!(pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV | + SetCRT2ToLCD | XGI_SetCRT2ToLCDA))) + goto reg_and_or; - if (!(pVBInfo->VBInfo & SetInSlaveMode)) - tempah |= 0x02; + if ((pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) && + (!(pVBInfo->VBInfo & SetSimuScanMode))) { + tempbl &= 0xf7; + tempah |= 0x01; + goto reg_and_or; + } - if (!(pVBInfo->VBInfo & - SetCRT2ToRAMDAC)) { - tempah = tempah ^ 0x05; - if (!(pVBInfo->VBInfo & - SetCRT2ToLCD)) - tempah = tempah ^ 0x01; - } + if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) { + tempbl &= 0xf7; + tempah |= 0x01; + } - if (!(pVBInfo->VBInfo & - SetCRT2ToDualEdge)) - tempah |= 0x08; - xgifb_reg_and_or(pVBInfo->Part1Port, - 0x2e, tempbl, tempah); - } else { - xgifb_reg_and_or(pVBInfo->Part1Port, - 0x2e, tempbl, tempah); - } - } - } else { - xgifb_reg_and_or(pVBInfo->Part1Port, 0x2e, tempbl, - tempah); - } + if (!(pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD))) + goto reg_and_or; + + tempbl &= 0xf8; + tempah = 0x01; + + if (!(pVBInfo->VBInfo & SetInSlaveMode)) + tempah |= 0x02; + + if (!(pVBInfo->VBInfo & SetCRT2ToRAMDAC)) { + tempah = tempah ^ 0x05; + if (!(pVBInfo->VBInfo & SetCRT2ToLCD)) + tempah = tempah ^ 0x01; } + if (!(pVBInfo->VBInfo & SetCRT2ToDualEdge)) + tempah |= 0x08; + +reg_and_or: + xgifb_reg_and_or(pVBInfo->Part1Port, 0x2e, tempbl, tempah); + if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) { tempah &= (~0x08); -- cgit v0.10.2 From 3bcc24601626a1e3e8a66577f735185141edd206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Fri, 6 Jul 2012 12:40:53 +0200 Subject: Staging: xgifb: Fix coding style. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix small coding style warnings in several files. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index e5657ff..0f49a21 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -590,7 +590,8 @@ static u8 XGIfb_search_refresh_rate(struct xgifb_video_info *xgifb_info, <= 2) && (XGIfb_vrate[i].idx != 1)) { pr_debug("Adjusting rate from %d down to %d\n", - rate, XGIfb_vrate[i-1].refresh); + rate, + XGIfb_vrate[i-1].refresh); xgifb_info->rate_idx = XGIfb_vrate[i - 1].idx; xgifb_info->refresh_rate = diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c index ae10153..80dba6a 100644 --- a/drivers/staging/xgifb/vb_init.c +++ b/drivers/staging/xgifb/vb_init.c @@ -1042,9 +1042,8 @@ static void XGINew_ChkSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, if (tempbx & tempcx) { CR3CData = xgifb_reg_get(pVBInfo->P3d4, 0x3c); - if (!(CR3CData & DisplayDeviceFromCMOS)) { + if (!(CR3CData & DisplayDeviceFromCMOS)) tempcx = 0x1FF0; - } } else { tempcx = 0x1FF0; } diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index 01a3ef3..e81149f 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -945,23 +945,26 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo, if (pVBInfo->IF_DEF_LVDS == 0) { CRT2Index = CRT2Index >> 6; /* for LCD */ - if (pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) { /*301b*/ + if (pVBInfo->VBInfo & + (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) { /*301b*/ if (pVBInfo->LCDResInfo != Panel_1024x768) - VCLKIndex = VCLK108_2_315 + 5; /* LCDXlat2VCLK */ + /* LCDXlat2VCLK */ + VCLKIndex = VCLK108_2_315 + 5; else VCLKIndex = VCLK65_315 + 2; /* LCDXlat1VCLK */ } else if (pVBInfo->VBInfo & SetCRT2ToHiVision) { - if (pVBInfo->SetFlag & RPLLDIV2XO) { + if (pVBInfo->SetFlag & RPLLDIV2XO) VCLKIndex = TVCLKBASE_315_25 + HiTVVCLKDIV2; - } else { + else VCLKIndex = TVCLKBASE_315_25 + HiTVVCLK; - } if (pVBInfo->SetFlag & TVSimuMode) { if (modeflag & Charx8Dot) { - VCLKIndex = TVCLKBASE_315_25 + HiTVSimuVCLK; + VCLKIndex = TVCLKBASE_315_25 + + HiTVSimuVCLK; } else { - VCLKIndex = TVCLKBASE_315_25 + HiTVTextVCLK; + VCLKIndex = TVCLKBASE_315_25 + + HiTVTextVCLK; } } @@ -978,11 +981,10 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo, VCLKIndex = YPbPr525iVCLK; } } else if (pVBInfo->VBInfo & SetCRT2ToTV) { - if (pVBInfo->SetFlag & RPLLDIV2XO) { + if (pVBInfo->SetFlag & RPLLDIV2XO) VCLKIndex = TVCLKBASE_315_25 + TVVCLKDIV2; - } else { + else VCLKIndex = TVCLKBASE_315_25 + TVVCLK; - } } else { /* for CRT2 */ /* di+Ext_CRTVCLK */ VCLKIndex = pVBInfo->RefIndex[RefreshRateTableIndex]. @@ -994,7 +996,8 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo, (pVBInfo->LCDResInfo == Panel_320x480)) VCLKIndex = VCLK40; /* LVDSXlat1VCLK */ else - VCLKIndex = VCLK65_315 + 2; /* LVDSXlat2VCLK, LVDSXlat3VCLK */ + VCLKIndex = VCLK65_315 + 2; /* LVDSXlat2VCLK, + LVDSXlat3VCLK */ } return VCLKIndex; @@ -1928,7 +1931,8 @@ static void XGI_GetLVDSData(unsigned short ModeNo, unsigned short ModeIdIndex, pVBInfo->HDE = 1024; pVBInfo->VDE = 768; } else if ((pVBInfo->LCDResInfo == Panel_1280x1024) || - (pVBInfo->LCDResInfo == Panel_1280x1024x75)) { + (pVBInfo->LCDResInfo == + Panel_1280x1024x75)) { pVBInfo->HDE = 1280; pVBInfo->VDE = 1024; } else if (pVBInfo->LCDResInfo == Panel_1400x1050) { @@ -2385,7 +2389,8 @@ static unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex, if (pVBInfo->TVInfo & TVSimuMode) { tempal = TVCLKBASE_315 + HiTVSimuVCLK; if (!(modeflag & Charx8Dot)) - tempal = TVCLKBASE_315 + HiTVTextVCLK; + tempal = TVCLKBASE_315 + + HiTVTextVCLK; } return tempal; @@ -2431,8 +2436,8 @@ static void XGI_GetVCLKLen(unsigned char tempal, unsigned char *di_0, { if (pVBInfo->VBType & (VB_SIS301 | VB_SIS301B | VB_SIS302B | VB_SIS301LV | VB_SIS302LV | VB_XGI301C)) { - if ((!(pVBInfo->VBInfo & XGI_SetCRT2ToLCDA)) && (pVBInfo->SetFlag - & ProgrammingCRT2)) { + if ((!(pVBInfo->VBInfo & XGI_SetCRT2ToLCDA)) && + (pVBInfo->SetFlag & ProgrammingCRT2)) { *di_0 = (unsigned char) XGI_VBVCLKData[tempal].SR2B; *di_1 = XGI_VBVCLKData[tempal].SR2C; } @@ -2948,7 +2953,10 @@ static unsigned char XGI_GetLCDInfo(unsigned short ModeNo, if ((pVBInfo->LCDResInfo == Panel_1400x1050) && (pVBInfo->VBInfo & SetCRT2ToLCD) && (resinfo == 9) && (!(tempbx & EnableScalingLCD))) - /* set to center in 1280x1024 LCDB for Panel_1400x1050 */ + /* + * set to center in 1280x1024 LCDB + * for Panel_1400x1050 + */ tempbx |= SetLCDtoNonExpanding; } @@ -5451,7 +5459,8 @@ static void XGI_DisableBridge(struct xgifb_video_info *xgifb_info, if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) { if (pVBInfo->VBInfo & SetCRT2ToDualEdge) { tempah = 0x7F; /* Disable Channel A */ - if (!(pVBInfo->VBInfo & XGI_SetCRT2ToLCDA)) + if (!(pVBInfo->VBInfo & + XGI_SetCRT2ToLCDA)) /* Disable Channel B */ tempah = 0xBF; @@ -5470,9 +5479,10 @@ static void XGI_DisableBridge(struct xgifb_video_info *xgifb_info, xgifb_reg_and(pVBInfo->Part4Port, 0x1F, tempah); if (pVBInfo->VBType & (VB_SIS302LV | VB_XGI301C)) { - if (((pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA))) - || (XGI_DisableChISLCD(pVBInfo)) - || (XGI_IsLCDON(pVBInfo))) + if (((pVBInfo->VBInfo & + (SetCRT2ToLCD | XGI_SetCRT2ToLCDA))) + || (XGI_DisableChISLCD(pVBInfo)) + || (XGI_IsLCDON(pVBInfo))) /* LVDS Driver power down */ xgifb_reg_or(pVBInfo->Part4Port, 0x30, 0x80); } @@ -5638,7 +5648,8 @@ static void XGI_SetDelayComp(struct vb_device_info *pVBInfo) if (pVBInfo->VBInfo & SetCRT2ToDualEdge) tempbl = tempbl >> 4; - if (pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) { + if (pVBInfo->VBInfo & + (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) { tempbh = XGI301LCDDelay; if (!(pVBInfo->VBInfo & XGI_SetCRT2ToLCDA)) @@ -5655,7 +5666,8 @@ static void XGI_SetDelayComp(struct vb_device_info *pVBInfo) tempah |= tempbl; } - if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) { /* Channel A */ + if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) { + /* Channel A */ tempah &= 0x0F; tempah |= tempbh; } @@ -6723,9 +6735,8 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info, XGI_UpdateModeInfo(HwDeviceExtension, pVBInfo); - if (HwDeviceExtension->jChipType < XG20) { + if (HwDeviceExtension->jChipType < XG20) XGI_LockCRT2(HwDeviceExtension, pVBInfo); - } return 1; } diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h index ca8c68d..1c16846 100644 --- a/drivers/staging/xgifb/vb_table.h +++ b/drivers/staging/xgifb/vb_table.h @@ -1838,9 +1838,12 @@ static struct XGI330_LCDDataTablStruct XGI_LCDDataTable[] = { {Panel_1024x768x75, 0x0019, 0x0001, 12}, /* XGI_ExtLCD1024x768x75Data */ {Panel_1024x768x75, 0x0019, 0x0000, 13}, /* XGI_StLCD1024x768x75Data */ {Panel_1024x768x75, 0x0018, 0x0010, 14}, /* XGI_CetLCD1024x768x75Data */ - {Panel_1280x1024x75, 0x0019, 0x0001, 15}, /* XGI_ExtLCD1280x1024x75Data*/ - {Panel_1280x1024x75, 0x0019, 0x0000, 16}, /* XGI_StLCD1280x1024x75Data */ - {Panel_1280x1024x75, 0x0018, 0x0010, 17}, /* XGI_CetLCD1280x1024x75Data*/ + /* XGI_ExtLCD1280x1024x75Data */ + {Panel_1280x1024x75, 0x0019, 0x0001, 15}, + /* XGI_StLCD1280x1024x75Data */ + {Panel_1280x1024x75, 0x0019, 0x0000, 16}, + /* XGI_CetLCD1280x1024x75Data */ + {Panel_1280x1024x75, 0x0018, 0x0010, 17}, {PanelRef75Hz, 0x0008, 0x0008, 18}, /* XGI_NoScalingDatax75 */ {0xFF, 0x0000, 0x0000, 0} /* End of table */ }; @@ -1859,9 +1862,12 @@ static struct XGI330_LCDDataTablStruct XGI_LCDDesDataTable[] = { {Panel_1600x1200, 0x0019, 0x0001, 10}, /* XGI_ExtLCDDes1600x1200Data */ {Panel_1600x1200, 0x0019, 0x0000, 11}, /* XGI_StLCDDes1600x1200Data */ {PanelRef60Hz, 0x0008, 0x0008, 12}, /* XGI_NoScalingDesData */ - {Panel_1024x768x75, 0x0019, 0x0001, 13}, /*XGI_ExtLCDDes1024x768x75Data*/ - {Panel_1024x768x75, 0x0019, 0x0000, 14}, /* XGI_StLCDDes1024x768x75Data*/ - {Panel_1024x768x75, 0x0018, 0x0010, 15}, /*XGI_CetLCDDes1024x768x75Data*/ + /* XGI_ExtLCDDes1024x768x75Data */ + {Panel_1024x768x75, 0x0019, 0x0001, 13}, + /* XGI_StLCDDes1024x768x75Data */ + {Panel_1024x768x75, 0x0019, 0x0000, 14}, + /* XGI_CetLCDDes1024x768x75Data */ + {Panel_1024x768x75, 0x0018, 0x0010, 15}, /* XGI_ExtLCDDes1280x1024x75Data */ {Panel_1280x1024x75, 0x0019, 0x0001, 16}, /* XGI_StLCDDes1280x1024x75Data */ @@ -1898,8 +1904,10 @@ static struct XGI330_LCDDataTablStruct XGI_EPLLCDDataPtr[] = { {PanelRef60Hz, 0x0008, 0x0008, 7}, /* XGI_LVDSNoScalingData */ {Panel_1024x768x75, 0x0018, 0x0000, 8}, /* XGI_LVDS1024x768Data_1x75 */ {Panel_1024x768x75, 0x0018, 0x0010, 9}, /* XGI_LVDS1024x768Data_2x75 */ - {Panel_1280x1024x75, 0x0018, 0x0000, 10}, /* XGI_LVDS1280x1024Data_1x75*/ - {Panel_1280x1024x75, 0x0018, 0x0010, 11}, /*XGI_LVDS1280x1024Data_2x75*/ + /* XGI_LVDS1280x1024Data_1x75 */ + {Panel_1280x1024x75, 0x0018, 0x0000, 10}, + /* XGI_LVDS1280x1024Data_2x75 */ + {Panel_1280x1024x75, 0x0018, 0x0010, 11}, {PanelRef75Hz, 0x0008, 0x0008, 12}, /* XGI_LVDSNoScalingDatax75 */ {0xFF, 0x0000, 0x0000, 0} }; @@ -1917,8 +1925,10 @@ static struct XGI330_LCDDataTablStruct XGI_EPLLCDDesDataPtr[] = { {Panel_1024x768x75, 0x0018, 0x0000, 9}, /* XGI_LVDS1024x768Des_1x75 */ {Panel_1024x768x75, 0x0618, 0x0410, 10}, /* XGI_LVDS1024x768Des_3x75 */ {Panel_1024x768x75, 0x0018, 0x0010, 11}, /* XGI_LVDS1024x768Des_2x75 */ - {Panel_1280x1024x75, 0x0018, 0x0000, 12}, /* XGI_LVDS1280x1024Des_1x75 */ - {Panel_1280x1024x75, 0x0018, 0x0010, 13}, /* XGI_LVDS1280x1024Des_2x75 */ + /* XGI_LVDS1280x1024Des_1x75 */ + {Panel_1280x1024x75, 0x0018, 0x0000, 12}, + /* XGI_LVDS1280x1024Des_2x75 */ + {Panel_1280x1024x75, 0x0018, 0x0010, 13}, {PanelRef75Hz, 0x0008, 0x0008, 14}, /* XGI_LVDSNoScalingDesDatax75 */ {0xFF, 0x0000, 0x0000, 0} }; -- cgit v0.10.2 From f6002041af0bc95bc4951ddf94cda706605faf48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20G=C3=B3mez?= Date: Fri, 6 Jul 2012 12:40:54 +0200 Subject: Staging: xgifb: Remove useless condition. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove last if branch in XGIfb_do_set_var(), as it has no action assigned. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 0f49a21..64ffd70 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -973,8 +973,6 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, vtotal <<= 1; else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE) vtotal <<= 2; - else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) { - } if (!htotal || !vtotal) { pr_debug("Invalid 'var' information\n"); -- cgit v0.10.2 From 9f433eac0b6f2af7642890ce7995dcc9d1d309ff Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Mon, 9 Jul 2012 22:32:38 -0300 Subject: staging: bcm: Remove code that will never execute This patch removes all references of "if 0" blocks in the bcm drivers. Signed-off-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/Misc.c b/drivers/staging/bcm/Misc.c index c36fd76..d7c662d 100644 --- a/drivers/staging/bcm/Misc.c +++ b/drivers/staging/bcm/Misc.c @@ -402,30 +402,6 @@ INT CopyBufferToControlPacket(struct bcm_mini_adapter *Adapter, PVOID ioBuffer) return Status; } -#if 0 -/***************************************************************** -* Function - SendStatisticsPointerRequest() -* -* Description - This function builds and forwards the Statistics -* Pointer Request control Packet. -* -* Parameters - Adapter : Pointer to Adapter structure. -* - pstStatisticsPtrRequest : Pointer to link request. -* -* Returns - None. -*****************************************************************/ -static VOID SendStatisticsPointerRequest(struct bcm_mini_adapter *Adapter, struct bcm_link_request *pstStatisticsPtrRequest) -{ - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "======>"); - pstStatisticsPtrRequest->Leader.Status = STATS_POINTER_REQ_STATUS; - pstStatisticsPtrRequest->Leader.PLength = sizeof(ULONG); /* minimum 4 bytes */ - pstStatisticsPtrRequest->szData[0] = STATISTICS_POINTER_REQ; - CopyBufferToControlPacket(Adapter, pstStatisticsPtrRequest); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "<====="); - return; -} -#endif - /****************************************************************** * Function - LinkMessage() * @@ -1217,45 +1193,6 @@ static VOID doPowerAutoCorrection(struct bcm_mini_adapter *psAdapter) } } -#if 0 -static unsigned char *ReadMacAddrEEPROM(struct bcm_mini_adapter *Adapter, ulong dwAddress) -{ - int status = 0, i = 0; - unsigned int temp = 0; - unsigned char *pucmacaddr = kmalloc(MAC_ADDRESS_SIZE, GFP_KERNEL); - int bytes; - - if (!pucmacaddr) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "No Buffers to Read the EEPROM Address\n"); - return NULL; - } - - dwAddress |= 0x5b000000; - status = wrmalt(Adapter, EEPROM_COMMAND_Q_REG, (PUINT)&dwAddress, sizeof(UINT)); - if (status != STATUS_SUCCESS) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "wrm Failed..\n"); - kfree(pucmacaddr); - pucmacaddr = NULL; - goto OUT; - } - - for (i = 0; i < MAC_ADDRESS_SIZE; i++) { - bytes = rdmalt(Adapter, EEPROM_READ_DATA_Q_REG, &temp, sizeof(temp)); - if (bytes < 0) { - status = bytes; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "rdm Failed..\n"); - kfree(pucmacaddr); - pucmacaddr = NULL; - goto OUT; - } - pucmacaddr[i] = temp & 0xff; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "%x\n", pucmacaddr[i]); - } -OUT: - return pucmacaddr; -} -#endif - static void convertEndian(B_UINT8 rwFlag, PUINT puiBuffer, UINT uiByteCount) { UINT uiIndex = 0; -- cgit v0.10.2 From d5bd0ba64df5ac474090b82f958328e696ade458 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Mon, 9 Jul 2012 22:32:39 -0300 Subject: staging: bcm: Remove all commented macros All these macros are commented, and can be removed. Signed-off-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 9c8c9b1..b54ec97 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -4,7 +4,6 @@ * Management. ************************************************************/ -/* #define CONN_MSG */ #include "headers.h" enum E_CLASSIFIER_ACTION { diff --git a/drivers/staging/bcm/Debug.h b/drivers/staging/bcm/Debug.h index 420382d..8018a18 100644 --- a/drivers/staging/bcm/Debug.h +++ b/drivers/staging/bcm/Debug.h @@ -42,10 +42,6 @@ #define ARP_REQ (TX<<5) #define ARP_RESP (TX<<6) -// dhcp.c -//#define DHCP TX -//#define DHCP_REQ (DHCP<<7) - // Leakybucket.c #define TOKEN_COUNTS (TX<<8) #define CHECK_TOKENS (TX<<9) @@ -147,7 +143,6 @@ DriverEntry.c, bcmfwup.c, ChipDetectTask.c, HaltnReset.c, InterfaceDDR.c */ #define HOST_MIBS (OTHERS << 28) #define CONN_MSG (CMHOST << 29) -//#define OTHERS_MISC (OTHERS << 29) // ProcSupport.c /*-----------------END SUBTYPEs------------------------------------------*/ diff --git a/drivers/staging/bcm/Macros.h b/drivers/staging/bcm/Macros.h index b5ca6f6..46f5f0f 100644 --- a/drivers/staging/bcm/Macros.h +++ b/drivers/staging/bcm/Macros.h @@ -6,7 +6,6 @@ #define TX_TIMER_PERIOD 10 /*10 msec*/ #define MAX_CLASSIFIERS 100 -/* #define MAX_CLASSIFIERS_PER_SF 20 */ #define MAX_TARGET_DSX_BUFFERS 24 #define MAX_CNTRL_PKTS 100 diff --git a/drivers/staging/bcm/PHSDefines.h b/drivers/staging/bcm/PHSDefines.h index eed4cfc..6016fc5 100644 --- a/drivers/staging/bcm/PHSDefines.h +++ b/drivers/staging/bcm/PHSDefines.h @@ -27,7 +27,6 @@ #define PHS_BUFFER_SIZE 1532 -//#define MAX_PHS_LENGTHS 100 #define MAX_PHSRULE_PER_SF 20 #define MAX_SERVICEFLOWS 17 -- cgit v0.10.2 From 3a53ecbd5f7b1843232ed692c3ec3308b1f63ca7 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Mon, 9 Jul 2012 22:32:40 -0300 Subject: staging: bcm: Misc.c: Remove unused macros These macros were reported by forgotten-macros tool (https://github.com/marcosps/forgotten_macros). Signed-off-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/bcm/Misc.c b/drivers/staging/bcm/Misc.c index d7c662d..9a60d4c 100644 --- a/drivers/staging/bcm/Misc.c +++ b/drivers/staging/bcm/Misc.c @@ -1206,9 +1206,6 @@ static void convertEndian(B_UINT8 rwFlag, PUINT puiBuffer, UINT uiByteCount) } } -#define CACHE_ADDRESS_MASK 0x80000000 -#define UNCACHE_ADDRESS_MASK 0xa0000000 - int rdm(struct bcm_mini_adapter *Adapter, UINT uiAddress, PCHAR pucBuff, size_t sSize) { return Adapter->interface_rdm(Adapter->pvInterfaceAdapter, -- cgit v0.10.2 From d69803b95580581bc7cf6cc901dec91e20f5d5a8 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Mon, 9 Jul 2012 23:43:09 -0300 Subject: staging: csr: Remove dead code All this code is dead, so remove it. Signed-off-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/monitor.c b/drivers/staging/csr/monitor.c index 7648d2b..8c35b7e 100644 --- a/drivers/staging/csr/monitor.c +++ b/drivers/staging/csr/monitor.c @@ -51,13 +51,6 @@ uf_start_sniff(unifi_priv_t *priv) req->Channel = priv->wext_conf.channel; req->ChannelStartingFactor = 0; -#if 0 - printk("SniffJoin: Ifindex=%d, Channel=%d, ChannelStartingFactor=%d\n", - req->Ifindex, - req->Channel, - req->ChannelStartingFactor); -#endif - signal.SignalPrimitiveHeader.SignalId = CSR_MLME_SNIFFJOIN_REQUEST_ID; r = unifi_mlme_blocking_request(priv, pcli, &signal, NULL, timeout); @@ -198,11 +191,6 @@ netrx_radiotap(unifi_priv_t *priv, unifi_rt->rt_antenna = ind->AntennaId; -#if 0 - printk("skb datalen=%d\n", skb->len); - dump(skb->data, 48); -#endif - skb->dev = dev; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) skb->mac_header = skb->data; @@ -282,24 +270,6 @@ netrx_prism(unifi_priv_t *priv, return; } -#if 0 - printk("MA-SINFFDATA.ind: DataLen=%d bytes, TSF %02X %02X %02X %02X %02X %02X %02X %02X, Rate=%d, Antenna=%d\n", - ind->Data.DataLength, - ind->Timestamp.x[0], - ind->Timestamp.x[1], - ind->Timestamp.x[2], - ind->Timestamp.x[3], - ind->Timestamp.x[4], - ind->Timestamp.x[5], - ind->Timestamp.x[6], - ind->Timestamp.x[7], - ind->Rate, - ind->Antenna); - - printk("payload, len %d\n", length); - dump((unsigned char *)payload, 32); -#endif - /* * Allocate a SKB for the received data packet, including radiotap * header. @@ -341,11 +311,6 @@ netrx_prism(unifi_priv_t *priv, avs->encoding = htonl(0); /* unknown */ -#if 0 - printk("skb datalen=%d\n", skb->len); - dump(skb->data, 48); -#endif - skb->dev = dev; skb->mac.raw = skb->data; skb->pkt_type = PACKET_OTHERHOST; @@ -402,33 +367,11 @@ ma_sniffdata_ind(void *ospriv, } skb->len = bulkdata->d[0].data_length; -#if 0 - printk("MA-SNIFFDATA.ind: DataLen=%d bytes, TSF %02X %02X %02X %02X %02X %02X %02X %02X, Rate=%d, Antenna=%d\n", - ind->Data.DataLength, - ind->Timestamp.x[0], - ind->Timestamp.x[1], - ind->Timestamp.x[2], - ind->Timestamp.x[3], - ind->Timestamp.x[4], - ind->Timestamp.x[5], - ind->Timestamp.x[6], - ind->Timestamp.x[7], - ind->Rate, - ind->AntennaId); - - printk("payload, len %lu\n", bulkdata->d[0].data_length); - if (bulkdata->d[0].os_data_ptr && (bulkdata->d[0].data_length >= 32)) { - dump((unsigned char *)bulkdata->d[0].os_data_ptr, 32); - } -#endif /* We only process data packets if the interface is open */ if (unlikely(!netif_running(dev))) { priv->stats.rx_dropped++; priv->wext_conf.wireless_stats.discard.misc++; -#if 0 - printk("Dropping packet while interface is not up.\n"); -#endif dev_kfree_skb(skb); return; } diff --git a/drivers/staging/csr/unifi_native.h b/drivers/staging/csr/unifi_native.h index a480c9e..a73b38e 100644 --- a/drivers/staging/csr/unifi_native.h +++ b/drivers/staging/csr/unifi_native.h @@ -242,25 +242,6 @@ void uf_native_process_udi_signal(ul_client_t *pcli, const u8 *packed_signal, int packed_signal_len, const bulk_data_param_t *bulkdata, int dir); -#if 0 -/* - * Choose one of these if available in linux/if_arp.h: - * #define UNIFI_SNIFF_ARPHRD ARPHRD_IEEE80211_RADIOTAP - * #define UNIFI_SNIFF_ARPHRD ARPHRD_IEEE80211_PRISM - * - * Radiotap is the newer standard for softmac WLAN devices, it works with - * Wireshark but not Ethereal (due to a bug in the Ethereal dissector). - * Prism is an older (less desirable) format but it does work with Ethereal. - */ -#ifdef ARPHRD_IEEE80211_RADIOTAP -#define UNIFI_SNIFF_ARPHRD ARPHRD_IEEE80211_RADIOTAP -#else -#ifdef ARPHRD_IEEE80211_PRISM -#define UNIFI_SNIFF_ARPHRD ARPHRD_IEEE80211_PRISM -#endif -#endif -#endif - #ifdef UNIFI_SNIFF_ARPHRD /* * monitor.c -- cgit v0.10.2 From b433ed5bfec42f956887e50e5965941c14120f31 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Mon, 9 Jul 2012 23:43:10 -0300 Subject: staging: csr: csr_util.h: Remove commented macros All these macros are commented, so we can removed it. Signed-off-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index ce39c7e..5cd6cb4 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -47,17 +47,10 @@ void CsrUInt32ToHex(CsrUint32 number, CsrCharString *str); #define CsrMemCmp(s1, s2, n) ((CsrInt32) memcmp((s1), (s2), (n))) #define CsrStrCmp(s1, s2) ((CsrInt32) strcmp((s1), (s2))) #define CsrStrNCmp(s1, s2, n) ((CsrInt32) strncmp((s1), (s2), (n))) -/*#define CsrMemChr memchr*/ #define CsrStrChr strchr -/*#define CsrStrCSpn strcspn*/ -/*#define CsrStrPBrk strpbrk*/ -/*#define CsrStrRChr strrchr*/ -/*#define CsrStrSpn strspn*/ #define CsrStrStr strstr -/*#define CsrStrTok strtok*/ #define CsrMemSet memset #define CsrStrLen strlen -/*#define CsrVsnprintf(s, n, format, arg) ((CsrInt32) vsnprintf((s), (n), (format), (arg)))*/ #else /* !CSR_USE_STDC_LIB */ void *CsrMemCpy(void *dest, const void *src, CsrSize count); void *CsrMemMove(void *dest, const void *src, CsrSize count); -- cgit v0.10.2 From e3a90feadf00d7892a0b08fee97cf6aed5c4e624 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Mon, 9 Jul 2012 23:43:11 -0300 Subject: staging: csr: netdev.c: Remove unused macros These macros are not used, so we can remove it. Signed-off-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/netdev.c b/drivers/staging/csr/netdev.c index cf19f11..55149df 100644 --- a/drivers/staging/csr/netdev.c +++ b/drivers/staging/csr/netdev.c @@ -70,11 +70,6 @@ */ #define ALLOW_Q_PAUSE -#define ieee2host16(n) __le16_to_cpu(n) -#define ieee2host32(n) __le32_to_cpu(n) -#define host2ieee16(n) __cpu_to_le16(n) -#define host2ieee32(n) __cpu_to_le32(n) - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) #ifdef UNIFI_NET_NAME #define UF_ALLOC_NETDEV(_dev, _size, _name, _setup, _num_of_queues) \ -- cgit v0.10.2 From 6d6f64ae16a38b485b164b8089f357343077d230 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Mon, 9 Jul 2012 23:43:12 -0300 Subject: staging: csr: unifi_sme.c: Remove unused macros These macros are not used, so remove it. Signed-off-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/unifi_sme.c b/drivers/staging/csr/unifi_sme.c index 6e7cbbf..5ad1d5f 100644 --- a/drivers/staging/csr/unifi_sme.c +++ b/drivers/staging/csr/unifi_sme.c @@ -78,12 +78,6 @@ sme_log_event(ul_client_t *pcli, CsrResult result = CSR_RESULT_SUCCESS; int r; - /* Following bits are encoded in hostTag These are there to ensure that hostTags are unique*/ -#define CSR_SME_DATA 0x00000000 /* Frames Sent by SME */ -#define CSR_PAL_DATA 0X10000000 /* Frames Sent by PAL-D*/ -#define CSR_NME_DATA 0x20000000 /* Frames Sent by NME*/ -#define APPLICATION_DATA 0x30000000 /* Frames Sent by Application*/ - func_enter(); /* Just a sanity check */ if ((signal == NULL) || (signal_len <= 0)) { -- cgit v0.10.2 From 69a7cd7dd54d4d7a129c209a9586f850b13721bb Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Mon, 9 Jul 2012 23:43:13 -0300 Subject: staging: csr: Remove unused macros These macros are not used, so remove it. Signed-off-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.c b/drivers/staging/csr/csr_wifi_hip_card_sdio.c index 91976b8..5a86ff9 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.c @@ -36,9 +36,6 @@ #define MAILBOX2_TIMEOUT 5 /* in millisecs */ #define MAILBOX2_ATTEMPTS 10 /* 50ms */ -#define MAILBOX2_RESET_ATTEMPTS 10 -#define MAILBOX2_RESET_TIMEOUT 5 /* in millisecs */ - #define RESET_SETTLE_DELAY 25 /* in millisecs */ static CsrResult card_init_slots(card_t *card); diff --git a/drivers/staging/csr/drv.c b/drivers/staging/csr/drv.c index fbe8630..4be6d95 100644 --- a/drivers/staging/csr/drv.c +++ b/drivers/staging/csr/drv.c @@ -63,7 +63,6 @@ int coredump_max = CSR_WIFI_HIP_NUM_COREDUMP_BUFFERS; int run_bh_once = -1; /* Set for scheduled interrupt mode, -1 = default */ int bh_priority = -1; #ifdef CSR_WIFI_HIP_DEBUG_OFFLINE -#define UNIFI_LOG_HIP_SIGNALS_FILTER_SIGNAL (1 << 0) #define UNIFI_LOG_HIP_SIGNALS_FILTER_BULKDATA (1 << 1) #define UNIFI_LOG_HIP_SIGNALS_FILTER_TIMESTAMP (1 << 2) int log_hip_signals = 0; diff --git a/drivers/staging/csr/firmware.c b/drivers/staging/csr/firmware.c index 03da0d5..98e27d6 100644 --- a/drivers/staging/csr/firmware.c +++ b/drivers/staging/csr/firmware.c @@ -220,7 +220,6 @@ unifi_fw_read(void *ospriv, void *arg, CsrUint32 offset, void *buf, CsrUint32 le -#define UNIFIHELPER_INIT_MODE_SMEEMB 0 #define UNIFIHELPER_INIT_MODE_SMEUSER 2 #define UNIFIHELPER_INIT_MODE_NATIVE 1 diff --git a/drivers/staging/csr/mlme.c b/drivers/staging/csr/mlme.c index 790d5d7..ed767ecc 100644 --- a/drivers/staging/csr/mlme.c +++ b/drivers/staging/csr/mlme.c @@ -15,11 +15,6 @@ #include "csr_wifi_hip_unifi.h" #include "unifi_priv.h" - -/* The additional time taken by the UniFi to do a scan per channel */ -#define SCAN_STARTUP_TIME 300 /* in millisecs */ - - /* * --------------------------------------------------------------------------- * unifi_mlme_wait_for_reply diff --git a/drivers/staging/csr/monitor.c b/drivers/staging/csr/monitor.c index 8c35b7e..628782a 100644 --- a/drivers/staging/csr/monitor.c +++ b/drivers/staging/csr/monitor.c @@ -242,9 +242,7 @@ netrx_prism(unifi_priv_t *priv, unsigned char *ptr; unsigned char *base; int ind_data_len = skb_orig->len - 2 - ETH_HLEN; -#define WLANCAP_MAGIC_COOKIE_BASE 0x80211000 #define WLANCAP_MAGIC_COOKIE_V1 0x80211001 -#define WLANCAP_MAGIC_COOKIE_V2 0x80211002 struct avs_header_v1 { uint32 version; uint32 length; diff --git a/drivers/staging/csr/sme_sys.c b/drivers/staging/csr/sme_sys.c index 9c3aa74..5f38f9d 100644 --- a/drivers/staging/csr/sme_sys.c +++ b/drivers/staging/csr/sme_sys.c @@ -1572,7 +1572,6 @@ void CsrWifiRouterMaPacketReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) r = _sys_packet_req(priv, &signal, mareq->subscriptionHandle, mareq->frameLength, mareq->frame, snap_protocol); -#define MAX_RETRY 2 if (r && mareq->cfmRequested) { CsrWifiRouterMaPacketCfmSend(msg->source,interfaceTag, -- cgit v0.10.2 From 80145a579f167f090af3b2716f14a6b0a82b4e76 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Tue, 10 Jul 2012 10:36:05 +0530 Subject: staging/ft1000: remove all spaces, tabs issue in while loop of ft1000_interrupt all spaces in the main while loop of ft1000_interrupt are converted to tabs. Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c index 0059cac..86a680c 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c @@ -1996,41 +1996,43 @@ static irqreturn_t ft1000_interrupt(int irq, void *dev_id) inttype = ft1000_read_reg(dev, FT1000_REG_SUP_ISR); // Make sure we process all interrupt before leaving the ISR due to the edge trigger interrupt type - while (inttype) { + while (inttype) { if (inttype & ISR_DOORBELL_PEND) ft1000_parse_dpram_msg(dev); - if (inttype & ISR_RCV) { - DEBUG(1, "Data in FIFO\n"); + if (inttype & ISR_RCV) { + DEBUG(1, "Data in FIFO\n"); - cnt = 0; - do { - // Check if we have packets in the Downlink FIFO - if (info->AsicID == ELECTRABUZZ_ID) { - tempword = - ft1000_read_reg(dev, FT1000_REG_DFIFO_STAT); - } else { - tempword = - ft1000_read_reg(dev, FT1000_REG_MAG_DFSR); - } - if (tempword & 0x1f) { - ft1000_copy_up_pkt(dev); - } else { - break; - } - cnt++; - } while (cnt < MAX_RCV_LOOP); + cnt = 0; + do { + // Check if we have packets in the Downlink FIFO + if (info->AsicID == ELECTRABUZZ_ID) { + tempword = + ft1000_read_reg(dev, + FT1000_REG_DFIFO_STAT); + } else { + tempword = + ft1000_read_reg(dev, + FT1000_REG_MAG_DFSR); + } + if (tempword & 0x1f) { + ft1000_copy_up_pkt(dev); + } else { + break; + } + cnt++; + } while (cnt < MAX_RCV_LOOP); + } + // clear interrupts + tempword = ft1000_read_reg(dev, FT1000_REG_SUP_ISR); + DEBUG(1, "ft1000_hw: interrupt status register = 0x%x\n", tempword); + ft1000_write_reg(dev, FT1000_REG_SUP_ISR, tempword); + + // Read interrupt type + inttype = ft1000_read_reg (dev, FT1000_REG_SUP_ISR); + DEBUG(1,"ft1000_hw: interrupt status register after clear = 0x%x\n",inttype); } - // clear interrupts - tempword = ft1000_read_reg(dev, FT1000_REG_SUP_ISR); - DEBUG(1, "ft1000_hw: interrupt status register = 0x%x\n", tempword); - ft1000_write_reg(dev, FT1000_REG_SUP_ISR, tempword); - - // Read interrupt type - inttype = ft1000_read_reg (dev, FT1000_REG_SUP_ISR); - DEBUG(1,"ft1000_hw: interrupt status register after clear = 0x%x\n",inttype); - } ft1000_enable_interrupts(dev); return IRQ_HANDLED; } -- cgit v0.10.2 From aaf3ee4f80960eecccdd94a6b44b41c6af6c14d3 Mon Sep 17 00:00:00 2001 From: Masanari Iida Date: Thu, 12 Jul 2012 00:41:44 +0900 Subject: staging: ft1000: Fix typo in ft1000_usb.c Correct spelling typo within debug message of ft1000_usb.c Signed-off-by: Masanari Iida Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c index 7bd7fb2..e8c4a4e5 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c @@ -237,7 +237,7 @@ static void ft1000_disconnect(struct usb_interface *interface) ft1000_destroy_dev(pft1000info->pFt1000Dev->net); unregister_netdev(pft1000info->pFt1000Dev->net); DEBUG - ("ft1000_disconnect: network device unregisterd\n"); + ("ft1000_disconnect: network device unregistered\n"); free_netdev(pft1000info->pFt1000Dev->net); } -- cgit v0.10.2 From e6345c81b4eb20850ae4078ed3a8ff6eae584283 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Tue, 10 Jul 2012 11:19:14 +0530 Subject: staging/sm7xxfb: use module_pci_driver macro as the manual of module_pci_driver says that it can be used when the init and exit functions of the module does nothing but the pci_register_driver and pci_unregister_driver. use it for the sm7xxfb driver, as the driver does nothing in its _init and _exit functions but the register and unregister. Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index e3511ec..0c0b603 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -1058,18 +1058,7 @@ static struct pci_driver smtcfb_driver = { .driver.pm = SM7XX_PM_OPS, }; -static int __init smtcfb_init(void) -{ - return pci_register_driver(&smtcfb_driver); -} - -static void __exit smtcfb_exit(void) -{ - pci_unregister_driver(&smtcfb_driver); -} - -module_init(smtcfb_init); -module_exit(smtcfb_exit); +module_pci_driver(smtcfb_driver); MODULE_AUTHOR("Siliconmotion "); MODULE_DESCRIPTION("Framebuffer driver for SMI Graphic Cards"); -- cgit v0.10.2 From fd67859d380b4c2af160d4aa3d8041bf63d7bd36 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Tue, 10 Jul 2012 11:19:15 +0530 Subject: staging/sm7xxfb: return a proper err for smtc_alloc_fb_info failure as smtc_alloc_fb_info can fail, but we are returning the 0, how? because the pci_enable_device succeeded, which makes the probe return 0, and may cause panics or some strange problems at remove when driver unloaded by modprobe -r. so return err properly as smtc_alloc_fb_info is doing kzallocs its good to do -ENOMEM Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index 0c0b603..7395196 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -808,8 +808,10 @@ static int __devinit smtcfb_pci_probe(struct pci_dev *pdev, sfb = smtc_alloc_fb_info(pdev, name); - if (!sfb) + if (!sfb) { + err = -ENOMEM; goto failed_free; + } sfb->chip_id = ent->device; sprintf(name, "sm%Xfb", sfb->chip_id); -- cgit v0.10.2 From 8e4763f67fe7279822c131bde4eadf5f7e456b2c Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Tue, 10 Jul 2012 12:11:48 +0530 Subject: staging/sep: use module_pci_driver macro this driver duplicates the module_pci_driver code, so remove the duplicated code and use module_pci_driver and also remove the obvious comments about _init and _exit. Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sep/sep_main.c b/drivers/staging/sep/sep_main.c index 270fcb8..205d0df 100644 --- a/drivers/staging/sep/sep_main.c +++ b/drivers/staging/sep/sep_main.c @@ -4492,30 +4492,5 @@ static struct pci_driver sep_pci_driver = { .remove = sep_remove }; -/** - * sep_init - init function - * - * Module load time. Register the PCI device driver. - */ - -static int __init sep_init(void) -{ - return pci_register_driver(&sep_pci_driver); -} - - -/** - * sep_exit - called to unload driver - * - * Unregister the driver The device will perform all the cleanup required. - */ -static void __exit sep_exit(void) -{ - pci_unregister_driver(&sep_pci_driver); -} - - -module_init(sep_init); -module_exit(sep_exit); - +module_pci_driver(sep_pci_driver); MODULE_LICENSE("GPL"); -- cgit v0.10.2 From 89812b1f5af666e531e4840e867edf86ed047db8 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Tue, 10 Jul 2012 12:11:03 +0530 Subject: staging/et131x: use module_pci_driver macro remove code duplicating module_pci_driver and also the obvious comments about the _init and _exit points. Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index 8f3fc5f..ac6897b 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -5445,24 +5445,4 @@ static struct pci_driver et131x_driver = { .driver.pm = ET131X_PM_OPS, }; -/** - * et131x_init_module - The "main" entry point called on driver initialization - * - * Returns 0 on success, errno on failure (as defined in errno.h) - */ -static int __init et131x_init_module(void) -{ - return pci_register_driver(&et131x_driver); -} - -/** - * et131x_cleanup_module - The entry point called on driver cleanup - */ -static void __exit et131x_cleanup_module(void) -{ - pci_unregister_driver(&et131x_driver); -} - -module_init(et131x_init_module); -module_exit(et131x_cleanup_module); - +module_pci_driver(et131x_driver); -- cgit v0.10.2 From 1cdb9c7c1d4846e04c28dbb41c6cef3a5e5f2b56 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Tue, 10 Jul 2012 12:10:04 +0530 Subject: staging/sbe-2t3e3: use module_pci_driver macro the _init and _exit functions do nothing but pci_register_driver, and pci_unregister_driver, so replace these and also the module _init and _exit macros with the module_pci_driver macro. Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sbe-2t3e3/module.c b/drivers/staging/sbe-2t3e3/module.c index e87fe81..cd778b3 100644 --- a/drivers/staging/sbe-2t3e3/module.c +++ b/drivers/staging/sbe-2t3e3/module.c @@ -194,17 +194,6 @@ static struct pci_driver t3e3_pci_driver = { .remove = t3e3_remove_card, }; -static int __init t3e3_init_module(void) -{ - return pci_register_driver(&t3e3_pci_driver); -} - -static void __exit t3e3_cleanup_module(void) -{ - pci_unregister_driver(&t3e3_pci_driver); -} - -module_init(t3e3_init_module); -module_exit(t3e3_cleanup_module); +module_pci_driver(t3e3_pci_driver); MODULE_LICENSE("GPL"); MODULE_DEVICE_TABLE(pci, t3e3_pci_tbl); -- cgit v0.10.2 From d44858a9b4abc1fb94f0dae587fbd1807bb3c576 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Tue, 10 Jul 2012 12:16:30 +0530 Subject: staging/phison: use module_pci_driver macro remove the duplication of module_pci_driver and use this macro instead module_pci_driver macro does the same things as the code below does static int __init pci_test_dev_init(void) { return pci_register_driver(&pci_test_driver_ops); } static void __exit pci_test_dev_exit(void) { pci_unregister_driver(&pci_test_driver_ops); } module_init(pci_test_dev_init); module_exit(pci_test_dev_exit); Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/phison/phison.c b/drivers/staging/phison/phison.c index d77b21f..919cb95 100644 --- a/drivers/staging/phison/phison.c +++ b/drivers/staging/phison/phison.c @@ -87,18 +87,7 @@ static struct pci_driver phison_pci_driver = { #endif }; -static int __init phison_ide_init(void) -{ - return pci_register_driver(&phison_pci_driver); -} - -static void __exit phison_ide_exit(void) -{ - pci_unregister_driver(&phison_pci_driver); -} - -module_init(phison_ide_init); -module_exit(phison_ide_exit); +module_pci_driver(phison_pci_driver); MODULE_AUTHOR("Evan Ko"); MODULE_DESCRIPTION("PCIE driver module for PHISON PS5000 E-BOX"); -- cgit v0.10.2 From d99b5ac65e7827f10ba60b1ea44d7bd041d58d1d Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Wed, 11 Jul 2012 11:54:15 +0545 Subject: staging/slicoss: disable pci device at remove at probe we enabled the device, and we should disable it at remove. Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 785e4c5..56829fc 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -3234,6 +3234,7 @@ static void __devexit slic_entry_remove(struct pci_dev *pcidev) } free_netdev(dev); pci_release_regions(pcidev); + pci_disable_device(pcidev); } static int slic_entry_halt(struct net_device *dev) -- cgit v0.10.2 From bbdb822c4c3f8dbefd8f6dc84f6d98c33af6e051 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Tue, 10 Jul 2012 22:32:00 +0100 Subject: iio: add adjd_s311 I2C digital color sensor driver sensor has 4 channels (10-bit each, R/G/B and clear), sensitivity and gain is controlled in the driver by ext_info integration_time and CHAN_INFO_HARDWAREGAIN driver supports triggered buffer and IIO_CHAN_INFO_RAW to get the sensor data v5: address comments by Jonathan Cameron * use macro for channel declaration * get timestamp right before measurement * cleanups v4: address comments by Lars-Peter Clausen * make sure trigger handler is exited with iio_trigger_notify_done() and IRQ_HANDLED * kfree()/kalloc() -> krealloc() v3: * fix warnings v2: address comments by Lars-Peter Clausen * buffer allocation now in update_scan_mode instead of in trigger handler * simplify trigger code (assume active_scan_mask is not empty, use for_each_set_bit, use iio_push_to_buffer) * reorder entry in Makefile and Kconfig * fix remove Signed-off-by: Peter Meerwald Signed-off-by: Jonathan Cameron diff --git a/drivers/iio/light/Kconfig b/drivers/iio/light/Kconfig index f3ea90d..91d15d2 100644 --- a/drivers/iio/light/Kconfig +++ b/drivers/iio/light/Kconfig @@ -3,6 +3,18 @@ # menu "Light sensors" +config ADJD_S311 + tristate "ADJD-S311-CR999 digital color sensor" + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + depends on I2C + help + If you say yes here you get support for the Avago ADJD-S311-CR999 + digital color light sensor. + + This driver can also be built as a module. If so, the module + will be called adjd_s311. + config SENSORS_LM3533 tristate "LM3533 ambient light sensor" depends on MFD_LM3533 diff --git a/drivers/iio/light/Makefile b/drivers/iio/light/Makefile index 06fa4d3..13f8a78 100644 --- a/drivers/iio/light/Makefile +++ b/drivers/iio/light/Makefile @@ -2,5 +2,6 @@ # Makefile for IIO Light sensors # +obj-$(CONFIG_ADJD_S311) += adjd_s311.o obj-$(CONFIG_SENSORS_LM3533) += lm3533-als.o obj-$(CONFIG_VCNL4000) += vcnl4000.o diff --git a/drivers/iio/light/adjd_s311.c b/drivers/iio/light/adjd_s311.c new file mode 100644 index 0000000..e485142 --- /dev/null +++ b/drivers/iio/light/adjd_s311.c @@ -0,0 +1,364 @@ +/* + * adjd_s311.c - Support for ADJD-S311-CR999 digital color sensor + * + * Copyright (C) 2012 Peter Meerwald + * + * This file is subject to the terms and conditions of version 2 of + * the GNU General Public License. See the file COPYING in the main + * directory of this archive for more details. + * + * driver for ADJD-S311-CR999 digital color sensor (10-bit channels for + * red, green, blue, clear); 7-bit I2C slave address 0x74 + * + * limitations: no calibration, no offset mode, no sleep mode + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#define ADJD_S311_DRV_NAME "adjd_s311" + +#define ADJD_S311_CTRL 0x00 +#define ADJD_S311_CONFIG 0x01 +#define ADJD_S311_CAP_RED 0x06 +#define ADJD_S311_CAP_GREEN 0x07 +#define ADJD_S311_CAP_BLUE 0x08 +#define ADJD_S311_CAP_CLEAR 0x09 +#define ADJD_S311_INT_RED_LO 0x0a +#define ADJD_S311_INT_RED_HI 0x0b +#define ADJD_S311_INT_GREEN_LO 0x0c +#define ADJD_S311_INT_GREEN_HI 0x0d +#define ADJD_S311_INT_BLUE_LO 0x0e +#define ADJD_S311_INT_BLUE_HI 0x0f +#define ADJD_S311_INT_CLEAR_LO 0x10 +#define ADJD_S311_INT_CLEAR_HI 0x11 +#define ADJD_S311_DATA_RED_LO 0x40 +#define ADJD_S311_DATA_RED_HI 0x41 +#define ADJD_S311_DATA_GREEN_LO 0x42 +#define ADJD_S311_DATA_GREEN_HI 0x43 +#define ADJD_S311_DATA_BLUE_LO 0x44 +#define ADJD_S311_DATA_BLUE_HI 0x45 +#define ADJD_S311_DATA_CLEAR_LO 0x46 +#define ADJD_S311_DATA_CLEAR_HI 0x47 +#define ADJD_S311_OFFSET_RED 0x48 +#define ADJD_S311_OFFSET_GREEN 0x49 +#define ADJD_S311_OFFSET_BLUE 0x4a +#define ADJD_S311_OFFSET_CLEAR 0x4b + +#define ADJD_S311_CTRL_GOFS 0x02 +#define ADJD_S311_CTRL_GSSR 0x01 +#define ADJD_S311_CAP_MASK 0x0f +#define ADJD_S311_INT_MASK 0x0fff +#define ADJD_S311_DATA_MASK 0x03ff + +struct adjd_s311_data { + struct i2c_client *client; + u16 *buffer; +}; + +enum adjd_s311_channel_idx { + IDX_RED, IDX_GREEN, IDX_BLUE, IDX_CLEAR +}; + +#define ADJD_S311_DATA_REG(chan) (ADJD_S311_DATA_RED_LO + (chan) * 2) +#define ADJD_S311_INT_REG(chan) (ADJD_S311_INT_RED_LO + (chan) * 2) +#define ADJD_S311_CAP_REG(chan) (ADJD_S311_CAP_RED + (chan)) + +static int adjd_s311_req_data(struct iio_dev *indio_dev) +{ + struct adjd_s311_data *data = iio_priv(indio_dev); + int tries = 10; + + int ret = i2c_smbus_write_byte_data(data->client, ADJD_S311_CTRL, + ADJD_S311_CTRL_GSSR); + if (ret < 0) + return ret; + + while (tries--) { + ret = i2c_smbus_read_byte_data(data->client, ADJD_S311_CTRL); + if (ret < 0) + return ret; + if (!(ret & ADJD_S311_CTRL_GSSR)) + break; + msleep(20); + } + + if (tries < 0) { + dev_err(&data->client->dev, + "adjd_s311_req_data() failed, data not ready\n"); + return -EIO; + } + + return 0; +} + +static int adjd_s311_read_data(struct iio_dev *indio_dev, u8 reg, int *val) +{ + struct adjd_s311_data *data = iio_priv(indio_dev); + + int ret = adjd_s311_req_data(indio_dev); + if (ret < 0) + return ret; + + ret = i2c_smbus_read_word_data(data->client, reg); + if (ret < 0) + return ret; + + *val = ret & ADJD_S311_DATA_MASK; + + return 0; +} + +static ssize_t adjd_s311_read_int_time(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, char *buf) +{ + struct adjd_s311_data *data = iio_priv(indio_dev); + s32 ret; + + ret = i2c_smbus_read_word_data(data->client, + ADJD_S311_INT_REG(chan->address)); + if (ret < 0) + return ret; + + return sprintf(buf, "%d\n", ret & ADJD_S311_INT_MASK); +} + +static ssize_t adjd_s311_write_int_time(struct iio_dev *indio_dev, + uintptr_t private, const struct iio_chan_spec *chan, const char *buf, + size_t len) +{ + struct adjd_s311_data *data = iio_priv(indio_dev); + unsigned long int_time; + int ret; + + ret = kstrtoul(buf, 10, &int_time); + if (ret) + return ret; + + if (int_time > ADJD_S311_INT_MASK) + return -EINVAL; + + ret = i2c_smbus_write_word_data(data->client, + ADJD_S311_INT_REG(chan->address), int_time); + if (ret < 0) + return ret; + + return len; +} + +static irqreturn_t adjd_s311_trigger_handler(int irq, void *p) +{ + struct iio_poll_func *pf = p; + struct iio_dev *indio_dev = pf->indio_dev; + struct adjd_s311_data *data = iio_priv(indio_dev); + struct iio_buffer *buffer = indio_dev->buffer; + s64 time_ns = iio_get_time_ns(); + int len = 0; + int i, j = 0; + + int ret = adjd_s311_req_data(indio_dev); + if (ret < 0) + goto done; + + for_each_set_bit(i, indio_dev->active_scan_mask, + indio_dev->masklength) { + ret = i2c_smbus_read_word_data(data->client, + ADJD_S311_DATA_REG(i)); + if (ret < 0) + goto done; + + data->buffer[j++] = ret & ADJD_S311_DATA_MASK; + len += 2; + } + + if (indio_dev->scan_timestamp) + *(s64 *)((phys_addr_t)data->buffer + ALIGN(len, sizeof(s64))) + = time_ns; + iio_push_to_buffer(buffer, (u8 *)data->buffer, time_ns); + +done: + iio_trigger_notify_done(indio_dev->trig); + + return IRQ_HANDLED; +} + +static const struct iio_chan_spec_ext_info adjd_s311_ext_info[] = { + { + .name = "integration_time", + .read = adjd_s311_read_int_time, + .write = adjd_s311_write_int_time, + }, + { } +}; + +#define ADJD_S311_CHANNEL(_color, _scan_idx) { \ + .type = IIO_INTENSITY, \ + .modified = 1, \ + .address = (IDX_##_color), \ + .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ + IIO_CHAN_INFO_HARDWAREGAIN_SEPARATE_BIT, \ + .channel2 = (IIO_MOD_LIGHT_##_color), \ + .scan_index = (_scan_idx), \ + .scan_type = IIO_ST('u', 10, 16, 0), \ + .ext_info = adjd_s311_ext_info, \ +} + +static const struct iio_chan_spec adjd_s311_channels[] = { + ADJD_S311_CHANNEL(RED, 0), + ADJD_S311_CHANNEL(GREEN, 1), + ADJD_S311_CHANNEL(BLUE, 2), + ADJD_S311_CHANNEL(CLEAR, 3), + IIO_CHAN_SOFT_TIMESTAMP(4), +}; + +static int adjd_s311_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, int *val2, long mask) +{ + struct adjd_s311_data *data = iio_priv(indio_dev); + int ret; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + ret = adjd_s311_read_data(indio_dev, chan->address, val); + if (ret < 0) + return ret; + return IIO_VAL_INT; + case IIO_CHAN_INFO_HARDWAREGAIN: + ret = i2c_smbus_read_byte_data(data->client, + ADJD_S311_CAP_REG(chan->address)); + if (ret < 0) + return ret; + *val = ret & ADJD_S311_CAP_MASK; + return IIO_VAL_INT; + } + return -EINVAL; +} + +static int adjd_s311_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int val, int val2, long mask) +{ + struct adjd_s311_data *data = iio_priv(indio_dev); + int ret; + + switch (mask) { + case IIO_CHAN_INFO_HARDWAREGAIN: + if (val < 0 || val > ADJD_S311_CAP_MASK) + return -EINVAL; + + ret = i2c_smbus_write_byte_data(data->client, + ADJD_S311_CAP_REG(chan->address), val); + return ret; + } + return -EINVAL; +} + +static int adjd_s311_update_scan_mode(struct iio_dev *indio_dev, + const unsigned long *scan_mask) +{ + struct adjd_s311_data *data = iio_priv(indio_dev); + data->buffer = krealloc(data->buffer, indio_dev->scan_bytes, + GFP_KERNEL); + if (!data->buffer) + return -ENOMEM; + + return 0; +} + +static const struct iio_info adjd_s311_info = { + .read_raw = adjd_s311_read_raw, + .write_raw = adjd_s311_write_raw, + .update_scan_mode = adjd_s311_update_scan_mode, + .driver_module = THIS_MODULE, +}; + +static int __devinit adjd_s311_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct adjd_s311_data *data; + struct iio_dev *indio_dev; + int err; + + indio_dev = iio_device_alloc(sizeof(*data)); + if (indio_dev == NULL) { + err = -ENOMEM; + goto exit; + } + data = iio_priv(indio_dev); + i2c_set_clientdata(client, indio_dev); + data->client = client; + + indio_dev->dev.parent = &client->dev; + indio_dev->info = &adjd_s311_info; + indio_dev->name = ADJD_S311_DRV_NAME; + indio_dev->channels = adjd_s311_channels; + indio_dev->num_channels = ARRAY_SIZE(adjd_s311_channels); + indio_dev->modes = INDIO_DIRECT_MODE; + + err = iio_triggered_buffer_setup(indio_dev, NULL, + adjd_s311_trigger_handler, NULL); + if (err < 0) + goto exit_free_device; + + err = iio_device_register(indio_dev); + if (err) + goto exit_unreg_buffer; + + dev_info(&client->dev, "ADJD-S311 color sensor registered\n"); + + return 0; + +exit_unreg_buffer: + iio_triggered_buffer_cleanup(indio_dev); +exit_free_device: + iio_device_free(indio_dev); +exit: + return err; +} + +static int __devexit adjd_s311_remove(struct i2c_client *client) +{ + struct iio_dev *indio_dev = i2c_get_clientdata(client); + struct adjd_s311_data *data = iio_priv(indio_dev); + + iio_device_unregister(indio_dev); + iio_triggered_buffer_cleanup(indio_dev); + kfree(data->buffer); + iio_device_free(indio_dev); + + return 0; +} + +static const struct i2c_device_id adjd_s311_id[] = { + { "adjd_s311", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, adjd_s311_id); + +static struct i2c_driver adjd_s311_driver = { + .driver = { + .name = ADJD_S311_DRV_NAME, + }, + .probe = adjd_s311_probe, + .remove = __devexit_p(adjd_s311_remove), + .id_table = adjd_s311_id, +}; +module_i2c_driver(adjd_s311_driver); + +MODULE_AUTHOR("Peter Meerwald "); +MODULE_DESCRIPTION("ADJD-S311 color sensor"); +MODULE_LICENSE("GPL"); -- cgit v0.10.2 From 3879089ba3421bc8136025837b1a532729643371 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 11 Jul 2012 10:28:00 +0100 Subject: staging:iio:max1363: Don't free uninitialized variable It is possible that on one of the error paths we are going to try to free 'rxbuf', even though it has not been allocated yet, which cause the following warning: drivers/staging/iio/adc/max1363_ring.c: In function 'max1363_trigger_handler': drivers/staging/iio/adc/max1363_ring.c:87:7: warning: 'rxbuf' may be used uninitialized in this function Reported-by: Fengguang Wu Signed-off-by: Lars-Peter Clausen diff --git a/drivers/staging/iio/adc/max1363_ring.c b/drivers/staging/iio/adc/max1363_ring.c index bf6b0c2..774ae1b 100644 --- a/drivers/staging/iio/adc/max1363_ring.c +++ b/drivers/staging/iio/adc/max1363_ring.c @@ -74,7 +74,7 @@ static irqreturn_t max1363_trigger_handler(int irq, void *p) else b_sent = i2c_master_recv(st->client, rxbuf, numvals); if (b_sent < 0) - goto done; + goto done_free; time_ns = iio_get_time_ns(); @@ -82,9 +82,10 @@ static irqreturn_t max1363_trigger_handler(int irq, void *p) memcpy(rxbuf + d_size - sizeof(s64), &time_ns, sizeof(time_ns)); iio_push_to_buffer(indio_dev->buffer, rxbuf, time_ns); +done_free: + kfree(rxbuf); done: iio_trigger_notify_done(indio_dev->trig); - kfree(rxbuf); return IRQ_HANDLED; } -- cgit v0.10.2 From 9660ac704ec92ef535bf7c991cb7129b186007a5 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 11 Jul 2012 09:01:00 +0100 Subject: iio: ad5064: Move bus write callbacks to #if protected sections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move the SPI and I2C specific write callbacks to the respective "#if IS_ENABLED(CONFIG_SPI_MASTER)" and "#if IS_ENABLED(CONFIG_I2C)" protected sections of the code. This fixes the following warning which occurs if CONFIG_I2C is not set: drivers/iio/dac/ad5064.c: In function ‘ad5064_i2c_write’: drivers/iio/dac/ad5064.c:132: error: implicit declaration of function ‘i2c_master_send’ And the follwing warning which occurs when CONFIG_SPI_MASTER is not set: drivers/iio/dac/ad5064.c:137: warning: ‘ad5064_spi_write’ defined but not used Reported-by: Randy Dunlap Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c index aa739c4..de2c368 100644 --- a/drivers/iio/dac/ad5064.c +++ b/drivers/iio/dac/ad5064.c @@ -122,25 +122,6 @@ enum ad5064_type { ID_AD5668_2, }; -static int ad5064_i2c_write(struct ad5064_state *st, unsigned int cmd, - unsigned int addr, unsigned int val) -{ - struct i2c_client *i2c = to_i2c_client(st->dev); - - st->data.i2c[0] = (cmd << 4) | addr; - put_unaligned_be16(val, &st->data.i2c[1]); - return i2c_master_send(i2c, st->data.i2c, 3); -} - -static int ad5064_spi_write(struct ad5064_state *st, unsigned int cmd, - unsigned int addr, unsigned int val) -{ - struct spi_device *spi = to_spi_device(st->dev); - - st->data.spi = cpu_to_be32(AD5064_CMD(cmd) | AD5064_ADDR(addr) | val); - return spi_write(spi, &st->data.spi, sizeof(st->data.spi)); -} - static int ad5064_write(struct ad5064_state *st, unsigned int cmd, unsigned int addr, unsigned int val, unsigned int shift) { @@ -533,6 +514,15 @@ static int __devexit ad5064_remove(struct device *dev) #if IS_ENABLED(CONFIG_SPI_MASTER) +static int ad5064_spi_write(struct ad5064_state *st, unsigned int cmd, + unsigned int addr, unsigned int val) +{ + struct spi_device *spi = to_spi_device(st->dev); + + st->data.spi = cpu_to_be32(AD5064_CMD(cmd) | AD5064_ADDR(addr) | val); + return spi_write(spi, &st->data.spi, sizeof(st->data.spi)); +} + static int __devinit ad5064_spi_probe(struct spi_device *spi) { const struct spi_device_id *id = spi_get_device_id(spi); @@ -596,6 +586,16 @@ static inline void ad5064_spi_unregister_driver(void) { } #if IS_ENABLED(CONFIG_I2C) +static int ad5064_i2c_write(struct ad5064_state *st, unsigned int cmd, + unsigned int addr, unsigned int val) +{ + struct i2c_client *i2c = to_i2c_client(st->dev); + + st->data.i2c[0] = (cmd << 4) | addr; + put_unaligned_be16(val, &st->data.i2c[1]); + return i2c_master_send(i2c, st->data.i2c, 3); +} + static int __devinit ad5064_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { -- cgit v0.10.2 From 21fa54e4017fb0ed2107282e6057528ca59b8942 Mon Sep 17 00:00:00 2001 From: Gerard Snitselaar Date: Wed, 11 Jul 2012 05:05:00 +0100 Subject: iio: dac: ad5064: fix section mismatch in ad5064_init() in linux-next ad5064_init() calls ad5064_spi_unregister_driver() which is annotated __exit. Signed-off-by: Gerard Snitselaar Acked-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c index de2c368..eb281a2 100644 --- a/drivers/iio/dac/ad5064.c +++ b/drivers/iio/dac/ad5064.c @@ -572,7 +572,7 @@ static int __init ad5064_spi_register_driver(void) return spi_register_driver(&ad5064_spi_driver); } -static void __exit ad5064_spi_unregister_driver(void) +static void ad5064_spi_unregister_driver(void) { spi_unregister_driver(&ad5064_spi_driver); } -- cgit v0.10.2 From e59b9afecf7ddf52d31d24e800b473f19c23cfe0 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 11 Jul 2012 07:34:00 +0100 Subject: iio: double unlock on error path We should be holding the mutex when we goto error_free_chans. Signed-off-by: Dan Carpenter Signed-off-by: Jonathan Cameron diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index e2aded0..b5afc2f 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c @@ -198,11 +198,12 @@ struct iio_channel *iio_channel_get_all(const char *name) iio_device_get(chans[mapind].indio_dev); mapind++; } - mutex_unlock(&iio_map_list_lock); if (mapind == 0) { ret = -ENODEV; goto error_free_chans; } + mutex_unlock(&iio_map_list_lock); + return chans; error_free_chans: -- cgit v0.10.2 From e0b757ad7f68cef55de6b36d656bd3747b0550d1 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:39:25 -0700 Subject: staging: comedi: rtd520: remove RtdResetBoard macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index cc1371d..0b6da10 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Reset board */ -#define RtdResetBoard(dev) \ - writel(0, devpriv->las0+LAS0_BOARD_RESET) - /* Reset channel gain table read pointer */ #define RtdResetCGT(dev) \ writel(0, devpriv->las0+LAS0_CGT_RESET) @@ -2050,7 +2046,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* initialize board, per RTD spec */ /* also, initialize shadow registers */ - RtdResetBoard(dev); + writel(0, devpriv->las0 + LAS0_BOARD_RESET); udelay(100); /* needed? */ RtdPlxInterruptWrite(dev, 0); RtdInterruptMask(dev, 0); /* and sets shadow */ @@ -2231,7 +2227,7 @@ static void rtd_detach(struct comedi_device *dev) } #endif /* USE_DMA */ if (devpriv->las0) { - RtdResetBoard(dev); + writel(0, devpriv->las0 + LAS0_BOARD_RESET); RtdInterruptMask(dev, 0); RtdInterruptClearMask(dev, ~0); RtdInterruptClear(dev); /* clears bits set by mask */ -- cgit v0.10.2 From a8cb975ffe6fa93dd091de9d08596742f51c9009 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:40:11 -0700 Subject: staging: comedi: rtd520: remove RtdResetCGT macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 0b6da10..ff30253 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Reset channel gain table read pointer */ -#define RtdResetCGT(dev) \ - writel(0, devpriv->las0+LAS0_CGT_RESET) - /* Reset channel gain table read and write pointers */ #define RtdClearCGT(dev) \ writel(0, devpriv->las0+LAS0_CGT_CLEAR) -- cgit v0.10.2 From 67e50c6ce031ab0e2309478c330655cd9c3b98ec Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:40:55 -0700 Subject: staging: comedi: rtd520: remove RtdClearCGT macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index ff30253..781f081 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -407,10 +407,6 @@ struct rtdPrivate { /* Macros to access registers */ /* Reset channel gain table read and write pointers */ -#define RtdClearCGT(dev) \ - writel(0, devpriv->las0+LAS0_CGT_CLEAR) - -/* Reset channel gain table read and write pointers */ #define RtdEnableCGT(dev, v) \ writel((v > 0) ? 1 : 0, devpriv->las0+LAS0_CGT_ENABLE) @@ -797,7 +793,8 @@ static void rtd_load_channelgain_list(struct comedi_device *dev, { if (n_chan > 1) { /* setup channel gain table */ int ii; - RtdClearCGT(dev); + + writel(0, devpriv->las0 + LAS0_CGT_CLEAR); RtdEnableCGT(dev, 1); /* enable table */ for (ii = 0; ii < n_chan; ii++) { RtdWriteCGTable(dev, rtdConvertChanGain(dev, list[ii], @@ -2049,7 +2046,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) RtdInterruptClearMask(dev, ~0); /* and sets shadow */ RtdInterruptClear(dev); /* clears bits set by mask */ RtdInterruptOverrunClear(dev); - RtdClearCGT(dev); + writel(0, devpriv->las0 + LAS0_CGT_CLEAR); RtdAdcClearFifo(dev); RtdDacClearFifo(dev, 0); RtdDacClearFifo(dev, 1); -- cgit v0.10.2 From cfe43ed9d63ed60c223387871e7c980f851e96f6 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:41:29 -0700 Subject: staging: comedi: rtd520: remove RtdEnableCGT macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 781f081..550ebbd 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Reset channel gain table read and write pointers */ -#define RtdEnableCGT(dev, v) \ - writel((v > 0) ? 1 : 0, devpriv->las0+LAS0_CGT_ENABLE) - /* Write channel gain table entry */ #define RtdWriteCGTable(dev, v) \ writel(v, devpriv->las0+LAS0_CGT_WRITE) @@ -795,13 +791,13 @@ static void rtd_load_channelgain_list(struct comedi_device *dev, int ii; writel(0, devpriv->las0 + LAS0_CGT_CLEAR); - RtdEnableCGT(dev, 1); /* enable table */ + writel(1, devpriv->las0 + LAS0_CGT_ENABLE); for (ii = 0; ii < n_chan; ii++) { RtdWriteCGTable(dev, rtdConvertChanGain(dev, list[ii], ii)); } } else { /* just use the channel gain latch */ - RtdEnableCGT(dev, 0); /* disable table, enable latch */ + writel(0, devpriv->las0 + LAS0_CGT_ENABLE); RtdWriteCGLatch(dev, rtdConvertChanGain(dev, list[0], 0)); } } -- cgit v0.10.2 From 3194c5e33131fd4948ad97a8934369a7b2efdd00 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:42:08 -0700 Subject: staging: comedi: rtd520: remove RtdWriteCGTable macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 550ebbd..0467877 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Write channel gain table entry */ -#define RtdWriteCGTable(dev, v) \ - writel(v, devpriv->las0+LAS0_CGT_WRITE) - /* Write Channel Gain Latch */ #define RtdWriteCGLatch(dev, v) \ writel(v, devpriv->las0+LAS0_CGL_WRITE) @@ -793,8 +789,8 @@ static void rtd_load_channelgain_list(struct comedi_device *dev, writel(0, devpriv->las0 + LAS0_CGT_CLEAR); writel(1, devpriv->las0 + LAS0_CGT_ENABLE); for (ii = 0; ii < n_chan; ii++) { - RtdWriteCGTable(dev, rtdConvertChanGain(dev, list[ii], - ii)); + writel(rtdConvertChanGain(dev, list[ii], ii), + devpriv->las0 + LAS0_CGT_WRITE); } } else { /* just use the channel gain latch */ writel(0, devpriv->las0 + LAS0_CGT_ENABLE); -- cgit v0.10.2 From 9b3f95cc39ed9ab637fee93ca86d42ca83d74099 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:42:48 -0700 Subject: staging: comedi: rtd520: remove RtdWriteCGLatch macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 0467877..3a7c030 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Write Channel Gain Latch */ -#define RtdWriteCGLatch(dev, v) \ - writel(v, devpriv->las0+LAS0_CGL_WRITE) - /* Reset ADC FIFO */ #define RtdAdcClearFifo(dev) \ writel(0, devpriv->las0+LAS0_ADC_FIFO_CLEAR) @@ -794,7 +790,8 @@ static void rtd_load_channelgain_list(struct comedi_device *dev, } } else { /* just use the channel gain latch */ writel(0, devpriv->las0 + LAS0_CGT_ENABLE); - RtdWriteCGLatch(dev, rtdConvertChanGain(dev, list[0], 0)); + writel(rtdConvertChanGain(dev, list[0], 0), + devpriv->las0 + LAS0_CGL_WRITE); } } -- cgit v0.10.2 From aa5372b8879e5c0e49728db8ce1b1cafc545caf4 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:43:32 -0700 Subject: staging: comedi: rtd520: remove RtdAdcClearFifo macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 3a7c030..eb46b5b 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Reset ADC FIFO */ -#define RtdAdcClearFifo(dev) \ - writel(0, devpriv->las0+LAS0_ADC_FIFO_CLEAR) - /* Set ADC start conversion source select (write only) */ #define RtdAdcConversionSource(dev, v) \ writel(v, devpriv->las0+LAS0_ADC_CONVERSION) @@ -804,7 +800,7 @@ static int rtd520_probe_fifo_depth(struct comedi_device *dev) static const unsigned limit = 0x2000; unsigned fifo_size = 0; - RtdAdcClearFifo(dev); + writel(0, devpriv->las0 + LAS0_ADC_FIFO_CLEAR); rtd_load_channelgain_list(dev, 1, &chanspec); RtdAdcConversionSource(dev, 0); /* software */ /* convert samples */ @@ -824,7 +820,7 @@ static int rtd520_probe_fifo_depth(struct comedi_device *dev) DRV_NAME); return -EIO; } - RtdAdcClearFifo(dev); + writel(0, devpriv->las0 + LAS0_ADC_FIFO_CLEAR); if (fifo_size != 0x400 && fifo_size != 0x2000) { printk (KERN_INFO "\ncomedi: %s: unexpected fifo size of %i, expected 1024 or 8192.\n", @@ -850,7 +846,7 @@ static int rtd_ai_rinsn(struct comedi_device *dev, int stat; /* clear any old fifo data */ - RtdAdcClearFifo(dev); + writel(0, devpriv->las0 + LAS0_ADC_FIFO_CLEAR); /* write channel to multiplexer and clear channel gain table */ rtd_load_channelgain_list(dev, 1, &insn->chanspec); @@ -1204,7 +1200,7 @@ static irqreturn_t rtd_interrupt(int irq, /* interrupt number (ignored) */ return IRQ_HANDLED; abortTransfer: - RtdAdcClearFifo(dev); /* clears full flag */ + writel(0, devpriv->las0 + LAS0_ADC_FIFO_CLEAR); s->async->events |= COMEDI_CB_ERROR; devpriv->aiCount = 0; /* stop and don't transfer any more */ /* fall into transferDone */ @@ -1495,7 +1491,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) } RtdDma0Reset(dev); /* reset onboard state */ #endif /* USE_DMA */ - RtdAdcClearFifo(dev); /* clear any old data */ + writel(0, devpriv->las0 + LAS0_ADC_FIFO_CLEAR); RtdInterruptOverrunClear(dev); devpriv->intCount = 0; @@ -2036,7 +2032,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) RtdInterruptClear(dev); /* clears bits set by mask */ RtdInterruptOverrunClear(dev); writel(0, devpriv->las0 + LAS0_CGT_CLEAR); - RtdAdcClearFifo(dev); + writel(0, devpriv->las0 + LAS0_ADC_FIFO_CLEAR); RtdDacClearFifo(dev, 0); RtdDacClearFifo(dev, 1); /* clear digital IO fifo */ -- cgit v0.10.2 From 99e3cfc278d8558974ede15f9ddc74d3fd7649eb Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:44:15 -0700 Subject: staging: comedi: rtd520: remove RtdAdcConversionSource macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index eb46b5b..62748b9 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set ADC start conversion source select (write only) */ -#define RtdAdcConversionSource(dev, v) \ - writel(v, devpriv->las0+LAS0_ADC_CONVERSION) - /* Set burst start source select (write only) */ #define RtdBurstStartSource(dev, v) \ writel(v, devpriv->las0+LAS0_BURST_START) @@ -802,7 +798,7 @@ static int rtd520_probe_fifo_depth(struct comedi_device *dev) writel(0, devpriv->las0 + LAS0_ADC_FIFO_CLEAR); rtd_load_channelgain_list(dev, 1, &chanspec); - RtdAdcConversionSource(dev, 0); /* software */ + writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); /* convert samples */ for (i = 0; i < limit; ++i) { unsigned fifo_status; @@ -852,7 +848,7 @@ static int rtd_ai_rinsn(struct comedi_device *dev, rtd_load_channelgain_list(dev, 1, &insn->chanspec); /* set conversion source */ - RtdAdcConversionSource(dev, 0); /* software */ + writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); /* convert n samples */ for (n = 0; n < insn->n; n++) { @@ -1208,7 +1204,7 @@ abortTransfer: transferDone: RtdPacerStopSource(dev, 0); /* stop on SOFTWARE stop */ RtdPacerStop(dev); /* Stop PACER */ - RtdAdcConversionSource(dev, 0); /* software trigger only */ + writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); RtdInterruptMask(dev, 0); /* mask out SAMPLE */ #ifdef USE_DMA if (devpriv->flags & DMA0_ACTIVE) { @@ -1477,7 +1473,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* stop anything currently running */ RtdPacerStopSource(dev, 0); /* stop on SOFTWARE stop */ RtdPacerStop(dev); /* make sure PACER is stopped */ - RtdAdcConversionSource(dev, 0); /* software trigger only */ + writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); RtdInterruptMask(dev, 0); #ifdef USE_DMA if (devpriv->flags & DMA0_ACTIVE) { /* cancel anything running */ @@ -1509,11 +1505,11 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /*DPRINTK ("rtd520: Multi channel setup\n"); */ RtdPacerStartSource(dev, 0); /* software triggers pacer */ RtdBurstStartSource(dev, 1); /* PACER triggers burst */ - RtdAdcConversionSource(dev, 2); /* BURST triggers ADC */ + writel(2, devpriv->las0 + LAS0_ADC_CONVERSION); } else { /* single channel */ /*DPRINTK ("rtd520: single channel setup\n"); */ RtdPacerStartSource(dev, 0); /* software triggers pacer */ - RtdAdcConversionSource(dev, 1); /* PACER triggers ADC */ + writel(1, devpriv->las0 + LAS0_ADC_CONVERSION); } RtdAboutCounter(dev, devpriv->fifoLen / 2 - 1); /* 1/2 FIFO */ @@ -1675,7 +1671,7 @@ static int rtd_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) RtdPacerStopSource(dev, 0); /* stop on SOFTWARE stop */ RtdPacerStop(dev); /* Stop PACER */ - RtdAdcConversionSource(dev, 0); /* software trigger only */ + writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); RtdInterruptMask(dev, 0); devpriv->aiCount = 0; /* stop and don't transfer any more */ #ifdef USE_DMA -- cgit v0.10.2 From 7a3bbeb72f457c823b94a6ea9f5fc3e8e567c311 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:44:49 -0700 Subject: staging: comedi: rtd520: remove RtdBurstStartSource macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 62748b9..26bdcab 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set burst start source select (write only) */ -#define RtdBurstStartSource(dev, v) \ - writel(v, devpriv->las0+LAS0_BURST_START) - /* Set Pacer start source select (write only) */ #define RtdPacerStartSource(dev, v) \ writel(v, devpriv->las0+LAS0_PACER_START) @@ -1504,7 +1500,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (cmd->chanlist_len > 1) { /*DPRINTK ("rtd520: Multi channel setup\n"); */ RtdPacerStartSource(dev, 0); /* software triggers pacer */ - RtdBurstStartSource(dev, 1); /* PACER triggers burst */ + writel(1, devpriv->las0 + LAS0_BURST_START); writel(2, devpriv->las0 + LAS0_ADC_CONVERSION); } else { /* single channel */ /*DPRINTK ("rtd520: single channel setup\n"); */ @@ -1614,7 +1610,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) break; case TRIG_EXT: /* external */ - RtdBurstStartSource(dev, 2); /* EXTERNALy trigger burst */ + writel(2, devpriv->las0 + LAS0_BURST_START); break; default: -- cgit v0.10.2 From f6104e15a57485d571a8a02363f1604d367b742b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:45:22 -0700 Subject: staging: comedi: rtd520: remove RtdPacerStartSource macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 26bdcab..0a92ae5 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set Pacer start source select (write only) */ -#define RtdPacerStartSource(dev, v) \ - writel(v, devpriv->las0+LAS0_PACER_START) - /* Set Pacer stop source select (write only) */ #define RtdPacerStopSource(dev, v) \ writel(v, devpriv->las0+LAS0_PACER_STOP) @@ -1499,12 +1495,12 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* setup the common case and override if needed */ if (cmd->chanlist_len > 1) { /*DPRINTK ("rtd520: Multi channel setup\n"); */ - RtdPacerStartSource(dev, 0); /* software triggers pacer */ + writel(0, devpriv->las0 + LAS0_PACER_START); writel(1, devpriv->las0 + LAS0_BURST_START); writel(2, devpriv->las0 + LAS0_ADC_CONVERSION); } else { /* single channel */ /*DPRINTK ("rtd520: single channel setup\n"); */ - RtdPacerStartSource(dev, 0); /* software triggers pacer */ + writel(0, devpriv->las0 + LAS0_PACER_START); writel(1, devpriv->las0 + LAS0_ADC_CONVERSION); } RtdAboutCounter(dev, devpriv->fifoLen / 2 - 1); /* 1/2 FIFO */ @@ -1588,7 +1584,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) break; case TRIG_EXT: - RtdPacerStartSource(dev, 1); /* EXTERNALy trigger pacer */ + writel(1, devpriv->las0 + LAS0_PACER_START); break; default: -- cgit v0.10.2 From 1d137eb4c989396e7574d5037e2cb531de299daa Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:45:57 -0700 Subject: staging: comedi: rtd520: remove RtdPacerStopSource macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 0a92ae5..6636b26 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set Pacer stop source select (write only) */ -#define RtdPacerStopSource(dev, v) \ - writel(v, devpriv->las0+LAS0_PACER_STOP) - /* Set Pacer clock source select (write only) 0=external 1=internal */ #define RtdPacerClockSource(dev, v) \ writel((v > 0) ? 1 : 0, devpriv->las0+LAS0_PACER_SELECT) @@ -1194,7 +1190,7 @@ abortTransfer: /* fall into transferDone */ transferDone: - RtdPacerStopSource(dev, 0); /* stop on SOFTWARE stop */ + writel(0, devpriv->las0 + LAS0_PACER_STOP); RtdPacerStop(dev); /* Stop PACER */ writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); RtdInterruptMask(dev, 0); /* mask out SAMPLE */ @@ -1463,7 +1459,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) int timer; /* stop anything currently running */ - RtdPacerStopSource(dev, 0); /* stop on SOFTWARE stop */ + writel(0, devpriv->las0 + LAS0_PACER_STOP); RtdPacerStop(dev); /* make sure PACER is stopped */ writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); RtdInterruptMask(dev, 0); @@ -1661,7 +1657,7 @@ static int rtd_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { u16 status; - RtdPacerStopSource(dev, 0); /* stop on SOFTWARE stop */ + writel(0, devpriv->las0 + LAS0_PACER_STOP); RtdPacerStop(dev); /* Stop PACER */ writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); RtdInterruptMask(dev, 0); -- cgit v0.10.2 From 896a64dd6cbea51e18cf5ba43982d781f92c2e59 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:46:37 -0700 Subject: staging: comedi: rtd520: remove RtdPacerClockSource macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 6636b26..ecdc7e4 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set Pacer clock source select (write only) 0=external 1=internal */ -#define RtdPacerClockSource(dev, v) \ - writel((v > 0) ? 1 : 0, devpriv->las0+LAS0_PACER_SELECT) - /* Set sample counter source select (write only) */ #define RtdAdcSampleCounterSource(dev, v) \ writel(v, devpriv->las0+LAS0_ADC_SCNT_SRC) @@ -1544,7 +1540,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->transCount = 0; devpriv->flags &= ~SEND_EOS; } - RtdPacerClockSource(dev, 1); /* use INTERNAL 8Mhz clock source */ + writel(1, devpriv->las0 + LAS0_PACER_SELECT); RtdAboutStopEnable(dev, 1); /* just interrupt, dont stop */ /* BUG??? these look like enumerated values, but they are bit fields */ -- cgit v0.10.2 From e6794a579649c027f2c49d57d28e8422e9f5e4bc Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:47:12 -0700 Subject: staging: comedi: rtd520: remove RtdAdcSampleCounterSource macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index ecdc7e4..0f1ee3f 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set sample counter source select (write only) */ -#define RtdAdcSampleCounterSource(dev, v) \ - writel(v, devpriv->las0+LAS0_ADC_SCNT_SRC) - /* Set Pacer trigger mode select (write only) 0=single cycle, 1=repeat */ #define RtdPacerTriggerMode(dev, v) \ writel((v > 0) ? 1 : 0, devpriv->las0+LAS0_PACER_REPEAT) -- cgit v0.10.2 From c777b2ab2cffab9054e4bf777d6ccc35d18a0c58 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:47:46 -0700 Subject: staging: comedi: rtd520: remove RtdPacerTriggerMode macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 0f1ee3f..f3fea5a 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set Pacer trigger mode select (write only) 0=single cycle, 1=repeat */ -#define RtdPacerTriggerMode(dev, v) \ - writel((v > 0) ? 1 : 0, devpriv->las0+LAS0_PACER_REPEAT) - /* Set About counter stop enable (write only) */ #define RtdAboutStopEnable(dev, v) \ writel((v > 0) ? 1 : 0, devpriv->las0+LAS0_ACNT_STOP_ENABLE) -- cgit v0.10.2 From dcfbb64cc108435ae336f9b44014212a02f6bdf1 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:48:22 -0700 Subject: staging: comedi: rtd520: remove RtdAboutStopEnable macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index f3fea5a..df505a3 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set About counter stop enable (write only) */ -#define RtdAboutStopEnable(dev, v) \ - writel((v > 0) ? 1 : 0, devpriv->las0+LAS0_ACNT_STOP_ENABLE) - /* Set external trigger polarity (write only) 0=positive edge, 1=negative */ #define RtdTriggerPolarity(dev, v) \ writel((v > 0) ? 1 : 0, devpriv->las0+LAS0_ETRG_POLARITY) @@ -1533,7 +1529,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->flags &= ~SEND_EOS; } writel(1, devpriv->las0 + LAS0_PACER_SELECT); - RtdAboutStopEnable(dev, 1); /* just interrupt, dont stop */ + writel(1, devpriv->las0 + LAS0_ACNT_STOP_ENABLE); /* BUG??? these look like enumerated values, but they are bit fields */ -- cgit v0.10.2 From 864663300b2f1b237f042db5952162af851351bf Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:48:58 -0700 Subject: staging: comedi: rtd520: remove RtdTriggerPolarity macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index df505a3..1face98 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set external trigger polarity (write only) 0=positive edge, 1=negative */ -#define RtdTriggerPolarity(dev, v) \ - writel((v > 0) ? 1 : 0, devpriv->las0+LAS0_ETRG_POLARITY) - /* Start single ADC conversion */ #define RtdAdcStart(dev) \ writew(0, devpriv->las0+LAS0_ADC) -- cgit v0.10.2 From 02818bba43fea7d25b09d7b6886ea50c7293fc7e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:49:28 -0700 Subject: staging: comedi: rtd520: remove RtdAdcStart macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 1face98..b76bb75 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Start single ADC conversion */ -#define RtdAdcStart(dev) \ - writew(0, devpriv->las0+LAS0_ADC) - /* Read one ADC data value (12bit (with sign extend) as 16bit) */ /* Note: matches what DMA would get. Actual value >> 3 */ #define RtdAdcFifoGet(dev) \ @@ -771,7 +767,7 @@ static int rtd520_probe_fifo_depth(struct comedi_device *dev) for (i = 0; i < limit; ++i) { unsigned fifo_status; /* trigger conversion */ - RtdAdcStart(dev); + writew(0, devpriv->las0 + LAS0_ADC); udelay(1); fifo_status = RtdFifoStatus(dev); if ((fifo_status & FS_ADC_HEMPTY) == 0) { @@ -822,7 +818,7 @@ static int rtd_ai_rinsn(struct comedi_device *dev, for (n = 0; n < insn->n; n++) { s16 d; /* trigger conversion */ - RtdAdcStart(dev); + writew(0, devpriv->las0 + LAS0_ADC); for (ii = 0; ii < RTD_ADC_TIMEOUT; ++ii) { stat = RtdFifoStatus(dev); -- cgit v0.10.2 From d2e1aebee74622251d032643b0bcd9e68a4b1693 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:50:12 -0700 Subject: staging: comedi: rtd520: remove RtdAdcFifoGet macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'readw'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index b76bb75..b37a281 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,11 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Read one ADC data value (12bit (with sign extend) as 16bit) */ -/* Note: matches what DMA would get. Actual value >> 3 */ -#define RtdAdcFifoGet(dev) \ - readw(devpriv->las1+LAS1_ADC_FIFO) - /* Read two ADC data values (DOESN'T WORK) */ #define RtdAdcFifoGet2(dev) \ readl(devpriv->las1+LAS1_ADC_FIFO) @@ -834,7 +829,7 @@ static int rtd_ai_rinsn(struct comedi_device *dev, } /* read data */ - d = RtdAdcFifoGet(dev); /* get 2s comp value */ + d = readw(devpriv->las1 + LAS1_ADC_FIFO); /*printk ("rtd520: Got 0x%x after %d usec\n", d, ii+1); */ d = d >> 3; /* low 3 bits are marker lines */ if (CHAN_ARRAY_TEST(devpriv->chanBipolar, 0)) @@ -864,7 +859,7 @@ static int ai_read_n(struct comedi_device *dev, struct comedi_subdevice *s, s16 d; if (0 == devpriv->aiCount) { /* done */ - d = RtdAdcFifoGet(dev); /* Read N and discard */ + d = readw(devpriv->las1 + LAS1_ADC_FIFO); continue; } #if 0 @@ -874,7 +869,7 @@ static int ai_read_n(struct comedi_device *dev, struct comedi_subdevice *s, break; } #endif - d = RtdAdcFifoGet(dev); /* get 2s comp value */ + d = readw(devpriv->las1 + LAS1_ADC_FIFO); d = d >> 3; /* low 3 bits are marker lines */ if (CHAN_ARRAY_TEST(devpriv->chanBipolar, s->async->cur_chan)) { @@ -899,7 +894,7 @@ static int ai_read_dregs(struct comedi_device *dev, struct comedi_subdevice *s) { while (RtdFifoStatus(dev) & FS_ADC_NOT_EMPTY) { /* 1 -> not empty */ short sample; - s16 d = RtdAdcFifoGet(dev); /* get 2s comp value */ + s16 d = readw(devpriv->las1 + LAS1_ADC_FIFO); if (0 == devpriv->aiCount) { /* done */ continue; /* read rest */ -- cgit v0.10.2 From ba5478e6e0e938ec68cb3f6daa0b3cfc7869d638 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:50:45 -0700 Subject: staging: comedi: rtd520: remove RtdAdcFifoGet2 macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used and the comment says it does not work. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index b37a281..8e9265d 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Read two ADC data values (DOESN'T WORK) */ -#define RtdAdcFifoGet2(dev) \ - readl(devpriv->las1+LAS1_ADC_FIFO) - /* FIFO status */ #define RtdFifoStatus(dev) \ readl(devpriv->las0+LAS0_ADC) -- cgit v0.10.2 From 0eecf787f3cf0f805e0d12ee14956225c7d26d6a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:51:16 -0700 Subject: staging: comedi: rtd520: remove RtdFifoStatus macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'readl'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 8e9265d..3b44776 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* FIFO status */ -#define RtdFifoStatus(dev) \ - readl(devpriv->las0+LAS0_ADC) - /* pacer start/stop read=start, write=stop*/ #define RtdPacerStart(dev) \ readl(devpriv->las0+LAS0_PACER) @@ -760,7 +756,7 @@ static int rtd520_probe_fifo_depth(struct comedi_device *dev) /* trigger conversion */ writew(0, devpriv->las0 + LAS0_ADC); udelay(1); - fifo_status = RtdFifoStatus(dev); + fifo_status = readl(devpriv->las0 + LAS0_ADC); if ((fifo_status & FS_ADC_HEMPTY) == 0) { fifo_size = 2 * i; break; @@ -812,7 +808,7 @@ static int rtd_ai_rinsn(struct comedi_device *dev, writew(0, devpriv->las0 + LAS0_ADC); for (ii = 0; ii < RTD_ADC_TIMEOUT; ++ii) { - stat = RtdFifoStatus(dev); + stat = readl(devpriv->las0 + LAS0_ADC); if (stat & FS_ADC_NOT_EMPTY) /* 1 -> not empty */ break; WAIT_QUIETLY; @@ -859,7 +855,7 @@ static int ai_read_n(struct comedi_device *dev, struct comedi_subdevice *s, continue; } #if 0 - if (0 == (RtdFifoStatus(dev) & FS_ADC_NOT_EMPTY)) { /* DEBUG */ + if (!(readl(devpriv->las0 + LAS0_ADC) & FS_ADC_NOT_EMPTY)) { DPRINTK("comedi: READ OOPS on %d of %d\n", ii + 1, count); break; @@ -888,7 +884,7 @@ static int ai_read_n(struct comedi_device *dev, struct comedi_subdevice *s, */ static int ai_read_dregs(struct comedi_device *dev, struct comedi_subdevice *s) { - while (RtdFifoStatus(dev) & FS_ADC_NOT_EMPTY) { /* 1 -> not empty */ + while (readl(devpriv->las0 + LAS0_ADC) & FS_ADC_NOT_EMPTY) { short sample; s16 d = readw(devpriv->las1 + LAS1_ADC_FIFO); @@ -1048,7 +1044,7 @@ static irqreturn_t rtd_interrupt(int irq, /* interrupt number (ignored) */ devpriv->intCount++; /* DEBUG statistics */ - fifoStatus = RtdFifoStatus(dev); + fifoStatus = readl(devpriv->las0 + LAS0_ADC); /* check for FIFO full, this automatically halts the ADC! */ if (!(fifoStatus & FS_ADC_NOT_FULL)) { /* 0 -> full */ DPRINTK("rtd520: FIFO full! fifo_status=0x%x\n", (fifoStatus ^ 0x6666) & 0x7777); /* should be all 0s */ @@ -1176,7 +1172,7 @@ transferDone: #endif /* USE_DMA */ if (devpriv->aiCount > 0) { /* there shouldn't be anything left */ - fifoStatus = RtdFifoStatus(dev); + fifoStatus = readl(devpriv->las0 + LAS0_ADC); DPRINTK("rtd520: Finishing up. %ld remain, fifoStat=%x\n", devpriv->aiCount, (fifoStatus ^ 0x6666) & 0x7777); /* should read all 0s */ ai_read_dregs(dev, s); /* read anything left in FIFO */ } @@ -1189,7 +1185,7 @@ transferDone: RtdInterruptClearMask(dev, status); RtdInterruptClear(dev); - fifoStatus = RtdFifoStatus(dev); /* DEBUG */ + fifoStatus = readl(devpriv->las0 + LAS0_ADC); DPRINTK ("rtd520: Acquisition complete. %ld ints, intStat=%x, overStat=%x\n", devpriv->intCount, status, @@ -1687,7 +1683,7 @@ static int rtd_ao_winsn(struct comedi_device *dev, devpriv->aoValue[chan] = data[i]; /* save for read back */ for (ii = 0; ii < RTD_DAC_TIMEOUT; ++ii) { - stat = RtdFifoStatus(dev); + stat = readl(devpriv->las0 + LAS0_ADC); /* 1 -> not empty */ if (stat & ((0 == chan) ? FS_DAC1_NOT_EMPTY : FS_DAC2_NOT_EMPTY)) -- cgit v0.10.2 From 18e18ddded6bbcefb0a1b0a4d111bd3aef661b7b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:51:46 -0700 Subject: staging: comedi: rtd520: remove RtdPacerStart macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'readl'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 3b44776..190f287 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -407,8 +407,6 @@ struct rtdPrivate { /* Macros to access registers */ /* pacer start/stop read=start, write=stop*/ -#define RtdPacerStart(dev) \ - readl(devpriv->las0+LAS0_PACER) #define RtdPacerStop(dev) \ writel(0, devpriv->las0+LAS0_PACER) @@ -1609,7 +1607,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* BUG: start_src is ASSUMED to be TRIG_NOW */ /* BUG? it seems like things are running before the "start" */ - RtdPacerStart(dev); /* Start PACER */ + readl(devpriv->las0 + LAS0_PACER); return 0; } -- cgit v0.10.2 From 5d4a93438d9b0a97ca670f73ee77122279e6f1ac Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:52:14 -0700 Subject: staging: comedi: rtd520: remove RtdPacerStop macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 190f287..5fca77b 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* pacer start/stop read=start, write=stop*/ -#define RtdPacerStop(dev) \ - writel(0, devpriv->las0+LAS0_PACER) - /* Interrupt status */ #define RtdInterruptStatus(dev) \ readw(devpriv->las0+LAS0_IT) @@ -1152,7 +1148,7 @@ abortTransfer: transferDone: writel(0, devpriv->las0 + LAS0_PACER_STOP); - RtdPacerStop(dev); /* Stop PACER */ + writel(0, devpriv->las0 + LAS0_PACER); writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); RtdInterruptMask(dev, 0); /* mask out SAMPLE */ #ifdef USE_DMA @@ -1421,7 +1417,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* stop anything currently running */ writel(0, devpriv->las0 + LAS0_PACER_STOP); - RtdPacerStop(dev); /* make sure PACER is stopped */ + writel(0, devpriv->las0 + LAS0_PACER); writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); RtdInterruptMask(dev, 0); #ifdef USE_DMA @@ -1619,7 +1615,7 @@ static int rtd_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) u16 status; writel(0, devpriv->las0 + LAS0_PACER_STOP); - RtdPacerStop(dev); /* Stop PACER */ + writel(0, devpriv->las0 + LAS0_PACER); writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); RtdInterruptMask(dev, 0); devpriv->aiCount = 0; /* stop and don't transfer any more */ -- cgit v0.10.2 From 732941ad7f93700f79371bfdf8ec1c521a7c7d54 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:52:45 -0700 Subject: staging: comedi: rtd520: remove RtdInterruptStatus macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'readw'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 5fca77b..c3810ea 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Interrupt status */ -#define RtdInterruptStatus(dev) \ - readw(devpriv->las0+LAS0_IT) - /* Interrupt mask */ #define RtdInterruptMask(dev, v) \ writew((devpriv->intMask = (v)), devpriv->las0+LAS0_IT) @@ -1078,7 +1074,7 @@ static irqreturn_t rtd_interrupt(int irq, /* interrupt number (ignored) */ /* Fall through and check for other interrupt sources */ #endif /* USE_DMA */ - status = RtdInterruptStatus(dev); + status = readw(devpriv->las0 + LAS0_IT); /* if interrupt was not caused by our board, or handled above */ if (0 == status) return IRQ_HANDLED; @@ -1175,7 +1171,7 @@ transferDone: comedi_event(dev, s); /* clear the interrupt */ - status = RtdInterruptStatus(dev); + status = readw(devpriv->las0 + LAS0_IT); RtdInterruptClearMask(dev, status); RtdInterruptClear(dev); @@ -1627,7 +1623,7 @@ static int rtd_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->flags &= ~DMA0_ACTIVE; } #endif /* USE_DMA */ - status = RtdInterruptStatus(dev); + status = readw(devpriv->las0 + LAS0_IT); DPRINTK ("rtd520: Acquisition canceled. %ld ints, intStat=%x, overStat=%x\n", devpriv->intCount, status, -- cgit v0.10.2 From acef7c0fc69cfa6ecea7624e36b2e9037cdd5866 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:53:15 -0700 Subject: staging: comedi: rtd520: remove RtdInterruptMask macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writew'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index c3810ea..74ababc 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Interrupt mask */ -#define RtdInterruptMask(dev, v) \ - writew((devpriv->intMask = (v)), devpriv->las0+LAS0_IT) - /* Interrupt status clear (only bits set in mask) */ #define RtdInterruptClear(dev) \ readw(devpriv->las0+LAS0_CLEAR) @@ -1146,7 +1142,8 @@ transferDone: writel(0, devpriv->las0 + LAS0_PACER_STOP); writel(0, devpriv->las0 + LAS0_PACER); writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); - RtdInterruptMask(dev, 0); /* mask out SAMPLE */ + devpriv->intMask = 0; + writew(devpriv->intMask, devpriv->las0 + LAS0_IT); #ifdef USE_DMA if (devpriv->flags & DMA0_ACTIVE) { RtdPlxInterruptWrite(dev, /* disable any more interrupts */ @@ -1415,7 +1412,8 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) writel(0, devpriv->las0 + LAS0_PACER_STOP); writel(0, devpriv->las0 + LAS0_PACER); writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); - RtdInterruptMask(dev, 0); + devpriv->intMask = 0; + writew(devpriv->intMask, devpriv->las0 + LAS0_IT); #ifdef USE_DMA if (devpriv->flags & DMA0_ACTIVE) { /* cancel anything running */ RtdPlxInterruptWrite(dev, /* disable any more interrupts */ @@ -1571,7 +1569,8 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* TODO: allow multiple interrupt sources */ if (devpriv->transCount > 0) { /* transfer every N samples */ - RtdInterruptMask(dev, IRQM_ADC_ABOUT_CNT); + devpriv->intMask = IRQM_ADC_ABOUT_CNT; + writew(devpriv->intMask, devpriv->las0 + LAS0_IT); DPRINTK("rtd520: Transferring every %d\n", devpriv->transCount); } else { /* 1/2 FIFO transfers */ #ifdef USE_DMA @@ -1592,7 +1591,8 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) DPRINTK("rtd520: Using DMA0 transfers. plxInt %x RtdInt %x\n", RtdPlxInterruptRead(dev), devpriv->intMask); #else /* USE_DMA */ - RtdInterruptMask(dev, IRQM_ADC_ABOUT_CNT); + devpriv->intMask = IRQM_ADC_ABOUT_CNT; + writew(devpriv->intMask, devpriv->las0 + LAS0_IT); DPRINTK("rtd520: Transferring every 1/2 FIFO\n"); #endif /* USE_DMA */ } @@ -1613,7 +1613,8 @@ static int rtd_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) writel(0, devpriv->las0 + LAS0_PACER_STOP); writel(0, devpriv->las0 + LAS0_PACER); writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); - RtdInterruptMask(dev, 0); + devpriv->intMask = 0; + writew(devpriv->intMask, devpriv->las0 + LAS0_IT); devpriv->aiCount = 0; /* stop and don't transfer any more */ #ifdef USE_DMA if (devpriv->flags & DMA0_ACTIVE) { @@ -1964,7 +1965,8 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) writel(0, devpriv->las0 + LAS0_BOARD_RESET); udelay(100); /* needed? */ RtdPlxInterruptWrite(dev, 0); - RtdInterruptMask(dev, 0); /* and sets shadow */ + devpriv->intMask = 0; + writew(devpriv->intMask, devpriv->las0 + LAS0_IT); RtdInterruptClearMask(dev, ~0); /* and sets shadow */ RtdInterruptClear(dev); /* clears bits set by mask */ RtdInterruptOverrunClear(dev); @@ -2143,7 +2145,8 @@ static void rtd_detach(struct comedi_device *dev) #endif /* USE_DMA */ if (devpriv->las0) { writel(0, devpriv->las0 + LAS0_BOARD_RESET); - RtdInterruptMask(dev, 0); + devpriv->intMask = 0; + writew(devpriv->intMask, devpriv->las0 + LAS0_IT); RtdInterruptClearMask(dev, ~0); RtdInterruptClear(dev); /* clears bits set by mask */ } -- cgit v0.10.2 From a2b520b7867c964bb629633c1f909f6ac901f91b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:53:44 -0700 Subject: staging: comedi: rtd520: remove RtdInterruptClear macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'readw'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 74ababc..591091c 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Interrupt status clear (only bits set in mask) */ -#define RtdInterruptClear(dev) \ - readw(devpriv->las0+LAS0_CLEAR) - /* Interrupt clear mask */ #define RtdInterruptClearMask(dev, v) \ writew((devpriv->intClearMask = (v)), devpriv->las0+LAS0_CLEAR) @@ -1129,7 +1125,7 @@ static irqreturn_t rtd_interrupt(int irq, /* interrupt number (ignored) */ /* clear the interrupt */ RtdInterruptClearMask(dev, status); - RtdInterruptClear(dev); + readw(devpriv->las0 + LAS0_CLEAR); return IRQ_HANDLED; abortTransfer: @@ -1170,7 +1166,7 @@ transferDone: /* clear the interrupt */ status = readw(devpriv->las0 + LAS0_IT); RtdInterruptClearMask(dev, status); - RtdInterruptClear(dev); + readw(devpriv->las0 + LAS0_CLEAR); fifoStatus = readl(devpriv->las0 + LAS0_ADC); DPRINTK @@ -1565,7 +1561,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* This doesn't seem to work. There is no way to clear an interrupt that the priority controller has queued! */ RtdInterruptClearMask(dev, ~0); /* clear any existing flags */ - RtdInterruptClear(dev); + readw(devpriv->las0 + LAS0_CLEAR); /* TODO: allow multiple interrupt sources */ if (devpriv->transCount > 0) { /* transfer every N samples */ @@ -1968,7 +1964,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->intMask = 0; writew(devpriv->intMask, devpriv->las0 + LAS0_IT); RtdInterruptClearMask(dev, ~0); /* and sets shadow */ - RtdInterruptClear(dev); /* clears bits set by mask */ + readw(devpriv->las0 + LAS0_CLEAR); RtdInterruptOverrunClear(dev); writel(0, devpriv->las0 + LAS0_CGT_CLEAR); writel(0, devpriv->las0 + LAS0_ADC_FIFO_CLEAR); @@ -2148,7 +2144,7 @@ static void rtd_detach(struct comedi_device *dev) devpriv->intMask = 0; writew(devpriv->intMask, devpriv->las0 + LAS0_IT); RtdInterruptClearMask(dev, ~0); - RtdInterruptClear(dev); /* clears bits set by mask */ + readw(devpriv->las0 + LAS0_CLEAR); } #ifdef USE_DMA /* release DMA */ -- cgit v0.10.2 From 9d8ed35d02c54282eef1f14523aec78551b56e49 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:54:15 -0700 Subject: staging: comedi: rtd520: remove RtdInterruptClearMask macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writew'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 591091c..07260cd 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Interrupt clear mask */ -#define RtdInterruptClearMask(dev, v) \ - writew((devpriv->intClearMask = (v)), devpriv->las0+LAS0_CLEAR) - /* Interrupt overrun status */ #define RtdInterruptOverrunStatus(dev) \ readl(devpriv->las0+LAS0_OVERRUN) @@ -1124,7 +1120,8 @@ static irqreturn_t rtd_interrupt(int irq, /* interrupt number (ignored) */ } /* clear the interrupt */ - RtdInterruptClearMask(dev, status); + devpriv->intClearMask = status; + writew(devpriv->intClearMask, devpriv->las0 + LAS0_CLEAR); readw(devpriv->las0 + LAS0_CLEAR); return IRQ_HANDLED; @@ -1165,7 +1162,8 @@ transferDone: /* clear the interrupt */ status = readw(devpriv->las0 + LAS0_IT); - RtdInterruptClearMask(dev, status); + devpriv->intClearMask = status; + writew(devpriv->intClearMask, devpriv->las0 + LAS0_CLEAR); readw(devpriv->las0 + LAS0_CLEAR); fifoStatus = readl(devpriv->las0 + LAS0_ADC); @@ -1560,7 +1558,8 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* This doesn't seem to work. There is no way to clear an interrupt that the priority controller has queued! */ - RtdInterruptClearMask(dev, ~0); /* clear any existing flags */ + devpriv->intClearMask = ~0; + writew(devpriv->intClearMask, devpriv->las0 + LAS0_CLEAR); readw(devpriv->las0 + LAS0_CLEAR); /* TODO: allow multiple interrupt sources */ @@ -1963,7 +1962,8 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) RtdPlxInterruptWrite(dev, 0); devpriv->intMask = 0; writew(devpriv->intMask, devpriv->las0 + LAS0_IT); - RtdInterruptClearMask(dev, ~0); /* and sets shadow */ + devpriv->intClearMask = ~0; + writew(devpriv->intClearMask, devpriv->las0 + LAS0_CLEAR); readw(devpriv->las0 + LAS0_CLEAR); RtdInterruptOverrunClear(dev); writel(0, devpriv->las0 + LAS0_CGT_CLEAR); @@ -2143,7 +2143,9 @@ static void rtd_detach(struct comedi_device *dev) writel(0, devpriv->las0 + LAS0_BOARD_RESET); devpriv->intMask = 0; writew(devpriv->intMask, devpriv->las0 + LAS0_IT); - RtdInterruptClearMask(dev, ~0); + devpriv->intClearMask = ~0; + writew(devpriv->intClearMask, + devpriv->las0 + LAS0_CLEAR); readw(devpriv->las0 + LAS0_CLEAR); } #ifdef USE_DMA -- cgit v0.10.2 From 4c977b86b123e0ae1da8bf25b00125443fd514c9 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:55:04 -0700 Subject: staging: comedi: rtd520: remove RtdInterruptOverrunStatus macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'readl'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 07260cd..3c501ca 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Interrupt overrun status */ -#define RtdInterruptOverrunStatus(dev) \ - readl(devpriv->las0+LAS0_OVERRUN) - /* Interrupt overrun clear */ #define RtdInterruptOverrunClear(dev) \ writel(0, devpriv->las0+LAS0_OVERRUN) @@ -1013,9 +1009,10 @@ static irqreturn_t rtd_interrupt(int irq, /* interrupt number (ignored) */ void *d) { /* our data *//* cpu context (ignored) */ struct comedi_device *dev = d; /* must be called "dev" for devpriv */ + struct comedi_subdevice *s = dev->subdevices + 0; /* analog in subdevice */ + u32 overrun; u16 status; u16 fifoStatus; - struct comedi_subdevice *s = dev->subdevices + 0; /* analog in subdevice */ if (!dev->attached) return IRQ_NONE; @@ -1112,10 +1109,11 @@ static irqreturn_t rtd_interrupt(int irq, /* interrupt number (ignored) */ DPRINTK("rtd520: unknown interrupt source!\n"); } - if (0xffff & RtdInterruptOverrunStatus(dev)) { /* interrupt overrun */ + overrun = readl(devpriv->las0 + LAS0_OVERRUN) & 0xffff; + if (overrun) { DPRINTK ("rtd520: Interrupt overrun with %ld to go! over_status=0x%x\n", - devpriv->aiCount, 0xffff & RtdInterruptOverrunStatus(dev)); + devpriv->aiCount, overrun); goto abortTransfer; } @@ -1167,10 +1165,10 @@ transferDone: readw(devpriv->las0 + LAS0_CLEAR); fifoStatus = readl(devpriv->las0 + LAS0_ADC); + overrun = readl(devpriv->las0 + LAS0_OVERRUN) & 0xffff; DPRINTK ("rtd520: Acquisition complete. %ld ints, intStat=%x, overStat=%x\n", - devpriv->intCount, status, - 0xffff & RtdInterruptOverrunStatus(dev)); + devpriv->intCount, status, overrun); return IRQ_HANDLED; } @@ -1603,6 +1601,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) */ static int rtd_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { + u32 overrun; u16 status; writel(0, devpriv->las0 + LAS0_PACER_STOP); @@ -1620,10 +1619,10 @@ static int rtd_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) } #endif /* USE_DMA */ status = readw(devpriv->las0 + LAS0_IT); + overrun = readl(devpriv->las0 + LAS0_OVERRUN) & 0xffff; DPRINTK ("rtd520: Acquisition canceled. %ld ints, intStat=%x, overStat=%x\n", - devpriv->intCount, status, - 0xffff & RtdInterruptOverrunStatus(dev)); + devpriv->intCount, status, overrun); return 0; } -- cgit v0.10.2 From 50b0d087f3415f93c02b9c58a1ff50b818f96590 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:55:40 -0700 Subject: staging: comedi: rtd520: remove RtdInterruptOverrunClear macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 3c501ca..b159c2f 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Interrupt overrun clear */ -#define RtdInterruptOverrunClear(dev) \ - writel(0, devpriv->las0+LAS0_OVERRUN) - /* Pacer counter, 24bit */ #define RtdPacerCount(dev) \ readl(devpriv->las0+LAS0_PCLK) @@ -1419,7 +1415,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) RtdDma0Reset(dev); /* reset onboard state */ #endif /* USE_DMA */ writel(0, devpriv->las0 + LAS0_ADC_FIFO_CLEAR); - RtdInterruptOverrunClear(dev); + writel(0, devpriv->las0 + LAS0_OVERRUN); devpriv->intCount = 0; if (!dev->irq) { /* we need interrupts for this */ @@ -1964,7 +1960,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->intClearMask = ~0; writew(devpriv->intClearMask, devpriv->las0 + LAS0_CLEAR); readw(devpriv->las0 + LAS0_CLEAR); - RtdInterruptOverrunClear(dev); + writel(0, devpriv->las0 + LAS0_OVERRUN); writel(0, devpriv->las0 + LAS0_CGT_CLEAR); writel(0, devpriv->las0 + LAS0_ADC_FIFO_CLEAR); RtdDacClearFifo(dev, 0); -- cgit v0.10.2 From 08680c8913149670c84572971321cc06d6c3a208 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:56:12 -0700 Subject: staging: comedi: rtd520: remove RtdPacerCount macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index b159c2f..de4a150 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -407,8 +407,6 @@ struct rtdPrivate { /* Macros to access registers */ /* Pacer counter, 24bit */ -#define RtdPacerCount(dev) \ - readl(devpriv->las0+LAS0_PCLK) #define RtdPacerCounter(dev, v) \ writel((v) & 0xffffff, devpriv->las0+LAS0_PCLK) -- cgit v0.10.2 From 5b8b384dfd6cf5ac1aaae644f99cc5cefc6a3004 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:56:40 -0700 Subject: staging: comedi: rtd520: remove RtdPacerCounter macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index de4a150..7a940b7 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Pacer counter, 24bit */ -#define RtdPacerCounter(dev, v) \ - writel((v) & 0xffffff, devpriv->las0+LAS0_PCLK) - /* Burst counter, 10bit */ #define RtdBurstCount(dev) \ readl(devpriv->las0+LAS0_BCLK) @@ -1512,7 +1508,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) TRIG_ROUND_NEAREST); /* set PACER clock */ /*DPRINTK ("rtd520: loading %d into pacer\n", timer); */ - RtdPacerCounter(dev, timer); + writel(timer & 0xffffff, devpriv->las0 + LAS0_PCLK); break; -- cgit v0.10.2 From 92f336d35223f6f46bd4768f3875d373fc244a76 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:57:14 -0700 Subject: staging: comedi: rtd520: remove RtdBurstCount macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 7a940b7..5f9877a 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -407,8 +407,6 @@ struct rtdPrivate { /* Macros to access registers */ /* Burst counter, 10bit */ -#define RtdBurstCount(dev) \ - readl(devpriv->las0+LAS0_BCLK) #define RtdBurstCounter(dev, v) \ writel((v) & 0x3ff, devpriv->las0+LAS0_BCLK) -- cgit v0.10.2 From 3c4aaead4d048599b31adcc7628fd755d3fa582c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:57:50 -0700 Subject: staging: comedi: rtd520: remove RtdBurstCounter macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 5f9877a..0e3196f 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Burst counter, 10bit */ -#define RtdBurstCounter(dev, v) \ - writel((v) & 0x3ff, devpriv->las0+LAS0_BCLK) - /* Delay counter, 16bit */ #define RtdDelayCount(dev) \ readl(devpriv->las0+LAS0_DCLK) @@ -1527,7 +1523,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) TRIG_ROUND_NEAREST); /* setup BURST clock */ /*DPRINTK ("rtd520: loading %d into burst\n", timer); */ - RtdBurstCounter(dev, timer); + writel(timer & 0x3ff, devpriv->las0 + LAS0_BCLK); } break; -- cgit v0.10.2 From 55b577c94d31233e96e6e14dd92a466067d4bcc9 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:58:19 -0700 Subject: staging: comedi: rtd520: remove RtdDelayCount macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 0e3196f..d0b76a5 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -407,8 +407,6 @@ struct rtdPrivate { /* Macros to access registers */ /* Delay counter, 16bit */ -#define RtdDelayCount(dev) \ - readl(devpriv->las0+LAS0_DCLK) #define RtdDelayCounter(dev, v) \ writel((v) & 0xffff, devpriv->las0+LAS0_DCLK) -- cgit v0.10.2 From 945e398411f76a7ffbecf8905d8a455c403251cf Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:58:47 -0700 Subject: staging: comedi: rtd520: remove RtdDelayCounter macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index d0b76a5..b6e2c3e 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Delay counter, 16bit */ -#define RtdDelayCounter(dev, v) \ - writel((v) & 0xffff, devpriv->las0+LAS0_DCLK) - /* About counter, 16bit */ #define RtdAboutCount(dev) \ readl(devpriv->las0+LAS0_ACNT) -- cgit v0.10.2 From 50399017ea9a27db1133feba86b518562266f924 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:59:16 -0700 Subject: staging: comedi: rtd520: remove RtdAboutCount macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index b6e2c3e..9c0236b 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -407,8 +407,6 @@ struct rtdPrivate { /* Macros to access registers */ /* About counter, 16bit */ -#define RtdAboutCount(dev) \ - readl(devpriv->las0+LAS0_ACNT) #define RtdAboutCounter(dev, v) \ writel((v) & 0xffff, devpriv->las0+LAS0_ACNT) -- cgit v0.10.2 From 06bc659cefefcb9614b766c48d78dc4158ca79e7 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 16:59:46 -0700 Subject: staging: comedi: rtd520: remove RtdAboutCounter macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 9c0236b..87446ec 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* About counter, 16bit */ -#define RtdAboutCounter(dev, v) \ - writel((v) & 0xffff, devpriv->las0+LAS0_ACNT) - /* ADC sample counter, 10bit */ #define RtdAdcSampleCount(dev) \ readl(devpriv->las0+LAS0_ADC_SCNT) @@ -1418,7 +1414,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) writel(0, devpriv->las0 + LAS0_PACER_START); writel(1, devpriv->las0 + LAS0_ADC_CONVERSION); } - RtdAboutCounter(dev, devpriv->fifoLen / 2 - 1); /* 1/2 FIFO */ + writel((devpriv->fifoLen / 2 - 1) & 0xffff, devpriv->las0 + LAS0_ACNT); if (TRIG_TIMER == cmd->scan_begin_src) { /* scan_begin_arg is in nanoseconds */ @@ -1452,7 +1448,8 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->flags &= ~SEND_EOS; } else { /* interrupt for each transfer */ - RtdAboutCounter(dev, devpriv->transCount - 1); + writel((devpriv->transCount - 1) & 0xffff, + devpriv->las0 + LAS0_ACNT); } DPRINTK -- cgit v0.10.2 From cce14cbd7425fc14b8cff4cbc11cfd9f3b6721f5 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:00:20 -0700 Subject: staging: comedi: rtd520: remove RtdAdcSampleCount macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 87446ec..a9ab78b1 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -407,8 +407,6 @@ struct rtdPrivate { /* Macros to access registers */ /* ADC sample counter, 10bit */ -#define RtdAdcSampleCount(dev) \ - readl(devpriv->las0+LAS0_ADC_SCNT) #define RtdAdcSampleCounter(dev, v) \ writel((v) & 0x3ff, devpriv->las0+LAS0_ADC_SCNT) -- cgit v0.10.2 From 3b8e25eeddcd8adb23ee72f09dee1ef644ba6a2a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:00:49 -0700 Subject: staging: comedi: rtd520: remove RtdAdcSampleCounter macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index a9ab78b1..1c53920 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* ADC sample counter, 10bit */ -#define RtdAdcSampleCounter(dev, v) \ - writel((v) & 0x3ff, devpriv->las0+LAS0_ADC_SCNT) - /* User Timer/Counter (8254) */ #define RtdUtcCounterGet(dev, n) \ readb(devpriv->las0 \ -- cgit v0.10.2 From 2bdb728c14919f0ac8b8a14511c383cae55ab199 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:01:17 -0700 Subject: staging: comedi: rtd520: remove RtdUtcCounterGet macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 1c53920..051cc19 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,11 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* User Timer/Counter (8254) */ -#define RtdUtcCounterGet(dev, n) \ - readb(devpriv->las0 \ - + ((n <= 0) ? LAS0_UTC0 : ((1 == n) ? LAS0_UTC1 : LAS0_UTC2))) - #define RtdUtcCounterPut(dev, n, v) \ writeb((v) & 0xff, devpriv->las0 \ + ((n <= 0) ? LAS0_UTC0 : ((1 == n) ? LAS0_UTC1 : LAS0_UTC2))) -- cgit v0.10.2 From 7f24131b9344968be1fd23c66e2f2cc8abebae32 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:01:47 -0700 Subject: staging: comedi: rtd520: remove RtdUtcCounterPut macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 051cc19..21c9291 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -#define RtdUtcCounterPut(dev, n, v) \ - writeb((v) & 0xff, devpriv->las0 \ - + ((n <= 0) ? LAS0_UTC0 : ((1 == n) ? LAS0_UTC1 : LAS0_UTC2))) - /* Set UTC (8254) control byte */ #define RtdUtcCtrlPut(dev, n, v) \ writeb(devpriv->utcCtrl[(n) & 3] = (((n) & 3) << 6) | ((v) & 0x3f), \ -- cgit v0.10.2 From abf39e3f9cf56a5e041585ef7a93ebf270e2ae61 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:02:27 -0700 Subject: staging: comedi: rtd520: remove RtdUtcCtrlPut macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writeb'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 21c9291..2201d11 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,11 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set UTC (8254) control byte */ -#define RtdUtcCtrlPut(dev, n, v) \ - writeb(devpriv->utcCtrl[(n) & 3] = (((n) & 3) << 6) | ((v) & 0x3f), \ - devpriv->las0 + LAS0_UTC_CTRL) - /* Set UTCn clock source (write only) */ #define RtdUtcClockSource(dev, n, v) \ writew(v, devpriv->las0 \ @@ -1929,10 +1924,14 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) RtdDacClearFifo(dev, 1); /* clear digital IO fifo */ RtdDioStatusWrite(dev, 0); /* safe state, set shadow */ - RtdUtcCtrlPut(dev, 0, 0x30); /* safe state, set shadow */ - RtdUtcCtrlPut(dev, 1, 0x30); /* safe state, set shadow */ - RtdUtcCtrlPut(dev, 2, 0x30); /* safe state, set shadow */ - RtdUtcCtrlPut(dev, 3, 0); /* safe state, set shadow */ + devpriv->utcCtrl[0] = (0 << 6) | 0x30; + devpriv->utcCtrl[1] = (1 << 6) | 0x30; + devpriv->utcCtrl[2] = (2 << 6) | 0x30; + devpriv->utcCtrl[3] = (3 << 6) | 0x00; + writeb(devpriv->utcCtrl[0], devpriv->las0 + LAS0_UTC_CTRL); + writeb(devpriv->utcCtrl[1], devpriv->las0 + LAS0_UTC_CTRL); + writeb(devpriv->utcCtrl[2], devpriv->las0 + LAS0_UTC_CTRL); + writeb(devpriv->utcCtrl[3], devpriv->las0 + LAS0_UTC_CTRL); /* TODO: set user out source ??? */ /* check if our interrupt is available and get it */ -- cgit v0.10.2 From 7b15fcc90215d9739307706c7ab23dec49cea57a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:02:58 -0700 Subject: staging: comedi: rtd520: remove RtdUtcClockSource macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 2201d11..c411e60 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,12 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set UTCn clock source (write only) */ -#define RtdUtcClockSource(dev, n, v) \ - writew(v, devpriv->las0 \ - + ((n <= 0) ? LAS0_UTC0_CLOCK : \ - ((1 == n) ? LAS0_UTC1_CLOCK : LAS0_UTC2_CLOCK))) - /* Set UTCn gate source (write only) */ #define RtdUtcGateSource(dev, n, v) \ writew(v, devpriv->las0 \ -- cgit v0.10.2 From b673c49f6fa53c8a9ad40cf0121bda293438e7e9 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:03:32 -0700 Subject: staging: comedi: rtd520: remove RtdUtcGateSource macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index c411e60..5da6930 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,12 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set UTCn gate source (write only) */ -#define RtdUtcGateSource(dev, n, v) \ - writew(v, devpriv->las0 \ - + ((n <= 0) ? LAS0_UTC0_GATE : \ - ((1 == n) ? LAS0_UTC1_GATE : LAS0_UTC2_GATE))) - /* User output N source select (write only) */ #define RtdUsrOutSource(dev, n, v) \ writel(v, devpriv->las0+((n <= 0) ? LAS0_UOUT0_SELECT : \ -- cgit v0.10.2 From db1701246d5c553ed440bcb6ee1b00ed6a975829 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:04:05 -0700 Subject: staging: comedi: rtd520: remove RtdUsrOutSource macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 5da6930..757cebb 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,11 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* User output N source select (write only) */ -#define RtdUsrOutSource(dev, n, v) \ - writel(v, devpriv->las0+((n <= 0) ? LAS0_UOUT0_SELECT : \ - LAS0_UOUT1_SELECT)) - /* Digital IO */ #define RtdDio0Read(dev) \ (readw(devpriv->las0+LAS0_DIO0) & 0xff) -- cgit v0.10.2 From 2b6e6b8042a9f783170b0a15e0550a075381726e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:04:58 -0700 Subject: staging: comedi: rtd520: remove RtdDio0Read macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'readw'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 757cebb..e3a6aa2 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -407,8 +407,6 @@ struct rtdPrivate { /* Macros to access registers */ /* Digital IO */ -#define RtdDio0Read(dev) \ - (readw(devpriv->las0+LAS0_DIO0) & 0xff) #define RtdDio0Write(dev, v) \ writew((v) & 0xff, devpriv->las0+LAS0_DIO0) @@ -1664,7 +1662,7 @@ static int rtd_dio_insn_bits(struct comedi_device *dev, } /* on return, data[1] contains the value of the digital * input lines. */ - data[1] = RtdDio0Read(dev); + data[1] = readw(devpriv->las0 + LAS0_DIO0) & 0xff; /*DPRINTK("rtd520:port_0 wrote: 0x%x read: 0x%x\n", s->state, data[1]); */ -- cgit v0.10.2 From 97271c3bcb83babe81cab0b79b374c7d732eff41 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Fri, 13 Jul 2012 13:04:00 +0100 Subject: staging:iio:adis16260: Fix drvdata inconsistency The SPI drvdata is set to adis16260_state struct in probe(), but assumed to be the iio_dev struct in remove(). Fix this by setting it to the iio_dev in probe(). The issue has been discovered using the following coccinelle patch: // @r1@ type T; T data; expression dev; @@ ( spi_set_drvdata(dev, (void *)data) | spi_set_drvdata(dev, data) ) @r2@ type r1.T; T data; position p; expression dev; @@ data = spi_get_drvdata@p(dev) @depends on r1@ position p != r2.p; expression dev; identifier data; @@ *data = spi_get_drvdata@p(dev) // Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/gyro/adis16260_core.c b/drivers/staging/iio/gyro/adis16260_core.c index f16b393..93aa431 100644 --- a/drivers/staging/iio/gyro/adis16260_core.c +++ b/drivers/staging/iio/gyro/adis16260_core.c @@ -617,7 +617,7 @@ static int __devinit adis16260_probe(struct spi_device *spi) if (pd) st->negate = pd->negate; /* this is only used for removal purposes */ - spi_set_drvdata(spi, st); + spi_set_drvdata(spi, indio_dev); st->us = spi; mutex_init(&st->buf_lock); -- cgit v0.10.2 From 79d2a6bd14b117f140817b7d258a54bb5c963473 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Fri, 13 Jul 2012 13:04:00 +0100 Subject: staging:iio:tsl2x7x: Fix client data inconsistency In probe the I2C client data is set to the iio_dev struct in probe(), but assumed to be the tsl2X7X_chip struct in remove(). Fix this by reading the client data back as iio_dev as well. The issue has been discovered using the following coccinelle patch: // @r1@ type T; T data; expression dev; @@ ( i2c_set_clientdata(dev, (void *)data) | i2c_set_clientdata(dev, data) ) @r2@ type r1.T; T data; position p; expression dev; @@ data = i2c_get_clientdata@p(dev) @depends on r1@ position p != r2.p; expression dev; identifier data; @@ *data = i2c_get_clientdata@p(dev) // Cc: Jon Brenner Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c index fdf75e4..7944686 100644 --- a/drivers/staging/iio/light/tsl2x7x_core.c +++ b/drivers/staging/iio/light/tsl2x7x_core.c @@ -2028,8 +2028,8 @@ static int tsl2x7x_resume(struct device *dev) static int __devexit tsl2x7x_remove(struct i2c_client *client) { - struct tsl2X7X_chip *chip = i2c_get_clientdata(client); - struct iio_dev *indio_dev = iio_priv_to_dev(chip); + struct iio_dev *indio_dev = i2c_get_clientdata(client); + struct tsl2X7X_chip *chip = iio_priv(indio_dev); tsl2x7x_chip_off(indio_dev); -- cgit v0.10.2 From 165d0c52fe87f8a95fcc01391432a659915bd332 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Fri, 13 Jul 2012 13:04:00 +0100 Subject: staging:iio:lpc32xx_adc: Ensure request_irq and free_irq dev_id parameter match The data parameters for request_irq and free_irq have to match, otherwise the IRQ wont be freed. The issue has been discovered using the following coccinelle patch: // @r1@ type T; T data; @@ ( request_irq(..., (void *)data) | request_irq(..., data) | request_threaded_irq(..., (void *)data) | request_threaded_irq(..., data) ) @r2@ type r1.T; T data; position p; @@ ( free_irq@p(..., (void *)data) | free_irq@p(..., data) ) @depends on r1@ position p != r2.p; @@ *free_irq@p(...) // Cc: Roland Stigge Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/adc/lpc32xx_adc.c b/drivers/staging/iio/adc/lpc32xx_adc.c index 9690306..348d051 100644 --- a/drivers/staging/iio/adc/lpc32xx_adc.c +++ b/drivers/staging/iio/adc/lpc32xx_adc.c @@ -196,7 +196,7 @@ static int __devinit lpc32xx_adc_probe(struct platform_device *pdev) return 0; errout5: - free_irq(irq, iodev); + free_irq(irq, info); errout4: clk_put(info->clk); errout3: @@ -214,7 +214,7 @@ static int __devexit lpc32xx_adc_remove(struct platform_device *pdev) int irq = platform_get_irq(pdev, 0); iio_device_unregister(iodev); - free_irq(irq, iodev); + free_irq(irq, info); platform_set_drvdata(pdev, NULL); clk_put(info->clk); iounmap(info->adc_base); -- cgit v0.10.2 From d291d5f692f3fe90de08cea3f1c14ebd80da89ce Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Fri, 13 Jul 2012 13:04:00 +0100 Subject: staging:iio:tsl2x7x: Ensure request_irq and free_irq dev_id parameter match The data parameters for request_irq and free_irq have to match, otherwise the IRQ wont be freed. The issue has been discovered using the following coccinelle patch: // @r1@ type T; T data; @@ ( request_irq(..., (void *)data) | request_irq(..., data) | request_threaded_irq(..., (void *)data) | request_threaded_irq(..., data) ) @r2@ type r1.T; T data; position p; @@ ( free_irq@p(..., (void *)data) | free_irq@p(..., data) ) @depends on r1@ position p != r2.p; @@ *free_irq@p(...) // Cc: Jon Brenner Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c index 7944686..497a977 100644 --- a/drivers/staging/iio/light/tsl2x7x_core.c +++ b/drivers/staging/iio/light/tsl2x7x_core.c @@ -2029,13 +2029,12 @@ static int tsl2x7x_resume(struct device *dev) static int __devexit tsl2x7x_remove(struct i2c_client *client) { struct iio_dev *indio_dev = i2c_get_clientdata(client); - struct tsl2X7X_chip *chip = iio_priv(indio_dev); tsl2x7x_chip_off(indio_dev); iio_device_unregister(indio_dev); if (client->irq) - free_irq(client->irq, chip->client->name); + free_irq(client->irq, indio_dev); iio_device_free(indio_dev); -- cgit v0.10.2 From 795876238f127089d96f268e2639eb0f56ec1a91 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Sat, 14 Jul 2012 17:23:00 +0100 Subject: iio: fix pointer cast warning fix compile warning reported by Fengguang Wu: drivers/iio/light/adjd_s311.c: In function 'adjd_s311_trigger_handler': drivers/iio/light/adjd_s311.c:188:12: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] drivers/iio/light/adjd_s311.c:188:4: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 185 } 186 187 if (indio_dev->scan_timestamp) > 188 *(s64 *)((phys_addr_t)data->buffer + ALIGN(len, sizeof(s64))) 189 = time_ns; 190 iio_push_to_buffer(buffer, (u8 *)data->buffer, time_ns); 191 Signed-off-by: Peter Meerwald Reported-by: Fengguang Wu Signed-off-by: Jonathan Cameron diff --git a/drivers/iio/light/adjd_s311.c b/drivers/iio/light/adjd_s311.c index e485142..1cbb449 100644 --- a/drivers/iio/light/adjd_s311.c +++ b/drivers/iio/light/adjd_s311.c @@ -185,7 +185,7 @@ static irqreturn_t adjd_s311_trigger_handler(int irq, void *p) } if (indio_dev->scan_timestamp) - *(s64 *)((phys_addr_t)data->buffer + ALIGN(len, sizeof(s64))) + *(s64 *)((u8 *)data->buffer + ALIGN(len, sizeof(s64))) = time_ns; iio_push_to_buffer(buffer, (u8 *)data->buffer, time_ns); -- cgit v0.10.2 From be344c84c2d805378f410929b2eb0a538b4206e2 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Sat, 14 Jul 2012 17:23:00 +0100 Subject: iio staging: fix cast warning Signed-off-by: Peter Meerwald Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/iio_simple_dummy_buffer.c b/drivers/staging/iio/iio_simple_dummy_buffer.c index c0951f9..bd628de 100644 --- a/drivers/staging/iio/iio_simple_dummy_buffer.c +++ b/drivers/staging/iio/iio_simple_dummy_buffer.c @@ -85,7 +85,7 @@ static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p) } /* Store the timestamp at an 8 byte aligned offset */ if (indio_dev->scan_timestamp) - *(s64 *)((phys_addr_t)data + ALIGN(len, sizeof(s64))) + *(s64 *)((u8 *)data + ALIGN(len, sizeof(s64))) = iio_get_time_ns(); buffer->access->store_to(buffer, (u8 *)data, pf->timestamp); -- cgit v0.10.2 From dcbc3c414e62faa4e1a1e17421f89eceea6bee30 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Sat, 14 Jul 2012 17:23:00 +0100 Subject: iio staging: fix cast warning and cleanup alignment code Signed-off-by: Peter Meerwald Signed-off-by: Jonathan Cameron diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c index d7f8af7..18d108f 100644 --- a/drivers/staging/iio/accel/lis3l02dq_ring.c +++ b/drivers/staging/iio/accel/lis3l02dq_ring.c @@ -151,8 +151,7 @@ static irqreturn_t lis3l02dq_trigger_handler(int irq, void *p) /* Guaranteed to be aligned with 8 byte boundary */ if (indio_dev->scan_timestamp) - *(s64 *)(((phys_addr_t)data + len - + sizeof(s64) - 1) & ~(sizeof(s64) - 1)) + *(s64 *)((u8 *)data + ALIGN(len, sizeof(s64))) = pf->timestamp; buffer->access->store_to(buffer, (u8 *)data, pf->timestamp); -- cgit v0.10.2 From e91403b2c9dcd4902c31920507293a0bb6e162d0 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:05:27 -0700 Subject: staging: comedi: rtd520: remove RtdDio0Write macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writew'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index e3a6aa2..6640e1b 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Digital IO */ -#define RtdDio0Write(dev, v) \ - writew((v) & 0xff, devpriv->las0+LAS0_DIO0) - #define RtdDio1Read(dev) \ (readw(devpriv->las0+LAS0_DIO1) & 0xff) #define RtdDio1Write(dev, v) \ @@ -1658,7 +1654,7 @@ static int rtd_dio_insn_bits(struct comedi_device *dev, s->state |= data[0] & data[1]; /* Write out the new digital output lines */ - RtdDio0Write(dev, s->state); + writew(s->state & 0xff, devpriv->las0 + LAS0_DIO0); } /* on return, data[1] contains the value of the digital * input lines. */ -- cgit v0.10.2 From 0f4a4dc57d7653a344d25c4035aca3f318a3047e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:05:55 -0700 Subject: staging: comedi: rtd520: remove RtdDio1Read macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 6640e1b..826c01b 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,8 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -#define RtdDio1Read(dev) \ - (readw(devpriv->las0+LAS0_DIO1) & 0xff) #define RtdDio1Write(dev, v) \ writew((v) & 0xff, devpriv->las0+LAS0_DIO1) -- cgit v0.10.2 From 474230ac9cf3db22caa96884176bc99ddb4e3b60 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:06:22 -0700 Subject: staging: comedi: rtd520: remove RtdDio1Write macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 826c01b..452b04b 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,9 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -#define RtdDio1Write(dev, v) \ - writew((v) & 0xff, devpriv->las0+LAS0_DIO1) - #define RtdDioStatusRead(dev) \ (readw(devpriv->las0+LAS0_DIO_STATUS) & 0xff) #define RtdDioStatusWrite(dev, v) \ -- cgit v0.10.2 From add1b4788e33e1b7abb36c68639a8fa1999f23c1 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:06:50 -0700 Subject: staging: comedi: rtd520: remove RtdDioStatusRead macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 452b04b..b7e1322 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,8 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -#define RtdDioStatusRead(dev) \ - (readw(devpriv->las0+LAS0_DIO_STATUS) & 0xff) #define RtdDioStatusWrite(dev, v) \ writew((devpriv->dioStatus = (v)), devpriv->las0+LAS0_DIO_STATUS) -- cgit v0.10.2 From 0bd1164637b14fdd2135494c4b2ee752cc6148f8 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:07:23 -0700 Subject: staging: comedi: rtd520: remove RtdDioStatusWrite macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writew'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index b7e1322..bcf15ae 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,9 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -#define RtdDioStatusWrite(dev, v) \ - writew((devpriv->dioStatus = (v)), devpriv->las0+LAS0_DIO_STATUS) - #define RtdDio0CtrlRead(dev) \ (readw(devpriv->las0+LAS0_DIO0_CTRL) & 0xff) #define RtdDio0CtrlWrite(dev, v) \ @@ -1689,9 +1686,11 @@ static int rtd_dio_insn_config(struct comedi_device *dev, DPRINTK("rtd520: port_0_direction=0x%x (1 means out)\n", s->io_bits); /* TODO support digital match interrupts and strobes */ - RtdDioStatusWrite(dev, 0x01); /* make Dio0Ctrl point to direction */ + devpriv->dioStatus = 0x01; /* set direction */ + writew(devpriv->dioStatus, devpriv->las0 + LAS0_DIO_STATUS); RtdDio0CtrlWrite(dev, s->io_bits); /* set direction 1 means Out */ - RtdDioStatusWrite(dev, 0); /* make Dio0Ctrl clear interrupts */ + devpriv->dioStatus = 0x00; /* clear interrupts */ + writew(devpriv->dioStatus, devpriv->las0 + LAS0_DIO_STATUS); /* port1 can only be all input or all output */ @@ -1893,7 +1892,8 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) RtdDacClearFifo(dev, 0); RtdDacClearFifo(dev, 1); /* clear digital IO fifo */ - RtdDioStatusWrite(dev, 0); /* safe state, set shadow */ + devpriv->dioStatus = 0; + writew(devpriv->dioStatus, devpriv->las0 + LAS0_DIO_STATUS); devpriv->utcCtrl[0] = (0 << 6) | 0x30; devpriv->utcCtrl[1] = (1 << 6) | 0x30; devpriv->utcCtrl[2] = (2 << 6) | 0x30; -- cgit v0.10.2 From d6e3da878313562078c7fc434c3c7f646b33f202 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:07:59 -0700 Subject: staging: comedi: rtd520: remove RtdDio0CtrlRead macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index bcf15ae..b0c5f34 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,8 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -#define RtdDio0CtrlRead(dev) \ - (readw(devpriv->las0+LAS0_DIO0_CTRL) & 0xff) #define RtdDio0CtrlWrite(dev, v) \ writew((v) & 0xff, devpriv->las0+LAS0_DIO0_CTRL) -- cgit v0.10.2 From b0c375a31ca821da57f752d4ded1689182876d02 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:08:29 -0700 Subject: staging: comedi: rtd520: remove RtdDio0CtrlWrite macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writew'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index b0c5f34..e7c550f 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,9 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -#define RtdDio0CtrlWrite(dev, v) \ - writew((v) & 0xff, devpriv->las0+LAS0_DIO0_CTRL) - /* Digital to Analog converter */ /* Write one data value (sign + 12bit + marker bits) */ /* Note: matches what DMA would put. Actual value << 3 */ @@ -1686,7 +1683,7 @@ static int rtd_dio_insn_config(struct comedi_device *dev, /* TODO support digital match interrupts and strobes */ devpriv->dioStatus = 0x01; /* set direction */ writew(devpriv->dioStatus, devpriv->las0 + LAS0_DIO_STATUS); - RtdDio0CtrlWrite(dev, s->io_bits); /* set direction 1 means Out */ + writew(s->io_bits & 0xff, devpriv->las0 + LAS0_DIO0_CTRL); devpriv->dioStatus = 0x00; /* clear interrupts */ writew(devpriv->dioStatus, devpriv->las0 + LAS0_DIO_STATUS); -- cgit v0.10.2 From 5f73c718554a70d27ddcd1f0a62b9731cc35eebd Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:08:59 -0700 Subject: staging: comedi: rtd520: remove RtdDacFifoPut macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writew'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index e7c550f..8ba7877 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,13 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Digital to Analog converter */ -/* Write one data value (sign + 12bit + marker bits) */ -/* Note: matches what DMA would put. Actual value << 3 */ -#define RtdDacFifoPut(dev, n, v) \ - writew((v), devpriv->las1 + (((n) == 0) ? LAS1_DAC1_FIFO : \ - LAS1_DAC2_FIFO)) - /* Start single DAC conversion */ #define RtdDacUpdate(dev, n) \ writew(0, devpriv->las0 + (((n) == 0) ? LAS0_DAC1 : LAS0_DAC2)) @@ -1577,7 +1570,8 @@ static int rtd_ao_winsn(struct comedi_device *dev, chan, range, data[i], val); /* a typical programming sequence */ - RtdDacFifoPut(dev, chan, val); /* put the value in */ + writew(val, devpriv->las1 + + ((chan == 0) ? LAS1_DAC1_FIFO : LAS1_DAC2_FIFO)); RtdDacUpdate(dev, chan); /* trigger the conversion */ devpriv->aoValue[chan] = data[i]; /* save for read back */ -- cgit v0.10.2 From 58f1fde22e3d1faffcc8d0e5b5fa62bd9d9ee5d4 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:09:31 -0700 Subject: staging: comedi: rtd520: remove RtdDacUpdate macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writew'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 8ba7877..e81939c 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Start single DAC conversion */ -#define RtdDacUpdate(dev, n) \ - writew(0, devpriv->las0 + (((n) == 0) ? LAS0_DAC1 : LAS0_DAC2)) - /* Start single DAC conversion on both DACs */ #define RtdDacBothUpdate(dev) \ writew(0, devpriv->las0+LAS0_DAC) @@ -1572,7 +1568,7 @@ static int rtd_ao_winsn(struct comedi_device *dev, /* a typical programming sequence */ writew(val, devpriv->las1 + ((chan == 0) ? LAS1_DAC1_FIFO : LAS1_DAC2_FIFO)); - RtdDacUpdate(dev, chan); /* trigger the conversion */ + writew(0, devpriv->las0 + ((chan == 0) ? LAS0_DAC1 : LAS0_DAC2)); devpriv->aoValue[chan] = data[i]; /* save for read back */ -- cgit v0.10.2 From bb50054f3ecfb8d1e5b2e568db261891bcc2c718 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:09:59 -0700 Subject: staging: comedi: rtd520: remove RtdDacBothUpdate macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index e81939c..ebe74bf 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Start single DAC conversion on both DACs */ -#define RtdDacBothUpdate(dev) \ - writew(0, devpriv->las0+LAS0_DAC) - /* Set DAC output type and range */ #define RtdDacRange(dev, n, v) \ writew((v) & 7, devpriv->las0 \ -- cgit v0.10.2 From 9db311d1c2587bbc6773498636397234bf2b34ad Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:10:27 -0700 Subject: staging: comedi: rtd520: remove RtdDacRange macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writew'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index ebe74bf..8cd056c 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,11 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set DAC output type and range */ -#define RtdDacRange(dev, n, v) \ - writew((v) & 7, devpriv->las0 \ - +(((n) == 0) ? LAS0_DAC1_CTRL : LAS0_DAC2_CTRL)) - /* Reset DAC FIFO */ #define RtdDacClearFifo(dev, n) \ writel(0, devpriv->las0+(((n) == 0) ? LAS0_DAC1_RESET : \ @@ -1538,7 +1533,8 @@ static int rtd_ao_winsn(struct comedi_device *dev, int range = CR_RANGE(insn->chanspec); /* Configure the output range (table index matches the range values) */ - RtdDacRange(dev, chan, range); + writew(range & 7, devpriv->las0 + + ((chan == 0) ? LAS0_DAC1_CTRL : LAS0_DAC2_CTRL)); /* Writing a list of values to an AO channel is probably not * very useful, but that's how the interface is defined. */ -- cgit v0.10.2 From e96eaf898d009aa3f40e615cc4894dfef5d1af9d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:11:01 -0700 Subject: staging: comedi: rtd520: remove RtdDacClearFifo macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 8cd056c..ead8420 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,11 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Reset DAC FIFO */ -#define RtdDacClearFifo(dev, n) \ - writel(0, devpriv->las0+(((n) == 0) ? LAS0_DAC1_RESET : \ - LAS0_DAC2_RESET)) - /* Set source for DMA 0 (write only, shadow?) */ #define RtdDma0Source(dev, n) \ writel((n) & 0xf, devpriv->las0+LAS0_DMA0_SRC) @@ -1866,8 +1861,8 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) writel(0, devpriv->las0 + LAS0_OVERRUN); writel(0, devpriv->las0 + LAS0_CGT_CLEAR); writel(0, devpriv->las0 + LAS0_ADC_FIFO_CLEAR); - RtdDacClearFifo(dev, 0); - RtdDacClearFifo(dev, 1); + writel(0, devpriv->las0 + LAS0_DAC1_RESET); + writel(0, devpriv->las0 + LAS0_DAC2_RESET); /* clear digital IO fifo */ devpriv->dioStatus = 0; writew(devpriv->dioStatus, devpriv->las0 + LAS0_DIO_STATUS); -- cgit v0.10.2 From 70fdb9739d9592ce806fe5bfb4644cd80ef689aa Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:11:29 -0700 Subject: staging: comedi: rtd520: remove RtdDma0Source macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index ead8420..847e98c 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set source for DMA 0 (write only, shadow?) */ -#define RtdDma0Source(dev, n) \ - writel((n) & 0xf, devpriv->las0+LAS0_DMA0_SRC) - /* Set source for DMA 1 (write only, shadow?) */ #define RtdDma1Source(dev, n) \ writel((n) & 0xf, devpriv->las0+LAS0_DMA1_SRC) @@ -1464,7 +1460,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) RtdDma0Mode(dev, DMA_MODE_BITS); RtdDma0Next(dev, /* point to first block */ devpriv->dma0Chain[DMA_CHAIN_COUNT - 1].next); - RtdDma0Source(dev, DMAS_ADFIFO_HALF_FULL); /* set DMA trigger source */ + writel(DMAS_ADFIFO_HALF_FULL, devpriv->las0 + LAS0_DMA0_SRC); RtdPlxInterruptWrite(dev, /* enable interrupt */ RtdPlxInterruptRead(dev) | ICS_DMA0_E); @@ -1961,7 +1957,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) RtdDma0Mode(dev, DMA_MODE_BITS); /* set DMA trigger source */ - RtdDma0Source(dev, DMAS_ADFIFO_HALF_FULL); + writel(DMAS_ADFIFO_HALF_FULL, devpriv->las0 + LAS0_DMA0_SRC); } else { printk(KERN_INFO "( no IRQ->no DMA )"); } -- cgit v0.10.2 From 4be6cd1cf63875092b468b57fbdaae946e93c631 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:11:55 -0700 Subject: staging: comedi: rtd520: remove RtdDma1Source macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 847e98c..783341a 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set source for DMA 1 (write only, shadow?) */ -#define RtdDma1Source(dev, n) \ - writel((n) & 0xf, devpriv->las0+LAS0_DMA1_SRC) - /* Reset board state for DMA 0 */ #define RtdDma0Reset(dev) \ writel(0, devpriv->las0+LAS0_DMA0_RESET) -- cgit v0.10.2 From e141869895906799e8111edab8e88b7bbde0cae1 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:12:22 -0700 Subject: staging: comedi: rtd520: remove RtdDma0Reset macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 783341a..8238fb0 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Reset board state for DMA 0 */ -#define RtdDma0Reset(dev) \ - writel(0, devpriv->las0+LAS0_DMA0_RESET) - /* Reset board state for DMA 1 */ #define RtdDma1Reset(dev) \ writel(0, devpriv->las0+LAS0_DMA1_SRC) @@ -1297,7 +1293,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) RtdDma0Control(dev, PLX_CLEAR_DMA_INTR_BIT); } } - RtdDma0Reset(dev); /* reset onboard state */ + writel(0, devpriv->las0 + LAS0_DMA0_RESET); #endif /* USE_DMA */ writel(0, devpriv->las0 + LAS0_ADC_FIFO_CLEAR); writel(0, devpriv->las0 + LAS0_OVERRUN); -- cgit v0.10.2 From ae9644522438ac6adef4fbd36d16b2da36b15c80 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:12:49 -0700 Subject: staging: comedi: rtd520: remove RtdDma1Reset macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 8238fb0..6d3e4d3 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Reset board state for DMA 1 */ -#define RtdDma1Reset(dev) \ - writel(0, devpriv->las0+LAS0_DMA1_SRC) - /* PLX9080 interrupt mask and status */ #define RtdPlxInterruptRead(dev) \ readl(devpriv->lcfg+LCFG_ITCSR) -- cgit v0.10.2 From 2b20f61cfd8498a76ece155cf4aca6a6bda0aecd Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:13:21 -0700 Subject: staging: comedi: rtd520: remove RtdPlxInterruptRead macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'readl'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 6d3e4d3..486a7fc 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -407,8 +407,6 @@ struct rtdPrivate { /* Macros to access registers */ /* PLX9080 interrupt mask and status */ -#define RtdPlxInterruptRead(dev) \ - readl(devpriv->lcfg+LCFG_ITCSR) #define RtdPlxInterruptWrite(dev, v) \ writel(v, devpriv->lcfg+LCFG_ITCSR) @@ -900,7 +898,7 @@ static irqreturn_t rtd_interrupt(int irq, /* interrupt number (ignored) */ } #ifdef USE_DMA if (devpriv->flags & DMA0_ACTIVE) { /* Check DMA */ - u32 istatus = RtdPlxInterruptRead(dev); + u32 istatus = readl(devpriv->lcfg + LCFG_ITCSR); if (istatus & ICS_DMA0_A) { if (ai_process_dma(dev, s) < 0) { @@ -1010,8 +1008,8 @@ transferDone: writew(devpriv->intMask, devpriv->las0 + LAS0_IT); #ifdef USE_DMA if (devpriv->flags & DMA0_ACTIVE) { - RtdPlxInterruptWrite(dev, /* disable any more interrupts */ - RtdPlxInterruptRead(dev) & ~ICS_DMA0_E); + RtdPlxInterruptWrite(dev, + readl(devpriv->lcfg + LCFG_ITCSR) & ~ICS_DMA0_E); abort_dma(dev, 0); devpriv->flags &= ~DMA0_ACTIVE; /* if Using DMA, then we should have read everything by now */ @@ -1281,13 +1279,12 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) writew(devpriv->intMask, devpriv->las0 + LAS0_IT); #ifdef USE_DMA if (devpriv->flags & DMA0_ACTIVE) { /* cancel anything running */ - RtdPlxInterruptWrite(dev, /* disable any more interrupts */ - RtdPlxInterruptRead(dev) & ~ICS_DMA0_E); + RtdPlxInterruptWrite(dev, + readl(devpriv->lcfg + LCFG_ITCSR) & ~ICS_DMA0_E); abort_dma(dev, 0); devpriv->flags &= ~DMA0_ACTIVE; - if (RtdPlxInterruptRead(dev) & ICS_DMA0_A) { /*clear pending int */ + if (readl(devpriv->lcfg + LCFG_ITCSR) & ICS_DMA0_A) RtdDma0Control(dev, PLX_CLEAR_DMA_INTR_BIT); - } } writel(0, devpriv->las0 + LAS0_DMA0_RESET); #endif /* USE_DMA */ @@ -1449,14 +1446,13 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) RtdDma0Next(dev, /* point to first block */ devpriv->dma0Chain[DMA_CHAIN_COUNT - 1].next); writel(DMAS_ADFIFO_HALF_FULL, devpriv->las0 + LAS0_DMA0_SRC); - - RtdPlxInterruptWrite(dev, /* enable interrupt */ - RtdPlxInterruptRead(dev) | ICS_DMA0_E); + RtdPlxInterruptWrite(dev, + readl(devpriv->lcfg + LCFG_ITCSR) | ICS_DMA0_E); /* Must be 2 steps. See PLX app note about "Starting a DMA transfer" */ RtdDma0Control(dev, PLX_DMA_EN_BIT); /* enable DMA (clear INTR?) */ RtdDma0Control(dev, PLX_DMA_EN_BIT | PLX_DMA_START_BIT); /*start DMA */ DPRINTK("rtd520: Using DMA0 transfers. plxInt %x RtdInt %x\n", - RtdPlxInterruptRead(dev), devpriv->intMask); + readl(devpriv->lcfg + LCFG_ITCSR), devpriv->intMask); #else /* USE_DMA */ devpriv->intMask = IRQM_ADC_ABOUT_CNT; writew(devpriv->intMask, devpriv->las0 + LAS0_IT); @@ -1486,8 +1482,8 @@ static int rtd_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->aiCount = 0; /* stop and don't transfer any more */ #ifdef USE_DMA if (devpriv->flags & DMA0_ACTIVE) { - RtdPlxInterruptWrite(dev, /* disable any more interrupts */ - RtdPlxInterruptRead(dev) & ~ICS_DMA0_E); + RtdPlxInterruptWrite(dev, + readl(devpriv->lcfg + LCFG_ITCSR) & ~ICS_DMA0_E); abort_dma(dev, 0); devpriv->flags &= ~DMA0_ACTIVE; } @@ -1983,9 +1979,9 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) #endif /* USE_DMA */ /* subdevices and priv are freed by the core */ if (dev->irq) { - /* disable interrupt controller */ - RtdPlxInterruptWrite(dev, RtdPlxInterruptRead(dev) - & ~(ICS_PLIE | ICS_DMA0_E | ICS_DMA1_E)); + RtdPlxInterruptWrite(dev, + readl(devpriv->lcfg + LCFG_ITCSR) & + ~(ICS_PLIE | ICS_DMA0_E | ICS_DMA1_E)); free_irq(dev->irq, dev); } @@ -2052,9 +2048,9 @@ static void rtd_detach(struct comedi_device *dev) } #endif /* USE_DMA */ if (dev->irq) { - RtdPlxInterruptWrite(dev, RtdPlxInterruptRead(dev) - & ~(ICS_PLIE | ICS_DMA0_E | - ICS_DMA1_E)); + RtdPlxInterruptWrite(dev, + readl(devpriv->lcfg + LCFG_ITCSR) & + ~(ICS_PLIE | ICS_DMA0_E | ICS_DMA1_E)); free_irq(dev->irq, dev); } if (devpriv->las0) -- cgit v0.10.2 From a5ca947535f3ce07e1fd4510634a34dd65f1eeda Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:13:54 -0700 Subject: staging: comedi: rtd520: remove RtdPlxInterruptWrite macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 486a7fc..202e1d8 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* PLX9080 interrupt mask and status */ -#define RtdPlxInterruptWrite(dev, v) \ - writel(v, devpriv->lcfg+LCFG_ITCSR) - /* Set mode for DMA 0 */ #define RtdDma0Mode(dev, m) \ writel((m), devpriv->lcfg+LCFG_DMAMODE0) @@ -1008,8 +1004,8 @@ transferDone: writew(devpriv->intMask, devpriv->las0 + LAS0_IT); #ifdef USE_DMA if (devpriv->flags & DMA0_ACTIVE) { - RtdPlxInterruptWrite(dev, - readl(devpriv->lcfg + LCFG_ITCSR) & ~ICS_DMA0_E); + writel(readl(devpriv->lcfg + LCFG_ITCSR) & ~ICS_DMA0_E, + devpriv->lcfg + LCFG_ITCSR); abort_dma(dev, 0); devpriv->flags &= ~DMA0_ACTIVE; /* if Using DMA, then we should have read everything by now */ @@ -1279,8 +1275,8 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) writew(devpriv->intMask, devpriv->las0 + LAS0_IT); #ifdef USE_DMA if (devpriv->flags & DMA0_ACTIVE) { /* cancel anything running */ - RtdPlxInterruptWrite(dev, - readl(devpriv->lcfg + LCFG_ITCSR) & ~ICS_DMA0_E); + writel(readl(devpriv->lcfg + LCFG_ITCSR) & ~ICS_DMA0_E, + devpriv->lcfg + LCFG_ITCSR); abort_dma(dev, 0); devpriv->flags &= ~DMA0_ACTIVE; if (readl(devpriv->lcfg + LCFG_ITCSR) & ICS_DMA0_A) @@ -1446,8 +1442,8 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) RtdDma0Next(dev, /* point to first block */ devpriv->dma0Chain[DMA_CHAIN_COUNT - 1].next); writel(DMAS_ADFIFO_HALF_FULL, devpriv->las0 + LAS0_DMA0_SRC); - RtdPlxInterruptWrite(dev, - readl(devpriv->lcfg + LCFG_ITCSR) | ICS_DMA0_E); + writel(readl(devpriv->lcfg + LCFG_ITCSR) | ICS_DMA0_E, + devpriv->lcfg + LCFG_ITCSR); /* Must be 2 steps. See PLX app note about "Starting a DMA transfer" */ RtdDma0Control(dev, PLX_DMA_EN_BIT); /* enable DMA (clear INTR?) */ RtdDma0Control(dev, PLX_DMA_EN_BIT | PLX_DMA_START_BIT); /*start DMA */ @@ -1482,8 +1478,8 @@ static int rtd_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->aiCount = 0; /* stop and don't transfer any more */ #ifdef USE_DMA if (devpriv->flags & DMA0_ACTIVE) { - RtdPlxInterruptWrite(dev, - readl(devpriv->lcfg + LCFG_ITCSR) & ~ICS_DMA0_E); + writel(readl(devpriv->lcfg + LCFG_ITCSR) & ~ICS_DMA0_E, + devpriv->lcfg + LCFG_ITCSR); abort_dma(dev, 0); devpriv->flags &= ~DMA0_ACTIVE; } @@ -1832,7 +1828,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* also, initialize shadow registers */ writel(0, devpriv->las0 + LAS0_BOARD_RESET); udelay(100); /* needed? */ - RtdPlxInterruptWrite(dev, 0); + writel(0, devpriv->lcfg + LCFG_ITCSR); devpriv->intMask = 0; writew(devpriv->intMask, devpriv->las0 + LAS0_IT); devpriv->intClearMask = ~0; @@ -1947,9 +1943,8 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) } #endif /* USE_DMA */ - if (dev->irq) { /* enable plx9080 interrupts */ - RtdPlxInterruptWrite(dev, ICS_PIE | ICS_PLIE); - } + if (dev->irq) + writel(ICS_PIE | ICS_PLIE, devpriv->lcfg + LCFG_ITCSR); printk("\ncomedi%d: rtd520 driver attached.\n", dev->minor); @@ -1979,9 +1974,9 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) #endif /* USE_DMA */ /* subdevices and priv are freed by the core */ if (dev->irq) { - RtdPlxInterruptWrite(dev, - readl(devpriv->lcfg + LCFG_ITCSR) & - ~(ICS_PLIE | ICS_DMA0_E | ICS_DMA1_E)); + writel(readl(devpriv->lcfg + LCFG_ITCSR) & + ~(ICS_PLIE | ICS_DMA0_E | ICS_DMA1_E), + devpriv->lcfg + LCFG_ITCSR); free_irq(dev->irq, dev); } @@ -2014,7 +2009,7 @@ static void rtd_detach(struct comedi_device *dev) if (devpriv->lcfg) { RtdDma0Control(dev, 0); /* disable DMA */ RtdDma1Control(dev, 0); /* disable DMA */ - RtdPlxInterruptWrite(dev, ICS_PIE | ICS_PLIE); + writel(ICS_PIE | ICS_PLIE, devpriv->lcfg + LCFG_ITCSR); } #endif /* USE_DMA */ if (devpriv->las0) { @@ -2048,9 +2043,9 @@ static void rtd_detach(struct comedi_device *dev) } #endif /* USE_DMA */ if (dev->irq) { - RtdPlxInterruptWrite(dev, - readl(devpriv->lcfg + LCFG_ITCSR) & - ~(ICS_PLIE | ICS_DMA0_E | ICS_DMA1_E)); + writel(readl(devpriv->lcfg + LCFG_ITCSR) & + ~(ICS_PLIE | ICS_DMA0_E | ICS_DMA1_E), + devpriv->lcfg + LCFG_ITCSR); free_irq(dev->irq, dev); } if (devpriv->las0) -- cgit v0.10.2 From 9d0f14393ca57bf93ad2a61d802b6265b9f59fe0 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:14:25 -0700 Subject: staging: comedi: rtd520: remove RtdDma0Mode macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 202e1d8..46d892a 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set mode for DMA 0 */ -#define RtdDma0Mode(dev, m) \ - writel((m), devpriv->lcfg+LCFG_DMAMODE0) - /* Set PCI address for DMA 0 */ #define RtdDma0PciAddr(dev, a) \ writel((a), devpriv->lcfg+LCFG_DMAPADR0) @@ -1438,7 +1434,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* point to first transfer in ring */ devpriv->dma0Offset = 0; - RtdDma0Mode(dev, DMA_MODE_BITS); + writel(DMA_MODE_BITS, devpriv->lcfg + LCFG_DMAMODE0); RtdDma0Next(dev, /* point to first block */ devpriv->dma0Chain[DMA_CHAIN_COUNT - 1].next); writel(DMAS_ADFIFO_HALF_FULL, devpriv->las0 + LAS0_DMA0_SRC); @@ -1935,7 +1931,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) goto rtd_attach_die_error; } - RtdDma0Mode(dev, DMA_MODE_BITS); + writel(DMA_MODE_BITS, devpriv->lcfg + LCFG_DMAMODE0); /* set DMA trigger source */ writel(DMAS_ADFIFO_HALF_FULL, devpriv->las0 + LAS0_DMA0_SRC); } else { -- cgit v0.10.2 From 751a8561c0e89851d4ff97ce383ab2c1298bbadc Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:14:55 -0700 Subject: staging: comedi: rtd520: remove RtdDma0PciAddr macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 46d892a..cf5deac 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set PCI address for DMA 0 */ -#define RtdDma0PciAddr(dev, a) \ - writel((a), devpriv->lcfg+LCFG_DMAPADR0) - /* Set local address for DMA 0 */ #define RtdDma0LocalAddr(dev, a) \ writel((a), devpriv->lcfg+LCFG_DMALADR0) -- cgit v0.10.2 From 532b4cdfdb17bcbfe0ed80b9bcb85a0b6f8bc98a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:15:28 -0700 Subject: staging: comedi: rtd520: remove RtdDma0LocalAddr macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index cf5deac..3aa7a39 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set local address for DMA 0 */ -#define RtdDma0LocalAddr(dev, a) \ - writel((a), devpriv->lcfg+LCFG_DMALADR0) - /* Set byte count for DMA 0 */ #define RtdDma0Count(dev, c) \ writel((c), devpriv->lcfg+LCFG_DMASIZ0) -- cgit v0.10.2 From d1def6be0757e6523aeb2967dc82eb8b02f0b3d5 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:17:45 -0700 Subject: staging: comedi: rtd520: remove RtdDma0Count macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 3aa7a39..c3400ea 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set byte count for DMA 0 */ -#define RtdDma0Count(dev, c) \ - writel((c), devpriv->lcfg+LCFG_DMASIZ0) - /* Set next descriptor for DMA 0 */ #define RtdDma0Next(dev, a) \ writel((a), devpriv->lcfg+LCFG_DMADPR0) -- cgit v0.10.2 From b1d4d7d32ae70cb3bedca47a67ac176e0b2863ce Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:18:48 -0700 Subject: staging: comedi: rtd520: remove RtdDma0Next macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writel'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index c3400ea..5296723 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set next descriptor for DMA 0 */ -#define RtdDma0Next(dev, a) \ - writel((a), devpriv->lcfg+LCFG_DMADPR0) - /* Set mode for DMA 1 */ #define RtdDma1Mode(dev, m) \ writel((m), devpriv->lcfg+LCFG_DMAMODE1) @@ -1423,8 +1419,9 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* point to first transfer in ring */ devpriv->dma0Offset = 0; writel(DMA_MODE_BITS, devpriv->lcfg + LCFG_DMAMODE0); - RtdDma0Next(dev, /* point to first block */ - devpriv->dma0Chain[DMA_CHAIN_COUNT - 1].next); + /* point to first block */ + writel(devpriv->dma0Chain[DMA_CHAIN_COUNT - 1].next, + devpriv->lcfg + LCFG_DMADPR0); writel(DMAS_ADFIFO_HALF_FULL, devpriv->las0 + LAS0_DMA0_SRC); writel(readl(devpriv->lcfg + LCFG_ITCSR) | ICS_DMA0_E, devpriv->lcfg + LCFG_ITCSR); -- cgit v0.10.2 From 7b1bb5a2a7f6498ca035e524812a6f9e70a9d9d3 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:19:17 -0700 Subject: staging: comedi: rtd520: remove RtdDma1Mode macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 5296723..ded65aa 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set mode for DMA 1 */ -#define RtdDma1Mode(dev, m) \ - writel((m), devpriv->lcfg+LCFG_DMAMODE1) - /* Set PCI address for DMA 1 */ #define RtdDma1PciAddr(dev, a) \ writel((a), devpriv->lcfg+LCFG_DMAADR1) -- cgit v0.10.2 From 06647cecb6421442f2a005bbe47afb0812db9a1b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:19:49 -0700 Subject: staging: comedi: rtd520: remove RtdDma1PciAddr macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index ded65aa..ef41fcc 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set PCI address for DMA 1 */ -#define RtdDma1PciAddr(dev, a) \ - writel((a), devpriv->lcfg+LCFG_DMAADR1) - /* Set local address for DMA 1 */ #define RtdDma1LocalAddr(dev, a) \ writel((a), devpriv->lcfg+LCFG_DMALADR1) -- cgit v0.10.2 From f1652df06096d1a89fdb1853d942b9c487b1e3ed Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:20:19 -0700 Subject: staging: comedi: rtd520: remove RtdDma1LocalAddr macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index ef41fcc..ca60f95 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set local address for DMA 1 */ -#define RtdDma1LocalAddr(dev, a) \ - writel((a), devpriv->lcfg+LCFG_DMALADR1) - /* Set byte count for DMA 1 */ #define RtdDma1Count(dev, c) \ writel((c), devpriv->lcfg+LCFG_DMASIZ1) -- cgit v0.10.2 From a387a88792c45a64b5094a00b4aa94e0c2b25ce3 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:20:47 -0700 Subject: staging: comedi: rtd520: remove RtdDma1Count macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index ca60f95..95f2b1d 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set byte count for DMA 1 */ -#define RtdDma1Count(dev, c) \ - writel((c), devpriv->lcfg+LCFG_DMASIZ1) - /* Set next descriptor for DMA 1 */ #define RtdDma1Next(dev, a) \ writel((a), devpriv->lcfg+LCFG_DMADPR1) -- cgit v0.10.2 From 879dabbc2ed61bea3f97d7e6aaea8ce2a2a14dd4 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:21:15 -0700 Subject: staging: comedi: rtd520: remove RtdDma1Next macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 95f2b1d..7d12380 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set next descriptor for DMA 1 */ -#define RtdDma1Next(dev, a) \ - writel((a), devpriv->lcfg+LCFG_DMADPR1) - /* Set control for DMA 0 (write only, shadow?) */ #define RtdDma0Control(dev, n) \ writeb(devpriv->dma0Control = (n), devpriv->lcfg+LCFG_DMACSR0) -- cgit v0.10.2 From f5439764e6ca90d72e585d5e13ed1b3f9c6ac6ed Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:21:45 -0700 Subject: staging: comedi: rtd520: remove RtdDma0Control macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writeb'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 7d12380..d92c682 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set control for DMA 0 (write only, shadow?) */ -#define RtdDma0Control(dev, n) \ - writeb(devpriv->dma0Control = (n), devpriv->lcfg+LCFG_DMACSR0) - /* Get status for DMA 0 */ #define RtdDma0Status(dev) \ readb(devpriv->lcfg+LCFG_DMACSR0) @@ -861,19 +857,19 @@ static irqreturn_t rtd_interrupt(int irq, /* interrupt number (ignored) */ DPRINTK ("rtd520: comedi read buffer overflow (DMA) with %ld to go!\n", devpriv->aiCount); - RtdDma0Control(dev, - (devpriv->dma0Control & - ~PLX_DMA_START_BIT) - | PLX_CLEAR_DMA_INTR_BIT); + devpriv->dma0Control &= ~PLX_DMA_START_BIT; + devpriv->dma0Control |= PLX_CLEAR_DMA_INTR_BIT; + writeb(devpriv->dma0Control, + devpriv->lcfg + LCFG_DMACSR0); goto abortTransfer; } /*DPRINTK ("rtd520: DMA transfer: %ld to go, istatus %x\n", devpriv->aiCount, istatus); */ - RtdDma0Control(dev, - (devpriv-> - dma0Control & ~PLX_DMA_START_BIT) - | PLX_CLEAR_DMA_INTR_BIT); + devpriv->dma0Control &= ~PLX_DMA_START_BIT; + devpriv->dma0Control |= PLX_CLEAR_DMA_INTR_BIT; + writeb(devpriv->dma0Control, + devpriv->lcfg + LCFG_DMACSR0); if (0 == devpriv->aiCount) { /* counted down */ DPRINTK("rtd520: Samples Done (DMA).\n"); goto transferDone; @@ -1239,8 +1235,11 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->lcfg + LCFG_ITCSR); abort_dma(dev, 0); devpriv->flags &= ~DMA0_ACTIVE; - if (readl(devpriv->lcfg + LCFG_ITCSR) & ICS_DMA0_A) - RtdDma0Control(dev, PLX_CLEAR_DMA_INTR_BIT); + if (readl(devpriv->lcfg + LCFG_ITCSR) & ICS_DMA0_A) { + devpriv->dma0Control = PLX_CLEAR_DMA_INTR_BIT; + writeb(devpriv->dma0Control, + devpriv->lcfg + LCFG_DMACSR0); + } } writel(0, devpriv->las0 + LAS0_DMA0_RESET); #endif /* USE_DMA */ @@ -1406,8 +1405,12 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) writel(readl(devpriv->lcfg + LCFG_ITCSR) | ICS_DMA0_E, devpriv->lcfg + LCFG_ITCSR); /* Must be 2 steps. See PLX app note about "Starting a DMA transfer" */ - RtdDma0Control(dev, PLX_DMA_EN_BIT); /* enable DMA (clear INTR?) */ - RtdDma0Control(dev, PLX_DMA_EN_BIT | PLX_DMA_START_BIT); /*start DMA */ + devpriv->dma0Control = PLX_DMA_EN_BIT; + writeb(devpriv->dma0Control, + devpriv->lcfg + LCFG_DMACSR0); + devpriv->dma0Control |= PLX_DMA_START_BIT; + writeb(devpriv->dma0Control, + devpriv->lcfg + LCFG_DMACSR0); DPRINTK("rtd520: Using DMA0 transfers. plxInt %x RtdInt %x\n", readl(devpriv->lcfg + LCFG_ITCSR), devpriv->intMask); #else /* USE_DMA */ @@ -1968,7 +1971,9 @@ static void rtd_detach(struct comedi_device *dev) /* Shut down any board ops by resetting it */ #ifdef USE_DMA if (devpriv->lcfg) { - RtdDma0Control(dev, 0); /* disable DMA */ + devpriv->dma0Control = 0; + writeb(devpriv->dma0Control, + devpriv->lcfg + LCFG_DMACSR0); RtdDma1Control(dev, 0); /* disable DMA */ writel(ICS_PIE | ICS_PLIE, devpriv->lcfg + LCFG_ITCSR); } -- cgit v0.10.2 From 9c4d44593eb612ebc0ef8e32dc160dda94de9d05 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:22:15 -0700 Subject: staging: comedi: rtd520: remove RtdDma0Status macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index d92c682..65f0b11 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Get status for DMA 0 */ -#define RtdDma0Status(dev) \ - readb(devpriv->lcfg+LCFG_DMACSR0) - /* Set control for DMA 1 (write only, shadow?) */ #define RtdDma1Control(dev, n) \ writeb(devpriv->dma1Control = (n), devpriv->lcfg+LCFG_DMACSR1) -- cgit v0.10.2 From 4de01dbbca4f11c8943e495ffda52c16778a2f0e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:22:46 -0700 Subject: staging: comedi: rtd520: remove RtdDma1Control macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. Plus it's just a wrapper around a simple 'writeb'. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 65f0b11..09e3938 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -406,10 +406,6 @@ struct rtdPrivate { /* Macros to access registers */ -/* Set control for DMA 1 (write only, shadow?) */ -#define RtdDma1Control(dev, n) \ - writeb(devpriv->dma1Control = (n), devpriv->lcfg+LCFG_DMACSR1) - /* Get status for DMA 1 */ #define RtdDma1Status(dev) \ readb(devpriv->lcfg+LCFG_DMACSR1) @@ -1968,9 +1964,11 @@ static void rtd_detach(struct comedi_device *dev) #ifdef USE_DMA if (devpriv->lcfg) { devpriv->dma0Control = 0; + devpriv->dma1Control = 0; writeb(devpriv->dma0Control, devpriv->lcfg + LCFG_DMACSR0); - RtdDma1Control(dev, 0); /* disable DMA */ + writeb(devpriv->dma1Control, + devpriv->lcfg + LCFG_DMACSR1); writel(ICS_PIE | ICS_PLIE, devpriv->lcfg + LCFG_ITCSR); } #endif /* USE_DMA */ -- cgit v0.10.2 From 6c1a597924c486c53db4a75903a1e0a21264edd3 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:23:13 -0700 Subject: staging: comedi: rtd520: remove RtdDma1Status macro This macro uses the 'devpriv' macro which relies on a local variable having a specific name. It's also not used. Remove the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 09e3938..a524039 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -404,12 +404,6 @@ struct rtdPrivate { */ #define devpriv ((struct rtdPrivate *)dev->private) -/* Macros to access registers */ - -/* Get status for DMA 1 */ -#define RtdDma1Status(dev) \ - readb(devpriv->lcfg+LCFG_DMACSR1) - /* Given a desired period and the clock period (both in ns), return the proper counter value (divider-1). -- cgit v0.10.2 From f782a255b93adc02e58024f9fc2c0e8fac35e7cf Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:23:40 -0700 Subject: staging: comedi: rtd520: remove devpriv macro The macro 'devpriv' relies on a local variable having a specific name and yeilds a pointer derived from that local variable. Replace the macro with a local variable where used. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index a524039..8ea0db1 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -399,12 +399,6 @@ struct rtdPrivate { (((array)[(index)/8] &= ~(1 << ((index) & 0x7)))) /* - * most drivers define the following macro to make it easy to - * access the private structure. - */ -#define devpriv ((struct rtdPrivate *)dev->private) - -/* Given a desired period and the clock period (both in ns), return the proper counter value (divider-1). Sets the original period to be the true value. @@ -453,6 +447,7 @@ static int rtd_ns_to_timer(unsigned int *ns, int round_mode) static unsigned short rtdConvertChanGain(struct comedi_device *dev, unsigned int comediChan, int chanIndex) { /* index in channel list */ + struct rtdPrivate *devpriv = dev->private; unsigned int chan, range, aref; unsigned short r = 0; @@ -505,6 +500,8 @@ static unsigned short rtdConvertChanGain(struct comedi_device *dev, static void rtd_load_channelgain_list(struct comedi_device *dev, unsigned int n_chan, unsigned int *list) { + struct rtdPrivate *devpriv = dev->private; + if (n_chan > 1) { /* setup channel gain table */ int ii; @@ -525,6 +522,7 @@ static void rtd_load_channelgain_list(struct comedi_device *dev, empty status flag clears */ static int rtd520_probe_fifo_depth(struct comedi_device *dev) { + struct rtdPrivate *devpriv = dev->private; unsigned int chanspec = CR_PACK(0, 0, AREF_GROUND); unsigned i; static const unsigned limit = 0x2000; @@ -572,6 +570,7 @@ static int rtd_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct rtdPrivate *devpriv = dev->private; int n, ii; int stat; @@ -627,6 +626,7 @@ static int rtd_ai_rinsn(struct comedi_device *dev, static int ai_read_n(struct comedi_device *dev, struct comedi_subdevice *s, int count) { + struct rtdPrivate *devpriv = dev->private; int ii; for (ii = 0; ii < count; ii++) { @@ -667,6 +667,8 @@ static int ai_read_n(struct comedi_device *dev, struct comedi_subdevice *s, */ static int ai_read_dregs(struct comedi_device *dev, struct comedi_subdevice *s) { + struct rtdPrivate *devpriv = dev->private; + while (readl(devpriv->las0 + LAS0_ADC) & FS_ADC_NOT_EMPTY) { short sample; s16 d = readw(devpriv->las1 + LAS1_ADC_FIFO); @@ -697,6 +699,7 @@ static int ai_read_dregs(struct comedi_device *dev, struct comedi_subdevice *s) */ void abort_dma(struct comedi_device *dev, unsigned int channel) { /* DMA channel 0, 1 */ + struct rtdPrivate *devpriv = dev->private; unsigned long dma_cs_addr; /* the control/status register */ uint8_t status; unsigned int ii; @@ -755,6 +758,7 @@ abortDmaExit: */ static int ai_process_dma(struct comedi_device *dev, struct comedi_subdevice *s) { + struct rtdPrivate *devpriv = dev->private; int ii, n; s16 *dp; @@ -817,8 +821,9 @@ static int ai_process_dma(struct comedi_device *dev, struct comedi_subdevice *s) static irqreturn_t rtd_interrupt(int irq, /* interrupt number (ignored) */ void *d) { /* our data *//* cpu context (ignored) */ - struct comedi_device *dev = d; /* must be called "dev" for devpriv */ + struct comedi_device *dev = d; struct comedi_subdevice *s = dev->subdevices + 0; /* analog in subdevice */ + struct rtdPrivate *devpriv = dev->private; u32 overrun; u16 status; u16 fifoStatus; @@ -1206,6 +1211,7 @@ static int rtd_ai_cmdtest(struct comedi_device *dev, */ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { + struct rtdPrivate *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; int timer; @@ -1417,6 +1423,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) */ static int rtd_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { + struct rtdPrivate *devpriv = dev->private; u32 overrun; u16 status; @@ -1449,6 +1456,7 @@ static int rtd_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct rtdPrivate *devpriv = dev->private; int i; int chan = CR_CHAN(insn->chanspec); int range = CR_RANGE(insn->chanspec); @@ -1511,6 +1519,7 @@ static int rtd_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct rtdPrivate *devpriv = dev->private; int i; int chan = CR_CHAN(insn->chanspec); @@ -1535,6 +1544,8 @@ static int rtd_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct rtdPrivate *devpriv = dev->private; + /* The insn data is a mask in data[0] and the new data * in data[1], each channel cooresponding to a bit. */ if (data[0]) { @@ -1560,6 +1571,7 @@ static int rtd_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct rtdPrivate *devpriv = dev->private; int chan = CR_CHAN(insn->chanspec); /* The input or output configuration of each digital line is @@ -1599,6 +1611,7 @@ static int rtd_dio_insn_config(struct comedi_device *dev, static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) { /* board name and options flags */ + struct rtdPrivate *devpriv; struct comedi_subdevice *s; struct pci_dev *pcidev; int ret; @@ -1623,6 +1636,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) */ if (alloc_private(dev, sizeof(struct rtdPrivate)) < 0) return -ENOMEM; + devpriv = dev->private; /* * Probe the device to determine what device in the series it is. @@ -1949,6 +1963,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) static void rtd_detach(struct comedi_device *dev) { + struct rtdPrivate *devpriv = dev->private; #ifdef USE_DMA int index; #endif -- cgit v0.10.2 From 9e81c8761cb11157e935fa27ed7bda18c55b6b82 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:24:10 -0700 Subject: staging: comedi: rtd520: remove thisboard macro The macro 'thisboard' relies on a local variable having a specific name and yeilds a pointer derived from that local variable. Replace the macro with a local variable where used and use the comedi_board() helper to get the pointer. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 8ea0db1..92f806d 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -328,11 +328,6 @@ static const struct rtdBoard rtd520Boards[] = { }; /* - * Useful for shorthand access to the particular board structure - */ -#define thisboard ((const struct rtdBoard *)dev->board_ptr) - -/* This structure is for data unique to this hardware driver. This is also unique for each board in the system. */ @@ -447,6 +442,7 @@ static int rtd_ns_to_timer(unsigned int *ns, int round_mode) static unsigned short rtdConvertChanGain(struct comedi_device *dev, unsigned int comediChan, int chanIndex) { /* index in channel list */ + const struct rtdBoard *thisboard = comedi_board(dev); struct rtdPrivate *devpriv = dev->private; unsigned int chan, range, aref; unsigned short r = 0; @@ -1611,6 +1607,7 @@ static int rtd_dio_insn_config(struct comedi_device *dev, static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) { /* board name and options flags */ + const struct rtdBoard *thisboard; struct rtdPrivate *devpriv; struct comedi_subdevice *s; struct pci_dev *pcidev; @@ -1671,6 +1668,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) return -EIO; } devpriv->pci_dev = pcidev; + thisboard = comedi_board(dev); dev->board_name = thisboard->name; ret = comedi_pci_enable(pcidev, DRV_NAME); -- cgit v0.10.2 From 7a819d1e5a40189ab94282dc0e42b76c7f52df8d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:24:52 -0700 Subject: staging: comedi: rtd520: factor out the "find pci device" code Factor the "find pci device" code out of the attach function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 92f806d..97d888f 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -1605,12 +1605,47 @@ static int rtd_dio_insn_config(struct comedi_device *dev, return 1; } +static struct pci_dev *rtd_find_pci(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + struct pci_dev *pcidev; + + for (pcidev = pci_get_device(PCI_VENDOR_ID_RTD, PCI_ANY_ID, NULL); + pcidev != NULL; + pcidev = pci_get_device(PCI_VENDOR_ID_RTD, PCI_ANY_ID, pcidev)) { + int i; + + if (it->options[0] || it->options[1]) { + if (pcidev->bus->number != it->options[0] + || PCI_SLOT(pcidev->devfn) != it->options[1]) { + continue; + } + } + for (i = 0; i < ARRAY_SIZE(rtd520Boards); ++i) { + if (pcidev->device == rtd520Boards[i].device_id) { + dev->board_ptr = &rtd520Boards[i]; + break; + } + } + if (dev->board_ptr) + return pcidev; /* found one */ + } + if (!pcidev) { + if (it->options[0] && it->options[1]) { + printk(KERN_INFO "No RTD card at bus=%d slot=%d.\n", + it->options[0], it->options[1]); + } else { + printk(KERN_INFO "No RTD card found.\n"); + } + } + return NULL; +} + static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) { /* board name and options flags */ const struct rtdBoard *thisboard; struct rtdPrivate *devpriv; struct comedi_subdevice *s; - struct pci_dev *pcidev; int ret; resource_size_t physLas0; /* configuration */ resource_size_t physLas1; /* data area */ @@ -1635,43 +1670,14 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) return -ENOMEM; devpriv = dev->private; - /* - * Probe the device to determine what device in the series it is. - */ - for (pcidev = pci_get_device(PCI_VENDOR_ID_RTD, PCI_ANY_ID, NULL); - pcidev != NULL; - pcidev = pci_get_device(PCI_VENDOR_ID_RTD, PCI_ANY_ID, pcidev)) { - int i; - - if (it->options[0] || it->options[1]) { - if (pcidev->bus->number != it->options[0] - || PCI_SLOT(pcidev->devfn) != it->options[1]) { - continue; - } - } - for (i = 0; i < ARRAY_SIZE(rtd520Boards); ++i) { - if (pcidev->device == rtd520Boards[i].device_id) { - dev->board_ptr = &rtd520Boards[i]; - break; - } - } - if (dev->board_ptr) - break; /* found one */ - } - if (!pcidev) { - if (it->options[0] && it->options[1]) { - printk(KERN_INFO "No RTD card at bus=%d slot=%d.\n", - it->options[0], it->options[1]); - } else { - printk(KERN_INFO "No RTD card found.\n"); - } + devpriv->pci_dev = rtd_find_pci(dev, it); + if (!devpriv->pci_dev) return -EIO; - } - devpriv->pci_dev = pcidev; thisboard = comedi_board(dev); + dev->board_name = thisboard->name; - ret = comedi_pci_enable(pcidev, DRV_NAME); + ret = comedi_pci_enable(devpriv->pci_dev, DRV_NAME); if (ret < 0) { printk(KERN_INFO "Failed to enable PCI device and request regions.\n"); return ret; -- cgit v0.10.2 From 26550b32e1640020c1aea2e5ccd857b0ddd84b82 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:25:33 -0700 Subject: staging: comedi: rtd520: cleanup the "find pci device" code Use for_each_pci_dev() instead of open-coding the for loop. Create local variables for the bus and slot options as well as the thisboard pointer in order to clarify the code. Consolidate the printk's when a supported board is not found into one dev_warn message. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 97d888f..9a29500 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -1608,36 +1608,31 @@ static int rtd_dio_insn_config(struct comedi_device *dev, static struct pci_dev *rtd_find_pci(struct comedi_device *dev, struct comedi_devconfig *it) { - struct pci_dev *pcidev; - - for (pcidev = pci_get_device(PCI_VENDOR_ID_RTD, PCI_ANY_ID, NULL); - pcidev != NULL; - pcidev = pci_get_device(PCI_VENDOR_ID_RTD, PCI_ANY_ID, pcidev)) { - int i; + const struct rtdBoard *thisboard; + struct pci_dev *pcidev = NULL; + int bus = it->options[0]; + int slot = it->options[1]; + int i; - if (it->options[0] || it->options[1]) { - if (pcidev->bus->number != it->options[0] - || PCI_SLOT(pcidev->devfn) != it->options[1]) { + for_each_pci_dev(pcidev) { + if (pcidev->vendor != PCI_VENDOR_ID_RTD) + continue; + if (bus || slot) { + if (pcidev->bus->number != bus || + PCI_SLOT(pcidev->devfn) != slot) continue; - } } - for (i = 0; i < ARRAY_SIZE(rtd520Boards); ++i) { - if (pcidev->device == rtd520Boards[i].device_id) { - dev->board_ptr = &rtd520Boards[i]; - break; + for (i = 0; i < ARRAY_SIZE(rtd520Boards); i++) { + thisboard = &rtd520Boards[i]; + if (pcidev->device == thisboard->device_id) { + dev->board_ptr = thisboard; + return pcidev; } } - if (dev->board_ptr) - return pcidev; /* found one */ - } - if (!pcidev) { - if (it->options[0] && it->options[1]) { - printk(KERN_INFO "No RTD card at bus=%d slot=%d.\n", - it->options[0], it->options[1]); - } else { - printk(KERN_INFO "No RTD card found.\n"); - } } + dev_warn(dev->class_dev, + "no supported board found! (req. bus/slot: %d/%d)\n", + bus, slot); return NULL; } -- cgit v0.10.2 From feb153f32688d8f5d79824413dbe3da56986fe6f Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:26:04 -0700 Subject: staging: comedi: rtd520: cleanup the range tables Change the whitespace of the range tables to avoid the > 80 character lines and the ugly line breaks. Convert a couple of the RANGE() values into the appropriate {UNI,BIP}_RANGE(). Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 9a29500..102e635 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -194,103 +194,75 @@ Configuration options: ======================================================================*/ /* - The board has 3 input modes and the gains of 1,2,4,...32 (, 64, 128) -*/ -static const struct comedi_lrange rtd_ai_7520_range = { 18, { - /* +-5V input range gain steps */ - BIP_RANGE(5.0), - BIP_RANGE(5.0 / 2), - BIP_RANGE(5.0 / 4), - BIP_RANGE(5.0 / 8), - BIP_RANGE(5.0 / - 16), - BIP_RANGE(5.0 / - 32), - /* +-10V input range gain steps */ - BIP_RANGE(10.0), - BIP_RANGE(10.0 / - 2), - BIP_RANGE(10.0 / - 4), - BIP_RANGE(10.0 / - 8), - BIP_RANGE(10.0 / - 16), - BIP_RANGE(10.0 / - 32), - /* +10V input range gain steps */ - UNI_RANGE(10.0), - UNI_RANGE(10.0 / - 2), - UNI_RANGE(10.0 / - 4), - UNI_RANGE(10.0 / - 8), - UNI_RANGE(10.0 / - 16), - UNI_RANGE(10.0 / - 32), - - } + * The board has 3 input modes and the gains of 1,2,4,...32 (, 64, 128) + */ +static const struct comedi_lrange rtd_ai_7520_range = { + 18, { + /* +-5V input range gain steps */ + BIP_RANGE(5.0), + BIP_RANGE(5.0 / 2), + BIP_RANGE(5.0 / 4), + BIP_RANGE(5.0 / 8), + BIP_RANGE(5.0 / 16), + BIP_RANGE(5.0 / 32), + /* +-10V input range gain steps */ + BIP_RANGE(10.0), + BIP_RANGE(10.0 / 2), + BIP_RANGE(10.0 / 4), + BIP_RANGE(10.0 / 8), + BIP_RANGE(10.0 / 16), + BIP_RANGE(10.0 / 32), + /* +10V input range gain steps */ + UNI_RANGE(10.0), + UNI_RANGE(10.0 / 2), + UNI_RANGE(10.0 / 4), + UNI_RANGE(10.0 / 8), + UNI_RANGE(10.0 / 16), + UNI_RANGE(10.0 / 32), + } }; /* PCI4520 has two more gains (6 more entries) */ -static const struct comedi_lrange rtd_ai_4520_range = { 24, { - /* +-5V input range gain steps */ - BIP_RANGE(5.0), - BIP_RANGE(5.0 / 2), - BIP_RANGE(5.0 / 4), - BIP_RANGE(5.0 / 8), - BIP_RANGE(5.0 / - 16), - BIP_RANGE(5.0 / - 32), - BIP_RANGE(5.0 / - 64), - BIP_RANGE(5.0 / - 128), - /* +-10V input range gain steps */ - BIP_RANGE(10.0), - BIP_RANGE(10.0 / - 2), - BIP_RANGE(10.0 / - 4), - BIP_RANGE(10.0 / - 8), - BIP_RANGE(10.0 / - 16), - BIP_RANGE(10.0 / - 32), - BIP_RANGE(10.0 / - 64), - BIP_RANGE(10.0 / - 128), - /* +10V input range gain steps */ - UNI_RANGE(10.0), - UNI_RANGE(10.0 / - 2), - UNI_RANGE(10.0 / - 4), - UNI_RANGE(10.0 / - 8), - UNI_RANGE(10.0 / - 16), - UNI_RANGE(10.0 / - 32), - UNI_RANGE(10.0 / - 64), - UNI_RANGE(10.0 / - 128), - } +static const struct comedi_lrange rtd_ai_4520_range = { + 24, { + /* +-5V input range gain steps */ + BIP_RANGE(5.0), + BIP_RANGE(5.0 / 2), + BIP_RANGE(5.0 / 4), + BIP_RANGE(5.0 / 8), + BIP_RANGE(5.0 / 16), + BIP_RANGE(5.0 / 32), + BIP_RANGE(5.0 / 64), + BIP_RANGE(5.0 / 128), + /* +-10V input range gain steps */ + BIP_RANGE(10.0), + BIP_RANGE(10.0 / 2), + BIP_RANGE(10.0 / 4), + BIP_RANGE(10.0 / 8), + BIP_RANGE(10.0 / 16), + BIP_RANGE(10.0 / 32), + BIP_RANGE(10.0 / 64), + BIP_RANGE(10.0 / 128), + /* +10V input range gain steps */ + UNI_RANGE(10.0), + UNI_RANGE(10.0 / 2), + UNI_RANGE(10.0 / 4), + UNI_RANGE(10.0 / 8), + UNI_RANGE(10.0 / 16), + UNI_RANGE(10.0 / 32), + UNI_RANGE(10.0 / 64), + UNI_RANGE(10.0 / 128), + } }; /* Table order matches range values */ -static const struct comedi_lrange rtd_ao_range = { 4, { - RANGE(0, 5), - RANGE(0, 10), - RANGE(-5, 5), - RANGE(-10, 10), - } +static const struct comedi_lrange rtd_ao_range = { + 4, { + UNI_RANGE(5), + UNI_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(10), + } }; /* -- cgit v0.10.2 From 3cdefc9276bce7ce77184048d1b5dbee78949689 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 10 Jul 2012 17:26:37 -0700 Subject: staging: comedi: rtd520: cleanup the boardinfo Remove a couple unnecessary comments. For aesthetic reasons, add some whitespace to the boardinfo to improve readability. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 102e635..5a2953e 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -265,11 +265,8 @@ static const struct comedi_lrange rtd_ao_range = { } }; -/* - Board descriptions - */ struct rtdBoard { - const char *name; /* must be first */ + const char *name; int device_id; int aiChans; int aiBits; @@ -280,23 +277,22 @@ struct rtdBoard { static const struct rtdBoard rtd520Boards[] = { { - .name = "DM7520", - .device_id = 0x7520, - .aiChans = 16, - .aiBits = 12, - .aiMaxGain = 32, - .range10Start = 6, - .rangeUniStart = 12, - }, - { - .name = "PCI4520", - .device_id = 0x4520, - .aiChans = 16, - .aiBits = 12, - .aiMaxGain = 128, - .range10Start = 8, - .rangeUniStart = 16, - }, + .name = "DM7520", + .device_id = 0x7520, + .aiChans = 16, + .aiBits = 12, + .aiMaxGain = 32, + .range10Start = 6, + .rangeUniStart = 12, + }, { + .name = "PCI4520", + .device_id = 0x4520, + .aiChans = 16, + .aiBits = 12, + .aiMaxGain = 128, + .range10Start = 8, + .rangeUniStart = 16, + }, }; /* -- cgit v0.10.2 From 9a1f72233f4d79165b9b3321b792549145291547 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 11 Jul 2012 13:28:19 +0100 Subject: staging: comedi: rtd520: add a few comments H Hartley Sweeten's recent series of patches to clean up the rtd520 driver made some of the register accesses harder to understand. Add a few comments to provide some clues to the reader. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 5a2953e..9998d6b 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -494,6 +494,7 @@ static int rtd520_probe_fifo_depth(struct comedi_device *dev) writel(0, devpriv->las0 + LAS0_ADC_FIFO_CLEAR); rtd_load_channelgain_list(dev, 1, &chanspec); + /* ADC conversion trigger source: SOFTWARE */ writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); /* convert samples */ for (i = 0; i < limit; ++i) { @@ -544,7 +545,7 @@ static int rtd_ai_rinsn(struct comedi_device *dev, /* write channel to multiplexer and clear channel gain table */ rtd_load_channelgain_list(dev, 1, &insn->chanspec); - /* set conversion source */ + /* ADC conversion trigger source: SOFTWARE */ writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); /* convert n samples */ @@ -908,8 +909,9 @@ abortTransfer: /* fall into transferDone */ transferDone: + /* pacer stop source: SOFTWARE */ writel(0, devpriv->las0 + LAS0_PACER_STOP); - writel(0, devpriv->las0 + LAS0_PACER); + writel(0, devpriv->las0 + LAS0_PACER); /* stop pacer */ writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); devpriv->intMask = 0; writew(devpriv->intMask, devpriv->las0 + LAS0_IT); @@ -1180,8 +1182,9 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) int timer; /* stop anything currently running */ + /* pacer stop source: SOFTWARE */ writel(0, devpriv->las0 + LAS0_PACER_STOP); - writel(0, devpriv->las0 + LAS0_PACER); + writel(0, devpriv->las0 + LAS0_PACER); /* stop pacer */ writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); devpriv->intMask = 0; writew(devpriv->intMask, devpriv->las0 + LAS0_IT); @@ -1215,12 +1218,17 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* setup the common case and override if needed */ if (cmd->chanlist_len > 1) { /*DPRINTK ("rtd520: Multi channel setup\n"); */ + /* pacer start source: SOFTWARE */ writel(0, devpriv->las0 + LAS0_PACER_START); + /* burst trigger source: PACER */ writel(1, devpriv->las0 + LAS0_BURST_START); + /* ADC conversion trigger source: BURST */ writel(2, devpriv->las0 + LAS0_ADC_CONVERSION); } else { /* single channel */ /*DPRINTK ("rtd520: single channel setup\n"); */ + /* pacer start source: SOFTWARE */ writel(0, devpriv->las0 + LAS0_PACER_START); + /* ADC conversion trigger source: PACER */ writel(1, devpriv->las0 + LAS0_ADC_CONVERSION); } writel((devpriv->fifoLen / 2 - 1) & 0xffff, devpriv->las0 + LAS0_ACNT); @@ -1269,7 +1277,9 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->transCount = 0; devpriv->flags &= ~SEND_EOS; } + /* pacer clock source: INTERNAL 8MHz */ writel(1, devpriv->las0 + LAS0_PACER_SELECT); + /* just interrupt, don't stop */ writel(1, devpriv->las0 + LAS0_ACNT_STOP_ENABLE); /* BUG??? these look like enumerated values, but they are bit fields */ @@ -1305,6 +1315,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) break; case TRIG_EXT: + /* pacer start source: EXTERNAL */ writel(1, devpriv->las0 + LAS0_PACER_START); break; @@ -1327,6 +1338,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) break; case TRIG_EXT: /* external */ + /* burst trigger source: EXTERNAL */ writel(2, devpriv->las0 + LAS0_BURST_START); break; @@ -1378,7 +1390,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* BUG: start_src is ASSUMED to be TRIG_NOW */ /* BUG? it seems like things are running before the "start" */ - readl(devpriv->las0 + LAS0_PACER); + readl(devpriv->las0 + LAS0_PACER); /* start pacer */ return 0; } @@ -1391,8 +1403,9 @@ static int rtd_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) u32 overrun; u16 status; + /* pacer stop source: SOFTWARE */ writel(0, devpriv->las0 + LAS0_PACER_STOP); - writel(0, devpriv->las0 + LAS0_PACER); + writel(0, devpriv->las0 + LAS0_PACER); /* stop pacer */ writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); devpriv->intMask = 0; writew(devpriv->intMask, devpriv->las0 + LAS0_IT); -- cgit v0.10.2 From 95c59dc96d361d15e0ca1fa6b753cdd8f3ebabec Mon Sep 17 00:00:00 2001 From: "Javier M. Mellid" Date: Wed, 11 Jul 2012 15:49:33 +0200 Subject: staging: sm7xxfb: fix struct names related to vesa modes This patch renames structs related to vesa modes in order to get more readable code on sm712vga_setup. Tested with SM712. Signed-off-by: Javier M. Mellid Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index 7395196..9afafaa 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -56,14 +56,14 @@ struct smtcfb_info { u_int hz; }; -struct vesa_mode_table { - char mode_index[6]; - u16 lfb_width; - u16 lfb_height; - u16 lfb_depth; +struct vesa_mode { + char index[6]; + u16 lfb_width; + u16 lfb_height; + u16 lfb_depth; }; -static struct vesa_mode_table vesa_mode[] = { +static struct vesa_mode vesa_mode_table[] = { {"0x301", 640, 480, 8}, {"0x303", 800, 600, 8}, {"0x305", 1024, 768, 8}, @@ -776,13 +776,15 @@ static int __init sm712vga_setup(char *options) pr_debug("sm712vga_setup = %s\n", options); for (index = 0; - index < ARRAY_SIZE(vesa_mode); + index < ARRAY_SIZE(vesa_mode_table); index++) { - if (strstr(options, vesa_mode[index].mode_index)) { - smtc_screen_info.lfb_width = vesa_mode[index].lfb_width; + if (strstr(options, vesa_mode_table[index].index)) { + smtc_screen_info.lfb_width = + vesa_mode_table[index].lfb_width; smtc_screen_info.lfb_height = - vesa_mode[index].lfb_height; - smtc_screen_info.lfb_depth = vesa_mode[index].lfb_depth; + vesa_mode_table[index].lfb_height; + smtc_screen_info.lfb_depth = + vesa_mode_table[index].lfb_depth; return 0; } } -- cgit v0.10.2 From 4102d9f86d4d88f2bf150f3d073b789f35c9ac6b Mon Sep 17 00:00:00 2001 From: "Javier M. Mellid" Date: Wed, 11 Jul 2012 15:49:34 +0200 Subject: staging: sm7xxfb: rename index var on sm712vga_setup This patchs renames index var on sm712vga_setup. Tested with SM712. Signed-off-by: Javier M. Mellid Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index 9afafaa..4287a80 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -764,7 +764,7 @@ static inline void sm7xx_init_hw(void) */ static int __init sm712vga_setup(char *options) { - int index; + int i; if (!options || !*options) return -EINVAL; @@ -775,16 +775,14 @@ static int __init sm712vga_setup(char *options) pr_debug("sm712vga_setup = %s\n", options); - for (index = 0; - index < ARRAY_SIZE(vesa_mode_table); - index++) { - if (strstr(options, vesa_mode_table[index].index)) { + for (i = 0; i < ARRAY_SIZE(vesa_mode_table); i++) { + if (strstr(options, vesa_mode_table[i].index)) { smtc_screen_info.lfb_width = - vesa_mode_table[index].lfb_width; + vesa_mode_table[i].lfb_width; smtc_screen_info.lfb_height = - vesa_mode_table[index].lfb_height; + vesa_mode_table[i].lfb_height; smtc_screen_info.lfb_depth = - vesa_mode_table[index].lfb_depth; + vesa_mode_table[i].lfb_depth; return 0; } } -- cgit v0.10.2 From 013db67415d1914da2c438ab20d8d4bd4def1fa4 Mon Sep 17 00:00:00 2001 From: "Javier M. Mellid" Date: Wed, 11 Jul 2012 15:49:35 +0200 Subject: staging: sm7xxfb: rename smtc_screen_info to smtc_scr_info This change of name improves readability on sm712_vga_setup and smtcfb_pci_probe. It is coherent with the name of vars being used on code while avoiding the use of extra long lines in functions. Tested with SM712. Signed-off-by: Javier M. Mellid Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index 4287a80..3df73e7 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -34,7 +34,7 @@ #include "sm7xx.h" -struct screen_info smtc_screen_info; +struct screen_info smtc_scr_info; /* * Private structure @@ -769,20 +769,17 @@ static int __init sm712vga_setup(char *options) if (!options || !*options) return -EINVAL; - smtc_screen_info.lfb_width = 0; - smtc_screen_info.lfb_height = 0; - smtc_screen_info.lfb_depth = 0; + smtc_scr_info.lfb_width = 0; + smtc_scr_info.lfb_height = 0; + smtc_scr_info.lfb_depth = 0; pr_debug("sm712vga_setup = %s\n", options); for (i = 0; i < ARRAY_SIZE(vesa_mode_table); i++) { if (strstr(options, vesa_mode_table[i].index)) { - smtc_screen_info.lfb_width = - vesa_mode_table[i].lfb_width; - smtc_screen_info.lfb_height = - vesa_mode_table[i].lfb_height; - smtc_screen_info.lfb_depth = - vesa_mode_table[i].lfb_depth; + smtc_scr_info.lfb_width = vesa_mode_table[i].lfb_width; + smtc_scr_info.lfb_height = vesa_mode_table[i].lfb_height; + smtc_scr_info.lfb_depth = vesa_mode_table[i].lfb_depth; return 0; } } @@ -820,11 +817,11 @@ static int __devinit smtcfb_pci_probe(struct pci_dev *pdev, sm7xx_init_hw(); - /*get mode parameter from smtc_screen_info */ - if (smtc_screen_info.lfb_width != 0) { - sfb->fb.var.xres = smtc_screen_info.lfb_width; - sfb->fb.var.yres = smtc_screen_info.lfb_height; - sfb->fb.var.bits_per_pixel = smtc_screen_info.lfb_depth; + /* get mode parameter from smtc_scr_info */ + if (smtc_scr_info.lfb_width != 0) { + sfb->fb.var.xres = smtc_scr_info.lfb_width; + sfb->fb.var.yres = smtc_scr_info.lfb_height; + sfb->fb.var.bits_per_pixel = smtc_scr_info.lfb_depth; } else { /* default resolution 1024x600 16bit mode */ sfb->fb.var.xres = SCREEN_X_RES; -- cgit v0.10.2 From 03e9e7091780e22f922e155ec40faf596fad335f Mon Sep 17 00:00:00 2001 From: "Javier M. Mellid" Date: Wed, 11 Jul 2012 15:49:36 +0200 Subject: staging: sm7xxfb: rename sm712vga_setup to sm7xx_vga_setup This patch renames sm712vga_setup to sm7xx_vga_setup. sm7xx_vga_setup process command line options in order to get the vga parameter. This parameter will be the lookup index to match the right vesa mode. It is chip independent. Signed-off-by: Javier M. Mellid Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index 3df73e7..34bbf19 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -756,13 +756,8 @@ static inline void sm7xx_init_hw(void) outb_p(0x11, 0x3c5); } -/* - * sm712vga_setup - process command line options, get vga parameter - * @options: string of options - * Returns zero. - * - */ -static int __init sm712vga_setup(char *options) +/* process command line options, get vga parameter */ +static int __init sm7xx_vga_setup(char *options) { int i; @@ -773,7 +768,7 @@ static int __init sm712vga_setup(char *options) smtc_scr_info.lfb_height = 0; smtc_scr_info.lfb_depth = 0; - pr_debug("sm712vga_setup = %s\n", options); + pr_debug("sm7xx_vga_setup = %s\n", options); for (i = 0; i < ARRAY_SIZE(vesa_mode_table); i++) { if (strstr(options, vesa_mode_table[i].index)) { @@ -786,7 +781,7 @@ static int __init sm712vga_setup(char *options) return -1; } -__setup("vga=", sm712vga_setup); +__setup("vga=", sm7xx_vga_setup); static int __devinit smtcfb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) -- cgit v0.10.2 From 1df7e0e234bef878590660267e59db62a4655ba6 Mon Sep 17 00:00:00 2001 From: "Javier M. Mellid" Date: Wed, 11 Jul 2012 15:49:37 +0200 Subject: staging: sm7xxfb: minor maintenance on sm7xx_vga_setup This patch keeps code related to sm7xx_vga_setup closed. It is useful to understand/maintain the logic behind sm7xx_vga_setup with a simple look. Tested with SM712. Signed-off-by: Javier M. Mellid Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index 34bbf19..e17a74e 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -34,8 +34,6 @@ #include "sm7xx.h" -struct screen_info smtc_scr_info; - /* * Private structure */ @@ -56,30 +54,6 @@ struct smtcfb_info { u_int hz; }; -struct vesa_mode { - char index[6]; - u16 lfb_width; - u16 lfb_height; - u16 lfb_depth; -}; - -static struct vesa_mode vesa_mode_table[] = { - {"0x301", 640, 480, 8}, - {"0x303", 800, 600, 8}, - {"0x305", 1024, 768, 8}, - {"0x307", 1280, 1024, 8}, - - {"0x311", 640, 480, 16}, - {"0x314", 800, 600, 16}, - {"0x317", 1024, 768, 16}, - {"0x31A", 1280, 1024, 16}, - - {"0x312", 640, 480, 24}, - {"0x315", 800, 600, 24}, - {"0x318", 1024, 768, 24}, - {"0x31B", 1280, 1024, 24}, -}; - char __iomem *smtc_RegBaseAddress; /* Memory Map IO starting address */ char __iomem *smtc_VRAMBaseAddress; /* video memory starting address */ @@ -108,6 +82,59 @@ static struct fb_fix_screeninfo smtcfb_fix = { .accel = FB_ACCEL_SMI_LYNX, }; +struct vesa_mode { + char index[6]; + u16 lfb_width; + u16 lfb_height; + u16 lfb_depth; +}; + +static struct vesa_mode vesa_mode_table[] = { + {"0x301", 640, 480, 8}, + {"0x303", 800, 600, 8}, + {"0x305", 1024, 768, 8}, + {"0x307", 1280, 1024, 8}, + + {"0x311", 640, 480, 16}, + {"0x314", 800, 600, 16}, + {"0x317", 1024, 768, 16}, + {"0x31A", 1280, 1024, 16}, + + {"0x312", 640, 480, 24}, + {"0x315", 800, 600, 24}, + {"0x318", 1024, 768, 24}, + {"0x31B", 1280, 1024, 24}, +}; + +struct screen_info smtc_scr_info; + +/* process command line options, get vga parameter */ +static int __init sm7xx_vga_setup(char *options) +{ + int i; + + if (!options || !*options) + return -EINVAL; + + smtc_scr_info.lfb_width = 0; + smtc_scr_info.lfb_height = 0; + smtc_scr_info.lfb_depth = 0; + + pr_debug("sm7xx_vga_setup = %s\n", options); + + for (i = 0; i < ARRAY_SIZE(vesa_mode_table); i++) { + if (strstr(options, vesa_mode_table[i].index)) { + smtc_scr_info.lfb_width = vesa_mode_table[i].lfb_width; + smtc_scr_info.lfb_height = vesa_mode_table[i].lfb_height; + smtc_scr_info.lfb_depth = vesa_mode_table[i].lfb_depth; + return 0; + } + } + + return -1; +} +__setup("vga=", sm7xx_vga_setup); + static void sm712_set_timing(struct smtcfb_info *sfb) { int i = 0, j = 0; @@ -756,33 +783,6 @@ static inline void sm7xx_init_hw(void) outb_p(0x11, 0x3c5); } -/* process command line options, get vga parameter */ -static int __init sm7xx_vga_setup(char *options) -{ - int i; - - if (!options || !*options) - return -EINVAL; - - smtc_scr_info.lfb_width = 0; - smtc_scr_info.lfb_height = 0; - smtc_scr_info.lfb_depth = 0; - - pr_debug("sm7xx_vga_setup = %s\n", options); - - for (i = 0; i < ARRAY_SIZE(vesa_mode_table); i++) { - if (strstr(options, vesa_mode_table[i].index)) { - smtc_scr_info.lfb_width = vesa_mode_table[i].lfb_width; - smtc_scr_info.lfb_height = vesa_mode_table[i].lfb_height; - smtc_scr_info.lfb_depth = vesa_mode_table[i].lfb_depth; - return 0; - } - } - - return -1; -} -__setup("vga=", sm7xx_vga_setup); - static int __devinit smtcfb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { -- cgit v0.10.2 From 0f9af641f2c0da815d6485eb977913d888601e12 Mon Sep 17 00:00:00 2001 From: "Javier M. Mellid" Date: Wed, 11 Jul 2012 15:49:38 +0200 Subject: staging: sm7xxfb: rename sm712_set_timing to sm7xx_set_timing sm712_set_timing handles timing for 0x710, 0x712 and 0x720 chips. This patch renames the name of the function of sm712_set_timing to sm7xx_set_timing. Tested with SM712. Signed-off-by: Javier M. Mellid Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index e17a74e..ceaf4a4 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -135,7 +135,7 @@ static int __init sm7xx_vga_setup(char *options) } __setup("vga=", sm7xx_vga_setup); -static void sm712_set_timing(struct smtcfb_info *sfb) +static void sm7xx_set_timing(struct smtcfb_info *sfb) { int i = 0, j = 0; u32 m_nScreenStride; @@ -243,6 +243,17 @@ static void sm712_set_timing(struct smtcfb_info *sfb) } +static void smtc_set_timing(struct smtcfb_info *sfb) +{ + switch (sfb->chip_id) { + case 0x710: + case 0x712: + case 0x720: + sm7xx_set_timing(sfb); + break; + } +} + static void sm712_setpalette(int regno, unsigned red, unsigned green, unsigned blue, struct fb_info *info) { @@ -255,17 +266,6 @@ static void sm712_setpalette(int regno, unsigned red, unsigned green, smtc_mmiowb(blue >> 10, dac_val); } -static void smtc_set_timing(struct smtcfb_info *sfb) -{ - switch (sfb->chip_id) { - case 0x710: - case 0x712: - case 0x720: - sm712_set_timing(sfb); - break; - } -} - /* chan_to_field * * convert a colour value into a field position -- cgit v0.10.2 From 4a7c2e0d73511b1bd155e175b973a075de030043 Mon Sep 17 00:00:00 2001 From: "Javier M. Mellid" Date: Wed, 11 Jul 2012 15:49:39 +0200 Subject: staging: sm7xxfb: minor maintenance on timing path This patch keeps smtc_set_timing and sm7xx_set_timing functions closed to smtcfb_setmode. This change eases reviewing and maintaining this logic path. Tested with SM712. Signed-off-by: Javier M. Mellid Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index ceaf4a4..1a273e7 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -135,125 +135,6 @@ static int __init sm7xx_vga_setup(char *options) } __setup("vga=", sm7xx_vga_setup); -static void sm7xx_set_timing(struct smtcfb_info *sfb) -{ - int i = 0, j = 0; - u32 m_nScreenStride; - - dev_dbg(&sfb->pdev->dev, - "sfb->width=%d sfb->height=%d " - "sfb->fb.var.bits_per_pixel=%d sfb->hz=%d\n", - sfb->width, sfb->height, sfb->fb.var.bits_per_pixel, sfb->hz); - - for (j = 0; j < numVGAModes; j++) { - if (VGAMode[j].mmSizeX == sfb->width && - VGAMode[j].mmSizeY == sfb->height && - VGAMode[j].bpp == sfb->fb.var.bits_per_pixel && - VGAMode[j].hz == sfb->hz) { - - dev_dbg(&sfb->pdev->dev, - "VGAMode[j].mmSizeX=%d VGAMode[j].mmSizeY=%d " - "VGAMode[j].bpp=%d VGAMode[j].hz=%d\n", - VGAMode[j].mmSizeX, VGAMode[j].mmSizeY, - VGAMode[j].bpp, VGAMode[j].hz); - - dev_dbg(&sfb->pdev->dev, "VGAMode index=%d\n", j); - - smtc_mmiowb(0x0, 0x3c6); - - smtc_seqw(0, 0x1); - - smtc_mmiowb(VGAMode[j].Init_MISC, 0x3c2); - - /* init SEQ register SR00 - SR04 */ - for (i = 0; i < SIZE_SR00_SR04; i++) - smtc_seqw(i, VGAMode[j].Init_SR00_SR04[i]); - - /* init SEQ register SR10 - SR24 */ - for (i = 0; i < SIZE_SR10_SR24; i++) - smtc_seqw(i + 0x10, - VGAMode[j].Init_SR10_SR24[i]); - - /* init SEQ register SR30 - SR75 */ - for (i = 0; i < SIZE_SR30_SR75; i++) - if (((i + 0x30) != 0x62) \ - && ((i + 0x30) != 0x6a) \ - && ((i + 0x30) != 0x6b)) - smtc_seqw(i + 0x30, - VGAMode[j].Init_SR30_SR75[i]); - - /* init SEQ register SR80 - SR93 */ - for (i = 0; i < SIZE_SR80_SR93; i++) - smtc_seqw(i + 0x80, - VGAMode[j].Init_SR80_SR93[i]); - - /* init SEQ register SRA0 - SRAF */ - for (i = 0; i < SIZE_SRA0_SRAF; i++) - smtc_seqw(i + 0xa0, - VGAMode[j].Init_SRA0_SRAF[i]); - - /* init Graphic register GR00 - GR08 */ - for (i = 0; i < SIZE_GR00_GR08; i++) - smtc_grphw(i, VGAMode[j].Init_GR00_GR08[i]); - - /* init Attribute register AR00 - AR14 */ - for (i = 0; i < SIZE_AR00_AR14; i++) - smtc_attrw(i, VGAMode[j].Init_AR00_AR14[i]); - - /* init CRTC register CR00 - CR18 */ - for (i = 0; i < SIZE_CR00_CR18; i++) - smtc_crtcw(i, VGAMode[j].Init_CR00_CR18[i]); - - /* init CRTC register CR30 - CR4D */ - for (i = 0; i < SIZE_CR30_CR4D; i++) - smtc_crtcw(i + 0x30, - VGAMode[j].Init_CR30_CR4D[i]); - - /* init CRTC register CR90 - CRA7 */ - for (i = 0; i < SIZE_CR90_CRA7; i++) - smtc_crtcw(i + 0x90, - VGAMode[j].Init_CR90_CRA7[i]); - } - } - smtc_mmiowb(0x67, 0x3c2); - - /* set VPR registers */ - writel(0x0, sfb->m_pVPR + 0x0C); - writel(0x0, sfb->m_pVPR + 0x40); - - /* set data width */ - m_nScreenStride = - (sfb->width * sfb->fb.var.bits_per_pixel) / 64; - switch (sfb->fb.var.bits_per_pixel) { - case 8: - writel(0x0, sfb->m_pVPR + 0x0); - break; - case 16: - writel(0x00020000, sfb->m_pVPR + 0x0); - break; - case 24: - writel(0x00040000, sfb->m_pVPR + 0x0); - break; - case 32: - writel(0x00030000, sfb->m_pVPR + 0x0); - break; - } - writel((u32) (((m_nScreenStride + 2) << 16) | m_nScreenStride), - sfb->m_pVPR + 0x10); - -} - -static void smtc_set_timing(struct smtcfb_info *sfb) -{ - switch (sfb->chip_id) { - case 0x710: - case 0x712: - case 0x720: - sm7xx_set_timing(sfb); - break; - } -} - static void sm712_setpalette(int regno, unsigned red, unsigned green, unsigned blue, struct fb_info *info) { @@ -581,6 +462,125 @@ smtcfb_write(struct fb_info *info, const char __user *buf, size_t count, } #endif /* ! __BIG_ENDIAN */ +static void sm7xx_set_timing(struct smtcfb_info *sfb) +{ + int i = 0, j = 0; + u32 m_nScreenStride; + + dev_dbg(&sfb->pdev->dev, + "sfb->width=%d sfb->height=%d " + "sfb->fb.var.bits_per_pixel=%d sfb->hz=%d\n", + sfb->width, sfb->height, sfb->fb.var.bits_per_pixel, sfb->hz); + + for (j = 0; j < numVGAModes; j++) { + if (VGAMode[j].mmSizeX == sfb->width && + VGAMode[j].mmSizeY == sfb->height && + VGAMode[j].bpp == sfb->fb.var.bits_per_pixel && + VGAMode[j].hz == sfb->hz) { + + dev_dbg(&sfb->pdev->dev, + "VGAMode[j].mmSizeX=%d VGAMode[j].mmSizeY=%d " + "VGAMode[j].bpp=%d VGAMode[j].hz=%d\n", + VGAMode[j].mmSizeX, VGAMode[j].mmSizeY, + VGAMode[j].bpp, VGAMode[j].hz); + + dev_dbg(&sfb->pdev->dev, "VGAMode index=%d\n", j); + + smtc_mmiowb(0x0, 0x3c6); + + smtc_seqw(0, 0x1); + + smtc_mmiowb(VGAMode[j].Init_MISC, 0x3c2); + + /* init SEQ register SR00 - SR04 */ + for (i = 0; i < SIZE_SR00_SR04; i++) + smtc_seqw(i, VGAMode[j].Init_SR00_SR04[i]); + + /* init SEQ register SR10 - SR24 */ + for (i = 0; i < SIZE_SR10_SR24; i++) + smtc_seqw(i + 0x10, + VGAMode[j].Init_SR10_SR24[i]); + + /* init SEQ register SR30 - SR75 */ + for (i = 0; i < SIZE_SR30_SR75; i++) + if (((i + 0x30) != 0x62) \ + && ((i + 0x30) != 0x6a) \ + && ((i + 0x30) != 0x6b)) + smtc_seqw(i + 0x30, + VGAMode[j].Init_SR30_SR75[i]); + + /* init SEQ register SR80 - SR93 */ + for (i = 0; i < SIZE_SR80_SR93; i++) + smtc_seqw(i + 0x80, + VGAMode[j].Init_SR80_SR93[i]); + + /* init SEQ register SRA0 - SRAF */ + for (i = 0; i < SIZE_SRA0_SRAF; i++) + smtc_seqw(i + 0xa0, + VGAMode[j].Init_SRA0_SRAF[i]); + + /* init Graphic register GR00 - GR08 */ + for (i = 0; i < SIZE_GR00_GR08; i++) + smtc_grphw(i, VGAMode[j].Init_GR00_GR08[i]); + + /* init Attribute register AR00 - AR14 */ + for (i = 0; i < SIZE_AR00_AR14; i++) + smtc_attrw(i, VGAMode[j].Init_AR00_AR14[i]); + + /* init CRTC register CR00 - CR18 */ + for (i = 0; i < SIZE_CR00_CR18; i++) + smtc_crtcw(i, VGAMode[j].Init_CR00_CR18[i]); + + /* init CRTC register CR30 - CR4D */ + for (i = 0; i < SIZE_CR30_CR4D; i++) + smtc_crtcw(i + 0x30, + VGAMode[j].Init_CR30_CR4D[i]); + + /* init CRTC register CR90 - CRA7 */ + for (i = 0; i < SIZE_CR90_CRA7; i++) + smtc_crtcw(i + 0x90, + VGAMode[j].Init_CR90_CRA7[i]); + } + } + smtc_mmiowb(0x67, 0x3c2); + + /* set VPR registers */ + writel(0x0, sfb->m_pVPR + 0x0C); + writel(0x0, sfb->m_pVPR + 0x40); + + /* set data width */ + m_nScreenStride = + (sfb->width * sfb->fb.var.bits_per_pixel) / 64; + switch (sfb->fb.var.bits_per_pixel) { + case 8: + writel(0x0, sfb->m_pVPR + 0x0); + break; + case 16: + writel(0x00020000, sfb->m_pVPR + 0x0); + break; + case 24: + writel(0x00040000, sfb->m_pVPR + 0x0); + break; + case 32: + writel(0x00030000, sfb->m_pVPR + 0x0); + break; + } + writel((u32) (((m_nScreenStride + 2) << 16) | m_nScreenStride), + sfb->m_pVPR + 0x10); + +} + +static void smtc_set_timing(struct smtcfb_info *sfb) +{ + switch (sfb->chip_id) { + case 0x710: + case 0x712: + case 0x720: + sm7xx_set_timing(sfb); + break; + } +} + void smtcfb_setmode(struct smtcfb_info *sfb) { switch (sfb->fb.var.bits_per_pixel) { -- cgit v0.10.2 From cd4653ae715321be0315d603e4c4ca2db8572493 Mon Sep 17 00:00:00 2001 From: "Javier M. Mellid" Date: Wed, 11 Jul 2012 15:49:40 +0200 Subject: staging: sm7xxfb: move pseudo palette into smtcfb_info This patch moves pseudo palette into smtcfb_info struct. Tested with SM712. Signed-off-by: Javier M. Mellid Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index 1a273e7..4ee9ca6 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -52,13 +52,13 @@ struct smtcfb_info { u_int width; u_int height; u_int hz; + + u32 colreg[17]; }; char __iomem *smtc_RegBaseAddress; /* Memory Map IO starting address */ char __iomem *smtc_VRAMBaseAddress; /* video memory starting address */ -static u32 colreg[17]; - static struct fb_var_screeninfo smtcfb_var = { .xres = 1024, .yres = 600, @@ -709,9 +709,9 @@ static struct smtcfb_info *smtc_alloc_fb_info(struct pci_dev *pdev, char *name) sfb->fb.var.accel_flags = FB_ACCELF_TEXT; sfb->fb.var.vmode = FB_VMODE_NONINTERLACED; - sfb->fb.par = sfb; + sfb->fb.pseudo_palette = sfb->colreg; - sfb->fb.pseudo_palette = colreg; + sfb->fb.par = sfb; return sfb; } -- cgit v0.10.2 From 13a05eaa9d4adf25dc199246eedbe2a211cffb6c Mon Sep 17 00:00:00 2001 From: "Javier M. Mellid" Date: Wed, 11 Jul 2012 15:49:41 +0200 Subject: staging: sm7xxfb: cleanup on smtc_alloc_fb_info This patch improves coding style on smtc_alloc_fb_info. Tested with SM712. Signed-off-by: Javier M. Mellid Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index 4ee9ca6..90c90db 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -673,7 +673,7 @@ static struct fb_ops smtcfb_ops = { }; /* - * Alloc struct smtcfb_info and assign the default value + * alloc struct smtcfb_info and assign the default value */ static struct smtcfb_info *smtc_alloc_fb_info(struct pci_dev *pdev, char *name) { @@ -686,30 +686,30 @@ static struct smtcfb_info *smtc_alloc_fb_info(struct pci_dev *pdev, char *name) sfb->pdev = pdev; - /*** Init sfb->fb with default value ***/ + /* init sfb->fb with default value */ + sfb->fb.flags = FBINFO_FLAG_DEFAULT; sfb->fb.fbops = &smtcfb_ops; - sfb->fb.var = smtcfb_var; - sfb->fb.fix = smtcfb_fix; + sfb->fb.fix = smtcfb_fix; strcpy(sfb->fb.fix.id, name); - sfb->fb.fix.type = FB_TYPE_PACKED_PIXELS; - sfb->fb.fix.type_aux = 0; - sfb->fb.fix.xpanstep = 0; - sfb->fb.fix.ypanstep = 0; - sfb->fb.fix.ywrapstep = 0; - sfb->fb.fix.accel = FB_ACCEL_SMI_LYNX; - - sfb->fb.var.nonstd = 0; - sfb->fb.var.activate = FB_ACTIVATE_NOW; - sfb->fb.var.height = -1; - sfb->fb.var.width = -1; - /* text mode acceleration */ + sfb->fb.fix.type = FB_TYPE_PACKED_PIXELS; + sfb->fb.fix.type_aux = 0; + sfb->fb.fix.xpanstep = 0; + sfb->fb.fix.ypanstep = 0; + sfb->fb.fix.ywrapstep = 0; + sfb->fb.fix.accel = FB_ACCEL_SMI_LYNX; + + sfb->fb.var = smtcfb_var; + sfb->fb.var.nonstd = 0; + sfb->fb.var.activate = FB_ACTIVATE_NOW; + sfb->fb.var.height = -1; + sfb->fb.var.width = -1; sfb->fb.var.accel_flags = FB_ACCELF_TEXT; - sfb->fb.var.vmode = FB_VMODE_NONINTERLACED; + sfb->fb.var.vmode = FB_VMODE_NONINTERLACED; - sfb->fb.pseudo_palette = sfb->colreg; + sfb->fb.pseudo_palette = sfb->colreg; sfb->fb.par = sfb; -- cgit v0.10.2 From a6e28b34205be389068cd08238e1368443f31b8b Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Thu, 12 Jul 2012 11:53:17 +0545 Subject: staging/et131x: use SET_ETHTOOL_OPS directly using a wrapper around SET_ETHTOOL_OPS macro is not actually required, remove and use SET_ETHTOOL_OPS directly. Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index ac6897b..4c78f12 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -3943,12 +3943,6 @@ static struct ethtool_ops et131x_ethtool_ops = { .get_regs = et131x_get_regs, .get_link = ethtool_op_get_link, }; - -static void et131x_set_ethtool_ops(struct net_device *netdev) -{ - SET_ETHTOOL_OPS(netdev, &et131x_ethtool_ops); -} - /** * et131x_hwaddr_init - set up the MAC Address on the ET1310 * @adapter: pointer to our private adapter structure @@ -5301,7 +5295,7 @@ static int __devinit et131x_pci_setup(struct pci_dev *pdev, netdev->netdev_ops = &et131x_netdev_ops; SET_NETDEV_DEV(netdev, &pdev->dev); - et131x_set_ethtool_ops(netdev); + SET_ETHTOOL_OPS(netdev, &et131x_ethtool_ops); adapter = et131x_adapter_init(netdev, pdev); -- cgit v0.10.2 From d67030d215ac1ec13cab16467904c2a7265e1fbd Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Thu, 12 Jul 2012 11:56:11 +0545 Subject: staging/gdm72xx: return PTR_ERR rather -ENOENT return the error of filp_open rather returning -ENOENT. Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/gdm72xx/usb_boot.c b/drivers/staging/gdm72xx/usb_boot.c index c163bcc..fef290c 100644 --- a/drivers/staging/gdm72xx/usb_boot.c +++ b/drivers/staging/gdm72xx/usb_boot.c @@ -174,7 +174,7 @@ int usb_boot(struct usb_device *usbdev, u16 pid) if (IS_ERR(filp)) { printk(KERN_ERR "Can't find %s.\n", img_name); set_fs(fs); - ret = -ENOENT; + ret = PTR_ERR(filp); goto restore_fs; } -- cgit v0.10.2 From 7fc03add26e1e1f0b375e905547e01da6cdc1599 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Thu, 12 Jul 2012 11:56:54 +0545 Subject: staging/gdm72xx: use kzalloc for phydev and udev we are doing kmalloc and memset, can be done using kzalloc itself. Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/gdm72xx/gdm_usb.c b/drivers/staging/gdm72xx/gdm_usb.c index 89268c7..d48d49c 100644 --- a/drivers/staging/gdm72xx/gdm_usb.c +++ b/drivers/staging/gdm72xx/gdm_usb.c @@ -590,20 +590,17 @@ static int gdm_usb_probe(struct usb_interface *intf, goto out; } - phy_dev = kmalloc(sizeof(*phy_dev), GFP_KERNEL); + phy_dev = kzalloc(sizeof(*phy_dev), GFP_KERNEL); if (phy_dev == NULL) { ret = -ENOMEM; goto out; } - udev = kmalloc(sizeof(*udev), GFP_KERNEL); + udev = kzalloc(sizeof(*udev), GFP_KERNEL); if (udev == NULL) { ret = -ENOMEM; goto out; } - memset(phy_dev, 0, sizeof(*phy_dev)); - memset(udev, 0, sizeof(*udev)); - if (idProduct == 0x7205 || idProduct == 0x7206) udev->padding = GDM7205_PADDING; else -- cgit v0.10.2 From 8df858ea76b76dde9a39d4edd9aaded983582cfe Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Thu, 12 Jul 2012 11:57:25 +0545 Subject: staging/gdm72xx: cleanup little at gdm_wimax_event_rcv the event sock check is done at the netlink_init itself. Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/gdm72xx/gdm_wimax.c b/drivers/staging/gdm72xx/gdm_wimax.c index e616de1..0716efc 100644 --- a/drivers/staging/gdm72xx/gdm_wimax.c +++ b/drivers/staging/gdm72xx/gdm_wimax.c @@ -255,17 +255,15 @@ static void gdm_wimax_event_rcv(struct net_device *dev, u16 type, void *msg, static int gdm_wimax_event_init(void) { - if (wm_event.ref_cnt == 0) { + if (!wm_event.ref_cnt) { wm_event.sock = netlink_init(NETLINK_WIMAX, gdm_wimax_event_rcv); + if (wm_event.sock) + wm_event.ref_cnt++; INIT_LIST_HEAD(&wm_event.evtq); INIT_LIST_HEAD(&wm_event.freeq); INIT_WORK(&wm_event.ws, __gdm_wimax_event_send); spin_lock_init(&wm_event.evt_lock); - } - - if (wm_event.sock) { - wm_event.ref_cnt++; return 0; } -- cgit v0.10.2 From c2a1793d1b2dedd3dfc33af00c6b1d4f050c040c Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Thu, 12 Jul 2012 11:58:37 +0545 Subject: staging/gdm72xx: use kzalloc for phydev and sdev in sdio probe function we are doing kmalloc which can be done using kzalloc. Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/gdm72xx/gdm_sdio.c b/drivers/staging/gdm72xx/gdm_sdio.c index 5e19b09..3e43c01 100644 --- a/drivers/staging/gdm72xx/gdm_sdio.c +++ b/drivers/staging/gdm72xx/gdm_sdio.c @@ -664,20 +664,17 @@ static int sdio_wimax_probe(struct sdio_func *func, if (ret) return ret; - phy_dev = kmalloc(sizeof(*phy_dev), GFP_KERNEL); + phy_dev = kzalloc(sizeof(*phy_dev), GFP_KERNEL); if (phy_dev == NULL) { ret = -ENOMEM; goto out; } - sdev = kmalloc(sizeof(*sdev), GFP_KERNEL); + sdev = kzalloc(sizeof(*sdev), GFP_KERNEL); if (sdev == NULL) { ret = -ENOMEM; goto out; } - memset(phy_dev, 0, sizeof(*phy_dev)); - memset(sdev, 0, sizeof(*sdev)); - phy_dev->priv_dev = (void *)sdev; phy_dev->send_func = gdm_sdio_send; phy_dev->rcv_func = gdm_sdio_receive; -- cgit v0.10.2 From 9b90b712c9504d36e60eaefce0baf66d64b3c901 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Thu, 12 Jul 2012 11:59:22 +0545 Subject: staging/gdm72xx: coding style fixes gdm_qos.c following warnings were fixed drivers/staging/gdm72xx/gdm_qos.c:198: ERROR: "foo* bar" should be "foo *bar" drivers/staging/gdm72xx/gdm_qos.c:198: ERROR: "foo* bar" should be "foo *bar" drivers/staging/gdm72xx/gdm_qos.c:244: WARNING: quoted string split across lines Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/gdm72xx/gdm_qos.c b/drivers/staging/gdm72xx/gdm_qos.c index e7134e2..80bde05 100644 --- a/drivers/staging/gdm72xx/gdm_qos.c +++ b/drivers/staging/gdm72xx/gdm_qos.c @@ -195,7 +195,7 @@ static u32 chk_ipv4_rule(struct gdm_wimax_csr_s *csr, u8 *Stream, u8 *port) return 0; } -static u32 get_qos_index(struct nic *nic, u8* iph, u8* tcpudph) +static u32 get_qos_index(struct nic *nic, u8 *iph, u8 *tcpudph) { u32 IP_Ver, Header_Len, i; struct qos_cb_s *qcb = &nic->qos; @@ -240,8 +240,7 @@ static u32 extract_qos_list(struct nic *nic, struct list_head *head) qcb->csr[i].QoSBufCount++; if (!list_empty(&qcb->qos_list[i])) - wprintk("QoS Index(%d) " - "is piled!!\n", i); + wprintk("QoS Index(%d) is piled!!\n", i); } } } -- cgit v0.10.2 From cd96aeca4d580f7a464897608165bc4b04369c80 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Thu, 12 Jul 2012 14:43:21 +0545 Subject: staging/sm7xxfb: select sm7xxfb only when CONFIG_PCI is enabled the sm7xxfb is a pci device, and should depend on the PCI. And also if we wont' depend on the PCI sub-system, the following warns will be triggered, drivers/staging/sm7xxfb/sm7xxfb.c:1061:1: warning: data definition has no type or storage class [enabled by default] drivers/staging/sm7xxfb/sm7xxfb.c:1061:1: warning: type defaults to 'int' in declaration of 'module_pci_driver' [-Wimplicit-int] drivers/staging/sm7xxfb/sm7xxfb.c:1061:1: warning: parameter names (without types) in function declaration [enabled by default] Reported-by: Fengguang Wu Signed-off-by: Devendra Naga Signed-off-by: Randy Dunlap Cc: Teddy Wang Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sm7xxfb/Kconfig b/drivers/staging/sm7xxfb/Kconfig index d5013f8..e2922ae 100644 --- a/drivers/staging/sm7xxfb/Kconfig +++ b/drivers/staging/sm7xxfb/Kconfig @@ -1,6 +1,6 @@ config FB_SM7XX tristate "Silicon Motion SM7XX framebuffer support" - depends on FB + depends on FB && PCI select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT -- cgit v0.10.2 From 6622bcd64f7432b99718b373fe6231992e832c9e Mon Sep 17 00:00:00 2001 From: Toshiaki Yamane Date: Thu, 12 Jul 2012 22:00:33 +0900 Subject: staging: panel: Remove printk(KERN_DEBUG ...) located in the #if 0 block Deleted #if 0 blocks Signed-off-by: Toshiaki Yamane Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c index 7365089..c625567 100644 --- a/drivers/staging/panel/panel.c +++ b/drivers/staging/panel/panel.c @@ -1837,12 +1837,6 @@ static void panel_process_inputs(void) struct list_head *item; struct logical_input *input; -#if 0 - printk(KERN_DEBUG - "entering panel_process_inputs with pp=%016Lx & pc=%016Lx\n", - phys_prev, phys_curr); -#endif - keypressed = 0; inputs_stable = 1; list_for_each(item, &logical_inputs) { @@ -2002,10 +1996,6 @@ static struct logical_input *panel_bind_key(char *name, char *press, key->rise_time = 1; key->fall_time = 1; -#if 0 - printk(KERN_DEBUG "bind: <%s> : m=%016Lx v=%016Lx\n", name, key->mask, - key->value); -#endif strncpy(key->u.kbd.press_str, press, sizeof(key->u.kbd.press_str)); strncpy(key->u.kbd.repeat_str, repeat, sizeof(key->u.kbd.repeat_str)); strncpy(key->u.kbd.release_str, release, -- cgit v0.10.2 From eb073a9bf2b6edf8cf69eb393a1e511942cd1c64 Mon Sep 17 00:00:00 2001 From: Toshiaki Yamane Date: Thu, 12 Jul 2012 22:01:17 +0900 Subject: staging: panel: Use pr_err(...) rather than printk(KERN_ERR ...) -Removed unnecessary OOM messages. -Removed embedded message prefixes. -Added __func__ to some pr_err messages. -Converted printk(KERN_ERR to pr_err -Refactored split printk strings onto a single line -Removed the space before the '!'. Signed-off-by: Toshiaki Yamane Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c index c625567..3675241 100644 --- a/drivers/staging/panel/panel.c +++ b/drivers/staging/panel/panel.c @@ -1981,10 +1981,9 @@ static struct logical_input *panel_bind_key(char *name, char *press, struct logical_input *key; key = kzalloc(sizeof(struct logical_input), GFP_KERNEL); - if (!key) { - printk(KERN_ERR "panel: not enough memory\n"); + if (!key) return NULL; - } + if (!input_name2mask(name, &key->mask, &key->value, &scan_mask_i, &scan_mask_o)) { kfree(key); @@ -2020,10 +2019,9 @@ static struct logical_input *panel_bind_callback(char *name, struct logical_input *callback; callback = kmalloc(sizeof(struct logical_input), GFP_KERNEL); - if (!callback) { - printk(KERN_ERR "panel: not enough memory\n"); + if (!callback) return NULL; - } + memset(callback, 0, sizeof(struct logical_input)); if (!input_name2mask(name, &callback->mask, &callback->value, &scan_mask_i, &scan_mask_o)) @@ -2100,10 +2098,8 @@ static void panel_attach(struct parport *port) return; if (pprt) { - printk(KERN_ERR - "panel_attach(): port->number=%d parport=%d, " - "already registered !\n", - port->number, parport); + pr_err("%s: port->number=%d parport=%d, already registered!\n", + __func__, port->number, parport); return; } @@ -2112,16 +2108,14 @@ static void panel_attach(struct parport *port) /*PARPORT_DEV_EXCL */ 0, (void *)&pprt); if (pprt == NULL) { - pr_err("panel_attach(): port->number=%d parport=%d, " - "parport_register_device() failed\n", - port->number, parport); + pr_err("%s: port->number=%d parport=%d, parport_register_device() failed\n", + __func__, port->number, parport); return; } if (parport_claim(pprt)) { - printk(KERN_ERR - "Panel: could not claim access to parport%d. " - "Aborting.\n", parport); + pr_err("could not claim access to parport%d. Aborting.\n", + parport); goto err_unreg_device; } @@ -2155,10 +2149,8 @@ static void panel_detach(struct parport *port) return; if (!pprt) { - printk(KERN_ERR - "panel_detach(): port->number=%d parport=%d, " - "nothing to unregister.\n", - port->number, parport); + pr_err("%s: port->number=%d parport=%d, nothing to unregister.\n", + __func__, port->number, parport); return; } @@ -2268,8 +2260,7 @@ int panel_init(void) init_in_progress = 1; if (parport_register_driver(&panel_driver)) { - printk(KERN_ERR - "Panel: could not register with parport. Aborting.\n"); + pr_err("could not register with parport. Aborting.\n"); return -EIO; } @@ -2281,8 +2272,7 @@ int panel_init(void) pprt = NULL; } parport_unregister_driver(&panel_driver); - printk(KERN_ERR "Panel driver version " PANEL_VERSION - " disabled.\n"); + pr_err("driver version " PANEL_VERSION " disabled.\n"); return -ENODEV; } -- cgit v0.10.2 From 493aa896cbed9e5a60f498076d4e3145335cf4c9 Mon Sep 17 00:00:00 2001 From: Toshiaki Yamane Date: Thu, 12 Jul 2012 22:01:00 +0900 Subject: staging: panel: Use pr_info(...) rather than printk(KERN_INFO -Added pr_fmt. -Converted printk(KERN_INFO to pr_info -Removed embedded message prefixes. Signed-off-by: Toshiaki Yamane Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c index 3675241..39f9982 100644 --- a/drivers/staging/panel/panel.c +++ b/drivers/staging/panel/panel.c @@ -34,6 +34,8 @@ * */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include #include @@ -2279,12 +2281,12 @@ int panel_init(void) register_reboot_notifier(&panel_notifier); if (pprt) - printk(KERN_INFO "Panel driver version " PANEL_VERSION - " registered on parport%d (io=0x%lx).\n", parport, - pprt->port->base); + pr_info("driver version " PANEL_VERSION + " registered on parport%d (io=0x%lx).\n", parport, + pprt->port->base); else - printk(KERN_INFO "Panel driver version " PANEL_VERSION - " not yet registered\n"); + pr_info("driver version " PANEL_VERSION + " not yet registered\n"); /* tells various subsystems about the fact that initialization is finished */ init_in_progress = 0; -- cgit v0.10.2 From 8feaf0ce1a04328c490a4400b9e457f1f88252c8 Mon Sep 17 00:00:00 2001 From: Eduardo Valentin Date: Thu, 12 Jul 2012 19:02:29 +0300 Subject: staging: OMAP4+: thermal: introduce bandgap temperature sensor In the System Control Module, OMAP supplies a voltage reference and a temperature sensor feature that are gathered in the band gap voltage and temperature sensor (VBGAPTS) module. The band gap provides current and voltage reference for its internal circuits and other analog IP blocks. The analog-to-digital converter (ADC) produces an output value that is proportional to the silicon temperature. This patch provides a platform driver which expose this feature. It is moduled as a MFD child of the System Control Module core MFD driver. This driver provides only APIs to access the device properties, like temperature, thresholds and update rate. Signed-off-by: Eduardo Valentin Signed-off-by: J Keerthy Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index d3934d7..e3402d5 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -134,4 +134,6 @@ source "drivers/staging/gdm72xx/Kconfig" source "drivers/staging/csr/Kconfig" +source "drivers/staging/omap-thermal/Kconfig" + endif # STAGING diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 5b2219a..3be59d0 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -59,3 +59,4 @@ obj-$(CONFIG_USB_WPAN_HCD) += ozwpan/ obj-$(CONFIG_USB_G_CCG) += ccg/ obj-$(CONFIG_WIMAX_GDM72XX) += gdm72xx/ obj-$(CONFIG_CSR_WIFI) += csr/ +obj-$(CONFIG_OMAP_BANDGAP) += omap-thermal/ diff --git a/drivers/staging/omap-thermal/Kconfig b/drivers/staging/omap-thermal/Kconfig new file mode 100644 index 0000000..8c9979d --- /dev/null +++ b/drivers/staging/omap-thermal/Kconfig @@ -0,0 +1,11 @@ +config OMAP_BANDGAP + tristate "Texas Instruments OMAP4+ temperature sensor driver" + depends on THERMAL + depends on ARCH_OMAP4 || SOC_OMAP5 + help + If you say yes here you get support for the Texas Instruments + OMAP4460+ on die bandgap temperature sensor support. The register + set is part of system control module. + + This includes alert interrupts generation and also the TSHUT + support. diff --git a/drivers/staging/omap-thermal/Makefile b/drivers/staging/omap-thermal/Makefile new file mode 100644 index 0000000..c92a854 --- /dev/null +++ b/drivers/staging/omap-thermal/Makefile @@ -0,0 +1,2 @@ +obj-$(CONFIG_OMAP_BANDGAP) += omap-thermal.o +omap-thermal-y := omap-bandgap.o diff --git a/drivers/staging/omap-thermal/TODO b/drivers/staging/omap-thermal/TODO new file mode 100644 index 0000000..9e23cc4 --- /dev/null +++ b/drivers/staging/omap-thermal/TODO @@ -0,0 +1,28 @@ +List of TODOs (by Eduardo Valentin) + +on omap-bandgap.c: +- Rework locking +- Improve driver code by adding usage of regmap-mmio +- Test every exposed API to userland +- Add support to hwmon +- Review and revisit all API exposed +- Revisit PM support +- Revisit data structures and simplify them +- Once SCM-core api settles, update this driver accordingly + +on omap-thermal-common.c/omap-thermal.h: +- Revisit extrapolation constants for O4/O5 +- Revisit need for locking +- Revisit trips and its definitions +- Revisit trending + +on omap5-thermal.c +- Add support for GPU cooling + +generally: +- write Kconfig dependencies so that omap variants are covered +- make checkpatch.pl and sparse happy +- make sure this code works on OMAP4430, OMAP4460 and OMAP5430 +- update documentation + +Copy patches to Eduardo Valentin diff --git a/drivers/staging/omap-thermal/omap-bandgap.c b/drivers/staging/omap-thermal/omap-bandgap.c new file mode 100644 index 0000000..8ea6264 --- /dev/null +++ b/drivers/staging/omap-thermal/omap-bandgap.c @@ -0,0 +1,1167 @@ +/* + * OMAP4 Bandgap temperature sensor driver + * + * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/ + * Author: J Keerthy + * Author: Moiz Sonasath + * Couple of fixes, DT and MFD adaptation: + * Eduardo Valentin + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "omap-bandgap.h" + +static u32 omap_bandgap_readl(struct omap_bandgap *bg_ptr, u32 reg) +{ + return readl(bg_ptr->base + reg); +} + +static void omap_bandgap_writel(struct omap_bandgap *bg_ptr, u32 val, u32 reg) +{ + writel(val, bg_ptr->base + reg); +} + +static int omap_bandgap_power(struct omap_bandgap *bg_ptr, bool on) +{ + struct temp_sensor_registers *tsr; + int i; + u32 ctrl; + + if (!OMAP_BANDGAP_HAS(bg_ptr, POWER_SWITCH)) + return 0; + + for (i = 0; i < bg_ptr->conf->sensor_count; i++) { + tsr = bg_ptr->conf->sensors[i].registers; + ctrl = omap_bandgap_readl(bg_ptr, tsr->temp_sensor_ctrl); + ctrl &= ~tsr->bgap_tempsoff_mask; + /* active on 0 */ + ctrl |= !on << __ffs(tsr->bgap_tempsoff_mask); + + /* write BGAP_TEMPSOFF should be reset to 0 */ + omap_bandgap_writel(bg_ptr, ctrl, tsr->temp_sensor_ctrl); + } + + return 0; +} + +/* This is the Talert handler. Call it only if HAS(TALERT) is set */ +static irqreturn_t talert_irq_handler(int irq, void *data) +{ + struct omap_bandgap *bg_ptr = data; + struct temp_sensor_registers *tsr; + u32 t_hot = 0, t_cold = 0, temp, ctrl; + int i; + + bg_ptr = data; + /* Read the status of t_hot */ + for (i = 0; i < bg_ptr->conf->sensor_count; i++) { + tsr = bg_ptr->conf->sensors[i].registers; + t_hot = omap_bandgap_readl(bg_ptr, tsr->bgap_status); + t_hot &= tsr->status_hot_mask; + + /* Read the status of t_cold */ + t_cold = omap_bandgap_readl(bg_ptr, tsr->bgap_status); + t_cold &= tsr->status_cold_mask; + + if (!t_cold && !t_hot) + continue; + + ctrl = omap_bandgap_readl(bg_ptr, tsr->bgap_mask_ctrl); + /* + * One TALERT interrupt: Two sources + * If the interrupt is due to t_hot then mask t_hot and + * and unmask t_cold else mask t_cold and unmask t_hot + */ + if (t_hot) { + ctrl &= ~tsr->mask_hot_mask; + ctrl |= tsr->mask_cold_mask; + } else if (t_cold) { + ctrl &= ~tsr->mask_cold_mask; + ctrl |= tsr->mask_hot_mask; + } + + omap_bandgap_writel(bg_ptr, ctrl, tsr->bgap_mask_ctrl); + + /* read temperature */ + temp = omap_bandgap_readl(bg_ptr, tsr->temp_sensor_ctrl); + temp &= tsr->bgap_dtemp_mask; + + /* report temperature to whom may concern */ + if (bg_ptr->conf->report_temperature) + bg_ptr->conf->report_temperature(bg_ptr, i); + } + + return IRQ_HANDLED; +} + +/* This is the Tshut handler. Call it only if HAS(TSHUT) is set */ +static irqreturn_t omap_bandgap_tshut_irq_handler(int irq, void *data) +{ + orderly_poweroff(true); + + return IRQ_HANDLED; +} + +static +int adc_to_temp_conversion(struct omap_bandgap *bg_ptr, int id, int adc_val, + int *t) +{ + struct temp_sensor_data *ts_data = bg_ptr->conf->sensors[id].ts_data; + + /* look up for temperature in the table and return the temperature */ + if (adc_val < ts_data->adc_start_val || adc_val > ts_data->adc_end_val) + return -ERANGE; + + *t = bg_ptr->conv_table[adc_val - ts_data->adc_start_val]; + + return 0; +} + +static int temp_to_adc_conversion(long temp, struct omap_bandgap *bg_ptr, int i, + int *adc) +{ + struct temp_sensor_data *ts_data = bg_ptr->conf->sensors[i].ts_data; + int high, low, mid; + + low = 0; + high = ts_data->adc_end_val - ts_data->adc_start_val; + mid = (high + low) / 2; + + if (temp < bg_ptr->conv_table[high] || temp > bg_ptr->conv_table[high]) + return -EINVAL; + + while (low < high) { + if (temp < bg_ptr->conv_table[mid]) + high = mid - 1; + else + low = mid + 1; + mid = (low + high) / 2; + } + + *adc = ts_data->adc_start_val + low; + + return 0; +} + +/* Talert masks. Call it only if HAS(TALERT) is set */ +static int temp_sensor_unmask_interrupts(struct omap_bandgap *bg_ptr, int id, + u32 t_hot, u32 t_cold) +{ + struct temp_sensor_registers *tsr; + u32 temp, reg_val; + + /* Read the current on die temperature */ + tsr = bg_ptr->conf->sensors[id].registers; + temp = omap_bandgap_readl(bg_ptr, tsr->temp_sensor_ctrl); + temp &= tsr->bgap_dtemp_mask; + + reg_val = omap_bandgap_readl(bg_ptr, tsr->bgap_mask_ctrl); + if (temp < t_hot) + reg_val |= tsr->mask_hot_mask; + else + reg_val &= ~tsr->mask_hot_mask; + + if (t_cold < temp) + reg_val |= tsr->mask_cold_mask; + else + reg_val &= ~tsr->mask_cold_mask; + omap_bandgap_writel(bg_ptr, reg_val, tsr->bgap_mask_ctrl); + + return 0; +} + +static +int add_hyst(int adc_val, int hyst_val, struct omap_bandgap *bg_ptr, int i, + u32 *sum) +{ + int temp, ret; + + ret = adc_to_temp_conversion(bg_ptr, i, adc_val, &temp); + if (ret < 0) + return ret; + + temp += hyst_val; + + return temp_to_adc_conversion(temp, bg_ptr, i, sum); +} + +/* Talert Thot threshold. Call it only if HAS(TALERT) is set */ +static +int temp_sensor_configure_thot(struct omap_bandgap *bg_ptr, int id, int t_hot) +{ + struct temp_sensor_data *ts_data = bg_ptr->conf->sensors[id].ts_data; + struct temp_sensor_registers *tsr; + u32 thresh_val, reg_val; + int cold, err = 0; + + tsr = bg_ptr->conf->sensors[id].registers; + + /* obtain the T cold value */ + thresh_val = omap_bandgap_readl(bg_ptr, tsr->bgap_threshold); + cold = (thresh_val & tsr->threshold_tcold_mask) >> + __ffs(tsr->threshold_tcold_mask); + if (t_hot <= cold) { + /* change the t_cold to t_hot - 5000 millidegrees */ + err |= add_hyst(t_hot, -ts_data->hyst_val, bg_ptr, id, &cold); + /* write the new t_cold value */ + reg_val = thresh_val & (~tsr->threshold_tcold_mask); + reg_val |= cold << __ffs(tsr->threshold_tcold_mask); + omap_bandgap_writel(bg_ptr, reg_val, tsr->bgap_threshold); + thresh_val = reg_val; + } + + /* write the new t_hot value */ + reg_val = thresh_val & ~tsr->threshold_thot_mask; + reg_val |= (t_hot << __ffs(tsr->threshold_thot_mask)); + omap_bandgap_writel(bg_ptr, reg_val, tsr->bgap_threshold); + if (err) { + dev_err(bg_ptr->dev, "failed to reprogram thot threshold\n"); + return -EIO; + } + + return temp_sensor_unmask_interrupts(bg_ptr, id, t_hot, cold); +} + +/* Talert Thot and Tcold thresholds. Call it only if HAS(TALERT) is set */ +static +int temp_sensor_init_talert_thresholds(struct omap_bandgap *bg_ptr, int id, + int t_hot, int t_cold) +{ + struct temp_sensor_registers *tsr; + u32 reg_val, thresh_val; + + tsr = bg_ptr->conf->sensors[id].registers; + thresh_val = omap_bandgap_readl(bg_ptr, tsr->bgap_threshold); + + /* write the new t_cold value */ + reg_val = thresh_val & ~tsr->threshold_tcold_mask; + reg_val |= (t_cold << __ffs(tsr->threshold_tcold_mask)); + omap_bandgap_writel(bg_ptr, reg_val, tsr->bgap_threshold); + + thresh_val = omap_bandgap_readl(bg_ptr, tsr->bgap_threshold); + + /* write the new t_hot value */ + reg_val = thresh_val & ~tsr->threshold_thot_mask; + reg_val |= (t_hot << __ffs(tsr->threshold_thot_mask)); + omap_bandgap_writel(bg_ptr, reg_val, tsr->bgap_threshold); + + reg_val = omap_bandgap_readl(bg_ptr, tsr->bgap_mask_ctrl); + reg_val |= tsr->mask_hot_mask; + reg_val |= tsr->mask_cold_mask; + omap_bandgap_writel(bg_ptr, reg_val, tsr->bgap_mask_ctrl); + + return 0; +} + +/* Talert Tcold threshold. Call it only if HAS(TALERT) is set */ +static +int temp_sensor_configure_tcold(struct omap_bandgap *bg_ptr, int id, + int t_cold) +{ + struct temp_sensor_data *ts_data = bg_ptr->conf->sensors[id].ts_data; + struct temp_sensor_registers *tsr; + u32 thresh_val, reg_val; + int hot, err = 0; + + tsr = bg_ptr->conf->sensors[id].registers; + /* obtain the T cold value */ + thresh_val = omap_bandgap_readl(bg_ptr, tsr->bgap_threshold); + hot = (thresh_val & tsr->threshold_thot_mask) >> + __ffs(tsr->threshold_thot_mask); + + if (t_cold >= hot) { + /* change the t_hot to t_cold + 5000 millidegrees */ + err |= add_hyst(t_cold, ts_data->hyst_val, bg_ptr, id, &hot); + /* write the new t_hot value */ + reg_val = thresh_val & (~tsr->threshold_thot_mask); + reg_val |= hot << __ffs(tsr->threshold_thot_mask); + omap_bandgap_writel(bg_ptr, reg_val, tsr->bgap_threshold); + thresh_val = reg_val; + } + + /* write the new t_cold value */ + reg_val = thresh_val & ~tsr->threshold_tcold_mask; + reg_val |= (t_cold << __ffs(tsr->threshold_tcold_mask)); + omap_bandgap_writel(bg_ptr, reg_val, tsr->bgap_threshold); + if (err) { + dev_err(bg_ptr->dev, "failed to reprogram tcold threshold\n"); + return -EIO; + } + + return temp_sensor_unmask_interrupts(bg_ptr, id, hot, t_cold); +} + +/* This is Tshut Thot config. Call it only if HAS(TSHUT_CONFIG) is set */ +static int temp_sensor_configure_tshut_hot(struct omap_bandgap *bg_ptr, + int id, int tshut_hot) +{ + struct temp_sensor_registers *tsr; + u32 reg_val; + + tsr = bg_ptr->conf->sensors[id].registers; + reg_val = omap_bandgap_readl(bg_ptr, tsr->tshut_threshold); + reg_val &= ~tsr->tshut_hot_mask; + reg_val |= tshut_hot << __ffs(tsr->tshut_hot_mask); + omap_bandgap_writel(bg_ptr, reg_val, tsr->tshut_threshold); + + return 0; +} + +/* This is Tshut Tcold config. Call it only if HAS(TSHUT_CONFIG) is set */ +static int temp_sensor_configure_tshut_cold(struct omap_bandgap *bg_ptr, + int id, int tshut_cold) +{ + struct temp_sensor_registers *tsr; + u32 reg_val; + + tsr = bg_ptr->conf->sensors[id].registers; + reg_val = omap_bandgap_readl(bg_ptr, tsr->tshut_threshold); + reg_val &= ~tsr->tshut_cold_mask; + reg_val |= tshut_cold << __ffs(tsr->tshut_cold_mask); + omap_bandgap_writel(bg_ptr, reg_val, tsr->tshut_threshold); + + return 0; +} + +/* This is counter config. Call it only if HAS(COUNTER) is set */ +static int configure_temp_sensor_counter(struct omap_bandgap *bg_ptr, int id, + u32 counter) +{ + struct temp_sensor_registers *tsr; + u32 val; + + tsr = bg_ptr->conf->sensors[id].registers; + val = omap_bandgap_readl(bg_ptr, tsr->bgap_counter); + val &= ~tsr->counter_mask; + val |= counter << __ffs(tsr->counter_mask); + omap_bandgap_writel(bg_ptr, val, tsr->bgap_counter); + + return 0; +} + +#define bandgap_is_valid(b) \ + (!IS_ERR_OR_NULL(b)) +#define bandgap_is_valid_sensor_id(b, i) \ + ((i) >= 0 && (i) < (b)->conf->sensor_count) +static inline int omap_bandgap_validate(struct omap_bandgap *bg_ptr, int id) +{ + if (!bandgap_is_valid(bg_ptr)) { + pr_err("%s: invalid bandgap pointer\n", __func__); + return -EINVAL; + } + + if (!bandgap_is_valid_sensor_id(bg_ptr, id)) { + dev_err(bg_ptr->dev, "%s: sensor id out of range (%d)\n", + __func__, id); + return -ERANGE; + } + + return 0; +} + +/* Exposed APIs */ +/** + * omap_bandgap_read_thot() - reads sensor current thot + * @bg_ptr - pointer to bandgap instance + * @id - sensor id + * @thot - resulting current thot value + * + * returns 0 on success or the proper error code + */ +int omap_bandgap_read_thot(struct omap_bandgap *bg_ptr, int id, + int *thot) +{ + struct temp_sensor_registers *tsr; + u32 temp; + int ret; + + ret = omap_bandgap_validate(bg_ptr, id); + if (ret) + return ret; + + if (!OMAP_BANDGAP_HAS(bg_ptr, TALERT)) + return -ENOTSUPP; + + tsr = bg_ptr->conf->sensors[id].registers; + temp = omap_bandgap_readl(bg_ptr, tsr->bgap_threshold); + temp = (temp & tsr->threshold_thot_mask) >> + __ffs(tsr->threshold_thot_mask); + ret |= adc_to_temp_conversion(bg_ptr, id, temp, &temp); + if (ret) { + dev_err(bg_ptr->dev, "failed to read thot\n"); + return -EIO; + } + + *thot = temp; + + return 0; +} + +/** + * omap_bandgap_write_thot() - sets sensor current thot + * @bg_ptr - pointer to bandgap instance + * @id - sensor id + * @val - desired thot value + * + * returns 0 on success or the proper error code + */ +int omap_bandgap_write_thot(struct omap_bandgap *bg_ptr, int id, int val) +{ + struct temp_sensor_data *ts_data; + struct temp_sensor_registers *tsr; + u32 t_hot; + int ret; + + ret = omap_bandgap_validate(bg_ptr, id); + if (ret) + return ret; + + if (!OMAP_BANDGAP_HAS(bg_ptr, TALERT)) + return -ENOTSUPP; + + ts_data = bg_ptr->conf->sensors[id].ts_data; + tsr = bg_ptr->conf->sensors[id].registers; + + if (val < ts_data->min_temp + ts_data->hyst_val) + return -EINVAL; + ret = temp_to_adc_conversion(val, bg_ptr, id, &t_hot); + if (ret < 0) + return ret; + + mutex_lock(&bg_ptr->bg_mutex); + temp_sensor_configure_thot(bg_ptr, id, t_hot); + mutex_unlock(&bg_ptr->bg_mutex); + + return 0; +} + +/** + * omap_bandgap_read_tcold() - reads sensor current tcold + * @bg_ptr - pointer to bandgap instance + * @id - sensor id + * @tcold - resulting current tcold value + * + * returns 0 on success or the proper error code + */ +int omap_bandgap_read_tcold(struct omap_bandgap *bg_ptr, int id, + int *tcold) +{ + struct temp_sensor_registers *tsr; + u32 temp; + int ret; + + ret = omap_bandgap_validate(bg_ptr, id); + if (ret) + return ret; + + if (!OMAP_BANDGAP_HAS(bg_ptr, TALERT)) + return -ENOTSUPP; + + tsr = bg_ptr->conf->sensors[id].registers; + temp = omap_bandgap_readl(bg_ptr, tsr->bgap_threshold); + temp = (temp & tsr->threshold_tcold_mask) + >> __ffs(tsr->threshold_tcold_mask); + ret |= adc_to_temp_conversion(bg_ptr, id, temp, &temp); + if (ret) + return -EIO; + + *tcold = temp; + + return 0; +} + +/** + * omap_bandgap_write_tcold() - sets the sensor tcold + * @bg_ptr - pointer to bandgap instance + * @id - sensor id + * @val - desired tcold value + * + * returns 0 on success or the proper error code + */ +int omap_bandgap_write_tcold(struct omap_bandgap *bg_ptr, int id, int val) +{ + struct temp_sensor_data *ts_data; + struct temp_sensor_registers *tsr; + u32 t_cold; + int ret; + + ret = omap_bandgap_validate(bg_ptr, id); + if (ret) + return ret; + + if (!OMAP_BANDGAP_HAS(bg_ptr, TALERT)) + return -ENOTSUPP; + + ts_data = bg_ptr->conf->sensors[id].ts_data; + tsr = bg_ptr->conf->sensors[id].registers; + if (val > ts_data->max_temp + ts_data->hyst_val) + return -EINVAL; + + ret = temp_to_adc_conversion(val, bg_ptr, id, &t_cold); + if (ret < 0) + return ret; + + mutex_lock(&bg_ptr->bg_mutex); + temp_sensor_configure_tcold(bg_ptr, id, t_cold); + mutex_unlock(&bg_ptr->bg_mutex); + + return 0; +} + +/** + * omap_bandgap_read_update_interval() - read the sensor update interval + * @bg_ptr - pointer to bandgap instance + * @id - sensor id + * @interval - resulting update interval in miliseconds + * + * returns 0 on success or the proper error code + */ +int omap_bandgap_read_update_interval(struct omap_bandgap *bg_ptr, int id, + int *interval) +{ + struct temp_sensor_registers *tsr; + u32 time; + int ret; + + ret = omap_bandgap_validate(bg_ptr, id); + if (ret) + return ret; + + if (!OMAP_BANDGAP_HAS(bg_ptr, COUNTER)) + return -ENOTSUPP; + + tsr = bg_ptr->conf->sensors[id].registers; + time = omap_bandgap_readl(bg_ptr, tsr->bgap_counter); + if (ret) + return ret; + time = (time & tsr->counter_mask) >> __ffs(tsr->counter_mask); + time = time * 1000 / bg_ptr->clk_rate; + + *interval = time; + + return 0; +} + +/** + * omap_bandgap_write_update_interval() - set the update interval + * @bg_ptr - pointer to bandgap instance + * @id - sensor id + * @interval - desired update interval in miliseconds + * + * returns 0 on success or the proper error code + */ +int omap_bandgap_write_update_interval(struct omap_bandgap *bg_ptr, + int id, u32 interval) +{ + int ret = omap_bandgap_validate(bg_ptr, id); + if (ret) + return ret; + + if (!OMAP_BANDGAP_HAS(bg_ptr, COUNTER)) + return -ENOTSUPP; + + interval = interval * bg_ptr->clk_rate / 1000; + mutex_lock(&bg_ptr->bg_mutex); + configure_temp_sensor_counter(bg_ptr, id, interval); + mutex_unlock(&bg_ptr->bg_mutex); + + return 0; +} + +/** + * omap_bandgap_read_temperature() - report current temperature + * @bg_ptr - pointer to bandgap instance + * @id - sensor id + * @temperature - resulting temperature + * + * returns 0 on success or the proper error code + */ +int omap_bandgap_read_temperature(struct omap_bandgap *bg_ptr, int id, + int *temperature) +{ + struct temp_sensor_registers *tsr; + u32 temp; + int ret; + + ret = omap_bandgap_validate(bg_ptr, id); + if (ret) + return ret; + + tsr = bg_ptr->conf->sensors[id].registers; + temp = omap_bandgap_readl(bg_ptr, tsr->temp_sensor_ctrl); + temp &= tsr->bgap_dtemp_mask; + + ret |= adc_to_temp_conversion(bg_ptr, id, temp, &temp); + if (ret) + return -EIO; + + *temperature = temp; + + return 0; +} + +/** + * omap_bandgap_set_sensor_data() - helper function to store thermal + * framework related data. + * @bg_ptr - pointer to bandgap instance + * @id - sensor id + * @data - thermal framework related data to be stored + * + * returns 0 on success or the proper error code + */ +int omap_bandgap_set_sensor_data(struct omap_bandgap *bg_ptr, int id, + void *data) +{ + int ret = omap_bandgap_validate(bg_ptr, id); + if (ret) + return ret; + + bg_ptr->conf->sensors[id].data = data; + + return 0; +} + +/** + * omap_bandgap_get_sensor_data() - helper function to get thermal + * framework related data. + * @bg_ptr - pointer to bandgap instance + * @id - sensor id + * + * returns data stored by set function with sensor id on success or NULL + */ +void *omap_bandgap_get_sensor_data(struct omap_bandgap *bg_ptr, int id) +{ + int ret = omap_bandgap_validate(bg_ptr, id); + if (ret) + return ERR_PTR(ret); + + return bg_ptr->conf->sensors[id].data; +} + +static int +omap_bandgap_force_single_read(struct omap_bandgap *bg_ptr, int id) +{ + struct temp_sensor_registers *tsr; + u32 temp = 0, counter = 1000; + + tsr = bg_ptr->conf->sensors[id].registers; + /* Select single conversion mode */ + if (OMAP_BANDGAP_HAS(bg_ptr, MODE_CONFIG)) { + temp = omap_bandgap_readl(bg_ptr, tsr->bgap_mode_ctrl); + temp &= ~(1 << __ffs(tsr->mode_ctrl_mask)); + omap_bandgap_writel(bg_ptr, temp, tsr->bgap_mode_ctrl); + } + + /* Start of Conversion = 1 */ + temp = omap_bandgap_readl(bg_ptr, tsr->temp_sensor_ctrl); + temp |= 1 << __ffs(tsr->bgap_soc_mask); + omap_bandgap_writel(bg_ptr, temp, tsr->temp_sensor_ctrl); + /* Wait until DTEMP is updated */ + temp = omap_bandgap_readl(bg_ptr, tsr->temp_sensor_ctrl); + temp &= (tsr->bgap_dtemp_mask); + while ((temp == 0) && --counter) { + temp = omap_bandgap_readl(bg_ptr, tsr->temp_sensor_ctrl); + temp &= (tsr->bgap_dtemp_mask); + } + /* Start of Conversion = 0 */ + temp = omap_bandgap_readl(bg_ptr, tsr->temp_sensor_ctrl); + temp &= ~(1 << __ffs(tsr->bgap_soc_mask)); + omap_bandgap_writel(bg_ptr, temp, tsr->temp_sensor_ctrl); + + return 0; +} + +/** + * enable_continuous_mode() - One time enabling of continuous conversion mode + * @bg_ptr - pointer to scm instance + * + * Call this function only if HAS(MODE_CONFIG) is set + */ +static int enable_continuous_mode(struct omap_bandgap *bg_ptr) +{ + struct temp_sensor_registers *tsr; + int i; + u32 val; + + for (i = 0; i < bg_ptr->conf->sensor_count; i++) { + /* Perform a single read just before enabling continuous */ + omap_bandgap_force_single_read(bg_ptr, i); + tsr = bg_ptr->conf->sensors[i].registers; + val = omap_bandgap_readl(bg_ptr, tsr->bgap_mode_ctrl); + val |= 1 << __ffs(tsr->mode_ctrl_mask); + omap_bandgap_writel(bg_ptr, val, tsr->bgap_mode_ctrl); + } + + return 0; +} + +static int omap_bandgap_tshut_init(struct omap_bandgap *bg_ptr, + struct platform_device *pdev) +{ + int gpio_nr = bg_ptr->tshut_gpio; + int status; + + /* Request for gpio_86 line */ + status = gpio_request(gpio_nr, "tshut"); + if (status < 0) { + dev_err(bg_ptr->dev, + "Could not request for TSHUT GPIO:%i\n", 86); + return status; + } + status = gpio_direction_input(gpio_nr); + if (status) { + dev_err(bg_ptr->dev, + "Cannot set input TSHUT GPIO %d\n", gpio_nr); + return status; + } + + status = request_irq(gpio_to_irq(gpio_nr), + omap_bandgap_tshut_irq_handler, + IRQF_TRIGGER_RISING, "tshut", + NULL); + if (status) { + gpio_free(gpio_nr); + dev_err(bg_ptr->dev, "request irq failed for TSHUT"); + } + + return 0; +} + +/* Initialization of Talert. Call it only if HAS(TALERT) is set */ +static int omap_bandgap_talert_init(struct omap_bandgap *bg_ptr, + struct platform_device *pdev) +{ + int ret; + + bg_ptr->irq = platform_get_irq(pdev, 0); + if (bg_ptr->irq < 0) { + dev_err(&pdev->dev, "get_irq failed\n"); + return bg_ptr->irq; + } + ret = request_threaded_irq(bg_ptr->irq, NULL, + talert_irq_handler, + IRQF_TRIGGER_HIGH | IRQF_ONESHOT, + "talert", bg_ptr); + if (ret) { + dev_err(&pdev->dev, "Request threaded irq failed.\n"); + return ret; + } + + return 0; +} + +static const struct of_device_id of_omap_bandgap_match[]; +static struct omap_bandgap *omap_bandgap_build(struct platform_device *pdev) +{ + struct device_node *node = pdev->dev.of_node; + const struct of_device_id *of_id; + struct omap_bandgap *bg_ptr; + struct resource *res; + u32 prop; + int i; + + /* just for the sake */ + if (!node) { + dev_err(&pdev->dev, "no platform information available\n"); + return ERR_PTR(-EINVAL); + } + + bg_ptr = devm_kzalloc(&pdev->dev, sizeof(struct omap_bandgap), + GFP_KERNEL); + if (!bg_ptr) { + dev_err(&pdev->dev, "Unable to allocate mem for driver ref\n"); + return ERR_PTR(-ENOMEM); + } + + of_id = of_match_device(of_omap_bandgap_match, &pdev->dev); + if (of_id) + bg_ptr->conf = of_id->data; + + i = 0; + do { + void __iomem *chunk; + + res = platform_get_resource(pdev, IORESOURCE_MEM, i); + if (!res) + break; + chunk = devm_request_and_ioremap(&pdev->dev, res); + if (i == 0) + bg_ptr->base = chunk; + if (!chunk) { + dev_err(&pdev->dev, + "failed to request the IO (%d:%pR).\n", + i, res); + return ERR_PTR(-EADDRNOTAVAIL); + } + i++; + } while (res); + + if (OMAP_BANDGAP_HAS(bg_ptr, TSHUT)) { + if (of_property_read_u32(node, "ti,tshut-gpio", &prop) < 0) { + dev_err(&pdev->dev, "missing tshut gpio in device tree\n"); + return ERR_PTR(-EINVAL); + } + bg_ptr->tshut_gpio = prop; + if (!gpio_is_valid(bg_ptr->tshut_gpio)) { + dev_err(&pdev->dev, "invalid gpio for tshut (%d)\n", + bg_ptr->tshut_gpio); + return ERR_PTR(-EINVAL); + } + } + + return bg_ptr; +} + +static +int __devinit omap_bandgap_probe(struct platform_device *pdev) +{ + struct omap_bandgap *bg_ptr; + int clk_rate, ret = 0, i; + + bg_ptr = omap_bandgap_build(pdev); + if (IS_ERR_OR_NULL(bg_ptr)) { + dev_err(&pdev->dev, "failed to fetch platform data\n"); + return PTR_ERR(bg_ptr); + } + bg_ptr->dev = &pdev->dev; + + if (OMAP_BANDGAP_HAS(bg_ptr, TSHUT)) { + ret = omap_bandgap_tshut_init(bg_ptr, pdev); + if (ret) { + dev_err(&pdev->dev, + "failed to initialize system tshut IRQ\n"); + return ret; + } + } + + bg_ptr->fclock = clk_get(NULL, bg_ptr->conf->fclock_name); + ret = IS_ERR_OR_NULL(bg_ptr->fclock); + if (ret) { + dev_err(&pdev->dev, "failed to request fclock reference\n"); + goto free_irqs; + } + + bg_ptr->div_clk = clk_get(NULL, bg_ptr->conf->div_ck_name); + ret = IS_ERR_OR_NULL(bg_ptr->div_clk); + if (ret) { + dev_err(&pdev->dev, + "failed to request div_ts_ck clock ref\n"); + goto free_irqs; + } + + bg_ptr->conv_table = bg_ptr->conf->conv_table; + for (i = 0; i < bg_ptr->conf->sensor_count; i++) { + struct temp_sensor_registers *tsr; + u32 val; + + tsr = bg_ptr->conf->sensors[i].registers; + /* + * check if the efuse has a non-zero value if not + * it is an untrimmed sample and the temperatures + * may not be accurate + */ + val = omap_bandgap_readl(bg_ptr, tsr->bgap_efuse); + if (ret || !val) + dev_info(&pdev->dev, + "Non-trimmed BGAP, Temp not accurate\n"); + } + + clk_rate = clk_round_rate(bg_ptr->div_clk, + bg_ptr->conf->sensors[0].ts_data->max_freq); + if (clk_rate < bg_ptr->conf->sensors[0].ts_data->min_freq || + clk_rate == 0xffffffff) { + ret = -ENODEV; + dev_err(&pdev->dev, "wrong clock rate (%d)\n", clk_rate); + goto put_clks; + } + + ret = clk_set_rate(bg_ptr->div_clk, clk_rate); + if (ret) + dev_err(&pdev->dev, "Cannot re-set clock rate. Continuing\n"); + + bg_ptr->clk_rate = clk_rate; + clk_enable(bg_ptr->fclock); + + mutex_init(&bg_ptr->bg_mutex); + bg_ptr->dev = &pdev->dev; + platform_set_drvdata(pdev, bg_ptr); + + omap_bandgap_power(bg_ptr, true); + + /* Set default counter to 1 for now */ + if (OMAP_BANDGAP_HAS(bg_ptr, COUNTER)) + for (i = 0; i < bg_ptr->conf->sensor_count; i++) + configure_temp_sensor_counter(bg_ptr, i, 1); + + for (i = 0; i < bg_ptr->conf->sensor_count; i++) { + struct temp_sensor_data *ts_data; + + ts_data = bg_ptr->conf->sensors[i].ts_data; + + if (OMAP_BANDGAP_HAS(bg_ptr, TALERT)) + temp_sensor_init_talert_thresholds(bg_ptr, i, + ts_data->t_hot, + ts_data->t_cold); + if (OMAP_BANDGAP_HAS(bg_ptr, TSHUT_CONFIG)) { + temp_sensor_configure_tshut_hot(bg_ptr, i, + ts_data->tshut_hot); + temp_sensor_configure_tshut_cold(bg_ptr, i, + ts_data->tshut_cold); + } + } + + if (OMAP_BANDGAP_HAS(bg_ptr, MODE_CONFIG)) + enable_continuous_mode(bg_ptr); + + /* Set .250 seconds time as default counter */ + if (OMAP_BANDGAP_HAS(bg_ptr, COUNTER)) + for (i = 0; i < bg_ptr->conf->sensor_count; i++) + configure_temp_sensor_counter(bg_ptr, i, + bg_ptr->clk_rate / 4); + + /* Every thing is good? Then expose the sensors */ + for (i = 0; i < bg_ptr->conf->sensor_count; i++) { + char *domain; + + domain = bg_ptr->conf->sensors[i].domain; + if (bg_ptr->conf->expose_sensor) + bg_ptr->conf->expose_sensor(bg_ptr, i, domain); + + if (bg_ptr->conf->sensors[i].register_cooling) + bg_ptr->conf->sensors[i].register_cooling(bg_ptr, i); + } + + /* + * Enable the Interrupts once everything is set. Otherwise irq handler + * might be called as soon as it is enabled where as rest of framework + * is still getting initialised. + */ + if (OMAP_BANDGAP_HAS(bg_ptr, TALERT)) { + ret = omap_bandgap_talert_init(bg_ptr, pdev); + if (ret) { + dev_err(&pdev->dev, "failed to initialize Talert IRQ\n"); + i = bg_ptr->conf->sensor_count; + goto disable_clk; + } + } + + return 0; + +disable_clk: + clk_disable(bg_ptr->fclock); +put_clks: + clk_put(bg_ptr->fclock); + clk_put(bg_ptr->div_clk); +free_irqs: + if (OMAP_BANDGAP_HAS(bg_ptr, TSHUT)) { + free_irq(gpio_to_irq(bg_ptr->tshut_gpio), NULL); + gpio_free(bg_ptr->tshut_gpio); + } + + return ret; +} + +static +int __devexit omap_bandgap_remove(struct platform_device *pdev) +{ + struct omap_bandgap *bg_ptr = platform_get_drvdata(pdev); + int i; + + /* First thing is to remove sensor interfaces */ + for (i = 0; i < bg_ptr->conf->sensor_count; i++) { + if (bg_ptr->conf->sensors[i].register_cooling) + bg_ptr->conf->sensors[i].unregister_cooling(bg_ptr, i); + + if (bg_ptr->conf->remove_sensor) + bg_ptr->conf->remove_sensor(bg_ptr, i); + } + + omap_bandgap_power(bg_ptr, false); + + clk_disable(bg_ptr->fclock); + clk_put(bg_ptr->fclock); + clk_put(bg_ptr->div_clk); + + if (OMAP_BANDGAP_HAS(bg_ptr, TALERT)) + free_irq(bg_ptr->irq, bg_ptr); + + if (OMAP_BANDGAP_HAS(bg_ptr, TSHUT)) { + free_irq(gpio_to_irq(bg_ptr->tshut_gpio), NULL); + gpio_free(bg_ptr->tshut_gpio); + } + + return 0; +} + +#ifdef CONFIG_PM +static int omap_bandgap_save_ctxt(struct omap_bandgap *bg_ptr) +{ + int i; + + for (i = 0; i < bg_ptr->conf->sensor_count; i++) { + struct temp_sensor_registers *tsr; + struct temp_sensor_regval *rval; + + rval = &bg_ptr->conf->sensors[i].regval; + tsr = bg_ptr->conf->sensors[i].registers; + + if (OMAP_BANDGAP_HAS(bg_ptr, MODE_CONFIG)) + rval->bg_mode_ctrl = omap_bandgap_readl(bg_ptr, + tsr->bgap_mode_ctrl); + if (OMAP_BANDGAP_HAS(bg_ptr, COUNTER)) + rval->bg_counter = omap_bandgap_readl(bg_ptr, + tsr->bgap_counter); + if (OMAP_BANDGAP_HAS(bg_ptr, TALERT)) { + rval->bg_threshold = omap_bandgap_readl(bg_ptr, + tsr->bgap_threshold); + rval->bg_ctrl = omap_bandgap_readl(bg_ptr, + tsr->bgap_mask_ctrl); + } + + if (OMAP_BANDGAP_HAS(bg_ptr, TSHUT_CONFIG)) + rval->tshut_threshold = omap_bandgap_readl(bg_ptr, + tsr->tshut_threshold); + } + + return 0; +} + +static int omap_bandgap_restore_ctxt(struct omap_bandgap *bg_ptr) +{ + int i; + u32 temp = 0; + + for (i = 0; i < bg_ptr->conf->sensor_count; i++) { + struct temp_sensor_registers *tsr; + struct temp_sensor_regval *rval; + u32 val = 0; + + rval = &bg_ptr->conf->sensors[i].regval; + tsr = bg_ptr->conf->sensors[i].registers; + + if (OMAP_BANDGAP_HAS(bg_ptr, COUNTER)) + val = omap_bandgap_readl(bg_ptr, tsr->bgap_counter); + + if (val == 0) { + if (OMAP_BANDGAP_HAS(bg_ptr, TSHUT_CONFIG)) + omap_bandgap_writel(bg_ptr, rval->tshut_threshold, + tsr->tshut_threshold); + /* Force immediate temperature measurement and update + * of the DTEMP field + */ + omap_bandgap_force_single_read(bg_ptr, i); + + if (OMAP_BANDGAP_HAS(bg_ptr, COUNTER)) + omap_bandgap_writel(bg_ptr, rval->bg_counter, + tsr->bgap_counter); + if (OMAP_BANDGAP_HAS(bg_ptr, MODE_CONFIG)) + omap_bandgap_writel(bg_ptr, rval->bg_mode_ctrl, + tsr->bgap_mode_ctrl); + if (OMAP_BANDGAP_HAS(bg_ptr, TALERT)) { + omap_bandgap_writel(bg_ptr, + rval->bg_threshold, + tsr->bgap_threshold); + omap_bandgap_writel(bg_ptr, rval->bg_ctrl, + tsr->bgap_mask_ctrl); + } + } else { + temp = omap_bandgap_readl(bg_ptr, + tsr->temp_sensor_ctrl); + temp &= (tsr->bgap_dtemp_mask); + omap_bandgap_force_single_read(bg_ptr, i); + if (temp == 0 && OMAP_BANDGAP_HAS(bg_ptr, TALERT)) { + temp = omap_bandgap_readl(bg_ptr, + tsr->bgap_mask_ctrl); + temp |= 1 << __ffs(tsr->mode_ctrl_mask); + omap_bandgap_writel(bg_ptr, temp, + tsr->bgap_mask_ctrl); + } + } + } + + return 0; +} + +static int omap_bandgap_suspend(struct device *dev) +{ + struct omap_bandgap *bg_ptr = dev_get_drvdata(dev); + int err; + + err = omap_bandgap_save_ctxt(bg_ptr); + omap_bandgap_power(bg_ptr, false); + clk_disable(bg_ptr->fclock); + + return err; +} + +static int omap_bandgap_resume(struct device *dev) +{ + struct omap_bandgap *bg_ptr = dev_get_drvdata(dev); + + clk_enable(bg_ptr->fclock); + omap_bandgap_power(bg_ptr, true); + + return omap_bandgap_restore_ctxt(bg_ptr); +} +static const struct dev_pm_ops omap_bandgap_dev_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(omap_bandgap_suspend, + omap_bandgap_resume) +}; + +#define DEV_PM_OPS (&omap_bandgap_dev_pm_ops) +#else +#define DEV_PM_OPS NULL +#endif + +static const struct of_device_id of_omap_bandgap_match[] = { + /* Sentinel */ + { }, +}; +MODULE_DEVICE_TABLE(of, of_omap_bandgap_match); + +static struct platform_driver omap_bandgap_sensor_driver = { + .probe = omap_bandgap_probe, + .remove = omap_bandgap_remove, + .driver = { + .name = "omap-bandgap", + .pm = DEV_PM_OPS, + .of_match_table = of_omap_bandgap_match, + }, +}; + +module_platform_driver(omap_bandgap_sensor_driver); + +MODULE_DESCRIPTION("OMAP4+ bandgap temperature sensor driver"); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:omap-bandgap"); +MODULE_AUTHOR("Texas Instrument Inc."); diff --git a/drivers/staging/omap-thermal/omap-bandgap.h b/drivers/staging/omap-thermal/omap-bandgap.h new file mode 100644 index 0000000..8b9883d --- /dev/null +++ b/drivers/staging/omap-thermal/omap-bandgap.h @@ -0,0 +1,425 @@ +/* + * OMAP4 Bandgap temperature sensor driver + * + * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ + * Contact: + * Eduardo Valentin + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ +#ifndef __OMAP_BANDGAP_H +#define __OMAP_BANDGAP_H + +#include +#include +#include + +/* TEMP_SENSOR OMAP4430 */ +#define OMAP4430_BGAP_TSHUT_SHIFT 11 +#define OMAP4430_BGAP_TSHUT_MASK (1 << 11) + +/* TEMP_SENSOR OMAP4430 */ +#define OMAP4430_BGAP_TEMPSOFF_SHIFT 12 +#define OMAP4430_BGAP_TEMPSOFF_MASK (1 << 12) +#define OMAP4430_SINGLE_MODE_SHIFT 10 +#define OMAP4430_SINGLE_MODE_MASK (1 << 10) +#define OMAP4430_BGAP_TEMP_SENSOR_SOC_SHIFT 9 +#define OMAP4430_BGAP_TEMP_SENSOR_SOC_MASK (1 << 9) +#define OMAP4430_BGAP_TEMP_SENSOR_EOCZ_SHIFT 8 +#define OMAP4430_BGAP_TEMP_SENSOR_EOCZ_MASK (1 << 8) +#define OMAP4430_BGAP_TEMP_SENSOR_DTEMP_SHIFT 0 +#define OMAP4430_BGAP_TEMP_SENSOR_DTEMP_MASK (0xff << 0) + +#define OMAP4430_ADC_START_VALUE 0 +#define OMAP4430_ADC_END_VALUE 127 +#define OMAP4430_MAX_FREQ 32768 +#define OMAP4430_MIN_FREQ 32768 +#define OMAP4430_MIN_TEMP -40000 +#define OMAP4430_MAX_TEMP 125000 +#define OMAP4430_HYST_VAL 5000 + +/* TEMP_SENSOR OMAP4460 */ +#define OMAP4460_BGAP_TEMPSOFF_SHIFT 13 +#define OMAP4460_BGAP_TEMPSOFF_MASK (1 << 13) +#define OMAP4460_BGAP_TEMP_SENSOR_SOC_SHIFT 11 +#define OMAP4460_BGAP_TEMP_SENSOR_SOC_MASK (1 << 11) +#define OMAP4460_BGAP_TEMP_SENSOR_EOCZ_SHIFT 10 +#define OMAP4460_BGAP_TEMP_SENSOR_EOCZ_MASK (1 << 10) +#define OMAP4460_BGAP_TEMP_SENSOR_DTEMP_SHIFT 0 +#define OMAP4460_BGAP_TEMP_SENSOR_DTEMP_MASK (0x3ff << 0) + +/* BANDGAP_CTRL */ +#define OMAP4460_SINGLE_MODE_SHIFT 31 +#define OMAP4460_SINGLE_MODE_MASK (1 << 31) +#define OMAP4460_MASK_HOT_SHIFT 1 +#define OMAP4460_MASK_HOT_MASK (1 << 1) +#define OMAP4460_MASK_COLD_SHIFT 0 +#define OMAP4460_MASK_COLD_MASK (1 << 0) + +/* BANDGAP_COUNTER */ +#define OMAP4460_COUNTER_SHIFT 0 +#define OMAP4460_COUNTER_MASK (0xffffff << 0) + +/* BANDGAP_THRESHOLD */ +#define OMAP4460_T_HOT_SHIFT 16 +#define OMAP4460_T_HOT_MASK (0x3ff << 16) +#define OMAP4460_T_COLD_SHIFT 0 +#define OMAP4460_T_COLD_MASK (0x3ff << 0) + +/* TSHUT_THRESHOLD */ +#define OMAP4460_TSHUT_HOT_SHIFT 16 +#define OMAP4460_TSHUT_HOT_MASK (0x3ff << 16) +#define OMAP4460_TSHUT_COLD_SHIFT 0 +#define OMAP4460_TSHUT_COLD_MASK (0x3ff << 0) + +/* BANDGAP_STATUS */ +#define OMAP4460_CLEAN_STOP_SHIFT 3 +#define OMAP4460_CLEAN_STOP_MASK (1 << 3) +#define OMAP4460_BGAP_ALERT_SHIFT 2 +#define OMAP4460_BGAP_ALERT_MASK (1 << 2) +#define OMAP4460_HOT_FLAG_SHIFT 1 +#define OMAP4460_HOT_FLAG_MASK (1 << 1) +#define OMAP4460_COLD_FLAG_SHIFT 0 +#define OMAP4460_COLD_FLAG_MASK (1 << 0) + +/* TEMP_SENSOR OMAP5430 */ +#define OMAP5430_BGAP_TEMP_SENSOR_SOC_SHIFT 12 +#define OMAP5430_BGAP_TEMP_SENSOR_SOC_MASK (1 << 12) +#define OMAP5430_BGAP_TEMPSOFF_SHIFT 11 +#define OMAP5430_BGAP_TEMPSOFF_MASK (1 << 11) +#define OMAP5430_BGAP_TEMP_SENSOR_EOCZ_SHIFT 10 +#define OMAP5430_BGAP_TEMP_SENSOR_EOCZ_MASK (1 << 10) +#define OMAP5430_BGAP_TEMP_SENSOR_DTEMP_SHIFT 0 +#define OMAP5430_BGAP_TEMP_SENSOR_DTEMP_MASK (0x3ff << 0) + +/* BANDGAP_CTRL */ +#define OMAP5430_MASK_HOT_CORE_SHIFT 5 +#define OMAP5430_MASK_HOT_CORE_MASK (1 << 5) +#define OMAP5430_MASK_COLD_CORE_SHIFT 4 +#define OMAP5430_MASK_COLD_CORE_MASK (1 << 4) +#define OMAP5430_MASK_HOT_MM_SHIFT 3 +#define OMAP5430_MASK_HOT_MM_MASK (1 << 3) +#define OMAP5430_MASK_COLD_MM_SHIFT 2 +#define OMAP5430_MASK_COLD_MM_MASK (1 << 2) +#define OMAP5430_MASK_HOT_MPU_SHIFT 1 +#define OMAP5430_MASK_HOT_MPU_MASK (1 << 1) +#define OMAP5430_MASK_COLD_MPU_SHIFT 0 +#define OMAP5430_MASK_COLD_MPU_MASK (1 << 0) + +/* BANDGAP_COUNTER */ +#define OMAP5430_REPEAT_MODE_SHIFT 31 +#define OMAP5430_REPEAT_MODE_MASK (1 << 31) +#define OMAP5430_COUNTER_SHIFT 0 +#define OMAP5430_COUNTER_MASK (0xffffff << 0) + +/* BANDGAP_THRESHOLD */ +#define OMAP5430_T_HOT_SHIFT 16 +#define OMAP5430_T_HOT_MASK (0x3ff << 16) +#define OMAP5430_T_COLD_SHIFT 0 +#define OMAP5430_T_COLD_MASK (0x3ff << 0) + +/* TSHUT_THRESHOLD */ +#define OMAP5430_TSHUT_HOT_SHIFT 16 +#define OMAP5430_TSHUT_HOT_MASK (0x3ff << 16) +#define OMAP5430_TSHUT_COLD_SHIFT 0 +#define OMAP5430_TSHUT_COLD_MASK (0x3ff << 0) + +/* BANDGAP_STATUS */ +#define OMAP5430_BGAP_ALERT_SHIFT 31 +#define OMAP5430_BGAP_ALERT_MASK (1 << 31) +#define OMAP5430_HOT_CORE_FLAG_SHIFT 5 +#define OMAP5430_HOT_CORE_FLAG_MASK (1 << 5) +#define OMAP5430_COLD_CORE_FLAG_SHIFT 4 +#define OMAP5430_COLD_CORE_FLAG_MASK (1 << 4) +#define OMAP5430_HOT_MM_FLAG_SHIFT 3 +#define OMAP5430_HOT_MM_FLAG_MASK (1 << 3) +#define OMAP5430_COLD_MM_FLAG_SHIFT 2 +#define OMAP5430_COLD_MM_FLAG_MASK (1 << 2) +#define OMAP5430_HOT_MPU_FLAG_SHIFT 1 +#define OMAP5430_HOT_MPU_FLAG_MASK (1 << 1) +#define OMAP5430_COLD_MPU_FLAG_SHIFT 0 +#define OMAP5430_COLD_MPU_FLAG_MASK (1 << 0) + +/* Offsets from the base of temperature sensor registers */ + +/* 4430 - All goes relative to OPP_BGAP */ +#define OMAP4430_FUSE_OPP_BGAP 0x0 +#define OMAP4430_TEMP_SENSOR_CTRL_OFFSET 0xCC + +/* 4460 - All goes relative to OPP_BGAP */ +#define OMAP4460_FUSE_OPP_BGAP 0x0 +#define OMAP4460_TEMP_SENSOR_CTRL_OFFSET 0xCC +#define OMAP4460_BGAP_CTRL_OFFSET 0x118 +#define OMAP4460_BGAP_COUNTER_OFFSET 0x11C +#define OMAP4460_BGAP_THRESHOLD_OFFSET 0x120 +#define OMAP4460_BGAP_TSHUT_OFFSET 0x124 +#define OMAP4460_BGAP_STATUS_OFFSET 0x128 + +/* 5430 - All goes relative to OPP_BGAP_GPU */ +#define OMAP5430_FUSE_OPP_BGAP_GPU 0x0 +#define OMAP5430_TEMP_SENSOR_GPU_OFFSET 0x150 +#define OMAP5430_BGAP_COUNTER_GPU_OFFSET 0x1C0 +#define OMAP5430_BGAP_THRESHOLD_GPU_OFFSET 0x1A8 +#define OMAP5430_BGAP_TSHUT_GPU_OFFSET 0x1B4 + +#define OMAP5430_FUSE_OPP_BGAP_MPU 0x4 +#define OMAP5430_TEMP_SENSOR_MPU_OFFSET 0x14C +#define OMAP5430_BGAP_CTRL_OFFSET 0x1A0 +#define OMAP5430_BGAP_COUNTER_MPU_OFFSET 0x1BC +#define OMAP5430_BGAP_THRESHOLD_MPU_OFFSET 0x1A4 +#define OMAP5430_BGAP_TSHUT_MPU_OFFSET 0x1B0 +#define OMAP5430_BGAP_STATUS_OFFSET 0x1C8 + +#define OMAP5430_FUSE_OPP_BGAP_CORE 0x8 +#define OMAP5430_TEMP_SENSOR_CORE_OFFSET 0x154 +#define OMAP5430_BGAP_COUNTER_CORE_OFFSET 0x1C4 +#define OMAP5430_BGAP_THRESHOLD_CORE_OFFSET 0x1AC +#define OMAP5430_BGAP_TSHUT_CORE_OFFSET 0x1B8 + +#define OMAP4460_TSHUT_HOT 900 /* 122 deg C */ +#define OMAP4460_TSHUT_COLD 895 /* 100 deg C */ +#define OMAP4460_T_HOT 800 /* 73 deg C */ +#define OMAP4460_T_COLD 795 /* 71 deg C */ +#define OMAP4460_MAX_FREQ 1500000 +#define OMAP4460_MIN_FREQ 1000000 +#define OMAP4460_MIN_TEMP -40000 +#define OMAP4460_MAX_TEMP 123000 +#define OMAP4460_HYST_VAL 5000 +#define OMAP4460_ADC_START_VALUE 530 +#define OMAP4460_ADC_END_VALUE 932 + +#define OMAP5430_MPU_TSHUT_HOT 915 +#define OMAP5430_MPU_TSHUT_COLD 900 +#define OMAP5430_MPU_T_HOT 800 +#define OMAP5430_MPU_T_COLD 795 +#define OMAP5430_MPU_MAX_FREQ 1500000 +#define OMAP5430_MPU_MIN_FREQ 1000000 +#define OMAP5430_MPU_MIN_TEMP -40000 +#define OMAP5430_MPU_MAX_TEMP 125000 +#define OMAP5430_MPU_HYST_VAL 5000 +#define OMAP5430_ADC_START_VALUE 532 +#define OMAP5430_ADC_END_VALUE 934 + + +#define OMAP5430_GPU_TSHUT_HOT 915 +#define OMAP5430_GPU_TSHUT_COLD 900 +#define OMAP5430_GPU_T_HOT 800 +#define OMAP5430_GPU_T_COLD 795 +#define OMAP5430_GPU_MAX_FREQ 1500000 +#define OMAP5430_GPU_MIN_FREQ 1000000 +#define OMAP5430_GPU_MIN_TEMP -40000 +#define OMAP5430_GPU_MAX_TEMP 125000 +#define OMAP5430_GPU_HYST_VAL 5000 + +#define OMAP5430_CORE_TSHUT_HOT 915 +#define OMAP5430_CORE_TSHUT_COLD 900 +#define OMAP5430_CORE_T_HOT 800 +#define OMAP5430_CORE_T_COLD 795 +#define OMAP5430_CORE_MAX_FREQ 1500000 +#define OMAP5430_CORE_MIN_FREQ 1000000 +#define OMAP5430_CORE_MIN_TEMP -40000 +#define OMAP5430_CORE_MAX_TEMP 125000 +#define OMAP5430_CORE_HYST_VAL 5000 + +/** + * The register offsets and bit fields might change across + * OMAP versions hence populating them in this structure. + */ + +struct temp_sensor_registers { + u32 temp_sensor_ctrl; + u32 bgap_tempsoff_mask; + u32 bgap_soc_mask; + u32 bgap_eocz_mask; + u32 bgap_dtemp_mask; + + u32 bgap_mask_ctrl; + u32 mask_hot_mask; + u32 mask_cold_mask; + + u32 bgap_mode_ctrl; + u32 mode_ctrl_mask; + + u32 bgap_counter; + u32 counter_mask; + + u32 bgap_threshold; + u32 threshold_thot_mask; + u32 threshold_tcold_mask; + + u32 tshut_threshold; + u32 tshut_hot_mask; + u32 tshut_cold_mask; + + u32 bgap_status; + u32 status_clean_stop_mask; + u32 status_bgap_alert_mask; + u32 status_hot_mask; + u32 status_cold_mask; + + u32 bgap_efuse; +}; + +/** + * The thresholds and limits for temperature sensors. + */ +struct temp_sensor_data { + u32 tshut_hot; + u32 tshut_cold; + u32 t_hot; + u32 t_cold; + u32 min_freq; + u32 max_freq; + int max_temp; + int min_temp; + int hyst_val; + u32 adc_start_val; + u32 adc_end_val; + u32 update_int1; + u32 update_int2; +}; + +struct omap_bandgap_data; + +/** + * struct omap_bandgap - bandgap device structure + * @dev: device pointer + * @conf: platform data with sensor data + * @fclock: pointer to functional clock of temperature sensor + * @div_clk: pointer to parent clock of temperature sensor fclk + * @conv_table: Pointer to adc to temperature conversion table + * @bg_mutex: Mutex for sysfs, irq and PM + * @irq: MPU Irq number for thermal alert + * @tshut_gpio: GPIO where Tshut signal is routed + * @clk_rate: Holds current clock rate + */ +struct omap_bandgap { + struct device *dev; + void __iomem *base; + struct omap_bandgap_data *conf; + struct clk *fclock; + struct clk *div_clk; + const int *conv_table; + struct mutex bg_mutex; /* Mutex for irq and PM */ + int irq; + int tshut_gpio; + u32 clk_rate; +}; + +/** + * struct temp_sensor_regval - temperature sensor register values + * @bg_mode_ctrl: temp sensor control register value + * @bg_ctrl: bandgap ctrl register value + * @bg_counter: bandgap counter value + * @bg_threshold: bandgap threshold register value + * @tshut_threshold: bandgap tshut register value + */ +struct temp_sensor_regval { + u32 bg_mode_ctrl; + u32 bg_ctrl; + u32 bg_counter; + u32 bg_threshold; + u32 tshut_threshold; +}; + +/** + * struct thermal_cooling_conf - description on how to cool a thermal zone + * @freq_clip_count: size of freq_data + */ +struct thermal_cooling_conf { + int freq_clip_count; +}; + +/** + * struct omap_temp_sensor - bandgap temperature sensor platform data + * @ts_data: pointer to struct with thresholds, limits of temperature sensor + * @registers: pointer to the list of register offsets and bitfields + * @regval: temperature sensor register values + * @domain: the name of the domain where the sensor is located + * @cooling_data: description on how the zone should be cooled off. + * @slope: sensor gradient slope info for hotspot extrapolation + * @const: sensor gradient const info for hotspot extrapolation + * @slope_pcb: sensor gradient slope info for hotspot extrapolation + * with no external influence + * @const_pcb: sensor gradient const info for hotspot extrapolation + * with no external influence + * @data: private data + * @register_cooling: function to describe how this sensor is going to be cooled + * @unregister_cooling: function to release cooling data + */ +struct omap_temp_sensor { + struct temp_sensor_data *ts_data; + struct temp_sensor_registers *registers; + struct temp_sensor_regval regval; + char *domain; + struct thermal_cooling_conf cooling_data; + /* for hotspot extrapolation */ + const int slope; + const int constant; + const int slope_pcb; + const int constant_pcb; + void *data; + int (*register_cooling)(struct omap_bandgap *bg_ptr, int id); + int (*unregister_cooling)(struct omap_bandgap *bg_ptr, int id); +}; + +/** + * struct omap_bandgap_data - bandgap platform data structure + * @features: a bitwise flag set to describe the device features + * @conv_table: Pointer to adc to temperature conversion table + * @fclock_name: clock name of the functional clock + * @div_ck_nme: clock name of the clock divisor + * @sensor_count: count of temperature sensor device in scm + * @sensors: array of sensors present in this bandgap instance + * @expose_sensor: callback to export sensor to thermal API + */ +struct omap_bandgap_data { +#define OMAP_BANDGAP_FEATURE_TSHUT (1 << 0) +#define OMAP_BANDGAP_FEATURE_TSHUT_CONFIG (1 << 1) +#define OMAP_BANDGAP_FEATURE_TALERT (1 << 2) +#define OMAP_BANDGAP_FEATURE_MODE_CONFIG (1 << 3) +#define OMAP_BANDGAP_FEATURE_COUNTER (1 << 4) +#define OMAP_BANDGAP_FEATURE_POWER_SWITCH (1 << 5) +#define OMAP_BANDGAP_HAS(b, f) \ + ((b)->conf->features & OMAP_BANDGAP_FEATURE_ ## f) + unsigned int features; + const int *conv_table; + char *fclock_name; + char *div_ck_name; + int sensor_count; + int (*report_temperature)(struct omap_bandgap *bg_ptr, int id); + int (*expose_sensor)(struct omap_bandgap *bg_ptr, int id, char *domain); + int (*remove_sensor)(struct omap_bandgap *bg_ptr, int id); + + /* this needs to be at the end */ + struct omap_temp_sensor sensors[]; +}; + +int omap_bandgap_read_thot(struct omap_bandgap *bg_ptr, int id, int *thot); +int omap_bandgap_write_thot(struct omap_bandgap *bg_ptr, int id, int val); +int omap_bandgap_read_tcold(struct omap_bandgap *bg_ptr, int id, int *tcold); +int omap_bandgap_write_tcold(struct omap_bandgap *bg_ptr, int id, int val); +int omap_bandgap_read_update_interval(struct omap_bandgap *bg_ptr, int id, + int *interval); +int omap_bandgap_write_update_interval(struct omap_bandgap *bg_ptr, int id, + u32 interval); +int omap_bandgap_read_temperature(struct omap_bandgap *bg_ptr, int id, + int *temperature); +int omap_bandgap_set_sensor_data(struct omap_bandgap *bg_ptr, int id, + void *data); +void *omap_bandgap_get_sensor_data(struct omap_bandgap *bg_ptr, int id); + +#endif diff --git a/drivers/staging/omap-thermal/omap_bandgap.txt b/drivers/staging/omap-thermal/omap_bandgap.txt new file mode 100644 index 0000000..6008a14 --- /dev/null +++ b/drivers/staging/omap-thermal/omap_bandgap.txt @@ -0,0 +1,30 @@ +* Texas Instrument OMAP SCM bandgap bindings + +In the System Control Module, OMAP supplies a voltage reference +and a temperature sensor feature that are gathered in the band +gap voltage and temperature sensor (VBGAPTS) module. The band +gap provides current and voltage reference for its internal +circuits and other analog IP blocks. The analog-to-digital +converter (ADC) produces an output value that is proportional +to the silicon temperature. + +Required properties: +- compatible : Should be: + - "ti,omap4460-control-bandgap" : for OMAP4460 bandgap + - "ti,omap5430-control-bandgap" : for OMAP5430 bandgap +- interrupts : this entry should indicate which interrupt line +the talert signal is routed to; +Specific: +- ti,tshut-gpio : this entry should be used to inform which GPIO +line the tshut signal is routed to; + +Example: + +bandgap { + reg = <0x4a002260 0x4 + 0x4a00232C 0x4 + 0x4a002378 0x18>; + compatible = "ti,omap4460-control-bandgap"; + interrupts = <0 126 4>; /* talert */ + ti,tshut-gpio = <86>; +}; -- cgit v0.10.2 From 445eaf871bf94eb496b9b610e35b9e8c8830219f Mon Sep 17 00:00:00 2001 From: Eduardo Valentin Date: Thu, 12 Jul 2012 19:02:30 +0300 Subject: staging: omap-thermal: common code to expose driver to thermal framework This patch has the common thermal framework support for OMAP bandgap driver. It includes the zone registration and unregistration, the cpu cooling and the trip definitions. The trips definition is essentially one trip for passive cooling using the generic cpu cooling device and another one for thermal shutdown. The cpu cooling device is built based on the existing cpu freq table. The build should be agnostic to omap version, but relies that cpufreq is up and running by the time the driver registers the cpu cooling, as it relies on the table walk api from cpufreq. Signed-off-by: Eduardo Valentin Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/omap-thermal/Kconfig b/drivers/staging/omap-thermal/Kconfig index 8c9979d..f44228c 100644 --- a/drivers/staging/omap-thermal/Kconfig +++ b/drivers/staging/omap-thermal/Kconfig @@ -9,3 +9,12 @@ config OMAP_BANDGAP This includes alert interrupts generation and also the TSHUT support. + +config OMAP_THERMAL + bool "Texas Instruments OMAP4+ thermal framework support" + depends on OMAP_BANDGAP + depends on CPU_THERMAL + help + If you say yes here you want to get support for generic thermal + framework for the Texas Instruments OMAP4460+ on die bandgap + temperature sensor. diff --git a/drivers/staging/omap-thermal/Makefile b/drivers/staging/omap-thermal/Makefile index c92a854..fcdf773 100644 --- a/drivers/staging/omap-thermal/Makefile +++ b/drivers/staging/omap-thermal/Makefile @@ -1,2 +1,3 @@ obj-$(CONFIG_OMAP_BANDGAP) += omap-thermal.o omap-thermal-y := omap-bandgap.o +omap-thermal-$(CONFIG_OMAP_THERMAL) += omap-thermal-common.o diff --git a/drivers/staging/omap-thermal/omap-thermal-common.c b/drivers/staging/omap-thermal/omap-thermal-common.c new file mode 100644 index 0000000..0675a5e --- /dev/null +++ b/drivers/staging/omap-thermal/omap-thermal-common.c @@ -0,0 +1,364 @@ +/* + * OMAP thermal driver interface + * + * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ + * Contact: + * Eduardo Valentin + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "omap-thermal.h" +#include "omap-bandgap.h" + +/* common data structures */ +struct omap_thermal_data { + struct thermal_zone_device *omap_thermal; + struct thermal_cooling_device *cool_dev; + struct omap_bandgap *bg_ptr; + enum thermal_device_mode mode; + struct work_struct thermal_wq; + int sensor_id; +}; + +static void omap_thermal_work(struct work_struct *work) +{ + struct omap_thermal_data *data = container_of(work, + struct omap_thermal_data, thermal_wq); + + thermal_zone_device_update(data->omap_thermal); + + dev_dbg(&data->omap_thermal->device, "updated thermal zone %s\n", + data->omap_thermal->type); +} + +/** + * omap_thermal_hotspot_temperature - returns sensor extrapolated temperature + * @t: omap sensor temperature + * @s: omap sensor slope value + * @c: omap sensor const value + */ +static inline int omap_thermal_hotspot_temperature(int t, int s, int c) +{ + int delta = t * s / 1000 + c; + + if (delta < 0) + delta = 0; + + return t + delta; +} + +/* thermal zone ops */ +/* Get temperature callback function for thermal zone*/ +static inline int omap_thermal_get_temp(struct thermal_zone_device *thermal, + unsigned long *temp) +{ + struct omap_thermal_data *data = thermal->devdata; + struct omap_bandgap *bg_ptr = data->bg_ptr; + struct omap_temp_sensor *s = &bg_ptr->conf->sensors[data->sensor_id]; + int ret, tmp, pcb_temp, slope, constant; + + ret = omap_bandgap_read_temperature(bg_ptr, data->sensor_id, &tmp); + if (ret) + return ret; + + pcb_temp = 0; + /* TODO: Introduce pcb temperature lookup */ + /* In case pcb zone is available, use the extrapolation rule with it */ + if (pcb_temp) { + tmp -= pcb_temp; + slope = s->slope_pcb; + constant = s->constant_pcb; + } else { + slope = s->slope; + constant = s->constant; + } + *temp = omap_thermal_hotspot_temperature(tmp, slope, constant); + + return ret; +} + +/* Bind callback functions for thermal zone */ +static int omap_thermal_bind(struct thermal_zone_device *thermal, + struct thermal_cooling_device *cdev) +{ + struct omap_thermal_data *data = thermal->devdata; + int max, id; + + if (IS_ERR_OR_NULL(data)) + return -ENODEV; + + /* check if this is the cooling device we registered */ + if (data->cool_dev != cdev) + return 0; + + id = data->sensor_id; + max = data->bg_ptr->conf->sensors[id].cooling_data.freq_clip_count; + + /* TODO: bind with min and max states */ + /* Simple thing, two trips, one passive another critical */ + return thermal_zone_bind_cooling_device(thermal, 0, cdev); +} + +/* Unbind callback functions for thermal zone */ +static int omap_thermal_unbind(struct thermal_zone_device *thermal, + struct thermal_cooling_device *cdev) +{ + struct omap_thermal_data *data = thermal->devdata; + + if (IS_ERR_OR_NULL(data)) + return -ENODEV; + + /* check if this is the cooling device we registered */ + if (data->cool_dev != cdev) + return 0; + + /* Simple thing, two trips, one passive another critical */ + return thermal_zone_unbind_cooling_device(thermal, 0, cdev); +} + +/* Get mode callback functions for thermal zone */ +static int omap_thermal_get_mode(struct thermal_zone_device *thermal, + enum thermal_device_mode *mode) +{ + struct omap_thermal_data *data = thermal->devdata; + + if (data) + *mode = data->mode; + + return 0; +} + +/* Set mode callback functions for thermal zone */ +static int omap_thermal_set_mode(struct thermal_zone_device *thermal, + enum thermal_device_mode mode) +{ + struct omap_thermal_data *data = thermal->devdata; + + if (!data->omap_thermal) { + dev_notice(&thermal->device, "thermal zone not registered\n"); + return 0; + } + + mutex_lock(&data->omap_thermal->lock); + + if (mode == THERMAL_DEVICE_ENABLED) + data->omap_thermal->polling_delay = FAST_TEMP_MONITORING_RATE; + else + data->omap_thermal->polling_delay = 0; + + mutex_unlock(&data->omap_thermal->lock); + + data->mode = mode; + thermal_zone_device_update(data->omap_thermal); + dev_dbg(&thermal->device, "thermal polling set for duration=%d msec\n", + data->omap_thermal->polling_delay); + + return 0; +} + +/* Get trip type callback functions for thermal zone */ +static int omap_thermal_get_trip_type(struct thermal_zone_device *thermal, + int trip, enum thermal_trip_type *type) +{ + if (!omap_thermal_is_valid_trip(trip)) + return -EINVAL; + + if (trip + 1 == OMAP_TRIP_NUMBER) + *type = THERMAL_TRIP_CRITICAL; + else + *type = THERMAL_TRIP_PASSIVE; + + return 0; +} + +/* Get trip temperature callback functions for thermal zone */ +static int omap_thermal_get_trip_temp(struct thermal_zone_device *thermal, + int trip, unsigned long *temp) +{ + if (!omap_thermal_is_valid_trip(trip)) + return -EINVAL; + + *temp = omap_thermal_get_trip_value(trip); + + return 0; +} + +/* Get critical temperature callback functions for thermal zone */ +static int omap_thermal_get_crit_temp(struct thermal_zone_device *thermal, + unsigned long *temp) +{ + /* shutdown zone */ + return omap_thermal_get_trip_temp(thermal, OMAP_TRIP_NUMBER - 1, temp); +} + +static struct thermal_zone_device_ops omap_thermal_ops = { + .get_temp = omap_thermal_get_temp, + /* TODO: add .get_trend */ + .bind = omap_thermal_bind, + .unbind = omap_thermal_unbind, + .get_mode = omap_thermal_get_mode, + .set_mode = omap_thermal_set_mode, + .get_trip_type = omap_thermal_get_trip_type, + .get_trip_temp = omap_thermal_get_trip_temp, + .get_crit_temp = omap_thermal_get_crit_temp, +}; + +int omap_thermal_expose_sensor(struct omap_bandgap *bg_ptr, int id, + char *domain) +{ + struct omap_thermal_data *data; + + data = devm_kzalloc(bg_ptr->dev, sizeof(*data), GFP_KERNEL); + if (!data) { + dev_err(bg_ptr->dev, "kzalloc fail\n"); + return -ENOMEM; + } + data->sensor_id = id; + data->bg_ptr = bg_ptr; + data->mode = THERMAL_DEVICE_ENABLED; + INIT_WORK(&data->thermal_wq, omap_thermal_work); + + /* TODO: remove TC1 TC2 */ + /* Create thermal zone */ + data->omap_thermal = thermal_zone_device_register(domain, + OMAP_TRIP_NUMBER, 0, data, &omap_thermal_ops, + 0, FAST_TEMP_MONITORING_RATE, 0, 0); + if (IS_ERR_OR_NULL(data->omap_thermal)) { + dev_err(bg_ptr->dev, "thermal zone device is NULL\n"); + return PTR_ERR(data->omap_thermal); + } + data->omap_thermal->polling_delay = FAST_TEMP_MONITORING_RATE; + omap_bandgap_set_sensor_data(bg_ptr, id, data); + + return 0; +} + +int omap_thermal_remove_sensor(struct omap_bandgap *bg_ptr, int id) +{ + struct omap_thermal_data *data; + + data = omap_bandgap_get_sensor_data(bg_ptr, id); + + thermal_zone_device_unregister(data->omap_thermal); + + return 0; +} + +int omap_thermal_report_sensor_temperature(struct omap_bandgap *bg_ptr, int id) +{ + struct omap_thermal_data *data; + + data = omap_bandgap_get_sensor_data(bg_ptr, id); + + schedule_work(&data->thermal_wq); + + return 0; +} + +static int omap_thermal_build_cpufreq_clip(struct omap_bandgap *bg_ptr, + struct freq_clip_table **tab_ptr, + int *tab_size) +{ + struct cpufreq_frequency_table *freq_table; + struct freq_clip_table *tab; + int i, count = 0; + + freq_table = cpufreq_frequency_get_table(0); + if (IS_ERR_OR_NULL(freq_table)) { + dev_err(bg_ptr->dev, + "%s: failed to get cpufreq table (%p)\n", + __func__, freq_table); + return -EINVAL; + } + + for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) { + unsigned int freq = freq_table[i].frequency; + if (freq == CPUFREQ_ENTRY_INVALID) + continue; + count++; + } + + tab = devm_kzalloc(bg_ptr->dev, sizeof(*tab) * count, GFP_KERNEL); + if (!tab) { + dev_err(bg_ptr->dev, + "%s: no memory available\n", __func__); + return -ENOMEM; + } + + for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) { + unsigned int freq = freq_table[i].frequency; + + if (freq == CPUFREQ_ENTRY_INVALID) + continue; + + tab[count - i - 1].freq_clip_max = freq; + tab[count - i - 1].temp_level = OMAP_TRIP_HOT; + tab[count - i - 1].mask_val = cpumask_of(0); + } + + *tab_ptr = tab; + *tab_size = count; + + return 0; +} + +int omap_thermal_register_cpu_cooling(struct omap_bandgap *bg_ptr, int id) +{ + struct omap_thermal_data *data; + struct freq_clip_table *tab_ptr; + int tab_size, ret; + + data = omap_bandgap_get_sensor_data(bg_ptr, id); + + ret = omap_thermal_build_cpufreq_clip(bg_ptr, &tab_ptr, &tab_size); + if (ret < 0) { + dev_err(bg_ptr->dev, + "%s: failed to build cpufreq clip table\n", __func__); + return ret; + } + + /* Register cooling device */ + data->cool_dev = cpufreq_cooling_register(tab_ptr, tab_size); + if (IS_ERR_OR_NULL(data->cool_dev)) { + dev_err(bg_ptr->dev, + "Failed to register cpufreq cooling device\n"); + return PTR_ERR(data->cool_dev); + } + bg_ptr->conf->sensors[id].cooling_data.freq_clip_count = tab_size; + + return 0; +} + +int omap_thermal_unregister_cpu_cooling(struct omap_bandgap *bg_ptr, int id) +{ + struct omap_thermal_data *data; + + data = omap_bandgap_get_sensor_data(bg_ptr, id); + cpufreq_cooling_unregister(data->cool_dev); + + return 0; +} diff --git a/drivers/staging/omap-thermal/omap-thermal.h b/drivers/staging/omap-thermal/omap-thermal.h new file mode 100644 index 0000000..0dd2184 --- /dev/null +++ b/drivers/staging/omap-thermal/omap-thermal.h @@ -0,0 +1,108 @@ +/* + * OMAP thermal definitions + * + * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ + * Contact: + * Eduardo Valentin + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ +#ifndef __OMAP_THERMAL_H +#define __OMAP_THERMAL_H + +#include "omap-bandgap.h" + +/* sensors gradient and offsets */ +#define OMAP_GRADIENT_SLOPE_4460 348 +#define OMAP_GRADIENT_CONST_4460 -9301 +#define OMAP_GRADIENT_SLOPE_4470 308 +#define OMAP_GRADIENT_CONST_4470 -7896 + +#define OMAP_GRADIENT_SLOPE_5430_CPU 196 +#define OMAP_GRADIENT_CONST_5430_CPU -6822 +#define OMAP_GRADIENT_SLOPE_5430_GPU 64 +#define OMAP_GRADIENT_CONST_5430_GPU 978 + +/* PCB sensor calculation constants */ +#define OMAP_GRADIENT_SLOPE_W_PCB_4460 1142 +#define OMAP_GRADIENT_CONST_W_PCB_4460 -393 +#define OMAP_GRADIENT_SLOPE_W_PCB_4470 1063 +#define OMAP_GRADIENT_CONST_W_PCB_4470 -477 + +#define OMAP_GRADIENT_SLOPE_W_PCB_5430_CPU 469 +#define OMAP_GRADIENT_CONST_W_PCB_5430_CPU -1272 +#define OMAP_GRADIENT_SLOPE_W_PCB_5430_GPU 378 +#define OMAP_GRADIENT_CONST_W_PCB_5430_GPU 154 + +/* trip points of interest in milicelsius (at hotspot level) */ +#define OMAP_TRIP_COLD 100000 +#define OMAP_TRIP_HOT 110000 +#define OMAP_TRIP_SHUTDOWN 125000 +#define OMAP_TRIP_NUMBER 2 +#define OMAP_TRIP_STEP \ + ((OMAP_TRIP_SHUTDOWN - OMAP_TRIP_HOT) / (OMAP_TRIP_NUMBER - 1)) + +/* Update rates */ +#define FAST_TEMP_MONITORING_RATE 250 + +/* helper macros */ +/** + * omap_thermal_get_trip_value - returns trip temperature based on index + * @i: trip index + */ +#define omap_thermal_get_trip_value(i) \ + (OMAP_TRIP_HOT + ((i) * OMAP_TRIP_STEP)) + +/** + * omap_thermal_is_valid_trip - check for trip index + * @i: trip index + */ +#define omap_thermal_is_valid_trip(trip) \ + ((trip) >= 0 && (trip) < OMAP_TRIP_NUMBER) + +#ifdef CONFIG_OMAP_THERMAL +int omap_thermal_expose_sensor(struct omap_bandgap *bg_ptr, int id, + char *domain); +int omap_thermal_remove_sensor(struct omap_bandgap *bg_ptr, int id); +int omap_thermal_register_cpu_cooling(struct omap_bandgap *bg_ptr, int id); +int omap_thermal_unregister_cpu_cooling(struct omap_bandgap *bg_ptr, int id); +#else +static inline +int omap_thermal_expose_sensor(struct omap_bandgap *bg_ptr, int id, + char *domain) +{ + return 0; +} + +static inline +int omap_thermal_remove_sensor(struct omap_bandgap *bg_ptr, int id) +{ + return 0; +} + +static inline +int omap_thermal_register_cpu_cooling(struct omap_bandgap *bg_ptr, int id) +{ + return 0; +} + +static inline +int omap_thermal_unregister_cpu_cooling(struct omap_bandgap *bg_ptr, int id) +{ + return 0; +} +#endif +#endif -- cgit v0.10.2 From 1a31270e54d7f2af76d0727ca7e99950a44c80b0 Mon Sep 17 00:00:00 2001 From: Eduardo Valentin Date: Thu, 12 Jul 2012 19:02:31 +0300 Subject: staging: omap-thermal: add OMAP4 data structures This patch adds the data structures needed for proper registration of OMAP4 chips. This patch includes definitions for these chip versions: . OMAP4430 . OMAP4460 . OMAP4470 Signed-off-by: Eduardo Valentin Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/omap-thermal/Kconfig b/drivers/staging/omap-thermal/Kconfig index f44228c..b0105d2 100644 --- a/drivers/staging/omap-thermal/Kconfig +++ b/drivers/staging/omap-thermal/Kconfig @@ -18,3 +18,17 @@ config OMAP_THERMAL If you say yes here you want to get support for generic thermal framework for the Texas Instruments OMAP4460+ on die bandgap temperature sensor. + +config OMAP4_THERMAL + bool "Texas Instruments OMAP4 thermal support" + depends on OMAP_BANDGAP + depends on ARCH_OMAP4 + help + If you say yes here you get thermal support for the Texas Instruments + OMAP4 SoC family. The current chip supported are: + - OMAP4430 + - OMAP4460 + - OMAP4470 + + This includes alert interrupts generation and also the TSHUT + support. diff --git a/drivers/staging/omap-thermal/Makefile b/drivers/staging/omap-thermal/Makefile index fcdf773..76f9c19 100644 --- a/drivers/staging/omap-thermal/Makefile +++ b/drivers/staging/omap-thermal/Makefile @@ -1,3 +1,4 @@ obj-$(CONFIG_OMAP_BANDGAP) += omap-thermal.o omap-thermal-y := omap-bandgap.o omap-thermal-$(CONFIG_OMAP_THERMAL) += omap-thermal-common.o +omap-thermal-$(CONFIG_OMAP4_THERMAL) += omap4-thermal.o diff --git a/drivers/staging/omap-thermal/omap-bandgap.c b/drivers/staging/omap-thermal/omap-bandgap.c index 8ea6264..5158aa8 100644 --- a/drivers/staging/omap-thermal/omap-bandgap.c +++ b/drivers/staging/omap-thermal/omap-bandgap.c @@ -1144,6 +1144,20 @@ static const struct dev_pm_ops omap_bandgap_dev_pm_ops = { #endif static const struct of_device_id of_omap_bandgap_match[] = { +#ifdef CONFIG_OMAP4_THERMAL + { + .compatible = "ti,omap4430-bandgap", + .data = (void *)&omap4430_data, + }, + { + .compatible = "ti,omap4460-bandgap", + .data = (void *)&omap4460_data, + }, + { + .compatible = "ti,omap4470-bandgap", + .data = (void *)&omap4470_data, + }, +#endif /* Sentinel */ { }, }; diff --git a/drivers/staging/omap-thermal/omap-bandgap.h b/drivers/staging/omap-thermal/omap-bandgap.h index 8b9883d..6d442fe 100644 --- a/drivers/staging/omap-thermal/omap-bandgap.h +++ b/drivers/staging/omap-thermal/omap-bandgap.h @@ -422,4 +422,14 @@ int omap_bandgap_set_sensor_data(struct omap_bandgap *bg_ptr, int id, void *data); void *omap_bandgap_get_sensor_data(struct omap_bandgap *bg_ptr, int id); +#ifdef CONFIG_OMAP4_THERMAL +extern const struct omap_bandgap_data omap4430_data; +extern const struct omap_bandgap_data omap4460_data; +extern const struct omap_bandgap_data omap4470_data; +#else +#define omap4430_data NULL +#define omap4460_data NULL +#define omap4470_data NULL +#endif + #endif diff --git a/drivers/staging/omap-thermal/omap4-thermal.c b/drivers/staging/omap-thermal/omap4-thermal.c new file mode 100644 index 0000000..fa9dbcd --- /dev/null +++ b/drivers/staging/omap-thermal/omap4-thermal.c @@ -0,0 +1,259 @@ +/* + * OMAP4 thermal driver. + * + * Copyright (C) 2011-2012 Texas Instruments Inc. + * Contact: + * Eduardo Valentin + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * 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. + * + */ + +#include "omap-thermal.h" +#include "omap-bandgap.h" + +/* + * OMAP4430 has one instance of thermal sensor for MPU + * need to describe the individual bit fields + */ +static struct temp_sensor_registers +omap4430_mpu_temp_sensor_registers = { + .temp_sensor_ctrl = OMAP4430_TEMP_SENSOR_CTRL_OFFSET, + .bgap_tempsoff_mask = OMAP4430_BGAP_TEMPSOFF_MASK, + .bgap_soc_mask = OMAP4430_BGAP_TEMP_SENSOR_SOC_MASK, + .bgap_eocz_mask = OMAP4430_BGAP_TEMP_SENSOR_EOCZ_MASK, + .bgap_dtemp_mask = OMAP4430_BGAP_TEMP_SENSOR_DTEMP_MASK, + + .bgap_mode_ctrl = OMAP4430_TEMP_SENSOR_CTRL_OFFSET, + .mode_ctrl_mask = OMAP4430_SINGLE_MODE_MASK, + + .bgap_efuse = OMAP4430_FUSE_OPP_BGAP, +}; + +/* Thresholds and limits for OMAP4430 MPU temperature sensor */ +static struct temp_sensor_data omap4430_mpu_temp_sensor_data = { + .min_freq = OMAP4430_MIN_FREQ, + .max_freq = OMAP4430_MAX_FREQ, + .max_temp = OMAP4430_MAX_TEMP, + .min_temp = OMAP4430_MIN_TEMP, + .hyst_val = OMAP4430_HYST_VAL, + .adc_start_val = OMAP4430_ADC_START_VALUE, + .adc_end_val = OMAP4430_ADC_END_VALUE, +}; + +/* + * Temperature values in milli degree celsius + * ADC code values from 530 to 923 + */ +static const int +omap4430_adc_to_temp[OMAP4430_ADC_END_VALUE - OMAP4430_ADC_START_VALUE + 1] = { + -38000, -35000, -34000, -32000, -30000, -28000, -26000, -24000, -22000, + -20000, -18000, -17000, -15000, -13000, -12000, -10000, -8000, -6000, + -5000, -3000, -1000, 0, 2000, 3000, 5000, 6000, 8000, 10000, 12000, + 13000, 15000, 17000, 19000, 21000, 23000, 25000, 27000, 28000, 30000, + 32000, 33000, 35000, 37000, 38000, 40000, 42000, 43000, 45000, 47000, + 48000, 50000, 52000, 53000, 55000, 57000, 58000, 60000, 62000, 64000, + 66000, 68000, 70000, 71000, 73000, 75000, 77000, 78000, 80000, 82000, + 83000, 85000, 87000, 88000, 90000, 92000, 93000, 95000, 97000, 98000, + 100000, 102000, 103000, 105000, 107000, 109000, 111000, 113000, 115000, + 117000, 118000, 120000, 122000, 123000, +}; + +/* OMAP4430 data */ +const struct omap_bandgap_data omap4430_data = { + .features = OMAP_BANDGAP_FEATURE_MODE_CONFIG | + OMAP_BANDGAP_FEATURE_POWER_SWITCH, + .fclock_name = "bandgap_fclk", + .div_ck_name = "bandgap_fclk", + .conv_table = omap4430_adc_to_temp, + .expose_sensor = omap_thermal_expose_sensor, + .remove_sensor = omap_thermal_remove_sensor, + .sensors = { + { + .registers = &omap4430_mpu_temp_sensor_registers, + .ts_data = &omap4430_mpu_temp_sensor_data, + .domain = "cpu", + .slope = 0, + .constant = 20000, + .slope_pcb = 0, + .constant_pcb = 20000, + .register_cooling = omap_thermal_register_cpu_cooling, + .unregister_cooling = omap_thermal_unregister_cpu_cooling, + }, + }, + .sensor_count = 1, +}; +/* + * OMAP4460 has one instance of thermal sensor for MPU + * need to describe the individual bit fields + */ +static struct temp_sensor_registers +omap4460_mpu_temp_sensor_registers = { + .temp_sensor_ctrl = OMAP4460_TEMP_SENSOR_CTRL_OFFSET, + .bgap_tempsoff_mask = OMAP4460_BGAP_TEMPSOFF_MASK, + .bgap_soc_mask = OMAP4460_BGAP_TEMP_SENSOR_SOC_MASK, + .bgap_eocz_mask = OMAP4460_BGAP_TEMP_SENSOR_EOCZ_MASK, + .bgap_dtemp_mask = OMAP4460_BGAP_TEMP_SENSOR_DTEMP_MASK, + + .bgap_mask_ctrl = OMAP4460_BGAP_CTRL_OFFSET, + .mask_hot_mask = OMAP4460_MASK_HOT_MASK, + .mask_cold_mask = OMAP4460_MASK_COLD_MASK, + + .bgap_mode_ctrl = OMAP4460_BGAP_CTRL_OFFSET, + .mode_ctrl_mask = OMAP4460_SINGLE_MODE_MASK, + + .bgap_counter = OMAP4460_BGAP_COUNTER_OFFSET, + .counter_mask = OMAP4460_COUNTER_MASK, + + .bgap_threshold = OMAP4460_BGAP_THRESHOLD_OFFSET, + .threshold_thot_mask = OMAP4460_T_HOT_MASK, + .threshold_tcold_mask = OMAP4460_T_COLD_MASK, + + .tshut_threshold = OMAP4460_BGAP_TSHUT_OFFSET, + .tshut_hot_mask = OMAP4460_TSHUT_HOT_MASK, + .tshut_cold_mask = OMAP4460_TSHUT_COLD_MASK, + + .bgap_status = OMAP4460_BGAP_STATUS_OFFSET, + .status_clean_stop_mask = OMAP4460_CLEAN_STOP_MASK, + .status_bgap_alert_mask = OMAP4460_BGAP_ALERT_MASK, + .status_hot_mask = OMAP4460_HOT_FLAG_MASK, + .status_cold_mask = OMAP4460_COLD_FLAG_MASK, + + .bgap_efuse = OMAP4460_FUSE_OPP_BGAP, +}; + +/* Thresholds and limits for OMAP4460 MPU temperature sensor */ +static struct temp_sensor_data omap4460_mpu_temp_sensor_data = { + .tshut_hot = OMAP4460_TSHUT_HOT, + .tshut_cold = OMAP4460_TSHUT_COLD, + .t_hot = OMAP4460_T_HOT, + .t_cold = OMAP4460_T_COLD, + .min_freq = OMAP4460_MIN_FREQ, + .max_freq = OMAP4460_MAX_FREQ, + .max_temp = OMAP4460_MAX_TEMP, + .min_temp = OMAP4460_MIN_TEMP, + .hyst_val = OMAP4460_HYST_VAL, + .adc_start_val = OMAP4460_ADC_START_VALUE, + .adc_end_val = OMAP4460_ADC_END_VALUE, + .update_int1 = 1000, + .update_int2 = 2000, +}; + +/* + * Temperature values in milli degree celsius + * ADC code values from 530 to 923 + */ +static const int +omap4460_adc_to_temp[OMAP4460_ADC_END_VALUE - OMAP4460_ADC_START_VALUE + 1] = { + -40000, -40000, -40000, -40000, -39800, -39400, -39000, -38600, -38200, + -37800, -37300, -36800, -36400, -36000, -35600, -35200, -34800, + -34300, -33800, -33400, -33000, -32600, -32200, -31800, -31300, + -30800, -30400, -30000, -29600, -29200, -28700, -28200, -27800, + -27400, -27000, -26600, -26200, -25700, -25200, -24800, -24400, + -24000, -23600, -23200, -22700, -22200, -21800, -21400, -21000, + -20600, -20200, -19700, -19200, -18800, -18400, -18000, -17600, + -17200, -16700, -16200, -15800, -15400, -15000, -14600, -14200, + -13700, -13200, -12800, -12400, -12000, -11600, -11200, -10700, + -10200, -9800, -9400, -9000, -8600, -8200, -7700, -7200, -6800, + -6400, -6000, -5600, -5200, -4800, -4300, -3800, -3400, -3000, + -2600, -2200, -1800, -1300, -800, -400, 0, 400, 800, 1200, 1600, + 2100, 2600, 3000, 3400, 3800, 4200, 4600, 5100, 5600, 6000, 6400, + 6800, 7200, 7600, 8000, 8500, 9000, 9400, 9800, 10200, 10600, 11000, + 11400, 11900, 12400, 12800, 13200, 13600, 14000, 14400, 14800, + 15300, 15800, 16200, 16600, 17000, 17400, 17800, 18200, 18700, + 19200, 19600, 20000, 20400, 20800, 21200, 21600, 22100, 22600, + 23000, 23400, 23800, 24200, 24600, 25000, 25400, 25900, 26400, + 26800, 27200, 27600, 28000, 28400, 28800, 29300, 29800, 30200, + 30600, 31000, 31400, 31800, 32200, 32600, 33100, 33600, 34000, + 34400, 34800, 35200, 35600, 36000, 36400, 36800, 37300, 37800, + 38200, 38600, 39000, 39400, 39800, 40200, 40600, 41100, 41600, + 42000, 42400, 42800, 43200, 43600, 44000, 44400, 44800, 45300, + 45800, 46200, 46600, 47000, 47400, 47800, 48200, 48600, 49000, + 49500, 50000, 50400, 50800, 51200, 51600, 52000, 52400, 52800, + 53200, 53700, 54200, 54600, 55000, 55400, 55800, 56200, 56600, + 57000, 57400, 57800, 58200, 58700, 59200, 59600, 60000, 60400, + 60800, 61200, 61600, 62000, 62400, 62800, 63300, 63800, 64200, + 64600, 65000, 65400, 65800, 66200, 66600, 67000, 67400, 67800, + 68200, 68700, 69200, 69600, 70000, 70400, 70800, 71200, 71600, + 72000, 72400, 72800, 73200, 73600, 74100, 74600, 75000, 75400, + 75800, 76200, 76600, 77000, 77400, 77800, 78200, 78600, 79000, + 79400, 79800, 80300, 80800, 81200, 81600, 82000, 82400, 82800, + 83200, 83600, 84000, 84400, 84800, 85200, 85600, 86000, 86400, + 86800, 87300, 87800, 88200, 88600, 89000, 89400, 89800, 90200, + 90600, 91000, 91400, 91800, 92200, 92600, 93000, 93400, 93800, + 94200, 94600, 95000, 95500, 96000, 96400, 96800, 97200, 97600, + 98000, 98400, 98800, 99200, 99600, 100000, 100400, 100800, 101200, + 101600, 102000, 102400, 102800, 103200, 103600, 104000, 104400, + 104800, 105200, 105600, 106100, 106600, 107000, 107400, 107800, + 108200, 108600, 109000, 109400, 109800, 110200, 110600, 111000, + 111400, 111800, 112200, 112600, 113000, 113400, 113800, 114200, + 114600, 115000, 115400, 115800, 116200, 116600, 117000, 117400, + 117800, 118200, 118600, 119000, 119400, 119800, 120200, 120600, + 121000, 121400, 121800, 122200, 122600, 123000, 123400, 123800, 124200, + 124600, 124900, 125000, 125000, 125000, 125000 +}; + +/* OMAP4460 data */ +const struct omap_bandgap_data omap4460_data = { + .features = OMAP_BANDGAP_FEATURE_TSHUT | + OMAP_BANDGAP_FEATURE_TSHUT_CONFIG | + OMAP_BANDGAP_FEATURE_TALERT | + OMAP_BANDGAP_FEATURE_MODE_CONFIG | + OMAP_BANDGAP_FEATURE_POWER_SWITCH | + OMAP_BANDGAP_FEATURE_COUNTER, + .fclock_name = "bandgap_ts_fclk", + .div_ck_name = "div_ts_ck", + .conv_table = omap4460_adc_to_temp, + .expose_sensor = omap_thermal_expose_sensor, + .remove_sensor = omap_thermal_remove_sensor, + .sensors = { + { + .registers = &omap4460_mpu_temp_sensor_registers, + .ts_data = &omap4460_mpu_temp_sensor_data, + .domain = "cpu", + .slope = OMAP_GRADIENT_SLOPE_4460, + .constant = OMAP_GRADIENT_CONST_4460, + .slope_pcb = OMAP_GRADIENT_SLOPE_W_PCB_4460, + .constant_pcb = OMAP_GRADIENT_CONST_W_PCB_4460, + .register_cooling = omap_thermal_register_cpu_cooling, + .unregister_cooling = omap_thermal_unregister_cpu_cooling, + }, + }, + .sensor_count = 1, +}; + +/* OMAP4470 data */ +const struct omap_bandgap_data omap4470_data = { + .features = OMAP_BANDGAP_FEATURE_TSHUT | + OMAP_BANDGAP_FEATURE_TSHUT_CONFIG | + OMAP_BANDGAP_FEATURE_TALERT | + OMAP_BANDGAP_FEATURE_MODE_CONFIG | + OMAP_BANDGAP_FEATURE_POWER_SWITCH | + OMAP_BANDGAP_FEATURE_COUNTER, + .fclock_name = "bandgap_ts_fclk", + .div_ck_name = "div_ts_ck", + .conv_table = omap4460_adc_to_temp, + .expose_sensor = omap_thermal_expose_sensor, + .remove_sensor = omap_thermal_remove_sensor, + .sensors = { + { + .registers = &omap4460_mpu_temp_sensor_registers, + .ts_data = &omap4460_mpu_temp_sensor_data, + .domain = "cpu", + .slope = OMAP_GRADIENT_SLOPE_4470, + .constant = OMAP_GRADIENT_CONST_4470, + .slope_pcb = OMAP_GRADIENT_SLOPE_W_PCB_4470, + .constant_pcb = OMAP_GRADIENT_CONST_W_PCB_4470, + .register_cooling = omap_thermal_register_cpu_cooling, + .unregister_cooling = omap_thermal_unregister_cpu_cooling, + }, + }, + .sensor_count = 1, +}; -- cgit v0.10.2 From 949f5a505cb19248a941d404fd64d2e37a87a059 Mon Sep 17 00:00:00 2001 From: Eduardo Valentin Date: Thu, 12 Jul 2012 19:02:32 +0300 Subject: staging: omap-thermal: add OMAP5 data structures This patch adds the data structures needed for proper registration of OMAP5 chips. This patch includes definitions for these chip versions: . OMAP5430 Signed-off-by: Eduardo Valentin Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/omap-thermal/Kconfig b/drivers/staging/omap-thermal/Kconfig index b0105d2..30cbc3b 100644 --- a/drivers/staging/omap-thermal/Kconfig +++ b/drivers/staging/omap-thermal/Kconfig @@ -32,3 +32,15 @@ config OMAP4_THERMAL This includes alert interrupts generation and also the TSHUT support. + +config OMAP5_THERMAL + bool "Texas Instruments OMAP5 thermal support" + depends on OMAP_BANDGAP + depends on SOC_OMAP5 + help + If you say yes here you get thermal support for the Texas Instruments + OMAP5 SoC family. The current chip supported are: + - OMAP5430 + + This includes alert interrupts generation and also the TSHUT + support. diff --git a/drivers/staging/omap-thermal/Makefile b/drivers/staging/omap-thermal/Makefile index 76f9c19..091c4d2 100644 --- a/drivers/staging/omap-thermal/Makefile +++ b/drivers/staging/omap-thermal/Makefile @@ -2,3 +2,4 @@ obj-$(CONFIG_OMAP_BANDGAP) += omap-thermal.o omap-thermal-y := omap-bandgap.o omap-thermal-$(CONFIG_OMAP_THERMAL) += omap-thermal-common.o omap-thermal-$(CONFIG_OMAP4_THERMAL) += omap4-thermal.o +omap-thermal-$(CONFIG_OMAP5_THERMAL) += omap5-thermal.o diff --git a/drivers/staging/omap-thermal/omap-bandgap.c b/drivers/staging/omap-thermal/omap-bandgap.c index 5158aa8..c556abb 100644 --- a/drivers/staging/omap-thermal/omap-bandgap.c +++ b/drivers/staging/omap-thermal/omap-bandgap.c @@ -1158,6 +1158,12 @@ static const struct of_device_id of_omap_bandgap_match[] = { .data = (void *)&omap4470_data, }, #endif +#ifdef CONFIG_OMAP5_THERMAL + { + .compatible = "ti,omap5430-bandgap", + .data = (void *)&omap5430_data, + }, +#endif /* Sentinel */ { }, }; diff --git a/drivers/staging/omap-thermal/omap-bandgap.h b/drivers/staging/omap-thermal/omap-bandgap.h index 6d442fe..78aed75 100644 --- a/drivers/staging/omap-thermal/omap-bandgap.h +++ b/drivers/staging/omap-thermal/omap-bandgap.h @@ -432,4 +432,10 @@ extern const struct omap_bandgap_data omap4470_data; #define omap4470_data NULL #endif +#ifdef CONFIG_OMAP5_THERMAL +extern const struct omap_bandgap_data omap5430_data; +#else +#define omap5430_data NULL +#endif + #endif diff --git a/drivers/staging/omap-thermal/omap5-thermal.c b/drivers/staging/omap-thermal/omap5-thermal.c new file mode 100644 index 0000000..0658af2 --- /dev/null +++ b/drivers/staging/omap-thermal/omap5-thermal.c @@ -0,0 +1,297 @@ +/* + * OMAP5 thermal driver. + * + * Copyright (C) 2011-2012 Texas Instruments Inc. + * Contact: + * Eduardo Valentin + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * 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. + * + */ + +#include "omap-bandgap.h" +#include "omap-thermal.h" + +/* + * omap5430 has one instance of thermal sensor for MPU + * need to describe the individual bit fields + */ +static struct temp_sensor_registers +omap5430_mpu_temp_sensor_registers = { + .temp_sensor_ctrl = OMAP5430_TEMP_SENSOR_MPU_OFFSET, + .bgap_tempsoff_mask = OMAP5430_BGAP_TEMPSOFF_MASK, + .bgap_soc_mask = OMAP5430_BGAP_TEMP_SENSOR_SOC_MASK, + .bgap_eocz_mask = OMAP5430_BGAP_TEMP_SENSOR_EOCZ_MASK, + .bgap_dtemp_mask = OMAP5430_BGAP_TEMP_SENSOR_DTEMP_MASK, + + .bgap_mask_ctrl = OMAP5430_BGAP_CTRL_OFFSET, + .mask_hot_mask = OMAP5430_MASK_HOT_MPU_MASK, + .mask_cold_mask = OMAP5430_MASK_COLD_MPU_MASK, + + .bgap_mode_ctrl = OMAP5430_BGAP_COUNTER_MPU_OFFSET, + .mode_ctrl_mask = OMAP5430_REPEAT_MODE_MASK, + + .bgap_counter = OMAP5430_BGAP_COUNTER_MPU_OFFSET, + .counter_mask = OMAP5430_COUNTER_MASK, + + .bgap_threshold = OMAP5430_BGAP_THRESHOLD_MPU_OFFSET, + .threshold_thot_mask = OMAP5430_T_HOT_MASK, + .threshold_tcold_mask = OMAP5430_T_COLD_MASK, + + .tshut_threshold = OMAP5430_BGAP_TSHUT_MPU_OFFSET, + .tshut_hot_mask = OMAP5430_TSHUT_HOT_MASK, + .tshut_cold_mask = OMAP5430_TSHUT_COLD_MASK, + + .bgap_status = OMAP5430_BGAP_STATUS_OFFSET, + .status_clean_stop_mask = 0x0, + .status_bgap_alert_mask = OMAP5430_BGAP_ALERT_MASK, + .status_hot_mask = OMAP5430_HOT_MPU_FLAG_MASK, + .status_cold_mask = OMAP5430_COLD_MPU_FLAG_MASK, + + .bgap_efuse = OMAP5430_FUSE_OPP_BGAP_MPU, +}; + +/* + * omap5430 has one instance of thermal sensor for GPU + * need to describe the individual bit fields + */ +static struct temp_sensor_registers +omap5430_gpu_temp_sensor_registers = { + .temp_sensor_ctrl = OMAP5430_TEMP_SENSOR_GPU_OFFSET, + .bgap_tempsoff_mask = OMAP5430_BGAP_TEMPSOFF_MASK, + .bgap_soc_mask = OMAP5430_BGAP_TEMP_SENSOR_SOC_MASK, + .bgap_eocz_mask = OMAP5430_BGAP_TEMP_SENSOR_EOCZ_MASK, + .bgap_dtemp_mask = OMAP5430_BGAP_TEMP_SENSOR_DTEMP_MASK, + + .bgap_mask_ctrl = OMAP5430_BGAP_CTRL_OFFSET, + .mask_hot_mask = OMAP5430_MASK_HOT_MM_MASK, + .mask_cold_mask = OMAP5430_MASK_COLD_MM_MASK, + + .bgap_mode_ctrl = OMAP5430_BGAP_COUNTER_GPU_OFFSET, + .mode_ctrl_mask = OMAP5430_REPEAT_MODE_MASK, + + .bgap_counter = OMAP5430_BGAP_COUNTER_GPU_OFFSET, + .counter_mask = OMAP5430_COUNTER_MASK, + + .bgap_threshold = OMAP5430_BGAP_THRESHOLD_GPU_OFFSET, + .threshold_thot_mask = OMAP5430_T_HOT_MASK, + .threshold_tcold_mask = OMAP5430_T_COLD_MASK, + + .tshut_threshold = OMAP5430_BGAP_TSHUT_GPU_OFFSET, + .tshut_hot_mask = OMAP5430_TSHUT_HOT_MASK, + .tshut_cold_mask = OMAP5430_TSHUT_COLD_MASK, + + .bgap_status = OMAP5430_BGAP_STATUS_OFFSET, + .status_clean_stop_mask = 0x0, + .status_bgap_alert_mask = OMAP5430_BGAP_ALERT_MASK, + .status_hot_mask = OMAP5430_HOT_MM_FLAG_MASK, + .status_cold_mask = OMAP5430_COLD_MM_FLAG_MASK, + + .bgap_efuse = OMAP5430_FUSE_OPP_BGAP_GPU, +}; + +/* + * omap5430 has one instance of thermal sensor for CORE + * need to describe the individual bit fields + */ +static struct temp_sensor_registers +omap5430_core_temp_sensor_registers = { + .temp_sensor_ctrl = OMAP5430_TEMP_SENSOR_CORE_OFFSET, + .bgap_tempsoff_mask = OMAP5430_BGAP_TEMPSOFF_MASK, + .bgap_soc_mask = OMAP5430_BGAP_TEMP_SENSOR_SOC_MASK, + .bgap_eocz_mask = OMAP5430_BGAP_TEMP_SENSOR_EOCZ_MASK, + .bgap_dtemp_mask = OMAP5430_BGAP_TEMP_SENSOR_DTEMP_MASK, + + .bgap_mask_ctrl = OMAP5430_BGAP_CTRL_OFFSET, + .mask_hot_mask = OMAP5430_MASK_HOT_CORE_MASK, + .mask_cold_mask = OMAP5430_MASK_COLD_CORE_MASK, + + .bgap_mode_ctrl = OMAP5430_BGAP_COUNTER_CORE_OFFSET, + .mode_ctrl_mask = OMAP5430_REPEAT_MODE_MASK, + + .bgap_counter = OMAP5430_BGAP_COUNTER_CORE_OFFSET, + .counter_mask = OMAP5430_COUNTER_MASK, + + .bgap_threshold = OMAP5430_BGAP_THRESHOLD_CORE_OFFSET, + .threshold_thot_mask = OMAP5430_T_HOT_MASK, + .threshold_tcold_mask = OMAP5430_T_COLD_MASK, + + .tshut_threshold = OMAP5430_BGAP_TSHUT_CORE_OFFSET, + .tshut_hot_mask = OMAP5430_TSHUT_HOT_MASK, + .tshut_cold_mask = OMAP5430_TSHUT_COLD_MASK, + + .bgap_status = OMAP5430_BGAP_STATUS_OFFSET, + .status_clean_stop_mask = 0x0, + .status_bgap_alert_mask = OMAP5430_BGAP_ALERT_MASK, + .status_hot_mask = OMAP5430_HOT_CORE_FLAG_MASK, + .status_cold_mask = OMAP5430_COLD_CORE_FLAG_MASK, + + .bgap_efuse = OMAP5430_FUSE_OPP_BGAP_CORE, +}; + +/* Thresholds and limits for OMAP5430 MPU temperature sensor */ +static struct temp_sensor_data omap5430_mpu_temp_sensor_data = { + .tshut_hot = OMAP5430_MPU_TSHUT_HOT, + .tshut_cold = OMAP5430_MPU_TSHUT_COLD, + .t_hot = OMAP5430_MPU_T_HOT, + .t_cold = OMAP5430_MPU_T_COLD, + .min_freq = OMAP5430_MPU_MIN_FREQ, + .max_freq = OMAP5430_MPU_MAX_FREQ, + .max_temp = OMAP5430_MPU_MAX_TEMP, + .min_temp = OMAP5430_MPU_MIN_TEMP, + .hyst_val = OMAP5430_MPU_HYST_VAL, + .adc_start_val = OMAP5430_ADC_START_VALUE, + .adc_end_val = OMAP5430_ADC_END_VALUE, + .update_int1 = 1000, + .update_int2 = 2000, +}; + +/* Thresholds and limits for OMAP5430 GPU temperature sensor */ +static struct temp_sensor_data omap5430_gpu_temp_sensor_data = { + .tshut_hot = OMAP5430_GPU_TSHUT_HOT, + .tshut_cold = OMAP5430_GPU_TSHUT_COLD, + .t_hot = OMAP5430_GPU_T_HOT, + .t_cold = OMAP5430_GPU_T_COLD, + .min_freq = OMAP5430_GPU_MIN_FREQ, + .max_freq = OMAP5430_GPU_MAX_FREQ, + .max_temp = OMAP5430_GPU_MAX_TEMP, + .min_temp = OMAP5430_GPU_MIN_TEMP, + .hyst_val = OMAP5430_GPU_HYST_VAL, + .adc_start_val = OMAP5430_ADC_START_VALUE, + .adc_end_val = OMAP5430_ADC_END_VALUE, + .update_int1 = 1000, + .update_int2 = 2000, +}; + +/* Thresholds and limits for OMAP5430 CORE temperature sensor */ +static struct temp_sensor_data omap5430_core_temp_sensor_data = { + .tshut_hot = OMAP5430_CORE_TSHUT_HOT, + .tshut_cold = OMAP5430_CORE_TSHUT_COLD, + .t_hot = OMAP5430_CORE_T_HOT, + .t_cold = OMAP5430_CORE_T_COLD, + .min_freq = OMAP5430_CORE_MIN_FREQ, + .max_freq = OMAP5430_CORE_MAX_FREQ, + .max_temp = OMAP5430_CORE_MAX_TEMP, + .min_temp = OMAP5430_CORE_MIN_TEMP, + .hyst_val = OMAP5430_CORE_HYST_VAL, + .adc_start_val = OMAP5430_ADC_START_VALUE, + .adc_end_val = OMAP5430_ADC_END_VALUE, + .update_int1 = 1000, + .update_int2 = 2000, +}; + +static const int +omap5430_adc_to_temp[OMAP5430_ADC_END_VALUE - OMAP5430_ADC_START_VALUE + 1] = { + -40000, -40000, -40000, -40000, -39800, -39400, -39000, -38600, + -38200, -37800, -37300, -36800, + -36400, -36000, -35600, -35200, -34800, -34300, -33800, -33400, -33000, + -32600, + -32200, -31800, -31300, -30800, -30400, -30000, -29600, -29200, -28700, + -28200, -27800, -27400, -27000, -26600, -26200, -25700, -25200, -24800, + -24400, -24000, -23600, -23200, -22700, -22200, -21800, -21400, -21000, + -20600, -20200, -19700, -19200, -9300, -18400, -18000, -17600, -17200, + -16700, -16200, -15800, -15400, -15000, -14600, -14200, -13700, -13200, + -12800, -12400, -12000, -11600, -11200, -10700, -10200, -9800, -9400, + -9000, + -8600, -8200, -7700, -7200, -6800, -6400, -6000, -5600, -5200, -4800, + -4300, + -3800, -3400, -3000, -2600, -2200, -1800, -1300, -800, -400, 0, 400, + 800, + 1200, 1600, 2100, 2600, 3000, 3400, 3800, 4200, 4600, 5100, 5600, 6000, + 6400, 6800, 7200, 7600, 8000, 8500, 9000, 9400, 9800, 10200, 10800, + 11100, + 11400, 11900, 12400, 12800, 13200, 13600, 14000, 14400, 14800, 15300, + 15800, + 16200, 16600, 17000, 17400, 17800, 18200, 18700, 19200, 19600, 20000, + 20400, + 20800, 21200, 21600, 22100, 22600, 23000, 23400, 23800, 24200, 24600, + 25000, + 25400, 25900, 26400, 26800, 27200, 27600, 28000, 28400, 28800, 29300, + 29800, + 30200, 30600, 31000, 31400, 31800, 32200, 32600, 33100, 33600, 34000, + 34400, + 34800, 35200, 35600, 36000, 36400, 36800, 37300, 37800, 38200, 38600, + 39000, + 39400, 39800, 40200, 40600, 41100, 41600, 42000, 42400, 42800, 43200, + 43600, + 44000, 44400, 44800, 45300, 45800, 46200, 46600, 47000, 47400, 47800, + 48200, + 48600, 49000, 49500, 50000, 50400, 50800, 51200, 51600, 52000, 52400, + 52800, + 53200, 53700, 54200, 54600, 55000, 55400, 55800, 56200, 56600, 57000, + 57400, + 57800, 58200, 58700, 59200, 59600, 60000, 60400, 60800, 61200, 61600, + 62000, + 62400, 62800, 63300, 63800, 64200, 64600, 65000, 65400, 65800, 66200, + 66600, + 67000, 67400, 67800, 68200, 68700, 69200, 69600, 70000, 70400, 70800, + 71200, + 71600, 72000, 72400, 72800, 73200, 73600, 74100, 74600, 75000, 75400, + 75800, + 76200, 76600, 77000, 77400, 77800, 78200, 78600, 79000, 79400, 79800, + 80300, + 80800, 81200, 81600, 82000, 82400, 82800, 83200, 83600, 84000, 84400, + 84800, + 85200, 85600, 86000, 86400, 86800, 87300, 87800, 88200, 88600, 89000, + 89400, + 89800, 90200, 90600, 91000, 91400, 91800, 92200, 92600, 93000, 93400, + 93800, + 94200, 94600, 95000, 95500, 96000, 96400, 96800, 97200, 97600, 98000, + 98400, + 98800, 99200, 99600, 100000, 100400, 100800, 101200, 101600, 102000, + 102400, + 102800, 103200, 103600, 104000, 104400, 104800, 105200, 105600, 106100, + 106600, 107000, 107400, 107800, 108200, 108600, 109000, 109400, 109800, + 110200, 110600, 111000, 111400, 111800, 112200, 112600, 113000, 113400, + 113800, 114200, 114600, 115000, 115400, 115800, 116200, 116600, 117000, + 117400, 117800, 118200, 118600, 119000, 119400, 119800, 120200, 120600, + 121000, 121400, 121800, 122200, 122600, 123000, 123400, 123800, 124200, + 124600, 124900, 125000, 125000, 125000, 125000, +}; + +const struct omap_bandgap_data omap5430_data = { + .features = OMAP_BANDGAP_FEATURE_TSHUT_CONFIG | + OMAP_BANDGAP_FEATURE_TALERT | + OMAP_BANDGAP_FEATURE_MODE_CONFIG | + OMAP_BANDGAP_FEATURE_COUNTER, + .fclock_name = "ts_clk_div_ck", + .div_ck_name = "ts_clk_div_ck", + .conv_table = omap5430_adc_to_temp, + .expose_sensor = omap_thermal_expose_sensor, + .remove_sensor = omap_thermal_remove_sensor, + .sensors = { + { + .registers = &omap5430_mpu_temp_sensor_registers, + .ts_data = &omap5430_mpu_temp_sensor_data, + .domain = "cpu", + .register_cooling = omap_thermal_register_cpu_cooling, + .unregister_cooling = omap_thermal_unregister_cpu_cooling, + .slope = OMAP_GRADIENT_SLOPE_5430_CPU, + .constant = OMAP_GRADIENT_CONST_5430_CPU, + .slope_pcb = OMAP_GRADIENT_SLOPE_W_PCB_5430_CPU, + .constant_pcb = OMAP_GRADIENT_CONST_W_PCB_5430_CPU, + }, + { + .registers = &omap5430_gpu_temp_sensor_registers, + .ts_data = &omap5430_gpu_temp_sensor_data, + .domain = "gpu", + .slope = OMAP_GRADIENT_SLOPE_5430_GPU, + .constant = OMAP_GRADIENT_CONST_5430_GPU, + .slope_pcb = OMAP_GRADIENT_SLOPE_W_PCB_5430_GPU, + .constant_pcb = OMAP_GRADIENT_CONST_W_PCB_5430_GPU, + }, + { + .registers = &omap5430_core_temp_sensor_registers, + .ts_data = &omap5430_core_temp_sensor_data, + .domain = "core", + }, + }, + .sensor_count = 3, +}; -- cgit v0.10.2 From 626888df7fc7ed26d1e7edfdea3f6c85912175fc Mon Sep 17 00:00:00 2001 From: Marek Belisko Date: Thu, 12 Jul 2012 23:50:43 +0200 Subject: staging: ft1000-usb: Change KERN_ERROR usage to pr_err in ft1000_usb.c. Signed-off-by: Marek Belisko Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c index e8c4a4e5..b2ecd0e 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c @@ -70,7 +70,7 @@ static int ft1000_probe(struct usb_interface *interface, ft1000dev = kzalloc(sizeof(struct ft1000_device), GFP_KERNEL); if (!ft1000dev) { - printk(KERN_ERR "out of memory allocating device structure\n"); + pr_err("out of memory allocating device structure\n"); return -ENOMEM; } @@ -138,7 +138,7 @@ static int ft1000_probe(struct usb_interface *interface, ret = request_firmware(&dsp_fw, "ft3000.img", &dev->dev); if (ret < 0) { - printk(KERN_ERR "Error request_firmware().\n"); + pr_err("Error request_firmware().\n"); goto err_fw; } @@ -166,7 +166,7 @@ static int ft1000_probe(struct usb_interface *interface, DEBUG("In probe: pft1000info=%p\n", pft1000info); ret = dsp_reload(ft1000dev); if (ret) { - printk(KERN_ERR "Problem with DSP image loading\n"); + pr_err("Problem with DSP image loading\n"); goto err_load; } -- cgit v0.10.2 From 494e734a4052a3a917c7358319f79d86813c0c71 Mon Sep 17 00:00:00 2001 From: Marek Belisko Date: Thu, 12 Jul 2012 23:50:44 +0200 Subject: staging: ft1000-usb: Remove commented lines from ft1000_device. Signed-off-by: Marek Belisko Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h index 51c0847..d4f1aa1 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h @@ -74,10 +74,6 @@ struct ft1000_device u8 bulk_in_endpointAddr; u8 bulk_out_endpointAddr; - - //struct ft1000_ethernet_configuration configuration; - -// struct net_device_stats stats; //mbelian } __attribute__ ((packed)); struct ft1000_debug_dirs { -- cgit v0.10.2 From e2bdf27d398ba7783d328e3e69dc2e8a0fd4a6f7 Mon Sep 17 00:00:00 2001 From: Marek Belisko Date: Thu, 12 Jul 2012 23:50:45 +0200 Subject: staging: ft1000-usb: Remove leading spaces from struct ft1000_info. Signed-off-by: Marek Belisko Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h index d4f1aa1..3f22df9 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h @@ -84,57 +84,57 @@ struct ft1000_debug_dirs { }; struct ft1000_info { - struct ft1000_device *pFt1000Dev; - struct net_device_stats stats; + struct ft1000_device *pFt1000Dev; + struct net_device_stats stats; - struct task_struct *pPollThread; + struct task_struct *pPollThread; - unsigned char fcodeldr; - unsigned char bootmode; + unsigned char fcodeldr; + unsigned char bootmode; unsigned char usbboot; - unsigned short dspalive; - u16 ASIC_ID; - bool fProvComplete; - bool fCondResetPend; - bool fAppMsgPend; - u16 DrvErrNum; - u16 AsicID; - int DspAsicReset; - int DeviceCreated; - int CardReady; - int NetDevRegDone; - u8 CardNumber; - u8 DeviceName[15]; - struct ft1000_debug_dirs nodes; - int registered; - int mediastate; - u8 squeseqnum; // sequence number on slow queue - spinlock_t dpram_lock; - spinlock_t fifo_lock; - u16 fifo_cnt; - u8 DspVer[DSPVERSZ]; // DSP version number - u8 HwSerNum[HWSERNUMSZ]; // Hardware Serial Number - u8 Sku[SKUSZ]; // SKU - u8 eui64[EUISZ]; // EUI64 - time_t ConTm; // Connection Time - u8 ProductMode[MODESZ]; - u8 RfCalVer[CALVERSZ]; - u8 RfCalDate[CALDATESZ]; - u16 DSP_TIME[4]; - u16 LedStat; //mbelian - u16 ConStat; //mbelian - u16 ProgConStat; - struct list_head prov_list; - int appcnt; + unsigned short dspalive; + u16 ASIC_ID; + bool fProvComplete; + bool fCondResetPend; + bool fAppMsgPend; + u16 DrvErrNum; + u16 AsicID; + int DspAsicReset; + int DeviceCreated; + int CardReady; + int NetDevRegDone; + u8 CardNumber; + u8 DeviceName[15]; + struct ft1000_debug_dirs nodes; + int registered; + int mediastate; + u8 squeseqnum; // sequence number on slow queue + spinlock_t dpram_lock; + spinlock_t fifo_lock; + u16 fifo_cnt; + u8 DspVer[DSPVERSZ]; // DSP version number + u8 HwSerNum[HWSERNUMSZ]; // Hardware Serial Number + u8 Sku[SKUSZ]; // SKU + u8 eui64[EUISZ]; // EUI64 + time_t ConTm; // Connection Time + u8 ProductMode[MODESZ]; + u8 RfCalVer[CALVERSZ]; + u8 RfCalDate[CALDATESZ]; + u16 DSP_TIME[4]; + u16 LedStat; //mbelian + u16 ConStat; //mbelian + u16 ProgConStat; + struct list_head prov_list; + int appcnt; struct app_info_block app_info[MAX_NUM_APP]; - u16 DSPInfoBlklen; - u16 DrvMsgPend; - int (*ft1000_reset)(struct net_device *dev); - u16 DSPInfoBlk[MAX_DSP_SESS_REC]; - union { - u16 Rec[MAX_DSP_SESS_REC]; - u32 MagRec[MAX_DSP_SESS_REC/2]; - } DSPSess; + u16 DSPInfoBlklen; + u16 DrvMsgPend; + int (*ft1000_reset)(struct net_device *dev); + u16 DSPInfoBlk[MAX_DSP_SESS_REC]; + union { + u16 Rec[MAX_DSP_SESS_REC]; + u32 MagRec[MAX_DSP_SESS_REC/2]; + } DSPSess; unsigned short tempbuf[32]; char netdevname[IFNAMSIZ]; struct proc_dir_entry *ft1000_proc_dir; //mbelian -- cgit v0.10.2 From 586288c957cb17bf0fe00bf91f793c786f995946 Mon Sep 17 00:00:00 2001 From: Marek Belisko Date: Thu, 12 Jul 2012 23:50:46 +0200 Subject: staging: ft1000-usb: Remove spaces from struct dpram_blk. Signed-off-by: Marek Belisko Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h index 3f22df9..06bce31 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h @@ -142,8 +142,8 @@ struct ft1000_info { struct dpram_blk { - struct list_head list; - u16 *pbuffer; + struct list_head list; + u16 *pbuffer; } __attribute__ ((packed)); int ft1000_read_register(struct ft1000_device *ft1000dev, u16* Data, u16 nRegIndx); -- cgit v0.10.2 From 03b3ac18cf5ee05c821a1e54d1ddd4e713f08343 Mon Sep 17 00:00:00 2001 From: Marek Belisko Date: Thu, 12 Jul 2012 23:50:47 +0200 Subject: staging: ft1000-usb: Remove name comments from ft1000_usb.h. Signed-off-by: Marek Belisko Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h index 06bce31..2b98754 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h @@ -1,7 +1,6 @@ #ifndef _FT1000_USB_H_ #define _FT1000_USB_H_ -/*Jim*/ #include "../ft1000.h" #include "ft1000_ioctl.h" #define FT1000_DRV_VER 0x01010403 @@ -27,7 +26,6 @@ struct app_info_block { struct list_head app_sqlist; // link list of msgs for applicaton on slow queue } __attribute__((packed)); -/*end of Jim*/ #define DEBUG(args...) printk(KERN_INFO args) #define FALSE 0 @@ -121,8 +119,8 @@ struct ft1000_info { u8 RfCalVer[CALVERSZ]; u8 RfCalDate[CALDATESZ]; u16 DSP_TIME[4]; - u16 LedStat; //mbelian - u16 ConStat; //mbelian + u16 LedStat; + u16 ConStat; u16 ProgConStat; struct list_head prov_list; int appcnt; @@ -137,7 +135,7 @@ struct ft1000_info { } DSPSess; unsigned short tempbuf[32]; char netdevname[IFNAMSIZ]; - struct proc_dir_entry *ft1000_proc_dir; //mbelian + struct proc_dir_entry *ft1000_proc_dir; }; -- cgit v0.10.2 From f7e5780deff665c9dbc0a6dd80c8955302dc04a7 Mon Sep 17 00:00:00 2001 From: Marek Belisko Date: Thu, 12 Jul 2012 23:50:48 +0200 Subject: staging: ft1000-usb: Fix lines over 80 chars. Signed-off-by: Marek Belisko Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h index 2b98754..60071f0 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h @@ -144,28 +144,38 @@ struct dpram_blk { u16 *pbuffer; } __attribute__ ((packed)); -int ft1000_read_register(struct ft1000_device *ft1000dev, u16* Data, u16 nRegIndx); -int ft1000_write_register(struct ft1000_device *ft1000dev, u16 value, u16 nRegIndx); -int ft1000_read_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, u16 cnt); -int ft1000_write_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, u16 cnt); -int ft1000_read_dpram16(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, u8 highlow); -int ft1000_write_dpram16(struct ft1000_device *ft1000dev, u16 indx, u16 value, u8 highlow); -int fix_ft1000_read_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer); -int fix_ft1000_write_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer); +int ft1000_read_register(struct ft1000_device *ft1000dev, + u16* Data, u16 nRegIndx); +int ft1000_write_register(struct ft1000_device *ft1000dev, + u16 value, u16 nRegIndx); +int ft1000_read_dpram32(struct ft1000_device *ft1000dev, + u16 indx, u8 *buffer, u16 cnt); +int ft1000_write_dpram32(struct ft1000_device *ft1000dev, + u16 indx, u8 *buffer, u16 cnt); +int ft1000_read_dpram16(struct ft1000_device *ft1000dev, + u16 indx, u8 *buffer, u8 highlow); +int ft1000_write_dpram16(struct ft1000_device *ft1000dev, + u16 indx, u16 value, u8 highlow); +int fix_ft1000_read_dpram32(struct ft1000_device *ft1000dev, + u16 indx, u8 *buffer); +int fix_ft1000_write_dpram32(struct ft1000_device *ft1000dev, + u16 indx, u8 *buffer); extern void *pFileStart; extern size_t FileLength; extern int numofmsgbuf; int ft1000_close (struct net_device *dev); -u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, u32 FileLength); +u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, + u32 FileLength); extern struct list_head freercvpool; extern spinlock_t free_buff_lock; // lock to arbitrate free buffer list for receive command data int ft1000_create_dev(struct ft1000_device *dev); void ft1000_destroy_dev(struct net_device *dev); -extern void card_send_command(struct ft1000_device *ft1000dev, void *ptempbuffer, int size); +extern void card_send_command(struct ft1000_device *ft1000dev, + void *ptempbuffer, int size); struct dpram_blk *ft1000_get_buffer(struct list_head *bufflist); void ft1000_free_buffer(struct dpram_blk *pdpram_blk, struct list_head *plist); @@ -173,7 +183,8 @@ void ft1000_free_buffer(struct dpram_blk *pdpram_blk, struct list_head *plist); int dsp_reload(struct ft1000_device *ft1000dev); int init_ft1000_netdev(struct ft1000_device *ft1000dev); struct usb_interface; -int reg_ft1000_netdev(struct ft1000_device *ft1000dev, struct usb_interface *intf); +int reg_ft1000_netdev(struct ft1000_device *ft1000dev, + struct usb_interface *intf); int ft1000_poll(void* dev_id); int ft1000_init_proc(struct net_device *dev); -- cgit v0.10.2 From 35975ea664dab765a304d40b776b475a32d7f407 Mon Sep 17 00:00:00 2001 From: Marek Belisko Date: Thu, 12 Jul 2012 23:50:49 +0200 Subject: staging: ft1000-usb: Replace all C99 comments with regular in ft1000_usb.h. Signed-off-by: Marek Belisko Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h index 60071f0..58cc54b 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h @@ -14,16 +14,16 @@ #define SUCCESS 0x00 struct app_info_block { - u32 nTxMsg; // DPRAM msg sent to DSP with app_id - u32 nRxMsg; // DPRAM msg rcv from dsp with app_id - u32 nTxMsgReject; // DPRAM msg rejected due to DSP doorbell set - u32 nRxMsgMiss; // DPRAM msg dropped due to overflow - struct fown_struct *fileobject;// Application's file object - u16 app_id; // Application id + u32 nTxMsg; /* DPRAM msg sent to DSP with app_id */ + u32 nRxMsg; /* DPRAM msg rcv from dsp with app_id */ + u32 nTxMsgReject; /* DPRAM msg rejected due to DSP doorbell set */ + u32 nRxMsgMiss; /* DPRAM msg dropped due to overflow */ + struct fown_struct *fileobject;/* Application's file object */ + u16 app_id; /* Application id */ int DspBCMsgFlag; - int NumOfMsg; // number of messages queued up + int NumOfMsg; /* number of messages queued up */ wait_queue_head_t wait_dpram_msg; - struct list_head app_sqlist; // link list of msgs for applicaton on slow queue + struct list_head app_sqlist; /* link list of msgs for applicaton on slow queue */ } __attribute__((packed)); #define DEBUG(args...) printk(KERN_INFO args) @@ -45,14 +45,14 @@ struct app_info_block { #undef FT1000_DPRAM_RX_BASE #define FT1000_DPRAM_RX_BASE 0x1800 /* RX AREA (SlowQ) */ -// MEMORY MAP FOR MAGNEMITE +/* MEMORY MAP FOR MAGNEMITE */ /* the indexes are swapped comparing to PCMCIA - is it OK or a bug? */ #undef FT1000_MAG_DSP_LED_INDX #define FT1000_MAG_DSP_LED_INDX 0x1 /* dsp led status for PAD device */ #undef FT1000_MAG_DSP_CON_STATE_INDX #define FT1000_MAG_DSP_CON_STATE_INDX 0x0 /* DSP Connection Status Info */ -// Maximum times trying to get ASIC out of reset +/* Maximum times trying to get ASIC out of reset */ #define MAX_ASIC_RESET_CNT 20 #define MAX_BUF_SIZE 4096 @@ -106,15 +106,15 @@ struct ft1000_info { struct ft1000_debug_dirs nodes; int registered; int mediastate; - u8 squeseqnum; // sequence number on slow queue + u8 squeseqnum; /* sequence number on slow queue */ spinlock_t dpram_lock; spinlock_t fifo_lock; u16 fifo_cnt; - u8 DspVer[DSPVERSZ]; // DSP version number - u8 HwSerNum[HWSERNUMSZ]; // Hardware Serial Number - u8 Sku[SKUSZ]; // SKU - u8 eui64[EUISZ]; // EUI64 - time_t ConTm; // Connection Time + u8 DspVer[DSPVERSZ]; /* DSP version number */ + u8 HwSerNum[HWSERNUMSZ]; /* Hardware Serial Number */ + u8 Sku[SKUSZ]; /* SKU */ + u8 eui64[EUISZ]; /* EUI64 */ + time_t ConTm; /* Connection Time */ u8 ProductMode[MODESZ]; u8 RfCalVer[CALVERSZ]; u8 RfCalDate[CALDATESZ]; @@ -170,7 +170,8 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, u32 FileLength); extern struct list_head freercvpool; -extern spinlock_t free_buff_lock; // lock to arbitrate free buffer list for receive command data + +extern spinlock_t free_buff_lock; /* lock to arbitrate free buffer list for receive command data */ int ft1000_create_dev(struct ft1000_device *dev); void ft1000_destroy_dev(struct net_device *dev); -- cgit v0.10.2 From b70ac75eeff0fb1f356924e58f6f543c9b3d3077 Mon Sep 17 00:00:00 2001 From: Marek Belisko Date: Thu, 12 Jul 2012 23:50:50 +0200 Subject: staging: ft1000-usb: Fix various checkpach warnings in ft1000_usb.h Signed-off-by: Marek Belisko Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h index 58cc54b..642bb89 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h @@ -24,7 +24,7 @@ struct app_info_block { int NumOfMsg; /* number of messages queued up */ wait_queue_head_t wait_dpram_msg; struct list_head app_sqlist; /* link list of msgs for applicaton on slow queue */ -} __attribute__((packed)); +} __packed; #define DEBUG(args...) printk(KERN_INFO args) @@ -57,8 +57,7 @@ struct app_info_block { #define MAX_BUF_SIZE 4096 -struct ft1000_device -{ +struct ft1000_device { struct usb_device *dev; struct net_device *net; @@ -72,7 +71,7 @@ struct ft1000_device u8 bulk_in_endpointAddr; u8 bulk_out_endpointAddr; -} __attribute__ ((packed)); +} __packed; struct ft1000_debug_dirs { struct list_head list; @@ -142,10 +141,10 @@ struct ft1000_info { struct dpram_blk { struct list_head list; u16 *pbuffer; -} __attribute__ ((packed)); +} __packed; int ft1000_read_register(struct ft1000_device *ft1000dev, - u16* Data, u16 nRegIndx); + u16 *Data, u16 nRegIndx); int ft1000_write_register(struct ft1000_device *ft1000dev, u16 value, u16 nRegIndx); int ft1000_read_dpram32(struct ft1000_device *ft1000dev, @@ -165,7 +164,7 @@ extern void *pFileStart; extern size_t FileLength; extern int numofmsgbuf; -int ft1000_close (struct net_device *dev); +int ft1000_close(struct net_device *dev); u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, u32 FileLength); @@ -186,7 +185,7 @@ int init_ft1000_netdev(struct ft1000_device *ft1000dev); struct usb_interface; int reg_ft1000_netdev(struct ft1000_device *ft1000dev, struct usb_interface *intf); -int ft1000_poll(void* dev_id); +int ft1000_poll(void *dev_id); int ft1000_init_proc(struct net_device *dev); void ft1000_cleanup_proc(struct ft1000_info *info); -- cgit v0.10.2 From d254eb7418e389e063831d8d77b7dac240288f02 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Thu, 12 Jul 2012 17:46:37 -0700 Subject: staging: comedi: dt282x: remove the outw wrapper macros The macros 'update_dacsr', 'update_adcsr', and 'update_supcsr' all use the 'devpriv' macro which uses a local variable of a specific name and yeilds a pointer derived from that name. They are also just wrappers around simple 'outw' calls. Remove the macros. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c index 4af3343..1f0b40e 100644 --- a/drivers/staging/comedi/drivers/dt282x.c +++ b/drivers/staging/comedi/drivers/dt282x.c @@ -255,11 +255,8 @@ struct dt282x_private { * Some useless abstractions */ #define chan_to_DAC(a) ((a)&1) -#define update_dacsr(a) outw(devpriv->dacsr|(a), dev->iobase+DT2821_DACSR) -#define update_adcsr(a) outw(devpriv->adcsr|(a), dev->iobase+DT2821_ADCSR) #define mux_busy() (inw(dev->iobase+DT2821_ADCSR)&DT2821_MUXBUSY) #define ad_done() (inw(dev->iobase+DT2821_ADCSR)&DT2821_ADDONE) -#define update_supcsr(a) outw(devpriv->supcsr|(a), dev->iobase+DT2821_SUPCSR) /* * danger! macro abuse... a is the expression to wait on, and b is @@ -317,7 +314,7 @@ static void dt282x_ao_dma_interrupt(struct comedi_device *dev) int i; struct comedi_subdevice *s = dev->subdevices + 1; - update_supcsr(DT2821_CLRDMADNE); + outw(devpriv->supcsr | DT2821_CLRDMADNE, dev->iobase + DT2821_SUPCSR); if (!s->async->prealloc_buf) { printk(KERN_ERR "async->data disappeared. dang!\n"); @@ -350,7 +347,7 @@ static void dt282x_ai_dma_interrupt(struct comedi_device *dev) int ret; struct comedi_subdevice *s = dev->subdevices; - update_supcsr(DT2821_CLRDMADNE); + outw(devpriv->supcsr | DT2821_CLRDMADNE, dev->iobase + DT2821_SUPCSR); if (!s->async->prealloc_buf) { printk(KERN_ERR "async->data disappeared. dang!\n"); @@ -387,7 +384,7 @@ static void dt282x_ai_dma_interrupt(struct comedi_device *dev) /* XXX probably wrong */ if (!devpriv->ntrig) { devpriv->supcsr &= ~(DT2821_DDMA); - update_supcsr(0); + outw(devpriv->supcsr, dev->iobase + DT2821_SUPCSR); } #endif /* restart the channel */ @@ -513,7 +510,8 @@ static irqreturn_t dt282x_interrupt(int irq, void *d) s->async->events |= COMEDI_CB_EOA; } else { if (supcsr & DT2821_SCDN) - update_supcsr(DT2821_STRIG); + outw(devpriv->supcsr | DT2821_STRIG, + dev->iobase + DT2821_SUPCSR); } handled = 1; } @@ -534,7 +532,8 @@ static void dt282x_load_changain(struct comedi_device *dev, int n, for (i = 0; i < n; i++) { chan = CR_CHAN(chanlist[i]); range = CR_RANGE(chanlist[i]); - update_adcsr((range << 4) | (chan)); + outw(devpriv->adcsr | (range << 4) | chan, + dev->iobase + DT2821_ADCSR); } outw(n - 1, dev->iobase + DT2821_CHANCSR); } @@ -553,15 +552,16 @@ static int dt282x_ai_insn_read(struct comedi_device *dev, /* XXX should we really be enabling the ad clock here? */ devpriv->adcsr = DT2821_ADCLK; - update_adcsr(0); + outw(devpriv->adcsr, dev->iobase + DT2821_ADCSR); dt282x_load_changain(dev, 1, &insn->chanspec); - update_supcsr(DT2821_PRLD); + outw(devpriv->supcsr | DT2821_PRLD, dev->iobase + DT2821_SUPCSR); wait_for(!mux_busy(), comedi_error(dev, "timeout\n"); return -ETIME;); for (i = 0; i < insn->n; i++) { - update_supcsr(DT2821_STRIG); + outw(devpriv->supcsr | DT2821_STRIG, + dev->iobase + DT2821_SUPCSR); wait_for(ad_done(), comedi_error(dev, "timeout\n"); return -ETIME;); @@ -718,7 +718,8 @@ static int dt282x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* external trigger */ devpriv->supcsr = DT2821_ERRINTEN | DT2821_DS0 | DT2821_DS1; } - update_supcsr(DT2821_CLRDMADNE | DT2821_BUFFB | DT2821_ADCINIT); + outw(devpriv->supcsr | DT2821_CLRDMADNE | DT2821_BUFFB | DT2821_ADCINIT, + dev->iobase + DT2821_SUPCSR); devpriv->ntrig = cmd->stop_arg * cmd->scan_end_arg; devpriv->nread = devpriv->ntrig; @@ -729,7 +730,7 @@ static int dt282x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (devpriv->ntrig) { prep_ai_dma(dev, 1, 0); devpriv->supcsr |= DT2821_DDMA; - update_supcsr(0); + outw(devpriv->supcsr, dev->iobase + DT2821_SUPCSR); } devpriv->adcsr = 0; @@ -737,16 +738,17 @@ static int dt282x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) dt282x_load_changain(dev, cmd->chanlist_len, cmd->chanlist); devpriv->adcsr = DT2821_ADCLK | DT2821_IADDONE; - update_adcsr(0); + outw(devpriv->adcsr, dev->iobase + DT2821_ADCSR); - update_supcsr(DT2821_PRLD); + outw(devpriv->supcsr | DT2821_PRLD, dev->iobase + DT2821_SUPCSR); wait_for(!mux_busy(), comedi_error(dev, "timeout\n"); return -ETIME;); if (cmd->scan_begin_src == TRIG_FOLLOW) { - update_supcsr(DT2821_STRIG); + outw(devpriv->supcsr | DT2821_STRIG, + dev->iobase + DT2821_SUPCSR); } else { devpriv->supcsr |= DT2821_XTRIG; - update_supcsr(0); + outw(devpriv->supcsr, dev->iobase + DT2821_SUPCSR); } return 0; @@ -766,10 +768,10 @@ static int dt282x_ai_cancel(struct comedi_device *dev, dt282x_disable_dma(dev); devpriv->adcsr = 0; - update_adcsr(0); + outw(devpriv->adcsr, dev->iobase + DT2821_ADCSR); devpriv->supcsr = 0; - update_supcsr(DT2821_ADCINIT); + outw(devpriv->supcsr | DT2821_ADCINIT, dev->iobase + DT2821_SUPCSR); return 0; } @@ -845,11 +847,11 @@ static int dt282x_ao_insn_write(struct comedi_device *dev, d ^= (1 << (boardtype.dabits - 1)); } - update_dacsr(0); + outw(devpriv->dacsr, dev->iobase + DT2821_DACSR); outw(d, dev->iobase + DT2821_DADAT); - update_supcsr(DT2821_DACON); + outw(devpriv->supcsr | DT2821_DACON, dev->iobase + DT2821_SUPCSR); return 1; } @@ -972,7 +974,7 @@ static int dt282x_ao_inttrig(struct comedi_device *dev, } prep_ao_dma(dev, 1, size); - update_supcsr(DT2821_STRIG); + outw(devpriv->supcsr | DT2821_STRIG, dev->iobase + DT2821_SUPCSR); s->async->inttrig = NULL; return 1; @@ -993,7 +995,8 @@ static int dt282x_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) dt282x_disable_dma(dev); devpriv->supcsr = DT2821_ERRINTEN | DT2821_DS1 | DT2821_DDMA; - update_supcsr(DT2821_CLRDMADNE | DT2821_BUFFB | DT2821_DACINIT); + outw(devpriv->supcsr | DT2821_CLRDMADNE | DT2821_BUFFB | DT2821_DACINIT, + dev->iobase + DT2821_SUPCSR); devpriv->ntrig = cmd->stop_arg * cmd->chanlist_len; devpriv->nread = devpriv->ntrig; @@ -1005,7 +1008,7 @@ static int dt282x_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) outw(timer, dev->iobase + DT2821_TMRCTR); devpriv->dacsr = DT2821_SSEL | DT2821_DACLK | DT2821_IDARDY; - update_dacsr(0); + outw(devpriv->dacsr, dev->iobase + DT2821_DACSR); s->async->inttrig = dt282x_ao_inttrig; @@ -1018,10 +1021,10 @@ static int dt282x_ao_cancel(struct comedi_device *dev, dt282x_disable_dma(dev); devpriv->dacsr = 0; - update_dacsr(0); + outw(devpriv->dacsr, dev->iobase + DT2821_DACSR); devpriv->supcsr = 0; - update_supcsr(DT2821_DACINIT); + outw(devpriv->supcsr | DT2821_DACINIT, dev->iobase + DT2821_SUPCSR); return 0; } -- cgit v0.10.2 From 1337b07e664c5a40ae0c5cbc13f5da4cf37c870c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Iglesias=20Gons=C3=A1lvez?= Date: Fri, 13 Jul 2012 13:33:13 +0200 Subject: Staging: ipack/devices/ipoctal: fix dereference NULL pointer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After opening and closing the file /dev/ipoctal.X.Y.Z for the second time, it gives a kernel oops due to a dereference of a NULL pointer. The problem was that tty->driver_data was not properly initialized when accessing the file for the second time. Reported-by: Alberto Garcia Gonzalez Signed-off-by: Samuel Iglesias Gonsálvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/devices/ipoctal.c b/drivers/staging/ipack/devices/ipoctal.c index a5af423..a1aae40 100644 --- a/drivers/staging/ipack/devices/ipoctal.c +++ b/drivers/staging/ipack/devices/ipoctal.c @@ -114,8 +114,6 @@ static int ipoctal_port_activate(struct tty_port *port, struct tty_struct *tty) ipoctal_write_io_reg(ipoctal, &ipoctal->chan_regs[channel].u.w.cr, CR_ENABLE_RX); - tty->driver_data = ipoctal; - return 0; } @@ -136,6 +134,8 @@ static int ipoctal_open(struct tty_struct *tty, struct file *file) if (atomic_read(&ipoctal->open[channel])) return -EBUSY; + tty->driver_data = ipoctal; + res = tty_port_open(&ipoctal->tty_port[channel], tty, file); if (res) return res; -- cgit v0.10.2 From 4eed84a8a4731e37254a10adfaad76e69e236b8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Iglesias=20Gons=C3=A1lvez?= Date: Fri, 13 Jul 2012 13:33:14 +0200 Subject: Staging: ipack/devices/ipoctal: initialize the device in probe function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Initialize the device when registering it. Sometimes the user access to it and the device is in an unknown state, so it could fail. Signed-off-by: Samuel Iglesias Gonsálvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/devices/ipoctal.c b/drivers/staging/ipack/devices/ipoctal.c index a1aae40..fd0e301 100644 --- a/drivers/staging/ipack/devices/ipoctal.c +++ b/drivers/staging/ipack/devices/ipoctal.c @@ -411,6 +411,20 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, for (i = 0; i < NR_CHANNELS ; i++) { ipoctal_write_io_reg(ipoctal, &ipoctal->chan_regs[i].u.w.cr, CR_DISABLE_RX | CR_DISABLE_TX); + ipoctal_write_cr_cmd(ipoctal, &ipoctal->chan_regs[i].u.w.cr, + CR_CMD_RESET_RX); + ipoctal_write_cr_cmd(ipoctal, &ipoctal->chan_regs[i].u.w.cr, + CR_CMD_RESET_TX); + ipoctal_write_io_reg(ipoctal, + &ipoctal->chan_regs[i].u.w.mr, + MR1_CHRL_8_BITS | MR1_ERROR_CHAR | + MR1_RxINT_RxRDY); /* mr1 */ + ipoctal_write_io_reg(ipoctal, + &ipoctal->chan_regs[i].u.w.mr, + 0); /* mr2 */ + ipoctal_write_io_reg(ipoctal, + &ipoctal->chan_regs[i].u.w.csr, + TX_CLK_9600 | RX_CLK_9600); } for (i = 0; i < IP_OCTAL_NB_BLOCKS; i++) { -- cgit v0.10.2 From 6bab320b40fa59f5dd6468c1bc6204fbaac68700 Mon Sep 17 00:00:00 2001 From: Paul Bolle Date: Fri, 13 Jul 2012 14:03:42 +0200 Subject: staging: wlags49_h2: remove vi modelines Opening drivers/staging/wlags49_h2/dhf.h with vim triggered this warning: "drivers/staging/wlags49_h2/dhf.h" 226L, 8428C Error detected while processing modelines: line 2: E518: Unknown option: */ Press ENTER or type command to continue Since the Linux kernel coding style disallows modelines this invalid modeline can simply be removed. And since we're touching this file we might as well remove all vim modelines from this driver. vim tested only. Signed-off-by: Paul Bolle Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/wlags49_h2/dhf.c b/drivers/staging/wlags49_h2/dhf.c index bb80b54..13d360f 100644 --- a/drivers/staging/wlags49_h2/dhf.c +++ b/drivers/staging/wlags49_h2/dhf.c @@ -1,5 +1,4 @@ -/* vim:tw=110:ts=4: */ /************************************************************************************************************** * * FILE : DHF.C diff --git a/drivers/staging/wlags49_h2/dhf.h b/drivers/staging/wlags49_h2/dhf.h index dbe0611..1299b825 100644 --- a/drivers/staging/wlags49_h2/dhf.h +++ b/drivers/staging/wlags49_h2/dhf.h @@ -1,5 +1,4 @@ -/* vim:tw=110:ts=4: */ #ifndef DHF_H #define DHF_H diff --git a/drivers/staging/wlags49_h2/hcf.h b/drivers/staging/wlags49_h2/hcf.h index 68e2330..2abeaa1 100644 --- a/drivers/staging/wlags49_h2/hcf.h +++ b/drivers/staging/wlags49_h2/hcf.h @@ -1,5 +1,4 @@ -// vim:tw=110:ts=4: #ifndef HCF_H #define HCF_H 1 diff --git a/drivers/staging/wlags49_h2/hcfcfg.h b/drivers/staging/wlags49_h2/hcfcfg.h index ef60da8..39fb4d3 100644 --- a/drivers/staging/wlags49_h2/hcfcfg.h +++ b/drivers/staging/wlags49_h2/hcfcfg.h @@ -1,5 +1,4 @@ -// vim:tw=110:ts=4: #ifndef HCFCFG_H #define HCFCFG_H 1 diff --git a/drivers/staging/wlags49_h2/mdd.h b/drivers/staging/wlags49_h2/mdd.h index 5f951ef..5c3515f 100644 --- a/drivers/staging/wlags49_h2/mdd.h +++ b/drivers/staging/wlags49_h2/mdd.h @@ -1,5 +1,4 @@ -// vim:tw=110:ts=4: #ifndef MDD_H #define MDD_H 1 diff --git a/drivers/staging/wlags49_h2/mmd.c b/drivers/staging/wlags49_h2/mmd.c index 7204a37..3312348 100644 --- a/drivers/staging/wlags49_h2/mmd.c +++ b/drivers/staging/wlags49_h2/mmd.c @@ -1,5 +1,4 @@ -// vim:tw=110:ts=4: /************************************************************************************************************ * * FILE : mmd.c diff --git a/drivers/staging/wlags49_h2/mmd.h b/drivers/staging/wlags49_h2/mmd.h index 9149525..1445803 100644 --- a/drivers/staging/wlags49_h2/mmd.h +++ b/drivers/staging/wlags49_h2/mmd.h @@ -1,5 +1,4 @@ -// vim:tw=110:ts=4: #ifndef MMD_H #define MMD_H 1 -- cgit v0.10.2 From a984fa55400b647f88bb3ee64d0cf932f7b510cd Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Sat, 14 Jul 2012 02:06:07 +0545 Subject: staging/vt6656: coding style fix in BSSvSecondTxData this function seemed bit more coding style fix... The following fixes: remove spaces at start of line and use tabs use space between if and ( give a space in a multiplication operation use space after = and another variable/constant Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index 78ea121..cecfdb6 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -1273,32 +1273,32 @@ void vResetCommandTimer(void *hDeviceContext) void BSSvSecondTxData(void *hDeviceContext) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - - pDevice->nTxDataTimeCout++; - - if(pDevice->nTxDataTimeCout<4) //don't tx data if timer less than 40s - { - // printk("mike:%s-->no data Tx not exceed the desired Time as %d\n",__FUNCTION__, - // (int)pDevice->nTxDataTimeCout); - pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback - add_timer(&pDevice->sTimerTxData); - return; - } - - spin_lock_irq(&pDevice->lock); - //is wap_supplicant running successful OR only open && sharekey mode! - if(((pDevice->bLinkPass ==TRUE)&&(pMgmt->eAuthenMode < WMAC_AUTH_WPA)) || //open && sharekey linking - (pDevice->fWPA_Authened == TRUE)) { //wpa linking - // printk("mike:%s-->InSleep Tx Data Procedure\n",__FUNCTION__); - pDevice->fTxDataInSleep = TRUE; - PSbSendNullPacket(pDevice); //send null packet - pDevice->fTxDataInSleep = FALSE; - } - spin_unlock_irq(&pDevice->lock); - - pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback - add_timer(&pDevice->sTimerTxData); - return; + PSDevice pDevice = (PSDevice)hDeviceContext; + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + + pDevice->nTxDataTimeCout++; + + if (pDevice->nTxDataTimeCout < 4) { //don't tx data if timer less than 40s + // printk("mike:%s-->no data Tx not exceed the desired Time as %d\n",__FUNCTION__, + // (int)pDevice->nTxDataTimeCout); + pDevice->sTimerTxData.expires = RUN_AT(10 * HZ); //10s callback + add_timer(&pDevice->sTimerTxData); + return; + } + + spin_lock_irq(&pDevice->lock); + //is wap_supplicant running successful OR only open && sharekey mode! + if (((pDevice->bLinkPass == TRUE) && + (pMgmt->eAuthenMode < WMAC_AUTH_WPA)) || //open && sharekey linking + (pDevice->fWPA_Authened == TRUE)) { //wpa linking + // printk("mike:%s-->InSleep Tx Data Procedure\n",__FUNCTION__); + pDevice->fTxDataInSleep = TRUE; + PSbSendNullPacket(pDevice); //send null packet + pDevice->fTxDataInSleep = FALSE; + } + spin_unlock_irq(&pDevice->lock); + + pDevice->sTimerTxData.expires = RUN_AT(10 * HZ); //10s callback + add_timer(&pDevice->sTimerTxData); + return; } -- cgit v0.10.2 From eab6e193076c8469971c57488d301b16014adf91 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Sat, 14 Jul 2012 02:06:52 +0545 Subject: staging/vt6656: remove unnecessary return in BSSvSecondTxData this return is at the function end, and function is returning nothing.. i.e a void. Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index cecfdb6..c9de937 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -1300,5 +1300,4 @@ void BSSvSecondTxData(void *hDeviceContext) pDevice->sTimerTxData.expires = RUN_AT(10 * HZ); //10s callback add_timer(&pDevice->sTimerTxData); - return; } -- cgit v0.10.2 From 3afe5f6ca150f1a402543b32f8fe66f759c7d8ed Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Sat, 14 Jul 2012 02:07:18 +0545 Subject: staging/vt6656: cleanup coding style in vResetCommandTimer the following fixes... removed spaces at start of a line and used tabs Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index c9de937..9d2caa8 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -1254,21 +1254,21 @@ static BOOL s_bClearBSSID_SCAN(void *hDeviceContext) //mike add:reset command timer void vResetCommandTimer(void *hDeviceContext) { - PSDevice pDevice = (PSDevice)hDeviceContext; + PSDevice pDevice = (PSDevice)hDeviceContext; - //delete timer - del_timer(&pDevice->sTimerCommand); - //init timer - init_timer(&pDevice->sTimerCommand); - pDevice->sTimerCommand.data = (unsigned long)pDevice; - pDevice->sTimerCommand.function = (TimerFunction)vRunCommand; - pDevice->sTimerCommand.expires = RUN_AT(HZ); - pDevice->cbFreeCmdQueue = CMD_Q_SIZE; - pDevice->uCmdDequeueIdx = 0; - pDevice->uCmdEnqueueIdx = 0; - pDevice->eCommandState = WLAN_CMD_IDLE; - pDevice->bCmdRunning = FALSE; - pDevice->bCmdClear = FALSE; + //delete timer + del_timer(&pDevice->sTimerCommand); + //init timer + init_timer(&pDevice->sTimerCommand); + pDevice->sTimerCommand.data = (unsigned long)pDevice; + pDevice->sTimerCommand.function = (TimerFunction)vRunCommand; + pDevice->sTimerCommand.expires = RUN_AT(HZ); + pDevice->cbFreeCmdQueue = CMD_Q_SIZE; + pDevice->uCmdDequeueIdx = 0; + pDevice->uCmdEnqueueIdx = 0; + pDevice->eCommandState = WLAN_CMD_IDLE; + pDevice->bCmdRunning = FALSE; + pDevice->bCmdClear = FALSE; } void BSSvSecondTxData(void *hDeviceContext) -- cgit v0.10.2 From 2390e83439f533cf2eaf506087e4efb6cf92d91f Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Jul 2012 17:05:02 -0700 Subject: staging: comedi: addi_data: remove pr_TTLRangelist All the addi driver ttl subdevices use the range table 'range_digital' provided by the comedi core. The boardinfo value 'pr_TTLRangeList' is not used by the drivers. Remove the unused range tables and the boardinfo pointer. The unused range tables don't make sense anyway... Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c index a5aa673..a3d4ed2 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.c +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c @@ -613,7 +613,6 @@ static const struct addi_board boardtypes[] = { .i_IorangeBase0 = 128, .i_PCIEeprom = ADDIDATA_NO_EEPROM, .i_NbrTTLChannel = 48, - .pr_TTLRangelist = &range_apci16xx_ttl, .reset = i_APCI16XX_Reset, .ttl_config = i_APCI16XX_InsnConfigInitTTLIO, .ttl_bits = i_APCI16XX_InsnBitsReadTTLIO, @@ -626,7 +625,6 @@ static const struct addi_board boardtypes[] = { .i_IorangeBase0 = 128, .i_PCIEeprom = ADDIDATA_NO_EEPROM, .i_NbrTTLChannel = 96, - .pr_TTLRangelist = &range_apci16xx_ttl, .reset = i_APCI16XX_Reset, .ttl_config = i_APCI16XX_InsnConfigInitTTLIO, .ttl_bits = i_APCI16XX_InsnBitsReadTTLIO, @@ -651,7 +649,6 @@ static const struct addi_board boardtypes[] = { .i_AiMaxdata = 4095, .pr_AiRangelist = &range_apci3XXX_ai, .i_NbrTTLChannel = 24, - .pr_TTLRangelist = &range_apci3XXX_ttl, .b_AvailableConvertUnit = 6, .ui_MinAcquisitiontimeNs = 10000, .interrupt = v_APCI3XXX_Interrupt, @@ -678,7 +675,6 @@ static const struct addi_board boardtypes[] = { .i_AiMaxdata = 4095, .pr_AiRangelist = &range_apci3XXX_ai, .i_NbrTTLChannel = 24, - .pr_TTLRangelist = &range_apci3XXX_ttl, .b_AvailableConvertUnit = 6, .ui_MinAcquisitiontimeNs = 10000, .interrupt = v_APCI3XXX_Interrupt, @@ -705,7 +701,6 @@ static const struct addi_board boardtypes[] = { .i_AiMaxdata = 4095, .pr_AiRangelist = &range_apci3XXX_ai, .i_NbrTTLChannel = 24, - .pr_TTLRangelist = &range_apci3XXX_ttl, .b_AvailableConvertUnit = 6, .ui_MinAcquisitiontimeNs = 10000, .interrupt = v_APCI3XXX_Interrupt, @@ -732,7 +727,6 @@ static const struct addi_board boardtypes[] = { .i_AiMaxdata = 65535, .pr_AiRangelist = &range_apci3XXX_ai, .i_NbrTTLChannel = 24, - .pr_TTLRangelist = &range_apci3XXX_ttl, .b_AvailableConvertUnit = 6, .ui_MinAcquisitiontimeNs = 10000, .interrupt = v_APCI3XXX_Interrupt, @@ -759,7 +753,6 @@ static const struct addi_board boardtypes[] = { .i_AiMaxdata = 65535, .pr_AiRangelist = &range_apci3XXX_ai, .i_NbrTTLChannel = 24, - .pr_TTLRangelist = &range_apci3XXX_ttl, .b_AvailableConvertUnit = 6, .ui_MinAcquisitiontimeNs = 10000, .interrupt = v_APCI3XXX_Interrupt, @@ -786,7 +779,6 @@ static const struct addi_board boardtypes[] = { .i_AiMaxdata = 65535, .pr_AiRangelist = &range_apci3XXX_ai, .i_NbrTTLChannel = 24, - .pr_TTLRangelist = &range_apci3XXX_ttl, .b_AvailableConvertUnit = 6, .ui_MinAcquisitiontimeNs = 10000, .interrupt = v_APCI3XXX_Interrupt, @@ -816,7 +808,6 @@ static const struct addi_board boardtypes[] = { .i_NbrDoChannel = 4, .i_DoMaxdata = 1, .i_NbrTTLChannel = 24, - .pr_TTLRangelist = &range_apci3XXX_ttl, .b_AvailableConvertUnit = 6, .ui_MinAcquisitiontimeNs = 5000, .interrupt = v_APCI3XXX_Interrupt, @@ -851,7 +842,6 @@ static const struct addi_board boardtypes[] = { .i_NbrDoChannel = 4, .i_DoMaxdata = 1, .i_NbrTTLChannel = 24, - .pr_TTLRangelist = &range_apci3XXX_ttl, .b_AvailableConvertUnit = 6, .ui_MinAcquisitiontimeNs = 5000, .interrupt = v_APCI3XXX_Interrupt, @@ -886,7 +876,6 @@ static const struct addi_board boardtypes[] = { .i_NbrDoChannel = 4, .i_DoMaxdata = 1, .i_NbrTTLChannel = 24, - .pr_TTLRangelist = &range_apci3XXX_ttl, .b_AvailableConvertUnit = 6, .ui_MinAcquisitiontimeNs = 5000, .interrupt = v_APCI3XXX_Interrupt, @@ -921,7 +910,6 @@ static const struct addi_board boardtypes[] = { .i_NbrDoChannel = 4, .i_DoMaxdata = 1, .i_NbrTTLChannel = 24, - .pr_TTLRangelist = &range_apci3XXX_ttl, .b_AvailableConvertUnit = 6, .ui_MinAcquisitiontimeNs = 5000, .interrupt = v_APCI3XXX_Interrupt, @@ -956,7 +944,6 @@ static const struct addi_board boardtypes[] = { .i_NbrDoChannel = 4, .i_DoMaxdata = 1, .i_NbrTTLChannel = 24, - .pr_TTLRangelist = &range_apci3XXX_ttl, .b_AvailableConvertUnit = 6, .ui_MinAcquisitiontimeNs = 5000, .interrupt = v_APCI3XXX_Interrupt, @@ -991,7 +978,6 @@ static const struct addi_board boardtypes[] = { .i_NbrDoChannel = 4, .i_DoMaxdata = 1, .i_NbrTTLChannel = 24, - .pr_TTLRangelist = &range_apci3XXX_ttl, .b_AvailableConvertUnit = 6, .ui_MinAcquisitiontimeNs = 5000, .interrupt = v_APCI3XXX_Interrupt, @@ -1026,7 +1012,6 @@ static const struct addi_board boardtypes[] = { .pr_AiRangelist = &range_apci3XXX_ai, .pr_AoRangelist = &range_apci3XXX_ao, .i_NbrTTLChannel = 24, - .pr_TTLRangelist = &range_apci3XXX_ttl, .b_AvailableConvertUnit = 6, .ui_MinAcquisitiontimeNs = 10000, .interrupt = v_APCI3XXX_Interrupt, @@ -1057,7 +1042,6 @@ static const struct addi_board boardtypes[] = { .pr_AiRangelist = &range_apci3XXX_ai, .pr_AoRangelist = &range_apci3XXX_ao, .i_NbrTTLChannel = 24, - .pr_TTLRangelist = &range_apci3XXX_ttl, .b_AvailableConvertUnit = 6, .ui_MinAcquisitiontimeNs = 10000, .interrupt = v_APCI3XXX_Interrupt, @@ -1088,7 +1072,6 @@ static const struct addi_board boardtypes[] = { .pr_AiRangelist = &range_apci3XXX_ai, .pr_AoRangelist = &range_apci3XXX_ao, .i_NbrTTLChannel = 24, - .pr_TTLRangelist = &range_apci3XXX_ttl, .b_AvailableConvertUnit = 6, .ui_MinAcquisitiontimeNs = 10000, .interrupt = v_APCI3XXX_Interrupt, @@ -1119,7 +1102,6 @@ static const struct addi_board boardtypes[] = { .pr_AiRangelist = &range_apci3XXX_ai, .pr_AoRangelist = &range_apci3XXX_ao, .i_NbrTTLChannel = 24, - .pr_TTLRangelist = &range_apci3XXX_ttl, .b_AvailableConvertUnit = 6, .ui_MinAcquisitiontimeNs = 10000, .interrupt = v_APCI3XXX_Interrupt, @@ -1153,7 +1135,6 @@ static const struct addi_board boardtypes[] = { .i_NbrDoChannel = 4, .i_DoMaxdata = 1, .i_NbrTTLChannel = 24, - .pr_TTLRangelist = &range_apci3XXX_ttl, .b_AvailableConvertUnit = 6, .ui_MinAcquisitiontimeNs = 5000, .interrupt = v_APCI3XXX_Interrupt, @@ -1192,7 +1173,6 @@ static const struct addi_board boardtypes[] = { .i_NbrDoChannel = 4, .i_DoMaxdata = 1, .i_NbrTTLChannel = 24, - .pr_TTLRangelist = &range_apci3XXX_ttl, .b_AvailableConvertUnit = 6, .ui_MinAcquisitiontimeNs = 5000, .interrupt = v_APCI3XXX_Interrupt, @@ -1231,7 +1211,6 @@ static const struct addi_board boardtypes[] = { .i_NbrDoChannel = 4, .i_DoMaxdata = 1, .i_NbrTTLChannel = 24, - .pr_TTLRangelist = &range_apci3XXX_ttl, .b_AvailableConvertUnit = 6, .ui_MinAcquisitiontimeNs = 5000, .interrupt = v_APCI3XXX_Interrupt, @@ -1270,7 +1249,6 @@ static const struct addi_board boardtypes[] = { .i_NbrDoChannel = 4, .i_DoMaxdata = 1, .i_NbrTTLChannel = 24, - .pr_TTLRangelist = &range_apci3XXX_ttl, .b_AvailableConvertUnit = 6, .ui_MinAcquisitiontimeNs = 5000, .interrupt = v_APCI3XXX_Interrupt, @@ -1413,7 +1391,6 @@ static const struct addi_board boardtypes[] = { .i_AoMaxdata = 4095, .pr_AoRangelist = &range_apci3XXX_ao, .i_NbrTTLChannel = 24, - .pr_TTLRangelist = &range_apci3XXX_ttl, .interrupt = v_APCI3XXX_Interrupt, .reset = i_APCI3XXX_Reset, .ao_write = i_APCI3XXX_InsnWriteAnalogOutput, diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.h b/drivers/staging/comedi/drivers/addi-data/addi_common.h index 2c3f347..b7bbb71 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.h @@ -85,7 +85,6 @@ struct addi_board { int i_DoMaxdata; /* data to set all channels high */ int i_NbrTTLChannel; /* Number of TTL channels */ - const struct comedi_lrange *pr_TTLRangelist; /* rangelist for TTL */ int i_Dma; /* dma present or not */ int i_Timer; /* timer subdevice present or not */ diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci16xx.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci16xx.h index 5bf91e1..a12df4b 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci16xx.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci16xx.h @@ -41,21 +41,6 @@ #ifdef __KERNEL__ -static const struct comedi_lrange range_apci16xx_ttl = { 12, - {BIP_RANGE(1), - BIP_RANGE(1), - BIP_RANGE(1), - BIP_RANGE(1), - BIP_RANGE(1), - BIP_RANGE(1), - BIP_RANGE(1), - BIP_RANGE(1), - BIP_RANGE(1), - BIP_RANGE(1), - BIP_RANGE(1), - BIP_RANGE(1)} -}; - /* +----------------------------------------------------------------------------+ | TTL INISIALISATION FUNCTION | diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.h index cce9e12..e10b7e5 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.h @@ -42,20 +42,6 @@ static const struct comedi_lrange range_apci3XXX_ai = { 8, {BIP_RANGE(10), UNI_RANGE(1)} }; -static const struct comedi_lrange range_apci3XXX_ttl = { 12, {BIP_RANGE(1), - BIP_RANGE(1), - BIP_RANGE(1), - BIP_RANGE(1), - BIP_RANGE(1), - BIP_RANGE(1), - BIP_RANGE(1), - BIP_RANGE(1), - BIP_RANGE(1), - BIP_RANGE(1), - BIP_RANGE(1), - BIP_RANGE(1)} -}; - static const struct comedi_lrange range_apci3XXX_ao = { 2, {BIP_RANGE(10), UNI_RANGE(10)} }; -- cgit v0.10.2 From 6594ac5dead7ad7cd10103d147eda3190fd49cad Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Sat, 14 Jul 2012 13:25:37 +0545 Subject: staging/winbond: use err and remove nr err can be used get return status of the usb_control_msg, rather using nr and assigning it to err when the function returns error. Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c index c3751a7..ef36054 100644 --- a/drivers/staging/winbond/wbusb.c +++ b/drivers/staging/winbond/wbusb.c @@ -747,20 +747,18 @@ static int wb35_probe(struct usb_interface *intf, struct usb_host_interface *interface; struct ieee80211_hw *dev; struct wbsoft_priv *priv; - int nr, err; + int err; u32 ltmp; usb_get_dev(udev); /* Check the device if it already be opened */ - nr = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), + err = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x01, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, 0x0, 0x400, <mp, 4, HZ * 100); - if (nr < 0) { - err = nr; + if (err < 0) goto error; - } /* Is already initialized? */ ltmp = cpu_to_le32(ltmp); -- cgit v0.10.2 From 1a46eafe1c4a2bf45928beb280b378f5af904ed9 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Sat, 14 Jul 2012 13:26:59 +0545 Subject: staging/wlan-ng: use kzalloc rather using kmalloc at create_wlan instead we would have used kzalloc, so our memory which is allocated will be set to 0. codepath: the code path here is prism2sta_probe_usb, calling when ever usb-dev id and usb-vendor id e.t.c matches with what ever present in the MODULE_DEVICE_TABLE, and in prism2sta_probe_usb , we call create_wlan, and its called nowhere else... Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c index 417aea5..1dfd9aa 100644 --- a/drivers/staging/wlan-ng/prism2sta.c +++ b/drivers/staging/wlan-ng/prism2sta.c @@ -1947,8 +1947,8 @@ static wlandevice_t *create_wlan(void) hfa384x_t *hw = NULL; /* Alloc our structures */ - wlandev = kmalloc(sizeof(wlandevice_t), GFP_KERNEL); - hw = kmalloc(sizeof(hfa384x_t), GFP_KERNEL); + wlandev = kzalloc(sizeof(wlandevice_t), GFP_KERNEL); + hw = kzalloc(sizeof(hfa384x_t), GFP_KERNEL); if (!wlandev || !hw) { printk(KERN_ERR "%s: Memory allocation failure.\n", dev_info); @@ -1957,10 +1957,6 @@ static wlandevice_t *create_wlan(void) return NULL; } - /* Clear all the structs */ - memset(wlandev, 0, sizeof(wlandevice_t)); - memset(hw, 0, sizeof(hfa384x_t)); - /* Initialize the network device object. */ wlandev->nsdname = dev_info; wlandev->msdstate = WLAN_MSD_HWPRESENT_PENDING; -- cgit v0.10.2 From 71063199213795b886329f3e8e02ad6c1589efea Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Sun, 15 Jul 2012 23:14:37 +0530 Subject: staging/rts_pstor: use kthread_run instead doing kthread_create and wake_up_process with kthread_create we need to call wake_up_process to run the thread, this can be done using the macro kthread_run, which creates and if thread creation is succeeded starts the thread by calling wake_up_process, and also there are two more threads in the rts_pstor, which calls kthread_run instead calling kthread_create and another call to the wake_up_process, so with this change the creation of rtsx_scan_thread will be in consistency with the other control and poll threads. Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/rts_pstor/rtsx.c b/drivers/staging/rts_pstor/rtsx.c index 1dccd93..5fb05a2 100644 --- a/drivers/staging/rts_pstor/rtsx.c +++ b/drivers/staging/rts_pstor/rtsx.c @@ -1021,7 +1021,7 @@ static int __devinit rtsx_probe(struct pci_dev *pci, } /* Start up the thread for delayed SCSI-device scanning */ - th = kthread_create(rtsx_scan_thread, dev, "rtsx-scan"); + th = kthread_run(rtsx_scan_thread, dev, "rtsx-scan"); if (IS_ERR(th)) { printk(KERN_ERR "Unable to start the device-scanning thread\n"); complete(&dev->scanning_done); @@ -1030,8 +1030,6 @@ static int __devinit rtsx_probe(struct pci_dev *pci, goto errout; } - wake_up_process(th); - /* Start up the thread for polling thread */ th = kthread_run(rtsx_polling_thread, dev, "rtsx-polling"); if (IS_ERR(th)) { -- cgit v0.10.2 From d761074bfa05c763353c265aea3e8781f733a03e Mon Sep 17 00:00:00 2001 From: "Justin P. Mattock" Date: Mon, 16 Jul 2012 07:30:05 -0700 Subject: staging: ste_rmi4: Fix typos Signed-off-by: Justin P. Mattock Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c index 11728a0..277491a 100644 --- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c +++ b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c @@ -655,13 +655,13 @@ static int synpatics_rmi4_touchpad_detect(struct synaptics_rmi4_data *pdata, } /** - * synpatics_rmi4_touchpad_config() - confiures the rmi4 touchpad device + * synaptics_rmi4_touchpad_config() - configures the rmi4 touchpad device * @pdata: pointer to synaptics_rmi4_data structure * @rfi: pointer to synaptics_rmi4_fn structure * - * This function calls to confiures the rmi4 touchpad device + * This function calls to configures the rmi4 touchpad device */ -int synpatics_rmi4_touchpad_config(struct synaptics_rmi4_data *pdata, +int synaptics_rmi4_touchpad_config(struct synaptics_rmi4_data *pdata, struct synaptics_rmi4_fn *rfi) { /* @@ -855,7 +855,7 @@ static int synaptics_rmi4_i2c_query_device(struct synaptics_rmi4_data *pdata) if (rfi->num_of_data_sources) { if (rfi->fn_number == SYNAPTICS_RMI4_TOUCHPAD_FUNC_NUM) { - retval = synpatics_rmi4_touchpad_config + retval = synaptics_rmi4_touchpad_config (pdata, rfi); if (retval < 0) return retval; -- cgit v0.10.2 From 4a53ffae6afc94bab803087245b3b45e712c21c8 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Mon, 9 Jul 2012 17:03:18 -0700 Subject: pstore/ram_core: Get rid of prz->ecc_symsize and prz->ecc_poly The struct members were never used anywhere outside of persistent_ram_init_ecc(), so there's actually no need for them to be in the struct. If we ever want to make polynomial or symbol size configurable, it would make more sense to just pass initialized rs_decoder to the persistent_ram init functions. Signed-off-by: Anton Vorontsov Acked-by: Kees Cook Signed-off-by: Greg Kroah-Hartman diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index a5a7b13..3f4d6e6 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c @@ -177,14 +177,14 @@ static int persistent_ram_init_ecc(struct persistent_ram_zone *prz) struct persistent_ram_buffer *buffer = prz->buffer; int ecc_blocks; size_t ecc_total; + int ecc_symsize = 8; + int ecc_poly = 0x11d; if (!prz->ecc) return 0; prz->ecc_block_size = 128; prz->ecc_size = 16; - prz->ecc_symsize = 8; - prz->ecc_poly = 0x11d; ecc_blocks = DIV_ROUND_UP(prz->buffer_size, prz->ecc_block_size); ecc_total = (ecc_blocks + 1) * prz->ecc_size; @@ -202,8 +202,7 @@ static int persistent_ram_init_ecc(struct persistent_ram_zone *prz) * first consecutive root is 0 * primitive element to generate roots = 1 */ - prz->rs_decoder = init_rs(prz->ecc_symsize, prz->ecc_poly, 0, 1, - prz->ecc_size); + prz->rs_decoder = init_rs(ecc_symsize, ecc_poly, 0, 1, prz->ecc_size); if (prz->rs_decoder == NULL) { pr_info("persistent_ram: init_rs failed\n"); return -EINVAL; diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h index e681af9..a0975c0 100644 --- a/include/linux/pstore_ram.h +++ b/include/linux/pstore_ram.h @@ -41,8 +41,6 @@ struct persistent_ram_zone { int bad_blocks; int ecc_block_size; int ecc_size; - int ecc_symsize; - int ecc_poly; char *old_log; size_t old_log_size; -- cgit v0.10.2 From 5ca5d4e61d0cac15f36160ab48425c6e43bf2e2f Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Mon, 9 Jul 2012 17:03:19 -0700 Subject: pstore/ram: Make ECC size configurable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is now pretty straightforward: instead of using bool, just pass an integer. For backwards compatibility ramoops.ecc=1 means 16 bytes ECC (using 1 byte for ECC isn't much of use anyway). Suggested-by: Arve Hjønnevåg Signed-off-by: Anton Vorontsov Acked-by: Kees Cook Signed-off-by: Greg Kroah-Hartman diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 58b93fb..b39aebb 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -63,7 +63,9 @@ MODULE_PARM_DESC(dump_oops, static int ramoops_ecc; module_param_named(ecc, ramoops_ecc, int, 0600); MODULE_PARM_DESC(ramoops_ecc, - "set to 1 to enable ECC support"); + "if non-zero, the option enables ECC support and specifies " + "ECC buffer size in bytes (1 is a special value, means 16 " + "bytes ECC)"); struct ramoops_context { struct persistent_ram_zone **przs; @@ -73,7 +75,7 @@ struct ramoops_context { size_t record_size; size_t console_size; int dump_oops; - bool ecc; + int ecc_size; unsigned int max_dump_cnt; unsigned int dump_write_cnt; unsigned int dump_read_cnt; @@ -288,7 +290,7 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt, for (i = 0; i < cxt->max_dump_cnt; i++) { size_t sz = cxt->record_size; - cxt->przs[i] = persistent_ram_new(*paddr, sz, cxt->ecc); + cxt->przs[i] = persistent_ram_new(*paddr, sz, cxt->ecc_size); if (IS_ERR(cxt->przs[i])) { err = PTR_ERR(cxt->przs[i]); dev_err(dev, "failed to request mem region (0x%zx@0x%llx): %d\n", @@ -314,7 +316,7 @@ static int ramoops_init_prz(struct device *dev, struct ramoops_context *cxt, if (*paddr + sz > *paddr + cxt->size) return -ENOMEM; - *prz = persistent_ram_new(*paddr, sz, cxt->ecc); + *prz = persistent_ram_new(*paddr, sz, cxt->ecc_size); if (IS_ERR(*prz)) { int err = PTR_ERR(*prz); @@ -361,7 +363,7 @@ static int __devinit ramoops_probe(struct platform_device *pdev) cxt->record_size = pdata->record_size; cxt->console_size = pdata->console_size; cxt->dump_oops = pdata->dump_oops; - cxt->ecc = pdata->ecc; + cxt->ecc_size = pdata->ecc_size; paddr = cxt->phys_addr; @@ -411,9 +413,9 @@ static int __devinit ramoops_probe(struct platform_device *pdev) record_size = pdata->record_size; dump_oops = pdata->dump_oops; - pr_info("attached 0x%lx@0x%llx, ecc: %s\n", + pr_info("attached 0x%lx@0x%llx, ecc: %d\n", cxt->size, (unsigned long long)cxt->phys_addr, - ramoops_ecc ? "on" : "off"); + cxt->ecc_size); return 0; @@ -478,7 +480,11 @@ static void ramoops_register_dummy(void) dummy_data->record_size = record_size; dummy_data->console_size = ramoops_console_size; dummy_data->dump_oops = dump_oops; - dummy_data->ecc = ramoops_ecc; + /* + * For backwards compatibility ramoops.ecc=1 means 16 bytes ECC + * (using 1 byte for ECC isn't much of use anyway). + */ + dummy_data->ecc_size = ramoops_ecc == 1 ? 16 : ramoops_ecc; dummy = platform_device_register_data(NULL, "ramoops", -1, dummy_data, sizeof(struct ramoops_platform_data)); diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index 3f4d6e6..7e5a2a9 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c @@ -171,7 +171,8 @@ static void persistent_ram_ecc_old(struct persistent_ram_zone *prz) } } -static int persistent_ram_init_ecc(struct persistent_ram_zone *prz) +static int persistent_ram_init_ecc(struct persistent_ram_zone *prz, + int ecc_size) { int numerr; struct persistent_ram_buffer *buffer = prz->buffer; @@ -184,7 +185,7 @@ static int persistent_ram_init_ecc(struct persistent_ram_zone *prz) return 0; prz->ecc_block_size = 128; - prz->ecc_size = 16; + prz->ecc_size = ecc_size; ecc_blocks = DIV_ROUND_UP(prz->buffer_size, prz->ecc_block_size); ecc_total = (ecc_blocks + 1) * prz->ecc_size; @@ -390,13 +391,13 @@ static int persistent_ram_buffer_map(phys_addr_t start, phys_addr_t size, } static int __devinit persistent_ram_post_init(struct persistent_ram_zone *prz, - bool ecc) + int ecc_size) { int ret; - prz->ecc = ecc; + prz->ecc = ecc_size; - ret = persistent_ram_init_ecc(prz); + ret = persistent_ram_init_ecc(prz, ecc_size); if (ret) return ret; @@ -444,7 +445,7 @@ void persistent_ram_free(struct persistent_ram_zone *prz) struct persistent_ram_zone * __devinit persistent_ram_new(phys_addr_t start, size_t size, - bool ecc) + int ecc_size) { struct persistent_ram_zone *prz; int ret = -ENOMEM; @@ -459,7 +460,7 @@ struct persistent_ram_zone * __devinit persistent_ram_new(phys_addr_t start, if (ret) goto err; - ret = persistent_ram_post_init(prz, ecc); + ret = persistent_ram_post_init(prz, ecc_size); if (ret) goto err; diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h index a0975c0..94b79f1 100644 --- a/include/linux/pstore_ram.h +++ b/include/linux/pstore_ram.h @@ -48,7 +48,7 @@ struct persistent_ram_zone { struct persistent_ram_zone * __devinit persistent_ram_new(phys_addr_t start, size_t size, - bool ecc); + int ecc_size); void persistent_ram_free(struct persistent_ram_zone *prz); void persistent_ram_zap(struct persistent_ram_zone *prz); @@ -74,7 +74,7 @@ struct ramoops_platform_data { unsigned long record_size; unsigned long console_size; int dump_oops; - bool ecc; + int ecc_size; }; #endif -- cgit v0.10.2 From c1743cbc8d20d208bb1d2b10598204f2d89b144c Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Mon, 9 Jul 2012 17:03:20 -0700 Subject: pstore/ram_core: Get rid of prz->ecc enable/disable flag Nowadays we can use prz->ecc_size as a flag, no need for the special member in the prz struct. Signed-off-by: Anton Vorontsov Acked-by: Kees Cook Signed-off-by: Greg Kroah-Hartman diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index 7e5a2a9..4dabbb8 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c @@ -114,7 +114,7 @@ static void notrace persistent_ram_update_ecc(struct persistent_ram_zone *prz, int ecc_size = prz->ecc_size; int size = prz->ecc_block_size; - if (!prz->ecc) + if (!prz->ecc_size) return; block = buffer->data + (start & ~(ecc_block_size - 1)); @@ -133,7 +133,7 @@ static void persistent_ram_update_header_ecc(struct persistent_ram_zone *prz) { struct persistent_ram_buffer *buffer = prz->buffer; - if (!prz->ecc) + if (!prz->ecc_size) return; persistent_ram_encode_rs8(prz, (uint8_t *)buffer, sizeof(*buffer), @@ -146,7 +146,7 @@ static void persistent_ram_ecc_old(struct persistent_ram_zone *prz) uint8_t *block; uint8_t *par; - if (!prz->ecc) + if (!prz->ecc_size) return; block = buffer->data; @@ -181,7 +181,7 @@ static int persistent_ram_init_ecc(struct persistent_ram_zone *prz, int ecc_symsize = 8; int ecc_poly = 0x11d; - if (!prz->ecc) + if (!ecc_size) return 0; prz->ecc_block_size = 128; @@ -395,8 +395,6 @@ static int __devinit persistent_ram_post_init(struct persistent_ram_zone *prz, { int ret; - prz->ecc = ecc_size; - ret = persistent_ram_init_ecc(prz, ecc_size); if (ret) return ret; diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h index 94b79f1..dcf805f 100644 --- a/include/linux/pstore_ram.h +++ b/include/linux/pstore_ram.h @@ -33,7 +33,6 @@ struct persistent_ram_zone { size_t buffer_size; /* ECC correction */ - bool ecc; char *par_buffer; char *par_header; struct rs_control *rs_decoder; -- cgit v0.10.2 From b2ad368bebc0f772613668e893fa176396e9094c Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Mon, 9 Jul 2012 17:10:39 -0700 Subject: tracing: Fix initialization failure path in tracing_set_tracer() If tracer->init() fails, current code will leave current_tracer pointing to an unusable tracer, which at best makes 'current_tracer' report inaccurate value. Fix the issue by pointing current_tracer to nop tracer, and only update current_tracer with the new one after all the initialization succeeds. Signed-off-by: Anton Vorontsov Acked-by: Steven Rostedt Signed-off-by: Greg Kroah-Hartman diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 49249c2..44ee11e 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -3172,10 +3172,10 @@ static int tracing_set_tracer(const char *buf) } destroy_trace_option_files(topts); - current_trace = t; + current_trace = &nop_trace; - topts = create_trace_option_files(current_trace); - if (current_trace->use_max_tr) { + topts = create_trace_option_files(t); + if (t->use_max_tr) { int cpu; /* we need to make per cpu buffer sizes equivalent */ for_each_tracing_cpu(cpu) { @@ -3195,6 +3195,7 @@ static int tracing_set_tracer(const char *buf) goto out; } + current_trace = t; trace_branch_enable(tr); out: mutex_unlock(&trace_types_lock); -- cgit v0.10.2 From 897dba027445be93f40e5caf550556ca38c48c51 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Mon, 9 Jul 2012 17:10:40 -0700 Subject: pstore: Introduce write_buf backend callback For function tracing we need to stop using pstore.buf directly, since in a tracing callback we can't use spinlocks, and thus we can't safely use the global buffer. With write_buf callback, backends no longer need to access pstore.buf directly, and thus we can pass any buffers (e.g. allocated on stack). Signed-off-by: Anton Vorontsov Signed-off-by: Greg Kroah-Hartman diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 6b3ff04..ef5ca8a 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -188,6 +188,14 @@ static void pstore_register_console(void) static void pstore_register_console(void) {} #endif +static int pstore_write_compat(enum pstore_type_id type, + enum kmsg_dump_reason reason, + u64 *id, unsigned int part, + size_t size, struct pstore_info *psi) +{ + return psi->write_buf(type, reason, id, part, psinfo->buf, size, psi); +} + /* * platform specific persistent storage driver registers with * us here. If pstore is already mounted, call the platform @@ -212,6 +220,8 @@ int pstore_register(struct pstore_info *psi) return -EINVAL; } + if (!psi->write) + psi->write = pstore_write_compat; psinfo = psi; mutex_init(&psinfo->read_mutex); spin_unlock(&pstore_lock); diff --git a/include/linux/pstore.h b/include/linux/pstore.h index 1bd014b..b107484 100644 --- a/include/linux/pstore.h +++ b/include/linux/pstore.h @@ -48,6 +48,10 @@ struct pstore_info { int (*write)(enum pstore_type_id type, enum kmsg_dump_reason reason, u64 *id, unsigned int part, size_t size, struct pstore_info *psi); + int (*write_buf)(enum pstore_type_id type, + enum kmsg_dump_reason reason, u64 *id, + unsigned int part, const char *buf, size_t size, + struct pstore_info *psi); int (*erase)(enum pstore_type_id type, u64 id, struct pstore_info *psi); void *data; -- cgit v0.10.2 From 060287b8c467bf49a594d8d669e1986c6d8d76b0 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Mon, 9 Jul 2012 17:10:41 -0700 Subject: pstore: Add persistent function tracing With this support kernel can save function call chain log into a persistent ram buffer that can be decoded and dumped after reboot through pstore filesystem. It can be used to determine what function was last called before a reset or panic. We store the log in a binary format and then decode it at read time. p.s. Mostly the code comes from trace_persistent.c driver found in the Android git tree, written by Colin Cross (according to sign-off history). I reworked the driver a little bit, and ported it to pstore. Signed-off-by: Anton Vorontsov Signed-off-by: Greg Kroah-Hartman diff --git a/fs/pstore/Kconfig b/fs/pstore/Kconfig index d044de6..d39bb5c 100644 --- a/fs/pstore/Kconfig +++ b/fs/pstore/Kconfig @@ -19,6 +19,18 @@ config PSTORE_CONSOLE When the option is enabled, pstore will log all kernel messages, even if no oops or panic happened. +config PSTORE_FTRACE + bool "Persistent function tracer" + depends on PSTORE + depends on FUNCTION_TRACER + help + With this option kernel traces function calls into a persistent + ram buffer that can be decoded and dumped after reboot through + pstore filesystem. It can be used to determine what function + was last called before a reset or panic. + + If unsure, say N. + config PSTORE_RAM tristate "Log panic/oops to a RAM buffer" depends on PSTORE diff --git a/fs/pstore/Makefile b/fs/pstore/Makefile index 278a44e..4c9095c 100644 --- a/fs/pstore/Makefile +++ b/fs/pstore/Makefile @@ -5,6 +5,7 @@ obj-y += pstore.o pstore-objs += inode.o platform.o +obj-$(CONFIG_PSTORE_FTRACE) += ftrace.o ramoops-objs += ram.o ram_core.o obj-$(CONFIG_PSTORE_RAM) += ramoops.o diff --git a/fs/pstore/ftrace.c b/fs/pstore/ftrace.c new file mode 100644 index 0000000..a130d48 --- /dev/null +++ b/fs/pstore/ftrace.c @@ -0,0 +1,35 @@ +/* + * Copyright 2012 Google, Inc. + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include "internal.h" + +void notrace pstore_ftrace_call(unsigned long ip, unsigned long parent_ip) +{ + struct pstore_ftrace_record rec = {}; + + if (unlikely(oops_in_progress)) + return; + + rec.ip = ip; + rec.parent_ip = parent_ip; + pstore_ftrace_encode_cpu(&rec, raw_smp_processor_id()); + psinfo->write_buf(PSTORE_TYPE_FTRACE, 0, NULL, 0, (void *)&rec, + sizeof(rec), psinfo); +} diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c index 45bff54..4ab572e 100644 --- a/fs/pstore/inode.c +++ b/fs/pstore/inode.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -52,18 +53,117 @@ struct pstore_private { char data[]; }; +struct pstore_ftrace_seq_data { + const void *ptr; + size_t off; + size_t size; +}; + +#define REC_SIZE sizeof(struct pstore_ftrace_record) + +static void *pstore_ftrace_seq_start(struct seq_file *s, loff_t *pos) +{ + struct pstore_private *ps = s->private; + struct pstore_ftrace_seq_data *data; + + data = kzalloc(sizeof(*data), GFP_KERNEL); + if (!data) + return NULL; + + data->off = ps->size % REC_SIZE; + data->off += *pos * REC_SIZE; + if (data->off + REC_SIZE > ps->size) { + kfree(data); + return NULL; + } + + return data; + +} + +static void pstore_ftrace_seq_stop(struct seq_file *s, void *v) +{ + kfree(v); +} + +static void *pstore_ftrace_seq_next(struct seq_file *s, void *v, loff_t *pos) +{ + struct pstore_private *ps = s->private; + struct pstore_ftrace_seq_data *data = v; + + data->off += REC_SIZE; + if (data->off + REC_SIZE > ps->size) + return NULL; + + (*pos)++; + return data; +} + +static int pstore_ftrace_seq_show(struct seq_file *s, void *v) +{ + struct pstore_private *ps = s->private; + struct pstore_ftrace_seq_data *data = v; + struct pstore_ftrace_record *rec = (void *)(ps->data + data->off); + + seq_printf(s, "%d %08lx %08lx %pf <- %pF\n", + pstore_ftrace_decode_cpu(rec), rec->ip, rec->parent_ip, + (void *)rec->ip, (void *)rec->parent_ip); + + return 0; +} + +static const struct seq_operations pstore_ftrace_seq_ops = { + .start = pstore_ftrace_seq_start, + .next = pstore_ftrace_seq_next, + .stop = pstore_ftrace_seq_stop, + .show = pstore_ftrace_seq_show, +}; + static ssize_t pstore_file_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - struct pstore_private *ps = file->private_data; + struct seq_file *sf = file->private_data; + struct pstore_private *ps = sf->private; + if (ps->type == PSTORE_TYPE_FTRACE) + return seq_read(file, userbuf, count, ppos); return simple_read_from_buffer(userbuf, count, ppos, ps->data, ps->size); } +static int pstore_file_open(struct inode *inode, struct file *file) +{ + struct pstore_private *ps = inode->i_private; + struct seq_file *sf; + int err; + const struct seq_operations *sops = NULL; + + if (ps->type == PSTORE_TYPE_FTRACE) + sops = &pstore_ftrace_seq_ops; + + err = seq_open(file, sops); + if (err < 0) + return err; + + sf = file->private_data; + sf->private = ps; + + return 0; +} + +static loff_t pstore_file_llseek(struct file *file, loff_t off, int origin) +{ + struct seq_file *sf = file->private_data; + + if (sf->op) + return seq_lseek(file, off, origin); + return default_llseek(file, off, origin); +} + static const struct file_operations pstore_file_operations = { - .open = simple_open, - .read = pstore_file_read, - .llseek = default_llseek, + .open = pstore_file_open, + .read = pstore_file_read, + .llseek = pstore_file_llseek, + .release = seq_release, }; /* @@ -215,6 +315,9 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, case PSTORE_TYPE_CONSOLE: sprintf(name, "console-%s", psname); break; + case PSTORE_TYPE_FTRACE: + sprintf(name, "ftrace-%s", psname); + break; case PSTORE_TYPE_MCE: sprintf(name, "mce-%s-%lld", psname, id); break; diff --git a/fs/pstore/internal.h b/fs/pstore/internal.h index 3bde461..958c48d 100644 --- a/fs/pstore/internal.h +++ b/fs/pstore/internal.h @@ -1,6 +1,49 @@ +#ifndef __PSTORE_INTERNAL_H__ +#define __PSTORE_INTERNAL_H__ + +#include + +#if NR_CPUS <= 2 && defined(CONFIG_ARM_THUMB) +#define PSTORE_CPU_IN_IP 0x1 +#elif NR_CPUS <= 4 && defined(CONFIG_ARM) +#define PSTORE_CPU_IN_IP 0x3 +#endif + +struct pstore_ftrace_record { + unsigned long ip; + unsigned long parent_ip; +#ifndef PSTORE_CPU_IN_IP + unsigned int cpu; +#endif +}; + +static inline void +pstore_ftrace_encode_cpu(struct pstore_ftrace_record *rec, unsigned int cpu) +{ +#ifndef PSTORE_CPU_IN_IP + rec->cpu = cpu; +#else + rec->ip |= cpu; +#endif +} + +static inline unsigned int +pstore_ftrace_decode_cpu(struct pstore_ftrace_record *rec) +{ +#ifndef PSTORE_CPU_IN_IP + return rec->cpu; +#else + return rec->ip & PSTORE_CPU_IN_IP; +#endif +} + +extern struct pstore_info *psinfo; + extern void pstore_set_kmsg_bytes(int); extern void pstore_get_records(int); extern int pstore_mkfile(enum pstore_type_id, char *psname, u64 id, char *data, size_t size, struct timespec time, struct pstore_info *psi); extern int pstore_is_mounted(void); + +#endif diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index ef5ca8a..29996e8 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -61,7 +61,7 @@ static DECLARE_WORK(pstore_work, pstore_dowork); * calls to pstore_register() */ static DEFINE_SPINLOCK(pstore_lock); -static struct pstore_info *psinfo; +struct pstore_info *psinfo; static char *backend; diff --git a/include/linux/pstore.h b/include/linux/pstore.h index b107484..120443b 100644 --- a/include/linux/pstore.h +++ b/include/linux/pstore.h @@ -30,6 +30,7 @@ enum pstore_type_id { PSTORE_TYPE_DMESG = 0, PSTORE_TYPE_MCE = 1, PSTORE_TYPE_CONSOLE = 2, + PSTORE_TYPE_FTRACE = 3, PSTORE_TYPE_UNKNOWN = 255 }; @@ -57,6 +58,14 @@ struct pstore_info { void *data; }; + +#ifdef CONFIG_PSTORE_FTRACE +extern void pstore_ftrace_call(unsigned long ip, unsigned long parent_ip); +#else +static inline void pstore_ftrace_call(unsigned long ip, unsigned long parent_ip) +{ } +#endif + #ifdef CONFIG_PSTORE extern int pstore_register(struct pstore_info *); #else -- cgit v0.10.2 From 21f679404a0c28bd5b1b3aff2a7218bbff4cb43d Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Mon, 9 Jul 2012 17:10:42 -0700 Subject: tracing/function: Introduce persistent trace option This patch introduces 'func_ptrace' option, now available in /sys/kernel/debug/tracing/options when function tracer is selected. The patch also adds some tiny code that calls back to pstore to record the trace. The callback is no-op when PSTORE=n. Signed-off-by: Anton Vorontsov Acked-by: Steven Rostedt Signed-off-by: Greg Kroah-Hartman diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c index c7b0c6a..13770ab 100644 --- a/kernel/trace/trace_functions.c +++ b/kernel/trace/trace_functions.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include "trace.h" @@ -74,6 +75,14 @@ function_trace_call_preempt_only(unsigned long ip, unsigned long parent_ip) preempt_enable_notrace(); } +/* Our two options */ +enum { + TRACE_FUNC_OPT_STACK = 0x1, + TRACE_FUNC_OPT_PSTORE = 0x2, +}; + +static struct tracer_flags func_flags; + static void function_trace_call(unsigned long ip, unsigned long parent_ip) { @@ -97,6 +106,12 @@ function_trace_call(unsigned long ip, unsigned long parent_ip) disabled = atomic_inc_return(&data->disabled); if (likely(disabled == 1)) { + /* + * So far tracing doesn't support multiple buffers, so + * we make an explicit call for now. + */ + if (unlikely(func_flags.val & TRACE_FUNC_OPT_PSTORE)) + pstore_ftrace_call(ip, parent_ip); pc = preempt_count(); trace_function(tr, ip, parent_ip, flags, pc); } @@ -158,15 +173,13 @@ static struct ftrace_ops trace_stack_ops __read_mostly = .flags = FTRACE_OPS_FL_GLOBAL, }; -/* Our two options */ -enum { - TRACE_FUNC_OPT_STACK = 0x1, -}; - static struct tracer_opt func_opts[] = { #ifdef CONFIG_STACKTRACE { TRACER_OPT(func_stack_trace, TRACE_FUNC_OPT_STACK) }, #endif +#ifdef CONFIG_PSTORE_FTRACE + { TRACER_OPT(func_pstore, TRACE_FUNC_OPT_PSTORE) }, +#endif { } /* Always set a last empty entry */ }; @@ -218,6 +231,8 @@ static int func_set_flag(u32 old_flags, u32 bit, int set) } return 0; + } else if (bit == TRACE_FUNC_OPT_PSTORE) { + return 0; } return -EINVAL; -- cgit v0.10.2 From c2b7113261c5bb49031a15b833e59ea2d8ec4074 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Mon, 9 Jul 2012 17:10:43 -0700 Subject: pstore/ram: Convert to write_buf callback Don't use pstore.buf directly, instead convert the code to write_buf callback which passes a pointer to a buffer as an argument. Signed-off-by: Anton Vorontsov Signed-off-by: Greg Kroah-Hartman diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index b39aebb..74f4111 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -170,11 +170,12 @@ static size_t ramoops_write_kmsg_hdr(struct persistent_ram_zone *prz) return len; } -static int ramoops_pstore_write(enum pstore_type_id type, - enum kmsg_dump_reason reason, - u64 *id, - unsigned int part, - size_t size, struct pstore_info *psi) + +static int ramoops_pstore_write_buf(enum pstore_type_id type, + enum kmsg_dump_reason reason, + u64 *id, unsigned int part, + const char *buf, size_t size, + struct pstore_info *psi) { struct ramoops_context *cxt = psi->data; struct persistent_ram_zone *prz = cxt->przs[cxt->dump_write_cnt]; @@ -183,7 +184,7 @@ static int ramoops_pstore_write(enum pstore_type_id type, if (type == PSTORE_TYPE_CONSOLE) { if (!cxt->cprz) return -ENOMEM; - persistent_ram_write(cxt->cprz, cxt->pstore.buf, size); + persistent_ram_write(cxt->cprz, buf, size); return 0; } @@ -212,7 +213,7 @@ static int ramoops_pstore_write(enum pstore_type_id type, hlen = ramoops_write_kmsg_hdr(prz); if (size + hlen > prz->buffer_size) size = prz->buffer_size - hlen; - persistent_ram_write(prz, cxt->pstore.buf, size); + persistent_ram_write(prz, buf, size); cxt->dump_write_cnt = (cxt->dump_write_cnt + 1) % cxt->max_dump_cnt; @@ -250,7 +251,7 @@ static struct ramoops_context oops_cxt = { .name = "ramoops", .open = ramoops_pstore_open, .read = ramoops_pstore_read, - .write = ramoops_pstore_write, + .write_buf = ramoops_pstore_write_buf, .erase = ramoops_pstore_erase, }, }; -- cgit v0.10.2 From a694d1b5916a486ce25fb5f2b39f2627f7afd5f3 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Mon, 9 Jul 2012 17:10:44 -0700 Subject: pstore/ram: Add ftrace messages handling The ftrace log size is configurable via ramoops.ftrace_size module option, and the log itself is available via /ftrace-ramoops file. Signed-off-by: Anton Vorontsov Signed-off-by: Greg Kroah-Hartman diff --git a/Documentation/ramoops.txt b/Documentation/ramoops.txt index 59a74a8..197ad59 100644 --- a/Documentation/ramoops.txt +++ b/Documentation/ramoops.txt @@ -94,3 +94,28 @@ timestamp and a new line. The dump then continues with the actual data. The dump data can be read from the pstore filesystem. The format for these files is "dmesg-ramoops-N", where N is the record number in memory. To delete a stored record from RAM, simply unlink the respective pstore file. + +5. Persistent function tracing + +Persistent function tracing might be useful for debugging software or hardware +related hangs. The functions call chain log is stored in a "ftrace-ramoops" +file. Here is an example of usage: + + # mount -t debugfs debugfs /sys/kernel/debug/ + # cd /sys/kernel/debug/tracing + # echo function > current_tracer + # echo 1 > options/func_pstore + # reboot -f + [...] + # mount -t pstore pstore /mnt/ + # tail /mnt/ftrace-ramoops + 0 ffffffff8101ea64 ffffffff8101bcda native_apic_mem_read <- disconnect_bsp_APIC+0x6a/0xc0 + 0 ffffffff8101ea44 ffffffff8101bcf6 native_apic_mem_write <- disconnect_bsp_APIC+0x86/0xc0 + 0 ffffffff81020084 ffffffff8101a4b5 hpet_disable <- native_machine_shutdown+0x75/0x90 + 0 ffffffff81005f94 ffffffff8101a4bb iommu_shutdown_noop <- native_machine_shutdown+0x7b/0x90 + 0 ffffffff8101a6a1 ffffffff8101a437 native_machine_emergency_restart <- native_machine_restart+0x37/0x40 + 0 ffffffff811f9876 ffffffff8101a73a acpi_reboot <- native_machine_emergency_restart+0xaa/0x1e0 + 0 ffffffff8101a514 ffffffff8101a772 mach_reboot_fixups <- native_machine_emergency_restart+0xe2/0x1e0 + 0 ffffffff811d9c54 ffffffff8101a7a0 __const_udelay <- native_machine_emergency_restart+0x110/0x1e0 + 0 ffffffff811d9c34 ffffffff811d9c80 __delay <- __const_udelay+0x30/0x40 + 0 ffffffff811d9d14 ffffffff811d9c3f delay_tsc <- __delay+0xf/0x20 diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 74f4111..1dd108e 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -45,6 +45,10 @@ static ulong ramoops_console_size = MIN_MEM_SIZE; module_param_named(console_size, ramoops_console_size, ulong, 0400); MODULE_PARM_DESC(console_size, "size of kernel console log"); +static ulong ramoops_ftrace_size = MIN_MEM_SIZE; +module_param_named(ftrace_size, ramoops_ftrace_size, ulong, 0400); +MODULE_PARM_DESC(ftrace_size, "size of ftrace log"); + static ulong mem_address; module_param(mem_address, ulong, 0400); MODULE_PARM_DESC(mem_address, @@ -70,16 +74,19 @@ MODULE_PARM_DESC(ramoops_ecc, struct ramoops_context { struct persistent_ram_zone **przs; struct persistent_ram_zone *cprz; + struct persistent_ram_zone *fprz; phys_addr_t phys_addr; unsigned long size; size_t record_size; size_t console_size; + size_t ftrace_size; int dump_oops; int ecc_size; unsigned int max_dump_cnt; unsigned int dump_write_cnt; unsigned int dump_read_cnt; unsigned int console_read_cnt; + unsigned int ftrace_read_cnt; struct pstore_info pstore; }; @@ -138,6 +145,9 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type, prz = ramoops_get_next_prz(&cxt->cprz, &cxt->console_read_cnt, 1, id, type, PSTORE_TYPE_CONSOLE, 0); if (!prz) + prz = ramoops_get_next_prz(&cxt->fprz, &cxt->ftrace_read_cnt, + 1, id, type, PSTORE_TYPE_FTRACE, 0); + if (!prz) return 0; /* TODO(kees): Bogus time for the moment. */ @@ -186,6 +196,11 @@ static int ramoops_pstore_write_buf(enum pstore_type_id type, return -ENOMEM; persistent_ram_write(cxt->cprz, buf, size); return 0; + } else if (type == PSTORE_TYPE_FTRACE) { + if (!cxt->fprz) + return -ENOMEM; + persistent_ram_write(cxt->fprz, buf, size); + return 0; } if (type != PSTORE_TYPE_DMESG) @@ -235,6 +250,9 @@ static int ramoops_pstore_erase(enum pstore_type_id type, u64 id, case PSTORE_TYPE_CONSOLE: prz = cxt->cprz; break; + case PSTORE_TYPE_FTRACE: + prz = cxt->fprz; + break; default: return -EINVAL; } @@ -348,7 +366,8 @@ static int __devinit ramoops_probe(struct platform_device *pdev) if (cxt->max_dump_cnt) goto fail_out; - if (!pdata->mem_size || (!pdata->record_size && !pdata->console_size)) { + if (!pdata->mem_size || (!pdata->record_size && !pdata->console_size && + !pdata->ftrace_size)) { pr_err("The memory size and the record/console size must be " "non-zero\n"); goto fail_out; @@ -357,18 +376,20 @@ static int __devinit ramoops_probe(struct platform_device *pdev) pdata->mem_size = rounddown_pow_of_two(pdata->mem_size); pdata->record_size = rounddown_pow_of_two(pdata->record_size); pdata->console_size = rounddown_pow_of_two(pdata->console_size); + pdata->ftrace_size = rounddown_pow_of_two(pdata->ftrace_size); cxt->dump_read_cnt = 0; cxt->size = pdata->mem_size; cxt->phys_addr = pdata->mem_address; cxt->record_size = pdata->record_size; cxt->console_size = pdata->console_size; + cxt->ftrace_size = pdata->ftrace_size; cxt->dump_oops = pdata->dump_oops; cxt->ecc_size = pdata->ecc_size; paddr = cxt->phys_addr; - dump_mem_sz = cxt->size - cxt->console_size; + dump_mem_sz = cxt->size - cxt->console_size - cxt->ftrace_size; err = ramoops_init_przs(dev, cxt, &paddr, dump_mem_sz); if (err) goto fail_out; @@ -377,9 +398,14 @@ static int __devinit ramoops_probe(struct platform_device *pdev) if (err) goto fail_init_cprz; - if (!cxt->przs && !cxt->cprz) { + err = ramoops_init_prz(dev, cxt, &cxt->fprz, &paddr, cxt->ftrace_size); + if (err) + goto fail_init_fprz; + + if (!cxt->przs && !cxt->cprz && !cxt->fprz) { pr_err("memory size too small, minimum is %lu\n", - cxt->console_size + cxt->record_size); + cxt->console_size + cxt->record_size + + cxt->ftrace_size); goto fail_cnt; } @@ -426,6 +452,8 @@ fail_clear: cxt->pstore.bufsize = 0; cxt->max_dump_cnt = 0; fail_cnt: + kfree(cxt->fprz); +fail_init_fprz: kfree(cxt->cprz); fail_init_cprz: ramoops_free_przs(cxt); @@ -480,6 +508,7 @@ static void ramoops_register_dummy(void) dummy_data->mem_address = mem_address; dummy_data->record_size = record_size; dummy_data->console_size = ramoops_console_size; + dummy_data->ftrace_size = ramoops_ftrace_size; dummy_data->dump_oops = dump_oops; /* * For backwards compatibility ramoops.ecc=1 means 16 bytes ECC diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h index dcf805f..af848e1 100644 --- a/include/linux/pstore_ram.h +++ b/include/linux/pstore_ram.h @@ -72,6 +72,7 @@ struct ramoops_platform_data { unsigned long mem_address; unsigned long record_size; unsigned long console_size; + unsigned long ftrace_size; int dump_oops; int ecc_size; }; -- cgit v0.10.2 From f555f1231a69846d57099760f9c361982600ffa2 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Mon, 9 Jul 2012 17:10:46 -0700 Subject: tracing/function: Convert func_set_flag() to a switch statement Since the function accepts just one bit, we can use the switch construction instead of if/else if/... Just a cosmetic change, there should be no functional changes. Suggested-by: Steven Rostedt Signed-off-by: Anton Vorontsov Acked-by: Steven Rostedt Signed-off-by: Greg Kroah-Hartman diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c index 13770ab..a426f41 100644 --- a/kernel/trace/trace_functions.c +++ b/kernel/trace/trace_functions.c @@ -217,10 +217,11 @@ static void tracing_stop_function_trace(void) static int func_set_flag(u32 old_flags, u32 bit, int set) { - if (bit == TRACE_FUNC_OPT_STACK) { + switch (bit) { + case TRACE_FUNC_OPT_STACK: /* do nothing if already set */ if (!!set == !!(func_flags.val & TRACE_FUNC_OPT_STACK)) - return 0; + break; if (set) { unregister_ftrace_function(&trace_ops); @@ -230,12 +231,14 @@ static int func_set_flag(u32 old_flags, u32 bit, int set) register_ftrace_function(&trace_ops); } - return 0; - } else if (bit == TRACE_FUNC_OPT_PSTORE) { - return 0; + break; + case TRACE_FUNC_OPT_PSTORE: + break; + default: + return -EINVAL; } - return -EINVAL; + return 0; } static struct tracer function_trace __read_mostly = -- cgit v0.10.2 From 39d48bb0607f1c8ac4c57ddba534a402f4fc91e7 Mon Sep 17 00:00:00 2001 From: Erik Jones Date: Mon, 16 Jul 2012 23:51:14 -0400 Subject: staging: rts5139: rts51x_card: fixed brace coding style issue Fixed a coding style issue. Signed-off-by: Erik Jones Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/rts5139/rts51x_card.c b/drivers/staging/rts5139/rts51x_card.c index 4192c3b..a3cb559 100644 --- a/drivers/staging/rts5139/rts51x_card.c +++ b/drivers/staging/rts5139/rts51x_card.c @@ -211,13 +211,12 @@ static void card_cd_debounce(struct rts51x_chip *chip, u8 *need_reset, release_map |= MS_CARD; } } else { - if (chip->card_status & XD_CD) { + if (chip->card_status & XD_CD) reset_map |= XD_CARD; - } else if (chip->card_status & SD_CD) { + else if (chip->card_status & SD_CD) reset_map |= SD_CARD; - } else if (chip->card_status & MS_CD) { + else if (chip->card_status & MS_CD) reset_map |= MS_CARD; - } } if (CHECK_PKG(chip, QFN24) && reset_map) { -- cgit v0.10.2 From cf3a5ca084979f0087a8e6f6cd34a6d5ee0decb5 Mon Sep 17 00:00:00 2001 From: Erik Jones Date: Mon, 16 Jul 2012 23:51:15 -0400 Subject: staging: rts5139: rts51x_card: fixed brace coding style issue Fixed a coding style issue. An else statement was not on the same line as the preceding if statement's closing brace. Signed-off-by: Erik Jones Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/rts5139/rts51x_card.c b/drivers/staging/rts5139/rts51x_card.c index a3cb559..50be42a 100644 --- a/drivers/staging/rts5139/rts51x_card.c +++ b/drivers/staging/rts5139/rts51x_card.c @@ -826,8 +826,7 @@ int card_power_on(struct rts51x_chip *chip, u8 card) if ((card == SD_CARD) || (card == XD_CARD)) { RTS51X_WRITE_REG(chip, CARD_PWR_CTL, mask | LDO3318_PWR_MASK, val1 | LDO_SUSPEND); - } - else { + } else { #endif RTS51X_WRITE_REG(chip, CARD_PWR_CTL, mask, val1); #ifdef SD_XD_IO_FOLLOW_PWR -- cgit v0.10.2 From 8f834c14e35d629d84a743983c5d36449ad3182f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Iglesias=20Gons=C3=A1lvez?= Date: Tue, 17 Jul 2012 12:56:17 +0200 Subject: Staging: ipack: added development mailing list in TODO file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Samuel Iglesias Gonsálvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/TODO b/drivers/staging/ipack/TODO index 0f8bf20..25ed7ae 100644 --- a/drivers/staging/ipack/TODO +++ b/drivers/staging/ipack/TODO @@ -39,4 +39,5 @@ Ipack Contact ======= -Contact: Samuel Iglesias Gonsalvez \ No newline at end of file +Contact: Samuel Iglesias Gonsalvez +Mailing List: industrypack-devel@lists.sourceforge.net -- cgit v0.10.2 From bfce7cf68673216168020f369365dfc8ccbf23de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Iglesias=20Gons=C3=A1lvez?= Date: Tue, 17 Jul 2012 12:56:18 +0200 Subject: Staging: ipack: change naming convention in TODO file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the ANSI/VITA 4.0-1995 (S2011) naming convention for the mezzanine or daughter boards. They are called IP modules in the Standard. Signed-off-by: Samuel Iglesias Gonsálvez Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ipack/TODO b/drivers/staging/ipack/TODO index 25ed7ae..b21d33a 100644 --- a/drivers/staging/ipack/TODO +++ b/drivers/staging/ipack/TODO @@ -3,7 +3,7 @@ Introduction ============ -These drivers add support for IndustryPack devices: carrier and mezzanine +These drivers add support for IndustryPack devices: carrier and IP module boards. The ipack driver is just an abstraction of the bus providing the common @@ -31,7 +31,7 @@ Ipack ----- * The structures and API exported can be improved a lot. For example, the - way to unregistering mezzanine devices, doing the mezzanine driver a call to + way to unregistering IP module devices, doing the IP module driver a call to remove_device() to notify the carrier driver, or the opposite with the call to the ipack_driver_ops' remove() function could be improved. -- cgit v0.10.2 From 67a101f573b0cb1043c8c305112113450cb9fdbf Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Tue, 17 Jul 2012 11:37:07 -0700 Subject: pstore: Headers should include all stuff they use MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Headers should really include all the needed prototypes, types, defines etc. to be self-contained. This is a long-standing issue, but apparently the new tracing code unearthed it (SMP=n is also a prerequisite): In file included from fs/pstore/internal.h:4:0, from fs/pstore/ftrace.c:21: include/linux/pstore.h:43:15: error: field ‘read_mutex’ has incomplete type While at it, I also added the following: linux/types.h -> size_t, phys_addr_t, uXX and friends linux/spinlock.h -> spinlock_t linux/errno.h -> Exxxx linux/time.h -> struct timespec (struct passed by value) struct module and rs_control forward declaration (passed via pointers). Signed-off-by: Anton Vorontsov Signed-off-by: Greg Kroah-Hartman diff --git a/fs/pstore/internal.h b/fs/pstore/internal.h index 958c48d..0d0d3b7 100644 --- a/fs/pstore/internal.h +++ b/fs/pstore/internal.h @@ -1,6 +1,8 @@ #ifndef __PSTORE_INTERNAL_H__ #define __PSTORE_INTERNAL_H__ +#include +#include #include #if NR_CPUS <= 2 && defined(CONFIG_ARM_THUMB) diff --git a/include/linux/pstore.h b/include/linux/pstore.h index 120443b..c892587 100644 --- a/include/linux/pstore.h +++ b/include/linux/pstore.h @@ -24,6 +24,10 @@ #include #include +#include +#include +#include +#include /* types */ enum pstore_type_id { @@ -34,6 +38,8 @@ enum pstore_type_id { PSTORE_TYPE_UNKNOWN = 255 }; +struct module; + struct pstore_info { struct module *owner; char *name; diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h index af848e1..ba2b211 100644 --- a/include/linux/pstore_ram.h +++ b/include/linux/pstore_ram.h @@ -24,6 +24,7 @@ #include struct persistent_ram_buffer; +struct rs_control; struct persistent_ram_zone { phys_addr_t paddr; -- cgit v0.10.2 From cbe7cbf5a666ad9dfe2e0c276066131af73769ab Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Tue, 17 Jul 2012 12:11:12 -0700 Subject: pstore/ram: Make tracing log versioned Decoding the binary trace w/ a different kernel might be troublesome since we convert addresses to symbols. For kernels with minimal changes, the mappings would probably match, but it's not guaranteed at all. (But still we could convert the addresses by hand, since we do print raw addresses.) If we use modules, the symbols could be loaded at different addresses from the previously booted kernel, and so this would also fail, but there's nothing we can do about it. Also, the binary data format that pstore/ram is using in its ringbuffer may change between the kernels, so here we too must ensure that we're running the same kernel. So, there are two questions really: 1. How to compute the unique kernel tag; 2. Where to store it. In this patch we're using LINUX_VERSION_CODE, just as hibernation (suspend-to-disk) does. This way we are protecting from the kernel version mismatch, making sure that we're running the same kernel version and patch level. We could use CRC of a symbol table (as suggested by Tony Luck), but for now let's not be that strict. And as for storing, we are using a small trick here. Instead of allocating a dedicated buffer for the tag (i.e. another prz), or hacking ram_core routines to "reserve" some control data in the buffer, we are just encoding the tag into the buffer signature (and XOR'ing it with the actual signature value, so that buffers not needing a tag can just pass zero, which will result into the plain old PRZ signature). Suggested-by: Steven Rostedt Suggested-by: Tony Luck Suggested-by: Colin Cross Signed-off-by: Anton Vorontsov Signed-off-by: Greg Kroah-Hartman diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 1dd108e..0b311bc 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -309,7 +310,7 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt, for (i = 0; i < cxt->max_dump_cnt; i++) { size_t sz = cxt->record_size; - cxt->przs[i] = persistent_ram_new(*paddr, sz, cxt->ecc_size); + cxt->przs[i] = persistent_ram_new(*paddr, sz, 0, cxt->ecc_size); if (IS_ERR(cxt->przs[i])) { err = PTR_ERR(cxt->przs[i]); dev_err(dev, "failed to request mem region (0x%zx@0x%llx): %d\n", @@ -327,7 +328,7 @@ fail_prz: static int ramoops_init_prz(struct device *dev, struct ramoops_context *cxt, struct persistent_ram_zone **prz, - phys_addr_t *paddr, size_t sz) + phys_addr_t *paddr, size_t sz, u32 sig) { if (!sz) return 0; @@ -335,7 +336,7 @@ static int ramoops_init_prz(struct device *dev, struct ramoops_context *cxt, if (*paddr + sz > *paddr + cxt->size) return -ENOMEM; - *prz = persistent_ram_new(*paddr, sz, cxt->ecc_size); + *prz = persistent_ram_new(*paddr, sz, sig, cxt->ecc_size); if (IS_ERR(*prz)) { int err = PTR_ERR(*prz); @@ -394,11 +395,13 @@ static int __devinit ramoops_probe(struct platform_device *pdev) if (err) goto fail_out; - err = ramoops_init_prz(dev, cxt, &cxt->cprz, &paddr, cxt->console_size); + err = ramoops_init_prz(dev, cxt, &cxt->cprz, &paddr, + cxt->console_size, 0); if (err) goto fail_init_cprz; - err = ramoops_init_prz(dev, cxt, &cxt->fprz, &paddr, cxt->ftrace_size); + err = ramoops_init_prz(dev, cxt, &cxt->fprz, &paddr, cxt->ftrace_size, + LINUX_VERSION_CODE); if (err) goto fail_init_fprz; diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index 4dabbb8..eecd2a8 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c @@ -391,7 +391,7 @@ static int persistent_ram_buffer_map(phys_addr_t start, phys_addr_t size, } static int __devinit persistent_ram_post_init(struct persistent_ram_zone *prz, - int ecc_size) + u32 sig, int ecc_size) { int ret; @@ -399,7 +399,9 @@ static int __devinit persistent_ram_post_init(struct persistent_ram_zone *prz, if (ret) return ret; - if (prz->buffer->sig == PERSISTENT_RAM_SIG) { + sig ^= PERSISTENT_RAM_SIG; + + if (prz->buffer->sig == sig) { if (buffer_size(prz) > prz->buffer_size || buffer_start(prz) > buffer_size(prz)) pr_info("persistent_ram: found existing invalid buffer," @@ -417,7 +419,7 @@ static int __devinit persistent_ram_post_init(struct persistent_ram_zone *prz, " (sig = 0x%08x)\n", prz->buffer->sig); } - prz->buffer->sig = PERSISTENT_RAM_SIG; + prz->buffer->sig = sig; persistent_ram_zap(prz); return 0; @@ -442,7 +444,7 @@ void persistent_ram_free(struct persistent_ram_zone *prz) } struct persistent_ram_zone * __devinit persistent_ram_new(phys_addr_t start, - size_t size, + size_t size, u32 sig, int ecc_size) { struct persistent_ram_zone *prz; @@ -458,7 +460,7 @@ struct persistent_ram_zone * __devinit persistent_ram_new(phys_addr_t start, if (ret) goto err; - ret = persistent_ram_post_init(prz, ecc_size); + ret = persistent_ram_post_init(prz, sig, ecc_size); if (ret) goto err; diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h index ba2b211..098d2a8 100644 --- a/include/linux/pstore_ram.h +++ b/include/linux/pstore_ram.h @@ -47,7 +47,7 @@ struct persistent_ram_zone { }; struct persistent_ram_zone * __devinit persistent_ram_new(phys_addr_t start, - size_t size, + size_t size, u32 sig, int ecc_size); void persistent_ram_free(struct persistent_ram_zone *prz); void persistent_ram_zap(struct persistent_ram_zone *prz); -- cgit v0.10.2 From 59e32c490e476dba2938dde9fd4d4eaf5d0f8121 Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Thu, 19 Jul 2012 15:36:08 -0700 Subject: staging: sm7xxfb: fix for "rename smtc_screen_info to smtc_scr_info" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stephen Rothwell Acked-by: Javier Muñoz Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index 90c90db..1c1780c 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -826,7 +826,7 @@ static int __devinit smtcfb_pci_probe(struct pci_dev *pdev, #ifdef __BIG_ENDIAN if (sfb->fb.var.bits_per_pixel == 24) - sfb->fb.var.bits_per_pixel = (smtc_screen_info.lfb_depth = 32); + sfb->fb.var.bits_per_pixel = (smtc_scr_info.lfb_depth = 32); #endif /* Map address and memory detection */ pFramebufferPhysical = pci_resource_start(pdev, 0); -- cgit v0.10.2 From 363e2e6f9e2d9ca53fb87e3988e2a225dc879aa4 Mon Sep 17 00:00:00 2001 From: Martyn Welch Date: Thu, 19 Jul 2012 17:48:46 +0100 Subject: VME: Prevent D16 cycles being split into 8-bit blocks The memcpy_fromio() and memcpy_toio() functions use the __memcpy() function, at least on x86. This function carries out transfers smaller than 32 bits as multiple 8 bit transfers, causing a single (aligned) 16 bit transfer to be split into 2 8 bit transfers which may not be supported by the target VME device. The commit 53059aa05988761a738fa8bc082bbf3c5d4462d1 fixed this for the ca91cx42, however this was not fixed for the tsi148 at the time. This patch uses the same algorithm to fix the tsi148. Reported-by: Daniel Lambert Signed-off-by: Martyn Welch Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/vme/bridges/vme_tsi148.c b/drivers/vme/bridges/vme_tsi148.c index f6385f7..880d924 100644 --- a/drivers/vme/bridges/vme_tsi148.c +++ b/drivers/vme/bridges/vme_tsi148.c @@ -1263,12 +1263,55 @@ static ssize_t tsi148_master_read(struct vme_master_resource *image, void *buf, u32 aspace, cycle, dwidth; struct vme_bus_error *vme_err = NULL; struct vme_bridge *tsi148_bridge; + void *addr = image->kern_base + offset; + unsigned int done = 0; + unsigned int count32; tsi148_bridge = image->parent; spin_lock(&image->lock); - memcpy_fromio(buf, image->kern_base + offset, (unsigned int)count); + /* The following code handles VME address alignment. We cannot use + * memcpy_xxx directly here because it may cut small data transfers in + * to 8-bit cycles, thus making D16 cycle impossible. + * On the other hand, the bridge itself assures that the maximum data + * cycle configured for the transfer is used and splits it + * automatically for non-aligned addresses, so we don't want the + * overhead of needlessly forcing small transfers for the entire cycle. + */ + if ((uintptr_t)addr & 0x1) { + *(u8 *)buf = ioread8(addr); + done += 1; + if (done == count) + goto out; + } + if ((uintptr_t)addr & 0x2) { + if ((count - done) < 2) { + *(u8 *)(buf + done) = ioread8(addr + done); + done += 1; + goto out; + } else { + *(u16 *)(buf + done) = ioread16(addr + done); + done += 2; + } + } + + count32 = (count - done) & ~0x3; + if (count32 > 0) { + memcpy_fromio(buf + done, addr + done, count32); + done += count32; + } + + if ((count - done) & 0x2) { + *(u16 *)(buf + done) = ioread16(addr + done); + done += 2; + } + if ((count - done) & 0x1) { + *(u8 *)(buf + done) = ioread8(addr + done); + done += 1; + } + +out: retval = count; if (!err_chk) @@ -1301,6 +1344,9 @@ static ssize_t tsi148_master_write(struct vme_master_resource *image, void *buf, int retval = 0, enabled; unsigned long long vme_base, size; u32 aspace, cycle, dwidth; + void *addr = image->kern_base + offset; + unsigned int done = 0; + unsigned int count32; struct vme_bus_error *vme_err = NULL; struct vme_bridge *tsi148_bridge; @@ -1312,7 +1358,42 @@ static ssize_t tsi148_master_write(struct vme_master_resource *image, void *buf, spin_lock(&image->lock); - memcpy_toio(image->kern_base + offset, buf, (unsigned int)count); + /* Here we apply for the same strategy we do in master_read + * function in order to assure D16 cycle when required. + */ + if ((uintptr_t)addr & 0x1) { + iowrite8(*(u8 *)buf, addr); + done += 1; + if (done == count) + goto out; + } + if ((uintptr_t)addr & 0x2) { + if ((count - done) < 2) { + iowrite8(*(u8 *)(buf + done), addr + done); + done += 1; + goto out; + } else { + iowrite16(*(u16 *)(buf + done), addr + done); + done += 2; + } + } + + count32 = (count - done) & ~0x3; + if (count32 > 0) { + memcpy_toio(addr + done, buf + done, count32); + done += count32; + } + + if ((count - done) & 0x2) { + iowrite16(*(u16 *)(buf + done), addr + done); + done += 2; + } + if ((count - done) & 0x1) { + iowrite8(*(u8 *)(buf + done), addr + done); + done += 1; + } + +out: retval = count; /* -- cgit v0.10.2 From be408d7807ea2de36471ceb35cd4bd503118beaf Mon Sep 17 00:00:00 2001 From: Duan Jiong Date: Wed, 18 Jul 2012 22:25:39 +0800 Subject: vme_user.c: remove duplicated include Signed-off-by: Duan Jiong Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index 0c2479e..e25645e 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include -- cgit v0.10.2 From 12f3f21d08e4ba8ec35a9c132b89fa3fe9c82d13 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Tue, 17 Jul 2012 19:41:25 -0300 Subject: staging: sbe-2t3e3: Remove code that will never execute This patch removes all references of "if 0" blocks in the sbe-2t3e3 driver. Signed-off-by: Marcos Paulo de Souza Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sbe-2t3e3/2t3e3.h b/drivers/staging/sbe-2t3e3/2t3e3.h index fe9f086..383f2cf 100644 --- a/drivers/staging/sbe-2t3e3/2t3e3.h +++ b/drivers/staging/sbe-2t3e3/2t3e3.h @@ -801,9 +801,6 @@ u32 cpld_read(struct channel *sc, u32 reg); void cpld_set_crc(struct channel *, u32); void cpld_start_intr(struct channel *); void cpld_stop_intr(struct channel *); -#if 0 -void cpld_led_onoff(struct channel *, u32, u32, u32, u32); -#endif void cpld_set_clock(struct channel *sc, u32 mode); void cpld_set_scrambler(struct channel *, u32); void cpld_select_panel(struct channel *, u32); diff --git a/drivers/staging/sbe-2t3e3/cpld.c b/drivers/staging/sbe-2t3e3/cpld.c index b0fc2dd..cc2b54d 100644 --- a/drivers/staging/sbe-2t3e3/cpld.c +++ b/drivers/staging/sbe-2t3e3/cpld.c @@ -41,14 +41,6 @@ static inline void cpld_clear_bit(struct channel *channel, unsigned reg, u32 bit void cpld_init(struct channel *sc) { u32 val; -#if 0 - /* reset LIU and Framer */ - val = cpld_val_map[SBE_2T3E3_CPLD_VAL_LIU_FRAMER_RESET][sc->h.slot]; - cpld_write(sc, SBE_2T3E3_CPLD_REG_STATIC_RESET, val); - udelay(10000); /* TODO - how long? */ - val = 0; - cpld_write(sc, SBE_2T3E3_CPLD_REG_STATIC_RESET, val); -#endif /* PCRA */ val = SBE_2T3E3_CPLD_VAL_CRC32 | @@ -109,13 +101,6 @@ void cpld_start_intr(struct channel *sc) val = SBE_2T3E3_CPLD_VAL_INTERRUPT_FROM_ETHERNET_ENABLE | SBE_2T3E3_CPLD_VAL_INTERRUPT_FROM_FRAMER_ENABLE; cpld_write(sc, SBE_2T3E3_CPLD_REG_PIER, val); -#if 0 - /* - do you want to hang up your computer? - ENABLE REST OF INTERRUPTS !!! - you have been warned :). - */ -#endif } void cpld_stop_intr(struct channel *sc) diff --git a/drivers/staging/sbe-2t3e3/ctrl.c b/drivers/staging/sbe-2t3e3/ctrl.c index d9dd216..a5825d7 100644 --- a/drivers/staging/sbe-2t3e3/ctrl.c +++ b/drivers/staging/sbe-2t3e3/ctrl.c @@ -230,11 +230,9 @@ void t3e3_port_get_stats(struct channel *sc, result = exar7250_read(sc, SBE_2T3E3_FRAMER_REG_E3_RX_CONFIGURATION_STATUS_2); sc->s.LOF = result & SBE_2T3E3_FRAMER_VAL_E3_RX_LOF ? 1 : 0; sc->s.OOF = result & SBE_2T3E3_FRAMER_VAL_E3_RX_OOF ? 1 : 0; -#if 0 - sc->s.LOS = result & SBE_2T3E3_FRAMER_VAL_E3_RX_LOS ? 1 : 0; -#else + cpld_LOS_update(sc); -#endif + sc->s.AIS = result & SBE_2T3E3_FRAMER_VAL_E3_RX_AIS ? 1 : 0; sc->s.FERF = result & SBE_2T3E3_FRAMER_VAL_E3_RX_FERF ? 1 : 0; break; @@ -243,11 +241,9 @@ void t3e3_port_get_stats(struct channel *sc, case SBE_2T3E3_FRAME_TYPE_T3_M13: result = exar7250_read(sc, SBE_2T3E3_FRAMER_REG_T3_RX_CONFIGURATION_STATUS); sc->s.AIS = result & SBE_2T3E3_FRAMER_VAL_T3_RX_AIS ? 1 : 0; -#if 0 - sc->s.LOS = result & SBE_2T3E3_FRAMER_VAL_T3_RX_LOS ? 1 : 0; -#else + cpld_LOS_update(sc); -#endif + sc->s.IDLE = result & SBE_2T3E3_FRAMER_VAL_T3_RX_IDLE ? 1 : 0; sc->s.OOF = result & SBE_2T3E3_FRAMER_VAL_T3_RX_OOF ? 1 : 0; @@ -322,10 +318,6 @@ void t3e3_if_config(struct channel *sc, u32 cmd, char *set, *rlen = sizeof(ret->u.data); break; case SBE_2T3E3_PORT_WRITE_REGS: -#if 0 - printk(KERN_DEBUG "SBE_2T3E3_PORT_WRITE_REGS, 0x%x, 0x%x, 0x%x\n", - ((int*)data)[0], ((int*)data)[1], ((int*)data)[2]); -#endif t3e3_reg_write(sc, data); *rlen = 0; break; @@ -336,9 +328,6 @@ void t3e3_if_config(struct channel *sc, u32 cmd, char *set, *rlen = 0; break; } - - /* turn on interrupt */ - /* cpld_start_intr(sc); */ } void t3e3_sc_init(struct channel *sc) diff --git a/drivers/staging/sbe-2t3e3/dc.c b/drivers/staging/sbe-2t3e3/dc.c index e897a43..9e81d90 100644 --- a/drivers/staging/sbe-2t3e3/dc.c +++ b/drivers/staging/sbe-2t3e3/dc.c @@ -63,14 +63,6 @@ void dc_init(struct channel *sc) if (sc->p.loopback == SBE_2T3E3_LOOPBACK_ETHERNET) sc->p.loopback = SBE_2T3E3_LOOPBACK_NONE; -#if 0 /* No need to clear this register - and it may be in use */ - /* - * BOOT_ROM_SERIAL_ROM_AND_MII_MANAGEMENT (CSR9) - */ - val = 0; - dc_write(sc->addr, SBE_2T3E3_21143_REG_BOOT_ROM_SERIAL_ROM_AND_MII_MANAGEMENT, val); -#endif - /* * GENERAL_PURPOSE_TIMER_AND_INTERRUPT_MITIGATION_CONTROL (CSR11) */ @@ -301,15 +293,6 @@ void dc_set_loopback(struct channel *sc, u32 mode) return; } -#if 0 - /* restart SIA */ - dc_clear_bits(sc->addr, SBE_2T3E3_21143_REG_SIA_CONNECTIVITY, - SBE_2T3E3_21143_VAL_SIA_RESET); - udelay(1000); - dc_set_bits(sc->addr, SBE_2T3E3_21143_REG_SIA_CONNECTIVITY, - SBE_2T3E3_21143_VAL_SIA_RESET); -#endif - /* select loopback mode */ val = dc_read(sc->addr, SBE_2T3E3_21143_REG_OPERATION_MODE) & ~SBE_2T3E3_21143_VAL_OPERATING_MODE; diff --git a/drivers/staging/sbe-2t3e3/exar7250.c b/drivers/staging/sbe-2t3e3/exar7250.c index 809f446..e3ddd14 100644 --- a/drivers/staging/sbe-2t3e3/exar7250.c +++ b/drivers/staging/sbe-2t3e3/exar7250.c @@ -78,64 +78,32 @@ void exar7250_start_intr(struct channel *sc, u32 type) case SBE_2T3E3_FRAME_TYPE_E3_G751: case SBE_2T3E3_FRAME_TYPE_E3_G832: val = exar7250_read(sc, SBE_2T3E3_FRAMER_REG_E3_RX_CONFIGURATION_STATUS_2); -#if 0 - sc->s.LOS = val & SBE_2T3E3_FRAMER_VAL_E3_RX_LOS ? 1 : 0; -#else + cpld_LOS_update(sc); -#endif + sc->s.OOF = val & SBE_2T3E3_FRAMER_VAL_E3_RX_OOF ? 1 : 0; exar7250_read(sc, SBE_2T3E3_FRAMER_REG_E3_RX_INTERRUPT_STATUS_1); exar7250_write(sc, SBE_2T3E3_FRAMER_REG_E3_RX_INTERRUPT_ENABLE_1, SBE_2T3E3_FRAMER_VAL_E3_RX_OOF_INTERRUPT_ENABLE | SBE_2T3E3_FRAMER_VAL_E3_RX_LOS_INTERRUPT_ENABLE); -#if 0 - /*SBE_2T3E3_FRAMER_VAL_E3_RX_COFA_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_E3_RX_OOF_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_E3_RX_LOF_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_E3_RX_LOS_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_E3_RX_AIS_INTERRUPT_ENABLE);*/ -#endif exar7250_read(sc, SBE_2T3E3_FRAMER_REG_E3_RX_INTERRUPT_STATUS_2); -#if 0 - exar7250_write(sc, SBE_2T3E3_FRAMER_REG_E3_RX_INTERRUPT_ENABLE_2, - SBE_2T3E3_FRAMER_VAL_E3_RX_FEBE_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_E3_RX_FERF_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_E3_RX_FRAMING_BYTE_ERROR_INTERRUPT_ENABLE); -#endif break; case SBE_2T3E3_FRAME_TYPE_T3_CBIT: case SBE_2T3E3_FRAME_TYPE_T3_M13: val = exar7250_read(sc, SBE_2T3E3_FRAMER_REG_T3_RX_CONFIGURATION_STATUS); -#if 0 - sc->s.LOS = val & SBE_2T3E3_FRAMER_VAL_T3_RX_LOS ? 1 : 0; -#else + cpld_LOS_update(sc); -#endif + sc->s.OOF = val & SBE_2T3E3_FRAMER_VAL_T3_RX_OOF ? 1 : 0; exar7250_read(sc, SBE_2T3E3_FRAMER_REG_T3_RX_INTERRUPT_STATUS); exar7250_write(sc, SBE_2T3E3_FRAMER_REG_T3_RX_INTERRUPT_ENABLE, SBE_2T3E3_FRAMER_VAL_T3_RX_LOS_INTERRUPT_ENABLE | SBE_2T3E3_FRAMER_VAL_T3_RX_OOF_INTERRUPT_ENABLE); -#if 0 - /* SBE_2T3E3_FRAMER_VAL_T3_RX_CP_BIT_ERROR_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_T3_RX_LOS_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_T3_RX_AIS_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_T3_RX_IDLE_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_T3_RX_FERF_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_T3_RX_AIC_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_T3_RX_OOF_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_T3_RX_P_BIT_INTERRUPT_ENABLE);*/ -#endif exar7250_read(sc, SBE_2T3E3_FRAMER_REG_T3_RX_FEAC_INTERRUPT_ENABLE_STATUS); -#if 0 - exar7250_write(sc, SBE_2T3E3_FRAMER_REG_T3_RX_FEAC_INTERRUPT_ENABLE_STATUS, - SBE_2T3E3_FRAMER_VAL_T3_RX_FEAC_REMOVE_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_T3_RX_FEAC_VALID_INTERRUPT_ENABLE); -#endif exar7250_write(sc, SBE_2T3E3_FRAMER_REG_T3_RX_LAPD_CONTROL, 0); break; diff --git a/drivers/staging/sbe-2t3e3/exar7300.c b/drivers/staging/sbe-2t3e3/exar7300.c index d10d696..cd22999 100644 --- a/drivers/staging/sbe-2t3e3/exar7300.c +++ b/drivers/staging/sbe-2t3e3/exar7300.c @@ -43,23 +43,6 @@ void exar7300_set_loopback(struct channel *sc, u32 mode) val &= ~(SBE_2T3E3_LIU_VAL_LOCAL_LOOPBACK | SBE_2T3E3_LIU_VAL_REMOTE_LOOPBACK); val |= mode; exar7300_write(sc, SBE_2T3E3_LIU_REG_REG4, val); - -#if 0 - /* TODO - is it necessary? idea from 2T3E3_HW_Test_code */ - switch (mode) { - case SBE_2T3E3_LIU_VAL_LOOPBACK_OFF: - break; - case SBE_2T3E3_LIU_VAL_LOOPBACK_REMOTE: - exar7300_receive_equalization_onoff(sc, SBE_2T3E3_ON); - break; - case SBE_2T3E3_LIU_VAL_LOOPBACK_ANALOG: - exar7300_receive_equalization_onoff(sc, SBE_2T3E3_OFF); - break; - case SBE_2T3E3_LIU_VAL_LOOPBACK_DIGITAL: - exar7300_receive_equalization_onoff(sc, SBE_2T3E3_ON); - break; - } -#endif } void exar7300_set_frame_type(struct channel *sc, u32 type) diff --git a/drivers/staging/sbe-2t3e3/intr.c b/drivers/staging/sbe-2t3e3/intr.c index 1336aab..efdeb75 100644 --- a/drivers/staging/sbe-2t3e3/intr.c +++ b/drivers/staging/sbe-2t3e3/intr.c @@ -434,11 +434,6 @@ void exar7250_intr(struct channel *sc) { u32 status, old_OOF; -#if 0 - /* disable interrupts */ - exar7250_write(sc, SBE_2T3E3_FRAMER_REG_BLOCK_INTERRUPT_ENABLE, 0); -#endif - old_OOF = sc->s.OOF; status = exar7250_read(sc, SBE_2T3E3_FRAMER_REG_BLOCK_INTERRUPT_STATUS); @@ -479,13 +474,6 @@ void exar7250_intr(struct channel *sc) dc_start_intr(sc); } } -#if 0 - /* reenable interrupts */ - exar7250_write(sc, SBE_2T3E3_FRAMER_REG_BLOCK_INTERRUPT_ENABLE, - SBE_2T3E3_FRAMER_VAL_RX_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_TX_INTERRUPT_ENABLE - ); -#endif } @@ -503,16 +491,8 @@ void exar7250_T3_intr(struct channel *sc, u32 block_status) result = exar7250_read(sc, SBE_2T3E3_FRAMER_REG_T3_RX_CONFIGURATION_STATUS); -#if 0 - if (status & SBE_2T3E3_FRAMER_VAL_T3_RX_LOS_INTERRUPT_STATUS) { - dev_dbg(&sc->pdev->dev, - "Framer interrupt T3: LOS\n"); - sc->s.LOS = result & SBE_2T3E3_FRAMER_VAL_T3_RX_LOS ? 1 : 0; - - } -#else cpld_LOS_update(sc); -#endif + if (status & SBE_2T3E3_FRAMER_VAL_T3_RX_OOF_INTERRUPT_STATUS) { sc->s.OOF = result & SBE_2T3E3_FRAMER_VAL_T3_RX_OOF ? 1 : 0; dev_dbg(&sc->pdev->dev, @@ -523,16 +503,6 @@ void exar7250_T3_intr(struct channel *sc, u32 block_status) exar7250_write(sc, SBE_2T3E3_FRAMER_REG_T3_RX_INTERRUPT_ENABLE, SBE_2T3E3_FRAMER_VAL_T3_RX_LOS_INTERRUPT_ENABLE | SBE_2T3E3_FRAMER_VAL_T3_RX_OOF_INTERRUPT_ENABLE); -#if 0 - SBE_2T3E3_FRAMER_VAL_T3_RX_CP_BIT_ERROR_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_T3_RX_LOS_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_T3_RX_AIS_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_T3_RX_IDLE_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_T3_RX_FERF_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_T3_RX_AIC_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_T3_RX_OOF_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_T3_RX_P_BIT_INTERRUPT_ENABLE -#endif } status = exar7250_read(sc, SBE_2T3E3_FRAMER_REG_T3_RX_FEAC_INTERRUPT_ENABLE_STATUS); @@ -540,12 +510,6 @@ void exar7250_T3_intr(struct channel *sc, u32 block_status) dev_dbg(&sc->pdev->dev, "Framer interrupt T3 RX (REG[0x17] = %02X)\n", status); -#if 0 - exar7250_write(sc, SBE_2T3E3_FRAMER_REG_T3_RX_FEAC_INTERRUPT_ENABLE_STATUS, - SBE_2T3E3_FRAMER_VAL_T3_RX_FEAC_REMOVE_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_T3_RX_FEAC_VALID_INTERRUPT_ENABLE - ); -#endif } status = exar7250_read(sc, SBE_2T3E3_FRAMER_REG_T3_RX_LAPD_CONTROL); @@ -582,15 +546,8 @@ void exar7250_E3_intr(struct channel *sc, u32 block_status) result = exar7250_read(sc, SBE_2T3E3_FRAMER_REG_E3_RX_CONFIGURATION_STATUS_2); -#if 0 - if (status & SBE_2T3E3_FRAMER_VAL_E3_RX_LOS_INTERRUPT_STATUS) { - dev_dbg(&sc->pdev->dev, - "Framer interrupt E3: LOS\n"); - sc->s.LOS = result & SBE_2T3E3_FRAMER_VAL_E3_RX_LOS ? 1 : 0; - } -#else cpld_LOS_update(sc); -#endif + if (status & SBE_2T3E3_FRAMER_VAL_E3_RX_OOF_INTERRUPT_STATUS) { sc->s.OOF = result & SBE_2T3E3_FRAMER_VAL_E3_RX_OOF ? 1 : 0; dev_dbg(&sc->pdev->dev, @@ -602,13 +559,6 @@ void exar7250_E3_intr(struct channel *sc, u32 block_status) SBE_2T3E3_FRAMER_VAL_E3_RX_OOF_INTERRUPT_ENABLE | SBE_2T3E3_FRAMER_VAL_E3_RX_LOS_INTERRUPT_ENABLE ); -#if 0 - SBE_2T3E3_FRAMER_VAL_E3_RX_COFA_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_E3_RX_OOF_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_E3_RX_LOF_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_E3_RX_LOS_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_E3_RX_AIS_INTERRUPT_ENABLE -#endif } status = exar7250_read(sc, SBE_2T3E3_FRAMER_REG_E3_RX_INTERRUPT_STATUS_2); @@ -617,12 +567,6 @@ void exar7250_E3_intr(struct channel *sc, u32 block_status) "Framer interrupt E3 RX (REG[0x15] = %02X)\n", status); -#if 0 - exar7250_write(sc, SBE_2T3E3_FRAMER_REG_E3_RX_INTERRUPT_ENABLE_2, - SBE_2T3E3_FRAMER_VAL_E3_RX_FEBE_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_E3_RX_FERF_INTERRUPT_ENABLE | - SBE_2T3E3_FRAMER_VAL_E3_RX_FRAMING_BYTE_ERROR_INTERRUPT_ENABLE); -#endif } } diff --git a/drivers/staging/sbe-2t3e3/io.c b/drivers/staging/sbe-2t3e3/io.c index d2391cb..c9947b1 100644 --- a/drivers/staging/sbe-2t3e3/io.c +++ b/drivers/staging/sbe-2t3e3/io.c @@ -199,15 +199,6 @@ u32 exar7250_read(struct channel *channel, u32 reg) u32 result; unsigned long flags; -#if 0 - switch (reg) { - case SBE_2T3E3_FRAMER_REG_OPERATING_MODE: - return channel->framer_regs[reg]; - break; - default: - } -#endif - spin_lock_irqsave(&channel->card->bootrom_lock, flags); result = bootrom_read(channel, cpld_reg_map[SBE_2T3E3_CPLD_REG_FRAMER_BASE_ADDRESS] @@ -243,18 +234,6 @@ u32 exar7300_read(struct channel *channel, u32 reg) unsigned long addr = channel->card->bootrom_addr, flags; u32 i, val; -#if 0 - switch (reg) { - case SBE_2T3E3_LIU_REG_REG1: - case SBE_2T3E3_LIU_REG_REG2: - case SBE_2T3E3_LIU_REG_REG3: - case SBE_2T3E3_LIU_REG_REG4: - return channel->liu_regs[reg]; - break; - default: - } -#endif - /* select correct Serial Chip */ spin_lock_irqsave(&channel->card->bootrom_lock, flags); -- cgit v0.10.2 From e58b89dade3e9e7577f8481b21af3043dc0fffe3 Mon Sep 17 00:00:00 2001 From: Toshiaki Yamane Date: Thu, 19 Jul 2012 10:34:32 +0900 Subject: staging/et131x: fix checkpatch warnings The below checkpatch warns was fixed, drivers/staging/et131x/et131x.c:2556: WARNING: Prefer pr_info(... to printk(KERN_INFO, ... drivers/staging/et131x/et131x.c:2577: WARNING: Prefer pr_info(... to printk(KERN_INFO, ... drivers/staging/et131x/et131x.c:5189: WARNING: Prefer pr_info(... to printk(KERN_INFO, ... And fixed below, -added pr_fmt -fixed printk formats for dma_addr_t -converted printk to netdev_info Signed-off-by: Toshiaki Yamane Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index 4c78f12..029725c 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -53,6 +53,8 @@ * */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include #include #include @@ -2553,8 +2555,8 @@ static int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) "Cannot alloc memory for Packet Status Ring\n"); return -ENOMEM; } - printk(KERN_INFO "Packet Status Ring %lx\n", - (unsigned long) rx_ring->ps_ring_physaddr); + pr_info("Packet Status Ring %llx\n", + (unsigned long long) rx_ring->ps_ring_physaddr); /* * NOTE : dma_alloc_coherent(), used above to alloc DMA regions, @@ -2574,7 +2576,7 @@ static int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) return -ENOMEM; } rx_ring->num_rfd = NIC_DEFAULT_NUM_RFD; - printk(KERN_INFO "PRS %lx\n", (unsigned long)rx_ring->rx_status_bus); + pr_info("PRS %llx\n", (unsigned long long)rx_ring->rx_status_bus); /* Recv * kmem_cache_create initializes a lookaside list. After successful @@ -5180,8 +5182,8 @@ static int et131x_set_mac_addr(struct net_device *netdev, void *new_mac) memcpy(netdev->dev_addr, address->sa_data, netdev->addr_len); - printk(KERN_INFO "%s: Setting MAC address to %pM\n", - netdev->name, netdev->dev_addr); + netdev_info(netdev, "Setting MAC address to %pM\n", + netdev->dev_addr); /* Free Rx DMA memory */ et131x_adapter_memory_free(adapter); -- cgit v0.10.2 From a952f947b9ebf83cea406bf69f2847a3ca8a076c Mon Sep 17 00:00:00 2001 From: Toshiaki Yamane Date: Thu, 19 Jul 2012 10:08:42 +0900 Subject: staging/frontier: fix checkpatch warnings The below checkpatch warns was fixed, drivers/staging/frontier/tranzport.c:356: WARNING: Prefer pr_err(... to printk(KERN_ERR, ... drivers/staging/frontier/tranzport.c:523: WARNING: Prefer pr_err(... to printk(KERN_ERR, ... drivers/staging/frontier/tranzport.c:696: WARNING: Prefer pr_err(... to printk(KERN_ERR, ... drivers/staging/frontier/alphatrack.c:336: WARNING: Prefer pr_err(... to printk(KERN_ERR, ... drivers/staging/frontier/alphatrack.c:497: WARNING: Prefer pr_err(... to printk(KERN_ERR, ... drivers/staging/frontier/alphatrack.c:568: WARNING: Prefer pr_err(... to printk(KERN_ERR, ... Signed-off-by: Toshiaki Yamane Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/frontier/alphatrack.c b/drivers/staging/frontier/alphatrack.c index acbb2cc..33085782 100644 --- a/drivers/staging/frontier/alphatrack.c +++ b/drivers/staging/frontier/alphatrack.c @@ -333,7 +333,7 @@ static int usb_alphatrack_open(struct inode *inode, struct file *file) interface = usb_find_interface(&usb_alphatrack_driver, subminor); if (!interface) { - printk(KERN_ERR "%s - error, can't find device for minor %d\n", + pr_err("%s - error, can't find device for minor %d\n", __func__, subminor); retval = -ENODEV; goto unlock_disconnect_exit; @@ -494,7 +494,7 @@ static ssize_t usb_alphatrack_read(struct file *file, char __user *buffer, /* verify that the device wasn't unplugged */ if (dev->intf == NULL) { retval = -ENODEV; - printk(KERN_ERR "%s: No device or device unplugged %d\n", + pr_err("%s: No device or device unplugged %d\n", __func__, retval); goto unlock_exit; } @@ -565,7 +565,7 @@ static ssize_t usb_alphatrack_write(struct file *file, /* verify that the device wasn't unplugged */ if (dev->intf == NULL) { retval = -ENODEV; - printk(KERN_ERR "%s: No device or device unplugged %d\n", + pr_err("%s: No device or device unplugged %d\n", __func__, retval); goto unlock_exit; } diff --git a/drivers/staging/frontier/tranzport.c b/drivers/staging/frontier/tranzport.c index 376706f..5196a4e 100644 --- a/drivers/staging/frontier/tranzport.c +++ b/drivers/staging/frontier/tranzport.c @@ -353,8 +353,8 @@ static int usb_tranzport_open(struct inode *inode, struct file *file) interface = usb_find_interface(&usb_tranzport_driver, subminor); if (!interface) { - printk(KERN_ERR "%s - error, can't find device for minor %d\n", - __func__, subminor); + pr_err("%s - error, can't find device for minor %d\n", + __func__, subminor); retval = -ENODEV; goto unlock_disconnect_exit; } @@ -520,8 +520,8 @@ static ssize_t usb_tranzport_read(struct file *file, char __user *buffer, /* verify that the device wasn't unplugged */ if (dev->intf == NULL) { retval = -ENODEV; - printk(KERN_ERR "%s: No device or device unplugged %d\n", - __func__, retval); + pr_err("%s: No device or device unplugged %d\n", + __func__, retval); goto unlock_exit; } @@ -693,8 +693,8 @@ static ssize_t usb_tranzport_write(struct file *file, /* verify that the device wasn't unplugged */ if (dev->intf == NULL) { retval = -ENODEV; - printk(KERN_ERR "%s: No device or device unplugged %d\n", - __func__, retval); + pr_err("%s: No device or device unplugged %d\n", + __func__, retval); goto unlock_exit; } -- cgit v0.10.2 From 5b99b094308b4e328bcf604ff2edceb9170f1732 Mon Sep 17 00:00:00 2001 From: Lauri Hintsala Date: Wed, 18 Jul 2012 08:05:39 +0300 Subject: staging: csr: remove unneeded PCI dependency Signed-off-by: Lauri Hintsala Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/Kconfig b/drivers/staging/csr/Kconfig index bd86fb9..cee8d48 100644 --- a/drivers/staging/csr/Kconfig +++ b/drivers/staging/csr/Kconfig @@ -1,6 +1,6 @@ config CSR_WIFI tristate "CSR wireless driver" - depends on PCI && MMC && CFG80211_WEXT + depends on MMC && CFG80211_WEXT select WIRELESS_EXT select WEXT_PRIV help -- cgit v0.10.2 From 289a64295c9ae897c18302c15abd8f0464e8c6cb Mon Sep 17 00:00:00 2001 From: Toshiaki Yamane Date: Wed, 18 Jul 2012 10:16:07 +0900 Subject: staging/cptm1217: fix checkpatch warnings The below checkpatch error was fixed, drivers/staging/cptm1217/cp_tm1217.h:5: ERROR: open brace '{' following struct go on the same line Signed-off-by: Toshiaki Yamane Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/cptm1217/cp_tm1217.h b/drivers/staging/cptm1217/cp_tm1217.h index a0ce31d..30bad35 100644 --- a/drivers/staging/cptm1217/cp_tm1217.h +++ b/drivers/staging/cptm1217/cp_tm1217.h @@ -1,8 +1,7 @@ #ifndef __LINUX_I2C_CP_TM1217_H #define __LINUX_I2C_CP_TM1217_H -struct cp_tm1217_platform_data -{ +struct cp_tm1217_platform_data { int gpio; /* If not set uses the IRQ resource 0 */ }; -- cgit v0.10.2 From ddb01367b85df2c4c773bde047e5b04b6de1835b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Thu, 19 Jul 2012 10:39:33 -0700 Subject: staging: comedi: comedidev.h: introduce comedi_to_pci_dev() helper Introduce a wrapper for to_pci_dev() to allow the comedi_pci_drivers to store the pci_dev pointer in the comedi_device hw_dev variable and retrieve it easily. Signed-off-by: H Hartley Sweeten Cc: Ian Abbot Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index de8c99c..f713783 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -446,6 +446,11 @@ static inline void comedi_set_hw_dev(struct comedi_device *dev, } } +static inline struct pci_dev *comedi_to_pci_dev(struct comedi_device *dev) +{ + return dev->hw_dev ? to_pci_dev(dev->hw_dev) : NULL; +} + int comedi_buf_put(struct comedi_async *async, short x); int comedi_buf_get(struct comedi_async *async, short *x); -- cgit v0.10.2 From f8ec639268156073bf8214a5b9446890764448c8 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:24:37 -0700 Subject: staging: comedi: adl_pci6208: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index 487fd4a..3bec0f6 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -73,7 +73,6 @@ static const struct pci6208_board pci6208_boards[] = { }; struct pci6208_private { - struct pci_dev *pci_dev; unsigned int ao_readback[PCI6208_MAX_AO_CHANNELS]; }; @@ -200,6 +199,7 @@ static int pci6208_attach(struct comedi_device *dev, { const struct pci6208_board *thisboard; struct pci6208_private *devpriv; + struct pci_dev *pcidev; struct comedi_subdevice *s; int ret; @@ -208,20 +208,21 @@ static int pci6208_attach(struct comedi_device *dev, return ret; devpriv = dev->private; - devpriv->pci_dev = pci6208_find_device(dev, it); - if (!devpriv->pci_dev) + pcidev = pci6208_find_device(dev, it); + if (!pcidev) return -EIO; + comedi_set_hw_dev(dev, &pcidev->dev); thisboard = comedi_board(dev); dev->board_name = thisboard->name; - ret = comedi_pci_enable(devpriv->pci_dev, dev->driver->driver_name); + ret = comedi_pci_enable(pcidev, dev->driver->driver_name); if (ret) { dev_err(dev->class_dev, "Failed to enable PCI device and request regions\n"); return ret; } - dev->iobase = pci_resource_start(devpriv->pci_dev, 2); + dev->iobase = pci_resource_start(pcidev, 2); ret = comedi_alloc_subdevices(dev, 2); if (ret) @@ -258,12 +259,12 @@ static int pci6208_attach(struct comedi_device *dev, static void pci6208_detach(struct comedi_device *dev) { - struct pci6208_private *devpriv = dev->private; + struct pci_dev *pcidev = comedi_to_pci_dev(dev); - if (devpriv && devpriv->pci_dev) { + if (pcidev) { if (dev->iobase) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); } } -- cgit v0.10.2 From 807856bf94385cf6f94e3254c289b3574d2e9948 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:24:57 -0700 Subject: staging: comedi: adl_pci7230: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci7230.c b/drivers/staging/comedi/drivers/adl_pci7230.c index cfb8bb0..cdf39490 100644 --- a/drivers/staging/comedi/drivers/adl_pci7230.c +++ b/drivers/staging/comedi/drivers/adl_pci7230.c @@ -44,7 +44,6 @@ Configuration Options: struct adl_pci7230_private { int data; - struct pci_dev *pci_dev; }; #define devpriv ((struct adl_pci7230_private *)dev->private) @@ -102,6 +101,7 @@ static int adl_pci7230_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; + struct pci_dev *pcidev; int ret; printk(KERN_INFO "comedi%d: adl_pci7230\n", dev->minor); @@ -115,16 +115,17 @@ static int adl_pci7230_attach(struct comedi_device *dev, if (ret) return ret; - devpriv->pci_dev = adl_pci7230_find_pci(dev, it); - if (!devpriv->pci_dev) + pcidev = adl_pci7230_find_pci(dev, it); + if (!pcidev) return -EIO; + comedi_set_hw_dev(dev, &pcidev->dev); - if (comedi_pci_enable(devpriv->pci_dev, "adl_pci7230") < 0) { + if (comedi_pci_enable(pcidev, "adl_pci7230") < 0) { printk(KERN_ERR "comedi%d: Failed to enable PCI device and request regions\n", dev->minor); return -EIO; } - dev->iobase = pci_resource_start(devpriv->pci_dev, 2); + dev->iobase = pci_resource_start(pcidev, 2); printk(KERN_DEBUG "comedi: base addr %4lx\n", dev->iobase); s = dev->subdevices + 0; @@ -152,10 +153,12 @@ static int adl_pci7230_attach(struct comedi_device *dev, static void adl_pci7230_detach(struct comedi_device *dev) { - if (devpriv && devpriv->pci_dev) { + struct pci_dev *pcidev = comedi_to_pci_dev(dev); + + if (pcidev) { if (dev->iobase) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); } } -- cgit v0.10.2 From 8f9c5b7032df0210c464a0fbb9a93654310da54a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:25:29 -0700 Subject: staging: comedi: adl_pci7230: remove the private data The private data is no longer needed by this driver. Remove the struct, devpriv macro, and the allocation. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci7230.c b/drivers/staging/comedi/drivers/adl_pci7230.c index cdf39490..7df4c96 100644 --- a/drivers/staging/comedi/drivers/adl_pci7230.c +++ b/drivers/staging/comedi/drivers/adl_pci7230.c @@ -42,12 +42,6 @@ Configuration Options: #define PCI_DEVICE_ID_PCI7230 0x7230 -struct adl_pci7230_private { - int data; -}; - -#define devpriv ((struct adl_pci7230_private *)dev->private) - static int adl_pci7230_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -108,9 +102,6 @@ static int adl_pci7230_attach(struct comedi_device *dev, dev->board_name = "pci7230"; - if (alloc_private(dev, sizeof(struct adl_pci7230_private)) < 0) - return -ENOMEM; - ret = comedi_alloc_subdevices(dev, 2); if (ret) return ret; -- cgit v0.10.2 From caeb2490e046909fcb2f8209b88458a147011819 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:25:49 -0700 Subject: staging: comedi: adl_pci7296: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci7296.c b/drivers/staging/comedi/drivers/adl_pci7296.c index 58deb60..b003ed0 100644 --- a/drivers/staging/comedi/drivers/adl_pci7296.c +++ b/drivers/staging/comedi/drivers/adl_pci7296.c @@ -49,7 +49,6 @@ Configuration Options: struct adl_pci7296_private { int data; - struct pci_dev *pci_dev; }; #define devpriv ((struct adl_pci7296_private *)dev->private) @@ -82,6 +81,7 @@ static struct pci_dev *adl_pci7296_find_pci(struct comedi_device *dev, static int adl_pci7296_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + struct pci_dev *pcidev; struct comedi_subdevice *s; int ret; @@ -96,18 +96,19 @@ static int adl_pci7296_attach(struct comedi_device *dev, if (ret) return ret; - devpriv->pci_dev = adl_pci7296_find_pci(dev, it); - if (!devpriv->pci_dev) + pcidev = adl_pci7296_find_pci(dev, it); + if (!pcidev) return -EIO; + comedi_set_hw_dev(dev, &pcidev->dev); - if (comedi_pci_enable(devpriv->pci_dev, "adl_pci7296") < 0) { + if (comedi_pci_enable(pcidev, "adl_pci7296") < 0) { printk(KERN_ERR "comedi%d: Failed to enable PCI device and request regions\n", dev->minor); return -EIO; } - dev->iobase = pci_resource_start(devpriv->pci_dev, 2); + dev->iobase = pci_resource_start(pcidev, 2); printk(KERN_INFO "comedi: base addr %4lx\n", dev->iobase); /* four 8255 digital io subdevices */ @@ -139,10 +140,12 @@ static int adl_pci7296_attach(struct comedi_device *dev, static void adl_pci7296_detach(struct comedi_device *dev) { - if (devpriv && devpriv->pci_dev) { + struct pci_dev *pcidev = comedi_to_pci_dev(dev); + + if (pcidev) { if (dev->iobase) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); } if (dev->subdevices) { subdev_8255_cleanup(dev, dev->subdevices + 0); -- cgit v0.10.2 From b94cea48ab8428ae803f4e27131367574295853d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:26:23 -0700 Subject: staging: comedi: adl_pci7296: remove the private data The private data is no longer needed by this driver. Remove the struct, devpriv macro, and the allocation. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci7296.c b/drivers/staging/comedi/drivers/adl_pci7296.c index b003ed0..19b47af 100644 --- a/drivers/staging/comedi/drivers/adl_pci7296.c +++ b/drivers/staging/comedi/drivers/adl_pci7296.c @@ -47,12 +47,6 @@ Configuration Options: #define PCI_DEVICE_ID_PCI7296 0x7296 -struct adl_pci7296_private { - int data; -}; - -#define devpriv ((struct adl_pci7296_private *)dev->private) - static struct pci_dev *adl_pci7296_find_pci(struct comedi_device *dev, struct comedi_devconfig *it) { @@ -89,9 +83,6 @@ static int adl_pci7296_attach(struct comedi_device *dev, dev->board_name = "pci7432"; - if (alloc_private(dev, sizeof(struct adl_pci7296_private)) < 0) - return -ENOMEM; - ret = comedi_alloc_subdevices(dev, 4); if (ret) return ret; -- cgit v0.10.2 From e4eff325edd671f422f8f2d8531fece569f74866 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:27:03 -0700 Subject: staging: comedi: adl_pci7432: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci7432.c b/drivers/staging/comedi/drivers/adl_pci7432.c index 10683c2..ebe022d 100644 --- a/drivers/staging/comedi/drivers/adl_pci7432.c +++ b/drivers/staging/comedi/drivers/adl_pci7432.c @@ -44,7 +44,6 @@ Configuration Options: struct adl_pci7432_private { int data; - struct pci_dev *pci_dev; }; #define devpriv ((struct adl_pci7432_private *)dev->private) @@ -110,6 +109,7 @@ static struct pci_dev *adl_pci7432_find_pci(struct comedi_device *dev, static int adl_pci7432_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + struct pci_dev *pcidev; struct comedi_subdevice *s; int ret; @@ -124,16 +124,17 @@ static int adl_pci7432_attach(struct comedi_device *dev, if (ret) return ret; - devpriv->pci_dev = adl_pci7432_find_pci(dev, it); - if (!devpriv->pci_dev) + pcidev = adl_pci7432_find_pci(dev, it); + if (!pcidev) return -EIO; + comedi_set_hw_dev(dev, &pcidev->dev); - if (comedi_pci_enable(devpriv->pci_dev, "adl_pci7432") < 0) { + if (comedi_pci_enable(pcidev, "adl_pci7432") < 0) { printk(KERN_ERR "comedi%d: Failed to enable PCI device and request regions\n", dev->minor); return -EIO; } - dev->iobase = pci_resource_start(devpriv->pci_dev, 2); + dev->iobase = pci_resource_start(pcidev, 2); printk(KERN_INFO "comedi: base addr %4lx\n", dev->iobase); s = dev->subdevices + 0; @@ -162,10 +163,12 @@ static int adl_pci7432_attach(struct comedi_device *dev, static void adl_pci7432_detach(struct comedi_device *dev) { - if (devpriv && devpriv->pci_dev) { + struct pci_dev *pcidev = comedi_to_pci_dev(dev); + + if (pcidev) { if (dev->iobase) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); } } -- cgit v0.10.2 From 0ff9ba1b6294a2507769ab3c1b5867d3a527641e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:27:29 -0700 Subject: staging: comedi: adl_pci7432: remove the private data The private data is no longer needed by this driver. Remove the struct, devpriv macro, and the allocation. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci7432.c b/drivers/staging/comedi/drivers/adl_pci7432.c index ebe022d..6b8d940 100644 --- a/drivers/staging/comedi/drivers/adl_pci7432.c +++ b/drivers/staging/comedi/drivers/adl_pci7432.c @@ -42,12 +42,6 @@ Configuration Options: #define PCI_DEVICE_ID_PCI7432 0x7432 -struct adl_pci7432_private { - int data; -}; - -#define devpriv ((struct adl_pci7432_private *)dev->private) - static int adl_pci7432_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -117,9 +111,6 @@ static int adl_pci7432_attach(struct comedi_device *dev, dev->board_name = "pci7432"; - if (alloc_private(dev, sizeof(struct adl_pci7432_private)) < 0) - return -ENOMEM; - ret = comedi_alloc_subdevices(dev, 2); if (ret) return ret; -- cgit v0.10.2 From 35260aa6f7fd5c404efb76ffa9b58a0b5d115dec Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:27:53 -0700 Subject: staging: comedi: adl_pci8164: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci8164.c b/drivers/staging/comedi/drivers/adl_pci8164.c index 1811375..94230d6 100644 --- a/drivers/staging/comedi/drivers/adl_pci8164.c +++ b/drivers/staging/comedi/drivers/adl_pci8164.c @@ -57,7 +57,6 @@ Configuration Options: struct adl_pci8164_private { int data; - struct pci_dev *pci_dev; }; #define devpriv ((struct adl_pci8164_private *)dev->private) @@ -251,6 +250,7 @@ static struct pci_dev *adl_pci8164_find_pci(struct comedi_device *dev, static int adl_pci8164_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + struct pci_dev *pcidev; struct comedi_subdevice *s; int ret; @@ -266,16 +266,17 @@ static int adl_pci8164_attach(struct comedi_device *dev, if (ret) return ret; - devpriv->pci_dev = adl_pci8164_find_pci(dev, it); - if (!devpriv->pci_dev) + pcidev = adl_pci8164_find_pci(dev, it); + if (!pcidev) return -EIO; + comedi_set_hw_dev(dev, &pcidev->dev); - if (comedi_pci_enable(devpriv->pci_dev, "adl_pci8164") < 0) { + if (comedi_pci_enable(pcidev, "adl_pci8164") < 0) { printk(KERN_ERR "comedi%d: Failed to enable " "PCI device and request regions\n", dev->minor); return -EIO; } - dev->iobase = pci_resource_start(devpriv->pci_dev, 2); + dev->iobase = pci_resource_start(pcidev, 2); printk(KERN_DEBUG "comedi: base addr %4lx\n", dev->iobase); s = dev->subdevices + 0; @@ -324,10 +325,12 @@ static int adl_pci8164_attach(struct comedi_device *dev, static void adl_pci8164_detach(struct comedi_device *dev) { - if (devpriv && devpriv->pci_dev) { + struct pci_dev *pcidev = comedi_to_pci_dev(dev); + + if (pcidev) { if (dev->iobase) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); } } -- cgit v0.10.2 From e5ba6018d3db7a4c251ca6c75ea529d1e2de1f21 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:28:13 -0700 Subject: staging: comedi: adl_pci8164: remove the private data The private data is no longer needed by this driver. Remove the struct, devpriv macro, and the allocation. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci8164.c b/drivers/staging/comedi/drivers/adl_pci8164.c index 94230d6..247ef00 100644 --- a/drivers/staging/comedi/drivers/adl_pci8164.c +++ b/drivers/staging/comedi/drivers/adl_pci8164.c @@ -55,12 +55,6 @@ Configuration Options: #define PCI_DEVICE_ID_PCI8164 0x8164 -struct adl_pci8164_private { - int data; -}; - -#define devpriv ((struct adl_pci8164_private *)dev->private) - /* all the read commands are the same except for the addition a constant * const to the data for inw() @@ -259,9 +253,6 @@ static int adl_pci8164_attach(struct comedi_device *dev, dev->board_name = "pci8164"; - if (alloc_private(dev, sizeof(struct adl_pci8164_private)) < 0) - return -ENOMEM; - ret = comedi_alloc_subdevices(dev, 4); if (ret) return ret; -- cgit v0.10.2 From 6a7b1b0c4c7e306ecaee404389574c4c20546ee8 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:28:43 -0700 Subject: staging: comedi: adl_pci9111: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c index c41cfc5..a31dae6 100644 --- a/drivers/staging/comedi/drivers/adl_pci9111.c +++ b/drivers/staging/comedi/drivers/adl_pci9111.c @@ -338,7 +338,6 @@ static const struct pci9111_board pci9111_boards[] = { /* Private data structure */ struct pci9111_private_data { - struct pci_dev *pci_device; unsigned long io_range; /* PCI6503 io range */ unsigned long lcr_io_base; /* Local configuration register base @@ -1247,6 +1246,7 @@ static struct pci_dev *pci9111_find_pci(struct comedi_device *dev, static int pci9111_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + struct pci_dev *pcidev; struct comedi_subdevice *subdevice; unsigned long io_base, io_range, lcr_io_base, lcr_io_range; int error; @@ -1259,9 +1259,10 @@ static int pci9111_attach(struct comedi_device *dev, printk(KERN_ERR "comedi%d: " PCI9111_DRIVER_NAME " driver\n", dev->minor); - dev_private->pci_device = pci9111_find_pci(dev, it); - if (!dev_private->pci_device) + pcidev = pci9111_find_pci(dev, it); + if (!pcidev) return -EIO; + comedi_set_hw_dev(dev, &pcidev->dev); board = (struct pci9111_board *)dev->board_ptr; /* TODO: Warn about non-tested boards. */ @@ -1269,15 +1270,15 @@ static int pci9111_attach(struct comedi_device *dev, /* Read local configuration register base address * [PCI_BASE_ADDRESS #1]. */ - lcr_io_base = pci_resource_start(dev_private->pci_device, 1); - lcr_io_range = pci_resource_len(dev_private->pci_device, 1); + lcr_io_base = pci_resource_start(pcidev, 1); + lcr_io_range = pci_resource_len(pcidev, 1); printk ("comedi%d: local configuration registers at address 0x%4lx [0x%4lx]\n", dev->minor, lcr_io_base, lcr_io_range); /* Enable PCI device and request regions */ - if (comedi_pci_enable(dev_private->pci_device, PCI9111_DRIVER_NAME) < 0) { + if (comedi_pci_enable(pcidev, PCI9111_DRIVER_NAME) < 0) { printk ("comedi%d: Failed to enable PCI device and request regions\n", dev->minor); @@ -1285,8 +1286,8 @@ static int pci9111_attach(struct comedi_device *dev, } /* Read PCI6308 register base address [PCI_BASE_ADDRESS #2]. */ - io_base = pci_resource_start(dev_private->pci_device, 2); - io_range = pci_resource_len(dev_private->pci_device, 2); + io_base = pci_resource_start(pcidev, 2); + io_range = pci_resource_len(pcidev, 2); printk(KERN_ERR "comedi%d: 6503 registers at address 0x%4lx [0x%4lx]\n", dev->minor, io_base, io_range); @@ -1303,8 +1304,8 @@ static int pci9111_attach(struct comedi_device *dev, /* Irq setup */ dev->irq = 0; - if (dev_private->pci_device->irq > 0) { - dev->irq = dev_private->pci_device->irq; + if (pcidev->irq > 0) { + dev->irq = pcidev->irq; if (request_irq(dev->irq, pci9111_interrupt, IRQF_SHARED, PCI9111_DRIVER_NAME, dev) != 0) { @@ -1374,16 +1375,18 @@ static int pci9111_attach(struct comedi_device *dev, static void pci9111_detach(struct comedi_device *dev) { + struct pci_dev *pcidev = comedi_to_pci_dev(dev); + if (dev->private != NULL) { if (dev_private->is_valid) pci9111_reset(dev); } if (dev->irq != 0) free_irq(dev->irq, dev); - if (dev_private != NULL && dev_private->pci_device != NULL) { + if (pcidev) { if (dev->iobase) - comedi_pci_disable(dev_private->pci_device); - pci_dev_put(dev_private->pci_device); + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); } } -- cgit v0.10.2 From c945a1d1189428101c357220ee25f6adc906a7de Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:29:15 -0700 Subject: staging: comedi: adl_pci9118: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 4482aab..a1f74c2 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -250,7 +250,6 @@ struct boardtype { struct pci9118_private { unsigned long iobase_a; /* base+size for AMCC chip */ unsigned int master; /* master capable */ - struct pci_dev *pcidev; /* ptr to actual pcidev */ unsigned int usemux; /* we want to use external multiplexor! */ #ifdef PCI9118_PARANOIDCHECK unsigned short chanlist[PCI9118_CHANLEN + 1]; /* @@ -2151,6 +2150,7 @@ static struct pci_dev *pci9118_find_pci(struct comedi_device *dev, static int pci9118_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + struct pci_dev *pcidev; struct comedi_subdevice *s; int ret, pages, i; unsigned short master; @@ -2170,16 +2170,17 @@ static int pci9118_attach(struct comedi_device *dev, return -ENOMEM; } - devpriv->pcidev = pci9118_find_pci(dev, it); - if (!devpriv->pcidev) + pcidev = pci9118_find_pci(dev, it); + if (!pcidev) return -EIO; + comedi_set_hw_dev(dev, &pcidev->dev); if (master) - pci_set_master(devpriv->pcidev); + pci_set_master(pcidev); - irq = devpriv->pcidev->irq; - devpriv->iobase_a = pci_resource_start(devpriv->pcidev, 0); - dev->iobase = pci_resource_start(devpriv->pcidev, 2); + irq = pcidev->irq; + devpriv->iobase_a = pci_resource_start(pcidev, 0); + dev->iobase = pci_resource_start(pcidev, 2); dev->board_name = this_board->name; @@ -2264,8 +2265,8 @@ static int pci9118_attach(struct comedi_device *dev, printk(".\n"); - pci_read_config_word(devpriv->pcidev, PCI_COMMAND, &u16w); - pci_write_config_word(devpriv->pcidev, PCI_COMMAND, u16w | 64); + pci_read_config_word(pcidev, PCI_COMMAND, &u16w); + pci_write_config_word(pcidev, PCI_COMMAND, u16w | 64); /* Enable parity check for parity error */ ret = comedi_alloc_subdevices(dev, 4); @@ -2343,17 +2344,13 @@ static int pci9118_attach(struct comedi_device *dev, static void pci9118_detach(struct comedi_device *dev) { + struct pci_dev *pcidev = comedi_to_pci_dev(dev); + if (dev->private) { if (devpriv->valid) pci9118_reset(dev); if (dev->irq) free_irq(dev->irq, dev); - if (devpriv->pcidev) { - if (dev->iobase) - comedi_pci_disable(devpriv->pcidev); - - pci_dev_put(devpriv->pcidev); - } if (devpriv->dmabuf_virt[0]) free_pages((unsigned long)devpriv->dmabuf_virt[0], devpriv->dmabuf_pages[0]); @@ -2361,6 +2358,12 @@ static void pci9118_detach(struct comedi_device *dev) free_pages((unsigned long)devpriv->dmabuf_virt[1], devpriv->dmabuf_pages[1]); } + if (pcidev) { + if (dev->iobase) + comedi_pci_disable(pcidev); + + pci_dev_put(pcidev); + } } static const struct boardtype boardtypes[] = { -- cgit v0.10.2 From 05979c7b3c5463eddbbfd3dd56f8a62679508c5e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:29:54 -0700 Subject: staging: comedi: adv_pci1723: factor out the "find pci device" code Factor the "find pci device" code out of the attach function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adv_pci1723.c b/drivers/staging/comedi/drivers/adv_pci1723.c index 5c99c74..4803a8c 100644 --- a/drivers/staging/comedi/drivers/adv_pci1723.c +++ b/drivers/staging/comedi/drivers/adv_pci1723.c @@ -287,29 +287,18 @@ static int pci1723_dio_insn_bits(struct comedi_device *dev, return insn->n; } -static int pci1723_attach(struct comedi_device *dev, - struct comedi_devconfig *it) +static struct pci_dev *pci1723_find_pci_dev(struct comedi_device *dev, + struct comedi_devconfig *it) { - struct comedi_subdevice *s; - int ret, subdev, n_subdevices; struct pci_dev *pcidev; unsigned int iobase; unsigned char pci_bus, pci_slot, pci_func; int opt_bus, opt_slot; const char *errstr; - printk(KERN_ERR "comedi%d: adv_pci1723: board=%s", - dev->minor, this_board->name); - opt_bus = it->options[0]; opt_slot = it->options[1]; - ret = alloc_private(dev, sizeof(struct pci1723_private)); - if (ret < 0) { - printk(" - Allocation failed!\n"); - return -ENOMEM; - } - /* Look for matching PCI device */ errstr = "not found!"; pcidev = NULL; @@ -342,7 +331,7 @@ static int pci1723_attach(struct comedi_device *dev, } else { printk(KERN_ERR " - Card %s\n", errstr); } - return -EIO; + return NULL; } pci_bus = pcidev->bus->number; @@ -353,10 +342,31 @@ static int pci1723_attach(struct comedi_device *dev, printk(KERN_ERR ", b:s:f=%d:%d:%d, io=0x%4x", pci_bus, pci_slot, pci_func, iobase); - dev->iobase = iobase; + return pcidev; +} + +static int pci1723_attach(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + struct comedi_subdevice *s; + int ret, subdev, n_subdevices; + + printk(KERN_ERR "comedi%d: adv_pci1723: board=%s", + dev->minor, this_board->name); + + ret = alloc_private(dev, sizeof(struct pci1723_private)); + if (ret < 0) { + printk(" - Allocation failed!\n"); + return -ENOMEM; + } + + devpriv->pcidev = pci1723_find_pci_dev(dev, it); + if (!devpriv->pcidev) + return -EIO; + + dev->iobase = pci_resource_start(devpriv->pcidev, 2); dev->board_name = this_board->name; - devpriv->pcidev = pcidev; n_subdevices = 0; -- cgit v0.10.2 From 3dbd666ca4e3c6e6d19101781a62555d0210ff57 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:30:15 -0700 Subject: staging: comedi: adv_pci1723: cleanup "find pci device" code Use for_each_pci_dev() instead of open-coding the loop using pci_get_device(). Drop the printk error messages. They just add noise. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adv_pci1723.c b/drivers/staging/comedi/drivers/adv_pci1723.c index 4803a8c..f561a2a 100644 --- a/drivers/staging/comedi/drivers/adv_pci1723.c +++ b/drivers/staging/comedi/drivers/adv_pci1723.c @@ -290,59 +290,30 @@ static int pci1723_dio_insn_bits(struct comedi_device *dev, static struct pci_dev *pci1723_find_pci_dev(struct comedi_device *dev, struct comedi_devconfig *it) { - struct pci_dev *pcidev; - unsigned int iobase; - unsigned char pci_bus, pci_slot, pci_func; - int opt_bus, opt_slot; - const char *errstr; - - opt_bus = it->options[0]; - opt_slot = it->options[1]; - - /* Look for matching PCI device */ - errstr = "not found!"; - pcidev = NULL; - while (NULL != (pcidev = - pci_get_device(PCI_VENDOR_ID_ADVANTECH, - this_board->device_id, pcidev))) { - /* Found matching vendor/device. */ - if (opt_bus || opt_slot) { - /* Check bus/slot. */ - if (opt_bus != pcidev->bus->number - || opt_slot != PCI_SLOT(pcidev->devfn)) - continue; /* no match */ + struct pci_dev *pcidev = NULL; + int bus = it->options[0]; + int slot = it->options[1]; + + for_each_pci_dev(pcidev) { + if (bus || slot) { + if (bus != pcidev->bus->number || + slot != PCI_SLOT(pcidev->devfn)) + continue; } + if (pcidev->vendor != PCI_VENDOR_ID_ADVANTECH) + continue; /* * Look for device that isn't in use. * Enable PCI device and request regions. */ - if (comedi_pci_enable(pcidev, "adv_pci1723")) { - errstr = - "failed to enable PCI device and request regions!"; + if (comedi_pci_enable(pcidev, "adv_pci1723")) continue; - } - break; - } - - if (!pcidev) { - if (opt_bus || opt_slot) { - printk(KERN_ERR " - Card at b:s %d:%d %s\n", - opt_bus, opt_slot, errstr); - } else { - printk(KERN_ERR " - Card %s\n", errstr); - } - return NULL; + return pcidev; } - - pci_bus = pcidev->bus->number; - pci_slot = PCI_SLOT(pcidev->devfn); - pci_func = PCI_FUNC(pcidev->devfn); - iobase = pci_resource_start(pcidev, 2); - - printk(KERN_ERR ", b:s:f=%d:%d:%d, io=0x%4x", - pci_bus, pci_slot, pci_func, iobase); - - return pcidev; + dev_err(dev->class_dev, + "No supported board found! (req. bus %d, slot %d)\n", + bus, slot); + return NULL; } static int pci1723_attach(struct comedi_device *dev, -- cgit v0.10.2 From cc04c8a5fc82bd284f7f791869a7f9c0bfb528b5 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:30:48 -0700 Subject: staging: comedi: adv_pci1723: move comedi_pci_enable() into the attach Use pci_is_enabled() in the "find pci device" function to determine if the found pci device is not in use and move the comedi_pci_enable() call into the attach. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adv_pci1723.c b/drivers/staging/comedi/drivers/adv_pci1723.c index f561a2a..e971fa6 100644 --- a/drivers/staging/comedi/drivers/adv_pci1723.c +++ b/drivers/staging/comedi/drivers/adv_pci1723.c @@ -302,11 +302,7 @@ static struct pci_dev *pci1723_find_pci_dev(struct comedi_device *dev, } if (pcidev->vendor != PCI_VENDOR_ID_ADVANTECH) continue; - /* - * Look for device that isn't in use. - * Enable PCI device and request regions. - */ - if (comedi_pci_enable(pcidev, "adv_pci1723")) + if (pci_is_enabled(pcidev)) continue; return pcidev; } @@ -335,6 +331,10 @@ static int pci1723_attach(struct comedi_device *dev, if (!devpriv->pcidev) return -EIO; + ret = comedi_pci_enable(devpriv->pcidev, "adv_pci1723"); + if (ret) + return ret; + dev->iobase = pci_resource_start(devpriv->pcidev, 2); dev->board_name = this_board->name; -- cgit v0.10.2 From dbe85f1757f1cb6a8ce206a38a855fb7b60ca159 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:31:06 -0700 Subject: staging: comedi: adv_pci1723: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adv_pci1723.c b/drivers/staging/comedi/drivers/adv_pci1723.c index e971fa6..da5ee69 100644 --- a/drivers/staging/comedi/drivers/adv_pci1723.c +++ b/drivers/staging/comedi/drivers/adv_pci1723.c @@ -152,7 +152,6 @@ static const struct pci1723_board boardtypes[] = { struct pci1723_private { int valid; /* card is usable; */ - struct pci_dev *pcidev; unsigned char da_range[8]; /* D/A output range for each channel */ short ao_data[8]; /* data output buffer */ @@ -315,6 +314,7 @@ static struct pci_dev *pci1723_find_pci_dev(struct comedi_device *dev, static int pci1723_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + struct pci_dev *pcidev; struct comedi_subdevice *s; int ret, subdev, n_subdevices; @@ -327,15 +327,16 @@ static int pci1723_attach(struct comedi_device *dev, return -ENOMEM; } - devpriv->pcidev = pci1723_find_pci_dev(dev, it); - if (!devpriv->pcidev) + pcidev = pci1723_find_pci_dev(dev, it); + if (!pcidev) return -EIO; + comedi_set_hw_dev(dev, &pcidev->dev); - ret = comedi_pci_enable(devpriv->pcidev, "adv_pci1723"); + ret = comedi_pci_enable(pcidev, "adv_pci1723"); if (ret) return ret; - dev->iobase = pci_resource_start(devpriv->pcidev, 2); + dev->iobase = pci_resource_start(pcidev, 2); dev->board_name = this_board->name; @@ -410,14 +411,16 @@ static int pci1723_attach(struct comedi_device *dev, static void pci1723_detach(struct comedi_device *dev) { + struct pci_dev *pcidev = comedi_to_pci_dev(dev); + if (dev->private) { if (devpriv->valid) pci1723_reset(dev); - if (devpriv->pcidev) { - if (dev->iobase) - comedi_pci_disable(devpriv->pcidev); - pci_dev_put(devpriv->pcidev); - } + } + if (pcidev) { + if (dev->iobase) + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); } } -- cgit v0.10.2 From 96554c81d512d171b2e3b9dd3769bed8280ded2f Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:31:26 -0700 Subject: staging: comedi: adv_pci1710: factor out the "find pci device" code Factor the "find pci device" code out of the attach function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 0ed1ff9..0823a36 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -1333,29 +1333,21 @@ static int pci1710_reset(struct comedi_device *dev) DPRINTK("adv_pci1710 EDBG: END: pci1710_reset(...)\n"); } -static int pci1710_attach(struct comedi_device *dev, - struct comedi_devconfig *it) +static struct pci_dev *pci1710_find_pci_dev(struct comedi_device *dev, + struct comedi_devconfig *it) { - struct comedi_subdevice *s; - int ret, subdev, n_subdevices; - unsigned int irq; - unsigned long iobase; struct pci_dev *pcidev; int opt_bus, opt_slot; const char *errstr; unsigned char pci_bus, pci_slot, pci_func; int i; int board_index; - - dev_info(dev->class_dev, DRV_NAME ": attach\n"); + unsigned int irq; + unsigned long iobase; opt_bus = it->options[0]; opt_slot = it->options[1]; - ret = alloc_private(dev, sizeof(struct pci1710_private)); - if (ret < 0) - return -ENOMEM; - /* Look for matching PCI device */ errstr = "not found!"; pcidev = NULL; @@ -1404,7 +1396,7 @@ static int pci1710_attach(struct comedi_device *dev, } else { dev_err(dev->class_dev, "- Card %s\n", errstr); } - return -EIO; + return NULL; } pci_bus = pcidev->bus->number; @@ -1416,10 +1408,30 @@ static int pci1710_attach(struct comedi_device *dev, dev_dbg(dev->class_dev, "b:s:f=%d:%d:%d, io=0x%4lx\n", pci_bus, pci_slot, pci_func, iobase); - dev->iobase = iobase; + return pcidev; +} + +static int pci1710_attach(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + struct comedi_subdevice *s; + int ret, subdev, n_subdevices; + unsigned int irq; + + dev_info(dev->class_dev, DRV_NAME ": attach\n"); + + ret = alloc_private(dev, sizeof(struct pci1710_private)); + if (ret < 0) + return -ENOMEM; + + devpriv->pcidev = pci1710_find_pci_dev(dev, it); + if (!devpriv->pcidev) + return -EIO; + + dev->iobase = pci_resource_start(devpriv->pcidev, 2); + irq = devpriv->pcidev->irq; dev->board_name = this_board->name; - devpriv->pcidev = pcidev; n_subdevices = 0; if (this_board->n_aichan) -- cgit v0.10.2 From 5aa53d5f2e9cf38112b8087ead926fcaacaa5abe Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:31:43 -0700 Subject: staging: comedi: adv_pci1710: cleanup "find pci device" code Use for_each_pci_dev() instead of open-coding the loop using pci_get_device(). Drop the printk error messages. They just add noise. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 0823a36..5eecf6b 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -1336,24 +1336,21 @@ static int pci1710_reset(struct comedi_device *dev) static struct pci_dev *pci1710_find_pci_dev(struct comedi_device *dev, struct comedi_devconfig *it) { - struct pci_dev *pcidev; - int opt_bus, opt_slot; - const char *errstr; - unsigned char pci_bus, pci_slot, pci_func; + struct pci_dev *pcidev = NULL; + int bus = it->options[0]; + int slot = it->options[1]; + int board_index = this_board - boardtypes; int i; - int board_index; - unsigned int irq; - unsigned long iobase; - opt_bus = it->options[0]; - opt_slot = it->options[1]; + for_each_pci_dev(pcidev) { + if (bus || slot) { + if (bus != pcidev->bus->number || + slot != PCI_SLOT(pcidev->devfn)) + continue; + } + if (pcidev->vendor != PCI_VENDOR_ID_ADVANTECH) + continue; - /* Look for matching PCI device */ - errstr = "not found!"; - pcidev = NULL; - board_index = this_board - boardtypes; - while (NULL != (pcidev = pci_get_device(PCI_VENDOR_ID_ADVANTECH, - PCI_ANY_ID, pcidev))) { if (strcmp(this_board->name, DRV_NAME) == 0) { for (i = 0; i < ARRAY_SIZE(boardtypes); ++i) { if (pcidev->device == boardtypes[i].device_id) { @@ -1368,47 +1365,21 @@ static struct pci_dev *pci1710_find_pci_dev(struct comedi_device *dev, continue; } - /* Found matching vendor/device. */ - if (opt_bus || opt_slot) { - /* Check bus/slot. */ - if (opt_bus != pcidev->bus->number - || opt_slot != PCI_SLOT(pcidev->devfn)) - continue; /* no match */ - } /* * Look for device that isn't in use. * Enable PCI device and request regions. */ if (comedi_pci_enable(pcidev, DRV_NAME)) { - errstr = - "failed to enable PCI device and request regions!"; continue; } /* fixup board_ptr in case we were using the dummy entry with the driver name */ dev->board_ptr = &boardtypes[board_index]; - break; + return pcidev; } - - if (!pcidev) { - if (opt_bus || opt_slot) { - dev_err(dev->class_dev, "- Card at b:s %d:%d %s\n", - opt_bus, opt_slot, errstr); - } else { - dev_err(dev->class_dev, "- Card %s\n", errstr); - } - return NULL; - } - - pci_bus = pcidev->bus->number; - pci_slot = PCI_SLOT(pcidev->devfn); - pci_func = PCI_FUNC(pcidev->devfn); - irq = pcidev->irq; - iobase = pci_resource_start(pcidev, 2); - - dev_dbg(dev->class_dev, "b:s:f=%d:%d:%d, io=0x%4lx\n", - pci_bus, pci_slot, pci_func, iobase); - - return pcidev; + dev_err(dev->class_dev, + "No supported board found! (req. bus %d, slot %d)\n", + bus, slot); + return NULL; } static int pci1710_attach(struct comedi_device *dev, -- cgit v0.10.2 From 5f5d1b9ac13d44f370a3f7ebfc624b7f6cca4c19 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:32:01 -0700 Subject: staging: comedi: adv_pci1710: move comedi_pci_enable() into the attach Use pci_is_enabled() in the "find pci device" function to determine if the found pci device is not in use and move the comedi_pci_enable() call into the attach. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 5eecf6b..33dd1db 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -1350,6 +1350,8 @@ static struct pci_dev *pci1710_find_pci_dev(struct comedi_device *dev, } if (pcidev->vendor != PCI_VENDOR_ID_ADVANTECH) continue; + if (pci_is_enabled(pcidev)) + continue; if (strcmp(this_board->name, DRV_NAME) == 0) { for (i = 0; i < ARRAY_SIZE(boardtypes); ++i) { @@ -1364,15 +1366,6 @@ static struct pci_dev *pci1710_find_pci_dev(struct comedi_device *dev, if (pcidev->device != boardtypes[board_index].device_id) continue; } - - /* - * Look for device that isn't in use. - * Enable PCI device and request regions. - */ - if (comedi_pci_enable(pcidev, DRV_NAME)) { - continue; - } - /* fixup board_ptr in case we were using the dummy entry with the driver name */ dev->board_ptr = &boardtypes[board_index]; return pcidev; } @@ -1399,6 +1392,10 @@ static int pci1710_attach(struct comedi_device *dev, if (!devpriv->pcidev) return -EIO; + ret = comedi_pci_enable(devpriv->pcidev, DRV_NAME); + if (ret) + return ret; + dev->iobase = pci_resource_start(devpriv->pcidev, 2); irq = devpriv->pcidev->irq; -- cgit v0.10.2 From ad37c85c44bd9b40028c2338c7e1a7e9be3dbd70 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:33:06 -0700 Subject: staging: comedi: adv_pci1710: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 33dd1db..3198660 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -248,7 +248,6 @@ static const struct boardtype boardtypes[] = { }; struct pci1710_private { - struct pci_dev *pcidev; /* ptr to PCI device */ char valid; /* card is usable */ char neverending_ai; /* we do unlimited AI */ unsigned int CntrlReg; /* Control register */ @@ -1378,6 +1377,7 @@ static struct pci_dev *pci1710_find_pci_dev(struct comedi_device *dev, static int pci1710_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + struct pci_dev *pcidev; struct comedi_subdevice *s; int ret, subdev, n_subdevices; unsigned int irq; @@ -1388,16 +1388,17 @@ static int pci1710_attach(struct comedi_device *dev, if (ret < 0) return -ENOMEM; - devpriv->pcidev = pci1710_find_pci_dev(dev, it); - if (!devpriv->pcidev) + pcidev = pci1710_find_pci_dev(dev, it); + if (!pcidev) return -EIO; + comedi_set_hw_dev(dev, &pcidev->dev); - ret = comedi_pci_enable(devpriv->pcidev, DRV_NAME); + ret = comedi_pci_enable(pcidev, DRV_NAME); if (ret) return ret; - dev->iobase = pci_resource_start(devpriv->pcidev, 2); - irq = devpriv->pcidev->irq; + dev->iobase = pci_resource_start(pcidev, 2); + irq = pcidev->irq; dev->board_name = this_board->name; @@ -1532,16 +1533,18 @@ static int pci1710_attach(struct comedi_device *dev, static void pci1710_detach(struct comedi_device *dev) { + struct pci_dev *pcidev = comedi_to_pci_dev(dev); + if (dev->private) { if (devpriv->valid) pci1710_reset(dev); if (dev->irq) free_irq(dev->irq, dev); - if (devpriv->pcidev) { - if (dev->iobase) - comedi_pci_disable(devpriv->pcidev); - pci_dev_put(devpriv->pcidev); - } + } + if (pcidev) { + if (dev->iobase) + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); } } -- cgit v0.10.2 From 54b303c45d43d5b4ca69de843fb2d1a7160578f9 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:33:27 -0700 Subject: staging: comedi: adv_pci_dio: factor out the "find pci device" code Factor the "find pci device" code out of the attach function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index ad653a5..e1f52c6 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -1077,23 +1077,16 @@ static int CheckAndAllocCard(struct comedi_device *dev, pci_priv = devpriv; } - devpriv->pcidev = pcidev; - return 1; } -static int pci_dio_attach(struct comedi_device *dev, - struct comedi_devconfig *it) +static struct pci_dev *pci_dio_find_pci_dev(struct comedi_device *dev, + struct comedi_devconfig *it) { - struct comedi_subdevice *s; - int ret, subdev, n_subdevices, i, j; - unsigned long iobase; struct pci_dev *pcidev = NULL; - - - ret = alloc_private(dev, sizeof(struct pci_dio_private)); - if (ret < 0) - return -ENOMEM; + unsigned long iobase; + int i; + int ret; for_each_pci_dev(pcidev) { /* loop through cards supported by this driver */ @@ -1123,20 +1116,37 @@ static int pci_dio_attach(struct comedi_device *dev, if (!dev->board_ptr) { dev_err(dev->class_dev, "Error: Requested type of the card was not found!\n"); - return -EIO; + return NULL; } + iobase = pci_resource_start(devpriv->pcidev, this_board->main_pci_region); + dev_dbg(dev->class_dev, "b:s:f=%d:%d:%d, io=0x%4lx\n", + pcidev->bus->number, PCI_SLOT(pcidev->devfn), + PCI_FUNC(pcidev->devfn), iobase); + return pcidev; +} - if (comedi_pci_enable(pcidev, dev->driver->driver_name)) { +static int pci_dio_attach(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + struct comedi_subdevice *s; + int ret, subdev, n_subdevices, i, j; + + ret = alloc_private(dev, sizeof(struct pci_dio_private)); + if (ret < 0) + return -ENOMEM; + + devpriv->pcidev = pci_dio_find_pci_dev(dev, it); + if (!devpriv->pcidev) + return -EIO; + + if (comedi_pci_enable(devpriv->pcidev, dev->driver->driver_name)) { dev_err(dev->class_dev, "Error: Can't enable PCI device and request regions!\n"); return -EIO; } - iobase = pci_resource_start(pcidev, this_board->main_pci_region); - dev_dbg(dev->class_dev, "b:s:f=%d:%d:%d, io=0x%4lx\n", - pcidev->bus->number, PCI_SLOT(pcidev->devfn), - PCI_FUNC(pcidev->devfn), iobase); - dev->iobase = iobase; + dev->iobase = pci_resource_start(devpriv->pcidev, + this_board->main_pci_region); dev->board_name = this_board->name; if (this_board->cardtype == TYPE_PCI1760) { -- cgit v0.10.2 From e10355b946a5b685ca16be7d7ba31e9571233bee Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:34:15 -0700 Subject: staging: comedi: adv_pci_dio: remove CheckAndAllocCard() This driver creates a linked list of all the pci devices in the system while it's looking for a match. It's only use is to determine if a device is "free" to use. The pci_is_enabled() helper can give us the same information. Use that instead and remove the linked list. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index e1f52c6..ab92169 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -382,8 +382,6 @@ static const struct dio_boardtype boardtypes[] = { }; struct pci_dio_private { - struct pci_dio_private *prev; /* previous private struct */ - struct pci_dio_private *next; /* next private struct */ struct pci_dev *pcidev; /* pointer to board's pci_dev */ char valid; /* card is usable */ char GlobalIrqEnabled; /* 1= any IRQ source is enabled */ @@ -404,8 +402,6 @@ struct pci_dio_private { unsigned short IDIFiltrHigh[8]; /* IDI's filter value high signal */ }; -static struct pci_dio_private *pci_priv; /* list of allocated cards */ - #define devpriv ((struct pci_dio_private *)dev->private) #define this_board ((const struct dio_boardtype *)dev->board_ptr) @@ -1055,38 +1051,12 @@ static int pci_dio_add_8254(struct comedi_device *dev, return 0; } -/* -============================================================================== -*/ -static int CheckAndAllocCard(struct comedi_device *dev, - struct comedi_devconfig *it, - struct pci_dev *pcidev) -{ - struct pci_dio_private *pr, *prev; - - for (pr = pci_priv, prev = NULL; pr != NULL; prev = pr, pr = pr->next) { - if (pr->pcidev == pcidev) - return 0; /* this card is used, look for another */ - - } - - if (prev) { - devpriv->prev = prev; - prev->next = devpriv; - } else { - pci_priv = devpriv; - } - - return 1; -} - static struct pci_dev *pci_dio_find_pci_dev(struct comedi_device *dev, struct comedi_devconfig *it) { struct pci_dev *pcidev = NULL; unsigned long iobase; int i; - int ret; for_each_pci_dev(pcidev) { /* loop through cards supported by this driver */ @@ -1103,8 +1073,7 @@ static struct pci_dev *pci_dio_find_pci_dev(struct comedi_device *dev, continue; } } - ret = CheckAndAllocCard(dev, it, pcidev); - if (ret != 1) + if (pci_is_enabled(pcidev)) continue; dev->board_ptr = boardtypes + i; break; @@ -1260,12 +1229,6 @@ static void pci_dio_detach(struct comedi_device *dev) comedi_pci_disable(devpriv->pcidev); pci_dev_put(devpriv->pcidev); } - if (devpriv->prev) - devpriv->prev->next = devpriv->next; - else - pci_priv = devpriv->next; - if (devpriv->next) - devpriv->next->prev = devpriv->prev; } } -- cgit v0.10.2 From 096de334d9209daff1595c056f89695f6ad35d6c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:34:51 -0700 Subject: staging: comedi: adv_pci_dio: cleanup "find pci device" code Add a couple local variables to make the tests more concise. Reorder the tests to make the for() loop checking for a matching boardtype quicker. Drop the dev_dbg message for a match. It's just add noise. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index ab92169..c805208 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -1055,43 +1055,31 @@ static struct pci_dev *pci_dio_find_pci_dev(struct comedi_device *dev, struct comedi_devconfig *it) { struct pci_dev *pcidev = NULL; - unsigned long iobase; + int bus = it->options[0]; + int slot = it->options[1]; int i; for_each_pci_dev(pcidev) { - /* loop through cards supported by this driver */ + if (bus || slot) { + if (bus != pcidev->bus->number || + slot != PCI_SLOT(pcidev->devfn)) + continue; + } + if (pci_is_enabled(pcidev)) + continue; for (i = 0; i < ARRAY_SIZE(boardtypes); ++i) { if (boardtypes[i].vendor_id != pcidev->vendor) continue; if (boardtypes[i].device_id != pcidev->device) continue; - /* was a particular bus/slot requested? */ - if (it->options[0] || it->options[1]) { - /* are we on the wrong bus/slot? */ - if (pcidev->bus->number != it->options[0] || - PCI_SLOT(pcidev->devfn) != it->options[1]) { - continue; - } - } - if (pci_is_enabled(pcidev)) - continue; dev->board_ptr = boardtypes + i; - break; + return pcidev; } - if (dev->board_ptr) - break; - } - - if (!dev->board_ptr) { - dev_err(dev->class_dev, - "Error: Requested type of the card was not found!\n"); - return NULL; } - iobase = pci_resource_start(devpriv->pcidev, this_board->main_pci_region); - dev_dbg(dev->class_dev, "b:s:f=%d:%d:%d, io=0x%4lx\n", - pcidev->bus->number, PCI_SLOT(pcidev->devfn), - PCI_FUNC(pcidev->devfn), iobase); - return pcidev; + dev_err(dev->class_dev, + "No supported board found! (req. bus %d, slot %d)\n", + bus, slot); + return NULL; } static int pci_dio_attach(struct comedi_device *dev, -- cgit v0.10.2 From 983ff48833061b71e37d15b618198ef65b242ca0 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:35:13 -0700 Subject: staging: comedi: adv_pci_dio: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index c805208..97f06dc 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -382,7 +382,6 @@ static const struct dio_boardtype boardtypes[] = { }; struct pci_dio_private { - struct pci_dev *pcidev; /* pointer to board's pci_dev */ char valid; /* card is usable */ char GlobalIrqEnabled; /* 1= any IRQ source is enabled */ /* PCI-1760 specific data */ @@ -1085,6 +1084,7 @@ static struct pci_dev *pci_dio_find_pci_dev(struct comedi_device *dev, static int pci_dio_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + struct pci_dev *pcidev; struct comedi_subdevice *s; int ret, subdev, n_subdevices, i, j; @@ -1092,18 +1092,18 @@ static int pci_dio_attach(struct comedi_device *dev, if (ret < 0) return -ENOMEM; - devpriv->pcidev = pci_dio_find_pci_dev(dev, it); - if (!devpriv->pcidev) + pcidev = pci_dio_find_pci_dev(dev, it); + if (!pcidev) return -EIO; + comedi_set_hw_dev(dev, &pcidev->dev); - if (comedi_pci_enable(devpriv->pcidev, dev->driver->driver_name)) { + if (comedi_pci_enable(pcidev, dev->driver->driver_name)) { dev_err(dev->class_dev, "Error: Can't enable PCI device and request regions!\n"); return -EIO; } - dev->iobase = pci_resource_start(devpriv->pcidev, - this_board->main_pci_region); + dev->iobase = pci_resource_start(pcidev, this_board->main_pci_region); dev->board_name = this_board->name; if (this_board->cardtype == TYPE_PCI1760) { @@ -1180,6 +1180,7 @@ static int pci_dio_attach(struct comedi_device *dev, static void pci_dio_detach(struct comedi_device *dev) { + struct pci_dev *pcidev = comedi_to_pci_dev(dev); int i, j; struct comedi_subdevice *s; int subdev; @@ -1212,11 +1213,11 @@ static void pci_dio_detach(struct comedi_device *dev) s = dev->subdevices + i; s->private = NULL; } - if (devpriv->pcidev) { - if (dev->iobase) - comedi_pci_disable(devpriv->pcidev); - pci_dev_put(devpriv->pcidev); - } + } + if (pcidev) { + if (dev->iobase) + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); } } -- cgit v0.10.2 From ba36b9ba768b5d617f0729eeebef16dc8416c750 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:35:38 -0700 Subject: staging: comedi: cb_pcidas: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 301444e..2b6a637 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -343,7 +343,6 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { }; struct cb_pcidas_private { - struct pci_dev *pci_dev; /* base addresses */ unsigned long s5933_config; unsigned long control_status; @@ -1545,6 +1544,7 @@ static int cb_pcidas_attach(struct comedi_device *dev, { const struct cb_pcidas_board *thisboard; struct cb_pcidas_private *devpriv; + struct pci_dev *pcidev; struct comedi_subdevice *s; int i; int ret; @@ -1553,35 +1553,36 @@ static int cb_pcidas_attach(struct comedi_device *dev, return -ENOMEM; devpriv = dev->private; - devpriv->pci_dev = cb_pcidas_find_pci_device(dev, it); - if (!devpriv->pci_dev) + pcidev = cb_pcidas_find_pci_device(dev, it); + if (!pcidev) return -EIO; + comedi_set_hw_dev(dev, &pcidev->dev); thisboard = comedi_board(dev); - if (comedi_pci_enable(devpriv->pci_dev, dev->driver->driver_name)) { + if (comedi_pci_enable(pcidev, dev->driver->driver_name)) { dev_err(dev->class_dev, "Failed to enable PCI device and request regions\n"); return -EIO; } - devpriv->s5933_config = pci_resource_start(devpriv->pci_dev, 0); - devpriv->control_status = pci_resource_start(devpriv->pci_dev, 1); - devpriv->adc_fifo = pci_resource_start(devpriv->pci_dev, 2); - devpriv->pacer_counter_dio = pci_resource_start(devpriv->pci_dev, 3); + devpriv->s5933_config = pci_resource_start(pcidev, 0); + devpriv->control_status = pci_resource_start(pcidev, 1); + devpriv->adc_fifo = pci_resource_start(pcidev, 2); + devpriv->pacer_counter_dio = pci_resource_start(pcidev, 3); if (thisboard->ao_nchan) - devpriv->ao_registers = pci_resource_start(devpriv->pci_dev, 4); + devpriv->ao_registers = pci_resource_start(pcidev, 4); /* disable and clear interrupts on amcc s5933 */ outl(INTCSR_INBOX_INTR_STATUS, devpriv->s5933_config + AMCC_OP_REG_INTCSR); - if (request_irq(devpriv->pci_dev->irq, cb_pcidas_interrupt, + if (request_irq(pcidev->irq, cb_pcidas_interrupt, IRQF_SHARED, dev->driver->driver_name, dev)) { dev_dbg(dev->class_dev, "unable to allocate irq %d\n", - devpriv->pci_dev->irq); + pcidev->irq); return -EINVAL; } - dev->irq = devpriv->pci_dev->irq; + dev->irq = pcidev->irq; dev->board_name = thisboard->name; @@ -1703,6 +1704,7 @@ static int cb_pcidas_attach(struct comedi_device *dev, static void cb_pcidas_detach(struct comedi_device *dev) { struct cb_pcidas_private *devpriv = dev->private; + struct pci_dev *pcidev = comedi_to_pci_dev(dev); if (devpriv) { if (devpriv->s5933_config) { @@ -1714,10 +1716,10 @@ static void cb_pcidas_detach(struct comedi_device *dev) free_irq(dev->irq, dev); if (dev->subdevices) subdev_8255_cleanup(dev, dev->subdevices + 2); - if (devpriv && devpriv->pci_dev) { + if (pcidev) { if (devpriv->s5933_config) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); } } -- cgit v0.10.2 From 41f7ea34f53ea432f77129b81db6d880d4cfa648 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:36:08 -0700 Subject: staging: comedi: cb_pcidio: factor out the "find pci device" code Factor the "find pci device" code out of the attach function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidio.c b/drivers/staging/comedi/drivers/cb_pcidio.c index 9160859..5f4d0a5 100644 --- a/drivers/staging/comedi/drivers/cb_pcidio.c +++ b/drivers/staging/comedi/drivers/cb_pcidio.c @@ -111,27 +111,11 @@ struct pcidio_private { */ #define devpriv ((struct pcidio_private *)dev->private) -static int pcidio_attach(struct comedi_device *dev, struct comedi_devconfig *it) +static struct pci_dev *pcidio_find_pci_dev(struct comedi_device *dev, + struct comedi_devconfig *it) { struct pci_dev *pcidev = NULL; int index; - int i; - int ret; - -/* - * Allocate the private structure area. alloc_private() is a - * convenient macro defined in comedidev.h. - */ - if (alloc_private(dev, sizeof(struct pcidio_private)) < 0) - return -ENOMEM; -/* - * If you can probe the device to determine what device in a series - * it is, this is the place to do it. Otherwise, dev->board_ptr - * should already be initialized. - */ -/* - * Probe the device to determine what device in the series it is. - */ for_each_pci_dev(pcidev) { /* is it not a computer boards card? */ @@ -151,15 +135,32 @@ static int pcidio_attach(struct comedi_device *dev, struct comedi_devconfig *it) } } dev->board_ptr = pcidio_boards + index; - goto found; + dev_dbg(dev->class_dev, "Found %s on bus %i, slot %i\n", + thisboard->name, devpriv->pci_dev->bus->number, + PCI_SLOT(devpriv->pci_dev->devfn)); + return pcidev; } } - dev_err(dev->class_dev, "No supported ComputerBoards/MeasurementComputing card found on requested position\n"); - return -EIO; + return NULL; +} + +static int pcidio_attach(struct comedi_device *dev, struct comedi_devconfig *it) +{ + int i; + int ret; + +/* + * Allocate the private structure area. alloc_private() is a + * convenient macro defined in comedidev.h. + */ + if (alloc_private(dev, sizeof(struct pcidio_private)) < 0) + return -ENOMEM; -found: + devpriv->pci_dev = pcidio_find_pci_dev(dev, it); + if (!devpriv->pci_dev) + return -EIO; /* * Initialize dev->board_name. Note that we can use the "thisboard" @@ -167,17 +168,12 @@ found: */ dev->board_name = thisboard->name; - devpriv->pci_dev = pcidev; - dev_dbg(dev->class_dev, "Found %s on bus %i, slot %i\n", - thisboard->name, devpriv->pci_dev->bus->number, - PCI_SLOT(devpriv->pci_dev->devfn)); - if (comedi_pci_enable(pcidev, thisboard->name)) + if (comedi_pci_enable(devpriv->pci_dev, thisboard->name)) return -EIO; devpriv->dio_reg_base = - pci_resource_start(devpriv->pci_dev, - pcidio_boards[index].dioregs_badrindex); + pci_resource_start(devpriv->pci_dev, thisboard->dioregs_badrindex); ret = comedi_alloc_subdevices(dev, thisboard->n_8255); if (ret) -- cgit v0.10.2 From 2329a10c3f985cbe7bba6ff3a053837f71a1ea40 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:36:30 -0700 Subject: staging: comedi: cb_pcidio: cleanup "find pci device" code Add a couple local variables to make the tests more concise. Reorder the tests to make the for() loop checking for a matching boardtype quicker. Drop the dev_dbg for a match. It's just add noise. Reword the dev_err when no match is found. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidio.c b/drivers/staging/comedi/drivers/cb_pcidio.c index 5f4d0a5..5527b4b 100644 --- a/drivers/staging/comedi/drivers/cb_pcidio.c +++ b/drivers/staging/comedi/drivers/cb_pcidio.c @@ -115,34 +115,29 @@ static struct pci_dev *pcidio_find_pci_dev(struct comedi_device *dev, struct comedi_devconfig *it) { struct pci_dev *pcidev = NULL; - int index; + int bus = it->options[0]; + int slot = it->options[1]; + int i; for_each_pci_dev(pcidev) { - /* is it not a computer boards card? */ + if (bus || slot) { + if (bus != pcidev->bus->number || + slot != PCI_SLOT(pcidev->devfn)) + continue; + } if (pcidev->vendor != PCI_VENDOR_ID_CB) continue; - /* loop through cards supported by this driver */ - for (index = 0; index < ARRAY_SIZE(pcidio_boards); index++) { - if (pcidio_boards[index].dev_id != pcidev->device) + for (i = 0; i < ARRAY_SIZE(pcidio_boards); i++) { + if (pcidio_boards[i].dev_id != pcidev->device) continue; - /* was a particular bus/slot requested? */ - if (it->options[0] || it->options[1]) { - /* are we on the wrong bus/slot? */ - if (pcidev->bus->number != it->options[0] || - PCI_SLOT(pcidev->devfn) != it->options[1]) { - continue; - } - } - dev->board_ptr = pcidio_boards + index; - dev_dbg(dev->class_dev, "Found %s on bus %i, slot %i\n", - thisboard->name, devpriv->pci_dev->bus->number, - PCI_SLOT(devpriv->pci_dev->devfn)); + dev->board_ptr = pcidio_boards + i; return pcidev; } } dev_err(dev->class_dev, - "No supported ComputerBoards/MeasurementComputing card found on requested position\n"); + "No supported board found! (req. bus %d, slot %d)\n", + bus, slot); return NULL; } -- cgit v0.10.2 From c2eb50bbdb4400fae3d462237470c22e0f98545b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:37:05 -0700 Subject: staging: comedi: cb_pcidio: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidio.c b/drivers/staging/comedi/drivers/cb_pcidio.c index 5527b4b..11c7502 100644 --- a/drivers/staging/comedi/drivers/cb_pcidio.c +++ b/drivers/staging/comedi/drivers/cb_pcidio.c @@ -96,9 +96,6 @@ static const struct pcidio_board pcidio_boards[] = { struct pcidio_private { int data; /* currently unused */ - /* would be useful for a PCI device */ - struct pci_dev *pci_dev; - /* used for DO readback, currently unused */ unsigned int do_readback[4]; /* up to 4 unsigned int suffice to hold 96 bits for PCI-DIO96 */ @@ -143,6 +140,7 @@ static struct pci_dev *pcidio_find_pci_dev(struct comedi_device *dev, static int pcidio_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + struct pci_dev *pcidev; int i; int ret; @@ -153,9 +151,10 @@ static int pcidio_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (alloc_private(dev, sizeof(struct pcidio_private)) < 0) return -ENOMEM; - devpriv->pci_dev = pcidio_find_pci_dev(dev, it); - if (!devpriv->pci_dev) + pcidev = pcidio_find_pci_dev(dev, it); + if (!pcidev) return -EIO; + comedi_set_hw_dev(dev, &pcidev->dev); /* * Initialize dev->board_name. Note that we can use the "thisboard" @@ -163,12 +162,12 @@ static int pcidio_attach(struct comedi_device *dev, struct comedi_devconfig *it) */ dev->board_name = thisboard->name; - if (comedi_pci_enable(devpriv->pci_dev, thisboard->name)) + if (comedi_pci_enable(pcidev, thisboard->name)) return -EIO; devpriv->dio_reg_base = - pci_resource_start(devpriv->pci_dev, thisboard->dioregs_badrindex); + pci_resource_start(pcidev, thisboard->dioregs_badrindex); ret = comedi_alloc_subdevices(dev, thisboard->n_8255); if (ret) @@ -186,12 +185,12 @@ static int pcidio_attach(struct comedi_device *dev, struct comedi_devconfig *it) static void pcidio_detach(struct comedi_device *dev) { - if (devpriv) { - if (devpriv->pci_dev) { - if (devpriv->dio_reg_base) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); - } + struct pci_dev *pcidev = comedi_to_pci_dev(dev); + + if (pcidev) { + if (devpriv->dio_reg_base) + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); } if (dev->subdevices) { int i; -- cgit v0.10.2 From dd90576838a6f9eb51ffe11796073bdd733847df Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:37:31 -0700 Subject: staging: comedi: amplc_dio200: cleanup "find pci device" code For aesthetic reasons, rename the function and pass the comedi_devconfig struct instead of pre-parsing out the bus/slot information. Use for_each_pci_dev() instead of open-coding the loop using pci_get_device(). Consolidate the dev_err messages when a pci device is not found. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index 55f3050..ca9d4f2 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -469,23 +469,23 @@ dio200_find_pci_board(struct pci_dev *pci_dev) * This function looks for a PCI device matching the requested board name, * bus and slot. */ -static struct pci_dev * -dio200_find_pci(struct comedi_device *dev, int bus, int slot) +static struct pci_dev *dio200_find_pci_dev(struct comedi_device *dev, + struct comedi_devconfig *it) { const struct dio200_board *thisboard = comedi_board(dev); struct pci_dev *pci_dev = NULL; + int bus = it->options[0]; + int slot = it->options[1]; - /* Look for matching PCI device. */ - for (pci_dev = pci_get_device(PCI_VENDOR_ID_AMPLICON, PCI_ANY_ID, NULL); - pci_dev != NULL; - pci_dev = pci_get_device(PCI_VENDOR_ID_AMPLICON, - PCI_ANY_ID, pci_dev)) { - /* If bus/slot specified, check them. */ + for_each_pci_dev(pci_dev) { if (bus || slot) { - if (bus != pci_dev->bus->number - || slot != PCI_SLOT(pci_dev->devfn)) + if (bus != pci_dev->bus->number || + slot != PCI_SLOT(pci_dev->devfn)) continue; } + if (pci_dev->vendor != PCI_VENDOR_ID_AMPLICON) + continue; + if (thisboard->model == anypci_model) { /* Wildcard board matches any supported PCI board. */ const struct dio200_board *foundboard; @@ -495,25 +495,16 @@ dio200_find_pci(struct comedi_device *dev, int bus, int slot) continue; /* Replace wildcard board_ptr. */ dev->board_ptr = foundboard; - thisboard = comedi_board(dev); } else { /* Match specific model name. */ if (pci_dev->device != thisboard->devid) continue; } - - /* Found a match. */ return pci_dev; } - /* No match found. */ - if (bus || slot) { - dev_err(dev->class_dev, - "error! no %s found at pci %02x:%02x!\n", - thisboard->name, bus, slot); - } else { - dev_err(dev->class_dev, "error! no %s found!\n", - thisboard->name); - } + dev_err(dev->class_dev, + "No supported board found! (req. bus %d, slot %d)\n", + bus, slot); return NULL; } @@ -1385,12 +1376,9 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) } else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI) && thisboard->bustype == pci_bustype) { struct pci_dev *pci_dev; - int bus, slot; - bus = it->options[0]; - slot = it->options[1]; - pci_dev = dio200_find_pci(dev, bus, slot); - if (pci_dev == NULL) + pci_dev = dio200_find_pci_dev(dev, it); + if (!pci_dev) return -EIO; return dio200_pci_common_attach(dev, pci_dev); } else { -- cgit v0.10.2 From b5e6df11f4820179573637e05c132b4561da92ce Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:37:50 -0700 Subject: staging: comedi: amplc_dio200: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Since the pci_dev is no longer held in the provate data, we can also cleanup the detach a bit. Remove the IS_ENABLED() tests in the detach. If the pci_dev is non NULL it's a PCI device otherwise it's an ISA device. Using IS_ENABLED() to omit the code paths makes the code a bit confusing and doesn't save much. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index ca9d4f2..6c81e377 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -424,7 +424,6 @@ static const struct dio200_layout_struct dio200_layouts[] = { feel free to suggest moving the variable to the struct comedi_device struct. */ struct dio200_private { - struct pci_dev *pci_dev; /* PCI device */ int intr_sd; }; @@ -1225,7 +1224,7 @@ dio200_subdev_8254_cleanup(struct comedi_device *dev, static void dio200_report_attach(struct comedi_device *dev, unsigned int irq) { const struct dio200_board *thisboard = comedi_board(dev); - struct dio200_private *devpriv = dev->private; + struct pci_dev *pcidev = comedi_to_pci_dev(dev); char tmpbuf[60]; int tmplen; @@ -1236,7 +1235,7 @@ static void dio200_report_attach(struct comedi_device *dev, unsigned int irq) else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI) && thisboard->bustype == pci_bustype) tmplen = scnprintf(tmpbuf, sizeof(tmpbuf), - "(pci %s) ", pci_name(devpriv->pci_dev)); + "(pci %s) ", pci_name(pcidev)); else tmplen = 0; if (irq) @@ -1327,11 +1326,11 @@ static int dio200_common_attach(struct comedi_device *dev, unsigned long iobase, static int dio200_pci_common_attach(struct comedi_device *dev, struct pci_dev *pci_dev) { - struct dio200_private *devpriv = dev->private; unsigned long iobase; int ret; - devpriv->pci_dev = pci_dev; + comedi_set_hw_dev(dev, &pci_dev->dev); + ret = comedi_pci_enable(pci_dev, DIO200_DRIVER_NAME); if (ret < 0) { dev_err(dev->class_dev, @@ -1419,7 +1418,7 @@ static int __devinit dio200_attach_pci(struct comedi_device *dev, static void dio200_detach(struct comedi_device *dev) { const struct dio200_board *thisboard = comedi_board(dev); - struct dio200_private *devpriv = dev->private; + struct pci_dev *pcidev = comedi_to_pci_dev(dev); const struct dio200_layout_struct *layout; unsigned n; @@ -1444,19 +1443,13 @@ static void dio200_detach(struct comedi_device *dev) } } } - if (devpriv) { - if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI) && - thisboard->bustype == pci_bustype) { - if (devpriv->pci_dev) { - if (dev->iobase) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); - } - } else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA) && - thisboard->bustype == isa_bustype) { - if (dev->iobase) - release_region(dev->iobase, DIO200_IO_SIZE); - } + if (pcidev) { + if (dev->iobase) + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); + } else { + if (dev->iobase) + release_region(dev->iobase, DIO200_IO_SIZE); } } -- cgit v0.10.2 From ed7fd225efef11fb8c85ec650288702af69bbe83 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:39:03 -0700 Subject: staging: comedi: amplc_pc236: cleanup "find pci device" code For aesthetic reasons, rename the function and pass the comedi_devconfig struct instead of pre-parsing out the bus/slot information. Use for_each_pci_dev() instead of open-coding the loop using pci_get_device(). Consolidate the dev_err messages when a pci device is not found. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c index 77dae8e..3eee7f3 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236.c +++ b/drivers/staging/comedi/drivers/amplc_pc236.c @@ -155,49 +155,42 @@ static const struct pc236_board *pc236_find_pci_board(struct pci_dev *pci_dev) * This function looks for a PCI device matching the requested board name, * bus and slot. */ -static struct pci_dev * -pc236_find_pci(struct comedi_device *dev, int bus, int slot) +static struct pci_dev *pc236_find_pci_dev(struct comedi_device *dev, + struct comedi_devconfig *it) { const struct pc236_board *thisboard = comedi_board(dev); struct pci_dev *pci_dev = NULL; + int bus = it->options[0]; + int slot = it->options[1]; - /* Look for matching PCI device. */ - for (pci_dev = pci_get_device(PCI_VENDOR_ID_AMPLICON, PCI_ANY_ID, NULL); - pci_dev != NULL; - pci_dev = pci_get_device(PCI_VENDOR_ID_AMPLICON, - PCI_ANY_ID, pci_dev)) { - /* If bus/slot specified, check them. */ + for_each_pci_dev(pci_dev) { if (bus || slot) { - if (bus != pci_dev->bus->number - || slot != PCI_SLOT(pci_dev->devfn)) + if (bus != pci_dev->bus->number || + slot != PCI_SLOT(pci_dev->devfn)) continue; } + if (pci_dev->vendor != PCI_VENDOR_ID_AMPLICON) + continue; + if (thisboard->model == anypci_model) { /* Wildcard board matches any supported PCI board. */ const struct pc236_board *foundboard; + foundboard = pc236_find_pci_board(pci_dev); if (foundboard == NULL) continue; /* Replace wildcard board_ptr. */ - dev->board_ptr = thisboard = foundboard; + dev->board_ptr = foundboard; } else { /* Match specific model name. */ if (pci_dev->device != thisboard->devid) continue; } - - /* Found a match. */ return pci_dev; } - /* No match found. */ - if (bus || slot) { - dev_err(dev->class_dev, - "error! no %s found at pci %02x:%02x!\n", - thisboard->name, bus, slot); - } else { - dev_err(dev->class_dev, "error! no %s found!\n", - thisboard->name); - } + dev_err(dev->class_dev, + "No supported board found! (req. bus %d, slot %d)\n", + bus, slot); return NULL; } @@ -536,12 +529,10 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) return pc236_common_attach(dev, iobase, irq, 0); } else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) && thisboard->bustype == pci_bustype) { - int bus = it->options[0]; - int slot = it->options[1]; struct pci_dev *pci_dev; - pci_dev = pc236_find_pci(dev, bus, slot); - if (pci_dev == NULL) + pci_dev = pc236_find_pci_dev(dev, it); + if (!pci_dev) return -EIO; return pc236_pci_common_attach(dev, pci_dev); } else { -- cgit v0.10.2 From b6d446b5de6139d2a5764c7568012ffa14e2aa6e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:39:24 -0700 Subject: staging: comedi: amplc_pc236: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Since the pci_dev is no longer held in the provate data, we can also cleanup the detach a bit. Remove the IS_ENABLED() tests in the detach. If the pci_dev is non NULL it's a PCI device otherwise it's an ISA device. Using IS_ENABLED() to omit the code paths makes the code a bit confusing and doesn't save much. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c index 3eee7f3..aabba98 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236.c +++ b/drivers/staging/comedi/drivers/amplc_pc236.c @@ -131,8 +131,6 @@ static const struct pc236_board pc236_boards[] = { feel free to suggest moving the variable to the struct comedi_device struct. */ struct pc236_private { - /* PCI device */ - struct pci_dev *pci_dev; unsigned long lcr_iobase; /* PLX PCI9052 config registers in PCIBAR1 */ int enable_irq; }; @@ -412,6 +410,7 @@ static irqreturn_t pc236_interrupt(int irq, void *d) static void pc236_report_attach(struct comedi_device *dev, unsigned int irq) { const struct pc236_board *thisboard = comedi_board(dev); + struct pci_dev *pcidev = comedi_to_pci_dev(dev); char tmpbuf[60]; int tmplen; @@ -421,10 +420,8 @@ static void pc236_report_attach(struct comedi_device *dev, unsigned int irq) "(base %#lx) ", dev->iobase); else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) && thisboard->bustype == pci_bustype) { - struct pc236_private *devpriv = dev->private; - struct pci_dev *pci_dev = devpriv->pci_dev; tmplen = scnprintf(tmpbuf, sizeof(tmpbuf), - "(pci %s) ", pci_name(pci_dev)); + "(pci %s) ", pci_name(pcidev)); } else tmplen = 0; if (irq) @@ -489,7 +486,8 @@ static int pc236_pci_common_attach(struct comedi_device *dev, unsigned long iobase; int ret; - devpriv->pci_dev = pci_dev; + comedi_set_hw_dev(dev, &pci_dev->dev); + ret = comedi_pci_enable(pci_dev, PC236_DRIVER_NAME); if (ret < 0) { dev_err(dev->class_dev, @@ -573,6 +571,7 @@ static int __devinit pc236_attach_pci(struct comedi_device *dev, static void pc236_detach(struct comedi_device *dev) { struct pc236_private *devpriv = dev->private; + struct pci_dev *pcidev = comedi_to_pci_dev(dev); if (devpriv) pc236_intr_disable(dev); @@ -580,16 +579,13 @@ static void pc236_detach(struct comedi_device *dev) free_irq(dev->irq, dev); if (dev->subdevices) subdev_8255_cleanup(dev, dev->subdevices + 0); - if (devpriv) { - if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) && - devpriv->pci_dev) { - if (dev->iobase) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); - } else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA)) { - if (dev->iobase) - release_region(dev->iobase, PC236_IO_SIZE); - } + if (pcidev) { + if (dev->iobase) + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); + } else { + if (dev->iobase) + release_region(dev->iobase, PC236_IO_SIZE); } } -- cgit v0.10.2 From 1c16519fc2d63d0f58a7c54a47404e3de2c20396 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:39:42 -0700 Subject: staging: comedi: amplc_pc263: cleanup "find pci device" code For aesthetic reasons, rename the function and pass the comedi_devconfig struct instead of pre-parsing out the bus/slot information. Use for_each_pci_dev() instead of open-coding the loop using pci_get_device(). Consolidate the dev_err messages when a pci device is not found. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index e90178d..8ed8601 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c @@ -121,26 +121,27 @@ static const struct pc263_board *pc263_find_pci_board(struct pci_dev *pci_dev) * This function looks for a PCI device matching the requested board name, * bus and slot. */ -static struct pci_dev * -pc263_find_pci(struct comedi_device *dev, int bus, int slot) +static struct pci_dev *pc263_find_pci_dev(struct comedi_device *dev, + struct comedi_devconfig *it) { const struct pc263_board *thisboard = comedi_board(dev); struct pci_dev *pci_dev = NULL; + int bus = it->options[0]; + int slot = it->options[1]; - /* Look for matching PCI device. */ - for (pci_dev = pci_get_device(PCI_VENDOR_ID_AMPLICON, PCI_ANY_ID, NULL); - pci_dev != NULL; - pci_dev = pci_get_device(PCI_VENDOR_ID_AMPLICON, - PCI_ANY_ID, pci_dev)) { - /* If bus/slot specified, check them. */ + for_each_pci_dev(pci_dev) { if (bus || slot) { - if (bus != pci_dev->bus->number - || slot != PCI_SLOT(pci_dev->devfn)) + if (bus != pci_dev->bus->number || + slot != PCI_SLOT(pci_dev->devfn)) continue; } + if (pci_dev->vendor != PCI_VENDOR_ID_AMPLICON) + continue; + if (thisboard->model == anypci_model) { /* Wildcard board matches any supported PCI board. */ const struct pc263_board *foundboard; + foundboard = pc263_find_pci_board(pci_dev); if (foundboard == NULL) continue; @@ -151,19 +152,11 @@ pc263_find_pci(struct comedi_device *dev, int bus, int slot) if (pci_dev->device != thisboard->devid) continue; } - - /* Found a match. */ return pci_dev; } - /* No match found. */ - if (bus || slot) { - dev_err(dev->class_dev, - "error! no %s found at pci %02x:%02x!\n", - thisboard->name, bus, slot); - } else { - dev_err(dev->class_dev, "error! no %s found!\n", - thisboard->name); - } + dev_err(dev->class_dev, + "No supported board found! (req. bus %d, slot %d)\n", + bus, slot); return NULL; } /* @@ -285,17 +278,14 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) } else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) && thisboard->bustype == pci_bustype) { struct pci_dev *pci_dev; - int bus, slot; ret = alloc_private(dev, sizeof(struct pc263_private)); if (ret < 0) { dev_err(dev->class_dev, "error! out of memory!\n"); return ret; } - bus = it->options[0]; - slot = it->options[1]; - pci_dev = pc263_find_pci(dev, bus, slot); - if (pci_dev == NULL) + pci_dev = pc263_find_pci_dev(dev, it); + if (!pci_dev) return -EIO; return pc263_pci_common_attach(dev, pci_dev); } else { -- cgit v0.10.2 From 69fa3b755eb4ed8754a761a1528504ca9681e4b0 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:40:01 -0700 Subject: staging: comedi: amplc_pc263: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Since the pci_dev is no longer held in the provate data, we can also cleanup the detach a bit. Remove the IS_ENABLED() tests in the detach. If the pci_dev is non NULL it's a PCI device otherwise it's an ISA device. Using IS_ENABLED() to omit the code paths makes the code a bit confusing and doesn't save much. Since the pci_dev was the only thing in the private data, remove the struct, and it's allocation. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index 8ed8601..40ec1ff 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c @@ -93,15 +93,6 @@ static const struct pc263_board pc263_boards[] = { #endif }; -/* this structure is for data unique to this hardware driver. If - several hardware drivers keep similar information in this structure, - feel free to suggest moving the variable to the struct comedi_device struct. -*/ -struct pc263_private { - /* PCI device. */ - struct pci_dev *pci_dev; -}; - /* * This function looks for a board matching the supplied PCI device. */ @@ -193,7 +184,7 @@ static int pc263_do_insn_bits(struct comedi_device *dev, static void pc263_report_attach(struct comedi_device *dev) { const struct pc263_board *thisboard = comedi_board(dev); - struct pc263_private *devpriv = dev->private; + struct pci_dev *pcidev = comedi_to_pci_dev(dev); char tmpbuf[40]; if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_ISA) && @@ -202,7 +193,7 @@ static void pc263_report_attach(struct comedi_device *dev) else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) && thisboard->bustype == pci_bustype) snprintf(tmpbuf, sizeof(tmpbuf), "(pci %s) ", - pci_name(devpriv->pci_dev)); + pci_name(pcidev)); else tmpbuf[0] = '\0'; dev_info(dev->class_dev, "%s %sattached\n", dev->board_name, tmpbuf); @@ -239,11 +230,11 @@ static int pc263_common_attach(struct comedi_device *dev, unsigned long iobase) static int pc263_pci_common_attach(struct comedi_device *dev, struct pci_dev *pci_dev) { - struct pc263_private *devpriv = dev->private; unsigned long iobase; int ret; - devpriv->pci_dev = pci_dev; + comedi_set_hw_dev(dev, &pci_dev->dev); + ret = comedi_pci_enable(pci_dev, PC263_DRIVER_NAME); if (ret < 0) { dev_err(dev->class_dev, @@ -279,11 +270,6 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) thisboard->bustype == pci_bustype) { struct pci_dev *pci_dev; - ret = alloc_private(dev, sizeof(struct pc263_private)); - if (ret < 0) { - dev_err(dev->class_dev, "error! out of memory!\n"); - return ret; - } pci_dev = pc263_find_pci_dev(dev, it); if (!pci_dev) return -EIO; @@ -302,18 +288,11 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) static int __devinit pc263_attach_pci(struct comedi_device *dev, struct pci_dev *pci_dev) { - int ret; - if (!IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI)) return -EINVAL; dev_info(dev->class_dev, PC263_DRIVER_NAME ": attach pci %s\n", pci_name(pci_dev)); - ret = alloc_private(dev, sizeof(struct pc263_private)); - if (ret < 0) { - dev_err(dev->class_dev, "error! out of memory!\n"); - return ret; - } dev->board_ptr = pc263_find_pci_board(pci_dev); if (dev->board_ptr == NULL) { dev_err(dev->class_dev, "BUG! cannot determine board type!\n"); @@ -324,14 +303,13 @@ static int __devinit pc263_attach_pci(struct comedi_device *dev, static void pc263_detach(struct comedi_device *dev) { - struct pc263_private *devpriv = dev->private; + struct pci_dev *pcidev = comedi_to_pci_dev(dev); - if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) && devpriv && - devpriv->pci_dev) { + if (pcidev) { if (dev->iobase) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); - } else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_ISA)) { + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); + } else { if (dev->iobase) release_region(dev->iobase, PC263_IO_SIZE); } -- cgit v0.10.2 From 89ed0731bcf4be9f4f4bef9d564dc329c5511639 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:40:38 -0700 Subject: staging: comedi: amplc_pci224: cleanup "find pci device" code For aesthetic reasons, rename the function and pass the comedi_devconfig struct instead of pre-parsing out the bus/slot information. Use for_each_pci_dev() instead of open-coding the loop using pci_get_device(). Consolidate the dev_err messages when a pci device is not found. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index b87e10d..d489367 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -1256,50 +1256,42 @@ static const struct pci224_board * This function looks for a PCI device matching the requested board name, * bus and slot. */ -static struct pci_dev * -pci224_find_pci(struct comedi_device *dev, int bus, int slot) +static struct pci_dev *pci224_find_pci_dev(struct comedi_device *dev, + struct comedi_devconfig *it) { const struct pci224_board *thisboard = comedi_board(dev); struct pci_dev *pci_dev = NULL; + int bus = it->options[0]; + int slot = it->options[1]; - /* Look for matching PCI device. */ - for (pci_dev = pci_get_device(PCI_VENDOR_ID_AMPLICON, PCI_ANY_ID, NULL); - pci_dev != NULL; - pci_dev = pci_get_device(PCI_VENDOR_ID_AMPLICON, PCI_ANY_ID, - pci_dev)) { - /* If bus/slot specified, check them. */ + for_each_pci_dev(pci_dev) { if (bus || slot) { - if (bus != pci_dev->bus->number - || slot != PCI_SLOT(pci_dev->devfn)) + if (bus != pci_dev->bus->number || + slot != PCI_SLOT(pci_dev->devfn)) continue; } + if (pci_dev->vendor != PCI_VENDOR_ID_AMPLICON) + continue; + if (thisboard->model == any_model) { /* Match any supported model. */ const struct pci224_board *board_ptr; + board_ptr = pci224_find_pci_board(pci_dev); if (board_ptr == NULL) continue; /* Change board_ptr to matched board. */ dev->board_ptr = board_ptr; - thisboard = comedi_board(dev); } else { /* Match specific model name. */ if (thisboard->devid != pci_dev->device) continue; } - - /* Found a match. */ return pci_dev; } - /* No match found. */ - if (bus || slot) { - dev_err(dev->class_dev, - "error! no %s found at pci %02x:%02x!\n", - thisboard->name, bus, slot); - } else { - dev_err(dev->class_dev, "error! no %s found!\n", - thisboard->name); - } + dev_err(dev->class_dev, + "No supported board found! (req. bus %d, slot %d)\n", + bus, slot); return NULL; } @@ -1474,21 +1466,18 @@ static int pci224_attach_common(struct comedi_device *dev, static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct pci_dev *pci_dev; - int bus, slot; int ret; dev_info(dev->class_dev, DRIVER_NAME ": attach\n"); - bus = it->options[0]; - slot = it->options[1]; ret = alloc_private(dev, sizeof(struct pci224_private)); if (ret < 0) { dev_err(dev->class_dev, "error! out of memory!\n"); return ret; } - pci_dev = pci224_find_pci(dev, bus, slot); - if (pci_dev == NULL) + pci_dev = pci224_find_pci_dev(dev, it); + if (!pci_dev) return -EIO; return pci224_attach_common(dev, pci_dev, it->options); -- cgit v0.10.2 From 415417040fbe26160c381b7e147408aacc814a96 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:41:09 -0700 Subject: staging: comedi: amplc_pci224: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index d489367..4e17f13 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -378,7 +378,6 @@ static const struct pci224_board pci224_boards[] = { several hardware drivers keep similar information in this structure, feel free to suggest moving the variable to the struct comedi_device struct. */ struct pci224_private { - struct pci_dev *pci_dev; /* PCI device */ const unsigned short *hwrange; unsigned long iobase1; unsigned long state; @@ -1297,7 +1296,7 @@ static struct pci_dev *pci224_find_pci_dev(struct comedi_device *dev, static void pci224_report_attach(struct comedi_device *dev, unsigned int irq) { - struct pci224_private *devpriv = dev->private; + struct pci_dev *pcidev = comedi_to_pci_dev(dev); char tmpbuf[30]; if (irq) @@ -1306,7 +1305,7 @@ static void pci224_report_attach(struct comedi_device *dev, unsigned int irq) else snprintf(tmpbuf, sizeof(tmpbuf), "no irq"); dev_info(dev->class_dev, "%s (pci %s) (%s) attached\n", - dev->board_name, pci_name(devpriv->pci_dev), tmpbuf); + dev->board_name, pci_name(pcidev), tmpbuf); } /* @@ -1322,7 +1321,8 @@ static int pci224_attach_common(struct comedi_device *dev, unsigned n; int ret; - devpriv->pci_dev = pci_dev; + comedi_set_hw_dev(dev, &pci_dev->dev); + ret = comedi_pci_enable(pci_dev, DRIVER_NAME); if (ret < 0) { dev_err(dev->class_dev, @@ -1509,6 +1509,7 @@ pci224_attach_pci(struct comedi_device *dev, struct pci_dev *pci_dev) static void pci224_detach(struct comedi_device *dev) { struct pci224_private *devpriv = dev->private; + struct pci_dev *pcidev = comedi_to_pci_dev(dev); if (dev->irq) free_irq(dev->irq, dev); @@ -1523,11 +1524,11 @@ static void pci224_detach(struct comedi_device *dev) kfree(devpriv->ao_readback); kfree(devpriv->ao_scan_vals); kfree(devpriv->ao_scan_order); - if (devpriv->pci_dev) { - if (dev->iobase) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); - } + } + if (pcidev) { + if (dev->iobase) + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); } } -- cgit v0.10.2 From 2605d35b439da85634db975d98bc7be76f9d563a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:41:47 -0700 Subject: staging: comedi: amplc_pci230: cleanup "find pci device" code For aesthetic reasons, rename the function and pass the comedi_devconfig struct instead of pre-parsing out the bus/slot information. Consolidate the dev_err messages when a pci device is not found. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index 3d7f2cd..0b09934 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -2683,11 +2683,13 @@ static const struct pci230_board *pci230_find_pci_board(struct pci_dev *pci_dev) } /* Look for PCI device matching requested board name, bus and slot. */ -static struct pci_dev *pci230_find_pci(struct comedi_device *dev, - int bus, int slot) +static struct pci_dev *pci230_find_pci_dev(struct comedi_device *dev, + struct comedi_devconfig *it) { const struct pci230_board *thisboard = comedi_board(dev); struct pci_dev *pci_dev = NULL; + int bus = it->options[0]; + int slot = it->options[1]; for_each_pci_dev(pci_dev) { /* Check vendor ID (same for all supported PCI boards). */ @@ -2707,23 +2709,16 @@ static struct pci_dev *pci230_find_pci(struct comedi_device *dev, continue; /* Replace wildcard board_ptr. */ dev->board_ptr = foundboard; - thisboard = comedi_board(dev); } else { /* Need to match a specific board. */ if (!pci230_match_pci_board(thisboard, pci_dev)) continue; } - /* Found a matching PCI device. */ return pci_dev; } - /* No matching PCI device found. */ - if (bus || slot) - dev_err(dev->class_dev, - "error! no %s found at pci %02x:%02x\n", - thisboard->name, bus, slot); - else - dev_err(dev->class_dev, - "error! no %s found\n", thisboard->name); + dev_err(dev->class_dev, + "No supported board found! (req. bus %d, slot %d)\n", + bus, slot); return NULL; } @@ -2909,8 +2904,7 @@ static int pci230_attach(struct comedi_device *dev, struct comedi_devconfig *it) rc = pci230_alloc_private(dev); /* sets dev->private */ if (rc) return rc; - /* Find card. */ - pci_dev = pci230_find_pci(dev, it->options[0], it->options[1]); + pci_dev = pci230_find_pci_dev(dev, it); if (!pci_dev) return -EIO; return pci230_attach_common(dev, pci_dev); -- cgit v0.10.2 From c5866e7850e015b984aae4ad56998f6ced69af8e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:42:07 -0700 Subject: staging: comedi: amplc_pci230: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index 0b09934..1b67d0c 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -500,7 +500,6 @@ static const struct pci230_board pci230_boards[] = { several hardware drivers keep similar information in this structure, feel free to suggest moving the variable to the struct comedi_device struct. */ struct pci230_private { - struct pci_dev *pci_dev; spinlock_t isr_spinlock; /* Interrupt spin lock */ spinlock_t res_spinlock; /* Shared resources spin lock */ spinlock_t ai_stop_spinlock; /* Spin lock for stopping AI command */ @@ -2752,7 +2751,8 @@ static int pci230_attach_common(struct comedi_device *dev, /* PCI230's I/O spaces 1 and 2 respectively. */ int irq_hdl, rc; - devpriv->pci_dev = pci_dev; + comedi_set_hw_dev(dev, &pci_dev->dev); + dev->board_name = thisboard->name; /* Enable PCI device and reserve I/O spaces. */ if (comedi_pci_enable(pci_dev, "amplc_pci230") < 0) { @@ -2823,16 +2823,15 @@ static int pci230_attach_common(struct comedi_device *dev, outw(devpriv->adccon | PCI230_ADC_FIFO_RESET, dev->iobase + PCI230_ADCCON); /* Register the interrupt handler. */ - irq_hdl = request_irq(devpriv->pci_dev->irq, pci230_interrupt, + irq_hdl = request_irq(pci_dev->irq, pci230_interrupt, IRQF_SHARED, "amplc_pci230", dev); if (irq_hdl < 0) { dev_warn(dev->class_dev, "unable to register irq %u, commands will not be available\n", - devpriv->pci_dev->irq); + pci_dev->irq); } else { - dev->irq = devpriv->pci_dev->irq; - dev_dbg(dev->class_dev, "registered irq %u\n", - devpriv->pci_dev->irq); + dev->irq = pci_dev->irq; + dev_dbg(dev->class_dev, "registered irq %u\n", pci_dev->irq); } rc = comedi_alloc_subdevices(dev, 3); @@ -2932,18 +2931,16 @@ static int __devinit pci230_attach_pci(struct comedi_device *dev, static void pci230_detach(struct comedi_device *dev) { const struct pci230_board *thisboard = comedi_board(dev); - struct pci230_private *devpriv = dev->private; + struct pci_dev *pcidev = comedi_to_pci_dev(dev); if (dev->subdevices && thisboard->have_dio) subdev_8255_cleanup(dev, dev->subdevices + 2); if (dev->irq) free_irq(dev->irq, dev); - if (devpriv) { - if (devpriv->pci_dev) { - if (dev->iobase) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); - } + if (pcidev) { + if (dev->iobase) + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); } } -- cgit v0.10.2 From eeff9dbc6f7513b88163253b782b7e5a4b087cdd Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:42:36 -0700 Subject: staging: comedi: cb_pcidas64: factor out the "find pci device" code Factor the "find pci device" code out of the attach function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 11ce3fdf..704f5ea 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -1650,26 +1650,11 @@ static inline void warn_external_queue(struct comedi_device *dev) "Use internal AI channel queue (channels must be consecutive and use same range/aref)"); } -/* - * Attach is called by the Comedi core to configure the driver - * for a particular board. - */ -static int attach(struct comedi_device *dev, struct comedi_devconfig *it) +static struct pci_dev *cb_pcidas64_find_pci_dev(struct comedi_device *dev, + struct comedi_devconfig *it) { struct pci_dev *pcidev = NULL; int index; - uint32_t local_range, local_decode; - int retval; - -/* - * Allocate the private structure area. - */ - if (alloc_private(dev, sizeof(struct pcidas64_private)) < 0) - return -ENOMEM; - -/* - * Probe the device to determine what device in the series it is. - */ for_each_pci_dev(pcidev) { /* is it not a computer boards card? */ @@ -1687,22 +1672,38 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it) continue; } } - priv(dev)->hw_dev = pcidev; dev->board_ptr = pcidas64_boards + index; - break; + dev_dbg(dev->class_dev, "Found %s on bus %i, slot %i\n", + board(dev)->name, + pcidev->bus->number, PCI_SLOT(pcidev->devfn)); + return pcidev; } - if (dev->board_ptr) - break; } - if (dev->board_ptr == NULL) { - printk - ("No supported ComputerBoards/MeasurementComputing card found\n"); - return -EIO; - } + printk("No supported ComputerBoards/MeasurementComputing card found\n"); + return NULL; +} + +/* + * Attach is called by the Comedi core to configure the driver + * for a particular board. + */ +static int attach(struct comedi_device *dev, struct comedi_devconfig *it) +{ + struct pci_dev *pcidev; + uint32_t local_range, local_decode; + int retval; - dev_dbg(dev->class_dev, "Found %s on bus %i, slot %i\n", - board(dev)->name, pcidev->bus->number, PCI_SLOT(pcidev->devfn)); +/* + * Allocate the private structure area. + */ + if (alloc_private(dev, sizeof(struct pcidas64_private)) < 0) + return -ENOMEM; + + pcidev = cb_pcidas64_find_pci_dev(dev, it); + if (!pcidev) + return -EIO; + priv(dev)->hw_dev = pcidev; if (comedi_pci_enable(pcidev, dev->driver->driver_name)) { dev_warn(dev->class_dev, -- cgit v0.10.2 From 88262703416be01d6770fbf55737e73edb60ee16 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:42:57 -0700 Subject: staging: comedi: cb_pcidas64: cleanup "find pci device" code Add a couple local variables to make the tests more concise. Reorder the tests to make the for() loop checking for a matching boardtype quicker. Drop the dev_dbg for a match. It's just add noise. Reword the dev_err when no match is found. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 704f5ea..d1b0327 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -1654,33 +1654,29 @@ static struct pci_dev *cb_pcidas64_find_pci_dev(struct comedi_device *dev, struct comedi_devconfig *it) { struct pci_dev *pcidev = NULL; - int index; + int bus = it->options[0]; + int slot = it->options[1]; + int i; for_each_pci_dev(pcidev) { - /* is it not a computer boards card? */ + if (bus || slot) { + if (bus != pcidev->bus->number || + slot != PCI_SLOT(pcidev->devfn)) + continue; + } if (pcidev->vendor != PCI_VENDOR_ID_COMPUTERBOARDS) continue; - /* loop through cards supported by this driver */ - for (index = 0; index < ARRAY_SIZE(pcidas64_boards); index++) { - if (pcidas64_boards[index].device_id != pcidev->device) + + for (i = 0; i < ARRAY_SIZE(pcidas64_boards); i++) { + if (pcidas64_boards[i].device_id != pcidev->device) continue; - /* was a particular bus/slot requested? */ - if (it->options[0] || it->options[1]) { - /* are we on the wrong bus/slot? */ - if (pcidev->bus->number != it->options[0] || - PCI_SLOT(pcidev->devfn) != it->options[1]) { - continue; - } - } - dev->board_ptr = pcidas64_boards + index; - dev_dbg(dev->class_dev, "Found %s on bus %i, slot %i\n", - board(dev)->name, - pcidev->bus->number, PCI_SLOT(pcidev->devfn)); + dev->board_ptr = pcidas64_boards + i; return pcidev; } } - - printk("No supported ComputerBoards/MeasurementComputing card found\n"); + dev_err(dev->class_dev, + "No supported board found! (req. bus %d, slot %d)\n", + bus, slot); return NULL; } -- cgit v0.10.2 From 000e2635028bf8a1537383c5c27bf1bff27bc2f6 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:43:18 -0700 Subject: staging: comedi: cb_pcidas64: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Save the pci bar in dev->iobase so the detach is consistent with the other comedi pci drivers. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index d1b0327..65cbaab 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -1047,8 +1047,6 @@ struct ext_clock_info { /* this structure is for data unique to this hardware driver. */ struct pcidas64_private { - - struct pci_dev *hw_dev; /* pointer to board's pci_dev struct */ /* base addresses (physical) */ resource_size_t plx9080_phys_iobase; resource_size_t main_phys_iobase; @@ -1553,12 +1551,13 @@ static void init_stc_registers(struct comedi_device *dev) static int alloc_and_init_dma_members(struct comedi_device *dev) { + struct pci_dev *pcidev = comedi_to_pci_dev(dev); int i; /* alocate pci dma buffers */ for (i = 0; i < ai_dma_ring_count(board(dev)); i++) { priv(dev)->ai_buffer[i] = - pci_alloc_consistent(priv(dev)->hw_dev, DMA_BUFFER_SIZE, + pci_alloc_consistent(pcidev, DMA_BUFFER_SIZE, &priv(dev)->ai_buffer_bus_addr[i]); if (priv(dev)->ai_buffer[i] == NULL) return -ENOMEM; @@ -1567,7 +1566,7 @@ static int alloc_and_init_dma_members(struct comedi_device *dev) for (i = 0; i < AO_DMA_RING_COUNT; i++) { if (ao_cmd_is_supported(board(dev))) { priv(dev)->ao_buffer[i] = - pci_alloc_consistent(priv(dev)->hw_dev, + pci_alloc_consistent(pcidev, DMA_BUFFER_SIZE, &priv(dev)-> ao_buffer_bus_addr[i]); @@ -1578,7 +1577,7 @@ static int alloc_and_init_dma_members(struct comedi_device *dev) } /* allocate dma descriptors */ priv(dev)->ai_dma_desc = - pci_alloc_consistent(priv(dev)->hw_dev, + pci_alloc_consistent(pcidev, sizeof(struct plx_dma_desc) * ai_dma_ring_count(board(dev)), &priv(dev)->ai_dma_desc_bus_addr); @@ -1589,7 +1588,7 @@ static int alloc_and_init_dma_members(struct comedi_device *dev) priv(dev)->ai_dma_desc_bus_addr); if (ao_cmd_is_supported(board(dev))) { priv(dev)->ao_dma_desc = - pci_alloc_consistent(priv(dev)->hw_dev, + pci_alloc_consistent(pcidev, sizeof(struct plx_dma_desc) * AO_DMA_RING_COUNT, &priv(dev)->ao_dma_desc_bus_addr); @@ -1699,7 +1698,7 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it) pcidev = cb_pcidas64_find_pci_dev(dev, it); if (!pcidev) return -EIO; - priv(dev)->hw_dev = pcidev; + comedi_set_hw_dev(dev, &pcidev->dev); if (comedi_pci_enable(pcidev, dev->driver->driver_name)) { dev_warn(dev->class_dev, @@ -1711,10 +1710,11 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Initialize dev->board_name */ dev->board_name = board(dev)->name; + dev->iobase = pci_resource_start(pcidev, MAIN_BADDRINDEX); + priv(dev)->plx9080_phys_iobase = pci_resource_start(pcidev, PLX9080_BADDRINDEX); - priv(dev)->main_phys_iobase = - pci_resource_start(pcidev, MAIN_BADDRINDEX); + priv(dev)->main_phys_iobase = dev->iobase; priv(dev)->dio_counter_phys_iobase = pci_resource_start(pcidev, DIO_COUNTER_BADDRINDEX); @@ -1791,12 +1791,13 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it) static void detach(struct comedi_device *dev) { + struct pci_dev *pcidev = comedi_to_pci_dev(dev); unsigned int i; if (dev->irq) free_irq(dev->irq, dev); if (priv(dev)) { - if (priv(dev)->hw_dev) { + if (pcidev) { if (priv(dev)->plx9080_iobase) { disable_plx_interrupts(dev); iounmap(priv(dev)->plx9080_iobase); @@ -1808,7 +1809,7 @@ static void detach(struct comedi_device *dev) /* free pci dma buffers */ for (i = 0; i < ai_dma_ring_count(board(dev)); i++) { if (priv(dev)->ai_buffer[i]) - pci_free_consistent(priv(dev)->hw_dev, + pci_free_consistent(pcidev, DMA_BUFFER_SIZE, priv(dev)-> ai_buffer[i], @@ -1818,7 +1819,7 @@ static void detach(struct comedi_device *dev) } for (i = 0; i < AO_DMA_RING_COUNT; i++) { if (priv(dev)->ao_buffer[i]) - pci_free_consistent(priv(dev)->hw_dev, + pci_free_consistent(pcidev, DMA_BUFFER_SIZE, priv(dev)-> ao_buffer[i], @@ -1828,7 +1829,7 @@ static void detach(struct comedi_device *dev) } /* free dma descriptors */ if (priv(dev)->ai_dma_desc) - pci_free_consistent(priv(dev)->hw_dev, + pci_free_consistent(pcidev, sizeof(struct plx_dma_desc) * ai_dma_ring_count(board @@ -1837,20 +1838,22 @@ static void detach(struct comedi_device *dev) priv(dev)-> ai_dma_desc_bus_addr); if (priv(dev)->ao_dma_desc) - pci_free_consistent(priv(dev)->hw_dev, + pci_free_consistent(pcidev, sizeof(struct plx_dma_desc) * AO_DMA_RING_COUNT, priv(dev)->ao_dma_desc, priv(dev)-> ao_dma_desc_bus_addr); - if (priv(dev)->main_phys_iobase) - comedi_pci_disable(priv(dev)->hw_dev); - - pci_dev_put(priv(dev)->hw_dev); } } if (dev->subdevices) subdev_8255_cleanup(dev, dev->subdevices + 4); + if (pcidev) { + if (dev->iobase) + comedi_pci_disable(pcidev); + + pci_dev_put(pcidev); + } } static int ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, -- cgit v0.10.2 From 84b2d57c0bd9ddb31d33f6a5656bc4d6e6a04576 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:44:03 -0700 Subject: staging: comedi: cb_pcidda: factor out the "find pci device" code Factor the "find pci device" code out of the attach function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidda.c b/drivers/staging/comedi/drivers/cb_pcidda.c index f5a7957..d3d8326 100644 --- a/drivers/staging/comedi/drivers/cb_pcidda.c +++ b/drivers/staging/comedi/drivers/cb_pcidda.c @@ -255,27 +255,11 @@ static unsigned int cb_pcidda_read_eeprom(struct comedi_device *dev, static void cb_pcidda_calibrate(struct comedi_device *dev, unsigned int channel, unsigned int range); -/* - * Attach is called by the Comedi core to configure the driver - * for a particular board. - */ -static int cb_pcidda_attach(struct comedi_device *dev, - struct comedi_devconfig *it) +static struct pci_dev *cb_pcidda_find_pci_dev(struct comedi_device *dev, + struct comedi_devconfig *it) { - struct comedi_subdevice *s; struct pci_dev *pcidev = NULL; int index; - int ret; - -/* - * Allocate the private structure area. - */ - if (alloc_private(dev, sizeof(struct cb_pcidda_private)) < 0) - return -ENOMEM; - -/* - * Probe the device to determine what device in the series it is. - */ for_each_pci_dev(pcidev) { if (pcidev->vendor == PCI_VENDOR_ID_CB) { @@ -288,22 +272,42 @@ static int cb_pcidda_attach(struct comedi_device *dev, for (index = 0; index < ARRAY_SIZE(cb_pcidda_boards); index++) { if (cb_pcidda_boards[index].device_id == pcidev->device) { - goto found; + dev->board_ptr = cb_pcidda_boards + index; + dev_dbg(dev->class_dev, + "Found %s at requested position\n", + thisboard->name); + return pcidev; } } } } - if (!pcidev) { - dev_err(dev->class_dev, - "Not a ComputerBoards/MeasurementComputing card on requested position\n"); + dev_err(dev->class_dev, + "Not a ComputerBoards/MeasurementComputing card on requested position\n"); + return NULL; +} + +/* + * Attach is called by the Comedi core to configure the driver + * for a particular board. + */ +static int cb_pcidda_attach(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + struct pci_dev *pcidev; + struct comedi_subdevice *s; + int index; + int ret; + +/* + * Allocate the private structure area. + */ + if (alloc_private(dev, sizeof(struct cb_pcidda_private)) < 0) + return -ENOMEM; + + pcidev = cb_pcidda_find_pci_dev(dev, it); + if (!pcidev) return -EIO; - } -found: devpriv->pci_dev = pcidev; - dev->board_ptr = cb_pcidda_boards + index; - /* "thisboard" macro can be used from here. */ - dev_dbg(dev->class_dev, "Found %s at requested position\n", - thisboard->name); /* * Enable PCI device and request regions. -- cgit v0.10.2 From 5b7c52a78da910a198d743c2b32aa7a93e7a540a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:44:22 -0700 Subject: staging: comedi: cb_pcidda: cleanup "find pci device" code Add a couple local variables to make the tests more concise. Reorder the tests to make the for() loop checking for a matching boardtype quicker. Drop the dev_dbg for a match. It's just add noise. Reword the dev_err when no match is found. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidda.c b/drivers/staging/comedi/drivers/cb_pcidda.c index d3d8326..3567f4a 100644 --- a/drivers/staging/comedi/drivers/cb_pcidda.c +++ b/drivers/staging/comedi/drivers/cb_pcidda.c @@ -259,30 +259,29 @@ static struct pci_dev *cb_pcidda_find_pci_dev(struct comedi_device *dev, struct comedi_devconfig *it) { struct pci_dev *pcidev = NULL; - int index; + int bus = it->options[0]; + int slot = it->options[1]; + int i; for_each_pci_dev(pcidev) { - if (pcidev->vendor == PCI_VENDOR_ID_CB) { - if (it->options[0] || it->options[1]) { - if (pcidev->bus->number != it->options[0] || - PCI_SLOT(pcidev->devfn) != it->options[1]) { - continue; - } - } - for (index = 0; index < ARRAY_SIZE(cb_pcidda_boards); index++) { - if (cb_pcidda_boards[index].device_id == - pcidev->device) { - dev->board_ptr = cb_pcidda_boards + index; - dev_dbg(dev->class_dev, - "Found %s at requested position\n", - thisboard->name); - return pcidev; - } - } + if (bus || slot) { + if (bus != pcidev->bus->number || + slot != PCI_SLOT(pcidev->devfn)) + continue; + } + if (pcidev->vendor != PCI_VENDOR_ID_CB) + continue; + + for (i = 0; i < ARRAY_SIZE(cb_pcidda_boards); i++) { + if (cb_pcidda_boards[i].device_id != pcidev->device) + continue; + dev->board_ptr = cb_pcidda_boards + i; + return pcidev; } } dev_err(dev->class_dev, - "Not a ComputerBoards/MeasurementComputing card on requested position\n"); + "No supported board found! (req. bus %d, slot %d)\n", + bus, slot); return NULL; } -- cgit v0.10.2 From 04cec90cd356016296af3030b12aacabd891f393 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:44:43 -0700 Subject: staging: comedi: cb_pcidda: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Save the pci bar in dev->iobase so the detach is consistent with the other comedi pci drivers. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidda.c b/drivers/staging/comedi/drivers/cb_pcidda.c index 3567f4a..12660a3 100644 --- a/drivers/staging/comedi/drivers/cb_pcidda.c +++ b/drivers/staging/comedi/drivers/cb_pcidda.c @@ -216,9 +216,6 @@ static const struct cb_pcidda_board cb_pcidda_boards[] = { struct cb_pcidda_private { int data; - /* would be useful for a PCI device */ - struct pci_dev *pci_dev; - unsigned long digitalio; unsigned long dac; @@ -306,7 +303,7 @@ static int cb_pcidda_attach(struct comedi_device *dev, pcidev = cb_pcidda_find_pci_dev(dev, it); if (!pcidev) return -EIO; - devpriv->pci_dev = pcidev; + comedi_set_hw_dev(dev, &pcidev->dev); /* * Enable PCI device and request regions. @@ -320,9 +317,9 @@ static int cb_pcidda_attach(struct comedi_device *dev, /* * Allocate the I/O ports. */ - devpriv->digitalio = - pci_resource_start(devpriv->pci_dev, DIGITALIO_BADRINDEX); - devpriv->dac = pci_resource_start(devpriv->pci_dev, DAC_BADRINDEX); + devpriv->digitalio = pci_resource_start(pcidev, DIGITALIO_BADRINDEX); + devpriv->dac = pci_resource_start(pcidev, DAC_BADRINDEX); + dev->iobase = devpriv->dac; /* * Warn about the status of the driver. @@ -377,12 +374,12 @@ static int cb_pcidda_attach(struct comedi_device *dev, static void cb_pcidda_detach(struct comedi_device *dev) { - if (devpriv) { - if (devpriv->pci_dev) { - if (devpriv->dac) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); - } + struct pci_dev *pcidev = comedi_to_pci_dev(dev); + + if (pcidev) { + if (dev->iobase) + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); } if (dev->subdevices) { subdev_8255_cleanup(dev, dev->subdevices + 1); -- cgit v0.10.2 From dbd658fc0cf4be8df0c63ed1d70e631f2b606e11 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:45:04 -0700 Subject: staging: comedi: cb_pcidio: store the iobase in the comedi_device Save the pci bar in dev->iobase instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidio.c b/drivers/staging/comedi/drivers/cb_pcidio.c index 11c7502..f30f6da 100644 --- a/drivers/staging/comedi/drivers/cb_pcidio.c +++ b/drivers/staging/comedi/drivers/cb_pcidio.c @@ -99,7 +99,6 @@ struct pcidio_private { /* used for DO readback, currently unused */ unsigned int do_readback[4]; /* up to 4 unsigned int suffice to hold 96 bits for PCI-DIO96 */ - unsigned long dio_reg_base; /* address of port A of the first 8255 chip on board */ }; /* @@ -165,9 +164,7 @@ static int pcidio_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (comedi_pci_enable(pcidev, thisboard->name)) return -EIO; - devpriv->dio_reg_base - = - pci_resource_start(pcidev, thisboard->dioregs_badrindex); + dev->iobase = pci_resource_start(pcidev, thisboard->dioregs_badrindex); ret = comedi_alloc_subdevices(dev, thisboard->n_8255); if (ret) @@ -175,9 +172,9 @@ static int pcidio_attach(struct comedi_device *dev, struct comedi_devconfig *it) for (i = 0; i < thisboard->n_8255; i++) { subdev_8255_init(dev, dev->subdevices + i, - NULL, devpriv->dio_reg_base + i * 4); + NULL, dev->iobase + i * 4); dev_dbg(dev->class_dev, "subdev %d: base = 0x%lx\n", i, - devpriv->dio_reg_base + i * 4); + dev->iobase + i * 4); } return 1; @@ -188,7 +185,7 @@ static void pcidio_detach(struct comedi_device *dev) struct pci_dev *pcidev = comedi_to_pci_dev(dev); if (pcidev) { - if (devpriv->dio_reg_base) + if (dev->iobase) comedi_pci_disable(pcidev); pci_dev_put(pcidev); } -- cgit v0.10.2 From cdb82250ea00574c8822366ee59d12c343e81206 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:45:26 -0700 Subject: staging: comedi: cb_pcidio: remove the private data The private data is no longer needed by this driver. Remove the struct, devpriv macro, and the allocation. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcidio.c b/drivers/staging/comedi/drivers/cb_pcidio.c index f30f6da..e370d0d 100644 --- a/drivers/staging/comedi/drivers/cb_pcidio.c +++ b/drivers/staging/comedi/drivers/cb_pcidio.c @@ -90,23 +90,6 @@ static const struct pcidio_board pcidio_boards[] = { */ #define thisboard ((const struct pcidio_board *)dev->board_ptr) -/* this structure is for data unique to this hardware driver. If - several hardware drivers keep similar information in this structure, - feel free to suggest moving the variable to the struct comedi_device struct. */ -struct pcidio_private { - int data; /* currently unused */ - - /* used for DO readback, currently unused */ - unsigned int do_readback[4]; /* up to 4 unsigned int suffice to hold 96 bits for PCI-DIO96 */ - -}; - -/* - * most drivers define the following macro to make it easy to - * access the private structure. - */ -#define devpriv ((struct pcidio_private *)dev->private) - static struct pci_dev *pcidio_find_pci_dev(struct comedi_device *dev, struct comedi_devconfig *it) { @@ -143,13 +126,6 @@ static int pcidio_attach(struct comedi_device *dev, struct comedi_devconfig *it) int i; int ret; -/* - * Allocate the private structure area. alloc_private() is a - * convenient macro defined in comedidev.h. - */ - if (alloc_private(dev, sizeof(struct pcidio_private)) < 0) - return -ENOMEM; - pcidev = pcidio_find_pci_dev(dev, it); if (!pcidev) return -EIO; -- cgit v0.10.2 From 46a4ff0dbc7a27621983ec1157824af3fdb7f08b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:46:07 -0700 Subject: staging: comedi: cb_pcimdas: factor out the "find pci device" code Factor the "find pci device" code out of the attach function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index 2977f2d..8999a72 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -175,30 +175,11 @@ static int cb_pcimdas_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -/* - * Attach is called by the Comedi core to configure the driver - * for a particular board. If you specified a board_name array - * in the driver structure, dev->board_ptr contains that - * address. - */ -static int cb_pcimdas_attach(struct comedi_device *dev, - struct comedi_devconfig *it) +static struct pci_dev *cb_pcimdas_find_pci_dev(struct comedi_device *dev, + struct comedi_devconfig *it) { - struct comedi_subdevice *s; struct pci_dev *pcidev = NULL; int index; - int ret; - /* int i; */ - -/* - * Allocate the private structure area. - */ - if (alloc_private(dev, sizeof(struct cb_pcimdas_private)) < 0) - return -ENOMEM; - -/* - * Probe the device to determine what device in the series it is. - */ for_each_pci_dev(pcidev) { /* is it not a computer boards card? */ @@ -217,21 +198,43 @@ static int cb_pcimdas_attach(struct comedi_device *dev, continue; } } - devpriv->pci_dev = pcidev; dev->board_ptr = cb_pcimdas_boards + index; - goto found; + dev_dbg(dev->class_dev, + "Found %s on bus %i, slot %i\n", + cb_pcimdas_boards[index].name, + pcidev->bus->number, + PCI_SLOT(pcidev->devfn)); + return pcidev; } } - dev_err(dev->class_dev, "No supported ComputerBoards/MeasurementComputing card found on requested position\n"); - return -EIO; + return NULL; +} -found: +/* + * Attach is called by the Comedi core to configure the driver + * for a particular board. If you specified a board_name array + * in the driver structure, dev->board_ptr contains that + * address. + */ +static int cb_pcimdas_attach(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + struct pci_dev *pcidev; + struct comedi_subdevice *s; + int ret; - dev_dbg(dev->class_dev, "Found %s on bus %i, slot %i\n", - cb_pcimdas_boards[index].name, pcidev->bus->number, - PCI_SLOT(pcidev->devfn)); +/* + * Allocate the private structure area. + */ + if (alloc_private(dev, sizeof(struct cb_pcimdas_private)) < 0) + return -ENOMEM; + + pcidev = cb_pcimdas_find_pci_dev(dev, it); + if (!pcidev) + return -EIO; + devpriv->pci_dev = pcidev; /* Warn about non-tested features */ switch (thisboard->device_id) { -- cgit v0.10.2 From 366d6245fb1b643bbbe8dfbc4d63b78c7c44746a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:46:27 -0700 Subject: staging: comedi: cb_pcimdas: cleanup "find pci device" code Add a couple local variables to make the tests more concise. Reorder the tests to make the for() loop checking for a matching boardtype quicker. Use ARRAY_SIZE() to determine the number of boards instead of the hard-coded '1'. Drop the dev_dbg for a match. It's just add noise. Reword the dev_err when no match is found. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index 8999a72..1b6ebb7 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -122,8 +122,6 @@ static const struct cb_pcimdas_board cb_pcimdas_boards[] = { }, }; -#define N_BOARDS 1 /* Max number of boards supported */ - /* * Useful for shorthand access to the particular board structure */ @@ -179,36 +177,30 @@ static struct pci_dev *cb_pcimdas_find_pci_dev(struct comedi_device *dev, struct comedi_devconfig *it) { struct pci_dev *pcidev = NULL; - int index; + int bus = it->options[0]; + int slot = it->options[1]; + int i; for_each_pci_dev(pcidev) { - /* is it not a computer boards card? */ + if (bus || slot) { + if (bus != pcidev->bus->number || + slot != PCI_SLOT(pcidev->devfn)) + continue; + } if (pcidev->vendor != PCI_VENDOR_ID_COMPUTERBOARDS) continue; - /* loop through cards supported by this driver */ - for (index = 0; index < N_BOARDS; index++) { - if (cb_pcimdas_boards[index].device_id != - pcidev->device) + + for (i = 0; i < ARRAY_SIZE(cb_pcimdas_boards); i++) { + if (cb_pcimdas_boards[i].device_id != pcidev->device) continue; - /* was a particular bus/slot requested? */ - if (it->options[0] || it->options[1]) { - /* are we on the wrong bus/slot? */ - if (pcidev->bus->number != it->options[0] || - PCI_SLOT(pcidev->devfn) != it->options[1]) { - continue; - } - } - dev->board_ptr = cb_pcimdas_boards + index; - dev_dbg(dev->class_dev, - "Found %s on bus %i, slot %i\n", - cb_pcimdas_boards[index].name, - pcidev->bus->number, - PCI_SLOT(pcidev->devfn)); + + dev->board_ptr = cb_pcimdas_boards + i; return pcidev; } } dev_err(dev->class_dev, - "No supported ComputerBoards/MeasurementComputing card found on requested position\n"); + "No supported board found! (req. bus %d, slot %d)\n", + bus, slot); return NULL; } -- cgit v0.10.2 From 718c39e8ff8ccc824883cc1078c1bf2fd2afeacc Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:46:50 -0700 Subject: staging: comedi: cb_pcimdas: remove the debug print of the pci bars Remove the dev_dbg output of the pci addresses. It's just add noise. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index 1b6ebb7..3400067 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -250,12 +250,6 @@ static int cb_pcimdas_attach(struct comedi_device *dev, devpriv->BADR3 = pci_resource_start(devpriv->pci_dev, 3); devpriv->BADR4 = pci_resource_start(devpriv->pci_dev, 4); - dev_dbg(dev->class_dev, "devpriv->BADR0 = 0x%lx\n", devpriv->BADR0); - dev_dbg(dev->class_dev, "devpriv->BADR1 = 0x%lx\n", devpriv->BADR1); - dev_dbg(dev->class_dev, "devpriv->BADR2 = 0x%lx\n", devpriv->BADR2); - dev_dbg(dev->class_dev, "devpriv->BADR3 = 0x%lx\n", devpriv->BADR3); - dev_dbg(dev->class_dev, "devpriv->BADR4 = 0x%lx\n", devpriv->BADR4); - /* Dont support IRQ yet */ /* get irq */ /* if(request_irq(devpriv->pci_dev->irq, cb_pcimdas_interrupt, IRQF_SHARED, "cb_pcimdas", dev )) */ -- cgit v0.10.2 From 2852230eb210bbd249c5f217eef36b641b2e4bb8 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:47:11 -0700 Subject: staging: comedi: cb_pcimdas: cleanup the private data Remove the unused variables from the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index 3400067..9e4bac1 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -134,8 +134,6 @@ static const struct cb_pcimdas_board cb_pcimdas_boards[] = { * struct. */ struct cb_pcimdas_private { - int data; - /* would be useful for a PCI device */ struct pci_dev *pci_dev; @@ -148,13 +146,6 @@ struct cb_pcimdas_private { /* Used for AO readback */ unsigned int ao_readback[2]; - - /* Used for DIO */ - unsigned short int port_a; /* copy of BADR4+0 */ - unsigned short int port_b; /* copy of BADR4+1 */ - unsigned short int port_c; /* copy of BADR4+2 */ - unsigned short int dio_mode; /* copy of BADR4+3 */ - }; /* -- cgit v0.10.2 From 170581bf4858f22dfeb00f648e9bcc57377da4fa Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:47:46 -0700 Subject: staging: comedi: cb_pcimdas: remove BADR1 from the private data The pci resource bar 1 address is not used in the driver. Remove it from the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index 9e4bac1..3902c85bc 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -57,7 +57,6 @@ See http://www.mccdaq.com/PDFs/Manuals/pcim-das1602-16.pdf for more details. /* sizes of io regions (bytes) */ #define BADR0_SIZE 2 /* ?? */ -#define BADR1_SIZE 4 #define BADR2_SIZE 6 #define BADR3_SIZE 16 #define BADR4_SIZE 4 @@ -139,7 +138,6 @@ struct cb_pcimdas_private { /* base addresses */ unsigned long BADR0; - unsigned long BADR1; unsigned long BADR2; unsigned long BADR3; unsigned long BADR4; @@ -236,7 +234,6 @@ static int cb_pcimdas_attach(struct comedi_device *dev, } devpriv->BADR0 = pci_resource_start(devpriv->pci_dev, 0); - devpriv->BADR1 = pci_resource_start(devpriv->pci_dev, 1); devpriv->BADR2 = pci_resource_start(devpriv->pci_dev, 2); devpriv->BADR3 = pci_resource_start(devpriv->pci_dev, 3); devpriv->BADR4 = pci_resource_start(devpriv->pci_dev, 4); -- cgit v0.10.2 From 8e2f2384c78a9608b05b91acd4b35a35620acf16 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:48:07 -0700 Subject: staging: comedi: cb_pcimdas: remove BADR4 from the private data The pci resource bar 4 address is only needed to initialize the 8255 subdevice. Use a local variable to hold it and remove it from the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index 3902c85bc..c8df680 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -59,7 +59,6 @@ See http://www.mccdaq.com/PDFs/Manuals/pcim-das1602-16.pdf for more details. #define BADR0_SIZE 2 /* ?? */ #define BADR2_SIZE 6 #define BADR3_SIZE 16 -#define BADR4_SIZE 4 /* DAC Offsets */ #define ADC_TRIG 0 @@ -140,7 +139,6 @@ struct cb_pcimdas_private { unsigned long BADR0; unsigned long BADR2; unsigned long BADR3; - unsigned long BADR4; /* Used for AO readback */ unsigned int ao_readback[2]; @@ -204,6 +202,7 @@ static int cb_pcimdas_attach(struct comedi_device *dev, { struct pci_dev *pcidev; struct comedi_subdevice *s; + unsigned long iobase_8255; int ret; /* @@ -236,7 +235,7 @@ static int cb_pcimdas_attach(struct comedi_device *dev, devpriv->BADR0 = pci_resource_start(devpriv->pci_dev, 0); devpriv->BADR2 = pci_resource_start(devpriv->pci_dev, 2); devpriv->BADR3 = pci_resource_start(devpriv->pci_dev, 3); - devpriv->BADR4 = pci_resource_start(devpriv->pci_dev, 4); + iobase_8255 = pci_resource_start(devpriv->pci_dev, 4); /* Dont support IRQ yet */ /* get irq */ @@ -280,7 +279,7 @@ static int cb_pcimdas_attach(struct comedi_device *dev, s = dev->subdevices + 2; /* digital i/o subdevice */ if (thisboard->has_dio) - subdev_8255_init(dev, s, NULL, devpriv->BADR4); + subdev_8255_init(dev, s, NULL, iobase_8255); else s->type = COMEDI_SUBD_UNUSED; -- cgit v0.10.2 From 6191a3ff59ed91ed3efd7a4a5fcad0368c199f28 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:48:27 -0700 Subject: staging: comedi: cb_pcimdas: remove BADR2 from the private data The pci resource bar 2 address is the primary i/o address used by this device. Store it in dev->iobase and remove it from the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index c8df680..4312e9b 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -57,7 +57,6 @@ See http://www.mccdaq.com/PDFs/Manuals/pcim-das1602-16.pdf for more details. /* sizes of io regions (bytes) */ #define BADR0_SIZE 2 /* ?? */ -#define BADR2_SIZE 6 #define BADR3_SIZE 16 /* DAC Offsets */ @@ -137,7 +136,6 @@ struct cb_pcimdas_private { /* base addresses */ unsigned long BADR0; - unsigned long BADR2; unsigned long BADR3; /* Used for AO readback */ @@ -233,7 +231,7 @@ static int cb_pcimdas_attach(struct comedi_device *dev, } devpriv->BADR0 = pci_resource_start(devpriv->pci_dev, 0); - devpriv->BADR2 = pci_resource_start(devpriv->pci_dev, 2); + dev->iobase = pci_resource_start(devpriv->pci_dev, 2); devpriv->BADR3 = pci_resource_start(devpriv->pci_dev, 3); iobase_8255 = pci_resource_start(devpriv->pci_dev, 4); @@ -344,7 +342,7 @@ static int cb_pcimdas_ai_rinsn(struct comedi_device *dev, /* convert n samples */ for (n = 0; n < insn->n; n++) { /* trigger conversion */ - outw(0, devpriv->BADR2 + 0); + outw(0, dev->iobase + 0); #define TIMEOUT 1000 /* typically takes 5 loops on a lightly loaded Pentium 100MHz, */ /* this is likely to be 100 loops on a 2GHz machine, so set 1000 as the limit. */ @@ -360,7 +358,7 @@ static int cb_pcimdas_ai_rinsn(struct comedi_device *dev, return -ETIMEDOUT; } /* read data */ - d = inw(devpriv->BADR2 + 0); + d = inw(dev->iobase + 0); /* mangle the data as necessary */ /* d ^= 1<<(thisboard->ai_bits-1); // 16 bit data from ADC, so no mangle needed. */ @@ -384,10 +382,10 @@ static int cb_pcimdas_ao_winsn(struct comedi_device *dev, for (i = 0; i < insn->n; i++) { switch (chan) { case 0: - outw(data[i] & 0x0FFF, devpriv->BADR2 + DAC0_OFFSET); + outw(data[i] & 0x0FFF, dev->iobase + DAC0_OFFSET); break; case 1: - outw(data[i] & 0x0FFF, devpriv->BADR2 + DAC1_OFFSET); + outw(data[i] & 0x0FFF, dev->iobase + DAC1_OFFSET); break; default: return -1; -- cgit v0.10.2 From 6d2d7ef7315cb40549baec7bb13dccfcf5162225 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:49:03 -0700 Subject: staging: comedi: cb_pcimdas: remove BADR0 from the private data The pci resource bar 0 address is only used as a "flag" to let the datach function know that the pci device has been enabled. Use dev->iobase in the detach instead and remove BADR0 from the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index 4312e9b..ce08533 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -56,7 +56,6 @@ See http://www.mccdaq.com/PDFs/Manuals/pcim-das1602-16.pdf for more details. /* Registers for the PCIM-DAS1602/16 */ /* sizes of io regions (bytes) */ -#define BADR0_SIZE 2 /* ?? */ #define BADR3_SIZE 16 /* DAC Offsets */ @@ -135,7 +134,6 @@ struct cb_pcimdas_private { struct pci_dev *pci_dev; /* base addresses */ - unsigned long BADR0; unsigned long BADR3; /* Used for AO readback */ @@ -230,7 +228,6 @@ static int cb_pcimdas_attach(struct comedi_device *dev, return -EIO; } - devpriv->BADR0 = pci_resource_start(devpriv->pci_dev, 0); dev->iobase = pci_resource_start(devpriv->pci_dev, 2); devpriv->BADR3 = pci_resource_start(devpriv->pci_dev, 3); iobase_8255 = pci_resource_start(devpriv->pci_dev, 4); @@ -290,7 +287,7 @@ static void cb_pcimdas_detach(struct comedi_device *dev) free_irq(dev->irq, dev); if (devpriv) { if (devpriv->pci_dev) { - if (devpriv->BADR0) + if (dev->iobase) comedi_pci_disable(devpriv->pci_dev); pci_dev_put(devpriv->pci_dev); } -- cgit v0.10.2 From 16dd84f52c2dea55870ed9293e74ce61e3d405c2 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:49:35 -0700 Subject: staging: comedi: cb_pcimdas: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index ce08533..c632a89 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -130,9 +130,6 @@ static const struct cb_pcimdas_board cb_pcimdas_boards[] = { * struct. */ struct cb_pcimdas_private { - /* would be useful for a PCI device */ - struct pci_dev *pci_dev; - /* base addresses */ unsigned long BADR3; @@ -210,7 +207,7 @@ static int cb_pcimdas_attach(struct comedi_device *dev, pcidev = cb_pcimdas_find_pci_dev(dev, it); if (!pcidev) return -EIO; - devpriv->pci_dev = pcidev; + comedi_set_hw_dev(dev, &pcidev->dev); /* Warn about non-tested features */ switch (thisboard->device_id) { @@ -228,18 +225,18 @@ static int cb_pcimdas_attach(struct comedi_device *dev, return -EIO; } - dev->iobase = pci_resource_start(devpriv->pci_dev, 2); - devpriv->BADR3 = pci_resource_start(devpriv->pci_dev, 3); - iobase_8255 = pci_resource_start(devpriv->pci_dev, 4); + dev->iobase = pci_resource_start(pcidev, 2); + devpriv->BADR3 = pci_resource_start(pcidev, 3); + iobase_8255 = pci_resource_start(pcidev, 4); /* Dont support IRQ yet */ /* get irq */ -/* if(request_irq(devpriv->pci_dev->irq, cb_pcimdas_interrupt, IRQF_SHARED, "cb_pcimdas", dev )) */ +/* if(request_irq(pcidev->irq, cb_pcimdas_interrupt, IRQF_SHARED, "cb_pcimdas", dev )) */ /* { */ -/* printk(" unable to allocate irq %u\n", devpriv->pci_dev->irq); */ +/* printk(" unable to allocate irq %u\n", pcidev->irq); */ /* return -EINVAL; */ /* } */ -/* dev->irq = devpriv->pci_dev->irq; */ +/* dev->irq = pcidev->irq; */ /* Initialize dev->board_name */ dev->board_name = thisboard->name; @@ -283,14 +280,14 @@ static int cb_pcimdas_attach(struct comedi_device *dev, static void cb_pcimdas_detach(struct comedi_device *dev) { + struct pci_dev *pcidev = comedi_to_pci_dev(dev); + if (dev->irq) free_irq(dev->irq, dev); - if (devpriv) { - if (devpriv->pci_dev) { - if (dev->iobase) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); - } + if (pcidev) { + if (dev->iobase) + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); } } -- cgit v0.10.2 From f0bd6d357527ed40c84e75f1f3137ea944f179db Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:49:56 -0700 Subject: staging: comedi: contec_pci_dio: factor out the "find pci device" code Factor the "find pci device" code out of the attach function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/contec_pci_dio.c b/drivers/staging/comedi/drivers/contec_pci_dio.c index ee769e0..e4d37fc 100644 --- a/drivers/staging/comedi/drivers/contec_pci_dio.c +++ b/drivers/staging/comedi/drivers/contec_pci_dio.c @@ -97,22 +97,10 @@ static int contec_di_insn_bits(struct comedi_device *dev, return insn->n; } -static int contec_attach(struct comedi_device *dev, struct comedi_devconfig *it) +static struct pci_dev *contec_find_pci_dev(struct comedi_device *dev, + struct comedi_devconfig *it) { struct pci_dev *pcidev = NULL; - struct comedi_subdevice *s; - int ret; - - printk("comedi%d: contec: ", dev->minor); - - dev->board_name = thisboard->name; - - if (alloc_private(dev, sizeof(struct contec_private)) < 0) - return -ENOMEM; - - ret = comedi_alloc_subdevices(dev, 2); - if (ret) - return ret; for_each_pci_dev(pcidev) { if (pcidev->vendor == PCI_VENDOR_ID_CONTEC && @@ -124,43 +112,63 @@ static int contec_attach(struct comedi_device *dev, struct comedi_devconfig *it) continue; } } - devpriv->pci_dev = pcidev; - if (comedi_pci_enable(pcidev, "contec_pci_dio")) { - printk - ("error enabling PCI device and request regions!\n"); - return -EIO; - } - dev->iobase = pci_resource_start(pcidev, 0); - printk(" base addr %lx ", dev->iobase); - dev->board_ptr = contec_boards + 0; + return pcidev; + } + } + printk("card not present!\n"); + return NULL; +} - s = dev->subdevices + 0; +static int contec_attach(struct comedi_device *dev, struct comedi_devconfig *it) +{ + struct pci_dev *pcidev; + struct comedi_subdevice *s; + int ret; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = contec_di_insn_bits; + printk("comedi%d: contec: ", dev->minor); - s = dev->subdevices + 1; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = contec_do_insn_bits; + dev->board_name = thisboard->name; - printk("attached\n"); + if (alloc_private(dev, sizeof(struct contec_private)) < 0) + return -ENOMEM; - return 1; - } + ret = comedi_alloc_subdevices(dev, 2); + if (ret) + return ret; + + pcidev = contec_find_pci_dev(dev, it); + if (!pcidev) + return -EIO; + devpriv->pci_dev = pcidev; + + if (comedi_pci_enable(pcidev, "contec_pci_dio")) { + printk("error enabling PCI device and request regions!\n"); + return -EIO; } + dev->iobase = pci_resource_start(pcidev, 0); + printk(" base addr %lx ", dev->iobase); - printk("card not present!\n"); + s = dev->subdevices + 0; + + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = contec_di_insn_bits; + + s = dev->subdevices + 1; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = contec_do_insn_bits; + + printk("attached\n"); - return -EIO; + return 1; } static void contec_detach(struct comedi_device *dev) -- cgit v0.10.2 From b8acd7750a2366216d9ec81f96b0594f6bb86707 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:50:16 -0700 Subject: staging: comedi: contec_pci_dio: cleanup "find pci device" code Add a couple local variables and reorder the tests to make to make the more concise. Change the printk to a dev_err when no match is found and reword the message. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/contec_pci_dio.c b/drivers/staging/comedi/drivers/contec_pci_dio.c index e4d37fc..b75a8af 100644 --- a/drivers/staging/comedi/drivers/contec_pci_dio.c +++ b/drivers/staging/comedi/drivers/contec_pci_dio.c @@ -101,22 +101,25 @@ static struct pci_dev *contec_find_pci_dev(struct comedi_device *dev, struct comedi_devconfig *it) { struct pci_dev *pcidev = NULL; + int bus = it->options[0]; + int slot = it->options[1]; for_each_pci_dev(pcidev) { - if (pcidev->vendor == PCI_VENDOR_ID_CONTEC && - pcidev->device == PCI_DEVICE_ID_PIO1616L) { - if (it->options[0] || it->options[1]) { - /* Check bus and slot. */ - if (it->options[0] != pcidev->bus->number || - it->options[1] != PCI_SLOT(pcidev->devfn)) { - continue; - } - } - dev->board_ptr = contec_boards + 0; - return pcidev; + if (bus || slot) { + if (bus != pcidev->bus->number || + slot != PCI_SLOT(pcidev->devfn)) + continue; } + if (pcidev->vendor != PCI_VENDOR_ID_CONTEC || + pcidev->device != PCI_DEVICE_ID_PIO1616L) + continue; + + dev->board_ptr = contec_boards + 0; + return pcidev; } - printk("card not present!\n"); + dev_err(dev->class_dev, + "No supported board found! (req. bus %d, slot %d)\n", + bus, slot); return NULL; } -- cgit v0.10.2 From e3ab476bee2c4b038ca9c8e3a2c2fd79f7403749 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:50:42 -0700 Subject: staging: comedi: contec_pci_dio: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/contec_pci_dio.c b/drivers/staging/comedi/drivers/contec_pci_dio.c index b75a8af..5578c2c 100644 --- a/drivers/staging/comedi/drivers/contec_pci_dio.c +++ b/drivers/staging/comedi/drivers/contec_pci_dio.c @@ -59,9 +59,6 @@ static const struct contec_board contec_boards[] = { struct contec_private { int data; - - struct pci_dev *pci_dev; - }; #define devpriv ((struct contec_private *)dev->private) @@ -143,7 +140,7 @@ static int contec_attach(struct comedi_device *dev, struct comedi_devconfig *it) pcidev = contec_find_pci_dev(dev, it); if (!pcidev) return -EIO; - devpriv->pci_dev = pcidev; + comedi_set_hw_dev(dev, &pcidev->dev); if (comedi_pci_enable(pcidev, "contec_pci_dio")) { printk("error enabling PCI device and request regions!\n"); @@ -176,10 +173,12 @@ static int contec_attach(struct comedi_device *dev, struct comedi_devconfig *it) static void contec_detach(struct comedi_device *dev) { - if (devpriv && devpriv->pci_dev) { + struct pci_dev *pcidev = comedi_to_pci_dev(dev); + + if (pcidev) { if (dev->iobase) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); } } -- cgit v0.10.2 From 49cd97b9beef15f7e946b659d45820f8812a3fe1 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:50:59 -0700 Subject: staging: comedi: contec_pci_dio: remove the private data The private data is no longer needed by this driver. Remove the struct, devpriv macro, and the allocation. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/contec_pci_dio.c b/drivers/staging/comedi/drivers/contec_pci_dio.c index 5578c2c..944cfee 100644 --- a/drivers/staging/comedi/drivers/contec_pci_dio.c +++ b/drivers/staging/comedi/drivers/contec_pci_dio.c @@ -57,12 +57,6 @@ static const struct contec_board contec_boards[] = { #define thisboard ((const struct contec_board *)dev->board_ptr) -struct contec_private { - int data; -}; - -#define devpriv ((struct contec_private *)dev->private) - static int contec_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -130,9 +124,6 @@ static int contec_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->board_name = thisboard->name; - if (alloc_private(dev, sizeof(struct contec_private)) < 0) - return -ENOMEM; - ret = comedi_alloc_subdevices(dev, 2); if (ret) return ret; -- cgit v0.10.2 From 6896ddfa109b32bef1892a3cbeb5c90d78d568c5 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:51:18 -0700 Subject: staging: comedi: daqboard2000: factor out the "find pci device" code Factor the "find pci device" code out of the attach function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c index 8455cb9..fe2f39c 100644 --- a/drivers/staging/comedi/drivers/daqboard2000.c +++ b/drivers/staging/comedi/drivers/daqboard2000.c @@ -703,48 +703,38 @@ static int daqboard2000_8255_cb(int dir, int port, int data, return result; } -static int daqboard2000_attach(struct comedi_device *dev, - struct comedi_devconfig *it) +static struct pci_dev *daqboard2000_find_pci_dev(struct comedi_device *dev, + struct comedi_devconfig *it) { - int result = 0; - struct comedi_subdevice *s; - struct pci_dev *card = NULL; - void *aux_data; - unsigned int aux_len; - int bus, slot; - - bus = it->options[0]; - slot = it->options[1]; + struct pci_dev *pcidev = NULL; + int bus = it->options[0]; + int slot = it->options[1]; - result = alloc_private(dev, sizeof(struct daqboard2000_private)); - if (result < 0) - return -ENOMEM; - - for (card = pci_get_device(0x1616, 0x0409, NULL); - card != NULL; card = pci_get_device(0x1616, 0x0409, card)) { + for (pcidev = pci_get_device(0x1616, 0x0409, NULL); + pcidev != NULL; pcidev = pci_get_device(0x1616, 0x0409, pcidev)) { if (bus || slot) { /* requested particular bus/slot */ - if (card->bus->number != bus || - PCI_SLOT(card->devfn) != slot) { + if (pcidev->bus->number != bus || + PCI_SLOT(pcidev->devfn) != slot) { continue; } } break; /* found one */ } - if (!card) { + if (!pcidev) { if (bus || slot) dev_err(dev->class_dev, "no daqboard2000 found at bus/slot: %d/%d\n", bus, slot); else dev_err(dev->class_dev, "no daqboard2000 found\n"); - return -EIO; + return NULL; } else { u32 id; int i; - devpriv->pci_dev = card; - id = ((u32) card-> - subsystem_device << 16) | card->subsystem_vendor; + + id = ((u32) pcidev-> + subsystem_device << 16) | pcidev->subsystem_vendor; for (i = 0; i < ARRAY_SIZE(boardtypes); i++) { if (boardtypes[i].id == id) { dev_dbg(dev->class_dev, "%s\n", @@ -758,9 +748,29 @@ static int daqboard2000_attach(struct comedi_device *dev, id); dev->board_ptr = boardtypes; } + return pcidev; } +} + +static int daqboard2000_attach(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + struct pci_dev *pcidev; + struct comedi_subdevice *s; + void *aux_data; + unsigned int aux_len; + int result; + + result = alloc_private(dev, sizeof(struct daqboard2000_private)); + if (result < 0) + return -ENOMEM; + + pcidev = daqboard2000_find_pci_dev(dev, it); + if (!pcidev) + return -EIO; + devpriv->pci_dev = pcidev; - result = comedi_pci_enable(card, "daqboard2000"); + result = comedi_pci_enable(pcidev, "daqboard2000"); if (result < 0) { dev_err(dev->class_dev, "failed to enable PCI device and request regions\n"); @@ -768,9 +778,9 @@ static int daqboard2000_attach(struct comedi_device *dev, } devpriv->got_regions = 1; devpriv->plx = - ioremap(pci_resource_start(card, 0), DAQBOARD2000_PLX_SIZE); + ioremap(pci_resource_start(pcidev, 0), DAQBOARD2000_PLX_SIZE); devpriv->daq = - ioremap(pci_resource_start(card, 2), DAQBOARD2000_DAQ_SIZE); + ioremap(pci_resource_start(pcidev, 2), DAQBOARD2000_DAQ_SIZE); if (!devpriv->plx || !devpriv->daq) return -ENOMEM; @@ -783,7 +793,7 @@ static int daqboard2000_attach(struct comedi_device *dev, /* u8 interrupt; Windows code does restore interrupts, but since we don't use them... - pci_read_config_byte(card, PCI_INTERRUPT_LINE, &interrupt); + pci_read_config_byte(pcidev, PCI_INTERRUPT_LINE, &interrupt); printk("Interrupt before is: %x\n", interrupt); */ @@ -803,7 +813,7 @@ static int daqboard2000_attach(struct comedi_device *dev, daqboard2000_initializeDac(dev); /* Windows code does restore interrupts, but since we don't use them... - pci_read_config_byte(card, PCI_INTERRUPT_LINE, &interrupt); + pci_read_config_byte(pcidev, PCI_INTERRUPT_LINE, &interrupt); printk("Interrupt after is: %x\n", interrupt); */ -- cgit v0.10.2 From f34ec8002b685e865e26c384887b90149949c5bf Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:56:29 -0700 Subject: staging: comedi: daqboard2000: cleanup "find pci device" code The "find pci device" code for this driver was quite a bit different from the other comedi pci drivers. Clean it up so it follows the format of the other drivers. Use for_each_pci_dev() instead of open-coding the loop using pci_get_device(). Check for a specific bus/slot then the vendor/device ids. The loop checking for the matching boardinfo was creating an "id" based on the subsystem_device and subsystem_vendor info from the pci_dev. The vendor id was already checked so just check against the subsystem_device. Only return the pci_dev if a matching boardinfo is found. Consolidate the dev_err messages when a device is not found into a single message. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c index fe2f39c..eb07466 100644 --- a/drivers/staging/comedi/drivers/daqboard2000.c +++ b/drivers/staging/comedi/drivers/daqboard2000.c @@ -120,8 +120,10 @@ Configuration options: #include "8255.h" -#define DAQBOARD2000_SUBSYSTEM_IDS2 0x00021616 /* Daqboard/2000 - 2 Dacs */ -#define DAQBOARD2000_SUBSYSTEM_IDS4 0x00041616 /* Daqboard/2000 - 4 Dacs */ +#define PCI_VENDOR_ID_IOTECH 0x1616 + +#define DAQBOARD2000_SUBSYSTEM_IDS2 0x0002 /* Daqboard/2000 - 2 Dacs */ +#define DAQBOARD2000_SUBSYSTEM_IDS4 0x0004 /* Daqboard/2000 - 4 Dacs */ #define DAQBOARD2000_DAQ_SIZE 0x1002 #define DAQBOARD2000_PLX_SIZE 0x100 @@ -709,47 +711,29 @@ static struct pci_dev *daqboard2000_find_pci_dev(struct comedi_device *dev, struct pci_dev *pcidev = NULL; int bus = it->options[0]; int slot = it->options[1]; + int i; - for (pcidev = pci_get_device(0x1616, 0x0409, NULL); - pcidev != NULL; pcidev = pci_get_device(0x1616, 0x0409, pcidev)) { + for_each_pci_dev(pcidev) { if (bus || slot) { - /* requested particular bus/slot */ - if (pcidev->bus->number != bus || - PCI_SLOT(pcidev->devfn) != slot) { + if (bus != pcidev->bus->number || + slot != PCI_SLOT(pcidev->devfn)) continue; - } } - break; /* found one */ - } - if (!pcidev) { - if (bus || slot) - dev_err(dev->class_dev, - "no daqboard2000 found at bus/slot: %d/%d\n", - bus, slot); - else - dev_err(dev->class_dev, "no daqboard2000 found\n"); - return NULL; - } else { - u32 id; - int i; + if (pcidev->vendor != PCI_VENDOR_ID_IOTECH || + pcidev->device != 0x0409) + continue; - id = ((u32) pcidev-> - subsystem_device << 16) | pcidev->subsystem_vendor; for (i = 0; i < ARRAY_SIZE(boardtypes); i++) { - if (boardtypes[i].id == id) { - dev_dbg(dev->class_dev, "%s\n", - boardtypes[i].name); - dev->board_ptr = boardtypes + i; - } - } - if (!dev->board_ptr) { - printk - (" unknown subsystem id %08x (pretend it is an ids2)", - id); - dev->board_ptr = boardtypes; + if (boardtypes[i].id != pcidev->subsystem_device) + continue; + dev->board_ptr = boardtypes + i; + return pcidev; } - return pcidev; } + dev_err(dev->class_dev, + "No supported board found! (req. bus %d, slot %d)\n", + bus, slot); + return NULL; } static int daqboard2000_attach(struct comedi_device *dev, @@ -886,7 +870,7 @@ static void __devexit daqboard2000_pci_remove(struct pci_dev *dev) } static DEFINE_PCI_DEVICE_TABLE(daqboard2000_pci_table) = { - { PCI_DEVICE(0x1616, 0x0409) }, + { PCI_DEVICE(PCI_VENDOR_ID_IOTECH, 0x0409) }, { 0 } }; MODULE_DEVICE_TABLE(pci, daqboard2000_pci_table); -- cgit v0.10.2 From f55354b0a8a3c6d3e5fc64b3da37510711aaf352 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:56:49 -0700 Subject: staging: comedi: daqboard2000: remove 'got_regions' from private data The 'got_regions' variable in the private data is used as a flag for the detach to know if the pci device has been enabled. Typically the dev->iobase variable is used to indicate this in all the other comedi drivers. Do the same here for consistancy. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c index eb07466..1d94b58 100644 --- a/drivers/staging/comedi/drivers/daqboard2000.c +++ b/drivers/staging/comedi/drivers/daqboard2000.c @@ -320,7 +320,6 @@ struct daqboard2000_private { struct pci_dev *pci_dev; void *daq; void *plx; - int got_regions; unsigned int ao_readback[2]; }; @@ -760,11 +759,11 @@ static int daqboard2000_attach(struct comedi_device *dev, "failed to enable PCI device and request regions\n"); return -EIO; } - devpriv->got_regions = 1; + dev->iobase = pci_resource_start(pcidev, 2); + devpriv->plx = ioremap(pci_resource_start(pcidev, 0), DAQBOARD2000_PLX_SIZE); - devpriv->daq = - ioremap(pci_resource_start(pcidev, 2), DAQBOARD2000_DAQ_SIZE); + devpriv->daq = ioremap(dev->iobase, DAQBOARD2000_DAQ_SIZE); if (!devpriv->plx || !devpriv->daq) return -ENOMEM; @@ -844,7 +843,7 @@ static void daqboard2000_detach(struct comedi_device *dev) if (devpriv->plx) iounmap(devpriv->plx); if (devpriv->pci_dev) { - if (devpriv->got_regions) + if (dev->iobase) comedi_pci_disable(devpriv->pci_dev); pci_dev_put(devpriv->pci_dev); } -- cgit v0.10.2 From ad196be73d4c5fd433cec22a306dcbab3fc7e25c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:57:08 -0700 Subject: staging: comedi: daqboard2000: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c index 1d94b58..ba61e32 100644 --- a/drivers/staging/comedi/drivers/daqboard2000.c +++ b/drivers/staging/comedi/drivers/daqboard2000.c @@ -317,7 +317,6 @@ struct daqboard2000_private { enum { card_daqboard_2000 } card; - struct pci_dev *pci_dev; void *daq; void *plx; unsigned int ao_readback[2]; @@ -751,7 +750,7 @@ static int daqboard2000_attach(struct comedi_device *dev, pcidev = daqboard2000_find_pci_dev(dev, it); if (!pcidev) return -EIO; - devpriv->pci_dev = pcidev; + comedi_set_hw_dev(dev, &pcidev->dev); result = comedi_pci_enable(pcidev, "daqboard2000"); if (result < 0) { @@ -833,6 +832,8 @@ out: static void daqboard2000_detach(struct comedi_device *dev) { + struct pci_dev *pcidev = comedi_to_pci_dev(dev); + if (dev->subdevices) subdev_8255_cleanup(dev, dev->subdevices + 2); if (dev->irq) @@ -842,11 +843,11 @@ static void daqboard2000_detach(struct comedi_device *dev) iounmap(devpriv->daq); if (devpriv->plx) iounmap(devpriv->plx); - if (devpriv->pci_dev) { - if (dev->iobase) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); - } + } + if (pcidev) { + if (dev->iobase) + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); } } -- cgit v0.10.2 From d73805ceb1cf7fd86863de25a8038e5c1651172e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:57:28 -0700 Subject: staging: comedi: daqboard2000: void *plx should be a void __iomem * The private data variable 'plx' is an ioremap'ed pci resource and should be a void __iomem *. This quiets a number of sparse warnings about "different address spaces". Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c index ba61e32..ef28385 100644 --- a/drivers/staging/comedi/drivers/daqboard2000.c +++ b/drivers/staging/comedi/drivers/daqboard2000.c @@ -318,7 +318,7 @@ struct daqboard2000_private { card_daqboard_2000 } card; void *daq; - void *plx; + void __iomem *plx; unsigned int ao_readback[2]; }; -- cgit v0.10.2 From 606f1295cfe8fd3fe8b4e4f7ca393a5db5e89e44 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:57:49 -0700 Subject: staging: comedi: dt3000: cleanup "find pci device" code The "find pci device" code for this driver was split between two functions which could cause the driver to walk the pci bus multiple times while looking for a match. Consolidate the functions into the format that is more standard for the comedi pci drivers. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c index d1d99a3..10b43a2 100644 --- a/drivers/staging/comedi/drivers/dt3000.c +++ b/drivers/staging/comedi/drivers/dt3000.c @@ -159,7 +159,6 @@ static const struct dt3k_boardtype dt3k_boardtypes[] = { }, }; -#define n_dt3k_boards sizeof(dt3k_boardtypes)/sizeof(struct dt3k_boardtype) #define this_board ((const struct dt3k_boardtype *)dev->board_ptr) #define DT3000_SIZE (4*0x1000) @@ -797,87 +796,65 @@ static int setup_pci(struct comedi_device *dev) return 0; } -static struct pci_dev *dt_pci_find_device(struct pci_dev *from, int *board) +static struct pci_dev *dt3000_find_pci_dev(struct comedi_device *dev, + struct comedi_devconfig *it) { + struct pci_dev *pcidev = NULL; + int bus = it->options[0]; + int slot = it->options[1]; int i; - for (from = pci_get_device(PCI_VENDOR_ID_DT, PCI_ANY_ID, from); - from != NULL; - from = pci_get_device(PCI_VENDOR_ID_DT, PCI_ANY_ID, from)) { - for (i = 0; i < n_dt3k_boards; i++) { - if (from->device == dt3k_boardtypes[i].device_id) { - *board = i; - return from; - } + for_each_pci_dev(pcidev) { + if (bus || slot) { + if (bus != pcidev->bus->number || + slot != PCI_SLOT(pcidev->devfn)) + continue; } - printk - ("unknown Data Translation PCI device found with device_id=0x%04x\n", - from->device); - } - *board = -1; - return from; -} - -static int dt_pci_probe(struct comedi_device *dev, int bus, int slot) -{ - int board; - int ret; - struct pci_dev *pcidev; - - pcidev = NULL; - while ((pcidev = dt_pci_find_device(pcidev, &board)) != NULL) { - if ((bus == 0 && slot == 0) || - (pcidev->bus->number == bus && - PCI_SLOT(pcidev->devfn) == slot)) { - break; + if (pcidev->vendor != PCI_VENDOR_ID_DT) + continue; + for (i = 0; i < ARRAY_SIZE(dt3k_boardtypes); i++) { + if (dt3k_boardtypes[i].device_id != pcidev->device) + continue; + dev->board_ptr = dt3k_boardtypes + i; + return pcidev; } } - devpriv->pci_dev = pcidev; - - if (board >= 0) - dev->board_ptr = dt3k_boardtypes + board; - - if (!devpriv->pci_dev) - return 0; - - ret = setup_pci(dev); - if (ret < 0) - return ret; - - return 1; + dev_err(dev->class_dev, + "No supported board found! (req. bus %d, slot %d)\n", + bus, slot); + return NULL; } static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + struct pci_dev *pcidev; struct comedi_subdevice *s; - int bus, slot; int ret = 0; dev_dbg(dev->class_dev, "dt3000:\n"); - bus = it->options[0]; - slot = it->options[1]; ret = alloc_private(dev, sizeof(struct dt3k_private)); if (ret < 0) return ret; - ret = dt_pci_probe(dev, bus, slot); + pcidev = dt3000_find_pci_dev(dev, it); + if (!pcidev) + return -EIO; + devpriv->pci_dev = pcidev; + + ret = setup_pci(dev); if (ret < 0) return ret; - if (ret == 0) { - dev_warn(dev->class_dev, "no DT board found\n"); - return -ENODEV; - } dev->board_name = this_board->name; - if (request_irq(devpriv->pci_dev->irq, dt3k_interrupt, IRQF_SHARED, + if (request_irq(pcidev->irq, dt3k_interrupt, IRQF_SHARED, "dt3000", dev)) { dev_err(dev->class_dev, "unable to allocate IRQ %u\n", - devpriv->pci_dev->irq); + pcidev->irq); return -EINVAL; } - dev->irq = devpriv->pci_dev->irq; + dev->irq = pcidev->irq; ret = comedi_alloc_subdevices(dev, 4); if (ret) -- cgit v0.10.2 From 5512a35b38f9cafc217ad123f9e8eea12c585208 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:58:07 -0700 Subject: staging: comedi: dt3000: move the setup_pci() code into the attach The setup_pci() function simply calls comedi_pci_enable() to enable the device then ioremaps the pci address. Move the code directly into the attach function as is more typical for the comedi pci drivers. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c index 10b43a2..92558e7 100644 --- a/drivers/staging/comedi/drivers/dt3000.c +++ b/drivers/staging/comedi/drivers/dt3000.c @@ -774,28 +774,6 @@ static int dt3k_mem_insn_read(struct comedi_device *dev, return i; } -static int setup_pci(struct comedi_device *dev) -{ - resource_size_t addr; - int ret; - - ret = comedi_pci_enable(devpriv->pci_dev, "dt3000"); - if (ret < 0) - return ret; - - addr = pci_resource_start(devpriv->pci_dev, 0); - devpriv->phys_addr = addr; - devpriv->io_addr = ioremap(devpriv->phys_addr, DT3000_SIZE); - if (!devpriv->io_addr) - return -ENOMEM; -#if DEBUG - printk("0x%08llx mapped to %p, ", - (unsigned long long)devpriv->phys_addr, devpriv->io_addr); -#endif - - return 0; -} - static struct pci_dev *dt3000_find_pci_dev(struct comedi_device *dev, struct comedi_devconfig *it) { @@ -842,10 +820,15 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it) return -EIO; devpriv->pci_dev = pcidev; - ret = setup_pci(dev); + ret = comedi_pci_enable(pcidev, "dt3000"); if (ret < 0) return ret; + devpriv->phys_addr = pci_resource_start(pcidev, 0); + devpriv->io_addr = ioremap(devpriv->phys_addr, DT3000_SIZE); + if (!devpriv->io_addr) + return -ENOMEM; + dev->board_name = this_board->name; if (request_irq(pcidev->irq, dt3k_interrupt, IRQF_SHARED, -- cgit v0.10.2 From 2d49c815233f8c6a7977c0cf7539849aa51cb633 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:58:24 -0700 Subject: staging: comedi: dt3000: remove 'phys_addr' from the private data The 'phys_addr' variable in the private data is simply used as a flag for the detach function to know that the pci device has been enabled. Use the 'dev->iobase' variable instead as is more typical for other comedi pci drivers. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c index 92558e7..3937e87 100644 --- a/drivers/staging/comedi/drivers/dt3000.c +++ b/drivers/staging/comedi/drivers/dt3000.c @@ -250,7 +250,6 @@ static const struct dt3k_boardtype dt3k_boardtypes[] = { struct dt3k_private { struct pci_dev *pci_dev; - resource_size_t phys_addr; void __iomem *io_addr; unsigned int lock; unsigned int ao_readback[2]; @@ -824,8 +823,8 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (ret < 0) return ret; - devpriv->phys_addr = pci_resource_start(pcidev, 0); - devpriv->io_addr = ioremap(devpriv->phys_addr, DT3000_SIZE); + dev->iobase = pci_resource_start(pcidev, 0); + devpriv->io_addr = ioremap(dev->iobase, DT3000_SIZE); if (!devpriv->io_addr) return -ENOMEM; @@ -905,7 +904,7 @@ static void dt3000_detach(struct comedi_device *dev) free_irq(dev->irq, dev); if (devpriv) { if (devpriv->pci_dev) { - if (devpriv->phys_addr) + if (dev->iobase) comedi_pci_disable(devpriv->pci_dev); pci_dev_put(devpriv->pci_dev); } -- cgit v0.10.2 From 9e9e13f53f739c86070a4ad09e49a4e7543dd31d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:58:43 -0700 Subject: staging: comedi: dt3000: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c index 3937e87..a6fe6c9 100644 --- a/drivers/staging/comedi/drivers/dt3000.c +++ b/drivers/staging/comedi/drivers/dt3000.c @@ -248,8 +248,6 @@ static const struct dt3k_boardtype dt3k_boardtypes[] = { #define DT3000_CHANNEL_MODE_DI 1 struct dt3k_private { - - struct pci_dev *pci_dev; void __iomem *io_addr; unsigned int lock; unsigned int ao_readback[2]; @@ -817,7 +815,7 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it) pcidev = dt3000_find_pci_dev(dev, it); if (!pcidev) return -EIO; - devpriv->pci_dev = pcidev; + comedi_set_hw_dev(dev, &pcidev->dev); ret = comedi_pci_enable(pcidev, "dt3000"); if (ret < 0) @@ -900,17 +898,19 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it) static void dt3000_detach(struct comedi_device *dev) { + struct pci_dev *pcidev = comedi_to_pci_dev(dev); + if (dev->irq) free_irq(dev->irq, dev); if (devpriv) { - if (devpriv->pci_dev) { - if (dev->iobase) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); - } if (devpriv->io_addr) iounmap(devpriv->io_addr); } + if (pcidev) { + if (dev->iobase) + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); + } } static struct comedi_driver dt3000_driver = { -- cgit v0.10.2 From 1f20b973f68346af2712e5d014932d984b6f5387 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:59:00 -0700 Subject: staging: comedi: dyna_pci10xx: factor out the "find pci device" code Factor the "find pci device" code out of the attach function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dyna_pci10xx.c b/drivers/staging/comedi/drivers/dyna_pci10xx.c index d0e3679..81af215 100644 --- a/drivers/staging/comedi/drivers/dyna_pci10xx.c +++ b/drivers/staging/comedi/drivers/dyna_pci10xx.c @@ -229,36 +229,15 @@ static int dyna_pci10xx_do_insn_bits(struct comedi_device *dev, return insn->n; } -/******************************************************************************/ -/*********************** INITIALIZATION FUNCTIONS *****************************/ -/******************************************************************************/ - -static int dyna_pci10xx_attach(struct comedi_device *dev, - struct comedi_devconfig *it) +static struct pci_dev *dyna_pci10xx_find_pci_dev(struct comedi_device *dev, + struct comedi_devconfig *it) { - struct comedi_subdevice *s; - struct pci_dev *pcidev; - unsigned int opt_bus, opt_slot; - int board_index, i; - int ret; - - mutex_lock(&start_stop_sem); - - if (alloc_private(dev, sizeof(struct dyna_pci10xx_private)) < 0) { - printk(KERN_ERR "comedi: dyna_pci10xx: " - "failed to allocate memory!\n"); - mutex_unlock(&start_stop_sem); - return -ENOMEM; - } - - opt_bus = it->options[0]; - opt_slot = it->options[1]; - dev->board_name = thisboard->name; - dev->irq = 0; + struct pci_dev *pcidev = NULL; + int opt_bus = it->options[0]; + int opt_slot = it->options[1]; + int board_index; + int i; - /* - * Probe the PCI bus and located the matching device - */ for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pcidev != NULL; pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { @@ -285,8 +264,7 @@ static int dyna_pci10xx_attach(struct comedi_device *dev, goto found; } printk(KERN_ERR "comedi: dyna_pci10xx: no supported device found!\n"); - mutex_unlock(&start_stop_sem); - return -EIO; + return NULL; found: @@ -299,9 +277,38 @@ found: printk(KERN_ERR "comedi: dyna_pci10xx: " "invalid PCI device\n"); } + return NULL; + } + + dev->board_ptr = &boardtypes[board_index]; + return pcidev; +} + +static int dyna_pci10xx_attach(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + struct pci_dev *pcidev; + struct comedi_subdevice *s; + int ret; + + mutex_lock(&start_stop_sem); + + if (alloc_private(dev, sizeof(struct dyna_pci10xx_private)) < 0) { + printk(KERN_ERR "comedi: dyna_pci10xx: " + "failed to allocate memory!\n"); + mutex_unlock(&start_stop_sem); + return -ENOMEM; + } + + pcidev = dyna_pci10xx_find_pci_dev(dev, it); + if (!pcidev) { mutex_unlock(&start_stop_sem); return -EIO; } + devpriv->pci_dev = pcidev; + + dev->board_name = thisboard->name; + dev->irq = 0; if (comedi_pci_enable(pcidev, DRV_NAME)) { printk(KERN_ERR "comedi: dyna_pci10xx: " @@ -311,8 +318,6 @@ found: } mutex_init(&devpriv->mutex); - dev->board_ptr = &boardtypes[board_index]; - devpriv->pci_dev = pcidev; printk(KERN_INFO "comedi: dyna_pci10xx: device found!\n"); @@ -375,7 +380,7 @@ found: mutex_unlock(&start_stop_sem); printk(KERN_INFO "comedi: dyna_pci10xx: %s - device setup completed!\n", - boardtypes[board_index].name); + thisboard->name); return 1; } -- cgit v0.10.2 From 5d30e51909b61916744e45d3c50cf42569c92c20 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:59:17 -0700 Subject: staging: comedi: dyna_pci10xx: cleanup "find pci device" code Cleanup the "find pci device" code so that it follows the style of the other comedi pci drivers. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dyna_pci10xx.c b/drivers/staging/comedi/drivers/dyna_pci10xx.c index 81af215..bd804f1 100644 --- a/drivers/staging/comedi/drivers/dyna_pci10xx.c +++ b/drivers/staging/comedi/drivers/dyna_pci10xx.c @@ -233,55 +233,31 @@ static struct pci_dev *dyna_pci10xx_find_pci_dev(struct comedi_device *dev, struct comedi_devconfig *it) { struct pci_dev *pcidev = NULL; - int opt_bus = it->options[0]; - int opt_slot = it->options[1]; - int board_index; + int bus = it->options[0]; + int slot = it->options[1]; int i; - for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); - pcidev != NULL; - pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { - - board_index = -1; - for (i = 0; i < ARRAY_SIZE(boardtypes); ++i) { - if ((pcidev->vendor == PCI_VENDOR_ID_DYNALOG) && - (pcidev->device == boardtypes[i].device_id)) { - board_index = i; - break; - } + for_each_pci_dev(pcidev) { + if (bus || slot) { + if (bus != pcidev->bus->number || + slot != PCI_SLOT(pcidev->devfn)) + continue; } - if (board_index < 0) + if (pcidev->vendor != PCI_VENDOR_ID_DYNALOG) continue; - /* Found matching vendor/device. */ - if (opt_bus || opt_slot) { - /* Check bus/slot. */ - if (opt_bus != pcidev->bus->number - || opt_slot != PCI_SLOT(pcidev->devfn)) - continue; /* no match */ - } - - goto found; - } - printk(KERN_ERR "comedi: dyna_pci10xx: no supported device found!\n"); - return NULL; - -found: + for (i = 0; i < ARRAY_SIZE(boardtypes); ++i) { + if (pcidev->device != boardtypes[i].device_id) + continue; - if (!pcidev) { - if (opt_bus || opt_slot) { - printk(KERN_ERR "comedi: dyna_pci10xx: " - "invalid PCI device at b:s %d:%d\n", - opt_bus, opt_slot); - } else { - printk(KERN_ERR "comedi: dyna_pci10xx: " - "invalid PCI device\n"); + dev->board_ptr = &boardtypes[i]; + return pcidev; } - return NULL; } - - dev->board_ptr = &boardtypes[board_index]; - return pcidev; + dev_err(dev->class_dev, + "No supported board found! (req. bus %d, slot %d)\n", + bus, slot); + return NULL; } static int dyna_pci10xx_attach(struct comedi_device *dev, -- cgit v0.10.2 From 6bdae560f46cddc8aeff5bd9c76454168ee8e8ab Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 18:59:35 -0700 Subject: staging: comedi: dyna_pci10xx: remove the 'start_stop_sem' mutex The comedi core already has a mutex protecting the attach/detach of the comedi drivers. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dyna_pci10xx.c b/drivers/staging/comedi/drivers/dyna_pci10xx.c index bd804f1..82002c4 100644 --- a/drivers/staging/comedi/drivers/dyna_pci10xx.c +++ b/drivers/staging/comedi/drivers/dyna_pci10xx.c @@ -45,8 +45,6 @@ #define READ_TIMEOUT 50 -static DEFINE_MUTEX(start_stop_sem); - static const struct comedi_lrange range_pci1050_ai = { 3, { BIP_RANGE(10), BIP_RANGE(5), @@ -267,20 +265,15 @@ static int dyna_pci10xx_attach(struct comedi_device *dev, struct comedi_subdevice *s; int ret; - mutex_lock(&start_stop_sem); - if (alloc_private(dev, sizeof(struct dyna_pci10xx_private)) < 0) { printk(KERN_ERR "comedi: dyna_pci10xx: " "failed to allocate memory!\n"); - mutex_unlock(&start_stop_sem); return -ENOMEM; } pcidev = dyna_pci10xx_find_pci_dev(dev, it); - if (!pcidev) { - mutex_unlock(&start_stop_sem); + if (!pcidev) return -EIO; - } devpriv->pci_dev = pcidev; dev->board_name = thisboard->name; @@ -289,7 +282,6 @@ static int dyna_pci10xx_attach(struct comedi_device *dev, if (comedi_pci_enable(pcidev, DRV_NAME)) { printk(KERN_ERR "comedi: dyna_pci10xx: " "failed to enable PCI device and request regions!"); - mutex_unlock(&start_stop_sem); return -EIO; } @@ -306,10 +298,8 @@ static int dyna_pci10xx_attach(struct comedi_device *dev, devpriv->BADR5 = pci_resource_start(pcidev, 5); ret = comedi_alloc_subdevices(dev, 4); - if (ret) { - mutex_unlock(&start_stop_sem); + if (ret) return ret; - } /* analog input */ s = dev->subdevices + 0; @@ -353,7 +343,6 @@ static int dyna_pci10xx_attach(struct comedi_device *dev, s->insn_bits = dyna_pci10xx_do_insn_bits; devpriv->valid = 1; - mutex_unlock(&start_stop_sem); printk(KERN_INFO "comedi: dyna_pci10xx: %s - device setup completed!\n", thisboard->name); -- cgit v0.10.2 From 423e0e3f551212df86d4e06287d253c2ae26e8dd Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 19:00:04 -0700 Subject: staging: comedi: dyna_pci10xx: remove 'valid' from the private data This variable is set at the end of the attach but never used in the driver. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dyna_pci10xx.c b/drivers/staging/comedi/drivers/dyna_pci10xx.c index 82002c4..24c5cd2 100644 --- a/drivers/staging/comedi/drivers/dyna_pci10xx.c +++ b/drivers/staging/comedi/drivers/dyna_pci10xx.c @@ -101,7 +101,6 @@ static const struct boardtype boardtypes[] = { struct dyna_pci10xx_private { struct pci_dev *pci_dev; /* ptr to PCI device */ - char valid; /* card is usable */ struct mutex mutex; /* device base address registers */ @@ -342,8 +341,6 @@ static int dyna_pci10xx_attach(struct comedi_device *dev, s->state = 0; s->insn_bits = dyna_pci10xx_do_insn_bits; - devpriv->valid = 1; - printk(KERN_INFO "comedi: dyna_pci10xx: %s - device setup completed!\n", thisboard->name); -- cgit v0.10.2 From 87790601cc603ea657fa667dd329fb21f318dfa9 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 19:00:37 -0700 Subject: staging: comedi: dyna_pci10xx: remove unused bars from the private data All of the pci device base address registers are saved in the private data but only bar2 and bar3 are used by the driver. Remove the others. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dyna_pci10xx.c b/drivers/staging/comedi/drivers/dyna_pci10xx.c index 24c5cd2..95ee422 100644 --- a/drivers/staging/comedi/drivers/dyna_pci10xx.c +++ b/drivers/staging/comedi/drivers/dyna_pci10xx.c @@ -104,7 +104,7 @@ struct dyna_pci10xx_private { struct mutex mutex; /* device base address registers */ - unsigned long BADR0, BADR1, BADR2, BADR3, BADR4, BADR5; + unsigned long BADR2, BADR3; }; #define thisboard ((const struct boardtype *)dev->board_ptr) @@ -288,13 +288,8 @@ static int dyna_pci10xx_attach(struct comedi_device *dev, printk(KERN_INFO "comedi: dyna_pci10xx: device found!\n"); - /* initialize device base address registers */ - devpriv->BADR0 = pci_resource_start(pcidev, 0); - devpriv->BADR1 = pci_resource_start(pcidev, 1); devpriv->BADR2 = pci_resource_start(pcidev, 2); devpriv->BADR3 = pci_resource_start(pcidev, 3); - devpriv->BADR4 = pci_resource_start(pcidev, 4); - devpriv->BADR5 = pci_resource_start(pcidev, 5); ret = comedi_alloc_subdevices(dev, 4); if (ret) -- cgit v0.10.2 From b694c4f4339bf4126e944def8318ff4f5cfbee76 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 19:00:54 -0700 Subject: staging: comedi: dyna_pci10xx: use dev->iobase Use dev->iobase to hold one of the pci base addresses used by the driver instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dyna_pci10xx.c b/drivers/staging/comedi/drivers/dyna_pci10xx.c index 95ee422..e7086b1 100644 --- a/drivers/staging/comedi/drivers/dyna_pci10xx.c +++ b/drivers/staging/comedi/drivers/dyna_pci10xx.c @@ -104,7 +104,7 @@ struct dyna_pci10xx_private { struct mutex mutex; /* device base address registers */ - unsigned long BADR2, BADR3; + unsigned long BADR3; }; #define thisboard ((const struct boardtype *)dev->board_ptr) @@ -132,11 +132,11 @@ static int dyna_pci10xx_insn_read_ai(struct comedi_device *dev, for (n = 0; n < insn->n; n++) { /* trigger conversion */ smp_mb(); - outw_p(0x0000 + range + chan, devpriv->BADR2 + 2); + outw_p(0x0000 + range + chan, dev->iobase + 2); udelay(10); /* read data */ for (counter = 0; counter < READ_TIMEOUT; counter++) { - d = inw_p(devpriv->BADR2); + d = inw_p(dev->iobase); /* check if read is successful if the EOC bit is set */ if (d & (1 << 15)) @@ -172,7 +172,7 @@ static int dyna_pci10xx_insn_write_ao(struct comedi_device *dev, for (n = 0; n < insn->n; n++) { smp_mb(); /* trigger conversion and write data */ - outw_p(data[n], devpriv->BADR2); + outw_p(data[n], dev->iobase); udelay(10); } mutex_unlock(&devpriv->mutex); @@ -288,7 +288,7 @@ static int dyna_pci10xx_attach(struct comedi_device *dev, printk(KERN_INFO "comedi: dyna_pci10xx: device found!\n"); - devpriv->BADR2 = pci_resource_start(pcidev, 2); + dev->iobase = pci_resource_start(pcidev, 2); devpriv->BADR3 = pci_resource_start(pcidev, 3); ret = comedi_alloc_subdevices(dev, 4); -- cgit v0.10.2 From 06183026d82cf58cdfba53b661914faf3c414029 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 19:01:13 -0700 Subject: staging: comedi: dyna_pci10xx: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dyna_pci10xx.c b/drivers/staging/comedi/drivers/dyna_pci10xx.c index e7086b1..6821f87 100644 --- a/drivers/staging/comedi/drivers/dyna_pci10xx.c +++ b/drivers/staging/comedi/drivers/dyna_pci10xx.c @@ -100,10 +100,7 @@ static const struct boardtype boardtypes[] = { }; struct dyna_pci10xx_private { - struct pci_dev *pci_dev; /* ptr to PCI device */ struct mutex mutex; - - /* device base address registers */ unsigned long BADR3; }; @@ -273,7 +270,7 @@ static int dyna_pci10xx_attach(struct comedi_device *dev, pcidev = dyna_pci10xx_find_pci_dev(dev, it); if (!pcidev) return -EIO; - devpriv->pci_dev = pcidev; + comedi_set_hw_dev(dev, &pcidev->dev); dev->board_name = thisboard->name; dev->irq = 0; @@ -344,9 +341,12 @@ static int dyna_pci10xx_attach(struct comedi_device *dev, static void dyna_pci10xx_detach(struct comedi_device *dev) { - if (devpriv && devpriv->pci_dev) { - comedi_pci_disable(devpriv->pci_dev); + struct pci_dev *pcidev = comedi_to_pci_dev(dev); + + if (devpriv) mutex_destroy(&devpriv->mutex); + if (pcidev) { + comedi_pci_disable(pcidev); } } -- cgit v0.10.2 From f2a64902e3c2ffa34b52e6ad13e8e3c40f6919c7 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 19:01:34 -0700 Subject: staging: comedi: dyna_pci10xx: fix detach The detach for this driver is missing the check to make sure that the pci device is enabled before disabling it. It's also missing the pci_dev_put(). Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/dyna_pci10xx.c b/drivers/staging/comedi/drivers/dyna_pci10xx.c index 6821f87..064be9a 100644 --- a/drivers/staging/comedi/drivers/dyna_pci10xx.c +++ b/drivers/staging/comedi/drivers/dyna_pci10xx.c @@ -346,7 +346,9 @@ static void dyna_pci10xx_detach(struct comedi_device *dev) if (devpriv) mutex_destroy(&devpriv->mutex); if (pcidev) { - comedi_pci_disable(pcidev); + if (dev->iobase) + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); } } -- cgit v0.10.2 From bd8a9bc167483acf21dc291a5860b4d66853e391 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 19:01:52 -0700 Subject: staging: comedi: ke_counter: factor out the "find pci device" code Factor the "find pci device" code out of the attach function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ke_counter.c b/drivers/staging/comedi/drivers/ke_counter.c index 019e91a..f0b8652 100644 --- a/drivers/staging/comedi/drivers/ke_counter.c +++ b/drivers/staging/comedi/drivers/ke_counter.c @@ -122,18 +122,12 @@ static int cnt_rinsn(struct comedi_device *dev, return 1; } -static int cnt_attach(struct comedi_device *dev, struct comedi_devconfig *it) +static struct pci_dev *cnt_find_pci_dev(struct comedi_device *dev, + struct comedi_devconfig *it) { - struct comedi_subdevice *subdevice; - struct pci_dev *pci_device = NULL; struct cnt_board_struct *board; - unsigned long io_base; - int error, i; - - /* allocate device private structure */ - error = alloc_private(dev, sizeof(struct cnt_device_private)); - if (error < 0) - return error; + struct pci_dev *pci_device = NULL; + int i; /* Probe the device to determine what device in the series it is. */ for_each_pci_dev(pci_device) { @@ -166,14 +160,35 @@ static int cnt_attach(struct comedi_device *dev, struct comedi_devconfig *it) printk(KERN_WARNING "comedi%d: no supported board found! (req. bus/slot: %d/%d)\n", dev->minor, it->options[0], it->options[1]); - return -EIO; + return NULL; found: printk(KERN_INFO "comedi%d: found %s at PCI bus %d, slot %d\n", dev->minor, board->name, pci_device->bus->number, PCI_SLOT(pci_device->devfn)); + return pci_device; +} + +static int cnt_attach(struct comedi_device *dev, struct comedi_devconfig *it) +{ + struct pci_dev *pci_device; + struct comedi_subdevice *subdevice; + struct cnt_board_struct *board; + unsigned long io_base; + int error; + + /* allocate device private structure */ + error = alloc_private(dev, sizeof(struct cnt_device_private)); + if (error < 0) + return error; + + pci_device = cnt_find_pci_dev(dev, it); + if (!pci_device) + return -EIO; devpriv->pcidev = pci_device; + board = (struct cnt_board_struct *)dev->board_ptr; + dev->board_name = board->name; /* enable PCI device and request regions */ -- cgit v0.10.2 From a890062bb785fcf8b160cb8b635aefffebfd0e8d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 19:02:11 -0700 Subject: staging: comedi: ke_counter: cleanup "find pci device" code Cleanup the "find pci device" code so that it follows the style of the other comedi pci drivers. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ke_counter.c b/drivers/staging/comedi/drivers/ke_counter.c index f0b8652..826e6c2 100644 --- a/drivers/staging/comedi/drivers/ke_counter.c +++ b/drivers/staging/comedi/drivers/ke_counter.c @@ -125,49 +125,35 @@ static int cnt_rinsn(struct comedi_device *dev, static struct pci_dev *cnt_find_pci_dev(struct comedi_device *dev, struct comedi_devconfig *it) { - struct cnt_board_struct *board; - struct pci_dev *pci_device = NULL; + const struct cnt_board_struct *board; + struct pci_dev *pcidev = NULL; + int bus = it->options[0]; + int slot = it->options[1]; int i; /* Probe the device to determine what device in the series it is. */ - for_each_pci_dev(pci_device) { - if (pci_device->vendor == PCI_VENDOR_ID_KOLTER) { - for (i = 0; i < cnt_board_nbr; i++) { - if (cnt_boards[i].device_id == - pci_device->device) { - /* was a particular bus/slot requested? */ - if ((it->options[0] != 0) - || (it->options[1] != 0)) { - /* are we on the wrong bus/slot? */ - if (pci_device->bus->number != - it->options[0] - || - PCI_SLOT(pci_device->devfn) - != it->options[1]) { - continue; - } - } - - dev->board_ptr = cnt_boards + i; - board = - (struct cnt_board_struct *) - dev->board_ptr; - goto found; - } - } + for_each_pci_dev(pcidev) { + if (bus || slot) { + if (pcidev->bus->number != bus || + PCI_SLOT(pcidev->devfn) != slot) + continue; + } + if (pcidev->vendor != PCI_VENDOR_ID_KOLTER) + continue; + + for (i = 0; i < cnt_board_nbr; i++) { + board = &cnt_boards[i]; + if (board->device_id != pcidev->device) + continue; + + dev->board_ptr = board; + return pcidev; } } - printk(KERN_WARNING - "comedi%d: no supported board found! (req. bus/slot: %d/%d)\n", - dev->minor, it->options[0], it->options[1]); + dev_err(dev->class_dev, + "No supported board found! (req. bus %d, slot %d)\n", + bus, slot); return NULL; - -found: - printk(KERN_INFO - "comedi%d: found %s at PCI bus %d, slot %d\n", dev->minor, - board->name, pci_device->bus->number, - PCI_SLOT(pci_device->devfn)); - return pci_device; } static int cnt_attach(struct comedi_device *dev, struct comedi_devconfig *it) -- cgit v0.10.2 From f32e6061d5756b795eca58549093d5de7cd6d952 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 19:02:29 -0700 Subject: staging: comedi: ke_counter: minor cleanup of cnt_attach() Cleanup the attach function a bit to follow the style of the other comedi pci drivers. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ke_counter.c b/drivers/staging/comedi/drivers/ke_counter.c index 826e6c2..78eb8d4 100644 --- a/drivers/staging/comedi/drivers/ke_counter.c +++ b/drivers/staging/comedi/drivers/ke_counter.c @@ -158,9 +158,9 @@ static struct pci_dev *cnt_find_pci_dev(struct comedi_device *dev, static int cnt_attach(struct comedi_device *dev, struct comedi_devconfig *it) { - struct pci_dev *pci_device; + const struct cnt_board_struct *board; + struct pci_dev *pcidev; struct comedi_subdevice *subdevice; - struct cnt_board_struct *board; unsigned long io_base; int error; @@ -169,16 +169,16 @@ static int cnt_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (error < 0) return error; - pci_device = cnt_find_pci_dev(dev, it); - if (!pci_device) + pcidev = cnt_find_pci_dev(dev, it); + if (!pcidev) return -EIO; - devpriv->pcidev = pci_device; - board = (struct cnt_board_struct *)dev->board_ptr; + devpriv->pcidev = pcidev; + board = comedi_board(dev); dev->board_name = board->name; /* enable PCI device and request regions */ - error = comedi_pci_enable(pci_device, CNT_DRIVER_NAME); + error = comedi_pci_enable(pcidev, CNT_DRIVER_NAME); if (error < 0) { printk(KERN_WARNING "comedi%d: " "failed to enable PCI device and request regions!\n", @@ -187,7 +187,7 @@ static int cnt_attach(struct comedi_device *dev, struct comedi_devconfig *it) } /* read register base address [PCI_BASE_ADDRESS #0] */ - io_base = pci_resource_start(pci_device, 0); + io_base = pci_resource_start(pcidev, 0); dev->iobase = io_base; error = comedi_alloc_subdevices(dev, 1); -- cgit v0.10.2 From 6e4996bcd82453e43b324e53f5353e5c0fe625a2 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 19:02:50 -0700 Subject: staging: comedi: ke_counter: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Since the pci_dev was the only thing in the private data, remove the struct, the devpriv macro, and it's allocation. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ke_counter.c b/drivers/staging/comedi/drivers/ke_counter.c index 78eb8d4..4153977 100644 --- a/drivers/staging/comedi/drivers/ke_counter.c +++ b/drivers/staging/comedi/drivers/ke_counter.c @@ -64,15 +64,6 @@ static const struct cnt_board_struct cnt_boards[] = { #define cnt_board_nbr (sizeof(cnt_boards)/sizeof(struct cnt_board_struct)) -/*-- device private structure -----------------------------------------------*/ - -struct cnt_device_private { - - struct pci_dev *pcidev; -}; - -#define devpriv ((struct cnt_device_private *)dev->private) - /*-- counter write ----------------------------------------------------------*/ /* This should be used only for resetting the counters; maybe it is better @@ -164,15 +155,10 @@ static int cnt_attach(struct comedi_device *dev, struct comedi_devconfig *it) unsigned long io_base; int error; - /* allocate device private structure */ - error = alloc_private(dev, sizeof(struct cnt_device_private)); - if (error < 0) - return error; - pcidev = cnt_find_pci_dev(dev, it); if (!pcidev) return -EIO; - devpriv->pcidev = pcidev; + comedi_set_hw_dev(dev, &pcidev->dev); board = comedi_board(dev); dev->board_name = board->name; @@ -219,10 +205,12 @@ static int cnt_attach(struct comedi_device *dev, struct comedi_devconfig *it) static void cnt_detach(struct comedi_device *dev) { - if (devpriv && devpriv->pcidev) { + struct pci_dev *pcidev = comedi_to_pci_dev(dev); + + if (pcidev) { if (dev->iobase) - comedi_pci_disable(devpriv->pcidev); - pci_dev_put(devpriv->pcidev); + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); } } -- cgit v0.10.2 From bdc1afa388b89285d68de2ae423dd0d25cfc1d62 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 19:03:08 -0700 Subject: staging: comedi: ke_counter: remove the cnt_board_nbr macro This macro is an open-coded version of ARRAY_SIZE(). Use that instead. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/ke_counter.c b/drivers/staging/comedi/drivers/ke_counter.c index 4153977..d4e9292 100644 --- a/drivers/staging/comedi/drivers/ke_counter.c +++ b/drivers/staging/comedi/drivers/ke_counter.c @@ -62,8 +62,6 @@ static const struct cnt_board_struct cnt_boards[] = { .cnt_bits = 24} }; -#define cnt_board_nbr (sizeof(cnt_boards)/sizeof(struct cnt_board_struct)) - /*-- counter write ----------------------------------------------------------*/ /* This should be used only for resetting the counters; maybe it is better @@ -132,7 +130,7 @@ static struct pci_dev *cnt_find_pci_dev(struct comedi_device *dev, if (pcidev->vendor != PCI_VENDOR_ID_KOLTER) continue; - for (i = 0; i < cnt_board_nbr; i++) { + for (i = 0; i < ARRAY_SIZE(cnt_boards); i++) { board = &cnt_boards[i]; if (board->device_id != pcidev->device) continue; -- cgit v0.10.2 From b92169fd857421825e16f68d178c48f8727e75cc Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 19:03:25 -0700 Subject: staging: comedi: me_daq: factor out the "find pci device" code Factor the "find pci device" code out of the attach function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/me_daq.c b/drivers/staging/comedi/drivers/me_daq.c index 1803d66..dc0fbbd 100644 --- a/drivers/staging/comedi/drivers/me_daq.c +++ b/drivers/staging/comedi/drivers/me_daq.c @@ -610,23 +610,11 @@ static int me_reset(struct comedi_device *dev) return 0; } -static int me_attach(struct comedi_device *dev, struct comedi_devconfig *it) +static struct pci_dev *me_find_pci_dev(struct comedi_device *dev, + struct comedi_devconfig *it) { struct pci_dev *pci_device = NULL; - struct comedi_subdevice *subdevice; - struct me_board *board; - resource_size_t plx_regbase_tmp; - unsigned long plx_regbase_size_tmp; - resource_size_t me_regbase_tmp; - unsigned long me_regbase_size_tmp; - resource_size_t swap_regbase_tmp; - unsigned long swap_regbase_size_tmp; - resource_size_t regbase_tmp; - int result, error, i; - - /* Allocate private memory */ - if (alloc_private(dev, sizeof(struct me_private_data)) < 0) - return -ENOMEM; + int i; /* Probe the device to determine what device in the series it is. */ for_each_pci_dev(pci_device) { @@ -652,9 +640,6 @@ static int me_attach(struct comedi_device *dev, struct comedi_devconfig *it) } dev->board_ptr = me_boards + i; - board = - (struct me_board *)dev->board_ptr; - dev_private->pci_device = pci_device; goto found; } } @@ -664,12 +649,38 @@ static int me_attach(struct comedi_device *dev, struct comedi_devconfig *it) printk(KERN_ERR "comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", dev->minor, it->options[0], it->options[1]); - return -EIO; + return NULL; found: printk(KERN_INFO "comedi%d: found %s at PCI bus %d, slot %d\n", dev->minor, me_boards[i].name, pci_device->bus->number, PCI_SLOT(pci_device->devfn)); + return pci_device; +} + +static int me_attach(struct comedi_device *dev, struct comedi_devconfig *it) +{ + struct pci_dev *pci_device; + struct comedi_subdevice *subdevice; + struct me_board *board; + resource_size_t plx_regbase_tmp; + unsigned long plx_regbase_size_tmp; + resource_size_t me_regbase_tmp; + unsigned long me_regbase_size_tmp; + resource_size_t swap_regbase_tmp; + unsigned long swap_regbase_size_tmp; + resource_size_t regbase_tmp; + int result, error; + + /* Allocate private memory */ + if (alloc_private(dev, sizeof(struct me_private_data)) < 0) + return -ENOMEM; + + pci_device = me_find_pci_dev(dev, it); + if (!pci_device) + return -EIO; + dev_private->pci_device = pci_device; + board = (struct me_board *)dev->board_ptr; /* Enable PCI device and request PCI regions */ if (comedi_pci_enable(pci_device, ME_DRIVER_NAME) < 0) { -- cgit v0.10.2 From 81f9334602a4bec05614cdc228ac5515f03b854e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 19:03:43 -0700 Subject: staging: comedi: me_daq: cleanup "find pci device" code Cleanup the "find pci device" code so that it follows the style of the other comedi pci drivers. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/me_daq.c b/drivers/staging/comedi/drivers/me_daq.c index dc0fbbd..cd66af9 100644 --- a/drivers/staging/comedi/drivers/me_daq.c +++ b/drivers/staging/comedi/drivers/me_daq.c @@ -231,8 +231,6 @@ static const struct me_board me_boards[] = { } }; -#define me_board_nbr (sizeof(me_boards)/sizeof(struct me_board)) - /* Private data structure */ struct me_private_data { struct pci_dev *pci_device; @@ -613,49 +611,34 @@ static int me_reset(struct comedi_device *dev) static struct pci_dev *me_find_pci_dev(struct comedi_device *dev, struct comedi_devconfig *it) { - struct pci_dev *pci_device = NULL; + const struct me_board *board; + struct pci_dev *pcidev = NULL; + int bus = it->options[0]; + int slot = it->options[1]; int i; - /* Probe the device to determine what device in the series it is. */ - for_each_pci_dev(pci_device) { - if (pci_device->vendor == PCI_VENDOR_ID_MEILHAUS) { - for (i = 0; i < me_board_nbr; i++) { - if (me_boards[i].device_id == - pci_device->device) { - /* - * was a particular bus/slot requested? - */ - if ((it->options[0] != 0) - || (it->options[1] != 0)) { - /* - * are we on the wrong bus/slot? - */ - if (pci_device->bus->number != - it->options[0] - || - PCI_SLOT(pci_device->devfn) - != it->options[1]) { - continue; - } - } - - dev->board_ptr = me_boards + i; - goto found; - } - } + for_each_pci_dev(pcidev) { + if (bus || slot) { + if (pcidev->bus->number != bus || + PCI_SLOT(pcidev->devfn) != slot) + continue; } - } + if (pcidev->vendor != PCI_VENDOR_ID_MEILHAUS) + continue; - printk(KERN_ERR - "comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", - dev->minor, it->options[0], it->options[1]); - return NULL; + for (i = 0; i < ARRAY_SIZE(me_boards); i++) { + board = &me_boards[i]; + if (board->device_id != pcidev->device) + continue; -found: - printk(KERN_INFO "comedi%d: found %s at PCI bus %d, slot %d\n", - dev->minor, me_boards[i].name, - pci_device->bus->number, PCI_SLOT(pci_device->devfn)); - return pci_device; + dev->board_ptr = board; + return pcidev; + } + } + dev_err(dev->class_dev, + "No supported board found! (req. bus %d, slot %d)\n", + bus, slot); + return NULL; } static int me_attach(struct comedi_device *dev, struct comedi_devconfig *it) -- cgit v0.10.2 From 27034e8ace5ab5289ee94fb53f9cd5aa821728dd Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 19:03:59 -0700 Subject: staging: comedi: me_daq: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Since the pci_dev was the only thing in the private data, remove the struct, the devpriv macro, and it's allocation. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/me_daq.c b/drivers/staging/comedi/drivers/me_daq.c index cd66af9..8c6f8b9 100644 --- a/drivers/staging/comedi/drivers/me_daq.c +++ b/drivers/staging/comedi/drivers/me_daq.c @@ -233,7 +233,6 @@ static const struct me_board me_boards[] = { /* Private data structure */ struct me_private_data { - struct pci_dev *pci_device; void __iomem *plx_regbase; /* PLX configuration base address */ void __iomem *me_regbase; /* Base address of the Meilhaus card */ unsigned long plx_regbase_size; /* Size of PLX configuration space */ @@ -662,7 +661,7 @@ static int me_attach(struct comedi_device *dev, struct comedi_devconfig *it) pci_device = me_find_pci_dev(dev, it); if (!pci_device) return -EIO; - dev_private->pci_device = pci_device; + comedi_set_hw_dev(dev, &pci_device->dev); board = (struct me_board *)dev->board_ptr; /* Enable PCI device and request PCI regions */ @@ -799,6 +798,8 @@ static int me_attach(struct comedi_device *dev, struct comedi_devconfig *it) static void me_detach(struct comedi_device *dev) { + struct pci_dev *pcidev = comedi_to_pci_dev(dev); + if (dev_private) { if (dev_private->me_regbase) { me_reset(dev); @@ -806,11 +807,11 @@ static void me_detach(struct comedi_device *dev) } if (dev_private->plx_regbase) iounmap(dev_private->plx_regbase); - if (dev_private->pci_device) { - if (dev_private->plx_regbase_size) - comedi_pci_disable(dev_private->pci_device); - pci_dev_put(dev_private->pci_device); - } + } + if (pcidev) { + if (dev_private->plx_regbase_size) + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); } } -- cgit v0.10.2 From 825906964524dd9b69c1b7920515943fc370d914 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 19:04:18 -0700 Subject: staging: comedi: rtd520: remove the debug print of the pci addresses This is just noise. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 9998d6b..02be4dd 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -1676,10 +1676,6 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (!devpriv->las0 || !devpriv->las1 || !devpriv->lcfg) return -ENOMEM; - - DPRINTK("%s: LAS0=%llx, LAS1=%llx, CFG=%llx.\n", dev->board_name, - (unsigned long long)physLas0, (unsigned long long)physLas1, - (unsigned long long)physLcfg); { /* The RTD driver does this */ unsigned char pci_latency; u16 revision; -- cgit v0.10.2 From 39ed05b769190e54d443b8b995b9f3ddee4a32e3 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 19:04:37 -0700 Subject: staging: comedi: rtd520: remove 'got_regions' from private data The 'got_regions' variable in the private data is used as a flag for the detach to know if the pci device has been enabled. Typically the dev->iobase variable is used to indicate this in all the other comedi drivers. Do the same here for consistancy. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 02be4dd..aeccae9 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -312,7 +312,6 @@ struct rtdPrivate { /* PCI device info */ struct pci_dev *pci_dev; - int got_regions; /* non-zero if PCI regions owned */ /* channel list info */ /* chanBipolar tracks whether a channel is bipolar (and needs +2048) */ @@ -1623,7 +1622,6 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) struct rtdPrivate *devpriv; struct comedi_subdevice *s; int ret; - resource_size_t physLas0; /* configuration */ resource_size_t physLas1; /* data area */ resource_size_t physLcfg; /* PLX9080 */ #ifdef USE_DMA @@ -1658,18 +1656,17 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) printk(KERN_INFO "Failed to enable PCI device and request regions.\n"); return ret; } - devpriv->got_regions = 1; /* * Initialize base addresses */ /* Get the physical address from PCI config */ - physLas0 = pci_resource_start(devpriv->pci_dev, LAS0_PCIINDEX); + dev->iobase = pci_resource_start(devpriv->pci_dev, LAS0_PCIINDEX); physLas1 = pci_resource_start(devpriv->pci_dev, LAS1_PCIINDEX); physLcfg = pci_resource_start(devpriv->pci_dev, LCFG_PCIINDEX); /* Now have the kernel map this into memory */ /* ASSUME page aligned */ - devpriv->las0 = ioremap_nocache(physLas0, LAS0_PCISIZE); + devpriv->las0 = ioremap_nocache(dev->iobase, LAS0_PCISIZE); devpriv->las1 = ioremap_nocache(physLas1, LAS1_PCISIZE); devpriv->lcfg = ioremap_nocache(physLcfg, LCFG_PCISIZE); @@ -2000,7 +1997,7 @@ static void rtd_detach(struct comedi_device *dev) if (devpriv->lcfg) iounmap(devpriv->lcfg); if (devpriv->pci_dev) { - if (devpriv->got_regions) + if (dev->iobase) comedi_pci_disable(devpriv->pci_dev); pci_dev_put(devpriv->pci_dev); } -- cgit v0.10.2 From 670793019d15c1066ce6621f4d175fb71a1a24e4 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 19:04:56 -0700 Subject: staging: comedi: rtd520: remove the '#if 0' code in the attach This driver has code #if 0'ed out that would allow cleaning up the attach if there was an error. The comedi core currently calls the detach function to do this if the attach fails. Remove the #if 0'ed out code. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index aeccae9..d1753e2 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -1886,52 +1886,6 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) printk("\ncomedi%d: rtd520 driver attached.\n", dev->minor); return 1; - -#if 0 - /* hit an error, clean up memory and return ret */ -/* rtd_attach_die_error: */ -#ifdef USE_DMA - for (index = 0; index < DMA_CHAIN_COUNT; index++) { - if (NULL != devpriv->dma0Buff[index]) { /* free buffer memory */ - pci_free_consistent(devpriv->pci_dev, - sizeof(u16) * devpriv->fifoLen / 2, - devpriv->dma0Buff[index], - devpriv->dma0BuffPhysAddr[index]); - devpriv->dma0Buff[index] = NULL; - } - } - if (NULL != devpriv->dma0Chain) { - pci_free_consistent(devpriv->pci_dev, - sizeof(struct plx_dma_desc) - * DMA_CHAIN_COUNT, - devpriv->dma0Chain, - devpriv->dma0ChainPhysAddr); - devpriv->dma0Chain = NULL; - } -#endif /* USE_DMA */ - /* subdevices and priv are freed by the core */ - if (dev->irq) { - writel(readl(devpriv->lcfg + LCFG_ITCSR) & - ~(ICS_PLIE | ICS_DMA0_E | ICS_DMA1_E), - devpriv->lcfg + LCFG_ITCSR); - free_irq(dev->irq, dev); - } - - /* release all regions that were allocated */ - if (devpriv->las0) - iounmap(devpriv->las0); - - if (devpriv->las1) - iounmap(devpriv->las1); - - if (devpriv->lcfg) - iounmap(devpriv->lcfg); - - if (devpriv->pci_dev) - pci_dev_put(devpriv->pci_dev); - - return ret; -#endif } static void rtd_detach(struct comedi_device *dev) -- cgit v0.10.2 From 843c042d15dbecaece3070f08d88d9b7ad9d2284 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 19:05:13 -0700 Subject: staging: comedi: rtd520: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index d1753e2..112fdc3 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -310,9 +310,6 @@ struct rtdPrivate { int transCount; /* # to transfer data. 0->1/2FIFO */ int flags; /* flag event modes */ - /* PCI device info */ - struct pci_dev *pci_dev; - /* channel list info */ /* chanBipolar tracks whether a channel is bipolar (and needs +2048) */ unsigned char chanBipolar[RTD_MAX_CHANLIST / 8]; /* bit array */ @@ -1620,6 +1617,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) { /* board name and options flags */ const struct rtdBoard *thisboard; struct rtdPrivate *devpriv; + struct pci_dev *pcidev; struct comedi_subdevice *s; int ret; resource_size_t physLas1; /* data area */ @@ -1644,14 +1642,15 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) return -ENOMEM; devpriv = dev->private; - devpriv->pci_dev = rtd_find_pci(dev, it); - if (!devpriv->pci_dev) + pcidev = rtd_find_pci(dev, it); + if (!pcidev) return -EIO; + comedi_set_hw_dev(dev, &pcidev->dev); thisboard = comedi_board(dev); dev->board_name = thisboard->name; - ret = comedi_pci_enable(devpriv->pci_dev, DRV_NAME); + ret = comedi_pci_enable(pcidev, DRV_NAME); if (ret < 0) { printk(KERN_INFO "Failed to enable PCI device and request regions.\n"); return ret; @@ -1661,9 +1660,9 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) * Initialize base addresses */ /* Get the physical address from PCI config */ - dev->iobase = pci_resource_start(devpriv->pci_dev, LAS0_PCIINDEX); - physLas1 = pci_resource_start(devpriv->pci_dev, LAS1_PCIINDEX); - physLcfg = pci_resource_start(devpriv->pci_dev, LCFG_PCIINDEX); + dev->iobase = pci_resource_start(pcidev, LAS0_PCIINDEX); + physLas1 = pci_resource_start(pcidev, LAS1_PCIINDEX); + physLcfg = pci_resource_start(pcidev, LCFG_PCIINDEX); /* Now have the kernel map this into memory */ /* ASSUME page aligned */ devpriv->las0 = ioremap_nocache(dev->iobase, LAS0_PCISIZE); @@ -1678,16 +1677,16 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) u16 revision; /*uint32_t epld_version; */ - pci_read_config_word(devpriv->pci_dev, PCI_REVISION_ID, + pci_read_config_word(pcidev, PCI_REVISION_ID, &revision); DPRINTK("%s: PCI revision %d.\n", dev->board_name, revision); - pci_read_config_byte(devpriv->pci_dev, + pci_read_config_byte(pcidev, PCI_LATENCY_TIMER, &pci_latency); if (pci_latency < 32) { printk(KERN_INFO "%s: PCI latency changed from %d to %d\n", dev->board_name, pci_latency, 32); - pci_write_config_byte(devpriv->pci_dev, + pci_write_config_byte(pcidev, PCI_LATENCY_TIMER, 32); } else { DPRINTK("rtd520: PCI latency = %d\n", pci_latency); @@ -1790,15 +1789,15 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* TODO: set user out source ??? */ /* check if our interrupt is available and get it */ - ret = request_irq(devpriv->pci_dev->irq, rtd_interrupt, + ret = request_irq(pcidev->irq, rtd_interrupt, IRQF_SHARED, DRV_NAME, dev); if (ret < 0) { printk("Could not get interrupt! (%u)\n", - devpriv->pci_dev->irq); + pcidev->irq); return ret; } - dev->irq = devpriv->pci_dev->irq; + dev->irq = pcidev->irq; printk(KERN_INFO "( irq=%u )", dev->irq); ret = rtd520_probe_fifo_depth(dev); @@ -1820,7 +1819,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) for (index = 0; index < DMA_CHAIN_COUNT; index++) { devpriv->dma0Buff[index] = - pci_alloc_consistent(devpriv->pci_dev, + pci_alloc_consistent(pcidev, sizeof(u16) * devpriv->fifoLen / 2, &devpriv-> @@ -1840,7 +1839,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) * ordering?) */ devpriv->dma0Chain = - pci_alloc_consistent(devpriv->pci_dev, + pci_alloc_consistent(pcidev, sizeof(struct plx_dma_desc) * DMA_CHAIN_COUNT, &devpriv->dma0ChainPhysAddr); @@ -1891,6 +1890,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) static void rtd_detach(struct comedi_device *dev) { struct rtdPrivate *devpriv = dev->private; + struct pci_dev *pcidev = comedi_to_pci_dev(dev); #ifdef USE_DMA int index; #endif @@ -1921,7 +1921,7 @@ static void rtd_detach(struct comedi_device *dev) /* release DMA */ for (index = 0; index < DMA_CHAIN_COUNT; index++) { if (NULL != devpriv->dma0Buff[index]) { - pci_free_consistent(devpriv->pci_dev, + pci_free_consistent(pcidev, sizeof(u16) * devpriv->fifoLen / 2, devpriv->dma0Buff[index], @@ -1931,7 +1931,7 @@ static void rtd_detach(struct comedi_device *dev) } } if (NULL != devpriv->dma0Chain) { - pci_free_consistent(devpriv->pci_dev, + pci_free_consistent(pcidev, sizeof(struct plx_dma_desc) * DMA_CHAIN_COUNT, devpriv->dma0Chain, devpriv->dma0ChainPhysAddr); @@ -1950,11 +1950,11 @@ static void rtd_detach(struct comedi_device *dev) iounmap(devpriv->las1); if (devpriv->lcfg) iounmap(devpriv->lcfg); - if (devpriv->pci_dev) { - if (dev->iobase) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); - } + } + if (pcidev) { + if (dev->iobase) + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); } } -- cgit v0.10.2 From 3808dd926f2d6773939a078e4798a4b3c47ecc84 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 19:05:32 -0700 Subject: staging: comedi: aio_iiro_16: remove the private data The private data is not used by this driver. Remove the struct, devpriv macro, and the allocation. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/aio_iiro_16.c b/drivers/staging/comedi/drivers/aio_iiro_16.c index 16f28f6..ba1e3bb 100644 --- a/drivers/staging/comedi/drivers/aio_iiro_16.c +++ b/drivers/staging/comedi/drivers/aio_iiro_16.c @@ -57,14 +57,6 @@ static const struct aio_iiro_16_board aio_iiro_16_boards[] = { .do_ = 16}, }; -struct aio_iiro_16_private { - int data; - struct pci_dev *pci_dev; - unsigned int ao_readback[2]; -}; - -#define devpriv ((struct aio_iiro_16_private *) dev->private) - static int aio_iiro_16_dio_insn_bits_write(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -116,9 +108,6 @@ static int aio_iiro_16_attach(struct comedi_device *dev, dev->iobase = iobase; - if (alloc_private(dev, sizeof(struct aio_iiro_16_private)) < 0) - return -ENOMEM; - ret = comedi_alloc_subdevices(dev, 2); if (ret) return ret; -- cgit v0.10.2 From 1226f1ab90902f3aaaa2fdb01497b6ca765da888 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Jul 2012 19:05:55 -0700 Subject: staging: comedi: s526: remove unused variables in the private data The 'data' and 'pci_dev' variables in the private data are not used. They appear to be cut-and-paste from the skel driver. Remove them. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/s526.c b/drivers/staging/comedi/drivers/s526.c index 358380f..737a194 100644 --- a/drivers/staging/comedi/drivers/s526.c +++ b/drivers/staging/comedi/drivers/s526.c @@ -206,15 +206,7 @@ static const struct s526_board s526_boards[] = { struct. */ struct s526_private { - - int data; - - /* would be useful for a PCI device */ - struct pci_dev *pci_dev; - - /* Used for AO readback */ unsigned int ao_readback[2]; - struct s526GPCTConfig s526_gpct_config[4]; unsigned short s526_ai_config; }; -- cgit v0.10.2 From 33792df47ca5d9c654a5286dfb521b0ef81569ef Mon Sep 17 00:00:00 2001 From: Duan Jiong Date: Wed, 18 Jul 2012 22:30:30 +0800 Subject: staging: sep_main.c: remove duplicated include Signed-off-by: Duan Jiong Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sep/sep_main.c b/drivers/staging/sep/sep_main.c index 205d0df..ca8946a 100644 --- a/drivers/staging/sep/sep_main.c +++ b/drivers/staging/sep/sep_main.c @@ -61,7 +61,6 @@ #include #include #include -#include #include #include #include -- cgit v0.10.2 From 194ccca70ec29795ef8db006fd557a14783e734e Mon Sep 17 00:00:00 2001 From: Duan Jiong Date: Wed, 18 Jul 2012 22:33:38 +0800 Subject: staging: sep_crypto.c: remove duplicated include Signed-off-by: Duan Jiong Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/sep/sep_crypto.c b/drivers/staging/sep/sep_crypto.c index 3c06116..34710ce 100644 --- a/drivers/staging/sep/sep_crypto.c +++ b/drivers/staging/sep/sep_crypto.c @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include -- cgit v0.10.2 From 7a72e416e9f44fee263eef4e3c21ac70eb2927dd Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 19 Jul 2012 17:33:09 -0700 Subject: Staging: csr: remove oska compat functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These functions were for older kernel versions, which we aren't supporting anymore now that this is in the kernel. So remove the files, they are no longer needed. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/oska/Makefile b/drivers/staging/csr/oska/Makefile index 3a0b648..57ae66d 100644 --- a/drivers/staging/csr/oska/Makefile +++ b/drivers/staging/csr/oska/Makefile @@ -3,7 +3,6 @@ obj-$(CONFIG_CSR_WIFI) := csr_oska.o csr_oska-y := \ list.o \ refcount.o \ - compat.o \ event.o \ oska_module.o \ print.o \ diff --git a/drivers/staging/csr/oska/compat.c b/drivers/staging/csr/oska/compat.c deleted file mode 100644 index 790b97a..0000000 --- a/drivers/staging/csr/oska/compat.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Linux version compatibility functions. - * - * Copyright (C) 2008 Cambridge Silicon Radio Ltd. - * - * 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, see . - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#include "kernel-compat.h" - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) - -int dev_set_name(struct device *dev, const char *fmt, ...) -{ - va_list vargs; - - va_start(vargs, fmt); - vsnprintf(dev->bus_id, sizeof(dev->bus_id), fmt, vargs); - va_end(vargs); - return 0; -} -EXPORT_SYMBOL_GPL(dev_set_name); - -#endif /* Linux kernel < 2.6.26 */ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) - -struct device *class_find_device(struct class *class, struct device *start, - void *data, int (*match)(struct device *, void *)) -{ - struct device *dev; - - list_for_each_entry(dev, &class->devices, node) { - if (match(dev, data)) { - get_device(dev); - return dev; - } - } - return NULL; -} -EXPORT_SYMBOL_GPL(class_find_device); - -#endif /* Linux kernel < 2.6.25 */ diff --git a/drivers/staging/csr/oska/kernel-compat.h b/drivers/staging/csr/oska/kernel-compat.h deleted file mode 100644 index b6d27d3..0000000 --- a/drivers/staging/csr/oska/kernel-compat.h +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Kernel version compatibility. - * - * Copyright (C) 2007-2008 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * Wherever possible compatible implementations of newer APIs are - * provided for older kernel versions. - */ -#ifndef __LINUX_KERNEL_COMPAT_H -#define __LINUX_KERNEL_COMPAT_H - -#include -#include -#include - -#include - -/* - * linux/semaphore.h replaces asm/semaphore.h in 2.6.27. - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) -# include -#else -# include -#endif - -/* - * Workqueue API changes in 2.6.20 - * - * See http://lwn.net/Articles/211279/ for details. - * - * We deliberately don't provide the non-automatic release (NAR) - * variants as a simple compatible implementation is not possible. - * This shouldn't be a problem as all usage so far is to embed the - * struct work_struct into another struct and the NAR variants aren't - * useful in this case (see http://lwn.net/Articles/213149/). - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - -#include - -#undef INIT_WORK -#define INIT_WORK(_work, _func) \ - do { \ - INIT_LIST_HEAD(&(_work)->entry); \ - (_work)->pending = 0; \ - PREPARE_WORK((_work), (_func), (_work)); \ - init_timer(&(_work)->timer); \ - } while(0) - -#undef DECLARE_WORK -#define DECLARE_WORK(n, f) \ - struct work_struct n = __WORK_INITIALIZER((n), (f), &(n)) - -struct delayed_work { - struct work_struct work; -}; - -#define INIT_DELAYED_WORK(dw, fn) \ - INIT_WORK(&(dw)->work, (fn)) - -#define queue_delayed_work(wq, dw, delay) \ - queue_delayed_work((wq), &(dw)->work, (delay)) - -#define schedule_delayed_work(dw, delay) \ - schedule_delayed_work(&(dw)->work, (delay)) - -#define cancel_delayed_work(dw) \ - cancel_delayed_work(&(dw)->work) - -#endif /* Linux kernel < 2.6.20 */ - -/* - * device_create()/class_device_create() - * - * device_create() gains a drvdata parameter in 2.6.27. Since all - * users of device_create() in CSR code don't use drvdata just ignore - * it. - * - * device_create() replaces class_device_create() in 2.6.21. - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21) - -#define device_create(class, parent, devt, drvdata, fmt, args...) \ - class_device_create((class), (parent), (devt), NULL, (fmt), ## args) -#define device_destroy(class, devt) \ - class_device_destroy(class, devt) - -#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) - -#define device_create(class, parent, devt, drvdata, fmt, args...) \ - device_create((class), (parent), (devt), (fmt), ## args) - -#endif /* Linux kernel < 2.6.26 */ - -/* - * dev_name() and dev_set_name() added in 2.6.26. - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) - -static inline char *dev_name(struct device *dev) -{ - return dev->bus_id; -} - -int dev_set_name(struct device *dev, const char *fmt, ...); - -#endif /* Linux kernel < 2.6.26 */ - -/* - * class_find_device() in 2.6.25 - */ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) - -struct device *class_find_device(struct class *class, struct device *start, - void *data, int (*match)(struct device *, void *)); - -#endif /* Linux kernel < 2.6.25 */ - -/* - * list_first_entry in 2.6.22. - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) - -#define list_first_entry(ptr, type, member) \ - list_entry((ptr)->next, type, member) - -#endif /* Linux kernel < 2.6.22 */ - -/* - * 2.6.19 adds a bool type. - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) - -typedef _Bool bool; -enum { - false = 0, - true = 1 -}; - -#endif /* Linux kernel < 2.6.19 */ - -/* - * Provide readq() and writeq() if unavailable. - */ -#ifndef readq -static inline __u64 readq(const volatile void __iomem *addr) -{ - const volatile u32 __iomem *p = addr; - u32 low, high; - - low = readl(p); - high = readl(p + 1); - - return low + ((u64)high << 32); -} -#endif - -#ifndef writeq -static inline void writeq(__u64 val, volatile void __iomem *addr) -{ - writel(val, addr); - writel(val >> 32, addr+4); -} -#endif - -/* - * get_unaligned_le16() and friends added in 2.6.26. - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) -#include - -static inline __u16 get_unaligned_le16(const void *p) -{ - return le16_to_cpu(get_unaligned((__le16 *)p)); -} - -static inline void put_unaligned_le16(__u16 val, const void *p) -{ - put_unaligned(cpu_to_le16(val), (__le16 *)p); -} -#endif /* Linux kernel < 2.6.26 */ - -/* - * Various device or vendor IDs may not exist. - */ -#ifndef PCI_VENDOR_ID_CSR -# define PCI_VENDOR_ID_CSR 0x18e5 -#endif - -#ifndef PCI_DEVICE_ID_JMICRON_JMB38X_SD -# define PCI_DEVICE_ID_JMICRON_JMB38X_SD 0x2381 -#endif - -#endif /* #ifndef __LINUX_KERNEL_COMPAT_H */ diff --git a/drivers/staging/csr/oska/mutex.h b/drivers/staging/csr/oska/mutex.h index 9138b28..e7d46fe 100644 --- a/drivers/staging/csr/oska/mutex.h +++ b/drivers/staging/csr/oska/mutex.h @@ -11,8 +11,8 @@ #include #include +#include -#include "kernel-compat.h" /* Real mutexes were only added to 2.6.16 so use semaphores instead. */ -- cgit v0.10.2 From e74927deee8094e81fc097ba8b73d708eae7ed44 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 19 Jul 2012 17:35:13 -0700 Subject: staging: csr: oska: remove io.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nothing is including it, so remove it. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/oska/all.h b/drivers/staging/csr/oska/all.h index 5fe8583..b08bc1f 100644 --- a/drivers/staging/csr/oska/all.h +++ b/drivers/staging/csr/oska/all.h @@ -41,7 +41,6 @@ * * There are additional modules that are not included in . * - * - \ref io "Memory mapped I/O" * - \ref refcount "Reference Counting" * - \ref list "Linked lists" * - \ref trace "Tracing messages" diff --git a/drivers/staging/csr/oska/io.h b/drivers/staging/csr/oska/io.h deleted file mode 100644 index c6c406c..0000000 --- a/drivers/staging/csr/oska/io.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * OSKA Linux implementation -- memory mapped I/O. - * - * Copyright (C) 2009 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef __OSKA_LINUX_IO_H -#define __OSKA_LINUX_IO_H - -#include -#include -#include - -typedef void __iomem *os_io_mem_t; - -static inline uint8_t os_io_read8(os_io_mem_t base, unsigned offset) -{ - return readb(base + offset); -} - -static inline uint16_t os_io_read16(os_io_mem_t base, unsigned offset) -{ - return readw(base + offset); -} - -static inline uint32_t os_io_read32(os_io_mem_t base, unsigned offset) -{ - return readl(base + offset); -} - -static inline uint64_t os_io_read64(os_io_mem_t base, unsigned offset) -{ - return readq(base + offset); -} - -static inline void os_io_write8(os_io_mem_t base, unsigned offset, uint8_t val) -{ - writeb(val, base + offset); -} - -static inline void os_io_write16(os_io_mem_t base, unsigned offset, uint16_t val) -{ - writew(val, base + offset); -} - -static inline void os_io_write32(os_io_mem_t base, unsigned offset, uint32_t val) -{ - writel(val, base + offset); -} - -static inline void os_io_write64(os_io_mem_t base, unsigned offset, uint64_t val) -{ - writeq(val, base + offset); -} - -static inline void os_io_memory_barrier(void) -{ - mb(); -} - -#endif /* #ifndef __OSKA_LINUX_IO_H */ -- cgit v0.10.2 From 44bb4ac4bf6b3ac751dadce46367a05ff965376e Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 19 Jul 2012 17:37:48 -0700 Subject: staging: csr: oska: remove refcount.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's not called by anyone, so remove it and the .h file and don't export the functions as they are not around anymore. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/oska/Makefile b/drivers/staging/csr/oska/Makefile index 57ae66d..d2aabb7 100644 --- a/drivers/staging/csr/oska/Makefile +++ b/drivers/staging/csr/oska/Makefile @@ -2,7 +2,6 @@ obj-$(CONFIG_CSR_WIFI) := csr_oska.o csr_oska-y := \ list.o \ - refcount.o \ event.o \ oska_module.o \ print.o \ diff --git a/drivers/staging/csr/oska/oska_module.c b/drivers/staging/csr/oska/oska_module.c index da12564..2876ec2 100644 --- a/drivers/staging/csr/oska/oska_module.c +++ b/drivers/staging/csr/oska/oska_module.c @@ -8,14 +8,6 @@ */ #include -#include "all.h" -#include "refcount.h" - -EXPORT_SYMBOL(os_refcount_init); -EXPORT_SYMBOL(os_refcount_destroy); -EXPORT_SYMBOL(os_refcount_get); -EXPORT_SYMBOL(os_refcount_put); - MODULE_DESCRIPTION("Operating System Kernel Abstraction"); MODULE_AUTHOR("Cambridge Silicon Radio Ltd."); MODULE_LICENSE("GPL and additional rights"); diff --git a/drivers/staging/csr/oska/refcount.c b/drivers/staging/csr/oska/refcount.c deleted file mode 100644 index 28abb64..0000000 --- a/drivers/staging/csr/oska/refcount.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * OSKA generic implementation -- reference counting. - * - * Copyright (C) 2010 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#include "refcount.h" -#include "types.h" - -void os_refcount_init(os_refcount_t *refcount, os_refcount_callback_f func, void *arg) -{ - os_spinlock_init(&refcount->lock); - refcount->count = 1; - refcount->func = func; - refcount->arg = arg; -} - -void os_refcount_destroy(os_refcount_t *refcount) -{ - os_spinlock_destroy(&refcount->lock); -} - -void os_refcount_get(os_refcount_t *refcount) -{ - os_int_status_t istate; - - os_spinlock_lock_intsave(&refcount->lock, &istate); - refcount->count++; - os_spinlock_unlock_intrestore(&refcount->lock, &istate); -} - -void os_refcount_put(os_refcount_t *refcount) -{ - bool is_zero; - os_int_status_t istate; - - os_spinlock_lock_intsave(&refcount->lock, &istate); - refcount->count--; - is_zero = refcount->count == 0; - os_spinlock_unlock_intrestore(&refcount->lock, &istate); - - if (is_zero) { - refcount->func(refcount->arg); - } -} diff --git a/drivers/staging/csr/oska/refcount.h b/drivers/staging/csr/oska/refcount.h deleted file mode 100644 index 741b00a..0000000 --- a/drivers/staging/csr/oska/refcount.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Operating system kernel abstraction -- reference counting. - * - * Copyright (C) 2010 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef __OSKA_REFCOUNT_H -#define __OSKA_REFCOUNT_H - -#include "spinlock.h" - -/** - * @defgroup refcount Reference Counting - * - * A reference count is an atomic counter. A callback function is - * called whenever the count reaches zero. - * - * A generic implementation is provided that is suitable for all - * platforms that support the spinlock API in (see - * \ref spinlock). - */ - -typedef void (*os_refcount_callback_f)(void *arg); - -struct __os_refcount_impl { - unsigned count; - os_spinlock_t lock; - os_refcount_callback_f func; - void *arg; -}; - -/** - * A reference count object. - * - * @ingroup refcount - */ -typedef struct __os_refcount_impl os_refcount_t; - -/** - * Initialize a reference count to 1. - * - * Initialized reference counts must be destroyed by calling - * os_refcount_destroy(). - * - * @param refcount the reference count. - * @param func the function which will be called when the - * reference count reaches 0. - * @param arg an argument to pass to func. - * - * @ingroup refcount - */ -void os_refcount_init(os_refcount_t *refcount, os_refcount_callback_f func, void *arg); - -/** - * Destroy a reference count object. - * - * @param refcount the reference count. - * - * @ingroup refcount - */ -void os_refcount_destroy(os_refcount_t *refcount); - -/** - * Atomically increase the reference count by 1. - * - * @param refcount the reference count. - * - * @ingroup refcount - */ -void os_refcount_get(os_refcount_t *refcount); - -/** - * Atomically decrease the reference count by 1. - * - * The callback function passed to the call to os_refcount_init() is - * called if the count was decreased to zero. - * - * @param refcount the reference count. - * - * @ingroup refcount - */ -void os_refcount_put(os_refcount_t *refcount); - -#endif /* #ifndef __OSKA_REFCOUNT_H */ -- cgit v0.10.2 From 9f47550adbe8e3496b88c54400c58986b27f33da Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 19 Jul 2012 17:42:52 -0700 Subject: staging: csr: oska: remove all.h and types.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No one is using these (with one minor exception that was fixed in list.c) so remove the header files. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/oska/all.h b/drivers/staging/csr/oska/all.h deleted file mode 100644 index b08bc1f..0000000 --- a/drivers/staging/csr/oska/all.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Operating system kernel abstraction -- all functions - * - * Copyright (C) 2007 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef __OSKA_ALL_H -#define __OSKA_ALL_H - -/** - * @mainpage Operating System Kernel Abstraction - * - * @section intro Introduction - * - * The Operating System Kernel Abstraction (oska) is a software - * package providing an abstraction for various operating system - * kernel facilities for use by device drivers and other OS kernel - * software (e.g., SDIO stacks). Oska is modularized and intended to - * be a lightweight wrapper around an OSes interfaces. - * - * @section modules Modules - * - * Oska is organized into the modules, each of which has it's own - * header file providing the interface. - * - * - \ref alloc "Memory allocation" - * - \ref event "Events" - * - \ref mutex "Mutexes" - * - \ref print "Console output" - * - \ref spinlock "Spinlocks" - * - \ref thread "Threading" - * - \ref time "Timing and delays" - * - \ref timer "Timers" - * - \ref types "Standard Types" - * - \ref util "Miscellaneous utilities" - * - * An header is provided which includes all the above - * modules. - * - * There are additional modules that are not included in . - * - * - \ref refcount "Reference Counting" - * - \ref list "Linked lists" - * - \ref trace "Tracing messages" - */ - -#include "alloc.h" -#include "event.h" -#include "mutex.h" -#include "print.h" -#include "spinlock.h" -#include "thread.h" -#include "time.h" -#include "timer.h" -#include "types.h" -#include "util.h" - -#endif /* __OSKA_ALL_H */ diff --git a/drivers/staging/csr/oska/list.c b/drivers/staging/csr/oska/list.c index b5e884e..7d26c4a 100644 --- a/drivers/staging/csr/oska/list.c +++ b/drivers/staging/csr/oska/list.c @@ -8,9 +8,7 @@ */ #include - #include "list.h" -#include "util.h" /** * Initialize an empty list. @@ -37,8 +35,6 @@ int os_list_empty(struct os_list *list) static void os_list_add(struct os_list_node *prev, struct os_list_node *new, struct os_list_node *next) { - OS_ASSERT(new->next == NULL && new->prev == NULL); - next->prev = new; new->next = next; new->prev = prev; diff --git a/drivers/staging/csr/oska/types.h b/drivers/staging/csr/oska/types.h deleted file mode 100644 index 18d7c11..0000000 --- a/drivers/staging/csr/oska/types.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * OSKA Linux implementation -- types - * - * Copyright (C) 2009 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef __OSKA_LINUX_TYPES_H -#define __OSKA_LINUX_TYPES_H - -#include - -#endif /* #ifndef __OSKA_LINUX_TYPES_H */ -- cgit v0.10.2 From c30fbb3c1e4d55f8444fd802d7e2faf1da8323f9 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 19 Jul 2012 17:44:09 -0700 Subject: staging: csr: oska: remove list.c and list.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No one is using these functions, so remove them. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/oska/Makefile b/drivers/staging/csr/oska/Makefile index d2aabb7..92d3f86 100644 --- a/drivers/staging/csr/oska/Makefile +++ b/drivers/staging/csr/oska/Makefile @@ -1,7 +1,6 @@ obj-$(CONFIG_CSR_WIFI) := csr_oska.o csr_oska-y := \ - list.o \ event.o \ oska_module.o \ print.o \ diff --git a/drivers/staging/csr/oska/list.c b/drivers/staging/csr/oska/list.c deleted file mode 100644 index 7d26c4a..0000000 --- a/drivers/staging/csr/oska/list.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Operating system kernel abstraction -- linked lists. - * - * Copyright (C) 2009-2010 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ - -#include -#include "list.h" - -/** - * Initialize an empty list. - * - * @ingroup list - */ -void os_list_init(struct os_list *list) -{ - list->head.next = list->head.prev = &list->head; -} - -/** - * Is the list empty? - * - * @return true iff the list contains no nodes. - * - * @ingroup list - */ -int os_list_empty(struct os_list *list) -{ - return list->head.next == &list->head; -} - -static void os_list_add(struct os_list_node *prev, struct os_list_node *new, - struct os_list_node *next) -{ - next->prev = new; - new->next = next; - new->prev = prev; - prev->next = new; -} - -/** - * Add a node to the tail of the list. - * - * @param list the list. - * @param node the list node to add. - * - * @ingroup list - */ -void os_list_add_tail(struct os_list *list, struct os_list_node *node) -{ - os_list_add(list->head.prev, node, &list->head); -} - -/** - * Remove a node from a list. - * - * @param node the node to remove. - * - * @ingroup list - */ -void os_list_del(struct os_list_node *node) -{ - node->prev->next = node->next; - node->next->prev = node->prev; - - node->prev = node->next = NULL; -} - -/** - * The node at the head of the list. - * - * @param list the list. - * - * @return the node at the head of the list; or os_list_end() if the - * list is empty. - * - * @ingroup list - */ -struct os_list_node *os_list_head(struct os_list *list) -{ - return list->head.next; -} - -/** - * The node marking the end of a list. - * - * @param list the list. - * - * @return the node that marks the end of the list. - * - * @ingroup list - */ -struct os_list_node *os_list_end(struct os_list *list) -{ - return &list->head; -} diff --git a/drivers/staging/csr/oska/list.h b/drivers/staging/csr/oska/list.h deleted file mode 100644 index a69b3b7..0000000 --- a/drivers/staging/csr/oska/list.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Operating system kernel abstraction -- linked lists. - * - * Copyright (C) 2009-2010 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef __OSKA_LIST_H -#define __OSKA_LIST_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup list Linked Lists - * - * Generic linked list implementations suitable for all platforms. - * - * - Circular, doubly-linked list (struct os_list). - */ - -/** - * A list node. - * - * This list node structure should be the first field within any - * structure that is to be stored in a list. - * - * @see struct os_list - * @ingroup list - */ -struct os_list_node { - /** - * The pointer to the previous node in the list, or os_list_end() - * if the end of the list has been reached. - */ - struct os_list_node *prev; - /** - * The pointer to the next node in the list, or os_list_end() if - * the end of the list has been reached. - */ - struct os_list_node *next; -}; - -/** - * A circular, doubly-linked list of nodes. - * - * Structures to be stored in a list should contains a struct - * os_list_node as the \e first field. - * \code - * struct foo { - * struct os_list_node node; - * int bar; - * ... - * }; - * \endcode - * Going to/from a struct foo to a list node is then simple. - * \code - * struct os_list_node *node; - * struct foo *foo; - * [...] - * node = &foo->node; - * foo = (struct foo *)node - * \endcode - * Lists must be initialized with os_list_init() before adding nodes - * with os_list_add_tail(). The node at the head of the list is - * obtained with os_list_head(). Nodes are removed from the list with - * os_list_del(). - * - * A list can be interated from the head to the tail using: - * \code - * struct os_list_node *node; - * for (node = os_list_head(list); node != os_list_end(list); node = node->next) { - * struct foo *foo = (struct foo *)node; - * ... - * } - * \endcode - * - * In the above loop, the current list node cannot be removed (with - * os_list_del()). If this is required use this form of loop: - * \code - * struct os_list_node *node, *next; - * for (node = os_list_head(list), next = node->next; - * node != os_list_end(list); - * node = next, next = node->next) { - * struct foo *foo = (struct foo *)node; - * ... - * os_list_del(node); - * ... - * } - * \endcode - * - * @ingroup list - */ -struct os_list { - /** - * @internal - * The dummy node marking the end of the list. - */ - struct os_list_node head; -}; - -void os_list_init(struct os_list *list); -int os_list_empty(struct os_list *list); -void os_list_add_tail(struct os_list *list, struct os_list_node *node); -void os_list_del(struct os_list_node *node); -struct os_list_node *os_list_head(struct os_list *list); -struct os_list_node *os_list_end(struct os_list *list); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* #ifndef __OSKA_LIST_H */ -- cgit v0.10.2 From fa335388d936a56935aaa101d73a799da9271c11 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 19 Jul 2012 17:46:17 -0700 Subject: staging: csr: oska: remove print.h and print.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No one was calling these functions, so remove them. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/oska/Makefile b/drivers/staging/csr/oska/Makefile index 92d3f86..63ab141 100644 --- a/drivers/staging/csr/oska/Makefile +++ b/drivers/staging/csr/oska/Makefile @@ -3,7 +3,6 @@ obj-$(CONFIG_CSR_WIFI) := csr_oska.o csr_oska-y := \ event.o \ oska_module.o \ - print.o \ thread.o \ timer.o diff --git a/drivers/staging/csr/oska/print.c b/drivers/staging/csr/oska/print.c deleted file mode 100644 index 5f5b263..0000000 --- a/drivers/staging/csr/oska/print.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Linux console printing functions. - * - * Copyright (C) 2007 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#include - -#include "print.h" - -void os_print(enum os_print_level level, const char *prefix, const char *name, - const char *format, ...) -{ - va_list va_args; - - va_start(va_args, format); - os_vprint(level, prefix, name, format, va_args); - va_end(va_args); -} -EXPORT_SYMBOL(os_print); - -void os_vprint(enum os_print_level level, const char *prefix, const char *name, - const char *format, va_list args) -{ - const char *level_str[] = { - [OS_PRINT_ERROR] = KERN_ERR, - [OS_PRINT_WARNING] = KERN_WARNING, - [OS_PRINT_INFO] = KERN_INFO, - [OS_PRINT_DEBUG] = KERN_DEBUG, - }; - char buf[80]; - int w = 0; - - if (name) { - w += snprintf(buf + w, sizeof(buf) - w, "%s%s%s: ", level_str[level], prefix, name); - } else { - w += snprintf(buf + w, sizeof(buf) - w, "%s%s", level_str[level], prefix); - } - w += vsnprintf(buf + w, sizeof(buf) - w, format, args); - printk("%s\n", buf); -} -EXPORT_SYMBOL(os_vprint); diff --git a/drivers/staging/csr/oska/print.h b/drivers/staging/csr/oska/print.h deleted file mode 100644 index f48bb83..0000000 --- a/drivers/staging/csr/oska/print.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * OSKA Linux implementation -- console printing - * - * Copyright (C) 2007 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef __OSKA_LINUX_PRINT_H -#define __OSKA_LINUX_PRINT_H - -#include - -/** - * Severity of a console or log message. - * - * @ingroup print - */ -enum os_print_level { - OS_PRINT_ERROR, - OS_PRINT_WARNING, - OS_PRINT_INFO, - OS_PRINT_DEBUG, -}; - -void os_print(enum os_print_level level, const char *prefix, const char *name, - const char *format, ...); -void os_vprint(enum os_print_level level, const char *prefix, const char *name, - const char *format, va_list args); - - -#endif /* #ifndef __OSKA_LINUX_PRINT_H */ -- cgit v0.10.2 From 3421ee2f84488e9c03fb7ddfcd60bc30796678c8 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 19 Jul 2012 17:47:44 -0700 Subject: staging: csr: oska: remove time.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No one was including it, so remove it. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/oska/time.h b/drivers/staging/csr/oska/time.h deleted file mode 100644 index d246ce9..0000000 --- a/drivers/staging/csr/oska/time.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * OSKA Linux implementation -- timing - * - * Copyright (C) 2007 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef __OSKA_LINUX_TIME_H -#define __OSKA_LINUX_TIME_H - -#include -#include -#include -#include - -static inline unsigned long os_current_time_ms(void) -{ - return jiffies_to_msecs(jiffies); -} - -static inline void os_sleep_ms(unsigned ms) -{ - msleep_interruptible(ms); -} - -static inline void os_delay_us(unsigned us) -{ - udelay(us); -} - -#define os_time_after(a, b) time_after((a), (b)) - -#endif /* __OSKA_LINUX_TIME_H */ -- cgit v0.10.2 From bd2b57ab75be545f141f3ec5ed5cadeaff898ada Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 19 Jul 2012 17:51:56 -0700 Subject: staging: csr: oska: remove timer.c and timer.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No one is using these, remove them. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/oska/Makefile b/drivers/staging/csr/oska/Makefile index 63ab141..02b8ef5 100644 --- a/drivers/staging/csr/oska/Makefile +++ b/drivers/staging/csr/oska/Makefile @@ -3,6 +3,5 @@ obj-$(CONFIG_CSR_WIFI) := csr_oska.o csr_oska-y := \ event.o \ oska_module.o \ - thread.o \ - timer.o + thread.o diff --git a/drivers/staging/csr/oska/timer.c b/drivers/staging/csr/oska/timer.c deleted file mode 100644 index 67d3423..0000000 --- a/drivers/staging/csr/oska/timer.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * OSKA Linux implementation -- timers. - * - * Copyright (C) 2007 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#include - -#include "timer.h" - -static void timer_func(unsigned long data) -{ - os_timer_t *timer = (os_timer_t *)data; - - timer->func(timer->arg); -} - -void os_timer_init(os_timer_t *timer, os_timer_func_t func, void *arg) -{ - timer->func = func; - timer->arg = arg; - timer->timer.function = timer_func; - timer->timer.data = (unsigned long)timer; - init_timer(&timer->timer); -} -EXPORT_SYMBOL(os_timer_init); diff --git a/drivers/staging/csr/oska/timer.h b/drivers/staging/csr/oska/timer.h deleted file mode 100644 index 3045fc3..0000000 --- a/drivers/staging/csr/oska/timer.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * OSKA Linux implementation -- timers. - * - * Copyright (C) 2009 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef __OSKA_LINUX_TIMER_H -#define __OSKA_LINUX_TIMER_H - -#include -#include - -typedef void (*os_timer_func_t)(void *arg); - -typedef struct { - os_timer_func_t func; - void *arg; - struct timer_list timer; -} os_timer_t; - -void os_timer_init(os_timer_t *timer, os_timer_func_t func, void *arg); - -static inline void os_timer_destroy(os_timer_t *timer) -{ - del_timer_sync(&timer->timer); -} - -static inline void os_timer_set(os_timer_t *timer, unsigned long expires_ms) -{ - mod_timer(&timer->timer, jiffies + msecs_to_jiffies(expires_ms)); -} - -static inline void os_timer_cancel(os_timer_t *timer) -{ - del_timer(&timer->timer); -} - -#endif /* #ifndef __OSKA_LINUX_TIMER_H */ -- cgit v0.10.2 From db03f1d2cb5f99dd8bd33d68c28f67b43c67545a Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 19 Jul 2012 17:52:51 -0700 Subject: staging: csr: remove oska submodule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Turns out nothing in this module was being used at all, so instead of deleting it piece by piece, just remove the whole thing. I don't know why it was added in the first place. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/Makefile b/drivers/staging/csr/Makefile index e0e7bab..1c1685b 100644 --- a/drivers/staging/csr/Makefile +++ b/drivers/staging/csr/Makefile @@ -1,5 +1,3 @@ -obj-$(CONFIG_CSR_WIFI) += oska/ - ccflags-y := -DCSR_SME_USERSPACE -DCSR_SUPPORT_SME -DREMOTE_SYS_SAP -DCSR_WIFI_SECURITY_WAPI_ENABLE -DENABLE_SHUTDOWN -DUNIFI_DEBUG ccflags-y += -DSDIO_EXPORTS_STRUCT_DEVICE -DCSR_WIFI_SUPPORT_MMC_DRIVER -DCSR_WIFI_SINGLE_FUNCTION -DCSR_WIFI_SPLIT_PATCH ccflags-y += -DCSR_SUPPORT_WEXT -DREMOTE_SYS_SAP -DREMOTE_MGT_SAP -DCSR_WIFI_SECURITY_WAPI_ENABLE -DCSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND -DENABLE_SHUTDOWN -DCSR_WIFI_NME_ENABLE -DCSR_WIFI_AP_ENABLE -DCSR_SUPPORT_WEXT_AP -DCSR_WIFI_REQUEUE_PACKET_TO_HAL diff --git a/drivers/staging/csr/oska/Makefile b/drivers/staging/csr/oska/Makefile deleted file mode 100644 index 02b8ef5..0000000 --- a/drivers/staging/csr/oska/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -obj-$(CONFIG_CSR_WIFI) := csr_oska.o - -csr_oska-y := \ - event.o \ - oska_module.o \ - thread.o - diff --git a/drivers/staging/csr/oska/alloc.h b/drivers/staging/csr/oska/alloc.h deleted file mode 100644 index 0f10601..0000000 --- a/drivers/staging/csr/oska/alloc.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * OSKA Linux implementation -- memory allocation - * - * Copyright (C) 2007 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef __OSKA_LINUX_ALLOC_H -#define __OSKA_LINUX_ALLOC_H - -#include -#include -#include - -static inline void *os_alloc(size_t size) -{ - return kzalloc(size, GFP_ATOMIC); -} - -static inline void *os_alloc_nonzeroed(size_t size) -{ - return kmalloc(size, GFP_KERNEL); -} - -static inline void os_free(void *ptr) -{ - kfree(ptr); -} - -static inline void *os_alloc_big(size_t size) -{ - return vmalloc(size); -} - -static inline void os_free_big(void *ptr) -{ - vfree(ptr); -} - -#endif /* #ifndef __OSKA_LINUX_ALLOC_H */ diff --git a/drivers/staging/csr/oska/event.c b/drivers/staging/csr/oska/event.c deleted file mode 100644 index 4aedaaa..0000000 --- a/drivers/staging/csr/oska/event.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Linux event functions. - * - * Copyright (C) 2009 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#include -#include - -#include "event.h" - -void os_event_init(os_event_t *evt) -{ - init_waitqueue_head(&evt->wq); - spin_lock_init(&evt->lock); - evt->events = 0; -} -EXPORT_SYMBOL(os_event_init); - -uint16_t os_event_wait(os_event_t *evt) -{ - uint16_t e; - unsigned long flags; - - wait_event(evt->wq, evt->events != 0); - - spin_lock_irqsave(&evt->lock, flags); - e = evt->events; - evt->events &= ~e; - spin_unlock_irqrestore(&evt->lock, flags); - - return e; -} -EXPORT_SYMBOL(os_event_wait); - -uint16_t os_event_wait_interruptible(os_event_t *evt) -{ - uint16_t e; - unsigned long flags; - - wait_event_interruptible(evt->wq, evt->events != 0); - - spin_lock_irqsave(&evt->lock, flags); - e = evt->events; - evt->events &= ~e; - spin_unlock_irqrestore(&evt->lock, flags); - - return e; -} -EXPORT_SYMBOL(os_event_wait_interruptible); - -uint16_t os_event_wait_timed(os_event_t *evt, unsigned timeout_ms) -{ - uint16_t e; - unsigned long flags; - - wait_event_interruptible_timeout(evt->wq, - evt->events != 0, - msecs_to_jiffies(timeout_ms)); - - spin_lock_irqsave(&evt->lock, flags); - e = evt->events; - evt->events &= ~e; - spin_unlock_irqrestore(&evt->lock, flags); - - return e; -} -EXPORT_SYMBOL(os_event_wait_timed); - -void os_event_raise(os_event_t *evt, uint16_t events) -{ - unsigned long flags; - - spin_lock_irqsave(&evt->lock, flags); - evt->events |= events; - spin_unlock_irqrestore(&evt->lock, flags); - - wake_up(&evt->wq); -} -EXPORT_SYMBOL(os_event_raise); diff --git a/drivers/staging/csr/oska/event.h b/drivers/staging/csr/oska/event.h deleted file mode 100644 index be52e42..0000000 --- a/drivers/staging/csr/oska/event.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * OSKA Linux implementation -- events - * - * Copyright (C) 2009 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef __OSKA_LINUX_EVENT_H -#define __OSKA_LINUX_EVENT_H - -#include -#include -#include - -typedef struct { - wait_queue_head_t wq; - spinlock_t lock; - uint16_t events; -} os_event_t; - -void os_event_init(os_event_t *evt); - -static inline void os_event_destroy(os_event_t *evt) -{ -} - -uint16_t os_event_wait(os_event_t *evt); -uint16_t os_event_wait_interruptible(os_event_t *evt); -uint16_t os_event_wait_timed(os_event_t *evt, unsigned timeout_ms); -void os_event_raise(os_event_t *evt, uint16_t events); - -#endif /* #ifndef __OSKA_LINUX_EVENT_H */ diff --git a/drivers/staging/csr/oska/mutex.h b/drivers/staging/csr/oska/mutex.h deleted file mode 100644 index e7d46fe..0000000 --- a/drivers/staging/csr/oska/mutex.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * OSKA Linux implementation -- mutexes - * - * Copyright (C) 2007 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef __OSKA_LINUX_MUTEX_H -#define __OSKA_LINUX_MUTEX_H - -#include -#include -#include - - -/* Real mutexes were only added to 2.6.16 so use semaphores - instead. */ -typedef struct semaphore os_mutex_t; - -static inline void os_mutex_init(os_mutex_t *mutex) -{ - //init_MUTEX(mutex); - sema_init(mutex, 1); -} - -static inline void os_mutex_destroy(os_mutex_t *mutex) -{ - /* no op */ -} - -static inline void os_mutex_lock(os_mutex_t *mutex) -{ - down(mutex); -} - -static inline void os_mutex_unlock(os_mutex_t *mutex) -{ - up(mutex); -} - -#endif /* __OSKA_LINUX_MUTEX_H */ diff --git a/drivers/staging/csr/oska/oska_module.c b/drivers/staging/csr/oska/oska_module.c deleted file mode 100644 index 2876ec2..0000000 --- a/drivers/staging/csr/oska/oska_module.c +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Linux kernel module support. - * - * Copyright (C) 2010 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#include - -MODULE_DESCRIPTION("Operating System Kernel Abstraction"); -MODULE_AUTHOR("Cambridge Silicon Radio Ltd."); -MODULE_LICENSE("GPL and additional rights"); diff --git a/drivers/staging/csr/oska/semaphore.h b/drivers/staging/csr/oska/semaphore.h deleted file mode 100644 index 965bfe8..0000000 --- a/drivers/staging/csr/oska/semaphore.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * OSKA Linux implementation -- semaphores - * - * Copyright (C) 2007 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef __OSKA_LINUX_SEMAPHORE_H -#define __OSKA_LINUX_SEMAPHORE_H - -#include - -#include - -typedef struct semaphore os_semaphore_t; - -static inline void os_semaphore_init(os_semaphore_t *sem) -{ - sema_init(sem, 0); -} - -static inline void os_semaphore_destroy(os_semaphore_t *sem) -{ -} - -static inline void os_semaphore_wait(os_semaphore_t *sem) -{ - down(sem); -} - -/* - * down_timeout() was added in 2.6.26 with the generic semaphore - * implementation. For now, only support it on recent kernels as - * semaphores may be replaced by an event API that would be - * implemented with wait_event(), and wait_event_timeout(). - */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) - -static inline int os_semaphore_wait_timed(os_semaphore_t *sem, - int time_ms) -{ - if (down_timeout(sem, msecs_to_jiffies(time_ms)) < 0) { - return -ETIMEDOUT; - } - return 0; -} - -#else - -static inline int os_semaphore_wait_timed(os_semaphore_t *sem, int time_ms) -{ - unsigned long now = jiffies; - do{ - if(!down_trylock(sem)) - return 0; - msleep(1); - } while(time_before(jiffies, now + msecs_to_jiffies(time_ms))); - - return -ETIMEDOUT; -} - -#endif - -static inline void os_semaphore_post(os_semaphore_t *sem) -{ - up(sem); -} - -#endif /* __OSKA_LINUX_SEMAPHORE_H */ diff --git a/drivers/staging/csr/oska/spinlock.h b/drivers/staging/csr/oska/spinlock.h deleted file mode 100644 index 157b350..0000000 --- a/drivers/staging/csr/oska/spinlock.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * OSKA Linux implementation -- spinlocks - * - * Copyright (C) 2007 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef __OSKA_LINUX_SPINLOCK_H -#define __OSKA_LINUX_SPINLOCK_H - -#include -#include - -typedef spinlock_t os_spinlock_t; -typedef unsigned long os_int_status_t; - -static inline void os_spinlock_init(os_spinlock_t *lock) -{ - spinlock_t *l = (spinlock_t *)lock; - spin_lock_init(l); -} - -static inline void os_spinlock_destroy(os_spinlock_t *lock) -{ - /* no op */ -} - -static inline void os_spinlock_lock_intsave(os_spinlock_t *lock, - os_int_status_t *int_state) -{ - spinlock_t *l = (spinlock_t *)lock; - spin_lock_irqsave(l, *int_state); -} - -static inline void os_spinlock_unlock_intrestore(os_spinlock_t *lock, - os_int_status_t *int_state) -{ - spinlock_t *l = (spinlock_t *)lock; - spin_unlock_irqrestore(l, *int_state); -} - -#endif /* #ifndef __OSKA_LINUX_SPINLOCK_H */ diff --git a/drivers/staging/csr/oska/thread.c b/drivers/staging/csr/oska/thread.c deleted file mode 100644 index f680cef..0000000 --- a/drivers/staging/csr/oska/thread.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Linux thread functions. - * - * Copyright (C) 2007 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#include - -#include "thread.h" - -static int thread_func(void *data) -{ - os_thread_t *thread = data; - - thread->func(thread->arg); - - /* - * kthread_stop() cannot handle the thread exiting while - * kthread_should_stop() is false, so sleep until kthread_stop() - * wakes us up. - */ - set_current_state(TASK_INTERRUPTIBLE); - if (!kthread_should_stop()) - schedule(); - - return 0; -} - -int os_thread_create(os_thread_t *thread, const char *name, void (*func)(void *), void *arg) -{ - thread->func = func; - thread->arg = arg; - - thread->stop = 0; - - thread->task = kthread_run(thread_func, thread, name); - if (IS_ERR(thread->task)) { - return PTR_ERR(thread->task); - } - return 0; -} -EXPORT_SYMBOL(os_thread_create); - -void os_thread_stop(os_thread_t *thread, os_event_t *evt) -{ - /* - * Stop flag must be set before the event is raised so - * kthread_should_stop() cannot be used. - */ - thread->stop = 1; - - if (evt) { - os_event_raise(evt, ~0); - } - - kthread_stop(thread->task); -} -EXPORT_SYMBOL(os_thread_stop); - -int os_thread_should_stop(os_thread_t *thread) -{ - return thread->stop; -} -EXPORT_SYMBOL(os_thread_should_stop); diff --git a/drivers/staging/csr/oska/thread.h b/drivers/staging/csr/oska/thread.h deleted file mode 100644 index 8816dc8..0000000 --- a/drivers/staging/csr/oska/thread.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * OSKA Linux implementation -- threading - * - * Copyright (C) 2007 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef __OSKA_LINUX_THREAD_H -#define __OSKA_LINUX_THREAD_H - -#include -#include -#include -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19) -#include -#endif -#include "event.h" - -struct os_thread_lx { - void (*func)(void *); - void *arg; - struct task_struct *task; - int stop; -}; - -typedef struct os_thread_lx os_thread_t; - -int os_thread_create(os_thread_t *thread, const char *name, - void (*func)(void *), void *arg); -void os_thread_stop(os_thread_t *thread, os_event_t *evt); -int os_thread_should_stop(os_thread_t *thread); - -static inline void os_try_suspend_thread(os_thread_t *thread) -{ - try_to_freeze(); -} - -#endif /* __OSKA_LINUX_THREAD_H */ diff --git a/drivers/staging/csr/oska/trace.h b/drivers/staging/csr/oska/trace.h deleted file mode 100644 index b28f37d..0000000 --- a/drivers/staging/csr/oska/trace.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * OSKA Linux implementation -- tracing messages. - * - * Copyright (C) 2009 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef __OSKA_LINUX_TRACE_H -#define __OSKA_LINUX_TRACE_H - -#include - -#ifndef OS_TRACE_PREFIX -# define OS_TRACE_PREFIX "" -#endif - -#define os_trace_err(format, ...) printk(KERN_ERR OS_TRACE_PREFIX format "\n", ## __VA_ARGS__) -#define os_trace_warn(format, ...) printk(KERN_WARNING OS_TRACE_PREFIX format "\n", ## __VA_ARGS__) -#define os_trace_info(format, ...) printk(KERN_INFO OS_TRACE_PREFIX format "\n", ## __VA_ARGS__) -#define os_trace_dbg(format, ...) printk(KERN_DEBUG OS_TRACE_PREFIX format "\n", ## __VA_ARGS__) - -#endif /* #ifndef __OSKA_LINUX_TRACE_H */ diff --git a/drivers/staging/csr/oska/util.h b/drivers/staging/csr/oska/util.h deleted file mode 100644 index bf29e2d..0000000 --- a/drivers/staging/csr/oska/util.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * OSKA Linux implementation -- misc. utility functions - * - * Copyright (C) 2007 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef __OSKA_LINUX_UTILS_H -#define __OSKA_LINUX_UTILS_H - -#include -#include -#include - -#define OS_ASSERT(expr) BUG_ON(!(expr)) - -static inline uint16_t os_le16_to_cpu(uint16_t x) -{ - return le16_to_cpu(x); -} - -static inline uint16_t os_cpu_to_le16(uint16_t x) -{ - return cpu_to_le16(x); -} - -static inline uint32_t os_le32_to_cpu(uint32_t x) -{ - return le32_to_cpu(x); -} - -static inline uint32_t os_cpu_to_le32(uint32_t x) -{ - return cpu_to_le32(x); -} - -static inline uint64_t os_le64_to_cpu(uint64_t x) -{ - return le64_to_cpu(x); -} - -static inline uint64_t os_cpu_to_le64(uint64_t x) -{ - return cpu_to_le64(x); -} - -#endif /* __OSKA_LINUX_UTILS_H */ -- cgit v0.10.2 From 22c45f0b3502ddd48637b4b2f65036fbe0868622 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 11:21:41 -0700 Subject: staging: csr: remove sdioemb/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nothing in the subdirectory is being used, so remove it, and the sdio_emb.c file which also isn't being built. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/sdio_emb.c b/drivers/staging/csr/sdio_emb.c deleted file mode 100644 index b6a7d6f..0000000 --- a/drivers/staging/csr/sdio_emb.c +++ /dev/null @@ -1,891 +0,0 @@ -/* - * --------------------------------------------------------------------------- - * - * FILE: sdio_emb.c - * - * PURPOSE: Driver instantiation and deletion for SDIO on Linux. - * - * This file brings together the SDIO bus interface, the UniFi - * driver core and the Linux net_device stack. - * - * Copyright (C) 2007-2009 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * --------------------------------------------------------------------------- - */ -#include -#include -#include -#include "csr_wifi_hip_unifi.h" -#include "unifi_priv.h" - -#include "sdioemb/sdio_api.h" - -/* The function driver context, i.e the UniFi Driver */ -static CsrSdioFunctionDriver *sdio_func_drv; - -#ifdef CONFIG_PM -static int uf_sdio_emb_power_event(struct notifier_block *this, unsigned long event, void *ptr); -#endif - -/* The Android wakelock is here for completeness. Typically the MMC driver is used - * instead of sdioemb, but sdioemb may be used for CSPI. - */ -#ifdef ANDROID_BUILD -struct wake_lock unifi_sdio_wake_lock; /* wakelock to prevent suspend while resuming */ -#endif - -/* sdioemb driver uses POSIX error codes */ -static CsrResult -ConvertSdioToCsrSdioResult(int r) -{ - CsrResult csrResult = CSR_RESULT_FAILURE; - - switch (r) { - case 0: - csrResult = CSR_RESULT_SUCCESS; - break; - case -EIO: - csrResult = CSR_SDIO_RESULT_CRC_ERROR; - break; - /* Timeout errors */ - case -ETIMEDOUT: - case -EBUSY: - csrResult = CSR_SDIO_RESULT_TIMEOUT; - break; - case -ENODEV: - case -ENOMEDIUM: - csrResult = CSR_SDIO_RESULT_NO_DEVICE; - break; - case -EINVAL: - csrResult = CSR_SDIO_RESULT_INVALID_VALUE; - break; - case -ENOMEM: - case -ENOSYS: - case -EILSEQ: - case -ERANGE: - case -ENXIO: - csrResult = CSR_RESULT_FAILURE; - break; - default: - unifi_warning(NULL, "Unrecognised SDIO error code: %d\n", r); - break; - } - - return csrResult; -} - - -CsrResult -CsrSdioRead8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data) -{ - struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; - int err; - err = sdioemb_read8(fdev, address, data); - if (err) { - return ConvertSdioToCsrSdioResult(err); - } - return CSR_RESULT_SUCCESS; -} /* CsrSdioRead8() */ - -CsrResult -CsrSdioWrite8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data) -{ - struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; - int err; - err = sdioemb_write8(fdev, address, data); - if (err) { - return ConvertSdioToCsrSdioResult(err); - } - return CSR_RESULT_SUCCESS; -} /* CsrSdioWrite8() */ - -CsrResult -CsrSdioRead16(CsrSdioFunction *function, CsrUint32 address, CsrUint16 *data) -{ - struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; - int r; - - r = sdioemb_read16(fdev, address, data); - if (r) { - return ConvertSdioToCsrSdioResult(r); - } - - return CSR_RESULT_SUCCESS; -} /* CsrSdioRead16() */ - -CsrResult -CsrSdioWrite16(CsrSdioFunction *function, CsrUint32 address, CsrUint16 data) -{ - struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; - int r; - - r = sdioemb_write16(fdev, address, data); - if (r) { - return ConvertSdioToCsrSdioResult(r); - } - - return CSR_RESULT_SUCCESS; -} /* CsrSdioWrite16() */ - - -CsrResult -CsrSdioF0Read8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data) -{ - struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; - int err; - err = sdioemb_f0_read8(fdev, address, data); - if (err) { - return ConvertSdioToCsrSdioResult(err); - } - return CSR_RESULT_SUCCESS; -} /* CsrSdioF0Read8() */ - - -CsrResult -CsrSdioF0Write8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data) -{ - struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; - int err; - err = sdioemb_f0_write8(fdev, address, data); - if (err) { - return ConvertSdioToCsrSdioResult(err); - } - return CSR_RESULT_SUCCESS; -} /* CsrSdioF0Write8() */ - -CsrResult -CsrSdioRead(CsrSdioFunction *function, CsrUint32 address, void *data, CsrUint32 length) -{ - struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; - int err; - err = sdioemb_read(fdev, address, data, length); - if (err) { - return ConvertSdioToCsrSdioResult(err); - } - return CSR_RESULT_SUCCESS; -} /* CsrSdioRead() */ - -CsrResult -CsrSdioWrite(CsrSdioFunction *function, CsrUint32 address, const void *data, CsrUint32 length) -{ - struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; - int err; - err = sdioemb_write(fdev, address, data, length); - if (err) { - return ConvertSdioToCsrSdioResult(err); - } - return CSR_RESULT_SUCCESS; -} /* CsrSdioWrite() */ - - -CsrResult -CsrSdioBlockSizeSet(CsrSdioFunction *function, CsrUint16 blockSize) -{ - struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; - int r = 0; - - /* Module parameter overrides */ - if (sdio_block_size > -1) { - blockSize = sdio_block_size; - } - - unifi_trace(NULL, UDBG1, "Set SDIO function block size to %d\n", - blockSize); - - r = sdioemb_set_block_size(fdev, blockSize); - if (r) { - unifi_error(NULL, "Error %d setting block size\n", r); - } - - /* Determine the achieved block size to report to the core */ - function->blockSize = fdev->blocksize; - - return ConvertSdioToCsrSdioResult(r); -} /* CsrSdioBlockSizeSet() */ - - -/* - * --------------------------------------------------------------------------- - * CsrSdioMaxBusClockFrequencySet - * - * Set the maximum SDIO bus clock speed to use. - * - * Arguments: - * sdio SDIO context pointer - * maxFrequency maximum clock speed in Hz - * - * Returns: - * an error code. - * --------------------------------------------------------------------------- - */ -CsrResult -CsrSdioMaxBusClockFrequencySet(CsrSdioFunction *function, CsrUint32 maxFrequency) -{ - struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; - CsrUint32 max_khz = maxFrequency/1000; - - if (!max_khz || max_khz > sdio_clock) { - max_khz = sdio_clock; - } - unifi_trace(NULL, UDBG1, "Setting SDIO bus clock to %d kHz\n", max_khz); - sdioemb_set_max_bus_freq(fdev, 1000 * max_khz); - - return CSR_RESULT_SUCCESS; -} /* CsrSdioMaxBusClockFrequencySet() */ - - -/* - * --------------------------------------------------------------------------- - * CsrSdioInterruptEnable - * CsrSdioInterruptDisable - * - * Enable or disable the SDIO interrupt. - * - * Arguments: - * sdio SDIO context pointer - * - * Returns: - * Zero on success or a UniFi driver error code. - * --------------------------------------------------------------------------- - */ -CsrResult -CsrSdioInterruptEnable(CsrSdioFunction *function) -{ - struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; - int r; - - r = sdioemb_interrupt_enable(fdev); - if (r) { - return ConvertSdioToCsrSdioResult(r); - } - - return CSR_RESULT_SUCCESS; -} /* CsrSdioInterruptEnable() */ - -CsrResult -CsrSdioInterruptDisable(CsrSdioFunction *function) -{ - struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; - int r; - - r = sdioemb_interrupt_disable(fdev); - if (r) { - return ConvertSdioToCsrSdioResult(r); - } - - return CSR_RESULT_SUCCESS; -} /* CsrSdioInterruptDisable() */ - - -/* - * --------------------------------------------------------------------------- - * CsrSdioInterruptAcknowledge - * - * Acknowledge an SDIO interrupt. - * - * Arguments: - * sdio SDIO context pointer - * - * Returns: - * Zero on success or a UniFi driver error code. - * --------------------------------------------------------------------------- - */ -void CsrSdioInterruptAcknowledge(CsrSdioFunction *function) -{ - struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; - - sdioemb_interrupt_acknowledge(fdev); -} /* CsrSdioInterruptAcknowledge() */ - - -/* - * --------------------------------------------------------------------------- - * CsrSdioFunctionEnable - * - * Enable i/o on this function. - * - * Arguments: - * sdio SDIO context pointer - * - * Returns: - * UniFi driver error code. - * --------------------------------------------------------------------------- - */ -CsrResult -CsrSdioFunctionEnable(CsrSdioFunction *function) -{ - struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; - int r; - - /* Enable UniFi function (the 802.11 part). */ - r = sdioemb_enable_function(fdev); - if (r) { - unifi_error(NULL, "Failed to enable SDIO function %d\n", fdev->function); - return ConvertSdioToCsrSdioResult(r); - } - return CSR_RESULT_SUCCESS; -} /* CsrSdioFunctionEnable() */ - - -/* - * --------------------------------------------------------------------------- - * CsrSdioFunctionDisable - * - * Disable i/o on this function. - * - * Arguments: - * sdio SDIO context pointer - * - * Returns: - * UniFi driver error code. - * --------------------------------------------------------------------------- - */ -CsrResult -CsrSdioFunctionDisable(CsrSdioFunction *function) -{ - struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; - int r; - - /* Disable UniFi function (the 802.11 part). */ - r = sdioemb_disable_function(fdev); - if (r) { - unifi_error(NULL, "Failed to disable SDIO function %d\n", fdev->function); - return ConvertSdioToCsrSdioResult(r); - } - return CSR_RESULT_SUCCESS; -} /* CsrSdioFunctionDisable() */ - - -/* - * --------------------------------------------------------------------------- - * CsrSdioFunctionActive - * - * No-op as the bus goes to an active state at the start of every - * command. - * - * Arguments: - * sdio SDIO context pointer - * --------------------------------------------------------------------------- - */ -void -CsrSdioFunctionActive(CsrSdioFunction *function) -{ -} /* CsrSdioFunctionActive() */ - -/* - * --------------------------------------------------------------------------- - * CsrSdioFunctionIdle - * - * Set the function as idle. - * - * Arguments: - * sdio SDIO context pointer - * --------------------------------------------------------------------------- - */ -void -CsrSdioFunctionIdle(CsrSdioFunction *function) -{ - struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; - - sdioemb_idle_function(fdev); -} /* CsrSdioFunctionIdle() */ - - -CsrResult -CsrSdioPowerOn(CsrSdioFunction *function) -{ - struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; - - if (disable_power_control != 1) { - sdioemb_power_on(fdev); - } - - return CSR_RESULT_SUCCESS; -} /* CsrSdioPowerOn() */ - -void -CsrSdioPowerOff(CsrSdioFunction *function) -{ - struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; - if (disable_power_control != 1) { - sdioemb_power_off(fdev); - } -} /* CsrSdioPowerOff() */ - - -/* - * --------------------------------------------------------------------------- - * CsrSdioHardReset - * - * Hard Resets UniFi is possible. - * - * Arguments: - * sdio SDIO context pointer - * - * Returns: - * 1 if the SDIO driver is not capable of doing a hard reset. - * 0 if a hard reset was successfully performed. - * -CSR_EIO if an I/O error occured while re-initializing the card. - * This is a fatal, non-recoverable error. - * -CSR_ENODEV if the card is no longer present. - * --------------------------------------------------------------------------- - */ -CsrResult -CsrSdioHardReset(CsrSdioFunction *function) -{ - struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; - int r; - - /* Hard reset can be disabled by a module parameter */ - r = 1; - if (disable_hw_reset != 1) { - r = sdioemb_hard_reset(fdev); /* may return 1 if can't reset */ - if (r < 0) { - return ConvertSdioToCsrSdioResult(r); /* fatal error */ - } - } - - /* Set the SDIO bus width after a hard reset */ - if (buswidth == 1) { - unifi_info(NULL, "Setting SDIO bus width to 1\n"); - sdioemb_set_bus_width(fdev, buswidth); - } else if (buswidth == 4) { - unifi_info(NULL, "Setting SDIO bus width to 4\n"); - sdioemb_set_bus_width(fdev, buswidth); - } - - if(r == 1) - { - return CSR_SDIO_RESULT_NOT_RESET; - } - - return ConvertSdioToCsrSdioResult(r); - -} /* CsrSdioHardReset() */ - - -int csr_sdio_linux_remove_irq(CsrSdioFunction *function) -{ - struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; - - return sdioemb_interrupt_disable(fdev); -} - -int csr_sdio_linux_install_irq(CsrSdioFunction *function) -{ - struct sdioemb_dev *fdev = (struct sdioemb_dev *)function->priv; - - return sdioemb_interrupt_enable(fdev); -} - - -/* - * --------------------------------------------------------------------------- - * uf_glue_sdio_int_handler - * Card interrupt callback. - * - * Arguments: - * fdev SDIO context pointer - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -static void -uf_glue_sdio_int_handler(struct sdioemb_dev *fdev) -{ - CsrSdioFunction *sdio_ctx = fdev->drv_data; - CsrSdioInterruptDsrCallback func_dsr_callback; - - /* If the function driver has registered a handler, call it */ - if (sdio_func_drv && sdio_func_drv->intr) { - /* The function driver may return a DSR. */ - func_dsr_callback = sdio_func_drv->intr(sdio_ctx); - /* If it did return a DSR handle, call it */ - if (func_dsr_callback) { - func_dsr_callback(sdio_ctx); - } - } -} - -#ifdef CONFIG_PM - -/* - * Power Management notifier - */ -struct uf_sdio_emb_pm_notifier -{ - struct list_head list; - - CsrSdioFunction *sdio_ctx; - struct notifier_block pm_notifier; -}; - -/* PM notifier list head */ -static struct uf_sdio_emb_pm_notifier uf_sdio_emb_pm_notifiers = { - .sdio_ctx = NULL, -}; - -/* - * --------------------------------------------------------------------------- - * uf_sdio_emb_register_pm_notifier - * uf_sdio_emb_unregister_pm_notifier - * - * Register/unregister for power management events. A list is used to - * allow multiple card instances to be supported. - * - * Arguments: - * sdio_ctx - CSR SDIO context to associate PM notifier to - * - * Returns: - * Register function returns NULL on error - * --------------------------------------------------------------------------- - */ -static struct uf_sdio_emb_pm_notifier * -uf_sdio_emb_register_pm_notifier(CsrSdioFunction *sdio_ctx) -{ - /* Allocate notifier context for this card instance */ - struct uf_sdio_emb_pm_notifier *notifier_ctx = kmalloc(sizeof(struct uf_sdio_emb_pm_notifier), GFP_KERNEL); - - if (notifier_ctx) - { - notifier_ctx->sdio_ctx = sdio_ctx; - notifier_ctx->pm_notifier.notifier_call = uf_sdio_emb_power_event; - - list_add(¬ifier_ctx->list, &uf_sdio_emb_pm_notifiers.list); - - if (register_pm_notifier(¬ifier_ctx->pm_notifier)) { - printk(KERN_ERR "unifi: register_pm_notifier failed\n"); - } - } - - return notifier_ctx; -} - -static void -uf_sdio_emb_unregister_pm_notifier(CsrSdioFunction *sdio_ctx) -{ - struct uf_sdio_emb_pm_notifier *notifier_ctx; - struct list_head *node, *q; - - list_for_each_safe(node, q, &uf_sdio_emb_pm_notifiers.list) { - notifier_ctx = list_entry(node, struct uf_sdio_emb_pm_notifier, list); - - /* If it matches, unregister and free the notifier context */ - if (notifier_ctx && notifier_ctx->sdio_ctx == sdio_ctx) - { - if (unregister_pm_notifier(¬ifier_ctx->pm_notifier)) { - printk(KERN_ERR "unifi: unregister_pm_notifier failed\n"); - } - - /* Remove from list */ - notifier_ctx->sdio_ctx = NULL; - list_del(node); - kfree(notifier_ctx); - } - } -} - -/* - * --------------------------------------------------------------------------- - * uf_sdio_emb_power_event - * - * Handler for power management events. - * - * We need to handle suspend/resume events while the userspace is unsuspended - * to allow the SME to run its suspend/resume state machines. - * - * Arguments: - * event event ID - * - * Returns: - * Status of the event handling - * --------------------------------------------------------------------------- - */ -static int -uf_sdio_emb_power_event(struct notifier_block *this, unsigned long event, void *ptr) -{ - struct uf_sdio_emb_pm_notifier *notifier_ctx = container_of(this, - struct uf_sdio_emb_pm_notifier, - pm_notifier); - - /* Call the CSR SDIO function driver's suspend/resume method - * while the userspace is unsuspended. - */ - switch (event) { - case PM_POST_HIBERNATION: - case PM_POST_SUSPEND: - printk(KERN_INFO "%s:%d resume\n", __FUNCTION__, __LINE__ ); - if (sdio_func_drv && sdio_func_drv->resume) { - sdio_func_drv->resume(notifier_ctx->sdio_ctx); - } - break; - - case PM_HIBERNATION_PREPARE: - case PM_SUSPEND_PREPARE: - printk(KERN_INFO "%s:%d suspend\n", __FUNCTION__, __LINE__ ); - if (sdio_func_drv && sdio_func_drv->suspend) { - sdio_func_drv->suspend(notifier_ctx->sdio_ctx); - } - break; - } - return NOTIFY_DONE; -} - -#endif /* CONFIG_PM */ - -/* - * --------------------------------------------------------------------------- - * uf_glue_sdio_probe - * - * Card insert callback. - * - * Arguments: - * fdev SDIO context pointer - * - * Returns: - * UniFi driver error code. - * --------------------------------------------------------------------------- - */ -static int -uf_glue_sdio_probe(struct sdioemb_dev *fdev) -{ - CsrSdioFunction *sdio_ctx; - - unifi_info(NULL, "UniFi card inserted\n"); - - /* Allocate context and private in one lump */ - sdio_ctx = (CsrSdioFunction *)kmalloc(sizeof(CsrSdioFunction), - GFP_KERNEL); - if (sdio_ctx == NULL) { - return -ENOMEM; - } - - - sdio_ctx->sdioId.manfId = fdev->vendor_id; - sdio_ctx->sdioId.cardId = fdev->device_id; - sdio_ctx->sdioId.sdioFunction = fdev->function; - sdio_ctx->sdioId.sdioInterface = 0; - sdio_ctx->blockSize = fdev->blocksize; - sdio_ctx->priv = (void *)fdev; - sdio_ctx->features = 0; - - /* Module parameter enables byte mode */ - if (sdio_byte_mode) { - sdio_ctx->features |= CSR_SDIO_FEATURE_BYTE_MODE; - } - - /* Set up pointer to func_priv in middle of lump */ - fdev->drv_data = sdio_ctx; - - /* Always override default SDIO bus clock */ - unifi_trace(NULL, UDBG1, "Setting SDIO bus clock to %d kHz\n", sdio_clock); - sdioemb_set_max_bus_freq(fdev, 1000 * sdio_clock); - -#ifdef CONFIG_PM - /* Register to get PM events */ - if (uf_sdio_emb_register_pm_notifier(sdio_ctx) == NULL) { - unifi_error(NULL, "%s: Failed to register for PM events\n", __FUNCTION__); - } -#endif - - /* Call the main UniFi driver inserted handler */ - if (sdio_func_drv && sdio_func_drv->inserted) { - uf_add_os_device(fdev->slot_id, fdev->os_device); - sdio_func_drv->inserted(sdio_ctx); - } - -#ifdef ANDROID_BUILD - /* Take the wakelock */ - unifi_trace(NULL, UDBG1, "emb probe: take wake lock\n"); - wake_lock(&unifi_sdio_wake_lock); -#endif - - return 0; -} /* uf_glue_sdio_probe() */ - - - -/* - * --------------------------------------------------------------------------- - * uf_sdio_remove - * - * Card removal callback. - * - * Arguments: - * fdev SDIO device - * - * Returns: - * UniFi driver error code. - * --------------------------------------------------------------------------- - */ -static void -uf_sdio_remove(struct sdioemb_dev *fdev) -{ - CsrSdioFunction *sdio_ctx = fdev->drv_data; - - unifi_info(NULL, "UniFi card removed\n"); - - /* Clean up the SDIO function driver */ - if (sdio_func_drv && sdio_func_drv->removed) { - sdio_func_drv->removed(sdio_ctx); - } - -#ifdef CONFIG_PM - /* Unregister for PM events */ - uf_sdio_emb_unregister_pm_notifier(sdio_ctx); -#endif - - kfree(sdio_ctx); - -} /* uf_sdio_remove */ - - -/* - * --------------------------------------------------------------------------- - * uf_glue_sdio_suspend - * - * System suspend callback. - * - * Arguments: - * fdev SDIO device - * - * Returns: - * - * --------------------------------------------------------------------------- - */ -static void -uf_glue_sdio_suspend(struct sdioemb_dev *fdev) -{ - unifi_info(NULL, "Suspending...\n"); - -} /* uf_glue_sdio_suspend() */ - - -/* - * --------------------------------------------------------------------------- - * uf_glue_sdio_resume - * - * System resume callback. - * - * Arguments: - * fdev SDIO device - * - * Returns: - * - * --------------------------------------------------------------------------- - */ -static void -uf_glue_sdio_resume(struct sdioemb_dev *fdev) -{ - unifi_info(NULL, "Resuming...\n"); - -#ifdef ANDROID_BUILD - unifi_trace(NULL, UDBG1, "emb resume: take wakelock\n"); - wake_lock(&unifi_sdio_wake_lock); -#endif - -} /* uf_glue_sdio_resume() */ - - - - -static struct sdioemb_func_driver unifi_sdioemb = { - .name = "unifi", - .id_table = NULL, /* Filled in when main driver registers */ - - .probe = uf_glue_sdio_probe, - .remove = uf_sdio_remove, - .card_int_handler = uf_glue_sdio_int_handler, - .suspend = uf_glue_sdio_suspend, - .resume = uf_glue_sdio_resume, -}; - - -/* - * --------------------------------------------------------------------------- - * CsrSdioFunctionDriverRegister - * CsrSdioFunctionDriverUnregister - * - * These functions are called from the main module load and unload - * functions. They perform the appropriate operations for the - * SDIOemb driver. - * - * Arguments: - * None. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -CsrResult -CsrSdioFunctionDriverRegister(CsrSdioFunctionDriver *sdio_drv) -{ - int r; - int i; - - printk("Unifi: Using CSR embedded SDIO driver\n"); - - if (sdio_func_drv) { - unifi_error(NULL, "sdio_emb: UniFi driver already registered\n"); - return CSR_SDIO_RESULT_INVALID_VALUE; - } - - /* Build ID table to pass to sdioemb */ - unifi_sdioemb.id_table = CsrPmemAlloc(sizeof(struct sdioemb_id_table) * (sdio_drv->idsCount + 1)); - if (unifi_sdioemb.id_table == NULL) { - unifi_error(NULL, "sdio_emb: Failed to allocate memory for ID table (%d IDs)\n", sdio_drv->idsCount); - return CSR_RESULT_FAILURE; - } - for (i = 0; i < sdio_drv->idsCount; i++) { - unifi_sdioemb.id_table[i].vendor_id = sdio_drv->ids[i].manfId; - unifi_sdioemb.id_table[i].device_id = sdio_drv->ids[i].cardId; - unifi_sdioemb.id_table[i].function = sdio_drv->ids[i].sdioFunction; - unifi_sdioemb.id_table[i].interface = sdio_drv->ids[i].sdioInterface; - } - unifi_sdioemb.id_table[i].vendor_id = 0; - unifi_sdioemb.id_table[i].device_id = 0; - unifi_sdioemb.id_table[i].function = 0; - unifi_sdioemb.id_table[i].interface = 0; - - /* Save the registered driver description */ - sdio_func_drv = sdio_drv; - -#ifdef CONFIG_PM - /* Initialise PM notifier list */ - INIT_LIST_HEAD(&uf_sdio_emb_pm_notifiers.list); -#endif - -#ifdef ANDROID_BUILD - wake_lock_init(&unifi_sdio_wake_lock, WAKE_LOCK_SUSPEND, "unifi_sdio_work"); -#endif - - /* Register ourself with sdioemb */ - r = sdioemb_driver_register(&unifi_sdioemb); - if (r) { - unifi_error(NULL, "Failed to register UniFi SDIO driver: %d\n", r); - return ConvertSdioToCsrSdioResult(r); - } - - return CSR_RESULT_SUCCESS; -} /* CsrSdioFunctionDriverRegister() */ - - -void -CsrSdioFunctionDriverUnregister(CsrSdioFunctionDriver *sdio_drv) -{ - sdioemb_driver_unregister(&unifi_sdioemb); - -#ifdef ANDROID_BUILD - wake_lock_destroy(&unifi_sdio_wake_lock); -#endif - - sdio_func_drv = NULL; - - CsrPmemFree(unifi_sdioemb.id_table); - unifi_sdioemb.id_table = NULL; -} /* CsrSdioFunctionDriverUnregister() */ - diff --git a/drivers/staging/csr/sdioemb/cspi.h b/drivers/staging/csr/sdioemb/cspi.h deleted file mode 100644 index b0a2886..0000000 --- a/drivers/staging/csr/sdioemb/cspi.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * CSPI definitions. - * - * Copyright (C) 2007 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef SDIOEMB_CSPI_H -#define SDIOEMB_CSPI_H - -/** - * @addtogroup sdriver - *@{*/ - -#define CSPI_FUNC(f) (f) -#define CSPI_READ 0x10 -#define CSPI_WRITE 0x20 -#define CSPI_BURST 0x40 -#define CSPI_TYPE_MASK 0x70 - -/** - * CSPI_MODE function 0 register. - * - * Various CSPI mode settings. - * - * @see CSPI specification (CS-110124-SP) - */ -#define CSPI_MODE 0xf7 -# define CSPI_MODE_PADDED_WRITE_HDRS (1 << 7) -# define CSPI_MODE_PADDED_READ_HDRS (1 << 6) -/** - * BigEndianRegisters bit of \ref CSPI_MODE -- enable big-endian CSPI - * register reads and writes. - * - * @warning This bit should never be set as it's not possible to use - * this mode without knowledge of which registers are 8 bit and which - * are 16 bit. - */ -# define CSPI_MODE_BE_REG (1 << 5) -# define CSPI_MODE_BE_BURST (1 << 4) -# define CSPI_MODE_INT_ACTIVE_HIGH (1 << 3) -# define CSPI_MODE_INT_ON_ERR (1 << 2) -# define CSPI_MODE_LEN_FIELD_PRESENT (1 << 1) -# define CSPI_MODE_DRV_MISO_ON_RISING_CLK (1 << 0) - -#define CSPI_STATUS 0xf8 - -#define CSPI_PADDING 0xf9 -# define CSPI_PADDING_REG(p) ((p) << 0) -# define CSPI_PADDING_BURST(p) ((p) << 4) - -#define CSPI_PADDING_MAX 15 -#define CSPI_PADDING_REG_DFLT 0 -#define CSPI_PADDING_BURST_DFLT 2 - -/* cmd byte, 3 byte addr, padding, error byte, data word */ -#define CSPI_REG_TRANSFER_LEN (1 + 3 + CSPI_PADDING_MAX + 1 + 2) - -/*@}*/ - -#endif /* #ifndef SDIOEMB_CSPI_H */ diff --git a/drivers/staging/csr/sdioemb/csr_result.h b/drivers/staging/csr/sdioemb/csr_result.h deleted file mode 100644 index 9813f3f..0000000 --- a/drivers/staging/csr/sdioemb/csr_result.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Synergy compatible API -- common result codes. - * - * Copyright (C) 2010 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef CSR_RESULT_H__ -#define CSR_RESULT_H__ - -typedef CsrUint16 CsrResult; -#define CSR_RESULT_SUCCESS ((CsrResult) 0x0000) -#define CSR_RESULT_FAILURE ((CsrResult) 0xffff) - -#endif diff --git a/drivers/staging/csr/sdioemb/csr_sdio.h b/drivers/staging/csr/sdioemb/csr_sdio.h deleted file mode 100644 index 5d05d96..0000000 --- a/drivers/staging/csr/sdioemb/csr_sdio.h +++ /dev/null @@ -1,711 +0,0 @@ -/* - * Synergy compatible API -- SDIO. - * - * Copyright (C) 2010 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef CSR_SDIO_H__ -#define CSR_SDIO_H__ - -#include "csr_types.h" -#include "csr_result.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Result Codes */ -#define CSR_SDIO_RESULT_INVALID_VALUE ((CsrResult) 1) /* Invalid argument value */ -#define CSR_SDIO_RESULT_NO_DEVICE ((CsrResult) 2) /* The specified device is no longer present */ -#define CSR_SDIO_RESULT_CRC_ERROR ((CsrResult) 3) /* The transmitted/received data or command response contained a CRC error */ -#define CSR_SDIO_RESULT_TIMEOUT ((CsrResult) 4) /* No command response or data received from device, or function enable/disable did not succeed within timeout period */ -#define CSR_SDIO_RESULT_NOT_RESET ((CsrResult) 5) /* The device was not reset */ - -/* Features (for use in features member of CsrSdioFunction) */ -#define CSR_SDIO_FEATURE_BYTE_MODE 0x00000001 /* Transfer sizes do not have to be a multiple of block size */ -#define CSR_SDIO_FEATURE_DMA_CAPABLE_MEM_REQUIRED 0x00000002 /* Bulk operations require DMA friendly memory */ - -/* CsrSdioFunctionId wildcards (for use in CsrSdioFunctionId members) */ -#define CSR_SDIO_ANY_MANF_ID 0xFFFF -#define CSR_SDIO_ANY_CARD_ID 0xFFFF -#define CSR_SDIO_ANY_SDIO_FUNCTION 0xFF -#define CSR_SDIO_ANY_SDIO_INTERFACE 0xFF - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioFunctionId - * - * DESCRIPTION - * This structure describes one or more functions of a device, based on - * four qualitative measures. The CsrSdioFunctionId wildcard defines can be - * used for making the CsrSdioFunctionId match more than one function. - * - * MEMBERS - * manfId - Vendor ID (or CSR_SDIO_ANY_MANF_ID). - * cardId - Device ID (or CSR_SDIO_ANY_CARD_ID). - * sdioFunction - SDIO Function number (or CSR_SDIO_ANY_SDIO_FUNCTION). - * sdioInterface - SDIO Standard Interface Code (or CSR_SDIO_ANY_SDIO_INTERFACE) - * - *----------------------------------------------------------------------------*/ -typedef struct -{ - CsrUint16 manfId; /* Vendor ID to match or CSR_SDIO_ANY_MANF_ID */ - CsrUint16 cardId; /* Device ID to match or CSR_SDIO_ANY_CARD_ID */ - CsrUint8 sdioFunction; /* SDIO Function number to match or CSR_SDIO_ANY_SDIO_FUNCTION */ - CsrUint8 sdioInterface; /* SDIO Standard Interface Code to match or CSR_SDIO_ANY_SDIO_INTERFACE */ -} CsrSdioFunctionId; - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioFunction - * - * DESCRIPTION - * This structure represents a single function on a device. - * - * MEMBERS - * sdioId - A CsrSdioFunctionId describing this particular function. The - * subfield shall not contain any CsrSdioFunctionId wildcards. The - * subfields shall describe the specific single function - * represented by this structure. - * blockSize - Actual configured block size, or 0 if unconfigured. - * features - Bit mask with any of CSR_SDIO_FEATURE_* set. - * driverData - For use by the Function Driver. The SDIO Driver shall not - * attempt to dereference the pointer. - * priv - For use by the SDIO Driver. The Function Driver shall not attempt - * to dereference the pointer. - * - *----------------------------------------------------------------------------*/ -typedef struct -{ - CsrSdioFunctionId sdioId; - CsrUint16 blockSize; /* Actual configured block size, or 0 if unconfigured */ - CsrUint32 features; /* Bit mask with any of CSR_SDIO_FEATURE_* set */ - void *cardHandle; /* An opaque handle for this function's card. */ - void *osDevice; - void *driverData; /* For use by the Function Driver */ - void *priv; /* For use by the SDIO Driver */ -} CsrSdioFunction; - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioInsertedCallback, CsrSdioRemovedCallback - * - * DESCRIPTION - * CsrSdioInsertedCallback is called when a function becomes available to - * a registered Function Driver that supports the function. - * CsrSdioRemovedCallback is called when a function is no longer available - * to a Function Driver, either because the device has been removed, or the - * Function Driver has been unregistered. - * - * NOTE: These functions are implemented by the Function Driver, and are - * passed as function pointers in the CsrSdioFunctionDriver struct. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * - *----------------------------------------------------------------------------*/ -typedef void (*CsrSdioInsertedCallback)(CsrSdioFunction *function); -typedef void (*CsrSdioRemovedCallback)(CsrSdioFunction *function); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioInterruptDsrCallback, CsrSdioInterruptCallback - * - * DESCRIPTION - * CsrSdioInterruptCallback is called when an interrupt occurs on the - * the device associated with the specified function. - * - * NOTE: These functions are implemented by the Function Driver, and are - * passed as function pointers in the CsrSdioFunctionDriver struct. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * - * RETURNS (only CsrSdioInterruptCallback) - * A pointer to a CsrSdioInterruptDsrCallback function. - * - *----------------------------------------------------------------------------*/ -typedef void (*CsrSdioInterruptDsrCallback)(CsrSdioFunction *function); -typedef CsrSdioInterruptDsrCallback (*CsrSdioInterruptCallback)(CsrSdioFunction *function); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioSuspendCallback, CsrSdioResumeCallback - * - * DESCRIPTION - * CsrSdioSuspendCallback is called when the system is preparing to go - * into a suspended state. CsrSdioResumeCallback is called when the system - * has entered an active state again. - * - * NOTE: These functions are implemented by the Function Driver, and are - * passed as function pointers in the CsrSdioFunctionDriver struct. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * - *----------------------------------------------------------------------------*/ -typedef void (*CsrSdioSuspendCallback)(CsrSdioFunction *function); -typedef void (*CsrSdioResumeCallback)(CsrSdioFunction *function); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioAsyncCallback, CsrSdioAsyncDsrCallback - * - * DESCRIPTION - * CsrSdioAsyncCallback is called when an asynchronous operation completes. - * - * NOTE: These functions are implemented by the Function Driver, and are - * passed as function pointers in the function calls that initiate - * the operation. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * result - The result of the operation that completed. See the description - * of the initiating function for possible result values. - * - * RETURNS (only CsrSdioAsyncCallback) - * A pointer to a CsrSdioAsyncDsrCallback function. - * - *----------------------------------------------------------------------------*/ -typedef void (*CsrSdioAsyncDsrCallback)(CsrSdioFunction *function, CsrResult result); -typedef CsrSdioAsyncDsrCallback (*CsrSdioAsyncCallback)(CsrSdioFunction *function, CsrResult result); - -typedef struct -{ - CsrSdioInsertedCallback inserted; - CsrSdioRemovedCallback removed; - CsrSdioInterruptCallback intr; - CsrSdioSuspendCallback suspend; - CsrSdioResumeCallback resume; - CsrSdioFunctionId *ids; - CsrUint8 idsCount; - void *priv; -} CsrSdioFunctionDriver; - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioFunctionDriverRegister - * - * DESCRIPTION - * Register a Function Driver. - * - * PARAMETERS - * functionDriver - Pointer to struct describing the Function Driver. - * - * RETURNS - * CSR_RESULT_SUCCESS - The Function Driver was successfully - * registered. - * CSR_RESULT_FAILURE - Unable to register the function driver, - * because of an unspecified/unknown error. The - * Function Driver has not been registered. - * CSR_SDIO_RESULT_INVALID_VALUE - The specified Function Driver pointer - * does not point at a valid Function - * Driver structure, or some of the members - * contain invalid entries. - * - *----------------------------------------------------------------------------*/ -CsrResult CsrSdioFunctionDriverRegister(CsrSdioFunctionDriver *functionDriver); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioFunctionDriverUnregister - * - * DESCRIPTION - * Unregister a previously registered Function Driver. - * - * PARAMETERS - * functionDriver - pointer to struct describing the Function Driver. - * - *----------------------------------------------------------------------------*/ -void CsrSdioFunctionDriverUnregister(CsrSdioFunctionDriver *functionDriver); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioFunctionEnable, CsrSdioFunctionDisable - * - * DESCRIPTION - * Enable/disable the specified function by setting/clearing the - * corresponding bit in the I/O Enable register in function 0, and then - * periodically reading the related bit in the I/O Ready register until it - * is set/clear, limited by an implementation defined timeout. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * - * RETURNS - * CSR_RESULT_SUCCESS - The specified function was enabled/disabled. - * CSR_RESULT_FAILURE - Unspecified/unknown error. - * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. - * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. The state of the - * related bit in the I/O Enable register is - * undefined. - * CSR_SDIO_RESULT_TIMEOUT - No response from the device, or the related - * bit in the I/O ready register was not - * set/cleared within the timeout period. - * - * NOTE: If the SDIO R5 response is available, and either of the - * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit - * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), - * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and - * COM_CRC_ERROR bits shall be ignored. - * - * If the CSPI response is available, and any of the - * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE will be returned. - * - *----------------------------------------------------------------------------*/ -CsrResult CsrSdioFunctionEnable(CsrSdioFunction *function); -CsrResult CsrSdioFunctionDisable(CsrSdioFunction *function); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioInterruptEnable, CsrSdioInterruptDisable - * - * DESCRIPTION - * Enable/disable the interrupt for the specified function by - * setting/clearing the corresponding bit in the INT Enable register in - * function 0. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * - * RETURNS - * CSR_RESULT_SUCCESS - The specified function was enabled/disabled. - * CSR_RESULT_FAILURE - Unspecified/unknown error. - * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. - * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. The state of the - * related bit in the INT Enable register is - * unchanged. - * CSR_SDIO_RESULT_INVALID_VALUE - The specified function cannot be - * enabled/disabled, because it either - * does not exist or it is not possible to - * individually enable/disable functions. - * CSR_SDIO_RESULT_TIMEOUT - No response from the device. - * - * NOTE: If the SDIO R5 response is available, and either of the - * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit - * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), - * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and - * COM_CRC_ERROR bits shall be ignored. - * - * If the CSPI response is available, and any of the - * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE will be returned. - * - *----------------------------------------------------------------------------*/ -CsrResult CsrSdioInterruptEnable(CsrSdioFunction *function); -CsrResult CsrSdioInterruptDisable(CsrSdioFunction *function); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioInterruptAcknowledge - * - * DESCRIPTION - * Acknowledge that a signalled interrupt has been handled. Shall only - * be called once, and exactly once for each signalled interrupt to the - * corresponding function. - * - * PARAMETERS - * function - Pointer to struct representing the function to which the - * event was signalled. - * - *----------------------------------------------------------------------------*/ -void CsrSdioInterruptAcknowledge(CsrSdioFunction *function); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioInsertedAcknowledge, CsrSdioRemovedAcknowledge - * - * DESCRIPTION - * Acknowledge that a signalled inserted/removed event has been handled. - * Shall only be called once, and exactly once for each signalled event to - * the corresponding function. - * - * PARAMETERS - * function - Pointer to struct representing the function to which the - * inserted was signalled. - * result (CsrSdioInsertedAcknowledge only) - * CSR_RESULT_SUCCESS - The Function Driver has accepted the - * function, and the function is attached to - * the Function Driver until the - * CsrSdioRemovedCallback is called and - * acknowledged. - * CSR_RESULT_FAILURE - Unable to accept the function. The - * function is not attached to the Function - * Driver, and it may be passed to another - * Function Driver which supports the - * function. - * - *----------------------------------------------------------------------------*/ -void CsrSdioInsertedAcknowledge(CsrSdioFunction *function, CsrResult result); -void CsrSdioRemovedAcknowledge(CsrSdioFunction *function); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioSuspendAcknowledge, CsrSdioResumeAcknowledge - * - * DESCRIPTION - * Acknowledge that a signalled suspend event has been handled. Shall only - * be called once, and exactly once for each signalled event to the - * corresponding function. - * - * PARAMETERS - * function - Pointer to struct representing the function to which the - * event was signalled. - * result - * CSR_RESULT_SUCCESS - Successfully suspended/resumed. - * CSR_RESULT_FAILURE - Unspecified/unknown error. - * - *----------------------------------------------------------------------------*/ -void CsrSdioSuspendAcknowledge(CsrSdioFunction *function, CsrResult result); -void CsrSdioResumeAcknowledge(CsrSdioFunction *function, CsrResult result); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioBlockSizeSet - * - * DESCRIPTION - * Set the block size to use for the function. The actual configured block - * size shall be the minimum of: - * 1) Maximum block size supported by the function. - * 2) Maximum block size supported by the host controller. - * 3) The block size specified by the blockSize argument. - * - * When this function returns, the actual configured block size is - * available in the blockSize member of the function struct. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * blockSize - Block size to use for the function. Valid range is 1 to - * 2048. - * - * RETURNS - * CSR_RESULT_SUCCESS - The block size register on the chip - * was updated. - * CSR_RESULT_FAILURE - Unspecified/unknown error. - * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. - * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. - * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. The configured block - * size is undefined. - * CSR_SDIO_RESULT_TIMEOUT - No response from the device. - * - * NOTE: If the SDIO R5 response is available, and the FUNCTION_NUMBER - * bits is set, CSR_SDIO_RESULT_INVALID_VALUE shall be returned. - * If the ERROR bit is set (but not FUNCTION_NUMBER), - * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and - * COM_CRC_ERROR bits shall be ignored. - * - * If the CSPI response is available, and any of the - * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE will be returned. - * - * NOTE: Setting the block size requires two individual operations. The - * implementation shall ignore the OUT_OF_RANGE bit of the SDIO R5 - * response for the first operation, as the partially configured - * block size may be out of range, even if the final block size - * (after the second operation) is in the valid range. - * - *----------------------------------------------------------------------------*/ -CsrResult CsrSdioBlockSizeSet(CsrSdioFunction *function, CsrUint16 blockSize); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioMaxBusClockFrequencySet - * - * DESCRIPTION - * Set the maximum clock frequency to use for the device associated with - * the specified function. The actual configured clock frequency for the - * device shall be the minimum of: - * 1) Maximum clock frequency supported by the device. - * 2) Maximum clock frequency supported by the host controller. - * 3) Maximum clock frequency specified for any function on the same - * device. - * - * If the clock frequency exceeds 25MHz, it is the responsibility of the - * SDIO driver to enable high speed mode on the device, using the standard - * defined procedure, before increasing the frequency beyond the limit. - * - * Note that the clock frequency configured affects all functions on the - * same device. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * maxFrequency - The maximum clock frequency for the function in Hertz. - * - * RETURNS - * CSR_RESULT_SUCCESS - The maximum clock frequency was succesfully - * set for the function. - * CSR_RESULT_FAILURE - Unspecified/unknown error. - * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. - * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. - * - * NOTE: If the SDIO R5 response is available, and the FUNCTION_NUMBER - * bits is set, CSR_SDIO_RESULT_INVALID_VALUE shall be returned. - * If the ERROR bit is set (but not FUNCTION_NUMBER), - * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and - * COM_CRC_ERROR bits shall be ignored. - * - * If the CSPI response is available, and any of the - * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE will be returned. - * - * - *----------------------------------------------------------------------------*/ -CsrResult CsrSdioMaxBusClockFrequencySet(CsrSdioFunction *function, CsrUint32 maxFrequency); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioRead8, CsrSdioWrite8, CsrSdioRead8Async, CsrSdioWrite8Async - * - * DESCRIPTION - * Read/write an 8bit value from/to the specified register address. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * address - Register address within the function. - * data - The data to read/write. - * callback - The function to call on operation completion. - * - * RETURNS - * CSR_RESULT_SUCCESS - The data was successfully read/written. - * CSR_RESULT_FAILURE - Unspecified/unknown error. - * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. - * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. - * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. No data read/written. - * CSR_SDIO_RESULT_TIMEOUT - No response from the device. - * - * NOTE: If the SDIO R5 response is available, and either of the - * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit - * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), - * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and - * COM_CRC_ERROR bits shall be ignored. - * - * If the CSPI response is available, and any of the - * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE will be returned. - * - * NOTE: The CsrSdioRead8Async and CsrSdioWrite8Async functions return - * immediately, and the supplied callback function is called when the - * operation is complete. The result value is given as an argument to - * the callback function. - * - *----------------------------------------------------------------------------*/ -CsrResult CsrSdioRead8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data); -CsrResult CsrSdioWrite8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data); -void CsrSdioRead8Async(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data, CsrSdioAsyncCallback callback); -void CsrSdioWrite8Async(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data, CsrSdioAsyncCallback callback); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioRead16, CsrSdioWrite16, CsrSdioRead16Async, CsrSdioWrite16Async - * - * DESCRIPTION - * Read/write a 16bit value from/to the specified register address. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * address - Register address within the function. - * data - The data to read/write. - * callback - The function to call on operation completion. - * - * RETURNS - * CSR_RESULT_SUCCESS - The data was successfully read/written. - * CSR_RESULT_FAILURE - Unspecified/unknown error. - * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. - * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. - * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. Data may have been - * partially read/written. - * CSR_SDIO_RESULT_TIMEOUT - No response from the device. - * - * NOTE: If the SDIO R5 response is available, and either of the - * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit - * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), - * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and - * COM_CRC_ERROR bits shall be ignored. - * - * If the CSPI response is available, and any of the - * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE will be returned. - * - * NOTE: The CsrSdioRead16Async and CsrSdioWrite16Async functions return - * immediately, and the supplied callback function is called when the - * operation is complete. The result value is given as an argument to - * the callback function. - * - *----------------------------------------------------------------------------*/ -CsrResult CsrSdioRead16(CsrSdioFunction *function, CsrUint32 address, CsrUint16 *data); -CsrResult CsrSdioWrite16(CsrSdioFunction *function, CsrUint32 address, CsrUint16 data); -void CsrSdioRead16Async(CsrSdioFunction *function, CsrUint32 address, CsrUint16 *data, CsrSdioAsyncCallback callback); -void CsrSdioWrite16Async(CsrSdioFunction *function, CsrUint32 address, CsrUint16 data, CsrSdioAsyncCallback callback); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioF0Read8, CsrSdioF0Write8, CsrSdioF0Read8Async, - * CsrSdioF0Write8Async - * - * DESCRIPTION - * Read/write an 8bit value from/to the specified register address in - * function 0. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * address - Register address within the function. - * data - The data to read/write. - * callback - The function to call on operation completion. - * - * RETURNS - * CSR_RESULT_SUCCESS - The data was successfully read/written. - * CSR_RESULT_FAILURE - Unspecified/unknown error. - * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. - * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. - * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. No data read/written. - * CSR_SDIO_RESULT_TIMEOUT - No response from the device. - * - * NOTE: If the SDIO R5 response is available, and either of the - * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit - * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), - * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and - * COM_CRC_ERROR bits shall be ignored. - * - * If the CSPI response is available, and any of the - * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE will be returned. - * - * NOTE: The CsrSdioF0Read8Async and CsrSdioF0Write8Async functions return - * immediately, and the supplied callback function is called when the - * operation is complete. The result value is given as an argument to - * the callback function. - * - *----------------------------------------------------------------------------*/ -CsrResult CsrSdioF0Read8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data); -CsrResult CsrSdioF0Write8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data); -void CsrSdioF0Read8Async(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data, CsrSdioAsyncCallback callback); -void CsrSdioF0Write8Async(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data, CsrSdioAsyncCallback callback); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioRead, CsrSdioWrite, CsrSdioReadAsync, CsrSdioWriteAsync - * - * DESCRIPTION - * Read/write a specified number of bytes from/to the specified register - * address. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * address - Register address within the function. - * data - The data to read/write. - * length - Number of byte to read/write. - * callback - The function to call on operation completion. - * - * RETURNS - * CSR_RESULT_SUCCESS - The data was successfully read/written. - * CSR_RESULT_FAILURE - Unspecified/unknown error. - * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. - * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. - * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. Data may have been - * partially read/written. - * CSR_SDIO_RESULT_TIMEOUT - No response from the device. - * - * NOTE: If the SDIO R5 response is available, and either of the - * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit - * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), - * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and - * COM_CRC_ERROR bits shall be ignored. - * - * If the CSPI response is available, and any of the - * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE will be returned. - * - * NOTE: The CsrSdioF0Read8Async and CsrSdioF0Write8Async functions return - * immediately, and the supplied callback function is called when the - * operation is complete. The result value is given as an argument to - * the callback function. - * - *----------------------------------------------------------------------------*/ -CsrResult CsrSdioRead(CsrSdioFunction *function, CsrUint32 address, void *data, CsrUint32 length); -CsrResult CsrSdioWrite(CsrSdioFunction *function, CsrUint32 address, const void *data, CsrUint32 length); -void CsrSdioReadAsync(CsrSdioFunction *function, CsrUint32 address, void *data, CsrUint32 length, CsrSdioAsyncCallback callback); -void CsrSdioWriteAsync(CsrSdioFunction *function, CsrUint32 address, const void *data, CsrUint32 length, CsrSdioAsyncCallback callback); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioPowerOn, CsrSdioPowerOff - * - * DESCRIPTION - * Power on/off the device. - * - * PARAMETERS - * function - Pointer to struct representing the function that resides on - * the device to power on/off. - * - * RETURNS (only CsrSdioPowerOn) - * CSR_RESULT_SUCCESS - Power was succesfully reapplied and the device - * has been reinitialised. - * CSR_RESULT_FAILURE - Unspecified/unknown error. - * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. - * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured during reinitialisation. - * CSR_SDIO_RESULT_TIMEOUT - No response from the device during - * reinitialisation. - * CSR_SDIO_RESULT_NOT_RESET - The power was not removed by the - * CsrSdioPowerOff call. The state of the - * device is unchanged. - * - *----------------------------------------------------------------------------*/ -CsrResult CsrSdioPowerOn(CsrSdioFunction *function); -void CsrSdioPowerOff(CsrSdioFunction *function); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioHardReset - * - * DESCRIPTION - * Perform a hardware reset of the device. - * - * PARAMETERS - * function - Pointer to struct representing the function that resides on - * the device to hard reset. - * - * RETURNS - * CSR_RESULT_SUCCESS - Reset was succesfully performed and the device - * has been reinitialised. - * CSR_RESULT_FAILURE - Unspecified/unknown error. - * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. - * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured during reinitialisation. - * CSR_SDIO_RESULT_TIMEOUT - No response from the device during - * reinitialisation. - * CSR_SDIO_RESULT_NOT_RESET - The reset was not applied because it is not - * supported. The state of the device is - * unchanged. - * - *----------------------------------------------------------------------------*/ -CsrResult CsrSdioHardReset(CsrSdioFunction *function); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioFunctionActive, CsrSdioFunctionIdle - * - * DESCRIPTION - * - * PARAMETERS - * function - Pointer to struct representing the function. - * - *----------------------------------------------------------------------------*/ -void CsrSdioFunctionActive(CsrSdioFunction *function); -void CsrSdioFunctionIdle(CsrSdioFunction *function); - -void CsrSdioCallbackInhibitEnter(CsrSdioFunction *function); -void CsrSdioCallbackInhibitLeave(CsrSdioFunction *function); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/drivers/staging/csr/sdioemb/csr_sdio_lib.h b/drivers/staging/csr/sdioemb/csr_sdio_lib.h deleted file mode 100644 index 15c70f6..0000000 --- a/drivers/staging/csr/sdioemb/csr_sdio_lib.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Synergy compatible API -- SDIO utility library. - * - * Copyright (C) 2010 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef CSR_SDIO_LIB_H__ -#define CSR_SDIO_LIB_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -CsrResult CsrSdioFunctionReenable(CsrSdioFunction *function); - -typedef int CsrStatus; /* platform specific */ -#define CSR_STATUS_FAILURE(status) ((status) < 0) /* platform specific */ - -CsrResult CsrSdioStatusToResult(CsrStatus status); -CsrStatus CsrSdioResultToStatus(CsrResult result); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* #ifndef CSR_SDIO_LIB_H__ */ diff --git a/drivers/staging/csr/sdioemb/csr_sdio_wdf.h b/drivers/staging/csr/sdioemb/csr_sdio_wdf.h deleted file mode 100644 index 6f0d71c..0000000 --- a/drivers/staging/csr/sdioemb/csr_sdio_wdf.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Synergy compatible API -- helpers for Windows Driver Framework drivers. - * - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef CSR_SDIO_WDF_H__ -#define CSR_SDIO_WDF_H__ - -#include - -NTSTATUS CsrSdioWdfDeviceInit(WDFDEVICE device); -void CsrSdioWdfDeviceCleanup(WDFDEVICE device); - -NTSTATUS CsrSdioWdfDeviceAdd(WDFDEVICE device); -void CsrSdioWdfDeviceDel(WDFDEVICE device); - -NTSTATUS CsrSdioWdfDeviceSuspend(WDFDEVICE device); -NTSTATUS CsrSdioWdfDeviceResume(WDFDEVICE device); - -#endif /* #ifndef CSR_SDIO_WDF_H__ */ diff --git a/drivers/staging/csr/sdioemb/csr_types.h b/drivers/staging/csr/sdioemb/csr_types.h deleted file mode 100644 index c0d95b3..0000000 --- a/drivers/staging/csr/sdioemb/csr_types.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Synergy compatible API -- basic types. - * - * Copyright (C) 2010 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef CSR_TYPES_H__ -#define CSR_TYPES_H__ - -#include - -#ifndef FALSE -#define FALSE false -#endif - -#ifndef TRUE -#define TRUE true -#endif - -/* Data types */ - -typedef size_t CsrSize; - -typedef uint8_t CsrUint8; -typedef uint16_t CsrUint16; -typedef uint32_t CsrUint32; - -typedef int8_t CsrInt8; -typedef int16_t CsrInt16; -typedef int32_t CsrInt32; - -typedef bool CsrBool; - -typedef char CsrCharString; -typedef unsigned char CsrUtf8String; -typedef CsrUint16 CsrUtf16String; /* 16-bit UTF16 strings */ -typedef CsrUint32 CsrUint24; - -/* - * 64-bit integers - * - * Note: If a given compiler does not support 64-bit types, it is - * OK to omit these definitions; 32-bit versions of the code using - * these types may be available. Consult the relevant documentation - * or the customer support group for information on this. - */ -#define CSR_HAVE_64_BIT_INTEGERS -typedef uint64_t CsrUint64; -typedef int64_t CsrInt64; - -#endif diff --git a/drivers/staging/csr/sdioemb/libsdio.h b/drivers/staging/csr/sdioemb/libsdio.h deleted file mode 100644 index 29ac411..0000000 --- a/drivers/staging/csr/sdioemb/libsdio.h +++ /dev/null @@ -1,404 +0,0 @@ -/* - * SDIO Userspace Interface library. - * - * Copyright (C) 2007 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef SDIOEMB_LIBSDIO_H -#define SDIOEMB_LIBSDIO_H - -/** - * \defgroup libsdio Userspace SDIO library (libsdio) - * - * \brief \e libsdio is a Linux C library for accessing SDIO cards. - * - * Use of this library requires several \e sdioemb kernel modules to be - * loaded: - * - \c sdio. - * - \c An SDIO slot driver (e.g., \c slot_shc for a standard PCI - * SDIO Host Controller). - * - \c sdio_uif which provides the required character devices - * (/dev/sdio_uif0 for the card in SDIO slot 0 etc.). - */ -/*@{*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef WIN32 -# define LIBSDIOAPI __stdcall -#else -# define LIBSDIOAPI -#endif - -struct sdio_uif; - -/** - * Handle to an opened SDIO Userspace Interface device. - */ -typedef struct sdio_uif *sdio_uif_t; - -enum sdio_status { - SDIO_SUCCESS = 0, - SDIO_EAGAIN = -1, - SDIO_EINVAL = -2, - SDIO_EIO = -3, - SDIO_ENODEV = -4, - SDIO_ENOMEM = -5, - SDIO_ENOTSUPP = -6, - SDIO_ENXIO = -7, - SDIO_ETIMEDOUT = -8, -}; - -/** - * Card interrupt handler function. - * - * @param uif handle to the interrupting device. - * @param arg data supplied by the caller of sdio_open(). - */ -typedef void (LIBSDIOAPI *sdio_int_handler_t)(sdio_uif_t uif, void *arg); - -/** - * Asynchronous IO completion callback function. - * - * @param uif handle to the device that completed the IO operation. - * @param arg data supplied by the caller of the asynchronous IO operation. - * @param status status of the IO operation. 0 is success; -EIO, - * -EINVAL, -ETIMEDOUT etc. on an error. - */ -typedef void (LIBSDIOAPI *sdio_io_callback_t)(sdio_uif_t uif, void *arg, int status); - -/** - * Open a SDIO Userspace Interface device and (optionally) register a - * card interrupt handler and enable card interrupts. - * - * Card interrupts are masked before calling int_handler and are - * unmasked when int_handler returns (unless sdio_interrupt_mask() is - * called). - * - * @param dev_filename filename of the device to open. - * @param int_handler card interrupt handler; or NULL if no - * interrupt handler is required. - * @param arg argument to be passed to the interrupt handler. - * - * @return handle to the opened device; or NULL on error with errno - * set. - */ -sdio_uif_t LIBSDIOAPI sdio_open(const char *dev_filename, - sdio_int_handler_t int_handler, void *arg); - -/** - * Mask the SDIO interrupt. - * - * Call this in an interrupt handler to allow the processing of - * interrupts to be deferred until after the interrupt handler has - * returned. - * - * @note \e Must only be called from within the interrupt handler - * registered with sdio_open(). - * - * @param uif device handle. - */ -void LIBSDIOAPI sdio_interrupt_mask(sdio_uif_t uif); - -/** - * Unmask the SDIO interrupt. - * - * Unmasks the SDIO interrupt if it had previously been masked with - * sdio_interrupt_mask(). - * - * @param uif device handle. - */ -void LIBSDIOAPI sdio_interrupt_unmask(sdio_uif_t uif); - -/** - * Close an opened SDIO Userspace Interface device, freeing all - * associated resources. - * - * @param uif handle to the device. - */ -void LIBSDIOAPI sdio_close(sdio_uif_t uif); - -/** - * Return the number of functions the card has. - * - * @param uif device handle. - * - * @return number of card functions. - */ -int LIBSDIOAPI sdio_num_functions(sdio_uif_t uif); - -/** - * Set an SDIO bus to 1 bit or 4 bit wide mode. - * - * The CCCR bus interface control register will be read and rewritten - * with the new bus width. - * - * @param uif device handle. - * @param bus_width bus width (1 or 4). - * - * @return 0 on success; -ve on error with errno set. - * - * @note The card capabilities are \e not checked. The user should - * ensure 4 bit mode is not enabled on a card that does not support - * it. - */ -int LIBSDIOAPI sdio_set_bus_width(sdio_uif_t uif, int bus_width); - -/** - * Limit the frequency of (or stop) the SD bus clock. - * - * The frequency cannot be set greater than that supported by the card - * or the controller. - * - * @note Stopping the bus clock while other device drivers are - * executing commands may result in those commands not completing - * until the bus clock is restarted. - * - * @param uif device handle. - * @param max_freq maximum frequency (Hz) or 0 to stop the bus clock - * until the start of the next command. - */ -void LIBSDIOAPI sdio_set_max_bus_freq(sdio_uif_t uif, int max_freq); - -/** - * Return the card's manufacturer (vendor) ID. - * - * @param uif device handle. - * - * @return manufacturer ID. - */ -uint16_t LIBSDIOAPI sdio_manf_id(sdio_uif_t uif); - -/** - * Return the card's card (device) ID. - * - * @param uif device handle. - * - * @return card ID. - */ -uint16_t LIBSDIOAPI sdio_card_id(sdio_uif_t uif); - -/** - * Return the standard interface code for a function. - * - * @param uif device handle. - * @param func card function to query. - * - * @return the standard interface. - */ -uint8_t LIBSDIOAPI sdio_std_if(sdio_uif_t uif, int func); - -/** - * Return a function's maximum supported block size. - * - * @param uif device handle. - * @param func card function to query. - * - * @return maximum block size. - */ -int LIBSDIOAPI sdio_max_block_size(sdio_uif_t uif, int func); - -/** - * Return a function's current block size. - * - * @note This returns the driver's view of the block size and not the - * value in the function's block size register. - * - * @param uif device handle. - * @param func card function to query. - * - * @return the current block size. - */ -int LIBSDIOAPI sdio_block_size(sdio_uif_t uif, int func); - -/** - * Set a function's block size. - * - * The function's block size registers will be written if necessary. - * - * @param uif device handle. - * @param func function to modify. - * @param blksz the new block size; or 0 for the default size. - * - * @return 0 on success; or -ve on error with errno set. - */ -int LIBSDIOAPI sdio_set_block_size(sdio_uif_t uif, int func, int blksz); - -/** - * Read an 8 bit register. - * - * @param uif device handle. - * @param func card function. - * @param addr register address. - * @param data the data read. - * - * @return 0 on success; or -ve on error with errno set. - */ -int LIBSDIOAPI sdio_read8(sdio_uif_t uif, int func, uint32_t addr, uint8_t *data); - -/** - * Write an 8 bit register. - * - * @param uif device handle. - * @param func card function. - * @param addr register address. - * @param data the data to write. - * - * @return 0 on success; or -ve on error with errno set. - */ -int LIBSDIOAPI sdio_write8(sdio_uif_t uif, int func, uint32_t addr, uint8_t data); - -/** - * Read a buffer from a 8 bit wide register/FIFO. - * - * The buffer read uses a fixed (not incrementing) address. - * - * \a block_size \e must be set to the value writted into \a func's - * I/O block size FBR register. - * - * If \a len % \a block_size == 0, a block mode transfer is used; a - * byte mode transfer is used if \a len < \a block_size. - * - * @param uif device handle. - * @param func card function. - * @param addr register/FIFO address. - * @param data buffer to store the data read. - * @param len length of data to read. - * @param block_size block size to use for this transfer. - * - * @return 0 on success; or -ve on error with errno set. - */ -int LIBSDIOAPI sdio_read(sdio_uif_t uif, int func, uint32_t addr, uint8_t *data, - size_t len, int block_size); - -/** - * Write a buffer to an 8 bit wide register/FIFO. - * - * The buffer write uses a fixed (not incrementing) address. - * - * \a block_size \e must be set to the value writted into \a func's - * I/O block size FBR register. - * - * If \a len % \a block_size == 0, a block mode transfer is used; a - * byte mode transfer is used if \a len < \a block_size. - * - * @param uif device handle. - * @param func card function. - * @param addr register/FIFO address. - * @param data buffer of data to write. - * @param len length of the data to write. - * @param block_size block size to use for this transfer. - * - * @return 0 on success; or -ve on error with errno set. - */ -int LIBSDIOAPI sdio_write(sdio_uif_t uif, int func, uint32_t addr, const uint8_t *data, - size_t len, int block_size); - -/** - * Read an 8 bit register, without waiting for completion. - * - * @param uif device handle. - * @param func card function. - * @param addr register address. - * @param data the data read. - * @param callback function to be called when the read completes. - * @param arg argument to be passed to callback. - * - * @return 0 on success; or -ve on error with errno set. - */ -int LIBSDIOAPI sdio_read8_async(sdio_uif_t uif, int func, uint32_t addr, uint8_t *data, - sdio_io_callback_t callback, void *arg); - -/** - * Write an 8 bit register, without waiting for completion. - * - * @param uif device handle. - * @param func card function. - * @param addr register address. - * @param data the data to write. - * @param callback function to be called when the write completes. - * @param arg argument to be passed to callback. - * - * @return 0 on success; or -ve on error with errno set. - */ -int LIBSDIOAPI sdio_write8_async(sdio_uif_t uif, int func, uint32_t addr, uint8_t data, - sdio_io_callback_t callback, void *arg); - -/** - * Read a buffer from a 8 bit wide register/FIFO, without waiting for - * completion. - * - * The buffer read uses a fixed (not incrementing) address. - * - * \a block_size \e must be set to the value writted into \a func's - * I/O block size FBR register. - * - * If \a len % \a block_size == 0, a block mode transfer is used; a - * byte mode transfer is used if \a len < \a block_size. - * - * @param uif device handle. - * @param func card function. - * @param addr register/FIFO address. - * @param data buffer to store the data read. - * @param len length of data to read. - * @param block_size block size to use for this transfer. - * @param callback function to be called when the read completes. - * @param arg argument to be passed to callback. - * - * @return 0 on success; or -ve on error with errno set. - */ -int LIBSDIOAPI sdio_read_async(sdio_uif_t uif, int func, uint32_t addr, uint8_t *data, - size_t len, int block_size, - sdio_io_callback_t callback, void *arg); - -/** - * Write a buffer to an 8 bit wide register/FIFO, without waiting for - * completion. - * - * The buffer write uses a fixed (not incrementing) address. - * - * \a block_size \e must be set to the value writted into \a func's - * I/O block size FBR register. - * - * If \a len % \a block_size == 0, a block mode transfer is used; a - * byte mode transfer is used if \a len < \a block_size. - * - * @param uif device handle. - * @param func card function. - * @param addr register/FIFO address. - * @param data buffer of data to write. - * @param len length of the data to write. - * @param block_size block size to use for this transfer. - * @param callback function to be called when the write completes. - * @param arg argument to be passed to callback. - * - * @return 0 on success; or -ve on error with errno set. - */ -int LIBSDIOAPI sdio_write_async(sdio_uif_t uif, int func, uint32_t addr, const uint8_t *data, - size_t len, int block_size, - sdio_io_callback_t callback, void *arg); -/** - * Force a card removal and reinsertion. - * - * This will power cycle the card if the slot hardware supports power - * control. - * - * @note The device handle will no longer be valid. - * - * @param uif device handle. - * - * @return 0 on success; or -ve on error with errno set. - */ -int LIBSDIOAPI sdio_reinsert_card(sdio_uif_t uif); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -/*@}*/ - -#endif /* #ifndef SDIOEMB_LIBSDIO_H */ diff --git a/drivers/staging/csr/sdioemb/linux.h b/drivers/staging/csr/sdioemb/linux.h deleted file mode 100644 index f574f71..0000000 --- a/drivers/staging/csr/sdioemb/linux.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Linux helpers for slot drivers. - * - * Copyright (C) 2009 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef SDIOEMB_LINUX_H -#define SDIOEMB_LINUX_H - -#include - -int sdioemb_linux_slot_register(struct sdioemb_slot *slot); - -#endif /* #ifndef SDIOEMB_LINUX_H */ diff --git a/drivers/staging/csr/sdioemb/sdio.h b/drivers/staging/csr/sdioemb/sdio.h deleted file mode 100644 index 50bb8fd..0000000 --- a/drivers/staging/csr/sdioemb/sdio.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Standard SDIO definitions. - * - * Copyright (C) 2007 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef SDIOEMB_SDIO_H -#define SDIOEMB_SDIO_H - -/* Maximum time for VDD to rise to VDD min. */ -#define SDIO_POWER_UP_TIME_MS 250 - -/* Minimum SD bus clock a card must support (Hz). */ -#define SDIO_CLOCK_FREQ_MIN 400000 - -/* Maximum clock frequency for normal mode (Hz). - * - * Although high speed mode should be suitable for all speeds not all - * controller/card combinations are capable of meeting the higher - * tolerances for (e.g.) clock rise/fall times. Therefore, default - * mode is used where possible for improved compatibility. */ -#define SDIO_CLOCK_FREQ_NORMAL_SPD 25000000 - -/* Maximum clock frequency for high speed mode (Hz). */ -#define SDIO_CLOCK_FREQ_HIGH_SPD 50000000 - -#define SDIO_MAX_FUNCTIONS 8 /* incl. F0 */ - -/* Command argument format. */ - -#define SDIO_CMD52_ARG_WRITE 0x80000000 -#define SDIO_CMD52_ARG_FUNC(f) ((f) << 28) -#define SDIO_CMD52_ARG_ADDR(a) ((a) << 9) -#define SDIO_CMD52_ARG_DATA(d) ((d) << 0) - -#define SDIO_CMD53_ARG_WRITE 0x80000000 -#define SDIO_CMD53_ARG_FUNC(f) ((f) << 28) -#define SDIO_CMD53_ARG_BLK_MODE 0x08000000 -#define SDIO_CMD53_ARG_ADDR(a) ((a) << 9) -#define SDIO_CMD53_ARG_CNT(c) ((c) << 0) - -/* Response format. */ - -#define SDIO_R5_DATA(r) (((r) >> 0) & 0xff) -#define SDIO_R5_OUT_OF_RANGE (1 << 8) -#define SDIO_R5_FUNCTION_NUMBER (1 << 9) -#define SDIO_R5_ERROR (1 << 11) - -/* Register offsets and bits. */ - -#define SDIO_OCR_CARD_READY 0x80000000 -#define SDIO_OCR_NUM_FUNCS_MASK 0x70000000 -#define SDIO_OCR_NUM_FUNCS_OFFSET 28 -#define SDIO_OCR_VOLTAGE_3V3 0x00300000 /* 3.2-3.3V & 3.3-3.4V */ - -#define SDIO_CCCR_SDIO_REV 0x00 -#define SDIO_CCCR_SD_REV 0x01 -#define SDIO_CCCR_IO_EN 0x02 -#define SDIO_CCCR_IO_READY 0x03 -#define SDIO_CCCR_INT_EN 0x04 -# define SDIO_CCCR_INT_EN_MIE 0x01 -#define SDIO_CCCR_INT_PENDING 0x05 -#define SDIO_CCCR_IO_ABORT 0x06 -#define SDIO_CCCR_BUS_IFACE_CNTL 0x07 -# define SDIO_CCCR_BUS_IFACE_CNTL_CD_R_DISABLE 0x80 -# define SDIO_CCCR_BUS_IFACE_CNTL_ECSI 0x20 -# define SDIO_CCCR_BUS_IFACE_CNTL_4BIT_BUS 0x02 -#define SDIO_CCCR_CARD_CAPS 0x08 -# define SDIO_CCCR_CARD_CAPS_LSC 0x40 -# define SDIO_CCCR_CARD_CAPS_4BLS 0x80 -#define SDIO_CCCR_CIS_PTR 0x09 -#define SDIO_CCCR_BUS_SUSPEND 0x0c -#define SDIO_CCCR_FUNC_SEL 0x0d -#define SDIO_CCCR_EXEC_FLAGS 0x0e -#define SDIO_CCCR_READY_FLAGS 0x0f -#define SDIO_CCCR_F0_BLK_SIZE 0x10 -#define SDIO_CCCR_PWR_CNTL 0x12 -#define SDIO_CCCR_HIGH_SPEED 0x13 -# define SDIO_CCCR_HIGH_SPEED_SHS 0x01 -# define SDIO_CCCR_HIGH_SPEED_EHS 0x02 - -#define SDIO_FBR_REG(f, r) (0x100*(f) + (r)) - -#define SDIO_FBR_STD_IFACE(f) SDIO_FBR_REG(f, 0x00) -#define SDIO_FBR_STD_IFACE_EXT(f) SDIO_FBR_REG(f, 0x01) -#define SDIO_FBR_CIS_PTR(f) SDIO_FBR_REG(f, 0x09) -#define SDIO_FBR_CSA_PTR(f) SDIO_FBR_REG(f, 0x0c) -#define SDIO_FBR_CSA_DATA(f) SDIO_FBR_REG(f, 0x0f) -#define SDIO_FBR_BLK_SIZE(f) SDIO_FBR_REG(f, 0x10) - -#define SDIO_STD_IFACE_UART 0x01 -#define SDIO_STD_IFACE_BT_TYPE_A 0x02 -#define SDIO_STD_IFACE_BT_TYPE_B 0x03 -#define SDIO_STD_IFACE_GPS 0x04 -#define SDIO_STD_IFACE_CAMERA 0x05 -#define SDIO_STD_IFACE_PHS 0x06 -#define SDIO_STD_IFACE_WLAN 0x07 -#define SDIO_STD_IFACE_BT_TYPE_A_AMP 0x09 - -/* - * Manufacturer and card IDs. - */ -#define SDIO_MANF_ID_CSR 0x032a - -#define SDIO_CARD_ID_CSR_UNIFI_1 0x0001 -#define SDIO_CARD_ID_CSR_UNIFI_2 0x0002 -#define SDIO_CARD_ID_CSR_BC6 0x0004 -#define SDIO_CARD_ID_CSR_DASH_D00 0x0005 -#define SDIO_CARD_ID_CSR_BC7 0x0006 -#define SDIO_CARD_ID_CSR_CINDERELLA 0x0007 -#define SDIO_CARD_ID_CSR_UNIFI_3 0x0007 -#define SDIO_CARD_ID_CSR_UNIFI_4 0x0008 -#define SDIO_CARD_ID_CSR_DASH 0x0010 - -#endif /* #ifndef SDIOEMB_SDIO_H */ diff --git a/drivers/staging/csr/sdioemb/sdio_api.h b/drivers/staging/csr/sdioemb/sdio_api.h deleted file mode 100644 index cd8aded..0000000 --- a/drivers/staging/csr/sdioemb/sdio_api.h +++ /dev/null @@ -1,408 +0,0 @@ -/* - * SDIO device driver API. - * - * Copyright (C) 2007-2008 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef _SDIO_API_H -#define _SDIO_API_H - -/** - * @defgroup fdriver SDIO function driver API - * - * @brief The SDIO function driver API is used to implement drivers - * for SDIO card functions. - * - * Function drivers register with the SDIO driver core - * (sdio_register_driver()), listing which functions it supports and - * providing callback functions for card inserts, removes and - * interrupts. - * - * @par \anchor card_io_ops Card I/O operations: - * - * - \link sdioemb_read8(struct sdioemb_dev *, uint32_t, uint8_t *) sdioemb_read8()\endlink - * - \link sdioemb_read16(struct sdioemb_dev *, uint32_t, uint16_t *) sdioemb_read16()\endlink - * - \link sdioemb_write8(struct sdioemb_dev *, uint32_t, uint8_t) sdioemb_write8()\endlink - * - \link sdioemb_write16(struct sdioemb_dev *, uint32_t, uint16_t) sdioemb_write16()\endlink - * - \link sdioemb_f0_read8(struct sdioemb_dev *, uint32_t, uint8_t *) sdioemb_f0_read8()\endlink - * - \link sdioemb_f0_write8(struct sdioemb_dev *, uint32_t, uint8_t) sdioemb_f0_write8()\endlink - * - \link sdioemb_read(struct sdioemb_dev *, uint32_t, void *, size_t) sdioemb_read()\endlink - * - \link sdioemb_write(struct sdioemb_dev *, uint32_t, const void *, size_t) sdioemb_write()\endlink - */ - -struct sdioemb_func_driver; -struct sdioemb_dev; -struct sdioemb_dev_priv; - -/** - * An SDIO device. - * - * Each SDIO card will have an sdio_dev for each function. - * - * None of the fields (except for drv_data) should be written. - * - * @ingroup fdriver - */ -struct sdioemb_dev { - struct sdioemb_func_driver *driver; /**< Function driver for this device. */ - uint16_t vendor_id; /**< Vendor ID of the card. */ - uint16_t device_id; /**< Device ID of the card. */ - int function; /**< Function number of this device. */ - uint8_t interface; /**< SDIO standard interface number. */ - uint16_t max_blocksize; /**< Maximum block size supported. */ - uint16_t blocksize; /**< Blocksize in use. */ - int slot_id; /**< ID of the slot this card is inserted into. */ - void * os_device; /**< Pointer to an OS-specific device structure. */ - struct sdioemb_dev_priv *priv; /**< Data private to the SDIO core. */ - void * drv_data; /**< Data private to the function driver. */ -}; - -#define SDIOEMB_ANY_ID 0xffff -#define SDIOEMB_UIF_FUNC 0 -#define SDIOEMB_ANY_FUNC 0xff -#define SDIOEMB_ANY_IFACE 0xff - -/** - * An entry for an SDIO device ID table. - * - * Functions are matched to drivers using any combination of vendor - * ID, device ID, function number or standard interface. - * - * Matching on #function == SDIOEMB_UIF_FUNC is reserved for the SDIO - * Userspace Interface driver. Card management drivers can match on - * #function == 0, these will be probed before any function drivers. - * - * @ingroup fdriver - */ -struct sdioemb_id_table { - uint16_t vendor_id; /**< Vendor ID to match or SDIOEMB_ANY_ID */ - uint16_t device_id; /**< Device ID to match or SDIOEMB_ANY_ID */ - int function; /**< Function number to match or SDIOEMB_ANY_FUNC */ - uint8_t interface; /**< SDIO standard interface to match or SDIOEMB_ANY_IFACE */ -}; - -/** - * A driver for an SDIO function. - * - * @ingroup fdriver - */ -struct sdioemb_func_driver { - /** - * Driver name used in diagnostics. - */ - const char *name; - - /** - * 0 terminated array of functions supported by this device. - * - * The driver may (for example) match on a number of vendor - * ID/device ID/function number triplets or on an SDIO standard - * interface. - */ - struct sdioemb_id_table *id_table; - - /** - * Called by the core when an inserted card has functions which - * match those listed in id_table. - * - * The driver's implementation should (if required): - * - * - perform any additional probing - * - do function specific initialization - * - allocate and register any function/OS specific devices or interfaces. - * - * Called in: thread context. - * - * @param fdev the newly inserted device. - * - * @return 0 on success; -ve on error. - */ - int (*probe)(struct sdioemb_dev *fdev); - - /** - * Called by the core when a card is removed. This is only called - * if the probe() call succeeded. - * - * The driver's implementation should (if required); - * - * - do any function specific shutdown. - * - cleanup any data structures created/registers during probe(). - * - * Called in: thread context. - * - * @param fdev the device being removed. - */ - void (*remove)(struct sdioemb_dev *fdev); - - /** - * Called by the core to signal an SDIO interrupt for this card - * occurs, if interrupts have been enabled with - * sdioemb_interrupt_enable(). - * - * The driver's implementation should signal a thread (or similar) - * to actually handle the interrupt as no card I/O may be - * performed whilst in interrupt context. When the interrupt is - * handled, the driver should call sdioemb_interrupt_acknowledge() to - * enable further interrupts to be signalled. - * - * Called in: interrupt context. - * - * @param fdev the device which may have raised the interrupt. - */ - void (*card_int_handler)(struct sdioemb_dev *fdev); - - /** - * Called by the core to signal a suspend power management - * event occured. - * - * The driver's implementation should (if required) - * set the card to a low power mode and return as soon - * as possible. After this function returns, the - * driver should not start any SDIO commands. - * - * Called in: thread context. - * - * @param fdev the device handler. - */ - void (*suspend)(struct sdioemb_dev *fdev); - - /** - * Called by the core to signal a resume power management - * event occured. - * - * The driver's implementation should (if required) - * initialise the card to an operational mode and return - * as soon as possible. If the card has been powered off - * during suspend, the driver would have to initialise - * the card from scratch (f/w download, h/w initialisation, etc.). - * - * Called in: thread context. - * - * @param fdev the device handler. - */ - void (*resume)(struct sdioemb_dev *fdev); -}; - -int sdioemb_driver_register(struct sdioemb_func_driver *fdriver); -void sdioemb_driver_unregister(struct sdioemb_func_driver *fdriver); - -int sdioemb_driver_probe(struct sdioemb_func_driver *fdriver, struct sdioemb_dev *fdev); -void sdioemb_driver_remove(struct sdioemb_func_driver *fdriver, struct sdioemb_dev *fdev); - -/* For backward compatibility. */ -#define sdio_register_driver sdioemb_driver_register -#define sdio_unregister_driver sdioemb_driver_unregister - -int sdioemb_set_block_size(struct sdioemb_dev *fdev, uint16_t blksz); -void sdioemb_set_max_bus_freq(struct sdioemb_dev *fdev, int max_freq); -int sdioemb_set_bus_width(struct sdioemb_dev *fdev, int bus_width); - -int sdioemb_enable_function(struct sdioemb_dev *fdev); -int sdioemb_disable_function(struct sdioemb_dev *fdev); -int sdioemb_reenable_csr_function(struct sdioemb_dev *dev); -void sdioemb_idle_function(struct sdioemb_dev *fdev); - -int sdioemb_read8(struct sdioemb_dev *fdev, uint32_t addr, uint8_t *val); -int sdioemb_read16(struct sdioemb_dev *fdev, uint32_t addr, uint16_t *val); -int sdioemb_write8(struct sdioemb_dev *fdev, uint32_t addr, uint8_t val); -int sdioemb_write16(struct sdioemb_dev *fdev, uint32_t addr, uint16_t val); -int sdioemb_f0_read8(struct sdioemb_dev *fdev, uint32_t addr, uint8_t *val); -int sdioemb_f0_write8(struct sdioemb_dev *fdev, uint32_t addr, uint8_t val); -int sdioemb_read(struct sdioemb_dev *fdev, uint32_t addr, void *data, size_t len); -int sdioemb_write(struct sdioemb_dev *fdev, uint32_t addr, const void *data, size_t len); - -int sdioemb_hard_reset(struct sdioemb_dev *fdev); - -void sdioemb_power_on(struct sdioemb_dev *fdev); -void sdioemb_power_off(struct sdioemb_dev *fdev); - -int sdioemb_interrupt_enable(struct sdioemb_dev *fdev); -int sdioemb_interrupt_disable(struct sdioemb_dev *fdev); -void sdioemb_interrupt_acknowledge(struct sdioemb_dev *fdev); - -int sdioemb_cis_get_tuple(struct sdioemb_dev *fdev, uint8_t tuple, - void *buf, size_t len); - -void sdioemb_suspend_function(struct sdioemb_dev *fdev); -void sdioemb_resume_function(struct sdioemb_dev *fdev); - -/** - * SDIO command status. - * - * @ingroup fdriver - */ -enum sdioemb_cmd_status { - SDIOEMB_CMD_OK = 0x00, /**< Command successful. */ - - SDIOEMB_CMD_ERR_CMD = 0x01, - SDIOEMB_CMD_ERR_DAT = 0x02, - - SDIOEMB_CMD_ERR_CRC = 0x10, - SDIOEMB_CMD_ERR_TIMEOUT = 0x20, - SDIOEMB_CMD_ERR_OTHER = 0x40, - - SDIOEMB_CMD_ERR_CMD_CRC = SDIOEMB_CMD_ERR_CMD | SDIOEMB_CMD_ERR_CRC, /**< Response CRC error. */ - SDIOEMB_CMD_ERR_CMD_TIMEOUT = SDIOEMB_CMD_ERR_CMD | SDIOEMB_CMD_ERR_TIMEOUT, /**< Response time out. */ - SDIOEMB_CMD_ERR_CMD_OTHER = SDIOEMB_CMD_ERR_CMD | SDIOEMB_CMD_ERR_OTHER, /**< Other response error. */ - SDIOEMB_CMD_ERR_DAT_CRC = SDIOEMB_CMD_ERR_DAT | SDIOEMB_CMD_ERR_CRC, /**< Data CRC error. */ - SDIOEMB_CMD_ERR_DAT_TIMEOUT = SDIOEMB_CMD_ERR_DAT | SDIOEMB_CMD_ERR_TIMEOUT, /**< Data receive time out. */ - SDIOEMB_CMD_ERR_DAT_OTHER = SDIOEMB_CMD_ERR_DAT | SDIOEMB_CMD_ERR_OTHER, /**< Other data error. */ - - SDIOEMB_CMD_ERR_NO_CARD = 0x04, /**< No card present. */ - - SDIOEMB_CMD_IN_PROGRESS = 0xff, /**< Command still in progress. */ -}; - -/** - * A response to an SDIO command. - * - * For R1, R4, R5, and R6 responses only the middle 32 bits of the - * response are stored, the leading octet (start and direction bits - * and command index) and trailing octet (CRC and stop bit) are - * discarded. - * - * @bug R2 and R3 responses are not used by SDIO and are not - * supported. - * - * @ingroup fdriver - */ -union sdioemb_response { - uint32_t r1; - uint32_t r4; - uint32_t r5; - uint32_t r6; -}; - -/** - * SDIO command parameters and response. - */ -struct sdioemb_cmd_resp { - uint8_t cmd; /**< Command index (0 to 63). */ - uint32_t arg; /**< Command argument. */ - union sdioemb_response response; /**< Response to the command. Valid - iff the command has completed and - (sdio_cmd::status & SDIOEMB_CMD_ERR_CMD) == 0.*/ -}; - -/** - * CSPI command parameters and response. - */ -struct cspi_cmd_resp { - unsigned cmd : 8; /**< Command octet (type, and function). */ - unsigned addr: 24; /**< 24 bit address. */ - uint16_t val; /**< Word to write or read from the card (for non-burst commands). */ - uint8_t response; /**< Response octet. Valid iff the command has completed and - (sdio_cmd::status & SDIOEMB_CMD_ERR_CMD) == 0. */ -}; - - -/** - * An SDIO command, its status and response. - * - * sdio_cmd is used to submit SDIO commands to a device and return its - * status and any response or data. - * - * @ingroup fdriver - */ -struct sdioemb_cmd { - /** - * The SDIO device which submitted the command. Set by the - * core. - */ - struct sdioemb_dev *owner; - - /** - * Called by the core when the command has been completed. - * - * Called in: interrupt context. - * - * @param cmd the completed command. - */ - void (*callback)(struct sdioemb_cmd *cmd); - - /** - * Set of flags specifying the response type, data transfer - * direction and other parameters. - * - * For SDIO commands set at least one of the response types: - * - #SDIOEMB_CMD_FLAG_RESP_NONE - * - #SDIOEMB_CMD_FLAG_RESP_R1 - * - #SDIOEMB_CMD_FLAG_RESP_R1B - * - #SDIOEMB_CMD_FLAG_RESP_R2 - * - #SDIOEMB_CMD_FLAG_RESP_R3 - * - #SDIOEMB_CMD_FLAG_RESP_R4 - * - #SDIOEMB_CMD_FLAG_RESP_R5 - * - #SDIOEMB_CMD_FLAG_RESP_R5B - * - #SDIOEMB_CMD_FLAG_RESP_R6 - * - * and any of the additional flags: - * - #SDIOEMB_CMD_FLAG_READ - * - * For CSPI commands set: - * - #SDIOEMB_CMD_FLAG_CSPI - */ - unsigned flags; - - /** - * SDIO command parameters and response. - * - * Valid only if #SDIOEMB_CMD_FLAG_CSPI is \e not set in #flags. - */ - struct sdioemb_cmd_resp sdio; - - /** - * CSPI command parameters and response. - * - * Valid only if #SDIOEMB_CMD_FLAG_CSPI is set in #flags. - */ - struct cspi_cmd_resp cspi; - - /** - * Buffer of data to read or write. - * - * Must be set to NULL if the command is not a data transfer. - */ - uint8_t *data; - - /** - * Length of #data in octets. - * - * len must be either: less than the device's sdio_dev::blocksize; - * or a multiple of the device's sdio_dev::blocksize. - */ - size_t len; - - /** - * Status of the command after it has completed. - */ - enum sdioemb_cmd_status status; - - /** - * Data private to caller of sdioemb_start_cmd(). - */ - void *priv; -}; - -/** @addtogroup fdriver - *@{*/ -#define SDIOEMB_CMD_FLAG_RESP_NONE 0x00 /**< No response. */ -#define SDIOEMB_CMD_FLAG_RESP_R1 0x01 /**< R1 response. */ -#define SDIOEMB_CMD_FLAG_RESP_R1B 0x02 /**< R1b response. */ -#define SDIOEMB_CMD_FLAG_RESP_R2 0x03 /**< R2 response. */ -#define SDIOEMB_CMD_FLAG_RESP_R3 0x04 /**< R3 response. */ -#define SDIOEMB_CMD_FLAG_RESP_R4 0x05 /**< R4 response. */ -#define SDIOEMB_CMD_FLAG_RESP_R5 0x06 /**< R5 response. */ -#define SDIOEMB_CMD_FLAG_RESP_R5B 0x07 /**< R5b response. */ -#define SDIOEMB_CMD_FLAG_RESP_R6 0x08 /**< R6 response. */ -#define SDIOEMB_CMD_FLAG_RESP_MASK 0xff /**< Mask for response type. */ -#define SDIOEMB_CMD_FLAG_RAW 0x0100 /**< @internal Bypass the command queues. */ -#define SDIOEMB_CMD_FLAG_READ 0x0200 /**< Data transfer is a read, not a write. */ -#define SDIOEMB_CMD_FLAG_CSPI 0x0400 /**< CSPI transfer, not SDIO or SDIO-SPI. */ -#define SDIOEMB_CMD_FLAG_ABORT 0x0800 /**< Data transfer abort command. */ -/*@}*/ - -int sdioemb_start_cmd(struct sdioemb_dev *fdev, struct sdioemb_cmd *cmd); - -#endif /* #ifndef _SDIO_API_H */ diff --git a/drivers/staging/csr/sdioemb/sdio_bt_a.h b/drivers/staging/csr/sdioemb/sdio_bt_a.h deleted file mode 100644 index 9efe4a3..0000000 --- a/drivers/staging/csr/sdioemb/sdio_bt_a.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * SDIO Bluetooth Type-A interface definitions. - * - * Copyright (C) 2007 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef SDIOEMB_SDIO_BT_A_H -#define SDIOEMB_SDIO_BT_A_H - -#include -#include - -/* - * Standard SDIO function registers for a Bluetooth Type-A interface. - */ -#define SDIO_BT_A_RD 0x00 -#define SDIO_BT_A_TD 0x00 - -#define SDIO_BT_A_RX_PKT_CTRL 0x10 -# define PC_RRT 0x01 - -#define SDIO_BT_A_TX_PKT_CTRL 0x11 -# define PC_WRT 0x01 - -#define SDIO_BT_A_RETRY_CTRL 0x12 -# define RTC_STAT 0x01 -# define RTC_SET 0x01 - -#define SDIO_BT_A_INTRD 0x13 -# define INTRD 0x01 -# define CL_INTRD 0x01 - -#define SDIO_BT_A_INT_EN 0x14 -# define EN_INTRD 0x01 - -#define SDIO_BT_A_BT_MODE 0x20 -# define MD_STAT 0x01 - -/* - * Length of the Type-A header. - * - * Packet length (3 octets) plus Service ID (1 octet). - */ -#define SDIO_BT_A_HEADER_LEN 4 - -/* - * Maximum length of a Type-A transport packet. - * - * Type-A header length and maximum length of a HCI packet (65535 - * octets). - */ -#define SDIO_BT_A_PACKET_LEN_MAX 65543 - -enum sdioemb_bt_a_service_id { - SDIO_BT_A_SID_CMD = 0x01, - SDIO_BT_A_SID_ACL = 0x02, - SDIO_BT_A_SID_SCO = 0x03, - SDIO_BT_A_SID_EVT = 0x04, - SDIO_BT_A_SID_VENDOR = 0xfe, -}; - -static __inline int sdioemb_bt_a_packet_len(const char *p) -{ - return (p[0] & 0xff) | ((p[1] & 0xff) << 8) | ((p[2] & 0xff) << 16); -} - -static __inline int sdioemb_bt_a_service_id(const char *p) -{ - return p[3]; -} - -/* - * Minimum amount to read (including the Type-A header). This allows - * short packets (e.g., flow control packets) to be read with a single - * command. - */ -#define SDIO_BT_A_MIN_READ 32 - -#define SDIO_BT_A_NAME_LEN 16 - -struct sdioemb_bt_a_dev { - CsrSdioFunction *func; - char name[SDIO_BT_A_NAME_LEN]; - void *drv_data; - - /** - * Get a buffer to receive a packet into. - * - * @param bt the BT device. - * @param header a buffer of length #SDIO_BT_A_MIN_READ containing - * (part of) the packet the buffer is for. It will contain - * the Type-A header and as much of the payload that will - * fit. - * @param buffer_min_len the minimum length of buffer required to - * receive the whole packet. This includes space for padding - * the read to a whole number of blocks (if more than 512 - * octets is still to be read). - * @param buffer returns the buffer. The packet (including the - * Type-A header will be placed at the beginning of this - * buffer. - * @param buffer_handle returns a buffer handle passed to the - * subsequent call of the receive() callback. - * - * @return 0 if a buffer was provided. - * @return -ENOMEM if no buffer could be provided. - */ - int (*get_rx_buffer)(struct sdioemb_bt_a_dev *bt, const uint8_t *header, - size_t buffer_min_len, uint8_t **buffer, void **buffer_handle); - void (*receive)(struct sdioemb_bt_a_dev *bt, void *buffer_handle, int status); - void (*sleep_state_changed)(struct sdioemb_bt_a_dev *bt); - - enum sdio_sleep_state sleep_state; - - uint8_t max_tx_retries; - uint8_t max_rx_retries; - unsigned needs_read_ack:1; - unsigned wait_for_firmware:1; - - unsigned rx_off:1; - - /** - * A buffer to read the packet header into before the real buffer - * is requested with the get_rx_buffer() callback. - * - * @internal - */ - uint8_t *header; -}; - -int sdioemb_bt_a_setup(struct sdioemb_bt_a_dev *bt, CsrSdioFunction *func); -void sdioemb_bt_a_cleanup(struct sdioemb_bt_a_dev *bt); -int sdioemb_bt_a_send(struct sdioemb_bt_a_dev *bt, const uint8_t *packet, size_t len); -void sdioemb_bt_a_handle_interrupt(struct sdioemb_bt_a_dev *bt); -void sdioemb_bt_a_set_sleep_state(struct sdioemb_bt_a_dev *bt, enum sdio_sleep_state state); -int sdioemb_bt_a_check_for_reset(struct sdioemb_bt_a_dev *bt); -void sdioemb_bt_a_start(struct sdioemb_bt_a_dev *bt); -void sdioemb_bt_a_stop(struct sdioemb_bt_a_dev *bt); -void sdioemb_bt_a_rx_on(struct sdioemb_bt_a_dev *bt); -void sdioemb_bt_a_rx_off(struct sdioemb_bt_a_dev *bt); - -#endif /* #ifndef SDIOEMB_SDIO_BT_A_H */ diff --git a/drivers/staging/csr/sdioemb/sdio_cis.h b/drivers/staging/csr/sdioemb/sdio_cis.h deleted file mode 100644 index ec5e8fc..0000000 --- a/drivers/staging/csr/sdioemb/sdio_cis.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * SDIO CIS definitions. - * - * Copyright (C) 2007 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef _SDIO_CIS_H -#define _SDIO_CIS_H - -#define CISTPL_NULL 0x00 -#define CISTPL_CHECKSUM 0x10 -#define CISTPL_VERS_1 0x15 -#define CISTPL_ALTSTR 0x16 -#define CISTPL_MANFID 0x20 -# define CISTPL_MANFID_SIZE 0x04 -#define CISTPL_FUNCID 0x21 -#define CISTPL_FUNCE 0x22 -#define CISTPL_SDIO_STD 0x91 -#define CISTPL_SDIO_EXT 0x92 -#define CISTPL_END 0xff -#define CISTPL_FUNCE 0x22 -# define CISTPL_FUNCE_00_SIZE 0x04 -# define CISTPL_FUNCE_01_SIZE 0x2a - -#endif /* #ifndef _SDIO_CIS_H */ diff --git a/drivers/staging/csr/sdioemb/sdio_csr.h b/drivers/staging/csr/sdioemb/sdio_csr.h deleted file mode 100644 index 3b00e46..0000000 --- a/drivers/staging/csr/sdioemb/sdio_csr.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * CSR specific SDIO registers. - * - * Copyright (C) 2007 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef SDIOEMB_SDIO_CSR_H -#define SDIOEMB_SDIO_CSR_H - -/** - * @defgroup registers CSR specific SDIO registers - * - * Registers at 0xF0 - 0xFF in the CCCR are reserved for vendor - * specific registers. The registers documented here are specific to - * following CSR chips: - * - * - BlueCore (6 and later) - * - UltraCore - *@{ - */ - -/** - * Interrupt status/host wakeup register. - * - * This controls a function's deep sleep state. - * - * @see enum sdio_sleep_state - */ -#define SDIO_CSR_SLEEP_STATE 0xf0 -# define SDIO_CSR_SLEEP_STATE_FUNC(f) ((f) << 4) -# define SDIO_CSR_SLEEP_STATE_RDY_INT_EN 0x02 -# define SDIO_CSR_SLEEP_STATE_WAKE_REQ 0x01 - -/** - * Host interrupt clear register. - * - * Writing a 1 to bit 0 clears an SDIO interrupt raised by a generic - * function. - */ -#define SDIO_CSR_HOST_INT 0xf1 -# define SDIO_CSR_HOST_INT_CL 0x01 - -/** - * From host scratch register 0. - * - * A read/write register that can be used for signalling between the - * host and the chip. - * - * The usage of this register depends on the version of the chip or - * firmware. - */ -#define SDIO_CSR_FROM_HOST_SCRATCH0 0xf2 - -/** - * From host scratch register 1. - * - * @see SDIO_CSR_FROM_HOST_SCRATCH0 - */ -#define SDIO_CSR_FROM_HOST_SCRATCH1 0xf3 - -/** - * To host scratch register 0. - * - * A read only register that may be used for signalling between the - * chip and the host. - * - * The usage of this register depends on the version of the chip or - * firmware. - */ -#define SDIO_CSR_TO_HOST_SCRATCH0 0xf4 - -/** - * To host scratch register 1. - * - * @see SDIO_CSR_TO_HOST_SCRATCH0 - */ -#define SDIO_CSR_TO_HOST_SCRATCH1 0xf5 - -/** - * Extended I/O enable. - * - * Similar to the standard CCCR I/O Enable register, this is used to - * detect if an internal reset of a function has occured and - * (optionally) reenable it. - * - * An internal reset is detected by CCCR I/O Enable bit being set and - * the corresponding EXT_IO_EN bit being clear. - */ -#define SDIO_CSR_EXT_IO_EN 0xf6 - -/** - * Deep sleep states as set via the sleep state register. - * - * These states are used to control when the chip may go into a deep - * sleep (a low power mode). - * - * Since a chip in deep sleep may not respond to SDIO commands, the - * host should ensure that the chip is not in deep sleep before - * attempting SDIO commands to functions 1 to 7. - * - * The available states are: - * - * AWAKE - chip must not enter deep sleep and should exit deep sleep - * if it's currently sleeping. - * - * TORPID - chip may enter deep sleep. - * - * DROWSY - a transition state between TORPID and AWAKE. This is - * AWAKE plus the chip asserts an interrupt when the chip is awake. - * - * @see SDIO_CSR_SLEEP_STATE - */ -enum sdio_sleep_state { - SLEEP_STATE_AWAKE = SDIO_CSR_SLEEP_STATE_WAKE_REQ, - SLEEP_STATE_DROWSY = SDIO_CSR_SLEEP_STATE_WAKE_REQ | SDIO_CSR_SLEEP_STATE_RDY_INT_EN, - SLEEP_STATE_TORPID = 0x00, -}; - -/*@}*/ - -/* - * Generic function registers (with byte addresses). - */ - -/* - * SDIO_MODE is chip dependant, see the sdio_mode table in sdio_cspi.c - * to add support for new chips. - */ -#define SDIO_MODE /* chip dependant */ -# define SDIO_MODE_CSPI_EN 0x40 - -#endif /* SDIOEMB_SDIO_CSR_H */ diff --git a/drivers/staging/csr/sdioemb/slot_api.h b/drivers/staging/csr/sdioemb/slot_api.h deleted file mode 100644 index 777bdd4..0000000 --- a/drivers/staging/csr/sdioemb/slot_api.h +++ /dev/null @@ -1,313 +0,0 @@ -/* - * Slot driver API. - * - * Copyright (C) 2007-2009 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef _SLOT_API_H -#define _SLOT_API_H - -#include - -struct sdioemb_slot; - -/** - * @defgroup sdriver SDIO slot driver API - * - * @brief The SDIO slot driver API provides an interface for the SDIO - * layer to driver an SDIO slot (socket). - * - * Slot drivers register with the SDIO layer (sdioemb_slot_register()), - * providing functions to starting commands, enabling/disable card - * interrupts, card detection and bus power control. - * - * Functions are provided to notify the SDIO layer when a command has - * completed (sdioemb_cmd_complete()) and when an SDIO card interrupt has - * occurred (sdioemb_interrupt()). - */ - -#define SDIOEMB_BUS_FREQ_OFF 0 -#define SDIOEMB_BUS_FREQ_DEFAULT -1 -#define SDIOEMB_BUS_FREQ_IDLE -2 - -/** - * Valid SDIO bus voltage levels. - * - * @ingroup sdriver - */ -enum sdioemb_power { - SDIOEMB_POWER_OFF = 0, /**< Power switched off. */ - SDIOEMB_POWER_3V3 = 33, /**< Voltage set to 3.3V. */ -}; - -/** - * SDIO slot capabilities. - * - * @ingroup sdriver - */ -struct slot_caps { - int max_bus_freq; /**< Maximum bus frequency (Hz). */ - int max_bus_width; /**< Maximum bus width supported (1 or 4 data lines). */ - uint8_t cspi_mode; /**< CSPI_MODE register value (for CSPI capable slots). */ -}; - -/** - * Controller hardware type. - * - * @ingroup sdriver - */ -enum slot_controller_type { - SDIOEMB_SLOT_TYPE_SD = 0, /**< SD/SDIO controller. */ - SDIOEMB_SLOT_TYPE_SPI, /**< SPI controller. */ - SDIOEMB_SLOT_TYPE_SPI_CSPI, /**< SPI controller capable of CSPI. */ -}; - -/** - * Return values from the add_function() notifier. - * - * @ingroup sdriver - */ -enum sdioemb_add_func_status { - /** - * The core will call sdioemb_add_function(). - */ - SDIOEMB_ADD_FUNC_NOW = 0, - /** - * The slot driver will call sdioemb_add_function() or the - * function driver will call sdioemb_driver_probe() directly. - */ - SDIOEMB_ADD_FUNC_DEFERRED = 1, -}; - -/** - * Slot/card event notifiers. - * - * A slot driver may be notified when certain slot or card events - * occur. - * - * @ingroup sdriver - */ -struct sdioemb_slot_notifiers { - /** - * This is called when a card function has been enumerated - * and initialized but before can be bound to a function driver. - * - * A slot driver may use this to create an OS-specific object for - * the function. The slot driver must either (a) return - * SDIOEMB_ADD_FUNC_NOW; (b) return SDIOEMB_ADD_FUNC_DEFERRED and - * call sdioemb_add_function() later on; (c) return - * SDIOEMB_ADD_FUNC_DEFERRED and pass the fdev to the function - * driver for it to call sdioemb_driver_probe() directly; or (d) - * return an error. - * - * The slot driver may need to get a reference to the fdev with - * sdioemb_get_function() if the lifetime of the OS-specific - * object extends beyond the subsequent return of the - * del_function() callback. - * - * If this is non-NULL the slot driver must also provide - * del_function(). - * - * @param slot the SDIO slot producing the notification. - * @param fdev the SDIO function being added. - * - * @return SDIOEMB_ADD_FUNC_NOW if the function is ready for use. - * @return SDIOEMB_ADD_FUNC_DEFERRED if sdioemb_add_function() or - * sdioemb_driver_probe() will be called later. - * @return -ve on a error. - */ - int (*add_function)(struct sdioemb_slot *slot, struct sdioemb_dev *fdev); - - /** - * This is called when a card function is being removed and after - * any function driver has been unbound. - * - * A slot driver may use this to delete any OS-specific object - * created by the add_function() notifier. - * - * @param slot the SDIO slot producing the notification. - * @param fdev the SDIO function being deleted. - */ - void (*del_function)(struct sdioemb_slot *slot, struct sdioemb_dev *fdev); -}; - -struct sdioemb_slot_priv; - -/** - * An SDIO slot driver. - * - * Allocate and free with sdioemb_slot_alloc() and sdioemb_slot_free(). - * - * @ingroup sdriver - */ -struct sdioemb_slot { - /** - * Name of the slot used in diagnostic messages. - * - * This would typically include the name of the SDIO controller - * and the slot number if the controller has multiple slots. - * - * This will be set by sdioemb_slot_register() if it is left as an - * empty string. - */ - char name[64]; - - /** - * Controller hardware type. - */ - enum slot_controller_type type; - - /** - * Set the SD bus clock frequency. - * - * The driver's implementation should set the SD bus clock to not - * more than \a clk Hz (unless \a clk is equal to - * #SDIOEMB_BUS_FREQ_OFF or #SDIOEMB_BUS_FREQ_IDLE). - * - * If \a clk == SDIOEMB_BUS_FREQ_OFF the clock should be stopped. - * - * \a clk == SDIOEMB_BUS_FREQ_IDLE indicates that the bus is idle - * (currently unused) and the host controller may slow (or stop) - * the SD bus clock to save power on the card. During this idle - * state the host controller must be capable of receiving SDIO - * interrupts (for certain host controllers this may require - * leaving the clock running). - * - * If \a clk is greater than #SDIO_CLOCK_FREQ_NORMAL_SPD (25 MHz) - * subsequent commands should be done with the controller in high - * speed mode. - * - * Called from: interrupt context. - * - * @param slot the slot to configure. - * @param clk new SD bus clock frequency in Hz, SDIOEMB_BUS_FREQ_OFF - * or SDIOEMB_BUS_FREQ_IDLE. - * - * @return The bus frequency actually configured in Hz. - */ - int (*set_bus_freq)(struct sdioemb_slot *slot, int clk); - - /** - * Set the SD bus width. - * - * The driver's implementation should set the width of the SD bus - * for all subsequent data transfers to the specified value. - * - * This may be NULL if the driver sets the bus width when starting - * a command, or the driver is for an SDIO-SPI or CSPI controller. - * - * Called from: thread context. - * - * @param slot the slot to configure. - * @param bus_width new SD bus width (either 1 or 4). - * - * @return 0 on success. - * @return -ve if a low-level error occured when setting the bus width. - */ - int (*set_bus_width)(struct sdioemb_slot *slot, int bus_width); - - /** - * Start an SDIO command. - * - * The driver's implementation should: - * - * - set the controller's bus width to #bus_width, - * - program the controller to start the command. - * - * Called from: interrupt context. - * - * @param slot slot to perform the command. - * @param cmd SDIO command to start. - */ - int (*start_cmd)(struct sdioemb_slot *slot, struct sdioemb_cmd *cmd); - - /** - * Detect if a card is inserted into the slot. - * - * Called from: thread context. - * - * @param slot slot to check. - * - * @return non-zero if a card is inserted; 0 otherwise. - */ - int (*card_present)(struct sdioemb_slot *slot); - - /** - * Switch on/off the SDIO bus power and set the SDIO bus voltage. - * - * Called from: thread context. - * - * @param slot the slot. - * @param power the requested voltage. - * - * @return 0 on success; -ve on error: -EINVAL - requested voltage - * is not supported. - */ - int (*card_power)(struct sdioemb_slot *slot, enum sdioemb_power power); - - /** - * Enable (unmask) the SDIO card interrupt on the controller. - * - * Called from: interrupt context. - * - * @param slot the slot to enable the interrupt on.. - */ - void (*enable_card_int)(struct sdioemb_slot *slot); - - /** - * Disable (mask) the SDIO card interrupt on the controller. - * - * Called from: thread context. - * - * @param slot the slot to disable the interrupt on. - */ - void (*disable_card_int)(struct sdioemb_slot *slot); - - /** - * Perform a hard reset of the card. - * - * Hard resets can be achieved in two ways: - * - * -# Power cycle (if the slot has power control). - * -# Platform-specific assertion of a card/chip reset line. - * - * If hard resets are not supported, either return 0 or set - * hard_reset to NULL. - * - * @param slot the slot for the card to reset. - * - * @return 0 if a hard reset was performed. - * @return 1 if hard resets are not supported. - */ - int (*hard_reset)(struct sdioemb_slot *slot); - - struct slot_caps caps; /**< Slot capabilities. */ - int clock_freq; /**< SD bus frequency requested by the SDIO layer. */ - int bus_width; /**< Bus width requested by the SDIO layer. */ - struct sdioemb_slot_notifiers notifs; /**< Slot event notifiers. */ - int cspi_reg_pad; /**< Padding for CSPI register reads. */ - int cspi_burst_pad; /**< Padding for CSPI burst reads. */ - struct sdioemb_slot_priv *priv; /**< Data private to the SDIO layer. */ - void * drv_data; /**< Data private to the slot driver. */ -}; - -struct sdioemb_slot *sdioemb_slot_alloc(size_t drv_data_size); -void sdioemb_slot_free(struct sdioemb_slot *slot); -int sdioemb_slot_register(struct sdioemb_slot *slot); -void sdioemb_slot_unregister(struct sdioemb_slot *slot); -int sdioemb_card_inserted(struct sdioemb_slot *slot); -void sdioemb_card_removed(struct sdioemb_slot *slot); -void sdioemb_interrupt(struct sdioemb_slot *slot); -void sdioemb_cmd_complete(struct sdioemb_slot *slot, struct sdioemb_cmd *cmd); - -void sdioemb_suspend(struct sdioemb_slot *slot); -void sdioemb_resume(struct sdioemb_slot *slot); - -void sdioemb_add_function(struct sdioemb_dev *fdev); -void sdioemb_del_function(struct sdioemb_dev *fdev); -void sdioemb_get_function(struct sdioemb_dev *fdev); -void sdioemb_put_function(struct sdioemb_dev *fdev); - -#endif /* #ifndef _SLOT_API_H */ diff --git a/drivers/staging/csr/sdioemb/slot_imx27.h b/drivers/staging/csr/sdioemb/slot_imx27.h deleted file mode 100644 index 3aa2235..0000000 --- a/drivers/staging/csr/sdioemb/slot_imx27.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * i.MX27 SDHC definitions. - * - * Copyright (C) 2007 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef _SLOT_IMX27_H -#define _SLOT_IMX27_H - -/* - * i.MX27 SDHC registers. - */ - -#define SDHC_STR_STP_CLK 0x00 -# define STR_STP_CLK_MMCSD_RESET 0x0008 -# define STR_STP_CLK_START_CLK 0x0002 -# define STR_STP_CLK_STOP_CLK 0x0001 - -#define SDHC_STATUS 0x04 -# define STATUS_CARD_PRESENCE 0x8000 -# define STATUS_SDIO_INT_ACTIVE 0x4000 -# define STATUS_END_CMD_RESP 0x2000 -# define STATUS_WRITE_OP_DONE 0x1000 -# define STATUS_READ_OP_DONE 0x0800 -# define STATUS_CARD_BUS_CLK_RUN 0x0100 -# define STATUS_APPL_BUFF_FF 0x0080 -# define STATUS_APPL_BUFF_FE 0x0040 -# define STATUS_RESP_CRC_ERR 0x0020 -# define STATUS_CRC_READ_ERR 0x0008 -# define STATUS_CRC_WRITE_ERR 0x0004 -# define STATUS_TIME_OUT_RESP 0x0002 -# define STATUS_TIME_OUT_READ 0x0001 -# define STATUS_ERR_CMD_MASK (STATUS_RESP_CRC_ERR | STATUS_TIME_OUT_RESP) -# define STATUS_ERR_DATA_MASK (STATUS_CRC_READ_ERR | STATUS_CRC_WRITE_ERR | STATUS_TIME_OUT_READ) -# define STATUS_ERR_MASK (STATUS_ERR_CMD_MASK | STATUS_ERR_DATA_MASK) - -#define SDHC_CLK_RATE 0x08 - -#define SDHC_CMD_DAT_CTRL 0x0c /* CMD_DAT_CONT */ -# define CMD_DAT_CTRL_CMD_RESUME 0x8000 -# define CMD_DAT_CTRL_CMD_RESP_LONG_OFF 0x1000 -# define CMD_DAT_CTRL_STOP_READ_WAIT 0x0800 -# define CMD_DAT_CTRL_START_READ_WAIT 0x0400 -# define CMD_DAT_CTRL_BUS_WIDTH_4 0x0200 -# define CMD_DAT_CTRL_INIT 0x0080 -# define CMD_DAT_CTRL_WRITE 0x0010 -# define CMD_DAT_CTRL_DATA_ENABLE 0x0008 -# define CMD_DAT_CTRL_RESP_NONE 0x0000 -# define CMD_DAT_CTRL_RESP_R1_R5_R6 0x0001 -# define CMD_DAT_CTRL_RESP_R2 0x0002 -# define CMD_DAT_CTRL_RESP_R3_R4 0x0003 - -#define SDHC_RES_TO 0x10 - -#define SDHC_READ_TO 0x14 -# define READ_TO_RECOMMENDED 0x2db4 - -#define SDHC_BLK_LEN 0x18 - -#define SDHC_NOB 0x1c - -#define SDHC_REV_NO 0x20 - -#define SDHC_INT_CTRL 0x24 /* INT_CNTR */ -# define INT_CTRL_CARD_INSERTION_EN 0x8000 -# define INT_CTRL_SDIO_REMOVAL_EN 0x4000 -# define INT_CTRL_SDIO_IRQ_EN 0x2000 -# define INT_CTRL_DAT0_EN 0x1000 -# define INT_CTRL_BUF_READ_EN 0x0010 -# define INT_CTRL_BUF_WRITE_EN 0x0008 -# define INT_CTRL_END_CMD_RES 0x0004 -# define INT_CTRL_WRITE_OP_DONE 0x0002 -# define INT_CTRL_READ_OP_DONE 0x0001 -# define INT_CTRL_INT_EN_MASK 0xe01f - -#define SDHC_CMD 0x28 - -#define SDHC_ARG 0x2c - -#define SDHC_RES_FIFO 0x34 - -#define SDHC_BUFFER_ACCESS 0x38 - -#endif /* #ifndef _SLOT_IMX27_H */ diff --git a/drivers/staging/csr/sdioemb/slot_imx31.h b/drivers/staging/csr/sdioemb/slot_imx31.h deleted file mode 100644 index b11894a..0000000 --- a/drivers/staging/csr/sdioemb/slot_imx31.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * i.MX31 SDHC definitions. - * - * Copyright (C) 2007 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef _SLOT_IMX31_H -#define _SLOT_IMX31_H - -/* - * i.MX31 SDHC registers. - */ - -#define SDHC_STR_STP_CLK 0x00 -# define STR_STP_CLK_MMCSD_RESET 0x0008 -# define STR_STP_CLK_START_CLK 0x0002 -# define STR_STP_CLK_STOP_CLK 0x0001 - -#define SDHC_STATUS 0x04 -# define STATUS_CARD_PRESENCE 0x8000 -# define STATUS_SDIO_INT_ACTIVE 0x4000 -# define STATUS_END_CMD_RESP 0x2000 -# define STATUS_WRITE_OP_DONE 0x1000 -# define STATUS_READ_OP_DONE 0x0800 -# define STATUS_CARD_BUS_CLK_RUN 0x0100 -# define STATUS_APPL_BUFF_FF 0x0080 -# define STATUS_APPL_BUFF_FE 0x0040 -# define STATUS_RESP_CRC_ERR 0x0020 -# define STATUS_CRC_READ_ERR 0x0008 -# define STATUS_CRC_WRITE_ERR 0x0004 -# define STATUS_TIME_OUT_RESP 0x0002 -# define STATUS_TIME_OUT_READ 0x0001 -# define STATUS_ERR_CMD_MASK (STATUS_RESP_CRC_ERR | STATUS_TIME_OUT_RESP) -# define STATUS_ERR_DATA_MASK (STATUS_CRC_READ_ERR | STATUS_CRC_WRITE_ERR | STATUS_TIME_OUT_READ) -# define STATUS_ERR_MASK (STATUS_ERR_CMD_MASK | STATUS_ERR_DATA_MASK) - -#define SDHC_CLK_RATE 0x08 - -#define SDHC_CMD_DAT_CTRL 0x0c /* CMD_DAT_CONT */ -# define CMD_DAT_CTRL_CMD_RESUME 0x8000 -# define CMD_DAT_CTRL_CMD_RESP_LONG_OFF 0x1000 -# define CMD_DAT_CTRL_STOP_READ_WAIT 0x0800 -# define CMD_DAT_CTRL_START_READ_WAIT 0x0400 -# define CMD_DAT_CTRL_BUS_WIDTH_4 0x0200 -# define CMD_DAT_CTRL_INIT 0x0080 -# define CMD_DAT_CTRL_WRITE 0x0010 -# define CMD_DAT_CTRL_DATA_ENABLE 0x0008 -# define CMD_DAT_CTRL_RESP_NONE 0x0000 -# define CMD_DAT_CTRL_RESP_R1_R5_R6 0x0001 -# define CMD_DAT_CTRL_RESP_R2 0x0002 -# define CMD_DAT_CTRL_RESP_R3_R4 0x0003 - -#define SDHC_RES_TO 0x10 - -#define SDHC_READ_TO 0x14 -# define READ_TO_RECOMMENDED 0x2db4 - -#define SDHC_BLK_LEN 0x18 - -#define SDHC_NOB 0x1c - -#define SDHC_REV_NO 0x20 - -#define SDHC_INT_CTRL 0x24 /* INT_CNTR */ -# define INT_CTRL_CARD_INSERTION_EN 0x8000 -# define INT_CTRL_SDIO_REMOVAL_EN 0x4000 -# define INT_CTRL_SDIO_IRQ_EN 0x2000 -# define INT_CTRL_DAT0_EN 0x1000 -# define INT_CTRL_BUF_READ_EN 0x0010 -# define INT_CTRL_BUF_WRITE_EN 0x0008 -# define INT_CTRL_END_CMD_RES 0x0004 -# define INT_CTRL_WRITE_OP_DONE 0x0002 -# define INT_CTRL_READ_OP_DONE 0x0001 -# define INT_CTRL_INT_EN_MASK 0xe01f - -#define SDHC_CMD 0x28 - -#define SDHC_ARG 0x2c - -#define SDHC_RES_FIFO 0x34 - -#define SDHC_BUFFER_ACCESS 0x38 - -#endif /* #ifndef _SLOT_IMX31_H */ diff --git a/drivers/staging/csr/sdioemb/slot_pxa27x.h b/drivers/staging/csr/sdioemb/slot_pxa27x.h deleted file mode 100644 index cca853a..0000000 --- a/drivers/staging/csr/sdioemb/slot_pxa27x.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * PXA27x MMC/SD controller definitions. - * - * Copyright (C) 2007 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef _SLOT_PXA27X_H -#define _SLOT_PXA27X_H - -#define PXA27X_MMC_MMCLK_BASE_FREQ 19500000 -#define PXA27X_MMC_FIFO_SIZE 32 - -#define STOP_CLOCK (1 << 0) -#define START_CLOCK (2 << 0) - -#define STAT_END_CMD_RES (1 << 13) -#define STAT_PRG_DONE (1 << 12) -#define STAT_DATA_TRAN_DONE (1 << 11) -#define STAT_CLK_EN (1 << 8) -#define STAT_RECV_FIFO_FULL (1 << 7) -#define STAT_XMIT_FIFO_EMPTY (1 << 6) -#define STAT_RES_CRC_ERR (1 << 5) -#define STAT_SPI_READ_ERROR_TOKEN (1 << 4) -#define STAT_CRC_READ_ERROR (1 << 3) -#define STAT_CRC_WRITE_ERROR (1 << 2) -#define STAT_TIME_OUT_RESPONSE (1 << 1) -#define STAT_READ_TIME_OUT (1 << 0) - -#define SPI_CS_ADDRESS (1 << 3) -#define SPI_CS_EN (1 << 2) -#define CRC_ON (1 << 1) -#define SPI_EN (1 << 0) - -#define CMDAT_SDIO_INT_EN (1 << 11) -#define CMDAT_STOP_TRAN (1 << 10) -#define CMDAT_SD_4DAT (1 << 8) -#define CMDAT_DMAEN (1 << 7) -#define CMDAT_INIT (1 << 6) -#define CMDAT_BUSY (1 << 5) -#define CMDAT_STREAM (1 << 4) /* 1 = stream */ -#define CMDAT_WRITE (1 << 3) /* 1 = write */ -#define CMDAT_DATAEN (1 << 2) -#define CMDAT_RESP_NONE (0 << 0) -#define CMDAT_RESP_SHORT (1 << 0) -#define CMDAT_RESP_R2 (2 << 0) -#define CMDAT_RESP_R3 (3 << 0) - -#define RDTO_MAX 0xffff - -#define BUF_PART_FULL (1 << 0) - -#define SDIO_SUSPEND_ACK (1 << 12) -#define SDIO_INT (1 << 11) -#define RD_STALLED (1 << 10) -#define RES_ERR (1 << 9) -#define DAT_ERR (1 << 8) -#define TINT (1 << 7) -#define TXFIFO_WR_REQ (1 << 6) -#define RXFIFO_RD_REQ (1 << 5) -#define CLK_IS_OFF (1 << 4) -#define STOP_CMD (1 << 3) -#define END_CMD_RES (1 << 2) -#define PRG_DONE (1 << 1) -#define DATA_TRAN_DONE (1 << 0) - -#define MMC_I_MASK_ALL 0x00001fff - -#endif /* #ifndef _SLOT_PXA27X_H */ diff --git a/drivers/staging/csr/sdioemb/slot_shc.h b/drivers/staging/csr/sdioemb/slot_shc.h deleted file mode 100644 index 0eb5e53..0000000 --- a/drivers/staging/csr/sdioemb/slot_shc.h +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Standard Host Controller definitions. - * - * Copyright (C) 2007 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef _SLOT_SHC_H -#define _SLOT_SHC_H - -#include - -/* SHC registers */ -#define SHC_SYSTEM_ADDRESS 0x00 - -#define SHC_BLOCK_SIZE 0x04 -# define SHC_BLOCK_SIZE_DMA_BOUNDARY_4K (0x0 << 12) -# define SHC_BLOCK_SIZE_DMA_BOUNDARY_512K (0x7 << 12) - -#define SHC_BLOCK_COUNT 0x06 -#define SHC_ARG 0x08 - -#define SHC_TRANSFER_MODE 0x0c -# define SHC_TRANSFER_MODE_DMA_EN 0x0001 -# define SHC_TRANSFER_MODE_BLK_CNT_EN 0x0002 -# define SHC_TRANSFER_MODE_AUTO_CMD12_EN 0x0004 -# define SHC_TRANSFER_MODE_DATA_READ 0x0010 -# define SHC_TRANSFER_MODE_MULTI_BLK 0x0020 - -#define SHC_CMD 0x0e -# define SHC_CMD_RESP_NONE 0x0000 -# define SHC_CMD_RESP_136 0x0001 -# define SHC_CMD_RESP_48 0x0002 -# define SHC_CMD_RESP_48B 0x0003 -# define SHC_CMD_RESP_CRC_CHK 0x0008 -# define SHC_CMD_RESP_IDX_CHK 0x0010 -# define SHC_CMD_DATA_PRESENT 0x0020 -# define SHC_CMD_TYPE_ABORT (0x3 << 6) -# define SHC_CMD_IDX(c) ((c) << 8) - -#define SHC_RESPONSE_0_31 0x10 - -#define SHC_BUFFER_DATA_PORT 0x20 - -#define SHC_PRESENT_STATE 0x24 -# define SHC_PRESENT_STATE_CMD_INHIBIT 0x00000001 -# define SHC_PRESENT_STATE_DAT_INHIBIT 0x00000002 -# define SHC_PRESENT_STATE_CARD_PRESENT 0x00010000 - -#define SHC_HOST_CTRL 0x28 -# define SHC_HOST_CTRL_LED_ON 0x01 -# define SHC_HOST_CTRL_4BIT 0x02 -# define SHC_HOST_CTRL_HIGH_SPD_EN 0x04 - - -#define SHC_PWR_CTRL 0x29 -# define SHC_PWR_CTRL_3V3 0x0e -# define SHC_PWR_CTRL_ON 0x01 - -#define SHC_BLOCK_GAP_CTRL 0x2a -#define SHC_WAKEUP_CTRL 0x2b - -#define SHC_CLOCK_CTRL 0x2c -# define SHC_CLOCK_CTRL_INT_CLK_EN 0x01 -# define SHC_CLOCK_CTRL_INT_CLK_STABLE 0x02 -# define SHC_CLOCK_CTRL_SD_CLK_EN 0x04 -# define SHC_CLOCK_CTRL_DIV(d) (((d) >> 1) << 8) /* divisor must be power of 2 */ - -#define SHC_TIMEOUT_CTRL 0x2e -# define SHC_TIMEOUT_CTRL_MAX 0x0e - -#define SHC_SOFTWARE_RST 0x2f -# define SHC_SOFTWARE_RST_ALL 0x01 -# define SHC_SOFTWARE_RST_CMD 0x02 -# define SHC_SOFTWARE_RST_DAT 0x04 - -#define SHC_INT_STATUS 0x30 -#define SHC_INT_STATUS_EN 0x34 -#define SHC_INT_SIGNAL_EN 0x38 -# define SHC_INT_CMD_COMPLETE 0x00000001 -# define SHC_INT_TRANSFER_COMPLETE 0x00000002 -# define SHC_INT_BLOCK_GAP 0x00000004 -# define SHC_INT_DMA 0x00000008 -# define SHC_INT_WR_BUF_RDY 0x00000010 -# define SHC_INT_RD_BUF_RDY 0x00000020 -# define SHC_INT_CARD_INSERTED 0x00000040 -# define SHC_INT_CARD_REMOVED 0x00000080 -# define SHC_INT_CARD_INT 0x00000100 -# define SHC_INT_ERR_ANY 0x00008000 -# define SHC_INT_ERR_CMD_TIMEOUT 0x00010000 -# define SHC_INT_ERR_CMD_CRC 0x00020000 -# define SHC_INT_ERR_CMD_ENDBIT 0x00040000 -# define SHC_INT_ERR_CMD_INDEX 0x00080000 -# define SHC_INT_ERR_CMD_ALL 0x000f0000 -# define SHC_INT_ERR_DAT_TIMEOUT 0x00100000 -# define SHC_INT_ERR_DAT_CRC 0x00200000 -# define SHC_INT_ERR_DAT_ENDBIT 0x00400000 -# define SHC_INT_ERR_DAT_ALL 0x00700000 -# define SHC_INT_ERR_CURRENT_LIMIT 0x00800000 -# define SHC_INT_ERR_AUTO_CMD12 0x01000000 -# define SHC_INT_ERR_ALL 0x01ff0000 -# define SHC_INT_ALL 0x01ff81ff - -#define SHC_AUTO_CMD12_STATUS 0x3c - -#define SHC_CAPS 0x40 -# define SHC_CAPS_TO_BASE_CLK_FREQ(c) (((c) & 0x00003f00) >> 8) -# define SHC_CAPS_PWR_3V3 (1 << 24) - -#define SHC_MAX_CURRENT_CAPS 0x4c - -/* PCI configuration registers. */ -#define PCI_SHC_SLOT_INFO 0x40 - -/* Maximum time to wait for a software reset. */ -#define SHC_RESET_TIMEOUT_MS 100 /* ms */ - -/* Maximum time to wait for internal clock to stabilize */ -#define SHC_INT_CLK_STABLE_TIMEOUT_MS 100 - -/* - * No supported voltages in the capabilities register. - * - * Workaround: Assume 3.3V is supported. - */ -#define SLOT_SHC_QUIRK_NO_VOLTAGE_CAPS (1 << 0) - -/* - * Commands with an R5B (busy) response do not complete. - * - * Workaround: Use R5 instead. This will only work if the busy signal - * is cleared sufficiently quickly before the next command is started. - */ -#define SLOT_SHC_QUIRK_R5B_BROKEN (1 << 1) - -/* - * High speed mode doesn't work. - * - * Workaround: limit maximum bus frequency to 25 MHz. - */ -#define SLOT_SHC_QUIRK_HIGH_SPD_BROKEN (1 << 2) - -/* - * Data timeout (TIMEOUT_CTRL) uses SDCLK and not TMCLK. - * - * Workaround: set TIMEOUT_CTRL using SDCLK. - */ -#define SLOT_SHC_QUIRK_DATA_TIMEOUT_USES_SDCLK (1 << 3) - -/* - * Controller can only start DMA on dword (32 bit) aligned addresses. - * - * Workaround: PIO is used on data transfers with a non-dword aligned - * address. - */ -#define SHC_QUIRK_DMA_NEEDS_DWORD_ALIGNED_ADDR (1 << 4) - -/* - * Controller is unreliable following multiple transfers - * - * Workaround: The controller is reset following every command, not just - * erroneous ones - */ -#define SHC_QUIRK_RESET_EVERY_CMD_COMPLETE (1 << 5) - -/* - * JMicron JMB381 to JMB385 controllers require some non-standard PCI - * config space writes. - */ -#define SHC_QUIRK_JMICRON_JMB38X (1 << 6) - -/* - * Controller can only do DMA if the length is a whole number of - * dwords. - * - * Controller with this quirk probably also need - * SHC_QUIRK_DMA_NEEDS_DWORD_ALIGNED_ADDR. - * - * Workaround: PIO is used on data transfers that don't end on an - * aligned address. - */ -#define SHC_QUIRK_DMA_NEEDS_DWORD_ALIGNED_LEN (1 << 7) - -struct sdioemb_shc { - struct sdioemb_slot *slot; - void (*enable_int)(struct sdioemb_slot *slot, uint32_t ints); - void (*disable_int)(struct sdioemb_slot *slot, uint32_t ints); - void (*cmd_complete)(struct sdioemb_slot *slot, struct sdioemb_cmd *cmd); - uint32_t quirks; - os_io_mem_t addr; - - os_spinlock_t lock; - os_timer_t lockup_timer; - uint32_t base_clk; - struct sdioemb_cmd *current_cmd; - uint8_t *data; - size_t remaining; - size_t block_size; -}; - -void sdioemb_shc_init(struct sdioemb_shc *shc); -void sdioemb_shc_clean_up(struct sdioemb_shc *shc); - -int sdioemb_shc_start(struct sdioemb_shc *shc); -void sdioemb_shc_stop(struct sdioemb_shc *shc); - -bool sdioemb_shc_isr(struct sdioemb_shc *shc, uint32_t *int_stat); -void sdioemb_shc_dsr(struct sdioemb_shc *shc, uint32_t int_stat); - -int sdioemb_shc_set_bus_freq(struct sdioemb_shc *shc, int clk); -int sdioemb_shc_set_bus_width(struct sdioemb_shc *shc, int bus_width); -int sdioemb_shc_start_cmd(struct sdioemb_shc *shc, struct sdioemb_cmd *cmd, - bool use_dma, uint64_t dma_addr); -int sdioemb_shc_card_present(struct sdioemb_shc *shc); -int sdioemb_shc_card_power(struct sdioemb_shc *shc, enum sdioemb_power power); -void sdioemb_shc_enable_card_int(struct sdioemb_shc *shc); -void sdioemb_shc_disable_card_int(struct sdioemb_shc *shc); -int sdioemb_shc_hard_reset(struct sdioemb_shc *shc); - -void sdioemb_shc_show_quirks(struct sdioemb_shc *shc); - -#endif /* #ifndef _SLOT_SHC_H */ diff --git a/drivers/staging/csr/sdioemb/slot_ushc.h b/drivers/staging/csr/sdioemb/slot_ushc.h deleted file mode 100644 index efe3310..0000000 --- a/drivers/staging/csr/sdioemb/slot_ushc.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - * USB Standard Host Controller definitions. - * - * Copyright (C) 2010 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef _SLOT_USHC_H -#define _SLOT_USHC_H - -#include - -enum ushc_request -{ - USHC_GET_CAPS = 0x00, - USHC_HOST_CTRL = 0x01, - USHC_PWR_CTRL = 0x02, - USHC_CLK_FREQ = 0x03, - USHC_EXEC_CMD = 0x04, - USHC_READ_RESP = 0x05, - USHC_RESET = 0x06 -}; - -enum ushc_request_recipient -{ - USHC_RECIPIENT_DEVICE = 0x00, - USHC_RECIPIENT_INTERFACE = 0x01, - USHC_RECIPIENT_ENDPOINT = 0x02, - USHC_RECIPIENT_OTHER = 0x03 -}; - -enum ushc_request_direction -{ - USHC_HOST_TO_DEVICE = 0x00, - USHC_DEVICE_TO_HOST = 0x01 -}; - -struct sdioemb_ushc -{ - struct sdioemb_slot *slot; - - void (*enable_int)(struct sdioemb_slot *slot, uint32_t ints); - void (*disable_int)(struct sdioemb_slot *slot, uint32_t ints); - void (*cmd_complete)(struct sdioemb_slot *slot, struct sdioemb_cmd *cmd); - int (*set_host_ctrl)(struct sdioemb_slot *slot, uint16_t controler_state); - int (*submit_vendor_request)(struct sdioemb_slot *slot, - enum ushc_request request, - enum ushc_request_direction direction, - enum ushc_request_recipient recipient, - uint16_t value, - uint16_t index, - void* io_buffer, - uint32_t io_buffer_length); - int (*submit_cbw_request)(struct sdioemb_slot *slot, uint8_t cmd_index, uint16_t block_size, uint32_t cmd_arg); - int (*submit_data_request)(struct sdioemb_slot *slot, - enum ushc_request_direction direction, - void* request_buffer, - uint32_t request_buffer_length); - int (*submit_csw_request)(struct sdioemb_slot *slot); - - os_spinlock_t lock; - - uint32_t base_clock; - uint32_t controler_capabilities; - uint16_t controler_state; - struct sdioemb_cmd* current_cmd; - -#define DISCONNECTED 0 -#define INT_EN 1 -#define IGNORE_NEXT_INT 2 -#define STOP 4 - uint32_t flags; - -#define USHC_INT_STATUS_SDIO_INT (1 << 1) -#define USHC_INT_STATUS_CARD_PRESENT (1 << 0) - uint8_t interrupt_status; - - size_t block_size; -}; - -#define USHC_GET_CAPS_VERSION_MASK 0xff -#define USHC_GET_CAPS_3V3 (1 << 8) -#define USHC_GET_CAPS_3V0 (1 << 9) -#define USHC_GET_CAPS_1V8 (1 << 10) -#define USHC_GET_CAPS_HIGH_SPD (1 << 16) - -#define USHC_PWR_CTRL_OFF 0x00 -#define USHC_PWR_CTRL_3V3 0x01 -#define USHC_PWR_CTRL_3V0 0x02 -#define USHC_PWR_CTRL_1V8 0x03 - -#define USHC_HOST_CTRL_4BIT (1 << 1) -#define USHC_HOST_CTRL_HIGH_SPD (1 << 0) - -#define USHC_READ_RESP_BUSY (1 << 4) -#define USHC_READ_RESP_ERR_TIMEOUT (1 << 3) -#define USHC_READ_RESP_ERR_CRC (1 << 2) -#define USHC_READ_RESP_ERR_DAT (1 << 1) -#define USHC_READ_RESP_ERR_CMD (1 << 0) -#define USHC_READ_RESP_ERR_MASK 0x0f - -void sdioemb_ushc_init(struct sdioemb_ushc* ushc); -void sdioemb_ushc_clean_up(struct sdioemb_ushc* ushc); - -int sdioemb_ushc_start(struct sdioemb_ushc* ushc); -void sdioemb_ushc_stop(struct sdioemb_ushc* ushc); - -bool sdioemb_ushc_isr(struct sdioemb_ushc* ushc, uint8_t int_stat); - -int sdioemb_ushc_set_bus_freq(struct sdioemb_ushc* ushc, int clk); -int sdioemb_ushc_set_bus_width(struct sdioemb_ushc* ushc, int bus_width); -int sdioemb_ushc_start_cmd(struct sdioemb_ushc* ushc, struct sdioemb_cmd *cmd); -int sdioemb_ushc_card_present(struct sdioemb_ushc* ushc); -int sdioemb_ushc_card_power(struct sdioemb_ushc* ushc, enum sdioemb_power power); -void sdioemb_ushc_enable_card_int(struct sdioemb_ushc* ushc); -void sdioemb_ushc_disable_card_int(struct sdioemb_ushc* ushc); -int sdioemb_ushc_hard_reset(struct sdioemb_ushc* ushc); - -void sdioemb_ushc_command_complete(struct sdioemb_ushc* ushc, uint8_t status, uint32_t respones); - -int ushc_hw_get_caps(struct sdioemb_ushc* ushc); -static int ushc_hw_set_host_ctrl(struct sdioemb_ushc* ushc, uint16_t mask, uint16_t val); -static int ushc_hw_submit_vendor_request(struct sdioemb_ushc* ushc, - enum ushc_request request, - enum ushc_request_recipient recipient, - enum ushc_request_direction direction, - uint16_t value, - uint16_t index, - void* io_buffer, - uint32_t io_buffer_length); - -#endif diff --git a/drivers/staging/csr/sdioemb/trace.h b/drivers/staging/csr/sdioemb/trace.h deleted file mode 100644 index 57cbb01..0000000 --- a/drivers/staging/csr/sdioemb/trace.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Sdioemb trace messages. - * - * Copyright (C) 2009 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ - -#ifndef SDIOEMB_TRACE_H -#define SDIOEMB_TRACE_H - -#if defined(__linux__) -# define OS_TRACE_PREFIX "sdioemb: " -#endif - -#include - -#endif /* #ifndef SDIOEMB_TRACE_H */ diff --git a/drivers/staging/csr/sdioemb/uif.h b/drivers/staging/csr/sdioemb/uif.h deleted file mode 100644 index c09357f..0000000 --- a/drivers/staging/csr/sdioemb/uif.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Userspace interface to the SDIO Userspace Interface driver. - * - * Copyright (C) 2007 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - */ -#ifndef LINUX_SDIOEMB_UIF_H -#define LINUX_SDIOEMB_UIF_H - -enum sdioemb_uif_cmd_type { - SDIOEMB_UIF_CMD52_READ, SDIOEMB_UIF_CMD52_WRITE, - SDIOEMB_UIF_CMD53_READ, SDIOEMB_UIF_CMD53_WRITE, -}; - -struct sdioemb_uif_cmd { - enum sdioemb_uif_cmd_type type; - int function; - uint32_t address; - uint8_t * data; - size_t len; - int block_size; -}; - -#define SDIOEMB_UIF_IOC_MAGIC 's' - -#define SDIOEMB_UIF_IOCQNUMFUNCS _IO(SDIOEMB_UIF_IOC_MAGIC, 0) -#define SDIOEMB_UIF_IOCCMD _IOWR(SDIOEMB_UIF_IOC_MAGIC, 1, struct sdioemb_uif_cmd) -#define SDIOEMB_UIF_IOCWAITFORINT _IO(SDIOEMB_UIF_IOC_MAGIC, 2) -#define SDIOEMB_UIF_IOCTBUSWIDTH _IO(SDIOEMB_UIF_IOC_MAGIC, 3) -#define SDIOEMB_UIF_IOCREINSERT _IO(SDIOEMB_UIF_IOC_MAGIC, 4) -#define SDIOEMB_UIF_IOCTBUSFREQ _IO(SDIOEMB_UIF_IOC_MAGIC, 5) -#define SDIOEMB_UIF_IOCQMANFID _IO(SDIOEMB_UIF_IOC_MAGIC, 6) -#define SDIOEMB_UIF_IOCQCARDID _IO(SDIOEMB_UIF_IOC_MAGIC, 7) -#define SDIOEMB_UIF_IOCQSTDIF _IO(SDIOEMB_UIF_IOC_MAGIC, 8) -#define SDIOEMB_UIF_IOCQMAXBLKSZ _IO(SDIOEMB_UIF_IOC_MAGIC, 9) -#define SDIOEMB_UIF_IOCQBLKSZ _IO(SDIOEMB_UIF_IOC_MAGIC, 10) -#define SDIOEMB_UIF_IOCTBLKSZ _IO(SDIOEMB_UIF_IOC_MAGIC, 11) - -#endif /* #ifndef LINUX_SDIOEMB_UIF_H */ diff --git a/drivers/staging/csr/sdioemb/version.h b/drivers/staging/csr/sdioemb/version.h deleted file mode 100644 index b88ef6e..0000000 --- a/drivers/staging/csr/sdioemb/version.h +++ /dev/null @@ -1,11 +0,0 @@ -/* Autogenerated by the sdioemb release procedure. */ -#ifndef SDIOEMB_VERSION_H -#define SDIOEMB_VERSION_H - -#define SDIOEMB_RELEASE 31 - -#ifndef SDIOEMB_RELEASE_EXTRA -#define SDIOEMB_RELEASE_EXTRA "" -#endif - -#endif /* #ifndef SDIOEMB_VERSION_H */ -- cgit v0.10.2 From ca6d25029a5ecc9f1f3497537eafa8557e9cfdab Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 11:25:50 -0700 Subject: staging: csr: clean up csr_types.h a bit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the floating point variables and the sections that are not being built if the code isn't in the kernel. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_types.h b/drivers/staging/csr/csr_types.h index 23193ea..e736a78 100644 --- a/drivers/staging/csr/csr_types.h +++ b/drivers/staging/csr/csr_types.h @@ -10,19 +10,11 @@ *****************************************************************************/ -#ifdef __KERNEL__ #include #include #include -#include #include -#else -#include -#include -#include -#include -#include -#endif +#include #ifdef __cplusplus extern "C" { @@ -38,11 +30,7 @@ extern "C" { typedef size_t CsrSize; /* Return type of sizeof (ISO/IEC 9899:1990 7.1.6) */ typedef ptrdiff_t CsrPtrdiff; /* Type of the result of subtracting two pointers (ISO/IEC 9899:1990 7.1.6) */ typedef uintptr_t CsrUintptr; /* Unsigned integer large enough to hold any pointer (ISO/IEC 9899:1999 7.18.1.4) */ -#ifdef __KERNEL__ typedef ptrdiff_t CsrIntptr; /* intptr_t is not defined in kernel. Use the equivalent ptrdiff_t. */ -#else -typedef intptr_t CsrIntptr; /* Signed integer large enough to hold any pointer (ISO/IEC 9899:1999 7.18.1.4) */ -#endif /* Unsigned fixed width types */ typedef uint8_t CsrUint8; @@ -75,17 +63,6 @@ typedef CsrUint32 CsrUint24; typedef uint64_t CsrUint64; typedef int64_t CsrInt64; -/* - * Floating point - * - * Note: If a given compiler does not support floating point, it is - * OK to omit these definitions; alternative versions of the code using - * these types may be available. Consult the relevant documentation - * or the customer support group for information on this. - */ -#define CSR_HAVE_FLOATING_POINT -typedef float CsrFloat; -typedef double CsrDouble; #ifdef __cplusplus } -- cgit v0.10.2 From 7e6f57944cb508fc426bce20cc2838fbe9d95654 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 11:51:01 -0700 Subject: staging: csr: remove CsrUint8 typedef MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the in-kernel u8 type instead. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/bh.c b/drivers/staging/csr/bh.c index 6af9d29..bfc2f9e 100644 --- a/drivers/staging/csr/bh.c +++ b/drivers/staging/csr/bh.c @@ -159,7 +159,7 @@ uf_wait_for_thread_to_stop(unifi_priv_t *priv, struct uf_thread *thread) handle_bh_error(unifi_priv_t *priv) { u8 conf_param = CONFIG_IND_ERROR; - CsrUint8 interfaceTag = 0; /* used as a loop counter */ + u8 interfaceTag = 0; /* used as a loop counter */ /* Block unifi_run_bh() until the error has been handled. */ diff --git a/drivers/staging/csr/csr_lib.h b/drivers/staging/csr/csr_lib.h index 171f5fe..041bd09 100644 --- a/drivers/staging/csr/csr_lib.h +++ b/drivers/staging/csr/csr_lib.h @@ -35,7 +35,7 @@ CsrEvent *CsrEvent_struct(CsrUint16 primtype, CsrUint16 msgtype); typedef struct { CsrPrim type; - CsrUint8 value; + u8 value; } CsrEventCsrUint8; /*----------------------------------------------------------------------------* @@ -46,7 +46,7 @@ typedef struct * Allocates and fills in a message with the signature CsrEventCsrUint8 * *----------------------------------------------------------------------------*/ -CsrEventCsrUint8 *CsrEventCsrUint8_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint8 value); +CsrEventCsrUint8 *CsrEventCsrUint8_struct(CsrUint16 primtype, CsrUint16 msgtype, u8 value); typedef struct { @@ -68,7 +68,7 @@ typedef struct { CsrPrim type; CsrUint16 value1; - CsrUint8 value2; + u8 value2; } CsrEventCsrUint16CsrUint8; /*----------------------------------------------------------------------------* @@ -79,7 +79,7 @@ typedef struct * Allocates and fills in a message with the signature CsrEventCsrUint16CsrUint8 * *----------------------------------------------------------------------------*/ -CsrEventCsrUint16CsrUint8 *CsrEventCsrUint16CsrUint8_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint16 value1, CsrUint8 value2); +CsrEventCsrUint16CsrUint8 *CsrEventCsrUint16CsrUint8_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint16 value1, u8 value2); typedef struct { diff --git a/drivers/staging/csr/csr_log.h b/drivers/staging/csr/csr_log.h index db2653c..f86c492 100644 --- a/drivers/staging/csr/csr_log.h +++ b/drivers/staging/csr/csr_log.h @@ -111,7 +111,7 @@ typedef struct /*---------------------------------*/ /* Tech logging */ /*---------------------------------*/ -typedef CsrUint8 bitmask8_t; +typedef u8 bitmask8_t; typedef CsrUint16 bitmask16_t; typedef CsrUint32 bitmask32_t; @@ -168,13 +168,13 @@ void CsrLogStateTransition(bitmask16_t mask, /*---------------------------------*/ /* BSP logging */ /*---------------------------------*/ -void CsrLogSchedInit(CsrUint8 thread_id); -void CsrLogSchedDeinit(CsrUint8 thread_id); +void CsrLogSchedInit(u8 thread_id); +void CsrLogSchedDeinit(u8 thread_id); -void CsrLogSchedStart(CsrUint8 thread_id); -void CsrLogSchedStop(CsrUint8 thread_id); +void CsrLogSchedStart(u8 thread_id); +void CsrLogSchedStop(u8 thread_id); -void CsrLogInitTask(CsrUint8 thread_id, CsrSchedQid tskid, const CsrCharString *tskName); +void CsrLogInitTask(u8 thread_id, CsrSchedQid tskid, const CsrCharString *tskName); void CsrLogDeinitTask(CsrUint16 task_id); void CsrLogActivate(CsrSchedQid tskid); @@ -218,7 +218,7 @@ void CsrLogTimedEventCancel(CsrUint32 line, CsrSchedTid tid, CsrBool cancel_res); -void CsrLogBgintRegister(CsrUint8 thread_id, +void CsrLogBgintRegister(u8 thread_id, CsrSchedBgint irq, const CsrCharString *callback, const void *ptr); diff --git a/drivers/staging/csr/csr_log_configure.h b/drivers/staging/csr/csr_log_configure.h index 3d48bf9..8c727ad 100644 --- a/drivers/staging/csr/csr_log_configure.h +++ b/drivers/staging/csr/csr_log_configure.h @@ -20,7 +20,7 @@ extern "C" { /*---------------------------------*/ /* Log init/deinit */ /*---------------------------------*/ -void CsrLogInit(CsrUint8 size); +void CsrLogInit(u8 size); void CsrLogDeinit(void); /*---------------------------------*/ diff --git a/drivers/staging/csr/csr_macro.h b/drivers/staging/csr/csr_macro.h index 2e3dcac..e8de0a7 100644 --- a/drivers/staging/csr/csr_macro.h +++ b/drivers/staging/csr/csr_macro.h @@ -31,39 +31,39 @@ extern "C" { /*------------------------------------------------------------------*/ /* Endian conversion */ /*------------------------------------------------------------------*/ -#define CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr) (((CsrUint16) ((CsrUint8 *) (ptr))[0]) | ((CsrUint16) ((CsrUint8 *) (ptr))[1]) << 8) -#define CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr) (((CsrUint32) ((CsrUint8 *) (ptr))[0]) | ((CsrUint32) ((CsrUint8 *) (ptr))[1]) << 8 | \ - ((CsrUint32) ((CsrUint8 *) (ptr))[2]) << 16 | ((CsrUint32) ((CsrUint8 *) (ptr))[3]) << 24) -#define CSR_COPY_UINT16_TO_LITTLE_ENDIAN(uint, ptr) ((CsrUint8 *) (ptr))[0] = ((CsrUint8) ((uint) & 0x00FF)); \ - ((CsrUint8 *) (ptr))[1] = ((CsrUint8) ((uint) >> 8)) -#define CSR_COPY_UINT32_TO_LITTLE_ENDIAN(uint, ptr) ((CsrUint8 *) (ptr))[0] = ((CsrUint8) ((uint) & 0x000000FF)); \ - ((CsrUint8 *) (ptr))[1] = ((CsrUint8) (((uint) >> 8) & 0x000000FF)); \ - ((CsrUint8 *) (ptr))[2] = ((CsrUint8) (((uint) >> 16) & 0x000000FF)); \ - ((CsrUint8 *) (ptr))[3] = ((CsrUint8) (((uint) >> 24) & 0x000000FF)) -#define CSR_GET_UINT16_FROM_BIG_ENDIAN(ptr) (((CsrUint16) ((CsrUint8 *) (ptr))[1]) | ((CsrUint16) ((CsrUint8 *) (ptr))[0]) << 8) -#define CSR_GET_UINT24_FROM_BIG_ENDIAN(ptr) (((CsrUint24) ((CsrUint8 *) (ptr))[2]) | \ - ((CsrUint24) ((CsrUint8 *) (ptr))[1]) << 8 | ((CsrUint24) ((CsrUint8 *) (ptr))[0]) << 16) -#define CSR_GET_UINT32_FROM_BIG_ENDIAN(ptr) (((CsrUint32) ((CsrUint8 *) (ptr))[3]) | ((CsrUint32) ((CsrUint8 *) (ptr))[2]) << 8 | \ - ((CsrUint32) ((CsrUint8 *) (ptr))[1]) << 16 | ((CsrUint32) ((CsrUint8 *) (ptr))[0]) << 24) -#define CSR_COPY_UINT16_TO_BIG_ENDIAN(uint, ptr) ((CsrUint8 *) (ptr))[1] = ((CsrUint8) ((uint) & 0x00FF)); \ - ((CsrUint8 *) (ptr))[0] = ((CsrUint8) ((uint) >> 8)) -#define CSR_COPY_UINT24_TO_BIG_ENDIAN(uint, ptr) ((CsrUint8 *) (ptr))[2] = ((CsrUint8) ((uint) & 0x000000FF)); \ - ((CsrUint8 *) (ptr))[1] = ((CsrUint8) (((uint) >> 8) & 0x000000FF)); \ - ((CsrUint8 *) (ptr))[0] = ((CsrUint8) (((uint) >> 16) & 0x000000FF)) -#define CSR_COPY_UINT32_TO_BIG_ENDIAN(uint, ptr) ((CsrUint8 *) (ptr))[3] = ((CsrUint8) ((uint) & 0x000000FF)); \ - ((CsrUint8 *) (ptr))[2] = ((CsrUint8) (((uint) >> 8) & 0x000000FF)); \ - ((CsrUint8 *) (ptr))[1] = ((CsrUint8) (((uint) >> 16) & 0x000000FF)); \ - ((CsrUint8 *) (ptr))[0] = ((CsrUint8) (((uint) >> 24) & 0x000000FF)) +#define CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr) (((CsrUint16) ((u8 *) (ptr))[0]) | ((CsrUint16) ((u8 *) (ptr))[1]) << 8) +#define CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr) (((CsrUint32) ((u8 *) (ptr))[0]) | ((CsrUint32) ((u8 *) (ptr))[1]) << 8 | \ + ((CsrUint32) ((u8 *) (ptr))[2]) << 16 | ((CsrUint32) ((u8 *) (ptr))[3]) << 24) +#define CSR_COPY_UINT16_TO_LITTLE_ENDIAN(uint, ptr) ((u8 *) (ptr))[0] = ((u8) ((uint) & 0x00FF)); \ + ((u8 *) (ptr))[1] = ((u8) ((uint) >> 8)) +#define CSR_COPY_UINT32_TO_LITTLE_ENDIAN(uint, ptr) ((u8 *) (ptr))[0] = ((u8) ((uint) & 0x000000FF)); \ + ((u8 *) (ptr))[1] = ((u8) (((uint) >> 8) & 0x000000FF)); \ + ((u8 *) (ptr))[2] = ((u8) (((uint) >> 16) & 0x000000FF)); \ + ((u8 *) (ptr))[3] = ((u8) (((uint) >> 24) & 0x000000FF)) +#define CSR_GET_UINT16_FROM_BIG_ENDIAN(ptr) (((CsrUint16) ((u8 *) (ptr))[1]) | ((CsrUint16) ((u8 *) (ptr))[0]) << 8) +#define CSR_GET_UINT24_FROM_BIG_ENDIAN(ptr) (((CsrUint24) ((u8 *) (ptr))[2]) | \ + ((CsrUint24) ((u8 *) (ptr))[1]) << 8 | ((CsrUint24) ((u8 *) (ptr))[0]) << 16) +#define CSR_GET_UINT32_FROM_BIG_ENDIAN(ptr) (((CsrUint32) ((u8 *) (ptr))[3]) | ((CsrUint32) ((u8 *) (ptr))[2]) << 8 | \ + ((CsrUint32) ((u8 *) (ptr))[1]) << 16 | ((CsrUint32) ((u8 *) (ptr))[0]) << 24) +#define CSR_COPY_UINT16_TO_BIG_ENDIAN(uint, ptr) ((u8 *) (ptr))[1] = ((u8) ((uint) & 0x00FF)); \ + ((u8 *) (ptr))[0] = ((u8) ((uint) >> 8)) +#define CSR_COPY_UINT24_TO_BIG_ENDIAN(uint, ptr) ((u8 *) (ptr))[2] = ((u8) ((uint) & 0x000000FF)); \ + ((u8 *) (ptr))[1] = ((u8) (((uint) >> 8) & 0x000000FF)); \ + ((u8 *) (ptr))[0] = ((u8) (((uint) >> 16) & 0x000000FF)) +#define CSR_COPY_UINT32_TO_BIG_ENDIAN(uint, ptr) ((u8 *) (ptr))[3] = ((u8) ((uint) & 0x000000FF)); \ + ((u8 *) (ptr))[2] = ((u8) (((uint) >> 8) & 0x000000FF)); \ + ((u8 *) (ptr))[1] = ((u8) (((uint) >> 16) & 0x000000FF)); \ + ((u8 *) (ptr))[0] = ((u8) (((uint) >> 24) & 0x000000FF)) /*------------------------------------------------------------------*/ /* XAP conversion macros */ /*------------------------------------------------------------------*/ -#define CSR_LSB16(a) ((CsrUint8) ((a) & 0x00ff)) -#define CSR_MSB16(b) ((CsrUint8) ((b) >> 8)) +#define CSR_LSB16(a) ((u8) ((a) & 0x00ff)) +#define CSR_MSB16(b) ((u8) ((b) >> 8)) #define CSR_CONVERT_8_FROM_XAP(output, input) \ - (output) = ((CsrUint8) (input));(input) += 2 + (output) = ((u8) (input));(input) += 2 #define CSR_CONVERT_16_FROM_XAP(output, input) \ (output) = (CsrUint16) ((((CsrUint16) (input)[1]) << 8) | \ @@ -80,14 +80,14 @@ extern "C" { (output)[1] = 0;(output) += 2 #define CSR_ADD_UINT16_TO_XAP(output, input) \ - (output)[0] = ((CsrUint8) ((input) & 0x00FF)); \ - (output)[1] = ((CsrUint8) ((input) >> 8));(output) += 2 + (output)[0] = ((u8) ((input) & 0x00FF)); \ + (output)[1] = ((u8) ((input) >> 8));(output) += 2 #define CSR_ADD_UINT32_TO_XAP(output, input) \ - (output)[0] = ((CsrUint8) (((input) >> 16) & 0x00FF)); \ - (output)[1] = ((CsrUint8) ((input) >> 24)); \ - (output)[2] = ((CsrUint8) ((input) & 0x00FF)); \ - (output)[3] = ((CsrUint8) (((input) >> 8) & 0x00FF));(output) += 4 + (output)[0] = ((u8) (((input) >> 16) & 0x00FF)); \ + (output)[1] = ((u8) ((input) >> 24)); \ + (output)[2] = ((u8) ((input) & 0x00FF)); \ + (output)[3] = ((u8) (((input) >> 8) & 0x00FF));(output) += 4 /*------------------------------------------------------------------*/ /* Misc */ diff --git a/drivers/staging/csr/csr_msgconv.c b/drivers/staging/csr/csr_msgconv.c index 9f1c946..3f57b04 100644 --- a/drivers/staging/csr/csr_msgconv.c +++ b/drivers/staging/csr/csr_msgconv.c @@ -73,10 +73,10 @@ static const CsrMsgConvMsgEntry *find_msg_converter(CsrMsgConvPrimEntry *ptr, Cs static void *deserialize_data(CsrUint16 primType, CsrSize length, - CsrUint8 *data) + u8 *data) { CsrMsgConvPrimEntry *ptr; - CsrUint8 *ret; + u8 *ret; ptr = CsrMsgConvFind(primType); @@ -133,7 +133,7 @@ static CsrSize sizeof_message(CsrUint16 primType, void *msg) return ret; } -static CsrBool free_message(CsrUint16 primType, CsrUint8 *data) +static CsrBool free_message(CsrUint16 primType, u8 *data) { CsrMsgConvPrimEntry *ptr; CsrBool ret; @@ -164,13 +164,13 @@ static CsrBool free_message(CsrUint16 primType, CsrUint8 *data) return ret; } -static CsrUint8 *serialize_message(CsrUint16 primType, +static u8 *serialize_message(CsrUint16 primType, void *msg, CsrSize *length, - CsrUint8 *buffer) + u8 *buffer) { CsrMsgConvPrimEntry *ptr; - CsrUint8 *ret; + u8 *ret; ptr = CsrMsgConvFind(primType); @@ -203,13 +203,13 @@ CsrSize CsrMsgConvSizeof(CsrUint16 primType, void *msg) return sizeof_message(primType, msg); } -CsrUint8 *CsrMsgConvSerialize(CsrUint8 *buffer, CsrSize maxBufferOffset, CsrSize *offset, CsrUint16 primType, void *msg) +u8 *CsrMsgConvSerialize(u8 *buffer, CsrSize maxBufferOffset, CsrSize *offset, CsrUint16 primType, void *msg) { if (converter) { CsrSize serializedLength; - CsrUint8 *bufSerialized; - CsrUint8 *bufOffset = &buffer[*offset]; + u8 *bufSerialized; + u8 *bufOffset = &buffer[*offset]; bufSerialized = converter->serialize_message(primType, msg, &serializedLength, bufOffset); *offset += serializedLength; return bufSerialized; diff --git a/drivers/staging/csr/csr_msgconv.h b/drivers/staging/csr/csr_msgconv.h index 2875c8c..dd4853d 100644 --- a/drivers/staging/csr/csr_msgconv.h +++ b/drivers/staging/csr/csr_msgconv.h @@ -21,9 +21,9 @@ extern "C" { #endif typedef CsrSize (CsrMsgSizeofFunc)(void *msg); -typedef CsrUint8 *(CsrMsgSerializeFunc)(CsrUint8 *buffer, CsrSize *length, void *msg); +typedef u8 *(CsrMsgSerializeFunc)(u8 *buffer, CsrSize *length, void *msg); typedef void (CsrMsgFreeFunc)(void *msg); -typedef void *(CsrMsgDeserializeFunc)(CsrUint8 *buffer, CsrSize length); +typedef void *(CsrMsgDeserializeFunc)(u8 *buffer, CsrSize length); /* Converter entry for one message type */ typedef struct CsrMsgConvMsgEntry @@ -50,16 +50,16 @@ typedef struct CsrMsgConvPrimEntry typedef struct { CsrMsgConvPrimEntry *profile_converters; - void *(*deserialize_data)(CsrUint16 primType, CsrSize length, CsrUint8 * data); - CsrBool (*free_message)(CsrUint16 primType, CsrUint8 *data); + void *(*deserialize_data)(CsrUint16 primType, CsrSize length, u8 * data); + CsrBool (*free_message)(CsrUint16 primType, u8 *data); CsrSize (*sizeof_message)(CsrUint16 primType, void *msg); - CsrUint8 *(*serialize_message)(CsrUint16 primType, void *msg, + u8 *(*serialize_message)(CsrUint16 primType, void *msg, CsrSize * length, - CsrUint8 * buffer); + u8 * buffer); } CsrMsgConvEntry; CsrSize CsrMsgConvSizeof(CsrUint16 primType, void *msg); -CsrUint8 *CsrMsgConvSerialize(CsrUint8 *buffer, CsrSize maxBufferOffset, CsrSize *offset, CsrUint16 primType, void *msg); +u8 *CsrMsgConvSerialize(u8 *buffer, CsrSize maxBufferOffset, CsrSize *offset, CsrUint16 primType, void *msg); void CsrMsgConvCustomLookupRegister(CsrUint16 primType, CsrMsgCustomLookupFunc *lookupFunc); void CsrMsgConvInsert(CsrUint16 primType, const CsrMsgConvMsgEntry *ce); CsrMsgConvPrimEntry *CsrMsgConvFind(CsrUint16 primType); @@ -78,65 +78,65 @@ CsrUint32 CsrUtf8StringSerLen(const CsrUtf8String *str); CsrUint32 CsrUtf16StringSerLen(const CsrUtf16String *str); /* Prototypes for primitive type serializers */ -void CsrUint8Ser(CsrUint8 *buffer, CsrSize *offset, CsrUint8 value); -void CsrUint16Ser(CsrUint8 *buffer, CsrSize *offset, CsrUint16 value); -void CsrUint32Ser(CsrUint8 *buffer, CsrSize *offset, CsrUint32 value); -void CsrMemCpySer(CsrUint8 *buffer, CsrSize *offset, const void *value, CsrSize length); -void CsrCharStringSer(CsrUint8 *buffer, CsrSize *offset, const CsrCharString *value); -void CsrUtf8StringSer(CsrUint8 *buffer, CsrSize *offset, const CsrUtf8String *value); -void CsrUtf16StringSer(CsrUint8 *buffer, CsrSize *offset, const CsrUtf16String *value); -void CsrVoidPtrSer(CsrUint8 *buffer, CsrSize *offset, void *ptr); -void CsrSizeSer(CsrUint8 *buffer, CsrSize *offset, CsrSize value); - -void CsrUint8Des(CsrUint8 *value, CsrUint8 *buffer, CsrSize *offset); -void CsrUint16Des(CsrUint16 *value, CsrUint8 *buffer, CsrSize *offset); -void CsrUint32Des(CsrUint32 *value, CsrUint8 *buffer, CsrSize *offset); -void CsrMemCpyDes(void *value, CsrUint8 *buffer, CsrSize *offset, CsrSize length); -void CsrCharStringDes(CsrCharString **value, CsrUint8 *buffer, CsrSize *offset); -void CsrUtf8StringDes(CsrUtf8String **value, CsrUint8 *buffer, CsrSize *offset); -void CsrUtf16StringDes(CsrUtf16String **value, CsrUint8 *buffer, CsrSize *offset); -void CsrVoidPtrDes(void **value, CsrUint8 *buffer, CsrSize *offset); -void CsrSizeDes(CsrSize *value, CsrUint8 *buffer, CsrSize *offset); +void CsrUint8Ser(u8 *buffer, CsrSize *offset, u8 value); +void CsrUint16Ser(u8 *buffer, CsrSize *offset, CsrUint16 value); +void CsrUint32Ser(u8 *buffer, CsrSize *offset, CsrUint32 value); +void CsrMemCpySer(u8 *buffer, CsrSize *offset, const void *value, CsrSize length); +void CsrCharStringSer(u8 *buffer, CsrSize *offset, const CsrCharString *value); +void CsrUtf8StringSer(u8 *buffer, CsrSize *offset, const CsrUtf8String *value); +void CsrUtf16StringSer(u8 *buffer, CsrSize *offset, const CsrUtf16String *value); +void CsrVoidPtrSer(u8 *buffer, CsrSize *offset, void *ptr); +void CsrSizeSer(u8 *buffer, CsrSize *offset, CsrSize value); + +void CsrUint8Des(u8 *value, u8 *buffer, CsrSize *offset); +void CsrUint16Des(CsrUint16 *value, u8 *buffer, CsrSize *offset); +void CsrUint32Des(CsrUint32 *value, u8 *buffer, CsrSize *offset); +void CsrMemCpyDes(void *value, u8 *buffer, CsrSize *offset, CsrSize length); +void CsrCharStringDes(CsrCharString **value, u8 *buffer, CsrSize *offset); +void CsrUtf8StringDes(CsrUtf8String **value, u8 *buffer, CsrSize *offset); +void CsrUtf16StringDes(CsrUtf16String **value, u8 *buffer, CsrSize *offset); +void CsrVoidPtrDes(void **value, u8 *buffer, CsrSize *offset); +void CsrSizeDes(CsrSize *value, u8 *buffer, CsrSize *offset); CsrSize CsrEventSizeof(void *msg); -CsrUint8 *CsrEventSer(CsrUint8 *ptr, CsrSize *len, void *msg); -void *CsrEventDes(CsrUint8 *buffer, CsrSize length); +u8 *CsrEventSer(u8 *ptr, CsrSize *len, void *msg); +void *CsrEventDes(u8 *buffer, CsrSize length); CsrSize CsrEventCsrUint8Sizeof(void *msg); -CsrUint8 *CsrEventCsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg); -void *CsrEventCsrUint8Des(CsrUint8 *buffer, CsrSize length); +u8 *CsrEventCsrUint8Ser(u8 *ptr, CsrSize *len, void *msg); +void *CsrEventCsrUint8Des(u8 *buffer, CsrSize length); CsrSize CsrEventCsrUint16Sizeof(void *msg); -CsrUint8 *CsrEventCsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg); -void *CsrEventCsrUint16Des(CsrUint8 *buffer, CsrSize length); +u8 *CsrEventCsrUint16Ser(u8 *ptr, CsrSize *len, void *msg); +void *CsrEventCsrUint16Des(u8 *buffer, CsrSize length); CsrSize CsrEventCsrUint32Sizeof(void *msg); -CsrUint8 *CsrEventCsrUint32Ser(CsrUint8 *ptr, CsrSize *len, void *msg); -void *CsrEventCsrUint32Des(CsrUint8 *buffer, CsrSize length); +u8 *CsrEventCsrUint32Ser(u8 *ptr, CsrSize *len, void *msg); +void *CsrEventCsrUint32Des(u8 *buffer, CsrSize length); CsrSize CsrEventCsrUint16CsrUint8Sizeof(void *msg); -CsrUint8 *CsrEventCsrUint16CsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg); -void *CsrEventCsrUint16CsrUint8Des(CsrUint8 *buffer, CsrSize length); +u8 *CsrEventCsrUint16CsrUint8Ser(u8 *ptr, CsrSize *len, void *msg); +void *CsrEventCsrUint16CsrUint8Des(u8 *buffer, CsrSize length); CsrSize CsrEventCsrUint16CsrUint16Sizeof(void *msg); -CsrUint8 *CsrEventCsrUint16CsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg); -void *CsrEventCsrUint16CsrUint16Des(CsrUint8 *buffer, CsrSize length); +u8 *CsrEventCsrUint16CsrUint16Ser(u8 *ptr, CsrSize *len, void *msg); +void *CsrEventCsrUint16CsrUint16Des(u8 *buffer, CsrSize length); CsrSize CsrEventCsrUint16CsrUint32Sizeof(void *msg); -CsrUint8 *CsrEventCsrUint16CsrUint32Ser(CsrUint8 *ptr, CsrSize *len, void *msg); -void *CsrEventCsrUint16CsrUint32Des(CsrUint8 *buffer, CsrSize length); +u8 *CsrEventCsrUint16CsrUint32Ser(u8 *ptr, CsrSize *len, void *msg); +void *CsrEventCsrUint16CsrUint32Des(u8 *buffer, CsrSize length); CsrSize CsrEventCsrUint16CsrCharStringSizeof(void *msg); -CsrUint8 *CsrEventCsrUint16CsrCharStringSer(CsrUint8 *ptr, CsrSize *len, void *msg); -void *CsrEventCsrUint16CsrCharStringDes(CsrUint8 *buffer, CsrSize length); +u8 *CsrEventCsrUint16CsrCharStringSer(u8 *ptr, CsrSize *len, void *msg); +void *CsrEventCsrUint16CsrCharStringDes(u8 *buffer, CsrSize length); CsrSize CsrEventCsrUint32CsrUint16Sizeof(void *msg); -CsrUint8 *CsrEventCsrUint32CsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg); -void *CsrEventCsrUint32CsrUint16Des(CsrUint8 *buffer, CsrSize length); +u8 *CsrEventCsrUint32CsrUint16Ser(u8 *ptr, CsrSize *len, void *msg); +void *CsrEventCsrUint32CsrUint16Des(u8 *buffer, CsrSize length); CsrSize CsrEventCsrUint32CsrCharStringSizeof(void *msg); -CsrUint8 *CsrEventCsrUint32CsrCharStringSer(CsrUint8 *ptr, CsrSize *len, void *msg); -void *CsrEventCsrUint32CsrCharStringDes(CsrUint8 *buffer, CsrSize length); +u8 *CsrEventCsrUint32CsrCharStringSer(u8 *ptr, CsrSize *len, void *msg); +void *CsrEventCsrUint32CsrCharStringDes(u8 *buffer, CsrSize length); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_panic.c b/drivers/staging/csr/csr_panic.c index 2564e80..87c72ad 100644 --- a/drivers/staging/csr/csr_panic.c +++ b/drivers/staging/csr/csr_panic.c @@ -15,7 +15,7 @@ #include "csr_types.h" #include "csr_panic.h" -void CsrPanic(CsrUint8 tech, CsrUint16 reason, const char *p) +void CsrPanic(u8 tech, CsrUint16 reason, const char *p) { BUG_ON(1); } diff --git a/drivers/staging/csr/csr_panic.h b/drivers/staging/csr/csr_panic.h index 6e33f93..2b71668 100644 --- a/drivers/staging/csr/csr_panic.h +++ b/drivers/staging/csr/csr_panic.h @@ -46,7 +46,7 @@ extern "C" { /* Panic interface used by technologies */ /* DEPRECATED - replaced by csr_log_text.h */ -void CsrPanic(CsrUint8 tech, CsrUint16 reason, const char *p); +void CsrPanic(u8 tech, CsrUint16 reason, const char *p); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_pmem.h b/drivers/staging/csr/csr_pmem.h index f1e59ef..4007915 100644 --- a/drivers/staging/csr/csr_pmem.h +++ b/drivers/staging/csr/csr_pmem.h @@ -102,7 +102,7 @@ void CsrPmemFree(void *ptr); *----------------------------------------------------------------------------*/ #ifdef CSR_PMEM_DEBUG_ENABLE -typedef CsrUint8 CsrPmemDebugAllocType; +typedef u8 CsrPmemDebugAllocType; #define CSR_PMEM_DEBUG_TYPE_PMEM_ALLOC 1 #define CSR_PMEM_DEBUG_TYPE_MEM_ALLOC 2 #define CSR_PMEM_DEBUG_TYPE_MEM_CALLOC 3 @@ -125,7 +125,7 @@ typedef void (CsrPmemDebugOnFree)(void *ptr, void *userptr, CsrPmemDebugAllocTyp * void * *----------------------------------------------------------------------------*/ -void CsrPmemDebugInstallHooks(CsrUint8 headSize, CsrUint8 endSize, CsrPmemDebugOnAlloc *onAllocCallback, CsrPmemDebugOnFree *onFreeCallback); +void CsrPmemDebugInstallHooks(u8 headSize, u8 endSize, CsrPmemDebugOnAlloc *onAllocCallback, CsrPmemDebugOnFree *onFreeCallback); void *CsrPmemDebugAlloc(CsrSize size, CsrPmemDebugAllocType type, const CsrCharString* file, CsrUint32 line); #define CsrPmemAlloc(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_PMEM_ALLOC, __FILE__, __LINE__) diff --git a/drivers/staging/csr/csr_sdio.h b/drivers/staging/csr/csr_sdio.h index d60ef45..2ce4f16 100644 --- a/drivers/staging/csr/csr_sdio.h +++ b/drivers/staging/csr/csr_sdio.h @@ -54,8 +54,8 @@ typedef struct { CsrUint16 manfId; /* Vendor ID to match or CSR_SDIO_ANY_MANF_ID */ CsrUint16 cardId; /* Device ID to match or CSR_SDIO_ANY_CARD_ID */ - CsrUint8 sdioFunction; /* SDIO Function number to match or CSR_SDIO_ANY_SDIO_FUNCTION */ - CsrUint8 sdioInterface; /* SDIO Standard Interface Code to match or CSR_SDIO_ANY_SDIO_INTERFACE */ + u8 sdioFunction; /* SDIO Function number to match or CSR_SDIO_ANY_SDIO_FUNCTION */ + u8 sdioInterface; /* SDIO Standard Interface Code to match or CSR_SDIO_ANY_SDIO_INTERFACE */ } CsrSdioFunctionId; /*----------------------------------------------------------------------------* @@ -204,7 +204,7 @@ typedef struct CsrSdioSuspendCallback suspend; CsrSdioResumeCallback resume; CsrSdioFunctionId *ids; - CsrUint8 idsCount; + u8 idsCount; void *priv; /* For use by the SDIO Driver */ } CsrSdioFunctionDriver; @@ -519,10 +519,10 @@ CsrResult CsrSdioMaxBusClockFrequencySet(CsrSdioFunction *function, CsrUint32 ma * the callback function. * *----------------------------------------------------------------------------*/ -CsrResult CsrSdioRead8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data); -CsrResult CsrSdioWrite8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data); -void CsrSdioRead8Async(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data, CsrSdioAsyncCallback callback); -void CsrSdioWrite8Async(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data, CsrSdioAsyncCallback callback); +CsrResult CsrSdioRead8(CsrSdioFunction *function, CsrUint32 address, u8 *data); +CsrResult CsrSdioWrite8(CsrSdioFunction *function, CsrUint32 address, u8 data); +void CsrSdioRead8Async(CsrSdioFunction *function, CsrUint32 address, u8 *data, CsrSdioAsyncCallback callback); +void CsrSdioWrite8Async(CsrSdioFunction *function, CsrUint32 address, u8 data, CsrSdioAsyncCallback callback); /*----------------------------------------------------------------------------* * NAME @@ -608,10 +608,10 @@ void CsrSdioWrite16Async(CsrSdioFunction *function, CsrUint32 address, CsrUint16 * the callback function. * *----------------------------------------------------------------------------*/ -CsrResult CsrSdioF0Read8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data); -CsrResult CsrSdioF0Write8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data); -void CsrSdioF0Read8Async(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data, CsrSdioAsyncCallback callback); -void CsrSdioF0Write8Async(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data, CsrSdioAsyncCallback callback); +CsrResult CsrSdioF0Read8(CsrSdioFunction *function, CsrUint32 address, u8 *data); +CsrResult CsrSdioF0Write8(CsrSdioFunction *function, CsrUint32 address, u8 data); +void CsrSdioF0Read8Async(CsrSdioFunction *function, CsrUint32 address, u8 *data, CsrSdioAsyncCallback callback); +void CsrSdioF0Write8Async(CsrSdioFunction *function, CsrUint32 address, u8 data, CsrSdioAsyncCallback callback); /*----------------------------------------------------------------------------* * NAME diff --git a/drivers/staging/csr/csr_serialize_primitive_types.c b/drivers/staging/csr/csr_serialize_primitive_types.c index 5ea06fc..41bd4be 100644 --- a/drivers/staging/csr/csr_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_serialize_primitive_types.c @@ -16,14 +16,14 @@ #include "csr_pmem.h" #include "csr_lib.h" -void CsrUint8Des(CsrUint8 *value, CsrUint8 *buffer, CsrSize *offset) +void CsrUint8Des(u8 *value, u8 *buffer, CsrSize *offset) { *value = buffer[*offset]; *offset += sizeof(*value); } EXPORT_SYMBOL_GPL(CsrUint8Des); -void CsrUint16Des(CsrUint16 *value, CsrUint8 *buffer, CsrSize *offset) +void CsrUint16Des(CsrUint16 *value, u8 *buffer, CsrSize *offset) { *value = (buffer[*offset + 0] << 0) | (buffer[*offset + 1] << 8); @@ -31,7 +31,7 @@ void CsrUint16Des(CsrUint16 *value, CsrUint8 *buffer, CsrSize *offset) } EXPORT_SYMBOL_GPL(CsrUint16Des); -void CsrUint32Des(CsrUint32 *value, CsrUint8 *buffer, CsrSize *offset) +void CsrUint32Des(CsrUint32 *value, u8 *buffer, CsrSize *offset) { *value = (buffer[*offset + 0] << 0) | (buffer[*offset + 1] << 8) | @@ -41,27 +41,27 @@ void CsrUint32Des(CsrUint32 *value, CsrUint8 *buffer, CsrSize *offset) } EXPORT_SYMBOL_GPL(CsrUint32Des); -void CsrMemCpyDes(void *value, CsrUint8 *buffer, CsrSize *offset, CsrSize length) +void CsrMemCpyDes(void *value, u8 *buffer, CsrSize *offset, CsrSize length) { CsrMemCpy(value, &buffer[*offset], length); *offset += length; } EXPORT_SYMBOL_GPL(CsrMemCpyDes); -void CsrCharStringDes(CsrCharString **value, CsrUint8 *buffer, CsrSize *offset) +void CsrCharStringDes(CsrCharString **value, u8 *buffer, CsrSize *offset) { *value = CsrStrDup((CsrCharString *) &buffer[*offset]); *offset += CsrStrLen(*value) + 1; } EXPORT_SYMBOL_GPL(CsrCharStringDes); -void CsrUtf8StringDes(CsrUtf8String **value, CsrUint8 *buffer, CsrSize *offset) +void CsrUtf8StringDes(CsrUtf8String **value, u8 *buffer, CsrSize *offset) { *value = (CsrUtf8String *) CsrStrDup((CsrCharString *) &buffer[*offset]); *offset += CsrStrLen((CsrCharString *) *value) + 1; } -void CsrUtf16StringDes(CsrUtf16String **value, CsrUint8 *buffer, CsrSize *offset) +void CsrUtf16StringDes(CsrUtf16String **value, u8 *buffer, CsrSize *offset) { CsrUint32 length, i; @@ -74,7 +74,7 @@ void CsrUtf16StringDes(CsrUtf16String **value, CsrUint8 *buffer, CsrSize *offset } } -void CsrSizeDes(CsrSize *value, CsrUint8 *buffer, CsrSize *offset) +void CsrSizeDes(CsrSize *value, u8 *buffer, CsrSize *offset) { *value = (buffer[*offset + 0] << 0) | (buffer[*offset + 1] << 8) | @@ -83,44 +83,44 @@ void CsrSizeDes(CsrSize *value, CsrUint8 *buffer, CsrSize *offset) *offset += sizeof(*value); } -void CsrVoidPtrDes(void **value, CsrUint8 *buffer, CsrSize *offset) +void CsrVoidPtrDes(void **value, u8 *buffer, CsrSize *offset) { CsrSizeDes((CsrSize *) value, buffer, offset); } -void CsrUint8Ser(CsrUint8 *buffer, CsrSize *offset, CsrUint8 value) +void CsrUint8Ser(u8 *buffer, CsrSize *offset, u8 value) { buffer[*offset] = value; *offset += sizeof(value); } EXPORT_SYMBOL_GPL(CsrUint8Ser); -void CsrUint16Ser(CsrUint8 *buffer, CsrSize *offset, CsrUint16 value) +void CsrUint16Ser(u8 *buffer, CsrSize *offset, CsrUint16 value) { - buffer[*offset + 0] = (CsrUint8) ((value >> 0) & 0xFF); - buffer[*offset + 1] = (CsrUint8) ((value >> 8) & 0xFF); + buffer[*offset + 0] = (u8) ((value >> 0) & 0xFF); + buffer[*offset + 1] = (u8) ((value >> 8) & 0xFF); *offset += sizeof(value); } EXPORT_SYMBOL_GPL(CsrUint16Ser); -void CsrUint32Ser(CsrUint8 *buffer, CsrSize *offset, CsrUint32 value) +void CsrUint32Ser(u8 *buffer, CsrSize *offset, CsrUint32 value) { - buffer[*offset + 0] = (CsrUint8) ((value >> 0) & 0xFF); - buffer[*offset + 1] = (CsrUint8) ((value >> 8) & 0xFF); - buffer[*offset + 2] = (CsrUint8) ((value >> 16) & 0xFF); - buffer[*offset + 3] = (CsrUint8) ((value >> 24) & 0xFF); + buffer[*offset + 0] = (u8) ((value >> 0) & 0xFF); + buffer[*offset + 1] = (u8) ((value >> 8) & 0xFF); + buffer[*offset + 2] = (u8) ((value >> 16) & 0xFF); + buffer[*offset + 3] = (u8) ((value >> 24) & 0xFF); *offset += sizeof(value); } EXPORT_SYMBOL_GPL(CsrUint32Ser); -void CsrMemCpySer(CsrUint8 *buffer, CsrSize *offset, const void *value, CsrSize length) +void CsrMemCpySer(u8 *buffer, CsrSize *offset, const void *value, CsrSize length) { CsrMemCpy(&buffer[*offset], value, length); *offset += length; } EXPORT_SYMBOL_GPL(CsrMemCpySer); -void CsrCharStringSer(CsrUint8 *buffer, CsrSize *offset, const CsrCharString *value) +void CsrCharStringSer(u8 *buffer, CsrSize *offset, const CsrCharString *value) { if (value) { @@ -134,12 +134,12 @@ void CsrCharStringSer(CsrUint8 *buffer, CsrSize *offset, const CsrCharString *va } EXPORT_SYMBOL_GPL(CsrCharStringSer); -void CsrUtf8StringSer(CsrUint8 *buffer, CsrSize *offset, const CsrUtf8String *value) +void CsrUtf8StringSer(u8 *buffer, CsrSize *offset, const CsrUtf8String *value) { CsrCharStringSer(buffer, offset, (CsrCharString *) value); } -void CsrUtf16StringSer(CsrUint8 *buffer, CsrSize *offset, const CsrUtf16String *value) +void CsrUtf16StringSer(u8 *buffer, CsrSize *offset, const CsrUtf16String *value) { if (value) { @@ -159,16 +159,16 @@ void CsrUtf16StringSer(CsrUint8 *buffer, CsrSize *offset, const CsrUtf16String * } } -void CsrSizeSer(CsrUint8 *buffer, CsrSize *offset, CsrSize value) +void CsrSizeSer(u8 *buffer, CsrSize *offset, CsrSize value) { - buffer[*offset + 0] = (CsrUint8) ((value >> 0) & 0xFF); - buffer[*offset + 1] = (CsrUint8) ((value >> 8) & 0xFF); - buffer[*offset + 2] = (CsrUint8) ((value >> 16) & 0xFF); - buffer[*offset + 3] = (CsrUint8) ((value >> 24) & 0xFF); + buffer[*offset + 0] = (u8) ((value >> 0) & 0xFF); + buffer[*offset + 1] = (u8) ((value >> 8) & 0xFF); + buffer[*offset + 2] = (u8) ((value >> 16) & 0xFF); + buffer[*offset + 3] = (u8) ((value >> 24) & 0xFF); *offset += sizeof(value); } -void CsrVoidPtrSer(CsrUint8 *buffer, CsrSize *offset, void *ptr) +void CsrVoidPtrSer(u8 *buffer, CsrSize *offset, void *ptr) { CsrSizeSer(buffer, offset, (CsrSize) ptr); } @@ -215,7 +215,7 @@ CsrSize CsrEventSizeof(void *msg) return 2; } -CsrUint8 *CsrEventSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8 *CsrEventSer(u8 *ptr, CsrSize *len, void *msg) { CsrEvent *primitive = (CsrEvent *) msg; *len = 0; @@ -223,7 +223,7 @@ CsrUint8 *CsrEventSer(CsrUint8 *ptr, CsrSize *len, void *msg) return ptr; } -void *CsrEventDes(CsrUint8 *buffer, CsrSize length) +void *CsrEventDes(u8 *buffer, CsrSize length) { CsrEvent *primitive = (CsrEvent *) CsrPmemAlloc(sizeof(CsrEvent)); CsrSize offset = 0; @@ -237,7 +237,7 @@ CsrSize CsrEventCsrUint8Sizeof(void *msg) return 3; } -CsrUint8 *CsrEventCsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg) +u8 *CsrEventCsrUint8Ser(u8 *ptr, CsrSize *len, void *msg) { CsrEventCsrUint8 *primitive = (CsrEventCsrUint8 *) msg; *len = 0; @@ -246,7 +246,7 @@ CsrUint8 *CsrEventCsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg) return ptr; } -void *CsrEventCsrUint8Des(CsrUint8 *buffer, CsrSize length) +void *CsrEventCsrUint8Des(u8 *buffer, CsrSize length) { CsrEventCsrUint8 *primitive = (CsrEventCsrUint8 *) CsrPmemAlloc(sizeof(CsrEventCsrUint8)); @@ -262,7 +262,7 @@ CsrSize CsrEventCsrUint16Sizeof(void *msg) return 4; } -CsrUint8 *CsrEventCsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg) +u8 *CsrEventCsrUint16Ser(u8 *ptr, CsrSize *len, void *msg) { CsrEventCsrUint16 *primitive = (CsrEventCsrUint16 *) msg; *len = 0; @@ -271,7 +271,7 @@ CsrUint8 *CsrEventCsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg) return ptr; } -void *CsrEventCsrUint16Des(CsrUint8 *buffer, CsrSize length) +void *CsrEventCsrUint16Des(u8 *buffer, CsrSize length) { CsrEventCsrUint16 *primitive = (CsrEventCsrUint16 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16)); @@ -287,7 +287,7 @@ CsrSize CsrEventCsrUint32Sizeof(void *msg) return 6; } -CsrUint8 *CsrEventCsrUint32Ser(CsrUint8 *ptr, CsrSize *len, void *msg) +u8 *CsrEventCsrUint32Ser(u8 *ptr, CsrSize *len, void *msg) { CsrEventCsrUint32 *primitive = (CsrEventCsrUint32 *) msg; *len = 0; @@ -296,7 +296,7 @@ CsrUint8 *CsrEventCsrUint32Ser(CsrUint8 *ptr, CsrSize *len, void *msg) return ptr; } -void *CsrEventCsrUint32Des(CsrUint8 *buffer, CsrSize length) +void *CsrEventCsrUint32Des(u8 *buffer, CsrSize length) { CsrEventCsrUint32 *primitive = (CsrEventCsrUint32 *) CsrPmemAlloc(sizeof(CsrEventCsrUint32)); @@ -312,7 +312,7 @@ CsrSize CsrEventCsrUint16CsrUint8Sizeof(void *msg) return 5; } -CsrUint8 *CsrEventCsrUint16CsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg) +u8 *CsrEventCsrUint16CsrUint8Ser(u8 *ptr, CsrSize *len, void *msg) { CsrEventCsrUint16CsrUint8 *primitive = (CsrEventCsrUint16CsrUint8 *) msg; *len = 0; @@ -322,7 +322,7 @@ CsrUint8 *CsrEventCsrUint16CsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg) return ptr; } -void *CsrEventCsrUint16CsrUint8Des(CsrUint8 *buffer, CsrSize length) +void *CsrEventCsrUint16CsrUint8Des(u8 *buffer, CsrSize length) { CsrEventCsrUint16CsrUint8 *primitive = (CsrEventCsrUint16CsrUint8 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrUint8)); @@ -339,7 +339,7 @@ CsrSize CsrEventCsrUint16CsrUint16Sizeof(void *msg) return 6; } -CsrUint8 *CsrEventCsrUint16CsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg) +u8 *CsrEventCsrUint16CsrUint16Ser(u8 *ptr, CsrSize *len, void *msg) { CsrEventCsrUint16CsrUint16 *primitive = (CsrEventCsrUint16CsrUint16 *) msg; *len = 0; @@ -349,7 +349,7 @@ CsrUint8 *CsrEventCsrUint16CsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg) return ptr; } -void *CsrEventCsrUint16CsrUint16Des(CsrUint8 *buffer, CsrSize length) +void *CsrEventCsrUint16CsrUint16Des(u8 *buffer, CsrSize length) { CsrEventCsrUint16CsrUint16 *primitive = (CsrEventCsrUint16CsrUint16 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrUint16)); @@ -366,7 +366,7 @@ CsrSize CsrEventCsrUint16CsrUint32Sizeof(void *msg) return 8; } -CsrUint8 *CsrEventCsrUint16CsrUint32Ser(CsrUint8 *ptr, CsrSize *len, void *msg) +u8 *CsrEventCsrUint16CsrUint32Ser(u8 *ptr, CsrSize *len, void *msg) { CsrEventCsrUint16CsrUint32 *primitive = (CsrEventCsrUint16CsrUint32 *) msg; *len = 0; @@ -376,7 +376,7 @@ CsrUint8 *CsrEventCsrUint16CsrUint32Ser(CsrUint8 *ptr, CsrSize *len, void *msg) return ptr; } -void *CsrEventCsrUint16CsrUint32Des(CsrUint8 *buffer, CsrSize length) +void *CsrEventCsrUint16CsrUint32Des(u8 *buffer, CsrSize length) { CsrEventCsrUint16CsrUint32 *primitive = (CsrEventCsrUint16CsrUint32 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrUint32)); @@ -394,7 +394,7 @@ CsrSize CsrEventCsrUint16CsrCharStringSizeof(void *msg) return 4 + CsrStrLen(primitive->value2) + 1; } -CsrUint8 *CsrEventCsrUint16CsrCharStringSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8 *CsrEventCsrUint16CsrCharStringSer(u8 *ptr, CsrSize *len, void *msg) { CsrEventCsrUint16CsrCharString *primitive = (CsrEventCsrUint16CsrCharString *) msg; *len = 0; @@ -404,7 +404,7 @@ CsrUint8 *CsrEventCsrUint16CsrCharStringSer(CsrUint8 *ptr, CsrSize *len, void *m return ptr; } -void *CsrEventCsrUint16CsrCharStringDes(CsrUint8 *buffer, CsrSize length) +void *CsrEventCsrUint16CsrCharStringDes(u8 *buffer, CsrSize length) { CsrEventCsrUint16CsrCharString *primitive = (CsrEventCsrUint16CsrCharString *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrCharString)); @@ -421,7 +421,7 @@ CsrSize CsrEventCsrUint32CsrUint16Sizeof(void *msg) return 8; } -CsrUint8 *CsrEventCsrUint32CsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg) +u8 *CsrEventCsrUint32CsrUint16Ser(u8 *ptr, CsrSize *len, void *msg) { CsrEventCsrUint32CsrUint16 *primitive = (CsrEventCsrUint32CsrUint16 *) msg; *len = 0; @@ -431,7 +431,7 @@ CsrUint8 *CsrEventCsrUint32CsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg) return ptr; } -void *CsrEventCsrUint32CsrUint16Des(CsrUint8 *buffer, CsrSize length) +void *CsrEventCsrUint32CsrUint16Des(u8 *buffer, CsrSize length) { CsrEventCsrUint32CsrUint16 *primitive = (CsrEventCsrUint32CsrUint16 *) CsrPmemAlloc(sizeof(CsrEventCsrUint32CsrUint16)); @@ -449,7 +449,7 @@ CsrSize CsrEventCsrUint32CsrCharStringSizeof(void *msg) return 6 + CsrStrLen(primitive->value2) + 1; } -CsrUint8 *CsrEventCsrUint32CsrCharStringSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8 *CsrEventCsrUint32CsrCharStringSer(u8 *ptr, CsrSize *len, void *msg) { CsrEventCsrUint32CsrCharString *primitive = (CsrEventCsrUint32CsrCharString *) msg; *len = 0; @@ -459,7 +459,7 @@ CsrUint8 *CsrEventCsrUint32CsrCharStringSer(CsrUint8 *ptr, CsrSize *len, void *m return ptr; } -void *CsrEventCsrUint32CsrCharStringDes(CsrUint8 *buffer, CsrSize length) +void *CsrEventCsrUint32CsrCharStringDes(u8 *buffer, CsrSize length) { CsrEventCsrUint32CsrCharString *primitive = (CsrEventCsrUint32CsrCharString *) CsrPmemAlloc(sizeof(CsrEventCsrUint32CsrCharString)); diff --git a/drivers/staging/csr/csr_types.h b/drivers/staging/csr/csr_types.h index e736a78..683e077 100644 --- a/drivers/staging/csr/csr_types.h +++ b/drivers/staging/csr/csr_types.h @@ -33,7 +33,6 @@ typedef uintptr_t CsrUintptr; /* Unsigned integer large enough to hold any poi typedef ptrdiff_t CsrIntptr; /* intptr_t is not defined in kernel. Use the equivalent ptrdiff_t. */ /* Unsigned fixed width types */ -typedef uint8_t CsrUint8; typedef uint16_t CsrUint16; typedef uint32_t CsrUint32; @@ -43,11 +42,11 @@ typedef int16_t CsrInt16; typedef int32_t CsrInt32; /* Boolean */ -typedef CsrUint8 CsrBool; +typedef u8 CsrBool; /* String types */ typedef char CsrCharString; -typedef CsrUint8 CsrUtf8String; +typedef u8 CsrUtf8String; typedef CsrUint16 CsrUtf16String; /* 16-bit UTF16 strings */ typedef CsrUint32 CsrUint24; diff --git a/drivers/staging/csr/csr_unicode.h b/drivers/staging/csr/csr_unicode.h index 9faf856..3d86de4 100644 --- a/drivers/staging/csr/csr_unicode.h +++ b/drivers/staging/csr/csr_unicode.h @@ -172,16 +172,16 @@ CsrUtf8String *CsrUtf8StringConcatenateTexts(const CsrUtf8String *inputText1, co * * D-13157 */ -typedef CsrUint8 CsrUcs2String; +typedef u8 CsrUcs2String; CsrSize CsrUcs2ByteStrLen(const CsrUcs2String *ucs2String); CsrSize CsrConverterUcs2ByteStrLen(const CsrUcs2String *str); -CsrUint8 *CsrUcs2ByteString2Utf8(const CsrUcs2String *ucs2String); -CsrUcs2String *CsrUtf82Ucs2ByteString(const CsrUint8 *utf8String); +u8 *CsrUcs2ByteString2Utf8(const CsrUcs2String *ucs2String); +CsrUcs2String *CsrUtf82Ucs2ByteString(const u8 *utf8String); -CsrUint8 *CsrUtf16String2Ucs2ByteString(const CsrUtf16String *source); -CsrUtf16String *CsrUcs2ByteString2Utf16String(const CsrUint8 *source); +u8 *CsrUtf16String2Ucs2ByteString(const CsrUtf16String *source); +CsrUtf16String *CsrUcs2ByteString2Utf16String(const u8 *source); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index 9259635..42fb7b0 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -18,7 +18,7 @@ #define UNI_SUR_LOW_START ((CsrUint32) 0xDC00) #define UNI_SUR_LOW_END ((CsrUint32) 0xDFFF) #define UNI_REPLACEMENT_CHAR ((CsrUint32) 0xFFFD) -#define UNI_HALF_SHIFT ((CsrUint8) 10) /* used for shifting by 10 bits */ +#define UNI_HALF_SHIFT ((u8) 10) /* used for shifting by 10 bits */ #define UNI_HALF_BASE ((CsrUint32) 0x00010000) #define UNI_BYTEMASK ((CsrUint32) 0xBF) #define UNI_BYTEMARK ((CsrUint32) 0x80) @@ -152,7 +152,7 @@ CsrUint32 CsrUtf16StringToUint32(const CsrUtf16String *unicodeString) *********************************************************************************/ CsrUtf16String *CsrUtf16MemCpy(CsrUtf16String *dest, const CsrUtf16String *src, CsrUint32 count) { - return CsrMemCpy((CsrUint8 *) dest, (CsrUint8 *) src, count * sizeof(CsrUtf16String)); + return CsrMemCpy((u8 *) dest, (u8 *) src, count * sizeof(CsrUtf16String)); } /******************************************************************************** @@ -260,10 +260,10 @@ CsrUtf8String *CsrUtf16String2Utf8(const CsrUtf16String *source) CsrUint32 ch; CsrUint32 length; CsrUint32 sourceLength; - CsrUint8 bytes; + u8 bytes; CsrBool appendNull = FALSE; - CsrUint8 firstByteMark[5] = {0x00, 0x00, 0xC0, 0xE0, 0xF0}; + u8 firstByteMark[5] = {0x00, 0x00, 0xC0, 0xE0, 0xF0}; if (!source) { @@ -384,25 +384,25 @@ CsrUtf8String *CsrUtf16String2Utf8(const CsrUtf16String *source) { case 4: { - *--dest = (CsrUint8) ((ch | UNI_BYTEMARK) & UNI_BYTEMASK); + *--dest = (u8) ((ch | UNI_BYTEMARK) & UNI_BYTEMASK); ch >>= 6; } /* FALLTHROUGH */ case 3: { - *--dest = (CsrUint8) ((ch | UNI_BYTEMARK) & UNI_BYTEMASK); + *--dest = (u8) ((ch | UNI_BYTEMARK) & UNI_BYTEMASK); ch >>= 6; } /* FALLTHROUGH */ case 2: { - *--dest = (CsrUint8) ((ch | UNI_BYTEMARK) & UNI_BYTEMASK); + *--dest = (u8) ((ch | UNI_BYTEMARK) & UNI_BYTEMASK); ch >>= 6; } /* FALLTHROUGH */ case 1: { - *--dest = (CsrUint8) (ch | firstByteMark[bytes]); + *--dest = (u8) (ch | firstByteMark[bytes]); } /* FALLTHROUGH */ default: @@ -466,7 +466,7 @@ CsrUtf8String *CsrUtf16String2Utf8(const CsrUtf16String *source) static CsrBool isLegalUtf8(const CsrUtf8String *codeUnit, CsrUint32 length) { const CsrUtf8String *srcPtr = codeUnit + length; - CsrUint8 byte; + u8 byte; switch (length) /* Everything falls through except case 1 */ { diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index ee2d047..83721fe 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -21,9 +21,9 @@ /*------------------------------------------------------------------*/ /* Time proportional with the number of 1's */ -CsrUint8 CsrBitCountSparse(CsrUint32 n) +u8 CsrBitCountSparse(CsrUint32 n) { - CsrUint8 count = 0; + u8 count = 0; while (n) { @@ -35,9 +35,9 @@ CsrUint8 CsrBitCountSparse(CsrUint32 n) } /* Time proportional with the number of 0's */ -CsrUint8 CsrBitCountDense(CsrUint32 n) +u8 CsrBitCountDense(CsrUint32 n) { - CsrUint8 count = 8 * sizeof(CsrUint32); + u8 count = 8 * sizeof(CsrUint32); n ^= (CsrUint32) (-1); @@ -53,7 +53,7 @@ CsrUint8 CsrBitCountDense(CsrUint32 n) /*------------------------------------------------------------------*/ /* Base conversion */ /*------------------------------------------------------------------*/ -CsrBool CsrHexStrToUint8(const CsrCharString *string, CsrUint8 *returnValue) +CsrBool CsrHexStrToUint8(const CsrCharString *string, u8 *returnValue) { CsrUint16 currentIndex = 0; *returnValue = 0; @@ -65,7 +65,7 @@ CsrBool CsrHexStrToUint8(const CsrCharString *string, CsrUint8 *returnValue) { while (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) || ((CSR_TOUPPER(string[currentIndex]) >= 'A') && (CSR_TOUPPER(string[currentIndex]) <= 'F'))) { - *returnValue = (CsrUint8) (*returnValue * 16 + (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) ? string[currentIndex] - '0' : CSR_TOUPPER(string[currentIndex]) - 'A' + 10)); + *returnValue = (u8) (*returnValue * 16 + (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) ? string[currentIndex] - '0' : CSR_TOUPPER(string[currentIndex]) - 'A' + 10)); currentIndex++; if (currentIndex >= 2) { @@ -148,7 +148,7 @@ CsrUint32 CsrPow(CsrUint32 base, CsrUint32 exponent) void CsrIntToBase10(CsrInt32 number, CsrCharString *str) { CsrInt32 digit; - CsrUint8 index; + u8 index; CsrCharString res[I2B10_MAX]; CsrBool foundDigit = FALSE; @@ -228,7 +228,7 @@ void *CsrMemCpy(void *dest, const void *src, CsrSize count) } EXPORT_SYMBOL_GPL(CsrMemCpy); -void *CsrMemSet(void *dest, CsrUint8 c, CsrSize count) +void *CsrMemSet(void *dest, u8 c, CsrSize count) { return memset(dest, c, count); } @@ -423,7 +423,7 @@ const CsrCharString *CsrGetBaseName(const CsrCharString *file) /*------------------------------------------------------------------*/ /* Misc */ /*------------------------------------------------------------------*/ -CsrBool CsrIsSpace(CsrUint8 c) +CsrBool CsrIsSpace(u8 c) { switch (c) { diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index 5cd6cb4..e48dcbb 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -20,13 +20,13 @@ extern "C" { /*------------------------------------------------------------------*/ /* Bits - intended to operate on CsrUint32 values */ /*------------------------------------------------------------------*/ -CsrUint8 CsrBitCountSparse(CsrUint32 n); -CsrUint8 CsrBitCountDense(CsrUint32 n); +u8 CsrBitCountSparse(CsrUint32 n); +u8 CsrBitCountDense(CsrUint32 n); /*------------------------------------------------------------------*/ /* Base conversion */ /*------------------------------------------------------------------*/ -CsrBool CsrHexStrToUint8(const CsrCharString *string, CsrUint8 *returnValue); +CsrBool CsrHexStrToUint8(const CsrCharString *string, u8 *returnValue); CsrBool CsrHexStrToUint16(const CsrCharString *string, CsrUint16 *returnValue); CsrBool CsrHexStrToUint32(const CsrCharString *string, CsrUint32 *returnValue); CsrUint32 CsrPow(CsrUint32 base, CsrUint32 exponent); @@ -63,7 +63,7 @@ CsrInt32 CsrStrCmp(const CsrCharString *string1, const CsrCharString *string2); CsrInt32 CsrStrNCmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count); CsrCharString *CsrStrChr(const CsrCharString *string, CsrCharString c); CsrCharString *CsrStrStr(const CsrCharString *string1, const CsrCharString *string2); -void *CsrMemSet(void *dest, CsrUint8 c, CsrSize count); +void *CsrMemSet(void *dest, u8 c, CsrSize count); CsrSize CsrStrLen(const CsrCharString *string); #endif /* !CSR_USE_STDC_LIB */ CsrInt32 CsrVsnprintf(CsrCharString *string, CsrSize count, const CsrCharString *format, va_list args); @@ -85,7 +85,7 @@ const CsrCharString *CsrGetBaseName(const CsrCharString *file); /*------------------------------------------------------------------*/ /* Misc */ /*------------------------------------------------------------------*/ -CsrBool CsrIsSpace(CsrUint8 c); +CsrBool CsrIsSpace(u8 c); #define CsrOffsetOf(st, m) ((CsrSize) & ((st *) 0)->m) #ifdef __cplusplus diff --git a/drivers/staging/csr/csr_wifi_common.h b/drivers/staging/csr/csr_wifi_common.h index 442dcc6..df04a8b 100644 --- a/drivers/staging/csr/csr_wifi_common.h +++ b/drivers/staging/csr/csr_wifi_common.h @@ -21,25 +21,25 @@ extern "C" { /* MAC address */ typedef struct { - CsrUint8 a[6]; + u8 a[6]; } CsrWifiMacAddress; /* IPv4 address */ typedef struct { - CsrUint8 a[4]; + u8 a[4]; } CsrWifiIp4Address; /* IPv6 address */ typedef struct { - CsrUint8 a[16]; + u8 a[16]; } CsrWifiIp6Address; typedef struct { - CsrUint8 ssid[32]; - CsrUint8 length; + u8 ssid[32]; + u8 length; } CsrWifiSsid; /******************************************************************************* diff --git a/drivers/staging/csr/csr_wifi_fsm_types.h b/drivers/staging/csr/csr_wifi_fsm_types.h index 7c611e3..99e60e8 100644 --- a/drivers/staging/csr/csr_wifi_fsm_types.h +++ b/drivers/staging/csr/csr_wifi_fsm_types.h @@ -219,7 +219,7 @@ typedef struct */ typedef struct { - const CsrUint8 numEntries; + const u8 numEntries; const CsrBool saveAll; const CsrWifiFsmEventEntry *eventEntryArray; /* array of transition function pointers for state */ #ifdef CSR_LOG_ENABLE diff --git a/drivers/staging/csr/csr_wifi_hip_card.h b/drivers/staging/csr/csr_wifi_hip_card.h index 2ab4784..c99a606 100644 --- a/drivers/staging/csr/csr_wifi_hip_card.h +++ b/drivers/staging/csr/csr_wifi_hip_card.h @@ -103,7 +103,7 @@ CsrResult card_wait_for_firmware_to_start(card_t *card, CsrUint32 *paddr); CsrResult unifi_dl_firmware(card_t *card, void *arg); CsrResult unifi_dl_patch(card_t *card, void *arg, CsrUint32 boot_ctrl); -CsrResult unifi_do_loader_op(card_t *card, CsrUint32 op_addr, CsrUint8 opcode); +CsrResult unifi_do_loader_op(card_t *card, CsrUint32 op_addr, u8 opcode); void* unifi_dl_fw_read_start(card_t *card, CsrInt8 is_fw); CsrResult unifi_coredump_handle_request(card_t *card); diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.c b/drivers/staging/csr/csr_wifi_hip_card_sdio.c index 5a86ff9..ef9c566 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.c @@ -139,7 +139,7 @@ card_t* unifi_alloc_card(CsrSdioFunction *sdio, void *ospriv) { CsrUint32 val = 0x01234567; - if (*((CsrUint8 *)&val) == 0x01) + if (*((u8 *)&val) == 0x01) { card->lsb = sizeof(void *) - 1; /* BE */ } @@ -510,7 +510,7 @@ static CsrResult unifi_hip_init(card_t *card) * --------------------------------------------------------------------------- */ static void _build_sdio_config_data(sdio_config_data_t *cfg_data, - const CsrUint8 *cfg_data_buf) + const u8 *cfg_data_buf) { CsrInt16 offset = 0; @@ -603,7 +603,7 @@ static CsrResult card_hw_init(card_t *card) CsrUint16 finger_print; symbol_t slut; sdio_config_data_t *cfg_data; - CsrUint8 cfg_data_buf[SDIO_CONFIG_DATA_SIZE]; + u8 cfg_data_buf[SDIO_CONFIG_DATA_SIZE]; CsrResult r; void *dlpriv; CsrInt16 major, minor; @@ -1002,7 +1002,7 @@ static CsrResult card_wait_for_unifi_to_reset(card_t *card) { CsrInt16 i; CsrResult r; - CsrUint8 io_enable; + u8 io_enable; CsrResult csrResult; func_enter(); @@ -1134,7 +1134,7 @@ static CsrResult card_wait_for_unifi_to_disable(card_t *card) { CsrInt16 i; CsrResult r; - CsrUint8 io_enable; + u8 io_enable; CsrResult csrResult; func_enter(); @@ -2006,7 +2006,7 @@ void unifi_free_card(card_t *card) static CsrResult card_init_slots(card_t *card) { CsrResult r; - CsrUint8 i; + u8 i; func_enter(); @@ -2170,7 +2170,7 @@ CsrResult unifi_remove_udi_hook(card_t *card, udi_func_t udi_fn) static void CardReassignDynamicReservation(card_t *card) { - CsrUint8 i; + u8 i; func_enter(); @@ -2352,7 +2352,7 @@ static void CardCheckDynamicReservation(card_t *card, unifi_TrafficQueue queue) */ void CardClearFromHostDataSlot(card_t *card, const CsrInt16 slot) { - CsrUint8 queue = card->from_host_data[slot].queue; + u8 queue = card->from_host_data[slot].queue; const void *os_data_ptr = card->from_host_data[slot].bd.os_data_ptr; func_enter(); @@ -2419,7 +2419,7 @@ void CardClearFromHostDataSlot(card_t *card, const CsrInt16 slot) */ void CardClearFromHostDataSlotWithoutFreeingBulkData(card_t *card, const CsrInt16 slot) { - CsrUint8 queue = card->from_host_data[slot].queue; + u8 queue = card->from_host_data[slot].queue; /* Initialise the from_host data slot so it can be re-used, * Set length field in from_host_data array to 0. @@ -2538,7 +2538,7 @@ static CsrResult unifi_identify_hw(card_t *card) * Setup the chip helper so that we can access the registers (and * also tell what sub-type of HIP we should use). */ - card->helper = ChipHelper_GetVersionSdio((CsrUint8)card->chip_id); + card->helper = ChipHelper_GetVersionSdio((u8)card->chip_id); if (!card->helper) { unifi_error(card->ospriv, "Null ChipHelper\n"); @@ -3121,13 +3121,13 @@ CsrResult CardGenInt(card_t *card) if (card->chip_id > SDIO_CARD_ID_UNIFI_2) { r = sdio_write_f0(card, SDIO_CSR_FROM_HOST_SCRATCH0, - (CsrUint8)card->unifi_interrupt_seq); + (u8)card->unifi_interrupt_seq); } else { r = unifi_write_direct_8_or_16(card, ChipHelper_SHARED_IO_INTERRUPT(card->helper) * 2, - (CsrUint8)card->unifi_interrupt_seq); + (u8)card->unifi_interrupt_seq); } if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) { @@ -3165,7 +3165,7 @@ CsrResult CardGenInt(card_t *card) CsrResult CardEnableInt(card_t *card) { CsrResult r; - CsrUint8 int_enable; + u8 int_enable; r = sdio_read_f0(card, SDIO_INT_ENABLE, &int_enable); if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) @@ -3213,7 +3213,7 @@ CsrResult CardEnableInt(card_t *card) CsrResult CardDisableInt(card_t *card) { CsrResult r; - CsrUint8 int_enable; + u8 int_enable; r = sdio_read_f0(card, SDIO_INT_ENABLE, &int_enable); if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) @@ -3264,7 +3264,7 @@ CsrResult CardDisableInt(card_t *card) CsrResult CardPendingInt(card_t *card, CsrBool *pintr) { CsrResult r; - CsrUint8 pending; + u8 pending; *pintr = FALSE; @@ -3364,7 +3364,7 @@ CsrResult CardClearInt(card_t *card) CsrResult CardIntEnabled(card_t *card, CsrBool *enabled) { CsrResult r; - CsrUint8 int_enable; + u8 int_enable; r = sdio_read_f0(card, SDIO_INT_ENABLE, &int_enable); if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) @@ -3403,7 +3403,7 @@ CsrResult CardIntEnabled(card_t *card, CsrBool *enabled) CsrResult CardWriteBulkData(card_t *card, card_signal_t *csptr, unifi_TrafficQueue queue) { CsrUint16 i, slots[UNIFI_MAX_DATA_REFERENCES], j = 0; - CsrUint8 *packed_sigptr, num_slots_required = 0; + u8 *packed_sigptr, num_slots_required = 0; bulk_data_desc_t *bulkdata = csptr->bulkdata; CsrInt16 h, nslots; @@ -3704,7 +3704,7 @@ static void bootstrap_chip_hw(card_t *card) CsrResult unifi_card_stop_processor(card_t *card, enum unifi_dbg_processors_select which) { CsrResult r = CSR_RESULT_SUCCESS; - CsrUint8 status; + u8 status; CsrInt16 retry = 100; while (retry--) @@ -3903,10 +3903,10 @@ CsrResult unifi_set_host_state(card_t *card, enum unifi_host_state state) static const CsrCharString *const states[] = { "AWAKE", "DROWSY", "TORPID" }; - static const CsrUint8 state_csr_host_wakeup[] = { + static const u8 state_csr_host_wakeup[] = { 1, 3, 0 }; - static const CsrUint8 state_io_abort[] = { + static const u8 state_io_abort[] = { 0, 2, 3 }; @@ -3922,7 +3922,7 @@ CsrResult unifi_set_host_state(card_t *card, enum unifi_host_state state) if (card->chip_id > SDIO_CARD_ID_UNIFI_2) { r = sdio_write_f0(card, SDIO_CSR_HOST_WAKEUP, - (CsrUint8)((card->function << 4) | state_csr_host_wakeup[state])); + (u8)((card->function << 4) | state_csr_host_wakeup[state])); } else { @@ -4034,7 +4034,7 @@ void unifi_card_info(card_t *card, card_info_t *card_info) */ CsrResult unifi_check_io_status(card_t *card, CsrInt32 *status) { - CsrUint8 io_en; + u8 io_en; CsrResult r; CsrBool pending; diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.h b/drivers/staging/csr/csr_wifi_hip_card_sdio.h index 4481d81..2615169 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.h +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.h @@ -246,7 +246,7 @@ typedef struct */ typedef struct card_signal { - CsrUint8 sigbuf[UNIFI_PACKED_SIGBUF_SIZE]; + u8 sigbuf[UNIFI_PACKED_SIGBUF_SIZE]; /* Length of the SIGNAL inside sigbuf */ CsrUint16 signal_length; @@ -421,7 +421,7 @@ struct card CsrUint16 chip_version; /* From the SDIO driver (probably 1) */ - CsrUint8 function; + u8 function; /* This is sused to get the register addresses and things. */ ChipDescript *helper; @@ -448,11 +448,11 @@ struct card /* UDI callback for logging UniFi interactions */ udi_func_t udi_hook; - CsrUint8 bh_reason_host; - CsrUint8 bh_reason_unifi; + u8 bh_reason_host; + u8 bh_reason_unifi; /* SDIO clock speed request from OS layer */ - CsrUint8 request_max_clock; + u8 request_max_clock; /* Last SDIO clock frequency set */ CsrUint32 sdio_clock_speed; @@ -505,8 +505,8 @@ struct card #define UNIFI_FH_BUF_SIZE 1024 struct sigbuf { - CsrUint8 *buf; /* buffer area */ - CsrUint8 *ptr; /* current pos */ + u8 *buf; /* buffer area */ + u8 *ptr; /* current pos */ CsrUint16 count; /* signal count */ CsrUint16 bufsize; } fh_buffer; @@ -519,7 +519,7 @@ struct card * Flag to say we need to generate an interrupt at end of processing. */ CsrUint32 unifi_interrupt_seq; - CsrUint8 generate_interrupt; + u8 generate_interrupt; /* Pointers to the bulk data slots */ @@ -560,7 +560,7 @@ struct card CsrUint32 sdio_bytes_read; CsrUint32 sdio_bytes_written; - CsrUint8 memory_resources_allocated; + u8 memory_resources_allocated; /* UniFi SDIO I/O Block size. */ CsrUint16 sdio_io_block_size; @@ -615,7 +615,7 @@ struct card CsrUint32 intmode; #ifdef UNIFI_DEBUG - CsrUint8 lsb; + u8 lsb; #endif /* Historic firmware panic codes */ @@ -671,10 +671,10 @@ CsrResult unifi_bulk_rw_noretry(card_t *card, CsrUint32 handle, #define UNIFI_SDIO_READ 0 #define UNIFI_SDIO_WRITE 1 -CsrResult unifi_read_8_or_16(card_t *card, CsrUint32 unifi_addr, CsrUint8 *pdata); -CsrResult unifi_write_8_or_16(card_t *card, CsrUint32 unifi_addr, CsrUint8 data); -CsrResult unifi_read_direct_8_or_16(card_t *card, CsrUint32 addr, CsrUint8 *pdata); -CsrResult unifi_write_direct_8_or_16(card_t *card, CsrUint32 addr, CsrUint8 data); +CsrResult unifi_read_8_or_16(card_t *card, CsrUint32 unifi_addr, u8 *pdata); +CsrResult unifi_write_8_or_16(card_t *card, CsrUint32 unifi_addr, u8 data); +CsrResult unifi_read_direct_8_or_16(card_t *card, CsrUint32 addr, u8 *pdata); +CsrResult unifi_write_direct_8_or_16(card_t *card, CsrUint32 addr, u8 data); CsrResult unifi_read_direct16(card_t *card, CsrUint32 addr, CsrUint16 *pdata); CsrResult unifi_read_direct32(card_t *card, CsrUint32 addr, CsrUint32 *pdata); @@ -683,8 +683,8 @@ CsrResult unifi_read_directn(card_t *card, CsrUint32 addr, void *pdata, CsrUint1 CsrResult unifi_write_direct16(card_t *card, CsrUint32 addr, CsrUint16 data); CsrResult unifi_write_directn(card_t *card, CsrUint32 addr, void *pdata, CsrUint16 len); -CsrResult sdio_read_f0(card_t *card, CsrUint32 addr, CsrUint8 *pdata); -CsrResult sdio_write_f0(card_t *card, CsrUint32 addr, CsrUint8 data); +CsrResult sdio_read_f0(card_t *card, CsrUint32 addr, u8 *pdata); +CsrResult sdio_write_f0(card_t *card, CsrUint32 addr, u8 data); void unifi_read_panic(card_t *card); #ifdef CSR_PRE_ALLOC_NET_DATA diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c index 8fefbdf..52a6ed3 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c @@ -53,10 +53,10 @@ static CsrResult read_to_host_signals(card_t *card, CsrInt32 *processed); static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed); static CsrResult process_bulk_data_command(card_t *card, - const CsrUint8 *cmdptr, + const u8 *cmdptr, CsrInt16 cmd, CsrUint16 len); static CsrResult process_clear_slot_command(card_t *card, - const CsrUint8 *cmdptr); + const u8 *cmdptr); static CsrResult process_fh_cmd_queue(card_t *card, CsrInt32 *processed); static CsrResult process_fh_traffic_queue(card_t *card, CsrInt32 *processed); static void restart_packet_flow(card_t *card); @@ -408,7 +408,7 @@ CsrResult unifi_bh(card_t *card, CsrUint32 *remaining) */ if (card->host_state == UNIFI_HOST_STATE_DROWSY || card->host_state == UNIFI_HOST_STATE_TORPID) { - CsrUint8 reason_unifi; + u8 reason_unifi; /* * An interrupt may occur while or after we cache the reason. @@ -1064,7 +1064,7 @@ static CsrResult update_to_host_signals_r(card_t *card, CsrInt16 pending) /* Update the count of signals read */ r = unifi_write_8_or_16(card, card->sdio_ctrl_addr + 6, - (CsrUint8)card->to_host_signals_r); + (u8)card->to_host_signals_r); if (r != CSR_RESULT_SUCCESS) { unifi_error(card->ospriv, "Failed to update to-host signals read\n"); @@ -1098,7 +1098,7 @@ static CsrResult update_to_host_signals_r(card_t *card, CsrInt16 pending) * None. * --------------------------------------------------------------------------- */ -static void read_unpack_cmd(const CsrUint8 *ptr, bulk_data_cmd_t *bulk_data_cmd) +static void read_unpack_cmd(const u8 *ptr, bulk_data_cmd_t *bulk_data_cmd) { CsrInt16 index = 0; bulk_data_cmd->cmd_and_len = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); @@ -1147,7 +1147,7 @@ static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed) { CsrInt16 pending; CsrInt16 remaining; - CsrUint8 *bufptr; + u8 *bufptr; bulk_data_param_t data_ptrs; CsrInt16 cmd; CsrUint16 sig_len; @@ -1512,8 +1512,8 @@ static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed) if (remaining > 0) { /* Use a safe copy because source and destination may overlap */ - CsrUint8 *d = card->th_buffer.buf; - CsrUint8 *s = bufptr; + u8 *d = card->th_buffer.buf; + u8 *s = bufptr; CsrInt32 n = remaining; while (n--) { @@ -1543,7 +1543,7 @@ static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed) * 0 on success, CSR error code on error * --------------------------------------------------------------------------- */ -static CsrResult process_clear_slot_command(card_t *card, const CsrUint8 *cmdptr) +static CsrResult process_clear_slot_command(card_t *card, const u8 *cmdptr) { CsrUint16 data_slot; CsrInt16 slot; @@ -1618,12 +1618,12 @@ static CsrResult process_clear_slot_command(card_t *card, const CsrUint8 *cmdptr * CSR_RESULT_SUCCESS on success, CSR error code on error * --------------------------------------------------------------------------- */ -static CsrResult process_bulk_data_command(card_t *card, const CsrUint8 *cmdptr, +static CsrResult process_bulk_data_command(card_t *card, const u8 *cmdptr, CsrInt16 cmd, CsrUint16 len) { bulk_data_desc_t *bdslot; #ifdef CSR_WIFI_ALIGNMENT_WORKAROUND - CsrUint8 *host_bulk_data_slot; + u8 *host_bulk_data_slot; #endif bulk_data_cmd_t bdcmd; CsrInt16 offset; @@ -2032,7 +2032,7 @@ static CsrResult process_fh_cmd_queue(card_t *card, CsrInt32 *processed) CsrInt16 i; CsrUint16 sig_chunks, total_length, free_chunks_in_fh_buffer; bulk_data_param_t bulkdata; - CsrUint8 *packed_sigptr; + u8 *packed_sigptr; CsrUint16 signal_length = 0; /* Retrieve the entry at the head of the queue */ @@ -2100,9 +2100,9 @@ static CsrResult process_fh_cmd_queue(card_t *card, CsrInt32 *processed) /* Append packed signal to F-H buffer */ total_length = sig_chunks * card->config_data.sig_frag_size; - card->fh_buffer.ptr[0] = (CsrUint8)(signal_length & 0xff); + card->fh_buffer.ptr[0] = (u8)(signal_length & 0xff); card->fh_buffer.ptr[1] = - (CsrUint8)(((signal_length >> 8) & 0xf) | (SDIO_CMD_SIGNAL << 4)); + (u8)(((signal_length >> 8) & 0xf) | (SDIO_CMD_SIGNAL << 4)); CsrMemCpy(card->fh_buffer.ptr + 2, packed_sigptr, signal_length); CsrMemSet(card->fh_buffer.ptr + 2 + signal_length, 0, @@ -2273,7 +2273,7 @@ static CsrResult process_fh_traffic_queue(card_t *card, CsrInt32 *processed) card_signal_t *csptr; CsrUint16 sig_chunks, total_length, free_chunks_in_fh_buffer; bulk_data_param_t bulkdata; - CsrUint8 *packed_sigptr; + u8 *packed_sigptr; CsrUint16 signal_length = 0; /* if this queue is empty go to next one. */ @@ -2378,9 +2378,9 @@ static CsrResult process_fh_traffic_queue(card_t *card, CsrInt32 *processed) /* Append packed signal to F-H buffer */ total_length = sig_chunks * card->config_data.sig_frag_size; - card->fh_buffer.ptr[0] = (CsrUint8)(signal_length & 0xff); + card->fh_buffer.ptr[0] = (u8)(signal_length & 0xff); card->fh_buffer.ptr[1] = - (CsrUint8)(((signal_length >> 8) & 0xf) | (SDIO_CMD_SIGNAL << 4)); + (u8)(((signal_length >> 8) & 0xf) | (SDIO_CMD_SIGNAL << 4)); CsrMemCpy(card->fh_buffer.ptr + 2, packed_sigptr, signal_length); CsrMemSet(card->fh_buffer.ptr + 2 + signal_length, 0, @@ -2516,7 +2516,7 @@ static CsrResult flush_fh_buffer(card_t *card) card->from_host_signals_w = (card->from_host_signals_w + card->fh_buffer.count) % 128u; r = unifi_write_8_or_16(card, card->sdio_ctrl_addr + 0, - (CsrUint8)card->from_host_signals_w); + (u8)card->from_host_signals_w); if (r != CSR_RESULT_SUCCESS) { unifi_error(card->ospriv, "Failed to write fh signal count %u with error %d\n", @@ -2556,7 +2556,7 @@ static CsrResult flush_fh_buffer(card_t *card) */ static void restart_packet_flow(card_t *card) { - CsrUint8 q; + u8 q; /* * We only look at the fh_traffic_queue, because that is where packets from diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c index 8bc2d74..d5066ac 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c @@ -53,7 +53,7 @@ * CSR_RESULT_FAILURE an SDIO error occurred * --------------------------------------------------------------------------- */ -static CsrResult retrying_read8(card_t *card, CsrInt16 funcnum, CsrUint32 addr, CsrUint8 *pdata) +static CsrResult retrying_read8(card_t *card, CsrInt16 funcnum, CsrUint32 addr, u8 *pdata) { CsrSdioFunction *sdio = card->sdio_if; CsrResult r = CSR_RESULT_SUCCESS; @@ -128,7 +128,7 @@ static CsrResult retrying_read8(card_t *card, CsrInt16 funcnum, CsrUint32 addr, } /* retrying_read8() */ -static CsrResult retrying_write8(card_t *card, CsrInt16 funcnum, CsrUint32 addr, CsrUint8 data) +static CsrResult retrying_write8(card_t *card, CsrInt16 funcnum, CsrUint32 addr, u8 data) { CsrSdioFunction *sdio = card->sdio_if; CsrResult r = CSR_RESULT_SUCCESS; @@ -338,7 +338,7 @@ static CsrResult retrying_write16(card_t *card, CsrInt16 funcnum, * CSR_RESULT_FAILURE an SDIO error occurred * --------------------------------------------------------------------------- */ -CsrResult sdio_read_f0(card_t *card, CsrUint32 addr, CsrUint8 *pdata) +CsrResult sdio_read_f0(card_t *card, CsrUint32 addr, u8 *pdata) { #if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) card->cmd_prof.cmd52_f0_r_count++; @@ -364,7 +364,7 @@ CsrResult sdio_read_f0(card_t *card, CsrUint32 addr, CsrUint8 *pdata) * CSR_RESULT_FAILURE an SDIO error occurred * --------------------------------------------------------------------------- */ -CsrResult sdio_write_f0(card_t *card, CsrUint32 addr, CsrUint8 data) +CsrResult sdio_write_f0(card_t *card, CsrUint32 addr, u8 data) { #if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) card->cmd_prof.cmd52_f0_w_count++; @@ -388,14 +388,14 @@ CsrResult sdio_write_f0(card_t *card, CsrUint32 addr, CsrUint8 data) * CSR_RESULT_SUCCESS on success, non-zero error code on error: * --------------------------------------------------------------------------- */ -CsrResult unifi_read_direct_8_or_16(card_t *card, CsrUint32 addr, CsrUint8 *pdata) +CsrResult unifi_read_direct_8_or_16(card_t *card, CsrUint32 addr, u8 *pdata) { #ifdef CSR_WIFI_TRANSPORT_CSPI CsrUint16 w; CsrResult r; r = retrying_read16(card, card->function, addr, &w); - *pdata = (CsrUint8)(w & 0xFF); + *pdata = (u8)(w & 0xFF); return r; #else return retrying_read8(card, card->function, addr, pdata); @@ -423,7 +423,7 @@ CsrResult unifi_read_direct_8_or_16(card_t *card, CsrUint32 addr, CsrUint8 *pdat * to memory until the preceding even address is written. * --------------------------------------------------------------------------- */ -CsrResult unifi_write_direct_8_or_16(card_t *card, CsrUint32 addr, CsrUint8 data) +CsrResult unifi_write_direct_8_or_16(card_t *card, CsrUint32 addr, u8 data) { if (addr & 1) { @@ -568,12 +568,12 @@ static CsrResult unifi_read_directn_match(card_t *card, CsrUint32 addr, void *pd { CsrResult r; CsrUint32 i; - CsrUint8 *cptr; + u8 *cptr; CsrUint16 w; *num = 0; - cptr = (CsrUint8 *)pdata; + cptr = (u8 *)pdata; for (i = 0; i < len; i += 2) { r = retrying_read16(card, card->function, addr, &w); @@ -582,7 +582,7 @@ static CsrResult unifi_read_directn_match(card_t *card, CsrUint32 addr, void *pd return r; } - *cptr++ = ((CsrUint8)w & 0xFF); + *cptr++ = ((u8)w & 0xFF); if ((m >= 0) && (((CsrInt8)w & 0xFF) == m)) { break; @@ -594,7 +594,7 @@ static CsrResult unifi_read_directn_match(card_t *card, CsrUint32 addr, void *pd break; } - *cptr++ = ((CsrUint8)(w >> 8) & 0xFF); + *cptr++ = ((u8)(w >> 8) & 0xFF); if ((m >= 0) && (((CsrInt8)(w >> 8) & 0xFF) == m)) { break; @@ -603,7 +603,7 @@ static CsrResult unifi_read_directn_match(card_t *card, CsrUint32 addr, void *pd addr += 2; } - *num = (CsrInt32)(cptr - (CsrUint8 *)pdata); + *num = (CsrInt32)(cptr - (u8 *)pdata); return CSR_RESULT_SUCCESS; } @@ -667,10 +667,10 @@ CsrResult unifi_read_directn(card_t *card, CsrUint32 addr, void *pdata, CsrUint1 CsrResult unifi_write_directn(card_t *card, CsrUint32 addr, void *pdata, CsrUint16 len) { CsrResult r; - CsrUint8 *cptr; + u8 *cptr; CsrInt16 signed_len; - cptr = (CsrUint8 *)pdata; + cptr = (u8 *)pdata; signed_len = (CsrInt16)len; while (signed_len > 0) { @@ -1022,7 +1022,7 @@ CsrResult unifi_set_proc_select(card_t *card, enum unifi_dbg_processors_select s { r = unifi_write_direct16(card, ChipHelper_DBG_HOST_PROC_SELECT(card->helper) * 2, - (CsrUint8)select); + (u8)select); if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) { return r; @@ -1059,7 +1059,7 @@ CsrResult unifi_set_proc_select(card_t *card, enum unifi_dbg_processors_select s * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified * --------------------------------------------------------------------------- */ -CsrResult unifi_read_8_or_16(card_t *card, CsrUint32 unifi_addr, CsrUint8 *pdata) +CsrResult unifi_read_8_or_16(card_t *card, CsrUint32 unifi_addr, u8 *pdata) { CsrUint32 sdio_addr; CsrResult r; @@ -1078,7 +1078,7 @@ CsrResult unifi_read_8_or_16(card_t *card, CsrUint32 unifi_addr, CsrUint8 *pdata #endif #ifdef CSR_WIFI_TRANSPORT_CSPI r = retrying_read16(card, card->function, sdio_addr, &w); - *pdata = (CsrUint8)(w & 0xFF); + *pdata = (u8)(w & 0xFF); return r; #else return retrying_read8(card, card->function, sdio_addr, pdata); @@ -1110,7 +1110,7 @@ CsrResult unifi_read_8_or_16(card_t *card, CsrUint32 unifi_addr, CsrUint8 *pdata * write with the previously cached odd byte. * --------------------------------------------------------------------------- */ -CsrResult unifi_write_8_or_16(card_t *card, CsrUint32 unifi_addr, CsrUint8 data) +CsrResult unifi_write_8_or_16(card_t *card, CsrUint32 unifi_addr, u8 data) { CsrUint32 sdio_addr; CsrResult r; @@ -1325,7 +1325,7 @@ CsrResult unifi_readnz(card_t *card, CsrUint32 unifi_addr, void *pdata, CsrUint1 */ CsrInt32 unifi_read_shared_count(card_t *card, CsrUint32 addr) { - CsrUint8 b; + u8 b; /* I've increased this count, because I have seen cases where * there were three reads in a row with the top bit set. I'm not * sure why this might have happened, but I can't see a problem @@ -1400,7 +1400,7 @@ CsrResult unifi_writen(card_t *card, CsrUint32 unifi_addr, void *pdata, CsrUint1 static CsrResult csr_sdio_block_rw(card_t *card, CsrInt16 funcnum, - CsrUint32 addr, CsrUint8 *pdata, + CsrUint32 addr, u8 *pdata, CsrUint16 count, CsrInt16 dir_is_write) { CsrResult csrResult; @@ -1488,10 +1488,10 @@ CsrResult unifi_bulk_rw(card_t *card, CsrUint32 handle, void *pdata, CsrResult r = CSR_RESULT_SUCCESS; /* HIP error code */ CsrInt16 retries = CMD53_RETRIES; CsrInt16 stat_retries; - CsrUint8 stat; + u8 stat; CsrInt16 dump_read; #ifdef UNIFI_DEBUG - CsrUint8 *pdata_lsb = ((CsrUint8 *)&pdata) + card->lsb; + u8 *pdata_lsb = ((u8 *)&pdata) + card->lsb; #endif #ifdef CSR_WIFI_MAKE_FAKE_CMD53_ERRORS static CsrInt16 fake_error; @@ -1529,7 +1529,7 @@ CsrResult unifi_bulk_rw(card_t *card, CsrUint32 handle, void *pdata, while (1) { csrResult = csr_sdio_block_rw(card, card->function, handle, - (CsrUint8 *)pdata, (CsrUint16)len, + (u8 *)pdata, (CsrUint16)len, direction); if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) { @@ -1591,7 +1591,7 @@ CsrResult unifi_bulk_rw(card_t *card, CsrUint32 handle, void *pdata, /* The transfer failed, rewind and try again */ r = unifi_write_8_or_16(card, card->sdio_ctrl_addr + 8, - (CsrUint8)(handle & 0xff)); + (u8)(handle & 0xff)); if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) { return r; @@ -1699,7 +1699,7 @@ CsrResult unifi_bulk_rw_noretry(card_t *card, CsrUint32 handle, void *pdata, CsrResult csrResult; csrResult = csr_sdio_block_rw(card, card->function, handle, - (CsrUint8 *)pdata, (CsrUint16)len, direction); + (u8 *)pdata, (CsrUint16)len, direction); if (csrResult != CSR_RESULT_SUCCESS) { unifi_error(card->ospriv, "Block %s failed\n", diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper.c b/drivers/staging/csr/csr_wifi_hip_chiphelper.c index a3148d8..729df88 100644 --- a/drivers/staging/csr/csr_wifi_hip_chiphelper.c +++ b/drivers/staging/csr/csr_wifi_hip_chiphelper.c @@ -575,7 +575,7 @@ static const struct chip_device_desc_t *chip_ver_to_desc[] = &hyd_wlan_subsys_desc_v1 }; -ChipDescript* ChipHelper_GetVersionSdio(CsrUint8 sdio_ver) +ChipDescript* ChipHelper_GetVersionSdio(u8 sdio_ver) { CsrUint32 i; diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper.h b/drivers/staging/csr/csr_wifi_hip_chiphelper.h index 6166d55..60dff8e 100644 --- a/drivers/staging/csr/csr_wifi_hip_chiphelper.h +++ b/drivers/staging/csr/csr_wifi_hip_chiphelper.h @@ -173,7 +173,7 @@ ChipDescript* ChipHelper_GetVersionUniFi(CsrUint16 version); /* This gets the version from the SDIO device id. This only gives quite a coarse grained version, so we should update once we hav access to the function N registers. */ -ChipDescript* ChipHelper_GetVersionSdio(CsrUint8 sdio_version); +ChipDescript* ChipHelper_GetVersionSdio(u8 sdio_version); /* The chip is some sort of BlueCore. If "age" is "pre_bc7" then "version" is what was read from FF9A. If "age" is bc7_or_later @@ -445,7 +445,7 @@ public: void GetVersionAny(CsrUint16 from_FF9A, CsrUint16 from_FE81); void GetVersionUniFi(CsrUint16 version); void GetVersionBlueCore(chip_helper_bluecore_age age, CsrUint16 version); - void GetVersionSdio(CsrUint8 sdio_version); + void GetVersionSdio(u8 sdio_version); /* Helpers to build the definitions of the member functions. */ #define CHIP_HELPER_DEF0_CPP_DEC(ret_type, name, info) \ diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h b/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h index 7ab8173..c0e2f2a 100644 --- a/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h +++ b/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h @@ -143,7 +143,7 @@ struct chip_version_t CsrInt32 pre_bc7; CsrUint16 mask; CsrUint16 result; - CsrUint8 sdio; + u8 sdio; }; struct chip_device_desc_t diff --git a/drivers/staging/csr/csr_wifi_hip_conversions.h b/drivers/staging/csr/csr_wifi_hip_conversions.h index 6a4647d..212b9b7 100644 --- a/drivers/staging/csr/csr_wifi_hip_conversions.h +++ b/drivers/staging/csr/csr_wifi_hip_conversions.h @@ -69,9 +69,9 @@ extern "C" { CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 2)) -CsrInt32 get_packed_struct_size(const CsrUint8 *buf); -CsrResult read_unpack_signal(const CsrUint8 *ptr, CSR_SIGNAL *sig); -CsrResult write_pack(const CSR_SIGNAL *sig, CsrUint8 *ptr, CsrUint16 *sig_len); +CsrInt32 get_packed_struct_size(const u8 *buf); +CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig); +CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, CsrUint16 *sig_len); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_wifi_hip_download.c b/drivers/staging/csr/csr_wifi_hip_download.c index 47178af..c43f589 100644 --- a/drivers/staging/csr/csr_wifi_hip_download.c +++ b/drivers/staging/csr/csr_wifi_hip_download.c @@ -497,11 +497,11 @@ void* unifi_dl_fw_read_start(card_t *card, CsrInt8 is_fw) * CSR_RESULT_SUCCESS on success, CSR error code on failure * --------------------------------------------------------------------------- */ -static CsrResult safe_read_shared_location(card_t *card, CsrUint32 address, CsrUint8 *pdata) +static CsrResult safe_read_shared_location(card_t *card, CsrUint32 address, u8 *pdata) { CsrResult r; CsrUint16 limit = 1000; - CsrUint8 b, b2; + u8 b, b2; *pdata = 0; @@ -559,7 +559,7 @@ static CsrResult safe_read_shared_location(card_t *card, CsrUint32 address, CsrU #define OPERATION_TIMEOUT_LOOPS (100) /* when OPERATION_TIMEOUT_DELAY==1, (500) otherwise */ #define OPERATION_TIMEOUT_DELAY 1 /* msec, or 200usecs */ -CsrResult unifi_do_loader_op(card_t *card, CsrUint32 op_addr, CsrUint8 opcode) +CsrResult unifi_do_loader_op(card_t *card, CsrUint32 op_addr, u8 opcode) { CsrResult r; CsrInt16 op_retries; @@ -580,7 +580,7 @@ CsrResult unifi_do_loader_op(card_t *card, CsrUint32 op_addr, CsrUint8 opcode) r = CSR_RESULT_SUCCESS; while (1) { - CsrUint8 op; + u8 op; /* * Read the memory location until two successive reads give @@ -658,7 +658,7 @@ static CsrResult send_ptdl_to_unifi(card_t *card, void *dlpriv, CsrUint32 op_addr) { CsrUint32 offset; - CsrUint8 *buf; + u8 *buf; CsrInt32 data_len; CsrUint32 write_len; CsrResult r; diff --git a/drivers/staging/csr/csr_wifi_hip_packing.c b/drivers/staging/csr/csr_wifi_hip_packing.c index 4e98da9..e024a1f 100644 --- a/drivers/staging/csr/csr_wifi_hip_packing.c +++ b/drivers/staging/csr/csr_wifi_hip_packing.c @@ -35,7 +35,7 @@ * This is useful for stepping past the signal to the object in the buffer. * --------------------------------------------------------------------------- */ -CsrInt32 get_packed_struct_size(const CsrUint8 *buf) +CsrInt32 get_packed_struct_size(const u8 *buf) { CsrInt32 size = 0; CsrUint16 sig_id; @@ -1148,7 +1148,7 @@ CsrInt32 get_packed_struct_size(const CsrUint8 *buf) * CSR_WIFI_HIP_RESULT_INVALID_VALUE if the ID of signal was not recognised. * --------------------------------------------------------------------------- */ -CsrResult read_unpack_signal(const CsrUint8 *ptr, CSR_SIGNAL *sig) +CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) { CsrInt32 index = 0; @@ -2984,7 +2984,7 @@ CsrResult read_unpack_signal(const CsrUint8 *ptr, CSR_SIGNAL *sig) * CSR_WIFI_HIP_RESULT_INVALID_VALUE if the ID of signal was not recognised. * --------------------------------------------------------------------------- */ -CsrResult write_pack(const CSR_SIGNAL *sig, CsrUint8 *ptr, CsrUint16 *sig_len) +CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, CsrUint16 *sig_len) { CsrInt16 index = 0; diff --git a/drivers/staging/csr/csr_wifi_hip_send.c b/drivers/staging/csr/csr_wifi_hip_send.c index 624f3bb..96bf40e 100644 --- a/drivers/staging/csr/csr_wifi_hip_send.c +++ b/drivers/staging/csr/csr_wifi_hip_send.c @@ -100,7 +100,7 @@ CSR_PRIORITY unifi_get_default_downgrade_priority(unifi_TrafficQueue queue) * Calls unifi_pause_xmit() when the last slots are used. * --------------------------------------------------------------------------- */ -static CsrResult send_signal(card_t *card, const CsrUint8 *sigptr, CsrUint32 siglen, +static CsrResult send_signal(card_t *card, const u8 *sigptr, CsrUint32 siglen, const bulk_data_param_t *bulkdata, q_t *sigq, CsrUint32 priority_q, CsrUint32 run_bh) { @@ -156,8 +156,8 @@ static CsrResult send_signal(card_t *card, const CsrUint8 *sigptr, CsrUint32 sig debug_print++; } /* Store the bulk data info in the soft queue. */ - csptr->bulkdata[i].os_data_ptr = (CsrUint8 *)bulkdata->d[i].os_data_ptr; - csptr->bulkdata[i].os_net_buf_ptr = (CsrUint8 *)bulkdata->d[i].os_net_buf_ptr; + csptr->bulkdata[i].os_data_ptr = (u8 *)bulkdata->d[i].os_data_ptr; + csptr->bulkdata[i].os_net_buf_ptr = (u8 *)bulkdata->d[i].os_net_buf_ptr; csptr->bulkdata[i].net_buf_length = bulkdata->d[i].net_buf_length; csptr->bulkdata[i].data_length = datalen; } @@ -170,7 +170,7 @@ static CsrResult send_signal(card_t *card, const CsrUint8 *sigptr, CsrUint32 sig if (debug_print) { - const CsrUint8 *sig = sigptr; + const u8 *sig = sigptr; unifi_error(card->ospriv, "Signal(%d): %02x %02x %02x %02x %02x %02x %02x %02x" " %02x %02x %02x %02x %02x %02x %02x %02x\n", @@ -303,7 +303,7 @@ static CsrResult send_signal(card_t *card, const CsrUint8 *sigptr, CsrUint32 sig * to the device. Signals are constructed using the UniFi packed structures. * --------------------------------------------------------------------------- */ -CsrResult unifi_send_signal(card_t *card, const CsrUint8 *sigptr, CsrUint32 siglen, +CsrResult unifi_send_signal(card_t *card, const u8 *sigptr, CsrUint32 siglen, const bulk_data_param_t *bulkdata) { q_t *sig_soft_q; @@ -383,7 +383,7 @@ CsrResult unifi_send_signal(card_t *card, const CsrUint8 *sigptr, CsrUint32 sigl * Notes: * --------------------------------------------------------------------------- */ -CsrResult unifi_send_resources_available(card_t *card, const CsrUint8 *sigptr) +CsrResult unifi_send_resources_available(card_t *card, const u8 *sigptr) { q_t *sig_soft_q; CsrUint16 signal_id = GET_SIGNAL_ID(sigptr); diff --git a/drivers/staging/csr/csr_wifi_hip_sigs.h b/drivers/staging/csr/csr_wifi_hip_sigs.h index c94e2a4..5d04c06 100644 --- a/drivers/staging/csr/csr_wifi_hip_sigs.h +++ b/drivers/staging/csr/csr_wifi_hip_sigs.h @@ -113,7 +113,7 @@ typedef enum CSR_LOADER_OPERATION typedef struct CSR_MAC_ADDRESS { - CsrUint8 x[6]; + u8 x[6]; } CSR_MACADDRESS; typedef enum CSR_MIB_STATUS @@ -374,7 +374,7 @@ typedef enum CSR_SYMBOL_ID typedef struct CSR_TSF_TIME { - CsrUint8 x[8]; + u8 x[8]; } CSR_TSF_TIME; typedef CsrUint16 CSR_TIME_UNITS; diff --git a/drivers/staging/csr/csr_wifi_hip_ta_sampling.c b/drivers/staging/csr/csr_wifi_hip_ta_sampling.c index 7afcd3c..7108cf0 100644 --- a/drivers/staging/csr/csr_wifi_hip_ta_sampling.c +++ b/drivers/staging/csr/csr_wifi_hip_ta_sampling.c @@ -72,7 +72,7 @@ enum ta_frame_identity #define snap_802_2 0xAAAA0300 #define oui_rfc1042 0x00000000 #define oui_8021h 0x0000f800 -static const CsrUint8 aironet_snap[5] = { 0x00, 0x40, 0x96, 0x00, 0x00 }; +static const u8 aironet_snap[5] = { 0x00, 0x40, 0x96, 0x00, 0x00 }; /* @@ -93,8 +93,8 @@ static const CsrUint8 aironet_snap[5] = { 0x00, 0x40, 0x96, 0x00, 0x00 }; */ static enum ta_frame_identity ta_detect_protocol(card_t *card, CsrWifiRouterCtrlProtocolDirection direction, const bulk_data_desc_t *data, - const CsrUint8 *saddr, - const CsrUint8 *sta_macaddr) + const u8 *saddr, + const u8 *sta_macaddr) { ta_data_t *tad = &card->ta_sampling; CsrUint16 proto; @@ -138,7 +138,7 @@ static enum ta_frame_identity ta_detect_protocol(card_t *card, CsrWifiRouterCtrl if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM) { ta_l4stats_t *ta_l4stats = &tad->ta_l4stats; - CsrUint8 l4proto = data->os_data_ptr[TA_IP_TYPE_OFFSET]; + u8 l4proto = data->os_data_ptr[TA_IP_TYPE_OFFSET]; if (l4proto == TA_IP_TYPE_TCP) { @@ -344,8 +344,8 @@ void unifi_ta_sampling_init(card_t *card) void unifi_ta_sample(card_t *card, CsrWifiRouterCtrlProtocolDirection direction, const bulk_data_desc_t *data, - const CsrUint8 *saddr, - const CsrUint8 *sta_macaddr, + const u8 *saddr, + const u8 *sta_macaddr, CsrUint32 timestamp, CsrUint16 rate) { diff --git a/drivers/staging/csr/csr_wifi_hip_udi.c b/drivers/staging/csr/csr_wifi_hip_udi.c index 2cf0281..b7c292c 100644 --- a/drivers/staging/csr/csr_wifi_hip_udi.c +++ b/drivers/staging/csr/csr_wifi_hip_udi.c @@ -55,7 +55,7 @@ CsrInt32 unifi_print_status(card_t *card, CsrCharString *str, CsrInt32 *remain) "AWAKE", "DROWSY", "TORPID" }; #define SHARED_READ_RETRY_LIMIT 10 - CsrUint8 b; + u8 b; #endif if (remaining <= 0) diff --git a/drivers/staging/csr/csr_wifi_hip_unifi.h b/drivers/staging/csr/csr_wifi_hip_unifi.h index 5f1c67b..62d7740 100644 --- a/drivers/staging/csr/csr_wifi_hip_unifi.h +++ b/drivers/staging/csr/csr_wifi_hip_unifi.h @@ -139,7 +139,7 @@ typedef enum */ typedef struct _bulk_data_desc { - const CsrUint8 *os_data_ptr; + const u8 *os_data_ptr; CsrUint32 data_length; const void *os_net_buf_ptr; CsrUint32 net_buf_length; @@ -324,7 +324,7 @@ void unifi_cancel_pending_signals(card_t *card); * * @ingroup upperedge */ -CsrResult unifi_send_signal(card_t *card, const CsrUint8 *sigptr, +CsrResult unifi_send_signal(card_t *card, const u8 *sigptr, CsrUint32 siglen, const bulk_data_param_t *bulkdata); @@ -343,7 +343,7 @@ CsrResult unifi_send_signal(card_t *card, const CsrUint8 *sigptr, * * @ingroup upperedge */ -CsrResult unifi_send_resources_available(card_t *card, const CsrUint8 *sigptr); +CsrResult unifi_send_resources_available(card_t *card, const u8 *sigptr); /** * @@ -511,8 +511,8 @@ CsrResult unifi_ta_configure(card_t *card, void unifi_ta_sample(card_t *card, CsrWifiRouterCtrlProtocolDirection direction, const bulk_data_desc_t *data, - const CsrUint8 *saddr, - const CsrUint8 *sta_macaddr, + const u8 *saddr, + const u8 *sta_macaddr, CsrUint32 timestamp, CsrUint16 rate); @@ -643,7 +643,7 @@ CsrResult unifi_run_bh(void *ospriv); * @ingroup upperedge */ void unifi_receive_event(void *ospriv, - CsrUint8 *sigdata, CsrUint32 siglen, + u8 *sigdata, CsrUint32 siglen, const bulk_data_param_t *bulkdata); #ifdef CSR_WIFI_REQUEUE_PACKET_TO_HAL diff --git a/drivers/staging/csr/csr_wifi_hip_unifi_udi.h b/drivers/staging/csr/csr_wifi_hip_unifi_udi.h index 0873b7b..e69f5c7 100644 --- a/drivers/staging/csr/csr_wifi_hip_unifi_udi.h +++ b/drivers/staging/csr/csr_wifi_hip_unifi_udi.h @@ -37,7 +37,7 @@ enum udi_log_direction UDI_LOG_TO_HOST = 0x0001 }; -typedef void (*udi_func_t)(void *ospriv, CsrUint8 *sigdata, +typedef void (*udi_func_t)(void *ospriv, u8 *sigdata, CsrUint32 signal_len, const bulk_data_param_t *bulkdata, enum udi_log_direction dir); diff --git a/drivers/staging/csr/csr_wifi_hip_xbv.c b/drivers/staging/csr/csr_wifi_hip_xbv.c index 5aaec4d..8bc79aa 100644 --- a/drivers/staging/csr/csr_wifi_hip_xbv.c +++ b/drivers/staging/csr/csr_wifi_hip_xbv.c @@ -103,7 +103,7 @@ static CsrUint32 write_uint16(void *buf, const CsrUint32 offset, static CsrUint32 write_uint32(void *buf, const CsrUint32 offset, const CsrUint32 val); static CsrUint32 write_bytes(void *buf, const CsrUint32 offset, - const CsrUint8 *data, const CsrUint32 len); + const u8 *data, const CsrUint32 len); static CsrUint32 write_tag(void *buf, const CsrUint32 offset, const CsrCharString *tag_str); static CsrUint32 write_chunk(void *buf, const CsrUint32 offset, @@ -489,7 +489,7 @@ static CsrInt32 xbv_push(xbv1_t *fwinfo, xbv_stack_t *stack, } -static CsrUint32 xbv2uint(CsrUint8 *ptr, CsrInt32 len) +static CsrUint32 xbv2uint(u8 *ptr, CsrInt32 len) { CsrUint32 u = 0; CsrInt16 i; @@ -506,7 +506,7 @@ static CsrUint32 xbv2uint(CsrUint8 *ptr, CsrInt32 len) static CsrInt32 read_tag(card_t *card, ct_t *ct, tag_t *tag) { - CsrUint8 buf[8]; + u8 buf[8]; CsrInt32 n; n = (*ct->iread)(card->ospriv, ct->dlpriv, ct->ioffset, buf, 8); @@ -549,7 +549,7 @@ static CsrInt32 read_bytes(card_t *card, ct_t *ct, void *buf, CsrUint32 len) static CsrInt32 read_uint(card_t *card, ct_t *ct, CsrUint32 *u, CsrUint32 len) { - CsrUint8 buf[4]; + u8 buf[4]; /* Integer cannot be more than 4 bytes */ if (len > 4) @@ -570,9 +570,9 @@ static CsrInt32 read_uint(card_t *card, ct_t *ct, CsrUint32 *u, CsrUint32 len) static CsrUint32 write_uint16(void *buf, const CsrUint32 offset, const CsrUint16 val) { - CsrUint8 *dst = (CsrUint8 *)buf + offset; - *dst++ = (CsrUint8)(val & 0xff); /* LSB first */ - *dst = (CsrUint8)(val >> 8); + u8 *dst = (u8 *)buf + offset; + *dst++ = (u8)(val & 0xff); /* LSB first */ + *dst = (u8)(val >> 8); return sizeof(CsrUint16); } @@ -585,14 +585,14 @@ static CsrUint32 write_uint32(void *buf, const CsrUint32 offset, const CsrUint32 } -static CsrUint32 write_bytes(void *buf, const CsrUint32 offset, const CsrUint8 *data, const CsrUint32 len) +static CsrUint32 write_bytes(void *buf, const CsrUint32 offset, const u8 *data, const CsrUint32 len) { CsrUint32 i; - CsrUint8 *dst = (CsrUint8 *)buf + offset; + u8 *dst = (u8 *)buf + offset; for (i = 0; i < len; i++) { - *dst++ = *((CsrUint8 *)data + i); + *dst++ = *((u8 *)data + i); } return len; } @@ -600,7 +600,7 @@ static CsrUint32 write_bytes(void *buf, const CsrUint32 offset, const CsrUint8 * static CsrUint32 write_tag(void *buf, const CsrUint32 offset, const CsrCharString *tag_str) { - CsrUint8 *dst = (CsrUint8 *)buf + offset; + u8 *dst = (u8 *)buf + offset; CsrMemCpy(dst, tag_str, 4); return 4; } @@ -619,7 +619,7 @@ static CsrUint32 write_chunk(void *buf, const CsrUint32 offset, const CsrCharStr static CsrUint16 calc_checksum(void *buf, const CsrUint32 offset, const CsrUint32 bytes_len) { CsrUint32 i; - CsrUint8 *src = (CsrUint8 *)buf + offset; + u8 *src = (u8 *)buf + offset; CsrUint16 sum = 0; CsrUint16 val; diff --git a/drivers/staging/csr/csr_wifi_lib.h b/drivers/staging/csr/csr_wifi_lib.h index 4c691fc8..e1ef72b 100644 --- a/drivers/staging/csr/csr_wifi_lib.h +++ b/drivers/staging/csr/csr_wifi_lib.h @@ -44,7 +44,7 @@ CsrWifiFsmEvent* CsrWifiEvent_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrS typedef struct { CsrWifiFsmEvent common; - CsrUint8 value; + u8 value; } CsrWifiEventCsrUint8; /*----------------------------------------------------------------------------* @@ -55,7 +55,7 @@ typedef struct * Allocates and fills in a message with the signature CsrWifiEventCsrUint8 * *----------------------------------------------------------------------------*/ -CsrWifiEventCsrUint8* CsrWifiEventCsrUint8_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrSchedQid dst, CsrSchedQid src, CsrUint8 value); +CsrWifiEventCsrUint8* CsrWifiEventCsrUint8_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrSchedQid dst, CsrSchedQid src, u8 value); typedef struct { @@ -93,7 +93,7 @@ typedef struct { CsrWifiFsmEvent common; CsrUint16 value16; - CsrUint8 value8; + u8 value8; } CsrWifiEventCsrUint16CsrUint8; /*----------------------------------------------------------------------------* @@ -104,7 +104,7 @@ typedef struct * Allocates and fills in a message with the signature CsrWifiEventCsrUint16CsrUint8 * *----------------------------------------------------------------------------*/ -CsrWifiEventCsrUint16CsrUint8* CsrWifiEventCsrUint16CsrUint8_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrSchedQid dst, CsrSchedQid src, CsrUint16 value16, CsrUint8 value8); +CsrWifiEventCsrUint16CsrUint8* CsrWifiEventCsrUint16CsrUint8_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrSchedQid dst, CsrSchedQid src, CsrUint16 value16, u8 value8); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_wifi_msgconv.h b/drivers/staging/csr/csr_wifi_msgconv.h index d74e595..6029a21 100644 --- a/drivers/staging/csr/csr_wifi_msgconv.h +++ b/drivers/staging/csr/csr_wifi_msgconv.h @@ -21,37 +21,37 @@ extern "C" { #endif -void CsrUint16SerBigEndian(CsrUint8 *ptr, CsrSize *len, CsrUint16 v); -void CsrUint24SerBigEndian(CsrUint8 *ptr, CsrSize *len, CsrUint32 v); -void CsrUint32SerBigEndian(CsrUint8 *ptr, CsrSize *len, CsrUint32 v); +void CsrUint16SerBigEndian(u8 *ptr, CsrSize *len, CsrUint16 v); +void CsrUint24SerBigEndian(u8 *ptr, CsrSize *len, CsrUint32 v); +void CsrUint32SerBigEndian(u8 *ptr, CsrSize *len, CsrUint32 v); -void CsrUint16DesBigEndian(CsrUint16 *v, CsrUint8 *buffer, CsrSize *offset); -void CsrUint24DesBigEndian(CsrUint32 *v, CsrUint8 *buffer, CsrSize *offset); -void CsrUint32DesBigEndian(CsrUint32 *v, CsrUint8 *buffer, CsrSize *offset); +void CsrUint16DesBigEndian(CsrUint16 *v, u8 *buffer, CsrSize *offset); +void CsrUint24DesBigEndian(CsrUint32 *v, u8 *buffer, CsrSize *offset); +void CsrUint32DesBigEndian(CsrUint32 *v, u8 *buffer, CsrSize *offset); -void CsrUint24Ser(CsrUint8 *ptr, CsrSize *len, CsrUint32 v); -void CsrUint24Des(CsrUint32 *v, CsrUint8 *buffer, CsrSize *offset); +void CsrUint24Ser(u8 *ptr, CsrSize *len, CsrUint32 v); +void CsrUint24Des(CsrUint32 *v, u8 *buffer, CsrSize *offset); CsrSize CsrWifiEventSizeof(void *msg); -CsrUint8* CsrWifiEventSer(CsrUint8 *ptr, CsrSize *len, void *msg); -void* CsrWifiEventDes(CsrUint8 *buffer, CsrSize length); +u8* CsrWifiEventSer(u8 *ptr, CsrSize *len, void *msg); +void* CsrWifiEventDes(u8 *buffer, CsrSize length); CsrSize CsrWifiEventCsrUint8Sizeof(void *msg); -CsrUint8* CsrWifiEventCsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg); -void* CsrWifiEventCsrUint8Des(CsrUint8 *buffer, CsrSize length); +u8* CsrWifiEventCsrUint8Ser(u8 *ptr, CsrSize *len, void *msg); +void* CsrWifiEventCsrUint8Des(u8 *buffer, CsrSize length); CsrSize CsrWifiEventCsrUint16Sizeof(void *msg); -CsrUint8* CsrWifiEventCsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg); -void* CsrWifiEventCsrUint16Des(CsrUint8 *buffer, CsrSize length); +u8* CsrWifiEventCsrUint16Ser(u8 *ptr, CsrSize *len, void *msg); +void* CsrWifiEventCsrUint16Des(u8 *buffer, CsrSize length); CsrSize CsrWifiEventCsrUint32Sizeof(void *msg); -CsrUint8* CsrWifiEventCsrUint32Ser(CsrUint8 *ptr, CsrSize *len, void *msg); -void* CsrWifiEventCsrUint32Des(CsrUint8 *buffer, CsrSize length); +u8* CsrWifiEventCsrUint32Ser(u8 *ptr, CsrSize *len, void *msg); +void* CsrWifiEventCsrUint32Des(u8 *buffer, CsrSize length); CsrSize CsrWifiEventCsrUint16CsrUint8Sizeof(void *msg); -CsrUint8* CsrWifiEventCsrUint16CsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg); -void* CsrWifiEventCsrUint16CsrUint8Des(CsrUint8 *buffer, CsrSize length); +u8* CsrWifiEventCsrUint16CsrUint8Ser(u8 *ptr, CsrSize *len, void *msg); +void* CsrWifiEventCsrUint16CsrUint8Des(u8 *buffer, CsrSize length); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_wifi_nme_ap_lib.h b/drivers/staging/csr/csr_wifi_nme_ap_lib.h index aa632d5..2deebdb 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_lib.h +++ b/drivers/staging/csr/csr_wifi_nme_ap_lib.h @@ -475,7 +475,7 @@ extern const CsrCharString *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM msg__->interfaceTag = (interfaceTag__); \ msg__->selectedDevicePasswordId = (selectedDevicePasswordId__); \ msg__->selectedConfigMethod = (selectedConfigMethod__); \ - CsrMemCpy(msg__->pin, (pin__), sizeof(CsrUint8) * 8); + CsrMemCpy(msg__->pin, (pin__), sizeof(u8) * 8); #define CsrWifiNmeApWpsRegisterReqSendTo(dst__, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__) \ { \ diff --git a/drivers/staging/csr/csr_wifi_nme_ap_prim.h b/drivers/staging/csr/csr_wifi_nme_ap_prim.h index 561c2fd..5e08d53 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_prim.h +++ b/drivers/staging/csr/csr_wifi_nme_ap_prim.h @@ -53,7 +53,7 @@ typedef CsrPrim CsrWifiNmeApPrim; - Use the specified passphrase as credential *******************************************************************************/ -typedef CsrUint8 CsrWifiNmeApPersCredentialType; +typedef u8 CsrWifiNmeApPersCredentialType; #define CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK ((CsrWifiNmeApPersCredentialType) 0x00) #define CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE ((CsrWifiNmeApPersCredentialType) 0x01) @@ -81,7 +81,7 @@ typedef struct CsrBool apStrictGtkRekey; CsrUint16 apGmkTimeout; CsrUint16 apResponseTimeout; - CsrUint8 apRetransLimit; + u8 apRetransLimit; } CsrWifiNmeApConfig; /******************************************************************************* @@ -225,7 +225,7 @@ typedef struct CsrUint16 interfaceTag; CsrWifiSmeWpsDpid selectedDevicePasswordId; CsrWifiSmeWpsConfigType selectedConfigMethod; - CsrUint8 pin[8]; + u8 pin[8]; } CsrWifiNmeApWpsRegisterReq; /******************************************************************************* @@ -259,9 +259,9 @@ typedef struct CsrBool cloakSsid; CsrWifiSsid ssid; CsrWifiSmeRadioIF ifIndex; - CsrUint8 channel; + u8 channel; CsrWifiNmeApCredentials apCredentials; - CsrUint8 maxConnections; + u8 maxConnections; CsrWifiSmeApP2pGoConfig p2pGoParam; CsrBool wpsEnabled; } CsrWifiNmeApStartReq; diff --git a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c index 947f86a..cdf33a6 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c +++ b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c @@ -36,13 +36,13 @@ CsrSize CsrWifiNmeApConfigSetReqSizeof(void *msg) bufferSize += 1; /* CsrBool primitive->apConfig.apStrictGtkRekey */ bufferSize += 2; /* CsrUint16 primitive->apConfig.apGmkTimeout */ bufferSize += 2; /* CsrUint16 primitive->apConfig.apResponseTimeout */ - bufferSize += 1; /* CsrUint8 primitive->apConfig.apRetransLimit */ + bufferSize += 1; /* u8 primitive->apConfig.apRetransLimit */ bufferSize += 1; /* CsrWifiSmeApPhySupportMask primitive->apMacConfig.phySupportedBitmap */ bufferSize += 2; /* CsrUint16 primitive->apMacConfig.beaconInterval */ - bufferSize += 1; /* CsrUint8 primitive->apMacConfig.dtimPeriod */ + bufferSize += 1; /* u8 primitive->apMacConfig.dtimPeriod */ bufferSize += 2; /* CsrUint16 primitive->apMacConfig.maxListenInterval */ - bufferSize += 1; /* CsrUint8 primitive->apMacConfig.supportedRatesCount */ - bufferSize += 20; /* CsrUint8 primitive->apMacConfig.supportedRates[20] */ + bufferSize += 1; /* u8 primitive->apMacConfig.supportedRatesCount */ + bufferSize += 20; /* u8 primitive->apMacConfig.supportedRates[20] */ bufferSize += 1; /* CsrWifiSmePreambleType primitive->apMacConfig.preamble */ bufferSize += 1; /* CsrBool primitive->apMacConfig.shortSlotTimeEnabled */ bufferSize += 1; /* CsrWifiSmeCtsProtectionType primitive->apMacConfig.ctsProtectionType */ @@ -51,9 +51,9 @@ CsrSize CsrWifiNmeApConfigSetReqSizeof(void *msg) CsrUint16 i2; for (i2 = 0; i2 < 4; i2++) { - bufferSize += 1; /* CsrUint8 primitive->apMacConfig.wmmApParams[i2].cwMin */ - bufferSize += 1; /* CsrUint8 primitive->apMacConfig.wmmApParams[i2].cwMax */ - bufferSize += 1; /* CsrUint8 primitive->apMacConfig.wmmApParams[i2].aifs */ + bufferSize += 1; /* u8 primitive->apMacConfig.wmmApParams[i2].cwMin */ + bufferSize += 1; /* u8 primitive->apMacConfig.wmmApParams[i2].cwMax */ + bufferSize += 1; /* u8 primitive->apMacConfig.wmmApParams[i2].aifs */ bufferSize += 2; /* CsrUint16 primitive->apMacConfig.wmmApParams[i2].txopLimit */ bufferSize += 1; /* CsrBool primitive->apMacConfig.wmmApParams[i2].admissionControlMandatory */ } @@ -62,76 +62,76 @@ CsrSize CsrWifiNmeApConfigSetReqSizeof(void *msg) CsrUint16 i2; for (i2 = 0; i2 < 4; i2++) { - bufferSize += 1; /* CsrUint8 primitive->apMacConfig.wmmApBcParams[i2].cwMin */ - bufferSize += 1; /* CsrUint8 primitive->apMacConfig.wmmApBcParams[i2].cwMax */ - bufferSize += 1; /* CsrUint8 primitive->apMacConfig.wmmApBcParams[i2].aifs */ + bufferSize += 1; /* u8 primitive->apMacConfig.wmmApBcParams[i2].cwMin */ + bufferSize += 1; /* u8 primitive->apMacConfig.wmmApBcParams[i2].cwMax */ + bufferSize += 1; /* u8 primitive->apMacConfig.wmmApBcParams[i2].aifs */ bufferSize += 2; /* CsrUint16 primitive->apMacConfig.wmmApBcParams[i2].txopLimit */ bufferSize += 1; /* CsrBool primitive->apMacConfig.wmmApBcParams[i2].admissionControlMandatory */ } } bufferSize += 1; /* CsrWifiSmeApAccessType primitive->apMacConfig.accessType */ - bufferSize += 1; /* CsrUint8 primitive->apMacConfig.macAddressListCount */ + bufferSize += 1; /* u8 primitive->apMacConfig.macAddressListCount */ { CsrUint16 i2; for (i2 = 0; i2 < primitive->apMacConfig.macAddressListCount; i2++) { - bufferSize += 6; /* CsrUint8 primitive->apMacConfig.macAddressList[i2].a[6] */ + bufferSize += 6; /* u8 primitive->apMacConfig.macAddressList[i2].a[6] */ } } bufferSize += 1; /* CsrBool primitive->apMacConfig.apHtParams.greenfieldSupported */ bufferSize += 1; /* CsrBool primitive->apMacConfig.apHtParams.shortGi20MHz */ - bufferSize += 1; /* CsrUint8 primitive->apMacConfig.apHtParams.rxStbc */ + bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.rxStbc */ bufferSize += 1; /* CsrBool primitive->apMacConfig.apHtParams.rifsModeAllowed */ - bufferSize += 1; /* CsrUint8 primitive->apMacConfig.apHtParams.htProtection */ + bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.htProtection */ bufferSize += 1; /* CsrBool primitive->apMacConfig.apHtParams.dualCtsProtection */ return bufferSize; } -CsrUint8* CsrWifiNmeApConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiNmeApConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiNmeApConfigSetReq *primitive = (CsrWifiNmeApConfigSetReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->apConfig.apGroupkeyTimeout); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apConfig.apStrictGtkRekey); + CsrUint8Ser(ptr, len, (u8) primitive->apConfig.apStrictGtkRekey); CsrUint16Ser(ptr, len, (CsrUint16) primitive->apConfig.apGmkTimeout); CsrUint16Ser(ptr, len, (CsrUint16) primitive->apConfig.apResponseTimeout); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apConfig.apRetransLimit); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.phySupportedBitmap); + CsrUint8Ser(ptr, len, (u8) primitive->apConfig.apRetransLimit); + CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.phySupportedBitmap); CsrUint16Ser(ptr, len, (CsrUint16) primitive->apMacConfig.beaconInterval); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.dtimPeriod); + CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.dtimPeriod); CsrUint16Ser(ptr, len, (CsrUint16) primitive->apMacConfig.maxListenInterval); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.supportedRatesCount); + CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.supportedRatesCount); CsrMemCpySer(ptr, len, (const void *) primitive->apMacConfig.supportedRates, ((CsrUint16) (20))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.preamble); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.shortSlotTimeEnabled); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.ctsProtectionType); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.wmmEnabled); + CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.preamble); + CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.shortSlotTimeEnabled); + CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.ctsProtectionType); + CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmEnabled); { CsrUint16 i2; for (i2 = 0; i2 < 4; i2++) { - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.wmmApParams[i2].cwMin); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.wmmApParams[i2].cwMax); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.wmmApParams[i2].aifs); + CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApParams[i2].cwMin); + CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApParams[i2].cwMax); + CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApParams[i2].aifs); CsrUint16Ser(ptr, len, (CsrUint16) primitive->apMacConfig.wmmApParams[i2].txopLimit); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.wmmApParams[i2].admissionControlMandatory); + CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApParams[i2].admissionControlMandatory); } } { CsrUint16 i2; for (i2 = 0; i2 < 4; i2++) { - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.wmmApBcParams[i2].cwMin); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.wmmApBcParams[i2].cwMax); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.wmmApBcParams[i2].aifs); + CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApBcParams[i2].cwMin); + CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApBcParams[i2].cwMax); + CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApBcParams[i2].aifs); CsrUint16Ser(ptr, len, (CsrUint16) primitive->apMacConfig.wmmApBcParams[i2].txopLimit); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.wmmApBcParams[i2].admissionControlMandatory); + CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApBcParams[i2].admissionControlMandatory); } } - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.accessType); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.macAddressListCount); + CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.accessType); + CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.macAddressListCount); { CsrUint16 i2; for (i2 = 0; i2 < primitive->apMacConfig.macAddressListCount; i2++) @@ -139,17 +139,17 @@ CsrUint8* CsrWifiNmeApConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) CsrMemCpySer(ptr, len, (const void *) primitive->apMacConfig.macAddressList[i2].a, ((CsrUint16) (6))); } } - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.apHtParams.greenfieldSupported); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.apHtParams.shortGi20MHz); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.apHtParams.rxStbc); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.apHtParams.rifsModeAllowed); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.apHtParams.htProtection); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apMacConfig.apHtParams.dualCtsProtection); + CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.greenfieldSupported); + CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.shortGi20MHz); + CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.rxStbc); + CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.rifsModeAllowed); + CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.htProtection); + CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.dualCtsProtection); return(ptr); } -void* CsrWifiNmeApConfigSetReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiNmeApConfigSetReqDes(u8 *buffer, CsrSize length) { CsrWifiNmeApConfigSetReq *primitive = (CsrWifiNmeApConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApConfigSetReq)); CsrSize offset; @@ -157,44 +157,44 @@ void* CsrWifiNmeApConfigSetReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->apConfig.apGroupkeyTimeout, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apConfig.apStrictGtkRekey, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apConfig.apStrictGtkRekey, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->apConfig.apGmkTimeout, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->apConfig.apResponseTimeout, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apConfig.apRetransLimit, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.phySupportedBitmap, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apConfig.apRetransLimit, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apMacConfig.phySupportedBitmap, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->apMacConfig.beaconInterval, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.dtimPeriod, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apMacConfig.dtimPeriod, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->apMacConfig.maxListenInterval, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.supportedRatesCount, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apMacConfig.supportedRatesCount, buffer, &offset); CsrMemCpyDes(primitive->apMacConfig.supportedRates, buffer, &offset, ((CsrUint16) (20))); - CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.preamble, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.shortSlotTimeEnabled, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.ctsProtectionType, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.wmmEnabled, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apMacConfig.preamble, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apMacConfig.shortSlotTimeEnabled, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apMacConfig.ctsProtectionType, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apMacConfig.wmmEnabled, buffer, &offset); { CsrUint16 i2; for (i2 = 0; i2 < 4; i2++) { - CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.wmmApParams[i2].cwMin, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.wmmApParams[i2].cwMax, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.wmmApParams[i2].aifs, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApParams[i2].cwMin, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApParams[i2].cwMax, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApParams[i2].aifs, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->apMacConfig.wmmApParams[i2].txopLimit, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.wmmApParams[i2].admissionControlMandatory, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApParams[i2].admissionControlMandatory, buffer, &offset); } } { CsrUint16 i2; for (i2 = 0; i2 < 4; i2++) { - CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.wmmApBcParams[i2].cwMin, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.wmmApBcParams[i2].cwMax, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.wmmApBcParams[i2].aifs, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApBcParams[i2].cwMin, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApBcParams[i2].cwMax, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApBcParams[i2].aifs, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->apMacConfig.wmmApBcParams[i2].txopLimit, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.wmmApBcParams[i2].admissionControlMandatory, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApBcParams[i2].admissionControlMandatory, buffer, &offset); } } - CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.accessType, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.macAddressListCount, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apMacConfig.accessType, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apMacConfig.macAddressListCount, buffer, &offset); primitive->apMacConfig.macAddressList = NULL; if (primitive->apMacConfig.macAddressListCount) { @@ -207,12 +207,12 @@ void* CsrWifiNmeApConfigSetReqDes(CsrUint8 *buffer, CsrSize length) CsrMemCpyDes(primitive->apMacConfig.macAddressList[i2].a, buffer, &offset, ((CsrUint16) (6))); } } - CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.apHtParams.greenfieldSupported, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.apHtParams.shortGi20MHz, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.apHtParams.rxStbc, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.apHtParams.rifsModeAllowed, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.apHtParams.htProtection, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apMacConfig.apHtParams.dualCtsProtection, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.greenfieldSupported, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.shortGi20MHz, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.rxStbc, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.rifsModeAllowed, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.htProtection, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.dualCtsProtection, buffer, &offset); return primitive; } @@ -234,12 +234,12 @@ CsrSize CsrWifiNmeApWpsRegisterReqSizeof(void *msg) bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiSmeWpsDpid primitive->selectedDevicePasswordId */ bufferSize += 2; /* CsrWifiSmeWpsConfigType primitive->selectedConfigMethod */ - bufferSize += 8; /* CsrUint8 primitive->pin[8] */ + bufferSize += 8; /* u8 primitive->pin[8] */ return bufferSize; } -CsrUint8* CsrWifiNmeApWpsRegisterReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiNmeApWpsRegisterReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiNmeApWpsRegisterReq *primitive = (CsrWifiNmeApWpsRegisterReq *)msg; *len = 0; @@ -252,7 +252,7 @@ CsrUint8* CsrWifiNmeApWpsRegisterReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiNmeApWpsRegisterReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiNmeApWpsRegisterReqDes(u8 *buffer, CsrSize length) { CsrWifiNmeApWpsRegisterReq *primitive = (CsrWifiNmeApWpsRegisterReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApWpsRegisterReq)); CsrSize offset; @@ -277,15 +277,15 @@ CsrSize CsrWifiNmeApStartReqSizeof(void *msg) bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiSmeApType primitive->apType */ bufferSize += 1; /* CsrBool primitive->cloakSsid */ - bufferSize += 32; /* CsrUint8 primitive->ssid.ssid[32] */ - bufferSize += 1; /* CsrUint8 primitive->ssid.length */ + bufferSize += 32; /* u8 primitive->ssid.ssid[32] */ + bufferSize += 1; /* u8 primitive->ssid.length */ bufferSize += 1; /* CsrWifiSmeRadioIF primitive->ifIndex */ - bufferSize += 1; /* CsrUint8 primitive->channel */ + bufferSize += 1; /* u8 primitive->channel */ bufferSize += 1; /* CsrWifiSmeApAuthType primitive->apCredentials.authType */ switch (primitive->apCredentials.authType) { case CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM: - bufferSize += 1; /* CsrUint8 primitive->apCredentials.nmeAuthType.openSystemEmpty.empty */ + bufferSize += 1; /* u8 primitive->apCredentials.nmeAuthType.openSystemEmpty.empty */ break; case CSR_WIFI_SME_AP_AUTH_TYPE_WEP: bufferSize += 1; /* CsrWifiSmeWepCredentialType primitive->apCredentials.nmeAuthType.authwep.wepKeyType */ @@ -293,19 +293,19 @@ CsrSize CsrWifiNmeApStartReqSizeof(void *msg) { case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128: bufferSize += 1; /* CsrWifiSmeWepAuthMode primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.wepAuthType */ - bufferSize += 1; /* CsrUint8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.selectedWepKey */ - bufferSize += 13; /* CsrUint8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key1[13] */ - bufferSize += 13; /* CsrUint8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key2[13] */ - bufferSize += 13; /* CsrUint8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key3[13] */ - bufferSize += 13; /* CsrUint8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key4[13] */ + bufferSize += 1; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.selectedWepKey */ + bufferSize += 13; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key1[13] */ + bufferSize += 13; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key2[13] */ + bufferSize += 13; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key3[13] */ + bufferSize += 13; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key4[13] */ break; case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64: bufferSize += 1; /* CsrWifiSmeWepAuthMode primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.wepAuthType */ - bufferSize += 1; /* CsrUint8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.selectedWepKey */ - bufferSize += 5; /* CsrUint8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key1[5] */ - bufferSize += 5; /* CsrUint8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key2[5] */ - bufferSize += 5; /* CsrUint8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key3[5] */ - bufferSize += 5; /* CsrUint8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key4[5] */ + bufferSize += 1; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.selectedWepKey */ + bufferSize += 5; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key1[5] */ + bufferSize += 5; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key2[5] */ + bufferSize += 5; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key3[5] */ + bufferSize += 5; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key4[5] */ break; default: break; @@ -320,7 +320,7 @@ CsrSize CsrWifiNmeApStartReqSizeof(void *msg) { case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK: bufferSize += 2; /* CsrUint16 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.encryptionMode */ - bufferSize += 32; /* CsrUint8 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.psk[32] */ + bufferSize += 32; /* u8 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.psk[32] */ break; case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: bufferSize += 2; /* CsrUint16 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.encryptionMode */ @@ -333,21 +333,21 @@ CsrSize CsrWifiNmeApStartReqSizeof(void *msg) default: break; } - bufferSize += 1; /* CsrUint8 primitive->maxConnections */ + bufferSize += 1; /* u8 primitive->maxConnections */ bufferSize += 1; /* CsrWifiSmeP2pGroupCapabilityMask primitive->p2pGoParam.groupCapability */ - bufferSize += 3; /* CsrUint8 primitive->p2pGoParam.operatingChanList.country[3] */ - bufferSize += 1; /* CsrUint8 primitive->p2pGoParam.operatingChanList.channelEntryListCount */ + bufferSize += 3; /* u8 primitive->p2pGoParam.operatingChanList.country[3] */ + bufferSize += 1; /* u8 primitive->p2pGoParam.operatingChanList.channelEntryListCount */ { CsrUint16 i3; for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++) { - bufferSize += 1; /* CsrUint8 primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingClass */ - bufferSize += 1; /* CsrUint8 primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount */ - bufferSize += primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount; /* CsrUint8 primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel */ + bufferSize += 1; /* u8 primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingClass */ + bufferSize += 1; /* u8 primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount */ + bufferSize += primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount; /* u8 primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel */ } } bufferSize += 1; /* CsrBool primitive->p2pGoParam.opPsEnabled */ - bufferSize += 1; /* CsrUint8 primitive->p2pGoParam.ctWindow */ + bufferSize += 1; /* u8 primitive->p2pGoParam.ctWindow */ bufferSize += 1; /* CsrWifiSmeP2pNoaConfigMethod primitive->p2pGoParam.noaConfigMethod */ bufferSize += 1; /* CsrBool primitive->p2pGoParam.allowNoaWithNonP2pDevices */ bufferSize += 1; /* CsrBool primitive->wpsEnabled */ @@ -355,39 +355,39 @@ CsrSize CsrWifiNmeApStartReqSizeof(void *msg) } -CsrUint8* CsrWifiNmeApStartReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiNmeApStartReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiNmeApStartReq *primitive = (CsrWifiNmeApStartReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apType); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->cloakSsid); + CsrUint8Ser(ptr, len, (u8) primitive->apType); + CsrUint8Ser(ptr, len, (u8) primitive->cloakSsid); CsrMemCpySer(ptr, len, (const void *) primitive->ssid.ssid, ((CsrUint16) (32))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->ssid.length); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->ifIndex); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->channel); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apCredentials.authType); + CsrUint8Ser(ptr, len, (u8) primitive->ssid.length); + CsrUint8Ser(ptr, len, (u8) primitive->ifIndex); + CsrUint8Ser(ptr, len, (u8) primitive->channel); + CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.authType); switch (primitive->apCredentials.authType) { case CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM: - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apCredentials.nmeAuthType.openSystemEmpty.empty); + CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.openSystemEmpty.empty); break; case CSR_WIFI_SME_AP_AUTH_TYPE_WEP: - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apCredentials.nmeAuthType.authwep.wepKeyType); + CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepKeyType); switch (primitive->apCredentials.nmeAuthType.authwep.wepKeyType) { case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128: - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.wepAuthType); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.selectedWepKey); + CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.wepAuthType); + CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.selectedWepKey); CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key1, ((CsrUint16) (13))); CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key2, ((CsrUint16) (13))); CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key3, ((CsrUint16) (13))); CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key4, ((CsrUint16) (13))); break; case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64: - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.wepAuthType); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.selectedWepKey); + CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.wepAuthType); + CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.selectedWepKey); CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key1, ((CsrUint16) (5))); CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key2, ((CsrUint16) (5))); CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key3, ((CsrUint16) (5))); @@ -398,10 +398,10 @@ CsrUint8* CsrWifiNmeApStartReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) } break; case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL: - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apCredentials.nmeAuthType.authTypePersonal.authSupport); + CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authTypePersonal.authSupport); CsrUint16Ser(ptr, len, (CsrUint16) primitive->apCredentials.nmeAuthType.authTypePersonal.rsnCapabilities); CsrUint16Ser(ptr, len, (CsrUint16) primitive->apCredentials.nmeAuthType.authTypePersonal.wapiCapabilities); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase); + CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase); switch (primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase) { case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK: @@ -419,32 +419,32 @@ CsrUint8* CsrWifiNmeApStartReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) default: break; } - CsrUint8Ser(ptr, len, (CsrUint8) primitive->maxConnections); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->p2pGoParam.groupCapability); + CsrUint8Ser(ptr, len, (u8) primitive->maxConnections); + CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.groupCapability); CsrMemCpySer(ptr, len, (const void *) primitive->p2pGoParam.operatingChanList.country, ((CsrUint16) (3))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->p2pGoParam.operatingChanList.channelEntryListCount); + CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.operatingChanList.channelEntryListCount); { CsrUint16 i3; for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++) { - CsrUint8Ser(ptr, len, (CsrUint8) primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingClass); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount); + CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingClass); + CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount); if (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount) { CsrMemCpySer(ptr, len, (const void *) primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel, ((CsrUint16) (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount))); } } } - CsrUint8Ser(ptr, len, (CsrUint8) primitive->p2pGoParam.opPsEnabled); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->p2pGoParam.ctWindow); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->p2pGoParam.noaConfigMethod); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->p2pGoParam.allowNoaWithNonP2pDevices); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->wpsEnabled); + CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.opPsEnabled); + CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.ctWindow); + CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.noaConfigMethod); + CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.allowNoaWithNonP2pDevices); + CsrUint8Ser(ptr, len, (u8) primitive->wpsEnabled); return(ptr); } -void* CsrWifiNmeApStartReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiNmeApStartReqDes(u8 *buffer, CsrSize length) { CsrWifiNmeApStartReq *primitive = (CsrWifiNmeApStartReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStartReq)); CsrSize offset; @@ -452,33 +452,33 @@ void* CsrWifiNmeApStartReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apType, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->cloakSsid, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apType, buffer, &offset); + CsrUint8Des((u8 *) &primitive->cloakSsid, buffer, &offset); CsrMemCpyDes(primitive->ssid.ssid, buffer, &offset, ((CsrUint16) (32))); - CsrUint8Des((CsrUint8 *) &primitive->ssid.length, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->ifIndex, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->channel, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apCredentials.authType, buffer, &offset); + CsrUint8Des((u8 *) &primitive->ssid.length, buffer, &offset); + CsrUint8Des((u8 *) &primitive->ifIndex, buffer, &offset); + CsrUint8Des((u8 *) &primitive->channel, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apCredentials.authType, buffer, &offset); switch (primitive->apCredentials.authType) { case CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM: - CsrUint8Des((CsrUint8 *) &primitive->apCredentials.nmeAuthType.openSystemEmpty.empty, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.openSystemEmpty.empty, buffer, &offset); break; case CSR_WIFI_SME_AP_AUTH_TYPE_WEP: - CsrUint8Des((CsrUint8 *) &primitive->apCredentials.nmeAuthType.authwep.wepKeyType, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepKeyType, buffer, &offset); switch (primitive->apCredentials.nmeAuthType.authwep.wepKeyType) { case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128: - CsrUint8Des((CsrUint8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.wepAuthType, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.selectedWepKey, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.wepAuthType, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.selectedWepKey, buffer, &offset); CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key1, buffer, &offset, ((CsrUint16) (13))); CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key2, buffer, &offset, ((CsrUint16) (13))); CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key3, buffer, &offset, ((CsrUint16) (13))); CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key4, buffer, &offset, ((CsrUint16) (13))); break; case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64: - CsrUint8Des((CsrUint8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.wepAuthType, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.selectedWepKey, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.wepAuthType, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.selectedWepKey, buffer, &offset); CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key1, buffer, &offset, ((CsrUint16) (5))); CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key2, buffer, &offset, ((CsrUint16) (5))); CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key3, buffer, &offset, ((CsrUint16) (5))); @@ -489,10 +489,10 @@ void* CsrWifiNmeApStartReqDes(CsrUint8 *buffer, CsrSize length) } break; case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL: - CsrUint8Des((CsrUint8 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.authSupport, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.authSupport, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.rsnCapabilities, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.wapiCapabilities, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase, buffer, &offset); switch (primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase) { case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK: @@ -510,10 +510,10 @@ void* CsrWifiNmeApStartReqDes(CsrUint8 *buffer, CsrSize length) default: break; } - CsrUint8Des((CsrUint8 *) &primitive->maxConnections, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->p2pGoParam.groupCapability, buffer, &offset); + CsrUint8Des((u8 *) &primitive->maxConnections, buffer, &offset); + CsrUint8Des((u8 *) &primitive->p2pGoParam.groupCapability, buffer, &offset); CsrMemCpyDes(primitive->p2pGoParam.operatingChanList.country, buffer, &offset, ((CsrUint16) (3))); - CsrUint8Des((CsrUint8 *) &primitive->p2pGoParam.operatingChanList.channelEntryListCount, buffer, &offset); + CsrUint8Des((u8 *) &primitive->p2pGoParam.operatingChanList.channelEntryListCount, buffer, &offset); primitive->p2pGoParam.operatingChanList.channelEntryList = NULL; if (primitive->p2pGoParam.operatingChanList.channelEntryListCount) { @@ -523,11 +523,11 @@ void* CsrWifiNmeApStartReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16 i3; for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++) { - CsrUint8Des((CsrUint8 *) &primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingClass, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount, buffer, &offset); + CsrUint8Des((u8 *) &primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingClass, buffer, &offset); + CsrUint8Des((u8 *) &primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount, buffer, &offset); if (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount) { - primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel = (CsrUint8 *)CsrPmemAlloc(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount); + primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel = (u8 *)CsrPmemAlloc(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount); CsrMemCpyDes(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel, buffer, &offset, ((CsrUint16) (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount))); } else @@ -536,11 +536,11 @@ void* CsrWifiNmeApStartReqDes(CsrUint8 *buffer, CsrSize length) } } } - CsrUint8Des((CsrUint8 *) &primitive->p2pGoParam.opPsEnabled, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->p2pGoParam.ctWindow, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->p2pGoParam.noaConfigMethod, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->p2pGoParam.allowNoaWithNonP2pDevices, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->wpsEnabled, buffer, &offset); + CsrUint8Des((u8 *) &primitive->p2pGoParam.opPsEnabled, buffer, &offset); + CsrUint8Des((u8 *) &primitive->p2pGoParam.ctWindow, buffer, &offset); + CsrUint8Des((u8 *) &primitive->p2pGoParam.noaConfigMethod, buffer, &offset); + CsrUint8Des((u8 *) &primitive->p2pGoParam.allowNoaWithNonP2pDevices, buffer, &offset); + CsrUint8Des((u8 *) &primitive->wpsEnabled, buffer, &offset); return primitive; } @@ -585,9 +585,9 @@ CsrSize CsrWifiNmeApWmmParamUpdateReqSizeof(void *msg) CsrUint16 i1; for (i1 = 0; i1 < 4; i1++) { - bufferSize += 1; /* CsrUint8 primitive->wmmApParams[i1].cwMin */ - bufferSize += 1; /* CsrUint8 primitive->wmmApParams[i1].cwMax */ - bufferSize += 1; /* CsrUint8 primitive->wmmApParams[i1].aifs */ + bufferSize += 1; /* u8 primitive->wmmApParams[i1].cwMin */ + bufferSize += 1; /* u8 primitive->wmmApParams[i1].cwMax */ + bufferSize += 1; /* u8 primitive->wmmApParams[i1].aifs */ bufferSize += 2; /* CsrUint16 primitive->wmmApParams[i1].txopLimit */ bufferSize += 1; /* CsrBool primitive->wmmApParams[i1].admissionControlMandatory */ } @@ -596,9 +596,9 @@ CsrSize CsrWifiNmeApWmmParamUpdateReqSizeof(void *msg) CsrUint16 i1; for (i1 = 0; i1 < 4; i1++) { - bufferSize += 1; /* CsrUint8 primitive->wmmApBcParams[i1].cwMin */ - bufferSize += 1; /* CsrUint8 primitive->wmmApBcParams[i1].cwMax */ - bufferSize += 1; /* CsrUint8 primitive->wmmApBcParams[i1].aifs */ + bufferSize += 1; /* u8 primitive->wmmApBcParams[i1].cwMin */ + bufferSize += 1; /* u8 primitive->wmmApBcParams[i1].cwMax */ + bufferSize += 1; /* u8 primitive->wmmApBcParams[i1].aifs */ bufferSize += 2; /* CsrUint16 primitive->wmmApBcParams[i1].txopLimit */ bufferSize += 1; /* CsrBool primitive->wmmApBcParams[i1].admissionControlMandatory */ } @@ -607,7 +607,7 @@ CsrSize CsrWifiNmeApWmmParamUpdateReqSizeof(void *msg) } -CsrUint8* CsrWifiNmeApWmmParamUpdateReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiNmeApWmmParamUpdateReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiNmeApWmmParamUpdateReq *primitive = (CsrWifiNmeApWmmParamUpdateReq *)msg; *len = 0; @@ -616,29 +616,29 @@ CsrUint8* CsrWifiNmeApWmmParamUpdateReqSer(CsrUint8 *ptr, CsrSize *len, void *ms CsrUint16 i1; for (i1 = 0; i1 < 4; i1++) { - CsrUint8Ser(ptr, len, (CsrUint8) primitive->wmmApParams[i1].cwMin); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->wmmApParams[i1].cwMax); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->wmmApParams[i1].aifs); + CsrUint8Ser(ptr, len, (u8) primitive->wmmApParams[i1].cwMin); + CsrUint8Ser(ptr, len, (u8) primitive->wmmApParams[i1].cwMax); + CsrUint8Ser(ptr, len, (u8) primitive->wmmApParams[i1].aifs); CsrUint16Ser(ptr, len, (CsrUint16) primitive->wmmApParams[i1].txopLimit); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->wmmApParams[i1].admissionControlMandatory); + CsrUint8Ser(ptr, len, (u8) primitive->wmmApParams[i1].admissionControlMandatory); } } { CsrUint16 i1; for (i1 = 0; i1 < 4; i1++) { - CsrUint8Ser(ptr, len, (CsrUint8) primitive->wmmApBcParams[i1].cwMin); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->wmmApBcParams[i1].cwMax); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->wmmApBcParams[i1].aifs); + CsrUint8Ser(ptr, len, (u8) primitive->wmmApBcParams[i1].cwMin); + CsrUint8Ser(ptr, len, (u8) primitive->wmmApBcParams[i1].cwMax); + CsrUint8Ser(ptr, len, (u8) primitive->wmmApBcParams[i1].aifs); CsrUint16Ser(ptr, len, (CsrUint16) primitive->wmmApBcParams[i1].txopLimit); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->wmmApBcParams[i1].admissionControlMandatory); + CsrUint8Ser(ptr, len, (u8) primitive->wmmApBcParams[i1].admissionControlMandatory); } } return(ptr); } -void* CsrWifiNmeApWmmParamUpdateReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiNmeApWmmParamUpdateReqDes(u8 *buffer, CsrSize length) { CsrWifiNmeApWmmParamUpdateReq *primitive = (CsrWifiNmeApWmmParamUpdateReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApWmmParamUpdateReq)); CsrSize offset; @@ -649,22 +649,22 @@ void* CsrWifiNmeApWmmParamUpdateReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16 i1; for (i1 = 0; i1 < 4; i1++) { - CsrUint8Des((CsrUint8 *) &primitive->wmmApParams[i1].cwMin, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->wmmApParams[i1].cwMax, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->wmmApParams[i1].aifs, buffer, &offset); + CsrUint8Des((u8 *) &primitive->wmmApParams[i1].cwMin, buffer, &offset); + CsrUint8Des((u8 *) &primitive->wmmApParams[i1].cwMax, buffer, &offset); + CsrUint8Des((u8 *) &primitive->wmmApParams[i1].aifs, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->wmmApParams[i1].txopLimit, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->wmmApParams[i1].admissionControlMandatory, buffer, &offset); + CsrUint8Des((u8 *) &primitive->wmmApParams[i1].admissionControlMandatory, buffer, &offset); } } { CsrUint16 i1; for (i1 = 0; i1 < 4; i1++) { - CsrUint8Des((CsrUint8 *) &primitive->wmmApBcParams[i1].cwMin, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->wmmApBcParams[i1].cwMax, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->wmmApBcParams[i1].aifs, buffer, &offset); + CsrUint8Des((u8 *) &primitive->wmmApBcParams[i1].cwMin, buffer, &offset); + CsrUint8Des((u8 *) &primitive->wmmApBcParams[i1].cwMax, buffer, &offset); + CsrUint8Des((u8 *) &primitive->wmmApBcParams[i1].aifs, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->wmmApBcParams[i1].txopLimit, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->wmmApBcParams[i1].admissionControlMandatory, buffer, &offset); + CsrUint8Des((u8 *) &primitive->wmmApBcParams[i1].admissionControlMandatory, buffer, &offset); } } @@ -678,25 +678,25 @@ CsrSize CsrWifiNmeApStaRemoveReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ - bufferSize += 6; /* CsrUint8 primitive->staMacAddress.a[6] */ + bufferSize += 6; /* u8 primitive->staMacAddress.a[6] */ bufferSize += 1; /* CsrBool primitive->keepBlocking */ return bufferSize; } -CsrUint8* CsrWifiNmeApStaRemoveReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiNmeApStaRemoveReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiNmeApStaRemoveReq *primitive = (CsrWifiNmeApStaRemoveReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrMemCpySer(ptr, len, (const void *) primitive->staMacAddress.a, ((CsrUint16) (6))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->keepBlocking); + CsrUint8Ser(ptr, len, (u8) primitive->keepBlocking); return(ptr); } -void* CsrWifiNmeApStaRemoveReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiNmeApStaRemoveReqDes(u8 *buffer, CsrSize length) { CsrWifiNmeApStaRemoveReq *primitive = (CsrWifiNmeApStaRemoveReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStaRemoveReq)); CsrSize offset; @@ -705,7 +705,7 @@ void* CsrWifiNmeApStaRemoveReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrMemCpyDes(primitive->staMacAddress.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint8Des((CsrUint8 *) &primitive->keepBlocking, buffer, &offset); + CsrUint8Des((u8 *) &primitive->keepBlocking, buffer, &offset); return primitive; } @@ -722,7 +722,7 @@ CsrSize CsrWifiNmeApWpsRegisterCfmSizeof(void *msg) } -CsrUint8* CsrWifiNmeApWpsRegisterCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiNmeApWpsRegisterCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiNmeApWpsRegisterCfm *primitive = (CsrWifiNmeApWpsRegisterCfm *)msg; *len = 0; @@ -733,7 +733,7 @@ CsrUint8* CsrWifiNmeApWpsRegisterCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiNmeApWpsRegisterCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiNmeApWpsRegisterCfmDes(u8 *buffer, CsrSize length) { CsrWifiNmeApWpsRegisterCfm *primitive = (CsrWifiNmeApWpsRegisterCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApWpsRegisterCfm)); CsrSize offset; @@ -754,13 +754,13 @@ CsrSize CsrWifiNmeApStartCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 40) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 32; /* CsrUint8 primitive->ssid.ssid[32] */ - bufferSize += 1; /* CsrUint8 primitive->ssid.length */ + bufferSize += 32; /* u8 primitive->ssid.ssid[32] */ + bufferSize += 1; /* u8 primitive->ssid.length */ return bufferSize; } -CsrUint8* CsrWifiNmeApStartCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiNmeApStartCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiNmeApStartCfm *primitive = (CsrWifiNmeApStartCfm *)msg; *len = 0; @@ -768,12 +768,12 @@ CsrUint8* CsrWifiNmeApStartCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); CsrMemCpySer(ptr, len, (const void *) primitive->ssid.ssid, ((CsrUint16) (32))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->ssid.length); + CsrUint8Ser(ptr, len, (u8) primitive->ssid.length); return(ptr); } -void* CsrWifiNmeApStartCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiNmeApStartCfmDes(u8 *buffer, CsrSize length) { CsrWifiNmeApStartCfm *primitive = (CsrWifiNmeApStartCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApStartCfm)); CsrSize offset; @@ -783,7 +783,7 @@ void* CsrWifiNmeApStartCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); CsrMemCpyDes(primitive->ssid.ssid, buffer, &offset, ((CsrUint16) (32))); - CsrUint8Des((CsrUint8 *) &primitive->ssid.length, buffer, &offset); + CsrUint8Des((u8 *) &primitive->ssid.length, buffer, &offset); return primitive; } @@ -800,7 +800,7 @@ CsrSize CsrWifiNmeApStopCfmSizeof(void *msg) } -CsrUint8* CsrWifiNmeApStopCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiNmeApStopCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiNmeApStopCfm *primitive = (CsrWifiNmeApStopCfm *)msg; *len = 0; @@ -811,7 +811,7 @@ CsrUint8* CsrWifiNmeApStopCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiNmeApStopCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiNmeApStopCfmDes(u8 *buffer, CsrSize length) { CsrWifiNmeApStopCfm *primitive = (CsrWifiNmeApStopCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopCfm)); CsrSize offset; @@ -837,19 +837,19 @@ CsrSize CsrWifiNmeApStopIndSizeof(void *msg) } -CsrUint8* CsrWifiNmeApStopIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiNmeApStopIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiNmeApStopInd *primitive = (CsrWifiNmeApStopInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->apType); + CsrUint8Ser(ptr, len, (u8) primitive->apType); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); return(ptr); } -void* CsrWifiNmeApStopIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiNmeApStopIndDes(u8 *buffer, CsrSize length) { CsrWifiNmeApStopInd *primitive = (CsrWifiNmeApStopInd *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopInd)); CsrSize offset; @@ -857,7 +857,7 @@ void* CsrWifiNmeApStopIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->apType, buffer, &offset); + CsrUint8Des((u8 *) &primitive->apType, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); return primitive; @@ -871,26 +871,26 @@ CsrSize CsrWifiNmeApStationIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 18) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiSmeMediaStatus primitive->mediaStatus */ - bufferSize += 6; /* CsrUint8 primitive->peerMacAddress.a[6] */ - bufferSize += 6; /* CsrUint8 primitive->peerDeviceAddress.a[6] */ + bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ + bufferSize += 6; /* u8 primitive->peerDeviceAddress.a[6] */ return bufferSize; } -CsrUint8* CsrWifiNmeApStationIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiNmeApStationIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiNmeApStationInd *primitive = (CsrWifiNmeApStationInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->mediaStatus); + CsrUint8Ser(ptr, len, (u8) primitive->mediaStatus); CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); CsrMemCpySer(ptr, len, (const void *) primitive->peerDeviceAddress.a, ((CsrUint16) (6))); return(ptr); } -void* CsrWifiNmeApStationIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiNmeApStationIndDes(u8 *buffer, CsrSize length) { CsrWifiNmeApStationInd *primitive = (CsrWifiNmeApStationInd *) CsrPmemAlloc(sizeof(CsrWifiNmeApStationInd)); CsrSize offset; @@ -898,7 +898,7 @@ void* CsrWifiNmeApStationIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->mediaStatus, buffer, &offset); + CsrUint8Des((u8 *) &primitive->mediaStatus, buffer, &offset); CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); CsrMemCpyDes(primitive->peerDeviceAddress.a, buffer, &offset, ((CsrUint16) (6))); diff --git a/drivers/staging/csr/csr_wifi_nme_ap_serialize.h b/drivers/staging/csr/csr_wifi_nme_ap_serialize.h index d59abf9..563afb1 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_serialize.h +++ b/drivers/staging/csr/csr_wifi_nme_ap_serialize.h @@ -32,18 +32,18 @@ extern "C" { extern void CsrWifiNmeApPfree(void *ptr); -extern CsrUint8* CsrWifiNmeApConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeApConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeApConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeApConfigSetReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeApConfigSetReqSizeof(void *msg); extern void CsrWifiNmeApConfigSetReqSerFree(void *msg); -extern CsrUint8* CsrWifiNmeApWpsRegisterReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeApWpsRegisterReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeApWpsRegisterReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeApWpsRegisterReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeApWpsRegisterReqSizeof(void *msg); #define CsrWifiNmeApWpsRegisterReqSerFree CsrWifiNmeApPfree -extern CsrUint8* CsrWifiNmeApStartReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeApStartReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeApStartReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeApStartReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeApStartReqSizeof(void *msg); extern void CsrWifiNmeApStartReqSerFree(void *msg); @@ -52,13 +52,13 @@ extern void CsrWifiNmeApStartReqSerFree(void *msg); #define CsrWifiNmeApStopReqSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiNmeApStopReqSerFree CsrWifiNmeApPfree -extern CsrUint8* CsrWifiNmeApWmmParamUpdateReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeApWmmParamUpdateReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeApWmmParamUpdateReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeApWmmParamUpdateReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeApWmmParamUpdateReqSizeof(void *msg); #define CsrWifiNmeApWmmParamUpdateReqSerFree CsrWifiNmeApPfree -extern CsrUint8* CsrWifiNmeApStaRemoveReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeApStaRemoveReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeApStaRemoveReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeApStaRemoveReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeApStaRemoveReqSizeof(void *msg); #define CsrWifiNmeApStaRemoveReqSerFree CsrWifiNmeApPfree @@ -67,23 +67,23 @@ extern CsrSize CsrWifiNmeApStaRemoveReqSizeof(void *msg); #define CsrWifiNmeApConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiNmeApConfigSetCfmSerFree CsrWifiNmeApPfree -extern CsrUint8* CsrWifiNmeApWpsRegisterCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeApWpsRegisterCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeApWpsRegisterCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeApWpsRegisterCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeApWpsRegisterCfmSizeof(void *msg); #define CsrWifiNmeApWpsRegisterCfmSerFree CsrWifiNmeApPfree -extern CsrUint8* CsrWifiNmeApStartCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeApStartCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeApStartCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeApStartCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeApStartCfmSizeof(void *msg); #define CsrWifiNmeApStartCfmSerFree CsrWifiNmeApPfree -extern CsrUint8* CsrWifiNmeApStopCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeApStopCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeApStopCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeApStopCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeApStopCfmSizeof(void *msg); #define CsrWifiNmeApStopCfmSerFree CsrWifiNmeApPfree -extern CsrUint8* CsrWifiNmeApStopIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeApStopIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeApStopIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeApStopIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeApStopIndSizeof(void *msg); #define CsrWifiNmeApStopIndSerFree CsrWifiNmeApPfree @@ -92,8 +92,8 @@ extern CsrSize CsrWifiNmeApStopIndSizeof(void *msg); #define CsrWifiNmeApWmmParamUpdateCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiNmeApWmmParamUpdateCfmSerFree CsrWifiNmeApPfree -extern CsrUint8* CsrWifiNmeApStationIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeApStationIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeApStationIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeApStationIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeApStationIndSizeof(void *msg); #define CsrWifiNmeApStationIndSerFree CsrWifiNmeApPfree diff --git a/drivers/staging/csr/csr_wifi_nme_lib.h b/drivers/staging/csr/csr_wifi_nme_lib.h index 897afbf..d7d3c03 100644 --- a/drivers/staging/csr/csr_wifi_nme_lib.h +++ b/drivers/staging/csr/csr_wifi_nme_lib.h @@ -790,8 +790,8 @@ extern const CsrCharString *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWN #define CsrWifiNmeSimUmtsAuthIndCreate(msg__, dst__, src__, rand__, autn__) \ msg__ = (CsrWifiNmeSimUmtsAuthInd *) CsrPmemAlloc(sizeof(CsrWifiNmeSimUmtsAuthInd)); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_UMTS_AUTH_IND, dst__, src__); \ - CsrMemCpy(msg__->rand, (rand__), sizeof(CsrUint8) * 16); \ - CsrMemCpy(msg__->autn, (autn__), sizeof(CsrUint8) * 16); + CsrMemCpy(msg__->rand, (rand__), sizeof(u8) * 16); \ + CsrMemCpy(msg__->autn, (autn__), sizeof(u8) * 16); #define CsrWifiNmeSimUmtsAuthIndSendTo(dst__, src__, rand__, autn__) \ { \ @@ -839,11 +839,11 @@ extern const CsrCharString *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWN CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_UMTS_AUTH_RES, dst__, src__); \ msg__->status = (status__); \ msg__->result = (result__); \ - CsrMemCpy(msg__->umtsCipherKey, (umtsCipherKey__), sizeof(CsrUint8) * 16); \ - CsrMemCpy(msg__->umtsIntegrityKey, (umtsIntegrityKey__), sizeof(CsrUint8) * 16); \ + CsrMemCpy(msg__->umtsCipherKey, (umtsCipherKey__), sizeof(u8) * 16); \ + CsrMemCpy(msg__->umtsIntegrityKey, (umtsIntegrityKey__), sizeof(u8) * 16); \ msg__->resParameterLength = (resParameterLength__); \ msg__->resParameter = (resParameter__); \ - CsrMemCpy(msg__->auts, (auts__), sizeof(CsrUint8) * 14); + CsrMemCpy(msg__->auts, (auts__), sizeof(u8) * 14); #define CsrWifiNmeSimUmtsAuthResSendTo(dst__, src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__) \ { \ @@ -1034,7 +1034,7 @@ extern const CsrCharString *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWN msg__ = (CsrWifiNmeWpsReq *) CsrPmemAlloc(sizeof(CsrWifiNmeWpsReq)); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ - CsrMemCpy(msg__->pin, (pin__), sizeof(CsrUint8) * 8); \ + CsrMemCpy(msg__->pin, (pin__), sizeof(u8) * 8); \ msg__->ssid = (ssid__); \ msg__->bssid = (bssid__); diff --git a/drivers/staging/csr/csr_wifi_nme_prim.h b/drivers/staging/csr/csr_wifi_nme_prim.h index 4d77d2f..79187ba 100644 --- a/drivers/staging/csr/csr_wifi_nme_prim.h +++ b/drivers/staging/csr/csr_wifi_nme_prim.h @@ -101,7 +101,7 @@ typedef CsrUint16 CsrWifiNmeAuthMode; - P2P mode of operation. *******************************************************************************/ -typedef CsrUint8 CsrWifiNmeBssType; +typedef u8 CsrWifiNmeBssType; #define CSR_WIFI_NME_BSS_TYPE_INFRASTRUCTURE ((CsrWifiNmeBssType) 0x00) #define CSR_WIFI_NME_BSS_TYPE_ADHOC ((CsrWifiNmeBssType) 0x01) #define CSR_WIFI_NME_BSS_TYPE_RESERVED ((CsrWifiNmeBssType) 0x02) @@ -120,7 +120,7 @@ typedef CsrUint8 CsrWifiNmeBssType; CSR_WIFI_NME_CCX_OPTION_CCKM - CCX option cckm is set. *******************************************************************************/ -typedef CsrUint8 CsrWifiNmeCcxOptionsMask; +typedef u8 CsrWifiNmeCcxOptionsMask; #define CSR_WIFI_NME_CCX_OPTION_NONE ((CsrWifiNmeCcxOptionsMask) 0x00) #define CSR_WIFI_NME_CCX_OPTION_CCKM ((CsrWifiNmeCcxOptionsMask) 0x01) @@ -137,7 +137,7 @@ typedef CsrUint8 CsrWifiNmeCcxOptionsMask; CSR_WIFI_PIN_ENTRY_ENTER_PIN - *******************************************************************************/ -typedef CsrUint8 CsrWifiNmeConfigAction; +typedef u8 CsrWifiNmeConfigAction; #define CSR_WIFI_PIN_ENTRY_PUSH_BUTTON ((CsrWifiNmeConfigAction) 0x00) #define CSR_WIFI_PIN_ENTRY_DISPLAY_PIN ((CsrWifiNmeConfigAction) 0x01) #define CSR_WIFI_PIN_ENTRY_ENTER_PIN ((CsrWifiNmeConfigAction) 0x02) @@ -163,7 +163,7 @@ typedef CsrUint8 CsrWifiNmeConfigAction; - NME is in the process of disconnecting. *******************************************************************************/ -typedef CsrUint8 CsrWifiNmeConnectionStatus; +typedef u8 CsrWifiNmeConnectionStatus; #define CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_DISCONNECTED ((CsrWifiNmeConnectionStatus) 0x00) #define CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_CONNECTING ((CsrWifiNmeConnectionStatus) 0x01) #define CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_AUTHENTICATING ((CsrWifiNmeConnectionStatus) 0x02) @@ -363,7 +363,7 @@ typedef CsrUint32 CsrWifiNmeIndications; - Unknown Security Error. *******************************************************************************/ -typedef CsrUint8 CsrWifiNmeSecError; +typedef u8 CsrWifiNmeSecError; #define CSR_WIFI_NME_SEC_ERROR_SEC_ERROR_UNKNOWN ((CsrWifiNmeSecError) 0x00) /******************************************************************************* @@ -384,7 +384,7 @@ typedef CsrUint8 CsrWifiNmeSecError; UMTS and GSM authentications. *******************************************************************************/ -typedef CsrUint8 CsrWifiNmeSimCardType; +typedef u8 CsrWifiNmeSimCardType; #define CSR_WIFI_NME_SIM_CARD_TYPE_2G ((CsrWifiNmeSimCardType) 0x01) #define CSR_WIFI_NME_SIM_CARD_TYPE_3G ((CsrWifiNmeSimCardType) 0x02) #define CSR_WIFI_NME_SIM_CARD_TYPE_2G3G ((CsrWifiNmeSimCardType) 0x03) @@ -413,7 +413,7 @@ typedef CsrUint8 CsrWifiNmeSimCardType; aborted. *******************************************************************************/ -typedef CsrUint8 CsrWifiNmeUmtsAuthResult; +typedef u8 CsrWifiNmeUmtsAuthResult; #define CSR_WIFI_NME_UMTS_AUTH_RESULT_SUCCESS ((CsrWifiNmeUmtsAuthResult) 0x00) #define CSR_WIFI_NME_UMTS_AUTH_RESULT_SYNC_FAIL ((CsrWifiNmeUmtsAuthResult) 0x01) #define CSR_WIFI_NME_UMTS_AUTH_RESULT_REJECT ((CsrWifiNmeUmtsAuthResult) 0x02) @@ -449,7 +449,7 @@ typedef CsrUint8 CsrWifiNmeUmtsAuthResult; - WMM AP may deliver a maximum of 6 buffered frames per USP. *******************************************************************************/ -typedef CsrUint8 CsrWifiNmeWmmQosInfo; +typedef u8 CsrWifiNmeWmmQosInfo; #define CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_ALL ((CsrWifiNmeWmmQosInfo) 0x00) #define CSR_WIFI_NME_WMM_QOS_INFO_AC_VO ((CsrWifiNmeWmmQosInfo) 0x01) #define CSR_WIFI_NME_WMM_QOS_INFO_AC_VI ((CsrWifiNmeWmmQosInfo) 0x02) @@ -511,7 +511,7 @@ typedef CsrUint32 CsrWifiNmeNmeIndicationsMask; Mask type for use with the values defined by CsrWifiNmeWmmQosInfo *******************************************************************************/ -typedef CsrUint8 CsrWifiNmeWmmQosInfoMask; +typedef u8 CsrWifiNmeWmmQosInfoMask; /******************************************************************************* @@ -528,7 +528,7 @@ typedef CsrUint8 CsrWifiNmeWmmQosInfoMask; *******************************************************************************/ typedef struct { - CsrUint8 empty; + u8 empty; } CsrWifiNmeEmpty; /******************************************************************************* @@ -566,7 +566,7 @@ typedef struct typedef struct { CsrUint16 encryptionMode; - CsrUint8 psk[32]; + u8 psk[32]; } CsrWifiNmePsk; /******************************************************************************* @@ -595,11 +595,11 @@ typedef struct typedef struct { CsrUint32 certificateLength; - CsrUint8 *certificate; + u8 *certificate; CsrUint16 privateKeyLength; - CsrUint8 *privateKey; + u8 *privateKey; CsrUint32 caCertificateLength; - CsrUint8 *caCertificate; + u8 *caCertificate; } CsrWifiNmeWapiCredentials; /******************************************************************************* @@ -712,17 +712,17 @@ typedef struct CsrCharString *userPassword; CsrCharString *authServerUserIdentity; CsrUint32 clientCertificateLength; - CsrUint8 *clientCertificate; + u8 *clientCertificate; CsrUint32 certificateAuthorityCertificateLength; - CsrUint8 *certificateAuthorityCertificate; + u8 *certificateAuthorityCertificate; CsrUint16 privateKeyLength; - CsrUint8 *privateKey; + u8 *privateKey; CsrCharString *privateKeyPassword; CsrUint32 sessionLength; - CsrUint8 *session; + u8 *session; CsrBool allowPacProvisioning; CsrUint32 pacLength; - CsrUint8 *pac; + u8 *pac; CsrCharString *pacPassword; } CsrWifiNmeEapCredentials; @@ -744,7 +744,7 @@ typedef struct { CsrWifiMacAddress p2pDeviceId; CsrWifiSmeP2pGroupCapabilityMask groupCapabilityMask; - CsrUint8 groupOwnerIntent; + u8 groupOwnerIntent; } CsrWifiNmePeerConfig; /******************************************************************************* @@ -790,11 +790,11 @@ typedef struct typedef struct { CsrWifiSmeAuthModeMask wepAuthType; - CsrUint8 selectedWepKey; - CsrUint8 key1[13]; - CsrUint8 key2[13]; - CsrUint8 key3[13]; - CsrUint8 key4[13]; + u8 selectedWepKey; + u8 key1[13]; + u8 key2[13]; + u8 key3[13]; + u8 key4[13]; } CsrWifiNmeWep128Keys; /******************************************************************************* @@ -819,11 +819,11 @@ typedef struct typedef struct { CsrWifiSmeAuthModeMask wepAuthType; - CsrUint8 selectedWepKey; - CsrUint8 key1[5]; - CsrUint8 key2[5]; - CsrUint8 key3[5]; - CsrUint8 key4[5]; + u8 selectedWepKey; + u8 key1[5]; + u8 key2[5]; + u8 key3[5]; + u8 key4[5]; } CsrWifiNmeWep64Keys; /******************************************************************************* @@ -894,8 +894,8 @@ typedef struct CsrWifiNmeProfileIdentity profileIdentity; CsrWifiNmeWmmQosInfoMask wmmQosInfoMask; CsrWifiNmeBssType bssType; - CsrUint8 channelNo; - CsrUint8 ccxOptionsMask; + u8 channelNo; + u8 ccxOptionsMask; CsrBool cloakedSsid; CsrWifiNmeCredentials credentials; } CsrWifiNmeProfile; @@ -1036,7 +1036,7 @@ typedef struct { CsrWifiFsmEvent common; CsrUint16 interfaceTag; - CsrUint8 profileIdentitysCount; + u8 profileIdentitysCount; CsrWifiNmeProfileIdentity *profileIdentitys; } CsrWifiNmeProfileOrderSetReq; @@ -1088,7 +1088,7 @@ typedef struct { CsrWifiFsmEvent common; CsrUint16 interfaceTag; - CsrUint8 pin[8]; + u8 pin[8]; CsrWifiSsid ssid; CsrWifiMacAddress bssid; } CsrWifiNmeWpsReq; @@ -1186,10 +1186,10 @@ typedef struct { CsrWifiFsmEvent common; CsrResult status; - CsrUint8 kcsLength; - CsrUint8 *kcs; - CsrUint8 sresLength; - CsrUint8 *sres; + u8 kcsLength; + u8 *kcs; + u8 sresLength; + u8 *sres; } CsrWifiNmeSimGsmAuthRes; /******************************************************************************* @@ -1229,11 +1229,11 @@ typedef struct CsrWifiFsmEvent common; CsrResult status; CsrWifiNmeUmtsAuthResult result; - CsrUint8 umtsCipherKey[16]; - CsrUint8 umtsIntegrityKey[16]; - CsrUint8 resParameterLength; - CsrUint8 *resParameter; - CsrUint8 auts[14]; + u8 umtsCipherKey[16]; + u8 umtsIntegrityKey[16]; + u8 resParameterLength; + u8 *resParameter; + u8 auts[14]; } CsrWifiNmeSimUmtsAuthRes; /******************************************************************************* @@ -1399,7 +1399,7 @@ typedef struct CsrWifiFsmEvent common; CsrUint16 interfaceTag; CsrResult status; - CsrUint8 connectAttemptsCount; + u8 connectAttemptsCount; CsrWifiNmeConnectAttempt *connectAttempts; } CsrWifiNmeProfileConnectCfm; @@ -1532,7 +1532,7 @@ typedef struct { CsrWifiFsmEvent common; CsrUint16 interfaceTag; - CsrUint8 connectAttemptsCount; + u8 connectAttemptsCount; CsrWifiNmeConnectAttempt *connectAttempts; } CsrWifiNmeProfileDisconnectInd; @@ -1585,8 +1585,8 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint8 randsLength; - CsrUint8 *rands; + u8 randsLength; + u8 *rands; } CsrWifiNmeSimGsmAuthInd; /******************************************************************************* @@ -1614,8 +1614,8 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint8 rand[16]; - CsrUint8 autn[16]; + u8 rand[16]; + u8 autn[16]; } CsrWifiNmeSimUmtsAuthInd; /******************************************************************************* diff --git a/drivers/staging/csr/csr_wifi_nme_serialize.h b/drivers/staging/csr/csr_wifi_nme_serialize.h index aeca9c8..ecc5674 100644 --- a/drivers/staging/csr/csr_wifi_nme_serialize.h +++ b/drivers/staging/csr/csr_wifi_nme_serialize.h @@ -29,13 +29,13 @@ extern "C" { extern void CsrWifiNmePfree(void *ptr); -extern CsrUint8* CsrWifiNmeProfileSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeProfileSetReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeProfileSetReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeProfileSetReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeProfileSetReqSizeof(void *msg); extern void CsrWifiNmeProfileSetReqSerFree(void *msg); -extern CsrUint8* CsrWifiNmeProfileDeleteReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeProfileDeleteReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeProfileDeleteReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeProfileDeleteReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeProfileDeleteReqSizeof(void *msg); #define CsrWifiNmeProfileDeleteReqSerFree CsrWifiNmePfree @@ -44,18 +44,18 @@ extern CsrSize CsrWifiNmeProfileDeleteReqSizeof(void *msg); #define CsrWifiNmeProfileDeleteAllReqSizeof CsrWifiEventSizeof #define CsrWifiNmeProfileDeleteAllReqSerFree CsrWifiNmePfree -extern CsrUint8* CsrWifiNmeProfileOrderSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeProfileOrderSetReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeProfileOrderSetReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeProfileOrderSetReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeProfileOrderSetReqSizeof(void *msg); extern void CsrWifiNmeProfileOrderSetReqSerFree(void *msg); -extern CsrUint8* CsrWifiNmeProfileConnectReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeProfileConnectReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeProfileConnectReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeProfileConnectReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeProfileConnectReqSizeof(void *msg); #define CsrWifiNmeProfileConnectReqSerFree CsrWifiNmePfree -extern CsrUint8* CsrWifiNmeWpsReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeWpsReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeWpsReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeWpsReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeWpsReqSizeof(void *msg); #define CsrWifiNmeWpsReqSerFree CsrWifiNmePfree @@ -69,23 +69,23 @@ extern CsrSize CsrWifiNmeWpsReqSizeof(void *msg); #define CsrWifiNmeConnectionStatusGetReqSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiNmeConnectionStatusGetReqSerFree CsrWifiNmePfree -extern CsrUint8* CsrWifiNmeSimImsiGetResSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeSimImsiGetResDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeSimImsiGetResSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeSimImsiGetResDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeSimImsiGetResSizeof(void *msg); extern void CsrWifiNmeSimImsiGetResSerFree(void *msg); -extern CsrUint8* CsrWifiNmeSimGsmAuthResSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeSimGsmAuthResDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeSimGsmAuthResSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeSimGsmAuthResDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeSimGsmAuthResSizeof(void *msg); extern void CsrWifiNmeSimGsmAuthResSerFree(void *msg); -extern CsrUint8* CsrWifiNmeSimUmtsAuthResSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeSimUmtsAuthResDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeSimUmtsAuthResSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeSimUmtsAuthResDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeSimUmtsAuthResSizeof(void *msg); extern void CsrWifiNmeSimUmtsAuthResSerFree(void *msg); -extern CsrUint8* CsrWifiNmeWpsConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeWpsConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeWpsConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeWpsConfigSetReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeWpsConfigSetReqSizeof(void *msg); extern void CsrWifiNmeWpsConfigSetReqSerFree(void *msg); @@ -109,38 +109,38 @@ extern void CsrWifiNmeWpsConfigSetReqSerFree(void *msg); #define CsrWifiNmeProfileDeleteAllCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiNmeProfileDeleteAllCfmSerFree CsrWifiNmePfree -extern CsrUint8* CsrWifiNmeProfileOrderSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeProfileOrderSetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeProfileOrderSetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeProfileOrderSetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeProfileOrderSetCfmSizeof(void *msg); #define CsrWifiNmeProfileOrderSetCfmSerFree CsrWifiNmePfree -extern CsrUint8* CsrWifiNmeProfileConnectCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeProfileConnectCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeProfileConnectCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeProfileConnectCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeProfileConnectCfmSizeof(void *msg); extern void CsrWifiNmeProfileConnectCfmSerFree(void *msg); -extern CsrUint8* CsrWifiNmeWpsCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeWpsCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeWpsCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeWpsCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeWpsCfmSizeof(void *msg); extern void CsrWifiNmeWpsCfmSerFree(void *msg); -extern CsrUint8* CsrWifiNmeWpsCancelCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeWpsCancelCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeWpsCancelCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeWpsCancelCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeWpsCancelCfmSizeof(void *msg); #define CsrWifiNmeWpsCancelCfmSerFree CsrWifiNmePfree -extern CsrUint8* CsrWifiNmeConnectionStatusGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeConnectionStatusGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeConnectionStatusGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeConnectionStatusGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeConnectionStatusGetCfmSizeof(void *msg); #define CsrWifiNmeConnectionStatusGetCfmSerFree CsrWifiNmePfree -extern CsrUint8* CsrWifiNmeProfileUpdateIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeProfileUpdateIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeProfileUpdateIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeProfileUpdateIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeProfileUpdateIndSizeof(void *msg); extern void CsrWifiNmeProfileUpdateIndSerFree(void *msg); -extern CsrUint8* CsrWifiNmeProfileDisconnectIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeProfileDisconnectIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeProfileDisconnectIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeProfileDisconnectIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeProfileDisconnectIndSizeof(void *msg); extern void CsrWifiNmeProfileDisconnectIndSerFree(void *msg); @@ -149,13 +149,13 @@ extern void CsrWifiNmeProfileDisconnectIndSerFree(void *msg); #define CsrWifiNmeSimImsiGetIndSizeof CsrWifiEventSizeof #define CsrWifiNmeSimImsiGetIndSerFree CsrWifiNmePfree -extern CsrUint8* CsrWifiNmeSimGsmAuthIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeSimGsmAuthIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeSimGsmAuthIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeSimGsmAuthIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeSimGsmAuthIndSizeof(void *msg); extern void CsrWifiNmeSimGsmAuthIndSerFree(void *msg); -extern CsrUint8* CsrWifiNmeSimUmtsAuthIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeSimUmtsAuthIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiNmeSimUmtsAuthIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiNmeSimUmtsAuthIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiNmeSimUmtsAuthIndSizeof(void *msg); #define CsrWifiNmeSimUmtsAuthIndSerFree CsrWifiNmePfree diff --git a/drivers/staging/csr/csr_wifi_private_common.h b/drivers/staging/csr/csr_wifi_private_common.h index b1d1239..878b23b 100644 --- a/drivers/staging/csr/csr_wifi_private_common.h +++ b/drivers/staging/csr/csr_wifi_private_common.h @@ -72,7 +72,7 @@ extern "C" { /* Common structure for NME and SME to maintain Interface mode*/ -typedef CsrUint8 CsrWifiInterfaceMode; +typedef u8 CsrWifiInterfaceMode; #define CSR_WIFI_MODE_NONE ((CsrWifiInterfaceMode) 0xFF) #define CSR_WIFI_MODE_STA ((CsrWifiInterfaceMode) 0x00) #define CSR_WIFI_MODE_AP ((CsrWifiInterfaceMode) 0x01) diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_prim.h b/drivers/staging/csr/csr_wifi_router_ctrl_prim.h index 810482a..acf10ef 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_prim.h +++ b/drivers/staging/csr/csr_wifi_router_ctrl_prim.h @@ -28,14 +28,14 @@ extern "C" { typedef CsrPrim CsrWifiRouterCtrlPrim; -typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteWrite)(CsrUint8 func, CsrUint32 address, CsrUint8 data); -typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteRead)(CsrUint8 func, CsrUint32 address, CsrUint8 *pdata); -typedef CsrResult (*CsrWifiRouterCtrlRawSdioFirmwareDownload)(CsrUint32 length, const CsrUint8 *pdata); +typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteWrite)(u8 func, CsrUint32 address, u8 data); +typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteRead)(u8 func, CsrUint32 address, u8 *pdata); +typedef CsrResult (*CsrWifiRouterCtrlRawSdioFirmwareDownload)(CsrUint32 length, const u8 *pdata); typedef CsrResult (*CsrWifiRouterCtrlRawSdioReset)(void); typedef CsrResult (*CsrWifiRouterCtrlRawSdioCoreDumpPrepare)(CsrBool suspendSme); -typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteBlockRead)(CsrUint8 func, CsrUint32 address, CsrUint8 *pdata, CsrUint32 length); -typedef CsrResult (*CsrWifiRouterCtrlRawSdioGpRead16)(CsrUint8 func, CsrUint32 address, CsrUint16 *pdata); -typedef CsrResult (*CsrWifiRouterCtrlRawSdioGpWrite16)(CsrUint8 func, CsrUint32 address, CsrUint16 data); +typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteBlockRead)(u8 func, CsrUint32 address, u8 *pdata, CsrUint32 length); +typedef CsrResult (*CsrWifiRouterCtrlRawSdioGpRead16)(u8 func, CsrUint32 address, CsrUint16 *pdata); +typedef CsrResult (*CsrWifiRouterCtrlRawSdioGpWrite16)(u8 func, CsrUint32 address, CsrUint16 data); /******************************************************************************* @@ -51,7 +51,7 @@ typedef CsrResult (*CsrWifiRouterCtrlRawSdioGpWrite16)(CsrUint8 func, CsrUint32 - *******************************************************************************/ -typedef CsrUint8 CsrWifiRouterCtrlBlockAckRole; +typedef u8 CsrWifiRouterCtrlBlockAckRole; #define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR ((CsrWifiRouterCtrlBlockAckRole) 0x00) #define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT ((CsrWifiRouterCtrlBlockAckRole) 0x01) @@ -71,7 +71,7 @@ typedef CsrUint8 CsrWifiRouterCtrlBlockAckRole; - *******************************************************************************/ -typedef CsrUint8 CsrWifiRouterCtrlControlIndication; +typedef u8 CsrWifiRouterCtrlControlIndication; #define CSR_WIFI_ROUTER_CTRL_CONTROL_INDICATION_ERROR ((CsrWifiRouterCtrlControlIndication) 0x01) #define CSR_WIFI_ROUTER_CTRL_CONTROL_INDICATION_EXIT ((CsrWifiRouterCtrlControlIndication) 0x02) #define CSR_WIFI_ROUTER_CTRL_CONTROL_INDICATION_USER_REQUESTED ((CsrWifiRouterCtrlControlIndication) 0x03) @@ -94,7 +94,7 @@ typedef CsrUint8 CsrWifiRouterCtrlControlIndication; - *******************************************************************************/ -typedef CsrUint8 CsrWifiRouterCtrlListAction; +typedef u8 CsrWifiRouterCtrlListAction; #define CSR_WIFI_ROUTER_CTRL_LIST_ACTION_GET ((CsrWifiRouterCtrlListAction) 0x00) #define CSR_WIFI_ROUTER_CTRL_LIST_ACTION_ADD ((CsrWifiRouterCtrlListAction) 0x01) #define CSR_WIFI_ROUTER_CTRL_LIST_ACTION_REMOVE ((CsrWifiRouterCtrlListAction) 0x02) @@ -132,7 +132,7 @@ typedef CsrUint16 CsrWifiRouterCtrlLowPowerMode; - *******************************************************************************/ -typedef CsrUint8 CsrWifiRouterCtrlMediaStatus; +typedef u8 CsrWifiRouterCtrlMediaStatus; #define CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_CONNECTED ((CsrWifiRouterCtrlMediaStatus) 0x00) #define CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_DISCONNECTED ((CsrWifiRouterCtrlMediaStatus) 0x01) @@ -155,7 +155,7 @@ typedef CsrUint8 CsrWifiRouterCtrlMediaStatus; CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI - *******************************************************************************/ -typedef CsrUint8 CsrWifiRouterCtrlMode; +typedef u8 CsrWifiRouterCtrlMode; #define CSR_WIFI_ROUTER_CTRL_MODE_NONE ((CsrWifiRouterCtrlMode) 0x00) #define CSR_WIFI_ROUTER_CTRL_MODE_IBSS ((CsrWifiRouterCtrlMode) 0x01) #define CSR_WIFI_ROUTER_CTRL_MODE_STA ((CsrWifiRouterCtrlMode) 0x02) @@ -182,7 +182,7 @@ typedef CsrUint8 CsrWifiRouterCtrlMode; - *******************************************************************************/ -typedef CsrUint8 CsrWifiRouterCtrlPeerStatus; +typedef u8 CsrWifiRouterCtrlPeerStatus; #define CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE ((CsrWifiRouterCtrlPeerStatus) 0x00) #define CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE ((CsrWifiRouterCtrlPeerStatus) 0x01) #define CSR_WIFI_ROUTER_CTRL_PEER_DISCONNECTED ((CsrWifiRouterCtrlPeerStatus) 0x02) @@ -314,7 +314,7 @@ typedef CsrUint16 CsrWifiRouterCtrlQoSControl; - *******************************************************************************/ -typedef CsrUint8 CsrWifiRouterCtrlQueueConfig; +typedef u8 CsrWifiRouterCtrlQueueConfig; #define CSR_WIFI_ROUTER_CTRL_QUEUE_BE_ENABLE ((CsrWifiRouterCtrlQueueConfig) 0x01) #define CSR_WIFI_ROUTER_CTRL_QUEUE_BK_ENABLE ((CsrWifiRouterCtrlQueueConfig) 0x02) #define CSR_WIFI_ROUTER_CTRL_QUEUE_VI_ENABLE ((CsrWifiRouterCtrlQueueConfig) 0x04) @@ -395,7 +395,7 @@ typedef CsrUint16 CsrWifiRouterCtrlTrafficPacketType; - *******************************************************************************/ -typedef CsrUint8 CsrWifiRouterCtrlTrafficType; +typedef u8 CsrWifiRouterCtrlTrafficType; #define CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_OCCASIONAL ((CsrWifiRouterCtrlTrafficType) 0x00) #define CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_BURSTY ((CsrWifiRouterCtrlTrafficType) 0x01) #define CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_PERIODIC ((CsrWifiRouterCtrlTrafficType) 0x02) @@ -431,7 +431,7 @@ typedef CsrUint16 CsrWifiRouterCtrlPowersaveTypeMask; Mask type for use with the values defined by CsrWifiRouterCtrlQueueConfig *******************************************************************************/ -typedef CsrUint8 CsrWifiRouterCtrlQueueConfigMask; +typedef u8 CsrWifiRouterCtrlQueueConfigMask; /******************************************************************************* NAME @@ -449,7 +449,7 @@ typedef CsrUint16 CsrWifiRouterCtrlRequestorInfo; DESCRIPTION *******************************************************************************/ -typedef CsrUint8 CsrWifiRouterCtrlTrafficStreamId; +typedef u8 CsrWifiRouterCtrlTrafficStreamId; /******************************************************************************* @@ -490,7 +490,7 @@ typedef struct { CsrBool wmmOrQosEnabled; CsrWifiRouterCtrlPowersaveTypeMask powersaveMode; - CsrUint8 maxSpLength; + u8 maxSpLength; CsrUint16 listenIntervalInTus; } CsrWifiRouterCtrlStaInfo; @@ -511,7 +511,7 @@ typedef struct typedef struct { CsrUint32 etherType; - CsrUint8 ipType; + u8 ipType; CsrUint32 udpSourcePort; CsrUint32 udpDestPort; } CsrWifiRouterCtrlTrafficFilter; @@ -539,7 +539,7 @@ typedef struct CsrUint32 txFramesNum; CsrUint32 rxBytesCount; CsrUint32 txBytesCount; - CsrUint8 intervals[11]; + u8 intervals[11]; } CsrWifiRouterCtrlTrafficStats; /******************************************************************************* @@ -709,11 +709,11 @@ typedef struct { CsrWifiFsmEvent common; CsrUint16 mlmeCommandLength; - CsrUint8 *mlmeCommand; + u8 *mlmeCommand; CsrUint16 dataRef1Length; - CsrUint8 *dataRef1; + u8 *dataRef1; CsrUint16 dataRef2Length; - CsrUint8 *dataRef2; + u8 *dataRef2; } CsrWifiRouterCtrlHipReq; /******************************************************************************* @@ -762,7 +762,7 @@ typedef struct CsrWifiRouterCtrlRequestorInfo clientData; CsrResult status; CsrWifiRouterCtrlListAction action; - CsrUint8 getAddressesCount; + u8 getAddressesCount; CsrWifiMacAddress *getAddresses; } CsrWifiRouterCtrlMulticastAddressRes; @@ -859,7 +859,7 @@ typedef struct CsrUint16 interfaceTag; CsrWifiRouterCtrlRequestorInfo clientData; CsrUint16 tclasLength; - CsrUint8 *tclas; + u8 *tclas; } CsrWifiRouterCtrlTclasAddReq; /******************************************************************************* @@ -939,7 +939,7 @@ typedef struct CsrUint16 interfaceTag; CsrWifiRouterCtrlRequestorInfo clientData; CsrUint16 tclasLength; - CsrUint8 *tclas; + u8 *tclas; } CsrWifiRouterCtrlTclasDelReq; /******************************************************************************* @@ -1045,7 +1045,7 @@ typedef struct CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; CsrUint32 dataLength; - CsrUint8 *data; + u8 *data; } CsrWifiRouterCtrlWifiOnReq; /******************************************************************************* @@ -1299,9 +1299,9 @@ typedef struct CsrWifiFsmEvent common; CsrUint16 interfaceTag; CsrUint16 signalLength; - CsrUint8 *signal; + u8 *signal; CsrUint16 dataLength; - CsrUint8 *data; + u8 *data; } CsrWifiRouterCtrlWapiRxPktReq; /******************************************************************************* @@ -1321,7 +1321,7 @@ typedef struct { CsrWifiFsmEvent common; CsrUint16 interfaceTag; - CsrUint8 status; + u8 status; } CsrWifiRouterCtrlWapiMulticastFilterReq; /******************************************************************************* @@ -1341,7 +1341,7 @@ typedef struct { CsrWifiFsmEvent common; CsrUint16 interfaceTag; - CsrUint8 status; + u8 status; } CsrWifiRouterCtrlWapiUnicastFilterReq; /******************************************************************************* @@ -1363,7 +1363,7 @@ typedef struct CsrWifiFsmEvent common; CsrUint16 interfaceTag; CsrUint16 dataLength; - CsrUint8 *data; + u8 *data; } CsrWifiRouterCtrlWapiUnicastTxPktReq; /******************************************************************************* @@ -1408,11 +1408,11 @@ typedef struct { CsrWifiFsmEvent common; CsrUint16 mlmeCommandLength; - CsrUint8 *mlmeCommand; + u8 *mlmeCommand; CsrUint16 dataRef1Length; - CsrUint8 *dataRef1; + u8 *dataRef1; CsrUint16 dataRef2Length; - CsrUint8 *dataRef2; + u8 *dataRef2; } CsrWifiRouterCtrlHipInd; /******************************************************************************* @@ -1437,7 +1437,7 @@ typedef struct CsrWifiRouterCtrlRequestorInfo clientData; CsrUint16 interfaceTag; CsrWifiRouterCtrlListAction action; - CsrUint8 setAddressesCount; + u8 setAddressesCount; CsrWifiMacAddress *setAddresses; } CsrWifiRouterCtrlMulticastAddressInd; @@ -2060,9 +2060,9 @@ typedef struct CsrWifiRouterCtrlRequestorInfo clientData; CsrUint16 interfaceTag; CsrUint16 signalLength; - CsrUint8 *signal; + u8 *signal; CsrUint16 dataLength; - CsrUint8 *data; + u8 *data; } CsrWifiRouterCtrlWapiRxMicCheckInd; /******************************************************************************* @@ -2110,7 +2110,7 @@ typedef struct CsrWifiRouterCtrlRequestorInfo clientData; CsrUint16 interfaceTag; CsrUint16 dataLength; - CsrUint8 *data; + u8 *data; } CsrWifiRouterCtrlWapiUnicastTxEncryptInd; diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c index 3239c9b..7aa96e3 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c @@ -36,19 +36,19 @@ CsrSize CsrWifiRouterCtrlConfigurePowerModeReqSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlConfigurePowerModeReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlConfigurePowerModeReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlConfigurePowerModeReq *primitive = (CsrWifiRouterCtrlConfigurePowerModeReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); CsrUint16Ser(ptr, len, (CsrUint16) primitive->mode); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->wakeHost); + CsrUint8Ser(ptr, len, (u8) primitive->wakeHost); return(ptr); } -void* CsrWifiRouterCtrlConfigurePowerModeReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlConfigurePowerModeReqDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlConfigurePowerModeReq *primitive = (CsrWifiRouterCtrlConfigurePowerModeReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlConfigurePowerModeReq)); CsrSize offset; @@ -57,7 +57,7 @@ void* CsrWifiRouterCtrlConfigurePowerModeReqDes(CsrUint8 *buffer, CsrSize length CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->mode, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->wakeHost, buffer, &offset); + CsrUint8Des((u8 *) &primitive->wakeHost, buffer, &offset); return primitive; } @@ -70,16 +70,16 @@ CsrSize CsrWifiRouterCtrlHipReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */ bufferSize += 2; /* CsrUint16 primitive->mlmeCommandLength */ - bufferSize += primitive->mlmeCommandLength; /* CsrUint8 primitive->mlmeCommand */ + bufferSize += primitive->mlmeCommandLength; /* u8 primitive->mlmeCommand */ bufferSize += 2; /* CsrUint16 primitive->dataRef1Length */ - bufferSize += primitive->dataRef1Length; /* CsrUint8 primitive->dataRef1 */ + bufferSize += primitive->dataRef1Length; /* u8 primitive->dataRef1 */ bufferSize += 2; /* CsrUint16 primitive->dataRef2Length */ - bufferSize += primitive->dataRef2Length; /* CsrUint8 primitive->dataRef2 */ + bufferSize += primitive->dataRef2Length; /* u8 primitive->dataRef2 */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlHipReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlHipReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlHipReq *primitive = (CsrWifiRouterCtrlHipReq *)msg; *len = 0; @@ -103,7 +103,7 @@ CsrUint8* CsrWifiRouterCtrlHipReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlHipReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlHipReqDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlHipReq *primitive = (CsrWifiRouterCtrlHipReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlHipReq)); CsrSize offset; @@ -113,7 +113,7 @@ void* CsrWifiRouterCtrlHipReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->mlmeCommandLength, buffer, &offset); if (primitive->mlmeCommandLength) { - primitive->mlmeCommand = (CsrUint8 *)CsrPmemAlloc(primitive->mlmeCommandLength); + primitive->mlmeCommand = (u8 *)CsrPmemAlloc(primitive->mlmeCommandLength); CsrMemCpyDes(primitive->mlmeCommand, buffer, &offset, ((CsrUint16) (primitive->mlmeCommandLength))); } else @@ -123,7 +123,7 @@ void* CsrWifiRouterCtrlHipReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->dataRef1Length, buffer, &offset); if (primitive->dataRef1Length) { - primitive->dataRef1 = (CsrUint8 *)CsrPmemAlloc(primitive->dataRef1Length); + primitive->dataRef1 = (u8 *)CsrPmemAlloc(primitive->dataRef1Length); CsrMemCpyDes(primitive->dataRef1, buffer, &offset, ((CsrUint16) (primitive->dataRef1Length))); } else @@ -133,7 +133,7 @@ void* CsrWifiRouterCtrlHipReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->dataRef2Length, buffer, &offset); if (primitive->dataRef2Length) { - primitive->dataRef2 = (CsrUint8 *)CsrPmemAlloc(primitive->dataRef2Length); + primitive->dataRef2 = (u8 *)CsrPmemAlloc(primitive->dataRef2Length); CsrMemCpyDes(primitive->dataRef2, buffer, &offset, ((CsrUint16) (primitive->dataRef2Length))); } else @@ -167,19 +167,19 @@ CsrSize CsrWifiRouterCtrlMediaStatusReqSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlMediaStatusReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlMediaStatusReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlMediaStatusReq *primitive = (CsrWifiRouterCtrlMediaStatusReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->mediaStatus); + CsrUint8Ser(ptr, len, (u8) primitive->mediaStatus); return(ptr); } -void* CsrWifiRouterCtrlMediaStatusReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlMediaStatusReqDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlMediaStatusReq *primitive = (CsrWifiRouterCtrlMediaStatusReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMediaStatusReq)); CsrSize offset; @@ -188,7 +188,7 @@ void* CsrWifiRouterCtrlMediaStatusReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->mediaStatus, buffer, &offset); + CsrUint8Des((u8 *) &primitive->mediaStatus, buffer, &offset); return primitive; } @@ -204,19 +204,19 @@ CsrSize CsrWifiRouterCtrlMulticastAddressResSizeof(void *msg) bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* CsrWifiRouterCtrlListAction primitive->action */ - bufferSize += 1; /* CsrUint8 primitive->getAddressesCount */ + bufferSize += 1; /* u8 primitive->getAddressesCount */ { CsrUint16 i1; for (i1 = 0; i1 < primitive->getAddressesCount; i1++) { - bufferSize += 6; /* CsrUint8 primitive->getAddresses[i1].a[6] */ + bufferSize += 6; /* u8 primitive->getAddresses[i1].a[6] */ } } return bufferSize; } -CsrUint8* CsrWifiRouterCtrlMulticastAddressResSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlMulticastAddressResSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlMulticastAddressRes *primitive = (CsrWifiRouterCtrlMulticastAddressRes *)msg; *len = 0; @@ -224,8 +224,8 @@ CsrUint8* CsrWifiRouterCtrlMulticastAddressResSer(CsrUint8 *ptr, CsrSize *len, v CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->action); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->getAddressesCount); + CsrUint8Ser(ptr, len, (u8) primitive->action); + CsrUint8Ser(ptr, len, (u8) primitive->getAddressesCount); { CsrUint16 i1; for (i1 = 0; i1 < primitive->getAddressesCount; i1++) @@ -237,7 +237,7 @@ CsrUint8* CsrWifiRouterCtrlMulticastAddressResSer(CsrUint8 *ptr, CsrSize *len, v } -void* CsrWifiRouterCtrlMulticastAddressResDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlMulticastAddressResDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlMulticastAddressRes *primitive = (CsrWifiRouterCtrlMulticastAddressRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMulticastAddressRes)); CsrSize offset; @@ -247,8 +247,8 @@ void* CsrWifiRouterCtrlMulticastAddressResDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->action, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->getAddressesCount, buffer, &offset); + CsrUint8Des((u8 *) &primitive->action, buffer, &offset); + CsrUint8Des((u8 *) &primitive->getAddressesCount, buffer, &offset); primitive->getAddresses = NULL; if (primitive->getAddressesCount) { @@ -283,13 +283,13 @@ CsrSize CsrWifiRouterCtrlPortConfigureReqSizeof(void *msg) bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrWifiRouterCtrlPortAction primitive->uncontrolledPortAction */ bufferSize += 2; /* CsrWifiRouterCtrlPortAction primitive->controlledPortAction */ - bufferSize += 6; /* CsrUint8 primitive->macAddress.a[6] */ + bufferSize += 6; /* u8 primitive->macAddress.a[6] */ bufferSize += 1; /* CsrBool primitive->setProtection */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlPortConfigureReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlPortConfigureReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlPortConfigureReq *primitive = (CsrWifiRouterCtrlPortConfigureReq *)msg; *len = 0; @@ -299,12 +299,12 @@ CsrUint8* CsrWifiRouterCtrlPortConfigureReqSer(CsrUint8 *ptr, CsrSize *len, void CsrUint16Ser(ptr, len, (CsrUint16) primitive->uncontrolledPortAction); CsrUint16Ser(ptr, len, (CsrUint16) primitive->controlledPortAction); CsrMemCpySer(ptr, len, (const void *) primitive->macAddress.a, ((CsrUint16) (6))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->setProtection); + CsrUint8Ser(ptr, len, (u8) primitive->setProtection); return(ptr); } -void* CsrWifiRouterCtrlPortConfigureReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlPortConfigureReqDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlPortConfigureReq *primitive = (CsrWifiRouterCtrlPortConfigureReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPortConfigureReq)); CsrSize offset; @@ -316,7 +316,7 @@ void* CsrWifiRouterCtrlPortConfigureReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->uncontrolledPortAction, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->controlledPortAction, buffer, &offset); CsrMemCpyDes(primitive->macAddress.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint8Des((CsrUint8 *) &primitive->setProtection, buffer, &offset); + CsrUint8Des((u8 *) &primitive->setProtection, buffer, &offset); return primitive; } @@ -335,7 +335,7 @@ CsrSize CsrWifiRouterCtrlQosControlReqSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlQosControlReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlQosControlReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlQosControlReq *primitive = (CsrWifiRouterCtrlQosControlReq *)msg; *len = 0; @@ -343,12 +343,12 @@ CsrUint8* CsrWifiRouterCtrlQosControlReqSer(CsrUint8 *ptr, CsrSize *len, void *m CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); CsrUint16Ser(ptr, len, (CsrUint16) primitive->control); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->queueConfig); + CsrUint8Ser(ptr, len, (u8) primitive->queueConfig); return(ptr); } -void* CsrWifiRouterCtrlQosControlReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlQosControlReqDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlQosControlReq *primitive = (CsrWifiRouterCtrlQosControlReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlQosControlReq)); CsrSize offset; @@ -358,7 +358,7 @@ void* CsrWifiRouterCtrlQosControlReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->control, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->queueConfig, buffer, &offset); + CsrUint8Des((u8 *) &primitive->queueConfig, buffer, &offset); return primitive; } @@ -375,7 +375,7 @@ CsrSize CsrWifiRouterCtrlSuspendResSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlSuspendResSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlSuspendResSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlSuspendRes *primitive = (CsrWifiRouterCtrlSuspendRes *)msg; *len = 0; @@ -386,7 +386,7 @@ CsrUint8* CsrWifiRouterCtrlSuspendResSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlSuspendResDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlSuspendResDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlSuspendRes *primitive = (CsrWifiRouterCtrlSuspendRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlSuspendRes)); CsrSize offset; @@ -409,12 +409,12 @@ CsrSize CsrWifiRouterCtrlTclasAddReqSizeof(void *msg) bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrUint16 primitive->tclasLength */ - bufferSize += primitive->tclasLength; /* CsrUint8 primitive->tclas */ + bufferSize += primitive->tclasLength; /* u8 primitive->tclas */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlTclasAddReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlTclasAddReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlTclasAddReq *primitive = (CsrWifiRouterCtrlTclasAddReq *)msg; *len = 0; @@ -430,7 +430,7 @@ CsrUint8* CsrWifiRouterCtrlTclasAddReqSer(CsrUint8 *ptr, CsrSize *len, void *msg } -void* CsrWifiRouterCtrlTclasAddReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlTclasAddReqDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlTclasAddReq *primitive = (CsrWifiRouterCtrlTclasAddReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasAddReq)); CsrSize offset; @@ -442,7 +442,7 @@ void* CsrWifiRouterCtrlTclasAddReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->tclasLength, buffer, &offset); if (primitive->tclasLength) { - primitive->tclas = (CsrUint8 *)CsrPmemAlloc(primitive->tclasLength); + primitive->tclas = (u8 *)CsrPmemAlloc(primitive->tclasLength); CsrMemCpyDes(primitive->tclas, buffer, &offset, ((CsrUint16) (primitive->tclasLength))); } else @@ -473,7 +473,7 @@ CsrSize CsrWifiRouterCtrlResumeResSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlResumeResSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlResumeResSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlResumeRes *primitive = (CsrWifiRouterCtrlResumeRes *)msg; *len = 0; @@ -484,7 +484,7 @@ CsrUint8* CsrWifiRouterCtrlResumeResSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlResumeResDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlResumeResDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlResumeRes *primitive = (CsrWifiRouterCtrlResumeRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlResumeRes)); CsrSize offset; @@ -507,12 +507,12 @@ CsrSize CsrWifiRouterCtrlTclasDelReqSizeof(void *msg) bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrUint16 primitive->tclasLength */ - bufferSize += primitive->tclasLength; /* CsrUint8 primitive->tclas */ + bufferSize += primitive->tclasLength; /* u8 primitive->tclas */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlTclasDelReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlTclasDelReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlTclasDelReq *primitive = (CsrWifiRouterCtrlTclasDelReq *)msg; *len = 0; @@ -528,7 +528,7 @@ CsrUint8* CsrWifiRouterCtrlTclasDelReqSer(CsrUint8 *ptr, CsrSize *len, void *msg } -void* CsrWifiRouterCtrlTclasDelReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlTclasDelReqDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlTclasDelReq *primitive = (CsrWifiRouterCtrlTclasDelReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasDelReq)); CsrSize offset; @@ -540,7 +540,7 @@ void* CsrWifiRouterCtrlTclasDelReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->tclasLength, buffer, &offset); if (primitive->tclasLength) { - primitive->tclas = (CsrUint8 *)CsrPmemAlloc(primitive->tclasLength); + primitive->tclas = (u8 *)CsrPmemAlloc(primitive->tclasLength); CsrMemCpyDes(primitive->tclas, buffer, &offset, ((CsrUint16) (primitive->tclasLength))); } else @@ -573,20 +573,20 @@ CsrSize CsrWifiRouterCtrlTrafficClassificationReqSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlTrafficClassificationReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlTrafficClassificationReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlTrafficClassificationReq *primitive = (CsrWifiRouterCtrlTrafficClassificationReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->trafficType); + CsrUint8Ser(ptr, len, (u8) primitive->trafficType); CsrUint16Ser(ptr, len, (CsrUint16) primitive->period); return(ptr); } -void* CsrWifiRouterCtrlTrafficClassificationReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlTrafficClassificationReqDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlTrafficClassificationReq *primitive = (CsrWifiRouterCtrlTrafficClassificationReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficClassificationReq)); CsrSize offset; @@ -595,7 +595,7 @@ void* CsrWifiRouterCtrlTrafficClassificationReqDes(CsrUint8 *buffer, CsrSize len CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->trafficType, buffer, &offset); + CsrUint8Des((u8 *) &primitive->trafficType, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->period, buffer, &offset); return primitive; @@ -612,14 +612,14 @@ CsrSize CsrWifiRouterCtrlTrafficConfigReqSizeof(void *msg) bufferSize += 2; /* CsrWifiRouterCtrlTrafficConfigType primitive->trafficConfigType */ bufferSize += 2; /* CsrUint16 primitive->config.packetFilter */ bufferSize += 4; /* CsrUint32 primitive->config.customFilter.etherType */ - bufferSize += 1; /* CsrUint8 primitive->config.customFilter.ipType */ + bufferSize += 1; /* u8 primitive->config.customFilter.ipType */ bufferSize += 4; /* CsrUint32 primitive->config.customFilter.udpSourcePort */ bufferSize += 4; /* CsrUint32 primitive->config.customFilter.udpDestPort */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlTrafficConfigReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlTrafficConfigReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlTrafficConfigReq *primitive = (CsrWifiRouterCtrlTrafficConfigReq *)msg; *len = 0; @@ -629,14 +629,14 @@ CsrUint8* CsrWifiRouterCtrlTrafficConfigReqSer(CsrUint8 *ptr, CsrSize *len, void CsrUint16Ser(ptr, len, (CsrUint16) primitive->trafficConfigType); CsrUint16Ser(ptr, len, (CsrUint16) primitive->config.packetFilter); CsrUint32Ser(ptr, len, (CsrUint32) primitive->config.customFilter.etherType); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->config.customFilter.ipType); + CsrUint8Ser(ptr, len, (u8) primitive->config.customFilter.ipType); CsrUint32Ser(ptr, len, (CsrUint32) primitive->config.customFilter.udpSourcePort); CsrUint32Ser(ptr, len, (CsrUint32) primitive->config.customFilter.udpDestPort); return(ptr); } -void* CsrWifiRouterCtrlTrafficConfigReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlTrafficConfigReqDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlTrafficConfigReq *primitive = (CsrWifiRouterCtrlTrafficConfigReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficConfigReq)); CsrSize offset; @@ -648,7 +648,7 @@ void* CsrWifiRouterCtrlTrafficConfigReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->trafficConfigType, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->config.packetFilter, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->config.customFilter.etherType, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->config.customFilter.ipType, buffer, &offset); + CsrUint8Des((u8 *) &primitive->config.customFilter.ipType, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->config.customFilter.udpSourcePort, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->config.customFilter.udpDestPort, buffer, &offset); @@ -664,12 +664,12 @@ CsrSize CsrWifiRouterCtrlWifiOnReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 4; /* CsrUint32 primitive->dataLength */ - bufferSize += primitive->dataLength; /* CsrUint8 primitive->data */ + bufferSize += primitive->dataLength; /* u8 primitive->data */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlWifiOnReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlWifiOnReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlWifiOnReq *primitive = (CsrWifiRouterCtrlWifiOnReq *)msg; *len = 0; @@ -684,7 +684,7 @@ CsrUint8* CsrWifiRouterCtrlWifiOnReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlWifiOnReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlWifiOnReqDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlWifiOnReq *primitive = (CsrWifiRouterCtrlWifiOnReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnReq)); CsrSize offset; @@ -695,7 +695,7 @@ void* CsrWifiRouterCtrlWifiOnReqDes(CsrUint8 *buffer, CsrSize length) CsrUint32Des((CsrUint32 *) &primitive->dataLength, buffer, &offset); if (primitive->dataLength) { - primitive->data = (CsrUint8 *)CsrPmemAlloc(primitive->dataLength); + primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); CsrMemCpyDes(primitive->data, buffer, &offset, ((CsrUint16) (primitive->dataLength))); } else @@ -728,7 +728,7 @@ CsrSize CsrWifiRouterCtrlWifiOnResSizeof(void *msg) CsrUint16 i1; for (i1 = 0; i1 < 2; i1++) { - bufferSize += 6; /* CsrUint8 primitive->stationMacAddress[i1].a[6] */ + bufferSize += 6; /* u8 primitive->stationMacAddress[i1].a[6] */ } } bufferSize += 4; /* CsrUint32 primitive->smeVersions.firmwarePatch */ @@ -739,7 +739,7 @@ CsrSize CsrWifiRouterCtrlWifiOnResSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlWifiOnResSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlWifiOnResSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlWifiOnRes *primitive = (CsrWifiRouterCtrlWifiOnRes *)msg; *len = 0; @@ -757,12 +757,12 @@ CsrUint8* CsrWifiRouterCtrlWifiOnResSer(CsrUint8 *ptr, CsrSize *len, void *msg) CsrUint32Ser(ptr, len, (CsrUint32) primitive->smeVersions.firmwarePatch); CsrCharStringSer(ptr, len, primitive->smeVersions.smeBuild); CsrUint32Ser(ptr, len, (CsrUint32) primitive->smeVersions.smeHip); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scheduledInterrupt); + CsrUint8Ser(ptr, len, (u8) primitive->scheduledInterrupt); return(ptr); } -void* CsrWifiRouterCtrlWifiOnResDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlWifiOnResDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlWifiOnRes *primitive = (CsrWifiRouterCtrlWifiOnRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnRes)); CsrSize offset; @@ -782,7 +782,7 @@ void* CsrWifiRouterCtrlWifiOnResDes(CsrUint8 *buffer, CsrSize length) CsrUint32Des((CsrUint32 *) &primitive->smeVersions.firmwarePatch, buffer, &offset); CsrCharStringDes(&primitive->smeVersions.smeBuild, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->smeVersions.smeHip, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->scheduledInterrupt, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scheduledInterrupt, buffer, &offset); return primitive; } @@ -807,7 +807,7 @@ CsrSize CsrWifiRouterCtrlM4TransmitReqSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlM4TransmitReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlM4TransmitReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlM4TransmitReq *primitive = (CsrWifiRouterCtrlM4TransmitReq *)msg; *len = 0; @@ -818,7 +818,7 @@ CsrUint8* CsrWifiRouterCtrlM4TransmitReqSer(CsrUint8 *ptr, CsrSize *len, void *m } -void* CsrWifiRouterCtrlM4TransmitReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlM4TransmitReqDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlM4TransmitReq *primitive = (CsrWifiRouterCtrlM4TransmitReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlM4TransmitReq)); CsrSize offset; @@ -840,29 +840,29 @@ CsrSize CsrWifiRouterCtrlModeSetReqSizeof(void *msg) bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 1; /* CsrWifiRouterCtrlMode primitive->mode */ - bufferSize += 6; /* CsrUint8 primitive->bssid.a[6] */ + bufferSize += 6; /* u8 primitive->bssid.a[6] */ bufferSize += 1; /* CsrBool primitive->protection */ bufferSize += 1; /* CsrBool primitive->intraBssDistEnabled */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlModeSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlModeSetReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlModeSetReq *primitive = (CsrWifiRouterCtrlModeSetReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->mode); + CsrUint8Ser(ptr, len, (u8) primitive->mode); CsrMemCpySer(ptr, len, (const void *) primitive->bssid.a, ((CsrUint16) (6))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->protection); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->intraBssDistEnabled); + CsrUint8Ser(ptr, len, (u8) primitive->protection); + CsrUint8Ser(ptr, len, (u8) primitive->intraBssDistEnabled); return(ptr); } -void* CsrWifiRouterCtrlModeSetReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlModeSetReqDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlModeSetReq *primitive = (CsrWifiRouterCtrlModeSetReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlModeSetReq)); CsrSize offset; @@ -871,10 +871,10 @@ void* CsrWifiRouterCtrlModeSetReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->mode, buffer, &offset); + CsrUint8Des((u8 *) &primitive->mode, buffer, &offset); CsrMemCpyDes(primitive->bssid.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint8Des((CsrUint8 *) &primitive->protection, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->intraBssDistEnabled, buffer, &offset); + CsrUint8Des((u8 *) &primitive->protection, buffer, &offset); + CsrUint8Des((u8 *) &primitive->intraBssDistEnabled, buffer, &offset); return primitive; } @@ -887,17 +887,17 @@ CsrSize CsrWifiRouterCtrlPeerAddReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 21) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 6; /* CsrUint8 primitive->peerMacAddress.a[6] */ + bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ bufferSize += 2; /* CsrUint16 primitive->associationId */ bufferSize += 1; /* CsrBool primitive->staInfo.wmmOrQosEnabled */ bufferSize += 2; /* CsrWifiRouterCtrlPowersaveTypeMask primitive->staInfo.powersaveMode */ - bufferSize += 1; /* CsrUint8 primitive->staInfo.maxSpLength */ + bufferSize += 1; /* u8 primitive->staInfo.maxSpLength */ bufferSize += 2; /* CsrUint16 primitive->staInfo.listenIntervalInTus */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlPeerAddReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlPeerAddReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlPeerAddReq *primitive = (CsrWifiRouterCtrlPeerAddReq *)msg; *len = 0; @@ -906,15 +906,15 @@ CsrUint8* CsrWifiRouterCtrlPeerAddReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); CsrUint16Ser(ptr, len, (CsrUint16) primitive->associationId); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->staInfo.wmmOrQosEnabled); + CsrUint8Ser(ptr, len, (u8) primitive->staInfo.wmmOrQosEnabled); CsrUint16Ser(ptr, len, (CsrUint16) primitive->staInfo.powersaveMode); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->staInfo.maxSpLength); + CsrUint8Ser(ptr, len, (u8) primitive->staInfo.maxSpLength); CsrUint16Ser(ptr, len, (CsrUint16) primitive->staInfo.listenIntervalInTus); return(ptr); } -void* CsrWifiRouterCtrlPeerAddReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlPeerAddReqDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlPeerAddReq *primitive = (CsrWifiRouterCtrlPeerAddReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerAddReq)); CsrSize offset; @@ -925,9 +925,9 @@ void* CsrWifiRouterCtrlPeerAddReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); CsrUint16Des((CsrUint16 *) &primitive->associationId, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->staInfo.wmmOrQosEnabled, buffer, &offset); + CsrUint8Des((u8 *) &primitive->staInfo.wmmOrQosEnabled, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->staInfo.powersaveMode, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->staInfo.maxSpLength, buffer, &offset); + CsrUint8Des((u8 *) &primitive->staInfo.maxSpLength, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->staInfo.listenIntervalInTus, buffer, &offset); return primitive; @@ -946,7 +946,7 @@ CsrSize CsrWifiRouterCtrlPeerDelReqSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlPeerDelReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlPeerDelReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlPeerDelReq *primitive = (CsrWifiRouterCtrlPeerDelReq *)msg; *len = 0; @@ -958,7 +958,7 @@ CsrUint8* CsrWifiRouterCtrlPeerDelReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlPeerDelReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlPeerDelReqDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlPeerDelReq *primitive = (CsrWifiRouterCtrlPeerDelReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerDelReq)); CsrSize offset; @@ -986,7 +986,7 @@ CsrSize CsrWifiRouterCtrlPeerUpdateReqSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlPeerUpdateReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlPeerUpdateReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlPeerUpdateReq *primitive = (CsrWifiRouterCtrlPeerUpdateReq *)msg; *len = 0; @@ -999,7 +999,7 @@ CsrUint8* CsrWifiRouterCtrlPeerUpdateReqSer(CsrUint8 *ptr, CsrSize *len, void *m } -void* CsrWifiRouterCtrlPeerUpdateReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlPeerUpdateReqDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlPeerUpdateReq *primitive = (CsrWifiRouterCtrlPeerUpdateReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerUpdateReq)); CsrSize offset; @@ -1022,7 +1022,7 @@ CsrSize CsrWifiRouterCtrlBlockAckEnableReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 21) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 6; /* CsrUint8 primitive->macAddress.a[6] */ + bufferSize += 6; /* u8 primitive->macAddress.a[6] */ bufferSize += 1; /* CsrWifiRouterCtrlTrafficStreamId primitive->trafficStreamID */ bufferSize += 1; /* CsrWifiRouterCtrlBlockAckRole primitive->role */ bufferSize += 2; /* CsrUint16 primitive->bufferSize */ @@ -1032,7 +1032,7 @@ CsrSize CsrWifiRouterCtrlBlockAckEnableReqSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlBlockAckEnableReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlBlockAckEnableReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlBlockAckEnableReq *primitive = (CsrWifiRouterCtrlBlockAckEnableReq *)msg; *len = 0; @@ -1040,8 +1040,8 @@ CsrUint8* CsrWifiRouterCtrlBlockAckEnableReqSer(CsrUint8 *ptr, CsrSize *len, voi CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); CsrMemCpySer(ptr, len, (const void *) primitive->macAddress.a, ((CsrUint16) (6))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->trafficStreamID); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->role); + CsrUint8Ser(ptr, len, (u8) primitive->trafficStreamID); + CsrUint8Ser(ptr, len, (u8) primitive->role); CsrUint16Ser(ptr, len, (CsrUint16) primitive->bufferSize); CsrUint16Ser(ptr, len, (CsrUint16) primitive->timeout); CsrUint16Ser(ptr, len, (CsrUint16) primitive->ssn); @@ -1049,7 +1049,7 @@ CsrUint8* CsrWifiRouterCtrlBlockAckEnableReqSer(CsrUint8 *ptr, CsrSize *len, voi } -void* CsrWifiRouterCtrlBlockAckEnableReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlBlockAckEnableReqDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlBlockAckEnableReq *primitive = (CsrWifiRouterCtrlBlockAckEnableReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckEnableReq)); CsrSize offset; @@ -1059,8 +1059,8 @@ void* CsrWifiRouterCtrlBlockAckEnableReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); CsrMemCpyDes(primitive->macAddress.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint8Des((CsrUint8 *) &primitive->trafficStreamID, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->role, buffer, &offset); + CsrUint8Des((u8 *) &primitive->trafficStreamID, buffer, &offset); + CsrUint8Des((u8 *) &primitive->role, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->bufferSize, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->timeout, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->ssn, buffer, &offset); @@ -1076,14 +1076,14 @@ CsrSize CsrWifiRouterCtrlBlockAckDisableReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 6; /* CsrUint8 primitive->macAddress.a[6] */ + bufferSize += 6; /* u8 primitive->macAddress.a[6] */ bufferSize += 1; /* CsrWifiRouterCtrlTrafficStreamId primitive->trafficStreamID */ bufferSize += 1; /* CsrWifiRouterCtrlBlockAckRole primitive->role */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlBlockAckDisableReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlBlockAckDisableReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlBlockAckDisableReq *primitive = (CsrWifiRouterCtrlBlockAckDisableReq *)msg; *len = 0; @@ -1091,13 +1091,13 @@ CsrUint8* CsrWifiRouterCtrlBlockAckDisableReqSer(CsrUint8 *ptr, CsrSize *len, vo CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); CsrMemCpySer(ptr, len, (const void *) primitive->macAddress.a, ((CsrUint16) (6))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->trafficStreamID); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->role); + CsrUint8Ser(ptr, len, (u8) primitive->trafficStreamID); + CsrUint8Ser(ptr, len, (u8) primitive->role); return(ptr); } -void* CsrWifiRouterCtrlBlockAckDisableReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlBlockAckDisableReqDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlBlockAckDisableReq *primitive = (CsrWifiRouterCtrlBlockAckDisableReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckDisableReq)); CsrSize offset; @@ -1107,8 +1107,8 @@ void* CsrWifiRouterCtrlBlockAckDisableReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); CsrMemCpyDes(primitive->macAddress.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint8Des((CsrUint8 *) &primitive->trafficStreamID, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->role, buffer, &offset); + CsrUint8Des((u8 *) &primitive->trafficStreamID, buffer, &offset); + CsrUint8Des((u8 *) &primitive->role, buffer, &offset); return primitive; } @@ -1122,14 +1122,14 @@ CsrSize CsrWifiRouterCtrlWapiRxPktReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrUint16 primitive->signalLength */ - bufferSize += primitive->signalLength; /* CsrUint8 primitive->signal */ + bufferSize += primitive->signalLength; /* u8 primitive->signal */ bufferSize += 2; /* CsrUint16 primitive->dataLength */ - bufferSize += primitive->dataLength; /* CsrUint8 primitive->data */ + bufferSize += primitive->dataLength; /* u8 primitive->data */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlWapiRxPktReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlWapiRxPktReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlWapiRxPktReq *primitive = (CsrWifiRouterCtrlWapiRxPktReq *)msg; *len = 0; @@ -1149,7 +1149,7 @@ CsrUint8* CsrWifiRouterCtrlWapiRxPktReqSer(CsrUint8 *ptr, CsrSize *len, void *ms } -void* CsrWifiRouterCtrlWapiRxPktReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlWapiRxPktReqDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlWapiRxPktReq *primitive = (CsrWifiRouterCtrlWapiRxPktReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiRxPktReq)); CsrSize offset; @@ -1160,7 +1160,7 @@ void* CsrWifiRouterCtrlWapiRxPktReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->signalLength, buffer, &offset); if (primitive->signalLength) { - primitive->signal = (CsrUint8 *)CsrPmemAlloc(primitive->signalLength); + primitive->signal = (u8 *)CsrPmemAlloc(primitive->signalLength); CsrMemCpyDes(primitive->signal, buffer, &offset, ((CsrUint16) (primitive->signalLength))); } else @@ -1170,7 +1170,7 @@ void* CsrWifiRouterCtrlWapiRxPktReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->dataLength, buffer, &offset); if (primitive->dataLength) { - primitive->data = (CsrUint8 *)CsrPmemAlloc(primitive->dataLength); + primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); CsrMemCpyDes(primitive->data, buffer, &offset, ((CsrUint16) (primitive->dataLength))); } else @@ -1199,12 +1199,12 @@ CsrSize CsrWifiRouterCtrlWapiUnicastTxPktReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrUint16 primitive->dataLength */ - bufferSize += primitive->dataLength; /* CsrUint8 primitive->data */ + bufferSize += primitive->dataLength; /* u8 primitive->data */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlWapiUnicastTxPktReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlWapiUnicastTxPktReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlWapiUnicastTxPktReq *primitive = (CsrWifiRouterCtrlWapiUnicastTxPktReq *)msg; *len = 0; @@ -1219,7 +1219,7 @@ CsrUint8* CsrWifiRouterCtrlWapiUnicastTxPktReqSer(CsrUint8 *ptr, CsrSize *len, v } -void* CsrWifiRouterCtrlWapiUnicastTxPktReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlWapiUnicastTxPktReqDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlWapiUnicastTxPktReq *primitive = (CsrWifiRouterCtrlWapiUnicastTxPktReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxPktReq)); CsrSize offset; @@ -1230,7 +1230,7 @@ void* CsrWifiRouterCtrlWapiUnicastTxPktReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->dataLength, buffer, &offset); if (primitive->dataLength) { - primitive->data = (CsrUint8 *)CsrPmemAlloc(primitive->dataLength); + primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); CsrMemCpyDes(primitive->data, buffer, &offset, ((CsrUint16) (primitive->dataLength))); } else @@ -1257,16 +1257,16 @@ CsrSize CsrWifiRouterCtrlHipIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */ bufferSize += 2; /* CsrUint16 primitive->mlmeCommandLength */ - bufferSize += primitive->mlmeCommandLength; /* CsrUint8 primitive->mlmeCommand */ + bufferSize += primitive->mlmeCommandLength; /* u8 primitive->mlmeCommand */ bufferSize += 2; /* CsrUint16 primitive->dataRef1Length */ - bufferSize += primitive->dataRef1Length; /* CsrUint8 primitive->dataRef1 */ + bufferSize += primitive->dataRef1Length; /* u8 primitive->dataRef1 */ bufferSize += 2; /* CsrUint16 primitive->dataRef2Length */ - bufferSize += primitive->dataRef2Length; /* CsrUint8 primitive->dataRef2 */ + bufferSize += primitive->dataRef2Length; /* u8 primitive->dataRef2 */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlHipIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlHipIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlHipInd *primitive = (CsrWifiRouterCtrlHipInd *)msg; *len = 0; @@ -1290,7 +1290,7 @@ CsrUint8* CsrWifiRouterCtrlHipIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlHipIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlHipIndDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlHipInd *primitive = (CsrWifiRouterCtrlHipInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlHipInd)); CsrSize offset; @@ -1300,7 +1300,7 @@ void* CsrWifiRouterCtrlHipIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->mlmeCommandLength, buffer, &offset); if (primitive->mlmeCommandLength) { - primitive->mlmeCommand = (CsrUint8 *)CsrPmemAlloc(primitive->mlmeCommandLength); + primitive->mlmeCommand = (u8 *)CsrPmemAlloc(primitive->mlmeCommandLength); CsrMemCpyDes(primitive->mlmeCommand, buffer, &offset, ((CsrUint16) (primitive->mlmeCommandLength))); } else @@ -1310,7 +1310,7 @@ void* CsrWifiRouterCtrlHipIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->dataRef1Length, buffer, &offset); if (primitive->dataRef1Length) { - primitive->dataRef1 = (CsrUint8 *)CsrPmemAlloc(primitive->dataRef1Length); + primitive->dataRef1 = (u8 *)CsrPmemAlloc(primitive->dataRef1Length); CsrMemCpyDes(primitive->dataRef1, buffer, &offset, ((CsrUint16) (primitive->dataRef1Length))); } else @@ -1320,7 +1320,7 @@ void* CsrWifiRouterCtrlHipIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->dataRef2Length, buffer, &offset); if (primitive->dataRef2Length) { - primitive->dataRef2 = (CsrUint8 *)CsrPmemAlloc(primitive->dataRef2Length); + primitive->dataRef2 = (u8 *)CsrPmemAlloc(primitive->dataRef2Length); CsrMemCpyDes(primitive->dataRef2, buffer, &offset, ((CsrUint16) (primitive->dataRef2Length))); } else @@ -1351,27 +1351,27 @@ CsrSize CsrWifiRouterCtrlMulticastAddressIndSizeof(void *msg) bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiRouterCtrlListAction primitive->action */ - bufferSize += 1; /* CsrUint8 primitive->setAddressesCount */ + bufferSize += 1; /* u8 primitive->setAddressesCount */ { CsrUint16 i1; for (i1 = 0; i1 < primitive->setAddressesCount; i1++) { - bufferSize += 6; /* CsrUint8 primitive->setAddresses[i1].a[6] */ + bufferSize += 6; /* u8 primitive->setAddresses[i1].a[6] */ } } return bufferSize; } -CsrUint8* CsrWifiRouterCtrlMulticastAddressIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlMulticastAddressIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlMulticastAddressInd *primitive = (CsrWifiRouterCtrlMulticastAddressInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->action); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->setAddressesCount); + CsrUint8Ser(ptr, len, (u8) primitive->action); + CsrUint8Ser(ptr, len, (u8) primitive->setAddressesCount); { CsrUint16 i1; for (i1 = 0; i1 < primitive->setAddressesCount; i1++) @@ -1383,7 +1383,7 @@ CsrUint8* CsrWifiRouterCtrlMulticastAddressIndSer(CsrUint8 *ptr, CsrSize *len, v } -void* CsrWifiRouterCtrlMulticastAddressIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlMulticastAddressIndDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlMulticastAddressInd *primitive = (CsrWifiRouterCtrlMulticastAddressInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMulticastAddressInd)); CsrSize offset; @@ -1392,8 +1392,8 @@ void* CsrWifiRouterCtrlMulticastAddressIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->action, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->setAddressesCount, buffer, &offset); + CsrUint8Des((u8 *) &primitive->action, buffer, &offset); + CsrUint8Des((u8 *) &primitive->setAddressesCount, buffer, &offset); primitive->setAddresses = NULL; if (primitive->setAddressesCount) { @@ -1427,12 +1427,12 @@ CsrSize CsrWifiRouterCtrlPortConfigureCfmSizeof(void *msg) bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 6; /* CsrUint8 primitive->macAddress.a[6] */ + bufferSize += 6; /* u8 primitive->macAddress.a[6] */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlPortConfigureCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlPortConfigureCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlPortConfigureCfm *primitive = (CsrWifiRouterCtrlPortConfigureCfm *)msg; *len = 0; @@ -1445,7 +1445,7 @@ CsrUint8* CsrWifiRouterCtrlPortConfigureCfmSer(CsrUint8 *ptr, CsrSize *len, void } -void* CsrWifiRouterCtrlPortConfigureCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlPortConfigureCfmDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlPortConfigureCfm *primitive = (CsrWifiRouterCtrlPortConfigureCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPortConfigureCfm)); CsrSize offset; @@ -1473,19 +1473,19 @@ CsrSize CsrWifiRouterCtrlSuspendIndSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlSuspendIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlSuspendIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlSuspendInd *primitive = (CsrWifiRouterCtrlSuspendInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->hardSuspend); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->d3Suspend); + CsrUint8Ser(ptr, len, (u8) primitive->hardSuspend); + CsrUint8Ser(ptr, len, (u8) primitive->d3Suspend); return(ptr); } -void* CsrWifiRouterCtrlSuspendIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlSuspendIndDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlSuspendInd *primitive = (CsrWifiRouterCtrlSuspendInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlSuspendInd)); CsrSize offset; @@ -1493,8 +1493,8 @@ void* CsrWifiRouterCtrlSuspendIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->hardSuspend, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->d3Suspend, buffer, &offset); + CsrUint8Des((u8 *) &primitive->hardSuspend, buffer, &offset); + CsrUint8Des((u8 *) &primitive->d3Suspend, buffer, &offset); return primitive; } @@ -1512,7 +1512,7 @@ CsrSize CsrWifiRouterCtrlTclasAddCfmSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlTclasAddCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlTclasAddCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlTclasAddCfm *primitive = (CsrWifiRouterCtrlTclasAddCfm *)msg; *len = 0; @@ -1524,7 +1524,7 @@ CsrUint8* CsrWifiRouterCtrlTclasAddCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg } -void* CsrWifiRouterCtrlTclasAddCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlTclasAddCfmDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlTclasAddCfm *primitive = (CsrWifiRouterCtrlTclasAddCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasAddCfm)); CsrSize offset; @@ -1550,7 +1550,7 @@ CsrSize CsrWifiRouterCtrlRawSdioDeinitialiseCfmSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlRawSdioDeinitialiseCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlRawSdioDeinitialiseCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlRawSdioDeinitialiseCfm *primitive = (CsrWifiRouterCtrlRawSdioDeinitialiseCfm *)msg; *len = 0; @@ -1561,7 +1561,7 @@ CsrUint8* CsrWifiRouterCtrlRawSdioDeinitialiseCfmSer(CsrUint8 *ptr, CsrSize *len } -void* CsrWifiRouterCtrlRawSdioDeinitialiseCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlRawSdioDeinitialiseCfmDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlRawSdioDeinitialiseCfm *primitive = (CsrWifiRouterCtrlRawSdioDeinitialiseCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlRawSdioDeinitialiseCfm)); CsrSize offset; @@ -1594,7 +1594,7 @@ CsrSize CsrWifiRouterCtrlRawSdioInitialiseCfmSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlRawSdioInitialiseCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlRawSdioInitialiseCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlRawSdioInitialiseCfm *primitive = (CsrWifiRouterCtrlRawSdioInitialiseCfm *)msg; *len = 0; @@ -1613,7 +1613,7 @@ CsrUint8* CsrWifiRouterCtrlRawSdioInitialiseCfmSer(CsrUint8 *ptr, CsrSize *len, } -void* CsrWifiRouterCtrlRawSdioInitialiseCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlRawSdioInitialiseCfmDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlRawSdioInitialiseCfm *primitive = (CsrWifiRouterCtrlRawSdioInitialiseCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlRawSdioInitialiseCfm)); CsrSize offset; @@ -1655,7 +1655,7 @@ CsrSize CsrWifiRouterCtrlTclasDelCfmSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlTclasDelCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlTclasDelCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlTclasDelCfm *primitive = (CsrWifiRouterCtrlTclasDelCfm *)msg; *len = 0; @@ -1667,7 +1667,7 @@ CsrUint8* CsrWifiRouterCtrlTclasDelCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg } -void* CsrWifiRouterCtrlTclasDelCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlTclasDelCfmDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlTclasDelCfm *primitive = (CsrWifiRouterCtrlTclasDelCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasDelCfm)); CsrSize offset; @@ -1691,12 +1691,12 @@ CsrSize CsrWifiRouterCtrlTrafficProtocolIndSizeof(void *msg) bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiRouterCtrlTrafficPacketType primitive->packetType */ bufferSize += 2; /* CsrWifiRouterCtrlProtocolDirection primitive->direction */ - bufferSize += 6; /* CsrUint8 primitive->srcAddress.a[6] */ + bufferSize += 6; /* u8 primitive->srcAddress.a[6] */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlTrafficProtocolIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlTrafficProtocolIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlTrafficProtocolInd *primitive = (CsrWifiRouterCtrlTrafficProtocolInd *)msg; *len = 0; @@ -1710,7 +1710,7 @@ CsrUint8* CsrWifiRouterCtrlTrafficProtocolIndSer(CsrUint8 *ptr, CsrSize *len, vo } -void* CsrWifiRouterCtrlTrafficProtocolIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlTrafficProtocolIndDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlTrafficProtocolInd *primitive = (CsrWifiRouterCtrlTrafficProtocolInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficProtocolInd)); CsrSize offset; @@ -1739,12 +1739,12 @@ CsrSize CsrWifiRouterCtrlTrafficSampleIndSizeof(void *msg) bufferSize += 4; /* CsrUint32 primitive->stats.txFramesNum */ bufferSize += 4; /* CsrUint32 primitive->stats.rxBytesCount */ bufferSize += 4; /* CsrUint32 primitive->stats.txBytesCount */ - bufferSize += 11; /* CsrUint8 primitive->stats.intervals[11] */ + bufferSize += 11; /* u8 primitive->stats.intervals[11] */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlTrafficSampleIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlTrafficSampleIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlTrafficSampleInd *primitive = (CsrWifiRouterCtrlTrafficSampleInd *)msg; *len = 0; @@ -1761,7 +1761,7 @@ CsrUint8* CsrWifiRouterCtrlTrafficSampleIndSer(CsrUint8 *ptr, CsrSize *len, void } -void* CsrWifiRouterCtrlTrafficSampleIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlTrafficSampleIndDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlTrafficSampleInd *primitive = (CsrWifiRouterCtrlTrafficSampleInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficSampleInd)); CsrSize offset; @@ -1799,7 +1799,7 @@ CsrSize CsrWifiRouterCtrlWifiOnIndSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlWifiOnIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlWifiOnIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlWifiOnInd *primitive = (CsrWifiRouterCtrlWifiOnInd *)msg; *len = 0; @@ -1816,7 +1816,7 @@ CsrUint8* CsrWifiRouterCtrlWifiOnIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlWifiOnIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlWifiOnIndDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlWifiOnInd *primitive = (CsrWifiRouterCtrlWifiOnInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnInd)); CsrSize offset; @@ -1855,7 +1855,7 @@ CsrSize CsrWifiRouterCtrlWifiOnCfmSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlWifiOnCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlWifiOnCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlWifiOnCfm *primitive = (CsrWifiRouterCtrlWifiOnCfm *)msg; *len = 0; @@ -1866,7 +1866,7 @@ CsrUint8* CsrWifiRouterCtrlWifiOnCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlWifiOnCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlWifiOnCfmDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlWifiOnCfm *primitive = (CsrWifiRouterCtrlWifiOnCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnCfm)); CsrSize offset; @@ -1887,12 +1887,12 @@ CsrSize CsrWifiRouterCtrlM4ReadyToSendIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ - bufferSize += 6; /* CsrUint8 primitive->peerMacAddress.a[6] */ + bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlM4ReadyToSendIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlM4ReadyToSendIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlM4ReadyToSendInd *primitive = (CsrWifiRouterCtrlM4ReadyToSendInd *)msg; *len = 0; @@ -1904,7 +1904,7 @@ CsrUint8* CsrWifiRouterCtrlM4ReadyToSendIndSer(CsrUint8 *ptr, CsrSize *len, void } -void* CsrWifiRouterCtrlM4ReadyToSendIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlM4ReadyToSendIndDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlM4ReadyToSendInd *primitive = (CsrWifiRouterCtrlM4ReadyToSendInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlM4ReadyToSendInd)); CsrSize offset; @@ -1926,13 +1926,13 @@ CsrSize CsrWifiRouterCtrlM4TransmittedIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ - bufferSize += 6; /* CsrUint8 primitive->peerMacAddress.a[6] */ + bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ bufferSize += 2; /* CsrResult primitive->status */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlM4TransmittedIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlM4TransmittedIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlM4TransmittedInd *primitive = (CsrWifiRouterCtrlM4TransmittedInd *)msg; *len = 0; @@ -1945,7 +1945,7 @@ CsrUint8* CsrWifiRouterCtrlM4TransmittedIndSer(CsrUint8 *ptr, CsrSize *len, void } -void* CsrWifiRouterCtrlM4TransmittedIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlM4TransmittedIndDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlM4TransmittedInd *primitive = (CsrWifiRouterCtrlM4TransmittedInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlM4TransmittedInd)); CsrSize offset; @@ -1968,13 +1968,13 @@ CsrSize CsrWifiRouterCtrlMicFailureIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ - bufferSize += 6; /* CsrUint8 primitive->peerMacAddress.a[6] */ + bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ bufferSize += 1; /* CsrBool primitive->unicastPdu */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlMicFailureIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlMicFailureIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlMicFailureInd *primitive = (CsrWifiRouterCtrlMicFailureInd *)msg; *len = 0; @@ -1982,12 +1982,12 @@ CsrUint8* CsrWifiRouterCtrlMicFailureIndSer(CsrUint8 *ptr, CsrSize *len, void *m CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->unicastPdu); + CsrUint8Ser(ptr, len, (u8) primitive->unicastPdu); return(ptr); } -void* CsrWifiRouterCtrlMicFailureIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlMicFailureIndDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlMicFailureInd *primitive = (CsrWifiRouterCtrlMicFailureInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMicFailureInd)); CsrSize offset; @@ -1997,7 +1997,7 @@ void* CsrWifiRouterCtrlMicFailureIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint8Des((CsrUint8 *) &primitive->unicastPdu, buffer, &offset); + CsrUint8Des((u8 *) &primitive->unicastPdu, buffer, &offset); return primitive; } @@ -2010,13 +2010,13 @@ CsrSize CsrWifiRouterCtrlConnectedIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ - bufferSize += 6; /* CsrUint8 primitive->peerMacAddress.a[6] */ + bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ bufferSize += 1; /* CsrWifiRouterCtrlPeerStatus primitive->peerStatus */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlConnectedIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlConnectedIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlConnectedInd *primitive = (CsrWifiRouterCtrlConnectedInd *)msg; *len = 0; @@ -2024,12 +2024,12 @@ CsrUint8* CsrWifiRouterCtrlConnectedIndSer(CsrUint8 *ptr, CsrSize *len, void *ms CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->peerStatus); + CsrUint8Ser(ptr, len, (u8) primitive->peerStatus); return(ptr); } -void* CsrWifiRouterCtrlConnectedIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlConnectedIndDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlConnectedInd *primitive = (CsrWifiRouterCtrlConnectedInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlConnectedInd)); CsrSize offset; @@ -2039,7 +2039,7 @@ void* CsrWifiRouterCtrlConnectedIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint8Des((CsrUint8 *) &primitive->peerStatus, buffer, &offset); + CsrUint8Des((u8 *) &primitive->peerStatus, buffer, &offset); return primitive; } @@ -2052,14 +2052,14 @@ CsrSize CsrWifiRouterCtrlPeerAddCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 19) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ - bufferSize += 6; /* CsrUint8 primitive->peerMacAddress.a[6] */ + bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ bufferSize += 4; /* CsrWifiRouterCtrlPeerRecordHandle primitive->peerRecordHandle */ bufferSize += 2; /* CsrResult primitive->status */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlPeerAddCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlPeerAddCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlPeerAddCfm *primitive = (CsrWifiRouterCtrlPeerAddCfm *)msg; *len = 0; @@ -2073,7 +2073,7 @@ CsrUint8* CsrWifiRouterCtrlPeerAddCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlPeerAddCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlPeerAddCfmDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlPeerAddCfm *primitive = (CsrWifiRouterCtrlPeerAddCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerAddCfm)); CsrSize offset; @@ -2102,7 +2102,7 @@ CsrSize CsrWifiRouterCtrlPeerDelCfmSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlPeerDelCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlPeerDelCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlPeerDelCfm *primitive = (CsrWifiRouterCtrlPeerDelCfm *)msg; *len = 0; @@ -2114,7 +2114,7 @@ CsrUint8* CsrWifiRouterCtrlPeerDelCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlPeerDelCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlPeerDelCfmDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlPeerDelCfm *primitive = (CsrWifiRouterCtrlPeerDelCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerDelCfm)); CsrSize offset; @@ -2136,12 +2136,12 @@ CsrSize CsrWifiRouterCtrlUnexpectedFrameIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ - bufferSize += 6; /* CsrUint8 primitive->peerMacAddress.a[6] */ + bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlUnexpectedFrameIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlUnexpectedFrameIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlUnexpectedFrameInd *primitive = (CsrWifiRouterCtrlUnexpectedFrameInd *)msg; *len = 0; @@ -2153,7 +2153,7 @@ CsrUint8* CsrWifiRouterCtrlUnexpectedFrameIndSer(CsrUint8 *ptr, CsrSize *len, vo } -void* CsrWifiRouterCtrlUnexpectedFrameIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlUnexpectedFrameIndDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlUnexpectedFrameInd *primitive = (CsrWifiRouterCtrlUnexpectedFrameInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlUnexpectedFrameInd)); CsrSize offset; @@ -2180,7 +2180,7 @@ CsrSize CsrWifiRouterCtrlPeerUpdateCfmSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlPeerUpdateCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlPeerUpdateCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlPeerUpdateCfm *primitive = (CsrWifiRouterCtrlPeerUpdateCfm *)msg; *len = 0; @@ -2192,7 +2192,7 @@ CsrUint8* CsrWifiRouterCtrlPeerUpdateCfmSer(CsrUint8 *ptr, CsrSize *len, void *m } -void* CsrWifiRouterCtrlPeerUpdateCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlPeerUpdateCfmDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlPeerUpdateCfm *primitive = (CsrWifiRouterCtrlPeerUpdateCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerUpdateCfm)); CsrSize offset; @@ -2219,7 +2219,7 @@ CsrSize CsrWifiRouterCtrlCapabilitiesCfmSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlCapabilitiesCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlCapabilitiesCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlCapabilitiesCfm *primitive = (CsrWifiRouterCtrlCapabilitiesCfm *)msg; *len = 0; @@ -2231,7 +2231,7 @@ CsrUint8* CsrWifiRouterCtrlCapabilitiesCfmSer(CsrUint8 *ptr, CsrSize *len, void } -void* CsrWifiRouterCtrlCapabilitiesCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlCapabilitiesCfmDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlCapabilitiesCfm *primitive = (CsrWifiRouterCtrlCapabilitiesCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlCapabilitiesCfm)); CsrSize offset; @@ -2258,7 +2258,7 @@ CsrSize CsrWifiRouterCtrlBlockAckEnableCfmSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlBlockAckEnableCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlBlockAckEnableCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlBlockAckEnableCfm *primitive = (CsrWifiRouterCtrlBlockAckEnableCfm *)msg; *len = 0; @@ -2270,7 +2270,7 @@ CsrUint8* CsrWifiRouterCtrlBlockAckEnableCfmSer(CsrUint8 *ptr, CsrSize *len, voi } -void* CsrWifiRouterCtrlBlockAckEnableCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlBlockAckEnableCfmDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlBlockAckEnableCfm *primitive = (CsrWifiRouterCtrlBlockAckEnableCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckEnableCfm)); CsrSize offset; @@ -2297,7 +2297,7 @@ CsrSize CsrWifiRouterCtrlBlockAckDisableCfmSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlBlockAckDisableCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlBlockAckDisableCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlBlockAckDisableCfm *primitive = (CsrWifiRouterCtrlBlockAckDisableCfm *)msg; *len = 0; @@ -2309,7 +2309,7 @@ CsrUint8* CsrWifiRouterCtrlBlockAckDisableCfmSer(CsrUint8 *ptr, CsrSize *len, vo } -void* CsrWifiRouterCtrlBlockAckDisableCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlBlockAckDisableCfmDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlBlockAckDisableCfm *primitive = (CsrWifiRouterCtrlBlockAckDisableCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckDisableCfm)); CsrSize offset; @@ -2332,27 +2332,27 @@ CsrSize CsrWifiRouterCtrlBlockAckErrorIndSizeof(void *msg) bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiRouterCtrlTrafficStreamId primitive->trafficStreamID */ - bufferSize += 6; /* CsrUint8 primitive->peerMacAddress.a[6] */ + bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ bufferSize += 2; /* CsrResult primitive->status */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlBlockAckErrorIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlBlockAckErrorIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlBlockAckErrorInd *primitive = (CsrWifiRouterCtrlBlockAckErrorInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->trafficStreamID); + CsrUint8Ser(ptr, len, (u8) primitive->trafficStreamID); CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); return(ptr); } -void* CsrWifiRouterCtrlBlockAckErrorIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlBlockAckErrorIndDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlBlockAckErrorInd *primitive = (CsrWifiRouterCtrlBlockAckErrorInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckErrorInd)); CsrSize offset; @@ -2361,7 +2361,7 @@ void* CsrWifiRouterCtrlBlockAckErrorIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->trafficStreamID, buffer, &offset); + CsrUint8Des((u8 *) &primitive->trafficStreamID, buffer, &offset); CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); @@ -2376,12 +2376,12 @@ CsrSize CsrWifiRouterCtrlStaInactiveIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ - bufferSize += 6; /* CsrUint8 primitive->staAddress.a[6] */ + bufferSize += 6; /* u8 primitive->staAddress.a[6] */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlStaInactiveIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlStaInactiveIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlStaInactiveInd *primitive = (CsrWifiRouterCtrlStaInactiveInd *)msg; *len = 0; @@ -2393,7 +2393,7 @@ CsrUint8* CsrWifiRouterCtrlStaInactiveIndSer(CsrUint8 *ptr, CsrSize *len, void * } -void* CsrWifiRouterCtrlStaInactiveIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlStaInactiveIndDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlStaInactiveInd *primitive = (CsrWifiRouterCtrlStaInactiveInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlStaInactiveInd)); CsrSize offset; @@ -2417,14 +2417,14 @@ CsrSize CsrWifiRouterCtrlWapiRxMicCheckIndSizeof(void *msg) bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrUint16 primitive->signalLength */ - bufferSize += primitive->signalLength; /* CsrUint8 primitive->signal */ + bufferSize += primitive->signalLength; /* u8 primitive->signal */ bufferSize += 2; /* CsrUint16 primitive->dataLength */ - bufferSize += primitive->dataLength; /* CsrUint8 primitive->data */ + bufferSize += primitive->dataLength; /* u8 primitive->data */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlWapiRxMicCheckIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlWapiRxMicCheckIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlWapiRxMicCheckInd *primitive = (CsrWifiRouterCtrlWapiRxMicCheckInd *)msg; *len = 0; @@ -2445,7 +2445,7 @@ CsrUint8* CsrWifiRouterCtrlWapiRxMicCheckIndSer(CsrUint8 *ptr, CsrSize *len, voi } -void* CsrWifiRouterCtrlWapiRxMicCheckIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlWapiRxMicCheckIndDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlWapiRxMicCheckInd *primitive = (CsrWifiRouterCtrlWapiRxMicCheckInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiRxMicCheckInd)); CsrSize offset; @@ -2457,7 +2457,7 @@ void* CsrWifiRouterCtrlWapiRxMicCheckIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->signalLength, buffer, &offset); if (primitive->signalLength) { - primitive->signal = (CsrUint8 *)CsrPmemAlloc(primitive->signalLength); + primitive->signal = (u8 *)CsrPmemAlloc(primitive->signalLength); CsrMemCpyDes(primitive->signal, buffer, &offset, ((CsrUint16) (primitive->signalLength))); } else @@ -2467,7 +2467,7 @@ void* CsrWifiRouterCtrlWapiRxMicCheckIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->dataLength, buffer, &offset); if (primitive->dataLength) { - primitive->data = (CsrUint8 *)CsrPmemAlloc(primitive->dataLength); + primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); CsrMemCpyDes(primitive->data, buffer, &offset, ((CsrUint16) (primitive->dataLength))); } else @@ -2501,20 +2501,20 @@ CsrSize CsrWifiRouterCtrlModeSetCfmSizeof(void *msg) } -CsrUint8* CsrWifiRouterCtrlModeSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlModeSetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlModeSetCfm *primitive = (CsrWifiRouterCtrlModeSetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->mode); + CsrUint8Ser(ptr, len, (u8) primitive->mode); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); return(ptr); } -void* CsrWifiRouterCtrlModeSetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlModeSetCfmDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlModeSetCfm *primitive = (CsrWifiRouterCtrlModeSetCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlModeSetCfm)); CsrSize offset; @@ -2523,7 +2523,7 @@ void* CsrWifiRouterCtrlModeSetCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->mode, buffer, &offset); + CsrUint8Des((u8 *) &primitive->mode, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); return primitive; @@ -2539,12 +2539,12 @@ CsrSize CsrWifiRouterCtrlWapiUnicastTxEncryptIndSizeof(void *msg) bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrUint16 primitive->dataLength */ - bufferSize += primitive->dataLength; /* CsrUint8 primitive->data */ + bufferSize += primitive->dataLength; /* u8 primitive->data */ return bufferSize; } -CsrUint8* CsrWifiRouterCtrlWapiUnicastTxEncryptIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlWapiUnicastTxEncryptIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterCtrlWapiUnicastTxEncryptInd *primitive = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *)msg; *len = 0; @@ -2560,7 +2560,7 @@ CsrUint8* CsrWifiRouterCtrlWapiUnicastTxEncryptIndSer(CsrUint8 *ptr, CsrSize *le } -void* CsrWifiRouterCtrlWapiUnicastTxEncryptIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlWapiUnicastTxEncryptIndDes(u8 *buffer, CsrSize length) { CsrWifiRouterCtrlWapiUnicastTxEncryptInd *primitive = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxEncryptInd)); CsrSize offset; @@ -2572,7 +2572,7 @@ void* CsrWifiRouterCtrlWapiUnicastTxEncryptIndDes(CsrUint8 *buffer, CsrSize leng CsrUint16Des((CsrUint16 *) &primitive->dataLength, buffer, &offset); if (primitive->dataLength) { - primitive->data = (CsrUint8 *)CsrPmemAlloc(primitive->dataLength); + primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); CsrMemCpyDes(primitive->data, buffer, &offset, ((CsrUint16) (primitive->dataLength))); } else diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h index 3b7834d..5a17a45 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h +++ b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h @@ -25,48 +25,48 @@ extern "C" { extern void CsrWifiRouterCtrlPfree(void *ptr); -extern CsrUint8* CsrWifiRouterCtrlConfigurePowerModeReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlConfigurePowerModeReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlConfigurePowerModeReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlConfigurePowerModeReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlConfigurePowerModeReqSizeof(void *msg); #define CsrWifiRouterCtrlConfigurePowerModeReqSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlHipReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlHipReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlHipReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlHipReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlHipReqSizeof(void *msg); extern void CsrWifiRouterCtrlHipReqSerFree(void *msg); -extern CsrUint8* CsrWifiRouterCtrlMediaStatusReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlMediaStatusReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlMediaStatusReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlMediaStatusReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlMediaStatusReqSizeof(void *msg); #define CsrWifiRouterCtrlMediaStatusReqSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlMulticastAddressResSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlMulticastAddressResDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlMulticastAddressResSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlMulticastAddressResDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlMulticastAddressResSizeof(void *msg); extern void CsrWifiRouterCtrlMulticastAddressResSerFree(void *msg); -extern CsrUint8* CsrWifiRouterCtrlPortConfigureReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlPortConfigureReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlPortConfigureReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlPortConfigureReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlPortConfigureReqSizeof(void *msg); #define CsrWifiRouterCtrlPortConfigureReqSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlQosControlReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlQosControlReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlQosControlReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlQosControlReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlQosControlReqSizeof(void *msg); #define CsrWifiRouterCtrlQosControlReqSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlSuspendResSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlSuspendResDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlSuspendResSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlSuspendResDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlSuspendResSizeof(void *msg); #define CsrWifiRouterCtrlSuspendResSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlTclasAddReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlTclasAddReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlTclasAddReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlTclasAddReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlTclasAddReqSizeof(void *msg); extern void CsrWifiRouterCtrlTclasAddReqSerFree(void *msg); -extern CsrUint8* CsrWifiRouterCtrlResumeResSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlResumeResDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlResumeResSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlResumeResDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlResumeResSizeof(void *msg); #define CsrWifiRouterCtrlResumeResSerFree CsrWifiRouterCtrlPfree @@ -80,18 +80,18 @@ extern CsrSize CsrWifiRouterCtrlResumeResSizeof(void *msg); #define CsrWifiRouterCtrlRawSdioInitialiseReqSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiRouterCtrlRawSdioInitialiseReqSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlTclasDelReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlTclasDelReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlTclasDelReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlTclasDelReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlTclasDelReqSizeof(void *msg); extern void CsrWifiRouterCtrlTclasDelReqSerFree(void *msg); -extern CsrUint8* CsrWifiRouterCtrlTrafficClassificationReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlTrafficClassificationReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlTrafficClassificationReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlTrafficClassificationReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlTrafficClassificationReqSizeof(void *msg); #define CsrWifiRouterCtrlTrafficClassificationReqSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlTrafficConfigReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlTrafficConfigReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlTrafficConfigReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlTrafficConfigReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlTrafficConfigReqSizeof(void *msg); #define CsrWifiRouterCtrlTrafficConfigReqSerFree CsrWifiRouterCtrlPfree @@ -105,38 +105,38 @@ extern CsrSize CsrWifiRouterCtrlTrafficConfigReqSizeof(void *msg); #define CsrWifiRouterCtrlWifiOffResSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiRouterCtrlWifiOffResSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlWifiOnReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlWifiOnReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlWifiOnReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlWifiOnReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlWifiOnReqSizeof(void *msg); extern void CsrWifiRouterCtrlWifiOnReqSerFree(void *msg); -extern CsrUint8* CsrWifiRouterCtrlWifiOnResSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlWifiOnResDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlWifiOnResSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlWifiOnResDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlWifiOnResSizeof(void *msg); extern void CsrWifiRouterCtrlWifiOnResSerFree(void *msg); -extern CsrUint8* CsrWifiRouterCtrlM4TransmitReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlM4TransmitReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlM4TransmitReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlM4TransmitReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlM4TransmitReqSizeof(void *msg); #define CsrWifiRouterCtrlM4TransmitReqSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlModeSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlModeSetReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlModeSetReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlModeSetReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlModeSetReqSizeof(void *msg); #define CsrWifiRouterCtrlModeSetReqSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlPeerAddReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlPeerAddReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlPeerAddReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlPeerAddReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlPeerAddReqSizeof(void *msg); #define CsrWifiRouterCtrlPeerAddReqSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlPeerDelReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlPeerDelReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlPeerDelReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlPeerDelReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlPeerDelReqSizeof(void *msg); #define CsrWifiRouterCtrlPeerDelReqSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlPeerUpdateReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlPeerUpdateReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlPeerUpdateReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlPeerUpdateReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlPeerUpdateReqSizeof(void *msg); #define CsrWifiRouterCtrlPeerUpdateReqSerFree CsrWifiRouterCtrlPfree @@ -145,18 +145,18 @@ extern CsrSize CsrWifiRouterCtrlPeerUpdateReqSizeof(void *msg); #define CsrWifiRouterCtrlCapabilitiesReqSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiRouterCtrlCapabilitiesReqSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlBlockAckEnableReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlBlockAckEnableReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlBlockAckEnableReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlBlockAckEnableReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlBlockAckEnableReqSizeof(void *msg); #define CsrWifiRouterCtrlBlockAckEnableReqSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlBlockAckDisableReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlBlockAckDisableReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlBlockAckDisableReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlBlockAckDisableReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlBlockAckDisableReqSizeof(void *msg); #define CsrWifiRouterCtrlBlockAckDisableReqSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlWapiRxPktReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlWapiRxPktReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlWapiRxPktReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlWapiRxPktReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlWapiRxPktReqSizeof(void *msg); extern void CsrWifiRouterCtrlWapiRxPktReqSerFree(void *msg); @@ -170,8 +170,8 @@ extern void CsrWifiRouterCtrlWapiRxPktReqSerFree(void *msg); #define CsrWifiRouterCtrlWapiUnicastFilterReqSizeof CsrWifiEventCsrUint16CsrUint8Sizeof #define CsrWifiRouterCtrlWapiUnicastFilterReqSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlWapiUnicastTxPktReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlWapiUnicastTxPktReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlWapiUnicastTxPktReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlWapiUnicastTxPktReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlWapiUnicastTxPktReqSizeof(void *msg); extern void CsrWifiRouterCtrlWapiUnicastTxPktReqSerFree(void *msg); @@ -180,18 +180,18 @@ extern void CsrWifiRouterCtrlWapiUnicastTxPktReqSerFree(void *msg); #define CsrWifiRouterCtrlWapiFilterReqSizeof CsrWifiEventCsrUint16CsrUint8Sizeof #define CsrWifiRouterCtrlWapiFilterReqSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlHipIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlHipIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlHipIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlHipIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlHipIndSizeof(void *msg); extern void CsrWifiRouterCtrlHipIndSerFree(void *msg); -extern CsrUint8* CsrWifiRouterCtrlMulticastAddressIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlMulticastAddressIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlMulticastAddressIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlMulticastAddressIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlMulticastAddressIndSizeof(void *msg); extern void CsrWifiRouterCtrlMulticastAddressIndSerFree(void *msg); -extern CsrUint8* CsrWifiRouterCtrlPortConfigureCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlPortConfigureCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlPortConfigureCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlPortConfigureCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlPortConfigureCfmSizeof(void *msg); #define CsrWifiRouterCtrlPortConfigureCfmSerFree CsrWifiRouterCtrlPfree @@ -200,38 +200,38 @@ extern CsrSize CsrWifiRouterCtrlPortConfigureCfmSizeof(void *msg); #define CsrWifiRouterCtrlResumeIndSizeof CsrWifiEventCsrUint16CsrUint8Sizeof #define CsrWifiRouterCtrlResumeIndSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlSuspendIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlSuspendIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlSuspendIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlSuspendIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlSuspendIndSizeof(void *msg); #define CsrWifiRouterCtrlSuspendIndSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlTclasAddCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlTclasAddCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlTclasAddCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlTclasAddCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlTclasAddCfmSizeof(void *msg); #define CsrWifiRouterCtrlTclasAddCfmSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlRawSdioDeinitialiseCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlRawSdioDeinitialiseCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlRawSdioDeinitialiseCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlRawSdioDeinitialiseCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlRawSdioDeinitialiseCfmSizeof(void *msg); #define CsrWifiRouterCtrlRawSdioDeinitialiseCfmSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlRawSdioInitialiseCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlRawSdioInitialiseCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlRawSdioInitialiseCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlRawSdioInitialiseCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlRawSdioInitialiseCfmSizeof(void *msg); #define CsrWifiRouterCtrlRawSdioInitialiseCfmSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlTclasDelCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlTclasDelCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlTclasDelCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlTclasDelCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlTclasDelCfmSizeof(void *msg); #define CsrWifiRouterCtrlTclasDelCfmSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlTrafficProtocolIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlTrafficProtocolIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlTrafficProtocolIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlTrafficProtocolIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlTrafficProtocolIndSizeof(void *msg); #define CsrWifiRouterCtrlTrafficProtocolIndSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlTrafficSampleIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlTrafficSampleIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlTrafficSampleIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlTrafficSampleIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlTrafficSampleIndSizeof(void *msg); #define CsrWifiRouterCtrlTrafficSampleIndSerFree CsrWifiRouterCtrlPfree @@ -245,93 +245,93 @@ extern CsrSize CsrWifiRouterCtrlTrafficSampleIndSizeof(void *msg); #define CsrWifiRouterCtrlWifiOffCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiRouterCtrlWifiOffCfmSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlWifiOnIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlWifiOnIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlWifiOnIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlWifiOnIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlWifiOnIndSizeof(void *msg); extern void CsrWifiRouterCtrlWifiOnIndSerFree(void *msg); -extern CsrUint8* CsrWifiRouterCtrlWifiOnCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlWifiOnCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlWifiOnCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlWifiOnCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlWifiOnCfmSizeof(void *msg); #define CsrWifiRouterCtrlWifiOnCfmSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlM4ReadyToSendIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlM4ReadyToSendIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlM4ReadyToSendIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlM4ReadyToSendIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlM4ReadyToSendIndSizeof(void *msg); #define CsrWifiRouterCtrlM4ReadyToSendIndSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlM4TransmittedIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlM4TransmittedIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlM4TransmittedIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlM4TransmittedIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlM4TransmittedIndSizeof(void *msg); #define CsrWifiRouterCtrlM4TransmittedIndSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlMicFailureIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlMicFailureIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlMicFailureIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlMicFailureIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlMicFailureIndSizeof(void *msg); #define CsrWifiRouterCtrlMicFailureIndSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlConnectedIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlConnectedIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlConnectedIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlConnectedIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlConnectedIndSizeof(void *msg); #define CsrWifiRouterCtrlConnectedIndSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlPeerAddCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlPeerAddCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlPeerAddCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlPeerAddCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlPeerAddCfmSizeof(void *msg); #define CsrWifiRouterCtrlPeerAddCfmSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlPeerDelCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlPeerDelCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlPeerDelCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlPeerDelCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlPeerDelCfmSizeof(void *msg); #define CsrWifiRouterCtrlPeerDelCfmSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlUnexpectedFrameIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlUnexpectedFrameIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlUnexpectedFrameIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlUnexpectedFrameIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlUnexpectedFrameIndSizeof(void *msg); #define CsrWifiRouterCtrlUnexpectedFrameIndSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlPeerUpdateCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlPeerUpdateCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlPeerUpdateCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlPeerUpdateCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlPeerUpdateCfmSizeof(void *msg); #define CsrWifiRouterCtrlPeerUpdateCfmSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlCapabilitiesCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlCapabilitiesCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlCapabilitiesCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlCapabilitiesCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlCapabilitiesCfmSizeof(void *msg); #define CsrWifiRouterCtrlCapabilitiesCfmSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlBlockAckEnableCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlBlockAckEnableCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlBlockAckEnableCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlBlockAckEnableCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlBlockAckEnableCfmSizeof(void *msg); #define CsrWifiRouterCtrlBlockAckEnableCfmSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlBlockAckDisableCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlBlockAckDisableCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlBlockAckDisableCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlBlockAckDisableCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlBlockAckDisableCfmSizeof(void *msg); #define CsrWifiRouterCtrlBlockAckDisableCfmSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlBlockAckErrorIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlBlockAckErrorIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlBlockAckErrorIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlBlockAckErrorIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlBlockAckErrorIndSizeof(void *msg); #define CsrWifiRouterCtrlBlockAckErrorIndSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlStaInactiveIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlStaInactiveIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlStaInactiveIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlStaInactiveIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlStaInactiveIndSizeof(void *msg); #define CsrWifiRouterCtrlStaInactiveIndSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlWapiRxMicCheckIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlWapiRxMicCheckIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlWapiRxMicCheckIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlWapiRxMicCheckIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlWapiRxMicCheckIndSizeof(void *msg); extern void CsrWifiRouterCtrlWapiRxMicCheckIndSerFree(void *msg); -extern CsrUint8* CsrWifiRouterCtrlModeSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlModeSetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlModeSetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlModeSetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlModeSetCfmSizeof(void *msg); #define CsrWifiRouterCtrlModeSetCfmSerFree CsrWifiRouterCtrlPfree -extern CsrUint8* CsrWifiRouterCtrlWapiUnicastTxEncryptIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlWapiUnicastTxEncryptIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterCtrlWapiUnicastTxEncryptIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterCtrlWapiUnicastTxEncryptIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterCtrlWapiUnicastTxEncryptIndSizeof(void *msg); extern void CsrWifiRouterCtrlWapiUnicastTxEncryptIndSerFree(void *msg); diff --git a/drivers/staging/csr/csr_wifi_router_prim.h b/drivers/staging/csr/csr_wifi_router_prim.h index 67b71a4..182cbfc 100644 --- a/drivers/staging/csr/csr_wifi_router_prim.h +++ b/drivers/staging/csr/csr_wifi_router_prim.h @@ -44,7 +44,7 @@ typedef void (*CsrWifiRouterFrameFreeFunction)(void *frame); CSR_WIFI_ROUTER_APP_TYPE_OTHER - *******************************************************************************/ -typedef CsrUint8 CsrWifiRouterAppType; +typedef u8 CsrWifiRouterAppType; #define CSR_WIFI_ROUTER_APP_TYPE_SME ((CsrWifiRouterAppType) 0x0) #define CSR_WIFI_ROUTER_APP_TYPE_PAL ((CsrWifiRouterAppType) 0x1) #define CSR_WIFI_ROUTER_APP_TYPE_NME ((CsrWifiRouterAppType) 0x2) @@ -65,7 +65,7 @@ typedef CsrUint8 CsrWifiRouterAppType; - LLC/SNAP encapsulation *******************************************************************************/ -typedef CsrUint8 CsrWifiRouterEncapsulation; +typedef u8 CsrWifiRouterEncapsulation; #define CSR_WIFI_ROUTER_ENCAPSULATION_ETHERNET ((CsrWifiRouterEncapsulation) 0x00) #define CSR_WIFI_ROUTER_ENCAPSULATION_LLC_SNAP ((CsrWifiRouterEncapsulation) 0x01) @@ -204,7 +204,7 @@ typedef struct { CsrWifiFsmEvent common; CsrUint16 interfaceTag; - CsrUint8 subscriptionHandle; + u8 subscriptionHandle; } CsrWifiRouterMaPacketUnsubscribeReq; /******************************************************************************* @@ -243,9 +243,9 @@ typedef struct { CsrWifiFsmEvent common; CsrUint16 interfaceTag; - CsrUint8 subscriptionHandle; + u8 subscriptionHandle; CsrUint16 frameLength; - CsrUint8 *frame; + u8 *frame; CsrWifiRouterFrameFreeFunction freeFunction; CsrWifiRouterPriority priority; CsrUint32 hostTag; @@ -272,7 +272,7 @@ typedef struct { CsrWifiFsmEvent common; CsrUint16 interfaceTag; - CsrUint8 subscriptionHandle; + u8 subscriptionHandle; CsrResult result; } CsrWifiRouterMaPacketRes; @@ -332,7 +332,7 @@ typedef struct { CsrWifiFsmEvent common; CsrUint16 interfaceTag; - CsrUint8 subscriptionHandle; + u8 subscriptionHandle; CsrResult status; CsrUint16 allocOffset; } CsrWifiRouterMaPacketSubscribeCfm; @@ -411,10 +411,10 @@ typedef struct { CsrWifiFsmEvent common; CsrUint16 interfaceTag; - CsrUint8 subscriptionHandle; + u8 subscriptionHandle; CsrResult result; CsrUint16 frameLength; - CsrUint8 *frame; + u8 *frame; CsrWifiRouterFrameFreeFunction freeFunction; CsrInt16 rssi; CsrInt16 snr; diff --git a/drivers/staging/csr/csr_wifi_router_serialize.c b/drivers/staging/csr/csr_wifi_router_serialize.c index e1adf8f..e744db8 100644 --- a/drivers/staging/csr/csr_wifi_router_serialize.c +++ b/drivers/staging/csr/csr_wifi_router_serialize.c @@ -37,20 +37,20 @@ CsrSize CsrWifiRouterMaPacketSubscribeReqSizeof(void *msg) } -CsrUint8* CsrWifiRouterMaPacketSubscribeReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterMaPacketSubscribeReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterMaPacketSubscribeReq *primitive = (CsrWifiRouterMaPacketSubscribeReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->encapsulation); + CsrUint8Ser(ptr, len, (u8) primitive->encapsulation); CsrUint16Ser(ptr, len, (CsrUint16) primitive->protocol); CsrUint32Ser(ptr, len, (CsrUint32) primitive->oui); return(ptr); } -void* CsrWifiRouterMaPacketSubscribeReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterMaPacketSubscribeReqDes(u8 *buffer, CsrSize length) { CsrWifiRouterMaPacketSubscribeReq *primitive = (CsrWifiRouterMaPacketSubscribeReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketSubscribeReq)); CsrSize offset; @@ -58,7 +58,7 @@ void* CsrWifiRouterMaPacketSubscribeReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->encapsulation, buffer, &offset); + CsrUint8Des((u8 *) &primitive->encapsulation, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->protocol, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->oui, buffer, &offset); @@ -73,9 +73,9 @@ CsrSize CsrWifiRouterMaPacketReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 20) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ - bufferSize += 1; /* CsrUint8 primitive->subscriptionHandle */ + bufferSize += 1; /* u8 primitive->subscriptionHandle */ bufferSize += 2; /* CsrUint16 primitive->frameLength */ - bufferSize += primitive->frameLength; /* CsrUint8 primitive->frame */ + bufferSize += primitive->frameLength; /* u8 primitive->frame */ bufferSize += 4; /* CsrWifiRouterFrameFreeFunction primitive->freeFunction */ bufferSize += 2; /* CsrWifiRouterPriority primitive->priority */ bufferSize += 4; /* CsrUint32 primitive->hostTag */ @@ -84,13 +84,13 @@ CsrSize CsrWifiRouterMaPacketReqSizeof(void *msg) } -CsrUint8* CsrWifiRouterMaPacketReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterMaPacketReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->subscriptionHandle); + CsrUint8Ser(ptr, len, (u8) primitive->subscriptionHandle); CsrUint16Ser(ptr, len, (CsrUint16) primitive->frameLength); if (primitive->frameLength) { @@ -99,12 +99,12 @@ CsrUint8* CsrWifiRouterMaPacketReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->freeFunction */ CsrUint16Ser(ptr, len, (CsrUint16) primitive->priority); CsrUint32Ser(ptr, len, (CsrUint32) primitive->hostTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->cfmRequested); + CsrUint8Ser(ptr, len, (u8) primitive->cfmRequested); return(ptr); } -void* CsrWifiRouterMaPacketReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterMaPacketReqDes(u8 *buffer, CsrSize length) { CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketReq)); CsrSize offset; @@ -112,11 +112,11 @@ void* CsrWifiRouterMaPacketReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->subscriptionHandle, buffer, &offset); + CsrUint8Des((u8 *) &primitive->subscriptionHandle, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->frameLength, buffer, &offset); if (primitive->frameLength) { - primitive->frame = (CsrUint8 *)CsrPmemAlloc(primitive->frameLength); + primitive->frame = (u8 *)CsrPmemAlloc(primitive->frameLength); CsrMemCpyDes(primitive->frame, buffer, &offset, ((CsrUint16) (primitive->frameLength))); } else @@ -127,7 +127,7 @@ void* CsrWifiRouterMaPacketReqDes(CsrUint8 *buffer, CsrSize length) offset += 4; CsrUint16Des((CsrUint16 *) &primitive->priority, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->hostTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->cfmRequested, buffer, &offset); + CsrUint8Des((u8 *) &primitive->cfmRequested, buffer, &offset); return primitive; } @@ -147,25 +147,25 @@ CsrSize CsrWifiRouterMaPacketResSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ - bufferSize += 1; /* CsrUint8 primitive->subscriptionHandle */ + bufferSize += 1; /* u8 primitive->subscriptionHandle */ bufferSize += 2; /* CsrResult primitive->result */ return bufferSize; } -CsrUint8* CsrWifiRouterMaPacketResSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterMaPacketResSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterMaPacketRes *primitive = (CsrWifiRouterMaPacketRes *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->subscriptionHandle); + CsrUint8Ser(ptr, len, (u8) primitive->subscriptionHandle); CsrUint16Ser(ptr, len, (CsrUint16) primitive->result); return(ptr); } -void* CsrWifiRouterMaPacketResDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterMaPacketResDes(u8 *buffer, CsrSize length) { CsrWifiRouterMaPacketRes *primitive = (CsrWifiRouterMaPacketRes *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketRes)); CsrSize offset; @@ -173,7 +173,7 @@ void* CsrWifiRouterMaPacketResDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->subscriptionHandle, buffer, &offset); + CsrUint8Des((u8 *) &primitive->subscriptionHandle, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->result, buffer, &offset); return primitive; @@ -188,12 +188,12 @@ CsrSize CsrWifiRouterMaPacketCancelReqSizeof(void *msg) bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 4; /* CsrUint32 primitive->hostTag */ bufferSize += 2; /* CsrWifiRouterPriority primitive->priority */ - bufferSize += 6; /* CsrUint8 primitive->peerMacAddress.a[6] */ + bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ return bufferSize; } -CsrUint8* CsrWifiRouterMaPacketCancelReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterMaPacketCancelReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterMaPacketCancelReq *primitive = (CsrWifiRouterMaPacketCancelReq *)msg; *len = 0; @@ -206,7 +206,7 @@ CsrUint8* CsrWifiRouterMaPacketCancelReqSer(CsrUint8 *ptr, CsrSize *len, void *m } -void* CsrWifiRouterMaPacketCancelReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterMaPacketCancelReqDes(u8 *buffer, CsrSize length) { CsrWifiRouterMaPacketCancelReq *primitive = (CsrWifiRouterMaPacketCancelReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketCancelReq)); CsrSize offset; @@ -228,27 +228,27 @@ CsrSize CsrWifiRouterMaPacketSubscribeCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ - bufferSize += 1; /* CsrUint8 primitive->subscriptionHandle */ + bufferSize += 1; /* u8 primitive->subscriptionHandle */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 2; /* CsrUint16 primitive->allocOffset */ return bufferSize; } -CsrUint8* CsrWifiRouterMaPacketSubscribeCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterMaPacketSubscribeCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterMaPacketSubscribeCfm *primitive = (CsrWifiRouterMaPacketSubscribeCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->subscriptionHandle); + CsrUint8Ser(ptr, len, (u8) primitive->subscriptionHandle); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); CsrUint16Ser(ptr, len, (CsrUint16) primitive->allocOffset); return(ptr); } -void* CsrWifiRouterMaPacketSubscribeCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterMaPacketSubscribeCfmDes(u8 *buffer, CsrSize length) { CsrWifiRouterMaPacketSubscribeCfm *primitive = (CsrWifiRouterMaPacketSubscribeCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketSubscribeCfm)); CsrSize offset; @@ -256,7 +256,7 @@ void* CsrWifiRouterMaPacketSubscribeCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->subscriptionHandle, buffer, &offset); + CsrUint8Des((u8 *) &primitive->subscriptionHandle, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->allocOffset, buffer, &offset); @@ -275,7 +275,7 @@ CsrSize CsrWifiRouterMaPacketUnsubscribeCfmSizeof(void *msg) } -CsrUint8* CsrWifiRouterMaPacketUnsubscribeCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterMaPacketUnsubscribeCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterMaPacketUnsubscribeCfm *primitive = (CsrWifiRouterMaPacketUnsubscribeCfm *)msg; *len = 0; @@ -286,7 +286,7 @@ CsrUint8* CsrWifiRouterMaPacketUnsubscribeCfmSer(CsrUint8 *ptr, CsrSize *len, vo } -void* CsrWifiRouterMaPacketUnsubscribeCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterMaPacketUnsubscribeCfmDes(u8 *buffer, CsrSize length) { CsrWifiRouterMaPacketUnsubscribeCfm *primitive = (CsrWifiRouterMaPacketUnsubscribeCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketUnsubscribeCfm)); CsrSize offset; @@ -313,7 +313,7 @@ CsrSize CsrWifiRouterMaPacketCfmSizeof(void *msg) } -CsrUint8* CsrWifiRouterMaPacketCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterMaPacketCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterMaPacketCfm *primitive = (CsrWifiRouterMaPacketCfm *)msg; *len = 0; @@ -326,7 +326,7 @@ CsrUint8* CsrWifiRouterMaPacketCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterMaPacketCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterMaPacketCfmDes(u8 *buffer, CsrSize length) { CsrWifiRouterMaPacketCfm *primitive = (CsrWifiRouterMaPacketCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketCfm)); CsrSize offset; @@ -349,10 +349,10 @@ CsrSize CsrWifiRouterMaPacketIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 21) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ - bufferSize += 1; /* CsrUint8 primitive->subscriptionHandle */ + bufferSize += 1; /* u8 primitive->subscriptionHandle */ bufferSize += 2; /* CsrResult primitive->result */ bufferSize += 2; /* CsrUint16 primitive->frameLength */ - bufferSize += primitive->frameLength; /* CsrUint8 primitive->frame */ + bufferSize += primitive->frameLength; /* u8 primitive->frame */ bufferSize += 4; /* CsrWifiRouterFrameFreeFunction primitive->freeFunction */ bufferSize += 2; /* CsrInt16 primitive->rssi */ bufferSize += 2; /* CsrInt16 primitive->snr */ @@ -361,13 +361,13 @@ CsrSize CsrWifiRouterMaPacketIndSizeof(void *msg) } -CsrUint8* CsrWifiRouterMaPacketIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterMaPacketIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->subscriptionHandle); + CsrUint8Ser(ptr, len, (u8) primitive->subscriptionHandle); CsrUint16Ser(ptr, len, (CsrUint16) primitive->result); CsrUint16Ser(ptr, len, (CsrUint16) primitive->frameLength); if (primitive->frameLength) @@ -382,7 +382,7 @@ CsrUint8* CsrWifiRouterMaPacketIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterMaPacketIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiRouterMaPacketIndDes(u8 *buffer, CsrSize length) { CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketInd)); CsrSize offset; @@ -390,12 +390,12 @@ void* CsrWifiRouterMaPacketIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->subscriptionHandle, buffer, &offset); + CsrUint8Des((u8 *) &primitive->subscriptionHandle, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->result, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->frameLength, buffer, &offset); if (primitive->frameLength) { - primitive->frame = (CsrUint8 *)CsrPmemAlloc(primitive->frameLength); + primitive->frame = (u8 *)CsrPmemAlloc(primitive->frameLength); CsrMemCpyDes(primitive->frame, buffer, &offset, ((CsrUint16) (primitive->frameLength))); } else diff --git a/drivers/staging/csr/csr_wifi_router_serialize.h b/drivers/staging/csr/csr_wifi_router_serialize.h index 183a5a4..6a6c1b2 100644 --- a/drivers/staging/csr/csr_wifi_router_serialize.h +++ b/drivers/staging/csr/csr_wifi_router_serialize.h @@ -25,8 +25,8 @@ extern "C" { extern void CsrWifiRouterPfree(void *ptr); -extern CsrUint8* CsrWifiRouterMaPacketSubscribeReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterMaPacketSubscribeReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterMaPacketSubscribeReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterMaPacketSubscribeReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterMaPacketSubscribeReqSizeof(void *msg); #define CsrWifiRouterMaPacketSubscribeReqSerFree CsrWifiRouterPfree @@ -35,38 +35,38 @@ extern CsrSize CsrWifiRouterMaPacketSubscribeReqSizeof(void *msg); #define CsrWifiRouterMaPacketUnsubscribeReqSizeof CsrWifiEventCsrUint16CsrUint8Sizeof #define CsrWifiRouterMaPacketUnsubscribeReqSerFree CsrWifiRouterPfree -extern CsrUint8* CsrWifiRouterMaPacketReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterMaPacketReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterMaPacketReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterMaPacketReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterMaPacketReqSizeof(void *msg); extern void CsrWifiRouterMaPacketReqSerFree(void *msg); -extern CsrUint8* CsrWifiRouterMaPacketResSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterMaPacketResDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterMaPacketResSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterMaPacketResDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterMaPacketResSizeof(void *msg); #define CsrWifiRouterMaPacketResSerFree CsrWifiRouterPfree -extern CsrUint8* CsrWifiRouterMaPacketCancelReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterMaPacketCancelReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterMaPacketCancelReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterMaPacketCancelReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterMaPacketCancelReqSizeof(void *msg); #define CsrWifiRouterMaPacketCancelReqSerFree CsrWifiRouterPfree -extern CsrUint8* CsrWifiRouterMaPacketSubscribeCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterMaPacketSubscribeCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterMaPacketSubscribeCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterMaPacketSubscribeCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterMaPacketSubscribeCfmSizeof(void *msg); #define CsrWifiRouterMaPacketSubscribeCfmSerFree CsrWifiRouterPfree -extern CsrUint8* CsrWifiRouterMaPacketUnsubscribeCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterMaPacketUnsubscribeCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterMaPacketUnsubscribeCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterMaPacketUnsubscribeCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterMaPacketUnsubscribeCfmSizeof(void *msg); #define CsrWifiRouterMaPacketUnsubscribeCfmSerFree CsrWifiRouterPfree -extern CsrUint8* CsrWifiRouterMaPacketCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterMaPacketCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterMaPacketCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterMaPacketCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterMaPacketCfmSizeof(void *msg); #define CsrWifiRouterMaPacketCfmSerFree CsrWifiRouterPfree -extern CsrUint8* CsrWifiRouterMaPacketIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterMaPacketIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiRouterMaPacketIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiRouterMaPacketIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiRouterMaPacketIndSizeof(void *msg); extern void CsrWifiRouterMaPacketIndSerFree(void *msg); diff --git a/drivers/staging/csr/csr_wifi_router_transport.c b/drivers/staging/csr/csr_wifi_router_transport.c index ec7e01d..45bee24 100644 --- a/drivers/staging/csr/csr_wifi_router_transport.c +++ b/drivers/staging/csr/csr_wifi_router_transport.c @@ -61,7 +61,7 @@ void CsrWifiRouterTransportDeinit(unifi_priv_t *priv) } } -void CsrWifiRouterTransportRecv(unifi_priv_t *priv, CsrUint8* buffer, CsrSize bufferLength) +void CsrWifiRouterTransportRecv(unifi_priv_t *priv, u8* buffer, CsrSize bufferLength) { CsrMsgConvMsgEntry* msgEntry; CsrUint16 primType; @@ -166,7 +166,7 @@ static void CsrWifiRouterTransportSerialiseAndSend(CsrUint16 primType, void* msg CsrSize msgSize; CsrSize encodeBufferLen = 0; CsrSize offset = 0; - CsrUint8* encodeBuffer; + u8* encodeBuffer; unifi_trace(drvpriv, UDBG4, "CsrWifiRouterTransportSerialiseAndSend: primType=0x%.4X, msgType=0x%.4X\n", primType, evt->type); diff --git a/drivers/staging/csr/csr_wifi_serialize_primitive_types.c b/drivers/staging/csr/csr_wifi_serialize_primitive_types.c index 155bf65..0e5e201 100644 --- a/drivers/staging/csr/csr_wifi_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_wifi_serialize_primitive_types.c @@ -16,7 +16,7 @@ #include "csr_wifi_msgconv.h" #include "csr_wifi_lib.h" -void CsrUint24Des(CsrUint32 *v, CsrUint8 *buffer, CsrSize *offset) +void CsrUint24Des(CsrUint32 *v, u8 *buffer, CsrSize *offset) { CsrUint32 val; @@ -30,7 +30,7 @@ void CsrUint24Des(CsrUint32 *v, CsrUint8 *buffer, CsrSize *offset) /* Big endian :e.g WSC, TCLAS */ -void CsrUint16DesBigEndian(CsrUint16 *v, CsrUint8 *buffer, CsrSize *offset) +void CsrUint16DesBigEndian(CsrUint16 *v, u8 *buffer, CsrSize *offset) { CsrUint16 val; @@ -41,7 +41,7 @@ void CsrUint16DesBigEndian(CsrUint16 *v, CsrUint8 *buffer, CsrSize *offset) } -void CsrUint24DesBigEndian(CsrUint32 *v, CsrUint8 *buffer, CsrSize *offset) +void CsrUint24DesBigEndian(CsrUint32 *v, u8 *buffer, CsrSize *offset) { CsrUint32 val; @@ -54,7 +54,7 @@ void CsrUint24DesBigEndian(CsrUint32 *v, CsrUint8 *buffer, CsrSize *offset) } -void CsrUint32DesBigEndian(CsrUint32 *v, CsrUint8 *buffer, CsrSize *offset) +void CsrUint32DesBigEndian(CsrUint32 *v, u8 *buffer, CsrSize *offset) { CsrUint32 val; @@ -68,42 +68,42 @@ void CsrUint32DesBigEndian(CsrUint32 *v, CsrUint8 *buffer, CsrSize *offset) } -void CsrUint24Ser(CsrUint8 *ptr, CsrSize *len, CsrUint32 v) +void CsrUint24Ser(u8 *ptr, CsrSize *len, CsrUint32 v) { - ptr[(*len) + 2] = (CsrUint8)((v & 0x00ff0000) >> 16); - ptr[(*len) + 1] = (CsrUint8)((v & 0x0000ff00) >> 8); - ptr[(*len)] = (CsrUint8)((v & 0x000000ff)); + ptr[(*len) + 2] = (u8)((v & 0x00ff0000) >> 16); + ptr[(*len) + 1] = (u8)((v & 0x0000ff00) >> 8); + ptr[(*len)] = (u8)((v & 0x000000ff)); *len += 3; } /* Big endian :e.g WSC, TCLAS */ -void CsrUint16SerBigEndian(CsrUint8 *ptr, CsrSize *len, CsrUint16 v) +void CsrUint16SerBigEndian(u8 *ptr, CsrSize *len, CsrUint16 v) { - ptr[(*len)] = (CsrUint8)((v & 0xff00) >> 8); - ptr[(*len) + 1] = (CsrUint8)((v & 0x00ff)); + ptr[(*len)] = (u8)((v & 0xff00) >> 8); + ptr[(*len) + 1] = (u8)((v & 0x00ff)); *len += 2; } -void CsrUint32SerBigEndian(CsrUint8 *ptr, CsrSize *len, CsrUint32 v) +void CsrUint32SerBigEndian(u8 *ptr, CsrSize *len, CsrUint32 v) { - ptr[(*len)] = (CsrUint8)((v & 0xff000000) >> 24); - ptr[(*len) + 1] = (CsrUint8)((v & 0x00ff0000) >> 16); - ptr[(*len) + 2] = (CsrUint8)((v & 0x0000ff00) >> 8); - ptr[(*len) + 3] = (CsrUint8)((v & 0x000000ff)); + ptr[(*len)] = (u8)((v & 0xff000000) >> 24); + ptr[(*len) + 1] = (u8)((v & 0x00ff0000) >> 16); + ptr[(*len) + 2] = (u8)((v & 0x0000ff00) >> 8); + ptr[(*len) + 3] = (u8)((v & 0x000000ff)); *len += 4; } -void CsrUint24SerBigEndian(CsrUint8 *ptr, CsrSize *len, CsrUint32 v) +void CsrUint24SerBigEndian(u8 *ptr, CsrSize *len, CsrUint32 v) { - ptr[(*len)] = (CsrUint8)((v & 0x00ff0000) >> 16); - ptr[(*len) + 1] = (CsrUint8)((v & 0x0000ff00) >> 8); - ptr[(*len) + 2] = (CsrUint8)((v & 0x000000ff)); + ptr[(*len)] = (u8)((v & 0x00ff0000) >> 16); + ptr[(*len) + 1] = (u8)((v & 0x0000ff00) >> 8); + ptr[(*len) + 2] = (u8)((v & 0x000000ff)); *len += 3; } @@ -115,7 +115,7 @@ CsrSize CsrWifiEventSizeof(void *msg) } EXPORT_SYMBOL_GPL(CsrWifiEventSizeof); -CsrUint8* CsrWifiEventSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiEventSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiFsmEvent *primitive = (CsrWifiFsmEvent *)msg; *len = 0; @@ -124,7 +124,7 @@ CsrUint8* CsrWifiEventSer(CsrUint8 *ptr, CsrSize *len, void *msg) } EXPORT_SYMBOL_GPL(CsrWifiEventSer); -void* CsrWifiEventDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiEventDes(u8 *buffer, CsrSize length) { CsrWifiFsmEvent *primitive = (CsrWifiFsmEvent *) CsrPmemAlloc(sizeof(CsrWifiFsmEvent)); CsrSize offset = 0; @@ -140,7 +140,7 @@ CsrSize CsrWifiEventCsrUint8Sizeof(void *msg) } EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint8Sizeof); -CsrUint8* CsrWifiEventCsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiEventCsrUint8Ser(u8 *ptr, CsrSize *len, void *msg) { CsrWifiEventCsrUint8 *primitive = (CsrWifiEventCsrUint8 *)msg; *len = 0; @@ -151,7 +151,7 @@ CsrUint8* CsrWifiEventCsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg) EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint8Ser); -void* CsrWifiEventCsrUint8Des(CsrUint8 *buffer, CsrSize length) +void* CsrWifiEventCsrUint8Des(u8 *buffer, CsrSize length) { CsrWifiEventCsrUint8 *primitive = (CsrWifiEventCsrUint8 *) CsrPmemAlloc(sizeof(CsrWifiEventCsrUint8)); @@ -171,7 +171,7 @@ CsrSize CsrWifiEventCsrUint16Sizeof(void *msg) EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16Sizeof); -CsrUint8* CsrWifiEventCsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiEventCsrUint16Ser(u8 *ptr, CsrSize *len, void *msg) { CsrWifiEventCsrUint16 *primitive = (CsrWifiEventCsrUint16 *)msg; *len = 0; @@ -181,7 +181,7 @@ CsrUint8* CsrWifiEventCsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg) } EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16Ser); -void* CsrWifiEventCsrUint16Des(CsrUint8 *buffer, CsrSize length) +void* CsrWifiEventCsrUint16Des(u8 *buffer, CsrSize length) { CsrWifiEventCsrUint16 *primitive = (CsrWifiEventCsrUint16 *) CsrPmemAlloc(sizeof(CsrWifiEventCsrUint16)); @@ -200,7 +200,7 @@ CsrSize CsrWifiEventCsrUint32Sizeof(void *msg) } EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint32Sizeof); -CsrUint8* CsrWifiEventCsrUint32Ser(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiEventCsrUint32Ser(u8 *ptr, CsrSize *len, void *msg) { CsrWifiEventCsrUint32 *primitive = (CsrWifiEventCsrUint32 *)msg; *len = 0; @@ -211,7 +211,7 @@ CsrUint8* CsrWifiEventCsrUint32Ser(CsrUint8 *ptr, CsrSize *len, void *msg) EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint32Ser); -void* CsrWifiEventCsrUint32Des(CsrUint8 *buffer, CsrSize length) +void* CsrWifiEventCsrUint32Des(u8 *buffer, CsrSize length) { CsrWifiEventCsrUint32 *primitive = (CsrWifiEventCsrUint32 *) CsrPmemAlloc(sizeof(CsrWifiEventCsrUint32)); @@ -229,7 +229,7 @@ CsrSize CsrWifiEventCsrUint16CsrUint8Sizeof(void *msg) } EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16CsrUint8Sizeof); -CsrUint8* CsrWifiEventCsrUint16CsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiEventCsrUint16CsrUint8Ser(u8 *ptr, CsrSize *len, void *msg) { CsrWifiEventCsrUint16CsrUint8 *primitive = (CsrWifiEventCsrUint16CsrUint8 *)msg; *len = 0; @@ -241,7 +241,7 @@ CsrUint8* CsrWifiEventCsrUint16CsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *ms EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16CsrUint8Ser); -void* CsrWifiEventCsrUint16CsrUint8Des(CsrUint8 *buffer, CsrSize length) +void* CsrWifiEventCsrUint16CsrUint8Des(u8 *buffer, CsrSize length) { CsrWifiEventCsrUint16CsrUint8 *primitive = (CsrWifiEventCsrUint16CsrUint8 *) CsrPmemAlloc(sizeof(CsrWifiEventCsrUint16CsrUint8)); diff --git a/drivers/staging/csr/csr_wifi_sme_ap_prim.h b/drivers/staging/csr/csr_wifi_sme_ap_prim.h index 4159439..be275af 100644 --- a/drivers/staging/csr/csr_wifi_sme_ap_prim.h +++ b/drivers/staging/csr/csr_wifi_sme_ap_prim.h @@ -48,7 +48,7 @@ typedef CsrPrim CsrWifiSmeApPrim; CSR_WIFI_AP_ACCESS_TYPE_DENY - Disallow if MAC address is from the list *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeApAccessType; +typedef u8 CsrWifiSmeApAccessType; #define CSR_WIFI_AP_ACCESS_TYPE_NONE ((CsrWifiSmeApAccessType) 0x00) #define CSR_WIFI_AP_ACCESS_TYPE_ALLOW ((CsrWifiSmeApAccessType) 0x01) #define CSR_WIFI_AP_ACCESS_TYPE_DENY ((CsrWifiSmeApAccessType) 0x02) @@ -67,7 +67,7 @@ typedef CsrUint8 CsrWifiSmeApAccessType; CSR_WIFI_SME_AUTH_WAPIPSK - WAPI-PSK Support *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeApAuthSupport; +typedef u8 CsrWifiSmeApAuthSupport; #define CSR_WIFI_SME_RSN_AUTH_WPAPSK ((CsrWifiSmeApAuthSupport) 0x01) #define CSR_WIFI_SME_RSN_AUTH_WPA2PSK ((CsrWifiSmeApAuthSupport) 0x02) #define CSR_WIFI_SME_AUTH_WAPIPSK ((CsrWifiSmeApAuthSupport) 0x04) @@ -90,7 +90,7 @@ typedef CsrUint8 CsrWifiSmeApAuthSupport; - WEP authentication. This can be either open or shared key *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeApAuthType; +typedef u8 CsrWifiSmeApAuthType; #define CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM ((CsrWifiSmeApAuthType) 0x00) #define CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL ((CsrWifiSmeApAuthType) 0x01) #define CSR_WIFI_SME_AP_AUTH_TYPE_WEP ((CsrWifiSmeApAuthType) 0x02) @@ -108,7 +108,7 @@ typedef CsrUint8 CsrWifiSmeApAuthType; CSR_WIFI_AP_DIRECTION_ORIGINATOR - Originator *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeApDirection; +typedef u8 CsrWifiSmeApDirection; #define CSR_WIFI_AP_DIRECTION_RECEIPIENT ((CsrWifiSmeApDirection) 0x00) #define CSR_WIFI_AP_DIRECTION_ORIGINATOR ((CsrWifiSmeApDirection) 0x01) @@ -128,7 +128,7 @@ typedef CsrUint8 CsrWifiSmeApDirection; CSR_WIFI_SME_AP_PHY_SUPPORT_N - 802.11n *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeApPhySupport; +typedef u8 CsrWifiSmeApPhySupport; #define CSR_WIFI_SME_AP_PHY_SUPPORT_A ((CsrWifiSmeApPhySupport) 0x01) #define CSR_WIFI_SME_AP_PHY_SUPPORT_B ((CsrWifiSmeApPhySupport) 0x02) #define CSR_WIFI_SME_AP_PHY_SUPPORT_G ((CsrWifiSmeApPhySupport) 0x04) @@ -147,7 +147,7 @@ typedef CsrUint8 CsrWifiSmeApPhySupport; CSR_WIFI_AP_TYPE_P2P - P2P Group Owner(GO) *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeApType; +typedef u8 CsrWifiSmeApType; #define CSR_WIFI_AP_TYPE_LEGACY ((CsrWifiSmeApType) 0x00) #define CSR_WIFI_AP_TYPE_P2P ((CsrWifiSmeApType) 0x01) @@ -161,7 +161,7 @@ typedef CsrUint8 CsrWifiSmeApType; See CsrWifiSmeApAuthSupport for bit definitions *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeApAuthSupportMask; +typedef u8 CsrWifiSmeApAuthSupportMask; /******************************************************************************* NAME @@ -171,7 +171,7 @@ typedef CsrUint8 CsrWifiSmeApAuthSupportMask; Mask type for use with the values defined by CsrWifiSmeApPhySupport *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeApPhySupportMask; +typedef u8 CsrWifiSmeApPhySupportMask; /******************************************************************************* NAME @@ -250,9 +250,9 @@ typedef struct { CsrBool greenfieldSupported; CsrBool shortGi20MHz; - CsrUint8 rxStbc; + u8 rxStbc; CsrBool rifsModeAllowed; - CsrUint8 htProtection; + u8 htProtection; CsrBool dualCtsProtection; } CsrWifiSmeApHtParams; @@ -271,9 +271,9 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint8 operatingClass; - CsrUint8 operatingChannelCount; - CsrUint8 *operatingChannel; + u8 operatingClass; + u8 operatingChannelCount; + u8 *operatingChannel; } CsrWifiSmeApP2pOperatingChanEntry; /******************************************************************************* @@ -292,8 +292,8 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint8 country[3]; - CsrUint8 channelEntryListCount; + u8 country[3]; + u8 channelEntryListCount; CsrWifiSmeApP2pOperatingChanEntry *channelEntryList; } CsrWifiSmeApP2pOperatingChanList; @@ -337,7 +337,7 @@ typedef struct typedef struct { CsrWifiMacAddress peerMacAddress; - CsrUint8 tid; + u8 tid; CsrWifiSmeApDirection direction; } CsrWifiSmeApBaSession; @@ -384,10 +384,10 @@ typedef struct { CsrWifiSmeApPhySupportMask phySupportedBitmap; CsrUint16 beaconInterval; - CsrUint8 dtimPeriod; + u8 dtimPeriod; CsrUint16 maxListenInterval; - CsrUint8 supportedRatesCount; - CsrUint8 supportedRates[20]; + u8 supportedRatesCount; + u8 supportedRates[20]; CsrWifiSmePreambleType preamble; CsrBool shortSlotTimeEnabled; CsrWifiSmeCtsProtectionType ctsProtectionType; @@ -395,7 +395,7 @@ typedef struct CsrWifiSmeWmmAcParams wmmApParams[4]; CsrWifiSmeWmmAcParams wmmApBcParams[4]; CsrWifiSmeApAccessType accessType; - CsrUint8 macAddressListCount; + u8 macAddressListCount; CsrWifiMacAddress *macAddressList; CsrWifiSmeApHtParams apHtParams; } CsrWifiSmeApMacConfig; @@ -436,7 +436,7 @@ typedef struct CsrWifiSmeP2pGroupCapabilityMask groupCapability; CsrWifiSmeApP2pOperatingChanList operatingChanList; CsrBool opPsEnabled; - CsrUint8 ctWindow; + u8 ctWindow; CsrWifiSmeP2pNoaConfigMethod noaConfigMethod; CsrBool allowNoaWithNonP2pDevices; } CsrWifiSmeApP2pGoConfig; @@ -551,13 +551,13 @@ typedef struct { CsrWifiFsmEvent common; CsrUint16 interfaceTag; - CsrUint8 initialPresence; + u8 initialPresence; CsrWifiSmeApType apType; CsrBool cloakSsid; CsrWifiSsid ssid; CsrWifiSmeRadioIF ifIndex; - CsrUint8 channel; - CsrUint8 maxConnections; + u8 channel; + u8 maxConnections; CsrWifiSmeApSecConfig apCredentials; CsrWifiSmeApMacConfig smeApConfig; CsrWifiSmeApP2pGoConfig p2pGoParam; @@ -764,7 +764,7 @@ typedef struct CsrUint16 interfaceTag; CsrResult status; CsrUint16 secIeLength; - CsrUint8 *secIe; + u8 *secIe; } CsrWifiSmeApBeaconingStartCfm; /******************************************************************************* @@ -822,9 +822,9 @@ typedef struct CsrWifiSmeIEEE80211Reason disassocReason; CsrWifiSmeIEEE80211Reason deauthReason; CsrWifiSmeWpsRegistration WpsRegistration; - CsrUint8 secIeLength; - CsrUint8 *secIe; - CsrUint8 groupKeyId; + u8 secIeLength; + u8 *secIe; + u8 groupKeyId; CsrUint16 seqNumber[8]; } CsrWifiSmeApStaNotifyInd; diff --git a/drivers/staging/csr/csr_wifi_sme_lib.h b/drivers/staging/csr/csr_wifi_sme_lib.h index 67dcb48..63ac5df 100644 --- a/drivers/staging/csr/csr_wifi_sme_lib.h +++ b/drivers/staging/csr/csr_wifi_sme_lib.h @@ -1809,7 +1809,7 @@ extern const CsrCharString *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWN CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_CFM, dst__, src__); \ msg__->status = (status__); \ msg__->numInterfaces = (numInterfaces__); \ - CsrMemCpy(msg__->capBitmap, (capBitmap__), sizeof(CsrUint8) * 2); + CsrMemCpy(msg__->capBitmap, (capBitmap__), sizeof(u8) * 2); #define CsrWifiSmeInterfaceCapabilityGetCfmSendTo(dst__, src__, status__, numInterfaces__, capBitmap__) \ { \ diff --git a/drivers/staging/csr/csr_wifi_sme_prim.h b/drivers/staging/csr/csr_wifi_sme_prim.h index 8ffa50a..c9734a7 100644 --- a/drivers/staging/csr/csr_wifi_sme_prim.h +++ b/drivers/staging/csr/csr_wifi_sme_prim.h @@ -48,7 +48,7 @@ typedef CsrPrim CsrWifiSmePrim; - Automatic *******************************************************************************/ -typedef CsrUint8 CsrWifiSme80211NetworkType; +typedef u8 CsrWifiSme80211NetworkType; #define CSR_WIFI_SME_80211_NETWORK_TYPE_DS ((CsrWifiSme80211NetworkType) 0x00) #define CSR_WIFI_SME_80211_NETWORK_TYPE_OFDM24 ((CsrWifiSme80211NetworkType) 0x01) #define CSR_WIFI_SME_80211_NETWORK_TYPE_OFDM5 ((CsrWifiSme80211NetworkType) 0x02) @@ -70,7 +70,7 @@ typedef CsrUint8 CsrWifiSme80211NetworkType; - Privacy mode is disabled *******************************************************************************/ -typedef CsrUint8 CsrWifiSme80211PrivacyMode; +typedef u8 CsrWifiSme80211PrivacyMode; #define CSR_WIFI_SME_80211_PRIVACY_MODE_DISABLED ((CsrWifiSme80211PrivacyMode) 0x00) #define CSR_WIFI_SME_80211_PRIVACY_MODE_ENABLED ((CsrWifiSme80211PrivacyMode) 0x01) @@ -104,7 +104,7 @@ typedef CsrUint8 CsrWifiSme80211PrivacyMode; network *******************************************************************************/ -typedef CsrUint8 CsrWifiSme80211dTrustLevel; +typedef u8 CsrWifiSme80211dTrustLevel; #define CSR_WIFI_SME_80211D_TRUST_LEVEL_STRICT ((CsrWifiSme80211dTrustLevel) 0x01) #define CSR_WIFI_SME_80211D_TRUST_LEVEL_ADJUNCT ((CsrWifiSme80211dTrustLevel) 0x02) #define CSR_WIFI_SME_80211D_TRUST_LEVEL_BSS ((CsrWifiSme80211dTrustLevel) 0x03) @@ -125,7 +125,7 @@ typedef CsrUint8 CsrWifiSme80211dTrustLevel; CSR_WIFI_SME_AMP_INACTIVE - AMP INACTIVE *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeAmpStatus; +typedef u8 CsrWifiSmeAmpStatus; #define CSR_WIFI_SME_AMP_ACTIVE ((CsrWifiSmeAmpStatus) 0x00) #define CSR_WIFI_SME_AMP_INACTIVE ((CsrWifiSmeAmpStatus) 0x01) @@ -192,7 +192,7 @@ typedef CsrUint16 CsrWifiSmeAuthMode; - Not connected *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeBasicUsability; +typedef u8 CsrWifiSmeBasicUsability; #define CSR_WIFI_SME_BASIC_USABILITY_UNUSABLE ((CsrWifiSmeBasicUsability) 0x00) #define CSR_WIFI_SME_BASIC_USABILITY_POOR ((CsrWifiSmeBasicUsability) 0x01) #define CSR_WIFI_SME_BASIC_USABILITY_SATISFACTORY ((CsrWifiSmeBasicUsability) 0x02) @@ -217,7 +217,7 @@ typedef CsrUint8 CsrWifiSmeBasicUsability; - Specifies P2P *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeBssType; +typedef u8 CsrWifiSmeBssType; #define CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE ((CsrWifiSmeBssType) 0x00) #define CSR_WIFI_SME_BSS_TYPE_ADHOC ((CsrWifiSmeBssType) 0x01) #define CSR_WIFI_SME_BSS_TYPE_ANY_BSS ((CsrWifiSmeBssType) 0x02) @@ -243,7 +243,7 @@ typedef CsrUint8 CsrWifiSmeBssType; - Packet Traffic Arbitrator coexistence signalling *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeCoexScheme; +typedef u8 CsrWifiSmeCoexScheme; #define CSR_WIFI_SME_COEX_SCHEME_DISABLED ((CsrWifiSmeCoexScheme) 0x00) #define CSR_WIFI_SME_COEX_SCHEME_CSR ((CsrWifiSmeCoexScheme) 0x01) #define CSR_WIFI_SME_COEX_SCHEME_CSR_CHANNEL ((CsrWifiSmeCoexScheme) 0x02) @@ -275,7 +275,7 @@ typedef CsrUint8 CsrWifiSmeCoexScheme; application has sent CSR_WIFI_SME_WIFI_OFF_REQ *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeControlIndication; +typedef u8 CsrWifiSmeControlIndication; #define CSR_WIFI_SME_CONTROL_INDICATION_ERROR ((CsrWifiSmeControlIndication) 0x01) #define CSR_WIFI_SME_CONTROL_INDICATION_EXIT ((CsrWifiSmeControlIndication) 0x02) #define CSR_WIFI_SME_CONTROL_INDICATION_USER_REQUESTED ((CsrWifiSmeControlIndication) 0x03) @@ -304,7 +304,7 @@ typedef CsrUint8 CsrWifiSmeControlIndication; this option specifies the same behaviour as AUTOMATIC *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeCtsProtectionType; +typedef u8 CsrWifiSmeCtsProtectionType; #define CSR_WIFI_SME_CTS_PROTECTION_AUTOMATIC ((CsrWifiSmeCtsProtectionType) 0x00) #define CSR_WIFI_SME_CTS_PROTECTION_FORCE_ENABLED ((CsrWifiSmeCtsProtectionType) 0x01) #define CSR_WIFI_SME_CTS_PROTECTION_FORCE_DISABLED ((CsrWifiSmeCtsProtectionType) 0x02) @@ -328,7 +328,7 @@ typedef CsrUint8 CsrWifiSmeCtsProtectionType; CURRENTLY NOT SUPPORTED *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeD3AutoScanMode; +typedef u8 CsrWifiSmeD3AutoScanMode; #define CSR_WIFI_SME_D3AUTO_SCAN_MODE_PSON ((CsrWifiSmeD3AutoScanMode) 0x00) #define CSR_WIFI_SME_D3AUTO_SCAN_MODE_PSOFF ((CsrWifiSmeD3AutoScanMode) 0x01) #define CSR_WIFI_SME_D3AUTO_SCAN_MODE_PSAUTO ((CsrWifiSmeD3AutoScanMode) 0x02) @@ -396,7 +396,7 @@ typedef CsrUint16 CsrWifiSmeEncryption; - Preformated IEEE 802.11 header for user plane *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeFirmwareDriverInterface; +typedef u8 CsrWifiSmeFirmwareDriverInterface; #define CSR_WIFI_SME_FIRMWARE_DRIVER_INTERFACE_UNIT_DATA_INTERFACE ((CsrWifiSmeFirmwareDriverInterface) 0x00) #define CSR_WIFI_SME_FIRMWARE_DRIVER_INTERFACE_PACKET_INTERFACE ((CsrWifiSmeFirmwareDriverInterface) 0x01) @@ -417,7 +417,7 @@ typedef CsrUint8 CsrWifiSmeFirmwareDriverInterface; - For future use. *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeHostPowerMode; +typedef u8 CsrWifiSmeHostPowerMode; #define CSR_WIFI_SME_HOST_POWER_MODE_ACTIVE ((CsrWifiSmeHostPowerMode) 0x00) #define CSR_WIFI_SME_HOST_POWER_MODE_POWER_SAVE ((CsrWifiSmeHostPowerMode) 0x01) #define CSR_WIFI_SME_HOST_POWER_MODE_FULL_POWER_SAVE ((CsrWifiSmeHostPowerMode) 0x02) @@ -866,7 +866,7 @@ typedef CsrUint32 CsrWifiSmeIndications; CSR_WIFI_SME_KEY_TYPE_CCKM - Key for Cisco Centralized Key Management *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeKeyType; +typedef u8 CsrWifiSmeKeyType; #define CSR_WIFI_SME_KEY_TYPE_GROUP ((CsrWifiSmeKeyType) 0x00) #define CSR_WIFI_SME_KEY_TYPE_PAIRWISE ((CsrWifiSmeKeyType) 0x01) #define CSR_WIFI_SME_KEY_TYPE_STAKEY ((CsrWifiSmeKeyType) 0x02) @@ -891,7 +891,7 @@ typedef CsrUint8 CsrWifiSmeKeyType; CSR_WIFI_SME_LIST_ACTION_FLUSH - Remove all items *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeListAction; +typedef u8 CsrWifiSmeListAction; #define CSR_WIFI_SME_LIST_ACTION_GET ((CsrWifiSmeListAction) 0x00) #define CSR_WIFI_SME_LIST_ACTION_ADD ((CsrWifiSmeListAction) 0x01) #define CSR_WIFI_SME_LIST_ACTION_REMOVE ((CsrWifiSmeListAction) 0x02) @@ -933,7 +933,7 @@ typedef CsrUint8 CsrWifiSmeListAction; station has disconnected from the AP *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeMediaStatus; +typedef u8 CsrWifiSmeMediaStatus; #define CSR_WIFI_SME_MEDIA_STATUS_CONNECTED ((CsrWifiSmeMediaStatus) 0x00) #define CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED ((CsrWifiSmeMediaStatus) 0x01) @@ -966,7 +966,7 @@ typedef CsrUint8 CsrWifiSmeMediaStatus; otherwise. *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeP2pCapability; +typedef u8 CsrWifiSmeP2pCapability; #define CSR_WIFI_SME_P2P_SERVICE_DISCOVERY_CAPABILITY ((CsrWifiSmeP2pCapability) 0x01) #define CSR_WIFI_SME_P2P_CLIENT_DISCOVERABILITY_CAPABILITY ((CsrWifiSmeP2pCapability) 0x02) #define CSR_WIFI_SME_P2P_CONCURRENT_OPERATION_CAPABILITY ((CsrWifiSmeP2pCapability) 0x04) @@ -995,7 +995,7 @@ typedef CsrUint8 CsrWifiSmeP2pCapability; - Support of persistent reconnect *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeP2pGroupCapability; +typedef u8 CsrWifiSmeP2pGroupCapability; #define CSR_WIFI_P2P_GRP_CAP_GO ((CsrWifiSmeP2pGroupCapability) 0x01) #define CSR_WIFI_P2P_GRP_CAP_PERSISTENT ((CsrWifiSmeP2pGroupCapability) 0x02) #define CSR_WIFI_P2P_GRP_CAP_INTRABSS_DIST ((CsrWifiSmeP2pGroupCapability) 0x08) @@ -1016,7 +1016,7 @@ typedef CsrUint8 CsrWifiSmeP2pGroupCapability; CSR_WIFI_P2P_NOA_USER_DEFINED - NOA as specified by the user *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeP2pNoaConfigMethod; +typedef u8 CsrWifiSmeP2pNoaConfigMethod; #define CSR_WIFI_P2P_NOA_NONE ((CsrWifiSmeP2pNoaConfigMethod) 0x00) #define CSR_WIFI_P2P_NOA_AUTONOMOUS ((CsrWifiSmeP2pNoaConfigMethod) 0x01) #define CSR_WIFI_P2P_NOA_USER_DEFINED ((CsrWifiSmeP2pNoaConfigMethod) 0x02) @@ -1038,7 +1038,7 @@ typedef CsrUint8 CsrWifiSmeP2pNoaConfigMethod; within a P2P Group *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeP2pRole; +typedef u8 CsrWifiSmeP2pRole; #define CSR_WIFI_SME_P2P_ROLE_NONE ((CsrWifiSmeP2pRole) 0x00) #define CSR_WIFI_SME_P2P_ROLE_STANDALONE ((CsrWifiSmeP2pRole) 0x01) #define CSR_WIFI_SME_P2P_ROLE_GO ((CsrWifiSmeP2pRole) 0x02) @@ -1082,7 +1082,7 @@ typedef CsrUint8 CsrWifiSmeP2pRole; - Fail; Status Reserved *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeP2pStatus; +typedef u8 CsrWifiSmeP2pStatus; #define CSR_WIFI_SME_P2P_STATUS_SUCCESS ((CsrWifiSmeP2pStatus) 0x00) #define CSR_WIFI_SME_P2P_STATUS_FAIL_INFO_UNAVAILABLE ((CsrWifiSmeP2pStatus) 0x01) #define CSR_WIFI_SME_P2P_STATUS_FAIL_INCOMPATIBLE_PARAM ((CsrWifiSmeP2pStatus) 0x02) @@ -1115,7 +1115,7 @@ typedef CsrUint8 CsrWifiSmeP2pStatus; match at least one of the specified TCLAS IEs. *******************************************************************************/ -typedef CsrUint8 CsrWifiSmePacketFilterMode; +typedef u8 CsrWifiSmePacketFilterMode; #define CSR_WIFI_SME_PACKET_FILTER_MODE_OPT_OUT ((CsrWifiSmePacketFilterMode) 0x00) #define CSR_WIFI_SME_PACKET_FILTER_MODE_OPT_IN ((CsrWifiSmePacketFilterMode) 0x03) @@ -1142,7 +1142,7 @@ typedef CsrUint8 CsrWifiSmePacketFilterMode; analysis *******************************************************************************/ -typedef CsrUint8 CsrWifiSmePowerSaveLevel; +typedef u8 CsrWifiSmePowerSaveLevel; #define CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW ((CsrWifiSmePowerSaveLevel) 0x00) #define CSR_WIFI_SME_POWER_SAVE_LEVEL_HIGH ((CsrWifiSmePowerSaveLevel) 0x01) #define CSR_WIFI_SME_POWER_SAVE_LEVEL_MED ((CsrWifiSmePowerSaveLevel) 0x02) @@ -1161,7 +1161,7 @@ typedef CsrUint8 CsrWifiSmePowerSaveLevel; CSR_WIFI_SME_USE_SHORT_PREAMBLE - Use short PPDU format *******************************************************************************/ -typedef CsrUint8 CsrWifiSmePreambleType; +typedef u8 CsrWifiSmePreambleType; #define CSR_WIFI_SME_USE_LONG_PREAMBLE ((CsrWifiSmePreambleType) 0x00) #define CSR_WIFI_SME_USE_SHORT_PREAMBLE ((CsrWifiSmePreambleType) 0x01) @@ -1179,7 +1179,7 @@ typedef CsrUint8 CsrWifiSmePreambleType; CSR_WIFI_SME_RADIO_IF_BOTH - Future use: currently not supported *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeRadioIF; +typedef u8 CsrWifiSmeRadioIF; #define CSR_WIFI_SME_RADIO_IF_GHZ_2_4 ((CsrWifiSmeRadioIF) 0x01) #define CSR_WIFI_SME_RADIO_IF_GHZ_5_0 ((CsrWifiSmeRadioIF) 0x02) #define CSR_WIFI_SME_RADIO_IF_BOTH ((CsrWifiSmeRadioIF) 0x03) @@ -1217,7 +1217,7 @@ typedef CsrUint8 CsrWifiSmeRadioIF; - See IEEE 802.11 Standard *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeRegulatoryDomain; +typedef u8 CsrWifiSmeRegulatoryDomain; #define CSR_WIFI_SME_REGULATORY_DOMAIN_OTHER ((CsrWifiSmeRegulatoryDomain) 0x00) #define CSR_WIFI_SME_REGULATORY_DOMAIN_FCC ((CsrWifiSmeRegulatoryDomain) 0x10) #define CSR_WIFI_SME_REGULATORY_DOMAIN_IC ((CsrWifiSmeRegulatoryDomain) 0x20) @@ -1249,7 +1249,7 @@ typedef CsrUint8 CsrWifiSmeRegulatoryDomain; - A better AP has been found *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeRoamReason; +typedef u8 CsrWifiSmeRoamReason; #define CSR_WIFI_SME_ROAM_REASON_BEACONLOST ((CsrWifiSmeRoamReason) 0x00) #define CSR_WIFI_SME_ROAM_REASON_DISASSOCIATED ((CsrWifiSmeRoamReason) 0x01) #define CSR_WIFI_SME_ROAM_REASON_DEAUTHENTICATED ((CsrWifiSmeRoamReason) 0x02) @@ -1272,7 +1272,7 @@ typedef CsrUint8 CsrWifiSmeRoamReason; messages *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeScanType; +typedef u8 CsrWifiSmeScanType; #define CSR_WIFI_SME_SCAN_TYPE_ALL ((CsrWifiSmeScanType) 0x00) #define CSR_WIFI_SME_SCAN_TYPE_ACTIVE ((CsrWifiSmeScanType) 0x01) #define CSR_WIFI_SME_SCAN_TYPE_PASSIVE ((CsrWifiSmeScanType) 0x02) @@ -1305,7 +1305,7 @@ typedef CsrUint8 CsrWifiSmeScanType; received each second in either direction *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeTrafficType; +typedef u8 CsrWifiSmeTrafficType; #define CSR_WIFI_SME_TRAFFIC_TYPE_OCCASIONAL ((CsrWifiSmeTrafficType) 0x00) #define CSR_WIFI_SME_TRAFFIC_TYPE_BURSTY ((CsrWifiSmeTrafficType) 0x01) #define CSR_WIFI_SME_TRAFFIC_TYPE_PERIODIC ((CsrWifiSmeTrafficType) 0x02) @@ -1329,7 +1329,7 @@ typedef CsrUint8 CsrWifiSmeTrafficType; - Voice traffic TSPEC *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeTspecCtrl; +typedef u8 CsrWifiSmeTspecCtrl; #define CSR_WIFI_SME_TSPEC_CTRL_STRICT ((CsrWifiSmeTspecCtrl) 0x01) #define CSR_WIFI_SME_TSPEC_CTRL_CCX_SIGNALLING ((CsrWifiSmeTspecCtrl) 0x02) #define CSR_WIFI_SME_TSPEC_CTRL_CCX_VOICE ((CsrWifiSmeTspecCtrl) 0x04) @@ -1375,7 +1375,7 @@ typedef CsrUint8 CsrWifiSmeTspecCtrl; - The AP has deleted the TSPEC *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeTspecResultCode; +typedef u8 CsrWifiSmeTspecResultCode; #define CSR_WIFI_SME_TSPEC_RESULT_SUCCESS ((CsrWifiSmeTspecResultCode) 0x00) #define CSR_WIFI_SME_TSPEC_RESULT_UNSPECIFIED_QOS_FAILURE ((CsrWifiSmeTspecResultCode) 0x01) #define CSR_WIFI_SME_TSPEC_RESULT_FAILURE ((CsrWifiSmeTspecResultCode) 0x02) @@ -1405,7 +1405,7 @@ typedef CsrUint8 CsrWifiSmeTspecResultCode; CSR_WIFI_SME_WEP_AUTH_MODE_SHARED - Shared-key WEP enabled network. *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeWepAuthMode; +typedef u8 CsrWifiSmeWepAuthMode; #define CSR_WIFI_SME_WEP_AUTH_MODE_OPEN ((CsrWifiSmeWepAuthMode) 0x00) #define CSR_WIFI_SME_WEP_AUTH_MODE_SHARED ((CsrWifiSmeWepAuthMode) 0x01) @@ -1424,7 +1424,7 @@ typedef CsrUint8 CsrWifiSmeWepAuthMode; - WEP 128 credential *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeWepCredentialType; +typedef u8 CsrWifiSmeWepCredentialType; #define CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64 ((CsrWifiSmeWepCredentialType) 0x00) #define CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128 ((CsrWifiSmeWepCredentialType) 0x01) @@ -1445,7 +1445,7 @@ typedef CsrUint8 CsrWifiSmeWepCredentialType; available WMM features. *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeWmmMode; +typedef u8 CsrWifiSmeWmmMode; #define CSR_WIFI_SME_WMM_MODE_DISABLED ((CsrWifiSmeWmmMode) 0x00) #define CSR_WIFI_SME_WMM_MODE_AC_ENABLED ((CsrWifiSmeWmmMode) 0x01) #define CSR_WIFI_SME_WMM_MODE_PS_ENABLED ((CsrWifiSmeWmmMode) 0x02) @@ -1491,7 +1491,7 @@ typedef CsrUint8 CsrWifiSmeWmmMode; and MMPDUs) per USP *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeWmmQosInfo; +typedef u8 CsrWifiSmeWmmQosInfo; #define CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_ALL ((CsrWifiSmeWmmQosInfo) 0x00) #define CSR_WIFI_SME_WMM_QOS_INFO_AC_VO ((CsrWifiSmeWmmQosInfo) 0x01) #define CSR_WIFI_SME_WMM_QOS_INFO_AC_VI ((CsrWifiSmeWmmQosInfo) 0x02) @@ -1584,7 +1584,7 @@ typedef CsrUint16 CsrWifiSmeWpsConfigType; - Others. *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeWpsDeviceCategory; +typedef u8 CsrWifiSmeWpsDeviceCategory; #define CSR_WIFI_SME_WPS_CATEGORY_UNSPECIFIED ((CsrWifiSmeWpsDeviceCategory) 0x00) #define CSR_WIFI_SME_WPS_CATEGORY_COMPUTER ((CsrWifiSmeWpsDeviceCategory) 0x01) #define CSR_WIFI_SME_WPS_CATEGORY_INPUT_DEV ((CsrWifiSmeWpsDeviceCategory) 0x02) @@ -1726,7 +1726,7 @@ typedef CsrUint8 CsrWifiSmeWpsDeviceCategory; - Bar code reader. *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeWpsDeviceSubCategory; +typedef u8 CsrWifiSmeWpsDeviceSubCategory; #define CSR_WIFI_SME_WPS_SUB_CATEGORY_UNSPECIFIED ((CsrWifiSmeWpsDeviceSubCategory) 0x00) #define CSR_WIFI_SME_WPS_STORAGE_SUB_CATEGORY_NAS ((CsrWifiSmeWpsDeviceSubCategory) 0x01) #define CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_PRNTR ((CsrWifiSmeWpsDeviceSubCategory) 0x01) @@ -1827,7 +1827,7 @@ typedef CsrUint16 CsrWifiSmeWpsDpid; CSR_WIFI_SME_WPS_REG_UNKNOWN - No encryption set *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeWpsRegistration; +typedef u8 CsrWifiSmeWpsRegistration; #define CSR_WIFI_SME_WPS_REG_NOT_REQUIRED ((CsrWifiSmeWpsRegistration) 0x00) #define CSR_WIFI_SME_WPS_REG_REQUIRED ((CsrWifiSmeWpsRegistration) 0x01) #define CSR_WIFI_SME_WPS_REG_UNKNOWN ((CsrWifiSmeWpsRegistration) 0x02) @@ -1872,7 +1872,7 @@ typedef CsrUint32 CsrWifiSmeIndicationsMask; Mask type for use with the values defined by CsrWifiSmeP2pCapability *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeP2pCapabilityMask; +typedef u8 CsrWifiSmeP2pCapabilityMask; /******************************************************************************* NAME @@ -1882,7 +1882,7 @@ typedef CsrUint8 CsrWifiSmeP2pCapabilityMask; Mask type for use with the values defined by CsrWifiSmeP2pGroupCapability *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeP2pGroupCapabilityMask; +typedef u8 CsrWifiSmeP2pGroupCapabilityMask; /******************************************************************************* NAME @@ -1892,7 +1892,7 @@ typedef CsrUint8 CsrWifiSmeP2pGroupCapabilityMask; Mask type for use with the values defined by CsrWifiSmeTspecCtrl *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeTspecCtrlMask; +typedef u8 CsrWifiSmeTspecCtrlMask; /******************************************************************************* NAME @@ -1902,7 +1902,7 @@ typedef CsrUint8 CsrWifiSmeTspecCtrlMask; Mask type for use with the values defined by CsrWifiSmeWmmMode *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeWmmModeMask; +typedef u8 CsrWifiSmeWmmModeMask; /******************************************************************************* NAME @@ -1912,7 +1912,7 @@ typedef CsrUint8 CsrWifiSmeWmmModeMask; Mask type for use with the values defined by CsrWifiSmeWmmQosInfo *******************************************************************************/ -typedef CsrUint8 CsrWifiSmeWmmQosInfoMask; +typedef u8 CsrWifiSmeWmmQosInfoMask; /******************************************************************************* NAME @@ -1965,7 +1965,7 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint8 listenChannel; + u8 listenChannel; CsrUint16 availabilityDuration; CsrUint16 avalabilityPeriod; } CsrWifiSmeAvailabilityConfig; @@ -1987,9 +1987,9 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint8 keepAliveTimeMs; + u8 keepAliveTimeMs; CsrBool apRoamingEnabled; - CsrUint8 measurementsMask; + u8 measurementsMask; CsrBool ccxRadioMgtEnabled; } CsrWifiSmeCcxConfig; @@ -2125,8 +2125,8 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint8 unifiTxDataRate; - CsrUint8 unifiRxDataRate; + u8 unifiTxDataRate; + u8 unifiRxDataRate; CsrUint32 dot11RetryCount; CsrUint32 dot11MultipleRetryCount; CsrUint32 dot11AckFailureCount; @@ -2168,7 +2168,7 @@ typedef struct typedef struct { CsrUint16 length; - CsrUint8 *data; + u8 *data; } CsrWifiSmeDataBlock; /******************************************************************************* @@ -2185,7 +2185,7 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint8 empty; + u8 empty; } CsrWifiSmeEmpty; /******************************************************************************* @@ -2232,7 +2232,7 @@ typedef struct typedef struct { CsrBool unifiFixMaxTxDataRate; - CsrUint8 unifiFixTxDataRate; + u8 unifiFixTxDataRate; CsrUint16 dot11RtsThreshold; CsrUint16 dot11FragmentationThreshold; CsrUint16 dot11CurrentTxPowerLevel; @@ -2254,7 +2254,7 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint8 listenChannel; + u8 listenChannel; CsrUint16 availabilityDuration; CsrUint16 avalabilityPeriod; } CsrWifiSmeP2pProfileIdentity; @@ -2275,7 +2275,7 @@ typedef struct typedef struct { CsrWifiMacAddress bssid; - CsrUint8 pmkid[16]; + u8 pmkid[16]; } CsrWifiSmePmkid; /******************************************************************************* @@ -2313,7 +2313,7 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint8 pmkidsCount; + u8 pmkidsCount; CsrWifiSmePmkid *pmkids; } CsrWifiSmePmkidList; @@ -2342,7 +2342,7 @@ typedef struct CsrBool dot11MultiDomainCapabilityImplemented; CsrBool dot11MultiDomainCapabilityEnabled; CsrWifiSmeRegulatoryDomain currentRegulatoryDomain; - CsrUint8 currentCountryCode[2]; + u8 currentCountryCode[2]; } CsrWifiSmeRegulatoryDomainInfo; /******************************************************************************* @@ -2424,7 +2424,7 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint8 data[8]; + u8 data[8]; } CsrWifiSmeTsfTime; /******************************************************************************* @@ -2485,9 +2485,9 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint8 cwMin; - CsrUint8 cwMax; - CsrUint8 aifs; + u8 cwMin; + u8 cwMax; + u8 aifs; CsrUint16 txopLimit; CsrBool admissionControlMandatory; } CsrWifiSmeWmmAcParams; @@ -2506,7 +2506,7 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint8 deviceDetails[8]; + u8 deviceDetails[8]; } CsrWifiSmeWpsDeviceType; /******************************************************************************* @@ -2524,7 +2524,7 @@ typedef struct typedef struct { CsrBool spportWps; - CsrUint8 deviceType; + u8 deviceType; } CsrWifiSmeWpsDeviceTypeCommon; /******************************************************************************* @@ -2562,7 +2562,7 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint8 cloakedSsidsCount; + u8 cloakedSsidsCount; CsrWifiSsid *cloakedSsids; } CsrWifiSmeCloakedSsidConfig; @@ -2675,10 +2675,10 @@ typedef struct CsrWifiSmeAuthModeMask authModeMask; CsrWifiSmeEncryptionMask encryptionModeMask; CsrUint16 mlmeAssociateReqInformationElementsLength; - CsrUint8 *mlmeAssociateReqInformationElements; + u8 *mlmeAssociateReqInformationElements; CsrWifiSmeWmmQosInfoMask wmmQosInfo; CsrBool adhocJoinOnly; - CsrUint8 adhocChannel; + u8 adhocChannel; } CsrWifiSmeConnectionConfig; /******************************************************************************* @@ -2748,7 +2748,7 @@ typedef struct CsrWifiSsid ssid; CsrWifiMacAddress bssid; CsrWifiSme80211NetworkType networkType80211; - CsrUint8 channelNumber; + u8 channelNumber; CsrUint16 channelFrequency; CsrWifiSmeAuthMode authMode; CsrWifiSmeEncryption pairwiseCipher; @@ -2758,23 +2758,23 @@ typedef struct CsrUint16 beaconPeriodTu; CsrBool reassociation; CsrUint16 beaconFrameLength; - CsrUint8 *beaconFrame; + u8 *beaconFrame; CsrUint16 associationReqFrameLength; - CsrUint8 *associationReqFrame; + u8 *associationReqFrame; CsrUint16 associationRspFrameLength; - CsrUint8 *associationRspFrame; + u8 *associationRspFrame; CsrUint16 assocScanInfoElementsLength; - CsrUint8 *assocScanInfoElements; + u8 *assocScanInfoElements; CsrUint16 assocReqCapabilities; CsrUint16 assocReqListenIntervalTu; CsrWifiMacAddress assocReqApAddress; CsrUint16 assocReqInfoElementsLength; - CsrUint8 *assocReqInfoElements; + u8 *assocReqInfoElements; CsrWifiSmeIEEE80211Result assocRspResult; CsrUint16 assocRspCapabilityInfo; CsrUint16 assocRspAssociationId; CsrUint16 assocRspInfoElementsLength; - CsrUint8 *assocRspInfoElements; + u8 *assocRspInfoElements; } CsrWifiSmeConnectionInfo; /******************************************************************************* @@ -2798,7 +2798,7 @@ typedef struct typedef struct { CsrWifiSme80211dTrustLevel trustLevel; - CsrUint8 countryCode[2]; + u8 countryCode[2]; CsrWifiSmeFirmwareDriverInterface firmwareDriverInterface; CsrBool enableStrictDraftN; } CsrWifiSmeDeviceConfig; @@ -2828,10 +2828,10 @@ typedef struct CsrWifiSmeWpsConfigTypeMask configMethods; CsrWifiSmeP2pCapabilityMask p2PDeviceCap; CsrWifiSmeWpsDeviceType primDeviceType; - CsrUint8 secondaryDeviceTypeCount; + u8 secondaryDeviceTypeCount; CsrWifiSmeWpsDeviceType *secDeviceType; - CsrUint8 deviceName[32]; - CsrUint8 deviceNameLength; + u8 deviceName[32]; + u8 deviceNameLength; } CsrWifiSmeDeviceInfo; /******************************************************************************* @@ -2855,10 +2855,10 @@ typedef struct { CsrWifiMacAddress p2pDeviceAddress; CsrWifiSmeWpsDeviceTypeCommon primaryDeviceType; - CsrUint8 secondaryDeviceTypesCount; - CsrUint8 secondaryDeviceTypes[10]; - CsrUint8 deviceNameLength; - CsrUint8 deviceName[32]; + u8 secondaryDeviceTypesCount; + u8 secondaryDeviceTypes[10]; + u8 deviceNameLength; + u8 deviceName[32]; } CsrWifiSmeDeviceInfoCommon; /******************************************************************************* @@ -2924,13 +2924,13 @@ typedef struct typedef struct { CsrWifiSmeKeyType keyType; - CsrUint8 keyIndex; + u8 keyIndex; CsrBool wepTxKey; CsrUint16 keyRsc[8]; CsrBool authenticator; CsrWifiMacAddress address; - CsrUint8 keyLength; - CsrUint8 key[32]; + u8 keyLength; + u8 key[32]; } CsrWifiSmeKey; /******************************************************************************* @@ -2972,7 +2972,7 @@ typedef struct { CsrWifiSmeP2pGroupCapabilityMask groupCapability; CsrWifiMacAddress p2pDeviceAddress; - CsrUint8 p2pClientInfoCount; + u8 p2pClientInfoCount; CsrWifiSmeP2pClientInfoType *p2PClientInfo; } CsrWifiSmeP2pGroupInfo; @@ -3003,7 +3003,7 @@ typedef struct CsrUint16 listenIntervalTu; CsrBool rxDtims; CsrWifiSmeD3AutoScanMode d3AutoScanMode; - CsrUint8 clientTrafficWindow; + u8 clientTrafficWindow; CsrBool opportunisticPowerSave; CsrBool noticeOfAbsence; } CsrWifiSmePowerConfig; @@ -3041,7 +3041,7 @@ typedef struct CsrWifiSmeRoamingBandData roamingBands[3]; CsrBool disableSmoothRoaming; CsrBool disableRoamScans; - CsrUint8 reconnectLimit; + u8 reconnectLimit; CsrUint16 reconnectLimitIntervalMs; CsrWifiSmeScanConfigData roamScanCfg[3]; } CsrWifiSmeRoamingConfig; @@ -3094,7 +3094,7 @@ typedef struct CsrInt8 lowSnrThreshold; CsrInt8 deltaSnrThreshold; CsrUint16 passiveChannelListCount; - CsrUint8 *passiveChannelList; + u8 *passiveChannelList; } CsrWifiSmeScanConfig; /******************************************************************************* @@ -3149,11 +3149,11 @@ typedef struct CsrWifiSmeTsfTime localTime; CsrUint16 channelFrequency; CsrUint16 capabilityInformation; - CsrUint8 channelNumber; + u8 channelNumber; CsrWifiSmeBasicUsability usability; CsrWifiSmeBssType bssType; CsrUint16 informationElementsLength; - CsrUint8 *informationElements; + u8 *informationElements; CsrWifiSmeP2pRole p2pDeviceRole; union { CsrWifiSmeEmpty reservedCli; @@ -3189,8 +3189,8 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint8 connectionQualityRssiChangeTrigger; - CsrUint8 connectionQualitySnrChangeTrigger; + u8 connectionQualityRssiChangeTrigger; + u8 connectionQualitySnrChangeTrigger; CsrWifiSmeWmmModeMask wmmModeMask; CsrWifiSmeRadioIF ifIndex; CsrBool allowUnicastUseGroupCipher; @@ -3221,11 +3221,11 @@ typedef struct typedef struct { CsrWifiSmeWepAuthMode wepAuthType; - CsrUint8 selectedWepKey; - CsrUint8 key1[13]; - CsrUint8 key2[13]; - CsrUint8 key3[13]; - CsrUint8 key4[13]; + u8 selectedWepKey; + u8 key1[13]; + u8 key2[13]; + u8 key3[13]; + u8 key4[13]; } CsrWifiSmeWep128Keys; /******************************************************************************* @@ -3252,11 +3252,11 @@ typedef struct typedef struct { CsrWifiSmeWepAuthMode wepAuthType; - CsrUint8 selectedWepKey; - CsrUint8 key1[5]; - CsrUint8 key2[5]; - CsrUint8 key3[5]; - CsrUint8 key4[5]; + u8 selectedWepKey; + u8 key1[5]; + u8 key2[5]; + u8 key3[5]; + u8 key4[5]; } CsrWifiSmeWep64Keys; /******************************************************************************* @@ -3315,23 +3315,23 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint8 wpsVersion; - CsrUint8 uuid[16]; - CsrUint8 deviceName[32]; - CsrUint8 deviceNameLength; - CsrUint8 manufacturer[64]; - CsrUint8 manufacturerLength; - CsrUint8 modelName[32]; - CsrUint8 modelNameLength; - CsrUint8 modelNumber[32]; - CsrUint8 modelNumberLength; - CsrUint8 serialNumber[32]; + u8 wpsVersion; + u8 uuid[16]; + u8 deviceName[32]; + u8 deviceNameLength; + u8 manufacturer[64]; + u8 manufacturerLength; + u8 modelName[32]; + u8 modelNameLength; + u8 modelNumber[32]; + u8 modelNumberLength; + u8 serialNumber[32]; CsrWifiSmeWpsDeviceType primDeviceType; - CsrUint8 secondaryDeviceTypeCount; + u8 secondaryDeviceTypeCount; CsrWifiSmeWpsDeviceType *secondaryDeviceType; CsrWifiSmeWpsConfigTypeMask configMethods; - CsrUint8 rfBands; - CsrUint8 osVersion[4]; + u8 rfBands; + u8 osVersion[4]; } CsrWifiSmeWpsConfig; @@ -3564,7 +3564,7 @@ typedef struct CsrWifiFsmEvent common; CsrUint16 interfaceTag; CsrWifiSmeListAction action; - CsrUint8 setAddressCount; + u8 setAddressCount; CsrWifiMacAddress *setAddresses; } CsrWifiSmeBlacklistReq; @@ -3607,7 +3607,7 @@ typedef struct { CsrWifiFsmEvent common; CsrUint16 calibrationDataLength; - CsrUint8 *calibrationData; + u8 *calibrationData; } CsrWifiSmeCalibrationDataSetReq; /******************************************************************************* @@ -4024,7 +4024,7 @@ typedef struct { CsrWifiFsmEvent common; CsrUint16 mibAttributeLength; - CsrUint8 *mibAttribute; + u8 *mibAttribute; } CsrWifiSmeMibGetNextReq; /******************************************************************************* @@ -4047,7 +4047,7 @@ typedef struct { CsrWifiFsmEvent common; CsrUint16 mibAttributeLength; - CsrUint8 *mibAttribute; + u8 *mibAttribute; } CsrWifiSmeMibGetReq; /******************************************************************************* @@ -4078,7 +4078,7 @@ typedef struct { CsrWifiFsmEvent common; CsrUint16 mibAttributeLength; - CsrUint8 *mibAttribute; + u8 *mibAttribute; } CsrWifiSmeMibSetReq; /******************************************************************************* @@ -4109,7 +4109,7 @@ typedef struct CsrWifiFsmEvent common; CsrUint16 interfaceTag; CsrWifiSmeListAction action; - CsrUint8 setAddressesCount; + u8 setAddressesCount; CsrWifiMacAddress *setAddresses; } CsrWifiSmeMulticastAddressReq; @@ -4159,7 +4159,7 @@ typedef struct CsrWifiFsmEvent common; CsrUint16 interfaceTag; CsrUint16 filterLength; - CsrUint8 *filter; + u8 *filter; CsrWifiSmePacketFilterMode mode; CsrWifiIp4Address arpFilterAddress; } CsrWifiSmePacketFilterSetReq; @@ -4211,7 +4211,7 @@ typedef struct CsrWifiFsmEvent common; CsrUint16 interfaceTag; CsrWifiSmeListAction action; - CsrUint8 setPmkidsCount; + u8 setPmkidsCount; CsrWifiSmePmkid *setPmkids; } CsrWifiSmePmkidReq; @@ -4398,16 +4398,16 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint8 ssidCount; + u8 ssidCount; CsrWifiSsid *ssid; CsrWifiMacAddress bssid; CsrBool forceScan; CsrWifiSmeBssType bssType; CsrWifiSmeScanType scanType; CsrUint16 channelListCount; - CsrUint8 *channelList; + u8 *channelList; CsrUint16 probeIeLength; - CsrUint8 *probeIe; + u8 *probeIe; } CsrWifiSmeScanFullReq; /******************************************************************************* @@ -4564,9 +4564,9 @@ typedef struct CsrBool strict; CsrWifiSmeTspecCtrlMask ctrlMask; CsrUint16 tspecLength; - CsrUint8 *tspec; + u8 *tspec; CsrUint16 tclasLength; - CsrUint8 *tclas; + u8 *tclas; } CsrWifiSmeTspecReq; /******************************************************************************* @@ -4831,7 +4831,7 @@ typedef struct { CsrWifiFsmEvent common; CsrUint32 dataLength; - CsrUint8 *data; + u8 *data; } CsrWifiSmeSetReq; /******************************************************************************* @@ -4980,7 +4980,7 @@ typedef struct CsrUint16 interfaceTag; CsrResult status; CsrWifiSmeListAction action; - CsrUint8 getAddressCount; + u8 getAddressCount; CsrWifiMacAddress *getAddresses; } CsrWifiSmeBlacklistCfm; @@ -5006,7 +5006,7 @@ typedef struct CsrWifiFsmEvent common; CsrResult status; CsrUint16 calibrationDataLength; - CsrUint8 *calibrationData; + u8 *calibrationData; } CsrWifiSmeCalibrationDataGetCfm; /******************************************************************************* @@ -5535,7 +5535,7 @@ typedef struct CsrWifiFsmEvent common; CsrResult status; CsrUint16 mibAttributeLength; - CsrUint8 *mibAttribute; + u8 *mibAttribute; } CsrWifiSmeMibGetCfm; /******************************************************************************* @@ -5562,7 +5562,7 @@ typedef struct CsrWifiFsmEvent common; CsrResult status; CsrUint16 mibAttributeLength; - CsrUint8 *mibAttribute; + u8 *mibAttribute; } CsrWifiSmeMibGetNextCfm; /******************************************************************************* @@ -5641,7 +5641,7 @@ typedef struct CsrUint16 interfaceTag; CsrResult status; CsrWifiSmeListAction action; - CsrUint8 getAddressesCount; + u8 getAddressesCount; CsrWifiMacAddress *getAddresses; } CsrWifiSmeMulticastAddressCfm; @@ -5709,7 +5709,7 @@ typedef struct { CsrWifiFsmEvent common; CsrUint16 interfaceTag; - CsrUint8 pmkidCandidatesCount; + u8 pmkidCandidatesCount; CsrWifiSmePmkidCandidate *pmkidCandidates; } CsrWifiSmePmkidCandidateListInd; @@ -5740,7 +5740,7 @@ typedef struct CsrUint16 interfaceTag; CsrResult status; CsrWifiSmeListAction action; - CsrUint8 getPmkidsCount; + u8 getPmkidsCount; CsrWifiSmePmkid *getPmkids; } CsrWifiSmePmkidCfm; @@ -6132,7 +6132,7 @@ typedef struct CsrUint32 transactionId; CsrWifiSmeTspecResultCode tspecResultCode; CsrUint16 tspecLength; - CsrUint8 *tspec; + u8 *tspec; } CsrWifiSmeTspecInd; /******************************************************************************* @@ -6163,7 +6163,7 @@ typedef struct CsrUint32 transactionId; CsrWifiSmeTspecResultCode tspecResultCode; CsrUint16 tspecLength; - CsrUint8 *tspec; + u8 *tspec; } CsrWifiSmeTspecCfm; /******************************************************************************* @@ -6400,7 +6400,7 @@ typedef struct CsrWifiFsmEvent common; CsrResult status; CsrUint16 numInterfaces; - CsrUint8 capBitmap[2]; + u8 capBitmap[2]; } CsrWifiSmeInterfaceCapabilityGetCfm; /******************************************************************************* @@ -6466,7 +6466,7 @@ typedef struct { CsrWifiFsmEvent common; CsrUint32 dataLength; - CsrUint8 *data; + u8 *data; } CsrWifiSmeCoreDumpInd; /******************************************************************************* diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.c b/drivers/staging/csr/csr_wifi_sme_serialize.c index 5c1bc31..4558629 100644 --- a/drivers/staging/csr/csr_wifi_sme_serialize.c +++ b/drivers/staging/csr/csr_wifi_sme_serialize.c @@ -37,7 +37,7 @@ CsrSize CsrWifiSmeAdhocConfigSetReqSizeof(void *msg) } -CsrUint8* CsrWifiSmeAdhocConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeAdhocConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeAdhocConfigSetReq *primitive = (CsrWifiSmeAdhocConfigSetReq *)msg; *len = 0; @@ -50,7 +50,7 @@ CsrUint8* CsrWifiSmeAdhocConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeAdhocConfigSetReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeAdhocConfigSetReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeAdhocConfigSetReq *primitive = (CsrWifiSmeAdhocConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeAdhocConfigSetReq)); CsrSize offset; @@ -74,26 +74,26 @@ CsrSize CsrWifiSmeBlacklistReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ - bufferSize += 1; /* CsrUint8 primitive->setAddressCount */ + bufferSize += 1; /* u8 primitive->setAddressCount */ { CsrUint16 i1; for (i1 = 0; i1 < primitive->setAddressCount; i1++) { - bufferSize += 6; /* CsrUint8 primitive->setAddresses[i1].a[6] */ + bufferSize += 6; /* u8 primitive->setAddresses[i1].a[6] */ } } return bufferSize; } -CsrUint8* CsrWifiSmeBlacklistReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeBlacklistReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeBlacklistReq *primitive = (CsrWifiSmeBlacklistReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->action); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->setAddressCount); + CsrUint8Ser(ptr, len, (u8) primitive->action); + CsrUint8Ser(ptr, len, (u8) primitive->setAddressCount); { CsrUint16 i1; for (i1 = 0; i1 < primitive->setAddressCount; i1++) @@ -105,7 +105,7 @@ CsrUint8* CsrWifiSmeBlacklistReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeBlacklistReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeBlacklistReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeBlacklistReq *primitive = (CsrWifiSmeBlacklistReq *) CsrPmemAlloc(sizeof(CsrWifiSmeBlacklistReq)); CsrSize offset; @@ -113,8 +113,8 @@ void* CsrWifiSmeBlacklistReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->action, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->setAddressCount, buffer, &offset); + CsrUint8Des((u8 *) &primitive->action, buffer, &offset); + CsrUint8Des((u8 *) &primitive->setAddressCount, buffer, &offset); primitive->setAddresses = NULL; if (primitive->setAddressCount) { @@ -147,12 +147,12 @@ CsrSize CsrWifiSmeCalibrationDataSetReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */ bufferSize += 2; /* CsrUint16 primitive->calibrationDataLength */ - bufferSize += primitive->calibrationDataLength; /* CsrUint8 primitive->calibrationData */ + bufferSize += primitive->calibrationDataLength; /* u8 primitive->calibrationData */ return bufferSize; } -CsrUint8* CsrWifiSmeCalibrationDataSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeCalibrationDataSetReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeCalibrationDataSetReq *primitive = (CsrWifiSmeCalibrationDataSetReq *)msg; *len = 0; @@ -166,7 +166,7 @@ CsrUint8* CsrWifiSmeCalibrationDataSetReqSer(CsrUint8 *ptr, CsrSize *len, void * } -void* CsrWifiSmeCalibrationDataSetReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeCalibrationDataSetReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeCalibrationDataSetReq *primitive = (CsrWifiSmeCalibrationDataSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCalibrationDataSetReq)); CsrSize offset; @@ -176,7 +176,7 @@ void* CsrWifiSmeCalibrationDataSetReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->calibrationDataLength, buffer, &offset); if (primitive->calibrationDataLength) { - primitive->calibrationData = (CsrUint8 *)CsrPmemAlloc(primitive->calibrationDataLength); + primitive->calibrationData = (u8 *)CsrPmemAlloc(primitive->calibrationDataLength); CsrMemCpyDes(primitive->calibrationData, buffer, &offset, ((CsrUint16) (primitive->calibrationDataLength))); } else @@ -202,29 +202,29 @@ CsrSize CsrWifiSmeCcxConfigSetReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ - bufferSize += 1; /* CsrUint8 primitive->ccxConfig.keepAliveTimeMs */ + bufferSize += 1; /* u8 primitive->ccxConfig.keepAliveTimeMs */ bufferSize += 1; /* CsrBool primitive->ccxConfig.apRoamingEnabled */ - bufferSize += 1; /* CsrUint8 primitive->ccxConfig.measurementsMask */ + bufferSize += 1; /* u8 primitive->ccxConfig.measurementsMask */ bufferSize += 1; /* CsrBool primitive->ccxConfig.ccxRadioMgtEnabled */ return bufferSize; } -CsrUint8* CsrWifiSmeCcxConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeCcxConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeCcxConfigSetReq *primitive = (CsrWifiSmeCcxConfigSetReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->ccxConfig.keepAliveTimeMs); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->ccxConfig.apRoamingEnabled); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->ccxConfig.measurementsMask); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->ccxConfig.ccxRadioMgtEnabled); + CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.keepAliveTimeMs); + CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.apRoamingEnabled); + CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.measurementsMask); + CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.ccxRadioMgtEnabled); return(ptr); } -void* CsrWifiSmeCcxConfigSetReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeCcxConfigSetReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeCcxConfigSetReq *primitive = (CsrWifiSmeCcxConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCcxConfigSetReq)); CsrSize offset; @@ -232,10 +232,10 @@ void* CsrWifiSmeCcxConfigSetReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->ccxConfig.keepAliveTimeMs, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->ccxConfig.apRoamingEnabled, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->ccxConfig.measurementsMask, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->ccxConfig.ccxRadioMgtEnabled, buffer, &offset); + CsrUint8Des((u8 *) &primitive->ccxConfig.keepAliveTimeMs, buffer, &offset); + CsrUint8Des((u8 *) &primitive->ccxConfig.apRoamingEnabled, buffer, &offset); + CsrUint8Des((u8 *) &primitive->ccxConfig.measurementsMask, buffer, &offset); + CsrUint8Des((u8 *) &primitive->ccxConfig.ccxRadioMgtEnabled, buffer, &offset); return primitive; } @@ -264,13 +264,13 @@ CsrSize CsrWifiSmeCoexConfigSetReqSizeof(void *msg) } -CsrUint8* CsrWifiSmeCoexConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeCoexConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeCoexConfigSetReq *primitive = (CsrWifiSmeCoexConfigSetReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->coexConfig.coexEnableSchemeManagement); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->coexConfig.coexPeriodicWakeHost); + CsrUint8Ser(ptr, len, (u8) primitive->coexConfig.coexEnableSchemeManagement); + CsrUint8Ser(ptr, len, (u8) primitive->coexConfig.coexPeriodicWakeHost); CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexTrafficBurstyLatencyMs); CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexTrafficContinuousLatencyMs); CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexObexBlackoutDurationMs); @@ -287,15 +287,15 @@ CsrUint8* CsrWifiSmeCoexConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeCoexConfigSetReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeCoexConfigSetReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeCoexConfigSetReq *primitive = (CsrWifiSmeCoexConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexConfigSetReq)); CsrSize offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->coexConfig.coexEnableSchemeManagement, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->coexConfig.coexPeriodicWakeHost, buffer, &offset); + CsrUint8Des((u8 *) &primitive->coexConfig.coexEnableSchemeManagement, buffer, &offset); + CsrUint8Des((u8 *) &primitive->coexConfig.coexPeriodicWakeHost, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexTrafficBurstyLatencyMs, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexTrafficContinuousLatencyMs, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexObexBlackoutDurationMs, buffer, &offset); @@ -320,35 +320,35 @@ CsrSize CsrWifiSmeConnectReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 57) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ - bufferSize += 32; /* CsrUint8 primitive->connectionConfig.ssid.ssid[32] */ - bufferSize += 1; /* CsrUint8 primitive->connectionConfig.ssid.length */ - bufferSize += 6; /* CsrUint8 primitive->connectionConfig.bssid.a[6] */ + bufferSize += 32; /* u8 primitive->connectionConfig.ssid.ssid[32] */ + bufferSize += 1; /* u8 primitive->connectionConfig.ssid.length */ + bufferSize += 6; /* u8 primitive->connectionConfig.bssid.a[6] */ bufferSize += 1; /* CsrWifiSmeBssType primitive->connectionConfig.bssType */ bufferSize += 1; /* CsrWifiSmeRadioIF primitive->connectionConfig.ifIndex */ bufferSize += 1; /* CsrWifiSme80211PrivacyMode primitive->connectionConfig.privacyMode */ bufferSize += 2; /* CsrWifiSmeAuthModeMask primitive->connectionConfig.authModeMask */ bufferSize += 2; /* CsrWifiSmeEncryptionMask primitive->connectionConfig.encryptionModeMask */ bufferSize += 2; /* CsrUint16 primitive->connectionConfig.mlmeAssociateReqInformationElementsLength */ - bufferSize += primitive->connectionConfig.mlmeAssociateReqInformationElementsLength; /* CsrUint8 primitive->connectionConfig.mlmeAssociateReqInformationElements */ + bufferSize += primitive->connectionConfig.mlmeAssociateReqInformationElementsLength; /* u8 primitive->connectionConfig.mlmeAssociateReqInformationElements */ bufferSize += 1; /* CsrWifiSmeWmmQosInfoMask primitive->connectionConfig.wmmQosInfo */ bufferSize += 1; /* CsrBool primitive->connectionConfig.adhocJoinOnly */ - bufferSize += 1; /* CsrUint8 primitive->connectionConfig.adhocChannel */ + bufferSize += 1; /* u8 primitive->connectionConfig.adhocChannel */ return bufferSize; } -CsrUint8* CsrWifiSmeConnectReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeConnectReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeConnectReq *primitive = (CsrWifiSmeConnectReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.ssid.ssid, ((CsrUint16) (32))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.ssid.length); + CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.ssid.length); CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.bssid.a, ((CsrUint16) (6))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.bssType); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.ifIndex); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.privacyMode); + CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.bssType); + CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.ifIndex); + CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.privacyMode); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionConfig.authModeMask); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionConfig.encryptionModeMask); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionConfig.mlmeAssociateReqInformationElementsLength); @@ -356,14 +356,14 @@ CsrUint8* CsrWifiSmeConnectReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) { CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.mlmeAssociateReqInformationElements, ((CsrUint16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength))); } - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.wmmQosInfo); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.adhocJoinOnly); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.adhocChannel); + CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.wmmQosInfo); + CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.adhocJoinOnly); + CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.adhocChannel); return(ptr); } -void* CsrWifiSmeConnectReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeConnectReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeConnectReq *primitive = (CsrWifiSmeConnectReq *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectReq)); CsrSize offset; @@ -372,26 +372,26 @@ void* CsrWifiSmeConnectReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrMemCpyDes(primitive->connectionConfig.ssid.ssid, buffer, &offset, ((CsrUint16) (32))); - CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.ssid.length, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionConfig.ssid.length, buffer, &offset); CsrMemCpyDes(primitive->connectionConfig.bssid.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.bssType, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.ifIndex, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.privacyMode, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionConfig.bssType, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionConfig.ifIndex, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionConfig.privacyMode, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionConfig.authModeMask, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionConfig.encryptionModeMask, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionConfig.mlmeAssociateReqInformationElementsLength, buffer, &offset); if (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength) { - primitive->connectionConfig.mlmeAssociateReqInformationElements = (CsrUint8 *)CsrPmemAlloc(primitive->connectionConfig.mlmeAssociateReqInformationElementsLength); + primitive->connectionConfig.mlmeAssociateReqInformationElements = (u8 *)CsrPmemAlloc(primitive->connectionConfig.mlmeAssociateReqInformationElementsLength); CsrMemCpyDes(primitive->connectionConfig.mlmeAssociateReqInformationElements, buffer, &offset, ((CsrUint16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength))); } else { primitive->connectionConfig.mlmeAssociateReqInformationElements = NULL; } - CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.wmmQosInfo, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.adhocJoinOnly, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.adhocChannel, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionConfig.wmmQosInfo, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionConfig.adhocJoinOnly, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionConfig.adhocChannel, buffer, &offset); return primitive; } @@ -417,19 +417,19 @@ CsrSize CsrWifiSmeHostConfigSetReqSizeof(void *msg) } -CsrUint8* CsrWifiSmeHostConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeHostConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeHostConfigSetReq *primitive = (CsrWifiSmeHostConfigSetReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->hostConfig.powerMode); + CsrUint8Ser(ptr, len, (u8) primitive->hostConfig.powerMode); CsrUint16Ser(ptr, len, (CsrUint16) primitive->hostConfig.applicationDataPeriodMs); return(ptr); } -void* CsrWifiSmeHostConfigSetReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeHostConfigSetReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeHostConfigSetReq *primitive = (CsrWifiSmeHostConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeHostConfigSetReq)); CsrSize offset; @@ -437,7 +437,7 @@ void* CsrWifiSmeHostConfigSetReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->hostConfig.powerMode, buffer, &offset); + CsrUint8Des((u8 *) &primitive->hostConfig.powerMode, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->hostConfig.applicationDataPeriodMs, buffer, &offset); return primitive; @@ -452,7 +452,7 @@ CsrSize CsrWifiSmeKeyReqSizeof(void *msg) bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ bufferSize += 1; /* CsrWifiSmeKeyType primitive->key.keyType */ - bufferSize += 1; /* CsrUint8 primitive->key.keyIndex */ + bufferSize += 1; /* u8 primitive->key.keyIndex */ bufferSize += 1; /* CsrBool primitive->key.wepTxKey */ { CsrUint16 i2; @@ -462,23 +462,23 @@ CsrSize CsrWifiSmeKeyReqSizeof(void *msg) } } bufferSize += 1; /* CsrBool primitive->key.authenticator */ - bufferSize += 6; /* CsrUint8 primitive->key.address.a[6] */ - bufferSize += 1; /* CsrUint8 primitive->key.keyLength */ - bufferSize += 32; /* CsrUint8 primitive->key.key[32] */ + bufferSize += 6; /* u8 primitive->key.address.a[6] */ + bufferSize += 1; /* u8 primitive->key.keyLength */ + bufferSize += 32; /* u8 primitive->key.key[32] */ return bufferSize; } -CsrUint8* CsrWifiSmeKeyReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeKeyReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeKeyReq *primitive = (CsrWifiSmeKeyReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->action); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->key.keyType); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->key.keyIndex); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->key.wepTxKey); + CsrUint8Ser(ptr, len, (u8) primitive->action); + CsrUint8Ser(ptr, len, (u8) primitive->key.keyType); + CsrUint8Ser(ptr, len, (u8) primitive->key.keyIndex); + CsrUint8Ser(ptr, len, (u8) primitive->key.wepTxKey); { CsrUint16 i2; for (i2 = 0; i2 < 8; i2++) @@ -486,15 +486,15 @@ CsrUint8* CsrWifiSmeKeyReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) CsrUint16Ser(ptr, len, (CsrUint16) primitive->key.keyRsc[i2]); } } - CsrUint8Ser(ptr, len, (CsrUint8) primitive->key.authenticator); + CsrUint8Ser(ptr, len, (u8) primitive->key.authenticator); CsrMemCpySer(ptr, len, (const void *) primitive->key.address.a, ((CsrUint16) (6))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->key.keyLength); + CsrUint8Ser(ptr, len, (u8) primitive->key.keyLength); CsrMemCpySer(ptr, len, (const void *) primitive->key.key, ((CsrUint16) (32))); return(ptr); } -void* CsrWifiSmeKeyReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeKeyReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeKeyReq *primitive = (CsrWifiSmeKeyReq *) CsrPmemAlloc(sizeof(CsrWifiSmeKeyReq)); CsrSize offset; @@ -502,10 +502,10 @@ void* CsrWifiSmeKeyReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->action, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->key.keyType, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->key.keyIndex, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->key.wepTxKey, buffer, &offset); + CsrUint8Des((u8 *) &primitive->action, buffer, &offset); + CsrUint8Des((u8 *) &primitive->key.keyType, buffer, &offset); + CsrUint8Des((u8 *) &primitive->key.keyIndex, buffer, &offset); + CsrUint8Des((u8 *) &primitive->key.wepTxKey, buffer, &offset); { CsrUint16 i2; for (i2 = 0; i2 < 8; i2++) @@ -513,9 +513,9 @@ void* CsrWifiSmeKeyReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->key.keyRsc[i2], buffer, &offset); } } - CsrUint8Des((CsrUint8 *) &primitive->key.authenticator, buffer, &offset); + CsrUint8Des((u8 *) &primitive->key.authenticator, buffer, &offset); CsrMemCpyDes(primitive->key.address.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint8Des((CsrUint8 *) &primitive->key.keyLength, buffer, &offset); + CsrUint8Des((u8 *) &primitive->key.keyLength, buffer, &offset); CsrMemCpyDes(primitive->key.key, buffer, &offset, ((CsrUint16) (32))); return primitive; @@ -528,7 +528,7 @@ CsrSize CsrWifiSmeMibConfigSetReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ bufferSize += 1; /* CsrBool primitive->mibConfig.unifiFixMaxTxDataRate */ - bufferSize += 1; /* CsrUint8 primitive->mibConfig.unifiFixTxDataRate */ + bufferSize += 1; /* u8 primitive->mibConfig.unifiFixTxDataRate */ bufferSize += 2; /* CsrUint16 primitive->mibConfig.dot11RtsThreshold */ bufferSize += 2; /* CsrUint16 primitive->mibConfig.dot11FragmentationThreshold */ bufferSize += 2; /* CsrUint16 primitive->mibConfig.dot11CurrentTxPowerLevel */ @@ -536,13 +536,13 @@ CsrSize CsrWifiSmeMibConfigSetReqSizeof(void *msg) } -CsrUint8* CsrWifiSmeMibConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeMibConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeMibConfigSetReq *primitive = (CsrWifiSmeMibConfigSetReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->mibConfig.unifiFixMaxTxDataRate); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->mibConfig.unifiFixTxDataRate); + CsrUint8Ser(ptr, len, (u8) primitive->mibConfig.unifiFixMaxTxDataRate); + CsrUint8Ser(ptr, len, (u8) primitive->mibConfig.unifiFixTxDataRate); CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibConfig.dot11RtsThreshold); CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibConfig.dot11FragmentationThreshold); CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibConfig.dot11CurrentTxPowerLevel); @@ -550,15 +550,15 @@ CsrUint8* CsrWifiSmeMibConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeMibConfigSetReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeMibConfigSetReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeMibConfigSetReq *primitive = (CsrWifiSmeMibConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibConfigSetReq)); CsrSize offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->mibConfig.unifiFixMaxTxDataRate, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->mibConfig.unifiFixTxDataRate, buffer, &offset); + CsrUint8Des((u8 *) &primitive->mibConfig.unifiFixMaxTxDataRate, buffer, &offset); + CsrUint8Des((u8 *) &primitive->mibConfig.unifiFixTxDataRate, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->mibConfig.dot11RtsThreshold, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->mibConfig.dot11FragmentationThreshold, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->mibConfig.dot11CurrentTxPowerLevel, buffer, &offset); @@ -574,12 +574,12 @@ CsrSize CsrWifiSmeMibGetNextReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */ bufferSize += 2; /* CsrUint16 primitive->mibAttributeLength */ - bufferSize += primitive->mibAttributeLength; /* CsrUint8 primitive->mibAttribute */ + bufferSize += primitive->mibAttributeLength; /* u8 primitive->mibAttribute */ return bufferSize; } -CsrUint8* CsrWifiSmeMibGetNextReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeMibGetNextReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeMibGetNextReq *primitive = (CsrWifiSmeMibGetNextReq *)msg; *len = 0; @@ -593,7 +593,7 @@ CsrUint8* CsrWifiSmeMibGetNextReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeMibGetNextReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeMibGetNextReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeMibGetNextReq *primitive = (CsrWifiSmeMibGetNextReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetNextReq)); CsrSize offset; @@ -603,7 +603,7 @@ void* CsrWifiSmeMibGetNextReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->mibAttributeLength, buffer, &offset); if (primitive->mibAttributeLength) { - primitive->mibAttribute = (CsrUint8 *)CsrPmemAlloc(primitive->mibAttributeLength); + primitive->mibAttribute = (u8 *)CsrPmemAlloc(primitive->mibAttributeLength); CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((CsrUint16) (primitive->mibAttributeLength))); } else @@ -630,12 +630,12 @@ CsrSize CsrWifiSmeMibGetReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */ bufferSize += 2; /* CsrUint16 primitive->mibAttributeLength */ - bufferSize += primitive->mibAttributeLength; /* CsrUint8 primitive->mibAttribute */ + bufferSize += primitive->mibAttributeLength; /* u8 primitive->mibAttribute */ return bufferSize; } -CsrUint8* CsrWifiSmeMibGetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeMibGetReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeMibGetReq *primitive = (CsrWifiSmeMibGetReq *)msg; *len = 0; @@ -649,7 +649,7 @@ CsrUint8* CsrWifiSmeMibGetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeMibGetReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeMibGetReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeMibGetReq *primitive = (CsrWifiSmeMibGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetReq)); CsrSize offset; @@ -659,7 +659,7 @@ void* CsrWifiSmeMibGetReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->mibAttributeLength, buffer, &offset); if (primitive->mibAttributeLength) { - primitive->mibAttribute = (CsrUint8 *)CsrPmemAlloc(primitive->mibAttributeLength); + primitive->mibAttribute = (u8 *)CsrPmemAlloc(primitive->mibAttributeLength); CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((CsrUint16) (primitive->mibAttributeLength))); } else @@ -686,12 +686,12 @@ CsrSize CsrWifiSmeMibSetReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */ bufferSize += 2; /* CsrUint16 primitive->mibAttributeLength */ - bufferSize += primitive->mibAttributeLength; /* CsrUint8 primitive->mibAttribute */ + bufferSize += primitive->mibAttributeLength; /* u8 primitive->mibAttribute */ return bufferSize; } -CsrUint8* CsrWifiSmeMibSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeMibSetReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeMibSetReq *primitive = (CsrWifiSmeMibSetReq *)msg; *len = 0; @@ -705,7 +705,7 @@ CsrUint8* CsrWifiSmeMibSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeMibSetReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeMibSetReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeMibSetReq *primitive = (CsrWifiSmeMibSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibSetReq)); CsrSize offset; @@ -715,7 +715,7 @@ void* CsrWifiSmeMibSetReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->mibAttributeLength, buffer, &offset); if (primitive->mibAttributeLength) { - primitive->mibAttribute = (CsrUint8 *)CsrPmemAlloc(primitive->mibAttributeLength); + primitive->mibAttribute = (u8 *)CsrPmemAlloc(primitive->mibAttributeLength); CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((CsrUint16) (primitive->mibAttributeLength))); } else @@ -743,26 +743,26 @@ CsrSize CsrWifiSmeMulticastAddressReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ - bufferSize += 1; /* CsrUint8 primitive->setAddressesCount */ + bufferSize += 1; /* u8 primitive->setAddressesCount */ { CsrUint16 i1; for (i1 = 0; i1 < primitive->setAddressesCount; i1++) { - bufferSize += 6; /* CsrUint8 primitive->setAddresses[i1].a[6] */ + bufferSize += 6; /* u8 primitive->setAddresses[i1].a[6] */ } } return bufferSize; } -CsrUint8* CsrWifiSmeMulticastAddressReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeMulticastAddressReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeMulticastAddressReq *primitive = (CsrWifiSmeMulticastAddressReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->action); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->setAddressesCount); + CsrUint8Ser(ptr, len, (u8) primitive->action); + CsrUint8Ser(ptr, len, (u8) primitive->setAddressesCount); { CsrUint16 i1; for (i1 = 0; i1 < primitive->setAddressesCount; i1++) @@ -774,7 +774,7 @@ CsrUint8* CsrWifiSmeMulticastAddressReqSer(CsrUint8 *ptr, CsrSize *len, void *ms } -void* CsrWifiSmeMulticastAddressReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeMulticastAddressReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeMulticastAddressReq *primitive = (CsrWifiSmeMulticastAddressReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMulticastAddressReq)); CsrSize offset; @@ -782,8 +782,8 @@ void* CsrWifiSmeMulticastAddressReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->action, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->setAddressesCount, buffer, &offset); + CsrUint8Des((u8 *) &primitive->action, buffer, &offset); + CsrUint8Des((u8 *) &primitive->setAddressesCount, buffer, &offset); primitive->setAddresses = NULL; if (primitive->setAddressesCount) { @@ -817,14 +817,14 @@ CsrSize CsrWifiSmePacketFilterSetReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrUint16 primitive->filterLength */ - bufferSize += primitive->filterLength; /* CsrUint8 primitive->filter */ + bufferSize += primitive->filterLength; /* u8 primitive->filter */ bufferSize += 1; /* CsrWifiSmePacketFilterMode primitive->mode */ - bufferSize += 4; /* CsrUint8 primitive->arpFilterAddress.a[4] */ + bufferSize += 4; /* u8 primitive->arpFilterAddress.a[4] */ return bufferSize; } -CsrUint8* CsrWifiSmePacketFilterSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmePacketFilterSetReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmePacketFilterSetReq *primitive = (CsrWifiSmePacketFilterSetReq *)msg; *len = 0; @@ -835,13 +835,13 @@ CsrUint8* CsrWifiSmePacketFilterSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg { CsrMemCpySer(ptr, len, (const void *) primitive->filter, ((CsrUint16) (primitive->filterLength))); } - CsrUint8Ser(ptr, len, (CsrUint8) primitive->mode); + CsrUint8Ser(ptr, len, (u8) primitive->mode); CsrMemCpySer(ptr, len, (const void *) primitive->arpFilterAddress.a, ((CsrUint16) (4))); return(ptr); } -void* CsrWifiSmePacketFilterSetReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmePacketFilterSetReqDes(u8 *buffer, CsrSize length) { CsrWifiSmePacketFilterSetReq *primitive = (CsrWifiSmePacketFilterSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmePacketFilterSetReq)); CsrSize offset; @@ -852,14 +852,14 @@ void* CsrWifiSmePacketFilterSetReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->filterLength, buffer, &offset); if (primitive->filterLength) { - primitive->filter = (CsrUint8 *)CsrPmemAlloc(primitive->filterLength); + primitive->filter = (u8 *)CsrPmemAlloc(primitive->filterLength); CsrMemCpyDes(primitive->filter, buffer, &offset, ((CsrUint16) (primitive->filterLength))); } else { primitive->filter = NULL; } - CsrUint8Des((CsrUint8 *) &primitive->mode, buffer, &offset); + CsrUint8Des((u8 *) &primitive->mode, buffer, &offset); CsrMemCpyDes(primitive->arpFilterAddress.a, buffer, &offset, ((CsrUint16) (4))); return primitive; @@ -882,27 +882,27 @@ CsrSize CsrWifiSmePmkidReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 29) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ - bufferSize += 1; /* CsrUint8 primitive->setPmkidsCount */ + bufferSize += 1; /* u8 primitive->setPmkidsCount */ { CsrUint16 i1; for (i1 = 0; i1 < primitive->setPmkidsCount; i1++) { - bufferSize += 6; /* CsrUint8 primitive->setPmkids[i1].bssid.a[6] */ - bufferSize += 16; /* CsrUint8 primitive->setPmkids[i1].pmkid[16] */ + bufferSize += 6; /* u8 primitive->setPmkids[i1].bssid.a[6] */ + bufferSize += 16; /* u8 primitive->setPmkids[i1].pmkid[16] */ } } return bufferSize; } -CsrUint8* CsrWifiSmePmkidReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmePmkidReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmePmkidReq *primitive = (CsrWifiSmePmkidReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->action); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->setPmkidsCount); + CsrUint8Ser(ptr, len, (u8) primitive->action); + CsrUint8Ser(ptr, len, (u8) primitive->setPmkidsCount); { CsrUint16 i1; for (i1 = 0; i1 < primitive->setPmkidsCount; i1++) @@ -915,7 +915,7 @@ CsrUint8* CsrWifiSmePmkidReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmePmkidReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmePmkidReqDes(u8 *buffer, CsrSize length) { CsrWifiSmePmkidReq *primitive = (CsrWifiSmePmkidReq *) CsrPmemAlloc(sizeof(CsrWifiSmePmkidReq)); CsrSize offset; @@ -923,8 +923,8 @@ void* CsrWifiSmePmkidReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->action, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->setPmkidsCount, buffer, &offset); + CsrUint8Des((u8 *) &primitive->action, buffer, &offset); + CsrUint8Des((u8 *) &primitive->setPmkidsCount, buffer, &offset); primitive->setPmkids = NULL; if (primitive->setPmkidsCount) { @@ -960,43 +960,43 @@ CsrSize CsrWifiSmePowerConfigSetReqSizeof(void *msg) bufferSize += 2; /* CsrUint16 primitive->powerConfig.listenIntervalTu */ bufferSize += 1; /* CsrBool primitive->powerConfig.rxDtims */ bufferSize += 1; /* CsrWifiSmeD3AutoScanMode primitive->powerConfig.d3AutoScanMode */ - bufferSize += 1; /* CsrUint8 primitive->powerConfig.clientTrafficWindow */ + bufferSize += 1; /* u8 primitive->powerConfig.clientTrafficWindow */ bufferSize += 1; /* CsrBool primitive->powerConfig.opportunisticPowerSave */ bufferSize += 1; /* CsrBool primitive->powerConfig.noticeOfAbsence */ return bufferSize; } -CsrUint8* CsrWifiSmePowerConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmePowerConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmePowerConfigSetReq *primitive = (CsrWifiSmePowerConfigSetReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.powerSaveLevel); + CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.powerSaveLevel); CsrUint16Ser(ptr, len, (CsrUint16) primitive->powerConfig.listenIntervalTu); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.rxDtims); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.d3AutoScanMode); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.clientTrafficWindow); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.opportunisticPowerSave); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.noticeOfAbsence); + CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.rxDtims); + CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.d3AutoScanMode); + CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.clientTrafficWindow); + CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.opportunisticPowerSave); + CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.noticeOfAbsence); return(ptr); } -void* CsrWifiSmePowerConfigSetReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmePowerConfigSetReqDes(u8 *buffer, CsrSize length) { CsrWifiSmePowerConfigSetReq *primitive = (CsrWifiSmePowerConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmePowerConfigSetReq)); CsrSize offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->powerConfig.powerSaveLevel, buffer, &offset); + CsrUint8Des((u8 *) &primitive->powerConfig.powerSaveLevel, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->powerConfig.listenIntervalTu, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->powerConfig.rxDtims, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->powerConfig.d3AutoScanMode, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->powerConfig.clientTrafficWindow, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->powerConfig.opportunisticPowerSave, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->powerConfig.noticeOfAbsence, buffer, &offset); + CsrUint8Des((u8 *) &primitive->powerConfig.rxDtims, buffer, &offset); + CsrUint8Des((u8 *) &primitive->powerConfig.d3AutoScanMode, buffer, &offset); + CsrUint8Des((u8 *) &primitive->powerConfig.clientTrafficWindow, buffer, &offset); + CsrUint8Des((u8 *) &primitive->powerConfig.opportunisticPowerSave, buffer, &offset); + CsrUint8Des((u8 *) &primitive->powerConfig.noticeOfAbsence, buffer, &offset); return primitive; } @@ -1020,7 +1020,7 @@ CsrSize CsrWifiSmeRoamingConfigSetReqSizeof(void *msg) } bufferSize += 1; /* CsrBool primitive->roamingConfig.disableSmoothRoaming */ bufferSize += 1; /* CsrBool primitive->roamingConfig.disableRoamScans */ - bufferSize += 1; /* CsrUint8 primitive->roamingConfig.reconnectLimit */ + bufferSize += 1; /* u8 primitive->roamingConfig.reconnectLimit */ bufferSize += 2; /* CsrUint16 primitive->roamingConfig.reconnectLimitIntervalMs */ { CsrUint16 i2; @@ -1038,7 +1038,7 @@ CsrSize CsrWifiSmeRoamingConfigSetReqSizeof(void *msg) } -CsrUint8* CsrWifiSmeRoamingConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeRoamingConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeRoamingConfigSetReq *primitive = (CsrWifiSmeRoamingConfigSetReq *)msg; *len = 0; @@ -1054,9 +1054,9 @@ CsrUint8* CsrWifiSmeRoamingConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *ms CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamingBands[i2].snrLowThreshold); } } - CsrUint8Ser(ptr, len, (CsrUint8) primitive->roamingConfig.disableSmoothRoaming); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->roamingConfig.disableRoamScans); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->roamingConfig.reconnectLimit); + CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.disableSmoothRoaming); + CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.disableRoamScans); + CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.reconnectLimit); CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.reconnectLimitIntervalMs); { CsrUint16 i2; @@ -1074,7 +1074,7 @@ CsrUint8* CsrWifiSmeRoamingConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *ms } -void* CsrWifiSmeRoamingConfigSetReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeRoamingConfigSetReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeRoamingConfigSetReq *primitive = (CsrWifiSmeRoamingConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamingConfigSetReq)); CsrSize offset; @@ -1092,9 +1092,9 @@ void* CsrWifiSmeRoamingConfigSetReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamingBands[i2].snrLowThreshold, buffer, &offset); } } - CsrUint8Des((CsrUint8 *) &primitive->roamingConfig.disableSmoothRoaming, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->roamingConfig.disableRoamScans, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->roamingConfig.reconnectLimit, buffer, &offset); + CsrUint8Des((u8 *) &primitive->roamingConfig.disableSmoothRoaming, buffer, &offset); + CsrUint8Des((u8 *) &primitive->roamingConfig.disableRoamScans, buffer, &offset); + CsrUint8Des((u8 *) &primitive->roamingConfig.reconnectLimit, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.reconnectLimitIntervalMs, buffer, &offset); { CsrUint16 i2; @@ -1140,12 +1140,12 @@ CsrSize CsrWifiSmeScanConfigSetReqSizeof(void *msg) bufferSize += 1; /* CsrInt8 primitive->scanConfig.lowSnrThreshold */ bufferSize += 1; /* CsrInt8 primitive->scanConfig.deltaSnrThreshold */ bufferSize += 2; /* CsrUint16 primitive->scanConfig.passiveChannelListCount */ - bufferSize += primitive->scanConfig.passiveChannelListCount; /* CsrUint8 primitive->scanConfig.passiveChannelList */ + bufferSize += primitive->scanConfig.passiveChannelListCount; /* u8 primitive->scanConfig.passiveChannelList */ return bufferSize; } -CsrUint8* CsrWifiSmeScanConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeScanConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeScanConfigSetReq *primitive = (CsrWifiSmeScanConfigSetReq *)msg; *len = 0; @@ -1162,14 +1162,14 @@ CsrUint8* CsrWifiSmeScanConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu); } } - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.disableAutonomousScans); + CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.disableAutonomousScans); CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.maxResults); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.highRssiThreshold); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.lowRssiThreshold); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.deltaRssiThreshold); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.highSnrThreshold); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.lowSnrThreshold); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.deltaSnrThreshold); + CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.highRssiThreshold); + CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.lowRssiThreshold); + CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.deltaRssiThreshold); + CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.highSnrThreshold); + CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.lowSnrThreshold); + CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.deltaSnrThreshold); CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.passiveChannelListCount); if (primitive->scanConfig.passiveChannelListCount) { @@ -1179,7 +1179,7 @@ CsrUint8* CsrWifiSmeScanConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeScanConfigSetReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeScanConfigSetReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeScanConfigSetReq *primitive = (CsrWifiSmeScanConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeScanConfigSetReq)); CsrSize offset; @@ -1198,18 +1198,18 @@ void* CsrWifiSmeScanConfigSetReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu, buffer, &offset); } } - CsrUint8Des((CsrUint8 *) &primitive->scanConfig.disableAutonomousScans, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanConfig.disableAutonomousScans, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->scanConfig.maxResults, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->scanConfig.highRssiThreshold, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->scanConfig.lowRssiThreshold, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->scanConfig.deltaRssiThreshold, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->scanConfig.highSnrThreshold, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->scanConfig.lowSnrThreshold, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->scanConfig.deltaSnrThreshold, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanConfig.highRssiThreshold, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanConfig.lowRssiThreshold, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanConfig.deltaRssiThreshold, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanConfig.highSnrThreshold, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanConfig.lowSnrThreshold, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanConfig.deltaSnrThreshold, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->scanConfig.passiveChannelListCount, buffer, &offset); if (primitive->scanConfig.passiveChannelListCount) { - primitive->scanConfig.passiveChannelList = (CsrUint8 *)CsrPmemAlloc(primitive->scanConfig.passiveChannelListCount); + primitive->scanConfig.passiveChannelList = (u8 *)CsrPmemAlloc(primitive->scanConfig.passiveChannelListCount); CsrMemCpyDes(primitive->scanConfig.passiveChannelList, buffer, &offset, ((CsrUint16) (primitive->scanConfig.passiveChannelListCount))); } else @@ -1235,45 +1235,45 @@ CsrSize CsrWifiSmeScanFullReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 52) */ - bufferSize += 1; /* CsrUint8 primitive->ssidCount */ + bufferSize += 1; /* u8 primitive->ssidCount */ { CsrUint16 i1; for (i1 = 0; i1 < primitive->ssidCount; i1++) { - bufferSize += 32; /* CsrUint8 primitive->ssid[i1].ssid[32] */ - bufferSize += 1; /* CsrUint8 primitive->ssid[i1].length */ + bufferSize += 32; /* u8 primitive->ssid[i1].ssid[32] */ + bufferSize += 1; /* u8 primitive->ssid[i1].length */ } } - bufferSize += 6; /* CsrUint8 primitive->bssid.a[6] */ + bufferSize += 6; /* u8 primitive->bssid.a[6] */ bufferSize += 1; /* CsrBool primitive->forceScan */ bufferSize += 1; /* CsrWifiSmeBssType primitive->bssType */ bufferSize += 1; /* CsrWifiSmeScanType primitive->scanType */ bufferSize += 2; /* CsrUint16 primitive->channelListCount */ - bufferSize += primitive->channelListCount; /* CsrUint8 primitive->channelList */ + bufferSize += primitive->channelListCount; /* u8 primitive->channelList */ bufferSize += 2; /* CsrUint16 primitive->probeIeLength */ - bufferSize += primitive->probeIeLength; /* CsrUint8 primitive->probeIe */ + bufferSize += primitive->probeIeLength; /* u8 primitive->probeIe */ return bufferSize; } -CsrUint8* CsrWifiSmeScanFullReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeScanFullReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeScanFullReq *primitive = (CsrWifiSmeScanFullReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->ssidCount); + CsrUint8Ser(ptr, len, (u8) primitive->ssidCount); { CsrUint16 i1; for (i1 = 0; i1 < primitive->ssidCount; i1++) { CsrMemCpySer(ptr, len, (const void *) primitive->ssid[i1].ssid, ((CsrUint16) (32))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->ssid[i1].length); + CsrUint8Ser(ptr, len, (u8) primitive->ssid[i1].length); } } CsrMemCpySer(ptr, len, (const void *) primitive->bssid.a, ((CsrUint16) (6))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->forceScan); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->bssType); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanType); + CsrUint8Ser(ptr, len, (u8) primitive->forceScan); + CsrUint8Ser(ptr, len, (u8) primitive->bssType); + CsrUint8Ser(ptr, len, (u8) primitive->scanType); CsrUint16Ser(ptr, len, (CsrUint16) primitive->channelListCount); if (primitive->channelListCount) { @@ -1288,14 +1288,14 @@ CsrUint8* CsrWifiSmeScanFullReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeScanFullReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeScanFullReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeScanFullReq *primitive = (CsrWifiSmeScanFullReq *) CsrPmemAlloc(sizeof(CsrWifiSmeScanFullReq)); CsrSize offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->ssidCount, buffer, &offset); + CsrUint8Des((u8 *) &primitive->ssidCount, buffer, &offset); primitive->ssid = NULL; if (primitive->ssidCount) { @@ -1306,17 +1306,17 @@ void* CsrWifiSmeScanFullReqDes(CsrUint8 *buffer, CsrSize length) for (i1 = 0; i1 < primitive->ssidCount; i1++) { CsrMemCpyDes(primitive->ssid[i1].ssid, buffer, &offset, ((CsrUint16) (32))); - CsrUint8Des((CsrUint8 *) &primitive->ssid[i1].length, buffer, &offset); + CsrUint8Des((u8 *) &primitive->ssid[i1].length, buffer, &offset); } } CsrMemCpyDes(primitive->bssid.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint8Des((CsrUint8 *) &primitive->forceScan, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->bssType, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->scanType, buffer, &offset); + CsrUint8Des((u8 *) &primitive->forceScan, buffer, &offset); + CsrUint8Des((u8 *) &primitive->bssType, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanType, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->channelListCount, buffer, &offset); if (primitive->channelListCount) { - primitive->channelList = (CsrUint8 *)CsrPmemAlloc(primitive->channelListCount); + primitive->channelList = (u8 *)CsrPmemAlloc(primitive->channelListCount); CsrMemCpyDes(primitive->channelList, buffer, &offset, ((CsrUint16) (primitive->channelListCount))); } else @@ -1326,7 +1326,7 @@ void* CsrWifiSmeScanFullReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->probeIeLength, buffer, &offset); if (primitive->probeIeLength) { - primitive->probeIe = (CsrUint8 *)CsrPmemAlloc(primitive->probeIeLength); + primitive->probeIe = (u8 *)CsrPmemAlloc(primitive->probeIeLength); CsrMemCpyDes(primitive->probeIe, buffer, &offset, ((CsrUint16) (primitive->probeIeLength))); } else @@ -1354,8 +1354,8 @@ CsrSize CsrWifiSmeSmeStaConfigSetReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ - bufferSize += 1; /* CsrUint8 primitive->smeConfig.connectionQualityRssiChangeTrigger */ - bufferSize += 1; /* CsrUint8 primitive->smeConfig.connectionQualitySnrChangeTrigger */ + bufferSize += 1; /* u8 primitive->smeConfig.connectionQualityRssiChangeTrigger */ + bufferSize += 1; /* u8 primitive->smeConfig.connectionQualitySnrChangeTrigger */ bufferSize += 1; /* CsrWifiSmeWmmModeMask primitive->smeConfig.wmmModeMask */ bufferSize += 1; /* CsrWifiSmeRadioIF primitive->smeConfig.ifIndex */ bufferSize += 1; /* CsrBool primitive->smeConfig.allowUnicastUseGroupCipher */ @@ -1364,23 +1364,23 @@ CsrSize CsrWifiSmeSmeStaConfigSetReqSizeof(void *msg) } -CsrUint8* CsrWifiSmeSmeStaConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeSmeStaConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeSmeStaConfigSetReq *primitive = (CsrWifiSmeSmeStaConfigSetReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.connectionQualityRssiChangeTrigger); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.connectionQualitySnrChangeTrigger); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.wmmModeMask); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.ifIndex); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.allowUnicastUseGroupCipher); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.enableOpportunisticKeyCaching); + CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.connectionQualityRssiChangeTrigger); + CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.connectionQualitySnrChangeTrigger); + CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.wmmModeMask); + CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.ifIndex); + CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.allowUnicastUseGroupCipher); + CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.enableOpportunisticKeyCaching); return(ptr); } -void* CsrWifiSmeSmeStaConfigSetReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeSmeStaConfigSetReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeSmeStaConfigSetReq *primitive = (CsrWifiSmeSmeStaConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeStaConfigSetReq)); CsrSize offset; @@ -1388,12 +1388,12 @@ void* CsrWifiSmeSmeStaConfigSetReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->smeConfig.connectionQualityRssiChangeTrigger, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->smeConfig.connectionQualitySnrChangeTrigger, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->smeConfig.wmmModeMask, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->smeConfig.ifIndex, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->smeConfig.allowUnicastUseGroupCipher, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->smeConfig.enableOpportunisticKeyCaching, buffer, &offset); + CsrUint8Des((u8 *) &primitive->smeConfig.connectionQualityRssiChangeTrigger, buffer, &offset); + CsrUint8Des((u8 *) &primitive->smeConfig.connectionQualitySnrChangeTrigger, buffer, &offset); + CsrUint8Des((u8 *) &primitive->smeConfig.wmmModeMask, buffer, &offset); + CsrUint8Des((u8 *) &primitive->smeConfig.ifIndex, buffer, &offset); + CsrUint8Des((u8 *) &primitive->smeConfig.allowUnicastUseGroupCipher, buffer, &offset); + CsrUint8Des((u8 *) &primitive->smeConfig.enableOpportunisticKeyCaching, buffer, &offset); return primitive; } @@ -1411,23 +1411,23 @@ CsrSize CsrWifiSmeTspecReqSizeof(void *msg) bufferSize += 1; /* CsrBool primitive->strict */ bufferSize += 1; /* CsrWifiSmeTspecCtrlMask primitive->ctrlMask */ bufferSize += 2; /* CsrUint16 primitive->tspecLength */ - bufferSize += primitive->tspecLength; /* CsrUint8 primitive->tspec */ + bufferSize += primitive->tspecLength; /* u8 primitive->tspec */ bufferSize += 2; /* CsrUint16 primitive->tclasLength */ - bufferSize += primitive->tclasLength; /* CsrUint8 primitive->tclas */ + bufferSize += primitive->tclasLength; /* u8 primitive->tclas */ return bufferSize; } -CsrUint8* CsrWifiSmeTspecReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeTspecReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeTspecReq *primitive = (CsrWifiSmeTspecReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->action); + CsrUint8Ser(ptr, len, (u8) primitive->action); CsrUint32Ser(ptr, len, (CsrUint32) primitive->transactionId); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->strict); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->ctrlMask); + CsrUint8Ser(ptr, len, (u8) primitive->strict); + CsrUint8Ser(ptr, len, (u8) primitive->ctrlMask); CsrUint16Ser(ptr, len, (CsrUint16) primitive->tspecLength); if (primitive->tspecLength) { @@ -1442,7 +1442,7 @@ CsrUint8* CsrWifiSmeTspecReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeTspecReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeTspecReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeTspecReq *primitive = (CsrWifiSmeTspecReq *) CsrPmemAlloc(sizeof(CsrWifiSmeTspecReq)); CsrSize offset; @@ -1450,14 +1450,14 @@ void* CsrWifiSmeTspecReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->action, buffer, &offset); + CsrUint8Des((u8 *) &primitive->action, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->transactionId, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->strict, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->ctrlMask, buffer, &offset); + CsrUint8Des((u8 *) &primitive->strict, buffer, &offset); + CsrUint8Des((u8 *) &primitive->ctrlMask, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->tspecLength, buffer, &offset); if (primitive->tspecLength) { - primitive->tspec = (CsrUint8 *)CsrPmemAlloc(primitive->tspecLength); + primitive->tspec = (u8 *)CsrPmemAlloc(primitive->tspecLength); CsrMemCpyDes(primitive->tspec, buffer, &offset, ((CsrUint16) (primitive->tspecLength))); } else @@ -1467,7 +1467,7 @@ void* CsrWifiSmeTspecReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->tclasLength, buffer, &offset); if (primitive->tclasLength) { - primitive->tclas = (CsrUint8 *)CsrPmemAlloc(primitive->tclasLength); + primitive->tclas = (u8 *)CsrPmemAlloc(primitive->tclasLength); CsrMemCpyDes(primitive->tclas, buffer, &offset, ((CsrUint16) (primitive->tclasLength))); } else @@ -1494,21 +1494,21 @@ CsrSize CsrWifiSmeWifiFlightmodeReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */ - bufferSize += 6; /* CsrUint8 primitive->address.a[6] */ + bufferSize += 6; /* u8 primitive->address.a[6] */ bufferSize += 2; /* CsrUint16 primitive->mibFilesCount */ { CsrUint16 i1; for (i1 = 0; i1 < primitive->mibFilesCount; i1++) { bufferSize += 2; /* CsrUint16 primitive->mibFiles[i1].length */ - bufferSize += primitive->mibFiles[i1].length; /* CsrUint8 primitive->mibFiles[i1].data */ + bufferSize += primitive->mibFiles[i1].length; /* u8 primitive->mibFiles[i1].data */ } } return bufferSize; } -CsrUint8* CsrWifiSmeWifiFlightmodeReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeWifiFlightmodeReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeWifiFlightmodeReq *primitive = (CsrWifiSmeWifiFlightmodeReq *)msg; *len = 0; @@ -1530,7 +1530,7 @@ CsrUint8* CsrWifiSmeWifiFlightmodeReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeWifiFlightmodeReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeWifiFlightmodeReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeWifiFlightmodeReq *primitive = (CsrWifiSmeWifiFlightmodeReq *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiFlightmodeReq)); CsrSize offset; @@ -1551,7 +1551,7 @@ void* CsrWifiSmeWifiFlightmodeReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->mibFiles[i1].length, buffer, &offset); if (primitive->mibFiles[i1].length) { - primitive->mibFiles[i1].data = (CsrUint8 *)CsrPmemAlloc(primitive->mibFiles[i1].length); + primitive->mibFiles[i1].data = (u8 *)CsrPmemAlloc(primitive->mibFiles[i1].length); CsrMemCpyDes(primitive->mibFiles[i1].data, buffer, &offset, ((CsrUint16) (primitive->mibFiles[i1].length))); } else @@ -1586,21 +1586,21 @@ CsrSize CsrWifiSmeWifiOnReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */ - bufferSize += 6; /* CsrUint8 primitive->address.a[6] */ + bufferSize += 6; /* u8 primitive->address.a[6] */ bufferSize += 2; /* CsrUint16 primitive->mibFilesCount */ { CsrUint16 i1; for (i1 = 0; i1 < primitive->mibFilesCount; i1++) { bufferSize += 2; /* CsrUint16 primitive->mibFiles[i1].length */ - bufferSize += primitive->mibFiles[i1].length; /* CsrUint8 primitive->mibFiles[i1].data */ + bufferSize += primitive->mibFiles[i1].length; /* u8 primitive->mibFiles[i1].data */ } } return bufferSize; } -CsrUint8* CsrWifiSmeWifiOnReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeWifiOnReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeWifiOnReq *primitive = (CsrWifiSmeWifiOnReq *)msg; *len = 0; @@ -1622,7 +1622,7 @@ CsrUint8* CsrWifiSmeWifiOnReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeWifiOnReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeWifiOnReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeWifiOnReq *primitive = (CsrWifiSmeWifiOnReq *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiOnReq)); CsrSize offset; @@ -1643,7 +1643,7 @@ void* CsrWifiSmeWifiOnReqDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->mibFiles[i1].length, buffer, &offset); if (primitive->mibFiles[i1].length) { - primitive->mibFiles[i1].data = (CsrUint8 *)CsrPmemAlloc(primitive->mibFiles[i1].length); + primitive->mibFiles[i1].data = (u8 *)CsrPmemAlloc(primitive->mibFiles[i1].length); CsrMemCpyDes(primitive->mibFiles[i1].data, buffer, &offset, ((CsrUint16) (primitive->mibFiles[i1].length))); } else @@ -1678,45 +1678,45 @@ CsrSize CsrWifiSmeCloakedSsidsSetReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 37) */ - bufferSize += 1; /* CsrUint8 primitive->cloakedSsids.cloakedSsidsCount */ + bufferSize += 1; /* u8 primitive->cloakedSsids.cloakedSsidsCount */ { CsrUint16 i2; for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) { - bufferSize += 32; /* CsrUint8 primitive->cloakedSsids.cloakedSsids[i2].ssid[32] */ - bufferSize += 1; /* CsrUint8 primitive->cloakedSsids.cloakedSsids[i2].length */ + bufferSize += 32; /* u8 primitive->cloakedSsids.cloakedSsids[i2].ssid[32] */ + bufferSize += 1; /* u8 primitive->cloakedSsids.cloakedSsids[i2].length */ } } return bufferSize; } -CsrUint8* CsrWifiSmeCloakedSsidsSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeCloakedSsidsSetReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeCloakedSsidsSetReq *primitive = (CsrWifiSmeCloakedSsidsSetReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->cloakedSsids.cloakedSsidsCount); + CsrUint8Ser(ptr, len, (u8) primitive->cloakedSsids.cloakedSsidsCount); { CsrUint16 i2; for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) { CsrMemCpySer(ptr, len, (const void *) primitive->cloakedSsids.cloakedSsids[i2].ssid, ((CsrUint16) (32))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->cloakedSsids.cloakedSsids[i2].length); + CsrUint8Ser(ptr, len, (u8) primitive->cloakedSsids.cloakedSsids[i2].length); } } return(ptr); } -void* CsrWifiSmeCloakedSsidsSetReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeCloakedSsidsSetReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeCloakedSsidsSetReq *primitive = (CsrWifiSmeCloakedSsidsSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCloakedSsidsSetReq)); CsrSize offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->cloakedSsids.cloakedSsidsCount, buffer, &offset); + CsrUint8Des((u8 *) &primitive->cloakedSsids.cloakedSsidsCount, buffer, &offset); primitive->cloakedSsids.cloakedSsids = NULL; if (primitive->cloakedSsids.cloakedSsidsCount) { @@ -1727,7 +1727,7 @@ void* CsrWifiSmeCloakedSsidsSetReqDes(CsrUint8 *buffer, CsrSize length) for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) { CsrMemCpyDes(primitive->cloakedSsids.cloakedSsids[i2].ssid, buffer, &offset, ((CsrUint16) (32))); - CsrUint8Des((CsrUint8 *) &primitive->cloakedSsids.cloakedSsids[i2].length, buffer, &offset); + CsrUint8Des((u8 *) &primitive->cloakedSsids.cloakedSsids[i2].length, buffer, &offset); } } @@ -1749,37 +1749,37 @@ CsrSize CsrWifiSmeSmeCommonConfigSetReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 1; /* CsrWifiSme80211dTrustLevel primitive->deviceConfig.trustLevel */ - bufferSize += 2; /* CsrUint8 primitive->deviceConfig.countryCode[2] */ + bufferSize += 2; /* u8 primitive->deviceConfig.countryCode[2] */ bufferSize += 1; /* CsrWifiSmeFirmwareDriverInterface primitive->deviceConfig.firmwareDriverInterface */ bufferSize += 1; /* CsrBool primitive->deviceConfig.enableStrictDraftN */ return bufferSize; } -CsrUint8* CsrWifiSmeSmeCommonConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeSmeCommonConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeSmeCommonConfigSetReq *primitive = (CsrWifiSmeSmeCommonConfigSetReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->deviceConfig.trustLevel); + CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.trustLevel); CsrMemCpySer(ptr, len, (const void *) primitive->deviceConfig.countryCode, ((CsrUint16) (2))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->deviceConfig.firmwareDriverInterface); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->deviceConfig.enableStrictDraftN); + CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.firmwareDriverInterface); + CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.enableStrictDraftN); return(ptr); } -void* CsrWifiSmeSmeCommonConfigSetReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeSmeCommonConfigSetReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeSmeCommonConfigSetReq *primitive = (CsrWifiSmeSmeCommonConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeCommonConfigSetReq)); CsrSize offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->deviceConfig.trustLevel, buffer, &offset); + CsrUint8Des((u8 *) &primitive->deviceConfig.trustLevel, buffer, &offset); CsrMemCpyDes(primitive->deviceConfig.countryCode, buffer, &offset, ((CsrUint16) (2))); - CsrUint8Des((CsrUint8 *) &primitive->deviceConfig.firmwareDriverInterface, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->deviceConfig.enableStrictDraftN, buffer, &offset); + CsrUint8Des((u8 *) &primitive->deviceConfig.firmwareDriverInterface, buffer, &offset); + CsrUint8Des((u8 *) &primitive->deviceConfig.enableStrictDraftN, buffer, &offset); return primitive; } @@ -1791,51 +1791,51 @@ CsrSize CsrWifiSmeWpsConfigurationReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 240) */ - bufferSize += 1; /* CsrUint8 primitive->wpsConfig.wpsVersion */ - bufferSize += 16; /* CsrUint8 primitive->wpsConfig.uuid[16] */ - bufferSize += 32; /* CsrUint8 primitive->wpsConfig.deviceName[32] */ - bufferSize += 1; /* CsrUint8 primitive->wpsConfig.deviceNameLength */ - bufferSize += 64; /* CsrUint8 primitive->wpsConfig.manufacturer[64] */ - bufferSize += 1; /* CsrUint8 primitive->wpsConfig.manufacturerLength */ - bufferSize += 32; /* CsrUint8 primitive->wpsConfig.modelName[32] */ - bufferSize += 1; /* CsrUint8 primitive->wpsConfig.modelNameLength */ - bufferSize += 32; /* CsrUint8 primitive->wpsConfig.modelNumber[32] */ - bufferSize += 1; /* CsrUint8 primitive->wpsConfig.modelNumberLength */ - bufferSize += 32; /* CsrUint8 primitive->wpsConfig.serialNumber[32] */ - bufferSize += 8; /* CsrUint8 primitive->wpsConfig.primDeviceType.deviceDetails[8] */ - bufferSize += 1; /* CsrUint8 primitive->wpsConfig.secondaryDeviceTypeCount */ + bufferSize += 1; /* u8 primitive->wpsConfig.wpsVersion */ + bufferSize += 16; /* u8 primitive->wpsConfig.uuid[16] */ + bufferSize += 32; /* u8 primitive->wpsConfig.deviceName[32] */ + bufferSize += 1; /* u8 primitive->wpsConfig.deviceNameLength */ + bufferSize += 64; /* u8 primitive->wpsConfig.manufacturer[64] */ + bufferSize += 1; /* u8 primitive->wpsConfig.manufacturerLength */ + bufferSize += 32; /* u8 primitive->wpsConfig.modelName[32] */ + bufferSize += 1; /* u8 primitive->wpsConfig.modelNameLength */ + bufferSize += 32; /* u8 primitive->wpsConfig.modelNumber[32] */ + bufferSize += 1; /* u8 primitive->wpsConfig.modelNumberLength */ + bufferSize += 32; /* u8 primitive->wpsConfig.serialNumber[32] */ + bufferSize += 8; /* u8 primitive->wpsConfig.primDeviceType.deviceDetails[8] */ + bufferSize += 1; /* u8 primitive->wpsConfig.secondaryDeviceTypeCount */ { CsrUint16 i2; for (i2 = 0; i2 < primitive->wpsConfig.secondaryDeviceTypeCount; i2++) { - bufferSize += 8; /* CsrUint8 primitive->wpsConfig.secondaryDeviceType[i2].deviceDetails[8] */ + bufferSize += 8; /* u8 primitive->wpsConfig.secondaryDeviceType[i2].deviceDetails[8] */ } } bufferSize += 2; /* CsrWifiSmeWpsConfigTypeMask primitive->wpsConfig.configMethods */ - bufferSize += 1; /* CsrUint8 primitive->wpsConfig.rfBands */ - bufferSize += 4; /* CsrUint8 primitive->wpsConfig.osVersion[4] */ + bufferSize += 1; /* u8 primitive->wpsConfig.rfBands */ + bufferSize += 4; /* u8 primitive->wpsConfig.osVersion[4] */ return bufferSize; } -CsrUint8* CsrWifiSmeWpsConfigurationReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeWpsConfigurationReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeWpsConfigurationReq *primitive = (CsrWifiSmeWpsConfigurationReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->wpsConfig.wpsVersion); + CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.wpsVersion); CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.uuid, ((CsrUint16) (16))); CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.deviceName, ((CsrUint16) (32))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->wpsConfig.deviceNameLength); + CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.deviceNameLength); CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.manufacturer, ((CsrUint16) (64))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->wpsConfig.manufacturerLength); + CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.manufacturerLength); CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.modelName, ((CsrUint16) (32))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->wpsConfig.modelNameLength); + CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.modelNameLength); CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.modelNumber, ((CsrUint16) (32))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->wpsConfig.modelNumberLength); + CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.modelNumberLength); CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.serialNumber, ((CsrUint16) (32))); CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.primDeviceType.deviceDetails, ((CsrUint16) (8))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->wpsConfig.secondaryDeviceTypeCount); + CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.secondaryDeviceTypeCount); { CsrUint16 i2; for (i2 = 0; i2 < primitive->wpsConfig.secondaryDeviceTypeCount; i2++) @@ -1844,32 +1844,32 @@ CsrUint8* CsrWifiSmeWpsConfigurationReqSer(CsrUint8 *ptr, CsrSize *len, void *ms } } CsrUint16Ser(ptr, len, (CsrUint16) primitive->wpsConfig.configMethods); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->wpsConfig.rfBands); + CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.rfBands); CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.osVersion, ((CsrUint16) (4))); return(ptr); } -void* CsrWifiSmeWpsConfigurationReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeWpsConfigurationReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeWpsConfigurationReq *primitive = (CsrWifiSmeWpsConfigurationReq *) CsrPmemAlloc(sizeof(CsrWifiSmeWpsConfigurationReq)); CsrSize offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->wpsConfig.wpsVersion, buffer, &offset); + CsrUint8Des((u8 *) &primitive->wpsConfig.wpsVersion, buffer, &offset); CsrMemCpyDes(primitive->wpsConfig.uuid, buffer, &offset, ((CsrUint16) (16))); CsrMemCpyDes(primitive->wpsConfig.deviceName, buffer, &offset, ((CsrUint16) (32))); - CsrUint8Des((CsrUint8 *) &primitive->wpsConfig.deviceNameLength, buffer, &offset); + CsrUint8Des((u8 *) &primitive->wpsConfig.deviceNameLength, buffer, &offset); CsrMemCpyDes(primitive->wpsConfig.manufacturer, buffer, &offset, ((CsrUint16) (64))); - CsrUint8Des((CsrUint8 *) &primitive->wpsConfig.manufacturerLength, buffer, &offset); + CsrUint8Des((u8 *) &primitive->wpsConfig.manufacturerLength, buffer, &offset); CsrMemCpyDes(primitive->wpsConfig.modelName, buffer, &offset, ((CsrUint16) (32))); - CsrUint8Des((CsrUint8 *) &primitive->wpsConfig.modelNameLength, buffer, &offset); + CsrUint8Des((u8 *) &primitive->wpsConfig.modelNameLength, buffer, &offset); CsrMemCpyDes(primitive->wpsConfig.modelNumber, buffer, &offset, ((CsrUint16) (32))); - CsrUint8Des((CsrUint8 *) &primitive->wpsConfig.modelNumberLength, buffer, &offset); + CsrUint8Des((u8 *) &primitive->wpsConfig.modelNumberLength, buffer, &offset); CsrMemCpyDes(primitive->wpsConfig.serialNumber, buffer, &offset, ((CsrUint16) (32))); CsrMemCpyDes(primitive->wpsConfig.primDeviceType.deviceDetails, buffer, &offset, ((CsrUint16) (8))); - CsrUint8Des((CsrUint8 *) &primitive->wpsConfig.secondaryDeviceTypeCount, buffer, &offset); + CsrUint8Des((u8 *) &primitive->wpsConfig.secondaryDeviceTypeCount, buffer, &offset); primitive->wpsConfig.secondaryDeviceType = NULL; if (primitive->wpsConfig.secondaryDeviceTypeCount) { @@ -1883,7 +1883,7 @@ void* CsrWifiSmeWpsConfigurationReqDes(CsrUint8 *buffer, CsrSize length) } } CsrUint16Des((CsrUint16 *) &primitive->wpsConfig.configMethods, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->wpsConfig.rfBands, buffer, &offset); + CsrUint8Des((u8 *) &primitive->wpsConfig.rfBands, buffer, &offset); CsrMemCpyDes(primitive->wpsConfig.osVersion, buffer, &offset, ((CsrUint16) (4))); return primitive; @@ -1905,12 +1905,12 @@ CsrSize CsrWifiSmeSetReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 4; /* CsrUint32 primitive->dataLength */ - bufferSize += primitive->dataLength; /* CsrUint8 primitive->data */ + bufferSize += primitive->dataLength; /* u8 primitive->data */ return bufferSize; } -CsrUint8* CsrWifiSmeSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeSetReqSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeSetReq *primitive = (CsrWifiSmeSetReq *)msg; *len = 0; @@ -1924,7 +1924,7 @@ CsrUint8* CsrWifiSmeSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeSetReqDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeSetReqDes(u8 *buffer, CsrSize length) { CsrWifiSmeSetReq *primitive = (CsrWifiSmeSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeSetReq)); CsrSize offset; @@ -1934,7 +1934,7 @@ void* CsrWifiSmeSetReqDes(CsrUint8 *buffer, CsrSize length) CsrUint32Des((CsrUint32 *) &primitive->dataLength, buffer, &offset); if (primitive->dataLength) { - primitive->data = (CsrUint8 *)CsrPmemAlloc(primitive->dataLength); + primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); CsrMemCpyDes(primitive->data, buffer, &offset, ((CsrUint16) (primitive->dataLength))); } else @@ -1968,7 +1968,7 @@ CsrSize CsrWifiSmeAdhocConfigGetCfmSizeof(void *msg) } -CsrUint8* CsrWifiSmeAdhocConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeAdhocConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeAdhocConfigGetCfm *primitive = (CsrWifiSmeAdhocConfigGetCfm *)msg; *len = 0; @@ -1982,7 +1982,7 @@ CsrUint8* CsrWifiSmeAdhocConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeAdhocConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeAdhocConfigGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeAdhocConfigGetCfm *primitive = (CsrWifiSmeAdhocConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeAdhocConfigGetCfm)); CsrSize offset; @@ -2007,11 +2007,11 @@ CsrSize CsrWifiSmeAssociationCompleteIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 98) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 32; /* CsrUint8 primitive->connectionInfo.ssid.ssid[32] */ - bufferSize += 1; /* CsrUint8 primitive->connectionInfo.ssid.length */ - bufferSize += 6; /* CsrUint8 primitive->connectionInfo.bssid.a[6] */ + bufferSize += 32; /* u8 primitive->connectionInfo.ssid.ssid[32] */ + bufferSize += 1; /* u8 primitive->connectionInfo.ssid.length */ + bufferSize += 6; /* u8 primitive->connectionInfo.bssid.a[6] */ bufferSize += 1; /* CsrWifiSme80211NetworkType primitive->connectionInfo.networkType80211 */ - bufferSize += 1; /* CsrUint8 primitive->connectionInfo.channelNumber */ + bufferSize += 1; /* u8 primitive->connectionInfo.channelNumber */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.channelFrequency */ bufferSize += 2; /* CsrWifiSmeAuthMode primitive->connectionInfo.authMode */ bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.pairwiseCipher */ @@ -2021,29 +2021,29 @@ CsrSize CsrWifiSmeAssociationCompleteIndSizeof(void *msg) bufferSize += 2; /* CsrUint16 primitive->connectionInfo.beaconPeriodTu */ bufferSize += 1; /* CsrBool primitive->connectionInfo.reassociation */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.beaconFrameLength */ - bufferSize += primitive->connectionInfo.beaconFrameLength; /* CsrUint8 primitive->connectionInfo.beaconFrame */ + bufferSize += primitive->connectionInfo.beaconFrameLength; /* u8 primitive->connectionInfo.beaconFrame */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.associationReqFrameLength */ - bufferSize += primitive->connectionInfo.associationReqFrameLength; /* CsrUint8 primitive->connectionInfo.associationReqFrame */ + bufferSize += primitive->connectionInfo.associationReqFrameLength; /* u8 primitive->connectionInfo.associationReqFrame */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.associationRspFrameLength */ - bufferSize += primitive->connectionInfo.associationRspFrameLength; /* CsrUint8 primitive->connectionInfo.associationRspFrame */ + bufferSize += primitive->connectionInfo.associationRspFrameLength; /* u8 primitive->connectionInfo.associationRspFrame */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocScanInfoElementsLength */ - bufferSize += primitive->connectionInfo.assocScanInfoElementsLength; /* CsrUint8 primitive->connectionInfo.assocScanInfoElements */ + bufferSize += primitive->connectionInfo.assocScanInfoElementsLength; /* u8 primitive->connectionInfo.assocScanInfoElements */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqCapabilities */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqListenIntervalTu */ - bufferSize += 6; /* CsrUint8 primitive->connectionInfo.assocReqApAddress.a[6] */ + bufferSize += 6; /* u8 primitive->connectionInfo.assocReqApAddress.a[6] */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqInfoElementsLength */ - bufferSize += primitive->connectionInfo.assocReqInfoElementsLength; /* CsrUint8 primitive->connectionInfo.assocReqInfoElements */ + bufferSize += primitive->connectionInfo.assocReqInfoElementsLength; /* u8 primitive->connectionInfo.assocReqInfoElements */ bufferSize += 2; /* CsrWifiSmeIEEE80211Result primitive->connectionInfo.assocRspResult */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspCapabilityInfo */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspAssociationId */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspInfoElementsLength */ - bufferSize += primitive->connectionInfo.assocRspInfoElementsLength; /* CsrUint8 primitive->connectionInfo.assocRspInfoElements */ + bufferSize += primitive->connectionInfo.assocRspInfoElementsLength; /* u8 primitive->connectionInfo.assocRspInfoElements */ bufferSize += 2; /* CsrWifiSmeIEEE80211Reason primitive->deauthReason */ return bufferSize; } -CsrUint8* CsrWifiSmeAssociationCompleteIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeAssociationCompleteIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeAssociationCompleteInd *primitive = (CsrWifiSmeAssociationCompleteInd *)msg; *len = 0; @@ -2051,18 +2051,18 @@ CsrUint8* CsrWifiSmeAssociationCompleteIndSer(CsrUint8 *ptr, CsrSize *len, void CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.ssid.ssid, ((CsrUint16) (32))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.ssid.length); + CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ssid.length); CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.bssid.a, ((CsrUint16) (6))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.networkType80211); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.channelNumber); + CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.networkType80211); + CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.channelNumber); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.channelFrequency); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.authMode); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.pairwiseCipher); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.groupCipher); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.ifIndex); + CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ifIndex); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.atimWindowTu); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.beaconPeriodTu); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.reassociation); + CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.reassociation); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.beaconFrameLength); if (primitive->connectionInfo.beaconFrameLength) { @@ -2104,7 +2104,7 @@ CsrUint8* CsrWifiSmeAssociationCompleteIndSer(CsrUint8 *ptr, CsrSize *len, void } -void* CsrWifiSmeAssociationCompleteIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeAssociationCompleteIndDes(u8 *buffer, CsrSize length) { CsrWifiSmeAssociationCompleteInd *primitive = (CsrWifiSmeAssociationCompleteInd *) CsrPmemAlloc(sizeof(CsrWifiSmeAssociationCompleteInd)); CsrSize offset; @@ -2114,22 +2114,22 @@ void* CsrWifiSmeAssociationCompleteIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); CsrMemCpyDes(primitive->connectionInfo.ssid.ssid, buffer, &offset, ((CsrUint16) (32))); - CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.ssid.length, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionInfo.ssid.length, buffer, &offset); CsrMemCpyDes(primitive->connectionInfo.bssid.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.networkType80211, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.channelNumber, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionInfo.networkType80211, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionInfo.channelNumber, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.channelFrequency, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.authMode, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.pairwiseCipher, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.groupCipher, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.ifIndex, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionInfo.ifIndex, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.atimWindowTu, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.beaconPeriodTu, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.reassociation, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionInfo.reassociation, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.beaconFrameLength, buffer, &offset); if (primitive->connectionInfo.beaconFrameLength) { - primitive->connectionInfo.beaconFrame = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.beaconFrameLength); + primitive->connectionInfo.beaconFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.beaconFrameLength); CsrMemCpyDes(primitive->connectionInfo.beaconFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.beaconFrameLength))); } else @@ -2139,7 +2139,7 @@ void* CsrWifiSmeAssociationCompleteIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.associationReqFrameLength, buffer, &offset); if (primitive->connectionInfo.associationReqFrameLength) { - primitive->connectionInfo.associationReqFrame = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.associationReqFrameLength); + primitive->connectionInfo.associationReqFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.associationReqFrameLength); CsrMemCpyDes(primitive->connectionInfo.associationReqFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.associationReqFrameLength))); } else @@ -2149,7 +2149,7 @@ void* CsrWifiSmeAssociationCompleteIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.associationRspFrameLength, buffer, &offset); if (primitive->connectionInfo.associationRspFrameLength) { - primitive->connectionInfo.associationRspFrame = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.associationRspFrameLength); + primitive->connectionInfo.associationRspFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.associationRspFrameLength); CsrMemCpyDes(primitive->connectionInfo.associationRspFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.associationRspFrameLength))); } else @@ -2159,7 +2159,7 @@ void* CsrWifiSmeAssociationCompleteIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocScanInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocScanInfoElementsLength) { - primitive->connectionInfo.assocScanInfoElements = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.assocScanInfoElementsLength); + primitive->connectionInfo.assocScanInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocScanInfoElementsLength); CsrMemCpyDes(primitive->connectionInfo.assocScanInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocScanInfoElementsLength))); } else @@ -2172,7 +2172,7 @@ void* CsrWifiSmeAssociationCompleteIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocReqInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocReqInfoElementsLength) { - primitive->connectionInfo.assocReqInfoElements = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.assocReqInfoElementsLength); + primitive->connectionInfo.assocReqInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocReqInfoElementsLength); CsrMemCpyDes(primitive->connectionInfo.assocReqInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocReqInfoElementsLength))); } else @@ -2185,7 +2185,7 @@ void* CsrWifiSmeAssociationCompleteIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocRspInfoElementsLength) { - primitive->connectionInfo.assocRspInfoElements = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.assocRspInfoElementsLength); + primitive->connectionInfo.assocRspInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocRspInfoElementsLength); CsrMemCpyDes(primitive->connectionInfo.assocRspInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocRspInfoElementsLength))); } else @@ -2217,14 +2217,14 @@ CsrSize CsrWifiSmeAssociationStartIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 44) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ - bufferSize += 6; /* CsrUint8 primitive->address.a[6] */ - bufferSize += 32; /* CsrUint8 primitive->ssid.ssid[32] */ - bufferSize += 1; /* CsrUint8 primitive->ssid.length */ + bufferSize += 6; /* u8 primitive->address.a[6] */ + bufferSize += 32; /* u8 primitive->ssid.ssid[32] */ + bufferSize += 1; /* u8 primitive->ssid.length */ return bufferSize; } -CsrUint8* CsrWifiSmeAssociationStartIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeAssociationStartIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeAssociationStartInd *primitive = (CsrWifiSmeAssociationStartInd *)msg; *len = 0; @@ -2232,12 +2232,12 @@ CsrUint8* CsrWifiSmeAssociationStartIndSer(CsrUint8 *ptr, CsrSize *len, void *ms CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((CsrUint16) (6))); CsrMemCpySer(ptr, len, (const void *) primitive->ssid.ssid, ((CsrUint16) (32))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->ssid.length); + CsrUint8Ser(ptr, len, (u8) primitive->ssid.length); return(ptr); } -void* CsrWifiSmeAssociationStartIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeAssociationStartIndDes(u8 *buffer, CsrSize length) { CsrWifiSmeAssociationStartInd *primitive = (CsrWifiSmeAssociationStartInd *) CsrPmemAlloc(sizeof(CsrWifiSmeAssociationStartInd)); CsrSize offset; @@ -2247,7 +2247,7 @@ void* CsrWifiSmeAssociationStartIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrMemCpyDes(primitive->address.a, buffer, &offset, ((CsrUint16) (6))); CsrMemCpyDes(primitive->ssid.ssid, buffer, &offset, ((CsrUint16) (32))); - CsrUint8Des((CsrUint8 *) &primitive->ssid.length, buffer, &offset); + CsrUint8Des((u8 *) &primitive->ssid.length, buffer, &offset); return primitive; } @@ -2262,27 +2262,27 @@ CsrSize CsrWifiSmeBlacklistCfmSizeof(void *msg) bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ - bufferSize += 1; /* CsrUint8 primitive->getAddressCount */ + bufferSize += 1; /* u8 primitive->getAddressCount */ { CsrUint16 i1; for (i1 = 0; i1 < primitive->getAddressCount; i1++) { - bufferSize += 6; /* CsrUint8 primitive->getAddresses[i1].a[6] */ + bufferSize += 6; /* u8 primitive->getAddresses[i1].a[6] */ } } return bufferSize; } -CsrUint8* CsrWifiSmeBlacklistCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeBlacklistCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeBlacklistCfm *primitive = (CsrWifiSmeBlacklistCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->action); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->getAddressCount); + CsrUint8Ser(ptr, len, (u8) primitive->action); + CsrUint8Ser(ptr, len, (u8) primitive->getAddressCount); { CsrUint16 i1; for (i1 = 0; i1 < primitive->getAddressCount; i1++) @@ -2294,7 +2294,7 @@ CsrUint8* CsrWifiSmeBlacklistCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeBlacklistCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeBlacklistCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeBlacklistCfm *primitive = (CsrWifiSmeBlacklistCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeBlacklistCfm)); CsrSize offset; @@ -2303,8 +2303,8 @@ void* CsrWifiSmeBlacklistCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->action, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->getAddressCount, buffer, &offset); + CsrUint8Des((u8 *) &primitive->action, buffer, &offset); + CsrUint8Des((u8 *) &primitive->getAddressCount, buffer, &offset); primitive->getAddresses = NULL; if (primitive->getAddressCount) { @@ -2338,12 +2338,12 @@ CsrSize CsrWifiSmeCalibrationDataGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 2; /* CsrUint16 primitive->calibrationDataLength */ - bufferSize += primitive->calibrationDataLength; /* CsrUint8 primitive->calibrationData */ + bufferSize += primitive->calibrationDataLength; /* u8 primitive->calibrationData */ return bufferSize; } -CsrUint8* CsrWifiSmeCalibrationDataGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeCalibrationDataGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeCalibrationDataGetCfm *primitive = (CsrWifiSmeCalibrationDataGetCfm *)msg; *len = 0; @@ -2358,7 +2358,7 @@ CsrUint8* CsrWifiSmeCalibrationDataGetCfmSer(CsrUint8 *ptr, CsrSize *len, void * } -void* CsrWifiSmeCalibrationDataGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeCalibrationDataGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeCalibrationDataGetCfm *primitive = (CsrWifiSmeCalibrationDataGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCalibrationDataGetCfm)); CsrSize offset; @@ -2369,7 +2369,7 @@ void* CsrWifiSmeCalibrationDataGetCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->calibrationDataLength, buffer, &offset); if (primitive->calibrationDataLength) { - primitive->calibrationData = (CsrUint8 *)CsrPmemAlloc(primitive->calibrationDataLength); + primitive->calibrationData = (u8 *)CsrPmemAlloc(primitive->calibrationDataLength); CsrMemCpyDes(primitive->calibrationData, buffer, &offset, ((CsrUint16) (primitive->calibrationDataLength))); } else @@ -2396,30 +2396,30 @@ CsrSize CsrWifiSmeCcxConfigGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* CsrUint8 primitive->ccxConfig.keepAliveTimeMs */ + bufferSize += 1; /* u8 primitive->ccxConfig.keepAliveTimeMs */ bufferSize += 1; /* CsrBool primitive->ccxConfig.apRoamingEnabled */ - bufferSize += 1; /* CsrUint8 primitive->ccxConfig.measurementsMask */ + bufferSize += 1; /* u8 primitive->ccxConfig.measurementsMask */ bufferSize += 1; /* CsrBool primitive->ccxConfig.ccxRadioMgtEnabled */ return bufferSize; } -CsrUint8* CsrWifiSmeCcxConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeCcxConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeCcxConfigGetCfm *primitive = (CsrWifiSmeCcxConfigGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->ccxConfig.keepAliveTimeMs); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->ccxConfig.apRoamingEnabled); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->ccxConfig.measurementsMask); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->ccxConfig.ccxRadioMgtEnabled); + CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.keepAliveTimeMs); + CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.apRoamingEnabled); + CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.measurementsMask); + CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.ccxRadioMgtEnabled); return(ptr); } -void* CsrWifiSmeCcxConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeCcxConfigGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeCcxConfigGetCfm *primitive = (CsrWifiSmeCcxConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCcxConfigGetCfm)); CsrSize offset; @@ -2428,10 +2428,10 @@ void* CsrWifiSmeCcxConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->ccxConfig.keepAliveTimeMs, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->ccxConfig.apRoamingEnabled, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->ccxConfig.measurementsMask, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->ccxConfig.ccxRadioMgtEnabled, buffer, &offset); + CsrUint8Des((u8 *) &primitive->ccxConfig.keepAliveTimeMs, buffer, &offset); + CsrUint8Des((u8 *) &primitive->ccxConfig.apRoamingEnabled, buffer, &offset); + CsrUint8Des((u8 *) &primitive->ccxConfig.measurementsMask, buffer, &offset); + CsrUint8Des((u8 *) &primitive->ccxConfig.ccxRadioMgtEnabled, buffer, &offset); return primitive; } @@ -2448,7 +2448,7 @@ CsrSize CsrWifiSmeCcxConfigSetCfmSizeof(void *msg) } -CsrUint8* CsrWifiSmeCcxConfigSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeCcxConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeCcxConfigSetCfm *primitive = (CsrWifiSmeCcxConfigSetCfm *)msg; *len = 0; @@ -2459,7 +2459,7 @@ CsrUint8* CsrWifiSmeCcxConfigSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeCcxConfigSetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeCcxConfigSetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeCcxConfigSetCfm *primitive = (CsrWifiSmeCcxConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCcxConfigSetCfm)); CsrSize offset; @@ -2497,14 +2497,14 @@ CsrSize CsrWifiSmeCoexConfigGetCfmSizeof(void *msg) } -CsrUint8* CsrWifiSmeCoexConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeCoexConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeCoexConfigGetCfm *primitive = (CsrWifiSmeCoexConfigGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->coexConfig.coexEnableSchemeManagement); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->coexConfig.coexPeriodicWakeHost); + CsrUint8Ser(ptr, len, (u8) primitive->coexConfig.coexEnableSchemeManagement); + CsrUint8Ser(ptr, len, (u8) primitive->coexConfig.coexPeriodicWakeHost); CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexTrafficBurstyLatencyMs); CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexTrafficContinuousLatencyMs); CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexObexBlackoutDurationMs); @@ -2521,7 +2521,7 @@ CsrUint8* CsrWifiSmeCoexConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeCoexConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeCoexConfigGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeCoexConfigGetCfm *primitive = (CsrWifiSmeCoexConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexConfigGetCfm)); CsrSize offset; @@ -2529,8 +2529,8 @@ void* CsrWifiSmeCoexConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->coexConfig.coexEnableSchemeManagement, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->coexConfig.coexPeriodicWakeHost, buffer, &offset); + CsrUint8Des((u8 *) &primitive->coexConfig.coexEnableSchemeManagement, buffer, &offset); + CsrUint8Des((u8 *) &primitive->coexConfig.coexPeriodicWakeHost, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexTrafficBurstyLatencyMs, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexTrafficContinuousLatencyMs, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexObexBlackoutDurationMs, buffer, &offset); @@ -2568,27 +2568,27 @@ CsrSize CsrWifiSmeCoexInfoGetCfmSizeof(void *msg) } -CsrUint8* CsrWifiSmeCoexInfoGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeCoexInfoGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeCoexInfoGetCfm *primitive = (CsrWifiSmeCoexInfoGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->coexInfo.hasTrafficData); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->coexInfo.currentTrafficType); + CsrUint8Ser(ptr, len, (u8) primitive->coexInfo.hasTrafficData); + CsrUint8Ser(ptr, len, (u8) primitive->coexInfo.currentTrafficType); CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexInfo.currentPeriodMs); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->coexInfo.currentPowerSave); + CsrUint8Ser(ptr, len, (u8) primitive->coexInfo.currentPowerSave); CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexInfo.currentCoexPeriodMs); CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexInfo.currentCoexLatencyMs); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->coexInfo.hasBtDevice); + CsrUint8Ser(ptr, len, (u8) primitive->coexInfo.hasBtDevice); CsrUint32Ser(ptr, len, (CsrUint32) primitive->coexInfo.currentBlackoutDurationUs); CsrUint32Ser(ptr, len, (CsrUint32) primitive->coexInfo.currentBlackoutPeriodUs); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->coexInfo.currentCoexScheme); + CsrUint8Ser(ptr, len, (u8) primitive->coexInfo.currentCoexScheme); return(ptr); } -void* CsrWifiSmeCoexInfoGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeCoexInfoGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeCoexInfoGetCfm *primitive = (CsrWifiSmeCoexInfoGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexInfoGetCfm)); CsrSize offset; @@ -2596,16 +2596,16 @@ void* CsrWifiSmeCoexInfoGetCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->coexInfo.hasTrafficData, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->coexInfo.currentTrafficType, buffer, &offset); + CsrUint8Des((u8 *) &primitive->coexInfo.hasTrafficData, buffer, &offset); + CsrUint8Des((u8 *) &primitive->coexInfo.currentTrafficType, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->coexInfo.currentPeriodMs, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->coexInfo.currentPowerSave, buffer, &offset); + CsrUint8Des((u8 *) &primitive->coexInfo.currentPowerSave, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->coexInfo.currentCoexPeriodMs, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->coexInfo.currentCoexLatencyMs, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->coexInfo.hasBtDevice, buffer, &offset); + CsrUint8Des((u8 *) &primitive->coexInfo.hasBtDevice, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->coexInfo.currentBlackoutDurationUs, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->coexInfo.currentBlackoutPeriodUs, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->coexInfo.currentCoexScheme, buffer, &offset); + CsrUint8Des((u8 *) &primitive->coexInfo.currentCoexScheme, buffer, &offset); return primitive; } @@ -2622,7 +2622,7 @@ CsrSize CsrWifiSmeConnectCfmSizeof(void *msg) } -CsrUint8* CsrWifiSmeConnectCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeConnectCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeConnectCfm *primitive = (CsrWifiSmeConnectCfm *)msg; *len = 0; @@ -2633,7 +2633,7 @@ CsrUint8* CsrWifiSmeConnectCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeConnectCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeConnectCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeConnectCfm *primitive = (CsrWifiSmeConnectCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectCfm)); CsrSize offset; @@ -2655,24 +2655,24 @@ CsrSize CsrWifiSmeConnectionConfigGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 59) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 32; /* CsrUint8 primitive->connectionConfig.ssid.ssid[32] */ - bufferSize += 1; /* CsrUint8 primitive->connectionConfig.ssid.length */ - bufferSize += 6; /* CsrUint8 primitive->connectionConfig.bssid.a[6] */ + bufferSize += 32; /* u8 primitive->connectionConfig.ssid.ssid[32] */ + bufferSize += 1; /* u8 primitive->connectionConfig.ssid.length */ + bufferSize += 6; /* u8 primitive->connectionConfig.bssid.a[6] */ bufferSize += 1; /* CsrWifiSmeBssType primitive->connectionConfig.bssType */ bufferSize += 1; /* CsrWifiSmeRadioIF primitive->connectionConfig.ifIndex */ bufferSize += 1; /* CsrWifiSme80211PrivacyMode primitive->connectionConfig.privacyMode */ bufferSize += 2; /* CsrWifiSmeAuthModeMask primitive->connectionConfig.authModeMask */ bufferSize += 2; /* CsrWifiSmeEncryptionMask primitive->connectionConfig.encryptionModeMask */ bufferSize += 2; /* CsrUint16 primitive->connectionConfig.mlmeAssociateReqInformationElementsLength */ - bufferSize += primitive->connectionConfig.mlmeAssociateReqInformationElementsLength; /* CsrUint8 primitive->connectionConfig.mlmeAssociateReqInformationElements */ + bufferSize += primitive->connectionConfig.mlmeAssociateReqInformationElementsLength; /* u8 primitive->connectionConfig.mlmeAssociateReqInformationElements */ bufferSize += 1; /* CsrWifiSmeWmmQosInfoMask primitive->connectionConfig.wmmQosInfo */ bufferSize += 1; /* CsrBool primitive->connectionConfig.adhocJoinOnly */ - bufferSize += 1; /* CsrUint8 primitive->connectionConfig.adhocChannel */ + bufferSize += 1; /* u8 primitive->connectionConfig.adhocChannel */ return bufferSize; } -CsrUint8* CsrWifiSmeConnectionConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeConnectionConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeConnectionConfigGetCfm *primitive = (CsrWifiSmeConnectionConfigGetCfm *)msg; *len = 0; @@ -2680,11 +2680,11 @@ CsrUint8* CsrWifiSmeConnectionConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.ssid.ssid, ((CsrUint16) (32))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.ssid.length); + CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.ssid.length); CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.bssid.a, ((CsrUint16) (6))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.bssType); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.ifIndex); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.privacyMode); + CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.bssType); + CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.ifIndex); + CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.privacyMode); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionConfig.authModeMask); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionConfig.encryptionModeMask); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionConfig.mlmeAssociateReqInformationElementsLength); @@ -2692,14 +2692,14 @@ CsrUint8* CsrWifiSmeConnectionConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void { CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.mlmeAssociateReqInformationElements, ((CsrUint16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength))); } - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.wmmQosInfo); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.adhocJoinOnly); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionConfig.adhocChannel); + CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.wmmQosInfo); + CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.adhocJoinOnly); + CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.adhocChannel); return(ptr); } -void* CsrWifiSmeConnectionConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeConnectionConfigGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeConnectionConfigGetCfm *primitive = (CsrWifiSmeConnectionConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionConfigGetCfm)); CsrSize offset; @@ -2709,26 +2709,26 @@ void* CsrWifiSmeConnectionConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); CsrMemCpyDes(primitive->connectionConfig.ssid.ssid, buffer, &offset, ((CsrUint16) (32))); - CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.ssid.length, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionConfig.ssid.length, buffer, &offset); CsrMemCpyDes(primitive->connectionConfig.bssid.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.bssType, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.ifIndex, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.privacyMode, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionConfig.bssType, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionConfig.ifIndex, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionConfig.privacyMode, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionConfig.authModeMask, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionConfig.encryptionModeMask, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionConfig.mlmeAssociateReqInformationElementsLength, buffer, &offset); if (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength) { - primitive->connectionConfig.mlmeAssociateReqInformationElements = (CsrUint8 *)CsrPmemAlloc(primitive->connectionConfig.mlmeAssociateReqInformationElementsLength); + primitive->connectionConfig.mlmeAssociateReqInformationElements = (u8 *)CsrPmemAlloc(primitive->connectionConfig.mlmeAssociateReqInformationElementsLength); CsrMemCpyDes(primitive->connectionConfig.mlmeAssociateReqInformationElements, buffer, &offset, ((CsrUint16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength))); } else { primitive->connectionConfig.mlmeAssociateReqInformationElements = NULL; } - CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.wmmQosInfo, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.adhocJoinOnly, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->connectionConfig.adhocChannel, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionConfig.wmmQosInfo, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionConfig.adhocJoinOnly, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionConfig.adhocChannel, buffer, &offset); return primitive; } @@ -2750,11 +2750,11 @@ CsrSize CsrWifiSmeConnectionInfoGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 96) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 32; /* CsrUint8 primitive->connectionInfo.ssid.ssid[32] */ - bufferSize += 1; /* CsrUint8 primitive->connectionInfo.ssid.length */ - bufferSize += 6; /* CsrUint8 primitive->connectionInfo.bssid.a[6] */ + bufferSize += 32; /* u8 primitive->connectionInfo.ssid.ssid[32] */ + bufferSize += 1; /* u8 primitive->connectionInfo.ssid.length */ + bufferSize += 6; /* u8 primitive->connectionInfo.bssid.a[6] */ bufferSize += 1; /* CsrWifiSme80211NetworkType primitive->connectionInfo.networkType80211 */ - bufferSize += 1; /* CsrUint8 primitive->connectionInfo.channelNumber */ + bufferSize += 1; /* u8 primitive->connectionInfo.channelNumber */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.channelFrequency */ bufferSize += 2; /* CsrWifiSmeAuthMode primitive->connectionInfo.authMode */ bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.pairwiseCipher */ @@ -2764,28 +2764,28 @@ CsrSize CsrWifiSmeConnectionInfoGetCfmSizeof(void *msg) bufferSize += 2; /* CsrUint16 primitive->connectionInfo.beaconPeriodTu */ bufferSize += 1; /* CsrBool primitive->connectionInfo.reassociation */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.beaconFrameLength */ - bufferSize += primitive->connectionInfo.beaconFrameLength; /* CsrUint8 primitive->connectionInfo.beaconFrame */ + bufferSize += primitive->connectionInfo.beaconFrameLength; /* u8 primitive->connectionInfo.beaconFrame */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.associationReqFrameLength */ - bufferSize += primitive->connectionInfo.associationReqFrameLength; /* CsrUint8 primitive->connectionInfo.associationReqFrame */ + bufferSize += primitive->connectionInfo.associationReqFrameLength; /* u8 primitive->connectionInfo.associationReqFrame */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.associationRspFrameLength */ - bufferSize += primitive->connectionInfo.associationRspFrameLength; /* CsrUint8 primitive->connectionInfo.associationRspFrame */ + bufferSize += primitive->connectionInfo.associationRspFrameLength; /* u8 primitive->connectionInfo.associationRspFrame */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocScanInfoElementsLength */ - bufferSize += primitive->connectionInfo.assocScanInfoElementsLength; /* CsrUint8 primitive->connectionInfo.assocScanInfoElements */ + bufferSize += primitive->connectionInfo.assocScanInfoElementsLength; /* u8 primitive->connectionInfo.assocScanInfoElements */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqCapabilities */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqListenIntervalTu */ - bufferSize += 6; /* CsrUint8 primitive->connectionInfo.assocReqApAddress.a[6] */ + bufferSize += 6; /* u8 primitive->connectionInfo.assocReqApAddress.a[6] */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqInfoElementsLength */ - bufferSize += primitive->connectionInfo.assocReqInfoElementsLength; /* CsrUint8 primitive->connectionInfo.assocReqInfoElements */ + bufferSize += primitive->connectionInfo.assocReqInfoElementsLength; /* u8 primitive->connectionInfo.assocReqInfoElements */ bufferSize += 2; /* CsrWifiSmeIEEE80211Result primitive->connectionInfo.assocRspResult */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspCapabilityInfo */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspAssociationId */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspInfoElementsLength */ - bufferSize += primitive->connectionInfo.assocRspInfoElementsLength; /* CsrUint8 primitive->connectionInfo.assocRspInfoElements */ + bufferSize += primitive->connectionInfo.assocRspInfoElementsLength; /* u8 primitive->connectionInfo.assocRspInfoElements */ return bufferSize; } -CsrUint8* CsrWifiSmeConnectionInfoGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeConnectionInfoGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeConnectionInfoGetCfm *primitive = (CsrWifiSmeConnectionInfoGetCfm *)msg; *len = 0; @@ -2793,18 +2793,18 @@ CsrUint8* CsrWifiSmeConnectionInfoGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *m CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.ssid.ssid, ((CsrUint16) (32))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.ssid.length); + CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ssid.length); CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.bssid.a, ((CsrUint16) (6))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.networkType80211); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.channelNumber); + CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.networkType80211); + CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.channelNumber); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.channelFrequency); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.authMode); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.pairwiseCipher); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.groupCipher); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.ifIndex); + CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ifIndex); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.atimWindowTu); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.beaconPeriodTu); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.reassociation); + CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.reassociation); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.beaconFrameLength); if (primitive->connectionInfo.beaconFrameLength) { @@ -2845,7 +2845,7 @@ CsrUint8* CsrWifiSmeConnectionInfoGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *m } -void* CsrWifiSmeConnectionInfoGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeConnectionInfoGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeConnectionInfoGetCfm *primitive = (CsrWifiSmeConnectionInfoGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionInfoGetCfm)); CsrSize offset; @@ -2855,22 +2855,22 @@ void* CsrWifiSmeConnectionInfoGetCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); CsrMemCpyDes(primitive->connectionInfo.ssid.ssid, buffer, &offset, ((CsrUint16) (32))); - CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.ssid.length, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionInfo.ssid.length, buffer, &offset); CsrMemCpyDes(primitive->connectionInfo.bssid.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.networkType80211, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.channelNumber, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionInfo.networkType80211, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionInfo.channelNumber, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.channelFrequency, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.authMode, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.pairwiseCipher, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.groupCipher, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.ifIndex, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionInfo.ifIndex, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.atimWindowTu, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.beaconPeriodTu, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.reassociation, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionInfo.reassociation, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.beaconFrameLength, buffer, &offset); if (primitive->connectionInfo.beaconFrameLength) { - primitive->connectionInfo.beaconFrame = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.beaconFrameLength); + primitive->connectionInfo.beaconFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.beaconFrameLength); CsrMemCpyDes(primitive->connectionInfo.beaconFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.beaconFrameLength))); } else @@ -2880,7 +2880,7 @@ void* CsrWifiSmeConnectionInfoGetCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.associationReqFrameLength, buffer, &offset); if (primitive->connectionInfo.associationReqFrameLength) { - primitive->connectionInfo.associationReqFrame = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.associationReqFrameLength); + primitive->connectionInfo.associationReqFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.associationReqFrameLength); CsrMemCpyDes(primitive->connectionInfo.associationReqFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.associationReqFrameLength))); } else @@ -2890,7 +2890,7 @@ void* CsrWifiSmeConnectionInfoGetCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.associationRspFrameLength, buffer, &offset); if (primitive->connectionInfo.associationRspFrameLength) { - primitive->connectionInfo.associationRspFrame = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.associationRspFrameLength); + primitive->connectionInfo.associationRspFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.associationRspFrameLength); CsrMemCpyDes(primitive->connectionInfo.associationRspFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.associationRspFrameLength))); } else @@ -2900,7 +2900,7 @@ void* CsrWifiSmeConnectionInfoGetCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocScanInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocScanInfoElementsLength) { - primitive->connectionInfo.assocScanInfoElements = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.assocScanInfoElementsLength); + primitive->connectionInfo.assocScanInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocScanInfoElementsLength); CsrMemCpyDes(primitive->connectionInfo.assocScanInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocScanInfoElementsLength))); } else @@ -2913,7 +2913,7 @@ void* CsrWifiSmeConnectionInfoGetCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocReqInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocReqInfoElementsLength) { - primitive->connectionInfo.assocReqInfoElements = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.assocReqInfoElementsLength); + primitive->connectionInfo.assocReqInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocReqInfoElementsLength); CsrMemCpyDes(primitive->connectionInfo.assocReqInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocReqInfoElementsLength))); } else @@ -2926,7 +2926,7 @@ void* CsrWifiSmeConnectionInfoGetCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocRspInfoElementsLength) { - primitive->connectionInfo.assocRspInfoElements = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.assocRspInfoElementsLength); + primitive->connectionInfo.assocRspInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocRspInfoElementsLength); CsrMemCpyDes(primitive->connectionInfo.assocRspInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocRspInfoElementsLength))); } else @@ -2963,7 +2963,7 @@ CsrSize CsrWifiSmeConnectionQualityIndSizeof(void *msg) } -CsrUint8* CsrWifiSmeConnectionQualityIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeConnectionQualityIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeConnectionQualityInd *primitive = (CsrWifiSmeConnectionQualityInd *)msg; *len = 0; @@ -2975,7 +2975,7 @@ CsrUint8* CsrWifiSmeConnectionQualityIndSer(CsrUint8 *ptr, CsrSize *len, void *m } -void* CsrWifiSmeConnectionQualityIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeConnectionQualityIndDes(u8 *buffer, CsrSize length) { CsrWifiSmeConnectionQualityInd *primitive = (CsrWifiSmeConnectionQualityInd *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionQualityInd)); CsrSize offset; @@ -2997,8 +2997,8 @@ CsrSize CsrWifiSmeConnectionStatsGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 101) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* CsrUint8 primitive->connectionStats.unifiTxDataRate */ - bufferSize += 1; /* CsrUint8 primitive->connectionStats.unifiRxDataRate */ + bufferSize += 1; /* u8 primitive->connectionStats.unifiTxDataRate */ + bufferSize += 1; /* u8 primitive->connectionStats.unifiRxDataRate */ bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11RetryCount */ bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11MultipleRetryCount */ bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11AckFailureCount */ @@ -3026,15 +3026,15 @@ CsrSize CsrWifiSmeConnectionStatsGetCfmSizeof(void *msg) } -CsrUint8* CsrWifiSmeConnectionStatsGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeConnectionStatsGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeConnectionStatsGetCfm *primitive = (CsrWifiSmeConnectionStatsGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionStats.unifiTxDataRate); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionStats.unifiRxDataRate); + CsrUint8Ser(ptr, len, (u8) primitive->connectionStats.unifiTxDataRate); + CsrUint8Ser(ptr, len, (u8) primitive->connectionStats.unifiRxDataRate); CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11RetryCount); CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11MultipleRetryCount); CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11AckFailureCount); @@ -3062,7 +3062,7 @@ CsrUint8* CsrWifiSmeConnectionStatsGetCfmSer(CsrUint8 *ptr, CsrSize *len, void * } -void* CsrWifiSmeConnectionStatsGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeConnectionStatsGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeConnectionStatsGetCfm *primitive = (CsrWifiSmeConnectionStatsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionStatsGetCfm)); CsrSize offset; @@ -3071,8 +3071,8 @@ void* CsrWifiSmeConnectionStatsGetCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->connectionStats.unifiTxDataRate, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->connectionStats.unifiRxDataRate, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionStats.unifiTxDataRate, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionStats.unifiRxDataRate, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11RetryCount, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11MultipleRetryCount, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11AckFailureCount, buffer, &offset); @@ -3112,7 +3112,7 @@ CsrSize CsrWifiSmeDisconnectCfmSizeof(void *msg) } -CsrUint8* CsrWifiSmeDisconnectCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeDisconnectCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeDisconnectCfm *primitive = (CsrWifiSmeDisconnectCfm *)msg; *len = 0; @@ -3123,7 +3123,7 @@ CsrUint8* CsrWifiSmeDisconnectCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeDisconnectCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeDisconnectCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeDisconnectCfm *primitive = (CsrWifiSmeDisconnectCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeDisconnectCfm)); CsrSize offset; @@ -3150,20 +3150,20 @@ CsrSize CsrWifiSmeHostConfigGetCfmSizeof(void *msg) } -CsrUint8* CsrWifiSmeHostConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeHostConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeHostConfigGetCfm *primitive = (CsrWifiSmeHostConfigGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->hostConfig.powerMode); + CsrUint8Ser(ptr, len, (u8) primitive->hostConfig.powerMode); CsrUint16Ser(ptr, len, (CsrUint16) primitive->hostConfig.applicationDataPeriodMs); return(ptr); } -void* CsrWifiSmeHostConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeHostConfigGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeHostConfigGetCfm *primitive = (CsrWifiSmeHostConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeHostConfigGetCfm)); CsrSize offset; @@ -3172,7 +3172,7 @@ void* CsrWifiSmeHostConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->hostConfig.powerMode, buffer, &offset); + CsrUint8Des((u8 *) &primitive->hostConfig.powerMode, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->hostConfig.applicationDataPeriodMs, buffer, &offset); return primitive; @@ -3190,7 +3190,7 @@ CsrSize CsrWifiSmeHostConfigSetCfmSizeof(void *msg) } -CsrUint8* CsrWifiSmeHostConfigSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeHostConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeHostConfigSetCfm *primitive = (CsrWifiSmeHostConfigSetCfm *)msg; *len = 0; @@ -3201,7 +3201,7 @@ CsrUint8* CsrWifiSmeHostConfigSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeHostConfigSetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeHostConfigSetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeHostConfigSetCfm *primitive = (CsrWifiSmeHostConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeHostConfigSetCfm)); CsrSize offset; @@ -3220,24 +3220,24 @@ CsrSize CsrWifiSmeIbssStationIndSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ - bufferSize += 6; /* CsrUint8 primitive->address.a[6] */ + bufferSize += 6; /* u8 primitive->address.a[6] */ bufferSize += 1; /* CsrBool primitive->isconnected */ return bufferSize; } -CsrUint8* CsrWifiSmeIbssStationIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeIbssStationIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeIbssStationInd *primitive = (CsrWifiSmeIbssStationInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((CsrUint16) (6))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->isconnected); + CsrUint8Ser(ptr, len, (u8) primitive->isconnected); return(ptr); } -void* CsrWifiSmeIbssStationIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeIbssStationIndDes(u8 *buffer, CsrSize length) { CsrWifiSmeIbssStationInd *primitive = (CsrWifiSmeIbssStationInd *) CsrPmemAlloc(sizeof(CsrWifiSmeIbssStationInd)); CsrSize offset; @@ -3245,7 +3245,7 @@ void* CsrWifiSmeIbssStationIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrMemCpyDes(primitive->address.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint8Des((CsrUint8 *) &primitive->isconnected, buffer, &offset); + CsrUint8Des((u8 *) &primitive->isconnected, buffer, &offset); return primitive; } @@ -3260,26 +3260,26 @@ CsrSize CsrWifiSmeKeyCfmSizeof(void *msg) bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ bufferSize += 1; /* CsrWifiSmeKeyType primitive->keyType */ - bufferSize += 6; /* CsrUint8 primitive->peerMacAddress.a[6] */ + bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ return bufferSize; } -CsrUint8* CsrWifiSmeKeyCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeKeyCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeKeyCfm *primitive = (CsrWifiSmeKeyCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->action); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->keyType); + CsrUint8Ser(ptr, len, (u8) primitive->action); + CsrUint8Ser(ptr, len, (u8) primitive->keyType); CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); return(ptr); } -void* CsrWifiSmeKeyCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeKeyCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeKeyCfm *primitive = (CsrWifiSmeKeyCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeKeyCfm)); CsrSize offset; @@ -3288,8 +3288,8 @@ void* CsrWifiSmeKeyCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->action, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->keyType, buffer, &offset); + CsrUint8Des((u8 *) &primitive->action, buffer, &offset); + CsrUint8Des((u8 *) &primitive->keyType, buffer, &offset); CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); return primitive; @@ -3309,7 +3309,7 @@ CsrSize CsrWifiSmeLinkQualityGetCfmSizeof(void *msg) } -CsrUint8* CsrWifiSmeLinkQualityGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeLinkQualityGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeLinkQualityGetCfm *primitive = (CsrWifiSmeLinkQualityGetCfm *)msg; *len = 0; @@ -3322,7 +3322,7 @@ CsrUint8* CsrWifiSmeLinkQualityGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeLinkQualityGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeLinkQualityGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeLinkQualityGetCfm *primitive = (CsrWifiSmeLinkQualityGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeLinkQualityGetCfm)); CsrSize offset; @@ -3346,11 +3346,11 @@ CsrSize CsrWifiSmeMediaStatusIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 99) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiSmeMediaStatus primitive->mediaStatus */ - bufferSize += 32; /* CsrUint8 primitive->connectionInfo.ssid.ssid[32] */ - bufferSize += 1; /* CsrUint8 primitive->connectionInfo.ssid.length */ - bufferSize += 6; /* CsrUint8 primitive->connectionInfo.bssid.a[6] */ + bufferSize += 32; /* u8 primitive->connectionInfo.ssid.ssid[32] */ + bufferSize += 1; /* u8 primitive->connectionInfo.ssid.length */ + bufferSize += 6; /* u8 primitive->connectionInfo.bssid.a[6] */ bufferSize += 1; /* CsrWifiSme80211NetworkType primitive->connectionInfo.networkType80211 */ - bufferSize += 1; /* CsrUint8 primitive->connectionInfo.channelNumber */ + bufferSize += 1; /* u8 primitive->connectionInfo.channelNumber */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.channelFrequency */ bufferSize += 2; /* CsrWifiSmeAuthMode primitive->connectionInfo.authMode */ bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.pairwiseCipher */ @@ -3360,49 +3360,49 @@ CsrSize CsrWifiSmeMediaStatusIndSizeof(void *msg) bufferSize += 2; /* CsrUint16 primitive->connectionInfo.beaconPeriodTu */ bufferSize += 1; /* CsrBool primitive->connectionInfo.reassociation */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.beaconFrameLength */ - bufferSize += primitive->connectionInfo.beaconFrameLength; /* CsrUint8 primitive->connectionInfo.beaconFrame */ + bufferSize += primitive->connectionInfo.beaconFrameLength; /* u8 primitive->connectionInfo.beaconFrame */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.associationReqFrameLength */ - bufferSize += primitive->connectionInfo.associationReqFrameLength; /* CsrUint8 primitive->connectionInfo.associationReqFrame */ + bufferSize += primitive->connectionInfo.associationReqFrameLength; /* u8 primitive->connectionInfo.associationReqFrame */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.associationRspFrameLength */ - bufferSize += primitive->connectionInfo.associationRspFrameLength; /* CsrUint8 primitive->connectionInfo.associationRspFrame */ + bufferSize += primitive->connectionInfo.associationRspFrameLength; /* u8 primitive->connectionInfo.associationRspFrame */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocScanInfoElementsLength */ - bufferSize += primitive->connectionInfo.assocScanInfoElementsLength; /* CsrUint8 primitive->connectionInfo.assocScanInfoElements */ + bufferSize += primitive->connectionInfo.assocScanInfoElementsLength; /* u8 primitive->connectionInfo.assocScanInfoElements */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqCapabilities */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqListenIntervalTu */ - bufferSize += 6; /* CsrUint8 primitive->connectionInfo.assocReqApAddress.a[6] */ + bufferSize += 6; /* u8 primitive->connectionInfo.assocReqApAddress.a[6] */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqInfoElementsLength */ - bufferSize += primitive->connectionInfo.assocReqInfoElementsLength; /* CsrUint8 primitive->connectionInfo.assocReqInfoElements */ + bufferSize += primitive->connectionInfo.assocReqInfoElementsLength; /* u8 primitive->connectionInfo.assocReqInfoElements */ bufferSize += 2; /* CsrWifiSmeIEEE80211Result primitive->connectionInfo.assocRspResult */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspCapabilityInfo */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspAssociationId */ bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspInfoElementsLength */ - bufferSize += primitive->connectionInfo.assocRspInfoElementsLength; /* CsrUint8 primitive->connectionInfo.assocRspInfoElements */ + bufferSize += primitive->connectionInfo.assocRspInfoElementsLength; /* u8 primitive->connectionInfo.assocRspInfoElements */ bufferSize += 2; /* CsrWifiSmeIEEE80211Reason primitive->disassocReason */ bufferSize += 2; /* CsrWifiSmeIEEE80211Reason primitive->deauthReason */ return bufferSize; } -CsrUint8* CsrWifiSmeMediaStatusIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeMediaStatusIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeMediaStatusInd *primitive = (CsrWifiSmeMediaStatusInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->mediaStatus); + CsrUint8Ser(ptr, len, (u8) primitive->mediaStatus); CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.ssid.ssid, ((CsrUint16) (32))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.ssid.length); + CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ssid.length); CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.bssid.a, ((CsrUint16) (6))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.networkType80211); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.channelNumber); + CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.networkType80211); + CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.channelNumber); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.channelFrequency); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.authMode); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.pairwiseCipher); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.groupCipher); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.ifIndex); + CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ifIndex); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.atimWindowTu); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.beaconPeriodTu); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->connectionInfo.reassociation); + CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.reassociation); CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.beaconFrameLength); if (primitive->connectionInfo.beaconFrameLength) { @@ -3445,7 +3445,7 @@ CsrUint8* CsrWifiSmeMediaStatusIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeMediaStatusIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeMediaStatusIndDes(u8 *buffer, CsrSize length) { CsrWifiSmeMediaStatusInd *primitive = (CsrWifiSmeMediaStatusInd *) CsrPmemAlloc(sizeof(CsrWifiSmeMediaStatusInd)); CsrSize offset; @@ -3453,24 +3453,24 @@ void* CsrWifiSmeMediaStatusIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->mediaStatus, buffer, &offset); + CsrUint8Des((u8 *) &primitive->mediaStatus, buffer, &offset); CsrMemCpyDes(primitive->connectionInfo.ssid.ssid, buffer, &offset, ((CsrUint16) (32))); - CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.ssid.length, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionInfo.ssid.length, buffer, &offset); CsrMemCpyDes(primitive->connectionInfo.bssid.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.networkType80211, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.channelNumber, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionInfo.networkType80211, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionInfo.channelNumber, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.channelFrequency, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.authMode, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.pairwiseCipher, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.groupCipher, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.ifIndex, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionInfo.ifIndex, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.atimWindowTu, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.beaconPeriodTu, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->connectionInfo.reassociation, buffer, &offset); + CsrUint8Des((u8 *) &primitive->connectionInfo.reassociation, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.beaconFrameLength, buffer, &offset); if (primitive->connectionInfo.beaconFrameLength) { - primitive->connectionInfo.beaconFrame = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.beaconFrameLength); + primitive->connectionInfo.beaconFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.beaconFrameLength); CsrMemCpyDes(primitive->connectionInfo.beaconFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.beaconFrameLength))); } else @@ -3480,7 +3480,7 @@ void* CsrWifiSmeMediaStatusIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.associationReqFrameLength, buffer, &offset); if (primitive->connectionInfo.associationReqFrameLength) { - primitive->connectionInfo.associationReqFrame = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.associationReqFrameLength); + primitive->connectionInfo.associationReqFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.associationReqFrameLength); CsrMemCpyDes(primitive->connectionInfo.associationReqFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.associationReqFrameLength))); } else @@ -3490,7 +3490,7 @@ void* CsrWifiSmeMediaStatusIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.associationRspFrameLength, buffer, &offset); if (primitive->connectionInfo.associationRspFrameLength) { - primitive->connectionInfo.associationRspFrame = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.associationRspFrameLength); + primitive->connectionInfo.associationRspFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.associationRspFrameLength); CsrMemCpyDes(primitive->connectionInfo.associationRspFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.associationRspFrameLength))); } else @@ -3500,7 +3500,7 @@ void* CsrWifiSmeMediaStatusIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocScanInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocScanInfoElementsLength) { - primitive->connectionInfo.assocScanInfoElements = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.assocScanInfoElementsLength); + primitive->connectionInfo.assocScanInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocScanInfoElementsLength); CsrMemCpyDes(primitive->connectionInfo.assocScanInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocScanInfoElementsLength))); } else @@ -3513,7 +3513,7 @@ void* CsrWifiSmeMediaStatusIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocReqInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocReqInfoElementsLength) { - primitive->connectionInfo.assocReqInfoElements = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.assocReqInfoElementsLength); + primitive->connectionInfo.assocReqInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocReqInfoElementsLength); CsrMemCpyDes(primitive->connectionInfo.assocReqInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocReqInfoElementsLength))); } else @@ -3526,7 +3526,7 @@ void* CsrWifiSmeMediaStatusIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocRspInfoElementsLength) { - primitive->connectionInfo.assocRspInfoElements = (CsrUint8 *)CsrPmemAlloc(primitive->connectionInfo.assocRspInfoElementsLength); + primitive->connectionInfo.assocRspInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocRspInfoElementsLength); CsrMemCpyDes(primitive->connectionInfo.assocRspInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocRspInfoElementsLength))); } else @@ -3560,7 +3560,7 @@ CsrSize CsrWifiSmeMibConfigGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* CsrBool primitive->mibConfig.unifiFixMaxTxDataRate */ - bufferSize += 1; /* CsrUint8 primitive->mibConfig.unifiFixTxDataRate */ + bufferSize += 1; /* u8 primitive->mibConfig.unifiFixTxDataRate */ bufferSize += 2; /* CsrUint16 primitive->mibConfig.dot11RtsThreshold */ bufferSize += 2; /* CsrUint16 primitive->mibConfig.dot11FragmentationThreshold */ bufferSize += 2; /* CsrUint16 primitive->mibConfig.dot11CurrentTxPowerLevel */ @@ -3568,14 +3568,14 @@ CsrSize CsrWifiSmeMibConfigGetCfmSizeof(void *msg) } -CsrUint8* CsrWifiSmeMibConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeMibConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeMibConfigGetCfm *primitive = (CsrWifiSmeMibConfigGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->mibConfig.unifiFixMaxTxDataRate); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->mibConfig.unifiFixTxDataRate); + CsrUint8Ser(ptr, len, (u8) primitive->mibConfig.unifiFixMaxTxDataRate); + CsrUint8Ser(ptr, len, (u8) primitive->mibConfig.unifiFixTxDataRate); CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibConfig.dot11RtsThreshold); CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibConfig.dot11FragmentationThreshold); CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibConfig.dot11CurrentTxPowerLevel); @@ -3583,7 +3583,7 @@ CsrUint8* CsrWifiSmeMibConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeMibConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeMibConfigGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeMibConfigGetCfm *primitive = (CsrWifiSmeMibConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMibConfigGetCfm)); CsrSize offset; @@ -3591,8 +3591,8 @@ void* CsrWifiSmeMibConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->mibConfig.unifiFixMaxTxDataRate, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->mibConfig.unifiFixTxDataRate, buffer, &offset); + CsrUint8Des((u8 *) &primitive->mibConfig.unifiFixMaxTxDataRate, buffer, &offset); + CsrUint8Des((u8 *) &primitive->mibConfig.unifiFixTxDataRate, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->mibConfig.dot11RtsThreshold, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->mibConfig.dot11FragmentationThreshold, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->mibConfig.dot11CurrentTxPowerLevel, buffer, &offset); @@ -3609,12 +3609,12 @@ CsrSize CsrWifiSmeMibGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 2; /* CsrUint16 primitive->mibAttributeLength */ - bufferSize += primitive->mibAttributeLength; /* CsrUint8 primitive->mibAttribute */ + bufferSize += primitive->mibAttributeLength; /* u8 primitive->mibAttribute */ return bufferSize; } -CsrUint8* CsrWifiSmeMibGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeMibGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeMibGetCfm *primitive = (CsrWifiSmeMibGetCfm *)msg; *len = 0; @@ -3629,7 +3629,7 @@ CsrUint8* CsrWifiSmeMibGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeMibGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeMibGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeMibGetCfm *primitive = (CsrWifiSmeMibGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetCfm)); CsrSize offset; @@ -3640,7 +3640,7 @@ void* CsrWifiSmeMibGetCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->mibAttributeLength, buffer, &offset); if (primitive->mibAttributeLength) { - primitive->mibAttribute = (CsrUint8 *)CsrPmemAlloc(primitive->mibAttributeLength); + primitive->mibAttribute = (u8 *)CsrPmemAlloc(primitive->mibAttributeLength); CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((CsrUint16) (primitive->mibAttributeLength))); } else @@ -3668,12 +3668,12 @@ CsrSize CsrWifiSmeMibGetNextCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 2; /* CsrUint16 primitive->mibAttributeLength */ - bufferSize += primitive->mibAttributeLength; /* CsrUint8 primitive->mibAttribute */ + bufferSize += primitive->mibAttributeLength; /* u8 primitive->mibAttribute */ return bufferSize; } -CsrUint8* CsrWifiSmeMibGetNextCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeMibGetNextCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeMibGetNextCfm *primitive = (CsrWifiSmeMibGetNextCfm *)msg; *len = 0; @@ -3688,7 +3688,7 @@ CsrUint8* CsrWifiSmeMibGetNextCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeMibGetNextCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeMibGetNextCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeMibGetNextCfm *primitive = (CsrWifiSmeMibGetNextCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetNextCfm)); CsrSize offset; @@ -3699,7 +3699,7 @@ void* CsrWifiSmeMibGetNextCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->mibAttributeLength, buffer, &offset); if (primitive->mibAttributeLength) { - primitive->mibAttribute = (CsrUint8 *)CsrPmemAlloc(primitive->mibAttributeLength); + primitive->mibAttribute = (u8 *)CsrPmemAlloc(primitive->mibAttributeLength); CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((CsrUint16) (primitive->mibAttributeLength))); } else @@ -3727,27 +3727,27 @@ CsrSize CsrWifiSmeMicFailureIndSizeof(void *msg) bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 1; /* CsrBool primitive->secondFailure */ bufferSize += 2; /* CsrUint16 primitive->count */ - bufferSize += 6; /* CsrUint8 primitive->address.a[6] */ + bufferSize += 6; /* u8 primitive->address.a[6] */ bufferSize += 1; /* CsrWifiSmeKeyType primitive->keyType */ return bufferSize; } -CsrUint8* CsrWifiSmeMicFailureIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeMicFailureIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeMicFailureInd *primitive = (CsrWifiSmeMicFailureInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->secondFailure); + CsrUint8Ser(ptr, len, (u8) primitive->secondFailure); CsrUint16Ser(ptr, len, (CsrUint16) primitive->count); CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((CsrUint16) (6))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->keyType); + CsrUint8Ser(ptr, len, (u8) primitive->keyType); return(ptr); } -void* CsrWifiSmeMicFailureIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeMicFailureIndDes(u8 *buffer, CsrSize length) { CsrWifiSmeMicFailureInd *primitive = (CsrWifiSmeMicFailureInd *) CsrPmemAlloc(sizeof(CsrWifiSmeMicFailureInd)); CsrSize offset; @@ -3755,10 +3755,10 @@ void* CsrWifiSmeMicFailureIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->secondFailure, buffer, &offset); + CsrUint8Des((u8 *) &primitive->secondFailure, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->count, buffer, &offset); CsrMemCpyDes(primitive->address.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint8Des((CsrUint8 *) &primitive->keyType, buffer, &offset); + CsrUint8Des((u8 *) &primitive->keyType, buffer, &offset); return primitive; } @@ -3773,27 +3773,27 @@ CsrSize CsrWifiSmeMulticastAddressCfmSizeof(void *msg) bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ - bufferSize += 1; /* CsrUint8 primitive->getAddressesCount */ + bufferSize += 1; /* u8 primitive->getAddressesCount */ { CsrUint16 i1; for (i1 = 0; i1 < primitive->getAddressesCount; i1++) { - bufferSize += 6; /* CsrUint8 primitive->getAddresses[i1].a[6] */ + bufferSize += 6; /* u8 primitive->getAddresses[i1].a[6] */ } } return bufferSize; } -CsrUint8* CsrWifiSmeMulticastAddressCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeMulticastAddressCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeMulticastAddressCfm *primitive = (CsrWifiSmeMulticastAddressCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->action); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->getAddressesCount); + CsrUint8Ser(ptr, len, (u8) primitive->action); + CsrUint8Ser(ptr, len, (u8) primitive->getAddressesCount); { CsrUint16 i1; for (i1 = 0; i1 < primitive->getAddressesCount; i1++) @@ -3805,7 +3805,7 @@ CsrUint8* CsrWifiSmeMulticastAddressCfmSer(CsrUint8 *ptr, CsrSize *len, void *ms } -void* CsrWifiSmeMulticastAddressCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeMulticastAddressCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeMulticastAddressCfm *primitive = (CsrWifiSmeMulticastAddressCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMulticastAddressCfm)); CsrSize offset; @@ -3814,8 +3814,8 @@ void* CsrWifiSmeMulticastAddressCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->action, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->getAddressesCount, buffer, &offset); + CsrUint8Des((u8 *) &primitive->action, buffer, &offset); + CsrUint8Des((u8 *) &primitive->getAddressesCount, buffer, &offset); primitive->getAddresses = NULL; if (primitive->getAddressesCount) { @@ -3852,7 +3852,7 @@ CsrSize CsrWifiSmePacketFilterSetCfmSizeof(void *msg) } -CsrUint8* CsrWifiSmePacketFilterSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmePacketFilterSetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmePacketFilterSetCfm *primitive = (CsrWifiSmePacketFilterSetCfm *)msg; *len = 0; @@ -3863,7 +3863,7 @@ CsrUint8* CsrWifiSmePacketFilterSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg } -void* CsrWifiSmePacketFilterSetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmePacketFilterSetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmePacketFilterSetCfm *primitive = (CsrWifiSmePacketFilterSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePacketFilterSetCfm)); CsrSize offset; @@ -3883,12 +3883,12 @@ CsrSize CsrWifiSmePermanentMacAddressGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 6; /* CsrUint8 primitive->permanentMacAddress.a[6] */ + bufferSize += 6; /* u8 primitive->permanentMacAddress.a[6] */ return bufferSize; } -CsrUint8* CsrWifiSmePermanentMacAddressGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmePermanentMacAddressGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmePermanentMacAddressGetCfm *primitive = (CsrWifiSmePermanentMacAddressGetCfm *)msg; *len = 0; @@ -3899,7 +3899,7 @@ CsrUint8* CsrWifiSmePermanentMacAddressGetCfmSer(CsrUint8 *ptr, CsrSize *len, vo } -void* CsrWifiSmePermanentMacAddressGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmePermanentMacAddressGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmePermanentMacAddressGetCfm *primitive = (CsrWifiSmePermanentMacAddressGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePermanentMacAddressGetCfm)); CsrSize offset; @@ -3920,12 +3920,12 @@ CsrSize CsrWifiSmePmkidCandidateListIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ - bufferSize += 1; /* CsrUint8 primitive->pmkidCandidatesCount */ + bufferSize += 1; /* u8 primitive->pmkidCandidatesCount */ { CsrUint16 i1; for (i1 = 0; i1 < primitive->pmkidCandidatesCount; i1++) { - bufferSize += 6; /* CsrUint8 primitive->pmkidCandidates[i1].bssid.a[6] */ + bufferSize += 6; /* u8 primitive->pmkidCandidates[i1].bssid.a[6] */ bufferSize += 1; /* CsrBool primitive->pmkidCandidates[i1].preAuthAllowed */ } } @@ -3933,26 +3933,26 @@ CsrSize CsrWifiSmePmkidCandidateListIndSizeof(void *msg) } -CsrUint8* CsrWifiSmePmkidCandidateListIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmePmkidCandidateListIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmePmkidCandidateListInd *primitive = (CsrWifiSmePmkidCandidateListInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->pmkidCandidatesCount); + CsrUint8Ser(ptr, len, (u8) primitive->pmkidCandidatesCount); { CsrUint16 i1; for (i1 = 0; i1 < primitive->pmkidCandidatesCount; i1++) { CsrMemCpySer(ptr, len, (const void *) primitive->pmkidCandidates[i1].bssid.a, ((CsrUint16) (6))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->pmkidCandidates[i1].preAuthAllowed); + CsrUint8Ser(ptr, len, (u8) primitive->pmkidCandidates[i1].preAuthAllowed); } } return(ptr); } -void* CsrWifiSmePmkidCandidateListIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmePmkidCandidateListIndDes(u8 *buffer, CsrSize length) { CsrWifiSmePmkidCandidateListInd *primitive = (CsrWifiSmePmkidCandidateListInd *) CsrPmemAlloc(sizeof(CsrWifiSmePmkidCandidateListInd)); CsrSize offset; @@ -3960,7 +3960,7 @@ void* CsrWifiSmePmkidCandidateListIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->pmkidCandidatesCount, buffer, &offset); + CsrUint8Des((u8 *) &primitive->pmkidCandidatesCount, buffer, &offset); primitive->pmkidCandidates = NULL; if (primitive->pmkidCandidatesCount) { @@ -3971,7 +3971,7 @@ void* CsrWifiSmePmkidCandidateListIndDes(CsrUint8 *buffer, CsrSize length) for (i1 = 0; i1 < primitive->pmkidCandidatesCount; i1++) { CsrMemCpyDes(primitive->pmkidCandidates[i1].bssid.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint8Des((CsrUint8 *) &primitive->pmkidCandidates[i1].preAuthAllowed, buffer, &offset); + CsrUint8Des((u8 *) &primitive->pmkidCandidates[i1].preAuthAllowed, buffer, &offset); } } @@ -3996,28 +3996,28 @@ CsrSize CsrWifiSmePmkidCfmSizeof(void *msg) bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ - bufferSize += 1; /* CsrUint8 primitive->getPmkidsCount */ + bufferSize += 1; /* u8 primitive->getPmkidsCount */ { CsrUint16 i1; for (i1 = 0; i1 < primitive->getPmkidsCount; i1++) { - bufferSize += 6; /* CsrUint8 primitive->getPmkids[i1].bssid.a[6] */ - bufferSize += 16; /* CsrUint8 primitive->getPmkids[i1].pmkid[16] */ + bufferSize += 6; /* u8 primitive->getPmkids[i1].bssid.a[6] */ + bufferSize += 16; /* u8 primitive->getPmkids[i1].pmkid[16] */ } } return bufferSize; } -CsrUint8* CsrWifiSmePmkidCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmePmkidCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmePmkidCfm *primitive = (CsrWifiSmePmkidCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->action); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->getPmkidsCount); + CsrUint8Ser(ptr, len, (u8) primitive->action); + CsrUint8Ser(ptr, len, (u8) primitive->getPmkidsCount); { CsrUint16 i1; for (i1 = 0; i1 < primitive->getPmkidsCount; i1++) @@ -4030,7 +4030,7 @@ CsrUint8* CsrWifiSmePmkidCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmePmkidCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmePmkidCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmePmkidCfm *primitive = (CsrWifiSmePmkidCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePmkidCfm)); CsrSize offset; @@ -4039,8 +4039,8 @@ void* CsrWifiSmePmkidCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->action, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->getPmkidsCount, buffer, &offset); + CsrUint8Des((u8 *) &primitive->action, buffer, &offset); + CsrUint8Des((u8 *) &primitive->getPmkidsCount, buffer, &offset); primitive->getPmkids = NULL; if (primitive->getPmkidsCount) { @@ -4077,31 +4077,31 @@ CsrSize CsrWifiSmePowerConfigGetCfmSizeof(void *msg) bufferSize += 2; /* CsrUint16 primitive->powerConfig.listenIntervalTu */ bufferSize += 1; /* CsrBool primitive->powerConfig.rxDtims */ bufferSize += 1; /* CsrWifiSmeD3AutoScanMode primitive->powerConfig.d3AutoScanMode */ - bufferSize += 1; /* CsrUint8 primitive->powerConfig.clientTrafficWindow */ + bufferSize += 1; /* u8 primitive->powerConfig.clientTrafficWindow */ bufferSize += 1; /* CsrBool primitive->powerConfig.opportunisticPowerSave */ bufferSize += 1; /* CsrBool primitive->powerConfig.noticeOfAbsence */ return bufferSize; } -CsrUint8* CsrWifiSmePowerConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmePowerConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmePowerConfigGetCfm *primitive = (CsrWifiSmePowerConfigGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.powerSaveLevel); + CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.powerSaveLevel); CsrUint16Ser(ptr, len, (CsrUint16) primitive->powerConfig.listenIntervalTu); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.rxDtims); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.d3AutoScanMode); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.clientTrafficWindow); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.opportunisticPowerSave); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->powerConfig.noticeOfAbsence); + CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.rxDtims); + CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.d3AutoScanMode); + CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.clientTrafficWindow); + CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.opportunisticPowerSave); + CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.noticeOfAbsence); return(ptr); } -void* CsrWifiSmePowerConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmePowerConfigGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmePowerConfigGetCfm *primitive = (CsrWifiSmePowerConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePowerConfigGetCfm)); CsrSize offset; @@ -4109,13 +4109,13 @@ void* CsrWifiSmePowerConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->powerConfig.powerSaveLevel, buffer, &offset); + CsrUint8Des((u8 *) &primitive->powerConfig.powerSaveLevel, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->powerConfig.listenIntervalTu, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->powerConfig.rxDtims, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->powerConfig.d3AutoScanMode, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->powerConfig.clientTrafficWindow, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->powerConfig.opportunisticPowerSave, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->powerConfig.noticeOfAbsence, buffer, &offset); + CsrUint8Des((u8 *) &primitive->powerConfig.rxDtims, buffer, &offset); + CsrUint8Des((u8 *) &primitive->powerConfig.d3AutoScanMode, buffer, &offset); + CsrUint8Des((u8 *) &primitive->powerConfig.clientTrafficWindow, buffer, &offset); + CsrUint8Des((u8 *) &primitive->powerConfig.opportunisticPowerSave, buffer, &offset); + CsrUint8Des((u8 *) &primitive->powerConfig.noticeOfAbsence, buffer, &offset); return primitive; } @@ -4130,26 +4130,26 @@ CsrSize CsrWifiSmeRegulatoryDomainInfoGetCfmSizeof(void *msg) bufferSize += 1; /* CsrBool primitive->regDomInfo.dot11MultiDomainCapabilityImplemented */ bufferSize += 1; /* CsrBool primitive->regDomInfo.dot11MultiDomainCapabilityEnabled */ bufferSize += 1; /* CsrWifiSmeRegulatoryDomain primitive->regDomInfo.currentRegulatoryDomain */ - bufferSize += 2; /* CsrUint8 primitive->regDomInfo.currentCountryCode[2] */ + bufferSize += 2; /* u8 primitive->regDomInfo.currentCountryCode[2] */ return bufferSize; } -CsrUint8* CsrWifiSmeRegulatoryDomainInfoGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeRegulatoryDomainInfoGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeRegulatoryDomainInfoGetCfm *primitive = (CsrWifiSmeRegulatoryDomainInfoGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->regDomInfo.dot11MultiDomainCapabilityImplemented); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->regDomInfo.dot11MultiDomainCapabilityEnabled); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->regDomInfo.currentRegulatoryDomain); + CsrUint8Ser(ptr, len, (u8) primitive->regDomInfo.dot11MultiDomainCapabilityImplemented); + CsrUint8Ser(ptr, len, (u8) primitive->regDomInfo.dot11MultiDomainCapabilityEnabled); + CsrUint8Ser(ptr, len, (u8) primitive->regDomInfo.currentRegulatoryDomain); CsrMemCpySer(ptr, len, (const void *) primitive->regDomInfo.currentCountryCode, ((CsrUint16) (2))); return(ptr); } -void* CsrWifiSmeRegulatoryDomainInfoGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeRegulatoryDomainInfoGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeRegulatoryDomainInfoGetCfm *primitive = (CsrWifiSmeRegulatoryDomainInfoGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeRegulatoryDomainInfoGetCfm)); CsrSize offset; @@ -4157,9 +4157,9 @@ void* CsrWifiSmeRegulatoryDomainInfoGetCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->regDomInfo.dot11MultiDomainCapabilityImplemented, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->regDomInfo.dot11MultiDomainCapabilityEnabled, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->regDomInfo.currentRegulatoryDomain, buffer, &offset); + CsrUint8Des((u8 *) &primitive->regDomInfo.dot11MultiDomainCapabilityImplemented, buffer, &offset); + CsrUint8Des((u8 *) &primitive->regDomInfo.dot11MultiDomainCapabilityEnabled, buffer, &offset); + CsrUint8Des((u8 *) &primitive->regDomInfo.currentRegulatoryDomain, buffer, &offset); CsrMemCpyDes(primitive->regDomInfo.currentCountryCode, buffer, &offset, ((CsrUint16) (2))); return primitive; @@ -4177,7 +4177,7 @@ CsrSize CsrWifiSmeRoamCompleteIndSizeof(void *msg) } -CsrUint8* CsrWifiSmeRoamCompleteIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeRoamCompleteIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeRoamCompleteInd *primitive = (CsrWifiSmeRoamCompleteInd *)msg; *len = 0; @@ -4188,7 +4188,7 @@ CsrUint8* CsrWifiSmeRoamCompleteIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeRoamCompleteIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeRoamCompleteIndDes(u8 *buffer, CsrSize length) { CsrWifiSmeRoamCompleteInd *primitive = (CsrWifiSmeRoamCompleteInd *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamCompleteInd)); CsrSize offset; @@ -4214,19 +4214,19 @@ CsrSize CsrWifiSmeRoamStartIndSizeof(void *msg) } -CsrUint8* CsrWifiSmeRoamStartIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeRoamStartIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeRoamStartInd *primitive = (CsrWifiSmeRoamStartInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->roamReason); + CsrUint8Ser(ptr, len, (u8) primitive->roamReason); CsrUint16Ser(ptr, len, (CsrUint16) primitive->reason80211); return(ptr); } -void* CsrWifiSmeRoamStartIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeRoamStartIndDes(u8 *buffer, CsrSize length) { CsrWifiSmeRoamStartInd *primitive = (CsrWifiSmeRoamStartInd *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamStartInd)); CsrSize offset; @@ -4234,7 +4234,7 @@ void* CsrWifiSmeRoamStartIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->roamReason, buffer, &offset); + CsrUint8Des((u8 *) &primitive->roamReason, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->reason80211, buffer, &offset); return primitive; @@ -4260,7 +4260,7 @@ CsrSize CsrWifiSmeRoamingConfigGetCfmSizeof(void *msg) } bufferSize += 1; /* CsrBool primitive->roamingConfig.disableSmoothRoaming */ bufferSize += 1; /* CsrBool primitive->roamingConfig.disableRoamScans */ - bufferSize += 1; /* CsrUint8 primitive->roamingConfig.reconnectLimit */ + bufferSize += 1; /* u8 primitive->roamingConfig.reconnectLimit */ bufferSize += 2; /* CsrUint16 primitive->roamingConfig.reconnectLimitIntervalMs */ { CsrUint16 i2; @@ -4278,7 +4278,7 @@ CsrSize CsrWifiSmeRoamingConfigGetCfmSizeof(void *msg) } -CsrUint8* CsrWifiSmeRoamingConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeRoamingConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeRoamingConfigGetCfm *primitive = (CsrWifiSmeRoamingConfigGetCfm *)msg; *len = 0; @@ -4295,9 +4295,9 @@ CsrUint8* CsrWifiSmeRoamingConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *ms CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamingBands[i2].snrLowThreshold); } } - CsrUint8Ser(ptr, len, (CsrUint8) primitive->roamingConfig.disableSmoothRoaming); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->roamingConfig.disableRoamScans); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->roamingConfig.reconnectLimit); + CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.disableSmoothRoaming); + CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.disableRoamScans); + CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.reconnectLimit); CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.reconnectLimitIntervalMs); { CsrUint16 i2; @@ -4315,7 +4315,7 @@ CsrUint8* CsrWifiSmeRoamingConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *ms } -void* CsrWifiSmeRoamingConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeRoamingConfigGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeRoamingConfigGetCfm *primitive = (CsrWifiSmeRoamingConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamingConfigGetCfm)); CsrSize offset; @@ -4334,9 +4334,9 @@ void* CsrWifiSmeRoamingConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamingBands[i2].snrLowThreshold, buffer, &offset); } } - CsrUint8Des((CsrUint8 *) &primitive->roamingConfig.disableSmoothRoaming, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->roamingConfig.disableRoamScans, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->roamingConfig.reconnectLimit, buffer, &offset); + CsrUint8Des((u8 *) &primitive->roamingConfig.disableSmoothRoaming, buffer, &offset); + CsrUint8Des((u8 *) &primitive->roamingConfig.disableRoamScans, buffer, &offset); + CsrUint8Des((u8 *) &primitive->roamingConfig.reconnectLimit, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.reconnectLimitIntervalMs, buffer, &offset); { CsrUint16 i2; @@ -4366,7 +4366,7 @@ CsrSize CsrWifiSmeRoamingConfigSetCfmSizeof(void *msg) } -CsrUint8* CsrWifiSmeRoamingConfigSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeRoamingConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeRoamingConfigSetCfm *primitive = (CsrWifiSmeRoamingConfigSetCfm *)msg; *len = 0; @@ -4377,7 +4377,7 @@ CsrUint8* CsrWifiSmeRoamingConfigSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *ms } -void* CsrWifiSmeRoamingConfigSetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeRoamingConfigSetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeRoamingConfigSetCfm *primitive = (CsrWifiSmeRoamingConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamingConfigSetCfm)); CsrSize offset; @@ -4419,12 +4419,12 @@ CsrSize CsrWifiSmeScanConfigGetCfmSizeof(void *msg) bufferSize += 1; /* CsrInt8 primitive->scanConfig.lowSnrThreshold */ bufferSize += 1; /* CsrInt8 primitive->scanConfig.deltaSnrThreshold */ bufferSize += 2; /* CsrUint16 primitive->scanConfig.passiveChannelListCount */ - bufferSize += primitive->scanConfig.passiveChannelListCount; /* CsrUint8 primitive->scanConfig.passiveChannelList */ + bufferSize += primitive->scanConfig.passiveChannelListCount; /* u8 primitive->scanConfig.passiveChannelList */ return bufferSize; } -CsrUint8* CsrWifiSmeScanConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeScanConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeScanConfigGetCfm *primitive = (CsrWifiSmeScanConfigGetCfm *)msg; *len = 0; @@ -4442,14 +4442,14 @@ CsrUint8* CsrWifiSmeScanConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu); } } - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.disableAutonomousScans); + CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.disableAutonomousScans); CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.maxResults); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.highRssiThreshold); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.lowRssiThreshold); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.deltaRssiThreshold); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.highSnrThreshold); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.lowSnrThreshold); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanConfig.deltaSnrThreshold); + CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.highRssiThreshold); + CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.lowRssiThreshold); + CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.deltaRssiThreshold); + CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.highSnrThreshold); + CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.lowSnrThreshold); + CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.deltaSnrThreshold); CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.passiveChannelListCount); if (primitive->scanConfig.passiveChannelListCount) { @@ -4459,7 +4459,7 @@ CsrUint8* CsrWifiSmeScanConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeScanConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeScanConfigGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeScanConfigGetCfm *primitive = (CsrWifiSmeScanConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeScanConfigGetCfm)); CsrSize offset; @@ -4479,18 +4479,18 @@ void* CsrWifiSmeScanConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu, buffer, &offset); } } - CsrUint8Des((CsrUint8 *) &primitive->scanConfig.disableAutonomousScans, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanConfig.disableAutonomousScans, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->scanConfig.maxResults, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->scanConfig.highRssiThreshold, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->scanConfig.lowRssiThreshold, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->scanConfig.deltaRssiThreshold, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->scanConfig.highSnrThreshold, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->scanConfig.lowSnrThreshold, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->scanConfig.deltaSnrThreshold, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanConfig.highRssiThreshold, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanConfig.lowRssiThreshold, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanConfig.deltaRssiThreshold, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanConfig.highSnrThreshold, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanConfig.lowSnrThreshold, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanConfig.deltaSnrThreshold, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->scanConfig.passiveChannelListCount, buffer, &offset); if (primitive->scanConfig.passiveChannelListCount) { - primitive->scanConfig.passiveChannelList = (CsrUint8 *)CsrPmemAlloc(primitive->scanConfig.passiveChannelListCount); + primitive->scanConfig.passiveChannelList = (u8 *)CsrPmemAlloc(primitive->scanConfig.passiveChannelListCount); CsrMemCpyDes(primitive->scanConfig.passiveChannelList, buffer, &offset, ((CsrUint16) (primitive->scanConfig.passiveChannelListCount))); } else @@ -4516,72 +4516,72 @@ CsrSize CsrWifiSmeScanResultIndSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 149) */ - bufferSize += 32; /* CsrUint8 primitive->result.ssid.ssid[32] */ - bufferSize += 1; /* CsrUint8 primitive->result.ssid.length */ - bufferSize += 6; /* CsrUint8 primitive->result.bssid.a[6] */ + bufferSize += 32; /* u8 primitive->result.ssid.ssid[32] */ + bufferSize += 1; /* u8 primitive->result.ssid.length */ + bufferSize += 6; /* u8 primitive->result.bssid.a[6] */ bufferSize += 2; /* CsrInt16 primitive->result.rssi */ bufferSize += 2; /* CsrInt16 primitive->result.snr */ bufferSize += 1; /* CsrWifiSmeRadioIF primitive->result.ifIndex */ bufferSize += 2; /* CsrUint16 primitive->result.beaconPeriodTu */ - bufferSize += 8; /* CsrUint8 primitive->result.timeStamp.data[8] */ - bufferSize += 8; /* CsrUint8 primitive->result.localTime.data[8] */ + bufferSize += 8; /* u8 primitive->result.timeStamp.data[8] */ + bufferSize += 8; /* u8 primitive->result.localTime.data[8] */ bufferSize += 2; /* CsrUint16 primitive->result.channelFrequency */ bufferSize += 2; /* CsrUint16 primitive->result.capabilityInformation */ - bufferSize += 1; /* CsrUint8 primitive->result.channelNumber */ + bufferSize += 1; /* u8 primitive->result.channelNumber */ bufferSize += 1; /* CsrWifiSmeBasicUsability primitive->result.usability */ bufferSize += 1; /* CsrWifiSmeBssType primitive->result.bssType */ bufferSize += 2; /* CsrUint16 primitive->result.informationElementsLength */ - bufferSize += primitive->result.informationElementsLength; /* CsrUint8 primitive->result.informationElements */ + bufferSize += primitive->result.informationElementsLength; /* u8 primitive->result.informationElements */ bufferSize += 1; /* CsrWifiSmeP2pRole primitive->result.p2pDeviceRole */ switch (primitive->result.p2pDeviceRole) { case CSR_WIFI_SME_P2P_ROLE_CLI: - bufferSize += 1; /* CsrUint8 primitive->result.deviceInfo.reservedCli.empty */ + bufferSize += 1; /* u8 primitive->result.deviceInfo.reservedCli.empty */ break; case CSR_WIFI_SME_P2P_ROLE_GO: bufferSize += 1; /* CsrWifiSmeP2pGroupCapabilityMask primitive->result.deviceInfo.groupInfo.groupCapability */ - bufferSize += 6; /* CsrUint8 primitive->result.deviceInfo.groupInfo.p2pDeviceAddress.a[6] */ - bufferSize += 1; /* CsrUint8 primitive->result.deviceInfo.groupInfo.p2pClientInfoCount */ + bufferSize += 6; /* u8 primitive->result.deviceInfo.groupInfo.p2pDeviceAddress.a[6] */ + bufferSize += 1; /* u8 primitive->result.deviceInfo.groupInfo.p2pClientInfoCount */ { CsrUint16 i4; for (i4 = 0; i4 < primitive->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++) { - bufferSize += 6; /* CsrUint8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a[6] */ - bufferSize += 6; /* CsrUint8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a[6] */ + bufferSize += 6; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a[6] */ + bufferSize += 6; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a[6] */ bufferSize += 2; /* CsrWifiSmeWpsConfigTypeMask primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods */ bufferSize += 1; /* CsrWifiSmeP2pCapabilityMask primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap */ - bufferSize += 8; /* CsrUint8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails[8] */ - bufferSize += 1; /* CsrUint8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount */ + bufferSize += 8; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails[8] */ + bufferSize += 1; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount */ { CsrUint16 i6; for (i6 = 0; i6 < primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++) { - bufferSize += 8; /* CsrUint8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails[8] */ + bufferSize += 8; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails[8] */ } } - bufferSize += 32; /* CsrUint8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName[32] */ - bufferSize += 1; /* CsrUint8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength */ + bufferSize += 32; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName[32] */ + bufferSize += 1; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength */ } } break; case CSR_WIFI_SME_P2P_ROLE_NONE: - bufferSize += 1; /* CsrUint8 primitive->result.deviceInfo.reservedNone.empty */ + bufferSize += 1; /* u8 primitive->result.deviceInfo.reservedNone.empty */ break; case CSR_WIFI_SME_P2P_ROLE_STANDALONE: - bufferSize += 6; /* CsrUint8 primitive->result.deviceInfo.standalonedevInfo.deviceAddress.a[6] */ + bufferSize += 6; /* u8 primitive->result.deviceInfo.standalonedevInfo.deviceAddress.a[6] */ bufferSize += 2; /* CsrWifiSmeWpsConfigTypeMask primitive->result.deviceInfo.standalonedevInfo.configMethods */ bufferSize += 1; /* CsrWifiSmeP2pCapabilityMask primitive->result.deviceInfo.standalonedevInfo.p2PDeviceCap */ - bufferSize += 8; /* CsrUint8 primitive->result.deviceInfo.standalonedevInfo.primDeviceType.deviceDetails[8] */ - bufferSize += 1; /* CsrUint8 primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount */ + bufferSize += 8; /* u8 primitive->result.deviceInfo.standalonedevInfo.primDeviceType.deviceDetails[8] */ + bufferSize += 1; /* u8 primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount */ { CsrUint16 i4; for (i4 = 0; i4 < primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++) { - bufferSize += 8; /* CsrUint8 primitive->result.deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails[8] */ + bufferSize += 8; /* u8 primitive->result.deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails[8] */ } } - bufferSize += 32; /* CsrUint8 primitive->result.deviceInfo.standalonedevInfo.deviceName[32] */ - bufferSize += 1; /* CsrUint8 primitive->result.deviceInfo.standalonedevInfo.deviceNameLength */ + bufferSize += 32; /* u8 primitive->result.deviceInfo.standalonedevInfo.deviceName[32] */ + bufferSize += 1; /* u8 primitive->result.deviceInfo.standalonedevInfo.deviceNameLength */ break; default: break; @@ -4590,40 +4590,40 @@ CsrSize CsrWifiSmeScanResultIndSizeof(void *msg) } -CsrUint8* CsrWifiSmeScanResultIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeScanResultIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeScanResultInd *primitive = (CsrWifiSmeScanResultInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrMemCpySer(ptr, len, (const void *) primitive->result.ssid.ssid, ((CsrUint16) (32))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.ssid.length); + CsrUint8Ser(ptr, len, (u8) primitive->result.ssid.length); CsrMemCpySer(ptr, len, (const void *) primitive->result.bssid.a, ((CsrUint16) (6))); CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.rssi); CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.snr); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.ifIndex); + CsrUint8Ser(ptr, len, (u8) primitive->result.ifIndex); CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.beaconPeriodTu); CsrMemCpySer(ptr, len, (const void *) primitive->result.timeStamp.data, ((CsrUint16) (8))); CsrMemCpySer(ptr, len, (const void *) primitive->result.localTime.data, ((CsrUint16) (8))); CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.channelFrequency); CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.capabilityInformation); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.channelNumber); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.usability); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.bssType); + CsrUint8Ser(ptr, len, (u8) primitive->result.channelNumber); + CsrUint8Ser(ptr, len, (u8) primitive->result.usability); + CsrUint8Ser(ptr, len, (u8) primitive->result.bssType); CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.informationElementsLength); if (primitive->result.informationElementsLength) { CsrMemCpySer(ptr, len, (const void *) primitive->result.informationElements, ((CsrUint16) (primitive->result.informationElementsLength))); } - CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.p2pDeviceRole); + CsrUint8Ser(ptr, len, (u8) primitive->result.p2pDeviceRole); switch (primitive->result.p2pDeviceRole) { case CSR_WIFI_SME_P2P_ROLE_CLI: - CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.deviceInfo.reservedCli.empty); + CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.reservedCli.empty); break; case CSR_WIFI_SME_P2P_ROLE_GO: - CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.deviceInfo.groupInfo.groupCapability); + CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.groupInfo.groupCapability); CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2pDeviceAddress.a, ((CsrUint16) (6))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.deviceInfo.groupInfo.p2pClientInfoCount); + CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.groupInfo.p2pClientInfoCount); { CsrUint16 i4; for (i4 = 0; i4 < primitive->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++) @@ -4631,9 +4631,9 @@ CsrUint8* CsrWifiSmeScanResultIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, ((CsrUint16) (6))); CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, ((CsrUint16) (6))); CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap); + CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap); CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, ((CsrUint16) (8))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount); + CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount); { CsrUint16 i6; for (i6 = 0; i6 < primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++) @@ -4642,19 +4642,19 @@ CsrUint8* CsrWifiSmeScanResultIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) } } CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, ((CsrUint16) (32))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength); + CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength); } } break; case CSR_WIFI_SME_P2P_ROLE_NONE: - CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.deviceInfo.reservedNone.empty); + CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.reservedNone.empty); break; case CSR_WIFI_SME_P2P_ROLE_STANDALONE: CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.standalonedevInfo.deviceAddress.a, ((CsrUint16) (6))); CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.deviceInfo.standalonedevInfo.configMethods); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.deviceInfo.standalonedevInfo.p2PDeviceCap); + CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.standalonedevInfo.p2PDeviceCap); CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, ((CsrUint16) (8))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount); + CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount); { CsrUint16 i4; for (i4 = 0; i4 < primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++) @@ -4663,7 +4663,7 @@ CsrUint8* CsrWifiSmeScanResultIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) } } CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.standalonedevInfo.deviceName, ((CsrUint16) (32))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->result.deviceInfo.standalonedevInfo.deviceNameLength); + CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.standalonedevInfo.deviceNameLength); break; default: break; @@ -4672,7 +4672,7 @@ CsrUint8* CsrWifiSmeScanResultIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeScanResultIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeScanResultIndDes(u8 *buffer, CsrSize length) { CsrWifiSmeScanResultInd *primitive = (CsrWifiSmeScanResultInd *) CsrPmemAlloc(sizeof(CsrWifiSmeScanResultInd)); CsrSize offset; @@ -4680,39 +4680,39 @@ void* CsrWifiSmeScanResultIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrMemCpyDes(primitive->result.ssid.ssid, buffer, &offset, ((CsrUint16) (32))); - CsrUint8Des((CsrUint8 *) &primitive->result.ssid.length, buffer, &offset); + CsrUint8Des((u8 *) &primitive->result.ssid.length, buffer, &offset); CsrMemCpyDes(primitive->result.bssid.a, buffer, &offset, ((CsrUint16) (6))); CsrUint16Des((CsrUint16 *) &primitive->result.rssi, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->result.snr, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->result.ifIndex, buffer, &offset); + CsrUint8Des((u8 *) &primitive->result.ifIndex, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->result.beaconPeriodTu, buffer, &offset); CsrMemCpyDes(primitive->result.timeStamp.data, buffer, &offset, ((CsrUint16) (8))); CsrMemCpyDes(primitive->result.localTime.data, buffer, &offset, ((CsrUint16) (8))); CsrUint16Des((CsrUint16 *) &primitive->result.channelFrequency, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->result.capabilityInformation, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->result.channelNumber, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->result.usability, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->result.bssType, buffer, &offset); + CsrUint8Des((u8 *) &primitive->result.channelNumber, buffer, &offset); + CsrUint8Des((u8 *) &primitive->result.usability, buffer, &offset); + CsrUint8Des((u8 *) &primitive->result.bssType, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->result.informationElementsLength, buffer, &offset); if (primitive->result.informationElementsLength) { - primitive->result.informationElements = (CsrUint8 *)CsrPmemAlloc(primitive->result.informationElementsLength); + primitive->result.informationElements = (u8 *)CsrPmemAlloc(primitive->result.informationElementsLength); CsrMemCpyDes(primitive->result.informationElements, buffer, &offset, ((CsrUint16) (primitive->result.informationElementsLength))); } else { primitive->result.informationElements = NULL; } - CsrUint8Des((CsrUint8 *) &primitive->result.p2pDeviceRole, buffer, &offset); + CsrUint8Des((u8 *) &primitive->result.p2pDeviceRole, buffer, &offset); switch (primitive->result.p2pDeviceRole) { case CSR_WIFI_SME_P2P_ROLE_CLI: - CsrUint8Des((CsrUint8 *) &primitive->result.deviceInfo.reservedCli.empty, buffer, &offset); + CsrUint8Des((u8 *) &primitive->result.deviceInfo.reservedCli.empty, buffer, &offset); break; case CSR_WIFI_SME_P2P_ROLE_GO: - CsrUint8Des((CsrUint8 *) &primitive->result.deviceInfo.groupInfo.groupCapability, buffer, &offset); + CsrUint8Des((u8 *) &primitive->result.deviceInfo.groupInfo.groupCapability, buffer, &offset); CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2pDeviceAddress.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint8Des((CsrUint8 *) &primitive->result.deviceInfo.groupInfo.p2pClientInfoCount, buffer, &offset); + CsrUint8Des((u8 *) &primitive->result.deviceInfo.groupInfo.p2pClientInfoCount, buffer, &offset); primitive->result.deviceInfo.groupInfo.p2PClientInfo = NULL; if (primitive->result.deviceInfo.groupInfo.p2pClientInfoCount) { @@ -4725,9 +4725,9 @@ void* CsrWifiSmeScanResultIndDes(CsrUint8 *buffer, CsrSize length) CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, buffer, &offset, ((CsrUint16) (6))); CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, buffer, &offset, ((CsrUint16) (6))); CsrUint16Des((CsrUint16 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap, buffer, &offset); + CsrUint8Des((u8 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap, buffer, &offset); CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, buffer, &offset, ((CsrUint16) (8))); - CsrUint8Des((CsrUint8 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount, buffer, &offset); + CsrUint8Des((u8 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount, buffer, &offset); primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL; if (primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount) { @@ -4741,19 +4741,19 @@ void* CsrWifiSmeScanResultIndDes(CsrUint8 *buffer, CsrSize length) } } CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, buffer, &offset, ((CsrUint16) (32))); - CsrUint8Des((CsrUint8 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength, buffer, &offset); + CsrUint8Des((u8 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength, buffer, &offset); } } break; case CSR_WIFI_SME_P2P_ROLE_NONE: - CsrUint8Des((CsrUint8 *) &primitive->result.deviceInfo.reservedNone.empty, buffer, &offset); + CsrUint8Des((u8 *) &primitive->result.deviceInfo.reservedNone.empty, buffer, &offset); break; case CSR_WIFI_SME_P2P_ROLE_STANDALONE: CsrMemCpyDes(primitive->result.deviceInfo.standalonedevInfo.deviceAddress.a, buffer, &offset, ((CsrUint16) (6))); CsrUint16Des((CsrUint16 *) &primitive->result.deviceInfo.standalonedevInfo.configMethods, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->result.deviceInfo.standalonedevInfo.p2PDeviceCap, buffer, &offset); + CsrUint8Des((u8 *) &primitive->result.deviceInfo.standalonedevInfo.p2PDeviceCap, buffer, &offset); CsrMemCpyDes(primitive->result.deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, buffer, &offset, ((CsrUint16) (8))); - CsrUint8Des((CsrUint8 *) &primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount, buffer, &offset); + CsrUint8Des((u8 *) &primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount, buffer, &offset); primitive->result.deviceInfo.standalonedevInfo.secDeviceType = NULL; if (primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount) { @@ -4767,7 +4767,7 @@ void* CsrWifiSmeScanResultIndDes(CsrUint8 *buffer, CsrSize length) } } CsrMemCpyDes(primitive->result.deviceInfo.standalonedevInfo.deviceName, buffer, &offset, ((CsrUint16) (32))); - CsrUint8Des((CsrUint8 *) &primitive->result.deviceInfo.standalonedevInfo.deviceNameLength, buffer, &offset); + CsrUint8Des((u8 *) &primitive->result.deviceInfo.standalonedevInfo.deviceNameLength, buffer, &offset); break; default: break; @@ -4815,72 +4815,72 @@ CsrSize CsrWifiSmeScanResultsGetCfmSizeof(void *msg) CsrUint16 i1; for (i1 = 0; i1 < primitive->scanResultsCount; i1++) { - bufferSize += 32; /* CsrUint8 primitive->scanResults[i1].ssid.ssid[32] */ - bufferSize += 1; /* CsrUint8 primitive->scanResults[i1].ssid.length */ - bufferSize += 6; /* CsrUint8 primitive->scanResults[i1].bssid.a[6] */ + bufferSize += 32; /* u8 primitive->scanResults[i1].ssid.ssid[32] */ + bufferSize += 1; /* u8 primitive->scanResults[i1].ssid.length */ + bufferSize += 6; /* u8 primitive->scanResults[i1].bssid.a[6] */ bufferSize += 2; /* CsrInt16 primitive->scanResults[i1].rssi */ bufferSize += 2; /* CsrInt16 primitive->scanResults[i1].snr */ bufferSize += 1; /* CsrWifiSmeRadioIF primitive->scanResults[i1].ifIndex */ bufferSize += 2; /* CsrUint16 primitive->scanResults[i1].beaconPeriodTu */ - bufferSize += 8; /* CsrUint8 primitive->scanResults[i1].timeStamp.data[8] */ - bufferSize += 8; /* CsrUint8 primitive->scanResults[i1].localTime.data[8] */ + bufferSize += 8; /* u8 primitive->scanResults[i1].timeStamp.data[8] */ + bufferSize += 8; /* u8 primitive->scanResults[i1].localTime.data[8] */ bufferSize += 2; /* CsrUint16 primitive->scanResults[i1].channelFrequency */ bufferSize += 2; /* CsrUint16 primitive->scanResults[i1].capabilityInformation */ - bufferSize += 1; /* CsrUint8 primitive->scanResults[i1].channelNumber */ + bufferSize += 1; /* u8 primitive->scanResults[i1].channelNumber */ bufferSize += 1; /* CsrWifiSmeBasicUsability primitive->scanResults[i1].usability */ bufferSize += 1; /* CsrWifiSmeBssType primitive->scanResults[i1].bssType */ bufferSize += 2; /* CsrUint16 primitive->scanResults[i1].informationElementsLength */ - bufferSize += primitive->scanResults[i1].informationElementsLength; /* CsrUint8 primitive->scanResults[i1].informationElements */ + bufferSize += primitive->scanResults[i1].informationElementsLength; /* u8 primitive->scanResults[i1].informationElements */ bufferSize += 1; /* CsrWifiSmeP2pRole primitive->scanResults[i1].p2pDeviceRole */ switch (primitive->scanResults[i1].p2pDeviceRole) { case CSR_WIFI_SME_P2P_ROLE_CLI: - bufferSize += 1; /* CsrUint8 primitive->scanResults[i1].deviceInfo.reservedCli.empty */ + bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.reservedCli.empty */ break; case CSR_WIFI_SME_P2P_ROLE_GO: bufferSize += 1; /* CsrWifiSmeP2pGroupCapabilityMask primitive->scanResults[i1].deviceInfo.groupInfo.groupCapability */ - bufferSize += 6; /* CsrUint8 primitive->scanResults[i1].deviceInfo.groupInfo.p2pDeviceAddress.a[6] */ - bufferSize += 1; /* CsrUint8 primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount */ + bufferSize += 6; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2pDeviceAddress.a[6] */ + bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount */ { CsrUint16 i4; for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++) { - bufferSize += 6; /* CsrUint8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a[6] */ - bufferSize += 6; /* CsrUint8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a[6] */ + bufferSize += 6; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a[6] */ + bufferSize += 6; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a[6] */ bufferSize += 2; /* CsrWifiSmeWpsConfigTypeMask primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods */ bufferSize += 1; /* CsrWifiSmeP2pCapabilityMask primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap */ - bufferSize += 8; /* CsrUint8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails[8] */ - bufferSize += 1; /* CsrUint8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount */ + bufferSize += 8; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails[8] */ + bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount */ { CsrUint16 i6; for (i6 = 0; i6 < primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++) { - bufferSize += 8; /* CsrUint8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails[8] */ + bufferSize += 8; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails[8] */ } } - bufferSize += 32; /* CsrUint8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName[32] */ - bufferSize += 1; /* CsrUint8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength */ + bufferSize += 32; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName[32] */ + bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength */ } } break; case CSR_WIFI_SME_P2P_ROLE_NONE: - bufferSize += 1; /* CsrUint8 primitive->scanResults[i1].deviceInfo.reservedNone.empty */ + bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.reservedNone.empty */ break; case CSR_WIFI_SME_P2P_ROLE_STANDALONE: - bufferSize += 6; /* CsrUint8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceAddress.a[6] */ + bufferSize += 6; /* u8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceAddress.a[6] */ bufferSize += 2; /* CsrWifiSmeWpsConfigTypeMask primitive->scanResults[i1].deviceInfo.standalonedevInfo.configMethods */ bufferSize += 1; /* CsrWifiSmeP2pCapabilityMask primitive->scanResults[i1].deviceInfo.standalonedevInfo.p2PDeviceCap */ - bufferSize += 8; /* CsrUint8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.primDeviceType.deviceDetails[8] */ - bufferSize += 1; /* CsrUint8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount */ + bufferSize += 8; /* u8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.primDeviceType.deviceDetails[8] */ + bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount */ { CsrUint16 i4; for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++) { - bufferSize += 8; /* CsrUint8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails[8] */ + bufferSize += 8; /* u8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails[8] */ } } - bufferSize += 32; /* CsrUint8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceName[32] */ - bufferSize += 1; /* CsrUint8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceNameLength */ + bufferSize += 32; /* u8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceName[32] */ + bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceNameLength */ break; default: break; @@ -4891,7 +4891,7 @@ CsrSize CsrWifiSmeScanResultsGetCfmSizeof(void *msg) } -CsrUint8* CsrWifiSmeScanResultsGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeScanResultsGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeScanResultsGetCfm *primitive = (CsrWifiSmeScanResultsGetCfm *)msg; *len = 0; @@ -4903,34 +4903,34 @@ CsrUint8* CsrWifiSmeScanResultsGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) for (i1 = 0; i1 < primitive->scanResultsCount; i1++) { CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].ssid.ssid, ((CsrUint16) (32))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].ssid.length); + CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].ssid.length); CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].bssid.a, ((CsrUint16) (6))); CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].rssi); CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].snr); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].ifIndex); + CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].ifIndex); CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].beaconPeriodTu); CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].timeStamp.data, ((CsrUint16) (8))); CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].localTime.data, ((CsrUint16) (8))); CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].channelFrequency); CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].capabilityInformation); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].channelNumber); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].usability); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].bssType); + CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].channelNumber); + CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].usability); + CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].bssType); CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].informationElementsLength); if (primitive->scanResults[i1].informationElementsLength) { CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].informationElements, ((CsrUint16) (primitive->scanResults[i1].informationElementsLength))); } - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].p2pDeviceRole); + CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].p2pDeviceRole); switch (primitive->scanResults[i1].p2pDeviceRole) { case CSR_WIFI_SME_P2P_ROLE_CLI: - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].deviceInfo.reservedCli.empty); + CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.reservedCli.empty); break; case CSR_WIFI_SME_P2P_ROLE_GO: - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].deviceInfo.groupInfo.groupCapability); + CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.groupInfo.groupCapability); CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2pDeviceAddress.a, ((CsrUint16) (6))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount); + CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount); { CsrUint16 i4; for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++) @@ -4938,9 +4938,9 @@ CsrUint8* CsrWifiSmeScanResultsGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, ((CsrUint16) (6))); CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, ((CsrUint16) (6))); CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap); + CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap); CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, ((CsrUint16) (8))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount); + CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount); { CsrUint16 i6; for (i6 = 0; i6 < primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++) @@ -4949,19 +4949,19 @@ CsrUint8* CsrWifiSmeScanResultsGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } } CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, ((CsrUint16) (32))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength); + CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength); } } break; case CSR_WIFI_SME_P2P_ROLE_NONE: - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].deviceInfo.reservedNone.empty); + CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.reservedNone.empty); break; case CSR_WIFI_SME_P2P_ROLE_STANDALONE: CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceAddress.a, ((CsrUint16) (6))); CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].deviceInfo.standalonedevInfo.configMethods); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].deviceInfo.standalonedevInfo.p2PDeviceCap); + CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.standalonedevInfo.p2PDeviceCap); CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, ((CsrUint16) (8))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount); + CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount); { CsrUint16 i4; for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++) @@ -4970,7 +4970,7 @@ CsrUint8* CsrWifiSmeScanResultsGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } } CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceName, ((CsrUint16) (32))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceNameLength); + CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceNameLength); break; default: break; @@ -4981,7 +4981,7 @@ CsrUint8* CsrWifiSmeScanResultsGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeScanResultsGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeScanResultsGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeScanResultsGetCfm *primitive = (CsrWifiSmeScanResultsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeScanResultsGetCfm)); CsrSize offset; @@ -5000,39 +5000,39 @@ void* CsrWifiSmeScanResultsGetCfmDes(CsrUint8 *buffer, CsrSize length) for (i1 = 0; i1 < primitive->scanResultsCount; i1++) { CsrMemCpyDes(primitive->scanResults[i1].ssid.ssid, buffer, &offset, ((CsrUint16) (32))); - CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].ssid.length, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanResults[i1].ssid.length, buffer, &offset); CsrMemCpyDes(primitive->scanResults[i1].bssid.a, buffer, &offset, ((CsrUint16) (6))); CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].rssi, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].snr, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].ifIndex, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanResults[i1].ifIndex, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].beaconPeriodTu, buffer, &offset); CsrMemCpyDes(primitive->scanResults[i1].timeStamp.data, buffer, &offset, ((CsrUint16) (8))); CsrMemCpyDes(primitive->scanResults[i1].localTime.data, buffer, &offset, ((CsrUint16) (8))); CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].channelFrequency, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].capabilityInformation, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].channelNumber, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].usability, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].bssType, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanResults[i1].channelNumber, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanResults[i1].usability, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanResults[i1].bssType, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].informationElementsLength, buffer, &offset); if (primitive->scanResults[i1].informationElementsLength) { - primitive->scanResults[i1].informationElements = (CsrUint8 *)CsrPmemAlloc(primitive->scanResults[i1].informationElementsLength); + primitive->scanResults[i1].informationElements = (u8 *)CsrPmemAlloc(primitive->scanResults[i1].informationElementsLength); CsrMemCpyDes(primitive->scanResults[i1].informationElements, buffer, &offset, ((CsrUint16) (primitive->scanResults[i1].informationElementsLength))); } else { primitive->scanResults[i1].informationElements = NULL; } - CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].p2pDeviceRole, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanResults[i1].p2pDeviceRole, buffer, &offset); switch (primitive->scanResults[i1].p2pDeviceRole) { case CSR_WIFI_SME_P2P_ROLE_CLI: - CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].deviceInfo.reservedCli.empty, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.reservedCli.empty, buffer, &offset); break; case CSR_WIFI_SME_P2P_ROLE_GO: - CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.groupCapability, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.groupCapability, buffer, &offset); CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2pDeviceAddress.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount, buffer, &offset); primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo = NULL; if (primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount) { @@ -5045,9 +5045,9 @@ void* CsrWifiSmeScanResultsGetCfmDes(CsrUint8 *buffer, CsrSize length) CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, buffer, &offset, ((CsrUint16) (6))); CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, buffer, &offset, ((CsrUint16) (6))); CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap, buffer, &offset); CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, buffer, &offset, ((CsrUint16) (8))); - CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount, buffer, &offset); primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL; if (primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount) { @@ -5061,19 +5061,19 @@ void* CsrWifiSmeScanResultsGetCfmDes(CsrUint8 *buffer, CsrSize length) } } CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, buffer, &offset, ((CsrUint16) (32))); - CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength, buffer, &offset); } } break; case CSR_WIFI_SME_P2P_ROLE_NONE: - CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].deviceInfo.reservedNone.empty, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.reservedNone.empty, buffer, &offset); break; case CSR_WIFI_SME_P2P_ROLE_STANDALONE: CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceAddress.a, buffer, &offset, ((CsrUint16) (6))); CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.configMethods, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.p2PDeviceCap, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.p2PDeviceCap, buffer, &offset); CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, buffer, &offset, ((CsrUint16) (8))); - CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount, buffer, &offset); primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType = NULL; if (primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount) { @@ -5087,7 +5087,7 @@ void* CsrWifiSmeScanResultsGetCfmDes(CsrUint8 *buffer, CsrSize length) } } CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceName, buffer, &offset, ((CsrUint16) (32))); - CsrUint8Des((CsrUint8 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceNameLength, buffer, &offset); + CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceNameLength, buffer, &offset); break; default: break; @@ -5139,8 +5139,8 @@ CsrSize CsrWifiSmeSmeStaConfigGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* CsrUint8 primitive->smeConfig.connectionQualityRssiChangeTrigger */ - bufferSize += 1; /* CsrUint8 primitive->smeConfig.connectionQualitySnrChangeTrigger */ + bufferSize += 1; /* u8 primitive->smeConfig.connectionQualityRssiChangeTrigger */ + bufferSize += 1; /* u8 primitive->smeConfig.connectionQualitySnrChangeTrigger */ bufferSize += 1; /* CsrWifiSmeWmmModeMask primitive->smeConfig.wmmModeMask */ bufferSize += 1; /* CsrWifiSmeRadioIF primitive->smeConfig.ifIndex */ bufferSize += 1; /* CsrBool primitive->smeConfig.allowUnicastUseGroupCipher */ @@ -5149,24 +5149,24 @@ CsrSize CsrWifiSmeSmeStaConfigGetCfmSizeof(void *msg) } -CsrUint8* CsrWifiSmeSmeStaConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeSmeStaConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeSmeStaConfigGetCfm *primitive = (CsrWifiSmeSmeStaConfigGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.connectionQualityRssiChangeTrigger); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.connectionQualitySnrChangeTrigger); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.wmmModeMask); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.ifIndex); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.allowUnicastUseGroupCipher); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->smeConfig.enableOpportunisticKeyCaching); + CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.connectionQualityRssiChangeTrigger); + CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.connectionQualitySnrChangeTrigger); + CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.wmmModeMask); + CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.ifIndex); + CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.allowUnicastUseGroupCipher); + CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.enableOpportunisticKeyCaching); return(ptr); } -void* CsrWifiSmeSmeStaConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeSmeStaConfigGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeSmeStaConfigGetCfm *primitive = (CsrWifiSmeSmeStaConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeStaConfigGetCfm)); CsrSize offset; @@ -5175,12 +5175,12 @@ void* CsrWifiSmeSmeStaConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->smeConfig.connectionQualityRssiChangeTrigger, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->smeConfig.connectionQualitySnrChangeTrigger, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->smeConfig.wmmModeMask, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->smeConfig.ifIndex, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->smeConfig.allowUnicastUseGroupCipher, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->smeConfig.enableOpportunisticKeyCaching, buffer, &offset); + CsrUint8Des((u8 *) &primitive->smeConfig.connectionQualityRssiChangeTrigger, buffer, &offset); + CsrUint8Des((u8 *) &primitive->smeConfig.connectionQualitySnrChangeTrigger, buffer, &offset); + CsrUint8Des((u8 *) &primitive->smeConfig.wmmModeMask, buffer, &offset); + CsrUint8Des((u8 *) &primitive->smeConfig.ifIndex, buffer, &offset); + CsrUint8Des((u8 *) &primitive->smeConfig.allowUnicastUseGroupCipher, buffer, &offset); + CsrUint8Des((u8 *) &primitive->smeConfig.enableOpportunisticKeyCaching, buffer, &offset); return primitive; } @@ -5197,7 +5197,7 @@ CsrSize CsrWifiSmeSmeStaConfigSetCfmSizeof(void *msg) } -CsrUint8* CsrWifiSmeSmeStaConfigSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeSmeStaConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeSmeStaConfigSetCfm *primitive = (CsrWifiSmeSmeStaConfigSetCfm *)msg; *len = 0; @@ -5208,7 +5208,7 @@ CsrUint8* CsrWifiSmeSmeStaConfigSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg } -void* CsrWifiSmeSmeStaConfigSetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeSmeStaConfigSetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeSmeStaConfigSetCfm *primitive = (CsrWifiSmeSmeStaConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeStaConfigSetCfm)); CsrSize offset; @@ -5232,14 +5232,14 @@ CsrSize CsrWifiSmeStationMacAddressGetCfmSizeof(void *msg) CsrUint16 i1; for (i1 = 0; i1 < 2; i1++) { - bufferSize += 6; /* CsrUint8 primitive->stationMacAddress[i1].a[6] */ + bufferSize += 6; /* u8 primitive->stationMacAddress[i1].a[6] */ } } return bufferSize; } -CsrUint8* CsrWifiSmeStationMacAddressGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeStationMacAddressGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeStationMacAddressGetCfm *primitive = (CsrWifiSmeStationMacAddressGetCfm *)msg; *len = 0; @@ -5256,7 +5256,7 @@ CsrUint8* CsrWifiSmeStationMacAddressGetCfmSer(CsrUint8 *ptr, CsrSize *len, void } -void* CsrWifiSmeStationMacAddressGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeStationMacAddressGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeStationMacAddressGetCfm *primitive = (CsrWifiSmeStationMacAddressGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeStationMacAddressGetCfm)); CsrSize offset; @@ -5286,19 +5286,19 @@ CsrSize CsrWifiSmeTspecIndSizeof(void *msg) bufferSize += 4; /* CsrUint32 primitive->transactionId */ bufferSize += 1; /* CsrWifiSmeTspecResultCode primitive->tspecResultCode */ bufferSize += 2; /* CsrUint16 primitive->tspecLength */ - bufferSize += primitive->tspecLength; /* CsrUint8 primitive->tspec */ + bufferSize += primitive->tspecLength; /* u8 primitive->tspec */ return bufferSize; } -CsrUint8* CsrWifiSmeTspecIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeTspecIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeTspecInd *primitive = (CsrWifiSmeTspecInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrUint32Ser(ptr, len, (CsrUint32) primitive->transactionId); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->tspecResultCode); + CsrUint8Ser(ptr, len, (u8) primitive->tspecResultCode); CsrUint16Ser(ptr, len, (CsrUint16) primitive->tspecLength); if (primitive->tspecLength) { @@ -5308,7 +5308,7 @@ CsrUint8* CsrWifiSmeTspecIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeTspecIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeTspecIndDes(u8 *buffer, CsrSize length) { CsrWifiSmeTspecInd *primitive = (CsrWifiSmeTspecInd *) CsrPmemAlloc(sizeof(CsrWifiSmeTspecInd)); CsrSize offset; @@ -5317,11 +5317,11 @@ void* CsrWifiSmeTspecIndDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->transactionId, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->tspecResultCode, buffer, &offset); + CsrUint8Des((u8 *) &primitive->tspecResultCode, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->tspecLength, buffer, &offset); if (primitive->tspecLength) { - primitive->tspec = (CsrUint8 *)CsrPmemAlloc(primitive->tspecLength); + primitive->tspec = (u8 *)CsrPmemAlloc(primitive->tspecLength); CsrMemCpyDes(primitive->tspec, buffer, &offset, ((CsrUint16) (primitive->tspecLength))); } else @@ -5352,12 +5352,12 @@ CsrSize CsrWifiSmeTspecCfmSizeof(void *msg) bufferSize += 4; /* CsrUint32 primitive->transactionId */ bufferSize += 1; /* CsrWifiSmeTspecResultCode primitive->tspecResultCode */ bufferSize += 2; /* CsrUint16 primitive->tspecLength */ - bufferSize += primitive->tspecLength; /* CsrUint8 primitive->tspec */ + bufferSize += primitive->tspecLength; /* u8 primitive->tspec */ return bufferSize; } -CsrUint8* CsrWifiSmeTspecCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeTspecCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeTspecCfm *primitive = (CsrWifiSmeTspecCfm *)msg; *len = 0; @@ -5365,7 +5365,7 @@ CsrUint8* CsrWifiSmeTspecCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); CsrUint32Ser(ptr, len, (CsrUint32) primitive->transactionId); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->tspecResultCode); + CsrUint8Ser(ptr, len, (u8) primitive->tspecResultCode); CsrUint16Ser(ptr, len, (CsrUint16) primitive->tspecLength); if (primitive->tspecLength) { @@ -5375,7 +5375,7 @@ CsrUint8* CsrWifiSmeTspecCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeTspecCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeTspecCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeTspecCfm *primitive = (CsrWifiSmeTspecCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeTspecCfm)); CsrSize offset; @@ -5385,11 +5385,11 @@ void* CsrWifiSmeTspecCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->transactionId, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->tspecResultCode, buffer, &offset); + CsrUint8Des((u8 *) &primitive->tspecResultCode, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->tspecLength, buffer, &offset); if (primitive->tspecLength) { - primitive->tspec = (CsrUint8 *)CsrPmemAlloc(primitive->tspecLength); + primitive->tspec = (u8 *)CsrPmemAlloc(primitive->tspecLength); CsrMemCpyDes(primitive->tspec, buffer, &offset, ((CsrUint16) (primitive->tspecLength))); } else @@ -5429,7 +5429,7 @@ CsrSize CsrWifiSmeVersionsGetCfmSizeof(void *msg) } -CsrUint8* CsrWifiSmeVersionsGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeVersionsGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeVersionsGetCfm *primitive = (CsrWifiSmeVersionsGetCfm *)msg; *len = 0; @@ -5448,7 +5448,7 @@ CsrUint8* CsrWifiSmeVersionsGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeVersionsGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeVersionsGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeVersionsGetCfm *primitive = (CsrWifiSmeVersionsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeVersionsGetCfm)); CsrSize offset; @@ -5486,39 +5486,39 @@ CsrSize CsrWifiSmeCloakedSsidsGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 39) */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* CsrUint8 primitive->cloakedSsids.cloakedSsidsCount */ + bufferSize += 1; /* u8 primitive->cloakedSsids.cloakedSsidsCount */ { CsrUint16 i2; for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) { - bufferSize += 32; /* CsrUint8 primitive->cloakedSsids.cloakedSsids[i2].ssid[32] */ - bufferSize += 1; /* CsrUint8 primitive->cloakedSsids.cloakedSsids[i2].length */ + bufferSize += 32; /* u8 primitive->cloakedSsids.cloakedSsids[i2].ssid[32] */ + bufferSize += 1; /* u8 primitive->cloakedSsids.cloakedSsids[i2].length */ } } return bufferSize; } -CsrUint8* CsrWifiSmeCloakedSsidsGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeCloakedSsidsGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeCloakedSsidsGetCfm *primitive = (CsrWifiSmeCloakedSsidsGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->cloakedSsids.cloakedSsidsCount); + CsrUint8Ser(ptr, len, (u8) primitive->cloakedSsids.cloakedSsidsCount); { CsrUint16 i2; for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) { CsrMemCpySer(ptr, len, (const void *) primitive->cloakedSsids.cloakedSsids[i2].ssid, ((CsrUint16) (32))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->cloakedSsids.cloakedSsids[i2].length); + CsrUint8Ser(ptr, len, (u8) primitive->cloakedSsids.cloakedSsids[i2].length); } } return(ptr); } -void* CsrWifiSmeCloakedSsidsGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeCloakedSsidsGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeCloakedSsidsGetCfm *primitive = (CsrWifiSmeCloakedSsidsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCloakedSsidsGetCfm)); CsrSize offset; @@ -5526,7 +5526,7 @@ void* CsrWifiSmeCloakedSsidsGetCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->cloakedSsids.cloakedSsidsCount, buffer, &offset); + CsrUint8Des((u8 *) &primitive->cloakedSsids.cloakedSsidsCount, buffer, &offset); primitive->cloakedSsids.cloakedSsids = NULL; if (primitive->cloakedSsids.cloakedSsidsCount) { @@ -5537,7 +5537,7 @@ void* CsrWifiSmeCloakedSsidsGetCfmDes(CsrUint8 *buffer, CsrSize length) for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) { CsrMemCpyDes(primitive->cloakedSsids.cloakedSsids[i2].ssid, buffer, &offset, ((CsrUint16) (32))); - CsrUint8Des((CsrUint8 *) &primitive->cloakedSsids.cloakedSsids[i2].length, buffer, &offset); + CsrUint8Des((u8 *) &primitive->cloakedSsids.cloakedSsids[i2].length, buffer, &offset); } } @@ -5558,12 +5558,12 @@ CsrSize CsrWifiSmeWifiOnIndSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ - bufferSize += 6; /* CsrUint8 primitive->address.a[6] */ + bufferSize += 6; /* u8 primitive->address.a[6] */ return bufferSize; } -CsrUint8* CsrWifiSmeWifiOnIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeWifiOnIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeWifiOnInd *primitive = (CsrWifiSmeWifiOnInd *)msg; *len = 0; @@ -5573,7 +5573,7 @@ CsrUint8* CsrWifiSmeWifiOnIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeWifiOnIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeWifiOnIndDes(u8 *buffer, CsrSize length) { CsrWifiSmeWifiOnInd *primitive = (CsrWifiSmeWifiOnInd *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiOnInd)); CsrSize offset; @@ -5593,28 +5593,28 @@ CsrSize CsrWifiSmeSmeCommonConfigGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* CsrWifiSme80211dTrustLevel primitive->deviceConfig.trustLevel */ - bufferSize += 2; /* CsrUint8 primitive->deviceConfig.countryCode[2] */ + bufferSize += 2; /* u8 primitive->deviceConfig.countryCode[2] */ bufferSize += 1; /* CsrWifiSmeFirmwareDriverInterface primitive->deviceConfig.firmwareDriverInterface */ bufferSize += 1; /* CsrBool primitive->deviceConfig.enableStrictDraftN */ return bufferSize; } -CsrUint8* CsrWifiSmeSmeCommonConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeSmeCommonConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeSmeCommonConfigGetCfm *primitive = (CsrWifiSmeSmeCommonConfigGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->deviceConfig.trustLevel); + CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.trustLevel); CsrMemCpySer(ptr, len, (const void *) primitive->deviceConfig.countryCode, ((CsrUint16) (2))); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->deviceConfig.firmwareDriverInterface); - CsrUint8Ser(ptr, len, (CsrUint8) primitive->deviceConfig.enableStrictDraftN); + CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.firmwareDriverInterface); + CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.enableStrictDraftN); return(ptr); } -void* CsrWifiSmeSmeCommonConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeSmeCommonConfigGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeSmeCommonConfigGetCfm *primitive = (CsrWifiSmeSmeCommonConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeCommonConfigGetCfm)); CsrSize offset; @@ -5622,10 +5622,10 @@ void* CsrWifiSmeSmeCommonConfigGetCfmDes(CsrUint8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->deviceConfig.trustLevel, buffer, &offset); + CsrUint8Des((u8 *) &primitive->deviceConfig.trustLevel, buffer, &offset); CsrMemCpyDes(primitive->deviceConfig.countryCode, buffer, &offset, ((CsrUint16) (2))); - CsrUint8Des((CsrUint8 *) &primitive->deviceConfig.firmwareDriverInterface, buffer, &offset); - CsrUint8Des((CsrUint8 *) &primitive->deviceConfig.enableStrictDraftN, buffer, &offset); + CsrUint8Des((u8 *) &primitive->deviceConfig.firmwareDriverInterface, buffer, &offset); + CsrUint8Des((u8 *) &primitive->deviceConfig.enableStrictDraftN, buffer, &offset); return primitive; } @@ -5638,12 +5638,12 @@ CsrSize CsrWifiSmeInterfaceCapabilityGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 2; /* CsrUint16 primitive->numInterfaces */ - bufferSize += 2; /* CsrUint8 primitive->capBitmap[2] */ + bufferSize += 2; /* u8 primitive->capBitmap[2] */ return bufferSize; } -CsrUint8* CsrWifiSmeInterfaceCapabilityGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeInterfaceCapabilityGetCfmSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeInterfaceCapabilityGetCfm *primitive = (CsrWifiSmeInterfaceCapabilityGetCfm *)msg; *len = 0; @@ -5655,7 +5655,7 @@ CsrUint8* CsrWifiSmeInterfaceCapabilityGetCfmSer(CsrUint8 *ptr, CsrSize *len, vo } -void* CsrWifiSmeInterfaceCapabilityGetCfmDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeInterfaceCapabilityGetCfmDes(u8 *buffer, CsrSize length) { CsrWifiSmeInterfaceCapabilityGetCfm *primitive = (CsrWifiSmeInterfaceCapabilityGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeInterfaceCapabilityGetCfm)); CsrSize offset; @@ -5681,7 +5681,7 @@ CsrSize CsrWifiSmeErrorIndSizeof(void *msg) } -CsrUint8* CsrWifiSmeErrorIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeErrorIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeErrorInd *primitive = (CsrWifiSmeErrorInd *)msg; *len = 0; @@ -5691,7 +5691,7 @@ CsrUint8* CsrWifiSmeErrorIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeErrorIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeErrorIndDes(u8 *buffer, CsrSize length) { CsrWifiSmeErrorInd *primitive = (CsrWifiSmeErrorInd *) CsrPmemAlloc(sizeof(CsrWifiSmeErrorInd)); CsrSize offset; @@ -5723,7 +5723,7 @@ CsrSize CsrWifiSmeInfoIndSizeof(void *msg) } -CsrUint8* CsrWifiSmeInfoIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeInfoIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeInfoInd *primitive = (CsrWifiSmeInfoInd *)msg; *len = 0; @@ -5733,7 +5733,7 @@ CsrUint8* CsrWifiSmeInfoIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeInfoIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeInfoIndDes(u8 *buffer, CsrSize length) { CsrWifiSmeInfoInd *primitive = (CsrWifiSmeInfoInd *) CsrPmemAlloc(sizeof(CsrWifiSmeInfoInd)); CsrSize offset; @@ -5761,12 +5761,12 @@ CsrSize CsrWifiSmeCoreDumpIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 4; /* CsrUint32 primitive->dataLength */ - bufferSize += primitive->dataLength; /* CsrUint8 primitive->data */ + bufferSize += primitive->dataLength; /* u8 primitive->data */ return bufferSize; } -CsrUint8* CsrWifiSmeCoreDumpIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeCoreDumpIndSer(u8 *ptr, CsrSize *len, void *msg) { CsrWifiSmeCoreDumpInd *primitive = (CsrWifiSmeCoreDumpInd *)msg; *len = 0; @@ -5780,7 +5780,7 @@ CsrUint8* CsrWifiSmeCoreDumpIndSer(CsrUint8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeCoreDumpIndDes(CsrUint8 *buffer, CsrSize length) +void* CsrWifiSmeCoreDumpIndDes(u8 *buffer, CsrSize length) { CsrWifiSmeCoreDumpInd *primitive = (CsrWifiSmeCoreDumpInd *) CsrPmemAlloc(sizeof(CsrWifiSmeCoreDumpInd)); CsrSize offset; @@ -5790,7 +5790,7 @@ void* CsrWifiSmeCoreDumpIndDes(CsrUint8 *buffer, CsrSize length) CsrUint32Des((CsrUint32 *) &primitive->dataLength, buffer, &offset); if (primitive->dataLength) { - primitive->data = (CsrUint8 *)CsrPmemAlloc(primitive->dataLength); + primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); CsrMemCpyDes(primitive->data, buffer, &offset, ((CsrUint16) (primitive->dataLength))); } else diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.h b/drivers/staging/csr/csr_wifi_sme_serialize.h index 0080bf4..700d049 100644 --- a/drivers/staging/csr/csr_wifi_sme_serialize.h +++ b/drivers/staging/csr/csr_wifi_sme_serialize.h @@ -35,13 +35,13 @@ extern void CsrWifiSmePfree(void *ptr); #define CsrWifiSmeAdhocConfigGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmeAdhocConfigGetReqSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeAdhocConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeAdhocConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeAdhocConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeAdhocConfigSetReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeAdhocConfigSetReqSizeof(void *msg); #define CsrWifiSmeAdhocConfigSetReqSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeBlacklistReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeBlacklistReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeBlacklistReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeBlacklistReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeBlacklistReqSizeof(void *msg); extern void CsrWifiSmeBlacklistReqSerFree(void *msg); @@ -50,8 +50,8 @@ extern void CsrWifiSmeBlacklistReqSerFree(void *msg); #define CsrWifiSmeCalibrationDataGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmeCalibrationDataGetReqSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeCalibrationDataSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeCalibrationDataSetReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeCalibrationDataSetReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeCalibrationDataSetReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeCalibrationDataSetReqSizeof(void *msg); extern void CsrWifiSmeCalibrationDataSetReqSerFree(void *msg); @@ -60,8 +60,8 @@ extern void CsrWifiSmeCalibrationDataSetReqSerFree(void *msg); #define CsrWifiSmeCcxConfigGetReqSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeCcxConfigGetReqSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeCcxConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeCcxConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeCcxConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeCcxConfigSetReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeCcxConfigSetReqSizeof(void *msg); #define CsrWifiSmeCcxConfigSetReqSerFree CsrWifiSmePfree @@ -70,8 +70,8 @@ extern CsrSize CsrWifiSmeCcxConfigSetReqSizeof(void *msg); #define CsrWifiSmeCoexConfigGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmeCoexConfigGetReqSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeCoexConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeCoexConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeCoexConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeCoexConfigSetReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeCoexConfigSetReqSizeof(void *msg); #define CsrWifiSmeCoexConfigSetReqSerFree CsrWifiSmePfree @@ -80,8 +80,8 @@ extern CsrSize CsrWifiSmeCoexConfigSetReqSizeof(void *msg); #define CsrWifiSmeCoexInfoGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmeCoexInfoGetReqSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeConnectReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeConnectReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeConnectReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeConnectReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeConnectReqSizeof(void *msg); extern void CsrWifiSmeConnectReqSerFree(void *msg); @@ -120,13 +120,13 @@ extern void CsrWifiSmeConnectReqSerFree(void *msg); #define CsrWifiSmeHostConfigGetReqSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeHostConfigGetReqSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeHostConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeHostConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeHostConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeHostConfigSetReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeHostConfigSetReqSizeof(void *msg); #define CsrWifiSmeHostConfigSetReqSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeKeyReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeKeyReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeKeyReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeKeyReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeKeyReqSizeof(void *msg); #define CsrWifiSmeKeyReqSerFree CsrWifiSmePfree @@ -140,33 +140,33 @@ extern CsrSize CsrWifiSmeKeyReqSizeof(void *msg); #define CsrWifiSmeMibConfigGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmeMibConfigGetReqSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeMibConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeMibConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeMibConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeMibConfigSetReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeMibConfigSetReqSizeof(void *msg); #define CsrWifiSmeMibConfigSetReqSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeMibGetNextReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeMibGetNextReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeMibGetNextReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeMibGetNextReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeMibGetNextReqSizeof(void *msg); extern void CsrWifiSmeMibGetNextReqSerFree(void *msg); -extern CsrUint8* CsrWifiSmeMibGetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeMibGetReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeMibGetReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeMibGetReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeMibGetReqSizeof(void *msg); extern void CsrWifiSmeMibGetReqSerFree(void *msg); -extern CsrUint8* CsrWifiSmeMibSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeMibSetReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeMibSetReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeMibSetReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeMibSetReqSizeof(void *msg); extern void CsrWifiSmeMibSetReqSerFree(void *msg); -extern CsrUint8* CsrWifiSmeMulticastAddressReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeMulticastAddressReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeMulticastAddressReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeMulticastAddressReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeMulticastAddressReqSizeof(void *msg); extern void CsrWifiSmeMulticastAddressReqSerFree(void *msg); -extern CsrUint8* CsrWifiSmePacketFilterSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmePacketFilterSetReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmePacketFilterSetReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmePacketFilterSetReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmePacketFilterSetReqSizeof(void *msg); extern void CsrWifiSmePacketFilterSetReqSerFree(void *msg); @@ -175,8 +175,8 @@ extern void CsrWifiSmePacketFilterSetReqSerFree(void *msg); #define CsrWifiSmePermanentMacAddressGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmePermanentMacAddressGetReqSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmePmkidReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmePmkidReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmePmkidReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmePmkidReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmePmkidReqSizeof(void *msg); extern void CsrWifiSmePmkidReqSerFree(void *msg); @@ -185,8 +185,8 @@ extern void CsrWifiSmePmkidReqSerFree(void *msg); #define CsrWifiSmePowerConfigGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmePowerConfigGetReqSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmePowerConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmePowerConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmePowerConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmePowerConfigSetReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmePowerConfigSetReqSizeof(void *msg); #define CsrWifiSmePowerConfigSetReqSerFree CsrWifiSmePfree @@ -200,8 +200,8 @@ extern CsrSize CsrWifiSmePowerConfigSetReqSizeof(void *msg); #define CsrWifiSmeRoamingConfigGetReqSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeRoamingConfigGetReqSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeRoamingConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeRoamingConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeRoamingConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeRoamingConfigSetReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeRoamingConfigSetReqSizeof(void *msg); #define CsrWifiSmeRoamingConfigSetReqSerFree CsrWifiSmePfree @@ -210,13 +210,13 @@ extern CsrSize CsrWifiSmeRoamingConfigSetReqSizeof(void *msg); #define CsrWifiSmeScanConfigGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmeScanConfigGetReqSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeScanConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeScanConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeScanConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeScanConfigSetReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeScanConfigSetReqSizeof(void *msg); extern void CsrWifiSmeScanConfigSetReqSerFree(void *msg); -extern CsrUint8* CsrWifiSmeScanFullReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeScanFullReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeScanFullReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeScanFullReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeScanFullReqSizeof(void *msg); extern void CsrWifiSmeScanFullReqSerFree(void *msg); @@ -235,8 +235,8 @@ extern void CsrWifiSmeScanFullReqSerFree(void *msg); #define CsrWifiSmeSmeStaConfigGetReqSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeSmeStaConfigGetReqSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeSmeStaConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeSmeStaConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeSmeStaConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeSmeStaConfigSetReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeSmeStaConfigSetReqSizeof(void *msg); #define CsrWifiSmeSmeStaConfigSetReqSerFree CsrWifiSmePfree @@ -245,8 +245,8 @@ extern CsrSize CsrWifiSmeSmeStaConfigSetReqSizeof(void *msg); #define CsrWifiSmeStationMacAddressGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmeStationMacAddressGetReqSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeTspecReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeTspecReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeTspecReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeTspecReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeTspecReqSizeof(void *msg); extern void CsrWifiSmeTspecReqSerFree(void *msg); @@ -255,8 +255,8 @@ extern void CsrWifiSmeTspecReqSerFree(void *msg); #define CsrWifiSmeVersionsGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmeVersionsGetReqSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeWifiFlightmodeReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeWifiFlightmodeReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeWifiFlightmodeReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeWifiFlightmodeReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeWifiFlightmodeReqSizeof(void *msg); extern void CsrWifiSmeWifiFlightmodeReqSerFree(void *msg); @@ -265,13 +265,13 @@ extern void CsrWifiSmeWifiFlightmodeReqSerFree(void *msg); #define CsrWifiSmeWifiOffReqSizeof CsrWifiEventSizeof #define CsrWifiSmeWifiOffReqSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeWifiOnReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeWifiOnReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeWifiOnReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeWifiOnReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeWifiOnReqSizeof(void *msg); extern void CsrWifiSmeWifiOnReqSerFree(void *msg); -extern CsrUint8* CsrWifiSmeCloakedSsidsSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeCloakedSsidsSetReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeCloakedSsidsSetReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeCloakedSsidsSetReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeCloakedSsidsSetReqSizeof(void *msg); extern void CsrWifiSmeCloakedSsidsSetReqSerFree(void *msg); @@ -285,8 +285,8 @@ extern void CsrWifiSmeCloakedSsidsSetReqSerFree(void *msg); #define CsrWifiSmeSmeCommonConfigGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmeSmeCommonConfigGetReqSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeSmeCommonConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeSmeCommonConfigSetReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeSmeCommonConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeSmeCommonConfigSetReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeSmeCommonConfigSetReqSizeof(void *msg); #define CsrWifiSmeSmeCommonConfigSetReqSerFree CsrWifiSmePfree @@ -295,13 +295,13 @@ extern CsrSize CsrWifiSmeSmeCommonConfigSetReqSizeof(void *msg); #define CsrWifiSmeInterfaceCapabilityGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmeInterfaceCapabilityGetReqSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeWpsConfigurationReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeWpsConfigurationReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeWpsConfigurationReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeWpsConfigurationReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeWpsConfigurationReqSizeof(void *msg); extern void CsrWifiSmeWpsConfigurationReqSerFree(void *msg); -extern CsrUint8* CsrWifiSmeSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeSetReqDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeSetReqSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeSetReqDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeSetReqSizeof(void *msg); extern void CsrWifiSmeSetReqSerFree(void *msg); @@ -310,8 +310,8 @@ extern void CsrWifiSmeSetReqSerFree(void *msg); #define CsrWifiSmeActivateCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeActivateCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeAdhocConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeAdhocConfigGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeAdhocConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeAdhocConfigGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeAdhocConfigGetCfmSizeof(void *msg); #define CsrWifiSmeAdhocConfigGetCfmSerFree CsrWifiSmePfree @@ -320,23 +320,23 @@ extern CsrSize CsrWifiSmeAdhocConfigGetCfmSizeof(void *msg); #define CsrWifiSmeAdhocConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeAdhocConfigSetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeAssociationCompleteIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeAssociationCompleteIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeAssociationCompleteIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeAssociationCompleteIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeAssociationCompleteIndSizeof(void *msg); extern void CsrWifiSmeAssociationCompleteIndSerFree(void *msg); -extern CsrUint8* CsrWifiSmeAssociationStartIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeAssociationStartIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeAssociationStartIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeAssociationStartIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeAssociationStartIndSizeof(void *msg); #define CsrWifiSmeAssociationStartIndSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeBlacklistCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeBlacklistCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeBlacklistCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeBlacklistCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeBlacklistCfmSizeof(void *msg); extern void CsrWifiSmeBlacklistCfmSerFree(void *msg); -extern CsrUint8* CsrWifiSmeCalibrationDataGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeCalibrationDataGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeCalibrationDataGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeCalibrationDataGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeCalibrationDataGetCfmSizeof(void *msg); extern void CsrWifiSmeCalibrationDataGetCfmSerFree(void *msg); @@ -345,18 +345,18 @@ extern void CsrWifiSmeCalibrationDataGetCfmSerFree(void *msg); #define CsrWifiSmeCalibrationDataSetCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeCalibrationDataSetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeCcxConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeCcxConfigGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeCcxConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeCcxConfigGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeCcxConfigGetCfmSizeof(void *msg); #define CsrWifiSmeCcxConfigGetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeCcxConfigSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeCcxConfigSetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeCcxConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeCcxConfigSetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeCcxConfigSetCfmSizeof(void *msg); #define CsrWifiSmeCcxConfigSetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeCoexConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeCoexConfigGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeCoexConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeCoexConfigGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeCoexConfigGetCfmSizeof(void *msg); #define CsrWifiSmeCoexConfigGetCfmSerFree CsrWifiSmePfree @@ -365,33 +365,33 @@ extern CsrSize CsrWifiSmeCoexConfigGetCfmSizeof(void *msg); #define CsrWifiSmeCoexConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeCoexConfigSetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeCoexInfoGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeCoexInfoGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeCoexInfoGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeCoexInfoGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeCoexInfoGetCfmSizeof(void *msg); #define CsrWifiSmeCoexInfoGetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeConnectCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeConnectCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeConnectCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeConnectCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeConnectCfmSizeof(void *msg); #define CsrWifiSmeConnectCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeConnectionConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeConnectionConfigGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeConnectionConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeConnectionConfigGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeConnectionConfigGetCfmSizeof(void *msg); extern void CsrWifiSmeConnectionConfigGetCfmSerFree(void *msg); -extern CsrUint8* CsrWifiSmeConnectionInfoGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeConnectionInfoGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeConnectionInfoGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeConnectionInfoGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeConnectionInfoGetCfmSizeof(void *msg); extern void CsrWifiSmeConnectionInfoGetCfmSerFree(void *msg); -extern CsrUint8* CsrWifiSmeConnectionQualityIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeConnectionQualityIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeConnectionQualityIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeConnectionQualityIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeConnectionQualityIndSizeof(void *msg); #define CsrWifiSmeConnectionQualityIndSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeConnectionStatsGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeConnectionStatsGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeConnectionStatsGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeConnectionStatsGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeConnectionStatsGetCfmSizeof(void *msg); #define CsrWifiSmeConnectionStatsGetCfmSerFree CsrWifiSmePfree @@ -400,8 +400,8 @@ extern CsrSize CsrWifiSmeConnectionStatsGetCfmSizeof(void *msg); #define CsrWifiSmeDeactivateCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeDeactivateCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeDisconnectCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeDisconnectCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeDisconnectCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeDisconnectCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeDisconnectCfmSizeof(void *msg); #define CsrWifiSmeDisconnectCfmSerFree CsrWifiSmePfree @@ -410,38 +410,38 @@ extern CsrSize CsrWifiSmeDisconnectCfmSizeof(void *msg); #define CsrWifiSmeEventMaskSetCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeEventMaskSetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeHostConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeHostConfigGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeHostConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeHostConfigGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeHostConfigGetCfmSizeof(void *msg); #define CsrWifiSmeHostConfigGetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeHostConfigSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeHostConfigSetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeHostConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeHostConfigSetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeHostConfigSetCfmSizeof(void *msg); #define CsrWifiSmeHostConfigSetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeIbssStationIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeIbssStationIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeIbssStationIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeIbssStationIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeIbssStationIndSizeof(void *msg); #define CsrWifiSmeIbssStationIndSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeKeyCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeKeyCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeKeyCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeKeyCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeKeyCfmSizeof(void *msg); #define CsrWifiSmeKeyCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeLinkQualityGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeLinkQualityGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeLinkQualityGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeLinkQualityGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeLinkQualityGetCfmSizeof(void *msg); #define CsrWifiSmeLinkQualityGetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeMediaStatusIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeMediaStatusIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeMediaStatusIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeMediaStatusIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeMediaStatusIndSizeof(void *msg); extern void CsrWifiSmeMediaStatusIndSerFree(void *msg); -extern CsrUint8* CsrWifiSmeMibConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeMibConfigGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeMibConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeMibConfigGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeMibConfigGetCfmSizeof(void *msg); #define CsrWifiSmeMibConfigGetCfmSerFree CsrWifiSmePfree @@ -450,13 +450,13 @@ extern CsrSize CsrWifiSmeMibConfigGetCfmSizeof(void *msg); #define CsrWifiSmeMibConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeMibConfigSetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeMibGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeMibGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeMibGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeMibGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeMibGetCfmSizeof(void *msg); extern void CsrWifiSmeMibGetCfmSerFree(void *msg); -extern CsrUint8* CsrWifiSmeMibGetNextCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeMibGetNextCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeMibGetNextCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeMibGetNextCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeMibGetNextCfmSizeof(void *msg); extern void CsrWifiSmeMibGetNextCfmSerFree(void *msg); @@ -465,38 +465,38 @@ extern void CsrWifiSmeMibGetNextCfmSerFree(void *msg); #define CsrWifiSmeMibSetCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeMibSetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeMicFailureIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeMicFailureIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeMicFailureIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeMicFailureIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeMicFailureIndSizeof(void *msg); #define CsrWifiSmeMicFailureIndSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeMulticastAddressCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeMulticastAddressCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeMulticastAddressCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeMulticastAddressCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeMulticastAddressCfmSizeof(void *msg); extern void CsrWifiSmeMulticastAddressCfmSerFree(void *msg); -extern CsrUint8* CsrWifiSmePacketFilterSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmePacketFilterSetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmePacketFilterSetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmePacketFilterSetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmePacketFilterSetCfmSizeof(void *msg); #define CsrWifiSmePacketFilterSetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmePermanentMacAddressGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmePermanentMacAddressGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmePermanentMacAddressGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmePermanentMacAddressGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmePermanentMacAddressGetCfmSizeof(void *msg); #define CsrWifiSmePermanentMacAddressGetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmePmkidCandidateListIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmePmkidCandidateListIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmePmkidCandidateListIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmePmkidCandidateListIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmePmkidCandidateListIndSizeof(void *msg); extern void CsrWifiSmePmkidCandidateListIndSerFree(void *msg); -extern CsrUint8* CsrWifiSmePmkidCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmePmkidCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmePmkidCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmePmkidCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmePmkidCfmSizeof(void *msg); extern void CsrWifiSmePmkidCfmSerFree(void *msg); -extern CsrUint8* CsrWifiSmePowerConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmePowerConfigGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmePowerConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmePowerConfigGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmePowerConfigGetCfmSizeof(void *msg); #define CsrWifiSmePowerConfigGetCfmSerFree CsrWifiSmePfree @@ -505,33 +505,33 @@ extern CsrSize CsrWifiSmePowerConfigGetCfmSizeof(void *msg); #define CsrWifiSmePowerConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmePowerConfigSetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeRegulatoryDomainInfoGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeRegulatoryDomainInfoGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeRegulatoryDomainInfoGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeRegulatoryDomainInfoGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeRegulatoryDomainInfoGetCfmSizeof(void *msg); #define CsrWifiSmeRegulatoryDomainInfoGetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeRoamCompleteIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeRoamCompleteIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeRoamCompleteIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeRoamCompleteIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeRoamCompleteIndSizeof(void *msg); #define CsrWifiSmeRoamCompleteIndSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeRoamStartIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeRoamStartIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeRoamStartIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeRoamStartIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeRoamStartIndSizeof(void *msg); #define CsrWifiSmeRoamStartIndSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeRoamingConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeRoamingConfigGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeRoamingConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeRoamingConfigGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeRoamingConfigGetCfmSizeof(void *msg); #define CsrWifiSmeRoamingConfigGetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeRoamingConfigSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeRoamingConfigSetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeRoamingConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeRoamingConfigSetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeRoamingConfigSetCfmSizeof(void *msg); #define CsrWifiSmeRoamingConfigSetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeScanConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeScanConfigGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeScanConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeScanConfigGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeScanConfigGetCfmSizeof(void *msg); extern void CsrWifiSmeScanConfigGetCfmSerFree(void *msg); @@ -545,8 +545,8 @@ extern void CsrWifiSmeScanConfigGetCfmSerFree(void *msg); #define CsrWifiSmeScanFullCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeScanFullCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeScanResultIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeScanResultIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeScanResultIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeScanResultIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeScanResultIndSizeof(void *msg); extern void CsrWifiSmeScanResultIndSerFree(void *msg); @@ -555,38 +555,38 @@ extern void CsrWifiSmeScanResultIndSerFree(void *msg); #define CsrWifiSmeScanResultsFlushCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeScanResultsFlushCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeScanResultsGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeScanResultsGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeScanResultsGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeScanResultsGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeScanResultsGetCfmSizeof(void *msg); extern void CsrWifiSmeScanResultsGetCfmSerFree(void *msg); -extern CsrUint8* CsrWifiSmeSmeStaConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeSmeStaConfigGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeSmeStaConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeSmeStaConfigGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeSmeStaConfigGetCfmSizeof(void *msg); #define CsrWifiSmeSmeStaConfigGetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeSmeStaConfigSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeSmeStaConfigSetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeSmeStaConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeSmeStaConfigSetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeSmeStaConfigSetCfmSizeof(void *msg); #define CsrWifiSmeSmeStaConfigSetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeStationMacAddressGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeStationMacAddressGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeStationMacAddressGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeStationMacAddressGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeStationMacAddressGetCfmSizeof(void *msg); #define CsrWifiSmeStationMacAddressGetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeTspecIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeTspecIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeTspecIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeTspecIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeTspecIndSizeof(void *msg); extern void CsrWifiSmeTspecIndSerFree(void *msg); -extern CsrUint8* CsrWifiSmeTspecCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeTspecCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeTspecCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeTspecCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeTspecCfmSizeof(void *msg); extern void CsrWifiSmeTspecCfmSerFree(void *msg); -extern CsrUint8* CsrWifiSmeVersionsGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeVersionsGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeVersionsGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeVersionsGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeVersionsGetCfmSizeof(void *msg); extern void CsrWifiSmeVersionsGetCfmSerFree(void *msg); @@ -615,18 +615,18 @@ extern void CsrWifiSmeVersionsGetCfmSerFree(void *msg); #define CsrWifiSmeCloakedSsidsSetCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeCloakedSsidsSetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeCloakedSsidsGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeCloakedSsidsGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeCloakedSsidsGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeCloakedSsidsGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeCloakedSsidsGetCfmSizeof(void *msg); extern void CsrWifiSmeCloakedSsidsGetCfmSerFree(void *msg); -extern CsrUint8* CsrWifiSmeWifiOnIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeWifiOnIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeWifiOnIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeWifiOnIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeWifiOnIndSizeof(void *msg); #define CsrWifiSmeWifiOnIndSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeSmeCommonConfigGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeSmeCommonConfigGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeSmeCommonConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeSmeCommonConfigGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeSmeCommonConfigGetCfmSizeof(void *msg); #define CsrWifiSmeSmeCommonConfigGetCfmSerFree CsrWifiSmePfree @@ -635,23 +635,23 @@ extern CsrSize CsrWifiSmeSmeCommonConfigGetCfmSizeof(void *msg); #define CsrWifiSmeSmeCommonConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeSmeCommonConfigSetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeInterfaceCapabilityGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeInterfaceCapabilityGetCfmDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeInterfaceCapabilityGetCfmSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeInterfaceCapabilityGetCfmDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeInterfaceCapabilityGetCfmSizeof(void *msg); #define CsrWifiSmeInterfaceCapabilityGetCfmSerFree CsrWifiSmePfree -extern CsrUint8* CsrWifiSmeErrorIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeErrorIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeErrorIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeErrorIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeErrorIndSizeof(void *msg); extern void CsrWifiSmeErrorIndSerFree(void *msg); -extern CsrUint8* CsrWifiSmeInfoIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeInfoIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeInfoIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeInfoIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeInfoIndSizeof(void *msg); extern void CsrWifiSmeInfoIndSerFree(void *msg); -extern CsrUint8* CsrWifiSmeCoreDumpIndSer(CsrUint8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeCoreDumpIndDes(CsrUint8 *buffer, CsrSize len); +extern u8* CsrWifiSmeCoreDumpIndSer(u8 *ptr, CsrSize *len, void *msg); +extern void* CsrWifiSmeCoreDumpIndDes(u8 *buffer, CsrSize len); extern CsrSize CsrWifiSmeCoreDumpIndSizeof(void *msg); extern void CsrWifiSmeCoreDumpIndSerFree(void *msg); diff --git a/drivers/staging/csr/csr_wifi_vif_utils.h b/drivers/staging/csr/csr_wifi_vif_utils.h index c534588..ee8b438 100644 --- a/drivers/staging/csr/csr_wifi_vif_utils.h +++ b/drivers/staging/csr/csr_wifi_vif_utils.h @@ -24,7 +24,7 @@ extern "C" { /* MACROS *******************************************************************/ /* Common macros for NME and SME to be used temporarily until SoftMAC changes are made */ -#define CSR_WIFI_NUM_INTERFACES (CsrUint8)0x1 +#define CSR_WIFI_NUM_INTERFACES (u8)0x1 #define CSR_WIFI_INTERFACE_IN_USE (CsrUint16)0x0 /* This is used at places where interface Id isn't available*/ @@ -37,7 +37,7 @@ extern "C" { /* Extract the Interface Id from the event */ #define CsrWifiVifUtilsGetVifTagFromEvent(msg) \ - ((CsrUint16) * ((CsrUint16 *) ((CsrUint8 *) (msg) + sizeof(CsrWifiFsmEvent)))) + ((CsrUint16) * ((CsrUint16 *) ((u8 *) (msg) + sizeof(CsrWifiFsmEvent)))) /* The HPI Vif combines the type and the interface id */ #define CsrWifiVifUtilsGetVifTagFromHipEvent(msg) \ @@ -58,16 +58,16 @@ extern "C" { * First checks if the mode is supported capability bitmap of the interface. * If this succeeds, then checks if running this mode on this interface is allowed. * - * @param[in] CsrUint8 : interface capability bitmap - * @param[in] CsrUint8* : pointer to the array of current interface modes + * @param[in] u8 : interface capability bitmap + * @param[in] u8* : pointer to the array of current interface modes * @param[in] CsrUint16 : interfaceTag * @param[in] CsrWifiInterfaceMode : mode * * @return * CsrBool : returns true if the interface is allowed to operate in the mode otherwise false. */ -extern CsrBool CsrWifiVifUtilsCheckCompatibility(CsrUint8 interfaceCapability, - CsrUint8 *currentInterfaceModes, +extern CsrBool CsrWifiVifUtilsCheckCompatibility(u8 interfaceCapability, + u8 *currentInterfaceModes, CsrUint16 interfaceTag, CsrWifiInterfaceMode mode); diff --git a/drivers/staging/csr/netdev.c b/drivers/staging/csr/netdev.c index 55149df..e18395c 100644 --- a/drivers/staging/csr/netdev.c +++ b/drivers/staging/csr/netdev.c @@ -913,7 +913,7 @@ get_packet_priority(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr CSR_PRIORITY priority = CSR_CONTENTION; const int proto = ntohs(ehdr->h_proto); - CsrUint8 interfaceMode = interfacePriv->interfaceMode; + u8 interfaceMode = interfacePriv->interfaceMode; func_enter(); @@ -1088,7 +1088,7 @@ _identify_sme_ma_pkt_ind(unifi_priv_t *priv, { CSR_MA_PACKET_INDICATION *pkt_ind = (CSR_MA_PACKET_INDICATION*)&signal->u.MaPacketIndication; int r; - CsrUint8 i; + u8 i; unifi_trace(priv, UDBG5, "_identify_sme_ma_pkt_ind -->\n"); @@ -1141,7 +1141,7 @@ _identify_sme_ma_pkt_ind(unifi_priv_t *priv, i, pkt_ind->ReceptionStatus, bulkdata->d[0].data_length, - (CsrUint8*)bulkdata->d[0].os_data_ptr, + (u8*)bulkdata->d[0].os_data_ptr, NULL, pkt_ind->Rssi, pkt_ind->Snr, @@ -1369,19 +1369,19 @@ int prepare_and_add_macheader(unifi_priv_t *priv, struct sk_buff *skb, struct sk CSR_PRIORITY priority, bulk_data_param_t *bulkdata, CsrUint16 interfaceTag, - const CsrUint8 *daddr, - const CsrUint8 *saddr, + const u8 *daddr, + const u8 *saddr, CsrBool protection) { CsrUint16 fc = 0; - CsrUint8 qc = 0; - CsrUint8 macHeaderLengthInBytes = MAC_HEADER_SIZE, *bufPtr = NULL; + u8 qc = 0; + u8 macHeaderLengthInBytes = MAC_HEADER_SIZE, *bufPtr = NULL; bulk_data_param_t data_ptrs; CsrResult csrResult; int headroom =0; - CsrUint8 direction = 0; + u8 direction = 0; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - CsrUint8 *addressOne; + u8 *addressOne; CsrBool bQosNull = false; if (skb == NULL) { @@ -1478,14 +1478,14 @@ int prepare_and_add_macheader(unifi_priv_t *priv, struct sk_buff *skb, struct sk bulkdata->d[0].os_net_buf_ptr = (unsigned char*)newSkb; bulkdata->d[0].data_length = newSkb->len; - bufPtr = (CsrUint8*)data_ptrs.d[0].os_data_ptr; + bufPtr = (u8*)data_ptrs.d[0].os_data_ptr; /* The old skb will not be used again */ kfree_skb(skb); } else { /* headroom has sufficient size, so will get proper pointer */ - bufPtr = (CsrUint8*)skb_push(skb, macHeaderLengthInBytes); + bufPtr = (u8*)skb_push(skb, macHeaderLengthInBytes); bulkdata->d[0].os_data_ptr = skb->data; bulkdata->d[0].os_net_buf_ptr = (unsigned char*)skb; bulkdata->d[0].data_length = skb->len; @@ -1753,7 +1753,7 @@ send_ma_pkt_request(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr * the Address 1 field of 802.11 Mac header here 4 is: (sizeof(framecontrol) + sizeof (durationID)) * which is address 1 field */ - memcpy(peerAddress.a, ((CsrUint8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN); + memcpy(peerAddress.a, ((u8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN); unifi_trace(priv, UDBG5, "RA[0]=%x, RA[1]=%x, RA[2]=%x, RA[3]=%x, RA[4]=%x, RA[5]=%x\n", peerAddress.a[0],peerAddress.a[1], peerAddress.a[2], peerAddress.a[3], @@ -1792,7 +1792,7 @@ send_ma_pkt_request(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr req->TransmitRate = 0; req->HostTag = CSR_WIFI_EAPOL_M4_HOST_TAG; /* RA address matching with address 1 of Mac header */ - memcpy(req->Ra.x, ((CsrUint8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN); + memcpy(req->Ra.x, ((u8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN); spin_lock(&priv->m4_lock); /* Store the M4-PACKET.req for later */ @@ -1841,7 +1841,7 @@ send_ma_pkt_request(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr req->TransmitRate = (CSR_RATE) 0; /* rate selected by firmware */ req->HostTag = 0xffffffff; /* Ask for a new HostTag */ /* RA address matching with address 1 of Mac header */ - memcpy(req->Ra.x, ((CsrUint8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN); + memcpy(req->Ra.x, ((u8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN); /* Store the M4-PACKET.req for later */ spin_lock(&priv->wapi_lock); @@ -2150,7 +2150,7 @@ unifi_restart_xmit(void *ospriv, unifi_TrafficQueue queue) static void -indicate_rx_skb(unifi_priv_t *priv, CsrUint16 ifTag, CsrUint8* dst_a, CsrUint8* src_a, struct sk_buff *skb, CSR_SIGNAL *signal, +indicate_rx_skb(unifi_priv_t *priv, CsrUint16 ifTag, u8* dst_a, u8* src_a, struct sk_buff *skb, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata) { int r, sr = 0; @@ -2392,12 +2392,12 @@ unifi_rx(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata) const CSR_MA_PACKET_INDICATION *pkt_ind = &signal->u.MaPacketIndication; struct sk_buff *skb; CsrWifiRouterCtrlPortAction port_action; - CsrUint8 dataFrameType; + u8 dataFrameType; int proto; int queue; - CsrUint8 da[ETH_ALEN], sa[ETH_ALEN]; - CsrUint8 toDs, fromDs, frameType, macHeaderLengthInBytes = MAC_HEADER_SIZE; + u8 da[ETH_ALEN], sa[ETH_ALEN]; + u8 toDs, fromDs, frameType, macHeaderLengthInBytes = MAC_HEADER_SIZE; CsrUint16 frameControl; netInterface_priv_t *interfacePriv; struct ethhdr ehdr; @@ -2738,15 +2738,15 @@ static void process_ma_packet_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_d struct sk_buff *skb; CsrUint16 frameControl; netInterface_priv_t *interfacePriv; - CsrUint8 da[ETH_ALEN], sa[ETH_ALEN]; - CsrUint8 *bssid = NULL, *ba_addr = NULL; - CsrUint8 toDs, fromDs, frameType; - CsrUint8 i =0; + u8 da[ETH_ALEN], sa[ETH_ALEN]; + u8 *bssid = NULL, *ba_addr = NULL; + u8 toDs, fromDs, frameType; + u8 i =0; #ifdef CSR_SUPPORT_SME - CsrUint8 dataFrameType = 0; + u8 dataFrameType = 0; CsrBool powerSaveChanged = FALSE; - CsrUint8 pmBit = 0; + u8 pmBit = 0; CsrWifiRouterCtrlStaInfo_t *srcStaInfo = NULL; CsrUint16 qosControl; @@ -2812,7 +2812,7 @@ static void process_ma_packet_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_d } else { - bssid = (CsrUint8 *) (skb->data + 4 + 12 - (fromDs * 6) - (toDs * 12)); + bssid = (u8 *) (skb->data + 4 + 12 - (fromDs * 6) - (toDs * 12)); } pData = &bulkdata->d[0]; @@ -2827,7 +2827,7 @@ static void process_ma_packet_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_d if((frameControl & 0x00f0) == 0x00A0){ /* This is a PS-POLL request */ - CsrUint8 pmBit = (frameControl & 0x1000)?0x01:0x00; + u8 pmBit = (frameControl & 0x1000)?0x01:0x00; unifi_trace(priv, UDBG6, "%s: Received PS-POLL Frame\n", __FUNCTION__); uf_process_ps_poll(priv,sa,da,pmBit,interfaceTag); @@ -2908,10 +2908,10 @@ static void process_ma_packet_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_d #endif if( ((frameControl & 0x00f0) >> 4) == QOS_DATA) { - CsrUint8 *qos_control_ptr = (CsrUint8*)bulkdata->d[0].os_data_ptr + (((frameControl & IEEE802_11_FC_TO_DS_MASK) && (frameControl & IEEE802_11_FC_FROM_DS_MASK))?30: 24); + u8 *qos_control_ptr = (u8*)bulkdata->d[0].os_data_ptr + (((frameControl & IEEE802_11_FC_TO_DS_MASK) && (frameControl & IEEE802_11_FC_FROM_DS_MASK))?30: 24); int tID = *qos_control_ptr & IEEE802_11_QC_TID_MASK; /* using ls octet of qos control */ ba_session_rx_struct *ba_session; - CsrUint8 ba_session_idx = 0; + u8 ba_session_idx = 0; /* Get the BA originator address */ if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO){ @@ -3622,12 +3622,12 @@ static void CsrUint32 offset; CsrUint32 length = bulkdata->d[0].data_length; CsrUint32 subframe_length, subframe_body_length, dot11_hdr_size; - CsrUint8 *ptr; + u8 *ptr; bulk_data_param_t subframe_bulkdata; - CsrUint8 *dot11_hdr_ptr = (CsrUint8*)bulkdata->d[0].os_data_ptr; + u8 *dot11_hdr_ptr = (u8*)bulkdata->d[0].os_data_ptr; CsrResult csrResult; CsrUint16 frameControl; - CsrUint8 *qos_control_ptr; + u8 *qos_control_ptr; frameControl = le16_to_cpu(*((CsrUint16*)dot11_hdr_ptr)); qos_control_ptr = dot11_hdr_ptr + (((frameControl & IEEE802_11_FC_TO_DS_MASK) && (frameControl & IEEE802_11_FC_FROM_DS_MASK))?30: 24); @@ -3657,20 +3657,20 @@ static void break; } - memcpy((CsrUint8*)subframe_bulkdata.d[0].os_data_ptr, dot11_hdr_ptr, dot11_hdr_size); + memcpy((u8*)subframe_bulkdata.d[0].os_data_ptr, dot11_hdr_ptr, dot11_hdr_size); /* When to DS=0 and from DS=0, address 3 will already have BSSID so no need to re-program */ if ((frameControl & IEEE802_11_FC_TO_DS_MASK) && !(frameControl & IEEE802_11_FC_FROM_DS_MASK)){ - memcpy((CsrUint8*)subframe_bulkdata.d[0].os_data_ptr + IEEE802_11_ADDR3_OFFSET, ((struct ethhdr*)ptr)->h_dest, ETH_ALEN); + memcpy((u8*)subframe_bulkdata.d[0].os_data_ptr + IEEE802_11_ADDR3_OFFSET, ((struct ethhdr*)ptr)->h_dest, ETH_ALEN); } else if (!(frameControl & IEEE802_11_FC_TO_DS_MASK) && (frameControl & IEEE802_11_FC_FROM_DS_MASK)){ - memcpy((CsrUint8*)subframe_bulkdata.d[0].os_data_ptr + IEEE802_11_ADDR3_OFFSET, + memcpy((u8*)subframe_bulkdata.d[0].os_data_ptr + IEEE802_11_ADDR3_OFFSET, ((struct ethhdr*)ptr)->h_source, ETH_ALEN); } - memcpy((CsrUint8*)subframe_bulkdata.d[0].os_data_ptr + dot11_hdr_size, + memcpy((u8*)subframe_bulkdata.d[0].os_data_ptr + dot11_hdr_size, ptr + sizeof(struct ethhdr), subframe_body_length); unifi_trace(priv, UDBG6, "%s: calling unifi_rx. length = %d subframe_length = %d\n", __FUNCTION__, length, subframe_length); @@ -3845,7 +3845,7 @@ static void process_ba_frame(unifi_priv_t *priv, static void process_ba_complete(unifi_priv_t *priv, netInterface_priv_t *interfacePriv) { frame_desc_struct *frame_desc; - CsrUint8 i; + u8 i; for(i = 0; i < interfacePriv->ba_complete_index; i++) { frame_desc = &interfacePriv->ba_complete[i]; @@ -3867,13 +3867,13 @@ static void check_ba_frame_age_timeout( unifi_priv_t *priv, { CsrTime now; CsrTime age; - CsrUint8 i, j; + u8 i, j; CsrUint16 sn_temp; /* gap is started at 1 because we have buffered frames and * hence a minimum gap of 1 exists */ - CsrUint8 gap=1; + u8 gap=1; now = CsrTimeGet(NULL); @@ -3945,7 +3945,7 @@ static void process_ma_packet_error_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, const CSR_MA_PACKET_ERROR_INDICATION *pkt_err_ind = &signal->u.MaPacketErrorIndication; netInterface_priv_t *interfacePriv; ba_session_rx_struct *ba_session; - CsrUint8 ba_session_idx = 0; + u8 ba_session_idx = 0; CSR_PRIORITY UserPriority; CSR_SEQUENCE_NUMBER sn; diff --git a/drivers/staging/csr/putest.c b/drivers/staging/csr/putest.c index 22614e7..676c8f6 100644 --- a/drivers/staging/csr/putest.c +++ b/drivers/staging/csr/putest.c @@ -24,15 +24,15 @@ int unifi_putest_cmd52_read(unifi_priv_t *priv, unsigned char *arg) { struct unifi_putest_cmd52 cmd52_params; - CsrUint8 *arg_pos; + u8 *arg_pos; unsigned int cmd_param_size; int r; CsrResult csrResult; unsigned char ret_buffer[32]; - CsrUint8 *ret_buffer_pos; - CsrUint8 retries; + u8 *ret_buffer_pos; + u8 retries; - arg_pos = (CsrUint8*)(((unifi_putest_command_t*)arg) + 1); + arg_pos = (u8*)(((unifi_putest_command_t*)arg) + 1); if (get_user(cmd_param_size, (int*)arg_pos)) { unifi_error(priv, "unifi_putest_cmd52_read: Failed to get the argument\n"); @@ -77,7 +77,7 @@ int unifi_putest_cmd52_read(unifi_priv_t *priv, unsigned char *arg) /* Copy the info to the out buffer */ *(unifi_putest_command_t*)ret_buffer = UNIFI_PUTEST_CMD52_READ; - ret_buffer_pos = (CsrUint8*)(((unifi_putest_command_t*)ret_buffer) + 1); + ret_buffer_pos = (u8*)(((unifi_putest_command_t*)ret_buffer) + 1); *(unsigned int*)ret_buffer_pos = sizeof(struct unifi_putest_cmd52); ret_buffer_pos += sizeof(unsigned int); memcpy(ret_buffer_pos, &cmd52_params, sizeof(struct unifi_putest_cmd52)); @@ -99,12 +99,12 @@ int unifi_putest_cmd52_read(unifi_priv_t *priv, unsigned char *arg) int unifi_putest_cmd52_write(unifi_priv_t *priv, unsigned char *arg) { struct unifi_putest_cmd52 cmd52_params; - CsrUint8 *arg_pos; + u8 *arg_pos; unsigned int cmd_param_size; CsrResult csrResult; - CsrUint8 retries; + u8 retries; - arg_pos = (CsrUint8*)(((unifi_putest_command_t*)arg) + 1); + arg_pos = (u8*)(((unifi_putest_command_t*)arg) + 1); if (get_user(cmd_param_size, (int*)arg_pos)) { unifi_error(priv, "unifi_putest_cmd52_write: Failed to get the argument\n"); @@ -152,14 +152,14 @@ int unifi_putest_cmd52_write(unifi_priv_t *priv, unsigned char *arg) int unifi_putest_gp_read16(unifi_priv_t *priv, unsigned char *arg) { struct unifi_putest_gp_rw16 gp_r16_params; - CsrUint8 *arg_pos; + u8 *arg_pos; unsigned int cmd_param_size; int r; CsrResult csrResult; unsigned char ret_buffer[32]; - CsrUint8 *ret_buffer_pos; + u8 *ret_buffer_pos; - arg_pos = (CsrUint8*)(((unifi_putest_command_t*)arg) + 1); + arg_pos = (u8*)(((unifi_putest_command_t*)arg) + 1); if (get_user(cmd_param_size, (int*)arg_pos)) { unifi_error(priv, "unifi_putest_gp_read16: Failed to get the argument\n"); @@ -193,7 +193,7 @@ int unifi_putest_gp_read16(unifi_priv_t *priv, unsigned char *arg) /* Copy the info to the out buffer */ *(unifi_putest_command_t*)ret_buffer = UNIFI_PUTEST_GP_READ16; - ret_buffer_pos = (CsrUint8*)(((unifi_putest_command_t*)ret_buffer) + 1); + ret_buffer_pos = (u8*)(((unifi_putest_command_t*)ret_buffer) + 1); *(unsigned int*)ret_buffer_pos = sizeof(struct unifi_putest_gp_rw16); ret_buffer_pos += sizeof(unsigned int); memcpy(ret_buffer_pos, &gp_r16_params, sizeof(struct unifi_putest_gp_rw16)); @@ -214,11 +214,11 @@ int unifi_putest_gp_read16(unifi_priv_t *priv, unsigned char *arg) int unifi_putest_gp_write16(unifi_priv_t *priv, unsigned char *arg) { struct unifi_putest_gp_rw16 gp_w16_params; - CsrUint8 *arg_pos; + u8 *arg_pos; unsigned int cmd_param_size; CsrResult csrResult; - arg_pos = (CsrUint8*)(((unifi_putest_command_t*)arg) + 1); + arg_pos = (u8*)(((unifi_putest_command_t*)arg) + 1); if (get_user(cmd_param_size, (int*)arg_pos)) { unifi_error(priv, "unifi_putest_gp_write16: Failed to get the argument\n"); @@ -629,12 +629,12 @@ int unifi_putest_coredump_prepare(unifi_priv_t *priv, unsigned char *arg) int unifi_putest_cmd52_block_read(unifi_priv_t *priv, unsigned char *arg) { struct unifi_putest_block_cmd52_r block_cmd52; - CsrUint8 *arg_pos; + u8 *arg_pos; unsigned int cmd_param_size; CsrResult r; - CsrUint8 *block_local_buffer; + u8 *block_local_buffer; - arg_pos = (CsrUint8*)(((unifi_putest_command_t*)arg) + 1); + arg_pos = (u8*)(((unifi_putest_command_t*)arg) + 1); if (get_user(cmd_param_size, (int*)arg_pos)) { unifi_error(priv, "cmd52r_block: Failed to get the argument\n"); diff --git a/drivers/staging/csr/sdio_mmc.c b/drivers/staging/csr/sdio_mmc.c index 24be087..f95a57f 100644 --- a/drivers/staging/csr/sdio_mmc.c +++ b/drivers/staging/csr/sdio_mmc.c @@ -144,7 +144,7 @@ csr_io_rw_direct(struct mmc_card *card, int write, uint8_t fn, CsrResult -CsrSdioRead8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data) +CsrSdioRead8(CsrSdioFunction *function, CsrUint32 address, u8 *data) { struct sdio_func *func = (struct sdio_func *)function->priv; int err = 0; @@ -162,7 +162,7 @@ CsrSdioRead8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data) } /* CsrSdioRead8() */ CsrResult -CsrSdioWrite8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data) +CsrSdioWrite8(CsrSdioFunction *function, CsrUint32 address, u8 data) { struct sdio_func *func = (struct sdio_func *)function->priv; int err = 0; @@ -234,7 +234,7 @@ CsrSdioWrite16(CsrSdioFunction *function, CsrUint32 address, CsrUint16 data) CsrResult -CsrSdioF0Read8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data) +CsrSdioF0Read8(CsrSdioFunction *function, CsrUint32 address, u8 *data) { struct sdio_func *func = (struct sdio_func *)function->priv; int err = 0; @@ -256,7 +256,7 @@ CsrSdioF0Read8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data) } /* CsrSdioF0Read8() */ CsrResult -CsrSdioF0Write8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data) +CsrSdioF0Write8(CsrSdioFunction *function, CsrUint32 address, u8 data) { struct sdio_func *func = (struct sdio_func *)function->priv; int err = 0; diff --git a/drivers/staging/csr/sme_mgt.c b/drivers/staging/csr/sme_mgt.c index c27c0a7..28295ef 100644 --- a/drivers/staging/csr/sme_mgt.c +++ b/drivers/staging/csr/sme_mgt.c @@ -126,7 +126,7 @@ void CsrWifiSmeScanResultsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) CsrWifiSmeScanResultsGetCfm* cfm = (CsrWifiSmeScanResultsGetCfm*)msg; int bytesRequired = cfm->scanResultsCount * sizeof(CsrWifiSmeScanResult); int i; - CsrUint8* current_buff; + u8* current_buff; CsrWifiSmeScanResult* scanCopy; if (priv == NULL) { @@ -145,7 +145,7 @@ void CsrWifiSmeScanResultsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) memcpy(scanCopy, cfm->scanResults, sizeof(CsrWifiSmeScanResult) * cfm->scanResultsCount); /* Take a Copy of the Info Elements AND update the scan result pointers */ - current_buff = (CsrUint8*)&scanCopy[cfm->scanResultsCount]; + current_buff = (u8*)&scanCopy[cfm->scanResultsCount]; for (i = 0; i < cfm->scanResultsCount; ++i) { CsrWifiSmeScanResult *scan_result = &scanCopy[i]; diff --git a/drivers/staging/csr/sme_sys.c b/drivers/staging/csr/sme_sys.c index 5f38f9d..a84d99f 100644 --- a/drivers/staging/csr/sme_sys.c +++ b/drivers/staging/csr/sme_sys.c @@ -63,7 +63,7 @@ void send_auto_ma_packet_confirm(unifi_priv_t *priv, int client_id; CSR_SIGNAL unpacked_signal; - CsrUint8 sigbuf[UNIFI_PACKED_SIGBUF_SIZE]; + u8 sigbuf[UNIFI_PACKED_SIGBUF_SIZE]; CsrUint16 packed_siglen; @@ -111,7 +111,7 @@ void send_auto_ma_packet_confirm(unifi_priv_t *priv, CsrWifiRouterCtrlHipIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, packed_siglen, - (CsrUint8 *)sigbuf, + (u8 *)sigbuf, 0, NULL, 0, NULL); } @@ -406,7 +406,7 @@ uf_send_gratuitous_arp(unifi_priv_t *priv, CsrUint16 interfaceTag) struct sk_buff *skb, *newSkb = NULL; CsrInt8 protection; int r; - static const CsrUint8 arp_req[36] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, + static const u8 arp_req[36] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, 0x08, 0x06, 0x00, 0x01, 0x08, 0x00, 0x06, 0x04, 0x00, 0x01, 0x00, 0x02, 0x5f, 0x20, 0x2f, 0x02, 0xc0, 0xa8, 0x00, 0x02, @@ -506,7 +506,7 @@ configure_data_port(unifi_priv_t *priv, const int queue, CsrUint16 interfaceTag) { - const CsrUint8 broadcast_mac_address[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; + const u8 broadcast_mac_address[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; unifi_port_config_t *port; netInterface_priv_t *interfacePriv; int i; @@ -686,7 +686,7 @@ void CsrWifiRouterCtrlPortConfigureReqHandler(void* drvpriv, CsrWifiFsmEvent* ms case CSR_WIFI_ROUTER_CTRL_MODE_AP: case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: { - CsrUint8 i; + u8 i; CsrWifiRouterCtrlStaInfo_t *staRecord; /* Ifscontrolled port is open means, The peer has been added to station record * so that the protection corresponding to the peer is valid in this req @@ -1212,7 +1212,7 @@ void CsrWifiRouterMaPacketSubscribeReqHandler(void* drvpriv, CsrWifiFsmEvent* ms { unifi_priv_t *priv = (unifi_priv_t*)drvpriv; CsrWifiRouterMaPacketSubscribeReq* req = (CsrWifiRouterMaPacketSubscribeReq*)msg; - CsrUint8 i; + u8 i; CsrResult result; if (priv == NULL) { @@ -1232,9 +1232,9 @@ void CsrWifiRouterMaPacketSubscribeReqHandler(void* drvpriv, CsrWifiFsmEvent* ms priv->sme_unidata_ind_filters[i].encapsulation = req->encapsulation; priv->sme_unidata_ind_filters[i].protocol = req->protocol; - priv->sme_unidata_ind_filters[i].oui[2] = (CsrUint8) (req->oui & 0xFF); - priv->sme_unidata_ind_filters[i].oui[1] = (CsrUint8) ((req->oui >> 8) & 0xFF); - priv->sme_unidata_ind_filters[i].oui[0] = (CsrUint8) ((req->oui >> 16) & 0xFF); + priv->sme_unidata_ind_filters[i].oui[2] = (u8) (req->oui & 0xFF); + priv->sme_unidata_ind_filters[i].oui[1] = (u8) ((req->oui >> 8) & 0xFF); + priv->sme_unidata_ind_filters[i].oui[0] = (u8) ((req->oui >> 16) & 0xFF); result = CSR_RESULT_SUCCESS; break; @@ -1353,8 +1353,8 @@ void CsrWifiRouterCtrlTrafficClassificationReqHandler(void* drvpriv, CsrWifiFsmE static int _sys_packet_req(unifi_priv_t *priv, const CSR_SIGNAL *signal, - CsrUint8 subscriptionHandle, - CsrUint16 frameLength, CsrUint8 *frame, + u8 subscriptionHandle, + CsrUint16 frameLength, u8 *frame, int proto) { int r; @@ -1502,7 +1502,7 @@ void CsrWifiRouterMaPacketReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) CSR_SIGNAL signal; CSR_MA_PACKET_REQUEST *req = &signal.u.MaPacketRequest; CsrWifiRouterCtrlPortAction controlPortaction; - CsrUint8 *daddr, *saddr; + u8 *daddr, *saddr; CsrUint16 interfaceTag = mareq->interfaceTag & 0x00ff; int queue; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; @@ -1640,7 +1640,7 @@ void CsrWifiRouterCtrlM4TransmitReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) /* reset the station records when the mode is set as CSR_WIFI_ROUTER_CTRL_MODE_NONE */ static void CsrWifiRouterCtrlResetStationRecordList(unifi_priv_t *priv, CsrUint16 interfaceTag) { - CsrUint8 i,j; + u8 i,j; CsrWifiRouterCtrlStaInfo_t *staInfo=NULL; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; unsigned long lock_flags; @@ -1798,7 +1798,7 @@ void CsrWifiRouterCtrlModeSetReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) { netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; #ifdef CSR_WIFI_SPLIT_PATCH - CsrUint8 old_mode = interfacePriv->interfaceMode; + u8 old_mode = interfacePriv->interfaceMode; #endif unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlModeSetReqHandler: interfacePriv->interfaceMode = %d\n", interfacePriv->interfaceMode); @@ -1914,13 +1914,13 @@ void CsrWifiRouterMaPacketResHandler(void* drvpriv, CsrWifiFsmEvent* msg) /* delete the station record from the station record data base */ static int peer_delete_record(unifi_priv_t *priv, CsrWifiRouterCtrlPeerDelReq *req) { - CsrUint8 j; + u8 j; CsrWifiRouterCtrlStaInfo_t *staInfo = NULL; unifi_port_config_t *controlledPort; unifi_port_config_t *unControlledPort; netInterface_priv_t *interfacePriv; - CsrUint8 ba_session_idx = 0; + u8 ba_session_idx = 0; ba_session_rx_struct *ba_session_rx = NULL; ba_session_tx_struct *ba_session_tx = NULL; @@ -2100,7 +2100,7 @@ void CsrWifiRouterCtrlPeerDelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) /* Add the new station to the station record data base */ static int peer_add_new_record(unifi_priv_t *priv,CsrWifiRouterCtrlPeerAddReq *req,CsrUint32 *handle) { - CsrUint8 i, powerModeTemp = 0; + u8 i, powerModeTemp = 0; CsrBool freeSlotFound = FALSE; CsrWifiRouterCtrlStaInfo_t *newRecord = NULL; netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; @@ -2157,7 +2157,7 @@ static int peer_add_new_record(unifi_priv_t *priv,CsrWifiRouterCtrlPeerAddReq *r newRecord->assignedHandle = i; /* copy power save mode of all access catagory (Trigger/Delivery/both enabled/disabled) */ - powerModeTemp = (CsrUint8) ((req->staInfo.powersaveMode >> 4) & 0xff); + powerModeTemp = (u8) ((req->staInfo.powersaveMode >> 4) & 0xff); if(!(req->staInfo.powersaveMode & 0x0001)) newRecord->powersaveMode[UNIFI_TRAFFIC_Q_BK]= CSR_WIFI_AC_LEGACY_POWER_SAVE; @@ -2180,7 +2180,7 @@ static int peer_add_new_record(unifi_priv_t *priv,CsrWifiRouterCtrlPeerAddReq *r newRecord->powersaveMode[UNIFI_TRAFFIC_Q_VO]= ((powerModeTemp & 0xC0)>> 6); { - CsrUint8 k; + u8 k; for(k=0; k< MAX_ACCESS_CATOGORY ;k++) unifi_trace(priv, UDBG2, "peer_add_new_record: WMM : %d ,AC %d, powersaveMode %x \n", req->staInfo.wmmOrQosEnabled,k,newRecord->powersaveMode[k]); @@ -2191,7 +2191,7 @@ static int peer_add_new_record(unifi_priv_t *priv,CsrWifiRouterCtrlPeerAddReq *r /* Initialize the mgtFrames & data Pdu list */ { - CsrUint8 j; + u8 j; INIT_LIST_HEAD(&newRecord->mgtFrames); for(j = 0; j < MAX_ACCESS_CATOGORY; j++) { INIT_LIST_HEAD(&newRecord->dataPdu[j]); @@ -2297,7 +2297,7 @@ static void check_inactivity_timer_expire_func(unsigned long data) { struct unifi_priv *priv; CsrWifiRouterCtrlStaInfo_t *sta_record = NULL; - CsrUint8 i = 0; + u8 i = 0; CsrTime now; CsrTime inactive_time; netInterface_priv_t *interfacePriv = (netInterface_priv_t *) data; @@ -2411,7 +2411,7 @@ void uf_send_disconnected_ind_wq(struct work_struct *work) unifi_priv_t *priv; CsrUint16 interfaceTag; struct list_head send_cfm_list; - CsrUint8 j; + u8 j; func_enter(); @@ -2619,7 +2619,7 @@ CsrBool blockack_session_stop(unifi_priv_t *priv, netInterface_priv_t *interfacePriv; ba_session_rx_struct *ba_session_rx = NULL; ba_session_tx_struct *ba_session_tx = NULL; - CsrUint8 ba_session_idx = 0; + u8 ba_session_idx = 0; int i; if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { @@ -2743,7 +2743,7 @@ CsrBool blockack_session_start(unifi_priv_t *priv, netInterface_priv_t *interfacePriv; ba_session_rx_struct *ba_session_rx = NULL; ba_session_tx_struct *ba_session_tx = NULL; - CsrUint8 ba_session_idx = 0; + u8 ba_session_idx = 0; if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { @@ -3132,9 +3132,9 @@ void CsrWifiRouterCtrlWapiUnicastTxPktReqHandler(void* drvpriv, CsrWifiFsmEvent* CsrWifiRouterCtrlWapiUnicastTxPktReq *req = (CsrWifiRouterCtrlWapiUnicastTxPktReq*) msg; netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; bulk_data_param_t bulkdata; - CsrUint8 macHeaderLengthInBytes = MAC_HEADER_SIZE; + u8 macHeaderLengthInBytes = MAC_HEADER_SIZE; /*KeyID, Reserved, PN, MIC*/ - CsrUint8 appendedCryptoFields = 1 + 1 + 16 + 16; + u8 appendedCryptoFields = 1 + 1 + 16 + 16; CsrResult result; /* Retrieve the MA PACKET REQ fields from the Signal retained from send_ma_pkt_request() */ CSR_MA_PACKET_REQUEST *storedSignalMAPktReq = &interfacePriv->wapi_unicast_ma_pkt_sig.u.MaPacketRequest; diff --git a/drivers/staging/csr/sme_userspace.c b/drivers/staging/csr/sme_userspace.c index d87a6e3..fc2506e 100644 --- a/drivers/staging/csr/sme_userspace.c +++ b/drivers/staging/csr/sme_userspace.c @@ -119,7 +119,7 @@ void uf_sme_deinit(unifi_priv_t *priv) { int i,j; - CsrUint8 ba_session_idx; + u8 ba_session_idx; ba_session_rx_struct *ba_session_rx = NULL; ba_session_tx_struct *ba_session_tx = NULL; CsrWifiRouterCtrlStaInfo_t *staInfo = NULL; diff --git a/drivers/staging/csr/sme_userspace.h b/drivers/staging/csr/sme_userspace.h index 19f484f..e266efb 100644 --- a/drivers/staging/csr/sme_userspace.h +++ b/drivers/staging/csr/sme_userspace.h @@ -32,7 +32,7 @@ int uf_sme_queue_message(unifi_priv_t *priv, u8 *buffer, int length); #include "csr_wifi_sme_lib.h" void CsrWifiRouterTransportInit(unifi_priv_t *priv); -void CsrWifiRouterTransportRecv(unifi_priv_t *priv, CsrUint8* buffer, CsrSize bufferLength); +void CsrWifiRouterTransportRecv(unifi_priv_t *priv, u8* buffer, CsrSize bufferLength); void CsrWifiRouterTransportDeInit(unifi_priv_t *priv); #endif /* __LINUX_SME_USERSPACE_H__ */ diff --git a/drivers/staging/csr/sme_wext.c b/drivers/staging/csr/sme_wext.c index cdc72db..64e2939e 100644 --- a/drivers/staging/csr/sme_wext.c +++ b/drivers/staging/csr/sme_wext.c @@ -457,10 +457,10 @@ static int decode_parameter_from_string(unifi_priv_t* priv, char **str_ptr, const char *token, int param_type, void *dst, int param_max_len) { - CsrUint8 int_str[7] = "0"; + u8 int_str[7] = "0"; CsrUint32 param_str_len; - CsrUint8 *param_str_begin,*param_str_end; - CsrUint8 *orig_str = *str_ptr; + u8 *param_str_begin,*param_str_end; + u8 *orig_str = *str_ptr; if (!strncmp(*str_ptr, token, strlen(token))) { strsep(str_ptr, "=,"); @@ -616,7 +616,7 @@ static int store_ap_config_from_string( unifi_priv_t * priv,char *param_str) int i,j=0; CsrWifiNmeApAuthPers *pers = ((CsrWifiNmeApAuthPers *)&(ap_config->credentials.nmeAuthType.authTypePersonal)); - CsrUint8 *psk = pers->authPers_credentials.psk.psk; + u8 *psk = pers->authPers_credentials.psk.psk; unifi_trace(priv,UDBG2,"store_ap_config_from_string: security WPA2"); if(ret) { @@ -797,7 +797,7 @@ static int iwprivsconfwapi(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - CsrUint8 enable; + u8 enable; netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); unifi_priv_t *priv = interfacePriv->privPtr; func_enter(); @@ -811,7 +811,7 @@ iwprivsconfwapi(struct net_device *dev, struct iw_request_info *info, return -EPERM; } - enable = *(CsrUint8*)(extra); + enable = *(u8*)(extra); if (enable) { priv->connection_config.authModeMask = CSR_WIFI_SME_AUTH_MODE_80211_OPEN; @@ -1255,7 +1255,7 @@ unifi_giwap(struct net_device *dev, struct iw_request_info *info, unifi_priv_t *priv = interfacePriv->privPtr; CsrWifiSmeConnectionInfo connectionInfo; int r = 0; - CsrUint8 *bssid; + u8 *bssid; func_enter(); diff --git a/drivers/staging/csr/ul_int.c b/drivers/staging/csr/ul_int.c index 958b8a1..3135468 100644 --- a/drivers/staging/csr/ul_int.c +++ b/drivers/staging/csr/ul_int.c @@ -213,7 +213,7 @@ ul_deregister_client(ul_client_t *ul_client) */ void logging_handler(void *ospriv, - CsrUint8 *sigdata, CsrUint32 signal_len, + u8 *sigdata, CsrUint32 signal_len, const bulk_data_param_t *bulkdata, enum udi_log_direction direction) { @@ -285,7 +285,7 @@ ul_log_config_ind(unifi_priv_t *priv, u8 *conf_param, int len) bulkdata.d[0].data_length = 0; bulkdata.d[1].data_length = 0; - sme_native_log_event(priv->sme_cli, conf_param, sizeof(CsrUint8), + sme_native_log_event(priv->sme_cli, conf_param, sizeof(u8), &bulkdata, UDI_CONFIG_IND); #endif /* CSR_SUPPORT_SME */ @@ -324,7 +324,7 @@ free_bulkdata_buffers(unifi_priv_t *priv, bulk_data_param_t *bulkdata) } /* free_bulkdata_buffers */ static int -_align_bulk_data_buffers(unifi_priv_t *priv, CsrUint8 *signal, +_align_bulk_data_buffers(unifi_priv_t *priv, u8 *signal, bulk_data_param_t *bulkdata) { unsigned int i; @@ -417,7 +417,7 @@ int ul_send_signal_unpacked(unifi_priv_t *priv, CSR_SIGNAL *sigptr, bulk_data_param_t *bulkdata) { - CsrUint8 sigbuf[UNIFI_PACKED_SIGBUF_SIZE]; + u8 sigbuf[UNIFI_PACKED_SIGBUF_SIZE]; CsrUint16 packed_siglen; CsrResult csrResult; unsigned long lock_flags; @@ -504,7 +504,7 @@ ul_send_signal_raw(unifi_priv_t *priv, unsigned char *sigptr, int siglen, * Make sure that the signal is updated with the bulk data * alignment for DMA. */ - r = _align_bulk_data_buffers(priv, (CsrUint8*)sigptr, bulkdata); + r = _align_bulk_data_buffers(priv, (u8*)sigptr, bulkdata); if (r) { return r; } diff --git a/drivers/staging/csr/unifi_clients.h b/drivers/staging/csr/unifi_clients.h index 206b8cf..ca105e5 100644 --- a/drivers/staging/csr/unifi_clients.h +++ b/drivers/staging/csr/unifi_clients.h @@ -49,7 +49,7 @@ typedef void (*udi_event_t)(ul_client_t *client, int dir); void logging_handler(void *ospriv, - CsrUint8 *sigdata, CsrUint32 signal_len, + u8 *sigdata, CsrUint32 signal_len, const bulk_data_param_t *bulkdata, enum udi_log_direction direction); diff --git a/drivers/staging/csr/unifi_event.c b/drivers/staging/csr/unifi_event.c index 8b5d466..bbc1564 100644 --- a/drivers/staging/csr/unifi_event.c +++ b/drivers/staging/csr/unifi_event.c @@ -92,33 +92,33 @@ static void send_to_client(unifi_priv_t *priv, ul_client_t *client, * --------------------------------------------------------------------------- */ static CsrBool check_routing_pkt_data_ind(unifi_priv_t *priv, - CsrUint8 *sigdata, + u8 *sigdata, const bulk_data_param_t* bulkdata, CsrBool *freeBulkData, netInterface_priv_t *interfacePriv) { CsrUint16 frmCtrl, receptionStatus, frmCtrlSubType; - CsrUint8 *macHdrLocation; - CsrUint8 interfaceTag; + u8 *macHdrLocation; + u8 interfaceTag; CsrBool isDataFrame; CsrBool isProtocolVerInvalid = FALSE; CsrBool isDataFrameSubTypeNoData = FALSE; #ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - static const CsrUint8 wapiProtocolIdSNAPHeader[] = {0x88,0xb4}; - static const CsrUint8 wapiProtocolIdSNAPHeaderOffset = 6; - CsrUint8 *destAddr; - CsrUint8 *srcAddr; + static const u8 wapiProtocolIdSNAPHeader[] = {0x88,0xb4}; + static const u8 wapiProtocolIdSNAPHeaderOffset = 6; + u8 *destAddr; + u8 *srcAddr; CsrBool isWapiUnicastPkt = FALSE; #ifdef CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND CsrUint16 qosControl; #endif - CsrUint8 llcSnapHeaderOffset = 0; + u8 llcSnapHeaderOffset = 0; - destAddr = (CsrUint8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR1_OFFSET; - srcAddr = (CsrUint8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR2_OFFSET; + destAddr = (u8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR1_OFFSET; + srcAddr = (u8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR2_OFFSET; /*Individual/Group bit - Bit 0 of first byte*/ isWapiUnicastPkt = (!(destAddr[0] & 0x01)) ? TRUE : FALSE; @@ -129,7 +129,7 @@ static CsrBool check_routing_pkt_data_ind(unifi_priv_t *priv, *freeBulkData = FALSE; /* Fetch the MAC header location from MA_PKT_IND packet */ - macHdrLocation = (CsrUint8 *) bulkdata->d[0].os_data_ptr; + macHdrLocation = (u8 *) bulkdata->d[0].os_data_ptr; /* Fetch the Frame Control value from MAC header */ frmCtrl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(macHdrLocation); @@ -286,7 +286,7 @@ static CsrBool check_routing_pkt_data_ind(unifi_priv_t *priv, if (llcSnapHeaderOffset > 0) { /* QoS data or Data */ unifi_trace(priv, UDBG6, "check_routing_pkt_data_ind(): SNAP header found & its offset %d\n",llcSnapHeaderOffset); - if (memcmp((CsrUint8 *)(bulkdata->d[0].os_data_ptr+llcSnapHeaderOffset+wapiProtocolIdSNAPHeaderOffset), + if (memcmp((u8 *)(bulkdata->d[0].os_data_ptr+llcSnapHeaderOffset+wapiProtocolIdSNAPHeaderOffset), wapiProtocolIdSNAPHeader,sizeof(wapiProtocolIdSNAPHeader))) { unifi_trace(priv, UDBG6, "check_routing_pkt_data_ind(): This is a data & NOT a WAI protocol packet\n"); @@ -310,8 +310,8 @@ static CsrBool check_routing_pkt_data_ind(unifi_priv_t *priv, if((interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2P)&&\ ((CSR_WIFI_80211_GET_FRAME_SUBTYPE(macHdrLocation)) == CSR_WIFI_80211_FRAME_SUBTYPE_BEACON)){ - CsrUint8 *pSsid, *pSsidLen; - static CsrUint8 P2PWildCardSsid[CSR_WIFI_P2P_WILDCARD_SSID_LENGTH] = {'D', 'I', 'R', 'E', 'C', 'T', '-'}; + u8 *pSsid, *pSsidLen; + static u8 P2PWildCardSsid[CSR_WIFI_P2P_WILDCARD_SSID_LENGTH] = {'D', 'I', 'R', 'E', 'C', 'T', '-'}; pSsidLen = macHdrLocation + MAC_HEADER_SIZE + CSR_WIFI_BEACON_FIXED_LENGTH; pSsid = pSsidLen + 2; @@ -367,7 +367,7 @@ static CsrBool check_routing_pkt_data_ind(unifi_priv_t *priv, */ static void unifi_process_receive_event(void *ospriv, - CsrUint8 *sigdata, CsrUint32 siglen, + u8 *sigdata, CsrUint32 siglen, const bulk_data_param_t *bulkdata) { unifi_priv_t *priv = (unifi_priv_t*)ospriv; @@ -400,7 +400,7 @@ unifi_process_receive_event(void *ospriv, if (signal_id == CSR_MA_PACKET_INDICATION_ID) { #define CSR_MA_PACKET_INDICATION_INTERFACETAG_OFFSET 14 - CsrUint8 interfaceTag; + u8 interfaceTag; netInterface_priv_t *interfacePriv; /* Pull out interface tag from virtual interface identifier */ @@ -411,9 +411,9 @@ unifi_process_receive_event(void *ospriv, #ifdef CSR_SUPPORT_SME if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_IBSS) { - CsrUint8 *saddr; + u8 *saddr; /* Fetch the source address from mac header */ - saddr = (CsrUint8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR2_OFFSET; + saddr = (u8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR2_OFFSET; unifi_trace(priv, UDBG5, "Updating sta activity in IBSS interfaceTag %x Src Addr %x:%x:%x:%x:%x:%x\n", interfaceTag, saddr[0], saddr[1], saddr[2], saddr[3], saddr[4], saddr[5]); @@ -466,7 +466,7 @@ unifi_process_receive_event(void *ospriv, #if (defined(CSR_SUPPORT_SME) && defined(CSR_WIFI_SECURITY_WAPI_ENABLE)) #define CSR_MA_PACKET_INDICATION_RECEPTION_STATUS_OFFSET sizeof(CSR_SIGNAL_PRIMITIVE_HEADER) + 22 netInterface_priv_t *interfacePriv; - CsrUint8 interfaceTag; + u8 interfaceTag; CsrUint16 receptionStatus = CSR_RX_SUCCESS; /* Pull out interface tag from virtual interface identifier */ @@ -487,7 +487,7 @@ unifi_process_receive_event(void *ospriv, )) { CSR_SIGNAL signal; - CsrUint8 *destAddr; + u8 *destAddr; CsrResult res; CsrUint16 interfaceTag = 0; CsrBool isMcastPkt = TRUE; @@ -501,7 +501,7 @@ unifi_process_receive_event(void *ospriv, } /* Check if the type of MPDU and the respective filter status*/ - destAddr = (CsrUint8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR1_OFFSET; + destAddr = (u8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR1_OFFSET; isMcastPkt = (destAddr[0] & 0x01) ? TRUE : FALSE; unifi_trace(priv, UDBG6, "1.MPDU type: (%s), 2.Multicast filter: (%s), 3. Unicast filter: (%s)\n", @@ -516,7 +516,7 @@ unifi_process_receive_event(void *ospriv, ) { unifi_trace(priv, UDBG4, "Sending the WAPI MPDU for MIC check\n"); - CsrWifiRouterCtrlWapiRxMicCheckIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, siglen, sigdata, bulkdata->d[0].data_length, (CsrUint8*)bulkdata->d[0].os_data_ptr); + CsrWifiRouterCtrlWapiRxMicCheckIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, siglen, sigdata, bulkdata->d[0].data_length, (u8*)bulkdata->d[0].os_data_ptr); for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { if (bulkdata->d[i].data_length != 0) { @@ -591,7 +591,7 @@ void unifi_rx_queue_flush(void *ospriv) unifi_trace(priv, UDBG4, "rx_wq_handler: RdPtr = %d WritePtr = %d\n", priv->rxSignalBuffer.readPointer,priv->rxSignalBuffer.writePointer); if(priv != NULL) { - CsrUint8 readPointer = priv->rxSignalBuffer.readPointer; + u8 readPointer = priv->rxSignalBuffer.readPointer; while (readPointer != priv->rxSignalBuffer.writePointer) { rx_buff_struct_t *buf = &priv->rxSignalBuffer.rx_buff[readPointer]; @@ -647,12 +647,12 @@ void rx_wq_handler(struct work_struct *work) */ void unifi_receive_event(void *ospriv, - CsrUint8 *sigdata, CsrUint32 siglen, + u8 *sigdata, CsrUint32 siglen, const bulk_data_param_t *bulkdata) { #ifdef CSR_WIFI_RX_PATH_SPLIT unifi_priv_t *priv = (unifi_priv_t*)ospriv; - CsrUint8 writePointer; + u8 writePointer; int i; rx_buff_struct_t * rx_buff; func_enter(); diff --git a/drivers/staging/csr/unifi_pdu_processing.c b/drivers/staging/csr/unifi_pdu_processing.c index 45c69a9..3c0491b 100644 --- a/drivers/staging/csr/unifi_pdu_processing.c +++ b/drivers/staging/csr/unifi_pdu_processing.c @@ -56,15 +56,15 @@ void unifi_frame_ma_packet_req(unifi_priv_t *priv, CSR_PRIORITY priority, CSR_RATE TransmitRate, CSR_CLIENT_TAG hostTag, CsrUint16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl, - CSR_PROCESS_ID leSenderProcessId, CsrUint8 *peerMacAddress, + CSR_PROCESS_ID leSenderProcessId, u8 *peerMacAddress, CSR_SIGNAL *signal) { CSR_MA_PACKET_REQUEST *req = &signal->u.MaPacketRequest; netInterface_priv_t *interfacePriv; - CsrUint8 ba_session_idx = 0; + u8 ba_session_idx = 0; ba_session_tx_struct *ba_session = NULL; - CsrUint8 *ba_addr = NULL; + u8 *ba_addr = NULL; interfacePriv = priv->interfacePriv[interfaceTag]; @@ -135,8 +135,8 @@ int frame_and_send_queued_pdu(unifi_priv_t* priv,tx_buffered_packets_t* buffered CSR_SIGNAL signal; bulk_data_param_t bulkdata; int result; - CsrUint8 toDs, fromDs, macHeaderLengthInBytes = MAC_HEADER_SIZE; - CsrUint8 *qc; + u8 toDs, fromDs, macHeaderLengthInBytes = MAC_HEADER_SIZE; + u8 *qc; CsrUint16 *fc = (CsrUint16*)(buffered_pkt->bulkdata.os_data_ptr); unsigned long lock_flags; unifi_trace(priv, UDBG3, "frame_and_send_queued_pdu with moreData: %d , EOSP: %d\n",moreData,eosp); @@ -180,9 +180,9 @@ int frame_and_send_queued_pdu(unifi_priv_t* priv,tx_buffered_packets_t* buffered /* If order bit set then HT control field is the part of MAC header */ if (*fc & cpu_to_le16(IEEE80211_FC_ORDER_MASK)) { macHeaderLengthInBytes += HT_CONTROL_HEADER_SIZE; - qc = (CsrUint8*)(buffered_pkt->bulkdata.os_data_ptr + (macHeaderLengthInBytes-6)); + qc = (u8*)(buffered_pkt->bulkdata.os_data_ptr + (macHeaderLengthInBytes-6)); } else { - qc = (CsrUint8*)(buffered_pkt->bulkdata.os_data_ptr + (macHeaderLengthInBytes-2)); + qc = (u8*)(buffered_pkt->bulkdata.os_data_ptr + (macHeaderLengthInBytes-2)); } *qc = eosp ? *qc | (1 << 4) : *qc & (~(1 << 4)); break; @@ -299,7 +299,7 @@ void verify_and_accomodate_tx_packet(unifi_priv_t *priv) unsigned long lock_flags; struct list_head *listHead, *list; struct list_head *placeHolder; - CsrUint8 i, j,eospFramedeleted=0; + u8 i, j,eospFramedeleted=0; CsrBool thresholdExcedeDueToBroadcast = TRUE; /* it will be made it interface Specific in the future when multi interfaces are supported , right now interface 0 is considered */ @@ -477,7 +477,7 @@ CsrResult unifi_reque_ma_packet_request (void *ospriv, CsrUint32 host_tag, unifi_trace(priv, UDBG6, "unifi_reque_ma_packet_request: host_tag = 0x%x\n", host_tag); staRecord = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, - (((CsrUint8 *) bulkDataDesc->os_data_ptr) + 4), + (((u8 *) bulkDataDesc->os_data_ptr) + 4), interfaceTag); if (NULL == staRecord) { unifi_trace(priv, UDBG5, "unifi_reque_ma_packet_request: Invalid STA record \n"); @@ -532,7 +532,7 @@ CsrResult unifi_reque_ma_packet_request (void *ospriv, CsrUint32 host_tag, /* Extract the Packet priority */ if (TRUE == staRecord->wmmOrQosEnabled) { CsrUint16 qosControl = 0; - CsrUint8 dataFrameType = 0; + u8 dataFrameType = 0; dataFrameType =((frameControl & IEEE80211_FC_SUBTYPE_MASK) >> 4); @@ -603,9 +603,9 @@ CsrResult unifi_reque_ma_packet_request (void *ospriv, CsrUint32 host_tag, } #endif -static void is_all_ac_deliver_enabled_and_moredata(CsrWifiRouterCtrlStaInfo_t *staRecord, CsrUint8 *allDeliveryEnabled, CsrUint8 *dataAvailable) +static void is_all_ac_deliver_enabled_and_moredata(CsrWifiRouterCtrlStaInfo_t *staRecord, u8 *allDeliveryEnabled, u8 *dataAvailable) { - CsrUint8 i; + u8 i; *allDeliveryEnabled = TRUE; for (i = 0 ;i < MAX_ACCESS_CATOGORY; i++) { if (!IS_DELIVERY_ENABLED(staRecord->powersaveMode[i])) { @@ -637,15 +637,15 @@ static void is_all_ac_deliver_enabled_and_moredata(CsrWifiRouterCtrlStaInfo_t *s */ void uf_handle_tim_cfm(unifi_priv_t *priv, CSR_MLME_SET_TIM_CONFIRM *cfm, CsrUint16 receiverProcessId) { - CsrUint8 handle = CSR_WIFI_GET_STATION_HANDLE_FROM_RECEIVER_ID(receiverProcessId); - CsrUint8 timSetStatus = CSR_WIFI_GET_TIMSET_STATE_FROM_RECEIVER_ID(receiverProcessId); + u8 handle = CSR_WIFI_GET_STATION_HANDLE_FROM_RECEIVER_ID(receiverProcessId); + u8 timSetStatus = CSR_WIFI_GET_TIMSET_STATE_FROM_RECEIVER_ID(receiverProcessId); CsrUint16 interfaceTag = (cfm->VirtualInterfaceIdentifier & 0xff); netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; CsrWifiRouterCtrlStaInfo_t *staRecord = NULL; /* This variable holds what TIM value we wanted to set in firmware */ CsrUint16 timSetValue = 0; /* Irrespective of interface the count maintained */ - static CsrUint8 retryCount = 0; + static u8 retryCount = 0; unsigned long lock_flags; unifi_trace(priv, UDBG3, "entering %s, handle = %x, timSetStatus = %x\n", __FUNCTION__, handle, timSetStatus); @@ -774,7 +774,7 @@ void uf_handle_tim_cfm(unifi_priv_t *priv, CSR_MLME_SET_TIM_CONFIRM *cfm, CsrUin !list_empty(&staRecord->mgtFrames)); } else { /* Peer is QSTA */ - CsrUint8 allDeliveryEnabled = 0, dataAvailable = 0; + u8 allDeliveryEnabled = 0, dataAvailable = 0; /* Check if all AC's are Delivery Enabled */ is_all_ac_deliver_enabled_and_moredata(staRecord, &allDeliveryEnabled, &dataAvailable); /*check for more data in non-delivery enabled queues*/ @@ -859,14 +859,14 @@ void uf_handle_tim_cfm(unifi_priv_t *priv, CSR_MLME_SET_TIM_CONFIRM *cfm, CsrUin * * --------------------------------------------------------------------------- */ -void update_tim(unifi_priv_t * priv, CsrUint16 aid, CsrUint8 setTim, CsrUint16 interfaceTag, CsrUint32 handle) +void update_tim(unifi_priv_t * priv, CsrUint16 aid, u8 setTim, CsrUint16 interfaceTag, CsrUint32 handle) { CSR_SIGNAL signal; CsrInt32 r; CSR_MLME_SET_TIM_REQUEST *req = &signal.u.MlmeSetTimRequest; bulk_data_param_t *bulkdata = NULL; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - CsrUint8 senderIdLsb = 0; + u8 senderIdLsb = 0; CsrWifiRouterCtrlStaInfo_t *staRecord = NULL; CsrUint32 oldTimSetStatus = 0, timSetStatus = 0; @@ -998,7 +998,7 @@ void process_peer_active_transition(unifi_priv_t * priv, spin_lock_irqsave(&priv->tx_q_lock,lock_flags); list_add(&buffered_pkt->q, &staRecord->mgtFrames); spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); - priv->pausedStaHandle[3]=(CsrUint8)(staRecord->assignedHandle); + priv->pausedStaHandle[3]=(u8)(staRecord->assignedHandle); spaceAvail[3] = FALSE; break; } else { @@ -1040,7 +1040,7 @@ void process_peer_active_transition(unifi_priv_t * priv, spin_lock_irqsave(&priv->tx_q_lock,lock_flags); list_add(&buffered_pkt->q, &staRecord->dataPdu[i]); spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); - priv->pausedStaHandle[i]=(CsrUint8)(staRecord->assignedHandle); + priv->pausedStaHandle[i]=(u8)(staRecord->assignedHandle); break; } else { if(r){ @@ -1075,7 +1075,7 @@ void process_peer_active_transition(unifi_priv_t * priv, void uf_process_ma_pkt_cfm_for_ap(unifi_priv_t *priv,CsrUint16 interfaceTag, const CSR_MA_PACKET_CONFIRM *pkt_cfm) { netInterface_priv_t *interfacePriv; - CsrUint8 i; + u8 i; CsrWifiRouterCtrlStaInfo_t *staRecord = NULL; interfacePriv = priv->interfacePriv[interfaceTag]; @@ -1148,7 +1148,7 @@ void uf_process_ma_pkt_cfm_for_ap(unifi_priv_t *priv,CsrUint16 interfaceTag, con if (inactive_time >= STA_INACTIVE_TIMEOUT_VAL) { struct list_head send_cfm_list; - CsrUint8 j; + u8 j; /* The SME/NME may be waiting for confirmation for requested frames to this station. * Though this is --VERY UNLIKELY-- in case of station in active mode. But still as a @@ -1256,17 +1256,17 @@ CsrUint16 uf_get_vif_identifier (CsrWifiRouterCtrlMode mode, CsrUint16 tag) static int update_macheader(unifi_priv_t *priv, struct sk_buff *skb, struct sk_buff *newSkb, CSR_PRIORITY *priority, bulk_data_param_t *bulkdata, CsrUint16 interfaceTag, - CsrUint8 macHeaderLengthInBytes, - CsrUint8 qosDestination) + u8 macHeaderLengthInBytes, + u8 qosDestination) { CsrUint16 *fc = NULL; - CsrUint8 direction = 0, toDs, fromDs; - CsrUint8 *bufPtr = NULL; - CsrUint8 sa[ETH_ALEN], da[ETH_ALEN]; + u8 direction = 0, toDs, fromDs; + u8 *bufPtr = NULL; + u8 sa[ETH_ALEN], da[ETH_ALEN]; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; int headroom; - CsrUint8 macHeaderBuf[IEEE802_11_DATA_FRAME_MAC_HEADER_SIZE] = {0}; + u8 macHeaderBuf[IEEE802_11_DATA_FRAME_MAC_HEADER_SIZE] = {0}; unifi_trace(priv, UDBG5, "entering the update_macheader function\n"); @@ -1348,7 +1348,7 @@ static int update_macheader(unifi_priv_t *priv, struct sk_buff *skb, unifi_trace(priv, UDBG1, " sufficient headroom not there to push updated mac header \n"); return -1; } - bufPtr = (CsrUint8 *) skb_push(skb, macHeaderLengthInBytes); + bufPtr = (u8 *) skb_push(skb, macHeaderLengthInBytes); /* update bulk data os_data_ptr */ bulkdata->d[0].os_data_ptr = skb->data; @@ -1357,11 +1357,11 @@ static int update_macheader(unifi_priv_t *priv, struct sk_buff *skb, } else { /* pointing to QOS control field */ - CsrUint8 qc; + u8 qc; if (*fc & cpu_to_le16(IEEE80211_FC_ORDER_MASK)) { - qc = *((CsrUint8*)(macHeaderBuf + (macHeaderLengthInBytes - 4 - 2))); + qc = *((u8*)(macHeaderBuf + (macHeaderLengthInBytes - 4 - 2))); } else { - qc = *((CsrUint8*)(macHeaderBuf + (macHeaderLengthInBytes - 2))); + qc = *((u8*)(macHeaderBuf + (macHeaderLengthInBytes - 2))); } if ((qc & IEEE802_11_QC_TID_MASK) > 7) { @@ -1376,7 +1376,7 @@ static int update_macheader(unifi_priv_t *priv, struct sk_buff *skb, unifi_trace(priv, UDBG3, " sufficient headroom not there to push updated mac header \n"); return -1; } - bufPtr = (CsrUint8 *) skb_push(skb, macHeaderLengthInBytes); + bufPtr = (u8 *) skb_push(skb, macHeaderLengthInBytes); } break; default: @@ -1386,7 +1386,7 @@ static int update_macheader(unifi_priv_t *priv, struct sk_buff *skb, unifi_trace(priv, UDBG5, "normal Data packet, NO QOS \n"); if (qosDestination) { - CsrUint8 qc = 0; + u8 qc = 0; unifi_trace(priv, UDBG3, "destination is QOS station \n"); /* Set Ma-Packet.req UP to UP0 */ @@ -1428,13 +1428,13 @@ static int update_macheader(unifi_priv_t *priv, struct sk_buff *skb, bulkdata->d[0].os_net_buf_ptr = (unsigned char*)newSkb; bulkdata->d[0].data_length = newSkb->len; - bufPtr = (CsrUint8*)data_ptrs.d[0].os_data_ptr; + bufPtr = (u8*)data_ptrs.d[0].os_data_ptr; /* The old skb will not be used again */ kfree_skb(skb); } else { /* skb headroom is sufficient to append Macheader */ - bufPtr = (CsrUint8*)skb_push(skb, macHeaderLengthInBytes); + bufPtr = (u8*)skb_push(skb, macHeaderLengthInBytes); bulkdata->d[0].os_data_ptr = skb->data; bulkdata->d[0].os_net_buf_ptr = (unsigned char*)skb; bulkdata->d[0].data_length = skb->len; @@ -1458,13 +1458,13 @@ static int update_macheader(unifi_priv_t *priv, struct sk_buff *skb, bulkdata->d[0].os_net_buf_ptr = (unsigned char*)newSkb; bulkdata->d[0].data_length = newSkb->len; - bufPtr = (CsrUint8*)data_ptrs.d[0].os_data_ptr; + bufPtr = (u8*)data_ptrs.d[0].os_data_ptr; /* The old skb will not be used again */ kfree_skb(skb); } else { /* skb headroom is sufficient to append Macheader */ - bufPtr = (CsrUint8*)skb_push(skb, macHeaderLengthInBytes); + bufPtr = (u8*)skb_push(skb, macHeaderLengthInBytes); bulkdata->d[0].os_data_ptr = skb->data; bulkdata->d[0].os_net_buf_ptr = (unsigned char*)skb; bulkdata->d[0].data_length = skb->len; @@ -1507,7 +1507,7 @@ uf_ap_process_data_pdu(unifi_priv_t *priv, struct sk_buff *skb, struct ethhdr *ehdr, CsrWifiRouterCtrlStaInfo_t * srcStaInfo, const CSR_SIGNAL *signal, bulk_data_param_t *bulkdata, - CsrUint8 macHeaderLengthInBytes) + u8 macHeaderLengthInBytes) { const CSR_MA_PACKET_INDICATION *ind = &(signal->u.MaPacketIndication); CsrUint16 interfaceTag = (ind->VirtualInterfaceIdentifier & 0x00ff); @@ -1643,7 +1643,7 @@ uf_ap_process_data_pdu(unifi_priv_t *priv, struct sk_buff *skb, #endif CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, - CsrUint8 *peerMacAddress, + u8 *peerMacAddress, CSR_CLIENT_TAG hostTag, CsrUint16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl, @@ -1657,7 +1657,7 @@ CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, int result; #ifdef CSR_SUPPORT_SME CsrWifiRouterCtrlStaInfo_t *staRecord = NULL; - const CsrUint8 *macHdrLocation = bulkdata->d[0].os_data_ptr; + const u8 *macHdrLocation = bulkdata->d[0].os_data_ptr; CsrWifiPacketType pktType; int frameType = 0; CsrBool queuePacketDozing = FALSE; @@ -1800,7 +1800,7 @@ CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, list = &staRecord->mgtFrames; requeueOnSamePos = TRUE; unifi_trace(priv, UDBG1, "(ENOSPC) Sending MgtFrames Failed handle = %d so buffering\n",staRecord->assignedHandle); - priv->pausedStaHandle[0]=(CsrUint8)(staRecord->assignedHandle); + priv->pausedStaHandle[0]=(u8)(staRecord->assignedHandle); } else if (result) { status = CSR_RESULT_FAILURE; } @@ -1847,7 +1847,7 @@ CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, unifi_trace(priv, UDBG1, "(ENOSPC) Sending Unicast DataPDU to queue %d Failed so buffering\n",priority_q); requeueOnSamePos = TRUE; list = &staRecord->dataPdu[priority_q]; - priv->pausedStaHandle[priority_q]=(CsrUint8)(staRecord->assignedHandle); + priv->pausedStaHandle[priority_q]=(u8)(staRecord->assignedHandle); if(!isRouterBufferEnabled(priv,priority_q)) { unifi_error(priv,"Buffering Not enabled for queue %d \n",priority_q); } @@ -1928,7 +1928,7 @@ CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, } } else { /* Check for non delivery enable(i.e trigger enable), all delivery enable & legacy AC for TIM update in firmware */ - CsrUint8 allDeliveryEnabled = 0, dataAvailable = 0; + u8 allDeliveryEnabled = 0, dataAvailable = 0; /* Check if all AC's are Delivery Enabled */ is_all_ac_deliver_enabled_and_moredata(staRecord, &allDeliveryEnabled, &dataAvailable); if (uf_is_more_data_for_non_delivery_ac(staRecord) || (allDeliveryEnabled && dataAvailable) @@ -1976,7 +1976,7 @@ CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, } #ifdef CSR_SUPPORT_SME -CsrInt8 uf_get_protection_bit_from_interfacemode(unifi_priv_t *priv, CsrUint16 interfaceTag, const CsrUint8 *daddr) +CsrInt8 uf_get_protection_bit_from_interfacemode(unifi_priv_t *priv, CsrUint16 interfaceTag, const u8 *daddr) { CsrInt8 protection = 0; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; @@ -2017,12 +2017,12 @@ CsrInt8 uf_get_protection_bit_from_interfacemode(unifi_priv_t *priv, CsrUint16 i } #endif #ifdef CSR_SUPPORT_SME -CsrUint8 send_multicast_frames(unifi_priv_t *priv, CsrUint16 interfaceTag) +u8 send_multicast_frames(unifi_priv_t *priv, CsrUint16 interfaceTag) { int r; tx_buffered_packets_t * buffered_pkt = NULL; CsrBool moreData = FALSE; - CsrUint8 pduSent =0; + u8 pduSent =0; unsigned long lock_flags; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; CsrUint32 hostTag = 0xffffffff; @@ -2115,7 +2115,7 @@ CsrUint8 send_multicast_frames(unifi_priv_t *priv, CsrUint16 interfaceTag) return pduSent; } #endif -void uf_process_ma_vif_availibility_ind(unifi_priv_t *priv,CsrUint8 *sigdata, +void uf_process_ma_vif_availibility_ind(unifi_priv_t *priv,u8 *sigdata, CsrUint32 siglen) { #ifdef CSR_SUPPORT_SME @@ -2123,7 +2123,7 @@ void uf_process_ma_vif_availibility_ind(unifi_priv_t *priv,CsrUint8 *sigdata, CSR_MA_VIF_AVAILABILITY_INDICATION *ind; int r; CsrUint16 interfaceTag; - CsrUint8 pduSent =0; + u8 pduSent =0; CSR_RESULT_CODE resultCode = CSR_RC_SUCCESS; netInterface_priv_t *interfacePriv; @@ -2261,7 +2261,7 @@ static CsrBool uf_is_more_data_for_usp_delivery(unifi_priv_t *priv, CsrWifiRoute */ void uf_send_buffered_data_from_delivery_ac(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo, - CsrUint8 queue, + u8 queue, struct list_head *txList) { @@ -2337,7 +2337,7 @@ void uf_send_buffered_data_from_delivery_ac(unifi_priv_t *priv, spin_lock_irqsave(&priv->tx_q_lock,lock_flags); list_add(&buffered_pkt->q,txList); spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); - priv->pausedStaHandle[queue]=(CsrUint8)(staInfo->assignedHandle); + priv->pausedStaHandle[queue]=(u8)(staInfo->assignedHandle); break; } else { if(r){ @@ -2363,7 +2363,7 @@ void uf_send_buffered_data_from_delivery_ac(unifi_priv_t *priv, void uf_send_buffered_data_from_ac(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo, - CsrUint8 queue, + u8 queue, struct list_head *txList) { tx_buffered_packets_t * buffered_pkt = NULL; @@ -2390,7 +2390,7 @@ void uf_send_buffered_data_from_ac(unifi_priv_t *priv, list_add(&buffered_pkt->q,txList); spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); if(staInfo != NULL){ - priv->pausedStaHandle[queue]=(CsrUint8)(staInfo->assignedHandle); + priv->pausedStaHandle[queue]=(u8)(staInfo->assignedHandle); } unifi_trace(priv,UDBG3," uf_send_buffered_data_from_ac: PDU sending failed .. no space for queue %d \n",queue); } else { @@ -2411,7 +2411,7 @@ void uf_send_buffered_frames(unifi_priv_t *priv,unifi_TrafficQueue q) CsrUint16 interfaceTag = GET_ACTIVE_INTERFACE_TAG(priv); CsrUint32 startIndex=0,endIndex=0; CsrWifiRouterCtrlStaInfo_t * staInfo = NULL; - CsrUint8 queue; + u8 queue; CsrBool moreData = FALSE; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; @@ -2551,7 +2551,7 @@ void uf_send_buffered_frames(unifi_priv_t *priv,unifi_TrafficQueue q) CsrBool uf_is_more_data_for_non_delivery_ac(CsrWifiRouterCtrlStaInfo_t *staRecord) { - CsrUint8 i; + u8 i; for(i=0;i<=3;i++) { @@ -2640,7 +2640,7 @@ static void uf_handle_uspframes_delivery(unifi_priv_t * priv, CsrWifiRouterCtrlS { CsrInt8 i; - CsrUint8 allDeliveryEnabled = 0, dataAvailable = 0; + u8 allDeliveryEnabled = 0, dataAvailable = 0; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; unsigned long lock_flags; @@ -2720,7 +2720,7 @@ static void uf_handle_uspframes_delivery(unifi_priv_t * priv, CsrWifiRouterCtrlS is_all_ac_deliver_enabled_and_moredata(staInfo, &allDeliveryEnabled, &dataAvailable); if ((allDeliveryEnabled && !dataAvailable)) { if ((staInfo->timSet != CSR_WIFI_TIM_RESET) || (staInfo->timSet != CSR_WIFI_TIM_RESETTING)) { - staInfo->updateTimReqQueued = (CsrUint8) CSR_WIFI_TIM_RESET; + staInfo->updateTimReqQueued = (u8) CSR_WIFI_TIM_RESET; unifi_trace(priv, UDBG4, " --uf_handle_uspframes_delivery, UAPSD timset\n"); if (!staInfo->timRequestPendingFlag) { update_tim(priv, staInfo->aid, 0, interfaceTag, staInfo->assignedHandle); @@ -2759,7 +2759,7 @@ void uf_process_wmm_deliver_ac_uapsd(unifi_priv_t * priv, } -void uf_send_qos_null(unifi_priv_t * priv,CsrUint16 interfaceTag, const CsrUint8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo) +void uf_send_qos_null(unifi_priv_t * priv,CsrUint16 interfaceTag, const u8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo) { bulk_data_param_t bulkdata; CsrResult csrResult; @@ -2798,7 +2798,7 @@ void uf_send_qos_null(unifi_priv_t * priv,CsrUint16 interfaceTag, const CsrUint8 unifi_net_data_free(priv, &bulkdata.d[0]); return; } - memcpy(peerAddress.a, ((CsrUint8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN); + memcpy(peerAddress.a, ((u8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN); /* convert priority to queue */ priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY) priority); @@ -2830,7 +2830,7 @@ void uf_send_qos_null(unifi_priv_t * priv,CsrUint16 interfaceTag, const CsrUint8 return; } -void uf_send_nulldata(unifi_priv_t * priv,CsrUint16 interfaceTag, const CsrUint8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo) +void uf_send_nulldata(unifi_priv_t * priv,CsrUint16 interfaceTag, const u8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo) { bulk_data_param_t bulkdata; CsrResult csrResult; @@ -2868,7 +2868,7 @@ void uf_send_nulldata(unifi_priv_t * priv,CsrUint16 interfaceTag, const CsrUint8 unifi_net_data_free(priv, &bulkdata.d[0]); return; } - memcpy(peerAddress.a, ((CsrUint8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN); + memcpy(peerAddress.a, ((u8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN); /* convert priority to queue */ priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY) priority); transmissionControl &= ~(CSR_NO_CONFIRM_REQUIRED); @@ -2918,9 +2918,9 @@ void uf_send_nulldata(unifi_priv_t * priv,CsrUint16 interfaceTag, const CsrUint8 CsrBool uf_check_broadcast_bssid(unifi_priv_t *priv, const bulk_data_param_t *bulkdata) { - CsrUint8 *bssid = NULL; + u8 *bssid = NULL; static const CsrWifiMacAddress broadcast_address = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}}; - CsrUint8 toDs, fromDs; + u8 toDs, fromDs; toDs = (((bulkdata->d[0].os_data_ptr)[1]) & 0x01) ? 1 : 0; fromDs =(((bulkdata->d[0].os_data_ptr)[1]) & 0x02) ? 1 : 0; @@ -2933,17 +2933,17 @@ CsrBool uf_check_broadcast_bssid(unifi_priv_t *priv, const bulk_data_param_t *bu else if((toDs == 0) && (fromDs ==0)) { /* BSSID is Address 3 */ - bssid = (CsrUint8 *) (bulkdata->d[0].os_data_ptr + 4 + (2 * ETH_ALEN)); + bssid = (u8 *) (bulkdata->d[0].os_data_ptr + 4 + (2 * ETH_ALEN)); } else if(toDs) { /* BSSID is Address 1 */ - bssid = (CsrUint8 *) (bulkdata->d[0].os_data_ptr + 4); + bssid = (u8 *) (bulkdata->d[0].os_data_ptr + 4); } else if(fromDs) { /* BSSID is Address 2 */ - bssid = (CsrUint8 *) (bulkdata->d[0].os_data_ptr + 4 + ETH_ALEN); + bssid = (u8 *) (bulkdata->d[0].os_data_ptr + 4 + ETH_ALEN); } if (memcmp(broadcast_address.a, bssid, ETH_ALEN)== 0) @@ -2958,7 +2958,7 @@ CsrBool uf_check_broadcast_bssid(unifi_priv_t *priv, const bulk_data_param_t *bu CsrBool uf_process_pm_bit_for_peer(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t * srcStaInfo, - CsrUint8 pmBit,CsrUint16 interfaceTag) + u8 pmBit,CsrUint16 interfaceTag) { CsrBool moreData = FALSE; CsrBool powerSaveChanged = FALSE; @@ -3023,7 +3023,7 @@ CsrBool uf_process_pm_bit_for_peer(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo } } else { - CsrUint8 allDeliveryEnabled = 0, dataAvailable = 0; + u8 allDeliveryEnabled = 0, dataAvailable = 0; unifi_trace(priv, UDBG5, "Qos in AP Mode\n"); /* Check if all AC's are Delivery Enabled */ is_all_ac_deliver_enabled_and_moredata(srcStaInfo, &allDeliveryEnabled, &dataAvailable); @@ -3052,7 +3052,7 @@ CsrBool uf_process_pm_bit_for_peer(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo -void uf_process_ps_poll(unifi_priv_t *priv,CsrUint8* sa,CsrUint8* da,CsrUint8 pmBit,CsrUint16 interfaceTag) +void uf_process_ps_poll(unifi_priv_t *priv,u8* sa,u8* da,u8 pmBit,CsrUint16 interfaceTag) { CsrWifiRouterCtrlStaInfo_t *staRecord = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, sa, interfaceTag); @@ -3105,7 +3105,7 @@ void uf_process_ps_poll(unifi_priv_t *priv,CsrUint8* sa,CsrUint8* da,CsrUint8 pm list_add(&buffered_pkt->q, &staRecord->mgtFrames); spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); unifi_trace(priv, UDBG1, "(ENOSPC) PS-POLL received : PDU sending failed \n"); - priv->pausedStaHandle[3]=(CsrUint8)(staRecord->assignedHandle); + priv->pausedStaHandle[3]=(u8)(staRecord->assignedHandle); } else { if(r){ unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n"); @@ -3127,7 +3127,7 @@ void uf_process_ps_poll(unifi_priv_t *priv,CsrUint8* sa,CsrUint8* da,CsrUint8 pm spin_lock_irqsave(&priv->tx_q_lock,lock_flags); list_add(&buffered_pkt->q, &staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]); spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); - priv->pausedStaHandle[3]=(CsrUint8)(staRecord->assignedHandle); + priv->pausedStaHandle[3]=(u8)(staRecord->assignedHandle); unifi_trace(priv, UDBG1, "(ENOSPC) PS-POLL received : PDU sending failed \n"); } else { if(r){ @@ -3149,7 +3149,7 @@ void uf_process_ps_poll(unifi_priv_t *priv,CsrUint8* sa,CsrUint8* da,CsrUint8 pm spin_lock_irqsave(&priv->tx_q_lock,lock_flags); list_add(&buffered_pkt->q, &staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]); spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); - priv->pausedStaHandle[0]=(CsrUint8)(staRecord->assignedHandle); + priv->pausedStaHandle[0]=(u8)(staRecord->assignedHandle); unifi_trace(priv, UDBG1, "(ENOSPC) PS-POLL received : PDU sending failed \n"); } else { if(r){ @@ -3183,7 +3183,7 @@ void uf_process_ps_poll(unifi_priv_t *priv,CsrUint8* sa,CsrUint8* da,CsrUint8 pm } } else { - CsrUint8 allDeliveryEnabled = 0, dataAvailable = 0; + u8 allDeliveryEnabled = 0, dataAvailable = 0; unifi_trace(priv, UDBG3,"Qos Support station.Processing PS-Poll\n"); /*Send Data From Management Frames*/ @@ -3218,7 +3218,7 @@ void uf_process_ps_poll(unifi_priv_t *priv,CsrUint8* sa,CsrUint8* da,CsrUint8 pm spin_lock_irqsave(&priv->tx_q_lock,lock_flags); list_add(&buffered_pkt->q, &staRecord->mgtFrames); spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); - priv->pausedStaHandle[0]=(CsrUint8)(staRecord->assignedHandle); + priv->pausedStaHandle[0]=(u8)(staRecord->assignedHandle); unifi_trace(priv, UDBG1, "(ENOSPC) PS-POLL received : PDU sending failed \n"); } else { if(r){ @@ -3253,7 +3253,7 @@ void uf_process_ps_poll(unifi_priv_t *priv,CsrUint8* sa,CsrUint8* da,CsrUint8 pm spin_lock_irqsave(&priv->tx_q_lock,lock_flags); list_add(&buffered_pkt->q, &staRecord->dataPdu[i]); spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); - priv->pausedStaHandle[0]=(CsrUint8)(staRecord->assignedHandle); + priv->pausedStaHandle[0]=(u8)(staRecord->assignedHandle); unifi_trace(priv, UDBG1, "(ENOSPC) PS-POLL received : PDU sending failed \n"); } else { if(r) { @@ -3447,10 +3447,10 @@ tx_buffered_packets_t *dequeue_tx_data_pdu(unifi_priv_t *priv, struct list_head } /* generic function to get the station record handler */ CsrWifiRouterCtrlStaInfo_t *CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(unifi_priv_t *priv, - const CsrUint8 *peerMacAddress, + const u8 *peerMacAddress, CsrUint16 interfaceTag) { - CsrUint8 i; + u8 i; netInterface_priv_t *interfacePriv; unsigned long lock_flags; @@ -3527,7 +3527,7 @@ void uf_check_inactivity(unifi_priv_t *priv, CsrUint16 interfaceTag, CsrTime cur spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); if (elapsedTime > MAX_INACTIVITY_INTERVAL) { - memcpy((CsrUint8*)&peerMacAddress, (CsrUint8*)&staInfo->peerMacAddress, sizeof(CsrWifiMacAddress)); + memcpy((u8*)&peerMacAddress, (u8*)&staInfo->peerMacAddress, sizeof(CsrWifiMacAddress)); /* Indicate inactivity for the station */ unifi_trace(priv, UDBG3, "Station %x:%x:%x:%x:%x:%x inactive since %xus\n sending Inactive Ind\n", @@ -3544,7 +3544,7 @@ void uf_check_inactivity(unifi_priv_t *priv, CsrUint16 interfaceTag, CsrTime cur } /* Function to update activity of a station */ -void uf_update_sta_activity(unifi_priv_t *priv, CsrUint16 interfaceTag, const CsrUint8 *peerMacAddress) +void uf_update_sta_activity(unifi_priv_t *priv, CsrUint16 interfaceTag, const u8 *peerMacAddress) { CsrTime elapsedTime, currentTime; /* Time in microseconds */ CsrTime timeHi; /* Not used - Time in microseconds */ @@ -3591,7 +3591,7 @@ void resume_unicast_buffered_frames(unifi_priv_t *priv, CsrUint16 interfaceTag) { netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - CsrUint8 i; + u8 i; int j; tx_buffered_packets_t * buffered_pkt = NULL; CsrBool hipslotFree[4] = {TRUE,TRUE,TRUE,TRUE}; @@ -3635,7 +3635,7 @@ void resume_unicast_buffered_frames(unifi_priv_t *priv, CsrUint16 interfaceTag) spin_lock_irqsave(&priv->tx_q_lock,lock_flags); list_add(&buffered_pkt->q, &staInfo->mgtFrames); spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); - priv->pausedStaHandle[3]=(CsrUint8)(staInfo->assignedHandle); + priv->pausedStaHandle[3]=(u8)(staInfo->assignedHandle); hipslotFree[3] = FALSE; break; } else { @@ -3660,7 +3660,7 @@ void resume_unicast_buffered_frames(unifi_priv_t *priv, CsrUint16 interfaceTag) spin_lock_irqsave(&priv->tx_q_lock,lock_flags); list_add(&buffered_pkt->q, &staInfo->dataPdu[j]); spin_unlock_irqrestore(&priv->tx_q_lock,lock_flags); - priv->pausedStaHandle[j]=(CsrUint8)(staInfo->assignedHandle); + priv->pausedStaHandle[j]=(u8)(staInfo->assignedHandle); hipslotFree[j]=FALSE; break; } else { @@ -3721,7 +3721,7 @@ void update_eosp_to_head_of_broadcast_list_head(unifi_priv_t *priv,CsrUint16 int void resume_suspended_uapsd(unifi_priv_t* priv,CsrUint16 interfaceTag) { - CsrUint8 startIndex; + u8 startIndex; CsrWifiRouterCtrlStaInfo_t * staInfo = NULL; unsigned long lock_flags; diff --git a/drivers/staging/csr/unifi_priv.h b/drivers/staging/csr/unifi_priv.h index 7e940ef..666e17f 100644 --- a/drivers/staging/csr/unifi_priv.h +++ b/drivers/staging/csr/unifi_priv.h @@ -202,14 +202,14 @@ extern struct wake_lock unifi_sdio_wake_lock; #define CSR_WIFI_80211_FRAME_SUBTYPE_BEACON 0x8 #define CSR_WIFI_BEACON_FIXED_LENGTH 12 #define CSR_WIFI_FRAME_SUBTYPE_BIT_OFFSET 4 -#define CSR_WIFI_80211_FRAME_SUBTYPE_BIT_MASK ((CsrUint8)(0xF << CSR_WIFI_FRAME_SUBTYPE_BIT_OFFSET)) +#define CSR_WIFI_80211_FRAME_SUBTYPE_BIT_MASK ((u8)(0xF << CSR_WIFI_FRAME_SUBTYPE_BIT_OFFSET)) #define CSR_WIFI_80211_GET_FRAME_SUBTYPE(frameBuffer) \ - ((CsrUint8)(((CsrUint8 *)frameBuffer)[0] & CSR_WIFI_80211_FRAME_SUBTYPE_BIT_MASK) >> CSR_WIFI_FRAME_SUBTYPE_BIT_OFFSET) + ((u8)(((u8 *)frameBuffer)[0] & CSR_WIFI_80211_FRAME_SUBTYPE_BIT_MASK) >> CSR_WIFI_FRAME_SUBTYPE_BIT_OFFSET) /* For M4 request received via netdev*/ -typedef CsrUint8 CsrWifiPacketType; +typedef u8 CsrWifiPacketType; #define CSR_WIFI_UNICAST_PDU ((CsrWifiPacketType) 0x00) #define CSR_WIFI_MULTICAST_PDU ((CsrWifiPacketType) 0x1) #define CSR_WIFI_BROADCAST_PDU ((CsrWifiPacketType) 0x2) @@ -280,7 +280,7 @@ typedef struct rx_buffered_packets { } rx_buffered_packets_t; -typedef CsrUint8 CsrWifiAcPowersaveMode; +typedef u8 CsrWifiAcPowersaveMode; #define CSR_WIFI_AC_TRIGGER_ONLY_ENABLED 0x00 #define CSR_WIFI_AC_DELIVERY_ONLY_ENABLE 0X01 #define CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED 0X03 @@ -351,13 +351,13 @@ typedef struct CsrWifiRouterCtrlStaInfo_t { CsrWifiRouterCtrlPeerStatus currentPeerState; struct list_head dataPdu[MAX_ACCESS_CATOGORY]; struct list_head mgtFrames; - CsrUint8 spStatus; - CsrUint8 prevFrmType; - CsrUint8 prevFrmAccessCatogory; + u8 spStatus; + u8 prevFrmType; + u8 prevFrmAccessCatogory; CsrBool protection; CsrUint16 aid; CsrBool txSuspend; - CsrUint8 timSet; + u8 timSet; /* Dont change the value of below macro for SET & RESET */ #define CSR_WIFI_TIM_RESET 0 #define CSR_WIFI_TIM_SET 1 @@ -365,7 +365,7 @@ typedef struct CsrWifiRouterCtrlStaInfo_t { #define CSR_WIFI_TIM_SETTING 3 CsrBool timRequestPendingFlag; - CsrUint8 updateTimReqQueued; + u8 updateTimReqQueued; CsrUint16 noOfPktQueued; }CsrWifiRouterCtrlStaInfo_t; @@ -374,8 +374,8 @@ struct CsrWifiSmeApConfig { CsrWifiSsid ssid; CsrUint16 channel; CsrWifiNmeApCredentials credentials; - CsrUint8 max_connections; - CsrUint8 if_index; + u8 max_connections; + u8 if_index; }; #endif @@ -385,16 +385,16 @@ struct CsrWifiSmeApConfig { typedef struct { - CsrUint8 *bufptr; /* Signal Primitive */ + u8 *bufptr; /* Signal Primitive */ bulk_data_param_t data_ptrs; /* Bulk Data pointers */ CsrUint16 sig_len; }rx_buff_struct_t; typedef struct { - CsrUint8 writePointer; /**< write pointer */ - CsrUint8 readPointer; /**< read pointer */ - CsrUint8 size; /**< size of circular buffer */ + u8 writePointer; /**< write pointer */ + u8 readPointer; /**< read pointer */ + u8 size; /**< size of circular buffer */ rx_buff_struct_t rx_buff[CSR_WIFI_RX_SIGNAL_BUFFER_SIZE]; /**< Element of ciruclar buffer */ } rxCircularBuffer_t; @@ -427,7 +427,7 @@ struct unifi_priv { struct net_device *netdev[CSR_WIFI_NUM_INTERFACES]; struct netInterface_priv *interfacePriv[CSR_WIFI_NUM_INTERFACES]; - CsrUint8 totalInterfaceCount; + u8 totalInterfaceCount; int prev_queue; @@ -493,8 +493,8 @@ struct unifi_priv { #ifdef CSR_SUPPORT_SME /* lock to protect the tx queues list */ spinlock_t tx_q_lock; - CsrUint8 allPeerDozing; - CsrUint8 pausedStaHandle[MAX_ACCESS_CATOGORY]; + u8 allPeerDozing; + u8 pausedStaHandle[MAX_ACCESS_CATOGORY]; /* Max packet the driver can queue, irrespective of interface number */ CsrUint16 noOfPktQueuedInDriver; #define CSR_WIFI_DRIVER_SUPPORT_FOR_MAX_PKT_QUEUEING 512 @@ -638,7 +638,7 @@ struct unifi_priv { /* Array to indicate if a particular Tx queue is paused, this may not be * required in a multiqueue implementation since we can directly stop kernel * queues */ - CsrUint8 tx_q_paused_flag[UNIFI_TRAFFIC_Q_MAX]; + u8 tx_q_paused_flag[UNIFI_TRAFFIC_Q_MAX]; #endif #ifdef CSR_WIFI_RX_PATH_SPLIT @@ -655,10 +655,10 @@ struct unifi_priv { #ifdef CSR_WIFI_SECURITY_WAPI_ENABLE /*Set if multicast KeyID = 1*/ - CsrUint8 wapi_multicast_filter; + u8 wapi_multicast_filter; /*Set if unicast KeyID = 1*/ - CsrUint8 wapi_unicast_filter; - CsrUint8 wapi_unicast_queued_pkt_filter; + u8 wapi_unicast_filter; + u8 wapi_unicast_queued_pkt_filter; #ifdef CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND CsrBool isWapiConnection; #endif @@ -675,7 +675,7 @@ struct unifi_priv { typedef struct { CsrUint16 queue_length[4]; - CsrUint8 os_queue_paused; + u8 os_queue_paused; } unifi_OsQosInfo; @@ -716,14 +716,14 @@ typedef struct netInterface_priv ba_session_tx_struct *ba_session_tx[MAX_SUPPORTED_BA_SESSIONS_TX]; ba_session_rx_struct *ba_session_rx[MAX_SUPPORTED_BA_SESSIONS_RX]; frame_desc_struct ba_complete[MAX_BA_WIND_SIZE]; - CsrUint8 ba_complete_index; - CsrUint8 queueEnabled[UNIFI_NO_OF_TX_QS]; + u8 ba_complete_index; + u8 queueEnabled[UNIFI_NO_OF_TX_QS]; struct work_struct send_m4_ready_task; #ifdef CSR_WIFI_SECURITY_WAPI_ENABLE struct work_struct send_pkt_to_encrypt; #endif struct net_device_stats stats; - CsrUint8 interfaceMode; + u8 interfaceMode; CsrBool protect; CsrWifiMacAddress bssid; /* @@ -756,7 +756,7 @@ typedef struct netInterface_priv unifi_port_config_t uncontrolled_data_port; /* station record maintenance related data structures */ - CsrUint8 num_stations_joined; + u8 num_stations_joined; CsrWifiRouterCtrlStaInfo_t *(staInfo)[UNIFI_MAX_CONNECTIONS]; struct list_head genericMgtFrames; struct list_head genericMulticastOrBroadCastFrames; @@ -957,31 +957,31 @@ int uf_verify_m4(unifi_priv_t *priv, const unsigned char *packet, #ifdef CSR_SUPPORT_SME CsrBool uf_check_broadcast_bssid(unifi_priv_t *priv, const bulk_data_param_t *bulkdata); -CsrBool uf_process_pm_bit_for_peer(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t * srcStaInfo,CsrUint8 pmBit,CsrUint16 interfaceTag); -void uf_process_ps_poll(unifi_priv_t *priv,CsrUint8* sa,CsrUint8* da,CsrUint8 pmBit,CsrUint16 interfaceTag); +CsrBool uf_process_pm_bit_for_peer(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t * srcStaInfo,u8 pmBit,CsrUint16 interfaceTag); +void uf_process_ps_poll(unifi_priv_t *priv,u8* sa,u8* da,u8 pmBit,CsrUint16 interfaceTag); int uf_ap_process_data_pdu(unifi_priv_t *priv, struct sk_buff *skb, struct ethhdr *ehdr, CsrWifiRouterCtrlStaInfo_t * srcStaInfo, const CSR_SIGNAL *signal, bulk_data_param_t *bulkdata, - CsrUint8 macHeaderLengthInBytes); + u8 macHeaderLengthInBytes); CsrBool uf_is_more_data_for_non_delivery_ac(CsrWifiRouterCtrlStaInfo_t *staRecord); void uf_process_wmm_deliver_ac_uapsd ( unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t * srcStaInfo, CsrUint16 qosControl, CsrUint16 interfaceTag); -void uf_send_buffered_data_from_ac(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo, CsrUint8 queue, struct list_head *txList); -void uf_send_buffered_data_from_delivery_ac(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo, CsrUint8 queue, struct list_head *txList); +void uf_send_buffered_data_from_ac(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo, u8 queue, struct list_head *txList); +void uf_send_buffered_data_from_delivery_ac(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo, u8 queue, struct list_head *txList); void uf_continue_uapsd(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo); -void uf_send_qos_null(unifi_priv_t * priv,CsrUint16 interfaceTag, const CsrUint8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo); -void uf_send_nulldata(unifi_priv_t * priv,CsrUint16 interfaceTag, const CsrUint8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo); +void uf_send_qos_null(unifi_priv_t * priv,CsrUint16 interfaceTag, const u8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo); +void uf_send_nulldata(unifi_priv_t * priv,CsrUint16 interfaceTag, const u8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo); #endif -CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, CsrUint8 *peerMacAddress, CSR_CLIENT_TAG hostTag, CsrUint16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl, CSR_RATE TransmitRate, CSR_PRIORITY priority, CSR_PROCESS_ID senderId, bulk_data_param_t *bulkdata); -void uf_process_ma_vif_availibility_ind(unifi_priv_t *priv,CsrUint8 *sigdata, CsrUint32 siglen); +CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, u8 *peerMacAddress, CSR_CLIENT_TAG hostTag, CsrUint16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl, CSR_RATE TransmitRate, CSR_PRIORITY priority, CSR_PROCESS_ID senderId, bulk_data_param_t *bulkdata); +void uf_process_ma_vif_availibility_ind(unifi_priv_t *priv,u8 *sigdata, CsrUint32 siglen); #ifdef CSR_SUPPORT_SME void uf_send_buffered_frames(unifi_priv_t *priv,unifi_TrafficQueue queue); int uf_process_station_records_for_sending_data(unifi_priv_t *priv,CsrUint16 interfaceTag, @@ -1029,8 +1029,8 @@ int prepare_and_add_macheader(unifi_priv_t *priv, CSR_PRIORITY priority, bulk_data_param_t *bulkdata, CsrUint16 interfaceTag, - const CsrUint8 *daddr, - const CsrUint8 *saddr, + const u8 *daddr, + const u8 *saddr, CsrBool protection); CSR_PRIORITY get_packet_priority(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr *ehdr, netInterface_priv_t *interfacePriv); @@ -1039,21 +1039,21 @@ void unifi_frame_ma_packet_req(unifi_priv_t *priv, CSR_PRIORITY priority, CSR_RATE TransmitRate, CSR_CLIENT_TAG hostTag, CsrUint16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl, - CSR_PROCESS_ID leSenderProcessId, CsrUint8 *peerMacAddress, + CSR_PROCESS_ID leSenderProcessId, u8 *peerMacAddress, CSR_SIGNAL *signal); /* Pack the LSB to include station handle & status of tim set */ #define CSR_WIFI_PACK_SENDER_ID_LSB_FOR_TIM_REQ(handle, timState) ((handle << 2) | timState) /* get the station record handle from the sender ID */ -#define CSR_WIFI_GET_STATION_HANDLE_FROM_RECEIVER_ID(receiverProcessId) (CsrUint8) ((receiverProcessId & 0xff) >> 2) +#define CSR_WIFI_GET_STATION_HANDLE_FROM_RECEIVER_ID(receiverProcessId) (u8) ((receiverProcessId & 0xff) >> 2) /* get the timSet status from the sender ID */ -#define CSR_WIFI_GET_TIMSET_STATE_FROM_RECEIVER_ID(receiverProcessId) (CsrUint8) (receiverProcessId & 0x03) +#define CSR_WIFI_GET_TIMSET_STATE_FROM_RECEIVER_ID(receiverProcessId) (u8) (receiverProcessId & 0x03) /* handle is 6 bits to accomodate in senderId LSB (only 64 station can be associated) */ #define CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE 0x3F -void update_tim(unifi_priv_t * priv, CsrUint16 aid, CsrUint8 setTim, CsrUint16 interfaceTag, CsrUint32 handle); +void update_tim(unifi_priv_t * priv, CsrUint16 aid, u8 setTim, CsrUint16 interfaceTag, CsrUint32 handle); void uf_handle_tim_cfm(unifi_priv_t *priv, CSR_MLME_SET_TIM_CONFIRM *cfm, CsrUint16 senderProcessId); /* Clear the Peer station Record, in case of wifioff/unexpected card removal */ @@ -1071,13 +1071,13 @@ CsrBool blockack_session_stop(unifi_priv_t *priv, CsrWifiMacAddress macAddress); #ifdef CSR_SUPPORT_SME /* Fetch the protection information from interface Mode */ -CsrInt8 uf_get_protection_bit_from_interfacemode(unifi_priv_t *priv, CsrUint16 interfaceTag, const CsrUint8 *daddr); +CsrInt8 uf_get_protection_bit_from_interfacemode(unifi_priv_t *priv, CsrUint16 interfaceTag, const u8 *daddr); #endif /* Fetch the station record handler from data base for matching Mac address */ #ifdef CSR_SUPPORT_SME CsrWifiRouterCtrlStaInfo_t *CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(unifi_priv_t *priv, - const CsrUint8 *peerMacAddress, + const u8 *peerMacAddress, CsrUint16 interfaceTag); /* Fetch the station record handler from data base for matching handle */ @@ -1085,7 +1085,7 @@ CsrWifiRouterCtrlStaInfo_t * CsrWifiRouterCtrlGetStationRecordFromHandle(unifi_p CsrUint32 handle, CsrUint16 interfaceTag); -void uf_update_sta_activity(unifi_priv_t *priv, CsrUint16 interfaceTag, const CsrUint8 *peerMacAddress); +void uf_update_sta_activity(unifi_priv_t *priv, CsrUint16 interfaceTag, const u8 *peerMacAddress); void uf_process_ma_pkt_cfm_for_ap(unifi_priv_t *priv,CsrUint16 interfaceTag, const CSR_MA_PACKET_CONFIRM *pkt_cfm); #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) diff --git a/drivers/staging/csr/unifi_sme.c b/drivers/staging/csr/unifi_sme.c index 5ad1d5f..559213b 100644 --- a/drivers/staging/csr/unifi_sme.c +++ b/drivers/staging/csr/unifi_sme.c @@ -116,13 +116,13 @@ sme_log_event(ul_client_t *pcli, { CsrUint16 frmCtrl; CsrBool unicastPdu = TRUE; - CsrUint8 *macHdrLocation; - CsrUint8 *raddr = NULL, *taddr = NULL; + u8 *macHdrLocation; + u8 *raddr = NULL, *taddr = NULL; CsrWifiMacAddress peerMacAddress; /* Check if we need to send CsrWifiRouterCtrlMicFailureInd*/ CSR_MA_PACKET_INDICATION *ind = &unpacked_signal.u.MaPacketIndication; - macHdrLocation = (CsrUint8 *) bulkdata->d[0].os_data_ptr; + macHdrLocation = (u8 *) bulkdata->d[0].os_data_ptr; /* Fetch the frame control value from mac header */ frmCtrl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(macHdrLocation); @@ -146,7 +146,7 @@ sme_log_event(ul_client_t *pcli, { if(ind->ReceptionStatus == CSR_RX_SUCCESS) { - CsrUint8 pmBit = (frmCtrl & 0x1000)?0x01:0x00; + u8 pmBit = (frmCtrl & 0x1000)?0x01:0x00; CsrUint16 interfaceTag = (ind->VirtualInterfaceIdentifier & 0xff); CsrWifiRouterCtrlStaInfo_t *srcStaInfo = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv,taddr,interfaceTag); if((srcStaInfo != NULL) && (uf_check_broadcast_bssid(priv, bulkdata)== FALSE)) @@ -226,11 +226,11 @@ sme_log_event(ul_client_t *pcli, } mlmeCommand.length = signal_len; - mlmeCommand.data = (CsrUint8*)signal; + mlmeCommand.data = (u8*)signal; dataref1.length = bulkdata->d[0].data_length; if (dataref1.length > 0) { - dataref1.data = (CsrUint8 *) bulkdata->d[0].os_data_ptr; + dataref1.data = (u8 *) bulkdata->d[0].os_data_ptr; } else { dataref1.data = NULL; @@ -238,7 +238,7 @@ sme_log_event(ul_client_t *pcli, dataref2.length = bulkdata->d[1].data_length; if (dataref2.length > 0) { - dataref2.data = (CsrUint8 *) bulkdata->d[1].os_data_ptr; + dataref2.data = (u8 *) bulkdata->d[1].os_data_ptr; } else { dataref2.data = NULL; @@ -615,10 +615,10 @@ int unifi_cfg_packet_filters(unifi_priv_t *priv, unsigned char *arg) dhcp_tclas->user_priority = 0; dhcp_tclas->tcp_ip_cls_fr.cls_fr_type = 1; dhcp_tclas->tcp_ip_cls_fr.version = 4; - ((CsrUint8*)(&dhcp_tclas->tcp_ip_cls_fr.source_port))[0] = 0x00; - ((CsrUint8*)(&dhcp_tclas->tcp_ip_cls_fr.source_port))[1] = 0x44; - ((CsrUint8*)(&dhcp_tclas->tcp_ip_cls_fr.dest_port))[0] = 0x00; - ((CsrUint8*)(&dhcp_tclas->tcp_ip_cls_fr.dest_port))[1] = 0x43; + ((u8*)(&dhcp_tclas->tcp_ip_cls_fr.source_port))[0] = 0x00; + ((u8*)(&dhcp_tclas->tcp_ip_cls_fr.source_port))[1] = 0x44; + ((u8*)(&dhcp_tclas->tcp_ip_cls_fr.dest_port))[0] = 0x00; + ((u8*)(&dhcp_tclas->tcp_ip_cls_fr.dest_port))[1] = 0x43; dhcp_tclas->tcp_ip_cls_fr.protocol = 0x11; dhcp_tclas->tcp_ip_cls_fr.cls_fr_mask = 0x58; //bits: 3,4,6 } @@ -631,10 +631,10 @@ int unifi_cfg_packet_filters(unifi_priv_t *priv, unsigned char *arg) int unifi_cfg_wmm_qos_info(unifi_priv_t *priv, unsigned char *arg) { - CsrUint8 wmm_qos_info; + u8 wmm_qos_info; int rc = 0; - if (get_user(wmm_qos_info, (CsrUint8*)(((unifi_cfg_command_t*)arg) + 1))) { + if (get_user(wmm_qos_info, (u8*)(((unifi_cfg_command_t*)arg) + 1))) { unifi_error(priv, "UNIFI_CFG: Failed to get the argument\n"); return -EFAULT; } @@ -649,21 +649,21 @@ int unifi_cfg_wmm_qos_info(unifi_priv_t *priv, unsigned char *arg) int unifi_cfg_wmm_addts(unifi_priv_t *priv, unsigned char *arg) { CsrUint32 addts_tid; - CsrUint8 addts_ie_length; - CsrUint8 *addts_ie; - CsrUint8 *addts_params; + u8 addts_ie_length; + u8 *addts_ie; + u8 *addts_params; CsrWifiSmeDataBlock tspec; CsrWifiSmeDataBlock tclas; int rc; - addts_params = (CsrUint8*)(((unifi_cfg_command_t*)arg) + 1); + addts_params = (u8*)(((unifi_cfg_command_t*)arg) + 1); if (get_user(addts_tid, (CsrUint32*)addts_params)) { unifi_error(priv, "unifi_cfg_wmm_addts: Failed to get the argument\n"); return -EFAULT; } addts_params += sizeof(CsrUint32); - if (get_user(addts_ie_length, (CsrUint8*)addts_params)) { + if (get_user(addts_ie_length, (u8*)addts_params)) { unifi_error(priv, "unifi_cfg_wmm_addts: Failed to get the argument\n"); return -EFAULT; } @@ -679,7 +679,7 @@ int unifi_cfg_wmm_addts(unifi_priv_t *priv, unsigned char *arg) return -ENOMEM; } - addts_params += sizeof(CsrUint8); + addts_params += sizeof(u8); rc = copy_from_user(addts_ie, addts_params, addts_ie_length); if (rc) { unifi_error(priv, "unifi_cfg_wmm_addts: Failed to get the addts buffer\n"); @@ -703,12 +703,12 @@ int unifi_cfg_wmm_addts(unifi_priv_t *priv, unsigned char *arg) int unifi_cfg_wmm_delts(unifi_priv_t *priv, unsigned char *arg) { CsrUint32 delts_tid; - CsrUint8 *delts_params; + u8 *delts_params; CsrWifiSmeDataBlock tspec; CsrWifiSmeDataBlock tclas; int rc; - delts_params = (CsrUint8*)(((unifi_cfg_command_t*)arg) + 1); + delts_params = (u8*)(((unifi_cfg_command_t*)arg) + 1); if (get_user(delts_tid, (CsrUint32*)delts_params)) { unifi_error(priv, "unifi_cfg_wmm_delts: Failed to get the argument\n"); return -EFAULT; @@ -728,13 +728,13 @@ int unifi_cfg_wmm_delts(unifi_priv_t *priv, unsigned char *arg) int unifi_cfg_strict_draft_n(unifi_priv_t *priv, unsigned char *arg) { CsrBool strict_draft_n; - CsrUint8 *strict_draft_n_params; + u8 *strict_draft_n_params; int rc; CsrWifiSmeStaConfig staConfig; CsrWifiSmeDeviceConfig deviceConfig; - strict_draft_n_params = (CsrUint8*)(((unifi_cfg_command_t*)arg) + 1); + strict_draft_n_params = (u8*)(((unifi_cfg_command_t*)arg) + 1); if (get_user(strict_draft_n, (CsrBool*)strict_draft_n_params)) { unifi_error(priv, "unifi_cfg_strict_draft_n: Failed to get the argument\n"); return -EFAULT; @@ -764,13 +764,13 @@ int unifi_cfg_strict_draft_n(unifi_priv_t *priv, unsigned char *arg) int unifi_cfg_enable_okc(unifi_priv_t *priv, unsigned char *arg) { CsrBool enable_okc; - CsrUint8 *enable_okc_params; + u8 *enable_okc_params; int rc; CsrWifiSmeStaConfig staConfig; CsrWifiSmeDeviceConfig deviceConfig; - enable_okc_params = (CsrUint8*)(((unifi_cfg_command_t*)arg) + 1); + enable_okc_params = (u8*)(((unifi_cfg_command_t*)arg) + 1); if (get_user(enable_okc, (CsrBool*)enable_okc_params)) { unifi_error(priv, "unifi_cfg_enable_okc: Failed to get the argument\n"); return -EFAULT; @@ -911,7 +911,7 @@ int unifi_cfg_get_info(unifi_priv_t *priv, unsigned char *arg) } #ifdef CSR_SUPPORT_WEXT_AP int - uf_configure_supported_rates(CsrUint8 * supportedRates, CsrUint8 phySupportedBitmap) + uf_configure_supported_rates(u8 * supportedRates, u8 phySupportedBitmap) { int i=0; CsrBool b=FALSE, g = FALSE, n = FALSE; @@ -1199,7 +1199,7 @@ void uf_send_pkt_to_encrypt(struct work_struct *work) unifi_priv_t *priv = interfacePriv->privPtr; CsrUint32 pktBulkDataLength; - CsrUint8 *pktBulkData; + u8 *pktBulkData; unsigned long flags; if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_STA) { @@ -1209,7 +1209,7 @@ void uf_send_pkt_to_encrypt(struct work_struct *work) pktBulkDataLength = interfacePriv->wapi_unicast_bulk_data.data_length; if (pktBulkDataLength > 0) { - pktBulkData = (CsrUint8 *)CsrPmemAlloc(pktBulkDataLength); + pktBulkData = (u8 *)CsrPmemAlloc(pktBulkDataLength); CsrMemSet(pktBulkData, 0, pktBulkDataLength); } else { unifi_error(priv, "uf_send_pkt_to_encrypt() : invalid buffer\n"); @@ -1218,7 +1218,7 @@ void uf_send_pkt_to_encrypt(struct work_struct *work) spin_lock_irqsave(&priv->wapi_lock, flags); /* Copy over the MA PKT REQ bulk data */ - CsrMemCpy(pktBulkData, (CsrUint8*)interfacePriv->wapi_unicast_bulk_data.os_data_ptr, pktBulkDataLength); + CsrMemCpy(pktBulkData, (u8*)interfacePriv->wapi_unicast_bulk_data.os_data_ptr, pktBulkDataLength); /* Free any bulk data buffers allocated for the WAPI Data pkt */ unifi_net_data_free(priv, &interfacePriv->wapi_unicast_bulk_data); interfacePriv->wapi_unicast_bulk_data.net_buf_length = 0; diff --git a/drivers/staging/csr/unifi_sme.h b/drivers/staging/csr/unifi_sme.h index 3cbee81..05de4cd 100644 --- a/drivers/staging/csr/unifi_sme.h +++ b/drivers/staging/csr/unifi_sme.h @@ -87,8 +87,8 @@ typedef struct { CsrUint16 appHandle; CsrWifiRouterEncapsulation encapsulation; CsrUint16 protocol; - CsrUint8 oui[3]; - CsrUint8 in_use; + u8 oui[3]; + u8 in_use; } sme_ma_unidata_ind_filter_t; @@ -213,7 +213,7 @@ int sme_mgt_mib_set(unifi_priv_t *priv, int sme_ap_start(unifi_priv_t *priv,CsrUint16 interface_tag,CsrWifiSmeApConfig_t *ap_config); int sme_ap_stop(unifi_priv_t *priv,CsrUint16 interface_tag); int sme_ap_config(unifi_priv_t *priv,CsrWifiSmeApMacConfig *ap_mac_config, CsrWifiNmeApConfig *group_security_config); -int uf_configure_supported_rates(CsrUint8 * supportedRates, CsrUint8 phySupportedBitmap); +int uf_configure_supported_rates(u8 * supportedRates, u8 phySupportedBitmap); #endif int unifi_translate_scan(struct net_device *dev, struct iw_request_info *info, diff --git a/drivers/staging/csr/unifiio.h b/drivers/staging/csr/unifiio.h index 4ab050b..c1e3f53 100644 --- a/drivers/staging/csr/unifiio.h +++ b/drivers/staging/csr/unifiio.h @@ -212,7 +212,7 @@ typedef struct { -typedef CsrUint8 unifi_putest_command_t; +typedef u8 unifi_putest_command_t; #define UNIFI_PUTEST_START 0 #define UNIFI_PUTEST_STOP 1 @@ -310,21 +310,21 @@ typedef struct uf_cfg_bcast_packet_filter typedef struct uf_cfg_ap_config { - CsrUint8 phySupportedBitmap; - CsrUint8 channel; + u8 phySupportedBitmap; + u8 channel; CsrUint16 beaconInterval; - CsrUint8 dtimPeriod; + u8 dtimPeriod; CsrBool wmmEnabled; - CsrUint8 shortSlotTimeEnabled; + u8 shortSlotTimeEnabled; CsrUint16 groupkeyTimeout; CsrBool strictGtkRekeyEnabled; CsrUint16 gmkTimeout; CsrUint16 responseTimeout; - CsrUint8 retransLimit; - CsrUint8 rxStbc; + u8 retransLimit; + u8 rxStbc; CsrBool rifsModeAllowed; - CsrUint8 dualCtsProtection; - CsrUint8 ctsProtectionType; + u8 dualCtsProtection; + u8 ctsProtectionType; CsrUint16 maxListenInterval; }uf_cfg_ap_config_t; @@ -358,14 +358,14 @@ typedef struct tclas { /* WAPI Key */ typedef struct { - CsrUint8 unicastKey; + u8 unicastKey; /* If non zero, then unicast key otherwise group key */ - CsrUint8 keyIndex; - CsrUint8 keyRsc[16]; - CsrUint8 authenticator; + u8 keyIndex; + u8 keyRsc[16]; + u8 authenticator; /* If non zero, then authenticator otherwise supplicant */ - CsrUint8 address[6]; - CsrUint8 key[32]; + u8 address[6]; + u8 key[32]; } unifiio_wapi_key_t; /* Values describing XAP memory regions captured by the mini-coredump system */ -- cgit v0.10.2 From 163eb0d85294e08b686d453744ca95e5f583e7db Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 11:56:26 -0700 Subject: staging: csr: remove CsrInt8 typedef MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the in-kernel s8 type instead. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_types.h b/drivers/staging/csr/csr_types.h index 683e077..e295060 100644 --- a/drivers/staging/csr/csr_types.h +++ b/drivers/staging/csr/csr_types.h @@ -37,7 +37,6 @@ typedef uint16_t CsrUint16; typedef uint32_t CsrUint32; /* Signed fixed width types */ -typedef int8_t CsrInt8; typedef int16_t CsrInt16; typedef int32_t CsrInt32; diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index 42fb7b0..6f709da 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -43,7 +43,7 @@ * F1-F3 80-BF 80-BF 80-BF * F4 80-8F 80-BF 80-BF */ -static const CsrInt8 trailingBytesForUtf8[256] = +static const s8 trailingBytesForUtf8[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 - 0x1F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 - 0x3F */ @@ -568,7 +568,7 @@ CsrUtf16String *CsrUtf82Utf16String(const CsrUtf8String *utf8String) CsrSize sourceLength; CsrUtf16String *dest = NULL; CsrUtf16String *destStart = NULL; - CsrInt8 extraBytes2Read; + s8 extraBytes2Read; if (!utf8String) { diff --git a/drivers/staging/csr/csr_wifi_hip_card.h b/drivers/staging/csr/csr_wifi_hip_card.h index c99a606..fcaf27d 100644 --- a/drivers/staging/csr/csr_wifi_hip_card.h +++ b/drivers/staging/csr/csr_wifi_hip_card.h @@ -104,7 +104,7 @@ CsrResult card_wait_for_firmware_to_start(card_t *card, CsrUint32 *paddr); CsrResult unifi_dl_firmware(card_t *card, void *arg); CsrResult unifi_dl_patch(card_t *card, void *arg, CsrUint32 boot_ctrl); CsrResult unifi_do_loader_op(card_t *card, CsrUint32 op_addr, u8 opcode); -void* unifi_dl_fw_read_start(card_t *card, CsrInt8 is_fw); +void* unifi_dl_fw_read_start(card_t *card, s8 is_fw); CsrResult unifi_coredump_handle_request(card_t *card); diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c index d5066ac..d98610f 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c @@ -564,7 +564,7 @@ CsrResult unifi_read_direct32(card_t *card, CsrUint32 addr, CsrUint32 *pdata) * even address is read. * --------------------------------------------------------------------------- */ -static CsrResult unifi_read_directn_match(card_t *card, CsrUint32 addr, void *pdata, CsrUint16 len, CsrInt8 m, CsrUint32 *num) +static CsrResult unifi_read_directn_match(card_t *card, CsrUint32 addr, void *pdata, CsrUint16 len, s8 m, CsrUint32 *num) { CsrResult r; CsrUint32 i; @@ -583,7 +583,7 @@ static CsrResult unifi_read_directn_match(card_t *card, CsrUint32 addr, void *pd } *cptr++ = ((u8)w & 0xFF); - if ((m >= 0) && (((CsrInt8)w & 0xFF) == m)) + if ((m >= 0) && (((s8)w & 0xFF) == m)) { break; } @@ -595,7 +595,7 @@ static CsrResult unifi_read_directn_match(card_t *card, CsrUint32 addr, void *pd } *cptr++ = ((u8)(w >> 8) & 0xFF); - if ((m >= 0) && (((CsrInt8)(w >> 8) & 0xFF) == m)) + if ((m >= 0) && (((s8)(w >> 8) & 0xFF) == m)) { break; } @@ -1278,7 +1278,7 @@ CsrResult unifi_read32(card_t *card, CsrUint32 unifi_addr, CsrUint32 *pdata) * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified * --------------------------------------------------------------------------- */ -CsrResult unifi_readn_match(card_t *card, CsrUint32 unifi_addr, void *pdata, CsrUint16 len, CsrInt8 match) +CsrResult unifi_readn_match(card_t *card, CsrUint32 unifi_addr, void *pdata, CsrUint16 len, s8 match) { CsrUint32 sdio_addr; CsrResult r; diff --git a/drivers/staging/csr/csr_wifi_hip_download.c b/drivers/staging/csr/csr_wifi_hip_download.c index c43f589..4f7dae8 100644 --- a/drivers/staging/csr/csr_wifi_hip_download.c +++ b/drivers/staging/csr/csr_wifi_hip_download.c @@ -465,7 +465,7 @@ CsrResult unifi_dl_patch(card_t *card, void *dlpriv, CsrUint32 boot_ctrl) } /* unifi_dl_patch() */ -void* unifi_dl_fw_read_start(card_t *card, CsrInt8 is_fw) +void* unifi_dl_fw_read_start(card_t *card, s8 is_fw) { card_info_t card_info; diff --git a/drivers/staging/csr/csr_wifi_hip_dump.c b/drivers/staging/csr/csr_wifi_hip_dump.c index 5297f10..efa699f 100644 --- a/drivers/staging/csr/csr_wifi_hip_dump.c +++ b/drivers/staging/csr/csr_wifi_hip_dump.c @@ -99,7 +99,7 @@ static const struct coredump_zone zonedef_table[HIP_CDUMP_NUM_ZONES] = { * immediately after that, the mini-coredump can be captured. * --------------------------------------------------------------------------- */ -CsrResult unifi_coredump_request_at_next_reset(card_t *card, CsrInt8 enable) +CsrResult unifi_coredump_request_at_next_reset(card_t *card, s8 enable) { CsrResult r; diff --git a/drivers/staging/csr/csr_wifi_hip_unifi.h b/drivers/staging/csr/csr_wifi_hip_unifi.h index 62d7740..1fb9d76 100644 --- a/drivers/staging/csr/csr_wifi_hip_unifi.h +++ b/drivers/staging/csr/csr_wifi_hip_unifi.h @@ -701,7 +701,7 @@ void unifi_get_hip_qos_info(card_t *card, unifi_HipQosInfo *hipqosinfo); * * @ingroup upperedge */ -void* unifi_fw_read_start(void *ospriv, CsrInt8 is_fw, const card_info_t *info); +void* unifi_fw_read_start(void *ospriv, s8 is_fw, const card_info_t *info); /** * @@ -871,7 +871,7 @@ void unifi_debug_hex_to_buf(const CsrCharString *buff, CsrUint16 length); /* Mini-coredump utility functions */ CsrResult unifi_coredump_get_value(card_t *card, struct unifi_coredump_req *req); CsrResult unifi_coredump_capture(card_t *card, struct unifi_coredump_req *req); -CsrResult unifi_coredump_request_at_next_reset(card_t *card, CsrInt8 enable); +CsrResult unifi_coredump_request_at_next_reset(card_t *card, s8 enable); CsrResult unifi_coredump_init(card_t *card, CsrUint16 num_dump_buffers); void unifi_coredump_free(card_t *card); diff --git a/drivers/staging/csr/csr_wifi_sme_prim.h b/drivers/staging/csr/csr_wifi_sme_prim.h index c9734a7..700f268 100644 --- a/drivers/staging/csr/csr_wifi_sme_prim.h +++ b/drivers/staging/csr/csr_wifi_sme_prim.h @@ -3087,12 +3087,12 @@ typedef struct CsrWifiSmeScanConfigData scanCfg[4]; CsrBool disableAutonomousScans; CsrUint16 maxResults; - CsrInt8 highRssiThreshold; - CsrInt8 lowRssiThreshold; - CsrInt8 deltaRssiThreshold; - CsrInt8 highSnrThreshold; - CsrInt8 lowSnrThreshold; - CsrInt8 deltaSnrThreshold; + s8 highRssiThreshold; + s8 lowRssiThreshold; + s8 deltaRssiThreshold; + s8 highSnrThreshold; + s8 lowSnrThreshold; + s8 deltaSnrThreshold; CsrUint16 passiveChannelListCount; u8 *passiveChannelList; } CsrWifiSmeScanConfig; diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.c b/drivers/staging/csr/csr_wifi_sme_serialize.c index 4558629..f35f836 100644 --- a/drivers/staging/csr/csr_wifi_sme_serialize.c +++ b/drivers/staging/csr/csr_wifi_sme_serialize.c @@ -1133,12 +1133,12 @@ CsrSize CsrWifiSmeScanConfigSetReqSizeof(void *msg) } bufferSize += 1; /* CsrBool primitive->scanConfig.disableAutonomousScans */ bufferSize += 2; /* CsrUint16 primitive->scanConfig.maxResults */ - bufferSize += 1; /* CsrInt8 primitive->scanConfig.highRssiThreshold */ - bufferSize += 1; /* CsrInt8 primitive->scanConfig.lowRssiThreshold */ - bufferSize += 1; /* CsrInt8 primitive->scanConfig.deltaRssiThreshold */ - bufferSize += 1; /* CsrInt8 primitive->scanConfig.highSnrThreshold */ - bufferSize += 1; /* CsrInt8 primitive->scanConfig.lowSnrThreshold */ - bufferSize += 1; /* CsrInt8 primitive->scanConfig.deltaSnrThreshold */ + bufferSize += 1; /* s8 primitive->scanConfig.highRssiThreshold */ + bufferSize += 1; /* s8 primitive->scanConfig.lowRssiThreshold */ + bufferSize += 1; /* s8 primitive->scanConfig.deltaRssiThreshold */ + bufferSize += 1; /* s8 primitive->scanConfig.highSnrThreshold */ + bufferSize += 1; /* s8 primitive->scanConfig.lowSnrThreshold */ + bufferSize += 1; /* s8 primitive->scanConfig.deltaSnrThreshold */ bufferSize += 2; /* CsrUint16 primitive->scanConfig.passiveChannelListCount */ bufferSize += primitive->scanConfig.passiveChannelListCount; /* u8 primitive->scanConfig.passiveChannelList */ return bufferSize; @@ -4412,12 +4412,12 @@ CsrSize CsrWifiSmeScanConfigGetCfmSizeof(void *msg) } bufferSize += 1; /* CsrBool primitive->scanConfig.disableAutonomousScans */ bufferSize += 2; /* CsrUint16 primitive->scanConfig.maxResults */ - bufferSize += 1; /* CsrInt8 primitive->scanConfig.highRssiThreshold */ - bufferSize += 1; /* CsrInt8 primitive->scanConfig.lowRssiThreshold */ - bufferSize += 1; /* CsrInt8 primitive->scanConfig.deltaRssiThreshold */ - bufferSize += 1; /* CsrInt8 primitive->scanConfig.highSnrThreshold */ - bufferSize += 1; /* CsrInt8 primitive->scanConfig.lowSnrThreshold */ - bufferSize += 1; /* CsrInt8 primitive->scanConfig.deltaSnrThreshold */ + bufferSize += 1; /* s8 primitive->scanConfig.highRssiThreshold */ + bufferSize += 1; /* s8 primitive->scanConfig.lowRssiThreshold */ + bufferSize += 1; /* s8 primitive->scanConfig.deltaRssiThreshold */ + bufferSize += 1; /* s8 primitive->scanConfig.highSnrThreshold */ + bufferSize += 1; /* s8 primitive->scanConfig.lowSnrThreshold */ + bufferSize += 1; /* s8 primitive->scanConfig.deltaSnrThreshold */ bufferSize += 2; /* CsrUint16 primitive->scanConfig.passiveChannelListCount */ bufferSize += primitive->scanConfig.passiveChannelListCount; /* u8 primitive->scanConfig.passiveChannelList */ return bufferSize; diff --git a/drivers/staging/csr/firmware.c b/drivers/staging/csr/firmware.c index 98e27d6..8199ff9 100644 --- a/drivers/staging/csr/firmware.c +++ b/drivers/staging/csr/firmware.c @@ -57,7 +57,7 @@ * --------------------------------------------------------------------------- */ void* -unifi_fw_read_start(void *ospriv, CsrInt8 is_fw, const card_info_t *info) +unifi_fw_read_start(void *ospriv, s8 is_fw, const card_info_t *info) { unifi_priv_t *priv = (unifi_priv_t*)ospriv; CSR_UNUSED(info); diff --git a/drivers/staging/csr/netdev.c b/drivers/staging/csr/netdev.c index e18395c..cef0ba3 100644 --- a/drivers/staging/csr/netdev.c +++ b/drivers/staging/csr/netdev.c @@ -1080,7 +1080,7 @@ skb_add_llc_snap(struct net_device *dev, struct sk_buff *skb, int proto) #ifdef CSR_SUPPORT_SME static int _identify_sme_ma_pkt_ind(unifi_priv_t *priv, - const CsrInt8 *oui, CsrUint16 protocol, + const s8 *oui, CsrUint16 protocol, const CSR_SIGNAL *signal, bulk_data_param_t *bulkdata, const unsigned char *daddr, @@ -1657,7 +1657,7 @@ send_ma_pkt_request(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr CsrUint16 interfaceTag; CsrWifiMacAddress peerAddress; CSR_TRANSMISSION_CONTROL transmissionControl = CSR_NO_CONFIRM_REQUIRED; - CsrInt8 protection; + s8 protection; netInterface_priv_t *interfacePriv = NULL; CSR_RATE TransmitRate = (CSR_RATE)0; diff --git a/drivers/staging/csr/sme_sys.c b/drivers/staging/csr/sme_sys.c index a84d99f..e28e7c8 100644 --- a/drivers/staging/csr/sme_sys.c +++ b/drivers/staging/csr/sme_sys.c @@ -404,7 +404,7 @@ uf_send_gratuitous_arp(unifi_priv_t *priv, CsrUint16 interfaceTag) bulk_data_param_t bulkdata; CsrResult csrResult; struct sk_buff *skb, *newSkb = NULL; - CsrInt8 protection; + s8 protection; int r; static const u8 arp_req[36] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, 0x08, 0x06, 0x00, 0x01, 0x08, 0x00, 0x06, 0x04, 0x00, 0x01, @@ -1366,7 +1366,7 @@ _sys_packet_req(unifi_priv_t *priv, const CSR_SIGNAL *signal, CsrResult csrResult; CsrUint16 interfaceTag = req.VirtualInterfaceIdentifier & 0xff; CsrBool eapolStore = FALSE; - CsrInt8 protection = 0; + s8 protection = 0; netInterface_priv_t *interfacePriv; unsigned long flags; diff --git a/drivers/staging/csr/unifi_pdu_processing.c b/drivers/staging/csr/unifi_pdu_processing.c index 3c0491b..a007a59 100644 --- a/drivers/staging/csr/unifi_pdu_processing.c +++ b/drivers/staging/csr/unifi_pdu_processing.c @@ -1976,9 +1976,9 @@ CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, } #ifdef CSR_SUPPORT_SME -CsrInt8 uf_get_protection_bit_from_interfacemode(unifi_priv_t *priv, CsrUint16 interfaceTag, const u8 *daddr) +s8 uf_get_protection_bit_from_interfacemode(unifi_priv_t *priv, CsrUint16 interfaceTag, const u8 *daddr) { - CsrInt8 protection = 0; + s8 protection = 0; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; switch(interfacePriv->interfaceMode) @@ -2205,7 +2205,7 @@ void uf_process_ma_vif_availibility_ind(unifi_priv_t *priv,u8 *sigdata, static CsrBool uf_is_more_data_for_delivery_ac(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t *staRecord) { - CsrInt8 i; + s8 i; for(i=UNIFI_TRAFFIC_Q_VO; i >= UNIFI_TRAFFIC_Q_BK; i--) { @@ -2223,7 +2223,7 @@ static CsrBool uf_is_more_data_for_delivery_ac(unifi_priv_t *priv, CsrWifiRouter static CsrBool uf_is_more_data_for_usp_delivery(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t *staRecord, unifi_TrafficQueue queue) { - CsrInt8 i; + s8 i; for(i = queue; i >= UNIFI_TRAFFIC_Q_BK; i--) { @@ -2269,7 +2269,7 @@ void uf_send_buffered_data_from_delivery_ac(unifi_priv_t *priv, tx_buffered_packets_t * buffered_pkt = NULL; unsigned long lock_flags; CsrBool eosp=FALSE; - CsrInt8 r =0; + s8 r =0; CsrBool moreData = FALSE; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; @@ -2370,7 +2370,7 @@ void uf_send_buffered_data_from_ac(unifi_priv_t *priv, unsigned long lock_flags; CsrBool eosp=FALSE; CsrBool moreData = FALSE; - CsrInt8 r =0; + s8 r =0; func_enter(); @@ -2639,7 +2639,7 @@ int uf_process_station_records_for_sending_data(unifi_priv_t *priv,CsrUint16 int static void uf_handle_uspframes_delivery(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t *staInfo, CsrUint16 interfaceTag) { - CsrInt8 i; + s8 i; u8 allDeliveryEnabled = 0, dataAvailable = 0; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; unsigned long lock_flags; @@ -3059,7 +3059,7 @@ void uf_process_ps_poll(unifi_priv_t *priv,u8* sa,u8* da,u8 pmBit,CsrUint16 inte tx_buffered_packets_t * buffered_pkt = NULL; CsrWifiMacAddress peerMacAddress; unsigned long lock_flags; - CsrInt8 r =0; + s8 r =0; CsrBool moreData = FALSE; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; @@ -3233,7 +3233,7 @@ void uf_process_ps_poll(unifi_priv_t *priv,u8* sa,u8* da,u8 pmBit,CsrUint16 inte } } else { - CsrInt8 i; + s8 i; /* We dont have buffered packet in mangement frame queue (1 failed), So proceed with condition 2 * UNIFI_TRAFFIC_Q_VO -> VI -> BE -> BK */ diff --git a/drivers/staging/csr/unifi_priv.h b/drivers/staging/csr/unifi_priv.h index 666e17f..f56c702 100644 --- a/drivers/staging/csr/unifi_priv.h +++ b/drivers/staging/csr/unifi_priv.h @@ -1071,7 +1071,7 @@ CsrBool blockack_session_stop(unifi_priv_t *priv, CsrWifiMacAddress macAddress); #ifdef CSR_SUPPORT_SME /* Fetch the protection information from interface Mode */ -CsrInt8 uf_get_protection_bit_from_interfacemode(unifi_priv_t *priv, CsrUint16 interfaceTag, const u8 *daddr); +s8 uf_get_protection_bit_from_interfacemode(unifi_priv_t *priv, CsrUint16 interfaceTag, const u8 *daddr); #endif /* Fetch the station record handler from data base for matching Mac address */ -- cgit v0.10.2 From 8c87f69acf942222d8e2ead6d0ca144957141284 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 12:00:10 -0700 Subject: staging: csr: remove CsrUint16 typedef MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the in-kernel u16 type instead. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_framework_ext.c b/drivers/staging/csr/csr_framework_ext.c index 1586b23..b2b2ea9 100644 --- a/drivers/staging/csr/csr_framework_ext.c +++ b/drivers/staging/csr/csr_framework_ext.c @@ -138,7 +138,7 @@ CsrResult CsrMutexUnlock(CsrMutexHandle *mutexHandle) * void * *----------------------------------------------------------------------------*/ -void CsrThreadSleep(CsrUint16 sleepTimeInMs) +void CsrThreadSleep(u16 sleepTimeInMs) { unsigned long t; diff --git a/drivers/staging/csr/csr_framework_ext.h b/drivers/staging/csr/csr_framework_ext.h index 401bf2d..942db87 100644 --- a/drivers/staging/csr/csr_framework_ext.h +++ b/drivers/staging/csr/csr_framework_ext.h @@ -27,13 +27,13 @@ extern "C" { #define CSR_FE_RESULT_NO_MORE_THREADS ((CsrResult) 0x0006) /* Thread priorities */ -#define CSR_THREAD_PRIORITY_HIGHEST ((CsrUint16) 0) -#define CSR_THREAD_PRIORITY_HIGH ((CsrUint16) 1) -#define CSR_THREAD_PRIORITY_NORMAL ((CsrUint16) 2) -#define CSR_THREAD_PRIORITY_LOW ((CsrUint16) 3) -#define CSR_THREAD_PRIORITY_LOWEST ((CsrUint16) 4) +#define CSR_THREAD_PRIORITY_HIGHEST ((u16) 0) +#define CSR_THREAD_PRIORITY_HIGH ((u16) 1) +#define CSR_THREAD_PRIORITY_NORMAL ((u16) 2) +#define CSR_THREAD_PRIORITY_LOW ((u16) 3) +#define CSR_THREAD_PRIORITY_LOWEST ((u16) 4) -#define CSR_EVENT_WAIT_INFINITE ((CsrUint16) 0xFFFF) +#define CSR_EVENT_WAIT_INFINITE ((u16) 0xFFFF) /*----------------------------------------------------------------------------* * NAME @@ -66,7 +66,7 @@ CsrResult CsrEventCreate(CsrEventHandle *eventHandle); * CSR_FE_RESULT_INVALID_POINTER in case the eventBits pointer is invalid * *----------------------------------------------------------------------------*/ -CsrResult CsrEventWait(CsrEventHandle *eventHandle, CsrUint16 timeoutInMs, CsrUint32 *eventBits); +CsrResult CsrEventWait(CsrEventHandle *eventHandle, u16 timeoutInMs, CsrUint32 *eventBits); /*----------------------------------------------------------------------------* * NAME @@ -195,7 +195,7 @@ void CsrGlobalMutexUnlock(void); * *----------------------------------------------------------------------------*/ CsrResult CsrThreadCreate(void (*threadFunction)(void *pointer), void *pointer, - CsrUint32 stackSize, CsrUint16 priority, + CsrUint32 stackSize, u16 priority, const CsrCharString *threadName, CsrThreadHandle *threadHandle); /*----------------------------------------------------------------------------* @@ -240,7 +240,7 @@ CsrResult CsrThreadEqual(CsrThreadHandle *threadHandle1, CsrThreadHandle *thread * void * *----------------------------------------------------------------------------*/ -void CsrThreadSleep(CsrUint16 sleepTimeInMs); +void CsrThreadSleep(u16 sleepTimeInMs); #ifndef CSR_PMEM_DEBUG_ENABLE /*----------------------------------------------------------------------------* diff --git a/drivers/staging/csr/csr_lib.h b/drivers/staging/csr/csr_lib.h index 041bd09..7259b63 100644 --- a/drivers/staging/csr/csr_lib.h +++ b/drivers/staging/csr/csr_lib.h @@ -30,7 +30,7 @@ typedef struct * Allocates and fills in a message with the signature CsrEvent * *----------------------------------------------------------------------------*/ -CsrEvent *CsrEvent_struct(CsrUint16 primtype, CsrUint16 msgtype); +CsrEvent *CsrEvent_struct(u16 primtype, u16 msgtype); typedef struct { @@ -46,12 +46,12 @@ typedef struct * Allocates and fills in a message with the signature CsrEventCsrUint8 * *----------------------------------------------------------------------------*/ -CsrEventCsrUint8 *CsrEventCsrUint8_struct(CsrUint16 primtype, CsrUint16 msgtype, u8 value); +CsrEventCsrUint8 *CsrEventCsrUint8_struct(u16 primtype, u16 msgtype, u8 value); typedef struct { CsrPrim type; - CsrUint16 value; + u16 value; } CsrEventCsrUint16; /*----------------------------------------------------------------------------* @@ -62,12 +62,12 @@ typedef struct * Allocates and fills in a message with the signature CsrEventCsrUint16 * *----------------------------------------------------------------------------*/ -CsrEventCsrUint16 *CsrEventCsrUint16_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint16 value); +CsrEventCsrUint16 *CsrEventCsrUint16_struct(u16 primtype, u16 msgtype, u16 value); typedef struct { CsrPrim type; - CsrUint16 value1; + u16 value1; u8 value2; } CsrEventCsrUint16CsrUint8; @@ -79,13 +79,13 @@ typedef struct * Allocates and fills in a message with the signature CsrEventCsrUint16CsrUint8 * *----------------------------------------------------------------------------*/ -CsrEventCsrUint16CsrUint8 *CsrEventCsrUint16CsrUint8_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint16 value1, u8 value2); +CsrEventCsrUint16CsrUint8 *CsrEventCsrUint16CsrUint8_struct(u16 primtype, u16 msgtype, u16 value1, u8 value2); typedef struct { CsrPrim type; - CsrUint16 value1; - CsrUint16 value2; + u16 value1; + u16 value2; } CsrEventCsrUint16CsrUint16; /*----------------------------------------------------------------------------* @@ -96,12 +96,12 @@ typedef struct * Allocates and fills in a message with the signature CsrEventCsrUint16CsrUint16 * *----------------------------------------------------------------------------*/ -CsrEventCsrUint16CsrUint16 *CsrEventCsrUint16CsrUint16_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint16 value1, CsrUint16 value2); +CsrEventCsrUint16CsrUint16 *CsrEventCsrUint16CsrUint16_struct(u16 primtype, u16 msgtype, u16 value1, u16 value2); typedef struct { CsrPrim type; - CsrUint16 value1; + u16 value1; CsrUint32 value2; } CsrEventCsrUint16CsrUint32; @@ -113,12 +113,12 @@ typedef struct * Allocates and fills in a message with the signature CsrEventCsrUint16 * *----------------------------------------------------------------------------*/ -CsrEventCsrUint16CsrUint32 *CsrEventCsrUint16CsrUint32_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint16 value1, CsrUint32 value2); +CsrEventCsrUint16CsrUint32 *CsrEventCsrUint16CsrUint32_struct(u16 primtype, u16 msgtype, u16 value1, CsrUint32 value2); typedef struct { CsrPrim type; - CsrUint16 value1; + u16 value1; CsrCharString *value2; } CsrEventCsrUint16CsrCharString; @@ -130,7 +130,7 @@ typedef struct * Allocates and fills in a message with the signature CsrEventCsrUint16CsrCharString * *----------------------------------------------------------------------------*/ -CsrEventCsrUint16CsrCharString *CsrEventCsrUint16CsrCharString_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint16 value1, CsrCharString *value2); +CsrEventCsrUint16CsrCharString *CsrEventCsrUint16CsrCharString_struct(u16 primtype, u16 msgtype, u16 value1, CsrCharString *value2); typedef struct { @@ -146,13 +146,13 @@ typedef struct * Allocates and fills in a message with the signature CsrEventCsrUint32 * *----------------------------------------------------------------------------*/ -CsrEventCsrUint32 *CsrEventCsrUint32_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint32 value); +CsrEventCsrUint32 *CsrEventCsrUint32_struct(u16 primtype, u16 msgtype, CsrUint32 value); typedef struct { CsrPrim type; CsrUint32 value1; - CsrUint16 value2; + u16 value2; } CsrEventCsrUint32CsrUint16; /*----------------------------------------------------------------------------* @@ -163,7 +163,7 @@ typedef struct * Allocates and fills in a message with the signature CsrEventCsrUint32CsrUint16 * *----------------------------------------------------------------------------*/ -CsrEventCsrUint32CsrUint16 *CsrEventCsrUint32CsrUint16_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint32 value1, CsrUint32 value2); +CsrEventCsrUint32CsrUint16 *CsrEventCsrUint32CsrUint16_struct(u16 primtype, u16 msgtype, CsrUint32 value1, CsrUint32 value2); typedef struct { @@ -180,7 +180,7 @@ typedef struct * Allocates and fills in a message with the signature CsrEventCsrUint32CsrCharString * *----------------------------------------------------------------------------*/ -CsrEventCsrUint32CsrCharString *CsrEventCsrUint32CsrCharString_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint32 value1, CsrCharString *value2); +CsrEventCsrUint32CsrCharString *CsrEventCsrUint32CsrCharString_struct(u16 primtype, u16 msgtype, CsrUint32 value1, CsrCharString *value2); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_log.h b/drivers/staging/csr/csr_log.h index f86c492..f6aaac1 100644 --- a/drivers/staging/csr/csr_log.h +++ b/drivers/staging/csr/csr_log.h @@ -96,7 +96,7 @@ CsrBool CsrLogTaskIsFiltered(CsrSchedQid taskId, CsrLogLevelTask level); typedef struct { - CsrUint16 primitiveType; + u16 primitiveType; const CsrCharString *primitiveName; CsrMsgConvMsgEntry *messageConv; /* Private - do not use */ } CsrLogPrimitiveInformation; @@ -112,7 +112,7 @@ typedef struct /* Tech logging */ /*---------------------------------*/ typedef u8 bitmask8_t; -typedef CsrUint16 bitmask16_t; +typedef u16 bitmask16_t; typedef CsrUint32 bitmask32_t; #ifdef CSR_LOG_ENABLE @@ -175,7 +175,7 @@ void CsrLogSchedStart(u8 thread_id); void CsrLogSchedStop(u8 thread_id); void CsrLogInitTask(u8 thread_id, CsrSchedQid tskid, const CsrCharString *tskName); -void CsrLogDeinitTask(CsrUint16 task_id); +void CsrLogDeinitTask(u16 task_id); void CsrLogActivate(CsrSchedQid tskid); void CsrLogDeactivate(CsrSchedQid tskid); @@ -188,14 +188,14 @@ void CsrLogMessagePut(CsrUint32 line, CsrSchedQid src_task_id, CsrSchedQid dst_taskid, CsrSchedMsgId msg_id, - CsrUint16 prim_type, + u16 prim_type, const void *msg); void CsrLogMessageGet(CsrSchedQid src_task_id, CsrSchedQid dst_taskid, CsrBool get_res, CsrSchedMsgId msg_id, - CsrUint16 prim_type, + u16 prim_type, const void *msg); void CsrLogTimedEventIn(CsrUint32 line, @@ -203,7 +203,7 @@ void CsrLogTimedEventIn(CsrUint32 line, CsrSchedQid task_id, CsrSchedTid tid, CsrTime requested_delay, - CsrUint16 fniarg, + u16 fniarg, const void *fnvarg); void CsrLogTimedEventFire(CsrSchedQid task_id, @@ -227,18 +227,18 @@ void CsrLogBgintSet(CsrSchedBgint irq); void CsrLogBgintServiceStart(CsrSchedBgint irq); void CsrLogBgintServiceDone(CsrSchedBgint irq); -void CsrLogExceptionStateEvent(CsrUint16 prim_type, +void CsrLogExceptionStateEvent(u16 prim_type, CsrPrim msg_type, - CsrUint16 state, + u16 state, CsrUint32 line, const CsrCharString *file); -void CsrLogExceptionGeneral(CsrUint16 prim_type, - CsrUint16 state, +void CsrLogExceptionGeneral(u16 prim_type, + u16 state, const CsrCharString *text, CsrUint32 line, const CsrCharString *file); -void CsrLogExceptionWarning(CsrUint16 prim_type, - CsrUint16 state, +void CsrLogExceptionWarning(u16 prim_type, + u16 state, const CsrCharString *text, CsrUint32 line, const CsrCharString *file); diff --git a/drivers/staging/csr/csr_log_configure.h b/drivers/staging/csr/csr_log_configure.h index 8c727ad..c47016b 100644 --- a/drivers/staging/csr/csr_log_configure.h +++ b/drivers/staging/csr/csr_log_configure.h @@ -57,7 +57,7 @@ typedef CsrUint32 CsrLogLevelText; #define CSR_LOG_LEVEL_TEXT_ALL ((CsrLogLevelText) 0xFFFF) /* The log text interface is used by both scheduler tasks and components outside the scheduler context. - * Therefore a CsrLogTextTaskId is introduced. It is effectively considered as two CsrUint16's. The lower + * Therefore a CsrLogTextTaskId is introduced. It is effectively considered as two u16's. The lower * 16 bits corresponds one2one with the scheduler queueId's (CsrSchedQid) and as such these bits can not be used * by components outside scheduler tasks. The upper 16 bits are allocated for use of components outside the * scheduler like drivers etc. Components in this range is defined independently by each technology. To avoid @@ -78,7 +78,7 @@ void CsrLogLevelTextSetTask(CsrLogTextTaskId taskId, CsrLogLevelText warningLeve /* Set the text logging level for a given tasks subOrigin */ /* This function can be used as a complement to CsrLogLevelTextSetAll() and CsrLogLevelTextSetTask() to add more _or_ less log from a given * subOrigin within a task than what is set generally with CsrLogLevelTextSetAll() _or_ CsrLogLevelTextSetTask(). */ -void CsrLogLevelTextSetTaskSubOrigin(CsrLogTextTaskId taskId, CsrUint16 subOrigin, CsrLogLevelText warningLevelMask); +void CsrLogLevelTextSetTaskSubOrigin(CsrLogTextTaskId taskId, u16 subOrigin, CsrLogLevelText warningLevelMask); /******************************************************************************* diff --git a/drivers/staging/csr/csr_log_text.h b/drivers/staging/csr/csr_log_text.h index 6e0df43..cb01655 100644 --- a/drivers/staging/csr/csr_log_text.h +++ b/drivers/staging/csr/csr_log_text.h @@ -19,13 +19,13 @@ extern "C" { typedef struct CsrLogSubOrigin { - CsrUint16 subOriginNumber; /* Id of the given SubOrigin */ + u16 subOriginNumber; /* Id of the given SubOrigin */ const CsrCharString *subOriginName; /* Prefix Text for this SubOrigin */ } CsrLogSubOrigin; /* Register a task which is going to use the CSR_LOG_TEXT_XXX interface */ #ifdef CSR_LOG_ENABLE -void CsrLogTextRegister(CsrLogTextTaskId taskId, const CsrCharString *taskName, CsrUint16 subOriginsLength, const CsrLogSubOrigin *subOrigins); +void CsrLogTextRegister(CsrLogTextTaskId taskId, const CsrCharString *taskName, u16 subOriginsLength, const CsrLogSubOrigin *subOrigins); #else #define CsrLogTextRegister(taskId, taskName, subOriginsLength, subOrigins) #endif @@ -33,8 +33,8 @@ void CsrLogTextRegister(CsrLogTextTaskId taskId, const CsrCharString *taskName, /* CRITICAL: Conditions that are threatening to the integrity/stability of the system as a whole. */ #if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_CRITICAL_DISABLE) -void CsrLogTextCritical(CsrLogTextTaskId taskId, CsrUint16 subOrigin, const CsrCharString *formatString, ...); -void CsrLogTextBufferCritical(CsrLogTextTaskId taskId, CsrUint16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...); +void CsrLogTextCritical(CsrLogTextTaskId taskId, u16 subOrigin, const CsrCharString *formatString, ...); +void CsrLogTextBufferCritical(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...); #define CSR_LOG_TEXT_CRITICAL(taskId_subOrigin_formatString_varargs) CsrLogTextCritical taskId_subOrigin_formatString_varargs #define CSR_LOG_TEXT_CONDITIONAL_CRITICAL(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_CRITICAL(logtextargs);}} #define CSR_LOG_TEXT_BUFFER_CRITICAL(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferCritical taskId_subOrigin_length_buffer_formatString_varargs @@ -49,8 +49,8 @@ void CsrLogTextBufferCritical(CsrLogTextTaskId taskId, CsrUint16 subOrigin, CsrS /* ERROR: Malfunction of a component rendering it unable to operate correctly, causing lack of functionality but not loss of system integrity/stability. */ #if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_ERROR_DISABLE) -void CsrLogTextError(CsrLogTextTaskId taskId, CsrUint16 subOrigin, const CsrCharString *formatString, ...); -void CsrLogTextBufferError(CsrLogTextTaskId taskId, CsrUint16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...); +void CsrLogTextError(CsrLogTextTaskId taskId, u16 subOrigin, const CsrCharString *formatString, ...); +void CsrLogTextBufferError(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...); #define CSR_LOG_TEXT_ERROR(taskId_subOrigin_formatString_varargs) CsrLogTextError taskId_subOrigin_formatString_varargs #define CSR_LOG_TEXT_CONDITIONAL_ERROR(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_ERROR(logtextargs);}} #define CSR_LOG_TEXT_BUFFER_ERROR(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferError taskId_subOrigin_length_buffer_formatString_varargs @@ -66,8 +66,8 @@ void CsrLogTextBufferError(CsrLogTextTaskId taskId, CsrUint16 subOrigin, CsrSize or violations of specifications, where the result of such deviations does not lead to malfunction of the component. */ #if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_WARNING_DISABLE) -void CsrLogTextWarning(CsrLogTextTaskId taskId, CsrUint16 subOrigin, const CsrCharString *formatString, ...); -void CsrLogTextBufferWarning(CsrLogTextTaskId taskId, CsrUint16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...); +void CsrLogTextWarning(CsrLogTextTaskId taskId, u16 subOrigin, const CsrCharString *formatString, ...); +void CsrLogTextBufferWarning(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...); #define CSR_LOG_TEXT_WARNING(taskId_subOrigin_formatString_varargs) CsrLogTextWarning taskId_subOrigin_formatString_varargs #define CSR_LOG_TEXT_CONDITIONAL_WARNING(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_WARNING(logtextargs);}} #define CSR_LOG_TEXT_BUFFER_WARNING(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferWarning taskId_subOrigin_length_buffer_formatString_varargs @@ -82,8 +82,8 @@ void CsrLogTextBufferWarning(CsrLogTextTaskId taskId, CsrUint16 subOrigin, CsrSi /* INFO: Important events that may aid in determining the conditions under which the more severe conditions are encountered. */ #if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_INFO_DISABLE) -void CsrLogTextInfo(CsrLogTextTaskId taskId, CsrUint16 subOrigin, const CsrCharString *formatString, ...); -void CsrLogTextBufferInfo(CsrLogTextTaskId taskId, CsrUint16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...); +void CsrLogTextInfo(CsrLogTextTaskId taskId, u16 subOrigin, const CsrCharString *formatString, ...); +void CsrLogTextBufferInfo(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...); #define CSR_LOG_TEXT_INFO(taskId_subOrigin_formatString_varargs) CsrLogTextInfo taskId_subOrigin_formatString_varargs #define CSR_LOG_TEXT_CONDITIONAL_INFO(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_INFO(logtextargs);}} #define CSR_LOG_TEXT_BUFFER_INFO(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferInfo taskId_subOrigin_length_buffer_formatString_varargs @@ -97,8 +97,8 @@ void CsrLogTextBufferInfo(CsrLogTextTaskId taskId, CsrUint16 subOrigin, CsrSize /* DEBUG: Similar to INFO, but dedicated to events that occur more frequently. */ #if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_DEBUG_DISABLE) -void CsrLogTextDebug(CsrLogTextTaskId taskId, CsrUint16 subOrigin, const CsrCharString *formatString, ...); -void CsrLogTextBufferDebug(CsrLogTextTaskId taskId, CsrUint16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...); +void CsrLogTextDebug(CsrLogTextTaskId taskId, u16 subOrigin, const CsrCharString *formatString, ...); +void CsrLogTextBufferDebug(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...); #define CSR_LOG_TEXT_DEBUG(taskId_subOrigin_formatString_varargs) CsrLogTextDebug taskId_subOrigin_formatString_varargs #define CSR_LOG_TEXT_CONDITIONAL_DEBUG(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_DEBUG(logtextargs);}} #define CSR_LOG_TEXT_BUFFER_DEBUG(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferDebug taskId_subOrigin_length_buffer_formatString_varargs diff --git a/drivers/staging/csr/csr_macro.h b/drivers/staging/csr/csr_macro.h index e8de0a7..7656e2a 100644 --- a/drivers/staging/csr/csr_macro.h +++ b/drivers/staging/csr/csr_macro.h @@ -31,7 +31,7 @@ extern "C" { /*------------------------------------------------------------------*/ /* Endian conversion */ /*------------------------------------------------------------------*/ -#define CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr) (((CsrUint16) ((u8 *) (ptr))[0]) | ((CsrUint16) ((u8 *) (ptr))[1]) << 8) +#define CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr) (((u16) ((u8 *) (ptr))[0]) | ((u16) ((u8 *) (ptr))[1]) << 8) #define CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr) (((CsrUint32) ((u8 *) (ptr))[0]) | ((CsrUint32) ((u8 *) (ptr))[1]) << 8 | \ ((CsrUint32) ((u8 *) (ptr))[2]) << 16 | ((CsrUint32) ((u8 *) (ptr))[3]) << 24) #define CSR_COPY_UINT16_TO_LITTLE_ENDIAN(uint, ptr) ((u8 *) (ptr))[0] = ((u8) ((uint) & 0x00FF)); \ @@ -40,7 +40,7 @@ extern "C" { ((u8 *) (ptr))[1] = ((u8) (((uint) >> 8) & 0x000000FF)); \ ((u8 *) (ptr))[2] = ((u8) (((uint) >> 16) & 0x000000FF)); \ ((u8 *) (ptr))[3] = ((u8) (((uint) >> 24) & 0x000000FF)) -#define CSR_GET_UINT16_FROM_BIG_ENDIAN(ptr) (((CsrUint16) ((u8 *) (ptr))[1]) | ((CsrUint16) ((u8 *) (ptr))[0]) << 8) +#define CSR_GET_UINT16_FROM_BIG_ENDIAN(ptr) (((u16) ((u8 *) (ptr))[1]) | ((u16) ((u8 *) (ptr))[0]) << 8) #define CSR_GET_UINT24_FROM_BIG_ENDIAN(ptr) (((CsrUint24) ((u8 *) (ptr))[2]) | \ ((CsrUint24) ((u8 *) (ptr))[1]) << 8 | ((CsrUint24) ((u8 *) (ptr))[0]) << 16) #define CSR_GET_UINT32_FROM_BIG_ENDIAN(ptr) (((CsrUint32) ((u8 *) (ptr))[3]) | ((CsrUint32) ((u8 *) (ptr))[2]) << 8 | \ @@ -66,8 +66,8 @@ extern "C" { (output) = ((u8) (input));(input) += 2 #define CSR_CONVERT_16_FROM_XAP(output, input) \ - (output) = (CsrUint16) ((((CsrUint16) (input)[1]) << 8) | \ - ((CsrUint16) (input)[0]));(input) += 2 + (output) = (u16) ((((u16) (input)[1]) << 8) | \ + ((u16) (input)[0]));(input) += 2 #define CSR_CONVERT_32_FROM_XAP(output, input) \ (output) = (((CsrUint32) (input)[1]) << 24) | \ diff --git a/drivers/staging/csr/csr_msgconv.c b/drivers/staging/csr/csr_msgconv.c index 3f57b04..b2aeb7a 100644 --- a/drivers/staging/csr/csr_msgconv.c +++ b/drivers/staging/csr/csr_msgconv.c @@ -18,7 +18,7 @@ static CsrMsgConvEntry *converter; -CsrMsgConvPrimEntry *CsrMsgConvFind(CsrUint16 primType) +CsrMsgConvPrimEntry *CsrMsgConvFind(u16 primType) { CsrMsgConvPrimEntry *ptr = NULL; @@ -41,7 +41,7 @@ CsrMsgConvPrimEntry *CsrMsgConvFind(CsrUint16 primType) return ptr; } -static const CsrMsgConvMsgEntry *find_msg_converter(CsrMsgConvPrimEntry *ptr, CsrUint16 msgType) +static const CsrMsgConvMsgEntry *find_msg_converter(CsrMsgConvPrimEntry *ptr, u16 msgType) { const CsrMsgConvMsgEntry *cv = ptr->conv; if (ptr->lookupFunc) @@ -71,7 +71,7 @@ static const CsrMsgConvMsgEntry *find_msg_converter(CsrMsgConvPrimEntry *ptr, Cs return cv; } -static void *deserialize_data(CsrUint16 primType, +static void *deserialize_data(u16 primType, CsrSize length, u8 *data) { @@ -83,7 +83,7 @@ static void *deserialize_data(CsrUint16 primType, if (ptr) { const CsrMsgConvMsgEntry *cv; - CsrUint16 msgId = 0; + u16 msgId = 0; CsrSize offset = 0; CsrUint16Des(&msgId, data, &offset); @@ -105,7 +105,7 @@ static void *deserialize_data(CsrUint16 primType, return ret; } -static CsrSize sizeof_message(CsrUint16 primType, void *msg) +static CsrSize sizeof_message(u16 primType, void *msg) { CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType); CsrSize ret; @@ -113,7 +113,7 @@ static CsrSize sizeof_message(CsrUint16 primType, void *msg) if (ptr) { const CsrMsgConvMsgEntry *cv; - CsrUint16 msgId = *(CsrUint16 *) msg; + u16 msgId = *(u16 *) msg; cv = find_msg_converter(ptr, msgId); if (cv) @@ -133,7 +133,7 @@ static CsrSize sizeof_message(CsrUint16 primType, void *msg) return ret; } -static CsrBool free_message(CsrUint16 primType, u8 *data) +static CsrBool free_message(u16 primType, u8 *data) { CsrMsgConvPrimEntry *ptr; CsrBool ret; @@ -143,7 +143,7 @@ static CsrBool free_message(CsrUint16 primType, u8 *data) if (ptr) { const CsrMsgConvMsgEntry *cv; - CsrUint16 msgId = *(CsrUint16 *) data; + u16 msgId = *(u16 *) data; cv = find_msg_converter(ptr, msgId); if (cv) @@ -164,7 +164,7 @@ static CsrBool free_message(CsrUint16 primType, u8 *data) return ret; } -static u8 *serialize_message(CsrUint16 primType, +static u8 *serialize_message(u16 primType, void *msg, CsrSize *length, u8 *buffer) @@ -180,7 +180,7 @@ static u8 *serialize_message(CsrUint16 primType, { const CsrMsgConvMsgEntry *cv; - cv = find_msg_converter(ptr, *(CsrUint16 *) msg); + cv = find_msg_converter(ptr, *(u16 *) msg); if (cv) { ret = cv->serFunc(buffer, length, msg); @@ -198,12 +198,12 @@ static u8 *serialize_message(CsrUint16 primType, return ret; } -CsrSize CsrMsgConvSizeof(CsrUint16 primType, void *msg) +CsrSize CsrMsgConvSizeof(u16 primType, void *msg) { return sizeof_message(primType, msg); } -u8 *CsrMsgConvSerialize(u8 *buffer, CsrSize maxBufferOffset, CsrSize *offset, CsrUint16 primType, void *msg) +u8 *CsrMsgConvSerialize(u8 *buffer, CsrSize maxBufferOffset, CsrSize *offset, u16 primType, void *msg) { if (converter) { @@ -221,7 +221,7 @@ u8 *CsrMsgConvSerialize(u8 *buffer, CsrSize maxBufferOffset, CsrSize *offset, Cs } /* Insert profile converter at head of converter list. */ -void CsrMsgConvInsert(CsrUint16 primType, const CsrMsgConvMsgEntry *ce) +void CsrMsgConvInsert(u16 primType, const CsrMsgConvMsgEntry *ce) { CsrMsgConvPrimEntry *pc; pc = CsrMsgConvFind(primType); @@ -242,7 +242,7 @@ void CsrMsgConvInsert(CsrUint16 primType, const CsrMsgConvMsgEntry *ce) } EXPORT_SYMBOL_GPL(CsrMsgConvInsert); -CsrMsgConvMsgEntry *CsrMsgConvFindEntry(CsrUint16 primType, CsrUint16 msgType) +CsrMsgConvMsgEntry *CsrMsgConvFindEntry(u16 primType, u16 msgType) { CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType); if (ptr) @@ -253,18 +253,18 @@ CsrMsgConvMsgEntry *CsrMsgConvFindEntry(CsrUint16 primType, CsrUint16 msgType) } EXPORT_SYMBOL_GPL(CsrMsgConvFindEntry); -CsrMsgConvMsgEntry *CsrMsgConvFindEntryByMsg(CsrUint16 primType, const void *msg) +CsrMsgConvMsgEntry *CsrMsgConvFindEntryByMsg(u16 primType, const void *msg) { CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType); if (ptr && msg) { - CsrUint16 msgType = *((CsrUint16 *) msg); + u16 msgType = *((u16 *) msg); return (CsrMsgConvMsgEntry *) find_msg_converter(ptr, msgType); } return NULL; } -void CsrMsgConvCustomLookupRegister(CsrUint16 primType, CsrMsgCustomLookupFunc *lookupFunc) +void CsrMsgConvCustomLookupRegister(u16 primType, CsrMsgCustomLookupFunc *lookupFunc) { CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType); if (ptr) diff --git a/drivers/staging/csr/csr_msgconv.h b/drivers/staging/csr/csr_msgconv.h index dd4853d..7438f95 100644 --- a/drivers/staging/csr/csr_msgconv.h +++ b/drivers/staging/csr/csr_msgconv.h @@ -28,7 +28,7 @@ typedef void *(CsrMsgDeserializeFunc)(u8 *buffer, CsrSize length); /* Converter entry for one message type */ typedef struct CsrMsgConvMsgEntry { - CsrUint16 msgType; + u16 msgType; CsrMsgSizeofFunc *sizeofFunc; CsrMsgSerializeFunc *serFunc; CsrMsgDeserializeFunc *deserFunc; @@ -36,12 +36,12 @@ typedef struct CsrMsgConvMsgEntry } CsrMsgConvMsgEntry; /* Optional lookup function */ -typedef CsrMsgConvMsgEntry *(CsrMsgCustomLookupFunc)(CsrMsgConvMsgEntry *ce, CsrUint16 msgType); +typedef CsrMsgConvMsgEntry *(CsrMsgCustomLookupFunc)(CsrMsgConvMsgEntry *ce, u16 msgType); /* All converter entries for one specific primitive */ typedef struct CsrMsgConvPrimEntry { - CsrUint16 primType; + u16 primType; const CsrMsgConvMsgEntry *conv; CsrMsgCustomLookupFunc *lookupFunc; struct CsrMsgConvPrimEntry *next; @@ -50,21 +50,21 @@ typedef struct CsrMsgConvPrimEntry typedef struct { CsrMsgConvPrimEntry *profile_converters; - void *(*deserialize_data)(CsrUint16 primType, CsrSize length, u8 * data); - CsrBool (*free_message)(CsrUint16 primType, u8 *data); - CsrSize (*sizeof_message)(CsrUint16 primType, void *msg); - u8 *(*serialize_message)(CsrUint16 primType, void *msg, + void *(*deserialize_data)(u16 primType, CsrSize length, u8 * data); + CsrBool (*free_message)(u16 primType, u8 *data); + CsrSize (*sizeof_message)(u16 primType, void *msg); + u8 *(*serialize_message)(u16 primType, void *msg, CsrSize * length, u8 * buffer); } CsrMsgConvEntry; -CsrSize CsrMsgConvSizeof(CsrUint16 primType, void *msg); -u8 *CsrMsgConvSerialize(u8 *buffer, CsrSize maxBufferOffset, CsrSize *offset, CsrUint16 primType, void *msg); -void CsrMsgConvCustomLookupRegister(CsrUint16 primType, CsrMsgCustomLookupFunc *lookupFunc); -void CsrMsgConvInsert(CsrUint16 primType, const CsrMsgConvMsgEntry *ce); -CsrMsgConvPrimEntry *CsrMsgConvFind(CsrUint16 primType); -CsrMsgConvMsgEntry *CsrMsgConvFindEntry(CsrUint16 primType, CsrUint16 msgType); -CsrMsgConvMsgEntry *CsrMsgConvFindEntryByMsg(CsrUint16 primType, const void *msg); +CsrSize CsrMsgConvSizeof(u16 primType, void *msg); +u8 *CsrMsgConvSerialize(u8 *buffer, CsrSize maxBufferOffset, CsrSize *offset, u16 primType, void *msg); +void CsrMsgConvCustomLookupRegister(u16 primType, CsrMsgCustomLookupFunc *lookupFunc); +void CsrMsgConvInsert(u16 primType, const CsrMsgConvMsgEntry *ce); +CsrMsgConvPrimEntry *CsrMsgConvFind(u16 primType); +CsrMsgConvMsgEntry *CsrMsgConvFindEntry(u16 primType, u16 msgType); +CsrMsgConvMsgEntry *CsrMsgConvFindEntryByMsg(u16 primType, const void *msg); CsrMsgConvEntry *CsrMsgConvGet(void); CsrMsgConvEntry *CsrMsgConvInit(void); #ifdef ENABLE_SHUTDOWN @@ -79,7 +79,7 @@ CsrUint32 CsrUtf16StringSerLen(const CsrUtf16String *str); /* Prototypes for primitive type serializers */ void CsrUint8Ser(u8 *buffer, CsrSize *offset, u8 value); -void CsrUint16Ser(u8 *buffer, CsrSize *offset, CsrUint16 value); +void CsrUint16Ser(u8 *buffer, CsrSize *offset, u16 value); void CsrUint32Ser(u8 *buffer, CsrSize *offset, CsrUint32 value); void CsrMemCpySer(u8 *buffer, CsrSize *offset, const void *value, CsrSize length); void CsrCharStringSer(u8 *buffer, CsrSize *offset, const CsrCharString *value); @@ -89,7 +89,7 @@ void CsrVoidPtrSer(u8 *buffer, CsrSize *offset, void *ptr); void CsrSizeSer(u8 *buffer, CsrSize *offset, CsrSize value); void CsrUint8Des(u8 *value, u8 *buffer, CsrSize *offset); -void CsrUint16Des(CsrUint16 *value, u8 *buffer, CsrSize *offset); +void CsrUint16Des(u16 *value, u8 *buffer, CsrSize *offset); void CsrUint32Des(CsrUint32 *value, u8 *buffer, CsrSize *offset); void CsrMemCpyDes(void *value, u8 *buffer, CsrSize *offset, CsrSize length); void CsrCharStringDes(CsrCharString **value, u8 *buffer, CsrSize *offset); diff --git a/drivers/staging/csr/csr_panic.c b/drivers/staging/csr/csr_panic.c index 87c72ad..0b78a72 100644 --- a/drivers/staging/csr/csr_panic.c +++ b/drivers/staging/csr/csr_panic.c @@ -15,7 +15,7 @@ #include "csr_types.h" #include "csr_panic.h" -void CsrPanic(u8 tech, CsrUint16 reason, const char *p) +void CsrPanic(u8 tech, u16 reason, const char *p) { BUG_ON(1); } diff --git a/drivers/staging/csr/csr_panic.h b/drivers/staging/csr/csr_panic.h index 2b71668..e993baf 100644 --- a/drivers/staging/csr/csr_panic.h +++ b/drivers/staging/csr/csr_panic.h @@ -46,7 +46,7 @@ extern "C" { /* Panic interface used by technologies */ /* DEPRECATED - replaced by csr_log_text.h */ -void CsrPanic(u8 tech, CsrUint16 reason, const char *p); +void CsrPanic(u8 tech, u16 reason, const char *p); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_prim_defs.h b/drivers/staging/csr/csr_prim_defs.h index 02ab913..7d47578 100644 --- a/drivers/staging/csr/csr_prim_defs.h +++ b/drivers/staging/csr/csr_prim_defs.h @@ -18,44 +18,44 @@ extern "C" { /************************************************************************************ * Segmentation of primitives in upstream and downstream segment ************************************************************************************/ -typedef CsrUint16 CsrPrim; +typedef u16 CsrPrim; #define CSR_PRIM_UPSTREAM ((CsrPrim) (0x8000)) /************************************************************************************ * Primitive definitions for Synergy framework ************************************************************************************/ -#define CSR_SYNERGY_EVENT_CLASS_BASE ((CsrUint16) (0x0600)) +#define CSR_SYNERGY_EVENT_CLASS_BASE ((u16) (0x0600)) -#define CSR_HCI_PRIM ((CsrUint16) (0x0000 | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_BCCMD_PRIM ((CsrUint16) (0x0001 | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_HQ_PRIM ((CsrUint16) (0x0002 | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_VM_PRIM ((CsrUint16) (0x0003 | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_TM_BLUECORE_PRIM ((CsrUint16) (0x0004 | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_FP_PRIM ((CsrUint16) (0x0005 | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_IP_SOCKET_PRIM ((CsrUint16) (0x0006 | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_IP_ETHER_PRIM ((CsrUint16) (0x0007 | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_IP_IFCONFIG_PRIM ((CsrUint16) (0x0008 | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_IP_INTERNAL_PRIM ((CsrUint16) (0x0009 | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_FSAL_PRIM ((CsrUint16) (0x000A | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_DATA_STORE_PRIM ((CsrUint16) (0x000B | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_AM_PRIM ((CsrUint16) (0x000C | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_TLS_PRIM ((CsrUint16) (0x000D | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_DHCP_SERVER_PRIM ((CsrUint16) (0x000E | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_TFTP_PRIM ((CsrUint16) (0x000F | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_DSPM_PRIM ((CsrUint16) (0x0010 | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_TLS_INTERNAL_PRIM ((CsrUint16) (0x0011 | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_HCI_PRIM ((u16) (0x0000 | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_BCCMD_PRIM ((u16) (0x0001 | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_HQ_PRIM ((u16) (0x0002 | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_VM_PRIM ((u16) (0x0003 | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_TM_BLUECORE_PRIM ((u16) (0x0004 | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_FP_PRIM ((u16) (0x0005 | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_IP_SOCKET_PRIM ((u16) (0x0006 | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_IP_ETHER_PRIM ((u16) (0x0007 | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_IP_IFCONFIG_PRIM ((u16) (0x0008 | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_IP_INTERNAL_PRIM ((u16) (0x0009 | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_FSAL_PRIM ((u16) (0x000A | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_DATA_STORE_PRIM ((u16) (0x000B | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_AM_PRIM ((u16) (0x000C | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_TLS_PRIM ((u16) (0x000D | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_DHCP_SERVER_PRIM ((u16) (0x000E | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_TFTP_PRIM ((u16) (0x000F | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_DSPM_PRIM ((u16) (0x0010 | CSR_SYNERGY_EVENT_CLASS_BASE)) +#define CSR_TLS_INTERNAL_PRIM ((u16) (0x0011 | CSR_SYNERGY_EVENT_CLASS_BASE)) #define NUMBER_OF_CSR_FW_EVENTS (CSR_DSPM_PRIM - CSR_SYNERGY_EVENT_CLASS_BASE + 1) -#define CSR_SYNERGY_EVENT_CLASS_MISC_BASE ((CsrUint16) (0x06A0)) +#define CSR_SYNERGY_EVENT_CLASS_MISC_BASE ((u16) (0x06A0)) -#define CSR_UI_PRIM ((CsrUint16) (0x0000 | CSR_SYNERGY_EVENT_CLASS_MISC_BASE)) -#define CSR_APP_PRIM ((CsrUint16) (0x0001 | CSR_SYNERGY_EVENT_CLASS_MISC_BASE)) -#define CSR_SDIO_PROBE_PRIM ((CsrUint16) (0x0002 | CSR_SYNERGY_EVENT_CLASS_MISC_BASE)) +#define CSR_UI_PRIM ((u16) (0x0000 | CSR_SYNERGY_EVENT_CLASS_MISC_BASE)) +#define CSR_APP_PRIM ((u16) (0x0001 | CSR_SYNERGY_EVENT_CLASS_MISC_BASE)) +#define CSR_SDIO_PROBE_PRIM ((u16) (0x0002 | CSR_SYNERGY_EVENT_CLASS_MISC_BASE)) #define NUMBER_OF_CSR_FW_MISC_EVENTS (CSR_SDIO_PROBE_PRIM - CSR_SYNERGY_EVENT_CLASS_MISC_BASE + 1) -#define CSR_ENV_PRIM ((CsrUint16) (0x00FF | CSR_SYNERGY_EVENT_CLASS_MISC_BASE)) +#define CSR_ENV_PRIM ((u16) (0x00FF | CSR_SYNERGY_EVENT_CLASS_MISC_BASE)) #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_result.h b/drivers/staging/csr/csr_result.h index 249b499..68fb759 100644 --- a/drivers/staging/csr/csr_result.h +++ b/drivers/staging/csr/csr_result.h @@ -16,7 +16,7 @@ extern "C" { #endif -typedef CsrUint16 CsrResult; +typedef u16 CsrResult; #define CSR_RESULT_SUCCESS ((CsrResult) 0x0000) #define CSR_RESULT_FAILURE ((CsrResult) 0xFFFF) diff --git a/drivers/staging/csr/csr_sched.h b/drivers/staging/csr/csr_sched.h index 2f982bb..944b7c1 100644 --- a/drivers/staging/csr/csr_sched.h +++ b/drivers/staging/csr/csr_sched.h @@ -20,10 +20,10 @@ extern "C" { typedef CsrUint32 CsrSchedIdentifier; /* A task identifier */ -typedef CsrUint16 CsrSchedTaskId; +typedef u16 CsrSchedTaskId; /* A queue identifier */ -typedef CsrUint16 CsrSchedQid; +typedef u16 CsrSchedQid; #define CSR_SCHED_QID_INVALID ((CsrSchedQid) 0xFFFF) /* A message identifier */ @@ -50,7 +50,7 @@ typedef void (*schedEntryFunction_t)(void **inst); /* * Background interrupt definitions */ -typedef CsrUint16 CsrSchedBgint; +typedef u16 CsrSchedBgint; #define CSR_SCHED_BGINT_INVALID ((CsrSchedBgint) 0xFFFF) typedef void (*CsrSchedBgintHandler)(void *); @@ -133,14 +133,14 @@ void CsrSchedBgintSet(CsrSchedBgint bgint); *----------------------------------------------------------------------------*/ #if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER) void CsrSchedMessagePutStringLog(CsrSchedQid q, - CsrUint16 mi, + u16 mi, void *mv, CsrUint32 line, const CsrCharString *file); #define CsrSchedMessagePut(q, mi, mv) CsrSchedMessagePutStringLog((q), (mi), (mv), __LINE__, __FILE__) #else void CsrSchedMessagePut(CsrSchedQid q, - CsrUint16 mi, + u16 mi, void *mv); #endif @@ -164,14 +164,14 @@ void CsrSchedMessagePut(CsrSchedQid q, * *----------------------------------------------------------------------------*/ #if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER) -void CsrSchedMessageBroadcastStringLog(CsrUint16 mi, +void CsrSchedMessageBroadcastStringLog(u16 mi, void *(*msg_build_func)(void *), void *msg_build_ptr, CsrUint32 line, const CsrCharString *file); #define CsrSchedMessageBroadcast(mi, fn, ptr) CsrSchedMessageBroadcastStringLog((mi), (fn), (ptr), __LINE__, __FILE__) #else -void CsrSchedMessageBroadcast(CsrUint16 mi, +void CsrSchedMessageBroadcast(u16 mi, void *(*msg_build_func)(void *), void *msg_build_ptr); #endif @@ -182,7 +182,7 @@ void CsrSchedMessageBroadcast(CsrUint16 mi, * * DESCRIPTION * Obtains a message from the message queue belonging to the calling task. - * The message consists of one or both of a CsrUint16 and a void *. + * The message consists of one or both of a u16 and a void *. * * RETURNS * CsrBool - TRUE if a message has been obtained from the queue, else FALSE. @@ -193,7 +193,7 @@ void CsrSchedMessageBroadcast(CsrUint16 mi, * them message is discarded. * *----------------------------------------------------------------------------*/ -CsrBool CsrSchedMessageGet(CsrUint16 *pmi, void **pmv); +CsrBool CsrSchedMessageGet(u16 *pmi, void **pmv); /*----------------------------------------------------------------------------* * NAME @@ -219,16 +219,16 @@ CsrBool CsrSchedMessageGet(CsrUint16 *pmi, void **pmv); *----------------------------------------------------------------------------*/ #if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER) CsrSchedTid CsrSchedTimerSetStringLog(CsrTime delay, - void (*fn)(CsrUint16 mi, void *mv), - CsrUint16 fniarg, + void (*fn)(u16 mi, void *mv), + u16 fniarg, void *fnvarg, CsrUint32 line, const CsrCharString *file); #define CsrSchedTimerSet(d, fn, fni, fnv) CsrSchedTimerSetStringLog((d), (fn), (fni), (fnv), __LINE__, __FILE__) #else CsrSchedTid CsrSchedTimerSet(CsrTime delay, - void (*fn)(CsrUint16 mi, void *mv), - CsrUint16 fniarg, + void (*fn)(u16 mi, void *mv), + u16 fniarg, void *fnvarg); #endif @@ -246,14 +246,14 @@ CsrSchedTid CsrSchedTimerSet(CsrTime delay, *----------------------------------------------------------------------------*/ #if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER) CsrBool CsrSchedTimerCancelStringLog(CsrSchedTid eventid, - CsrUint16 *pmi, + u16 *pmi, void **pmv, CsrUint32 line, const CsrCharString *file); #define CsrSchedTimerCancel(e, pmi, pmv) CsrSchedTimerCancelStringLog((e), (pmi), (pmv), __LINE__, __FILE__) #else CsrBool CsrSchedTimerCancel(CsrSchedTid eventid, - CsrUint16 *pmi, + u16 *pmi, void **pmv); #endif diff --git a/drivers/staging/csr/csr_sdio.h b/drivers/staging/csr/csr_sdio.h index 2ce4f16..0b24f55 100644 --- a/drivers/staging/csr/csr_sdio.h +++ b/drivers/staging/csr/csr_sdio.h @@ -52,8 +52,8 @@ extern "C" { *----------------------------------------------------------------------------*/ typedef struct { - CsrUint16 manfId; /* Vendor ID to match or CSR_SDIO_ANY_MANF_ID */ - CsrUint16 cardId; /* Device ID to match or CSR_SDIO_ANY_CARD_ID */ + u16 manfId; /* Vendor ID to match or CSR_SDIO_ANY_MANF_ID */ + u16 cardId; /* Device ID to match or CSR_SDIO_ANY_CARD_ID */ u8 sdioFunction; /* SDIO Function number to match or CSR_SDIO_ANY_SDIO_FUNCTION */ u8 sdioInterface; /* SDIO Standard Interface Code to match or CSR_SDIO_ANY_SDIO_INTERFACE */ } CsrSdioFunctionId; @@ -84,7 +84,7 @@ typedef struct typedef struct { CsrSdioFunctionId sdioId; - CsrUint16 blockSize; /* Actual configured block size, or 0 if unconfigured */ + u16 blockSize; /* Actual configured block size, or 0 if unconfigured */ CsrUint32 features; /* Bit mask with any of CSR_SDIO_FEATURE_* set */ void *device; /* Handle of device containing the function */ void *driverData; /* For use by the Function Driver */ @@ -434,7 +434,7 @@ void CsrSdioResumeAcknowledge(CsrSdioFunction *function, CsrResult result); * (after the second operation) is in the valid range. * *----------------------------------------------------------------------------*/ -CsrResult CsrSdioBlockSizeSet(CsrSdioFunction *function, CsrUint16 blockSize); +CsrResult CsrSdioBlockSizeSet(CsrSdioFunction *function, u16 blockSize); /*----------------------------------------------------------------------------* * NAME @@ -563,10 +563,10 @@ void CsrSdioWrite8Async(CsrSdioFunction *function, CsrUint32 address, u8 data, C * the callback function. * *----------------------------------------------------------------------------*/ -CsrResult CsrSdioRead16(CsrSdioFunction *function, CsrUint32 address, CsrUint16 *data); -CsrResult CsrSdioWrite16(CsrSdioFunction *function, CsrUint32 address, CsrUint16 data); -void CsrSdioRead16Async(CsrSdioFunction *function, CsrUint32 address, CsrUint16 *data, CsrSdioAsyncCallback callback); -void CsrSdioWrite16Async(CsrSdioFunction *function, CsrUint32 address, CsrUint16 data, CsrSdioAsyncCallback callback); +CsrResult CsrSdioRead16(CsrSdioFunction *function, CsrUint32 address, u16 *data); +CsrResult CsrSdioWrite16(CsrSdioFunction *function, CsrUint32 address, u16 data); +void CsrSdioRead16Async(CsrSdioFunction *function, CsrUint32 address, u16 *data, CsrSdioAsyncCallback callback); +void CsrSdioWrite16Async(CsrSdioFunction *function, CsrUint32 address, u16 data, CsrSdioAsyncCallback callback); /*----------------------------------------------------------------------------* * NAME diff --git a/drivers/staging/csr/csr_serialize_primitive_types.c b/drivers/staging/csr/csr_serialize_primitive_types.c index 41bd4be..3b20b7d 100644 --- a/drivers/staging/csr/csr_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_serialize_primitive_types.c @@ -23,7 +23,7 @@ void CsrUint8Des(u8 *value, u8 *buffer, CsrSize *offset) } EXPORT_SYMBOL_GPL(CsrUint8Des); -void CsrUint16Des(CsrUint16 *value, u8 *buffer, CsrSize *offset) +void CsrUint16Des(u16 *value, u8 *buffer, CsrSize *offset) { *value = (buffer[*offset + 0] << 0) | (buffer[*offset + 1] << 8); @@ -95,7 +95,7 @@ void CsrUint8Ser(u8 *buffer, CsrSize *offset, u8 value) } EXPORT_SYMBOL_GPL(CsrUint8Ser); -void CsrUint16Ser(u8 *buffer, CsrSize *offset, CsrUint16 value) +void CsrUint16Ser(u8 *buffer, CsrSize *offset, u16 value) { buffer[*offset + 0] = (u8) ((value >> 0) & 0xFF); buffer[*offset + 1] = (u8) ((value >> 8) & 0xFF); @@ -150,7 +150,7 @@ void CsrUtf16StringSer(u8 *buffer, CsrSize *offset, const CsrUtf16String *value) for (i = 0; i < length; i++) { - CsrUint16Ser(buffer, offset, (CsrUint16) value[i]); + CsrUint16Ser(buffer, offset, (u16) value[i]); } } else diff --git a/drivers/staging/csr/csr_time.h b/drivers/staging/csr/csr_time.h index 0ede47e..0329427 100644 --- a/drivers/staging/csr/csr_time.h +++ b/drivers/staging/csr/csr_time.h @@ -43,7 +43,7 @@ typedef CsrUint32 CsrTime; typedef struct { CsrUint32 sec; - CsrUint16 msec; + u16 msec; } CsrTimeUtc; diff --git a/drivers/staging/csr/csr_types.h b/drivers/staging/csr/csr_types.h index e295060..0e5abe5 100644 --- a/drivers/staging/csr/csr_types.h +++ b/drivers/staging/csr/csr_types.h @@ -33,7 +33,6 @@ typedef uintptr_t CsrUintptr; /* Unsigned integer large enough to hold any poi typedef ptrdiff_t CsrIntptr; /* intptr_t is not defined in kernel. Use the equivalent ptrdiff_t. */ /* Unsigned fixed width types */ -typedef uint16_t CsrUint16; typedef uint32_t CsrUint32; /* Signed fixed width types */ @@ -46,7 +45,7 @@ typedef u8 CsrBool; /* String types */ typedef char CsrCharString; typedef u8 CsrUtf8String; -typedef CsrUint16 CsrUtf16String; /* 16-bit UTF16 strings */ +typedef u16 CsrUtf16String; /* 16-bit UTF16 strings */ typedef CsrUint32 CsrUint24; /* diff --git a/drivers/staging/csr/csr_unicode.h b/drivers/staging/csr/csr_unicode.h index 3d86de4..64519c0 100644 --- a/drivers/staging/csr/csr_unicode.h +++ b/drivers/staging/csr/csr_unicode.h @@ -28,8 +28,8 @@ CsrUtf16String *CsrUtf82Utf16String(const CsrUtf8String *utf8String); CsrUtf16String *CsrUtf16StrCpy(CsrUtf16String *target, const CsrUtf16String *source); CsrUtf16String *CsrUtf16StringDuplicate(const CsrUtf16String *source); -CsrUint16 CsrUtf16StrICmp(const CsrUtf16String *string1, const CsrUtf16String *string2); -CsrUint16 CsrUtf16StrNICmp(const CsrUtf16String *string1, const CsrUtf16String *string2, CsrUint32 count); +u16 CsrUtf16StrICmp(const CsrUtf16String *string1, const CsrUtf16String *string2); +u16 CsrUtf16StrNICmp(const CsrUtf16String *string1, const CsrUtf16String *string2, CsrUint32 count); CsrUtf16String *CsrUtf16MemCpy(CsrUtf16String *dest, const CsrUtf16String *src, CsrUint32 count); CsrUtf16String *CsrUtf16ConcatenateTexts(const CsrUtf16String *inputText1, const CsrUtf16String *inputText2, diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index 6f709da..7e724da7 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -75,7 +75,7 @@ static const CsrUint32 offsetsFromUtf8[4] = *********************************************************************************/ CsrUtf16String *CsrUint32ToUtf16String(CsrUint32 number) { - CsrUint16 count, noOfDigits; + u16 count, noOfDigits; CsrUtf16String *output; CsrUint32 tempNumber; @@ -115,10 +115,10 @@ CsrUtf16String *CsrUint32ToUtf16String(CsrUint32 number) *********************************************************************************/ CsrUint32 CsrUtf16StringToUint32(const CsrUtf16String *unicodeString) { - CsrUint16 numLen, count; + u16 numLen, count; CsrUint32 newNumber = 0; - numLen = (CsrUint16) CsrUtf16StrLen(unicodeString); + numLen = (u16) CsrUtf16StrLen(unicodeString); if ((numLen > 10) || (numLen == 0) || (unicodeString == NULL)) /*CSRMAX number is 4.294.967.295 */ { @@ -673,15 +673,15 @@ CsrUtf16String *CsrUtf82Utf16String(const CsrUtf8String *utf8String) ch -= offsetsFromUtf8[extraBytes2Read]; - if (ch <= 0xFFFF) /* Character can be encoded in one CsrUint16 */ + if (ch <= 0xFFFF) /* Character can be encoded in one u16 */ { - *dest++ = (CsrUint16) ch; + *dest++ = (u16) ch; } - else /* The character needs two CsrUint16 */ + else /* The character needs two u16 */ { ch -= UNI_HALF_BASE; - *dest++ = (CsrUint16) ((ch >> UNI_HALF_SHIFT) | UNI_SUR_HIGH_START); - *dest++ = (CsrUint16) ((ch & 0x03FF) | UNI_SUR_LOW_START); + *dest++ = (u16) ((ch >> UNI_HALF_SHIFT) | UNI_SUR_HIGH_START); + *dest++ = (u16) ((ch & 0x03FF) | UNI_SUR_LOW_START); } } } @@ -753,7 +753,7 @@ CsrUtf16String *CsrUtf16StringDuplicate(const CsrUtf16String *source) * Output: 0: if the strings are identical. * *********************************************************************************/ -CsrUint16 CsrUtf16StrICmp(const CsrUtf16String *string1, const CsrUtf16String *string2) +u16 CsrUtf16StrICmp(const CsrUtf16String *string1, const CsrUtf16String *string2) { while (*string1 || *string2) { @@ -781,7 +781,7 @@ CsrUint16 CsrUtf16StrICmp(const CsrUtf16String *string1, const CsrUtf16String *s * Output: 0: if the strings are identical. * *********************************************************************************/ -CsrUint16 CsrUtf16StrNICmp(const CsrUtf16String *string1, const CsrUtf16String *string2, CsrUint32 count) +u16 CsrUtf16StrNICmp(const CsrUtf16String *string1, const CsrUtf16String *string2, CsrUint32 count) { while ((*string1 || *string2) && count--) { diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index 83721fe..32c114b 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -55,7 +55,7 @@ u8 CsrBitCountDense(CsrUint32 n) /*------------------------------------------------------------------*/ CsrBool CsrHexStrToUint8(const CsrCharString *string, u8 *returnValue) { - CsrUint16 currentIndex = 0; + u16 currentIndex = 0; *returnValue = 0; if ((string[currentIndex] == '0') && (CSR_TOUPPER(string[currentIndex + 1]) == 'X')) { @@ -77,9 +77,9 @@ CsrBool CsrHexStrToUint8(const CsrCharString *string, u8 *returnValue) return FALSE; } -CsrBool CsrHexStrToUint16(const CsrCharString *string, CsrUint16 *returnValue) +CsrBool CsrHexStrToUint16(const CsrCharString *string, u16 *returnValue) { - CsrUint16 currentIndex = 0; + u16 currentIndex = 0; *returnValue = 0; if ((string[currentIndex] == '0') && (CSR_TOUPPER(string[currentIndex + 1]) == 'X')) { @@ -89,7 +89,7 @@ CsrBool CsrHexStrToUint16(const CsrCharString *string, CsrUint16 *returnValue) { while (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) || ((CSR_TOUPPER(string[currentIndex]) >= 'A') && (CSR_TOUPPER(string[currentIndex]) <= 'F'))) { - *returnValue = (CsrUint16) (*returnValue * 16 + (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) ? string[currentIndex] - '0' : CSR_TOUPPER(string[currentIndex]) - 'A' + 10)); + *returnValue = (u16) (*returnValue * 16 + (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) ? string[currentIndex] - '0' : CSR_TOUPPER(string[currentIndex]) - 'A' + 10)); currentIndex++; if (currentIndex >= 4) { @@ -103,7 +103,7 @@ CsrBool CsrHexStrToUint16(const CsrCharString *string, CsrUint16 *returnValue) CsrBool CsrHexStrToUint32(const CsrCharString *string, CsrUint32 *returnValue) { - CsrUint16 currentIndex = 0; + u16 currentIndex = 0; *returnValue = 0; if ((string[currentIndex] == '0') && (CSR_TOUPPER(string[currentIndex + 1]) == 'X')) { @@ -190,14 +190,14 @@ void CsrIntToBase10(CsrInt32 number, CsrCharString *str) CsrStrCpy(str, res); } -void CsrUInt16ToHex(CsrUint16 number, CsrCharString *str) +void CsrUInt16ToHex(u16 number, CsrCharString *str) { - CsrUint16 index; - CsrUint16 currentValue; + u16 index; + u16 currentValue; for (index = 0; index < 4; index++) { - currentValue = (CsrUint16) (number & 0x000F); + currentValue = (u16) (number & 0x000F); number >>= 4; str[3 - index] = (char) (currentValue > 9 ? currentValue + 55 : currentValue + '0'); } @@ -206,7 +206,7 @@ void CsrUInt16ToHex(CsrUint16 number, CsrCharString *str) void CsrUInt32ToHex(CsrUint32 number, CsrCharString *str) { - CsrUint16 index; + u16 index; CsrUint32 currentValue; for (index = 0; index < 8; index++) @@ -334,7 +334,7 @@ CsrUint32 CsrStrToInt(const CsrCharString *str) digit = 1; /* Start from the string end */ - for (i = (CsrUint16) (CsrStrLen(str) - 1); i >= 0; i--) + for (i = (u16) (CsrStrLen(str) - 1); i >= 0; i--) { /* Only convert numbers */ if ((str[i] >= '0') && (str[i] <= '9')) diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index e48dcbb..610d35e 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -27,11 +27,11 @@ u8 CsrBitCountDense(CsrUint32 n); /* Base conversion */ /*------------------------------------------------------------------*/ CsrBool CsrHexStrToUint8(const CsrCharString *string, u8 *returnValue); -CsrBool CsrHexStrToUint16(const CsrCharString *string, CsrUint16 *returnValue); +CsrBool CsrHexStrToUint16(const CsrCharString *string, u16 *returnValue); CsrBool CsrHexStrToUint32(const CsrCharString *string, CsrUint32 *returnValue); CsrUint32 CsrPow(CsrUint32 base, CsrUint32 exponent); void CsrIntToBase10(CsrInt32 number, CsrCharString *str); -void CsrUInt16ToHex(CsrUint16 number, CsrCharString *str); +void CsrUInt16ToHex(u16 number, CsrCharString *str); void CsrUInt32ToHex(CsrUint32 number, CsrCharString *str); /*------------------------------------------------------------------*/ diff --git a/drivers/staging/csr/csr_wifi_fsm.h b/drivers/staging/csr/csr_wifi_fsm.h index cfdf082..2128034 100644 --- a/drivers/staging/csr/csr_wifi_fsm.h +++ b/drivers/staging/csr/csr_wifi_fsm.h @@ -66,7 +66,7 @@ typedef void (*CsrWifiFsmExternalWakupCallbackPtr)(void *context); * @return * CsrWifiFsmContext* fsm context */ -extern CsrWifiFsmContext* CsrWifiFsmInit(void *applicationContext, void *externalContext, CsrUint16 maxProcesses, CsrLogTextTaskId loggingTaskId); +extern CsrWifiFsmContext* CsrWifiFsmInit(void *applicationContext, void *externalContext, u16 maxProcesses, CsrLogTextTaskId loggingTaskId); /** * @brief @@ -143,7 +143,7 @@ extern CsrUint32 CsrWifiFsmExecute(CsrWifiFsmContext *context); * @return * void */ -extern void CsrWifiFsmSendEventExternal(CsrWifiFsmContext *context, CsrWifiFsmEvent *event, CsrUint16 source, CsrUint16 destination, CsrPrim primtype, CsrUint16 id); +extern void CsrWifiFsmSendEventExternal(CsrWifiFsmContext *context, CsrWifiFsmEvent *event, u16 source, u16 destination, CsrPrim primtype, u16 id); /** * @brief @@ -202,7 +202,7 @@ extern CsrUint32 CsrWifiFsmGetNextTimeout(CsrWifiFsmContext *context); * @return * void */ -extern void CsrWifiFsmFastForward(CsrWifiFsmContext *context, CsrUint16 ms); +extern void CsrWifiFsmFastForward(CsrWifiFsmContext *context, u16 ms); /** * @brief diff --git a/drivers/staging/csr/csr_wifi_fsm_event.h b/drivers/staging/csr/csr_wifi_fsm_event.h index ef07d8a..47ca245 100644 --- a/drivers/staging/csr/csr_wifi_fsm_event.h +++ b/drivers/staging/csr/csr_wifi_fsm_event.h @@ -30,7 +30,7 @@ extern "C" { typedef struct CsrWifiFsmEvent { CsrPrim type; - CsrUint16 primtype; + u16 primtype; CsrSchedQid destination; CsrSchedQid source; diff --git a/drivers/staging/csr/csr_wifi_fsm_types.h b/drivers/staging/csr/csr_wifi_fsm_types.h index 99e60e8..5bc6987 100644 --- a/drivers/staging/csr/csr_wifi_fsm_types.h +++ b/drivers/staging/csr/csr_wifi_fsm_types.h @@ -54,9 +54,9 @@ typedef struct CsrWifiFsmEventList typedef struct CsrWifiFsmTimerId { CsrPrim type; - CsrUint16 primtype; + u16 primtype; CsrSchedQid destination; - CsrUint16 uniqueid; + u16 uniqueid; } CsrWifiFsmTimerId; /** @@ -71,7 +71,7 @@ typedef struct CsrWifiFsmTimerId typedef struct CsrWifiFsmTimer { CsrPrim type; - CsrUint16 primtype; + u16 primtype; CsrSchedQid destination; CsrSchedQid source; @@ -109,7 +109,7 @@ typedef struct CsrWifiFsmTimerList { CsrWifiFsmTimer *first; CsrWifiFsmTimer *last; - CsrUint16 nexttimerid; + u16 nexttimerid; } CsrWifiFsmTimerList; /** @@ -171,9 +171,9 @@ typedef void (*CsrWifiFsmProcResetFnPtr)(CsrWifiFsmContext *context); * @param[in] context : External context * * @return - * CsrUint16 a valid destination OR CSR_WIFI_FSM_ENV + * u16 a valid destination OR CSR_WIFI_FSM_ENV */ -typedef CsrUint16 (*CsrWifiFsmDestLookupCallbackPtr)(void *context, const CsrWifiFsmEvent *event); +typedef u16 (*CsrWifiFsmDestLookupCallbackPtr)(void *context, const CsrWifiFsmEvent *event); #ifdef CSR_WIFI_FSM_DUMP_ENABLE @@ -223,7 +223,7 @@ typedef struct const CsrBool saveAll; const CsrWifiFsmEventEntry *eventEntryArray; /* array of transition function pointers for state */ #ifdef CSR_LOG_ENABLE - CsrUint16 stateNumber; + u16 stateNumber; const CsrCharString *stateName; #endif } CsrWifiFsmTableEntry; @@ -237,7 +237,7 @@ typedef struct */ typedef struct { - CsrUint16 numStates; /* number of states */ + u16 numStates; /* number of states */ const CsrWifiFsmTableEntry *aStateEventMatrix; /* state event matrix */ } CsrWifiFsmTransitionFunctionTable; @@ -271,12 +271,12 @@ typedef struct */ typedef struct { - CsrUint16 transitionNumber; + u16 transitionNumber; CsrWifiFsmEvent event; - CsrUint16 fromState; - CsrUint16 toState; + u16 fromState; + u16 toState; CsrWifiFsmTransitionFnPtr transitionFn; - CsrUint16 transitionCount; /* number consecutive of times this transition was seen */ + u16 transitionCount; /* number consecutive of times this transition was seen */ #ifdef CSR_LOG_ENABLE const CsrCharString *transitionName; #endif @@ -288,7 +288,7 @@ typedef struct */ typedef struct { - CsrUint16 numTransitions; + u16 numTransitions; CsrWifiFsmTransitionRecord records[CSR_WIFI_FSM_MAX_TRANSITION_HISTORY]; } CsrWifiFsmTransitionRecords; #endif @@ -304,8 +304,8 @@ typedef struct typedef struct { const CsrWifiFsmProcessStateMachine *fsmInfo; /* state machine info that is constant regardless of context */ - CsrUint16 instanceId; /* Runtime process id */ - CsrUint16 state; /* Current state */ + u16 instanceId; /* Runtime process id */ + u16 state; /* Current state */ void *params; /* Instance user data */ CsrWifiFsmEventList savedEventQueue; /* The saved event queue */ struct CsrWifiFsmInstanceEntry *subFsm; /* Sub Fsm instance data */ @@ -358,7 +358,7 @@ typedef void (*CsrWifiFsmOnTransitionFnPtr)(void *extContext, const CsrWifiFsmEv * @return * void */ -typedef void (*CsrWifiFsmOnStateChangeFnPtr)(void *extContext, CsrUint16 nextstate); +typedef void (*CsrWifiFsmOnStateChangeFnPtr)(void *extContext, u16 nextstate); /** * @brief @@ -394,8 +394,8 @@ struct CsrWifiFsmContext CsrBool useTempSaveList; /* Should the temp save list be used */ CsrWifiFsmEventList tempSaveList; /* The temp save event queue */ CsrWifiFsmEvent *eventForwardedOrSaved; /* The event that was forwarded or Saved */ - CsrUint16 maxProcesses; /* Size of instanceArray */ - CsrUint16 numProcesses; /* Current number allocated in instanceArray */ + u16 maxProcesses; /* Size of instanceArray */ + u16 numProcesses; /* Current number allocated in instanceArray */ CsrWifiFsmInstanceEntry *instanceArray; /* Array of processes for this component */ CsrWifiFsmInstanceEntry *ownerInstance; /* The Process that owns currentInstance (SubFsm support) */ CsrWifiFsmInstanceEntry *currentInstance; /* Current Process that is executing */ @@ -429,7 +429,7 @@ struct CsrWifiFsmContext CsrWifiFsmOnEventFnPtr onInvalidCallback; /* Invalid event Callback */ #endif #ifdef CSR_WIFI_FSM_DUMP_ENABLE - CsrUint16 masterTransitionNumber; /* Increments on every transition */ + u16 masterTransitionNumber; /* Increments on every transition */ #endif }; diff --git a/drivers/staging/csr/csr_wifi_hip_card.h b/drivers/staging/csr/csr_wifi_hip_card.h index fcaf27d..dfee536 100644 --- a/drivers/staging/csr/csr_wifi_hip_card.h +++ b/drivers/staging/csr/csr_wifi_hip_card.h @@ -68,7 +68,7 @@ CsrResult CardIntEnabled(card_t *card, CsrBool *enabled); /***************************************************************************** * CardGetDataSlotSize */ -CsrUint16 CardGetDataSlotSize(card_t *card); +u16 CardGetDataSlotSize(card_t *card); /***************************************************************************** * CardWriteBulkData - @@ -93,9 +93,9 @@ void CardClearFromHostDataSlotWithoutFreeingBulkData(card_t *card, const CsrInt1 /***************************************************************************** * CardGetFreeFromHostDataSlots - */ -CsrUint16 CardGetFreeFromHostDataSlots(card_t *card); +u16 CardGetFreeFromHostDataSlots(card_t *card); -CsrUint16 CardAreAllFromHostDataSlotsEmpty(card_t *card); +u16 CardAreAllFromHostDataSlotsEmpty(card_t *card); CsrResult card_start_processor(card_t *card, enum unifi_dbg_processors_select which); @@ -112,7 +112,7 @@ CsrResult ConvertCsrSdioToCsrHipResult(card_t *card, CsrResult csrResult); #ifdef CSR_WIFI_HIP_DEBUG_OFFLINE void unifi_debug_log_to_buf(const CsrCharString *fmt, ...); void unifi_debug_string_to_buf(const CsrCharString *str); -void unifi_debug_hex_to_buf(const CsrCharString *buff, CsrUint16 length); +void unifi_debug_hex_to_buf(const CsrCharString *buff, u16 length); #endif diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.c b/drivers/staging/csr/csr_wifi_hip_card_sdio.c index ef9c566..7e75e60 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.c @@ -599,8 +599,8 @@ static void _build_sdio_config_data(sdio_config_data_t *cfg_data, static CsrResult card_hw_init(card_t *card) { CsrUint32 slut_address; - CsrUint16 initialised; - CsrUint16 finger_print; + u16 initialised; + u16 finger_print; symbol_t slut; sdio_config_data_t *cfg_data; u8 cfg_data_buf[SDIO_CONFIG_DATA_SIZE]; @@ -691,7 +691,7 @@ static CsrResult card_hw_init(card_t *card) */ while (!search_4slut_again) { - CsrUint16 s; + u16 s; CsrUint32 l; r = unifi_card_read16(card, slut_address, &s); @@ -785,7 +785,7 @@ static CsrResult card_hw_init(card_t *card) func_exit_r(CSR_WIFI_HIP_RESULT_INVALID_VALUE); return CSR_WIFI_HIP_RESULT_INVALID_VALUE; } - cfg_data->tohost_signal_padding = (CsrUint16) (card->sdio_io_block_size / cfg_data->sig_frag_size); + cfg_data->tohost_signal_padding = (u16) (card->sdio_io_block_size / cfg_data->sig_frag_size); unifi_info(card->ospriv, "SDIO block size %d requires %d padding chunks\n", card->sdio_io_block_size, cfg_data->tohost_signal_padding); r = unifi_card_write16(card, slut.obj + SDIO_TO_HOST_SIG_PADDING_OFFSET, cfg_data->tohost_signal_padding); @@ -1051,7 +1051,7 @@ static CsrResult card_wait_for_unifi_to_reset(card_t *card) } if (r == CSR_RESULT_SUCCESS) { - CsrUint16 mbox2; + u16 mbox2; CsrInt16 enabled = io_enable & (1 << card->function); if (!enabled) @@ -1236,7 +1236,7 @@ static CsrResult card_wait_for_unifi_to_disable(card_t *card) CsrResult card_wait_for_firmware_to_start(card_t *card, CsrUint32 *paddr) { CsrInt32 i; - CsrUint16 mbox0, mbox1; + u16 mbox0, mbox1; CsrResult r; func_enter(); @@ -1402,7 +1402,7 @@ CsrResult unifi_capture_panic(card_t *card) */ static CsrResult card_access_panic(card_t *card) { - CsrUint16 data_u16 = 0; + u16 data_u16 = 0; CsrInt32 i; CsrResult r, sr; @@ -1535,7 +1535,7 @@ static CsrResult card_access_panic(card_t *card) void unifi_read_panic(card_t *card) { CsrResult r; - CsrUint16 p_code, p_arg; + u16 p_code, p_arg; func_enter(); @@ -2045,7 +2045,7 @@ static CsrResult card_init_slots(card_t *card) /* Get initial signal counts from UniFi, in case it has not been reset. */ { - CsrUint16 s; + u16 s; /* Get the from-host-signals-written count */ r = unifi_card_read16(card, card->sdio_ctrl_addr + 0, &s); @@ -2219,11 +2219,11 @@ static void CardReassignDynamicReservation(card_t *card) */ static void CardCheckDynamicReservation(card_t *card, unifi_TrafficQueue queue) { - CsrUint16 q_len, active_queues = 0, excess_queue_slots, div_extra_slots, + u16 q_len, active_queues = 0, excess_queue_slots, div_extra_slots, queue_fair_share, reserved_slots = 0, q, excess_need_queues = 0, unmovable_slots = 0; CsrInt32 i; q_t *sigq; - CsrUint16 num_data_slots = card->config_data.num_fromhost_data_slots - UNIFI_RESERVED_COMMAND_SLOTS; + u16 num_data_slots = card->config_data.num_fromhost_data_slots - UNIFI_RESERVED_COMMAND_SLOTS; func_enter(); @@ -2453,7 +2453,7 @@ void CardClearFromHostDataSlotWithoutFreeingBulkData(card_t *card, const CsrInt1 #endif -CsrUint16 CardGetDataSlotSize(card_t *card) +u16 CardGetDataSlotSize(card_t *card) { return card->config_data.data_slot_size; } /* CardGetDataSlotSize() */ @@ -2472,9 +2472,9 @@ CsrUint16 CardGetDataSlotSize(card_t *card) * Number of free from-host bulk data slots. * --------------------------------------------------------------------------- */ -CsrUint16 CardGetFreeFromHostDataSlots(card_t *card) +u16 CardGetFreeFromHostDataSlots(card_t *card) { - CsrUint16 i, n = 0; + u16 i, n = 0; func_enter(); @@ -2507,9 +2507,9 @@ CsrUint16 CardGetFreeFromHostDataSlots(card_t *card) * 0 Some or all the from-host bulk data slots are in use. * --------------------------------------------------------------------------- */ -CsrUint16 CardAreAllFromHostDataSlotsEmpty(card_t *card) +u16 CardAreAllFromHostDataSlotsEmpty(card_t *card) { - CsrUint16 i; + u16 i; for (i = 0; i < card->config_data.num_fromhost_data_slots; i++) { @@ -2642,7 +2642,7 @@ static CsrResult unifi_read_chip_version(card_t *card) { CsrUint32 gbl_chip_version; CsrResult r; - CsrUint16 ver; + u16 ver; func_enter(); @@ -2700,7 +2700,7 @@ static CsrResult unifi_read_chip_version(card_t *card) static CsrResult unifi_reset_hardware(card_t *card) { CsrResult r; - CsrUint16 new_block_size = UNIFI_IO_BLOCK_SIZE; + u16 new_block_size = UNIFI_IO_BLOCK_SIZE; CsrResult csrResult; func_enter(); @@ -3402,7 +3402,7 @@ CsrResult CardIntEnabled(card_t *card, CsrBool *enabled) */ CsrResult CardWriteBulkData(card_t *card, card_signal_t *csptr, unifi_TrafficQueue queue) { - CsrUint16 i, slots[UNIFI_MAX_DATA_REFERENCES], j = 0; + u16 i, slots[UNIFI_MAX_DATA_REFERENCES], j = 0; u8 *packed_sigptr, num_slots_required = 0; bulk_data_desc_t *bulkdata = csptr->bulkdata; CsrInt16 h, nslots; @@ -3512,7 +3512,7 @@ CsrResult CardWriteBulkData(card_t *card, card_signal_t *csptr, unifi_TrafficQue * Fill in the slot number in the SIGNAL structure but * preserve the offset already in there */ - SET_PACKED_DATAREF_SLOT(packed_sigptr, i, slots[j] | (((CsrUint16)packed_sigptr[SIZEOF_SIGNAL_HEADER + (i * SIZEOF_DATAREF) + 1]) << 8)); + SET_PACKED_DATAREF_SLOT(packed_sigptr, i, slots[j] | (((u16)packed_sigptr[SIZEOF_SIGNAL_HEADER + (i * SIZEOF_DATAREF) + 1]) << 8)); SET_PACKED_DATAREF_LEN(packed_sigptr, i, bulkdata[i].data_length); /* Do not copy the data, just store the information to them */ @@ -3607,7 +3607,7 @@ bulk_data_desc_t* card_find_data_slot(card_t *card, CsrInt16 slot) static CsrResult firmware_present_in_flash(card_t *card) { CsrResult r; - CsrUint16 m1, m5; + u16 m1, m5; if (ChipHelper_HasRom(card->helper)) { @@ -4107,7 +4107,7 @@ void unifi_get_hip_qos_info(card_t *card, unifi_HipQosInfo *hipqosinfo) CsrUint32 occupied_fh; q_t *sigq; - CsrUint16 nslots, i; + u16 nslots, i; CsrMemSet(hipqosinfo, 0, sizeof(unifi_HipQosInfo)); @@ -4142,7 +4142,7 @@ void unifi_get_hip_qos_info(card_t *card, unifi_HipQosInfo *hipqosinfo) occupied_fh = (card->from_host_signals_w - count_fhr) % 128; - hipqosinfo->free_fh_fw_slots = (CsrUint16)(card->config_data.num_fromhost_sig_frags - occupied_fh); + hipqosinfo->free_fh_fw_slots = (u16)(card->config_data.num_fromhost_sig_frags - occupied_fh); } diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.h b/drivers/staging/csr/csr_wifi_hip_card_sdio.h index 2615169..8c81856 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.h +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.h @@ -115,25 +115,25 @@ typedef struct * indicate incompatible changes. The LSB gives the minor revision number, * used to indicate changes that maintain backwards compatibility. */ - CsrUint16 version; + u16 version; /* * offset from the start of the shared data memory to the SD IO * control structure. */ - CsrUint16 sdio_ctrl_offset; + u16 sdio_ctrl_offset; /* Buffer handle of the from-host signal queue */ - CsrUint16 fromhost_sigbuf_handle; + u16 fromhost_sigbuf_handle; /* Buffer handle of the to-host signal queue */ - CsrUint16 tohost_sigbuf_handle; + u16 tohost_sigbuf_handle; /* * Maximum number of signal primitive or bulk data command fragments that may be * pending in the to-hw signal queue. */ - CsrUint16 num_fromhost_sig_frags; + u16 num_fromhost_sig_frags; /* * Number of signal primitive or bulk data command fragments that must be pending @@ -145,42 +145,42 @@ typedef struct * Note that the hw may place more signals in the to-host signal queue * than indicated by this field. */ - CsrUint16 num_tohost_sig_frags; + u16 num_tohost_sig_frags; /* * Number of to-hw bulk data slots. Slots are numbered from 0 (zero) to * one less than the value in this field */ - CsrUint16 num_fromhost_data_slots; + u16 num_fromhost_data_slots; /* * Number of frm-hw bulk data slots. Slots are numbered from 0 (zero) to * one less than the value in this field */ - CsrUint16 num_tohost_data_slots; + u16 num_tohost_data_slots; /* * Size of the bulk data slots (2 octets) * The size of the bulk data slots in octets. This will usually be * the size of the largest MSDU. The value should always be even. */ - CsrUint16 data_slot_size; + u16 data_slot_size; /* * Indicates that the host has finished the initialisation sequence. * Initialised to 0x0000 by the firmware, and set to 0x0001 by us. */ - CsrUint16 initialised; + u16 initialised; /* Added by protocol version 0x0001 */ CsrUint32 overlay_size; /* Added by protocol version 0x0300 */ - CsrUint16 data_slot_round; - CsrUint16 sig_frag_size; + u16 data_slot_round; + u16 sig_frag_size; /* Added by protocol version 0x0500 */ - CsrUint16 tohost_signal_padding; + u16 tohost_signal_padding; } sdio_config_data_t; /* @@ -200,10 +200,10 @@ typedef struct /* Structure for a bulk data transfer command */ typedef struct { - CsrUint16 cmd_and_len; /* bits 12-15 cmd, bits 0-11 len */ - CsrUint16 data_slot; /* slot number, perhaps OR'd with SLOT_DIR_TO_HOST */ - CsrUint16 offset; - CsrUint16 buffer_handle; + u16 cmd_and_len; /* bits 12-15 cmd, bits 0-11 len */ + u16 data_slot; /* slot number, perhaps OR'd with SLOT_DIR_TO_HOST */ + u16 offset; + u16 buffer_handle; } bulk_data_cmd_t; @@ -249,7 +249,7 @@ typedef struct card_signal u8 sigbuf[UNIFI_PACKED_SIGBUF_SIZE]; /* Length of the SIGNAL inside sigbuf */ - CsrUint16 signal_length; + u16 signal_length; bulk_data_desc_t bulkdata[UNIFI_MAX_DATA_REFERENCES]; } card_signal_t; @@ -264,10 +264,10 @@ typedef struct card_signal_t *q_body; /* Num elements in queue (capacity is one less than this!) */ - CsrUint16 q_length; + u16 q_length; - CsrUint16 q_wr_ptr; - CsrUint16 q_rd_ptr; + u16 q_wr_ptr; + u16 q_rd_ptr; CsrCharString name[UNIFI_QUEUE_NAME_MAX_LENGTH]; } q_t; @@ -283,9 +283,9 @@ typedef struct */ typedef struct { - CsrUint16 from_host_used_slots[UNIFI_NO_OF_TX_QS]; - CsrUint16 from_host_max_slots[UNIFI_NO_OF_TX_QS]; - CsrUint16 from_host_reserved_slots[UNIFI_NO_OF_TX_QS]; + u16 from_host_used_slots[UNIFI_NO_OF_TX_QS]; + u16 from_host_max_slots[UNIFI_NO_OF_TX_QS]; + u16 from_host_reserved_slots[UNIFI_NO_OF_TX_QS]; /* Parameters to determine if a queue was active. If number of packets sent is greater than the threshold @@ -293,11 +293,11 @@ typedef struct re reservation is done, it is important not to keep this value too low */ /* Packets sent during this interval */ - CsrUint16 packets_txed[UNIFI_NO_OF_TX_QS]; - CsrUint16 total_packets_txed; + u16 packets_txed[UNIFI_NO_OF_TX_QS]; + u16 total_packets_txed; /* Number of packets to see if slots need to be reassigned */ - CsrUint16 packets_interval; + u16 packets_interval; /* Once a queue reaches a stable state, avoid processing */ CsrBool queue_stable[UNIFI_NO_OF_TX_QS]; @@ -311,7 +311,7 @@ typedef struct * params: * const q_t *q * returns: - * CsrUint16 + * u16 */ #define CSR_WIFI_HIP_Q_SLOTS_USED(q) \ (((q)->q_wr_ptr - (q)->q_rd_ptr < 0)? \ @@ -321,7 +321,7 @@ typedef struct * params: * const q_t *q * returns: - * CsrUint16 + * u16 */ #define CSR_WIFI_HIP_Q_SLOTS_FREE(q) \ ((q)->q_length - CSR_WIFI_HIP_Q_SLOTS_USED((q)) - 1) @@ -329,7 +329,7 @@ typedef struct /* Return slot signal data pointer * params: * const q_t *q - * CsrUint16 slot + * u16 slot * returns: * card_signal_t * */ @@ -340,7 +340,7 @@ typedef struct * params: * const q_t *q * returns: - * CsrUint16 slot offset + * u16 slot offset */ #define CSR_WIFI_HIP_Q_NEXT_R_SLOT(q) \ ((q)->q_rd_ptr) @@ -349,7 +349,7 @@ typedef struct * params: * const q_t *q * returns: - * CsrUint16 slot offset + * u16 slot offset */ #define CSR_WIFI_HIP_Q_NEXT_W_SLOT(q) \ ((q)->q_wr_ptr) @@ -357,9 +357,9 @@ typedef struct /* Return updated queue pointer wrapped around its length * params: * const q_t *q - * CsrUint16 x amount to add to queue pointer + * u16 x amount to add to queue pointer * returns: - * CsrUint16 wrapped queue pointer + * u16 wrapped queue pointer */ #define CSR_WIFI_HIP_Q_WRAP(q, x) \ ((((x) >= (q)->q_length)?((x) % (q)->q_length) : (x))) @@ -415,10 +415,10 @@ struct card CsrCharString build_id_string[128]; /* Retrieve from SDIO driver. */ - CsrUint16 chip_id; + u16 chip_id; /* Read from GBL_CHIP_VERSION. */ - CsrUint16 chip_version; + u16 chip_version; /* From the SDIO driver (probably 1) */ u8 function; @@ -443,7 +443,7 @@ struct card #define card_tx_q_unpause(card, q) (card->tx_q_paused_flag[q] = 0) #define card_tx_q_pause(card, q) (card->tx_q_paused_flag[q] = 1) - CsrUint16 tx_q_paused_flag[UNIFI_TRAFFIC_Q_MAX + 1 + UNIFI_NO_OF_TX_QS]; /* defensive more than big enough */ + u16 tx_q_paused_flag[UNIFI_TRAFFIC_Q_MAX + 1 + UNIFI_NO_OF_TX_QS]; /* defensive more than big enough */ /* UDI callback for logging UniFi interactions */ udi_func_t udi_hook; @@ -507,8 +507,8 @@ struct card { u8 *buf; /* buffer area */ u8 *ptr; /* current pos */ - CsrUint16 count; /* signal count */ - CsrUint16 bufsize; + u16 count; /* signal count */ + u16 bufsize; } fh_buffer; struct sigbuf th_buffer; @@ -563,7 +563,7 @@ struct card u8 memory_resources_allocated; /* UniFi SDIO I/O Block size. */ - CsrUint16 sdio_io_block_size; + u16 sdio_io_block_size; /* Pad transfer sizes to SDIO block boundaries */ CsrBool sdio_io_block_pad; @@ -621,14 +621,14 @@ struct card /* Historic firmware panic codes */ CsrUint32 panic_data_phy_addr; CsrUint32 panic_data_mac_addr; - CsrUint16 last_phy_panic_code; - CsrUint16 last_phy_panic_arg; - CsrUint16 last_mac_panic_code; - CsrUint16 last_mac_panic_arg; + u16 last_phy_panic_code; + u16 last_phy_panic_arg; + u16 last_mac_panic_code; + u16 last_mac_panic_arg; #ifdef CSR_PRE_ALLOC_NET_DATA bulk_data_desc_t bulk_data_desc_list[BULK_DATA_PRE_ALLOC_NUM]; - CsrUint16 prealloc_netdata_r; - CsrUint16 prealloc_netdata_w; + u16 prealloc_netdata_r; + u16 prealloc_netdata_w; #endif }; /* struct card */ @@ -659,10 +659,10 @@ bulk_data_desc_t* card_find_data_slot(card_t *card, CsrInt16 slot); CsrResult unifi_read32(card_t *card, CsrUint32 unifi_addr, CsrUint32 *pdata); CsrResult unifi_readnz(card_t *card, CsrUint32 unifi_addr, - void *pdata, CsrUint16 len); + void *pdata, u16 len); CsrInt32 unifi_read_shared_count(card_t *card, CsrUint32 addr); -CsrResult unifi_writen(card_t *card, CsrUint32 unifi_addr, void *pdata, CsrUint16 len); +CsrResult unifi_writen(card_t *card, CsrUint32 unifi_addr, void *pdata, u16 len); CsrResult unifi_bulk_rw(card_t *card, CsrUint32 handle, void *pdata, CsrUint32 len, CsrInt16 direction); @@ -676,12 +676,12 @@ CsrResult unifi_write_8_or_16(card_t *card, CsrUint32 unifi_addr, u8 data); CsrResult unifi_read_direct_8_or_16(card_t *card, CsrUint32 addr, u8 *pdata); CsrResult unifi_write_direct_8_or_16(card_t *card, CsrUint32 addr, u8 data); -CsrResult unifi_read_direct16(card_t *card, CsrUint32 addr, CsrUint16 *pdata); +CsrResult unifi_read_direct16(card_t *card, CsrUint32 addr, u16 *pdata); CsrResult unifi_read_direct32(card_t *card, CsrUint32 addr, CsrUint32 *pdata); -CsrResult unifi_read_directn(card_t *card, CsrUint32 addr, void *pdata, CsrUint16 len); +CsrResult unifi_read_directn(card_t *card, CsrUint32 addr, void *pdata, u16 len); -CsrResult unifi_write_direct16(card_t *card, CsrUint32 addr, CsrUint16 data); -CsrResult unifi_write_directn(card_t *card, CsrUint32 addr, void *pdata, CsrUint16 len); +CsrResult unifi_write_direct16(card_t *card, CsrUint32 addr, u16 data); +CsrResult unifi_write_directn(card_t *card, CsrUint32 addr, void *pdata, u16 len); CsrResult sdio_read_f0(card_t *card, CsrUint32 addr, u8 *pdata); CsrResult sdio_write_f0(card_t *card, CsrUint32 addr, u8 data); @@ -692,8 +692,8 @@ void prealloc_netdata_free(card_t *card); CsrResult prealloc_netdata_alloc(card_t *card); #endif /* For diagnostic use */ -void dump(void *mem, CsrUint16 len); -void dump16(void *mem, CsrUint16 len); +void dump(void *mem, u16 len); +void dump16(void *mem, u16 len); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c index 52a6ed3..2d3b3ea 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c @@ -47,14 +47,14 @@ static CsrResult handle_host_protocol(card_t *card, CsrBool *processed_something static CsrResult flush_fh_buffer(card_t *card); -static CsrResult check_fh_sig_slots(card_t *card, CsrUint16 needed, CsrInt32 *space); +static CsrResult check_fh_sig_slots(card_t *card, u16 needed, CsrInt32 *space); static CsrResult read_to_host_signals(card_t *card, CsrInt32 *processed); static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed); static CsrResult process_bulk_data_command(card_t *card, const u8 *cmdptr, - CsrInt16 cmd, CsrUint16 len); + CsrInt16 cmd, u16 len); static CsrResult process_clear_slot_command(card_t *card, const u8 *cmdptr); static CsrResult process_fh_cmd_queue(card_t *card, CsrInt32 *processed); @@ -143,14 +143,14 @@ void unifi_debug_log_to_buf(const CsrCharString *fmt, ...) * * --------------------------------------------------------------------------- */ -void unifi_debug_hex_to_buf(const CsrCharString *buff, CsrUint16 length) +void unifi_debug_hex_to_buf(const CsrCharString *buff, u16 length) { CsrCharString s[5]; - CsrUint16 i; + u16 i; for (i = 0; i < length; i = i + 2) { - CsrUInt16ToHex(*((CsrUint16 *)(buff + i)), s); + CsrUInt16ToHex(*((u16 *)(buff + i)), s); unifi_debug_string_to_buf(s); } } @@ -361,7 +361,7 @@ CsrResult unifi_bh(card_t *card, CsrUint32 *remaining) CsrBool pending; CsrInt32 iostate, j; const enum unifi_low_power_mode low_power_mode = card->low_power_mode; - CsrUint16 data_slots_used = 0; + u16 data_slots_used = 0; /* Process request to raise the maximum SDIO clock */ @@ -1029,7 +1029,7 @@ static CsrResult read_to_host_signals(card_t *card, CsrInt32 *processed) } card->th_buffer.ptr += unread_bytes; - card->th_buffer.count += (CsrUint16)unread_chunks; + card->th_buffer.count += (u16)unread_chunks; *processed = 1; @@ -1150,10 +1150,10 @@ static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed) u8 *bufptr; bulk_data_param_t data_ptrs; CsrInt16 cmd; - CsrUint16 sig_len; + u16 sig_len; CsrInt16 i; - CsrUint16 chunks_in_buf; - CsrUint16 bytes_transferred = 0; + u16 chunks_in_buf; + u16 bytes_transferred = 0; CsrResult r = CSR_RESULT_SUCCESS; *processed = 0; @@ -1205,14 +1205,14 @@ static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed) */ if (cmd == SDIO_CMD_SIGNAL) { - chunks_in_buf = GET_CHUNKS_FOR(card->config_data.sig_frag_size, (CsrUint16)(sig_len + 2)); + chunks_in_buf = GET_CHUNKS_FOR(card->config_data.sig_frag_size, (u16)(sig_len + 2)); } else { chunks_in_buf = 1; } - if (chunks_in_buf > (CsrUint16)pending) + if (chunks_in_buf > (u16)pending) { unifi_error(card->ospriv, "incomplete signal (0x%x?): need %d chunks, got %d\n", GET_SIGNAL_ID(bufptr + 2), @@ -1235,7 +1235,7 @@ static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed) for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { /* Retrieve dataRefs[i].DataLength */ - CsrUint16 data_len = GET_PACKED_DATAREF_LEN(bufptr + 2, i); + u16 data_len = GET_PACKED_DATAREF_LEN(bufptr + 2, i); /* * The bulk data length in the signal can not be greater than @@ -1316,7 +1316,7 @@ static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed) { /* Get host tag and transmission status */ CsrUint32 host_tag = GET_PACKED_MA_PACKET_CONFIRM_HOST_TAG(bufptr + 2); - CsrUint16 status = GET_PACKED_MA_PACKET_CONFIRM_TRANSMISSION_STATUS(bufptr + 2); + u16 status = GET_PACKED_MA_PACKET_CONFIRM_TRANSMISSION_STATUS(bufptr + 2); unifi_trace(card->ospriv, UDBG4, "process_to_host_signals signal ID=%x host Tag=%x status=%x\n", GET_SIGNAL_ID(bufptr + 2), host_tag, status); @@ -1327,7 +1327,7 @@ static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed) if (status && (card->fh_slot_host_tag_record)) { - CsrUint16 num_fh_slots = card->config_data.num_fromhost_data_slots; + u16 num_fh_slots = card->config_data.num_fromhost_data_slots; /* search through the list of slot records and match with host tag * If a slot is not yet cleared then clear the slot from here @@ -1545,7 +1545,7 @@ static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed) */ static CsrResult process_clear_slot_command(card_t *card, const u8 *cmdptr) { - CsrUint16 data_slot; + u16 data_slot; CsrInt16 slot; data_slot = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cmdptr + SIZEOF_UINT16); @@ -1619,7 +1619,7 @@ static CsrResult process_clear_slot_command(card_t *card, const u8 *cmdptr) * --------------------------------------------------------------------------- */ static CsrResult process_bulk_data_command(card_t *card, const u8 *cmdptr, - CsrInt16 cmd, CsrUint16 len) + CsrInt16 cmd, u16 len) { bulk_data_desc_t *bdslot; #ifdef CSR_WIFI_ALIGNMENT_WORKAROUND @@ -1839,7 +1839,7 @@ static CsrResult process_bulk_data_command(card_t *card, const u8 *cmdptr, * CSR_RESULT_SUCCESS, otherwise CSR error code on error. * --------------------------------------------------------------------------- */ -static CsrResult check_fh_sig_slots(card_t *card, CsrUint16 needed, CsrInt32 *space_fh) +static CsrResult check_fh_sig_slots(card_t *card, u16 needed, CsrInt32 *space_fh) { CsrUint32 count_fhw; CsrUint32 occupied_fh, slots_fh; @@ -1885,8 +1885,8 @@ static CsrResult check_fh_sig_slots(card_t *card, CsrUint16 needed, CsrInt32 *sp */ #define ROUND_UP_NEEDED_CHUNKS(_card, _needed_chunks) \ { \ - CsrUint16 _chunks_per_block; \ - CsrUint16 _chunks_in_last_block; \ + u16 _chunks_per_block; \ + u16 _chunks_in_last_block; \ \ if (_card->sdio_io_block_pad) \ { \ @@ -1902,7 +1902,7 @@ static CsrResult check_fh_sig_slots(card_t *card, CsrUint16 needed, CsrInt32 *sp #define ROUND_UP_SPACE_CHUNKS(_card, _space_chunks) \ { \ - CsrUint16 _chunks_per_block; \ + u16 _chunks_per_block; \ \ if (_card->sdio_io_block_pad) \ { \ @@ -1945,11 +1945,11 @@ static CsrResult process_fh_cmd_queue(card_t *card, CsrInt32 *processed) q_t *sigq = &card->fh_command_queue; CsrResult r; - CsrUint16 pending_sigs; - CsrUint16 pending_chunks; - CsrUint16 needed_chunks; + u16 pending_sigs; + u16 pending_chunks; + u16 needed_chunks; CsrInt32 space_chunks; - CsrUint16 q_index; + u16 q_index; *processed = 0; @@ -1973,7 +1973,7 @@ static CsrResult process_fh_cmd_queue(card_t *card, CsrInt32 *processed) * Note that GET_CHUNKS_FOR() needs the size of the packed * (wire-formatted) structure */ - pending_chunks += GET_CHUNKS_FOR(card->config_data.sig_frag_size, (CsrUint16)(csptr->signal_length + 2)); + pending_chunks += GET_CHUNKS_FOR(card->config_data.sig_frag_size, (u16)(csptr->signal_length + 2)); } /* @@ -2003,7 +2003,7 @@ static CsrResult process_fh_cmd_queue(card_t *card, CsrInt32 *processed) * Coalesce as many from-host signals as possible * into a single block and write using a single CMD53 */ - if (needed_chunks > (CsrUint16)space_chunks) + if (needed_chunks > (u16)space_chunks) { /* Round up to the block size if necessary */ ROUND_UP_SPACE_CHUNKS(card, space_chunks); @@ -2012,7 +2012,7 @@ static CsrResult process_fh_cmd_queue(card_t *card, CsrInt32 *processed) * If the f/w has less free chunks than those already pending * return immediately. */ - if ((CsrUint16)space_chunks <= card->fh_buffer.count) + if ((u16)space_chunks <= card->fh_buffer.count) { /* * No room in UniFi for any signals after the buffered bulk @@ -2023,17 +2023,17 @@ static CsrResult process_fh_cmd_queue(card_t *card, CsrInt32 *processed) card->generate_interrupt = 1; return CSR_RESULT_SUCCESS; } - pending_chunks = (CsrUint16)(space_chunks - card->fh_buffer.count); + pending_chunks = (u16)(space_chunks - card->fh_buffer.count); } while (pending_sigs-- && pending_chunks > 0) { card_signal_t *csptr; CsrInt16 i; - CsrUint16 sig_chunks, total_length, free_chunks_in_fh_buffer; + u16 sig_chunks, total_length, free_chunks_in_fh_buffer; bulk_data_param_t bulkdata; u8 *packed_sigptr; - CsrUint16 signal_length = 0; + u16 signal_length = 0; /* Retrieve the entry at the head of the queue */ q_index = CSR_WIFI_HIP_Q_NEXT_R_SLOT(sigq); @@ -2051,15 +2051,15 @@ static CsrResult process_fh_cmd_queue(card_t *card, CsrInt32 *processed) } /* Need space for 2-byte SDIO protocol header + signal */ - sig_chunks = GET_CHUNKS_FOR(card->config_data.sig_frag_size, (CsrUint16)(signal_length + 2)); + sig_chunks = GET_CHUNKS_FOR(card->config_data.sig_frag_size, (u16)(signal_length + 2)); free_chunks_in_fh_buffer = GET_CHUNKS_FOR(card->config_data.sig_frag_size, - (CsrUint16)((card->fh_buffer.buf + UNIFI_FH_BUF_SIZE) - card->fh_buffer.ptr)); + (u16)((card->fh_buffer.buf + UNIFI_FH_BUF_SIZE) - card->fh_buffer.ptr)); if (free_chunks_in_fh_buffer < sig_chunks) { /* No more room */ unifi_notice(card->ospriv, "proc_fh_cmd_q: no room in fh buffer for 0x%.4X, deferring\n", - (CsrUint16)(GET_SIGNAL_ID(csptr->sigbuf))); + (u16)(GET_SIGNAL_ID(csptr->sigbuf))); break; } @@ -2069,7 +2069,7 @@ static CsrResult process_fh_cmd_queue(card_t *card, CsrInt32 *processed) if (CSR_RESULT_FAILURE == CardWriteBulkData(card, csptr, UNIFI_TRAFFIC_Q_MLME)) { unifi_notice(card->ospriv, "proc_fh_cmd_q: no fh data slots for 0x%.4X, deferring\n", - (CsrUint16)(GET_SIGNAL_ID(csptr->sigbuf))); + (u16)(GET_SIGNAL_ID(csptr->sigbuf))); break; } @@ -2175,13 +2175,13 @@ static CsrResult process_fh_traffic_queue(card_t *card, CsrInt32 *processed) CsrResult r; CsrInt16 n = 0; CsrInt32 q_no; - CsrUint16 pending_sigs = 0; - CsrUint16 pending_chunks = 0; - CsrUint16 needed_chunks; + u16 pending_sigs = 0; + u16 pending_chunks = 0; + u16 needed_chunks; CsrInt32 space_chunks; - CsrUint16 q_index; + u16 q_index; CsrUint32 host_tag = 0; - CsrUint16 slot_num = 0; + u16 slot_num = 0; *processed = 0; @@ -2203,7 +2203,7 @@ static CsrResult process_fh_traffic_queue(card_t *card, CsrInt32 *processed) * Note that GET_CHUNKS_FOR() needs the size of the packed * (wire-formatted) structure */ - pending_chunks += GET_CHUNKS_FOR(card->config_data.sig_frag_size, (CsrUint16)(csptr->signal_length + 2)); + pending_chunks += GET_CHUNKS_FOR(card->config_data.sig_frag_size, (u16)(csptr->signal_length + 2)); } } @@ -2240,12 +2240,12 @@ static CsrResult process_fh_traffic_queue(card_t *card, CsrInt32 *processed) /* Coalesce as many from-host signals as possible into a single block and write using a single CMD53 */ - if (needed_chunks > (CsrUint16)space_chunks) + if (needed_chunks > (u16)space_chunks) { /* Round up to the block size if necessary */ ROUND_UP_SPACE_CHUNKS(card, space_chunks); - if ((CsrUint16)space_chunks <= card->fh_buffer.count) + if ((u16)space_chunks <= card->fh_buffer.count) { /* * No room in UniFi for any signals after the buffered bulk @@ -2257,7 +2257,7 @@ static CsrResult process_fh_traffic_queue(card_t *card, CsrInt32 *processed) return 0; } - pending_chunks = (CsrUint16)space_chunks - card->fh_buffer.count; + pending_chunks = (u16)space_chunks - card->fh_buffer.count; } q_no = UNIFI_NO_OF_TX_QS - 1; @@ -2271,10 +2271,10 @@ static CsrResult process_fh_traffic_queue(card_t *card, CsrInt32 *processed) do { card_signal_t *csptr; - CsrUint16 sig_chunks, total_length, free_chunks_in_fh_buffer; + u16 sig_chunks, total_length, free_chunks_in_fh_buffer; bulk_data_param_t bulkdata; u8 *packed_sigptr; - CsrUint16 signal_length = 0; + u16 signal_length = 0; /* if this queue is empty go to next one. */ if (CSR_WIFI_HIP_Q_SLOTS_USED(&sigq[q_no]) == 0) @@ -2299,9 +2299,9 @@ static CsrResult process_fh_traffic_queue(card_t *card, CsrInt32 *processed) } /* Need space for 2-byte SDIO protocol header + signal */ - sig_chunks = GET_CHUNKS_FOR(card->config_data.sig_frag_size, (CsrUint16)(signal_length + 2)); + sig_chunks = GET_CHUNKS_FOR(card->config_data.sig_frag_size, (u16)(signal_length + 2)); free_chunks_in_fh_buffer = GET_CHUNKS_FOR(card->config_data.sig_frag_size, - (CsrUint16)((card->fh_buffer.buf + UNIFI_FH_BUF_SIZE) - card->fh_buffer.ptr)); + (u16)((card->fh_buffer.buf + UNIFI_FH_BUF_SIZE) - card->fh_buffer.ptr)); if (free_chunks_in_fh_buffer < sig_chunks) { /* No more room */ @@ -2444,12 +2444,12 @@ static CsrResult process_fh_traffic_queue(card_t *card, CsrInt32 *processed) static CsrResult flush_fh_buffer(card_t *card) { CsrResult r; - CsrUint16 len; - CsrUint16 sig_units; - CsrUint16 data_round; - CsrUint16 chunks_in_last_block; - CsrUint16 padding_chunks; - CsrUint16 i; + u16 len; + u16 sig_units; + u16 data_round; + u16 chunks_in_last_block; + u16 padding_chunks; + u16 i; len = card->fh_buffer.ptr - card->fh_buffer.buf; diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c index d98610f..9953ebf 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c @@ -202,7 +202,7 @@ static CsrResult retrying_write8(card_t *card, CsrInt16 funcnum, CsrUint32 addr, static CsrResult retrying_read16(card_t *card, CsrInt16 funcnum, - CsrUint32 addr, CsrUint16 *pdata) + CsrUint32 addr, u16 *pdata) { CsrSdioFunction *sdio = card->sdio_if; CsrResult r = CSR_RESULT_SUCCESS; @@ -263,7 +263,7 @@ static CsrResult retrying_read16(card_t *card, CsrInt16 funcnum, static CsrResult retrying_write16(card_t *card, CsrInt16 funcnum, - CsrUint32 addr, CsrUint16 data) + CsrUint32 addr, u16 data) { CsrSdioFunction *sdio = card->sdio_if; CsrResult r = CSR_RESULT_SUCCESS; @@ -391,7 +391,7 @@ CsrResult sdio_write_f0(card_t *card, CsrUint32 addr, u8 data) CsrResult unifi_read_direct_8_or_16(card_t *card, CsrUint32 addr, u8 *pdata) { #ifdef CSR_WIFI_TRANSPORT_CSPI - CsrUint16 w; + u16 w; CsrResult r; r = retrying_read16(card, card->function, addr, &w); @@ -433,7 +433,7 @@ CsrResult unifi_write_direct_8_or_16(card_t *card, CsrUint32 addr, u8 data) } #ifdef CSR_WIFI_TRANSPORT_CSPI - return retrying_write16(card, card->function, addr, (CsrUint16)data); + return retrying_write16(card, card->function, addr, (u16)data); #else return retrying_write8(card, card->function, addr, data); #endif @@ -462,7 +462,7 @@ CsrResult unifi_write_direct_8_or_16(card_t *card, CsrUint32 addr, u8 data) * even address is read. * --------------------------------------------------------------------------- */ -CsrResult unifi_read_direct16(card_t *card, CsrUint32 addr, CsrUint16 *pdata) +CsrResult unifi_read_direct16(card_t *card, CsrUint32 addr, u16 *pdata) { return retrying_read16(card, card->function, addr, pdata); } /* unifi_read_direct16() */ @@ -490,7 +490,7 @@ CsrResult unifi_read_direct16(card_t *card, CsrUint32 addr, CsrUint16 *pdata) * even address is written. * --------------------------------------------------------------------------- */ -CsrResult unifi_write_direct16(card_t *card, CsrUint32 addr, CsrUint16 data) +CsrResult unifi_write_direct16(card_t *card, CsrUint32 addr, u16 data) { return retrying_write16(card, card->function, addr, data); } /* unifi_write_direct16() */ @@ -516,7 +516,7 @@ CsrResult unifi_write_direct16(card_t *card, CsrUint32 addr, CsrUint16 data) CsrResult unifi_read_direct32(card_t *card, CsrUint32 addr, CsrUint32 *pdata) { CsrResult r; - CsrUint16 w0, w1; + u16 w0, w1; r = retrying_read16(card, card->function, addr, &w0); if (r != CSR_RESULT_SUCCESS) @@ -564,12 +564,12 @@ CsrResult unifi_read_direct32(card_t *card, CsrUint32 addr, CsrUint32 *pdata) * even address is read. * --------------------------------------------------------------------------- */ -static CsrResult unifi_read_directn_match(card_t *card, CsrUint32 addr, void *pdata, CsrUint16 len, s8 m, CsrUint32 *num) +static CsrResult unifi_read_directn_match(card_t *card, CsrUint32 addr, void *pdata, u16 len, s8 m, CsrUint32 *num) { CsrResult r; CsrUint32 i; u8 *cptr; - CsrUint16 w; + u16 w; *num = 0; @@ -631,7 +631,7 @@ static CsrResult unifi_read_directn_match(card_t *card, CsrUint32 addr, void *pd * even address is read. * --------------------------------------------------------------------------- */ -CsrResult unifi_read_directn(card_t *card, CsrUint32 addr, void *pdata, CsrUint16 len) +CsrResult unifi_read_directn(card_t *card, CsrUint32 addr, void *pdata, u16 len) { CsrUint32 num; @@ -664,7 +664,7 @@ CsrResult unifi_read_directn(card_t *card, CsrUint32 addr, void *pdata, CsrUint1 * This means we must write data as pairs of bytes in reverse order. * --------------------------------------------------------------------------- */ -CsrResult unifi_write_directn(card_t *card, CsrUint32 addr, void *pdata, CsrUint16 len) +CsrResult unifi_write_directn(card_t *card, CsrUint32 addr, void *pdata, u16 len) { CsrResult r; u8 *cptr; @@ -716,7 +716,7 @@ CsrResult unifi_write_directn(card_t *card, CsrUint32 addr, void *pdata, CsrUint */ static CsrResult set_dmem_page(card_t *card, CsrUint32 dmem_addr, CsrUint32 *paddr) { - CsrUint16 page, addr; + u16 page, addr; CsrUint32 len; CsrResult r; @@ -756,7 +756,7 @@ static CsrResult set_dmem_page(card_t *card, CsrUint32 dmem_addr, CsrUint32 *pad static CsrResult set_pmem_page(card_t *card, CsrUint32 pmem_addr, enum chip_helper_window_type mem_type, CsrUint32 *paddr) { - CsrUint16 page, addr; + u16 page, addr; CsrUint32 len; CsrResult r; @@ -1064,7 +1064,7 @@ CsrResult unifi_read_8_or_16(card_t *card, CsrUint32 unifi_addr, u8 *pdata) CsrUint32 sdio_addr; CsrResult r; #ifdef CSR_WIFI_TRANSPORT_CSPI - CsrUint16 w; + u16 w; #endif r = set_page(card, unifi_addr, &sdio_addr); @@ -1115,7 +1115,7 @@ CsrResult unifi_write_8_or_16(card_t *card, CsrUint32 unifi_addr, u8 data) CsrUint32 sdio_addr; CsrResult r; #ifdef CSR_WIFI_TRANSPORT_CSPI - CsrUint16 w; + u16 w; #endif r = set_page(card, unifi_addr, &sdio_addr); @@ -1162,7 +1162,7 @@ CsrResult unifi_write_8_or_16(card_t *card, CsrUint32 unifi_addr, u8 data) * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified * --------------------------------------------------------------------------- */ -CsrResult unifi_card_read16(card_t *card, CsrUint32 unifi_addr, CsrUint16 *pdata) +CsrResult unifi_card_read16(card_t *card, CsrUint32 unifi_addr, u16 *pdata) { CsrUint32 sdio_addr; CsrResult r; @@ -1199,7 +1199,7 @@ CsrResult unifi_card_read16(card_t *card, CsrUint32 unifi_addr, CsrUint16 *pdata * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified * --------------------------------------------------------------------------- */ -CsrResult unifi_card_write16(card_t *card, CsrUint32 unifi_addr, CsrUint16 data) +CsrResult unifi_card_write16(card_t *card, CsrUint32 unifi_addr, u16 data) { CsrUint32 sdio_addr; CsrResult r; @@ -1278,7 +1278,7 @@ CsrResult unifi_read32(card_t *card, CsrUint32 unifi_addr, CsrUint32 *pdata) * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified * --------------------------------------------------------------------------- */ -CsrResult unifi_readn_match(card_t *card, CsrUint32 unifi_addr, void *pdata, CsrUint16 len, s8 match) +CsrResult unifi_readn_match(card_t *card, CsrUint32 unifi_addr, void *pdata, u16 len, s8 match) { CsrUint32 sdio_addr; CsrResult r; @@ -1295,13 +1295,13 @@ CsrResult unifi_readn_match(card_t *card, CsrUint32 unifi_addr, void *pdata, Csr } /* unifi_readn_match() */ -CsrResult unifi_card_readn(card_t *card, CsrUint32 unifi_addr, void *pdata, CsrUint16 len) +CsrResult unifi_card_readn(card_t *card, CsrUint32 unifi_addr, void *pdata, u16 len) { return unifi_readn_match(card, unifi_addr, pdata, len, -1); } /* unifi_card_readn() */ -CsrResult unifi_readnz(card_t *card, CsrUint32 unifi_addr, void *pdata, CsrUint16 len) +CsrResult unifi_readnz(card_t *card, CsrUint32 unifi_addr, void *pdata, u16 len) { return unifi_readn_match(card, unifi_addr, pdata, len, 0); } /* unifi_readnz() */ @@ -1384,7 +1384,7 @@ CsrInt32 unifi_read_shared_count(card_t *card, CsrUint32 addr) * CSR_WIFI_HIP_RESULT_INVALID_VALUE an odd length or length too big. * --------------------------------------------------------------------------- */ -CsrResult unifi_writen(card_t *card, CsrUint32 unifi_addr, void *pdata, CsrUint16 len) +CsrResult unifi_writen(card_t *card, CsrUint32 unifi_addr, void *pdata, u16 len) { CsrUint32 sdio_addr; CsrResult r; @@ -1401,7 +1401,7 @@ CsrResult unifi_writen(card_t *card, CsrUint32 unifi_addr, void *pdata, CsrUint1 static CsrResult csr_sdio_block_rw(card_t *card, CsrInt16 funcnum, CsrUint32 addr, u8 *pdata, - CsrUint16 count, CsrInt16 dir_is_write) + u16 count, CsrInt16 dir_is_write) { CsrResult csrResult; @@ -1505,7 +1505,7 @@ CsrResult unifi_bulk_rw(card_t *card, CsrUint32 handle, void *pdata, pdata, (direction == UNIFI_SDIO_READ)?"To" : "From"); if (direction == UNIFI_SDIO_WRITE) { - dump(pdata, (CsrUint16)len); + dump(pdata, (u16)len); } else { @@ -1529,7 +1529,7 @@ CsrResult unifi_bulk_rw(card_t *card, CsrUint32 handle, void *pdata, while (1) { csrResult = csr_sdio_block_rw(card, card->function, handle, - (u8 *)pdata, (CsrUint16)len, + (u8 *)pdata, (u16)len, direction); if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) { @@ -1550,7 +1550,7 @@ CsrResult unifi_bulk_rw(card_t *card, CsrUint32 handle, void *pdata, { if (dump_read) { - dump(pdata, (CsrUint16)len); + dump(pdata, (u16)len); } break; } @@ -1699,7 +1699,7 @@ CsrResult unifi_bulk_rw_noretry(card_t *card, CsrUint32 handle, void *pdata, CsrResult csrResult; csrResult = csr_sdio_block_rw(card, card->function, handle, - (u8 *)pdata, (CsrUint16)len, direction); + (u8 *)pdata, (u16)len, direction); if (csrResult != CSR_RESULT_SUCCESS) { unifi_error(card->ospriv, "Block %s failed\n", diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper.c b/drivers/staging/csr/csr_wifi_hip_chiphelper.c index 729df88..efdbab0 100644 --- a/drivers/staging/csr/csr_wifi_hip_chiphelper.c +++ b/drivers/staging/csr/csr_wifi_hip_chiphelper.c @@ -58,10 +58,10 @@ static const struct chip_helper_init_values init_vals_v22_v23[] = { { 0x????, 0x???? }*/ }; -static const CsrUint16 reset_program_a_v1_or_v2[] = { +static const u16 reset_program_a_v1_or_v2[] = { 0x0000 }; -static const CsrUint16 reset_program_b_v1_or_v2[] = { +static const u16 reset_program_b_v1_or_v2[] = { 0x0010, 0xFE00, 0xA021, 0xFF00, 0x8111, 0x0009, 0x0CA4, 0x0114, 0x0280, 0x04F8, 0xFE00, 0x6F25, 0x06E0, 0x0010, 0xFC00, 0x0121, 0xFC00, 0x0225, 0xFE00, 0x7125, 0xFE00, 0x6D11, 0x03F0, 0xFE00, @@ -591,7 +591,7 @@ ChipDescript* ChipHelper_GetVersionSdio(u8 sdio_ver) } -ChipDescript* ChipHelper_GetVersionAny(CsrUint16 from_FF9A, CsrUint16 from_FE81) +ChipDescript* ChipHelper_GetVersionAny(u16 from_FF9A, u16 from_FE81) { CsrUint32 i; @@ -624,7 +624,7 @@ ChipDescript* ChipHelper_GetVersionAny(CsrUint16 from_FF9A, CsrUint16 from_FE81) } -ChipDescript* ChipHelper_GetVersionUniFi(CsrUint16 ver) +ChipDescript* ChipHelper_GetVersionUniFi(u16 ver) { return ChipHelper_GetVersionAny(0x0000, ver); } @@ -636,7 +636,7 @@ ChipDescript *ChipHelper_Null(void) } -ChipDescript* ChipHelper_GetVersionBlueCore(enum chip_helper_bluecore_age bc_age, CsrUint16 version) +ChipDescript* ChipHelper_GetVersionBlueCore(enum chip_helper_bluecore_age bc_age, u16 version) { if (bc_age == chip_helper_bluecore_pre_bc7) { @@ -664,7 +664,7 @@ CHIP_HELPER_LIST(C_DEF) /* * Map register addresses between HOST and SPI access. */ -CsrUint16 ChipHelper_MapAddress_SPI2HOST(ChipDescript *chip_help, CsrUint16 addr) +u16 ChipHelper_MapAddress_SPI2HOST(ChipDescript *chip_help, u16 addr) { CsrUint32 i; for (i = 0; i < chip_help->map.len; i++) @@ -678,7 +678,7 @@ CsrUint16 ChipHelper_MapAddress_SPI2HOST(ChipDescript *chip_help, CsrUint16 addr } -CsrUint16 ChipHelper_MapAddress_HOST2SPI(ChipDescript *chip_help, CsrUint16 addr) +u16 ChipHelper_MapAddress_HOST2SPI(ChipDescript *chip_help, u16 addr) { CsrUint32 i; for (i = 0; i < chip_help->map.len; i++) @@ -698,7 +698,7 @@ CsrUint16 ChipHelper_MapAddress_HOST2SPI(ChipDescript *chip_help, CsrUint16 addr start is unusable because something else is cluttering up the address map then that is taken into account and this function returns that address justt past that. */ -CsrUint16 ChipHelper_WINDOW_ADDRESS(ChipDescript *chip_help, +u16 ChipHelper_WINDOW_ADDRESS(ChipDescript *chip_help, enum chip_helper_window_index window) { if (window < CHIP_HELPER_WINDOW_COUNT && @@ -711,7 +711,7 @@ CsrUint16 ChipHelper_WINDOW_ADDRESS(ChipDescript *chip_help, /* This returns the size of the window minus any blocked section */ -CsrUint16 ChipHelper_WINDOW_SIZE(ChipDescript *chip_help, +u16 ChipHelper_WINDOW_SIZE(ChipDescript *chip_help, enum chip_helper_window_index window) { if (window < CHIP_HELPER_WINDOW_COUNT && @@ -747,11 +747,11 @@ CsrInt32 ChipHelper_DecodeWindow(ChipDescript *chip_help, enum chip_helper_window_index window, enum chip_helper_window_type type, CsrUint32 offset, - CsrUint16 *page, CsrUint16 *addr, CsrUint32 *len) + u16 *page, u16 *addr, CsrUint32 *len) { const struct window_info_t *win; const struct window_shift_info_t *mode; - CsrUint16 of, pg; + u16 of, pg; if (window >= CHIP_HELPER_WINDOW_COUNT) { @@ -774,8 +774,8 @@ CsrInt32 ChipHelper_DecodeWindow(ChipDescript *chip_help, return FALSE; } - pg = (CsrUint16)(offset >> mode->page_shift) + mode->page_offset; - of = (CsrUint16)(offset & ((1 << mode->page_shift) - 1)); + pg = (u16)(offset >> mode->page_shift) + mode->page_offset; + of = (u16)(offset & ((1 << mode->page_shift) - 1)); /* If 'blocked' is zero this does nothing, else decrease the page register and increase the offset until we aren't in the blocked region of the window. */ diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper.h b/drivers/staging/csr/csr_wifi_hip_chiphelper.h index 60dff8e..a539c04 100644 --- a/drivers/staging/csr/csr_wifi_hip_chiphelper.h +++ b/drivers/staging/csr/csr_wifi_hip_chiphelper.h @@ -133,8 +133,8 @@ enum chip_helper_fixed_registers /* Address-value pairs for defining initialisation values */ struct chip_helper_init_values { - CsrUint16 addr; - CsrUint16 value; + u16 addr; + u16 value; }; /* A block of data that should be written to the device */ @@ -142,7 +142,7 @@ struct chip_helper_reset_values { CsrUint32 gp_address; CsrUint32 len; - const CsrUint16 *data; + const u16 *data; }; /* @@ -164,11 +164,11 @@ ChipDescript* ChipHelper_Null(void); FF9A is the old GBL_CHIP_VERSION register. If the high eight bits are zero then the chip is a new (BC7 +) one and FE81 is the _new_ GBL_CHIP_VERSION register. */ -ChipDescript* ChipHelper_GetVersionAny(CsrUint16 from_FF9A, CsrUint16 from_FE81); +ChipDescript* ChipHelper_GetVersionAny(u16 from_FF9A, u16 from_FE81); /* The chip is a UniFi, but we don't know which type The parameter is the value of UNIFI_GBL_CHIP_VERSION (0xFE81) */ -ChipDescript* ChipHelper_GetVersionUniFi(CsrUint16 version); +ChipDescript* ChipHelper_GetVersionUniFi(u16 version); /* This gets the version from the SDIO device id. This only gives quite a coarse grained version, so we should update once @@ -180,7 +180,7 @@ ChipDescript* ChipHelper_GetVersionSdio(u8 sdio_version); then "version" is read from FE81. If we don't know if we're pre or post BC7 then we should use "GetVersionAny". */ ChipDescript* ChipHelper_GetVersionBlueCore(enum chip_helper_bluecore_age age, - CsrUint16 version); + u16 version); /* The main functions of this class are built with an X macro. This means we can generate the C and C++ versions from the same source @@ -198,52 +198,52 @@ ChipDescript* ChipHelper_GetVersionBlueCore(enum chip_helper_bluecore_age age, #define CHIP_HELPER_LIST(m) \ CHIP_HELPER_DEF0(m, (const CsrCharString *, FriendlyName, friendly_name)) \ CHIP_HELPER_DEF0(m, (const CsrCharString *, MarketingName, marketing_name)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, DBG_EMU_CMD, regs->dbg_emu_cmd)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, DBG_HOST_PROC_SELECT, regs->host.dbg_proc_select)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, DBG_HOST_STOP_STATUS, regs->host.dbg_stop_status)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, HOST_WINDOW1_PAGE, regs->host.window1_page)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, HOST_WINDOW2_PAGE, regs->host.window2_page)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, HOST_WINDOW3_PAGE, regs->host.window3_page)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, HOST_IO_LOG_ADDR, regs->host.io_log_addr)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, DBG_SPI_PROC_SELECT, regs->spi.dbg_proc_select)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, DBG_SPI_STOP_STATUS, regs->spi.dbg_stop_status)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, SPI_WINDOW1_PAGE, regs->spi.window1_page)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, SPI_WINDOW2_PAGE, regs->spi.window2_page)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, SPI_WINDOW3_PAGE, regs->spi.window3_page)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, SPI_IO_LOG_ADDR, regs->spi.io_log_addr)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, DBG_RESET, regs->dbg_reset)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, DBG_RESET_VALUE, regs->dbg_reset_value)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, DBG_RESET_WARN, regs->dbg_reset_warn)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, DBG_RESET_WARN_VALUE, regs->dbg_reset_warn_value)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, DBG_RESET_RESULT, regs->dbg_reset_result)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, WATCHDOG_DISABLE, regs->watchdog_disable)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, PROC_PC_SNOOP, regs->proc_pc_snoop)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, GBL_CHIP_VERSION, regs->gbl_chip_version)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, GBL_MISC_ENABLES, regs->gbl_misc_enables)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, XAP_PCH, regs->xap_pch)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, XAP_PCL, regs->xap_pcl)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, MAILBOX0, regs->mailbox0)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, MAILBOX1, regs->mailbox1)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, MAILBOX2, regs->mailbox2)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, MAILBOX3, regs->mailbox3)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, SDIO_HIP_HANDSHAKE, regs->sdio_hip_handshake)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, SDIO_HOST_INT, regs->sdio_host_int)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, COEX_STATUS, regs->coex_status)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, SHARED_IO_INTERRUPT, regs->shared_io_interrupt)) \ + CHIP_HELPER_DEF0(m, (u16, DBG_EMU_CMD, regs->dbg_emu_cmd)) \ + CHIP_HELPER_DEF0(m, (u16, DBG_HOST_PROC_SELECT, regs->host.dbg_proc_select)) \ + CHIP_HELPER_DEF0(m, (u16, DBG_HOST_STOP_STATUS, regs->host.dbg_stop_status)) \ + CHIP_HELPER_DEF0(m, (u16, HOST_WINDOW1_PAGE, regs->host.window1_page)) \ + CHIP_HELPER_DEF0(m, (u16, HOST_WINDOW2_PAGE, regs->host.window2_page)) \ + CHIP_HELPER_DEF0(m, (u16, HOST_WINDOW3_PAGE, regs->host.window3_page)) \ + CHIP_HELPER_DEF0(m, (u16, HOST_IO_LOG_ADDR, regs->host.io_log_addr)) \ + CHIP_HELPER_DEF0(m, (u16, DBG_SPI_PROC_SELECT, regs->spi.dbg_proc_select)) \ + CHIP_HELPER_DEF0(m, (u16, DBG_SPI_STOP_STATUS, regs->spi.dbg_stop_status)) \ + CHIP_HELPER_DEF0(m, (u16, SPI_WINDOW1_PAGE, regs->spi.window1_page)) \ + CHIP_HELPER_DEF0(m, (u16, SPI_WINDOW2_PAGE, regs->spi.window2_page)) \ + CHIP_HELPER_DEF0(m, (u16, SPI_WINDOW3_PAGE, regs->spi.window3_page)) \ + CHIP_HELPER_DEF0(m, (u16, SPI_IO_LOG_ADDR, regs->spi.io_log_addr)) \ + CHIP_HELPER_DEF0(m, (u16, DBG_RESET, regs->dbg_reset)) \ + CHIP_HELPER_DEF0(m, (u16, DBG_RESET_VALUE, regs->dbg_reset_value)) \ + CHIP_HELPER_DEF0(m, (u16, DBG_RESET_WARN, regs->dbg_reset_warn)) \ + CHIP_HELPER_DEF0(m, (u16, DBG_RESET_WARN_VALUE, regs->dbg_reset_warn_value)) \ + CHIP_HELPER_DEF0(m, (u16, DBG_RESET_RESULT, regs->dbg_reset_result)) \ + CHIP_HELPER_DEF0(m, (u16, WATCHDOG_DISABLE, regs->watchdog_disable)) \ + CHIP_HELPER_DEF0(m, (u16, PROC_PC_SNOOP, regs->proc_pc_snoop)) \ + CHIP_HELPER_DEF0(m, (u16, GBL_CHIP_VERSION, regs->gbl_chip_version)) \ + CHIP_HELPER_DEF0(m, (u16, GBL_MISC_ENABLES, regs->gbl_misc_enables)) \ + CHIP_HELPER_DEF0(m, (u16, XAP_PCH, regs->xap_pch)) \ + CHIP_HELPER_DEF0(m, (u16, XAP_PCL, regs->xap_pcl)) \ + CHIP_HELPER_DEF0(m, (u16, MAILBOX0, regs->mailbox0)) \ + CHIP_HELPER_DEF0(m, (u16, MAILBOX1, regs->mailbox1)) \ + CHIP_HELPER_DEF0(m, (u16, MAILBOX2, regs->mailbox2)) \ + CHIP_HELPER_DEF0(m, (u16, MAILBOX3, regs->mailbox3)) \ + CHIP_HELPER_DEF0(m, (u16, SDIO_HIP_HANDSHAKE, regs->sdio_hip_handshake)) \ + CHIP_HELPER_DEF0(m, (u16, SDIO_HOST_INT, regs->sdio_host_int)) \ + CHIP_HELPER_DEF0(m, (u16, COEX_STATUS, regs->coex_status)) \ + CHIP_HELPER_DEF0(m, (u16, SHARED_IO_INTERRUPT, regs->shared_io_interrupt)) \ CHIP_HELPER_DEF0(m, (CsrUint32, PROGRAM_MEMORY_RAM_OFFSET, prog_offset.ram)) \ CHIP_HELPER_DEF0(m, (CsrUint32, PROGRAM_MEMORY_ROM_OFFSET, prog_offset.rom)) \ CHIP_HELPER_DEF0(m, (CsrUint32, PROGRAM_MEMORY_FLASH_OFFSET, prog_offset.flash)) \ CHIP_HELPER_DEF0(m, (CsrUint32, PROGRAM_MEMORY_EXT_SRAM_OFFSET, prog_offset.ext_sram)) \ - CHIP_HELPER_DEF0(m, (CsrUint16, DATA_MEMORY_RAM_OFFSET, data_offset.ram)) \ + CHIP_HELPER_DEF0(m, (u16, DATA_MEMORY_RAM_OFFSET, data_offset.ram)) \ CHIP_HELPER_DEF0(m, (CsrInt32, HasFlash, bools.has_flash)) \ CHIP_HELPER_DEF0(m, (CsrInt32, HasExtSram, bools.has_ext_sram)) \ CHIP_HELPER_DEF0(m, (CsrInt32, HasRom, bools.has_rom)) \ CHIP_HELPER_DEF0(m, (CsrInt32, HasBt, bools.has_bt)) \ CHIP_HELPER_DEF0(m, (CsrInt32, HasWLan, bools.has_wlan)) \ - CHIP_HELPER_DEF1(m, (CsrUint16, WINDOW_ADDRESS, enum chip_helper_window_index, window)) \ - CHIP_HELPER_DEF1(m, (CsrUint16, WINDOW_SIZE, enum chip_helper_window_index, window)) \ - CHIP_HELPER_DEF1(m, (CsrUint16, MapAddress_SPI2HOST, CsrUint16, addr)) \ - CHIP_HELPER_DEF1(m, (CsrUint16, MapAddress_HOST2SPI, CsrUint16, addr)) \ + CHIP_HELPER_DEF1(m, (u16, WINDOW_ADDRESS, enum chip_helper_window_index, window)) \ + CHIP_HELPER_DEF1(m, (u16, WINDOW_SIZE, enum chip_helper_window_index, window)) \ + CHIP_HELPER_DEF1(m, (u16, MapAddress_SPI2HOST, u16, addr)) \ + CHIP_HELPER_DEF1(m, (u16, MapAddress_HOST2SPI, u16, addr)) \ CHIP_HELPER_DEF1(m, (CsrUint32, ClockStartupSequence, const struct chip_helper_init_values **, val)) \ CHIP_HELPER_DEF1(m, (CsrUint32, HostResetSequence, const struct chip_helper_reset_values **, val)) @@ -406,7 +406,7 @@ CsrInt32 ChipHelper_DecodeWindow(ChipDescript *chip_help, enum chip_helper_window_index window, enum chip_helper_window_type type, CsrUint32 offset, - CsrUint16 *page, CsrUint16 *addr, CsrUint32 *len); + u16 *page, u16 *addr, CsrUint32 *len); #ifdef __cplusplus /* Close the extern "C" */ @@ -429,7 +429,7 @@ public: /* The default constructor assume a BC7 / UF105x series chip and that the number given is the value of UNIFI_GBL_CHIP_VERSION (0xFE81) */ - ChipHelper(CsrUint16 version); + ChipHelper(u16 version); /* This returns the C interface magic token from a C++ instance. */ ChipDescript* GetDescript() const @@ -442,9 +442,9 @@ public: void ClearVersion(); /* Load this class with data for a specific chip. */ - void GetVersionAny(CsrUint16 from_FF9A, CsrUint16 from_FE81); - void GetVersionUniFi(CsrUint16 version); - void GetVersionBlueCore(chip_helper_bluecore_age age, CsrUint16 version); + void GetVersionAny(u16 from_FF9A, u16 from_FE81); + void GetVersionUniFi(u16 version); + void GetVersionBlueCore(chip_helper_bluecore_age age, u16 version); void GetVersionSdio(u8 sdio_version); /* Helpers to build the definitions of the member functions. */ @@ -460,7 +460,7 @@ public: CsrInt32 DecodeWindow(chip_helper_window_index window, chip_helper_window_type type, CsrUint32 offset, - CsrUint16 &page, CsrUint16 &addr, CsrUint32 &len) const; + u16 &page, u16 &addr, CsrUint32 &len) const; private: ChipDescript *m_desc; diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h b/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h index c0e2f2a..aacafe1 100644 --- a/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h +++ b/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h @@ -47,11 +47,11 @@ struct val_array_t const struct chip_helper_init_values *vals; }; -/* Just a (counted) CsrUint16 array */ +/* Just a (counted) u16 array */ struct data_array_t { CsrUint32 len; - const CsrUint16 *vals; + const u16 *vals; }; struct reset_prog_t @@ -64,7 +64,7 @@ struct reset_prog_t different host transports. */ struct chip_map_address_t { - CsrUint16 spi, host; + u16 spi, host; }; struct map_array_t @@ -75,38 +75,38 @@ struct map_array_t struct chip_device_regs_per_transport_t { - CsrUint16 dbg_proc_select; - CsrUint16 dbg_stop_status; - CsrUint16 window1_page; /* PROG_PMEM1 or GW1 */ - CsrUint16 window2_page; /* PROG_PMEM2 or GW2 */ - CsrUint16 window3_page; /* SHARED or GW3 */ - CsrUint16 io_log_addr; + u16 dbg_proc_select; + u16 dbg_stop_status; + u16 window1_page; /* PROG_PMEM1 or GW1 */ + u16 window2_page; /* PROG_PMEM2 or GW2 */ + u16 window3_page; /* SHARED or GW3 */ + u16 io_log_addr; }; struct chip_device_regs_t { - CsrUint16 gbl_chip_version; - CsrUint16 gbl_misc_enables; - CsrUint16 dbg_emu_cmd; + u16 gbl_chip_version; + u16 gbl_misc_enables; + u16 dbg_emu_cmd; struct chip_device_regs_per_transport_t host; struct chip_device_regs_per_transport_t spi; - CsrUint16 dbg_reset; - CsrUint16 dbg_reset_value; - CsrUint16 dbg_reset_warn; - CsrUint16 dbg_reset_warn_value; - CsrUint16 dbg_reset_result; - CsrUint16 xap_pch; - CsrUint16 xap_pcl; - CsrUint16 proc_pc_snoop; - CsrUint16 watchdog_disable; - CsrUint16 mailbox0; - CsrUint16 mailbox1; - CsrUint16 mailbox2; - CsrUint16 mailbox3; - CsrUint16 sdio_host_int; - CsrUint16 shared_io_interrupt; - CsrUint16 sdio_hip_handshake; - CsrUint16 coex_status; /* Allows WAPI detection */ + u16 dbg_reset; + u16 dbg_reset_value; + u16 dbg_reset_warn; + u16 dbg_reset_warn_value; + u16 dbg_reset_result; + u16 xap_pch; + u16 xap_pcl; + u16 proc_pc_snoop; + u16 watchdog_disable; + u16 mailbox0; + u16 mailbox1; + u16 mailbox2; + u16 mailbox3; + u16 sdio_host_int; + u16 shared_io_interrupt; + u16 sdio_hip_handshake; + u16 coex_status; /* Allows WAPI detection */ }; /* If allowed is false then this window does not provide this @@ -119,7 +119,7 @@ struct window_shift_info_t { CsrInt32 allowed; CsrUint32 page_shift; - CsrUint16 page_offset; + u16 page_offset; }; /* Each window has an address and size. These are obvious. It then @@ -129,9 +129,9 @@ struct window_shift_info_t are unusable. */ struct window_info_t { - CsrUint16 address; - CsrUint16 size; - CsrUint16 blocked; + u16 address; + u16 size; + u16 blocked; const struct window_shift_info_t *mode; }; @@ -141,8 +141,8 @@ struct window_info_t struct chip_version_t { CsrInt32 pre_bc7; - CsrUint16 mask; - CsrUint16 result; + u16 mask; + u16 result; u8 sdio; }; @@ -193,7 +193,7 @@ struct chip_device_desc_t /* The offsets into the data address space of interesting things. */ struct { - CsrUint16 ram; + u16 ram; /* maybe add shared / page tables? */ } data_offset; diff --git a/drivers/staging/csr/csr_wifi_hip_conversions.h b/drivers/staging/csr/csr_wifi_hip_conversions.h index 212b9b7..58a2d72 100644 --- a/drivers/staging/csr/csr_wifi_hip_conversions.h +++ b/drivers/staging/csr/csr_wifi_hip_conversions.h @@ -71,7 +71,7 @@ extern "C" { CsrInt32 get_packed_struct_size(const u8 *buf); CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig); -CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, CsrUint16 *sig_len); +CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_wifi_hip_download.c b/drivers/staging/csr/csr_wifi_hip_download.c index 4f7dae8..2a3ece3 100644 --- a/drivers/staging/csr/csr_wifi_hip_download.c +++ b/drivers/staging/csr/csr_wifi_hip_download.c @@ -52,7 +52,7 @@ static CsrResult do_patch_convert_download(card_t *card, static CsrResult _find_in_slut(card_t *card, symbol_t *psym, CsrUint32 *pslut) { CsrUint32 slut_address; - CsrUint16 finger_print; + u16 finger_print; CsrResult r; CsrResult csrResult; @@ -121,7 +121,7 @@ static CsrResult _find_in_slut(card_t *card, symbol_t *psym, CsrUint32 *pslut) while (1) { - CsrUint16 id; + u16 id; CsrUint32 obj; r = unifi_card_read16(card, slut_address, &id); @@ -500,7 +500,7 @@ void* unifi_dl_fw_read_start(card_t *card, s8 is_fw) static CsrResult safe_read_shared_location(card_t *card, CsrUint32 address, u8 *pdata) { CsrResult r; - CsrUint16 limit = 1000; + u16 limit = 1000; u8 b, b2; *pdata = 0; @@ -662,7 +662,7 @@ static CsrResult send_ptdl_to_unifi(card_t *card, void *dlpriv, CsrInt32 data_len; CsrUint32 write_len; CsrResult r; - const CsrUint16 buf_size = 2 * 1024; + const u16 buf_size = 2 * 1024; offset = ptdl->dl_offset; data_len = ptdl->dl_size; @@ -757,8 +757,8 @@ static CsrResult do_patch_download(card_t *card, void *dlpriv, xbv1_t *pfwinfo, { CsrResult r; CsrInt32 i; - CsrUint16 loader_version; - CsrUint16 handle; + u16 loader_version; + u16 handle; CsrUint32 total_bytes; /* @@ -795,7 +795,7 @@ static CsrResult do_patch_download(card_t *card, void *dlpriv, xbv1_t *pfwinfo, if (card->loader_led_mask) { r = unifi_card_write16(card, boot_ctrl_addr + 2, - (CsrUint16)card->loader_led_mask); + (u16)card->loader_led_mask); if (r != CSR_RESULT_SUCCESS) { unifi_error(card->ospriv, "Patch download: Failed to write LED mask\n"); diff --git a/drivers/staging/csr/csr_wifi_hip_dump.c b/drivers/staging/csr/csr_wifi_hip_dump.c index efa699f..fa9b697 100644 --- a/drivers/staging/csr/csr_wifi_hip_dump.c +++ b/drivers/staging/csr/csr_wifi_hip_dump.c @@ -38,12 +38,12 @@ /* Mini-coredump state */ typedef struct coredump_buf { - CsrUint16 count; /* serial number of dump */ + u16 count; /* serial number of dump */ CsrTime timestamp; /* host's system time at capture */ CsrInt16 requestor; /* request: 0=auto dump, 1=manual */ - CsrUint16 chip_ver; + u16 chip_ver; CsrUint32 fw_ver; - CsrUint16 *zone[HIP_CDUMP_NUM_ZONES]; + u16 *zone[HIP_CDUMP_NUM_ZONES]; struct coredump_buf *next; /* circular list */ struct coredump_buf *prev; /* circular list */ @@ -55,16 +55,16 @@ struct coredump_zone unifi_coredump_space_t space; /* XAP memory space this zone covers */ enum unifi_dbg_processors_select cpu; /* XAP CPU core selector */ CsrUint32 gp; /* Generic Pointer to memory zone on XAP */ - CsrUint16 offset; /* 16-bit XAP word offset of zone in memory space */ - CsrUint16 length; /* Length of zone in XAP words */ + u16 offset; /* 16-bit XAP word offset of zone in memory space */ + u16 length; /* Length of zone in XAP words */ }; static CsrResult unifi_coredump_from_sdio(card_t *card, coredump_buffer *dump_buf); static CsrResult unifi_coredump_read_zones(card_t *card, coredump_buffer *dump_buf); -static CsrResult unifi_coredump_read_zone(card_t *card, CsrUint16 *zone, +static CsrResult unifi_coredump_read_zone(card_t *card, u16 *zone, const struct coredump_zone *def); static CsrInt32 get_value_from_coredump(const coredump_buffer *dump, - const unifi_coredump_space_t space, const CsrUint16 offset); + const unifi_coredump_space_t space, const u16 offset); /* Table of chip memory zones we capture on mini-coredump */ static const struct coredump_zone zonedef_table[HIP_CDUMP_NUM_ZONES] = { @@ -190,7 +190,7 @@ CsrResult unifi_coredump_handle_request(card_t *card) CsrResult unifi_coredump_capture(card_t *card, struct unifi_coredump_req *req) { CsrResult r = CSR_RESULT_SUCCESS; - static CsrUint16 dump_seq_no = 1; + static u16 dump_seq_no = 1; CsrTime time_of_capture; func_enter(); @@ -295,10 +295,10 @@ done: */ static CsrInt32 get_value_from_coredump(const coredump_buffer *coreDump, const unifi_coredump_space_t space, - const CsrUint16 offset_in_space) + const u16 offset_in_space) { CsrInt32 r = -1; - CsrUint16 offset_in_zone; + u16 offset_in_zone; CsrUint32 zone_end_offset; CsrInt32 i; const struct coredump_zone *def = &zonedef_table[0]; @@ -430,7 +430,7 @@ CsrResult unifi_coredump_get_value(card_t *card, struct unifi_coredump_req *req) req->index, find_dump->count, i); /* Find the appropriate entry in the buffer */ - req->value = get_value_from_coredump(find_dump, req->space, (CsrUint16)req->offset); + req->value = get_value_from_coredump(find_dump, req->space, (u16)req->offset); if (req->value < 0) { r = CSR_WIFI_HIP_RESULT_RANGE; /* Un-captured register */ @@ -476,7 +476,7 @@ done: * It is assumed that the caller has already stopped the XAPs * --------------------------------------------------------------------------- */ -static CsrResult unifi_coredump_read_zone(card_t *card, CsrUint16 *zonebuf, const struct coredump_zone *def) +static CsrResult unifi_coredump_read_zone(card_t *card, u16 *zonebuf, const struct coredump_zone *def) { CsrResult r; @@ -508,7 +508,7 @@ static CsrResult unifi_coredump_read_zone(card_t *card, CsrUint16 *zonebuf, cons def->space, def->offset, def->length, def->gp, def->cpu); /* Read on-chip RAM (byte-wise) */ - r = unifi_card_readn(card, def->gp, zonebuf, (CsrUint16)(def->length * 2)); + r = unifi_card_readn(card, def->gp, zonebuf, (u16)(def->length * 2)); if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) { goto done; @@ -585,7 +585,7 @@ static CsrResult unifi_coredump_read_zones(card_t *card, coredump_buffer *dump_b */ static CsrResult unifi_coredump_from_sdio(card_t *card, coredump_buffer *dump_buf) { - CsrUint16 val; + u16 val; CsrResult r; CsrUint32 sdio_addr; @@ -661,7 +661,7 @@ static coredump_buffer* new_coredump_node(void *ospriv, coredump_buffer *prevnode) { coredump_buffer *newnode = NULL; - CsrUint16 *newzone = NULL; + u16 *newzone = NULL; CsrInt32 i; CsrUint32 zone_size; @@ -676,8 +676,8 @@ coredump_buffer* new_coredump_node(void *ospriv, coredump_buffer *prevnode) /* Allocate chip memory zone capture buffers */ for (i = 0; i < HIP_CDUMP_NUM_ZONES; i++) { - zone_size = sizeof(CsrUint16) * zonedef_table[i].length; - newzone = (CsrUint16 *)CsrMemAlloc(zone_size); + zone_size = sizeof(u16) * zonedef_table[i].length; + newzone = (u16 *)CsrMemAlloc(zone_size); newnode->zone[i] = newzone; if (newzone != NULL) { @@ -738,7 +738,7 @@ coredump_buffer* new_coredump_node(void *ospriv, coredump_buffer *prevnode) * free for capturing. * --------------------------------------------------------------------------- */ -CsrResult unifi_coredump_init(card_t *card, CsrUint16 num_dump_buffers) +CsrResult unifi_coredump_init(card_t *card, u16 num_dump_buffers) { #ifndef UNIFI_DISABLE_COREDUMP void *ospriv = card->ospriv; diff --git a/drivers/staging/csr/csr_wifi_hip_packing.c b/drivers/staging/csr/csr_wifi_hip_packing.c index e024a1f..968926b 100644 --- a/drivers/staging/csr/csr_wifi_hip_packing.c +++ b/drivers/staging/csr/csr_wifi_hip_packing.c @@ -38,7 +38,7 @@ CsrInt32 get_packed_struct_size(const u8 *buf) { CsrInt32 size = 0; - CsrUint16 sig_id; + u16 sig_id; sig_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(buf); @@ -2984,7 +2984,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) * CSR_WIFI_HIP_RESULT_INVALID_VALUE if the ID of signal was not recognised. * --------------------------------------------------------------------------- */ -CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, CsrUint16 *sig_len) +CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) { CsrInt16 index = 0; diff --git a/drivers/staging/csr/csr_wifi_hip_send.c b/drivers/staging/csr/csr_wifi_hip_send.c index 96bf40e..5d6b18b 100644 --- a/drivers/staging/csr/csr_wifi_hip_send.c +++ b/drivers/staging/csr/csr_wifi_hip_send.c @@ -104,7 +104,7 @@ static CsrResult send_signal(card_t *card, const u8 *sigptr, CsrUint32 siglen, const bulk_data_param_t *bulkdata, q_t *sigq, CsrUint32 priority_q, CsrUint32 run_bh) { - CsrUint16 i, data_slot_size; + u16 i, data_slot_size; card_signal_t *csptr; CsrInt16 qe; CsrResult r; @@ -128,7 +128,7 @@ static CsrResult send_signal(card_t *card, const u8 *sigptr, CsrUint32 siglen, csptr = CSR_WIFI_HIP_Q_SLOT_DATA(sigq, qe); /* Make up the card_signal struct */ - csptr->signal_length = (CsrUint16)siglen; + csptr->signal_length = (u16)siglen; CsrMemCpy((void *)csptr->sigbuf, (void *)sigptr, siglen); for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; ++i) @@ -307,7 +307,7 @@ CsrResult unifi_send_signal(card_t *card, const u8 *sigptr, CsrUint32 siglen, const bulk_data_param_t *bulkdata) { q_t *sig_soft_q; - CsrUint16 signal_id; + u16 signal_id; CsrResult r; CsrUint32 run_bh; CsrUint32 priority_q; @@ -328,7 +328,7 @@ CsrResult unifi_send_signal(card_t *card, const u8 *sigptr, CsrUint32 siglen, */ if (signal_id == CSR_MA_PACKET_REQUEST_ID) { - CsrUint16 frame_priority; + u16 frame_priority; if (card->periodic_wake_mode == UNIFI_PERIODIC_WAKE_HOST_ENABLED) { @@ -386,7 +386,7 @@ CsrResult unifi_send_signal(card_t *card, const u8 *sigptr, CsrUint32 siglen, CsrResult unifi_send_resources_available(card_t *card, const u8 *sigptr) { q_t *sig_soft_q; - CsrUint16 signal_id = GET_SIGNAL_ID(sigptr); + u16 signal_id = GET_SIGNAL_ID(sigptr); /* * If the signal is a CSR_MA_PACKET_REQUEST , @@ -394,7 +394,7 @@ CsrResult unifi_send_resources_available(card_t *card, const u8 *sigptr) */ if (signal_id == CSR_MA_PACKET_REQUEST_ID) { - CsrUint16 frame_priority; + u16 frame_priority; CsrUint32 priority_q; /* Map the frame priority to a traffic queue index. */ diff --git a/drivers/staging/csr/csr_wifi_hip_signals.c b/drivers/staging/csr/csr_wifi_hip_signals.c index 5d0be53..a1b16fa 100644 --- a/drivers/staging/csr/csr_wifi_hip_signals.c +++ b/drivers/staging/csr/csr_wifi_hip_signals.c @@ -944,7 +944,7 @@ CsrInt32 SigGetDataRefs(CSR_SIGNAL *aSignal, CSR_DATAREF **aDataRef) } -CsrUint32 SigGetFilterPos(CsrUint16 aSigID) +CsrUint32 SigGetFilterPos(u16 aSigID) { switch (aSigID) { diff --git a/drivers/staging/csr/csr_wifi_hip_sigs.h b/drivers/staging/csr/csr_wifi_hip_sigs.h index 5d04c06..a649e14 100644 --- a/drivers/staging/csr/csr_wifi_hip_sigs.h +++ b/drivers/staging/csr/csr_wifi_hip_sigs.h @@ -22,13 +22,13 @@ extern "C" { typedef CsrInt16 csr_place_holding_type; -typedef CsrUint16 CSR_ASSOCIATION_ID; +typedef u16 CSR_ASSOCIATION_ID; -typedef CsrUint16 CSR_AUTONOMOUS_SCAN_ID; +typedef u16 CSR_AUTONOMOUS_SCAN_ID; -typedef CsrUint16 CSR_BEACON_PERIODS; +typedef u16 CSR_BEACON_PERIODS; -typedef CsrUint16 CSR_BLACKOUT_ID; +typedef u16 CSR_BLACKOUT_ID; typedef enum CSR_BLACKOUT_SOURCE { @@ -57,9 +57,9 @@ typedef enum CSR_BOOT_LOADER_OPERATION CSR_BOOT_LOADER_IMAGE_3 = 0x13 } CSR_BOOT_LOADER_OPERATION; -typedef CsrUint16 CSR_CAPABILITY_INFORMATION; +typedef u16 CSR_CAPABILITY_INFORMATION; -typedef CsrUint16 CSR_CHANNEL_STARTING_FACTOR; +typedef u16 CSR_CHANNEL_STARTING_FACTOR; typedef CsrUint32 CSR_CIPHER_SUITE_SELECTOR; @@ -142,11 +142,11 @@ typedef enum CSR_MEMORY_SPACE CSR_BT_PROCESSOR_ROM = 0x32 } CSR_MEMORY_SPACE; -typedef CsrUint16 CSR_MICROSECONDS16; +typedef u16 CSR_MICROSECONDS16; typedef CsrUint32 CSR_MICROSECONDS32; -typedef CsrUint16 CSR_NATURAL16; +typedef u16 CSR_NATURAL16; typedef enum CSR_PS_SCHEME { @@ -161,7 +161,7 @@ typedef enum CSR_PACKET_FILTER_MODE CSR_PFM_OPT_IN = 0x0003 } CSR_PACKET_FILTER_MODE; -typedef CsrUint16 CSR_PERIODIC_ID; +typedef u16 CSR_PERIODIC_ID; typedef enum CSR_PERIODIC_SCHEDULING_MODE { @@ -344,9 +344,9 @@ typedef enum CSR_SIGNAL_ID CSR_DEBUG_GENERIC_INDICATION_ID = 0x080b } CSR_SIGNAL_ID; -typedef CsrUint16 CSR_SIMPLE_POINTER; +typedef u16 CSR_SIMPLE_POINTER; -typedef CsrUint16 CSR_STARTING_SEQUENCE_NUMBER; +typedef u16 CSR_STARTING_SEQUENCE_NUMBER; typedef enum CSR_SYMBOL_ID { @@ -377,7 +377,7 @@ typedef struct CSR_TSF_TIME u8 x[8]; } CSR_TSF_TIME; -typedef CsrUint16 CSR_TIME_UNITS; +typedef u16 CSR_TIME_UNITS; typedef enum CSR_TRANSMISSION_CONTROL { @@ -405,9 +405,9 @@ typedef enum CSR_TRANSMISSION_STATUS CSR_TX_REJECTED_DTIM_STARTED = 0x0010 } CSR_TRANSMISSION_STATUS; -typedef CsrUint16 CSR_TRIGGER_ID; +typedef u16 CSR_TRIGGER_ID; -typedef CsrUint16 CSR_TRIGGERED_ID; +typedef u16 CSR_TRIGGERED_ID; typedef enum CSR_HIP_VERSIONS { @@ -415,17 +415,17 @@ typedef enum CSR_HIP_VERSIONS CSR_HIP_VERSION = 0x0900 } CSR_HIP_VERSIONS; -typedef CsrUint16 CSR_BUFFER_HANDLE; +typedef u16 CSR_BUFFER_HANDLE; -typedef CsrUint16 CSR_CHANNEL_NUMBER; +typedef u16 CSR_CHANNEL_NUMBER; typedef struct CSR_DATA_REFERENCE { - CsrUint16 SlotNumber; - CsrUint16 DataLength; + u16 SlotNumber; + u16 DataLength; } CSR_DATAREF; -typedef CsrUint16 CSR_DIALOG_TOKEN; +typedef u16 CSR_DIALOG_TOKEN; typedef struct CSR_GENERIC_POINTER { @@ -574,11 +574,11 @@ typedef struct CSR_MLME_STOP_MEASURE_REQUEST CSR_DIALOG_TOKEN DialogToken; } CSR_MLME_STOP_MEASURE_REQUEST; -typedef CsrUint16 CSR_PROCESS_ID; +typedef u16 CSR_PROCESS_ID; -typedef CsrUint16 CSR_RATE; +typedef u16 CSR_RATE; -typedef CsrUint16 CSR_SEQUENCE_NUMBER; +typedef u16 CSR_SEQUENCE_NUMBER; typedef struct CSR_SIGNAL_PRIMITIVE_HEADER { @@ -587,9 +587,9 @@ typedef struct CSR_SIGNAL_PRIMITIVE_HEADER CSR_PROCESS_ID SenderProcessId; } CSR_SIGNAL_PRIMITIVE_HEADER; -typedef CsrUint16 CSR_TRAFFIC_WINDOW; +typedef u16 CSR_TRAFFIC_WINDOW; -typedef CsrUint16 CSR_VIF_IDENTIFIER; +typedef u16 CSR_VIF_IDENTIFIER; typedef struct CSR_DEBUG_GENERIC_CONFIRM { @@ -1416,7 +1416,7 @@ typedef struct CSR_SIGNAL_PRIMITIVE #define SIG_FILTER_SIZE 6 -CsrUint32 SigGetFilterPos(CsrUint16 aSigID); +CsrUint32 SigGetFilterPos(u16 aSigID); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_wifi_hip_ta_sampling.c b/drivers/staging/csr/csr_wifi_hip_ta_sampling.c index 7108cf0..1dabd84 100644 --- a/drivers/staging/csr/csr_wifi_hip_ta_sampling.c +++ b/drivers/staging/csr/csr_wifi_hip_ta_sampling.c @@ -97,8 +97,8 @@ static enum ta_frame_identity ta_detect_protocol(card_t *card, CsrWifiRouterCtrl const u8 *sta_macaddr) { ta_data_t *tad = &card->ta_sampling; - CsrUint16 proto; - CsrUint16 source_port, dest_port; + u16 proto; + u16 source_port, dest_port; CsrWifiMacAddress srcAddress; CsrUint32 snap_hdr, oui_hdr; @@ -347,7 +347,7 @@ void unifi_ta_sample(card_t *card, const u8 *saddr, const u8 *sta_macaddr, CsrUint32 timestamp, - CsrUint16 rate) + u16 rate) { ta_data_t *tad = &card->ta_sampling; enum ta_frame_identity identity; @@ -530,7 +530,7 @@ CsrResult unifi_ta_configure(card_t *card, */ void unifi_ta_classification(card_t *card, CsrWifiRouterCtrlTrafficType traffic_type, - CsrUint16 period) + u16 period) { unifi_trace(card->ospriv, UDBG3, "Changed current ta classification to: %d\n", traffic_type); diff --git a/drivers/staging/csr/csr_wifi_hip_ta_sampling.h b/drivers/staging/csr/csr_wifi_hip_ta_sampling.h index 602943e..7183e25 100644 --- a/drivers/staging/csr/csr_wifi_hip_ta_sampling.h +++ b/drivers/staging/csr/csr_wifi_hip_ta_sampling.h @@ -42,7 +42,7 @@ typedef struct ta_l4stats typedef struct ta_data { /* Current packet filter configuration */ - CsrUint16 packet_filter; + u16 packet_filter; /* Current packet custom filter configuration */ CsrWifiRouterCtrlTrafficFilter custom_filter; diff --git a/drivers/staging/csr/csr_wifi_hip_udi.c b/drivers/staging/csr/csr_wifi_hip_udi.c index b7c292c..72deb2f 100644 --- a/drivers/staging/csr/csr_wifi_hip_udi.c +++ b/drivers/staging/csr/csr_wifi_hip_udi.c @@ -45,7 +45,7 @@ CsrInt32 unifi_print_status(card_t *card, CsrCharString *str, CsrInt32 *remain) { CsrCharString *p = str; sdio_config_data_t *cfg; - CsrUint16 i, n; + u16 i, n; CsrInt32 remaining = *remain; CsrInt32 written; #ifdef CSR_UNSAFE_SDIO_ACCESS @@ -65,7 +65,7 @@ CsrInt32 unifi_print_status(card_t *card, CsrCharString *str, CsrInt32 *remain) i = n = 0; written = CsrSnprintf(p, remaining, "Chip ID %u\n", - (CsrUint16)card->chip_id); + (u16)card->chip_id); UNIFI_SNPRINTF_RET(p, remaining, written); written = CsrSnprintf(p, remaining, "Chip Version %04X\n", card->chip_version); @@ -107,7 +107,7 @@ CsrInt32 unifi_print_status(card_t *card, CsrCharString *str, CsrInt32 *remain) /* Added by protocol version 0x0001 */ written = CsrSnprintf(p, remaining, "overlay_size %u\n", - (CsrUint16)cfg->overlay_size); + (u16)cfg->overlay_size); UNIFI_SNPRINTF_RET(p, remaining, written); /* Added by protocol version 0x0300 */ @@ -134,16 +134,16 @@ CsrInt32 unifi_print_status(card_t *card, CsrCharString *str, CsrInt32 *remain) UNIFI_SNPRINTF_RET(p, remaining, written); written = CsrSnprintf(p, remaining, "fhsr: %u\n", - (CsrUint16)card->from_host_signals_r); + (u16)card->from_host_signals_r); UNIFI_SNPRINTF_RET(p, remaining, written); written = CsrSnprintf(p, remaining, "fhsw: %u\n", - (CsrUint16)card->from_host_signals_w); + (u16)card->from_host_signals_w); UNIFI_SNPRINTF_RET(p, remaining, written); written = CsrSnprintf(p, remaining, "thsr: %u\n", - (CsrUint16)card->to_host_signals_r); + (u16)card->to_host_signals_r); UNIFI_SNPRINTF_RET(p, remaining, written); written = CsrSnprintf(p, remaining, "thsw: %u\n", - (CsrUint16)card->to_host_signals_w); + (u16)card->to_host_signals_w); UNIFI_SNPRINTF_RET(p, remaining, written); written = CsrSnprintf(p, remaining, "fh buffer contains: %u signals, %u bytes\n", @@ -189,7 +189,7 @@ CsrInt32 unifi_print_status(card_t *card, CsrCharString *str, CsrInt32 *remain) for (i = 0; i < n && card->from_host_data; i++) { written = CsrSnprintf(p, remaining, " %u", - (CsrUint16)card->from_host_data[i].bd.data_length); + (u16)card->from_host_data[i].bd.data_length); UNIFI_SNPRINTF_RET(p, remaining, written); } written = CsrSnprintf(p, remaining, "\n"); @@ -201,7 +201,7 @@ CsrInt32 unifi_print_status(card_t *card, CsrCharString *str, CsrInt32 *remain) for (i = 0; i < n && card->to_host_data; i++) { written = CsrSnprintf(p, remaining, " %u", - (CsrUint16)card->to_host_data[i].data_length); + (u16)card->to_host_data[i].data_length); UNIFI_SNPRINTF_RET(p, remaining, written); } diff --git a/drivers/staging/csr/csr_wifi_hip_unifi.h b/drivers/staging/csr/csr_wifi_hip_unifi.h index 1fb9d76..cbe600d 100644 --- a/drivers/staging/csr/csr_wifi_hip_unifi.h +++ b/drivers/staging/csr/csr_wifi_hip_unifi.h @@ -148,7 +148,7 @@ typedef struct _bulk_data_desc /* Structure of an entry in the Symbol Look Up Table (SLUT). */ typedef struct _symbol { - CsrUint16 id; + u16 id; CsrUint32 obj; } symbol_t; @@ -194,10 +194,10 @@ typedef struct _bulk_data_param */ typedef struct _card_info { - CsrUint16 chip_id; - CsrUint16 chip_version; + u16 chip_id; + u16 chip_version; CsrUint32 fw_build; - CsrUint16 fw_hip_version; + u16 fw_hip_version; CsrUint32 sdio_block_size; } card_info_t; @@ -514,7 +514,7 @@ void unifi_ta_sample(card_t *card, const u8 *saddr, const u8 *sta_macaddr, CsrUint32 timestamp, - CsrUint16 rate); + u16 rate); /** * Notify the HIP core lib for a detected Traffic Classification. @@ -530,7 +530,7 @@ void unifi_ta_sample(card_t *card, */ void unifi_ta_classification(card_t *card, CsrWifiRouterCtrlTrafficType traffic_type, - CsrUint16 period); + u16 period); #endif /** @@ -545,9 +545,9 @@ void unifi_ta_classification(card_t *card, CsrResult unifi_card_hard_reset(card_t *card); -CsrResult unifi_card_readn(card_t *card, CsrUint32 unifi_addr, void *pdata, CsrUint16 len); -CsrResult unifi_card_read16(card_t *card, CsrUint32 unifi_addr, CsrUint16 *pdata); -CsrResult unifi_card_write16(card_t *card, CsrUint32 unifi_addr, CsrUint16 data); +CsrResult unifi_card_readn(card_t *card, CsrUint32 unifi_addr, void *pdata, u16 len); +CsrResult unifi_card_read16(card_t *card, CsrUint32 unifi_addr, u16 *pdata); +CsrResult unifi_card_write16(card_t *card, CsrUint32 unifi_addr, u16 data); enum unifi_dbg_processors_select @@ -660,15 +660,15 @@ void unifi_receive_event(void *ospriv, * @ingroup upperedge */ CsrResult unifi_reque_ma_packet_request(void *ospriv, CsrUint32 host_tag, - CsrUint16 status, + u16 status, bulk_data_desc_t *bulkDataDesc); #endif typedef struct { - CsrUint16 free_fh_sig_queue_slots[UNIFI_NO_OF_TX_QS]; - CsrUint16 free_fh_bulkdata_slots; - CsrUint16 free_fh_fw_slots; + u16 free_fh_sig_queue_slots[UNIFI_NO_OF_TX_QS]; + u16 free_fh_bulkdata_slots; + u16 free_fh_fw_slots; } unifi_HipQosInfo; void unifi_get_hip_qos_info(card_t *card, unifi_HipQosInfo *hipqosinfo); @@ -859,20 +859,20 @@ void unifi_request_max_sdio_clock(card_t *card); /* Functions to lookup bulk data command names. */ -const CsrCharString* lookup_bulkcmd_name(CsrUint16 id); +const CsrCharString* lookup_bulkcmd_name(u16 id); /* Function to log HIP's global debug buffer */ #ifdef CSR_WIFI_HIP_DEBUG_OFFLINE void unifi_debug_buf_dump(void); void unifi_debug_log_to_buf(const CsrCharString *fmt, ...); -void unifi_debug_hex_to_buf(const CsrCharString *buff, CsrUint16 length); +void unifi_debug_hex_to_buf(const CsrCharString *buff, u16 length); #endif /* Mini-coredump utility functions */ CsrResult unifi_coredump_get_value(card_t *card, struct unifi_coredump_req *req); CsrResult unifi_coredump_capture(card_t *card, struct unifi_coredump_req *req); CsrResult unifi_coredump_request_at_next_reset(card_t *card, s8 enable); -CsrResult unifi_coredump_init(card_t *card, CsrUint16 num_dump_buffers); +CsrResult unifi_coredump_init(card_t *card, u16 num_dump_buffers); void unifi_coredump_free(card_t *card); #ifdef __cplusplus diff --git a/drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c b/drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c index ee1970d..07aa954 100644 --- a/drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c +++ b/drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c @@ -29,7 +29,7 @@ static const struct sig_name Unifi_bulkcmd_names[] = { { 15, "Padding" } }; -const CsrCharString* lookup_bulkcmd_name(CsrUint16 id) +const CsrCharString* lookup_bulkcmd_name(u16 id) { if (id < 9) { diff --git a/drivers/staging/csr/csr_wifi_hip_xbv.c b/drivers/staging/csr/csr_wifi_hip_xbv.c index 8bc79aa..cc590d7 100644 --- a/drivers/staging/csr/csr_wifi_hip_xbv.c +++ b/drivers/staging/csr/csr_wifi_hip_xbv.c @@ -99,7 +99,7 @@ static CsrInt32 xbv_push(xbv1_t *fwinfo, xbv_stack_t *stack, xbv_container new_cont, CsrUint32 ioff); static CsrUint32 write_uint16(void *buf, const CsrUint32 offset, - const CsrUint16 val); + const u16 val); static CsrUint32 write_uint32(void *buf, const CsrUint32 offset, const CsrUint32 val); static CsrUint32 write_bytes(void *buf, const CsrUint32 offset, @@ -109,7 +109,7 @@ static CsrUint32 write_tag(void *buf, const CsrUint32 offset, static CsrUint32 write_chunk(void *buf, const CsrUint32 offset, const CsrCharString *tag_str, const CsrUint32 payload_len); -static CsrUint16 calc_checksum(void *buf, const CsrUint32 offset, +static u16 calc_checksum(void *buf, const CsrUint32 offset, const CsrUint32 bytes_len); static CsrUint32 calc_patch_size(const xbv1_t *fwinfo); @@ -118,7 +118,7 @@ static CsrUint32 write_xbv_header(void *buf, const CsrUint32 offset, static CsrUint32 write_ptch_header(void *buf, const CsrUint32 offset, const CsrUint32 fw_id); static CsrUint32 write_patchcmd(void *buf, const CsrUint32 offset, - const CsrUint32 dst_genaddr, const CsrUint16 len); + const CsrUint32 dst_genaddr, const u16 len); static CsrUint32 write_reset_ptdl(void *buf, const CsrUint32 offset, const xbv1_t *fwinfo, CsrUint32 fw_id); static CsrUint32 write_fwdl_to_ptdl(void *buf, const CsrUint32 offset, @@ -361,8 +361,8 @@ CsrResult xbv1_parse(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwin /* Fill in the VMEQ */ vmeq->addr = temp[0]; - vmeq->mask = (CsrUint16)temp[1]; - vmeq->value = (CsrUint16)temp[2]; + vmeq->mask = (u16)temp[1]; + vmeq->value = (u16)temp[2]; } else if (TAG_EQ(tag.t_name, "FWID")) { @@ -568,19 +568,19 @@ static CsrInt32 read_uint(card_t *card, ct_t *ct, CsrUint32 *u, CsrUint32 len) } /* read_uint() */ -static CsrUint32 write_uint16(void *buf, const CsrUint32 offset, const CsrUint16 val) +static CsrUint32 write_uint16(void *buf, const CsrUint32 offset, const u16 val) { u8 *dst = (u8 *)buf + offset; *dst++ = (u8)(val & 0xff); /* LSB first */ *dst = (u8)(val >> 8); - return sizeof(CsrUint16); + return sizeof(u16); } static CsrUint32 write_uint32(void *buf, const CsrUint32 offset, const CsrUint32 val) { - (void)write_uint16(buf, offset + 0, (CsrUint16)(val & 0xffff)); - (void)write_uint16(buf, offset + 2, (CsrUint16)(val >> 16)); + (void)write_uint16(buf, offset + 0, (u16)(val & 0xffff)); + (void)write_uint16(buf, offset + 2, (u16)(val >> 16)); return sizeof(CsrUint32); } @@ -616,18 +616,18 @@ static CsrUint32 write_chunk(void *buf, const CsrUint32 offset, const CsrCharStr } -static CsrUint16 calc_checksum(void *buf, const CsrUint32 offset, const CsrUint32 bytes_len) +static u16 calc_checksum(void *buf, const CsrUint32 offset, const CsrUint32 bytes_len) { CsrUint32 i; u8 *src = (u8 *)buf + offset; - CsrUint16 sum = 0; - CsrUint16 val; + u16 sum = 0; + u16 val; for (i = 0; i < bytes_len / 2; i++) { /* Contents copied to file is LE, host might not be */ - val = (CsrUint16) * src++; /* LSB */ - val += (CsrUint16)(*src++) << 8; /* MSB */ + val = (u16) * src++; /* LSB */ + val += (u16)(*src++) << 8; /* MSB */ sum += val; } @@ -711,11 +711,11 @@ static CsrUint32 write_ptch_header(void *buf, const CsrUint32 offset, const CsrU #define UF_MEMPUT_MAC 0x0000 #define UF_MEMPUT_PHY 0x1000 -static CsrUint32 write_patchcmd(void *buf, const CsrUint32 offset, const CsrUint32 dst_genaddr, const CsrUint16 len) +static CsrUint32 write_patchcmd(void *buf, const CsrUint32 offset, const CsrUint32 dst_genaddr, const u16 len) { CsrUint32 written = 0; CsrUint32 region = (dst_genaddr >> 28); - CsrUint16 cmd_and_len = UF_MEMPUT_MAC; + u16 cmd_and_len = UF_MEMPUT_MAC; if (region == UF_REGION_PHY) { @@ -731,8 +731,8 @@ static CsrUint32 write_patchcmd(void *buf, const CsrUint32 offset, const CsrUint written += write_uint16(buf, offset + written, cmd_and_len); /* Write the destination generic address */ - written += write_uint16(buf, offset + written, (CsrUint16)(dst_genaddr >> 16)); - written += write_uint16(buf, offset + written, (CsrUint16)(dst_genaddr & 0xffff)); + written += write_uint16(buf, offset + written, (u16)(dst_genaddr >> 16)); + written += write_uint16(buf, offset + written, (u16)(dst_genaddr & 0xffff)); /* The data payload should be appended to the command */ return written; @@ -748,7 +748,7 @@ static CsrUint32 write_fwdl_to_ptdl(void *buf, const CsrUint32 offset, fwreadfn_ CsrUint32 left = fwdl->dl_size; /* Bytes left in this fwdl */ CsrUint32 dl_addr = fwdl->dl_addr; /* Target address of fwdl image on XAP */ CsrUint32 dl_offs = fwdl->dl_offset; /* Offset of fwdl image data in source */ - CsrUint16 csum; + u16 csum; CsrUint32 csum_start_offs; /* first offset to include in checksum */ CsrUint32 sec_data_len; /* section data byte count */ CsrUint32 sec_len; /* section data + header byte count */ @@ -768,15 +768,15 @@ static CsrUint32 write_fwdl_to_ptdl(void *buf, const CsrUint32 offset, fwreadfn_ csum_start_offs = offset + written; /* Patch-chunk header: fw_id. Note that this is in XAP word order */ - written += write_uint16(buf, offset + written, (CsrUint16)(fw_id >> 16)); - written += write_uint16(buf, offset + written, (CsrUint16)(fw_id & 0xffff)); + written += write_uint16(buf, offset + written, (u16)(fw_id >> 16)); + written += write_uint16(buf, offset + written, (u16)(fw_id & 0xffff)); /* Patch-chunk header: section length in uint16s */ - written += write_uint16(buf, offset + written, (CsrUint16)(sec_len / 2)); + written += write_uint16(buf, offset + written, (u16)(sec_len / 2)); /* Write the appropriate patch command for the data's destination ptr */ - written += write_patchcmd(buf, offset + written, dl_addr, (CsrUint16)(sec_data_len / 2)); + written += write_patchcmd(buf, offset + written, dl_addr, (u16)(sec_data_len / 2)); /* Write the data itself (limited to the max chunk length) */ if (readfn(NULL, (void *)dlpriv, dl_offs, fw_buf, sec_data_len) < 0) @@ -789,7 +789,7 @@ static CsrUint32 write_fwdl_to_ptdl(void *buf, const CsrUint32 offset, fwreadfn_ fw_buf, sec_data_len); - /* CsrUint16 checksum calculated over data written */ + /* u16 checksum calculated over data written */ csum = calc_checksum(buf, csum_start_offs, written - (csum_start_offs - offset)); written += write_uint16(buf, offset + written, csum); @@ -813,7 +813,7 @@ static CsrUint32 write_fwdl_to_ptdl(void *buf, const CsrUint32 offset, fwreadfn_ static CsrUint32 write_reset_ptdl(void *buf, const CsrUint32 offset, const xbv1_t *fwinfo, CsrUint32 fw_id) { CsrUint32 written = 0; - CsrUint16 csum; + u16 csum; CsrUint32 csum_start_offs; /* first offset to include in checksum */ CsrUint32 sec_len; /* section data + header byte count */ @@ -826,11 +826,11 @@ static CsrUint32 write_reset_ptdl(void *buf, const CsrUint32 offset, const xbv1_ csum_start_offs = offset + written; /* Patch-chunk header: fw_id. Note that this is in XAP word order */ - written += write_uint16(buf, offset + written, (CsrUint16)(fw_id >> 16)); - written += write_uint16(buf, offset + written, (CsrUint16)(fw_id & 0xffff)); + written += write_uint16(buf, offset + written, (u16)(fw_id >> 16)); + written += write_uint16(buf, offset + written, (u16)(fw_id & 0xffff)); /* Patch-chunk header: section length in uint16s */ - written += write_uint16(buf, offset + written, (CsrUint16)(sec_len / 2)); + written += write_uint16(buf, offset + written, (u16)(sec_len / 2)); /* * Restart addresses to be executed on subsequent loader restart command. @@ -846,7 +846,7 @@ static CsrUint32 write_reset_ptdl(void *buf, const CsrUint32 offset, const xbv1_ written += write_uint16(buf, offset + written, (UF_PHY_START_VEC >> 16)); written += write_uint16(buf, offset + written, (UF_PHY_START_VEC & 0xffff)); - /* CsrUint16 checksum calculated over data written */ + /* u16 checksum calculated over data written */ csum = calc_checksum(buf, csum_start_offs, written - (csum_start_offs - offset)); written += write_uint16(buf, offset + written, csum); @@ -936,7 +936,7 @@ CsrInt32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *f return -1; } - slut[count].id = (CsrUint16)id; + slut[count].id = (u16)id; slut[count].obj = obj; count++; } diff --git a/drivers/staging/csr/csr_wifi_hip_xbv.h b/drivers/staging/csr/csr_wifi_hip_xbv.h index fdc4560..f5c3e80 100644 --- a/drivers/staging/csr/csr_wifi_hip_xbv.h +++ b/drivers/staging/csr/csr_wifi_hip_xbv.h @@ -34,8 +34,8 @@ extern "C" { struct VMEQ { CsrUint32 addr; - CsrUint16 mask; - CsrUint16 value; + u16 mask; + u16 value; }; struct VAND diff --git a/drivers/staging/csr/csr_wifi_lib.h b/drivers/staging/csr/csr_wifi_lib.h index e1ef72b..540d93c 100644 --- a/drivers/staging/csr/csr_wifi_lib.h +++ b/drivers/staging/csr/csr_wifi_lib.h @@ -39,7 +39,7 @@ extern "C" { * Allocates and fills in a message with the signature CsrWifiEvent * *----------------------------------------------------------------------------*/ -CsrWifiFsmEvent* CsrWifiEvent_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrSchedQid dst, CsrSchedQid src); +CsrWifiFsmEvent* CsrWifiEvent_struct(u16 primtype, u16 msgtype, CsrSchedQid dst, CsrSchedQid src); typedef struct { @@ -55,12 +55,12 @@ typedef struct * Allocates and fills in a message with the signature CsrWifiEventCsrUint8 * *----------------------------------------------------------------------------*/ -CsrWifiEventCsrUint8* CsrWifiEventCsrUint8_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrSchedQid dst, CsrSchedQid src, u8 value); +CsrWifiEventCsrUint8* CsrWifiEventCsrUint8_struct(u16 primtype, u16 msgtype, CsrSchedQid dst, CsrSchedQid src, u8 value); typedef struct { CsrWifiFsmEvent common; - CsrUint16 value; + u16 value; } CsrWifiEventCsrUint16; /*----------------------------------------------------------------------------* @@ -71,7 +71,7 @@ typedef struct * Allocates and fills in a message with the signature CsrWifiEventCsrUint16 * *----------------------------------------------------------------------------*/ -CsrWifiEventCsrUint16* CsrWifiEventCsrUint16_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrSchedQid dst, CsrSchedQid src, CsrUint16 value); +CsrWifiEventCsrUint16* CsrWifiEventCsrUint16_struct(u16 primtype, u16 msgtype, CsrSchedQid dst, CsrSchedQid src, u16 value); typedef struct { @@ -87,12 +87,12 @@ typedef struct * Allocates and fills in a message with the signature CsrWifiEventCsrUint32 * *----------------------------------------------------------------------------*/ -CsrWifiEventCsrUint32* CsrWifiEventCsrUint32_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrSchedQid dst, CsrSchedQid src, CsrUint32 value); +CsrWifiEventCsrUint32* CsrWifiEventCsrUint32_struct(u16 primtype, u16 msgtype, CsrSchedQid dst, CsrSchedQid src, CsrUint32 value); typedef struct { CsrWifiFsmEvent common; - CsrUint16 value16; + u16 value16; u8 value8; } CsrWifiEventCsrUint16CsrUint8; @@ -104,7 +104,7 @@ typedef struct * Allocates and fills in a message with the signature CsrWifiEventCsrUint16CsrUint8 * *----------------------------------------------------------------------------*/ -CsrWifiEventCsrUint16CsrUint8* CsrWifiEventCsrUint16CsrUint8_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrSchedQid dst, CsrSchedQid src, CsrUint16 value16, u8 value8); +CsrWifiEventCsrUint16CsrUint8* CsrWifiEventCsrUint16CsrUint8_struct(u16 primtype, u16 msgtype, CsrSchedQid dst, CsrSchedQid src, u16 value16, u8 value8); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_wifi_msgconv.h b/drivers/staging/csr/csr_wifi_msgconv.h index 6029a21..72da857 100644 --- a/drivers/staging/csr/csr_wifi_msgconv.h +++ b/drivers/staging/csr/csr_wifi_msgconv.h @@ -21,11 +21,11 @@ extern "C" { #endif -void CsrUint16SerBigEndian(u8 *ptr, CsrSize *len, CsrUint16 v); +void CsrUint16SerBigEndian(u8 *ptr, CsrSize *len, u16 v); void CsrUint24SerBigEndian(u8 *ptr, CsrSize *len, CsrUint32 v); void CsrUint32SerBigEndian(u8 *ptr, CsrSize *len, CsrUint32 v); -void CsrUint16DesBigEndian(CsrUint16 *v, u8 *buffer, CsrSize *offset); +void CsrUint16DesBigEndian(u16 *v, u8 *buffer, CsrSize *offset); void CsrUint24DesBigEndian(CsrUint32 *v, u8 *buffer, CsrSize *offset); void CsrUint32DesBigEndian(CsrUint32 *v, u8 *buffer, CsrSize *offset); diff --git a/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c b/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c index 83b3727..3757409 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c +++ b/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c @@ -43,11 +43,11 @@ static CsrMsgConvMsgEntry csrwifinmeap_conv_lut[] = { { 0, NULL, NULL, NULL, NULL }, }; -CsrMsgConvMsgEntry* CsrWifiNmeApConverterLookup(CsrMsgConvMsgEntry *ce, CsrUint16 msgType) +CsrMsgConvMsgEntry* CsrWifiNmeApConverterLookup(CsrMsgConvMsgEntry *ce, u16 msgType) { if (msgType & CSR_PRIM_UPSTREAM) { - CsrUint16 idx = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_COUNT; + u16 idx = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_COUNT; if (idx < (CSR_WIFI_NME_AP_PRIM_UPSTREAM_COUNT + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_COUNT) && csrwifinmeap_conv_lut[idx].msgType == msgType) { diff --git a/drivers/staging/csr/csr_wifi_nme_ap_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_nme_ap_free_downstream_contents.c index 8a95f3c..6812396 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_free_downstream_contents.c +++ b/drivers/staging/csr/csr_wifi_nme_ap_free_downstream_contents.c @@ -25,7 +25,7 @@ * eventClass: only the value CSR_WIFI_NME_AP_PRIM will be handled * message: the message to free *----------------------------------------------------------------------------*/ -void CsrWifiNmeApFreeDownstreamMessageContents(CsrUint16 eventClass, void *message) +void CsrWifiNmeApFreeDownstreamMessageContents(u16 eventClass, void *message) { if (eventClass != CSR_WIFI_NME_AP_PRIM) { @@ -65,7 +65,7 @@ void CsrWifiNmeApFreeDownstreamMessageContents(CsrUint16 eventClass, void *messa break; } { - CsrUint16 i3; + u16 i3; for (i3 = 0; i3 < p->p2pGoParam.operatingChanList.channelEntryListCount; i3++) { CsrPmemFree(p->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel); diff --git a/drivers/staging/csr/csr_wifi_nme_ap_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_nme_ap_free_upstream_contents.c index 7740dc3..d9ebce3 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_free_upstream_contents.c +++ b/drivers/staging/csr/csr_wifi_nme_ap_free_upstream_contents.c @@ -25,7 +25,7 @@ * eventClass: only the value CSR_WIFI_NME_AP_PRIM will be handled * message: the message to free *----------------------------------------------------------------------------*/ -void CsrWifiNmeApFreeUpstreamMessageContents(CsrUint16 eventClass, void *message) +void CsrWifiNmeApFreeUpstreamMessageContents(u16 eventClass, void *message) { if (eventClass != CSR_WIFI_NME_AP_PRIM) { diff --git a/drivers/staging/csr/csr_wifi_nme_ap_lib.h b/drivers/staging/csr/csr_wifi_nme_ap_lib.h index 2deebdb..4523065 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_lib.h +++ b/drivers/staging/csr/csr_wifi_nme_ap_lib.h @@ -46,7 +46,7 @@ extern "C" { * PARAMETERS * Deallocates the resources in a CSR_WIFI_NME_AP upstream message *----------------------------------------------------------------------------*/ -void CsrWifiNmeApFreeUpstreamMessageContents(CsrUint16 eventClass, void *message); +void CsrWifiNmeApFreeUpstreamMessageContents(u16 eventClass, void *message); /*----------------------------------------------------------------------------* * CsrWifiNmeApFreeDownstreamMessageContents @@ -58,7 +58,7 @@ void CsrWifiNmeApFreeUpstreamMessageContents(CsrUint16 eventClass, void *message * PARAMETERS * Deallocates the resources in a CSR_WIFI_NME_AP downstream message *----------------------------------------------------------------------------*/ -void CsrWifiNmeApFreeDownstreamMessageContents(CsrUint16 eventClass, void *message); +void CsrWifiNmeApFreeDownstreamMessageContents(u16 eventClass, void *message); /*----------------------------------------------------------------------------* * Enum to string functions diff --git a/drivers/staging/csr/csr_wifi_nme_ap_prim.h b/drivers/staging/csr/csr_wifi_nme_ap_prim.h index 5e08d53..616a899 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_prim.h +++ b/drivers/staging/csr/csr_wifi_nme_ap_prim.h @@ -77,10 +77,10 @@ typedef u8 CsrWifiNmeApPersCredentialType; *******************************************************************************/ typedef struct { - CsrUint16 apGroupkeyTimeout; + u16 apGroupkeyTimeout; CsrBool apStrictGtkRekey; - CsrUint16 apGmkTimeout; - CsrUint16 apResponseTimeout; + u16 apGmkTimeout; + u16 apResponseTimeout; u8 apRetransLimit; } CsrWifiNmeApConfig; @@ -222,7 +222,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeWpsDpid selectedDevicePasswordId; CsrWifiSmeWpsConfigType selectedConfigMethod; u8 pin[8]; @@ -254,7 +254,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeApType apType; CsrBool cloakSsid; CsrWifiSsid ssid; @@ -282,7 +282,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; } CsrWifiNmeApStopReq; /******************************************************************************* @@ -332,7 +332,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiMacAddress staMacAddress; CsrBool keepBlocking; } CsrWifiNmeApStaRemoveReq; @@ -373,7 +373,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; } CsrWifiNmeApWpsRegisterCfm; @@ -395,7 +395,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; CsrWifiSsid ssid; } CsrWifiNmeApStartCfm; @@ -419,7 +419,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; } CsrWifiNmeApStopCfm; @@ -443,7 +443,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeApType apType; CsrResult status; } CsrWifiNmeApStopInd; @@ -488,7 +488,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeMediaStatus mediaStatus; CsrWifiMacAddress peerMacAddress; CsrWifiMacAddress peerDeviceAddress; diff --git a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c index cdf33a6..b79b8e8 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c +++ b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c @@ -32,15 +32,15 @@ CsrSize CsrWifiNmeApConfigSetReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 104) */ - bufferSize += 2; /* CsrUint16 primitive->apConfig.apGroupkeyTimeout */ + bufferSize += 2; /* u16 primitive->apConfig.apGroupkeyTimeout */ bufferSize += 1; /* CsrBool primitive->apConfig.apStrictGtkRekey */ - bufferSize += 2; /* CsrUint16 primitive->apConfig.apGmkTimeout */ - bufferSize += 2; /* CsrUint16 primitive->apConfig.apResponseTimeout */ + bufferSize += 2; /* u16 primitive->apConfig.apGmkTimeout */ + bufferSize += 2; /* u16 primitive->apConfig.apResponseTimeout */ bufferSize += 1; /* u8 primitive->apConfig.apRetransLimit */ bufferSize += 1; /* CsrWifiSmeApPhySupportMask primitive->apMacConfig.phySupportedBitmap */ - bufferSize += 2; /* CsrUint16 primitive->apMacConfig.beaconInterval */ + bufferSize += 2; /* u16 primitive->apMacConfig.beaconInterval */ bufferSize += 1; /* u8 primitive->apMacConfig.dtimPeriod */ - bufferSize += 2; /* CsrUint16 primitive->apMacConfig.maxListenInterval */ + bufferSize += 2; /* u16 primitive->apMacConfig.maxListenInterval */ bufferSize += 1; /* u8 primitive->apMacConfig.supportedRatesCount */ bufferSize += 20; /* u8 primitive->apMacConfig.supportedRates[20] */ bufferSize += 1; /* CsrWifiSmePreambleType primitive->apMacConfig.preamble */ @@ -48,31 +48,31 @@ CsrSize CsrWifiNmeApConfigSetReqSizeof(void *msg) bufferSize += 1; /* CsrWifiSmeCtsProtectionType primitive->apMacConfig.ctsProtectionType */ bufferSize += 1; /* CsrBool primitive->apMacConfig.wmmEnabled */ { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 4; i2++) { bufferSize += 1; /* u8 primitive->apMacConfig.wmmApParams[i2].cwMin */ bufferSize += 1; /* u8 primitive->apMacConfig.wmmApParams[i2].cwMax */ bufferSize += 1; /* u8 primitive->apMacConfig.wmmApParams[i2].aifs */ - bufferSize += 2; /* CsrUint16 primitive->apMacConfig.wmmApParams[i2].txopLimit */ + bufferSize += 2; /* u16 primitive->apMacConfig.wmmApParams[i2].txopLimit */ bufferSize += 1; /* CsrBool primitive->apMacConfig.wmmApParams[i2].admissionControlMandatory */ } } { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 4; i2++) { bufferSize += 1; /* u8 primitive->apMacConfig.wmmApBcParams[i2].cwMin */ bufferSize += 1; /* u8 primitive->apMacConfig.wmmApBcParams[i2].cwMax */ bufferSize += 1; /* u8 primitive->apMacConfig.wmmApBcParams[i2].aifs */ - bufferSize += 2; /* CsrUint16 primitive->apMacConfig.wmmApBcParams[i2].txopLimit */ + bufferSize += 2; /* u16 primitive->apMacConfig.wmmApBcParams[i2].txopLimit */ bufferSize += 1; /* CsrBool primitive->apMacConfig.wmmApBcParams[i2].admissionControlMandatory */ } } bufferSize += 1; /* CsrWifiSmeApAccessType primitive->apMacConfig.accessType */ bufferSize += 1; /* u8 primitive->apMacConfig.macAddressListCount */ { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < primitive->apMacConfig.macAddressListCount; i2++) { bufferSize += 6; /* u8 primitive->apMacConfig.macAddressList[i2].a[6] */ @@ -93,50 +93,50 @@ u8* CsrWifiNmeApConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiNmeApConfigSetReq *primitive = (CsrWifiNmeApConfigSetReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->apConfig.apGroupkeyTimeout); + CsrUint16Ser(ptr, len, (u16) primitive->apConfig.apGroupkeyTimeout); CsrUint8Ser(ptr, len, (u8) primitive->apConfig.apStrictGtkRekey); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->apConfig.apGmkTimeout); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->apConfig.apResponseTimeout); + CsrUint16Ser(ptr, len, (u16) primitive->apConfig.apGmkTimeout); + CsrUint16Ser(ptr, len, (u16) primitive->apConfig.apResponseTimeout); CsrUint8Ser(ptr, len, (u8) primitive->apConfig.apRetransLimit); CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.phySupportedBitmap); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->apMacConfig.beaconInterval); + CsrUint16Ser(ptr, len, (u16) primitive->apMacConfig.beaconInterval); CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.dtimPeriod); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->apMacConfig.maxListenInterval); + CsrUint16Ser(ptr, len, (u16) primitive->apMacConfig.maxListenInterval); CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.supportedRatesCount); - CsrMemCpySer(ptr, len, (const void *) primitive->apMacConfig.supportedRates, ((CsrUint16) (20))); + CsrMemCpySer(ptr, len, (const void *) primitive->apMacConfig.supportedRates, ((u16) (20))); CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.preamble); CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.shortSlotTimeEnabled); CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.ctsProtectionType); CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmEnabled); { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 4; i2++) { CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApParams[i2].cwMin); CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApParams[i2].cwMax); CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApParams[i2].aifs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->apMacConfig.wmmApParams[i2].txopLimit); + CsrUint16Ser(ptr, len, (u16) primitive->apMacConfig.wmmApParams[i2].txopLimit); CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApParams[i2].admissionControlMandatory); } } { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 4; i2++) { CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApBcParams[i2].cwMin); CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApBcParams[i2].cwMax); CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApBcParams[i2].aifs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->apMacConfig.wmmApBcParams[i2].txopLimit); + CsrUint16Ser(ptr, len, (u16) primitive->apMacConfig.wmmApBcParams[i2].txopLimit); CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApBcParams[i2].admissionControlMandatory); } } CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.accessType); CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.macAddressListCount); { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < primitive->apMacConfig.macAddressListCount; i2++) { - CsrMemCpySer(ptr, len, (const void *) primitive->apMacConfig.macAddressList[i2].a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->apMacConfig.macAddressList[i2].a, ((u16) (6))); } } CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.greenfieldSupported); @@ -156,40 +156,40 @@ void* CsrWifiNmeApConfigSetReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->apConfig.apGroupkeyTimeout, buffer, &offset); + CsrUint16Des((u16 *) &primitive->apConfig.apGroupkeyTimeout, buffer, &offset); CsrUint8Des((u8 *) &primitive->apConfig.apStrictGtkRekey, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->apConfig.apGmkTimeout, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->apConfig.apResponseTimeout, buffer, &offset); + CsrUint16Des((u16 *) &primitive->apConfig.apGmkTimeout, buffer, &offset); + CsrUint16Des((u16 *) &primitive->apConfig.apResponseTimeout, buffer, &offset); CsrUint8Des((u8 *) &primitive->apConfig.apRetransLimit, buffer, &offset); CsrUint8Des((u8 *) &primitive->apMacConfig.phySupportedBitmap, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->apMacConfig.beaconInterval, buffer, &offset); + CsrUint16Des((u16 *) &primitive->apMacConfig.beaconInterval, buffer, &offset); CsrUint8Des((u8 *) &primitive->apMacConfig.dtimPeriod, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->apMacConfig.maxListenInterval, buffer, &offset); + CsrUint16Des((u16 *) &primitive->apMacConfig.maxListenInterval, buffer, &offset); CsrUint8Des((u8 *) &primitive->apMacConfig.supportedRatesCount, buffer, &offset); - CsrMemCpyDes(primitive->apMacConfig.supportedRates, buffer, &offset, ((CsrUint16) (20))); + CsrMemCpyDes(primitive->apMacConfig.supportedRates, buffer, &offset, ((u16) (20))); CsrUint8Des((u8 *) &primitive->apMacConfig.preamble, buffer, &offset); CsrUint8Des((u8 *) &primitive->apMacConfig.shortSlotTimeEnabled, buffer, &offset); CsrUint8Des((u8 *) &primitive->apMacConfig.ctsProtectionType, buffer, &offset); CsrUint8Des((u8 *) &primitive->apMacConfig.wmmEnabled, buffer, &offset); { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 4; i2++) { CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApParams[i2].cwMin, buffer, &offset); CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApParams[i2].cwMax, buffer, &offset); CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApParams[i2].aifs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->apMacConfig.wmmApParams[i2].txopLimit, buffer, &offset); + CsrUint16Des((u16 *) &primitive->apMacConfig.wmmApParams[i2].txopLimit, buffer, &offset); CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApParams[i2].admissionControlMandatory, buffer, &offset); } } { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 4; i2++) { CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApBcParams[i2].cwMin, buffer, &offset); CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApBcParams[i2].cwMax, buffer, &offset); CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApBcParams[i2].aifs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->apMacConfig.wmmApBcParams[i2].txopLimit, buffer, &offset); + CsrUint16Des((u16 *) &primitive->apMacConfig.wmmApBcParams[i2].txopLimit, buffer, &offset); CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApBcParams[i2].admissionControlMandatory, buffer, &offset); } } @@ -201,10 +201,10 @@ void* CsrWifiNmeApConfigSetReqDes(u8 *buffer, CsrSize length) primitive->apMacConfig.macAddressList = (CsrWifiMacAddress *)CsrPmemAlloc(sizeof(CsrWifiMacAddress) * primitive->apMacConfig.macAddressListCount); } { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < primitive->apMacConfig.macAddressListCount; i2++) { - CsrMemCpyDes(primitive->apMacConfig.macAddressList[i2].a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->apMacConfig.macAddressList[i2].a, buffer, &offset, ((u16) (6))); } } CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.greenfieldSupported, buffer, &offset); @@ -231,7 +231,7 @@ CsrSize CsrWifiNmeApWpsRegisterReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiSmeWpsDpid primitive->selectedDevicePasswordId */ bufferSize += 2; /* CsrWifiSmeWpsConfigType primitive->selectedConfigMethod */ bufferSize += 8; /* u8 primitive->pin[8] */ @@ -244,10 +244,10 @@ u8* CsrWifiNmeApWpsRegisterReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiNmeApWpsRegisterReq *primitive = (CsrWifiNmeApWpsRegisterReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->selectedDevicePasswordId); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->selectedConfigMethod); - CsrMemCpySer(ptr, len, (const void *) primitive->pin, ((CsrUint16) (8))); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->selectedDevicePasswordId); + CsrUint16Ser(ptr, len, (u16) primitive->selectedConfigMethod); + CsrMemCpySer(ptr, len, (const void *) primitive->pin, ((u16) (8))); return(ptr); } @@ -259,10 +259,10 @@ void* CsrWifiNmeApWpsRegisterReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->selectedDevicePasswordId, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->selectedConfigMethod, buffer, &offset); - CsrMemCpyDes(primitive->pin, buffer, &offset, ((CsrUint16) (8))); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->selectedDevicePasswordId, buffer, &offset); + CsrUint16Des((u16 *) &primitive->selectedConfigMethod, buffer, &offset); + CsrMemCpyDes(primitive->pin, buffer, &offset, ((u16) (8))); return primitive; } @@ -274,7 +274,7 @@ CsrSize CsrWifiNmeApStartReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 112) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiSmeApType primitive->apType */ bufferSize += 1; /* CsrBool primitive->cloakSsid */ bufferSize += 32; /* u8 primitive->ssid.ssid[32] */ @@ -319,11 +319,11 @@ CsrSize CsrWifiNmeApStartReqSizeof(void *msg) switch (primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase) { case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK: - bufferSize += 2; /* CsrUint16 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.encryptionMode */ + bufferSize += 2; /* u16 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.encryptionMode */ bufferSize += 32; /* u8 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.psk[32] */ break; case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: - bufferSize += 2; /* CsrUint16 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.encryptionMode */ + bufferSize += 2; /* u16 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.encryptionMode */ bufferSize += (primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase?CsrStrLen(primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase) : 0) + 1; /* CsrCharString* primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase (0 byte len + 1 for NULL Term) */ break; default: @@ -338,7 +338,7 @@ CsrSize CsrWifiNmeApStartReqSizeof(void *msg) bufferSize += 3; /* u8 primitive->p2pGoParam.operatingChanList.country[3] */ bufferSize += 1; /* u8 primitive->p2pGoParam.operatingChanList.channelEntryListCount */ { - CsrUint16 i3; + u16 i3; for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++) { bufferSize += 1; /* u8 primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingClass */ @@ -360,10 +360,10 @@ u8* CsrWifiNmeApStartReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiNmeApStartReq *primitive = (CsrWifiNmeApStartReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->apType); CsrUint8Ser(ptr, len, (u8) primitive->cloakSsid); - CsrMemCpySer(ptr, len, (const void *) primitive->ssid.ssid, ((CsrUint16) (32))); + CsrMemCpySer(ptr, len, (const void *) primitive->ssid.ssid, ((u16) (32))); CsrUint8Ser(ptr, len, (u8) primitive->ssid.length); CsrUint8Ser(ptr, len, (u8) primitive->ifIndex); CsrUint8Ser(ptr, len, (u8) primitive->channel); @@ -380,18 +380,18 @@ u8* CsrWifiNmeApStartReqSer(u8 *ptr, CsrSize *len, void *msg) case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128: CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.wepAuthType); CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.selectedWepKey); - CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key1, ((CsrUint16) (13))); - CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key2, ((CsrUint16) (13))); - CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key3, ((CsrUint16) (13))); - CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key4, ((CsrUint16) (13))); + CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key1, ((u16) (13))); + CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key2, ((u16) (13))); + CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key3, ((u16) (13))); + CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key4, ((u16) (13))); break; case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64: CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.wepAuthType); CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.selectedWepKey); - CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key1, ((CsrUint16) (5))); - CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key2, ((CsrUint16) (5))); - CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key3, ((CsrUint16) (5))); - CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key4, ((CsrUint16) (5))); + CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key1, ((u16) (5))); + CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key2, ((u16) (5))); + CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key3, ((u16) (5))); + CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key4, ((u16) (5))); break; default: break; @@ -399,17 +399,17 @@ u8* CsrWifiNmeApStartReqSer(u8 *ptr, CsrSize *len, void *msg) break; case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL: CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authTypePersonal.authSupport); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->apCredentials.nmeAuthType.authTypePersonal.rsnCapabilities); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->apCredentials.nmeAuthType.authTypePersonal.wapiCapabilities); + CsrUint16Ser(ptr, len, (u16) primitive->apCredentials.nmeAuthType.authTypePersonal.rsnCapabilities); + CsrUint16Ser(ptr, len, (u16) primitive->apCredentials.nmeAuthType.authTypePersonal.wapiCapabilities); CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase); switch (primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase) { case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK: - CsrUint16Ser(ptr, len, (CsrUint16) primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.encryptionMode); - CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.psk, ((CsrUint16) (32))); + CsrUint16Ser(ptr, len, (u16) primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.encryptionMode); + CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.psk, ((u16) (32))); break; case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: - CsrUint16Ser(ptr, len, (CsrUint16) primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.encryptionMode); + CsrUint16Ser(ptr, len, (u16) primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.encryptionMode); CsrCharStringSer(ptr, len, primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase); break; default: @@ -421,17 +421,17 @@ u8* CsrWifiNmeApStartReqSer(u8 *ptr, CsrSize *len, void *msg) } CsrUint8Ser(ptr, len, (u8) primitive->maxConnections); CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.groupCapability); - CsrMemCpySer(ptr, len, (const void *) primitive->p2pGoParam.operatingChanList.country, ((CsrUint16) (3))); + CsrMemCpySer(ptr, len, (const void *) primitive->p2pGoParam.operatingChanList.country, ((u16) (3))); CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.operatingChanList.channelEntryListCount); { - CsrUint16 i3; + u16 i3; for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++) { CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingClass); CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount); if (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount) { - CsrMemCpySer(ptr, len, (const void *) primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel, ((CsrUint16) (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount))); + CsrMemCpySer(ptr, len, (const void *) primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel, ((u16) (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount))); } } } @@ -451,10 +451,10 @@ void* CsrWifiNmeApStartReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->apType, buffer, &offset); CsrUint8Des((u8 *) &primitive->cloakSsid, buffer, &offset); - CsrMemCpyDes(primitive->ssid.ssid, buffer, &offset, ((CsrUint16) (32))); + CsrMemCpyDes(primitive->ssid.ssid, buffer, &offset, ((u16) (32))); CsrUint8Des((u8 *) &primitive->ssid.length, buffer, &offset); CsrUint8Des((u8 *) &primitive->ifIndex, buffer, &offset); CsrUint8Des((u8 *) &primitive->channel, buffer, &offset); @@ -471,18 +471,18 @@ void* CsrWifiNmeApStartReqDes(u8 *buffer, CsrSize length) case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128: CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.wepAuthType, buffer, &offset); CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.selectedWepKey, buffer, &offset); - CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key1, buffer, &offset, ((CsrUint16) (13))); - CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key2, buffer, &offset, ((CsrUint16) (13))); - CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key3, buffer, &offset, ((CsrUint16) (13))); - CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key4, buffer, &offset, ((CsrUint16) (13))); + CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key1, buffer, &offset, ((u16) (13))); + CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key2, buffer, &offset, ((u16) (13))); + CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key3, buffer, &offset, ((u16) (13))); + CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key4, buffer, &offset, ((u16) (13))); break; case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64: CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.wepAuthType, buffer, &offset); CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.selectedWepKey, buffer, &offset); - CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key1, buffer, &offset, ((CsrUint16) (5))); - CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key2, buffer, &offset, ((CsrUint16) (5))); - CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key3, buffer, &offset, ((CsrUint16) (5))); - CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key4, buffer, &offset, ((CsrUint16) (5))); + CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key1, buffer, &offset, ((u16) (5))); + CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key2, buffer, &offset, ((u16) (5))); + CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key3, buffer, &offset, ((u16) (5))); + CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key4, buffer, &offset, ((u16) (5))); break; default: break; @@ -490,17 +490,17 @@ void* CsrWifiNmeApStartReqDes(u8 *buffer, CsrSize length) break; case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL: CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.authSupport, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.rsnCapabilities, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.wapiCapabilities, buffer, &offset); + CsrUint16Des((u16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.rsnCapabilities, buffer, &offset); + CsrUint16Des((u16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.wapiCapabilities, buffer, &offset); CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase, buffer, &offset); switch (primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase) { case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK: - CsrUint16Des((CsrUint16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.encryptionMode, buffer, &offset); - CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.psk, buffer, &offset, ((CsrUint16) (32))); + CsrUint16Des((u16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.encryptionMode, buffer, &offset); + CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.psk, buffer, &offset, ((u16) (32))); break; case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: - CsrUint16Des((CsrUint16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.encryptionMode, buffer, &offset); + CsrUint16Des((u16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.encryptionMode, buffer, &offset); CsrCharStringDes(&primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase, buffer, &offset); break; default: @@ -512,7 +512,7 @@ void* CsrWifiNmeApStartReqDes(u8 *buffer, CsrSize length) } CsrUint8Des((u8 *) &primitive->maxConnections, buffer, &offset); CsrUint8Des((u8 *) &primitive->p2pGoParam.groupCapability, buffer, &offset); - CsrMemCpyDes(primitive->p2pGoParam.operatingChanList.country, buffer, &offset, ((CsrUint16) (3))); + CsrMemCpyDes(primitive->p2pGoParam.operatingChanList.country, buffer, &offset, ((u16) (3))); CsrUint8Des((u8 *) &primitive->p2pGoParam.operatingChanList.channelEntryListCount, buffer, &offset); primitive->p2pGoParam.operatingChanList.channelEntryList = NULL; if (primitive->p2pGoParam.operatingChanList.channelEntryListCount) @@ -520,7 +520,7 @@ void* CsrWifiNmeApStartReqDes(u8 *buffer, CsrSize length) primitive->p2pGoParam.operatingChanList.channelEntryList = (CsrWifiSmeApP2pOperatingChanEntry *)CsrPmemAlloc(sizeof(CsrWifiSmeApP2pOperatingChanEntry) * primitive->p2pGoParam.operatingChanList.channelEntryListCount); } { - CsrUint16 i3; + u16 i3; for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++) { CsrUint8Des((u8 *) &primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingClass, buffer, &offset); @@ -528,7 +528,7 @@ void* CsrWifiNmeApStartReqDes(u8 *buffer, CsrSize length) if (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount) { primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel = (u8 *)CsrPmemAlloc(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount); - CsrMemCpyDes(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel, buffer, &offset, ((CsrUint16) (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount))); + CsrMemCpyDes(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel, buffer, &offset, ((u16) (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount))); } else { @@ -565,7 +565,7 @@ void CsrWifiNmeApStartReqSerFree(void *voidPrimitivePointer) break; } { - CsrUint16 i3; + u16 i3; for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++) { CsrPmemFree(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel); @@ -582,24 +582,24 @@ CsrSize CsrWifiNmeApWmmParamUpdateReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 51) */ { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < 4; i1++) { bufferSize += 1; /* u8 primitive->wmmApParams[i1].cwMin */ bufferSize += 1; /* u8 primitive->wmmApParams[i1].cwMax */ bufferSize += 1; /* u8 primitive->wmmApParams[i1].aifs */ - bufferSize += 2; /* CsrUint16 primitive->wmmApParams[i1].txopLimit */ + bufferSize += 2; /* u16 primitive->wmmApParams[i1].txopLimit */ bufferSize += 1; /* CsrBool primitive->wmmApParams[i1].admissionControlMandatory */ } } { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < 4; i1++) { bufferSize += 1; /* u8 primitive->wmmApBcParams[i1].cwMin */ bufferSize += 1; /* u8 primitive->wmmApBcParams[i1].cwMax */ bufferSize += 1; /* u8 primitive->wmmApBcParams[i1].aifs */ - bufferSize += 2; /* CsrUint16 primitive->wmmApBcParams[i1].txopLimit */ + bufferSize += 2; /* u16 primitive->wmmApBcParams[i1].txopLimit */ bufferSize += 1; /* CsrBool primitive->wmmApBcParams[i1].admissionControlMandatory */ } } @@ -613,24 +613,24 @@ u8* CsrWifiNmeApWmmParamUpdateReqSer(u8 *ptr, CsrSize *len, void *msg) *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < 4; i1++) { CsrUint8Ser(ptr, len, (u8) primitive->wmmApParams[i1].cwMin); CsrUint8Ser(ptr, len, (u8) primitive->wmmApParams[i1].cwMax); CsrUint8Ser(ptr, len, (u8) primitive->wmmApParams[i1].aifs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->wmmApParams[i1].txopLimit); + CsrUint16Ser(ptr, len, (u16) primitive->wmmApParams[i1].txopLimit); CsrUint8Ser(ptr, len, (u8) primitive->wmmApParams[i1].admissionControlMandatory); } } { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < 4; i1++) { CsrUint8Ser(ptr, len, (u8) primitive->wmmApBcParams[i1].cwMin); CsrUint8Ser(ptr, len, (u8) primitive->wmmApBcParams[i1].cwMax); CsrUint8Ser(ptr, len, (u8) primitive->wmmApBcParams[i1].aifs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->wmmApBcParams[i1].txopLimit); + CsrUint16Ser(ptr, len, (u16) primitive->wmmApBcParams[i1].txopLimit); CsrUint8Ser(ptr, len, (u8) primitive->wmmApBcParams[i1].admissionControlMandatory); } } @@ -646,24 +646,24 @@ void* CsrWifiNmeApWmmParamUpdateReqDes(u8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < 4; i1++) { CsrUint8Des((u8 *) &primitive->wmmApParams[i1].cwMin, buffer, &offset); CsrUint8Des((u8 *) &primitive->wmmApParams[i1].cwMax, buffer, &offset); CsrUint8Des((u8 *) &primitive->wmmApParams[i1].aifs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->wmmApParams[i1].txopLimit, buffer, &offset); + CsrUint16Des((u16 *) &primitive->wmmApParams[i1].txopLimit, buffer, &offset); CsrUint8Des((u8 *) &primitive->wmmApParams[i1].admissionControlMandatory, buffer, &offset); } } { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < 4; i1++) { CsrUint8Des((u8 *) &primitive->wmmApBcParams[i1].cwMin, buffer, &offset); CsrUint8Des((u8 *) &primitive->wmmApBcParams[i1].cwMax, buffer, &offset); CsrUint8Des((u8 *) &primitive->wmmApBcParams[i1].aifs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->wmmApBcParams[i1].txopLimit, buffer, &offset); + CsrUint16Des((u16 *) &primitive->wmmApBcParams[i1].txopLimit, buffer, &offset); CsrUint8Des((u8 *) &primitive->wmmApBcParams[i1].admissionControlMandatory, buffer, &offset); } } @@ -677,7 +677,7 @@ CsrSize CsrWifiNmeApStaRemoveReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 6; /* u8 primitive->staMacAddress.a[6] */ bufferSize += 1; /* CsrBool primitive->keepBlocking */ return bufferSize; @@ -689,8 +689,8 @@ u8* CsrWifiNmeApStaRemoveReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiNmeApStaRemoveReq *primitive = (CsrWifiNmeApStaRemoveReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrMemCpySer(ptr, len, (const void *) primitive->staMacAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrMemCpySer(ptr, len, (const void *) primitive->staMacAddress.a, ((u16) (6))); CsrUint8Ser(ptr, len, (u8) primitive->keepBlocking); return(ptr); } @@ -703,8 +703,8 @@ void* CsrWifiNmeApStaRemoveReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrMemCpyDes(primitive->staMacAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrMemCpyDes(primitive->staMacAddress.a, buffer, &offset, ((u16) (6))); CsrUint8Des((u8 *) &primitive->keepBlocking, buffer, &offset); return primitive; @@ -716,7 +716,7 @@ CsrSize CsrWifiNmeApWpsRegisterCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ return bufferSize; } @@ -727,8 +727,8 @@ u8* CsrWifiNmeApWpsRegisterCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiNmeApWpsRegisterCfm *primitive = (CsrWifiNmeApWpsRegisterCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -740,8 +740,8 @@ void* CsrWifiNmeApWpsRegisterCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -752,7 +752,7 @@ CsrSize CsrWifiNmeApStartCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 40) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 32; /* u8 primitive->ssid.ssid[32] */ bufferSize += 1; /* u8 primitive->ssid.length */ @@ -765,9 +765,9 @@ u8* CsrWifiNmeApStartCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiNmeApStartCfm *primitive = (CsrWifiNmeApStartCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrMemCpySer(ptr, len, (const void *) primitive->ssid.ssid, ((CsrUint16) (32))); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); + CsrMemCpySer(ptr, len, (const void *) primitive->ssid.ssid, ((u16) (32))); CsrUint8Ser(ptr, len, (u8) primitive->ssid.length); return(ptr); } @@ -780,9 +780,9 @@ void* CsrWifiNmeApStartCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrMemCpyDes(primitive->ssid.ssid, buffer, &offset, ((CsrUint16) (32))); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); + CsrMemCpyDes(primitive->ssid.ssid, buffer, &offset, ((u16) (32))); CsrUint8Des((u8 *) &primitive->ssid.length, buffer, &offset); return primitive; @@ -794,7 +794,7 @@ CsrSize CsrWifiNmeApStopCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ return bufferSize; } @@ -805,8 +805,8 @@ u8* CsrWifiNmeApStopCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiNmeApStopCfm *primitive = (CsrWifiNmeApStopCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -818,8 +818,8 @@ void* CsrWifiNmeApStopCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -830,7 +830,7 @@ CsrSize CsrWifiNmeApStopIndSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiSmeApType primitive->apType */ bufferSize += 2; /* CsrResult primitive->status */ return bufferSize; @@ -842,9 +842,9 @@ u8* CsrWifiNmeApStopIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiNmeApStopInd *primitive = (CsrWifiNmeApStopInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->apType); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -856,9 +856,9 @@ void* CsrWifiNmeApStopIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->apType, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -869,7 +869,7 @@ CsrSize CsrWifiNmeApStationIndSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 18) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiSmeMediaStatus primitive->mediaStatus */ bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ bufferSize += 6; /* u8 primitive->peerDeviceAddress.a[6] */ @@ -882,10 +882,10 @@ u8* CsrWifiNmeApStationIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiNmeApStationInd *primitive = (CsrWifiNmeApStationInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->mediaStatus); - CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); - CsrMemCpySer(ptr, len, (const void *) primitive->peerDeviceAddress.a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->peerDeviceAddress.a, ((u16) (6))); return(ptr); } @@ -897,10 +897,10 @@ void* CsrWifiNmeApStationIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->mediaStatus, buffer, &offset); - CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); - CsrMemCpyDes(primitive->peerDeviceAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); + CsrMemCpyDes(primitive->peerDeviceAddress.a, buffer, &offset, ((u16) (6))); return primitive; } diff --git a/drivers/staging/csr/csr_wifi_nme_lib.h b/drivers/staging/csr/csr_wifi_nme_lib.h index d7d3c03..d539d35 100644 --- a/drivers/staging/csr/csr_wifi_nme_lib.h +++ b/drivers/staging/csr/csr_wifi_nme_lib.h @@ -43,7 +43,7 @@ extern "C" { * PARAMETERS * Deallocates the resources in a CSR_WIFI_NME upstream message *----------------------------------------------------------------------------*/ -void CsrWifiNmeFreeUpstreamMessageContents(CsrUint16 eventClass, void *message); +void CsrWifiNmeFreeUpstreamMessageContents(u16 eventClass, void *message); /*----------------------------------------------------------------------------* * CsrWifiNmeFreeDownstreamMessageContents @@ -55,7 +55,7 @@ void CsrWifiNmeFreeUpstreamMessageContents(CsrUint16 eventClass, void *message); * PARAMETERS * Deallocates the resources in a CSR_WIFI_NME downstream message *----------------------------------------------------------------------------*/ -void CsrWifiNmeFreeDownstreamMessageContents(CsrUint16 eventClass, void *message); +void CsrWifiNmeFreeDownstreamMessageContents(u16 eventClass, void *message); /*----------------------------------------------------------------------------* * Enum to string functions diff --git a/drivers/staging/csr/csr_wifi_nme_prim.h b/drivers/staging/csr/csr_wifi_nme_prim.h index 79187ba..4aff291 100644 --- a/drivers/staging/csr/csr_wifi_nme_prim.h +++ b/drivers/staging/csr/csr_wifi_nme_prim.h @@ -67,7 +67,7 @@ typedef void (*CsrWifiNmeFrameFreeFunction)(void *frame); - For future use. *******************************************************************************/ -typedef CsrUint16 CsrWifiNmeAuthMode; +typedef u16 CsrWifiNmeAuthMode; #define CSR_WIFI_NME_AUTH_MODE_80211_OPEN ((CsrWifiNmeAuthMode) 0x0001) #define CSR_WIFI_NME_AUTH_MODE_80211_SHARED ((CsrWifiNmeAuthMode) 0x0002) #define CSR_WIFI_NME_AUTH_MODE_8021X_WPA ((CsrWifiNmeAuthMode) 0x0004) @@ -204,7 +204,7 @@ typedef u8 CsrWifiNmeConnectionStatus; FAST/LEAP/TLS/TTLS/PEAP/etc. *******************************************************************************/ -typedef CsrUint16 CsrWifiNmeCredentialType; +typedef u16 CsrWifiNmeCredentialType; #define CSR_WIFI_NME_CREDENTIAL_TYPE_OPEN_SYSTEM ((CsrWifiNmeCredentialType) 0x0000) #define CSR_WIFI_NME_CREDENTIAL_TYPE_WEP64 ((CsrWifiNmeCredentialType) 0x0001) #define CSR_WIFI_NME_CREDENTIAL_TYPE_WEP128 ((CsrWifiNmeCredentialType) 0x0002) @@ -246,7 +246,7 @@ typedef CsrUint16 CsrWifiNmeCredentialType; - EAP-LEAP Method. *******************************************************************************/ -typedef CsrUint16 CsrWifiNmeEapMethod; +typedef u16 CsrWifiNmeEapMethod; #define CSR_WIFI_NME_EAP_METHOD_TLS ((CsrWifiNmeEapMethod) 0x0001) #define CSR_WIFI_NME_EAP_METHOD_TTLS_MSCHAPV2 ((CsrWifiNmeEapMethod) 0x0002) #define CSR_WIFI_NME_EAP_METHOD_PEAP_GTC ((CsrWifiNmeEapMethod) 0x0004) @@ -290,7 +290,7 @@ typedef CsrUint16 CsrWifiNmeEapMethod; - SMS4 key for broadcast messages. *******************************************************************************/ -typedef CsrUint16 CsrWifiNmeEncryption; +typedef u16 CsrWifiNmeEncryption; #define CSR_WIFI_NME_ENCRYPTION_CIPHER_NONE ((CsrWifiNmeEncryption) 0x0000) #define CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_WEP40 ((CsrWifiNmeEncryption) 0x0001) #define CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_WEP104 ((CsrWifiNmeEncryption) 0x0002) @@ -469,7 +469,7 @@ typedef u8 CsrWifiNmeWmmQosInfo; Mask type for use with the values defined by CsrWifiNmeEapMethod. *******************************************************************************/ -typedef CsrUint16 CsrWifiNmeEapMethodMask; +typedef u16 CsrWifiNmeEapMethodMask; /******************************************************************************* NAME @@ -479,7 +479,7 @@ typedef CsrUint16 CsrWifiNmeEapMethodMask; Mask type for use with the values defined by CsrWifiNmeEncryption *******************************************************************************/ -typedef CsrUint16 CsrWifiNmeEncryptionMask; +typedef u16 CsrWifiNmeEncryptionMask; /******************************************************************************* NAME @@ -546,7 +546,7 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint16 encryptionMode; + u16 encryptionMode; CsrCharString *passphrase; } CsrWifiNmePassphrase; @@ -565,7 +565,7 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint16 encryptionMode; + u16 encryptionMode; u8 psk[32]; } CsrWifiNmePsk; @@ -596,7 +596,7 @@ typedef struct { CsrUint32 certificateLength; u8 *certificate; - CsrUint16 privateKeyLength; + u16 privateKeyLength; u8 *privateKey; CsrUint32 caCertificateLength; u8 *caCertificate; @@ -715,7 +715,7 @@ typedef struct u8 *clientCertificate; CsrUint32 certificateAuthorityCertificateLength; u8 *certificateAuthorityCertificate; - CsrUint16 privateKeyLength; + u16 privateKeyLength; u8 *privateKey; CsrCharString *privateKeyPassword; CsrUint32 sessionLength; @@ -1035,7 +1035,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; u8 profileIdentitysCount; CsrWifiNmeProfileIdentity *profileIdentitys; } CsrWifiNmeProfileOrderSetReq; @@ -1059,7 +1059,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiNmeProfileIdentity profileIdentity; } CsrWifiNmeProfileConnectReq; @@ -1087,7 +1087,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; u8 pin[8]; CsrWifiSsid ssid; CsrWifiMacAddress bssid; @@ -1111,7 +1111,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; } CsrWifiNmeWpsCancelReq; /******************************************************************************* @@ -1130,7 +1130,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; } CsrWifiNmeConnectionStatusGetReq; /******************************************************************************* @@ -1361,7 +1361,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; } CsrWifiNmeProfileOrderSetCfm; @@ -1397,7 +1397,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; u8 connectAttemptsCount; CsrWifiNmeConnectAttempt *connectAttempts; @@ -1426,7 +1426,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; CsrWifiNmeProfile profile; } CsrWifiNmeWpsCfm; @@ -1448,7 +1448,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; } CsrWifiNmeWpsCancelCfm; @@ -1471,7 +1471,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; CsrWifiNmeConnectionStatus connectionStatus; } CsrWifiNmeConnectionStatusGetCfm; @@ -1499,7 +1499,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiNmeProfile profile; } CsrWifiNmeProfileUpdateInd; @@ -1531,7 +1531,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; u8 connectAttemptsCount; CsrWifiNmeConnectAttempt *connectAttempts; } CsrWifiNmeProfileDisconnectInd; diff --git a/drivers/staging/csr/csr_wifi_router_converter_init.c b/drivers/staging/csr/csr_wifi_router_converter_init.c index 6ff59c0..048b146 100644 --- a/drivers/staging/csr/csr_wifi_router_converter_init.c +++ b/drivers/staging/csr/csr_wifi_router_converter_init.c @@ -37,11 +37,11 @@ static CsrMsgConvMsgEntry csrwifirouter_conv_lut[] = { { 0, NULL, NULL, NULL, NULL }, }; -CsrMsgConvMsgEntry* CsrWifiRouterConverterLookup(CsrMsgConvMsgEntry *ce, CsrUint16 msgType) +CsrMsgConvMsgEntry* CsrWifiRouterConverterLookup(CsrMsgConvMsgEntry *ce, u16 msgType) { if (msgType & CSR_PRIM_UPSTREAM) { - CsrUint16 idx = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT; + u16 idx = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT; if (idx < (CSR_WIFI_ROUTER_PRIM_UPSTREAM_COUNT + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT) && csrwifirouter_conv_lut[idx].msgType == msgType) { diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c b/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c index 32d0bb6..7c3289a 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c @@ -90,11 +90,11 @@ static CsrMsgConvMsgEntry csrwifirouterctrl_conv_lut[] = { { 0, NULL, NULL, NULL, NULL }, }; -CsrMsgConvMsgEntry* CsrWifiRouterCtrlConverterLookup(CsrMsgConvMsgEntry *ce, CsrUint16 msgType) +CsrMsgConvMsgEntry* CsrWifiRouterCtrlConverterLookup(CsrMsgConvMsgEntry *ce, u16 msgType) { if (msgType & CSR_PRIM_UPSTREAM) { - CsrUint16 idx = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT; + u16 idx = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT; if (idx < (CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_COUNT + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT) && csrwifirouterctrl_conv_lut[idx].msgType == msgType) { diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c index d161fad..2329dc3 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c @@ -25,7 +25,7 @@ * eventClass: only the value CSR_WIFI_ROUTER_CTRL_PRIM will be handled * message: the message to free *----------------------------------------------------------------------------*/ -void CsrWifiRouterCtrlFreeDownstreamMessageContents(CsrUint16 eventClass, void *message) +void CsrWifiRouterCtrlFreeDownstreamMessageContents(u16 eventClass, void *message) { if (eventClass != CSR_WIFI_ROUTER_CTRL_PRIM) { diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c index b6bf11d..8f1ce3d 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c @@ -25,7 +25,7 @@ * eventClass: only the value CSR_WIFI_ROUTER_CTRL_PRIM will be handled * message: the message to free *----------------------------------------------------------------------------*/ -void CsrWifiRouterCtrlFreeUpstreamMessageContents(CsrUint16 eventClass, void *message) +void CsrWifiRouterCtrlFreeUpstreamMessageContents(u16 eventClass, void *message) { if (eventClass != CSR_WIFI_ROUTER_CTRL_PRIM) { diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_lib.h b/drivers/staging/csr/csr_wifi_router_ctrl_lib.h index 6c7e974..e7117ee 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_lib.h +++ b/drivers/staging/csr/csr_wifi_router_ctrl_lib.h @@ -39,7 +39,7 @@ extern "C" { * PARAMETERS * Deallocates the resources in a CSR_WIFI_ROUTER_CTRL upstream message *----------------------------------------------------------------------------*/ -void CsrWifiRouterCtrlFreeUpstreamMessageContents(CsrUint16 eventClass, void *message); +void CsrWifiRouterCtrlFreeUpstreamMessageContents(u16 eventClass, void *message); /*----------------------------------------------------------------------------* * CsrWifiRouterCtrlFreeDownstreamMessageContents @@ -51,7 +51,7 @@ void CsrWifiRouterCtrlFreeUpstreamMessageContents(CsrUint16 eventClass, void *me * PARAMETERS * Deallocates the resources in a CSR_WIFI_ROUTER_CTRL downstream message *----------------------------------------------------------------------------*/ -void CsrWifiRouterCtrlFreeDownstreamMessageContents(CsrUint16 eventClass, void *message); +void CsrWifiRouterCtrlFreeDownstreamMessageContents(u16 eventClass, void *message); /*----------------------------------------------------------------------------* * Enum to string functions diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_prim.h b/drivers/staging/csr/csr_wifi_router_ctrl_prim.h index acf10ef..37ba5ea 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_prim.h +++ b/drivers/staging/csr/csr_wifi_router_ctrl_prim.h @@ -34,8 +34,8 @@ typedef CsrResult (*CsrWifiRouterCtrlRawSdioFirmwareDownload)(CsrUint32 length, typedef CsrResult (*CsrWifiRouterCtrlRawSdioReset)(void); typedef CsrResult (*CsrWifiRouterCtrlRawSdioCoreDumpPrepare)(CsrBool suspendSme); typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteBlockRead)(u8 func, CsrUint32 address, u8 *pdata, CsrUint32 length); -typedef CsrResult (*CsrWifiRouterCtrlRawSdioGpRead16)(u8 func, CsrUint32 address, CsrUint16 *pdata); -typedef CsrResult (*CsrWifiRouterCtrlRawSdioGpWrite16)(u8 func, CsrUint32 address, CsrUint16 data); +typedef CsrResult (*CsrWifiRouterCtrlRawSdioGpRead16)(u8 func, CsrUint32 address, u16 *pdata); +typedef CsrResult (*CsrWifiRouterCtrlRawSdioGpWrite16)(u8 func, CsrUint32 address, u16 data); /******************************************************************************* @@ -114,7 +114,7 @@ typedef u8 CsrWifiRouterCtrlListAction; - *******************************************************************************/ -typedef CsrUint16 CsrWifiRouterCtrlLowPowerMode; +typedef u16 CsrWifiRouterCtrlLowPowerMode; #define CSR_WIFI_ROUTER_CTRL_LOW_POWER_MODE_DISABLED ((CsrWifiRouterCtrlLowPowerMode) 0x0000) #define CSR_WIFI_ROUTER_CTRL_LOW_POWER_MODE_ENABLED ((CsrWifiRouterCtrlLowPowerMode) 0x0001) @@ -203,7 +203,7 @@ typedef u8 CsrWifiRouterCtrlPeerStatus; - *******************************************************************************/ -typedef CsrUint16 CsrWifiRouterCtrlPortAction; +typedef u16 CsrWifiRouterCtrlPortAction; #define CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN ((CsrWifiRouterCtrlPortAction) 0x0000) #define CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD ((CsrWifiRouterCtrlPortAction) 0x0001) #define CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_BLOCK ((CsrWifiRouterCtrlPortAction) 0x0002) @@ -242,7 +242,7 @@ typedef CsrUint16 CsrWifiRouterCtrlPortAction; - *******************************************************************************/ -typedef CsrUint16 CsrWifiRouterCtrlPowersaveType; +typedef u16 CsrWifiRouterCtrlPowersaveType; #define CSR_WIFI_ROUTER_CTRL_AC_BK_PS_INFO_PRESENT ((CsrWifiRouterCtrlPowersaveType) 0x0001) #define CSR_WIFI_ROUTER_CTRL_AC_BE_PS_INFO_PRESENT ((CsrWifiRouterCtrlPowersaveType) 0x0002) #define CSR_WIFI_ROUTER_CTRL_AC_VI_PS_INFO_PRESENT ((CsrWifiRouterCtrlPowersaveType) 0x0004) @@ -270,7 +270,7 @@ typedef CsrUint16 CsrWifiRouterCtrlPowersaveType; - *******************************************************************************/ -typedef CsrUint16 CsrWifiRouterCtrlProtocolDirection; +typedef u16 CsrWifiRouterCtrlProtocolDirection; #define CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_RX ((CsrWifiRouterCtrlProtocolDirection) 0x0000) #define CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX ((CsrWifiRouterCtrlProtocolDirection) 0x0001) @@ -290,7 +290,7 @@ typedef CsrUint16 CsrWifiRouterCtrlProtocolDirection; - *******************************************************************************/ -typedef CsrUint16 CsrWifiRouterCtrlQoSControl; +typedef u16 CsrWifiRouterCtrlQoSControl; #define CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_OFF ((CsrWifiRouterCtrlQoSControl) 0x0000) #define CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_WMM_ON ((CsrWifiRouterCtrlQoSControl) 0x0001) #define CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_80211_ON ((CsrWifiRouterCtrlQoSControl) 0x0002) @@ -336,7 +336,7 @@ typedef u8 CsrWifiRouterCtrlQueueConfig; - *******************************************************************************/ -typedef CsrUint16 CsrWifiRouterCtrlTrafficConfigType; +typedef u16 CsrWifiRouterCtrlTrafficConfigType; #define CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_RESET ((CsrWifiRouterCtrlTrafficConfigType) 0x0000) #define CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_FILTER ((CsrWifiRouterCtrlTrafficConfigType) 0x0001) #define CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_CLS ((CsrWifiRouterCtrlTrafficConfigType) 0x0002) @@ -367,7 +367,7 @@ typedef CsrUint16 CsrWifiRouterCtrlTrafficConfigType; - *******************************************************************************/ -typedef CsrUint16 CsrWifiRouterCtrlTrafficPacketType; +typedef u16 CsrWifiRouterCtrlTrafficPacketType; #define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_NONE ((CsrWifiRouterCtrlTrafficPacketType) 0x0000) #define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_EAPOL ((CsrWifiRouterCtrlTrafficPacketType) 0x0001) #define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP ((CsrWifiRouterCtrlTrafficPacketType) 0x0002) @@ -421,7 +421,7 @@ typedef CsrUint32 CsrWifiRouterCtrlPeerRecordHandle; CsrWifiRouterCtrlPowersaveType *******************************************************************************/ -typedef CsrUint16 CsrWifiRouterCtrlPowersaveTypeMask; +typedef u16 CsrWifiRouterCtrlPowersaveTypeMask; /******************************************************************************* NAME @@ -440,7 +440,7 @@ typedef u8 CsrWifiRouterCtrlQueueConfigMask; DESCRIPTION *******************************************************************************/ -typedef CsrUint16 CsrWifiRouterCtrlRequestorInfo; +typedef u16 CsrWifiRouterCtrlRequestorInfo; /******************************************************************************* NAME @@ -491,7 +491,7 @@ typedef struct CsrBool wmmOrQosEnabled; CsrWifiRouterCtrlPowersaveTypeMask powersaveMode; u8 maxSpLength; - CsrUint16 listenIntervalInTus; + u16 listenIntervalInTus; } CsrWifiRouterCtrlStaInfo; /******************************************************************************* @@ -582,7 +582,7 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint16 packetFilter; + u16 packetFilter; CsrWifiRouterCtrlTrafficFilter customFilter; } CsrWifiRouterCtrlTrafficConfig; @@ -708,11 +708,11 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 mlmeCommandLength; + u16 mlmeCommandLength; u8 *mlmeCommand; - CsrUint16 dataRef1Length; + u16 dataRef1Length; u8 *dataRef1; - CsrUint16 dataRef2Length; + u16 dataRef2Length; u8 *dataRef2; } CsrWifiRouterCtrlHipReq; @@ -733,7 +733,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiRouterCtrlRequestorInfo clientData; CsrWifiRouterCtrlMediaStatus mediaStatus; } CsrWifiRouterCtrlMediaStatusReq; @@ -758,7 +758,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiRouterCtrlRequestorInfo clientData; CsrResult status; CsrWifiRouterCtrlListAction action; @@ -786,7 +786,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiRouterCtrlRequestorInfo clientData; CsrWifiRouterCtrlPortAction uncontrolledPortAction; CsrWifiRouterCtrlPortAction controlledPortAction; @@ -812,7 +812,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiRouterCtrlRequestorInfo clientData; CsrWifiRouterCtrlQoSControl control; CsrWifiRouterCtrlQueueConfigMask queueConfig; @@ -856,9 +856,9 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 tclasLength; + u16 tclasLength; u8 *tclas; } CsrWifiRouterCtrlTclasAddReq; @@ -936,9 +936,9 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 tclasLength; + u16 tclasLength; u8 *tclas; } CsrWifiRouterCtrlTclasDelReq; @@ -960,10 +960,10 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiRouterCtrlRequestorInfo clientData; CsrWifiRouterCtrlTrafficType trafficType; - CsrUint16 period; + u16 period; } CsrWifiRouterCtrlTrafficClassificationReq; /******************************************************************************* @@ -984,7 +984,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiRouterCtrlRequestorInfo clientData; CsrWifiRouterCtrlTrafficConfigType trafficConfigType; CsrWifiRouterCtrlTrafficConfig config; @@ -1070,7 +1070,7 @@ typedef struct CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; CsrResult status; - CsrUint16 numInterfaceAddress; + u16 numInterfaceAddress; CsrWifiMacAddress stationMacAddress[2]; CsrWifiRouterCtrlSmeVersions smeVersions; CsrBool scheduledInterrupt; @@ -1092,7 +1092,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiRouterCtrlRequestorInfo clientData; } CsrWifiRouterCtrlM4TransmitReq; @@ -1122,7 +1122,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiRouterCtrlRequestorInfo clientData; CsrWifiRouterCtrlMode mode; CsrWifiMacAddress bssid; @@ -1149,10 +1149,10 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiRouterCtrlRequestorInfo clientData; CsrWifiMacAddress peerMacAddress; - CsrUint16 associationId; + u16 associationId; CsrWifiRouterCtrlStaInfo staInfo; } CsrWifiRouterCtrlPeerAddReq; @@ -1173,7 +1173,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiRouterCtrlRequestorInfo clientData; CsrWifiRouterCtrlPeerRecordHandle peerRecordHandle; } CsrWifiRouterCtrlPeerDelReq; @@ -1196,7 +1196,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiRouterCtrlRequestorInfo clientData; CsrWifiRouterCtrlPeerRecordHandle peerRecordHandle; CsrWifiRouterCtrlPowersaveTypeMask powersaveMode; @@ -1242,14 +1242,14 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiRouterCtrlRequestorInfo clientData; CsrWifiMacAddress macAddress; CsrWifiRouterCtrlTrafficStreamId trafficStreamID; CsrWifiRouterCtrlBlockAckRole role; - CsrUint16 bufferSize; - CsrUint16 timeout; - CsrUint16 ssn; + u16 bufferSize; + u16 timeout; + u16 ssn; } CsrWifiRouterCtrlBlockAckEnableReq; /******************************************************************************* @@ -1271,7 +1271,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiRouterCtrlRequestorInfo clientData; CsrWifiMacAddress macAddress; CsrWifiRouterCtrlTrafficStreamId trafficStreamID; @@ -1297,10 +1297,10 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; - CsrUint16 signalLength; + u16 interfaceTag; + u16 signalLength; u8 *signal; - CsrUint16 dataLength; + u16 dataLength; u8 *data; } CsrWifiRouterCtrlWapiRxPktReq; @@ -1320,7 +1320,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; u8 status; } CsrWifiRouterCtrlWapiMulticastFilterReq; @@ -1340,7 +1340,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; u8 status; } CsrWifiRouterCtrlWapiUnicastFilterReq; @@ -1361,8 +1361,8 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; - CsrUint16 dataLength; + u16 interfaceTag; + u16 dataLength; u8 *data; } CsrWifiRouterCtrlWapiUnicastTxPktReq; @@ -1382,7 +1382,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrBool isWapiConnected; } CsrWifiRouterCtrlWapiFilterReq; @@ -1407,11 +1407,11 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 mlmeCommandLength; + u16 mlmeCommandLength; u8 *mlmeCommand; - CsrUint16 dataRef1Length; + u16 dataRef1Length; u8 *dataRef1; - CsrUint16 dataRef2Length; + u16 dataRef2Length; u8 *dataRef2; } CsrWifiRouterCtrlHipInd; @@ -1435,7 +1435,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiRouterCtrlListAction action; u8 setAddressesCount; CsrWifiMacAddress *setAddresses; @@ -1460,7 +1460,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; CsrWifiMacAddress macAddress; } CsrWifiRouterCtrlPortConfigureCfm; @@ -1525,7 +1525,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; } CsrWifiRouterCtrlTclasAddCfm; @@ -1603,7 +1603,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; } CsrWifiRouterCtrlTclasDelCfm; @@ -1627,7 +1627,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiRouterCtrlTrafficPacketType packetType; CsrWifiRouterCtrlProtocolDirection direction; CsrWifiMacAddress srcAddress; @@ -1651,7 +1651,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiRouterCtrlTrafficStats stats; } CsrWifiRouterCtrlTrafficSampleInd; @@ -1753,7 +1753,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiMacAddress peerMacAddress; } CsrWifiRouterCtrlM4ReadyToSendInd; @@ -1776,7 +1776,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiMacAddress peerMacAddress; CsrResult status; } CsrWifiRouterCtrlM4TransmittedInd; @@ -1800,7 +1800,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiMacAddress peerMacAddress; CsrBool unicastPdu; } CsrWifiRouterCtrlMicFailureInd; @@ -1824,7 +1824,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiMacAddress peerMacAddress; CsrWifiRouterCtrlPeerStatus peerStatus; } CsrWifiRouterCtrlConnectedInd; @@ -1849,7 +1849,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiMacAddress peerMacAddress; CsrWifiRouterCtrlPeerRecordHandle peerRecordHandle; CsrResult status; @@ -1873,7 +1873,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; } CsrWifiRouterCtrlPeerDelCfm; @@ -1895,7 +1895,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiMacAddress peerMacAddress; } CsrWifiRouterCtrlUnexpectedFrameInd; @@ -1917,7 +1917,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; } CsrWifiRouterCtrlPeerUpdateCfm; @@ -1941,8 +1941,8 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 commandQueueSize; - CsrUint16 trafficQueueSize; + u16 commandQueueSize; + u16 trafficQueueSize; } CsrWifiRouterCtrlCapabilitiesCfm; /******************************************************************************* @@ -1963,7 +1963,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; } CsrWifiRouterCtrlBlockAckEnableCfm; @@ -1985,7 +1985,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; } CsrWifiRouterCtrlBlockAckDisableCfm; @@ -2009,7 +2009,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiRouterCtrlTrafficStreamId trafficStreamID; CsrWifiMacAddress peerMacAddress; CsrResult status; @@ -2033,7 +2033,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiMacAddress staAddress; } CsrWifiRouterCtrlStaInactiveInd; @@ -2058,10 +2058,10 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 interfaceTag; - CsrUint16 signalLength; + u16 interfaceTag; + u16 signalLength; u8 *signal; - CsrUint16 dataLength; + u16 dataLength; u8 *data; } CsrWifiRouterCtrlWapiRxMicCheckInd; @@ -2084,7 +2084,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiRouterCtrlMode mode; CsrResult status; } CsrWifiRouterCtrlModeSetCfm; @@ -2108,8 +2108,8 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint16 interfaceTag; - CsrUint16 dataLength; + u16 interfaceTag; + u16 dataLength; u8 *data; } CsrWifiRouterCtrlWapiUnicastTxEncryptInd; diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c index 7aa96e3..f46a536 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c @@ -41,8 +41,8 @@ u8* CsrWifiRouterCtrlConfigurePowerModeReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlConfigurePowerModeReq *primitive = (CsrWifiRouterCtrlConfigurePowerModeReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->mode); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->mode); CsrUint8Ser(ptr, len, (u8) primitive->wakeHost); return(ptr); } @@ -55,8 +55,8 @@ void* CsrWifiRouterCtrlConfigurePowerModeReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->mode, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->mode, buffer, &offset); CsrUint8Des((u8 *) &primitive->wakeHost, buffer, &offset); return primitive; @@ -69,11 +69,11 @@ CsrSize CsrWifiRouterCtrlHipReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */ - bufferSize += 2; /* CsrUint16 primitive->mlmeCommandLength */ + bufferSize += 2; /* u16 primitive->mlmeCommandLength */ bufferSize += primitive->mlmeCommandLength; /* u8 primitive->mlmeCommand */ - bufferSize += 2; /* CsrUint16 primitive->dataRef1Length */ + bufferSize += 2; /* u16 primitive->dataRef1Length */ bufferSize += primitive->dataRef1Length; /* u8 primitive->dataRef1 */ - bufferSize += 2; /* CsrUint16 primitive->dataRef2Length */ + bufferSize += 2; /* u16 primitive->dataRef2Length */ bufferSize += primitive->dataRef2Length; /* u8 primitive->dataRef2 */ return bufferSize; } @@ -84,20 +84,20 @@ u8* CsrWifiRouterCtrlHipReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlHipReq *primitive = (CsrWifiRouterCtrlHipReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->mlmeCommandLength); + CsrUint16Ser(ptr, len, (u16) primitive->mlmeCommandLength); if (primitive->mlmeCommandLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->mlmeCommand, ((CsrUint16) (primitive->mlmeCommandLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->mlmeCommand, ((u16) (primitive->mlmeCommandLength))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->dataRef1Length); + CsrUint16Ser(ptr, len, (u16) primitive->dataRef1Length); if (primitive->dataRef1Length) { - CsrMemCpySer(ptr, len, (const void *) primitive->dataRef1, ((CsrUint16) (primitive->dataRef1Length))); + CsrMemCpySer(ptr, len, (const void *) primitive->dataRef1, ((u16) (primitive->dataRef1Length))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->dataRef2Length); + CsrUint16Ser(ptr, len, (u16) primitive->dataRef2Length); if (primitive->dataRef2Length) { - CsrMemCpySer(ptr, len, (const void *) primitive->dataRef2, ((CsrUint16) (primitive->dataRef2Length))); + CsrMemCpySer(ptr, len, (const void *) primitive->dataRef2, ((u16) (primitive->dataRef2Length))); } return(ptr); } @@ -110,31 +110,31 @@ void* CsrWifiRouterCtrlHipReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->mlmeCommandLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->mlmeCommandLength, buffer, &offset); if (primitive->mlmeCommandLength) { primitive->mlmeCommand = (u8 *)CsrPmemAlloc(primitive->mlmeCommandLength); - CsrMemCpyDes(primitive->mlmeCommand, buffer, &offset, ((CsrUint16) (primitive->mlmeCommandLength))); + CsrMemCpyDes(primitive->mlmeCommand, buffer, &offset, ((u16) (primitive->mlmeCommandLength))); } else { primitive->mlmeCommand = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->dataRef1Length, buffer, &offset); + CsrUint16Des((u16 *) &primitive->dataRef1Length, buffer, &offset); if (primitive->dataRef1Length) { primitive->dataRef1 = (u8 *)CsrPmemAlloc(primitive->dataRef1Length); - CsrMemCpyDes(primitive->dataRef1, buffer, &offset, ((CsrUint16) (primitive->dataRef1Length))); + CsrMemCpyDes(primitive->dataRef1, buffer, &offset, ((u16) (primitive->dataRef1Length))); } else { primitive->dataRef1 = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->dataRef2Length, buffer, &offset); + CsrUint16Des((u16 *) &primitive->dataRef2Length, buffer, &offset); if (primitive->dataRef2Length) { primitive->dataRef2 = (u8 *)CsrPmemAlloc(primitive->dataRef2Length); - CsrMemCpyDes(primitive->dataRef2, buffer, &offset, ((CsrUint16) (primitive->dataRef2Length))); + CsrMemCpyDes(primitive->dataRef2, buffer, &offset, ((u16) (primitive->dataRef2Length))); } else { @@ -160,7 +160,7 @@ CsrSize CsrWifiRouterCtrlMediaStatusReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 1; /* CsrWifiRouterCtrlMediaStatus primitive->mediaStatus */ return bufferSize; @@ -172,8 +172,8 @@ u8* CsrWifiRouterCtrlMediaStatusReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlMediaStatusReq *primitive = (CsrWifiRouterCtrlMediaStatusReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); CsrUint8Ser(ptr, len, (u8) primitive->mediaStatus); return(ptr); } @@ -186,8 +186,8 @@ void* CsrWifiRouterCtrlMediaStatusReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); CsrUint8Des((u8 *) &primitive->mediaStatus, buffer, &offset); return primitive; @@ -200,13 +200,13 @@ CsrSize CsrWifiRouterCtrlMulticastAddressResSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* CsrWifiRouterCtrlListAction primitive->action */ bufferSize += 1; /* u8 primitive->getAddressesCount */ { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->getAddressesCount; i1++) { bufferSize += 6; /* u8 primitive->getAddresses[i1].a[6] */ @@ -221,16 +221,16 @@ u8* CsrWifiRouterCtrlMulticastAddressResSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlMulticastAddressRes *primitive = (CsrWifiRouterCtrlMulticastAddressRes *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->status); CsrUint8Ser(ptr, len, (u8) primitive->action); CsrUint8Ser(ptr, len, (u8) primitive->getAddressesCount); { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->getAddressesCount; i1++) { - CsrMemCpySer(ptr, len, (const void *) primitive->getAddresses[i1].a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->getAddresses[i1].a, ((u16) (6))); } } return(ptr); @@ -244,9 +244,9 @@ void* CsrWifiRouterCtrlMulticastAddressResDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); CsrUint8Des((u8 *) &primitive->action, buffer, &offset); CsrUint8Des((u8 *) &primitive->getAddressesCount, buffer, &offset); primitive->getAddresses = NULL; @@ -255,10 +255,10 @@ void* CsrWifiRouterCtrlMulticastAddressResDes(u8 *buffer, CsrSize length) primitive->getAddresses = (CsrWifiMacAddress *)CsrPmemAlloc(sizeof(CsrWifiMacAddress) * primitive->getAddressesCount); } { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->getAddressesCount; i1++) { - CsrMemCpyDes(primitive->getAddresses[i1].a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->getAddresses[i1].a, buffer, &offset, ((u16) (6))); } } @@ -279,7 +279,7 @@ CsrSize CsrWifiRouterCtrlPortConfigureReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 18) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrWifiRouterCtrlPortAction primitive->uncontrolledPortAction */ bufferSize += 2; /* CsrWifiRouterCtrlPortAction primitive->controlledPortAction */ @@ -294,11 +294,11 @@ u8* CsrWifiRouterCtrlPortConfigureReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlPortConfigureReq *primitive = (CsrWifiRouterCtrlPortConfigureReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->uncontrolledPortAction); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->controlledPortAction); - CsrMemCpySer(ptr, len, (const void *) primitive->macAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->uncontrolledPortAction); + CsrUint16Ser(ptr, len, (u16) primitive->controlledPortAction); + CsrMemCpySer(ptr, len, (const void *) primitive->macAddress.a, ((u16) (6))); CsrUint8Ser(ptr, len, (u8) primitive->setProtection); return(ptr); } @@ -311,11 +311,11 @@ void* CsrWifiRouterCtrlPortConfigureReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->uncontrolledPortAction, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->controlledPortAction, buffer, &offset); - CsrMemCpyDes(primitive->macAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->uncontrolledPortAction, buffer, &offset); + CsrUint16Des((u16 *) &primitive->controlledPortAction, buffer, &offset); + CsrMemCpyDes(primitive->macAddress.a, buffer, &offset, ((u16) (6))); CsrUint8Des((u8 *) &primitive->setProtection, buffer, &offset); return primitive; @@ -327,7 +327,7 @@ CsrSize CsrWifiRouterCtrlQosControlReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrWifiRouterCtrlQoSControl primitive->control */ bufferSize += 1; /* CsrWifiRouterCtrlQueueConfigMask primitive->queueConfig */ @@ -340,9 +340,9 @@ u8* CsrWifiRouterCtrlQosControlReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlQosControlReq *primitive = (CsrWifiRouterCtrlQosControlReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->control); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->control); CsrUint8Ser(ptr, len, (u8) primitive->queueConfig); return(ptr); } @@ -355,9 +355,9 @@ void* CsrWifiRouterCtrlQosControlReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->control, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->control, buffer, &offset); CsrUint8Des((u8 *) &primitive->queueConfig, buffer, &offset); return primitive; @@ -380,8 +380,8 @@ u8* CsrWifiRouterCtrlSuspendResSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlSuspendRes *primitive = (CsrWifiRouterCtrlSuspendRes *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -393,8 +393,8 @@ void* CsrWifiRouterCtrlSuspendResDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -406,9 +406,9 @@ CsrSize CsrWifiRouterCtrlTclasAddReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->tclasLength */ + bufferSize += 2; /* u16 primitive->tclasLength */ bufferSize += primitive->tclasLength; /* u8 primitive->tclas */ return bufferSize; } @@ -419,12 +419,12 @@ u8* CsrWifiRouterCtrlTclasAddReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlTclasAddReq *primitive = (CsrWifiRouterCtrlTclasAddReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->tclasLength); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->tclasLength); if (primitive->tclasLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->tclas, ((CsrUint16) (primitive->tclasLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->tclas, ((u16) (primitive->tclasLength))); } return(ptr); } @@ -437,13 +437,13 @@ void* CsrWifiRouterCtrlTclasAddReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->tclasLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->tclasLength, buffer, &offset); if (primitive->tclasLength) { primitive->tclas = (u8 *)CsrPmemAlloc(primitive->tclasLength); - CsrMemCpyDes(primitive->tclas, buffer, &offset, ((CsrUint16) (primitive->tclasLength))); + CsrMemCpyDes(primitive->tclas, buffer, &offset, ((u16) (primitive->tclasLength))); } else { @@ -478,8 +478,8 @@ u8* CsrWifiRouterCtrlResumeResSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlResumeRes *primitive = (CsrWifiRouterCtrlResumeRes *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -491,8 +491,8 @@ void* CsrWifiRouterCtrlResumeResDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -504,9 +504,9 @@ CsrSize CsrWifiRouterCtrlTclasDelReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->tclasLength */ + bufferSize += 2; /* u16 primitive->tclasLength */ bufferSize += primitive->tclasLength; /* u8 primitive->tclas */ return bufferSize; } @@ -517,12 +517,12 @@ u8* CsrWifiRouterCtrlTclasDelReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlTclasDelReq *primitive = (CsrWifiRouterCtrlTclasDelReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->tclasLength); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->tclasLength); if (primitive->tclasLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->tclas, ((CsrUint16) (primitive->tclasLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->tclas, ((u16) (primitive->tclasLength))); } return(ptr); } @@ -535,13 +535,13 @@ void* CsrWifiRouterCtrlTclasDelReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->tclasLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->tclasLength, buffer, &offset); if (primitive->tclasLength) { primitive->tclas = (u8 *)CsrPmemAlloc(primitive->tclasLength); - CsrMemCpyDes(primitive->tclas, buffer, &offset, ((CsrUint16) (primitive->tclasLength))); + CsrMemCpyDes(primitive->tclas, buffer, &offset, ((u16) (primitive->tclasLength))); } else { @@ -565,10 +565,10 @@ CsrSize CsrWifiRouterCtrlTrafficClassificationReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 1; /* CsrWifiRouterCtrlTrafficType primitive->trafficType */ - bufferSize += 2; /* CsrUint16 primitive->period */ + bufferSize += 2; /* u16 primitive->period */ return bufferSize; } @@ -578,10 +578,10 @@ u8* CsrWifiRouterCtrlTrafficClassificationReqSer(u8 *ptr, CsrSize *len, void *ms CsrWifiRouterCtrlTrafficClassificationReq *primitive = (CsrWifiRouterCtrlTrafficClassificationReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); CsrUint8Ser(ptr, len, (u8) primitive->trafficType); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->period); + CsrUint16Ser(ptr, len, (u16) primitive->period); return(ptr); } @@ -593,10 +593,10 @@ void* CsrWifiRouterCtrlTrafficClassificationReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); CsrUint8Des((u8 *) &primitive->trafficType, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->period, buffer, &offset); + CsrUint16Des((u16 *) &primitive->period, buffer, &offset); return primitive; } @@ -607,10 +607,10 @@ CsrSize CsrWifiRouterCtrlTrafficConfigReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 24) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrWifiRouterCtrlTrafficConfigType primitive->trafficConfigType */ - bufferSize += 2; /* CsrUint16 primitive->config.packetFilter */ + bufferSize += 2; /* u16 primitive->config.packetFilter */ bufferSize += 4; /* CsrUint32 primitive->config.customFilter.etherType */ bufferSize += 1; /* u8 primitive->config.customFilter.ipType */ bufferSize += 4; /* CsrUint32 primitive->config.customFilter.udpSourcePort */ @@ -624,10 +624,10 @@ u8* CsrWifiRouterCtrlTrafficConfigReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlTrafficConfigReq *primitive = (CsrWifiRouterCtrlTrafficConfigReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->trafficConfigType); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->config.packetFilter); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->trafficConfigType); + CsrUint16Ser(ptr, len, (u16) primitive->config.packetFilter); CsrUint32Ser(ptr, len, (CsrUint32) primitive->config.customFilter.etherType); CsrUint8Ser(ptr, len, (u8) primitive->config.customFilter.ipType); CsrUint32Ser(ptr, len, (CsrUint32) primitive->config.customFilter.udpSourcePort); @@ -643,10 +643,10 @@ void* CsrWifiRouterCtrlTrafficConfigReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->trafficConfigType, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->config.packetFilter, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->trafficConfigType, buffer, &offset); + CsrUint16Des((u16 *) &primitive->config.packetFilter, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->config.customFilter.etherType, buffer, &offset); CsrUint8Des((u8 *) &primitive->config.customFilter.ipType, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->config.customFilter.udpSourcePort, buffer, &offset); @@ -674,11 +674,11 @@ u8* CsrWifiRouterCtrlWifiOnReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlWifiOnReq *primitive = (CsrWifiRouterCtrlWifiOnReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); CsrUint32Ser(ptr, len, (CsrUint32) primitive->dataLength); if (primitive->dataLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->data, ((CsrUint16) (primitive->dataLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength))); } return(ptr); } @@ -691,12 +691,12 @@ void* CsrWifiRouterCtrlWifiOnReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->dataLength, buffer, &offset); if (primitive->dataLength) { primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); - CsrMemCpyDes(primitive->data, buffer, &offset, ((CsrUint16) (primitive->dataLength))); + CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength))); } else { @@ -723,9 +723,9 @@ CsrSize CsrWifiRouterCtrlWifiOnResSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 30) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 2; /* CsrUint16 primitive->numInterfaceAddress */ + bufferSize += 2; /* u16 primitive->numInterfaceAddress */ { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < 2; i1++) { bufferSize += 6; /* u8 primitive->stationMacAddress[i1].a[6] */ @@ -744,14 +744,14 @@ u8* CsrWifiRouterCtrlWifiOnResSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlWifiOnRes *primitive = (CsrWifiRouterCtrlWifiOnRes *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->numInterfaceAddress); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->numInterfaceAddress); { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < 2; i1++) { - CsrMemCpySer(ptr, len, (const void *) primitive->stationMacAddress[i1].a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->stationMacAddress[i1].a, ((u16) (6))); } } CsrUint32Ser(ptr, len, (CsrUint32) primitive->smeVersions.firmwarePatch); @@ -769,14 +769,14 @@ void* CsrWifiRouterCtrlWifiOnResDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->numInterfaceAddress, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->numInterfaceAddress, buffer, &offset); { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < 2; i1++) { - CsrMemCpyDes(primitive->stationMacAddress[i1].a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->stationMacAddress[i1].a, buffer, &offset, ((u16) (6))); } } CsrUint32Des((CsrUint32 *) &primitive->smeVersions.firmwarePatch, buffer, &offset); @@ -801,7 +801,7 @@ CsrSize CsrWifiRouterCtrlM4TransmitReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ return bufferSize; } @@ -812,8 +812,8 @@ u8* CsrWifiRouterCtrlM4TransmitReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlM4TransmitReq *primitive = (CsrWifiRouterCtrlM4TransmitReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); return(ptr); } @@ -825,8 +825,8 @@ void* CsrWifiRouterCtrlM4TransmitReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); return primitive; } @@ -837,7 +837,7 @@ CsrSize CsrWifiRouterCtrlModeSetReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 16) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 1; /* CsrWifiRouterCtrlMode primitive->mode */ bufferSize += 6; /* u8 primitive->bssid.a[6] */ @@ -852,10 +852,10 @@ u8* CsrWifiRouterCtrlModeSetReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlModeSetReq *primitive = (CsrWifiRouterCtrlModeSetReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); CsrUint8Ser(ptr, len, (u8) primitive->mode); - CsrMemCpySer(ptr, len, (const void *) primitive->bssid.a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->bssid.a, ((u16) (6))); CsrUint8Ser(ptr, len, (u8) primitive->protection); CsrUint8Ser(ptr, len, (u8) primitive->intraBssDistEnabled); return(ptr); @@ -869,10 +869,10 @@ void* CsrWifiRouterCtrlModeSetReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); CsrUint8Des((u8 *) &primitive->mode, buffer, &offset); - CsrMemCpyDes(primitive->bssid.a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->bssid.a, buffer, &offset, ((u16) (6))); CsrUint8Des((u8 *) &primitive->protection, buffer, &offset); CsrUint8Des((u8 *) &primitive->intraBssDistEnabled, buffer, &offset); @@ -885,14 +885,14 @@ CsrSize CsrWifiRouterCtrlPeerAddReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 21) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ - bufferSize += 2; /* CsrUint16 primitive->associationId */ + bufferSize += 2; /* u16 primitive->associationId */ bufferSize += 1; /* CsrBool primitive->staInfo.wmmOrQosEnabled */ bufferSize += 2; /* CsrWifiRouterCtrlPowersaveTypeMask primitive->staInfo.powersaveMode */ bufferSize += 1; /* u8 primitive->staInfo.maxSpLength */ - bufferSize += 2; /* CsrUint16 primitive->staInfo.listenIntervalInTus */ + bufferSize += 2; /* u16 primitive->staInfo.listenIntervalInTus */ return bufferSize; } @@ -902,14 +902,14 @@ u8* CsrWifiRouterCtrlPeerAddReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlPeerAddReq *primitive = (CsrWifiRouterCtrlPeerAddReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->associationId); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->associationId); CsrUint8Ser(ptr, len, (u8) primitive->staInfo.wmmOrQosEnabled); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->staInfo.powersaveMode); + CsrUint16Ser(ptr, len, (u16) primitive->staInfo.powersaveMode); CsrUint8Ser(ptr, len, (u8) primitive->staInfo.maxSpLength); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->staInfo.listenIntervalInTus); + CsrUint16Ser(ptr, len, (u16) primitive->staInfo.listenIntervalInTus); return(ptr); } @@ -921,14 +921,14 @@ void* CsrWifiRouterCtrlPeerAddReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint16Des((CsrUint16 *) &primitive->associationId, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); + CsrUint16Des((u16 *) &primitive->associationId, buffer, &offset); CsrUint8Des((u8 *) &primitive->staInfo.wmmOrQosEnabled, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->staInfo.powersaveMode, buffer, &offset); + CsrUint16Des((u16 *) &primitive->staInfo.powersaveMode, buffer, &offset); CsrUint8Des((u8 *) &primitive->staInfo.maxSpLength, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->staInfo.listenIntervalInTus, buffer, &offset); + CsrUint16Des((u16 *) &primitive->staInfo.listenIntervalInTus, buffer, &offset); return primitive; } @@ -939,7 +939,7 @@ CsrSize CsrWifiRouterCtrlPeerDelReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 4; /* CsrWifiRouterCtrlPeerRecordHandle primitive->peerRecordHandle */ return bufferSize; @@ -951,8 +951,8 @@ u8* CsrWifiRouterCtrlPeerDelReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlPeerDelReq *primitive = (CsrWifiRouterCtrlPeerDelReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); CsrUint32Ser(ptr, len, (CsrUint32) primitive->peerRecordHandle); return(ptr); } @@ -965,8 +965,8 @@ void* CsrWifiRouterCtrlPeerDelReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->peerRecordHandle, buffer, &offset); return primitive; @@ -978,7 +978,7 @@ CsrSize CsrWifiRouterCtrlPeerUpdateReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 4; /* CsrWifiRouterCtrlPeerRecordHandle primitive->peerRecordHandle */ bufferSize += 2; /* CsrWifiRouterCtrlPowersaveTypeMask primitive->powersaveMode */ @@ -991,10 +991,10 @@ u8* CsrWifiRouterCtrlPeerUpdateReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlPeerUpdateReq *primitive = (CsrWifiRouterCtrlPeerUpdateReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); CsrUint32Ser(ptr, len, (CsrUint32) primitive->peerRecordHandle); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->powersaveMode); + CsrUint16Ser(ptr, len, (u16) primitive->powersaveMode); return(ptr); } @@ -1006,10 +1006,10 @@ void* CsrWifiRouterCtrlPeerUpdateReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->peerRecordHandle, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->powersaveMode, buffer, &offset); + CsrUint16Des((u16 *) &primitive->powersaveMode, buffer, &offset); return primitive; } @@ -1020,14 +1020,14 @@ CsrSize CsrWifiRouterCtrlBlockAckEnableReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 21) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 6; /* u8 primitive->macAddress.a[6] */ bufferSize += 1; /* CsrWifiRouterCtrlTrafficStreamId primitive->trafficStreamID */ bufferSize += 1; /* CsrWifiRouterCtrlBlockAckRole primitive->role */ - bufferSize += 2; /* CsrUint16 primitive->bufferSize */ - bufferSize += 2; /* CsrUint16 primitive->timeout */ - bufferSize += 2; /* CsrUint16 primitive->ssn */ + bufferSize += 2; /* u16 primitive->bufferSize */ + bufferSize += 2; /* u16 primitive->timeout */ + bufferSize += 2; /* u16 primitive->ssn */ return bufferSize; } @@ -1037,14 +1037,14 @@ u8* CsrWifiRouterCtrlBlockAckEnableReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlBlockAckEnableReq *primitive = (CsrWifiRouterCtrlBlockAckEnableReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrMemCpySer(ptr, len, (const void *) primitive->macAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrMemCpySer(ptr, len, (const void *) primitive->macAddress.a, ((u16) (6))); CsrUint8Ser(ptr, len, (u8) primitive->trafficStreamID); CsrUint8Ser(ptr, len, (u8) primitive->role); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->bufferSize); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->timeout); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->ssn); + CsrUint16Ser(ptr, len, (u16) primitive->bufferSize); + CsrUint16Ser(ptr, len, (u16) primitive->timeout); + CsrUint16Ser(ptr, len, (u16) primitive->ssn); return(ptr); } @@ -1056,14 +1056,14 @@ void* CsrWifiRouterCtrlBlockAckEnableReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrMemCpyDes(primitive->macAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrMemCpyDes(primitive->macAddress.a, buffer, &offset, ((u16) (6))); CsrUint8Des((u8 *) &primitive->trafficStreamID, buffer, &offset); CsrUint8Des((u8 *) &primitive->role, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->bufferSize, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->timeout, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->ssn, buffer, &offset); + CsrUint16Des((u16 *) &primitive->bufferSize, buffer, &offset); + CsrUint16Des((u16 *) &primitive->timeout, buffer, &offset); + CsrUint16Des((u16 *) &primitive->ssn, buffer, &offset); return primitive; } @@ -1074,7 +1074,7 @@ CsrSize CsrWifiRouterCtrlBlockAckDisableReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 6; /* u8 primitive->macAddress.a[6] */ bufferSize += 1; /* CsrWifiRouterCtrlTrafficStreamId primitive->trafficStreamID */ @@ -1088,9 +1088,9 @@ u8* CsrWifiRouterCtrlBlockAckDisableReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlBlockAckDisableReq *primitive = (CsrWifiRouterCtrlBlockAckDisableReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrMemCpySer(ptr, len, (const void *) primitive->macAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrMemCpySer(ptr, len, (const void *) primitive->macAddress.a, ((u16) (6))); CsrUint8Ser(ptr, len, (u8) primitive->trafficStreamID); CsrUint8Ser(ptr, len, (u8) primitive->role); return(ptr); @@ -1104,9 +1104,9 @@ void* CsrWifiRouterCtrlBlockAckDisableReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrMemCpyDes(primitive->macAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrMemCpyDes(primitive->macAddress.a, buffer, &offset, ((u16) (6))); CsrUint8Des((u8 *) &primitive->trafficStreamID, buffer, &offset); CsrUint8Des((u8 *) &primitive->role, buffer, &offset); @@ -1120,10 +1120,10 @@ CsrSize CsrWifiRouterCtrlWapiRxPktReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ - bufferSize += 2; /* CsrUint16 primitive->signalLength */ + bufferSize += 2; /* u16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->signalLength */ bufferSize += primitive->signalLength; /* u8 primitive->signal */ - bufferSize += 2; /* CsrUint16 primitive->dataLength */ + bufferSize += 2; /* u16 primitive->dataLength */ bufferSize += primitive->dataLength; /* u8 primitive->data */ return bufferSize; } @@ -1134,16 +1134,16 @@ u8* CsrWifiRouterCtrlWapiRxPktReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlWapiRxPktReq *primitive = (CsrWifiRouterCtrlWapiRxPktReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->signalLength); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->signalLength); if (primitive->signalLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->signal, ((CsrUint16) (primitive->signalLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->signal, ((u16) (primitive->signalLength))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->dataLength); + CsrUint16Ser(ptr, len, (u16) primitive->dataLength); if (primitive->dataLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->data, ((CsrUint16) (primitive->dataLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength))); } return(ptr); } @@ -1156,22 +1156,22 @@ void* CsrWifiRouterCtrlWapiRxPktReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->signalLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->signalLength, buffer, &offset); if (primitive->signalLength) { primitive->signal = (u8 *)CsrPmemAlloc(primitive->signalLength); - CsrMemCpyDes(primitive->signal, buffer, &offset, ((CsrUint16) (primitive->signalLength))); + CsrMemCpyDes(primitive->signal, buffer, &offset, ((u16) (primitive->signalLength))); } else { primitive->signal = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->dataLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->dataLength, buffer, &offset); if (primitive->dataLength) { primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); - CsrMemCpyDes(primitive->data, buffer, &offset, ((CsrUint16) (primitive->dataLength))); + CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength))); } else { @@ -1197,8 +1197,8 @@ CsrSize CsrWifiRouterCtrlWapiUnicastTxPktReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ - bufferSize += 2; /* CsrUint16 primitive->dataLength */ + bufferSize += 2; /* u16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->dataLength */ bufferSize += primitive->dataLength; /* u8 primitive->data */ return bufferSize; } @@ -1209,11 +1209,11 @@ u8* CsrWifiRouterCtrlWapiUnicastTxPktReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlWapiUnicastTxPktReq *primitive = (CsrWifiRouterCtrlWapiUnicastTxPktReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->dataLength); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->dataLength); if (primitive->dataLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->data, ((CsrUint16) (primitive->dataLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength))); } return(ptr); } @@ -1226,12 +1226,12 @@ void* CsrWifiRouterCtrlWapiUnicastTxPktReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->dataLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->dataLength, buffer, &offset); if (primitive->dataLength) { primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); - CsrMemCpyDes(primitive->data, buffer, &offset, ((CsrUint16) (primitive->dataLength))); + CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength))); } else { @@ -1256,11 +1256,11 @@ CsrSize CsrWifiRouterCtrlHipIndSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */ - bufferSize += 2; /* CsrUint16 primitive->mlmeCommandLength */ + bufferSize += 2; /* u16 primitive->mlmeCommandLength */ bufferSize += primitive->mlmeCommandLength; /* u8 primitive->mlmeCommand */ - bufferSize += 2; /* CsrUint16 primitive->dataRef1Length */ + bufferSize += 2; /* u16 primitive->dataRef1Length */ bufferSize += primitive->dataRef1Length; /* u8 primitive->dataRef1 */ - bufferSize += 2; /* CsrUint16 primitive->dataRef2Length */ + bufferSize += 2; /* u16 primitive->dataRef2Length */ bufferSize += primitive->dataRef2Length; /* u8 primitive->dataRef2 */ return bufferSize; } @@ -1271,20 +1271,20 @@ u8* CsrWifiRouterCtrlHipIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlHipInd *primitive = (CsrWifiRouterCtrlHipInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->mlmeCommandLength); + CsrUint16Ser(ptr, len, (u16) primitive->mlmeCommandLength); if (primitive->mlmeCommandLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->mlmeCommand, ((CsrUint16) (primitive->mlmeCommandLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->mlmeCommand, ((u16) (primitive->mlmeCommandLength))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->dataRef1Length); + CsrUint16Ser(ptr, len, (u16) primitive->dataRef1Length); if (primitive->dataRef1Length) { - CsrMemCpySer(ptr, len, (const void *) primitive->dataRef1, ((CsrUint16) (primitive->dataRef1Length))); + CsrMemCpySer(ptr, len, (const void *) primitive->dataRef1, ((u16) (primitive->dataRef1Length))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->dataRef2Length); + CsrUint16Ser(ptr, len, (u16) primitive->dataRef2Length); if (primitive->dataRef2Length) { - CsrMemCpySer(ptr, len, (const void *) primitive->dataRef2, ((CsrUint16) (primitive->dataRef2Length))); + CsrMemCpySer(ptr, len, (const void *) primitive->dataRef2, ((u16) (primitive->dataRef2Length))); } return(ptr); } @@ -1297,31 +1297,31 @@ void* CsrWifiRouterCtrlHipIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->mlmeCommandLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->mlmeCommandLength, buffer, &offset); if (primitive->mlmeCommandLength) { primitive->mlmeCommand = (u8 *)CsrPmemAlloc(primitive->mlmeCommandLength); - CsrMemCpyDes(primitive->mlmeCommand, buffer, &offset, ((CsrUint16) (primitive->mlmeCommandLength))); + CsrMemCpyDes(primitive->mlmeCommand, buffer, &offset, ((u16) (primitive->mlmeCommandLength))); } else { primitive->mlmeCommand = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->dataRef1Length, buffer, &offset); + CsrUint16Des((u16 *) &primitive->dataRef1Length, buffer, &offset); if (primitive->dataRef1Length) { primitive->dataRef1 = (u8 *)CsrPmemAlloc(primitive->dataRef1Length); - CsrMemCpyDes(primitive->dataRef1, buffer, &offset, ((CsrUint16) (primitive->dataRef1Length))); + CsrMemCpyDes(primitive->dataRef1, buffer, &offset, ((u16) (primitive->dataRef1Length))); } else { primitive->dataRef1 = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->dataRef2Length, buffer, &offset); + CsrUint16Des((u16 *) &primitive->dataRef2Length, buffer, &offset); if (primitive->dataRef2Length) { primitive->dataRef2 = (u8 *)CsrPmemAlloc(primitive->dataRef2Length); - CsrMemCpyDes(primitive->dataRef2, buffer, &offset, ((CsrUint16) (primitive->dataRef2Length))); + CsrMemCpyDes(primitive->dataRef2, buffer, &offset, ((u16) (primitive->dataRef2Length))); } else { @@ -1349,11 +1349,11 @@ CsrSize CsrWifiRouterCtrlMulticastAddressIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiRouterCtrlListAction primitive->action */ bufferSize += 1; /* u8 primitive->setAddressesCount */ { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->setAddressesCount; i1++) { bufferSize += 6; /* u8 primitive->setAddresses[i1].a[6] */ @@ -1368,15 +1368,15 @@ u8* CsrWifiRouterCtrlMulticastAddressIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlMulticastAddressInd *primitive = (CsrWifiRouterCtrlMulticastAddressInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->action); CsrUint8Ser(ptr, len, (u8) primitive->setAddressesCount); { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->setAddressesCount; i1++) { - CsrMemCpySer(ptr, len, (const void *) primitive->setAddresses[i1].a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->setAddresses[i1].a, ((u16) (6))); } } return(ptr); @@ -1390,8 +1390,8 @@ void* CsrWifiRouterCtrlMulticastAddressIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->action, buffer, &offset); CsrUint8Des((u8 *) &primitive->setAddressesCount, buffer, &offset); primitive->setAddresses = NULL; @@ -1400,10 +1400,10 @@ void* CsrWifiRouterCtrlMulticastAddressIndDes(u8 *buffer, CsrSize length) primitive->setAddresses = (CsrWifiMacAddress *)CsrPmemAlloc(sizeof(CsrWifiMacAddress) * primitive->setAddressesCount); } { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->setAddressesCount; i1++) { - CsrMemCpyDes(primitive->setAddresses[i1].a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->setAddresses[i1].a, buffer, &offset, ((u16) (6))); } } @@ -1425,7 +1425,7 @@ CsrSize CsrWifiRouterCtrlPortConfigureCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 6; /* u8 primitive->macAddress.a[6] */ return bufferSize; @@ -1437,10 +1437,10 @@ u8* CsrWifiRouterCtrlPortConfigureCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlPortConfigureCfm *primitive = (CsrWifiRouterCtrlPortConfigureCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrMemCpySer(ptr, len, (const void *) primitive->macAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); + CsrMemCpySer(ptr, len, (const void *) primitive->macAddress.a, ((u16) (6))); return(ptr); } @@ -1452,10 +1452,10 @@ void* CsrWifiRouterCtrlPortConfigureCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrMemCpyDes(primitive->macAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); + CsrMemCpyDes(primitive->macAddress.a, buffer, &offset, ((u16) (6))); return primitive; } @@ -1478,7 +1478,7 @@ u8* CsrWifiRouterCtrlSuspendIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlSuspendInd *primitive = (CsrWifiRouterCtrlSuspendInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); CsrUint8Ser(ptr, len, (u8) primitive->hardSuspend); CsrUint8Ser(ptr, len, (u8) primitive->d3Suspend); return(ptr); @@ -1492,7 +1492,7 @@ void* CsrWifiRouterCtrlSuspendIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); CsrUint8Des((u8 *) &primitive->hardSuspend, buffer, &offset); CsrUint8Des((u8 *) &primitive->d3Suspend, buffer, &offset); @@ -1506,7 +1506,7 @@ CsrSize CsrWifiRouterCtrlTclasAddCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ return bufferSize; } @@ -1517,9 +1517,9 @@ u8* CsrWifiRouterCtrlTclasAddCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlTclasAddCfm *primitive = (CsrWifiRouterCtrlTclasAddCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -1531,9 +1531,9 @@ void* CsrWifiRouterCtrlTclasAddCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -1555,8 +1555,8 @@ u8* CsrWifiRouterCtrlRawSdioDeinitialiseCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlRawSdioDeinitialiseCfm *primitive = (CsrWifiRouterCtrlRawSdioDeinitialiseCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->result); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->result); return(ptr); } @@ -1568,8 +1568,8 @@ void* CsrWifiRouterCtrlRawSdioDeinitialiseCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->result, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->result, buffer, &offset); return primitive; } @@ -1599,8 +1599,8 @@ u8* CsrWifiRouterCtrlRawSdioInitialiseCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlRawSdioInitialiseCfm *primitive = (CsrWifiRouterCtrlRawSdioInitialiseCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->result); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->result); CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->byteRead */ CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->byteWrite */ CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->firmwareDownload */ @@ -1620,8 +1620,8 @@ void* CsrWifiRouterCtrlRawSdioInitialiseCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->result, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->result, buffer, &offset); primitive->byteRead = NULL; /* Special for Function Pointers... */ offset += 4; primitive->byteWrite = NULL; /* Special for Function Pointers... */ @@ -1649,7 +1649,7 @@ CsrSize CsrWifiRouterCtrlTclasDelCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ return bufferSize; } @@ -1660,9 +1660,9 @@ u8* CsrWifiRouterCtrlTclasDelCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlTclasDelCfm *primitive = (CsrWifiRouterCtrlTclasDelCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -1674,9 +1674,9 @@ void* CsrWifiRouterCtrlTclasDelCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -1688,7 +1688,7 @@ CsrSize CsrWifiRouterCtrlTrafficProtocolIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrWifiRouterCtrlTrafficPacketType primitive->packetType */ bufferSize += 2; /* CsrWifiRouterCtrlProtocolDirection primitive->direction */ bufferSize += 6; /* u8 primitive->srcAddress.a[6] */ @@ -1701,11 +1701,11 @@ u8* CsrWifiRouterCtrlTrafficProtocolIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlTrafficProtocolInd *primitive = (CsrWifiRouterCtrlTrafficProtocolInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->packetType); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->direction); - CsrMemCpySer(ptr, len, (const void *) primitive->srcAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->packetType); + CsrUint16Ser(ptr, len, (u16) primitive->direction); + CsrMemCpySer(ptr, len, (const void *) primitive->srcAddress.a, ((u16) (6))); return(ptr); } @@ -1717,11 +1717,11 @@ void* CsrWifiRouterCtrlTrafficProtocolIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->packetType, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->direction, buffer, &offset); - CsrMemCpyDes(primitive->srcAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->packetType, buffer, &offset); + CsrUint16Des((u16 *) &primitive->direction, buffer, &offset); + CsrMemCpyDes(primitive->srcAddress.a, buffer, &offset, ((u16) (6))); return primitive; } @@ -1733,7 +1733,7 @@ CsrSize CsrWifiRouterCtrlTrafficSampleIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 38) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 4; /* CsrUint32 primitive->stats.rxMeanRate */ bufferSize += 4; /* CsrUint32 primitive->stats.rxFramesNum */ bufferSize += 4; /* CsrUint32 primitive->stats.txFramesNum */ @@ -1749,14 +1749,14 @@ u8* CsrWifiRouterCtrlTrafficSampleIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlTrafficSampleInd *primitive = (CsrWifiRouterCtrlTrafficSampleInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint32Ser(ptr, len, (CsrUint32) primitive->stats.rxMeanRate); CsrUint32Ser(ptr, len, (CsrUint32) primitive->stats.rxFramesNum); CsrUint32Ser(ptr, len, (CsrUint32) primitive->stats.txFramesNum); CsrUint32Ser(ptr, len, (CsrUint32) primitive->stats.rxBytesCount); CsrUint32Ser(ptr, len, (CsrUint32) primitive->stats.txBytesCount); - CsrMemCpySer(ptr, len, (const void *) primitive->stats.intervals, ((CsrUint16) (11))); + CsrMemCpySer(ptr, len, (const void *) primitive->stats.intervals, ((u16) (11))); return(ptr); } @@ -1768,14 +1768,14 @@ void* CsrWifiRouterCtrlTrafficSampleIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->stats.rxMeanRate, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->stats.rxFramesNum, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->stats.txFramesNum, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->stats.rxBytesCount, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->stats.txBytesCount, buffer, &offset); - CsrMemCpyDes(primitive->stats.intervals, buffer, &offset, ((CsrUint16) (11))); + CsrMemCpyDes(primitive->stats.intervals, buffer, &offset, ((u16) (11))); return primitive; } @@ -1804,8 +1804,8 @@ u8* CsrWifiRouterCtrlWifiOnIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlWifiOnInd *primitive = (CsrWifiRouterCtrlWifiOnInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->status); CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.chipId); CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.chipVersion); CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.firmwareBuild); @@ -1823,8 +1823,8 @@ void* CsrWifiRouterCtrlWifiOnIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->versions.chipId, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->versions.chipVersion, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->versions.firmwareBuild, buffer, &offset); @@ -1860,8 +1860,8 @@ u8* CsrWifiRouterCtrlWifiOnCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlWifiOnCfm *primitive = (CsrWifiRouterCtrlWifiOnCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -1873,8 +1873,8 @@ void* CsrWifiRouterCtrlWifiOnCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -1886,7 +1886,7 @@ CsrSize CsrWifiRouterCtrlM4ReadyToSendIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ return bufferSize; } @@ -1897,9 +1897,9 @@ u8* CsrWifiRouterCtrlM4ReadyToSendIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlM4ReadyToSendInd *primitive = (CsrWifiRouterCtrlM4ReadyToSendInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); return(ptr); } @@ -1911,9 +1911,9 @@ void* CsrWifiRouterCtrlM4ReadyToSendIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); return primitive; } @@ -1925,7 +1925,7 @@ CsrSize CsrWifiRouterCtrlM4TransmittedIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ bufferSize += 2; /* CsrResult primitive->status */ return bufferSize; @@ -1937,10 +1937,10 @@ u8* CsrWifiRouterCtrlM4TransmittedIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlM4TransmittedInd *primitive = (CsrWifiRouterCtrlM4TransmittedInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -1952,10 +1952,10 @@ void* CsrWifiRouterCtrlM4TransmittedIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -1967,7 +1967,7 @@ CsrSize CsrWifiRouterCtrlMicFailureIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ bufferSize += 1; /* CsrBool primitive->unicastPdu */ return bufferSize; @@ -1979,9 +1979,9 @@ u8* CsrWifiRouterCtrlMicFailureIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlMicFailureInd *primitive = (CsrWifiRouterCtrlMicFailureInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); CsrUint8Ser(ptr, len, (u8) primitive->unicastPdu); return(ptr); } @@ -1994,9 +1994,9 @@ void* CsrWifiRouterCtrlMicFailureIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); CsrUint8Des((u8 *) &primitive->unicastPdu, buffer, &offset); return primitive; @@ -2009,7 +2009,7 @@ CsrSize CsrWifiRouterCtrlConnectedIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ bufferSize += 1; /* CsrWifiRouterCtrlPeerStatus primitive->peerStatus */ return bufferSize; @@ -2021,9 +2021,9 @@ u8* CsrWifiRouterCtrlConnectedIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlConnectedInd *primitive = (CsrWifiRouterCtrlConnectedInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); CsrUint8Ser(ptr, len, (u8) primitive->peerStatus); return(ptr); } @@ -2036,9 +2036,9 @@ void* CsrWifiRouterCtrlConnectedIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); CsrUint8Des((u8 *) &primitive->peerStatus, buffer, &offset); return primitive; @@ -2051,7 +2051,7 @@ CsrSize CsrWifiRouterCtrlPeerAddCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 19) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ bufferSize += 4; /* CsrWifiRouterCtrlPeerRecordHandle primitive->peerRecordHandle */ bufferSize += 2; /* CsrResult primitive->status */ @@ -2064,11 +2064,11 @@ u8* CsrWifiRouterCtrlPeerAddCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlPeerAddCfm *primitive = (CsrWifiRouterCtrlPeerAddCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); CsrUint32Ser(ptr, len, (CsrUint32) primitive->peerRecordHandle); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -2080,11 +2080,11 @@ void* CsrWifiRouterCtrlPeerAddCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); CsrUint32Des((CsrUint32 *) &primitive->peerRecordHandle, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -2096,7 +2096,7 @@ CsrSize CsrWifiRouterCtrlPeerDelCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ return bufferSize; } @@ -2107,9 +2107,9 @@ u8* CsrWifiRouterCtrlPeerDelCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlPeerDelCfm *primitive = (CsrWifiRouterCtrlPeerDelCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -2121,9 +2121,9 @@ void* CsrWifiRouterCtrlPeerDelCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -2135,7 +2135,7 @@ CsrSize CsrWifiRouterCtrlUnexpectedFrameIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ return bufferSize; } @@ -2146,9 +2146,9 @@ u8* CsrWifiRouterCtrlUnexpectedFrameIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlUnexpectedFrameInd *primitive = (CsrWifiRouterCtrlUnexpectedFrameInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); return(ptr); } @@ -2160,9 +2160,9 @@ void* CsrWifiRouterCtrlUnexpectedFrameIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); return primitive; } @@ -2174,7 +2174,7 @@ CsrSize CsrWifiRouterCtrlPeerUpdateCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ return bufferSize; } @@ -2185,9 +2185,9 @@ u8* CsrWifiRouterCtrlPeerUpdateCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlPeerUpdateCfm *primitive = (CsrWifiRouterCtrlPeerUpdateCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -2199,9 +2199,9 @@ void* CsrWifiRouterCtrlPeerUpdateCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -2213,8 +2213,8 @@ CsrSize CsrWifiRouterCtrlCapabilitiesCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->commandQueueSize */ - bufferSize += 2; /* CsrUint16 primitive->trafficQueueSize */ + bufferSize += 2; /* u16 primitive->commandQueueSize */ + bufferSize += 2; /* u16 primitive->trafficQueueSize */ return bufferSize; } @@ -2224,9 +2224,9 @@ u8* CsrWifiRouterCtrlCapabilitiesCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlCapabilitiesCfm *primitive = (CsrWifiRouterCtrlCapabilitiesCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->commandQueueSize); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->trafficQueueSize); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->commandQueueSize); + CsrUint16Ser(ptr, len, (u16) primitive->trafficQueueSize); return(ptr); } @@ -2238,9 +2238,9 @@ void* CsrWifiRouterCtrlCapabilitiesCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->commandQueueSize, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->trafficQueueSize, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->commandQueueSize, buffer, &offset); + CsrUint16Des((u16 *) &primitive->trafficQueueSize, buffer, &offset); return primitive; } @@ -2252,7 +2252,7 @@ CsrSize CsrWifiRouterCtrlBlockAckEnableCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ return bufferSize; } @@ -2263,9 +2263,9 @@ u8* CsrWifiRouterCtrlBlockAckEnableCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlBlockAckEnableCfm *primitive = (CsrWifiRouterCtrlBlockAckEnableCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -2277,9 +2277,9 @@ void* CsrWifiRouterCtrlBlockAckEnableCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -2291,7 +2291,7 @@ CsrSize CsrWifiRouterCtrlBlockAckDisableCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ return bufferSize; } @@ -2302,9 +2302,9 @@ u8* CsrWifiRouterCtrlBlockAckDisableCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlBlockAckDisableCfm *primitive = (CsrWifiRouterCtrlBlockAckDisableCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -2316,9 +2316,9 @@ void* CsrWifiRouterCtrlBlockAckDisableCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -2330,7 +2330,7 @@ CsrSize CsrWifiRouterCtrlBlockAckErrorIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 16) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiRouterCtrlTrafficStreamId primitive->trafficStreamID */ bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ bufferSize += 2; /* CsrResult primitive->status */ @@ -2343,11 +2343,11 @@ u8* CsrWifiRouterCtrlBlockAckErrorIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlBlockAckErrorInd *primitive = (CsrWifiRouterCtrlBlockAckErrorInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->trafficStreamID); - CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -2359,11 +2359,11 @@ void* CsrWifiRouterCtrlBlockAckErrorIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->trafficStreamID, buffer, &offset); - CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -2375,7 +2375,7 @@ CsrSize CsrWifiRouterCtrlStaInactiveIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 6; /* u8 primitive->staAddress.a[6] */ return bufferSize; } @@ -2386,9 +2386,9 @@ u8* CsrWifiRouterCtrlStaInactiveIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlStaInactiveInd *primitive = (CsrWifiRouterCtrlStaInactiveInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrMemCpySer(ptr, len, (const void *) primitive->staAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrMemCpySer(ptr, len, (const void *) primitive->staAddress.a, ((u16) (6))); return(ptr); } @@ -2400,9 +2400,9 @@ void* CsrWifiRouterCtrlStaInactiveIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrMemCpyDes(primitive->staAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrMemCpyDes(primitive->staAddress.a, buffer, &offset, ((u16) (6))); return primitive; } @@ -2415,10 +2415,10 @@ CsrSize CsrWifiRouterCtrlWapiRxMicCheckIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ - bufferSize += 2; /* CsrUint16 primitive->signalLength */ + bufferSize += 2; /* u16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->signalLength */ bufferSize += primitive->signalLength; /* u8 primitive->signal */ - bufferSize += 2; /* CsrUint16 primitive->dataLength */ + bufferSize += 2; /* u16 primitive->dataLength */ bufferSize += primitive->dataLength; /* u8 primitive->data */ return bufferSize; } @@ -2429,17 +2429,17 @@ u8* CsrWifiRouterCtrlWapiRxMicCheckIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlWapiRxMicCheckInd *primitive = (CsrWifiRouterCtrlWapiRxMicCheckInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->signalLength); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->signalLength); if (primitive->signalLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->signal, ((CsrUint16) (primitive->signalLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->signal, ((u16) (primitive->signalLength))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->dataLength); + CsrUint16Ser(ptr, len, (u16) primitive->dataLength); if (primitive->dataLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->data, ((CsrUint16) (primitive->dataLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength))); } return(ptr); } @@ -2452,23 +2452,23 @@ void* CsrWifiRouterCtrlWapiRxMicCheckIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->signalLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->signalLength, buffer, &offset); if (primitive->signalLength) { primitive->signal = (u8 *)CsrPmemAlloc(primitive->signalLength); - CsrMemCpyDes(primitive->signal, buffer, &offset, ((CsrUint16) (primitive->signalLength))); + CsrMemCpyDes(primitive->signal, buffer, &offset, ((u16) (primitive->signalLength))); } else { primitive->signal = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->dataLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->dataLength, buffer, &offset); if (primitive->dataLength) { primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); - CsrMemCpyDes(primitive->data, buffer, &offset, ((CsrUint16) (primitive->dataLength))); + CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength))); } else { @@ -2494,7 +2494,7 @@ CsrSize CsrWifiRouterCtrlModeSetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiRouterCtrlMode primitive->mode */ bufferSize += 2; /* CsrResult primitive->status */ return bufferSize; @@ -2506,10 +2506,10 @@ u8* CsrWifiRouterCtrlModeSetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterCtrlModeSetCfm *primitive = (CsrWifiRouterCtrlModeSetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->mode); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -2521,10 +2521,10 @@ void* CsrWifiRouterCtrlModeSetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->mode, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -2537,8 +2537,8 @@ CsrSize CsrWifiRouterCtrlWapiUnicastTxEncryptIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ - bufferSize += 2; /* CsrUint16 primitive->dataLength */ + bufferSize += 2; /* u16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->dataLength */ bufferSize += primitive->dataLength; /* u8 primitive->data */ return bufferSize; } @@ -2549,12 +2549,12 @@ u8* CsrWifiRouterCtrlWapiUnicastTxEncryptIndSer(u8 *ptr, CsrSize *len, void *msg CsrWifiRouterCtrlWapiUnicastTxEncryptInd *primitive = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->clientData); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->dataLength); + CsrUint16Ser(ptr, len, (u16) primitive->clientData); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->dataLength); if (primitive->dataLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->data, ((CsrUint16) (primitive->dataLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength))); } return(ptr); } @@ -2567,13 +2567,13 @@ void* CsrWifiRouterCtrlWapiUnicastTxEncryptIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->dataLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->dataLength, buffer, &offset); if (primitive->dataLength) { primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); - CsrMemCpyDes(primitive->data, buffer, &offset, ((CsrUint16) (primitive->dataLength))); + CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength))); } else { diff --git a/drivers/staging/csr/csr_wifi_router_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_router_free_downstream_contents.c index 9ae6cff..24d4ae2 100644 --- a/drivers/staging/csr/csr_wifi_router_free_downstream_contents.c +++ b/drivers/staging/csr/csr_wifi_router_free_downstream_contents.c @@ -25,7 +25,7 @@ * eventClass: only the value CSR_WIFI_ROUTER_PRIM will be handled * message: the message to free *----------------------------------------------------------------------------*/ -void CsrWifiRouterFreeDownstreamMessageContents(CsrUint16 eventClass, void *message) +void CsrWifiRouterFreeDownstreamMessageContents(u16 eventClass, void *message) { if (eventClass != CSR_WIFI_ROUTER_PRIM) { diff --git a/drivers/staging/csr/csr_wifi_router_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_router_free_upstream_contents.c index 19d9c23..2faaaac 100644 --- a/drivers/staging/csr/csr_wifi_router_free_upstream_contents.c +++ b/drivers/staging/csr/csr_wifi_router_free_upstream_contents.c @@ -25,7 +25,7 @@ * eventClass: only the value CSR_WIFI_ROUTER_PRIM will be handled * message: the message to free *----------------------------------------------------------------------------*/ -void CsrWifiRouterFreeUpstreamMessageContents(CsrUint16 eventClass, void *message) +void CsrWifiRouterFreeUpstreamMessageContents(u16 eventClass, void *message) { if (eventClass != CSR_WIFI_ROUTER_PRIM) { diff --git a/drivers/staging/csr/csr_wifi_router_lib.h b/drivers/staging/csr/csr_wifi_router_lib.h index 553e7d3..4d1fb27 100644 --- a/drivers/staging/csr/csr_wifi_router_lib.h +++ b/drivers/staging/csr/csr_wifi_router_lib.h @@ -39,7 +39,7 @@ extern "C" { * PARAMETERS * Deallocates the resources in a CSR_WIFI_ROUTER upstream message *----------------------------------------------------------------------------*/ -void CsrWifiRouterFreeUpstreamMessageContents(CsrUint16 eventClass, void *message); +void CsrWifiRouterFreeUpstreamMessageContents(u16 eventClass, void *message); /*----------------------------------------------------------------------------* * CsrWifiRouterFreeDownstreamMessageContents @@ -51,7 +51,7 @@ void CsrWifiRouterFreeUpstreamMessageContents(CsrUint16 eventClass, void *messag * PARAMETERS * Deallocates the resources in a CSR_WIFI_ROUTER downstream message *----------------------------------------------------------------------------*/ -void CsrWifiRouterFreeDownstreamMessageContents(CsrUint16 eventClass, void *message); +void CsrWifiRouterFreeDownstreamMessageContents(u16 eventClass, void *message); /*----------------------------------------------------------------------------* * Enum to string functions diff --git a/drivers/staging/csr/csr_wifi_router_prim.h b/drivers/staging/csr/csr_wifi_router_prim.h index 182cbfc..b05ce1a 100644 --- a/drivers/staging/csr/csr_wifi_router_prim.h +++ b/drivers/staging/csr/csr_wifi_router_prim.h @@ -116,7 +116,7 @@ typedef CsrUint32 CsrWifiRouterOui; - See IEEE 802.11 Standard *******************************************************************************/ -typedef CsrUint16 CsrWifiRouterPriority; +typedef u16 CsrWifiRouterPriority; #define CSR_WIFI_ROUTER_PRIORITY_QOS_UP0 ((CsrWifiRouterPriority) 0x0000) #define CSR_WIFI_ROUTER_PRIORITY_QOS_UP1 ((CsrWifiRouterPriority) 0x0001) #define CSR_WIFI_ROUTER_PRIORITY_QOS_UP2 ((CsrWifiRouterPriority) 0x0002) @@ -180,9 +180,9 @@ typedef CsrUint16 CsrWifiRouterPriority; typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiRouterEncapsulation encapsulation; - CsrUint16 protocol; + u16 protocol; CsrUint32 oui; } CsrWifiRouterMaPacketSubscribeReq; @@ -203,7 +203,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; u8 subscriptionHandle; } CsrWifiRouterMaPacketUnsubscribeReq; @@ -242,9 +242,9 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; u8 subscriptionHandle; - CsrUint16 frameLength; + u16 frameLength; u8 *frame; CsrWifiRouterFrameFreeFunction freeFunction; CsrWifiRouterPriority priority; @@ -271,7 +271,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; u8 subscriptionHandle; CsrResult result; } CsrWifiRouterMaPacketRes; @@ -304,7 +304,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrUint32 hostTag; CsrWifiRouterPriority priority; CsrWifiMacAddress peerMacAddress; @@ -331,10 +331,10 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; u8 subscriptionHandle; CsrResult status; - CsrUint16 allocOffset; + u16 allocOffset; } CsrWifiRouterMaPacketSubscribeCfm; /******************************************************************************* @@ -355,7 +355,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; } CsrWifiRouterMaPacketUnsubscribeCfm; @@ -379,10 +379,10 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult result; CsrUint32 hostTag; - CsrUint16 rate; + u16 rate; } CsrWifiRouterMaPacketCfm; /******************************************************************************* @@ -410,15 +410,15 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; u8 subscriptionHandle; CsrResult result; - CsrUint16 frameLength; + u16 frameLength; u8 *frame; CsrWifiRouterFrameFreeFunction freeFunction; CsrInt16 rssi; CsrInt16 snr; - CsrUint16 rate; + u16 rate; } CsrWifiRouterMaPacketInd; diff --git a/drivers/staging/csr/csr_wifi_router_serialize.c b/drivers/staging/csr/csr_wifi_router_serialize.c index e744db8..e488564 100644 --- a/drivers/staging/csr/csr_wifi_router_serialize.c +++ b/drivers/staging/csr/csr_wifi_router_serialize.c @@ -29,9 +29,9 @@ CsrSize CsrWifiRouterMaPacketSubscribeReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiRouterEncapsulation primitive->encapsulation */ - bufferSize += 2; /* CsrUint16 primitive->protocol */ + bufferSize += 2; /* u16 primitive->protocol */ bufferSize += 4; /* CsrUint32 primitive->oui */ return bufferSize; } @@ -42,9 +42,9 @@ u8* CsrWifiRouterMaPacketSubscribeReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterMaPacketSubscribeReq *primitive = (CsrWifiRouterMaPacketSubscribeReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->encapsulation); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->protocol); + CsrUint16Ser(ptr, len, (u16) primitive->protocol); CsrUint32Ser(ptr, len, (CsrUint32) primitive->oui); return(ptr); } @@ -57,9 +57,9 @@ void* CsrWifiRouterMaPacketSubscribeReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->encapsulation, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->protocol, buffer, &offset); + CsrUint16Des((u16 *) &primitive->protocol, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->oui, buffer, &offset); return primitive; @@ -72,9 +72,9 @@ CsrSize CsrWifiRouterMaPacketReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 20) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* u8 primitive->subscriptionHandle */ - bufferSize += 2; /* CsrUint16 primitive->frameLength */ + bufferSize += 2; /* u16 primitive->frameLength */ bufferSize += primitive->frameLength; /* u8 primitive->frame */ bufferSize += 4; /* CsrWifiRouterFrameFreeFunction primitive->freeFunction */ bufferSize += 2; /* CsrWifiRouterPriority primitive->priority */ @@ -89,15 +89,15 @@ u8* CsrWifiRouterMaPacketReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->subscriptionHandle); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->frameLength); + CsrUint16Ser(ptr, len, (u16) primitive->frameLength); if (primitive->frameLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->frame, ((CsrUint16) (primitive->frameLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->frame, ((u16) (primitive->frameLength))); } CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->freeFunction */ - CsrUint16Ser(ptr, len, (CsrUint16) primitive->priority); + CsrUint16Ser(ptr, len, (u16) primitive->priority); CsrUint32Ser(ptr, len, (CsrUint32) primitive->hostTag); CsrUint8Ser(ptr, len, (u8) primitive->cfmRequested); return(ptr); @@ -111,13 +111,13 @@ void* CsrWifiRouterMaPacketReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->subscriptionHandle, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->frameLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->frameLength, buffer, &offset); if (primitive->frameLength) { primitive->frame = (u8 *)CsrPmemAlloc(primitive->frameLength); - CsrMemCpyDes(primitive->frame, buffer, &offset, ((CsrUint16) (primitive->frameLength))); + CsrMemCpyDes(primitive->frame, buffer, &offset, ((u16) (primitive->frameLength))); } else { @@ -125,7 +125,7 @@ void* CsrWifiRouterMaPacketReqDes(u8 *buffer, CsrSize length) } primitive->freeFunction = NULL; /* Special for Function Pointers... */ offset += 4; - CsrUint16Des((CsrUint16 *) &primitive->priority, buffer, &offset); + CsrUint16Des((u16 *) &primitive->priority, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->hostTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->cfmRequested, buffer, &offset); @@ -146,7 +146,7 @@ CsrSize CsrWifiRouterMaPacketResSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* u8 primitive->subscriptionHandle */ bufferSize += 2; /* CsrResult primitive->result */ return bufferSize; @@ -158,9 +158,9 @@ u8* CsrWifiRouterMaPacketResSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterMaPacketRes *primitive = (CsrWifiRouterMaPacketRes *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->subscriptionHandle); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->result); + CsrUint16Ser(ptr, len, (u16) primitive->result); return(ptr); } @@ -172,9 +172,9 @@ void* CsrWifiRouterMaPacketResDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->subscriptionHandle, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->result, buffer, &offset); + CsrUint16Des((u16 *) &primitive->result, buffer, &offset); return primitive; } @@ -185,7 +185,7 @@ CsrSize CsrWifiRouterMaPacketCancelReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 4; /* CsrUint32 primitive->hostTag */ bufferSize += 2; /* CsrWifiRouterPriority primitive->priority */ bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ @@ -198,10 +198,10 @@ u8* CsrWifiRouterMaPacketCancelReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterMaPacketCancelReq *primitive = (CsrWifiRouterMaPacketCancelReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint32Ser(ptr, len, (CsrUint32) primitive->hostTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->priority); - CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->priority); + CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); return(ptr); } @@ -213,10 +213,10 @@ void* CsrWifiRouterMaPacketCancelReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->hostTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->priority, buffer, &offset); - CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((u16 *) &primitive->priority, buffer, &offset); + CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); return primitive; } @@ -227,10 +227,10 @@ CsrSize CsrWifiRouterMaPacketSubscribeCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* u8 primitive->subscriptionHandle */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 2; /* CsrUint16 primitive->allocOffset */ + bufferSize += 2; /* u16 primitive->allocOffset */ return bufferSize; } @@ -240,10 +240,10 @@ u8* CsrWifiRouterMaPacketSubscribeCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterMaPacketSubscribeCfm *primitive = (CsrWifiRouterMaPacketSubscribeCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->subscriptionHandle); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->allocOffset); + CsrUint16Ser(ptr, len, (u16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->allocOffset); return(ptr); } @@ -255,10 +255,10 @@ void* CsrWifiRouterMaPacketSubscribeCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->subscriptionHandle, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->allocOffset, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->allocOffset, buffer, &offset); return primitive; } @@ -269,7 +269,7 @@ CsrSize CsrWifiRouterMaPacketUnsubscribeCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ return bufferSize; } @@ -280,8 +280,8 @@ u8* CsrWifiRouterMaPacketUnsubscribeCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterMaPacketUnsubscribeCfm *primitive = (CsrWifiRouterMaPacketUnsubscribeCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -293,8 +293,8 @@ void* CsrWifiRouterMaPacketUnsubscribeCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -305,10 +305,10 @@ CsrSize CsrWifiRouterMaPacketCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->result */ bufferSize += 4; /* CsrUint32 primitive->hostTag */ - bufferSize += 2; /* CsrUint16 primitive->rate */ + bufferSize += 2; /* u16 primitive->rate */ return bufferSize; } @@ -318,10 +318,10 @@ u8* CsrWifiRouterMaPacketCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterMaPacketCfm *primitive = (CsrWifiRouterMaPacketCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->result); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->result); CsrUint32Ser(ptr, len, (CsrUint32) primitive->hostTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->rate); + CsrUint16Ser(ptr, len, (u16) primitive->rate); return(ptr); } @@ -333,10 +333,10 @@ void* CsrWifiRouterMaPacketCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->result, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->result, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->hostTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->rate, buffer, &offset); + CsrUint16Des((u16 *) &primitive->rate, buffer, &offset); return primitive; } @@ -348,15 +348,15 @@ CsrSize CsrWifiRouterMaPacketIndSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 21) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* u8 primitive->subscriptionHandle */ bufferSize += 2; /* CsrResult primitive->result */ - bufferSize += 2; /* CsrUint16 primitive->frameLength */ + bufferSize += 2; /* u16 primitive->frameLength */ bufferSize += primitive->frameLength; /* u8 primitive->frame */ bufferSize += 4; /* CsrWifiRouterFrameFreeFunction primitive->freeFunction */ bufferSize += 2; /* CsrInt16 primitive->rssi */ bufferSize += 2; /* CsrInt16 primitive->snr */ - bufferSize += 2; /* CsrUint16 primitive->rate */ + bufferSize += 2; /* u16 primitive->rate */ return bufferSize; } @@ -366,18 +366,18 @@ u8* CsrWifiRouterMaPacketIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->subscriptionHandle); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->result); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->frameLength); + CsrUint16Ser(ptr, len, (u16) primitive->result); + CsrUint16Ser(ptr, len, (u16) primitive->frameLength); if (primitive->frameLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->frame, ((CsrUint16) (primitive->frameLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->frame, ((u16) (primitive->frameLength))); } CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->freeFunction */ - CsrUint16Ser(ptr, len, (CsrUint16) primitive->rssi); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->snr); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->rate); + CsrUint16Ser(ptr, len, (u16) primitive->rssi); + CsrUint16Ser(ptr, len, (u16) primitive->snr); + CsrUint16Ser(ptr, len, (u16) primitive->rate); return(ptr); } @@ -389,14 +389,14 @@ void* CsrWifiRouterMaPacketIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->subscriptionHandle, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->result, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->frameLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->result, buffer, &offset); + CsrUint16Des((u16 *) &primitive->frameLength, buffer, &offset); if (primitive->frameLength) { primitive->frame = (u8 *)CsrPmemAlloc(primitive->frameLength); - CsrMemCpyDes(primitive->frame, buffer, &offset, ((CsrUint16) (primitive->frameLength))); + CsrMemCpyDes(primitive->frame, buffer, &offset, ((u16) (primitive->frameLength))); } else { @@ -404,9 +404,9 @@ void* CsrWifiRouterMaPacketIndDes(u8 *buffer, CsrSize length) } primitive->freeFunction = NULL; /* Special for Function Pointers... */ offset += 4; - CsrUint16Des((CsrUint16 *) &primitive->rssi, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->snr, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->rate, buffer, &offset); + CsrUint16Des((u16 *) &primitive->rssi, buffer, &offset); + CsrUint16Des((u16 *) &primitive->snr, buffer, &offset); + CsrUint16Des((u16 *) &primitive->rate, buffer, &offset); return primitive; } diff --git a/drivers/staging/csr/csr_wifi_router_transport.c b/drivers/staging/csr/csr_wifi_router_transport.c index 45bee24..3247b58 100644 --- a/drivers/staging/csr/csr_wifi_router_transport.c +++ b/drivers/staging/csr/csr_wifi_router_transport.c @@ -64,10 +64,10 @@ void CsrWifiRouterTransportDeinit(unifi_priv_t *priv) void CsrWifiRouterTransportRecv(unifi_priv_t *priv, u8* buffer, CsrSize bufferLength) { CsrMsgConvMsgEntry* msgEntry; - CsrUint16 primType; + u16 primType; CsrSchedQid src; CsrSchedQid dest; - CsrUint16 msgType; + u16 msgType; CsrSize offset = 0; CsrWifiFsmEvent* msg; @@ -96,13 +96,13 @@ void CsrWifiRouterTransportRecv(unifi_priv_t *priv, u8* buffer, CsrSize bufferLe if (req.dataRef1Length) { - CsrUint16 dr1Offset = (bufferLength - req.dataRef2Length) - req.dataRef1Length; + u16 dr1Offset = (bufferLength - req.dataRef2Length) - req.dataRef1Length; req.dataRef1 = &buffer[dr1Offset]; } if (req.dataRef2Length) { - CsrUint16 dr2Offset = bufferLength - req.dataRef2Length; + u16 dr2Offset = bufferLength - req.dataRef2Length; req.dataRef2 = &buffer[dr2Offset]; } @@ -159,7 +159,7 @@ void CsrWifiRouterTransportRecv(unifi_priv_t *priv, u8* buffer, CsrSize bufferLe CsrPmemFree(msg); } -static void CsrWifiRouterTransportSerialiseAndSend(CsrUint16 primType, void* msg) +static void CsrWifiRouterTransportSerialiseAndSend(u16 primType, void* msg) { CsrWifiFsmEvent* evt = (CsrWifiFsmEvent*)msg; CsrMsgConvMsgEntry* msgEntry; @@ -198,9 +198,9 @@ static void CsrWifiRouterTransportSerialiseAndSend(CsrUint16 primType, void* msg } #if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER) -void CsrSchedMessagePutStringLog(CsrSchedQid q, CsrUint16 mi, void *mv, CsrUint32 line, CsrCharString *file) +void CsrSchedMessagePutStringLog(CsrSchedQid q, u16 mi, void *mv, CsrUint32 line, CsrCharString *file) #else -void CsrSchedMessagePut(CsrSchedQid q, CsrUint16 mi, void *mv) +void CsrSchedMessagePut(CsrSchedQid q, u16 mi, void *mv) #endif { CsrWifiFsmEvent* evt = (CsrWifiFsmEvent*)mv; diff --git a/drivers/staging/csr/csr_wifi_serialize_primitive_types.c b/drivers/staging/csr/csr_wifi_serialize_primitive_types.c index 0e5e201..b81e51a 100644 --- a/drivers/staging/csr/csr_wifi_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_wifi_serialize_primitive_types.c @@ -30,9 +30,9 @@ void CsrUint24Des(CsrUint32 *v, u8 *buffer, CsrSize *offset) /* Big endian :e.g WSC, TCLAS */ -void CsrUint16DesBigEndian(CsrUint16 *v, u8 *buffer, CsrSize *offset) +void CsrUint16DesBigEndian(u16 *v, u8 *buffer, CsrSize *offset) { - CsrUint16 val; + u16 val; val = (buffer[(*offset)] << 8) | (buffer[(*offset) + 1]); *offset += 2; @@ -79,7 +79,7 @@ void CsrUint24Ser(u8 *ptr, CsrSize *len, CsrUint32 v) /* Big endian :e.g WSC, TCLAS */ -void CsrUint16SerBigEndian(u8 *ptr, CsrSize *len, CsrUint16 v) +void CsrUint16SerBigEndian(u8 *ptr, CsrSize *len, u16 v) { ptr[(*len)] = (u8)((v & 0xff00) >> 8); ptr[(*len) + 1] = (u8)((v & 0x00ff)); diff --git a/drivers/staging/csr/csr_wifi_sme_ap_lib.h b/drivers/staging/csr/csr_wifi_sme_ap_lib.h index bb9e79f..06e4130 100644 --- a/drivers/staging/csr/csr_wifi_sme_ap_lib.h +++ b/drivers/staging/csr/csr_wifi_sme_ap_lib.h @@ -43,7 +43,7 @@ extern "C" { * PARAMETERS * Deallocates the resources in a CSR_WIFI_SME_AP upstream message *----------------------------------------------------------------------------*/ -void CsrWifiSmeApFreeUpstreamMessageContents(CsrUint16 eventClass, void *message); +void CsrWifiSmeApFreeUpstreamMessageContents(u16 eventClass, void *message); /*----------------------------------------------------------------------------* * CsrWifiSmeApFreeDownstreamMessageContents @@ -55,7 +55,7 @@ void CsrWifiSmeApFreeUpstreamMessageContents(CsrUint16 eventClass, void *message * PARAMETERS * Deallocates the resources in a CSR_WIFI_SME_AP downstream message *----------------------------------------------------------------------------*/ -void CsrWifiSmeApFreeDownstreamMessageContents(CsrUint16 eventClass, void *message); +void CsrWifiSmeApFreeDownstreamMessageContents(u16 eventClass, void *message); /*----------------------------------------------------------------------------* * Enum to string functions @@ -525,7 +525,7 @@ extern const CsrCharString *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM msg__->secIeLength = (secIeLength__); \ msg__->secIe = (secIe__); \ msg__->groupKeyId = (groupKeyId__); \ - CsrMemCpy(msg__->seqNumber, (seqNumber__), sizeof(CsrUint16) * 8); + CsrMemCpy(msg__->seqNumber, (seqNumber__), sizeof(u16) * 8); #define CsrWifiSmeApStaNotifyIndSendTo(dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__) \ { \ diff --git a/drivers/staging/csr/csr_wifi_sme_ap_prim.h b/drivers/staging/csr/csr_wifi_sme_ap_prim.h index be275af..363c10b 100644 --- a/drivers/staging/csr/csr_wifi_sme_ap_prim.h +++ b/drivers/staging/csr/csr_wifi_sme_ap_prim.h @@ -181,7 +181,7 @@ typedef u8 CsrWifiSmeApPhySupportMask; Set to 0 for the current release *******************************************************************************/ -typedef CsrUint16 CsrWifiSmeApRsnCapabilities; +typedef u16 CsrWifiSmeApRsnCapabilities; /******************************************************************************* NAME @@ -191,7 +191,7 @@ typedef CsrUint16 CsrWifiSmeApRsnCapabilities; Mask type for use with the values defined by CsrWifiSmeApRsnCapabilities *******************************************************************************/ -typedef CsrUint16 CsrWifiSmeApRsnCapabilitiesMask; +typedef u16 CsrWifiSmeApRsnCapabilitiesMask; /******************************************************************************* NAME @@ -202,7 +202,7 @@ typedef CsrUint16 CsrWifiSmeApRsnCapabilitiesMask; current release *******************************************************************************/ -typedef CsrUint16 CsrWifiSmeApWapiCapabilities; +typedef u16 CsrWifiSmeApWapiCapabilities; /******************************************************************************* NAME @@ -212,7 +212,7 @@ typedef CsrUint16 CsrWifiSmeApWapiCapabilities; Mask type for use with the values defined by CsrWifiSmeApWapiCapabilities *******************************************************************************/ -typedef CsrUint16 CsrWifiSmeApWapiCapabilitiesMask; +typedef u16 CsrWifiSmeApWapiCapabilitiesMask; /******************************************************************************* @@ -383,9 +383,9 @@ typedef struct typedef struct { CsrWifiSmeApPhySupportMask phySupportedBitmap; - CsrUint16 beaconInterval; + u16 beaconInterval; u8 dtimPeriod; - CsrUint16 maxListenInterval; + u16 maxListenInterval; u8 supportedRatesCount; u8 supportedRates[20]; CsrWifiSmePreambleType preamble; @@ -550,7 +550,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; u8 initialPresence; CsrWifiSmeApType apType; CsrBool cloakSsid; @@ -579,7 +579,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; } CsrWifiSmeApBeaconingStopReq; /******************************************************************************* @@ -600,7 +600,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeWpsDpid SelectedDevicePasswordId; CsrWifiSmeWpsConfigType SelectedconfigMethod; } CsrWifiSmeApWpsRegistrationStartedReq; @@ -621,7 +621,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; } CsrWifiSmeApWpsRegistrationFinishedReq; /******************************************************************************* @@ -643,7 +643,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeWmmAcParams wmmApParams[4]; CsrWifiSmeWmmAcParams wmmApBcParams[4]; } CsrWifiSmeApWmmParamUpdateReq; @@ -671,7 +671,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeIEEE80211Reason deauthReason; CsrWifiSmeIEEE80211Reason disassocReason; CsrWifiMacAddress peerMacaddress; @@ -715,7 +715,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; } CsrWifiSmeApActiveBaGetReq; /******************************************************************************* @@ -736,7 +736,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeIEEE80211Reason reason; CsrWifiSmeApBaSession baSession; } CsrWifiSmeApBaDeleteReq; @@ -761,9 +761,9 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; - CsrUint16 secIeLength; + u16 secIeLength; u8 *secIe; } CsrWifiSmeApBeaconingStartCfm; @@ -784,7 +784,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; } CsrWifiSmeApBeaconingStopCfm; @@ -815,7 +815,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeMediaStatus mediaStatus; CsrWifiMacAddress peerMacAddress; CsrWifiMacAddress peerDeviceAddress; @@ -825,7 +825,7 @@ typedef struct u8 secIeLength; u8 *secIe; u8 groupKeyId; - CsrUint16 seqNumber[8]; + u16 seqNumber[8]; } CsrWifiSmeApStaNotifyInd; /******************************************************************************* @@ -846,7 +846,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiMacAddress peerMacAddress; } CsrWifiSmeApStaConnectStartInd; @@ -867,7 +867,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; } CsrWifiSmeApWpsRegistrationStartedCfm; @@ -888,7 +888,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; } CsrWifiSmeApWpsRegistrationFinishedCfm; @@ -909,7 +909,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; } CsrWifiSmeApWmmParamUpdateCfm; @@ -931,7 +931,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; CsrWifiMacAddress peerMacaddress; } CsrWifiSmeApStaDisconnectCfm; @@ -976,7 +976,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeApType apType; CsrResult status; } CsrWifiSmeApErrorInd; @@ -1001,9 +1001,9 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; - CsrUint16 activeBaCount; + u16 activeBaCount; CsrWifiSmeApBaSession *activeBaSessions; } CsrWifiSmeApActiveBaGetCfm; @@ -1025,7 +1025,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; CsrWifiSmeApBaSession baSession; } CsrWifiSmeApBaDeleteCfm; diff --git a/drivers/staging/csr/csr_wifi_sme_converter_init.c b/drivers/staging/csr/csr_wifi_sme_converter_init.c index 6897a77..18373af 100644 --- a/drivers/staging/csr/csr_wifi_sme_converter_init.c +++ b/drivers/staging/csr/csr_wifi_sme_converter_init.c @@ -156,11 +156,11 @@ static CsrMsgConvMsgEntry csrwifisme_conv_lut[] = { { 0, NULL, NULL, NULL, NULL }, }; -CsrMsgConvMsgEntry* CsrWifiSmeConverterLookup(CsrMsgConvMsgEntry *ce, CsrUint16 msgType) +CsrMsgConvMsgEntry* CsrWifiSmeConverterLookup(CsrMsgConvMsgEntry *ce, u16 msgType) { if (msgType & CSR_PRIM_UPSTREAM) { - CsrUint16 idx = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT; + u16 idx = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT; if (idx < (CSR_WIFI_SME_PRIM_UPSTREAM_COUNT + CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT) && csrwifisme_conv_lut[idx].msgType == msgType) { diff --git a/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c index 93e75e5..826ef3a 100644 --- a/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c +++ b/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c @@ -25,7 +25,7 @@ * eventClass: only the value CSR_WIFI_SME_PRIM will be handled * message: the message to free *----------------------------------------------------------------------------*/ -void CsrWifiSmeFreeDownstreamMessageContents(CsrUint16 eventClass, void *message) +void CsrWifiSmeFreeDownstreamMessageContents(u16 eventClass, void *message) { if (eventClass != CSR_WIFI_SME_PRIM) { @@ -132,7 +132,7 @@ void CsrWifiSmeFreeDownstreamMessageContents(CsrUint16 eventClass, void *message { CsrWifiSmeWifiFlightmodeReq *p = (CsrWifiSmeWifiFlightmodeReq *)message; { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < p->mibFilesCount; i1++) { CsrPmemFree(p->mibFiles[i1].data); @@ -147,7 +147,7 @@ void CsrWifiSmeFreeDownstreamMessageContents(CsrUint16 eventClass, void *message { CsrWifiSmeWifiOnReq *p = (CsrWifiSmeWifiOnReq *)message; { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < p->mibFilesCount; i1++) { CsrPmemFree(p->mibFiles[i1].data); diff --git a/drivers/staging/csr/csr_wifi_sme_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_sme_free_upstream_contents.c index c32bf68..c34b57e 100644 --- a/drivers/staging/csr/csr_wifi_sme_free_upstream_contents.c +++ b/drivers/staging/csr/csr_wifi_sme_free_upstream_contents.c @@ -25,7 +25,7 @@ * eventClass: only the value CSR_WIFI_SME_PRIM will be handled * message: the message to free *----------------------------------------------------------------------------*/ -void CsrWifiSmeFreeUpstreamMessageContents(CsrUint16 eventClass, void *message) +void CsrWifiSmeFreeUpstreamMessageContents(u16 eventClass, void *message) { if (eventClass != CSR_WIFI_SME_PRIM) { @@ -161,7 +161,7 @@ void CsrWifiSmeFreeUpstreamMessageContents(CsrUint16 eventClass, void *message) { case CSR_WIFI_SME_P2P_ROLE_GO: { - CsrUint16 i4; + u16 i4; for (i4 = 0; i4 < p->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++) { CsrPmemFree(p->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType); @@ -184,7 +184,7 @@ void CsrWifiSmeFreeUpstreamMessageContents(CsrUint16 eventClass, void *message) { CsrWifiSmeScanResultsGetCfm *p = (CsrWifiSmeScanResultsGetCfm *)message; { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < p->scanResultsCount; i1++) { CsrPmemFree(p->scanResults[i1].informationElements); @@ -193,7 +193,7 @@ void CsrWifiSmeFreeUpstreamMessageContents(CsrUint16 eventClass, void *message) { case CSR_WIFI_SME_P2P_ROLE_GO: { - CsrUint16 i4; + u16 i4; for (i4 = 0; i4 < p->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++) { CsrPmemFree(p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType); diff --git a/drivers/staging/csr/csr_wifi_sme_lib.h b/drivers/staging/csr/csr_wifi_sme_lib.h index 63ac5df..1c05f03 100644 --- a/drivers/staging/csr/csr_wifi_sme_lib.h +++ b/drivers/staging/csr/csr_wifi_sme_lib.h @@ -49,7 +49,7 @@ extern "C" { * PARAMETERS * Deallocates the resources in a CSR_WIFI_SME upstream message *----------------------------------------------------------------------------*/ -void CsrWifiSmeFreeUpstreamMessageContents(CsrUint16 eventClass, void *message); +void CsrWifiSmeFreeUpstreamMessageContents(u16 eventClass, void *message); /*----------------------------------------------------------------------------* * CsrWifiSmeFreeDownstreamMessageContents @@ -61,7 +61,7 @@ void CsrWifiSmeFreeUpstreamMessageContents(CsrUint16 eventClass, void *message); * PARAMETERS * Deallocates the resources in a CSR_WIFI_SME downstream message *----------------------------------------------------------------------------*/ -void CsrWifiSmeFreeDownstreamMessageContents(CsrUint16 eventClass, void *message); +void CsrWifiSmeFreeDownstreamMessageContents(u16 eventClass, void *message); /*----------------------------------------------------------------------------* * Enum to string functions diff --git a/drivers/staging/csr/csr_wifi_sme_prim.h b/drivers/staging/csr/csr_wifi_sme_prim.h index 700f268..731f4bf 100644 --- a/drivers/staging/csr/csr_wifi_sme_prim.h +++ b/drivers/staging/csr/csr_wifi_sme_prim.h @@ -161,7 +161,7 @@ typedef u8 CsrWifiSmeAmpStatus; - For future use. *******************************************************************************/ -typedef CsrUint16 CsrWifiSmeAuthMode; +typedef u16 CsrWifiSmeAuthMode; #define CSR_WIFI_SME_AUTH_MODE_80211_OPEN ((CsrWifiSmeAuthMode) 0x0001) #define CSR_WIFI_SME_AUTH_MODE_80211_SHARED ((CsrWifiSmeAuthMode) 0x0002) #define CSR_WIFI_SME_AUTH_MODE_8021X_WPA ((CsrWifiSmeAuthMode) 0x0004) @@ -368,7 +368,7 @@ typedef u8 CsrWifiSmeD3AutoScanMode; - Selects SMS4 for broadcast messages *******************************************************************************/ -typedef CsrUint16 CsrWifiSmeEncryption; +typedef u16 CsrWifiSmeEncryption; #define CSR_WIFI_SME_ENCRYPTION_CIPHER_NONE ((CsrWifiSmeEncryption) 0x0000) #define CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP40 ((CsrWifiSmeEncryption) 0x0001) #define CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP104 ((CsrWifiSmeEncryption) 0x0002) @@ -525,7 +525,7 @@ typedef u8 CsrWifiSmeHostPowerMode; - See IEEE 802.11 Standard *******************************************************************************/ -typedef CsrUint16 CsrWifiSmeIEEE80211Reason; +typedef u16 CsrWifiSmeIEEE80211Reason; #define CSR_WIFI_SME_IEEE80211_REASON_SUCCESS ((CsrWifiSmeIEEE80211Reason) 0x0000) #define CSR_WIFI_SME_IEEE80211_REASON_UNSPECIFIED_REASON ((CsrWifiSmeIEEE80211Reason) 0x0001) #define CSR_WIFI_SME_IEEE80211_REASON_AUTHENTICATION_NOT_VALID ((CsrWifiSmeIEEE80211Reason) 0x0002) @@ -712,7 +712,7 @@ typedef CsrUint16 CsrWifiSmeIEEE80211Reason; - See IEEE 802.11 Standard *******************************************************************************/ -typedef CsrUint16 CsrWifiSmeIEEE80211Result; +typedef u16 CsrWifiSmeIEEE80211Result; #define CSR_WIFI_SME_IEEE80211_RESULT_SUCCESS ((CsrWifiSmeIEEE80211Result) 0x0000) #define CSR_WIFI_SME_IEEE80211_RESULT_UNSPECIFIED_FAILURE ((CsrWifiSmeIEEE80211Result) 0x0001) #define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_CAPABILITIES_MISMATCH ((CsrWifiSmeIEEE80211Result) 0x000a) @@ -1534,7 +1534,7 @@ typedef u8 CsrWifiSmeWmmQosInfo; - Physical Display : Attached to the device *******************************************************************************/ -typedef CsrUint16 CsrWifiSmeWpsConfigType; +typedef u16 CsrWifiSmeWpsConfigType; #define CSR_WIFI_WPS_CONFIG_LABEL ((CsrWifiSmeWpsConfigType) 0x0004) #define CSR_WIFI_WPS_CONFIG_DISPLAY ((CsrWifiSmeWpsConfigType) 0x0008) #define CSR_WIFI_WPS_CONFIG_EXT_NFC ((CsrWifiSmeWpsConfigType) 0x0010) @@ -1806,7 +1806,7 @@ typedef u8 CsrWifiSmeWpsDeviceSubCategory; negotiation procedure *******************************************************************************/ -typedef CsrUint16 CsrWifiSmeWpsDpid; +typedef u16 CsrWifiSmeWpsDpid; #define CSR_WIFI_SME_WPS_DPID_PIN ((CsrWifiSmeWpsDpid) 0x0000) #define CSR_WIFI_SME_WPS_DPID_USER ((CsrWifiSmeWpsDpid) 0x0001) #define CSR_WIFI_SME_WPS_DPID_MACHINE ((CsrWifiSmeWpsDpid) 0x0002) @@ -1842,7 +1842,7 @@ typedef u8 CsrWifiSmeWpsRegistration; Mask type for use with the values defined by CsrWifiSmeAuthMode *******************************************************************************/ -typedef CsrUint16 CsrWifiSmeAuthModeMask; +typedef u16 CsrWifiSmeAuthModeMask; /******************************************************************************* NAME @@ -1852,7 +1852,7 @@ typedef CsrUint16 CsrWifiSmeAuthModeMask; Mask type for use with the values defined by CsrWifiSmeEncryption *******************************************************************************/ -typedef CsrUint16 CsrWifiSmeEncryptionMask; +typedef u16 CsrWifiSmeEncryptionMask; /******************************************************************************* NAME @@ -1922,7 +1922,7 @@ typedef u8 CsrWifiSmeWmmQosInfoMask; Mask type for use with the values defined by CsrWifiSmeWpsConfigType *******************************************************************************/ -typedef CsrUint16 CsrWifiSmeWpsConfigTypeMask; +typedef u16 CsrWifiSmeWpsConfigTypeMask; /******************************************************************************* @@ -1944,10 +1944,10 @@ typedef CsrUint16 CsrWifiSmeWpsConfigTypeMask; *******************************************************************************/ typedef struct { - CsrUint16 atimWindowTu; - CsrUint16 beaconPeriodTu; - CsrUint16 joinOnlyAttempts; - CsrUint16 joinAttemptIntervalMs; + u16 atimWindowTu; + u16 beaconPeriodTu; + u16 joinOnlyAttempts; + u16 joinAttemptIntervalMs; } CsrWifiSmeAdHocConfig; /******************************************************************************* @@ -1966,8 +1966,8 @@ typedef struct typedef struct { u8 listenChannel; - CsrUint16 availabilityDuration; - CsrUint16 avalabilityPeriod; + u16 availabilityDuration; + u16 avalabilityPeriod; } CsrWifiSmeAvailabilityConfig; /******************************************************************************* @@ -2039,18 +2039,18 @@ typedef struct { CsrBool coexEnableSchemeManagement; CsrBool coexPeriodicWakeHost; - CsrUint16 coexTrafficBurstyLatencyMs; - CsrUint16 coexTrafficContinuousLatencyMs; - CsrUint16 coexObexBlackoutDurationMs; - CsrUint16 coexObexBlackoutPeriodMs; - CsrUint16 coexA2dpBrBlackoutDurationMs; - CsrUint16 coexA2dpBrBlackoutPeriodMs; - CsrUint16 coexA2dpEdrBlackoutDurationMs; - CsrUint16 coexA2dpEdrBlackoutPeriodMs; - CsrUint16 coexPagingBlackoutDurationMs; - CsrUint16 coexPagingBlackoutPeriodMs; - CsrUint16 coexInquiryBlackoutDurationMs; - CsrUint16 coexInquiryBlackoutPeriodMs; + u16 coexTrafficBurstyLatencyMs; + u16 coexTrafficContinuousLatencyMs; + u16 coexObexBlackoutDurationMs; + u16 coexObexBlackoutPeriodMs; + u16 coexA2dpBrBlackoutDurationMs; + u16 coexA2dpBrBlackoutPeriodMs; + u16 coexA2dpEdrBlackoutDurationMs; + u16 coexA2dpEdrBlackoutPeriodMs; + u16 coexPagingBlackoutDurationMs; + u16 coexPagingBlackoutPeriodMs; + u16 coexInquiryBlackoutDurationMs; + u16 coexInquiryBlackoutPeriodMs; } CsrWifiSmeCoexConfig; /******************************************************************************* @@ -2167,7 +2167,7 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint16 length; + u16 length; u8 *data; } CsrWifiSmeDataBlock; @@ -2233,9 +2233,9 @@ typedef struct { CsrBool unifiFixMaxTxDataRate; u8 unifiFixTxDataRate; - CsrUint16 dot11RtsThreshold; - CsrUint16 dot11FragmentationThreshold; - CsrUint16 dot11CurrentTxPowerLevel; + u16 dot11RtsThreshold; + u16 dot11FragmentationThreshold; + u16 dot11CurrentTxPowerLevel; } CsrWifiSmeMibConfig; /******************************************************************************* @@ -2255,8 +2255,8 @@ typedef struct typedef struct { u8 listenChannel; - CsrUint16 availabilityDuration; - CsrUint16 avalabilityPeriod; + u16 availabilityDuration; + u16 avalabilityPeriod; } CsrWifiSmeP2pProfileIdentity; /******************************************************************************* @@ -2402,12 +2402,12 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint16 intervalSeconds; - CsrUint16 validitySeconds; - CsrUint16 minActiveChannelTimeTu; - CsrUint16 maxActiveChannelTimeTu; - CsrUint16 minPassiveChannelTimeTu; - CsrUint16 maxPassiveChannelTimeTu; + u16 intervalSeconds; + u16 validitySeconds; + u16 minActiveChannelTimeTu; + u16 maxActiveChannelTimeTu; + u16 minPassiveChannelTimeTu; + u16 maxPassiveChannelTimeTu; } CsrWifiSmeScanConfigData; /******************************************************************************* @@ -2488,7 +2488,7 @@ typedef struct u8 cwMin; u8 cwMax; u8 aifs; - CsrUint16 txopLimit; + u16 txopLimit; CsrBool admissionControlMandatory; } CsrWifiSmeWmmAcParams; @@ -2542,9 +2542,9 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint16 version; - CsrUint16 configMethods; - CsrUint16 devicePassworId; + u16 version; + u16 configMethods; + u16 devicePassworId; } CsrWifiSmeWpsInfo; /******************************************************************************* @@ -2598,10 +2598,10 @@ typedef struct { CsrBool hasTrafficData; CsrWifiSmeTrafficType currentTrafficType; - CsrUint16 currentPeriodMs; + u16 currentPeriodMs; CsrWifiSmePowerSaveLevel currentPowerSave; - CsrUint16 currentCoexPeriodMs; - CsrUint16 currentCoexLatencyMs; + u16 currentCoexPeriodMs; + u16 currentCoexLatencyMs; CsrBool hasBtDevice; CsrUint32 currentBlackoutDurationUs; CsrUint32 currentBlackoutPeriodUs; @@ -2674,7 +2674,7 @@ typedef struct CsrWifiSme80211PrivacyMode privacyMode; CsrWifiSmeAuthModeMask authModeMask; CsrWifiSmeEncryptionMask encryptionModeMask; - CsrUint16 mlmeAssociateReqInformationElementsLength; + u16 mlmeAssociateReqInformationElementsLength; u8 *mlmeAssociateReqInformationElements; CsrWifiSmeWmmQosInfoMask wmmQosInfo; CsrBool adhocJoinOnly; @@ -2749,31 +2749,31 @@ typedef struct CsrWifiMacAddress bssid; CsrWifiSme80211NetworkType networkType80211; u8 channelNumber; - CsrUint16 channelFrequency; + u16 channelFrequency; CsrWifiSmeAuthMode authMode; CsrWifiSmeEncryption pairwiseCipher; CsrWifiSmeEncryption groupCipher; CsrWifiSmeRadioIF ifIndex; - CsrUint16 atimWindowTu; - CsrUint16 beaconPeriodTu; + u16 atimWindowTu; + u16 beaconPeriodTu; CsrBool reassociation; - CsrUint16 beaconFrameLength; + u16 beaconFrameLength; u8 *beaconFrame; - CsrUint16 associationReqFrameLength; + u16 associationReqFrameLength; u8 *associationReqFrame; - CsrUint16 associationRspFrameLength; + u16 associationRspFrameLength; u8 *associationRspFrame; - CsrUint16 assocScanInfoElementsLength; + u16 assocScanInfoElementsLength; u8 *assocScanInfoElements; - CsrUint16 assocReqCapabilities; - CsrUint16 assocReqListenIntervalTu; + u16 assocReqCapabilities; + u16 assocReqListenIntervalTu; CsrWifiMacAddress assocReqApAddress; - CsrUint16 assocReqInfoElementsLength; + u16 assocReqInfoElementsLength; u8 *assocReqInfoElements; CsrWifiSmeIEEE80211Result assocRspResult; - CsrUint16 assocRspCapabilityInfo; - CsrUint16 assocRspAssociationId; - CsrUint16 assocRspInfoElementsLength; + u16 assocRspCapabilityInfo; + u16 assocRspAssociationId; + u16 assocRspInfoElementsLength; u8 *assocRspInfoElements; } CsrWifiSmeConnectionInfo; @@ -2890,7 +2890,7 @@ typedef struct typedef struct { CsrWifiSmeHostPowerMode powerMode; - CsrUint16 applicationDataPeriodMs; + u16 applicationDataPeriodMs; } CsrWifiSmeHostConfig; /******************************************************************************* @@ -2926,7 +2926,7 @@ typedef struct CsrWifiSmeKeyType keyType; u8 keyIndex; CsrBool wepTxKey; - CsrUint16 keyRsc[8]; + u16 keyRsc[8]; CsrBool authenticator; CsrWifiMacAddress address; u8 keyLength; @@ -3000,7 +3000,7 @@ typedef struct typedef struct { CsrWifiSmePowerSaveLevel powerSaveLevel; - CsrUint16 listenIntervalTu; + u16 listenIntervalTu; CsrBool rxDtims; CsrWifiSmeD3AutoScanMode d3AutoScanMode; u8 clientTrafficWindow; @@ -3042,7 +3042,7 @@ typedef struct CsrBool disableSmoothRoaming; CsrBool disableRoamScans; u8 reconnectLimit; - CsrUint16 reconnectLimitIntervalMs; + u16 reconnectLimitIntervalMs; CsrWifiSmeScanConfigData roamScanCfg[3]; } CsrWifiSmeRoamingConfig; @@ -3086,14 +3086,14 @@ typedef struct { CsrWifiSmeScanConfigData scanCfg[4]; CsrBool disableAutonomousScans; - CsrUint16 maxResults; + u16 maxResults; s8 highRssiThreshold; s8 lowRssiThreshold; s8 deltaRssiThreshold; s8 highSnrThreshold; s8 lowSnrThreshold; s8 deltaSnrThreshold; - CsrUint16 passiveChannelListCount; + u16 passiveChannelListCount; u8 *passiveChannelList; } CsrWifiSmeScanConfig; @@ -3144,15 +3144,15 @@ typedef struct CsrInt16 rssi; CsrInt16 snr; CsrWifiSmeRadioIF ifIndex; - CsrUint16 beaconPeriodTu; + u16 beaconPeriodTu; CsrWifiSmeTsfTime timeStamp; CsrWifiSmeTsfTime localTime; - CsrUint16 channelFrequency; - CsrUint16 capabilityInformation; + u16 channelFrequency; + u16 capabilityInformation; u8 channelNumber; CsrWifiSmeBasicUsability usability; CsrWifiSmeBssType bssType; - CsrUint16 informationElementsLength; + u16 informationElementsLength; u8 *informationElements; CsrWifiSmeP2pRole p2pDeviceRole; union { @@ -3562,7 +3562,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeListAction action; u8 setAddressCount; CsrWifiMacAddress *setAddresses; @@ -3606,7 +3606,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 calibrationDataLength; + u16 calibrationDataLength; u8 *calibrationData; } CsrWifiSmeCalibrationDataSetReq; @@ -3627,7 +3627,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; } CsrWifiSmeCcxConfigGetReq; /******************************************************************************* @@ -3648,7 +3648,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeCcxConfig ccxConfig; } CsrWifiSmeCcxConfigSetReq; @@ -3758,7 +3758,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeConnectionConfig connectionConfig; } CsrWifiSmeConnectReq; @@ -3778,7 +3778,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; } CsrWifiSmeConnectionConfigGetReq; /******************************************************************************* @@ -3797,7 +3797,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; } CsrWifiSmeConnectionInfoGetReq; /******************************************************************************* @@ -3816,7 +3816,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; } CsrWifiSmeConnectionStatsGetReq; /******************************************************************************* @@ -3853,7 +3853,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; } CsrWifiSmeDisconnectReq; /******************************************************************************* @@ -3894,7 +3894,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; } CsrWifiSmeHostConfigGetReq; /******************************************************************************* @@ -3916,7 +3916,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeHostConfig hostConfig; } CsrWifiSmeHostConfigSetReq; @@ -3943,7 +3943,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeListAction action; CsrWifiSmeKey key; } CsrWifiSmeKeyReq; @@ -3964,7 +3964,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; } CsrWifiSmeLinkQualityGetReq; /******************************************************************************* @@ -4023,7 +4023,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 mibAttributeLength; + u16 mibAttributeLength; u8 *mibAttribute; } CsrWifiSmeMibGetNextReq; @@ -4046,7 +4046,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 mibAttributeLength; + u16 mibAttributeLength; u8 *mibAttribute; } CsrWifiSmeMibGetReq; @@ -4077,7 +4077,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 mibAttributeLength; + u16 mibAttributeLength; u8 *mibAttribute; } CsrWifiSmeMibSetReq; @@ -4107,7 +4107,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeListAction action; u8 setAddressesCount; CsrWifiMacAddress *setAddresses; @@ -4157,8 +4157,8 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; - CsrUint16 filterLength; + u16 interfaceTag; + u16 filterLength; u8 *filter; CsrWifiSmePacketFilterMode mode; CsrWifiIp4Address arpFilterAddress; @@ -4209,7 +4209,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeListAction action; u8 setPmkidsCount; CsrWifiSmePmkid *setPmkids; @@ -4284,7 +4284,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; } CsrWifiSmeRoamingConfigGetReq; /******************************************************************************* @@ -4304,7 +4304,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeRoamingConfig roamingConfig; } CsrWifiSmeRoamingConfigSetReq; @@ -4404,9 +4404,9 @@ typedef struct CsrBool forceScan; CsrWifiSmeBssType bssType; CsrWifiSmeScanType scanType; - CsrUint16 channelListCount; + u16 channelListCount; u8 *channelList; - CsrUint16 probeIeLength; + u16 probeIeLength; u8 *probeIe; } CsrWifiSmeScanFullReq; @@ -4471,7 +4471,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; } CsrWifiSmeSmeStaConfigGetReq; /******************************************************************************* @@ -4491,7 +4491,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeStaConfig smeConfig; } CsrWifiSmeSmeStaConfigSetReq; @@ -4558,14 +4558,14 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeListAction action; CsrUint32 transactionId; CsrBool strict; CsrWifiSmeTspecCtrlMask ctrlMask; - CsrUint16 tspecLength; + u16 tspecLength; u8 *tspec; - CsrUint16 tclasLength; + u16 tclasLength; u8 *tclas; } CsrWifiSmeTspecReq; @@ -4631,7 +4631,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiMacAddress address; - CsrUint16 mibFilesCount; + u16 mibFilesCount; CsrWifiSmeDataBlock *mibFiles; } CsrWifiSmeWifiFlightmodeReq; @@ -4691,7 +4691,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiMacAddress address; - CsrUint16 mibFilesCount; + u16 mibFilesCount; CsrWifiSmeDataBlock *mibFiles; } CsrWifiSmeWifiOnReq; @@ -4922,7 +4922,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; CsrWifiSmeConnectionInfo connectionInfo; CsrWifiSmeIEEE80211Reason deauthReason; @@ -4947,7 +4947,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiMacAddress address; CsrWifiSsid ssid; } CsrWifiSmeAssociationStartInd; @@ -4977,7 +4977,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; CsrWifiSmeListAction action; u8 getAddressCount; @@ -5005,7 +5005,7 @@ typedef struct { CsrWifiFsmEvent common; CsrResult status; - CsrUint16 calibrationDataLength; + u16 calibrationDataLength; u8 *calibrationData; } CsrWifiSmeCalibrationDataGetCfm; @@ -5046,7 +5046,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; CsrWifiSmeCcxConfig ccxConfig; } CsrWifiSmeCcxConfigGetCfm; @@ -5068,7 +5068,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; } CsrWifiSmeCcxConfigSetCfm; @@ -5154,7 +5154,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; } CsrWifiSmeConnectCfm; @@ -5176,7 +5176,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; CsrWifiSmeConnectionConfig connectionConfig; } CsrWifiSmeConnectionConfigGetCfm; @@ -5199,7 +5199,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; CsrWifiSmeConnectionInfo connectionInfo; } CsrWifiSmeConnectionInfoGetCfm; @@ -5228,7 +5228,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeLinkQuality linkQuality; } CsrWifiSmeConnectionQualityInd; @@ -5250,7 +5250,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; CsrWifiSmeConnectionStats connectionStats; } CsrWifiSmeConnectionStatsGetCfm; @@ -5296,7 +5296,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; } CsrWifiSmeDisconnectCfm; @@ -5338,7 +5338,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; CsrWifiSmeHostConfig hostConfig; } CsrWifiSmeHostConfigGetCfm; @@ -5360,7 +5360,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; } CsrWifiSmeHostConfigSetCfm; @@ -5407,7 +5407,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; CsrWifiSmeListAction action; CsrWifiSmeKeyType keyType; @@ -5432,7 +5432,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; CsrWifiSmeLinkQuality linkQuality; } CsrWifiSmeLinkQualityGetCfm; @@ -5467,7 +5467,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeMediaStatus mediaStatus; CsrWifiSmeConnectionInfo connectionInfo; CsrWifiSmeIEEE80211Reason disassocReason; @@ -5534,7 +5534,7 @@ typedef struct { CsrWifiFsmEvent common; CsrResult status; - CsrUint16 mibAttributeLength; + u16 mibAttributeLength; u8 *mibAttribute; } CsrWifiSmeMibGetCfm; @@ -5561,7 +5561,7 @@ typedef struct { CsrWifiFsmEvent common; CsrResult status; - CsrUint16 mibAttributeLength; + u16 mibAttributeLength; u8 *mibAttribute; } CsrWifiSmeMibGetNextCfm; @@ -5607,9 +5607,9 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrBool secondFailure; - CsrUint16 count; + u16 count; CsrWifiMacAddress address; CsrWifiSmeKeyType keyType; } CsrWifiSmeMicFailureInd; @@ -5638,7 +5638,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; CsrWifiSmeListAction action; u8 getAddressesCount; @@ -5662,7 +5662,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; } CsrWifiSmePacketFilterSetCfm; @@ -5708,7 +5708,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; u8 pmkidCandidatesCount; CsrWifiSmePmkidCandidate *pmkidCandidates; } CsrWifiSmePmkidCandidateListInd; @@ -5737,7 +5737,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; CsrWifiSmeListAction action; u8 getPmkidsCount; @@ -5827,7 +5827,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; } CsrWifiSmeRoamCompleteInd; @@ -5867,7 +5867,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeRoamReason roamReason; CsrWifiSmeIEEE80211Reason reason80211; } CsrWifiSmeRoamStartInd; @@ -5890,7 +5890,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; CsrWifiSmeRoamingConfig roamingConfig; } CsrWifiSmeRoamingConfigGetCfm; @@ -5912,7 +5912,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; } CsrWifiSmeRoamingConfigSetCfm; @@ -6036,7 +6036,7 @@ typedef struct { CsrWifiFsmEvent common; CsrResult status; - CsrUint16 scanResultsCount; + u16 scanResultsCount; CsrWifiSmeScanResult *scanResults; } CsrWifiSmeScanResultsGetCfm; @@ -6058,7 +6058,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; CsrWifiSmeStaConfig smeConfig; } CsrWifiSmeSmeStaConfigGetCfm; @@ -6080,7 +6080,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; } CsrWifiSmeSmeStaConfigSetCfm; @@ -6128,10 +6128,10 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrUint32 transactionId; CsrWifiSmeTspecResultCode tspecResultCode; - CsrUint16 tspecLength; + u16 tspecLength; u8 *tspec; } CsrWifiSmeTspecInd; @@ -6158,11 +6158,11 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrResult status; CsrUint32 transactionId; CsrWifiSmeTspecResultCode tspecResultCode; - CsrUint16 tspecLength; + u16 tspecLength; u8 *tspec; } CsrWifiSmeTspecCfm; @@ -6399,7 +6399,7 @@ typedef struct { CsrWifiFsmEvent common; CsrResult status; - CsrUint16 numInterfaces; + u16 numInterfaces; u8 capBitmap[2]; } CsrWifiSmeInterfaceCapabilityGetCfm; @@ -6487,7 +6487,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiSmeAmpStatus ampStatus; } CsrWifiSmeAmpStatusChangeInd; diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.c b/drivers/staging/csr/csr_wifi_sme_serialize.c index f35f836..0e3096e 100644 --- a/drivers/staging/csr/csr_wifi_sme_serialize.c +++ b/drivers/staging/csr/csr_wifi_sme_serialize.c @@ -29,10 +29,10 @@ CsrSize CsrWifiSmeAdhocConfigSetReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ - bufferSize += 2; /* CsrUint16 primitive->adHocConfig.atimWindowTu */ - bufferSize += 2; /* CsrUint16 primitive->adHocConfig.beaconPeriodTu */ - bufferSize += 2; /* CsrUint16 primitive->adHocConfig.joinOnlyAttempts */ - bufferSize += 2; /* CsrUint16 primitive->adHocConfig.joinAttemptIntervalMs */ + bufferSize += 2; /* u16 primitive->adHocConfig.atimWindowTu */ + bufferSize += 2; /* u16 primitive->adHocConfig.beaconPeriodTu */ + bufferSize += 2; /* u16 primitive->adHocConfig.joinOnlyAttempts */ + bufferSize += 2; /* u16 primitive->adHocConfig.joinAttemptIntervalMs */ return bufferSize; } @@ -42,10 +42,10 @@ u8* CsrWifiSmeAdhocConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeAdhocConfigSetReq *primitive = (CsrWifiSmeAdhocConfigSetReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->adHocConfig.atimWindowTu); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->adHocConfig.beaconPeriodTu); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->adHocConfig.joinOnlyAttempts); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->adHocConfig.joinAttemptIntervalMs); + CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.atimWindowTu); + CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.beaconPeriodTu); + CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.joinOnlyAttempts); + CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.joinAttemptIntervalMs); return(ptr); } @@ -57,10 +57,10 @@ void* CsrWifiSmeAdhocConfigSetReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->adHocConfig.atimWindowTu, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->adHocConfig.beaconPeriodTu, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->adHocConfig.joinOnlyAttempts, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->adHocConfig.joinAttemptIntervalMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->adHocConfig.atimWindowTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->adHocConfig.beaconPeriodTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->adHocConfig.joinOnlyAttempts, buffer, &offset); + CsrUint16Des((u16 *) &primitive->adHocConfig.joinAttemptIntervalMs, buffer, &offset); return primitive; } @@ -72,11 +72,11 @@ CsrSize CsrWifiSmeBlacklistReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ bufferSize += 1; /* u8 primitive->setAddressCount */ { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->setAddressCount; i1++) { bufferSize += 6; /* u8 primitive->setAddresses[i1].a[6] */ @@ -91,14 +91,14 @@ u8* CsrWifiSmeBlacklistReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeBlacklistReq *primitive = (CsrWifiSmeBlacklistReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->action); CsrUint8Ser(ptr, len, (u8) primitive->setAddressCount); { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->setAddressCount; i1++) { - CsrMemCpySer(ptr, len, (const void *) primitive->setAddresses[i1].a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->setAddresses[i1].a, ((u16) (6))); } } return(ptr); @@ -112,7 +112,7 @@ void* CsrWifiSmeBlacklistReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->action, buffer, &offset); CsrUint8Des((u8 *) &primitive->setAddressCount, buffer, &offset); primitive->setAddresses = NULL; @@ -121,10 +121,10 @@ void* CsrWifiSmeBlacklistReqDes(u8 *buffer, CsrSize length) primitive->setAddresses = (CsrWifiMacAddress *)CsrPmemAlloc(sizeof(CsrWifiMacAddress) * primitive->setAddressCount); } { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->setAddressCount; i1++) { - CsrMemCpyDes(primitive->setAddresses[i1].a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->setAddresses[i1].a, buffer, &offset, ((u16) (6))); } } @@ -146,7 +146,7 @@ CsrSize CsrWifiSmeCalibrationDataSetReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */ - bufferSize += 2; /* CsrUint16 primitive->calibrationDataLength */ + bufferSize += 2; /* u16 primitive->calibrationDataLength */ bufferSize += primitive->calibrationDataLength; /* u8 primitive->calibrationData */ return bufferSize; } @@ -157,10 +157,10 @@ u8* CsrWifiSmeCalibrationDataSetReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeCalibrationDataSetReq *primitive = (CsrWifiSmeCalibrationDataSetReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->calibrationDataLength); + CsrUint16Ser(ptr, len, (u16) primitive->calibrationDataLength); if (primitive->calibrationDataLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->calibrationData, ((CsrUint16) (primitive->calibrationDataLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->calibrationData, ((u16) (primitive->calibrationDataLength))); } return(ptr); } @@ -173,11 +173,11 @@ void* CsrWifiSmeCalibrationDataSetReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->calibrationDataLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->calibrationDataLength, buffer, &offset); if (primitive->calibrationDataLength) { primitive->calibrationData = (u8 *)CsrPmemAlloc(primitive->calibrationDataLength); - CsrMemCpyDes(primitive->calibrationData, buffer, &offset, ((CsrUint16) (primitive->calibrationDataLength))); + CsrMemCpyDes(primitive->calibrationData, buffer, &offset, ((u16) (primitive->calibrationDataLength))); } else { @@ -201,7 +201,7 @@ CsrSize CsrWifiSmeCcxConfigSetReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* u8 primitive->ccxConfig.keepAliveTimeMs */ bufferSize += 1; /* CsrBool primitive->ccxConfig.apRoamingEnabled */ bufferSize += 1; /* u8 primitive->ccxConfig.measurementsMask */ @@ -215,7 +215,7 @@ u8* CsrWifiSmeCcxConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeCcxConfigSetReq *primitive = (CsrWifiSmeCcxConfigSetReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.keepAliveTimeMs); CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.apRoamingEnabled); CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.measurementsMask); @@ -231,7 +231,7 @@ void* CsrWifiSmeCcxConfigSetReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->ccxConfig.keepAliveTimeMs, buffer, &offset); CsrUint8Des((u8 *) &primitive->ccxConfig.apRoamingEnabled, buffer, &offset); CsrUint8Des((u8 *) &primitive->ccxConfig.measurementsMask, buffer, &offset); @@ -248,18 +248,18 @@ CsrSize CsrWifiSmeCoexConfigSetReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 29) */ bufferSize += 1; /* CsrBool primitive->coexConfig.coexEnableSchemeManagement */ bufferSize += 1; /* CsrBool primitive->coexConfig.coexPeriodicWakeHost */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexTrafficBurstyLatencyMs */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexTrafficContinuousLatencyMs */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexObexBlackoutDurationMs */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexObexBlackoutPeriodMs */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexA2dpBrBlackoutDurationMs */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexA2dpBrBlackoutPeriodMs */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexA2dpEdrBlackoutDurationMs */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexPagingBlackoutDurationMs */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexPagingBlackoutPeriodMs */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexInquiryBlackoutDurationMs */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexInquiryBlackoutPeriodMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexTrafficBurstyLatencyMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexTrafficContinuousLatencyMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexObexBlackoutDurationMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexObexBlackoutPeriodMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpBrBlackoutDurationMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpBrBlackoutPeriodMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpEdrBlackoutDurationMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexPagingBlackoutDurationMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexPagingBlackoutPeriodMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexInquiryBlackoutDurationMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexInquiryBlackoutPeriodMs */ return bufferSize; } @@ -271,18 +271,18 @@ u8* CsrWifiSmeCoexConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) CsrUint16Ser(ptr, len, primitive->common.type); CsrUint8Ser(ptr, len, (u8) primitive->coexConfig.coexEnableSchemeManagement); CsrUint8Ser(ptr, len, (u8) primitive->coexConfig.coexPeriodicWakeHost); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexTrafficBurstyLatencyMs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexTrafficContinuousLatencyMs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexObexBlackoutDurationMs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexObexBlackoutPeriodMs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexA2dpBrBlackoutDurationMs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexA2dpBrBlackoutPeriodMs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexA2dpEdrBlackoutDurationMs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexPagingBlackoutDurationMs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexPagingBlackoutPeriodMs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexInquiryBlackoutDurationMs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexInquiryBlackoutPeriodMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexTrafficBurstyLatencyMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexTrafficContinuousLatencyMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexObexBlackoutDurationMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexObexBlackoutPeriodMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpBrBlackoutDurationMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpBrBlackoutPeriodMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpEdrBlackoutDurationMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexPagingBlackoutDurationMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexPagingBlackoutPeriodMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexInquiryBlackoutDurationMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexInquiryBlackoutPeriodMs); return(ptr); } @@ -296,18 +296,18 @@ void* CsrWifiSmeCoexConfigSetReqDes(u8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint8Des((u8 *) &primitive->coexConfig.coexEnableSchemeManagement, buffer, &offset); CsrUint8Des((u8 *) &primitive->coexConfig.coexPeriodicWakeHost, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexTrafficBurstyLatencyMs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexTrafficContinuousLatencyMs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexObexBlackoutDurationMs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexObexBlackoutPeriodMs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexA2dpBrBlackoutDurationMs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexA2dpBrBlackoutPeriodMs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexA2dpEdrBlackoutDurationMs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexPagingBlackoutDurationMs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexPagingBlackoutPeriodMs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexInquiryBlackoutDurationMs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexInquiryBlackoutPeriodMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexTrafficBurstyLatencyMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexTrafficContinuousLatencyMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexObexBlackoutDurationMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexObexBlackoutPeriodMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpBrBlackoutDurationMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpBrBlackoutPeriodMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpEdrBlackoutDurationMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexPagingBlackoutDurationMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexPagingBlackoutPeriodMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexInquiryBlackoutDurationMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexInquiryBlackoutPeriodMs, buffer, &offset); return primitive; } @@ -319,7 +319,7 @@ CsrSize CsrWifiSmeConnectReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 57) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 32; /* u8 primitive->connectionConfig.ssid.ssid[32] */ bufferSize += 1; /* u8 primitive->connectionConfig.ssid.length */ bufferSize += 6; /* u8 primitive->connectionConfig.bssid.a[6] */ @@ -328,7 +328,7 @@ CsrSize CsrWifiSmeConnectReqSizeof(void *msg) bufferSize += 1; /* CsrWifiSme80211PrivacyMode primitive->connectionConfig.privacyMode */ bufferSize += 2; /* CsrWifiSmeAuthModeMask primitive->connectionConfig.authModeMask */ bufferSize += 2; /* CsrWifiSmeEncryptionMask primitive->connectionConfig.encryptionModeMask */ - bufferSize += 2; /* CsrUint16 primitive->connectionConfig.mlmeAssociateReqInformationElementsLength */ + bufferSize += 2; /* u16 primitive->connectionConfig.mlmeAssociateReqInformationElementsLength */ bufferSize += primitive->connectionConfig.mlmeAssociateReqInformationElementsLength; /* u8 primitive->connectionConfig.mlmeAssociateReqInformationElements */ bufferSize += 1; /* CsrWifiSmeWmmQosInfoMask primitive->connectionConfig.wmmQosInfo */ bufferSize += 1; /* CsrBool primitive->connectionConfig.adhocJoinOnly */ @@ -342,19 +342,19 @@ u8* CsrWifiSmeConnectReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeConnectReq *primitive = (CsrWifiSmeConnectReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.ssid.ssid, ((CsrUint16) (32))); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.ssid.ssid, ((u16) (32))); CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.ssid.length); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.bssid.a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.bssid.a, ((u16) (6))); CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.bssType); CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.ifIndex); CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.privacyMode); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionConfig.authModeMask); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionConfig.encryptionModeMask); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionConfig.mlmeAssociateReqInformationElementsLength); + CsrUint16Ser(ptr, len, (u16) primitive->connectionConfig.authModeMask); + CsrUint16Ser(ptr, len, (u16) primitive->connectionConfig.encryptionModeMask); + CsrUint16Ser(ptr, len, (u16) primitive->connectionConfig.mlmeAssociateReqInformationElementsLength); if (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.mlmeAssociateReqInformationElements, ((CsrUint16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.mlmeAssociateReqInformationElements, ((u16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength))); } CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.wmmQosInfo); CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.adhocJoinOnly); @@ -370,20 +370,20 @@ void* CsrWifiSmeConnectReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrMemCpyDes(primitive->connectionConfig.ssid.ssid, buffer, &offset, ((CsrUint16) (32))); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrMemCpyDes(primitive->connectionConfig.ssid.ssid, buffer, &offset, ((u16) (32))); CsrUint8Des((u8 *) &primitive->connectionConfig.ssid.length, buffer, &offset); - CsrMemCpyDes(primitive->connectionConfig.bssid.a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->connectionConfig.bssid.a, buffer, &offset, ((u16) (6))); CsrUint8Des((u8 *) &primitive->connectionConfig.bssType, buffer, &offset); CsrUint8Des((u8 *) &primitive->connectionConfig.ifIndex, buffer, &offset); CsrUint8Des((u8 *) &primitive->connectionConfig.privacyMode, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionConfig.authModeMask, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionConfig.encryptionModeMask, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionConfig.mlmeAssociateReqInformationElementsLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionConfig.authModeMask, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionConfig.encryptionModeMask, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionConfig.mlmeAssociateReqInformationElementsLength, buffer, &offset); if (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength) { primitive->connectionConfig.mlmeAssociateReqInformationElements = (u8 *)CsrPmemAlloc(primitive->connectionConfig.mlmeAssociateReqInformationElementsLength); - CsrMemCpyDes(primitive->connectionConfig.mlmeAssociateReqInformationElements, buffer, &offset, ((CsrUint16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength))); + CsrMemCpyDes(primitive->connectionConfig.mlmeAssociateReqInformationElements, buffer, &offset, ((u16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength))); } else { @@ -410,9 +410,9 @@ CsrSize CsrWifiSmeHostConfigSetReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiSmeHostPowerMode primitive->hostConfig.powerMode */ - bufferSize += 2; /* CsrUint16 primitive->hostConfig.applicationDataPeriodMs */ + bufferSize += 2; /* u16 primitive->hostConfig.applicationDataPeriodMs */ return bufferSize; } @@ -422,9 +422,9 @@ u8* CsrWifiSmeHostConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeHostConfigSetReq *primitive = (CsrWifiSmeHostConfigSetReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->hostConfig.powerMode); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->hostConfig.applicationDataPeriodMs); + CsrUint16Ser(ptr, len, (u16) primitive->hostConfig.applicationDataPeriodMs); return(ptr); } @@ -436,9 +436,9 @@ void* CsrWifiSmeHostConfigSetReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->hostConfig.powerMode, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->hostConfig.applicationDataPeriodMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->hostConfig.applicationDataPeriodMs, buffer, &offset); return primitive; } @@ -449,16 +449,16 @@ CsrSize CsrWifiSmeKeyReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 65) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ bufferSize += 1; /* CsrWifiSmeKeyType primitive->key.keyType */ bufferSize += 1; /* u8 primitive->key.keyIndex */ bufferSize += 1; /* CsrBool primitive->key.wepTxKey */ { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 8; i2++) { - bufferSize += 2; /* CsrUint16 primitive->key.keyRsc[8] */ + bufferSize += 2; /* u16 primitive->key.keyRsc[8] */ } } bufferSize += 1; /* CsrBool primitive->key.authenticator */ @@ -474,22 +474,22 @@ u8* CsrWifiSmeKeyReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeKeyReq *primitive = (CsrWifiSmeKeyReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->action); CsrUint8Ser(ptr, len, (u8) primitive->key.keyType); CsrUint8Ser(ptr, len, (u8) primitive->key.keyIndex); CsrUint8Ser(ptr, len, (u8) primitive->key.wepTxKey); { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 8; i2++) { - CsrUint16Ser(ptr, len, (CsrUint16) primitive->key.keyRsc[i2]); + CsrUint16Ser(ptr, len, (u16) primitive->key.keyRsc[i2]); } } CsrUint8Ser(ptr, len, (u8) primitive->key.authenticator); - CsrMemCpySer(ptr, len, (const void *) primitive->key.address.a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->key.address.a, ((u16) (6))); CsrUint8Ser(ptr, len, (u8) primitive->key.keyLength); - CsrMemCpySer(ptr, len, (const void *) primitive->key.key, ((CsrUint16) (32))); + CsrMemCpySer(ptr, len, (const void *) primitive->key.key, ((u16) (32))); return(ptr); } @@ -501,22 +501,22 @@ void* CsrWifiSmeKeyReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->action, buffer, &offset); CsrUint8Des((u8 *) &primitive->key.keyType, buffer, &offset); CsrUint8Des((u8 *) &primitive->key.keyIndex, buffer, &offset); CsrUint8Des((u8 *) &primitive->key.wepTxKey, buffer, &offset); { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 8; i2++) { - CsrUint16Des((CsrUint16 *) &primitive->key.keyRsc[i2], buffer, &offset); + CsrUint16Des((u16 *) &primitive->key.keyRsc[i2], buffer, &offset); } } CsrUint8Des((u8 *) &primitive->key.authenticator, buffer, &offset); - CsrMemCpyDes(primitive->key.address.a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->key.address.a, buffer, &offset, ((u16) (6))); CsrUint8Des((u8 *) &primitive->key.keyLength, buffer, &offset); - CsrMemCpyDes(primitive->key.key, buffer, &offset, ((CsrUint16) (32))); + CsrMemCpyDes(primitive->key.key, buffer, &offset, ((u16) (32))); return primitive; } @@ -529,9 +529,9 @@ CsrSize CsrWifiSmeMibConfigSetReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ bufferSize += 1; /* CsrBool primitive->mibConfig.unifiFixMaxTxDataRate */ bufferSize += 1; /* u8 primitive->mibConfig.unifiFixTxDataRate */ - bufferSize += 2; /* CsrUint16 primitive->mibConfig.dot11RtsThreshold */ - bufferSize += 2; /* CsrUint16 primitive->mibConfig.dot11FragmentationThreshold */ - bufferSize += 2; /* CsrUint16 primitive->mibConfig.dot11CurrentTxPowerLevel */ + bufferSize += 2; /* u16 primitive->mibConfig.dot11RtsThreshold */ + bufferSize += 2; /* u16 primitive->mibConfig.dot11FragmentationThreshold */ + bufferSize += 2; /* u16 primitive->mibConfig.dot11CurrentTxPowerLevel */ return bufferSize; } @@ -543,9 +543,9 @@ u8* CsrWifiSmeMibConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) CsrUint16Ser(ptr, len, primitive->common.type); CsrUint8Ser(ptr, len, (u8) primitive->mibConfig.unifiFixMaxTxDataRate); CsrUint8Ser(ptr, len, (u8) primitive->mibConfig.unifiFixTxDataRate); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibConfig.dot11RtsThreshold); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibConfig.dot11FragmentationThreshold); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibConfig.dot11CurrentTxPowerLevel); + CsrUint16Ser(ptr, len, (u16) primitive->mibConfig.dot11RtsThreshold); + CsrUint16Ser(ptr, len, (u16) primitive->mibConfig.dot11FragmentationThreshold); + CsrUint16Ser(ptr, len, (u16) primitive->mibConfig.dot11CurrentTxPowerLevel); return(ptr); } @@ -559,9 +559,9 @@ void* CsrWifiSmeMibConfigSetReqDes(u8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint8Des((u8 *) &primitive->mibConfig.unifiFixMaxTxDataRate, buffer, &offset); CsrUint8Des((u8 *) &primitive->mibConfig.unifiFixTxDataRate, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->mibConfig.dot11RtsThreshold, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->mibConfig.dot11FragmentationThreshold, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->mibConfig.dot11CurrentTxPowerLevel, buffer, &offset); + CsrUint16Des((u16 *) &primitive->mibConfig.dot11RtsThreshold, buffer, &offset); + CsrUint16Des((u16 *) &primitive->mibConfig.dot11FragmentationThreshold, buffer, &offset); + CsrUint16Des((u16 *) &primitive->mibConfig.dot11CurrentTxPowerLevel, buffer, &offset); return primitive; } @@ -573,7 +573,7 @@ CsrSize CsrWifiSmeMibGetNextReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */ - bufferSize += 2; /* CsrUint16 primitive->mibAttributeLength */ + bufferSize += 2; /* u16 primitive->mibAttributeLength */ bufferSize += primitive->mibAttributeLength; /* u8 primitive->mibAttribute */ return bufferSize; } @@ -584,10 +584,10 @@ u8* CsrWifiSmeMibGetNextReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeMibGetNextReq *primitive = (CsrWifiSmeMibGetNextReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibAttributeLength); + CsrUint16Ser(ptr, len, (u16) primitive->mibAttributeLength); if (primitive->mibAttributeLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((CsrUint16) (primitive->mibAttributeLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((u16) (primitive->mibAttributeLength))); } return(ptr); } @@ -600,11 +600,11 @@ void* CsrWifiSmeMibGetNextReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->mibAttributeLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->mibAttributeLength, buffer, &offset); if (primitive->mibAttributeLength) { primitive->mibAttribute = (u8 *)CsrPmemAlloc(primitive->mibAttributeLength); - CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((CsrUint16) (primitive->mibAttributeLength))); + CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((u16) (primitive->mibAttributeLength))); } else { @@ -629,7 +629,7 @@ CsrSize CsrWifiSmeMibGetReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */ - bufferSize += 2; /* CsrUint16 primitive->mibAttributeLength */ + bufferSize += 2; /* u16 primitive->mibAttributeLength */ bufferSize += primitive->mibAttributeLength; /* u8 primitive->mibAttribute */ return bufferSize; } @@ -640,10 +640,10 @@ u8* CsrWifiSmeMibGetReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeMibGetReq *primitive = (CsrWifiSmeMibGetReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibAttributeLength); + CsrUint16Ser(ptr, len, (u16) primitive->mibAttributeLength); if (primitive->mibAttributeLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((CsrUint16) (primitive->mibAttributeLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((u16) (primitive->mibAttributeLength))); } return(ptr); } @@ -656,11 +656,11 @@ void* CsrWifiSmeMibGetReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->mibAttributeLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->mibAttributeLength, buffer, &offset); if (primitive->mibAttributeLength) { primitive->mibAttribute = (u8 *)CsrPmemAlloc(primitive->mibAttributeLength); - CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((CsrUint16) (primitive->mibAttributeLength))); + CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((u16) (primitive->mibAttributeLength))); } else { @@ -685,7 +685,7 @@ CsrSize CsrWifiSmeMibSetReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */ - bufferSize += 2; /* CsrUint16 primitive->mibAttributeLength */ + bufferSize += 2; /* u16 primitive->mibAttributeLength */ bufferSize += primitive->mibAttributeLength; /* u8 primitive->mibAttribute */ return bufferSize; } @@ -696,10 +696,10 @@ u8* CsrWifiSmeMibSetReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeMibSetReq *primitive = (CsrWifiSmeMibSetReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibAttributeLength); + CsrUint16Ser(ptr, len, (u16) primitive->mibAttributeLength); if (primitive->mibAttributeLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((CsrUint16) (primitive->mibAttributeLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((u16) (primitive->mibAttributeLength))); } return(ptr); } @@ -712,11 +712,11 @@ void* CsrWifiSmeMibSetReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->mibAttributeLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->mibAttributeLength, buffer, &offset); if (primitive->mibAttributeLength) { primitive->mibAttribute = (u8 *)CsrPmemAlloc(primitive->mibAttributeLength); - CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((CsrUint16) (primitive->mibAttributeLength))); + CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((u16) (primitive->mibAttributeLength))); } else { @@ -741,11 +741,11 @@ CsrSize CsrWifiSmeMulticastAddressReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ bufferSize += 1; /* u8 primitive->setAddressesCount */ { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->setAddressesCount; i1++) { bufferSize += 6; /* u8 primitive->setAddresses[i1].a[6] */ @@ -760,14 +760,14 @@ u8* CsrWifiSmeMulticastAddressReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeMulticastAddressReq *primitive = (CsrWifiSmeMulticastAddressReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->action); CsrUint8Ser(ptr, len, (u8) primitive->setAddressesCount); { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->setAddressesCount; i1++) { - CsrMemCpySer(ptr, len, (const void *) primitive->setAddresses[i1].a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->setAddresses[i1].a, ((u16) (6))); } } return(ptr); @@ -781,7 +781,7 @@ void* CsrWifiSmeMulticastAddressReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->action, buffer, &offset); CsrUint8Des((u8 *) &primitive->setAddressesCount, buffer, &offset); primitive->setAddresses = NULL; @@ -790,10 +790,10 @@ void* CsrWifiSmeMulticastAddressReqDes(u8 *buffer, CsrSize length) primitive->setAddresses = (CsrWifiMacAddress *)CsrPmemAlloc(sizeof(CsrWifiMacAddress) * primitive->setAddressesCount); } { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->setAddressesCount; i1++) { - CsrMemCpyDes(primitive->setAddresses[i1].a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->setAddresses[i1].a, buffer, &offset, ((u16) (6))); } } @@ -815,8 +815,8 @@ CsrSize CsrWifiSmePacketFilterSetReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ - bufferSize += 2; /* CsrUint16 primitive->filterLength */ + bufferSize += 2; /* u16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->filterLength */ bufferSize += primitive->filterLength; /* u8 primitive->filter */ bufferSize += 1; /* CsrWifiSmePacketFilterMode primitive->mode */ bufferSize += 4; /* u8 primitive->arpFilterAddress.a[4] */ @@ -829,14 +829,14 @@ u8* CsrWifiSmePacketFilterSetReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmePacketFilterSetReq *primitive = (CsrWifiSmePacketFilterSetReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->filterLength); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->filterLength); if (primitive->filterLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->filter, ((CsrUint16) (primitive->filterLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->filter, ((u16) (primitive->filterLength))); } CsrUint8Ser(ptr, len, (u8) primitive->mode); - CsrMemCpySer(ptr, len, (const void *) primitive->arpFilterAddress.a, ((CsrUint16) (4))); + CsrMemCpySer(ptr, len, (const void *) primitive->arpFilterAddress.a, ((u16) (4))); return(ptr); } @@ -848,19 +848,19 @@ void* CsrWifiSmePacketFilterSetReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->filterLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->filterLength, buffer, &offset); if (primitive->filterLength) { primitive->filter = (u8 *)CsrPmemAlloc(primitive->filterLength); - CsrMemCpyDes(primitive->filter, buffer, &offset, ((CsrUint16) (primitive->filterLength))); + CsrMemCpyDes(primitive->filter, buffer, &offset, ((u16) (primitive->filterLength))); } else { primitive->filter = NULL; } CsrUint8Des((u8 *) &primitive->mode, buffer, &offset); - CsrMemCpyDes(primitive->arpFilterAddress.a, buffer, &offset, ((CsrUint16) (4))); + CsrMemCpyDes(primitive->arpFilterAddress.a, buffer, &offset, ((u16) (4))); return primitive; } @@ -880,11 +880,11 @@ CsrSize CsrWifiSmePmkidReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 29) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ bufferSize += 1; /* u8 primitive->setPmkidsCount */ { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->setPmkidsCount; i1++) { bufferSize += 6; /* u8 primitive->setPmkids[i1].bssid.a[6] */ @@ -900,15 +900,15 @@ u8* CsrWifiSmePmkidReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmePmkidReq *primitive = (CsrWifiSmePmkidReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->action); CsrUint8Ser(ptr, len, (u8) primitive->setPmkidsCount); { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->setPmkidsCount; i1++) { - CsrMemCpySer(ptr, len, (const void *) primitive->setPmkids[i1].bssid.a, ((CsrUint16) (6))); - CsrMemCpySer(ptr, len, (const void *) primitive->setPmkids[i1].pmkid, ((CsrUint16) (16))); + CsrMemCpySer(ptr, len, (const void *) primitive->setPmkids[i1].bssid.a, ((u16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->setPmkids[i1].pmkid, ((u16) (16))); } } return(ptr); @@ -922,7 +922,7 @@ void* CsrWifiSmePmkidReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->action, buffer, &offset); CsrUint8Des((u8 *) &primitive->setPmkidsCount, buffer, &offset); primitive->setPmkids = NULL; @@ -931,11 +931,11 @@ void* CsrWifiSmePmkidReqDes(u8 *buffer, CsrSize length) primitive->setPmkids = (CsrWifiSmePmkid *)CsrPmemAlloc(sizeof(CsrWifiSmePmkid) * primitive->setPmkidsCount); } { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->setPmkidsCount; i1++) { - CsrMemCpyDes(primitive->setPmkids[i1].bssid.a, buffer, &offset, ((CsrUint16) (6))); - CsrMemCpyDes(primitive->setPmkids[i1].pmkid, buffer, &offset, ((CsrUint16) (16))); + CsrMemCpyDes(primitive->setPmkids[i1].bssid.a, buffer, &offset, ((u16) (6))); + CsrMemCpyDes(primitive->setPmkids[i1].pmkid, buffer, &offset, ((u16) (16))); } } @@ -957,7 +957,7 @@ CsrSize CsrWifiSmePowerConfigSetReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ bufferSize += 1; /* CsrWifiSmePowerSaveLevel primitive->powerConfig.powerSaveLevel */ - bufferSize += 2; /* CsrUint16 primitive->powerConfig.listenIntervalTu */ + bufferSize += 2; /* u16 primitive->powerConfig.listenIntervalTu */ bufferSize += 1; /* CsrBool primitive->powerConfig.rxDtims */ bufferSize += 1; /* CsrWifiSmeD3AutoScanMode primitive->powerConfig.d3AutoScanMode */ bufferSize += 1; /* u8 primitive->powerConfig.clientTrafficWindow */ @@ -973,7 +973,7 @@ u8* CsrWifiSmePowerConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.powerSaveLevel); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->powerConfig.listenIntervalTu); + CsrUint16Ser(ptr, len, (u16) primitive->powerConfig.listenIntervalTu); CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.rxDtims); CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.d3AutoScanMode); CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.clientTrafficWindow); @@ -991,7 +991,7 @@ void* CsrWifiSmePowerConfigSetReqDes(u8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint8Des((u8 *) &primitive->powerConfig.powerSaveLevel, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->powerConfig.listenIntervalTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->powerConfig.listenIntervalTu, buffer, &offset); CsrUint8Des((u8 *) &primitive->powerConfig.rxDtims, buffer, &offset); CsrUint8Des((u8 *) &primitive->powerConfig.d3AutoScanMode, buffer, &offset); CsrUint8Des((u8 *) &primitive->powerConfig.clientTrafficWindow, buffer, &offset); @@ -1007,9 +1007,9 @@ CsrSize CsrWifiSmeRoamingConfigSetReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 70) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 3; i2++) { bufferSize += 2; /* CsrInt16 primitive->roamingConfig.roamingBands[i2].rssiHighThreshold */ @@ -1021,17 +1021,17 @@ CsrSize CsrWifiSmeRoamingConfigSetReqSizeof(void *msg) bufferSize += 1; /* CsrBool primitive->roamingConfig.disableSmoothRoaming */ bufferSize += 1; /* CsrBool primitive->roamingConfig.disableRoamScans */ bufferSize += 1; /* u8 primitive->roamingConfig.reconnectLimit */ - bufferSize += 2; /* CsrUint16 primitive->roamingConfig.reconnectLimitIntervalMs */ + bufferSize += 2; /* u16 primitive->roamingConfig.reconnectLimitIntervalMs */ { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 3; i2++) { - bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].intervalSeconds */ - bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].validitySeconds */ - bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu */ - bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu */ - bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu */ - bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu */ + bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].intervalSeconds */ + bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].validitySeconds */ + bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu */ + bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu */ + bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu */ + bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu */ } } return bufferSize; @@ -1043,31 +1043,31 @@ u8* CsrWifiSmeRoamingConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeRoamingConfigSetReq *primitive = (CsrWifiSmeRoamingConfigSetReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 3; i2++) { - CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamingBands[i2].rssiHighThreshold); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamingBands[i2].rssiLowThreshold); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamingBands[i2].snrHighThreshold); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamingBands[i2].snrLowThreshold); + CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].rssiHighThreshold); + CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].rssiLowThreshold); + CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].snrHighThreshold); + CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].snrLowThreshold); } } CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.disableSmoothRoaming); CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.disableRoamScans); CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.reconnectLimit); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.reconnectLimitIntervalMs); + CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.reconnectLimitIntervalMs); { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 3; i2++) { - CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].intervalSeconds); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].validitySeconds); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu); + CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].intervalSeconds); + CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].validitySeconds); + CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu); + CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu); + CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu); + CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu); } } return(ptr); @@ -1081,31 +1081,31 @@ void* CsrWifiSmeRoamingConfigSetReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 3; i2++) { - CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamingBands[i2].rssiHighThreshold, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamingBands[i2].rssiLowThreshold, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamingBands[i2].snrHighThreshold, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamingBands[i2].snrLowThreshold, buffer, &offset); + CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].rssiHighThreshold, buffer, &offset); + CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].rssiLowThreshold, buffer, &offset); + CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].snrHighThreshold, buffer, &offset); + CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].snrLowThreshold, buffer, &offset); } } CsrUint8Des((u8 *) &primitive->roamingConfig.disableSmoothRoaming, buffer, &offset); CsrUint8Des((u8 *) &primitive->roamingConfig.disableRoamScans, buffer, &offset); CsrUint8Des((u8 *) &primitive->roamingConfig.reconnectLimit, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.reconnectLimitIntervalMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->roamingConfig.reconnectLimitIntervalMs, buffer, &offset); { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 3; i2++) { - CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].intervalSeconds, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].validitySeconds, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].intervalSeconds, buffer, &offset); + CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].validitySeconds, buffer, &offset); + CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu, buffer, &offset); } } @@ -1120,26 +1120,26 @@ CsrSize CsrWifiSmeScanConfigSetReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 63) */ { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 4; i2++) { - bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].intervalSeconds */ - bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].validitySeconds */ - bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu */ - bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu */ - bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu */ - bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu */ + bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].intervalSeconds */ + bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].validitySeconds */ + bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu */ + bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu */ + bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu */ + bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu */ } } bufferSize += 1; /* CsrBool primitive->scanConfig.disableAutonomousScans */ - bufferSize += 2; /* CsrUint16 primitive->scanConfig.maxResults */ + bufferSize += 2; /* u16 primitive->scanConfig.maxResults */ bufferSize += 1; /* s8 primitive->scanConfig.highRssiThreshold */ bufferSize += 1; /* s8 primitive->scanConfig.lowRssiThreshold */ bufferSize += 1; /* s8 primitive->scanConfig.deltaRssiThreshold */ bufferSize += 1; /* s8 primitive->scanConfig.highSnrThreshold */ bufferSize += 1; /* s8 primitive->scanConfig.lowSnrThreshold */ bufferSize += 1; /* s8 primitive->scanConfig.deltaSnrThreshold */ - bufferSize += 2; /* CsrUint16 primitive->scanConfig.passiveChannelListCount */ + bufferSize += 2; /* u16 primitive->scanConfig.passiveChannelListCount */ bufferSize += primitive->scanConfig.passiveChannelListCount; /* u8 primitive->scanConfig.passiveChannelList */ return bufferSize; } @@ -1151,29 +1151,29 @@ u8* CsrWifiSmeScanConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 4; i2++) { - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].intervalSeconds); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].validitySeconds); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu); + CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].intervalSeconds); + CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].validitySeconds); + CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu); + CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu); + CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu); + CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu); } } CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.disableAutonomousScans); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.maxResults); + CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.maxResults); CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.highRssiThreshold); CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.lowRssiThreshold); CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.deltaRssiThreshold); CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.highSnrThreshold); CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.lowSnrThreshold); CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.deltaSnrThreshold); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.passiveChannelListCount); + CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.passiveChannelListCount); if (primitive->scanConfig.passiveChannelListCount) { - CsrMemCpySer(ptr, len, (const void *) primitive->scanConfig.passiveChannelList, ((CsrUint16) (primitive->scanConfig.passiveChannelListCount))); + CsrMemCpySer(ptr, len, (const void *) primitive->scanConfig.passiveChannelList, ((u16) (primitive->scanConfig.passiveChannelListCount))); } return(ptr); } @@ -1187,30 +1187,30 @@ void* CsrWifiSmeScanConfigSetReqDes(u8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 4; i2++) { - CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].intervalSeconds, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].validitySeconds, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].intervalSeconds, buffer, &offset); + CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].validitySeconds, buffer, &offset); + CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu, buffer, &offset); } } CsrUint8Des((u8 *) &primitive->scanConfig.disableAutonomousScans, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->scanConfig.maxResults, buffer, &offset); + CsrUint16Des((u16 *) &primitive->scanConfig.maxResults, buffer, &offset); CsrUint8Des((u8 *) &primitive->scanConfig.highRssiThreshold, buffer, &offset); CsrUint8Des((u8 *) &primitive->scanConfig.lowRssiThreshold, buffer, &offset); CsrUint8Des((u8 *) &primitive->scanConfig.deltaRssiThreshold, buffer, &offset); CsrUint8Des((u8 *) &primitive->scanConfig.highSnrThreshold, buffer, &offset); CsrUint8Des((u8 *) &primitive->scanConfig.lowSnrThreshold, buffer, &offset); CsrUint8Des((u8 *) &primitive->scanConfig.deltaSnrThreshold, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->scanConfig.passiveChannelListCount, buffer, &offset); + CsrUint16Des((u16 *) &primitive->scanConfig.passiveChannelListCount, buffer, &offset); if (primitive->scanConfig.passiveChannelListCount) { primitive->scanConfig.passiveChannelList = (u8 *)CsrPmemAlloc(primitive->scanConfig.passiveChannelListCount); - CsrMemCpyDes(primitive->scanConfig.passiveChannelList, buffer, &offset, ((CsrUint16) (primitive->scanConfig.passiveChannelListCount))); + CsrMemCpyDes(primitive->scanConfig.passiveChannelList, buffer, &offset, ((u16) (primitive->scanConfig.passiveChannelListCount))); } else { @@ -1237,7 +1237,7 @@ CsrSize CsrWifiSmeScanFullReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 52) */ bufferSize += 1; /* u8 primitive->ssidCount */ { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->ssidCount; i1++) { bufferSize += 32; /* u8 primitive->ssid[i1].ssid[32] */ @@ -1248,9 +1248,9 @@ CsrSize CsrWifiSmeScanFullReqSizeof(void *msg) bufferSize += 1; /* CsrBool primitive->forceScan */ bufferSize += 1; /* CsrWifiSmeBssType primitive->bssType */ bufferSize += 1; /* CsrWifiSmeScanType primitive->scanType */ - bufferSize += 2; /* CsrUint16 primitive->channelListCount */ + bufferSize += 2; /* u16 primitive->channelListCount */ bufferSize += primitive->channelListCount; /* u8 primitive->channelList */ - bufferSize += 2; /* CsrUint16 primitive->probeIeLength */ + bufferSize += 2; /* u16 primitive->probeIeLength */ bufferSize += primitive->probeIeLength; /* u8 primitive->probeIe */ return bufferSize; } @@ -1263,26 +1263,26 @@ u8* CsrWifiSmeScanFullReqSer(u8 *ptr, CsrSize *len, void *msg) CsrUint16Ser(ptr, len, primitive->common.type); CsrUint8Ser(ptr, len, (u8) primitive->ssidCount); { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->ssidCount; i1++) { - CsrMemCpySer(ptr, len, (const void *) primitive->ssid[i1].ssid, ((CsrUint16) (32))); + CsrMemCpySer(ptr, len, (const void *) primitive->ssid[i1].ssid, ((u16) (32))); CsrUint8Ser(ptr, len, (u8) primitive->ssid[i1].length); } } - CsrMemCpySer(ptr, len, (const void *) primitive->bssid.a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->bssid.a, ((u16) (6))); CsrUint8Ser(ptr, len, (u8) primitive->forceScan); CsrUint8Ser(ptr, len, (u8) primitive->bssType); CsrUint8Ser(ptr, len, (u8) primitive->scanType); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->channelListCount); + CsrUint16Ser(ptr, len, (u16) primitive->channelListCount); if (primitive->channelListCount) { - CsrMemCpySer(ptr, len, (const void *) primitive->channelList, ((CsrUint16) (primitive->channelListCount))); + CsrMemCpySer(ptr, len, (const void *) primitive->channelList, ((u16) (primitive->channelListCount))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->probeIeLength); + CsrUint16Ser(ptr, len, (u16) primitive->probeIeLength); if (primitive->probeIeLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->probeIe, ((CsrUint16) (primitive->probeIeLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->probeIe, ((u16) (primitive->probeIeLength))); } return(ptr); } @@ -1302,32 +1302,32 @@ void* CsrWifiSmeScanFullReqDes(u8 *buffer, CsrSize length) primitive->ssid = (CsrWifiSsid *)CsrPmemAlloc(sizeof(CsrWifiSsid) * primitive->ssidCount); } { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->ssidCount; i1++) { - CsrMemCpyDes(primitive->ssid[i1].ssid, buffer, &offset, ((CsrUint16) (32))); + CsrMemCpyDes(primitive->ssid[i1].ssid, buffer, &offset, ((u16) (32))); CsrUint8Des((u8 *) &primitive->ssid[i1].length, buffer, &offset); } } - CsrMemCpyDes(primitive->bssid.a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->bssid.a, buffer, &offset, ((u16) (6))); CsrUint8Des((u8 *) &primitive->forceScan, buffer, &offset); CsrUint8Des((u8 *) &primitive->bssType, buffer, &offset); CsrUint8Des((u8 *) &primitive->scanType, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->channelListCount, buffer, &offset); + CsrUint16Des((u16 *) &primitive->channelListCount, buffer, &offset); if (primitive->channelListCount) { primitive->channelList = (u8 *)CsrPmemAlloc(primitive->channelListCount); - CsrMemCpyDes(primitive->channelList, buffer, &offset, ((CsrUint16) (primitive->channelListCount))); + CsrMemCpyDes(primitive->channelList, buffer, &offset, ((u16) (primitive->channelListCount))); } else { primitive->channelList = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->probeIeLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->probeIeLength, buffer, &offset); if (primitive->probeIeLength) { primitive->probeIe = (u8 *)CsrPmemAlloc(primitive->probeIeLength); - CsrMemCpyDes(primitive->probeIe, buffer, &offset, ((CsrUint16) (primitive->probeIeLength))); + CsrMemCpyDes(primitive->probeIe, buffer, &offset, ((u16) (primitive->probeIeLength))); } else { @@ -1353,7 +1353,7 @@ CsrSize CsrWifiSmeSmeStaConfigSetReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* u8 primitive->smeConfig.connectionQualityRssiChangeTrigger */ bufferSize += 1; /* u8 primitive->smeConfig.connectionQualitySnrChangeTrigger */ bufferSize += 1; /* CsrWifiSmeWmmModeMask primitive->smeConfig.wmmModeMask */ @@ -1369,7 +1369,7 @@ u8* CsrWifiSmeSmeStaConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeSmeStaConfigSetReq *primitive = (CsrWifiSmeSmeStaConfigSetReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.connectionQualityRssiChangeTrigger); CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.connectionQualitySnrChangeTrigger); CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.wmmModeMask); @@ -1387,7 +1387,7 @@ void* CsrWifiSmeSmeStaConfigSetReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->smeConfig.connectionQualityRssiChangeTrigger, buffer, &offset); CsrUint8Des((u8 *) &primitive->smeConfig.connectionQualitySnrChangeTrigger, buffer, &offset); CsrUint8Des((u8 *) &primitive->smeConfig.wmmModeMask, buffer, &offset); @@ -1405,14 +1405,14 @@ CsrSize CsrWifiSmeTspecReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 18) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ bufferSize += 4; /* CsrUint32 primitive->transactionId */ bufferSize += 1; /* CsrBool primitive->strict */ bufferSize += 1; /* CsrWifiSmeTspecCtrlMask primitive->ctrlMask */ - bufferSize += 2; /* CsrUint16 primitive->tspecLength */ + bufferSize += 2; /* u16 primitive->tspecLength */ bufferSize += primitive->tspecLength; /* u8 primitive->tspec */ - bufferSize += 2; /* CsrUint16 primitive->tclasLength */ + bufferSize += 2; /* u16 primitive->tclasLength */ bufferSize += primitive->tclasLength; /* u8 primitive->tclas */ return bufferSize; } @@ -1423,20 +1423,20 @@ u8* CsrWifiSmeTspecReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeTspecReq *primitive = (CsrWifiSmeTspecReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->action); CsrUint32Ser(ptr, len, (CsrUint32) primitive->transactionId); CsrUint8Ser(ptr, len, (u8) primitive->strict); CsrUint8Ser(ptr, len, (u8) primitive->ctrlMask); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->tspecLength); + CsrUint16Ser(ptr, len, (u16) primitive->tspecLength); if (primitive->tspecLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->tspec, ((CsrUint16) (primitive->tspecLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->tspec, ((u16) (primitive->tspecLength))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->tclasLength); + CsrUint16Ser(ptr, len, (u16) primitive->tclasLength); if (primitive->tclasLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->tclas, ((CsrUint16) (primitive->tclasLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->tclas, ((u16) (primitive->tclasLength))); } return(ptr); } @@ -1449,26 +1449,26 @@ void* CsrWifiSmeTspecReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->action, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->transactionId, buffer, &offset); CsrUint8Des((u8 *) &primitive->strict, buffer, &offset); CsrUint8Des((u8 *) &primitive->ctrlMask, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->tspecLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->tspecLength, buffer, &offset); if (primitive->tspecLength) { primitive->tspec = (u8 *)CsrPmemAlloc(primitive->tspecLength); - CsrMemCpyDes(primitive->tspec, buffer, &offset, ((CsrUint16) (primitive->tspecLength))); + CsrMemCpyDes(primitive->tspec, buffer, &offset, ((u16) (primitive->tspecLength))); } else { primitive->tspec = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->tclasLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->tclasLength, buffer, &offset); if (primitive->tclasLength) { primitive->tclas = (u8 *)CsrPmemAlloc(primitive->tclasLength); - CsrMemCpyDes(primitive->tclas, buffer, &offset, ((CsrUint16) (primitive->tclasLength))); + CsrMemCpyDes(primitive->tclas, buffer, &offset, ((u16) (primitive->tclasLength))); } else { @@ -1495,12 +1495,12 @@ CsrSize CsrWifiSmeWifiFlightmodeReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */ bufferSize += 6; /* u8 primitive->address.a[6] */ - bufferSize += 2; /* CsrUint16 primitive->mibFilesCount */ + bufferSize += 2; /* u16 primitive->mibFilesCount */ { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->mibFilesCount; i1++) { - bufferSize += 2; /* CsrUint16 primitive->mibFiles[i1].length */ + bufferSize += 2; /* u16 primitive->mibFiles[i1].length */ bufferSize += primitive->mibFiles[i1].length; /* u8 primitive->mibFiles[i1].data */ } } @@ -1513,16 +1513,16 @@ u8* CsrWifiSmeWifiFlightmodeReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeWifiFlightmodeReq *primitive = (CsrWifiSmeWifiFlightmodeReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((CsrUint16) (6))); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibFilesCount); + CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((u16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->mibFilesCount); { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->mibFilesCount; i1++) { - CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibFiles[i1].length); + CsrUint16Ser(ptr, len, (u16) primitive->mibFiles[i1].length); if (primitive->mibFiles[i1].length) { - CsrMemCpySer(ptr, len, (const void *) primitive->mibFiles[i1].data, ((CsrUint16) (primitive->mibFiles[i1].length))); + CsrMemCpySer(ptr, len, (const void *) primitive->mibFiles[i1].data, ((u16) (primitive->mibFiles[i1].length))); } } } @@ -1537,22 +1537,22 @@ void* CsrWifiSmeWifiFlightmodeReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrMemCpyDes(primitive->address.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint16Des((CsrUint16 *) &primitive->mibFilesCount, buffer, &offset); + CsrMemCpyDes(primitive->address.a, buffer, &offset, ((u16) (6))); + CsrUint16Des((u16 *) &primitive->mibFilesCount, buffer, &offset); primitive->mibFiles = NULL; if (primitive->mibFilesCount) { primitive->mibFiles = (CsrWifiSmeDataBlock *)CsrPmemAlloc(sizeof(CsrWifiSmeDataBlock) * primitive->mibFilesCount); } { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->mibFilesCount; i1++) { - CsrUint16Des((CsrUint16 *) &primitive->mibFiles[i1].length, buffer, &offset); + CsrUint16Des((u16 *) &primitive->mibFiles[i1].length, buffer, &offset); if (primitive->mibFiles[i1].length) { primitive->mibFiles[i1].data = (u8 *)CsrPmemAlloc(primitive->mibFiles[i1].length); - CsrMemCpyDes(primitive->mibFiles[i1].data, buffer, &offset, ((CsrUint16) (primitive->mibFiles[i1].length))); + CsrMemCpyDes(primitive->mibFiles[i1].data, buffer, &offset, ((u16) (primitive->mibFiles[i1].length))); } else { @@ -1569,7 +1569,7 @@ void CsrWifiSmeWifiFlightmodeReqSerFree(void *voidPrimitivePointer) { CsrWifiSmeWifiFlightmodeReq *primitive = (CsrWifiSmeWifiFlightmodeReq *) voidPrimitivePointer; { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->mibFilesCount; i1++) { CsrPmemFree(primitive->mibFiles[i1].data); @@ -1587,12 +1587,12 @@ CsrSize CsrWifiSmeWifiOnReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */ bufferSize += 6; /* u8 primitive->address.a[6] */ - bufferSize += 2; /* CsrUint16 primitive->mibFilesCount */ + bufferSize += 2; /* u16 primitive->mibFilesCount */ { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->mibFilesCount; i1++) { - bufferSize += 2; /* CsrUint16 primitive->mibFiles[i1].length */ + bufferSize += 2; /* u16 primitive->mibFiles[i1].length */ bufferSize += primitive->mibFiles[i1].length; /* u8 primitive->mibFiles[i1].data */ } } @@ -1605,16 +1605,16 @@ u8* CsrWifiSmeWifiOnReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeWifiOnReq *primitive = (CsrWifiSmeWifiOnReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((CsrUint16) (6))); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibFilesCount); + CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((u16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->mibFilesCount); { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->mibFilesCount; i1++) { - CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibFiles[i1].length); + CsrUint16Ser(ptr, len, (u16) primitive->mibFiles[i1].length); if (primitive->mibFiles[i1].length) { - CsrMemCpySer(ptr, len, (const void *) primitive->mibFiles[i1].data, ((CsrUint16) (primitive->mibFiles[i1].length))); + CsrMemCpySer(ptr, len, (const void *) primitive->mibFiles[i1].data, ((u16) (primitive->mibFiles[i1].length))); } } } @@ -1629,22 +1629,22 @@ void* CsrWifiSmeWifiOnReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrMemCpyDes(primitive->address.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint16Des((CsrUint16 *) &primitive->mibFilesCount, buffer, &offset); + CsrMemCpyDes(primitive->address.a, buffer, &offset, ((u16) (6))); + CsrUint16Des((u16 *) &primitive->mibFilesCount, buffer, &offset); primitive->mibFiles = NULL; if (primitive->mibFilesCount) { primitive->mibFiles = (CsrWifiSmeDataBlock *)CsrPmemAlloc(sizeof(CsrWifiSmeDataBlock) * primitive->mibFilesCount); } { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->mibFilesCount; i1++) { - CsrUint16Des((CsrUint16 *) &primitive->mibFiles[i1].length, buffer, &offset); + CsrUint16Des((u16 *) &primitive->mibFiles[i1].length, buffer, &offset); if (primitive->mibFiles[i1].length) { primitive->mibFiles[i1].data = (u8 *)CsrPmemAlloc(primitive->mibFiles[i1].length); - CsrMemCpyDes(primitive->mibFiles[i1].data, buffer, &offset, ((CsrUint16) (primitive->mibFiles[i1].length))); + CsrMemCpyDes(primitive->mibFiles[i1].data, buffer, &offset, ((u16) (primitive->mibFiles[i1].length))); } else { @@ -1661,7 +1661,7 @@ void CsrWifiSmeWifiOnReqSerFree(void *voidPrimitivePointer) { CsrWifiSmeWifiOnReq *primitive = (CsrWifiSmeWifiOnReq *) voidPrimitivePointer; { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->mibFilesCount; i1++) { CsrPmemFree(primitive->mibFiles[i1].data); @@ -1680,7 +1680,7 @@ CsrSize CsrWifiSmeCloakedSsidsSetReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 37) */ bufferSize += 1; /* u8 primitive->cloakedSsids.cloakedSsidsCount */ { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) { bufferSize += 32; /* u8 primitive->cloakedSsids.cloakedSsids[i2].ssid[32] */ @@ -1698,10 +1698,10 @@ u8* CsrWifiSmeCloakedSsidsSetReqSer(u8 *ptr, CsrSize *len, void *msg) CsrUint16Ser(ptr, len, primitive->common.type); CsrUint8Ser(ptr, len, (u8) primitive->cloakedSsids.cloakedSsidsCount); { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) { - CsrMemCpySer(ptr, len, (const void *) primitive->cloakedSsids.cloakedSsids[i2].ssid, ((CsrUint16) (32))); + CsrMemCpySer(ptr, len, (const void *) primitive->cloakedSsids.cloakedSsids[i2].ssid, ((u16) (32))); CsrUint8Ser(ptr, len, (u8) primitive->cloakedSsids.cloakedSsids[i2].length); } } @@ -1723,10 +1723,10 @@ void* CsrWifiSmeCloakedSsidsSetReqDes(u8 *buffer, CsrSize length) primitive->cloakedSsids.cloakedSsids = (CsrWifiSsid *)CsrPmemAlloc(sizeof(CsrWifiSsid) * primitive->cloakedSsids.cloakedSsidsCount); } { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) { - CsrMemCpyDes(primitive->cloakedSsids.cloakedSsids[i2].ssid, buffer, &offset, ((CsrUint16) (32))); + CsrMemCpyDes(primitive->cloakedSsids.cloakedSsids[i2].ssid, buffer, &offset, ((u16) (32))); CsrUint8Des((u8 *) &primitive->cloakedSsids.cloakedSsids[i2].length, buffer, &offset); } } @@ -1762,7 +1762,7 @@ u8* CsrWifiSmeSmeCommonConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.trustLevel); - CsrMemCpySer(ptr, len, (const void *) primitive->deviceConfig.countryCode, ((CsrUint16) (2))); + CsrMemCpySer(ptr, len, (const void *) primitive->deviceConfig.countryCode, ((u16) (2))); CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.firmwareDriverInterface); CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.enableStrictDraftN); return(ptr); @@ -1777,7 +1777,7 @@ void* CsrWifiSmeSmeCommonConfigSetReqDes(u8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint8Des((u8 *) &primitive->deviceConfig.trustLevel, buffer, &offset); - CsrMemCpyDes(primitive->deviceConfig.countryCode, buffer, &offset, ((CsrUint16) (2))); + CsrMemCpyDes(primitive->deviceConfig.countryCode, buffer, &offset, ((u16) (2))); CsrUint8Des((u8 *) &primitive->deviceConfig.firmwareDriverInterface, buffer, &offset); CsrUint8Des((u8 *) &primitive->deviceConfig.enableStrictDraftN, buffer, &offset); @@ -1805,7 +1805,7 @@ CsrSize CsrWifiSmeWpsConfigurationReqSizeof(void *msg) bufferSize += 8; /* u8 primitive->wpsConfig.primDeviceType.deviceDetails[8] */ bufferSize += 1; /* u8 primitive->wpsConfig.secondaryDeviceTypeCount */ { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < primitive->wpsConfig.secondaryDeviceTypeCount; i2++) { bufferSize += 8; /* u8 primitive->wpsConfig.secondaryDeviceType[i2].deviceDetails[8] */ @@ -1824,28 +1824,28 @@ u8* CsrWifiSmeWpsConfigurationReqSer(u8 *ptr, CsrSize *len, void *msg) *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.wpsVersion); - CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.uuid, ((CsrUint16) (16))); - CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.deviceName, ((CsrUint16) (32))); + CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.uuid, ((u16) (16))); + CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.deviceName, ((u16) (32))); CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.deviceNameLength); - CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.manufacturer, ((CsrUint16) (64))); + CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.manufacturer, ((u16) (64))); CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.manufacturerLength); - CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.modelName, ((CsrUint16) (32))); + CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.modelName, ((u16) (32))); CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.modelNameLength); - CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.modelNumber, ((CsrUint16) (32))); + CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.modelNumber, ((u16) (32))); CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.modelNumberLength); - CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.serialNumber, ((CsrUint16) (32))); - CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.primDeviceType.deviceDetails, ((CsrUint16) (8))); + CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.serialNumber, ((u16) (32))); + CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.primDeviceType.deviceDetails, ((u16) (8))); CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.secondaryDeviceTypeCount); { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < primitive->wpsConfig.secondaryDeviceTypeCount; i2++) { - CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.secondaryDeviceType[i2].deviceDetails, ((CsrUint16) (8))); + CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.secondaryDeviceType[i2].deviceDetails, ((u16) (8))); } } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->wpsConfig.configMethods); + CsrUint16Ser(ptr, len, (u16) primitive->wpsConfig.configMethods); CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.rfBands); - CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.osVersion, ((CsrUint16) (4))); + CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.osVersion, ((u16) (4))); return(ptr); } @@ -1858,17 +1858,17 @@ void* CsrWifiSmeWpsConfigurationReqDes(u8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint8Des((u8 *) &primitive->wpsConfig.wpsVersion, buffer, &offset); - CsrMemCpyDes(primitive->wpsConfig.uuid, buffer, &offset, ((CsrUint16) (16))); - CsrMemCpyDes(primitive->wpsConfig.deviceName, buffer, &offset, ((CsrUint16) (32))); + CsrMemCpyDes(primitive->wpsConfig.uuid, buffer, &offset, ((u16) (16))); + CsrMemCpyDes(primitive->wpsConfig.deviceName, buffer, &offset, ((u16) (32))); CsrUint8Des((u8 *) &primitive->wpsConfig.deviceNameLength, buffer, &offset); - CsrMemCpyDes(primitive->wpsConfig.manufacturer, buffer, &offset, ((CsrUint16) (64))); + CsrMemCpyDes(primitive->wpsConfig.manufacturer, buffer, &offset, ((u16) (64))); CsrUint8Des((u8 *) &primitive->wpsConfig.manufacturerLength, buffer, &offset); - CsrMemCpyDes(primitive->wpsConfig.modelName, buffer, &offset, ((CsrUint16) (32))); + CsrMemCpyDes(primitive->wpsConfig.modelName, buffer, &offset, ((u16) (32))); CsrUint8Des((u8 *) &primitive->wpsConfig.modelNameLength, buffer, &offset); - CsrMemCpyDes(primitive->wpsConfig.modelNumber, buffer, &offset, ((CsrUint16) (32))); + CsrMemCpyDes(primitive->wpsConfig.modelNumber, buffer, &offset, ((u16) (32))); CsrUint8Des((u8 *) &primitive->wpsConfig.modelNumberLength, buffer, &offset); - CsrMemCpyDes(primitive->wpsConfig.serialNumber, buffer, &offset, ((CsrUint16) (32))); - CsrMemCpyDes(primitive->wpsConfig.primDeviceType.deviceDetails, buffer, &offset, ((CsrUint16) (8))); + CsrMemCpyDes(primitive->wpsConfig.serialNumber, buffer, &offset, ((u16) (32))); + CsrMemCpyDes(primitive->wpsConfig.primDeviceType.deviceDetails, buffer, &offset, ((u16) (8))); CsrUint8Des((u8 *) &primitive->wpsConfig.secondaryDeviceTypeCount, buffer, &offset); primitive->wpsConfig.secondaryDeviceType = NULL; if (primitive->wpsConfig.secondaryDeviceTypeCount) @@ -1876,15 +1876,15 @@ void* CsrWifiSmeWpsConfigurationReqDes(u8 *buffer, CsrSize length) primitive->wpsConfig.secondaryDeviceType = (CsrWifiSmeWpsDeviceType *)CsrPmemAlloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->wpsConfig.secondaryDeviceTypeCount); } { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < primitive->wpsConfig.secondaryDeviceTypeCount; i2++) { - CsrMemCpyDes(primitive->wpsConfig.secondaryDeviceType[i2].deviceDetails, buffer, &offset, ((CsrUint16) (8))); + CsrMemCpyDes(primitive->wpsConfig.secondaryDeviceType[i2].deviceDetails, buffer, &offset, ((u16) (8))); } } - CsrUint16Des((CsrUint16 *) &primitive->wpsConfig.configMethods, buffer, &offset); + CsrUint16Des((u16 *) &primitive->wpsConfig.configMethods, buffer, &offset); CsrUint8Des((u8 *) &primitive->wpsConfig.rfBands, buffer, &offset); - CsrMemCpyDes(primitive->wpsConfig.osVersion, buffer, &offset, ((CsrUint16) (4))); + CsrMemCpyDes(primitive->wpsConfig.osVersion, buffer, &offset, ((u16) (4))); return primitive; } @@ -1918,7 +1918,7 @@ u8* CsrWifiSmeSetReqSer(u8 *ptr, CsrSize *len, void *msg) CsrUint32Ser(ptr, len, (CsrUint32) primitive->dataLength); if (primitive->dataLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->data, ((CsrUint16) (primitive->dataLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength))); } return(ptr); } @@ -1935,7 +1935,7 @@ void* CsrWifiSmeSetReqDes(u8 *buffer, CsrSize length) if (primitive->dataLength) { primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); - CsrMemCpyDes(primitive->data, buffer, &offset, ((CsrUint16) (primitive->dataLength))); + CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength))); } else { @@ -1960,10 +1960,10 @@ CsrSize CsrWifiSmeAdhocConfigGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 2; /* CsrUint16 primitive->adHocConfig.atimWindowTu */ - bufferSize += 2; /* CsrUint16 primitive->adHocConfig.beaconPeriodTu */ - bufferSize += 2; /* CsrUint16 primitive->adHocConfig.joinOnlyAttempts */ - bufferSize += 2; /* CsrUint16 primitive->adHocConfig.joinAttemptIntervalMs */ + bufferSize += 2; /* u16 primitive->adHocConfig.atimWindowTu */ + bufferSize += 2; /* u16 primitive->adHocConfig.beaconPeriodTu */ + bufferSize += 2; /* u16 primitive->adHocConfig.joinOnlyAttempts */ + bufferSize += 2; /* u16 primitive->adHocConfig.joinAttemptIntervalMs */ return bufferSize; } @@ -1973,11 +1973,11 @@ u8* CsrWifiSmeAdhocConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeAdhocConfigGetCfm *primitive = (CsrWifiSmeAdhocConfigGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->adHocConfig.atimWindowTu); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->adHocConfig.beaconPeriodTu); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->adHocConfig.joinOnlyAttempts); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->adHocConfig.joinAttemptIntervalMs); + CsrUint16Ser(ptr, len, (u16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.atimWindowTu); + CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.beaconPeriodTu); + CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.joinOnlyAttempts); + CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.joinAttemptIntervalMs); return(ptr); } @@ -1989,11 +1989,11 @@ void* CsrWifiSmeAdhocConfigGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->adHocConfig.atimWindowTu, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->adHocConfig.beaconPeriodTu, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->adHocConfig.joinOnlyAttempts, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->adHocConfig.joinAttemptIntervalMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->adHocConfig.atimWindowTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->adHocConfig.beaconPeriodTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->adHocConfig.joinOnlyAttempts, buffer, &offset); + CsrUint16Des((u16 *) &primitive->adHocConfig.joinAttemptIntervalMs, buffer, &offset); return primitive; } @@ -2005,38 +2005,38 @@ CsrSize CsrWifiSmeAssociationCompleteIndSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 98) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 32; /* u8 primitive->connectionInfo.ssid.ssid[32] */ bufferSize += 1; /* u8 primitive->connectionInfo.ssid.length */ bufferSize += 6; /* u8 primitive->connectionInfo.bssid.a[6] */ bufferSize += 1; /* CsrWifiSme80211NetworkType primitive->connectionInfo.networkType80211 */ bufferSize += 1; /* u8 primitive->connectionInfo.channelNumber */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.channelFrequency */ + bufferSize += 2; /* u16 primitive->connectionInfo.channelFrequency */ bufferSize += 2; /* CsrWifiSmeAuthMode primitive->connectionInfo.authMode */ bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.pairwiseCipher */ bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.groupCipher */ bufferSize += 1; /* CsrWifiSmeRadioIF primitive->connectionInfo.ifIndex */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.atimWindowTu */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.beaconPeriodTu */ + bufferSize += 2; /* u16 primitive->connectionInfo.atimWindowTu */ + bufferSize += 2; /* u16 primitive->connectionInfo.beaconPeriodTu */ bufferSize += 1; /* CsrBool primitive->connectionInfo.reassociation */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.beaconFrameLength */ + bufferSize += 2; /* u16 primitive->connectionInfo.beaconFrameLength */ bufferSize += primitive->connectionInfo.beaconFrameLength; /* u8 primitive->connectionInfo.beaconFrame */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.associationReqFrameLength */ + bufferSize += 2; /* u16 primitive->connectionInfo.associationReqFrameLength */ bufferSize += primitive->connectionInfo.associationReqFrameLength; /* u8 primitive->connectionInfo.associationReqFrame */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.associationRspFrameLength */ + bufferSize += 2; /* u16 primitive->connectionInfo.associationRspFrameLength */ bufferSize += primitive->connectionInfo.associationRspFrameLength; /* u8 primitive->connectionInfo.associationRspFrame */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocScanInfoElementsLength */ + bufferSize += 2; /* u16 primitive->connectionInfo.assocScanInfoElementsLength */ bufferSize += primitive->connectionInfo.assocScanInfoElementsLength; /* u8 primitive->connectionInfo.assocScanInfoElements */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqCapabilities */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqListenIntervalTu */ + bufferSize += 2; /* u16 primitive->connectionInfo.assocReqCapabilities */ + bufferSize += 2; /* u16 primitive->connectionInfo.assocReqListenIntervalTu */ bufferSize += 6; /* u8 primitive->connectionInfo.assocReqApAddress.a[6] */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqInfoElementsLength */ + bufferSize += 2; /* u16 primitive->connectionInfo.assocReqInfoElementsLength */ bufferSize += primitive->connectionInfo.assocReqInfoElementsLength; /* u8 primitive->connectionInfo.assocReqInfoElements */ bufferSize += 2; /* CsrWifiSmeIEEE80211Result primitive->connectionInfo.assocRspResult */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspCapabilityInfo */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspAssociationId */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspInfoElementsLength */ + bufferSize += 2; /* u16 primitive->connectionInfo.assocRspCapabilityInfo */ + bufferSize += 2; /* u16 primitive->connectionInfo.assocRspAssociationId */ + bufferSize += 2; /* u16 primitive->connectionInfo.assocRspInfoElementsLength */ bufferSize += primitive->connectionInfo.assocRspInfoElementsLength; /* u8 primitive->connectionInfo.assocRspInfoElements */ bufferSize += 2; /* CsrWifiSmeIEEE80211Reason primitive->deauthReason */ return bufferSize; @@ -2048,58 +2048,58 @@ u8* CsrWifiSmeAssociationCompleteIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeAssociationCompleteInd *primitive = (CsrWifiSmeAssociationCompleteInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.ssid.ssid, ((CsrUint16) (32))); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.ssid.ssid, ((u16) (32))); CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ssid.length); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.bssid.a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.bssid.a, ((u16) (6))); CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.networkType80211); CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.channelNumber); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.channelFrequency); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.authMode); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.pairwiseCipher); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.groupCipher); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.channelFrequency); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.authMode); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.pairwiseCipher); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.groupCipher); CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ifIndex); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.atimWindowTu); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.beaconPeriodTu); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.atimWindowTu); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.beaconPeriodTu); CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.reassociation); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.beaconFrameLength); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.beaconFrameLength); if (primitive->connectionInfo.beaconFrameLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.beaconFrame, ((CsrUint16) (primitive->connectionInfo.beaconFrameLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.beaconFrame, ((u16) (primitive->connectionInfo.beaconFrameLength))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.associationReqFrameLength); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.associationReqFrameLength); if (primitive->connectionInfo.associationReqFrameLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationReqFrame, ((CsrUint16) (primitive->connectionInfo.associationReqFrameLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationReqFrame, ((u16) (primitive->connectionInfo.associationReqFrameLength))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.associationRspFrameLength); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.associationRspFrameLength); if (primitive->connectionInfo.associationRspFrameLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationRspFrame, ((CsrUint16) (primitive->connectionInfo.associationRspFrameLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationRspFrame, ((u16) (primitive->connectionInfo.associationRspFrameLength))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocScanInfoElementsLength); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocScanInfoElementsLength); if (primitive->connectionInfo.assocScanInfoElementsLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocScanInfoElements, ((CsrUint16) (primitive->connectionInfo.assocScanInfoElementsLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocScanInfoElements, ((u16) (primitive->connectionInfo.assocScanInfoElementsLength))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocReqCapabilities); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocReqListenIntervalTu); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqApAddress.a, ((CsrUint16) (6))); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocReqInfoElementsLength); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqCapabilities); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqListenIntervalTu); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqApAddress.a, ((u16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqInfoElementsLength); if (primitive->connectionInfo.assocReqInfoElementsLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqInfoElements, ((CsrUint16) (primitive->connectionInfo.assocReqInfoElementsLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqInfoElements, ((u16) (primitive->connectionInfo.assocReqInfoElementsLength))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspResult); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspCapabilityInfo); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspAssociationId); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspInfoElementsLength); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspResult); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspCapabilityInfo); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspAssociationId); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspInfoElementsLength); if (primitive->connectionInfo.assocRspInfoElementsLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocRspInfoElements, ((CsrUint16) (primitive->connectionInfo.assocRspInfoElementsLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocRspInfoElements, ((u16) (primitive->connectionInfo.assocRspInfoElementsLength))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->deauthReason); + CsrUint16Ser(ptr, len, (u16) primitive->deauthReason); return(ptr); } @@ -2111,88 +2111,88 @@ void* CsrWifiSmeAssociationCompleteIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrMemCpyDes(primitive->connectionInfo.ssid.ssid, buffer, &offset, ((CsrUint16) (32))); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); + CsrMemCpyDes(primitive->connectionInfo.ssid.ssid, buffer, &offset, ((u16) (32))); CsrUint8Des((u8 *) &primitive->connectionInfo.ssid.length, buffer, &offset); - CsrMemCpyDes(primitive->connectionInfo.bssid.a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->connectionInfo.bssid.a, buffer, &offset, ((u16) (6))); CsrUint8Des((u8 *) &primitive->connectionInfo.networkType80211, buffer, &offset); CsrUint8Des((u8 *) &primitive->connectionInfo.channelNumber, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.channelFrequency, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.authMode, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.pairwiseCipher, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.groupCipher, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.channelFrequency, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.authMode, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.pairwiseCipher, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.groupCipher, buffer, &offset); CsrUint8Des((u8 *) &primitive->connectionInfo.ifIndex, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.atimWindowTu, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.beaconPeriodTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.atimWindowTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.beaconPeriodTu, buffer, &offset); CsrUint8Des((u8 *) &primitive->connectionInfo.reassociation, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.beaconFrameLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.beaconFrameLength, buffer, &offset); if (primitive->connectionInfo.beaconFrameLength) { primitive->connectionInfo.beaconFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.beaconFrameLength); - CsrMemCpyDes(primitive->connectionInfo.beaconFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.beaconFrameLength))); + CsrMemCpyDes(primitive->connectionInfo.beaconFrame, buffer, &offset, ((u16) (primitive->connectionInfo.beaconFrameLength))); } else { primitive->connectionInfo.beaconFrame = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.associationReqFrameLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.associationReqFrameLength, buffer, &offset); if (primitive->connectionInfo.associationReqFrameLength) { primitive->connectionInfo.associationReqFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.associationReqFrameLength); - CsrMemCpyDes(primitive->connectionInfo.associationReqFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.associationReqFrameLength))); + CsrMemCpyDes(primitive->connectionInfo.associationReqFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationReqFrameLength))); } else { primitive->connectionInfo.associationReqFrame = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.associationRspFrameLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.associationRspFrameLength, buffer, &offset); if (primitive->connectionInfo.associationRspFrameLength) { primitive->connectionInfo.associationRspFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.associationRspFrameLength); - CsrMemCpyDes(primitive->connectionInfo.associationRspFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.associationRspFrameLength))); + CsrMemCpyDes(primitive->connectionInfo.associationRspFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationRspFrameLength))); } else { primitive->connectionInfo.associationRspFrame = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocScanInfoElementsLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocScanInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocScanInfoElementsLength) { primitive->connectionInfo.assocScanInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocScanInfoElementsLength); - CsrMemCpyDes(primitive->connectionInfo.assocScanInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocScanInfoElementsLength))); + CsrMemCpyDes(primitive->connectionInfo.assocScanInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocScanInfoElementsLength))); } else { primitive->connectionInfo.assocScanInfoElements = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocReqCapabilities, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocReqListenIntervalTu, buffer, &offset); - CsrMemCpyDes(primitive->connectionInfo.assocReqApAddress.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocReqInfoElementsLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqCapabilities, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqListenIntervalTu, buffer, &offset); + CsrMemCpyDes(primitive->connectionInfo.assocReqApAddress.a, buffer, &offset, ((u16) (6))); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocReqInfoElementsLength) { primitive->connectionInfo.assocReqInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocReqInfoElementsLength); - CsrMemCpyDes(primitive->connectionInfo.assocReqInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocReqInfoElementsLength))); + CsrMemCpyDes(primitive->connectionInfo.assocReqInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocReqInfoElementsLength))); } else { primitive->connectionInfo.assocReqInfoElements = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspResult, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspCapabilityInfo, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspAssociationId, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspInfoElementsLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspResult, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspCapabilityInfo, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspAssociationId, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocRspInfoElementsLength) { primitive->connectionInfo.assocRspInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocRspInfoElementsLength); - CsrMemCpyDes(primitive->connectionInfo.assocRspInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocRspInfoElementsLength))); + CsrMemCpyDes(primitive->connectionInfo.assocRspInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocRspInfoElementsLength))); } else { primitive->connectionInfo.assocRspInfoElements = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->deauthReason, buffer, &offset); + CsrUint16Des((u16 *) &primitive->deauthReason, buffer, &offset); return primitive; } @@ -2216,7 +2216,7 @@ CsrSize CsrWifiSmeAssociationStartIndSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 44) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 6; /* u8 primitive->address.a[6] */ bufferSize += 32; /* u8 primitive->ssid.ssid[32] */ bufferSize += 1; /* u8 primitive->ssid.length */ @@ -2229,9 +2229,9 @@ u8* CsrWifiSmeAssociationStartIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeAssociationStartInd *primitive = (CsrWifiSmeAssociationStartInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((CsrUint16) (6))); - CsrMemCpySer(ptr, len, (const void *) primitive->ssid.ssid, ((CsrUint16) (32))); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((u16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->ssid.ssid, ((u16) (32))); CsrUint8Ser(ptr, len, (u8) primitive->ssid.length); return(ptr); } @@ -2244,9 +2244,9 @@ void* CsrWifiSmeAssociationStartIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrMemCpyDes(primitive->address.a, buffer, &offset, ((CsrUint16) (6))); - CsrMemCpyDes(primitive->ssid.ssid, buffer, &offset, ((CsrUint16) (32))); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrMemCpyDes(primitive->address.a, buffer, &offset, ((u16) (6))); + CsrMemCpyDes(primitive->ssid.ssid, buffer, &offset, ((u16) (32))); CsrUint8Des((u8 *) &primitive->ssid.length, buffer, &offset); return primitive; @@ -2259,12 +2259,12 @@ CsrSize CsrWifiSmeBlacklistCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ bufferSize += 1; /* u8 primitive->getAddressCount */ { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->getAddressCount; i1++) { bufferSize += 6; /* u8 primitive->getAddresses[i1].a[6] */ @@ -2279,15 +2279,15 @@ u8* CsrWifiSmeBlacklistCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeBlacklistCfm *primitive = (CsrWifiSmeBlacklistCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); CsrUint8Ser(ptr, len, (u8) primitive->action); CsrUint8Ser(ptr, len, (u8) primitive->getAddressCount); { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->getAddressCount; i1++) { - CsrMemCpySer(ptr, len, (const void *) primitive->getAddresses[i1].a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->getAddresses[i1].a, ((u16) (6))); } } return(ptr); @@ -2301,8 +2301,8 @@ void* CsrWifiSmeBlacklistCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); CsrUint8Des((u8 *) &primitive->action, buffer, &offset); CsrUint8Des((u8 *) &primitive->getAddressCount, buffer, &offset); primitive->getAddresses = NULL; @@ -2311,10 +2311,10 @@ void* CsrWifiSmeBlacklistCfmDes(u8 *buffer, CsrSize length) primitive->getAddresses = (CsrWifiMacAddress *)CsrPmemAlloc(sizeof(CsrWifiMacAddress) * primitive->getAddressCount); } { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->getAddressCount; i1++) { - CsrMemCpyDes(primitive->getAddresses[i1].a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->getAddresses[i1].a, buffer, &offset, ((u16) (6))); } } @@ -2337,7 +2337,7 @@ CsrSize CsrWifiSmeCalibrationDataGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 2; /* CsrUint16 primitive->calibrationDataLength */ + bufferSize += 2; /* u16 primitive->calibrationDataLength */ bufferSize += primitive->calibrationDataLength; /* u8 primitive->calibrationData */ return bufferSize; } @@ -2348,11 +2348,11 @@ u8* CsrWifiSmeCalibrationDataGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeCalibrationDataGetCfm *primitive = (CsrWifiSmeCalibrationDataGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->calibrationDataLength); + CsrUint16Ser(ptr, len, (u16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->calibrationDataLength); if (primitive->calibrationDataLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->calibrationData, ((CsrUint16) (primitive->calibrationDataLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->calibrationData, ((u16) (primitive->calibrationDataLength))); } return(ptr); } @@ -2365,12 +2365,12 @@ void* CsrWifiSmeCalibrationDataGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->calibrationDataLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->calibrationDataLength, buffer, &offset); if (primitive->calibrationDataLength) { primitive->calibrationData = (u8 *)CsrPmemAlloc(primitive->calibrationDataLength); - CsrMemCpyDes(primitive->calibrationData, buffer, &offset, ((CsrUint16) (primitive->calibrationDataLength))); + CsrMemCpyDes(primitive->calibrationData, buffer, &offset, ((u16) (primitive->calibrationDataLength))); } else { @@ -2394,7 +2394,7 @@ CsrSize CsrWifiSmeCcxConfigGetCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* u8 primitive->ccxConfig.keepAliveTimeMs */ bufferSize += 1; /* CsrBool primitive->ccxConfig.apRoamingEnabled */ @@ -2409,8 +2409,8 @@ u8* CsrWifiSmeCcxConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeCcxConfigGetCfm *primitive = (CsrWifiSmeCcxConfigGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.keepAliveTimeMs); CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.apRoamingEnabled); CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.measurementsMask); @@ -2426,8 +2426,8 @@ void* CsrWifiSmeCcxConfigGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); CsrUint8Des((u8 *) &primitive->ccxConfig.keepAliveTimeMs, buffer, &offset); CsrUint8Des((u8 *) &primitive->ccxConfig.apRoamingEnabled, buffer, &offset); CsrUint8Des((u8 *) &primitive->ccxConfig.measurementsMask, buffer, &offset); @@ -2442,7 +2442,7 @@ CsrSize CsrWifiSmeCcxConfigSetCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ return bufferSize; } @@ -2453,8 +2453,8 @@ u8* CsrWifiSmeCcxConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeCcxConfigSetCfm *primitive = (CsrWifiSmeCcxConfigSetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -2466,8 +2466,8 @@ void* CsrWifiSmeCcxConfigSetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -2481,18 +2481,18 @@ CsrSize CsrWifiSmeCoexConfigGetCfmSizeof(void *msg) bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* CsrBool primitive->coexConfig.coexEnableSchemeManagement */ bufferSize += 1; /* CsrBool primitive->coexConfig.coexPeriodicWakeHost */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexTrafficBurstyLatencyMs */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexTrafficContinuousLatencyMs */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexObexBlackoutDurationMs */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexObexBlackoutPeriodMs */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexA2dpBrBlackoutDurationMs */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexA2dpBrBlackoutPeriodMs */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexA2dpEdrBlackoutDurationMs */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexPagingBlackoutDurationMs */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexPagingBlackoutPeriodMs */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexInquiryBlackoutDurationMs */ - bufferSize += 2; /* CsrUint16 primitive->coexConfig.coexInquiryBlackoutPeriodMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexTrafficBurstyLatencyMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexTrafficContinuousLatencyMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexObexBlackoutDurationMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexObexBlackoutPeriodMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpBrBlackoutDurationMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpBrBlackoutPeriodMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpEdrBlackoutDurationMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexPagingBlackoutDurationMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexPagingBlackoutPeriodMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexInquiryBlackoutDurationMs */ + bufferSize += 2; /* u16 primitive->coexConfig.coexInquiryBlackoutPeriodMs */ return bufferSize; } @@ -2502,21 +2502,21 @@ u8* CsrWifiSmeCoexConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeCoexConfigGetCfm *primitive = (CsrWifiSmeCoexConfigGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->status); CsrUint8Ser(ptr, len, (u8) primitive->coexConfig.coexEnableSchemeManagement); CsrUint8Ser(ptr, len, (u8) primitive->coexConfig.coexPeriodicWakeHost); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexTrafficBurstyLatencyMs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexTrafficContinuousLatencyMs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexObexBlackoutDurationMs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexObexBlackoutPeriodMs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexA2dpBrBlackoutDurationMs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexA2dpBrBlackoutPeriodMs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexA2dpEdrBlackoutDurationMs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexPagingBlackoutDurationMs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexPagingBlackoutPeriodMs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexInquiryBlackoutDurationMs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexConfig.coexInquiryBlackoutPeriodMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexTrafficBurstyLatencyMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexTrafficContinuousLatencyMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexObexBlackoutDurationMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexObexBlackoutPeriodMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpBrBlackoutDurationMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpBrBlackoutPeriodMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpEdrBlackoutDurationMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexPagingBlackoutDurationMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexPagingBlackoutPeriodMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexInquiryBlackoutDurationMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexInquiryBlackoutPeriodMs); return(ptr); } @@ -2528,21 +2528,21 @@ void* CsrWifiSmeCoexConfigGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); CsrUint8Des((u8 *) &primitive->coexConfig.coexEnableSchemeManagement, buffer, &offset); CsrUint8Des((u8 *) &primitive->coexConfig.coexPeriodicWakeHost, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexTrafficBurstyLatencyMs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexTrafficContinuousLatencyMs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexObexBlackoutDurationMs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexObexBlackoutPeriodMs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexA2dpBrBlackoutDurationMs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexA2dpBrBlackoutPeriodMs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexA2dpEdrBlackoutDurationMs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexPagingBlackoutDurationMs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexPagingBlackoutPeriodMs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexInquiryBlackoutDurationMs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexConfig.coexInquiryBlackoutPeriodMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexTrafficBurstyLatencyMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexTrafficContinuousLatencyMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexObexBlackoutDurationMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexObexBlackoutPeriodMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpBrBlackoutDurationMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpBrBlackoutPeriodMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpEdrBlackoutDurationMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexPagingBlackoutDurationMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexPagingBlackoutPeriodMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexInquiryBlackoutDurationMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexConfig.coexInquiryBlackoutPeriodMs, buffer, &offset); return primitive; } @@ -2556,10 +2556,10 @@ CsrSize CsrWifiSmeCoexInfoGetCfmSizeof(void *msg) bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* CsrBool primitive->coexInfo.hasTrafficData */ bufferSize += 1; /* CsrWifiSmeTrafficType primitive->coexInfo.currentTrafficType */ - bufferSize += 2; /* CsrUint16 primitive->coexInfo.currentPeriodMs */ + bufferSize += 2; /* u16 primitive->coexInfo.currentPeriodMs */ bufferSize += 1; /* CsrWifiSmePowerSaveLevel primitive->coexInfo.currentPowerSave */ - bufferSize += 2; /* CsrUint16 primitive->coexInfo.currentCoexPeriodMs */ - bufferSize += 2; /* CsrUint16 primitive->coexInfo.currentCoexLatencyMs */ + bufferSize += 2; /* u16 primitive->coexInfo.currentCoexPeriodMs */ + bufferSize += 2; /* u16 primitive->coexInfo.currentCoexLatencyMs */ bufferSize += 1; /* CsrBool primitive->coexInfo.hasBtDevice */ bufferSize += 4; /* CsrUint32 primitive->coexInfo.currentBlackoutDurationUs */ bufferSize += 4; /* CsrUint32 primitive->coexInfo.currentBlackoutPeriodUs */ @@ -2573,13 +2573,13 @@ u8* CsrWifiSmeCoexInfoGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeCoexInfoGetCfm *primitive = (CsrWifiSmeCoexInfoGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->status); CsrUint8Ser(ptr, len, (u8) primitive->coexInfo.hasTrafficData); CsrUint8Ser(ptr, len, (u8) primitive->coexInfo.currentTrafficType); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexInfo.currentPeriodMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexInfo.currentPeriodMs); CsrUint8Ser(ptr, len, (u8) primitive->coexInfo.currentPowerSave); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexInfo.currentCoexPeriodMs); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->coexInfo.currentCoexLatencyMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexInfo.currentCoexPeriodMs); + CsrUint16Ser(ptr, len, (u16) primitive->coexInfo.currentCoexLatencyMs); CsrUint8Ser(ptr, len, (u8) primitive->coexInfo.hasBtDevice); CsrUint32Ser(ptr, len, (CsrUint32) primitive->coexInfo.currentBlackoutDurationUs); CsrUint32Ser(ptr, len, (CsrUint32) primitive->coexInfo.currentBlackoutPeriodUs); @@ -2595,13 +2595,13 @@ void* CsrWifiSmeCoexInfoGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); CsrUint8Des((u8 *) &primitive->coexInfo.hasTrafficData, buffer, &offset); CsrUint8Des((u8 *) &primitive->coexInfo.currentTrafficType, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexInfo.currentPeriodMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexInfo.currentPeriodMs, buffer, &offset); CsrUint8Des((u8 *) &primitive->coexInfo.currentPowerSave, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexInfo.currentCoexPeriodMs, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->coexInfo.currentCoexLatencyMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexInfo.currentCoexPeriodMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->coexInfo.currentCoexLatencyMs, buffer, &offset); CsrUint8Des((u8 *) &primitive->coexInfo.hasBtDevice, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->coexInfo.currentBlackoutDurationUs, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->coexInfo.currentBlackoutPeriodUs, buffer, &offset); @@ -2616,7 +2616,7 @@ CsrSize CsrWifiSmeConnectCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ return bufferSize; } @@ -2627,8 +2627,8 @@ u8* CsrWifiSmeConnectCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeConnectCfm *primitive = (CsrWifiSmeConnectCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -2640,8 +2640,8 @@ void* CsrWifiSmeConnectCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -2653,7 +2653,7 @@ CsrSize CsrWifiSmeConnectionConfigGetCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 59) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 32; /* u8 primitive->connectionConfig.ssid.ssid[32] */ bufferSize += 1; /* u8 primitive->connectionConfig.ssid.length */ @@ -2663,7 +2663,7 @@ CsrSize CsrWifiSmeConnectionConfigGetCfmSizeof(void *msg) bufferSize += 1; /* CsrWifiSme80211PrivacyMode primitive->connectionConfig.privacyMode */ bufferSize += 2; /* CsrWifiSmeAuthModeMask primitive->connectionConfig.authModeMask */ bufferSize += 2; /* CsrWifiSmeEncryptionMask primitive->connectionConfig.encryptionModeMask */ - bufferSize += 2; /* CsrUint16 primitive->connectionConfig.mlmeAssociateReqInformationElementsLength */ + bufferSize += 2; /* u16 primitive->connectionConfig.mlmeAssociateReqInformationElementsLength */ bufferSize += primitive->connectionConfig.mlmeAssociateReqInformationElementsLength; /* u8 primitive->connectionConfig.mlmeAssociateReqInformationElements */ bufferSize += 1; /* CsrWifiSmeWmmQosInfoMask primitive->connectionConfig.wmmQosInfo */ bufferSize += 1; /* CsrBool primitive->connectionConfig.adhocJoinOnly */ @@ -2677,20 +2677,20 @@ u8* CsrWifiSmeConnectionConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeConnectionConfigGetCfm *primitive = (CsrWifiSmeConnectionConfigGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.ssid.ssid, ((CsrUint16) (32))); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.ssid.ssid, ((u16) (32))); CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.ssid.length); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.bssid.a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.bssid.a, ((u16) (6))); CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.bssType); CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.ifIndex); CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.privacyMode); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionConfig.authModeMask); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionConfig.encryptionModeMask); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionConfig.mlmeAssociateReqInformationElementsLength); + CsrUint16Ser(ptr, len, (u16) primitive->connectionConfig.authModeMask); + CsrUint16Ser(ptr, len, (u16) primitive->connectionConfig.encryptionModeMask); + CsrUint16Ser(ptr, len, (u16) primitive->connectionConfig.mlmeAssociateReqInformationElementsLength); if (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.mlmeAssociateReqInformationElements, ((CsrUint16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.mlmeAssociateReqInformationElements, ((u16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength))); } CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.wmmQosInfo); CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.adhocJoinOnly); @@ -2706,21 +2706,21 @@ void* CsrWifiSmeConnectionConfigGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrMemCpyDes(primitive->connectionConfig.ssid.ssid, buffer, &offset, ((CsrUint16) (32))); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); + CsrMemCpyDes(primitive->connectionConfig.ssid.ssid, buffer, &offset, ((u16) (32))); CsrUint8Des((u8 *) &primitive->connectionConfig.ssid.length, buffer, &offset); - CsrMemCpyDes(primitive->connectionConfig.bssid.a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->connectionConfig.bssid.a, buffer, &offset, ((u16) (6))); CsrUint8Des((u8 *) &primitive->connectionConfig.bssType, buffer, &offset); CsrUint8Des((u8 *) &primitive->connectionConfig.ifIndex, buffer, &offset); CsrUint8Des((u8 *) &primitive->connectionConfig.privacyMode, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionConfig.authModeMask, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionConfig.encryptionModeMask, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionConfig.mlmeAssociateReqInformationElementsLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionConfig.authModeMask, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionConfig.encryptionModeMask, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionConfig.mlmeAssociateReqInformationElementsLength, buffer, &offset); if (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength) { primitive->connectionConfig.mlmeAssociateReqInformationElements = (u8 *)CsrPmemAlloc(primitive->connectionConfig.mlmeAssociateReqInformationElementsLength); - CsrMemCpyDes(primitive->connectionConfig.mlmeAssociateReqInformationElements, buffer, &offset, ((CsrUint16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength))); + CsrMemCpyDes(primitive->connectionConfig.mlmeAssociateReqInformationElements, buffer, &offset, ((u16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength))); } else { @@ -2748,38 +2748,38 @@ CsrSize CsrWifiSmeConnectionInfoGetCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 96) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 32; /* u8 primitive->connectionInfo.ssid.ssid[32] */ bufferSize += 1; /* u8 primitive->connectionInfo.ssid.length */ bufferSize += 6; /* u8 primitive->connectionInfo.bssid.a[6] */ bufferSize += 1; /* CsrWifiSme80211NetworkType primitive->connectionInfo.networkType80211 */ bufferSize += 1; /* u8 primitive->connectionInfo.channelNumber */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.channelFrequency */ + bufferSize += 2; /* u16 primitive->connectionInfo.channelFrequency */ bufferSize += 2; /* CsrWifiSmeAuthMode primitive->connectionInfo.authMode */ bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.pairwiseCipher */ bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.groupCipher */ bufferSize += 1; /* CsrWifiSmeRadioIF primitive->connectionInfo.ifIndex */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.atimWindowTu */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.beaconPeriodTu */ + bufferSize += 2; /* u16 primitive->connectionInfo.atimWindowTu */ + bufferSize += 2; /* u16 primitive->connectionInfo.beaconPeriodTu */ bufferSize += 1; /* CsrBool primitive->connectionInfo.reassociation */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.beaconFrameLength */ + bufferSize += 2; /* u16 primitive->connectionInfo.beaconFrameLength */ bufferSize += primitive->connectionInfo.beaconFrameLength; /* u8 primitive->connectionInfo.beaconFrame */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.associationReqFrameLength */ + bufferSize += 2; /* u16 primitive->connectionInfo.associationReqFrameLength */ bufferSize += primitive->connectionInfo.associationReqFrameLength; /* u8 primitive->connectionInfo.associationReqFrame */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.associationRspFrameLength */ + bufferSize += 2; /* u16 primitive->connectionInfo.associationRspFrameLength */ bufferSize += primitive->connectionInfo.associationRspFrameLength; /* u8 primitive->connectionInfo.associationRspFrame */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocScanInfoElementsLength */ + bufferSize += 2; /* u16 primitive->connectionInfo.assocScanInfoElementsLength */ bufferSize += primitive->connectionInfo.assocScanInfoElementsLength; /* u8 primitive->connectionInfo.assocScanInfoElements */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqCapabilities */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqListenIntervalTu */ + bufferSize += 2; /* u16 primitive->connectionInfo.assocReqCapabilities */ + bufferSize += 2; /* u16 primitive->connectionInfo.assocReqListenIntervalTu */ bufferSize += 6; /* u8 primitive->connectionInfo.assocReqApAddress.a[6] */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqInfoElementsLength */ + bufferSize += 2; /* u16 primitive->connectionInfo.assocReqInfoElementsLength */ bufferSize += primitive->connectionInfo.assocReqInfoElementsLength; /* u8 primitive->connectionInfo.assocReqInfoElements */ bufferSize += 2; /* CsrWifiSmeIEEE80211Result primitive->connectionInfo.assocRspResult */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspCapabilityInfo */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspAssociationId */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspInfoElementsLength */ + bufferSize += 2; /* u16 primitive->connectionInfo.assocRspCapabilityInfo */ + bufferSize += 2; /* u16 primitive->connectionInfo.assocRspAssociationId */ + bufferSize += 2; /* u16 primitive->connectionInfo.assocRspInfoElementsLength */ bufferSize += primitive->connectionInfo.assocRspInfoElementsLength; /* u8 primitive->connectionInfo.assocRspInfoElements */ return bufferSize; } @@ -2790,56 +2790,56 @@ u8* CsrWifiSmeConnectionInfoGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeConnectionInfoGetCfm *primitive = (CsrWifiSmeConnectionInfoGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.ssid.ssid, ((CsrUint16) (32))); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.ssid.ssid, ((u16) (32))); CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ssid.length); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.bssid.a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.bssid.a, ((u16) (6))); CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.networkType80211); CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.channelNumber); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.channelFrequency); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.authMode); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.pairwiseCipher); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.groupCipher); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.channelFrequency); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.authMode); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.pairwiseCipher); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.groupCipher); CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ifIndex); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.atimWindowTu); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.beaconPeriodTu); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.atimWindowTu); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.beaconPeriodTu); CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.reassociation); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.beaconFrameLength); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.beaconFrameLength); if (primitive->connectionInfo.beaconFrameLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.beaconFrame, ((CsrUint16) (primitive->connectionInfo.beaconFrameLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.beaconFrame, ((u16) (primitive->connectionInfo.beaconFrameLength))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.associationReqFrameLength); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.associationReqFrameLength); if (primitive->connectionInfo.associationReqFrameLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationReqFrame, ((CsrUint16) (primitive->connectionInfo.associationReqFrameLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationReqFrame, ((u16) (primitive->connectionInfo.associationReqFrameLength))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.associationRspFrameLength); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.associationRspFrameLength); if (primitive->connectionInfo.associationRspFrameLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationRspFrame, ((CsrUint16) (primitive->connectionInfo.associationRspFrameLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationRspFrame, ((u16) (primitive->connectionInfo.associationRspFrameLength))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocScanInfoElementsLength); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocScanInfoElementsLength); if (primitive->connectionInfo.assocScanInfoElementsLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocScanInfoElements, ((CsrUint16) (primitive->connectionInfo.assocScanInfoElementsLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocScanInfoElements, ((u16) (primitive->connectionInfo.assocScanInfoElementsLength))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocReqCapabilities); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocReqListenIntervalTu); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqApAddress.a, ((CsrUint16) (6))); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocReqInfoElementsLength); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqCapabilities); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqListenIntervalTu); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqApAddress.a, ((u16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqInfoElementsLength); if (primitive->connectionInfo.assocReqInfoElementsLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqInfoElements, ((CsrUint16) (primitive->connectionInfo.assocReqInfoElementsLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqInfoElements, ((u16) (primitive->connectionInfo.assocReqInfoElementsLength))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspResult); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspCapabilityInfo); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspAssociationId); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspInfoElementsLength); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspResult); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspCapabilityInfo); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspAssociationId); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspInfoElementsLength); if (primitive->connectionInfo.assocRspInfoElementsLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocRspInfoElements, ((CsrUint16) (primitive->connectionInfo.assocRspInfoElementsLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocRspInfoElements, ((u16) (primitive->connectionInfo.assocRspInfoElementsLength))); } return(ptr); } @@ -2852,82 +2852,82 @@ void* CsrWifiSmeConnectionInfoGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrMemCpyDes(primitive->connectionInfo.ssid.ssid, buffer, &offset, ((CsrUint16) (32))); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); + CsrMemCpyDes(primitive->connectionInfo.ssid.ssid, buffer, &offset, ((u16) (32))); CsrUint8Des((u8 *) &primitive->connectionInfo.ssid.length, buffer, &offset); - CsrMemCpyDes(primitive->connectionInfo.bssid.a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->connectionInfo.bssid.a, buffer, &offset, ((u16) (6))); CsrUint8Des((u8 *) &primitive->connectionInfo.networkType80211, buffer, &offset); CsrUint8Des((u8 *) &primitive->connectionInfo.channelNumber, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.channelFrequency, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.authMode, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.pairwiseCipher, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.groupCipher, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.channelFrequency, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.authMode, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.pairwiseCipher, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.groupCipher, buffer, &offset); CsrUint8Des((u8 *) &primitive->connectionInfo.ifIndex, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.atimWindowTu, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.beaconPeriodTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.atimWindowTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.beaconPeriodTu, buffer, &offset); CsrUint8Des((u8 *) &primitive->connectionInfo.reassociation, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.beaconFrameLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.beaconFrameLength, buffer, &offset); if (primitive->connectionInfo.beaconFrameLength) { primitive->connectionInfo.beaconFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.beaconFrameLength); - CsrMemCpyDes(primitive->connectionInfo.beaconFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.beaconFrameLength))); + CsrMemCpyDes(primitive->connectionInfo.beaconFrame, buffer, &offset, ((u16) (primitive->connectionInfo.beaconFrameLength))); } else { primitive->connectionInfo.beaconFrame = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.associationReqFrameLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.associationReqFrameLength, buffer, &offset); if (primitive->connectionInfo.associationReqFrameLength) { primitive->connectionInfo.associationReqFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.associationReqFrameLength); - CsrMemCpyDes(primitive->connectionInfo.associationReqFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.associationReqFrameLength))); + CsrMemCpyDes(primitive->connectionInfo.associationReqFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationReqFrameLength))); } else { primitive->connectionInfo.associationReqFrame = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.associationRspFrameLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.associationRspFrameLength, buffer, &offset); if (primitive->connectionInfo.associationRspFrameLength) { primitive->connectionInfo.associationRspFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.associationRspFrameLength); - CsrMemCpyDes(primitive->connectionInfo.associationRspFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.associationRspFrameLength))); + CsrMemCpyDes(primitive->connectionInfo.associationRspFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationRspFrameLength))); } else { primitive->connectionInfo.associationRspFrame = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocScanInfoElementsLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocScanInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocScanInfoElementsLength) { primitive->connectionInfo.assocScanInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocScanInfoElementsLength); - CsrMemCpyDes(primitive->connectionInfo.assocScanInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocScanInfoElementsLength))); + CsrMemCpyDes(primitive->connectionInfo.assocScanInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocScanInfoElementsLength))); } else { primitive->connectionInfo.assocScanInfoElements = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocReqCapabilities, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocReqListenIntervalTu, buffer, &offset); - CsrMemCpyDes(primitive->connectionInfo.assocReqApAddress.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocReqInfoElementsLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqCapabilities, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqListenIntervalTu, buffer, &offset); + CsrMemCpyDes(primitive->connectionInfo.assocReqApAddress.a, buffer, &offset, ((u16) (6))); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocReqInfoElementsLength) { primitive->connectionInfo.assocReqInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocReqInfoElementsLength); - CsrMemCpyDes(primitive->connectionInfo.assocReqInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocReqInfoElementsLength))); + CsrMemCpyDes(primitive->connectionInfo.assocReqInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocReqInfoElementsLength))); } else { primitive->connectionInfo.assocReqInfoElements = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspResult, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspCapabilityInfo, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspAssociationId, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspInfoElementsLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspResult, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspCapabilityInfo, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspAssociationId, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocRspInfoElementsLength) { primitive->connectionInfo.assocRspInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocRspInfoElementsLength); - CsrMemCpyDes(primitive->connectionInfo.assocRspInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocRspInfoElementsLength))); + CsrMemCpyDes(primitive->connectionInfo.assocRspInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocRspInfoElementsLength))); } else { @@ -2956,7 +2956,7 @@ CsrSize CsrWifiSmeConnectionQualityIndSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrInt16 primitive->linkQuality.unifiRssi */ bufferSize += 2; /* CsrInt16 primitive->linkQuality.unifiSnr */ return bufferSize; @@ -2968,9 +2968,9 @@ u8* CsrWifiSmeConnectionQualityIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeConnectionQualityInd *primitive = (CsrWifiSmeConnectionQualityInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->linkQuality.unifiRssi); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->linkQuality.unifiSnr); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->linkQuality.unifiRssi); + CsrUint16Ser(ptr, len, (u16) primitive->linkQuality.unifiSnr); return(ptr); } @@ -2982,9 +2982,9 @@ void* CsrWifiSmeConnectionQualityIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->linkQuality.unifiRssi, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->linkQuality.unifiSnr, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->linkQuality.unifiRssi, buffer, &offset); + CsrUint16Des((u16 *) &primitive->linkQuality.unifiSnr, buffer, &offset); return primitive; } @@ -2995,7 +2995,7 @@ CsrSize CsrWifiSmeConnectionStatsGetCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 101) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* u8 primitive->connectionStats.unifiTxDataRate */ bufferSize += 1; /* u8 primitive->connectionStats.unifiRxDataRate */ @@ -3031,8 +3031,8 @@ u8* CsrWifiSmeConnectionStatsGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeConnectionStatsGetCfm *primitive = (CsrWifiSmeConnectionStatsGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); CsrUint8Ser(ptr, len, (u8) primitive->connectionStats.unifiTxDataRate); CsrUint8Ser(ptr, len, (u8) primitive->connectionStats.unifiRxDataRate); CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11RetryCount); @@ -3069,8 +3069,8 @@ void* CsrWifiSmeConnectionStatsGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); CsrUint8Des((u8 *) &primitive->connectionStats.unifiTxDataRate, buffer, &offset); CsrUint8Des((u8 *) &primitive->connectionStats.unifiRxDataRate, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11RetryCount, buffer, &offset); @@ -3106,7 +3106,7 @@ CsrSize CsrWifiSmeDisconnectCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ return bufferSize; } @@ -3117,8 +3117,8 @@ u8* CsrWifiSmeDisconnectCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeDisconnectCfm *primitive = (CsrWifiSmeDisconnectCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -3130,8 +3130,8 @@ void* CsrWifiSmeDisconnectCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -3142,10 +3142,10 @@ CsrSize CsrWifiSmeHostConfigGetCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* CsrWifiSmeHostPowerMode primitive->hostConfig.powerMode */ - bufferSize += 2; /* CsrUint16 primitive->hostConfig.applicationDataPeriodMs */ + bufferSize += 2; /* u16 primitive->hostConfig.applicationDataPeriodMs */ return bufferSize; } @@ -3155,10 +3155,10 @@ u8* CsrWifiSmeHostConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeHostConfigGetCfm *primitive = (CsrWifiSmeHostConfigGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); CsrUint8Ser(ptr, len, (u8) primitive->hostConfig.powerMode); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->hostConfig.applicationDataPeriodMs); + CsrUint16Ser(ptr, len, (u16) primitive->hostConfig.applicationDataPeriodMs); return(ptr); } @@ -3170,10 +3170,10 @@ void* CsrWifiSmeHostConfigGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); CsrUint8Des((u8 *) &primitive->hostConfig.powerMode, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->hostConfig.applicationDataPeriodMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->hostConfig.applicationDataPeriodMs, buffer, &offset); return primitive; } @@ -3184,7 +3184,7 @@ CsrSize CsrWifiSmeHostConfigSetCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ return bufferSize; } @@ -3195,8 +3195,8 @@ u8* CsrWifiSmeHostConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeHostConfigSetCfm *primitive = (CsrWifiSmeHostConfigSetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -3208,8 +3208,8 @@ void* CsrWifiSmeHostConfigSetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -3231,7 +3231,7 @@ u8* CsrWifiSmeIbssStationIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeIbssStationInd *primitive = (CsrWifiSmeIbssStationInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((u16) (6))); CsrUint8Ser(ptr, len, (u8) primitive->isconnected); return(ptr); } @@ -3244,7 +3244,7 @@ void* CsrWifiSmeIbssStationIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrMemCpyDes(primitive->address.a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->address.a, buffer, &offset, ((u16) (6))); CsrUint8Des((u8 *) &primitive->isconnected, buffer, &offset); return primitive; @@ -3256,7 +3256,7 @@ CsrSize CsrWifiSmeKeyCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ bufferSize += 1; /* CsrWifiSmeKeyType primitive->keyType */ @@ -3270,11 +3270,11 @@ u8* CsrWifiSmeKeyCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeKeyCfm *primitive = (CsrWifiSmeKeyCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); CsrUint8Ser(ptr, len, (u8) primitive->action); CsrUint8Ser(ptr, len, (u8) primitive->keyType); - CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); return(ptr); } @@ -3286,11 +3286,11 @@ void* CsrWifiSmeKeyCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); CsrUint8Des((u8 *) &primitive->action, buffer, &offset); CsrUint8Des((u8 *) &primitive->keyType, buffer, &offset); - CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); return primitive; } @@ -3301,7 +3301,7 @@ CsrSize CsrWifiSmeLinkQualityGetCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 2; /* CsrInt16 primitive->linkQuality.unifiRssi */ bufferSize += 2; /* CsrInt16 primitive->linkQuality.unifiSnr */ @@ -3314,10 +3314,10 @@ u8* CsrWifiSmeLinkQualityGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeLinkQualityGetCfm *primitive = (CsrWifiSmeLinkQualityGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->linkQuality.unifiRssi); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->linkQuality.unifiSnr); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->linkQuality.unifiRssi); + CsrUint16Ser(ptr, len, (u16) primitive->linkQuality.unifiSnr); return(ptr); } @@ -3329,10 +3329,10 @@ void* CsrWifiSmeLinkQualityGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->linkQuality.unifiRssi, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->linkQuality.unifiSnr, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->linkQuality.unifiRssi, buffer, &offset); + CsrUint16Des((u16 *) &primitive->linkQuality.unifiSnr, buffer, &offset); return primitive; } @@ -3344,38 +3344,38 @@ CsrSize CsrWifiSmeMediaStatusIndSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 99) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiSmeMediaStatus primitive->mediaStatus */ bufferSize += 32; /* u8 primitive->connectionInfo.ssid.ssid[32] */ bufferSize += 1; /* u8 primitive->connectionInfo.ssid.length */ bufferSize += 6; /* u8 primitive->connectionInfo.bssid.a[6] */ bufferSize += 1; /* CsrWifiSme80211NetworkType primitive->connectionInfo.networkType80211 */ bufferSize += 1; /* u8 primitive->connectionInfo.channelNumber */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.channelFrequency */ + bufferSize += 2; /* u16 primitive->connectionInfo.channelFrequency */ bufferSize += 2; /* CsrWifiSmeAuthMode primitive->connectionInfo.authMode */ bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.pairwiseCipher */ bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.groupCipher */ bufferSize += 1; /* CsrWifiSmeRadioIF primitive->connectionInfo.ifIndex */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.atimWindowTu */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.beaconPeriodTu */ + bufferSize += 2; /* u16 primitive->connectionInfo.atimWindowTu */ + bufferSize += 2; /* u16 primitive->connectionInfo.beaconPeriodTu */ bufferSize += 1; /* CsrBool primitive->connectionInfo.reassociation */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.beaconFrameLength */ + bufferSize += 2; /* u16 primitive->connectionInfo.beaconFrameLength */ bufferSize += primitive->connectionInfo.beaconFrameLength; /* u8 primitive->connectionInfo.beaconFrame */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.associationReqFrameLength */ + bufferSize += 2; /* u16 primitive->connectionInfo.associationReqFrameLength */ bufferSize += primitive->connectionInfo.associationReqFrameLength; /* u8 primitive->connectionInfo.associationReqFrame */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.associationRspFrameLength */ + bufferSize += 2; /* u16 primitive->connectionInfo.associationRspFrameLength */ bufferSize += primitive->connectionInfo.associationRspFrameLength; /* u8 primitive->connectionInfo.associationRspFrame */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocScanInfoElementsLength */ + bufferSize += 2; /* u16 primitive->connectionInfo.assocScanInfoElementsLength */ bufferSize += primitive->connectionInfo.assocScanInfoElementsLength; /* u8 primitive->connectionInfo.assocScanInfoElements */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqCapabilities */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqListenIntervalTu */ + bufferSize += 2; /* u16 primitive->connectionInfo.assocReqCapabilities */ + bufferSize += 2; /* u16 primitive->connectionInfo.assocReqListenIntervalTu */ bufferSize += 6; /* u8 primitive->connectionInfo.assocReqApAddress.a[6] */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocReqInfoElementsLength */ + bufferSize += 2; /* u16 primitive->connectionInfo.assocReqInfoElementsLength */ bufferSize += primitive->connectionInfo.assocReqInfoElementsLength; /* u8 primitive->connectionInfo.assocReqInfoElements */ bufferSize += 2; /* CsrWifiSmeIEEE80211Result primitive->connectionInfo.assocRspResult */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspCapabilityInfo */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspAssociationId */ - bufferSize += 2; /* CsrUint16 primitive->connectionInfo.assocRspInfoElementsLength */ + bufferSize += 2; /* u16 primitive->connectionInfo.assocRspCapabilityInfo */ + bufferSize += 2; /* u16 primitive->connectionInfo.assocRspAssociationId */ + bufferSize += 2; /* u16 primitive->connectionInfo.assocRspInfoElementsLength */ bufferSize += primitive->connectionInfo.assocRspInfoElementsLength; /* u8 primitive->connectionInfo.assocRspInfoElements */ bufferSize += 2; /* CsrWifiSmeIEEE80211Reason primitive->disassocReason */ bufferSize += 2; /* CsrWifiSmeIEEE80211Reason primitive->deauthReason */ @@ -3388,59 +3388,59 @@ u8* CsrWifiSmeMediaStatusIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeMediaStatusInd *primitive = (CsrWifiSmeMediaStatusInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->mediaStatus); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.ssid.ssid, ((CsrUint16) (32))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.ssid.ssid, ((u16) (32))); CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ssid.length); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.bssid.a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.bssid.a, ((u16) (6))); CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.networkType80211); CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.channelNumber); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.channelFrequency); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.authMode); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.pairwiseCipher); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.groupCipher); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.channelFrequency); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.authMode); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.pairwiseCipher); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.groupCipher); CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ifIndex); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.atimWindowTu); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.beaconPeriodTu); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.atimWindowTu); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.beaconPeriodTu); CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.reassociation); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.beaconFrameLength); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.beaconFrameLength); if (primitive->connectionInfo.beaconFrameLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.beaconFrame, ((CsrUint16) (primitive->connectionInfo.beaconFrameLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.beaconFrame, ((u16) (primitive->connectionInfo.beaconFrameLength))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.associationReqFrameLength); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.associationReqFrameLength); if (primitive->connectionInfo.associationReqFrameLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationReqFrame, ((CsrUint16) (primitive->connectionInfo.associationReqFrameLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationReqFrame, ((u16) (primitive->connectionInfo.associationReqFrameLength))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.associationRspFrameLength); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.associationRspFrameLength); if (primitive->connectionInfo.associationRspFrameLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationRspFrame, ((CsrUint16) (primitive->connectionInfo.associationRspFrameLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationRspFrame, ((u16) (primitive->connectionInfo.associationRspFrameLength))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocScanInfoElementsLength); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocScanInfoElementsLength); if (primitive->connectionInfo.assocScanInfoElementsLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocScanInfoElements, ((CsrUint16) (primitive->connectionInfo.assocScanInfoElementsLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocScanInfoElements, ((u16) (primitive->connectionInfo.assocScanInfoElementsLength))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocReqCapabilities); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocReqListenIntervalTu); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqApAddress.a, ((CsrUint16) (6))); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocReqInfoElementsLength); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqCapabilities); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqListenIntervalTu); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqApAddress.a, ((u16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqInfoElementsLength); if (primitive->connectionInfo.assocReqInfoElementsLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqInfoElements, ((CsrUint16) (primitive->connectionInfo.assocReqInfoElementsLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqInfoElements, ((u16) (primitive->connectionInfo.assocReqInfoElementsLength))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspResult); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspCapabilityInfo); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspAssociationId); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->connectionInfo.assocRspInfoElementsLength); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspResult); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspCapabilityInfo); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspAssociationId); + CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspInfoElementsLength); if (primitive->connectionInfo.assocRspInfoElementsLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocRspInfoElements, ((CsrUint16) (primitive->connectionInfo.assocRspInfoElementsLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocRspInfoElements, ((u16) (primitive->connectionInfo.assocRspInfoElementsLength))); } - CsrUint16Ser(ptr, len, (CsrUint16) primitive->disassocReason); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->deauthReason); + CsrUint16Ser(ptr, len, (u16) primitive->disassocReason); + CsrUint16Ser(ptr, len, (u16) primitive->deauthReason); return(ptr); } @@ -3452,89 +3452,89 @@ void* CsrWifiSmeMediaStatusIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->mediaStatus, buffer, &offset); - CsrMemCpyDes(primitive->connectionInfo.ssid.ssid, buffer, &offset, ((CsrUint16) (32))); + CsrMemCpyDes(primitive->connectionInfo.ssid.ssid, buffer, &offset, ((u16) (32))); CsrUint8Des((u8 *) &primitive->connectionInfo.ssid.length, buffer, &offset); - CsrMemCpyDes(primitive->connectionInfo.bssid.a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->connectionInfo.bssid.a, buffer, &offset, ((u16) (6))); CsrUint8Des((u8 *) &primitive->connectionInfo.networkType80211, buffer, &offset); CsrUint8Des((u8 *) &primitive->connectionInfo.channelNumber, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.channelFrequency, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.authMode, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.pairwiseCipher, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.groupCipher, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.channelFrequency, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.authMode, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.pairwiseCipher, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.groupCipher, buffer, &offset); CsrUint8Des((u8 *) &primitive->connectionInfo.ifIndex, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.atimWindowTu, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.beaconPeriodTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.atimWindowTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.beaconPeriodTu, buffer, &offset); CsrUint8Des((u8 *) &primitive->connectionInfo.reassociation, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.beaconFrameLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.beaconFrameLength, buffer, &offset); if (primitive->connectionInfo.beaconFrameLength) { primitive->connectionInfo.beaconFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.beaconFrameLength); - CsrMemCpyDes(primitive->connectionInfo.beaconFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.beaconFrameLength))); + CsrMemCpyDes(primitive->connectionInfo.beaconFrame, buffer, &offset, ((u16) (primitive->connectionInfo.beaconFrameLength))); } else { primitive->connectionInfo.beaconFrame = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.associationReqFrameLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.associationReqFrameLength, buffer, &offset); if (primitive->connectionInfo.associationReqFrameLength) { primitive->connectionInfo.associationReqFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.associationReqFrameLength); - CsrMemCpyDes(primitive->connectionInfo.associationReqFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.associationReqFrameLength))); + CsrMemCpyDes(primitive->connectionInfo.associationReqFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationReqFrameLength))); } else { primitive->connectionInfo.associationReqFrame = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.associationRspFrameLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.associationRspFrameLength, buffer, &offset); if (primitive->connectionInfo.associationRspFrameLength) { primitive->connectionInfo.associationRspFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.associationRspFrameLength); - CsrMemCpyDes(primitive->connectionInfo.associationRspFrame, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.associationRspFrameLength))); + CsrMemCpyDes(primitive->connectionInfo.associationRspFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationRspFrameLength))); } else { primitive->connectionInfo.associationRspFrame = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocScanInfoElementsLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocScanInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocScanInfoElementsLength) { primitive->connectionInfo.assocScanInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocScanInfoElementsLength); - CsrMemCpyDes(primitive->connectionInfo.assocScanInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocScanInfoElementsLength))); + CsrMemCpyDes(primitive->connectionInfo.assocScanInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocScanInfoElementsLength))); } else { primitive->connectionInfo.assocScanInfoElements = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocReqCapabilities, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocReqListenIntervalTu, buffer, &offset); - CsrMemCpyDes(primitive->connectionInfo.assocReqApAddress.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocReqInfoElementsLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqCapabilities, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqListenIntervalTu, buffer, &offset); + CsrMemCpyDes(primitive->connectionInfo.assocReqApAddress.a, buffer, &offset, ((u16) (6))); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocReqInfoElementsLength) { primitive->connectionInfo.assocReqInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocReqInfoElementsLength); - CsrMemCpyDes(primitive->connectionInfo.assocReqInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocReqInfoElementsLength))); + CsrMemCpyDes(primitive->connectionInfo.assocReqInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocReqInfoElementsLength))); } else { primitive->connectionInfo.assocReqInfoElements = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspResult, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspCapabilityInfo, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspAssociationId, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->connectionInfo.assocRspInfoElementsLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspResult, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspCapabilityInfo, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspAssociationId, buffer, &offset); + CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocRspInfoElementsLength) { primitive->connectionInfo.assocRspInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocRspInfoElementsLength); - CsrMemCpyDes(primitive->connectionInfo.assocRspInfoElements, buffer, &offset, ((CsrUint16) (primitive->connectionInfo.assocRspInfoElementsLength))); + CsrMemCpyDes(primitive->connectionInfo.assocRspInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocRspInfoElementsLength))); } else { primitive->connectionInfo.assocRspInfoElements = NULL; } - CsrUint16Des((CsrUint16 *) &primitive->disassocReason, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->deauthReason, buffer, &offset); + CsrUint16Des((u16 *) &primitive->disassocReason, buffer, &offset); + CsrUint16Des((u16 *) &primitive->deauthReason, buffer, &offset); return primitive; } @@ -3561,9 +3561,9 @@ CsrSize CsrWifiSmeMibConfigGetCfmSizeof(void *msg) bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* CsrBool primitive->mibConfig.unifiFixMaxTxDataRate */ bufferSize += 1; /* u8 primitive->mibConfig.unifiFixTxDataRate */ - bufferSize += 2; /* CsrUint16 primitive->mibConfig.dot11RtsThreshold */ - bufferSize += 2; /* CsrUint16 primitive->mibConfig.dot11FragmentationThreshold */ - bufferSize += 2; /* CsrUint16 primitive->mibConfig.dot11CurrentTxPowerLevel */ + bufferSize += 2; /* u16 primitive->mibConfig.dot11RtsThreshold */ + bufferSize += 2; /* u16 primitive->mibConfig.dot11FragmentationThreshold */ + bufferSize += 2; /* u16 primitive->mibConfig.dot11CurrentTxPowerLevel */ return bufferSize; } @@ -3573,12 +3573,12 @@ u8* CsrWifiSmeMibConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeMibConfigGetCfm *primitive = (CsrWifiSmeMibConfigGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->status); CsrUint8Ser(ptr, len, (u8) primitive->mibConfig.unifiFixMaxTxDataRate); CsrUint8Ser(ptr, len, (u8) primitive->mibConfig.unifiFixTxDataRate); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibConfig.dot11RtsThreshold); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibConfig.dot11FragmentationThreshold); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibConfig.dot11CurrentTxPowerLevel); + CsrUint16Ser(ptr, len, (u16) primitive->mibConfig.dot11RtsThreshold); + CsrUint16Ser(ptr, len, (u16) primitive->mibConfig.dot11FragmentationThreshold); + CsrUint16Ser(ptr, len, (u16) primitive->mibConfig.dot11CurrentTxPowerLevel); return(ptr); } @@ -3590,12 +3590,12 @@ void* CsrWifiSmeMibConfigGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); CsrUint8Des((u8 *) &primitive->mibConfig.unifiFixMaxTxDataRate, buffer, &offset); CsrUint8Des((u8 *) &primitive->mibConfig.unifiFixTxDataRate, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->mibConfig.dot11RtsThreshold, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->mibConfig.dot11FragmentationThreshold, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->mibConfig.dot11CurrentTxPowerLevel, buffer, &offset); + CsrUint16Des((u16 *) &primitive->mibConfig.dot11RtsThreshold, buffer, &offset); + CsrUint16Des((u16 *) &primitive->mibConfig.dot11FragmentationThreshold, buffer, &offset); + CsrUint16Des((u16 *) &primitive->mibConfig.dot11CurrentTxPowerLevel, buffer, &offset); return primitive; } @@ -3608,7 +3608,7 @@ CsrSize CsrWifiSmeMibGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 2; /* CsrUint16 primitive->mibAttributeLength */ + bufferSize += 2; /* u16 primitive->mibAttributeLength */ bufferSize += primitive->mibAttributeLength; /* u8 primitive->mibAttribute */ return bufferSize; } @@ -3619,11 +3619,11 @@ u8* CsrWifiSmeMibGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeMibGetCfm *primitive = (CsrWifiSmeMibGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibAttributeLength); + CsrUint16Ser(ptr, len, (u16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->mibAttributeLength); if (primitive->mibAttributeLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((CsrUint16) (primitive->mibAttributeLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((u16) (primitive->mibAttributeLength))); } return(ptr); } @@ -3636,12 +3636,12 @@ void* CsrWifiSmeMibGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->mibAttributeLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->mibAttributeLength, buffer, &offset); if (primitive->mibAttributeLength) { primitive->mibAttribute = (u8 *)CsrPmemAlloc(primitive->mibAttributeLength); - CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((CsrUint16) (primitive->mibAttributeLength))); + CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((u16) (primitive->mibAttributeLength))); } else { @@ -3667,7 +3667,7 @@ CsrSize CsrWifiSmeMibGetNextCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 2; /* CsrUint16 primitive->mibAttributeLength */ + bufferSize += 2; /* u16 primitive->mibAttributeLength */ bufferSize += primitive->mibAttributeLength; /* u8 primitive->mibAttribute */ return bufferSize; } @@ -3678,11 +3678,11 @@ u8* CsrWifiSmeMibGetNextCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeMibGetNextCfm *primitive = (CsrWifiSmeMibGetNextCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->mibAttributeLength); + CsrUint16Ser(ptr, len, (u16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->mibAttributeLength); if (primitive->mibAttributeLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((CsrUint16) (primitive->mibAttributeLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((u16) (primitive->mibAttributeLength))); } return(ptr); } @@ -3695,12 +3695,12 @@ void* CsrWifiSmeMibGetNextCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->mibAttributeLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->mibAttributeLength, buffer, &offset); if (primitive->mibAttributeLength) { primitive->mibAttribute = (u8 *)CsrPmemAlloc(primitive->mibAttributeLength); - CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((CsrUint16) (primitive->mibAttributeLength))); + CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((u16) (primitive->mibAttributeLength))); } else { @@ -3724,9 +3724,9 @@ CsrSize CsrWifiSmeMicFailureIndSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* CsrBool primitive->secondFailure */ - bufferSize += 2; /* CsrUint16 primitive->count */ + bufferSize += 2; /* u16 primitive->count */ bufferSize += 6; /* u8 primitive->address.a[6] */ bufferSize += 1; /* CsrWifiSmeKeyType primitive->keyType */ return bufferSize; @@ -3738,10 +3738,10 @@ u8* CsrWifiSmeMicFailureIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeMicFailureInd *primitive = (CsrWifiSmeMicFailureInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->secondFailure); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->count); - CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->count); + CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((u16) (6))); CsrUint8Ser(ptr, len, (u8) primitive->keyType); return(ptr); } @@ -3754,10 +3754,10 @@ void* CsrWifiSmeMicFailureIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->secondFailure, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->count, buffer, &offset); - CsrMemCpyDes(primitive->address.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((u16 *) &primitive->count, buffer, &offset); + CsrMemCpyDes(primitive->address.a, buffer, &offset, ((u16) (6))); CsrUint8Des((u8 *) &primitive->keyType, buffer, &offset); return primitive; @@ -3770,12 +3770,12 @@ CsrSize CsrWifiSmeMulticastAddressCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ bufferSize += 1; /* u8 primitive->getAddressesCount */ { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->getAddressesCount; i1++) { bufferSize += 6; /* u8 primitive->getAddresses[i1].a[6] */ @@ -3790,15 +3790,15 @@ u8* CsrWifiSmeMulticastAddressCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeMulticastAddressCfm *primitive = (CsrWifiSmeMulticastAddressCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); CsrUint8Ser(ptr, len, (u8) primitive->action); CsrUint8Ser(ptr, len, (u8) primitive->getAddressesCount); { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->getAddressesCount; i1++) { - CsrMemCpySer(ptr, len, (const void *) primitive->getAddresses[i1].a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->getAddresses[i1].a, ((u16) (6))); } } return(ptr); @@ -3812,8 +3812,8 @@ void* CsrWifiSmeMulticastAddressCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); CsrUint8Des((u8 *) &primitive->action, buffer, &offset); CsrUint8Des((u8 *) &primitive->getAddressesCount, buffer, &offset); primitive->getAddresses = NULL; @@ -3822,10 +3822,10 @@ void* CsrWifiSmeMulticastAddressCfmDes(u8 *buffer, CsrSize length) primitive->getAddresses = (CsrWifiMacAddress *)CsrPmemAlloc(sizeof(CsrWifiMacAddress) * primitive->getAddressesCount); } { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->getAddressesCount; i1++) { - CsrMemCpyDes(primitive->getAddresses[i1].a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->getAddresses[i1].a, buffer, &offset, ((u16) (6))); } } @@ -3846,7 +3846,7 @@ CsrSize CsrWifiSmePacketFilterSetCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ return bufferSize; } @@ -3857,8 +3857,8 @@ u8* CsrWifiSmePacketFilterSetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmePacketFilterSetCfm *primitive = (CsrWifiSmePacketFilterSetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -3870,8 +3870,8 @@ void* CsrWifiSmePacketFilterSetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -3893,8 +3893,8 @@ u8* CsrWifiSmePermanentMacAddressGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmePermanentMacAddressGetCfm *primitive = (CsrWifiSmePermanentMacAddressGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrMemCpySer(ptr, len, (const void *) primitive->permanentMacAddress.a, ((CsrUint16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->status); + CsrMemCpySer(ptr, len, (const void *) primitive->permanentMacAddress.a, ((u16) (6))); return(ptr); } @@ -3906,8 +3906,8 @@ void* CsrWifiSmePermanentMacAddressGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrMemCpyDes(primitive->permanentMacAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); + CsrMemCpyDes(primitive->permanentMacAddress.a, buffer, &offset, ((u16) (6))); return primitive; } @@ -3919,10 +3919,10 @@ CsrSize CsrWifiSmePmkidCandidateListIndSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* u8 primitive->pmkidCandidatesCount */ { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->pmkidCandidatesCount; i1++) { bufferSize += 6; /* u8 primitive->pmkidCandidates[i1].bssid.a[6] */ @@ -3938,13 +3938,13 @@ u8* CsrWifiSmePmkidCandidateListIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmePmkidCandidateListInd *primitive = (CsrWifiSmePmkidCandidateListInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->pmkidCandidatesCount); { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->pmkidCandidatesCount; i1++) { - CsrMemCpySer(ptr, len, (const void *) primitive->pmkidCandidates[i1].bssid.a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->pmkidCandidates[i1].bssid.a, ((u16) (6))); CsrUint8Ser(ptr, len, (u8) primitive->pmkidCandidates[i1].preAuthAllowed); } } @@ -3959,7 +3959,7 @@ void* CsrWifiSmePmkidCandidateListIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->pmkidCandidatesCount, buffer, &offset); primitive->pmkidCandidates = NULL; if (primitive->pmkidCandidatesCount) @@ -3967,10 +3967,10 @@ void* CsrWifiSmePmkidCandidateListIndDes(u8 *buffer, CsrSize length) primitive->pmkidCandidates = (CsrWifiSmePmkidCandidate *)CsrPmemAlloc(sizeof(CsrWifiSmePmkidCandidate) * primitive->pmkidCandidatesCount); } { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->pmkidCandidatesCount; i1++) { - CsrMemCpyDes(primitive->pmkidCandidates[i1].bssid.a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->pmkidCandidates[i1].bssid.a, buffer, &offset, ((u16) (6))); CsrUint8Des((u8 *) &primitive->pmkidCandidates[i1].preAuthAllowed, buffer, &offset); } } @@ -3993,12 +3993,12 @@ CsrSize CsrWifiSmePmkidCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 31) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ bufferSize += 1; /* u8 primitive->getPmkidsCount */ { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->getPmkidsCount; i1++) { bufferSize += 6; /* u8 primitive->getPmkids[i1].bssid.a[6] */ @@ -4014,16 +4014,16 @@ u8* CsrWifiSmePmkidCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmePmkidCfm *primitive = (CsrWifiSmePmkidCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); CsrUint8Ser(ptr, len, (u8) primitive->action); CsrUint8Ser(ptr, len, (u8) primitive->getPmkidsCount); { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->getPmkidsCount; i1++) { - CsrMemCpySer(ptr, len, (const void *) primitive->getPmkids[i1].bssid.a, ((CsrUint16) (6))); - CsrMemCpySer(ptr, len, (const void *) primitive->getPmkids[i1].pmkid, ((CsrUint16) (16))); + CsrMemCpySer(ptr, len, (const void *) primitive->getPmkids[i1].bssid.a, ((u16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->getPmkids[i1].pmkid, ((u16) (16))); } } return(ptr); @@ -4037,8 +4037,8 @@ void* CsrWifiSmePmkidCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); CsrUint8Des((u8 *) &primitive->action, buffer, &offset); CsrUint8Des((u8 *) &primitive->getPmkidsCount, buffer, &offset); primitive->getPmkids = NULL; @@ -4047,11 +4047,11 @@ void* CsrWifiSmePmkidCfmDes(u8 *buffer, CsrSize length) primitive->getPmkids = (CsrWifiSmePmkid *)CsrPmemAlloc(sizeof(CsrWifiSmePmkid) * primitive->getPmkidsCount); } { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->getPmkidsCount; i1++) { - CsrMemCpyDes(primitive->getPmkids[i1].bssid.a, buffer, &offset, ((CsrUint16) (6))); - CsrMemCpyDes(primitive->getPmkids[i1].pmkid, buffer, &offset, ((CsrUint16) (16))); + CsrMemCpyDes(primitive->getPmkids[i1].bssid.a, buffer, &offset, ((u16) (6))); + CsrMemCpyDes(primitive->getPmkids[i1].pmkid, buffer, &offset, ((u16) (16))); } } @@ -4074,7 +4074,7 @@ CsrSize CsrWifiSmePowerConfigGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* CsrWifiSmePowerSaveLevel primitive->powerConfig.powerSaveLevel */ - bufferSize += 2; /* CsrUint16 primitive->powerConfig.listenIntervalTu */ + bufferSize += 2; /* u16 primitive->powerConfig.listenIntervalTu */ bufferSize += 1; /* CsrBool primitive->powerConfig.rxDtims */ bufferSize += 1; /* CsrWifiSmeD3AutoScanMode primitive->powerConfig.d3AutoScanMode */ bufferSize += 1; /* u8 primitive->powerConfig.clientTrafficWindow */ @@ -4089,9 +4089,9 @@ u8* CsrWifiSmePowerConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmePowerConfigGetCfm *primitive = (CsrWifiSmePowerConfigGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->status); CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.powerSaveLevel); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->powerConfig.listenIntervalTu); + CsrUint16Ser(ptr, len, (u16) primitive->powerConfig.listenIntervalTu); CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.rxDtims); CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.d3AutoScanMode); CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.clientTrafficWindow); @@ -4108,9 +4108,9 @@ void* CsrWifiSmePowerConfigGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); CsrUint8Des((u8 *) &primitive->powerConfig.powerSaveLevel, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->powerConfig.listenIntervalTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->powerConfig.listenIntervalTu, buffer, &offset); CsrUint8Des((u8 *) &primitive->powerConfig.rxDtims, buffer, &offset); CsrUint8Des((u8 *) &primitive->powerConfig.d3AutoScanMode, buffer, &offset); CsrUint8Des((u8 *) &primitive->powerConfig.clientTrafficWindow, buffer, &offset); @@ -4140,11 +4140,11 @@ u8* CsrWifiSmeRegulatoryDomainInfoGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeRegulatoryDomainInfoGetCfm *primitive = (CsrWifiSmeRegulatoryDomainInfoGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->status); CsrUint8Ser(ptr, len, (u8) primitive->regDomInfo.dot11MultiDomainCapabilityImplemented); CsrUint8Ser(ptr, len, (u8) primitive->regDomInfo.dot11MultiDomainCapabilityEnabled); CsrUint8Ser(ptr, len, (u8) primitive->regDomInfo.currentRegulatoryDomain); - CsrMemCpySer(ptr, len, (const void *) primitive->regDomInfo.currentCountryCode, ((CsrUint16) (2))); + CsrMemCpySer(ptr, len, (const void *) primitive->regDomInfo.currentCountryCode, ((u16) (2))); return(ptr); } @@ -4156,11 +4156,11 @@ void* CsrWifiSmeRegulatoryDomainInfoGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); CsrUint8Des((u8 *) &primitive->regDomInfo.dot11MultiDomainCapabilityImplemented, buffer, &offset); CsrUint8Des((u8 *) &primitive->regDomInfo.dot11MultiDomainCapabilityEnabled, buffer, &offset); CsrUint8Des((u8 *) &primitive->regDomInfo.currentRegulatoryDomain, buffer, &offset); - CsrMemCpyDes(primitive->regDomInfo.currentCountryCode, buffer, &offset, ((CsrUint16) (2))); + CsrMemCpyDes(primitive->regDomInfo.currentCountryCode, buffer, &offset, ((u16) (2))); return primitive; } @@ -4171,7 +4171,7 @@ CsrSize CsrWifiSmeRoamCompleteIndSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ return bufferSize; } @@ -4182,8 +4182,8 @@ u8* CsrWifiSmeRoamCompleteIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeRoamCompleteInd *primitive = (CsrWifiSmeRoamCompleteInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -4195,8 +4195,8 @@ void* CsrWifiSmeRoamCompleteIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -4207,7 +4207,7 @@ CsrSize CsrWifiSmeRoamStartIndSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiSmeRoamReason primitive->roamReason */ bufferSize += 2; /* CsrWifiSmeIEEE80211Reason primitive->reason80211 */ return bufferSize; @@ -4219,9 +4219,9 @@ u8* CsrWifiSmeRoamStartIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeRoamStartInd *primitive = (CsrWifiSmeRoamStartInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->roamReason); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->reason80211); + CsrUint16Ser(ptr, len, (u16) primitive->reason80211); return(ptr); } @@ -4233,9 +4233,9 @@ void* CsrWifiSmeRoamStartIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->roamReason, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->reason80211, buffer, &offset); + CsrUint16Des((u16 *) &primitive->reason80211, buffer, &offset); return primitive; } @@ -4246,10 +4246,10 @@ CsrSize CsrWifiSmeRoamingConfigGetCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 72) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 3; i2++) { bufferSize += 2; /* CsrInt16 primitive->roamingConfig.roamingBands[i2].rssiHighThreshold */ @@ -4261,17 +4261,17 @@ CsrSize CsrWifiSmeRoamingConfigGetCfmSizeof(void *msg) bufferSize += 1; /* CsrBool primitive->roamingConfig.disableSmoothRoaming */ bufferSize += 1; /* CsrBool primitive->roamingConfig.disableRoamScans */ bufferSize += 1; /* u8 primitive->roamingConfig.reconnectLimit */ - bufferSize += 2; /* CsrUint16 primitive->roamingConfig.reconnectLimitIntervalMs */ + bufferSize += 2; /* u16 primitive->roamingConfig.reconnectLimitIntervalMs */ { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 3; i2++) { - bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].intervalSeconds */ - bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].validitySeconds */ - bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu */ - bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu */ - bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu */ - bufferSize += 2; /* CsrUint16 primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu */ + bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].intervalSeconds */ + bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].validitySeconds */ + bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu */ + bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu */ + bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu */ + bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu */ } } return bufferSize; @@ -4283,32 +4283,32 @@ u8* CsrWifiSmeRoamingConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeRoamingConfigGetCfm *primitive = (CsrWifiSmeRoamingConfigGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 3; i2++) { - CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamingBands[i2].rssiHighThreshold); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamingBands[i2].rssiLowThreshold); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamingBands[i2].snrHighThreshold); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamingBands[i2].snrLowThreshold); + CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].rssiHighThreshold); + CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].rssiLowThreshold); + CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].snrHighThreshold); + CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].snrLowThreshold); } } CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.disableSmoothRoaming); CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.disableRoamScans); CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.reconnectLimit); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.reconnectLimitIntervalMs); + CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.reconnectLimitIntervalMs); { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 3; i2++) { - CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].intervalSeconds); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].validitySeconds); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu); + CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].intervalSeconds); + CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].validitySeconds); + CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu); + CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu); + CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu); + CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu); } } return(ptr); @@ -4322,32 +4322,32 @@ void* CsrWifiSmeRoamingConfigGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 3; i2++) { - CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamingBands[i2].rssiHighThreshold, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamingBands[i2].rssiLowThreshold, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamingBands[i2].snrHighThreshold, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamingBands[i2].snrLowThreshold, buffer, &offset); + CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].rssiHighThreshold, buffer, &offset); + CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].rssiLowThreshold, buffer, &offset); + CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].snrHighThreshold, buffer, &offset); + CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].snrLowThreshold, buffer, &offset); } } CsrUint8Des((u8 *) &primitive->roamingConfig.disableSmoothRoaming, buffer, &offset); CsrUint8Des((u8 *) &primitive->roamingConfig.disableRoamScans, buffer, &offset); CsrUint8Des((u8 *) &primitive->roamingConfig.reconnectLimit, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.reconnectLimitIntervalMs, buffer, &offset); + CsrUint16Des((u16 *) &primitive->roamingConfig.reconnectLimitIntervalMs, buffer, &offset); { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 3; i2++) { - CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].intervalSeconds, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].validitySeconds, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].intervalSeconds, buffer, &offset); + CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].validitySeconds, buffer, &offset); + CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu, buffer, &offset); } } @@ -4360,7 +4360,7 @@ CsrSize CsrWifiSmeRoamingConfigSetCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ return bufferSize; } @@ -4371,8 +4371,8 @@ u8* CsrWifiSmeRoamingConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeRoamingConfigSetCfm *primitive = (CsrWifiSmeRoamingConfigSetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -4384,8 +4384,8 @@ void* CsrWifiSmeRoamingConfigSetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -4399,26 +4399,26 @@ CsrSize CsrWifiSmeScanConfigGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 65) */ bufferSize += 2; /* CsrResult primitive->status */ { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 4; i2++) { - bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].intervalSeconds */ - bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].validitySeconds */ - bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu */ - bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu */ - bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu */ - bufferSize += 2; /* CsrUint16 primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu */ + bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].intervalSeconds */ + bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].validitySeconds */ + bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu */ + bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu */ + bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu */ + bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu */ } } bufferSize += 1; /* CsrBool primitive->scanConfig.disableAutonomousScans */ - bufferSize += 2; /* CsrUint16 primitive->scanConfig.maxResults */ + bufferSize += 2; /* u16 primitive->scanConfig.maxResults */ bufferSize += 1; /* s8 primitive->scanConfig.highRssiThreshold */ bufferSize += 1; /* s8 primitive->scanConfig.lowRssiThreshold */ bufferSize += 1; /* s8 primitive->scanConfig.deltaRssiThreshold */ bufferSize += 1; /* s8 primitive->scanConfig.highSnrThreshold */ bufferSize += 1; /* s8 primitive->scanConfig.lowSnrThreshold */ bufferSize += 1; /* s8 primitive->scanConfig.deltaSnrThreshold */ - bufferSize += 2; /* CsrUint16 primitive->scanConfig.passiveChannelListCount */ + bufferSize += 2; /* u16 primitive->scanConfig.passiveChannelListCount */ bufferSize += primitive->scanConfig.passiveChannelListCount; /* u8 primitive->scanConfig.passiveChannelList */ return bufferSize; } @@ -4429,31 +4429,31 @@ u8* CsrWifiSmeScanConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeScanConfigGetCfm *primitive = (CsrWifiSmeScanConfigGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->status); { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 4; i2++) { - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].intervalSeconds); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].validitySeconds); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu); + CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].intervalSeconds); + CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].validitySeconds); + CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu); + CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu); + CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu); + CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu); } } CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.disableAutonomousScans); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.maxResults); + CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.maxResults); CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.highRssiThreshold); CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.lowRssiThreshold); CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.deltaRssiThreshold); CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.highSnrThreshold); CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.lowSnrThreshold); CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.deltaSnrThreshold); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanConfig.passiveChannelListCount); + CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.passiveChannelListCount); if (primitive->scanConfig.passiveChannelListCount) { - CsrMemCpySer(ptr, len, (const void *) primitive->scanConfig.passiveChannelList, ((CsrUint16) (primitive->scanConfig.passiveChannelListCount))); + CsrMemCpySer(ptr, len, (const void *) primitive->scanConfig.passiveChannelList, ((u16) (primitive->scanConfig.passiveChannelListCount))); } return(ptr); } @@ -4466,32 +4466,32 @@ void* CsrWifiSmeScanConfigGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < 4; i2++) { - CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].intervalSeconds, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].validitySeconds, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].intervalSeconds, buffer, &offset); + CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].validitySeconds, buffer, &offset); + CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu, buffer, &offset); + CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu, buffer, &offset); } } CsrUint8Des((u8 *) &primitive->scanConfig.disableAutonomousScans, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->scanConfig.maxResults, buffer, &offset); + CsrUint16Des((u16 *) &primitive->scanConfig.maxResults, buffer, &offset); CsrUint8Des((u8 *) &primitive->scanConfig.highRssiThreshold, buffer, &offset); CsrUint8Des((u8 *) &primitive->scanConfig.lowRssiThreshold, buffer, &offset); CsrUint8Des((u8 *) &primitive->scanConfig.deltaRssiThreshold, buffer, &offset); CsrUint8Des((u8 *) &primitive->scanConfig.highSnrThreshold, buffer, &offset); CsrUint8Des((u8 *) &primitive->scanConfig.lowSnrThreshold, buffer, &offset); CsrUint8Des((u8 *) &primitive->scanConfig.deltaSnrThreshold, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->scanConfig.passiveChannelListCount, buffer, &offset); + CsrUint16Des((u16 *) &primitive->scanConfig.passiveChannelListCount, buffer, &offset); if (primitive->scanConfig.passiveChannelListCount) { primitive->scanConfig.passiveChannelList = (u8 *)CsrPmemAlloc(primitive->scanConfig.passiveChannelListCount); - CsrMemCpyDes(primitive->scanConfig.passiveChannelList, buffer, &offset, ((CsrUint16) (primitive->scanConfig.passiveChannelListCount))); + CsrMemCpyDes(primitive->scanConfig.passiveChannelList, buffer, &offset, ((u16) (primitive->scanConfig.passiveChannelListCount))); } else { @@ -4522,15 +4522,15 @@ CsrSize CsrWifiSmeScanResultIndSizeof(void *msg) bufferSize += 2; /* CsrInt16 primitive->result.rssi */ bufferSize += 2; /* CsrInt16 primitive->result.snr */ bufferSize += 1; /* CsrWifiSmeRadioIF primitive->result.ifIndex */ - bufferSize += 2; /* CsrUint16 primitive->result.beaconPeriodTu */ + bufferSize += 2; /* u16 primitive->result.beaconPeriodTu */ bufferSize += 8; /* u8 primitive->result.timeStamp.data[8] */ bufferSize += 8; /* u8 primitive->result.localTime.data[8] */ - bufferSize += 2; /* CsrUint16 primitive->result.channelFrequency */ - bufferSize += 2; /* CsrUint16 primitive->result.capabilityInformation */ + bufferSize += 2; /* u16 primitive->result.channelFrequency */ + bufferSize += 2; /* u16 primitive->result.capabilityInformation */ bufferSize += 1; /* u8 primitive->result.channelNumber */ bufferSize += 1; /* CsrWifiSmeBasicUsability primitive->result.usability */ bufferSize += 1; /* CsrWifiSmeBssType primitive->result.bssType */ - bufferSize += 2; /* CsrUint16 primitive->result.informationElementsLength */ + bufferSize += 2; /* u16 primitive->result.informationElementsLength */ bufferSize += primitive->result.informationElementsLength; /* u8 primitive->result.informationElements */ bufferSize += 1; /* CsrWifiSmeP2pRole primitive->result.p2pDeviceRole */ switch (primitive->result.p2pDeviceRole) @@ -4543,7 +4543,7 @@ CsrSize CsrWifiSmeScanResultIndSizeof(void *msg) bufferSize += 6; /* u8 primitive->result.deviceInfo.groupInfo.p2pDeviceAddress.a[6] */ bufferSize += 1; /* u8 primitive->result.deviceInfo.groupInfo.p2pClientInfoCount */ { - CsrUint16 i4; + u16 i4; for (i4 = 0; i4 < primitive->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++) { bufferSize += 6; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a[6] */ @@ -4553,7 +4553,7 @@ CsrSize CsrWifiSmeScanResultIndSizeof(void *msg) bufferSize += 8; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails[8] */ bufferSize += 1; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount */ { - CsrUint16 i6; + u16 i6; for (i6 = 0; i6 < primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++) { bufferSize += 8; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails[8] */ @@ -4574,7 +4574,7 @@ CsrSize CsrWifiSmeScanResultIndSizeof(void *msg) bufferSize += 8; /* u8 primitive->result.deviceInfo.standalonedevInfo.primDeviceType.deviceDetails[8] */ bufferSize += 1; /* u8 primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount */ { - CsrUint16 i4; + u16 i4; for (i4 = 0; i4 < primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++) { bufferSize += 8; /* u8 primitive->result.deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails[8] */ @@ -4595,24 +4595,24 @@ u8* CsrWifiSmeScanResultIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeScanResultInd *primitive = (CsrWifiSmeScanResultInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrMemCpySer(ptr, len, (const void *) primitive->result.ssid.ssid, ((CsrUint16) (32))); + CsrMemCpySer(ptr, len, (const void *) primitive->result.ssid.ssid, ((u16) (32))); CsrUint8Ser(ptr, len, (u8) primitive->result.ssid.length); - CsrMemCpySer(ptr, len, (const void *) primitive->result.bssid.a, ((CsrUint16) (6))); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.rssi); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.snr); + CsrMemCpySer(ptr, len, (const void *) primitive->result.bssid.a, ((u16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->result.rssi); + CsrUint16Ser(ptr, len, (u16) primitive->result.snr); CsrUint8Ser(ptr, len, (u8) primitive->result.ifIndex); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.beaconPeriodTu); - CsrMemCpySer(ptr, len, (const void *) primitive->result.timeStamp.data, ((CsrUint16) (8))); - CsrMemCpySer(ptr, len, (const void *) primitive->result.localTime.data, ((CsrUint16) (8))); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.channelFrequency); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.capabilityInformation); + CsrUint16Ser(ptr, len, (u16) primitive->result.beaconPeriodTu); + CsrMemCpySer(ptr, len, (const void *) primitive->result.timeStamp.data, ((u16) (8))); + CsrMemCpySer(ptr, len, (const void *) primitive->result.localTime.data, ((u16) (8))); + CsrUint16Ser(ptr, len, (u16) primitive->result.channelFrequency); + CsrUint16Ser(ptr, len, (u16) primitive->result.capabilityInformation); CsrUint8Ser(ptr, len, (u8) primitive->result.channelNumber); CsrUint8Ser(ptr, len, (u8) primitive->result.usability); CsrUint8Ser(ptr, len, (u8) primitive->result.bssType); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.informationElementsLength); + CsrUint16Ser(ptr, len, (u16) primitive->result.informationElementsLength); if (primitive->result.informationElementsLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->result.informationElements, ((CsrUint16) (primitive->result.informationElementsLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->result.informationElements, ((u16) (primitive->result.informationElementsLength))); } CsrUint8Ser(ptr, len, (u8) primitive->result.p2pDeviceRole); switch (primitive->result.p2pDeviceRole) @@ -4622,26 +4622,26 @@ u8* CsrWifiSmeScanResultIndSer(u8 *ptr, CsrSize *len, void *msg) break; case CSR_WIFI_SME_P2P_ROLE_GO: CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.groupInfo.groupCapability); - CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2pDeviceAddress.a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2pDeviceAddress.a, ((u16) (6))); CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.groupInfo.p2pClientInfoCount); { - CsrUint16 i4; + u16 i4; for (i4 = 0; i4 < primitive->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++) { - CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, ((CsrUint16) (6))); - CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, ((CsrUint16) (6))); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods); + CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, ((u16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, ((u16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods); CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap); - CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, ((CsrUint16) (8))); + CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, ((u16) (8))); CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount); { - CsrUint16 i6; + u16 i6; for (i6 = 0; i6 < primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++) { - CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails, ((CsrUint16) (8))); + CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails, ((u16) (8))); } } - CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, ((CsrUint16) (32))); + CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, ((u16) (32))); CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength); } } @@ -4650,19 +4650,19 @@ u8* CsrWifiSmeScanResultIndSer(u8 *ptr, CsrSize *len, void *msg) CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.reservedNone.empty); break; case CSR_WIFI_SME_P2P_ROLE_STANDALONE: - CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.standalonedevInfo.deviceAddress.a, ((CsrUint16) (6))); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->result.deviceInfo.standalonedevInfo.configMethods); + CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.standalonedevInfo.deviceAddress.a, ((u16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->result.deviceInfo.standalonedevInfo.configMethods); CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.standalonedevInfo.p2PDeviceCap); - CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, ((CsrUint16) (8))); + CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, ((u16) (8))); CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount); { - CsrUint16 i4; + u16 i4; for (i4 = 0; i4 < primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++) { - CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails, ((CsrUint16) (8))); + CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails, ((u16) (8))); } } - CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.standalonedevInfo.deviceName, ((CsrUint16) (32))); + CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.standalonedevInfo.deviceName, ((u16) (32))); CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.standalonedevInfo.deviceNameLength); break; default: @@ -4679,25 +4679,25 @@ void* CsrWifiSmeScanResultIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrMemCpyDes(primitive->result.ssid.ssid, buffer, &offset, ((CsrUint16) (32))); + CsrMemCpyDes(primitive->result.ssid.ssid, buffer, &offset, ((u16) (32))); CsrUint8Des((u8 *) &primitive->result.ssid.length, buffer, &offset); - CsrMemCpyDes(primitive->result.bssid.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint16Des((CsrUint16 *) &primitive->result.rssi, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->result.snr, buffer, &offset); + CsrMemCpyDes(primitive->result.bssid.a, buffer, &offset, ((u16) (6))); + CsrUint16Des((u16 *) &primitive->result.rssi, buffer, &offset); + CsrUint16Des((u16 *) &primitive->result.snr, buffer, &offset); CsrUint8Des((u8 *) &primitive->result.ifIndex, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->result.beaconPeriodTu, buffer, &offset); - CsrMemCpyDes(primitive->result.timeStamp.data, buffer, &offset, ((CsrUint16) (8))); - CsrMemCpyDes(primitive->result.localTime.data, buffer, &offset, ((CsrUint16) (8))); - CsrUint16Des((CsrUint16 *) &primitive->result.channelFrequency, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->result.capabilityInformation, buffer, &offset); + CsrUint16Des((u16 *) &primitive->result.beaconPeriodTu, buffer, &offset); + CsrMemCpyDes(primitive->result.timeStamp.data, buffer, &offset, ((u16) (8))); + CsrMemCpyDes(primitive->result.localTime.data, buffer, &offset, ((u16) (8))); + CsrUint16Des((u16 *) &primitive->result.channelFrequency, buffer, &offset); + CsrUint16Des((u16 *) &primitive->result.capabilityInformation, buffer, &offset); CsrUint8Des((u8 *) &primitive->result.channelNumber, buffer, &offset); CsrUint8Des((u8 *) &primitive->result.usability, buffer, &offset); CsrUint8Des((u8 *) &primitive->result.bssType, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->result.informationElementsLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->result.informationElementsLength, buffer, &offset); if (primitive->result.informationElementsLength) { primitive->result.informationElements = (u8 *)CsrPmemAlloc(primitive->result.informationElementsLength); - CsrMemCpyDes(primitive->result.informationElements, buffer, &offset, ((CsrUint16) (primitive->result.informationElementsLength))); + CsrMemCpyDes(primitive->result.informationElements, buffer, &offset, ((u16) (primitive->result.informationElementsLength))); } else { @@ -4711,7 +4711,7 @@ void* CsrWifiSmeScanResultIndDes(u8 *buffer, CsrSize length) break; case CSR_WIFI_SME_P2P_ROLE_GO: CsrUint8Des((u8 *) &primitive->result.deviceInfo.groupInfo.groupCapability, buffer, &offset); - CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2pDeviceAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2pDeviceAddress.a, buffer, &offset, ((u16) (6))); CsrUint8Des((u8 *) &primitive->result.deviceInfo.groupInfo.p2pClientInfoCount, buffer, &offset); primitive->result.deviceInfo.groupInfo.p2PClientInfo = NULL; if (primitive->result.deviceInfo.groupInfo.p2pClientInfoCount) @@ -4719,14 +4719,14 @@ void* CsrWifiSmeScanResultIndDes(u8 *buffer, CsrSize length) primitive->result.deviceInfo.groupInfo.p2PClientInfo = (CsrWifiSmeP2pClientInfoType *)CsrPmemAlloc(sizeof(CsrWifiSmeP2pClientInfoType) * primitive->result.deviceInfo.groupInfo.p2pClientInfoCount); } { - CsrUint16 i4; + u16 i4; for (i4 = 0; i4 < primitive->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++) { - CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, buffer, &offset, ((CsrUint16) (6))); - CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint16Des((CsrUint16 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods, buffer, &offset); + CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, buffer, &offset, ((u16) (6))); + CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, buffer, &offset, ((u16) (6))); + CsrUint16Des((u16 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods, buffer, &offset); CsrUint8Des((u8 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap, buffer, &offset); - CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, buffer, &offset, ((CsrUint16) (8))); + CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, buffer, &offset, ((u16) (8))); CsrUint8Des((u8 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount, buffer, &offset); primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL; if (primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount) @@ -4734,13 +4734,13 @@ void* CsrWifiSmeScanResultIndDes(u8 *buffer, CsrSize length) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = (CsrWifiSmeWpsDeviceType *)CsrPmemAlloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount); } { - CsrUint16 i6; + u16 i6; for (i6 = 0; i6 < primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++) { - CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails, buffer, &offset, ((CsrUint16) (8))); + CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails, buffer, &offset, ((u16) (8))); } } - CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, buffer, &offset, ((CsrUint16) (32))); + CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, buffer, &offset, ((u16) (32))); CsrUint8Des((u8 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength, buffer, &offset); } } @@ -4749,10 +4749,10 @@ void* CsrWifiSmeScanResultIndDes(u8 *buffer, CsrSize length) CsrUint8Des((u8 *) &primitive->result.deviceInfo.reservedNone.empty, buffer, &offset); break; case CSR_WIFI_SME_P2P_ROLE_STANDALONE: - CsrMemCpyDes(primitive->result.deviceInfo.standalonedevInfo.deviceAddress.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint16Des((CsrUint16 *) &primitive->result.deviceInfo.standalonedevInfo.configMethods, buffer, &offset); + CsrMemCpyDes(primitive->result.deviceInfo.standalonedevInfo.deviceAddress.a, buffer, &offset, ((u16) (6))); + CsrUint16Des((u16 *) &primitive->result.deviceInfo.standalonedevInfo.configMethods, buffer, &offset); CsrUint8Des((u8 *) &primitive->result.deviceInfo.standalonedevInfo.p2PDeviceCap, buffer, &offset); - CsrMemCpyDes(primitive->result.deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, buffer, &offset, ((CsrUint16) (8))); + CsrMemCpyDes(primitive->result.deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, buffer, &offset, ((u16) (8))); CsrUint8Des((u8 *) &primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount, buffer, &offset); primitive->result.deviceInfo.standalonedevInfo.secDeviceType = NULL; if (primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount) @@ -4760,13 +4760,13 @@ void* CsrWifiSmeScanResultIndDes(u8 *buffer, CsrSize length) primitive->result.deviceInfo.standalonedevInfo.secDeviceType = (CsrWifiSmeWpsDeviceType *)CsrPmemAlloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount); } { - CsrUint16 i4; + u16 i4; for (i4 = 0; i4 < primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++) { - CsrMemCpyDes(primitive->result.deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails, buffer, &offset, ((CsrUint16) (8))); + CsrMemCpyDes(primitive->result.deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails, buffer, &offset, ((u16) (8))); } } - CsrMemCpyDes(primitive->result.deviceInfo.standalonedevInfo.deviceName, buffer, &offset, ((CsrUint16) (32))); + CsrMemCpyDes(primitive->result.deviceInfo.standalonedevInfo.deviceName, buffer, &offset, ((u16) (32))); CsrUint8Des((u8 *) &primitive->result.deviceInfo.standalonedevInfo.deviceNameLength, buffer, &offset); break; default: @@ -4785,7 +4785,7 @@ void CsrWifiSmeScanResultIndSerFree(void *voidPrimitivePointer) { case CSR_WIFI_SME_P2P_ROLE_GO: { - CsrUint16 i4; + u16 i4; for (i4 = 0; i4 < primitive->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++) { CsrPmemFree(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType); @@ -4810,9 +4810,9 @@ CsrSize CsrWifiSmeScanResultsGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 153) */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 2; /* CsrUint16 primitive->scanResultsCount */ + bufferSize += 2; /* u16 primitive->scanResultsCount */ { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->scanResultsCount; i1++) { bufferSize += 32; /* u8 primitive->scanResults[i1].ssid.ssid[32] */ @@ -4821,15 +4821,15 @@ CsrSize CsrWifiSmeScanResultsGetCfmSizeof(void *msg) bufferSize += 2; /* CsrInt16 primitive->scanResults[i1].rssi */ bufferSize += 2; /* CsrInt16 primitive->scanResults[i1].snr */ bufferSize += 1; /* CsrWifiSmeRadioIF primitive->scanResults[i1].ifIndex */ - bufferSize += 2; /* CsrUint16 primitive->scanResults[i1].beaconPeriodTu */ + bufferSize += 2; /* u16 primitive->scanResults[i1].beaconPeriodTu */ bufferSize += 8; /* u8 primitive->scanResults[i1].timeStamp.data[8] */ bufferSize += 8; /* u8 primitive->scanResults[i1].localTime.data[8] */ - bufferSize += 2; /* CsrUint16 primitive->scanResults[i1].channelFrequency */ - bufferSize += 2; /* CsrUint16 primitive->scanResults[i1].capabilityInformation */ + bufferSize += 2; /* u16 primitive->scanResults[i1].channelFrequency */ + bufferSize += 2; /* u16 primitive->scanResults[i1].capabilityInformation */ bufferSize += 1; /* u8 primitive->scanResults[i1].channelNumber */ bufferSize += 1; /* CsrWifiSmeBasicUsability primitive->scanResults[i1].usability */ bufferSize += 1; /* CsrWifiSmeBssType primitive->scanResults[i1].bssType */ - bufferSize += 2; /* CsrUint16 primitive->scanResults[i1].informationElementsLength */ + bufferSize += 2; /* u16 primitive->scanResults[i1].informationElementsLength */ bufferSize += primitive->scanResults[i1].informationElementsLength; /* u8 primitive->scanResults[i1].informationElements */ bufferSize += 1; /* CsrWifiSmeP2pRole primitive->scanResults[i1].p2pDeviceRole */ switch (primitive->scanResults[i1].p2pDeviceRole) @@ -4842,7 +4842,7 @@ CsrSize CsrWifiSmeScanResultsGetCfmSizeof(void *msg) bufferSize += 6; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2pDeviceAddress.a[6] */ bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount */ { - CsrUint16 i4; + u16 i4; for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++) { bufferSize += 6; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a[6] */ @@ -4852,7 +4852,7 @@ CsrSize CsrWifiSmeScanResultsGetCfmSizeof(void *msg) bufferSize += 8; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails[8] */ bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount */ { - CsrUint16 i6; + u16 i6; for (i6 = 0; i6 < primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++) { bufferSize += 8; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails[8] */ @@ -4873,7 +4873,7 @@ CsrSize CsrWifiSmeScanResultsGetCfmSizeof(void *msg) bufferSize += 8; /* u8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.primDeviceType.deviceDetails[8] */ bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount */ { - CsrUint16 i4; + u16 i4; for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++) { bufferSize += 8; /* u8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails[8] */ @@ -4896,30 +4896,30 @@ u8* CsrWifiSmeScanResultsGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeScanResultsGetCfm *primitive = (CsrWifiSmeScanResultsGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResultsCount); + CsrUint16Ser(ptr, len, (u16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->scanResultsCount); { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->scanResultsCount; i1++) { - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].ssid.ssid, ((CsrUint16) (32))); + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].ssid.ssid, ((u16) (32))); CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].ssid.length); - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].bssid.a, ((CsrUint16) (6))); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].rssi); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].snr); + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].bssid.a, ((u16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].rssi); + CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].snr); CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].ifIndex); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].beaconPeriodTu); - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].timeStamp.data, ((CsrUint16) (8))); - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].localTime.data, ((CsrUint16) (8))); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].channelFrequency); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].capabilityInformation); + CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].beaconPeriodTu); + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].timeStamp.data, ((u16) (8))); + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].localTime.data, ((u16) (8))); + CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].channelFrequency); + CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].capabilityInformation); CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].channelNumber); CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].usability); CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].bssType); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].informationElementsLength); + CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].informationElementsLength); if (primitive->scanResults[i1].informationElementsLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].informationElements, ((CsrUint16) (primitive->scanResults[i1].informationElementsLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].informationElements, ((u16) (primitive->scanResults[i1].informationElementsLength))); } CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].p2pDeviceRole); switch (primitive->scanResults[i1].p2pDeviceRole) @@ -4929,26 +4929,26 @@ u8* CsrWifiSmeScanResultsGetCfmSer(u8 *ptr, CsrSize *len, void *msg) break; case CSR_WIFI_SME_P2P_ROLE_GO: CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.groupInfo.groupCapability); - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2pDeviceAddress.a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2pDeviceAddress.a, ((u16) (6))); CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount); { - CsrUint16 i4; + u16 i4; for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++) { - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, ((CsrUint16) (6))); - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, ((CsrUint16) (6))); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods); + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, ((u16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, ((u16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods); CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap); - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, ((CsrUint16) (8))); + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, ((u16) (8))); CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount); { - CsrUint16 i6; + u16 i6; for (i6 = 0; i6 < primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++) { - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails, ((CsrUint16) (8))); + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails, ((u16) (8))); } } - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, ((CsrUint16) (32))); + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, ((u16) (32))); CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength); } } @@ -4957,19 +4957,19 @@ u8* CsrWifiSmeScanResultsGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.reservedNone.empty); break; case CSR_WIFI_SME_P2P_ROLE_STANDALONE: - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceAddress.a, ((CsrUint16) (6))); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->scanResults[i1].deviceInfo.standalonedevInfo.configMethods); + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceAddress.a, ((u16) (6))); + CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].deviceInfo.standalonedevInfo.configMethods); CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.standalonedevInfo.p2PDeviceCap); - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, ((CsrUint16) (8))); + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, ((u16) (8))); CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount); { - CsrUint16 i4; + u16 i4; for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++) { - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails, ((CsrUint16) (8))); + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails, ((u16) (8))); } } - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceName, ((CsrUint16) (32))); + CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceName, ((u16) (32))); CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceNameLength); break; default: @@ -4988,36 +4988,36 @@ void* CsrWifiSmeScanResultsGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->scanResultsCount, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->scanResultsCount, buffer, &offset); primitive->scanResults = NULL; if (primitive->scanResultsCount) { primitive->scanResults = (CsrWifiSmeScanResult *)CsrPmemAlloc(sizeof(CsrWifiSmeScanResult) * primitive->scanResultsCount); } { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->scanResultsCount; i1++) { - CsrMemCpyDes(primitive->scanResults[i1].ssid.ssid, buffer, &offset, ((CsrUint16) (32))); + CsrMemCpyDes(primitive->scanResults[i1].ssid.ssid, buffer, &offset, ((u16) (32))); CsrUint8Des((u8 *) &primitive->scanResults[i1].ssid.length, buffer, &offset); - CsrMemCpyDes(primitive->scanResults[i1].bssid.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].rssi, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].snr, buffer, &offset); + CsrMemCpyDes(primitive->scanResults[i1].bssid.a, buffer, &offset, ((u16) (6))); + CsrUint16Des((u16 *) &primitive->scanResults[i1].rssi, buffer, &offset); + CsrUint16Des((u16 *) &primitive->scanResults[i1].snr, buffer, &offset); CsrUint8Des((u8 *) &primitive->scanResults[i1].ifIndex, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].beaconPeriodTu, buffer, &offset); - CsrMemCpyDes(primitive->scanResults[i1].timeStamp.data, buffer, &offset, ((CsrUint16) (8))); - CsrMemCpyDes(primitive->scanResults[i1].localTime.data, buffer, &offset, ((CsrUint16) (8))); - CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].channelFrequency, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].capabilityInformation, buffer, &offset); + CsrUint16Des((u16 *) &primitive->scanResults[i1].beaconPeriodTu, buffer, &offset); + CsrMemCpyDes(primitive->scanResults[i1].timeStamp.data, buffer, &offset, ((u16) (8))); + CsrMemCpyDes(primitive->scanResults[i1].localTime.data, buffer, &offset, ((u16) (8))); + CsrUint16Des((u16 *) &primitive->scanResults[i1].channelFrequency, buffer, &offset); + CsrUint16Des((u16 *) &primitive->scanResults[i1].capabilityInformation, buffer, &offset); CsrUint8Des((u8 *) &primitive->scanResults[i1].channelNumber, buffer, &offset); CsrUint8Des((u8 *) &primitive->scanResults[i1].usability, buffer, &offset); CsrUint8Des((u8 *) &primitive->scanResults[i1].bssType, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].informationElementsLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->scanResults[i1].informationElementsLength, buffer, &offset); if (primitive->scanResults[i1].informationElementsLength) { primitive->scanResults[i1].informationElements = (u8 *)CsrPmemAlloc(primitive->scanResults[i1].informationElementsLength); - CsrMemCpyDes(primitive->scanResults[i1].informationElements, buffer, &offset, ((CsrUint16) (primitive->scanResults[i1].informationElementsLength))); + CsrMemCpyDes(primitive->scanResults[i1].informationElements, buffer, &offset, ((u16) (primitive->scanResults[i1].informationElementsLength))); } else { @@ -5031,7 +5031,7 @@ void* CsrWifiSmeScanResultsGetCfmDes(u8 *buffer, CsrSize length) break; case CSR_WIFI_SME_P2P_ROLE_GO: CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.groupCapability, buffer, &offset); - CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2pDeviceAddress.a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2pDeviceAddress.a, buffer, &offset, ((u16) (6))); CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount, buffer, &offset); primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo = NULL; if (primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount) @@ -5039,14 +5039,14 @@ void* CsrWifiSmeScanResultsGetCfmDes(u8 *buffer, CsrSize length) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo = (CsrWifiSmeP2pClientInfoType *)CsrPmemAlloc(sizeof(CsrWifiSmeP2pClientInfoType) * primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount); } { - CsrUint16 i4; + u16 i4; for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++) { - CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, buffer, &offset, ((CsrUint16) (6))); - CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods, buffer, &offset); + CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, buffer, &offset, ((u16) (6))); + CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, buffer, &offset, ((u16) (6))); + CsrUint16Des((u16 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods, buffer, &offset); CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap, buffer, &offset); - CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, buffer, &offset, ((CsrUint16) (8))); + CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, buffer, &offset, ((u16) (8))); CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount, buffer, &offset); primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL; if (primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount) @@ -5054,13 +5054,13 @@ void* CsrWifiSmeScanResultsGetCfmDes(u8 *buffer, CsrSize length) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = (CsrWifiSmeWpsDeviceType *)CsrPmemAlloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount); } { - CsrUint16 i6; + u16 i6; for (i6 = 0; i6 < primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++) { - CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails, buffer, &offset, ((CsrUint16) (8))); + CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails, buffer, &offset, ((u16) (8))); } } - CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, buffer, &offset, ((CsrUint16) (32))); + CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, buffer, &offset, ((u16) (32))); CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength, buffer, &offset); } } @@ -5069,10 +5069,10 @@ void* CsrWifiSmeScanResultsGetCfmDes(u8 *buffer, CsrSize length) CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.reservedNone.empty, buffer, &offset); break; case CSR_WIFI_SME_P2P_ROLE_STANDALONE: - CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceAddress.a, buffer, &offset, ((CsrUint16) (6))); - CsrUint16Des((CsrUint16 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.configMethods, buffer, &offset); + CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceAddress.a, buffer, &offset, ((u16) (6))); + CsrUint16Des((u16 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.configMethods, buffer, &offset); CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.p2PDeviceCap, buffer, &offset); - CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, buffer, &offset, ((CsrUint16) (8))); + CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, buffer, &offset, ((u16) (8))); CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount, buffer, &offset); primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType = NULL; if (primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount) @@ -5080,13 +5080,13 @@ void* CsrWifiSmeScanResultsGetCfmDes(u8 *buffer, CsrSize length) primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType = (CsrWifiSmeWpsDeviceType *)CsrPmemAlloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount); } { - CsrUint16 i4; + u16 i4; for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++) { - CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails, buffer, &offset, ((CsrUint16) (8))); + CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails, buffer, &offset, ((u16) (8))); } } - CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceName, buffer, &offset, ((CsrUint16) (32))); + CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceName, buffer, &offset, ((u16) (32))); CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceNameLength, buffer, &offset); break; default: @@ -5103,7 +5103,7 @@ void CsrWifiSmeScanResultsGetCfmSerFree(void *voidPrimitivePointer) { CsrWifiSmeScanResultsGetCfm *primitive = (CsrWifiSmeScanResultsGetCfm *) voidPrimitivePointer; { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < primitive->scanResultsCount; i1++) { CsrPmemFree(primitive->scanResults[i1].informationElements); @@ -5111,7 +5111,7 @@ void CsrWifiSmeScanResultsGetCfmSerFree(void *voidPrimitivePointer) { case CSR_WIFI_SME_P2P_ROLE_GO: { - CsrUint16 i4; + u16 i4; for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++) { CsrPmemFree(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType); @@ -5137,7 +5137,7 @@ CsrSize CsrWifiSmeSmeStaConfigGetCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* u8 primitive->smeConfig.connectionQualityRssiChangeTrigger */ bufferSize += 1; /* u8 primitive->smeConfig.connectionQualitySnrChangeTrigger */ @@ -5154,8 +5154,8 @@ u8* CsrWifiSmeSmeStaConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeSmeStaConfigGetCfm *primitive = (CsrWifiSmeSmeStaConfigGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.connectionQualityRssiChangeTrigger); CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.connectionQualitySnrChangeTrigger); CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.wmmModeMask); @@ -5173,8 +5173,8 @@ void* CsrWifiSmeSmeStaConfigGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); CsrUint8Des((u8 *) &primitive->smeConfig.connectionQualityRssiChangeTrigger, buffer, &offset); CsrUint8Des((u8 *) &primitive->smeConfig.connectionQualitySnrChangeTrigger, buffer, &offset); CsrUint8Des((u8 *) &primitive->smeConfig.wmmModeMask, buffer, &offset); @@ -5191,7 +5191,7 @@ CsrSize CsrWifiSmeSmeStaConfigSetCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ return bufferSize; } @@ -5202,8 +5202,8 @@ u8* CsrWifiSmeSmeStaConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeSmeStaConfigSetCfm *primitive = (CsrWifiSmeSmeStaConfigSetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -5215,8 +5215,8 @@ void* CsrWifiSmeSmeStaConfigSetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; } @@ -5229,7 +5229,7 @@ CsrSize CsrWifiSmeStationMacAddressGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */ bufferSize += 2; /* CsrResult primitive->status */ { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < 2; i1++) { bufferSize += 6; /* u8 primitive->stationMacAddress[i1].a[6] */ @@ -5244,12 +5244,12 @@ u8* CsrWifiSmeStationMacAddressGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeStationMacAddressGetCfm *primitive = (CsrWifiSmeStationMacAddressGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->status); { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < 2; i1++) { - CsrMemCpySer(ptr, len, (const void *) primitive->stationMacAddress[i1].a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->stationMacAddress[i1].a, ((u16) (6))); } } return(ptr); @@ -5263,12 +5263,12 @@ void* CsrWifiSmeStationMacAddressGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); { - CsrUint16 i1; + u16 i1; for (i1 = 0; i1 < 2; i1++) { - CsrMemCpyDes(primitive->stationMacAddress[i1].a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->stationMacAddress[i1].a, buffer, &offset, ((u16) (6))); } } @@ -5282,10 +5282,10 @@ CsrSize CsrWifiSmeTspecIndSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 4; /* CsrUint32 primitive->transactionId */ bufferSize += 1; /* CsrWifiSmeTspecResultCode primitive->tspecResultCode */ - bufferSize += 2; /* CsrUint16 primitive->tspecLength */ + bufferSize += 2; /* u16 primitive->tspecLength */ bufferSize += primitive->tspecLength; /* u8 primitive->tspec */ return bufferSize; } @@ -5296,13 +5296,13 @@ u8* CsrWifiSmeTspecIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeTspecInd *primitive = (CsrWifiSmeTspecInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint32Ser(ptr, len, (CsrUint32) primitive->transactionId); CsrUint8Ser(ptr, len, (u8) primitive->tspecResultCode); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->tspecLength); + CsrUint16Ser(ptr, len, (u16) primitive->tspecLength); if (primitive->tspecLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->tspec, ((CsrUint16) (primitive->tspecLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->tspec, ((u16) (primitive->tspecLength))); } return(ptr); } @@ -5315,14 +5315,14 @@ void* CsrWifiSmeTspecIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->transactionId, buffer, &offset); CsrUint8Des((u8 *) &primitive->tspecResultCode, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->tspecLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->tspecLength, buffer, &offset); if (primitive->tspecLength) { primitive->tspec = (u8 *)CsrPmemAlloc(primitive->tspecLength); - CsrMemCpyDes(primitive->tspec, buffer, &offset, ((CsrUint16) (primitive->tspecLength))); + CsrMemCpyDes(primitive->tspec, buffer, &offset, ((u16) (primitive->tspecLength))); } else { @@ -5347,11 +5347,11 @@ CsrSize CsrWifiSmeTspecCfmSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ - bufferSize += 2; /* CsrUint16 primitive->interfaceTag */ + bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 4; /* CsrUint32 primitive->transactionId */ bufferSize += 1; /* CsrWifiSmeTspecResultCode primitive->tspecResultCode */ - bufferSize += 2; /* CsrUint16 primitive->tspecLength */ + bufferSize += 2; /* u16 primitive->tspecLength */ bufferSize += primitive->tspecLength; /* u8 primitive->tspec */ return bufferSize; } @@ -5362,14 +5362,14 @@ u8* CsrWifiSmeTspecCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeTspecCfm *primitive = (CsrWifiSmeTspecCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); + CsrUint16Ser(ptr, len, (u16) primitive->status); CsrUint32Ser(ptr, len, (CsrUint32) primitive->transactionId); CsrUint8Ser(ptr, len, (u8) primitive->tspecResultCode); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->tspecLength); + CsrUint16Ser(ptr, len, (u16) primitive->tspecLength); if (primitive->tspecLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->tspec, ((CsrUint16) (primitive->tspecLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->tspec, ((u16) (primitive->tspecLength))); } return(ptr); } @@ -5382,15 +5382,15 @@ void* CsrWifiSmeTspecCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->transactionId, buffer, &offset); CsrUint8Des((u8 *) &primitive->tspecResultCode, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->tspecLength, buffer, &offset); + CsrUint16Des((u16 *) &primitive->tspecLength, buffer, &offset); if (primitive->tspecLength) { primitive->tspec = (u8 *)CsrPmemAlloc(primitive->tspecLength); - CsrMemCpyDes(primitive->tspec, buffer, &offset, ((CsrUint16) (primitive->tspecLength))); + CsrMemCpyDes(primitive->tspec, buffer, &offset, ((u16) (primitive->tspecLength))); } else { @@ -5434,7 +5434,7 @@ u8* CsrWifiSmeVersionsGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeVersionsGetCfm *primitive = (CsrWifiSmeVersionsGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->status); CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.chipId); CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.chipVersion); CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.firmwareBuild); @@ -5455,7 +5455,7 @@ void* CsrWifiSmeVersionsGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->versions.chipId, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->versions.chipVersion, buffer, &offset); CsrUint32Des((CsrUint32 *) &primitive->versions.firmwareBuild, buffer, &offset); @@ -5488,7 +5488,7 @@ CsrSize CsrWifiSmeCloakedSsidsGetCfmSizeof(void *msg) bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* u8 primitive->cloakedSsids.cloakedSsidsCount */ { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) { bufferSize += 32; /* u8 primitive->cloakedSsids.cloakedSsids[i2].ssid[32] */ @@ -5504,13 +5504,13 @@ u8* CsrWifiSmeCloakedSsidsGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeCloakedSsidsGetCfm *primitive = (CsrWifiSmeCloakedSsidsGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->status); CsrUint8Ser(ptr, len, (u8) primitive->cloakedSsids.cloakedSsidsCount); { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) { - CsrMemCpySer(ptr, len, (const void *) primitive->cloakedSsids.cloakedSsids[i2].ssid, ((CsrUint16) (32))); + CsrMemCpySer(ptr, len, (const void *) primitive->cloakedSsids.cloakedSsids[i2].ssid, ((u16) (32))); CsrUint8Ser(ptr, len, (u8) primitive->cloakedSsids.cloakedSsids[i2].length); } } @@ -5525,7 +5525,7 @@ void* CsrWifiSmeCloakedSsidsGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); CsrUint8Des((u8 *) &primitive->cloakedSsids.cloakedSsidsCount, buffer, &offset); primitive->cloakedSsids.cloakedSsids = NULL; if (primitive->cloakedSsids.cloakedSsidsCount) @@ -5533,10 +5533,10 @@ void* CsrWifiSmeCloakedSsidsGetCfmDes(u8 *buffer, CsrSize length) primitive->cloakedSsids.cloakedSsids = (CsrWifiSsid *)CsrPmemAlloc(sizeof(CsrWifiSsid) * primitive->cloakedSsids.cloakedSsidsCount); } { - CsrUint16 i2; + u16 i2; for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) { - CsrMemCpyDes(primitive->cloakedSsids.cloakedSsids[i2].ssid, buffer, &offset, ((CsrUint16) (32))); + CsrMemCpyDes(primitive->cloakedSsids.cloakedSsids[i2].ssid, buffer, &offset, ((u16) (32))); CsrUint8Des((u8 *) &primitive->cloakedSsids.cloakedSsids[i2].length, buffer, &offset); } } @@ -5568,7 +5568,7 @@ u8* CsrWifiSmeWifiOnIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeWifiOnInd *primitive = (CsrWifiSmeWifiOnInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((CsrUint16) (6))); + CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((u16) (6))); return(ptr); } @@ -5580,7 +5580,7 @@ void* CsrWifiSmeWifiOnIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrMemCpyDes(primitive->address.a, buffer, &offset, ((CsrUint16) (6))); + CsrMemCpyDes(primitive->address.a, buffer, &offset, ((u16) (6))); return primitive; } @@ -5605,9 +5605,9 @@ u8* CsrWifiSmeSmeCommonConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeSmeCommonConfigGetCfm *primitive = (CsrWifiSmeSmeCommonConfigGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->status); CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.trustLevel); - CsrMemCpySer(ptr, len, (const void *) primitive->deviceConfig.countryCode, ((CsrUint16) (2))); + CsrMemCpySer(ptr, len, (const void *) primitive->deviceConfig.countryCode, ((u16) (2))); CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.firmwareDriverInterface); CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.enableStrictDraftN); return(ptr); @@ -5621,9 +5621,9 @@ void* CsrWifiSmeSmeCommonConfigGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); CsrUint8Des((u8 *) &primitive->deviceConfig.trustLevel, buffer, &offset); - CsrMemCpyDes(primitive->deviceConfig.countryCode, buffer, &offset, ((CsrUint16) (2))); + CsrMemCpyDes(primitive->deviceConfig.countryCode, buffer, &offset, ((u16) (2))); CsrUint8Des((u8 *) &primitive->deviceConfig.firmwareDriverInterface, buffer, &offset); CsrUint8Des((u8 *) &primitive->deviceConfig.enableStrictDraftN, buffer, &offset); @@ -5637,7 +5637,7 @@ CsrSize CsrWifiSmeInterfaceCapabilityGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 2; /* CsrUint16 primitive->numInterfaces */ + bufferSize += 2; /* u16 primitive->numInterfaces */ bufferSize += 2; /* u8 primitive->capBitmap[2] */ return bufferSize; } @@ -5648,9 +5648,9 @@ u8* CsrWifiSmeInterfaceCapabilityGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeInterfaceCapabilityGetCfm *primitive = (CsrWifiSmeInterfaceCapabilityGetCfm *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->status); - CsrUint16Ser(ptr, len, (CsrUint16) primitive->numInterfaces); - CsrMemCpySer(ptr, len, (const void *) primitive->capBitmap, ((CsrUint16) (2))); + CsrUint16Ser(ptr, len, (u16) primitive->status); + CsrUint16Ser(ptr, len, (u16) primitive->numInterfaces); + CsrMemCpySer(ptr, len, (const void *) primitive->capBitmap, ((u16) (2))); return(ptr); } @@ -5662,9 +5662,9 @@ void* CsrWifiSmeInterfaceCapabilityGetCfmDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset); - CsrUint16Des((CsrUint16 *) &primitive->numInterfaces, buffer, &offset); - CsrMemCpyDes(primitive->capBitmap, buffer, &offset, ((CsrUint16) (2))); + CsrUint16Des((u16 *) &primitive->status, buffer, &offset); + CsrUint16Des((u16 *) &primitive->numInterfaces, buffer, &offset); + CsrMemCpyDes(primitive->capBitmap, buffer, &offset, ((u16) (2))); return primitive; } @@ -5774,7 +5774,7 @@ u8* CsrWifiSmeCoreDumpIndSer(u8 *ptr, CsrSize *len, void *msg) CsrUint32Ser(ptr, len, (CsrUint32) primitive->dataLength); if (primitive->dataLength) { - CsrMemCpySer(ptr, len, (const void *) primitive->data, ((CsrUint16) (primitive->dataLength))); + CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength))); } return(ptr); } @@ -5791,7 +5791,7 @@ void* CsrWifiSmeCoreDumpIndDes(u8 *buffer, CsrSize length) if (primitive->dataLength) { primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); - CsrMemCpyDes(primitive->data, buffer, &offset, ((CsrUint16) (primitive->dataLength))); + CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength))); } else { diff --git a/drivers/staging/csr/csr_wifi_vif_utils.h b/drivers/staging/csr/csr_wifi_vif_utils.h index ee8b438..4eafbec 100644 --- a/drivers/staging/csr/csr_wifi_vif_utils.h +++ b/drivers/staging/csr/csr_wifi_vif_utils.h @@ -25,7 +25,7 @@ extern "C" { /* Common macros for NME and SME to be used temporarily until SoftMAC changes are made */ #define CSR_WIFI_NUM_INTERFACES (u8)0x1 -#define CSR_WIFI_INTERFACE_IN_USE (CsrUint16)0x0 +#define CSR_WIFI_INTERFACE_IN_USE (u16)0x0 /* This is used at places where interface Id isn't available*/ #define CSR_WIFI_INTERFACE_ZERO 0 @@ -37,14 +37,14 @@ extern "C" { /* Extract the Interface Id from the event */ #define CsrWifiVifUtilsGetVifTagFromEvent(msg) \ - ((CsrUint16) * ((CsrUint16 *) ((u8 *) (msg) + sizeof(CsrWifiFsmEvent)))) + ((u16) * ((u16 *) ((u8 *) (msg) + sizeof(CsrWifiFsmEvent)))) /* The HPI Vif combines the type and the interface id */ #define CsrWifiVifUtilsGetVifTagFromHipEvent(msg) \ ((msg)->virtualInterfaceIdentifier & 0x00FF) #define CsrWifiVifUtilsPackHipEventVif(type, interfaceId) \ - ((CsrUint16)((interfaceId) | ((type) << 8))) + ((u16)((interfaceId) | ((type) << 8))) /* TYPES DEFINITIONS ********************************************************/ @@ -60,7 +60,7 @@ extern "C" { * * @param[in] u8 : interface capability bitmap * @param[in] u8* : pointer to the array of current interface modes - * @param[in] CsrUint16 : interfaceTag + * @param[in] u16 : interfaceTag * @param[in] CsrWifiInterfaceMode : mode * * @return @@ -68,7 +68,7 @@ extern "C" { */ extern CsrBool CsrWifiVifUtilsCheckCompatibility(u8 interfaceCapability, u8 *currentInterfaceModes, - CsrUint16 interfaceTag, + u16 interfaceTag, CsrWifiInterfaceMode mode); /** @@ -77,12 +77,12 @@ extern CsrBool CsrWifiVifUtilsCheckCompatibility(u8 interfaceCapabil * NOTE: Only checks that the interface is supported, no checks are made to * determine whether a supported interface may be made active. * - * @param[in] CsrUint16 : interfaceTag + * @param[in] u16 : interfaceTag * * @return * CsrBool : returns true if the interface is supported, otherwise false. */ -extern CsrBool CsrWifiVifUtilsIsSupported(CsrUint16 interfaceTag); +extern CsrBool CsrWifiVifUtilsIsSupported(u16 interfaceTag); #ifdef CSR_LOG_ENABLE /** diff --git a/drivers/staging/csr/data_tx.c b/drivers/staging/csr/data_tx.c index c5858a5..8ed7a78 100644 --- a/drivers/staging/csr/data_tx.c +++ b/drivers/staging/csr/data_tx.c @@ -19,7 +19,7 @@ int uf_verify_m4(unifi_priv_t *priv, const unsigned char *packet, unsigned int length) { const unsigned char *p = packet; - CsrUint16 keyinfo; + u16 keyinfo; if (length < (4 + 5 + 8 + 32 + 16 + 8 + 8 + 16 + 1 + 8)) { diff --git a/drivers/staging/csr/drv.c b/drivers/staging/csr/drv.c index 4be6d95..5ce3329 100644 --- a/drivers/staging/csr/drv.c +++ b/drivers/staging/csr/drv.c @@ -1295,7 +1295,7 @@ unifi_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) case UNIFI_INIT_NETDEV: { /* get the proper interfaceTagId */ - CsrUint16 interfaceTag=0; + u16 interfaceTag=0; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; dev = priv->netdev[interfaceTag]; @@ -1483,14 +1483,14 @@ unifi_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) break; } - pcli->snap_filter.protocols = CsrPmemAlloc(snap_filter.count * sizeof(CsrUint16)); + pcli->snap_filter.protocols = CsrPmemAlloc(snap_filter.count * sizeof(u16)); if (!pcli->snap_filter.protocols) { r = -ENOMEM; goto out; } if (copy_from_user((void*)pcli->snap_filter.protocols, (void*)snap_filter.protocols, - snap_filter.count * sizeof(CsrUint16))) + snap_filter.count * sizeof(u16))) { CsrPmemFree(pcli->snap_filter.protocols); r = -EFAULT; @@ -1805,16 +1805,16 @@ udi_log_event(ul_client_t *pcli, { int timestamp = jiffies_to_msecs(jiffies); unifi_debug_log_to_buf("T:"); - unifi_debug_log_to_buf("%04X%04X ", *(((CsrUint16*)×tamp) + 1), - *(CsrUint16*)×tamp); + unifi_debug_log_to_buf("%04X%04X ", *(((u16*)×tamp) + 1), + *(u16*)×tamp); } /* Add signal */ unifi_debug_log_to_buf("S%s:%04X R:%04X D:%04X ", dir ? "T" : "F", - *(CsrUint16*)signal, - *(CsrUint16*)(signal + 2), - *(CsrUint16*)(signal + 4)); + *(u16*)signal, + *(u16*)(signal + 2), + *(u16*)(signal + 4)); unifi_debug_hex_to_buf(signal + 6, signal_len - 6); /* Add bulk data (assume 1 bulk data per signal) */ diff --git a/drivers/staging/csr/io.c b/drivers/staging/csr/io.c index f489ade..d089579 100644 --- a/drivers/staging/csr/io.c +++ b/drivers/staging/csr/io.c @@ -333,7 +333,7 @@ register_unifi_sdio(CsrSdioFunction *sdio_dev, int bus_id, struct device *dev) Unifi_netdev_instances[bus_id * CSR_WIFI_NUM_INTERFACES] = netdev_priv(priv->netdev[0]); /* Initialise the mini-coredump capture buffers */ - csrResult = unifi_coredump_init(priv->card, (CsrUint16)coredump_max); + csrResult = unifi_coredump_init(priv->card, (u16)coredump_max); if (csrResult != CSR_RESULT_SUCCESS) { unifi_error(priv, "Couldn't allocate mini-coredump buffers\n"); } diff --git a/drivers/staging/csr/netdev.c b/drivers/staging/csr/netdev.c index cef0ba3..947a6ec 100644 --- a/drivers/staging/csr/netdev.c +++ b/drivers/staging/csr/netdev.c @@ -553,7 +553,7 @@ uf_alloc_netdevice(CsrSdioFunction *sdio_dev, int bus_id) * --------------------------------------------------------------------------- */ CsrBool -uf_alloc_netdevice_for_other_interfaces(unifi_priv_t *priv, CsrUint16 interfaceTag) +uf_alloc_netdevice_for_other_interfaces(unifi_priv_t *priv, u16 interfaceTag) { struct net_device *dev; netInterface_priv_t *interfacePriv; @@ -1080,7 +1080,7 @@ skb_add_llc_snap(struct net_device *dev, struct sk_buff *skb, int proto) #ifdef CSR_SUPPORT_SME static int _identify_sme_ma_pkt_ind(unifi_priv_t *priv, - const s8 *oui, CsrUint16 protocol, + const s8 *oui, u16 protocol, const CSR_SIGNAL *signal, bulk_data_param_t *bulkdata, const unsigned char *daddr, @@ -1322,7 +1322,7 @@ skb_80211_to_ether(unifi_priv_t *priv, struct sk_buff *skb, } /* skb_80211_to_ether() */ -static CsrWifiRouterCtrlPortAction verify_port(unifi_priv_t *priv, unsigned char *address, int queue, CsrUint16 interfaceTag) +static CsrWifiRouterCtrlPortAction verify_port(unifi_priv_t *priv, unsigned char *address, int queue, u16 interfaceTag) { #ifdef CSR_NATIVE_LINUX #ifdef CSR_SUPPORT_WEXT @@ -1368,12 +1368,12 @@ static CsrWifiRouterCtrlPortAction verify_port(unifi_priv_t *priv, unsigned char int prepare_and_add_macheader(unifi_priv_t *priv, struct sk_buff *skb, struct sk_buff *newSkb, CSR_PRIORITY priority, bulk_data_param_t *bulkdata, - CsrUint16 interfaceTag, + u16 interfaceTag, const u8 *daddr, const u8 *saddr, CsrBool protection) { - CsrUint16 fc = 0; + u16 fc = 0; u8 qc = 0; u8 macHeaderLengthInBytes = MAC_HEADER_SIZE, *bufPtr = NULL; bulk_data_param_t data_ptrs; @@ -1649,12 +1649,12 @@ static int send_ma_pkt_request(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr *ehdr, CSR_PRIORITY priority) { int r; - CsrUint16 i; + u16 i; CsrBool eapolStore = FALSE; struct sk_buff *newSkb = NULL; bulk_data_param_t bulkdata; const int proto = ntohs(ehdr->h_proto); - CsrUint16 interfaceTag; + u16 interfaceTag; CsrWifiMacAddress peerAddress; CSR_TRANSMISSION_CONTROL transmissionControl = CSR_NO_CONFIRM_REQUIRED; s8 protection; @@ -2150,7 +2150,7 @@ unifi_restart_xmit(void *ospriv, unifi_TrafficQueue queue) static void -indicate_rx_skb(unifi_priv_t *priv, CsrUint16 ifTag, u8* dst_a, u8* src_a, struct sk_buff *skb, CSR_SIGNAL *signal, +indicate_rx_skb(unifi_priv_t *priv, u16 ifTag, u8* dst_a, u8* src_a, struct sk_buff *skb, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata) { int r, sr = 0; @@ -2250,7 +2250,7 @@ indicate_rx_skb(unifi_priv_t *priv, CsrUint16 ifTag, u8* dst_a, u8* src_a, struc void uf_process_rx_pending_queue(unifi_priv_t *priv, int queue, CsrWifiMacAddress source_address, - int indicate, CsrUint16 interfaceTag) + int indicate, u16 interfaceTag) { rx_buffered_packets_t *rx_q_item; struct list_head *rx_list; @@ -2325,7 +2325,7 @@ uf_process_rx_pending_queue(unifi_priv_t *priv, int queue, void uf_resume_data_plane(unifi_priv_t *priv, int queue, CsrWifiMacAddress peer_address, - CsrUint16 interfaceTag) + u16 interfaceTag) { #ifdef CSR_SUPPORT_WEXT netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; @@ -2363,7 +2363,7 @@ uf_resume_data_plane(unifi_priv_t *priv, int queue, } /* uf_resume_data_plane() */ -void uf_free_pending_rx_packets(unifi_priv_t *priv, int queue, CsrWifiMacAddress peer_address,CsrUint16 interfaceTag) +void uf_free_pending_rx_packets(unifi_priv_t *priv, int queue, CsrWifiMacAddress peer_address,u16 interfaceTag) { uf_process_rx_pending_queue(priv, queue, peer_address, 0,interfaceTag); @@ -2387,7 +2387,7 @@ void uf_free_pending_rx_packets(unifi_priv_t *priv, int queue, CsrWifiMacAddress static void unifi_rx(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata) { - CsrUint16 interfaceTag; + u16 interfaceTag; bulk_data_desc_t *pData; const CSR_MA_PACKET_INDICATION *pkt_ind = &signal->u.MaPacketIndication; struct sk_buff *skb; @@ -2398,7 +2398,7 @@ unifi_rx(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata) u8 da[ETH_ALEN], sa[ETH_ALEN]; u8 toDs, fromDs, frameType, macHeaderLengthInBytes = MAC_HEADER_SIZE; - CsrUint16 frameControl; + u16 frameControl; netInterface_priv_t *interfacePriv; struct ethhdr ehdr; @@ -2676,7 +2676,7 @@ unifi_rx(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata) static void process_ma_packet_cfm(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata) { - CsrUint16 interfaceTag; + u16 interfaceTag; const CSR_MA_PACKET_CONFIRM *pkt_cfm = &signal->u.MaPacketConfirm; netInterface_priv_t *interfacePriv; @@ -2732,11 +2732,11 @@ static void process_ma_packet_cfm(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_d */ static void process_ma_packet_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata) { - CsrUint16 interfaceTag; + u16 interfaceTag; bulk_data_desc_t *pData; CSR_MA_PACKET_INDICATION *pkt_ind = (CSR_MA_PACKET_INDICATION*)&signal->u.MaPacketIndication; struct sk_buff *skb; - CsrUint16 frameControl; + u16 frameControl; netInterface_priv_t *interfacePriv; u8 da[ETH_ALEN], sa[ETH_ALEN]; u8 *bssid = NULL, *ba_addr = NULL; @@ -2748,7 +2748,7 @@ static void process_ma_packet_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_d CsrBool powerSaveChanged = FALSE; u8 pmBit = 0; CsrWifiRouterCtrlStaInfo_t *srcStaInfo = NULL; - CsrUint16 qosControl; + u16 qosControl; #endif @@ -2820,7 +2820,7 @@ static void process_ma_packet_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_d frameType = ((frameControl & 0x000C) >> 2); unifi_trace(priv, UDBG3, "Rx Frame Type: %d sn: %d\n",frameType, - (le16_to_cpu(*((CsrUint16*)(bulkdata->d[0].os_data_ptr + IEEE802_11_SEQUENCE_CONTROL_OFFSET))) >> 4) & 0xfff); + (le16_to_cpu(*((u16*)(bulkdata->d[0].os_data_ptr + IEEE802_11_SEQUENCE_CONTROL_OFFSET))) >> 4) & 0xfff); if(frameType == IEEE802_11_FRAMETYPE_CONTROL){ #ifdef CSR_SUPPORT_SME unifi_trace(priv, UDBG6, "%s: Received Control Frame\n", __FUNCTION__); @@ -2929,7 +2929,7 @@ static void process_ma_packet_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_d frame_desc_struct frame_desc; frame_desc.bulkdata = *bulkdata; frame_desc.signal = *signal; - frame_desc.sn = (le16_to_cpu(*((CsrUint16*)(bulkdata->d[0].os_data_ptr + IEEE802_11_SEQUENCE_CONTROL_OFFSET))) >> 4) & 0xfff; + frame_desc.sn = (le16_to_cpu(*((u16*)(bulkdata->d[0].os_data_ptr + IEEE802_11_SEQUENCE_CONTROL_OFFSET))) >> 4) & 0xfff; frame_desc.active = TRUE; unifi_trace(priv, UDBG6, "%s: calling process_ba_frame (session=%d)\n", __FUNCTION__, ba_session_idx); process_ba_frame(priv, interfacePriv, ba_session, &frame_desc); @@ -3626,10 +3626,10 @@ static void bulk_data_param_t subframe_bulkdata; u8 *dot11_hdr_ptr = (u8*)bulkdata->d[0].os_data_ptr; CsrResult csrResult; - CsrUint16 frameControl; + u16 frameControl; u8 *qos_control_ptr; - frameControl = le16_to_cpu(*((CsrUint16*)dot11_hdr_ptr)); + frameControl = le16_to_cpu(*((u16*)dot11_hdr_ptr)); qos_control_ptr = dot11_hdr_ptr + (((frameControl & IEEE802_11_FC_TO_DS_MASK) && (frameControl & IEEE802_11_FC_FROM_DS_MASK))?30: 24); if(!(*qos_control_ptr & IEEE802_11_QC_A_MSDU_PRESENT)) { unifi_trace(priv, UDBG6, "%s: calling unifi_rx()", __FUNCTION__); @@ -3712,10 +3712,10 @@ static void add_frame_to_ba_complete(unifi_priv_t *priv, static void update_expected_sn(unifi_priv_t *priv, netInterface_priv_t *interfacePriv, ba_session_rx_struct *ba_session, - CsrUint16 sn) + u16 sn) { int i, j; - CsrUint16 gap; + u16 gap; gap = (sn - ba_session->expected_sn) & 0xFFF; unifi_trace(priv, UDBG6, "%s: proccess the frames up to new_expected_sn = %d gap = %d\n", __FUNCTION__, sn, gap); @@ -3754,7 +3754,7 @@ static void complete_ready_sequence(unifi_priv_t *priv, void scroll_ba_window(unifi_priv_t *priv, netInterface_priv_t *interfacePriv, ba_session_rx_struct *ba_session, - CsrUint16 sn) + u16 sn) { if(((sn - ba_session->expected_sn) & 0xFFF) <= 2048) { update_expected_sn(priv, interfacePriv, ba_session, sn); @@ -3766,10 +3766,10 @@ void scroll_ba_window(unifi_priv_t *priv, static int consume_frame_or_get_buffer_index(unifi_priv_t *priv, netInterface_priv_t *interfacePriv, ba_session_rx_struct *ba_session, - CsrUint16 sn, + u16 sn, frame_desc_struct *frame_desc) { int i; - CsrUint16 sn_temp; + u16 sn_temp; if(((sn - ba_session->expected_sn) & 0xFFF) <= 2048) { @@ -3781,7 +3781,7 @@ static int consume_frame_or_get_buffer_index(unifi_priv_t *priv, sn_temp = ba_session->expected_sn + ba_session->wind_size; unifi_trace(priv, UDBG6, "%s: new frame: sn=%d\n", __FUNCTION__, sn); if(!(((sn - sn_temp) & 0xFFF) > 2048)) { - CsrUint16 new_expected_sn; + u16 new_expected_sn; unifi_trace(priv, UDBG6, "%s: frame is out of window\n", __FUNCTION__); sn_temp = (sn - ba_session->wind_size) & 0xFFF; new_expected_sn = (sn_temp + 1) & 0xFFF; @@ -3822,7 +3822,7 @@ static void process_ba_frame(unifi_priv_t *priv, frame_desc_struct *frame_desc) { int i; - CsrUint16 sn = frame_desc->sn; + u16 sn = frame_desc->sn; if (ba_session->timeout) { mod_timer(&ba_session->timer, (jiffies + usecs_to_jiffies((ba_session->timeout) * 1024))); @@ -3868,7 +3868,7 @@ static void check_ba_frame_age_timeout( unifi_priv_t *priv, CsrTime now; CsrTime age; u8 i, j; - CsrUint16 sn_temp; + u16 sn_temp; /* gap is started at 1 because we have buffered frames and * hence a minimum gap of 1 exists @@ -3941,7 +3941,7 @@ static void check_ba_frame_age_timeout( unifi_priv_t *priv, static void process_ma_packet_error_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata) { - CsrUint16 interfaceTag; + u16 interfaceTag; const CSR_MA_PACKET_ERROR_INDICATION *pkt_err_ind = &signal->u.MaPacketErrorIndication; netInterface_priv_t *interfacePriv; ba_session_rx_struct *ba_session; diff --git a/drivers/staging/csr/os.c b/drivers/staging/csr/os.c index f5a9352..35dc908 100644 --- a/drivers/staging/csr/os.c +++ b/drivers/staging/csr/os.c @@ -370,7 +370,7 @@ unifi_trace_nop(void* ospriv, int level, const char *fmt, ...) /* Memory dump with level filter controlled by unifi_debug */ void -unifi_dump(void *ospriv, int level, const char *msg, void *mem, CsrUint16 len) +unifi_dump(void *ospriv, int level, const char *msg, void *mem, u16 len) { unifi_priv_t *priv = (unifi_priv_t*) ospriv; @@ -400,7 +400,7 @@ unifi_dump(void *ospriv, int level, const char *msg, void *mem, CsrUint16 len) /* Memory dump that appears all the time, use sparingly */ void -dump(void *mem, CsrUint16 len) +dump(void *mem, u16 len) { int i, col = 0; unsigned char *pdata = (unsigned char *)mem; @@ -430,7 +430,7 @@ dump(void *mem, CsrUint16 len) void -dump16(void *mem, CsrUint16 len) +dump16(void *mem, u16 len) { int i, col=0; unsigned short *p = (unsigned short *)mem; @@ -457,7 +457,7 @@ dump16(void *mem, CsrUint16 len) #ifdef CSR_WIFI_HIP_DEBUG_OFFLINE void -dump_str(void *mem, CsrUint16 len) +dump_str(void *mem, u16 len) { int i, col = 0; unsigned char *pdata = (unsigned char *)mem; diff --git a/drivers/staging/csr/putest.c b/drivers/staging/csr/putest.c index 676c8f6..9c9dc60 100644 --- a/drivers/staging/csr/putest.c +++ b/drivers/staging/csr/putest.c @@ -545,7 +545,7 @@ free_fw: int unifi_putest_coredump_prepare(unifi_priv_t *priv, unsigned char *arg) { - CsrUint16 data_u16; + u16 data_u16; CsrInt32 i; CsrResult r; diff --git a/drivers/staging/csr/sdio_mmc.c b/drivers/staging/csr/sdio_mmc.c index f95a57f..8dc91bf 100644 --- a/drivers/staging/csr/sdio_mmc.c +++ b/drivers/staging/csr/sdio_mmc.c @@ -180,7 +180,7 @@ CsrSdioWrite8(CsrSdioFunction *function, CsrUint32 address, u8 data) } /* CsrSdioWrite8() */ CsrResult -CsrSdioRead16(CsrSdioFunction *function, CsrUint32 address, CsrUint16 *data) +CsrSdioRead16(CsrSdioFunction *function, CsrUint32 address, u16 *data) { struct sdio_func *func = (struct sdio_func *)function->priv; int err; @@ -207,7 +207,7 @@ CsrSdioRead16(CsrSdioFunction *function, CsrUint32 address, CsrUint16 *data) CsrResult -CsrSdioWrite16(CsrSdioFunction *function, CsrUint32 address, CsrUint16 data) +CsrSdioWrite16(CsrSdioFunction *function, CsrUint32 address, u16 data) { struct sdio_func *func = (struct sdio_func *)function->priv; int err; @@ -716,7 +716,7 @@ sdio_set_block_size_ignore_first_error(struct sdio_func *func, unsigned blksz) } CsrResult -CsrSdioBlockSizeSet(CsrSdioFunction *function, CsrUint16 blockSize) +CsrSdioBlockSizeSet(CsrSdioFunction *function, u16 blockSize) { struct sdio_func *func = (struct sdio_func *)function->priv; int r = 0; diff --git a/drivers/staging/csr/sdio_stubs.c b/drivers/staging/csr/sdio_stubs.c index bc6a369..839fae0 100644 --- a/drivers/staging/csr/sdio_stubs.c +++ b/drivers/staging/csr/sdio_stubs.c @@ -38,7 +38,7 @@ CsrResult __attribute__((weak)) CsrSdioHardReset(CsrSdioFunction *function) } CsrResult __attribute__((weak)) CsrSdioBlockSizeSet(CsrSdioFunction *function, - CsrUint16 blockSize) + u16 blockSize) { return CSR_RESULT_SUCCESS; } diff --git a/drivers/staging/csr/sme_blocking.c b/drivers/staging/csr/sme_blocking.c index 8461bac..c95f1b3 100644 --- a/drivers/staging/csr/sme_blocking.c +++ b/drivers/staging/csr/sme_blocking.c @@ -222,7 +222,7 @@ _sme_wait_for_reply(unifi_priv_t *priv, #ifdef CSR_SUPPORT_WEXT int sme_mgt_wifi_on(unifi_priv_t *priv) { - CsrUint16 numElements; + u16 numElements; CsrWifiSmeDataBlock* dataList; #ifdef CSR_SUPPORT_WEXT_AP int r; @@ -350,7 +350,7 @@ int sme_mgt_scan_full(unifi_priv_t *priv, is_active, CSR_WIFI_SME_BSS_TYPE_ANY_BSS, CSR_WIFI_SME_SCAN_TYPE_ALL, - (CsrUint16)num_channels, channel_list, + (u16)num_channels, channel_list, 0, NULL); r = sme_wait_for_reply(priv, UNIFI_SME_MGT_LONG_TIMEOUT); @@ -372,7 +372,7 @@ int sme_mgt_scan_results_get_async(unifi_priv_t *priv, char *scan_results, long scan_results_len) { - CsrUint16 scan_result_list_count; + u16 scan_result_list_count; CsrWifiSmeScanResult *scan_result_list; CsrWifiSmeScanResult *scan_result; int r; @@ -1443,7 +1443,7 @@ int sme_sys_resume(unifi_priv_t *priv) } #ifdef CSR_SUPPORT_WEXT_AP -int sme_ap_stop(unifi_priv_t *priv,CsrUint16 interface_tag) +int sme_ap_stop(unifi_priv_t *priv,u16 interface_tag) { int r; @@ -1471,7 +1471,7 @@ int sme_ap_stop(unifi_priv_t *priv,CsrUint16 interface_tag) } -int sme_ap_start(unifi_priv_t *priv,CsrUint16 interface_tag, +int sme_ap_start(unifi_priv_t *priv,u16 interface_tag, CsrWifiSmeApConfig_t * ap_config) { int r; diff --git a/drivers/staging/csr/sme_native.c b/drivers/staging/csr/sme_native.c index 2091109..2e63db2 100644 --- a/drivers/staging/csr/sme_native.c +++ b/drivers/staging/csr/sme_native.c @@ -249,7 +249,7 @@ sme_native_log_event(ul_client_t *pcli, if (r == 0) { signal_len = SigGetSize(&signal); } else { - CsrUint16 receiver_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sig_packed) + sizeof(CsrUint16)) & 0xFF00; + u16 receiver_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sig_packed) + sizeof(u16)) & 0xFF00; /* The control indications are 1 byte, pass them to client. */ if (sig_len == 1) { diff --git a/drivers/staging/csr/sme_sys.c b/drivers/staging/csr/sme_sys.c index e28e7c8..c3d9c6a 100644 --- a/drivers/staging/csr/sme_sys.c +++ b/drivers/staging/csr/sme_sys.c @@ -64,7 +64,7 @@ void send_auto_ma_packet_confirm(unifi_priv_t *priv, CSR_SIGNAL unpacked_signal; u8 sigbuf[UNIFI_PACKED_SIGBUF_SIZE]; - CsrUint16 packed_siglen; + u16 packed_siglen; list_for_each_safe(listHead, placeHolder, buffered_frames_list) @@ -279,7 +279,7 @@ void CsrWifiRouterCtrlHipReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) void *dest; CsrResult csrResult; CSR_SIGNAL *signal; - CsrUint16 interfaceTag = 0; + u16 interfaceTag = 0; CSR_MA_PACKET_REQUEST *req; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; @@ -301,7 +301,7 @@ void CsrWifiRouterCtrlHipReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) signal = (CSR_SIGNAL *)hipreq->mlmeCommand; unifi_trace(priv, UDBG4, "CsrWifiRouterCtrlHipReqHandler: 0x04%X ---->\n", - *((CsrUint16*)hipreq->mlmeCommand)); + *((u16*)hipreq->mlmeCommand)); /* Construct the signal. */ signal_ptr = (u8*)hipreq->mlmeCommand; @@ -348,7 +348,7 @@ void CsrWifiRouterCtrlHipReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) } unifi_trace(priv, UDBG3, "SME SEND: Signal 0x%.4X \n", - *((CsrUint16*)signal_ptr)); + *((u16*)signal_ptr)); if (signal->SignalPrimitiveHeader.SignalId == CSR_MA_PACKET_REQUEST_ID) { CSR_SIGNAL unpacked_signal; @@ -387,7 +387,7 @@ void CsrWifiRouterCtrlHipReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) if (r) { unifi_error(priv, "CsrWifiRouterCtrlHipReqHandler: Failed to send signal (0x%.4X - %u)\n", - *((CsrUint16*)signal_ptr), r); + *((u16*)signal_ptr), r); CsrWifiRouterCtrlWifiOffIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,0,CSR_WIFI_SME_CONTROL_INDICATION_ERROR); } @@ -396,7 +396,7 @@ void CsrWifiRouterCtrlHipReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) #ifdef CSR_WIFI_SEND_GRATUITOUS_ARP static void -uf_send_gratuitous_arp(unifi_priv_t *priv, CsrUint16 interfaceTag) +uf_send_gratuitous_arp(unifi_priv_t *priv, u16 interfaceTag) { netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; CSR_PRIORITY priority; @@ -504,7 +504,7 @@ configure_data_port(unifi_priv_t *priv, CsrWifiRouterCtrlPortAction port_action, const CsrWifiMacAddress *macAddress, const int queue, - CsrUint16 interfaceTag) + u16 interfaceTag) { const u8 broadcast_mac_address[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; unifi_port_config_t *port; @@ -1354,7 +1354,7 @@ void CsrWifiRouterCtrlTrafficClassificationReqHandler(void* drvpriv, CsrWifiFsmE static int _sys_packet_req(unifi_priv_t *priv, const CSR_SIGNAL *signal, u8 subscriptionHandle, - CsrUint16 frameLength, u8 *frame, + u16 frameLength, u8 *frame, int proto) { int r; @@ -1364,7 +1364,7 @@ _sys_packet_req(unifi_priv_t *priv, const CSR_SIGNAL *signal, struct sk_buff *skb, *newSkb = NULL; CsrWifiMacAddress peerMacAddress; CsrResult csrResult; - CsrUint16 interfaceTag = req.VirtualInterfaceIdentifier & 0xff; + u16 interfaceTag = req.VirtualInterfaceIdentifier & 0xff; CsrBool eapolStore = FALSE; s8 protection = 0; netInterface_priv_t *interfacePriv; @@ -1498,12 +1498,12 @@ void CsrWifiRouterMaPacketReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) unifi_priv_t *priv = (unifi_priv_t*)drvpriv; CsrWifiRouterMaPacketReq* mareq = (CsrWifiRouterMaPacketReq*)msg; llc_snap_hdr_t *snap; - CsrUint16 snap_protocol; + u16 snap_protocol; CSR_SIGNAL signal; CSR_MA_PACKET_REQUEST *req = &signal.u.MaPacketRequest; CsrWifiRouterCtrlPortAction controlPortaction; u8 *daddr, *saddr; - CsrUint16 interfaceTag = mareq->interfaceTag & 0x00ff; + u16 interfaceTag = mareq->interfaceTag & 0x00ff; int queue; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; @@ -1638,7 +1638,7 @@ void CsrWifiRouterCtrlM4TransmitReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) } /* reset the station records when the mode is set as CSR_WIFI_ROUTER_CTRL_MODE_NONE */ -static void CsrWifiRouterCtrlResetStationRecordList(unifi_priv_t *priv, CsrUint16 interfaceTag) +static void CsrWifiRouterCtrlResetStationRecordList(unifi_priv_t *priv, u16 interfaceTag) { u8 i,j; CsrWifiRouterCtrlStaInfo_t *staInfo=NULL; @@ -1723,7 +1723,7 @@ static void CsrWifiRouterCtrlResetStationRecordList(unifi_priv_t *priv, CsrUint1 } } -void CsrWifiRouterCtrlInterfaceReset(unifi_priv_t *priv, CsrUint16 interfaceTag) +void CsrWifiRouterCtrlInterfaceReset(unifi_priv_t *priv, u16 interfaceTag) { netInterface_priv_t *interfacePriv; @@ -2409,7 +2409,7 @@ void uf_send_disconnected_ind_wq(struct work_struct *work) CsrWifiRouterCtrlStaInfo_t *staInfo = container_of(work, CsrWifiRouterCtrlStaInfo_t, send_disconnected_ind_task); unifi_priv_t *priv; - CsrUint16 interfaceTag; + u16 interfaceTag; struct list_head send_cfm_list; u8 j; @@ -2611,9 +2611,9 @@ static void ba_session_terminate_timer_func(unsigned long data) CsrBool blockack_session_stop(unifi_priv_t *priv, - CsrUint16 interfaceTag, + u16 interfaceTag, CsrWifiRouterCtrlBlockAckRole role, - CsrUint16 tID, + u16 tID, CsrWifiMacAddress macAddress) { netInterface_priv_t *interfacePriv; @@ -2731,12 +2731,12 @@ void CsrWifiRouterCtrlBlockAckDisableReqHandler(void* drvpriv, CsrWifiFsmEvent* CsrBool blockack_session_start(unifi_priv_t *priv, - CsrUint16 interfaceTag, - CsrUint16 tID, - CsrUint16 timeout, + u16 interfaceTag, + u16 tID, + u16 timeout, CsrWifiRouterCtrlBlockAckRole role, - CsrUint16 wind_size, - CsrUint16 start_sn, + u16 wind_size, + u16 start_sn, CsrWifiMacAddress macAddress ) { diff --git a/drivers/staging/csr/sme_userspace.c b/drivers/staging/csr/sme_userspace.c index fc2506e..b4a0009 100644 --- a/drivers/staging/csr/sme_userspace.c +++ b/drivers/staging/csr/sme_userspace.c @@ -223,7 +223,7 @@ unifi_ta_indicate_protocol(void *ospriv, if (CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_RX == direction) { - CsrUint16 interfaceTag = 0; + u16 interfaceTag = 0; CsrWifiRouterCtrlTrafficProtocolIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,0, interfaceTag, packet_type, diff --git a/drivers/staging/csr/sme_wext.c b/drivers/staging/csr/sme_wext.c index 64e2939e..51c19bb 100644 --- a/drivers/staging/csr/sme_wext.c +++ b/drivers/staging/csr/sme_wext.c @@ -727,7 +727,7 @@ iwprivsapstop(struct net_device *dev, struct iw_request_info *info, netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); unifi_priv_t *priv = interfacePriv->privPtr; int r; - CsrUint16 interface_tag = interfacePriv->InterfaceTag; + u16 interface_tag = interfacePriv->InterfaceTag; unifi_trace(priv, UDBG1, "iwprivsapstop\n" ); r = sme_ap_stop(priv,interface_tag); @@ -766,7 +766,7 @@ iwprivsstackstop(struct net_device *dev, struct iw_request_info *info, netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); unifi_priv_t *priv = interfacePriv->privPtr; int r = 0; - CsrUint16 interface_tag = interfacePriv->InterfaceTag; + u16 interface_tag = interfacePriv->InterfaceTag; unifi_trace(priv, UDBG1, "iwprivsstackstop\n" ); diff --git a/drivers/staging/csr/ul_int.c b/drivers/staging/csr/ul_int.c index 3135468..325218f 100644 --- a/drivers/staging/csr/ul_int.c +++ b/drivers/staging/csr/ul_int.c @@ -418,7 +418,7 @@ ul_send_signal_unpacked(unifi_priv_t *priv, CSR_SIGNAL *sigptr, bulk_data_param_t *bulkdata) { u8 sigbuf[UNIFI_PACKED_SIGBUF_SIZE]; - CsrUint16 packed_siglen; + u16 packed_siglen; CsrResult csrResult; unsigned long lock_flags; int r; diff --git a/drivers/staging/csr/unifi_clients.h b/drivers/staging/csr/unifi_clients.h index ca105e5..418cb4d9 100644 --- a/drivers/staging/csr/unifi_clients.h +++ b/drivers/staging/csr/unifi_clients.h @@ -98,7 +98,7 @@ struct ul_client { CSR_SIGNAL* reply_signal; bulk_data_t* reply_bulkdata[UNIFI_MAX_DATA_REFERENCES]; - CsrUint16 signal_filter[SIG_FILTER_SIZE]; + u16 signal_filter[SIG_FILTER_SIZE]; /* ------------------------------------------------------------------- */ diff --git a/drivers/staging/csr/unifi_event.c b/drivers/staging/csr/unifi_event.c index bbc1564..c2ef2ee 100644 --- a/drivers/staging/csr/unifi_event.c +++ b/drivers/staging/csr/unifi_event.c @@ -97,7 +97,7 @@ static CsrBool check_routing_pkt_data_ind(unifi_priv_t *priv, CsrBool *freeBulkData, netInterface_priv_t *interfacePriv) { - CsrUint16 frmCtrl, receptionStatus, frmCtrlSubType; + u16 frmCtrl, receptionStatus, frmCtrlSubType; u8 *macHdrLocation; u8 interfaceTag; CsrBool isDataFrame; @@ -112,7 +112,7 @@ static CsrBool check_routing_pkt_data_ind(unifi_priv_t *priv, CsrBool isWapiUnicastPkt = FALSE; #ifdef CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND - CsrUint16 qosControl; + u16 qosControl; #endif u8 llcSnapHeaderOffset = 0; @@ -467,7 +467,7 @@ unifi_process_receive_event(void *ospriv, #define CSR_MA_PACKET_INDICATION_RECEPTION_STATUS_OFFSET sizeof(CSR_SIGNAL_PRIMITIVE_HEADER) + 22 netInterface_priv_t *interfacePriv; u8 interfaceTag; - CsrUint16 receptionStatus = CSR_RX_SUCCESS; + u16 receptionStatus = CSR_RX_SUCCESS; /* Pull out interface tag from virtual interface identifier */ interfaceTag = (CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata + CSR_MA_PACKET_INDICATION_INTERFACETAG_OFFSET)) & 0xff; @@ -489,7 +489,7 @@ unifi_process_receive_event(void *ospriv, CSR_SIGNAL signal; u8 *destAddr; CsrResult res; - CsrUint16 interfaceTag = 0; + u16 interfaceTag = 0; CsrBool isMcastPkt = TRUE; unifi_trace(priv, UDBG6, "Received a WAPI data packet when the Unicast/Multicast filter is set\n"); diff --git a/drivers/staging/csr/unifi_os.h b/drivers/staging/csr/unifi_os.h index 0a97494..4e63a94 100644 --- a/drivers/staging/csr/unifi_os.h +++ b/drivers/staging/csr/unifi_os.h @@ -90,11 +90,11 @@ extern int unifi_debug; } while (0) -void unifi_dump(void *ospriv, int lvl, const char *msg, void *mem, CsrUint16 len); -void dump(void *mem, CsrUint16 len); -void dump16(void *mem, CsrUint16 len); +void unifi_dump(void *ospriv, int lvl, const char *msg, void *mem, u16 len); +void dump(void *mem, u16 len); +void dump16(void *mem, u16 len); #ifdef CSR_WIFI_HIP_DEBUG_OFFLINE -void dump_str(void *mem, CsrUint16 len); +void dump_str(void *mem, u16 len); #endif /* CSR_WIFI_HIP_DEBUG_OFFLINE */ void unifi_error(void* ospriv, const char *fmt, ...); @@ -113,11 +113,11 @@ void unifi_trace(void* ospriv, int level, const char *fmt, ...); #define ASSERT(cond) -static inline void unifi_dump(void *ospriv, int lvl, const char *msg, void *mem, CsrUint16 len) {} -static inline void dump(void *mem, CsrUint16 len) {} -static inline void dump16(void *mem, CsrUint16 len) {} +static inline void unifi_dump(void *ospriv, int lvl, const char *msg, void *mem, u16 len) {} +static inline void dump(void *mem, u16 len) {} +static inline void dump16(void *mem, u16 len) {} #ifdef CSR_WIFI_HIP_DEBUG_OFFLINE -static inline void dump_str(void *mem, CsrUint16 len) {} +static inline void dump_str(void *mem, u16 len) {} #endif /* CSR_WIFI_HIP_DEBUG_OFFLINE */ void unifi_error_nop(void* ospriv, const char *fmt, ...); diff --git a/drivers/staging/csr/unifi_pdu_processing.c b/drivers/staging/csr/unifi_pdu_processing.c index a007a59..51ce5e4 100644 --- a/drivers/staging/csr/unifi_pdu_processing.c +++ b/drivers/staging/csr/unifi_pdu_processing.c @@ -55,7 +55,7 @@ static void _update_buffered_pkt_params_after_alignment(unifi_priv_t *priv, bulk void unifi_frame_ma_packet_req(unifi_priv_t *priv, CSR_PRIORITY priority, CSR_RATE TransmitRate, CSR_CLIENT_TAG hostTag, - CsrUint16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl, + u16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl, CSR_PROCESS_ID leSenderProcessId, u8 *peerMacAddress, CSR_SIGNAL *signal) { @@ -137,7 +137,7 @@ int frame_and_send_queued_pdu(unifi_priv_t* priv,tx_buffered_packets_t* buffered int result; u8 toDs, fromDs, macHeaderLengthInBytes = MAC_HEADER_SIZE; u8 *qc; - CsrUint16 *fc = (CsrUint16*)(buffered_pkt->bulkdata.os_data_ptr); + u16 *fc = (u16*)(buffered_pkt->bulkdata.os_data_ptr); unsigned long lock_flags; unifi_trace(priv, UDBG3, "frame_and_send_queued_pdu with moreData: %d , EOSP: %d\n",moreData,eosp); unifi_frame_ma_packet_req(priv, buffered_pkt->priority, buffered_pkt->rate, buffered_pkt->hostTag, @@ -449,7 +449,7 @@ CsrResult enque_tx_data_pdu(unifi_priv_t *priv, bulk_data_param_t *bulkdata, #ifdef CSR_WIFI_REQUEUE_PACKET_TO_HAL CsrResult unifi_reque_ma_packet_request (void *ospriv, CsrUint32 host_tag, - CsrUint16 txStatus, bulk_data_desc_t *bulkDataDesc) + u16 txStatus, bulk_data_desc_t *bulkDataDesc) { CsrResult status = CSR_RESULT_SUCCESS; unifi_priv_t *priv = (unifi_priv_t*)ospriv; @@ -459,9 +459,9 @@ CsrResult unifi_reque_ma_packet_request (void *ospriv, CsrUint32 host_tag, bulk_data_param_t bulkData; CSR_SIGNAL signal; CSR_PRIORITY priority = 0; - CsrUint16 interfaceTag = 0; + u16 interfaceTag = 0; unifi_TrafficQueue priority_q; - CsrUint16 frameControl = 0, frameType = 0; + u16 frameControl = 0, frameType = 0; unsigned long lock_flags; interfacePriv = priv->interfacePriv[interfaceTag]; @@ -531,7 +531,7 @@ CsrResult unifi_reque_ma_packet_request (void *ospriv, CsrUint32 host_tag, /* Extract the Packet priority */ if (TRUE == staRecord->wmmOrQosEnabled) { - CsrUint16 qosControl = 0; + u16 qosControl = 0; u8 dataFrameType = 0; dataFrameType =((frameControl & IEEE80211_FC_SUBTYPE_MASK) >> 4); @@ -635,15 +635,15 @@ static void is_all_ac_deliver_enabled_and_moredata(CsrWifiRouterCtrlStaInfo_t *s * * --------------------------------------------------------------------------- */ -void uf_handle_tim_cfm(unifi_priv_t *priv, CSR_MLME_SET_TIM_CONFIRM *cfm, CsrUint16 receiverProcessId) +void uf_handle_tim_cfm(unifi_priv_t *priv, CSR_MLME_SET_TIM_CONFIRM *cfm, u16 receiverProcessId) { u8 handle = CSR_WIFI_GET_STATION_HANDLE_FROM_RECEIVER_ID(receiverProcessId); u8 timSetStatus = CSR_WIFI_GET_TIMSET_STATE_FROM_RECEIVER_ID(receiverProcessId); - CsrUint16 interfaceTag = (cfm->VirtualInterfaceIdentifier & 0xff); + u16 interfaceTag = (cfm->VirtualInterfaceIdentifier & 0xff); netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; CsrWifiRouterCtrlStaInfo_t *staRecord = NULL; /* This variable holds what TIM value we wanted to set in firmware */ - CsrUint16 timSetValue = 0; + u16 timSetValue = 0; /* Irrespective of interface the count maintained */ static u8 retryCount = 0; unsigned long lock_flags; @@ -859,7 +859,7 @@ void uf_handle_tim_cfm(unifi_priv_t *priv, CSR_MLME_SET_TIM_CONFIRM *cfm, CsrUin * * --------------------------------------------------------------------------- */ -void update_tim(unifi_priv_t * priv, CsrUint16 aid, u8 setTim, CsrUint16 interfaceTag, CsrUint32 handle) +void update_tim(unifi_priv_t * priv, u16 aid, u8 setTim, u16 interfaceTag, CsrUint32 handle) { CSR_SIGNAL signal; CsrInt32 r; @@ -956,7 +956,7 @@ void update_tim(unifi_priv_t * priv, CsrUint16 aid, u8 setTim, CsrUint16 interfa static void process_peer_active_transition(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t *staRecord, - CsrUint16 interfaceTag) + u16 interfaceTag) { int r,i; CsrBool spaceAvail[4] = {TRUE,TRUE,TRUE,TRUE}; @@ -1072,7 +1072,7 @@ void process_peer_active_transition(unifi_priv_t * priv, -void uf_process_ma_pkt_cfm_for_ap(unifi_priv_t *priv,CsrUint16 interfaceTag, const CSR_MA_PACKET_CONFIRM *pkt_cfm) +void uf_process_ma_pkt_cfm_for_ap(unifi_priv_t *priv,u16 interfaceTag, const CSR_MA_PACKET_CONFIRM *pkt_cfm) { netInterface_priv_t *interfacePriv; u8 i; @@ -1201,7 +1201,7 @@ void uf_process_ma_pkt_cfm_for_ap(unifi_priv_t *priv,CsrUint16 interfaceTag, con } #endif -CsrUint16 uf_get_vif_identifier (CsrWifiRouterCtrlMode mode, CsrUint16 tag) +u16 uf_get_vif_identifier (CsrWifiRouterCtrlMode mode, u16 tag) { switch(mode) { @@ -1255,12 +1255,12 @@ CsrUint16 uf_get_vif_identifier (CsrWifiRouterCtrlMode mode, CsrUint16 tag) static int update_macheader(unifi_priv_t *priv, struct sk_buff *skb, struct sk_buff *newSkb, CSR_PRIORITY *priority, - bulk_data_param_t *bulkdata, CsrUint16 interfaceTag, + bulk_data_param_t *bulkdata, u16 interfaceTag, u8 macHeaderLengthInBytes, u8 qosDestination) { - CsrUint16 *fc = NULL; + u16 *fc = NULL; u8 direction = 0, toDs, fromDs; u8 *bufPtr = NULL; u8 sa[ETH_ALEN], da[ETH_ALEN]; @@ -1280,7 +1280,7 @@ static int update_macheader(unifi_priv_t *priv, struct sk_buff *skb, headroom = skb_headroom(skb); /* pointer to frame control field */ - fc = (CsrUint16*) macHeaderBuf; + fc = (u16*) macHeaderBuf; toDs = (*fc & cpu_to_le16(IEEE802_11_FC_TO_DS_MASK))?1 : 0; fromDs = (*fc & cpu_to_le16(IEEE802_11_FC_FROM_DS_MASK))? 1: 0; @@ -1510,7 +1510,7 @@ uf_ap_process_data_pdu(unifi_priv_t *priv, struct sk_buff *skb, u8 macHeaderLengthInBytes) { const CSR_MA_PACKET_INDICATION *ind = &(signal->u.MaPacketIndication); - CsrUint16 interfaceTag = (ind->VirtualInterfaceIdentifier & 0x00ff); + u16 interfaceTag = (ind->VirtualInterfaceIdentifier & 0x00ff); struct sk_buff *newSkb = NULL; /* pointer to skb or private skb created using skb_copy() */ struct sk_buff *skbPtr = skb; @@ -1645,7 +1645,7 @@ uf_ap_process_data_pdu(unifi_priv_t *priv, struct sk_buff *skb, CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, u8 *peerMacAddress, CSR_CLIENT_TAG hostTag, - CsrUint16 interfaceTag, + u16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl, CSR_RATE TransmitRate, CSR_PRIORITY priority, @@ -1662,7 +1662,7 @@ CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, int frameType = 0; CsrBool queuePacketDozing = FALSE; CsrUint32 priority_q; - CsrUint16 frmCtrl; + u16 frmCtrl; struct list_head * list = NULL; /* List to which buffered PDUs are to be enqueued*/ CsrBool setBcTim=FALSE; netInterface_priv_t *interfacePriv; @@ -1976,7 +1976,7 @@ CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, } #ifdef CSR_SUPPORT_SME -s8 uf_get_protection_bit_from_interfacemode(unifi_priv_t *priv, CsrUint16 interfaceTag, const u8 *daddr) +s8 uf_get_protection_bit_from_interfacemode(unifi_priv_t *priv, u16 interfaceTag, const u8 *daddr) { s8 protection = 0; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; @@ -2017,7 +2017,7 @@ s8 uf_get_protection_bit_from_interfacemode(unifi_priv_t *priv, CsrUint16 interf } #endif #ifdef CSR_SUPPORT_SME -u8 send_multicast_frames(unifi_priv_t *priv, CsrUint16 interfaceTag) +u8 send_multicast_frames(unifi_priv_t *priv, u16 interfaceTag) { int r; tx_buffered_packets_t * buffered_pkt = NULL; @@ -2122,7 +2122,7 @@ void uf_process_ma_vif_availibility_ind(unifi_priv_t *priv,u8 *sigdata, CSR_SIGNAL signal; CSR_MA_VIF_AVAILABILITY_INDICATION *ind; int r; - CsrUint16 interfaceTag; + u16 interfaceTag; u8 pduSent =0; CSR_RESULT_CODE resultCode = CSR_RC_SUCCESS; netInterface_priv_t *interfacePriv; @@ -2130,7 +2130,7 @@ void uf_process_ma_vif_availibility_ind(unifi_priv_t *priv,u8 *sigdata, func_enter(); unifi_trace(priv, UDBG3, "uf_process_ma_vif_availibility_ind: Process signal 0x%.4X\n", - *((CsrUint16*)sigdata)); + *((u16*)sigdata)); r = read_unpack_signal(sigdata, &signal); if (r) { @@ -2265,7 +2265,7 @@ void uf_send_buffered_data_from_delivery_ac(unifi_priv_t *priv, struct list_head *txList) { - CsrUint16 interfaceTag = GET_ACTIVE_INTERFACE_TAG(priv); + u16 interfaceTag = GET_ACTIVE_INTERFACE_TAG(priv); tx_buffered_packets_t * buffered_pkt = NULL; unsigned long lock_flags; CsrBool eosp=FALSE; @@ -2408,7 +2408,7 @@ void uf_send_buffered_data_from_ac(unifi_priv_t *priv, void uf_send_buffered_frames(unifi_priv_t *priv,unifi_TrafficQueue q) { - CsrUint16 interfaceTag = GET_ACTIVE_INTERFACE_TAG(priv); + u16 interfaceTag = GET_ACTIVE_INTERFACE_TAG(priv); CsrUint32 startIndex=0,endIndex=0; CsrWifiRouterCtrlStaInfo_t * staInfo = NULL; u8 queue; @@ -2576,7 +2576,7 @@ CsrBool uf_is_more_data_for_non_delivery_ac(CsrWifiRouterCtrlStaInfo_t *staRecor } -int uf_process_station_records_for_sending_data(unifi_priv_t *priv,CsrUint16 interfaceTag, +int uf_process_station_records_for_sending_data(unifi_priv_t *priv,u16 interfaceTag, CsrWifiRouterCtrlStaInfo_t *srcStaInfo, CsrWifiRouterCtrlStaInfo_t *dstStaInfo) { @@ -2636,7 +2636,7 @@ int uf_process_station_records_for_sending_data(unifi_priv_t *priv,CsrUint16 int * interfaceTag virtual interface tag * --------------------------------------------------------------------------- */ -static void uf_handle_uspframes_delivery(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t *staInfo, CsrUint16 interfaceTag) +static void uf_handle_uspframes_delivery(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t *staInfo, u16 interfaceTag) { s8 i; @@ -2733,8 +2733,8 @@ static void uf_handle_uspframes_delivery(unifi_priv_t * priv, CsrWifiRouterCtrlS void uf_process_wmm_deliver_ac_uapsd(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t * srcStaInfo, - CsrUint16 qosControl, - CsrUint16 interfaceTag) + u16 qosControl, + u16 interfaceTag) { CSR_PRIORITY priority; unifi_TrafficQueue priority_q; @@ -2759,7 +2759,7 @@ void uf_process_wmm_deliver_ac_uapsd(unifi_priv_t * priv, } -void uf_send_qos_null(unifi_priv_t * priv,CsrUint16 interfaceTag, const u8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo) +void uf_send_qos_null(unifi_priv_t * priv,u16 interfaceTag, const u8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo) { bulk_data_param_t bulkdata; CsrResult csrResult; @@ -2830,7 +2830,7 @@ void uf_send_qos_null(unifi_priv_t * priv,CsrUint16 interfaceTag, const u8 *da,C return; } -void uf_send_nulldata(unifi_priv_t * priv,CsrUint16 interfaceTag, const u8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo) +void uf_send_nulldata(unifi_priv_t * priv,u16 interfaceTag, const u8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo) { bulk_data_param_t bulkdata; CsrResult csrResult; @@ -2958,7 +2958,7 @@ CsrBool uf_check_broadcast_bssid(unifi_priv_t *priv, const bulk_data_param_t *bu CsrBool uf_process_pm_bit_for_peer(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t * srcStaInfo, - u8 pmBit,CsrUint16 interfaceTag) + u8 pmBit,u16 interfaceTag) { CsrBool moreData = FALSE; CsrBool powerSaveChanged = FALSE; @@ -3052,7 +3052,7 @@ CsrBool uf_process_pm_bit_for_peer(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo -void uf_process_ps_poll(unifi_priv_t *priv,u8* sa,u8* da,u8 pmBit,CsrUint16 interfaceTag) +void uf_process_ps_poll(unifi_priv_t *priv,u8* sa,u8* da,u8 pmBit,u16 interfaceTag) { CsrWifiRouterCtrlStaInfo_t *staRecord = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, sa, interfaceTag); @@ -3448,7 +3448,7 @@ tx_buffered_packets_t *dequeue_tx_data_pdu(unifi_priv_t *priv, struct list_head /* generic function to get the station record handler */ CsrWifiRouterCtrlStaInfo_t *CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(unifi_priv_t *priv, const u8 *peerMacAddress, - CsrUint16 interfaceTag) + u16 interfaceTag) { u8 i; netInterface_priv_t *interfacePriv; @@ -3482,7 +3482,7 @@ CsrWifiRouterCtrlStaInfo_t *CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress( /* generic function to get the station record handler from the handle */ CsrWifiRouterCtrlStaInfo_t * CsrWifiRouterCtrlGetStationRecordFromHandle(unifi_priv_t *priv, CsrUint32 handle, - CsrUint16 interfaceTag) + u16 interfaceTag) { netInterface_priv_t *interfacePriv; @@ -3495,7 +3495,7 @@ CsrWifiRouterCtrlStaInfo_t * CsrWifiRouterCtrlGetStationRecordFromHandle(unifi_p } /* Function to do inactivity */ -void uf_check_inactivity(unifi_priv_t *priv, CsrUint16 interfaceTag, CsrTime currentTime) +void uf_check_inactivity(unifi_priv_t *priv, u16 interfaceTag, CsrTime currentTime) { CsrUint32 i; CsrWifiRouterCtrlStaInfo_t *staInfo; @@ -3544,7 +3544,7 @@ void uf_check_inactivity(unifi_priv_t *priv, CsrUint16 interfaceTag, CsrTime cur } /* Function to update activity of a station */ -void uf_update_sta_activity(unifi_priv_t *priv, CsrUint16 interfaceTag, const u8 *peerMacAddress) +void uf_update_sta_activity(unifi_priv_t *priv, u16 interfaceTag, const u8 *peerMacAddress) { CsrTime elapsedTime, currentTime; /* Time in microseconds */ CsrTime timeHi; /* Not used - Time in microseconds */ @@ -3587,7 +3587,7 @@ void uf_update_sta_activity(unifi_priv_t *priv, CsrUint16 interfaceTag, const u8 uf_check_inactivity(priv, interfaceTag, currentTime); } } -void resume_unicast_buffered_frames(unifi_priv_t *priv, CsrUint16 interfaceTag) +void resume_unicast_buffered_frames(unifi_priv_t *priv, u16 interfaceTag) { netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; @@ -3677,7 +3677,7 @@ void resume_unicast_buffered_frames(unifi_priv_t *priv, CsrUint16 interfaceTag) } func_exit(); } -void update_eosp_to_head_of_broadcast_list_head(unifi_priv_t *priv,CsrUint16 interfaceTag) +void update_eosp_to_head_of_broadcast_list_head(unifi_priv_t *priv,u16 interfaceTag) { netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; @@ -3718,7 +3718,7 @@ void update_eosp_to_head_of_broadcast_list_head(unifi_priv_t *priv,CsrUint16 int * interfaceTag For which resume should happen * --------------------------------------------------------------------------- */ -void resume_suspended_uapsd(unifi_priv_t* priv,CsrUint16 interfaceTag) +void resume_suspended_uapsd(unifi_priv_t* priv,u16 interfaceTag) { u8 startIndex; diff --git a/drivers/staging/csr/unifi_priv.h b/drivers/staging/csr/unifi_priv.h index f56c702..126e7c6 100644 --- a/drivers/staging/csr/unifi_priv.h +++ b/drivers/staging/csr/unifi_priv.h @@ -305,7 +305,7 @@ typedef u8 CsrWifiAcPowersaveMode; typedef struct tx_buffered_packets { /* List link structure */ struct list_head q; - CsrUint16 interfaceTag; + u16 interfaceTag; CSR_CLIENT_TAG hostTag; CSR_PROCESS_ID leSenderProcessId; CSR_TRANSMISSION_CONTROL transmissionControl; @@ -325,9 +325,9 @@ typedef struct CsrWifiRouterCtrlStaInfo_t { CsrUint32 assignedHandle; CsrBool wmmOrQosEnabled; CsrWifiAcPowersaveMode powersaveMode[MAX_ACCESS_CATOGORY]; - CsrUint16 maxSpLength; + u16 maxSpLength; CsrBool uapsdActive; - CsrUint16 noOfSpFramesSent; + u16 noOfSpFramesSent; /* Router/Driver database */ #ifdef CSR_SUPPORT_SME @@ -338,7 +338,7 @@ typedef struct CsrWifiRouterCtrlStaInfo_t { struct netInterface_priv *interfacePriv; struct work_struct send_disconnected_ind_task; CsrBool activity_flag; - CsrUint16 listenIntervalInTus; + u16 listenIntervalInTus; CSR_CLIENT_TAG nullDataHostTag; /* Activity timestamps for the station */ @@ -355,7 +355,7 @@ typedef struct CsrWifiRouterCtrlStaInfo_t { u8 prevFrmType; u8 prevFrmAccessCatogory; CsrBool protection; - CsrUint16 aid; + u16 aid; CsrBool txSuspend; u8 timSet; /* Dont change the value of below macro for SET & RESET */ @@ -366,13 +366,13 @@ typedef struct CsrWifiRouterCtrlStaInfo_t { CsrBool timRequestPendingFlag; u8 updateTimReqQueued; - CsrUint16 noOfPktQueued; + u16 noOfPktQueued; }CsrWifiRouterCtrlStaInfo_t; #ifdef CSR_SUPPORT_WEXT_AP struct CsrWifiSmeApConfig { CsrWifiSsid ssid; - CsrUint16 channel; + u16 channel; CsrWifiNmeApCredentials credentials; u8 max_connections; u8 if_index; @@ -387,7 +387,7 @@ typedef struct { u8 *bufptr; /* Signal Primitive */ bulk_data_param_t data_ptrs; /* Bulk Data pointers */ - CsrUint16 sig_len; + u16 sig_len; }rx_buff_struct_t; typedef struct @@ -496,7 +496,7 @@ struct unifi_priv { u8 allPeerDozing; u8 pausedStaHandle[MAX_ACCESS_CATOGORY]; /* Max packet the driver can queue, irrespective of interface number */ - CsrUint16 noOfPktQueuedInDriver; + u16 noOfPktQueuedInDriver; #define CSR_WIFI_DRIVER_SUPPORT_FOR_MAX_PKT_QUEUEING 512 #define CSR_WIFI_DRIVER_MAX_PKT_QUEUING_THRESHOLD_PER_PEER 64 #define CSR_WIFI_DRIVER_MINIMUM_BROADCAST_PKT_THRESHOLD 3 @@ -674,7 +674,7 @@ struct unifi_priv { }; typedef struct { - CsrUint16 queue_length[4]; + u16 queue_length[4]; u8 os_queue_paused; } unifi_OsQosInfo; @@ -683,21 +683,21 @@ typedef struct { CsrBool active; bulk_data_param_t bulkdata; CSR_SIGNAL signal; - CsrUint16 sn; + u16 sn; CsrTime recv_time; } frame_desc_struct; typedef struct { frame_desc_struct *buffer; - CsrUint16 wind_size; - CsrUint16 occupied_slots; + u16 wind_size; + u16 occupied_slots; struct timer_list timer; - CsrUint16 timeout; - CsrUint16 expected_sn; - CsrUint16 start_sn; + u16 timeout; + u16 expected_sn; + u16 start_sn; CsrBool trigger_ba_after_ssn; struct netInterface_priv *interfacePriv; - CsrUint16 tID; + u16 tID; CsrWifiMacAddress macAddress; struct work_struct send_ba_err_task; } ba_session_rx_struct; @@ -705,13 +705,13 @@ typedef struct { typedef struct { struct netInterface_priv *interfacePriv; - CsrUint16 tID; + u16 tID; CsrWifiMacAddress macAddress; } ba_session_tx_struct; typedef struct netInterface_priv { - CsrUint16 InterfaceTag; + u16 InterfaceTag; struct unifi_priv *privPtr; ba_session_tx_struct *ba_session_tx[MAX_SUPPORTED_BA_SESSIONS_TX]; ba_session_rx_struct *ba_session_rx[MAX_SUPPORTED_BA_SESSIONS_RX]; @@ -770,7 +770,7 @@ typedef struct netInterface_priv CsrTime last_inactivity_check; /*number of multicast or borad cast packets queued*/ - CsrUint16 noOfbroadcastPktQueued; + u16 noOfbroadcastPktQueued; #endif /* A list to hold the buffered uncontrolled port packets */ struct list_head rx_uncontrolled_list; @@ -895,7 +895,7 @@ unifi_priv_t *uf_alloc_netdevice(CsrSdioFunction *sdio_dev, int bus_id); int uf_free_netdevice(unifi_priv_t *priv); /* Allocating function for other interfaces */ -CsrBool uf_alloc_netdevice_for_other_interfaces(unifi_priv_t *priv, CsrUint16 interfaceTag); +CsrBool uf_alloc_netdevice_for_other_interfaces(unifi_priv_t *priv, u16 interfaceTag); /* * Firmware download related functions. @@ -957,8 +957,8 @@ int uf_verify_m4(unifi_priv_t *priv, const unsigned char *packet, #ifdef CSR_SUPPORT_SME CsrBool uf_check_broadcast_bssid(unifi_priv_t *priv, const bulk_data_param_t *bulkdata); -CsrBool uf_process_pm_bit_for_peer(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t * srcStaInfo,u8 pmBit,CsrUint16 interfaceTag); -void uf_process_ps_poll(unifi_priv_t *priv,u8* sa,u8* da,u8 pmBit,CsrUint16 interfaceTag); +CsrBool uf_process_pm_bit_for_peer(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t * srcStaInfo,u8 pmBit,u16 interfaceTag); +void uf_process_ps_poll(unifi_priv_t *priv,u8* sa,u8* da,u8 pmBit,u16 interfaceTag); int uf_ap_process_data_pdu(unifi_priv_t *priv, struct sk_buff *skb, struct ethhdr *ehdr, CsrWifiRouterCtrlStaInfo_t * srcStaInfo, const CSR_SIGNAL *signal, @@ -967,24 +967,24 @@ int uf_ap_process_data_pdu(unifi_priv_t *priv, struct sk_buff *skb, CsrBool uf_is_more_data_for_non_delivery_ac(CsrWifiRouterCtrlStaInfo_t *staRecord); void uf_process_wmm_deliver_ac_uapsd ( unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t * srcStaInfo, - CsrUint16 qosControl, - CsrUint16 interfaceTag); + u16 qosControl, + u16 interfaceTag); void uf_send_buffered_data_from_ac(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo, u8 queue, struct list_head *txList); void uf_send_buffered_data_from_delivery_ac(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo, u8 queue, struct list_head *txList); void uf_continue_uapsd(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo); -void uf_send_qos_null(unifi_priv_t * priv,CsrUint16 interfaceTag, const u8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo); -void uf_send_nulldata(unifi_priv_t * priv,CsrUint16 interfaceTag, const u8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo); +void uf_send_qos_null(unifi_priv_t * priv,u16 interfaceTag, const u8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo); +void uf_send_nulldata(unifi_priv_t * priv,u16 interfaceTag, const u8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo); #endif -CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, u8 *peerMacAddress, CSR_CLIENT_TAG hostTag, CsrUint16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl, CSR_RATE TransmitRate, CSR_PRIORITY priority, CSR_PROCESS_ID senderId, bulk_data_param_t *bulkdata); +CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, u8 *peerMacAddress, CSR_CLIENT_TAG hostTag, u16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl, CSR_RATE TransmitRate, CSR_PRIORITY priority, CSR_PROCESS_ID senderId, bulk_data_param_t *bulkdata); void uf_process_ma_vif_availibility_ind(unifi_priv_t *priv,u8 *sigdata, CsrUint32 siglen); #ifdef CSR_SUPPORT_SME void uf_send_buffered_frames(unifi_priv_t *priv,unifi_TrafficQueue queue); -int uf_process_station_records_for_sending_data(unifi_priv_t *priv,CsrUint16 interfaceTag, +int uf_process_station_records_for_sending_data(unifi_priv_t *priv,u16 interfaceTag, CsrWifiRouterCtrlStaInfo_t *srcStaInfo, CsrWifiRouterCtrlStaInfo_t *dstStaInfo); void uf_prepare_send_cfm_list_for_queued_pkts(unifi_priv_t * priv, @@ -995,9 +995,9 @@ void send_auto_ma_packet_confirm(unifi_priv_t *priv, struct list_head *buffered_frames_list); void uf_flush_list(unifi_priv_t * priv, struct list_head * list); tx_buffered_packets_t *dequeue_tx_data_pdu(unifi_priv_t *priv, struct list_head *txList); -void resume_unicast_buffered_frames(unifi_priv_t *priv, CsrUint16 interfaceTag); -void update_eosp_to_head_of_broadcast_list_head(unifi_priv_t *priv,CsrUint16 interfaceTag); -void resume_suspended_uapsd(unifi_priv_t* priv,CsrUint16 interfaceTag); +void resume_unicast_buffered_frames(unifi_priv_t *priv, u16 interfaceTag); +void update_eosp_to_head_of_broadcast_list_head(unifi_priv_t *priv,u16 interfaceTag); +void resume_suspended_uapsd(unifi_priv_t* priv,u16 interfaceTag); #endif /* * netdev.c @@ -1028,7 +1028,7 @@ int prepare_and_add_macheader(unifi_priv_t *priv, struct sk_buff *newSkb, CSR_PRIORITY priority, bulk_data_param_t *bulkdata, - CsrUint16 interfaceTag, + u16 interfaceTag, const u8 *daddr, const u8 *saddr, CsrBool protection); @@ -1038,7 +1038,7 @@ get_packet_priority(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr void unifi_frame_ma_packet_req(unifi_priv_t *priv, CSR_PRIORITY priority, CSR_RATE TransmitRate, CSR_CLIENT_TAG hostTag, - CsrUint16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl, + u16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl, CSR_PROCESS_ID leSenderProcessId, u8 *peerMacAddress, CSR_SIGNAL *signal); @@ -1053,40 +1053,40 @@ unifi_frame_ma_packet_req(unifi_priv_t *priv, CSR_PRIORITY priority, /* handle is 6 bits to accomodate in senderId LSB (only 64 station can be associated) */ #define CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE 0x3F -void update_tim(unifi_priv_t * priv, CsrUint16 aid, u8 setTim, CsrUint16 interfaceTag, CsrUint32 handle); -void uf_handle_tim_cfm(unifi_priv_t *priv, CSR_MLME_SET_TIM_CONFIRM *cfm, CsrUint16 senderProcessId); +void update_tim(unifi_priv_t * priv, u16 aid, u8 setTim, u16 interfaceTag, CsrUint32 handle); +void uf_handle_tim_cfm(unifi_priv_t *priv, CSR_MLME_SET_TIM_CONFIRM *cfm, u16 senderProcessId); /* Clear the Peer station Record, in case of wifioff/unexpected card removal */ -void CsrWifiRouterCtrlInterfaceReset(unifi_priv_t *priv, CsrUint16 interfaceTag); +void CsrWifiRouterCtrlInterfaceReset(unifi_priv_t *priv, u16 interfaceTag); void scroll_ba_window(unifi_priv_t *priv, netInterface_priv_t *interfacePriv, ba_session_rx_struct *ba_session, - CsrUint16 sn); + u16 sn); CsrBool blockack_session_stop(unifi_priv_t *priv, - CsrUint16 interfaceTag, + u16 interfaceTag, CsrWifiRouterCtrlBlockAckRole role, - CsrUint16 tID, + u16 tID, CsrWifiMacAddress macAddress); #ifdef CSR_SUPPORT_SME /* Fetch the protection information from interface Mode */ -s8 uf_get_protection_bit_from_interfacemode(unifi_priv_t *priv, CsrUint16 interfaceTag, const u8 *daddr); +s8 uf_get_protection_bit_from_interfacemode(unifi_priv_t *priv, u16 interfaceTag, const u8 *daddr); #endif /* Fetch the station record handler from data base for matching Mac address */ #ifdef CSR_SUPPORT_SME CsrWifiRouterCtrlStaInfo_t *CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(unifi_priv_t *priv, const u8 *peerMacAddress, - CsrUint16 interfaceTag); + u16 interfaceTag); /* Fetch the station record handler from data base for matching handle */ CsrWifiRouterCtrlStaInfo_t * CsrWifiRouterCtrlGetStationRecordFromHandle(unifi_priv_t *priv, CsrUint32 handle, - CsrUint16 interfaceTag); + u16 interfaceTag); -void uf_update_sta_activity(unifi_priv_t *priv, CsrUint16 interfaceTag, const u8 *peerMacAddress); -void uf_process_ma_pkt_cfm_for_ap(unifi_priv_t *priv,CsrUint16 interfaceTag, const CSR_MA_PACKET_CONFIRM *pkt_cfm); +void uf_update_sta_activity(unifi_priv_t *priv, u16 interfaceTag, const u8 *peerMacAddress); +void uf_process_ma_pkt_cfm_for_ap(unifi_priv_t *priv,u16 interfaceTag, const CSR_MA_PACKET_CONFIRM *pkt_cfm); #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) int uf_install_qdisc(struct net_device *dev); @@ -1094,9 +1094,9 @@ int uf_install_qdisc(struct net_device *dev); void uf_resume_data_plane(unifi_priv_t *priv, int queue, CsrWifiMacAddress peer_address, - CsrUint16 interfaceTag); + u16 interfaceTag); void uf_free_pending_rx_packets(unifi_priv_t *priv, int queue, - CsrWifiMacAddress peer_address,CsrUint16 interfaceTag); + CsrWifiMacAddress peer_address,u16 interfaceTag); int uf_register_netdev(unifi_priv_t *priv, int numOfInterface); void uf_unregister_netdev(unifi_priv_t *priv); @@ -1104,11 +1104,11 @@ void uf_unregister_netdev(unifi_priv_t *priv); void uf_net_get_name(struct net_device *dev, char *name, int len); void uf_send_queue_info(unifi_priv_t *priv); -CsrUint16 uf_get_vif_identifier(CsrWifiRouterCtrlMode mode, CsrUint16 tag); +u16 uf_get_vif_identifier(CsrWifiRouterCtrlMode mode, u16 tag); void uf_process_rx_pending_queue(unifi_priv_t *priv, int queue, CsrWifiMacAddress source_address, - int indicate, CsrUint16 interfaceTag); + int indicate, u16 interfaceTag); #ifdef CSR_WIFI_HIP_DEBUG_OFFLINE int uf_register_hip_offline_debug(unifi_priv_t *priv); diff --git a/drivers/staging/csr/unifi_sme.c b/drivers/staging/csr/unifi_sme.c index 559213b..98c9c07 100644 --- a/drivers/staging/csr/unifi_sme.c +++ b/drivers/staging/csr/unifi_sme.c @@ -114,7 +114,7 @@ sme_log_event(ul_client_t *pcli, } if (unpacked_signal.SignalPrimitiveHeader.SignalId == CSR_MA_PACKET_INDICATION_ID) { - CsrUint16 frmCtrl; + u16 frmCtrl; CsrBool unicastPdu = TRUE; u8 *macHdrLocation; u8 *raddr = NULL, *taddr = NULL; @@ -147,7 +147,7 @@ sme_log_event(ul_client_t *pcli, if(ind->ReceptionStatus == CSR_RX_SUCCESS) { u8 pmBit = (frmCtrl & 0x1000)?0x01:0x00; - CsrUint16 interfaceTag = (ind->VirtualInterfaceIdentifier & 0xff); + u16 interfaceTag = (ind->VirtualInterfaceIdentifier & 0xff); CsrWifiRouterCtrlStaInfo_t *srcStaInfo = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv,taddr,interfaceTag); if((srcStaInfo != NULL) && (uf_check_broadcast_bssid(priv, bulkdata)== FALSE)) { @@ -163,7 +163,7 @@ sme_log_event(ul_client_t *pcli, if (unpacked_signal.SignalPrimitiveHeader.SignalId == CSR_MA_PACKET_CONFIRM_ID) { CSR_MA_PACKET_CONFIRM *cfm = &unpacked_signal.u.MaPacketConfirm; - CsrUint16 interfaceTag = (cfm->VirtualInterfaceIdentifier & 0xff); + u16 interfaceTag = (cfm->VirtualInterfaceIdentifier & 0xff); netInterface_priv_t *interfacePriv; CSR_MA_PACKET_REQUEST *req; CsrWifiMacAddress peerMacAddress; @@ -212,7 +212,7 @@ sme_log_event(ul_client_t *pcli, #endif /* If EAPOL was requested via router APIs then send cfm else ignore*/ if((cfm->HostTag & 0x80000000) != CSR_WIFI_EAPOL_M4_HOST_TAG) { - CsrWifiRouterMaPacketCfmSend((CsrUint16)signal[2], + CsrWifiRouterMaPacketCfmSend((u16)signal[2], cfm->VirtualInterfaceIdentifier, result, (cfm->HostTag & 0x3fffffff), cfm->Rate); @@ -268,7 +268,7 @@ sme_log_event(ul_client_t *pcli, * --------------------------------------------------------------------------- */ CsrWifiRouterCtrlPortAction -uf_sme_port_state(unifi_priv_t *priv, unsigned char *address, int queue, CsrUint16 interfaceTag) +uf_sme_port_state(unifi_priv_t *priv, unsigned char *address, int queue, u16 interfaceTag) { int i; unifi_port_config_t *port; @@ -332,7 +332,7 @@ uf_sme_port_state(unifi_priv_t *priv, unsigned char *address, int queue, CsrUint * --------------------------------------------------------------------------- */ unifi_port_cfg_t* -uf_sme_port_config_handle(unifi_priv_t *priv, unsigned char *address, int queue, CsrUint16 interfaceTag) +uf_sme_port_config_handle(unifi_priv_t *priv, unsigned char *address, int queue, u16 interfaceTag) { int i; unifi_port_config_t *port; @@ -387,7 +387,7 @@ uf_multicast_list_wq(struct work_struct *work) unifi_priv_t *priv = container_of(work, unifi_priv_t, multicast_list_task); int i; - CsrUint16 interfaceTag = 0; + u16 interfaceTag = 0; CsrWifiMacAddress* multicast_address_list = NULL; int mc_count; u8 *mc_list; @@ -867,7 +867,7 @@ int unifi_cfg_get_info(unifi_priv_t *priv, unsigned char *arg) break; case UNIFI_CFG_GET_INSTANCE: { - CsrUint16 InterfaceId=0; + u16 InterfaceId=0; uf_net_get_name(priv->netdev[InterfaceId], &inst_name[0], sizeof(inst_name)); /* Copy the info to the out buffer */ @@ -1054,7 +1054,7 @@ uf_ta_ind_wq(struct work_struct *work) { struct ta_ind *ind = container_of(work, struct ta_ind, task); unifi_priv_t *priv = container_of(ind, unifi_priv_t, ta_ind_work); - CsrUint16 interfaceTag = 0; + u16 interfaceTag = 0; CsrWifiRouterCtrlTrafficProtocolIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,0, @@ -1091,7 +1091,7 @@ uf_ta_sample_ind_wq(struct work_struct *work) { struct ta_sample_ind *ind = container_of(work, struct ta_sample_ind, task); unifi_priv_t *priv = container_of(ind, unifi_priv_t, ta_sample_ind_work); - CsrUint16 interfaceTag = 0; + u16 interfaceTag = 0; unifi_trace(priv, UDBG5, "rxtcp %d txtcp %d rxudp %d txudp %d prio %d\n", priv->rxTcpThroughput, @@ -1152,7 +1152,7 @@ void uf_send_m4_ready_wq(struct work_struct *work) { netInterface_priv_t *InterfacePriv = container_of(work, netInterface_priv_t, send_m4_ready_task); - CsrUint16 iface = InterfacePriv->InterfaceTag; + u16 iface = InterfacePriv->InterfaceTag; unifi_priv_t *priv = InterfacePriv->privPtr; CSR_MA_PACKET_REQUEST *req = &InterfacePriv->m4_signal.u.MaPacketRequest; CsrWifiMacAddress peer; @@ -1195,7 +1195,7 @@ uf_send_m4_ready_wq(struct work_struct *work) void uf_send_pkt_to_encrypt(struct work_struct *work) { netInterface_priv_t *interfacePriv = container_of(work, netInterface_priv_t, send_pkt_to_encrypt); - CsrUint16 interfaceTag = interfacePriv->InterfaceTag; + u16 interfaceTag = interfacePriv->InterfaceTag; unifi_priv_t *priv = interfacePriv->privPtr; CsrUint32 pktBulkDataLength; diff --git a/drivers/staging/csr/unifi_sme.h b/drivers/staging/csr/unifi_sme.h index 05de4cd..bfe20d3 100644 --- a/drivers/staging/csr/unifi_sme.h +++ b/drivers/staging/csr/unifi_sme.h @@ -77,16 +77,16 @@ typedef struct { /* SME's reply to a scan request */ - CsrUint16 reply_scan_results_count; + u16 reply_scan_results_count; CsrWifiSmeScanResult* reply_scan_results; } sme_reply_t; typedef struct { - CsrUint16 appHandle; + u16 appHandle; CsrWifiRouterEncapsulation encapsulation; - CsrUint16 protocol; + u16 protocol; u8 oui[3]; u8 in_use; } sme_ma_unidata_ind_filter_t; @@ -95,11 +95,11 @@ typedef struct { CsrWifiRouterCtrlPortAction uf_sme_port_state(unifi_priv_t *priv, unsigned char *address, int queue, - CsrUint16 interfaceTag); + u16 interfaceTag); unifi_port_cfg_t *uf_sme_port_config_handle(unifi_priv_t *priv, unsigned char *address, int queue, - CsrUint16 interfaceTag); + u16 interfaceTag); @@ -210,8 +210,8 @@ int sme_mgt_mib_get(unifi_priv_t *priv, int sme_mgt_mib_set(unifi_priv_t *priv, unsigned char *varbind, int length); #ifdef CSR_SUPPORT_WEXT_AP -int sme_ap_start(unifi_priv_t *priv,CsrUint16 interface_tag,CsrWifiSmeApConfig_t *ap_config); -int sme_ap_stop(unifi_priv_t *priv,CsrUint16 interface_tag); +int sme_ap_start(unifi_priv_t *priv,u16 interface_tag,CsrWifiSmeApConfig_t *ap_config); +int sme_ap_stop(unifi_priv_t *priv,u16 interface_tag); int sme_ap_config(unifi_priv_t *priv,CsrWifiSmeApMacConfig *ap_mac_config, CsrWifiNmeApConfig *group_security_config); int uf_configure_supported_rates(u8 * supportedRates, u8 phySupportedBitmap); #endif diff --git a/drivers/staging/csr/unifi_wext.h b/drivers/staging/csr/unifi_wext.h index ac86df9..4ce0011 100644 --- a/drivers/staging/csr/unifi_wext.h +++ b/drivers/staging/csr/unifi_wext.h @@ -58,9 +58,9 @@ void wext_send_assoc_event(unifi_priv_t *priv, unsigned char *bssid, unsigned char *scan_ie, unsigned int scan_ie_len); void wext_send_disassoc_event(unifi_priv_t *priv); void wext_send_michaelmicfailure_event(unifi_priv_t *priv, - CsrUint16 count, CsrWifiMacAddress address, - CsrWifiSmeKeyType keyType, CsrUint16 interfaceTag); -void wext_send_pmkid_candidate_event(unifi_priv_t *priv, CsrWifiMacAddress bssid, CsrBool preauth_allowed, CsrUint16 interfaceTag); + u16 count, CsrWifiMacAddress address, + CsrWifiSmeKeyType keyType, u16 interfaceTag); +void wext_send_pmkid_candidate_event(unifi_priv_t *priv, CsrWifiMacAddress bssid, CsrBool preauth_allowed, u16 interfaceTag); void wext_send_started_event(unifi_priv_t *priv); diff --git a/drivers/staging/csr/unifiio.h b/drivers/staging/csr/unifiio.h index c1e3f53..74720fc 100644 --- a/drivers/staging/csr/unifiio.h +++ b/drivers/staging/csr/unifiio.h @@ -205,9 +205,9 @@ typedef struct { typedef struct { /* Number of 16-bit ints in the protocols array */ - CsrUint16 count; + u16 count; /* List of protocol ids to pass */ - CsrUint16 *protocols; + u16 *protocols; } unifiio_snap_filter_t; @@ -312,20 +312,20 @@ typedef struct uf_cfg_ap_config { u8 phySupportedBitmap; u8 channel; - CsrUint16 beaconInterval; + u16 beaconInterval; u8 dtimPeriod; CsrBool wmmEnabled; u8 shortSlotTimeEnabled; - CsrUint16 groupkeyTimeout; + u16 groupkeyTimeout; CsrBool strictGtkRekeyEnabled; - CsrUint16 gmkTimeout; - CsrUint16 responseTimeout; + u16 gmkTimeout; + u16 responseTimeout; u8 retransLimit; u8 rxStbc; CsrBool rifsModeAllowed; u8 dualCtsProtection; u8 ctsProtectionType; - CsrUint16 maxListenInterval; + u16 maxListenInterval; }uf_cfg_ap_config_t; typedef struct tcpic_clsfr diff --git a/drivers/staging/csr/wext_events.c b/drivers/staging/csr/wext_events.c index 5674782..f250ea6 100644 --- a/drivers/staging/csr/wext_events.c +++ b/drivers/staging/csr/wext_events.c @@ -217,10 +217,10 @@ _send_michaelmicfailure_event(struct net_device *dev, void wext_send_michaelmicfailure_event(unifi_priv_t *priv, - CsrUint16 count, + u16 count, CsrWifiMacAddress address, CsrWifiSmeKeyType keyType, - CsrUint16 interfaceTag) + u16 interfaceTag) { unsigned char tsc[8] = {0}; @@ -238,7 +238,7 @@ wext_send_michaelmicfailure_event(unifi_priv_t *priv, } /* wext_send_michaelmicfailure_event() */ void -wext_send_pmkid_candidate_event(unifi_priv_t *priv, CsrWifiMacAddress bssid, CsrBool preauth_allowed, CsrUint16 interfaceTag) +wext_send_pmkid_candidate_event(unifi_priv_t *priv, CsrWifiMacAddress bssid, CsrBool preauth_allowed, u16 interfaceTag) { #if WIRELESS_EXT > 17 union iwreq_data wrqu; -- cgit v0.10.2 From ab2b8c7383caf6b071930e4e1d4a8b4bf1708f38 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 12:02:00 -0700 Subject: staging: csr: remove CsrInt16 typedef MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the in-kernel s16 type instead. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_types.h b/drivers/staging/csr/csr_types.h index 0e5abe5..061fde8 100644 --- a/drivers/staging/csr/csr_types.h +++ b/drivers/staging/csr/csr_types.h @@ -36,7 +36,6 @@ typedef ptrdiff_t CsrIntptr; /* intptr_t is not defined in kernel. Use the eq typedef uint32_t CsrUint32; /* Signed fixed width types */ -typedef int16_t CsrInt16; typedef int32_t CsrInt32; /* Boolean */ diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index 32c114b..aaadc6f 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -326,7 +326,7 @@ CsrCharString *CsrStrNCpyZero(CsrCharString *dest, /* Convert string with base 10 to integer */ CsrUint32 CsrStrToInt(const CsrCharString *str) { - CsrInt16 i; + s16 i; CsrUint32 res; CsrUint32 digit; diff --git a/drivers/staging/csr/csr_wifi_hip_card.h b/drivers/staging/csr/csr_wifi_hip_card.h index dfee536..6a0d60b 100644 --- a/drivers/staging/csr/csr_wifi_hip_card.h +++ b/drivers/staging/csr/csr_wifi_hip_card.h @@ -79,7 +79,7 @@ CsrResult CardWriteBulkData(card_t *card, card_signal_t *csptr, unifi_TrafficQue /***************************************************************************** * CardClearFromHostDataSlot - */ -void CardClearFromHostDataSlot(card_t *card, const CsrInt16 aSlotNum); +void CardClearFromHostDataSlot(card_t *card, const s16 aSlotNum); #ifdef CSR_WIFI_REQUEUE_PACKET_TO_HAL /***************************************************************************** @@ -87,7 +87,7 @@ void CardClearFromHostDataSlot(card_t *card, const CsrInt16 aSlotNum); * without freeing the bulk data */ -void CardClearFromHostDataSlotWithoutFreeingBulkData(card_t *card, const CsrInt16 aSlotNum); +void CardClearFromHostDataSlotWithoutFreeingBulkData(card_t *card, const s16 aSlotNum); #endif /***************************************************************************** diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.c b/drivers/staging/csr/csr_wifi_hip_card_sdio.c index 7e75e60..1c88f1c 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.c @@ -512,7 +512,7 @@ static CsrResult unifi_hip_init(card_t *card) static void _build_sdio_config_data(sdio_config_data_t *cfg_data, const u8 *cfg_data_buf) { - CsrInt16 offset = 0; + s16 offset = 0; cfg_data->version = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); offset += SIZEOF_UINT16; @@ -606,8 +606,8 @@ static CsrResult card_hw_init(card_t *card) u8 cfg_data_buf[SDIO_CONFIG_DATA_SIZE]; CsrResult r; void *dlpriv; - CsrInt16 major, minor; - CsrInt16 search_4slut_again; + s16 major, minor; + s16 search_4slut_again; CsrResult csrResult; func_enter(); @@ -1000,7 +1000,7 @@ static CsrResult card_hw_init(card_t *card) */ static CsrResult card_wait_for_unifi_to_reset(card_t *card) { - CsrInt16 i; + s16 i; CsrResult r; u8 io_enable; CsrResult csrResult; @@ -1052,7 +1052,7 @@ static CsrResult card_wait_for_unifi_to_reset(card_t *card) if (r == CSR_RESULT_SUCCESS) { u16 mbox2; - CsrInt16 enabled = io_enable & (1 << card->function); + s16 enabled = io_enable & (1 << card->function); if (!enabled) { @@ -1132,7 +1132,7 @@ static CsrResult card_wait_for_unifi_to_reset(card_t *card) */ static CsrResult card_wait_for_unifi_to_disable(card_t *card) { - CsrInt16 i; + s16 i; CsrResult r; u8 io_enable; CsrResult csrResult; @@ -1178,7 +1178,7 @@ static CsrResult card_wait_for_unifi_to_disable(card_t *card) } if (csrResult == CSR_RESULT_SUCCESS) { - CsrInt16 enabled = io_enable & (1 << card->function); + s16 enabled = io_enable & (1 << card->function); r = CSR_RESULT_SUCCESS; if (!enabled) { @@ -1605,7 +1605,7 @@ void unifi_read_panic(card_t *card) */ static CsrResult card_allocate_memory_resources(card_t *card) { - CsrInt16 n, i, k, r; + s16 n, i, k, r; sdio_config_data_t *cfg_data; func_enter(); @@ -1837,7 +1837,7 @@ static void card_free_memory_resources(card_t *card) static void card_init_soft_queues(card_t *card) { - CsrInt16 i; + s16 i; func_enter(); @@ -1876,7 +1876,7 @@ static void card_init_soft_queues(card_t *card) */ void unifi_cancel_pending_signals(card_t *card) { - CsrInt16 i, n, r; + s16 i, n, r; func_enter(); unifi_trace(card->ospriv, UDBG1, "Canceling pending signals.\n"); @@ -2059,7 +2059,7 @@ static CsrResult card_init_slots(card_t *card) func_exit_r(r); return r; } - card->from_host_signals_w = (CsrInt16)s; + card->from_host_signals_w = (s16)s; /* Get the to-host-signals-written count */ r = unifi_card_read16(card, card->sdio_ctrl_addr + 6, &s); @@ -2073,7 +2073,7 @@ static CsrResult card_init_slots(card_t *card) func_exit_r(r); return r; } - card->to_host_signals_r = (CsrInt16)s; + card->to_host_signals_r = (s16)s; } /* Set Initialised flag. */ @@ -2350,7 +2350,7 @@ static void CardCheckDynamicReservation(card_t *card, unifi_TrafficQueue queue) * None. * --------------------------------------------------------------------------- */ -void CardClearFromHostDataSlot(card_t *card, const CsrInt16 slot) +void CardClearFromHostDataSlot(card_t *card, const s16 slot) { u8 queue = card->from_host_data[slot].queue; const void *os_data_ptr = card->from_host_data[slot].bd.os_data_ptr; @@ -2417,7 +2417,7 @@ void CardClearFromHostDataSlot(card_t *card, const CsrInt16 slot) * None. * --------------------------------------------------------------------------- */ -void CardClearFromHostDataSlotWithoutFreeingBulkData(card_t *card, const CsrInt16 slot) +void CardClearFromHostDataSlotWithoutFreeingBulkData(card_t *card, const s16 slot) { u8 queue = card->from_host_data[slot].queue; @@ -3405,7 +3405,7 @@ CsrResult CardWriteBulkData(card_t *card, card_signal_t *csptr, unifi_TrafficQue u16 i, slots[UNIFI_MAX_DATA_REFERENCES], j = 0; u8 *packed_sigptr, num_slots_required = 0; bulk_data_desc_t *bulkdata = csptr->bulkdata; - CsrInt16 h, nslots; + s16 h, nslots; func_enter(); @@ -3562,9 +3562,9 @@ CsrResult CardWriteBulkData(card_t *card, card_signal_t *csptr, unifi_TrafficQue * Pointer to entry in bulk_data_slot array. * --------------------------------------------------------------------------- */ -bulk_data_desc_t* card_find_data_slot(card_t *card, CsrInt16 slot) +bulk_data_desc_t* card_find_data_slot(card_t *card, s16 slot) { - CsrInt16 sn; + s16 sn; bulk_data_desc_t *bd; sn = slot & 0x7FFF; @@ -3705,7 +3705,7 @@ CsrResult unifi_card_stop_processor(card_t *card, enum unifi_dbg_processors_sele { CsrResult r = CSR_RESULT_SUCCESS; u8 status; - CsrInt16 retry = 100; + s16 retry = 100; while (retry--) { @@ -4103,7 +4103,7 @@ CsrResult unifi_check_io_status(card_t *card, CsrInt32 *status) void unifi_get_hip_qos_info(card_t *card, unifi_HipQosInfo *hipqosinfo) { CsrInt32 count_fhr; - CsrInt16 t; + s16 t; CsrUint32 occupied_fh; q_t *sigq; diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.h b/drivers/staging/csr/csr_wifi_hip_card_sdio.h index 8c81856..6463e24 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.h +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.h @@ -532,7 +532,7 @@ struct card * This is an optimisation that starts searching at a more likely point * than the beginning. */ - CsrInt16 from_host_data_head; + s16 from_host_data_head; /* Dynamic slot allocation for queues */ card_dynamic_slot_t dynamic_slot_data; @@ -577,7 +577,7 @@ struct card #endif /* Auto-coredump */ - CsrInt16 request_coredump_on_reset; /* request coredump on next reset */ + s16 request_coredump_on_reset; /* request coredump on next reset */ struct coredump_buf *dump_buf; /* root node */ struct coredump_buf *dump_next_write; /* node to fill at next dump */ struct coredump_buf *dump_cur_read; /* valid node to read, or NULL */ @@ -654,7 +654,7 @@ CsrResult unifi_set_host_state(card_t *card, enum unifi_host_state state); CsrResult unifi_set_proc_select(card_t *card, enum unifi_dbg_processors_select select); CsrInt32 card_read_signal_counts(card_t *card); -bulk_data_desc_t* card_find_data_slot(card_t *card, CsrInt16 slot); +bulk_data_desc_t* card_find_data_slot(card_t *card, s16 slot); CsrResult unifi_read32(card_t *card, CsrUint32 unifi_addr, CsrUint32 *pdata); @@ -665,9 +665,9 @@ CsrInt32 unifi_read_shared_count(card_t *card, CsrUint32 addr); CsrResult unifi_writen(card_t *card, CsrUint32 unifi_addr, void *pdata, u16 len); CsrResult unifi_bulk_rw(card_t *card, CsrUint32 handle, - void *pdata, CsrUint32 len, CsrInt16 direction); + void *pdata, CsrUint32 len, s16 direction); CsrResult unifi_bulk_rw_noretry(card_t *card, CsrUint32 handle, - void *pdata, CsrUint32 len, CsrInt16 direction); + void *pdata, CsrUint32 len, s16 direction); #define UNIFI_SDIO_READ 0 #define UNIFI_SDIO_WRITE 1 diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c index 2d3b3ea..1d09b97 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c @@ -54,7 +54,7 @@ static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed); static CsrResult process_bulk_data_command(card_t *card, const u8 *cmdptr, - CsrInt16 cmd, u16 len); + s16 cmd, u16 len); static CsrResult process_clear_slot_command(card_t *card, const u8 *cmdptr); static CsrResult process_fh_cmd_queue(card_t *card, CsrInt32 *processed); @@ -63,7 +63,7 @@ static void restart_packet_flow(card_t *card); static CsrResult process_clock_request(card_t *card); #ifdef CSR_WIFI_HIP_NOISY -CsrInt16 dump_fh_buf = 0; +s16 dump_fh_buf = 0; #endif /* CSR_WIFI_HIP_NOISY */ #ifdef CSR_WIFI_HIP_DEBUG_OFFLINE @@ -1054,7 +1054,7 @@ static CsrResult read_to_host_signals(card_t *card, CsrInt32 *processed) * CSR_RESULT_SUCCESS on success or CSR error code * --------------------------------------------------------------------------- */ -static CsrResult update_to_host_signals_r(card_t *card, CsrInt16 pending) +static CsrResult update_to_host_signals_r(card_t *card, s16 pending) { CsrResult r; @@ -1100,7 +1100,7 @@ static CsrResult update_to_host_signals_r(card_t *card, CsrInt16 pending) */ static void read_unpack_cmd(const u8 *ptr, bulk_data_cmd_t *bulk_data_cmd) { - CsrInt16 index = 0; + s16 index = 0; bulk_data_cmd->cmd_and_len = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; bulk_data_cmd->data_slot = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); @@ -1145,13 +1145,13 @@ static void read_unpack_cmd(const u8 *ptr, bulk_data_cmd_t *bulk_data_cmd) */ static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed) { - CsrInt16 pending; - CsrInt16 remaining; + s16 pending; + s16 remaining; u8 *bufptr; bulk_data_param_t data_ptrs; - CsrInt16 cmd; + s16 cmd; u16 sig_len; - CsrInt16 i; + s16 i; u16 chunks_in_buf; u16 bytes_transferred = 0; CsrResult r = CSR_RESULT_SUCCESS; @@ -1177,7 +1177,7 @@ static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed) while (pending > 0) { - CsrInt16 f_flush_count = 0; + s16 f_flush_count = 0; /* * Command and length are common to signal and bulk data msgs. @@ -1257,7 +1257,7 @@ static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed) if (data_len != 0) { /* Retrieve dataRefs[i].SlotNumber */ - CsrInt16 slot = GET_PACKED_DATAREF_SLOT(bufptr + 2, i); + s16 slot = GET_PACKED_DATAREF_SLOT(bufptr + 2, i); if (slot >= card->config_data.num_tohost_data_slots) { @@ -1372,7 +1372,7 @@ static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed) /* The slot is only valid if the length is non-zero. */ if (GET_PACKED_DATAREF_LEN(bufptr + 2, i) != 0) { - CsrInt16 slot = GET_PACKED_DATAREF_SLOT(bufptr + 2, i); + s16 slot = GET_PACKED_DATAREF_SLOT(bufptr + 2, i); if (slot < card->config_data.num_tohost_data_slots) { UNIFI_INIT_BULK_DATA(&card->to_host_data[slot]); @@ -1546,7 +1546,7 @@ static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed) static CsrResult process_clear_slot_command(card_t *card, const u8 *cmdptr) { u16 data_slot; - CsrInt16 slot; + s16 slot; data_slot = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cmdptr + SIZEOF_UINT16); @@ -1619,16 +1619,16 @@ static CsrResult process_clear_slot_command(card_t *card, const u8 *cmdptr) * --------------------------------------------------------------------------- */ static CsrResult process_bulk_data_command(card_t *card, const u8 *cmdptr, - CsrInt16 cmd, u16 len) + s16 cmd, u16 len) { bulk_data_desc_t *bdslot; #ifdef CSR_WIFI_ALIGNMENT_WORKAROUND u8 *host_bulk_data_slot; #endif bulk_data_cmd_t bdcmd; - CsrInt16 offset; - CsrInt16 slot; - CsrInt16 dir; + s16 offset; + s16 slot; + s16 dir; CsrResult r; read_unpack_cmd(cmdptr, &bdcmd); @@ -2029,7 +2029,7 @@ static CsrResult process_fh_cmd_queue(card_t *card, CsrInt32 *processed) while (pending_sigs-- && pending_chunks > 0) { card_signal_t *csptr; - CsrInt16 i; + s16 i; u16 sig_chunks, total_length, free_chunks_in_fh_buffer; bulk_data_param_t bulkdata; u8 *packed_sigptr; @@ -2173,7 +2173,7 @@ static CsrResult process_fh_traffic_queue(card_t *card, CsrInt32 *processed) q_t *sigq = card->fh_traffic_queue; CsrResult r; - CsrInt16 n = 0; + s16 n = 0; CsrInt32 q_no; u16 pending_sigs = 0; u16 pending_chunks = 0; diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c index 9953ebf..15a0403 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c @@ -53,11 +53,11 @@ * CSR_RESULT_FAILURE an SDIO error occurred * --------------------------------------------------------------------------- */ -static CsrResult retrying_read8(card_t *card, CsrInt16 funcnum, CsrUint32 addr, u8 *pdata) +static CsrResult retrying_read8(card_t *card, s16 funcnum, CsrUint32 addr, u8 *pdata) { CsrSdioFunction *sdio = card->sdio_if; CsrResult r = CSR_RESULT_SUCCESS; - CsrInt16 retries; + s16 retries; CsrResult csrResult = CSR_RESULT_SUCCESS; retries = 0; @@ -128,11 +128,11 @@ static CsrResult retrying_read8(card_t *card, CsrInt16 funcnum, CsrUint32 addr, } /* retrying_read8() */ -static CsrResult retrying_write8(card_t *card, CsrInt16 funcnum, CsrUint32 addr, u8 data) +static CsrResult retrying_write8(card_t *card, s16 funcnum, CsrUint32 addr, u8 data) { CsrSdioFunction *sdio = card->sdio_if; CsrResult r = CSR_RESULT_SUCCESS; - CsrInt16 retries; + s16 retries; CsrResult csrResult = CSR_RESULT_SUCCESS; retries = 0; @@ -201,12 +201,12 @@ static CsrResult retrying_write8(card_t *card, CsrInt16 funcnum, CsrUint32 addr, } /* retrying_write8() */ -static CsrResult retrying_read16(card_t *card, CsrInt16 funcnum, +static CsrResult retrying_read16(card_t *card, s16 funcnum, CsrUint32 addr, u16 *pdata) { CsrSdioFunction *sdio = card->sdio_if; CsrResult r = CSR_RESULT_SUCCESS; - CsrInt16 retries; + s16 retries; CsrResult csrResult = CSR_RESULT_SUCCESS; retries = 0; @@ -262,12 +262,12 @@ static CsrResult retrying_read16(card_t *card, CsrInt16 funcnum, } /* retrying_read16() */ -static CsrResult retrying_write16(card_t *card, CsrInt16 funcnum, +static CsrResult retrying_write16(card_t *card, s16 funcnum, CsrUint32 addr, u16 data) { CsrSdioFunction *sdio = card->sdio_if; CsrResult r = CSR_RESULT_SUCCESS; - CsrInt16 retries; + s16 retries; CsrResult csrResult = CSR_RESULT_SUCCESS; retries = 0; @@ -668,10 +668,10 @@ CsrResult unifi_write_directn(card_t *card, CsrUint32 addr, void *pdata, u16 len { CsrResult r; u8 *cptr; - CsrInt16 signed_len; + s16 signed_len; cptr = (u8 *)pdata; - signed_len = (CsrInt16)len; + signed_len = (s16)len; while (signed_len > 0) { /* This is UniFi-1 specific code. CSPI not supported so 8-bit write allowed */ @@ -1399,9 +1399,9 @@ CsrResult unifi_writen(card_t *card, CsrUint32 unifi_addr, void *pdata, u16 len) } /* unifi_writen() */ -static CsrResult csr_sdio_block_rw(card_t *card, CsrInt16 funcnum, +static CsrResult csr_sdio_block_rw(card_t *card, s16 funcnum, CsrUint32 addr, u8 *pdata, - u16 count, CsrInt16 dir_is_write) + u16 count, s16 dir_is_write) { CsrResult csrResult; @@ -1473,7 +1473,7 @@ static CsrResult csr_sdio_block_rw(card_t *card, CsrInt16 funcnum, * --------------------------------------------------------------------------- */ CsrResult unifi_bulk_rw(card_t *card, CsrUint32 handle, void *pdata, - CsrUint32 len, CsrInt16 direction) + CsrUint32 len, s16 direction) { #define CMD53_RETRIES 3 /* @@ -1486,15 +1486,15 @@ CsrResult unifi_bulk_rw(card_t *card, CsrUint32 handle, void *pdata, #define REWIND_DELAY 1 /* msec or 50usecs */ CsrResult csrResult; /* SDIO error code */ CsrResult r = CSR_RESULT_SUCCESS; /* HIP error code */ - CsrInt16 retries = CMD53_RETRIES; - CsrInt16 stat_retries; + s16 retries = CMD53_RETRIES; + s16 stat_retries; u8 stat; - CsrInt16 dump_read; + s16 dump_read; #ifdef UNIFI_DEBUG u8 *pdata_lsb = ((u8 *)&pdata) + card->lsb; #endif #ifdef CSR_WIFI_MAKE_FAKE_CMD53_ERRORS - static CsrInt16 fake_error; + static s16 fake_error; #endif dump_read = 0; @@ -1587,7 +1587,7 @@ CsrResult unifi_bulk_rw(card_t *card, CsrUint32 handle, void *pdata, unifi_trace(card->ospriv, UDBG4, "Error in a CMD53 transfer, retrying (h:%d,l:%u)...\n", - (CsrInt16)handle & 0xff, len); + (s16)handle & 0xff, len); /* The transfer failed, rewind and try again */ r = unifi_write_8_or_16(card, card->sdio_ctrl_addr + 8, @@ -1694,7 +1694,7 @@ CsrResult unifi_bulk_rw(card_t *card, CsrUint32 handle, void *pdata, * --------------------------------------------------------------------------- */ CsrResult unifi_bulk_rw_noretry(card_t *card, CsrUint32 handle, void *pdata, - CsrUint32 len, CsrInt16 direction) + CsrUint32 len, s16 direction) { CsrResult csrResult; diff --git a/drivers/staging/csr/csr_wifi_hip_download.c b/drivers/staging/csr/csr_wifi_hip_download.c index 2a3ece3..808fae6a 100644 --- a/drivers/staging/csr/csr_wifi_hip_download.c +++ b/drivers/staging/csr/csr_wifi_hip_download.c @@ -562,7 +562,7 @@ static CsrResult safe_read_shared_location(card_t *card, CsrUint32 address, u8 * CsrResult unifi_do_loader_op(card_t *card, CsrUint32 op_addr, u8 opcode) { CsrResult r; - CsrInt16 op_retries; + s16 op_retries; unifi_trace(card->ospriv, UDBG4, "Loader cmd 0x%0x -> 0x%08x\n", opcode, op_addr); diff --git a/drivers/staging/csr/csr_wifi_hip_dump.c b/drivers/staging/csr/csr_wifi_hip_dump.c index fa9b697..da1a7ac 100644 --- a/drivers/staging/csr/csr_wifi_hip_dump.c +++ b/drivers/staging/csr/csr_wifi_hip_dump.c @@ -40,7 +40,7 @@ typedef struct coredump_buf { u16 count; /* serial number of dump */ CsrTime timestamp; /* host's system time at capture */ - CsrInt16 requestor; /* request: 0=auto dump, 1=manual */ + s16 requestor; /* request: 0=auto dump, 1=manual */ u16 chip_ver; CsrUint32 fw_ver; u16 *zone[HIP_CDUMP_NUM_ZONES]; @@ -827,8 +827,8 @@ void unifi_coredump_free(card_t *card) { void *ospriv = card->ospriv; coredump_buffer *node, *del_node; - CsrInt16 i = 0; - CsrInt16 j; + s16 i = 0; + s16 j; func_enter(); unifi_trace(ospriv, UDBG2, "Core dump de-configured\n"); diff --git a/drivers/staging/csr/csr_wifi_hip_packing.c b/drivers/staging/csr/csr_wifi_hip_packing.c index 968926b..f3a192d 100644 --- a/drivers/staging/csr/csr_wifi_hip_packing.c +++ b/drivers/staging/csr/csr_wifi_hip_packing.c @@ -2986,7 +2986,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) */ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) { - CsrInt16 index = 0; + s16 index = 0; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->SignalPrimitiveHeader.SignalId, ptr + index); index += SIZEOF_UINT16; diff --git a/drivers/staging/csr/csr_wifi_hip_send.c b/drivers/staging/csr/csr_wifi_hip_send.c index 5d6b18b..3e0e72e 100644 --- a/drivers/staging/csr/csr_wifi_hip_send.c +++ b/drivers/staging/csr/csr_wifi_hip_send.c @@ -106,9 +106,9 @@ static CsrResult send_signal(card_t *card, const u8 *sigptr, CsrUint32 siglen, { u16 i, data_slot_size; card_signal_t *csptr; - CsrInt16 qe; + s16 qe; CsrResult r; - CsrInt16 debug_print = 0; + s16 debug_print = 0; data_slot_size = CardGetDataSlotSize(card); diff --git a/drivers/staging/csr/csr_wifi_hip_sigs.h b/drivers/staging/csr/csr_wifi_hip_sigs.h index a649e14..d9c9d1e 100644 --- a/drivers/staging/csr/csr_wifi_hip_sigs.h +++ b/drivers/staging/csr/csr_wifi_hip_sigs.h @@ -20,7 +20,7 @@ extern "C" { #endif -typedef CsrInt16 csr_place_holding_type; +typedef s16 csr_place_holding_type; typedef u16 CSR_ASSOCIATION_ID; @@ -71,7 +71,7 @@ typedef enum CSR_CONNECTION_STATUS CSR_CONNECTED_AWAKE = 0x0001 } CSR_CONNECTION_STATUS; -typedef CsrInt16 CSR_DECIBELS; +typedef s16 CSR_DECIBELS; typedef enum CSR_DIRECTION { @@ -542,7 +542,7 @@ typedef struct CSR_MLME_RESET_REQUEST CSR_DATAREF Dummydataref1; CSR_DATAREF Dummydataref2; CSR_MACADDRESS StaAddress; - CsrInt16 SetDefaultMib; + s16 SetDefaultMib; } CSR_MLME_RESET_REQUEST; typedef struct CSR_MLME_SET_CONFIRM @@ -582,7 +582,7 @@ typedef u16 CSR_SEQUENCE_NUMBER; typedef struct CSR_SIGNAL_PRIMITIVE_HEADER { - CsrInt16 SignalId; + s16 SignalId; CSR_PROCESS_ID ReceiverProcessId; CSR_PROCESS_ID SenderProcessId; } CSR_SIGNAL_PRIMITIVE_HEADER; @@ -685,7 +685,7 @@ typedef struct CSR_MA_VIF_AVAILABILITY_INDICATION CSR_DATAREF Dummydataref1; CSR_DATAREF Dummydataref2; CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CsrInt16 Multicast; + s16 Multicast; } CSR_MA_VIF_AVAILABILITY_INDICATION; typedef struct CSR_MA_VIF_AVAILABILITY_RESPONSE @@ -776,7 +776,7 @@ typedef struct CSR_MLME_ADD_PERIODIC_REQUEST CSR_PERIODIC_ID PeriodicId; CSR_MICROSECONDS32 MaximumLatency; CSR_PERIODIC_SCHEDULING_MODE PeriodicSchedulingMode; - CsrInt16 WakeHost; + s16 WakeHost; CSR_PRIORITY UserPriority; } CSR_MLME_ADD_PERIODIC_REQUEST; @@ -1108,7 +1108,7 @@ typedef struct CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST CSR_DATAREF Dummydataref2; CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; CSR_AUTONOMOUS_SCAN_ID AutonomousScanId; - CsrInt16 Pause; + s16 Pause; } CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST; typedef struct CSR_MLME_POWERMGT_CONFIRM @@ -1125,7 +1125,7 @@ typedef struct CSR_MLME_POWERMGT_REQUEST CSR_DATAREF Dummydataref2; CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; CSR_POWER_MANAGEMENT_MODE PowerManagementMode; - CsrInt16 ReceiveDtims; + s16 ReceiveDtims; CSR_BEACON_PERIODS ListenInterval; CSR_TRAFFIC_WINDOW TrafficWindow; } CSR_MLME_POWERMGT_REQUEST; @@ -1229,7 +1229,7 @@ typedef struct CSR_MLME_SET_TIM_REQUEST CSR_DATAREF Dummydataref2; CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; CSR_ASSOCIATION_ID AssociationId; - CsrInt16 TimValue; + s16 TimValue; } CSR_MLME_SET_TIM_REQUEST; typedef struct CSR_MLME_SM_START_CONFIRM diff --git a/drivers/staging/csr/csr_wifi_hip_ta_sampling.c b/drivers/staging/csr/csr_wifi_hip_ta_sampling.c index 1dabd84..b53abbf 100644 --- a/drivers/staging/csr/csr_wifi_hip_ta_sampling.c +++ b/drivers/staging/csr/csr_wifi_hip_ta_sampling.c @@ -271,7 +271,7 @@ static enum ta_frame_identity ta_detect_protocol(card_t *card, CsrWifiRouterCtrl static void tas_reset_data(ta_data_t *tad) { - CsrInt16 i; + s16 i; for (i = 0; i < (TA_INTERVALS_NUM + 1); i++) { diff --git a/drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c b/drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c index 07aa954..8bc968c 100644 --- a/drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c +++ b/drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c @@ -12,7 +12,7 @@ struct sig_name { - CsrInt16 id; + s16 id; const CsrCharString *name; }; diff --git a/drivers/staging/csr/csr_wifi_hip_xbv.c b/drivers/staging/csr/csr_wifi_hip_xbv.c index cc590d7..3236b2b 100644 --- a/drivers/staging/csr/csr_wifi_hip_xbv.c +++ b/drivers/staging/csr/csr_wifi_hip_xbv.c @@ -492,7 +492,7 @@ static CsrInt32 xbv_push(xbv1_t *fwinfo, xbv_stack_t *stack, static CsrUint32 xbv2uint(u8 *ptr, CsrInt32 len) { CsrUint32 u = 0; - CsrInt16 i; + s16 i; for (i = 0; i < len; i++) { @@ -642,7 +642,7 @@ static u16 calc_checksum(void *buf, const CsrUint32 offset, const CsrUint32 byte static CsrUint32 calc_patch_size(const xbv1_t *fwinfo) { - CsrInt16 i; + s16 i; CsrUint32 size = 0; /* @@ -744,7 +744,7 @@ static CsrUint32 write_fwdl_to_ptdl(void *buf, const CsrUint32 offset, fwreadfn_ const CsrUint32 fw_id, void *fw_buf) { CsrUint32 written = 0; - CsrInt16 chunks = 0; + s16 chunks = 0; CsrUint32 left = fwdl->dl_size; /* Bytes left in this fwdl */ CsrUint32 dl_addr = fwdl->dl_addr; /* Target address of fwdl image on XAP */ CsrUint32 dl_offs = fwdl->dl_offset; /* Offset of fwdl image data in source */ @@ -873,7 +873,7 @@ static CsrUint32 write_reset_ptdl(void *buf, const CsrUint32 offset, const xbv1_ CsrInt32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo, symbol_t *slut, CsrUint32 slut_len) { - CsrInt16 i; + s16 i; CsrInt32 offset; CsrUint32 magic; CsrUint32 count = 0; @@ -974,7 +974,7 @@ void* xbv_to_patch(card_t *card, fwreadfn_t readfn, void *patch_buf = NULL; CsrUint32 patch_buf_size; CsrUint32 payload_offs = 0; /* Start of XBV payload */ - CsrInt16 i; + s16 i; CsrUint32 patch_offs = 0; CsrUint32 list_len_offs = 0; /* Offset of PTDL LIST length parameter */ CsrUint32 ptdl_start_offs = 0; /* Offset of first PTDL chunk */ diff --git a/drivers/staging/csr/csr_wifi_hip_xbv.h b/drivers/staging/csr/csr_wifi_hip_xbv.h index f5c3e80..abf6e4b 100644 --- a/drivers/staging/csr/csr_wifi_hip_xbv.h +++ b/drivers/staging/csr/csr_wifi_hip_xbv.h @@ -98,7 +98,7 @@ typedef struct /* F/W download image, possibly more than one part */ struct FWDL fwdl[MAX_FWDL]; - CsrInt16 num_fwdl; + s16 num_fwdl; /* F/W overlay image, add r not used */ struct FWOV fwov; @@ -108,7 +108,7 @@ typedef struct CsrUint32 build_id; struct PTDL ptdl[MAX_PTDL]; - CsrInt16 num_ptdl; + s16 num_ptdl; } xbv1_t; diff --git a/drivers/staging/csr/csr_wifi_router_prim.h b/drivers/staging/csr/csr_wifi_router_prim.h index b05ce1a..c281f02 100644 --- a/drivers/staging/csr/csr_wifi_router_prim.h +++ b/drivers/staging/csr/csr_wifi_router_prim.h @@ -416,8 +416,8 @@ typedef struct u16 frameLength; u8 *frame; CsrWifiRouterFrameFreeFunction freeFunction; - CsrInt16 rssi; - CsrInt16 snr; + s16 rssi; + s16 snr; u16 rate; } CsrWifiRouterMaPacketInd; diff --git a/drivers/staging/csr/csr_wifi_router_serialize.c b/drivers/staging/csr/csr_wifi_router_serialize.c index e488564..7711fa5 100644 --- a/drivers/staging/csr/csr_wifi_router_serialize.c +++ b/drivers/staging/csr/csr_wifi_router_serialize.c @@ -354,8 +354,8 @@ CsrSize CsrWifiRouterMaPacketIndSizeof(void *msg) bufferSize += 2; /* u16 primitive->frameLength */ bufferSize += primitive->frameLength; /* u8 primitive->frame */ bufferSize += 4; /* CsrWifiRouterFrameFreeFunction primitive->freeFunction */ - bufferSize += 2; /* CsrInt16 primitive->rssi */ - bufferSize += 2; /* CsrInt16 primitive->snr */ + bufferSize += 2; /* s16 primitive->rssi */ + bufferSize += 2; /* s16 primitive->snr */ bufferSize += 2; /* u16 primitive->rate */ return bufferSize; } diff --git a/drivers/staging/csr/csr_wifi_sme_prim.h b/drivers/staging/csr/csr_wifi_sme_prim.h index 731f4bf..1732506 100644 --- a/drivers/staging/csr/csr_wifi_sme_prim.h +++ b/drivers/staging/csr/csr_wifi_sme_prim.h @@ -2204,8 +2204,8 @@ typedef struct *******************************************************************************/ typedef struct { - CsrInt16 unifiRssi; - CsrInt16 unifiSnr; + s16 unifiRssi; + s16 unifiSnr; } CsrWifiSmeLinkQuality; /******************************************************************************* @@ -2366,10 +2366,10 @@ typedef struct *******************************************************************************/ typedef struct { - CsrInt16 rssiHighThreshold; - CsrInt16 rssiLowThreshold; - CsrInt16 snrHighThreshold; - CsrInt16 snrLowThreshold; + s16 rssiHighThreshold; + s16 rssiLowThreshold; + s16 snrHighThreshold; + s16 snrLowThreshold; } CsrWifiSmeRoamingBandData; /******************************************************************************* @@ -3141,8 +3141,8 @@ typedef struct { CsrWifiSsid ssid; CsrWifiMacAddress bssid; - CsrInt16 rssi; - CsrInt16 snr; + s16 rssi; + s16 snr; CsrWifiSmeRadioIF ifIndex; u16 beaconPeriodTu; CsrWifiSmeTsfTime timeStamp; diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.c b/drivers/staging/csr/csr_wifi_sme_serialize.c index 0e3096e..b5ffdce 100644 --- a/drivers/staging/csr/csr_wifi_sme_serialize.c +++ b/drivers/staging/csr/csr_wifi_sme_serialize.c @@ -1012,10 +1012,10 @@ CsrSize CsrWifiSmeRoamingConfigSetReqSizeof(void *msg) u16 i2; for (i2 = 0; i2 < 3; i2++) { - bufferSize += 2; /* CsrInt16 primitive->roamingConfig.roamingBands[i2].rssiHighThreshold */ - bufferSize += 2; /* CsrInt16 primitive->roamingConfig.roamingBands[i2].rssiLowThreshold */ - bufferSize += 2; /* CsrInt16 primitive->roamingConfig.roamingBands[i2].snrHighThreshold */ - bufferSize += 2; /* CsrInt16 primitive->roamingConfig.roamingBands[i2].snrLowThreshold */ + bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].rssiHighThreshold */ + bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].rssiLowThreshold */ + bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].snrHighThreshold */ + bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].snrLowThreshold */ } } bufferSize += 1; /* CsrBool primitive->roamingConfig.disableSmoothRoaming */ @@ -2957,8 +2957,8 @@ CsrSize CsrWifiSmeConnectionQualityIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrInt16 primitive->linkQuality.unifiRssi */ - bufferSize += 2; /* CsrInt16 primitive->linkQuality.unifiSnr */ + bufferSize += 2; /* s16 primitive->linkQuality.unifiRssi */ + bufferSize += 2; /* s16 primitive->linkQuality.unifiSnr */ return bufferSize; } @@ -3303,8 +3303,8 @@ CsrSize CsrWifiSmeLinkQualityGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 2; /* CsrInt16 primitive->linkQuality.unifiRssi */ - bufferSize += 2; /* CsrInt16 primitive->linkQuality.unifiSnr */ + bufferSize += 2; /* s16 primitive->linkQuality.unifiRssi */ + bufferSize += 2; /* s16 primitive->linkQuality.unifiSnr */ return bufferSize; } @@ -4252,10 +4252,10 @@ CsrSize CsrWifiSmeRoamingConfigGetCfmSizeof(void *msg) u16 i2; for (i2 = 0; i2 < 3; i2++) { - bufferSize += 2; /* CsrInt16 primitive->roamingConfig.roamingBands[i2].rssiHighThreshold */ - bufferSize += 2; /* CsrInt16 primitive->roamingConfig.roamingBands[i2].rssiLowThreshold */ - bufferSize += 2; /* CsrInt16 primitive->roamingConfig.roamingBands[i2].snrHighThreshold */ - bufferSize += 2; /* CsrInt16 primitive->roamingConfig.roamingBands[i2].snrLowThreshold */ + bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].rssiHighThreshold */ + bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].rssiLowThreshold */ + bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].snrHighThreshold */ + bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].snrLowThreshold */ } } bufferSize += 1; /* CsrBool primitive->roamingConfig.disableSmoothRoaming */ @@ -4519,8 +4519,8 @@ CsrSize CsrWifiSmeScanResultIndSizeof(void *msg) bufferSize += 32; /* u8 primitive->result.ssid.ssid[32] */ bufferSize += 1; /* u8 primitive->result.ssid.length */ bufferSize += 6; /* u8 primitive->result.bssid.a[6] */ - bufferSize += 2; /* CsrInt16 primitive->result.rssi */ - bufferSize += 2; /* CsrInt16 primitive->result.snr */ + bufferSize += 2; /* s16 primitive->result.rssi */ + bufferSize += 2; /* s16 primitive->result.snr */ bufferSize += 1; /* CsrWifiSmeRadioIF primitive->result.ifIndex */ bufferSize += 2; /* u16 primitive->result.beaconPeriodTu */ bufferSize += 8; /* u8 primitive->result.timeStamp.data[8] */ @@ -4818,8 +4818,8 @@ CsrSize CsrWifiSmeScanResultsGetCfmSizeof(void *msg) bufferSize += 32; /* u8 primitive->scanResults[i1].ssid.ssid[32] */ bufferSize += 1; /* u8 primitive->scanResults[i1].ssid.length */ bufferSize += 6; /* u8 primitive->scanResults[i1].bssid.a[6] */ - bufferSize += 2; /* CsrInt16 primitive->scanResults[i1].rssi */ - bufferSize += 2; /* CsrInt16 primitive->scanResults[i1].snr */ + bufferSize += 2; /* s16 primitive->scanResults[i1].rssi */ + bufferSize += 2; /* s16 primitive->scanResults[i1].snr */ bufferSize += 1; /* CsrWifiSmeRadioIF primitive->scanResults[i1].ifIndex */ bufferSize += 2; /* u16 primitive->scanResults[i1].beaconPeriodTu */ bufferSize += 8; /* u8 primitive->scanResults[i1].timeStamp.data[8] */ diff --git a/drivers/staging/csr/sme_sys.c b/drivers/staging/csr/sme_sys.c index c3d9c6a..59909a4 100644 --- a/drivers/staging/csr/sme_sys.c +++ b/drivers/staging/csr/sme_sys.c @@ -3095,7 +3095,7 @@ void CsrWifiRouterCtrlWapiRxPktReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) memcpy((void*)bulkdata.d[0].os_data_ptr, req->data, req->dataLength); - receiver_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN((req->signal) + sizeof(CsrInt16)) & 0xFFF0; + receiver_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN((req->signal) + sizeof(s16)) & 0xFFF0; client_id = (receiver_id & 0x0F00) >> UDI_SENDER_ID_SHIFT; client = &priv->ul_clients[client_id]; diff --git a/drivers/staging/csr/unifi_event.c b/drivers/staging/csr/unifi_event.c index c2ef2ee..f1b8cc5 100644 --- a/drivers/staging/csr/unifi_event.c +++ b/drivers/staging/csr/unifi_event.c @@ -373,24 +373,24 @@ unifi_process_receive_event(void *ospriv, unifi_priv_t *priv = (unifi_priv_t*)ospriv; int i, receiver_id; int client_id; - CsrInt16 signal_id; + s16 signal_id; CsrBool pktIndToSme = FALSE, freeBulkData = FALSE; func_enter(); unifi_trace(priv, UDBG5, "unifi_process_receive_event: " "%04x %04x %04x %04x %04x %04x %04x %04x (%d)\n", - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*0) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*1) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*2) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*3) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*4) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*5) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*6) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*7) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*0) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*1) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*2) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*3) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*4) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*5) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*6) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*7) & 0xFFFF, siglen); - receiver_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)) & 0xFF00; + receiver_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)) & 0xFF00; client_id = (receiver_id & 0x0F00) >> UDI_SENDER_ID_SHIFT; signal_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata); @@ -659,14 +659,14 @@ unifi_receive_event(void *ospriv, unifi_trace(priv, UDBG5, "unifi_receive_event: " "%04x %04x %04x %04x %04x %04x %04x %04x (%d)\n", - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*0) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*1) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*2) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*3) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*4) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*5) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*6) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(CsrInt16)*7) & 0xFFFF, siglen); + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*0) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*1) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*2) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*3) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*4) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*5) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*6) & 0xFFFF, + CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*7) & 0xFFFF, siglen); if(signal_buffer_is_full(priv)) { unifi_error(priv,"TO HOST signal queue FULL dropping the PDU\n"); for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { -- cgit v0.10.2 From 26a6b2e1688bc154a16778851d710e90b62f715e Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 12:05:42 -0700 Subject: staging: csr: remove CsrUint32 typedef MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the in-kernel u32 type instead. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/bh.c b/drivers/staging/csr/bh.c index bfc2f9e..b089c28 100644 --- a/drivers/staging/csr/bh.c +++ b/drivers/staging/csr/bh.c @@ -227,7 +227,7 @@ bh_thread_function(void *arg) unifi_priv_t *priv = (unifi_priv_t*)arg; CsrResult csrResult; long ret; - CsrUint32 timeout, t; + u32 timeout, t; struct uf_thread *this_thread; unifi_trace(priv, UDBG2, "bh_thread_function starting\n"); diff --git a/drivers/staging/csr/csr_framework_ext.h b/drivers/staging/csr/csr_framework_ext.h index 942db87..82da0a4 100644 --- a/drivers/staging/csr/csr_framework_ext.h +++ b/drivers/staging/csr/csr_framework_ext.h @@ -66,7 +66,7 @@ CsrResult CsrEventCreate(CsrEventHandle *eventHandle); * CSR_FE_RESULT_INVALID_POINTER in case the eventBits pointer is invalid * *----------------------------------------------------------------------------*/ -CsrResult CsrEventWait(CsrEventHandle *eventHandle, u16 timeoutInMs, CsrUint32 *eventBits); +CsrResult CsrEventWait(CsrEventHandle *eventHandle, u16 timeoutInMs, u32 *eventBits); /*----------------------------------------------------------------------------* * NAME @@ -81,7 +81,7 @@ CsrResult CsrEventWait(CsrEventHandle *eventHandle, u16 timeoutInMs, CsrUint32 * * CSR_FE_RESULT_INVALID_HANDLE in case the eventHandle is invalid * *----------------------------------------------------------------------------*/ -CsrResult CsrEventSet(CsrEventHandle *eventHandle, CsrUint32 eventBits); +CsrResult CsrEventSet(CsrEventHandle *eventHandle, u32 eventBits); /*----------------------------------------------------------------------------* * NAME @@ -195,7 +195,7 @@ void CsrGlobalMutexUnlock(void); * *----------------------------------------------------------------------------*/ CsrResult CsrThreadCreate(void (*threadFunction)(void *pointer), void *pointer, - CsrUint32 stackSize, u16 priority, + u32 stackSize, u16 priority, const CsrCharString *threadName, CsrThreadHandle *threadHandle); /*----------------------------------------------------------------------------* @@ -257,7 +257,7 @@ void CsrThreadSleep(u16 sleepTimeInMs); *----------------------------------------------------------------------------*/ #ifdef CSR_MEM_DEBUG void *CsrMemAllocDebug(CsrSize size, - const CsrCharString *file, CsrUint32 line); + const CsrCharString *file, u32 line); #define CsrMemAlloc(sz) CsrMemAllocDebug((sz), __FILE__, __LINE__) #else void *CsrMemAlloc(CsrSize size); @@ -278,7 +278,7 @@ void *CsrMemAlloc(CsrSize size); *----------------------------------------------------------------------------*/ #ifdef CSR_MEM_DEBUG void *CsrMemCallocDebug(CsrSize numberOfElements, CsrSize elementSize, - const CsrCharString *file, CsrUint32 line); + const CsrCharString *file, u32 line); #define CsrMemCalloc(cnt, sz) CsrMemAllocDebug((cnt), (sz), __FILE__, __LINE__) #else void *CsrMemCalloc(CsrSize numberOfElements, CsrSize elementSize); @@ -311,7 +311,7 @@ void CsrMemFree(void *pointer); *----------------------------------------------------------------------------*/ #ifdef CSR_MEM_DEBUG void *CsrMemAllocDmaDebug(CsrSize size, - const CsrCharString *file, CsrUint32 line); + const CsrCharString *file, u32 line); #define CsrMemAllocDma(sz) CsrMemAllocDmaDebug((sz), __FILE__, __LINE__) #else void *CsrMemAllocDma(CsrSize size); diff --git a/drivers/staging/csr/csr_framework_ext_types.h b/drivers/staging/csr/csr_framework_ext_types.h index d155a2b..b1ff72f 100644 --- a/drivers/staging/csr/csr_framework_ext_types.h +++ b/drivers/staging/csr/csr_framework_ext_types.h @@ -49,7 +49,7 @@ struct CsrEvent { pthread_cond_t event; pthread_mutex_t mutex; - CsrUint32 eventBits; + u32 eventBits; }; typedef struct CsrEvent CsrEventHandle; diff --git a/drivers/staging/csr/csr_lib.h b/drivers/staging/csr/csr_lib.h index 7259b63..55768f8 100644 --- a/drivers/staging/csr/csr_lib.h +++ b/drivers/staging/csr/csr_lib.h @@ -102,7 +102,7 @@ typedef struct { CsrPrim type; u16 value1; - CsrUint32 value2; + u32 value2; } CsrEventCsrUint16CsrUint32; /*----------------------------------------------------------------------------* @@ -113,7 +113,7 @@ typedef struct * Allocates and fills in a message with the signature CsrEventCsrUint16 * *----------------------------------------------------------------------------*/ -CsrEventCsrUint16CsrUint32 *CsrEventCsrUint16CsrUint32_struct(u16 primtype, u16 msgtype, u16 value1, CsrUint32 value2); +CsrEventCsrUint16CsrUint32 *CsrEventCsrUint16CsrUint32_struct(u16 primtype, u16 msgtype, u16 value1, u32 value2); typedef struct { @@ -135,7 +135,7 @@ CsrEventCsrUint16CsrCharString *CsrEventCsrUint16CsrCharString_struct(u16 primty typedef struct { CsrPrim type; - CsrUint32 value; + u32 value; } CsrEventCsrUint32; /*----------------------------------------------------------------------------* @@ -146,12 +146,12 @@ typedef struct * Allocates and fills in a message with the signature CsrEventCsrUint32 * *----------------------------------------------------------------------------*/ -CsrEventCsrUint32 *CsrEventCsrUint32_struct(u16 primtype, u16 msgtype, CsrUint32 value); +CsrEventCsrUint32 *CsrEventCsrUint32_struct(u16 primtype, u16 msgtype, u32 value); typedef struct { CsrPrim type; - CsrUint32 value1; + u32 value1; u16 value2; } CsrEventCsrUint32CsrUint16; @@ -163,12 +163,12 @@ typedef struct * Allocates and fills in a message with the signature CsrEventCsrUint32CsrUint16 * *----------------------------------------------------------------------------*/ -CsrEventCsrUint32CsrUint16 *CsrEventCsrUint32CsrUint16_struct(u16 primtype, u16 msgtype, CsrUint32 value1, CsrUint32 value2); +CsrEventCsrUint32CsrUint16 *CsrEventCsrUint32CsrUint16_struct(u16 primtype, u16 msgtype, u32 value1, u32 value2); typedef struct { CsrPrim type; - CsrUint32 value1; + u32 value1; CsrCharString *value2; } CsrEventCsrUint32CsrCharString; @@ -180,7 +180,7 @@ typedef struct * Allocates and fills in a message with the signature CsrEventCsrUint32CsrCharString * *----------------------------------------------------------------------------*/ -CsrEventCsrUint32CsrCharString *CsrEventCsrUint32CsrCharString_struct(u16 primtype, u16 msgtype, CsrUint32 value1, CsrCharString *value2); +CsrEventCsrUint32CsrCharString *CsrEventCsrUint32CsrCharString_struct(u16 primtype, u16 msgtype, u32 value1, CsrCharString *value2); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_log.h b/drivers/staging/csr/csr_log.h index f6aaac1..748657b 100644 --- a/drivers/staging/csr/csr_log.h +++ b/drivers/staging/csr/csr_log.h @@ -27,7 +27,7 @@ extern "C" { /*----------------------------------------------------*/ /* Filtering on environment specific log levels */ /*----------------------------------------------------*/ -typedef CsrUint32 CsrLogLevelEnvironment; +typedef u32 CsrLogLevelEnvironment; #define CSR_LOG_LEVEL_ENVIRONMENT_OFF ((CsrLogLevelEnvironment) 0x00000000) /* No environment data/events are logged */ #define CSR_LOG_LEVEL_ENVIRONMENT_BCI_ACL ((CsrLogLevelEnvironment) 0x00000001) /* BlueCore Channel Interface HCI Acl data are logged */ #define CSR_LOG_LEVEL_ENVIRONMENT_BCI_HCI ((CsrLogLevelEnvironment) 0x00000002) /* BlueCore Channel Interface HCI Cmd/Evt data are logged */ @@ -47,7 +47,7 @@ typedef CsrUint32 CsrLogLevelEnvironment; /*----------------------------------------------------*/ /* Filtering on task specific log levels */ /*----------------------------------------------------*/ -typedef CsrUint32 CsrLogLevelTask; +typedef u32 CsrLogLevelTask; #define CSR_LOG_LEVEL_TASK_OFF ((CsrLogLevelTask) 0x00000000) /* No events are logged for this task */ #define CSR_LOG_LEVEL_TASK_TEXT ((CsrLogLevelTask) 0x00000001) /* Text strings printed by a task are logged NB: This bit does not affect the CSR_LOG_TEXT_LEVEL interface. This has to be configured separately */ #define CSR_LOG_LEVEL_TASK_TEXT_LOC ((CsrLogLevelTask) 0x00000002) /* The locaction where the text string call occured are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_TEXT, it has no effect without it */ @@ -104,7 +104,7 @@ typedef struct typedef struct { const CsrCharString *techVer; - CsrUint32 primitiveInfoCount; + u32 primitiveInfoCount; CsrLogPrimitiveInformation *primitiveInfo; } CsrLogTechInformation; @@ -113,7 +113,7 @@ typedef struct /*---------------------------------*/ typedef u8 bitmask8_t; typedef u16 bitmask16_t; -typedef CsrUint32 bitmask32_t; +typedef u32 bitmask32_t; #ifdef CSR_LOG_ENABLE #ifdef CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER @@ -141,7 +141,7 @@ typedef CsrUint32 bitmask32_t; /* DEPRECATED - replaced by csr_log_text.h */ void CsrLogTaskText(const CsrCharString *text, - CsrUint32 line, + u32 line, const CsrCharString *file); #define CSR_LOG_STATE_TRANSITION_MASK_FSM_NAME (0x001) @@ -154,15 +154,15 @@ void CsrLogTaskText(const CsrCharString *text, /* DEPRECATED - replaced by csr_log_text.h */ void CsrLogStateTransition(bitmask16_t mask, - CsrUint32 identifier, + u32 identifier, const CsrCharString *fsm_name, - CsrUint32 prev_state, + u32 prev_state, const CsrCharString *prev_state_str, - CsrUint32 in_event, + u32 in_event, const CsrCharString *in_event_str, - CsrUint32 next_state, + u32 next_state, const CsrCharString *next_state_str, - CsrUint32 line, + u32 line, const CsrCharString *file); /*---------------------------------*/ @@ -183,7 +183,7 @@ void CsrLogDeactivate(CsrSchedQid tskid); #define SYNERGY_SERIALIZER_TYPE_DUMP (0x000) #define SYNERGY_SERIALIZER_TYPE_SER (0x001) -void CsrLogMessagePut(CsrUint32 line, +void CsrLogMessagePut(u32 line, const CsrCharString *file, CsrSchedQid src_task_id, CsrSchedQid dst_taskid, @@ -198,7 +198,7 @@ void CsrLogMessageGet(CsrSchedQid src_task_id, u16 prim_type, const void *msg); -void CsrLogTimedEventIn(CsrUint32 line, +void CsrLogTimedEventIn(u32 line, const CsrCharString *file, CsrSchedQid task_id, CsrSchedTid tid, @@ -212,7 +212,7 @@ void CsrLogTimedEventFire(CsrSchedQid task_id, void CsrLogTimedEventDone(CsrSchedQid task_id, CsrSchedTid tid); -void CsrLogTimedEventCancel(CsrUint32 line, +void CsrLogTimedEventCancel(u32 line, const CsrCharString *file, CsrSchedQid task_id, CsrSchedTid tid, @@ -230,17 +230,17 @@ void CsrLogBgintServiceDone(CsrSchedBgint irq); void CsrLogExceptionStateEvent(u16 prim_type, CsrPrim msg_type, u16 state, - CsrUint32 line, + u32 line, const CsrCharString *file); void CsrLogExceptionGeneral(u16 prim_type, u16 state, const CsrCharString *text, - CsrUint32 line, + u32 line, const CsrCharString *file); void CsrLogExceptionWarning(u16 prim_type, u16 state, const CsrCharString *text, - CsrUint32 line, + u32 line, const CsrCharString *file); #ifdef __cplusplus diff --git a/drivers/staging/csr/csr_log_configure.h b/drivers/staging/csr/csr_log_configure.h index c47016b..60e7be9 100644 --- a/drivers/staging/csr/csr_log_configure.h +++ b/drivers/staging/csr/csr_log_configure.h @@ -45,7 +45,7 @@ void CsrLogLevelTaskSetSpecific(CsrSchedQid taskId, CsrLogLevelTask taskLogLevel /*--------------------------------------------*/ /* Filtering on log text warning levels */ /*--------------------------------------------*/ -typedef CsrUint32 CsrLogLevelText; +typedef u32 CsrLogLevelText; #define CSR_LOG_LEVEL_TEXT_OFF ((CsrLogLevelText) 0x0000) #define CSR_LOG_LEVEL_TEXT_CRITICAL ((CsrLogLevelText) 0x0001) @@ -64,7 +64,7 @@ typedef CsrUint32 CsrLogLevelText; * clashes the technologies are only allowed to assign values within the same restrictive range as allies to * primitive identifiers. eg. for the framework components outside the scheduler is only allowed to assign * taskId's in the range 0x0600xxxx to 0x06FFxxxx. And so on for other technologies. */ -typedef CsrUint32 CsrLogTextTaskId; +typedef u32 CsrLogTextTaskId; /* Set the text logging level for all Tasks */ /* This function call takes precedence over all previous calls to CsrLogLevelTextSetTask() and CsrLogLevelTextSetTaskSubOrigin() */ diff --git a/drivers/staging/csr/csr_macro.h b/drivers/staging/csr/csr_macro.h index 7656e2a..92cdb8d 100644 --- a/drivers/staging/csr/csr_macro.h +++ b/drivers/staging/csr/csr_macro.h @@ -17,7 +17,7 @@ extern "C" { #endif /*------------------------------------------------------------------*/ -/* Bits - intended to operate on CsrUint32 values */ +/* Bits - intended to operate on u32 values */ /*------------------------------------------------------------------*/ #define CSR_MASK_IS_SET(val, mask) (((val) & (mask)) == (mask)) #define CSR_MASK_IS_UNSET(val, mask) ((((val) & (mask)) ^ mask) == (mask)) @@ -32,8 +32,8 @@ extern "C" { /* Endian conversion */ /*------------------------------------------------------------------*/ #define CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr) (((u16) ((u8 *) (ptr))[0]) | ((u16) ((u8 *) (ptr))[1]) << 8) -#define CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr) (((CsrUint32) ((u8 *) (ptr))[0]) | ((CsrUint32) ((u8 *) (ptr))[1]) << 8 | \ - ((CsrUint32) ((u8 *) (ptr))[2]) << 16 | ((CsrUint32) ((u8 *) (ptr))[3]) << 24) +#define CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr) (((u32) ((u8 *) (ptr))[0]) | ((u32) ((u8 *) (ptr))[1]) << 8 | \ + ((u32) ((u8 *) (ptr))[2]) << 16 | ((u32) ((u8 *) (ptr))[3]) << 24) #define CSR_COPY_UINT16_TO_LITTLE_ENDIAN(uint, ptr) ((u8 *) (ptr))[0] = ((u8) ((uint) & 0x00FF)); \ ((u8 *) (ptr))[1] = ((u8) ((uint) >> 8)) #define CSR_COPY_UINT32_TO_LITTLE_ENDIAN(uint, ptr) ((u8 *) (ptr))[0] = ((u8) ((uint) & 0x000000FF)); \ @@ -43,8 +43,8 @@ extern "C" { #define CSR_GET_UINT16_FROM_BIG_ENDIAN(ptr) (((u16) ((u8 *) (ptr))[1]) | ((u16) ((u8 *) (ptr))[0]) << 8) #define CSR_GET_UINT24_FROM_BIG_ENDIAN(ptr) (((CsrUint24) ((u8 *) (ptr))[2]) | \ ((CsrUint24) ((u8 *) (ptr))[1]) << 8 | ((CsrUint24) ((u8 *) (ptr))[0]) << 16) -#define CSR_GET_UINT32_FROM_BIG_ENDIAN(ptr) (((CsrUint32) ((u8 *) (ptr))[3]) | ((CsrUint32) ((u8 *) (ptr))[2]) << 8 | \ - ((CsrUint32) ((u8 *) (ptr))[1]) << 16 | ((CsrUint32) ((u8 *) (ptr))[0]) << 24) +#define CSR_GET_UINT32_FROM_BIG_ENDIAN(ptr) (((u32) ((u8 *) (ptr))[3]) | ((u32) ((u8 *) (ptr))[2]) << 8 | \ + ((u32) ((u8 *) (ptr))[1]) << 16 | ((u32) ((u8 *) (ptr))[0]) << 24) #define CSR_COPY_UINT16_TO_BIG_ENDIAN(uint, ptr) ((u8 *) (ptr))[1] = ((u8) ((uint) & 0x00FF)); \ ((u8 *) (ptr))[0] = ((u8) ((uint) >> 8)) #define CSR_COPY_UINT24_TO_BIG_ENDIAN(uint, ptr) ((u8 *) (ptr))[2] = ((u8) ((uint) & 0x000000FF)); \ @@ -70,10 +70,10 @@ extern "C" { ((u16) (input)[0]));(input) += 2 #define CSR_CONVERT_32_FROM_XAP(output, input) \ - (output) = (((CsrUint32) (input)[1]) << 24) | \ - (((CsrUint32) (input)[0]) << 16) | \ - (((CsrUint32) (input)[3]) << 8) | \ - ((CsrUint32) (input)[2]);input += 4 + (output) = (((u32) (input)[1]) << 24) | \ + (((u32) (input)[0]) << 16) | \ + (((u32) (input)[3]) << 8) | \ + ((u32) (input)[2]);input += 4 #define CSR_ADD_UINT8_TO_XAP(output, input) \ (output)[0] = (input); \ diff --git a/drivers/staging/csr/csr_msgconv.h b/drivers/staging/csr/csr_msgconv.h index 7438f95..0f614bc 100644 --- a/drivers/staging/csr/csr_msgconv.h +++ b/drivers/staging/csr/csr_msgconv.h @@ -73,14 +73,14 @@ void CsrMsgConvDeinit(void); /* SHOULD BE INTERNAL TO FRAMEWORK AKA DEPRECATED */ -CsrUint32 CsrCharStringSerLen(const CsrCharString *str); -CsrUint32 CsrUtf8StringSerLen(const CsrUtf8String *str); -CsrUint32 CsrUtf16StringSerLen(const CsrUtf16String *str); +u32 CsrCharStringSerLen(const CsrCharString *str); +u32 CsrUtf8StringSerLen(const CsrUtf8String *str); +u32 CsrUtf16StringSerLen(const CsrUtf16String *str); /* Prototypes for primitive type serializers */ void CsrUint8Ser(u8 *buffer, CsrSize *offset, u8 value); void CsrUint16Ser(u8 *buffer, CsrSize *offset, u16 value); -void CsrUint32Ser(u8 *buffer, CsrSize *offset, CsrUint32 value); +void CsrUint32Ser(u8 *buffer, CsrSize *offset, u32 value); void CsrMemCpySer(u8 *buffer, CsrSize *offset, const void *value, CsrSize length); void CsrCharStringSer(u8 *buffer, CsrSize *offset, const CsrCharString *value); void CsrUtf8StringSer(u8 *buffer, CsrSize *offset, const CsrUtf8String *value); @@ -90,7 +90,7 @@ void CsrSizeSer(u8 *buffer, CsrSize *offset, CsrSize value); void CsrUint8Des(u8 *value, u8 *buffer, CsrSize *offset); void CsrUint16Des(u16 *value, u8 *buffer, CsrSize *offset); -void CsrUint32Des(CsrUint32 *value, u8 *buffer, CsrSize *offset); +void CsrUint32Des(u32 *value, u8 *buffer, CsrSize *offset); void CsrMemCpyDes(void *value, u8 *buffer, CsrSize *offset, CsrSize length); void CsrCharStringDes(CsrCharString **value, u8 *buffer, CsrSize *offset); void CsrUtf8StringDes(CsrUtf8String **value, u8 *buffer, CsrSize *offset); diff --git a/drivers/staging/csr/csr_pmem.h b/drivers/staging/csr/csr_pmem.h index 4007915..be21186 100644 --- a/drivers/staging/csr/csr_pmem.h +++ b/drivers/staging/csr/csr_pmem.h @@ -39,7 +39,7 @@ extern "C" { *****************************************************************************/ #ifdef CSR_PMEM_DEBUG void *CsrPmemAllocDebug(CsrSize size, - const CsrCharString *file, CsrUint32 line); + const CsrCharString *file, u32 line); #define CsrPmemAlloc(sz) CsrPmemAllocDebug((sz), __FILE__, __LINE__) #else void *CsrPmemAlloc(CsrSize size); @@ -108,8 +108,8 @@ typedef u8 CsrPmemDebugAllocType; #define CSR_PMEM_DEBUG_TYPE_MEM_CALLOC 3 #define CSR_PMEM_DEBUG_TYPE_MEM_ALLOC_DMA 4 -typedef void (CsrPmemDebugOnAlloc)(void *ptr, void *userptr, CsrSize size, CsrPmemDebugAllocType type, const CsrCharString* file, CsrUint32 line); -typedef void (CsrPmemDebugOnFree)(void *ptr, void *userptr, CsrPmemDebugAllocType type, const CsrCharString* file, CsrUint32 line); +typedef void (CsrPmemDebugOnAlloc)(void *ptr, void *userptr, CsrSize size, CsrPmemDebugAllocType type, const CsrCharString* file, u32 line); +typedef void (CsrPmemDebugOnFree)(void *ptr, void *userptr, CsrPmemDebugAllocType type, const CsrCharString* file, u32 line); /*----------------------------------------------------------------------------* * NAME @@ -127,10 +127,10 @@ typedef void (CsrPmemDebugOnFree)(void *ptr, void *userptr, CsrPmemDebugAllocTyp *----------------------------------------------------------------------------*/ void CsrPmemDebugInstallHooks(u8 headSize, u8 endSize, CsrPmemDebugOnAlloc *onAllocCallback, CsrPmemDebugOnFree *onFreeCallback); -void *CsrPmemDebugAlloc(CsrSize size, CsrPmemDebugAllocType type, const CsrCharString* file, CsrUint32 line); +void *CsrPmemDebugAlloc(CsrSize size, CsrPmemDebugAllocType type, const CsrCharString* file, u32 line); #define CsrPmemAlloc(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_PMEM_ALLOC, __FILE__, __LINE__) -void CsrPmemDebugFree(void *ptr, CsrPmemDebugAllocType type, const CsrCharString* file, CsrUint32 line); +void CsrPmemDebugFree(void *ptr, CsrPmemDebugAllocType type, const CsrCharString* file, u32 line); #define CsrPmemFree(ptr) CsrPmemDebugFree(ptr, CSR_PMEM_DEBUG_TYPE_PMEM_ALLOC, __FILE__, __LINE__) #endif diff --git a/drivers/staging/csr/csr_sched.h b/drivers/staging/csr/csr_sched.h index 944b7c1..530ee28 100644 --- a/drivers/staging/csr/csr_sched.h +++ b/drivers/staging/csr/csr_sched.h @@ -17,7 +17,7 @@ extern "C" { #endif /* An identifier issued by the scheduler. */ -typedef CsrUint32 CsrSchedIdentifier; +typedef u32 CsrSchedIdentifier; /* A task identifier */ typedef u16 CsrSchedTaskId; @@ -135,7 +135,7 @@ void CsrSchedBgintSet(CsrSchedBgint bgint); void CsrSchedMessagePutStringLog(CsrSchedQid q, u16 mi, void *mv, - CsrUint32 line, + u32 line, const CsrCharString *file); #define CsrSchedMessagePut(q, mi, mv) CsrSchedMessagePutStringLog((q), (mi), (mv), __LINE__, __FILE__) #else @@ -167,7 +167,7 @@ void CsrSchedMessagePut(CsrSchedQid q, void CsrSchedMessageBroadcastStringLog(u16 mi, void *(*msg_build_func)(void *), void *msg_build_ptr, - CsrUint32 line, + u32 line, const CsrCharString *file); #define CsrSchedMessageBroadcast(mi, fn, ptr) CsrSchedMessageBroadcastStringLog((mi), (fn), (ptr), __LINE__, __FILE__) #else @@ -222,7 +222,7 @@ CsrSchedTid CsrSchedTimerSetStringLog(CsrTime delay, void (*fn)(u16 mi, void *mv), u16 fniarg, void *fnvarg, - CsrUint32 line, + u32 line, const CsrCharString *file); #define CsrSchedTimerSet(d, fn, fni, fnv) CsrSchedTimerSetStringLog((d), (fn), (fni), (fnv), __LINE__, __FILE__) #else @@ -248,7 +248,7 @@ CsrSchedTid CsrSchedTimerSet(CsrTime delay, CsrBool CsrSchedTimerCancelStringLog(CsrSchedTid eventid, u16 *pmi, void **pmv, - CsrUint32 line, + u32 line, const CsrCharString *file); #define CsrSchedTimerCancel(e, pmi, pmv) CsrSchedTimerCancelStringLog((e), (pmi), (pmv), __LINE__, __FILE__) #else diff --git a/drivers/staging/csr/csr_sdio.h b/drivers/staging/csr/csr_sdio.h index 0b24f55..861604d 100644 --- a/drivers/staging/csr/csr_sdio.h +++ b/drivers/staging/csr/csr_sdio.h @@ -85,7 +85,7 @@ typedef struct { CsrSdioFunctionId sdioId; u16 blockSize; /* Actual configured block size, or 0 if unconfigured */ - CsrUint32 features; /* Bit mask with any of CSR_SDIO_FEATURE_* set */ + u32 features; /* Bit mask with any of CSR_SDIO_FEATURE_* set */ void *device; /* Handle of device containing the function */ void *driverData; /* For use by the Function Driver */ void *priv; /* For use by the SDIO Driver */ @@ -479,7 +479,7 @@ CsrResult CsrSdioBlockSizeSet(CsrSdioFunction *function, u16 blockSize); * * *----------------------------------------------------------------------------*/ -CsrResult CsrSdioMaxBusClockFrequencySet(CsrSdioFunction *function, CsrUint32 maxFrequency); +CsrResult CsrSdioMaxBusClockFrequencySet(CsrSdioFunction *function, u32 maxFrequency); /*----------------------------------------------------------------------------* * NAME @@ -519,10 +519,10 @@ CsrResult CsrSdioMaxBusClockFrequencySet(CsrSdioFunction *function, CsrUint32 ma * the callback function. * *----------------------------------------------------------------------------*/ -CsrResult CsrSdioRead8(CsrSdioFunction *function, CsrUint32 address, u8 *data); -CsrResult CsrSdioWrite8(CsrSdioFunction *function, CsrUint32 address, u8 data); -void CsrSdioRead8Async(CsrSdioFunction *function, CsrUint32 address, u8 *data, CsrSdioAsyncCallback callback); -void CsrSdioWrite8Async(CsrSdioFunction *function, CsrUint32 address, u8 data, CsrSdioAsyncCallback callback); +CsrResult CsrSdioRead8(CsrSdioFunction *function, u32 address, u8 *data); +CsrResult CsrSdioWrite8(CsrSdioFunction *function, u32 address, u8 data); +void CsrSdioRead8Async(CsrSdioFunction *function, u32 address, u8 *data, CsrSdioAsyncCallback callback); +void CsrSdioWrite8Async(CsrSdioFunction *function, u32 address, u8 data, CsrSdioAsyncCallback callback); /*----------------------------------------------------------------------------* * NAME @@ -563,10 +563,10 @@ void CsrSdioWrite8Async(CsrSdioFunction *function, CsrUint32 address, u8 data, C * the callback function. * *----------------------------------------------------------------------------*/ -CsrResult CsrSdioRead16(CsrSdioFunction *function, CsrUint32 address, u16 *data); -CsrResult CsrSdioWrite16(CsrSdioFunction *function, CsrUint32 address, u16 data); -void CsrSdioRead16Async(CsrSdioFunction *function, CsrUint32 address, u16 *data, CsrSdioAsyncCallback callback); -void CsrSdioWrite16Async(CsrSdioFunction *function, CsrUint32 address, u16 data, CsrSdioAsyncCallback callback); +CsrResult CsrSdioRead16(CsrSdioFunction *function, u32 address, u16 *data); +CsrResult CsrSdioWrite16(CsrSdioFunction *function, u32 address, u16 data); +void CsrSdioRead16Async(CsrSdioFunction *function, u32 address, u16 *data, CsrSdioAsyncCallback callback); +void CsrSdioWrite16Async(CsrSdioFunction *function, u32 address, u16 data, CsrSdioAsyncCallback callback); /*----------------------------------------------------------------------------* * NAME @@ -608,10 +608,10 @@ void CsrSdioWrite16Async(CsrSdioFunction *function, CsrUint32 address, u16 data, * the callback function. * *----------------------------------------------------------------------------*/ -CsrResult CsrSdioF0Read8(CsrSdioFunction *function, CsrUint32 address, u8 *data); -CsrResult CsrSdioF0Write8(CsrSdioFunction *function, CsrUint32 address, u8 data); -void CsrSdioF0Read8Async(CsrSdioFunction *function, CsrUint32 address, u8 *data, CsrSdioAsyncCallback callback); -void CsrSdioF0Write8Async(CsrSdioFunction *function, CsrUint32 address, u8 data, CsrSdioAsyncCallback callback); +CsrResult CsrSdioF0Read8(CsrSdioFunction *function, u32 address, u8 *data); +CsrResult CsrSdioF0Write8(CsrSdioFunction *function, u32 address, u8 data); +void CsrSdioF0Read8Async(CsrSdioFunction *function, u32 address, u8 *data, CsrSdioAsyncCallback callback); +void CsrSdioF0Write8Async(CsrSdioFunction *function, u32 address, u8 data, CsrSdioAsyncCallback callback); /*----------------------------------------------------------------------------* * NAME @@ -654,10 +654,10 @@ void CsrSdioF0Write8Async(CsrSdioFunction *function, CsrUint32 address, u8 data, * the callback function. * *----------------------------------------------------------------------------*/ -CsrResult CsrSdioRead(CsrSdioFunction *function, CsrUint32 address, void *data, CsrUint32 length); -CsrResult CsrSdioWrite(CsrSdioFunction *function, CsrUint32 address, const void *data, CsrUint32 length); -void CsrSdioReadAsync(CsrSdioFunction *function, CsrUint32 address, void *data, CsrUint32 length, CsrSdioAsyncCallback callback); -void CsrSdioWriteAsync(CsrSdioFunction *function, CsrUint32 address, const void *data, CsrUint32 length, CsrSdioAsyncCallback callback); +CsrResult CsrSdioRead(CsrSdioFunction *function, u32 address, void *data, u32 length); +CsrResult CsrSdioWrite(CsrSdioFunction *function, u32 address, const void *data, u32 length); +void CsrSdioReadAsync(CsrSdioFunction *function, u32 address, void *data, u32 length, CsrSdioAsyncCallback callback); +void CsrSdioWriteAsync(CsrSdioFunction *function, u32 address, const void *data, u32 length, CsrSdioAsyncCallback callback); /*----------------------------------------------------------------------------* * NAME diff --git a/drivers/staging/csr/csr_serialize_primitive_types.c b/drivers/staging/csr/csr_serialize_primitive_types.c index 3b20b7d..a96dcb7 100644 --- a/drivers/staging/csr/csr_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_serialize_primitive_types.c @@ -31,7 +31,7 @@ void CsrUint16Des(u16 *value, u8 *buffer, CsrSize *offset) } EXPORT_SYMBOL_GPL(CsrUint16Des); -void CsrUint32Des(CsrUint32 *value, u8 *buffer, CsrSize *offset) +void CsrUint32Des(u32 *value, u8 *buffer, CsrSize *offset) { *value = (buffer[*offset + 0] << 0) | (buffer[*offset + 1] << 8) | @@ -63,7 +63,7 @@ void CsrUtf8StringDes(CsrUtf8String **value, u8 *buffer, CsrSize *offset) void CsrUtf16StringDes(CsrUtf16String **value, u8 *buffer, CsrSize *offset) { - CsrUint32 length, i; + u32 length, i; CsrUint32Des(&length, buffer, offset); @@ -103,7 +103,7 @@ void CsrUint16Ser(u8 *buffer, CsrSize *offset, u16 value) } EXPORT_SYMBOL_GPL(CsrUint16Ser); -void CsrUint32Ser(u8 *buffer, CsrSize *offset, CsrUint32 value) +void CsrUint32Ser(u8 *buffer, CsrSize *offset, u32 value) { buffer[*offset + 0] = (u8) ((value >> 0) & 0xFF); buffer[*offset + 1] = (u8) ((value >> 8) & 0xFF); @@ -143,8 +143,8 @@ void CsrUtf16StringSer(u8 *buffer, CsrSize *offset, const CsrUtf16String *value) { if (value) { - CsrUint32 length = CsrUtf16StrLen(value) + 1; - CsrUint32 i; + u32 length = CsrUtf16StrLen(value) + 1; + u32 i; CsrUint32Ser(buffer, offset, length); @@ -173,11 +173,11 @@ void CsrVoidPtrSer(u8 *buffer, CsrSize *offset, void *ptr) CsrSizeSer(buffer, offset, (CsrSize) ptr); } -CsrUint32 CsrCharStringSerLen(const CsrCharString *str) +u32 CsrCharStringSerLen(const CsrCharString *str) { if (str) { - return (CsrUint32) (CsrStrLen(str) + sizeof(*str)); + return (u32) (CsrStrLen(str) + sizeof(*str)); } else { @@ -185,11 +185,11 @@ CsrUint32 CsrCharStringSerLen(const CsrCharString *str) } } -CsrUint32 CsrUtf8StringSerLen(const CsrUtf8String *str) +u32 CsrUtf8StringSerLen(const CsrUtf8String *str) { if (str) { - return (CsrUint32) (CsrStrLen((CsrCharString *) str) + sizeof(*str)); + return (u32) (CsrStrLen((CsrCharString *) str) + sizeof(*str)); } else { @@ -197,16 +197,16 @@ CsrUint32 CsrUtf8StringSerLen(const CsrUtf8String *str) } } -CsrUint32 CsrUtf16StringSerLen(const CsrUtf16String *str) +u32 CsrUtf16StringSerLen(const CsrUtf16String *str) { if (str) { /* We always write down the length of the string */ - return sizeof(CsrUint32) + (CsrUtf16StrLen(str) + 1) * sizeof(*str); + return sizeof(u32) + (CsrUtf16StrLen(str) + 1) * sizeof(*str); } else { - return sizeof(CsrUint32); + return sizeof(u32); } } diff --git a/drivers/staging/csr/csr_time.h b/drivers/staging/csr/csr_time.h index 0329427..9687b06 100644 --- a/drivers/staging/csr/csr_time.h +++ b/drivers/staging/csr/csr_time.h @@ -27,7 +27,7 @@ extern "C" { reference, usually associated with system startup. *******************************************************************************/ -typedef CsrUint32 CsrTime; +typedef u32 CsrTime; /******************************************************************************* @@ -42,7 +42,7 @@ typedef CsrUint32 CsrTime; *******************************************************************************/ typedef struct { - CsrUint32 sec; + u32 sec; u16 msec; } CsrTimeUtc; diff --git a/drivers/staging/csr/csr_types.h b/drivers/staging/csr/csr_types.h index 061fde8..144c980 100644 --- a/drivers/staging/csr/csr_types.h +++ b/drivers/staging/csr/csr_types.h @@ -32,9 +32,6 @@ typedef ptrdiff_t CsrPtrdiff; /* Type of the result of subtracting two pointer typedef uintptr_t CsrUintptr; /* Unsigned integer large enough to hold any pointer (ISO/IEC 9899:1999 7.18.1.4) */ typedef ptrdiff_t CsrIntptr; /* intptr_t is not defined in kernel. Use the equivalent ptrdiff_t. */ -/* Unsigned fixed width types */ -typedef uint32_t CsrUint32; - /* Signed fixed width types */ typedef int32_t CsrInt32; @@ -45,7 +42,7 @@ typedef u8 CsrBool; typedef char CsrCharString; typedef u8 CsrUtf8String; typedef u16 CsrUtf16String; /* 16-bit UTF16 strings */ -typedef CsrUint32 CsrUint24; +typedef u32 CsrUint24; /* * 64-bit integers diff --git a/drivers/staging/csr/csr_unicode.h b/drivers/staging/csr/csr_unicode.h index 64519c0..4a97771 100644 --- a/drivers/staging/csr/csr_unicode.h +++ b/drivers/staging/csr/csr_unicode.h @@ -16,10 +16,10 @@ extern "C" { #endif -CsrUtf16String *CsrUint32ToUtf16String(CsrUint32 number); +CsrUtf16String *CsrUint32ToUtf16String(u32 number); -CsrUint32 CsrUtf16StringToUint32(const CsrUtf16String *unicodeString); -CsrUint32 CsrUtf16StrLen(const CsrUtf16String *unicodeString); +u32 CsrUtf16StringToUint32(const CsrUtf16String *unicodeString); +u32 CsrUtf16StrLen(const CsrUtf16String *unicodeString); CsrUtf8String *CsrUtf16String2Utf8(const CsrUtf16String *source); @@ -29,9 +29,9 @@ CsrUtf16String *CsrUtf16StrCpy(CsrUtf16String *target, const CsrUtf16String *sou CsrUtf16String *CsrUtf16StringDuplicate(const CsrUtf16String *source); u16 CsrUtf16StrICmp(const CsrUtf16String *string1, const CsrUtf16String *string2); -u16 CsrUtf16StrNICmp(const CsrUtf16String *string1, const CsrUtf16String *string2, CsrUint32 count); +u16 CsrUtf16StrNICmp(const CsrUtf16String *string1, const CsrUtf16String *string2, u32 count); -CsrUtf16String *CsrUtf16MemCpy(CsrUtf16String *dest, const CsrUtf16String *src, CsrUint32 count); +CsrUtf16String *CsrUtf16MemCpy(CsrUtf16String *dest, const CsrUtf16String *src, u32 count); CsrUtf16String *CsrUtf16ConcatenateTexts(const CsrUtf16String *inputText1, const CsrUtf16String *inputText2, const CsrUtf16String *inputText3, const CsrUtf16String *inputText4); @@ -40,7 +40,7 @@ CsrUtf16String *CsrXML2Utf16String(CsrUtf16String *str); CsrInt32 CsrUtf8StrCmp(const CsrUtf8String *string1, const CsrUtf8String *string2); CsrInt32 CsrUtf8StrNCmp(const CsrUtf8String *string1, const CsrUtf8String *string2, CsrSize count); -CsrUint32 CsrUtf8StringLengthInBytes(const CsrUtf8String *string); +u32 CsrUtf8StringLengthInBytes(const CsrUtf8String *string); /******************************************************************************* diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index 7e724da7..b9a5c5f 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -13,15 +13,15 @@ #include "csr_unicode.h" #include "csr_util.h" -#define UNI_SUR_HIGH_START ((CsrUint32) 0xD800) -#define UNI_SUR_HIGH_END ((CsrUint32) 0xDBFF) -#define UNI_SUR_LOW_START ((CsrUint32) 0xDC00) -#define UNI_SUR_LOW_END ((CsrUint32) 0xDFFF) -#define UNI_REPLACEMENT_CHAR ((CsrUint32) 0xFFFD) +#define UNI_SUR_HIGH_START ((u32) 0xD800) +#define UNI_SUR_HIGH_END ((u32) 0xDBFF) +#define UNI_SUR_LOW_START ((u32) 0xDC00) +#define UNI_SUR_LOW_END ((u32) 0xDFFF) +#define UNI_REPLACEMENT_CHAR ((u32) 0xFFFD) #define UNI_HALF_SHIFT ((u8) 10) /* used for shifting by 10 bits */ -#define UNI_HALF_BASE ((CsrUint32) 0x00010000) -#define UNI_BYTEMASK ((CsrUint32) 0xBF) -#define UNI_BYTEMARK ((CsrUint32) 0x80) +#define UNI_HALF_BASE ((u32) 0x00010000) +#define UNI_BYTEMASK ((u32) 0xBF) +#define UNI_BYTEMARK ((u32) 0x80) #define CAPITAL(x) ((x >= 'a') && (x <= 'z') ? ((x) & 0x00DF) : (x)) @@ -55,8 +55,8 @@ static const s8 trailingBytesForUtf8[256] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xE0 - 0xFF */ }; -/* Values to be substracted from a CsrUint32 when converting from UTF8 to UTF16 */ -static const CsrUint32 offsetsFromUtf8[4] = +/* Values to be substracted from a u32 when converting from UTF8 to UTF16 */ +static const u32 offsetsFromUtf8[4] = { 0x00000000, 0x00003080, 0x000E2080, 0x03C82080 }; @@ -73,11 +73,11 @@ static const CsrUint32 offsetsFromUtf8[4] = * Output: A string of UTF-16 characters. * *********************************************************************************/ -CsrUtf16String *CsrUint32ToUtf16String(CsrUint32 number) +CsrUtf16String *CsrUint32ToUtf16String(u32 number) { u16 count, noOfDigits; CsrUtf16String *output; - CsrUint32 tempNumber; + u32 tempNumber; /* calculate the number of digits in the output */ tempNumber = number; @@ -113,10 +113,10 @@ CsrUtf16String *CsrUint32ToUtf16String(CsrUint32 number) * Output: 32 bit number. * *********************************************************************************/ -CsrUint32 CsrUtf16StringToUint32(const CsrUtf16String *unicodeString) +u32 CsrUtf16StringToUint32(const CsrUtf16String *unicodeString) { u16 numLen, count; - CsrUint32 newNumber = 0; + u32 newNumber = 0; numLen = (u16) CsrUtf16StrLen(unicodeString); @@ -150,7 +150,7 @@ CsrUint32 CsrUtf16StringToUint32(const CsrUtf16String *unicodeString) * Output: A pointer to an unicoded string. * *********************************************************************************/ -CsrUtf16String *CsrUtf16MemCpy(CsrUtf16String *dest, const CsrUtf16String *src, CsrUint32 count) +CsrUtf16String *CsrUtf16MemCpy(CsrUtf16String *dest, const CsrUtf16String *src, u32 count) { return CsrMemCpy((u8 *) dest, (u8 *) src, count * sizeof(CsrUtf16String)); } @@ -171,7 +171,7 @@ CsrUtf16String *CsrUtf16ConcatenateTexts(const CsrUtf16String *inputText1, const const CsrUtf16String *inputText3, const CsrUtf16String *inputText4) { CsrUtf16String *outputText; - CsrUint32 textLen, textLen1, textLen2, textLen3, textLen4; + u32 textLen, textLen1, textLen2, textLen3, textLen4; textLen1 = CsrUtf16StrLen(inputText1); textLen2 = CsrUtf16StrLen(inputText2); @@ -225,9 +225,9 @@ CsrUtf16String *CsrUtf16ConcatenateTexts(const CsrUtf16String *inputText1, const * Output: The number of 16 bit elements in the string. * *********************************************************************************/ -CsrUint32 CsrUtf16StrLen(const CsrUtf16String *unicodeString) +u32 CsrUtf16StrLen(const CsrUtf16String *unicodeString) { - CsrUint32 length; + u32 length; length = 0; if (unicodeString != NULL) @@ -256,10 +256,10 @@ CsrUint32 CsrUtf16StrLen(const CsrUtf16String *unicodeString) CsrUtf8String *CsrUtf16String2Utf8(const CsrUtf16String *source) { CsrUtf8String *dest, *destStart = NULL; - CsrUint32 i; - CsrUint32 ch; - CsrUint32 length; - CsrUint32 sourceLength; + u32 i; + u32 ch; + u32 length; + u32 sourceLength; u8 bytes; CsrBool appendNull = FALSE; @@ -280,7 +280,7 @@ CsrUtf8String *CsrUtf16String2Utf8(const CsrUtf16String *source) { if (i + 1 < sourceLength) /* The low surrogate is in the source */ { - CsrUint32 ch2 = source[++i]; + u32 ch2 = source[++i]; if ((ch2 >= UNI_SUR_LOW_START) && (ch2 <= UNI_SUR_LOW_END)) /* And it is a legal low surrogate */ { length += 4; @@ -330,7 +330,7 @@ CsrUtf8String *CsrUtf16String2Utf8(const CsrUtf16String *source) { if (i + 1 < sourceLength) /* The low surrogate is in the source */ { - CsrUint32 ch2 = source[++i]; + u32 ch2 = source[++i]; if ((ch2 >= UNI_SUR_LOW_START) && (ch2 <= UNI_SUR_LOW_END)) /* And it is a legal low surrogate, convert to UTF-32 */ { ch = ((ch - UNI_SUR_HIGH_START) << UNI_HALF_SHIFT) + (ch2 - UNI_SUR_LOW_START) + UNI_HALF_BASE; @@ -356,19 +356,19 @@ CsrUtf8String *CsrUtf16String2Utf8(const CsrUtf16String *source) } /* Figure out how many bytes that are required */ - if (ch < (CsrUint32) 0x80) + if (ch < (u32) 0x80) { bytes = 1; } - else if (ch < (CsrUint32) 0x800) + else if (ch < (u32) 0x800) { bytes = 2; } - else if (ch < (CsrUint32) 0x10000) + else if (ch < (u32) 0x10000) { bytes = 3; } - else if (ch < (CsrUint32) 0x110000) + else if (ch < (u32) 0x110000) { bytes = 4; } @@ -463,7 +463,7 @@ CsrUtf8String *CsrUtf16String2Utf8(const CsrUtf16String *source) TRUE if the given code unit is legal. *****************************************************************************/ -static CsrBool isLegalUtf8(const CsrUtf8String *codeUnit, CsrUint32 length) +static CsrBool isLegalUtf8(const CsrUtf8String *codeUnit, u32 length) { const CsrUtf8String *srcPtr = codeUnit + length; u8 byte; @@ -633,9 +633,9 @@ CsrUtf16String *CsrUtf82Utf16String(const CsrUtf8String *utf8String) { *dest++ = UNI_REPLACEMENT_CHAR; } - else /* It is legal, convert the character to an CsrUint32 */ + else /* It is legal, convert the character to an u32 */ { - CsrUint32 ch = 0; + u32 ch = 0; switch (extraBytes2Read) /* Everything falls through */ { @@ -731,7 +731,7 @@ CsrUtf16String *CsrUtf16StrCpy(CsrUtf16String *target, const CsrUtf16String *sou CsrUtf16String *CsrUtf16StringDuplicate(const CsrUtf16String *source) { CsrUtf16String *target = NULL; - CsrUint32 length; + u32 length; if (source) /* if source is not NULL*/ { @@ -781,7 +781,7 @@ u16 CsrUtf16StrICmp(const CsrUtf16String *string1, const CsrUtf16String *string2 * Output: 0: if the strings are identical. * *********************************************************************************/ -u16 CsrUtf16StrNICmp(const CsrUtf16String *string1, const CsrUtf16String *string2, CsrUint32 count) +u16 CsrUtf16StrNICmp(const CsrUtf16String *string1, const CsrUtf16String *string2, u32 count) { while ((*string1 || *string2) && count--) { @@ -814,7 +814,7 @@ CsrUtf16String *CsrUtf16String2XML(CsrUtf16String *str) CsrUtf16String *scanString; CsrUtf16String *outputString = NULL; CsrUtf16String *resultString = str; - CsrUint32 stringLength = 0; + u32 stringLength = 0; CsrBool encodeChars = FALSE; scanString = str; @@ -907,7 +907,7 @@ CsrUtf16String *CsrXML2Utf16String(CsrUtf16String *str) CsrUtf16String *scanString; CsrUtf16String *outputString = NULL; CsrUtf16String *resultString = str; - CsrUint32 stringLength = 0; + u32 stringLength = 0; CsrBool encodeChars = FALSE; scanString = str; @@ -1026,14 +1026,14 @@ CsrInt32 CsrUtf8StrNCmp(const CsrUtf8String *string1, const CsrUtf8String *strin return CsrStrNCmp((const CsrCharString *) string1, (const CsrCharString *) string2, count); } -CsrUint32 CsrUtf8StringLengthInBytes(const CsrUtf8String *string) +u32 CsrUtf8StringLengthInBytes(const CsrUtf8String *string) { CsrSize length = 0; if (string) { length = CsrStrLen((const CsrCharString *) string); } - return (CsrUint32) length; + return (u32) length; } CsrUtf8String *CsrUtf8StrCpy(CsrUtf8String *target, const CsrUtf8String *source) @@ -1093,7 +1093,7 @@ CsrUtf8String *CsrUtf8StrDup(const CsrUtf8String *source) CsrUtf8String *CsrUtf8StringConcatenateTexts(const CsrUtf8String *inputText1, const CsrUtf8String *inputText2, const CsrUtf8String *inputText3, const CsrUtf8String *inputText4) { CsrUtf8String *outputText; - CsrUint32 textLen, textLen1, textLen2, textLen3, textLen4; + u32 textLen, textLen1, textLen2, textLen3, textLen4; textLen1 = CsrUtf8StringLengthInBytes(inputText1); textLen2 = CsrUtf8StringLengthInBytes(inputText2); diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index aaadc6f..edee2e2 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -21,7 +21,7 @@ /*------------------------------------------------------------------*/ /* Time proportional with the number of 1's */ -u8 CsrBitCountSparse(CsrUint32 n) +u8 CsrBitCountSparse(u32 n) { u8 count = 0; @@ -35,11 +35,11 @@ u8 CsrBitCountSparse(CsrUint32 n) } /* Time proportional with the number of 0's */ -u8 CsrBitCountDense(CsrUint32 n) +u8 CsrBitCountDense(u32 n) { - u8 count = 8 * sizeof(CsrUint32); + u8 count = 8 * sizeof(u32); - n ^= (CsrUint32) (-1); + n ^= (u32) (-1); while (n) { @@ -101,7 +101,7 @@ CsrBool CsrHexStrToUint16(const CsrCharString *string, u16 *returnValue) return FALSE; } -CsrBool CsrHexStrToUint32(const CsrCharString *string, CsrUint32 *returnValue) +CsrBool CsrHexStrToUint32(const CsrCharString *string, u32 *returnValue) { u16 currentIndex = 0; *returnValue = 0; @@ -125,7 +125,7 @@ CsrBool CsrHexStrToUint32(const CsrCharString *string, CsrUint32 *returnValue) return FALSE; } -CsrUint32 CsrPow(CsrUint32 base, CsrUint32 exponent) +u32 CsrPow(u32 base, u32 exponent) { if (exponent == 0) { @@ -133,7 +133,7 @@ CsrUint32 CsrPow(CsrUint32 base, CsrUint32 exponent) } else { - CsrUint32 i, t = base; + u32 i, t = base; for (i = 1; i < exponent; i++) { @@ -204,14 +204,14 @@ void CsrUInt16ToHex(u16 number, CsrCharString *str) str[4] = '\0'; } -void CsrUInt32ToHex(CsrUint32 number, CsrCharString *str) +void CsrUInt32ToHex(u32 number, CsrCharString *str) { u16 index; - CsrUint32 currentValue; + u32 currentValue; for (index = 0; index < 8; index++) { - currentValue = (CsrUint32) (number & 0x0000000F); + currentValue = (u32) (number & 0x0000000F); number >>= 4; str[7 - index] = (char) (currentValue > 9 ? currentValue + 55 : currentValue + '0'); } @@ -324,11 +324,11 @@ CsrCharString *CsrStrNCpyZero(CsrCharString *dest, } /* Convert string with base 10 to integer */ -CsrUint32 CsrStrToInt(const CsrCharString *str) +u32 CsrStrToInt(const CsrCharString *str) { s16 i; - CsrUint32 res; - CsrUint32 digit; + u32 res; + u32 digit; res = 0; digit = 1; @@ -350,7 +350,7 @@ CsrUint32 CsrStrToInt(const CsrCharString *str) CsrCharString *CsrStrDup(const CsrCharString *string) { CsrCharString *copy; - CsrUint32 len; + u32 len; copy = NULL; if (string != NULL) @@ -366,7 +366,7 @@ int CsrStrNICmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count) { - CsrUint32 index; + u32 index; int returnValue = 0; for (index = 0; index < count; index++) diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index 610d35e..f19f953 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -18,21 +18,21 @@ extern "C" { #include "csr_macro.h" /*------------------------------------------------------------------*/ -/* Bits - intended to operate on CsrUint32 values */ +/* Bits - intended to operate on u32 values */ /*------------------------------------------------------------------*/ -u8 CsrBitCountSparse(CsrUint32 n); -u8 CsrBitCountDense(CsrUint32 n); +u8 CsrBitCountSparse(u32 n); +u8 CsrBitCountDense(u32 n); /*------------------------------------------------------------------*/ /* Base conversion */ /*------------------------------------------------------------------*/ CsrBool CsrHexStrToUint8(const CsrCharString *string, u8 *returnValue); CsrBool CsrHexStrToUint16(const CsrCharString *string, u16 *returnValue); -CsrBool CsrHexStrToUint32(const CsrCharString *string, CsrUint32 *returnValue); -CsrUint32 CsrPow(CsrUint32 base, CsrUint32 exponent); +CsrBool CsrHexStrToUint32(const CsrCharString *string, u32 *returnValue); +u32 CsrPow(u32 base, u32 exponent); void CsrIntToBase10(CsrInt32 number, CsrCharString *str); void CsrUInt16ToHex(u16 number, CsrCharString *str); -void CsrUInt32ToHex(CsrUint32 number, CsrCharString *str); +void CsrUInt32ToHex(u32 number, CsrCharString *str); /*------------------------------------------------------------------*/ /* Standard C Library functions */ @@ -74,7 +74,7 @@ CsrInt32 CsrVsnprintf(CsrCharString *string, CsrSize count, const CsrCharString void *CsrMemDup(const void *buf1, CsrSize count); int CsrStrNICmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count); CsrCharString *CsrStrDup(const CsrCharString *string); -CsrUint32 CsrStrToInt(const CsrCharString *string); +u32 CsrStrToInt(const CsrCharString *string); CsrCharString *CsrStrNCpyZero(CsrCharString *dest, const CsrCharString *src, CsrSize count); /*------------------------------------------------------------------*/ diff --git a/drivers/staging/csr/csr_wifi_fsm.h b/drivers/staging/csr/csr_wifi_fsm.h index 2128034..0f9cd8f 100644 --- a/drivers/staging/csr/csr_wifi_fsm.h +++ b/drivers/staging/csr/csr_wifi_fsm.h @@ -122,9 +122,9 @@ extern void CsrWifiFsmShutdown(CsrWifiFsmContext *context); * @param[in] context : FSM context * * @return - * CsrUint32 Time in ms until next timeout or 0xFFFFFFFF for no timer set + * u32 Time in ms until next timeout or 0xFFFFFFFF for no timer set */ -extern CsrUint32 CsrWifiFsmExecute(CsrWifiFsmContext *context); +extern u32 CsrWifiFsmExecute(CsrWifiFsmContext *context); /** * @brief @@ -174,9 +174,9 @@ extern void CsrWifiFsmSendEventExternal(CsrWifiFsmContext *context, CsrWifiFsmEv * @param[in] context : FSM context * * @return - * CsrUint32 32 bit ms tick + * u32 32 bit ms tick */ -extern CsrUint32 CsrWifiFsmGetTimeOfDayMs(CsrWifiFsmContext *context); +extern u32 CsrWifiFsmGetTimeOfDayMs(CsrWifiFsmContext *context); /** * @brief @@ -188,9 +188,9 @@ extern CsrUint32 CsrWifiFsmGetTimeOfDayMs(CsrWifiFsmContext *context); * @param[in] context : FSM context * * @return - * CsrUint32 Time in ms until next timeout or 0xFFFFFFFF for no timer set + * u32 Time in ms until next timeout or 0xFFFFFFFF for no timer set */ -extern CsrUint32 CsrWifiFsmGetNextTimeout(CsrWifiFsmContext *context); +extern u32 CsrWifiFsmGetNextTimeout(CsrWifiFsmContext *context); /** * @brief @@ -217,7 +217,7 @@ extern void CsrWifiFsmFastForward(CsrWifiFsmContext *context, u16 ms); * @return * void */ -extern void CsrWifiFsmTestAdvanceTime(CsrWifiFsmContext *context, CsrUint32 ms); +extern void CsrWifiFsmTestAdvanceTime(CsrWifiFsmContext *context, u32 ms); /** * @brief diff --git a/drivers/staging/csr/csr_wifi_fsm_types.h b/drivers/staging/csr/csr_wifi_fsm_types.h index 5bc6987..63b69fe 100644 --- a/drivers/staging/csr/csr_wifi_fsm_types.h +++ b/drivers/staging/csr/csr_wifi_fsm_types.h @@ -79,7 +79,7 @@ typedef struct CsrWifiFsmTimer struct CsrWifiFsmTimer *next; CsrWifiFsmTimerId timerid; - CsrUint32 timeoutTimeMs; + u32 timeoutTimeMs; } CsrWifiFsmTimer; @@ -202,7 +202,7 @@ typedef void (*CsrWifiFsmDumpFnPtr)(CsrWifiFsmContext *context, void *fsmData); */ typedef struct { - CsrUint32 eventid; + u32 eventid; CsrWifiFsmTransitionFnPtr transition; #ifdef CSR_LOG_ENABLE const CsrCharString *transitionName; @@ -253,7 +253,7 @@ typedef struct typedef struct { const CsrCharString *processName; - const CsrUint32 processId; + const u32 processId; const CsrWifiFsmTransitionFunctionTable transitionTable; const CsrWifiFsmTableEntry unhandledTransitions; const CsrWifiFsmTableEntry ignoreFunctions; @@ -389,7 +389,7 @@ struct CsrWifiFsmContext #ifdef CSR_WIFI_FSM_MUTEX_ENABLE CsrMutexHandle externalEventQueueLock; /* The external event queue mutex */ #endif - CsrUint32 timeOffset; /* Amount to adjust the TimeOfDayMs by */ + u32 timeOffset; /* Amount to adjust the TimeOfDayMs by */ CsrWifiFsmTimerList timerQueue; /* The internal timer queue */ CsrBool useTempSaveList; /* Should the temp save list be used */ CsrWifiFsmEventList tempSaveList; /* The temp save event queue */ @@ -409,7 +409,7 @@ struct CsrWifiFsmContext #ifndef CSR_WIFI_FSM_SCHEDULER_DISABLED CsrSchedTid schedTimerId; /* Scheduler TimerId for use in Scheduler Tasks */ - CsrUint32 schedTimerNexttimeoutMs; /* Next timeout time for the current timer */ + u32 schedTimerNexttimeoutMs; /* Next timeout time for the current timer */ #endif #ifdef CSR_WIFI_FSM_MUTEX_ENABLE diff --git a/drivers/staging/csr/csr_wifi_hip_card.h b/drivers/staging/csr/csr_wifi_hip_card.h index 6a0d60b..481ba68 100644 --- a/drivers/staging/csr/csr_wifi_hip_card.h +++ b/drivers/staging/csr/csr_wifi_hip_card.h @@ -99,11 +99,11 @@ u16 CardAreAllFromHostDataSlotsEmpty(card_t *card); CsrResult card_start_processor(card_t *card, enum unifi_dbg_processors_select which); -CsrResult card_wait_for_firmware_to_start(card_t *card, CsrUint32 *paddr); +CsrResult card_wait_for_firmware_to_start(card_t *card, u32 *paddr); CsrResult unifi_dl_firmware(card_t *card, void *arg); -CsrResult unifi_dl_patch(card_t *card, void *arg, CsrUint32 boot_ctrl); -CsrResult unifi_do_loader_op(card_t *card, CsrUint32 op_addr, u8 opcode); +CsrResult unifi_dl_patch(card_t *card, void *arg, u32 boot_ctrl); +CsrResult unifi_do_loader_op(card_t *card, u32 op_addr, u8 opcode); void* unifi_dl_fw_read_start(card_t *card, s8 is_fw); CsrResult unifi_coredump_handle_request(card_t *card); diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.c b/drivers/staging/csr/csr_wifi_hip_card_sdio.c index 1c88f1c..0678344 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.c @@ -67,7 +67,7 @@ static CsrResult unifi_read_chip_version(card_t *card); card_t* unifi_alloc_card(CsrSdioFunction *sdio, void *ospriv) { card_t *card; - CsrUint32 i; + u32 i; func_enter(); @@ -86,9 +86,9 @@ card_t* unifi_alloc_card(CsrSdioFunction *sdio, void *ospriv) card->unifi_interrupt_seq = 1; /* Make these invalid. */ - card->proc_select = (CsrUint32)(-1); - card->dmem_page = (CsrUint32)(-1); - card->pmem_page = (CsrUint32)(-1); + card->proc_select = (u32)(-1); + card->dmem_page = (u32)(-1); + card->pmem_page = (u32)(-1); card->bh_reason_host = 0; card->bh_reason_unifi = 0; @@ -137,7 +137,7 @@ card_t* unifi_alloc_card(CsrSdioFunction *sdio, void *ospriv) * warnings when casting pointer types, e.g. on 64-bit systems. */ { - CsrUint32 val = 0x01234567; + u32 val = 0x01234567; if (*((u8 *)&val) == 0x01) { @@ -288,9 +288,9 @@ CsrResult unifi_init(card_t *card) * The page registers will be maintained by unifi_read...() and * unifi_write...(). */ - card->proc_select = (CsrUint32)(-1); - card->dmem_page = (CsrUint32)(-1); - card->pmem_page = (CsrUint32)(-1); + card->proc_select = (u32)(-1); + card->dmem_page = (u32)(-1); + card->pmem_page = (u32)(-1); r = unifi_write_direct16(card, ChipHelper_HOST_WINDOW3_PAGE(card->helper) * 2, 0); if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) { @@ -598,7 +598,7 @@ static void _build_sdio_config_data(sdio_config_data_t *cfg_data, */ static CsrResult card_hw_init(card_t *card) { - CsrUint32 slut_address; + u32 slut_address; u16 initialised; u16 finger_print; symbol_t slut; @@ -692,7 +692,7 @@ static CsrResult card_hw_init(card_t *card) while (!search_4slut_again) { u16 s; - CsrUint32 l; + u32 l; r = unifi_card_read16(card, slut_address, &s); if (r != CSR_RESULT_SUCCESS) @@ -810,7 +810,7 @@ static CsrResult card_hw_init(card_t *card) case CSR_SLT_BUILD_ID_NUMBER: { - CsrUint32 n; + u32 n; r = unifi_read32(card, slut.obj, &n); if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) { @@ -1233,7 +1233,7 @@ static CsrResult card_wait_for_unifi_to_disable(card_t *card) * CSR_RESULT_SUCCESS on success, CSR error code on failure. * --------------------------------------------------------------------------- */ -CsrResult card_wait_for_firmware_to_start(card_t *card, CsrUint32 *paddr) +CsrResult card_wait_for_firmware_to_start(card_t *card, u32 *paddr) { CsrInt32 i; u16 mbox0, mbox1; @@ -1335,7 +1335,7 @@ CsrResult card_wait_for_firmware_to_start(card_t *card, CsrUint32 *paddr) return r; } - *paddr = (((CsrUint32)mbox1 << 16) | mbox0); + *paddr = (((u32)mbox1 << 16) | mbox0); func_exit(); return CSR_RESULT_SUCCESS; @@ -1681,7 +1681,7 @@ static CsrResult card_allocate_memory_resources(card_t *card) /* Allocate memory for the array used for slot host tag mapping */ card->fh_slot_host_tag_record = - (CsrUint32 *)CsrMemAlloc(n * sizeof(CsrUint32)); + (u32 *)CsrMemAlloc(n * sizeof(u32)); if (card->fh_slot_host_tag_record == NULL) { @@ -2640,7 +2640,7 @@ static CsrResult unifi_prepare_hw(card_t *card) static CsrResult unifi_read_chip_version(card_t *card) { - CsrUint32 gbl_chip_version; + u32 gbl_chip_version; CsrResult r; u16 ver; @@ -3025,14 +3025,14 @@ CsrResult unifi_card_hard_reset(card_t *card) { CsrResult r; const struct chip_helper_reset_values *init_data; - CsrUint32 chunks; + u32 chunks; func_enter(); /* Clear cache of page registers */ - card->proc_select = (CsrUint32)(-1); - card->dmem_page = (CsrUint32)(-1); - card->pmem_page = (CsrUint32)(-1); + card->proc_select = (u32)(-1); + card->dmem_page = (u32)(-1); + card->pmem_page = (u32)(-1); /* * We need to have a valid card->helper before we use software hard reset. @@ -3665,7 +3665,7 @@ static CsrResult firmware_present_in_flash(card_t *card) static void bootstrap_chip_hw(card_t *card) { const struct chip_helper_init_values *vals; - CsrUint32 i, len; + u32 i, len; void *sdio = card->sdio_if; CsrResult csrResult; @@ -3816,7 +3816,7 @@ CsrResult card_start_processor(card_t *card, enum unifi_dbg_processors_select wh * None * --------------------------------------------------------------------------- */ -void unifi_set_interrupt_mode(card_t *card, CsrUint32 mode) +void unifi_set_interrupt_mode(card_t *card, u32 mode) { if (mode == CSR_WIFI_INTMODE_RUN_BH_ONCE) { @@ -4104,7 +4104,7 @@ void unifi_get_hip_qos_info(card_t *card, unifi_HipQosInfo *hipqosinfo) { CsrInt32 count_fhr; s16 t; - CsrUint32 occupied_fh; + u32 occupied_fh; q_t *sigq; u16 nslots, i; diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.h b/drivers/staging/csr/csr_wifi_hip_card_sdio.h index 6463e24..42fce7b 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.h +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.h @@ -173,7 +173,7 @@ typedef struct u16 initialised; /* Added by protocol version 0x0001 */ - CsrUint32 overlay_size; + u32 overlay_size; /* Added by protocol version 0x0300 */ u16 data_slot_round; @@ -407,11 +407,11 @@ struct card * array is indexed by slot numbers and each index stores * information of the last host tag it was used for */ - CsrUint32 *fh_slot_host_tag_record; + u32 *fh_slot_host_tag_record; /* Info read from Symbol Table during probe */ - CsrUint32 build_id; + u32 build_id; CsrCharString build_id_string[128]; /* Retrieve from SDIO driver. */ @@ -455,7 +455,7 @@ struct card u8 request_max_clock; /* Last SDIO clock frequency set */ - CsrUint32 sdio_clock_speed; + u32 sdio_clock_speed; /* * Current host state (copy of value in IOABORT register and @@ -518,7 +518,7 @@ struct card * SHARED_IO_INTERRUPT register. * Flag to say we need to generate an interrupt at end of processing. */ - CsrUint32 unifi_interrupt_seq; + u32 unifi_interrupt_seq; u8 generate_interrupt; @@ -548,17 +548,17 @@ struct card sdio_config_data_t config_data; /* SDIO address of the Initialised flag and Control Data struct */ - CsrUint32 init_flag_addr; - CsrUint32 sdio_ctrl_addr; + u32 init_flag_addr; + u32 sdio_ctrl_addr; /* The last value written to the Shared Data Memory Page register */ - CsrUint32 proc_select; - CsrUint32 dmem_page; - CsrUint32 pmem_page; + u32 proc_select; + u32 dmem_page; + u32 pmem_page; /* SDIO traffic counters limited to 32 bits for Synergy compatibility */ - CsrUint32 sdio_bytes_read; - CsrUint32 sdio_bytes_written; + u32 sdio_bytes_read; + u32 sdio_bytes_written; u8 memory_resources_allocated; @@ -585,42 +585,42 @@ struct card #ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE struct cmd_profile { - CsrUint32 cmd52_count; - CsrUint32 cmd53_count; - CsrUint32 tx_count; - CsrUint32 tx_cfm_count; - CsrUint32 rx_count; - CsrUint32 bh_count; - CsrUint32 process_count; - CsrUint32 protocol_count; - - CsrUint32 cmd52_f0_r_count; - CsrUint32 cmd52_f0_w_count; - CsrUint32 cmd52_r8or16_count; - CsrUint32 cmd52_w8or16_count; - CsrUint32 cmd52_r16_count; - CsrUint32 cmd52_w16_count; - CsrUint32 cmd52_r32_count; - - CsrUint32 sdio_cmd_signal; - CsrUint32 sdio_cmd_clear_slot; - CsrUint32 sdio_cmd_to_host; - CsrUint32 sdio_cmd_from_host; - CsrUint32 sdio_cmd_from_host_and_clear; + u32 cmd52_count; + u32 cmd53_count; + u32 tx_count; + u32 tx_cfm_count; + u32 rx_count; + u32 bh_count; + u32 process_count; + u32 protocol_count; + + u32 cmd52_f0_r_count; + u32 cmd52_f0_w_count; + u32 cmd52_r8or16_count; + u32 cmd52_w8or16_count; + u32 cmd52_r16_count; + u32 cmd52_w16_count; + u32 cmd52_r32_count; + + u32 sdio_cmd_signal; + u32 sdio_cmd_clear_slot; + u32 sdio_cmd_to_host; + u32 sdio_cmd_from_host; + u32 sdio_cmd_from_host_and_clear; } hip_prof; struct cmd_profile cmd_prof; #endif /* Interrupt processing mode flags */ - CsrUint32 intmode; + u32 intmode; #ifdef UNIFI_DEBUG u8 lsb; #endif /* Historic firmware panic codes */ - CsrUint32 panic_data_phy_addr; - CsrUint32 panic_data_mac_addr; + u32 panic_data_phy_addr; + u32 panic_data_mac_addr; u16 last_phy_panic_code; u16 last_phy_panic_arg; u16 last_mac_panic_code; @@ -657,34 +657,34 @@ CsrInt32 card_read_signal_counts(card_t *card); bulk_data_desc_t* card_find_data_slot(card_t *card, s16 slot); -CsrResult unifi_read32(card_t *card, CsrUint32 unifi_addr, CsrUint32 *pdata); -CsrResult unifi_readnz(card_t *card, CsrUint32 unifi_addr, +CsrResult unifi_read32(card_t *card, u32 unifi_addr, u32 *pdata); +CsrResult unifi_readnz(card_t *card, u32 unifi_addr, void *pdata, u16 len); -CsrInt32 unifi_read_shared_count(card_t *card, CsrUint32 addr); +CsrInt32 unifi_read_shared_count(card_t *card, u32 addr); -CsrResult unifi_writen(card_t *card, CsrUint32 unifi_addr, void *pdata, u16 len); +CsrResult unifi_writen(card_t *card, u32 unifi_addr, void *pdata, u16 len); -CsrResult unifi_bulk_rw(card_t *card, CsrUint32 handle, - void *pdata, CsrUint32 len, s16 direction); -CsrResult unifi_bulk_rw_noretry(card_t *card, CsrUint32 handle, - void *pdata, CsrUint32 len, s16 direction); +CsrResult unifi_bulk_rw(card_t *card, u32 handle, + void *pdata, u32 len, s16 direction); +CsrResult unifi_bulk_rw_noretry(card_t *card, u32 handle, + void *pdata, u32 len, s16 direction); #define UNIFI_SDIO_READ 0 #define UNIFI_SDIO_WRITE 1 -CsrResult unifi_read_8_or_16(card_t *card, CsrUint32 unifi_addr, u8 *pdata); -CsrResult unifi_write_8_or_16(card_t *card, CsrUint32 unifi_addr, u8 data); -CsrResult unifi_read_direct_8_or_16(card_t *card, CsrUint32 addr, u8 *pdata); -CsrResult unifi_write_direct_8_or_16(card_t *card, CsrUint32 addr, u8 data); +CsrResult unifi_read_8_or_16(card_t *card, u32 unifi_addr, u8 *pdata); +CsrResult unifi_write_8_or_16(card_t *card, u32 unifi_addr, u8 data); +CsrResult unifi_read_direct_8_or_16(card_t *card, u32 addr, u8 *pdata); +CsrResult unifi_write_direct_8_or_16(card_t *card, u32 addr, u8 data); -CsrResult unifi_read_direct16(card_t *card, CsrUint32 addr, u16 *pdata); -CsrResult unifi_read_direct32(card_t *card, CsrUint32 addr, CsrUint32 *pdata); -CsrResult unifi_read_directn(card_t *card, CsrUint32 addr, void *pdata, u16 len); +CsrResult unifi_read_direct16(card_t *card, u32 addr, u16 *pdata); +CsrResult unifi_read_direct32(card_t *card, u32 addr, u32 *pdata); +CsrResult unifi_read_directn(card_t *card, u32 addr, void *pdata, u16 len); -CsrResult unifi_write_direct16(card_t *card, CsrUint32 addr, u16 data); -CsrResult unifi_write_directn(card_t *card, CsrUint32 addr, void *pdata, u16 len); +CsrResult unifi_write_direct16(card_t *card, u32 addr, u16 data); +CsrResult unifi_write_directn(card_t *card, u32 addr, void *pdata, u16 len); -CsrResult sdio_read_f0(card_t *card, CsrUint32 addr, u8 *pdata); -CsrResult sdio_write_f0(card_t *card, CsrUint32 addr, u8 data); +CsrResult sdio_read_f0(card_t *card, u32 addr, u8 *pdata); +CsrResult sdio_write_f0(card_t *card, u32 addr, u8 data); void unifi_read_panic(card_t *card); #ifdef CSR_PRE_ALLOC_NET_DATA diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c index 1d09b97..9c9e907 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c @@ -212,7 +212,7 @@ CsrResult prealloc_netdata_alloc(card_t *card) } -static CsrResult prealloc_netdata_get(card_t *card, bulk_data_desc_t *bulk_data_slot, CsrUint32 size) +static CsrResult prealloc_netdata_get(card_t *card, bulk_data_desc_t *bulk_data_slot, u32 size) { CsrResult r; @@ -354,7 +354,7 @@ CsrResult unifi_force_low_power_mode(card_t *card) * CSR_RESULT_SUCCESS on success or a CSR error code. * --------------------------------------------------------------------------- */ -CsrResult unifi_bh(card_t *card, CsrUint32 *remaining) +CsrResult unifi_bh(card_t *card, u32 *remaining) { CsrResult r; CsrResult csrResult; @@ -1315,7 +1315,7 @@ static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed) if (GET_SIGNAL_ID(bufptr + 2) == CSR_MA_PACKET_CONFIRM_ID) { /* Get host tag and transmission status */ - CsrUint32 host_tag = GET_PACKED_MA_PACKET_CONFIRM_HOST_TAG(bufptr + 2); + u32 host_tag = GET_PACKED_MA_PACKET_CONFIRM_HOST_TAG(bufptr + 2); u16 status = GET_PACKED_MA_PACKET_CONFIRM_TRANSMISSION_STATUS(bufptr + 2); unifi_trace(card->ospriv, UDBG4, "process_to_host_signals signal ID=%x host Tag=%x status=%x\n", @@ -1841,8 +1841,8 @@ static CsrResult process_bulk_data_command(card_t *card, const u8 *cmdptr, */ static CsrResult check_fh_sig_slots(card_t *card, u16 needed, CsrInt32 *space_fh) { - CsrUint32 count_fhw; - CsrUint32 occupied_fh, slots_fh; + u32 count_fhw; + u32 occupied_fh, slots_fh; CsrInt32 count_fhr; count_fhw = card->from_host_signals_w; @@ -2180,7 +2180,7 @@ static CsrResult process_fh_traffic_queue(card_t *card, CsrInt32 *processed) u16 needed_chunks; CsrInt32 space_chunks; u16 q_index; - CsrUint32 host_tag = 0; + u32 host_tag = 0; u16 slot_num = 0; *processed = 0; diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c index 15a0403..0454f43 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c @@ -53,7 +53,7 @@ * CSR_RESULT_FAILURE an SDIO error occurred * --------------------------------------------------------------------------- */ -static CsrResult retrying_read8(card_t *card, s16 funcnum, CsrUint32 addr, u8 *pdata) +static CsrResult retrying_read8(card_t *card, s16 funcnum, u32 addr, u8 *pdata) { CsrSdioFunction *sdio = card->sdio_if; CsrResult r = CSR_RESULT_SUCCESS; @@ -128,7 +128,7 @@ static CsrResult retrying_read8(card_t *card, s16 funcnum, CsrUint32 addr, u8 *p } /* retrying_read8() */ -static CsrResult retrying_write8(card_t *card, s16 funcnum, CsrUint32 addr, u8 data) +static CsrResult retrying_write8(card_t *card, s16 funcnum, u32 addr, u8 data) { CsrSdioFunction *sdio = card->sdio_if; CsrResult r = CSR_RESULT_SUCCESS; @@ -202,7 +202,7 @@ static CsrResult retrying_write8(card_t *card, s16 funcnum, CsrUint32 addr, u8 d static CsrResult retrying_read16(card_t *card, s16 funcnum, - CsrUint32 addr, u16 *pdata) + u32 addr, u16 *pdata) { CsrSdioFunction *sdio = card->sdio_if; CsrResult r = CSR_RESULT_SUCCESS; @@ -263,7 +263,7 @@ static CsrResult retrying_read16(card_t *card, s16 funcnum, static CsrResult retrying_write16(card_t *card, s16 funcnum, - CsrUint32 addr, u16 data) + u32 addr, u16 data) { CsrSdioFunction *sdio = card->sdio_if; CsrResult r = CSR_RESULT_SUCCESS; @@ -338,7 +338,7 @@ static CsrResult retrying_write16(card_t *card, s16 funcnum, * CSR_RESULT_FAILURE an SDIO error occurred * --------------------------------------------------------------------------- */ -CsrResult sdio_read_f0(card_t *card, CsrUint32 addr, u8 *pdata) +CsrResult sdio_read_f0(card_t *card, u32 addr, u8 *pdata) { #if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) card->cmd_prof.cmd52_f0_r_count++; @@ -364,7 +364,7 @@ CsrResult sdio_read_f0(card_t *card, CsrUint32 addr, u8 *pdata) * CSR_RESULT_FAILURE an SDIO error occurred * --------------------------------------------------------------------------- */ -CsrResult sdio_write_f0(card_t *card, CsrUint32 addr, u8 data) +CsrResult sdio_write_f0(card_t *card, u32 addr, u8 data) { #if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) card->cmd_prof.cmd52_f0_w_count++; @@ -388,7 +388,7 @@ CsrResult sdio_write_f0(card_t *card, CsrUint32 addr, u8 data) * CSR_RESULT_SUCCESS on success, non-zero error code on error: * --------------------------------------------------------------------------- */ -CsrResult unifi_read_direct_8_or_16(card_t *card, CsrUint32 addr, u8 *pdata) +CsrResult unifi_read_direct_8_or_16(card_t *card, u32 addr, u8 *pdata) { #ifdef CSR_WIFI_TRANSPORT_CSPI u16 w; @@ -423,7 +423,7 @@ CsrResult unifi_read_direct_8_or_16(card_t *card, CsrUint32 addr, u8 *pdata) * to memory until the preceding even address is written. * --------------------------------------------------------------------------- */ -CsrResult unifi_write_direct_8_or_16(card_t *card, CsrUint32 addr, u8 data) +CsrResult unifi_write_direct_8_or_16(card_t *card, u32 addr, u8 data) { if (addr & 1) { @@ -462,7 +462,7 @@ CsrResult unifi_write_direct_8_or_16(card_t *card, CsrUint32 addr, u8 data) * even address is read. * --------------------------------------------------------------------------- */ -CsrResult unifi_read_direct16(card_t *card, CsrUint32 addr, u16 *pdata) +CsrResult unifi_read_direct16(card_t *card, u32 addr, u16 *pdata) { return retrying_read16(card, card->function, addr, pdata); } /* unifi_read_direct16() */ @@ -490,7 +490,7 @@ CsrResult unifi_read_direct16(card_t *card, CsrUint32 addr, u16 *pdata) * even address is written. * --------------------------------------------------------------------------- */ -CsrResult unifi_write_direct16(card_t *card, CsrUint32 addr, u16 data) +CsrResult unifi_write_direct16(card_t *card, u32 addr, u16 data) { return retrying_write16(card, card->function, addr, data); } /* unifi_write_direct16() */ @@ -513,7 +513,7 @@ CsrResult unifi_write_direct16(card_t *card, CsrUint32 addr, u16 data) * CSR_RESULT_FAILURE an SDIO error occurred * --------------------------------------------------------------------------- */ -CsrResult unifi_read_direct32(card_t *card, CsrUint32 addr, CsrUint32 *pdata) +CsrResult unifi_read_direct32(card_t *card, u32 addr, u32 *pdata) { CsrResult r; u16 w0, w1; @@ -530,7 +530,7 @@ CsrResult unifi_read_direct32(card_t *card, CsrUint32 addr, CsrUint32 *pdata) return r; } - *pdata = ((CsrUint32)w1 << 16) | (CsrUint32)w0; + *pdata = ((u32)w1 << 16) | (u32)w0; return CSR_RESULT_SUCCESS; } /* unifi_read_direct32() */ @@ -564,10 +564,10 @@ CsrResult unifi_read_direct32(card_t *card, CsrUint32 addr, CsrUint32 *pdata) * even address is read. * --------------------------------------------------------------------------- */ -static CsrResult unifi_read_directn_match(card_t *card, CsrUint32 addr, void *pdata, u16 len, s8 m, CsrUint32 *num) +static CsrResult unifi_read_directn_match(card_t *card, u32 addr, void *pdata, u16 len, s8 m, u32 *num) { CsrResult r; - CsrUint32 i; + u32 i; u8 *cptr; u16 w; @@ -631,9 +631,9 @@ static CsrResult unifi_read_directn_match(card_t *card, CsrUint32 addr, void *pd * even address is read. * --------------------------------------------------------------------------- */ -CsrResult unifi_read_directn(card_t *card, CsrUint32 addr, void *pdata, u16 len) +CsrResult unifi_read_directn(card_t *card, u32 addr, void *pdata, u16 len) { - CsrUint32 num; + u32 num; return unifi_read_directn_match(card, addr, pdata, len, -1, &num); } /* unifi_read_directn() */ @@ -664,7 +664,7 @@ CsrResult unifi_read_directn(card_t *card, CsrUint32 addr, void *pdata, u16 len) * This means we must write data as pairs of bytes in reverse order. * --------------------------------------------------------------------------- */ -CsrResult unifi_write_directn(card_t *card, CsrUint32 addr, void *pdata, u16 len) +CsrResult unifi_write_directn(card_t *card, u32 addr, void *pdata, u16 len) { CsrResult r; u8 *cptr; @@ -714,10 +714,10 @@ CsrResult unifi_write_directn(card_t *card, CsrUint32 addr, void *pdata, u16 len * CSR_RESULT_FAILURE an SDIO error occurred * --------------------------------------------------------------------------- */ -static CsrResult set_dmem_page(card_t *card, CsrUint32 dmem_addr, CsrUint32 *paddr) +static CsrResult set_dmem_page(card_t *card, u32 dmem_addr, u32 *paddr) { u16 page, addr; - CsrUint32 len; + u32 len; CsrResult r; *paddr = 0; @@ -753,11 +753,11 @@ static CsrResult set_dmem_page(card_t *card, CsrUint32 dmem_addr, CsrUint32 *pad } /* set_dmem_page() */ -static CsrResult set_pmem_page(card_t *card, CsrUint32 pmem_addr, - enum chip_helper_window_type mem_type, CsrUint32 *paddr) +static CsrResult set_pmem_page(card_t *card, u32 pmem_addr, + enum chip_helper_window_type mem_type, u32 *paddr) { u16 page, addr; - CsrUint32 len; + u32 len; CsrResult r; *paddr = 0; @@ -814,10 +814,10 @@ static CsrResult set_pmem_page(card_t *card, CsrUint32 pmem_addr, * CSR_WIFI_HIP_RESULT_INVALID_VALUE the address is invalid * --------------------------------------------------------------------------- */ -static CsrResult set_page(card_t *card, CsrUint32 generic_addr, CsrUint32 *paddr) +static CsrResult set_page(card_t *card, u32 generic_addr, u32 *paddr) { CsrInt32 space; - CsrUint32 addr; + u32 addr; CsrResult r = CSR_RESULT_SUCCESS; if (!paddr) @@ -1018,7 +1018,7 @@ CsrResult unifi_set_proc_select(card_t *card, enum unifi_dbg_processors_select s return CSR_WIFI_HIP_RESULT_INVALID_VALUE; } - if (card->proc_select != (CsrUint32)select) + if (card->proc_select != (u32)select) { r = unifi_write_direct16(card, ChipHelper_DBG_HOST_PROC_SELECT(card->helper) * 2, @@ -1033,7 +1033,7 @@ CsrResult unifi_set_proc_select(card_t *card, enum unifi_dbg_processors_select s return r; } - card->proc_select = (CsrUint32)select; + card->proc_select = (u32)select; } return CSR_RESULT_SUCCESS; @@ -1059,9 +1059,9 @@ CsrResult unifi_set_proc_select(card_t *card, enum unifi_dbg_processors_select s * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified * --------------------------------------------------------------------------- */ -CsrResult unifi_read_8_or_16(card_t *card, CsrUint32 unifi_addr, u8 *pdata) +CsrResult unifi_read_8_or_16(card_t *card, u32 unifi_addr, u8 *pdata) { - CsrUint32 sdio_addr; + u32 sdio_addr; CsrResult r; #ifdef CSR_WIFI_TRANSPORT_CSPI u16 w; @@ -1110,9 +1110,9 @@ CsrResult unifi_read_8_or_16(card_t *card, CsrUint32 unifi_addr, u8 *pdata) * write with the previously cached odd byte. * --------------------------------------------------------------------------- */ -CsrResult unifi_write_8_or_16(card_t *card, CsrUint32 unifi_addr, u8 data) +CsrResult unifi_write_8_or_16(card_t *card, u32 unifi_addr, u8 data) { - CsrUint32 sdio_addr; + u32 sdio_addr; CsrResult r; #ifdef CSR_WIFI_TRANSPORT_CSPI u16 w; @@ -1162,9 +1162,9 @@ CsrResult unifi_write_8_or_16(card_t *card, CsrUint32 unifi_addr, u8 data) * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified * --------------------------------------------------------------------------- */ -CsrResult unifi_card_read16(card_t *card, CsrUint32 unifi_addr, u16 *pdata) +CsrResult unifi_card_read16(card_t *card, u32 unifi_addr, u16 *pdata) { - CsrUint32 sdio_addr; + u32 sdio_addr; CsrResult r; r = set_page(card, unifi_addr, &sdio_addr); @@ -1199,9 +1199,9 @@ CsrResult unifi_card_read16(card_t *card, CsrUint32 unifi_addr, u16 *pdata) * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified * --------------------------------------------------------------------------- */ -CsrResult unifi_card_write16(card_t *card, CsrUint32 unifi_addr, u16 data) +CsrResult unifi_card_write16(card_t *card, u32 unifi_addr, u16 data) { - CsrUint32 sdio_addr; + u32 sdio_addr; CsrResult r; r = set_page(card, unifi_addr, &sdio_addr); @@ -1236,9 +1236,9 @@ CsrResult unifi_card_write16(card_t *card, CsrUint32 unifi_addr, u16 data) * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified * --------------------------------------------------------------------------- */ -CsrResult unifi_read32(card_t *card, CsrUint32 unifi_addr, CsrUint32 *pdata) +CsrResult unifi_read32(card_t *card, u32 unifi_addr, u32 *pdata) { - CsrUint32 sdio_addr; + u32 sdio_addr; CsrResult r; r = set_page(card, unifi_addr, &sdio_addr); @@ -1278,11 +1278,11 @@ CsrResult unifi_read32(card_t *card, CsrUint32 unifi_addr, CsrUint32 *pdata) * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified * --------------------------------------------------------------------------- */ -CsrResult unifi_readn_match(card_t *card, CsrUint32 unifi_addr, void *pdata, u16 len, s8 match) +CsrResult unifi_readn_match(card_t *card, u32 unifi_addr, void *pdata, u16 len, s8 match) { - CsrUint32 sdio_addr; + u32 sdio_addr; CsrResult r; - CsrUint32 num; + u32 num; r = set_page(card, unifi_addr, &sdio_addr); if (r != CSR_RESULT_SUCCESS) @@ -1295,13 +1295,13 @@ CsrResult unifi_readn_match(card_t *card, CsrUint32 unifi_addr, void *pdata, u16 } /* unifi_readn_match() */ -CsrResult unifi_card_readn(card_t *card, CsrUint32 unifi_addr, void *pdata, u16 len) +CsrResult unifi_card_readn(card_t *card, u32 unifi_addr, void *pdata, u16 len) { return unifi_readn_match(card, unifi_addr, pdata, len, -1); } /* unifi_card_readn() */ -CsrResult unifi_readnz(card_t *card, CsrUint32 unifi_addr, void *pdata, u16 len) +CsrResult unifi_readnz(card_t *card, u32 unifi_addr, void *pdata, u16 len) { return unifi_readn_match(card, unifi_addr, pdata, len, 0); } /* unifi_readnz() */ @@ -1323,7 +1323,7 @@ CsrResult unifi_readnz(card_t *card, CsrUint32 unifi_addr, void *pdata, u16 len) * Value read from memory (0-127) or -1 on error * --------------------------------------------------------------------------- */ -CsrInt32 unifi_read_shared_count(card_t *card, CsrUint32 addr) +CsrInt32 unifi_read_shared_count(card_t *card, u32 addr) { u8 b; /* I've increased this count, because I have seen cases where @@ -1384,9 +1384,9 @@ CsrInt32 unifi_read_shared_count(card_t *card, CsrUint32 addr) * CSR_WIFI_HIP_RESULT_INVALID_VALUE an odd length or length too big. * --------------------------------------------------------------------------- */ -CsrResult unifi_writen(card_t *card, CsrUint32 unifi_addr, void *pdata, u16 len) +CsrResult unifi_writen(card_t *card, u32 unifi_addr, void *pdata, u16 len) { - CsrUint32 sdio_addr; + u32 sdio_addr; CsrResult r; r = set_page(card, unifi_addr, &sdio_addr); @@ -1400,7 +1400,7 @@ CsrResult unifi_writen(card_t *card, CsrUint32 unifi_addr, void *pdata, u16 len) static CsrResult csr_sdio_block_rw(card_t *card, s16 funcnum, - CsrUint32 addr, u8 *pdata, + u32 addr, u8 *pdata, u16 count, s16 dir_is_write) { CsrResult csrResult; @@ -1472,8 +1472,8 @@ static CsrResult csr_sdio_block_rw(card_t *card, s16 funcnum, * This function uses SDIO CMD53, which is the block transfer mode. * --------------------------------------------------------------------------- */ -CsrResult unifi_bulk_rw(card_t *card, CsrUint32 handle, void *pdata, - CsrUint32 len, s16 direction) +CsrResult unifi_bulk_rw(card_t *card, u32 handle, void *pdata, + u32 len, s16 direction) { #define CMD53_RETRIES 3 /* @@ -1693,8 +1693,8 @@ CsrResult unifi_bulk_rw(card_t *card, CsrUint32 handle, void *pdata, * This function uses SDIO CMD53, which is the block transfer mode. * --------------------------------------------------------------------------- */ -CsrResult unifi_bulk_rw_noretry(card_t *card, CsrUint32 handle, void *pdata, - CsrUint32 len, s16 direction) +CsrResult unifi_bulk_rw_noretry(card_t *card, u32 handle, void *pdata, + u32 len, s16 direction) { CsrResult csrResult; diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper.c b/drivers/staging/csr/csr_wifi_hip_chiphelper.c index efdbab0..4e8cc3f 100644 --- a/drivers/staging/csr/csr_wifi_hip_chiphelper.c +++ b/drivers/staging/csr/csr_wifi_hip_chiphelper.c @@ -577,7 +577,7 @@ static const struct chip_device_desc_t *chip_ver_to_desc[] = ChipDescript* ChipHelper_GetVersionSdio(u8 sdio_ver) { - CsrUint32 i; + u32 i; for (i = 0; i < nelem(chip_ver_to_desc); i++) { @@ -593,7 +593,7 @@ ChipDescript* ChipHelper_GetVersionSdio(u8 sdio_ver) ChipDescript* ChipHelper_GetVersionAny(u16 from_FF9A, u16 from_FE81) { - CsrUint32 i; + u32 i; if ((from_FF9A & 0xFF00) != 0) { @@ -666,7 +666,7 @@ CHIP_HELPER_LIST(C_DEF) */ u16 ChipHelper_MapAddress_SPI2HOST(ChipDescript *chip_help, u16 addr) { - CsrUint32 i; + u32 i; for (i = 0; i < chip_help->map.len; i++) { if (chip_help->map.vals[i].spi == addr) @@ -680,7 +680,7 @@ u16 ChipHelper_MapAddress_SPI2HOST(ChipDescript *chip_help, u16 addr) u16 ChipHelper_MapAddress_HOST2SPI(ChipDescript *chip_help, u16 addr) { - CsrUint32 i; + u32 i; for (i = 0; i < chip_help->map.len; i++) { if (chip_help->map.vals[i].host == addr) @@ -725,7 +725,7 @@ u16 ChipHelper_WINDOW_SIZE(ChipDescript *chip_help, /* Get the register writes we should do to make sure that the chip is running with most clocks on. */ -CsrUint32 ChipHelper_ClockStartupSequence(ChipDescript *chip_help, +u32 ChipHelper_ClockStartupSequence(ChipDescript *chip_help, const struct chip_helper_init_values **val) { *val = chip_help->init.vals; @@ -734,7 +734,7 @@ CsrUint32 ChipHelper_ClockStartupSequence(ChipDescript /* Get the set of values tat we should write to the chip to perform a reset. */ -CsrUint32 ChipHelper_HostResetSequence(ChipDescript *chip_help, +u32 ChipHelper_HostResetSequence(ChipDescript *chip_help, const struct chip_helper_reset_values **val) { *val = chip_help->reset_prog.vals; @@ -746,8 +746,8 @@ CsrUint32 ChipHelper_HostResetSequence(ChipDescript *c CsrInt32 ChipHelper_DecodeWindow(ChipDescript *chip_help, enum chip_helper_window_index window, enum chip_helper_window_type type, - CsrUint32 offset, - u16 *page, u16 *addr, CsrUint32 *len) + u32 offset, + u16 *page, u16 *addr, u32 *len) { const struct window_info_t *win; const struct window_shift_info_t *mode; diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper.h b/drivers/staging/csr/csr_wifi_hip_chiphelper.h index a539c04..11cff4e 100644 --- a/drivers/staging/csr/csr_wifi_hip_chiphelper.h +++ b/drivers/staging/csr/csr_wifi_hip_chiphelper.h @@ -140,8 +140,8 @@ struct chip_helper_init_values /* A block of data that should be written to the device */ struct chip_helper_reset_values { - CsrUint32 gp_address; - CsrUint32 len; + u32 gp_address; + u32 len; const u16 *data; }; @@ -230,10 +230,10 @@ ChipDescript* ChipHelper_GetVersionBlueCore(enum chip_helper_bluecore_age age, CHIP_HELPER_DEF0(m, (u16, SDIO_HOST_INT, regs->sdio_host_int)) \ CHIP_HELPER_DEF0(m, (u16, COEX_STATUS, regs->coex_status)) \ CHIP_HELPER_DEF0(m, (u16, SHARED_IO_INTERRUPT, regs->shared_io_interrupt)) \ - CHIP_HELPER_DEF0(m, (CsrUint32, PROGRAM_MEMORY_RAM_OFFSET, prog_offset.ram)) \ - CHIP_HELPER_DEF0(m, (CsrUint32, PROGRAM_MEMORY_ROM_OFFSET, prog_offset.rom)) \ - CHIP_HELPER_DEF0(m, (CsrUint32, PROGRAM_MEMORY_FLASH_OFFSET, prog_offset.flash)) \ - CHIP_HELPER_DEF0(m, (CsrUint32, PROGRAM_MEMORY_EXT_SRAM_OFFSET, prog_offset.ext_sram)) \ + CHIP_HELPER_DEF0(m, (u32, PROGRAM_MEMORY_RAM_OFFSET, prog_offset.ram)) \ + CHIP_HELPER_DEF0(m, (u32, PROGRAM_MEMORY_ROM_OFFSET, prog_offset.rom)) \ + CHIP_HELPER_DEF0(m, (u32, PROGRAM_MEMORY_FLASH_OFFSET, prog_offset.flash)) \ + CHIP_HELPER_DEF0(m, (u32, PROGRAM_MEMORY_EXT_SRAM_OFFSET, prog_offset.ext_sram)) \ CHIP_HELPER_DEF0(m, (u16, DATA_MEMORY_RAM_OFFSET, data_offset.ram)) \ CHIP_HELPER_DEF0(m, (CsrInt32, HasFlash, bools.has_flash)) \ CHIP_HELPER_DEF0(m, (CsrInt32, HasExtSram, bools.has_ext_sram)) \ @@ -244,8 +244,8 @@ ChipDescript* ChipHelper_GetVersionBlueCore(enum chip_helper_bluecore_age age, CHIP_HELPER_DEF1(m, (u16, WINDOW_SIZE, enum chip_helper_window_index, window)) \ CHIP_HELPER_DEF1(m, (u16, MapAddress_SPI2HOST, u16, addr)) \ CHIP_HELPER_DEF1(m, (u16, MapAddress_HOST2SPI, u16, addr)) \ - CHIP_HELPER_DEF1(m, (CsrUint32, ClockStartupSequence, const struct chip_helper_init_values **, val)) \ - CHIP_HELPER_DEF1(m, (CsrUint32, HostResetSequence, const struct chip_helper_reset_values **, val)) + CHIP_HELPER_DEF1(m, (u32, ClockStartupSequence, const struct chip_helper_init_values **, val)) \ + CHIP_HELPER_DEF1(m, (u32, HostResetSequence, const struct chip_helper_reset_values **, val)) /* Some magic to help the expansion */ #define CHIP_HELPER_DEF0(a, b) \ @@ -405,8 +405,8 @@ CHIP_HELPER_LIST(C_DEC) CsrInt32 ChipHelper_DecodeWindow(ChipDescript *chip_help, enum chip_helper_window_index window, enum chip_helper_window_type type, - CsrUint32 offset, - u16 *page, u16 *addr, CsrUint32 *len); + u32 offset, + u16 *page, u16 *addr, u32 *len); #ifdef __cplusplus /* Close the extern "C" */ @@ -459,8 +459,8 @@ public: /* The DecodeWindow function, see the description of the C version. */ CsrInt32 DecodeWindow(chip_helper_window_index window, chip_helper_window_type type, - CsrUint32 offset, - u16 &page, u16 &addr, CsrUint32 &len) const; + u32 offset, + u16 &page, u16 &addr, u32 &len) const; private: ChipDescript *m_desc; diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h b/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h index aacafe1..de6e063 100644 --- a/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h +++ b/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h @@ -43,20 +43,20 @@ extern "C" { /* Address value pairs */ struct val_array_t { - CsrUint32 len; + u32 len; const struct chip_helper_init_values *vals; }; /* Just a (counted) u16 array */ struct data_array_t { - CsrUint32 len; + u32 len; const u16 *vals; }; struct reset_prog_t { - CsrUint32 len; + u32 len; const struct chip_helper_reset_values *vals; }; @@ -69,7 +69,7 @@ struct chip_map_address_t struct map_array_t { - CsrUint32 len; + u32 len; const struct chip_map_address_t *vals; }; @@ -118,7 +118,7 @@ struct chip_device_regs_t struct window_shift_info_t { CsrInt32 allowed; - CsrUint32 page_shift; + u32 page_shift; u16 page_offset; }; @@ -167,11 +167,11 @@ struct chip_device_desc_t /* Some misc. info on the chip */ struct { - CsrUint32 has_flash : 1; - CsrUint32 has_ext_sram : 1; - CsrUint32 has_rom : 1; - CsrUint32 has_bt : 1; - CsrUint32 has_wlan : 1; + u32 has_flash : 1; + u32 has_ext_sram : 1; + u32 has_rom : 1; + u32 has_bt : 1; + u32 has_wlan : 1; } bools; /* This table is used to remap register addresses depending on what @@ -184,10 +184,10 @@ struct chip_device_desc_t The RAM offset is probably the most useful. */ struct { - CsrUint32 ram; - CsrUint32 rom; - CsrUint32 flash; - CsrUint32 ext_sram; + u32 ram; + u32 rom; + u32 flash; + u32 ext_sram; } prog_offset; /* The offsets into the data address space of interesting things. */ diff --git a/drivers/staging/csr/csr_wifi_hip_download.c b/drivers/staging/csr/csr_wifi_hip_download.c index 808fae6a..e90faf3 100644 --- a/drivers/staging/csr/csr_wifi_hip_download.c +++ b/drivers/staging/csr/csr_wifi_hip_download.c @@ -25,7 +25,7 @@ #undef CSR_WIFI_IGNORE_PATCH_VERSION_MISMATCH static CsrResult do_patch_download(card_t *card, void *dlpriv, - xbv1_t *pfwinfo, CsrUint32 boot_ctrl_addr); + xbv1_t *pfwinfo, u32 boot_ctrl_addr); static CsrResult do_patch_convert_download(card_t *card, void *dlpriv, xbv1_t *pfwinfo); @@ -49,9 +49,9 @@ static CsrResult do_patch_convert_download(card_t *card, * CSR_WIFI_HIP_RESULT_NOT_FOUND if not found * --------------------------------------------------------------------------- */ -static CsrResult _find_in_slut(card_t *card, symbol_t *psym, CsrUint32 *pslut) +static CsrResult _find_in_slut(card_t *card, symbol_t *psym, u32 *pslut) { - CsrUint32 slut_address; + u32 slut_address; u16 finger_print; CsrResult r; CsrResult csrResult; @@ -122,7 +122,7 @@ static CsrResult _find_in_slut(card_t *card, symbol_t *psym, CsrUint32 *pslut) while (1) { u16 id; - CsrUint32 obj; + u32 obj; r = unifi_card_read16(card, slut_address, &id); if (r != CSR_RESULT_SUCCESS) @@ -186,9 +186,9 @@ static CsrResult _find_in_slut(card_t *card, symbol_t *psym, CsrUint32 *pslut) static CsrResult do_patch_convert_download(card_t *card, void *dlpriv, xbv1_t *pfwinfo) { CsrResult r; - CsrUint32 slut_base = 0xffffffff; + u32 slut_base = 0xffffffff; void *pfw; - CsrUint32 psize; + u32 psize; symbol_t sym; /* Reset the chip to guarantee that the ROM loader is running */ @@ -203,7 +203,7 @@ static CsrResult do_patch_convert_download(card_t *card, void *dlpriv, xbv1_t *p /* If no unifi_helper is running, the firmware version must be read */ if (card->build_id == 0) { - CsrUint32 ver = 0; + u32 ver = 0; sym.id = CSR_SLT_BUILD_ID_NUMBER; sym.obj = 0; /* To be updated by _find_in_slut() */ @@ -399,7 +399,7 @@ CsrResult unifi_dl_firmware(card_t *card, void *dlpriv) * This ends up telling UniFi to restart. * --------------------------------------------------------------------------- */ -CsrResult unifi_dl_patch(card_t *card, void *dlpriv, CsrUint32 boot_ctrl) +CsrResult unifi_dl_patch(card_t *card, void *dlpriv, u32 boot_ctrl) { xbv1_t *fwinfo; CsrResult r; @@ -497,7 +497,7 @@ void* unifi_dl_fw_read_start(card_t *card, s8 is_fw) * CSR_RESULT_SUCCESS on success, CSR error code on failure * --------------------------------------------------------------------------- */ -static CsrResult safe_read_shared_location(card_t *card, CsrUint32 address, u8 *pdata) +static CsrResult safe_read_shared_location(card_t *card, u32 address, u8 *pdata) { CsrResult r; u16 limit = 1000; @@ -559,7 +559,7 @@ static CsrResult safe_read_shared_location(card_t *card, CsrUint32 address, u8 * #define OPERATION_TIMEOUT_LOOPS (100) /* when OPERATION_TIMEOUT_DELAY==1, (500) otherwise */ #define OPERATION_TIMEOUT_DELAY 1 /* msec, or 200usecs */ -CsrResult unifi_do_loader_op(card_t *card, CsrUint32 op_addr, u8 opcode) +CsrResult unifi_do_loader_op(card_t *card, u32 op_addr, u8 opcode) { CsrResult r; s16 op_retries; @@ -654,13 +654,13 @@ CsrResult unifi_do_loader_op(card_t *card, CsrUint32 op_addr, u8 opcode) * --------------------------------------------------------------------------- */ static CsrResult send_ptdl_to_unifi(card_t *card, void *dlpriv, - const struct PTDL *ptdl, CsrUint32 handle, - CsrUint32 op_addr) + const struct PTDL *ptdl, u32 handle, + u32 op_addr) { - CsrUint32 offset; + u32 offset; u8 *buf; CsrInt32 data_len; - CsrUint32 write_len; + u32 write_len; CsrResult r; const u16 buf_size = 2 * 1024; @@ -753,13 +753,13 @@ static CsrResult send_ptdl_to_unifi(card_t *card, void *dlpriv, * CSR_WIFI_HIP_RESULT_INVALID_VALUE for a bad laoader version number * --------------------------------------------------------------------------- */ -static CsrResult do_patch_download(card_t *card, void *dlpriv, xbv1_t *pfwinfo, CsrUint32 boot_ctrl_addr) +static CsrResult do_patch_download(card_t *card, void *dlpriv, xbv1_t *pfwinfo, u32 boot_ctrl_addr) { CsrResult r; CsrInt32 i; u16 loader_version; u16 handle; - CsrUint32 total_bytes; + u32 total_bytes; /* * Read info from the SDIO Loader Control Data Structure diff --git a/drivers/staging/csr/csr_wifi_hip_dump.c b/drivers/staging/csr/csr_wifi_hip_dump.c index da1a7ac..2f70a6c 100644 --- a/drivers/staging/csr/csr_wifi_hip_dump.c +++ b/drivers/staging/csr/csr_wifi_hip_dump.c @@ -42,7 +42,7 @@ typedef struct coredump_buf CsrTime timestamp; /* host's system time at capture */ s16 requestor; /* request: 0=auto dump, 1=manual */ u16 chip_ver; - CsrUint32 fw_ver; + u32 fw_ver; u16 *zone[HIP_CDUMP_NUM_ZONES]; struct coredump_buf *next; /* circular list */ @@ -54,7 +54,7 @@ struct coredump_zone { unifi_coredump_space_t space; /* XAP memory space this zone covers */ enum unifi_dbg_processors_select cpu; /* XAP CPU core selector */ - CsrUint32 gp; /* Generic Pointer to memory zone on XAP */ + u32 gp; /* Generic Pointer to memory zone on XAP */ u16 offset; /* 16-bit XAP word offset of zone in memory space */ u16 length; /* Length of zone in XAP words */ }; @@ -299,7 +299,7 @@ static CsrInt32 get_value_from_coredump(const coredump_buffer *coreDump, { CsrInt32 r = -1; u16 offset_in_zone; - CsrUint32 zone_end_offset; + u32 zone_end_offset; CsrInt32 i; const struct coredump_zone *def = &zonedef_table[0]; @@ -587,7 +587,7 @@ static CsrResult unifi_coredump_from_sdio(card_t *card, coredump_buffer *dump_bu { u16 val; CsrResult r; - CsrUint32 sdio_addr; + u32 sdio_addr; func_enter(); @@ -663,7 +663,7 @@ coredump_buffer* new_coredump_node(void *ospriv, coredump_buffer *prevnode) coredump_buffer *newnode = NULL; u16 *newzone = NULL; CsrInt32 i; - CsrUint32 zone_size; + u32 zone_size; /* Allocate node header */ newnode = (coredump_buffer *)CsrMemAlloc(sizeof(coredump_buffer)); @@ -744,7 +744,7 @@ CsrResult unifi_coredump_init(card_t *card, u16 num_dump_buffers) void *ospriv = card->ospriv; coredump_buffer *prev = NULL; coredump_buffer *newnode = NULL; - CsrUint32 i = 0; + u32 i = 0; #endif func_enter(); diff --git a/drivers/staging/csr/csr_wifi_hip_send.c b/drivers/staging/csr/csr_wifi_hip_send.c index 3e0e72e..88b5e34 100644 --- a/drivers/staging/csr/csr_wifi_hip_send.c +++ b/drivers/staging/csr/csr_wifi_hip_send.c @@ -100,9 +100,9 @@ CSR_PRIORITY unifi_get_default_downgrade_priority(unifi_TrafficQueue queue) * Calls unifi_pause_xmit() when the last slots are used. * --------------------------------------------------------------------------- */ -static CsrResult send_signal(card_t *card, const u8 *sigptr, CsrUint32 siglen, +static CsrResult send_signal(card_t *card, const u8 *sigptr, u32 siglen, const bulk_data_param_t *bulkdata, - q_t *sigq, CsrUint32 priority_q, CsrUint32 run_bh) + q_t *sigq, u32 priority_q, u32 run_bh) { u16 i, data_slot_size; card_signal_t *csptr; @@ -135,7 +135,7 @@ static CsrResult send_signal(card_t *card, const u8 *sigptr, CsrUint32 siglen, { if ((bulkdata != NULL) && (bulkdata->d[i].data_length != 0)) { - CsrUint32 datalen = bulkdata->d[i].data_length; + u32 datalen = bulkdata->d[i].data_length; /* Make sure data will fit in a bulk data slot */ if (bulkdata->d[i].os_data_ptr == NULL) @@ -303,14 +303,14 @@ static CsrResult send_signal(card_t *card, const u8 *sigptr, CsrUint32 siglen, * to the device. Signals are constructed using the UniFi packed structures. * --------------------------------------------------------------------------- */ -CsrResult unifi_send_signal(card_t *card, const u8 *sigptr, CsrUint32 siglen, +CsrResult unifi_send_signal(card_t *card, const u8 *sigptr, u32 siglen, const bulk_data_param_t *bulkdata) { q_t *sig_soft_q; u16 signal_id; CsrResult r; - CsrUint32 run_bh; - CsrUint32 priority_q; + u32 run_bh; + u32 priority_q; /* A NULL signal pointer is a request to check if UniFi is responsive */ if (sigptr == NULL) @@ -395,7 +395,7 @@ CsrResult unifi_send_resources_available(card_t *card, const u8 *sigptr) if (signal_id == CSR_MA_PACKET_REQUEST_ID) { u16 frame_priority; - CsrUint32 priority_q; + u32 priority_q; /* Map the frame priority to a traffic queue index. */ frame_priority = GET_PACKED_MA_PACKET_REQUEST_FRAME_PRIORITY(sigptr); diff --git a/drivers/staging/csr/csr_wifi_hip_signals.c b/drivers/staging/csr/csr_wifi_hip_signals.c index a1b16fa..43d9b8e 100644 --- a/drivers/staging/csr/csr_wifi_hip_signals.c +++ b/drivers/staging/csr/csr_wifi_hip_signals.c @@ -944,7 +944,7 @@ CsrInt32 SigGetDataRefs(CSR_SIGNAL *aSignal, CSR_DATAREF **aDataRef) } -CsrUint32 SigGetFilterPos(u16 aSigID) +u32 SigGetFilterPos(u16 aSigID) { switch (aSigID) { diff --git a/drivers/staging/csr/csr_wifi_hip_sigs.h b/drivers/staging/csr/csr_wifi_hip_sigs.h index d9c9d1e..a483179 100644 --- a/drivers/staging/csr/csr_wifi_hip_sigs.h +++ b/drivers/staging/csr/csr_wifi_hip_sigs.h @@ -61,9 +61,9 @@ typedef u16 CSR_CAPABILITY_INFORMATION; typedef u16 CSR_CHANNEL_STARTING_FACTOR; -typedef CsrUint32 CSR_CIPHER_SUITE_SELECTOR; +typedef u32 CSR_CIPHER_SUITE_SELECTOR; -typedef CsrUint32 CSR_CLIENT_TAG; +typedef u32 CSR_CLIENT_TAG; typedef enum CSR_CONNECTION_STATUS { @@ -89,7 +89,7 @@ typedef enum CSR_FRAME_TYPE CSR_PROBE_REQUEST = 0x0004 } CSR_FRAME_TYPE; -typedef CsrUint32 CSR_IPV4_ADDRESS; +typedef u32 CSR_IPV4_ADDRESS; typedef enum CSR_IFINTERFACE { @@ -144,7 +144,7 @@ typedef enum CSR_MEMORY_SPACE typedef u16 CSR_MICROSECONDS16; -typedef CsrUint32 CSR_MICROSECONDS32; +typedef u32 CSR_MICROSECONDS32; typedef u16 CSR_NATURAL16; @@ -1416,7 +1416,7 @@ typedef struct CSR_SIGNAL_PRIMITIVE #define SIG_FILTER_SIZE 6 -CsrUint32 SigGetFilterPos(u16 aSigID); +u32 SigGetFilterPos(u16 aSigID); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_wifi_hip_ta_sampling.c b/drivers/staging/csr/csr_wifi_hip_ta_sampling.c index b53abbf..33fc315 100644 --- a/drivers/staging/csr/csr_wifi_hip_ta_sampling.c +++ b/drivers/staging/csr/csr_wifi_hip_ta_sampling.c @@ -100,16 +100,16 @@ static enum ta_frame_identity ta_detect_protocol(card_t *card, CsrWifiRouterCtrl u16 proto; u16 source_port, dest_port; CsrWifiMacAddress srcAddress; - CsrUint32 snap_hdr, oui_hdr; + u32 snap_hdr, oui_hdr; if (data->data_length < TA_LLC_HEADER_SIZE) { return TA_FRAME_UNKNOWN; } - snap_hdr = (((CsrUint32)data->os_data_ptr[0]) << 24) | - (((CsrUint32)data->os_data_ptr[1]) << 16) | - (((CsrUint32)data->os_data_ptr[2]) << 8); + snap_hdr = (((u32)data->os_data_ptr[0]) << 24) | + (((u32)data->os_data_ptr[1]) << 16) | + (((u32)data->os_data_ptr[2]) << 8); if (snap_hdr != snap_802_2) { return TA_FRAME_UNKNOWN; @@ -122,9 +122,9 @@ static enum ta_frame_identity ta_detect_protocol(card_t *card, CsrWifiRouterCtrl */ } - oui_hdr = (((CsrUint32)data->os_data_ptr[3]) << 24) | - (((CsrUint32)data->os_data_ptr[4]) << 16) | - (((CsrUint32)data->os_data_ptr[5]) << 8); + oui_hdr = (((u32)data->os_data_ptr[3]) << 24) | + (((u32)data->os_data_ptr[4]) << 16) | + (((u32)data->os_data_ptr[5]) << 8); if ((oui_hdr == oui_rfc1042) || (oui_hdr == oui_8021h)) { proto = (data->os_data_ptr[TA_ETHERNET_TYPE_OFFSET] * 256) + @@ -346,12 +346,12 @@ void unifi_ta_sample(card_t *card, const bulk_data_desc_t *data, const u8 *saddr, const u8 *sta_macaddr, - CsrUint32 timestamp, + u32 timestamp, u16 rate) { ta_data_t *tad = &card->ta_sampling; enum ta_frame_identity identity; - CsrUint32 time_delta; + u32 time_delta; @@ -387,8 +387,8 @@ void unifi_ta_sample(card_t *card, */ if (tad->stats.txFramesNum < TA_MAX_INTERVALS_IN_C1) { - CsrUint32 interval; - CsrUint32 index_in_intervals; + u32 interval; + u32 index_in_intervals; interval = timestamp - tad->tx_last_ts; tad->tx_last_ts = timestamp; @@ -423,7 +423,7 @@ void unifi_ta_sample(card_t *card, * rxFramesNum can be flashed in tas_reset_data() by another thread. * Use a temp to avoid division by zero. */ - CsrUint32 temp_rxFramesNum; + u32 temp_rxFramesNum; temp_rxFramesNum = tad->stats.rxFramesNum; /* Calculate this interval's mean frame Rx rate from the sum */ @@ -442,10 +442,10 @@ void unifi_ta_sample(card_t *card, */ if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM) { - CsrUint32 rxTcpThroughput = tad->ta_l4stats.rxTcpBytesCount / time_delta; - CsrUint32 txTcpThroughput = tad->ta_l4stats.txTcpBytesCount / time_delta; - CsrUint32 rxUdpThroughput = tad->ta_l4stats.rxUdpBytesCount / time_delta; - CsrUint32 txUdpThroughput = tad->ta_l4stats.txUdpBytesCount / time_delta; + u32 rxTcpThroughput = tad->ta_l4stats.rxTcpBytesCount / time_delta; + u32 txTcpThroughput = tad->ta_l4stats.txTcpBytesCount / time_delta; + u32 rxUdpThroughput = tad->ta_l4stats.rxUdpBytesCount / time_delta; + u32 txUdpThroughput = tad->ta_l4stats.txUdpBytesCount / time_delta; unifi_ta_indicate_l4stats(card->ospriv, rxTcpThroughput, diff --git a/drivers/staging/csr/csr_wifi_hip_ta_sampling.h b/drivers/staging/csr/csr_wifi_hip_ta_sampling.h index 7183e25..46c630b 100644 --- a/drivers/staging/csr/csr_wifi_hip_ta_sampling.h +++ b/drivers/staging/csr/csr_wifi_hip_ta_sampling.h @@ -29,10 +29,10 @@ extern "C" { typedef struct ta_l4stats { - CsrUint32 rxTcpBytesCount; - CsrUint32 txTcpBytesCount; - CsrUint32 rxUdpBytesCount; - CsrUint32 txUdpBytesCount; + u32 rxTcpBytesCount; + u32 txTcpBytesCount; + u32 rxUdpBytesCount; + u32 txUdpBytesCount; } ta_l4stats_t; /* @@ -48,10 +48,10 @@ typedef struct ta_data CsrWifiRouterCtrlTrafficFilter custom_filter; /* The timestamp of the last tx packet processed. */ - CsrUint32 tx_last_ts; + u32 tx_last_ts; /* The timestamp of the last packet processed. */ - CsrUint32 last_indication_time; + u32 last_indication_time; /* Statistics */ CsrWifiRouterCtrlTrafficStats stats; @@ -60,7 +60,7 @@ typedef struct ta_data CsrWifiRouterCtrlTrafficType traffic_type; /* Sum of packet rx rates for this interval used to calculate mean */ - CsrUint32 rx_sum_rate; + u32 rx_sum_rate; ta_l4stats_t ta_l4stats; } ta_data_t; diff --git a/drivers/staging/csr/csr_wifi_hip_unifi.h b/drivers/staging/csr/csr_wifi_hip_unifi.h index cbe600d..6f2090e 100644 --- a/drivers/staging/csr/csr_wifi_hip_unifi.h +++ b/drivers/staging/csr/csr_wifi_hip_unifi.h @@ -140,16 +140,16 @@ typedef enum typedef struct _bulk_data_desc { const u8 *os_data_ptr; - CsrUint32 data_length; + u32 data_length; const void *os_net_buf_ptr; - CsrUint32 net_buf_length; + u32 net_buf_length; } bulk_data_desc_t; /* Structure of an entry in the Symbol Look Up Table (SLUT). */ typedef struct _symbol { u16 id; - CsrUint32 obj; + u32 obj; } symbol_t; /* @@ -196,9 +196,9 @@ typedef struct _card_info { u16 chip_id; u16 chip_version; - CsrUint32 fw_build; + u32 fw_build; u16 fw_hip_version; - CsrUint32 sdio_block_size; + u32 sdio_block_size; } card_info_t; @@ -225,14 +225,14 @@ typedef struct unifi_coredump_req /* From user */ CsrInt32 index; /* 0=newest, -1=oldest */ unifi_coredump_space_t space; /* memory space */ - CsrUint32 offset; /* register offset in space */ + u32 offset; /* register offset in space */ /* From driver */ - CsrUint32 drv_build; /* Driver build id */ - CsrUint32 chip_ver; /* Chip version */ - CsrUint32 fw_ver; /* Firmware version */ + u32 drv_build; /* Driver build id */ + u32 chip_ver; /* Chip version */ + u32 fw_ver; /* Firmware version */ CsrInt32 requestor; /* Requestor: 0=auto dump, 1=manual */ CsrTime timestamp; /* time of capture by driver */ - CsrUint32 serial; /* capture serial number */ + u32 serial; /* capture serial number */ CsrInt32 value; /* register value */ } unifi_coredump_req_t; /* mini-coredumped reg value request */ @@ -325,7 +325,7 @@ void unifi_cancel_pending_signals(card_t *card); * @ingroup upperedge */ CsrResult unifi_send_signal(card_t *card, const u8 *sigptr, - CsrUint32 siglen, + u32 siglen, const bulk_data_param_t *bulkdata); /** @@ -398,7 +398,7 @@ CsrResult unifi_check_io_status(card_t *card, CsrInt32 *status); * * @ingroup upperedge */ -CsrResult unifi_bh(card_t *card, CsrUint32 *remaining); +CsrResult unifi_bh(card_t *card, u32 *remaining); /** @@ -513,7 +513,7 @@ void unifi_ta_sample(card_t *card, const bulk_data_desc_t *data, const u8 *saddr, const u8 *sta_macaddr, - CsrUint32 timestamp, + u32 timestamp, u16 rate); /** @@ -545,9 +545,9 @@ void unifi_ta_classification(card_t *card, CsrResult unifi_card_hard_reset(card_t *card); -CsrResult unifi_card_readn(card_t *card, CsrUint32 unifi_addr, void *pdata, u16 len); -CsrResult unifi_card_read16(card_t *card, CsrUint32 unifi_addr, u16 *pdata); -CsrResult unifi_card_write16(card_t *card, CsrUint32 unifi_addr, u16 data); +CsrResult unifi_card_readn(card_t *card, u32 unifi_addr, void *pdata, u16 len); +CsrResult unifi_card_read16(card_t *card, u32 unifi_addr, u16 *pdata); +CsrResult unifi_card_write16(card_t *card, u32 unifi_addr, u16 data); enum unifi_dbg_processors_select @@ -643,7 +643,7 @@ CsrResult unifi_run_bh(void *ospriv); * @ingroup upperedge */ void unifi_receive_event(void *ospriv, - u8 *sigdata, CsrUint32 siglen, + u8 *sigdata, u32 siglen, const bulk_data_param_t *bulkdata); #ifdef CSR_WIFI_REQUEUE_PACKET_TO_HAL @@ -659,7 +659,7 @@ void unifi_receive_event(void *ospriv, * * @ingroup upperedge */ -CsrResult unifi_reque_ma_packet_request(void *ospriv, CsrUint32 host_tag, +CsrResult unifi_reque_ma_packet_request(void *ospriv, u32 host_tag, u16 status, bulk_data_desc_t *bulkDataDesc); @@ -719,7 +719,7 @@ void* unifi_fw_read_start(void *ospriv, s8 is_fw, const card_info_t *info); * * @ingroup upperedge */ -CsrInt32 unifi_fw_read(void *ospriv, void *arg, CsrUint32 offset, void *buf, CsrUint32 len); +CsrInt32 unifi_fw_read(void *ospriv, void *arg, u32 offset, void *buf, u32 len); /** * @@ -746,7 +746,7 @@ void unifi_fw_read_stop(void *ospriv, void *dlpriv); * * @ingroup upperedge */ -void* unifi_fw_open_buffer(void *ospriv, void *fwbuf, CsrUint32 len); +void* unifi_fw_open_buffer(void *ospriv, void *fwbuf, u32 len); /** * @@ -806,10 +806,10 @@ void unifi_ta_indicate_protocol(void *ospriv, */ void unifi_ta_indicate_sampling(void *ospriv, CsrWifiRouterCtrlTrafficStats *stats); void unifi_ta_indicate_l4stats(void *ospriv, - CsrUint32 rxTcpThroughput, - CsrUint32 txTcpThroughput, - CsrUint32 rxUdpThroughput, - CsrUint32 txUdpThroughput); + u32 rxTcpThroughput, + u32 txTcpThroughput, + u32 rxUdpThroughput, + u32 txUdpThroughput); #endif void unifi_rx_queue_flush(void *ospriv); @@ -849,7 +849,7 @@ CsrResult unifi_capture_panic(card_t *card); #define CSR_WIFI_INTMODE_DEFAULT 0 #define CSR_WIFI_INTMODE_RUN_BH_ONCE 1 /* Run BH once per interrupt */ -void unifi_set_interrupt_mode(card_t *card, CsrUint32 mode); +void unifi_set_interrupt_mode(card_t *card, u32 mode); /* * unifi_request_max_clock() requests that max SDIO clock speed is set at the diff --git a/drivers/staging/csr/csr_wifi_hip_unifi_udi.h b/drivers/staging/csr/csr_wifi_hip_unifi_udi.h index e69f5c7..774bdc9 100644 --- a/drivers/staging/csr/csr_wifi_hip_unifi_udi.h +++ b/drivers/staging/csr/csr_wifi_hip_unifi_udi.h @@ -38,7 +38,7 @@ enum udi_log_direction }; typedef void (*udi_func_t)(void *ospriv, u8 *sigdata, - CsrUint32 signal_len, + u32 signal_len, const bulk_data_param_t *bulkdata, enum udi_log_direction dir); diff --git a/drivers/staging/csr/csr_wifi_hip_xbv.c b/drivers/staging/csr/csr_wifi_hip_xbv.c index 3236b2b..3d559af 100644 --- a/drivers/staging/csr/csr_wifi_hip_xbv.c +++ b/drivers/staging/csr/csr_wifi_hip_xbv.c @@ -53,7 +53,7 @@ typedef struct typedef struct { CsrCharString t_name[4]; - CsrUint32 t_len; + u32 t_len; } tag_t; @@ -86,44 +86,44 @@ typedef struct xbv_container container; CsrInt32 ioffset_end; } s[XBV_STACK_SIZE]; - CsrUint32 ptr; + u32 ptr; } xbv_stack_t; static CsrInt32 read_tag(card_t *card, ct_t *ct, tag_t *tag); -static CsrInt32 read_bytes(card_t *card, ct_t *ct, void *buf, CsrUint32 len); -static CsrInt32 read_uint(card_t *card, ct_t *ct, CsrUint32 *u, CsrUint32 len); +static CsrInt32 read_bytes(card_t *card, ct_t *ct, void *buf, u32 len); +static CsrInt32 read_uint(card_t *card, ct_t *ct, u32 *u, u32 len); static CsrInt32 xbv_check(xbv1_t *fwinfo, const xbv_stack_t *stack, xbv_mode new_mode, xbv_container old_cont); static CsrInt32 xbv_push(xbv1_t *fwinfo, xbv_stack_t *stack, xbv_mode new_mode, xbv_container old_cont, - xbv_container new_cont, CsrUint32 ioff); + xbv_container new_cont, u32 ioff); -static CsrUint32 write_uint16(void *buf, const CsrUint32 offset, +static u32 write_uint16(void *buf, const u32 offset, const u16 val); -static CsrUint32 write_uint32(void *buf, const CsrUint32 offset, - const CsrUint32 val); -static CsrUint32 write_bytes(void *buf, const CsrUint32 offset, - const u8 *data, const CsrUint32 len); -static CsrUint32 write_tag(void *buf, const CsrUint32 offset, +static u32 write_uint32(void *buf, const u32 offset, + const u32 val); +static u32 write_bytes(void *buf, const u32 offset, + const u8 *data, const u32 len); +static u32 write_tag(void *buf, const u32 offset, const CsrCharString *tag_str); -static CsrUint32 write_chunk(void *buf, const CsrUint32 offset, +static u32 write_chunk(void *buf, const u32 offset, const CsrCharString *tag_str, - const CsrUint32 payload_len); -static u16 calc_checksum(void *buf, const CsrUint32 offset, - const CsrUint32 bytes_len); -static CsrUint32 calc_patch_size(const xbv1_t *fwinfo); - -static CsrUint32 write_xbv_header(void *buf, const CsrUint32 offset, - const CsrUint32 file_payload_length); -static CsrUint32 write_ptch_header(void *buf, const CsrUint32 offset, - const CsrUint32 fw_id); -static CsrUint32 write_patchcmd(void *buf, const CsrUint32 offset, - const CsrUint32 dst_genaddr, const u16 len); -static CsrUint32 write_reset_ptdl(void *buf, const CsrUint32 offset, - const xbv1_t *fwinfo, CsrUint32 fw_id); -static CsrUint32 write_fwdl_to_ptdl(void *buf, const CsrUint32 offset, + const u32 payload_len); +static u16 calc_checksum(void *buf, const u32 offset, + const u32 bytes_len); +static u32 calc_patch_size(const xbv1_t *fwinfo); + +static u32 write_xbv_header(void *buf, const u32 offset, + const u32 file_payload_length); +static u32 write_ptch_header(void *buf, const u32 offset, + const u32 fw_id); +static u32 write_patchcmd(void *buf, const u32 offset, + const u32 dst_genaddr, const u16 len); +static u32 write_reset_ptdl(void *buf, const u32 offset, + const xbv1_t *fwinfo, u32 fw_id); +static u32 write_fwdl_to_ptdl(void *buf, const u32 offset, fwreadfn_t readfn, const struct FWDL *fwdl, - const void *fw_buf, const CsrUint32 fw_id, + const void *fw_buf, const u32 fw_id, void *rdbuf); /* @@ -210,7 +210,7 @@ CsrResult xbv1_parse(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwin /* File format version */ if (TAG_EQ(tag.t_name, "VERF")) { - CsrUint32 version; + u32 version; if (xbv_check(fwinfo, &stack, xbv_unknown, xbv_xbv1) || (tag.t_len != 2) || @@ -228,7 +228,7 @@ CsrResult xbv1_parse(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwin else if (TAG_EQ(tag.t_name, "LIST")) { CsrCharString name[4]; - CsrUint32 list_end; + u32 list_end; list_end = ct.ioffset + tag.t_len; @@ -287,7 +287,7 @@ CsrResult xbv1_parse(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwin } else if (TAG_EQ(tag.t_name, "SLTP")) { - CsrUint32 addr; + u32 addr; if (xbv_check(fwinfo, &stack, xbv_firmware, xbv_fw) || (tag.t_len != 4) || @@ -301,7 +301,7 @@ CsrResult xbv1_parse(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwin } else if (TAG_EQ(tag.t_name, "FWDL")) { - CsrUint32 addr; + u32 addr; struct FWDL *fwdl; if (xbv_check(fwinfo, &stack, xbv_firmware, xbv_fw) || @@ -335,7 +335,7 @@ CsrResult xbv1_parse(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwin } else if (TAG_EQ(tag.t_name, "VMEQ")) { - CsrUint32 temp[3]; + u32 temp[3]; struct VAND *vand; struct VMEQ *vmeq; @@ -366,7 +366,7 @@ CsrResult xbv1_parse(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwin } else if (TAG_EQ(tag.t_name, "FWID")) { - CsrUint32 build_id; + u32 build_id; if (xbv_check(fwinfo, &stack, xbv_patch, xbv_ptch) || (tag.t_len != 4) || @@ -467,7 +467,7 @@ static CsrInt32 xbv_check(xbv1_t *fwinfo, const xbv_stack_t *stack, /* Make checks as above and then enter a new list */ static CsrInt32 xbv_push(xbv1_t *fwinfo, xbv_stack_t *stack, xbv_mode new_mode, xbv_container old_cont, - xbv_container new_cont, CsrUint32 new_ioff) + xbv_container new_cont, u32 new_ioff) { if (xbv_check(fwinfo, stack, new_mode, old_cont)) { @@ -489,14 +489,14 @@ static CsrInt32 xbv_push(xbv1_t *fwinfo, xbv_stack_t *stack, } -static CsrUint32 xbv2uint(u8 *ptr, CsrInt32 len) +static u32 xbv2uint(u8 *ptr, CsrInt32 len) { - CsrUint32 u = 0; + u32 u = 0; s16 i; for (i = 0; i < len; i++) { - CsrUint32 b; + u32 b; b = ptr[i]; u += b << (i * 8); } @@ -533,7 +533,7 @@ static CsrInt32 read_tag(card_t *card, ct_t *ct, tag_t *tag) } /* read_tag() */ -static CsrInt32 read_bytes(card_t *card, ct_t *ct, void *buf, CsrUint32 len) +static CsrInt32 read_bytes(card_t *card, ct_t *ct, void *buf, u32 len) { /* read the tag value */ if ((*ct->iread)(card->ospriv, ct->dlpriv, ct->ioffset, buf, len) != (CsrInt32)len) @@ -547,7 +547,7 @@ static CsrInt32 read_bytes(card_t *card, ct_t *ct, void *buf, CsrUint32 len) } /* read_bytes() */ -static CsrInt32 read_uint(card_t *card, ct_t *ct, CsrUint32 *u, CsrUint32 len) +static CsrInt32 read_uint(card_t *card, ct_t *ct, u32 *u, u32 len) { u8 buf[4]; @@ -568,7 +568,7 @@ static CsrInt32 read_uint(card_t *card, ct_t *ct, CsrUint32 *u, CsrUint32 len) } /* read_uint() */ -static CsrUint32 write_uint16(void *buf, const CsrUint32 offset, const u16 val) +static u32 write_uint16(void *buf, const u32 offset, const u16 val) { u8 *dst = (u8 *)buf + offset; *dst++ = (u8)(val & 0xff); /* LSB first */ @@ -577,17 +577,17 @@ static CsrUint32 write_uint16(void *buf, const CsrUint32 offset, const u16 val) } -static CsrUint32 write_uint32(void *buf, const CsrUint32 offset, const CsrUint32 val) +static u32 write_uint32(void *buf, const u32 offset, const u32 val) { (void)write_uint16(buf, offset + 0, (u16)(val & 0xffff)); (void)write_uint16(buf, offset + 2, (u16)(val >> 16)); - return sizeof(CsrUint32); + return sizeof(u32); } -static CsrUint32 write_bytes(void *buf, const CsrUint32 offset, const u8 *data, const CsrUint32 len) +static u32 write_bytes(void *buf, const u32 offset, const u8 *data, const u32 len) { - CsrUint32 i; + u32 i; u8 *dst = (u8 *)buf + offset; for (i = 0; i < len; i++) @@ -598,7 +598,7 @@ static CsrUint32 write_bytes(void *buf, const CsrUint32 offset, const u8 *data, } -static CsrUint32 write_tag(void *buf, const CsrUint32 offset, const CsrCharString *tag_str) +static u32 write_tag(void *buf, const u32 offset, const CsrCharString *tag_str) { u8 *dst = (u8 *)buf + offset; CsrMemCpy(dst, tag_str, 4); @@ -606,19 +606,19 @@ static CsrUint32 write_tag(void *buf, const CsrUint32 offset, const CsrCharStrin } -static CsrUint32 write_chunk(void *buf, const CsrUint32 offset, const CsrCharString *tag_str, const CsrUint32 payload_len) +static u32 write_chunk(void *buf, const u32 offset, const CsrCharString *tag_str, const u32 payload_len) { - CsrUint32 written = 0; + u32 written = 0; written += write_tag(buf, offset, tag_str); - written += write_uint32(buf, written + offset, (CsrUint32)payload_len); + written += write_uint32(buf, written + offset, (u32)payload_len); return written; } -static u16 calc_checksum(void *buf, const CsrUint32 offset, const CsrUint32 bytes_len) +static u16 calc_checksum(void *buf, const u32 offset, const u32 bytes_len) { - CsrUint32 i; + u32 i; u8 *src = (u8 *)buf + offset; u16 sum = 0; u16 val; @@ -640,10 +640,10 @@ static u16 calc_checksum(void *buf, const CsrUint32 offset, const CsrUint32 byte #define PTDL_RESET_DATA_SIZE 20 /* Size of reset vectors PTDL */ -static CsrUint32 calc_patch_size(const xbv1_t *fwinfo) +static u32 calc_patch_size(const xbv1_t *fwinfo) { s16 i; - CsrUint32 size = 0; + u32 size = 0; /* * Work out how big an equivalent patch format file must be for this image. @@ -673,9 +673,9 @@ static CsrUint32 calc_patch_size(const xbv1_t *fwinfo) } -static CsrUint32 write_xbv_header(void *buf, const CsrUint32 offset, const CsrUint32 file_payload_length) +static u32 write_xbv_header(void *buf, const u32 offset, const u32 file_payload_length) { - CsrUint32 written = 0; + u32 written = 0; /* The length value given to the XBV chunk is the length of all subsequent * contents of the file, excluding the 8 byte size of the XBV1 header itself @@ -690,9 +690,9 @@ static CsrUint32 write_xbv_header(void *buf, const CsrUint32 offset, const CsrUi } -static CsrUint32 write_ptch_header(void *buf, const CsrUint32 offset, const CsrUint32 fw_id) +static u32 write_ptch_header(void *buf, const u32 offset, const u32 fw_id) { - CsrUint32 written = 0; + u32 written = 0; /* LIST is written with a zero length, to be updated later */ written += write_chunk(buf, offset + written, (CsrCharString *)"LIST", 0); @@ -711,10 +711,10 @@ static CsrUint32 write_ptch_header(void *buf, const CsrUint32 offset, const CsrU #define UF_MEMPUT_MAC 0x0000 #define UF_MEMPUT_PHY 0x1000 -static CsrUint32 write_patchcmd(void *buf, const CsrUint32 offset, const CsrUint32 dst_genaddr, const u16 len) +static u32 write_patchcmd(void *buf, const u32 offset, const u32 dst_genaddr, const u16 len) { - CsrUint32 written = 0; - CsrUint32 region = (dst_genaddr >> 28); + u32 written = 0; + u32 region = (dst_genaddr >> 28); u16 cmd_and_len = UF_MEMPUT_MAC; if (region == UF_REGION_PHY) @@ -739,19 +739,19 @@ static CsrUint32 write_patchcmd(void *buf, const CsrUint32 offset, const CsrUint } -static CsrUint32 write_fwdl_to_ptdl(void *buf, const CsrUint32 offset, fwreadfn_t readfn, +static u32 write_fwdl_to_ptdl(void *buf, const u32 offset, fwreadfn_t readfn, const struct FWDL *fwdl, const void *dlpriv, - const CsrUint32 fw_id, void *fw_buf) + const u32 fw_id, void *fw_buf) { - CsrUint32 written = 0; + u32 written = 0; s16 chunks = 0; - CsrUint32 left = fwdl->dl_size; /* Bytes left in this fwdl */ - CsrUint32 dl_addr = fwdl->dl_addr; /* Target address of fwdl image on XAP */ - CsrUint32 dl_offs = fwdl->dl_offset; /* Offset of fwdl image data in source */ + u32 left = fwdl->dl_size; /* Bytes left in this fwdl */ + u32 dl_addr = fwdl->dl_addr; /* Target address of fwdl image on XAP */ + u32 dl_offs = fwdl->dl_offset; /* Offset of fwdl image data in source */ u16 csum; - CsrUint32 csum_start_offs; /* first offset to include in checksum */ - CsrUint32 sec_data_len; /* section data byte count */ - CsrUint32 sec_len; /* section data + header byte count */ + u32 csum_start_offs; /* first offset to include in checksum */ + u32 sec_data_len; /* section data byte count */ + u32 sec_len; /* section data + header byte count */ /* FWDL maps to one or more PTDLs, as max size for a PTDL is 1K words */ while (left) @@ -810,12 +810,12 @@ static CsrUint32 write_fwdl_to_ptdl(void *buf, const CsrUint32 offset, fwreadfn_ #define UF_MAC_START_CMD 0x6000 /* MAC "Set start address" command */ #define UF_PHY_START_CMD 0x7000 /* PHY "Set start address" command */ -static CsrUint32 write_reset_ptdl(void *buf, const CsrUint32 offset, const xbv1_t *fwinfo, CsrUint32 fw_id) +static u32 write_reset_ptdl(void *buf, const u32 offset, const xbv1_t *fwinfo, u32 fw_id) { - CsrUint32 written = 0; + u32 written = 0; u16 csum; - CsrUint32 csum_start_offs; /* first offset to include in checksum */ - CsrUint32 sec_len; /* section data + header byte count */ + u32 csum_start_offs; /* first offset to include in checksum */ + u32 sec_len; /* section data + header byte count */ sec_len = SEC_CMD_LEN + PTDL_VEC_HDR_SIZE; /* Total section byte length */ @@ -871,12 +871,12 @@ static CsrUint32 write_reset_ptdl(void *buf, const CsrUint32 offset, const xbv1_ * --------------------------------------------------------------------------- */ CsrInt32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo, - symbol_t *slut, CsrUint32 slut_len) + symbol_t *slut, u32 slut_len) { s16 i; CsrInt32 offset; - CsrUint32 magic; - CsrUint32 count = 0; + u32 magic; + u32 count = 0; ct_t ct; if (fwinfo->mode != xbv_firmware) @@ -916,7 +916,7 @@ CsrInt32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *f while (count < slut_len) { - CsrUint32 id, obj; + u32 id, obj; /* Read Symbol Id */ if (read_uint(card, &ct, &id, 2)) @@ -969,16 +969,16 @@ CsrInt32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *f #define PTCH_LIST_SIZE 16 /* sizeof PTCH+FWID chunk in LIST header */ void* xbv_to_patch(card_t *card, fwreadfn_t readfn, - const void *fw_buf, const xbv1_t *fwinfo, CsrUint32 *size) + const void *fw_buf, const xbv1_t *fwinfo, u32 *size) { void *patch_buf = NULL; - CsrUint32 patch_buf_size; - CsrUint32 payload_offs = 0; /* Start of XBV payload */ + u32 patch_buf_size; + u32 payload_offs = 0; /* Start of XBV payload */ s16 i; - CsrUint32 patch_offs = 0; - CsrUint32 list_len_offs = 0; /* Offset of PTDL LIST length parameter */ - CsrUint32 ptdl_start_offs = 0; /* Offset of first PTDL chunk */ - CsrUint32 fw_id; + u32 patch_offs = 0; + u32 list_len_offs = 0; /* Offset of PTDL LIST length parameter */ + u32 ptdl_start_offs = 0; /* Offset of first PTDL chunk */ + u32 fw_id; void *rdbuf; if (!fw_buf || !fwinfo || !card) diff --git a/drivers/staging/csr/csr_wifi_hip_xbv.h b/drivers/staging/csr/csr_wifi_hip_xbv.h index abf6e4b..3e3771e 100644 --- a/drivers/staging/csr/csr_wifi_hip_xbv.h +++ b/drivers/staging/csr/csr_wifi_hip_xbv.h @@ -33,39 +33,39 @@ extern "C" { struct VMEQ { - CsrUint32 addr; + u32 addr; u16 mask; u16 value; }; struct VAND { - CsrUint32 first; - CsrUint32 count; + u32 first; + u32 count; }; struct VERS { - CsrUint32 num_vand; + u32 num_vand; }; struct FWDL { - CsrUint32 dl_addr; - CsrUint32 dl_size; - CsrUint32 dl_offset; + u32 dl_addr; + u32 dl_size; + u32 dl_offset; }; struct FWOV { - CsrUint32 dl_size; - CsrUint32 dl_offset; + u32 dl_size; + u32 dl_offset; }; struct PTDL { - CsrUint32 dl_size; - CsrUint32 dl_offset; + u32 dl_size; + u32 dl_offset; }; #define MAX_VMEQ 64 @@ -90,11 +90,11 @@ typedef struct /* Parts of a Firmware XBV1 */ struct VMEQ vmeq[MAX_VMEQ]; - CsrUint32 num_vmeq; + u32 num_vmeq; struct VAND vand[MAX_VAND]; struct VERS vers; - CsrUint32 slut_addr; + u32 slut_addr; /* F/W download image, possibly more than one part */ struct FWDL fwdl[MAX_FWDL]; @@ -105,20 +105,20 @@ typedef struct /* Parts of a Patch XBV1 */ - CsrUint32 build_id; + u32 build_id; struct PTDL ptdl[MAX_PTDL]; s16 num_ptdl; } xbv1_t; -typedef CsrInt32 (*fwreadfn_t)(void *ospriv, void *dlpriv, CsrUint32 offset, void *buf, CsrUint32 len); +typedef CsrInt32 (*fwreadfn_t)(void *ospriv, void *dlpriv, u32 offset, void *buf, u32 len); CsrResult xbv1_parse(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo); CsrInt32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo, - symbol_t *slut, CsrUint32 slut_len); + symbol_t *slut, u32 slut_len); void* xbv_to_patch(card_t *card, fwreadfn_t readfn, const void *fw_buf, const xbv1_t *fwinfo, - CsrUint32 *size); + u32 *size); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_wifi_lib.h b/drivers/staging/csr/csr_wifi_lib.h index 540d93c..861e4a4 100644 --- a/drivers/staging/csr/csr_wifi_lib.h +++ b/drivers/staging/csr/csr_wifi_lib.h @@ -76,7 +76,7 @@ CsrWifiEventCsrUint16* CsrWifiEventCsrUint16_struct(u16 primtype, u16 msgtype, C typedef struct { CsrWifiFsmEvent common; - CsrUint32 value; + u32 value; } CsrWifiEventCsrUint32; /*----------------------------------------------------------------------------* @@ -87,7 +87,7 @@ typedef struct * Allocates and fills in a message with the signature CsrWifiEventCsrUint32 * *----------------------------------------------------------------------------*/ -CsrWifiEventCsrUint32* CsrWifiEventCsrUint32_struct(u16 primtype, u16 msgtype, CsrSchedQid dst, CsrSchedQid src, CsrUint32 value); +CsrWifiEventCsrUint32* CsrWifiEventCsrUint32_struct(u16 primtype, u16 msgtype, CsrSchedQid dst, CsrSchedQid src, u32 value); typedef struct { diff --git a/drivers/staging/csr/csr_wifi_msgconv.h b/drivers/staging/csr/csr_wifi_msgconv.h index 72da857..e97aaee 100644 --- a/drivers/staging/csr/csr_wifi_msgconv.h +++ b/drivers/staging/csr/csr_wifi_msgconv.h @@ -22,15 +22,15 @@ extern "C" { void CsrUint16SerBigEndian(u8 *ptr, CsrSize *len, u16 v); -void CsrUint24SerBigEndian(u8 *ptr, CsrSize *len, CsrUint32 v); -void CsrUint32SerBigEndian(u8 *ptr, CsrSize *len, CsrUint32 v); +void CsrUint24SerBigEndian(u8 *ptr, CsrSize *len, u32 v); +void CsrUint32SerBigEndian(u8 *ptr, CsrSize *len, u32 v); void CsrUint16DesBigEndian(u16 *v, u8 *buffer, CsrSize *offset); -void CsrUint24DesBigEndian(CsrUint32 *v, u8 *buffer, CsrSize *offset); -void CsrUint32DesBigEndian(CsrUint32 *v, u8 *buffer, CsrSize *offset); +void CsrUint24DesBigEndian(u32 *v, u8 *buffer, CsrSize *offset); +void CsrUint32DesBigEndian(u32 *v, u8 *buffer, CsrSize *offset); -void CsrUint24Ser(u8 *ptr, CsrSize *len, CsrUint32 v); -void CsrUint24Des(CsrUint32 *v, u8 *buffer, CsrSize *offset); +void CsrUint24Ser(u8 *ptr, CsrSize *len, u32 v); +void CsrUint24Des(u32 *v, u8 *buffer, CsrSize *offset); CsrSize CsrWifiEventSizeof(void *msg); diff --git a/drivers/staging/csr/csr_wifi_nme_prim.h b/drivers/staging/csr/csr_wifi_nme_prim.h index 4aff291..2c73943 100644 --- a/drivers/staging/csr/csr_wifi_nme_prim.h +++ b/drivers/staging/csr/csr_wifi_nme_prim.h @@ -336,7 +336,7 @@ typedef u16 CsrWifiNmeEncryption; - Used to register for all available indications *******************************************************************************/ -typedef CsrUint32 CsrWifiNmeIndications; +typedef u32 CsrWifiNmeIndications; #define CSR_WIFI_NME_INDICATIONS_IND_AP_STATION ((CsrWifiNmeIndications) 0x00100000) #define CSR_WIFI_NME_INDICATIONS_IND_AP_STOP ((CsrWifiNmeIndications) 0x00200000) #define CSR_WIFI_NME_INDICATIONS_IND_SIM_UMTS_AUTH ((CsrWifiNmeIndications) 0x01000000) @@ -489,7 +489,7 @@ typedef u16 CsrWifiNmeEncryptionMask; Mask type for use with the values defined by CsrWifiNmeIndications *******************************************************************************/ -typedef CsrUint32 CsrWifiNmeIndicationsMask; +typedef u32 CsrWifiNmeIndicationsMask; /******************************************************************************* NAME @@ -501,7 +501,7 @@ typedef CsrUint32 CsrWifiNmeIndicationsMask; specific indications *******************************************************************************/ -typedef CsrUint32 CsrWifiNmeNmeIndicationsMask; +typedef u32 CsrWifiNmeNmeIndicationsMask; /******************************************************************************* NAME @@ -594,11 +594,11 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint32 certificateLength; + u32 certificateLength; u8 *certificate; u16 privateKeyLength; u8 *privateKey; - CsrUint32 caCertificateLength; + u32 caCertificateLength; u8 *caCertificate; } CsrWifiNmeWapiCredentials; @@ -711,17 +711,17 @@ typedef struct CsrCharString *userName; CsrCharString *userPassword; CsrCharString *authServerUserIdentity; - CsrUint32 clientCertificateLength; + u32 clientCertificateLength; u8 *clientCertificate; - CsrUint32 certificateAuthorityCertificateLength; + u32 certificateAuthorityCertificateLength; u8 *certificateAuthorityCertificate; u16 privateKeyLength; u8 *privateKey; CsrCharString *privateKeyPassword; - CsrUint32 sessionLength; + u32 sessionLength; u8 *session; CsrBool allowPacProvisioning; - CsrUint32 pacLength; + u32 pacLength; u8 *pac; CsrCharString *pacPassword; } CsrWifiNmeEapCredentials; diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_prim.h b/drivers/staging/csr/csr_wifi_router_ctrl_prim.h index 37ba5ea..83b9c41 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_prim.h +++ b/drivers/staging/csr/csr_wifi_router_ctrl_prim.h @@ -28,14 +28,14 @@ extern "C" { typedef CsrPrim CsrWifiRouterCtrlPrim; -typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteWrite)(u8 func, CsrUint32 address, u8 data); -typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteRead)(u8 func, CsrUint32 address, u8 *pdata); -typedef CsrResult (*CsrWifiRouterCtrlRawSdioFirmwareDownload)(CsrUint32 length, const u8 *pdata); +typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteWrite)(u8 func, u32 address, u8 data); +typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteRead)(u8 func, u32 address, u8 *pdata); +typedef CsrResult (*CsrWifiRouterCtrlRawSdioFirmwareDownload)(u32 length, const u8 *pdata); typedef CsrResult (*CsrWifiRouterCtrlRawSdioReset)(void); typedef CsrResult (*CsrWifiRouterCtrlRawSdioCoreDumpPrepare)(CsrBool suspendSme); -typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteBlockRead)(u8 func, CsrUint32 address, u8 *pdata, CsrUint32 length); -typedef CsrResult (*CsrWifiRouterCtrlRawSdioGpRead16)(u8 func, CsrUint32 address, u16 *pdata); -typedef CsrResult (*CsrWifiRouterCtrlRawSdioGpWrite16)(u8 func, CsrUint32 address, u16 data); +typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteBlockRead)(u8 func, u32 address, u8 *pdata, u32 length); +typedef CsrResult (*CsrWifiRouterCtrlRawSdioGpRead16)(u8 func, u32 address, u16 *pdata); +typedef CsrResult (*CsrWifiRouterCtrlRawSdioGpWrite16)(u8 func, u32 address, u16 data); /******************************************************************************* @@ -410,7 +410,7 @@ typedef u8 CsrWifiRouterCtrlTrafficType; DESCRIPTION *******************************************************************************/ -typedef CsrUint32 CsrWifiRouterCtrlPeerRecordHandle; +typedef u32 CsrWifiRouterCtrlPeerRecordHandle; /******************************************************************************* NAME @@ -467,9 +467,9 @@ typedef u8 CsrWifiRouterCtrlTrafficStreamId; *******************************************************************************/ typedef struct { - CsrUint32 firmwarePatch; + u32 firmwarePatch; CsrCharString *smeBuild; - CsrUint32 smeHip; + u32 smeHip; } CsrWifiRouterCtrlSmeVersions; /******************************************************************************* @@ -510,10 +510,10 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint32 etherType; + u32 etherType; u8 ipType; - CsrUint32 udpSourcePort; - CsrUint32 udpDestPort; + u32 udpSourcePort; + u32 udpDestPort; } CsrWifiRouterCtrlTrafficFilter; /******************************************************************************* @@ -534,11 +534,11 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint32 rxMeanRate; - CsrUint32 rxFramesNum; - CsrUint32 txFramesNum; - CsrUint32 rxBytesCount; - CsrUint32 txBytesCount; + u32 rxMeanRate; + u32 rxFramesNum; + u32 txFramesNum; + u32 rxBytesCount; + u32 txBytesCount; u8 intervals[11]; } CsrWifiRouterCtrlTrafficStats; @@ -560,12 +560,12 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint32 chipId; - CsrUint32 chipVersion; - CsrUint32 firmwareBuild; - CsrUint32 firmwareHip; + u32 chipId; + u32 chipVersion; + u32 firmwareBuild; + u32 firmwareHip; CsrCharString *routerBuild; - CsrUint32 routerHip; + u32 routerHip; } CsrWifiRouterCtrlVersions; /******************************************************************************* @@ -1044,7 +1044,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrUint32 dataLength; + u32 dataLength; u8 *data; } CsrWifiRouterCtrlWifiOnReq; diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c index f46a536..6befbd8 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c @@ -611,10 +611,10 @@ CsrSize CsrWifiRouterCtrlTrafficConfigReqSizeof(void *msg) bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrWifiRouterCtrlTrafficConfigType primitive->trafficConfigType */ bufferSize += 2; /* u16 primitive->config.packetFilter */ - bufferSize += 4; /* CsrUint32 primitive->config.customFilter.etherType */ + bufferSize += 4; /* u32 primitive->config.customFilter.etherType */ bufferSize += 1; /* u8 primitive->config.customFilter.ipType */ - bufferSize += 4; /* CsrUint32 primitive->config.customFilter.udpSourcePort */ - bufferSize += 4; /* CsrUint32 primitive->config.customFilter.udpDestPort */ + bufferSize += 4; /* u32 primitive->config.customFilter.udpSourcePort */ + bufferSize += 4; /* u32 primitive->config.customFilter.udpDestPort */ return bufferSize; } @@ -628,10 +628,10 @@ u8* CsrWifiRouterCtrlTrafficConfigReqSer(u8 *ptr, CsrSize *len, void *msg) CsrUint16Ser(ptr, len, (u16) primitive->clientData); CsrUint16Ser(ptr, len, (u16) primitive->trafficConfigType); CsrUint16Ser(ptr, len, (u16) primitive->config.packetFilter); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->config.customFilter.etherType); + CsrUint32Ser(ptr, len, (u32) primitive->config.customFilter.etherType); CsrUint8Ser(ptr, len, (u8) primitive->config.customFilter.ipType); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->config.customFilter.udpSourcePort); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->config.customFilter.udpDestPort); + CsrUint32Ser(ptr, len, (u32) primitive->config.customFilter.udpSourcePort); + CsrUint32Ser(ptr, len, (u32) primitive->config.customFilter.udpDestPort); return(ptr); } @@ -647,10 +647,10 @@ void* CsrWifiRouterCtrlTrafficConfigReqDes(u8 *buffer, CsrSize length) CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); CsrUint16Des((u16 *) &primitive->trafficConfigType, buffer, &offset); CsrUint16Des((u16 *) &primitive->config.packetFilter, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->config.customFilter.etherType, buffer, &offset); + CsrUint32Des((u32 *) &primitive->config.customFilter.etherType, buffer, &offset); CsrUint8Des((u8 *) &primitive->config.customFilter.ipType, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->config.customFilter.udpSourcePort, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->config.customFilter.udpDestPort, buffer, &offset); + CsrUint32Des((u32 *) &primitive->config.customFilter.udpSourcePort, buffer, &offset); + CsrUint32Des((u32 *) &primitive->config.customFilter.udpDestPort, buffer, &offset); return primitive; } @@ -663,7 +663,7 @@ CsrSize CsrWifiRouterCtrlWifiOnReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 4; /* CsrUint32 primitive->dataLength */ + bufferSize += 4; /* u32 primitive->dataLength */ bufferSize += primitive->dataLength; /* u8 primitive->data */ return bufferSize; } @@ -675,7 +675,7 @@ u8* CsrWifiRouterCtrlWifiOnReqSer(u8 *ptr, CsrSize *len, void *msg) *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->dataLength); + CsrUint32Ser(ptr, len, (u32) primitive->dataLength); if (primitive->dataLength) { CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength))); @@ -692,7 +692,7 @@ void* CsrWifiRouterCtrlWifiOnReqDes(u8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->dataLength, buffer, &offset); + CsrUint32Des((u32 *) &primitive->dataLength, buffer, &offset); if (primitive->dataLength) { primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); @@ -731,9 +731,9 @@ CsrSize CsrWifiRouterCtrlWifiOnResSizeof(void *msg) bufferSize += 6; /* u8 primitive->stationMacAddress[i1].a[6] */ } } - bufferSize += 4; /* CsrUint32 primitive->smeVersions.firmwarePatch */ + bufferSize += 4; /* u32 primitive->smeVersions.firmwarePatch */ bufferSize += (primitive->smeVersions.smeBuild?CsrStrLen(primitive->smeVersions.smeBuild) : 0) + 1; /* CsrCharString* primitive->smeVersions.smeBuild (0 byte len + 1 for NULL Term) */ - bufferSize += 4; /* CsrUint32 primitive->smeVersions.smeHip */ + bufferSize += 4; /* u32 primitive->smeVersions.smeHip */ bufferSize += 1; /* CsrBool primitive->scheduledInterrupt */ return bufferSize; } @@ -754,9 +754,9 @@ u8* CsrWifiRouterCtrlWifiOnResSer(u8 *ptr, CsrSize *len, void *msg) CsrMemCpySer(ptr, len, (const void *) primitive->stationMacAddress[i1].a, ((u16) (6))); } } - CsrUint32Ser(ptr, len, (CsrUint32) primitive->smeVersions.firmwarePatch); + CsrUint32Ser(ptr, len, (u32) primitive->smeVersions.firmwarePatch); CsrCharStringSer(ptr, len, primitive->smeVersions.smeBuild); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->smeVersions.smeHip); + CsrUint32Ser(ptr, len, (u32) primitive->smeVersions.smeHip); CsrUint8Ser(ptr, len, (u8) primitive->scheduledInterrupt); return(ptr); } @@ -779,9 +779,9 @@ void* CsrWifiRouterCtrlWifiOnResDes(u8 *buffer, CsrSize length) CsrMemCpyDes(primitive->stationMacAddress[i1].a, buffer, &offset, ((u16) (6))); } } - CsrUint32Des((CsrUint32 *) &primitive->smeVersions.firmwarePatch, buffer, &offset); + CsrUint32Des((u32 *) &primitive->smeVersions.firmwarePatch, buffer, &offset); CsrCharStringDes(&primitive->smeVersions.smeBuild, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->smeVersions.smeHip, buffer, &offset); + CsrUint32Des((u32 *) &primitive->smeVersions.smeHip, buffer, &offset); CsrUint8Des((u8 *) &primitive->scheduledInterrupt, buffer, &offset); return primitive; @@ -953,7 +953,7 @@ u8* CsrWifiRouterCtrlPeerDelReqSer(u8 *ptr, CsrSize *len, void *msg) CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->peerRecordHandle); + CsrUint32Ser(ptr, len, (u32) primitive->peerRecordHandle); return(ptr); } @@ -967,7 +967,7 @@ void* CsrWifiRouterCtrlPeerDelReqDes(u8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->peerRecordHandle, buffer, &offset); + CsrUint32Des((u32 *) &primitive->peerRecordHandle, buffer, &offset); return primitive; } @@ -993,7 +993,7 @@ u8* CsrWifiRouterCtrlPeerUpdateReqSer(u8 *ptr, CsrSize *len, void *msg) CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->peerRecordHandle); + CsrUint32Ser(ptr, len, (u32) primitive->peerRecordHandle); CsrUint16Ser(ptr, len, (u16) primitive->powersaveMode); return(ptr); } @@ -1008,7 +1008,7 @@ void* CsrWifiRouterCtrlPeerUpdateReqDes(u8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->peerRecordHandle, buffer, &offset); + CsrUint32Des((u32 *) &primitive->peerRecordHandle, buffer, &offset); CsrUint16Des((u16 *) &primitive->powersaveMode, buffer, &offset); return primitive; @@ -1734,11 +1734,11 @@ CsrSize CsrWifiRouterCtrlTrafficSampleIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 38) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 4; /* CsrUint32 primitive->stats.rxMeanRate */ - bufferSize += 4; /* CsrUint32 primitive->stats.rxFramesNum */ - bufferSize += 4; /* CsrUint32 primitive->stats.txFramesNum */ - bufferSize += 4; /* CsrUint32 primitive->stats.rxBytesCount */ - bufferSize += 4; /* CsrUint32 primitive->stats.txBytesCount */ + bufferSize += 4; /* u32 primitive->stats.rxMeanRate */ + bufferSize += 4; /* u32 primitive->stats.rxFramesNum */ + bufferSize += 4; /* u32 primitive->stats.txFramesNum */ + bufferSize += 4; /* u32 primitive->stats.rxBytesCount */ + bufferSize += 4; /* u32 primitive->stats.txBytesCount */ bufferSize += 11; /* u8 primitive->stats.intervals[11] */ return bufferSize; } @@ -1751,11 +1751,11 @@ u8* CsrWifiRouterCtrlTrafficSampleIndSer(u8 *ptr, CsrSize *len, void *msg) CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (u16) primitive->clientData); CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->stats.rxMeanRate); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->stats.rxFramesNum); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->stats.txFramesNum); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->stats.rxBytesCount); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->stats.txBytesCount); + CsrUint32Ser(ptr, len, (u32) primitive->stats.rxMeanRate); + CsrUint32Ser(ptr, len, (u32) primitive->stats.rxFramesNum); + CsrUint32Ser(ptr, len, (u32) primitive->stats.txFramesNum); + CsrUint32Ser(ptr, len, (u32) primitive->stats.rxBytesCount); + CsrUint32Ser(ptr, len, (u32) primitive->stats.txBytesCount); CsrMemCpySer(ptr, len, (const void *) primitive->stats.intervals, ((u16) (11))); return(ptr); } @@ -1770,11 +1770,11 @@ void* CsrWifiRouterCtrlTrafficSampleIndDes(u8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->stats.rxMeanRate, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->stats.rxFramesNum, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->stats.txFramesNum, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->stats.rxBytesCount, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->stats.txBytesCount, buffer, &offset); + CsrUint32Des((u32 *) &primitive->stats.rxMeanRate, buffer, &offset); + CsrUint32Des((u32 *) &primitive->stats.rxFramesNum, buffer, &offset); + CsrUint32Des((u32 *) &primitive->stats.txFramesNum, buffer, &offset); + CsrUint32Des((u32 *) &primitive->stats.rxBytesCount, buffer, &offset); + CsrUint32Des((u32 *) &primitive->stats.txBytesCount, buffer, &offset); CsrMemCpyDes(primitive->stats.intervals, buffer, &offset, ((u16) (11))); return primitive; @@ -1789,12 +1789,12 @@ CsrSize CsrWifiRouterCtrlWifiOnIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 27) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 4; /* CsrUint32 primitive->versions.chipId */ - bufferSize += 4; /* CsrUint32 primitive->versions.chipVersion */ - bufferSize += 4; /* CsrUint32 primitive->versions.firmwareBuild */ - bufferSize += 4; /* CsrUint32 primitive->versions.firmwareHip */ + bufferSize += 4; /* u32 primitive->versions.chipId */ + bufferSize += 4; /* u32 primitive->versions.chipVersion */ + bufferSize += 4; /* u32 primitive->versions.firmwareBuild */ + bufferSize += 4; /* u32 primitive->versions.firmwareHip */ bufferSize += (primitive->versions.routerBuild?CsrStrLen(primitive->versions.routerBuild) : 0) + 1; /* CsrCharString* primitive->versions.routerBuild (0 byte len + 1 for NULL Term) */ - bufferSize += 4; /* CsrUint32 primitive->versions.routerHip */ + bufferSize += 4; /* u32 primitive->versions.routerHip */ return bufferSize; } @@ -1806,12 +1806,12 @@ u8* CsrWifiRouterCtrlWifiOnIndSer(u8 *ptr, CsrSize *len, void *msg) CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (u16) primitive->clientData); CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.chipId); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.chipVersion); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.firmwareBuild); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.firmwareHip); + CsrUint32Ser(ptr, len, (u32) primitive->versions.chipId); + CsrUint32Ser(ptr, len, (u32) primitive->versions.chipVersion); + CsrUint32Ser(ptr, len, (u32) primitive->versions.firmwareBuild); + CsrUint32Ser(ptr, len, (u32) primitive->versions.firmwareHip); CsrCharStringSer(ptr, len, primitive->versions.routerBuild); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.routerHip); + CsrUint32Ser(ptr, len, (u32) primitive->versions.routerHip); return(ptr); } @@ -1825,12 +1825,12 @@ void* CsrWifiRouterCtrlWifiOnIndDes(u8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->versions.chipId, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->versions.chipVersion, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->versions.firmwareBuild, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->versions.firmwareHip, buffer, &offset); + CsrUint32Des((u32 *) &primitive->versions.chipId, buffer, &offset); + CsrUint32Des((u32 *) &primitive->versions.chipVersion, buffer, &offset); + CsrUint32Des((u32 *) &primitive->versions.firmwareBuild, buffer, &offset); + CsrUint32Des((u32 *) &primitive->versions.firmwareHip, buffer, &offset); CsrCharStringDes(&primitive->versions.routerBuild, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->versions.routerHip, buffer, &offset); + CsrUint32Des((u32 *) &primitive->versions.routerHip, buffer, &offset); return primitive; } @@ -2067,7 +2067,7 @@ u8* CsrWifiRouterCtrlPeerAddCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrUint16Ser(ptr, len, (u16) primitive->clientData); CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->peerRecordHandle); + CsrUint32Ser(ptr, len, (u32) primitive->peerRecordHandle); CsrUint16Ser(ptr, len, (u16) primitive->status); return(ptr); } @@ -2083,7 +2083,7 @@ void* CsrWifiRouterCtrlPeerAddCfmDes(u8 *buffer, CsrSize length) CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); - CsrUint32Des((CsrUint32 *) &primitive->peerRecordHandle, buffer, &offset); + CsrUint32Des((u32 *) &primitive->peerRecordHandle, buffer, &offset); CsrUint16Des((u16 *) &primitive->status, buffer, &offset); return primitive; diff --git a/drivers/staging/csr/csr_wifi_router_prim.h b/drivers/staging/csr/csr_wifi_router_prim.h index c281f02..3b9ce1a 100644 --- a/drivers/staging/csr/csr_wifi_router_prim.h +++ b/drivers/staging/csr/csr_wifi_router_prim.h @@ -81,7 +81,7 @@ typedef u8 CsrWifiRouterEncapsulation; CSR_WIFI_ROUTER_OUI_BT - *******************************************************************************/ -typedef CsrUint32 CsrWifiRouterOui; +typedef u32 CsrWifiRouterOui; #define CSR_WIFI_ROUTER_OUI_RFC_1042 ((CsrWifiRouterOui) 0x000000) #define CSR_WIFI_ROUTER_OUI_BT ((CsrWifiRouterOui) 0x001958) @@ -183,7 +183,7 @@ typedef struct u16 interfaceTag; CsrWifiRouterEncapsulation encapsulation; u16 protocol; - CsrUint32 oui; + u32 oui; } CsrWifiRouterMaPacketSubscribeReq; /******************************************************************************* @@ -248,7 +248,7 @@ typedef struct u8 *frame; CsrWifiRouterFrameFreeFunction freeFunction; CsrWifiRouterPriority priority; - CsrUint32 hostTag; + u32 hostTag; CsrBool cfmRequested; } CsrWifiRouterMaPacketReq; @@ -305,7 +305,7 @@ typedef struct { CsrWifiFsmEvent common; u16 interfaceTag; - CsrUint32 hostTag; + u32 hostTag; CsrWifiRouterPriority priority; CsrWifiMacAddress peerMacAddress; } CsrWifiRouterMaPacketCancelReq; @@ -381,7 +381,7 @@ typedef struct CsrWifiFsmEvent common; u16 interfaceTag; CsrResult result; - CsrUint32 hostTag; + u32 hostTag; u16 rate; } CsrWifiRouterMaPacketCfm; diff --git a/drivers/staging/csr/csr_wifi_router_serialize.c b/drivers/staging/csr/csr_wifi_router_serialize.c index 7711fa5..c90bf7d 100644 --- a/drivers/staging/csr/csr_wifi_router_serialize.c +++ b/drivers/staging/csr/csr_wifi_router_serialize.c @@ -32,7 +32,7 @@ CsrSize CsrWifiRouterMaPacketSubscribeReqSizeof(void *msg) bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiRouterEncapsulation primitive->encapsulation */ bufferSize += 2; /* u16 primitive->protocol */ - bufferSize += 4; /* CsrUint32 primitive->oui */ + bufferSize += 4; /* u32 primitive->oui */ return bufferSize; } @@ -45,7 +45,7 @@ u8* CsrWifiRouterMaPacketSubscribeReqSer(u8 *ptr, CsrSize *len, void *msg) CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->encapsulation); CsrUint16Ser(ptr, len, (u16) primitive->protocol); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->oui); + CsrUint32Ser(ptr, len, (u32) primitive->oui); return(ptr); } @@ -60,7 +60,7 @@ void* CsrWifiRouterMaPacketSubscribeReqDes(u8 *buffer, CsrSize length) CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->encapsulation, buffer, &offset); CsrUint16Des((u16 *) &primitive->protocol, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->oui, buffer, &offset); + CsrUint32Des((u32 *) &primitive->oui, buffer, &offset); return primitive; } @@ -78,7 +78,7 @@ CsrSize CsrWifiRouterMaPacketReqSizeof(void *msg) bufferSize += primitive->frameLength; /* u8 primitive->frame */ bufferSize += 4; /* CsrWifiRouterFrameFreeFunction primitive->freeFunction */ bufferSize += 2; /* CsrWifiRouterPriority primitive->priority */ - bufferSize += 4; /* CsrUint32 primitive->hostTag */ + bufferSize += 4; /* u32 primitive->hostTag */ bufferSize += 1; /* CsrBool primitive->cfmRequested */ return bufferSize; } @@ -98,7 +98,7 @@ u8* CsrWifiRouterMaPacketReqSer(u8 *ptr, CsrSize *len, void *msg) } CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->freeFunction */ CsrUint16Ser(ptr, len, (u16) primitive->priority); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->hostTag); + CsrUint32Ser(ptr, len, (u32) primitive->hostTag); CsrUint8Ser(ptr, len, (u8) primitive->cfmRequested); return(ptr); } @@ -126,7 +126,7 @@ void* CsrWifiRouterMaPacketReqDes(u8 *buffer, CsrSize length) primitive->freeFunction = NULL; /* Special for Function Pointers... */ offset += 4; CsrUint16Des((u16 *) &primitive->priority, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->hostTag, buffer, &offset); + CsrUint32Des((u32 *) &primitive->hostTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->cfmRequested, buffer, &offset); return primitive; @@ -186,7 +186,7 @@ CsrSize CsrWifiRouterMaPacketCancelReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */ bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 4; /* CsrUint32 primitive->hostTag */ + bufferSize += 4; /* u32 primitive->hostTag */ bufferSize += 2; /* CsrWifiRouterPriority primitive->priority */ bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ return bufferSize; @@ -199,7 +199,7 @@ u8* CsrWifiRouterMaPacketCancelReqSer(u8 *ptr, CsrSize *len, void *msg) *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->hostTag); + CsrUint32Ser(ptr, len, (u32) primitive->hostTag); CsrUint16Ser(ptr, len, (u16) primitive->priority); CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); return(ptr); @@ -214,7 +214,7 @@ void* CsrWifiRouterMaPacketCancelReqDes(u8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->hostTag, buffer, &offset); + CsrUint32Des((u32 *) &primitive->hostTag, buffer, &offset); CsrUint16Des((u16 *) &primitive->priority, buffer, &offset); CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); @@ -307,7 +307,7 @@ CsrSize CsrWifiRouterMaPacketCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->result */ - bufferSize += 4; /* CsrUint32 primitive->hostTag */ + bufferSize += 4; /* u32 primitive->hostTag */ bufferSize += 2; /* u16 primitive->rate */ return bufferSize; } @@ -320,7 +320,7 @@ u8* CsrWifiRouterMaPacketCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (u16) primitive->result); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->hostTag); + CsrUint32Ser(ptr, len, (u32) primitive->hostTag); CsrUint16Ser(ptr, len, (u16) primitive->rate); return(ptr); } @@ -335,7 +335,7 @@ void* CsrWifiRouterMaPacketCfmDes(u8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((u16 *) &primitive->result, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->hostTag, buffer, &offset); + CsrUint32Des((u32 *) &primitive->hostTag, buffer, &offset); CsrUint16Des((u16 *) &primitive->rate, buffer, &offset); return primitive; diff --git a/drivers/staging/csr/csr_wifi_router_transport.c b/drivers/staging/csr/csr_wifi_router_transport.c index 3247b58..6842ac3 100644 --- a/drivers/staging/csr/csr_wifi_router_transport.c +++ b/drivers/staging/csr/csr_wifi_router_transport.c @@ -198,7 +198,7 @@ static void CsrWifiRouterTransportSerialiseAndSend(u16 primType, void* msg) } #if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER) -void CsrSchedMessagePutStringLog(CsrSchedQid q, u16 mi, void *mv, CsrUint32 line, CsrCharString *file) +void CsrSchedMessagePutStringLog(CsrSchedQid q, u16 mi, void *mv, u32 line, CsrCharString *file) #else void CsrSchedMessagePut(CsrSchedQid q, u16 mi, void *mv) #endif diff --git a/drivers/staging/csr/csr_wifi_serialize_primitive_types.c b/drivers/staging/csr/csr_wifi_serialize_primitive_types.c index b81e51a..5b5444a 100644 --- a/drivers/staging/csr/csr_wifi_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_wifi_serialize_primitive_types.c @@ -16,9 +16,9 @@ #include "csr_wifi_msgconv.h" #include "csr_wifi_lib.h" -void CsrUint24Des(CsrUint32 *v, u8 *buffer, CsrSize *offset) +void CsrUint24Des(u32 *v, u8 *buffer, CsrSize *offset) { - CsrUint32 val; + u32 val; val = ((buffer[(*offset) + 2] << 16) | (buffer[(*offset) + 1] << 8) | @@ -41,9 +41,9 @@ void CsrUint16DesBigEndian(u16 *v, u8 *buffer, CsrSize *offset) } -void CsrUint24DesBigEndian(CsrUint32 *v, u8 *buffer, CsrSize *offset) +void CsrUint24DesBigEndian(u32 *v, u8 *buffer, CsrSize *offset) { - CsrUint32 val; + u32 val; val = ((buffer[(*offset)] << 16) | (buffer[(*offset) + 1] << 8) | @@ -54,9 +54,9 @@ void CsrUint24DesBigEndian(CsrUint32 *v, u8 *buffer, CsrSize *offset) } -void CsrUint32DesBigEndian(CsrUint32 *v, u8 *buffer, CsrSize *offset) +void CsrUint32DesBigEndian(u32 *v, u8 *buffer, CsrSize *offset) { - CsrUint32 val; + u32 val; val = ((buffer[(*offset)] << 24) | (buffer[(*offset) + 1] << 16) | @@ -68,7 +68,7 @@ void CsrUint32DesBigEndian(CsrUint32 *v, u8 *buffer, CsrSize *offset) } -void CsrUint24Ser(u8 *ptr, CsrSize *len, CsrUint32 v) +void CsrUint24Ser(u8 *ptr, CsrSize *len, u32 v) { ptr[(*len) + 2] = (u8)((v & 0x00ff0000) >> 16); ptr[(*len) + 1] = (u8)((v & 0x0000ff00) >> 8); @@ -88,7 +88,7 @@ void CsrUint16SerBigEndian(u8 *ptr, CsrSize *len, u16 v) } -void CsrUint32SerBigEndian(u8 *ptr, CsrSize *len, CsrUint32 v) +void CsrUint32SerBigEndian(u8 *ptr, CsrSize *len, u32 v) { ptr[(*len)] = (u8)((v & 0xff000000) >> 24); ptr[(*len) + 1] = (u8)((v & 0x00ff0000) >> 16); @@ -99,7 +99,7 @@ void CsrUint32SerBigEndian(u8 *ptr, CsrSize *len, CsrUint32 v) } -void CsrUint24SerBigEndian(u8 *ptr, CsrSize *len, CsrUint32 v) +void CsrUint24SerBigEndian(u8 *ptr, CsrSize *len, u32 v) { ptr[(*len)] = (u8)((v & 0x00ff0000) >> 16); ptr[(*len) + 1] = (u8)((v & 0x0000ff00) >> 8); diff --git a/drivers/staging/csr/csr_wifi_sme_prim.h b/drivers/staging/csr/csr_wifi_sme_prim.h index 1732506..79bc2b2 100644 --- a/drivers/staging/csr/csr_wifi_sme_prim.h +++ b/drivers/staging/csr/csr_wifi_sme_prim.h @@ -829,7 +829,7 @@ typedef u16 CsrWifiSmeIEEE80211Result; - Used to register for all available indications *******************************************************************************/ -typedef CsrUint32 CsrWifiSmeIndications; +typedef u32 CsrWifiSmeIndications; #define CSR_WIFI_SME_INDICATIONS_NONE ((CsrWifiSmeIndications) 0x00000000) #define CSR_WIFI_SME_INDICATIONS_WIFIOFF ((CsrWifiSmeIndications) 0x00000001) #define CSR_WIFI_SME_INDICATIONS_SCANRESULT ((CsrWifiSmeIndications) 0x00000002) @@ -1862,7 +1862,7 @@ typedef u16 CsrWifiSmeEncryptionMask; Mask type for use with the values defined by CsrWifiSmeIndications *******************************************************************************/ -typedef CsrUint32 CsrWifiSmeIndicationsMask; +typedef u32 CsrWifiSmeIndicationsMask; /******************************************************************************* NAME @@ -2127,29 +2127,29 @@ typedef struct { u8 unifiTxDataRate; u8 unifiRxDataRate; - CsrUint32 dot11RetryCount; - CsrUint32 dot11MultipleRetryCount; - CsrUint32 dot11AckFailureCount; - CsrUint32 dot11FrameDuplicateCount; - CsrUint32 dot11FcsErrorCount; - CsrUint32 dot11RtsSuccessCount; - CsrUint32 dot11RtsFailureCount; - CsrUint32 dot11FailedCount; - CsrUint32 dot11TransmittedFragmentCount; - CsrUint32 dot11TransmittedFrameCount; - CsrUint32 dot11WepExcludedCount; - CsrUint32 dot11WepIcvErrorCount; - CsrUint32 dot11WepUndecryptableCount; - CsrUint32 dot11MulticastReceivedFrameCount; - CsrUint32 dot11MulticastTransmittedFrameCount; - CsrUint32 dot11ReceivedFragmentCount; - CsrUint32 dot11Rsna4WayHandshakeFailures; - CsrUint32 dot11RsnaTkipCounterMeasuresInvoked; - CsrUint32 dot11RsnaStatsTkipLocalMicFailures; - CsrUint32 dot11RsnaStatsTkipReplays; - CsrUint32 dot11RsnaStatsTkipIcvErrors; - CsrUint32 dot11RsnaStatsCcmpReplays; - CsrUint32 dot11RsnaStatsCcmpDecryptErrors; + u32 dot11RetryCount; + u32 dot11MultipleRetryCount; + u32 dot11AckFailureCount; + u32 dot11FrameDuplicateCount; + u32 dot11FcsErrorCount; + u32 dot11RtsSuccessCount; + u32 dot11RtsFailureCount; + u32 dot11FailedCount; + u32 dot11TransmittedFragmentCount; + u32 dot11TransmittedFrameCount; + u32 dot11WepExcludedCount; + u32 dot11WepIcvErrorCount; + u32 dot11WepUndecryptableCount; + u32 dot11MulticastReceivedFrameCount; + u32 dot11MulticastTransmittedFrameCount; + u32 dot11ReceivedFragmentCount; + u32 dot11Rsna4WayHandshakeFailures; + u32 dot11RsnaTkipCounterMeasuresInvoked; + u32 dot11RsnaStatsTkipLocalMicFailures; + u32 dot11RsnaStatsTkipReplays; + u32 dot11RsnaStatsTkipIcvErrors; + u32 dot11RsnaStatsCcmpReplays; + u32 dot11RsnaStatsCcmpDecryptErrors; } CsrWifiSmeConnectionStats; /******************************************************************************* @@ -2450,15 +2450,15 @@ typedef struct *******************************************************************************/ typedef struct { - CsrUint32 chipId; - CsrUint32 chipVersion; - CsrUint32 firmwareBuild; - CsrUint32 firmwarePatch; - CsrUint32 firmwareHip; + u32 chipId; + u32 chipVersion; + u32 firmwareBuild; + u32 firmwarePatch; + u32 firmwareHip; CsrCharString *routerBuild; - CsrUint32 routerHip; + u32 routerHip; CsrCharString *smeBuild; - CsrUint32 smeHip; + u32 smeHip; } CsrWifiSmeVersions; /******************************************************************************* @@ -2603,8 +2603,8 @@ typedef struct u16 currentCoexPeriodMs; u16 currentCoexLatencyMs; CsrBool hasBtDevice; - CsrUint32 currentBlackoutDurationUs; - CsrUint32 currentBlackoutPeriodUs; + u32 currentBlackoutDurationUs; + u32 currentBlackoutPeriodUs; CsrWifiSmeCoexScheme currentCoexScheme; } CsrWifiSmeCoexInfo; @@ -4560,7 +4560,7 @@ typedef struct CsrWifiFsmEvent common; u16 interfaceTag; CsrWifiSmeListAction action; - CsrUint32 transactionId; + u32 transactionId; CsrBool strict; CsrWifiSmeTspecCtrlMask ctrlMask; u16 tspecLength; @@ -4830,7 +4830,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint32 dataLength; + u32 dataLength; u8 *data; } CsrWifiSmeSetReq; @@ -6129,7 +6129,7 @@ typedef struct { CsrWifiFsmEvent common; u16 interfaceTag; - CsrUint32 transactionId; + u32 transactionId; CsrWifiSmeTspecResultCode tspecResultCode; u16 tspecLength; u8 *tspec; @@ -6160,7 +6160,7 @@ typedef struct CsrWifiFsmEvent common; u16 interfaceTag; CsrResult status; - CsrUint32 transactionId; + u32 transactionId; CsrWifiSmeTspecResultCode tspecResultCode; u16 tspecLength; u8 *tspec; @@ -6465,7 +6465,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrUint32 dataLength; + u32 dataLength; u8 *data; } CsrWifiSmeCoreDumpInd; diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.c b/drivers/staging/csr/csr_wifi_sme_serialize.c index b5ffdce..53d9fa2 100644 --- a/drivers/staging/csr/csr_wifi_sme_serialize.c +++ b/drivers/staging/csr/csr_wifi_sme_serialize.c @@ -1407,7 +1407,7 @@ CsrSize CsrWifiSmeTspecReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 18) */ bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ - bufferSize += 4; /* CsrUint32 primitive->transactionId */ + bufferSize += 4; /* u32 primitive->transactionId */ bufferSize += 1; /* CsrBool primitive->strict */ bufferSize += 1; /* CsrWifiSmeTspecCtrlMask primitive->ctrlMask */ bufferSize += 2; /* u16 primitive->tspecLength */ @@ -1425,7 +1425,7 @@ u8* CsrWifiSmeTspecReqSer(u8 *ptr, CsrSize *len, void *msg) CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint8Ser(ptr, len, (u8) primitive->action); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->transactionId); + CsrUint32Ser(ptr, len, (u32) primitive->transactionId); CsrUint8Ser(ptr, len, (u8) primitive->strict); CsrUint8Ser(ptr, len, (u8) primitive->ctrlMask); CsrUint16Ser(ptr, len, (u16) primitive->tspecLength); @@ -1451,7 +1451,7 @@ void* CsrWifiSmeTspecReqDes(u8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint8Des((u8 *) &primitive->action, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->transactionId, buffer, &offset); + CsrUint32Des((u32 *) &primitive->transactionId, buffer, &offset); CsrUint8Des((u8 *) &primitive->strict, buffer, &offset); CsrUint8Des((u8 *) &primitive->ctrlMask, buffer, &offset); CsrUint16Des((u16 *) &primitive->tspecLength, buffer, &offset); @@ -1904,7 +1904,7 @@ CsrSize CsrWifiSmeSetReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ - bufferSize += 4; /* CsrUint32 primitive->dataLength */ + bufferSize += 4; /* u32 primitive->dataLength */ bufferSize += primitive->dataLength; /* u8 primitive->data */ return bufferSize; } @@ -1915,7 +1915,7 @@ u8* CsrWifiSmeSetReqSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeSetReq *primitive = (CsrWifiSmeSetReq *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->dataLength); + CsrUint32Ser(ptr, len, (u32) primitive->dataLength); if (primitive->dataLength) { CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength))); @@ -1931,7 +1931,7 @@ void* CsrWifiSmeSetReqDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->dataLength, buffer, &offset); + CsrUint32Des((u32 *) &primitive->dataLength, buffer, &offset); if (primitive->dataLength) { primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); @@ -2561,8 +2561,8 @@ CsrSize CsrWifiSmeCoexInfoGetCfmSizeof(void *msg) bufferSize += 2; /* u16 primitive->coexInfo.currentCoexPeriodMs */ bufferSize += 2; /* u16 primitive->coexInfo.currentCoexLatencyMs */ bufferSize += 1; /* CsrBool primitive->coexInfo.hasBtDevice */ - bufferSize += 4; /* CsrUint32 primitive->coexInfo.currentBlackoutDurationUs */ - bufferSize += 4; /* CsrUint32 primitive->coexInfo.currentBlackoutPeriodUs */ + bufferSize += 4; /* u32 primitive->coexInfo.currentBlackoutDurationUs */ + bufferSize += 4; /* u32 primitive->coexInfo.currentBlackoutPeriodUs */ bufferSize += 1; /* CsrWifiSmeCoexScheme primitive->coexInfo.currentCoexScheme */ return bufferSize; } @@ -2581,8 +2581,8 @@ u8* CsrWifiSmeCoexInfoGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrUint16Ser(ptr, len, (u16) primitive->coexInfo.currentCoexPeriodMs); CsrUint16Ser(ptr, len, (u16) primitive->coexInfo.currentCoexLatencyMs); CsrUint8Ser(ptr, len, (u8) primitive->coexInfo.hasBtDevice); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->coexInfo.currentBlackoutDurationUs); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->coexInfo.currentBlackoutPeriodUs); + CsrUint32Ser(ptr, len, (u32) primitive->coexInfo.currentBlackoutDurationUs); + CsrUint32Ser(ptr, len, (u32) primitive->coexInfo.currentBlackoutPeriodUs); CsrUint8Ser(ptr, len, (u8) primitive->coexInfo.currentCoexScheme); return(ptr); } @@ -2603,8 +2603,8 @@ void* CsrWifiSmeCoexInfoGetCfmDes(u8 *buffer, CsrSize length) CsrUint16Des((u16 *) &primitive->coexInfo.currentCoexPeriodMs, buffer, &offset); CsrUint16Des((u16 *) &primitive->coexInfo.currentCoexLatencyMs, buffer, &offset); CsrUint8Des((u8 *) &primitive->coexInfo.hasBtDevice, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->coexInfo.currentBlackoutDurationUs, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->coexInfo.currentBlackoutPeriodUs, buffer, &offset); + CsrUint32Des((u32 *) &primitive->coexInfo.currentBlackoutDurationUs, buffer, &offset); + CsrUint32Des((u32 *) &primitive->coexInfo.currentBlackoutPeriodUs, buffer, &offset); CsrUint8Des((u8 *) &primitive->coexInfo.currentCoexScheme, buffer, &offset); return primitive; @@ -2999,29 +2999,29 @@ CsrSize CsrWifiSmeConnectionStatsGetCfmSizeof(void *msg) bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* u8 primitive->connectionStats.unifiTxDataRate */ bufferSize += 1; /* u8 primitive->connectionStats.unifiRxDataRate */ - bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11RetryCount */ - bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11MultipleRetryCount */ - bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11AckFailureCount */ - bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11FrameDuplicateCount */ - bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11FcsErrorCount */ - bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11RtsSuccessCount */ - bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11RtsFailureCount */ - bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11FailedCount */ - bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11TransmittedFragmentCount */ - bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11TransmittedFrameCount */ - bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11WepExcludedCount */ - bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11WepIcvErrorCount */ - bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11WepUndecryptableCount */ - bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11MulticastReceivedFrameCount */ - bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11MulticastTransmittedFrameCount */ - bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11ReceivedFragmentCount */ - bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11Rsna4WayHandshakeFailures */ - bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11RsnaTkipCounterMeasuresInvoked */ - bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11RsnaStatsTkipLocalMicFailures */ - bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11RsnaStatsTkipReplays */ - bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11RsnaStatsTkipIcvErrors */ - bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11RsnaStatsCcmpReplays */ - bufferSize += 4; /* CsrUint32 primitive->connectionStats.dot11RsnaStatsCcmpDecryptErrors */ + bufferSize += 4; /* u32 primitive->connectionStats.dot11RetryCount */ + bufferSize += 4; /* u32 primitive->connectionStats.dot11MultipleRetryCount */ + bufferSize += 4; /* u32 primitive->connectionStats.dot11AckFailureCount */ + bufferSize += 4; /* u32 primitive->connectionStats.dot11FrameDuplicateCount */ + bufferSize += 4; /* u32 primitive->connectionStats.dot11FcsErrorCount */ + bufferSize += 4; /* u32 primitive->connectionStats.dot11RtsSuccessCount */ + bufferSize += 4; /* u32 primitive->connectionStats.dot11RtsFailureCount */ + bufferSize += 4; /* u32 primitive->connectionStats.dot11FailedCount */ + bufferSize += 4; /* u32 primitive->connectionStats.dot11TransmittedFragmentCount */ + bufferSize += 4; /* u32 primitive->connectionStats.dot11TransmittedFrameCount */ + bufferSize += 4; /* u32 primitive->connectionStats.dot11WepExcludedCount */ + bufferSize += 4; /* u32 primitive->connectionStats.dot11WepIcvErrorCount */ + bufferSize += 4; /* u32 primitive->connectionStats.dot11WepUndecryptableCount */ + bufferSize += 4; /* u32 primitive->connectionStats.dot11MulticastReceivedFrameCount */ + bufferSize += 4; /* u32 primitive->connectionStats.dot11MulticastTransmittedFrameCount */ + bufferSize += 4; /* u32 primitive->connectionStats.dot11ReceivedFragmentCount */ + bufferSize += 4; /* u32 primitive->connectionStats.dot11Rsna4WayHandshakeFailures */ + bufferSize += 4; /* u32 primitive->connectionStats.dot11RsnaTkipCounterMeasuresInvoked */ + bufferSize += 4; /* u32 primitive->connectionStats.dot11RsnaStatsTkipLocalMicFailures */ + bufferSize += 4; /* u32 primitive->connectionStats.dot11RsnaStatsTkipReplays */ + bufferSize += 4; /* u32 primitive->connectionStats.dot11RsnaStatsTkipIcvErrors */ + bufferSize += 4; /* u32 primitive->connectionStats.dot11RsnaStatsCcmpReplays */ + bufferSize += 4; /* u32 primitive->connectionStats.dot11RsnaStatsCcmpDecryptErrors */ return bufferSize; } @@ -3035,29 +3035,29 @@ u8* CsrWifiSmeConnectionStatsGetCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrUint16Ser(ptr, len, (u16) primitive->status); CsrUint8Ser(ptr, len, (u8) primitive->connectionStats.unifiTxDataRate); CsrUint8Ser(ptr, len, (u8) primitive->connectionStats.unifiRxDataRate); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11RetryCount); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11MultipleRetryCount); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11AckFailureCount); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11FrameDuplicateCount); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11FcsErrorCount); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11RtsSuccessCount); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11RtsFailureCount); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11FailedCount); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11TransmittedFragmentCount); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11TransmittedFrameCount); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11WepExcludedCount); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11WepIcvErrorCount); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11WepUndecryptableCount); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11MulticastReceivedFrameCount); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11MulticastTransmittedFrameCount); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11ReceivedFragmentCount); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11Rsna4WayHandshakeFailures); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11RsnaTkipCounterMeasuresInvoked); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11RsnaStatsTkipLocalMicFailures); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11RsnaStatsTkipReplays); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11RsnaStatsTkipIcvErrors); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11RsnaStatsCcmpReplays); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->connectionStats.dot11RsnaStatsCcmpDecryptErrors); + CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RetryCount); + CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11MultipleRetryCount); + CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11AckFailureCount); + CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11FrameDuplicateCount); + CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11FcsErrorCount); + CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RtsSuccessCount); + CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RtsFailureCount); + CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11FailedCount); + CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11TransmittedFragmentCount); + CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11TransmittedFrameCount); + CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11WepExcludedCount); + CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11WepIcvErrorCount); + CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11WepUndecryptableCount); + CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11MulticastReceivedFrameCount); + CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11MulticastTransmittedFrameCount); + CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11ReceivedFragmentCount); + CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11Rsna4WayHandshakeFailures); + CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RsnaTkipCounterMeasuresInvoked); + CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RsnaStatsTkipLocalMicFailures); + CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RsnaStatsTkipReplays); + CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RsnaStatsTkipIcvErrors); + CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RsnaStatsCcmpReplays); + CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RsnaStatsCcmpDecryptErrors); return(ptr); } @@ -3073,29 +3073,29 @@ void* CsrWifiSmeConnectionStatsGetCfmDes(u8 *buffer, CsrSize length) CsrUint16Des((u16 *) &primitive->status, buffer, &offset); CsrUint8Des((u8 *) &primitive->connectionStats.unifiTxDataRate, buffer, &offset); CsrUint8Des((u8 *) &primitive->connectionStats.unifiRxDataRate, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11RetryCount, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11MultipleRetryCount, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11AckFailureCount, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11FrameDuplicateCount, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11FcsErrorCount, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11RtsSuccessCount, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11RtsFailureCount, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11FailedCount, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11TransmittedFragmentCount, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11TransmittedFrameCount, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11WepExcludedCount, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11WepIcvErrorCount, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11WepUndecryptableCount, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11MulticastReceivedFrameCount, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11MulticastTransmittedFrameCount, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11ReceivedFragmentCount, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11Rsna4WayHandshakeFailures, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11RsnaTkipCounterMeasuresInvoked, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11RsnaStatsTkipLocalMicFailures, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11RsnaStatsTkipReplays, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11RsnaStatsTkipIcvErrors, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11RsnaStatsCcmpReplays, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->connectionStats.dot11RsnaStatsCcmpDecryptErrors, buffer, &offset); + CsrUint32Des((u32 *) &primitive->connectionStats.dot11RetryCount, buffer, &offset); + CsrUint32Des((u32 *) &primitive->connectionStats.dot11MultipleRetryCount, buffer, &offset); + CsrUint32Des((u32 *) &primitive->connectionStats.dot11AckFailureCount, buffer, &offset); + CsrUint32Des((u32 *) &primitive->connectionStats.dot11FrameDuplicateCount, buffer, &offset); + CsrUint32Des((u32 *) &primitive->connectionStats.dot11FcsErrorCount, buffer, &offset); + CsrUint32Des((u32 *) &primitive->connectionStats.dot11RtsSuccessCount, buffer, &offset); + CsrUint32Des((u32 *) &primitive->connectionStats.dot11RtsFailureCount, buffer, &offset); + CsrUint32Des((u32 *) &primitive->connectionStats.dot11FailedCount, buffer, &offset); + CsrUint32Des((u32 *) &primitive->connectionStats.dot11TransmittedFragmentCount, buffer, &offset); + CsrUint32Des((u32 *) &primitive->connectionStats.dot11TransmittedFrameCount, buffer, &offset); + CsrUint32Des((u32 *) &primitive->connectionStats.dot11WepExcludedCount, buffer, &offset); + CsrUint32Des((u32 *) &primitive->connectionStats.dot11WepIcvErrorCount, buffer, &offset); + CsrUint32Des((u32 *) &primitive->connectionStats.dot11WepUndecryptableCount, buffer, &offset); + CsrUint32Des((u32 *) &primitive->connectionStats.dot11MulticastReceivedFrameCount, buffer, &offset); + CsrUint32Des((u32 *) &primitive->connectionStats.dot11MulticastTransmittedFrameCount, buffer, &offset); + CsrUint32Des((u32 *) &primitive->connectionStats.dot11ReceivedFragmentCount, buffer, &offset); + CsrUint32Des((u32 *) &primitive->connectionStats.dot11Rsna4WayHandshakeFailures, buffer, &offset); + CsrUint32Des((u32 *) &primitive->connectionStats.dot11RsnaTkipCounterMeasuresInvoked, buffer, &offset); + CsrUint32Des((u32 *) &primitive->connectionStats.dot11RsnaStatsTkipLocalMicFailures, buffer, &offset); + CsrUint32Des((u32 *) &primitive->connectionStats.dot11RsnaStatsTkipReplays, buffer, &offset); + CsrUint32Des((u32 *) &primitive->connectionStats.dot11RsnaStatsTkipIcvErrors, buffer, &offset); + CsrUint32Des((u32 *) &primitive->connectionStats.dot11RsnaStatsCcmpReplays, buffer, &offset); + CsrUint32Des((u32 *) &primitive->connectionStats.dot11RsnaStatsCcmpDecryptErrors, buffer, &offset); return primitive; } @@ -5283,7 +5283,7 @@ CsrSize CsrWifiSmeTspecIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 4; /* CsrUint32 primitive->transactionId */ + bufferSize += 4; /* u32 primitive->transactionId */ bufferSize += 1; /* CsrWifiSmeTspecResultCode primitive->tspecResultCode */ bufferSize += 2; /* u16 primitive->tspecLength */ bufferSize += primitive->tspecLength; /* u8 primitive->tspec */ @@ -5297,7 +5297,7 @@ u8* CsrWifiSmeTspecIndSer(u8 *ptr, CsrSize *len, void *msg) *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->transactionId); + CsrUint32Ser(ptr, len, (u32) primitive->transactionId); CsrUint8Ser(ptr, len, (u8) primitive->tspecResultCode); CsrUint16Ser(ptr, len, (u16) primitive->tspecLength); if (primitive->tspecLength) @@ -5316,7 +5316,7 @@ void* CsrWifiSmeTspecIndDes(u8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->transactionId, buffer, &offset); + CsrUint32Des((u32 *) &primitive->transactionId, buffer, &offset); CsrUint8Des((u8 *) &primitive->tspecResultCode, buffer, &offset); CsrUint16Des((u16 *) &primitive->tspecLength, buffer, &offset); if (primitive->tspecLength) @@ -5349,7 +5349,7 @@ CsrSize CsrWifiSmeTspecCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 4; /* CsrUint32 primitive->transactionId */ + bufferSize += 4; /* u32 primitive->transactionId */ bufferSize += 1; /* CsrWifiSmeTspecResultCode primitive->tspecResultCode */ bufferSize += 2; /* u16 primitive->tspecLength */ bufferSize += primitive->tspecLength; /* u8 primitive->tspec */ @@ -5364,7 +5364,7 @@ u8* CsrWifiSmeTspecCfmSer(u8 *ptr, CsrSize *len, void *msg) CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->transactionId); + CsrUint32Ser(ptr, len, (u32) primitive->transactionId); CsrUint8Ser(ptr, len, (u8) primitive->tspecResultCode); CsrUint16Ser(ptr, len, (u16) primitive->tspecLength); if (primitive->tspecLength) @@ -5384,7 +5384,7 @@ void* CsrWifiSmeTspecCfmDes(u8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->transactionId, buffer, &offset); + CsrUint32Des((u32 *) &primitive->transactionId, buffer, &offset); CsrUint8Des((u8 *) &primitive->tspecResultCode, buffer, &offset); CsrUint16Des((u16 *) &primitive->tspecLength, buffer, &offset); if (primitive->tspecLength) @@ -5416,15 +5416,15 @@ CsrSize CsrWifiSmeVersionsGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 33) */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 4; /* CsrUint32 primitive->versions.chipId */ - bufferSize += 4; /* CsrUint32 primitive->versions.chipVersion */ - bufferSize += 4; /* CsrUint32 primitive->versions.firmwareBuild */ - bufferSize += 4; /* CsrUint32 primitive->versions.firmwarePatch */ - bufferSize += 4; /* CsrUint32 primitive->versions.firmwareHip */ + bufferSize += 4; /* u32 primitive->versions.chipId */ + bufferSize += 4; /* u32 primitive->versions.chipVersion */ + bufferSize += 4; /* u32 primitive->versions.firmwareBuild */ + bufferSize += 4; /* u32 primitive->versions.firmwarePatch */ + bufferSize += 4; /* u32 primitive->versions.firmwareHip */ bufferSize += (primitive->versions.routerBuild?CsrStrLen(primitive->versions.routerBuild) : 0) + 1; /* CsrCharString* primitive->versions.routerBuild (0 byte len + 1 for NULL Term) */ - bufferSize += 4; /* CsrUint32 primitive->versions.routerHip */ + bufferSize += 4; /* u32 primitive->versions.routerHip */ bufferSize += (primitive->versions.smeBuild?CsrStrLen(primitive->versions.smeBuild) : 0) + 1; /* CsrCharString* primitive->versions.smeBuild (0 byte len + 1 for NULL Term) */ - bufferSize += 4; /* CsrUint32 primitive->versions.smeHip */ + bufferSize += 4; /* u32 primitive->versions.smeHip */ return bufferSize; } @@ -5435,15 +5435,15 @@ u8* CsrWifiSmeVersionsGetCfmSer(u8 *ptr, CsrSize *len, void *msg) *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.chipId); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.chipVersion); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.firmwareBuild); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.firmwarePatch); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.firmwareHip); + CsrUint32Ser(ptr, len, (u32) primitive->versions.chipId); + CsrUint32Ser(ptr, len, (u32) primitive->versions.chipVersion); + CsrUint32Ser(ptr, len, (u32) primitive->versions.firmwareBuild); + CsrUint32Ser(ptr, len, (u32) primitive->versions.firmwarePatch); + CsrUint32Ser(ptr, len, (u32) primitive->versions.firmwareHip); CsrCharStringSer(ptr, len, primitive->versions.routerBuild); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.routerHip); + CsrUint32Ser(ptr, len, (u32) primitive->versions.routerHip); CsrCharStringSer(ptr, len, primitive->versions.smeBuild); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->versions.smeHip); + CsrUint32Ser(ptr, len, (u32) primitive->versions.smeHip); return(ptr); } @@ -5456,15 +5456,15 @@ void* CsrWifiSmeVersionsGetCfmDes(u8 *buffer, CsrSize length) CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->versions.chipId, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->versions.chipVersion, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->versions.firmwareBuild, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->versions.firmwarePatch, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->versions.firmwareHip, buffer, &offset); + CsrUint32Des((u32 *) &primitive->versions.chipId, buffer, &offset); + CsrUint32Des((u32 *) &primitive->versions.chipVersion, buffer, &offset); + CsrUint32Des((u32 *) &primitive->versions.firmwareBuild, buffer, &offset); + CsrUint32Des((u32 *) &primitive->versions.firmwarePatch, buffer, &offset); + CsrUint32Des((u32 *) &primitive->versions.firmwareHip, buffer, &offset); CsrCharStringDes(&primitive->versions.routerBuild, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->versions.routerHip, buffer, &offset); + CsrUint32Des((u32 *) &primitive->versions.routerHip, buffer, &offset); CsrCharStringDes(&primitive->versions.smeBuild, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->versions.smeHip, buffer, &offset); + CsrUint32Des((u32 *) &primitive->versions.smeHip, buffer, &offset); return primitive; } @@ -5760,7 +5760,7 @@ CsrSize CsrWifiSmeCoreDumpIndSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ - bufferSize += 4; /* CsrUint32 primitive->dataLength */ + bufferSize += 4; /* u32 primitive->dataLength */ bufferSize += primitive->dataLength; /* u8 primitive->data */ return bufferSize; } @@ -5771,7 +5771,7 @@ u8* CsrWifiSmeCoreDumpIndSer(u8 *ptr, CsrSize *len, void *msg) CsrWifiSmeCoreDumpInd *primitive = (CsrWifiSmeCoreDumpInd *)msg; *len = 0; CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint32Ser(ptr, len, (CsrUint32) primitive->dataLength); + CsrUint32Ser(ptr, len, (u32) primitive->dataLength); if (primitive->dataLength) { CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength))); @@ -5787,7 +5787,7 @@ void* CsrWifiSmeCoreDumpIndDes(u8 *buffer, CsrSize length) offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint32Des((CsrUint32 *) &primitive->dataLength, buffer, &offset); + CsrUint32Des((u32 *) &primitive->dataLength, buffer, &offset); if (primitive->dataLength) { primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); diff --git a/drivers/staging/csr/drv.c b/drivers/staging/csr/drv.c index 5ce3329..c5beb22 100644 --- a/drivers/staging/csr/drv.c +++ b/drivers/staging/csr/drv.c @@ -1318,7 +1318,7 @@ unifi_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) /* Apply scheduled interrupt mode, if requested by module param */ if (run_bh_once != -1) { - unifi_set_interrupt_mode(priv->card, (CsrUint32)run_bh_once); + unifi_set_interrupt_mode(priv->card, (u32)run_bh_once); } priv->init_progress = UNIFI_INIT_COMPLETED; @@ -1703,7 +1703,7 @@ unifi_poll(struct file *filp, poll_table *wait) static void udi_set_log_filter(ul_client_t *pcli, unifiio_filter_t *udi_filter) { - CsrUint32 filter_pos; + u32 filter_pos; int i; if (udi_filter->action == UfSigFil_AllOn) @@ -1781,7 +1781,7 @@ udi_log_event(ul_client_t *pcli, int i; int total_len; udi_msg_t *msgptr; - CsrUint32 filter_pos; + u32 filter_pos; #ifdef OMNICLI_LINUX_EXTRA_LOG static volatile unsigned int printk_cpu = UINT_MAX; unsigned long long t; diff --git a/drivers/staging/csr/firmware.c b/drivers/staging/csr/firmware.c index 8199ff9..b871654 100644 --- a/drivers/staging/csr/firmware.c +++ b/drivers/staging/csr/firmware.c @@ -140,7 +140,7 @@ unifi_fw_read_stop(void *ospriv, void *dlpriv) * --------------------------------------------------------------------------- */ void * -unifi_fw_open_buffer(void *ospriv, void *fwbuf, CsrUint32 len) +unifi_fw_open_buffer(void *ospriv, void *fwbuf, u32 len) { unifi_priv_t *priv = (unifi_priv_t*)ospriv; func_enter(); @@ -197,7 +197,7 @@ void unifi_fw_close_buffer(void *ospriv, void *fwbuf) * --------------------------------------------------------------------------- */ CsrInt32 -unifi_fw_read(void *ospriv, void *arg, CsrUint32 offset, void *buf, CsrUint32 len) +unifi_fw_read(void *ospriv, void *arg, u32 offset, void *buf, u32 len) { const struct dlpriv *dlpriv = arg; diff --git a/drivers/staging/csr/netdev.c b/drivers/staging/csr/netdev.c index 947a6ec..529bd9d 100644 --- a/drivers/staging/csr/netdev.c +++ b/drivers/staging/csr/netdev.c @@ -3619,9 +3619,9 @@ static struct notifier_block uf_netdev_notifier = { static void process_amsdu(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata) { - CsrUint32 offset; - CsrUint32 length = bulkdata->d[0].data_length; - CsrUint32 subframe_length, subframe_body_length, dot11_hdr_size; + u32 offset; + u32 length = bulkdata->d[0].data_length; + u32 subframe_length, subframe_body_length, dot11_hdr_size; u8 *ptr; bulk_data_param_t subframe_bulkdata; u8 *dot11_hdr_ptr = (u8*)bulkdata->d[0].os_data_ptr; diff --git a/drivers/staging/csr/sdio_mmc.c b/drivers/staging/csr/sdio_mmc.c index 8dc91bf..d3fd57c 100644 --- a/drivers/staging/csr/sdio_mmc.c +++ b/drivers/staging/csr/sdio_mmc.c @@ -144,7 +144,7 @@ csr_io_rw_direct(struct mmc_card *card, int write, uint8_t fn, CsrResult -CsrSdioRead8(CsrSdioFunction *function, CsrUint32 address, u8 *data) +CsrSdioRead8(CsrSdioFunction *function, u32 address, u8 *data) { struct sdio_func *func = (struct sdio_func *)function->priv; int err = 0; @@ -162,7 +162,7 @@ CsrSdioRead8(CsrSdioFunction *function, CsrUint32 address, u8 *data) } /* CsrSdioRead8() */ CsrResult -CsrSdioWrite8(CsrSdioFunction *function, CsrUint32 address, u8 data) +CsrSdioWrite8(CsrSdioFunction *function, u32 address, u8 data) { struct sdio_func *func = (struct sdio_func *)function->priv; int err = 0; @@ -180,7 +180,7 @@ CsrSdioWrite8(CsrSdioFunction *function, CsrUint32 address, u8 data) } /* CsrSdioWrite8() */ CsrResult -CsrSdioRead16(CsrSdioFunction *function, CsrUint32 address, u16 *data) +CsrSdioRead16(CsrSdioFunction *function, u32 address, u16 *data) { struct sdio_func *func = (struct sdio_func *)function->priv; int err; @@ -207,7 +207,7 @@ CsrSdioRead16(CsrSdioFunction *function, CsrUint32 address, u16 *data) CsrResult -CsrSdioWrite16(CsrSdioFunction *function, CsrUint32 address, u16 data) +CsrSdioWrite16(CsrSdioFunction *function, u32 address, u16 data) { struct sdio_func *func = (struct sdio_func *)function->priv; int err; @@ -234,7 +234,7 @@ CsrSdioWrite16(CsrSdioFunction *function, CsrUint32 address, u16 data) CsrResult -CsrSdioF0Read8(CsrSdioFunction *function, CsrUint32 address, u8 *data) +CsrSdioF0Read8(CsrSdioFunction *function, u32 address, u8 *data) { struct sdio_func *func = (struct sdio_func *)function->priv; int err = 0; @@ -256,7 +256,7 @@ CsrSdioF0Read8(CsrSdioFunction *function, CsrUint32 address, u8 *data) } /* CsrSdioF0Read8() */ CsrResult -CsrSdioF0Write8(CsrSdioFunction *function, CsrUint32 address, u8 data) +CsrSdioF0Write8(CsrSdioFunction *function, u32 address, u8 data) { struct sdio_func *func = (struct sdio_func *)function->priv; int err = 0; @@ -279,7 +279,7 @@ CsrSdioF0Write8(CsrSdioFunction *function, CsrUint32 address, u8 data) CsrResult -CsrSdioRead(CsrSdioFunction *function, CsrUint32 address, void *data, CsrUint32 length) +CsrSdioRead(CsrSdioFunction *function, u32 address, void *data, u32 length) { struct sdio_func *func = (struct sdio_func *)function->priv; int err; @@ -297,7 +297,7 @@ CsrSdioRead(CsrSdioFunction *function, CsrUint32 address, void *data, CsrUint32 } /* CsrSdioRead() */ CsrResult -CsrSdioWrite(CsrSdioFunction *function, CsrUint32 address, const void *data, CsrUint32 length) +CsrSdioWrite(CsrSdioFunction *function, u32 address, const void *data, u32 length) { struct sdio_func *func = (struct sdio_func *)function->priv; int err; @@ -404,14 +404,14 @@ csr_sdio_disable_hs(struct mmc_card *card) * --------------------------------------------------------------------------- */ CsrResult -CsrSdioMaxBusClockFrequencySet(CsrSdioFunction *function, CsrUint32 maxFrequency) +CsrSdioMaxBusClockFrequencySet(CsrSdioFunction *function, u32 maxFrequency) { struct sdio_func *func = (struct sdio_func *)function->priv; struct mmc_host *host = func->card->host; struct mmc_ios *ios = &host->ios; unsigned int max_hz; int err; - CsrUint32 max_khz = maxFrequency/1000; + u32 max_khz = maxFrequency/1000; if (!max_khz || max_khz > sdio_clock) { max_khz = sdio_clock; diff --git a/drivers/staging/csr/sme_blocking.c b/drivers/staging/csr/sme_blocking.c index c95f1b3..92139671 100644 --- a/drivers/staging/csr/sme_blocking.c +++ b/drivers/staging/csr/sme_blocking.c @@ -1299,7 +1299,7 @@ int sme_mgt_packet_filter_set(unifi_priv_t *priv) } int sme_mgt_tspec(unifi_priv_t *priv, CsrWifiSmeListAction action, - CsrUint32 tid, CsrWifiSmeDataBlock *tspec, CsrWifiSmeDataBlock *tclas) + u32 tid, CsrWifiSmeDataBlock *tspec, CsrWifiSmeDataBlock *tclas) { int r; diff --git a/drivers/staging/csr/sme_native.c b/drivers/staging/csr/sme_native.c index 2e63db2..f22b804 100644 --- a/drivers/staging/csr/sme_native.c +++ b/drivers/staging/csr/sme_native.c @@ -395,10 +395,10 @@ unifi_ta_indicate_sampling(void *ospriv, CsrWifiRouterCtrlTrafficStats *stats) void unifi_ta_indicate_l4stats(void *ospriv, - CsrUint32 rxTcpThroughput, - CsrUint32 txTcpThroughput, - CsrUint32 rxUdpThroughput, - CsrUint32 txUdpThroughput) + u32 rxTcpThroughput, + u32 txTcpThroughput, + u32 rxUdpThroughput, + u32 txUdpThroughput) { } /* unifi_ta_indicate_l4stats() */ diff --git a/drivers/staging/csr/sme_sys.c b/drivers/staging/csr/sme_sys.c index 59909a4..add5771 100644 --- a/drivers/staging/csr/sme_sys.c +++ b/drivers/staging/csr/sme_sys.c @@ -1093,7 +1093,7 @@ void CsrWifiRouterCtrlWifiOnResHandler(void* drvpriv, CsrWifiFsmEvent* msg) if (res->status == CSR_RESULT_SUCCESS) { int i; /* used as a loop counter */ - CsrUint32 intmode = CSR_WIFI_INTMODE_DEFAULT; + u32 intmode = CSR_WIFI_INTMODE_DEFAULT; #ifdef CSR_WIFI_SPLIT_PATCH CsrBool switching_ap_fw = FALSE; #endif @@ -1147,7 +1147,7 @@ void CsrWifiRouterCtrlWifiOnResHandler(void* drvpriv, CsrWifiFsmEvent* msg) * but let module param override. */ if (run_bh_once != -1) { - intmode = (CsrUint32)run_bh_once; + intmode = (u32)run_bh_once; } else if (res->scheduledInterrupt) { intmode = CSR_WIFI_INTMODE_RUN_BH_ONCE; } @@ -2098,7 +2098,7 @@ void CsrWifiRouterCtrlPeerDelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) } /* Add the new station to the station record data base */ -static int peer_add_new_record(unifi_priv_t *priv,CsrWifiRouterCtrlPeerAddReq *req,CsrUint32 *handle) +static int peer_add_new_record(unifi_priv_t *priv,CsrWifiRouterCtrlPeerAddReq *req,u32 *handle) { u8 i, powerModeTemp = 0; CsrBool freeSlotFound = FALSE; @@ -2479,7 +2479,7 @@ void CsrWifiRouterCtrlPeerAddReqHandler(void* drvpriv,CsrWifiFsmEvent* msg) CsrWifiRouterCtrlPeerAddReq* req = (CsrWifiRouterCtrlPeerAddReq*)msg; CsrResult status = CSR_RESULT_SUCCESS; unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrUint32 handle = 0; + u32 handle = 0; netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; unifi_trace(priv, UDBG2, "entering CsrWifiRouterCtrlPeerAddReqHandler \n"); diff --git a/drivers/staging/csr/sme_userspace.c b/drivers/staging/csr/sme_userspace.c index b4a0009..5dc7a2e 100644 --- a/drivers/staging/csr/sme_userspace.c +++ b/drivers/staging/csr/sme_userspace.c @@ -297,10 +297,10 @@ unifi_ta_indicate_sampling(void *ospriv, CsrWifiRouterCtrlTrafficStats *stats) */ void unifi_ta_indicate_l4stats(void *ospriv, - CsrUint32 rxTcpThroughput, - CsrUint32 txTcpThroughput, - CsrUint32 rxUdpThroughput, - CsrUint32 txUdpThroughput) + u32 rxTcpThroughput, + u32 txTcpThroughput, + u32 rxUdpThroughput, + u32 txUdpThroughput) { unifi_priv_t *priv = (unifi_priv_t*)ospriv; diff --git a/drivers/staging/csr/sme_wext.c b/drivers/staging/csr/sme_wext.c index 51c19bb..7e85907 100644 --- a/drivers/staging/csr/sme_wext.c +++ b/drivers/staging/csr/sme_wext.c @@ -458,7 +458,7 @@ static int decode_parameter_from_string(unifi_priv_t* priv, char **str_ptr, void *dst, int param_max_len) { u8 int_str[7] = "0"; - CsrUint32 param_str_len; + u32 param_str_len; u8 *param_str_begin,*param_str_end; u8 *orig_str = *str_ptr; @@ -480,7 +480,7 @@ static int decode_parameter_from_string(unifi_priv_t* priv, char **str_ptr, switch (param_type) { case PARAM_TYPE_INT: { - CsrUint32 *pdst_int = dst,num =0; + u32 *pdst_int = dst,num =0; int i,j=0; if (param_str_len > sizeof(int_str)) { param_str_len = sizeof(int_str); diff --git a/drivers/staging/csr/ul_int.c b/drivers/staging/csr/ul_int.c index 325218f..d71bb05 100644 --- a/drivers/staging/csr/ul_int.c +++ b/drivers/staging/csr/ul_int.c @@ -213,7 +213,7 @@ ul_deregister_client(ul_client_t *ul_client) */ void logging_handler(void *ospriv, - u8 *sigdata, CsrUint32 signal_len, + u8 *sigdata, u32 signal_len, const bulk_data_param_t *bulkdata, enum udi_log_direction direction) { @@ -340,7 +340,7 @@ _align_bulk_data_buffers(unifi_priv_t *priv, u8 *signal, * The following complex casting is in place in order to eliminate 64-bit compilation warning * "cast to/from pointer from/to integer of different size" */ - CsrUint32 align_offset = (CsrUint32)(long)(bulkdata->d[i].os_data_ptr) & (CSR_WIFI_ALIGN_BYTES-1); + u32 align_offset = (u32)(long)(bulkdata->d[i].os_data_ptr) & (CSR_WIFI_ALIGN_BYTES-1); if (align_offset) { skb = (struct sk_buff*)bulkdata->d[i].os_net_buf_ptr; diff --git a/drivers/staging/csr/unifi_clients.h b/drivers/staging/csr/unifi_clients.h index 418cb4d9..df853e1 100644 --- a/drivers/staging/csr/unifi_clients.h +++ b/drivers/staging/csr/unifi_clients.h @@ -49,7 +49,7 @@ typedef void (*udi_event_t)(ul_client_t *client, int dir); void logging_handler(void *ospriv, - u8 *sigdata, CsrUint32 signal_len, + u8 *sigdata, u32 signal_len, const bulk_data_param_t *bulkdata, enum udi_log_direction direction); diff --git a/drivers/staging/csr/unifi_event.c b/drivers/staging/csr/unifi_event.c index f1b8cc5..f5c2e77 100644 --- a/drivers/staging/csr/unifi_event.c +++ b/drivers/staging/csr/unifi_event.c @@ -367,7 +367,7 @@ static CsrBool check_routing_pkt_data_ind(unifi_priv_t *priv, */ static void unifi_process_receive_event(void *ospriv, - u8 *sigdata, CsrUint32 siglen, + u8 *sigdata, u32 siglen, const bulk_data_param_t *bulkdata) { unifi_priv_t *priv = (unifi_priv_t*)ospriv; @@ -647,7 +647,7 @@ void rx_wq_handler(struct work_struct *work) */ void unifi_receive_event(void *ospriv, - u8 *sigdata, CsrUint32 siglen, + u8 *sigdata, u32 siglen, const bulk_data_param_t *bulkdata) { #ifdef CSR_WIFI_RX_PATH_SPLIT diff --git a/drivers/staging/csr/unifi_pdu_processing.c b/drivers/staging/csr/unifi_pdu_processing.c index 51ce5e4..7c5fb45 100644 --- a/drivers/staging/csr/unifi_pdu_processing.c +++ b/drivers/staging/csr/unifi_pdu_processing.c @@ -33,14 +33,14 @@ static void _update_buffered_pkt_params_after_alignment(unifi_priv_t *priv, bulk tx_buffered_packets_t* buffered_pkt) { struct sk_buff *skb ; - CsrUint32 align_offset; + u32 align_offset; if (priv == NULL || bulkdata == NULL || buffered_pkt == NULL){ return; } skb = (struct sk_buff*)bulkdata->d[0].os_net_buf_ptr; - align_offset = (CsrUint32)(long)(bulkdata->d[0].os_data_ptr) & (CSR_WIFI_ALIGN_BYTES-1); + align_offset = (u32)(long)(bulkdata->d[0].os_data_ptr) & (CSR_WIFI_ALIGN_BYTES-1); if(align_offset){ skb_pull(skb,align_offset); } @@ -448,7 +448,7 @@ CsrResult enque_tx_data_pdu(unifi_priv_t *priv, bulk_data_param_t *bulkdata, } #ifdef CSR_WIFI_REQUEUE_PACKET_TO_HAL -CsrResult unifi_reque_ma_packet_request (void *ospriv, CsrUint32 host_tag, +CsrResult unifi_reque_ma_packet_request (void *ospriv, u32 host_tag, u16 txStatus, bulk_data_desc_t *bulkDataDesc) { CsrResult status = CSR_RESULT_SUCCESS; @@ -859,7 +859,7 @@ void uf_handle_tim_cfm(unifi_priv_t *priv, CSR_MLME_SET_TIM_CONFIRM *cfm, u16 re * * --------------------------------------------------------------------------- */ -void update_tim(unifi_priv_t * priv, u16 aid, u8 setTim, u16 interfaceTag, CsrUint32 handle) +void update_tim(unifi_priv_t * priv, u16 aid, u8 setTim, u16 interfaceTag, u32 handle) { CSR_SIGNAL signal; CsrInt32 r; @@ -868,7 +868,7 @@ void update_tim(unifi_priv_t * priv, u16 aid, u8 setTim, u16 interfaceTag, CsrUi netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; u8 senderIdLsb = 0; CsrWifiRouterCtrlStaInfo_t *staRecord = NULL; - CsrUint32 oldTimSetStatus = 0, timSetStatus = 0; + u32 oldTimSetStatus = 0, timSetStatus = 0; unifi_trace(priv, UDBG5, "entering the update_tim routine\n"); @@ -1661,13 +1661,13 @@ CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, CsrWifiPacketType pktType; int frameType = 0; CsrBool queuePacketDozing = FALSE; - CsrUint32 priority_q; + u32 priority_q; u16 frmCtrl; struct list_head * list = NULL; /* List to which buffered PDUs are to be enqueued*/ CsrBool setBcTim=FALSE; netInterface_priv_t *interfacePriv; CsrBool requeueOnSamePos = FALSE; - CsrUint32 handle = 0xFFFFFFFF; + u32 handle = 0xFFFFFFFF; unsigned long lock_flags; unifi_trace(priv, UDBG5, @@ -2025,7 +2025,7 @@ u8 send_multicast_frames(unifi_priv_t *priv, u16 interfaceTag) u8 pduSent =0; unsigned long lock_flags; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - CsrUint32 hostTag = 0xffffffff; + u32 hostTag = 0xffffffff; func_enter(); if(!isRouterBufferEnabled(priv,UNIFI_TRAFFIC_Q_VO)) { @@ -2116,7 +2116,7 @@ u8 send_multicast_frames(unifi_priv_t *priv, u16 interfaceTag) } #endif void uf_process_ma_vif_availibility_ind(unifi_priv_t *priv,u8 *sigdata, - CsrUint32 siglen) + u32 siglen) { #ifdef CSR_SUPPORT_SME CSR_SIGNAL signal; @@ -2409,7 +2409,7 @@ void uf_send_buffered_data_from_ac(unifi_priv_t *priv, void uf_send_buffered_frames(unifi_priv_t *priv,unifi_TrafficQueue q) { u16 interfaceTag = GET_ACTIVE_INTERFACE_TAG(priv); - CsrUint32 startIndex=0,endIndex=0; + u32 startIndex=0,endIndex=0; CsrWifiRouterCtrlStaInfo_t * staInfo = NULL; u8 queue; CsrBool moreData = FALSE; @@ -2769,7 +2769,7 @@ void uf_send_qos_null(unifi_priv_t * priv,u16 interfaceTag, const u8 *da,CSR_PRI CSR_TRANSMISSION_CONTROL transmissionControl = (TRANSMISSION_CONTROL_EOSP_MASK | TRANSMISSION_CONTROL_TRIGGER_MASK); int r; CSR_SIGNAL signal; - CsrUint32 priority_q; + u32 priority_q; CSR_RATE transmitRate = 0; @@ -2840,7 +2840,7 @@ void uf_send_nulldata(unifi_priv_t * priv,u16 interfaceTag, const u8 *da,CSR_PRI CSR_TRANSMISSION_CONTROL transmissionControl = 0; int r; CSR_SIGNAL signal; - CsrUint32 priority_q; + u32 priority_q; CSR_RATE transmitRate = 0; CSR_MA_PACKET_REQUEST *req = &signal.u.MaPacketRequest; unsigned long lock_flags; @@ -3481,7 +3481,7 @@ CsrWifiRouterCtrlStaInfo_t *CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress( } /* generic function to get the station record handler from the handle */ CsrWifiRouterCtrlStaInfo_t * CsrWifiRouterCtrlGetStationRecordFromHandle(unifi_priv_t *priv, - CsrUint32 handle, + u32 handle, u16 interfaceTag) { netInterface_priv_t *interfacePriv; @@ -3497,7 +3497,7 @@ CsrWifiRouterCtrlStaInfo_t * CsrWifiRouterCtrlGetStationRecordFromHandle(unifi_p /* Function to do inactivity */ void uf_check_inactivity(unifi_priv_t *priv, u16 interfaceTag, CsrTime currentTime) { - CsrUint32 i; + u32 i; CsrWifiRouterCtrlStaInfo_t *staInfo; CsrTime elapsedTime; /* Time in microseconds */ netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; @@ -3523,7 +3523,7 @@ void uf_check_inactivity(unifi_priv_t *priv, u16 interfaceTag, CsrTime currentTi elapsedTime = (currentTime >= staInfo->lastActivity)? (currentTime - staInfo->lastActivity): - (~((CsrUint32)0) - staInfo->lastActivity + currentTime); + (~((u32)0) - staInfo->lastActivity + currentTime); spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); if (elapsedTime > MAX_INACTIVITY_INTERVAL) { @@ -3578,7 +3578,7 @@ void uf_update_sta_activity(unifi_priv_t *priv, u16 interfaceTag, const u8 *peer * 64 bit handling */ elapsedTime = (currentTime >= interfacePriv->last_inactivity_check)? (currentTime - interfacePriv->last_inactivity_check): - (~((CsrUint32)0) - interfacePriv->last_inactivity_check + currentTime); + (~((u32)0) - interfacePriv->last_inactivity_check + currentTime); spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags); diff --git a/drivers/staging/csr/unifi_priv.h b/drivers/staging/csr/unifi_priv.h index 126e7c6..2e05015 100644 --- a/drivers/staging/csr/unifi_priv.h +++ b/drivers/staging/csr/unifi_priv.h @@ -322,7 +322,7 @@ typedef struct CsrWifiRouterCtrlStaInfo_t { /* Sme sends these parameters */ CsrWifiMacAddress peerMacAddress; - CsrUint32 assignedHandle; + u32 assignedHandle; CsrBool wmmOrQosEnabled; CsrWifiAcPowersaveMode powersaveMode[MAX_ACCESS_CATOGORY]; u16 maxSpLength; @@ -648,10 +648,10 @@ struct unifi_priv { #endif - CsrUint32 rxTcpThroughput; - CsrUint32 txTcpThroughput; - CsrUint32 rxUdpThroughput; - CsrUint32 txUdpThroughput; + u32 rxTcpThroughput; + u32 txTcpThroughput; + u32 rxUdpThroughput; + u32 txUdpThroughput; #ifdef CSR_WIFI_SECURITY_WAPI_ENABLE /*Set if multicast KeyID = 1*/ @@ -749,7 +749,7 @@ typedef struct netInterface_priv u8 mc_list[UNIFI_MAX_MULTICAST_ADDRESSES*ETH_ALEN]; /* The multicast addresses count that the thread needs to set. */ int mc_list_count; - CsrUint32 tag; + u32 tag; #ifdef CSR_SUPPORT_SME /* (un)controlled port configuration */ unifi_port_config_t controlled_data_port; @@ -791,7 +791,7 @@ typedef struct netInterface_priv CSR_CLIENT_TAG m4_hostTag; CsrBool dtimActive; CsrBool intraBssEnabled; - CsrUint32 multicastPduHostTag; /* Used to set the tim after getting + u32 multicastPduHostTag; /* Used to set the tim after getting a confirm for it */ CsrBool bcTimSet; CsrBool bcTimSetReqPendingFlag; @@ -981,7 +981,7 @@ void uf_send_nulldata(unifi_priv_t * priv,u16 interfaceTag, const u8 *da,CSR_PRI #endif CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, u8 *peerMacAddress, CSR_CLIENT_TAG hostTag, u16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl, CSR_RATE TransmitRate, CSR_PRIORITY priority, CSR_PROCESS_ID senderId, bulk_data_param_t *bulkdata); -void uf_process_ma_vif_availibility_ind(unifi_priv_t *priv,u8 *sigdata, CsrUint32 siglen); +void uf_process_ma_vif_availibility_ind(unifi_priv_t *priv,u8 *sigdata, u32 siglen); #ifdef CSR_SUPPORT_SME void uf_send_buffered_frames(unifi_priv_t *priv,unifi_TrafficQueue queue); int uf_process_station_records_for_sending_data(unifi_priv_t *priv,u16 interfaceTag, @@ -1053,7 +1053,7 @@ unifi_frame_ma_packet_req(unifi_priv_t *priv, CSR_PRIORITY priority, /* handle is 6 bits to accomodate in senderId LSB (only 64 station can be associated) */ #define CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE 0x3F -void update_tim(unifi_priv_t * priv, u16 aid, u8 setTim, u16 interfaceTag, CsrUint32 handle); +void update_tim(unifi_priv_t * priv, u16 aid, u8 setTim, u16 interfaceTag, u32 handle); void uf_handle_tim_cfm(unifi_priv_t *priv, CSR_MLME_SET_TIM_CONFIRM *cfm, u16 senderProcessId); /* Clear the Peer station Record, in case of wifioff/unexpected card removal */ @@ -1082,7 +1082,7 @@ CsrWifiRouterCtrlStaInfo_t *CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress( /* Fetch the station record handler from data base for matching handle */ CsrWifiRouterCtrlStaInfo_t * CsrWifiRouterCtrlGetStationRecordFromHandle(unifi_priv_t *priv, - CsrUint32 handle, + u32 handle, u16 interfaceTag); void uf_update_sta_activity(unifi_priv_t *priv, u16 interfaceTag, const u8 *peerMacAddress); diff --git a/drivers/staging/csr/unifi_sme.c b/drivers/staging/csr/unifi_sme.c index 98c9c07..85ea812 100644 --- a/drivers/staging/csr/unifi_sme.c +++ b/drivers/staging/csr/unifi_sme.c @@ -648,7 +648,7 @@ int unifi_cfg_wmm_qos_info(unifi_priv_t *priv, unsigned char *arg) int unifi_cfg_wmm_addts(unifi_priv_t *priv, unsigned char *arg) { - CsrUint32 addts_tid; + u32 addts_tid; u8 addts_ie_length; u8 *addts_ie; u8 *addts_params; @@ -657,12 +657,12 @@ int unifi_cfg_wmm_addts(unifi_priv_t *priv, unsigned char *arg) int rc; addts_params = (u8*)(((unifi_cfg_command_t*)arg) + 1); - if (get_user(addts_tid, (CsrUint32*)addts_params)) { + if (get_user(addts_tid, (u32*)addts_params)) { unifi_error(priv, "unifi_cfg_wmm_addts: Failed to get the argument\n"); return -EFAULT; } - addts_params += sizeof(CsrUint32); + addts_params += sizeof(u32); if (get_user(addts_ie_length, (u8*)addts_params)) { unifi_error(priv, "unifi_cfg_wmm_addts: Failed to get the argument\n"); return -EFAULT; @@ -702,14 +702,14 @@ int unifi_cfg_wmm_addts(unifi_priv_t *priv, unsigned char *arg) int unifi_cfg_wmm_delts(unifi_priv_t *priv, unsigned char *arg) { - CsrUint32 delts_tid; + u32 delts_tid; u8 *delts_params; CsrWifiSmeDataBlock tspec; CsrWifiSmeDataBlock tclas; int rc; delts_params = (u8*)(((unifi_cfg_command_t*)arg) + 1); - if (get_user(delts_tid, (CsrUint32*)delts_params)) { + if (get_user(delts_tid, (u32*)delts_params)) { unifi_error(priv, "unifi_cfg_wmm_delts: Failed to get the argument\n"); return -EFAULT; } @@ -1198,7 +1198,7 @@ void uf_send_pkt_to_encrypt(struct work_struct *work) u16 interfaceTag = interfacePriv->InterfaceTag; unifi_priv_t *priv = interfacePriv->privPtr; - CsrUint32 pktBulkDataLength; + u32 pktBulkDataLength; u8 *pktBulkData; unsigned long flags; diff --git a/drivers/staging/csr/unifi_sme.h b/drivers/staging/csr/unifi_sme.h index bfe20d3..bdff0f3 100644 --- a/drivers/staging/csr/unifi_sme.h +++ b/drivers/staging/csr/unifi_sme.h @@ -166,7 +166,7 @@ int sme_mgt_sme_config_get(unifi_priv_t *priv, CsrWifiSmeStaConfig *staConfig, C int sme_mgt_coex_info_get(unifi_priv_t *priv, CsrWifiSmeCoexInfo *coexInfo); int sme_mgt_packet_filter_set(unifi_priv_t *priv); int sme_mgt_tspec(unifi_priv_t *priv, CsrWifiSmeListAction action, - CsrUint32 tid, CsrWifiSmeDataBlock *tspec, CsrWifiSmeDataBlock *tclas); + u32 tid, CsrWifiSmeDataBlock *tspec, CsrWifiSmeDataBlock *tclas); #ifdef CSR_SUPPORT_WEXT /* -- cgit v0.10.2 From 95e326c28aa66d6ff5821f3c1d22b46a8d335939 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 12:07:25 -0700 Subject: staging: csr: remove CsrInt32 typedef MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the in-kernel s32 type instead. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_formatted_io.c b/drivers/staging/csr/csr_formatted_io.c index bd6456b..145e99f 100644 --- a/drivers/staging/csr/csr_formatted_io.c +++ b/drivers/staging/csr/csr_formatted_io.c @@ -12,9 +12,9 @@ #include "csr_formatted_io.h" #include "csr_util.h" -CsrInt32 CsrSnprintf(CsrCharString *dest, CsrSize n, const CsrCharString *fmt, ...) +s32 CsrSnprintf(CsrCharString *dest, CsrSize n, const CsrCharString *fmt, ...) { - CsrInt32 r; + s32 r; va_list args; va_start(args, fmt); r = CsrVsnprintf(dest, n, fmt, args); diff --git a/drivers/staging/csr/csr_formatted_io.h b/drivers/staging/csr/csr_formatted_io.h index b458eb5..b51119c 100644 --- a/drivers/staging/csr/csr_formatted_io.h +++ b/drivers/staging/csr/csr_formatted_io.h @@ -16,7 +16,7 @@ extern "C" { #include "csr_types.h" -CsrInt32 CsrSnprintf(CsrCharString *dest, CsrSize n, const CsrCharString *fmt, ...); +s32 CsrSnprintf(CsrCharString *dest, CsrSize n, const CsrCharString *fmt, ...); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_time.h b/drivers/staging/csr/csr_time.h index 9687b06..286b289 100644 --- a/drivers/staging/csr/csr_time.h +++ b/drivers/staging/csr/csr_time.h @@ -131,7 +131,7 @@ void CsrTimeUtcGet(CsrTimeUtc *tod, CsrTime *low, CsrTime *high); * CsrTime - "t1" - "t2". * *----------------------------------------------------------------------------*/ -#define CsrTimeSub(t1, t2) ((CsrInt32) (t1) - (CsrInt32) (t2)) +#define CsrTimeSub(t1, t2) ((s32) (t1) - (s32) (t2)) /*----------------------------------------------------------------------------* * NAME diff --git a/drivers/staging/csr/csr_types.h b/drivers/staging/csr/csr_types.h index 144c980..deaecb6 100644 --- a/drivers/staging/csr/csr_types.h +++ b/drivers/staging/csr/csr_types.h @@ -32,9 +32,6 @@ typedef ptrdiff_t CsrPtrdiff; /* Type of the result of subtracting two pointer typedef uintptr_t CsrUintptr; /* Unsigned integer large enough to hold any pointer (ISO/IEC 9899:1999 7.18.1.4) */ typedef ptrdiff_t CsrIntptr; /* intptr_t is not defined in kernel. Use the equivalent ptrdiff_t. */ -/* Signed fixed width types */ -typedef int32_t CsrInt32; - /* Boolean */ typedef u8 CsrBool; diff --git a/drivers/staging/csr/csr_unicode.h b/drivers/staging/csr/csr_unicode.h index 4a97771..47ade65 100644 --- a/drivers/staging/csr/csr_unicode.h +++ b/drivers/staging/csr/csr_unicode.h @@ -38,8 +38,8 @@ CsrUtf16String *CsrUtf16ConcatenateTexts(const CsrUtf16String *inputText1, const CsrUtf16String *CsrUtf16String2XML(CsrUtf16String *str); CsrUtf16String *CsrXML2Utf16String(CsrUtf16String *str); -CsrInt32 CsrUtf8StrCmp(const CsrUtf8String *string1, const CsrUtf8String *string2); -CsrInt32 CsrUtf8StrNCmp(const CsrUtf8String *string1, const CsrUtf8String *string2, CsrSize count); +s32 CsrUtf8StrCmp(const CsrUtf8String *string1, const CsrUtf8String *string2); +s32 CsrUtf8StrNCmp(const CsrUtf8String *string1, const CsrUtf8String *string2, CsrSize count); u32 CsrUtf8StringLengthInBytes(const CsrUtf8String *string); /******************************************************************************* diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index b9a5c5f..5048250 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -1016,12 +1016,12 @@ CsrUtf16String *CsrXML2Utf16String(CsrUtf16String *str) return resultString; } -CsrInt32 CsrUtf8StrCmp(const CsrUtf8String *string1, const CsrUtf8String *string2) +s32 CsrUtf8StrCmp(const CsrUtf8String *string1, const CsrUtf8String *string2) { return CsrStrCmp((const CsrCharString *) string1, (const CsrCharString *) string2); } -CsrInt32 CsrUtf8StrNCmp(const CsrUtf8String *string1, const CsrUtf8String *string2, CsrSize count) +s32 CsrUtf8StrNCmp(const CsrUtf8String *string1, const CsrUtf8String *string2, CsrSize count) { return CsrStrNCmp((const CsrCharString *) string1, (const CsrCharString *) string2, count); } diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index edee2e2..170deac 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -145,9 +145,9 @@ u32 CsrPow(u32 base, u32 exponent) /* Convert signed 32 bit (or less) integer to string */ #define I2B10_MAX 12 -void CsrIntToBase10(CsrInt32 number, CsrCharString *str) +void CsrIntToBase10(s32 number, CsrCharString *str) { - CsrInt32 digit; + s32 digit; u8 index; CsrCharString res[I2B10_MAX]; CsrBool foundDigit = FALSE; @@ -240,7 +240,7 @@ void *CsrMemMove(void *dest, const void *src, CsrSize count) } EXPORT_SYMBOL_GPL(CsrMemMove); -CsrInt32 CsrMemCmp(const void *buf1, const void *buf2, CsrSize count) +s32 CsrMemCmp(const void *buf1, const void *buf2, CsrSize count) { return memcmp(buf1, buf2, count); } @@ -292,12 +292,12 @@ CsrSize CsrStrLen(const CsrCharString *string) } EXPORT_SYMBOL_GPL(CsrStrLen); -CsrInt32 CsrStrCmp(const CsrCharString *string1, const CsrCharString *string2) +s32 CsrStrCmp(const CsrCharString *string1, const CsrCharString *string2) { return strcmp(string1, string2); } -CsrInt32 CsrStrNCmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count) +s32 CsrStrNCmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count) { return strncmp(string1, string2, count); } @@ -308,7 +308,7 @@ CsrCharString *CsrStrChr(const CsrCharString *string, CsrCharString c) } #endif -CsrInt32 CsrVsnprintf(CsrCharString *string, CsrSize count, const CsrCharString *format, va_list args) +s32 CsrVsnprintf(CsrCharString *string, CsrSize count, const CsrCharString *format, va_list args) { return vsnprintf(string, count, format, args); } diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index f19f953..0d01127 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -30,7 +30,7 @@ CsrBool CsrHexStrToUint8(const CsrCharString *string, u8 *returnValue); CsrBool CsrHexStrToUint16(const CsrCharString *string, u16 *returnValue); CsrBool CsrHexStrToUint32(const CsrCharString *string, u32 *returnValue); u32 CsrPow(u32 base, u32 exponent); -void CsrIntToBase10(CsrInt32 number, CsrCharString *str); +void CsrIntToBase10(s32 number, CsrCharString *str); void CsrUInt16ToHex(u16 number, CsrCharString *str); void CsrUInt32ToHex(u32 number, CsrCharString *str); @@ -44,9 +44,9 @@ void CsrUInt32ToHex(u32 number, CsrCharString *str); #define CsrStrNCpy strncpy #define CsrStrCat strcat #define CsrStrNCat strncat -#define CsrMemCmp(s1, s2, n) ((CsrInt32) memcmp((s1), (s2), (n))) -#define CsrStrCmp(s1, s2) ((CsrInt32) strcmp((s1), (s2))) -#define CsrStrNCmp(s1, s2, n) ((CsrInt32) strncmp((s1), (s2), (n))) +#define CsrMemCmp(s1, s2, n) ((s32) memcmp((s1), (s2), (n))) +#define CsrStrCmp(s1, s2) ((s32) strcmp((s1), (s2))) +#define CsrStrNCmp(s1, s2, n) ((s32) strncmp((s1), (s2), (n))) #define CsrStrChr strchr #define CsrStrStr strstr #define CsrMemSet memset @@ -58,15 +58,15 @@ CsrCharString *CsrStrCpy(CsrCharString *dest, const CsrCharString *src); CsrCharString *CsrStrNCpy(CsrCharString *dest, const CsrCharString *src, CsrSize count); CsrCharString *CsrStrCat(CsrCharString *dest, const CsrCharString *src); CsrCharString *CsrStrNCat(CsrCharString *dest, const CsrCharString *src, CsrSize count); -CsrInt32 CsrMemCmp(const void *buf1, const void *buf2, CsrSize count); -CsrInt32 CsrStrCmp(const CsrCharString *string1, const CsrCharString *string2); -CsrInt32 CsrStrNCmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count); +s32 CsrMemCmp(const void *buf1, const void *buf2, CsrSize count); +s32 CsrStrCmp(const CsrCharString *string1, const CsrCharString *string2); +s32 CsrStrNCmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count); CsrCharString *CsrStrChr(const CsrCharString *string, CsrCharString c); CsrCharString *CsrStrStr(const CsrCharString *string1, const CsrCharString *string2); void *CsrMemSet(void *dest, u8 c, CsrSize count); CsrSize CsrStrLen(const CsrCharString *string); #endif /* !CSR_USE_STDC_LIB */ -CsrInt32 CsrVsnprintf(CsrCharString *string, CsrSize count, const CsrCharString *format, va_list args); +s32 CsrVsnprintf(CsrCharString *string, CsrSize count, const CsrCharString *format, va_list args); /*------------------------------------------------------------------*/ /* Non-standard utility functions */ diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.c b/drivers/staging/csr/csr_wifi_hip_card_sdio.c index 0678344..4c31a214 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.c @@ -168,7 +168,7 @@ card_t* unifi_alloc_card(CsrSdioFunction *sdio, void *ospriv) * CSR_RESULT_SUCCESS if successful * --------------------------------------------------------------------------- */ -CsrResult unifi_init_card(card_t *card, CsrInt32 led_mask) +CsrResult unifi_init_card(card_t *card, s32 led_mask) { CsrResult r; @@ -359,7 +359,7 @@ CsrResult unifi_init(card_t *card) * CsrResult error code on failure. * --------------------------------------------------------------------------- */ -CsrResult unifi_download(card_t *card, CsrInt32 led_mask) +CsrResult unifi_download(card_t *card, s32 led_mask) { CsrResult r; void *dlpriv; @@ -1235,7 +1235,7 @@ static CsrResult card_wait_for_unifi_to_disable(card_t *card) */ CsrResult card_wait_for_firmware_to_start(card_t *card, u32 *paddr) { - CsrInt32 i; + s32 i; u16 mbox0, mbox1; CsrResult r; @@ -1403,7 +1403,7 @@ CsrResult unifi_capture_panic(card_t *card) static CsrResult card_access_panic(card_t *card) { u16 data_u16 = 0; - CsrInt32 i; + s32 i; CsrResult r, sr; func_enter(); @@ -2221,7 +2221,7 @@ static void CardCheckDynamicReservation(card_t *card, unifi_TrafficQueue queue) { u16 q_len, active_queues = 0, excess_queue_slots, div_extra_slots, queue_fair_share, reserved_slots = 0, q, excess_need_queues = 0, unmovable_slots = 0; - CsrInt32 i; + s32 i; q_t *sigq; u16 num_data_slots = card->config_data.num_fromhost_data_slots - UNIFI_RESERVED_COMMAND_SLOTS; @@ -2246,11 +2246,11 @@ static void CardCheckDynamicReservation(card_t *card, unifi_TrafficQueue queue) for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) { - if (i != (CsrInt32)queue) + if (i != (s32)queue) { reserved_slots += card->dynamic_slot_data.from_host_reserved_slots[i]; } - if ((i == (CsrInt32)queue) || (card->dynamic_slot_data.from_host_reserved_slots[i] > 0)) + if ((i == (s32)queue) || (card->dynamic_slot_data.from_host_reserved_slots[i] > 0)) { active_queues++; } @@ -4032,7 +4032,7 @@ void unifi_card_info(card_t *card, card_info_t *card_info) * CSR_RESULT_SUCCESS if OK, or CSR error * --------------------------------------------------------------------------- */ -CsrResult unifi_check_io_status(card_t *card, CsrInt32 *status) +CsrResult unifi_check_io_status(card_t *card, s32 *status) { u8 io_en; CsrResult r; @@ -4053,7 +4053,7 @@ CsrResult unifi_check_io_status(card_t *card, CsrInt32 *status) if ((io_en & (1 << card->function)) == 0) { - CsrInt32 fw_count; + s32 fw_count; *status = 1; unifi_error(card->ospriv, "UniFi has spontaneously reset.\n"); @@ -4102,7 +4102,7 @@ CsrResult unifi_check_io_status(card_t *card, CsrInt32 *status) void unifi_get_hip_qos_info(card_t *card, unifi_HipQosInfo *hipqosinfo) { - CsrInt32 count_fhr; + s32 count_fhr; s16 t; u32 occupied_fh; diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.h b/drivers/staging/csr/csr_wifi_hip_card_sdio.h index 42fce7b..036258a 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.h +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.h @@ -431,7 +431,7 @@ struct card * We assume these are connected to LEDs. The main firmware gets * the mask from a MIB entry. */ - CsrInt32 loader_led_mask; + s32 loader_led_mask; /* * Support for flow control. When the from-host queue of signals @@ -490,10 +490,10 @@ struct card * These are the modulo-256 count of signals written to or read from UniFi * The value is incremented for every signal. */ - CsrInt32 from_host_signals_w; - CsrInt32 from_host_signals_r; - CsrInt32 to_host_signals_r; - CsrInt32 to_host_signals_w; + s32 from_host_signals_w; + s32 from_host_signals_r; + s32 to_host_signals_r; + s32 to_host_signals_w; /* Should specify buffer size as a number of signals */ @@ -653,14 +653,14 @@ CsrResult unifi_set_host_state(card_t *card, enum unifi_host_state state); CsrResult unifi_set_proc_select(card_t *card, enum unifi_dbg_processors_select select); -CsrInt32 card_read_signal_counts(card_t *card); +s32 card_read_signal_counts(card_t *card); bulk_data_desc_t* card_find_data_slot(card_t *card, s16 slot); CsrResult unifi_read32(card_t *card, u32 unifi_addr, u32 *pdata); CsrResult unifi_readnz(card_t *card, u32 unifi_addr, void *pdata, u16 len); -CsrInt32 unifi_read_shared_count(card_t *card, u32 addr); +s32 unifi_read_shared_count(card_t *card, u32 addr); CsrResult unifi_writen(card_t *card, u32 unifi_addr, void *pdata, u16 len); diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c index 9c9e907..4cf84d5 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c @@ -47,18 +47,18 @@ static CsrResult handle_host_protocol(card_t *card, CsrBool *processed_something static CsrResult flush_fh_buffer(card_t *card); -static CsrResult check_fh_sig_slots(card_t *card, u16 needed, CsrInt32 *space); +static CsrResult check_fh_sig_slots(card_t *card, u16 needed, s32 *space); -static CsrResult read_to_host_signals(card_t *card, CsrInt32 *processed); -static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed); +static CsrResult read_to_host_signals(card_t *card, s32 *processed); +static CsrResult process_to_host_signals(card_t *card, s32 *processed); static CsrResult process_bulk_data_command(card_t *card, const u8 *cmdptr, s16 cmd, u16 len); static CsrResult process_clear_slot_command(card_t *card, const u8 *cmdptr); -static CsrResult process_fh_cmd_queue(card_t *card, CsrInt32 *processed); -static CsrResult process_fh_traffic_queue(card_t *card, CsrInt32 *processed); +static CsrResult process_fh_cmd_queue(card_t *card, s32 *processed); +static CsrResult process_fh_traffic_queue(card_t *card, s32 *processed); static void restart_packet_flow(card_t *card); static CsrResult process_clock_request(card_t *card); @@ -158,7 +158,7 @@ void unifi_debug_hex_to_buf(const CsrCharString *buff, u16 length) void unifi_debug_buf_dump(void) { - CsrInt32 offset = unifi_dbgbuf_ptr - unifi_debug_output; + s32 offset = unifi_dbgbuf_ptr - unifi_debug_output; unifi_error(NULL, "HIP debug buffer offset=%d\n", offset); dump_str(unifi_debug_output + offset, UNIFI_DEBUG_GBUFFER_SIZE - offset); @@ -359,7 +359,7 @@ CsrResult unifi_bh(card_t *card, u32 *remaining) CsrResult r; CsrResult csrResult; CsrBool pending; - CsrInt32 iostate, j; + s32 iostate, j; const enum unifi_low_power_mode low_power_mode = card->low_power_mode; u16 data_slots_used = 0; @@ -845,7 +845,7 @@ static CsrResult process_bh(card_t *card) static CsrResult handle_host_protocol(card_t *card, CsrBool *processed_something) { CsrResult r; - CsrInt32 done; + s32 done; *processed_something = FALSE; @@ -982,10 +982,10 @@ static CsrResult handle_host_protocol(card_t *card, CsrBool *processed_something * CSR error code if an error occurred. * --------------------------------------------------------------------------- */ -static CsrResult read_to_host_signals(card_t *card, CsrInt32 *processed) +static CsrResult read_to_host_signals(card_t *card, s32 *processed) { - CsrInt32 count_thw, count_thr; - CsrInt32 unread_chunks, unread_bytes; + s32 count_thw, count_thr; + s32 unread_chunks, unread_bytes; CsrResult r; *processed = 0; @@ -1143,7 +1143,7 @@ static void read_unpack_cmd(const u8 *ptr, bulk_data_cmd_t *bulk_data_cmd) * indicate all data, as we have read it from the device. * --------------------------------------------------------------------------- */ -static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed) +static CsrResult process_to_host_signals(card_t *card, s32 *processed) { s16 pending; s16 remaining; @@ -1514,7 +1514,7 @@ static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed) /* Use a safe copy because source and destination may overlap */ u8 *d = card->th_buffer.buf; u8 *s = bufptr; - CsrInt32 n = remaining; + s32 n = remaining; while (n--) { *d++ = *s++; @@ -1839,11 +1839,11 @@ static CsrResult process_bulk_data_command(card_t *card, const u8 *cmdptr, * CSR_RESULT_SUCCESS, otherwise CSR error code on error. * --------------------------------------------------------------------------- */ -static CsrResult check_fh_sig_slots(card_t *card, u16 needed, CsrInt32 *space_fh) +static CsrResult check_fh_sig_slots(card_t *card, u16 needed, s32 *space_fh) { u32 count_fhw; u32 occupied_fh, slots_fh; - CsrInt32 count_fhr; + s32 count_fhr; count_fhw = card->from_host_signals_w; count_fhr = card->from_host_signals_r; @@ -1940,7 +1940,7 @@ static CsrResult check_fh_sig_slots(card_t *card, u16 needed, CsrInt32 *space_fh * structure that describes the queue to make the distiction. * --------------------------------------------------------------------------- */ -static CsrResult process_fh_cmd_queue(card_t *card, CsrInt32 *processed) +static CsrResult process_fh_cmd_queue(card_t *card, s32 *processed) { q_t *sigq = &card->fh_command_queue; @@ -1948,7 +1948,7 @@ static CsrResult process_fh_cmd_queue(card_t *card, CsrInt32 *processed) u16 pending_sigs; u16 pending_chunks; u16 needed_chunks; - CsrInt32 space_chunks; + s32 space_chunks; u16 q_index; *processed = 0; @@ -2168,17 +2168,17 @@ static CsrResult process_fh_cmd_queue(card_t *card, CsrInt32 *processed) * and any UDI clients interspersed. * --------------------------------------------------------------------------- */ -static CsrResult process_fh_traffic_queue(card_t *card, CsrInt32 *processed) +static CsrResult process_fh_traffic_queue(card_t *card, s32 *processed) { q_t *sigq = card->fh_traffic_queue; CsrResult r; s16 n = 0; - CsrInt32 q_no; + s32 q_no; u16 pending_sigs = 0; u16 pending_chunks = 0; u16 needed_chunks; - CsrInt32 space_chunks; + s32 space_chunks; u16 q_index; u32 host_tag = 0; u16 slot_num = 0; diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c index 0454f43..17867f6 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c @@ -603,7 +603,7 @@ static CsrResult unifi_read_directn_match(card_t *card, u32 addr, void *pdata, u addr += 2; } - *num = (CsrInt32)(cptr - (u8 *)pdata); + *num = (s32)(cptr - (u8 *)pdata); return CSR_RESULT_SUCCESS; } @@ -747,7 +747,7 @@ static CsrResult set_dmem_page(card_t *card, u32 dmem_addr, u32 *paddr) card->dmem_page = page; } - *paddr = ((CsrInt32)addr * 2) + (dmem_addr & 1); + *paddr = ((s32)addr * 2) + (dmem_addr & 1); return CSR_RESULT_SUCCESS; } /* set_dmem_page() */ @@ -787,7 +787,7 @@ static CsrResult set_pmem_page(card_t *card, u32 pmem_addr, card->pmem_page = page; } - *paddr = ((CsrInt32)addr * 2) + (pmem_addr & 1); + *paddr = ((s32)addr * 2) + (pmem_addr & 1); return CSR_RESULT_SUCCESS; } /* set_pmem_page() */ @@ -816,7 +816,7 @@ static CsrResult set_pmem_page(card_t *card, u32 pmem_addr, */ static CsrResult set_page(card_t *card, u32 generic_addr, u32 *paddr) { - CsrInt32 space; + s32 space; u32 addr; CsrResult r = CSR_RESULT_SUCCESS; @@ -1323,7 +1323,7 @@ CsrResult unifi_readnz(card_t *card, u32 unifi_addr, void *pdata, u16 len) * Value read from memory (0-127) or -1 on error * --------------------------------------------------------------------------- */ -CsrInt32 unifi_read_shared_count(card_t *card, u32 addr) +s32 unifi_read_shared_count(card_t *card, u32 addr) { u8 b; /* I've increased this count, because I have seen cases where @@ -1332,7 +1332,7 @@ CsrInt32 unifi_read_shared_count(card_t *card, u32 addr) * with increasing this limit. It's better to take a while to * recover than to fail. */ #define SHARED_READ_RETRY_LIMIT 10 - CsrInt32 i; + s32 i; /* * Get the to-host-signals-written count. @@ -1355,7 +1355,7 @@ CsrInt32 unifi_read_shared_count(card_t *card, u32 addr) * This avoids a race between driver read and firmware write of the * word, the value we need is in the lower 8 bits anway. */ - return (CsrInt32)(b & 0xff); + return (s32)(b & 0xff); } } diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper.c b/drivers/staging/csr/csr_wifi_hip_chiphelper.c index 4e8cc3f..1654d28 100644 --- a/drivers/staging/csr/csr_wifi_hip_chiphelper.c +++ b/drivers/staging/csr/csr_wifi_hip_chiphelper.c @@ -743,7 +743,7 @@ u32 ChipHelper_HostResetSequence(ChipDescript *chip_he /* Decode a windowed access to the chip. */ -CsrInt32 ChipHelper_DecodeWindow(ChipDescript *chip_help, +s32 ChipHelper_DecodeWindow(ChipDescript *chip_help, enum chip_helper_window_index window, enum chip_helper_window_type type, u32 offset, diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper.h b/drivers/staging/csr/csr_wifi_hip_chiphelper.h index 11cff4e..dbf7c0e 100644 --- a/drivers/staging/csr/csr_wifi_hip_chiphelper.h +++ b/drivers/staging/csr/csr_wifi_hip_chiphelper.h @@ -235,11 +235,11 @@ ChipDescript* ChipHelper_GetVersionBlueCore(enum chip_helper_bluecore_age age, CHIP_HELPER_DEF0(m, (u32, PROGRAM_MEMORY_FLASH_OFFSET, prog_offset.flash)) \ CHIP_HELPER_DEF0(m, (u32, PROGRAM_MEMORY_EXT_SRAM_OFFSET, prog_offset.ext_sram)) \ CHIP_HELPER_DEF0(m, (u16, DATA_MEMORY_RAM_OFFSET, data_offset.ram)) \ - CHIP_HELPER_DEF0(m, (CsrInt32, HasFlash, bools.has_flash)) \ - CHIP_HELPER_DEF0(m, (CsrInt32, HasExtSram, bools.has_ext_sram)) \ - CHIP_HELPER_DEF0(m, (CsrInt32, HasRom, bools.has_rom)) \ - CHIP_HELPER_DEF0(m, (CsrInt32, HasBt, bools.has_bt)) \ - CHIP_HELPER_DEF0(m, (CsrInt32, HasWLan, bools.has_wlan)) \ + CHIP_HELPER_DEF0(m, (s32, HasFlash, bools.has_flash)) \ + CHIP_HELPER_DEF0(m, (s32, HasExtSram, bools.has_ext_sram)) \ + CHIP_HELPER_DEF0(m, (s32, HasRom, bools.has_rom)) \ + CHIP_HELPER_DEF0(m, (s32, HasBt, bools.has_bt)) \ + CHIP_HELPER_DEF0(m, (s32, HasWLan, bools.has_wlan)) \ CHIP_HELPER_DEF1(m, (u16, WINDOW_ADDRESS, enum chip_helper_window_index, window)) \ CHIP_HELPER_DEF1(m, (u16, WINDOW_SIZE, enum chip_helper_window_index, window)) \ CHIP_HELPER_DEF1(m, (u16, MapAddress_SPI2HOST, u16, addr)) \ @@ -402,7 +402,7 @@ CHIP_HELPER_LIST(C_DEC) address in the XAPs 16 address map to read from. 'len' is the length that we can read without having to change the page registers. */ -CsrInt32 ChipHelper_DecodeWindow(ChipDescript *chip_help, +s32 ChipHelper_DecodeWindow(ChipDescript *chip_help, enum chip_helper_window_index window, enum chip_helper_window_type type, u32 offset, @@ -457,7 +457,7 @@ public: /* The DecodeWindow function, see the description of the C version. */ - CsrInt32 DecodeWindow(chip_helper_window_index window, + s32 DecodeWindow(chip_helper_window_index window, chip_helper_window_type type, u32 offset, u16 &page, u16 &addr, u32 &len) const; diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h b/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h index de6e063..93e30b6 100644 --- a/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h +++ b/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h @@ -117,7 +117,7 @@ struct chip_device_regs_t written to the page register. */ struct window_shift_info_t { - CsrInt32 allowed; + s32 allowed; u32 page_shift; u16 page_offset; }; @@ -140,7 +140,7 @@ struct window_info_t address of GBL_CHIP_VERSION is FF9A, else its FE81. */ struct chip_version_t { - CsrInt32 pre_bc7; + s32 pre_bc7; u16 mask; u16 result; u8 sdio; diff --git a/drivers/staging/csr/csr_wifi_hip_conversions.h b/drivers/staging/csr/csr_wifi_hip_conversions.h index 58a2d72..7d045c0 100644 --- a/drivers/staging/csr/csr_wifi_hip_conversions.h +++ b/drivers/staging/csr/csr_wifi_hip_conversions.h @@ -69,7 +69,7 @@ extern "C" { CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 2)) -CsrInt32 get_packed_struct_size(const u8 *buf); +s32 get_packed_struct_size(const u8 *buf); CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig); CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len); diff --git a/drivers/staging/csr/csr_wifi_hip_download.c b/drivers/staging/csr/csr_wifi_hip_download.c index e90faf3..a9d0c39 100644 --- a/drivers/staging/csr/csr_wifi_hip_download.c +++ b/drivers/staging/csr/csr_wifi_hip_download.c @@ -659,7 +659,7 @@ static CsrResult send_ptdl_to_unifi(card_t *card, void *dlpriv, { u32 offset; u8 *buf; - CsrInt32 data_len; + s32 data_len; u32 write_len; CsrResult r; const u16 buf_size = 2 * 1024; @@ -756,7 +756,7 @@ static CsrResult send_ptdl_to_unifi(card_t *card, void *dlpriv, static CsrResult do_patch_download(card_t *card, void *dlpriv, xbv1_t *pfwinfo, u32 boot_ctrl_addr) { CsrResult r; - CsrInt32 i; + s32 i; u16 loader_version; u16 handle; u32 total_bytes; diff --git a/drivers/staging/csr/csr_wifi_hip_dump.c b/drivers/staging/csr/csr_wifi_hip_dump.c index 2f70a6c..3dee997 100644 --- a/drivers/staging/csr/csr_wifi_hip_dump.c +++ b/drivers/staging/csr/csr_wifi_hip_dump.c @@ -63,7 +63,7 @@ static CsrResult unifi_coredump_from_sdio(card_t *card, coredump_buffer *dump_bu static CsrResult unifi_coredump_read_zones(card_t *card, coredump_buffer *dump_buf); static CsrResult unifi_coredump_read_zone(card_t *card, u16 *zone, const struct coredump_zone *def); -static CsrInt32 get_value_from_coredump(const coredump_buffer *dump, +static s32 get_value_from_coredump(const coredump_buffer *dump, const unifi_coredump_space_t space, const u16 offset); /* Table of chip memory zones we capture on mini-coredump */ @@ -293,14 +293,14 @@ done: * Notes: * --------------------------------------------------------------------------- */ -static CsrInt32 get_value_from_coredump(const coredump_buffer *coreDump, +static s32 get_value_from_coredump(const coredump_buffer *coreDump, const unifi_coredump_space_t space, const u16 offset_in_space) { - CsrInt32 r = -1; + s32 r = -1; u16 offset_in_zone; u32 zone_end_offset; - CsrInt32 i; + s32 i; const struct coredump_zone *def = &zonedef_table[0]; /* Search zone def table for a match with the requested memory space */ @@ -316,7 +316,7 @@ static CsrInt32 get_value_from_coredump(const coredump_buffer *coreDump, { /* Calculate the offset of data within the zone buffer */ offset_in_zone = offset_in_space - def->offset; - r = (CsrInt32) * (coreDump->zone[i] + offset_in_zone); + r = (s32) * (coreDump->zone[i] + offset_in_zone); unifi_trace(NULL, UDBG6, "sp %d, offs 0x%04x = 0x%04x (in z%d 0x%04x->0x%04x)\n", @@ -354,7 +354,7 @@ static CsrInt32 get_value_from_coredump(const coredump_buffer *coreDump, CsrResult unifi_coredump_get_value(card_t *card, struct unifi_coredump_req *req) { CsrResult r; - CsrInt32 i = 0; + s32 i = 0; coredump_buffer *find_dump = NULL; func_enter(); @@ -548,7 +548,7 @@ done: static CsrResult unifi_coredump_read_zones(card_t *card, coredump_buffer *dump_buf) { CsrResult r = CSR_RESULT_SUCCESS; - CsrInt32 i; + s32 i; func_enter(); @@ -662,7 +662,7 @@ coredump_buffer* new_coredump_node(void *ospriv, coredump_buffer *prevnode) { coredump_buffer *newnode = NULL; u16 *newzone = NULL; - CsrInt32 i; + s32 i; u32 zone_size; /* Allocate node header */ diff --git a/drivers/staging/csr/csr_wifi_hip_packing.c b/drivers/staging/csr/csr_wifi_hip_packing.c index f3a192d..c01bb13 100644 --- a/drivers/staging/csr/csr_wifi_hip_packing.c +++ b/drivers/staging/csr/csr_wifi_hip_packing.c @@ -35,9 +35,9 @@ * This is useful for stepping past the signal to the object in the buffer. * --------------------------------------------------------------------------- */ -CsrInt32 get_packed_struct_size(const u8 *buf) +s32 get_packed_struct_size(const u8 *buf) { - CsrInt32 size = 0; + s32 size = 0; u16 sig_id; sig_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(buf); @@ -1150,7 +1150,7 @@ CsrInt32 get_packed_struct_size(const u8 *buf) */ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) { - CsrInt32 index = 0; + s32 index = 0; sig->SignalPrimitiveHeader.SignalId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; diff --git a/drivers/staging/csr/csr_wifi_hip_signals.c b/drivers/staging/csr/csr_wifi_hip_signals.c index 43d9b8e..d3dc9bd 100644 --- a/drivers/staging/csr/csr_wifi_hip_signals.c +++ b/drivers/staging/csr/csr_wifi_hip_signals.c @@ -17,7 +17,7 @@ #include "csr_wifi_hip_unifi.h" -CsrInt32 SigGetSize(const CSR_SIGNAL *aSignal) +s32 SigGetSize(const CSR_SIGNAL *aSignal) { switch (aSignal->SignalPrimitiveHeader.SignalId) { @@ -383,9 +383,9 @@ CsrInt32 SigGetSize(const CSR_SIGNAL *aSignal) } -CsrInt32 SigGetDataRefs(CSR_SIGNAL *aSignal, CSR_DATAREF **aDataRef) +s32 SigGetDataRefs(CSR_SIGNAL *aSignal, CSR_DATAREF **aDataRef) { - CsrInt32 numRefs = 0; + s32 numRefs = 0; switch (aSignal->SignalPrimitiveHeader.SignalId) { diff --git a/drivers/staging/csr/csr_wifi_hip_signals.h b/drivers/staging/csr/csr_wifi_hip_signals.h index c48fddd..29c9a7c 100644 --- a/drivers/staging/csr/csr_wifi_hip_signals.h +++ b/drivers/staging/csr/csr_wifi_hip_signals.h @@ -116,7 +116,7 @@ extern "C" { * RETURNS: * The number of data-refs in the signal. */ -CsrInt32 SigGetDataRefs(CSR_SIGNAL *aSignal, CSR_DATAREF **aDataRef); +s32 SigGetDataRefs(CSR_SIGNAL *aSignal, CSR_DATAREF **aDataRef); /****************************************************************************** * SigGetSize - Retrieve the size (in bytes) of a given signal. @@ -127,7 +127,7 @@ CsrInt32 SigGetDataRefs(CSR_SIGNAL *aSignal, CSR_DATAREF **aDataRef); * RETURNS: * The size (in bytes) of the given signal. */ -CsrInt32 SigGetSize(const CSR_SIGNAL *aSignal); +s32 SigGetSize(const CSR_SIGNAL *aSignal); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_wifi_hip_udi.c b/drivers/staging/csr/csr_wifi_hip_udi.c index 72deb2f..0ea60f5 100644 --- a/drivers/staging/csr/csr_wifi_hip_udi.c +++ b/drivers/staging/csr/csr_wifi_hip_udi.c @@ -41,15 +41,15 @@ * None. * --------------------------------------------------------------------------- */ -CsrInt32 unifi_print_status(card_t *card, CsrCharString *str, CsrInt32 *remain) +s32 unifi_print_status(card_t *card, CsrCharString *str, s32 *remain) { CsrCharString *p = str; sdio_config_data_t *cfg; u16 i, n; - CsrInt32 remaining = *remain; - CsrInt32 written; + s32 remaining = *remain; + s32 written; #ifdef CSR_UNSAFE_SDIO_ACCESS - CsrInt32 iostate; + s32 iostate; CsrResult r; static const CsrCharString *const states[] = { "AWAKE", "DROWSY", "TORPID" diff --git a/drivers/staging/csr/csr_wifi_hip_unifi.h b/drivers/staging/csr/csr_wifi_hip_unifi.h index 6f2090e..892686f 100644 --- a/drivers/staging/csr/csr_wifi_hip_unifi.h +++ b/drivers/staging/csr/csr_wifi_hip_unifi.h @@ -223,17 +223,17 @@ typedef enum unifi_coredump_space typedef struct unifi_coredump_req { /* From user */ - CsrInt32 index; /* 0=newest, -1=oldest */ + s32 index; /* 0=newest, -1=oldest */ unifi_coredump_space_t space; /* memory space */ u32 offset; /* register offset in space */ /* From driver */ u32 drv_build; /* Driver build id */ u32 chip_ver; /* Chip version */ u32 fw_ver; /* Firmware version */ - CsrInt32 requestor; /* Requestor: 0=auto dump, 1=manual */ + s32 requestor; /* Requestor: 0=auto dump, 1=manual */ CsrTime timestamp; /* time of capture by driver */ u32 serial; /* capture serial number */ - CsrInt32 value; /* register value */ + s32 value; /* register value */ } unifi_coredump_req_t; /* mini-coredumped reg value request */ @@ -276,7 +276,7 @@ card_t* unifi_alloc_card(CsrSdioFunction *sdiopriv, void *ospriv); * * @ingroup upperedge */ -CsrResult unifi_init_card(card_t *card, CsrInt32 led_mask); +CsrResult unifi_init_card(card_t *card, s32 led_mask); /** * @@ -374,7 +374,7 @@ void unifi_card_info(card_t *card, card_info_t *card_info); * * @ingroup upperedge */ -CsrResult unifi_check_io_status(card_t *card, CsrInt32 *status); +CsrResult unifi_check_io_status(card_t *card, s32 *status); /** @@ -719,7 +719,7 @@ void* unifi_fw_read_start(void *ospriv, s8 is_fw, const card_info_t *info); * * @ingroup upperedge */ -CsrInt32 unifi_fw_read(void *ospriv, void *arg, u32 offset, void *buf, u32 len); +s32 unifi_fw_read(void *ospriv, void *arg, u32 offset, void *buf, u32 len); /** * @@ -834,7 +834,7 @@ void unifi_sdio_interrupt_handler(card_t *card); * that excludes HIP initialization. */ CsrResult unifi_init(card_t *card); -CsrResult unifi_download(card_t *card, CsrInt32 led_mask); +CsrResult unifi_download(card_t *card, s32 led_mask); /* * unifi_start_processors() ensures both on-chip processors are running diff --git a/drivers/staging/csr/csr_wifi_hip_unifi_udi.h b/drivers/staging/csr/csr_wifi_hip_unifi_udi.h index 774bdc9..79f0810 100644 --- a/drivers/staging/csr/csr_wifi_hip_unifi_udi.h +++ b/drivers/staging/csr/csr_wifi_hip_unifi_udi.h @@ -51,7 +51,7 @@ CsrResult unifi_remove_udi_hook(card_t *card, udi_func_t udi_fn); * This is used in the linux /proc interface and might be useful * in other systems. */ -CsrInt32 unifi_print_status(card_t *card, CsrCharString *str, CsrInt32 *remain); +s32 unifi_print_status(card_t *card, CsrCharString *str, s32 *remain); #define UNIFI_SNPRINTF_RET(buf_p, remain, written) \ do { \ diff --git a/drivers/staging/csr/csr_wifi_hip_xbv.c b/drivers/staging/csr/csr_wifi_hip_xbv.c index 3d559af..1e50429 100644 --- a/drivers/staging/csr/csr_wifi_hip_xbv.c +++ b/drivers/staging/csr/csr_wifi_hip_xbv.c @@ -45,7 +45,7 @@ typedef struct { void *dlpriv; - CsrInt32 ioffset; + s32 ioffset; fwreadfn_t iread; } ct_t; @@ -84,17 +84,17 @@ typedef struct struct { xbv_container container; - CsrInt32 ioffset_end; + s32 ioffset_end; } s[XBV_STACK_SIZE]; u32 ptr; } xbv_stack_t; -static CsrInt32 read_tag(card_t *card, ct_t *ct, tag_t *tag); -static CsrInt32 read_bytes(card_t *card, ct_t *ct, void *buf, u32 len); -static CsrInt32 read_uint(card_t *card, ct_t *ct, u32 *u, u32 len); -static CsrInt32 xbv_check(xbv1_t *fwinfo, const xbv_stack_t *stack, +static s32 read_tag(card_t *card, ct_t *ct, tag_t *tag); +static s32 read_bytes(card_t *card, ct_t *ct, void *buf, u32 len); +static s32 read_uint(card_t *card, ct_t *ct, u32 *u, u32 len); +static s32 xbv_check(xbv1_t *fwinfo, const xbv_stack_t *stack, xbv_mode new_mode, xbv_container old_cont); -static CsrInt32 xbv_push(xbv1_t *fwinfo, xbv_stack_t *stack, +static s32 xbv_push(xbv1_t *fwinfo, xbv_stack_t *stack, xbv_mode new_mode, xbv_container old_cont, xbv_container new_cont, u32 ioff); @@ -191,7 +191,7 @@ CsrResult xbv1_parse(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwin /* Now scan the file */ while (1) { - CsrInt32 n; + s32 n; n = read_tag(card, &ct, &tag); if (n < 0) @@ -437,7 +437,7 @@ CsrResult xbv1_parse(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwin /* Check the the XBV file is of a consistant sort (either firmware or * patch) and that we are in the correct containing list type. */ -static CsrInt32 xbv_check(xbv1_t *fwinfo, const xbv_stack_t *stack, +static s32 xbv_check(xbv1_t *fwinfo, const xbv_stack_t *stack, xbv_mode new_mode, xbv_container old_cont) { /* If the new file mode is unknown the current packet could be in @@ -465,7 +465,7 @@ static CsrInt32 xbv_check(xbv1_t *fwinfo, const xbv_stack_t *stack, /* Make checks as above and then enter a new list */ -static CsrInt32 xbv_push(xbv1_t *fwinfo, xbv_stack_t *stack, +static s32 xbv_push(xbv1_t *fwinfo, xbv_stack_t *stack, xbv_mode new_mode, xbv_container old_cont, xbv_container new_cont, u32 new_ioff) { @@ -489,7 +489,7 @@ static CsrInt32 xbv_push(xbv1_t *fwinfo, xbv_stack_t *stack, } -static u32 xbv2uint(u8 *ptr, CsrInt32 len) +static u32 xbv2uint(u8 *ptr, s32 len) { u32 u = 0; s16 i; @@ -504,10 +504,10 @@ static u32 xbv2uint(u8 *ptr, CsrInt32 len) } -static CsrInt32 read_tag(card_t *card, ct_t *ct, tag_t *tag) +static s32 read_tag(card_t *card, ct_t *ct, tag_t *tag) { u8 buf[8]; - CsrInt32 n; + s32 n; n = (*ct->iread)(card->ospriv, ct->dlpriv, ct->ioffset, buf, 8); if (n <= 0) @@ -533,10 +533,10 @@ static CsrInt32 read_tag(card_t *card, ct_t *ct, tag_t *tag) } /* read_tag() */ -static CsrInt32 read_bytes(card_t *card, ct_t *ct, void *buf, u32 len) +static s32 read_bytes(card_t *card, ct_t *ct, void *buf, u32 len) { /* read the tag value */ - if ((*ct->iread)(card->ospriv, ct->dlpriv, ct->ioffset, buf, len) != (CsrInt32)len) + if ((*ct->iread)(card->ospriv, ct->dlpriv, ct->ioffset, buf, len) != (s32)len) { return -1; } @@ -547,7 +547,7 @@ static CsrInt32 read_bytes(card_t *card, ct_t *ct, void *buf, u32 len) } /* read_bytes() */ -static CsrInt32 read_uint(card_t *card, ct_t *ct, u32 *u, u32 len) +static s32 read_uint(card_t *card, ct_t *ct, u32 *u, u32 len) { u8 buf[4]; @@ -870,11 +870,11 @@ static u32 write_reset_ptdl(void *buf, const u32 offset, const xbv1_t *fwinfo, u * Number of SLUT entries in the f/w, or -1 if the image was corrupt. * --------------------------------------------------------------------------- */ -CsrInt32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo, +s32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo, symbol_t *slut, u32 slut_len) { s16 i; - CsrInt32 offset; + s32 offset; u32 magic; u32 count = 0; ct_t ct; diff --git a/drivers/staging/csr/csr_wifi_hip_xbv.h b/drivers/staging/csr/csr_wifi_hip_xbv.h index 3e3771e..9b60a7e 100644 --- a/drivers/staging/csr/csr_wifi_hip_xbv.h +++ b/drivers/staging/csr/csr_wifi_hip_xbv.h @@ -112,10 +112,10 @@ typedef struct } xbv1_t; -typedef CsrInt32 (*fwreadfn_t)(void *ospriv, void *dlpriv, u32 offset, void *buf, u32 len); +typedef s32 (*fwreadfn_t)(void *ospriv, void *dlpriv, u32 offset, void *buf, u32 len); CsrResult xbv1_parse(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo); -CsrInt32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo, +s32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo, symbol_t *slut, u32 slut_len); void* xbv_to_patch(card_t *card, fwreadfn_t readfn, const void *fw_buf, const xbv1_t *fwinfo, u32 *size); diff --git a/drivers/staging/csr/drv.c b/drivers/staging/csr/drv.c index c5beb22..36d9d53 100644 --- a/drivers/staging/csr/drv.c +++ b/drivers/staging/csr/drv.c @@ -130,9 +130,9 @@ DEFINE_SEMAPHORE(udi_mutex); DECLARE_MUTEX(udi_mutex); #endif -CsrInt32 CsrHipResultToStatus(CsrResult csrResult) +s32 CsrHipResultToStatus(CsrResult csrResult) { - CsrInt32 r = -EIO; + s32 r = -EIO; switch (csrResult) { diff --git a/drivers/staging/csr/firmware.c b/drivers/staging/csr/firmware.c index b871654..b994d14 100644 --- a/drivers/staging/csr/firmware.c +++ b/drivers/staging/csr/firmware.c @@ -196,7 +196,7 @@ void unifi_fw_close_buffer(void *ospriv, void *fwbuf) * The number of bytes read from the firmware image, or -ve on error * --------------------------------------------------------------------------- */ -CsrInt32 +s32 unifi_fw_read(void *ospriv, void *arg, u32 offset, void *buf, u32 len) { const struct dlpriv *dlpriv = arg; diff --git a/drivers/staging/csr/io.c b/drivers/staging/csr/io.c index d089579..65b8895 100644 --- a/drivers/staging/csr/io.c +++ b/drivers/staging/csr/io.c @@ -887,8 +887,8 @@ uf_read_proc(char *page, char **start, off_t offset, int count, unifi_priv_t *priv; int actual_amount_to_copy; char *p, *orig_p; - CsrInt32 remain = UNIFI_DEBUG_TXT_BUFFER; - CsrInt32 written; + s32 remain = UNIFI_DEBUG_TXT_BUFFER; + s32 written; int i; /* diff --git a/drivers/staging/csr/putest.c b/drivers/staging/csr/putest.c index 9c9dc60..96597ac 100644 --- a/drivers/staging/csr/putest.c +++ b/drivers/staging/csr/putest.c @@ -546,7 +546,7 @@ free_fw: int unifi_putest_coredump_prepare(unifi_priv_t *priv, unsigned char *arg) { u16 data_u16; - CsrInt32 i; + s32 i; CsrResult r; unifi_info(priv, "Preparing for SDIO coredump\n"); diff --git a/drivers/staging/csr/sme_native.c b/drivers/staging/csr/sme_native.c index f22b804..229268f 100644 --- a/drivers/staging/csr/sme_native.c +++ b/drivers/staging/csr/sme_native.c @@ -71,7 +71,7 @@ uf_sme_deinit(unifi_priv_t *priv) int sme_mgt_wifi_on(unifi_priv_t *priv) { int r,i; - CsrInt32 csrResult; + s32 csrResult; if (priv == NULL) { return -EINVAL; diff --git a/drivers/staging/csr/unifi_pdu_processing.c b/drivers/staging/csr/unifi_pdu_processing.c index 7c5fb45..d1afa3a 100644 --- a/drivers/staging/csr/unifi_pdu_processing.c +++ b/drivers/staging/csr/unifi_pdu_processing.c @@ -862,7 +862,7 @@ void uf_handle_tim_cfm(unifi_priv_t *priv, CSR_MLME_SET_TIM_CONFIRM *cfm, u16 re void update_tim(unifi_priv_t * priv, u16 aid, u8 setTim, u16 interfaceTag, u32 handle) { CSR_SIGNAL signal; - CsrInt32 r; + s32 r; CSR_MLME_SET_TIM_REQUEST *req = &signal.u.MlmeSetTimRequest; bulk_data_param_t *bulkdata = NULL; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; diff --git a/drivers/staging/csr/unifi_priv.h b/drivers/staging/csr/unifi_priv.h index 2e05015..2f8f031 100644 --- a/drivers/staging/csr/unifi_priv.h +++ b/drivers/staging/csr/unifi_priv.h @@ -818,7 +818,7 @@ typedef struct netInterface_priv #define UNLOCK_DRIVER(_p) (void)(_p); /* as nothing */ #endif /* USE_DRIVER_LOCK */ -CsrInt32 CsrHipResultToStatus(CsrResult csrResult); +s32 CsrHipResultToStatus(CsrResult csrResult); /* -- cgit v0.10.2 From 9d25edfca7db9404d821c4558e06a2bb98981240 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 12:14:51 -0700 Subject: staging: csr: remove CsrUint24 typedef MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the in-kernel u32 type instead. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_macro.h b/drivers/staging/csr/csr_macro.h index 92cdb8d..214d6a3 100644 --- a/drivers/staging/csr/csr_macro.h +++ b/drivers/staging/csr/csr_macro.h @@ -41,8 +41,8 @@ extern "C" { ((u8 *) (ptr))[2] = ((u8) (((uint) >> 16) & 0x000000FF)); \ ((u8 *) (ptr))[3] = ((u8) (((uint) >> 24) & 0x000000FF)) #define CSR_GET_UINT16_FROM_BIG_ENDIAN(ptr) (((u16) ((u8 *) (ptr))[1]) | ((u16) ((u8 *) (ptr))[0]) << 8) -#define CSR_GET_UINT24_FROM_BIG_ENDIAN(ptr) (((CsrUint24) ((u8 *) (ptr))[2]) | \ - ((CsrUint24) ((u8 *) (ptr))[1]) << 8 | ((CsrUint24) ((u8 *) (ptr))[0]) << 16) +#define CSR_GET_UINT24_FROM_BIG_ENDIAN(ptr) (((u32) ((u8 *) (ptr))[2]) | \ + ((u32) ((u8 *) (ptr))[1]) << 8 | ((u32) ((u8 *) (ptr))[0]) << 16) #define CSR_GET_UINT32_FROM_BIG_ENDIAN(ptr) (((u32) ((u8 *) (ptr))[3]) | ((u32) ((u8 *) (ptr))[2]) << 8 | \ ((u32) ((u8 *) (ptr))[1]) << 16 | ((u32) ((u8 *) (ptr))[0]) << 24) #define CSR_COPY_UINT16_TO_BIG_ENDIAN(uint, ptr) ((u8 *) (ptr))[1] = ((u8) ((uint) & 0x00FF)); \ diff --git a/drivers/staging/csr/csr_types.h b/drivers/staging/csr/csr_types.h index deaecb6..659343b 100644 --- a/drivers/staging/csr/csr_types.h +++ b/drivers/staging/csr/csr_types.h @@ -39,7 +39,6 @@ typedef u8 CsrBool; typedef char CsrCharString; typedef u8 CsrUtf8String; typedef u16 CsrUtf16String; /* 16-bit UTF16 strings */ -typedef u32 CsrUint24; /* * 64-bit integers diff --git a/drivers/staging/csr/csr_wifi_hip_sigs.h b/drivers/staging/csr/csr_wifi_hip_sigs.h index a483179..2b9f51d 100644 --- a/drivers/staging/csr/csr_wifi_hip_sigs.h +++ b/drivers/staging/csr/csr_wifi_hip_sigs.h @@ -429,7 +429,7 @@ typedef u16 CSR_DIALOG_TOKEN; typedef struct CSR_GENERIC_POINTER { - CsrUint24 MemoryOffset; + u32 MemoryOffset; CSR_MEMORY_SPACE MemorySpace; } CSR_GENERIC_POINTER; -- cgit v0.10.2 From f58bfd88be490c0f9e25d980abe1976ceef00647 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 12:17:59 -0700 Subject: staging: csr: remove CsrUtf16String typedef MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the in-kernel u16 type instead. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_msgconv.h b/drivers/staging/csr/csr_msgconv.h index 0f614bc..a43a4a6 100644 --- a/drivers/staging/csr/csr_msgconv.h +++ b/drivers/staging/csr/csr_msgconv.h @@ -75,7 +75,7 @@ void CsrMsgConvDeinit(void); u32 CsrCharStringSerLen(const CsrCharString *str); u32 CsrUtf8StringSerLen(const CsrUtf8String *str); -u32 CsrUtf16StringSerLen(const CsrUtf16String *str); +u32 CsrUtf16StringSerLen(const u16 *str); /* Prototypes for primitive type serializers */ void CsrUint8Ser(u8 *buffer, CsrSize *offset, u8 value); @@ -84,7 +84,7 @@ void CsrUint32Ser(u8 *buffer, CsrSize *offset, u32 value); void CsrMemCpySer(u8 *buffer, CsrSize *offset, const void *value, CsrSize length); void CsrCharStringSer(u8 *buffer, CsrSize *offset, const CsrCharString *value); void CsrUtf8StringSer(u8 *buffer, CsrSize *offset, const CsrUtf8String *value); -void CsrUtf16StringSer(u8 *buffer, CsrSize *offset, const CsrUtf16String *value); +void CsrUtf16StringSer(u8 *buffer, CsrSize *offset, const u16 *value); void CsrVoidPtrSer(u8 *buffer, CsrSize *offset, void *ptr); void CsrSizeSer(u8 *buffer, CsrSize *offset, CsrSize value); @@ -94,7 +94,7 @@ void CsrUint32Des(u32 *value, u8 *buffer, CsrSize *offset); void CsrMemCpyDes(void *value, u8 *buffer, CsrSize *offset, CsrSize length); void CsrCharStringDes(CsrCharString **value, u8 *buffer, CsrSize *offset); void CsrUtf8StringDes(CsrUtf8String **value, u8 *buffer, CsrSize *offset); -void CsrUtf16StringDes(CsrUtf16String **value, u8 *buffer, CsrSize *offset); +void CsrUtf16StringDes(u16 **value, u8 *buffer, CsrSize *offset); void CsrVoidPtrDes(void **value, u8 *buffer, CsrSize *offset); void CsrSizeDes(CsrSize *value, u8 *buffer, CsrSize *offset); diff --git a/drivers/staging/csr/csr_serialize_primitive_types.c b/drivers/staging/csr/csr_serialize_primitive_types.c index a96dcb7..f0b9e84 100644 --- a/drivers/staging/csr/csr_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_serialize_primitive_types.c @@ -61,7 +61,7 @@ void CsrUtf8StringDes(CsrUtf8String **value, u8 *buffer, CsrSize *offset) *offset += CsrStrLen((CsrCharString *) *value) + 1; } -void CsrUtf16StringDes(CsrUtf16String **value, u8 *buffer, CsrSize *offset) +void CsrUtf16StringDes(u16 **value, u8 *buffer, CsrSize *offset) { u32 length, i; @@ -139,7 +139,7 @@ void CsrUtf8StringSer(u8 *buffer, CsrSize *offset, const CsrUtf8String *value) CsrCharStringSer(buffer, offset, (CsrCharString *) value); } -void CsrUtf16StringSer(u8 *buffer, CsrSize *offset, const CsrUtf16String *value) +void CsrUtf16StringSer(u8 *buffer, CsrSize *offset, const u16 *value) { if (value) { @@ -197,7 +197,7 @@ u32 CsrUtf8StringSerLen(const CsrUtf8String *str) } } -u32 CsrUtf16StringSerLen(const CsrUtf16String *str) +u32 CsrUtf16StringSerLen(const u16 *str) { if (str) { diff --git a/drivers/staging/csr/csr_types.h b/drivers/staging/csr/csr_types.h index 659343b..054e5c9 100644 --- a/drivers/staging/csr/csr_types.h +++ b/drivers/staging/csr/csr_types.h @@ -38,7 +38,6 @@ typedef u8 CsrBool; /* String types */ typedef char CsrCharString; typedef u8 CsrUtf8String; -typedef u16 CsrUtf16String; /* 16-bit UTF16 strings */ /* * 64-bit integers diff --git a/drivers/staging/csr/csr_unicode.h b/drivers/staging/csr/csr_unicode.h index 47ade65..6d2fc63 100644 --- a/drivers/staging/csr/csr_unicode.h +++ b/drivers/staging/csr/csr_unicode.h @@ -16,27 +16,27 @@ extern "C" { #endif -CsrUtf16String *CsrUint32ToUtf16String(u32 number); +u16 *CsrUint32ToUtf16String(u32 number); -u32 CsrUtf16StringToUint32(const CsrUtf16String *unicodeString); -u32 CsrUtf16StrLen(const CsrUtf16String *unicodeString); +u32 CsrUtf16StringToUint32(const u16 *unicodeString); +u32 CsrUtf16StrLen(const u16 *unicodeString); -CsrUtf8String *CsrUtf16String2Utf8(const CsrUtf16String *source); +CsrUtf8String *CsrUtf16String2Utf8(const u16 *source); -CsrUtf16String *CsrUtf82Utf16String(const CsrUtf8String *utf8String); +u16 *CsrUtf82Utf16String(const CsrUtf8String *utf8String); -CsrUtf16String *CsrUtf16StrCpy(CsrUtf16String *target, const CsrUtf16String *source); -CsrUtf16String *CsrUtf16StringDuplicate(const CsrUtf16String *source); +u16 *CsrUtf16StrCpy(u16 *target, const u16 *source); +u16 *CsrUtf16StringDuplicate(const u16 *source); -u16 CsrUtf16StrICmp(const CsrUtf16String *string1, const CsrUtf16String *string2); -u16 CsrUtf16StrNICmp(const CsrUtf16String *string1, const CsrUtf16String *string2, u32 count); +u16 CsrUtf16StrICmp(const u16 *string1, const u16 *string2); +u16 CsrUtf16StrNICmp(const u16 *string1, const u16 *string2, u32 count); -CsrUtf16String *CsrUtf16MemCpy(CsrUtf16String *dest, const CsrUtf16String *src, u32 count); -CsrUtf16String *CsrUtf16ConcatenateTexts(const CsrUtf16String *inputText1, const CsrUtf16String *inputText2, - const CsrUtf16String *inputText3, const CsrUtf16String *inputText4); +u16 *CsrUtf16MemCpy(u16 *dest, const u16 *src, u32 count); +u16 *CsrUtf16ConcatenateTexts(const u16 *inputText1, const u16 *inputText2, + const u16 *inputText3, const u16 *inputText4); -CsrUtf16String *CsrUtf16String2XML(CsrUtf16String *str); -CsrUtf16String *CsrXML2Utf16String(CsrUtf16String *str); +u16 *CsrUtf16String2XML(u16 *str); +u16 *CsrXML2Utf16String(u16 *str); s32 CsrUtf8StrCmp(const CsrUtf8String *string1, const CsrUtf8String *string2); s32 CsrUtf8StrNCmp(const CsrUtf8String *string1, const CsrUtf8String *string2, CsrSize count); @@ -180,8 +180,8 @@ CsrSize CsrConverterUcs2ByteStrLen(const CsrUcs2String *str); u8 *CsrUcs2ByteString2Utf8(const CsrUcs2String *ucs2String); CsrUcs2String *CsrUtf82Ucs2ByteString(const u8 *utf8String); -u8 *CsrUtf16String2Ucs2ByteString(const CsrUtf16String *source); -CsrUtf16String *CsrUcs2ByteString2Utf16String(const u8 *source); +u8 *CsrUtf16String2Ucs2ByteString(const u16 *source); +u16 *CsrUcs2ByteString2Utf16String(const u8 *source); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index 5048250..b33fa0b 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -73,10 +73,10 @@ static const u32 offsetsFromUtf8[4] = * Output: A string of UTF-16 characters. * *********************************************************************************/ -CsrUtf16String *CsrUint32ToUtf16String(u32 number) +u16 *CsrUint32ToUtf16String(u32 number) { u16 count, noOfDigits; - CsrUtf16String *output; + u16 *output; u32 tempNumber; /* calculate the number of digits in the output */ @@ -88,12 +88,12 @@ CsrUtf16String *CsrUint32ToUtf16String(u32 number) noOfDigits++; } - output = (CsrUtf16String *) CsrPmemAlloc(sizeof(CsrUtf16String) * (noOfDigits + 1)); /*add space for 0-termination*/ + output = (u16 *) CsrPmemAlloc(sizeof(u16) * (noOfDigits + 1)); /*add space for 0-termination*/ tempNumber = number; for (count = noOfDigits; count > 0; count--) { - output[count - 1] = (CsrUtf16String) ((tempNumber % 10) + '0'); + output[count - 1] = (u16) ((tempNumber % 10) + '0'); tempNumber = tempNumber / 10; } output[noOfDigits] = '\0'; @@ -113,7 +113,7 @@ CsrUtf16String *CsrUint32ToUtf16String(u32 number) * Output: 32 bit number. * *********************************************************************************/ -u32 CsrUtf16StringToUint32(const CsrUtf16String *unicodeString) +u32 CsrUtf16StringToUint32(const u16 *unicodeString) { u16 numLen, count; u32 newNumber = 0; @@ -127,7 +127,7 @@ u32 CsrUtf16StringToUint32(const CsrUtf16String *unicodeString) for (count = 0; count < numLen; count++) { - CsrUtf16String input = unicodeString[count]; + u16 input = unicodeString[count]; if ((input < 0x30) || (input > 0x39) || ((newNumber == 0x19999999) && (input > 0x35)) || (newNumber > 0x19999999)) /* chars are present or number is too large now causing number to get to large when *10 */ { return 0; @@ -150,9 +150,9 @@ u32 CsrUtf16StringToUint32(const CsrUtf16String *unicodeString) * Output: A pointer to an unicoded string. * *********************************************************************************/ -CsrUtf16String *CsrUtf16MemCpy(CsrUtf16String *dest, const CsrUtf16String *src, u32 count) +u16 *CsrUtf16MemCpy(u16 *dest, const u16 *src, u32 count) { - return CsrMemCpy((u8 *) dest, (u8 *) src, count * sizeof(CsrUtf16String)); + return CsrMemCpy((u8 *) dest, (u8 *) src, count * sizeof(u16)); } /******************************************************************************** @@ -167,10 +167,10 @@ CsrUtf16String *CsrUtf16MemCpy(CsrUtf16String *dest, const CsrUtf16String *src, * Output: A new unicoded string (UTF-16) containing the combined strings. * *********************************************************************************/ -CsrUtf16String *CsrUtf16ConcatenateTexts(const CsrUtf16String *inputText1, const CsrUtf16String *inputText2, - const CsrUtf16String *inputText3, const CsrUtf16String *inputText4) +u16 *CsrUtf16ConcatenateTexts(const u16 *inputText1, const u16 *inputText2, + const u16 *inputText3, const u16 *inputText4) { - CsrUtf16String *outputText; + u16 *outputText; u32 textLen, textLen1, textLen2, textLen3, textLen4; textLen1 = CsrUtf16StrLen(inputText1); @@ -185,7 +185,7 @@ CsrUtf16String *CsrUtf16ConcatenateTexts(const CsrUtf16String *inputText1, const return NULL; } - outputText = (CsrUtf16String *) CsrPmemAlloc((textLen + 1) * sizeof(CsrUtf16String)); /* add space for 0-termination*/ + outputText = (u16 *) CsrPmemAlloc((textLen + 1) * sizeof(u16)); /* add space for 0-termination*/ if (inputText1 != NULL) @@ -225,7 +225,7 @@ CsrUtf16String *CsrUtf16ConcatenateTexts(const CsrUtf16String *inputText1, const * Output: The number of 16 bit elements in the string. * *********************************************************************************/ -u32 CsrUtf16StrLen(const CsrUtf16String *unicodeString) +u32 CsrUtf16StrLen(const u16 *unicodeString) { u32 length; @@ -253,7 +253,7 @@ u32 CsrUtf16StrLen(const CsrUtf16String *unicodeString) * Output: 0-terminated string of byte oriented UTF8 coded characters. * *********************************************************************************/ -CsrUtf8String *CsrUtf16String2Utf8(const CsrUtf16String *source) +CsrUtf8String *CsrUtf16String2Utf8(const u16 *source) { CsrUtf8String *dest, *destStart = NULL; u32 i; @@ -562,12 +562,12 @@ static CsrBool isLegalUtf8(const CsrUtf8String *codeUnit, u32 length) * Output: 0-terminated string of UTF-16 characters. * *********************************************************************************/ -CsrUtf16String *CsrUtf82Utf16String(const CsrUtf8String *utf8String) +u16 *CsrUtf82Utf16String(const CsrUtf8String *utf8String) { CsrSize i, length = 0; CsrSize sourceLength; - CsrUtf16String *dest = NULL; - CsrUtf16String *destStart = NULL; + u16 *dest = NULL; + u16 *destStart = NULL; s8 extraBytes2Read; if (!utf8String) @@ -610,7 +610,7 @@ CsrUtf16String *CsrUtf82Utf16String(const CsrUtf8String *utf8String) } /* Create space for the null terminated character */ - dest = (CsrUtf16String *) CsrPmemAlloc((1 + length) * sizeof(CsrUtf16String)); + dest = (u16 *) CsrPmemAlloc((1 + length) * sizeof(u16)); destStart = dest; for (i = 0; i < sourceLength; i++) @@ -703,11 +703,11 @@ CsrUtf16String *CsrUtf82Utf16String(const CsrUtf8String *utf8String) * Output: 0-terminated UTF-16 string. * *********************************************************************************/ -CsrUtf16String *CsrUtf16StrCpy(CsrUtf16String *target, const CsrUtf16String *source) +u16 *CsrUtf16StrCpy(u16 *target, const u16 *source) { if (source) /* if source is not NULL*/ { - CsrMemCpy(target, source, (CsrUtf16StrLen(source) + 1) * sizeof(CsrUtf16String)); + CsrMemCpy(target, source, (CsrUtf16StrLen(source) + 1) * sizeof(u16)); return target; } else @@ -728,15 +728,15 @@ CsrUtf16String *CsrUtf16StrCpy(CsrUtf16String *target, const CsrUtf16String *sou * Output: Allocated variable0-terminated UTF-16 string. * *********************************************************************************/ -CsrUtf16String *CsrUtf16StringDuplicate(const CsrUtf16String *source) +u16 *CsrUtf16StringDuplicate(const u16 *source) { - CsrUtf16String *target = NULL; + u16 *target = NULL; u32 length; if (source) /* if source is not NULL*/ { - length = (CsrUtf16StrLen(source) + 1) * sizeof(CsrUtf16String); - target = (CsrUtf16String *) CsrPmemAlloc(length); + length = (CsrUtf16StrLen(source) + 1) * sizeof(u16); + target = (u16 *) CsrPmemAlloc(length); CsrMemCpy(target, source, length); } return target; @@ -753,7 +753,7 @@ CsrUtf16String *CsrUtf16StringDuplicate(const CsrUtf16String *source) * Output: 0: if the strings are identical. * *********************************************************************************/ -u16 CsrUtf16StrICmp(const CsrUtf16String *string1, const CsrUtf16String *string2) +u16 CsrUtf16StrICmp(const u16 *string1, const u16 *string2) { while (*string1 || *string2) { @@ -781,7 +781,7 @@ u16 CsrUtf16StrICmp(const CsrUtf16String *string1, const CsrUtf16String *string2 * Output: 0: if the strings are identical. * *********************************************************************************/ -u16 CsrUtf16StrNICmp(const CsrUtf16String *string1, const CsrUtf16String *string2, u32 count) +u16 CsrUtf16StrNICmp(const u16 *string1, const u16 *string2, u32 count) { while ((*string1 || *string2) && count--) { @@ -809,11 +809,11 @@ u16 CsrUtf16StrNICmp(const CsrUtf16String *string1, const CsrUtf16String *string * Output: A new unicoded string (UTF-16) containing the converted output. * *********************************************************************************/ -CsrUtf16String *CsrUtf16String2XML(CsrUtf16String *str) +u16 *CsrUtf16String2XML(u16 *str) { - CsrUtf16String *scanString; - CsrUtf16String *outputString = NULL; - CsrUtf16String *resultString = str; + u16 *scanString; + u16 *outputString = NULL; + u16 *resultString = str; u32 stringLength = 0; CsrBool encodeChars = FALSE; @@ -844,7 +844,7 @@ CsrUtf16String *CsrUtf16String2XML(CsrUtf16String *str) if (encodeChars) { - resultString = outputString = CsrPmemAlloc(stringLength * sizeof(CsrUtf16String)); + resultString = outputString = CsrPmemAlloc(stringLength * sizeof(u16)); scanString = str; @@ -902,11 +902,11 @@ CsrUtf16String *CsrUtf16String2XML(CsrUtf16String *str) * Output: A new unicoded pointer containing the decoded output. * *********************************************************************************/ -CsrUtf16String *CsrXML2Utf16String(CsrUtf16String *str) +u16 *CsrXML2Utf16String(u16 *str) { - CsrUtf16String *scanString; - CsrUtf16String *outputString = NULL; - CsrUtf16String *resultString = str; + u16 *scanString; + u16 *outputString = NULL; + u16 *resultString = str; u32 stringLength = 0; CsrBool encodeChars = FALSE; @@ -915,31 +915,31 @@ CsrUtf16String *CsrXML2Utf16String(CsrUtf16String *str) { while (*scanString) { - if (*scanString == (CsrUtf16String) L'&') + if (*scanString == (u16) L'&') { scanString++; - if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"AMP;", 4)) + if (!CsrUtf16StrNICmp(scanString, (u16 *) L"AMP;", 4)) { scanString += 3; encodeChars = TRUE; } - else if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"LT;", 3)) + else if (!CsrUtf16StrNICmp(scanString, (u16 *) L"LT;", 3)) { scanString += 2; encodeChars = TRUE; } - else if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"GT;", 3)) + else if (!CsrUtf16StrNICmp(scanString, (u16 *) L"GT;", 3)) { scanString += 2; encodeChars = TRUE; } - if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"APOS;", 5)) + if (!CsrUtf16StrNICmp(scanString, (u16 *) L"APOS;", 5)) { scanString += 4; encodeChars = TRUE; } - if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"QUOT;", 5)) + if (!CsrUtf16StrNICmp(scanString, (u16 *) L"QUOT;", 5)) { scanString += 4; encodeChars = TRUE; @@ -958,7 +958,7 @@ CsrUtf16String *CsrXML2Utf16String(CsrUtf16String *str) if (encodeChars) { - resultString = outputString = CsrPmemAlloc(stringLength * sizeof(CsrUtf16String)); + resultString = outputString = CsrPmemAlloc(stringLength * sizeof(u16)); scanString = str; @@ -968,27 +968,27 @@ CsrUtf16String *CsrXML2Utf16String(CsrUtf16String *str) { scanString++; - if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"AMP;", 4)) + if (!CsrUtf16StrNICmp(scanString, (u16 *) L"AMP;", 4)) { *outputString++ = L'&'; scanString += 3; } - else if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"LT;", 3)) + else if (!CsrUtf16StrNICmp(scanString, (u16 *) L"LT;", 3)) { *outputString++ = L'<'; scanString += 2; } - else if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"GT;", 3)) + else if (!CsrUtf16StrNICmp(scanString, (u16 *) L"GT;", 3)) { *outputString++ = L'>'; scanString += 2; } - else if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"APOS;", 5)) + else if (!CsrUtf16StrNICmp(scanString, (u16 *) L"APOS;", 5)) { *outputString++ = L'\''; scanString += 4; } - else if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"QUOT;", 5)) + else if (!CsrUtf16StrNICmp(scanString, (u16 *) L"QUOT;", 5)) { *outputString++ = L'\"'; scanString += 4; -- cgit v0.10.2 From 7f5393ea2d432c074d0b3796728e6abd182736b3 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 12:19:55 -0700 Subject: staging: csr: remove CsrUtf8String typedef MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the in-kernel u8 type instead. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_msgconv.h b/drivers/staging/csr/csr_msgconv.h index a43a4a6..3b009c8 100644 --- a/drivers/staging/csr/csr_msgconv.h +++ b/drivers/staging/csr/csr_msgconv.h @@ -74,7 +74,7 @@ void CsrMsgConvDeinit(void); /* SHOULD BE INTERNAL TO FRAMEWORK AKA DEPRECATED */ u32 CsrCharStringSerLen(const CsrCharString *str); -u32 CsrUtf8StringSerLen(const CsrUtf8String *str); +u32 CsrUtf8StringSerLen(const u8 *str); u32 CsrUtf16StringSerLen(const u16 *str); /* Prototypes for primitive type serializers */ @@ -83,7 +83,7 @@ void CsrUint16Ser(u8 *buffer, CsrSize *offset, u16 value); void CsrUint32Ser(u8 *buffer, CsrSize *offset, u32 value); void CsrMemCpySer(u8 *buffer, CsrSize *offset, const void *value, CsrSize length); void CsrCharStringSer(u8 *buffer, CsrSize *offset, const CsrCharString *value); -void CsrUtf8StringSer(u8 *buffer, CsrSize *offset, const CsrUtf8String *value); +void CsrUtf8StringSer(u8 *buffer, CsrSize *offset, const u8 *value); void CsrUtf16StringSer(u8 *buffer, CsrSize *offset, const u16 *value); void CsrVoidPtrSer(u8 *buffer, CsrSize *offset, void *ptr); void CsrSizeSer(u8 *buffer, CsrSize *offset, CsrSize value); @@ -93,7 +93,7 @@ void CsrUint16Des(u16 *value, u8 *buffer, CsrSize *offset); void CsrUint32Des(u32 *value, u8 *buffer, CsrSize *offset); void CsrMemCpyDes(void *value, u8 *buffer, CsrSize *offset, CsrSize length); void CsrCharStringDes(CsrCharString **value, u8 *buffer, CsrSize *offset); -void CsrUtf8StringDes(CsrUtf8String **value, u8 *buffer, CsrSize *offset); +void CsrUtf8StringDes(u8 **value, u8 *buffer, CsrSize *offset); void CsrUtf16StringDes(u16 **value, u8 *buffer, CsrSize *offset); void CsrVoidPtrDes(void **value, u8 *buffer, CsrSize *offset); void CsrSizeDes(CsrSize *value, u8 *buffer, CsrSize *offset); diff --git a/drivers/staging/csr/csr_serialize_primitive_types.c b/drivers/staging/csr/csr_serialize_primitive_types.c index f0b9e84..500c46e 100644 --- a/drivers/staging/csr/csr_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_serialize_primitive_types.c @@ -55,9 +55,9 @@ void CsrCharStringDes(CsrCharString **value, u8 *buffer, CsrSize *offset) } EXPORT_SYMBOL_GPL(CsrCharStringDes); -void CsrUtf8StringDes(CsrUtf8String **value, u8 *buffer, CsrSize *offset) +void CsrUtf8StringDes(u8 **value, u8 *buffer, CsrSize *offset) { - *value = (CsrUtf8String *) CsrStrDup((CsrCharString *) &buffer[*offset]); + *value = (u8 *) CsrStrDup((CsrCharString *) &buffer[*offset]); *offset += CsrStrLen((CsrCharString *) *value) + 1; } @@ -134,7 +134,7 @@ void CsrCharStringSer(u8 *buffer, CsrSize *offset, const CsrCharString *value) } EXPORT_SYMBOL_GPL(CsrCharStringSer); -void CsrUtf8StringSer(u8 *buffer, CsrSize *offset, const CsrUtf8String *value) +void CsrUtf8StringSer(u8 *buffer, CsrSize *offset, const u8 *value) { CsrCharStringSer(buffer, offset, (CsrCharString *) value); } @@ -185,7 +185,7 @@ u32 CsrCharStringSerLen(const CsrCharString *str) } } -u32 CsrUtf8StringSerLen(const CsrUtf8String *str) +u32 CsrUtf8StringSerLen(const u8 *str) { if (str) { diff --git a/drivers/staging/csr/csr_types.h b/drivers/staging/csr/csr_types.h index 054e5c9..56ce834 100644 --- a/drivers/staging/csr/csr_types.h +++ b/drivers/staging/csr/csr_types.h @@ -37,7 +37,6 @@ typedef u8 CsrBool; /* String types */ typedef char CsrCharString; -typedef u8 CsrUtf8String; /* * 64-bit integers diff --git a/drivers/staging/csr/csr_unicode.h b/drivers/staging/csr/csr_unicode.h index 6d2fc63..0c72f19 100644 --- a/drivers/staging/csr/csr_unicode.h +++ b/drivers/staging/csr/csr_unicode.h @@ -21,9 +21,9 @@ u16 *CsrUint32ToUtf16String(u32 number); u32 CsrUtf16StringToUint32(const u16 *unicodeString); u32 CsrUtf16StrLen(const u16 *unicodeString); -CsrUtf8String *CsrUtf16String2Utf8(const u16 *source); +u8 *CsrUtf16String2Utf8(const u16 *source); -u16 *CsrUtf82Utf16String(const CsrUtf8String *utf8String); +u16 *CsrUtf82Utf16String(const u8 *utf8String); u16 *CsrUtf16StrCpy(u16 *target, const u16 *source); u16 *CsrUtf16StringDuplicate(const u16 *source); @@ -38,9 +38,9 @@ u16 *CsrUtf16ConcatenateTexts(const u16 *inputText1, const u16 *inputText2, u16 *CsrUtf16String2XML(u16 *str); u16 *CsrXML2Utf16String(u16 *str); -s32 CsrUtf8StrCmp(const CsrUtf8String *string1, const CsrUtf8String *string2); -s32 CsrUtf8StrNCmp(const CsrUtf8String *string1, const CsrUtf8String *string2, CsrSize count); -u32 CsrUtf8StringLengthInBytes(const CsrUtf8String *string); +s32 CsrUtf8StrCmp(const u8 *string1, const u8 *string2); +s32 CsrUtf8StrNCmp(const u8 *string1, const u8 *string2, CsrSize count); +u32 CsrUtf8StringLengthInBytes(const u8 *string); /******************************************************************************* @@ -66,7 +66,7 @@ u32 CsrUtf8StringLengthInBytes(const CsrUtf8String *string); Returns target *******************************************************************************/ -CsrUtf8String *CsrUtf8StrTruncate(CsrUtf8String *target, CsrSize count); +u8 *CsrUtf8StrTruncate(u8 *target, CsrSize count); /******************************************************************************* @@ -90,7 +90,7 @@ CsrUtf8String *CsrUtf8StrTruncate(CsrUtf8String *target, CsrSize count); Returns target *******************************************************************************/ -CsrUtf8String *CsrUtf8StrCpy(CsrUtf8String *target, const CsrUtf8String *source); +u8 *CsrUtf8StrCpy(u8 *target, const u8 *source); /******************************************************************************* @@ -116,7 +116,7 @@ CsrUtf8String *CsrUtf8StrCpy(CsrUtf8String *target, const CsrUtf8String *source) Returns target *******************************************************************************/ -CsrUtf8String *CsrUtf8StrNCpy(CsrUtf8String *target, const CsrUtf8String *source, CsrSize count); +u8 *CsrUtf8StrNCpy(u8 *target, const u8 *source, CsrSize count); /******************************************************************************* @@ -143,7 +143,7 @@ CsrUtf8String *CsrUtf8StrNCpy(CsrUtf8String *target, const CsrUtf8String *source Returns target *******************************************************************************/ -CsrUtf8String *CsrUtf8StrNCpyZero(CsrUtf8String *target, const CsrUtf8String *source, CsrSize count); +u8 *CsrUtf8StrNCpyZero(u8 *target, const u8 *source, CsrSize count); /******************************************************************************* @@ -163,9 +163,9 @@ CsrUtf8String *CsrUtf8StrNCpyZero(CsrUtf8String *target, const CsrUtf8String *so Returns a duplicate of source. *******************************************************************************/ -CsrUtf8String *CsrUtf8StrDup(const CsrUtf8String *source); +u8 *CsrUtf8StrDup(const u8 *source); -CsrUtf8String *CsrUtf8StringConcatenateTexts(const CsrUtf8String *inputText1, const CsrUtf8String *inputText2, const CsrUtf8String *inputText3, const CsrUtf8String *inputText4); +u8 *CsrUtf8StringConcatenateTexts(const u8 *inputText1, const u8 *inputText2, const u8 *inputText3, const u8 *inputText4); /* * UCS2 diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index b33fa0b..dfd63b4 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -253,9 +253,9 @@ u32 CsrUtf16StrLen(const u16 *unicodeString) * Output: 0-terminated string of byte oriented UTF8 coded characters. * *********************************************************************************/ -CsrUtf8String *CsrUtf16String2Utf8(const u16 *source) +u8 *CsrUtf16String2Utf8(const u16 *source) { - CsrUtf8String *dest, *destStart = NULL; + u8 *dest, *destStart = NULL; u32 i; u32 ch; u32 length; @@ -463,9 +463,9 @@ CsrUtf8String *CsrUtf16String2Utf8(const u16 *source) TRUE if the given code unit is legal. *****************************************************************************/ -static CsrBool isLegalUtf8(const CsrUtf8String *codeUnit, u32 length) +static CsrBool isLegalUtf8(const u8 *codeUnit, u32 length) { - const CsrUtf8String *srcPtr = codeUnit + length; + const u8 *srcPtr = codeUnit + length; u8 byte; switch (length) /* Everything falls through except case 1 */ @@ -562,7 +562,7 @@ static CsrBool isLegalUtf8(const CsrUtf8String *codeUnit, u32 length) * Output: 0-terminated string of UTF-16 characters. * *********************************************************************************/ -u16 *CsrUtf82Utf16String(const CsrUtf8String *utf8String) +u16 *CsrUtf82Utf16String(const u8 *utf8String) { CsrSize i, length = 0; CsrSize sourceLength; @@ -1016,17 +1016,17 @@ u16 *CsrXML2Utf16String(u16 *str) return resultString; } -s32 CsrUtf8StrCmp(const CsrUtf8String *string1, const CsrUtf8String *string2) +s32 CsrUtf8StrCmp(const u8 *string1, const u8 *string2) { return CsrStrCmp((const CsrCharString *) string1, (const CsrCharString *) string2); } -s32 CsrUtf8StrNCmp(const CsrUtf8String *string1, const CsrUtf8String *string2, CsrSize count) +s32 CsrUtf8StrNCmp(const u8 *string1, const u8 *string2, CsrSize count) { return CsrStrNCmp((const CsrCharString *) string1, (const CsrCharString *) string2, count); } -u32 CsrUtf8StringLengthInBytes(const CsrUtf8String *string) +u32 CsrUtf8StringLengthInBytes(const u8 *string) { CsrSize length = 0; if (string) @@ -1036,12 +1036,12 @@ u32 CsrUtf8StringLengthInBytes(const CsrUtf8String *string) return (u32) length; } -CsrUtf8String *CsrUtf8StrCpy(CsrUtf8String *target, const CsrUtf8String *source) +u8 *CsrUtf8StrCpy(u8 *target, const u8 *source) { - return (CsrUtf8String *) CsrStrCpy((CsrCharString *) target, (const CsrCharString *) source); + return (u8 *) CsrStrCpy((CsrCharString *) target, (const CsrCharString *) source); } -CsrUtf8String *CsrUtf8StrTruncate(CsrUtf8String *target, CsrSize count) +u8 *CsrUtf8StrTruncate(u8 *target, CsrSize count) { CsrSize lastByte = count - 1; @@ -1070,12 +1070,12 @@ CsrUtf8String *CsrUtf8StrTruncate(CsrUtf8String *target, CsrSize count) return target; } -CsrUtf8String *CsrUtf8StrNCpy(CsrUtf8String *target, const CsrUtf8String *source, CsrSize count) +u8 *CsrUtf8StrNCpy(u8 *target, const u8 *source, CsrSize count) { - return (CsrUtf8String *) CsrStrNCpy((CsrCharString *) target, (const CsrCharString *) source, count); + return (u8 *) CsrStrNCpy((CsrCharString *) target, (const CsrCharString *) source, count); } -CsrUtf8String *CsrUtf8StrNCpyZero(CsrUtf8String *target, const CsrUtf8String *source, CsrSize count) +u8 *CsrUtf8StrNCpyZero(u8 *target, const u8 *source, CsrSize count) { CsrStrNCpy((CsrCharString *) target, (const CsrCharString *) source, count); if (target[count - 1] != '\0') @@ -1085,14 +1085,14 @@ CsrUtf8String *CsrUtf8StrNCpyZero(CsrUtf8String *target, const CsrUtf8String *so return target; } -CsrUtf8String *CsrUtf8StrDup(const CsrUtf8String *source) +u8 *CsrUtf8StrDup(const u8 *source) { - return (CsrUtf8String *) CsrStrDup((const CsrCharString *) source); + return (u8 *) CsrStrDup((const CsrCharString *) source); } -CsrUtf8String *CsrUtf8StringConcatenateTexts(const CsrUtf8String *inputText1, const CsrUtf8String *inputText2, const CsrUtf8String *inputText3, const CsrUtf8String *inputText4) +u8 *CsrUtf8StringConcatenateTexts(const u8 *inputText1, const u8 *inputText2, const u8 *inputText3, const u8 *inputText4) { - CsrUtf8String *outputText; + u8 *outputText; u32 textLen, textLen1, textLen2, textLen3, textLen4; textLen1 = CsrUtf8StringLengthInBytes(inputText1); @@ -1107,7 +1107,7 @@ CsrUtf8String *CsrUtf8StringConcatenateTexts(const CsrUtf8String *inputText1, co return NULL; } - outputText = (CsrUtf8String *) CsrPmemAlloc((textLen + 1) * sizeof(CsrUtf8String)); /* add space for 0-termination*/ + outputText = (u8 *) CsrPmemAlloc((textLen + 1) * sizeof(u8)); /* add space for 0-termination*/ if (inputText1 != NULL) -- cgit v0.10.2 From c781b96b8007d758a38e9c670957ba48e254f039 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 12:22:32 -0700 Subject: staging: csr: remove CsrCharString typedef MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use char instead. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_formatted_io.c b/drivers/staging/csr/csr_formatted_io.c index 145e99f..d7b81e8 100644 --- a/drivers/staging/csr/csr_formatted_io.c +++ b/drivers/staging/csr/csr_formatted_io.c @@ -12,7 +12,7 @@ #include "csr_formatted_io.h" #include "csr_util.h" -s32 CsrSnprintf(CsrCharString *dest, CsrSize n, const CsrCharString *fmt, ...) +s32 CsrSnprintf(char *dest, CsrSize n, const char *fmt, ...) { s32 r; va_list args; diff --git a/drivers/staging/csr/csr_formatted_io.h b/drivers/staging/csr/csr_formatted_io.h index b51119c..d0c3fb7 100644 --- a/drivers/staging/csr/csr_formatted_io.h +++ b/drivers/staging/csr/csr_formatted_io.h @@ -16,7 +16,7 @@ extern "C" { #include "csr_types.h" -s32 CsrSnprintf(CsrCharString *dest, CsrSize n, const CsrCharString *fmt, ...); +s32 CsrSnprintf(char *dest, CsrSize n, const char *fmt, ...); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_framework_ext.h b/drivers/staging/csr/csr_framework_ext.h index 82da0a4..5204514 100644 --- a/drivers/staging/csr/csr_framework_ext.h +++ b/drivers/staging/csr/csr_framework_ext.h @@ -196,7 +196,7 @@ void CsrGlobalMutexUnlock(void); *----------------------------------------------------------------------------*/ CsrResult CsrThreadCreate(void (*threadFunction)(void *pointer), void *pointer, u32 stackSize, u16 priority, - const CsrCharString *threadName, CsrThreadHandle *threadHandle); + const char *threadName, CsrThreadHandle *threadHandle); /*----------------------------------------------------------------------------* * NAME @@ -257,7 +257,7 @@ void CsrThreadSleep(u16 sleepTimeInMs); *----------------------------------------------------------------------------*/ #ifdef CSR_MEM_DEBUG void *CsrMemAllocDebug(CsrSize size, - const CsrCharString *file, u32 line); + const char *file, u32 line); #define CsrMemAlloc(sz) CsrMemAllocDebug((sz), __FILE__, __LINE__) #else void *CsrMemAlloc(CsrSize size); @@ -278,7 +278,7 @@ void *CsrMemAlloc(CsrSize size); *----------------------------------------------------------------------------*/ #ifdef CSR_MEM_DEBUG void *CsrMemCallocDebug(CsrSize numberOfElements, CsrSize elementSize, - const CsrCharString *file, u32 line); + const char *file, u32 line); #define CsrMemCalloc(cnt, sz) CsrMemAllocDebug((cnt), (sz), __FILE__, __LINE__) #else void *CsrMemCalloc(CsrSize numberOfElements, CsrSize elementSize); @@ -311,7 +311,7 @@ void CsrMemFree(void *pointer); *----------------------------------------------------------------------------*/ #ifdef CSR_MEM_DEBUG void *CsrMemAllocDmaDebug(CsrSize size, - const CsrCharString *file, u32 line); + const char *file, u32 line); #define CsrMemAllocDma(sz) CsrMemAllocDmaDebug((sz), __FILE__, __LINE__) #else void *CsrMemAllocDma(CsrSize size); diff --git a/drivers/staging/csr/csr_lib.h b/drivers/staging/csr/csr_lib.h index 55768f8..841d7ec 100644 --- a/drivers/staging/csr/csr_lib.h +++ b/drivers/staging/csr/csr_lib.h @@ -119,7 +119,7 @@ typedef struct { CsrPrim type; u16 value1; - CsrCharString *value2; + char *value2; } CsrEventCsrUint16CsrCharString; /*----------------------------------------------------------------------------* @@ -130,7 +130,7 @@ typedef struct * Allocates and fills in a message with the signature CsrEventCsrUint16CsrCharString * *----------------------------------------------------------------------------*/ -CsrEventCsrUint16CsrCharString *CsrEventCsrUint16CsrCharString_struct(u16 primtype, u16 msgtype, u16 value1, CsrCharString *value2); +CsrEventCsrUint16CsrCharString *CsrEventCsrUint16CsrCharString_struct(u16 primtype, u16 msgtype, u16 value1, char *value2); typedef struct { @@ -169,7 +169,7 @@ typedef struct { CsrPrim type; u32 value1; - CsrCharString *value2; + char *value2; } CsrEventCsrUint32CsrCharString; /*----------------------------------------------------------------------------* @@ -180,7 +180,7 @@ typedef struct * Allocates and fills in a message with the signature CsrEventCsrUint32CsrCharString * *----------------------------------------------------------------------------*/ -CsrEventCsrUint32CsrCharString *CsrEventCsrUint32CsrCharString_struct(u16 primtype, u16 msgtype, u32 value1, CsrCharString *value2); +CsrEventCsrUint32CsrCharString *CsrEventCsrUint32CsrCharString_struct(u16 primtype, u16 msgtype, u32 value1, char *value2); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_log.h b/drivers/staging/csr/csr_log.h index 748657b..6f8429d 100644 --- a/drivers/staging/csr/csr_log.h +++ b/drivers/staging/csr/csr_log.h @@ -86,7 +86,7 @@ CsrBool CsrLogTaskIsFiltered(CsrSchedQid taskId, CsrLogLevelTask level); do { \ if (!(cond)) \ { \ - CsrCharString *panic_arg = "[" __FILE__ ":" CSR_LOG_STRINGIFY(__LINE__) "] - " CSR_LOG_STRINGIFY(cond); \ + char *panic_arg = "[" __FILE__ ":" CSR_LOG_STRINGIFY(__LINE__) "] - " CSR_LOG_STRINGIFY(cond); \ CsrPanic(CSR_TECH_FW, CSR_PANIC_FW_ASSERTION_FAIL, panic_arg); \ } \ } while (0) @@ -97,13 +97,13 @@ CsrBool CsrLogTaskIsFiltered(CsrSchedQid taskId, CsrLogLevelTask level); typedef struct { u16 primitiveType; - const CsrCharString *primitiveName; + const char *primitiveName; CsrMsgConvMsgEntry *messageConv; /* Private - do not use */ } CsrLogPrimitiveInformation; typedef struct { - const CsrCharString *techVer; + const char *techVer; u32 primitiveInfoCount; CsrLogPrimitiveInformation *primitiveInfo; } CsrLogTechInformation; @@ -140,9 +140,9 @@ typedef u32 bitmask32_t; #endif /* DEPRECATED - replaced by csr_log_text.h */ -void CsrLogTaskText(const CsrCharString *text, +void CsrLogTaskText(const char *text, u32 line, - const CsrCharString *file); + const char *file); #define CSR_LOG_STATE_TRANSITION_MASK_FSM_NAME (0x001) #define CSR_LOG_STATE_TRANSITION_MASK_NEXT_STATE (0x002) @@ -155,15 +155,15 @@ void CsrLogTaskText(const CsrCharString *text, /* DEPRECATED - replaced by csr_log_text.h */ void CsrLogStateTransition(bitmask16_t mask, u32 identifier, - const CsrCharString *fsm_name, + const char *fsm_name, u32 prev_state, - const CsrCharString *prev_state_str, + const char *prev_state_str, u32 in_event, - const CsrCharString *in_event_str, + const char *in_event_str, u32 next_state, - const CsrCharString *next_state_str, + const char *next_state_str, u32 line, - const CsrCharString *file); + const char *file); /*---------------------------------*/ /* BSP logging */ @@ -174,7 +174,7 @@ void CsrLogSchedDeinit(u8 thread_id); void CsrLogSchedStart(u8 thread_id); void CsrLogSchedStop(u8 thread_id); -void CsrLogInitTask(u8 thread_id, CsrSchedQid tskid, const CsrCharString *tskName); +void CsrLogInitTask(u8 thread_id, CsrSchedQid tskid, const char *tskName); void CsrLogDeinitTask(u16 task_id); void CsrLogActivate(CsrSchedQid tskid); @@ -184,7 +184,7 @@ void CsrLogDeactivate(CsrSchedQid tskid); #define SYNERGY_SERIALIZER_TYPE_SER (0x001) void CsrLogMessagePut(u32 line, - const CsrCharString *file, + const char *file, CsrSchedQid src_task_id, CsrSchedQid dst_taskid, CsrSchedMsgId msg_id, @@ -199,7 +199,7 @@ void CsrLogMessageGet(CsrSchedQid src_task_id, const void *msg); void CsrLogTimedEventIn(u32 line, - const CsrCharString *file, + const char *file, CsrSchedQid task_id, CsrSchedTid tid, CsrTime requested_delay, @@ -213,14 +213,14 @@ void CsrLogTimedEventDone(CsrSchedQid task_id, CsrSchedTid tid); void CsrLogTimedEventCancel(u32 line, - const CsrCharString *file, + const char *file, CsrSchedQid task_id, CsrSchedTid tid, CsrBool cancel_res); void CsrLogBgintRegister(u8 thread_id, CsrSchedBgint irq, - const CsrCharString *callback, + const char *callback, const void *ptr); void CsrLogBgintUnregister(CsrSchedBgint irq); void CsrLogBgintSet(CsrSchedBgint irq); @@ -231,17 +231,17 @@ void CsrLogExceptionStateEvent(u16 prim_type, CsrPrim msg_type, u16 state, u32 line, - const CsrCharString *file); + const char *file); void CsrLogExceptionGeneral(u16 prim_type, u16 state, - const CsrCharString *text, + const char *text, u32 line, - const CsrCharString *file); + const char *file); void CsrLogExceptionWarning(u16 prim_type, u16 state, - const CsrCharString *text, + const char *text, u32 line, - const CsrCharString *file); + const char *file); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_log_configure.h b/drivers/staging/csr/csr_log_configure.h index 60e7be9..48e8a22 100644 --- a/drivers/staging/csr/csr_log_configure.h +++ b/drivers/staging/csr/csr_log_configure.h @@ -124,8 +124,8 @@ void CsrLogLevelTextSetTaskSubOrigin(CsrLogTextTaskId taskId, u16 subOrigin, Csr sub origin(s). *******************************************************************************/ -void CsrLogLevelTextSet(const CsrCharString *originName, - const CsrCharString *subOriginName, +void CsrLogLevelTextSet(const char *originName, + const char *subOriginName, CsrLogLevelText warningLevelMask); #ifdef __cplusplus diff --git a/drivers/staging/csr/csr_log_text.h b/drivers/staging/csr/csr_log_text.h index cb01655..d667c89 100644 --- a/drivers/staging/csr/csr_log_text.h +++ b/drivers/staging/csr/csr_log_text.h @@ -20,12 +20,12 @@ extern "C" { typedef struct CsrLogSubOrigin { u16 subOriginNumber; /* Id of the given SubOrigin */ - const CsrCharString *subOriginName; /* Prefix Text for this SubOrigin */ + const char *subOriginName; /* Prefix Text for this SubOrigin */ } CsrLogSubOrigin; /* Register a task which is going to use the CSR_LOG_TEXT_XXX interface */ #ifdef CSR_LOG_ENABLE -void CsrLogTextRegister(CsrLogTextTaskId taskId, const CsrCharString *taskName, u16 subOriginsLength, const CsrLogSubOrigin *subOrigins); +void CsrLogTextRegister(CsrLogTextTaskId taskId, const char *taskName, u16 subOriginsLength, const CsrLogSubOrigin *subOrigins); #else #define CsrLogTextRegister(taskId, taskName, subOriginsLength, subOrigins) #endif @@ -33,8 +33,8 @@ void CsrLogTextRegister(CsrLogTextTaskId taskId, const CsrCharString *taskName, /* CRITICAL: Conditions that are threatening to the integrity/stability of the system as a whole. */ #if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_CRITICAL_DISABLE) -void CsrLogTextCritical(CsrLogTextTaskId taskId, u16 subOrigin, const CsrCharString *formatString, ...); -void CsrLogTextBufferCritical(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...); +void CsrLogTextCritical(CsrLogTextTaskId taskId, u16 subOrigin, const char *formatString, ...); +void CsrLogTextBufferCritical(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize bufferLength, const void *buffer, const char *formatString, ...); #define CSR_LOG_TEXT_CRITICAL(taskId_subOrigin_formatString_varargs) CsrLogTextCritical taskId_subOrigin_formatString_varargs #define CSR_LOG_TEXT_CONDITIONAL_CRITICAL(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_CRITICAL(logtextargs);}} #define CSR_LOG_TEXT_BUFFER_CRITICAL(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferCritical taskId_subOrigin_length_buffer_formatString_varargs @@ -49,8 +49,8 @@ void CsrLogTextBufferCritical(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize bu /* ERROR: Malfunction of a component rendering it unable to operate correctly, causing lack of functionality but not loss of system integrity/stability. */ #if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_ERROR_DISABLE) -void CsrLogTextError(CsrLogTextTaskId taskId, u16 subOrigin, const CsrCharString *formatString, ...); -void CsrLogTextBufferError(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...); +void CsrLogTextError(CsrLogTextTaskId taskId, u16 subOrigin, const char *formatString, ...); +void CsrLogTextBufferError(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize bufferLength, const void *buffer, const char *formatString, ...); #define CSR_LOG_TEXT_ERROR(taskId_subOrigin_formatString_varargs) CsrLogTextError taskId_subOrigin_formatString_varargs #define CSR_LOG_TEXT_CONDITIONAL_ERROR(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_ERROR(logtextargs);}} #define CSR_LOG_TEXT_BUFFER_ERROR(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferError taskId_subOrigin_length_buffer_formatString_varargs @@ -66,8 +66,8 @@ void CsrLogTextBufferError(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize buffe or violations of specifications, where the result of such deviations does not lead to malfunction of the component. */ #if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_WARNING_DISABLE) -void CsrLogTextWarning(CsrLogTextTaskId taskId, u16 subOrigin, const CsrCharString *formatString, ...); -void CsrLogTextBufferWarning(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...); +void CsrLogTextWarning(CsrLogTextTaskId taskId, u16 subOrigin, const char *formatString, ...); +void CsrLogTextBufferWarning(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize bufferLength, const void *buffer, const char *formatString, ...); #define CSR_LOG_TEXT_WARNING(taskId_subOrigin_formatString_varargs) CsrLogTextWarning taskId_subOrigin_formatString_varargs #define CSR_LOG_TEXT_CONDITIONAL_WARNING(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_WARNING(logtextargs);}} #define CSR_LOG_TEXT_BUFFER_WARNING(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferWarning taskId_subOrigin_length_buffer_formatString_varargs @@ -82,8 +82,8 @@ void CsrLogTextBufferWarning(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize buf /* INFO: Important events that may aid in determining the conditions under which the more severe conditions are encountered. */ #if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_INFO_DISABLE) -void CsrLogTextInfo(CsrLogTextTaskId taskId, u16 subOrigin, const CsrCharString *formatString, ...); -void CsrLogTextBufferInfo(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...); +void CsrLogTextInfo(CsrLogTextTaskId taskId, u16 subOrigin, const char *formatString, ...); +void CsrLogTextBufferInfo(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize bufferLength, const void *buffer, const char *formatString, ...); #define CSR_LOG_TEXT_INFO(taskId_subOrigin_formatString_varargs) CsrLogTextInfo taskId_subOrigin_formatString_varargs #define CSR_LOG_TEXT_CONDITIONAL_INFO(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_INFO(logtextargs);}} #define CSR_LOG_TEXT_BUFFER_INFO(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferInfo taskId_subOrigin_length_buffer_formatString_varargs @@ -97,8 +97,8 @@ void CsrLogTextBufferInfo(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize buffer /* DEBUG: Similar to INFO, but dedicated to events that occur more frequently. */ #if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_DEBUG_DISABLE) -void CsrLogTextDebug(CsrLogTextTaskId taskId, u16 subOrigin, const CsrCharString *formatString, ...); -void CsrLogTextBufferDebug(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...); +void CsrLogTextDebug(CsrLogTextTaskId taskId, u16 subOrigin, const char *formatString, ...); +void CsrLogTextBufferDebug(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize bufferLength, const void *buffer, const char *formatString, ...); #define CSR_LOG_TEXT_DEBUG(taskId_subOrigin_formatString_varargs) CsrLogTextDebug taskId_subOrigin_formatString_varargs #define CSR_LOG_TEXT_CONDITIONAL_DEBUG(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_DEBUG(logtextargs);}} #define CSR_LOG_TEXT_BUFFER_DEBUG(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferDebug taskId_subOrigin_length_buffer_formatString_varargs diff --git a/drivers/staging/csr/csr_msgconv.h b/drivers/staging/csr/csr_msgconv.h index 3b009c8..b195b79 100644 --- a/drivers/staging/csr/csr_msgconv.h +++ b/drivers/staging/csr/csr_msgconv.h @@ -73,7 +73,7 @@ void CsrMsgConvDeinit(void); /* SHOULD BE INTERNAL TO FRAMEWORK AKA DEPRECATED */ -u32 CsrCharStringSerLen(const CsrCharString *str); +u32 CsrCharStringSerLen(const char *str); u32 CsrUtf8StringSerLen(const u8 *str); u32 CsrUtf16StringSerLen(const u16 *str); @@ -82,7 +82,7 @@ void CsrUint8Ser(u8 *buffer, CsrSize *offset, u8 value); void CsrUint16Ser(u8 *buffer, CsrSize *offset, u16 value); void CsrUint32Ser(u8 *buffer, CsrSize *offset, u32 value); void CsrMemCpySer(u8 *buffer, CsrSize *offset, const void *value, CsrSize length); -void CsrCharStringSer(u8 *buffer, CsrSize *offset, const CsrCharString *value); +void CsrCharStringSer(u8 *buffer, CsrSize *offset, const char *value); void CsrUtf8StringSer(u8 *buffer, CsrSize *offset, const u8 *value); void CsrUtf16StringSer(u8 *buffer, CsrSize *offset, const u16 *value); void CsrVoidPtrSer(u8 *buffer, CsrSize *offset, void *ptr); @@ -92,7 +92,7 @@ void CsrUint8Des(u8 *value, u8 *buffer, CsrSize *offset); void CsrUint16Des(u16 *value, u8 *buffer, CsrSize *offset); void CsrUint32Des(u32 *value, u8 *buffer, CsrSize *offset); void CsrMemCpyDes(void *value, u8 *buffer, CsrSize *offset, CsrSize length); -void CsrCharStringDes(CsrCharString **value, u8 *buffer, CsrSize *offset); +void CsrCharStringDes(char **value, u8 *buffer, CsrSize *offset); void CsrUtf8StringDes(u8 **value, u8 *buffer, CsrSize *offset); void CsrUtf16StringDes(u16 **value, u8 *buffer, CsrSize *offset); void CsrVoidPtrDes(void **value, u8 *buffer, CsrSize *offset); diff --git a/drivers/staging/csr/csr_pmem.h b/drivers/staging/csr/csr_pmem.h index be21186..ede1c72 100644 --- a/drivers/staging/csr/csr_pmem.h +++ b/drivers/staging/csr/csr_pmem.h @@ -39,7 +39,7 @@ extern "C" { *****************************************************************************/ #ifdef CSR_PMEM_DEBUG void *CsrPmemAllocDebug(CsrSize size, - const CsrCharString *file, u32 line); + const char *file, u32 line); #define CsrPmemAlloc(sz) CsrPmemAllocDebug((sz), __FILE__, __LINE__) #else void *CsrPmemAlloc(CsrSize size); @@ -108,8 +108,8 @@ typedef u8 CsrPmemDebugAllocType; #define CSR_PMEM_DEBUG_TYPE_MEM_CALLOC 3 #define CSR_PMEM_DEBUG_TYPE_MEM_ALLOC_DMA 4 -typedef void (CsrPmemDebugOnAlloc)(void *ptr, void *userptr, CsrSize size, CsrPmemDebugAllocType type, const CsrCharString* file, u32 line); -typedef void (CsrPmemDebugOnFree)(void *ptr, void *userptr, CsrPmemDebugAllocType type, const CsrCharString* file, u32 line); +typedef void (CsrPmemDebugOnAlloc)(void *ptr, void *userptr, CsrSize size, CsrPmemDebugAllocType type, const char* file, u32 line); +typedef void (CsrPmemDebugOnFree)(void *ptr, void *userptr, CsrPmemDebugAllocType type, const char* file, u32 line); /*----------------------------------------------------------------------------* * NAME @@ -127,10 +127,10 @@ typedef void (CsrPmemDebugOnFree)(void *ptr, void *userptr, CsrPmemDebugAllocTyp *----------------------------------------------------------------------------*/ void CsrPmemDebugInstallHooks(u8 headSize, u8 endSize, CsrPmemDebugOnAlloc *onAllocCallback, CsrPmemDebugOnFree *onFreeCallback); -void *CsrPmemDebugAlloc(CsrSize size, CsrPmemDebugAllocType type, const CsrCharString* file, u32 line); +void *CsrPmemDebugAlloc(CsrSize size, CsrPmemDebugAllocType type, const char* file, u32 line); #define CsrPmemAlloc(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_PMEM_ALLOC, __FILE__, __LINE__) -void CsrPmemDebugFree(void *ptr, CsrPmemDebugAllocType type, const CsrCharString* file, u32 line); +void CsrPmemDebugFree(void *ptr, CsrPmemDebugAllocType type, const char* file, u32 line); #define CsrPmemFree(ptr) CsrPmemDebugFree(ptr, CSR_PMEM_DEBUG_TYPE_PMEM_ALLOC, __FILE__, __LINE__) #endif diff --git a/drivers/staging/csr/csr_sched.h b/drivers/staging/csr/csr_sched.h index 530ee28..2413463 100644 --- a/drivers/staging/csr/csr_sched.h +++ b/drivers/staging/csr/csr_sched.h @@ -76,7 +76,7 @@ typedef void (*CsrSchedBgintHandler)(void *); *----------------------------------------------------------------------------*/ CsrSchedBgint CsrSchedBgintReg(CsrSchedBgintHandler cb, void *context, - const CsrCharString *id); + const char *id); /*----------------------------------------------------------------------------* * NAME @@ -136,7 +136,7 @@ void CsrSchedMessagePutStringLog(CsrSchedQid q, u16 mi, void *mv, u32 line, - const CsrCharString *file); + const char *file); #define CsrSchedMessagePut(q, mi, mv) CsrSchedMessagePutStringLog((q), (mi), (mv), __LINE__, __FILE__) #else void CsrSchedMessagePut(CsrSchedQid q, @@ -168,7 +168,7 @@ void CsrSchedMessageBroadcastStringLog(u16 mi, void *(*msg_build_func)(void *), void *msg_build_ptr, u32 line, - const CsrCharString *file); + const char *file); #define CsrSchedMessageBroadcast(mi, fn, ptr) CsrSchedMessageBroadcastStringLog((mi), (fn), (ptr), __LINE__, __FILE__) #else void CsrSchedMessageBroadcast(u16 mi, @@ -223,7 +223,7 @@ CsrSchedTid CsrSchedTimerSetStringLog(CsrTime delay, u16 fniarg, void *fnvarg, u32 line, - const CsrCharString *file); + const char *file); #define CsrSchedTimerSet(d, fn, fni, fnv) CsrSchedTimerSetStringLog((d), (fn), (fni), (fnv), __LINE__, __FILE__) #else CsrSchedTid CsrSchedTimerSet(CsrTime delay, @@ -249,7 +249,7 @@ CsrBool CsrSchedTimerCancelStringLog(CsrSchedTid eventid, u16 *pmi, void **pmv, u32 line, - const CsrCharString *file); + const char *file); #define CsrSchedTimerCancel(e, pmi, pmv) CsrSchedTimerCancelStringLog((e), (pmi), (pmv), __LINE__, __FILE__) #else CsrBool CsrSchedTimerCancel(CsrSchedTid eventid, @@ -279,10 +279,10 @@ CsrSchedQid CsrSchedTaskQueueGet(void); * Return the queue identifier for the currently running queue * * RETURNS - * CsrCharString - The current task queue identifier, or 0xFFFF if not available. + * char - The current task queue identifier, or 0xFFFF if not available. * *----------------------------------------------------------------------------*/ -CsrCharString* CsrSchedTaskNameGet(CsrSchedQid ); +char* CsrSchedTaskNameGet(CsrSchedQid ); #ifdef __cplusplus diff --git a/drivers/staging/csr/csr_serialize_primitive_types.c b/drivers/staging/csr/csr_serialize_primitive_types.c index 500c46e..2aa9d046 100644 --- a/drivers/staging/csr/csr_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_serialize_primitive_types.c @@ -48,17 +48,17 @@ void CsrMemCpyDes(void *value, u8 *buffer, CsrSize *offset, CsrSize length) } EXPORT_SYMBOL_GPL(CsrMemCpyDes); -void CsrCharStringDes(CsrCharString **value, u8 *buffer, CsrSize *offset) +void CsrCharStringDes(char **value, u8 *buffer, CsrSize *offset) { - *value = CsrStrDup((CsrCharString *) &buffer[*offset]); + *value = CsrStrDup((char *) &buffer[*offset]); *offset += CsrStrLen(*value) + 1; } EXPORT_SYMBOL_GPL(CsrCharStringDes); void CsrUtf8StringDes(u8 **value, u8 *buffer, CsrSize *offset) { - *value = (u8 *) CsrStrDup((CsrCharString *) &buffer[*offset]); - *offset += CsrStrLen((CsrCharString *) *value) + 1; + *value = (u8 *) CsrStrDup((char *) &buffer[*offset]); + *offset += CsrStrLen((char *) *value) + 1; } void CsrUtf16StringDes(u16 **value, u8 *buffer, CsrSize *offset) @@ -120,11 +120,11 @@ void CsrMemCpySer(u8 *buffer, CsrSize *offset, const void *value, CsrSize length } EXPORT_SYMBOL_GPL(CsrMemCpySer); -void CsrCharStringSer(u8 *buffer, CsrSize *offset, const CsrCharString *value) +void CsrCharStringSer(u8 *buffer, CsrSize *offset, const char *value) { if (value) { - CsrStrCpy(((CsrCharString *) &buffer[*offset]), value); + CsrStrCpy(((char *) &buffer[*offset]), value); *offset += CsrStrLen(value) + 1; } else @@ -136,7 +136,7 @@ EXPORT_SYMBOL_GPL(CsrCharStringSer); void CsrUtf8StringSer(u8 *buffer, CsrSize *offset, const u8 *value) { - CsrCharStringSer(buffer, offset, (CsrCharString *) value); + CsrCharStringSer(buffer, offset, (char *) value); } void CsrUtf16StringSer(u8 *buffer, CsrSize *offset, const u16 *value) @@ -173,7 +173,7 @@ void CsrVoidPtrSer(u8 *buffer, CsrSize *offset, void *ptr) CsrSizeSer(buffer, offset, (CsrSize) ptr); } -u32 CsrCharStringSerLen(const CsrCharString *str) +u32 CsrCharStringSerLen(const char *str) { if (str) { @@ -189,7 +189,7 @@ u32 CsrUtf8StringSerLen(const u8 *str) { if (str) { - return (u32) (CsrStrLen((CsrCharString *) str) + sizeof(*str)); + return (u32) (CsrStrLen((char *) str) + sizeof(*str)); } else { diff --git a/drivers/staging/csr/csr_types.h b/drivers/staging/csr/csr_types.h index 56ce834..0b5a231 100644 --- a/drivers/staging/csr/csr_types.h +++ b/drivers/staging/csr/csr_types.h @@ -35,9 +35,6 @@ typedef ptrdiff_t CsrIntptr; /* intptr_t is not defined in kernel. Use the eq /* Boolean */ typedef u8 CsrBool; -/* String types */ -typedef char CsrCharString; - /* * 64-bit integers * diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index dfd63b4..3064536 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -574,7 +574,7 @@ u16 *CsrUtf82Utf16String(const u8 *utf8String) { return NULL; } - sourceLength = CsrStrLen((CsrCharString *) utf8String); + sourceLength = CsrStrLen((char *) utf8String); for (i = 0; i < sourceLength; i++) { @@ -1018,12 +1018,12 @@ u16 *CsrXML2Utf16String(u16 *str) s32 CsrUtf8StrCmp(const u8 *string1, const u8 *string2) { - return CsrStrCmp((const CsrCharString *) string1, (const CsrCharString *) string2); + return CsrStrCmp((const char *) string1, (const char *) string2); } s32 CsrUtf8StrNCmp(const u8 *string1, const u8 *string2, CsrSize count) { - return CsrStrNCmp((const CsrCharString *) string1, (const CsrCharString *) string2, count); + return CsrStrNCmp((const char *) string1, (const char *) string2, count); } u32 CsrUtf8StringLengthInBytes(const u8 *string) @@ -1031,14 +1031,14 @@ u32 CsrUtf8StringLengthInBytes(const u8 *string) CsrSize length = 0; if (string) { - length = CsrStrLen((const CsrCharString *) string); + length = CsrStrLen((const char *) string); } return (u32) length; } u8 *CsrUtf8StrCpy(u8 *target, const u8 *source) { - return (u8 *) CsrStrCpy((CsrCharString *) target, (const CsrCharString *) source); + return (u8 *) CsrStrCpy((char *) target, (const char *) source); } u8 *CsrUtf8StrTruncate(u8 *target, CsrSize count) @@ -1072,12 +1072,12 @@ u8 *CsrUtf8StrTruncate(u8 *target, CsrSize count) u8 *CsrUtf8StrNCpy(u8 *target, const u8 *source, CsrSize count) { - return (u8 *) CsrStrNCpy((CsrCharString *) target, (const CsrCharString *) source, count); + return (u8 *) CsrStrNCpy((char *) target, (const char *) source, count); } u8 *CsrUtf8StrNCpyZero(u8 *target, const u8 *source, CsrSize count) { - CsrStrNCpy((CsrCharString *) target, (const CsrCharString *) source, count); + CsrStrNCpy((char *) target, (const char *) source, count); if (target[count - 1] != '\0') { CsrUtf8StrTruncate(target, count - 1); @@ -1087,7 +1087,7 @@ u8 *CsrUtf8StrNCpyZero(u8 *target, const u8 *source, CsrSize count) u8 *CsrUtf8StrDup(const u8 *source) { - return (u8 *) CsrStrDup((const CsrCharString *) source); + return (u8 *) CsrStrDup((const char *) source); } u8 *CsrUtf8StringConcatenateTexts(const u8 *inputText1, const u8 *inputText2, const u8 *inputText3, const u8 *inputText4) diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index 170deac..e381f25 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -53,7 +53,7 @@ u8 CsrBitCountDense(u32 n) /*------------------------------------------------------------------*/ /* Base conversion */ /*------------------------------------------------------------------*/ -CsrBool CsrHexStrToUint8(const CsrCharString *string, u8 *returnValue) +CsrBool CsrHexStrToUint8(const char *string, u8 *returnValue) { u16 currentIndex = 0; *returnValue = 0; @@ -77,7 +77,7 @@ CsrBool CsrHexStrToUint8(const CsrCharString *string, u8 *returnValue) return FALSE; } -CsrBool CsrHexStrToUint16(const CsrCharString *string, u16 *returnValue) +CsrBool CsrHexStrToUint16(const char *string, u16 *returnValue) { u16 currentIndex = 0; *returnValue = 0; @@ -101,7 +101,7 @@ CsrBool CsrHexStrToUint16(const CsrCharString *string, u16 *returnValue) return FALSE; } -CsrBool CsrHexStrToUint32(const CsrCharString *string, u32 *returnValue) +CsrBool CsrHexStrToUint32(const char *string, u32 *returnValue) { u16 currentIndex = 0; *returnValue = 0; @@ -145,11 +145,11 @@ u32 CsrPow(u32 base, u32 exponent) /* Convert signed 32 bit (or less) integer to string */ #define I2B10_MAX 12 -void CsrIntToBase10(s32 number, CsrCharString *str) +void CsrIntToBase10(s32 number, char *str) { s32 digit; u8 index; - CsrCharString res[I2B10_MAX]; + char res[I2B10_MAX]; CsrBool foundDigit = FALSE; for (digit = 0; digit < I2B10_MAX; digit++) @@ -190,7 +190,7 @@ void CsrIntToBase10(s32 number, CsrCharString *str) CsrStrCpy(str, res); } -void CsrUInt16ToHex(u16 number, CsrCharString *str) +void CsrUInt16ToHex(u16 number, char *str) { u16 index; u16 currentValue; @@ -204,7 +204,7 @@ void CsrUInt16ToHex(u16 number, CsrCharString *str) str[4] = '\0'; } -void CsrUInt32ToHex(u32 number, CsrCharString *str) +void CsrUInt32ToHex(u32 number, char *str) { u16 index; u32 currentValue; @@ -261,61 +261,61 @@ void *CsrMemDup(const void *buf1, CsrSize count) #endif #ifndef CSR_USE_STDC_LIB -CsrCharString *CsrStrCpy(CsrCharString *dest, const CsrCharString *src) +char *CsrStrCpy(char *dest, const char *src) { return strcpy(dest, src); } -CsrCharString *CsrStrNCpy(CsrCharString *dest, const CsrCharString *src, CsrSize count) +char *CsrStrNCpy(char *dest, const char *src, CsrSize count) { return strncpy(dest, src, count); } -CsrCharString *CsrStrCat(CsrCharString *dest, const CsrCharString *src) +char *CsrStrCat(char *dest, const char *src) { return strcat(dest, src); } -CsrCharString *CsrStrNCat(CsrCharString *dest, const CsrCharString *src, CsrSize count) +char *CsrStrNCat(char *dest, const char *src, CsrSize count) { return strncat(dest, src, count); } -CsrCharString *CsrStrStr(const CsrCharString *string1, const CsrCharString *string2) +char *CsrStrStr(const char *string1, const char *string2) { return strstr(string1, string2); } -CsrSize CsrStrLen(const CsrCharString *string) +CsrSize CsrStrLen(const char *string) { return strlen(string); } EXPORT_SYMBOL_GPL(CsrStrLen); -s32 CsrStrCmp(const CsrCharString *string1, const CsrCharString *string2) +s32 CsrStrCmp(const char *string1, const char *string2) { return strcmp(string1, string2); } -s32 CsrStrNCmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count) +s32 CsrStrNCmp(const char *string1, const char *string2, CsrSize count) { return strncmp(string1, string2, count); } -CsrCharString *CsrStrChr(const CsrCharString *string, CsrCharString c) +char *CsrStrChr(const char *string, char c) { return strchr(string, c); } #endif -s32 CsrVsnprintf(CsrCharString *string, CsrSize count, const CsrCharString *format, va_list args) +s32 CsrVsnprintf(char *string, CsrSize count, const char *format, va_list args) { return vsnprintf(string, count, format, args); } EXPORT_SYMBOL_GPL(CsrVsnprintf); -CsrCharString *CsrStrNCpyZero(CsrCharString *dest, - const CsrCharString *src, +char *CsrStrNCpyZero(char *dest, + const char *src, CsrSize count) { CsrStrNCpy(dest, src, count - 1); @@ -324,7 +324,7 @@ CsrCharString *CsrStrNCpyZero(CsrCharString *dest, } /* Convert string with base 10 to integer */ -u32 CsrStrToInt(const CsrCharString *str) +u32 CsrStrToInt(const char *str) { s16 i; u32 res; @@ -347,9 +347,9 @@ u32 CsrStrToInt(const CsrCharString *str) return res; } -CsrCharString *CsrStrDup(const CsrCharString *string) +char *CsrStrDup(const char *string) { - CsrCharString *copy; + char *copy; u32 len; copy = NULL; @@ -362,8 +362,8 @@ CsrCharString *CsrStrDup(const CsrCharString *string) return copy; } -int CsrStrNICmp(const CsrCharString *string1, - const CsrCharString *string2, +int CsrStrNICmp(const char *string1, + const char *string2, CsrSize count) { u32 index; @@ -391,10 +391,10 @@ int CsrStrNICmp(const CsrCharString *string1, return returnValue; } -const CsrCharString *CsrGetBaseName(const CsrCharString *file) +const char *CsrGetBaseName(const char *file) { - const CsrCharString *pch; - static const CsrCharString dotDir[] = "."; + const char *pch; + static const char dotDir[] = "."; if (!file) { diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index 0d01127..e0bcca2 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -26,13 +26,13 @@ u8 CsrBitCountDense(u32 n); /*------------------------------------------------------------------*/ /* Base conversion */ /*------------------------------------------------------------------*/ -CsrBool CsrHexStrToUint8(const CsrCharString *string, u8 *returnValue); -CsrBool CsrHexStrToUint16(const CsrCharString *string, u16 *returnValue); -CsrBool CsrHexStrToUint32(const CsrCharString *string, u32 *returnValue); +CsrBool CsrHexStrToUint8(const char *string, u8 *returnValue); +CsrBool CsrHexStrToUint16(const char *string, u16 *returnValue); +CsrBool CsrHexStrToUint32(const char *string, u32 *returnValue); u32 CsrPow(u32 base, u32 exponent); -void CsrIntToBase10(s32 number, CsrCharString *str); -void CsrUInt16ToHex(u16 number, CsrCharString *str); -void CsrUInt32ToHex(u32 number, CsrCharString *str); +void CsrIntToBase10(s32 number, char *str); +void CsrUInt16ToHex(u16 number, char *str); +void CsrUInt32ToHex(u32 number, char *str); /*------------------------------------------------------------------*/ /* Standard C Library functions */ @@ -54,33 +54,33 @@ void CsrUInt32ToHex(u32 number, CsrCharString *str); #else /* !CSR_USE_STDC_LIB */ void *CsrMemCpy(void *dest, const void *src, CsrSize count); void *CsrMemMove(void *dest, const void *src, CsrSize count); -CsrCharString *CsrStrCpy(CsrCharString *dest, const CsrCharString *src); -CsrCharString *CsrStrNCpy(CsrCharString *dest, const CsrCharString *src, CsrSize count); -CsrCharString *CsrStrCat(CsrCharString *dest, const CsrCharString *src); -CsrCharString *CsrStrNCat(CsrCharString *dest, const CsrCharString *src, CsrSize count); +char *CsrStrCpy(char *dest, const char *src); +char *CsrStrNCpy(char *dest, const char *src, CsrSize count); +char *CsrStrCat(char *dest, const char *src); +char *CsrStrNCat(char *dest, const char *src, CsrSize count); s32 CsrMemCmp(const void *buf1, const void *buf2, CsrSize count); -s32 CsrStrCmp(const CsrCharString *string1, const CsrCharString *string2); -s32 CsrStrNCmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count); -CsrCharString *CsrStrChr(const CsrCharString *string, CsrCharString c); -CsrCharString *CsrStrStr(const CsrCharString *string1, const CsrCharString *string2); +s32 CsrStrCmp(const char *string1, const char *string2); +s32 CsrStrNCmp(const char *string1, const char *string2, CsrSize count); +char *CsrStrChr(const char *string, char c); +char *CsrStrStr(const char *string1, const char *string2); void *CsrMemSet(void *dest, u8 c, CsrSize count); -CsrSize CsrStrLen(const CsrCharString *string); +CsrSize CsrStrLen(const char *string); #endif /* !CSR_USE_STDC_LIB */ -s32 CsrVsnprintf(CsrCharString *string, CsrSize count, const CsrCharString *format, va_list args); +s32 CsrVsnprintf(char *string, CsrSize count, const char *format, va_list args); /*------------------------------------------------------------------*/ /* Non-standard utility functions */ /*------------------------------------------------------------------*/ void *CsrMemDup(const void *buf1, CsrSize count); -int CsrStrNICmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count); -CsrCharString *CsrStrDup(const CsrCharString *string); -u32 CsrStrToInt(const CsrCharString *string); -CsrCharString *CsrStrNCpyZero(CsrCharString *dest, const CsrCharString *src, CsrSize count); +int CsrStrNICmp(const char *string1, const char *string2, CsrSize count); +char *CsrStrDup(const char *string); +u32 CsrStrToInt(const char *string); +char *CsrStrNCpyZero(char *dest, const char *src, CsrSize count); /*------------------------------------------------------------------*/ /* Filename */ /*------------------------------------------------------------------*/ -const CsrCharString *CsrGetBaseName(const CsrCharString *file); +const char *CsrGetBaseName(const char *file); /*------------------------------------------------------------------*/ /* Misc */ diff --git a/drivers/staging/csr/csr_wifi_fsm_types.h b/drivers/staging/csr/csr_wifi_fsm_types.h index 63b69fe..558fd2d 100644 --- a/drivers/staging/csr/csr_wifi_fsm_types.h +++ b/drivers/staging/csr/csr_wifi_fsm_types.h @@ -205,7 +205,7 @@ typedef struct u32 eventid; CsrWifiFsmTransitionFnPtr transition; #ifdef CSR_LOG_ENABLE - const CsrCharString *transitionName; + const char *transitionName; #endif } CsrWifiFsmEventEntry; @@ -224,7 +224,7 @@ typedef struct const CsrWifiFsmEventEntry *eventEntryArray; /* array of transition function pointers for state */ #ifdef CSR_LOG_ENABLE u16 stateNumber; - const CsrCharString *stateName; + const char *stateName; #endif } CsrWifiFsmTableEntry; @@ -252,7 +252,7 @@ typedef struct */ typedef struct { - const CsrCharString *processName; + const char *processName; const u32 processId; const CsrWifiFsmTransitionFunctionTable transitionTable; const CsrWifiFsmTableEntry unhandledTransitions; @@ -278,7 +278,7 @@ typedef struct CsrWifiFsmTransitionFnPtr transitionFn; u16 transitionCount; /* number consecutive of times this transition was seen */ #ifdef CSR_LOG_ENABLE - const CsrCharString *transitionName; + const char *transitionName; #endif } CsrWifiFsmTransitionRecord; diff --git a/drivers/staging/csr/csr_wifi_hip_card.h b/drivers/staging/csr/csr_wifi_hip_card.h index 481ba68..348572f 100644 --- a/drivers/staging/csr/csr_wifi_hip_card.h +++ b/drivers/staging/csr/csr_wifi_hip_card.h @@ -110,9 +110,9 @@ CsrResult unifi_coredump_handle_request(card_t *card); CsrResult ConvertCsrSdioToCsrHipResult(card_t *card, CsrResult csrResult); #ifdef CSR_WIFI_HIP_DEBUG_OFFLINE -void unifi_debug_log_to_buf(const CsrCharString *fmt, ...); -void unifi_debug_string_to_buf(const CsrCharString *str); -void unifi_debug_hex_to_buf(const CsrCharString *buff, u16 length); +void unifi_debug_log_to_buf(const char *fmt, ...); +void unifi_debug_string_to_buf(const char *str); +void unifi_debug_hex_to_buf(const char *buff, u16 length); #endif diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.c b/drivers/staging/csr/csr_wifi_hip_card_sdio.c index 4c31a214..07b3ac8 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.c @@ -3900,7 +3900,7 @@ CsrResult unifi_set_host_state(card_t *card, enum unifi_host_state state) { CsrResult r = CSR_RESULT_SUCCESS; CsrResult csrResult; - static const CsrCharString *const states[] = { + static const char *const states[] = { "AWAKE", "DROWSY", "TORPID" }; static const u8 state_csr_host_wakeup[] = { diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.h b/drivers/staging/csr/csr_wifi_hip_card_sdio.h index 036258a..ad5f131 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.h +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.h @@ -269,7 +269,7 @@ typedef struct u16 q_wr_ptr; u16 q_rd_ptr; - CsrCharString name[UNIFI_QUEUE_NAME_MAX_LENGTH]; + char name[UNIFI_QUEUE_NAME_MAX_LENGTH]; } q_t; @@ -412,7 +412,7 @@ struct card /* Info read from Symbol Table during probe */ u32 build_id; - CsrCharString build_id_string[128]; + char build_id_string[128]; /* Retrieve from SDIO driver. */ u16 chip_id; diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c index 4cf84d5..1bc97ac 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c @@ -81,11 +81,11 @@ s16 dump_fh_buf = 0; */ #define UNIFI_DEBUG_GBUFFER_SIZE 8192 -static CsrCharString unifi_debug_output[UNIFI_DEBUG_GBUFFER_SIZE]; -static CsrCharString *unifi_dbgbuf_ptr = unifi_debug_output; -static CsrCharString *unifi_dbgbuf_start = unifi_debug_output; +static char unifi_debug_output[UNIFI_DEBUG_GBUFFER_SIZE]; +static char *unifi_dbgbuf_ptr = unifi_debug_output; +static char *unifi_dbgbuf_start = unifi_debug_output; -static void append_char(CsrCharString c) +static void append_char(char c) { /* write char and advance pointer */ *unifi_dbgbuf_ptr++ = c; @@ -97,9 +97,9 @@ static void append_char(CsrCharString c) } /* append_char() */ -void unifi_debug_string_to_buf(const CsrCharString *str) +void unifi_debug_string_to_buf(const char *str) { - const CsrCharString *p = str; + const char *p = str; while (*p) { append_char(*p); @@ -114,10 +114,10 @@ void unifi_debug_string_to_buf(const CsrCharString *str) } -void unifi_debug_log_to_buf(const CsrCharString *fmt, ...) +void unifi_debug_log_to_buf(const char *fmt, ...) { #define DEBUG_BUFFER_SIZE 80 - static CsrCharString s[DEBUG_BUFFER_SIZE]; + static char s[DEBUG_BUFFER_SIZE]; va_list args; va_start(args, fmt); @@ -143,9 +143,9 @@ void unifi_debug_log_to_buf(const CsrCharString *fmt, ...) * * --------------------------------------------------------------------------- */ -void unifi_debug_hex_to_buf(const CsrCharString *buff, u16 length) +void unifi_debug_hex_to_buf(const char *buff, u16 length) { - CsrCharString s[5]; + char s[5]; u16 i; for (i = 0; i < length; i = i + 2) diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper.h b/drivers/staging/csr/csr_wifi_hip_chiphelper.h index dbf7c0e..1047f16 100644 --- a/drivers/staging/csr/csr_wifi_hip_chiphelper.h +++ b/drivers/staging/csr/csr_wifi_hip_chiphelper.h @@ -196,8 +196,8 @@ ChipDescript* ChipHelper_GetVersionBlueCore(enum chip_helper_bluecore_age age, parameter is the name of the parameter. The bodies of these functions are hand written. */ #define CHIP_HELPER_LIST(m) \ - CHIP_HELPER_DEF0(m, (const CsrCharString *, FriendlyName, friendly_name)) \ - CHIP_HELPER_DEF0(m, (const CsrCharString *, MarketingName, marketing_name)) \ + CHIP_HELPER_DEF0(m, (const char *, FriendlyName, friendly_name)) \ + CHIP_HELPER_DEF0(m, (const char *, MarketingName, marketing_name)) \ CHIP_HELPER_DEF0(m, (u16, DBG_EMU_CMD, regs->dbg_emu_cmd)) \ CHIP_HELPER_DEF0(m, (u16, DBG_HOST_PROC_SELECT, regs->host.dbg_proc_select)) \ CHIP_HELPER_DEF0(m, (u16, DBG_HOST_STOP_STATUS, regs->host.dbg_stop_status)) \ diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h b/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h index 93e30b6..cb0ea4b 100644 --- a/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h +++ b/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h @@ -151,9 +151,9 @@ struct chip_device_desc_t struct chip_version_t chip_version; /* This is a text string that a human might find useful (BC02, UF105x) */ - const CsrCharString *friendly_name; + const char *friendly_name; /* This is what we show to customers */ - const CsrCharString *marketing_name; + const char *marketing_name; /* Initialisation values to write following a reset */ struct val_array_t init; diff --git a/drivers/staging/csr/csr_wifi_hip_udi.c b/drivers/staging/csr/csr_wifi_hip_udi.c index 0ea60f5..07cfd36 100644 --- a/drivers/staging/csr/csr_wifi_hip_udi.c +++ b/drivers/staging/csr/csr_wifi_hip_udi.c @@ -41,9 +41,9 @@ * None. * --------------------------------------------------------------------------- */ -s32 unifi_print_status(card_t *card, CsrCharString *str, s32 *remain) +s32 unifi_print_status(card_t *card, char *str, s32 *remain) { - CsrCharString *p = str; + char *p = str; sdio_config_data_t *cfg; u16 i, n; s32 remaining = *remain; @@ -51,7 +51,7 @@ s32 unifi_print_status(card_t *card, CsrCharString *str, s32 *remain) #ifdef CSR_UNSAFE_SDIO_ACCESS s32 iostate; CsrResult r; - static const CsrCharString *const states[] = { + static const char *const states[] = { "AWAKE", "DROWSY", "TORPID" }; #define SHARED_READ_RETRY_LIMIT 10 diff --git a/drivers/staging/csr/csr_wifi_hip_unifi.h b/drivers/staging/csr/csr_wifi_hip_unifi.h index 892686f..50d458e 100644 --- a/drivers/staging/csr/csr_wifi_hip_unifi.h +++ b/drivers/staging/csr/csr_wifi_hip_unifi.h @@ -859,13 +859,13 @@ void unifi_request_max_sdio_clock(card_t *card); /* Functions to lookup bulk data command names. */ -const CsrCharString* lookup_bulkcmd_name(u16 id); +const char* lookup_bulkcmd_name(u16 id); /* Function to log HIP's global debug buffer */ #ifdef CSR_WIFI_HIP_DEBUG_OFFLINE void unifi_debug_buf_dump(void); -void unifi_debug_log_to_buf(const CsrCharString *fmt, ...); -void unifi_debug_hex_to_buf(const CsrCharString *buff, u16 length); +void unifi_debug_log_to_buf(const char *fmt, ...); +void unifi_debug_hex_to_buf(const char *buff, u16 length); #endif /* Mini-coredump utility functions */ diff --git a/drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c b/drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c index 8bc968c..7c13df2 100644 --- a/drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c +++ b/drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c @@ -13,7 +13,7 @@ struct sig_name { s16 id; - const CsrCharString *name; + const char *name; }; static const struct sig_name Unifi_bulkcmd_names[] = { @@ -29,7 +29,7 @@ static const struct sig_name Unifi_bulkcmd_names[] = { { 15, "Padding" } }; -const CsrCharString* lookup_bulkcmd_name(u16 id) +const char* lookup_bulkcmd_name(u16 id) { if (id < 9) { diff --git a/drivers/staging/csr/csr_wifi_hip_unifi_udi.h b/drivers/staging/csr/csr_wifi_hip_unifi_udi.h index 79f0810..83032d0 100644 --- a/drivers/staging/csr/csr_wifi_hip_unifi_udi.h +++ b/drivers/staging/csr/csr_wifi_hip_unifi_udi.h @@ -51,7 +51,7 @@ CsrResult unifi_remove_udi_hook(card_t *card, udi_func_t udi_fn); * This is used in the linux /proc interface and might be useful * in other systems. */ -s32 unifi_print_status(card_t *card, CsrCharString *str, s32 *remain); +s32 unifi_print_status(card_t *card, char *str, s32 *remain); #define UNIFI_SNPRINTF_RET(buf_p, remain, written) \ do { \ diff --git a/drivers/staging/csr/csr_wifi_hip_xbv.c b/drivers/staging/csr/csr_wifi_hip_xbv.c index 1e50429..2c0e4666 100644 --- a/drivers/staging/csr/csr_wifi_hip_xbv.c +++ b/drivers/staging/csr/csr_wifi_hip_xbv.c @@ -52,7 +52,7 @@ typedef struct /* Struct to represent a TLV field */ typedef struct { - CsrCharString t_name[4]; + char t_name[4]; u32 t_len; } tag_t; @@ -105,9 +105,9 @@ static u32 write_uint32(void *buf, const u32 offset, static u32 write_bytes(void *buf, const u32 offset, const u8 *data, const u32 len); static u32 write_tag(void *buf, const u32 offset, - const CsrCharString *tag_str); + const char *tag_str); static u32 write_chunk(void *buf, const u32 offset, - const CsrCharString *tag_str, + const char *tag_str, const u32 payload_len); static u16 calc_checksum(void *buf, const u32 offset, const u32 bytes_len); @@ -227,7 +227,7 @@ CsrResult xbv1_parse(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwin } else if (TAG_EQ(tag.t_name, "LIST")) { - CsrCharString name[4]; + char name[4]; u32 list_end; list_end = ct.ioffset + tag.t_len; @@ -598,7 +598,7 @@ static u32 write_bytes(void *buf, const u32 offset, const u8 *data, const u32 le } -static u32 write_tag(void *buf, const u32 offset, const CsrCharString *tag_str) +static u32 write_tag(void *buf, const u32 offset, const char *tag_str) { u8 *dst = (u8 *)buf + offset; CsrMemCpy(dst, tag_str, 4); @@ -606,7 +606,7 @@ static u32 write_tag(void *buf, const u32 offset, const CsrCharString *tag_str) } -static u32 write_chunk(void *buf, const u32 offset, const CsrCharString *tag_str, const u32 payload_len) +static u32 write_chunk(void *buf, const u32 offset, const char *tag_str, const u32 payload_len) { u32 written = 0; written += write_tag(buf, offset, tag_str); @@ -681,9 +681,9 @@ static u32 write_xbv_header(void *buf, const u32 offset, const u32 file_payload_ * contents of the file, excluding the 8 byte size of the XBV1 header itself * (The added 6 bytes thus accounts for the size of the VERF) */ - written += write_chunk(buf, offset + written, (CsrCharString *)"XBV1", file_payload_length + 6); + written += write_chunk(buf, offset + written, (char *)"XBV1", file_payload_length + 6); - written += write_chunk(buf, offset + written, (CsrCharString *)"VERF", 2); + written += write_chunk(buf, offset + written, (char *)"VERF", 2); written += write_uint16(buf, offset + written, 0); /* File version */ return written; @@ -695,10 +695,10 @@ static u32 write_ptch_header(void *buf, const u32 offset, const u32 fw_id) u32 written = 0; /* LIST is written with a zero length, to be updated later */ - written += write_chunk(buf, offset + written, (CsrCharString *)"LIST", 0); - written += write_tag(buf, offset + written, (CsrCharString *)"PTCH"); /* List type */ + written += write_chunk(buf, offset + written, (char *)"LIST", 0); + written += write_tag(buf, offset + written, (char *)"PTCH"); /* List type */ - written += write_chunk(buf, offset + written, (CsrCharString *)"FWID", 4); + written += write_chunk(buf, offset + written, (char *)"FWID", 4); written += write_uint32(buf, offset + written, fw_id); @@ -761,7 +761,7 @@ static u32 write_fwdl_to_ptdl(void *buf, const u32 offset, fwreadfn_t readfn, sec_len = sec_data_len + PTDL_HDR_SIZE; /* Write PTDL header + entire PTDL size */ - written += write_chunk(buf, offset + written, (CsrCharString *)"PTDL", sec_len); + written += write_chunk(buf, offset + written, (char *)"PTDL", sec_len); /* bug digest implies 4 bytes of padding here, but that seems wrong */ /* Checksum starts here */ @@ -820,7 +820,7 @@ static u32 write_reset_ptdl(void *buf, const u32 offset, const xbv1_t *fwinfo, u sec_len = SEC_CMD_LEN + PTDL_VEC_HDR_SIZE; /* Total section byte length */ /* Write PTDL header + entire PTDL size */ - written += write_chunk(buf, offset + written, (CsrCharString *)"PTDL", sec_len); + written += write_chunk(buf, offset + written, (char *)"PTDL", sec_len); /* Checksum starts here */ csum_start_offs = offset + written; diff --git a/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c b/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c index 3757409..fed0e65 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c +++ b/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c @@ -76,7 +76,7 @@ void CsrWifiNmeApConverterInit(void) #ifdef CSR_LOG_ENABLE static const CsrLogPrimitiveInformation csrwifinmeap_conv_info = { CSR_WIFI_NME_AP_PRIM, - (CsrCharString *)"CSR_WIFI_NME_AP_PRIM", + (char *)"CSR_WIFI_NME_AP_PRIM", csrwifinmeap_conv_lut }; const CsrLogPrimitiveInformation* CsrWifiNmeApTechInfoGet(void) diff --git a/drivers/staging/csr/csr_wifi_nme_ap_lib.h b/drivers/staging/csr/csr_wifi_nme_ap_lib.h index 4523065..a74ec69 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_lib.h +++ b/drivers/staging/csr/csr_wifi_nme_ap_lib.h @@ -63,20 +63,20 @@ void CsrWifiNmeApFreeDownstreamMessageContents(u16 eventClass, void *message); /*----------------------------------------------------------------------------* * Enum to string functions *----------------------------------------------------------------------------*/ -const CsrCharString* CsrWifiNmeApPersCredentialTypeToString(CsrWifiNmeApPersCredentialType value); +const char* CsrWifiNmeApPersCredentialTypeToString(CsrWifiNmeApPersCredentialType value); /*----------------------------------------------------------------------------* * CsrPrim Type toString function. * Converts a message type to the String name of the Message *----------------------------------------------------------------------------*/ -const CsrCharString* CsrWifiNmeApPrimTypeToString(CsrPrim msgType); +const char* CsrWifiNmeApPrimTypeToString(CsrPrim msgType); /*----------------------------------------------------------------------------* * Lookup arrays for PrimType name Strings *----------------------------------------------------------------------------*/ -extern const CsrCharString *CsrWifiNmeApUpstreamPrimNames[CSR_WIFI_NME_AP_PRIM_UPSTREAM_COUNT]; -extern const CsrCharString *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_COUNT]; +extern const char *CsrWifiNmeApUpstreamPrimNames[CSR_WIFI_NME_AP_PRIM_UPSTREAM_COUNT]; +extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_COUNT]; /******************************************************************************* diff --git a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c index b79b8e8..3fecb6f 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c +++ b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c @@ -324,7 +324,7 @@ CsrSize CsrWifiNmeApStartReqSizeof(void *msg) break; case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: bufferSize += 2; /* u16 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.encryptionMode */ - bufferSize += (primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase?CsrStrLen(primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase) : 0) + 1; /* CsrCharString* primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase (0 byte len + 1 for NULL Term) */ + bufferSize += (primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase?CsrStrLen(primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase) : 0) + 1; /* char* primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase (0 byte len + 1 for NULL Term) */ break; default: break; diff --git a/drivers/staging/csr/csr_wifi_nme_lib.h b/drivers/staging/csr/csr_wifi_nme_lib.h index d539d35..c38f78e 100644 --- a/drivers/staging/csr/csr_wifi_nme_lib.h +++ b/drivers/staging/csr/csr_wifi_nme_lib.h @@ -60,32 +60,32 @@ void CsrWifiNmeFreeDownstreamMessageContents(u16 eventClass, void *message); /*----------------------------------------------------------------------------* * Enum to string functions *----------------------------------------------------------------------------*/ -const CsrCharString* CsrWifiNmeAuthModeToString(CsrWifiNmeAuthMode value); -const CsrCharString* CsrWifiNmeBssTypeToString(CsrWifiNmeBssType value); -const CsrCharString* CsrWifiNmeCcxOptionsMaskToString(CsrWifiNmeCcxOptionsMask value); -const CsrCharString* CsrWifiNmeConfigActionToString(CsrWifiNmeConfigAction value); -const CsrCharString* CsrWifiNmeConnectionStatusToString(CsrWifiNmeConnectionStatus value); -const CsrCharString* CsrWifiNmeCredentialTypeToString(CsrWifiNmeCredentialType value); -const CsrCharString* CsrWifiNmeEapMethodToString(CsrWifiNmeEapMethod value); -const CsrCharString* CsrWifiNmeEncryptionToString(CsrWifiNmeEncryption value); -const CsrCharString* CsrWifiNmeIndicationsToString(CsrWifiNmeIndications value); -const CsrCharString* CsrWifiNmeSecErrorToString(CsrWifiNmeSecError value); -const CsrCharString* CsrWifiNmeSimCardTypeToString(CsrWifiNmeSimCardType value); -const CsrCharString* CsrWifiNmeUmtsAuthResultToString(CsrWifiNmeUmtsAuthResult value); -const CsrCharString* CsrWifiNmeWmmQosInfoToString(CsrWifiNmeWmmQosInfo value); +const char* CsrWifiNmeAuthModeToString(CsrWifiNmeAuthMode value); +const char* CsrWifiNmeBssTypeToString(CsrWifiNmeBssType value); +const char* CsrWifiNmeCcxOptionsMaskToString(CsrWifiNmeCcxOptionsMask value); +const char* CsrWifiNmeConfigActionToString(CsrWifiNmeConfigAction value); +const char* CsrWifiNmeConnectionStatusToString(CsrWifiNmeConnectionStatus value); +const char* CsrWifiNmeCredentialTypeToString(CsrWifiNmeCredentialType value); +const char* CsrWifiNmeEapMethodToString(CsrWifiNmeEapMethod value); +const char* CsrWifiNmeEncryptionToString(CsrWifiNmeEncryption value); +const char* CsrWifiNmeIndicationsToString(CsrWifiNmeIndications value); +const char* CsrWifiNmeSecErrorToString(CsrWifiNmeSecError value); +const char* CsrWifiNmeSimCardTypeToString(CsrWifiNmeSimCardType value); +const char* CsrWifiNmeUmtsAuthResultToString(CsrWifiNmeUmtsAuthResult value); +const char* CsrWifiNmeWmmQosInfoToString(CsrWifiNmeWmmQosInfo value); /*----------------------------------------------------------------------------* * CsrPrim Type toString function. * Converts a message type to the String name of the Message *----------------------------------------------------------------------------*/ -const CsrCharString* CsrWifiNmePrimTypeToString(CsrPrim msgType); +const char* CsrWifiNmePrimTypeToString(CsrPrim msgType); /*----------------------------------------------------------------------------* * Lookup arrays for PrimType name Strings *----------------------------------------------------------------------------*/ -extern const CsrCharString *CsrWifiNmeUpstreamPrimNames[CSR_WIFI_NME_PRIM_UPSTREAM_COUNT]; -extern const CsrCharString *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_COUNT]; +extern const char *CsrWifiNmeUpstreamPrimNames[CSR_WIFI_NME_PRIM_UPSTREAM_COUNT]; +extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_COUNT]; /******************************************************************************* diff --git a/drivers/staging/csr/csr_wifi_nme_prim.h b/drivers/staging/csr/csr_wifi_nme_prim.h index 2c73943..07ed884 100644 --- a/drivers/staging/csr/csr_wifi_nme_prim.h +++ b/drivers/staging/csr/csr_wifi_nme_prim.h @@ -547,7 +547,7 @@ typedef struct typedef struct { u16 encryptionMode; - CsrCharString *passphrase; + char *passphrase; } CsrWifiNmePassphrase; /******************************************************************************* @@ -708,22 +708,22 @@ typedef struct CsrWifiNmeEapMethodMask eapMethodMask; CsrWifiSmeAuthModeMask authMode; CsrWifiNmeEncryptionMask encryptionMode; - CsrCharString *userName; - CsrCharString *userPassword; - CsrCharString *authServerUserIdentity; + char *userName; + char *userPassword; + char *authServerUserIdentity; u32 clientCertificateLength; u8 *clientCertificate; u32 certificateAuthorityCertificateLength; u8 *certificateAuthorityCertificate; u16 privateKeyLength; u8 *privateKey; - CsrCharString *privateKeyPassword; + char *privateKeyPassword; u32 sessionLength; u8 *session; CsrBool allowPacProvisioning; u32 pacLength; u8 *pac; - CsrCharString *pacPassword; + char *pacPassword; } CsrWifiNmeEapCredentials; /******************************************************************************* @@ -1153,7 +1153,7 @@ typedef struct { CsrWifiFsmEvent common; CsrResult status; - CsrCharString *imsi; + char *imsi; CsrWifiNmeSimCardType cardType; } CsrWifiNmeSimImsiGetRes; diff --git a/drivers/staging/csr/csr_wifi_router_converter_init.c b/drivers/staging/csr/csr_wifi_router_converter_init.c index 048b146..c90d208 100644 --- a/drivers/staging/csr/csr_wifi_router_converter_init.c +++ b/drivers/staging/csr/csr_wifi_router_converter_init.c @@ -70,7 +70,7 @@ void CsrWifiRouterConverterInit(void) #ifdef CSR_LOG_ENABLE static const CsrLogPrimitiveInformation csrwifirouter_conv_info = { CSR_WIFI_ROUTER_PRIM, - (CsrCharString *)"CSR_WIFI_ROUTER_PRIM", + (char *)"CSR_WIFI_ROUTER_PRIM", csrwifirouter_conv_lut }; const CsrLogPrimitiveInformation* CsrWifiRouterTechInfoGet(void) diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c b/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c index 7c3289a..4dd8e6f 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c @@ -123,7 +123,7 @@ void CsrWifiRouterCtrlConverterInit(void) #ifdef CSR_LOG_ENABLE static const CsrLogPrimitiveInformation csrwifirouterctrl_conv_info = { CSR_WIFI_ROUTER_CTRL_PRIM, - (CsrCharString *)"CSR_WIFI_ROUTER_CTRL_PRIM", + (char *)"CSR_WIFI_ROUTER_CTRL_PRIM", csrwifirouterctrl_conv_lut }; const CsrLogPrimitiveInformation* CsrWifiRouterCtrlTechInfoGet(void) diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_lib.h b/drivers/staging/csr/csr_wifi_router_ctrl_lib.h index e7117ee..d837eea 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_lib.h +++ b/drivers/staging/csr/csr_wifi_router_ctrl_lib.h @@ -56,34 +56,34 @@ void CsrWifiRouterCtrlFreeDownstreamMessageContents(u16 eventClass, void *messag /*----------------------------------------------------------------------------* * Enum to string functions *----------------------------------------------------------------------------*/ -const CsrCharString* CsrWifiRouterCtrlBlockAckRoleToString(CsrWifiRouterCtrlBlockAckRole value); -const CsrCharString* CsrWifiRouterCtrlControlIndicationToString(CsrWifiRouterCtrlControlIndication value); -const CsrCharString* CsrWifiRouterCtrlListActionToString(CsrWifiRouterCtrlListAction value); -const CsrCharString* CsrWifiRouterCtrlLowPowerModeToString(CsrWifiRouterCtrlLowPowerMode value); -const CsrCharString* CsrWifiRouterCtrlMediaStatusToString(CsrWifiRouterCtrlMediaStatus value); -const CsrCharString* CsrWifiRouterCtrlModeToString(CsrWifiRouterCtrlMode value); -const CsrCharString* CsrWifiRouterCtrlPeerStatusToString(CsrWifiRouterCtrlPeerStatus value); -const CsrCharString* CsrWifiRouterCtrlPortActionToString(CsrWifiRouterCtrlPortAction value); -const CsrCharString* CsrWifiRouterCtrlPowersaveTypeToString(CsrWifiRouterCtrlPowersaveType value); -const CsrCharString* CsrWifiRouterCtrlProtocolDirectionToString(CsrWifiRouterCtrlProtocolDirection value); -const CsrCharString* CsrWifiRouterCtrlQoSControlToString(CsrWifiRouterCtrlQoSControl value); -const CsrCharString* CsrWifiRouterCtrlQueueConfigToString(CsrWifiRouterCtrlQueueConfig value); -const CsrCharString* CsrWifiRouterCtrlTrafficConfigTypeToString(CsrWifiRouterCtrlTrafficConfigType value); -const CsrCharString* CsrWifiRouterCtrlTrafficPacketTypeToString(CsrWifiRouterCtrlTrafficPacketType value); -const CsrCharString* CsrWifiRouterCtrlTrafficTypeToString(CsrWifiRouterCtrlTrafficType value); +const char* CsrWifiRouterCtrlBlockAckRoleToString(CsrWifiRouterCtrlBlockAckRole value); +const char* CsrWifiRouterCtrlControlIndicationToString(CsrWifiRouterCtrlControlIndication value); +const char* CsrWifiRouterCtrlListActionToString(CsrWifiRouterCtrlListAction value); +const char* CsrWifiRouterCtrlLowPowerModeToString(CsrWifiRouterCtrlLowPowerMode value); +const char* CsrWifiRouterCtrlMediaStatusToString(CsrWifiRouterCtrlMediaStatus value); +const char* CsrWifiRouterCtrlModeToString(CsrWifiRouterCtrlMode value); +const char* CsrWifiRouterCtrlPeerStatusToString(CsrWifiRouterCtrlPeerStatus value); +const char* CsrWifiRouterCtrlPortActionToString(CsrWifiRouterCtrlPortAction value); +const char* CsrWifiRouterCtrlPowersaveTypeToString(CsrWifiRouterCtrlPowersaveType value); +const char* CsrWifiRouterCtrlProtocolDirectionToString(CsrWifiRouterCtrlProtocolDirection value); +const char* CsrWifiRouterCtrlQoSControlToString(CsrWifiRouterCtrlQoSControl value); +const char* CsrWifiRouterCtrlQueueConfigToString(CsrWifiRouterCtrlQueueConfig value); +const char* CsrWifiRouterCtrlTrafficConfigTypeToString(CsrWifiRouterCtrlTrafficConfigType value); +const char* CsrWifiRouterCtrlTrafficPacketTypeToString(CsrWifiRouterCtrlTrafficPacketType value); +const char* CsrWifiRouterCtrlTrafficTypeToString(CsrWifiRouterCtrlTrafficType value); /*----------------------------------------------------------------------------* * CsrPrim Type toString function. * Converts a message type to the String name of the Message *----------------------------------------------------------------------------*/ -const CsrCharString* CsrWifiRouterCtrlPrimTypeToString(CsrPrim msgType); +const char* CsrWifiRouterCtrlPrimTypeToString(CsrPrim msgType); /*----------------------------------------------------------------------------* * Lookup arrays for PrimType name Strings *----------------------------------------------------------------------------*/ -extern const CsrCharString *CsrWifiRouterCtrlUpstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_COUNT]; -extern const CsrCharString *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT]; +extern const char *CsrWifiRouterCtrlUpstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_COUNT]; +extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT]; /******************************************************************************* diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_prim.h b/drivers/staging/csr/csr_wifi_router_ctrl_prim.h index 83b9c41..076ef53 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_prim.h +++ b/drivers/staging/csr/csr_wifi_router_ctrl_prim.h @@ -468,7 +468,7 @@ typedef u8 CsrWifiRouterCtrlTrafficStreamId; typedef struct { u32 firmwarePatch; - CsrCharString *smeBuild; + char *smeBuild; u32 smeHip; } CsrWifiRouterCtrlSmeVersions; @@ -564,7 +564,7 @@ typedef struct u32 chipVersion; u32 firmwareBuild; u32 firmwareHip; - CsrCharString *routerBuild; + char *routerBuild; u32 routerHip; } CsrWifiRouterCtrlVersions; diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c index 6befbd8..2dca1ea 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c @@ -732,7 +732,7 @@ CsrSize CsrWifiRouterCtrlWifiOnResSizeof(void *msg) } } bufferSize += 4; /* u32 primitive->smeVersions.firmwarePatch */ - bufferSize += (primitive->smeVersions.smeBuild?CsrStrLen(primitive->smeVersions.smeBuild) : 0) + 1; /* CsrCharString* primitive->smeVersions.smeBuild (0 byte len + 1 for NULL Term) */ + bufferSize += (primitive->smeVersions.smeBuild?CsrStrLen(primitive->smeVersions.smeBuild) : 0) + 1; /* char* primitive->smeVersions.smeBuild (0 byte len + 1 for NULL Term) */ bufferSize += 4; /* u32 primitive->smeVersions.smeHip */ bufferSize += 1; /* CsrBool primitive->scheduledInterrupt */ return bufferSize; @@ -1793,7 +1793,7 @@ CsrSize CsrWifiRouterCtrlWifiOnIndSizeof(void *msg) bufferSize += 4; /* u32 primitive->versions.chipVersion */ bufferSize += 4; /* u32 primitive->versions.firmwareBuild */ bufferSize += 4; /* u32 primitive->versions.firmwareHip */ - bufferSize += (primitive->versions.routerBuild?CsrStrLen(primitive->versions.routerBuild) : 0) + 1; /* CsrCharString* primitive->versions.routerBuild (0 byte len + 1 for NULL Term) */ + bufferSize += (primitive->versions.routerBuild?CsrStrLen(primitive->versions.routerBuild) : 0) + 1; /* char* primitive->versions.routerBuild (0 byte len + 1 for NULL Term) */ bufferSize += 4; /* u32 primitive->versions.routerHip */ return bufferSize; } diff --git a/drivers/staging/csr/csr_wifi_router_lib.h b/drivers/staging/csr/csr_wifi_router_lib.h index 4d1fb27..ae0965b 100644 --- a/drivers/staging/csr/csr_wifi_router_lib.h +++ b/drivers/staging/csr/csr_wifi_router_lib.h @@ -56,23 +56,23 @@ void CsrWifiRouterFreeDownstreamMessageContents(u16 eventClass, void *message); /*----------------------------------------------------------------------------* * Enum to string functions *----------------------------------------------------------------------------*/ -const CsrCharString* CsrWifiRouterAppTypeToString(CsrWifiRouterAppType value); -const CsrCharString* CsrWifiRouterEncapsulationToString(CsrWifiRouterEncapsulation value); -const CsrCharString* CsrWifiRouterOuiToString(CsrWifiRouterOui value); -const CsrCharString* CsrWifiRouterPriorityToString(CsrWifiRouterPriority value); +const char* CsrWifiRouterAppTypeToString(CsrWifiRouterAppType value); +const char* CsrWifiRouterEncapsulationToString(CsrWifiRouterEncapsulation value); +const char* CsrWifiRouterOuiToString(CsrWifiRouterOui value); +const char* CsrWifiRouterPriorityToString(CsrWifiRouterPriority value); /*----------------------------------------------------------------------------* * CsrPrim Type toString function. * Converts a message type to the String name of the Message *----------------------------------------------------------------------------*/ -const CsrCharString* CsrWifiRouterPrimTypeToString(CsrPrim msgType); +const char* CsrWifiRouterPrimTypeToString(CsrPrim msgType); /*----------------------------------------------------------------------------* * Lookup arrays for PrimType name Strings *----------------------------------------------------------------------------*/ -extern const CsrCharString *CsrWifiRouterUpstreamPrimNames[CSR_WIFI_ROUTER_PRIM_UPSTREAM_COUNT]; -extern const CsrCharString *CsrWifiRouterDownstreamPrimNames[CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT]; +extern const char *CsrWifiRouterUpstreamPrimNames[CSR_WIFI_ROUTER_PRIM_UPSTREAM_COUNT]; +extern const char *CsrWifiRouterDownstreamPrimNames[CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT]; /******************************************************************************* diff --git a/drivers/staging/csr/csr_wifi_router_transport.c b/drivers/staging/csr/csr_wifi_router_transport.c index 6842ac3..2986606 100644 --- a/drivers/staging/csr/csr_wifi_router_transport.c +++ b/drivers/staging/csr/csr_wifi_router_transport.c @@ -198,7 +198,7 @@ static void CsrWifiRouterTransportSerialiseAndSend(u16 primType, void* msg) } #if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER) -void CsrSchedMessagePutStringLog(CsrSchedQid q, u16 mi, void *mv, u32 line, CsrCharString *file) +void CsrSchedMessagePutStringLog(CsrSchedQid q, u16 mi, void *mv, u32 line, char *file) #else void CsrSchedMessagePut(CsrSchedQid q, u16 mi, void *mv) #endif diff --git a/drivers/staging/csr/csr_wifi_sme_ap_lib.h b/drivers/staging/csr/csr_wifi_sme_ap_lib.h index 06e4130..cacb3a5 100644 --- a/drivers/staging/csr/csr_wifi_sme_ap_lib.h +++ b/drivers/staging/csr/csr_wifi_sme_ap_lib.h @@ -60,25 +60,25 @@ void CsrWifiSmeApFreeDownstreamMessageContents(u16 eventClass, void *message); /*----------------------------------------------------------------------------* * Enum to string functions *----------------------------------------------------------------------------*/ -const CsrCharString* CsrWifiSmeApAccessTypeToString(CsrWifiSmeApAccessType value); -const CsrCharString* CsrWifiSmeApAuthSupportToString(CsrWifiSmeApAuthSupport value); -const CsrCharString* CsrWifiSmeApAuthTypeToString(CsrWifiSmeApAuthType value); -const CsrCharString* CsrWifiSmeApDirectionToString(CsrWifiSmeApDirection value); -const CsrCharString* CsrWifiSmeApPhySupportToString(CsrWifiSmeApPhySupport value); -const CsrCharString* CsrWifiSmeApTypeToString(CsrWifiSmeApType value); +const char* CsrWifiSmeApAccessTypeToString(CsrWifiSmeApAccessType value); +const char* CsrWifiSmeApAuthSupportToString(CsrWifiSmeApAuthSupport value); +const char* CsrWifiSmeApAuthTypeToString(CsrWifiSmeApAuthType value); +const char* CsrWifiSmeApDirectionToString(CsrWifiSmeApDirection value); +const char* CsrWifiSmeApPhySupportToString(CsrWifiSmeApPhySupport value); +const char* CsrWifiSmeApTypeToString(CsrWifiSmeApType value); /*----------------------------------------------------------------------------* * CsrPrim Type toString function. * Converts a message type to the String name of the Message *----------------------------------------------------------------------------*/ -const CsrCharString* CsrWifiSmeApPrimTypeToString(CsrPrim msgType); +const char* CsrWifiSmeApPrimTypeToString(CsrPrim msgType); /*----------------------------------------------------------------------------* * Lookup arrays for PrimType name Strings *----------------------------------------------------------------------------*/ -extern const CsrCharString *CsrWifiSmeApUpstreamPrimNames[CSR_WIFI_SME_AP_PRIM_UPSTREAM_COUNT]; -extern const CsrCharString *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_COUNT]; +extern const char *CsrWifiSmeApUpstreamPrimNames[CSR_WIFI_SME_AP_PRIM_UPSTREAM_COUNT]; +extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_COUNT]; /******************************************************************************* diff --git a/drivers/staging/csr/csr_wifi_sme_converter_init.c b/drivers/staging/csr/csr_wifi_sme_converter_init.c index 18373af..62b94e7 100644 --- a/drivers/staging/csr/csr_wifi_sme_converter_init.c +++ b/drivers/staging/csr/csr_wifi_sme_converter_init.c @@ -189,7 +189,7 @@ void CsrWifiSmeConverterInit(void) #ifdef CSR_LOG_ENABLE static const CsrLogPrimitiveInformation csrwifisme_conv_info = { CSR_WIFI_SME_PRIM, - (CsrCharString *)"CSR_WIFI_SME_PRIM", + (char *)"CSR_WIFI_SME_PRIM", csrwifisme_conv_lut }; const CsrLogPrimitiveInformation* CsrWifiSmeTechInfoGet(void) diff --git a/drivers/staging/csr/csr_wifi_sme_lib.h b/drivers/staging/csr/csr_wifi_sme_lib.h index 1c05f03..6960f8f 100644 --- a/drivers/staging/csr/csr_wifi_sme_lib.h +++ b/drivers/staging/csr/csr_wifi_sme_lib.h @@ -66,63 +66,63 @@ void CsrWifiSmeFreeDownstreamMessageContents(u16 eventClass, void *message); /*----------------------------------------------------------------------------* * Enum to string functions *----------------------------------------------------------------------------*/ -const CsrCharString* CsrWifiSme80211NetworkTypeToString(CsrWifiSme80211NetworkType value); -const CsrCharString* CsrWifiSme80211PrivacyModeToString(CsrWifiSme80211PrivacyMode value); -const CsrCharString* CsrWifiSme80211dTrustLevelToString(CsrWifiSme80211dTrustLevel value); -const CsrCharString* CsrWifiSmeAmpStatusToString(CsrWifiSmeAmpStatus value); -const CsrCharString* CsrWifiSmeAuthModeToString(CsrWifiSmeAuthMode value); -const CsrCharString* CsrWifiSmeBasicUsabilityToString(CsrWifiSmeBasicUsability value); -const CsrCharString* CsrWifiSmeBssTypeToString(CsrWifiSmeBssType value); -const CsrCharString* CsrWifiSmeCoexSchemeToString(CsrWifiSmeCoexScheme value); -const CsrCharString* CsrWifiSmeControlIndicationToString(CsrWifiSmeControlIndication value); -const CsrCharString* CsrWifiSmeCtsProtectionTypeToString(CsrWifiSmeCtsProtectionType value); -const CsrCharString* CsrWifiSmeD3AutoScanModeToString(CsrWifiSmeD3AutoScanMode value); -const CsrCharString* CsrWifiSmeEncryptionToString(CsrWifiSmeEncryption value); -const CsrCharString* CsrWifiSmeFirmwareDriverInterfaceToString(CsrWifiSmeFirmwareDriverInterface value); -const CsrCharString* CsrWifiSmeHostPowerModeToString(CsrWifiSmeHostPowerMode value); -const CsrCharString* CsrWifiSmeIEEE80211ReasonToString(CsrWifiSmeIEEE80211Reason value); -const CsrCharString* CsrWifiSmeIEEE80211ResultToString(CsrWifiSmeIEEE80211Result value); -const CsrCharString* CsrWifiSmeIndicationsToString(CsrWifiSmeIndications value); -const CsrCharString* CsrWifiSmeKeyTypeToString(CsrWifiSmeKeyType value); -const CsrCharString* CsrWifiSmeListActionToString(CsrWifiSmeListAction value); -const CsrCharString* CsrWifiSmeMediaStatusToString(CsrWifiSmeMediaStatus value); -const CsrCharString* CsrWifiSmeP2pCapabilityToString(CsrWifiSmeP2pCapability value); -const CsrCharString* CsrWifiSmeP2pGroupCapabilityToString(CsrWifiSmeP2pGroupCapability value); -const CsrCharString* CsrWifiSmeP2pNoaConfigMethodToString(CsrWifiSmeP2pNoaConfigMethod value); -const CsrCharString* CsrWifiSmeP2pRoleToString(CsrWifiSmeP2pRole value); -const CsrCharString* CsrWifiSmeP2pStatusToString(CsrWifiSmeP2pStatus value); -const CsrCharString* CsrWifiSmePacketFilterModeToString(CsrWifiSmePacketFilterMode value); -const CsrCharString* CsrWifiSmePowerSaveLevelToString(CsrWifiSmePowerSaveLevel value); -const CsrCharString* CsrWifiSmePreambleTypeToString(CsrWifiSmePreambleType value); -const CsrCharString* CsrWifiSmeRadioIFToString(CsrWifiSmeRadioIF value); -const CsrCharString* CsrWifiSmeRegulatoryDomainToString(CsrWifiSmeRegulatoryDomain value); -const CsrCharString* CsrWifiSmeRoamReasonToString(CsrWifiSmeRoamReason value); -const CsrCharString* CsrWifiSmeScanTypeToString(CsrWifiSmeScanType value); -const CsrCharString* CsrWifiSmeTrafficTypeToString(CsrWifiSmeTrafficType value); -const CsrCharString* CsrWifiSmeTspecCtrlToString(CsrWifiSmeTspecCtrl value); -const CsrCharString* CsrWifiSmeTspecResultCodeToString(CsrWifiSmeTspecResultCode value); -const CsrCharString* CsrWifiSmeWepAuthModeToString(CsrWifiSmeWepAuthMode value); -const CsrCharString* CsrWifiSmeWepCredentialTypeToString(CsrWifiSmeWepCredentialType value); -const CsrCharString* CsrWifiSmeWmmModeToString(CsrWifiSmeWmmMode value); -const CsrCharString* CsrWifiSmeWmmQosInfoToString(CsrWifiSmeWmmQosInfo value); -const CsrCharString* CsrWifiSmeWpsConfigTypeToString(CsrWifiSmeWpsConfigType value); -const CsrCharString* CsrWifiSmeWpsDeviceCategoryToString(CsrWifiSmeWpsDeviceCategory value); -const CsrCharString* CsrWifiSmeWpsDeviceSubCategoryToString(CsrWifiSmeWpsDeviceSubCategory value); -const CsrCharString* CsrWifiSmeWpsDpidToString(CsrWifiSmeWpsDpid value); -const CsrCharString* CsrWifiSmeWpsRegistrationToString(CsrWifiSmeWpsRegistration value); +const char* CsrWifiSme80211NetworkTypeToString(CsrWifiSme80211NetworkType value); +const char* CsrWifiSme80211PrivacyModeToString(CsrWifiSme80211PrivacyMode value); +const char* CsrWifiSme80211dTrustLevelToString(CsrWifiSme80211dTrustLevel value); +const char* CsrWifiSmeAmpStatusToString(CsrWifiSmeAmpStatus value); +const char* CsrWifiSmeAuthModeToString(CsrWifiSmeAuthMode value); +const char* CsrWifiSmeBasicUsabilityToString(CsrWifiSmeBasicUsability value); +const char* CsrWifiSmeBssTypeToString(CsrWifiSmeBssType value); +const char* CsrWifiSmeCoexSchemeToString(CsrWifiSmeCoexScheme value); +const char* CsrWifiSmeControlIndicationToString(CsrWifiSmeControlIndication value); +const char* CsrWifiSmeCtsProtectionTypeToString(CsrWifiSmeCtsProtectionType value); +const char* CsrWifiSmeD3AutoScanModeToString(CsrWifiSmeD3AutoScanMode value); +const char* CsrWifiSmeEncryptionToString(CsrWifiSmeEncryption value); +const char* CsrWifiSmeFirmwareDriverInterfaceToString(CsrWifiSmeFirmwareDriverInterface value); +const char* CsrWifiSmeHostPowerModeToString(CsrWifiSmeHostPowerMode value); +const char* CsrWifiSmeIEEE80211ReasonToString(CsrWifiSmeIEEE80211Reason value); +const char* CsrWifiSmeIEEE80211ResultToString(CsrWifiSmeIEEE80211Result value); +const char* CsrWifiSmeIndicationsToString(CsrWifiSmeIndications value); +const char* CsrWifiSmeKeyTypeToString(CsrWifiSmeKeyType value); +const char* CsrWifiSmeListActionToString(CsrWifiSmeListAction value); +const char* CsrWifiSmeMediaStatusToString(CsrWifiSmeMediaStatus value); +const char* CsrWifiSmeP2pCapabilityToString(CsrWifiSmeP2pCapability value); +const char* CsrWifiSmeP2pGroupCapabilityToString(CsrWifiSmeP2pGroupCapability value); +const char* CsrWifiSmeP2pNoaConfigMethodToString(CsrWifiSmeP2pNoaConfigMethod value); +const char* CsrWifiSmeP2pRoleToString(CsrWifiSmeP2pRole value); +const char* CsrWifiSmeP2pStatusToString(CsrWifiSmeP2pStatus value); +const char* CsrWifiSmePacketFilterModeToString(CsrWifiSmePacketFilterMode value); +const char* CsrWifiSmePowerSaveLevelToString(CsrWifiSmePowerSaveLevel value); +const char* CsrWifiSmePreambleTypeToString(CsrWifiSmePreambleType value); +const char* CsrWifiSmeRadioIFToString(CsrWifiSmeRadioIF value); +const char* CsrWifiSmeRegulatoryDomainToString(CsrWifiSmeRegulatoryDomain value); +const char* CsrWifiSmeRoamReasonToString(CsrWifiSmeRoamReason value); +const char* CsrWifiSmeScanTypeToString(CsrWifiSmeScanType value); +const char* CsrWifiSmeTrafficTypeToString(CsrWifiSmeTrafficType value); +const char* CsrWifiSmeTspecCtrlToString(CsrWifiSmeTspecCtrl value); +const char* CsrWifiSmeTspecResultCodeToString(CsrWifiSmeTspecResultCode value); +const char* CsrWifiSmeWepAuthModeToString(CsrWifiSmeWepAuthMode value); +const char* CsrWifiSmeWepCredentialTypeToString(CsrWifiSmeWepCredentialType value); +const char* CsrWifiSmeWmmModeToString(CsrWifiSmeWmmMode value); +const char* CsrWifiSmeWmmQosInfoToString(CsrWifiSmeWmmQosInfo value); +const char* CsrWifiSmeWpsConfigTypeToString(CsrWifiSmeWpsConfigType value); +const char* CsrWifiSmeWpsDeviceCategoryToString(CsrWifiSmeWpsDeviceCategory value); +const char* CsrWifiSmeWpsDeviceSubCategoryToString(CsrWifiSmeWpsDeviceSubCategory value); +const char* CsrWifiSmeWpsDpidToString(CsrWifiSmeWpsDpid value); +const char* CsrWifiSmeWpsRegistrationToString(CsrWifiSmeWpsRegistration value); /*----------------------------------------------------------------------------* * CsrPrim Type toString function. * Converts a message type to the String name of the Message *----------------------------------------------------------------------------*/ -const CsrCharString* CsrWifiSmePrimTypeToString(CsrPrim msgType); +const char* CsrWifiSmePrimTypeToString(CsrPrim msgType); /*----------------------------------------------------------------------------* * Lookup arrays for PrimType name Strings *----------------------------------------------------------------------------*/ -extern const CsrCharString *CsrWifiSmeUpstreamPrimNames[CSR_WIFI_SME_PRIM_UPSTREAM_COUNT]; -extern const CsrCharString *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT]; +extern const char *CsrWifiSmeUpstreamPrimNames[CSR_WIFI_SME_PRIM_UPSTREAM_COUNT]; +extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT]; /******************************************************************************* diff --git a/drivers/staging/csr/csr_wifi_sme_prim.h b/drivers/staging/csr/csr_wifi_sme_prim.h index 79bc2b2..3131dd7 100644 --- a/drivers/staging/csr/csr_wifi_sme_prim.h +++ b/drivers/staging/csr/csr_wifi_sme_prim.h @@ -2455,9 +2455,9 @@ typedef struct u32 firmwareBuild; u32 firmwarePatch; u32 firmwareHip; - CsrCharString *routerBuild; + char *routerBuild; u32 routerHip; - CsrCharString *smeBuild; + char *smeBuild; u32 smeHip; } CsrWifiSmeVersions; @@ -6419,7 +6419,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrCharString *errorMessage; + char *errorMessage; } CsrWifiSmeErrorInd; /******************************************************************************* @@ -6439,7 +6439,7 @@ typedef struct typedef struct { CsrWifiFsmEvent common; - CsrCharString *infoMessage; + char *infoMessage; } CsrWifiSmeInfoInd; /******************************************************************************* diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.c b/drivers/staging/csr/csr_wifi_sme_serialize.c index 53d9fa2..c9070ca 100644 --- a/drivers/staging/csr/csr_wifi_sme_serialize.c +++ b/drivers/staging/csr/csr_wifi_sme_serialize.c @@ -5421,9 +5421,9 @@ CsrSize CsrWifiSmeVersionsGetCfmSizeof(void *msg) bufferSize += 4; /* u32 primitive->versions.firmwareBuild */ bufferSize += 4; /* u32 primitive->versions.firmwarePatch */ bufferSize += 4; /* u32 primitive->versions.firmwareHip */ - bufferSize += (primitive->versions.routerBuild?CsrStrLen(primitive->versions.routerBuild) : 0) + 1; /* CsrCharString* primitive->versions.routerBuild (0 byte len + 1 for NULL Term) */ + bufferSize += (primitive->versions.routerBuild?CsrStrLen(primitive->versions.routerBuild) : 0) + 1; /* char* primitive->versions.routerBuild (0 byte len + 1 for NULL Term) */ bufferSize += 4; /* u32 primitive->versions.routerHip */ - bufferSize += (primitive->versions.smeBuild?CsrStrLen(primitive->versions.smeBuild) : 0) + 1; /* CsrCharString* primitive->versions.smeBuild (0 byte len + 1 for NULL Term) */ + bufferSize += (primitive->versions.smeBuild?CsrStrLen(primitive->versions.smeBuild) : 0) + 1; /* char* primitive->versions.smeBuild (0 byte len + 1 for NULL Term) */ bufferSize += 4; /* u32 primitive->versions.smeHip */ return bufferSize; } @@ -5676,7 +5676,7 @@ CsrSize CsrWifiSmeErrorIndSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 3) */ - bufferSize += (primitive->errorMessage?CsrStrLen(primitive->errorMessage) : 0) + 1; /* CsrCharString* primitive->errorMessage (0 byte len + 1 for NULL Term) */ + bufferSize += (primitive->errorMessage?CsrStrLen(primitive->errorMessage) : 0) + 1; /* char* primitive->errorMessage (0 byte len + 1 for NULL Term) */ return bufferSize; } @@ -5718,7 +5718,7 @@ CsrSize CsrWifiSmeInfoIndSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 3) */ - bufferSize += (primitive->infoMessage?CsrStrLen(primitive->infoMessage) : 0) + 1; /* CsrCharString* primitive->infoMessage (0 byte len + 1 for NULL Term) */ + bufferSize += (primitive->infoMessage?CsrStrLen(primitive->infoMessage) : 0) + 1; /* char* primitive->infoMessage (0 byte len + 1 for NULL Term) */ return bufferSize; } diff --git a/drivers/staging/csr/sme_sys.c b/drivers/staging/csr/sme_sys.c index add5771..7a41c9c 100644 --- a/drivers/staging/csr/sme_sys.c +++ b/drivers/staging/csr/sme_sys.c @@ -836,7 +836,7 @@ void CsrWifiRouterCtrlWifiOnReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) versions.chipVersion = priv->card_info.chip_version; versions.firmwareBuild = priv->card_info.fw_build; versions.firmwareHip = priv->card_info.fw_hip_version; - versions.routerBuild = (CsrCharString*)CSR_WIFI_VERSION; + versions.routerBuild = (char*)CSR_WIFI_VERSION; versions.routerHip = (UNIFI_HIP_MAJOR_VERSION << 8) | UNIFI_HIP_MINOR_VERSION; CsrWifiRouterCtrlWifiOnIndSend(msg->source, 0, CSR_RESULT_SUCCESS, versions); @@ -1852,7 +1852,7 @@ void CsrWifiRouterCtrlModeSetReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) versions.chipVersion = priv->card_info.chip_version; versions.firmwareBuild = priv->card_info.fw_build; versions.firmwareHip = priv->card_info.fw_hip_version; - versions.routerBuild = (CsrCharString*)CSR_WIFI_VERSION; + versions.routerBuild = (char*)CSR_WIFI_VERSION; versions.routerHip = (UNIFI_HIP_MAJOR_VERSION << 8) | UNIFI_HIP_MINOR_VERSION; /* Now that new firmware is running, send a WifiOnInd to the NME. This will -- cgit v0.10.2 From 5379b13d9e063e9bb2078a1c642f8df8c914e022 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 12:25:15 -0700 Subject: staging: csr: remove CsrBool typedef MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use u8 instead. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_log.h b/drivers/staging/csr/csr_log.h index 6f8429d..2619d22 100644 --- a/drivers/staging/csr/csr_log.h +++ b/drivers/staging/csr/csr_log.h @@ -71,9 +71,9 @@ typedef u32 CsrLogLevelTask; /* The bit masks between here are reserved for future usage */ #define CSR_LOG_LEVEL_TASK_ALL ((CsrLogLevelTask) 0xFFFFFFFF & ~(CSR_LOG_LEVEL_TASK_PRIM_ONLY_TYPE | CSR_LOG_LEVEL_TASK_PRIM_APPLY_LIMIT)) /* All info possible to log for a task are logged. WARNING: By using this define the application also accepts future possible task data/events in the logs */ -CsrBool CsrLogEnvironmentIsFiltered(CsrLogLevelEnvironment level); +u8 CsrLogEnvironmentIsFiltered(CsrLogLevelEnvironment level); CsrLogLevelTask CsrLogTaskFilterGet(CsrSchedQid taskId); -CsrBool CsrLogTaskIsFiltered(CsrSchedQid taskId, CsrLogLevelTask level); +u8 CsrLogTaskIsFiltered(CsrSchedQid taskId, CsrLogLevelTask level); /* * Logging stuff @@ -193,7 +193,7 @@ void CsrLogMessagePut(u32 line, void CsrLogMessageGet(CsrSchedQid src_task_id, CsrSchedQid dst_taskid, - CsrBool get_res, + u8 get_res, CsrSchedMsgId msg_id, u16 prim_type, const void *msg); @@ -216,7 +216,7 @@ void CsrLogTimedEventCancel(u32 line, const char *file, CsrSchedQid task_id, CsrSchedTid tid, - CsrBool cancel_res); + u8 cancel_res); void CsrLogBgintRegister(u8 thread_id, CsrSchedBgint irq, diff --git a/drivers/staging/csr/csr_macro.h b/drivers/staging/csr/csr_macro.h index 214d6a3..22405cf 100644 --- a/drivers/staging/csr/csr_macro.h +++ b/drivers/staging/csr/csr_macro.h @@ -23,7 +23,7 @@ extern "C" { #define CSR_MASK_IS_UNSET(val, mask) ((((val) & (mask)) ^ mask) == (mask)) #define CSR_MASK_SET(val, mask) ((val) |= (mask)) #define CSR_MASK_UNSET(val, mask) ((val) = ((val) ^ (mask)) & (val)) /* Unsets the bits in val that are set in mask */ -#define CSR_BIT_IS_SET(val, bit) ((CsrBool) ((((val) & (1UL << (bit))) != 0))) +#define CSR_BIT_IS_SET(val, bit) ((u8) ((((val) & (1UL << (bit))) != 0))) #define CSR_BIT_SET(val, bit) ((val) |= (1UL << (bit))) #define CSR_BIT_UNSET(val, bit) ((val) &= ~(1UL << (bit))) #define CSR_BIT_TOGGLE(val, bit) ((val) ^= (1UL << (bit))) diff --git a/drivers/staging/csr/csr_msgconv.c b/drivers/staging/csr/csr_msgconv.c index b2aeb7a..0d61caf 100644 --- a/drivers/staging/csr/csr_msgconv.c +++ b/drivers/staging/csr/csr_msgconv.c @@ -133,10 +133,10 @@ static CsrSize sizeof_message(u16 primType, void *msg) return ret; } -static CsrBool free_message(u16 primType, u8 *data) +static u8 free_message(u16 primType, u8 *data) { CsrMsgConvPrimEntry *ptr; - CsrBool ret; + u8 ret; ptr = CsrMsgConvFind(primType); diff --git a/drivers/staging/csr/csr_msgconv.h b/drivers/staging/csr/csr_msgconv.h index b195b79..8df292d 100644 --- a/drivers/staging/csr/csr_msgconv.h +++ b/drivers/staging/csr/csr_msgconv.h @@ -51,7 +51,7 @@ typedef struct { CsrMsgConvPrimEntry *profile_converters; void *(*deserialize_data)(u16 primType, CsrSize length, u8 * data); - CsrBool (*free_message)(u16 primType, u8 *data); + u8 (*free_message)(u16 primType, u8 *data); CsrSize (*sizeof_message)(u16 primType, void *msg); u8 *(*serialize_message)(u16 primType, void *msg, CsrSize * length, diff --git a/drivers/staging/csr/csr_sched.h b/drivers/staging/csr/csr_sched.h index 2413463..663fe59 100644 --- a/drivers/staging/csr/csr_sched.h +++ b/drivers/staging/csr/csr_sched.h @@ -185,7 +185,7 @@ void CsrSchedMessageBroadcast(u16 mi, * The message consists of one or both of a u16 and a void *. * * RETURNS - * CsrBool - TRUE if a message has been obtained from the queue, else FALSE. + * u8 - TRUE if a message has been obtained from the queue, else FALSE. * If a message is taken from the queue, then "*pmi" and "*pmv" are set to * the "mi" and "mv" passed to CsrSchedMessagePut() respectively. * @@ -193,7 +193,7 @@ void CsrSchedMessageBroadcast(u16 mi, * them message is discarded. * *----------------------------------------------------------------------------*/ -CsrBool CsrSchedMessageGet(u16 *pmi, void **pmv); +u8 CsrSchedMessageGet(u16 *pmi, void **pmv); /*----------------------------------------------------------------------------* * NAME @@ -241,18 +241,18 @@ CsrSchedTid CsrSchedTimerSet(CsrTime delay, * occurring. * * RETURNS - * CsrBool - TRUE if cancelled, FALSE if the event has already occurred. + * u8 - TRUE if cancelled, FALSE if the event has already occurred. * *----------------------------------------------------------------------------*/ #if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER) -CsrBool CsrSchedTimerCancelStringLog(CsrSchedTid eventid, +u8 CsrSchedTimerCancelStringLog(CsrSchedTid eventid, u16 *pmi, void **pmv, u32 line, const char *file); #define CsrSchedTimerCancel(e, pmi, pmv) CsrSchedTimerCancelStringLog((e), (pmi), (pmv), __LINE__, __FILE__) #else -CsrBool CsrSchedTimerCancel(CsrSchedTid eventid, +u8 CsrSchedTimerCancel(CsrSchedTid eventid, u16 *pmi, void **pmv); #endif diff --git a/drivers/staging/csr/csr_types.h b/drivers/staging/csr/csr_types.h index 0b5a231..40bc644 100644 --- a/drivers/staging/csr/csr_types.h +++ b/drivers/staging/csr/csr_types.h @@ -32,9 +32,6 @@ typedef ptrdiff_t CsrPtrdiff; /* Type of the result of subtracting two pointer typedef uintptr_t CsrUintptr; /* Unsigned integer large enough to hold any pointer (ISO/IEC 9899:1999 7.18.1.4) */ typedef ptrdiff_t CsrIntptr; /* intptr_t is not defined in kernel. Use the equivalent ptrdiff_t. */ -/* Boolean */ -typedef u8 CsrBool; - /* * 64-bit integers * diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index 3064536..579cd4b 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -261,7 +261,7 @@ u8 *CsrUtf16String2Utf8(const u16 *source) u32 length; u32 sourceLength; u8 bytes; - CsrBool appendNull = FALSE; + u8 appendNull = FALSE; u8 firstByteMark[5] = {0x00, 0x00, 0xC0, 0xE0, 0xF0}; @@ -463,7 +463,7 @@ u8 *CsrUtf16String2Utf8(const u16 *source) TRUE if the given code unit is legal. *****************************************************************************/ -static CsrBool isLegalUtf8(const u8 *codeUnit, u32 length) +static u8 isLegalUtf8(const u8 *codeUnit, u32 length) { const u8 *srcPtr = codeUnit + length; u8 byte; @@ -815,7 +815,7 @@ u16 *CsrUtf16String2XML(u16 *str) u16 *outputString = NULL; u16 *resultString = str; u32 stringLength = 0; - CsrBool encodeChars = FALSE; + u8 encodeChars = FALSE; scanString = str; if (scanString) @@ -908,7 +908,7 @@ u16 *CsrXML2Utf16String(u16 *str) u16 *outputString = NULL; u16 *resultString = str; u32 stringLength = 0; - CsrBool encodeChars = FALSE; + u8 encodeChars = FALSE; scanString = str; if (scanString) diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index e381f25..afb5783 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -53,7 +53,7 @@ u8 CsrBitCountDense(u32 n) /*------------------------------------------------------------------*/ /* Base conversion */ /*------------------------------------------------------------------*/ -CsrBool CsrHexStrToUint8(const char *string, u8 *returnValue) +u8 CsrHexStrToUint8(const char *string, u8 *returnValue) { u16 currentIndex = 0; *returnValue = 0; @@ -77,7 +77,7 @@ CsrBool CsrHexStrToUint8(const char *string, u8 *returnValue) return FALSE; } -CsrBool CsrHexStrToUint16(const char *string, u16 *returnValue) +u8 CsrHexStrToUint16(const char *string, u16 *returnValue) { u16 currentIndex = 0; *returnValue = 0; @@ -101,7 +101,7 @@ CsrBool CsrHexStrToUint16(const char *string, u16 *returnValue) return FALSE; } -CsrBool CsrHexStrToUint32(const char *string, u32 *returnValue) +u8 CsrHexStrToUint32(const char *string, u32 *returnValue) { u16 currentIndex = 0; *returnValue = 0; @@ -150,7 +150,7 @@ void CsrIntToBase10(s32 number, char *str) s32 digit; u8 index; char res[I2B10_MAX]; - CsrBool foundDigit = FALSE; + u8 foundDigit = FALSE; for (digit = 0; digit < I2B10_MAX; digit++) { @@ -423,7 +423,7 @@ const char *CsrGetBaseName(const char *file) /*------------------------------------------------------------------*/ /* Misc */ /*------------------------------------------------------------------*/ -CsrBool CsrIsSpace(u8 c) +u8 CsrIsSpace(u8 c) { switch (c) { diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index e0bcca2..0324fb4 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -26,9 +26,9 @@ u8 CsrBitCountDense(u32 n); /*------------------------------------------------------------------*/ /* Base conversion */ /*------------------------------------------------------------------*/ -CsrBool CsrHexStrToUint8(const char *string, u8 *returnValue); -CsrBool CsrHexStrToUint16(const char *string, u16 *returnValue); -CsrBool CsrHexStrToUint32(const char *string, u32 *returnValue); +u8 CsrHexStrToUint8(const char *string, u8 *returnValue); +u8 CsrHexStrToUint16(const char *string, u16 *returnValue); +u8 CsrHexStrToUint32(const char *string, u32 *returnValue); u32 CsrPow(u32 base, u32 exponent); void CsrIntToBase10(s32 number, char *str); void CsrUInt16ToHex(u16 number, char *str); @@ -85,7 +85,7 @@ const char *CsrGetBaseName(const char *file); /*------------------------------------------------------------------*/ /* Misc */ /*------------------------------------------------------------------*/ -CsrBool CsrIsSpace(u8 c); +u8 CsrIsSpace(u8 c); #define CsrOffsetOf(st, m) ((CsrSize) & ((st *) 0)->m) #ifdef __cplusplus diff --git a/drivers/staging/csr/csr_wifi_fsm.h b/drivers/staging/csr/csr_wifi_fsm.h index 0f9cd8f..d078dee 100644 --- a/drivers/staging/csr/csr_wifi_fsm.h +++ b/drivers/staging/csr/csr_wifi_fsm.h @@ -226,9 +226,9 @@ extern void CsrWifiFsmTestAdvanceTime(CsrWifiFsmContext *context, u32 ms); * @param[in] context : FSM context * * @return - * CsrBool returns TRUE if there are events for the FSM to process + * u8 returns TRUE if there are events for the FSM to process */ -extern CsrBool CsrWifiFsmHasEvents(CsrWifiFsmContext *context); +extern u8 CsrWifiFsmHasEvents(CsrWifiFsmContext *context); /** * @brief diff --git a/drivers/staging/csr/csr_wifi_fsm_types.h b/drivers/staging/csr/csr_wifi_fsm_types.h index 558fd2d..f3837c6 100644 --- a/drivers/staging/csr/csr_wifi_fsm_types.h +++ b/drivers/staging/csr/csr_wifi_fsm_types.h @@ -220,7 +220,7 @@ typedef struct typedef struct { const u8 numEntries; - const CsrBool saveAll; + const u8 saveAll; const CsrWifiFsmEventEntry *eventEntryArray; /* array of transition function pointers for state */ #ifdef CSR_LOG_ENABLE u16 stateNumber; @@ -391,7 +391,7 @@ struct CsrWifiFsmContext #endif u32 timeOffset; /* Amount to adjust the TimeOfDayMs by */ CsrWifiFsmTimerList timerQueue; /* The internal timer queue */ - CsrBool useTempSaveList; /* Should the temp save list be used */ + u8 useTempSaveList; /* Should the temp save list be used */ CsrWifiFsmEventList tempSaveList; /* The temp save event queue */ CsrWifiFsmEvent *eventForwardedOrSaved; /* The event that was forwarded or Saved */ u16 maxProcesses; /* Size of instanceArray */ diff --git a/drivers/staging/csr/csr_wifi_hip_card.h b/drivers/staging/csr/csr_wifi_hip_card.h index 348572f..9caf88c 100644 --- a/drivers/staging/csr/csr_wifi_hip_card.h +++ b/drivers/staging/csr/csr_wifi_hip_card.h @@ -43,7 +43,7 @@ CsrResult CardGenInt(card_t *card); /***************************************************************************** * CardPendingInt - */ -CsrResult CardPendingInt(card_t *card, CsrBool *pintr); +CsrResult CardPendingInt(card_t *card, u8 *pintr); /***************************************************************************** * CardDisableInt - @@ -63,7 +63,7 @@ void CardDisable(card_t *card); /***************************************************************************** * CardIntEnabled - */ -CsrResult CardIntEnabled(card_t *card, CsrBool *enabled); +CsrResult CardIntEnabled(card_t *card, u8 *enabled); /***************************************************************************** * CardGetDataSlotSize diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.c b/drivers/staging/csr/csr_wifi_hip_card_sdio.c index 07b3ac8..22778de 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.c @@ -3261,7 +3261,7 @@ CsrResult CardDisableInt(card_t *card) * CSR_RESULT_FAILURE if an SDIO error occurred, * --------------------------------------------------------------------------- */ -CsrResult CardPendingInt(card_t *card, CsrBool *pintr) +CsrResult CardPendingInt(card_t *card, u8 *pintr) { CsrResult r; u8 pending; @@ -3303,7 +3303,7 @@ CsrResult CardPendingInt(card_t *card, CsrBool *pintr) CsrResult CardClearInt(card_t *card) { CsrResult r; - CsrBool intr; + u8 intr; if (card->chip_id > SDIO_CARD_ID_UNIFI_2) { @@ -3361,7 +3361,7 @@ CsrResult CardClearInt(card_t *card) * CSR_RESULT_FAILURE if an SDIO error occurred, * --------------------------------------------------------------------------- */ -CsrResult CardIntEnabled(card_t *card, CsrBool *enabled) +CsrResult CardIntEnabled(card_t *card, u8 *enabled) { CsrResult r; u8 int_enable; @@ -4036,7 +4036,7 @@ CsrResult unifi_check_io_status(card_t *card, s32 *status) { u8 io_en; CsrResult r; - CsrBool pending; + u8 pending; *status = 0; diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.h b/drivers/staging/csr/csr_wifi_hip_card_sdio.h index ad5f131..dc2ed70 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.h +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.h @@ -300,7 +300,7 @@ typedef struct u16 packets_interval; /* Once a queue reaches a stable state, avoid processing */ - CsrBool queue_stable[UNIFI_NO_OF_TX_QS]; + u8 queue_stable[UNIFI_NO_OF_TX_QS]; } card_dynamic_slot_t; @@ -566,7 +566,7 @@ struct card u16 sdio_io_block_size; /* Pad transfer sizes to SDIO block boundaries */ - CsrBool sdio_io_block_pad; + u8 sdio_io_block_pad; /* Read from the XBV */ struct FWOV fwov; diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c index 1bc97ac..8aba828 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c @@ -43,7 +43,7 @@ static CsrResult process_bh(card_t *card); -static CsrResult handle_host_protocol(card_t *card, CsrBool *processed_something); +static CsrResult handle_host_protocol(card_t *card, u8 *processed_something); static CsrResult flush_fh_buffer(card_t *card); @@ -358,7 +358,7 @@ CsrResult unifi_bh(card_t *card, u32 *remaining) { CsrResult r; CsrResult csrResult; - CsrBool pending; + u8 pending; s32 iostate, j; const enum unifi_low_power_mode low_power_mode = card->low_power_mode; u16 data_slots_used = 0; @@ -700,7 +700,7 @@ static CsrResult process_clock_request(card_t *card) static CsrResult process_bh(card_t *card) { CsrResult r; - CsrBool more; + u8 more; more = FALSE; /* Process the reasons (interrupt, signals) */ @@ -842,7 +842,7 @@ static CsrResult process_bh(card_t *card) * CSR_RESULT_SUCCESS on success or CSR error code. * --------------------------------------------------------------------------- */ -static CsrResult handle_host_protocol(card_t *card, CsrBool *processed_something) +static CsrResult handle_host_protocol(card_t *card, u8 *processed_something) { CsrResult r; s32 done; diff --git a/drivers/staging/csr/csr_wifi_nme_ap_prim.h b/drivers/staging/csr/csr_wifi_nme_ap_prim.h index 616a899..1ca0ec9 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_prim.h +++ b/drivers/staging/csr/csr_wifi_nme_ap_prim.h @@ -78,7 +78,7 @@ typedef u8 CsrWifiNmeApPersCredentialType; typedef struct { u16 apGroupkeyTimeout; - CsrBool apStrictGtkRekey; + u8 apStrictGtkRekey; u16 apGmkTimeout; u16 apResponseTimeout; u8 apRetransLimit; @@ -256,14 +256,14 @@ typedef struct CsrWifiFsmEvent common; u16 interfaceTag; CsrWifiSmeApType apType; - CsrBool cloakSsid; + u8 cloakSsid; CsrWifiSsid ssid; CsrWifiSmeRadioIF ifIndex; u8 channel; CsrWifiNmeApCredentials apCredentials; u8 maxConnections; CsrWifiSmeApP2pGoConfig p2pGoParam; - CsrBool wpsEnabled; + u8 wpsEnabled; } CsrWifiNmeApStartReq; /******************************************************************************* @@ -334,7 +334,7 @@ typedef struct CsrWifiFsmEvent common; u16 interfaceTag; CsrWifiMacAddress staMacAddress; - CsrBool keepBlocking; + u8 keepBlocking; } CsrWifiNmeApStaRemoveReq; /******************************************************************************* diff --git a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c index 3fecb6f..c9a36e9 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c +++ b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c @@ -33,7 +33,7 @@ CsrSize CsrWifiNmeApConfigSetReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 104) */ bufferSize += 2; /* u16 primitive->apConfig.apGroupkeyTimeout */ - bufferSize += 1; /* CsrBool primitive->apConfig.apStrictGtkRekey */ + bufferSize += 1; /* u8 primitive->apConfig.apStrictGtkRekey */ bufferSize += 2; /* u16 primitive->apConfig.apGmkTimeout */ bufferSize += 2; /* u16 primitive->apConfig.apResponseTimeout */ bufferSize += 1; /* u8 primitive->apConfig.apRetransLimit */ @@ -44,9 +44,9 @@ CsrSize CsrWifiNmeApConfigSetReqSizeof(void *msg) bufferSize += 1; /* u8 primitive->apMacConfig.supportedRatesCount */ bufferSize += 20; /* u8 primitive->apMacConfig.supportedRates[20] */ bufferSize += 1; /* CsrWifiSmePreambleType primitive->apMacConfig.preamble */ - bufferSize += 1; /* CsrBool primitive->apMacConfig.shortSlotTimeEnabled */ + bufferSize += 1; /* u8 primitive->apMacConfig.shortSlotTimeEnabled */ bufferSize += 1; /* CsrWifiSmeCtsProtectionType primitive->apMacConfig.ctsProtectionType */ - bufferSize += 1; /* CsrBool primitive->apMacConfig.wmmEnabled */ + bufferSize += 1; /* u8 primitive->apMacConfig.wmmEnabled */ { u16 i2; for (i2 = 0; i2 < 4; i2++) @@ -55,7 +55,7 @@ CsrSize CsrWifiNmeApConfigSetReqSizeof(void *msg) bufferSize += 1; /* u8 primitive->apMacConfig.wmmApParams[i2].cwMax */ bufferSize += 1; /* u8 primitive->apMacConfig.wmmApParams[i2].aifs */ bufferSize += 2; /* u16 primitive->apMacConfig.wmmApParams[i2].txopLimit */ - bufferSize += 1; /* CsrBool primitive->apMacConfig.wmmApParams[i2].admissionControlMandatory */ + bufferSize += 1; /* u8 primitive->apMacConfig.wmmApParams[i2].admissionControlMandatory */ } } { @@ -66,7 +66,7 @@ CsrSize CsrWifiNmeApConfigSetReqSizeof(void *msg) bufferSize += 1; /* u8 primitive->apMacConfig.wmmApBcParams[i2].cwMax */ bufferSize += 1; /* u8 primitive->apMacConfig.wmmApBcParams[i2].aifs */ bufferSize += 2; /* u16 primitive->apMacConfig.wmmApBcParams[i2].txopLimit */ - bufferSize += 1; /* CsrBool primitive->apMacConfig.wmmApBcParams[i2].admissionControlMandatory */ + bufferSize += 1; /* u8 primitive->apMacConfig.wmmApBcParams[i2].admissionControlMandatory */ } } bufferSize += 1; /* CsrWifiSmeApAccessType primitive->apMacConfig.accessType */ @@ -78,12 +78,12 @@ CsrSize CsrWifiNmeApConfigSetReqSizeof(void *msg) bufferSize += 6; /* u8 primitive->apMacConfig.macAddressList[i2].a[6] */ } } - bufferSize += 1; /* CsrBool primitive->apMacConfig.apHtParams.greenfieldSupported */ - bufferSize += 1; /* CsrBool primitive->apMacConfig.apHtParams.shortGi20MHz */ + bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.greenfieldSupported */ + bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.shortGi20MHz */ bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.rxStbc */ - bufferSize += 1; /* CsrBool primitive->apMacConfig.apHtParams.rifsModeAllowed */ + bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.rifsModeAllowed */ bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.htProtection */ - bufferSize += 1; /* CsrBool primitive->apMacConfig.apHtParams.dualCtsProtection */ + bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.dualCtsProtection */ return bufferSize; } @@ -276,7 +276,7 @@ CsrSize CsrWifiNmeApStartReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 112) */ bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiSmeApType primitive->apType */ - bufferSize += 1; /* CsrBool primitive->cloakSsid */ + bufferSize += 1; /* u8 primitive->cloakSsid */ bufferSize += 32; /* u8 primitive->ssid.ssid[32] */ bufferSize += 1; /* u8 primitive->ssid.length */ bufferSize += 1; /* CsrWifiSmeRadioIF primitive->ifIndex */ @@ -346,11 +346,11 @@ CsrSize CsrWifiNmeApStartReqSizeof(void *msg) bufferSize += primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount; /* u8 primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel */ } } - bufferSize += 1; /* CsrBool primitive->p2pGoParam.opPsEnabled */ + bufferSize += 1; /* u8 primitive->p2pGoParam.opPsEnabled */ bufferSize += 1; /* u8 primitive->p2pGoParam.ctWindow */ bufferSize += 1; /* CsrWifiSmeP2pNoaConfigMethod primitive->p2pGoParam.noaConfigMethod */ - bufferSize += 1; /* CsrBool primitive->p2pGoParam.allowNoaWithNonP2pDevices */ - bufferSize += 1; /* CsrBool primitive->wpsEnabled */ + bufferSize += 1; /* u8 primitive->p2pGoParam.allowNoaWithNonP2pDevices */ + bufferSize += 1; /* u8 primitive->wpsEnabled */ return bufferSize; } @@ -589,7 +589,7 @@ CsrSize CsrWifiNmeApWmmParamUpdateReqSizeof(void *msg) bufferSize += 1; /* u8 primitive->wmmApParams[i1].cwMax */ bufferSize += 1; /* u8 primitive->wmmApParams[i1].aifs */ bufferSize += 2; /* u16 primitive->wmmApParams[i1].txopLimit */ - bufferSize += 1; /* CsrBool primitive->wmmApParams[i1].admissionControlMandatory */ + bufferSize += 1; /* u8 primitive->wmmApParams[i1].admissionControlMandatory */ } } { @@ -600,7 +600,7 @@ CsrSize CsrWifiNmeApWmmParamUpdateReqSizeof(void *msg) bufferSize += 1; /* u8 primitive->wmmApBcParams[i1].cwMax */ bufferSize += 1; /* u8 primitive->wmmApBcParams[i1].aifs */ bufferSize += 2; /* u16 primitive->wmmApBcParams[i1].txopLimit */ - bufferSize += 1; /* CsrBool primitive->wmmApBcParams[i1].admissionControlMandatory */ + bufferSize += 1; /* u8 primitive->wmmApBcParams[i1].admissionControlMandatory */ } } return bufferSize; @@ -679,7 +679,7 @@ CsrSize CsrWifiNmeApStaRemoveReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */ bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 6; /* u8 primitive->staMacAddress.a[6] */ - bufferSize += 1; /* CsrBool primitive->keepBlocking */ + bufferSize += 1; /* u8 primitive->keepBlocking */ return bufferSize; } diff --git a/drivers/staging/csr/csr_wifi_nme_prim.h b/drivers/staging/csr/csr_wifi_nme_prim.h index 07ed884..4676b42 100644 --- a/drivers/staging/csr/csr_wifi_nme_prim.h +++ b/drivers/staging/csr/csr_wifi_nme_prim.h @@ -720,7 +720,7 @@ typedef struct char *privateKeyPassword; u32 sessionLength; u8 *session; - CsrBool allowPacProvisioning; + u8 allowPacProvisioning; u32 pacLength; u8 *pac; char *pacPassword; @@ -896,7 +896,7 @@ typedef struct CsrWifiNmeBssType bssType; u8 channelNo; u8 ccxOptionsMask; - CsrBool cloakedSsid; + u8 cloakedSsid; CsrWifiNmeCredentials credentials; } CsrWifiNmeProfile; diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_prim.h b/drivers/staging/csr/csr_wifi_router_ctrl_prim.h index 076ef53..f5ad3b3 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_prim.h +++ b/drivers/staging/csr/csr_wifi_router_ctrl_prim.h @@ -32,7 +32,7 @@ typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteWrite)(u8 func, u32 address, u8 typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteRead)(u8 func, u32 address, u8 *pdata); typedef CsrResult (*CsrWifiRouterCtrlRawSdioFirmwareDownload)(u32 length, const u8 *pdata); typedef CsrResult (*CsrWifiRouterCtrlRawSdioReset)(void); -typedef CsrResult (*CsrWifiRouterCtrlRawSdioCoreDumpPrepare)(CsrBool suspendSme); +typedef CsrResult (*CsrWifiRouterCtrlRawSdioCoreDumpPrepare)(u8 suspendSme); typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteBlockRead)(u8 func, u32 address, u8 *pdata, u32 length); typedef CsrResult (*CsrWifiRouterCtrlRawSdioGpRead16)(u8 func, u32 address, u16 *pdata); typedef CsrResult (*CsrWifiRouterCtrlRawSdioGpWrite16)(u8 func, u32 address, u16 data); @@ -488,7 +488,7 @@ typedef struct *******************************************************************************/ typedef struct { - CsrBool wmmOrQosEnabled; + u8 wmmOrQosEnabled; CsrWifiRouterCtrlPowersaveTypeMask powersaveMode; u8 maxSpLength; u16 listenIntervalInTus; @@ -684,7 +684,7 @@ typedef struct CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; CsrWifiRouterCtrlLowPowerMode mode; - CsrBool wakeHost; + u8 wakeHost; } CsrWifiRouterCtrlConfigurePowerModeReq; /******************************************************************************* @@ -791,7 +791,7 @@ typedef struct CsrWifiRouterCtrlPortAction uncontrolledPortAction; CsrWifiRouterCtrlPortAction controlledPortAction; CsrWifiMacAddress macAddress; - CsrBool setProtection; + u8 setProtection; } CsrWifiRouterCtrlPortConfigureReq; /******************************************************************************* @@ -1073,7 +1073,7 @@ typedef struct u16 numInterfaceAddress; CsrWifiMacAddress stationMacAddress[2]; CsrWifiRouterCtrlSmeVersions smeVersions; - CsrBool scheduledInterrupt; + u8 scheduledInterrupt; } CsrWifiRouterCtrlWifiOnRes; /******************************************************************************* @@ -1126,8 +1126,8 @@ typedef struct CsrWifiRouterCtrlRequestorInfo clientData; CsrWifiRouterCtrlMode mode; CsrWifiMacAddress bssid; - CsrBool protection; - CsrBool intraBssDistEnabled; + u8 protection; + u8 intraBssDistEnabled; } CsrWifiRouterCtrlModeSetReq; /******************************************************************************* @@ -1383,7 +1383,7 @@ typedef struct { CsrWifiFsmEvent common; u16 interfaceTag; - CsrBool isWapiConnected; + u8 isWapiConnected; } CsrWifiRouterCtrlWapiFilterReq; /******************************************************************************* @@ -1482,7 +1482,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrBool powerMaintained; + u8 powerMaintained; } CsrWifiRouterCtrlResumeInd; /******************************************************************************* @@ -1503,8 +1503,8 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiRouterCtrlRequestorInfo clientData; - CsrBool hardSuspend; - CsrBool d3Suspend; + u8 hardSuspend; + u8 d3Suspend; } CsrWifiRouterCtrlSuspendInd; /******************************************************************************* @@ -1802,7 +1802,7 @@ typedef struct CsrWifiRouterCtrlRequestorInfo clientData; u16 interfaceTag; CsrWifiMacAddress peerMacAddress; - CsrBool unicastPdu; + u8 unicastPdu; } CsrWifiRouterCtrlMicFailureInd; /******************************************************************************* diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c index 2dca1ea..8cad0a4 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c @@ -31,7 +31,7 @@ CsrSize CsrWifiRouterCtrlConfigurePowerModeReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* CsrWifiRouterCtrlLowPowerMode primitive->mode */ - bufferSize += 1; /* CsrBool primitive->wakeHost */ + bufferSize += 1; /* u8 primitive->wakeHost */ return bufferSize; } @@ -284,7 +284,7 @@ CsrSize CsrWifiRouterCtrlPortConfigureReqSizeof(void *msg) bufferSize += 2; /* CsrWifiRouterCtrlPortAction primitive->uncontrolledPortAction */ bufferSize += 2; /* CsrWifiRouterCtrlPortAction primitive->controlledPortAction */ bufferSize += 6; /* u8 primitive->macAddress.a[6] */ - bufferSize += 1; /* CsrBool primitive->setProtection */ + bufferSize += 1; /* u8 primitive->setProtection */ return bufferSize; } @@ -734,7 +734,7 @@ CsrSize CsrWifiRouterCtrlWifiOnResSizeof(void *msg) bufferSize += 4; /* u32 primitive->smeVersions.firmwarePatch */ bufferSize += (primitive->smeVersions.smeBuild?CsrStrLen(primitive->smeVersions.smeBuild) : 0) + 1; /* char* primitive->smeVersions.smeBuild (0 byte len + 1 for NULL Term) */ bufferSize += 4; /* u32 primitive->smeVersions.smeHip */ - bufferSize += 1; /* CsrBool primitive->scheduledInterrupt */ + bufferSize += 1; /* u8 primitive->scheduledInterrupt */ return bufferSize; } @@ -841,8 +841,8 @@ CsrSize CsrWifiRouterCtrlModeSetReqSizeof(void *msg) bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 1; /* CsrWifiRouterCtrlMode primitive->mode */ bufferSize += 6; /* u8 primitive->bssid.a[6] */ - bufferSize += 1; /* CsrBool primitive->protection */ - bufferSize += 1; /* CsrBool primitive->intraBssDistEnabled */ + bufferSize += 1; /* u8 primitive->protection */ + bufferSize += 1; /* u8 primitive->intraBssDistEnabled */ return bufferSize; } @@ -889,7 +889,7 @@ CsrSize CsrWifiRouterCtrlPeerAddReqSizeof(void *msg) bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ bufferSize += 2; /* u16 primitive->associationId */ - bufferSize += 1; /* CsrBool primitive->staInfo.wmmOrQosEnabled */ + bufferSize += 1; /* u8 primitive->staInfo.wmmOrQosEnabled */ bufferSize += 2; /* CsrWifiRouterCtrlPowersaveTypeMask primitive->staInfo.powersaveMode */ bufferSize += 1; /* u8 primitive->staInfo.maxSpLength */ bufferSize += 2; /* u16 primitive->staInfo.listenIntervalInTus */ @@ -1467,8 +1467,8 @@ CsrSize CsrWifiRouterCtrlSuspendIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 1; /* CsrBool primitive->hardSuspend */ - bufferSize += 1; /* CsrBool primitive->d3Suspend */ + bufferSize += 1; /* u8 primitive->hardSuspend */ + bufferSize += 1; /* u8 primitive->d3Suspend */ return bufferSize; } @@ -1969,7 +1969,7 @@ CsrSize CsrWifiRouterCtrlMicFailureIndSizeof(void *msg) bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ - bufferSize += 1; /* CsrBool primitive->unicastPdu */ + bufferSize += 1; /* u8 primitive->unicastPdu */ return bufferSize; } diff --git a/drivers/staging/csr/csr_wifi_router_prim.h b/drivers/staging/csr/csr_wifi_router_prim.h index 3b9ce1a..64b1f4f 100644 --- a/drivers/staging/csr/csr_wifi_router_prim.h +++ b/drivers/staging/csr/csr_wifi_router_prim.h @@ -249,7 +249,7 @@ typedef struct CsrWifiRouterFrameFreeFunction freeFunction; CsrWifiRouterPriority priority; u32 hostTag; - CsrBool cfmRequested; + u8 cfmRequested; } CsrWifiRouterMaPacketReq; /******************************************************************************* diff --git a/drivers/staging/csr/csr_wifi_router_serialize.c b/drivers/staging/csr/csr_wifi_router_serialize.c index c90bf7d..913c291 100644 --- a/drivers/staging/csr/csr_wifi_router_serialize.c +++ b/drivers/staging/csr/csr_wifi_router_serialize.c @@ -79,7 +79,7 @@ CsrSize CsrWifiRouterMaPacketReqSizeof(void *msg) bufferSize += 4; /* CsrWifiRouterFrameFreeFunction primitive->freeFunction */ bufferSize += 2; /* CsrWifiRouterPriority primitive->priority */ bufferSize += 4; /* u32 primitive->hostTag */ - bufferSize += 1; /* CsrBool primitive->cfmRequested */ + bufferSize += 1; /* u8 primitive->cfmRequested */ return bufferSize; } diff --git a/drivers/staging/csr/csr_wifi_sme_ap_prim.h b/drivers/staging/csr/csr_wifi_sme_ap_prim.h index 363c10b..01df2a5 100644 --- a/drivers/staging/csr/csr_wifi_sme_ap_prim.h +++ b/drivers/staging/csr/csr_wifi_sme_ap_prim.h @@ -248,12 +248,12 @@ typedef u16 CsrWifiSmeApWapiCapabilitiesMask; *******************************************************************************/ typedef struct { - CsrBool greenfieldSupported; - CsrBool shortGi20MHz; + u8 greenfieldSupported; + u8 shortGi20MHz; u8 rxStbc; - CsrBool rifsModeAllowed; + u8 rifsModeAllowed; u8 htProtection; - CsrBool dualCtsProtection; + u8 dualCtsProtection; } CsrWifiSmeApHtParams; /******************************************************************************* @@ -389,9 +389,9 @@ typedef struct u8 supportedRatesCount; u8 supportedRates[20]; CsrWifiSmePreambleType preamble; - CsrBool shortSlotTimeEnabled; + u8 shortSlotTimeEnabled; CsrWifiSmeCtsProtectionType ctsProtectionType; - CsrBool wmmEnabled; + u8 wmmEnabled; CsrWifiSmeWmmAcParams wmmApParams[4]; CsrWifiSmeWmmAcParams wmmApBcParams[4]; CsrWifiSmeApAccessType accessType; @@ -435,10 +435,10 @@ typedef struct { CsrWifiSmeP2pGroupCapabilityMask groupCapability; CsrWifiSmeApP2pOperatingChanList operatingChanList; - CsrBool opPsEnabled; + u8 opPsEnabled; u8 ctWindow; CsrWifiSmeP2pNoaConfigMethod noaConfigMethod; - CsrBool allowNoaWithNonP2pDevices; + u8 allowNoaWithNonP2pDevices; } CsrWifiSmeApP2pGoConfig; /******************************************************************************* @@ -481,7 +481,7 @@ typedef struct typedef struct { CsrWifiSmeApCredentials apCredentials; - CsrBool wpsEnabled; + u8 wpsEnabled; } CsrWifiSmeApSecConfig; @@ -553,7 +553,7 @@ typedef struct u16 interfaceTag; u8 initialPresence; CsrWifiSmeApType apType; - CsrBool cloakSsid; + u8 cloakSsid; CsrWifiSsid ssid; CsrWifiSmeRadioIF ifIndex; u8 channel; @@ -675,7 +675,7 @@ typedef struct CsrWifiSmeIEEE80211Reason deauthReason; CsrWifiSmeIEEE80211Reason disassocReason; CsrWifiMacAddress peerMacaddress; - CsrBool keepBlocking; + u8 keepBlocking; } CsrWifiSmeApStaDisconnectReq; /******************************************************************************* diff --git a/drivers/staging/csr/csr_wifi_sme_prim.h b/drivers/staging/csr/csr_wifi_sme_prim.h index 3131dd7..84eb6e9 100644 --- a/drivers/staging/csr/csr_wifi_sme_prim.h +++ b/drivers/staging/csr/csr_wifi_sme_prim.h @@ -1988,9 +1988,9 @@ typedef struct typedef struct { u8 keepAliveTimeMs; - CsrBool apRoamingEnabled; + u8 apRoamingEnabled; u8 measurementsMask; - CsrBool ccxRadioMgtEnabled; + u8 ccxRadioMgtEnabled; } CsrWifiSmeCcxConfig; /******************************************************************************* @@ -2037,8 +2037,8 @@ typedef struct *******************************************************************************/ typedef struct { - CsrBool coexEnableSchemeManagement; - CsrBool coexPeriodicWakeHost; + u8 coexEnableSchemeManagement; + u8 coexPeriodicWakeHost; u16 coexTrafficBurstyLatencyMs; u16 coexTrafficContinuousLatencyMs; u16 coexObexBlackoutDurationMs; @@ -2231,7 +2231,7 @@ typedef struct *******************************************************************************/ typedef struct { - CsrBool unifiFixMaxTxDataRate; + u8 unifiFixMaxTxDataRate; u8 unifiFixTxDataRate; u16 dot11RtsThreshold; u16 dot11FragmentationThreshold; @@ -2294,7 +2294,7 @@ typedef struct typedef struct { CsrWifiMacAddress bssid; - CsrBool preAuthAllowed; + u8 preAuthAllowed; } CsrWifiSmePmkidCandidate; /******************************************************************************* @@ -2339,8 +2339,8 @@ typedef struct *******************************************************************************/ typedef struct { - CsrBool dot11MultiDomainCapabilityImplemented; - CsrBool dot11MultiDomainCapabilityEnabled; + u8 dot11MultiDomainCapabilityImplemented; + u8 dot11MultiDomainCapabilityEnabled; CsrWifiSmeRegulatoryDomain currentRegulatoryDomain; u8 currentCountryCode[2]; } CsrWifiSmeRegulatoryDomainInfo; @@ -2489,7 +2489,7 @@ typedef struct u8 cwMax; u8 aifs; u16 txopLimit; - CsrBool admissionControlMandatory; + u8 admissionControlMandatory; } CsrWifiSmeWmmAcParams; /******************************************************************************* @@ -2523,7 +2523,7 @@ typedef struct *******************************************************************************/ typedef struct { - CsrBool spportWps; + u8 spportWps; u8 deviceType; } CsrWifiSmeWpsDeviceTypeCommon; @@ -2596,13 +2596,13 @@ typedef struct *******************************************************************************/ typedef struct { - CsrBool hasTrafficData; + u8 hasTrafficData; CsrWifiSmeTrafficType currentTrafficType; u16 currentPeriodMs; CsrWifiSmePowerSaveLevel currentPowerSave; u16 currentCoexPeriodMs; u16 currentCoexLatencyMs; - CsrBool hasBtDevice; + u8 hasBtDevice; u32 currentBlackoutDurationUs; u32 currentBlackoutPeriodUs; CsrWifiSmeCoexScheme currentCoexScheme; @@ -2677,7 +2677,7 @@ typedef struct u16 mlmeAssociateReqInformationElementsLength; u8 *mlmeAssociateReqInformationElements; CsrWifiSmeWmmQosInfoMask wmmQosInfo; - CsrBool adhocJoinOnly; + u8 adhocJoinOnly; u8 adhocChannel; } CsrWifiSmeConnectionConfig; @@ -2756,7 +2756,7 @@ typedef struct CsrWifiSmeRadioIF ifIndex; u16 atimWindowTu; u16 beaconPeriodTu; - CsrBool reassociation; + u8 reassociation; u16 beaconFrameLength; u8 *beaconFrame; u16 associationReqFrameLength; @@ -2800,7 +2800,7 @@ typedef struct CsrWifiSme80211dTrustLevel trustLevel; u8 countryCode[2]; CsrWifiSmeFirmwareDriverInterface firmwareDriverInterface; - CsrBool enableStrictDraftN; + u8 enableStrictDraftN; } CsrWifiSmeDeviceConfig; /******************************************************************************* @@ -2925,9 +2925,9 @@ typedef struct { CsrWifiSmeKeyType keyType; u8 keyIndex; - CsrBool wepTxKey; + u8 wepTxKey; u16 keyRsc[8]; - CsrBool authenticator; + u8 authenticator; CsrWifiMacAddress address; u8 keyLength; u8 key[32]; @@ -3001,11 +3001,11 @@ typedef struct { CsrWifiSmePowerSaveLevel powerSaveLevel; u16 listenIntervalTu; - CsrBool rxDtims; + u8 rxDtims; CsrWifiSmeD3AutoScanMode d3AutoScanMode; u8 clientTrafficWindow; - CsrBool opportunisticPowerSave; - CsrBool noticeOfAbsence; + u8 opportunisticPowerSave; + u8 noticeOfAbsence; } CsrWifiSmePowerConfig; /******************************************************************************* @@ -3039,8 +3039,8 @@ typedef struct typedef struct { CsrWifiSmeRoamingBandData roamingBands[3]; - CsrBool disableSmoothRoaming; - CsrBool disableRoamScans; + u8 disableSmoothRoaming; + u8 disableRoamScans; u8 reconnectLimit; u16 reconnectLimitIntervalMs; CsrWifiSmeScanConfigData roamScanCfg[3]; @@ -3085,7 +3085,7 @@ typedef struct typedef struct { CsrWifiSmeScanConfigData scanCfg[4]; - CsrBool disableAutonomousScans; + u8 disableAutonomousScans; u16 maxResults; s8 highRssiThreshold; s8 lowRssiThreshold; @@ -3193,8 +3193,8 @@ typedef struct u8 connectionQualitySnrChangeTrigger; CsrWifiSmeWmmModeMask wmmModeMask; CsrWifiSmeRadioIF ifIndex; - CsrBool allowUnicastUseGroupCipher; - CsrBool enableOpportunisticKeyCaching; + u8 allowUnicastUseGroupCipher; + u8 enableOpportunisticKeyCaching; } CsrWifiSmeStaConfig; /******************************************************************************* @@ -4401,7 +4401,7 @@ typedef struct u8 ssidCount; CsrWifiSsid *ssid; CsrWifiMacAddress bssid; - CsrBool forceScan; + u8 forceScan; CsrWifiSmeBssType bssType; CsrWifiSmeScanType scanType; u16 channelListCount; @@ -4561,7 +4561,7 @@ typedef struct u16 interfaceTag; CsrWifiSmeListAction action; u32 transactionId; - CsrBool strict; + u8 strict; CsrWifiSmeTspecCtrlMask ctrlMask; u16 tspecLength; u8 *tspec; @@ -5383,7 +5383,7 @@ typedef struct { CsrWifiFsmEvent common; CsrWifiMacAddress address; - CsrBool isconnected; + u8 isconnected; } CsrWifiSmeIbssStationInd; /******************************************************************************* @@ -5608,7 +5608,7 @@ typedef struct { CsrWifiFsmEvent common; u16 interfaceTag; - CsrBool secondFailure; + u8 secondFailure; u16 count; CsrWifiMacAddress address; CsrWifiSmeKeyType keyType; diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.c b/drivers/staging/csr/csr_wifi_sme_serialize.c index c9070ca..472f9c0 100644 --- a/drivers/staging/csr/csr_wifi_sme_serialize.c +++ b/drivers/staging/csr/csr_wifi_sme_serialize.c @@ -203,9 +203,9 @@ CsrSize CsrWifiSmeCcxConfigSetReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* u8 primitive->ccxConfig.keepAliveTimeMs */ - bufferSize += 1; /* CsrBool primitive->ccxConfig.apRoamingEnabled */ + bufferSize += 1; /* u8 primitive->ccxConfig.apRoamingEnabled */ bufferSize += 1; /* u8 primitive->ccxConfig.measurementsMask */ - bufferSize += 1; /* CsrBool primitive->ccxConfig.ccxRadioMgtEnabled */ + bufferSize += 1; /* u8 primitive->ccxConfig.ccxRadioMgtEnabled */ return bufferSize; } @@ -246,8 +246,8 @@ CsrSize CsrWifiSmeCoexConfigSetReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 29) */ - bufferSize += 1; /* CsrBool primitive->coexConfig.coexEnableSchemeManagement */ - bufferSize += 1; /* CsrBool primitive->coexConfig.coexPeriodicWakeHost */ + bufferSize += 1; /* u8 primitive->coexConfig.coexEnableSchemeManagement */ + bufferSize += 1; /* u8 primitive->coexConfig.coexPeriodicWakeHost */ bufferSize += 2; /* u16 primitive->coexConfig.coexTrafficBurstyLatencyMs */ bufferSize += 2; /* u16 primitive->coexConfig.coexTrafficContinuousLatencyMs */ bufferSize += 2; /* u16 primitive->coexConfig.coexObexBlackoutDurationMs */ @@ -331,7 +331,7 @@ CsrSize CsrWifiSmeConnectReqSizeof(void *msg) bufferSize += 2; /* u16 primitive->connectionConfig.mlmeAssociateReqInformationElementsLength */ bufferSize += primitive->connectionConfig.mlmeAssociateReqInformationElementsLength; /* u8 primitive->connectionConfig.mlmeAssociateReqInformationElements */ bufferSize += 1; /* CsrWifiSmeWmmQosInfoMask primitive->connectionConfig.wmmQosInfo */ - bufferSize += 1; /* CsrBool primitive->connectionConfig.adhocJoinOnly */ + bufferSize += 1; /* u8 primitive->connectionConfig.adhocJoinOnly */ bufferSize += 1; /* u8 primitive->connectionConfig.adhocChannel */ return bufferSize; } @@ -453,7 +453,7 @@ CsrSize CsrWifiSmeKeyReqSizeof(void *msg) bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ bufferSize += 1; /* CsrWifiSmeKeyType primitive->key.keyType */ bufferSize += 1; /* u8 primitive->key.keyIndex */ - bufferSize += 1; /* CsrBool primitive->key.wepTxKey */ + bufferSize += 1; /* u8 primitive->key.wepTxKey */ { u16 i2; for (i2 = 0; i2 < 8; i2++) @@ -461,7 +461,7 @@ CsrSize CsrWifiSmeKeyReqSizeof(void *msg) bufferSize += 2; /* u16 primitive->key.keyRsc[8] */ } } - bufferSize += 1; /* CsrBool primitive->key.authenticator */ + bufferSize += 1; /* u8 primitive->key.authenticator */ bufferSize += 6; /* u8 primitive->key.address.a[6] */ bufferSize += 1; /* u8 primitive->key.keyLength */ bufferSize += 32; /* u8 primitive->key.key[32] */ @@ -527,7 +527,7 @@ CsrSize CsrWifiSmeMibConfigSetReqSizeof(void *msg) CsrSize bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ - bufferSize += 1; /* CsrBool primitive->mibConfig.unifiFixMaxTxDataRate */ + bufferSize += 1; /* u8 primitive->mibConfig.unifiFixMaxTxDataRate */ bufferSize += 1; /* u8 primitive->mibConfig.unifiFixTxDataRate */ bufferSize += 2; /* u16 primitive->mibConfig.dot11RtsThreshold */ bufferSize += 2; /* u16 primitive->mibConfig.dot11FragmentationThreshold */ @@ -958,11 +958,11 @@ CsrSize CsrWifiSmePowerConfigSetReqSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ bufferSize += 1; /* CsrWifiSmePowerSaveLevel primitive->powerConfig.powerSaveLevel */ bufferSize += 2; /* u16 primitive->powerConfig.listenIntervalTu */ - bufferSize += 1; /* CsrBool primitive->powerConfig.rxDtims */ + bufferSize += 1; /* u8 primitive->powerConfig.rxDtims */ bufferSize += 1; /* CsrWifiSmeD3AutoScanMode primitive->powerConfig.d3AutoScanMode */ bufferSize += 1; /* u8 primitive->powerConfig.clientTrafficWindow */ - bufferSize += 1; /* CsrBool primitive->powerConfig.opportunisticPowerSave */ - bufferSize += 1; /* CsrBool primitive->powerConfig.noticeOfAbsence */ + bufferSize += 1; /* u8 primitive->powerConfig.opportunisticPowerSave */ + bufferSize += 1; /* u8 primitive->powerConfig.noticeOfAbsence */ return bufferSize; } @@ -1018,8 +1018,8 @@ CsrSize CsrWifiSmeRoamingConfigSetReqSizeof(void *msg) bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].snrLowThreshold */ } } - bufferSize += 1; /* CsrBool primitive->roamingConfig.disableSmoothRoaming */ - bufferSize += 1; /* CsrBool primitive->roamingConfig.disableRoamScans */ + bufferSize += 1; /* u8 primitive->roamingConfig.disableSmoothRoaming */ + bufferSize += 1; /* u8 primitive->roamingConfig.disableRoamScans */ bufferSize += 1; /* u8 primitive->roamingConfig.reconnectLimit */ bufferSize += 2; /* u16 primitive->roamingConfig.reconnectLimitIntervalMs */ { @@ -1131,7 +1131,7 @@ CsrSize CsrWifiSmeScanConfigSetReqSizeof(void *msg) bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu */ } } - bufferSize += 1; /* CsrBool primitive->scanConfig.disableAutonomousScans */ + bufferSize += 1; /* u8 primitive->scanConfig.disableAutonomousScans */ bufferSize += 2; /* u16 primitive->scanConfig.maxResults */ bufferSize += 1; /* s8 primitive->scanConfig.highRssiThreshold */ bufferSize += 1; /* s8 primitive->scanConfig.lowRssiThreshold */ @@ -1245,7 +1245,7 @@ CsrSize CsrWifiSmeScanFullReqSizeof(void *msg) } } bufferSize += 6; /* u8 primitive->bssid.a[6] */ - bufferSize += 1; /* CsrBool primitive->forceScan */ + bufferSize += 1; /* u8 primitive->forceScan */ bufferSize += 1; /* CsrWifiSmeBssType primitive->bssType */ bufferSize += 1; /* CsrWifiSmeScanType primitive->scanType */ bufferSize += 2; /* u16 primitive->channelListCount */ @@ -1358,8 +1358,8 @@ CsrSize CsrWifiSmeSmeStaConfigSetReqSizeof(void *msg) bufferSize += 1; /* u8 primitive->smeConfig.connectionQualitySnrChangeTrigger */ bufferSize += 1; /* CsrWifiSmeWmmModeMask primitive->smeConfig.wmmModeMask */ bufferSize += 1; /* CsrWifiSmeRadioIF primitive->smeConfig.ifIndex */ - bufferSize += 1; /* CsrBool primitive->smeConfig.allowUnicastUseGroupCipher */ - bufferSize += 1; /* CsrBool primitive->smeConfig.enableOpportunisticKeyCaching */ + bufferSize += 1; /* u8 primitive->smeConfig.allowUnicastUseGroupCipher */ + bufferSize += 1; /* u8 primitive->smeConfig.enableOpportunisticKeyCaching */ return bufferSize; } @@ -1408,7 +1408,7 @@ CsrSize CsrWifiSmeTspecReqSizeof(void *msg) bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ bufferSize += 4; /* u32 primitive->transactionId */ - bufferSize += 1; /* CsrBool primitive->strict */ + bufferSize += 1; /* u8 primitive->strict */ bufferSize += 1; /* CsrWifiSmeTspecCtrlMask primitive->ctrlMask */ bufferSize += 2; /* u16 primitive->tspecLength */ bufferSize += primitive->tspecLength; /* u8 primitive->tspec */ @@ -1751,7 +1751,7 @@ CsrSize CsrWifiSmeSmeCommonConfigSetReqSizeof(void *msg) bufferSize += 1; /* CsrWifiSme80211dTrustLevel primitive->deviceConfig.trustLevel */ bufferSize += 2; /* u8 primitive->deviceConfig.countryCode[2] */ bufferSize += 1; /* CsrWifiSmeFirmwareDriverInterface primitive->deviceConfig.firmwareDriverInterface */ - bufferSize += 1; /* CsrBool primitive->deviceConfig.enableStrictDraftN */ + bufferSize += 1; /* u8 primitive->deviceConfig.enableStrictDraftN */ return bufferSize; } @@ -2019,7 +2019,7 @@ CsrSize CsrWifiSmeAssociationCompleteIndSizeof(void *msg) bufferSize += 1; /* CsrWifiSmeRadioIF primitive->connectionInfo.ifIndex */ bufferSize += 2; /* u16 primitive->connectionInfo.atimWindowTu */ bufferSize += 2; /* u16 primitive->connectionInfo.beaconPeriodTu */ - bufferSize += 1; /* CsrBool primitive->connectionInfo.reassociation */ + bufferSize += 1; /* u8 primitive->connectionInfo.reassociation */ bufferSize += 2; /* u16 primitive->connectionInfo.beaconFrameLength */ bufferSize += primitive->connectionInfo.beaconFrameLength; /* u8 primitive->connectionInfo.beaconFrame */ bufferSize += 2; /* u16 primitive->connectionInfo.associationReqFrameLength */ @@ -2397,9 +2397,9 @@ CsrSize CsrWifiSmeCcxConfigGetCfmSizeof(void *msg) bufferSize += 2; /* u16 primitive->interfaceTag */ bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* u8 primitive->ccxConfig.keepAliveTimeMs */ - bufferSize += 1; /* CsrBool primitive->ccxConfig.apRoamingEnabled */ + bufferSize += 1; /* u8 primitive->ccxConfig.apRoamingEnabled */ bufferSize += 1; /* u8 primitive->ccxConfig.measurementsMask */ - bufferSize += 1; /* CsrBool primitive->ccxConfig.ccxRadioMgtEnabled */ + bufferSize += 1; /* u8 primitive->ccxConfig.ccxRadioMgtEnabled */ return bufferSize; } @@ -2479,8 +2479,8 @@ CsrSize CsrWifiSmeCoexConfigGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 31) */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* CsrBool primitive->coexConfig.coexEnableSchemeManagement */ - bufferSize += 1; /* CsrBool primitive->coexConfig.coexPeriodicWakeHost */ + bufferSize += 1; /* u8 primitive->coexConfig.coexEnableSchemeManagement */ + bufferSize += 1; /* u8 primitive->coexConfig.coexPeriodicWakeHost */ bufferSize += 2; /* u16 primitive->coexConfig.coexTrafficBurstyLatencyMs */ bufferSize += 2; /* u16 primitive->coexConfig.coexTrafficContinuousLatencyMs */ bufferSize += 2; /* u16 primitive->coexConfig.coexObexBlackoutDurationMs */ @@ -2554,13 +2554,13 @@ CsrSize CsrWifiSmeCoexInfoGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 24) */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* CsrBool primitive->coexInfo.hasTrafficData */ + bufferSize += 1; /* u8 primitive->coexInfo.hasTrafficData */ bufferSize += 1; /* CsrWifiSmeTrafficType primitive->coexInfo.currentTrafficType */ bufferSize += 2; /* u16 primitive->coexInfo.currentPeriodMs */ bufferSize += 1; /* CsrWifiSmePowerSaveLevel primitive->coexInfo.currentPowerSave */ bufferSize += 2; /* u16 primitive->coexInfo.currentCoexPeriodMs */ bufferSize += 2; /* u16 primitive->coexInfo.currentCoexLatencyMs */ - bufferSize += 1; /* CsrBool primitive->coexInfo.hasBtDevice */ + bufferSize += 1; /* u8 primitive->coexInfo.hasBtDevice */ bufferSize += 4; /* u32 primitive->coexInfo.currentBlackoutDurationUs */ bufferSize += 4; /* u32 primitive->coexInfo.currentBlackoutPeriodUs */ bufferSize += 1; /* CsrWifiSmeCoexScheme primitive->coexInfo.currentCoexScheme */ @@ -2666,7 +2666,7 @@ CsrSize CsrWifiSmeConnectionConfigGetCfmSizeof(void *msg) bufferSize += 2; /* u16 primitive->connectionConfig.mlmeAssociateReqInformationElementsLength */ bufferSize += primitive->connectionConfig.mlmeAssociateReqInformationElementsLength; /* u8 primitive->connectionConfig.mlmeAssociateReqInformationElements */ bufferSize += 1; /* CsrWifiSmeWmmQosInfoMask primitive->connectionConfig.wmmQosInfo */ - bufferSize += 1; /* CsrBool primitive->connectionConfig.adhocJoinOnly */ + bufferSize += 1; /* u8 primitive->connectionConfig.adhocJoinOnly */ bufferSize += 1; /* u8 primitive->connectionConfig.adhocChannel */ return bufferSize; } @@ -2762,7 +2762,7 @@ CsrSize CsrWifiSmeConnectionInfoGetCfmSizeof(void *msg) bufferSize += 1; /* CsrWifiSmeRadioIF primitive->connectionInfo.ifIndex */ bufferSize += 2; /* u16 primitive->connectionInfo.atimWindowTu */ bufferSize += 2; /* u16 primitive->connectionInfo.beaconPeriodTu */ - bufferSize += 1; /* CsrBool primitive->connectionInfo.reassociation */ + bufferSize += 1; /* u8 primitive->connectionInfo.reassociation */ bufferSize += 2; /* u16 primitive->connectionInfo.beaconFrameLength */ bufferSize += primitive->connectionInfo.beaconFrameLength; /* u8 primitive->connectionInfo.beaconFrame */ bufferSize += 2; /* u16 primitive->connectionInfo.associationReqFrameLength */ @@ -3221,7 +3221,7 @@ CsrSize CsrWifiSmeIbssStationIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ bufferSize += 6; /* u8 primitive->address.a[6] */ - bufferSize += 1; /* CsrBool primitive->isconnected */ + bufferSize += 1; /* u8 primitive->isconnected */ return bufferSize; } @@ -3358,7 +3358,7 @@ CsrSize CsrWifiSmeMediaStatusIndSizeof(void *msg) bufferSize += 1; /* CsrWifiSmeRadioIF primitive->connectionInfo.ifIndex */ bufferSize += 2; /* u16 primitive->connectionInfo.atimWindowTu */ bufferSize += 2; /* u16 primitive->connectionInfo.beaconPeriodTu */ - bufferSize += 1; /* CsrBool primitive->connectionInfo.reassociation */ + bufferSize += 1; /* u8 primitive->connectionInfo.reassociation */ bufferSize += 2; /* u16 primitive->connectionInfo.beaconFrameLength */ bufferSize += primitive->connectionInfo.beaconFrameLength; /* u8 primitive->connectionInfo.beaconFrame */ bufferSize += 2; /* u16 primitive->connectionInfo.associationReqFrameLength */ @@ -3559,7 +3559,7 @@ CsrSize CsrWifiSmeMibConfigGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* CsrBool primitive->mibConfig.unifiFixMaxTxDataRate */ + bufferSize += 1; /* u8 primitive->mibConfig.unifiFixMaxTxDataRate */ bufferSize += 1; /* u8 primitive->mibConfig.unifiFixTxDataRate */ bufferSize += 2; /* u16 primitive->mibConfig.dot11RtsThreshold */ bufferSize += 2; /* u16 primitive->mibConfig.dot11FragmentationThreshold */ @@ -3725,7 +3725,7 @@ CsrSize CsrWifiSmeMicFailureIndSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* CsrBool primitive->secondFailure */ + bufferSize += 1; /* u8 primitive->secondFailure */ bufferSize += 2; /* u16 primitive->count */ bufferSize += 6; /* u8 primitive->address.a[6] */ bufferSize += 1; /* CsrWifiSmeKeyType primitive->keyType */ @@ -3926,7 +3926,7 @@ CsrSize CsrWifiSmePmkidCandidateListIndSizeof(void *msg) for (i1 = 0; i1 < primitive->pmkidCandidatesCount; i1++) { bufferSize += 6; /* u8 primitive->pmkidCandidates[i1].bssid.a[6] */ - bufferSize += 1; /* CsrBool primitive->pmkidCandidates[i1].preAuthAllowed */ + bufferSize += 1; /* u8 primitive->pmkidCandidates[i1].preAuthAllowed */ } } return bufferSize; @@ -4075,11 +4075,11 @@ CsrSize CsrWifiSmePowerConfigGetCfmSizeof(void *msg) bufferSize += 2; /* CsrResult primitive->status */ bufferSize += 1; /* CsrWifiSmePowerSaveLevel primitive->powerConfig.powerSaveLevel */ bufferSize += 2; /* u16 primitive->powerConfig.listenIntervalTu */ - bufferSize += 1; /* CsrBool primitive->powerConfig.rxDtims */ + bufferSize += 1; /* u8 primitive->powerConfig.rxDtims */ bufferSize += 1; /* CsrWifiSmeD3AutoScanMode primitive->powerConfig.d3AutoScanMode */ bufferSize += 1; /* u8 primitive->powerConfig.clientTrafficWindow */ - bufferSize += 1; /* CsrBool primitive->powerConfig.opportunisticPowerSave */ - bufferSize += 1; /* CsrBool primitive->powerConfig.noticeOfAbsence */ + bufferSize += 1; /* u8 primitive->powerConfig.opportunisticPowerSave */ + bufferSize += 1; /* u8 primitive->powerConfig.noticeOfAbsence */ return bufferSize; } @@ -4127,8 +4127,8 @@ CsrSize CsrWifiSmeRegulatoryDomainInfoGetCfmSizeof(void *msg) /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* CsrBool primitive->regDomInfo.dot11MultiDomainCapabilityImplemented */ - bufferSize += 1; /* CsrBool primitive->regDomInfo.dot11MultiDomainCapabilityEnabled */ + bufferSize += 1; /* u8 primitive->regDomInfo.dot11MultiDomainCapabilityImplemented */ + bufferSize += 1; /* u8 primitive->regDomInfo.dot11MultiDomainCapabilityEnabled */ bufferSize += 1; /* CsrWifiSmeRegulatoryDomain primitive->regDomInfo.currentRegulatoryDomain */ bufferSize += 2; /* u8 primitive->regDomInfo.currentCountryCode[2] */ return bufferSize; @@ -4258,8 +4258,8 @@ CsrSize CsrWifiSmeRoamingConfigGetCfmSizeof(void *msg) bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].snrLowThreshold */ } } - bufferSize += 1; /* CsrBool primitive->roamingConfig.disableSmoothRoaming */ - bufferSize += 1; /* CsrBool primitive->roamingConfig.disableRoamScans */ + bufferSize += 1; /* u8 primitive->roamingConfig.disableSmoothRoaming */ + bufferSize += 1; /* u8 primitive->roamingConfig.disableRoamScans */ bufferSize += 1; /* u8 primitive->roamingConfig.reconnectLimit */ bufferSize += 2; /* u16 primitive->roamingConfig.reconnectLimitIntervalMs */ { @@ -4410,7 +4410,7 @@ CsrSize CsrWifiSmeScanConfigGetCfmSizeof(void *msg) bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu */ } } - bufferSize += 1; /* CsrBool primitive->scanConfig.disableAutonomousScans */ + bufferSize += 1; /* u8 primitive->scanConfig.disableAutonomousScans */ bufferSize += 2; /* u16 primitive->scanConfig.maxResults */ bufferSize += 1; /* s8 primitive->scanConfig.highRssiThreshold */ bufferSize += 1; /* s8 primitive->scanConfig.lowRssiThreshold */ @@ -5143,8 +5143,8 @@ CsrSize CsrWifiSmeSmeStaConfigGetCfmSizeof(void *msg) bufferSize += 1; /* u8 primitive->smeConfig.connectionQualitySnrChangeTrigger */ bufferSize += 1; /* CsrWifiSmeWmmModeMask primitive->smeConfig.wmmModeMask */ bufferSize += 1; /* CsrWifiSmeRadioIF primitive->smeConfig.ifIndex */ - bufferSize += 1; /* CsrBool primitive->smeConfig.allowUnicastUseGroupCipher */ - bufferSize += 1; /* CsrBool primitive->smeConfig.enableOpportunisticKeyCaching */ + bufferSize += 1; /* u8 primitive->smeConfig.allowUnicastUseGroupCipher */ + bufferSize += 1; /* u8 primitive->smeConfig.enableOpportunisticKeyCaching */ return bufferSize; } @@ -5595,7 +5595,7 @@ CsrSize CsrWifiSmeSmeCommonConfigGetCfmSizeof(void *msg) bufferSize += 1; /* CsrWifiSme80211dTrustLevel primitive->deviceConfig.trustLevel */ bufferSize += 2; /* u8 primitive->deviceConfig.countryCode[2] */ bufferSize += 1; /* CsrWifiSmeFirmwareDriverInterface primitive->deviceConfig.firmwareDriverInterface */ - bufferSize += 1; /* CsrBool primitive->deviceConfig.enableStrictDraftN */ + bufferSize += 1; /* u8 primitive->deviceConfig.enableStrictDraftN */ return bufferSize; } diff --git a/drivers/staging/csr/csr_wifi_vif_utils.h b/drivers/staging/csr/csr_wifi_vif_utils.h index 4eafbec..523172d 100644 --- a/drivers/staging/csr/csr_wifi_vif_utils.h +++ b/drivers/staging/csr/csr_wifi_vif_utils.h @@ -64,9 +64,9 @@ extern "C" { * @param[in] CsrWifiInterfaceMode : mode * * @return - * CsrBool : returns true if the interface is allowed to operate in the mode otherwise false. + * u8 : returns true if the interface is allowed to operate in the mode otherwise false. */ -extern CsrBool CsrWifiVifUtilsCheckCompatibility(u8 interfaceCapability, +extern u8 CsrWifiVifUtilsCheckCompatibility(u8 interfaceCapability, u8 *currentInterfaceModes, u16 interfaceTag, CsrWifiInterfaceMode mode); @@ -80,9 +80,9 @@ extern CsrBool CsrWifiVifUtilsCheckCompatibility(u8 interfaceCapabil * @param[in] u16 : interfaceTag * * @return - * CsrBool : returns true if the interface is supported, otherwise false. + * u8 : returns true if the interface is supported, otherwise false. */ -extern CsrBool CsrWifiVifUtilsIsSupported(u16 interfaceTag); +extern u8 CsrWifiVifUtilsIsSupported(u16 interfaceTag); #ifdef CSR_LOG_ENABLE /** diff --git a/drivers/staging/csr/firmware.c b/drivers/staging/csr/firmware.c index b994d14..d14e118 100644 --- a/drivers/staging/csr/firmware.c +++ b/drivers/staging/csr/firmware.c @@ -296,7 +296,7 @@ uf_run_unifihelper(unifi_priv_t *priv) } /* uf_run_unifihelper() */ #ifdef CSR_WIFI_SPLIT_PATCH -static CsrBool is_ap_mode(unifi_priv_t *priv) +static u8 is_ap_mode(unifi_priv_t *priv) { if (priv == NULL || priv->interfacePriv[0] == NULL) { diff --git a/drivers/staging/csr/netdev.c b/drivers/staging/csr/netdev.c index 529bd9d..1e6e111 100644 --- a/drivers/staging/csr/netdev.c +++ b/drivers/staging/csr/netdev.c @@ -552,7 +552,7 @@ uf_alloc_netdevice(CsrSdioFunction *sdio_dev, int bus_id) * and should be freed by freeing the net_device pointer. * --------------------------------------------------------------------------- */ -CsrBool +u8 uf_alloc_netdevice_for_other_interfaces(unifi_priv_t *priv, u16 interfaceTag) { struct net_device *dev; @@ -1371,7 +1371,7 @@ int prepare_and_add_macheader(unifi_priv_t *priv, struct sk_buff *skb, struct sk u16 interfaceTag, const u8 *daddr, const u8 *saddr, - CsrBool protection) + u8 protection) { u16 fc = 0; u8 qc = 0; @@ -1382,7 +1382,7 @@ int prepare_and_add_macheader(unifi_priv_t *priv, struct sk_buff *skb, struct sk u8 direction = 0; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; u8 *addressOne; - CsrBool bQosNull = false; + u8 bQosNull = false; if (skb == NULL) { unifi_error(priv,"prepare_and_add_macheader: Invalid SKB reference\n"); @@ -1650,7 +1650,7 @@ send_ma_pkt_request(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr { int r; u16 i; - CsrBool eapolStore = FALSE; + u8 eapolStore = FALSE; struct sk_buff *newSkb = NULL; bulk_data_param_t bulkdata; const int proto = ntohs(ehdr->h_proto); @@ -2745,7 +2745,7 @@ static void process_ma_packet_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_d #ifdef CSR_SUPPORT_SME u8 dataFrameType = 0; - CsrBool powerSaveChanged = FALSE; + u8 powerSaveChanged = FALSE; u8 pmBit = 0; CsrWifiRouterCtrlStaInfo_t *srcStaInfo = NULL; u16 qosControl; diff --git a/drivers/staging/csr/sme_blocking.c b/drivers/staging/csr/sme_blocking.c index 92139671..3f0d70d 100644 --- a/drivers/staging/csr/sme_blocking.c +++ b/drivers/staging/csr/sme_blocking.c @@ -321,7 +321,7 @@ int sme_mgt_scan_full(unifi_priv_t *priv, unsigned char *channel_list) { CsrWifiMacAddress bcastAddress = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }}; - CsrBool is_active = (num_channels > 0) ? TRUE : FALSE; + u8 is_active = (num_channels > 0) ? TRUE : FALSE; int r; if (priv->smepriv == NULL) { diff --git a/drivers/staging/csr/sme_sys.c b/drivers/staging/csr/sme_sys.c index 7a41c9c..99de27e 100644 --- a/drivers/staging/csr/sme_sys.c +++ b/drivers/staging/csr/sme_sys.c @@ -1095,7 +1095,7 @@ void CsrWifiRouterCtrlWifiOnResHandler(void* drvpriv, CsrWifiFsmEvent* msg) int i; /* used as a loop counter */ u32 intmode = CSR_WIFI_INTMODE_DEFAULT; #ifdef CSR_WIFI_SPLIT_PATCH - CsrBool switching_ap_fw = FALSE; + u8 switching_ap_fw = FALSE; #endif /* Register the UniFi device with the OS network manager */ unifi_trace(priv, UDBG3, "Card Init Completed Successfully\n"); @@ -1365,7 +1365,7 @@ _sys_packet_req(unifi_priv_t *priv, const CSR_SIGNAL *signal, CsrWifiMacAddress peerMacAddress; CsrResult csrResult; u16 interfaceTag = req.VirtualInterfaceIdentifier & 0xff; - CsrBool eapolStore = FALSE; + u8 eapolStore = FALSE; s8 protection = 0; netInterface_priv_t *interfacePriv; unsigned long flags; @@ -2101,7 +2101,7 @@ void CsrWifiRouterCtrlPeerDelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) static int peer_add_new_record(unifi_priv_t *priv,CsrWifiRouterCtrlPeerAddReq *req,u32 *handle) { u8 i, powerModeTemp = 0; - CsrBool freeSlotFound = FALSE; + u8 freeSlotFound = FALSE; CsrWifiRouterCtrlStaInfo_t *newRecord = NULL; netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; CsrTime currentTime, currentTimeHi; @@ -2610,7 +2610,7 @@ static void ba_session_terminate_timer_func(unsigned long data) } -CsrBool blockack_session_stop(unifi_priv_t *priv, +u8 blockack_session_stop(unifi_priv_t *priv, u16 interfaceTag, CsrWifiRouterCtrlBlockAckRole role, u16 tID, @@ -2708,7 +2708,7 @@ CsrBool blockack_session_stop(unifi_priv_t *priv, void CsrWifiRouterCtrlBlockAckDisableReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) { CsrWifiRouterCtrlBlockAckDisableReq* req = (CsrWifiRouterCtrlBlockAckDisableReq*)msg; - CsrBool r; + u8 r; unifi_priv_t *priv = (unifi_priv_t*)drvpriv; unifi_trace(priv, UDBG6, "%s: in ok\n", __FUNCTION__); @@ -2730,7 +2730,7 @@ void CsrWifiRouterCtrlBlockAckDisableReqHandler(void* drvpriv, CsrWifiFsmEvent* } -CsrBool blockack_session_start(unifi_priv_t *priv, +u8 blockack_session_start(unifi_priv_t *priv, u16 interfaceTag, u16 tID, u16 timeout, @@ -2946,7 +2946,7 @@ CsrBool blockack_session_start(unifi_priv_t *priv, void CsrWifiRouterCtrlBlockAckEnableReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) { CsrWifiRouterCtrlBlockAckEnableReq* req = (CsrWifiRouterCtrlBlockAckEnableReq*)msg; - CsrBool r; + u8 r; unifi_priv_t *priv = (unifi_priv_t*)drvpriv; unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__); diff --git a/drivers/staging/csr/unifi_event.c b/drivers/staging/csr/unifi_event.c index f5c2e77..c27b23da 100644 --- a/drivers/staging/csr/unifi_event.c +++ b/drivers/staging/csr/unifi_event.c @@ -91,25 +91,25 @@ static void send_to_client(unifi_priv_t *priv, ul_client_t *client, * FALSE if the packet is for the driver or network stack * --------------------------------------------------------------------------- */ -static CsrBool check_routing_pkt_data_ind(unifi_priv_t *priv, +static u8 check_routing_pkt_data_ind(unifi_priv_t *priv, u8 *sigdata, const bulk_data_param_t* bulkdata, - CsrBool *freeBulkData, + u8 *freeBulkData, netInterface_priv_t *interfacePriv) { u16 frmCtrl, receptionStatus, frmCtrlSubType; u8 *macHdrLocation; u8 interfaceTag; - CsrBool isDataFrame; - CsrBool isProtocolVerInvalid = FALSE; - CsrBool isDataFrameSubTypeNoData = FALSE; + u8 isDataFrame; + u8 isProtocolVerInvalid = FALSE; + u8 isDataFrameSubTypeNoData = FALSE; #ifdef CSR_WIFI_SECURITY_WAPI_ENABLE static const u8 wapiProtocolIdSNAPHeader[] = {0x88,0xb4}; static const u8 wapiProtocolIdSNAPHeaderOffset = 6; u8 *destAddr; u8 *srcAddr; - CsrBool isWapiUnicastPkt = FALSE; + u8 isWapiUnicastPkt = FALSE; #ifdef CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND u16 qosControl; @@ -374,7 +374,7 @@ unifi_process_receive_event(void *ospriv, int i, receiver_id; int client_id; s16 signal_id; - CsrBool pktIndToSme = FALSE, freeBulkData = FALSE; + u8 pktIndToSme = FALSE, freeBulkData = FALSE; func_enter(); @@ -490,7 +490,7 @@ unifi_process_receive_event(void *ospriv, u8 *destAddr; CsrResult res; u16 interfaceTag = 0; - CsrBool isMcastPkt = TRUE; + u8 isMcastPkt = TRUE; unifi_trace(priv, UDBG6, "Received a WAPI data packet when the Unicast/Multicast filter is set\n"); res = read_unpack_signal(sigdata, &signal); @@ -578,7 +578,7 @@ unifi_process_receive_event(void *ospriv, #ifdef CSR_WIFI_RX_PATH_SPLIT -static CsrBool signal_buffer_is_full(unifi_priv_t* priv) +static u8 signal_buffer_is_full(unifi_priv_t* priv) { return (((priv->rxSignalBuffer.writePointer + 1)% priv->rxSignalBuffer.size) == (priv->rxSignalBuffer.readPointer)); } diff --git a/drivers/staging/csr/unifi_pdu_processing.c b/drivers/staging/csr/unifi_pdu_processing.c index d1afa3a..7c7e8d4 100644 --- a/drivers/staging/csr/unifi_pdu_processing.c +++ b/drivers/staging/csr/unifi_pdu_processing.c @@ -129,7 +129,7 @@ unifi_frame_ma_packet_req(unifi_priv_t *priv, CSR_PRIORITY priority, static int frame_and_send_queued_pdu(unifi_priv_t* priv,tx_buffered_packets_t* buffered_pkt, - CsrWifiRouterCtrlStaInfo_t *staRecord,CsrBool moreData , CsrBool eosp) + CsrWifiRouterCtrlStaInfo_t *staRecord,u8 moreData , u8 eosp) { CSR_SIGNAL signal; @@ -300,7 +300,7 @@ void verify_and_accomodate_tx_packet(unifi_priv_t *priv) struct list_head *listHead, *list; struct list_head *placeHolder; u8 i, j,eospFramedeleted=0; - CsrBool thresholdExcedeDueToBroadcast = TRUE; + u8 thresholdExcedeDueToBroadcast = TRUE; /* it will be made it interface Specific in the future when multi interfaces are supported , right now interface 0 is considered */ netInterface_priv_t *interfacePriv = priv->interfacePriv[0]; @@ -385,7 +385,7 @@ void verify_and_accomodate_tx_packet(unifi_priv_t *priv) static CsrResult enque_tx_data_pdu(unifi_priv_t *priv, bulk_data_param_t *bulkdata, struct list_head *list, CSR_SIGNAL *signal, - CsrBool requeueOnSamePos) + u8 requeueOnSamePos) { /* queue the tx data packets on to appropriate queue */ @@ -754,7 +754,7 @@ void uf_handle_tim_cfm(unifi_priv_t *priv, CSR_MLME_SET_TIM_CONFIRM *cfm, u16 re * If failure crosses this Limit, we have to take a call to FIX */ if (retryCount > UNIFI_MAX_RETRY_LIMIT) { - CsrBool moreData = FALSE; + u8 moreData = FALSE; retryCount = 0; /* Because of continuos traffic in fh_cmd_q the tim set request is failing (exceeding retry limit) * but if we didn't synchronize our timSet varible state with firmware then it can cause below issues @@ -959,7 +959,7 @@ void process_peer_active_transition(unifi_priv_t * priv, u16 interfaceTag) { int r,i; - CsrBool spaceAvail[4] = {TRUE,TRUE,TRUE,TRUE}; + u8 spaceAvail[4] = {TRUE,TRUE,TRUE,TRUE}; tx_buffered_packets_t * buffered_pkt = NULL; unsigned long lock_flags; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; @@ -1514,8 +1514,8 @@ uf_ap_process_data_pdu(unifi_priv_t *priv, struct sk_buff *skb, struct sk_buff *newSkb = NULL; /* pointer to skb or private skb created using skb_copy() */ struct sk_buff *skbPtr = skb; - CsrBool sendToNetdev = FALSE; - CsrBool qosDestination = FALSE; + u8 sendToNetdev = FALSE; + u8 qosDestination = FALSE; CSR_PRIORITY priority = CSR_CONTENTION; CsrWifiRouterCtrlStaInfo_t *dstStaInfo = NULL; netInterface_priv_t *interfacePriv; @@ -1660,13 +1660,13 @@ CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, const u8 *macHdrLocation = bulkdata->d[0].os_data_ptr; CsrWifiPacketType pktType; int frameType = 0; - CsrBool queuePacketDozing = FALSE; + u8 queuePacketDozing = FALSE; u32 priority_q; u16 frmCtrl; struct list_head * list = NULL; /* List to which buffered PDUs are to be enqueued*/ - CsrBool setBcTim=FALSE; + u8 setBcTim=FALSE; netInterface_priv_t *interfacePriv; - CsrBool requeueOnSamePos = FALSE; + u8 requeueOnSamePos = FALSE; u32 handle = 0xFFFFFFFF; unsigned long lock_flags; @@ -2021,7 +2021,7 @@ u8 send_multicast_frames(unifi_priv_t *priv, u16 interfaceTag) { int r; tx_buffered_packets_t * buffered_pkt = NULL; - CsrBool moreData = FALSE; + u8 moreData = FALSE; u8 pduSent =0; unsigned long lock_flags; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; @@ -2203,7 +2203,7 @@ void uf_process_ma_vif_availibility_ind(unifi_priv_t *priv,u8 *sigdata, #define GET_ACTIVE_INTERFACE_TAG(priv) 0 -static CsrBool uf_is_more_data_for_delivery_ac(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t *staRecord) +static u8 uf_is_more_data_for_delivery_ac(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t *staRecord) { s8 i; @@ -2221,7 +2221,7 @@ static CsrBool uf_is_more_data_for_delivery_ac(unifi_priv_t *priv, CsrWifiRouter return FALSE; } -static CsrBool uf_is_more_data_for_usp_delivery(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t *staRecord, unifi_TrafficQueue queue) +static u8 uf_is_more_data_for_usp_delivery(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t *staRecord, unifi_TrafficQueue queue) { s8 i; @@ -2268,9 +2268,9 @@ void uf_send_buffered_data_from_delivery_ac(unifi_priv_t *priv, u16 interfaceTag = GET_ACTIVE_INTERFACE_TAG(priv); tx_buffered_packets_t * buffered_pkt = NULL; unsigned long lock_flags; - CsrBool eosp=FALSE; + u8 eosp=FALSE; s8 r =0; - CsrBool moreData = FALSE; + u8 moreData = FALSE; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; unifi_trace(priv, UDBG2, "++uf_send_buffered_data_from_delivery_ac, active=%x\n", staInfo->uapsdActive); @@ -2368,8 +2368,8 @@ void uf_send_buffered_data_from_ac(unifi_priv_t *priv, { tx_buffered_packets_t * buffered_pkt = NULL; unsigned long lock_flags; - CsrBool eosp=FALSE; - CsrBool moreData = FALSE; + u8 eosp=FALSE; + u8 moreData = FALSE; s8 r =0; func_enter(); @@ -2412,7 +2412,7 @@ void uf_send_buffered_frames(unifi_priv_t *priv,unifi_TrafficQueue q) u32 startIndex=0,endIndex=0; CsrWifiRouterCtrlStaInfo_t * staInfo = NULL; u8 queue; - CsrBool moreData = FALSE; + u8 moreData = FALSE; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; @@ -2549,7 +2549,7 @@ void uf_send_buffered_frames(unifi_priv_t *priv,unifi_TrafficQueue q) } -CsrBool uf_is_more_data_for_non_delivery_ac(CsrWifiRouterCtrlStaInfo_t *staRecord) +u8 uf_is_more_data_for_non_delivery_ac(CsrWifiRouterCtrlStaInfo_t *staRecord) { u8 i; @@ -2916,7 +2916,7 @@ void uf_send_nulldata(unifi_priv_t * priv,u16 interfaceTag, const u8 *da,CSR_PRI return; } -CsrBool uf_check_broadcast_bssid(unifi_priv_t *priv, const bulk_data_param_t *bulkdata) +u8 uf_check_broadcast_bssid(unifi_priv_t *priv, const bulk_data_param_t *bulkdata) { u8 *bssid = NULL; static const CsrWifiMacAddress broadcast_address = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}}; @@ -2957,11 +2957,11 @@ CsrBool uf_check_broadcast_bssid(unifi_priv_t *priv, const bulk_data_param_t *bu } -CsrBool uf_process_pm_bit_for_peer(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t * srcStaInfo, +u8 uf_process_pm_bit_for_peer(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t * srcStaInfo, u8 pmBit,u16 interfaceTag) { - CsrBool moreData = FALSE; - CsrBool powerSaveChanged = FALSE; + u8 moreData = FALSE; + u8 powerSaveChanged = FALSE; unsigned long lock_flags; unifi_trace(priv, UDBG3, "entering uf_process_pm_bit_for_peer\n"); @@ -3060,7 +3060,7 @@ void uf_process_ps_poll(unifi_priv_t *priv,u8* sa,u8* da,u8 pmBit,u16 interfaceT CsrWifiMacAddress peerMacAddress; unsigned long lock_flags; s8 r =0; - CsrBool moreData = FALSE; + u8 moreData = FALSE; netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; unifi_trace(priv, UDBG3, "entering uf_process_ps_poll\n"); @@ -3594,7 +3594,7 @@ void resume_unicast_buffered_frames(unifi_priv_t *priv, u16 interfaceTag) u8 i; int j; tx_buffered_packets_t * buffered_pkt = NULL; - CsrBool hipslotFree[4] = {TRUE,TRUE,TRUE,TRUE}; + u8 hipslotFree[4] = {TRUE,TRUE,TRUE,TRUE}; int r; unsigned long lock_flags; diff --git a/drivers/staging/csr/unifi_priv.h b/drivers/staging/csr/unifi_priv.h index 2f8f031..6d6b461 100644 --- a/drivers/staging/csr/unifi_priv.h +++ b/drivers/staging/csr/unifi_priv.h @@ -323,10 +323,10 @@ typedef struct CsrWifiRouterCtrlStaInfo_t { /* Sme sends these parameters */ CsrWifiMacAddress peerMacAddress; u32 assignedHandle; - CsrBool wmmOrQosEnabled; + u8 wmmOrQosEnabled; CsrWifiAcPowersaveMode powersaveMode[MAX_ACCESS_CATOGORY]; u16 maxSpLength; - CsrBool uapsdActive; + u8 uapsdActive; u16 noOfSpFramesSent; /* Router/Driver database */ @@ -337,7 +337,7 @@ typedef struct CsrWifiRouterCtrlStaInfo_t { /* Inactivity feature parameters */ struct netInterface_priv *interfacePriv; struct work_struct send_disconnected_ind_task; - CsrBool activity_flag; + u8 activity_flag; u16 listenIntervalInTus; CSR_CLIENT_TAG nullDataHostTag; @@ -345,7 +345,7 @@ typedef struct CsrWifiRouterCtrlStaInfo_t { CsrTime lastActivity; /* during m/c transmission sp suspended */ - CsrBool uspSuspend; + u8 uspSuspend; CSR_PRIORITY triggerFramePriority; #endif CsrWifiRouterCtrlPeerStatus currentPeerState; @@ -354,9 +354,9 @@ typedef struct CsrWifiRouterCtrlStaInfo_t { u8 spStatus; u8 prevFrmType; u8 prevFrmAccessCatogory; - CsrBool protection; + u8 protection; u16 aid; - CsrBool txSuspend; + u8 txSuspend; u8 timSet; /* Dont change the value of below macro for SET & RESET */ #define CSR_WIFI_TIM_RESET 0 @@ -364,7 +364,7 @@ typedef struct CsrWifiRouterCtrlStaInfo_t { #define CSR_WIFI_TIM_RESETTING 2 #define CSR_WIFI_TIM_SETTING 3 - CsrBool timRequestPendingFlag; + u8 timRequestPendingFlag; u8 updateTimReqQueued; u16 noOfPktQueued; }CsrWifiRouterCtrlStaInfo_t; @@ -501,7 +501,7 @@ struct unifi_priv { #define CSR_WIFI_DRIVER_MAX_PKT_QUEUING_THRESHOLD_PER_PEER 64 #define CSR_WIFI_DRIVER_MINIMUM_BROADCAST_PKT_THRESHOLD 3 - CsrBool routerBufferEnable[MAX_ACCESS_CATOGORY]; + u8 routerBufferEnable[MAX_ACCESS_CATOGORY]; /* lock to protect stainfo members and priv members*/ spinlock_t staRecord_lock; #endif @@ -616,7 +616,7 @@ struct unifi_priv { int ptest_mode; /* Set when in production test mode */ int coredump_mode; /* Set when SME has requested a coredump */ - CsrBool wol_suspend; /* Set when suspending with UniFi powered */ + u8 wol_suspend; /* Set when suspending with UniFi powered */ #define UF_UNCONTROLLED_PORT_Q 0 #define UF_CONTROLLED_PORT_Q 1 @@ -660,7 +660,7 @@ struct unifi_priv { u8 wapi_unicast_filter; u8 wapi_unicast_queued_pkt_filter; #ifdef CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND - CsrBool isWapiConnection; + u8 isWapiConnection; #endif #endif @@ -668,7 +668,7 @@ struct unifi_priv { CsrWifiRouterCtrlModeSetReq pending_mode_set; #endif - CsrBool cmanrTestMode; + u8 cmanrTestMode; CSR_RATE cmanrTestModeTransmitRate; }; @@ -680,7 +680,7 @@ typedef struct { typedef struct { - CsrBool active; + u8 active; bulk_data_param_t bulkdata; CSR_SIGNAL signal; u16 sn; @@ -695,7 +695,7 @@ typedef struct { u16 timeout; u16 expected_sn; u16 start_sn; - CsrBool trigger_ba_after_ssn; + u8 trigger_ba_after_ssn; struct netInterface_priv *interfacePriv; u16 tID; CsrWifiMacAddress macAddress; @@ -724,7 +724,7 @@ typedef struct netInterface_priv #endif struct net_device_stats stats; u8 interfaceMode; - CsrBool protect; + u8 protect; CsrWifiMacAddress bssid; /* * Flag to reflect state of CONNECTED indication signal. @@ -739,9 +739,9 @@ typedef struct netInterface_priv } connected; #ifdef CSR_SUPPORT_WEXT /* Tracks when we are waiting for a netdevice state change callback */ - CsrBool wait_netdev_change; + u8 wait_netdev_change; /* True if we have successfully registered for netdev callbacks */ - CsrBool netdev_callback_registered; + u8 netdev_callback_registered; #endif /* CSR_SUPPORT_WEXT */ unsigned int netdev_registered; #define UNIFI_MAX_MULTICAST_ADDRESSES 10 @@ -764,7 +764,7 @@ typedef struct netInterface_priv /* Timer for detecting station inactivity */ struct timer_list sta_activity_check_timer; - CsrBool sta_activity_check_enabled; + u8 sta_activity_check_enabled; /* Timestamp when the last inactivity check was done */ CsrTime last_inactivity_check; @@ -787,15 +787,15 @@ typedef struct netInterface_priv #endif /* This should be removed and m4_hostTag should be used for checking*/ - CsrBool m4_sent; + u8 m4_sent; CSR_CLIENT_TAG m4_hostTag; - CsrBool dtimActive; - CsrBool intraBssEnabled; + u8 dtimActive; + u8 intraBssEnabled; u32 multicastPduHostTag; /* Used to set the tim after getting a confirm for it */ - CsrBool bcTimSet; - CsrBool bcTimSetReqPendingFlag; - CsrBool bcTimSetReqQueued; + u8 bcTimSet; + u8 bcTimSetReqPendingFlag; + u8 bcTimSetReqQueued; } netInterface_priv_t; #ifndef ALLOW_Q_PAUSE @@ -895,7 +895,7 @@ unifi_priv_t *uf_alloc_netdevice(CsrSdioFunction *sdio_dev, int bus_id); int uf_free_netdevice(unifi_priv_t *priv); /* Allocating function for other interfaces */ -CsrBool uf_alloc_netdevice_for_other_interfaces(unifi_priv_t *priv, u16 interfaceTag); +u8 uf_alloc_netdevice_for_other_interfaces(unifi_priv_t *priv, u16 interfaceTag); /* * Firmware download related functions. @@ -956,15 +956,15 @@ int uf_verify_m4(unifi_priv_t *priv, const unsigned char *packet, unsigned int length); #ifdef CSR_SUPPORT_SME -CsrBool uf_check_broadcast_bssid(unifi_priv_t *priv, const bulk_data_param_t *bulkdata); -CsrBool uf_process_pm_bit_for_peer(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t * srcStaInfo,u8 pmBit,u16 interfaceTag); +u8 uf_check_broadcast_bssid(unifi_priv_t *priv, const bulk_data_param_t *bulkdata); +u8 uf_process_pm_bit_for_peer(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t * srcStaInfo,u8 pmBit,u16 interfaceTag); void uf_process_ps_poll(unifi_priv_t *priv,u8* sa,u8* da,u8 pmBit,u16 interfaceTag); int uf_ap_process_data_pdu(unifi_priv_t *priv, struct sk_buff *skb, struct ethhdr *ehdr, CsrWifiRouterCtrlStaInfo_t * srcStaInfo, const CSR_SIGNAL *signal, bulk_data_param_t *bulkdata, u8 macHeaderLengthInBytes); -CsrBool uf_is_more_data_for_non_delivery_ac(CsrWifiRouterCtrlStaInfo_t *staRecord); +u8 uf_is_more_data_for_non_delivery_ac(CsrWifiRouterCtrlStaInfo_t *staRecord); void uf_process_wmm_deliver_ac_uapsd ( unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t * srcStaInfo, u16 qosControl, @@ -1031,7 +1031,7 @@ int prepare_and_add_macheader(unifi_priv_t *priv, u16 interfaceTag, const u8 *daddr, const u8 *saddr, - CsrBool protection); + u8 protection); CSR_PRIORITY get_packet_priority(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr *ehdr, netInterface_priv_t *interfacePriv); @@ -1064,7 +1064,7 @@ void scroll_ba_window(unifi_priv_t *priv, ba_session_rx_struct *ba_session, u16 sn); -CsrBool blockack_session_stop(unifi_priv_t *priv, +u8 blockack_session_stop(unifi_priv_t *priv, u16 interfaceTag, CsrWifiRouterCtrlBlockAckRole role, u16 tID, diff --git a/drivers/staging/csr/unifi_sme.c b/drivers/staging/csr/unifi_sme.c index 85ea812..85e0c9e 100644 --- a/drivers/staging/csr/unifi_sme.c +++ b/drivers/staging/csr/unifi_sme.c @@ -115,7 +115,7 @@ sme_log_event(ul_client_t *pcli, if (unpacked_signal.SignalPrimitiveHeader.SignalId == CSR_MA_PACKET_INDICATION_ID) { u16 frmCtrl; - CsrBool unicastPdu = TRUE; + u8 unicastPdu = TRUE; u8 *macHdrLocation; u8 *raddr = NULL, *taddr = NULL; CsrWifiMacAddress peerMacAddress; @@ -727,7 +727,7 @@ int unifi_cfg_wmm_delts(unifi_priv_t *priv, unsigned char *arg) int unifi_cfg_strict_draft_n(unifi_priv_t *priv, unsigned char *arg) { - CsrBool strict_draft_n; + u8 strict_draft_n; u8 *strict_draft_n_params; int rc; @@ -735,7 +735,7 @@ int unifi_cfg_strict_draft_n(unifi_priv_t *priv, unsigned char *arg) CsrWifiSmeDeviceConfig deviceConfig; strict_draft_n_params = (u8*)(((unifi_cfg_command_t*)arg) + 1); - if (get_user(strict_draft_n, (CsrBool*)strict_draft_n_params)) { + if (get_user(strict_draft_n, (u8*)strict_draft_n_params)) { unifi_error(priv, "unifi_cfg_strict_draft_n: Failed to get the argument\n"); return -EFAULT; } @@ -763,7 +763,7 @@ int unifi_cfg_strict_draft_n(unifi_priv_t *priv, unsigned char *arg) int unifi_cfg_enable_okc(unifi_priv_t *priv, unsigned char *arg) { - CsrBool enable_okc; + u8 enable_okc; u8 *enable_okc_params; int rc; @@ -771,7 +771,7 @@ int unifi_cfg_enable_okc(unifi_priv_t *priv, unsigned char *arg) CsrWifiSmeDeviceConfig deviceConfig; enable_okc_params = (u8*)(((unifi_cfg_command_t*)arg) + 1); - if (get_user(enable_okc, (CsrBool*)enable_okc_params)) { + if (get_user(enable_okc, (u8*)enable_okc_params)) { unifi_error(priv, "unifi_cfg_enable_okc: Failed to get the argument\n"); return -EFAULT; } @@ -914,7 +914,7 @@ int uf_configure_supported_rates(u8 * supportedRates, u8 phySupportedBitmap) { int i=0; - CsrBool b=FALSE, g = FALSE, n = FALSE; + u8 b=FALSE, g = FALSE, n = FALSE; b = phySupportedBitmap & CSR_WIFI_SME_AP_PHY_SUPPORT_B; n = phySupportedBitmap & CSR_WIFI_SME_AP_PHY_SUPPORT_N; g = phySupportedBitmap & CSR_WIFI_SME_AP_PHY_SUPPORT_G; diff --git a/drivers/staging/csr/unifi_sme.h b/drivers/staging/csr/unifi_sme.h index bdff0f3..b689cfe 100644 --- a/drivers/staging/csr/unifi_sme.h +++ b/drivers/staging/csr/unifi_sme.h @@ -27,7 +27,7 @@ typedef int unifi_data_port_action; typedef struct unifi_port_cfg { /* TRUE if this port entry is allocated */ - CsrBool in_use; + u8 in_use; CsrWifiRouterCtrlPortAction port_action; CsrWifiMacAddress mac_address; } unifi_port_cfg_t; diff --git a/drivers/staging/csr/unifi_wext.h b/drivers/staging/csr/unifi_wext.h index 4ce0011..6d7a995 100644 --- a/drivers/staging/csr/unifi_wext.h +++ b/drivers/staging/csr/unifi_wext.h @@ -60,7 +60,7 @@ void wext_send_disassoc_event(unifi_priv_t *priv); void wext_send_michaelmicfailure_event(unifi_priv_t *priv, u16 count, CsrWifiMacAddress address, CsrWifiSmeKeyType keyType, u16 interfaceTag); -void wext_send_pmkid_candidate_event(unifi_priv_t *priv, CsrWifiMacAddress bssid, CsrBool preauth_allowed, u16 interfaceTag); +void wext_send_pmkid_candidate_event(unifi_priv_t *priv, CsrWifiMacAddress bssid, u8 preauth_allowed, u16 interfaceTag); void wext_send_started_event(unifi_priv_t *priv); diff --git a/drivers/staging/csr/unifiio.h b/drivers/staging/csr/unifiio.h index 74720fc..9acf9ee 100644 --- a/drivers/staging/csr/unifiio.h +++ b/drivers/staging/csr/unifiio.h @@ -314,15 +314,15 @@ typedef struct uf_cfg_ap_config u8 channel; u16 beaconInterval; u8 dtimPeriod; - CsrBool wmmEnabled; + u8 wmmEnabled; u8 shortSlotTimeEnabled; u16 groupkeyTimeout; - CsrBool strictGtkRekeyEnabled; + u8 strictGtkRekeyEnabled; u16 gmkTimeout; u16 responseTimeout; u8 retransLimit; u8 rxStbc; - CsrBool rifsModeAllowed; + u8 rifsModeAllowed; u8 dualCtsProtection; u8 ctsProtectionType; u16 maxListenInterval; diff --git a/drivers/staging/csr/wext_events.c b/drivers/staging/csr/wext_events.c index f250ea6..d356887 100644 --- a/drivers/staging/csr/wext_events.c +++ b/drivers/staging/csr/wext_events.c @@ -238,7 +238,7 @@ wext_send_michaelmicfailure_event(unifi_priv_t *priv, } /* wext_send_michaelmicfailure_event() */ void -wext_send_pmkid_candidate_event(unifi_priv_t *priv, CsrWifiMacAddress bssid, CsrBool preauth_allowed, u16 interfaceTag) +wext_send_pmkid_candidate_event(unifi_priv_t *priv, CsrWifiMacAddress bssid, u8 preauth_allowed, u16 interfaceTag) { #if WIRELESS_EXT > 17 union iwreq_data wrqu; -- cgit v0.10.2 From d4fda8db9796271ddd306583e1afa9df23ae1558 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 12:27:19 -0700 Subject: staging: csr: remove CsrSize typedef MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use size_t instead. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_formatted_io.c b/drivers/staging/csr/csr_formatted_io.c index d7b81e8..d26fd78 100644 --- a/drivers/staging/csr/csr_formatted_io.c +++ b/drivers/staging/csr/csr_formatted_io.c @@ -12,7 +12,7 @@ #include "csr_formatted_io.h" #include "csr_util.h" -s32 CsrSnprintf(char *dest, CsrSize n, const char *fmt, ...) +s32 CsrSnprintf(char *dest, size_t n, const char *fmt, ...) { s32 r; va_list args; diff --git a/drivers/staging/csr/csr_formatted_io.h b/drivers/staging/csr/csr_formatted_io.h index d0c3fb7..c87f637 100644 --- a/drivers/staging/csr/csr_formatted_io.h +++ b/drivers/staging/csr/csr_formatted_io.h @@ -16,7 +16,7 @@ extern "C" { #include "csr_types.h" -s32 CsrSnprintf(char *dest, CsrSize n, const char *fmt, ...); +s32 CsrSnprintf(char *dest, size_t n, const char *fmt, ...); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_framework_ext.c b/drivers/staging/csr/csr_framework_ext.c index b2b2ea9..6b9ac92 100644 --- a/drivers/staging/csr/csr_framework_ext.c +++ b/drivers/staging/csr/csr_framework_ext.c @@ -161,7 +161,7 @@ EXPORT_SYMBOL_GPL(CsrThreadSleep); * Allocated memory is zero initialised. * *----------------------------------------------------------------------------*/ -void *CsrMemCalloc(CsrSize numberOfElements, CsrSize elementSize) +void *CsrMemCalloc(size_t numberOfElements, size_t elementSize) { void *buf; size_t size; @@ -189,7 +189,7 @@ void *CsrMemCalloc(CsrSize numberOfElements, CsrSize elementSize) * Allocated memory is not initialised. * *----------------------------------------------------------------------------*/ -void *CsrMemAlloc(CsrSize size) +void *CsrMemAlloc(size_t size) { return kmalloc(size, GFP_KERNEL); } @@ -224,7 +224,7 @@ EXPORT_SYMBOL_GPL(CsrMemFree); * Allocated memory is not initialised. * *----------------------------------------------------------------------------*/ -void *CsrMemAllocDma(CsrSize size) +void *CsrMemAllocDma(size_t size) { return kmalloc(size, GFP_KERNEL | GFP_DMA); } diff --git a/drivers/staging/csr/csr_framework_ext.h b/drivers/staging/csr/csr_framework_ext.h index 5204514..58cc22c 100644 --- a/drivers/staging/csr/csr_framework_ext.h +++ b/drivers/staging/csr/csr_framework_ext.h @@ -256,11 +256,11 @@ void CsrThreadSleep(u16 sleepTimeInMs); * *----------------------------------------------------------------------------*/ #ifdef CSR_MEM_DEBUG -void *CsrMemAllocDebug(CsrSize size, +void *CsrMemAllocDebug(size_t size, const char *file, u32 line); #define CsrMemAlloc(sz) CsrMemAllocDebug((sz), __FILE__, __LINE__) #else -void *CsrMemAlloc(CsrSize size); +void *CsrMemAlloc(size_t size); #endif /*----------------------------------------------------------------------------* @@ -277,11 +277,11 @@ void *CsrMemAlloc(CsrSize size); * *----------------------------------------------------------------------------*/ #ifdef CSR_MEM_DEBUG -void *CsrMemCallocDebug(CsrSize numberOfElements, CsrSize elementSize, +void *CsrMemCallocDebug(size_t numberOfElements, size_t elementSize, const char *file, u32 line); #define CsrMemCalloc(cnt, sz) CsrMemAllocDebug((cnt), (sz), __FILE__, __LINE__) #else -void *CsrMemCalloc(CsrSize numberOfElements, CsrSize elementSize); +void *CsrMemCalloc(size_t numberOfElements, size_t elementSize); #endif /*----------------------------------------------------------------------------* @@ -310,11 +310,11 @@ void CsrMemFree(void *pointer); * *----------------------------------------------------------------------------*/ #ifdef CSR_MEM_DEBUG -void *CsrMemAllocDmaDebug(CsrSize size, +void *CsrMemAllocDmaDebug(size_t size, const char *file, u32 line); #define CsrMemAllocDma(sz) CsrMemAllocDmaDebug((sz), __FILE__, __LINE__) #else -void *CsrMemAllocDma(CsrSize size); +void *CsrMemAllocDma(size_t size); #endif diff --git a/drivers/staging/csr/csr_log_text.h b/drivers/staging/csr/csr_log_text.h index d667c89..9fc2aa2 100644 --- a/drivers/staging/csr/csr_log_text.h +++ b/drivers/staging/csr/csr_log_text.h @@ -34,7 +34,7 @@ void CsrLogTextRegister(CsrLogTextTaskId taskId, const char *taskName, u16 subOr system as a whole. */ #if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_CRITICAL_DISABLE) void CsrLogTextCritical(CsrLogTextTaskId taskId, u16 subOrigin, const char *formatString, ...); -void CsrLogTextBufferCritical(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize bufferLength, const void *buffer, const char *formatString, ...); +void CsrLogTextBufferCritical(CsrLogTextTaskId taskId, u16 subOrigin, size_t bufferLength, const void *buffer, const char *formatString, ...); #define CSR_LOG_TEXT_CRITICAL(taskId_subOrigin_formatString_varargs) CsrLogTextCritical taskId_subOrigin_formatString_varargs #define CSR_LOG_TEXT_CONDITIONAL_CRITICAL(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_CRITICAL(logtextargs);}} #define CSR_LOG_TEXT_BUFFER_CRITICAL(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferCritical taskId_subOrigin_length_buffer_formatString_varargs @@ -50,7 +50,7 @@ void CsrLogTextBufferCritical(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize bu causing lack of functionality but not loss of system integrity/stability. */ #if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_ERROR_DISABLE) void CsrLogTextError(CsrLogTextTaskId taskId, u16 subOrigin, const char *formatString, ...); -void CsrLogTextBufferError(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize bufferLength, const void *buffer, const char *formatString, ...); +void CsrLogTextBufferError(CsrLogTextTaskId taskId, u16 subOrigin, size_t bufferLength, const void *buffer, const char *formatString, ...); #define CSR_LOG_TEXT_ERROR(taskId_subOrigin_formatString_varargs) CsrLogTextError taskId_subOrigin_formatString_varargs #define CSR_LOG_TEXT_CONDITIONAL_ERROR(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_ERROR(logtextargs);}} #define CSR_LOG_TEXT_BUFFER_ERROR(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferError taskId_subOrigin_length_buffer_formatString_varargs @@ -67,7 +67,7 @@ void CsrLogTextBufferError(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize buffe lead to malfunction of the component. */ #if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_WARNING_DISABLE) void CsrLogTextWarning(CsrLogTextTaskId taskId, u16 subOrigin, const char *formatString, ...); -void CsrLogTextBufferWarning(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize bufferLength, const void *buffer, const char *formatString, ...); +void CsrLogTextBufferWarning(CsrLogTextTaskId taskId, u16 subOrigin, size_t bufferLength, const void *buffer, const char *formatString, ...); #define CSR_LOG_TEXT_WARNING(taskId_subOrigin_formatString_varargs) CsrLogTextWarning taskId_subOrigin_formatString_varargs #define CSR_LOG_TEXT_CONDITIONAL_WARNING(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_WARNING(logtextargs);}} #define CSR_LOG_TEXT_BUFFER_WARNING(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferWarning taskId_subOrigin_length_buffer_formatString_varargs @@ -83,7 +83,7 @@ void CsrLogTextBufferWarning(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize buf the more severe conditions are encountered. */ #if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_INFO_DISABLE) void CsrLogTextInfo(CsrLogTextTaskId taskId, u16 subOrigin, const char *formatString, ...); -void CsrLogTextBufferInfo(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize bufferLength, const void *buffer, const char *formatString, ...); +void CsrLogTextBufferInfo(CsrLogTextTaskId taskId, u16 subOrigin, size_t bufferLength, const void *buffer, const char *formatString, ...); #define CSR_LOG_TEXT_INFO(taskId_subOrigin_formatString_varargs) CsrLogTextInfo taskId_subOrigin_formatString_varargs #define CSR_LOG_TEXT_CONDITIONAL_INFO(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_INFO(logtextargs);}} #define CSR_LOG_TEXT_BUFFER_INFO(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferInfo taskId_subOrigin_length_buffer_formatString_varargs @@ -98,7 +98,7 @@ void CsrLogTextBufferInfo(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize buffer /* DEBUG: Similar to INFO, but dedicated to events that occur more frequently. */ #if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_DEBUG_DISABLE) void CsrLogTextDebug(CsrLogTextTaskId taskId, u16 subOrigin, const char *formatString, ...); -void CsrLogTextBufferDebug(CsrLogTextTaskId taskId, u16 subOrigin, CsrSize bufferLength, const void *buffer, const char *formatString, ...); +void CsrLogTextBufferDebug(CsrLogTextTaskId taskId, u16 subOrigin, size_t bufferLength, const void *buffer, const char *formatString, ...); #define CSR_LOG_TEXT_DEBUG(taskId_subOrigin_formatString_varargs) CsrLogTextDebug taskId_subOrigin_formatString_varargs #define CSR_LOG_TEXT_CONDITIONAL_DEBUG(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_DEBUG(logtextargs);}} #define CSR_LOG_TEXT_BUFFER_DEBUG(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferDebug taskId_subOrigin_length_buffer_formatString_varargs diff --git a/drivers/staging/csr/csr_msgconv.c b/drivers/staging/csr/csr_msgconv.c index 0d61caf..ad01958 100644 --- a/drivers/staging/csr/csr_msgconv.c +++ b/drivers/staging/csr/csr_msgconv.c @@ -72,7 +72,7 @@ static const CsrMsgConvMsgEntry *find_msg_converter(CsrMsgConvPrimEntry *ptr, u1 } static void *deserialize_data(u16 primType, - CsrSize length, + size_t length, u8 *data) { CsrMsgConvPrimEntry *ptr; @@ -84,7 +84,7 @@ static void *deserialize_data(u16 primType, { const CsrMsgConvMsgEntry *cv; u16 msgId = 0; - CsrSize offset = 0; + size_t offset = 0; CsrUint16Des(&msgId, data, &offset); cv = find_msg_converter(ptr, msgId); @@ -105,10 +105,10 @@ static void *deserialize_data(u16 primType, return ret; } -static CsrSize sizeof_message(u16 primType, void *msg) +static size_t sizeof_message(u16 primType, void *msg) { CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType); - CsrSize ret; + size_t ret; if (ptr) { @@ -166,7 +166,7 @@ static u8 free_message(u16 primType, u8 *data) static u8 *serialize_message(u16 primType, void *msg, - CsrSize *length, + size_t *length, u8 *buffer) { CsrMsgConvPrimEntry *ptr; @@ -198,16 +198,16 @@ static u8 *serialize_message(u16 primType, return ret; } -CsrSize CsrMsgConvSizeof(u16 primType, void *msg) +size_t CsrMsgConvSizeof(u16 primType, void *msg) { return sizeof_message(primType, msg); } -u8 *CsrMsgConvSerialize(u8 *buffer, CsrSize maxBufferOffset, CsrSize *offset, u16 primType, void *msg) +u8 *CsrMsgConvSerialize(u8 *buffer, size_t maxBufferOffset, size_t *offset, u16 primType, void *msg) { if (converter) { - CsrSize serializedLength; + size_t serializedLength; u8 *bufSerialized; u8 *bufOffset = &buffer[*offset]; bufSerialized = converter->serialize_message(primType, msg, &serializedLength, bufOffset); diff --git a/drivers/staging/csr/csr_msgconv.h b/drivers/staging/csr/csr_msgconv.h index 8df292d..5aefda3 100644 --- a/drivers/staging/csr/csr_msgconv.h +++ b/drivers/staging/csr/csr_msgconv.h @@ -20,10 +20,10 @@ extern "C" { #endif -typedef CsrSize (CsrMsgSizeofFunc)(void *msg); -typedef u8 *(CsrMsgSerializeFunc)(u8 *buffer, CsrSize *length, void *msg); +typedef size_t (CsrMsgSizeofFunc)(void *msg); +typedef u8 *(CsrMsgSerializeFunc)(u8 *buffer, size_t *length, void *msg); typedef void (CsrMsgFreeFunc)(void *msg); -typedef void *(CsrMsgDeserializeFunc)(u8 *buffer, CsrSize length); +typedef void *(CsrMsgDeserializeFunc)(u8 *buffer, size_t length); /* Converter entry for one message type */ typedef struct CsrMsgConvMsgEntry @@ -50,16 +50,16 @@ typedef struct CsrMsgConvPrimEntry typedef struct { CsrMsgConvPrimEntry *profile_converters; - void *(*deserialize_data)(u16 primType, CsrSize length, u8 * data); + void *(*deserialize_data)(u16 primType, size_t length, u8 * data); u8 (*free_message)(u16 primType, u8 *data); - CsrSize (*sizeof_message)(u16 primType, void *msg); + size_t (*sizeof_message)(u16 primType, void *msg); u8 *(*serialize_message)(u16 primType, void *msg, - CsrSize * length, + size_t * length, u8 * buffer); } CsrMsgConvEntry; -CsrSize CsrMsgConvSizeof(u16 primType, void *msg); -u8 *CsrMsgConvSerialize(u8 *buffer, CsrSize maxBufferOffset, CsrSize *offset, u16 primType, void *msg); +size_t CsrMsgConvSizeof(u16 primType, void *msg); +u8 *CsrMsgConvSerialize(u8 *buffer, size_t maxBufferOffset, size_t *offset, u16 primType, void *msg); void CsrMsgConvCustomLookupRegister(u16 primType, CsrMsgCustomLookupFunc *lookupFunc); void CsrMsgConvInsert(u16 primType, const CsrMsgConvMsgEntry *ce); CsrMsgConvPrimEntry *CsrMsgConvFind(u16 primType); @@ -78,65 +78,65 @@ u32 CsrUtf8StringSerLen(const u8 *str); u32 CsrUtf16StringSerLen(const u16 *str); /* Prototypes for primitive type serializers */ -void CsrUint8Ser(u8 *buffer, CsrSize *offset, u8 value); -void CsrUint16Ser(u8 *buffer, CsrSize *offset, u16 value); -void CsrUint32Ser(u8 *buffer, CsrSize *offset, u32 value); -void CsrMemCpySer(u8 *buffer, CsrSize *offset, const void *value, CsrSize length); -void CsrCharStringSer(u8 *buffer, CsrSize *offset, const char *value); -void CsrUtf8StringSer(u8 *buffer, CsrSize *offset, const u8 *value); -void CsrUtf16StringSer(u8 *buffer, CsrSize *offset, const u16 *value); -void CsrVoidPtrSer(u8 *buffer, CsrSize *offset, void *ptr); -void CsrSizeSer(u8 *buffer, CsrSize *offset, CsrSize value); - -void CsrUint8Des(u8 *value, u8 *buffer, CsrSize *offset); -void CsrUint16Des(u16 *value, u8 *buffer, CsrSize *offset); -void CsrUint32Des(u32 *value, u8 *buffer, CsrSize *offset); -void CsrMemCpyDes(void *value, u8 *buffer, CsrSize *offset, CsrSize length); -void CsrCharStringDes(char **value, u8 *buffer, CsrSize *offset); -void CsrUtf8StringDes(u8 **value, u8 *buffer, CsrSize *offset); -void CsrUtf16StringDes(u16 **value, u8 *buffer, CsrSize *offset); -void CsrVoidPtrDes(void **value, u8 *buffer, CsrSize *offset); -void CsrSizeDes(CsrSize *value, u8 *buffer, CsrSize *offset); - -CsrSize CsrEventSizeof(void *msg); -u8 *CsrEventSer(u8 *ptr, CsrSize *len, void *msg); -void *CsrEventDes(u8 *buffer, CsrSize length); - -CsrSize CsrEventCsrUint8Sizeof(void *msg); -u8 *CsrEventCsrUint8Ser(u8 *ptr, CsrSize *len, void *msg); -void *CsrEventCsrUint8Des(u8 *buffer, CsrSize length); - -CsrSize CsrEventCsrUint16Sizeof(void *msg); -u8 *CsrEventCsrUint16Ser(u8 *ptr, CsrSize *len, void *msg); -void *CsrEventCsrUint16Des(u8 *buffer, CsrSize length); - -CsrSize CsrEventCsrUint32Sizeof(void *msg); -u8 *CsrEventCsrUint32Ser(u8 *ptr, CsrSize *len, void *msg); -void *CsrEventCsrUint32Des(u8 *buffer, CsrSize length); - -CsrSize CsrEventCsrUint16CsrUint8Sizeof(void *msg); -u8 *CsrEventCsrUint16CsrUint8Ser(u8 *ptr, CsrSize *len, void *msg); -void *CsrEventCsrUint16CsrUint8Des(u8 *buffer, CsrSize length); - -CsrSize CsrEventCsrUint16CsrUint16Sizeof(void *msg); -u8 *CsrEventCsrUint16CsrUint16Ser(u8 *ptr, CsrSize *len, void *msg); -void *CsrEventCsrUint16CsrUint16Des(u8 *buffer, CsrSize length); - -CsrSize CsrEventCsrUint16CsrUint32Sizeof(void *msg); -u8 *CsrEventCsrUint16CsrUint32Ser(u8 *ptr, CsrSize *len, void *msg); -void *CsrEventCsrUint16CsrUint32Des(u8 *buffer, CsrSize length); - -CsrSize CsrEventCsrUint16CsrCharStringSizeof(void *msg); -u8 *CsrEventCsrUint16CsrCharStringSer(u8 *ptr, CsrSize *len, void *msg); -void *CsrEventCsrUint16CsrCharStringDes(u8 *buffer, CsrSize length); - -CsrSize CsrEventCsrUint32CsrUint16Sizeof(void *msg); -u8 *CsrEventCsrUint32CsrUint16Ser(u8 *ptr, CsrSize *len, void *msg); -void *CsrEventCsrUint32CsrUint16Des(u8 *buffer, CsrSize length); - -CsrSize CsrEventCsrUint32CsrCharStringSizeof(void *msg); -u8 *CsrEventCsrUint32CsrCharStringSer(u8 *ptr, CsrSize *len, void *msg); -void *CsrEventCsrUint32CsrCharStringDes(u8 *buffer, CsrSize length); +void CsrUint8Ser(u8 *buffer, size_t *offset, u8 value); +void CsrUint16Ser(u8 *buffer, size_t *offset, u16 value); +void CsrUint32Ser(u8 *buffer, size_t *offset, u32 value); +void CsrMemCpySer(u8 *buffer, size_t *offset, const void *value, size_t length); +void CsrCharStringSer(u8 *buffer, size_t *offset, const char *value); +void CsrUtf8StringSer(u8 *buffer, size_t *offset, const u8 *value); +void CsrUtf16StringSer(u8 *buffer, size_t *offset, const u16 *value); +void CsrVoidPtrSer(u8 *buffer, size_t *offset, void *ptr); +void CsrSizeSer(u8 *buffer, size_t *offset, size_t value); + +void CsrUint8Des(u8 *value, u8 *buffer, size_t *offset); +void CsrUint16Des(u16 *value, u8 *buffer, size_t *offset); +void CsrUint32Des(u32 *value, u8 *buffer, size_t *offset); +void CsrMemCpyDes(void *value, u8 *buffer, size_t *offset, size_t length); +void CsrCharStringDes(char **value, u8 *buffer, size_t *offset); +void CsrUtf8StringDes(u8 **value, u8 *buffer, size_t *offset); +void CsrUtf16StringDes(u16 **value, u8 *buffer, size_t *offset); +void CsrVoidPtrDes(void **value, u8 *buffer, size_t *offset); +void CsrSizeDes(size_t *value, u8 *buffer, size_t *offset); + +size_t CsrEventSizeof(void *msg); +u8 *CsrEventSer(u8 *ptr, size_t *len, void *msg); +void *CsrEventDes(u8 *buffer, size_t length); + +size_t CsrEventCsrUint8Sizeof(void *msg); +u8 *CsrEventCsrUint8Ser(u8 *ptr, size_t *len, void *msg); +void *CsrEventCsrUint8Des(u8 *buffer, size_t length); + +size_t CsrEventCsrUint16Sizeof(void *msg); +u8 *CsrEventCsrUint16Ser(u8 *ptr, size_t *len, void *msg); +void *CsrEventCsrUint16Des(u8 *buffer, size_t length); + +size_t CsrEventCsrUint32Sizeof(void *msg); +u8 *CsrEventCsrUint32Ser(u8 *ptr, size_t *len, void *msg); +void *CsrEventCsrUint32Des(u8 *buffer, size_t length); + +size_t CsrEventCsrUint16CsrUint8Sizeof(void *msg); +u8 *CsrEventCsrUint16CsrUint8Ser(u8 *ptr, size_t *len, void *msg); +void *CsrEventCsrUint16CsrUint8Des(u8 *buffer, size_t length); + +size_t CsrEventCsrUint16CsrUint16Sizeof(void *msg); +u8 *CsrEventCsrUint16CsrUint16Ser(u8 *ptr, size_t *len, void *msg); +void *CsrEventCsrUint16CsrUint16Des(u8 *buffer, size_t length); + +size_t CsrEventCsrUint16CsrUint32Sizeof(void *msg); +u8 *CsrEventCsrUint16CsrUint32Ser(u8 *ptr, size_t *len, void *msg); +void *CsrEventCsrUint16CsrUint32Des(u8 *buffer, size_t length); + +size_t CsrEventCsrUint16CsrCharStringSizeof(void *msg); +u8 *CsrEventCsrUint16CsrCharStringSer(u8 *ptr, size_t *len, void *msg); +void *CsrEventCsrUint16CsrCharStringDes(u8 *buffer, size_t length); + +size_t CsrEventCsrUint32CsrUint16Sizeof(void *msg); +u8 *CsrEventCsrUint32CsrUint16Ser(u8 *ptr, size_t *len, void *msg); +void *CsrEventCsrUint32CsrUint16Des(u8 *buffer, size_t length); + +size_t CsrEventCsrUint32CsrCharStringSizeof(void *msg); +u8 *CsrEventCsrUint32CsrCharStringSer(u8 *ptr, size_t *len, void *msg); +void *CsrEventCsrUint32CsrCharStringDes(u8 *buffer, size_t length); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_pmem.c b/drivers/staging/csr/csr_pmem.c index a07c449..aeb9242 100644 --- a/drivers/staging/csr/csr_pmem.c +++ b/drivers/staging/csr/csr_pmem.c @@ -24,7 +24,7 @@ #include "csr_panic.h" #include "csr_pmem.h" -void *CsrPmemAlloc(CsrSize size) +void *CsrPmemAlloc(size_t size) { void *ret; diff --git a/drivers/staging/csr/csr_pmem.h b/drivers/staging/csr/csr_pmem.h index ede1c72..7962815 100644 --- a/drivers/staging/csr/csr_pmem.h +++ b/drivers/staging/csr/csr_pmem.h @@ -38,11 +38,11 @@ extern "C" { *****************************************************************************/ #ifdef CSR_PMEM_DEBUG -void *CsrPmemAllocDebug(CsrSize size, +void *CsrPmemAllocDebug(size_t size, const char *file, u32 line); #define CsrPmemAlloc(sz) CsrPmemAllocDebug((sz), __FILE__, __LINE__) #else -void *CsrPmemAlloc(CsrSize size); +void *CsrPmemAlloc(size_t size); #endif @@ -108,7 +108,7 @@ typedef u8 CsrPmemDebugAllocType; #define CSR_PMEM_DEBUG_TYPE_MEM_CALLOC 3 #define CSR_PMEM_DEBUG_TYPE_MEM_ALLOC_DMA 4 -typedef void (CsrPmemDebugOnAlloc)(void *ptr, void *userptr, CsrSize size, CsrPmemDebugAllocType type, const char* file, u32 line); +typedef void (CsrPmemDebugOnAlloc)(void *ptr, void *userptr, size_t size, CsrPmemDebugAllocType type, const char* file, u32 line); typedef void (CsrPmemDebugOnFree)(void *ptr, void *userptr, CsrPmemDebugAllocType type, const char* file, u32 line); /*----------------------------------------------------------------------------* @@ -127,7 +127,7 @@ typedef void (CsrPmemDebugOnFree)(void *ptr, void *userptr, CsrPmemDebugAllocTyp *----------------------------------------------------------------------------*/ void CsrPmemDebugInstallHooks(u8 headSize, u8 endSize, CsrPmemDebugOnAlloc *onAllocCallback, CsrPmemDebugOnFree *onFreeCallback); -void *CsrPmemDebugAlloc(CsrSize size, CsrPmemDebugAllocType type, const char* file, u32 line); +void *CsrPmemDebugAlloc(size_t size, CsrPmemDebugAllocType type, const char* file, u32 line); #define CsrPmemAlloc(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_PMEM_ALLOC, __FILE__, __LINE__) void CsrPmemDebugFree(void *ptr, CsrPmemDebugAllocType type, const char* file, u32 line); diff --git a/drivers/staging/csr/csr_serialize_primitive_types.c b/drivers/staging/csr/csr_serialize_primitive_types.c index 2aa9d046..169d6bc 100644 --- a/drivers/staging/csr/csr_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_serialize_primitive_types.c @@ -16,14 +16,14 @@ #include "csr_pmem.h" #include "csr_lib.h" -void CsrUint8Des(u8 *value, u8 *buffer, CsrSize *offset) +void CsrUint8Des(u8 *value, u8 *buffer, size_t *offset) { *value = buffer[*offset]; *offset += sizeof(*value); } EXPORT_SYMBOL_GPL(CsrUint8Des); -void CsrUint16Des(u16 *value, u8 *buffer, CsrSize *offset) +void CsrUint16Des(u16 *value, u8 *buffer, size_t *offset) { *value = (buffer[*offset + 0] << 0) | (buffer[*offset + 1] << 8); @@ -31,7 +31,7 @@ void CsrUint16Des(u16 *value, u8 *buffer, CsrSize *offset) } EXPORT_SYMBOL_GPL(CsrUint16Des); -void CsrUint32Des(u32 *value, u8 *buffer, CsrSize *offset) +void CsrUint32Des(u32 *value, u8 *buffer, size_t *offset) { *value = (buffer[*offset + 0] << 0) | (buffer[*offset + 1] << 8) | @@ -41,27 +41,27 @@ void CsrUint32Des(u32 *value, u8 *buffer, CsrSize *offset) } EXPORT_SYMBOL_GPL(CsrUint32Des); -void CsrMemCpyDes(void *value, u8 *buffer, CsrSize *offset, CsrSize length) +void CsrMemCpyDes(void *value, u8 *buffer, size_t *offset, size_t length) { CsrMemCpy(value, &buffer[*offset], length); *offset += length; } EXPORT_SYMBOL_GPL(CsrMemCpyDes); -void CsrCharStringDes(char **value, u8 *buffer, CsrSize *offset) +void CsrCharStringDes(char **value, u8 *buffer, size_t *offset) { *value = CsrStrDup((char *) &buffer[*offset]); *offset += CsrStrLen(*value) + 1; } EXPORT_SYMBOL_GPL(CsrCharStringDes); -void CsrUtf8StringDes(u8 **value, u8 *buffer, CsrSize *offset) +void CsrUtf8StringDes(u8 **value, u8 *buffer, size_t *offset) { *value = (u8 *) CsrStrDup((char *) &buffer[*offset]); *offset += CsrStrLen((char *) *value) + 1; } -void CsrUtf16StringDes(u16 **value, u8 *buffer, CsrSize *offset) +void CsrUtf16StringDes(u16 **value, u8 *buffer, size_t *offset) { u32 length, i; @@ -74,7 +74,7 @@ void CsrUtf16StringDes(u16 **value, u8 *buffer, CsrSize *offset) } } -void CsrSizeDes(CsrSize *value, u8 *buffer, CsrSize *offset) +void CsrSizeDes(size_t *value, u8 *buffer, size_t *offset) { *value = (buffer[*offset + 0] << 0) | (buffer[*offset + 1] << 8) | @@ -83,19 +83,19 @@ void CsrSizeDes(CsrSize *value, u8 *buffer, CsrSize *offset) *offset += sizeof(*value); } -void CsrVoidPtrDes(void **value, u8 *buffer, CsrSize *offset) +void CsrVoidPtrDes(void **value, u8 *buffer, size_t *offset) { - CsrSizeDes((CsrSize *) value, buffer, offset); + CsrSizeDes((size_t *) value, buffer, offset); } -void CsrUint8Ser(u8 *buffer, CsrSize *offset, u8 value) +void CsrUint8Ser(u8 *buffer, size_t *offset, u8 value) { buffer[*offset] = value; *offset += sizeof(value); } EXPORT_SYMBOL_GPL(CsrUint8Ser); -void CsrUint16Ser(u8 *buffer, CsrSize *offset, u16 value) +void CsrUint16Ser(u8 *buffer, size_t *offset, u16 value) { buffer[*offset + 0] = (u8) ((value >> 0) & 0xFF); buffer[*offset + 1] = (u8) ((value >> 8) & 0xFF); @@ -103,7 +103,7 @@ void CsrUint16Ser(u8 *buffer, CsrSize *offset, u16 value) } EXPORT_SYMBOL_GPL(CsrUint16Ser); -void CsrUint32Ser(u8 *buffer, CsrSize *offset, u32 value) +void CsrUint32Ser(u8 *buffer, size_t *offset, u32 value) { buffer[*offset + 0] = (u8) ((value >> 0) & 0xFF); buffer[*offset + 1] = (u8) ((value >> 8) & 0xFF); @@ -113,14 +113,14 @@ void CsrUint32Ser(u8 *buffer, CsrSize *offset, u32 value) } EXPORT_SYMBOL_GPL(CsrUint32Ser); -void CsrMemCpySer(u8 *buffer, CsrSize *offset, const void *value, CsrSize length) +void CsrMemCpySer(u8 *buffer, size_t *offset, const void *value, size_t length) { CsrMemCpy(&buffer[*offset], value, length); *offset += length; } EXPORT_SYMBOL_GPL(CsrMemCpySer); -void CsrCharStringSer(u8 *buffer, CsrSize *offset, const char *value) +void CsrCharStringSer(u8 *buffer, size_t *offset, const char *value) { if (value) { @@ -134,12 +134,12 @@ void CsrCharStringSer(u8 *buffer, CsrSize *offset, const char *value) } EXPORT_SYMBOL_GPL(CsrCharStringSer); -void CsrUtf8StringSer(u8 *buffer, CsrSize *offset, const u8 *value) +void CsrUtf8StringSer(u8 *buffer, size_t *offset, const u8 *value) { CsrCharStringSer(buffer, offset, (char *) value); } -void CsrUtf16StringSer(u8 *buffer, CsrSize *offset, const u16 *value) +void CsrUtf16StringSer(u8 *buffer, size_t *offset, const u16 *value) { if (value) { @@ -159,7 +159,7 @@ void CsrUtf16StringSer(u8 *buffer, CsrSize *offset, const u16 *value) } } -void CsrSizeSer(u8 *buffer, CsrSize *offset, CsrSize value) +void CsrSizeSer(u8 *buffer, size_t *offset, size_t value) { buffer[*offset + 0] = (u8) ((value >> 0) & 0xFF); buffer[*offset + 1] = (u8) ((value >> 8) & 0xFF); @@ -168,9 +168,9 @@ void CsrSizeSer(u8 *buffer, CsrSize *offset, CsrSize value) *offset += sizeof(value); } -void CsrVoidPtrSer(u8 *buffer, CsrSize *offset, void *ptr) +void CsrVoidPtrSer(u8 *buffer, size_t *offset, void *ptr) { - CsrSizeSer(buffer, offset, (CsrSize) ptr); + CsrSizeSer(buffer, offset, (size_t) ptr); } u32 CsrCharStringSerLen(const char *str) @@ -210,12 +210,12 @@ u32 CsrUtf16StringSerLen(const u16 *str) } } -CsrSize CsrEventSizeof(void *msg) +size_t CsrEventSizeof(void *msg) { return 2; } -u8 *CsrEventSer(u8 *ptr, CsrSize *len, void *msg) +u8 *CsrEventSer(u8 *ptr, size_t *len, void *msg) { CsrEvent *primitive = (CsrEvent *) msg; *len = 0; @@ -223,21 +223,21 @@ u8 *CsrEventSer(u8 *ptr, CsrSize *len, void *msg) return ptr; } -void *CsrEventDes(u8 *buffer, CsrSize length) +void *CsrEventDes(u8 *buffer, size_t length) { CsrEvent *primitive = (CsrEvent *) CsrPmemAlloc(sizeof(CsrEvent)); - CsrSize offset = 0; + size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); return primitive; } -CsrSize CsrEventCsrUint8Sizeof(void *msg) +size_t CsrEventCsrUint8Sizeof(void *msg) { return 3; } -u8 *CsrEventCsrUint8Ser(u8 *ptr, CsrSize *len, void *msg) +u8 *CsrEventCsrUint8Ser(u8 *ptr, size_t *len, void *msg) { CsrEventCsrUint8 *primitive = (CsrEventCsrUint8 *) msg; *len = 0; @@ -246,23 +246,23 @@ u8 *CsrEventCsrUint8Ser(u8 *ptr, CsrSize *len, void *msg) return ptr; } -void *CsrEventCsrUint8Des(u8 *buffer, CsrSize length) +void *CsrEventCsrUint8Des(u8 *buffer, size_t length) { CsrEventCsrUint8 *primitive = (CsrEventCsrUint8 *) CsrPmemAlloc(sizeof(CsrEventCsrUint8)); - CsrSize offset = 0; + size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); CsrUint8Des(&primitive->value, buffer, &offset); return primitive; } -CsrSize CsrEventCsrUint16Sizeof(void *msg) +size_t CsrEventCsrUint16Sizeof(void *msg) { return 4; } -u8 *CsrEventCsrUint16Ser(u8 *ptr, CsrSize *len, void *msg) +u8 *CsrEventCsrUint16Ser(u8 *ptr, size_t *len, void *msg) { CsrEventCsrUint16 *primitive = (CsrEventCsrUint16 *) msg; *len = 0; @@ -271,23 +271,23 @@ u8 *CsrEventCsrUint16Ser(u8 *ptr, CsrSize *len, void *msg) return ptr; } -void *CsrEventCsrUint16Des(u8 *buffer, CsrSize length) +void *CsrEventCsrUint16Des(u8 *buffer, size_t length) { CsrEventCsrUint16 *primitive = (CsrEventCsrUint16 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16)); - CsrSize offset = 0; + size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); CsrUint16Des(&primitive->value, buffer, &offset); return primitive; } -CsrSize CsrEventCsrUint32Sizeof(void *msg) +size_t CsrEventCsrUint32Sizeof(void *msg) { return 6; } -u8 *CsrEventCsrUint32Ser(u8 *ptr, CsrSize *len, void *msg) +u8 *CsrEventCsrUint32Ser(u8 *ptr, size_t *len, void *msg) { CsrEventCsrUint32 *primitive = (CsrEventCsrUint32 *) msg; *len = 0; @@ -296,23 +296,23 @@ u8 *CsrEventCsrUint32Ser(u8 *ptr, CsrSize *len, void *msg) return ptr; } -void *CsrEventCsrUint32Des(u8 *buffer, CsrSize length) +void *CsrEventCsrUint32Des(u8 *buffer, size_t length) { CsrEventCsrUint32 *primitive = (CsrEventCsrUint32 *) CsrPmemAlloc(sizeof(CsrEventCsrUint32)); - CsrSize offset = 0; + size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); CsrUint32Des(&primitive->value, buffer, &offset); return primitive; } -CsrSize CsrEventCsrUint16CsrUint8Sizeof(void *msg) +size_t CsrEventCsrUint16CsrUint8Sizeof(void *msg) { return 5; } -u8 *CsrEventCsrUint16CsrUint8Ser(u8 *ptr, CsrSize *len, void *msg) +u8 *CsrEventCsrUint16CsrUint8Ser(u8 *ptr, size_t *len, void *msg) { CsrEventCsrUint16CsrUint8 *primitive = (CsrEventCsrUint16CsrUint8 *) msg; *len = 0; @@ -322,11 +322,11 @@ u8 *CsrEventCsrUint16CsrUint8Ser(u8 *ptr, CsrSize *len, void *msg) return ptr; } -void *CsrEventCsrUint16CsrUint8Des(u8 *buffer, CsrSize length) +void *CsrEventCsrUint16CsrUint8Des(u8 *buffer, size_t length) { CsrEventCsrUint16CsrUint8 *primitive = (CsrEventCsrUint16CsrUint8 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrUint8)); - CsrSize offset = 0; + size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); CsrUint16Des(&primitive->value1, buffer, &offset); CsrUint8Des(&primitive->value2, buffer, &offset); @@ -334,12 +334,12 @@ void *CsrEventCsrUint16CsrUint8Des(u8 *buffer, CsrSize length) return primitive; } -CsrSize CsrEventCsrUint16CsrUint16Sizeof(void *msg) +size_t CsrEventCsrUint16CsrUint16Sizeof(void *msg) { return 6; } -u8 *CsrEventCsrUint16CsrUint16Ser(u8 *ptr, CsrSize *len, void *msg) +u8 *CsrEventCsrUint16CsrUint16Ser(u8 *ptr, size_t *len, void *msg) { CsrEventCsrUint16CsrUint16 *primitive = (CsrEventCsrUint16CsrUint16 *) msg; *len = 0; @@ -349,11 +349,11 @@ u8 *CsrEventCsrUint16CsrUint16Ser(u8 *ptr, CsrSize *len, void *msg) return ptr; } -void *CsrEventCsrUint16CsrUint16Des(u8 *buffer, CsrSize length) +void *CsrEventCsrUint16CsrUint16Des(u8 *buffer, size_t length) { CsrEventCsrUint16CsrUint16 *primitive = (CsrEventCsrUint16CsrUint16 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrUint16)); - CsrSize offset = 0; + size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); CsrUint16Des(&primitive->value1, buffer, &offset); CsrUint16Des(&primitive->value2, buffer, &offset); @@ -361,12 +361,12 @@ void *CsrEventCsrUint16CsrUint16Des(u8 *buffer, CsrSize length) return primitive; } -CsrSize CsrEventCsrUint16CsrUint32Sizeof(void *msg) +size_t CsrEventCsrUint16CsrUint32Sizeof(void *msg) { return 8; } -u8 *CsrEventCsrUint16CsrUint32Ser(u8 *ptr, CsrSize *len, void *msg) +u8 *CsrEventCsrUint16CsrUint32Ser(u8 *ptr, size_t *len, void *msg) { CsrEventCsrUint16CsrUint32 *primitive = (CsrEventCsrUint16CsrUint32 *) msg; *len = 0; @@ -376,11 +376,11 @@ u8 *CsrEventCsrUint16CsrUint32Ser(u8 *ptr, CsrSize *len, void *msg) return ptr; } -void *CsrEventCsrUint16CsrUint32Des(u8 *buffer, CsrSize length) +void *CsrEventCsrUint16CsrUint32Des(u8 *buffer, size_t length) { CsrEventCsrUint16CsrUint32 *primitive = (CsrEventCsrUint16CsrUint32 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrUint32)); - CsrSize offset = 0; + size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); CsrUint16Des(&primitive->value1, buffer, &offset); CsrUint32Des(&primitive->value2, buffer, &offset); @@ -388,13 +388,13 @@ void *CsrEventCsrUint16CsrUint32Des(u8 *buffer, CsrSize length) return primitive; } -CsrSize CsrEventCsrUint16CsrCharStringSizeof(void *msg) +size_t CsrEventCsrUint16CsrCharStringSizeof(void *msg) { CsrEventCsrUint16CsrCharString *primitive = (CsrEventCsrUint16CsrCharString *) msg; return 4 + CsrStrLen(primitive->value2) + 1; } -u8 *CsrEventCsrUint16CsrCharStringSer(u8 *ptr, CsrSize *len, void *msg) +u8 *CsrEventCsrUint16CsrCharStringSer(u8 *ptr, size_t *len, void *msg) { CsrEventCsrUint16CsrCharString *primitive = (CsrEventCsrUint16CsrCharString *) msg; *len = 0; @@ -404,11 +404,11 @@ u8 *CsrEventCsrUint16CsrCharStringSer(u8 *ptr, CsrSize *len, void *msg) return ptr; } -void *CsrEventCsrUint16CsrCharStringDes(u8 *buffer, CsrSize length) +void *CsrEventCsrUint16CsrCharStringDes(u8 *buffer, size_t length) { CsrEventCsrUint16CsrCharString *primitive = (CsrEventCsrUint16CsrCharString *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrCharString)); - CsrSize offset = 0; + size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); CsrUint16Des(&primitive->value1, buffer, &offset); CsrCharStringDes(&primitive->value2, buffer, &offset); @@ -416,12 +416,12 @@ void *CsrEventCsrUint16CsrCharStringDes(u8 *buffer, CsrSize length) return primitive; } -CsrSize CsrEventCsrUint32CsrUint16Sizeof(void *msg) +size_t CsrEventCsrUint32CsrUint16Sizeof(void *msg) { return 8; } -u8 *CsrEventCsrUint32CsrUint16Ser(u8 *ptr, CsrSize *len, void *msg) +u8 *CsrEventCsrUint32CsrUint16Ser(u8 *ptr, size_t *len, void *msg) { CsrEventCsrUint32CsrUint16 *primitive = (CsrEventCsrUint32CsrUint16 *) msg; *len = 0; @@ -431,11 +431,11 @@ u8 *CsrEventCsrUint32CsrUint16Ser(u8 *ptr, CsrSize *len, void *msg) return ptr; } -void *CsrEventCsrUint32CsrUint16Des(u8 *buffer, CsrSize length) +void *CsrEventCsrUint32CsrUint16Des(u8 *buffer, size_t length) { CsrEventCsrUint32CsrUint16 *primitive = (CsrEventCsrUint32CsrUint16 *) CsrPmemAlloc(sizeof(CsrEventCsrUint32CsrUint16)); - CsrSize offset = 0; + size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); CsrUint32Des(&primitive->value1, buffer, &offset); CsrUint16Des(&primitive->value2, buffer, &offset); @@ -443,13 +443,13 @@ void *CsrEventCsrUint32CsrUint16Des(u8 *buffer, CsrSize length) return primitive; } -CsrSize CsrEventCsrUint32CsrCharStringSizeof(void *msg) +size_t CsrEventCsrUint32CsrCharStringSizeof(void *msg) { CsrEventCsrUint32CsrCharString *primitive = (CsrEventCsrUint32CsrCharString *) msg; return 6 + CsrStrLen(primitive->value2) + 1; } -u8 *CsrEventCsrUint32CsrCharStringSer(u8 *ptr, CsrSize *len, void *msg) +u8 *CsrEventCsrUint32CsrCharStringSer(u8 *ptr, size_t *len, void *msg) { CsrEventCsrUint32CsrCharString *primitive = (CsrEventCsrUint32CsrCharString *) msg; *len = 0; @@ -459,11 +459,11 @@ u8 *CsrEventCsrUint32CsrCharStringSer(u8 *ptr, CsrSize *len, void *msg) return ptr; } -void *CsrEventCsrUint32CsrCharStringDes(u8 *buffer, CsrSize length) +void *CsrEventCsrUint32CsrCharStringDes(u8 *buffer, size_t length) { CsrEventCsrUint32CsrCharString *primitive = (CsrEventCsrUint32CsrCharString *) CsrPmemAlloc(sizeof(CsrEventCsrUint32CsrCharString)); - CsrSize offset = 0; + size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); CsrUint32Des(&primitive->value1, buffer, &offset); CsrCharStringDes(&primitive->value2, buffer, &offset); diff --git a/drivers/staging/csr/csr_types.h b/drivers/staging/csr/csr_types.h index 40bc644..fb0f07c 100644 --- a/drivers/staging/csr/csr_types.h +++ b/drivers/staging/csr/csr_types.h @@ -27,7 +27,6 @@ extern "C" { #define TRUE (1) /* Basic types */ -typedef size_t CsrSize; /* Return type of sizeof (ISO/IEC 9899:1990 7.1.6) */ typedef ptrdiff_t CsrPtrdiff; /* Type of the result of subtracting two pointers (ISO/IEC 9899:1990 7.1.6) */ typedef uintptr_t CsrUintptr; /* Unsigned integer large enough to hold any pointer (ISO/IEC 9899:1999 7.18.1.4) */ typedef ptrdiff_t CsrIntptr; /* intptr_t is not defined in kernel. Use the equivalent ptrdiff_t. */ diff --git a/drivers/staging/csr/csr_unicode.h b/drivers/staging/csr/csr_unicode.h index 0c72f19..701aae8 100644 --- a/drivers/staging/csr/csr_unicode.h +++ b/drivers/staging/csr/csr_unicode.h @@ -39,7 +39,7 @@ u16 *CsrUtf16String2XML(u16 *str); u16 *CsrXML2Utf16String(u16 *str); s32 CsrUtf8StrCmp(const u8 *string1, const u8 *string2); -s32 CsrUtf8StrNCmp(const u8 *string1, const u8 *string2, CsrSize count); +s32 CsrUtf8StrNCmp(const u8 *string1, const u8 *string2, size_t count); u32 CsrUtf8StringLengthInBytes(const u8 *string); /******************************************************************************* @@ -66,7 +66,7 @@ u32 CsrUtf8StringLengthInBytes(const u8 *string); Returns target *******************************************************************************/ -u8 *CsrUtf8StrTruncate(u8 *target, CsrSize count); +u8 *CsrUtf8StrTruncate(u8 *target, size_t count); /******************************************************************************* @@ -116,7 +116,7 @@ u8 *CsrUtf8StrCpy(u8 *target, const u8 *source); Returns target *******************************************************************************/ -u8 *CsrUtf8StrNCpy(u8 *target, const u8 *source, CsrSize count); +u8 *CsrUtf8StrNCpy(u8 *target, const u8 *source, size_t count); /******************************************************************************* @@ -143,7 +143,7 @@ u8 *CsrUtf8StrNCpy(u8 *target, const u8 *source, CsrSize count); Returns target *******************************************************************************/ -u8 *CsrUtf8StrNCpyZero(u8 *target, const u8 *source, CsrSize count); +u8 *CsrUtf8StrNCpyZero(u8 *target, const u8 *source, size_t count); /******************************************************************************* @@ -174,8 +174,8 @@ u8 *CsrUtf8StringConcatenateTexts(const u8 *inputText1, const u8 *inputText2, co */ typedef u8 CsrUcs2String; -CsrSize CsrUcs2ByteStrLen(const CsrUcs2String *ucs2String); -CsrSize CsrConverterUcs2ByteStrLen(const CsrUcs2String *str); +size_t CsrUcs2ByteStrLen(const CsrUcs2String *ucs2String); +size_t CsrConverterUcs2ByteStrLen(const CsrUcs2String *str); u8 *CsrUcs2ByteString2Utf8(const CsrUcs2String *ucs2String); CsrUcs2String *CsrUtf82Ucs2ByteString(const u8 *utf8String); diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index 579cd4b..c1c3b89 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -564,8 +564,8 @@ static u8 isLegalUtf8(const u8 *codeUnit, u32 length) *********************************************************************************/ u16 *CsrUtf82Utf16String(const u8 *utf8String) { - CsrSize i, length = 0; - CsrSize sourceLength; + size_t i, length = 0; + size_t sourceLength; u16 *dest = NULL; u16 *destStart = NULL; s8 extraBytes2Read; @@ -1021,14 +1021,14 @@ s32 CsrUtf8StrCmp(const u8 *string1, const u8 *string2) return CsrStrCmp((const char *) string1, (const char *) string2); } -s32 CsrUtf8StrNCmp(const u8 *string1, const u8 *string2, CsrSize count) +s32 CsrUtf8StrNCmp(const u8 *string1, const u8 *string2, size_t count) { return CsrStrNCmp((const char *) string1, (const char *) string2, count); } u32 CsrUtf8StringLengthInBytes(const u8 *string) { - CsrSize length = 0; + size_t length = 0; if (string) { length = CsrStrLen((const char *) string); @@ -1041,9 +1041,9 @@ u8 *CsrUtf8StrCpy(u8 *target, const u8 *source) return (u8 *) CsrStrCpy((char *) target, (const char *) source); } -u8 *CsrUtf8StrTruncate(u8 *target, CsrSize count) +u8 *CsrUtf8StrTruncate(u8 *target, size_t count) { - CsrSize lastByte = count - 1; + size_t lastByte = count - 1; target[count] = '\0'; @@ -1070,12 +1070,12 @@ u8 *CsrUtf8StrTruncate(u8 *target, CsrSize count) return target; } -u8 *CsrUtf8StrNCpy(u8 *target, const u8 *source, CsrSize count) +u8 *CsrUtf8StrNCpy(u8 *target, const u8 *source, size_t count) { return (u8 *) CsrStrNCpy((char *) target, (const char *) source, count); } -u8 *CsrUtf8StrNCpyZero(u8 *target, const u8 *source, CsrSize count) +u8 *CsrUtf8StrNCpyZero(u8 *target, const u8 *source, size_t count) { CsrStrNCpy((char *) target, (const char *) source, count); if (target[count - 1] != '\0') diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index afb5783..fa2b2b4 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -222,31 +222,31 @@ void CsrUInt32ToHex(u32 number, char *str) /* String */ /*------------------------------------------------------------------*/ #ifndef CSR_USE_STDC_LIB -void *CsrMemCpy(void *dest, const void *src, CsrSize count) +void *CsrMemCpy(void *dest, const void *src, size_t count) { return memcpy(dest, src, count); } EXPORT_SYMBOL_GPL(CsrMemCpy); -void *CsrMemSet(void *dest, u8 c, CsrSize count) +void *CsrMemSet(void *dest, u8 c, size_t count) { return memset(dest, c, count); } EXPORT_SYMBOL_GPL(CsrMemSet); -void *CsrMemMove(void *dest, const void *src, CsrSize count) +void *CsrMemMove(void *dest, const void *src, size_t count) { return memmove(dest, src, count); } EXPORT_SYMBOL_GPL(CsrMemMove); -s32 CsrMemCmp(const void *buf1, const void *buf2, CsrSize count) +s32 CsrMemCmp(const void *buf1, const void *buf2, size_t count) { return memcmp(buf1, buf2, count); } EXPORT_SYMBOL_GPL(CsrMemCmp); -void *CsrMemDup(const void *buf1, CsrSize count) +void *CsrMemDup(const void *buf1, size_t count) { void *buf2 = NULL; @@ -266,7 +266,7 @@ char *CsrStrCpy(char *dest, const char *src) return strcpy(dest, src); } -char *CsrStrNCpy(char *dest, const char *src, CsrSize count) +char *CsrStrNCpy(char *dest, const char *src, size_t count) { return strncpy(dest, src, count); } @@ -276,7 +276,7 @@ char *CsrStrCat(char *dest, const char *src) return strcat(dest, src); } -char *CsrStrNCat(char *dest, const char *src, CsrSize count) +char *CsrStrNCat(char *dest, const char *src, size_t count) { return strncat(dest, src, count); } @@ -286,7 +286,7 @@ char *CsrStrStr(const char *string1, const char *string2) return strstr(string1, string2); } -CsrSize CsrStrLen(const char *string) +size_t CsrStrLen(const char *string) { return strlen(string); } @@ -297,7 +297,7 @@ s32 CsrStrCmp(const char *string1, const char *string2) return strcmp(string1, string2); } -s32 CsrStrNCmp(const char *string1, const char *string2, CsrSize count) +s32 CsrStrNCmp(const char *string1, const char *string2, size_t count) { return strncmp(string1, string2, count); } @@ -308,7 +308,7 @@ char *CsrStrChr(const char *string, char c) } #endif -s32 CsrVsnprintf(char *string, CsrSize count, const char *format, va_list args) +s32 CsrVsnprintf(char *string, size_t count, const char *format, va_list args) { return vsnprintf(string, count, format, args); } @@ -316,7 +316,7 @@ EXPORT_SYMBOL_GPL(CsrVsnprintf); char *CsrStrNCpyZero(char *dest, const char *src, - CsrSize count) + size_t count) { CsrStrNCpy(dest, src, count - 1); dest[count - 1] = '\0'; @@ -364,7 +364,7 @@ char *CsrStrDup(const char *string) int CsrStrNICmp(const char *string1, const char *string2, - CsrSize count) + size_t count) { u32 index; int returnValue = 0; diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index 0324fb4..222e807 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -52,30 +52,30 @@ void CsrUInt32ToHex(u32 number, char *str); #define CsrMemSet memset #define CsrStrLen strlen #else /* !CSR_USE_STDC_LIB */ -void *CsrMemCpy(void *dest, const void *src, CsrSize count); -void *CsrMemMove(void *dest, const void *src, CsrSize count); +void *CsrMemCpy(void *dest, const void *src, size_t count); +void *CsrMemMove(void *dest, const void *src, size_t count); char *CsrStrCpy(char *dest, const char *src); -char *CsrStrNCpy(char *dest, const char *src, CsrSize count); +char *CsrStrNCpy(char *dest, const char *src, size_t count); char *CsrStrCat(char *dest, const char *src); -char *CsrStrNCat(char *dest, const char *src, CsrSize count); -s32 CsrMemCmp(const void *buf1, const void *buf2, CsrSize count); +char *CsrStrNCat(char *dest, const char *src, size_t count); +s32 CsrMemCmp(const void *buf1, const void *buf2, size_t count); s32 CsrStrCmp(const char *string1, const char *string2); -s32 CsrStrNCmp(const char *string1, const char *string2, CsrSize count); +s32 CsrStrNCmp(const char *string1, const char *string2, size_t count); char *CsrStrChr(const char *string, char c); char *CsrStrStr(const char *string1, const char *string2); -void *CsrMemSet(void *dest, u8 c, CsrSize count); -CsrSize CsrStrLen(const char *string); +void *CsrMemSet(void *dest, u8 c, size_t count); +size_t CsrStrLen(const char *string); #endif /* !CSR_USE_STDC_LIB */ -s32 CsrVsnprintf(char *string, CsrSize count, const char *format, va_list args); +s32 CsrVsnprintf(char *string, size_t count, const char *format, va_list args); /*------------------------------------------------------------------*/ /* Non-standard utility functions */ /*------------------------------------------------------------------*/ -void *CsrMemDup(const void *buf1, CsrSize count); -int CsrStrNICmp(const char *string1, const char *string2, CsrSize count); +void *CsrMemDup(const void *buf1, size_t count); +int CsrStrNICmp(const char *string1, const char *string2, size_t count); char *CsrStrDup(const char *string); u32 CsrStrToInt(const char *string); -char *CsrStrNCpyZero(char *dest, const char *src, CsrSize count); +char *CsrStrNCpyZero(char *dest, const char *src, size_t count); /*------------------------------------------------------------------*/ /* Filename */ @@ -86,7 +86,7 @@ const char *CsrGetBaseName(const char *file); /* Misc */ /*------------------------------------------------------------------*/ u8 CsrIsSpace(u8 c); -#define CsrOffsetOf(st, m) ((CsrSize) & ((st *) 0)->m) +#define CsrOffsetOf(st, m) ((size_t) & ((st *) 0)->m) #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_wifi_msgconv.h b/drivers/staging/csr/csr_wifi_msgconv.h index e97aaee..4508262 100644 --- a/drivers/staging/csr/csr_wifi_msgconv.h +++ b/drivers/staging/csr/csr_wifi_msgconv.h @@ -21,37 +21,37 @@ extern "C" { #endif -void CsrUint16SerBigEndian(u8 *ptr, CsrSize *len, u16 v); -void CsrUint24SerBigEndian(u8 *ptr, CsrSize *len, u32 v); -void CsrUint32SerBigEndian(u8 *ptr, CsrSize *len, u32 v); +void CsrUint16SerBigEndian(u8 *ptr, size_t *len, u16 v); +void CsrUint24SerBigEndian(u8 *ptr, size_t *len, u32 v); +void CsrUint32SerBigEndian(u8 *ptr, size_t *len, u32 v); -void CsrUint16DesBigEndian(u16 *v, u8 *buffer, CsrSize *offset); -void CsrUint24DesBigEndian(u32 *v, u8 *buffer, CsrSize *offset); -void CsrUint32DesBigEndian(u32 *v, u8 *buffer, CsrSize *offset); +void CsrUint16DesBigEndian(u16 *v, u8 *buffer, size_t *offset); +void CsrUint24DesBigEndian(u32 *v, u8 *buffer, size_t *offset); +void CsrUint32DesBigEndian(u32 *v, u8 *buffer, size_t *offset); -void CsrUint24Ser(u8 *ptr, CsrSize *len, u32 v); -void CsrUint24Des(u32 *v, u8 *buffer, CsrSize *offset); +void CsrUint24Ser(u8 *ptr, size_t *len, u32 v); +void CsrUint24Des(u32 *v, u8 *buffer, size_t *offset); -CsrSize CsrWifiEventSizeof(void *msg); -u8* CsrWifiEventSer(u8 *ptr, CsrSize *len, void *msg); -void* CsrWifiEventDes(u8 *buffer, CsrSize length); +size_t CsrWifiEventSizeof(void *msg); +u8* CsrWifiEventSer(u8 *ptr, size_t *len, void *msg); +void* CsrWifiEventDes(u8 *buffer, size_t length); -CsrSize CsrWifiEventCsrUint8Sizeof(void *msg); -u8* CsrWifiEventCsrUint8Ser(u8 *ptr, CsrSize *len, void *msg); -void* CsrWifiEventCsrUint8Des(u8 *buffer, CsrSize length); +size_t CsrWifiEventCsrUint8Sizeof(void *msg); +u8* CsrWifiEventCsrUint8Ser(u8 *ptr, size_t *len, void *msg); +void* CsrWifiEventCsrUint8Des(u8 *buffer, size_t length); -CsrSize CsrWifiEventCsrUint16Sizeof(void *msg); -u8* CsrWifiEventCsrUint16Ser(u8 *ptr, CsrSize *len, void *msg); -void* CsrWifiEventCsrUint16Des(u8 *buffer, CsrSize length); +size_t CsrWifiEventCsrUint16Sizeof(void *msg); +u8* CsrWifiEventCsrUint16Ser(u8 *ptr, size_t *len, void *msg); +void* CsrWifiEventCsrUint16Des(u8 *buffer, size_t length); -CsrSize CsrWifiEventCsrUint32Sizeof(void *msg); -u8* CsrWifiEventCsrUint32Ser(u8 *ptr, CsrSize *len, void *msg); -void* CsrWifiEventCsrUint32Des(u8 *buffer, CsrSize length); +size_t CsrWifiEventCsrUint32Sizeof(void *msg); +u8* CsrWifiEventCsrUint32Ser(u8 *ptr, size_t *len, void *msg); +void* CsrWifiEventCsrUint32Des(u8 *buffer, size_t length); -CsrSize CsrWifiEventCsrUint16CsrUint8Sizeof(void *msg); -u8* CsrWifiEventCsrUint16CsrUint8Ser(u8 *ptr, CsrSize *len, void *msg); -void* CsrWifiEventCsrUint16CsrUint8Des(u8 *buffer, CsrSize length); +size_t CsrWifiEventCsrUint16CsrUint8Sizeof(void *msg); +u8* CsrWifiEventCsrUint16CsrUint8Ser(u8 *ptr, size_t *len, void *msg); +void* CsrWifiEventCsrUint16CsrUint8Des(u8 *buffer, size_t length); #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c index c9a36e9..71a4995 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c +++ b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c @@ -26,10 +26,10 @@ void CsrWifiNmeApPfree(void *ptr) } -CsrSize CsrWifiNmeApConfigSetReqSizeof(void *msg) +size_t CsrWifiNmeApConfigSetReqSizeof(void *msg) { CsrWifiNmeApConfigSetReq *primitive = (CsrWifiNmeApConfigSetReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 104) */ bufferSize += 2; /* u16 primitive->apConfig.apGroupkeyTimeout */ @@ -88,7 +88,7 @@ CsrSize CsrWifiNmeApConfigSetReqSizeof(void *msg) } -u8* CsrWifiNmeApConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiNmeApConfigSetReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiNmeApConfigSetReq *primitive = (CsrWifiNmeApConfigSetReq *)msg; *len = 0; @@ -149,10 +149,10 @@ u8* CsrWifiNmeApConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiNmeApConfigSetReqDes(u8 *buffer, CsrSize length) +void* CsrWifiNmeApConfigSetReqDes(u8 *buffer, size_t length) { CsrWifiNmeApConfigSetReq *primitive = (CsrWifiNmeApConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApConfigSetReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -226,9 +226,9 @@ void CsrWifiNmeApConfigSetReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiNmeApWpsRegisterReqSizeof(void *msg) +size_t CsrWifiNmeApWpsRegisterReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -239,7 +239,7 @@ CsrSize CsrWifiNmeApWpsRegisterReqSizeof(void *msg) } -u8* CsrWifiNmeApWpsRegisterReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiNmeApWpsRegisterReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiNmeApWpsRegisterReq *primitive = (CsrWifiNmeApWpsRegisterReq *)msg; *len = 0; @@ -252,10 +252,10 @@ u8* CsrWifiNmeApWpsRegisterReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiNmeApWpsRegisterReqDes(u8 *buffer, CsrSize length) +void* CsrWifiNmeApWpsRegisterReqDes(u8 *buffer, size_t length) { CsrWifiNmeApWpsRegisterReq *primitive = (CsrWifiNmeApWpsRegisterReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApWpsRegisterReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -268,10 +268,10 @@ void* CsrWifiNmeApWpsRegisterReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiNmeApStartReqSizeof(void *msg) +size_t CsrWifiNmeApStartReqSizeof(void *msg) { CsrWifiNmeApStartReq *primitive = (CsrWifiNmeApStartReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 112) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -355,7 +355,7 @@ CsrSize CsrWifiNmeApStartReqSizeof(void *msg) } -u8* CsrWifiNmeApStartReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiNmeApStartReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiNmeApStartReq *primitive = (CsrWifiNmeApStartReq *)msg; *len = 0; @@ -444,10 +444,10 @@ u8* CsrWifiNmeApStartReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiNmeApStartReqDes(u8 *buffer, CsrSize length) +void* CsrWifiNmeApStartReqDes(u8 *buffer, size_t length) { CsrWifiNmeApStartReq *primitive = (CsrWifiNmeApStartReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStartReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -576,9 +576,9 @@ void CsrWifiNmeApStartReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiNmeApWmmParamUpdateReqSizeof(void *msg) +size_t CsrWifiNmeApWmmParamUpdateReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 51) */ { @@ -607,7 +607,7 @@ CsrSize CsrWifiNmeApWmmParamUpdateReqSizeof(void *msg) } -u8* CsrWifiNmeApWmmParamUpdateReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiNmeApWmmParamUpdateReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiNmeApWmmParamUpdateReq *primitive = (CsrWifiNmeApWmmParamUpdateReq *)msg; *len = 0; @@ -638,10 +638,10 @@ u8* CsrWifiNmeApWmmParamUpdateReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiNmeApWmmParamUpdateReqDes(u8 *buffer, CsrSize length) +void* CsrWifiNmeApWmmParamUpdateReqDes(u8 *buffer, size_t length) { CsrWifiNmeApWmmParamUpdateReq *primitive = (CsrWifiNmeApWmmParamUpdateReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApWmmParamUpdateReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -672,9 +672,9 @@ void* CsrWifiNmeApWmmParamUpdateReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiNmeApStaRemoveReqSizeof(void *msg) +size_t CsrWifiNmeApStaRemoveReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -684,7 +684,7 @@ CsrSize CsrWifiNmeApStaRemoveReqSizeof(void *msg) } -u8* CsrWifiNmeApStaRemoveReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiNmeApStaRemoveReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiNmeApStaRemoveReq *primitive = (CsrWifiNmeApStaRemoveReq *)msg; *len = 0; @@ -696,10 +696,10 @@ u8* CsrWifiNmeApStaRemoveReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiNmeApStaRemoveReqDes(u8 *buffer, CsrSize length) +void* CsrWifiNmeApStaRemoveReqDes(u8 *buffer, size_t length) { CsrWifiNmeApStaRemoveReq *primitive = (CsrWifiNmeApStaRemoveReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStaRemoveReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -711,9 +711,9 @@ void* CsrWifiNmeApStaRemoveReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiNmeApWpsRegisterCfmSizeof(void *msg) +size_t CsrWifiNmeApWpsRegisterCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -722,7 +722,7 @@ CsrSize CsrWifiNmeApWpsRegisterCfmSizeof(void *msg) } -u8* CsrWifiNmeApWpsRegisterCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiNmeApWpsRegisterCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiNmeApWpsRegisterCfm *primitive = (CsrWifiNmeApWpsRegisterCfm *)msg; *len = 0; @@ -733,10 +733,10 @@ u8* CsrWifiNmeApWpsRegisterCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiNmeApWpsRegisterCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiNmeApWpsRegisterCfmDes(u8 *buffer, size_t length) { CsrWifiNmeApWpsRegisterCfm *primitive = (CsrWifiNmeApWpsRegisterCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApWpsRegisterCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -747,9 +747,9 @@ void* CsrWifiNmeApWpsRegisterCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiNmeApStartCfmSizeof(void *msg) +size_t CsrWifiNmeApStartCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 40) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -760,7 +760,7 @@ CsrSize CsrWifiNmeApStartCfmSizeof(void *msg) } -u8* CsrWifiNmeApStartCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiNmeApStartCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiNmeApStartCfm *primitive = (CsrWifiNmeApStartCfm *)msg; *len = 0; @@ -773,10 +773,10 @@ u8* CsrWifiNmeApStartCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiNmeApStartCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiNmeApStartCfmDes(u8 *buffer, size_t length) { CsrWifiNmeApStartCfm *primitive = (CsrWifiNmeApStartCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApStartCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -789,9 +789,9 @@ void* CsrWifiNmeApStartCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiNmeApStopCfmSizeof(void *msg) +size_t CsrWifiNmeApStopCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -800,7 +800,7 @@ CsrSize CsrWifiNmeApStopCfmSizeof(void *msg) } -u8* CsrWifiNmeApStopCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiNmeApStopCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiNmeApStopCfm *primitive = (CsrWifiNmeApStopCfm *)msg; *len = 0; @@ -811,10 +811,10 @@ u8* CsrWifiNmeApStopCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiNmeApStopCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiNmeApStopCfmDes(u8 *buffer, size_t length) { CsrWifiNmeApStopCfm *primitive = (CsrWifiNmeApStopCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -825,9 +825,9 @@ void* CsrWifiNmeApStopCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiNmeApStopIndSizeof(void *msg) +size_t CsrWifiNmeApStopIndSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -837,7 +837,7 @@ CsrSize CsrWifiNmeApStopIndSizeof(void *msg) } -u8* CsrWifiNmeApStopIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiNmeApStopIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiNmeApStopInd *primitive = (CsrWifiNmeApStopInd *)msg; *len = 0; @@ -849,10 +849,10 @@ u8* CsrWifiNmeApStopIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiNmeApStopIndDes(u8 *buffer, CsrSize length) +void* CsrWifiNmeApStopIndDes(u8 *buffer, size_t length) { CsrWifiNmeApStopInd *primitive = (CsrWifiNmeApStopInd *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -864,9 +864,9 @@ void* CsrWifiNmeApStopIndDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiNmeApStationIndSizeof(void *msg) +size_t CsrWifiNmeApStationIndSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 18) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -877,7 +877,7 @@ CsrSize CsrWifiNmeApStationIndSizeof(void *msg) } -u8* CsrWifiNmeApStationIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiNmeApStationIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiNmeApStationInd *primitive = (CsrWifiNmeApStationInd *)msg; *len = 0; @@ -890,10 +890,10 @@ u8* CsrWifiNmeApStationIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiNmeApStationIndDes(u8 *buffer, CsrSize length) +void* CsrWifiNmeApStationIndDes(u8 *buffer, size_t length) { CsrWifiNmeApStationInd *primitive = (CsrWifiNmeApStationInd *) CsrPmemAlloc(sizeof(CsrWifiNmeApStationInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); diff --git a/drivers/staging/csr/csr_wifi_nme_ap_serialize.h b/drivers/staging/csr/csr_wifi_nme_ap_serialize.h index 563afb1..5f85b01 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_serialize.h +++ b/drivers/staging/csr/csr_wifi_nme_ap_serialize.h @@ -32,19 +32,19 @@ extern "C" { extern void CsrWifiNmeApPfree(void *ptr); -extern u8* CsrWifiNmeApConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeApConfigSetReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeApConfigSetReqSizeof(void *msg); +extern u8* CsrWifiNmeApConfigSetReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeApConfigSetReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeApConfigSetReqSizeof(void *msg); extern void CsrWifiNmeApConfigSetReqSerFree(void *msg); -extern u8* CsrWifiNmeApWpsRegisterReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeApWpsRegisterReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeApWpsRegisterReqSizeof(void *msg); +extern u8* CsrWifiNmeApWpsRegisterReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeApWpsRegisterReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeApWpsRegisterReqSizeof(void *msg); #define CsrWifiNmeApWpsRegisterReqSerFree CsrWifiNmeApPfree -extern u8* CsrWifiNmeApStartReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeApStartReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeApStartReqSizeof(void *msg); +extern u8* CsrWifiNmeApStartReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeApStartReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeApStartReqSizeof(void *msg); extern void CsrWifiNmeApStartReqSerFree(void *msg); #define CsrWifiNmeApStopReqSer CsrWifiEventCsrUint16Ser @@ -52,14 +52,14 @@ extern void CsrWifiNmeApStartReqSerFree(void *msg); #define CsrWifiNmeApStopReqSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiNmeApStopReqSerFree CsrWifiNmeApPfree -extern u8* CsrWifiNmeApWmmParamUpdateReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeApWmmParamUpdateReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeApWmmParamUpdateReqSizeof(void *msg); +extern u8* CsrWifiNmeApWmmParamUpdateReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeApWmmParamUpdateReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeApWmmParamUpdateReqSizeof(void *msg); #define CsrWifiNmeApWmmParamUpdateReqSerFree CsrWifiNmeApPfree -extern u8* CsrWifiNmeApStaRemoveReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeApStaRemoveReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeApStaRemoveReqSizeof(void *msg); +extern u8* CsrWifiNmeApStaRemoveReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeApStaRemoveReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeApStaRemoveReqSizeof(void *msg); #define CsrWifiNmeApStaRemoveReqSerFree CsrWifiNmeApPfree #define CsrWifiNmeApConfigSetCfmSer CsrWifiEventCsrUint16Ser @@ -67,24 +67,24 @@ extern CsrSize CsrWifiNmeApStaRemoveReqSizeof(void *msg); #define CsrWifiNmeApConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiNmeApConfigSetCfmSerFree CsrWifiNmeApPfree -extern u8* CsrWifiNmeApWpsRegisterCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeApWpsRegisterCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeApWpsRegisterCfmSizeof(void *msg); +extern u8* CsrWifiNmeApWpsRegisterCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeApWpsRegisterCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeApWpsRegisterCfmSizeof(void *msg); #define CsrWifiNmeApWpsRegisterCfmSerFree CsrWifiNmeApPfree -extern u8* CsrWifiNmeApStartCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeApStartCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeApStartCfmSizeof(void *msg); +extern u8* CsrWifiNmeApStartCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeApStartCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeApStartCfmSizeof(void *msg); #define CsrWifiNmeApStartCfmSerFree CsrWifiNmeApPfree -extern u8* CsrWifiNmeApStopCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeApStopCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeApStopCfmSizeof(void *msg); +extern u8* CsrWifiNmeApStopCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeApStopCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeApStopCfmSizeof(void *msg); #define CsrWifiNmeApStopCfmSerFree CsrWifiNmeApPfree -extern u8* CsrWifiNmeApStopIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeApStopIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeApStopIndSizeof(void *msg); +extern u8* CsrWifiNmeApStopIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeApStopIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeApStopIndSizeof(void *msg); #define CsrWifiNmeApStopIndSerFree CsrWifiNmeApPfree #define CsrWifiNmeApWmmParamUpdateCfmSer CsrWifiEventCsrUint16Ser @@ -92,9 +92,9 @@ extern CsrSize CsrWifiNmeApStopIndSizeof(void *msg); #define CsrWifiNmeApWmmParamUpdateCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiNmeApWmmParamUpdateCfmSerFree CsrWifiNmeApPfree -extern u8* CsrWifiNmeApStationIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeApStationIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeApStationIndSizeof(void *msg); +extern u8* CsrWifiNmeApStationIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeApStationIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeApStationIndSizeof(void *msg); #define CsrWifiNmeApStationIndSerFree CsrWifiNmeApPfree diff --git a/drivers/staging/csr/csr_wifi_nme_serialize.h b/drivers/staging/csr/csr_wifi_nme_serialize.h index ecc5674..2acc6c1 100644 --- a/drivers/staging/csr/csr_wifi_nme_serialize.h +++ b/drivers/staging/csr/csr_wifi_nme_serialize.h @@ -29,14 +29,14 @@ extern "C" { extern void CsrWifiNmePfree(void *ptr); -extern u8* CsrWifiNmeProfileSetReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeProfileSetReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeProfileSetReqSizeof(void *msg); +extern u8* CsrWifiNmeProfileSetReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeProfileSetReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeProfileSetReqSizeof(void *msg); extern void CsrWifiNmeProfileSetReqSerFree(void *msg); -extern u8* CsrWifiNmeProfileDeleteReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeProfileDeleteReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeProfileDeleteReqSizeof(void *msg); +extern u8* CsrWifiNmeProfileDeleteReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeProfileDeleteReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeProfileDeleteReqSizeof(void *msg); #define CsrWifiNmeProfileDeleteReqSerFree CsrWifiNmePfree #define CsrWifiNmeProfileDeleteAllReqSer CsrWifiEventSer @@ -44,19 +44,19 @@ extern CsrSize CsrWifiNmeProfileDeleteReqSizeof(void *msg); #define CsrWifiNmeProfileDeleteAllReqSizeof CsrWifiEventSizeof #define CsrWifiNmeProfileDeleteAllReqSerFree CsrWifiNmePfree -extern u8* CsrWifiNmeProfileOrderSetReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeProfileOrderSetReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeProfileOrderSetReqSizeof(void *msg); +extern u8* CsrWifiNmeProfileOrderSetReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeProfileOrderSetReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeProfileOrderSetReqSizeof(void *msg); extern void CsrWifiNmeProfileOrderSetReqSerFree(void *msg); -extern u8* CsrWifiNmeProfileConnectReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeProfileConnectReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeProfileConnectReqSizeof(void *msg); +extern u8* CsrWifiNmeProfileConnectReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeProfileConnectReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeProfileConnectReqSizeof(void *msg); #define CsrWifiNmeProfileConnectReqSerFree CsrWifiNmePfree -extern u8* CsrWifiNmeWpsReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeWpsReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeWpsReqSizeof(void *msg); +extern u8* CsrWifiNmeWpsReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeWpsReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeWpsReqSizeof(void *msg); #define CsrWifiNmeWpsReqSerFree CsrWifiNmePfree #define CsrWifiNmeWpsCancelReqSer CsrWifiEventCsrUint16Ser @@ -69,24 +69,24 @@ extern CsrSize CsrWifiNmeWpsReqSizeof(void *msg); #define CsrWifiNmeConnectionStatusGetReqSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiNmeConnectionStatusGetReqSerFree CsrWifiNmePfree -extern u8* CsrWifiNmeSimImsiGetResSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeSimImsiGetResDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeSimImsiGetResSizeof(void *msg); +extern u8* CsrWifiNmeSimImsiGetResSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeSimImsiGetResDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeSimImsiGetResSizeof(void *msg); extern void CsrWifiNmeSimImsiGetResSerFree(void *msg); -extern u8* CsrWifiNmeSimGsmAuthResSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeSimGsmAuthResDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeSimGsmAuthResSizeof(void *msg); +extern u8* CsrWifiNmeSimGsmAuthResSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeSimGsmAuthResDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeSimGsmAuthResSizeof(void *msg); extern void CsrWifiNmeSimGsmAuthResSerFree(void *msg); -extern u8* CsrWifiNmeSimUmtsAuthResSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeSimUmtsAuthResDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeSimUmtsAuthResSizeof(void *msg); +extern u8* CsrWifiNmeSimUmtsAuthResSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeSimUmtsAuthResDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeSimUmtsAuthResSizeof(void *msg); extern void CsrWifiNmeSimUmtsAuthResSerFree(void *msg); -extern u8* CsrWifiNmeWpsConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeWpsConfigSetReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeWpsConfigSetReqSizeof(void *msg); +extern u8* CsrWifiNmeWpsConfigSetReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeWpsConfigSetReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeWpsConfigSetReqSizeof(void *msg); extern void CsrWifiNmeWpsConfigSetReqSerFree(void *msg); #define CsrWifiNmeEventMaskSetReqSer CsrWifiEventCsrUint32Ser @@ -109,39 +109,39 @@ extern void CsrWifiNmeWpsConfigSetReqSerFree(void *msg); #define CsrWifiNmeProfileDeleteAllCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiNmeProfileDeleteAllCfmSerFree CsrWifiNmePfree -extern u8* CsrWifiNmeProfileOrderSetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeProfileOrderSetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeProfileOrderSetCfmSizeof(void *msg); +extern u8* CsrWifiNmeProfileOrderSetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeProfileOrderSetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeProfileOrderSetCfmSizeof(void *msg); #define CsrWifiNmeProfileOrderSetCfmSerFree CsrWifiNmePfree -extern u8* CsrWifiNmeProfileConnectCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeProfileConnectCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeProfileConnectCfmSizeof(void *msg); +extern u8* CsrWifiNmeProfileConnectCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeProfileConnectCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeProfileConnectCfmSizeof(void *msg); extern void CsrWifiNmeProfileConnectCfmSerFree(void *msg); -extern u8* CsrWifiNmeWpsCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeWpsCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeWpsCfmSizeof(void *msg); +extern u8* CsrWifiNmeWpsCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeWpsCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeWpsCfmSizeof(void *msg); extern void CsrWifiNmeWpsCfmSerFree(void *msg); -extern u8* CsrWifiNmeWpsCancelCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeWpsCancelCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeWpsCancelCfmSizeof(void *msg); +extern u8* CsrWifiNmeWpsCancelCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeWpsCancelCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeWpsCancelCfmSizeof(void *msg); #define CsrWifiNmeWpsCancelCfmSerFree CsrWifiNmePfree -extern u8* CsrWifiNmeConnectionStatusGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeConnectionStatusGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeConnectionStatusGetCfmSizeof(void *msg); +extern u8* CsrWifiNmeConnectionStatusGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeConnectionStatusGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeConnectionStatusGetCfmSizeof(void *msg); #define CsrWifiNmeConnectionStatusGetCfmSerFree CsrWifiNmePfree -extern u8* CsrWifiNmeProfileUpdateIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeProfileUpdateIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeProfileUpdateIndSizeof(void *msg); +extern u8* CsrWifiNmeProfileUpdateIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeProfileUpdateIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeProfileUpdateIndSizeof(void *msg); extern void CsrWifiNmeProfileUpdateIndSerFree(void *msg); -extern u8* CsrWifiNmeProfileDisconnectIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeProfileDisconnectIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeProfileDisconnectIndSizeof(void *msg); +extern u8* CsrWifiNmeProfileDisconnectIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeProfileDisconnectIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeProfileDisconnectIndSizeof(void *msg); extern void CsrWifiNmeProfileDisconnectIndSerFree(void *msg); #define CsrWifiNmeSimImsiGetIndSer CsrWifiEventSer @@ -149,14 +149,14 @@ extern void CsrWifiNmeProfileDisconnectIndSerFree(void *msg); #define CsrWifiNmeSimImsiGetIndSizeof CsrWifiEventSizeof #define CsrWifiNmeSimImsiGetIndSerFree CsrWifiNmePfree -extern u8* CsrWifiNmeSimGsmAuthIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeSimGsmAuthIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeSimGsmAuthIndSizeof(void *msg); +extern u8* CsrWifiNmeSimGsmAuthIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeSimGsmAuthIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeSimGsmAuthIndSizeof(void *msg); extern void CsrWifiNmeSimGsmAuthIndSerFree(void *msg); -extern u8* CsrWifiNmeSimUmtsAuthIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiNmeSimUmtsAuthIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiNmeSimUmtsAuthIndSizeof(void *msg); +extern u8* CsrWifiNmeSimUmtsAuthIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiNmeSimUmtsAuthIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiNmeSimUmtsAuthIndSizeof(void *msg); #define CsrWifiNmeSimUmtsAuthIndSerFree CsrWifiNmePfree #define CsrWifiNmeWpsConfigSetCfmSer CsrWifiEventCsrUint16Ser diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c index 8cad0a4..377efb1 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c @@ -24,9 +24,9 @@ void CsrWifiRouterCtrlPfree(void *ptr) } -CsrSize CsrWifiRouterCtrlConfigurePowerModeReqSizeof(void *msg) +size_t CsrWifiRouterCtrlConfigurePowerModeReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -36,7 +36,7 @@ CsrSize CsrWifiRouterCtrlConfigurePowerModeReqSizeof(void *msg) } -u8* CsrWifiRouterCtrlConfigurePowerModeReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlConfigurePowerModeReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlConfigurePowerModeReq *primitive = (CsrWifiRouterCtrlConfigurePowerModeReq *)msg; *len = 0; @@ -48,10 +48,10 @@ u8* CsrWifiRouterCtrlConfigurePowerModeReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlConfigurePowerModeReqDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlConfigurePowerModeReqDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlConfigurePowerModeReq *primitive = (CsrWifiRouterCtrlConfigurePowerModeReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlConfigurePowerModeReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -63,10 +63,10 @@ void* CsrWifiRouterCtrlConfigurePowerModeReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlHipReqSizeof(void *msg) +size_t CsrWifiRouterCtrlHipReqSizeof(void *msg) { CsrWifiRouterCtrlHipReq *primitive = (CsrWifiRouterCtrlHipReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */ bufferSize += 2; /* u16 primitive->mlmeCommandLength */ @@ -79,7 +79,7 @@ CsrSize CsrWifiRouterCtrlHipReqSizeof(void *msg) } -u8* CsrWifiRouterCtrlHipReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlHipReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlHipReq *primitive = (CsrWifiRouterCtrlHipReq *)msg; *len = 0; @@ -103,10 +103,10 @@ u8* CsrWifiRouterCtrlHipReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlHipReqDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlHipReqDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlHipReq *primitive = (CsrWifiRouterCtrlHipReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlHipReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -155,9 +155,9 @@ void CsrWifiRouterCtrlHipReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiRouterCtrlMediaStatusReqSizeof(void *msg) +size_t CsrWifiRouterCtrlMediaStatusReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -167,7 +167,7 @@ CsrSize CsrWifiRouterCtrlMediaStatusReqSizeof(void *msg) } -u8* CsrWifiRouterCtrlMediaStatusReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlMediaStatusReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlMediaStatusReq *primitive = (CsrWifiRouterCtrlMediaStatusReq *)msg; *len = 0; @@ -179,10 +179,10 @@ u8* CsrWifiRouterCtrlMediaStatusReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlMediaStatusReqDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlMediaStatusReqDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlMediaStatusReq *primitive = (CsrWifiRouterCtrlMediaStatusReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMediaStatusReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -194,10 +194,10 @@ void* CsrWifiRouterCtrlMediaStatusReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlMulticastAddressResSizeof(void *msg) +size_t CsrWifiRouterCtrlMulticastAddressResSizeof(void *msg) { CsrWifiRouterCtrlMulticastAddressRes *primitive = (CsrWifiRouterCtrlMulticastAddressRes *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -216,7 +216,7 @@ CsrSize CsrWifiRouterCtrlMulticastAddressResSizeof(void *msg) } -u8* CsrWifiRouterCtrlMulticastAddressResSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlMulticastAddressResSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlMulticastAddressRes *primitive = (CsrWifiRouterCtrlMulticastAddressRes *)msg; *len = 0; @@ -237,10 +237,10 @@ u8* CsrWifiRouterCtrlMulticastAddressResSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlMulticastAddressResDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlMulticastAddressResDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlMulticastAddressRes *primitive = (CsrWifiRouterCtrlMulticastAddressRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMulticastAddressRes)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -274,9 +274,9 @@ void CsrWifiRouterCtrlMulticastAddressResSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiRouterCtrlPortConfigureReqSizeof(void *msg) +size_t CsrWifiRouterCtrlPortConfigureReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 18) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -289,7 +289,7 @@ CsrSize CsrWifiRouterCtrlPortConfigureReqSizeof(void *msg) } -u8* CsrWifiRouterCtrlPortConfigureReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlPortConfigureReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlPortConfigureReq *primitive = (CsrWifiRouterCtrlPortConfigureReq *)msg; *len = 0; @@ -304,10 +304,10 @@ u8* CsrWifiRouterCtrlPortConfigureReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlPortConfigureReqDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlPortConfigureReqDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlPortConfigureReq *primitive = (CsrWifiRouterCtrlPortConfigureReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPortConfigureReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -322,9 +322,9 @@ void* CsrWifiRouterCtrlPortConfigureReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlQosControlReqSizeof(void *msg) +size_t CsrWifiRouterCtrlQosControlReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -335,7 +335,7 @@ CsrSize CsrWifiRouterCtrlQosControlReqSizeof(void *msg) } -u8* CsrWifiRouterCtrlQosControlReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlQosControlReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlQosControlReq *primitive = (CsrWifiRouterCtrlQosControlReq *)msg; *len = 0; @@ -348,10 +348,10 @@ u8* CsrWifiRouterCtrlQosControlReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlQosControlReqDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlQosControlReqDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlQosControlReq *primitive = (CsrWifiRouterCtrlQosControlReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlQosControlReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -364,9 +364,9 @@ void* CsrWifiRouterCtrlQosControlReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlSuspendResSizeof(void *msg) +size_t CsrWifiRouterCtrlSuspendResSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -375,7 +375,7 @@ CsrSize CsrWifiRouterCtrlSuspendResSizeof(void *msg) } -u8* CsrWifiRouterCtrlSuspendResSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlSuspendResSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlSuspendRes *primitive = (CsrWifiRouterCtrlSuspendRes *)msg; *len = 0; @@ -386,10 +386,10 @@ u8* CsrWifiRouterCtrlSuspendResSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlSuspendResDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlSuspendResDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlSuspendRes *primitive = (CsrWifiRouterCtrlSuspendRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlSuspendRes)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -400,10 +400,10 @@ void* CsrWifiRouterCtrlSuspendResDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlTclasAddReqSizeof(void *msg) +size_t CsrWifiRouterCtrlTclasAddReqSizeof(void *msg) { CsrWifiRouterCtrlTclasAddReq *primitive = (CsrWifiRouterCtrlTclasAddReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -414,7 +414,7 @@ CsrSize CsrWifiRouterCtrlTclasAddReqSizeof(void *msg) } -u8* CsrWifiRouterCtrlTclasAddReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlTclasAddReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlTclasAddReq *primitive = (CsrWifiRouterCtrlTclasAddReq *)msg; *len = 0; @@ -430,10 +430,10 @@ u8* CsrWifiRouterCtrlTclasAddReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlTclasAddReqDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlTclasAddReqDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlTclasAddReq *primitive = (CsrWifiRouterCtrlTclasAddReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasAddReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -462,9 +462,9 @@ void CsrWifiRouterCtrlTclasAddReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiRouterCtrlResumeResSizeof(void *msg) +size_t CsrWifiRouterCtrlResumeResSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -473,7 +473,7 @@ CsrSize CsrWifiRouterCtrlResumeResSizeof(void *msg) } -u8* CsrWifiRouterCtrlResumeResSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlResumeResSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlResumeRes *primitive = (CsrWifiRouterCtrlResumeRes *)msg; *len = 0; @@ -484,10 +484,10 @@ u8* CsrWifiRouterCtrlResumeResSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlResumeResDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlResumeResDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlResumeRes *primitive = (CsrWifiRouterCtrlResumeRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlResumeRes)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -498,10 +498,10 @@ void* CsrWifiRouterCtrlResumeResDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlTclasDelReqSizeof(void *msg) +size_t CsrWifiRouterCtrlTclasDelReqSizeof(void *msg) { CsrWifiRouterCtrlTclasDelReq *primitive = (CsrWifiRouterCtrlTclasDelReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -512,7 +512,7 @@ CsrSize CsrWifiRouterCtrlTclasDelReqSizeof(void *msg) } -u8* CsrWifiRouterCtrlTclasDelReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlTclasDelReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlTclasDelReq *primitive = (CsrWifiRouterCtrlTclasDelReq *)msg; *len = 0; @@ -528,10 +528,10 @@ u8* CsrWifiRouterCtrlTclasDelReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlTclasDelReqDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlTclasDelReqDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlTclasDelReq *primitive = (CsrWifiRouterCtrlTclasDelReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasDelReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -560,9 +560,9 @@ void CsrWifiRouterCtrlTclasDelReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiRouterCtrlTrafficClassificationReqSizeof(void *msg) +size_t CsrWifiRouterCtrlTrafficClassificationReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -573,7 +573,7 @@ CsrSize CsrWifiRouterCtrlTrafficClassificationReqSizeof(void *msg) } -u8* CsrWifiRouterCtrlTrafficClassificationReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlTrafficClassificationReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlTrafficClassificationReq *primitive = (CsrWifiRouterCtrlTrafficClassificationReq *)msg; *len = 0; @@ -586,10 +586,10 @@ u8* CsrWifiRouterCtrlTrafficClassificationReqSer(u8 *ptr, CsrSize *len, void *ms } -void* CsrWifiRouterCtrlTrafficClassificationReqDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlTrafficClassificationReqDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlTrafficClassificationReq *primitive = (CsrWifiRouterCtrlTrafficClassificationReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficClassificationReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -602,9 +602,9 @@ void* CsrWifiRouterCtrlTrafficClassificationReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlTrafficConfigReqSizeof(void *msg) +size_t CsrWifiRouterCtrlTrafficConfigReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 24) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -619,7 +619,7 @@ CsrSize CsrWifiRouterCtrlTrafficConfigReqSizeof(void *msg) } -u8* CsrWifiRouterCtrlTrafficConfigReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlTrafficConfigReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlTrafficConfigReq *primitive = (CsrWifiRouterCtrlTrafficConfigReq *)msg; *len = 0; @@ -636,10 +636,10 @@ u8* CsrWifiRouterCtrlTrafficConfigReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlTrafficConfigReqDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlTrafficConfigReqDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlTrafficConfigReq *primitive = (CsrWifiRouterCtrlTrafficConfigReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficConfigReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -656,10 +656,10 @@ void* CsrWifiRouterCtrlTrafficConfigReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlWifiOnReqSizeof(void *msg) +size_t CsrWifiRouterCtrlWifiOnReqSizeof(void *msg) { CsrWifiRouterCtrlWifiOnReq *primitive = (CsrWifiRouterCtrlWifiOnReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -669,7 +669,7 @@ CsrSize CsrWifiRouterCtrlWifiOnReqSizeof(void *msg) } -u8* CsrWifiRouterCtrlWifiOnReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlWifiOnReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlWifiOnReq *primitive = (CsrWifiRouterCtrlWifiOnReq *)msg; *len = 0; @@ -684,10 +684,10 @@ u8* CsrWifiRouterCtrlWifiOnReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlWifiOnReqDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlWifiOnReqDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlWifiOnReq *primitive = (CsrWifiRouterCtrlWifiOnReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -715,10 +715,10 @@ void CsrWifiRouterCtrlWifiOnReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiRouterCtrlWifiOnResSizeof(void *msg) +size_t CsrWifiRouterCtrlWifiOnResSizeof(void *msg) { CsrWifiRouterCtrlWifiOnRes *primitive = (CsrWifiRouterCtrlWifiOnRes *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 30) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -739,7 +739,7 @@ CsrSize CsrWifiRouterCtrlWifiOnResSizeof(void *msg) } -u8* CsrWifiRouterCtrlWifiOnResSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlWifiOnResSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlWifiOnRes *primitive = (CsrWifiRouterCtrlWifiOnRes *)msg; *len = 0; @@ -762,10 +762,10 @@ u8* CsrWifiRouterCtrlWifiOnResSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlWifiOnResDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlWifiOnResDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlWifiOnRes *primitive = (CsrWifiRouterCtrlWifiOnRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnRes)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -796,9 +796,9 @@ void CsrWifiRouterCtrlWifiOnResSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiRouterCtrlM4TransmitReqSizeof(void *msg) +size_t CsrWifiRouterCtrlM4TransmitReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -807,7 +807,7 @@ CsrSize CsrWifiRouterCtrlM4TransmitReqSizeof(void *msg) } -u8* CsrWifiRouterCtrlM4TransmitReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlM4TransmitReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlM4TransmitReq *primitive = (CsrWifiRouterCtrlM4TransmitReq *)msg; *len = 0; @@ -818,10 +818,10 @@ u8* CsrWifiRouterCtrlM4TransmitReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlM4TransmitReqDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlM4TransmitReqDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlM4TransmitReq *primitive = (CsrWifiRouterCtrlM4TransmitReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlM4TransmitReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -832,9 +832,9 @@ void* CsrWifiRouterCtrlM4TransmitReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlModeSetReqSizeof(void *msg) +size_t CsrWifiRouterCtrlModeSetReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 16) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -847,7 +847,7 @@ CsrSize CsrWifiRouterCtrlModeSetReqSizeof(void *msg) } -u8* CsrWifiRouterCtrlModeSetReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlModeSetReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlModeSetReq *primitive = (CsrWifiRouterCtrlModeSetReq *)msg; *len = 0; @@ -862,10 +862,10 @@ u8* CsrWifiRouterCtrlModeSetReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlModeSetReqDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlModeSetReqDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlModeSetReq *primitive = (CsrWifiRouterCtrlModeSetReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlModeSetReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -880,9 +880,9 @@ void* CsrWifiRouterCtrlModeSetReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlPeerAddReqSizeof(void *msg) +size_t CsrWifiRouterCtrlPeerAddReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 21) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -897,7 +897,7 @@ CsrSize CsrWifiRouterCtrlPeerAddReqSizeof(void *msg) } -u8* CsrWifiRouterCtrlPeerAddReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlPeerAddReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlPeerAddReq *primitive = (CsrWifiRouterCtrlPeerAddReq *)msg; *len = 0; @@ -914,10 +914,10 @@ u8* CsrWifiRouterCtrlPeerAddReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlPeerAddReqDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlPeerAddReqDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlPeerAddReq *primitive = (CsrWifiRouterCtrlPeerAddReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerAddReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -934,9 +934,9 @@ void* CsrWifiRouterCtrlPeerAddReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlPeerDelReqSizeof(void *msg) +size_t CsrWifiRouterCtrlPeerDelReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -946,7 +946,7 @@ CsrSize CsrWifiRouterCtrlPeerDelReqSizeof(void *msg) } -u8* CsrWifiRouterCtrlPeerDelReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlPeerDelReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlPeerDelReq *primitive = (CsrWifiRouterCtrlPeerDelReq *)msg; *len = 0; @@ -958,10 +958,10 @@ u8* CsrWifiRouterCtrlPeerDelReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlPeerDelReqDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlPeerDelReqDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlPeerDelReq *primitive = (CsrWifiRouterCtrlPeerDelReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerDelReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -973,9 +973,9 @@ void* CsrWifiRouterCtrlPeerDelReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlPeerUpdateReqSizeof(void *msg) +size_t CsrWifiRouterCtrlPeerUpdateReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -986,7 +986,7 @@ CsrSize CsrWifiRouterCtrlPeerUpdateReqSizeof(void *msg) } -u8* CsrWifiRouterCtrlPeerUpdateReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlPeerUpdateReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlPeerUpdateReq *primitive = (CsrWifiRouterCtrlPeerUpdateReq *)msg; *len = 0; @@ -999,10 +999,10 @@ u8* CsrWifiRouterCtrlPeerUpdateReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlPeerUpdateReqDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlPeerUpdateReqDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlPeerUpdateReq *primitive = (CsrWifiRouterCtrlPeerUpdateReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerUpdateReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1015,9 +1015,9 @@ void* CsrWifiRouterCtrlPeerUpdateReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlBlockAckEnableReqSizeof(void *msg) +size_t CsrWifiRouterCtrlBlockAckEnableReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 21) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -1032,7 +1032,7 @@ CsrSize CsrWifiRouterCtrlBlockAckEnableReqSizeof(void *msg) } -u8* CsrWifiRouterCtrlBlockAckEnableReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlBlockAckEnableReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlBlockAckEnableReq *primitive = (CsrWifiRouterCtrlBlockAckEnableReq *)msg; *len = 0; @@ -1049,10 +1049,10 @@ u8* CsrWifiRouterCtrlBlockAckEnableReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlBlockAckEnableReqDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlBlockAckEnableReqDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlBlockAckEnableReq *primitive = (CsrWifiRouterCtrlBlockAckEnableReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckEnableReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1069,9 +1069,9 @@ void* CsrWifiRouterCtrlBlockAckEnableReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlBlockAckDisableReqSizeof(void *msg) +size_t CsrWifiRouterCtrlBlockAckDisableReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -1083,7 +1083,7 @@ CsrSize CsrWifiRouterCtrlBlockAckDisableReqSizeof(void *msg) } -u8* CsrWifiRouterCtrlBlockAckDisableReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlBlockAckDisableReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlBlockAckDisableReq *primitive = (CsrWifiRouterCtrlBlockAckDisableReq *)msg; *len = 0; @@ -1097,10 +1097,10 @@ u8* CsrWifiRouterCtrlBlockAckDisableReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlBlockAckDisableReqDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlBlockAckDisableReqDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlBlockAckDisableReq *primitive = (CsrWifiRouterCtrlBlockAckDisableReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckDisableReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1114,10 +1114,10 @@ void* CsrWifiRouterCtrlBlockAckDisableReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlWapiRxPktReqSizeof(void *msg) +size_t CsrWifiRouterCtrlWapiRxPktReqSizeof(void *msg) { CsrWifiRouterCtrlWapiRxPktReq *primitive = (CsrWifiRouterCtrlWapiRxPktReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -1129,7 +1129,7 @@ CsrSize CsrWifiRouterCtrlWapiRxPktReqSizeof(void *msg) } -u8* CsrWifiRouterCtrlWapiRxPktReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlWapiRxPktReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlWapiRxPktReq *primitive = (CsrWifiRouterCtrlWapiRxPktReq *)msg; *len = 0; @@ -1149,10 +1149,10 @@ u8* CsrWifiRouterCtrlWapiRxPktReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlWapiRxPktReqDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlWapiRxPktReqDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlWapiRxPktReq *primitive = (CsrWifiRouterCtrlWapiRxPktReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiRxPktReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1191,10 +1191,10 @@ void CsrWifiRouterCtrlWapiRxPktReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiRouterCtrlWapiUnicastTxPktReqSizeof(void *msg) +size_t CsrWifiRouterCtrlWapiUnicastTxPktReqSizeof(void *msg) { CsrWifiRouterCtrlWapiUnicastTxPktReq *primitive = (CsrWifiRouterCtrlWapiUnicastTxPktReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -1204,7 +1204,7 @@ CsrSize CsrWifiRouterCtrlWapiUnicastTxPktReqSizeof(void *msg) } -u8* CsrWifiRouterCtrlWapiUnicastTxPktReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlWapiUnicastTxPktReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlWapiUnicastTxPktReq *primitive = (CsrWifiRouterCtrlWapiUnicastTxPktReq *)msg; *len = 0; @@ -1219,10 +1219,10 @@ u8* CsrWifiRouterCtrlWapiUnicastTxPktReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlWapiUnicastTxPktReqDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlWapiUnicastTxPktReqDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlWapiUnicastTxPktReq *primitive = (CsrWifiRouterCtrlWapiUnicastTxPktReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxPktReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1250,10 +1250,10 @@ void CsrWifiRouterCtrlWapiUnicastTxPktReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiRouterCtrlHipIndSizeof(void *msg) +size_t CsrWifiRouterCtrlHipIndSizeof(void *msg) { CsrWifiRouterCtrlHipInd *primitive = (CsrWifiRouterCtrlHipInd *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */ bufferSize += 2; /* u16 primitive->mlmeCommandLength */ @@ -1266,7 +1266,7 @@ CsrSize CsrWifiRouterCtrlHipIndSizeof(void *msg) } -u8* CsrWifiRouterCtrlHipIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlHipIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlHipInd *primitive = (CsrWifiRouterCtrlHipInd *)msg; *len = 0; @@ -1290,10 +1290,10 @@ u8* CsrWifiRouterCtrlHipIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlHipIndDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlHipIndDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlHipInd *primitive = (CsrWifiRouterCtrlHipInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlHipInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1342,10 +1342,10 @@ void CsrWifiRouterCtrlHipIndSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiRouterCtrlMulticastAddressIndSizeof(void *msg) +size_t CsrWifiRouterCtrlMulticastAddressIndSizeof(void *msg) { CsrWifiRouterCtrlMulticastAddressInd *primitive = (CsrWifiRouterCtrlMulticastAddressInd *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -1363,7 +1363,7 @@ CsrSize CsrWifiRouterCtrlMulticastAddressIndSizeof(void *msg) } -u8* CsrWifiRouterCtrlMulticastAddressIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlMulticastAddressIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlMulticastAddressInd *primitive = (CsrWifiRouterCtrlMulticastAddressInd *)msg; *len = 0; @@ -1383,10 +1383,10 @@ u8* CsrWifiRouterCtrlMulticastAddressIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlMulticastAddressIndDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlMulticastAddressIndDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlMulticastAddressInd *primitive = (CsrWifiRouterCtrlMulticastAddressInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMulticastAddressInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1419,9 +1419,9 @@ void CsrWifiRouterCtrlMulticastAddressIndSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiRouterCtrlPortConfigureCfmSizeof(void *msg) +size_t CsrWifiRouterCtrlPortConfigureCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -1432,7 +1432,7 @@ CsrSize CsrWifiRouterCtrlPortConfigureCfmSizeof(void *msg) } -u8* CsrWifiRouterCtrlPortConfigureCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlPortConfigureCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlPortConfigureCfm *primitive = (CsrWifiRouterCtrlPortConfigureCfm *)msg; *len = 0; @@ -1445,10 +1445,10 @@ u8* CsrWifiRouterCtrlPortConfigureCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlPortConfigureCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlPortConfigureCfmDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlPortConfigureCfm *primitive = (CsrWifiRouterCtrlPortConfigureCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPortConfigureCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1461,9 +1461,9 @@ void* CsrWifiRouterCtrlPortConfigureCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlSuspendIndSizeof(void *msg) +size_t CsrWifiRouterCtrlSuspendIndSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -1473,7 +1473,7 @@ CsrSize CsrWifiRouterCtrlSuspendIndSizeof(void *msg) } -u8* CsrWifiRouterCtrlSuspendIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlSuspendIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlSuspendInd *primitive = (CsrWifiRouterCtrlSuspendInd *)msg; *len = 0; @@ -1485,10 +1485,10 @@ u8* CsrWifiRouterCtrlSuspendIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlSuspendIndDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlSuspendIndDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlSuspendInd *primitive = (CsrWifiRouterCtrlSuspendInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlSuspendInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1500,9 +1500,9 @@ void* CsrWifiRouterCtrlSuspendIndDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlTclasAddCfmSizeof(void *msg) +size_t CsrWifiRouterCtrlTclasAddCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -1512,7 +1512,7 @@ CsrSize CsrWifiRouterCtrlTclasAddCfmSizeof(void *msg) } -u8* CsrWifiRouterCtrlTclasAddCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlTclasAddCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlTclasAddCfm *primitive = (CsrWifiRouterCtrlTclasAddCfm *)msg; *len = 0; @@ -1524,10 +1524,10 @@ u8* CsrWifiRouterCtrlTclasAddCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlTclasAddCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlTclasAddCfmDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlTclasAddCfm *primitive = (CsrWifiRouterCtrlTclasAddCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasAddCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1539,9 +1539,9 @@ void* CsrWifiRouterCtrlTclasAddCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlRawSdioDeinitialiseCfmSizeof(void *msg) +size_t CsrWifiRouterCtrlRawSdioDeinitialiseCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -1550,7 +1550,7 @@ CsrSize CsrWifiRouterCtrlRawSdioDeinitialiseCfmSizeof(void *msg) } -u8* CsrWifiRouterCtrlRawSdioDeinitialiseCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlRawSdioDeinitialiseCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlRawSdioDeinitialiseCfm *primitive = (CsrWifiRouterCtrlRawSdioDeinitialiseCfm *)msg; *len = 0; @@ -1561,10 +1561,10 @@ u8* CsrWifiRouterCtrlRawSdioDeinitialiseCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlRawSdioDeinitialiseCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlRawSdioDeinitialiseCfmDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlRawSdioDeinitialiseCfm *primitive = (CsrWifiRouterCtrlRawSdioDeinitialiseCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlRawSdioDeinitialiseCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1575,9 +1575,9 @@ void* CsrWifiRouterCtrlRawSdioDeinitialiseCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlRawSdioInitialiseCfmSizeof(void *msg) +size_t CsrWifiRouterCtrlRawSdioInitialiseCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 39) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -1594,7 +1594,7 @@ CsrSize CsrWifiRouterCtrlRawSdioInitialiseCfmSizeof(void *msg) } -u8* CsrWifiRouterCtrlRawSdioInitialiseCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlRawSdioInitialiseCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlRawSdioInitialiseCfm *primitive = (CsrWifiRouterCtrlRawSdioInitialiseCfm *)msg; *len = 0; @@ -1613,10 +1613,10 @@ u8* CsrWifiRouterCtrlRawSdioInitialiseCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlRawSdioInitialiseCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlRawSdioInitialiseCfmDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlRawSdioInitialiseCfm *primitive = (CsrWifiRouterCtrlRawSdioInitialiseCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlRawSdioInitialiseCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1643,9 +1643,9 @@ void* CsrWifiRouterCtrlRawSdioInitialiseCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlTclasDelCfmSizeof(void *msg) +size_t CsrWifiRouterCtrlTclasDelCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -1655,7 +1655,7 @@ CsrSize CsrWifiRouterCtrlTclasDelCfmSizeof(void *msg) } -u8* CsrWifiRouterCtrlTclasDelCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlTclasDelCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlTclasDelCfm *primitive = (CsrWifiRouterCtrlTclasDelCfm *)msg; *len = 0; @@ -1667,10 +1667,10 @@ u8* CsrWifiRouterCtrlTclasDelCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlTclasDelCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlTclasDelCfmDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlTclasDelCfm *primitive = (CsrWifiRouterCtrlTclasDelCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasDelCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1682,9 +1682,9 @@ void* CsrWifiRouterCtrlTclasDelCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlTrafficProtocolIndSizeof(void *msg) +size_t CsrWifiRouterCtrlTrafficProtocolIndSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -1696,7 +1696,7 @@ CsrSize CsrWifiRouterCtrlTrafficProtocolIndSizeof(void *msg) } -u8* CsrWifiRouterCtrlTrafficProtocolIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlTrafficProtocolIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlTrafficProtocolInd *primitive = (CsrWifiRouterCtrlTrafficProtocolInd *)msg; *len = 0; @@ -1710,10 +1710,10 @@ u8* CsrWifiRouterCtrlTrafficProtocolIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlTrafficProtocolIndDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlTrafficProtocolIndDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlTrafficProtocolInd *primitive = (CsrWifiRouterCtrlTrafficProtocolInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficProtocolInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1727,9 +1727,9 @@ void* CsrWifiRouterCtrlTrafficProtocolIndDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlTrafficSampleIndSizeof(void *msg) +size_t CsrWifiRouterCtrlTrafficSampleIndSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 38) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -1744,7 +1744,7 @@ CsrSize CsrWifiRouterCtrlTrafficSampleIndSizeof(void *msg) } -u8* CsrWifiRouterCtrlTrafficSampleIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlTrafficSampleIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlTrafficSampleInd *primitive = (CsrWifiRouterCtrlTrafficSampleInd *)msg; *len = 0; @@ -1761,10 +1761,10 @@ u8* CsrWifiRouterCtrlTrafficSampleIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlTrafficSampleIndDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlTrafficSampleIndDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlTrafficSampleInd *primitive = (CsrWifiRouterCtrlTrafficSampleInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficSampleInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1781,10 +1781,10 @@ void* CsrWifiRouterCtrlTrafficSampleIndDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlWifiOnIndSizeof(void *msg) +size_t CsrWifiRouterCtrlWifiOnIndSizeof(void *msg) { CsrWifiRouterCtrlWifiOnInd *primitive = (CsrWifiRouterCtrlWifiOnInd *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 27) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -1799,7 +1799,7 @@ CsrSize CsrWifiRouterCtrlWifiOnIndSizeof(void *msg) } -u8* CsrWifiRouterCtrlWifiOnIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlWifiOnIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlWifiOnInd *primitive = (CsrWifiRouterCtrlWifiOnInd *)msg; *len = 0; @@ -1816,10 +1816,10 @@ u8* CsrWifiRouterCtrlWifiOnIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlWifiOnIndDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlWifiOnIndDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlWifiOnInd *primitive = (CsrWifiRouterCtrlWifiOnInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1844,9 +1844,9 @@ void CsrWifiRouterCtrlWifiOnIndSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiRouterCtrlWifiOnCfmSizeof(void *msg) +size_t CsrWifiRouterCtrlWifiOnCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -1855,7 +1855,7 @@ CsrSize CsrWifiRouterCtrlWifiOnCfmSizeof(void *msg) } -u8* CsrWifiRouterCtrlWifiOnCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlWifiOnCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlWifiOnCfm *primitive = (CsrWifiRouterCtrlWifiOnCfm *)msg; *len = 0; @@ -1866,10 +1866,10 @@ u8* CsrWifiRouterCtrlWifiOnCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlWifiOnCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlWifiOnCfmDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlWifiOnCfm *primitive = (CsrWifiRouterCtrlWifiOnCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1880,9 +1880,9 @@ void* CsrWifiRouterCtrlWifiOnCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlM4ReadyToSendIndSizeof(void *msg) +size_t CsrWifiRouterCtrlM4ReadyToSendIndSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -1892,7 +1892,7 @@ CsrSize CsrWifiRouterCtrlM4ReadyToSendIndSizeof(void *msg) } -u8* CsrWifiRouterCtrlM4ReadyToSendIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlM4ReadyToSendIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlM4ReadyToSendInd *primitive = (CsrWifiRouterCtrlM4ReadyToSendInd *)msg; *len = 0; @@ -1904,10 +1904,10 @@ u8* CsrWifiRouterCtrlM4ReadyToSendIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlM4ReadyToSendIndDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlM4ReadyToSendIndDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlM4ReadyToSendInd *primitive = (CsrWifiRouterCtrlM4ReadyToSendInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlM4ReadyToSendInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1919,9 +1919,9 @@ void* CsrWifiRouterCtrlM4ReadyToSendIndDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlM4TransmittedIndSizeof(void *msg) +size_t CsrWifiRouterCtrlM4TransmittedIndSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -1932,7 +1932,7 @@ CsrSize CsrWifiRouterCtrlM4TransmittedIndSizeof(void *msg) } -u8* CsrWifiRouterCtrlM4TransmittedIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlM4TransmittedIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlM4TransmittedInd *primitive = (CsrWifiRouterCtrlM4TransmittedInd *)msg; *len = 0; @@ -1945,10 +1945,10 @@ u8* CsrWifiRouterCtrlM4TransmittedIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlM4TransmittedIndDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlM4TransmittedIndDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlM4TransmittedInd *primitive = (CsrWifiRouterCtrlM4TransmittedInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlM4TransmittedInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1961,9 +1961,9 @@ void* CsrWifiRouterCtrlM4TransmittedIndDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlMicFailureIndSizeof(void *msg) +size_t CsrWifiRouterCtrlMicFailureIndSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -1974,7 +1974,7 @@ CsrSize CsrWifiRouterCtrlMicFailureIndSizeof(void *msg) } -u8* CsrWifiRouterCtrlMicFailureIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlMicFailureIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlMicFailureInd *primitive = (CsrWifiRouterCtrlMicFailureInd *)msg; *len = 0; @@ -1987,10 +1987,10 @@ u8* CsrWifiRouterCtrlMicFailureIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlMicFailureIndDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlMicFailureIndDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlMicFailureInd *primitive = (CsrWifiRouterCtrlMicFailureInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMicFailureInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2003,9 +2003,9 @@ void* CsrWifiRouterCtrlMicFailureIndDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlConnectedIndSizeof(void *msg) +size_t CsrWifiRouterCtrlConnectedIndSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -2016,7 +2016,7 @@ CsrSize CsrWifiRouterCtrlConnectedIndSizeof(void *msg) } -u8* CsrWifiRouterCtrlConnectedIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlConnectedIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlConnectedInd *primitive = (CsrWifiRouterCtrlConnectedInd *)msg; *len = 0; @@ -2029,10 +2029,10 @@ u8* CsrWifiRouterCtrlConnectedIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlConnectedIndDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlConnectedIndDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlConnectedInd *primitive = (CsrWifiRouterCtrlConnectedInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlConnectedInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2045,9 +2045,9 @@ void* CsrWifiRouterCtrlConnectedIndDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlPeerAddCfmSizeof(void *msg) +size_t CsrWifiRouterCtrlPeerAddCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 19) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -2059,7 +2059,7 @@ CsrSize CsrWifiRouterCtrlPeerAddCfmSizeof(void *msg) } -u8* CsrWifiRouterCtrlPeerAddCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlPeerAddCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlPeerAddCfm *primitive = (CsrWifiRouterCtrlPeerAddCfm *)msg; *len = 0; @@ -2073,10 +2073,10 @@ u8* CsrWifiRouterCtrlPeerAddCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlPeerAddCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlPeerAddCfmDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlPeerAddCfm *primitive = (CsrWifiRouterCtrlPeerAddCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerAddCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2090,9 +2090,9 @@ void* CsrWifiRouterCtrlPeerAddCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlPeerDelCfmSizeof(void *msg) +size_t CsrWifiRouterCtrlPeerDelCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -2102,7 +2102,7 @@ CsrSize CsrWifiRouterCtrlPeerDelCfmSizeof(void *msg) } -u8* CsrWifiRouterCtrlPeerDelCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlPeerDelCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlPeerDelCfm *primitive = (CsrWifiRouterCtrlPeerDelCfm *)msg; *len = 0; @@ -2114,10 +2114,10 @@ u8* CsrWifiRouterCtrlPeerDelCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlPeerDelCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlPeerDelCfmDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlPeerDelCfm *primitive = (CsrWifiRouterCtrlPeerDelCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerDelCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2129,9 +2129,9 @@ void* CsrWifiRouterCtrlPeerDelCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlUnexpectedFrameIndSizeof(void *msg) +size_t CsrWifiRouterCtrlUnexpectedFrameIndSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -2141,7 +2141,7 @@ CsrSize CsrWifiRouterCtrlUnexpectedFrameIndSizeof(void *msg) } -u8* CsrWifiRouterCtrlUnexpectedFrameIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlUnexpectedFrameIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlUnexpectedFrameInd *primitive = (CsrWifiRouterCtrlUnexpectedFrameInd *)msg; *len = 0; @@ -2153,10 +2153,10 @@ u8* CsrWifiRouterCtrlUnexpectedFrameIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlUnexpectedFrameIndDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlUnexpectedFrameIndDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlUnexpectedFrameInd *primitive = (CsrWifiRouterCtrlUnexpectedFrameInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlUnexpectedFrameInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2168,9 +2168,9 @@ void* CsrWifiRouterCtrlUnexpectedFrameIndDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlPeerUpdateCfmSizeof(void *msg) +size_t CsrWifiRouterCtrlPeerUpdateCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -2180,7 +2180,7 @@ CsrSize CsrWifiRouterCtrlPeerUpdateCfmSizeof(void *msg) } -u8* CsrWifiRouterCtrlPeerUpdateCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlPeerUpdateCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlPeerUpdateCfm *primitive = (CsrWifiRouterCtrlPeerUpdateCfm *)msg; *len = 0; @@ -2192,10 +2192,10 @@ u8* CsrWifiRouterCtrlPeerUpdateCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlPeerUpdateCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlPeerUpdateCfmDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlPeerUpdateCfm *primitive = (CsrWifiRouterCtrlPeerUpdateCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerUpdateCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2207,9 +2207,9 @@ void* CsrWifiRouterCtrlPeerUpdateCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlCapabilitiesCfmSizeof(void *msg) +size_t CsrWifiRouterCtrlCapabilitiesCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -2219,7 +2219,7 @@ CsrSize CsrWifiRouterCtrlCapabilitiesCfmSizeof(void *msg) } -u8* CsrWifiRouterCtrlCapabilitiesCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlCapabilitiesCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlCapabilitiesCfm *primitive = (CsrWifiRouterCtrlCapabilitiesCfm *)msg; *len = 0; @@ -2231,10 +2231,10 @@ u8* CsrWifiRouterCtrlCapabilitiesCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlCapabilitiesCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlCapabilitiesCfmDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlCapabilitiesCfm *primitive = (CsrWifiRouterCtrlCapabilitiesCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlCapabilitiesCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2246,9 +2246,9 @@ void* CsrWifiRouterCtrlCapabilitiesCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlBlockAckEnableCfmSizeof(void *msg) +size_t CsrWifiRouterCtrlBlockAckEnableCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -2258,7 +2258,7 @@ CsrSize CsrWifiRouterCtrlBlockAckEnableCfmSizeof(void *msg) } -u8* CsrWifiRouterCtrlBlockAckEnableCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlBlockAckEnableCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlBlockAckEnableCfm *primitive = (CsrWifiRouterCtrlBlockAckEnableCfm *)msg; *len = 0; @@ -2270,10 +2270,10 @@ u8* CsrWifiRouterCtrlBlockAckEnableCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlBlockAckEnableCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlBlockAckEnableCfmDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlBlockAckEnableCfm *primitive = (CsrWifiRouterCtrlBlockAckEnableCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckEnableCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2285,9 +2285,9 @@ void* CsrWifiRouterCtrlBlockAckEnableCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlBlockAckDisableCfmSizeof(void *msg) +size_t CsrWifiRouterCtrlBlockAckDisableCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -2297,7 +2297,7 @@ CsrSize CsrWifiRouterCtrlBlockAckDisableCfmSizeof(void *msg) } -u8* CsrWifiRouterCtrlBlockAckDisableCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlBlockAckDisableCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlBlockAckDisableCfm *primitive = (CsrWifiRouterCtrlBlockAckDisableCfm *)msg; *len = 0; @@ -2309,10 +2309,10 @@ u8* CsrWifiRouterCtrlBlockAckDisableCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlBlockAckDisableCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlBlockAckDisableCfmDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlBlockAckDisableCfm *primitive = (CsrWifiRouterCtrlBlockAckDisableCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckDisableCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2324,9 +2324,9 @@ void* CsrWifiRouterCtrlBlockAckDisableCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlBlockAckErrorIndSizeof(void *msg) +size_t CsrWifiRouterCtrlBlockAckErrorIndSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 16) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -2338,7 +2338,7 @@ CsrSize CsrWifiRouterCtrlBlockAckErrorIndSizeof(void *msg) } -u8* CsrWifiRouterCtrlBlockAckErrorIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlBlockAckErrorIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlBlockAckErrorInd *primitive = (CsrWifiRouterCtrlBlockAckErrorInd *)msg; *len = 0; @@ -2352,10 +2352,10 @@ u8* CsrWifiRouterCtrlBlockAckErrorIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlBlockAckErrorIndDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlBlockAckErrorIndDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlBlockAckErrorInd *primitive = (CsrWifiRouterCtrlBlockAckErrorInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckErrorInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2369,9 +2369,9 @@ void* CsrWifiRouterCtrlBlockAckErrorIndDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlStaInactiveIndSizeof(void *msg) +size_t CsrWifiRouterCtrlStaInactiveIndSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -2381,7 +2381,7 @@ CsrSize CsrWifiRouterCtrlStaInactiveIndSizeof(void *msg) } -u8* CsrWifiRouterCtrlStaInactiveIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlStaInactiveIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlStaInactiveInd *primitive = (CsrWifiRouterCtrlStaInactiveInd *)msg; *len = 0; @@ -2393,10 +2393,10 @@ u8* CsrWifiRouterCtrlStaInactiveIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlStaInactiveIndDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlStaInactiveIndDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlStaInactiveInd *primitive = (CsrWifiRouterCtrlStaInactiveInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlStaInactiveInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2408,10 +2408,10 @@ void* CsrWifiRouterCtrlStaInactiveIndDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlWapiRxMicCheckIndSizeof(void *msg) +size_t CsrWifiRouterCtrlWapiRxMicCheckIndSizeof(void *msg) { CsrWifiRouterCtrlWapiRxMicCheckInd *primitive = (CsrWifiRouterCtrlWapiRxMicCheckInd *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -2424,7 +2424,7 @@ CsrSize CsrWifiRouterCtrlWapiRxMicCheckIndSizeof(void *msg) } -u8* CsrWifiRouterCtrlWapiRxMicCheckIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlWapiRxMicCheckIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlWapiRxMicCheckInd *primitive = (CsrWifiRouterCtrlWapiRxMicCheckInd *)msg; *len = 0; @@ -2445,10 +2445,10 @@ u8* CsrWifiRouterCtrlWapiRxMicCheckIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlWapiRxMicCheckIndDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlWapiRxMicCheckIndDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlWapiRxMicCheckInd *primitive = (CsrWifiRouterCtrlWapiRxMicCheckInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiRxMicCheckInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2488,9 +2488,9 @@ void CsrWifiRouterCtrlWapiRxMicCheckIndSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiRouterCtrlModeSetCfmSizeof(void *msg) +size_t CsrWifiRouterCtrlModeSetCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -2501,7 +2501,7 @@ CsrSize CsrWifiRouterCtrlModeSetCfmSizeof(void *msg) } -u8* CsrWifiRouterCtrlModeSetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlModeSetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlModeSetCfm *primitive = (CsrWifiRouterCtrlModeSetCfm *)msg; *len = 0; @@ -2514,10 +2514,10 @@ u8* CsrWifiRouterCtrlModeSetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterCtrlModeSetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlModeSetCfmDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlModeSetCfm *primitive = (CsrWifiRouterCtrlModeSetCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlModeSetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2530,10 +2530,10 @@ void* CsrWifiRouterCtrlModeSetCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterCtrlWapiUnicastTxEncryptIndSizeof(void *msg) +size_t CsrWifiRouterCtrlWapiUnicastTxEncryptIndSizeof(void *msg) { CsrWifiRouterCtrlWapiUnicastTxEncryptInd *primitive = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ @@ -2544,7 +2544,7 @@ CsrSize CsrWifiRouterCtrlWapiUnicastTxEncryptIndSizeof(void *msg) } -u8* CsrWifiRouterCtrlWapiUnicastTxEncryptIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterCtrlWapiUnicastTxEncryptIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterCtrlWapiUnicastTxEncryptInd *primitive = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *)msg; *len = 0; @@ -2560,10 +2560,10 @@ u8* CsrWifiRouterCtrlWapiUnicastTxEncryptIndSer(u8 *ptr, CsrSize *len, void *msg } -void* CsrWifiRouterCtrlWapiUnicastTxEncryptIndDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterCtrlWapiUnicastTxEncryptIndDes(u8 *buffer, size_t length) { CsrWifiRouterCtrlWapiUnicastTxEncryptInd *primitive = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxEncryptInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h index 5a17a45..458fb96 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h +++ b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h @@ -25,49 +25,49 @@ extern "C" { extern void CsrWifiRouterCtrlPfree(void *ptr); -extern u8* CsrWifiRouterCtrlConfigurePowerModeReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlConfigurePowerModeReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlConfigurePowerModeReqSizeof(void *msg); +extern u8* CsrWifiRouterCtrlConfigurePowerModeReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlConfigurePowerModeReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlConfigurePowerModeReqSizeof(void *msg); #define CsrWifiRouterCtrlConfigurePowerModeReqSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlHipReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlHipReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlHipReqSizeof(void *msg); +extern u8* CsrWifiRouterCtrlHipReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlHipReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlHipReqSizeof(void *msg); extern void CsrWifiRouterCtrlHipReqSerFree(void *msg); -extern u8* CsrWifiRouterCtrlMediaStatusReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlMediaStatusReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlMediaStatusReqSizeof(void *msg); +extern u8* CsrWifiRouterCtrlMediaStatusReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlMediaStatusReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlMediaStatusReqSizeof(void *msg); #define CsrWifiRouterCtrlMediaStatusReqSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlMulticastAddressResSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlMulticastAddressResDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlMulticastAddressResSizeof(void *msg); +extern u8* CsrWifiRouterCtrlMulticastAddressResSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlMulticastAddressResDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlMulticastAddressResSizeof(void *msg); extern void CsrWifiRouterCtrlMulticastAddressResSerFree(void *msg); -extern u8* CsrWifiRouterCtrlPortConfigureReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlPortConfigureReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlPortConfigureReqSizeof(void *msg); +extern u8* CsrWifiRouterCtrlPortConfigureReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlPortConfigureReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlPortConfigureReqSizeof(void *msg); #define CsrWifiRouterCtrlPortConfigureReqSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlQosControlReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlQosControlReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlQosControlReqSizeof(void *msg); +extern u8* CsrWifiRouterCtrlQosControlReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlQosControlReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlQosControlReqSizeof(void *msg); #define CsrWifiRouterCtrlQosControlReqSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlSuspendResSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlSuspendResDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlSuspendResSizeof(void *msg); +extern u8* CsrWifiRouterCtrlSuspendResSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlSuspendResDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlSuspendResSizeof(void *msg); #define CsrWifiRouterCtrlSuspendResSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlTclasAddReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlTclasAddReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlTclasAddReqSizeof(void *msg); +extern u8* CsrWifiRouterCtrlTclasAddReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlTclasAddReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlTclasAddReqSizeof(void *msg); extern void CsrWifiRouterCtrlTclasAddReqSerFree(void *msg); -extern u8* CsrWifiRouterCtrlResumeResSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlResumeResDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlResumeResSizeof(void *msg); +extern u8* CsrWifiRouterCtrlResumeResSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlResumeResDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlResumeResSizeof(void *msg); #define CsrWifiRouterCtrlResumeResSerFree CsrWifiRouterCtrlPfree #define CsrWifiRouterCtrlRawSdioDeinitialiseReqSer CsrWifiEventCsrUint16Ser @@ -80,19 +80,19 @@ extern CsrSize CsrWifiRouterCtrlResumeResSizeof(void *msg); #define CsrWifiRouterCtrlRawSdioInitialiseReqSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiRouterCtrlRawSdioInitialiseReqSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlTclasDelReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlTclasDelReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlTclasDelReqSizeof(void *msg); +extern u8* CsrWifiRouterCtrlTclasDelReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlTclasDelReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlTclasDelReqSizeof(void *msg); extern void CsrWifiRouterCtrlTclasDelReqSerFree(void *msg); -extern u8* CsrWifiRouterCtrlTrafficClassificationReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlTrafficClassificationReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlTrafficClassificationReqSizeof(void *msg); +extern u8* CsrWifiRouterCtrlTrafficClassificationReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlTrafficClassificationReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlTrafficClassificationReqSizeof(void *msg); #define CsrWifiRouterCtrlTrafficClassificationReqSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlTrafficConfigReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlTrafficConfigReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlTrafficConfigReqSizeof(void *msg); +extern u8* CsrWifiRouterCtrlTrafficConfigReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlTrafficConfigReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlTrafficConfigReqSizeof(void *msg); #define CsrWifiRouterCtrlTrafficConfigReqSerFree CsrWifiRouterCtrlPfree #define CsrWifiRouterCtrlWifiOffReqSer CsrWifiEventCsrUint16Ser @@ -105,39 +105,39 @@ extern CsrSize CsrWifiRouterCtrlTrafficConfigReqSizeof(void *msg); #define CsrWifiRouterCtrlWifiOffResSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiRouterCtrlWifiOffResSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlWifiOnReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlWifiOnReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlWifiOnReqSizeof(void *msg); +extern u8* CsrWifiRouterCtrlWifiOnReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlWifiOnReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlWifiOnReqSizeof(void *msg); extern void CsrWifiRouterCtrlWifiOnReqSerFree(void *msg); -extern u8* CsrWifiRouterCtrlWifiOnResSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlWifiOnResDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlWifiOnResSizeof(void *msg); +extern u8* CsrWifiRouterCtrlWifiOnResSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlWifiOnResDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlWifiOnResSizeof(void *msg); extern void CsrWifiRouterCtrlWifiOnResSerFree(void *msg); -extern u8* CsrWifiRouterCtrlM4TransmitReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlM4TransmitReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlM4TransmitReqSizeof(void *msg); +extern u8* CsrWifiRouterCtrlM4TransmitReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlM4TransmitReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlM4TransmitReqSizeof(void *msg); #define CsrWifiRouterCtrlM4TransmitReqSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlModeSetReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlModeSetReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlModeSetReqSizeof(void *msg); +extern u8* CsrWifiRouterCtrlModeSetReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlModeSetReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlModeSetReqSizeof(void *msg); #define CsrWifiRouterCtrlModeSetReqSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlPeerAddReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlPeerAddReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlPeerAddReqSizeof(void *msg); +extern u8* CsrWifiRouterCtrlPeerAddReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlPeerAddReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlPeerAddReqSizeof(void *msg); #define CsrWifiRouterCtrlPeerAddReqSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlPeerDelReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlPeerDelReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlPeerDelReqSizeof(void *msg); +extern u8* CsrWifiRouterCtrlPeerDelReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlPeerDelReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlPeerDelReqSizeof(void *msg); #define CsrWifiRouterCtrlPeerDelReqSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlPeerUpdateReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlPeerUpdateReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlPeerUpdateReqSizeof(void *msg); +extern u8* CsrWifiRouterCtrlPeerUpdateReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlPeerUpdateReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlPeerUpdateReqSizeof(void *msg); #define CsrWifiRouterCtrlPeerUpdateReqSerFree CsrWifiRouterCtrlPfree #define CsrWifiRouterCtrlCapabilitiesReqSer CsrWifiEventCsrUint16Ser @@ -145,19 +145,19 @@ extern CsrSize CsrWifiRouterCtrlPeerUpdateReqSizeof(void *msg); #define CsrWifiRouterCtrlCapabilitiesReqSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiRouterCtrlCapabilitiesReqSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlBlockAckEnableReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlBlockAckEnableReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlBlockAckEnableReqSizeof(void *msg); +extern u8* CsrWifiRouterCtrlBlockAckEnableReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlBlockAckEnableReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlBlockAckEnableReqSizeof(void *msg); #define CsrWifiRouterCtrlBlockAckEnableReqSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlBlockAckDisableReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlBlockAckDisableReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlBlockAckDisableReqSizeof(void *msg); +extern u8* CsrWifiRouterCtrlBlockAckDisableReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlBlockAckDisableReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlBlockAckDisableReqSizeof(void *msg); #define CsrWifiRouterCtrlBlockAckDisableReqSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlWapiRxPktReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlWapiRxPktReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlWapiRxPktReqSizeof(void *msg); +extern u8* CsrWifiRouterCtrlWapiRxPktReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlWapiRxPktReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlWapiRxPktReqSizeof(void *msg); extern void CsrWifiRouterCtrlWapiRxPktReqSerFree(void *msg); #define CsrWifiRouterCtrlWapiMulticastFilterReqSer CsrWifiEventCsrUint16CsrUint8Ser @@ -170,9 +170,9 @@ extern void CsrWifiRouterCtrlWapiRxPktReqSerFree(void *msg); #define CsrWifiRouterCtrlWapiUnicastFilterReqSizeof CsrWifiEventCsrUint16CsrUint8Sizeof #define CsrWifiRouterCtrlWapiUnicastFilterReqSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlWapiUnicastTxPktReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlWapiUnicastTxPktReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlWapiUnicastTxPktReqSizeof(void *msg); +extern u8* CsrWifiRouterCtrlWapiUnicastTxPktReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlWapiUnicastTxPktReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlWapiUnicastTxPktReqSizeof(void *msg); extern void CsrWifiRouterCtrlWapiUnicastTxPktReqSerFree(void *msg); #define CsrWifiRouterCtrlWapiFilterReqSer CsrWifiEventCsrUint16CsrUint8Ser @@ -180,19 +180,19 @@ extern void CsrWifiRouterCtrlWapiUnicastTxPktReqSerFree(void *msg); #define CsrWifiRouterCtrlWapiFilterReqSizeof CsrWifiEventCsrUint16CsrUint8Sizeof #define CsrWifiRouterCtrlWapiFilterReqSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlHipIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlHipIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlHipIndSizeof(void *msg); +extern u8* CsrWifiRouterCtrlHipIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlHipIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlHipIndSizeof(void *msg); extern void CsrWifiRouterCtrlHipIndSerFree(void *msg); -extern u8* CsrWifiRouterCtrlMulticastAddressIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlMulticastAddressIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlMulticastAddressIndSizeof(void *msg); +extern u8* CsrWifiRouterCtrlMulticastAddressIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlMulticastAddressIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlMulticastAddressIndSizeof(void *msg); extern void CsrWifiRouterCtrlMulticastAddressIndSerFree(void *msg); -extern u8* CsrWifiRouterCtrlPortConfigureCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlPortConfigureCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlPortConfigureCfmSizeof(void *msg); +extern u8* CsrWifiRouterCtrlPortConfigureCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlPortConfigureCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlPortConfigureCfmSizeof(void *msg); #define CsrWifiRouterCtrlPortConfigureCfmSerFree CsrWifiRouterCtrlPfree #define CsrWifiRouterCtrlResumeIndSer CsrWifiEventCsrUint16CsrUint8Ser @@ -200,39 +200,39 @@ extern CsrSize CsrWifiRouterCtrlPortConfigureCfmSizeof(void *msg); #define CsrWifiRouterCtrlResumeIndSizeof CsrWifiEventCsrUint16CsrUint8Sizeof #define CsrWifiRouterCtrlResumeIndSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlSuspendIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlSuspendIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlSuspendIndSizeof(void *msg); +extern u8* CsrWifiRouterCtrlSuspendIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlSuspendIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlSuspendIndSizeof(void *msg); #define CsrWifiRouterCtrlSuspendIndSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlTclasAddCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlTclasAddCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlTclasAddCfmSizeof(void *msg); +extern u8* CsrWifiRouterCtrlTclasAddCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlTclasAddCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlTclasAddCfmSizeof(void *msg); #define CsrWifiRouterCtrlTclasAddCfmSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlRawSdioDeinitialiseCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlRawSdioDeinitialiseCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlRawSdioDeinitialiseCfmSizeof(void *msg); +extern u8* CsrWifiRouterCtrlRawSdioDeinitialiseCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlRawSdioDeinitialiseCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlRawSdioDeinitialiseCfmSizeof(void *msg); #define CsrWifiRouterCtrlRawSdioDeinitialiseCfmSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlRawSdioInitialiseCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlRawSdioInitialiseCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlRawSdioInitialiseCfmSizeof(void *msg); +extern u8* CsrWifiRouterCtrlRawSdioInitialiseCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlRawSdioInitialiseCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlRawSdioInitialiseCfmSizeof(void *msg); #define CsrWifiRouterCtrlRawSdioInitialiseCfmSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlTclasDelCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlTclasDelCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlTclasDelCfmSizeof(void *msg); +extern u8* CsrWifiRouterCtrlTclasDelCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlTclasDelCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlTclasDelCfmSizeof(void *msg); #define CsrWifiRouterCtrlTclasDelCfmSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlTrafficProtocolIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlTrafficProtocolIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlTrafficProtocolIndSizeof(void *msg); +extern u8* CsrWifiRouterCtrlTrafficProtocolIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlTrafficProtocolIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlTrafficProtocolIndSizeof(void *msg); #define CsrWifiRouterCtrlTrafficProtocolIndSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlTrafficSampleIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlTrafficSampleIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlTrafficSampleIndSizeof(void *msg); +extern u8* CsrWifiRouterCtrlTrafficSampleIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlTrafficSampleIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlTrafficSampleIndSizeof(void *msg); #define CsrWifiRouterCtrlTrafficSampleIndSerFree CsrWifiRouterCtrlPfree #define CsrWifiRouterCtrlWifiOffIndSer CsrWifiEventCsrUint16CsrUint8Ser @@ -245,94 +245,94 @@ extern CsrSize CsrWifiRouterCtrlTrafficSampleIndSizeof(void *msg); #define CsrWifiRouterCtrlWifiOffCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiRouterCtrlWifiOffCfmSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlWifiOnIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlWifiOnIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlWifiOnIndSizeof(void *msg); +extern u8* CsrWifiRouterCtrlWifiOnIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlWifiOnIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlWifiOnIndSizeof(void *msg); extern void CsrWifiRouterCtrlWifiOnIndSerFree(void *msg); -extern u8* CsrWifiRouterCtrlWifiOnCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlWifiOnCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlWifiOnCfmSizeof(void *msg); +extern u8* CsrWifiRouterCtrlWifiOnCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlWifiOnCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlWifiOnCfmSizeof(void *msg); #define CsrWifiRouterCtrlWifiOnCfmSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlM4ReadyToSendIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlM4ReadyToSendIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlM4ReadyToSendIndSizeof(void *msg); +extern u8* CsrWifiRouterCtrlM4ReadyToSendIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlM4ReadyToSendIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlM4ReadyToSendIndSizeof(void *msg); #define CsrWifiRouterCtrlM4ReadyToSendIndSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlM4TransmittedIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlM4TransmittedIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlM4TransmittedIndSizeof(void *msg); +extern u8* CsrWifiRouterCtrlM4TransmittedIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlM4TransmittedIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlM4TransmittedIndSizeof(void *msg); #define CsrWifiRouterCtrlM4TransmittedIndSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlMicFailureIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlMicFailureIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlMicFailureIndSizeof(void *msg); +extern u8* CsrWifiRouterCtrlMicFailureIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlMicFailureIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlMicFailureIndSizeof(void *msg); #define CsrWifiRouterCtrlMicFailureIndSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlConnectedIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlConnectedIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlConnectedIndSizeof(void *msg); +extern u8* CsrWifiRouterCtrlConnectedIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlConnectedIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlConnectedIndSizeof(void *msg); #define CsrWifiRouterCtrlConnectedIndSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlPeerAddCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlPeerAddCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlPeerAddCfmSizeof(void *msg); +extern u8* CsrWifiRouterCtrlPeerAddCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlPeerAddCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlPeerAddCfmSizeof(void *msg); #define CsrWifiRouterCtrlPeerAddCfmSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlPeerDelCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlPeerDelCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlPeerDelCfmSizeof(void *msg); +extern u8* CsrWifiRouterCtrlPeerDelCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlPeerDelCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlPeerDelCfmSizeof(void *msg); #define CsrWifiRouterCtrlPeerDelCfmSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlUnexpectedFrameIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlUnexpectedFrameIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlUnexpectedFrameIndSizeof(void *msg); +extern u8* CsrWifiRouterCtrlUnexpectedFrameIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlUnexpectedFrameIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlUnexpectedFrameIndSizeof(void *msg); #define CsrWifiRouterCtrlUnexpectedFrameIndSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlPeerUpdateCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlPeerUpdateCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlPeerUpdateCfmSizeof(void *msg); +extern u8* CsrWifiRouterCtrlPeerUpdateCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlPeerUpdateCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlPeerUpdateCfmSizeof(void *msg); #define CsrWifiRouterCtrlPeerUpdateCfmSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlCapabilitiesCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlCapabilitiesCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlCapabilitiesCfmSizeof(void *msg); +extern u8* CsrWifiRouterCtrlCapabilitiesCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlCapabilitiesCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlCapabilitiesCfmSizeof(void *msg); #define CsrWifiRouterCtrlCapabilitiesCfmSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlBlockAckEnableCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlBlockAckEnableCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlBlockAckEnableCfmSizeof(void *msg); +extern u8* CsrWifiRouterCtrlBlockAckEnableCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlBlockAckEnableCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlBlockAckEnableCfmSizeof(void *msg); #define CsrWifiRouterCtrlBlockAckEnableCfmSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlBlockAckDisableCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlBlockAckDisableCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlBlockAckDisableCfmSizeof(void *msg); +extern u8* CsrWifiRouterCtrlBlockAckDisableCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlBlockAckDisableCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlBlockAckDisableCfmSizeof(void *msg); #define CsrWifiRouterCtrlBlockAckDisableCfmSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlBlockAckErrorIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlBlockAckErrorIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlBlockAckErrorIndSizeof(void *msg); +extern u8* CsrWifiRouterCtrlBlockAckErrorIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlBlockAckErrorIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlBlockAckErrorIndSizeof(void *msg); #define CsrWifiRouterCtrlBlockAckErrorIndSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlStaInactiveIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlStaInactiveIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlStaInactiveIndSizeof(void *msg); +extern u8* CsrWifiRouterCtrlStaInactiveIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlStaInactiveIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlStaInactiveIndSizeof(void *msg); #define CsrWifiRouterCtrlStaInactiveIndSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlWapiRxMicCheckIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlWapiRxMicCheckIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlWapiRxMicCheckIndSizeof(void *msg); +extern u8* CsrWifiRouterCtrlWapiRxMicCheckIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlWapiRxMicCheckIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlWapiRxMicCheckIndSizeof(void *msg); extern void CsrWifiRouterCtrlWapiRxMicCheckIndSerFree(void *msg); -extern u8* CsrWifiRouterCtrlModeSetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlModeSetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlModeSetCfmSizeof(void *msg); +extern u8* CsrWifiRouterCtrlModeSetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlModeSetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlModeSetCfmSizeof(void *msg); #define CsrWifiRouterCtrlModeSetCfmSerFree CsrWifiRouterCtrlPfree -extern u8* CsrWifiRouterCtrlWapiUnicastTxEncryptIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterCtrlWapiUnicastTxEncryptIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterCtrlWapiUnicastTxEncryptIndSizeof(void *msg); +extern u8* CsrWifiRouterCtrlWapiUnicastTxEncryptIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterCtrlWapiUnicastTxEncryptIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterCtrlWapiUnicastTxEncryptIndSizeof(void *msg); extern void CsrWifiRouterCtrlWapiUnicastTxEncryptIndSerFree(void *msg); diff --git a/drivers/staging/csr/csr_wifi_router_serialize.c b/drivers/staging/csr/csr_wifi_router_serialize.c index 913c291..f8447c8 100644 --- a/drivers/staging/csr/csr_wifi_router_serialize.c +++ b/drivers/staging/csr/csr_wifi_router_serialize.c @@ -24,9 +24,9 @@ void CsrWifiRouterPfree(void *ptr) } -CsrSize CsrWifiRouterMaPacketSubscribeReqSizeof(void *msg) +size_t CsrWifiRouterMaPacketSubscribeReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -37,7 +37,7 @@ CsrSize CsrWifiRouterMaPacketSubscribeReqSizeof(void *msg) } -u8* CsrWifiRouterMaPacketSubscribeReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterMaPacketSubscribeReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterMaPacketSubscribeReq *primitive = (CsrWifiRouterMaPacketSubscribeReq *)msg; *len = 0; @@ -50,10 +50,10 @@ u8* CsrWifiRouterMaPacketSubscribeReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterMaPacketSubscribeReqDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterMaPacketSubscribeReqDes(u8 *buffer, size_t length) { CsrWifiRouterMaPacketSubscribeReq *primitive = (CsrWifiRouterMaPacketSubscribeReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketSubscribeReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -66,10 +66,10 @@ void* CsrWifiRouterMaPacketSubscribeReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterMaPacketReqSizeof(void *msg) +size_t CsrWifiRouterMaPacketReqSizeof(void *msg) { CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 20) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -84,7 +84,7 @@ CsrSize CsrWifiRouterMaPacketReqSizeof(void *msg) } -u8* CsrWifiRouterMaPacketReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterMaPacketReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *)msg; *len = 0; @@ -104,10 +104,10 @@ u8* CsrWifiRouterMaPacketReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterMaPacketReqDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterMaPacketReqDes(u8 *buffer, size_t length) { CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -141,9 +141,9 @@ void CsrWifiRouterMaPacketReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiRouterMaPacketResSizeof(void *msg) +size_t CsrWifiRouterMaPacketResSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -153,7 +153,7 @@ CsrSize CsrWifiRouterMaPacketResSizeof(void *msg) } -u8* CsrWifiRouterMaPacketResSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterMaPacketResSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterMaPacketRes *primitive = (CsrWifiRouterMaPacketRes *)msg; *len = 0; @@ -165,10 +165,10 @@ u8* CsrWifiRouterMaPacketResSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterMaPacketResDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterMaPacketResDes(u8 *buffer, size_t length) { CsrWifiRouterMaPacketRes *primitive = (CsrWifiRouterMaPacketRes *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketRes)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -180,9 +180,9 @@ void* CsrWifiRouterMaPacketResDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterMaPacketCancelReqSizeof(void *msg) +size_t CsrWifiRouterMaPacketCancelReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -193,7 +193,7 @@ CsrSize CsrWifiRouterMaPacketCancelReqSizeof(void *msg) } -u8* CsrWifiRouterMaPacketCancelReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterMaPacketCancelReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterMaPacketCancelReq *primitive = (CsrWifiRouterMaPacketCancelReq *)msg; *len = 0; @@ -206,10 +206,10 @@ u8* CsrWifiRouterMaPacketCancelReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterMaPacketCancelReqDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterMaPacketCancelReqDes(u8 *buffer, size_t length) { CsrWifiRouterMaPacketCancelReq *primitive = (CsrWifiRouterMaPacketCancelReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketCancelReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -222,9 +222,9 @@ void* CsrWifiRouterMaPacketCancelReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterMaPacketSubscribeCfmSizeof(void *msg) +size_t CsrWifiRouterMaPacketSubscribeCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -235,7 +235,7 @@ CsrSize CsrWifiRouterMaPacketSubscribeCfmSizeof(void *msg) } -u8* CsrWifiRouterMaPacketSubscribeCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterMaPacketSubscribeCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterMaPacketSubscribeCfm *primitive = (CsrWifiRouterMaPacketSubscribeCfm *)msg; *len = 0; @@ -248,10 +248,10 @@ u8* CsrWifiRouterMaPacketSubscribeCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterMaPacketSubscribeCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterMaPacketSubscribeCfmDes(u8 *buffer, size_t length) { CsrWifiRouterMaPacketSubscribeCfm *primitive = (CsrWifiRouterMaPacketSubscribeCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketSubscribeCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -264,9 +264,9 @@ void* CsrWifiRouterMaPacketSubscribeCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterMaPacketUnsubscribeCfmSizeof(void *msg) +size_t CsrWifiRouterMaPacketUnsubscribeCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -275,7 +275,7 @@ CsrSize CsrWifiRouterMaPacketUnsubscribeCfmSizeof(void *msg) } -u8* CsrWifiRouterMaPacketUnsubscribeCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterMaPacketUnsubscribeCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterMaPacketUnsubscribeCfm *primitive = (CsrWifiRouterMaPacketUnsubscribeCfm *)msg; *len = 0; @@ -286,10 +286,10 @@ u8* CsrWifiRouterMaPacketUnsubscribeCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterMaPacketUnsubscribeCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterMaPacketUnsubscribeCfmDes(u8 *buffer, size_t length) { CsrWifiRouterMaPacketUnsubscribeCfm *primitive = (CsrWifiRouterMaPacketUnsubscribeCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketUnsubscribeCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -300,9 +300,9 @@ void* CsrWifiRouterMaPacketUnsubscribeCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterMaPacketCfmSizeof(void *msg) +size_t CsrWifiRouterMaPacketCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -313,7 +313,7 @@ CsrSize CsrWifiRouterMaPacketCfmSizeof(void *msg) } -u8* CsrWifiRouterMaPacketCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterMaPacketCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterMaPacketCfm *primitive = (CsrWifiRouterMaPacketCfm *)msg; *len = 0; @@ -326,10 +326,10 @@ u8* CsrWifiRouterMaPacketCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterMaPacketCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterMaPacketCfmDes(u8 *buffer, size_t length) { CsrWifiRouterMaPacketCfm *primitive = (CsrWifiRouterMaPacketCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -342,10 +342,10 @@ void* CsrWifiRouterMaPacketCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiRouterMaPacketIndSizeof(void *msg) +size_t CsrWifiRouterMaPacketIndSizeof(void *msg) { CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 21) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -361,7 +361,7 @@ CsrSize CsrWifiRouterMaPacketIndSizeof(void *msg) } -u8* CsrWifiRouterMaPacketIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiRouterMaPacketIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *)msg; *len = 0; @@ -382,10 +382,10 @@ u8* CsrWifiRouterMaPacketIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiRouterMaPacketIndDes(u8 *buffer, CsrSize length) +void* CsrWifiRouterMaPacketIndDes(u8 *buffer, size_t length) { CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); diff --git a/drivers/staging/csr/csr_wifi_router_serialize.h b/drivers/staging/csr/csr_wifi_router_serialize.h index 6a6c1b2..e6fdf32 100644 --- a/drivers/staging/csr/csr_wifi_router_serialize.h +++ b/drivers/staging/csr/csr_wifi_router_serialize.h @@ -25,9 +25,9 @@ extern "C" { extern void CsrWifiRouterPfree(void *ptr); -extern u8* CsrWifiRouterMaPacketSubscribeReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterMaPacketSubscribeReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterMaPacketSubscribeReqSizeof(void *msg); +extern u8* CsrWifiRouterMaPacketSubscribeReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterMaPacketSubscribeReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterMaPacketSubscribeReqSizeof(void *msg); #define CsrWifiRouterMaPacketSubscribeReqSerFree CsrWifiRouterPfree #define CsrWifiRouterMaPacketUnsubscribeReqSer CsrWifiEventCsrUint16CsrUint8Ser @@ -35,39 +35,39 @@ extern CsrSize CsrWifiRouterMaPacketSubscribeReqSizeof(void *msg); #define CsrWifiRouterMaPacketUnsubscribeReqSizeof CsrWifiEventCsrUint16CsrUint8Sizeof #define CsrWifiRouterMaPacketUnsubscribeReqSerFree CsrWifiRouterPfree -extern u8* CsrWifiRouterMaPacketReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterMaPacketReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterMaPacketReqSizeof(void *msg); +extern u8* CsrWifiRouterMaPacketReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterMaPacketReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterMaPacketReqSizeof(void *msg); extern void CsrWifiRouterMaPacketReqSerFree(void *msg); -extern u8* CsrWifiRouterMaPacketResSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterMaPacketResDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterMaPacketResSizeof(void *msg); +extern u8* CsrWifiRouterMaPacketResSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterMaPacketResDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterMaPacketResSizeof(void *msg); #define CsrWifiRouterMaPacketResSerFree CsrWifiRouterPfree -extern u8* CsrWifiRouterMaPacketCancelReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterMaPacketCancelReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterMaPacketCancelReqSizeof(void *msg); +extern u8* CsrWifiRouterMaPacketCancelReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterMaPacketCancelReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterMaPacketCancelReqSizeof(void *msg); #define CsrWifiRouterMaPacketCancelReqSerFree CsrWifiRouterPfree -extern u8* CsrWifiRouterMaPacketSubscribeCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterMaPacketSubscribeCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterMaPacketSubscribeCfmSizeof(void *msg); +extern u8* CsrWifiRouterMaPacketSubscribeCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterMaPacketSubscribeCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterMaPacketSubscribeCfmSizeof(void *msg); #define CsrWifiRouterMaPacketSubscribeCfmSerFree CsrWifiRouterPfree -extern u8* CsrWifiRouterMaPacketUnsubscribeCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterMaPacketUnsubscribeCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterMaPacketUnsubscribeCfmSizeof(void *msg); +extern u8* CsrWifiRouterMaPacketUnsubscribeCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterMaPacketUnsubscribeCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterMaPacketUnsubscribeCfmSizeof(void *msg); #define CsrWifiRouterMaPacketUnsubscribeCfmSerFree CsrWifiRouterPfree -extern u8* CsrWifiRouterMaPacketCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterMaPacketCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterMaPacketCfmSizeof(void *msg); +extern u8* CsrWifiRouterMaPacketCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterMaPacketCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterMaPacketCfmSizeof(void *msg); #define CsrWifiRouterMaPacketCfmSerFree CsrWifiRouterPfree -extern u8* CsrWifiRouterMaPacketIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiRouterMaPacketIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiRouterMaPacketIndSizeof(void *msg); +extern u8* CsrWifiRouterMaPacketIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiRouterMaPacketIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiRouterMaPacketIndSizeof(void *msg); extern void CsrWifiRouterMaPacketIndSerFree(void *msg); diff --git a/drivers/staging/csr/csr_wifi_router_transport.c b/drivers/staging/csr/csr_wifi_router_transport.c index 2986606..e42b21f 100644 --- a/drivers/staging/csr/csr_wifi_router_transport.c +++ b/drivers/staging/csr/csr_wifi_router_transport.c @@ -61,14 +61,14 @@ void CsrWifiRouterTransportDeinit(unifi_priv_t *priv) } } -void CsrWifiRouterTransportRecv(unifi_priv_t *priv, u8* buffer, CsrSize bufferLength) +void CsrWifiRouterTransportRecv(unifi_priv_t *priv, u8* buffer, size_t bufferLength) { CsrMsgConvMsgEntry* msgEntry; u16 primType; CsrSchedQid src; CsrSchedQid dest; u16 msgType; - CsrSize offset = 0; + size_t offset = 0; CsrWifiFsmEvent* msg; /* Decode the prim and message type */ @@ -163,9 +163,9 @@ static void CsrWifiRouterTransportSerialiseAndSend(u16 primType, void* msg) { CsrWifiFsmEvent* evt = (CsrWifiFsmEvent*)msg; CsrMsgConvMsgEntry* msgEntry; - CsrSize msgSize; - CsrSize encodeBufferLen = 0; - CsrSize offset = 0; + size_t msgSize; + size_t encodeBufferLen = 0; + size_t offset = 0; u8* encodeBuffer; unifi_trace(drvpriv, UDBG4, "CsrWifiRouterTransportSerialiseAndSend: primType=0x%.4X, msgType=0x%.4X\n", diff --git a/drivers/staging/csr/csr_wifi_serialize_primitive_types.c b/drivers/staging/csr/csr_wifi_serialize_primitive_types.c index 5b5444a..743dbdc 100644 --- a/drivers/staging/csr/csr_wifi_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_wifi_serialize_primitive_types.c @@ -16,7 +16,7 @@ #include "csr_wifi_msgconv.h" #include "csr_wifi_lib.h" -void CsrUint24Des(u32 *v, u8 *buffer, CsrSize *offset) +void CsrUint24Des(u32 *v, u8 *buffer, size_t *offset) { u32 val; @@ -30,7 +30,7 @@ void CsrUint24Des(u32 *v, u8 *buffer, CsrSize *offset) /* Big endian :e.g WSC, TCLAS */ -void CsrUint16DesBigEndian(u16 *v, u8 *buffer, CsrSize *offset) +void CsrUint16DesBigEndian(u16 *v, u8 *buffer, size_t *offset) { u16 val; @@ -41,7 +41,7 @@ void CsrUint16DesBigEndian(u16 *v, u8 *buffer, CsrSize *offset) } -void CsrUint24DesBigEndian(u32 *v, u8 *buffer, CsrSize *offset) +void CsrUint24DesBigEndian(u32 *v, u8 *buffer, size_t *offset) { u32 val; @@ -54,7 +54,7 @@ void CsrUint24DesBigEndian(u32 *v, u8 *buffer, CsrSize *offset) } -void CsrUint32DesBigEndian(u32 *v, u8 *buffer, CsrSize *offset) +void CsrUint32DesBigEndian(u32 *v, u8 *buffer, size_t *offset) { u32 val; @@ -68,7 +68,7 @@ void CsrUint32DesBigEndian(u32 *v, u8 *buffer, CsrSize *offset) } -void CsrUint24Ser(u8 *ptr, CsrSize *len, u32 v) +void CsrUint24Ser(u8 *ptr, size_t *len, u32 v) { ptr[(*len) + 2] = (u8)((v & 0x00ff0000) >> 16); ptr[(*len) + 1] = (u8)((v & 0x0000ff00) >> 8); @@ -79,7 +79,7 @@ void CsrUint24Ser(u8 *ptr, CsrSize *len, u32 v) /* Big endian :e.g WSC, TCLAS */ -void CsrUint16SerBigEndian(u8 *ptr, CsrSize *len, u16 v) +void CsrUint16SerBigEndian(u8 *ptr, size_t *len, u16 v) { ptr[(*len)] = (u8)((v & 0xff00) >> 8); ptr[(*len) + 1] = (u8)((v & 0x00ff)); @@ -88,7 +88,7 @@ void CsrUint16SerBigEndian(u8 *ptr, CsrSize *len, u16 v) } -void CsrUint32SerBigEndian(u8 *ptr, CsrSize *len, u32 v) +void CsrUint32SerBigEndian(u8 *ptr, size_t *len, u32 v) { ptr[(*len)] = (u8)((v & 0xff000000) >> 24); ptr[(*len) + 1] = (u8)((v & 0x00ff0000) >> 16); @@ -99,7 +99,7 @@ void CsrUint32SerBigEndian(u8 *ptr, CsrSize *len, u32 v) } -void CsrUint24SerBigEndian(u8 *ptr, CsrSize *len, u32 v) +void CsrUint24SerBigEndian(u8 *ptr, size_t *len, u32 v) { ptr[(*len)] = (u8)((v & 0x00ff0000) >> 16); ptr[(*len) + 1] = (u8)((v & 0x0000ff00) >> 8); @@ -109,13 +109,13 @@ void CsrUint24SerBigEndian(u8 *ptr, CsrSize *len, u32 v) } -CsrSize CsrWifiEventSizeof(void *msg) +size_t CsrWifiEventSizeof(void *msg) { return 2; } EXPORT_SYMBOL_GPL(CsrWifiEventSizeof); -u8* CsrWifiEventSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiEventSer(u8 *ptr, size_t *len, void *msg) { CsrWifiFsmEvent *primitive = (CsrWifiFsmEvent *)msg; *len = 0; @@ -124,23 +124,23 @@ u8* CsrWifiEventSer(u8 *ptr, CsrSize *len, void *msg) } EXPORT_SYMBOL_GPL(CsrWifiEventSer); -void* CsrWifiEventDes(u8 *buffer, CsrSize length) +void* CsrWifiEventDes(u8 *buffer, size_t length) { CsrWifiFsmEvent *primitive = (CsrWifiFsmEvent *) CsrPmemAlloc(sizeof(CsrWifiFsmEvent)); - CsrSize offset = 0; + size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); return primitive; } EXPORT_SYMBOL_GPL(CsrWifiEventDes); -CsrSize CsrWifiEventCsrUint8Sizeof(void *msg) +size_t CsrWifiEventCsrUint8Sizeof(void *msg) { return 3; } EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint8Sizeof); -u8* CsrWifiEventCsrUint8Ser(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiEventCsrUint8Ser(u8 *ptr, size_t *len, void *msg) { CsrWifiEventCsrUint8 *primitive = (CsrWifiEventCsrUint8 *)msg; *len = 0; @@ -151,11 +151,11 @@ u8* CsrWifiEventCsrUint8Ser(u8 *ptr, CsrSize *len, void *msg) EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint8Ser); -void* CsrWifiEventCsrUint8Des(u8 *buffer, CsrSize length) +void* CsrWifiEventCsrUint8Des(u8 *buffer, size_t length) { CsrWifiEventCsrUint8 *primitive = (CsrWifiEventCsrUint8 *) CsrPmemAlloc(sizeof(CsrWifiEventCsrUint8)); - CsrSize offset = 0; + size_t offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint8Des(&primitive->value, buffer, &offset); @@ -164,14 +164,14 @@ void* CsrWifiEventCsrUint8Des(u8 *buffer, CsrSize length) EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint8Des); -CsrSize CsrWifiEventCsrUint16Sizeof(void *msg) +size_t CsrWifiEventCsrUint16Sizeof(void *msg) { return 4; } EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16Sizeof); -u8* CsrWifiEventCsrUint16Ser(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiEventCsrUint16Ser(u8 *ptr, size_t *len, void *msg) { CsrWifiEventCsrUint16 *primitive = (CsrWifiEventCsrUint16 *)msg; *len = 0; @@ -181,11 +181,11 @@ u8* CsrWifiEventCsrUint16Ser(u8 *ptr, CsrSize *len, void *msg) } EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16Ser); -void* CsrWifiEventCsrUint16Des(u8 *buffer, CsrSize length) +void* CsrWifiEventCsrUint16Des(u8 *buffer, size_t length) { CsrWifiEventCsrUint16 *primitive = (CsrWifiEventCsrUint16 *) CsrPmemAlloc(sizeof(CsrWifiEventCsrUint16)); - CsrSize offset = 0; + size_t offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des(&primitive->value, buffer, &offset); @@ -194,13 +194,13 @@ void* CsrWifiEventCsrUint16Des(u8 *buffer, CsrSize length) EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16Des); -CsrSize CsrWifiEventCsrUint32Sizeof(void *msg) +size_t CsrWifiEventCsrUint32Sizeof(void *msg) { return 6; } EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint32Sizeof); -u8* CsrWifiEventCsrUint32Ser(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiEventCsrUint32Ser(u8 *ptr, size_t *len, void *msg) { CsrWifiEventCsrUint32 *primitive = (CsrWifiEventCsrUint32 *)msg; *len = 0; @@ -211,11 +211,11 @@ u8* CsrWifiEventCsrUint32Ser(u8 *ptr, CsrSize *len, void *msg) EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint32Ser); -void* CsrWifiEventCsrUint32Des(u8 *buffer, CsrSize length) +void* CsrWifiEventCsrUint32Des(u8 *buffer, size_t length) { CsrWifiEventCsrUint32 *primitive = (CsrWifiEventCsrUint32 *) CsrPmemAlloc(sizeof(CsrWifiEventCsrUint32)); - CsrSize offset = 0; + size_t offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint32Des(&primitive->value, buffer, &offset); @@ -223,13 +223,13 @@ void* CsrWifiEventCsrUint32Des(u8 *buffer, CsrSize length) } EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint32Des); -CsrSize CsrWifiEventCsrUint16CsrUint8Sizeof(void *msg) +size_t CsrWifiEventCsrUint16CsrUint8Sizeof(void *msg) { return 5; } EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16CsrUint8Sizeof); -u8* CsrWifiEventCsrUint16CsrUint8Ser(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiEventCsrUint16CsrUint8Ser(u8 *ptr, size_t *len, void *msg) { CsrWifiEventCsrUint16CsrUint8 *primitive = (CsrWifiEventCsrUint16CsrUint8 *)msg; *len = 0; @@ -241,11 +241,11 @@ u8* CsrWifiEventCsrUint16CsrUint8Ser(u8 *ptr, CsrSize *len, void *msg) EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16CsrUint8Ser); -void* CsrWifiEventCsrUint16CsrUint8Des(u8 *buffer, CsrSize length) +void* CsrWifiEventCsrUint16CsrUint8Des(u8 *buffer, size_t length) { CsrWifiEventCsrUint16CsrUint8 *primitive = (CsrWifiEventCsrUint16CsrUint8 *) CsrPmemAlloc(sizeof(CsrWifiEventCsrUint16CsrUint8)); - CsrSize offset = 0; + size_t offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); CsrUint16Des(&primitive->value16, buffer, &offset); CsrUint8Des(&primitive->value8, buffer, &offset); diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.c b/drivers/staging/csr/csr_wifi_sme_serialize.c index 472f9c0..514974b 100644 --- a/drivers/staging/csr/csr_wifi_sme_serialize.c +++ b/drivers/staging/csr/csr_wifi_sme_serialize.c @@ -24,9 +24,9 @@ void CsrWifiSmePfree(void *ptr) } -CsrSize CsrWifiSmeAdhocConfigSetReqSizeof(void *msg) +size_t CsrWifiSmeAdhocConfigSetReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ bufferSize += 2; /* u16 primitive->adHocConfig.atimWindowTu */ @@ -37,7 +37,7 @@ CsrSize CsrWifiSmeAdhocConfigSetReqSizeof(void *msg) } -u8* CsrWifiSmeAdhocConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeAdhocConfigSetReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeAdhocConfigSetReq *primitive = (CsrWifiSmeAdhocConfigSetReq *)msg; *len = 0; @@ -50,10 +50,10 @@ u8* CsrWifiSmeAdhocConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeAdhocConfigSetReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeAdhocConfigSetReqDes(u8 *buffer, size_t length) { CsrWifiSmeAdhocConfigSetReq *primitive = (CsrWifiSmeAdhocConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeAdhocConfigSetReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -66,10 +66,10 @@ void* CsrWifiSmeAdhocConfigSetReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeBlacklistReqSizeof(void *msg) +size_t CsrWifiSmeBlacklistReqSizeof(void *msg) { CsrWifiSmeBlacklistReq *primitive = (CsrWifiSmeBlacklistReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -86,7 +86,7 @@ CsrSize CsrWifiSmeBlacklistReqSizeof(void *msg) } -u8* CsrWifiSmeBlacklistReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeBlacklistReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeBlacklistReq *primitive = (CsrWifiSmeBlacklistReq *)msg; *len = 0; @@ -105,10 +105,10 @@ u8* CsrWifiSmeBlacklistReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeBlacklistReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeBlacklistReqDes(u8 *buffer, size_t length) { CsrWifiSmeBlacklistReq *primitive = (CsrWifiSmeBlacklistReq *) CsrPmemAlloc(sizeof(CsrWifiSmeBlacklistReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -140,10 +140,10 @@ void CsrWifiSmeBlacklistReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeCalibrationDataSetReqSizeof(void *msg) +size_t CsrWifiSmeCalibrationDataSetReqSizeof(void *msg) { CsrWifiSmeCalibrationDataSetReq *primitive = (CsrWifiSmeCalibrationDataSetReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */ bufferSize += 2; /* u16 primitive->calibrationDataLength */ @@ -152,7 +152,7 @@ CsrSize CsrWifiSmeCalibrationDataSetReqSizeof(void *msg) } -u8* CsrWifiSmeCalibrationDataSetReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeCalibrationDataSetReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeCalibrationDataSetReq *primitive = (CsrWifiSmeCalibrationDataSetReq *)msg; *len = 0; @@ -166,10 +166,10 @@ u8* CsrWifiSmeCalibrationDataSetReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeCalibrationDataSetReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeCalibrationDataSetReqDes(u8 *buffer, size_t length) { CsrWifiSmeCalibrationDataSetReq *primitive = (CsrWifiSmeCalibrationDataSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCalibrationDataSetReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -196,9 +196,9 @@ void CsrWifiSmeCalibrationDataSetReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeCcxConfigSetReqSizeof(void *msg) +size_t CsrWifiSmeCcxConfigSetReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -210,7 +210,7 @@ CsrSize CsrWifiSmeCcxConfigSetReqSizeof(void *msg) } -u8* CsrWifiSmeCcxConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeCcxConfigSetReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeCcxConfigSetReq *primitive = (CsrWifiSmeCcxConfigSetReq *)msg; *len = 0; @@ -224,10 +224,10 @@ u8* CsrWifiSmeCcxConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeCcxConfigSetReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeCcxConfigSetReqDes(u8 *buffer, size_t length) { CsrWifiSmeCcxConfigSetReq *primitive = (CsrWifiSmeCcxConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCcxConfigSetReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -241,9 +241,9 @@ void* CsrWifiSmeCcxConfigSetReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeCoexConfigSetReqSizeof(void *msg) +size_t CsrWifiSmeCoexConfigSetReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 29) */ bufferSize += 1; /* u8 primitive->coexConfig.coexEnableSchemeManagement */ @@ -264,7 +264,7 @@ CsrSize CsrWifiSmeCoexConfigSetReqSizeof(void *msg) } -u8* CsrWifiSmeCoexConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeCoexConfigSetReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeCoexConfigSetReq *primitive = (CsrWifiSmeCoexConfigSetReq *)msg; *len = 0; @@ -287,10 +287,10 @@ u8* CsrWifiSmeCoexConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeCoexConfigSetReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeCoexConfigSetReqDes(u8 *buffer, size_t length) { CsrWifiSmeCoexConfigSetReq *primitive = (CsrWifiSmeCoexConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexConfigSetReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -313,10 +313,10 @@ void* CsrWifiSmeCoexConfigSetReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeConnectReqSizeof(void *msg) +size_t CsrWifiSmeConnectReqSizeof(void *msg) { CsrWifiSmeConnectReq *primitive = (CsrWifiSmeConnectReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 57) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -337,7 +337,7 @@ CsrSize CsrWifiSmeConnectReqSizeof(void *msg) } -u8* CsrWifiSmeConnectReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeConnectReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeConnectReq *primitive = (CsrWifiSmeConnectReq *)msg; *len = 0; @@ -363,10 +363,10 @@ u8* CsrWifiSmeConnectReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeConnectReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeConnectReqDes(u8 *buffer, size_t length) { CsrWifiSmeConnectReq *primitive = (CsrWifiSmeConnectReq *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -405,9 +405,9 @@ void CsrWifiSmeConnectReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeHostConfigSetReqSizeof(void *msg) +size_t CsrWifiSmeHostConfigSetReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -417,7 +417,7 @@ CsrSize CsrWifiSmeHostConfigSetReqSizeof(void *msg) } -u8* CsrWifiSmeHostConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeHostConfigSetReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeHostConfigSetReq *primitive = (CsrWifiSmeHostConfigSetReq *)msg; *len = 0; @@ -429,10 +429,10 @@ u8* CsrWifiSmeHostConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeHostConfigSetReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeHostConfigSetReqDes(u8 *buffer, size_t length) { CsrWifiSmeHostConfigSetReq *primitive = (CsrWifiSmeHostConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeHostConfigSetReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -444,9 +444,9 @@ void* CsrWifiSmeHostConfigSetReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeKeyReqSizeof(void *msg) +size_t CsrWifiSmeKeyReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 65) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -469,7 +469,7 @@ CsrSize CsrWifiSmeKeyReqSizeof(void *msg) } -u8* CsrWifiSmeKeyReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeKeyReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeKeyReq *primitive = (CsrWifiSmeKeyReq *)msg; *len = 0; @@ -494,10 +494,10 @@ u8* CsrWifiSmeKeyReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeKeyReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeKeyReqDes(u8 *buffer, size_t length) { CsrWifiSmeKeyReq *primitive = (CsrWifiSmeKeyReq *) CsrPmemAlloc(sizeof(CsrWifiSmeKeyReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -522,9 +522,9 @@ void* CsrWifiSmeKeyReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeMibConfigSetReqSizeof(void *msg) +size_t CsrWifiSmeMibConfigSetReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ bufferSize += 1; /* u8 primitive->mibConfig.unifiFixMaxTxDataRate */ @@ -536,7 +536,7 @@ CsrSize CsrWifiSmeMibConfigSetReqSizeof(void *msg) } -u8* CsrWifiSmeMibConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeMibConfigSetReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeMibConfigSetReq *primitive = (CsrWifiSmeMibConfigSetReq *)msg; *len = 0; @@ -550,10 +550,10 @@ u8* CsrWifiSmeMibConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeMibConfigSetReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeMibConfigSetReqDes(u8 *buffer, size_t length) { CsrWifiSmeMibConfigSetReq *primitive = (CsrWifiSmeMibConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibConfigSetReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -567,10 +567,10 @@ void* CsrWifiSmeMibConfigSetReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeMibGetNextReqSizeof(void *msg) +size_t CsrWifiSmeMibGetNextReqSizeof(void *msg) { CsrWifiSmeMibGetNextReq *primitive = (CsrWifiSmeMibGetNextReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */ bufferSize += 2; /* u16 primitive->mibAttributeLength */ @@ -579,7 +579,7 @@ CsrSize CsrWifiSmeMibGetNextReqSizeof(void *msg) } -u8* CsrWifiSmeMibGetNextReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeMibGetNextReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeMibGetNextReq *primitive = (CsrWifiSmeMibGetNextReq *)msg; *len = 0; @@ -593,10 +593,10 @@ u8* CsrWifiSmeMibGetNextReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeMibGetNextReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeMibGetNextReqDes(u8 *buffer, size_t length) { CsrWifiSmeMibGetNextReq *primitive = (CsrWifiSmeMibGetNextReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetNextReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -623,10 +623,10 @@ void CsrWifiSmeMibGetNextReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeMibGetReqSizeof(void *msg) +size_t CsrWifiSmeMibGetReqSizeof(void *msg) { CsrWifiSmeMibGetReq *primitive = (CsrWifiSmeMibGetReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */ bufferSize += 2; /* u16 primitive->mibAttributeLength */ @@ -635,7 +635,7 @@ CsrSize CsrWifiSmeMibGetReqSizeof(void *msg) } -u8* CsrWifiSmeMibGetReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeMibGetReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeMibGetReq *primitive = (CsrWifiSmeMibGetReq *)msg; *len = 0; @@ -649,10 +649,10 @@ u8* CsrWifiSmeMibGetReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeMibGetReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeMibGetReqDes(u8 *buffer, size_t length) { CsrWifiSmeMibGetReq *primitive = (CsrWifiSmeMibGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -679,10 +679,10 @@ void CsrWifiSmeMibGetReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeMibSetReqSizeof(void *msg) +size_t CsrWifiSmeMibSetReqSizeof(void *msg) { CsrWifiSmeMibSetReq *primitive = (CsrWifiSmeMibSetReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */ bufferSize += 2; /* u16 primitive->mibAttributeLength */ @@ -691,7 +691,7 @@ CsrSize CsrWifiSmeMibSetReqSizeof(void *msg) } -u8* CsrWifiSmeMibSetReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeMibSetReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeMibSetReq *primitive = (CsrWifiSmeMibSetReq *)msg; *len = 0; @@ -705,10 +705,10 @@ u8* CsrWifiSmeMibSetReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeMibSetReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeMibSetReqDes(u8 *buffer, size_t length) { CsrWifiSmeMibSetReq *primitive = (CsrWifiSmeMibSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibSetReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -735,10 +735,10 @@ void CsrWifiSmeMibSetReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeMulticastAddressReqSizeof(void *msg) +size_t CsrWifiSmeMulticastAddressReqSizeof(void *msg) { CsrWifiSmeMulticastAddressReq *primitive = (CsrWifiSmeMulticastAddressReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -755,7 +755,7 @@ CsrSize CsrWifiSmeMulticastAddressReqSizeof(void *msg) } -u8* CsrWifiSmeMulticastAddressReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeMulticastAddressReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeMulticastAddressReq *primitive = (CsrWifiSmeMulticastAddressReq *)msg; *len = 0; @@ -774,10 +774,10 @@ u8* CsrWifiSmeMulticastAddressReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeMulticastAddressReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeMulticastAddressReqDes(u8 *buffer, size_t length) { CsrWifiSmeMulticastAddressReq *primitive = (CsrWifiSmeMulticastAddressReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMulticastAddressReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -809,10 +809,10 @@ void CsrWifiSmeMulticastAddressReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmePacketFilterSetReqSizeof(void *msg) +size_t CsrWifiSmePacketFilterSetReqSizeof(void *msg) { CsrWifiSmePacketFilterSetReq *primitive = (CsrWifiSmePacketFilterSetReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -824,7 +824,7 @@ CsrSize CsrWifiSmePacketFilterSetReqSizeof(void *msg) } -u8* CsrWifiSmePacketFilterSetReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmePacketFilterSetReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmePacketFilterSetReq *primitive = (CsrWifiSmePacketFilterSetReq *)msg; *len = 0; @@ -841,10 +841,10 @@ u8* CsrWifiSmePacketFilterSetReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmePacketFilterSetReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmePacketFilterSetReqDes(u8 *buffer, size_t length) { CsrWifiSmePacketFilterSetReq *primitive = (CsrWifiSmePacketFilterSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmePacketFilterSetReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -874,10 +874,10 @@ void CsrWifiSmePacketFilterSetReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmePmkidReqSizeof(void *msg) +size_t CsrWifiSmePmkidReqSizeof(void *msg) { CsrWifiSmePmkidReq *primitive = (CsrWifiSmePmkidReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 29) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -895,7 +895,7 @@ CsrSize CsrWifiSmePmkidReqSizeof(void *msg) } -u8* CsrWifiSmePmkidReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmePmkidReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmePmkidReq *primitive = (CsrWifiSmePmkidReq *)msg; *len = 0; @@ -915,10 +915,10 @@ u8* CsrWifiSmePmkidReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmePmkidReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmePmkidReqDes(u8 *buffer, size_t length) { CsrWifiSmePmkidReq *primitive = (CsrWifiSmePmkidReq *) CsrPmemAlloc(sizeof(CsrWifiSmePmkidReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -951,9 +951,9 @@ void CsrWifiSmePmkidReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmePowerConfigSetReqSizeof(void *msg) +size_t CsrWifiSmePowerConfigSetReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ bufferSize += 1; /* CsrWifiSmePowerSaveLevel primitive->powerConfig.powerSaveLevel */ @@ -967,7 +967,7 @@ CsrSize CsrWifiSmePowerConfigSetReqSizeof(void *msg) } -u8* CsrWifiSmePowerConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmePowerConfigSetReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmePowerConfigSetReq *primitive = (CsrWifiSmePowerConfigSetReq *)msg; *len = 0; @@ -983,10 +983,10 @@ u8* CsrWifiSmePowerConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmePowerConfigSetReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmePowerConfigSetReqDes(u8 *buffer, size_t length) { CsrWifiSmePowerConfigSetReq *primitive = (CsrWifiSmePowerConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmePowerConfigSetReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1002,9 +1002,9 @@ void* CsrWifiSmePowerConfigSetReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeRoamingConfigSetReqSizeof(void *msg) +size_t CsrWifiSmeRoamingConfigSetReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 70) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -1038,7 +1038,7 @@ CsrSize CsrWifiSmeRoamingConfigSetReqSizeof(void *msg) } -u8* CsrWifiSmeRoamingConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeRoamingConfigSetReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeRoamingConfigSetReq *primitive = (CsrWifiSmeRoamingConfigSetReq *)msg; *len = 0; @@ -1074,10 +1074,10 @@ u8* CsrWifiSmeRoamingConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeRoamingConfigSetReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeRoamingConfigSetReqDes(u8 *buffer, size_t length) { CsrWifiSmeRoamingConfigSetReq *primitive = (CsrWifiSmeRoamingConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamingConfigSetReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1113,10 +1113,10 @@ void* CsrWifiSmeRoamingConfigSetReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeScanConfigSetReqSizeof(void *msg) +size_t CsrWifiSmeScanConfigSetReqSizeof(void *msg) { CsrWifiSmeScanConfigSetReq *primitive = (CsrWifiSmeScanConfigSetReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 63) */ { @@ -1145,7 +1145,7 @@ CsrSize CsrWifiSmeScanConfigSetReqSizeof(void *msg) } -u8* CsrWifiSmeScanConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeScanConfigSetReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeScanConfigSetReq *primitive = (CsrWifiSmeScanConfigSetReq *)msg; *len = 0; @@ -1179,10 +1179,10 @@ u8* CsrWifiSmeScanConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeScanConfigSetReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeScanConfigSetReqDes(u8 *buffer, size_t length) { CsrWifiSmeScanConfigSetReq *primitive = (CsrWifiSmeScanConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeScanConfigSetReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1229,10 +1229,10 @@ void CsrWifiSmeScanConfigSetReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeScanFullReqSizeof(void *msg) +size_t CsrWifiSmeScanFullReqSizeof(void *msg) { CsrWifiSmeScanFullReq *primitive = (CsrWifiSmeScanFullReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 52) */ bufferSize += 1; /* u8 primitive->ssidCount */ @@ -1256,7 +1256,7 @@ CsrSize CsrWifiSmeScanFullReqSizeof(void *msg) } -u8* CsrWifiSmeScanFullReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeScanFullReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeScanFullReq *primitive = (CsrWifiSmeScanFullReq *)msg; *len = 0; @@ -1288,10 +1288,10 @@ u8* CsrWifiSmeScanFullReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeScanFullReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeScanFullReqDes(u8 *buffer, size_t length) { CsrWifiSmeScanFullReq *primitive = (CsrWifiSmeScanFullReq *) CsrPmemAlloc(sizeof(CsrWifiSmeScanFullReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1348,9 +1348,9 @@ void CsrWifiSmeScanFullReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeSmeStaConfigSetReqSizeof(void *msg) +size_t CsrWifiSmeSmeStaConfigSetReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -1364,7 +1364,7 @@ CsrSize CsrWifiSmeSmeStaConfigSetReqSizeof(void *msg) } -u8* CsrWifiSmeSmeStaConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeSmeStaConfigSetReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeSmeStaConfigSetReq *primitive = (CsrWifiSmeSmeStaConfigSetReq *)msg; *len = 0; @@ -1380,10 +1380,10 @@ u8* CsrWifiSmeSmeStaConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeSmeStaConfigSetReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeSmeStaConfigSetReqDes(u8 *buffer, size_t length) { CsrWifiSmeSmeStaConfigSetReq *primitive = (CsrWifiSmeSmeStaConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeStaConfigSetReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1399,10 +1399,10 @@ void* CsrWifiSmeSmeStaConfigSetReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeTspecReqSizeof(void *msg) +size_t CsrWifiSmeTspecReqSizeof(void *msg) { CsrWifiSmeTspecReq *primitive = (CsrWifiSmeTspecReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 18) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -1418,7 +1418,7 @@ CsrSize CsrWifiSmeTspecReqSizeof(void *msg) } -u8* CsrWifiSmeTspecReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeTspecReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeTspecReq *primitive = (CsrWifiSmeTspecReq *)msg; *len = 0; @@ -1442,10 +1442,10 @@ u8* CsrWifiSmeTspecReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeTspecReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeTspecReqDes(u8 *buffer, size_t length) { CsrWifiSmeTspecReq *primitive = (CsrWifiSmeTspecReq *) CsrPmemAlloc(sizeof(CsrWifiSmeTspecReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1488,10 +1488,10 @@ void CsrWifiSmeTspecReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeWifiFlightmodeReqSizeof(void *msg) +size_t CsrWifiSmeWifiFlightmodeReqSizeof(void *msg) { CsrWifiSmeWifiFlightmodeReq *primitive = (CsrWifiSmeWifiFlightmodeReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */ bufferSize += 6; /* u8 primitive->address.a[6] */ @@ -1508,7 +1508,7 @@ CsrSize CsrWifiSmeWifiFlightmodeReqSizeof(void *msg) } -u8* CsrWifiSmeWifiFlightmodeReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeWifiFlightmodeReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeWifiFlightmodeReq *primitive = (CsrWifiSmeWifiFlightmodeReq *)msg; *len = 0; @@ -1530,10 +1530,10 @@ u8* CsrWifiSmeWifiFlightmodeReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeWifiFlightmodeReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeWifiFlightmodeReqDes(u8 *buffer, size_t length) { CsrWifiSmeWifiFlightmodeReq *primitive = (CsrWifiSmeWifiFlightmodeReq *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiFlightmodeReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1580,10 +1580,10 @@ void CsrWifiSmeWifiFlightmodeReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeWifiOnReqSizeof(void *msg) +size_t CsrWifiSmeWifiOnReqSizeof(void *msg) { CsrWifiSmeWifiOnReq *primitive = (CsrWifiSmeWifiOnReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */ bufferSize += 6; /* u8 primitive->address.a[6] */ @@ -1600,7 +1600,7 @@ CsrSize CsrWifiSmeWifiOnReqSizeof(void *msg) } -u8* CsrWifiSmeWifiOnReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeWifiOnReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeWifiOnReq *primitive = (CsrWifiSmeWifiOnReq *)msg; *len = 0; @@ -1622,10 +1622,10 @@ u8* CsrWifiSmeWifiOnReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeWifiOnReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeWifiOnReqDes(u8 *buffer, size_t length) { CsrWifiSmeWifiOnReq *primitive = (CsrWifiSmeWifiOnReq *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiOnReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1672,10 +1672,10 @@ void CsrWifiSmeWifiOnReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeCloakedSsidsSetReqSizeof(void *msg) +size_t CsrWifiSmeCloakedSsidsSetReqSizeof(void *msg) { CsrWifiSmeCloakedSsidsSetReq *primitive = (CsrWifiSmeCloakedSsidsSetReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 37) */ bufferSize += 1; /* u8 primitive->cloakedSsids.cloakedSsidsCount */ @@ -1691,7 +1691,7 @@ CsrSize CsrWifiSmeCloakedSsidsSetReqSizeof(void *msg) } -u8* CsrWifiSmeCloakedSsidsSetReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeCloakedSsidsSetReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeCloakedSsidsSetReq *primitive = (CsrWifiSmeCloakedSsidsSetReq *)msg; *len = 0; @@ -1709,10 +1709,10 @@ u8* CsrWifiSmeCloakedSsidsSetReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeCloakedSsidsSetReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeCloakedSsidsSetReqDes(u8 *buffer, size_t length) { CsrWifiSmeCloakedSsidsSetReq *primitive = (CsrWifiSmeCloakedSsidsSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCloakedSsidsSetReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1743,9 +1743,9 @@ void CsrWifiSmeCloakedSsidsSetReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeSmeCommonConfigSetReqSizeof(void *msg) +size_t CsrWifiSmeSmeCommonConfigSetReqSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 1; /* CsrWifiSme80211dTrustLevel primitive->deviceConfig.trustLevel */ @@ -1756,7 +1756,7 @@ CsrSize CsrWifiSmeSmeCommonConfigSetReqSizeof(void *msg) } -u8* CsrWifiSmeSmeCommonConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeSmeCommonConfigSetReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeSmeCommonConfigSetReq *primitive = (CsrWifiSmeSmeCommonConfigSetReq *)msg; *len = 0; @@ -1769,10 +1769,10 @@ u8* CsrWifiSmeSmeCommonConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeSmeCommonConfigSetReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeSmeCommonConfigSetReqDes(u8 *buffer, size_t length) { CsrWifiSmeSmeCommonConfigSetReq *primitive = (CsrWifiSmeSmeCommonConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeCommonConfigSetReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1785,10 +1785,10 @@ void* CsrWifiSmeSmeCommonConfigSetReqDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeWpsConfigurationReqSizeof(void *msg) +size_t CsrWifiSmeWpsConfigurationReqSizeof(void *msg) { CsrWifiSmeWpsConfigurationReq *primitive = (CsrWifiSmeWpsConfigurationReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 240) */ bufferSize += 1; /* u8 primitive->wpsConfig.wpsVersion */ @@ -1818,7 +1818,7 @@ CsrSize CsrWifiSmeWpsConfigurationReqSizeof(void *msg) } -u8* CsrWifiSmeWpsConfigurationReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeWpsConfigurationReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeWpsConfigurationReq *primitive = (CsrWifiSmeWpsConfigurationReq *)msg; *len = 0; @@ -1850,10 +1850,10 @@ u8* CsrWifiSmeWpsConfigurationReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeWpsConfigurationReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeWpsConfigurationReqDes(u8 *buffer, size_t length) { CsrWifiSmeWpsConfigurationReq *primitive = (CsrWifiSmeWpsConfigurationReq *) CsrPmemAlloc(sizeof(CsrWifiSmeWpsConfigurationReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1898,10 +1898,10 @@ void CsrWifiSmeWpsConfigurationReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeSetReqSizeof(void *msg) +size_t CsrWifiSmeSetReqSizeof(void *msg) { CsrWifiSmeSetReq *primitive = (CsrWifiSmeSetReq *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 4; /* u32 primitive->dataLength */ @@ -1910,7 +1910,7 @@ CsrSize CsrWifiSmeSetReqSizeof(void *msg) } -u8* CsrWifiSmeSetReqSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeSetReqSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeSetReq *primitive = (CsrWifiSmeSetReq *)msg; *len = 0; @@ -1924,10 +1924,10 @@ u8* CsrWifiSmeSetReqSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeSetReqDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeSetReqDes(u8 *buffer, size_t length) { CsrWifiSmeSetReq *primitive = (CsrWifiSmeSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeSetReq)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1954,9 +1954,9 @@ void CsrWifiSmeSetReqSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeAdhocConfigGetCfmSizeof(void *msg) +size_t CsrWifiSmeAdhocConfigGetCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* CsrResult primitive->status */ @@ -1968,7 +1968,7 @@ CsrSize CsrWifiSmeAdhocConfigGetCfmSizeof(void *msg) } -u8* CsrWifiSmeAdhocConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeAdhocConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeAdhocConfigGetCfm *primitive = (CsrWifiSmeAdhocConfigGetCfm *)msg; *len = 0; @@ -1982,10 +1982,10 @@ u8* CsrWifiSmeAdhocConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeAdhocConfigGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeAdhocConfigGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeAdhocConfigGetCfm *primitive = (CsrWifiSmeAdhocConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeAdhocConfigGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -1999,10 +1999,10 @@ void* CsrWifiSmeAdhocConfigGetCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeAssociationCompleteIndSizeof(void *msg) +size_t CsrWifiSmeAssociationCompleteIndSizeof(void *msg) { CsrWifiSmeAssociationCompleteInd *primitive = (CsrWifiSmeAssociationCompleteInd *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 98) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -2043,7 +2043,7 @@ CsrSize CsrWifiSmeAssociationCompleteIndSizeof(void *msg) } -u8* CsrWifiSmeAssociationCompleteIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeAssociationCompleteIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeAssociationCompleteInd *primitive = (CsrWifiSmeAssociationCompleteInd *)msg; *len = 0; @@ -2104,10 +2104,10 @@ u8* CsrWifiSmeAssociationCompleteIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeAssociationCompleteIndDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeAssociationCompleteIndDes(u8 *buffer, size_t length) { CsrWifiSmeAssociationCompleteInd *primitive = (CsrWifiSmeAssociationCompleteInd *) CsrPmemAlloc(sizeof(CsrWifiSmeAssociationCompleteInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2211,9 +2211,9 @@ void CsrWifiSmeAssociationCompleteIndSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeAssociationStartIndSizeof(void *msg) +size_t CsrWifiSmeAssociationStartIndSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 44) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -2224,7 +2224,7 @@ CsrSize CsrWifiSmeAssociationStartIndSizeof(void *msg) } -u8* CsrWifiSmeAssociationStartIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeAssociationStartIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeAssociationStartInd *primitive = (CsrWifiSmeAssociationStartInd *)msg; *len = 0; @@ -2237,10 +2237,10 @@ u8* CsrWifiSmeAssociationStartIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeAssociationStartIndDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeAssociationStartIndDes(u8 *buffer, size_t length) { CsrWifiSmeAssociationStartInd *primitive = (CsrWifiSmeAssociationStartInd *) CsrPmemAlloc(sizeof(CsrWifiSmeAssociationStartInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2253,10 +2253,10 @@ void* CsrWifiSmeAssociationStartIndDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeBlacklistCfmSizeof(void *msg) +size_t CsrWifiSmeBlacklistCfmSizeof(void *msg) { CsrWifiSmeBlacklistCfm *primitive = (CsrWifiSmeBlacklistCfm *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -2274,7 +2274,7 @@ CsrSize CsrWifiSmeBlacklistCfmSizeof(void *msg) } -u8* CsrWifiSmeBlacklistCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeBlacklistCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeBlacklistCfm *primitive = (CsrWifiSmeBlacklistCfm *)msg; *len = 0; @@ -2294,10 +2294,10 @@ u8* CsrWifiSmeBlacklistCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeBlacklistCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeBlacklistCfmDes(u8 *buffer, size_t length) { CsrWifiSmeBlacklistCfm *primitive = (CsrWifiSmeBlacklistCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeBlacklistCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2330,10 +2330,10 @@ void CsrWifiSmeBlacklistCfmSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeCalibrationDataGetCfmSizeof(void *msg) +size_t CsrWifiSmeCalibrationDataGetCfmSizeof(void *msg) { CsrWifiSmeCalibrationDataGetCfm *primitive = (CsrWifiSmeCalibrationDataGetCfm *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 2; /* CsrResult primitive->status */ @@ -2343,7 +2343,7 @@ CsrSize CsrWifiSmeCalibrationDataGetCfmSizeof(void *msg) } -u8* CsrWifiSmeCalibrationDataGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeCalibrationDataGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeCalibrationDataGetCfm *primitive = (CsrWifiSmeCalibrationDataGetCfm *)msg; *len = 0; @@ -2358,10 +2358,10 @@ u8* CsrWifiSmeCalibrationDataGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeCalibrationDataGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeCalibrationDataGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeCalibrationDataGetCfm *primitive = (CsrWifiSmeCalibrationDataGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCalibrationDataGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2389,9 +2389,9 @@ void CsrWifiSmeCalibrationDataGetCfmSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeCcxConfigGetCfmSizeof(void *msg) +size_t CsrWifiSmeCcxConfigGetCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -2404,7 +2404,7 @@ CsrSize CsrWifiSmeCcxConfigGetCfmSizeof(void *msg) } -u8* CsrWifiSmeCcxConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeCcxConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeCcxConfigGetCfm *primitive = (CsrWifiSmeCcxConfigGetCfm *)msg; *len = 0; @@ -2419,10 +2419,10 @@ u8* CsrWifiSmeCcxConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeCcxConfigGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeCcxConfigGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeCcxConfigGetCfm *primitive = (CsrWifiSmeCcxConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCcxConfigGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2437,9 +2437,9 @@ void* CsrWifiSmeCcxConfigGetCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeCcxConfigSetCfmSizeof(void *msg) +size_t CsrWifiSmeCcxConfigSetCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -2448,7 +2448,7 @@ CsrSize CsrWifiSmeCcxConfigSetCfmSizeof(void *msg) } -u8* CsrWifiSmeCcxConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeCcxConfigSetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeCcxConfigSetCfm *primitive = (CsrWifiSmeCcxConfigSetCfm *)msg; *len = 0; @@ -2459,10 +2459,10 @@ u8* CsrWifiSmeCcxConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeCcxConfigSetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeCcxConfigSetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeCcxConfigSetCfm *primitive = (CsrWifiSmeCcxConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCcxConfigSetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2473,9 +2473,9 @@ void* CsrWifiSmeCcxConfigSetCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeCoexConfigGetCfmSizeof(void *msg) +size_t CsrWifiSmeCoexConfigGetCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 31) */ bufferSize += 2; /* CsrResult primitive->status */ @@ -2497,7 +2497,7 @@ CsrSize CsrWifiSmeCoexConfigGetCfmSizeof(void *msg) } -u8* CsrWifiSmeCoexConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeCoexConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeCoexConfigGetCfm *primitive = (CsrWifiSmeCoexConfigGetCfm *)msg; *len = 0; @@ -2521,10 +2521,10 @@ u8* CsrWifiSmeCoexConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeCoexConfigGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeCoexConfigGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeCoexConfigGetCfm *primitive = (CsrWifiSmeCoexConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexConfigGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2548,9 +2548,9 @@ void* CsrWifiSmeCoexConfigGetCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeCoexInfoGetCfmSizeof(void *msg) +size_t CsrWifiSmeCoexInfoGetCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 24) */ bufferSize += 2; /* CsrResult primitive->status */ @@ -2568,7 +2568,7 @@ CsrSize CsrWifiSmeCoexInfoGetCfmSizeof(void *msg) } -u8* CsrWifiSmeCoexInfoGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeCoexInfoGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeCoexInfoGetCfm *primitive = (CsrWifiSmeCoexInfoGetCfm *)msg; *len = 0; @@ -2588,10 +2588,10 @@ u8* CsrWifiSmeCoexInfoGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeCoexInfoGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeCoexInfoGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeCoexInfoGetCfm *primitive = (CsrWifiSmeCoexInfoGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexInfoGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2611,9 +2611,9 @@ void* CsrWifiSmeCoexInfoGetCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeConnectCfmSizeof(void *msg) +size_t CsrWifiSmeConnectCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -2622,7 +2622,7 @@ CsrSize CsrWifiSmeConnectCfmSizeof(void *msg) } -u8* CsrWifiSmeConnectCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeConnectCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeConnectCfm *primitive = (CsrWifiSmeConnectCfm *)msg; *len = 0; @@ -2633,10 +2633,10 @@ u8* CsrWifiSmeConnectCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeConnectCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeConnectCfmDes(u8 *buffer, size_t length) { CsrWifiSmeConnectCfm *primitive = (CsrWifiSmeConnectCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2647,10 +2647,10 @@ void* CsrWifiSmeConnectCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeConnectionConfigGetCfmSizeof(void *msg) +size_t CsrWifiSmeConnectionConfigGetCfmSizeof(void *msg) { CsrWifiSmeConnectionConfigGetCfm *primitive = (CsrWifiSmeConnectionConfigGetCfm *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 59) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -2672,7 +2672,7 @@ CsrSize CsrWifiSmeConnectionConfigGetCfmSizeof(void *msg) } -u8* CsrWifiSmeConnectionConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeConnectionConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeConnectionConfigGetCfm *primitive = (CsrWifiSmeConnectionConfigGetCfm *)msg; *len = 0; @@ -2699,10 +2699,10 @@ u8* CsrWifiSmeConnectionConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeConnectionConfigGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeConnectionConfigGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeConnectionConfigGetCfm *primitive = (CsrWifiSmeConnectionConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionConfigGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2742,10 +2742,10 @@ void CsrWifiSmeConnectionConfigGetCfmSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeConnectionInfoGetCfmSizeof(void *msg) +size_t CsrWifiSmeConnectionInfoGetCfmSizeof(void *msg) { CsrWifiSmeConnectionInfoGetCfm *primitive = (CsrWifiSmeConnectionInfoGetCfm *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 96) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -2785,7 +2785,7 @@ CsrSize CsrWifiSmeConnectionInfoGetCfmSizeof(void *msg) } -u8* CsrWifiSmeConnectionInfoGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeConnectionInfoGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeConnectionInfoGetCfm *primitive = (CsrWifiSmeConnectionInfoGetCfm *)msg; *len = 0; @@ -2845,10 +2845,10 @@ u8* CsrWifiSmeConnectionInfoGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeConnectionInfoGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeConnectionInfoGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeConnectionInfoGetCfm *primitive = (CsrWifiSmeConnectionInfoGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionInfoGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2951,9 +2951,9 @@ void CsrWifiSmeConnectionInfoGetCfmSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeConnectionQualityIndSizeof(void *msg) +size_t CsrWifiSmeConnectionQualityIndSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -2963,7 +2963,7 @@ CsrSize CsrWifiSmeConnectionQualityIndSizeof(void *msg) } -u8* CsrWifiSmeConnectionQualityIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeConnectionQualityIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeConnectionQualityInd *primitive = (CsrWifiSmeConnectionQualityInd *)msg; *len = 0; @@ -2975,10 +2975,10 @@ u8* CsrWifiSmeConnectionQualityIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeConnectionQualityIndDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeConnectionQualityIndDes(u8 *buffer, size_t length) { CsrWifiSmeConnectionQualityInd *primitive = (CsrWifiSmeConnectionQualityInd *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionQualityInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -2990,9 +2990,9 @@ void* CsrWifiSmeConnectionQualityIndDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeConnectionStatsGetCfmSizeof(void *msg) +size_t CsrWifiSmeConnectionStatsGetCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 101) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -3026,7 +3026,7 @@ CsrSize CsrWifiSmeConnectionStatsGetCfmSizeof(void *msg) } -u8* CsrWifiSmeConnectionStatsGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeConnectionStatsGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeConnectionStatsGetCfm *primitive = (CsrWifiSmeConnectionStatsGetCfm *)msg; *len = 0; @@ -3062,10 +3062,10 @@ u8* CsrWifiSmeConnectionStatsGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeConnectionStatsGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeConnectionStatsGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeConnectionStatsGetCfm *primitive = (CsrWifiSmeConnectionStatsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionStatsGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -3101,9 +3101,9 @@ void* CsrWifiSmeConnectionStatsGetCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeDisconnectCfmSizeof(void *msg) +size_t CsrWifiSmeDisconnectCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -3112,7 +3112,7 @@ CsrSize CsrWifiSmeDisconnectCfmSizeof(void *msg) } -u8* CsrWifiSmeDisconnectCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeDisconnectCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeDisconnectCfm *primitive = (CsrWifiSmeDisconnectCfm *)msg; *len = 0; @@ -3123,10 +3123,10 @@ u8* CsrWifiSmeDisconnectCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeDisconnectCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeDisconnectCfmDes(u8 *buffer, size_t length) { CsrWifiSmeDisconnectCfm *primitive = (CsrWifiSmeDisconnectCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeDisconnectCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -3137,9 +3137,9 @@ void* CsrWifiSmeDisconnectCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeHostConfigGetCfmSizeof(void *msg) +size_t CsrWifiSmeHostConfigGetCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -3150,7 +3150,7 @@ CsrSize CsrWifiSmeHostConfigGetCfmSizeof(void *msg) } -u8* CsrWifiSmeHostConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeHostConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeHostConfigGetCfm *primitive = (CsrWifiSmeHostConfigGetCfm *)msg; *len = 0; @@ -3163,10 +3163,10 @@ u8* CsrWifiSmeHostConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeHostConfigGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeHostConfigGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeHostConfigGetCfm *primitive = (CsrWifiSmeHostConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeHostConfigGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -3179,9 +3179,9 @@ void* CsrWifiSmeHostConfigGetCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeHostConfigSetCfmSizeof(void *msg) +size_t CsrWifiSmeHostConfigSetCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -3190,7 +3190,7 @@ CsrSize CsrWifiSmeHostConfigSetCfmSizeof(void *msg) } -u8* CsrWifiSmeHostConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeHostConfigSetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeHostConfigSetCfm *primitive = (CsrWifiSmeHostConfigSetCfm *)msg; *len = 0; @@ -3201,10 +3201,10 @@ u8* CsrWifiSmeHostConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeHostConfigSetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeHostConfigSetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeHostConfigSetCfm *primitive = (CsrWifiSmeHostConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeHostConfigSetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -3215,9 +3215,9 @@ void* CsrWifiSmeHostConfigSetCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeIbssStationIndSizeof(void *msg) +size_t CsrWifiSmeIbssStationIndSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ bufferSize += 6; /* u8 primitive->address.a[6] */ @@ -3226,7 +3226,7 @@ CsrSize CsrWifiSmeIbssStationIndSizeof(void *msg) } -u8* CsrWifiSmeIbssStationIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeIbssStationIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeIbssStationInd *primitive = (CsrWifiSmeIbssStationInd *)msg; *len = 0; @@ -3237,10 +3237,10 @@ u8* CsrWifiSmeIbssStationIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeIbssStationIndDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeIbssStationIndDes(u8 *buffer, size_t length) { CsrWifiSmeIbssStationInd *primitive = (CsrWifiSmeIbssStationInd *) CsrPmemAlloc(sizeof(CsrWifiSmeIbssStationInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -3251,9 +3251,9 @@ void* CsrWifiSmeIbssStationIndDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeKeyCfmSizeof(void *msg) +size_t CsrWifiSmeKeyCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -3265,7 +3265,7 @@ CsrSize CsrWifiSmeKeyCfmSizeof(void *msg) } -u8* CsrWifiSmeKeyCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeKeyCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeKeyCfm *primitive = (CsrWifiSmeKeyCfm *)msg; *len = 0; @@ -3279,10 +3279,10 @@ u8* CsrWifiSmeKeyCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeKeyCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeKeyCfmDes(u8 *buffer, size_t length) { CsrWifiSmeKeyCfm *primitive = (CsrWifiSmeKeyCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeKeyCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -3296,9 +3296,9 @@ void* CsrWifiSmeKeyCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeLinkQualityGetCfmSizeof(void *msg) +size_t CsrWifiSmeLinkQualityGetCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -3309,7 +3309,7 @@ CsrSize CsrWifiSmeLinkQualityGetCfmSizeof(void *msg) } -u8* CsrWifiSmeLinkQualityGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeLinkQualityGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeLinkQualityGetCfm *primitive = (CsrWifiSmeLinkQualityGetCfm *)msg; *len = 0; @@ -3322,10 +3322,10 @@ u8* CsrWifiSmeLinkQualityGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeLinkQualityGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeLinkQualityGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeLinkQualityGetCfm *primitive = (CsrWifiSmeLinkQualityGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeLinkQualityGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -3338,10 +3338,10 @@ void* CsrWifiSmeLinkQualityGetCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeMediaStatusIndSizeof(void *msg) +size_t CsrWifiSmeMediaStatusIndSizeof(void *msg) { CsrWifiSmeMediaStatusInd *primitive = (CsrWifiSmeMediaStatusInd *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 99) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -3383,7 +3383,7 @@ CsrSize CsrWifiSmeMediaStatusIndSizeof(void *msg) } -u8* CsrWifiSmeMediaStatusIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeMediaStatusIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeMediaStatusInd *primitive = (CsrWifiSmeMediaStatusInd *)msg; *len = 0; @@ -3445,10 +3445,10 @@ u8* CsrWifiSmeMediaStatusIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeMediaStatusIndDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeMediaStatusIndDes(u8 *buffer, size_t length) { CsrWifiSmeMediaStatusInd *primitive = (CsrWifiSmeMediaStatusInd *) CsrPmemAlloc(sizeof(CsrWifiSmeMediaStatusInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -3553,9 +3553,9 @@ void CsrWifiSmeMediaStatusIndSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeMibConfigGetCfmSizeof(void *msg) +size_t CsrWifiSmeMibConfigGetCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* CsrResult primitive->status */ @@ -3568,7 +3568,7 @@ CsrSize CsrWifiSmeMibConfigGetCfmSizeof(void *msg) } -u8* CsrWifiSmeMibConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeMibConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeMibConfigGetCfm *primitive = (CsrWifiSmeMibConfigGetCfm *)msg; *len = 0; @@ -3583,10 +3583,10 @@ u8* CsrWifiSmeMibConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeMibConfigGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeMibConfigGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeMibConfigGetCfm *primitive = (CsrWifiSmeMibConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMibConfigGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -3601,10 +3601,10 @@ void* CsrWifiSmeMibConfigGetCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeMibGetCfmSizeof(void *msg) +size_t CsrWifiSmeMibGetCfmSizeof(void *msg) { CsrWifiSmeMibGetCfm *primitive = (CsrWifiSmeMibGetCfm *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 2; /* CsrResult primitive->status */ @@ -3614,7 +3614,7 @@ CsrSize CsrWifiSmeMibGetCfmSizeof(void *msg) } -u8* CsrWifiSmeMibGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeMibGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeMibGetCfm *primitive = (CsrWifiSmeMibGetCfm *)msg; *len = 0; @@ -3629,10 +3629,10 @@ u8* CsrWifiSmeMibGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeMibGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeMibGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeMibGetCfm *primitive = (CsrWifiSmeMibGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -3660,10 +3660,10 @@ void CsrWifiSmeMibGetCfmSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeMibGetNextCfmSizeof(void *msg) +size_t CsrWifiSmeMibGetNextCfmSizeof(void *msg) { CsrWifiSmeMibGetNextCfm *primitive = (CsrWifiSmeMibGetNextCfm *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 2; /* CsrResult primitive->status */ @@ -3673,7 +3673,7 @@ CsrSize CsrWifiSmeMibGetNextCfmSizeof(void *msg) } -u8* CsrWifiSmeMibGetNextCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeMibGetNextCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeMibGetNextCfm *primitive = (CsrWifiSmeMibGetNextCfm *)msg; *len = 0; @@ -3688,10 +3688,10 @@ u8* CsrWifiSmeMibGetNextCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeMibGetNextCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeMibGetNextCfmDes(u8 *buffer, size_t length) { CsrWifiSmeMibGetNextCfm *primitive = (CsrWifiSmeMibGetNextCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetNextCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -3719,9 +3719,9 @@ void CsrWifiSmeMibGetNextCfmSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeMicFailureIndSizeof(void *msg) +size_t CsrWifiSmeMicFailureIndSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -3733,7 +3733,7 @@ CsrSize CsrWifiSmeMicFailureIndSizeof(void *msg) } -u8* CsrWifiSmeMicFailureIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeMicFailureIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeMicFailureInd *primitive = (CsrWifiSmeMicFailureInd *)msg; *len = 0; @@ -3747,10 +3747,10 @@ u8* CsrWifiSmeMicFailureIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeMicFailureIndDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeMicFailureIndDes(u8 *buffer, size_t length) { CsrWifiSmeMicFailureInd *primitive = (CsrWifiSmeMicFailureInd *) CsrPmemAlloc(sizeof(CsrWifiSmeMicFailureInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -3764,10 +3764,10 @@ void* CsrWifiSmeMicFailureIndDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeMulticastAddressCfmSizeof(void *msg) +size_t CsrWifiSmeMulticastAddressCfmSizeof(void *msg) { CsrWifiSmeMulticastAddressCfm *primitive = (CsrWifiSmeMulticastAddressCfm *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -3785,7 +3785,7 @@ CsrSize CsrWifiSmeMulticastAddressCfmSizeof(void *msg) } -u8* CsrWifiSmeMulticastAddressCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeMulticastAddressCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeMulticastAddressCfm *primitive = (CsrWifiSmeMulticastAddressCfm *)msg; *len = 0; @@ -3805,10 +3805,10 @@ u8* CsrWifiSmeMulticastAddressCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeMulticastAddressCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeMulticastAddressCfmDes(u8 *buffer, size_t length) { CsrWifiSmeMulticastAddressCfm *primitive = (CsrWifiSmeMulticastAddressCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMulticastAddressCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -3841,9 +3841,9 @@ void CsrWifiSmeMulticastAddressCfmSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmePacketFilterSetCfmSizeof(void *msg) +size_t CsrWifiSmePacketFilterSetCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -3852,7 +3852,7 @@ CsrSize CsrWifiSmePacketFilterSetCfmSizeof(void *msg) } -u8* CsrWifiSmePacketFilterSetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmePacketFilterSetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmePacketFilterSetCfm *primitive = (CsrWifiSmePacketFilterSetCfm *)msg; *len = 0; @@ -3863,10 +3863,10 @@ u8* CsrWifiSmePacketFilterSetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmePacketFilterSetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmePacketFilterSetCfmDes(u8 *buffer, size_t length) { CsrWifiSmePacketFilterSetCfm *primitive = (CsrWifiSmePacketFilterSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePacketFilterSetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -3877,9 +3877,9 @@ void* CsrWifiSmePacketFilterSetCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmePermanentMacAddressGetCfmSizeof(void *msg) +size_t CsrWifiSmePermanentMacAddressGetCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ bufferSize += 2; /* CsrResult primitive->status */ @@ -3888,7 +3888,7 @@ CsrSize CsrWifiSmePermanentMacAddressGetCfmSizeof(void *msg) } -u8* CsrWifiSmePermanentMacAddressGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmePermanentMacAddressGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmePermanentMacAddressGetCfm *primitive = (CsrWifiSmePermanentMacAddressGetCfm *)msg; *len = 0; @@ -3899,10 +3899,10 @@ u8* CsrWifiSmePermanentMacAddressGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmePermanentMacAddressGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmePermanentMacAddressGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmePermanentMacAddressGetCfm *primitive = (CsrWifiSmePermanentMacAddressGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePermanentMacAddressGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -3913,10 +3913,10 @@ void* CsrWifiSmePermanentMacAddressGetCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmePmkidCandidateListIndSizeof(void *msg) +size_t CsrWifiSmePmkidCandidateListIndSizeof(void *msg) { CsrWifiSmePmkidCandidateListInd *primitive = (CsrWifiSmePmkidCandidateListInd *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -3933,7 +3933,7 @@ CsrSize CsrWifiSmePmkidCandidateListIndSizeof(void *msg) } -u8* CsrWifiSmePmkidCandidateListIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmePmkidCandidateListIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmePmkidCandidateListInd *primitive = (CsrWifiSmePmkidCandidateListInd *)msg; *len = 0; @@ -3952,10 +3952,10 @@ u8* CsrWifiSmePmkidCandidateListIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmePmkidCandidateListIndDes(u8 *buffer, CsrSize length) +void* CsrWifiSmePmkidCandidateListIndDes(u8 *buffer, size_t length) { CsrWifiSmePmkidCandidateListInd *primitive = (CsrWifiSmePmkidCandidateListInd *) CsrPmemAlloc(sizeof(CsrWifiSmePmkidCandidateListInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -3987,10 +3987,10 @@ void CsrWifiSmePmkidCandidateListIndSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmePmkidCfmSizeof(void *msg) +size_t CsrWifiSmePmkidCfmSizeof(void *msg) { CsrWifiSmePmkidCfm *primitive = (CsrWifiSmePmkidCfm *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 31) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -4009,7 +4009,7 @@ CsrSize CsrWifiSmePmkidCfmSizeof(void *msg) } -u8* CsrWifiSmePmkidCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmePmkidCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmePmkidCfm *primitive = (CsrWifiSmePmkidCfm *)msg; *len = 0; @@ -4030,10 +4030,10 @@ u8* CsrWifiSmePmkidCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmePmkidCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmePmkidCfmDes(u8 *buffer, size_t length) { CsrWifiSmePmkidCfm *primitive = (CsrWifiSmePmkidCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePmkidCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -4067,9 +4067,9 @@ void CsrWifiSmePmkidCfmSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmePowerConfigGetCfmSizeof(void *msg) +size_t CsrWifiSmePowerConfigGetCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* CsrResult primitive->status */ @@ -4084,7 +4084,7 @@ CsrSize CsrWifiSmePowerConfigGetCfmSizeof(void *msg) } -u8* CsrWifiSmePowerConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmePowerConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmePowerConfigGetCfm *primitive = (CsrWifiSmePowerConfigGetCfm *)msg; *len = 0; @@ -4101,10 +4101,10 @@ u8* CsrWifiSmePowerConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmePowerConfigGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmePowerConfigGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmePowerConfigGetCfm *primitive = (CsrWifiSmePowerConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePowerConfigGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -4121,9 +4121,9 @@ void* CsrWifiSmePowerConfigGetCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeRegulatoryDomainInfoGetCfmSizeof(void *msg) +size_t CsrWifiSmeRegulatoryDomainInfoGetCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ bufferSize += 2; /* CsrResult primitive->status */ @@ -4135,7 +4135,7 @@ CsrSize CsrWifiSmeRegulatoryDomainInfoGetCfmSizeof(void *msg) } -u8* CsrWifiSmeRegulatoryDomainInfoGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeRegulatoryDomainInfoGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeRegulatoryDomainInfoGetCfm *primitive = (CsrWifiSmeRegulatoryDomainInfoGetCfm *)msg; *len = 0; @@ -4149,10 +4149,10 @@ u8* CsrWifiSmeRegulatoryDomainInfoGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeRegulatoryDomainInfoGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeRegulatoryDomainInfoGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeRegulatoryDomainInfoGetCfm *primitive = (CsrWifiSmeRegulatoryDomainInfoGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeRegulatoryDomainInfoGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -4166,9 +4166,9 @@ void* CsrWifiSmeRegulatoryDomainInfoGetCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeRoamCompleteIndSizeof(void *msg) +size_t CsrWifiSmeRoamCompleteIndSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -4177,7 +4177,7 @@ CsrSize CsrWifiSmeRoamCompleteIndSizeof(void *msg) } -u8* CsrWifiSmeRoamCompleteIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeRoamCompleteIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeRoamCompleteInd *primitive = (CsrWifiSmeRoamCompleteInd *)msg; *len = 0; @@ -4188,10 +4188,10 @@ u8* CsrWifiSmeRoamCompleteIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeRoamCompleteIndDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeRoamCompleteIndDes(u8 *buffer, size_t length) { CsrWifiSmeRoamCompleteInd *primitive = (CsrWifiSmeRoamCompleteInd *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamCompleteInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -4202,9 +4202,9 @@ void* CsrWifiSmeRoamCompleteIndDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeRoamStartIndSizeof(void *msg) +size_t CsrWifiSmeRoamStartIndSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -4214,7 +4214,7 @@ CsrSize CsrWifiSmeRoamStartIndSizeof(void *msg) } -u8* CsrWifiSmeRoamStartIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeRoamStartIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeRoamStartInd *primitive = (CsrWifiSmeRoamStartInd *)msg; *len = 0; @@ -4226,10 +4226,10 @@ u8* CsrWifiSmeRoamStartIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeRoamStartIndDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeRoamStartIndDes(u8 *buffer, size_t length) { CsrWifiSmeRoamStartInd *primitive = (CsrWifiSmeRoamStartInd *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamStartInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -4241,9 +4241,9 @@ void* CsrWifiSmeRoamStartIndDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeRoamingConfigGetCfmSizeof(void *msg) +size_t CsrWifiSmeRoamingConfigGetCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 72) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -4278,7 +4278,7 @@ CsrSize CsrWifiSmeRoamingConfigGetCfmSizeof(void *msg) } -u8* CsrWifiSmeRoamingConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeRoamingConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeRoamingConfigGetCfm *primitive = (CsrWifiSmeRoamingConfigGetCfm *)msg; *len = 0; @@ -4315,10 +4315,10 @@ u8* CsrWifiSmeRoamingConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeRoamingConfigGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeRoamingConfigGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeRoamingConfigGetCfm *primitive = (CsrWifiSmeRoamingConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamingConfigGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -4355,9 +4355,9 @@ void* CsrWifiSmeRoamingConfigGetCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeRoamingConfigSetCfmSizeof(void *msg) +size_t CsrWifiSmeRoamingConfigSetCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -4366,7 +4366,7 @@ CsrSize CsrWifiSmeRoamingConfigSetCfmSizeof(void *msg) } -u8* CsrWifiSmeRoamingConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeRoamingConfigSetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeRoamingConfigSetCfm *primitive = (CsrWifiSmeRoamingConfigSetCfm *)msg; *len = 0; @@ -4377,10 +4377,10 @@ u8* CsrWifiSmeRoamingConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeRoamingConfigSetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeRoamingConfigSetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeRoamingConfigSetCfm *primitive = (CsrWifiSmeRoamingConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamingConfigSetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -4391,10 +4391,10 @@ void* CsrWifiSmeRoamingConfigSetCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeScanConfigGetCfmSizeof(void *msg) +size_t CsrWifiSmeScanConfigGetCfmSizeof(void *msg) { CsrWifiSmeScanConfigGetCfm *primitive = (CsrWifiSmeScanConfigGetCfm *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 65) */ bufferSize += 2; /* CsrResult primitive->status */ @@ -4424,7 +4424,7 @@ CsrSize CsrWifiSmeScanConfigGetCfmSizeof(void *msg) } -u8* CsrWifiSmeScanConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeScanConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeScanConfigGetCfm *primitive = (CsrWifiSmeScanConfigGetCfm *)msg; *len = 0; @@ -4459,10 +4459,10 @@ u8* CsrWifiSmeScanConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeScanConfigGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeScanConfigGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeScanConfigGetCfm *primitive = (CsrWifiSmeScanConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeScanConfigGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -4510,10 +4510,10 @@ void CsrWifiSmeScanConfigGetCfmSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeScanResultIndSizeof(void *msg) +size_t CsrWifiSmeScanResultIndSizeof(void *msg) { CsrWifiSmeScanResultInd *primitive = (CsrWifiSmeScanResultInd *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 149) */ bufferSize += 32; /* u8 primitive->result.ssid.ssid[32] */ @@ -4590,7 +4590,7 @@ CsrSize CsrWifiSmeScanResultIndSizeof(void *msg) } -u8* CsrWifiSmeScanResultIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeScanResultIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeScanResultInd *primitive = (CsrWifiSmeScanResultInd *)msg; *len = 0; @@ -4672,10 +4672,10 @@ u8* CsrWifiSmeScanResultIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeScanResultIndDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeScanResultIndDes(u8 *buffer, size_t length) { CsrWifiSmeScanResultInd *primitive = (CsrWifiSmeScanResultInd *) CsrPmemAlloc(sizeof(CsrWifiSmeScanResultInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -4803,10 +4803,10 @@ void CsrWifiSmeScanResultIndSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeScanResultsGetCfmSizeof(void *msg) +size_t CsrWifiSmeScanResultsGetCfmSizeof(void *msg) { CsrWifiSmeScanResultsGetCfm *primitive = (CsrWifiSmeScanResultsGetCfm *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 153) */ bufferSize += 2; /* CsrResult primitive->status */ @@ -4891,7 +4891,7 @@ CsrSize CsrWifiSmeScanResultsGetCfmSizeof(void *msg) } -u8* CsrWifiSmeScanResultsGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeScanResultsGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeScanResultsGetCfm *primitive = (CsrWifiSmeScanResultsGetCfm *)msg; *len = 0; @@ -4981,10 +4981,10 @@ u8* CsrWifiSmeScanResultsGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeScanResultsGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeScanResultsGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeScanResultsGetCfm *primitive = (CsrWifiSmeScanResultsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeScanResultsGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -5132,9 +5132,9 @@ void CsrWifiSmeScanResultsGetCfmSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeSmeStaConfigGetCfmSizeof(void *msg) +size_t CsrWifiSmeSmeStaConfigGetCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -5149,7 +5149,7 @@ CsrSize CsrWifiSmeSmeStaConfigGetCfmSizeof(void *msg) } -u8* CsrWifiSmeSmeStaConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeSmeStaConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeSmeStaConfigGetCfm *primitive = (CsrWifiSmeSmeStaConfigGetCfm *)msg; *len = 0; @@ -5166,10 +5166,10 @@ u8* CsrWifiSmeSmeStaConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeSmeStaConfigGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeSmeStaConfigGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeSmeStaConfigGetCfm *primitive = (CsrWifiSmeSmeStaConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeStaConfigGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -5186,9 +5186,9 @@ void* CsrWifiSmeSmeStaConfigGetCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeSmeStaConfigSetCfmSizeof(void *msg) +size_t CsrWifiSmeSmeStaConfigSetCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -5197,7 +5197,7 @@ CsrSize CsrWifiSmeSmeStaConfigSetCfmSizeof(void *msg) } -u8* CsrWifiSmeSmeStaConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeSmeStaConfigSetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeSmeStaConfigSetCfm *primitive = (CsrWifiSmeSmeStaConfigSetCfm *)msg; *len = 0; @@ -5208,10 +5208,10 @@ u8* CsrWifiSmeSmeStaConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeSmeStaConfigSetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeSmeStaConfigSetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeSmeStaConfigSetCfm *primitive = (CsrWifiSmeSmeStaConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeStaConfigSetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -5222,9 +5222,9 @@ void* CsrWifiSmeSmeStaConfigSetCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeStationMacAddressGetCfmSizeof(void *msg) +size_t CsrWifiSmeStationMacAddressGetCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */ bufferSize += 2; /* CsrResult primitive->status */ @@ -5239,7 +5239,7 @@ CsrSize CsrWifiSmeStationMacAddressGetCfmSizeof(void *msg) } -u8* CsrWifiSmeStationMacAddressGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeStationMacAddressGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeStationMacAddressGetCfm *primitive = (CsrWifiSmeStationMacAddressGetCfm *)msg; *len = 0; @@ -5256,10 +5256,10 @@ u8* CsrWifiSmeStationMacAddressGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeStationMacAddressGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeStationMacAddressGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeStationMacAddressGetCfm *primitive = (CsrWifiSmeStationMacAddressGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeStationMacAddressGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -5276,10 +5276,10 @@ void* CsrWifiSmeStationMacAddressGetCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeTspecIndSizeof(void *msg) +size_t CsrWifiSmeTspecIndSizeof(void *msg) { CsrWifiSmeTspecInd *primitive = (CsrWifiSmeTspecInd *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -5291,7 +5291,7 @@ CsrSize CsrWifiSmeTspecIndSizeof(void *msg) } -u8* CsrWifiSmeTspecIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeTspecIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeTspecInd *primitive = (CsrWifiSmeTspecInd *)msg; *len = 0; @@ -5308,10 +5308,10 @@ u8* CsrWifiSmeTspecIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeTspecIndDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeTspecIndDes(u8 *buffer, size_t length) { CsrWifiSmeTspecInd *primitive = (CsrWifiSmeTspecInd *) CsrPmemAlloc(sizeof(CsrWifiSmeTspecInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -5341,10 +5341,10 @@ void CsrWifiSmeTspecIndSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeTspecCfmSizeof(void *msg) +size_t CsrWifiSmeTspecCfmSizeof(void *msg) { CsrWifiSmeTspecCfm *primitive = (CsrWifiSmeTspecCfm *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ bufferSize += 2; /* u16 primitive->interfaceTag */ @@ -5357,7 +5357,7 @@ CsrSize CsrWifiSmeTspecCfmSizeof(void *msg) } -u8* CsrWifiSmeTspecCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeTspecCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeTspecCfm *primitive = (CsrWifiSmeTspecCfm *)msg; *len = 0; @@ -5375,10 +5375,10 @@ u8* CsrWifiSmeTspecCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeTspecCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeTspecCfmDes(u8 *buffer, size_t length) { CsrWifiSmeTspecCfm *primitive = (CsrWifiSmeTspecCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeTspecCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -5409,10 +5409,10 @@ void CsrWifiSmeTspecCfmSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeVersionsGetCfmSizeof(void *msg) +size_t CsrWifiSmeVersionsGetCfmSizeof(void *msg) { CsrWifiSmeVersionsGetCfm *primitive = (CsrWifiSmeVersionsGetCfm *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 33) */ bufferSize += 2; /* CsrResult primitive->status */ @@ -5429,7 +5429,7 @@ CsrSize CsrWifiSmeVersionsGetCfmSizeof(void *msg) } -u8* CsrWifiSmeVersionsGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeVersionsGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeVersionsGetCfm *primitive = (CsrWifiSmeVersionsGetCfm *)msg; *len = 0; @@ -5448,10 +5448,10 @@ u8* CsrWifiSmeVersionsGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeVersionsGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeVersionsGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeVersionsGetCfm *primitive = (CsrWifiSmeVersionsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeVersionsGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -5479,10 +5479,10 @@ void CsrWifiSmeVersionsGetCfmSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeCloakedSsidsGetCfmSizeof(void *msg) +size_t CsrWifiSmeCloakedSsidsGetCfmSizeof(void *msg) { CsrWifiSmeCloakedSsidsGetCfm *primitive = (CsrWifiSmeCloakedSsidsGetCfm *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 39) */ bufferSize += 2; /* CsrResult primitive->status */ @@ -5499,7 +5499,7 @@ CsrSize CsrWifiSmeCloakedSsidsGetCfmSizeof(void *msg) } -u8* CsrWifiSmeCloakedSsidsGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeCloakedSsidsGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeCloakedSsidsGetCfm *primitive = (CsrWifiSmeCloakedSsidsGetCfm *)msg; *len = 0; @@ -5518,10 +5518,10 @@ u8* CsrWifiSmeCloakedSsidsGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeCloakedSsidsGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeCloakedSsidsGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeCloakedSsidsGetCfm *primitive = (CsrWifiSmeCloakedSsidsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCloakedSsidsGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -5553,9 +5553,9 @@ void CsrWifiSmeCloakedSsidsGetCfmSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeWifiOnIndSizeof(void *msg) +size_t CsrWifiSmeWifiOnIndSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ bufferSize += 6; /* u8 primitive->address.a[6] */ @@ -5563,7 +5563,7 @@ CsrSize CsrWifiSmeWifiOnIndSizeof(void *msg) } -u8* CsrWifiSmeWifiOnIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeWifiOnIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeWifiOnInd *primitive = (CsrWifiSmeWifiOnInd *)msg; *len = 0; @@ -5573,10 +5573,10 @@ u8* CsrWifiSmeWifiOnIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeWifiOnIndDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeWifiOnIndDes(u8 *buffer, size_t length) { CsrWifiSmeWifiOnInd *primitive = (CsrWifiSmeWifiOnInd *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiOnInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -5586,9 +5586,9 @@ void* CsrWifiSmeWifiOnIndDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeSmeCommonConfigGetCfmSizeof(void *msg) +size_t CsrWifiSmeSmeCommonConfigGetCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ bufferSize += 2; /* CsrResult primitive->status */ @@ -5600,7 +5600,7 @@ CsrSize CsrWifiSmeSmeCommonConfigGetCfmSizeof(void *msg) } -u8* CsrWifiSmeSmeCommonConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeSmeCommonConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeSmeCommonConfigGetCfm *primitive = (CsrWifiSmeSmeCommonConfigGetCfm *)msg; *len = 0; @@ -5614,10 +5614,10 @@ u8* CsrWifiSmeSmeCommonConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeSmeCommonConfigGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeSmeCommonConfigGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeSmeCommonConfigGetCfm *primitive = (CsrWifiSmeSmeCommonConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeCommonConfigGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -5631,9 +5631,9 @@ void* CsrWifiSmeSmeCommonConfigGetCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeInterfaceCapabilityGetCfmSizeof(void *msg) +size_t CsrWifiSmeInterfaceCapabilityGetCfmSizeof(void *msg) { - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ bufferSize += 2; /* CsrResult primitive->status */ @@ -5643,7 +5643,7 @@ CsrSize CsrWifiSmeInterfaceCapabilityGetCfmSizeof(void *msg) } -u8* CsrWifiSmeInterfaceCapabilityGetCfmSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeInterfaceCapabilityGetCfmSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeInterfaceCapabilityGetCfm *primitive = (CsrWifiSmeInterfaceCapabilityGetCfm *)msg; *len = 0; @@ -5655,10 +5655,10 @@ u8* CsrWifiSmeInterfaceCapabilityGetCfmSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeInterfaceCapabilityGetCfmDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeInterfaceCapabilityGetCfmDes(u8 *buffer, size_t length) { CsrWifiSmeInterfaceCapabilityGetCfm *primitive = (CsrWifiSmeInterfaceCapabilityGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeInterfaceCapabilityGetCfm)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -5670,10 +5670,10 @@ void* CsrWifiSmeInterfaceCapabilityGetCfmDes(u8 *buffer, CsrSize length) } -CsrSize CsrWifiSmeErrorIndSizeof(void *msg) +size_t CsrWifiSmeErrorIndSizeof(void *msg) { CsrWifiSmeErrorInd *primitive = (CsrWifiSmeErrorInd *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 3) */ bufferSize += (primitive->errorMessage?CsrStrLen(primitive->errorMessage) : 0) + 1; /* char* primitive->errorMessage (0 byte len + 1 for NULL Term) */ @@ -5681,7 +5681,7 @@ CsrSize CsrWifiSmeErrorIndSizeof(void *msg) } -u8* CsrWifiSmeErrorIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeErrorIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeErrorInd *primitive = (CsrWifiSmeErrorInd *)msg; *len = 0; @@ -5691,10 +5691,10 @@ u8* CsrWifiSmeErrorIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeErrorIndDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeErrorIndDes(u8 *buffer, size_t length) { CsrWifiSmeErrorInd *primitive = (CsrWifiSmeErrorInd *) CsrPmemAlloc(sizeof(CsrWifiSmeErrorInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -5712,10 +5712,10 @@ void CsrWifiSmeErrorIndSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeInfoIndSizeof(void *msg) +size_t CsrWifiSmeInfoIndSizeof(void *msg) { CsrWifiSmeInfoInd *primitive = (CsrWifiSmeInfoInd *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 3) */ bufferSize += (primitive->infoMessage?CsrStrLen(primitive->infoMessage) : 0) + 1; /* char* primitive->infoMessage (0 byte len + 1 for NULL Term) */ @@ -5723,7 +5723,7 @@ CsrSize CsrWifiSmeInfoIndSizeof(void *msg) } -u8* CsrWifiSmeInfoIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeInfoIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeInfoInd *primitive = (CsrWifiSmeInfoInd *)msg; *len = 0; @@ -5733,10 +5733,10 @@ u8* CsrWifiSmeInfoIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeInfoIndDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeInfoIndDes(u8 *buffer, size_t length) { CsrWifiSmeInfoInd *primitive = (CsrWifiSmeInfoInd *) CsrPmemAlloc(sizeof(CsrWifiSmeInfoInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -5754,10 +5754,10 @@ void CsrWifiSmeInfoIndSerFree(void *voidPrimitivePointer) } -CsrSize CsrWifiSmeCoreDumpIndSizeof(void *msg) +size_t CsrWifiSmeCoreDumpIndSizeof(void *msg) { CsrWifiSmeCoreDumpInd *primitive = (CsrWifiSmeCoreDumpInd *) msg; - CsrSize bufferSize = 2; + size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ bufferSize += 4; /* u32 primitive->dataLength */ @@ -5766,7 +5766,7 @@ CsrSize CsrWifiSmeCoreDumpIndSizeof(void *msg) } -u8* CsrWifiSmeCoreDumpIndSer(u8 *ptr, CsrSize *len, void *msg) +u8* CsrWifiSmeCoreDumpIndSer(u8 *ptr, size_t *len, void *msg) { CsrWifiSmeCoreDumpInd *primitive = (CsrWifiSmeCoreDumpInd *)msg; *len = 0; @@ -5780,10 +5780,10 @@ u8* CsrWifiSmeCoreDumpIndSer(u8 *ptr, CsrSize *len, void *msg) } -void* CsrWifiSmeCoreDumpIndDes(u8 *buffer, CsrSize length) +void* CsrWifiSmeCoreDumpIndDes(u8 *buffer, size_t length) { CsrWifiSmeCoreDumpInd *primitive = (CsrWifiSmeCoreDumpInd *) CsrPmemAlloc(sizeof(CsrWifiSmeCoreDumpInd)); - CsrSize offset; + size_t offset; offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.h b/drivers/staging/csr/csr_wifi_sme_serialize.h index 700d049..e8d5000 100644 --- a/drivers/staging/csr/csr_wifi_sme_serialize.h +++ b/drivers/staging/csr/csr_wifi_sme_serialize.h @@ -35,14 +35,14 @@ extern void CsrWifiSmePfree(void *ptr); #define CsrWifiSmeAdhocConfigGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmeAdhocConfigGetReqSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeAdhocConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeAdhocConfigSetReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeAdhocConfigSetReqSizeof(void *msg); +extern u8* CsrWifiSmeAdhocConfigSetReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeAdhocConfigSetReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeAdhocConfigSetReqSizeof(void *msg); #define CsrWifiSmeAdhocConfigSetReqSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeBlacklistReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeBlacklistReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeBlacklistReqSizeof(void *msg); +extern u8* CsrWifiSmeBlacklistReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeBlacklistReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeBlacklistReqSizeof(void *msg); extern void CsrWifiSmeBlacklistReqSerFree(void *msg); #define CsrWifiSmeCalibrationDataGetReqSer CsrWifiEventSer @@ -50,9 +50,9 @@ extern void CsrWifiSmeBlacklistReqSerFree(void *msg); #define CsrWifiSmeCalibrationDataGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmeCalibrationDataGetReqSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeCalibrationDataSetReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeCalibrationDataSetReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeCalibrationDataSetReqSizeof(void *msg); +extern u8* CsrWifiSmeCalibrationDataSetReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeCalibrationDataSetReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeCalibrationDataSetReqSizeof(void *msg); extern void CsrWifiSmeCalibrationDataSetReqSerFree(void *msg); #define CsrWifiSmeCcxConfigGetReqSer CsrWifiEventCsrUint16Ser @@ -60,9 +60,9 @@ extern void CsrWifiSmeCalibrationDataSetReqSerFree(void *msg); #define CsrWifiSmeCcxConfigGetReqSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeCcxConfigGetReqSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeCcxConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeCcxConfigSetReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeCcxConfigSetReqSizeof(void *msg); +extern u8* CsrWifiSmeCcxConfigSetReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeCcxConfigSetReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeCcxConfigSetReqSizeof(void *msg); #define CsrWifiSmeCcxConfigSetReqSerFree CsrWifiSmePfree #define CsrWifiSmeCoexConfigGetReqSer CsrWifiEventSer @@ -70,9 +70,9 @@ extern CsrSize CsrWifiSmeCcxConfigSetReqSizeof(void *msg); #define CsrWifiSmeCoexConfigGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmeCoexConfigGetReqSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeCoexConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeCoexConfigSetReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeCoexConfigSetReqSizeof(void *msg); +extern u8* CsrWifiSmeCoexConfigSetReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeCoexConfigSetReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeCoexConfigSetReqSizeof(void *msg); #define CsrWifiSmeCoexConfigSetReqSerFree CsrWifiSmePfree #define CsrWifiSmeCoexInfoGetReqSer CsrWifiEventSer @@ -80,9 +80,9 @@ extern CsrSize CsrWifiSmeCoexConfigSetReqSizeof(void *msg); #define CsrWifiSmeCoexInfoGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmeCoexInfoGetReqSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeConnectReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeConnectReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeConnectReqSizeof(void *msg); +extern u8* CsrWifiSmeConnectReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeConnectReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeConnectReqSizeof(void *msg); extern void CsrWifiSmeConnectReqSerFree(void *msg); #define CsrWifiSmeConnectionConfigGetReqSer CsrWifiEventCsrUint16Ser @@ -120,14 +120,14 @@ extern void CsrWifiSmeConnectReqSerFree(void *msg); #define CsrWifiSmeHostConfigGetReqSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeHostConfigGetReqSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeHostConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeHostConfigSetReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeHostConfigSetReqSizeof(void *msg); +extern u8* CsrWifiSmeHostConfigSetReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeHostConfigSetReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeHostConfigSetReqSizeof(void *msg); #define CsrWifiSmeHostConfigSetReqSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeKeyReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeKeyReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeKeyReqSizeof(void *msg); +extern u8* CsrWifiSmeKeyReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeKeyReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeKeyReqSizeof(void *msg); #define CsrWifiSmeKeyReqSerFree CsrWifiSmePfree #define CsrWifiSmeLinkQualityGetReqSer CsrWifiEventCsrUint16Ser @@ -140,34 +140,34 @@ extern CsrSize CsrWifiSmeKeyReqSizeof(void *msg); #define CsrWifiSmeMibConfigGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmeMibConfigGetReqSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeMibConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeMibConfigSetReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeMibConfigSetReqSizeof(void *msg); +extern u8* CsrWifiSmeMibConfigSetReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeMibConfigSetReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeMibConfigSetReqSizeof(void *msg); #define CsrWifiSmeMibConfigSetReqSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeMibGetNextReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeMibGetNextReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeMibGetNextReqSizeof(void *msg); +extern u8* CsrWifiSmeMibGetNextReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeMibGetNextReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeMibGetNextReqSizeof(void *msg); extern void CsrWifiSmeMibGetNextReqSerFree(void *msg); -extern u8* CsrWifiSmeMibGetReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeMibGetReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeMibGetReqSizeof(void *msg); +extern u8* CsrWifiSmeMibGetReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeMibGetReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeMibGetReqSizeof(void *msg); extern void CsrWifiSmeMibGetReqSerFree(void *msg); -extern u8* CsrWifiSmeMibSetReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeMibSetReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeMibSetReqSizeof(void *msg); +extern u8* CsrWifiSmeMibSetReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeMibSetReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeMibSetReqSizeof(void *msg); extern void CsrWifiSmeMibSetReqSerFree(void *msg); -extern u8* CsrWifiSmeMulticastAddressReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeMulticastAddressReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeMulticastAddressReqSizeof(void *msg); +extern u8* CsrWifiSmeMulticastAddressReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeMulticastAddressReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeMulticastAddressReqSizeof(void *msg); extern void CsrWifiSmeMulticastAddressReqSerFree(void *msg); -extern u8* CsrWifiSmePacketFilterSetReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmePacketFilterSetReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmePacketFilterSetReqSizeof(void *msg); +extern u8* CsrWifiSmePacketFilterSetReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmePacketFilterSetReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmePacketFilterSetReqSizeof(void *msg); extern void CsrWifiSmePacketFilterSetReqSerFree(void *msg); #define CsrWifiSmePermanentMacAddressGetReqSer CsrWifiEventSer @@ -175,9 +175,9 @@ extern void CsrWifiSmePacketFilterSetReqSerFree(void *msg); #define CsrWifiSmePermanentMacAddressGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmePermanentMacAddressGetReqSerFree CsrWifiSmePfree -extern u8* CsrWifiSmePmkidReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmePmkidReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmePmkidReqSizeof(void *msg); +extern u8* CsrWifiSmePmkidReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmePmkidReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmePmkidReqSizeof(void *msg); extern void CsrWifiSmePmkidReqSerFree(void *msg); #define CsrWifiSmePowerConfigGetReqSer CsrWifiEventSer @@ -185,9 +185,9 @@ extern void CsrWifiSmePmkidReqSerFree(void *msg); #define CsrWifiSmePowerConfigGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmePowerConfigGetReqSerFree CsrWifiSmePfree -extern u8* CsrWifiSmePowerConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmePowerConfigSetReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmePowerConfigSetReqSizeof(void *msg); +extern u8* CsrWifiSmePowerConfigSetReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmePowerConfigSetReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmePowerConfigSetReqSizeof(void *msg); #define CsrWifiSmePowerConfigSetReqSerFree CsrWifiSmePfree #define CsrWifiSmeRegulatoryDomainInfoGetReqSer CsrWifiEventSer @@ -200,9 +200,9 @@ extern CsrSize CsrWifiSmePowerConfigSetReqSizeof(void *msg); #define CsrWifiSmeRoamingConfigGetReqSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeRoamingConfigGetReqSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeRoamingConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeRoamingConfigSetReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeRoamingConfigSetReqSizeof(void *msg); +extern u8* CsrWifiSmeRoamingConfigSetReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeRoamingConfigSetReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeRoamingConfigSetReqSizeof(void *msg); #define CsrWifiSmeRoamingConfigSetReqSerFree CsrWifiSmePfree #define CsrWifiSmeScanConfigGetReqSer CsrWifiEventSer @@ -210,14 +210,14 @@ extern CsrSize CsrWifiSmeRoamingConfigSetReqSizeof(void *msg); #define CsrWifiSmeScanConfigGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmeScanConfigGetReqSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeScanConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeScanConfigSetReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeScanConfigSetReqSizeof(void *msg); +extern u8* CsrWifiSmeScanConfigSetReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeScanConfigSetReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeScanConfigSetReqSizeof(void *msg); extern void CsrWifiSmeScanConfigSetReqSerFree(void *msg); -extern u8* CsrWifiSmeScanFullReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeScanFullReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeScanFullReqSizeof(void *msg); +extern u8* CsrWifiSmeScanFullReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeScanFullReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeScanFullReqSizeof(void *msg); extern void CsrWifiSmeScanFullReqSerFree(void *msg); #define CsrWifiSmeScanResultsFlushReqSer CsrWifiEventSer @@ -235,9 +235,9 @@ extern void CsrWifiSmeScanFullReqSerFree(void *msg); #define CsrWifiSmeSmeStaConfigGetReqSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeSmeStaConfigGetReqSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeSmeStaConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeSmeStaConfigSetReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeSmeStaConfigSetReqSizeof(void *msg); +extern u8* CsrWifiSmeSmeStaConfigSetReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeSmeStaConfigSetReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeSmeStaConfigSetReqSizeof(void *msg); #define CsrWifiSmeSmeStaConfigSetReqSerFree CsrWifiSmePfree #define CsrWifiSmeStationMacAddressGetReqSer CsrWifiEventSer @@ -245,9 +245,9 @@ extern CsrSize CsrWifiSmeSmeStaConfigSetReqSizeof(void *msg); #define CsrWifiSmeStationMacAddressGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmeStationMacAddressGetReqSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeTspecReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeTspecReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeTspecReqSizeof(void *msg); +extern u8* CsrWifiSmeTspecReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeTspecReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeTspecReqSizeof(void *msg); extern void CsrWifiSmeTspecReqSerFree(void *msg); #define CsrWifiSmeVersionsGetReqSer CsrWifiEventSer @@ -255,9 +255,9 @@ extern void CsrWifiSmeTspecReqSerFree(void *msg); #define CsrWifiSmeVersionsGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmeVersionsGetReqSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeWifiFlightmodeReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeWifiFlightmodeReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeWifiFlightmodeReqSizeof(void *msg); +extern u8* CsrWifiSmeWifiFlightmodeReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeWifiFlightmodeReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeWifiFlightmodeReqSizeof(void *msg); extern void CsrWifiSmeWifiFlightmodeReqSerFree(void *msg); #define CsrWifiSmeWifiOffReqSer CsrWifiEventSer @@ -265,14 +265,14 @@ extern void CsrWifiSmeWifiFlightmodeReqSerFree(void *msg); #define CsrWifiSmeWifiOffReqSizeof CsrWifiEventSizeof #define CsrWifiSmeWifiOffReqSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeWifiOnReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeWifiOnReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeWifiOnReqSizeof(void *msg); +extern u8* CsrWifiSmeWifiOnReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeWifiOnReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeWifiOnReqSizeof(void *msg); extern void CsrWifiSmeWifiOnReqSerFree(void *msg); -extern u8* CsrWifiSmeCloakedSsidsSetReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeCloakedSsidsSetReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeCloakedSsidsSetReqSizeof(void *msg); +extern u8* CsrWifiSmeCloakedSsidsSetReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeCloakedSsidsSetReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeCloakedSsidsSetReqSizeof(void *msg); extern void CsrWifiSmeCloakedSsidsSetReqSerFree(void *msg); #define CsrWifiSmeCloakedSsidsGetReqSer CsrWifiEventSer @@ -285,9 +285,9 @@ extern void CsrWifiSmeCloakedSsidsSetReqSerFree(void *msg); #define CsrWifiSmeSmeCommonConfigGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmeSmeCommonConfigGetReqSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeSmeCommonConfigSetReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeSmeCommonConfigSetReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeSmeCommonConfigSetReqSizeof(void *msg); +extern u8* CsrWifiSmeSmeCommonConfigSetReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeSmeCommonConfigSetReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeSmeCommonConfigSetReqSizeof(void *msg); #define CsrWifiSmeSmeCommonConfigSetReqSerFree CsrWifiSmePfree #define CsrWifiSmeInterfaceCapabilityGetReqSer CsrWifiEventSer @@ -295,14 +295,14 @@ extern CsrSize CsrWifiSmeSmeCommonConfigSetReqSizeof(void *msg); #define CsrWifiSmeInterfaceCapabilityGetReqSizeof CsrWifiEventSizeof #define CsrWifiSmeInterfaceCapabilityGetReqSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeWpsConfigurationReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeWpsConfigurationReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeWpsConfigurationReqSizeof(void *msg); +extern u8* CsrWifiSmeWpsConfigurationReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeWpsConfigurationReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeWpsConfigurationReqSizeof(void *msg); extern void CsrWifiSmeWpsConfigurationReqSerFree(void *msg); -extern u8* CsrWifiSmeSetReqSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeSetReqDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeSetReqSizeof(void *msg); +extern u8* CsrWifiSmeSetReqSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeSetReqDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeSetReqSizeof(void *msg); extern void CsrWifiSmeSetReqSerFree(void *msg); #define CsrWifiSmeActivateCfmSer CsrWifiEventCsrUint16Ser @@ -310,9 +310,9 @@ extern void CsrWifiSmeSetReqSerFree(void *msg); #define CsrWifiSmeActivateCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeActivateCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeAdhocConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeAdhocConfigGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeAdhocConfigGetCfmSizeof(void *msg); +extern u8* CsrWifiSmeAdhocConfigGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeAdhocConfigGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeAdhocConfigGetCfmSizeof(void *msg); #define CsrWifiSmeAdhocConfigGetCfmSerFree CsrWifiSmePfree #define CsrWifiSmeAdhocConfigSetCfmSer CsrWifiEventCsrUint16Ser @@ -320,24 +320,24 @@ extern CsrSize CsrWifiSmeAdhocConfigGetCfmSizeof(void *msg); #define CsrWifiSmeAdhocConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeAdhocConfigSetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeAssociationCompleteIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeAssociationCompleteIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeAssociationCompleteIndSizeof(void *msg); +extern u8* CsrWifiSmeAssociationCompleteIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeAssociationCompleteIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeAssociationCompleteIndSizeof(void *msg); extern void CsrWifiSmeAssociationCompleteIndSerFree(void *msg); -extern u8* CsrWifiSmeAssociationStartIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeAssociationStartIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeAssociationStartIndSizeof(void *msg); +extern u8* CsrWifiSmeAssociationStartIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeAssociationStartIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeAssociationStartIndSizeof(void *msg); #define CsrWifiSmeAssociationStartIndSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeBlacklistCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeBlacklistCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeBlacklistCfmSizeof(void *msg); +extern u8* CsrWifiSmeBlacklistCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeBlacklistCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeBlacklistCfmSizeof(void *msg); extern void CsrWifiSmeBlacklistCfmSerFree(void *msg); -extern u8* CsrWifiSmeCalibrationDataGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeCalibrationDataGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeCalibrationDataGetCfmSizeof(void *msg); +extern u8* CsrWifiSmeCalibrationDataGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeCalibrationDataGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeCalibrationDataGetCfmSizeof(void *msg); extern void CsrWifiSmeCalibrationDataGetCfmSerFree(void *msg); #define CsrWifiSmeCalibrationDataSetCfmSer CsrWifiEventCsrUint16Ser @@ -345,19 +345,19 @@ extern void CsrWifiSmeCalibrationDataGetCfmSerFree(void *msg); #define CsrWifiSmeCalibrationDataSetCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeCalibrationDataSetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeCcxConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeCcxConfigGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeCcxConfigGetCfmSizeof(void *msg); +extern u8* CsrWifiSmeCcxConfigGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeCcxConfigGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeCcxConfigGetCfmSizeof(void *msg); #define CsrWifiSmeCcxConfigGetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeCcxConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeCcxConfigSetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeCcxConfigSetCfmSizeof(void *msg); +extern u8* CsrWifiSmeCcxConfigSetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeCcxConfigSetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeCcxConfigSetCfmSizeof(void *msg); #define CsrWifiSmeCcxConfigSetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeCoexConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeCoexConfigGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeCoexConfigGetCfmSizeof(void *msg); +extern u8* CsrWifiSmeCoexConfigGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeCoexConfigGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeCoexConfigGetCfmSizeof(void *msg); #define CsrWifiSmeCoexConfigGetCfmSerFree CsrWifiSmePfree #define CsrWifiSmeCoexConfigSetCfmSer CsrWifiEventCsrUint16Ser @@ -365,34 +365,34 @@ extern CsrSize CsrWifiSmeCoexConfigGetCfmSizeof(void *msg); #define CsrWifiSmeCoexConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeCoexConfigSetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeCoexInfoGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeCoexInfoGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeCoexInfoGetCfmSizeof(void *msg); +extern u8* CsrWifiSmeCoexInfoGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeCoexInfoGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeCoexInfoGetCfmSizeof(void *msg); #define CsrWifiSmeCoexInfoGetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeConnectCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeConnectCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeConnectCfmSizeof(void *msg); +extern u8* CsrWifiSmeConnectCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeConnectCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeConnectCfmSizeof(void *msg); #define CsrWifiSmeConnectCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeConnectionConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeConnectionConfigGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeConnectionConfigGetCfmSizeof(void *msg); +extern u8* CsrWifiSmeConnectionConfigGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeConnectionConfigGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeConnectionConfigGetCfmSizeof(void *msg); extern void CsrWifiSmeConnectionConfigGetCfmSerFree(void *msg); -extern u8* CsrWifiSmeConnectionInfoGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeConnectionInfoGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeConnectionInfoGetCfmSizeof(void *msg); +extern u8* CsrWifiSmeConnectionInfoGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeConnectionInfoGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeConnectionInfoGetCfmSizeof(void *msg); extern void CsrWifiSmeConnectionInfoGetCfmSerFree(void *msg); -extern u8* CsrWifiSmeConnectionQualityIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeConnectionQualityIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeConnectionQualityIndSizeof(void *msg); +extern u8* CsrWifiSmeConnectionQualityIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeConnectionQualityIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeConnectionQualityIndSizeof(void *msg); #define CsrWifiSmeConnectionQualityIndSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeConnectionStatsGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeConnectionStatsGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeConnectionStatsGetCfmSizeof(void *msg); +extern u8* CsrWifiSmeConnectionStatsGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeConnectionStatsGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeConnectionStatsGetCfmSizeof(void *msg); #define CsrWifiSmeConnectionStatsGetCfmSerFree CsrWifiSmePfree #define CsrWifiSmeDeactivateCfmSer CsrWifiEventCsrUint16Ser @@ -400,9 +400,9 @@ extern CsrSize CsrWifiSmeConnectionStatsGetCfmSizeof(void *msg); #define CsrWifiSmeDeactivateCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeDeactivateCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeDisconnectCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeDisconnectCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeDisconnectCfmSizeof(void *msg); +extern u8* CsrWifiSmeDisconnectCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeDisconnectCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeDisconnectCfmSizeof(void *msg); #define CsrWifiSmeDisconnectCfmSerFree CsrWifiSmePfree #define CsrWifiSmeEventMaskSetCfmSer CsrWifiEventCsrUint16Ser @@ -410,39 +410,39 @@ extern CsrSize CsrWifiSmeDisconnectCfmSizeof(void *msg); #define CsrWifiSmeEventMaskSetCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeEventMaskSetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeHostConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeHostConfigGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeHostConfigGetCfmSizeof(void *msg); +extern u8* CsrWifiSmeHostConfigGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeHostConfigGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeHostConfigGetCfmSizeof(void *msg); #define CsrWifiSmeHostConfigGetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeHostConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeHostConfigSetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeHostConfigSetCfmSizeof(void *msg); +extern u8* CsrWifiSmeHostConfigSetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeHostConfigSetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeHostConfigSetCfmSizeof(void *msg); #define CsrWifiSmeHostConfigSetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeIbssStationIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeIbssStationIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeIbssStationIndSizeof(void *msg); +extern u8* CsrWifiSmeIbssStationIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeIbssStationIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeIbssStationIndSizeof(void *msg); #define CsrWifiSmeIbssStationIndSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeKeyCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeKeyCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeKeyCfmSizeof(void *msg); +extern u8* CsrWifiSmeKeyCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeKeyCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeKeyCfmSizeof(void *msg); #define CsrWifiSmeKeyCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeLinkQualityGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeLinkQualityGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeLinkQualityGetCfmSizeof(void *msg); +extern u8* CsrWifiSmeLinkQualityGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeLinkQualityGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeLinkQualityGetCfmSizeof(void *msg); #define CsrWifiSmeLinkQualityGetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeMediaStatusIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeMediaStatusIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeMediaStatusIndSizeof(void *msg); +extern u8* CsrWifiSmeMediaStatusIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeMediaStatusIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeMediaStatusIndSizeof(void *msg); extern void CsrWifiSmeMediaStatusIndSerFree(void *msg); -extern u8* CsrWifiSmeMibConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeMibConfigGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeMibConfigGetCfmSizeof(void *msg); +extern u8* CsrWifiSmeMibConfigGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeMibConfigGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeMibConfigGetCfmSizeof(void *msg); #define CsrWifiSmeMibConfigGetCfmSerFree CsrWifiSmePfree #define CsrWifiSmeMibConfigSetCfmSer CsrWifiEventCsrUint16Ser @@ -450,14 +450,14 @@ extern CsrSize CsrWifiSmeMibConfigGetCfmSizeof(void *msg); #define CsrWifiSmeMibConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeMibConfigSetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeMibGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeMibGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeMibGetCfmSizeof(void *msg); +extern u8* CsrWifiSmeMibGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeMibGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeMibGetCfmSizeof(void *msg); extern void CsrWifiSmeMibGetCfmSerFree(void *msg); -extern u8* CsrWifiSmeMibGetNextCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeMibGetNextCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeMibGetNextCfmSizeof(void *msg); +extern u8* CsrWifiSmeMibGetNextCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeMibGetNextCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeMibGetNextCfmSizeof(void *msg); extern void CsrWifiSmeMibGetNextCfmSerFree(void *msg); #define CsrWifiSmeMibSetCfmSer CsrWifiEventCsrUint16Ser @@ -465,39 +465,39 @@ extern void CsrWifiSmeMibGetNextCfmSerFree(void *msg); #define CsrWifiSmeMibSetCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeMibSetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeMicFailureIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeMicFailureIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeMicFailureIndSizeof(void *msg); +extern u8* CsrWifiSmeMicFailureIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeMicFailureIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeMicFailureIndSizeof(void *msg); #define CsrWifiSmeMicFailureIndSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeMulticastAddressCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeMulticastAddressCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeMulticastAddressCfmSizeof(void *msg); +extern u8* CsrWifiSmeMulticastAddressCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeMulticastAddressCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeMulticastAddressCfmSizeof(void *msg); extern void CsrWifiSmeMulticastAddressCfmSerFree(void *msg); -extern u8* CsrWifiSmePacketFilterSetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmePacketFilterSetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmePacketFilterSetCfmSizeof(void *msg); +extern u8* CsrWifiSmePacketFilterSetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmePacketFilterSetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmePacketFilterSetCfmSizeof(void *msg); #define CsrWifiSmePacketFilterSetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmePermanentMacAddressGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmePermanentMacAddressGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmePermanentMacAddressGetCfmSizeof(void *msg); +extern u8* CsrWifiSmePermanentMacAddressGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmePermanentMacAddressGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmePermanentMacAddressGetCfmSizeof(void *msg); #define CsrWifiSmePermanentMacAddressGetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmePmkidCandidateListIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmePmkidCandidateListIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmePmkidCandidateListIndSizeof(void *msg); +extern u8* CsrWifiSmePmkidCandidateListIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmePmkidCandidateListIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmePmkidCandidateListIndSizeof(void *msg); extern void CsrWifiSmePmkidCandidateListIndSerFree(void *msg); -extern u8* CsrWifiSmePmkidCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmePmkidCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmePmkidCfmSizeof(void *msg); +extern u8* CsrWifiSmePmkidCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmePmkidCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmePmkidCfmSizeof(void *msg); extern void CsrWifiSmePmkidCfmSerFree(void *msg); -extern u8* CsrWifiSmePowerConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmePowerConfigGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmePowerConfigGetCfmSizeof(void *msg); +extern u8* CsrWifiSmePowerConfigGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmePowerConfigGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmePowerConfigGetCfmSizeof(void *msg); #define CsrWifiSmePowerConfigGetCfmSerFree CsrWifiSmePfree #define CsrWifiSmePowerConfigSetCfmSer CsrWifiEventCsrUint16Ser @@ -505,34 +505,34 @@ extern CsrSize CsrWifiSmePowerConfigGetCfmSizeof(void *msg); #define CsrWifiSmePowerConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmePowerConfigSetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeRegulatoryDomainInfoGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeRegulatoryDomainInfoGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeRegulatoryDomainInfoGetCfmSizeof(void *msg); +extern u8* CsrWifiSmeRegulatoryDomainInfoGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeRegulatoryDomainInfoGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeRegulatoryDomainInfoGetCfmSizeof(void *msg); #define CsrWifiSmeRegulatoryDomainInfoGetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeRoamCompleteIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeRoamCompleteIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeRoamCompleteIndSizeof(void *msg); +extern u8* CsrWifiSmeRoamCompleteIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeRoamCompleteIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeRoamCompleteIndSizeof(void *msg); #define CsrWifiSmeRoamCompleteIndSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeRoamStartIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeRoamStartIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeRoamStartIndSizeof(void *msg); +extern u8* CsrWifiSmeRoamStartIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeRoamStartIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeRoamStartIndSizeof(void *msg); #define CsrWifiSmeRoamStartIndSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeRoamingConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeRoamingConfigGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeRoamingConfigGetCfmSizeof(void *msg); +extern u8* CsrWifiSmeRoamingConfigGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeRoamingConfigGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeRoamingConfigGetCfmSizeof(void *msg); #define CsrWifiSmeRoamingConfigGetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeRoamingConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeRoamingConfigSetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeRoamingConfigSetCfmSizeof(void *msg); +extern u8* CsrWifiSmeRoamingConfigSetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeRoamingConfigSetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeRoamingConfigSetCfmSizeof(void *msg); #define CsrWifiSmeRoamingConfigSetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeScanConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeScanConfigGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeScanConfigGetCfmSizeof(void *msg); +extern u8* CsrWifiSmeScanConfigGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeScanConfigGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeScanConfigGetCfmSizeof(void *msg); extern void CsrWifiSmeScanConfigGetCfmSerFree(void *msg); #define CsrWifiSmeScanConfigSetCfmSer CsrWifiEventCsrUint16Ser @@ -545,9 +545,9 @@ extern void CsrWifiSmeScanConfigGetCfmSerFree(void *msg); #define CsrWifiSmeScanFullCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeScanFullCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeScanResultIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeScanResultIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeScanResultIndSizeof(void *msg); +extern u8* CsrWifiSmeScanResultIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeScanResultIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeScanResultIndSizeof(void *msg); extern void CsrWifiSmeScanResultIndSerFree(void *msg); #define CsrWifiSmeScanResultsFlushCfmSer CsrWifiEventCsrUint16Ser @@ -555,39 +555,39 @@ extern void CsrWifiSmeScanResultIndSerFree(void *msg); #define CsrWifiSmeScanResultsFlushCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeScanResultsFlushCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeScanResultsGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeScanResultsGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeScanResultsGetCfmSizeof(void *msg); +extern u8* CsrWifiSmeScanResultsGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeScanResultsGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeScanResultsGetCfmSizeof(void *msg); extern void CsrWifiSmeScanResultsGetCfmSerFree(void *msg); -extern u8* CsrWifiSmeSmeStaConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeSmeStaConfigGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeSmeStaConfigGetCfmSizeof(void *msg); +extern u8* CsrWifiSmeSmeStaConfigGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeSmeStaConfigGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeSmeStaConfigGetCfmSizeof(void *msg); #define CsrWifiSmeSmeStaConfigGetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeSmeStaConfigSetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeSmeStaConfigSetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeSmeStaConfigSetCfmSizeof(void *msg); +extern u8* CsrWifiSmeSmeStaConfigSetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeSmeStaConfigSetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeSmeStaConfigSetCfmSizeof(void *msg); #define CsrWifiSmeSmeStaConfigSetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeStationMacAddressGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeStationMacAddressGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeStationMacAddressGetCfmSizeof(void *msg); +extern u8* CsrWifiSmeStationMacAddressGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeStationMacAddressGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeStationMacAddressGetCfmSizeof(void *msg); #define CsrWifiSmeStationMacAddressGetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeTspecIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeTspecIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeTspecIndSizeof(void *msg); +extern u8* CsrWifiSmeTspecIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeTspecIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeTspecIndSizeof(void *msg); extern void CsrWifiSmeTspecIndSerFree(void *msg); -extern u8* CsrWifiSmeTspecCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeTspecCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeTspecCfmSizeof(void *msg); +extern u8* CsrWifiSmeTspecCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeTspecCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeTspecCfmSizeof(void *msg); extern void CsrWifiSmeTspecCfmSerFree(void *msg); -extern u8* CsrWifiSmeVersionsGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeVersionsGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeVersionsGetCfmSizeof(void *msg); +extern u8* CsrWifiSmeVersionsGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeVersionsGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeVersionsGetCfmSizeof(void *msg); extern void CsrWifiSmeVersionsGetCfmSerFree(void *msg); #define CsrWifiSmeWifiFlightmodeCfmSer CsrWifiEventCsrUint16Ser @@ -615,19 +615,19 @@ extern void CsrWifiSmeVersionsGetCfmSerFree(void *msg); #define CsrWifiSmeCloakedSsidsSetCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeCloakedSsidsSetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeCloakedSsidsGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeCloakedSsidsGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeCloakedSsidsGetCfmSizeof(void *msg); +extern u8* CsrWifiSmeCloakedSsidsGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeCloakedSsidsGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeCloakedSsidsGetCfmSizeof(void *msg); extern void CsrWifiSmeCloakedSsidsGetCfmSerFree(void *msg); -extern u8* CsrWifiSmeWifiOnIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeWifiOnIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeWifiOnIndSizeof(void *msg); +extern u8* CsrWifiSmeWifiOnIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeWifiOnIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeWifiOnIndSizeof(void *msg); #define CsrWifiSmeWifiOnIndSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeSmeCommonConfigGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeSmeCommonConfigGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeSmeCommonConfigGetCfmSizeof(void *msg); +extern u8* CsrWifiSmeSmeCommonConfigGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeSmeCommonConfigGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeSmeCommonConfigGetCfmSizeof(void *msg); #define CsrWifiSmeSmeCommonConfigGetCfmSerFree CsrWifiSmePfree #define CsrWifiSmeSmeCommonConfigSetCfmSer CsrWifiEventCsrUint16Ser @@ -635,24 +635,24 @@ extern CsrSize CsrWifiSmeSmeCommonConfigGetCfmSizeof(void *msg); #define CsrWifiSmeSmeCommonConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof #define CsrWifiSmeSmeCommonConfigSetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeInterfaceCapabilityGetCfmSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeInterfaceCapabilityGetCfmDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeInterfaceCapabilityGetCfmSizeof(void *msg); +extern u8* CsrWifiSmeInterfaceCapabilityGetCfmSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeInterfaceCapabilityGetCfmDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeInterfaceCapabilityGetCfmSizeof(void *msg); #define CsrWifiSmeInterfaceCapabilityGetCfmSerFree CsrWifiSmePfree -extern u8* CsrWifiSmeErrorIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeErrorIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeErrorIndSizeof(void *msg); +extern u8* CsrWifiSmeErrorIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeErrorIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeErrorIndSizeof(void *msg); extern void CsrWifiSmeErrorIndSerFree(void *msg); -extern u8* CsrWifiSmeInfoIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeInfoIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeInfoIndSizeof(void *msg); +extern u8* CsrWifiSmeInfoIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeInfoIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeInfoIndSizeof(void *msg); extern void CsrWifiSmeInfoIndSerFree(void *msg); -extern u8* CsrWifiSmeCoreDumpIndSer(u8 *ptr, CsrSize *len, void *msg); -extern void* CsrWifiSmeCoreDumpIndDes(u8 *buffer, CsrSize len); -extern CsrSize CsrWifiSmeCoreDumpIndSizeof(void *msg); +extern u8* CsrWifiSmeCoreDumpIndSer(u8 *ptr, size_t *len, void *msg); +extern void* CsrWifiSmeCoreDumpIndDes(u8 *buffer, size_t len); +extern size_t CsrWifiSmeCoreDumpIndSizeof(void *msg); extern void CsrWifiSmeCoreDumpIndSerFree(void *msg); #define CsrWifiSmeAmpStatusChangeIndSer CsrWifiEventCsrUint16CsrUint8Ser diff --git a/drivers/staging/csr/sme_userspace.h b/drivers/staging/csr/sme_userspace.h index e266efb..7816b15 100644 --- a/drivers/staging/csr/sme_userspace.h +++ b/drivers/staging/csr/sme_userspace.h @@ -32,7 +32,7 @@ int uf_sme_queue_message(unifi_priv_t *priv, u8 *buffer, int length); #include "csr_wifi_sme_lib.h" void CsrWifiRouterTransportInit(unifi_priv_t *priv); -void CsrWifiRouterTransportRecv(unifi_priv_t *priv, u8* buffer, CsrSize bufferLength); +void CsrWifiRouterTransportRecv(unifi_priv_t *priv, u8* buffer, size_t bufferLength); void CsrWifiRouterTransportDeInit(unifi_priv_t *priv); #endif /* __LINUX_SME_USERSPACE_H__ */ -- cgit v0.10.2 From 3c0b461e4c8fde467bd803e368d9a78ec2da5f8a Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 12:35:14 -0700 Subject: staging: csr: remove odd pointer typedefs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No one was using CsrPtrdiff or CsrUintptr, but CsrIntptr is used in one place, so replace that with ptrdiff_t. Odds are all it really wants is a void * there, but hey, I'll play along for now. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_types.h b/drivers/staging/csr/csr_types.h index fb0f07c..76f95615 100644 --- a/drivers/staging/csr/csr_types.h +++ b/drivers/staging/csr/csr_types.h @@ -26,11 +26,6 @@ extern "C" { #undef TRUE #define TRUE (1) -/* Basic types */ -typedef ptrdiff_t CsrPtrdiff; /* Type of the result of subtracting two pointers (ISO/IEC 9899:1990 7.1.6) */ -typedef uintptr_t CsrUintptr; /* Unsigned integer large enough to hold any pointer (ISO/IEC 9899:1999 7.18.1.4) */ -typedef ptrdiff_t CsrIntptr; /* intptr_t is not defined in kernel. Use the equivalent ptrdiff_t. */ - /* * 64-bit integers * diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c index 8aba828..9f2343c 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c @@ -1740,7 +1740,7 @@ static CsrResult process_bulk_data_command(card_t *card, const u8 *cmdptr, /* if os_data_ptr is not 4-byte aligned, then allocate a new buffer and copy data to new buffer to ensure the address passed to unifi_bulk_rw is 4-byte aligned */ - if (len != 0 && (dir == UNIFI_SDIO_WRITE) && (((CsrIntptr)bdslot->os_data_ptr + offset) & 3)) + if (len != 0 && (dir == UNIFI_SDIO_WRITE) && (((ptrdiff_t)bdslot->os_data_ptr + offset) & 3)) { host_bulk_data_slot = CsrMemAllocDma(len); @@ -1799,7 +1799,7 @@ static CsrResult process_bulk_data_command(card_t *card, const u8 *cmdptr, #ifdef CSR_WIFI_ALIGNMENT_WORKAROUND /* moving this check before we clear host data slot */ - if ((len != 0) && (dir == UNIFI_SDIO_WRITE) && (((CsrIntptr)bdslot->os_data_ptr + offset) & 3)) + if ((len != 0) && (dir == UNIFI_SDIO_WRITE) && (((ptrdiff_t)bdslot->os_data_ptr + offset) & 3)) { CsrMemFreeDma(host_bulk_data_slot); } -- cgit v0.10.2 From b6b5244e4f1ccf838cce8499732449f26c119b88 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 12:40:30 -0700 Subject: staging: csr: remove CsrUint64 and CsrInt64 typedefs. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CsrInt64 wasn't being used, and CsrUint64 was only used in one place, so replace that with u64. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_time.c b/drivers/staging/csr/csr_time.c index 1ef61e3..9e5aa90 100644 --- a/drivers/staging/csr/csr_time.c +++ b/drivers/staging/csr/csr_time.c @@ -26,11 +26,11 @@ CsrTime CsrTimeGet(CsrTime *high) { struct timespec ts; - CsrUint64 time; + u64 time; CsrTime low; ts = current_kernel_time(); - time = (CsrUint64) ts.tv_sec * 1000000 + ts.tv_nsec / 1000; + time = (u64) ts.tv_sec * 1000000 + ts.tv_nsec / 1000; if (high != NULL) { @@ -46,10 +46,10 @@ EXPORT_SYMBOL_GPL(CsrTimeGet); void CsrTimeUtcGet(CsrTimeUtc *tod, CsrTime *low, CsrTime *high) { struct timespec ts; - CsrUint64 time; + u64 time; ts = current_kernel_time(); - time = (CsrUint64) ts.tv_sec * 1000000 + ts.tv_nsec / 1000; + time = (u64) ts.tv_sec * 1000000 + ts.tv_nsec / 1000; if (high != NULL) { diff --git a/drivers/staging/csr/csr_types.h b/drivers/staging/csr/csr_types.h index 76f95615..7018c0a 100644 --- a/drivers/staging/csr/csr_types.h +++ b/drivers/staging/csr/csr_types.h @@ -26,19 +26,6 @@ extern "C" { #undef TRUE #define TRUE (1) -/* - * 64-bit integers - * - * Note: If a given compiler does not support 64-bit types, it is - * OK to omit these definitions; 32-bit versions of the code using - * these types may be available. Consult the relevant documentation - * or the customer support group for information on this. - */ -#define CSR_HAVE_64_BIT_INTEGERS -typedef uint64_t CsrUint64; -typedef int64_t CsrInt64; - - #ifdef __cplusplus } #endif -- cgit v0.10.2 From 980b5a2b0d90294a8b56cf999ecd1a5c31e5a173 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 13:07:13 -0700 Subject: staging: csr: remove csr_types.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only thing left in here is the TRUE/FALSE #defines, so move them to csr_macro.h and remove the file. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_formatted_io.c b/drivers/staging/csr/csr_formatted_io.c index d26fd78..51fb988 100644 --- a/drivers/staging/csr/csr_formatted_io.c +++ b/drivers/staging/csr/csr_formatted_io.c @@ -8,7 +8,6 @@ *****************************************************************************/ -#include "csr_types.h" #include "csr_formatted_io.h" #include "csr_util.h" diff --git a/drivers/staging/csr/csr_formatted_io.h b/drivers/staging/csr/csr_formatted_io.h index c87f637..2e238cb 100644 --- a/drivers/staging/csr/csr_formatted_io.h +++ b/drivers/staging/csr/csr_formatted_io.h @@ -14,7 +14,7 @@ extern "C" { #endif -#include "csr_types.h" +#include s32 CsrSnprintf(char *dest, size_t n, const char *fmt, ...); diff --git a/drivers/staging/csr/csr_framework_ext.c b/drivers/staging/csr/csr_framework_ext.c index 6b9ac92..7a0d660 100644 --- a/drivers/staging/csr/csr_framework_ext.c +++ b/drivers/staging/csr/csr_framework_ext.c @@ -28,7 +28,6 @@ #include -#include "csr_types.h" #include "csr_framework_ext.h" #include "csr_panic.h" diff --git a/drivers/staging/csr/csr_framework_ext.h b/drivers/staging/csr/csr_framework_ext.h index 58cc22c..46689c1 100644 --- a/drivers/staging/csr/csr_framework_ext.h +++ b/drivers/staging/csr/csr_framework_ext.h @@ -10,7 +10,6 @@ *****************************************************************************/ -#include "csr_types.h" #include "csr_result.h" #include "csr_framework_ext_types.h" diff --git a/drivers/staging/csr/csr_framework_ext_types.h b/drivers/staging/csr/csr_framework_ext_types.h index b1ff72f..57194ee 100644 --- a/drivers/staging/csr/csr_framework_ext_types.h +++ b/drivers/staging/csr/csr_framework_ext_types.h @@ -10,8 +10,6 @@ *****************************************************************************/ -#include "csr_types.h" - #ifdef __KERNEL__ #include #include diff --git a/drivers/staging/csr/csr_lib.h b/drivers/staging/csr/csr_lib.h index 841d7ec..b1a57d5 100644 --- a/drivers/staging/csr/csr_lib.h +++ b/drivers/staging/csr/csr_lib.h @@ -10,7 +10,6 @@ *****************************************************************************/ -#include "csr_types.h" #include "csr_prim_defs.h" #ifdef __cplusplus diff --git a/drivers/staging/csr/csr_log.h b/drivers/staging/csr/csr_log.h index 2619d22..b280856 100644 --- a/drivers/staging/csr/csr_log.h +++ b/drivers/staging/csr/csr_log.h @@ -10,7 +10,6 @@ *****************************************************************************/ -#include "csr_types.h" #include "csr_sched.h" #include "csr_panic.h" #include "csr_prim_defs.h" diff --git a/drivers/staging/csr/csr_log_configure.h b/drivers/staging/csr/csr_log_configure.h index 48e8a22..8842e4b 100644 --- a/drivers/staging/csr/csr_log_configure.h +++ b/drivers/staging/csr/csr_log_configure.h @@ -10,7 +10,6 @@ *****************************************************************************/ -#include "csr_types.h" #include "csr_log.h" #ifdef __cplusplus diff --git a/drivers/staging/csr/csr_log_text.h b/drivers/staging/csr/csr_log_text.h index 9fc2aa2..9fe6c90 100644 --- a/drivers/staging/csr/csr_log_text.h +++ b/drivers/staging/csr/csr_log_text.h @@ -10,7 +10,6 @@ *****************************************************************************/ -#include "csr_types.h" #include "csr_log_configure.h" #ifdef __cplusplus diff --git a/drivers/staging/csr/csr_macro.h b/drivers/staging/csr/csr_macro.h index 22405cf..57cbfcb 100644 --- a/drivers/staging/csr/csr_macro.h +++ b/drivers/staging/csr/csr_macro.h @@ -10,12 +10,15 @@ *****************************************************************************/ -#include "csr_types.h" +#include #ifdef __cplusplus extern "C" { #endif +#define FALSE (0) +#define TRUE (1) + /*------------------------------------------------------------------*/ /* Bits - intended to operate on u32 values */ /*------------------------------------------------------------------*/ diff --git a/drivers/staging/csr/csr_msgconv.c b/drivers/staging/csr/csr_msgconv.c index ad01958..a2e0842 100644 --- a/drivers/staging/csr/csr_msgconv.c +++ b/drivers/staging/csr/csr_msgconv.c @@ -9,7 +9,7 @@ *****************************************************************************/ #include -#include "csr_types.h" +#include #include "csr_pmem.h" #include "csr_panic.h" #include "csr_sched.h" diff --git a/drivers/staging/csr/csr_msgconv.h b/drivers/staging/csr/csr_msgconv.h index 5aefda3..2e1aad8 100644 --- a/drivers/staging/csr/csr_msgconv.h +++ b/drivers/staging/csr/csr_msgconv.h @@ -11,7 +11,7 @@ *****************************************************************************/ -#include "csr_types.h" +#include #include "csr_prim_defs.h" #include "csr_sched.h" #include "csr_unicode.h" diff --git a/drivers/staging/csr/csr_panic.c b/drivers/staging/csr/csr_panic.c index 0b78a72..353a829 100644 --- a/drivers/staging/csr/csr_panic.c +++ b/drivers/staging/csr/csr_panic.c @@ -12,7 +12,6 @@ #include #include -#include "csr_types.h" #include "csr_panic.h" void CsrPanic(u8 tech, u16 reason, const char *p) diff --git a/drivers/staging/csr/csr_panic.h b/drivers/staging/csr/csr_panic.h index e993baf..37989fc 100644 --- a/drivers/staging/csr/csr_panic.h +++ b/drivers/staging/csr/csr_panic.h @@ -9,8 +9,6 @@ on the license terms. *****************************************************************************/ -#include "csr_types.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/drivers/staging/csr/csr_pmem.h b/drivers/staging/csr/csr_pmem.h index 7962815..36adf22 100644 --- a/drivers/staging/csr/csr_pmem.h +++ b/drivers/staging/csr/csr_pmem.h @@ -10,7 +10,7 @@ *****************************************************************************/ -#include "csr_types.h" +#include #include "csr_util.h" #ifdef __cplusplus diff --git a/drivers/staging/csr/csr_prim_defs.h b/drivers/staging/csr/csr_prim_defs.h index 7d47578..6a7f73d 100644 --- a/drivers/staging/csr/csr_prim_defs.h +++ b/drivers/staging/csr/csr_prim_defs.h @@ -9,8 +9,6 @@ on the license terms. *****************************************************************************/ -#include "csr_types.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/drivers/staging/csr/csr_result.h b/drivers/staging/csr/csr_result.h index 68fb759..c7c36d6 100644 --- a/drivers/staging/csr/csr_result.h +++ b/drivers/staging/csr/csr_result.h @@ -10,8 +10,6 @@ *****************************************************************************/ -#include "csr_types.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/drivers/staging/csr/csr_sched.h b/drivers/staging/csr/csr_sched.h index 663fe59..e42fca9 100644 --- a/drivers/staging/csr/csr_sched.h +++ b/drivers/staging/csr/csr_sched.h @@ -9,7 +9,7 @@ on the license terms. *****************************************************************************/ -#include "csr_types.h" +#include #include "csr_time.h" #ifdef __cplusplus diff --git a/drivers/staging/csr/csr_sdio.h b/drivers/staging/csr/csr_sdio.h index 861604d..f0cda84 100644 --- a/drivers/staging/csr/csr_sdio.h +++ b/drivers/staging/csr/csr_sdio.h @@ -10,7 +10,6 @@ *****************************************************************************/ -#include "csr_types.h" #include "csr_result.h" #ifdef __cplusplus diff --git a/drivers/staging/csr/csr_serialize_primitive_types.c b/drivers/staging/csr/csr_serialize_primitive_types.c index 169d6bc..5fb026c 100644 --- a/drivers/staging/csr/csr_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_serialize_primitive_types.c @@ -9,7 +9,6 @@ *****************************************************************************/ #include -#include "csr_types.h" #include "csr_prim_defs.h" #include "csr_msgconv.h" #include "csr_util.h" diff --git a/drivers/staging/csr/csr_time.c b/drivers/staging/csr/csr_time.c index 9e5aa90..4d83674 100644 --- a/drivers/staging/csr/csr_time.c +++ b/drivers/staging/csr/csr_time.c @@ -20,7 +20,6 @@ #include #include -#include "csr_types.h" #include "csr_time.h" CsrTime CsrTimeGet(CsrTime *high) diff --git a/drivers/staging/csr/csr_time.h b/drivers/staging/csr/csr_time.h index 286b289..09eeeee 100644 --- a/drivers/staging/csr/csr_time.h +++ b/drivers/staging/csr/csr_time.h @@ -10,7 +10,7 @@ *****************************************************************************/ -#include "csr_types.h" +#include #ifdef __cplusplus extern "C" { diff --git a/drivers/staging/csr/csr_types.h b/drivers/staging/csr/csr_types.h deleted file mode 100644 index 7018c0a..0000000 --- a/drivers/staging/csr/csr_types.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef CSR_TYPES_H__ -#define CSR_TYPES_H__ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#undef FALSE -#define FALSE (0) - -#undef TRUE -#define TRUE (1) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/drivers/staging/csr/csr_unicode.h b/drivers/staging/csr/csr_unicode.h index 701aae8..44d7fd9 100644 --- a/drivers/staging/csr/csr_unicode.h +++ b/drivers/staging/csr/csr_unicode.h @@ -10,8 +10,6 @@ *****************************************************************************/ -#include "csr_types.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index c1c3b89..46bd130 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -8,7 +8,6 @@ *****************************************************************************/ #include -#include "csr_types.h" #include "csr_pmem.h" #include "csr_unicode.h" #include "csr_util.h" diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index fa2b2b4..4a9bde0 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -12,7 +12,6 @@ #include #include -#include "csr_types.h" #include "csr_pmem.h" #include "csr_util.h" diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index 222e807..a124c73 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -14,7 +14,8 @@ extern "C" { #endif -#include "csr_types.h" +#include +#include #include "csr_macro.h" /*------------------------------------------------------------------*/ diff --git a/drivers/staging/csr/csr_wifi_common.h b/drivers/staging/csr/csr_wifi_common.h index df04a8b..cc41a94 100644 --- a/drivers/staging/csr/csr_wifi_common.h +++ b/drivers/staging/csr/csr_wifi_common.h @@ -11,7 +11,7 @@ #ifndef CSR_WIFI_COMMON_H__ #define CSR_WIFI_COMMON_H__ -#include "csr_types.h" +#include #include "csr_result.h" #ifdef __cplusplus diff --git a/drivers/staging/csr/csr_wifi_fsm.h b/drivers/staging/csr/csr_wifi_fsm.h index d078dee..83a9c9e 100644 --- a/drivers/staging/csr/csr_wifi_fsm.h +++ b/drivers/staging/csr/csr_wifi_fsm.h @@ -15,7 +15,6 @@ extern "C" { #endif -#include "csr_types.h" #include "csr_pmem.h" #include "csr_prim_defs.h" #include "csr_log_text.h" diff --git a/drivers/staging/csr/csr_wifi_fsm_event.h b/drivers/staging/csr/csr_wifi_fsm_event.h index 47ca245..57a5caf 100644 --- a/drivers/staging/csr/csr_wifi_fsm_event.h +++ b/drivers/staging/csr/csr_wifi_fsm_event.h @@ -15,7 +15,6 @@ extern "C" { #endif -#include "csr_types.h" #include "csr_prim_defs.h" #include "csr_sched.h" diff --git a/drivers/staging/csr/csr_wifi_fsm_types.h b/drivers/staging/csr/csr_wifi_fsm_types.h index f3837c6..c378cca 100644 --- a/drivers/staging/csr/csr_wifi_fsm_types.h +++ b/drivers/staging/csr/csr_wifi_fsm_types.h @@ -15,7 +15,7 @@ extern "C" { #endif -#include "csr_types.h" +#include #include "csr_util.h" #include "csr_pmem.h" #include "csr_panic.h" diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper.c b/drivers/staging/csr/csr_wifi_hip_chiphelper.c index 1654d28..5cf5b8a 100644 --- a/drivers/staging/csr/csr_wifi_hip_chiphelper.c +++ b/drivers/staging/csr/csr_wifi_hip_chiphelper.c @@ -8,7 +8,7 @@ *****************************************************************************/ - +#include "csr_macro.h" #include "csr_wifi_hip_chiphelper_private.h" #ifndef nelem diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper.h b/drivers/staging/csr/csr_wifi_hip_chiphelper.h index 1047f16..24737ae 100644 --- a/drivers/staging/csr/csr_wifi_hip_chiphelper.h +++ b/drivers/staging/csr/csr_wifi_hip_chiphelper.h @@ -12,7 +12,7 @@ #define CSR_WIFI_HIP_CHIPHELPER_H__ -#include "csr_types.h" +#include #ifdef __cplusplus extern "C" { diff --git a/drivers/staging/csr/csr_wifi_hip_signals.h b/drivers/staging/csr/csr_wifi_hip_signals.h index 29c9a7c..5f84155 100644 --- a/drivers/staging/csr/csr_wifi_hip_signals.h +++ b/drivers/staging/csr/csr_wifi_hip_signals.h @@ -24,7 +24,7 @@ #ifndef __CSR_WIFI_HIP_SIGNALS_H__ #define __CSR_WIFI_HIP_SIGNALS_H__ -#include "csr_types.h" +#include #include "csr_wifi_hip_sigs.h" diff --git a/drivers/staging/csr/csr_wifi_hip_unifi.h b/drivers/staging/csr/csr_wifi_hip_unifi.h index 50d458e..88f24ba 100644 --- a/drivers/staging/csr/csr_wifi_hip_unifi.h +++ b/drivers/staging/csr/csr_wifi_hip_unifi.h @@ -95,7 +95,6 @@ extern "C" { #define UNIFI_SOFT_TRAFFIC_Q_LENGTH (20 + 1) #define UNIFI_SOFT_COMMAND_Q_LENGTH (16 + 1) -#include "csr_types.h" /* from the synergy porting folder */ #include "csr_framework_ext.h" /* from the synergy porting folder */ #include "csr_sdio.h" /* from the synergy porting folder */ #include "csr_pmem.h" /* from the synergy porting folder */ diff --git a/drivers/staging/csr/csr_wifi_lib.h b/drivers/staging/csr/csr_wifi_lib.h index 861e4a4..eb56f62 100644 --- a/drivers/staging/csr/csr_wifi_lib.h +++ b/drivers/staging/csr/csr_wifi_lib.h @@ -10,7 +10,6 @@ #ifndef CSR_WIFI_LIB_H__ #define CSR_WIFI_LIB_H__ -#include "csr_types.h" #include "csr_wifi_fsm_event.h" diff --git a/drivers/staging/csr/csr_wifi_msgconv.h b/drivers/staging/csr/csr_wifi_msgconv.h index 4508262..0631410 100644 --- a/drivers/staging/csr/csr_wifi_msgconv.h +++ b/drivers/staging/csr/csr_wifi_msgconv.h @@ -11,7 +11,6 @@ #ifndef CSR_WIFI_MSGCONV_H__ #define CSR_WIFI_MSGCONV_H__ -#include "csr_types.h" #include "csr_prim_defs.h" #include "csr_sched.h" #include "csr_unicode.h" diff --git a/drivers/staging/csr/csr_wifi_nme_ap_lib.h b/drivers/staging/csr/csr_wifi_nme_ap_lib.h index a74ec69..b7ebfe4 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_lib.h +++ b/drivers/staging/csr/csr_wifi_nme_ap_lib.h @@ -13,7 +13,6 @@ #ifndef CSR_WIFI_NME_AP_LIB_H__ #define CSR_WIFI_NME_AP_LIB_H__ -#include "csr_types.h" #include "csr_pmem.h" #include "csr_sched.h" #include "csr_util.h" diff --git a/drivers/staging/csr/csr_wifi_nme_ap_prim.h b/drivers/staging/csr/csr_wifi_nme_ap_prim.h index 1ca0ec9..ec67046 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_prim.h +++ b/drivers/staging/csr/csr_wifi_nme_ap_prim.h @@ -13,7 +13,6 @@ #ifndef CSR_WIFI_NME_AP_PRIM_H__ #define CSR_WIFI_NME_AP_PRIM_H__ -#include "csr_types.h" #include "csr_prim_defs.h" #include "csr_sched.h" #include "csr_wifi_common.h" diff --git a/drivers/staging/csr/csr_wifi_nme_ap_serialize.h b/drivers/staging/csr/csr_wifi_nme_ap_serialize.h index 5f85b01..524da14 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_serialize.h +++ b/drivers/staging/csr/csr_wifi_nme_ap_serialize.h @@ -13,7 +13,6 @@ #ifndef CSR_WIFI_NME_AP_SERIALIZE_H__ #define CSR_WIFI_NME_AP_SERIALIZE_H__ -#include "csr_types.h" #include "csr_pmem.h" #include "csr_wifi_msgconv.h" diff --git a/drivers/staging/csr/csr_wifi_nme_lib.h b/drivers/staging/csr/csr_wifi_nme_lib.h index c38f78e..4ec7b94 100644 --- a/drivers/staging/csr/csr_wifi_nme_lib.h +++ b/drivers/staging/csr/csr_wifi_nme_lib.h @@ -13,7 +13,6 @@ #ifndef CSR_WIFI_NME_LIB_H__ #define CSR_WIFI_NME_LIB_H__ -#include "csr_types.h" #include "csr_pmem.h" #include "csr_sched.h" #include "csr_util.h" diff --git a/drivers/staging/csr/csr_wifi_nme_prim.h b/drivers/staging/csr/csr_wifi_nme_prim.h index 4676b42..20dc779 100644 --- a/drivers/staging/csr/csr_wifi_nme_prim.h +++ b/drivers/staging/csr/csr_wifi_nme_prim.h @@ -13,7 +13,7 @@ #ifndef CSR_WIFI_NME_PRIM_H__ #define CSR_WIFI_NME_PRIM_H__ -#include "csr_types.h" +#include #include "csr_prim_defs.h" #include "csr_sched.h" #include "csr_wifi_common.h" diff --git a/drivers/staging/csr/csr_wifi_nme_serialize.h b/drivers/staging/csr/csr_wifi_nme_serialize.h index 2acc6c1..dca36d9 100644 --- a/drivers/staging/csr/csr_wifi_nme_serialize.h +++ b/drivers/staging/csr/csr_wifi_nme_serialize.h @@ -13,7 +13,6 @@ #ifndef CSR_WIFI_NME_SERIALIZE_H__ #define CSR_WIFI_NME_SERIALIZE_H__ -#include "csr_types.h" #include "csr_pmem.h" #include "csr_wifi_msgconv.h" diff --git a/drivers/staging/csr/csr_wifi_nme_task.h b/drivers/staging/csr/csr_wifi_nme_task.h index 2a03a19..76f44db 100644 --- a/drivers/staging/csr/csr_wifi_nme_task.h +++ b/drivers/staging/csr/csr_wifi_nme_task.h @@ -13,7 +13,7 @@ #ifndef CSR_WIFI_NME_TASK_H__ #define CSR_WIFI_NME_TASK_H__ -#include "csr_types.h" +#include #include "csr_sched.h" #ifdef __cplusplus diff --git a/drivers/staging/csr/csr_wifi_private_common.h b/drivers/staging/csr/csr_wifi_private_common.h index 878b23b..4730998 100644 --- a/drivers/staging/csr/csr_wifi_private_common.h +++ b/drivers/staging/csr/csr_wifi_private_common.h @@ -11,8 +11,6 @@ #ifndef CSR_WIFI_PRIVATE_COMMON_H__ #define CSR_WIFI_PRIVATE_COMMON_H__ -#include "csr_types.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/drivers/staging/csr/csr_wifi_result.h b/drivers/staging/csr/csr_wifi_result.h index 95b73a0..2f87cda 100644 --- a/drivers/staging/csr/csr_wifi_result.h +++ b/drivers/staging/csr/csr_wifi_result.h @@ -11,7 +11,6 @@ #ifndef CSR_WIFI_RESULT_H__ #define CSR_WIFI_RESULT_H__ -#include "csr_types.h" #include "csr_result.h" #ifdef __cplusplus diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_lib.h b/drivers/staging/csr/csr_wifi_router_ctrl_lib.h index d837eea..df9dd9b 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_lib.h +++ b/drivers/staging/csr/csr_wifi_router_ctrl_lib.h @@ -13,7 +13,6 @@ #ifndef CSR_WIFI_ROUTER_CTRL_LIB_H__ #define CSR_WIFI_ROUTER_CTRL_LIB_H__ -#include "csr_types.h" #include "csr_pmem.h" #include "csr_sched.h" #include "csr_util.h" diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_prim.h b/drivers/staging/csr/csr_wifi_router_ctrl_prim.h index f5ad3b3..ec972ac 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_prim.h +++ b/drivers/staging/csr/csr_wifi_router_ctrl_prim.h @@ -13,7 +13,7 @@ #ifndef CSR_WIFI_ROUTER_CTRL_PRIM_H__ #define CSR_WIFI_ROUTER_CTRL_PRIM_H__ -#include "csr_types.h" +#include #include "csr_prim_defs.h" #include "csr_sched.h" #include "csr_wifi_common.h" diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h index 458fb96..f270377 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h +++ b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h @@ -13,7 +13,6 @@ #ifndef CSR_WIFI_ROUTER_CTRL_SERIALIZE_H__ #define CSR_WIFI_ROUTER_CTRL_SERIALIZE_H__ -#include "csr_types.h" #include "csr_pmem.h" #include "csr_wifi_msgconv.h" diff --git a/drivers/staging/csr/csr_wifi_router_lib.h b/drivers/staging/csr/csr_wifi_router_lib.h index ae0965b..2ca557c 100644 --- a/drivers/staging/csr/csr_wifi_router_lib.h +++ b/drivers/staging/csr/csr_wifi_router_lib.h @@ -13,7 +13,6 @@ #ifndef CSR_WIFI_ROUTER_LIB_H__ #define CSR_WIFI_ROUTER_LIB_H__ -#include "csr_types.h" #include "csr_pmem.h" #include "csr_sched.h" #include "csr_util.h" diff --git a/drivers/staging/csr/csr_wifi_router_prim.h b/drivers/staging/csr/csr_wifi_router_prim.h index 64b1f4f..c61486f 100644 --- a/drivers/staging/csr/csr_wifi_router_prim.h +++ b/drivers/staging/csr/csr_wifi_router_prim.h @@ -13,7 +13,7 @@ #ifndef CSR_WIFI_ROUTER_PRIM_H__ #define CSR_WIFI_ROUTER_PRIM_H__ -#include "csr_types.h" +#include #include "csr_prim_defs.h" #include "csr_sched.h" #include "csr_wifi_common.h" diff --git a/drivers/staging/csr/csr_wifi_router_serialize.h b/drivers/staging/csr/csr_wifi_router_serialize.h index e6fdf32..4951c40 100644 --- a/drivers/staging/csr/csr_wifi_router_serialize.h +++ b/drivers/staging/csr/csr_wifi_router_serialize.h @@ -13,7 +13,6 @@ #ifndef CSR_WIFI_ROUTER_SERIALIZE_H__ #define CSR_WIFI_ROUTER_SERIALIZE_H__ -#include "csr_types.h" #include "csr_pmem.h" #include "csr_wifi_msgconv.h" diff --git a/drivers/staging/csr/csr_wifi_router_task.h b/drivers/staging/csr/csr_wifi_router_task.h index 5bc460e..4e51fae 100644 --- a/drivers/staging/csr/csr_wifi_router_task.h +++ b/drivers/staging/csr/csr_wifi_router_task.h @@ -13,7 +13,6 @@ #ifndef CSR_WIFI_ROUTER_TASK_H__ #define CSR_WIFI_ROUTER_TASK_H__ -#include "csr_types.h" #include "csr_sched.h" #ifdef __cplusplus diff --git a/drivers/staging/csr/csr_wifi_router_transport.c b/drivers/staging/csr/csr_wifi_router_transport.c index e42b21f..f340780 100644 --- a/drivers/staging/csr/csr_wifi_router_transport.c +++ b/drivers/staging/csr/csr_wifi_router_transport.c @@ -10,7 +10,6 @@ #include "unifi_priv.h" -#include "csr_types.h" #include "csr_sched.h" #include "csr_msgconv.h" diff --git a/drivers/staging/csr/csr_wifi_serialize_primitive_types.c b/drivers/staging/csr/csr_wifi_serialize_primitive_types.c index 743dbdc..e73f94b 100644 --- a/drivers/staging/csr/csr_wifi_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_wifi_serialize_primitive_types.c @@ -9,7 +9,6 @@ *****************************************************************************/ #include -#include "csr_types.h" #include "csr_pmem.h" #include "csr_util.h" #include "csr_msgconv.h" diff --git a/drivers/staging/csr/csr_wifi_sme_ap_lib.h b/drivers/staging/csr/csr_wifi_sme_ap_lib.h index cacb3a5..22a3419 100644 --- a/drivers/staging/csr/csr_wifi_sme_ap_lib.h +++ b/drivers/staging/csr/csr_wifi_sme_ap_lib.h @@ -13,7 +13,6 @@ #ifndef CSR_WIFI_SME_AP_LIB_H__ #define CSR_WIFI_SME_AP_LIB_H__ -#include "csr_types.h" #include "csr_pmem.h" #include "csr_sched.h" #include "csr_util.h" diff --git a/drivers/staging/csr/csr_wifi_sme_ap_prim.h b/drivers/staging/csr/csr_wifi_sme_ap_prim.h index 01df2a5..93b64e9 100644 --- a/drivers/staging/csr/csr_wifi_sme_ap_prim.h +++ b/drivers/staging/csr/csr_wifi_sme_ap_prim.h @@ -13,7 +13,6 @@ #ifndef CSR_WIFI_SME_AP_PRIM_H__ #define CSR_WIFI_SME_AP_PRIM_H__ -#include "csr_types.h" #include "csr_prim_defs.h" #include "csr_sched.h" #include "csr_wifi_common.h" diff --git a/drivers/staging/csr/csr_wifi_sme_lib.h b/drivers/staging/csr/csr_wifi_sme_lib.h index 6960f8f..f320bd4 100644 --- a/drivers/staging/csr/csr_wifi_sme_lib.h +++ b/drivers/staging/csr/csr_wifi_sme_lib.h @@ -13,7 +13,6 @@ #ifndef CSR_WIFI_SME_LIB_H__ #define CSR_WIFI_SME_LIB_H__ -#include "csr_types.h" #include "csr_pmem.h" #include "csr_sched.h" #include "csr_util.h" diff --git a/drivers/staging/csr/csr_wifi_sme_prim.h b/drivers/staging/csr/csr_wifi_sme_prim.h index 84eb6e9..55cac50 100644 --- a/drivers/staging/csr/csr_wifi_sme_prim.h +++ b/drivers/staging/csr/csr_wifi_sme_prim.h @@ -13,7 +13,7 @@ #ifndef CSR_WIFI_SME_PRIM_H__ #define CSR_WIFI_SME_PRIM_H__ -#include "csr_types.h" +#include #include "csr_prim_defs.h" #include "csr_sched.h" #include "csr_wifi_common.h" diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.h b/drivers/staging/csr/csr_wifi_sme_serialize.h index e8d5000..9ea9d15 100644 --- a/drivers/staging/csr/csr_wifi_sme_serialize.h +++ b/drivers/staging/csr/csr_wifi_sme_serialize.h @@ -13,7 +13,6 @@ #ifndef CSR_WIFI_SME_SERIALIZE_H__ #define CSR_WIFI_SME_SERIALIZE_H__ -#include "csr_types.h" #include "csr_pmem.h" #include "csr_wifi_msgconv.h" diff --git a/drivers/staging/csr/csr_wifi_sme_task.h b/drivers/staging/csr/csr_wifi_sme_task.h index 62cc8b7..0f725e4 100644 --- a/drivers/staging/csr/csr_wifi_sme_task.h +++ b/drivers/staging/csr/csr_wifi_sme_task.h @@ -13,7 +13,6 @@ #ifndef CSR_WIFI_SME_TASK_H__ #define CSR_WIFI_SME_TASK_H__ -#include "csr_types.h" #include "csr_sched.h" #ifdef __cplusplus diff --git a/drivers/staging/csr/unifiio.h b/drivers/staging/csr/unifiio.h index 9acf9ee..b9de0cb 100644 --- a/drivers/staging/csr/unifiio.h +++ b/drivers/staging/csr/unifiio.h @@ -19,7 +19,6 @@ #define __UNIFIIO_H__ #include -#include "csr_types.h" #define UNIFI_GET_UDI_ENABLE _IOR('u', 1, int) #define UNIFI_SET_UDI_ENABLE _IOW('u', 2, int) -- cgit v0.10.2 From c97dbc89bf21d7ef7297b90e0139a27fc10e9cd1 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 13:13:04 -0700 Subject: staging: csr: remove indications.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's an empty file, no need to build and link it. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/Makefile b/drivers/staging/csr/Makefile index 1c1685b..f4a8950 100644 --- a/drivers/staging/csr/Makefile +++ b/drivers/staging/csr/Makefile @@ -9,7 +9,6 @@ csr_wifi-y := bh.o \ data_tx.o \ drv.o \ firmware.o \ - indications.o \ inet.o \ init_hw.o \ io.o \ diff --git a/drivers/staging/csr/indications.c b/drivers/staging/csr/indications.c deleted file mode 100644 index 834b5f3..0000000 --- a/drivers/staging/csr/indications.c +++ /dev/null @@ -1,18 +0,0 @@ -/* - * *************************************************************************** - * FILE: indications.c - * - * PURPOSE: - * Callbacks to process signals sent to us by the UniFi chip. - * - * This file is linux-specific. - * - * Copyright (C) 2005-2008 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * *************************************************************************** - */ -#include "csr_wifi_hip_unifi.h" -#include "unifi_priv.h" -- cgit v0.10.2 From 957417bfeca2893254e660b01e18e71bd4572a38 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 14:11:58 -0700 Subject: staging: csr: remove a bunch of unused functions in csr_util.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They were wrappers for other functions already in the kernel, and no one was even calling them, so remove them. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index 4a9bde0..48ed9b7 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -16,179 +16,9 @@ #include "csr_util.h" /*------------------------------------------------------------------*/ -/* Bits */ -/*------------------------------------------------------------------*/ - -/* Time proportional with the number of 1's */ -u8 CsrBitCountSparse(u32 n) -{ - u8 count = 0; - - while (n) - { - count++; - n &= (n - 1); - } - - return count; -} - -/* Time proportional with the number of 0's */ -u8 CsrBitCountDense(u32 n) -{ - u8 count = 8 * sizeof(u32); - - n ^= (u32) (-1); - - while (n) - { - count--; - n &= (n - 1); - } - - return count; -} - -/*------------------------------------------------------------------*/ /* Base conversion */ /*------------------------------------------------------------------*/ -u8 CsrHexStrToUint8(const char *string, u8 *returnValue) -{ - u16 currentIndex = 0; - *returnValue = 0; - if ((string[currentIndex] == '0') && (CSR_TOUPPER(string[currentIndex + 1]) == 'X')) - { - string += 2; - } - if (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) || ((CSR_TOUPPER(string[currentIndex]) >= 'A') && (CSR_TOUPPER(string[currentIndex]) <= 'F'))) - { - while (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) || ((CSR_TOUPPER(string[currentIndex]) >= 'A') && (CSR_TOUPPER(string[currentIndex]) <= 'F'))) - { - *returnValue = (u8) (*returnValue * 16 + (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) ? string[currentIndex] - '0' : CSR_TOUPPER(string[currentIndex]) - 'A' + 10)); - currentIndex++; - if (currentIndex >= 2) - { - break; - } - } - return TRUE; - } - return FALSE; -} - -u8 CsrHexStrToUint16(const char *string, u16 *returnValue) -{ - u16 currentIndex = 0; - *returnValue = 0; - if ((string[currentIndex] == '0') && (CSR_TOUPPER(string[currentIndex + 1]) == 'X')) - { - string += 2; - } - if (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) || ((CSR_TOUPPER(string[currentIndex]) >= 'A') && (CSR_TOUPPER(string[currentIndex]) <= 'F'))) - { - while (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) || ((CSR_TOUPPER(string[currentIndex]) >= 'A') && (CSR_TOUPPER(string[currentIndex]) <= 'F'))) - { - *returnValue = (u16) (*returnValue * 16 + (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) ? string[currentIndex] - '0' : CSR_TOUPPER(string[currentIndex]) - 'A' + 10)); - currentIndex++; - if (currentIndex >= 4) - { - break; - } - } - return TRUE; - } - return FALSE; -} - -u8 CsrHexStrToUint32(const char *string, u32 *returnValue) -{ - u16 currentIndex = 0; - *returnValue = 0; - if ((string[currentIndex] == '0') && (CSR_TOUPPER(string[currentIndex + 1]) == 'X')) - { - string += 2; - } - if (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) || ((CSR_TOUPPER(string[currentIndex]) >= 'A') && (CSR_TOUPPER(string[currentIndex]) <= 'F'))) - { - while (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) || ((CSR_TOUPPER(string[currentIndex]) >= 'A') && (CSR_TOUPPER(string[currentIndex]) <= 'F'))) - { - *returnValue = *returnValue * 16 + (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) ? string[currentIndex] - '0' : CSR_TOUPPER(string[currentIndex]) - 'A' + 10); - currentIndex++; - if (currentIndex >= 8) - { - break; - } - } - return TRUE; - } - return FALSE; -} - -u32 CsrPow(u32 base, u32 exponent) -{ - if (exponent == 0) - { - return 1; - } - else - { - u32 i, t = base; - - for (i = 1; i < exponent; i++) - { - t = t * base; - } - return t; - } -} - /* Convert signed 32 bit (or less) integer to string */ -#define I2B10_MAX 12 -void CsrIntToBase10(s32 number, char *str) -{ - s32 digit; - u8 index; - char res[I2B10_MAX]; - u8 foundDigit = FALSE; - - for (digit = 0; digit < I2B10_MAX; digit++) - { - res[digit] = '\0'; - } - - /* Catch sign - and deal with positive numbers only afterwards */ - index = 0; - if (number < 0) - { - res[index++] = '-'; - number = -1 * number; - } - - digit = 1000000000; - if (number > 0) - { - while ((index < I2B10_MAX - 1) && (digit > 0)) - { - /* If the foundDigit flag is TRUE, this routine should be proceeded. - Otherwise the number which has '0' digit cannot be converted correctly */ - if (((number / digit) > 0) || foundDigit) - { - foundDigit = TRUE; /* set foundDigit flag to TRUE*/ - res[index++] = (char) ('0' + (number / digit)); - number = number % digit; - } - - digit = digit / 10; - } - } - else - { - res[index] = (char) '0'; - } - - CsrStrCpy(str, res); -} - void CsrUInt16ToHex(u16 number, char *str) { u16 index; @@ -203,20 +33,6 @@ void CsrUInt16ToHex(u16 number, char *str) str[4] = '\0'; } -void CsrUInt32ToHex(u32 number, char *str) -{ - u16 index; - u32 currentValue; - - for (index = 0; index < 8; index++) - { - currentValue = (u32) (number & 0x0000000F); - number >>= 4; - str[7 - index] = (char) (currentValue > 9 ? currentValue + 55 : currentValue + '0'); - } - str[8] = '\0'; -} - /*------------------------------------------------------------------*/ /* String */ /*------------------------------------------------------------------*/ @@ -244,19 +60,6 @@ s32 CsrMemCmp(const void *buf1, const void *buf2, size_t count) return memcmp(buf1, buf2, count); } EXPORT_SYMBOL_GPL(CsrMemCmp); - -void *CsrMemDup(const void *buf1, size_t count) -{ - void *buf2 = NULL; - - if (buf1) - { - buf2 = CsrPmemAlloc(count); - CsrMemCpy(buf2, buf1, count); - } - - return buf2; -} #endif #ifndef CSR_USE_STDC_LIB @@ -270,21 +73,6 @@ char *CsrStrNCpy(char *dest, const char *src, size_t count) return strncpy(dest, src, count); } -char *CsrStrCat(char *dest, const char *src) -{ - return strcat(dest, src); -} - -char *CsrStrNCat(char *dest, const char *src, size_t count) -{ - return strncat(dest, src, count); -} - -char *CsrStrStr(const char *string1, const char *string2) -{ - return strstr(string1, string2); -} - size_t CsrStrLen(const char *string) { return strlen(string); @@ -313,39 +101,6 @@ s32 CsrVsnprintf(char *string, size_t count, const char *format, va_list args) } EXPORT_SYMBOL_GPL(CsrVsnprintf); -char *CsrStrNCpyZero(char *dest, - const char *src, - size_t count) -{ - CsrStrNCpy(dest, src, count - 1); - dest[count - 1] = '\0'; - return dest; -} - -/* Convert string with base 10 to integer */ -u32 CsrStrToInt(const char *str) -{ - s16 i; - u32 res; - u32 digit; - - res = 0; - digit = 1; - - /* Start from the string end */ - for (i = (u16) (CsrStrLen(str) - 1); i >= 0; i--) - { - /* Only convert numbers */ - if ((str[i] >= '0') && (str[i] <= '9')) - { - res += digit * (str[i] - '0'); - digit = digit * 10; - } - } - - return res; -} - char *CsrStrDup(const char *string) { char *copy; @@ -361,82 +116,6 @@ char *CsrStrDup(const char *string) return copy; } -int CsrStrNICmp(const char *string1, - const char *string2, - size_t count) -{ - u32 index; - int returnValue = 0; - - for (index = 0; index < count; index++) - { - if (CSR_TOUPPER(string1[index]) != CSR_TOUPPER(string2[index])) - { - if (CSR_TOUPPER(string1[index]) > CSR_TOUPPER(string2[index])) - { - returnValue = 1; - } - else - { - returnValue = -1; - } - break; - } - if (string1[index] == '\0') - { - break; - } - } - return returnValue; -} - -const char *CsrGetBaseName(const char *file) -{ - const char *pch; - static const char dotDir[] = "."; - - if (!file) - { - return NULL; - } - - if (file[0] == '\0') - { - return dotDir; - } - - pch = file + CsrStrLen(file) - 1; - - while (*pch != '\\' && *pch != '/' && *pch != ':') - { - if (pch == file) - { - return pch; - } - --pch; - } - - return ++pch; -} - -/*------------------------------------------------------------------*/ -/* Misc */ -/*------------------------------------------------------------------*/ -u8 CsrIsSpace(u8 c) -{ - switch (c) - { - case '\t': - case '\n': - case '\f': - case '\r': - case ' ': - return TRUE; - default: - return FALSE; - } -} - MODULE_DESCRIPTION("CSR Operating System Kernel Abstraction"); MODULE_AUTHOR("Cambridge Silicon Radio Ltd."); MODULE_LICENSE("GPL and additional rights"); diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index a124c73..3561344 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -19,21 +19,9 @@ extern "C" { #include "csr_macro.h" /*------------------------------------------------------------------*/ -/* Bits - intended to operate on u32 values */ -/*------------------------------------------------------------------*/ -u8 CsrBitCountSparse(u32 n); -u8 CsrBitCountDense(u32 n); - -/*------------------------------------------------------------------*/ /* Base conversion */ /*------------------------------------------------------------------*/ -u8 CsrHexStrToUint8(const char *string, u8 *returnValue); -u8 CsrHexStrToUint16(const char *string, u16 *returnValue); -u8 CsrHexStrToUint32(const char *string, u32 *returnValue); -u32 CsrPow(u32 base, u32 exponent); -void CsrIntToBase10(s32 number, char *str); void CsrUInt16ToHex(u16 number, char *str); -void CsrUInt32ToHex(u32 number, char *str); /*------------------------------------------------------------------*/ /* Standard C Library functions */ @@ -43,13 +31,10 @@ void CsrUInt32ToHex(u32 number, char *str); #define CsrMemMove memmove #define CsrStrCpy strcpy #define CsrStrNCpy strncpy -#define CsrStrCat strcat -#define CsrStrNCat strncat #define CsrMemCmp(s1, s2, n) ((s32) memcmp((s1), (s2), (n))) #define CsrStrCmp(s1, s2) ((s32) strcmp((s1), (s2))) #define CsrStrNCmp(s1, s2, n) ((s32) strncmp((s1), (s2), (n))) #define CsrStrChr strchr -#define CsrStrStr strstr #define CsrMemSet memset #define CsrStrLen strlen #else /* !CSR_USE_STDC_LIB */ @@ -57,13 +42,10 @@ void *CsrMemCpy(void *dest, const void *src, size_t count); void *CsrMemMove(void *dest, const void *src, size_t count); char *CsrStrCpy(char *dest, const char *src); char *CsrStrNCpy(char *dest, const char *src, size_t count); -char *CsrStrCat(char *dest, const char *src); -char *CsrStrNCat(char *dest, const char *src, size_t count); s32 CsrMemCmp(const void *buf1, const void *buf2, size_t count); s32 CsrStrCmp(const char *string1, const char *string2); s32 CsrStrNCmp(const char *string1, const char *string2, size_t count); char *CsrStrChr(const char *string, char c); -char *CsrStrStr(const char *string1, const char *string2); void *CsrMemSet(void *dest, u8 c, size_t count); size_t CsrStrLen(const char *string); #endif /* !CSR_USE_STDC_LIB */ @@ -72,21 +54,8 @@ s32 CsrVsnprintf(char *string, size_t count, const char *format, va_list args); /*------------------------------------------------------------------*/ /* Non-standard utility functions */ /*------------------------------------------------------------------*/ -void *CsrMemDup(const void *buf1, size_t count); -int CsrStrNICmp(const char *string1, const char *string2, size_t count); char *CsrStrDup(const char *string); -u32 CsrStrToInt(const char *string); -char *CsrStrNCpyZero(char *dest, const char *src, size_t count); - -/*------------------------------------------------------------------*/ -/* Filename */ -/*------------------------------------------------------------------*/ -const char *CsrGetBaseName(const char *file); -/*------------------------------------------------------------------*/ -/* Misc */ -/*------------------------------------------------------------------*/ -u8 CsrIsSpace(u8 c); #define CsrOffsetOf(st, m) ((size_t) & ((st *) 0)->m) #ifdef __cplusplus -- cgit v0.10.2 From b7244a31e160c4c43043962228e61ae00b03b4c3 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 14:16:11 -0700 Subject: staging: csr: remove CsrMemSet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's really just memset(), so call that instead. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index 48ed9b7..7b9afeb 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -43,12 +43,6 @@ void *CsrMemCpy(void *dest, const void *src, size_t count) } EXPORT_SYMBOL_GPL(CsrMemCpy); -void *CsrMemSet(void *dest, u8 c, size_t count) -{ - return memset(dest, c, count); -} -EXPORT_SYMBOL_GPL(CsrMemSet); - void *CsrMemMove(void *dest, const void *src, size_t count) { return memmove(dest, src, count); diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index 3561344..a32db17 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -35,7 +35,6 @@ void CsrUInt16ToHex(u16 number, char *str); #define CsrStrCmp(s1, s2) ((s32) strcmp((s1), (s2))) #define CsrStrNCmp(s1, s2, n) ((s32) strncmp((s1), (s2), (n))) #define CsrStrChr strchr -#define CsrMemSet memset #define CsrStrLen strlen #else /* !CSR_USE_STDC_LIB */ void *CsrMemCpy(void *dest, const void *src, size_t count); @@ -46,7 +45,6 @@ s32 CsrMemCmp(const void *buf1, const void *buf2, size_t count); s32 CsrStrCmp(const char *string1, const char *string2); s32 CsrStrNCmp(const char *string1, const char *string2, size_t count); char *CsrStrChr(const char *string, char c); -void *CsrMemSet(void *dest, u8 c, size_t count); size_t CsrStrLen(const char *string); #endif /* !CSR_USE_STDC_LIB */ s32 CsrVsnprintf(char *string, size_t count, const char *format, va_list args); diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.c b/drivers/staging/csr/csr_wifi_hip_card_sdio.c index 22778de..78fc5c4 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.c @@ -77,7 +77,7 @@ card_t* unifi_alloc_card(CsrSdioFunction *sdio, void *ospriv) { return NULL; } - CsrMemSet(card, 0, sizeof(card_t)); + memset(card, 0, sizeof(card_t)); card->sdio_if = sdio; @@ -2090,7 +2090,7 @@ static CsrResult card_init_slots(card_t *card) } /* Dynamic queue reservation */ - CsrMemSet(&card->dynamic_slot_data, 0, sizeof(card_dynamic_slot_t)); + memset(&card->dynamic_slot_data, 0, sizeof(card_dynamic_slot_t)); for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) { @@ -4109,7 +4109,7 @@ void unifi_get_hip_qos_info(card_t *card, unifi_HipQosInfo *hipqosinfo) q_t *sigq; u16 nslots, i; - CsrMemSet(hipqosinfo, 0, sizeof(unifi_HipQosInfo)); + memset(hipqosinfo, 0, sizeof(unifi_HipQosInfo)); nslots = card->config_data.num_fromhost_data_slots; diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c index 9f2343c..b491110 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c @@ -2105,7 +2105,7 @@ static CsrResult process_fh_cmd_queue(card_t *card, s32 *processed) (u8)(((signal_length >> 8) & 0xf) | (SDIO_CMD_SIGNAL << 4)); CsrMemCpy(card->fh_buffer.ptr + 2, packed_sigptr, signal_length); - CsrMemSet(card->fh_buffer.ptr + 2 + signal_length, 0, + memset(card->fh_buffer.ptr + 2 + signal_length, 0, total_length - (2 + signal_length)); #ifdef CSR_WIFI_HIP_NOISY @@ -2383,7 +2383,7 @@ static CsrResult process_fh_traffic_queue(card_t *card, s32 *processed) (u8)(((signal_length >> 8) & 0xf) | (SDIO_CMD_SIGNAL << 4)); CsrMemCpy(card->fh_buffer.ptr + 2, packed_sigptr, signal_length); - CsrMemSet(card->fh_buffer.ptr + 2 + signal_length, 0, + memset(card->fh_buffer.ptr + 2 + signal_length, 0, total_length - (2 + signal_length)); #ifdef CSR_WIFI_HIP_NOISY @@ -2485,7 +2485,7 @@ static CsrResult flush_fh_buffer(card_t *card) { padding_chunks = (data_round / sig_units) - chunks_in_last_block; - CsrMemSet(card->fh_buffer.ptr, 0, padding_chunks * sig_units); + memset(card->fh_buffer.ptr, 0, padding_chunks * sig_units); for (i = 0; i < padding_chunks; i++) { card->fh_buffer.ptr[1] = SDIO_CMD_PADDING << 4; diff --git a/drivers/staging/csr/csr_wifi_hip_download.c b/drivers/staging/csr/csr_wifi_hip_download.c index a9d0c39..15da98e 100644 --- a/drivers/staging/csr/csr_wifi_hip_download.c +++ b/drivers/staging/csr/csr_wifi_hip_download.c @@ -697,7 +697,7 @@ static CsrResult send_ptdl_to_unifi(card_t *card, void *dlpriv, /* Zero out the rest of the buffer (This isn't needed, but it * makes debugging things later much easier). */ - CsrMemSet(buf + data_len, 0, write_len - data_len); + memset(buf + data_len, 0, write_len - data_len); } else { diff --git a/drivers/staging/csr/csr_wifi_hip_dump.c b/drivers/staging/csr/csr_wifi_hip_dump.c index 3dee997..0d1f9df 100644 --- a/drivers/staging/csr/csr_wifi_hip_dump.c +++ b/drivers/staging/csr/csr_wifi_hip_dump.c @@ -671,7 +671,7 @@ coredump_buffer* new_coredump_node(void *ospriv, coredump_buffer *prevnode) { return NULL; } - CsrMemSet(newnode, 0, sizeof(coredump_buffer)); + memset(newnode, 0, sizeof(coredump_buffer)); /* Allocate chip memory zone capture buffers */ for (i = 0; i < HIP_CDUMP_NUM_ZONES; i++) @@ -681,7 +681,7 @@ coredump_buffer* new_coredump_node(void *ospriv, coredump_buffer *prevnode) newnode->zone[i] = newzone; if (newzone != NULL) { - CsrMemSet(newzone, 0, zone_size); + memset(newzone, 0, zone_size); } else { diff --git a/drivers/staging/csr/csr_wifi_hip_xbv.c b/drivers/staging/csr/csr_wifi_hip_xbv.c index 2c0e4666..e841306 100644 --- a/drivers/staging/csr/csr_wifi_hip_xbv.c +++ b/drivers/staging/csr/csr_wifi_hip_xbv.c @@ -166,7 +166,7 @@ CsrResult xbv1_parse(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwin ct.ioffset = 0; ct.iread = readfn; - CsrMemSet(fwinfo, 0, sizeof(xbv1_t)); + memset(fwinfo, 0, sizeof(xbv1_t)); fwinfo->mode = xbv_unknown; /* File must start with XBV1 triplet */ @@ -1026,7 +1026,7 @@ void* xbv_to_patch(card_t *card, fwreadfn_t readfn, return NULL; } - CsrMemSet(patch_buf, 0xdd, patch_buf_size); + memset(patch_buf, 0xdd, patch_buf_size); /* Write XBV + VERF headers */ patch_offs += write_xbv_header(patch_buf, patch_offs, 0); diff --git a/drivers/staging/csr/unifi_sme.c b/drivers/staging/csr/unifi_sme.c index 85e0c9e..2fe7b57 100644 --- a/drivers/staging/csr/unifi_sme.c +++ b/drivers/staging/csr/unifi_sme.c @@ -1210,7 +1210,7 @@ void uf_send_pkt_to_encrypt(struct work_struct *work) if (pktBulkDataLength > 0) { pktBulkData = (u8 *)CsrPmemAlloc(pktBulkDataLength); - CsrMemSet(pktBulkData, 0, pktBulkDataLength); + memset(pktBulkData, 0, pktBulkDataLength); } else { unifi_error(priv, "uf_send_pkt_to_encrypt() : invalid buffer\n"); return; -- cgit v0.10.2 From 85a334e3ce9cc94ab02968882ba7235237c7920d Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 14:18:02 -0700 Subject: staging: csr: remove CsrMemCmp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's really just memcmp(), so call that instead. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index 7b9afeb..0b7b632 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -48,12 +48,6 @@ void *CsrMemMove(void *dest, const void *src, size_t count) return memmove(dest, src, count); } EXPORT_SYMBOL_GPL(CsrMemMove); - -s32 CsrMemCmp(const void *buf1, const void *buf2, size_t count) -{ - return memcmp(buf1, buf2, count); -} -EXPORT_SYMBOL_GPL(CsrMemCmp); #endif #ifndef CSR_USE_STDC_LIB diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index a32db17..f046712 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -31,7 +31,6 @@ void CsrUInt16ToHex(u16 number, char *str); #define CsrMemMove memmove #define CsrStrCpy strcpy #define CsrStrNCpy strncpy -#define CsrMemCmp(s1, s2, n) ((s32) memcmp((s1), (s2), (n))) #define CsrStrCmp(s1, s2) ((s32) strcmp((s1), (s2))) #define CsrStrNCmp(s1, s2, n) ((s32) strncmp((s1), (s2), (n))) #define CsrStrChr strchr @@ -41,7 +40,6 @@ void *CsrMemCpy(void *dest, const void *src, size_t count); void *CsrMemMove(void *dest, const void *src, size_t count); char *CsrStrCpy(char *dest, const char *src); char *CsrStrNCpy(char *dest, const char *src, size_t count); -s32 CsrMemCmp(const void *buf1, const void *buf2, size_t count); s32 CsrStrCmp(const char *string1, const char *string2); s32 CsrStrNCmp(const char *string1, const char *string2, size_t count); char *CsrStrChr(const char *string, char c); diff --git a/drivers/staging/csr/csr_wifi_hip_ta_sampling.c b/drivers/staging/csr/csr_wifi_hip_ta_sampling.c index 33fc315..f1df36a 100644 --- a/drivers/staging/csr/csr_wifi_hip_ta_sampling.c +++ b/drivers/staging/csr/csr_wifi_hip_ta_sampling.c @@ -257,7 +257,7 @@ static enum ta_frame_identity ta_detect_protocol(card_t *card, CsrWifiRouterCtrl else if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_AIRONET) { /* detect Aironet frames */ - if (!CsrMemCmp(data->os_data_ptr + 3, aironet_snap, 5)) + if (!memcmp(data->os_data_ptr + 3, aironet_snap, 5)) { UNIFI_MAC_ADDRESS_COPY(srcAddress.a, saddr); unifi_ta_indicate_protocol(card->ospriv, CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_AIRONET, -- cgit v0.10.2 From c80b2e3f62f335b137e02b63c339e33831407702 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 14:19:46 -0700 Subject: staging: csr: remove CsrMemMove() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No one was using it (it was also just a wrapper for memmove). Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index 0b7b632..20dbe3e 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -42,12 +42,6 @@ void *CsrMemCpy(void *dest, const void *src, size_t count) return memcpy(dest, src, count); } EXPORT_SYMBOL_GPL(CsrMemCpy); - -void *CsrMemMove(void *dest, const void *src, size_t count) -{ - return memmove(dest, src, count); -} -EXPORT_SYMBOL_GPL(CsrMemMove); #endif #ifndef CSR_USE_STDC_LIB diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index f046712..e4987b1 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -28,7 +28,6 @@ void CsrUInt16ToHex(u16 number, char *str); /*------------------------------------------------------------------*/ #ifdef CSR_USE_STDC_LIB #define CsrMemCpy memcpy -#define CsrMemMove memmove #define CsrStrCpy strcpy #define CsrStrNCpy strncpy #define CsrStrCmp(s1, s2) ((s32) strcmp((s1), (s2))) @@ -37,7 +36,6 @@ void CsrUInt16ToHex(u16 number, char *str); #define CsrStrLen strlen #else /* !CSR_USE_STDC_LIB */ void *CsrMemCpy(void *dest, const void *src, size_t count); -void *CsrMemMove(void *dest, const void *src, size_t count); char *CsrStrCpy(char *dest, const char *src); char *CsrStrNCpy(char *dest, const char *src, size_t count); s32 CsrStrCmp(const char *string1, const char *string2); -- cgit v0.10.2 From b6e6e3a8408cdd3e9264df98c51953fa36968bee Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 14:23:42 -0700 Subject: staging: csr: remove CsrStrCpy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was really just strcpy() so use that instead. Also remove CsrUtf8StrCpy() as no one was calling that function. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_serialize_primitive_types.c b/drivers/staging/csr/csr_serialize_primitive_types.c index 5fb026c..2e4a8e9 100644 --- a/drivers/staging/csr/csr_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_serialize_primitive_types.c @@ -123,7 +123,7 @@ void CsrCharStringSer(u8 *buffer, size_t *offset, const char *value) { if (value) { - CsrStrCpy(((char *) &buffer[*offset]), value); + strcpy(((char *) &buffer[*offset]), value); *offset += CsrStrLen(value) + 1; } else diff --git a/drivers/staging/csr/csr_unicode.h b/drivers/staging/csr/csr_unicode.h index 44d7fd9..b54a9ce 100644 --- a/drivers/staging/csr/csr_unicode.h +++ b/drivers/staging/csr/csr_unicode.h @@ -69,30 +69,6 @@ u8 *CsrUtf8StrTruncate(u8 *target, size_t count); /******************************************************************************* NAME - CsrUtf8StrCpy - - DESCRIPTION - Copies the null terminated UTF-8 string pointed at by source into the - memory pointed at by target, including the terminating null character. - - To avoid overflows, the size of the memory pointed at by target shall be - long enough to contain the same UTF-8 string as source (including the - terminating null character), and should not overlap in memory with - source. - - PARAMETERS - target - Pointer to the target memory where the content is to be copied. - source - UTF-8 string to be copied. - - RETURNS - Returns target - -*******************************************************************************/ -u8 *CsrUtf8StrCpy(u8 *target, const u8 *source); - -/******************************************************************************* - - NAME CsrUtf8StrNCpy DESCRIPTION diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index 46bd130..db91a73 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -1035,11 +1035,6 @@ u32 CsrUtf8StringLengthInBytes(const u8 *string) return (u32) length; } -u8 *CsrUtf8StrCpy(u8 *target, const u8 *source) -{ - return (u8 *) CsrStrCpy((char *) target, (const char *) source); -} - u8 *CsrUtf8StrTruncate(u8 *target, size_t count) { size_t lastByte = count - 1; diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index 20dbe3e..e1e9467 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -45,11 +45,6 @@ EXPORT_SYMBOL_GPL(CsrMemCpy); #endif #ifndef CSR_USE_STDC_LIB -char *CsrStrCpy(char *dest, const char *src) -{ - return strcpy(dest, src); -} - char *CsrStrNCpy(char *dest, const char *src, size_t count) { return strncpy(dest, src, count); diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index e4987b1..c7aa3a6 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -28,7 +28,6 @@ void CsrUInt16ToHex(u16 number, char *str); /*------------------------------------------------------------------*/ #ifdef CSR_USE_STDC_LIB #define CsrMemCpy memcpy -#define CsrStrCpy strcpy #define CsrStrNCpy strncpy #define CsrStrCmp(s1, s2) ((s32) strcmp((s1), (s2))) #define CsrStrNCmp(s1, s2, n) ((s32) strncmp((s1), (s2), (n))) @@ -36,7 +35,6 @@ void CsrUInt16ToHex(u16 number, char *str); #define CsrStrLen strlen #else /* !CSR_USE_STDC_LIB */ void *CsrMemCpy(void *dest, const void *src, size_t count); -char *CsrStrCpy(char *dest, const char *src); char *CsrStrNCpy(char *dest, const char *src, size_t count); s32 CsrStrCmp(const char *string1, const char *string2); s32 CsrStrNCmp(const char *string1, const char *string2, size_t count); -- cgit v0.10.2 From 310d5940f521840a92e2572603021c9b58aeab5e Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 14:27:26 -0700 Subject: staging: csr: remove CsrStrNcpy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A few other functions were using it, but no one was calling them, so remove them as well: CsrUtf8StrNCpy() CsrUtf8StrNCpyZero() CsrUtf8StringConcatenateTexts() Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_unicode.h b/drivers/staging/csr/csr_unicode.h index b54a9ce..c27b6f9 100644 --- a/drivers/staging/csr/csr_unicode.h +++ b/drivers/staging/csr/csr_unicode.h @@ -69,59 +69,6 @@ u8 *CsrUtf8StrTruncate(u8 *target, size_t count); /******************************************************************************* NAME - CsrUtf8StrNCpy - - DESCRIPTION - Copies the first count bytes of source to target. If the end of the - source UTF-8 string (which is signaled by a null-character) is found - before count bytes have been copied, target is padded with null - characters until a total of count bytes have been written to it. - - No null-character is implicitly appended to the end of target, so target - will only be null-terminated if the length of the UTF-8 string in source - is less than count. - - PARAMETERS - target - Pointer to the target memory where the content is to be copied. - source - UTF-8 string to be copied. - count - Maximum number of bytes to be written to target. - - RETURNS - Returns target - -*******************************************************************************/ -u8 *CsrUtf8StrNCpy(u8 *target, const u8 *source, size_t count); - -/******************************************************************************* - - NAME - CsrUtf8StrNCpyZero - - DESCRIPTION - Equivalent to CsrUtf8StrNCpy, but if the length of source is equal to or - greater than count the target string is truncated on a UTF-8 character - boundary by writing a null character somewhere in the range - target[count - 4]:target[count - 1], leaving the target string - unconditionally null terminated in all cases. - - Please note that if the length of source is shorter than count, no - truncation will be applied, and the target string will be a one to one - copy of source. - - PARAMETERS - target - Pointer to the target memory where the content is to be copied. - source - UTF-8 string to be copied. - count - Maximum number of bytes to be written to target. - - RETURNS - Returns target - -*******************************************************************************/ -u8 *CsrUtf8StrNCpyZero(u8 *target, const u8 *source, size_t count); - -/******************************************************************************* - - NAME CsrUtf8StrDup DESCRIPTION @@ -139,8 +86,6 @@ u8 *CsrUtf8StrNCpyZero(u8 *target, const u8 *source, size_t count); *******************************************************************************/ u8 *CsrUtf8StrDup(const u8 *source); -u8 *CsrUtf8StringConcatenateTexts(const u8 *inputText1, const u8 *inputText2, const u8 *inputText3, const u8 *inputText4); - /* * UCS2 * diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index db91a73..ed0d843e 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -1064,67 +1064,7 @@ u8 *CsrUtf8StrTruncate(u8 *target, size_t count) return target; } -u8 *CsrUtf8StrNCpy(u8 *target, const u8 *source, size_t count) -{ - return (u8 *) CsrStrNCpy((char *) target, (const char *) source, count); -} - -u8 *CsrUtf8StrNCpyZero(u8 *target, const u8 *source, size_t count) -{ - CsrStrNCpy((char *) target, (const char *) source, count); - if (target[count - 1] != '\0') - { - CsrUtf8StrTruncate(target, count - 1); - } - return target; -} - u8 *CsrUtf8StrDup(const u8 *source) { return (u8 *) CsrStrDup((const char *) source); } - -u8 *CsrUtf8StringConcatenateTexts(const u8 *inputText1, const u8 *inputText2, const u8 *inputText3, const u8 *inputText4) -{ - u8 *outputText; - u32 textLen, textLen1, textLen2, textLen3, textLen4; - - textLen1 = CsrUtf8StringLengthInBytes(inputText1); - textLen2 = CsrUtf8StringLengthInBytes(inputText2); - textLen3 = CsrUtf8StringLengthInBytes(inputText3); - textLen4 = CsrUtf8StringLengthInBytes(inputText4); - - textLen = textLen1 + textLen2 + textLen3 + textLen4; - - if (textLen == 0) /*stop here is all lengths are 0*/ - { - return NULL; - } - - outputText = (u8 *) CsrPmemAlloc((textLen + 1) * sizeof(u8)); /* add space for 0-termination*/ - - - if (inputText1 != NULL) - { - CsrUtf8StrNCpy(outputText, inputText1, textLen1); - } - - if (inputText2 != NULL) - { - CsrUtf8StrNCpy(&(outputText[textLen1]), inputText2, textLen2); - } - - if (inputText3 != NULL) - { - CsrUtf8StrNCpy(&(outputText[textLen1 + textLen2]), inputText3, textLen3); - } - - if (inputText4 != NULL) - { - CsrUtf8StrNCpy(&(outputText[textLen1 + textLen2 + textLen3]), inputText4, textLen4); - } - - outputText[textLen] = '\0'; - - return outputText; -} diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index e1e9467..87075cd 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -45,11 +45,6 @@ EXPORT_SYMBOL_GPL(CsrMemCpy); #endif #ifndef CSR_USE_STDC_LIB -char *CsrStrNCpy(char *dest, const char *src, size_t count) -{ - return strncpy(dest, src, count); -} - size_t CsrStrLen(const char *string) { return strlen(string); diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index c7aa3a6..ffd35df 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -28,14 +28,12 @@ void CsrUInt16ToHex(u16 number, char *str); /*------------------------------------------------------------------*/ #ifdef CSR_USE_STDC_LIB #define CsrMemCpy memcpy -#define CsrStrNCpy strncpy #define CsrStrCmp(s1, s2) ((s32) strcmp((s1), (s2))) #define CsrStrNCmp(s1, s2, n) ((s32) strncmp((s1), (s2), (n))) #define CsrStrChr strchr #define CsrStrLen strlen #else /* !CSR_USE_STDC_LIB */ void *CsrMemCpy(void *dest, const void *src, size_t count); -char *CsrStrNCpy(char *dest, const char *src, size_t count); s32 CsrStrCmp(const char *string1, const char *string2); s32 CsrStrNCmp(const char *string1, const char *string2, size_t count); char *CsrStrChr(const char *string, char c); -- cgit v0.10.2 From 943b0022df97fbf2a34c4d6cb081e8fcb44032b9 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 14:35:23 -0700 Subject: staging: csr: remove CsrStrCmp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only CsrUtf8StrCmp() was calling it, and nothing was calling CsrUtf8StrCmp(), so remove both of them. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_unicode.h b/drivers/staging/csr/csr_unicode.h index c27b6f9..96f7dc7 100644 --- a/drivers/staging/csr/csr_unicode.h +++ b/drivers/staging/csr/csr_unicode.h @@ -36,7 +36,6 @@ u16 *CsrUtf16ConcatenateTexts(const u16 *inputText1, const u16 *inputText2, u16 *CsrUtf16String2XML(u16 *str); u16 *CsrXML2Utf16String(u16 *str); -s32 CsrUtf8StrCmp(const u8 *string1, const u8 *string2); s32 CsrUtf8StrNCmp(const u8 *string1, const u8 *string2, size_t count); u32 CsrUtf8StringLengthInBytes(const u8 *string); diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index ed0d843e..58c17b3 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -1015,11 +1015,6 @@ u16 *CsrXML2Utf16String(u16 *str) return resultString; } -s32 CsrUtf8StrCmp(const u8 *string1, const u8 *string2) -{ - return CsrStrCmp((const char *) string1, (const char *) string2); -} - s32 CsrUtf8StrNCmp(const u8 *string1, const u8 *string2, size_t count) { return CsrStrNCmp((const char *) string1, (const char *) string2, count); diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index 87075cd..d3b8271 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -51,11 +51,6 @@ size_t CsrStrLen(const char *string) } EXPORT_SYMBOL_GPL(CsrStrLen); -s32 CsrStrCmp(const char *string1, const char *string2) -{ - return strcmp(string1, string2); -} - s32 CsrStrNCmp(const char *string1, const char *string2, size_t count) { return strncmp(string1, string2, count); diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index ffd35df..c794358 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -28,13 +28,11 @@ void CsrUInt16ToHex(u16 number, char *str); /*------------------------------------------------------------------*/ #ifdef CSR_USE_STDC_LIB #define CsrMemCpy memcpy -#define CsrStrCmp(s1, s2) ((s32) strcmp((s1), (s2))) #define CsrStrNCmp(s1, s2, n) ((s32) strncmp((s1), (s2), (n))) #define CsrStrChr strchr #define CsrStrLen strlen #else /* !CSR_USE_STDC_LIB */ void *CsrMemCpy(void *dest, const void *src, size_t count); -s32 CsrStrCmp(const char *string1, const char *string2); s32 CsrStrNCmp(const char *string1, const char *string2, size_t count); char *CsrStrChr(const char *string, char c); size_t CsrStrLen(const char *string); -- cgit v0.10.2 From 45755da2d88b7e0ff9ab037968d64f27f0820317 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 14:39:57 -0700 Subject: staging: csr: remove CsrStrNCmp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only CsrUtf8StrNCmp() was calling it, and nothing was calling CsrUtf8StrNCmp(), so remove both of them. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_unicode.h b/drivers/staging/csr/csr_unicode.h index 96f7dc7..a6ddb1f 100644 --- a/drivers/staging/csr/csr_unicode.h +++ b/drivers/staging/csr/csr_unicode.h @@ -36,7 +36,6 @@ u16 *CsrUtf16ConcatenateTexts(const u16 *inputText1, const u16 *inputText2, u16 *CsrUtf16String2XML(u16 *str); u16 *CsrXML2Utf16String(u16 *str); -s32 CsrUtf8StrNCmp(const u8 *string1, const u8 *string2, size_t count); u32 CsrUtf8StringLengthInBytes(const u8 *string); /******************************************************************************* diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index 58c17b3..3d47491 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -1015,11 +1015,6 @@ u16 *CsrXML2Utf16String(u16 *str) return resultString; } -s32 CsrUtf8StrNCmp(const u8 *string1, const u8 *string2, size_t count) -{ - return CsrStrNCmp((const char *) string1, (const char *) string2, count); -} - u32 CsrUtf8StringLengthInBytes(const u8 *string) { size_t length = 0; diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index d3b8271..f7fd3fb 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -51,11 +51,6 @@ size_t CsrStrLen(const char *string) } EXPORT_SYMBOL_GPL(CsrStrLen); -s32 CsrStrNCmp(const char *string1, const char *string2, size_t count) -{ - return strncmp(string1, string2, count); -} - char *CsrStrChr(const char *string, char c) { return strchr(string, c); diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index c794358..95030fa 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -28,12 +28,10 @@ void CsrUInt16ToHex(u16 number, char *str); /*------------------------------------------------------------------*/ #ifdef CSR_USE_STDC_LIB #define CsrMemCpy memcpy -#define CsrStrNCmp(s1, s2, n) ((s32) strncmp((s1), (s2), (n))) #define CsrStrChr strchr #define CsrStrLen strlen #else /* !CSR_USE_STDC_LIB */ void *CsrMemCpy(void *dest, const void *src, size_t count); -s32 CsrStrNCmp(const char *string1, const char *string2, size_t count); char *CsrStrChr(const char *string, char c); size_t CsrStrLen(const char *string); #endif /* !CSR_USE_STDC_LIB */ -- cgit v0.10.2 From 6a4f6d38a34a992f8fd1572fc8d5706c11089d5e Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 14:42:02 -0700 Subject: staging: csr: remove CsrStrChr() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No one was calling it, so remove it. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index f7fd3fb..fa6025a 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -50,11 +50,6 @@ size_t CsrStrLen(const char *string) return strlen(string); } EXPORT_SYMBOL_GPL(CsrStrLen); - -char *CsrStrChr(const char *string, char c) -{ - return strchr(string, c); -} #endif s32 CsrVsnprintf(char *string, size_t count, const char *format, va_list args) diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index 95030fa..024b520 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -28,11 +28,9 @@ void CsrUInt16ToHex(u16 number, char *str); /*------------------------------------------------------------------*/ #ifdef CSR_USE_STDC_LIB #define CsrMemCpy memcpy -#define CsrStrChr strchr #define CsrStrLen strlen #else /* !CSR_USE_STDC_LIB */ void *CsrMemCpy(void *dest, const void *src, size_t count); -char *CsrStrChr(const char *string, char c); size_t CsrStrLen(const char *string); #endif /* !CSR_USE_STDC_LIB */ s32 CsrVsnprintf(char *string, size_t count, const char *format, va_list args); -- cgit v0.10.2 From 5a0c09fd736d2518409e0eabe4c3039058e6fdfc Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 14:47:11 -0700 Subject: staging: csr: remove CsrStrDup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use kstrdup() for the few places that called it, and remove CsrUtf8StrDup() as no one calls that function. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_serialize_primitive_types.c b/drivers/staging/csr/csr_serialize_primitive_types.c index 2e4a8e9..419528b 100644 --- a/drivers/staging/csr/csr_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_serialize_primitive_types.c @@ -49,14 +49,14 @@ EXPORT_SYMBOL_GPL(CsrMemCpyDes); void CsrCharStringDes(char **value, u8 *buffer, size_t *offset) { - *value = CsrStrDup((char *) &buffer[*offset]); + *value = kstrdup((char *) &buffer[*offset], GFP_KERNEL); *offset += CsrStrLen(*value) + 1; } EXPORT_SYMBOL_GPL(CsrCharStringDes); void CsrUtf8StringDes(u8 **value, u8 *buffer, size_t *offset) { - *value = (u8 *) CsrStrDup((char *) &buffer[*offset]); + *value = (u8 *)kstrdup((char *) &buffer[*offset], GFP_KERNEL); *offset += CsrStrLen((char *) *value) + 1; } diff --git a/drivers/staging/csr/csr_unicode.h b/drivers/staging/csr/csr_unicode.h index a6ddb1f..2105e71 100644 --- a/drivers/staging/csr/csr_unicode.h +++ b/drivers/staging/csr/csr_unicode.h @@ -64,26 +64,6 @@ u32 CsrUtf8StringLengthInBytes(const u8 *string); *******************************************************************************/ u8 *CsrUtf8StrTruncate(u8 *target, size_t count); -/******************************************************************************* - - NAME - CsrUtf8StrDup - - DESCRIPTION - This function will allocate memory and copy the source string into the - allocated memory, which is then returned as a duplicate of the original - string. The memory returned must be freed by calling CsrPmemFree when - the duplicate is no longer needed. - - PARAMETERS - source - UTF-8 string to be duplicated. - - RETURNS - Returns a duplicate of source. - -*******************************************************************************/ -u8 *CsrUtf8StrDup(const u8 *source); - /* * UCS2 * diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index 3d47491..e678713 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -1053,8 +1053,3 @@ u8 *CsrUtf8StrTruncate(u8 *target, size_t count) return target; } - -u8 *CsrUtf8StrDup(const u8 *source) -{ - return (u8 *) CsrStrDup((const char *) source); -} diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index fa6025a..ff1b85e 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -58,21 +58,6 @@ s32 CsrVsnprintf(char *string, size_t count, const char *format, va_list args) } EXPORT_SYMBOL_GPL(CsrVsnprintf); -char *CsrStrDup(const char *string) -{ - char *copy; - u32 len; - - copy = NULL; - if (string != NULL) - { - len = CsrStrLen(string) + 1; - copy = CsrPmemAlloc(len); - CsrMemCpy(copy, string, len); - } - return copy; -} - MODULE_DESCRIPTION("CSR Operating System Kernel Abstraction"); MODULE_AUTHOR("Cambridge Silicon Radio Ltd."); MODULE_LICENSE("GPL and additional rights"); diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index 024b520..2efc331 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -35,11 +35,6 @@ size_t CsrStrLen(const char *string); #endif /* !CSR_USE_STDC_LIB */ s32 CsrVsnprintf(char *string, size_t count, const char *format, va_list args); -/*------------------------------------------------------------------*/ -/* Non-standard utility functions */ -/*------------------------------------------------------------------*/ -char *CsrStrDup(const char *string); - #define CsrOffsetOf(st, m) ((size_t) & ((st *) 0)->m) #ifdef __cplusplus -- cgit v0.10.2 From e4bcecd947a40731cbbbf44f8584f99070608416 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 14:50:38 -0700 Subject: staging: csr: remove CsrVsnprintf() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's just a wrapper for vsnprintf() so call that instead. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_formatted_io.c b/drivers/staging/csr/csr_formatted_io.c index 51fb988..bda8712 100644 --- a/drivers/staging/csr/csr_formatted_io.c +++ b/drivers/staging/csr/csr_formatted_io.c @@ -16,7 +16,7 @@ s32 CsrSnprintf(char *dest, size_t n, const char *fmt, ...) s32 r; va_list args; va_start(args, fmt); - r = CsrVsnprintf(dest, n, fmt, args); + r = vsnprintf(dest, n, fmt, args); va_end(args); if (dest && (n > 0)) diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index ff1b85e..397345c 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -52,12 +52,6 @@ size_t CsrStrLen(const char *string) EXPORT_SYMBOL_GPL(CsrStrLen); #endif -s32 CsrVsnprintf(char *string, size_t count, const char *format, va_list args) -{ - return vsnprintf(string, count, format, args); -} -EXPORT_SYMBOL_GPL(CsrVsnprintf); - MODULE_DESCRIPTION("CSR Operating System Kernel Abstraction"); MODULE_AUTHOR("Cambridge Silicon Radio Ltd."); MODULE_LICENSE("GPL and additional rights"); diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index 2efc331..1a911ca 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -33,7 +33,6 @@ void CsrUInt16ToHex(u16 number, char *str); void *CsrMemCpy(void *dest, const void *src, size_t count); size_t CsrStrLen(const char *string); #endif /* !CSR_USE_STDC_LIB */ -s32 CsrVsnprintf(char *string, size_t count, const char *format, va_list args); #define CsrOffsetOf(st, m) ((size_t) & ((st *) 0)->m) diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c index b491110..a111d40 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c @@ -121,7 +121,7 @@ void unifi_debug_log_to_buf(const char *fmt, ...) va_list args; va_start(args, fmt); - CsrVsnprintf(s, DEBUG_BUFFER_SIZE, fmt, args); + vsnprintf(s, DEBUG_BUFFER_SIZE, fmt, args); va_end(args); unifi_debug_string_to_buf(s); -- cgit v0.10.2 From 4bcb20f83441f1ffa5907200444066c580231755 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 14:56:57 -0700 Subject: staging: csr: remove CsrStrLen() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's just a wrapper around strlen(), so call that instead. Also add a few #include to fix up the build with this change. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_serialize_primitive_types.c b/drivers/staging/csr/csr_serialize_primitive_types.c index 419528b..1d84938 100644 --- a/drivers/staging/csr/csr_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_serialize_primitive_types.c @@ -50,14 +50,14 @@ EXPORT_SYMBOL_GPL(CsrMemCpyDes); void CsrCharStringDes(char **value, u8 *buffer, size_t *offset) { *value = kstrdup((char *) &buffer[*offset], GFP_KERNEL); - *offset += CsrStrLen(*value) + 1; + *offset += strlen(*value) + 1; } EXPORT_SYMBOL_GPL(CsrCharStringDes); void CsrUtf8StringDes(u8 **value, u8 *buffer, size_t *offset) { *value = (u8 *)kstrdup((char *) &buffer[*offset], GFP_KERNEL); - *offset += CsrStrLen((char *) *value) + 1; + *offset += strlen((char *) *value) + 1; } void CsrUtf16StringDes(u16 **value, u8 *buffer, size_t *offset) @@ -124,7 +124,7 @@ void CsrCharStringSer(u8 *buffer, size_t *offset, const char *value) if (value) { strcpy(((char *) &buffer[*offset]), value); - *offset += CsrStrLen(value) + 1; + *offset += strlen(value) + 1; } else { @@ -176,7 +176,7 @@ u32 CsrCharStringSerLen(const char *str) { if (str) { - return (u32) (CsrStrLen(str) + sizeof(*str)); + return (u32)(strlen(str) + sizeof(*str)); } else { @@ -188,7 +188,7 @@ u32 CsrUtf8StringSerLen(const u8 *str) { if (str) { - return (u32) (CsrStrLen((char *) str) + sizeof(*str)); + return (u32)(strlen((char *) str) + sizeof(*str)); } else { @@ -390,7 +390,7 @@ void *CsrEventCsrUint16CsrUint32Des(u8 *buffer, size_t length) size_t CsrEventCsrUint16CsrCharStringSizeof(void *msg) { CsrEventCsrUint16CsrCharString *primitive = (CsrEventCsrUint16CsrCharString *) msg; - return 4 + CsrStrLen(primitive->value2) + 1; + return 4 + strlen(primitive->value2) + 1; } u8 *CsrEventCsrUint16CsrCharStringSer(u8 *ptr, size_t *len, void *msg) @@ -445,7 +445,7 @@ void *CsrEventCsrUint32CsrUint16Des(u8 *buffer, size_t length) size_t CsrEventCsrUint32CsrCharStringSizeof(void *msg) { CsrEventCsrUint32CsrCharString *primitive = (CsrEventCsrUint32CsrCharString *) msg; - return 6 + CsrStrLen(primitive->value2) + 1; + return 6 + strlen(primitive->value2) + 1; } u8 *CsrEventCsrUint32CsrCharStringSer(u8 *ptr, size_t *len, void *msg) diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index e678713..edfc4b7 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -573,7 +573,7 @@ u16 *CsrUtf82Utf16String(const u8 *utf8String) { return NULL; } - sourceLength = CsrStrLen((char *) utf8String); + sourceLength = strlen((char *)utf8String); for (i = 0; i < sourceLength; i++) { @@ -1020,7 +1020,7 @@ u32 CsrUtf8StringLengthInBytes(const u8 *string) size_t length = 0; if (string) { - length = CsrStrLen((const char *) string); + length = strlen((const char *)string); } return (u32) length; } diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index 397345c..c3db3ee 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -44,14 +44,6 @@ void *CsrMemCpy(void *dest, const void *src, size_t count) EXPORT_SYMBOL_GPL(CsrMemCpy); #endif -#ifndef CSR_USE_STDC_LIB -size_t CsrStrLen(const char *string) -{ - return strlen(string); -} -EXPORT_SYMBOL_GPL(CsrStrLen); -#endif - MODULE_DESCRIPTION("CSR Operating System Kernel Abstraction"); MODULE_AUTHOR("Cambridge Silicon Radio Ltd."); MODULE_LICENSE("GPL and additional rights"); diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index 1a911ca..fb5f05e 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -28,10 +28,8 @@ void CsrUInt16ToHex(u16 number, char *str); /*------------------------------------------------------------------*/ #ifdef CSR_USE_STDC_LIB #define CsrMemCpy memcpy -#define CsrStrLen strlen #else /* !CSR_USE_STDC_LIB */ void *CsrMemCpy(void *dest, const void *src, size_t count); -size_t CsrStrLen(const char *string); #endif /* !CSR_USE_STDC_LIB */ #define CsrOffsetOf(st, m) ((size_t) & ((st *) 0)->m) diff --git a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c index 71a4995..b673c1c 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c +++ b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c @@ -9,7 +9,7 @@ *****************************************************************************/ /* Note: this is an auto-generated file. */ - +#include #include "csr_pmem.h" #include "csr_msgconv.h" #include "csr_unicode.h" @@ -324,7 +324,7 @@ size_t CsrWifiNmeApStartReqSizeof(void *msg) break; case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: bufferSize += 2; /* u16 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.encryptionMode */ - bufferSize += (primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase?CsrStrLen(primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase) : 0) + 1; /* char* primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase (0 byte len + 1 for NULL Term) */ + bufferSize += (primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase ? strlen(primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase) : 0) + 1; /* char* primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase (0 byte len + 1 for NULL Term) */ break; default: break; diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c index 377efb1..330eb95 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c @@ -9,7 +9,7 @@ *****************************************************************************/ /* Note: this is an auto-generated file. */ - +#include #include "csr_pmem.h" #include "csr_msgconv.h" #include "csr_unicode.h" @@ -732,7 +732,7 @@ size_t CsrWifiRouterCtrlWifiOnResSizeof(void *msg) } } bufferSize += 4; /* u32 primitive->smeVersions.firmwarePatch */ - bufferSize += (primitive->smeVersions.smeBuild?CsrStrLen(primitive->smeVersions.smeBuild) : 0) + 1; /* char* primitive->smeVersions.smeBuild (0 byte len + 1 for NULL Term) */ + bufferSize += (primitive->smeVersions.smeBuild ? strlen(primitive->smeVersions.smeBuild) : 0) + 1; /* char* primitive->smeVersions.smeBuild (0 byte len + 1 for NULL Term) */ bufferSize += 4; /* u32 primitive->smeVersions.smeHip */ bufferSize += 1; /* u8 primitive->scheduledInterrupt */ return bufferSize; @@ -1793,7 +1793,7 @@ size_t CsrWifiRouterCtrlWifiOnIndSizeof(void *msg) bufferSize += 4; /* u32 primitive->versions.chipVersion */ bufferSize += 4; /* u32 primitive->versions.firmwareBuild */ bufferSize += 4; /* u32 primitive->versions.firmwareHip */ - bufferSize += (primitive->versions.routerBuild?CsrStrLen(primitive->versions.routerBuild) : 0) + 1; /* char* primitive->versions.routerBuild (0 byte len + 1 for NULL Term) */ + bufferSize += (primitive->versions.routerBuild ? strlen(primitive->versions.routerBuild) : 0) + 1; /* char* primitive->versions.routerBuild (0 byte len + 1 for NULL Term) */ bufferSize += 4; /* u32 primitive->versions.routerHip */ return bufferSize; } diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.c b/drivers/staging/csr/csr_wifi_sme_serialize.c index 514974b..27e969c 100644 --- a/drivers/staging/csr/csr_wifi_sme_serialize.c +++ b/drivers/staging/csr/csr_wifi_sme_serialize.c @@ -9,7 +9,7 @@ *****************************************************************************/ /* Note: this is an auto-generated file. */ - +#include #include "csr_pmem.h" #include "csr_msgconv.h" #include "csr_unicode.h" @@ -5421,9 +5421,9 @@ size_t CsrWifiSmeVersionsGetCfmSizeof(void *msg) bufferSize += 4; /* u32 primitive->versions.firmwareBuild */ bufferSize += 4; /* u32 primitive->versions.firmwarePatch */ bufferSize += 4; /* u32 primitive->versions.firmwareHip */ - bufferSize += (primitive->versions.routerBuild?CsrStrLen(primitive->versions.routerBuild) : 0) + 1; /* char* primitive->versions.routerBuild (0 byte len + 1 for NULL Term) */ + bufferSize += (primitive->versions.routerBuild ? strlen(primitive->versions.routerBuild) : 0) + 1; /* char* primitive->versions.routerBuild (0 byte len + 1 for NULL Term) */ bufferSize += 4; /* u32 primitive->versions.routerHip */ - bufferSize += (primitive->versions.smeBuild?CsrStrLen(primitive->versions.smeBuild) : 0) + 1; /* char* primitive->versions.smeBuild (0 byte len + 1 for NULL Term) */ + bufferSize += (primitive->versions.smeBuild ? strlen(primitive->versions.smeBuild) : 0) + 1; /* char* primitive->versions.smeBuild (0 byte len + 1 for NULL Term) */ bufferSize += 4; /* u32 primitive->versions.smeHip */ return bufferSize; } @@ -5676,7 +5676,7 @@ size_t CsrWifiSmeErrorIndSizeof(void *msg) size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 3) */ - bufferSize += (primitive->errorMessage?CsrStrLen(primitive->errorMessage) : 0) + 1; /* char* primitive->errorMessage (0 byte len + 1 for NULL Term) */ + bufferSize += (primitive->errorMessage ? strlen(primitive->errorMessage) : 0) + 1; /* char* primitive->errorMessage (0 byte len + 1 for NULL Term) */ return bufferSize; } @@ -5718,7 +5718,7 @@ size_t CsrWifiSmeInfoIndSizeof(void *msg) size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 3) */ - bufferSize += (primitive->infoMessage?CsrStrLen(primitive->infoMessage) : 0) + 1; /* char* primitive->infoMessage (0 byte len + 1 for NULL Term) */ + bufferSize += (primitive->infoMessage ? strlen(primitive->infoMessage) : 0) + 1; /* char* primitive->infoMessage (0 byte len + 1 for NULL Term) */ return bufferSize; } -- cgit v0.10.2 From 25aebdb1bb13bbab2d620ae48e3ea3184a8fdac5 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 15:01:05 -0700 Subject: staging: csr: remove CsrMemCpy() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was just a wrapper around memcpy() so call that instead. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_serialize_primitive_types.c b/drivers/staging/csr/csr_serialize_primitive_types.c index 1d84938..dfb89f1 100644 --- a/drivers/staging/csr/csr_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_serialize_primitive_types.c @@ -42,7 +42,7 @@ EXPORT_SYMBOL_GPL(CsrUint32Des); void CsrMemCpyDes(void *value, u8 *buffer, size_t *offset, size_t length) { - CsrMemCpy(value, &buffer[*offset], length); + memcpy(value, &buffer[*offset], length); *offset += length; } EXPORT_SYMBOL_GPL(CsrMemCpyDes); @@ -114,7 +114,7 @@ EXPORT_SYMBOL_GPL(CsrUint32Ser); void CsrMemCpySer(u8 *buffer, size_t *offset, const void *value, size_t length) { - CsrMemCpy(&buffer[*offset], value, length); + memcpy(&buffer[*offset], value, length); *offset += length; } EXPORT_SYMBOL_GPL(CsrMemCpySer); diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index edfc4b7..682efa9 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -151,7 +151,7 @@ u32 CsrUtf16StringToUint32(const u16 *unicodeString) *********************************************************************************/ u16 *CsrUtf16MemCpy(u16 *dest, const u16 *src, u32 count) { - return CsrMemCpy((u8 *) dest, (u8 *) src, count * sizeof(u16)); + return memcpy((u8 *) dest, (u8 *) src, count * sizeof(u16)); } /******************************************************************************** @@ -706,7 +706,7 @@ u16 *CsrUtf16StrCpy(u16 *target, const u16 *source) { if (source) /* if source is not NULL*/ { - CsrMemCpy(target, source, (CsrUtf16StrLen(source) + 1) * sizeof(u16)); + memcpy(target, source, (CsrUtf16StrLen(source) + 1) * sizeof(u16)); return target; } else @@ -736,7 +736,7 @@ u16 *CsrUtf16StringDuplicate(const u16 *source) { length = (CsrUtf16StrLen(source) + 1) * sizeof(u16); target = (u16 *) CsrPmemAlloc(length); - CsrMemCpy(target, source, length); + memcpy(target, source, length); } return target; } diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index c3db3ee..ae2e1dcb 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -33,17 +33,6 @@ void CsrUInt16ToHex(u16 number, char *str) str[4] = '\0'; } -/*------------------------------------------------------------------*/ -/* String */ -/*------------------------------------------------------------------*/ -#ifndef CSR_USE_STDC_LIB -void *CsrMemCpy(void *dest, const void *src, size_t count) -{ - return memcpy(dest, src, count); -} -EXPORT_SYMBOL_GPL(CsrMemCpy); -#endif - MODULE_DESCRIPTION("CSR Operating System Kernel Abstraction"); MODULE_AUTHOR("Cambridge Silicon Radio Ltd."); MODULE_LICENSE("GPL and additional rights"); diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index fb5f05e..d60d8df 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -23,15 +23,6 @@ extern "C" { /*------------------------------------------------------------------*/ void CsrUInt16ToHex(u16 number, char *str); -/*------------------------------------------------------------------*/ -/* Standard C Library functions */ -/*------------------------------------------------------------------*/ -#ifdef CSR_USE_STDC_LIB -#define CsrMemCpy memcpy -#else /* !CSR_USE_STDC_LIB */ -void *CsrMemCpy(void *dest, const void *src, size_t count); -#endif /* !CSR_USE_STDC_LIB */ - #define CsrOffsetOf(st, m) ((size_t) & ((st *) 0)->m) #ifdef __cplusplus diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c index a111d40..6536cb3 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c @@ -1750,7 +1750,7 @@ static CsrResult process_bulk_data_command(card_t *card, const u8 *cmdptr, return -1; } - CsrMemCpy((void *)host_bulk_data_slot, + memcpy((void *)host_bulk_data_slot, (void *)(bdslot->os_data_ptr + offset), len); r = unifi_bulk_rw(card, @@ -2104,7 +2104,7 @@ static CsrResult process_fh_cmd_queue(card_t *card, s32 *processed) card->fh_buffer.ptr[1] = (u8)(((signal_length >> 8) & 0xf) | (SDIO_CMD_SIGNAL << 4)); - CsrMemCpy(card->fh_buffer.ptr + 2, packed_sigptr, signal_length); + memcpy(card->fh_buffer.ptr + 2, packed_sigptr, signal_length); memset(card->fh_buffer.ptr + 2 + signal_length, 0, total_length - (2 + signal_length)); @@ -2382,7 +2382,7 @@ static CsrResult process_fh_traffic_queue(card_t *card, s32 *processed) card->fh_buffer.ptr[1] = (u8)(((signal_length >> 8) & 0xf) | (SDIO_CMD_SIGNAL << 4)); - CsrMemCpy(card->fh_buffer.ptr + 2, packed_sigptr, signal_length); + memcpy(card->fh_buffer.ptr + 2, packed_sigptr, signal_length); memset(card->fh_buffer.ptr + 2 + signal_length, 0, total_length - (2 + signal_length)); diff --git a/drivers/staging/csr/csr_wifi_hip_packing.c b/drivers/staging/csr/csr_wifi_hip_packing.c index c01bb13..0768aef 100644 --- a/drivers/staging/csr/csr_wifi_hip_packing.c +++ b/drivers/staging/csr/csr_wifi_hip_packing.c @@ -1321,7 +1321,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) index += SIZEOF_UINT16; sig->u.MlmeStopAggregationConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(sig->u.MlmeStopAggregationConfirm.PeerQstaAddress.x, &ptr[index], 48 / 8); + memcpy(sig->u.MlmeStopAggregationConfirm.PeerQstaAddress.x, &ptr[index], 48 / 8); index += 48 / 8; sig->u.MlmeStopAggregationConfirm.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; @@ -1428,7 +1428,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) index += SIZEOF_UINT16; sig->u.MaPacketIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(sig->u.MaPacketIndication.LocalTime.x, &ptr[index], 64 / 8); + memcpy(sig->u.MaPacketIndication.LocalTime.x, &ptr[index], 64 / 8); index += 64 / 8; sig->u.MaPacketIndication.Ifindex = (CSR_IFINTERFACE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; @@ -1473,7 +1473,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) index += SIZEOF_UINT16; sig->u.MlmeConnectedIndication.ConnectionStatus = (CSR_CONNECTION_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(sig->u.MlmeConnectedIndication.PeerMacAddress.x, &ptr[index], 48 / 8); + memcpy(sig->u.MlmeConnectedIndication.PeerMacAddress.x, &ptr[index], 48 / 8); index += 48 / 8; break; #endif @@ -1593,7 +1593,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) index += SIZEOF_UINT16; sig->u.MlmeStartAggregationRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(sig->u.MlmeStartAggregationRequest.PeerQstaAddress.x, &ptr[index], 48 / 8); + memcpy(sig->u.MlmeStartAggregationRequest.PeerQstaAddress.x, &ptr[index], 48 / 8); index += 48 / 8; sig->u.MlmeStartAggregationRequest.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; @@ -1617,7 +1617,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) index += SIZEOF_UINT16; sig->u.MlmeHlSyncRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(sig->u.MlmeHlSyncRequest.GroupAddress.x, &ptr[index], 48 / 8); + memcpy(sig->u.MlmeHlSyncRequest.GroupAddress.x, &ptr[index], 48 / 8); index += 48 / 8; break; #endif @@ -1705,7 +1705,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) index += SIZEOF_UINT16; sig->u.MlmeResetRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(sig->u.MlmeResetRequest.StaAddress.x, &ptr[index], 48 / 8); + memcpy(sig->u.MlmeResetRequest.StaAddress.x, &ptr[index], 48 / 8); index += 48 / 8; sig->u.MlmeResetRequest.SetDefaultMib = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; @@ -1793,7 +1793,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) index += SIZEOF_UINT16; sig->u.MlmeConnectStatusRequest.ConnectionStatus = (CSR_CONNECTION_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(sig->u.MlmeConnectStatusRequest.StaAddress.x, &ptr[index], 48 / 8); + memcpy(sig->u.MlmeConnectStatusRequest.StaAddress.x, &ptr[index], 48 / 8); index += 48 / 8; sig->u.MlmeConnectStatusRequest.AssociationId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; @@ -2010,7 +2010,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) index += SIZEOF_UINT32; sig->u.MaPacketRequest.Priority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(sig->u.MaPacketRequest.Ra.x, &ptr[index], 48 / 8); + memcpy(sig->u.MaPacketRequest.Ra.x, &ptr[index], 48 / 8); index += 48 / 8; sig->u.MaPacketRequest.TransmissionControl = (CSR_TRANSMISSION_CONTROL) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; @@ -2033,7 +2033,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) index += SIZEOF_UINT16; sig->u.MlmeModifyBssParameterRequest.CapabilityInformation = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(sig->u.MlmeModifyBssParameterRequest.Bssid.x, &ptr[index], 48 / 8); + memcpy(sig->u.MlmeModifyBssParameterRequest.Bssid.x, &ptr[index], 48 / 8); index += 48 / 8; sig->u.MlmeModifyBssParameterRequest.RtsThreshold = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; @@ -2081,7 +2081,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) index += SIZEOF_UINT16; sig->u.MlmeHlSyncCancelRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(sig->u.MlmeHlSyncCancelRequest.GroupAddress.x, &ptr[index], 48 / 8); + memcpy(sig->u.MlmeHlSyncCancelRequest.GroupAddress.x, &ptr[index], 48 / 8); index += 48 / 8; break; #endif @@ -2151,7 +2151,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) index += SIZEOF_UINT16; sig->u.MlmeGetKeySequenceRequest.KeyType = (CSR_KEY_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(sig->u.MlmeGetKeySequenceRequest.Address.x, &ptr[index], 48 / 8); + memcpy(sig->u.MlmeGetKeySequenceRequest.Address.x, &ptr[index], 48 / 8); index += 48 / 8; break; #endif @@ -2171,7 +2171,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) index += SIZEOF_UINT16; sig->u.MlmeSetChannelRequest.Channel = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(sig->u.MlmeSetChannelRequest.Address.x, &ptr[index], 48 / 8); + memcpy(sig->u.MlmeSetChannelRequest.Address.x, &ptr[index], 48 / 8); index += 48 / 8; sig->u.MlmeSetChannelRequest.AvailabilityDuration = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; @@ -2223,7 +2223,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) index += SIZEOF_UINT16; sig->u.MlmeAutonomousScanLossIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(sig->u.MlmeAutonomousScanLossIndication.Bssid.x, &ptr[index], 48 / 8); + memcpy(sig->u.MlmeAutonomousScanLossIndication.Bssid.x, &ptr[index], 48 / 8); index += 48 / 8; break; #endif @@ -2337,7 +2337,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) index += SIZEOF_UINT16; sig->u.MlmeStopAggregationRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(sig->u.MlmeStopAggregationRequest.PeerQstaAddress.x, &ptr[index], 48 / 8); + memcpy(sig->u.MlmeStopAggregationRequest.PeerQstaAddress.x, &ptr[index], 48 / 8); index += 48 / 8; sig->u.MlmeStopAggregationRequest.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; @@ -2387,7 +2387,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) index += SIZEOF_UINT32; sig->u.MlmeAddBlackoutRequest.BlackoutDuration = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT32; - CsrMemCpy(sig->u.MlmeAddBlackoutRequest.PeerStaAddress.x, &ptr[index], 48 / 8); + memcpy(sig->u.MlmeAddBlackoutRequest.PeerStaAddress.x, &ptr[index], 48 / 8); index += 48 / 8; sig->u.MlmeAddBlackoutRequest.BlackoutCount = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; @@ -2409,7 +2409,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) index += SIZEOF_UINT16; sig->u.MlmeDeletekeysRequest.KeyType = (CSR_KEY_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(sig->u.MlmeDeletekeysRequest.Address.x, &ptr[index], 48 / 8); + memcpy(sig->u.MlmeDeletekeysRequest.Address.x, &ptr[index], 48 / 8); index += 48 / 8; break; #endif @@ -2437,7 +2437,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) index += SIZEOF_UINT16; sig->u.MlmeHlSyncConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(sig->u.MlmeHlSyncConfirm.GroupAddress.x, &ptr[index], 48 / 8); + memcpy(sig->u.MlmeHlSyncConfirm.GroupAddress.x, &ptr[index], 48 / 8); index += 48 / 8; sig->u.MlmeHlSyncConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; @@ -2499,9 +2499,9 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) index += SIZEOF_UINT16; sig->u.MlmeSmStartRequest.Channel = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(sig->u.MlmeSmStartRequest.InterfaceAddress.x, &ptr[index], 48 / 8); + memcpy(sig->u.MlmeSmStartRequest.InterfaceAddress.x, &ptr[index], 48 / 8); index += 48 / 8; - CsrMemCpy(sig->u.MlmeSmStartRequest.Bssid.x, &ptr[index], 48 / 8); + memcpy(sig->u.MlmeSmStartRequest.Bssid.x, &ptr[index], 48 / 8); index += 48 / 8; sig->u.MlmeSmStartRequest.BeaconPeriod = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; @@ -2579,7 +2579,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) index += SIZEOF_UINT16; sig->u.MlmeSetkeysRequest.KeyType = (CSR_KEY_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(sig->u.MlmeSetkeysRequest.Address.x, &ptr[index], 48 / 8); + memcpy(sig->u.MlmeSetkeysRequest.Address.x, &ptr[index], 48 / 8); index += 48 / 8; sig->u.MlmeSetkeysRequest.SequenceNumber[0] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; @@ -2597,7 +2597,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) index += SIZEOF_UINT16; sig->u.MlmeSetkeysRequest.SequenceNumber[7] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(&sig->u.MlmeSetkeysRequest.CipherSuiteSelector, &ptr[index], 32 / 8); + memcpy(&sig->u.MlmeSetkeysRequest.CipherSuiteSelector, &ptr[index], 32 / 8); index += 32 / 8; break; #endif @@ -2664,7 +2664,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) index += SIZEOF_UINT16; sig->u.MaPacketErrorIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(sig->u.MaPacketErrorIndication.PeerQstaAddress.x, &ptr[index], 48 / 8); + memcpy(sig->u.MaPacketErrorIndication.PeerQstaAddress.x, &ptr[index], 48 / 8); index += 48 / 8; sig->u.MaPacketErrorIndication.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; @@ -2829,7 +2829,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) index += SIZEOF_UINT16; sig->u.MlmeBlockackErrorIndication.ResultCode = (CSR_REASON_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(sig->u.MlmeBlockackErrorIndication.PeerQstaAddress.x, &ptr[index], 48 / 8); + memcpy(sig->u.MlmeBlockackErrorIndication.PeerQstaAddress.x, &ptr[index], 48 / 8); index += 48 / 8; break; #endif @@ -2875,7 +2875,7 @@ CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) index += SIZEOF_UINT16; sig->u.MlmeStartAggregationConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(sig->u.MlmeStartAggregationConfirm.PeerQstaAddress.x, &ptr[index], 48 / 8); + memcpy(sig->u.MlmeStartAggregationConfirm.PeerQstaAddress.x, &ptr[index], 48 / 8); index += 48 / 8; sig->u.MlmeStartAggregationConfirm.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); index += SIZEOF_UINT16; @@ -3157,7 +3157,7 @@ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) index += SIZEOF_UINT16; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.VirtualInterfaceIdentifier, ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(ptr + index, sig->u.MlmeStopAggregationConfirm.PeerQstaAddress.x, 48 / 8); + memcpy(ptr + index, sig->u.MlmeStopAggregationConfirm.PeerQstaAddress.x, 48 / 8); index += 48 / 8; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.UserPriority, ptr + index); index += SIZEOF_UINT16; @@ -3264,7 +3264,7 @@ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) index += SIZEOF_UINT16; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.VirtualInterfaceIdentifier, ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(ptr + index, sig->u.MaPacketIndication.LocalTime.x, 64 / 8); + memcpy(ptr + index, sig->u.MaPacketIndication.LocalTime.x, 64 / 8); index += 64 / 8; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Ifindex, ptr + index); index += SIZEOF_UINT16; @@ -3309,7 +3309,7 @@ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) index += SIZEOF_UINT16; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectedIndication.ConnectionStatus, ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(ptr + index, sig->u.MlmeConnectedIndication.PeerMacAddress.x, 48 / 8); + memcpy(ptr + index, sig->u.MlmeConnectedIndication.PeerMacAddress.x, 48 / 8); index += 48 / 8; break; #endif @@ -3429,7 +3429,7 @@ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) index += SIZEOF_UINT16; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.VirtualInterfaceIdentifier, ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(ptr + index, sig->u.MlmeStartAggregationRequest.PeerQstaAddress.x, 48 / 8); + memcpy(ptr + index, sig->u.MlmeStartAggregationRequest.PeerQstaAddress.x, 48 / 8); index += 48 / 8; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.UserPriority, ptr + index); index += SIZEOF_UINT16; @@ -3453,7 +3453,7 @@ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) index += SIZEOF_UINT16; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncRequest.Dummydataref2.DataLength, ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(ptr + index, sig->u.MlmeHlSyncRequest.GroupAddress.x, 48 / 8); + memcpy(ptr + index, sig->u.MlmeHlSyncRequest.GroupAddress.x, 48 / 8); index += 48 / 8; break; #endif @@ -3541,7 +3541,7 @@ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) index += SIZEOF_UINT16; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetRequest.Dummydataref2.DataLength, ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(ptr + index, sig->u.MlmeResetRequest.StaAddress.x, 48 / 8); + memcpy(ptr + index, sig->u.MlmeResetRequest.StaAddress.x, 48 / 8); index += 48 / 8; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetRequest.SetDefaultMib, ptr + index); index += SIZEOF_UINT16; @@ -3629,7 +3629,7 @@ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) index += SIZEOF_UINT16; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.ConnectionStatus, ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(ptr + index, sig->u.MlmeConnectStatusRequest.StaAddress.x, 48 / 8); + memcpy(ptr + index, sig->u.MlmeConnectStatusRequest.StaAddress.x, 48 / 8); index += 48 / 8; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.AssociationId, ptr + index); index += SIZEOF_UINT16; @@ -3846,7 +3846,7 @@ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) index += SIZEOF_UINT32; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.Priority, ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(ptr + index, sig->u.MaPacketRequest.Ra.x, 48 / 8); + memcpy(ptr + index, sig->u.MaPacketRequest.Ra.x, 48 / 8); index += 48 / 8; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.TransmissionControl, ptr + index); index += SIZEOF_UINT16; @@ -3869,7 +3869,7 @@ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) index += SIZEOF_UINT16; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.CapabilityInformation, ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(ptr + index, sig->u.MlmeModifyBssParameterRequest.Bssid.x, 48 / 8); + memcpy(ptr + index, sig->u.MlmeModifyBssParameterRequest.Bssid.x, 48 / 8); index += 48 / 8; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.RtsThreshold, ptr + index); index += SIZEOF_UINT16; @@ -3917,7 +3917,7 @@ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) index += SIZEOF_UINT16; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelRequest.Dummydataref2.DataLength, ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(ptr + index, sig->u.MlmeHlSyncCancelRequest.GroupAddress.x, 48 / 8); + memcpy(ptr + index, sig->u.MlmeHlSyncCancelRequest.GroupAddress.x, 48 / 8); index += 48 / 8; break; #endif @@ -3987,7 +3987,7 @@ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) index += SIZEOF_UINT16; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceRequest.KeyType, ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(ptr + index, sig->u.MlmeGetKeySequenceRequest.Address.x, 48 / 8); + memcpy(ptr + index, sig->u.MlmeGetKeySequenceRequest.Address.x, 48 / 8); index += 48 / 8; break; #endif @@ -4007,7 +4007,7 @@ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) index += SIZEOF_UINT16; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.Channel, ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(ptr + index, sig->u.MlmeSetChannelRequest.Address.x, 48 / 8); + memcpy(ptr + index, sig->u.MlmeSetChannelRequest.Address.x, 48 / 8); index += 48 / 8; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.AvailabilityDuration, ptr + index); index += SIZEOF_UINT16; @@ -4059,7 +4059,7 @@ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) index += SIZEOF_UINT16; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanLossIndication.VirtualInterfaceIdentifier, ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(ptr + index, sig->u.MlmeAutonomousScanLossIndication.Bssid.x, 48 / 8); + memcpy(ptr + index, sig->u.MlmeAutonomousScanLossIndication.Bssid.x, 48 / 8); index += 48 / 8; break; #endif @@ -4173,7 +4173,7 @@ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) index += SIZEOF_UINT16; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationRequest.VirtualInterfaceIdentifier, ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(ptr + index, sig->u.MlmeStopAggregationRequest.PeerQstaAddress.x, 48 / 8); + memcpy(ptr + index, sig->u.MlmeStopAggregationRequest.PeerQstaAddress.x, 48 / 8); index += 48 / 8; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationRequest.UserPriority, ptr + index); index += SIZEOF_UINT16; @@ -4223,7 +4223,7 @@ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) index += SIZEOF_UINT32; CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.BlackoutDuration, ptr + index); index += SIZEOF_UINT32; - CsrMemCpy(ptr + index, sig->u.MlmeAddBlackoutRequest.PeerStaAddress.x, 48 / 8); + memcpy(ptr + index, sig->u.MlmeAddBlackoutRequest.PeerStaAddress.x, 48 / 8); index += 48 / 8; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.BlackoutCount, ptr + index); index += SIZEOF_UINT16; @@ -4245,7 +4245,7 @@ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) index += SIZEOF_UINT16; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysRequest.KeyType, ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(ptr + index, sig->u.MlmeDeletekeysRequest.Address.x, 48 / 8); + memcpy(ptr + index, sig->u.MlmeDeletekeysRequest.Address.x, 48 / 8); index += 48 / 8; break; #endif @@ -4273,7 +4273,7 @@ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) index += SIZEOF_UINT16; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncConfirm.Dummydataref2.DataLength, ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(ptr + index, sig->u.MlmeHlSyncConfirm.GroupAddress.x, 48 / 8); + memcpy(ptr + index, sig->u.MlmeHlSyncConfirm.GroupAddress.x, 48 / 8); index += 48 / 8; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncConfirm.ResultCode, ptr + index); index += SIZEOF_UINT16; @@ -4335,9 +4335,9 @@ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) index += SIZEOF_UINT16; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.Channel, ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(ptr + index, sig->u.MlmeSmStartRequest.InterfaceAddress.x, 48 / 8); + memcpy(ptr + index, sig->u.MlmeSmStartRequest.InterfaceAddress.x, 48 / 8); index += 48 / 8; - CsrMemCpy(ptr + index, sig->u.MlmeSmStartRequest.Bssid.x, 48 / 8); + memcpy(ptr + index, sig->u.MlmeSmStartRequest.Bssid.x, 48 / 8); index += 48 / 8; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.BeaconPeriod, ptr + index); index += SIZEOF_UINT16; @@ -4415,7 +4415,7 @@ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) index += SIZEOF_UINT16; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.KeyType, ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(ptr + index, sig->u.MlmeSetkeysRequest.Address.x, 48 / 8); + memcpy(ptr + index, sig->u.MlmeSetkeysRequest.Address.x, 48 / 8); index += 48 / 8; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[0], ptr + index); index += SIZEOF_UINT16; @@ -4433,7 +4433,7 @@ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) index += SIZEOF_UINT16; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[7], ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(ptr + index, &sig->u.MlmeSetkeysRequest.CipherSuiteSelector, 32 / 8); + memcpy(ptr + index, &sig->u.MlmeSetkeysRequest.CipherSuiteSelector, 32 / 8); index += 32 / 8; break; #endif @@ -4500,7 +4500,7 @@ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) index += SIZEOF_UINT16; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketErrorIndication.VirtualInterfaceIdentifier, ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(ptr + index, sig->u.MaPacketErrorIndication.PeerQstaAddress.x, 48 / 8); + memcpy(ptr + index, sig->u.MaPacketErrorIndication.PeerQstaAddress.x, 48 / 8); index += 48 / 8; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketErrorIndication.UserPriority, ptr + index); index += SIZEOF_UINT16; @@ -4665,7 +4665,7 @@ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) index += SIZEOF_UINT16; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlockackErrorIndication.ResultCode, ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(ptr + index, sig->u.MlmeBlockackErrorIndication.PeerQstaAddress.x, 48 / 8); + memcpy(ptr + index, sig->u.MlmeBlockackErrorIndication.PeerQstaAddress.x, 48 / 8); index += 48 / 8; break; #endif @@ -4711,7 +4711,7 @@ CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) index += SIZEOF_UINT16; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.VirtualInterfaceIdentifier, ptr + index); index += SIZEOF_UINT16; - CsrMemCpy(ptr + index, sig->u.MlmeStartAggregationConfirm.PeerQstaAddress.x, 48 / 8); + memcpy(ptr + index, sig->u.MlmeStartAggregationConfirm.PeerQstaAddress.x, 48 / 8); index += 48 / 8; CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.UserPriority, ptr + index); index += SIZEOF_UINT16; diff --git a/drivers/staging/csr/csr_wifi_hip_send.c b/drivers/staging/csr/csr_wifi_hip_send.c index 88b5e34..684d304 100644 --- a/drivers/staging/csr/csr_wifi_hip_send.c +++ b/drivers/staging/csr/csr_wifi_hip_send.c @@ -129,7 +129,7 @@ static CsrResult send_signal(card_t *card, const u8 *sigptr, u32 siglen, /* Make up the card_signal struct */ csptr->signal_length = (u16)siglen; - CsrMemCpy((void *)csptr->sigbuf, (void *)sigptr, siglen); + memcpy((void *)csptr->sigbuf, (void *)sigptr, siglen); for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; ++i) { diff --git a/drivers/staging/csr/csr_wifi_hip_xbv.c b/drivers/staging/csr/csr_wifi_hip_xbv.c index e841306..c503365 100644 --- a/drivers/staging/csr/csr_wifi_hip_xbv.c +++ b/drivers/staging/csr/csr_wifi_hip_xbv.c @@ -522,7 +522,7 @@ static s32 read_tag(card_t *card, ct_t *ct, tag_t *tag) } /* get section tag */ - CsrMemCpy(tag->t_name, buf, 4); + memcpy(tag->t_name, buf, 4); /* get section length */ tag->t_len = xbv2uint(buf + 4, 4); @@ -601,7 +601,7 @@ static u32 write_bytes(void *buf, const u32 offset, const u8 *data, const u32 le static u32 write_tag(void *buf, const u32 offset, const char *tag_str) { u8 *dst = (u8 *)buf + offset; - CsrMemCpy(dst, tag_str, 4); + memcpy(dst, tag_str, 4); return 4; } diff --git a/drivers/staging/csr/csr_wifi_nme_ap_lib.h b/drivers/staging/csr/csr_wifi_nme_ap_lib.h index b7ebfe4..a07511e 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_lib.h +++ b/drivers/staging/csr/csr_wifi_nme_ap_lib.h @@ -404,8 +404,8 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE #define CsrWifiNmeApWmmParamUpdateReqCreate(msg__, dst__, src__, wmmApParams__, wmmApBcParams__) \ msg__ = (CsrWifiNmeApWmmParamUpdateReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApWmmParamUpdateReq)); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_REQ, dst__, src__); \ - CsrMemCpy(msg__->wmmApParams, (wmmApParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); \ - CsrMemCpy(msg__->wmmApBcParams, (wmmApBcParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); + memcpy(msg__->wmmApParams, (wmmApParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); \ + memcpy(msg__->wmmApBcParams, (wmmApBcParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); #define CsrWifiNmeApWmmParamUpdateReqSendTo(dst__, src__, wmmApParams__, wmmApBcParams__) \ { \ @@ -474,7 +474,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE msg__->interfaceTag = (interfaceTag__); \ msg__->selectedDevicePasswordId = (selectedDevicePasswordId__); \ msg__->selectedConfigMethod = (selectedConfigMethod__); \ - CsrMemCpy(msg__->pin, (pin__), sizeof(u8) * 8); + memcpy(msg__->pin, (pin__), sizeof(u8) * 8); #define CsrWifiNmeApWpsRegisterReqSendTo(dst__, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__) \ { \ diff --git a/drivers/staging/csr/csr_wifi_nme_lib.h b/drivers/staging/csr/csr_wifi_nme_lib.h index 4ec7b94..32ae9bf 100644 --- a/drivers/staging/csr/csr_wifi_nme_lib.h +++ b/drivers/staging/csr/csr_wifi_nme_lib.h @@ -789,8 +789,8 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO #define CsrWifiNmeSimUmtsAuthIndCreate(msg__, dst__, src__, rand__, autn__) \ msg__ = (CsrWifiNmeSimUmtsAuthInd *) CsrPmemAlloc(sizeof(CsrWifiNmeSimUmtsAuthInd)); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_UMTS_AUTH_IND, dst__, src__); \ - CsrMemCpy(msg__->rand, (rand__), sizeof(u8) * 16); \ - CsrMemCpy(msg__->autn, (autn__), sizeof(u8) * 16); + memcpy(msg__->rand, (rand__), sizeof(u8) * 16); \ + memcpy(msg__->autn, (autn__), sizeof(u8) * 16); #define CsrWifiNmeSimUmtsAuthIndSendTo(dst__, src__, rand__, autn__) \ { \ @@ -838,11 +838,11 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_UMTS_AUTH_RES, dst__, src__); \ msg__->status = (status__); \ msg__->result = (result__); \ - CsrMemCpy(msg__->umtsCipherKey, (umtsCipherKey__), sizeof(u8) * 16); \ - CsrMemCpy(msg__->umtsIntegrityKey, (umtsIntegrityKey__), sizeof(u8) * 16); \ + memcpy(msg__->umtsCipherKey, (umtsCipherKey__), sizeof(u8) * 16); \ + memcpy(msg__->umtsIntegrityKey, (umtsIntegrityKey__), sizeof(u8) * 16); \ msg__->resParameterLength = (resParameterLength__); \ msg__->resParameter = (resParameter__); \ - CsrMemCpy(msg__->auts, (auts__), sizeof(u8) * 14); + memcpy(msg__->auts, (auts__), sizeof(u8) * 14); #define CsrWifiNmeSimUmtsAuthResSendTo(dst__, src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__) \ { \ @@ -1033,7 +1033,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO msg__ = (CsrWifiNmeWpsReq *) CsrPmemAlloc(sizeof(CsrWifiNmeWpsReq)); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ - CsrMemCpy(msg__->pin, (pin__), sizeof(u8) * 8); \ + memcpy(msg__->pin, (pin__), sizeof(u8) * 8); \ msg__->ssid = (ssid__); \ msg__->bssid = (bssid__); diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_lib.h b/drivers/staging/csr/csr_wifi_router_ctrl_lib.h index df9dd9b..97d675a 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_lib.h +++ b/drivers/staging/csr/csr_wifi_router_ctrl_lib.h @@ -2042,7 +2042,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI msg__->clientData = (clientData__); \ msg__->status = (status__); \ msg__->numInterfaceAddress = (numInterfaceAddress__); \ - CsrMemCpy(msg__->stationMacAddress, (stationMacAddress__), sizeof(CsrWifiMacAddress) * 2); \ + memcpy(msg__->stationMacAddress, (stationMacAddress__), sizeof(CsrWifiMacAddress) * 2); \ msg__->smeVersions = (smeVersions__); \ msg__->scheduledInterrupt = (scheduledInterrupt__); diff --git a/drivers/staging/csr/csr_wifi_sme_ap_lib.h b/drivers/staging/csr/csr_wifi_sme_ap_lib.h index 22a3419..06a6f32 100644 --- a/drivers/staging/csr/csr_wifi_sme_ap_lib.h +++ b/drivers/staging/csr/csr_wifi_sme_ap_lib.h @@ -524,7 +524,7 @@ extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTRE msg__->secIeLength = (secIeLength__); \ msg__->secIe = (secIe__); \ msg__->groupKeyId = (groupKeyId__); \ - CsrMemCpy(msg__->seqNumber, (seqNumber__), sizeof(u16) * 8); + memcpy(msg__->seqNumber, (seqNumber__), sizeof(u16) * 8); #define CsrWifiSmeApStaNotifyIndSendTo(dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__) \ { \ @@ -556,8 +556,8 @@ extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTRE msg__ = (CsrWifiSmeApWmmParamUpdateReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApWmmParamUpdateReq)); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WMM_PARAM_UPDATE_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ - CsrMemCpy(msg__->wmmApParams, (wmmApParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); \ - CsrMemCpy(msg__->wmmApBcParams, (wmmApBcParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); + memcpy(msg__->wmmApParams, (wmmApParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); \ + memcpy(msg__->wmmApBcParams, (wmmApBcParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); #define CsrWifiSmeApWmmParamUpdateReqSendTo(dst__, src__, interfaceTag__, wmmApParams__, wmmApBcParams__) \ { \ diff --git a/drivers/staging/csr/csr_wifi_sme_lib.h b/drivers/staging/csr/csr_wifi_sme_lib.h index f320bd4..5b1b863 100644 --- a/drivers/staging/csr/csr_wifi_sme_lib.h +++ b/drivers/staging/csr/csr_wifi_sme_lib.h @@ -1808,7 +1808,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_CFM, dst__, src__); \ msg__->status = (status__); \ msg__->numInterfaces = (numInterfaces__); \ - CsrMemCpy(msg__->capBitmap, (capBitmap__), sizeof(u8) * 2); + memcpy(msg__->capBitmap, (capBitmap__), sizeof(u8) * 2); #define CsrWifiSmeInterfaceCapabilityGetCfmSendTo(dst__, src__, status__, numInterfaces__, capBitmap__) \ { \ @@ -3751,7 +3751,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO msg__ = (CsrWifiSmeStationMacAddressGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeStationMacAddressGetCfm)); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_STATION_MAC_ADDRESS_GET_CFM, dst__, src__); \ msg__->status = (status__); \ - CsrMemCpy(msg__->stationMacAddress, (stationMacAddress__), sizeof(CsrWifiMacAddress) * 2); + memcpy(msg__->stationMacAddress, (stationMacAddress__), sizeof(CsrWifiMacAddress) * 2); #define CsrWifiSmeStationMacAddressGetCfmSendTo(dst__, src__, status__, stationMacAddress__) \ { \ diff --git a/drivers/staging/csr/sme_mgt.c b/drivers/staging/csr/sme_mgt.c index 28295ef..e252883 100644 --- a/drivers/staging/csr/sme_mgt.c +++ b/drivers/staging/csr/sme_mgt.c @@ -149,7 +149,7 @@ void CsrWifiSmeScanResultsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) for (i = 0; i < cfm->scanResultsCount; ++i) { CsrWifiSmeScanResult *scan_result = &scanCopy[i]; - CsrMemCpy(current_buff, scan_result->informationElements, scan_result->informationElementsLength); + memcpy(current_buff, scan_result->informationElements, scan_result->informationElementsLength); scan_result->informationElements = current_buff; current_buff += scan_result->informationElementsLength; } diff --git a/drivers/staging/csr/unifi_sme.c b/drivers/staging/csr/unifi_sme.c index 2fe7b57..51d6792 100644 --- a/drivers/staging/csr/unifi_sme.c +++ b/drivers/staging/csr/unifi_sme.c @@ -130,7 +130,7 @@ sme_log_event(ul_client_t *pcli, raddr = macHdrLocation + MAC_HEADER_ADDR1_OFFSET; taddr = macHdrLocation + MAC_HEADER_ADDR2_OFFSET; - CsrMemCpy(peerMacAddress.a, taddr, ETH_ALEN); + memcpy(peerMacAddress.a, taddr, ETH_ALEN); if(ind->ReceptionStatus == CSR_MICHAEL_MIC_ERROR) { @@ -1218,7 +1218,7 @@ void uf_send_pkt_to_encrypt(struct work_struct *work) spin_lock_irqsave(&priv->wapi_lock, flags); /* Copy over the MA PKT REQ bulk data */ - CsrMemCpy(pktBulkData, (u8*)interfacePriv->wapi_unicast_bulk_data.os_data_ptr, pktBulkDataLength); + memcpy(pktBulkData, (u8*)interfacePriv->wapi_unicast_bulk_data.os_data_ptr, pktBulkDataLength); /* Free any bulk data buffers allocated for the WAPI Data pkt */ unifi_net_data_free(priv, &interfacePriv->wapi_unicast_bulk_data); interfacePriv->wapi_unicast_bulk_data.net_buf_length = 0; -- cgit v0.10.2 From ed51b4d84e7a11813bf09c5db41cedec18a69d50 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 15:04:31 -0700 Subject: staging: csr: make CsrUInt16ToHex static MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We do this by moving it from csr_util.c to csr_wifi_hip_card_sdio_intr.c as that's the only place that called it. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index ae2e1dcb..09dd754 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -15,24 +15,6 @@ #include "csr_pmem.h" #include "csr_util.h" -/*------------------------------------------------------------------*/ -/* Base conversion */ -/*------------------------------------------------------------------*/ -/* Convert signed 32 bit (or less) integer to string */ -void CsrUInt16ToHex(u16 number, char *str) -{ - u16 index; - u16 currentValue; - - for (index = 0; index < 4; index++) - { - currentValue = (u16) (number & 0x000F); - number >>= 4; - str[3 - index] = (char) (currentValue > 9 ? currentValue + 55 : currentValue + '0'); - } - str[4] = '\0'; -} - MODULE_DESCRIPTION("CSR Operating System Kernel Abstraction"); MODULE_AUTHOR("Cambridge Silicon Radio Ltd."); MODULE_LICENSE("GPL and additional rights"); diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index d60d8df..80c2f2b 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -18,11 +18,6 @@ extern "C" { #include #include "csr_macro.h" -/*------------------------------------------------------------------*/ -/* Base conversion */ -/*------------------------------------------------------------------*/ -void CsrUInt16ToHex(u16 number, char *str); - #define CsrOffsetOf(st, m) ((size_t) & ((st *) 0)->m) #ifdef __cplusplus diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c index 6536cb3..9fdd577 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c @@ -128,6 +128,22 @@ void unifi_debug_log_to_buf(const char *fmt, ...) } /* unifi_debug_log_to_buf() */ +/* Convert signed 32 bit (or less) integer to string */ +static void CsrUInt16ToHex(u16 number, char *str) +{ + u16 index; + u16 currentValue; + + for (index = 0; index < 4; index++) + { + currentValue = (u16) (number & 0x000F); + number >>= 4; + str[3 - index] = (char) (currentValue > 9 ? currentValue + 55 : currentValue + '0'); + } + str[4] = '\0'; +} + + /* * --------------------------------------------------------------------------- * unifi_debug_hex_to_buf -- cgit v0.10.2 From 2c92e28ee5b53408cccc062d92ef04ba8980716e Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 15:06:15 -0700 Subject: stating: csr: remove unneeded #includes in csr_util.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This .c file only holds the MODULE_* stuff for the module, so remove the other #include calls as they are not needed anymore. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index 09dd754..c3aa9d5 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -8,12 +8,7 @@ *****************************************************************************/ -#include #include -#include - -#include "csr_pmem.h" -#include "csr_util.h" MODULE_DESCRIPTION("CSR Operating System Kernel Abstraction"); MODULE_AUTHOR("Cambridge Silicon Radio Ltd."); -- cgit v0.10.2 From df738509ba49617303f7f07cda4fb6066fec0ed7 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 15:09:16 -0700 Subject: staging: csr: remove CsrOffSetOf() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's really just offsetof, so call that instead. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index 80c2f2b..17e241d 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -9,19 +9,8 @@ on the license terms. *****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif - #include #include #include "csr_macro.h" -#define CsrOffsetOf(st, m) ((size_t) & ((st *) 0)->m) - -#ifdef __cplusplus -} -#endif - #endif diff --git a/drivers/staging/csr/csr_wifi_hip_signals.c b/drivers/staging/csr/csr_wifi_hip_signals.c index d3dc9bd..3c82132 100644 --- a/drivers/staging/csr/csr_wifi_hip_signals.c +++ b/drivers/staging/csr/csr_wifi_hip_signals.c @@ -22,361 +22,361 @@ s32 SigGetSize(const CSR_SIGNAL *aSignal) switch (aSignal->SignalPrimitiveHeader.SignalId) { case CSR_MA_PACKET_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_REQUEST); case CSR_MA_PACKET_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_CONFIRM); case CSR_MA_PACKET_INDICATION_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_INDICATION); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_INDICATION); case CSR_MA_PACKET_CANCEL_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_CANCEL_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_CANCEL_REQUEST); case CSR_MA_VIF_AVAILABILITY_RESPONSE_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_VIF_AVAILABILITY_RESPONSE); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_VIF_AVAILABILITY_RESPONSE); case CSR_MA_VIF_AVAILABILITY_INDICATION_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_VIF_AVAILABILITY_INDICATION); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_VIF_AVAILABILITY_INDICATION); case CSR_MA_PACKET_ERROR_INDICATION_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_ERROR_INDICATION); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_ERROR_INDICATION); #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_RESET_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_RESET_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_RESET_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_RESET_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_RESET_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_RESET_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_GET_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_GET_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_SET_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_SET_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_GET_NEXT_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_NEXT_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_NEXT_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_GET_NEXT_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_NEXT_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_NEXT_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_POWERMGT_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_POWERMGT_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_POWERMGT_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_POWERMGT_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_POWERMGT_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_POWERMGT_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_SCAN_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SCAN_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SCAN_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_SCAN_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SCAN_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SCAN_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_HL_SYNC_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_HL_SYNC_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_HL_SYNC_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_HL_SYNC_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_HL_SYNC_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_HL_SYNC_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_MEASURE_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MEASURE_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MEASURE_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_MEASURE_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MEASURE_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MEASURE_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_MEASURE_INDICATION_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MEASURE_INDICATION); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MEASURE_INDICATION); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_SETKEYS_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SETKEYS_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SETKEYS_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_SETKEYS_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SETKEYS_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SETKEYS_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_DELETEKEYS_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DELETEKEYS_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DELETEKEYS_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_DELETEKEYS_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DELETEKEYS_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DELETEKEYS_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_CONNECTED_INDICATION_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONNECTED_INDICATION); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONNECTED_INDICATION); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_SCAN_CANCEL_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SCAN_CANCEL_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SCAN_CANCEL_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_HL_SYNC_CANCEL_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_HL_SYNC_CANCEL_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_HL_SYNC_CANCEL_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_HL_SYNC_CANCEL_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_HL_SYNC_CANCEL_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_ADD_PERIODIC_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_PERIODIC_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_PERIODIC_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_ADD_PERIODIC_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_PERIODIC_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_PERIODIC_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_DEL_PERIODIC_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_PERIODIC_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_PERIODIC_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_DEL_PERIODIC_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_PERIODIC_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_PERIODIC_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_SET_PACKET_FILTER_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_PACKET_FILTER_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_PACKET_FILTER_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_PACKET_FILTER_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_PACKET_FILTER_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_STOP_MEASURE_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_STOP_MEASURE_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_STOP_MEASURE_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_STOP_MEASURE_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_STOP_MEASURE_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_STOP_MEASURE_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_ADD_TRIGGERED_GET_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TRIGGERED_GET_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TRIGGERED_GET_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TRIGGERED_GET_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TRIGGERED_GET_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_DEL_TRIGGERED_GET_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_TRIGGERED_GET_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_TRIGGERED_GET_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_TRIGGERED_GET_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_TRIGGERED_GET_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_TRIGGERED_GET_INDICATION_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_TRIGGERED_GET_INDICATION); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_TRIGGERED_GET_INDICATION); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_ADD_BLACKOUT_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_BLACKOUT_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_BLACKOUT_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_ADD_BLACKOUT_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_BLACKOUT_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_BLACKOUT_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_BLACKOUT_ENDED_INDICATION_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_BLACKOUT_ENDED_INDICATION); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_BLACKOUT_ENDED_INDICATION); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_DEL_BLACKOUT_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_BLACKOUT_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_BLACKOUT_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_DEL_BLACKOUT_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_BLACKOUT_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_BLACKOUT_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_ADD_RX_TRIGGER_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_RX_TRIGGER_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_RX_TRIGGER_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_RX_TRIGGER_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_RX_TRIGGER_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_DEL_RX_TRIGGER_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_RX_TRIGGER_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_RX_TRIGGER_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_RX_TRIGGER_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_RX_TRIGGER_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_CONNECT_STATUS_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONNECT_STATUS_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONNECT_STATUS_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_CONNECT_STATUS_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONNECT_STATUS_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONNECT_STATUS_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_ADD_TEMPLATE_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TEMPLATE_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TEMPLATE_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_ADD_TEMPLATE_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TEMPLATE_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TEMPLATE_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_CONFIG_QUEUE_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONFIG_QUEUE_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONFIG_QUEUE_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_CONFIG_QUEUE_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONFIG_QUEUE_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONFIG_QUEUE_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_ADD_TSPEC_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TSPEC_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TSPEC_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_ADD_TSPEC_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TSPEC_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TSPEC_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_DEL_TSPEC_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_TSPEC_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_TSPEC_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_DEL_TSPEC_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_TSPEC_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_TSPEC_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_START_AGGREGATION_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_START_AGGREGATION_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_START_AGGREGATION_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_START_AGGREGATION_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_START_AGGREGATION_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_START_AGGREGATION_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_BLOCKACK_ERROR_INDICATION_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_BLOCKACK_ERROR_INDICATION); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_BLOCKACK_ERROR_INDICATION); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_STOP_AGGREGATION_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_STOP_AGGREGATION_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_STOP_AGGREGATION_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_STOP_AGGREGATION_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_STOP_AGGREGATION_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_STOP_AGGREGATION_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_SM_START_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SM_START_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SM_START_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_SM_START_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SM_START_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SM_START_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_LEAVE_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_LEAVE_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_LEAVE_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_LEAVE_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_LEAVE_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_LEAVE_CONFIRM); #endif case CSR_MLME_SET_TIM_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_TIM_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_TIM_REQUEST); case CSR_MLME_SET_TIM_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_TIM_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_TIM_CONFIRM); #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_GET_KEY_SEQUENCE_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_KEY_SEQUENCE_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_KEY_SEQUENCE_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_KEY_SEQUENCE_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_KEY_SEQUENCE_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_SET_CHANNEL_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_CHANNEL_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_CHANNEL_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_SET_CHANNEL_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_CHANNEL_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_CHANNEL_CONFIRM); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST); #endif #ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET case CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM); #endif case CSR_DEBUG_STRING_INDICATION_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_STRING_INDICATION); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_STRING_INDICATION); case CSR_DEBUG_WORD16_INDICATION_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_WORD16_INDICATION); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_WORD16_INDICATION); case CSR_DEBUG_GENERIC_REQUEST_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_GENERIC_REQUEST); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_GENERIC_REQUEST); case CSR_DEBUG_GENERIC_CONFIRM_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_GENERIC_CONFIRM); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_GENERIC_CONFIRM); case CSR_DEBUG_GENERIC_INDICATION_ID: - return CsrOffsetOf(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_GENERIC_INDICATION); + return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_GENERIC_INDICATION); default: return 0; } -- cgit v0.10.2 From d63123fc5084d5e38074ad8fb3f08a39747bcea6 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 15:14:52 -0700 Subject: staging: csr: remove csr_util.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that the header file has nothing in it, remove it from the tree, and adjust the places that were including it. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_formatted_io.c b/drivers/staging/csr/csr_formatted_io.c index bda8712..7213cc8 100644 --- a/drivers/staging/csr/csr_formatted_io.c +++ b/drivers/staging/csr/csr_formatted_io.c @@ -7,9 +7,8 @@ on the license terms. *****************************************************************************/ - +#include #include "csr_formatted_io.h" -#include "csr_util.h" s32 CsrSnprintf(char *dest, size_t n, const char *fmt, ...) { diff --git a/drivers/staging/csr/csr_msgconv.c b/drivers/staging/csr/csr_msgconv.c index a2e0842..04ce4ae 100644 --- a/drivers/staging/csr/csr_msgconv.c +++ b/drivers/staging/csr/csr_msgconv.c @@ -14,7 +14,7 @@ #include "csr_panic.h" #include "csr_sched.h" #include "csr_msgconv.h" -#include "csr_util.h" +#include "csr_macro.h" static CsrMsgConvEntry *converter; diff --git a/drivers/staging/csr/csr_pmem.h b/drivers/staging/csr/csr_pmem.h index 36adf22..5e8b6a0 100644 --- a/drivers/staging/csr/csr_pmem.h +++ b/drivers/staging/csr/csr_pmem.h @@ -11,7 +11,7 @@ *****************************************************************************/ #include -#include "csr_util.h" +#include "csr_macro.h" #ifdef __cplusplus extern "C" { diff --git a/drivers/staging/csr/csr_serialize_primitive_types.c b/drivers/staging/csr/csr_serialize_primitive_types.c index dfb89f1..a4b5632 100644 --- a/drivers/staging/csr/csr_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_serialize_primitive_types.c @@ -11,7 +11,7 @@ #include #include "csr_prim_defs.h" #include "csr_msgconv.h" -#include "csr_util.h" +#include "csr_macro.h" #include "csr_pmem.h" #include "csr_lib.h" diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index 682efa9..be48097 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -10,7 +10,7 @@ #include #include "csr_pmem.h" #include "csr_unicode.h" -#include "csr_util.h" +#include "csr_macro.h" #define UNI_SUR_HIGH_START ((u32) 0xD800) #define UNI_SUR_HIGH_END ((u32) 0xDBFF) diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h deleted file mode 100644 index 17e241d..0000000 --- a/drivers/staging/csr/csr_util.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef CSR_UTIL_H__ -#define CSR_UTIL_H__ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ -#include -#include -#include "csr_macro.h" - -#endif diff --git a/drivers/staging/csr/csr_wifi_fsm_types.h b/drivers/staging/csr/csr_wifi_fsm_types.h index c378cca..3251fa9 100644 --- a/drivers/staging/csr/csr_wifi_fsm_types.h +++ b/drivers/staging/csr/csr_wifi_fsm_types.h @@ -16,7 +16,7 @@ extern "C" { #endif #include -#include "csr_util.h" +#include "csr_macro.h" #include "csr_pmem.h" #include "csr_panic.h" #include "csr_sched.h" diff --git a/drivers/staging/csr/csr_wifi_hip_unifi.h b/drivers/staging/csr/csr_wifi_hip_unifi.h index 88f24ba..cabcf56 100644 --- a/drivers/staging/csr/csr_wifi_hip_unifi.h +++ b/drivers/staging/csr/csr_wifi_hip_unifi.h @@ -98,7 +98,7 @@ extern "C" { #include "csr_framework_ext.h" /* from the synergy porting folder */ #include "csr_sdio.h" /* from the synergy porting folder */ #include "csr_pmem.h" /* from the synergy porting folder */ -#include "csr_util.h" /* from the synergy porting folder */ +#include "csr_macro.h" /* from the synergy porting folder */ #include "csr_formatted_io.h" /* from the synergy gsp folder */ #include "csr_wifi_result.h" diff --git a/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c b/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c index fed0e65..ce2c7d5 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c +++ b/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c @@ -12,7 +12,7 @@ #include "csr_msgconv.h" #include "csr_pmem.h" -#include "csr_util.h" +#include "csr_macro.h" #ifdef CSR_WIFI_NME_ENABLE #ifdef CSR_WIFI_AP_ENABLE diff --git a/drivers/staging/csr/csr_wifi_nme_ap_lib.h b/drivers/staging/csr/csr_wifi_nme_ap_lib.h index a07511e..45b8d26 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_lib.h +++ b/drivers/staging/csr/csr_wifi_nme_ap_lib.h @@ -15,7 +15,7 @@ #include "csr_pmem.h" #include "csr_sched.h" -#include "csr_util.h" +#include "csr_macro.h" #include "csr_msg_transport.h" #include "csr_wifi_lib.h" diff --git a/drivers/staging/csr/csr_wifi_nme_lib.h b/drivers/staging/csr/csr_wifi_nme_lib.h index 32ae9bf..4d8f3f1 100644 --- a/drivers/staging/csr/csr_wifi_nme_lib.h +++ b/drivers/staging/csr/csr_wifi_nme_lib.h @@ -15,7 +15,7 @@ #include "csr_pmem.h" #include "csr_sched.h" -#include "csr_util.h" +#include "csr_macro.h" #include "csr_msg_transport.h" #include "csr_wifi_lib.h" diff --git a/drivers/staging/csr/csr_wifi_router_converter_init.c b/drivers/staging/csr/csr_wifi_router_converter_init.c index c90d208..a321786 100644 --- a/drivers/staging/csr/csr_wifi_router_converter_init.c +++ b/drivers/staging/csr/csr_wifi_router_converter_init.c @@ -12,7 +12,7 @@ #include "csr_msgconv.h" #include "csr_pmem.h" -#include "csr_util.h" +#include "csr_macro.h" #ifdef CSR_LOG_ENABLE diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c b/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c index 4dd8e6f..503f1af 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c @@ -12,8 +12,7 @@ #include "csr_msgconv.h" #include "csr_pmem.h" -#include "csr_util.h" - +#include "csr_macro.h" #ifdef CSR_LOG_ENABLE #include "csr_log.h" diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_lib.h b/drivers/staging/csr/csr_wifi_router_ctrl_lib.h index 97d675a..fd21467 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_lib.h +++ b/drivers/staging/csr/csr_wifi_router_ctrl_lib.h @@ -15,7 +15,7 @@ #include "csr_pmem.h" #include "csr_sched.h" -#include "csr_util.h" +#include "csr_macro.h" #include "csr_msg_transport.h" #include "csr_wifi_lib.h" diff --git a/drivers/staging/csr/csr_wifi_router_lib.h b/drivers/staging/csr/csr_wifi_router_lib.h index 2ca557c..e5f1f63 100644 --- a/drivers/staging/csr/csr_wifi_router_lib.h +++ b/drivers/staging/csr/csr_wifi_router_lib.h @@ -15,7 +15,7 @@ #include "csr_pmem.h" #include "csr_sched.h" -#include "csr_util.h" +#include "csr_macro.h" #include "csr_msg_transport.h" #include "csr_wifi_lib.h" diff --git a/drivers/staging/csr/csr_wifi_serialize_primitive_types.c b/drivers/staging/csr/csr_wifi_serialize_primitive_types.c index e73f94b..661d320 100644 --- a/drivers/staging/csr/csr_wifi_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_wifi_serialize_primitive_types.c @@ -10,7 +10,7 @@ #include #include "csr_pmem.h" -#include "csr_util.h" +#include "csr_macro.h" #include "csr_msgconv.h" #include "csr_wifi_msgconv.h" #include "csr_wifi_lib.h" diff --git a/drivers/staging/csr/csr_wifi_sme_ap_lib.h b/drivers/staging/csr/csr_wifi_sme_ap_lib.h index 06a6f32..8834a3b 100644 --- a/drivers/staging/csr/csr_wifi_sme_ap_lib.h +++ b/drivers/staging/csr/csr_wifi_sme_ap_lib.h @@ -15,7 +15,7 @@ #include "csr_pmem.h" #include "csr_sched.h" -#include "csr_util.h" +#include "csr_macro.h" #include "csr_msg_transport.h" #include "csr_wifi_lib.h" diff --git a/drivers/staging/csr/csr_wifi_sme_converter_init.c b/drivers/staging/csr/csr_wifi_sme_converter_init.c index 62b94e7..2d9c683 100644 --- a/drivers/staging/csr/csr_wifi_sme_converter_init.c +++ b/drivers/staging/csr/csr_wifi_sme_converter_init.c @@ -12,7 +12,7 @@ #include "csr_msgconv.h" #include "csr_pmem.h" -#include "csr_util.h" +#include "csr_macro.h" #ifdef CSR_LOG_ENABLE diff --git a/drivers/staging/csr/csr_wifi_sme_lib.h b/drivers/staging/csr/csr_wifi_sme_lib.h index 5b1b863..7fa9c23 100644 --- a/drivers/staging/csr/csr_wifi_sme_lib.h +++ b/drivers/staging/csr/csr_wifi_sme_lib.h @@ -15,7 +15,7 @@ #include "csr_pmem.h" #include "csr_sched.h" -#include "csr_util.h" +#include "csr_macro.h" #include "csr_msg_transport.h" #include "csr_wifi_lib.h" -- cgit v0.10.2 From 4fe9db37104f833972486355fe86d7dcd29279b5 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 15:26:55 -0700 Subject: staging: csr: remove CsrMemFree() and CsrMemFreeDma() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They were just wrappers around kfree() so call that instead. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_framework_ext.c b/drivers/staging/csr/csr_framework_ext.c index 7a0d660..22345e8 100644 --- a/drivers/staging/csr/csr_framework_ext.c +++ b/drivers/staging/csr/csr_framework_ext.c @@ -196,23 +196,6 @@ EXPORT_SYMBOL_GPL(CsrMemAlloc); /*----------------------------------------------------------------------------* * NAME - * CsrMemFree - * - * DESCRIPTION - * Free dynamic allocated memory. - * - * RETURNS - * void - * - *----------------------------------------------------------------------------*/ -void CsrMemFree(void *pointer) -{ - kfree(pointer); -} -EXPORT_SYMBOL_GPL(CsrMemFree); - -/*----------------------------------------------------------------------------* - * NAME * CsrMemAllocDma * * DESCRIPTION @@ -228,20 +211,3 @@ void *CsrMemAllocDma(size_t size) return kmalloc(size, GFP_KERNEL | GFP_DMA); } EXPORT_SYMBOL_GPL(CsrMemAllocDma); - -/*----------------------------------------------------------------------------* - * NAME - * CsrMemFreeDma - * - * DESCRIPTION - * Free DMA capable dynamic allocated memory. - * - * RETURNS - * void - * - *----------------------------------------------------------------------------*/ -void CsrMemFreeDma(void *pointer) -{ - kfree(pointer); -} -EXPORT_SYMBOL_GPL(CsrMemFreeDma); diff --git a/drivers/staging/csr/csr_framework_ext.h b/drivers/staging/csr/csr_framework_ext.h index 46689c1..a3fc152 100644 --- a/drivers/staging/csr/csr_framework_ext.h +++ b/drivers/staging/csr/csr_framework_ext.h @@ -285,19 +285,6 @@ void *CsrMemCalloc(size_t numberOfElements, size_t elementSize); /*----------------------------------------------------------------------------* * NAME - * CsrMemFree - * - * DESCRIPTION - * Free dynamic allocated memory. - * - * RETURNS - * void - * - *----------------------------------------------------------------------------*/ -void CsrMemFree(void *pointer); - -/*----------------------------------------------------------------------------* - * NAME * CsrMemAllocDma * * DESCRIPTION @@ -317,18 +304,6 @@ void *CsrMemAllocDma(size_t size); #endif -/*----------------------------------------------------------------------------* - * NAME - * CsrMemFreeDma - * - * DESCRIPTION - * Free dynamic memory allocated by CsrMemAllocDma. - * - * RETURNS - * void - * - *----------------------------------------------------------------------------*/ -void CsrMemFreeDma(void *pointer); #else #include "csr_pmem.h" @@ -337,12 +312,8 @@ void CsrMemFreeDma(void *pointer); #define CsrMemCalloc(numberOfElements, elementSize) CsrPmemDebugAlloc((numberOfElements * elementSize), CSR_PMEM_DEBUG_TYPE_MEM_CALLOC, __FILE__, __LINE__) -#define CsrMemFree(ptr) CsrPmemDebugFree(ptr,CSR_PMEM_DEBUG_TYPE_MEM_ALLOC, __FILE__, __LINE__) - #define CsrMemAllocDma(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC_DMA, __FILE__, __LINE__) -#define CsrMemFreeDma(ptr) CsrPmemDebugFree(ptr, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC_DMA, __FILE__, __LINE__) - #endif diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.c b/drivers/staging/csr/csr_wifi_hip_card_sdio.c index 78fc5c4..4f2d2e3 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.c @@ -21,6 +21,7 @@ * * --------------------------------------------------------------------------- */ +#include #include "csr_wifi_hip_unifi.h" #include "csr_wifi_hip_conversions.h" #include "csr_wifi_hip_unifiversion.h" @@ -1793,37 +1794,22 @@ static void card_free_memory_resources(card_t *card) unifi_cancel_pending_signals(card); - if (card->to_host_data) - { - CsrMemFree(card->to_host_data); - card->to_host_data = NULL; - } + kfree(card->to_host_data); + card->to_host_data = NULL; - if (card->from_host_data) - { - CsrMemFree(card->from_host_data); - card->from_host_data = NULL; - } + kfree(card->from_host_data); + card->from_host_data = NULL; /* free the memory for slot host tag mapping array */ - if (card->fh_slot_host_tag_record) - { - CsrMemFree(card->fh_slot_host_tag_record); - card->fh_slot_host_tag_record = NULL; - } + kfree(card->fh_slot_host_tag_record); + card->fh_slot_host_tag_record = NULL; - if (card->fh_buffer.buf) - { - CsrMemFreeDma(card->fh_buffer.buf); - } + kfree(card->fh_buffer.buf); card->fh_buffer.ptr = card->fh_buffer.buf = NULL; card->fh_buffer.bufsize = 0; card->fh_buffer.count = 0; - if (card->th_buffer.buf) - { - CsrMemFreeDma(card->th_buffer.buf); - } + kfree(card->th_buffer.buf); card->th_buffer.ptr = card->th_buffer.buf = NULL; card->th_buffer.bufsize = 0; card->th_buffer.count = 0; @@ -1984,7 +1970,7 @@ void unifi_free_card(card_t *card) unifi_coredump_free(card); /* free anyway to prevent memory leak */ } - CsrMemFree(card); + kfree(card); func_exit(); } /* unifi_free_card() */ diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c index 9fdd577..9789579 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c @@ -1817,7 +1817,7 @@ static CsrResult process_bulk_data_command(card_t *card, const u8 *cmdptr, /* moving this check before we clear host data slot */ if ((len != 0) && (dir == UNIFI_SDIO_WRITE) && (((ptrdiff_t)bdslot->os_data_ptr + offset) & 3)) { - CsrMemFreeDma(host_bulk_data_slot); + kfree(host_bulk_data_slot); } #endif diff --git a/drivers/staging/csr/csr_wifi_hip_download.c b/drivers/staging/csr/csr_wifi_hip_download.c index 15da98e..1a1dfb6 100644 --- a/drivers/staging/csr/csr_wifi_hip_download.c +++ b/drivers/staging/csr/csr_wifi_hip_download.c @@ -17,6 +17,7 @@ * * --------------------------------------------------------------------------- */ +#include #include "csr_wifi_hip_unifi.h" #include "csr_wifi_hip_unifiversion.h" #include "csr_wifi_hip_card.h" @@ -270,7 +271,7 @@ static CsrResult do_patch_convert_download(card_t *card, void *dlpriv, xbv1_t *p /* Download the patch */ unifi_info(card->ospriv, "Downloading converted f/w as patch\n"); r = unifi_dl_patch(card, desc, sym.obj); - CsrMemFree(pfw); + kfree(pfw); unifi_fw_close_buffer(card->ospriv, desc); if (r != CSR_RESULT_SUCCESS) @@ -347,7 +348,7 @@ CsrResult unifi_dl_firmware(card_t *card, void *dlpriv) { unifi_error(card->ospriv, "File type is %s, expected firmware.\n", fwinfo->mode == xbv_patch?"patch" : "unknown"); - CsrMemFree(fwinfo); + kfree(fwinfo); return CSR_WIFI_HIP_RESULT_INVALID_VALUE; } @@ -372,7 +373,7 @@ CsrResult unifi_dl_firmware(card_t *card, void *dlpriv) r = CSR_WIFI_HIP_RESULT_INVALID_VALUE; } - CsrMemFree(fwinfo); + kfree(fwinfo); func_exit_r(r); return r; } /* unifi_dl_firmware() */ @@ -426,7 +427,7 @@ CsrResult unifi_dl_patch(card_t *card, void *dlpriv, u32 boot_ctrl) r = xbv1_parse(card, unifi_fw_read, dlpriv, fwinfo); if (r != CSR_RESULT_SUCCESS || fwinfo->mode != xbv_patch) { - CsrMemFree(fwinfo); + kfree(fwinfo); unifi_error(card->ospriv, "Failed to read in patch file\n"); func_exit(); return CSR_WIFI_HIP_RESULT_INVALID_VALUE; @@ -441,7 +442,7 @@ CsrResult unifi_dl_patch(card_t *card, void *dlpriv, u32 boot_ctrl) { unifi_error(card->ospriv, "Wrong patch file for chip (chip = %lu, file = %lu)\n", card->build_id, fwinfo->build_id); - CsrMemFree(fwinfo); + kfree(fwinfo); #ifndef CSR_WIFI_IGNORE_PATCH_VERSION_MISMATCH func_exit(); return CSR_WIFI_HIP_RESULT_INVALID_VALUE; @@ -458,7 +459,7 @@ CsrResult unifi_dl_patch(card_t *card, void *dlpriv, u32 boot_ctrl) unifi_error(card->ospriv, "Failed to patch image\n"); } - CsrMemFree(fwinfo); + kfree(fwinfo); func_exit_r(r); return r; @@ -720,7 +721,7 @@ static CsrResult send_ptdl_to_unifi(card_t *card, void *dlpriv, } } - CsrMemFreeDma(buf); + kfree(buf); if (r != CSR_RESULT_SUCCESS && r != CSR_WIFI_HIP_RESULT_NO_DEVICE) { diff --git a/drivers/staging/csr/csr_wifi_hip_dump.c b/drivers/staging/csr/csr_wifi_hip_dump.c index 0d1f9df..350d9d2 100644 --- a/drivers/staging/csr/csr_wifi_hip_dump.c +++ b/drivers/staging/csr/csr_wifi_hip_dump.c @@ -17,6 +17,7 @@ * * --------------------------------------------------------------------------- */ +#include #include "csr_wifi_hip_unifi.h" #include "csr_wifi_hip_unifiversion.h" #include "csr_wifi_hip_card.h" @@ -696,7 +697,7 @@ coredump_buffer* new_coredump_node(void *ospriv, coredump_buffer *prevnode) { for (i = 0; newnode->zone[i] != NULL; i++) { - CsrMemFree(newnode->zone[i]); + kfree(newnode->zone[i]); newnode->zone[i] = NULL; } } @@ -844,11 +845,8 @@ void unifi_coredump_free(card_t *card) /* Free payload zones */ for (j = 0; j < HIP_CDUMP_NUM_ZONES; j++) { - if (node->zone[j] != NULL) - { - CsrMemFree(node->zone[j]); - node->zone[j] = NULL; - } + kfree(node->zone[j]); + node->zone[j] = NULL; } /* Detach */ @@ -856,7 +854,7 @@ void unifi_coredump_free(card_t *card) node = node->next; /* Free header */ - CsrMemFree(del_node); + kfree(del_node); i++; } while ((node != NULL) && (node != card->dump_buf)); diff --git a/drivers/staging/csr/csr_wifi_hip_xbv.c b/drivers/staging/csr/csr_wifi_hip_xbv.c index c503365..3016e63 100644 --- a/drivers/staging/csr/csr_wifi_hip_xbv.c +++ b/drivers/staging/csr/csr_wifi_hip_xbv.c @@ -19,6 +19,7 @@ * * --------------------------------------------------------------------------- */ +#include #ifdef CSR_WIFI_XBV_TEST /* Standalone test harness */ @@ -959,7 +960,7 @@ s32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo * * Returns: * Pointer to firmware image, or NULL on error. Caller must free this - * buffer via CsrMemFree() once it's finished with. + * buffer via kfree() once it's finished with. * * Notes: * The input fw_buf should have been checked via xbv1_parse prior to @@ -1021,7 +1022,7 @@ void* xbv_to_patch(card_t *card, fwreadfn_t readfn, patch_buf = (void *)CsrMemAlloc(patch_buf_size); if (!patch_buf) { - CsrMemFree(rdbuf); + kfree(rdbuf); unifi_error(NULL, "Can't malloc buffer for patch conversion\n"); return NULL; } @@ -1067,7 +1068,7 @@ void* xbv_to_patch(card_t *card, fwreadfn_t readfn, { *size = patch_offs; } - CsrMemFree(rdbuf); + kfree(rdbuf); return patch_buf; } diff --git a/drivers/staging/csr/io.c b/drivers/staging/csr/io.c index 65b8895..38b5f7e 100644 --- a/drivers/staging/csr/io.c +++ b/drivers/staging/csr/io.c @@ -107,7 +107,7 @@ static CsrResult signal_buffer_init(unifi_priv_t * priv, int size) for(j=0;jrxSignalBuffer.rx_buff[j].sig_len=0; - CsrMemFree(priv->rxSignalBuffer.rx_buff[j].bufptr); + kfree(priv->rxSignalBuffer.rx_buff[j].bufptr); priv->rxSignalBuffer.rx_buff[j].bufptr = NULL; } func_exit(); @@ -126,7 +126,7 @@ static void signal_buffer_free(unifi_priv_t * priv, int size) for(i=0; irxSignalBuffer.rx_buff[i].sig_len=0; - CsrMemFree(priv->rxSignalBuffer.rx_buff[i].bufptr); + kfree(priv->rxSignalBuffer.rx_buff[i].bufptr); priv->rxSignalBuffer.rx_buff[i].bufptr = NULL; } } -- cgit v0.10.2 From 70128792b7802efcf485e9b62249cf8a639187d8 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 15:37:12 -0700 Subject: staging: csr: remove CsrMemAlloc() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's just calling kmalloc(, GFP_KERNEL), so call that instead. A few places should be calling kzalloc(), so do that, and remove the call to memset at the same time. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_framework_ext.c b/drivers/staging/csr/csr_framework_ext.c index 22345e8..a34d263 100644 --- a/drivers/staging/csr/csr_framework_ext.c +++ b/drivers/staging/csr/csr_framework_ext.c @@ -178,24 +178,6 @@ void *CsrMemCalloc(size_t numberOfElements, size_t elementSize) /*----------------------------------------------------------------------------* * NAME - * CsrMemAlloc - * - * DESCRIPTION - * Allocate dynamic memory of a given size. - * - * RETURNS - * Pointer to allocated memory, or NULL in case of failure. - * Allocated memory is not initialised. - * - *----------------------------------------------------------------------------*/ -void *CsrMemAlloc(size_t size) -{ - return kmalloc(size, GFP_KERNEL); -} -EXPORT_SYMBOL_GPL(CsrMemAlloc); - -/*----------------------------------------------------------------------------* - * NAME * CsrMemAllocDma * * DESCRIPTION diff --git a/drivers/staging/csr/csr_framework_ext.h b/drivers/staging/csr/csr_framework_ext.h index a3fc152..141f288 100644 --- a/drivers/staging/csr/csr_framework_ext.h +++ b/drivers/staging/csr/csr_framework_ext.h @@ -244,26 +244,6 @@ void CsrThreadSleep(u16 sleepTimeInMs); #ifndef CSR_PMEM_DEBUG_ENABLE /*----------------------------------------------------------------------------* * NAME - * CsrMemAlloc - * - * DESCRIPTION - * Allocate dynamic memory of a given size. - * - * RETURNS - * Pointer to allocated memory, or NULL in case of failure. - * Allocated memory is not initialised. - * - *----------------------------------------------------------------------------*/ -#ifdef CSR_MEM_DEBUG -void *CsrMemAllocDebug(size_t size, - const char *file, u32 line); -#define CsrMemAlloc(sz) CsrMemAllocDebug((sz), __FILE__, __LINE__) -#else -void *CsrMemAlloc(size_t size); -#endif - -/*----------------------------------------------------------------------------* - * NAME * CsrMemCalloc * * DESCRIPTION @@ -308,8 +288,6 @@ void *CsrMemAllocDma(size_t size); #include "csr_pmem.h" -#define CsrMemAlloc(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC, __FILE__, __LINE__) - #define CsrMemCalloc(numberOfElements, elementSize) CsrPmemDebugAlloc((numberOfElements * elementSize), CSR_PMEM_DEBUG_TYPE_MEM_CALLOC, __FILE__, __LINE__) #define CsrMemAllocDma(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC_DMA, __FILE__, __LINE__) diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.c b/drivers/staging/csr/csr_wifi_hip_card_sdio.c index 4f2d2e3..608a069 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.c @@ -73,13 +73,11 @@ card_t* unifi_alloc_card(CsrSdioFunction *sdio, void *ospriv) func_enter(); - card = (card_t *)CsrMemAlloc(sizeof(card_t)); + card = kzalloc(sizeof(card_t), GFP_KERNEL); if (card == NULL) { return NULL; } - memset(card, 0, sizeof(card_t)); - card->sdio_if = sdio; card->ospriv = ospriv; @@ -1665,8 +1663,7 @@ static CsrResult card_allocate_memory_resources(card_t *card) n = cfg_data->num_fromhost_data_slots; unifi_trace(card->ospriv, UDBG3, "Alloc from-host resources, %d slots.\n", n); - card->from_host_data = - (slot_desc_t *)CsrMemAlloc(n * sizeof(slot_desc_t)); + card->from_host_data = kmalloc(n * sizeof(slot_desc_t), GFP_KERNEL); if (card->from_host_data == NULL) { unifi_error(card->ospriv, "Failed to allocate memory for F-H bulk data array\n"); @@ -1681,8 +1678,7 @@ static CsrResult card_allocate_memory_resources(card_t *card) } /* Allocate memory for the array used for slot host tag mapping */ - card->fh_slot_host_tag_record = - (u32 *)CsrMemAlloc(n * sizeof(u32)); + card->fh_slot_host_tag_record = kmalloc(n * sizeof(u32), GFP_KERNEL); if (card->fh_slot_host_tag_record == NULL) { @@ -1702,8 +1698,7 @@ static CsrResult card_allocate_memory_resources(card_t *card) n = cfg_data->num_tohost_data_slots; unifi_trace(card->ospriv, UDBG3, "Alloc to-host resources, %d slots.\n", n); - card->to_host_data = - (bulk_data_desc_t *)CsrMemAlloc(n * sizeof(bulk_data_desc_t)); + card->to_host_data = kmalloc(n * sizeof(bulk_data_desc_t), GFP_KERNEL); if (card->to_host_data == NULL) { unifi_error(card->ospriv, "Failed to allocate memory for T-H bulk data array\n"); diff --git a/drivers/staging/csr/csr_wifi_hip_download.c b/drivers/staging/csr/csr_wifi_hip_download.c index 1a1dfb6..f0f0ffd 100644 --- a/drivers/staging/csr/csr_wifi_hip_download.c +++ b/drivers/staging/csr/csr_wifi_hip_download.c @@ -327,7 +327,7 @@ CsrResult unifi_dl_firmware(card_t *card, void *dlpriv) func_enter(); - fwinfo = CsrMemAlloc(sizeof(xbv1_t)); + fwinfo = kmalloc(sizeof(xbv1_t), GFP_KERNEL); if (fwinfo == NULL) { unifi_error(card->ospriv, "Failed to allocate memory for firmware\n"); @@ -409,7 +409,7 @@ CsrResult unifi_dl_patch(card_t *card, void *dlpriv, u32 boot_ctrl) unifi_info(card->ospriv, "unifi_dl_patch %p %08x\n", dlpriv, boot_ctrl); - fwinfo = CsrMemAlloc(sizeof(xbv1_t)); + fwinfo = kmalloc(sizeof(xbv1_t), GFP_KERNEL); if (fwinfo == NULL) { unifi_error(card->ospriv, "Failed to allocate memory for patches\n"); diff --git a/drivers/staging/csr/csr_wifi_hip_dump.c b/drivers/staging/csr/csr_wifi_hip_dump.c index 350d9d2..d67b460 100644 --- a/drivers/staging/csr/csr_wifi_hip_dump.c +++ b/drivers/staging/csr/csr_wifi_hip_dump.c @@ -667,24 +667,19 @@ coredump_buffer* new_coredump_node(void *ospriv, coredump_buffer *prevnode) u32 zone_size; /* Allocate node header */ - newnode = (coredump_buffer *)CsrMemAlloc(sizeof(coredump_buffer)); + newnode = kzalloc(sizeof(coredump_buffer), GFP_KERNEL); if (newnode == NULL) { return NULL; } - memset(newnode, 0, sizeof(coredump_buffer)); /* Allocate chip memory zone capture buffers */ for (i = 0; i < HIP_CDUMP_NUM_ZONES; i++) { zone_size = sizeof(u16) * zonedef_table[i].length; - newzone = (u16 *)CsrMemAlloc(zone_size); + newzone = kzalloc(zone_size, GFP_KERNEL); newnode->zone[i] = newzone; - if (newzone != NULL) - { - memset(newzone, 0, zone_size); - } - else + if (newzone == NULL) { unifi_error(ospriv, "Out of memory on coredump zone %d (%d words)\n", i, zonedef_table[i].length); diff --git a/drivers/staging/csr/csr_wifi_hip_xbv.c b/drivers/staging/csr/csr_wifi_hip_xbv.c index 3016e63..071f80a 100644 --- a/drivers/staging/csr/csr_wifi_hip_xbv.c +++ b/drivers/staging/csr/csr_wifi_hip_xbv.c @@ -994,7 +994,7 @@ void* xbv_to_patch(card_t *card, fwreadfn_t readfn, } /* Pre-allocate read buffer for chunk conversion */ - rdbuf = CsrMemAlloc(PTDL_MAX_SIZE); + rdbuf = kmalloc(PTDL_MAX_SIZE, GFP_KERNEL); if (!rdbuf) { unifi_error(card, "Couldn't alloc conversion buffer\n"); @@ -1019,7 +1019,7 @@ void* xbv_to_patch(card_t *card, fwreadfn_t readfn, */ patch_buf_size = calc_patch_size(fwinfo); - patch_buf = (void *)CsrMemAlloc(patch_buf_size); + patch_buf = kmalloc(patch_buf_size, GFP_KERNEL); if (!patch_buf) { kfree(rdbuf); diff --git a/drivers/staging/csr/io.c b/drivers/staging/csr/io.c index 38b5f7e..e6503d96 100644 --- a/drivers/staging/csr/io.c +++ b/drivers/staging/csr/io.c @@ -99,7 +99,7 @@ static CsrResult signal_buffer_init(unifi_priv_t * priv, int size) for(i=0; irxSignalBuffer.rx_buff[i].sig_len=0; - priv->rxSignalBuffer.rx_buff[i].bufptr = CsrMemAlloc(UNIFI_PACKED_SIGBUF_SIZE); + priv->rxSignalBuffer.rx_buff[i].bufptr = kmalloc(UNIFI_PACKED_SIGBUF_SIZE, GFP_KERNEL); if (priv->rxSignalBuffer.rx_buff[i].bufptr == NULL) { int j; -- cgit v0.10.2 From 7de2c5b6ae9c99e7b4213c06ed5264c24d943a35 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 15:43:05 -0700 Subject: staging: csr: remove CsrMemCalloc() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No one calls it, so it doesn't need to be here. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_framework_ext.c b/drivers/staging/csr/csr_framework_ext.c index a34d263..771a369 100644 --- a/drivers/staging/csr/csr_framework_ext.c +++ b/drivers/staging/csr/csr_framework_ext.c @@ -149,35 +149,6 @@ EXPORT_SYMBOL_GPL(CsrThreadSleep); /*----------------------------------------------------------------------------* * NAME - * CsrMemCalloc - * - * DESCRIPTION - * Allocate dynamic memory of a given size calculated as the - * numberOfElements times the elementSize. - * - * RETURNS - * Pointer to allocated memory, or NULL in case of failure. - * Allocated memory is zero initialised. - * - *----------------------------------------------------------------------------*/ -void *CsrMemCalloc(size_t numberOfElements, size_t elementSize) -{ - void *buf; - size_t size; - - size = numberOfElements * elementSize; - - buf = kmalloc(size, GFP_KERNEL); - if (buf != NULL) - { - memset(buf, 0, size); - } - - return buf; -} - -/*----------------------------------------------------------------------------* - * NAME * CsrMemAllocDma * * DESCRIPTION diff --git a/drivers/staging/csr/csr_framework_ext.h b/drivers/staging/csr/csr_framework_ext.h index 141f288..817369d 100644 --- a/drivers/staging/csr/csr_framework_ext.h +++ b/drivers/staging/csr/csr_framework_ext.h @@ -244,27 +244,6 @@ void CsrThreadSleep(u16 sleepTimeInMs); #ifndef CSR_PMEM_DEBUG_ENABLE /*----------------------------------------------------------------------------* * NAME - * CsrMemCalloc - * - * DESCRIPTION - * Allocate dynamic memory of a given size calculated as the - * numberOfElements times the elementSize. - * - * RETURNS - * Pointer to allocated memory, or NULL in case of failure. - * Allocated memory is zero initialised. - * - *----------------------------------------------------------------------------*/ -#ifdef CSR_MEM_DEBUG -void *CsrMemCallocDebug(size_t numberOfElements, size_t elementSize, - const char *file, u32 line); -#define CsrMemCalloc(cnt, sz) CsrMemAllocDebug((cnt), (sz), __FILE__, __LINE__) -#else -void *CsrMemCalloc(size_t numberOfElements, size_t elementSize); -#endif - -/*----------------------------------------------------------------------------* - * NAME * CsrMemAllocDma * * DESCRIPTION @@ -288,8 +267,6 @@ void *CsrMemAllocDma(size_t size); #include "csr_pmem.h" -#define CsrMemCalloc(numberOfElements, elementSize) CsrPmemDebugAlloc((numberOfElements * elementSize), CSR_PMEM_DEBUG_TYPE_MEM_CALLOC, __FILE__, __LINE__) - #define CsrMemAllocDma(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC_DMA, __FILE__, __LINE__) #endif -- cgit v0.10.2 From 4becf12de1a4efefd28e057750e35f4ceb32dd1d Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 15:47:35 -0700 Subject: staging: csr: remove CsrMemAllocDma() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's just a call to kmalloc(, GFP_KERNEL | GFP_DMA); But, all memory allocated by kmalloc can be DMAed, and that's not what GFP_DMA means, so remove that flag, and just call kmalloc(, GFP_KERNEL); Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_framework_ext.c b/drivers/staging/csr/csr_framework_ext.c index 771a369..12e7ddf 100644 --- a/drivers/staging/csr/csr_framework_ext.c +++ b/drivers/staging/csr/csr_framework_ext.c @@ -146,21 +146,3 @@ void CsrThreadSleep(u16 sleepTimeInMs) schedule_timeout_uninterruptible(t); } EXPORT_SYMBOL_GPL(CsrThreadSleep); - -/*----------------------------------------------------------------------------* - * NAME - * CsrMemAllocDma - * - * DESCRIPTION - * Allocate DMA capable dynamic memory of a given size. - * - * RETURNS - * Pointer to allocated memory, or NULL in case of failure. - * Allocated memory is not initialised. - * - *----------------------------------------------------------------------------*/ -void *CsrMemAllocDma(size_t size) -{ - return kmalloc(size, GFP_KERNEL | GFP_DMA); -} -EXPORT_SYMBOL_GPL(CsrMemAllocDma); diff --git a/drivers/staging/csr/csr_framework_ext.h b/drivers/staging/csr/csr_framework_ext.h index 817369d..66973e9 100644 --- a/drivers/staging/csr/csr_framework_ext.h +++ b/drivers/staging/csr/csr_framework_ext.h @@ -241,37 +241,6 @@ CsrResult CsrThreadEqual(CsrThreadHandle *threadHandle1, CsrThreadHandle *thread *----------------------------------------------------------------------------*/ void CsrThreadSleep(u16 sleepTimeInMs); -#ifndef CSR_PMEM_DEBUG_ENABLE -/*----------------------------------------------------------------------------* - * NAME - * CsrMemAllocDma - * - * DESCRIPTION - * Allocate dynamic memory suitable for DMA transfers. - * - * RETURNS - * Pointer to allocated memory, or NULL in case of failure. - * Allocated memory is not initialised. - * - *----------------------------------------------------------------------------*/ -#ifdef CSR_MEM_DEBUG -void *CsrMemAllocDmaDebug(size_t size, - const char *file, u32 line); -#define CsrMemAllocDma(sz) CsrMemAllocDmaDebug((sz), __FILE__, __LINE__) -#else -void *CsrMemAllocDma(size_t size); -#endif - - -#else - -#include "csr_pmem.h" - -#define CsrMemAllocDma(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC_DMA, __FILE__, __LINE__) - -#endif - - #ifdef __cplusplus } #endif diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.c b/drivers/staging/csr/csr_wifi_hip_card_sdio.c index 608a069..d4c9281 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.c @@ -1630,7 +1630,7 @@ static CsrResult card_allocate_memory_resources(card_t *card) /* * Allocate memory for the from-host and to-host signal buffers. */ - card->fh_buffer.buf = CsrMemAllocDma(UNIFI_FH_BUF_SIZE); + card->fh_buffer.buf = kmalloc(UNIFI_FH_BUF_SIZE, GFP_KERNEL); if (card->fh_buffer.buf == NULL) { unifi_error(card->ospriv, "Failed to allocate memory for F-H signals\n"); @@ -1641,7 +1641,7 @@ static CsrResult card_allocate_memory_resources(card_t *card) card->fh_buffer.ptr = card->fh_buffer.buf; card->fh_buffer.count = 0; - card->th_buffer.buf = CsrMemAllocDma(UNIFI_FH_BUF_SIZE); + card->th_buffer.buf = kmalloc(UNIFI_FH_BUF_SIZE, GFP_KERNEL); if (card->th_buffer.buf == NULL) { unifi_error(card->ospriv, "Failed to allocate memory for T-H signals\n"); diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c index 9789579..97f645c 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c @@ -1758,7 +1758,7 @@ static CsrResult process_bulk_data_command(card_t *card, const u8 *cmdptr, if (len != 0 && (dir == UNIFI_SDIO_WRITE) && (((ptrdiff_t)bdslot->os_data_ptr + offset) & 3)) { - host_bulk_data_slot = CsrMemAllocDma(len); + host_bulk_data_slot = kmalloc(len, GFP_KERNEL); if (!host_bulk_data_slot) { diff --git a/drivers/staging/csr/csr_wifi_hip_download.c b/drivers/staging/csr/csr_wifi_hip_download.c index f0f0ffd..8e4a460 100644 --- a/drivers/staging/csr/csr_wifi_hip_download.c +++ b/drivers/staging/csr/csr_wifi_hip_download.c @@ -675,7 +675,7 @@ static CsrResult send_ptdl_to_unifi(card_t *card, void *dlpriv, return CSR_WIFI_HIP_RESULT_INVALID_VALUE; } - buf = CsrMemAllocDma(buf_size); + buf = kmalloc(buf_size, GFP_KERNEL); if (buf == NULL) { unifi_error(card->ospriv, "Failed to allocate transfer buffer for firmware download\n"); -- cgit v0.10.2 From 55a27055b9ea5aabf8206ed6b7777c79f4e840c3 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 15:59:12 -0700 Subject: staging: csr: remove CsrPmemFree() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's just a wrapper around kfree() so call that instead. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_msgconv.c b/drivers/staging/csr/csr_msgconv.c index 04ce4ae..42e0a4a 100644 --- a/drivers/staging/csr/csr_msgconv.c +++ b/drivers/staging/csr/csr_msgconv.c @@ -10,6 +10,7 @@ #include #include +#include #include "csr_pmem.h" #include "csr_panic.h" #include "csr_sched.h" @@ -312,11 +313,11 @@ void CsrMsgConvDeinit(void) { CsrMsgConvPrimEntry *s_next; s_next = s->next; - CsrPmemFree(s); + kfree(s); s = s_next; } - CsrPmemFree(converter); + kfree(converter); converter = NULL; } EXPORT_SYMBOL_GPL(CsrMsgConvDeinit); diff --git a/drivers/staging/csr/csr_pmem.c b/drivers/staging/csr/csr_pmem.c index aeb9242..a277925 100644 --- a/drivers/staging/csr/csr_pmem.c +++ b/drivers/staging/csr/csr_pmem.c @@ -38,14 +38,3 @@ void *CsrPmemAlloc(size_t size) return ret; } EXPORT_SYMBOL_GPL(CsrPmemAlloc); - -void CsrPmemFree(void *ptr) -{ - if (ptr == NULL) - { - return; - } - - kfree(ptr); -} -EXPORT_SYMBOL_GPL(CsrPmemFree); diff --git a/drivers/staging/csr/csr_pmem.h b/drivers/staging/csr/csr_pmem.h index 5e8b6a0..283aff0 100644 --- a/drivers/staging/csr/csr_pmem.h +++ b/drivers/staging/csr/csr_pmem.h @@ -45,20 +45,6 @@ void *CsrPmemAllocDebug(size_t size, void *CsrPmemAlloc(size_t size); #endif - -/***************************************************************************** - - NAME - CsrPmemFree - - DESCRIPTION - This function will deallocate a previously allocated block of memory. - - PARAMETERS - ptr - Pointer to allocated memory. - -*****************************************************************************/ -void CsrPmemFree(void *ptr); #endif /***************************************************************************** @@ -131,7 +117,6 @@ void *CsrPmemDebugAlloc(size_t size, CsrPmemDebugAllocType type, const char* fil #define CsrPmemAlloc(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_PMEM_ALLOC, __FILE__, __LINE__) void CsrPmemDebugFree(void *ptr, CsrPmemDebugAllocType type, const char* file, u32 line); -#define CsrPmemFree(ptr) CsrPmemDebugFree(ptr, CSR_PMEM_DEBUG_TYPE_PMEM_ALLOC, __FILE__, __LINE__) #endif diff --git a/drivers/staging/csr/csr_sched.h b/drivers/staging/csr/csr_sched.h index e42fca9..7ae1ea5 100644 --- a/drivers/staging/csr/csr_sched.h +++ b/drivers/staging/csr/csr_sched.h @@ -125,7 +125,7 @@ void CsrSchedBgintSet(CsrSchedBgint bgint); * obey the convention that when a message built with CsrPmemAlloc()ed memory * is given to CsrSchedMessagePut() then ownership of the memory is ceded to the * scheduler - and eventually to the recipient task. I.e., the receiver of - * the message will be expected to CsrPmemFree() the message storage. + * the message will be expected to kfree() the message storage. * * RETURNS * void. diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index be48097..f827342 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -8,6 +8,7 @@ *****************************************************************************/ #include +#include #include "csr_pmem.h" #include "csr_unicode.h" #include "csr_macro.h" @@ -881,7 +882,7 @@ u16 *CsrUtf16String2XML(u16 *str) *outputString++ = 0; - CsrPmemFree(str); + kfree(str); } } @@ -1008,7 +1009,7 @@ u16 *CsrXML2Utf16String(u16 *str) *outputString++ = 0; - CsrPmemFree(str); + kfree(str); } } diff --git a/drivers/staging/csr/csr_wifi_nme_ap_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_nme_ap_free_downstream_contents.c index 6812396..bfc511e 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_free_downstream_contents.c +++ b/drivers/staging/csr/csr_wifi_nme_ap_free_downstream_contents.c @@ -9,7 +9,7 @@ *****************************************************************************/ /* Note: this is an auto-generated file. */ - +#include #include "csr_pmem.h" #include "csr_wifi_nme_ap_prim.h" #include "csr_wifi_nme_ap_lib.h" @@ -41,7 +41,7 @@ void CsrWifiNmeApFreeDownstreamMessageContents(u16 eventClass, void *message) case CSR_WIFI_NME_AP_CONFIG_SET_REQ: { CsrWifiNmeApConfigSetReq *p = (CsrWifiNmeApConfigSetReq *)message; - CsrPmemFree(p->apMacConfig.macAddressList); + kfree(p->apMacConfig.macAddressList); p->apMacConfig.macAddressList = NULL; break; } @@ -54,7 +54,7 @@ void CsrWifiNmeApFreeDownstreamMessageContents(u16 eventClass, void *message) switch (p->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase) { case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: - CsrPmemFree(p->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase); + kfree(p->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase); p->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase = NULL; break; default: @@ -68,11 +68,11 @@ void CsrWifiNmeApFreeDownstreamMessageContents(u16 eventClass, void *message) u16 i3; for (i3 = 0; i3 < p->p2pGoParam.operatingChanList.channelEntryListCount; i3++) { - CsrPmemFree(p->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel); + kfree(p->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel); p->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel = NULL; } } - CsrPmemFree(p->p2pGoParam.operatingChanList.channelEntryList); + kfree(p->p2pGoParam.operatingChanList.channelEntryList); p->p2pGoParam.operatingChanList.channelEntryList = NULL; break; } diff --git a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c index b673c1c..dcdcc32 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c +++ b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c @@ -10,6 +10,7 @@ /* Note: this is an auto-generated file. */ #include +#include #include "csr_pmem.h" #include "csr_msgconv.h" #include "csr_unicode.h" @@ -22,7 +23,7 @@ void CsrWifiNmeApPfree(void *ptr) { - CsrPmemFree(ptr); + kfree(ptr); } @@ -221,8 +222,8 @@ void* CsrWifiNmeApConfigSetReqDes(u8 *buffer, size_t length) void CsrWifiNmeApConfigSetReqSerFree(void *voidPrimitivePointer) { CsrWifiNmeApConfigSetReq *primitive = (CsrWifiNmeApConfigSetReq *) voidPrimitivePointer; - CsrPmemFree(primitive->apMacConfig.macAddressList); - CsrPmemFree(primitive); + kfree(primitive->apMacConfig.macAddressList); + kfree(primitive); } @@ -555,7 +556,7 @@ void CsrWifiNmeApStartReqSerFree(void *voidPrimitivePointer) switch (primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase) { case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: - CsrPmemFree(primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase); + kfree(primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase); break; default: break; @@ -568,11 +569,11 @@ void CsrWifiNmeApStartReqSerFree(void *voidPrimitivePointer) u16 i3; for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++) { - CsrPmemFree(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel); + kfree(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel); } } - CsrPmemFree(primitive->p2pGoParam.operatingChanList.channelEntryList); - CsrPmemFree(primitive); + kfree(primitive->p2pGoParam.operatingChanList.channelEntryList); + kfree(primitive); } diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c index 2329dc3..b4b7243 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c @@ -9,7 +9,7 @@ *****************************************************************************/ /* Note: this is an auto-generated file. */ - +#include #include "csr_pmem.h" #include "csr_wifi_router_ctrl_prim.h" #include "csr_wifi_router_ctrl_lib.h" @@ -41,62 +41,62 @@ void CsrWifiRouterCtrlFreeDownstreamMessageContents(u16 eventClass, void *messag case CSR_WIFI_ROUTER_CTRL_HIP_REQ: { CsrWifiRouterCtrlHipReq *p = (CsrWifiRouterCtrlHipReq *)message; - CsrPmemFree(p->mlmeCommand); + kfree(p->mlmeCommand); p->mlmeCommand = NULL; - CsrPmemFree(p->dataRef1); + kfree(p->dataRef1); p->dataRef1 = NULL; - CsrPmemFree(p->dataRef2); + kfree(p->dataRef2); p->dataRef2 = NULL; break; } case CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_RES: { CsrWifiRouterCtrlMulticastAddressRes *p = (CsrWifiRouterCtrlMulticastAddressRes *)message; - CsrPmemFree(p->getAddresses); + kfree(p->getAddresses); p->getAddresses = NULL; break; } case CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_REQ: { CsrWifiRouterCtrlTclasAddReq *p = (CsrWifiRouterCtrlTclasAddReq *)message; - CsrPmemFree(p->tclas); + kfree(p->tclas); p->tclas = NULL; break; } case CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_REQ: { CsrWifiRouterCtrlTclasDelReq *p = (CsrWifiRouterCtrlTclasDelReq *)message; - CsrPmemFree(p->tclas); + kfree(p->tclas); p->tclas = NULL; break; } case CSR_WIFI_ROUTER_CTRL_WIFI_ON_REQ: { CsrWifiRouterCtrlWifiOnReq *p = (CsrWifiRouterCtrlWifiOnReq *)message; - CsrPmemFree(p->data); + kfree(p->data); p->data = NULL; break; } case CSR_WIFI_ROUTER_CTRL_WIFI_ON_RES: { CsrWifiRouterCtrlWifiOnRes *p = (CsrWifiRouterCtrlWifiOnRes *)message; - CsrPmemFree(p->smeVersions.smeBuild); + kfree(p->smeVersions.smeBuild); p->smeVersions.smeBuild = NULL; break; } case CSR_WIFI_ROUTER_CTRL_WAPI_RX_PKT_REQ: { CsrWifiRouterCtrlWapiRxPktReq *p = (CsrWifiRouterCtrlWapiRxPktReq *)message; - CsrPmemFree(p->signal); + kfree(p->signal); p->signal = NULL; - CsrPmemFree(p->data); + kfree(p->data); p->data = NULL; break; } case CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_PKT_REQ: { CsrWifiRouterCtrlWapiUnicastTxPktReq *p = (CsrWifiRouterCtrlWapiUnicastTxPktReq *)message; - CsrPmemFree(p->data); + kfree(p->data); p->data = NULL; break; } diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c index 8f1ce3d..4605c53 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c @@ -9,7 +9,7 @@ *****************************************************************************/ /* Note: this is an auto-generated file. */ - +#include #include "csr_pmem.h" #include "csr_wifi_router_ctrl_prim.h" #include "csr_wifi_router_ctrl_lib.h" @@ -41,41 +41,41 @@ void CsrWifiRouterCtrlFreeUpstreamMessageContents(u16 eventClass, void *message) case CSR_WIFI_ROUTER_CTRL_HIP_IND: { CsrWifiRouterCtrlHipInd *p = (CsrWifiRouterCtrlHipInd *)message; - CsrPmemFree(p->mlmeCommand); + kfree(p->mlmeCommand); p->mlmeCommand = NULL; - CsrPmemFree(p->dataRef1); + kfree(p->dataRef1); p->dataRef1 = NULL; - CsrPmemFree(p->dataRef2); + kfree(p->dataRef2); p->dataRef2 = NULL; break; } case CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_IND: { CsrWifiRouterCtrlMulticastAddressInd *p = (CsrWifiRouterCtrlMulticastAddressInd *)message; - CsrPmemFree(p->setAddresses); + kfree(p->setAddresses); p->setAddresses = NULL; break; } case CSR_WIFI_ROUTER_CTRL_WIFI_ON_IND: { CsrWifiRouterCtrlWifiOnInd *p = (CsrWifiRouterCtrlWifiOnInd *)message; - CsrPmemFree(p->versions.routerBuild); + kfree(p->versions.routerBuild); p->versions.routerBuild = NULL; break; } case CSR_WIFI_ROUTER_CTRL_WAPI_RX_MIC_CHECK_IND: { CsrWifiRouterCtrlWapiRxMicCheckInd *p = (CsrWifiRouterCtrlWapiRxMicCheckInd *)message; - CsrPmemFree(p->signal); + kfree(p->signal); p->signal = NULL; - CsrPmemFree(p->data); + kfree(p->data); p->data = NULL; break; } case CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_ENCRYPT_IND: { CsrWifiRouterCtrlWapiUnicastTxEncryptInd *p = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *)message; - CsrPmemFree(p->data); + kfree(p->data); p->data = NULL; break; } diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c index 330eb95..7340f58 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c @@ -10,6 +10,7 @@ /* Note: this is an auto-generated file. */ #include +#include #include "csr_pmem.h" #include "csr_msgconv.h" #include "csr_unicode.h" @@ -20,7 +21,7 @@ void CsrWifiRouterCtrlPfree(void *ptr) { - CsrPmemFree(ptr); + kfree(ptr); } @@ -148,10 +149,10 @@ void* CsrWifiRouterCtrlHipReqDes(u8 *buffer, size_t length) void CsrWifiRouterCtrlHipReqSerFree(void *voidPrimitivePointer) { CsrWifiRouterCtrlHipReq *primitive = (CsrWifiRouterCtrlHipReq *) voidPrimitivePointer; - CsrPmemFree(primitive->mlmeCommand); - CsrPmemFree(primitive->dataRef1); - CsrPmemFree(primitive->dataRef2); - CsrPmemFree(primitive); + kfree(primitive->mlmeCommand); + kfree(primitive->dataRef1); + kfree(primitive->dataRef2); + kfree(primitive); } @@ -269,8 +270,8 @@ void* CsrWifiRouterCtrlMulticastAddressResDes(u8 *buffer, size_t length) void CsrWifiRouterCtrlMulticastAddressResSerFree(void *voidPrimitivePointer) { CsrWifiRouterCtrlMulticastAddressRes *primitive = (CsrWifiRouterCtrlMulticastAddressRes *) voidPrimitivePointer; - CsrPmemFree(primitive->getAddresses); - CsrPmemFree(primitive); + kfree(primitive->getAddresses); + kfree(primitive); } @@ -457,8 +458,8 @@ void* CsrWifiRouterCtrlTclasAddReqDes(u8 *buffer, size_t length) void CsrWifiRouterCtrlTclasAddReqSerFree(void *voidPrimitivePointer) { CsrWifiRouterCtrlTclasAddReq *primitive = (CsrWifiRouterCtrlTclasAddReq *) voidPrimitivePointer; - CsrPmemFree(primitive->tclas); - CsrPmemFree(primitive); + kfree(primitive->tclas); + kfree(primitive); } @@ -555,8 +556,8 @@ void* CsrWifiRouterCtrlTclasDelReqDes(u8 *buffer, size_t length) void CsrWifiRouterCtrlTclasDelReqSerFree(void *voidPrimitivePointer) { CsrWifiRouterCtrlTclasDelReq *primitive = (CsrWifiRouterCtrlTclasDelReq *) voidPrimitivePointer; - CsrPmemFree(primitive->tclas); - CsrPmemFree(primitive); + kfree(primitive->tclas); + kfree(primitive); } @@ -710,8 +711,8 @@ void* CsrWifiRouterCtrlWifiOnReqDes(u8 *buffer, size_t length) void CsrWifiRouterCtrlWifiOnReqSerFree(void *voidPrimitivePointer) { CsrWifiRouterCtrlWifiOnReq *primitive = (CsrWifiRouterCtrlWifiOnReq *) voidPrimitivePointer; - CsrPmemFree(primitive->data); - CsrPmemFree(primitive); + kfree(primitive->data); + kfree(primitive); } @@ -791,8 +792,8 @@ void* CsrWifiRouterCtrlWifiOnResDes(u8 *buffer, size_t length) void CsrWifiRouterCtrlWifiOnResSerFree(void *voidPrimitivePointer) { CsrWifiRouterCtrlWifiOnRes *primitive = (CsrWifiRouterCtrlWifiOnRes *) voidPrimitivePointer; - CsrPmemFree(primitive->smeVersions.smeBuild); - CsrPmemFree(primitive); + kfree(primitive->smeVersions.smeBuild); + kfree(primitive); } @@ -1185,9 +1186,9 @@ void* CsrWifiRouterCtrlWapiRxPktReqDes(u8 *buffer, size_t length) void CsrWifiRouterCtrlWapiRxPktReqSerFree(void *voidPrimitivePointer) { CsrWifiRouterCtrlWapiRxPktReq *primitive = (CsrWifiRouterCtrlWapiRxPktReq *) voidPrimitivePointer; - CsrPmemFree(primitive->signal); - CsrPmemFree(primitive->data); - CsrPmemFree(primitive); + kfree(primitive->signal); + kfree(primitive->data); + kfree(primitive); } @@ -1245,8 +1246,8 @@ void* CsrWifiRouterCtrlWapiUnicastTxPktReqDes(u8 *buffer, size_t length) void CsrWifiRouterCtrlWapiUnicastTxPktReqSerFree(void *voidPrimitivePointer) { CsrWifiRouterCtrlWapiUnicastTxPktReq *primitive = (CsrWifiRouterCtrlWapiUnicastTxPktReq *) voidPrimitivePointer; - CsrPmemFree(primitive->data); - CsrPmemFree(primitive); + kfree(primitive->data); + kfree(primitive); } @@ -1335,10 +1336,10 @@ void* CsrWifiRouterCtrlHipIndDes(u8 *buffer, size_t length) void CsrWifiRouterCtrlHipIndSerFree(void *voidPrimitivePointer) { CsrWifiRouterCtrlHipInd *primitive = (CsrWifiRouterCtrlHipInd *) voidPrimitivePointer; - CsrPmemFree(primitive->mlmeCommand); - CsrPmemFree(primitive->dataRef1); - CsrPmemFree(primitive->dataRef2); - CsrPmemFree(primitive); + kfree(primitive->mlmeCommand); + kfree(primitive->dataRef1); + kfree(primitive->dataRef2); + kfree(primitive); } @@ -1414,8 +1415,8 @@ void* CsrWifiRouterCtrlMulticastAddressIndDes(u8 *buffer, size_t length) void CsrWifiRouterCtrlMulticastAddressIndSerFree(void *voidPrimitivePointer) { CsrWifiRouterCtrlMulticastAddressInd *primitive = (CsrWifiRouterCtrlMulticastAddressInd *) voidPrimitivePointer; - CsrPmemFree(primitive->setAddresses); - CsrPmemFree(primitive); + kfree(primitive->setAddresses); + kfree(primitive); } @@ -1839,8 +1840,8 @@ void* CsrWifiRouterCtrlWifiOnIndDes(u8 *buffer, size_t length) void CsrWifiRouterCtrlWifiOnIndSerFree(void *voidPrimitivePointer) { CsrWifiRouterCtrlWifiOnInd *primitive = (CsrWifiRouterCtrlWifiOnInd *) voidPrimitivePointer; - CsrPmemFree(primitive->versions.routerBuild); - CsrPmemFree(primitive); + kfree(primitive->versions.routerBuild); + kfree(primitive); } @@ -2482,9 +2483,9 @@ void* CsrWifiRouterCtrlWapiRxMicCheckIndDes(u8 *buffer, size_t length) void CsrWifiRouterCtrlWapiRxMicCheckIndSerFree(void *voidPrimitivePointer) { CsrWifiRouterCtrlWapiRxMicCheckInd *primitive = (CsrWifiRouterCtrlWapiRxMicCheckInd *) voidPrimitivePointer; - CsrPmemFree(primitive->signal); - CsrPmemFree(primitive->data); - CsrPmemFree(primitive); + kfree(primitive->signal); + kfree(primitive->data); + kfree(primitive); } @@ -2587,8 +2588,8 @@ void* CsrWifiRouterCtrlWapiUnicastTxEncryptIndDes(u8 *buffer, size_t length) void CsrWifiRouterCtrlWapiUnicastTxEncryptIndSerFree(void *voidPrimitivePointer) { CsrWifiRouterCtrlWapiUnicastTxEncryptInd *primitive = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *) voidPrimitivePointer; - CsrPmemFree(primitive->data); - CsrPmemFree(primitive); + kfree(primitive->data); + kfree(primitive); } diff --git a/drivers/staging/csr/csr_wifi_router_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_router_free_downstream_contents.c index 24d4ae2..fbd5b35 100644 --- a/drivers/staging/csr/csr_wifi_router_free_downstream_contents.c +++ b/drivers/staging/csr/csr_wifi_router_free_downstream_contents.c @@ -9,7 +9,7 @@ *****************************************************************************/ /* Note: this is an auto-generated file. */ - +#include #include "csr_pmem.h" #include "csr_wifi_router_prim.h" #include "csr_wifi_router_lib.h" @@ -41,7 +41,7 @@ void CsrWifiRouterFreeDownstreamMessageContents(u16 eventClass, void *message) case CSR_WIFI_ROUTER_MA_PACKET_REQ: { CsrWifiRouterMaPacketReq *p = (CsrWifiRouterMaPacketReq *)message; - CsrPmemFree(p->frame); + kfree(p->frame); p->frame = NULL; break; } diff --git a/drivers/staging/csr/csr_wifi_router_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_router_free_upstream_contents.c index 2faaaac..60f6ecd 100644 --- a/drivers/staging/csr/csr_wifi_router_free_upstream_contents.c +++ b/drivers/staging/csr/csr_wifi_router_free_upstream_contents.c @@ -9,7 +9,7 @@ *****************************************************************************/ /* Note: this is an auto-generated file. */ - +#include #include "csr_pmem.h" #include "csr_wifi_router_prim.h" #include "csr_wifi_router_lib.h" @@ -41,7 +41,7 @@ void CsrWifiRouterFreeUpstreamMessageContents(u16 eventClass, void *message) case CSR_WIFI_ROUTER_MA_PACKET_IND: { CsrWifiRouterMaPacketInd *p = (CsrWifiRouterMaPacketInd *)message; - CsrPmemFree(p->frame); + kfree(p->frame); p->frame = NULL; break; } diff --git a/drivers/staging/csr/csr_wifi_router_serialize.c b/drivers/staging/csr/csr_wifi_router_serialize.c index f8447c8..dd2c2ce 100644 --- a/drivers/staging/csr/csr_wifi_router_serialize.c +++ b/drivers/staging/csr/csr_wifi_router_serialize.c @@ -9,7 +9,7 @@ *****************************************************************************/ /* Note: this is an auto-generated file. */ - +#include #include "csr_pmem.h" #include "csr_msgconv.h" #include "csr_unicode.h" @@ -20,7 +20,7 @@ void CsrWifiRouterPfree(void *ptr) { - CsrPmemFree(ptr); + kfree(ptr); } @@ -136,8 +136,8 @@ void* CsrWifiRouterMaPacketReqDes(u8 *buffer, size_t length) void CsrWifiRouterMaPacketReqSerFree(void *voidPrimitivePointer) { CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *) voidPrimitivePointer; - CsrPmemFree(primitive->frame); - CsrPmemFree(primitive); + kfree(primitive->frame); + kfree(primitive); } @@ -415,8 +415,8 @@ void* CsrWifiRouterMaPacketIndDes(u8 *buffer, size_t length) void CsrWifiRouterMaPacketIndSerFree(void *voidPrimitivePointer) { CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *) voidPrimitivePointer; - CsrPmemFree(primitive->frame); - CsrPmemFree(primitive); + kfree(primitive->frame); + kfree(primitive); } diff --git a/drivers/staging/csr/csr_wifi_router_transport.c b/drivers/staging/csr/csr_wifi_router_transport.c index f340780..5d86aa8 100644 --- a/drivers/staging/csr/csr_wifi_router_transport.c +++ b/drivers/staging/csr/csr_wifi_router_transport.c @@ -155,7 +155,7 @@ void CsrWifiRouterTransportRecv(unifi_priv_t *priv, u8* buffer, size_t bufferLen unifi_error(priv, "CsrWifiRouterTransportDeserialiseAndSend unhandled prim type 0x%.4X\n", primType); break; } - CsrPmemFree(msg); + kfree(msg); } static void CsrWifiRouterTransportSerialiseAndSend(u16 primType, void* msg) @@ -193,7 +193,7 @@ static void CsrWifiRouterTransportSerialiseAndSend(u16 primType, void* msg) uf_sme_queue_message(drvpriv, encodeBuffer, encodeBufferLen); /* Do not use msgEntry->freeFunc because the memory is owned by the driver */ - CsrPmemFree(msg); + kfree(msg); } #if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER) diff --git a/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c index 826ef3a..ae3fec8 100644 --- a/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c +++ b/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c @@ -9,7 +9,7 @@ *****************************************************************************/ /* Note: this is an auto-generated file. */ - +#include #include "csr_pmem.h" #include "csr_wifi_sme_prim.h" #include "csr_wifi_sme_lib.h" @@ -41,90 +41,90 @@ void CsrWifiSmeFreeDownstreamMessageContents(u16 eventClass, void *message) case CSR_WIFI_SME_BLACKLIST_REQ: { CsrWifiSmeBlacklistReq *p = (CsrWifiSmeBlacklistReq *)message; - CsrPmemFree(p->setAddresses); + kfree(p->setAddresses); p->setAddresses = NULL; break; } case CSR_WIFI_SME_CALIBRATION_DATA_SET_REQ: { CsrWifiSmeCalibrationDataSetReq *p = (CsrWifiSmeCalibrationDataSetReq *)message; - CsrPmemFree(p->calibrationData); + kfree(p->calibrationData); p->calibrationData = NULL; break; } case CSR_WIFI_SME_CONNECT_REQ: { CsrWifiSmeConnectReq *p = (CsrWifiSmeConnectReq *)message; - CsrPmemFree(p->connectionConfig.mlmeAssociateReqInformationElements); + kfree(p->connectionConfig.mlmeAssociateReqInformationElements); p->connectionConfig.mlmeAssociateReqInformationElements = NULL; break; } case CSR_WIFI_SME_MIB_GET_NEXT_REQ: { CsrWifiSmeMibGetNextReq *p = (CsrWifiSmeMibGetNextReq *)message; - CsrPmemFree(p->mibAttribute); + kfree(p->mibAttribute); p->mibAttribute = NULL; break; } case CSR_WIFI_SME_MIB_GET_REQ: { CsrWifiSmeMibGetReq *p = (CsrWifiSmeMibGetReq *)message; - CsrPmemFree(p->mibAttribute); + kfree(p->mibAttribute); p->mibAttribute = NULL; break; } case CSR_WIFI_SME_MIB_SET_REQ: { CsrWifiSmeMibSetReq *p = (CsrWifiSmeMibSetReq *)message; - CsrPmemFree(p->mibAttribute); + kfree(p->mibAttribute); p->mibAttribute = NULL; break; } case CSR_WIFI_SME_MULTICAST_ADDRESS_REQ: { CsrWifiSmeMulticastAddressReq *p = (CsrWifiSmeMulticastAddressReq *)message; - CsrPmemFree(p->setAddresses); + kfree(p->setAddresses); p->setAddresses = NULL; break; } case CSR_WIFI_SME_PACKET_FILTER_SET_REQ: { CsrWifiSmePacketFilterSetReq *p = (CsrWifiSmePacketFilterSetReq *)message; - CsrPmemFree(p->filter); + kfree(p->filter); p->filter = NULL; break; } case CSR_WIFI_SME_PMKID_REQ: { CsrWifiSmePmkidReq *p = (CsrWifiSmePmkidReq *)message; - CsrPmemFree(p->setPmkids); + kfree(p->setPmkids); p->setPmkids = NULL; break; } case CSR_WIFI_SME_SCAN_CONFIG_SET_REQ: { CsrWifiSmeScanConfigSetReq *p = (CsrWifiSmeScanConfigSetReq *)message; - CsrPmemFree(p->scanConfig.passiveChannelList); + kfree(p->scanConfig.passiveChannelList); p->scanConfig.passiveChannelList = NULL; break; } case CSR_WIFI_SME_SCAN_FULL_REQ: { CsrWifiSmeScanFullReq *p = (CsrWifiSmeScanFullReq *)message; - CsrPmemFree(p->ssid); + kfree(p->ssid); p->ssid = NULL; - CsrPmemFree(p->channelList); + kfree(p->channelList); p->channelList = NULL; - CsrPmemFree(p->probeIe); + kfree(p->probeIe); p->probeIe = NULL; break; } case CSR_WIFI_SME_TSPEC_REQ: { CsrWifiSmeTspecReq *p = (CsrWifiSmeTspecReq *)message; - CsrPmemFree(p->tspec); + kfree(p->tspec); p->tspec = NULL; - CsrPmemFree(p->tclas); + kfree(p->tclas); p->tclas = NULL; break; } @@ -135,11 +135,11 @@ void CsrWifiSmeFreeDownstreamMessageContents(u16 eventClass, void *message) u16 i1; for (i1 = 0; i1 < p->mibFilesCount; i1++) { - CsrPmemFree(p->mibFiles[i1].data); + kfree(p->mibFiles[i1].data); p->mibFiles[i1].data = NULL; } } - CsrPmemFree(p->mibFiles); + kfree(p->mibFiles); p->mibFiles = NULL; break; } @@ -150,32 +150,32 @@ void CsrWifiSmeFreeDownstreamMessageContents(u16 eventClass, void *message) u16 i1; for (i1 = 0; i1 < p->mibFilesCount; i1++) { - CsrPmemFree(p->mibFiles[i1].data); + kfree(p->mibFiles[i1].data); p->mibFiles[i1].data = NULL; } } - CsrPmemFree(p->mibFiles); + kfree(p->mibFiles); p->mibFiles = NULL; break; } case CSR_WIFI_SME_CLOAKED_SSIDS_SET_REQ: { CsrWifiSmeCloakedSsidsSetReq *p = (CsrWifiSmeCloakedSsidsSetReq *)message; - CsrPmemFree(p->cloakedSsids.cloakedSsids); + kfree(p->cloakedSsids.cloakedSsids); p->cloakedSsids.cloakedSsids = NULL; break; } case CSR_WIFI_SME_WPS_CONFIGURATION_REQ: { CsrWifiSmeWpsConfigurationReq *p = (CsrWifiSmeWpsConfigurationReq *)message; - CsrPmemFree(p->wpsConfig.secondaryDeviceType); + kfree(p->wpsConfig.secondaryDeviceType); p->wpsConfig.secondaryDeviceType = NULL; break; } case CSR_WIFI_SME_SET_REQ: { CsrWifiSmeSetReq *p = (CsrWifiSmeSetReq *)message; - CsrPmemFree(p->data); + kfree(p->data); p->data = NULL; break; } diff --git a/drivers/staging/csr/csr_wifi_sme_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_sme_free_upstream_contents.c index c34b57e..1977747 100644 --- a/drivers/staging/csr/csr_wifi_sme_free_upstream_contents.c +++ b/drivers/staging/csr/csr_wifi_sme_free_upstream_contents.c @@ -9,7 +9,7 @@ *****************************************************************************/ /* Note: this is an auto-generated file. */ - +#include #include "csr_pmem.h" #include "csr_wifi_sme_prim.h" #include "csr_wifi_sme_lib.h" @@ -41,121 +41,121 @@ void CsrWifiSmeFreeUpstreamMessageContents(u16 eventClass, void *message) case CSR_WIFI_SME_ASSOCIATION_COMPLETE_IND: { CsrWifiSmeAssociationCompleteInd *p = (CsrWifiSmeAssociationCompleteInd *)message; - CsrPmemFree(p->connectionInfo.beaconFrame); + kfree(p->connectionInfo.beaconFrame); p->connectionInfo.beaconFrame = NULL; - CsrPmemFree(p->connectionInfo.associationReqFrame); + kfree(p->connectionInfo.associationReqFrame); p->connectionInfo.associationReqFrame = NULL; - CsrPmemFree(p->connectionInfo.associationRspFrame); + kfree(p->connectionInfo.associationRspFrame); p->connectionInfo.associationRspFrame = NULL; - CsrPmemFree(p->connectionInfo.assocScanInfoElements); + kfree(p->connectionInfo.assocScanInfoElements); p->connectionInfo.assocScanInfoElements = NULL; - CsrPmemFree(p->connectionInfo.assocReqInfoElements); + kfree(p->connectionInfo.assocReqInfoElements); p->connectionInfo.assocReqInfoElements = NULL; - CsrPmemFree(p->connectionInfo.assocRspInfoElements); + kfree(p->connectionInfo.assocRspInfoElements); p->connectionInfo.assocRspInfoElements = NULL; break; } case CSR_WIFI_SME_BLACKLIST_CFM: { CsrWifiSmeBlacklistCfm *p = (CsrWifiSmeBlacklistCfm *)message; - CsrPmemFree(p->getAddresses); + kfree(p->getAddresses); p->getAddresses = NULL; break; } case CSR_WIFI_SME_CALIBRATION_DATA_GET_CFM: { CsrWifiSmeCalibrationDataGetCfm *p = (CsrWifiSmeCalibrationDataGetCfm *)message; - CsrPmemFree(p->calibrationData); + kfree(p->calibrationData); p->calibrationData = NULL; break; } case CSR_WIFI_SME_CONNECTION_CONFIG_GET_CFM: { CsrWifiSmeConnectionConfigGetCfm *p = (CsrWifiSmeConnectionConfigGetCfm *)message; - CsrPmemFree(p->connectionConfig.mlmeAssociateReqInformationElements); + kfree(p->connectionConfig.mlmeAssociateReqInformationElements); p->connectionConfig.mlmeAssociateReqInformationElements = NULL; break; } case CSR_WIFI_SME_CONNECTION_INFO_GET_CFM: { CsrWifiSmeConnectionInfoGetCfm *p = (CsrWifiSmeConnectionInfoGetCfm *)message; - CsrPmemFree(p->connectionInfo.beaconFrame); + kfree(p->connectionInfo.beaconFrame); p->connectionInfo.beaconFrame = NULL; - CsrPmemFree(p->connectionInfo.associationReqFrame); + kfree(p->connectionInfo.associationReqFrame); p->connectionInfo.associationReqFrame = NULL; - CsrPmemFree(p->connectionInfo.associationRspFrame); + kfree(p->connectionInfo.associationRspFrame); p->connectionInfo.associationRspFrame = NULL; - CsrPmemFree(p->connectionInfo.assocScanInfoElements); + kfree(p->connectionInfo.assocScanInfoElements); p->connectionInfo.assocScanInfoElements = NULL; - CsrPmemFree(p->connectionInfo.assocReqInfoElements); + kfree(p->connectionInfo.assocReqInfoElements); p->connectionInfo.assocReqInfoElements = NULL; - CsrPmemFree(p->connectionInfo.assocRspInfoElements); + kfree(p->connectionInfo.assocRspInfoElements); p->connectionInfo.assocRspInfoElements = NULL; break; } case CSR_WIFI_SME_MEDIA_STATUS_IND: { CsrWifiSmeMediaStatusInd *p = (CsrWifiSmeMediaStatusInd *)message; - CsrPmemFree(p->connectionInfo.beaconFrame); + kfree(p->connectionInfo.beaconFrame); p->connectionInfo.beaconFrame = NULL; - CsrPmemFree(p->connectionInfo.associationReqFrame); + kfree(p->connectionInfo.associationReqFrame); p->connectionInfo.associationReqFrame = NULL; - CsrPmemFree(p->connectionInfo.associationRspFrame); + kfree(p->connectionInfo.associationRspFrame); p->connectionInfo.associationRspFrame = NULL; - CsrPmemFree(p->connectionInfo.assocScanInfoElements); + kfree(p->connectionInfo.assocScanInfoElements); p->connectionInfo.assocScanInfoElements = NULL; - CsrPmemFree(p->connectionInfo.assocReqInfoElements); + kfree(p->connectionInfo.assocReqInfoElements); p->connectionInfo.assocReqInfoElements = NULL; - CsrPmemFree(p->connectionInfo.assocRspInfoElements); + kfree(p->connectionInfo.assocRspInfoElements); p->connectionInfo.assocRspInfoElements = NULL; break; } case CSR_WIFI_SME_MIB_GET_CFM: { CsrWifiSmeMibGetCfm *p = (CsrWifiSmeMibGetCfm *)message; - CsrPmemFree(p->mibAttribute); + kfree(p->mibAttribute); p->mibAttribute = NULL; break; } case CSR_WIFI_SME_MIB_GET_NEXT_CFM: { CsrWifiSmeMibGetNextCfm *p = (CsrWifiSmeMibGetNextCfm *)message; - CsrPmemFree(p->mibAttribute); + kfree(p->mibAttribute); p->mibAttribute = NULL; break; } case CSR_WIFI_SME_MULTICAST_ADDRESS_CFM: { CsrWifiSmeMulticastAddressCfm *p = (CsrWifiSmeMulticastAddressCfm *)message; - CsrPmemFree(p->getAddresses); + kfree(p->getAddresses); p->getAddresses = NULL; break; } case CSR_WIFI_SME_PMKID_CANDIDATE_LIST_IND: { CsrWifiSmePmkidCandidateListInd *p = (CsrWifiSmePmkidCandidateListInd *)message; - CsrPmemFree(p->pmkidCandidates); + kfree(p->pmkidCandidates); p->pmkidCandidates = NULL; break; } case CSR_WIFI_SME_PMKID_CFM: { CsrWifiSmePmkidCfm *p = (CsrWifiSmePmkidCfm *)message; - CsrPmemFree(p->getPmkids); + kfree(p->getPmkids); p->getPmkids = NULL; break; } case CSR_WIFI_SME_SCAN_CONFIG_GET_CFM: { CsrWifiSmeScanConfigGetCfm *p = (CsrWifiSmeScanConfigGetCfm *)message; - CsrPmemFree(p->scanConfig.passiveChannelList); + kfree(p->scanConfig.passiveChannelList); p->scanConfig.passiveChannelList = NULL; break; } case CSR_WIFI_SME_SCAN_RESULT_IND: { CsrWifiSmeScanResultInd *p = (CsrWifiSmeScanResultInd *)message; - CsrPmemFree(p->result.informationElements); + kfree(p->result.informationElements); p->result.informationElements = NULL; switch (p->result.p2pDeviceRole) { @@ -164,15 +164,15 @@ void CsrWifiSmeFreeUpstreamMessageContents(u16 eventClass, void *message) u16 i4; for (i4 = 0; i4 < p->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++) { - CsrPmemFree(p->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType); + kfree(p->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType); p->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL; } } - CsrPmemFree(p->result.deviceInfo.groupInfo.p2PClientInfo); + kfree(p->result.deviceInfo.groupInfo.p2PClientInfo); p->result.deviceInfo.groupInfo.p2PClientInfo = NULL; break; case CSR_WIFI_SME_P2P_ROLE_STANDALONE: - CsrPmemFree(p->result.deviceInfo.standalonedevInfo.secDeviceType); + kfree(p->result.deviceInfo.standalonedevInfo.secDeviceType); p->result.deviceInfo.standalonedevInfo.secDeviceType = NULL; break; default: @@ -187,7 +187,7 @@ void CsrWifiSmeFreeUpstreamMessageContents(u16 eventClass, void *message) u16 i1; for (i1 = 0; i1 < p->scanResultsCount; i1++) { - CsrPmemFree(p->scanResults[i1].informationElements); + kfree(p->scanResults[i1].informationElements); p->scanResults[i1].informationElements = NULL; switch (p->scanResults[i1].p2pDeviceRole) { @@ -196,15 +196,15 @@ void CsrWifiSmeFreeUpstreamMessageContents(u16 eventClass, void *message) u16 i4; for (i4 = 0; i4 < p->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++) { - CsrPmemFree(p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType); + kfree(p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType); p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL; } } - CsrPmemFree(p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo); + kfree(p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo); p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo = NULL; break; case CSR_WIFI_SME_P2P_ROLE_STANDALONE: - CsrPmemFree(p->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType); + kfree(p->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType); p->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType = NULL; break; default: @@ -212,58 +212,58 @@ void CsrWifiSmeFreeUpstreamMessageContents(u16 eventClass, void *message) } } } - CsrPmemFree(p->scanResults); + kfree(p->scanResults); p->scanResults = NULL; break; } case CSR_WIFI_SME_TSPEC_IND: { CsrWifiSmeTspecInd *p = (CsrWifiSmeTspecInd *)message; - CsrPmemFree(p->tspec); + kfree(p->tspec); p->tspec = NULL; break; } case CSR_WIFI_SME_TSPEC_CFM: { CsrWifiSmeTspecCfm *p = (CsrWifiSmeTspecCfm *)message; - CsrPmemFree(p->tspec); + kfree(p->tspec); p->tspec = NULL; break; } case CSR_WIFI_SME_VERSIONS_GET_CFM: { CsrWifiSmeVersionsGetCfm *p = (CsrWifiSmeVersionsGetCfm *)message; - CsrPmemFree(p->versions.routerBuild); + kfree(p->versions.routerBuild); p->versions.routerBuild = NULL; - CsrPmemFree(p->versions.smeBuild); + kfree(p->versions.smeBuild); p->versions.smeBuild = NULL; break; } case CSR_WIFI_SME_CLOAKED_SSIDS_GET_CFM: { CsrWifiSmeCloakedSsidsGetCfm *p = (CsrWifiSmeCloakedSsidsGetCfm *)message; - CsrPmemFree(p->cloakedSsids.cloakedSsids); + kfree(p->cloakedSsids.cloakedSsids); p->cloakedSsids.cloakedSsids = NULL; break; } case CSR_WIFI_SME_ERROR_IND: { CsrWifiSmeErrorInd *p = (CsrWifiSmeErrorInd *)message; - CsrPmemFree(p->errorMessage); + kfree(p->errorMessage); p->errorMessage = NULL; break; } case CSR_WIFI_SME_INFO_IND: { CsrWifiSmeInfoInd *p = (CsrWifiSmeInfoInd *)message; - CsrPmemFree(p->infoMessage); + kfree(p->infoMessage); p->infoMessage = NULL; break; } case CSR_WIFI_SME_CORE_DUMP_IND: { CsrWifiSmeCoreDumpInd *p = (CsrWifiSmeCoreDumpInd *)message; - CsrPmemFree(p->data); + kfree(p->data); p->data = NULL; break; } diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.c b/drivers/staging/csr/csr_wifi_sme_serialize.c index 27e969c..57b4cf0 100644 --- a/drivers/staging/csr/csr_wifi_sme_serialize.c +++ b/drivers/staging/csr/csr_wifi_sme_serialize.c @@ -10,6 +10,7 @@ /* Note: this is an auto-generated file. */ #include +#include #include "csr_pmem.h" #include "csr_msgconv.h" #include "csr_unicode.h" @@ -20,7 +21,7 @@ void CsrWifiSmePfree(void *ptr) { - CsrPmemFree(ptr); + kfree(ptr); } @@ -135,8 +136,8 @@ void* CsrWifiSmeBlacklistReqDes(u8 *buffer, size_t length) void CsrWifiSmeBlacklistReqSerFree(void *voidPrimitivePointer) { CsrWifiSmeBlacklistReq *primitive = (CsrWifiSmeBlacklistReq *) voidPrimitivePointer; - CsrPmemFree(primitive->setAddresses); - CsrPmemFree(primitive); + kfree(primitive->setAddresses); + kfree(primitive); } @@ -191,8 +192,8 @@ void* CsrWifiSmeCalibrationDataSetReqDes(u8 *buffer, size_t length) void CsrWifiSmeCalibrationDataSetReqSerFree(void *voidPrimitivePointer) { CsrWifiSmeCalibrationDataSetReq *primitive = (CsrWifiSmeCalibrationDataSetReq *) voidPrimitivePointer; - CsrPmemFree(primitive->calibrationData); - CsrPmemFree(primitive); + kfree(primitive->calibrationData); + kfree(primitive); } @@ -400,8 +401,8 @@ void* CsrWifiSmeConnectReqDes(u8 *buffer, size_t length) void CsrWifiSmeConnectReqSerFree(void *voidPrimitivePointer) { CsrWifiSmeConnectReq *primitive = (CsrWifiSmeConnectReq *) voidPrimitivePointer; - CsrPmemFree(primitive->connectionConfig.mlmeAssociateReqInformationElements); - CsrPmemFree(primitive); + kfree(primitive->connectionConfig.mlmeAssociateReqInformationElements); + kfree(primitive); } @@ -618,8 +619,8 @@ void* CsrWifiSmeMibGetNextReqDes(u8 *buffer, size_t length) void CsrWifiSmeMibGetNextReqSerFree(void *voidPrimitivePointer) { CsrWifiSmeMibGetNextReq *primitive = (CsrWifiSmeMibGetNextReq *) voidPrimitivePointer; - CsrPmemFree(primitive->mibAttribute); - CsrPmemFree(primitive); + kfree(primitive->mibAttribute); + kfree(primitive); } @@ -674,8 +675,8 @@ void* CsrWifiSmeMibGetReqDes(u8 *buffer, size_t length) void CsrWifiSmeMibGetReqSerFree(void *voidPrimitivePointer) { CsrWifiSmeMibGetReq *primitive = (CsrWifiSmeMibGetReq *) voidPrimitivePointer; - CsrPmemFree(primitive->mibAttribute); - CsrPmemFree(primitive); + kfree(primitive->mibAttribute); + kfree(primitive); } @@ -730,8 +731,8 @@ void* CsrWifiSmeMibSetReqDes(u8 *buffer, size_t length) void CsrWifiSmeMibSetReqSerFree(void *voidPrimitivePointer) { CsrWifiSmeMibSetReq *primitive = (CsrWifiSmeMibSetReq *) voidPrimitivePointer; - CsrPmemFree(primitive->mibAttribute); - CsrPmemFree(primitive); + kfree(primitive->mibAttribute); + kfree(primitive); } @@ -804,8 +805,8 @@ void* CsrWifiSmeMulticastAddressReqDes(u8 *buffer, size_t length) void CsrWifiSmeMulticastAddressReqSerFree(void *voidPrimitivePointer) { CsrWifiSmeMulticastAddressReq *primitive = (CsrWifiSmeMulticastAddressReq *) voidPrimitivePointer; - CsrPmemFree(primitive->setAddresses); - CsrPmemFree(primitive); + kfree(primitive->setAddresses); + kfree(primitive); } @@ -869,8 +870,8 @@ void* CsrWifiSmePacketFilterSetReqDes(u8 *buffer, size_t length) void CsrWifiSmePacketFilterSetReqSerFree(void *voidPrimitivePointer) { CsrWifiSmePacketFilterSetReq *primitive = (CsrWifiSmePacketFilterSetReq *) voidPrimitivePointer; - CsrPmemFree(primitive->filter); - CsrPmemFree(primitive); + kfree(primitive->filter); + kfree(primitive); } @@ -946,8 +947,8 @@ void* CsrWifiSmePmkidReqDes(u8 *buffer, size_t length) void CsrWifiSmePmkidReqSerFree(void *voidPrimitivePointer) { CsrWifiSmePmkidReq *primitive = (CsrWifiSmePmkidReq *) voidPrimitivePointer; - CsrPmemFree(primitive->setPmkids); - CsrPmemFree(primitive); + kfree(primitive->setPmkids); + kfree(primitive); } @@ -1224,8 +1225,8 @@ void* CsrWifiSmeScanConfigSetReqDes(u8 *buffer, size_t length) void CsrWifiSmeScanConfigSetReqSerFree(void *voidPrimitivePointer) { CsrWifiSmeScanConfigSetReq *primitive = (CsrWifiSmeScanConfigSetReq *) voidPrimitivePointer; - CsrPmemFree(primitive->scanConfig.passiveChannelList); - CsrPmemFree(primitive); + kfree(primitive->scanConfig.passiveChannelList); + kfree(primitive); } @@ -1341,10 +1342,10 @@ void* CsrWifiSmeScanFullReqDes(u8 *buffer, size_t length) void CsrWifiSmeScanFullReqSerFree(void *voidPrimitivePointer) { CsrWifiSmeScanFullReq *primitive = (CsrWifiSmeScanFullReq *) voidPrimitivePointer; - CsrPmemFree(primitive->ssid); - CsrPmemFree(primitive->channelList); - CsrPmemFree(primitive->probeIe); - CsrPmemFree(primitive); + kfree(primitive->ssid); + kfree(primitive->channelList); + kfree(primitive->probeIe); + kfree(primitive); } @@ -1482,9 +1483,9 @@ void* CsrWifiSmeTspecReqDes(u8 *buffer, size_t length) void CsrWifiSmeTspecReqSerFree(void *voidPrimitivePointer) { CsrWifiSmeTspecReq *primitive = (CsrWifiSmeTspecReq *) voidPrimitivePointer; - CsrPmemFree(primitive->tspec); - CsrPmemFree(primitive->tclas); - CsrPmemFree(primitive); + kfree(primitive->tspec); + kfree(primitive->tclas); + kfree(primitive); } @@ -1572,11 +1573,11 @@ void CsrWifiSmeWifiFlightmodeReqSerFree(void *voidPrimitivePointer) u16 i1; for (i1 = 0; i1 < primitive->mibFilesCount; i1++) { - CsrPmemFree(primitive->mibFiles[i1].data); + kfree(primitive->mibFiles[i1].data); } } - CsrPmemFree(primitive->mibFiles); - CsrPmemFree(primitive); + kfree(primitive->mibFiles); + kfree(primitive); } @@ -1664,11 +1665,11 @@ void CsrWifiSmeWifiOnReqSerFree(void *voidPrimitivePointer) u16 i1; for (i1 = 0; i1 < primitive->mibFilesCount; i1++) { - CsrPmemFree(primitive->mibFiles[i1].data); + kfree(primitive->mibFiles[i1].data); } } - CsrPmemFree(primitive->mibFiles); - CsrPmemFree(primitive); + kfree(primitive->mibFiles); + kfree(primitive); } @@ -1738,8 +1739,8 @@ void* CsrWifiSmeCloakedSsidsSetReqDes(u8 *buffer, size_t length) void CsrWifiSmeCloakedSsidsSetReqSerFree(void *voidPrimitivePointer) { CsrWifiSmeCloakedSsidsSetReq *primitive = (CsrWifiSmeCloakedSsidsSetReq *) voidPrimitivePointer; - CsrPmemFree(primitive->cloakedSsids.cloakedSsids); - CsrPmemFree(primitive); + kfree(primitive->cloakedSsids.cloakedSsids); + kfree(primitive); } @@ -1893,8 +1894,8 @@ void* CsrWifiSmeWpsConfigurationReqDes(u8 *buffer, size_t length) void CsrWifiSmeWpsConfigurationReqSerFree(void *voidPrimitivePointer) { CsrWifiSmeWpsConfigurationReq *primitive = (CsrWifiSmeWpsConfigurationReq *) voidPrimitivePointer; - CsrPmemFree(primitive->wpsConfig.secondaryDeviceType); - CsrPmemFree(primitive); + kfree(primitive->wpsConfig.secondaryDeviceType); + kfree(primitive); } @@ -1949,8 +1950,8 @@ void* CsrWifiSmeSetReqDes(u8 *buffer, size_t length) void CsrWifiSmeSetReqSerFree(void *voidPrimitivePointer) { CsrWifiSmeSetReq *primitive = (CsrWifiSmeSetReq *) voidPrimitivePointer; - CsrPmemFree(primitive->data); - CsrPmemFree(primitive); + kfree(primitive->data); + kfree(primitive); } @@ -2201,13 +2202,13 @@ void* CsrWifiSmeAssociationCompleteIndDes(u8 *buffer, size_t length) void CsrWifiSmeAssociationCompleteIndSerFree(void *voidPrimitivePointer) { CsrWifiSmeAssociationCompleteInd *primitive = (CsrWifiSmeAssociationCompleteInd *) voidPrimitivePointer; - CsrPmemFree(primitive->connectionInfo.beaconFrame); - CsrPmemFree(primitive->connectionInfo.associationReqFrame); - CsrPmemFree(primitive->connectionInfo.associationRspFrame); - CsrPmemFree(primitive->connectionInfo.assocScanInfoElements); - CsrPmemFree(primitive->connectionInfo.assocReqInfoElements); - CsrPmemFree(primitive->connectionInfo.assocRspInfoElements); - CsrPmemFree(primitive); + kfree(primitive->connectionInfo.beaconFrame); + kfree(primitive->connectionInfo.associationReqFrame); + kfree(primitive->connectionInfo.associationRspFrame); + kfree(primitive->connectionInfo.assocScanInfoElements); + kfree(primitive->connectionInfo.assocReqInfoElements); + kfree(primitive->connectionInfo.assocRspInfoElements); + kfree(primitive); } @@ -2325,8 +2326,8 @@ void* CsrWifiSmeBlacklistCfmDes(u8 *buffer, size_t length) void CsrWifiSmeBlacklistCfmSerFree(void *voidPrimitivePointer) { CsrWifiSmeBlacklistCfm *primitive = (CsrWifiSmeBlacklistCfm *) voidPrimitivePointer; - CsrPmemFree(primitive->getAddresses); - CsrPmemFree(primitive); + kfree(primitive->getAddresses); + kfree(primitive); } @@ -2384,8 +2385,8 @@ void* CsrWifiSmeCalibrationDataGetCfmDes(u8 *buffer, size_t length) void CsrWifiSmeCalibrationDataGetCfmSerFree(void *voidPrimitivePointer) { CsrWifiSmeCalibrationDataGetCfm *primitive = (CsrWifiSmeCalibrationDataGetCfm *) voidPrimitivePointer; - CsrPmemFree(primitive->calibrationData); - CsrPmemFree(primitive); + kfree(primitive->calibrationData); + kfree(primitive); } @@ -2737,8 +2738,8 @@ void* CsrWifiSmeConnectionConfigGetCfmDes(u8 *buffer, size_t length) void CsrWifiSmeConnectionConfigGetCfmSerFree(void *voidPrimitivePointer) { CsrWifiSmeConnectionConfigGetCfm *primitive = (CsrWifiSmeConnectionConfigGetCfm *) voidPrimitivePointer; - CsrPmemFree(primitive->connectionConfig.mlmeAssociateReqInformationElements); - CsrPmemFree(primitive); + kfree(primitive->connectionConfig.mlmeAssociateReqInformationElements); + kfree(primitive); } @@ -2941,13 +2942,13 @@ void* CsrWifiSmeConnectionInfoGetCfmDes(u8 *buffer, size_t length) void CsrWifiSmeConnectionInfoGetCfmSerFree(void *voidPrimitivePointer) { CsrWifiSmeConnectionInfoGetCfm *primitive = (CsrWifiSmeConnectionInfoGetCfm *) voidPrimitivePointer; - CsrPmemFree(primitive->connectionInfo.beaconFrame); - CsrPmemFree(primitive->connectionInfo.associationReqFrame); - CsrPmemFree(primitive->connectionInfo.associationRspFrame); - CsrPmemFree(primitive->connectionInfo.assocScanInfoElements); - CsrPmemFree(primitive->connectionInfo.assocReqInfoElements); - CsrPmemFree(primitive->connectionInfo.assocRspInfoElements); - CsrPmemFree(primitive); + kfree(primitive->connectionInfo.beaconFrame); + kfree(primitive->connectionInfo.associationReqFrame); + kfree(primitive->connectionInfo.associationRspFrame); + kfree(primitive->connectionInfo.assocScanInfoElements); + kfree(primitive->connectionInfo.assocReqInfoElements); + kfree(primitive->connectionInfo.assocRspInfoElements); + kfree(primitive); } @@ -3543,13 +3544,13 @@ void* CsrWifiSmeMediaStatusIndDes(u8 *buffer, size_t length) void CsrWifiSmeMediaStatusIndSerFree(void *voidPrimitivePointer) { CsrWifiSmeMediaStatusInd *primitive = (CsrWifiSmeMediaStatusInd *) voidPrimitivePointer; - CsrPmemFree(primitive->connectionInfo.beaconFrame); - CsrPmemFree(primitive->connectionInfo.associationReqFrame); - CsrPmemFree(primitive->connectionInfo.associationRspFrame); - CsrPmemFree(primitive->connectionInfo.assocScanInfoElements); - CsrPmemFree(primitive->connectionInfo.assocReqInfoElements); - CsrPmemFree(primitive->connectionInfo.assocRspInfoElements); - CsrPmemFree(primitive); + kfree(primitive->connectionInfo.beaconFrame); + kfree(primitive->connectionInfo.associationReqFrame); + kfree(primitive->connectionInfo.associationRspFrame); + kfree(primitive->connectionInfo.assocScanInfoElements); + kfree(primitive->connectionInfo.assocReqInfoElements); + kfree(primitive->connectionInfo.assocRspInfoElements); + kfree(primitive); } @@ -3655,8 +3656,8 @@ void* CsrWifiSmeMibGetCfmDes(u8 *buffer, size_t length) void CsrWifiSmeMibGetCfmSerFree(void *voidPrimitivePointer) { CsrWifiSmeMibGetCfm *primitive = (CsrWifiSmeMibGetCfm *) voidPrimitivePointer; - CsrPmemFree(primitive->mibAttribute); - CsrPmemFree(primitive); + kfree(primitive->mibAttribute); + kfree(primitive); } @@ -3714,8 +3715,8 @@ void* CsrWifiSmeMibGetNextCfmDes(u8 *buffer, size_t length) void CsrWifiSmeMibGetNextCfmSerFree(void *voidPrimitivePointer) { CsrWifiSmeMibGetNextCfm *primitive = (CsrWifiSmeMibGetNextCfm *) voidPrimitivePointer; - CsrPmemFree(primitive->mibAttribute); - CsrPmemFree(primitive); + kfree(primitive->mibAttribute); + kfree(primitive); } @@ -3836,8 +3837,8 @@ void* CsrWifiSmeMulticastAddressCfmDes(u8 *buffer, size_t length) void CsrWifiSmeMulticastAddressCfmSerFree(void *voidPrimitivePointer) { CsrWifiSmeMulticastAddressCfm *primitive = (CsrWifiSmeMulticastAddressCfm *) voidPrimitivePointer; - CsrPmemFree(primitive->getAddresses); - CsrPmemFree(primitive); + kfree(primitive->getAddresses); + kfree(primitive); } @@ -3982,8 +3983,8 @@ void* CsrWifiSmePmkidCandidateListIndDes(u8 *buffer, size_t length) void CsrWifiSmePmkidCandidateListIndSerFree(void *voidPrimitivePointer) { CsrWifiSmePmkidCandidateListInd *primitive = (CsrWifiSmePmkidCandidateListInd *) voidPrimitivePointer; - CsrPmemFree(primitive->pmkidCandidates); - CsrPmemFree(primitive); + kfree(primitive->pmkidCandidates); + kfree(primitive); } @@ -4062,8 +4063,8 @@ void* CsrWifiSmePmkidCfmDes(u8 *buffer, size_t length) void CsrWifiSmePmkidCfmSerFree(void *voidPrimitivePointer) { CsrWifiSmePmkidCfm *primitive = (CsrWifiSmePmkidCfm *) voidPrimitivePointer; - CsrPmemFree(primitive->getPmkids); - CsrPmemFree(primitive); + kfree(primitive->getPmkids); + kfree(primitive); } @@ -4505,8 +4506,8 @@ void* CsrWifiSmeScanConfigGetCfmDes(u8 *buffer, size_t length) void CsrWifiSmeScanConfigGetCfmSerFree(void *voidPrimitivePointer) { CsrWifiSmeScanConfigGetCfm *primitive = (CsrWifiSmeScanConfigGetCfm *) voidPrimitivePointer; - CsrPmemFree(primitive->scanConfig.passiveChannelList); - CsrPmemFree(primitive); + kfree(primitive->scanConfig.passiveChannelList); + kfree(primitive); } @@ -4780,7 +4781,7 @@ void* CsrWifiSmeScanResultIndDes(u8 *buffer, size_t length) void CsrWifiSmeScanResultIndSerFree(void *voidPrimitivePointer) { CsrWifiSmeScanResultInd *primitive = (CsrWifiSmeScanResultInd *) voidPrimitivePointer; - CsrPmemFree(primitive->result.informationElements); + kfree(primitive->result.informationElements); switch (primitive->result.p2pDeviceRole) { case CSR_WIFI_SME_P2P_ROLE_GO: @@ -4788,18 +4789,18 @@ void CsrWifiSmeScanResultIndSerFree(void *voidPrimitivePointer) u16 i4; for (i4 = 0; i4 < primitive->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++) { - CsrPmemFree(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType); + kfree(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType); } } - CsrPmemFree(primitive->result.deviceInfo.groupInfo.p2PClientInfo); + kfree(primitive->result.deviceInfo.groupInfo.p2PClientInfo); break; case CSR_WIFI_SME_P2P_ROLE_STANDALONE: - CsrPmemFree(primitive->result.deviceInfo.standalonedevInfo.secDeviceType); + kfree(primitive->result.deviceInfo.standalonedevInfo.secDeviceType); break; default: break; } - CsrPmemFree(primitive); + kfree(primitive); } @@ -5106,7 +5107,7 @@ void CsrWifiSmeScanResultsGetCfmSerFree(void *voidPrimitivePointer) u16 i1; for (i1 = 0; i1 < primitive->scanResultsCount; i1++) { - CsrPmemFree(primitive->scanResults[i1].informationElements); + kfree(primitive->scanResults[i1].informationElements); switch (primitive->scanResults[i1].p2pDeviceRole) { case CSR_WIFI_SME_P2P_ROLE_GO: @@ -5114,21 +5115,21 @@ void CsrWifiSmeScanResultsGetCfmSerFree(void *voidPrimitivePointer) u16 i4; for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++) { - CsrPmemFree(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType); + kfree(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType); } } - CsrPmemFree(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo); + kfree(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo); break; case CSR_WIFI_SME_P2P_ROLE_STANDALONE: - CsrPmemFree(primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType); + kfree(primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType); break; default: break; } } } - CsrPmemFree(primitive->scanResults); - CsrPmemFree(primitive); + kfree(primitive->scanResults); + kfree(primitive); } @@ -5336,8 +5337,8 @@ void* CsrWifiSmeTspecIndDes(u8 *buffer, size_t length) void CsrWifiSmeTspecIndSerFree(void *voidPrimitivePointer) { CsrWifiSmeTspecInd *primitive = (CsrWifiSmeTspecInd *) voidPrimitivePointer; - CsrPmemFree(primitive->tspec); - CsrPmemFree(primitive); + kfree(primitive->tspec); + kfree(primitive); } @@ -5404,8 +5405,8 @@ void* CsrWifiSmeTspecCfmDes(u8 *buffer, size_t length) void CsrWifiSmeTspecCfmSerFree(void *voidPrimitivePointer) { CsrWifiSmeTspecCfm *primitive = (CsrWifiSmeTspecCfm *) voidPrimitivePointer; - CsrPmemFree(primitive->tspec); - CsrPmemFree(primitive); + kfree(primitive->tspec); + kfree(primitive); } @@ -5473,9 +5474,9 @@ void* CsrWifiSmeVersionsGetCfmDes(u8 *buffer, size_t length) void CsrWifiSmeVersionsGetCfmSerFree(void *voidPrimitivePointer) { CsrWifiSmeVersionsGetCfm *primitive = (CsrWifiSmeVersionsGetCfm *) voidPrimitivePointer; - CsrPmemFree(primitive->versions.routerBuild); - CsrPmemFree(primitive->versions.smeBuild); - CsrPmemFree(primitive); + kfree(primitive->versions.routerBuild); + kfree(primitive->versions.smeBuild); + kfree(primitive); } @@ -5548,8 +5549,8 @@ void* CsrWifiSmeCloakedSsidsGetCfmDes(u8 *buffer, size_t length) void CsrWifiSmeCloakedSsidsGetCfmSerFree(void *voidPrimitivePointer) { CsrWifiSmeCloakedSsidsGetCfm *primitive = (CsrWifiSmeCloakedSsidsGetCfm *) voidPrimitivePointer; - CsrPmemFree(primitive->cloakedSsids.cloakedSsids); - CsrPmemFree(primitive); + kfree(primitive->cloakedSsids.cloakedSsids); + kfree(primitive); } @@ -5707,8 +5708,8 @@ void* CsrWifiSmeErrorIndDes(u8 *buffer, size_t length) void CsrWifiSmeErrorIndSerFree(void *voidPrimitivePointer) { CsrWifiSmeErrorInd *primitive = (CsrWifiSmeErrorInd *) voidPrimitivePointer; - CsrPmemFree(primitive->errorMessage); - CsrPmemFree(primitive); + kfree(primitive->errorMessage); + kfree(primitive); } @@ -5749,8 +5750,8 @@ void* CsrWifiSmeInfoIndDes(u8 *buffer, size_t length) void CsrWifiSmeInfoIndSerFree(void *voidPrimitivePointer) { CsrWifiSmeInfoInd *primitive = (CsrWifiSmeInfoInd *) voidPrimitivePointer; - CsrPmemFree(primitive->infoMessage); - CsrPmemFree(primitive); + kfree(primitive->infoMessage); + kfree(primitive); } @@ -5805,8 +5806,8 @@ void* CsrWifiSmeCoreDumpIndDes(u8 *buffer, size_t length) void CsrWifiSmeCoreDumpIndSerFree(void *voidPrimitivePointer) { CsrWifiSmeCoreDumpInd *primitive = (CsrWifiSmeCoreDumpInd *) voidPrimitivePointer; - CsrPmemFree(primitive->data); - CsrPmemFree(primitive); + kfree(primitive->data); + kfree(primitive); } diff --git a/drivers/staging/csr/drv.c b/drivers/staging/csr/drv.c index 36d9d53..6f5b3dd 100644 --- a/drivers/staging/csr/drv.c +++ b/drivers/staging/csr/drv.c @@ -1476,7 +1476,7 @@ unifi_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) if (pcli->snap_filter.count) { pcli->snap_filter.count = 0; - CsrPmemFree(pcli->snap_filter.protocols); + kfree(pcli->snap_filter.protocols); } if (snap_filter.count == 0) { @@ -1492,7 +1492,7 @@ unifi_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) (void*)snap_filter.protocols, snap_filter.count * sizeof(u16))) { - CsrPmemFree(pcli->snap_filter.protocols); + kfree(pcli->snap_filter.protocols); r = -EFAULT; goto out; } @@ -1938,7 +1938,7 @@ uf_sme_queue_message(unifi_priv_t *priv, u8 *buffer, int length) if (logptr == NULL) { unifi_error(priv, "Failed to allocate %d bytes for an SME message\n", sizeof(udi_log_t) + length); - CsrPmemFree(buffer); + kfree(buffer); return -ENOMEM; } @@ -1956,7 +1956,7 @@ uf_sme_queue_message(unifi_priv_t *priv, u8 *buffer, int length) down(&udi_mutex); if (priv->sme_cli == NULL) { kfree(logptr); - CsrPmemFree(buffer); + kfree(buffer); up(&udi_mutex); unifi_info(priv, "Message for the SME dropped, SME has gone away\n"); return 0; @@ -1971,7 +1971,7 @@ uf_sme_queue_message(unifi_priv_t *priv, u8 *buffer, int length) up(&udi_mutex); /* It is our responsibility to free the buffer allocated in build_packed_*() */ - CsrPmemFree(buffer); + kfree(buffer); func_exit(); diff --git a/drivers/staging/csr/putest.c b/drivers/staging/csr/putest.c index 96597ac..f2cb11e 100644 --- a/drivers/staging/csr/putest.c +++ b/drivers/staging/csr/putest.c @@ -499,7 +499,7 @@ int unifi_putest_dl_fw_buff(unifi_priv_t *priv, unsigned char *arg) fw_user_ptr = ((unsigned char*)arg) + sizeof(unifi_putest_command_t) + sizeof(unsigned int); if (copy_from_user(fw_buf, (void*)fw_user_ptr, fw_length)) { unifi_error(priv, "unifi_putest_dl_fw_buff: Failed to get the buffer\n"); - CsrPmemFree(fw_buf); + kfree(fw_buf); return -EFAULT; } @@ -537,7 +537,7 @@ int unifi_putest_dl_fw_buff(unifi_priv_t *priv, unsigned char *arg) free_fw: /* Finished with the putest f/w, so restore the station f/w */ priv->fw_sta = temp_fw_sta; - CsrPmemFree(fw_buf); + kfree(fw_buf); return CsrHipResultToStatus(csrResult); } diff --git a/drivers/staging/csr/sme_blocking.c b/drivers/staging/csr/sme_blocking.c index 3f0d70d..acf0f0f 100644 --- a/drivers/staging/csr/sme_blocking.c +++ b/drivers/staging/csr/sme_blocking.c @@ -415,7 +415,7 @@ int sme_mgt_scan_results_get_async(unifi_priv_t *priv, scan_result, i+1); if (r < 0) { - CsrPmemFree(scan_result_list); + kfree(scan_result_list); priv->sme_reply.reply_scan_results_count = 0; priv->sme_reply.reply_scan_results = NULL; return r; @@ -429,7 +429,7 @@ int sme_mgt_scan_results_get_async(unifi_priv_t *priv, * and invalidate the reply_scan_results to avoid re-using * the freed pointers. */ - CsrPmemFree(scan_result_list); + kfree(scan_result_list); priv->sme_reply.reply_scan_results_count = 0; priv->sme_reply.reply_scan_results = NULL; diff --git a/drivers/staging/csr/sme_userspace.c b/drivers/staging/csr/sme_userspace.c index 5dc7a2e..abcb446 100644 --- a/drivers/staging/csr/sme_userspace.c +++ b/drivers/staging/csr/sme_userspace.c @@ -128,7 +128,7 @@ uf_sme_deinit(unifi_priv_t *priv) /* Free any TCLASs previously allocated */ if (priv->packet_filters.tclas_ies_length) { priv->packet_filters.tclas_ies_length = 0; - CsrPmemFree(priv->filter_tclas_ies); + kfree(priv->filter_tclas_ies); priv->filter_tclas_ies = NULL; } diff --git a/drivers/staging/csr/ul_int.c b/drivers/staging/csr/ul_int.c index d71bb05..d8a728b 100644 --- a/drivers/staging/csr/ul_int.c +++ b/drivers/staging/csr/ul_int.c @@ -117,9 +117,9 @@ ul_register_client(unifi_priv_t *priv, unsigned int configuration, /* If allocation fails, free allocated memory. */ if (ul_clients[id].reply_bulkdata[ref] == NULL) { for (; ref > 0; ref --) { - CsrPmemFree(ul_clients[id].reply_bulkdata[ref - 1]); + kfree(ul_clients[id].reply_bulkdata[ref - 1]); } - CsrPmemFree(ul_clients[id].reply_signal); + kfree(ul_clients[id].reply_signal); unifi_error(priv, "Failed to allocate bulk data buffers for client.\n"); return NULL; } @@ -164,14 +164,14 @@ ul_deregister_client(ul_client_t *ul_client) unifi_trace(priv, UDBG5, "UDI (0x%x) deregistered.\n", ul_client); /* Free memory allocated for the reply signal and its bulk data. */ - CsrPmemFree(ul_client->reply_signal); + kfree(ul_client->reply_signal); for (ref = 0; ref < UNIFI_MAX_DATA_REFERENCES; ref ++) { - CsrPmemFree(ul_client->reply_bulkdata[ref]); + kfree(ul_client->reply_bulkdata[ref]); } if (ul_client->snap_filter.count) { ul_client->snap_filter.count = 0; - CsrPmemFree(ul_client->snap_filter.protocols); + kfree(ul_client->snap_filter.protocols); } /* Free anything pending on the udi_log list */ diff --git a/drivers/staging/csr/unifi_sme.c b/drivers/staging/csr/unifi_sme.c index 51d6792..0cb7b01 100644 --- a/drivers/staging/csr/unifi_sme.c +++ b/drivers/staging/csr/unifi_sme.c @@ -423,7 +423,7 @@ uf_multicast_list_wq(struct work_struct *work) } if (priv->smepriv == NULL) { - CsrPmemFree(multicast_address_list); + kfree(multicast_address_list); return; } @@ -433,7 +433,7 @@ uf_multicast_list_wq(struct work_struct *work) mc_count, multicast_address_list); /* The SME will take a copy of the addreses*/ - CsrPmemFree(multicast_address_list); + kfree(multicast_address_list); } @@ -572,7 +572,7 @@ int unifi_cfg_packet_filters(unifi_priv_t *priv, unsigned char *arg) /* Free any TCLASs previously allocated */ if (priv->packet_filters.tclas_ies_length) { - CsrPmemFree(priv->filter_tclas_ies); + kfree(priv->filter_tclas_ies); priv->filter_tclas_ies = NULL; } @@ -683,7 +683,7 @@ int unifi_cfg_wmm_addts(unifi_priv_t *priv, unsigned char *arg) rc = copy_from_user(addts_ie, addts_params, addts_ie_length); if (rc) { unifi_error(priv, "unifi_cfg_wmm_addts: Failed to get the addts buffer\n"); - CsrPmemFree(addts_ie); + kfree(addts_ie); return -EFAULT; } @@ -695,7 +695,7 @@ int unifi_cfg_wmm_addts(unifi_priv_t *priv, unsigned char *arg) rc = sme_mgt_tspec(priv, CSR_WIFI_SME_LIST_ACTION_ADD, addts_tid, &tspec, &tclas); - CsrPmemFree(addts_ie); + kfree(addts_ie); return rc; } @@ -1229,7 +1229,7 @@ void uf_send_pkt_to_encrypt(struct work_struct *work) CsrWifiRouterCtrlWapiUnicastTxEncryptIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, pktBulkDataLength, pktBulkData); unifi_trace(priv, UDBG1, "WapiUnicastTxEncryptInd sent to SME\n"); - CsrPmemFree(pktBulkData); /* Would have been copied over by the SME Handler */ + kfree(pktBulkData); /* Would have been copied over by the SME Handler */ func_exit(); } else { -- cgit v0.10.2 From 786eeeb3756e7fb08174c3a136c16462ccd541d1 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 16:41:09 -0700 Subject: staging: csr: remove CsrPmemAlloc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's just a wrapper around kmalloc(, GFP_KERNEL) + a call to panic() if we are out of memory, which is a very foolish thing to do (the panic that is.) So replace it with calls to kmalloc() and ignore the out-of-memory casese for now, odds are it will not be hit, and if it does, hey, we will end up panicing just the same as with the old code. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/Makefile b/drivers/staging/csr/Makefile index f4a8950..814f57a 100644 --- a/drivers/staging/csr/Makefile +++ b/drivers/staging/csr/Makefile @@ -69,7 +69,6 @@ csr_wifi-y := bh.o \ csr_helper-y := csr_time.o \ csr_util.o \ csr_framework_ext.o \ - csr_pmem.o \ csr_wifi_serialize_primitive_types.o \ csr_serialize_primitive_types.o \ csr_utf16.o \ diff --git a/drivers/staging/csr/csr_msgconv.c b/drivers/staging/csr/csr_msgconv.c index 42e0a4a..dbf0d64 100644 --- a/drivers/staging/csr/csr_msgconv.c +++ b/drivers/staging/csr/csr_msgconv.c @@ -233,7 +233,7 @@ void CsrMsgConvInsert(u16 primType, const CsrMsgConvMsgEntry *ce) } else { - pc = CsrPmemAlloc(sizeof(*pc)); + pc = kmalloc(sizeof(*pc), GFP_KERNEL); pc->primType = primType; pc->conv = ce; pc->lookupFunc = NULL; @@ -279,7 +279,7 @@ CsrMsgConvEntry *CsrMsgConvInit(void) { if (!converter) { - converter = (CsrMsgConvEntry *) CsrPmemAlloc(sizeof(CsrMsgConvEntry)); + converter = kmalloc(sizeof(CsrMsgConvEntry), GFP_KERNEL); converter->profile_converters = NULL; converter->free_message = free_message; diff --git a/drivers/staging/csr/csr_pmem.c b/drivers/staging/csr/csr_pmem.c deleted file mode 100644 index a277925..0000000 --- a/drivers/staging/csr/csr_pmem.c +++ /dev/null @@ -1,40 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#include -#include -#include - - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33) -#include -#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16) -#include -#endif - -#include - -#include "csr_panic.h" -#include "csr_pmem.h" - -void *CsrPmemAlloc(size_t size) -{ - void *ret; - - ret = kmalloc(size, GFP_KERNEL); - if (!ret) - { - CsrPanic(CSR_TECH_FW, CSR_PANIC_FW_HEAP_EXHAUSTION, - "out of memory"); - } - - return ret; -} -EXPORT_SYMBOL_GPL(CsrPmemAlloc); diff --git a/drivers/staging/csr/csr_pmem.h b/drivers/staging/csr/csr_pmem.h index 283aff0..1fb74fa 100644 --- a/drivers/staging/csr/csr_pmem.h +++ b/drivers/staging/csr/csr_pmem.h @@ -17,36 +17,6 @@ extern "C" { #endif -#ifndef CSR_PMEM_DEBUG_ENABLE -/***************************************************************************** - - NAME - CsrPmemAlloc - - DESCRIPTION - This function will allocate a contiguous block of memory of at least - the specified size in bytes and return a pointer to the allocated - memory. This function is not allowed to return NULL. A size of 0 is a - valid request, and a unique and valid (not NULL) pointer must be - returned in this case. - - PARAMETERS - size - Size of memory requested. Note that a size of 0 is valid. - - RETURNS - Pointer to allocated memory. - -*****************************************************************************/ -#ifdef CSR_PMEM_DEBUG -void *CsrPmemAllocDebug(size_t size, - const char *file, u32 line); -#define CsrPmemAlloc(sz) CsrPmemAllocDebug((sz), __FILE__, __LINE__) -#else -void *CsrPmemAlloc(size_t size); -#endif - -#endif - /***************************************************************************** NAME @@ -114,7 +84,6 @@ typedef void (CsrPmemDebugOnFree)(void *ptr, void *userptr, CsrPmemDebugAllocTyp void CsrPmemDebugInstallHooks(u8 headSize, u8 endSize, CsrPmemDebugOnAlloc *onAllocCallback, CsrPmemDebugOnFree *onFreeCallback); void *CsrPmemDebugAlloc(size_t size, CsrPmemDebugAllocType type, const char* file, u32 line); -#define CsrPmemAlloc(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_PMEM_ALLOC, __FILE__, __LINE__) void CsrPmemDebugFree(void *ptr, CsrPmemDebugAllocType type, const char* file, u32 line); diff --git a/drivers/staging/csr/csr_sched.h b/drivers/staging/csr/csr_sched.h index 7ae1ea5..cc1b8bf 100644 --- a/drivers/staging/csr/csr_sched.h +++ b/drivers/staging/csr/csr_sched.h @@ -120,9 +120,9 @@ void CsrSchedBgintSet(CsrSchedBgint bgint); * be null. * * NOTE - * If "mv" is not null then it will typically be a chunk of CsrPmemAlloc()ed + * If "mv" is not null then it will typically be a chunk of kmalloc()ed * memory, though there is no need for it to be so. Tasks should normally - * obey the convention that when a message built with CsrPmemAlloc()ed memory + * obey the convention that when a message built with kmalloc()ed memory * is given to CsrSchedMessagePut() then ownership of the memory is ceded to the * scheduler - and eventually to the recipient task. I.e., the receiver of * the message will be expected to kfree() the message storage. diff --git a/drivers/staging/csr/csr_serialize_primitive_types.c b/drivers/staging/csr/csr_serialize_primitive_types.c index a4b5632..bb08f19 100644 --- a/drivers/staging/csr/csr_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_serialize_primitive_types.c @@ -9,6 +9,7 @@ *****************************************************************************/ #include +#include #include "csr_prim_defs.h" #include "csr_msgconv.h" #include "csr_macro.h" @@ -66,7 +67,7 @@ void CsrUtf16StringDes(u16 **value, u8 *buffer, size_t *offset) CsrUint32Des(&length, buffer, offset); - *value = CsrPmemAlloc(length * sizeof(**value)); + *value = kmalloc(length * sizeof(**value), GFP_KERNEL); for (i = 0; i < length; i++) { CsrUint16Des(&(*value)[i], buffer, offset); @@ -224,7 +225,7 @@ u8 *CsrEventSer(u8 *ptr, size_t *len, void *msg) void *CsrEventDes(u8 *buffer, size_t length) { - CsrEvent *primitive = (CsrEvent *) CsrPmemAlloc(sizeof(CsrEvent)); + CsrEvent *primitive = kmalloc(sizeof(CsrEvent), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); @@ -247,7 +248,7 @@ u8 *CsrEventCsrUint8Ser(u8 *ptr, size_t *len, void *msg) void *CsrEventCsrUint8Des(u8 *buffer, size_t length) { - CsrEventCsrUint8 *primitive = (CsrEventCsrUint8 *) CsrPmemAlloc(sizeof(CsrEventCsrUint8)); + CsrEventCsrUint8 *primitive = kmalloc(sizeof(CsrEventCsrUint8), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); @@ -272,7 +273,7 @@ u8 *CsrEventCsrUint16Ser(u8 *ptr, size_t *len, void *msg) void *CsrEventCsrUint16Des(u8 *buffer, size_t length) { - CsrEventCsrUint16 *primitive = (CsrEventCsrUint16 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16)); + CsrEventCsrUint16 *primitive = kmalloc(sizeof(CsrEventCsrUint16), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); @@ -297,7 +298,7 @@ u8 *CsrEventCsrUint32Ser(u8 *ptr, size_t *len, void *msg) void *CsrEventCsrUint32Des(u8 *buffer, size_t length) { - CsrEventCsrUint32 *primitive = (CsrEventCsrUint32 *) CsrPmemAlloc(sizeof(CsrEventCsrUint32)); + CsrEventCsrUint32 *primitive = kmalloc(sizeof(CsrEventCsrUint32), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); @@ -323,7 +324,7 @@ u8 *CsrEventCsrUint16CsrUint8Ser(u8 *ptr, size_t *len, void *msg) void *CsrEventCsrUint16CsrUint8Des(u8 *buffer, size_t length) { - CsrEventCsrUint16CsrUint8 *primitive = (CsrEventCsrUint16CsrUint8 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrUint8)); + CsrEventCsrUint16CsrUint8 *primitive = kmalloc(sizeof(CsrEventCsrUint16CsrUint8), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); @@ -350,7 +351,7 @@ u8 *CsrEventCsrUint16CsrUint16Ser(u8 *ptr, size_t *len, void *msg) void *CsrEventCsrUint16CsrUint16Des(u8 *buffer, size_t length) { - CsrEventCsrUint16CsrUint16 *primitive = (CsrEventCsrUint16CsrUint16 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrUint16)); + CsrEventCsrUint16CsrUint16 *primitive = kmalloc(sizeof(CsrEventCsrUint16CsrUint16), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); @@ -377,7 +378,7 @@ u8 *CsrEventCsrUint16CsrUint32Ser(u8 *ptr, size_t *len, void *msg) void *CsrEventCsrUint16CsrUint32Des(u8 *buffer, size_t length) { - CsrEventCsrUint16CsrUint32 *primitive = (CsrEventCsrUint16CsrUint32 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrUint32)); + CsrEventCsrUint16CsrUint32 *primitive = kmalloc(sizeof(CsrEventCsrUint16CsrUint32), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); @@ -405,7 +406,7 @@ u8 *CsrEventCsrUint16CsrCharStringSer(u8 *ptr, size_t *len, void *msg) void *CsrEventCsrUint16CsrCharStringDes(u8 *buffer, size_t length) { - CsrEventCsrUint16CsrCharString *primitive = (CsrEventCsrUint16CsrCharString *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrCharString)); + CsrEventCsrUint16CsrCharString *primitive = kmalloc(sizeof(CsrEventCsrUint16CsrCharString), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); @@ -432,7 +433,7 @@ u8 *CsrEventCsrUint32CsrUint16Ser(u8 *ptr, size_t *len, void *msg) void *CsrEventCsrUint32CsrUint16Des(u8 *buffer, size_t length) { - CsrEventCsrUint32CsrUint16 *primitive = (CsrEventCsrUint32CsrUint16 *) CsrPmemAlloc(sizeof(CsrEventCsrUint32CsrUint16)); + CsrEventCsrUint32CsrUint16 *primitive = kmalloc(sizeof(CsrEventCsrUint32CsrUint16), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); @@ -460,7 +461,7 @@ u8 *CsrEventCsrUint32CsrCharStringSer(u8 *ptr, size_t *len, void *msg) void *CsrEventCsrUint32CsrCharStringDes(u8 *buffer, size_t length) { - CsrEventCsrUint32CsrCharString *primitive = (CsrEventCsrUint32CsrCharString *) CsrPmemAlloc(sizeof(CsrEventCsrUint32CsrCharString)); + CsrEventCsrUint32CsrCharString *primitive = kmalloc(sizeof(CsrEventCsrUint32CsrCharString), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index f827342..801d8a8 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -88,7 +88,7 @@ u16 *CsrUint32ToUtf16String(u32 number) noOfDigits++; } - output = (u16 *) CsrPmemAlloc(sizeof(u16) * (noOfDigits + 1)); /*add space for 0-termination*/ + output = kmalloc(sizeof(u16) * (noOfDigits + 1), GFP_KERNEL); /*add space for 0-termination*/ tempNumber = number; for (count = noOfDigits; count > 0; count--) @@ -185,7 +185,7 @@ u16 *CsrUtf16ConcatenateTexts(const u16 *inputText1, const u16 *inputText2, return NULL; } - outputText = (u16 *) CsrPmemAlloc((textLen + 1) * sizeof(u16)); /* add space for 0-termination*/ + outputText = kmalloc((textLen + 1) * sizeof(u16), GFP_KERNEL); /* add space for 0-termination*/ if (inputText1 != NULL) @@ -320,7 +320,7 @@ u8 *CsrUtf16String2Utf8(const u16 *source) } } - dest = CsrPmemAlloc(length); + dest = kmalloc(length, GFP_KERNEL); destStart = dest; for (i = 0; i < sourceLength; i++) @@ -610,7 +610,7 @@ u16 *CsrUtf82Utf16String(const u8 *utf8String) } /* Create space for the null terminated character */ - dest = (u16 *) CsrPmemAlloc((1 + length) * sizeof(u16)); + dest = kmalloc((1 + length) * sizeof(u16), GFP_KERNEL); destStart = dest; for (i = 0; i < sourceLength; i++) @@ -736,7 +736,7 @@ u16 *CsrUtf16StringDuplicate(const u16 *source) if (source) /* if source is not NULL*/ { length = (CsrUtf16StrLen(source) + 1) * sizeof(u16); - target = (u16 *) CsrPmemAlloc(length); + target = kmalloc(length, GFP_KERNEL); memcpy(target, source, length); } return target; @@ -844,7 +844,7 @@ u16 *CsrUtf16String2XML(u16 *str) if (encodeChars) { - resultString = outputString = CsrPmemAlloc(stringLength * sizeof(u16)); + resultString = outputString = kmalloc(stringLength * sizeof(u16), GFP_KERNEL); scanString = str; @@ -958,7 +958,7 @@ u16 *CsrXML2Utf16String(u16 *str) if (encodeChars) { - resultString = outputString = CsrPmemAlloc(stringLength * sizeof(u16)); + resultString = outputString = kmalloc(stringLength * sizeof(u16), GFP_KERNEL); scanString = str; diff --git a/drivers/staging/csr/csr_wifi_fsm.h b/drivers/staging/csr/csr_wifi_fsm.h index 83a9c9e..e933ab1 100644 --- a/drivers/staging/csr/csr_wifi_fsm.h +++ b/drivers/staging/csr/csr_wifi_fsm.h @@ -160,7 +160,7 @@ extern void CsrWifiFsmSendEventExternal(CsrWifiFsmContext *context, CsrWifiFsmEv */ #define CsrWifiFsmSendAlienEventExternal(_context, _alienEvent, _source, _destination, _primtype, _id) \ { \ - CsrWifiFsmAlienEvent *_evt = (CsrWifiFsmAlienEvent *)CsrPmemAlloc(sizeof(CsrWifiFsmAlienEvent)); \ + CsrWifiFsmAlienEvent *_evt = kmalloc(sizeof(CsrWifiFsmAlienEvent), GFP_KERNEL); \ _evt->alienEvent = _alienEvent; \ CsrWifiFsmSendEventExternal(_context, (CsrWifiFsmEvent *)_evt, _source, _destination, _primtype, _id); \ } diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.c b/drivers/staging/csr/csr_wifi_hip_card_sdio.c index d4c9281..44ab00c 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.c @@ -1655,7 +1655,7 @@ static CsrResult card_allocate_memory_resources(card_t *card) /* * Allocate memory for the from-host and to-host bulk data slots. - * This is done as separate CsrPmemAllocs because lots of smaller + * This is done as separate kmallocs because lots of smaller * allocations are more likely to succeed than one huge one. */ diff --git a/drivers/staging/csr/csr_wifi_nme_ap_lib.h b/drivers/staging/csr/csr_wifi_nme_ap_lib.h index 45b8d26..fed0ea2 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_lib.h +++ b/drivers/staging/csr/csr_wifi_nme_ap_lib.h @@ -95,7 +95,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApConfigSetReqCreate(msg__, dst__, src__, apConfig__, apMacConfig__) \ - msg__ = (CsrWifiNmeApConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApConfigSetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApConfigSetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_CONFIG_SET_REQ, dst__, src__); \ msg__->apConfig = (apConfig__); \ msg__->apMacConfig = (apMacConfig__); @@ -124,7 +124,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApConfigSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiNmeApConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApConfigSetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApConfigSetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_CONFIG_SET_CFM, dst__, src__); \ msg__->status = (status__); @@ -159,7 +159,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApStaRemoveReqCreate(msg__, dst__, src__, interfaceTag__, staMacAddress__, keepBlocking__) \ - msg__ = (CsrWifiNmeApStaRemoveReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStaRemoveReq)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApStaRemoveReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STA_REMOVE_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->staMacAddress = (staMacAddress__); \ @@ -199,7 +199,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApStartReqCreate(msg__, dst__, src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__) \ - msg__ = (CsrWifiNmeApStartReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStartReq)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApStartReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_START_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->apType = (apType__); \ @@ -238,7 +238,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApStartCfmCreate(msg__, dst__, src__, interfaceTag__, status__, ssid__) \ - msg__ = (CsrWifiNmeApStartCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApStartCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApStartCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_START_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -273,7 +273,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApStationIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__) \ - msg__ = (CsrWifiNmeApStationInd *) CsrPmemAlloc(sizeof(CsrWifiNmeApStationInd)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApStationInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STATION_IND, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->mediaStatus = (mediaStatus__); \ @@ -304,7 +304,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApStopReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = (CsrWifiNmeApStopReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopReq)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApStopReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STOP_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); @@ -336,7 +336,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApStopIndCreate(msg__, dst__, src__, interfaceTag__, apType__, status__) \ - msg__ = (CsrWifiNmeApStopInd *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopInd)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApStopInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STOP_IND, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->apType = (apType__); \ @@ -369,7 +369,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApStopCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = (CsrWifiNmeApStopCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApStopCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STOP_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); @@ -402,7 +402,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApWmmParamUpdateReqCreate(msg__, dst__, src__, wmmApParams__, wmmApBcParams__) \ - msg__ = (CsrWifiNmeApWmmParamUpdateReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApWmmParamUpdateReq)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApWmmParamUpdateReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_REQ, dst__, src__); \ memcpy(msg__->wmmApParams, (wmmApParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); \ memcpy(msg__->wmmApBcParams, (wmmApBcParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); @@ -431,7 +431,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApWmmParamUpdateCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiNmeApWmmParamUpdateCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApWmmParamUpdateCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApWmmParamUpdateCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_CFM, dst__, src__); \ msg__->status = (status__); @@ -469,7 +469,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApWpsRegisterReqCreate(msg__, dst__, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__) \ - msg__ = (CsrWifiNmeApWpsRegisterReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApWpsRegisterReq)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApWpsRegisterReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WPS_REGISTER_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->selectedDevicePasswordId = (selectedDevicePasswordId__); \ @@ -501,7 +501,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApWpsRegisterCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = (CsrWifiNmeApWpsRegisterCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApWpsRegisterCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApWpsRegisterCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WPS_REGISTER_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); diff --git a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c index dcdcc32..8112aa0 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c +++ b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c @@ -152,7 +152,7 @@ u8* CsrWifiNmeApConfigSetReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiNmeApConfigSetReqDes(u8 *buffer, size_t length) { - CsrWifiNmeApConfigSetReq *primitive = (CsrWifiNmeApConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApConfigSetReq)); + CsrWifiNmeApConfigSetReq *primitive = kmalloc(sizeof(CsrWifiNmeApConfigSetReq), GFP_KERNEL); size_t offset; offset = 0; @@ -199,7 +199,7 @@ void* CsrWifiNmeApConfigSetReqDes(u8 *buffer, size_t length) primitive->apMacConfig.macAddressList = NULL; if (primitive->apMacConfig.macAddressListCount) { - primitive->apMacConfig.macAddressList = (CsrWifiMacAddress *)CsrPmemAlloc(sizeof(CsrWifiMacAddress) * primitive->apMacConfig.macAddressListCount); + primitive->apMacConfig.macAddressList = kmalloc(sizeof(CsrWifiMacAddress) * primitive->apMacConfig.macAddressListCount, GFP_KERNEL); } { u16 i2; @@ -255,7 +255,7 @@ u8* CsrWifiNmeApWpsRegisterReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiNmeApWpsRegisterReqDes(u8 *buffer, size_t length) { - CsrWifiNmeApWpsRegisterReq *primitive = (CsrWifiNmeApWpsRegisterReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApWpsRegisterReq)); + CsrWifiNmeApWpsRegisterReq *primitive = kmalloc(sizeof(CsrWifiNmeApWpsRegisterReq), GFP_KERNEL); size_t offset; offset = 0; @@ -447,7 +447,7 @@ u8* CsrWifiNmeApStartReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiNmeApStartReqDes(u8 *buffer, size_t length) { - CsrWifiNmeApStartReq *primitive = (CsrWifiNmeApStartReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStartReq)); + CsrWifiNmeApStartReq *primitive = kmalloc(sizeof(CsrWifiNmeApStartReq), GFP_KERNEL); size_t offset; offset = 0; @@ -518,7 +518,7 @@ void* CsrWifiNmeApStartReqDes(u8 *buffer, size_t length) primitive->p2pGoParam.operatingChanList.channelEntryList = NULL; if (primitive->p2pGoParam.operatingChanList.channelEntryListCount) { - primitive->p2pGoParam.operatingChanList.channelEntryList = (CsrWifiSmeApP2pOperatingChanEntry *)CsrPmemAlloc(sizeof(CsrWifiSmeApP2pOperatingChanEntry) * primitive->p2pGoParam.operatingChanList.channelEntryListCount); + primitive->p2pGoParam.operatingChanList.channelEntryList = kmalloc(sizeof(CsrWifiSmeApP2pOperatingChanEntry) * primitive->p2pGoParam.operatingChanList.channelEntryListCount, GFP_KERNEL); } { u16 i3; @@ -528,7 +528,7 @@ void* CsrWifiNmeApStartReqDes(u8 *buffer, size_t length) CsrUint8Des((u8 *) &primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount, buffer, &offset); if (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount) { - primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel = (u8 *)CsrPmemAlloc(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount); + primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel = kmalloc(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount, GFP_KERNEL); CsrMemCpyDes(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel, buffer, &offset, ((u16) (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount))); } else @@ -641,7 +641,7 @@ u8* CsrWifiNmeApWmmParamUpdateReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiNmeApWmmParamUpdateReqDes(u8 *buffer, size_t length) { - CsrWifiNmeApWmmParamUpdateReq *primitive = (CsrWifiNmeApWmmParamUpdateReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApWmmParamUpdateReq)); + CsrWifiNmeApWmmParamUpdateReq *primitive = kmalloc(sizeof(CsrWifiNmeApWmmParamUpdateReq), GFP_KERNEL); size_t offset; offset = 0; @@ -699,7 +699,7 @@ u8* CsrWifiNmeApStaRemoveReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiNmeApStaRemoveReqDes(u8 *buffer, size_t length) { - CsrWifiNmeApStaRemoveReq *primitive = (CsrWifiNmeApStaRemoveReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStaRemoveReq)); + CsrWifiNmeApStaRemoveReq *primitive = kmalloc(sizeof(CsrWifiNmeApStaRemoveReq), GFP_KERNEL); size_t offset; offset = 0; @@ -736,7 +736,7 @@ u8* CsrWifiNmeApWpsRegisterCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiNmeApWpsRegisterCfmDes(u8 *buffer, size_t length) { - CsrWifiNmeApWpsRegisterCfm *primitive = (CsrWifiNmeApWpsRegisterCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApWpsRegisterCfm)); + CsrWifiNmeApWpsRegisterCfm *primitive = kmalloc(sizeof(CsrWifiNmeApWpsRegisterCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -776,7 +776,7 @@ u8* CsrWifiNmeApStartCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiNmeApStartCfmDes(u8 *buffer, size_t length) { - CsrWifiNmeApStartCfm *primitive = (CsrWifiNmeApStartCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApStartCfm)); + CsrWifiNmeApStartCfm *primitive = kmalloc(sizeof(CsrWifiNmeApStartCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -814,7 +814,7 @@ u8* CsrWifiNmeApStopCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiNmeApStopCfmDes(u8 *buffer, size_t length) { - CsrWifiNmeApStopCfm *primitive = (CsrWifiNmeApStopCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopCfm)); + CsrWifiNmeApStopCfm *primitive = kmalloc(sizeof(CsrWifiNmeApStopCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -852,7 +852,7 @@ u8* CsrWifiNmeApStopIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiNmeApStopIndDes(u8 *buffer, size_t length) { - CsrWifiNmeApStopInd *primitive = (CsrWifiNmeApStopInd *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopInd)); + CsrWifiNmeApStopInd *primitive = kmalloc(sizeof(CsrWifiNmeApStopInd), GFP_KERNEL); size_t offset; offset = 0; @@ -893,7 +893,7 @@ u8* CsrWifiNmeApStationIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiNmeApStationIndDes(u8 *buffer, size_t length) { - CsrWifiNmeApStationInd *primitive = (CsrWifiNmeApStationInd *) CsrPmemAlloc(sizeof(CsrWifiNmeApStationInd)); + CsrWifiNmeApStationInd *primitive = kmalloc(sizeof(CsrWifiNmeApStationInd), GFP_KERNEL); size_t offset; offset = 0; diff --git a/drivers/staging/csr/csr_wifi_nme_lib.h b/drivers/staging/csr/csr_wifi_nme_lib.h index 4d8f3f1..04b7c31 100644 --- a/drivers/staging/csr/csr_wifi_nme_lib.h +++ b/drivers/staging/csr/csr_wifi_nme_lib.h @@ -100,7 +100,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeConnectionStatusGetReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = (CsrWifiNmeConnectionStatusGetReq *) CsrPmemAlloc(sizeof(CsrWifiNmeConnectionStatusGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeConnectionStatusGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_CONNECTION_STATUS_GET_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); @@ -131,7 +131,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeConnectionStatusGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionStatus__) \ - msg__ = (CsrWifiNmeConnectionStatusGetCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeConnectionStatusGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeConnectionStatusGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_CONNECTION_STATUS_GET_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -164,7 +164,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeEventMaskSetReqCreate(msg__, dst__, src__, indMask__) \ - msg__ = (CsrWifiNmeEventMaskSetReq *) CsrPmemAlloc(sizeof(CsrWifiNmeEventMaskSetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeEventMaskSetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_EVENT_MASK_SET_REQ, dst__, src__); \ msg__->indMask = (indMask__); @@ -193,7 +193,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeEventMaskSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiNmeEventMaskSetCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeEventMaskSetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeEventMaskSetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_EVENT_MASK_SET_CFM, dst__, src__); \ msg__->status = (status__); @@ -224,7 +224,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeProfileConnectReqCreate(msg__, dst__, src__, interfaceTag__, profileIdentity__) \ - msg__ = (CsrWifiNmeProfileConnectReq *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileConnectReq)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeProfileConnectReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_CONNECT_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->profileIdentity = (profileIdentity__); @@ -269,7 +269,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeProfileConnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__) \ - msg__ = (CsrWifiNmeProfileConnectCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileConnectCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeProfileConnectCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_CONNECT_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -300,7 +300,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeProfileDeleteAllReqCreate(msg__, dst__, src__) \ - msg__ = (CsrWifiNmeProfileDeleteAllReq *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileDeleteAllReq)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeProfileDeleteAllReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_ALL_REQ, dst__, src__); #define CsrWifiNmeProfileDeleteAllReqSendTo(dst__, src__) \ @@ -329,7 +329,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeProfileDeleteAllCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiNmeProfileDeleteAllCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileDeleteAllCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeProfileDeleteAllCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_ALL_CFM, dst__, src__); \ msg__->status = (status__); @@ -358,7 +358,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeProfileDeleteReqCreate(msg__, dst__, src__, profileIdentity__) \ - msg__ = (CsrWifiNmeProfileDeleteReq *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileDeleteReq)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeProfileDeleteReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_REQ, dst__, src__); \ msg__->profileIdentity = (profileIdentity__); @@ -387,7 +387,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeProfileDeleteCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiNmeProfileDeleteCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileDeleteCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeProfileDeleteCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_CFM, dst__, src__); \ msg__->status = (status__); @@ -427,7 +427,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeProfileDisconnectIndCreate(msg__, dst__, src__, interfaceTag__, connectAttemptsCount__, connectAttempts__) \ - msg__ = (CsrWifiNmeProfileDisconnectInd *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileDisconnectInd)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeProfileDisconnectInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DISCONNECT_IND, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->connectAttemptsCount = (connectAttemptsCount__); \ @@ -469,7 +469,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeProfileOrderSetReqCreate(msg__, dst__, src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__) \ - msg__ = (CsrWifiNmeProfileOrderSetReq *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileOrderSetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeProfileOrderSetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_ORDER_SET_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->profileIdentitysCount = (profileIdentitysCount__); \ @@ -501,7 +501,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeProfileOrderSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = (CsrWifiNmeProfileOrderSetCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileOrderSetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeProfileOrderSetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_ORDER_SET_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); @@ -535,7 +535,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeProfileSetReqCreate(msg__, dst__, src__, profile__) \ - msg__ = (CsrWifiNmeProfileSetReq *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileSetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeProfileSetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_SET_REQ, dst__, src__); \ msg__->profile = (profile__); @@ -568,7 +568,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeProfileSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiNmeProfileSetCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileSetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeProfileSetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_SET_CFM, dst__, src__); \ msg__->status = (status__); @@ -603,7 +603,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeProfileUpdateIndCreate(msg__, dst__, src__, interfaceTag__, profile__) \ - msg__ = (CsrWifiNmeProfileUpdateInd *) CsrPmemAlloc(sizeof(CsrWifiNmeProfileUpdateInd)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeProfileUpdateInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_UPDATE_IND, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->profile = (profile__); @@ -642,7 +642,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeSimGsmAuthIndCreate(msg__, dst__, src__, randsLength__, rands__) \ - msg__ = (CsrWifiNmeSimGsmAuthInd *) CsrPmemAlloc(sizeof(CsrWifiNmeSimGsmAuthInd)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeSimGsmAuthInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_GSM_AUTH_IND, dst__, src__); \ msg__->randsLength = (randsLength__); \ msg__->rands = (rands__); @@ -682,7 +682,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeSimGsmAuthResCreate(msg__, dst__, src__, status__, kcsLength__, kcs__, sresLength__, sres__) \ - msg__ = (CsrWifiNmeSimGsmAuthRes *) CsrPmemAlloc(sizeof(CsrWifiNmeSimGsmAuthRes)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeSimGsmAuthRes), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_GSM_AUTH_RES, dst__, src__); \ msg__->status = (status__); \ msg__->kcsLength = (kcsLength__); \ @@ -719,7 +719,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeSimImsiGetIndCreate(msg__, dst__, src__) \ - msg__ = (CsrWifiNmeSimImsiGetInd *) CsrPmemAlloc(sizeof(CsrWifiNmeSimImsiGetInd)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeSimImsiGetInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_IMSI_GET_IND, dst__, src__); #define CsrWifiNmeSimImsiGetIndSendTo(dst__, src__) \ @@ -748,7 +748,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeSimImsiGetResCreate(msg__, dst__, src__, status__, imsi__, cardType__) \ - msg__ = (CsrWifiNmeSimImsiGetRes *) CsrPmemAlloc(sizeof(CsrWifiNmeSimImsiGetRes)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeSimImsiGetRes), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_IMSI_GET_RES, dst__, src__); \ msg__->status = (status__); \ msg__->imsi = (imsi__); \ @@ -787,7 +787,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeSimUmtsAuthIndCreate(msg__, dst__, src__, rand__, autn__) \ - msg__ = (CsrWifiNmeSimUmtsAuthInd *) CsrPmemAlloc(sizeof(CsrWifiNmeSimUmtsAuthInd)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeSimUmtsAuthInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_UMTS_AUTH_IND, dst__, src__); \ memcpy(msg__->rand, (rand__), sizeof(u8) * 16); \ memcpy(msg__->autn, (autn__), sizeof(u8) * 16); @@ -834,7 +834,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeSimUmtsAuthResCreate(msg__, dst__, src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__) \ - msg__ = (CsrWifiNmeSimUmtsAuthRes *) CsrPmemAlloc(sizeof(CsrWifiNmeSimUmtsAuthRes)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeSimUmtsAuthRes), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_UMTS_AUTH_RES, dst__, src__); \ msg__->status = (status__); \ msg__->result = (result__); \ @@ -870,7 +870,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeWpsCancelReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = (CsrWifiNmeWpsCancelReq *) CsrPmemAlloc(sizeof(CsrWifiNmeWpsCancelReq)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeWpsCancelReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CANCEL_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); @@ -899,7 +899,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeWpsCancelCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = (CsrWifiNmeWpsCancelCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeWpsCancelCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeWpsCancelCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CANCEL_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); @@ -935,7 +935,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeWpsCfmCreate(msg__, dst__, src__, interfaceTag__, status__, profile__) \ - msg__ = (CsrWifiNmeWpsCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeWpsCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeWpsCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -966,7 +966,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeWpsConfigSetReqCreate(msg__, dst__, src__, wpsConfig__) \ - msg__ = (CsrWifiNmeWpsConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiNmeWpsConfigSetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeWpsConfigSetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CONFIG_SET_REQ, dst__, src__); \ msg__->wpsConfig = (wpsConfig__); @@ -994,7 +994,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeWpsConfigSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiNmeWpsConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeWpsConfigSetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeWpsConfigSetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CONFIG_SET_CFM, dst__, src__); \ msg__->status = (status__); @@ -1030,7 +1030,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeWpsReqCreate(msg__, dst__, src__, interfaceTag__, pin__, ssid__, bssid__) \ - msg__ = (CsrWifiNmeWpsReq *) CsrPmemAlloc(sizeof(CsrWifiNmeWpsReq)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeWpsReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ memcpy(msg__->pin, (pin__), sizeof(u8) * 8); \ diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_lib.h b/drivers/staging/csr/csr_wifi_router_ctrl_lib.h index fd21467..ba8e983 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_lib.h +++ b/drivers/staging/csr/csr_wifi_router_ctrl_lib.h @@ -101,7 +101,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlBlockAckDisableReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__) \ - msg__ = (CsrWifiRouterCtrlBlockAckDisableReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckDisableReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckDisableReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->clientData = (clientData__); \ @@ -134,7 +134,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlBlockAckDisableCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \ - msg__ = (CsrWifiRouterCtrlBlockAckDisableCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckDisableCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckDisableCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_CFM, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->interfaceTag = (interfaceTag__); \ @@ -170,7 +170,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlBlockAckEnableReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__, bufferSize__, timeout__, ssn__) \ - msg__ = (CsrWifiRouterCtrlBlockAckEnableReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckEnableReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckEnableReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->clientData = (clientData__); \ @@ -206,7 +206,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlBlockAckEnableCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \ - msg__ = (CsrWifiRouterCtrlBlockAckEnableCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckEnableCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckEnableCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_CFM, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->interfaceTag = (interfaceTag__); \ @@ -239,7 +239,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlBlockAckErrorIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, trafficStreamID__, peerMacAddress__, status__) \ - msg__ = (CsrWifiRouterCtrlBlockAckErrorInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckErrorInd)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckErrorInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ERROR_IND, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->interfaceTag = (interfaceTag__); \ @@ -270,7 +270,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlCapabilitiesReqCreate(msg__, dst__, src__, clientData__) \ - msg__ = (CsrWifiRouterCtrlCapabilitiesReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlCapabilitiesReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlCapabilitiesReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_CAPABILITIES_REQ, dst__, src__); \ msg__->clientData = (clientData__); @@ -301,7 +301,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlCapabilitiesCfmCreate(msg__, dst__, src__, clientData__, commandQueueSize__, trafficQueueSize__) \ - msg__ = (CsrWifiRouterCtrlCapabilitiesCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlCapabilitiesCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlCapabilitiesCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_CAPABILITIES_CFM, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->commandQueueSize = (commandQueueSize__); \ @@ -332,7 +332,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlConfigurePowerModeReqCreate(msg__, dst__, src__, clientData__, mode__, wakeHost__) \ - msg__ = (CsrWifiRouterCtrlConfigurePowerModeReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlConfigurePowerModeReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlConfigurePowerModeReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_CONFIGURE_POWER_MODE_REQ, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->mode = (mode__); \ @@ -364,7 +364,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlConnectedIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, peerStatus__) \ - msg__ = (CsrWifiRouterCtrlConnectedInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlConnectedInd)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlConnectedInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_CONNECTED_IND, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->interfaceTag = (interfaceTag__); \ @@ -400,7 +400,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlHipReqCreate(msg__, dst__, src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) \ - msg__ = (CsrWifiRouterCtrlHipReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlHipReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlHipReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_HIP_REQ, dst__, src__); \ msg__->mlmeCommandLength = (mlmeCommandLength__); \ msg__->mlmeCommand = (mlmeCommand__); \ @@ -438,7 +438,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlHipIndCreate(msg__, dst__, src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) \ - msg__ = (CsrWifiRouterCtrlHipInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlHipInd)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlHipInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_HIP_IND, dst__, src__); \ msg__->mlmeCommandLength = (mlmeCommandLength__); \ msg__->mlmeCommand = (mlmeCommand__); \ @@ -472,7 +472,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlM4ReadyToSendIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__) \ - msg__ = (CsrWifiRouterCtrlM4ReadyToSendInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlM4ReadyToSendInd)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlM4ReadyToSendInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_M4_READY_TO_SEND_IND, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->interfaceTag = (interfaceTag__); \ @@ -502,7 +502,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlM4TransmitReqCreate(msg__, dst__, src__, interfaceTag__, clientData__) \ - msg__ = (CsrWifiRouterCtrlM4TransmitReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlM4TransmitReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlM4TransmitReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_M4_TRANSMIT_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->clientData = (clientData__); @@ -533,7 +533,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlM4TransmittedIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, status__) \ - msg__ = (CsrWifiRouterCtrlM4TransmittedInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlM4TransmittedInd)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlM4TransmittedInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_M4_TRANSMITTED_IND, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->interfaceTag = (interfaceTag__); \ @@ -565,7 +565,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlMediaStatusReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, mediaStatus__) \ - msg__ = (CsrWifiRouterCtrlMediaStatusReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMediaStatusReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlMediaStatusReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->clientData = (clientData__); \ @@ -597,7 +597,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlMicFailureIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, unicastPdu__) \ - msg__ = (CsrWifiRouterCtrlMicFailureInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMicFailureInd)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlMicFailureInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MIC_FAILURE_IND, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->interfaceTag = (interfaceTag__); \ @@ -638,7 +638,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlModeSetReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, mode__, bssid__, protection__, intraBssDistEnabled__) \ - msg__ = (CsrWifiRouterCtrlModeSetReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlModeSetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlModeSetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MODE_SET_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->clientData = (clientData__); \ @@ -673,7 +673,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlModeSetCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, mode__, status__) \ - msg__ = (CsrWifiRouterCtrlModeSetCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlModeSetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlModeSetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MODE_SET_CFM, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->interfaceTag = (interfaceTag__); \ @@ -707,7 +707,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlMulticastAddressIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, action__, setAddressesCount__, setAddresses__) \ - msg__ = (CsrWifiRouterCtrlMulticastAddressInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMulticastAddressInd)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlMulticastAddressInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_IND, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->interfaceTag = (interfaceTag__); \ @@ -742,7 +742,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlMulticastAddressResCreate(msg__, dst__, src__, interfaceTag__, clientData__, status__, action__, getAddressesCount__, getAddresses__) \ - msg__ = (CsrWifiRouterCtrlMulticastAddressRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMulticastAddressRes)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlMulticastAddressRes), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_RES, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->clientData = (clientData__); \ @@ -778,7 +778,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlPeerAddReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, peerMacAddress__, associationId__, staInfo__) \ - msg__ = (CsrWifiRouterCtrlPeerAddReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerAddReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPeerAddReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_ADD_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->clientData = (clientData__); \ @@ -813,7 +813,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlPeerAddCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, peerRecordHandle__, status__) \ - msg__ = (CsrWifiRouterCtrlPeerAddCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerAddCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPeerAddCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_ADD_CFM, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->interfaceTag = (interfaceTag__); \ @@ -846,7 +846,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlPeerDelReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, peerRecordHandle__) \ - msg__ = (CsrWifiRouterCtrlPeerDelReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerDelReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPeerDelReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_DEL_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->clientData = (clientData__); \ @@ -877,7 +877,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlPeerDelCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \ - msg__ = (CsrWifiRouterCtrlPeerDelCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerDelCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPeerDelCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_DEL_CFM, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->interfaceTag = (interfaceTag__); \ @@ -909,7 +909,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlPeerUpdateReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, peerRecordHandle__, powersaveMode__) \ - msg__ = (CsrWifiRouterCtrlPeerUpdateReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerUpdateReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPeerUpdateReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_UPDATE_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->clientData = (clientData__); \ @@ -941,7 +941,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlPeerUpdateCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \ - msg__ = (CsrWifiRouterCtrlPeerUpdateCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerUpdateCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPeerUpdateCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_UPDATE_CFM, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->interfaceTag = (interfaceTag__); \ @@ -975,7 +975,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlPortConfigureReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, uncontrolledPortAction__, controlledPortAction__, macAddress__, setProtection__) \ - msg__ = (CsrWifiRouterCtrlPortConfigureReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPortConfigureReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPortConfigureReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PORT_CONFIGURE_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->clientData = (clientData__); \ @@ -1010,7 +1010,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlPortConfigureCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__, macAddress__) \ - msg__ = (CsrWifiRouterCtrlPortConfigureCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPortConfigureCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPortConfigureCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PORT_CONFIGURE_CFM, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->interfaceTag = (interfaceTag__); \ @@ -1043,7 +1043,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlQosControlReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, control__, queueConfig__) \ - msg__ = (CsrWifiRouterCtrlQosControlReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlQosControlReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlQosControlReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->clientData = (clientData__); \ @@ -1073,7 +1073,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlRawSdioDeinitialiseReqCreate(msg__, dst__, src__, clientData__) \ - msg__ = (CsrWifiRouterCtrlRawSdioDeinitialiseReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlRawSdioDeinitialiseReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlRawSdioDeinitialiseReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RAW_SDIO_DEINITIALISE_REQ, dst__, src__); \ msg__->clientData = (clientData__); @@ -1101,7 +1101,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlRawSdioDeinitialiseCfmCreate(msg__, dst__, src__, clientData__, result__) \ - msg__ = (CsrWifiRouterCtrlRawSdioDeinitialiseCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlRawSdioDeinitialiseCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlRawSdioDeinitialiseCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RAW_SDIO_DEINITIALISE_CFM, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->result = (result__); @@ -1129,7 +1129,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlRawSdioInitialiseReqCreate(msg__, dst__, src__, clientData__) \ - msg__ = (CsrWifiRouterCtrlRawSdioInitialiseReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlRawSdioInitialiseReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlRawSdioInitialiseReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RAW_SDIO_INITIALISE_REQ, dst__, src__); \ msg__->clientData = (clientData__); @@ -1165,7 +1165,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlRawSdioInitialiseCfmCreate(msg__, dst__, src__, clientData__, result__, byteRead__, byteWrite__, firmwareDownload__, reset__, coreDumpPrepare__, byteBlockRead__, gpRead16__, gpWrite16__) \ - msg__ = (CsrWifiRouterCtrlRawSdioInitialiseCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlRawSdioInitialiseCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlRawSdioInitialiseCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RAW_SDIO_INITIALISE_CFM, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->result = (result__); \ @@ -1202,7 +1202,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlResumeIndCreate(msg__, dst__, src__, clientData__, powerMaintained__) \ - msg__ = (CsrWifiRouterCtrlResumeInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlResumeInd)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlResumeInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RESUME_IND, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->powerMaintained = (powerMaintained__); @@ -1230,7 +1230,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlResumeResCreate(msg__, dst__, src__, clientData__, status__) \ - msg__ = (CsrWifiRouterCtrlResumeRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlResumeRes)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlResumeRes), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RESUME_RES, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->status = (status__); @@ -1260,7 +1260,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlStaInactiveIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, staAddress__) \ - msg__ = (CsrWifiRouterCtrlStaInactiveInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlStaInactiveInd)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlStaInactiveInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_STA_INACTIVE_IND, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->interfaceTag = (interfaceTag__); \ @@ -1291,7 +1291,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlSuspendIndCreate(msg__, dst__, src__, clientData__, hardSuspend__, d3Suspend__) \ - msg__ = (CsrWifiRouterCtrlSuspendInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlSuspendInd)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlSuspendInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_SUSPEND_IND, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->hardSuspend = (hardSuspend__); \ @@ -1320,7 +1320,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlSuspendResCreate(msg__, dst__, src__, clientData__, status__) \ - msg__ = (CsrWifiRouterCtrlSuspendRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlSuspendRes)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlSuspendRes), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_SUSPEND_RES, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->status = (status__); @@ -1351,7 +1351,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlTclasAddReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, tclasLength__, tclas__) \ - msg__ = (CsrWifiRouterCtrlTclasAddReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasAddReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTclasAddReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->clientData = (clientData__); \ @@ -1383,7 +1383,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlTclasAddCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \ - msg__ = (CsrWifiRouterCtrlTclasAddCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasAddCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTclasAddCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_CFM, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->interfaceTag = (interfaceTag__); \ @@ -1415,7 +1415,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlTclasDelReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, tclasLength__, tclas__) \ - msg__ = (CsrWifiRouterCtrlTclasDelReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasDelReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTclasDelReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->clientData = (clientData__); \ @@ -1447,7 +1447,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlTclasDelCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \ - msg__ = (CsrWifiRouterCtrlTclasDelCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasDelCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTclasDelCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_CFM, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->interfaceTag = (interfaceTag__); \ @@ -1479,7 +1479,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlTrafficClassificationReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, trafficType__, period__) \ - msg__ = (CsrWifiRouterCtrlTrafficClassificationReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficClassificationReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTrafficClassificationReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TRAFFIC_CLASSIFICATION_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->clientData = (clientData__); \ @@ -1512,7 +1512,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlTrafficConfigReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, trafficConfigType__, config__) \ - msg__ = (CsrWifiRouterCtrlTrafficConfigReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficConfigReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTrafficConfigReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->clientData = (clientData__); \ @@ -1546,7 +1546,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlTrafficProtocolIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, packetType__, direction__, srcAddress__) \ - msg__ = (CsrWifiRouterCtrlTrafficProtocolInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficProtocolInd)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTrafficProtocolInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TRAFFIC_PROTOCOL_IND, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->interfaceTag = (interfaceTag__); \ @@ -1579,7 +1579,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlTrafficSampleIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, stats__) \ - msg__ = (CsrWifiRouterCtrlTrafficSampleInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficSampleInd)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTrafficSampleInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TRAFFIC_SAMPLE_IND, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->interfaceTag = (interfaceTag__); \ @@ -1610,7 +1610,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlUnexpectedFrameIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__) \ - msg__ = (CsrWifiRouterCtrlUnexpectedFrameInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlUnexpectedFrameInd)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlUnexpectedFrameInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_UNEXPECTED_FRAME_IND, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->interfaceTag = (interfaceTag__); \ @@ -1640,7 +1640,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlWapiFilterReqCreate(msg__, dst__, src__, interfaceTag__, isWapiConnected__) \ - msg__ = (CsrWifiRouterCtrlWapiFilterReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiFilterReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWapiFilterReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_FILTER_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->isWapiConnected = (isWapiConnected__); @@ -1669,7 +1669,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlWapiMulticastFilterReqCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = (CsrWifiRouterCtrlWapiMulticastFilterReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiMulticastFilterReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWapiMulticastFilterReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_FILTER_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); @@ -1702,7 +1702,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlWapiRxMicCheckIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \ - msg__ = (CsrWifiRouterCtrlWapiRxMicCheckInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiRxMicCheckInd)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWapiRxMicCheckInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_RX_MIC_CHECK_IND, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->interfaceTag = (interfaceTag__); \ @@ -1738,7 +1738,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlWapiRxPktReqCreate(msg__, dst__, src__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \ - msg__ = (CsrWifiRouterCtrlWapiRxPktReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiRxPktReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWapiRxPktReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_RX_PKT_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->signalLength = (signalLength__); \ @@ -1770,7 +1770,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlWapiUnicastFilterReqCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = (CsrWifiRouterCtrlWapiUnicastFilterReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiUnicastFilterReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWapiUnicastFilterReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_FILTER_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); @@ -1801,7 +1801,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlWapiUnicastTxEncryptIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, dataLength__, data__) \ - msg__ = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxEncryptInd)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxEncryptInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_ENCRYPT_IND, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->interfaceTag = (interfaceTag__); \ @@ -1833,7 +1833,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlWapiUnicastTxPktReqCreate(msg__, dst__, src__, interfaceTag__, dataLength__, data__) \ - msg__ = (CsrWifiRouterCtrlWapiUnicastTxPktReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxPktReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxPktReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_PKT_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->dataLength = (dataLength__); \ @@ -1862,7 +1862,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlWifiOffReqCreate(msg__, dst__, src__, clientData__) \ - msg__ = (CsrWifiRouterCtrlWifiOffReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOffReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOffReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_OFF_REQ, dst__, src__); \ msg__->clientData = (clientData__); @@ -1890,7 +1890,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlWifiOffIndCreate(msg__, dst__, src__, clientData__, controlIndication__) \ - msg__ = (CsrWifiRouterCtrlWifiOffInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOffInd)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOffInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_OFF_IND, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->controlIndication = (controlIndication__); @@ -1917,7 +1917,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlWifiOffResCreate(msg__, dst__, src__, clientData__) \ - msg__ = (CsrWifiRouterCtrlWifiOffRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOffRes)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOffRes), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_OFF_RES, dst__, src__); \ msg__->clientData = (clientData__); @@ -1944,7 +1944,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlWifiOffCfmCreate(msg__, dst__, src__, clientData__) \ - msg__ = (CsrWifiRouterCtrlWifiOffCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOffCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOffCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_OFF_CFM, dst__, src__); \ msg__->clientData = (clientData__); @@ -1973,7 +1973,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlWifiOnReqCreate(msg__, dst__, src__, clientData__, dataLength__, data__) \ - msg__ = (CsrWifiRouterCtrlWifiOnReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_ON_REQ, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->dataLength = (dataLength__); \ @@ -2004,7 +2004,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlWifiOnIndCreate(msg__, dst__, src__, clientData__, status__, versions__) \ - msg__ = (CsrWifiRouterCtrlWifiOnInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnInd)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_ON_IND, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->status = (status__); \ @@ -2037,7 +2037,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlWifiOnResCreate(msg__, dst__, src__, clientData__, status__, numInterfaceAddress__, stationMacAddress__, smeVersions__, scheduledInterrupt__) \ - msg__ = (CsrWifiRouterCtrlWifiOnRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnRes)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnRes), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_ON_RES, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->status = (status__); \ @@ -2070,7 +2070,7 @@ extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRI *******************************************************************************/ #define CsrWifiRouterCtrlWifiOnCfmCreate(msg__, dst__, src__, clientData__, status__) \ - msg__ = (CsrWifiRouterCtrlWifiOnCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_ON_CFM, dst__, src__); \ msg__->clientData = (clientData__); \ msg__->status = (status__); diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c index 7340f58..e4b7ec9 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c @@ -51,7 +51,7 @@ u8* CsrWifiRouterCtrlConfigurePowerModeReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlConfigurePowerModeReqDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlConfigurePowerModeReq *primitive = (CsrWifiRouterCtrlConfigurePowerModeReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlConfigurePowerModeReq)); + CsrWifiRouterCtrlConfigurePowerModeReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlConfigurePowerModeReq), GFP_KERNEL); size_t offset; offset = 0; @@ -106,7 +106,7 @@ u8* CsrWifiRouterCtrlHipReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlHipReqDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlHipReq *primitive = (CsrWifiRouterCtrlHipReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlHipReq)); + CsrWifiRouterCtrlHipReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlHipReq), GFP_KERNEL); size_t offset; offset = 0; @@ -114,7 +114,7 @@ void* CsrWifiRouterCtrlHipReqDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->mlmeCommandLength, buffer, &offset); if (primitive->mlmeCommandLength) { - primitive->mlmeCommand = (u8 *)CsrPmemAlloc(primitive->mlmeCommandLength); + primitive->mlmeCommand = kmalloc(primitive->mlmeCommandLength, GFP_KERNEL); CsrMemCpyDes(primitive->mlmeCommand, buffer, &offset, ((u16) (primitive->mlmeCommandLength))); } else @@ -124,7 +124,7 @@ void* CsrWifiRouterCtrlHipReqDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->dataRef1Length, buffer, &offset); if (primitive->dataRef1Length) { - primitive->dataRef1 = (u8 *)CsrPmemAlloc(primitive->dataRef1Length); + primitive->dataRef1 = kmalloc(primitive->dataRef1Length, GFP_KERNEL); CsrMemCpyDes(primitive->dataRef1, buffer, &offset, ((u16) (primitive->dataRef1Length))); } else @@ -134,7 +134,7 @@ void* CsrWifiRouterCtrlHipReqDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->dataRef2Length, buffer, &offset); if (primitive->dataRef2Length) { - primitive->dataRef2 = (u8 *)CsrPmemAlloc(primitive->dataRef2Length); + primitive->dataRef2 = kmalloc(primitive->dataRef2Length, GFP_KERNEL); CsrMemCpyDes(primitive->dataRef2, buffer, &offset, ((u16) (primitive->dataRef2Length))); } else @@ -182,7 +182,7 @@ u8* CsrWifiRouterCtrlMediaStatusReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlMediaStatusReqDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlMediaStatusReq *primitive = (CsrWifiRouterCtrlMediaStatusReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMediaStatusReq)); + CsrWifiRouterCtrlMediaStatusReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlMediaStatusReq), GFP_KERNEL); size_t offset; offset = 0; @@ -240,7 +240,7 @@ u8* CsrWifiRouterCtrlMulticastAddressResSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlMulticastAddressResDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlMulticastAddressRes *primitive = (CsrWifiRouterCtrlMulticastAddressRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMulticastAddressRes)); + CsrWifiRouterCtrlMulticastAddressRes *primitive = kmalloc(sizeof(CsrWifiRouterCtrlMulticastAddressRes), GFP_KERNEL); size_t offset; offset = 0; @@ -253,7 +253,7 @@ void* CsrWifiRouterCtrlMulticastAddressResDes(u8 *buffer, size_t length) primitive->getAddresses = NULL; if (primitive->getAddressesCount) { - primitive->getAddresses = (CsrWifiMacAddress *)CsrPmemAlloc(sizeof(CsrWifiMacAddress) * primitive->getAddressesCount); + primitive->getAddresses = kmalloc(sizeof(CsrWifiMacAddress) * primitive->getAddressesCount, GFP_KERNEL); } { u16 i1; @@ -307,7 +307,7 @@ u8* CsrWifiRouterCtrlPortConfigureReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlPortConfigureReqDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlPortConfigureReq *primitive = (CsrWifiRouterCtrlPortConfigureReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPortConfigureReq)); + CsrWifiRouterCtrlPortConfigureReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPortConfigureReq), GFP_KERNEL); size_t offset; offset = 0; @@ -351,7 +351,7 @@ u8* CsrWifiRouterCtrlQosControlReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlQosControlReqDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlQosControlReq *primitive = (CsrWifiRouterCtrlQosControlReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlQosControlReq)); + CsrWifiRouterCtrlQosControlReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlQosControlReq), GFP_KERNEL); size_t offset; offset = 0; @@ -389,7 +389,7 @@ u8* CsrWifiRouterCtrlSuspendResSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlSuspendResDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlSuspendRes *primitive = (CsrWifiRouterCtrlSuspendRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlSuspendRes)); + CsrWifiRouterCtrlSuspendRes *primitive = kmalloc(sizeof(CsrWifiRouterCtrlSuspendRes), GFP_KERNEL); size_t offset; offset = 0; @@ -433,7 +433,7 @@ u8* CsrWifiRouterCtrlTclasAddReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlTclasAddReqDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlTclasAddReq *primitive = (CsrWifiRouterCtrlTclasAddReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasAddReq)); + CsrWifiRouterCtrlTclasAddReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTclasAddReq), GFP_KERNEL); size_t offset; offset = 0; @@ -443,7 +443,7 @@ void* CsrWifiRouterCtrlTclasAddReqDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->tclasLength, buffer, &offset); if (primitive->tclasLength) { - primitive->tclas = (u8 *)CsrPmemAlloc(primitive->tclasLength); + primitive->tclas = kmalloc(primitive->tclasLength, GFP_KERNEL); CsrMemCpyDes(primitive->tclas, buffer, &offset, ((u16) (primitive->tclasLength))); } else @@ -487,7 +487,7 @@ u8* CsrWifiRouterCtrlResumeResSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlResumeResDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlResumeRes *primitive = (CsrWifiRouterCtrlResumeRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlResumeRes)); + CsrWifiRouterCtrlResumeRes *primitive = kmalloc(sizeof(CsrWifiRouterCtrlResumeRes), GFP_KERNEL); size_t offset; offset = 0; @@ -531,7 +531,7 @@ u8* CsrWifiRouterCtrlTclasDelReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlTclasDelReqDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlTclasDelReq *primitive = (CsrWifiRouterCtrlTclasDelReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasDelReq)); + CsrWifiRouterCtrlTclasDelReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTclasDelReq), GFP_KERNEL); size_t offset; offset = 0; @@ -541,7 +541,7 @@ void* CsrWifiRouterCtrlTclasDelReqDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->tclasLength, buffer, &offset); if (primitive->tclasLength) { - primitive->tclas = (u8 *)CsrPmemAlloc(primitive->tclasLength); + primitive->tclas = kmalloc(primitive->tclasLength, GFP_KERNEL); CsrMemCpyDes(primitive->tclas, buffer, &offset, ((u16) (primitive->tclasLength))); } else @@ -589,7 +589,7 @@ u8* CsrWifiRouterCtrlTrafficClassificationReqSer(u8 *ptr, size_t *len, void *msg void* CsrWifiRouterCtrlTrafficClassificationReqDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlTrafficClassificationReq *primitive = (CsrWifiRouterCtrlTrafficClassificationReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficClassificationReq)); + CsrWifiRouterCtrlTrafficClassificationReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTrafficClassificationReq), GFP_KERNEL); size_t offset; offset = 0; @@ -639,7 +639,7 @@ u8* CsrWifiRouterCtrlTrafficConfigReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlTrafficConfigReqDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlTrafficConfigReq *primitive = (CsrWifiRouterCtrlTrafficConfigReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficConfigReq)); + CsrWifiRouterCtrlTrafficConfigReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTrafficConfigReq), GFP_KERNEL); size_t offset; offset = 0; @@ -687,7 +687,7 @@ u8* CsrWifiRouterCtrlWifiOnReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlWifiOnReqDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlWifiOnReq *primitive = (CsrWifiRouterCtrlWifiOnReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnReq)); + CsrWifiRouterCtrlWifiOnReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnReq), GFP_KERNEL); size_t offset; offset = 0; @@ -696,7 +696,7 @@ void* CsrWifiRouterCtrlWifiOnReqDes(u8 *buffer, size_t length) CsrUint32Des((u32 *) &primitive->dataLength, buffer, &offset); if (primitive->dataLength) { - primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); + primitive->data = kmalloc(primitive->dataLength, GFP_KERNEL); CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength))); } else @@ -765,7 +765,7 @@ u8* CsrWifiRouterCtrlWifiOnResSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlWifiOnResDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlWifiOnRes *primitive = (CsrWifiRouterCtrlWifiOnRes *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnRes)); + CsrWifiRouterCtrlWifiOnRes *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnRes), GFP_KERNEL); size_t offset; offset = 0; @@ -821,7 +821,7 @@ u8* CsrWifiRouterCtrlM4TransmitReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlM4TransmitReqDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlM4TransmitReq *primitive = (CsrWifiRouterCtrlM4TransmitReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlM4TransmitReq)); + CsrWifiRouterCtrlM4TransmitReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlM4TransmitReq), GFP_KERNEL); size_t offset; offset = 0; @@ -865,7 +865,7 @@ u8* CsrWifiRouterCtrlModeSetReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlModeSetReqDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlModeSetReq *primitive = (CsrWifiRouterCtrlModeSetReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlModeSetReq)); + CsrWifiRouterCtrlModeSetReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlModeSetReq), GFP_KERNEL); size_t offset; offset = 0; @@ -917,7 +917,7 @@ u8* CsrWifiRouterCtrlPeerAddReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlPeerAddReqDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlPeerAddReq *primitive = (CsrWifiRouterCtrlPeerAddReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerAddReq)); + CsrWifiRouterCtrlPeerAddReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPeerAddReq), GFP_KERNEL); size_t offset; offset = 0; @@ -961,7 +961,7 @@ u8* CsrWifiRouterCtrlPeerDelReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlPeerDelReqDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlPeerDelReq *primitive = (CsrWifiRouterCtrlPeerDelReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerDelReq)); + CsrWifiRouterCtrlPeerDelReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPeerDelReq), GFP_KERNEL); size_t offset; offset = 0; @@ -1002,7 +1002,7 @@ u8* CsrWifiRouterCtrlPeerUpdateReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlPeerUpdateReqDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlPeerUpdateReq *primitive = (CsrWifiRouterCtrlPeerUpdateReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerUpdateReq)); + CsrWifiRouterCtrlPeerUpdateReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPeerUpdateReq), GFP_KERNEL); size_t offset; offset = 0; @@ -1052,7 +1052,7 @@ u8* CsrWifiRouterCtrlBlockAckEnableReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlBlockAckEnableReqDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlBlockAckEnableReq *primitive = (CsrWifiRouterCtrlBlockAckEnableReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckEnableReq)); + CsrWifiRouterCtrlBlockAckEnableReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckEnableReq), GFP_KERNEL); size_t offset; offset = 0; @@ -1100,7 +1100,7 @@ u8* CsrWifiRouterCtrlBlockAckDisableReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlBlockAckDisableReqDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlBlockAckDisableReq *primitive = (CsrWifiRouterCtrlBlockAckDisableReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckDisableReq)); + CsrWifiRouterCtrlBlockAckDisableReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckDisableReq), GFP_KERNEL); size_t offset; offset = 0; @@ -1152,7 +1152,7 @@ u8* CsrWifiRouterCtrlWapiRxPktReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlWapiRxPktReqDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlWapiRxPktReq *primitive = (CsrWifiRouterCtrlWapiRxPktReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiRxPktReq)); + CsrWifiRouterCtrlWapiRxPktReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWapiRxPktReq), GFP_KERNEL); size_t offset; offset = 0; @@ -1161,7 +1161,7 @@ void* CsrWifiRouterCtrlWapiRxPktReqDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->signalLength, buffer, &offset); if (primitive->signalLength) { - primitive->signal = (u8 *)CsrPmemAlloc(primitive->signalLength); + primitive->signal = kmalloc(primitive->signalLength, GFP_KERNEL); CsrMemCpyDes(primitive->signal, buffer, &offset, ((u16) (primitive->signalLength))); } else @@ -1171,7 +1171,7 @@ void* CsrWifiRouterCtrlWapiRxPktReqDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->dataLength, buffer, &offset); if (primitive->dataLength) { - primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); + primitive->data = kmalloc(primitive->dataLength, GFP_KERNEL); CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength))); } else @@ -1222,7 +1222,7 @@ u8* CsrWifiRouterCtrlWapiUnicastTxPktReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlWapiUnicastTxPktReqDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlWapiUnicastTxPktReq *primitive = (CsrWifiRouterCtrlWapiUnicastTxPktReq *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxPktReq)); + CsrWifiRouterCtrlWapiUnicastTxPktReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxPktReq), GFP_KERNEL); size_t offset; offset = 0; @@ -1231,7 +1231,7 @@ void* CsrWifiRouterCtrlWapiUnicastTxPktReqDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->dataLength, buffer, &offset); if (primitive->dataLength) { - primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); + primitive->data = kmalloc(primitive->dataLength, GFP_KERNEL); CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength))); } else @@ -1293,7 +1293,7 @@ u8* CsrWifiRouterCtrlHipIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlHipIndDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlHipInd *primitive = (CsrWifiRouterCtrlHipInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlHipInd)); + CsrWifiRouterCtrlHipInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlHipInd), GFP_KERNEL); size_t offset; offset = 0; @@ -1301,7 +1301,7 @@ void* CsrWifiRouterCtrlHipIndDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->mlmeCommandLength, buffer, &offset); if (primitive->mlmeCommandLength) { - primitive->mlmeCommand = (u8 *)CsrPmemAlloc(primitive->mlmeCommandLength); + primitive->mlmeCommand = kmalloc(primitive->mlmeCommandLength, GFP_KERNEL); CsrMemCpyDes(primitive->mlmeCommand, buffer, &offset, ((u16) (primitive->mlmeCommandLength))); } else @@ -1311,7 +1311,7 @@ void* CsrWifiRouterCtrlHipIndDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->dataRef1Length, buffer, &offset); if (primitive->dataRef1Length) { - primitive->dataRef1 = (u8 *)CsrPmemAlloc(primitive->dataRef1Length); + primitive->dataRef1 = kmalloc(primitive->dataRef1Length, GFP_KERNEL); CsrMemCpyDes(primitive->dataRef1, buffer, &offset, ((u16) (primitive->dataRef1Length))); } else @@ -1321,7 +1321,7 @@ void* CsrWifiRouterCtrlHipIndDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->dataRef2Length, buffer, &offset); if (primitive->dataRef2Length) { - primitive->dataRef2 = (u8 *)CsrPmemAlloc(primitive->dataRef2Length); + primitive->dataRef2 = kmalloc(primitive->dataRef2Length, GFP_KERNEL); CsrMemCpyDes(primitive->dataRef2, buffer, &offset, ((u16) (primitive->dataRef2Length))); } else @@ -1386,7 +1386,7 @@ u8* CsrWifiRouterCtrlMulticastAddressIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlMulticastAddressIndDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlMulticastAddressInd *primitive = (CsrWifiRouterCtrlMulticastAddressInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMulticastAddressInd)); + CsrWifiRouterCtrlMulticastAddressInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlMulticastAddressInd), GFP_KERNEL); size_t offset; offset = 0; @@ -1398,7 +1398,7 @@ void* CsrWifiRouterCtrlMulticastAddressIndDes(u8 *buffer, size_t length) primitive->setAddresses = NULL; if (primitive->setAddressesCount) { - primitive->setAddresses = (CsrWifiMacAddress *)CsrPmemAlloc(sizeof(CsrWifiMacAddress) * primitive->setAddressesCount); + primitive->setAddresses = kmalloc(sizeof(CsrWifiMacAddress) * primitive->setAddressesCount, GFP_KERNEL); } { u16 i1; @@ -1448,7 +1448,7 @@ u8* CsrWifiRouterCtrlPortConfigureCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlPortConfigureCfmDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlPortConfigureCfm *primitive = (CsrWifiRouterCtrlPortConfigureCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPortConfigureCfm)); + CsrWifiRouterCtrlPortConfigureCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPortConfigureCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -1488,7 +1488,7 @@ u8* CsrWifiRouterCtrlSuspendIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlSuspendIndDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlSuspendInd *primitive = (CsrWifiRouterCtrlSuspendInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlSuspendInd)); + CsrWifiRouterCtrlSuspendInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlSuspendInd), GFP_KERNEL); size_t offset; offset = 0; @@ -1527,7 +1527,7 @@ u8* CsrWifiRouterCtrlTclasAddCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlTclasAddCfmDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlTclasAddCfm *primitive = (CsrWifiRouterCtrlTclasAddCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasAddCfm)); + CsrWifiRouterCtrlTclasAddCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTclasAddCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -1564,7 +1564,7 @@ u8* CsrWifiRouterCtrlRawSdioDeinitialiseCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlRawSdioDeinitialiseCfmDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlRawSdioDeinitialiseCfm *primitive = (CsrWifiRouterCtrlRawSdioDeinitialiseCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlRawSdioDeinitialiseCfm)); + CsrWifiRouterCtrlRawSdioDeinitialiseCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlRawSdioDeinitialiseCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -1616,7 +1616,7 @@ u8* CsrWifiRouterCtrlRawSdioInitialiseCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlRawSdioInitialiseCfmDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlRawSdioInitialiseCfm *primitive = (CsrWifiRouterCtrlRawSdioInitialiseCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlRawSdioInitialiseCfm)); + CsrWifiRouterCtrlRawSdioInitialiseCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlRawSdioInitialiseCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -1670,7 +1670,7 @@ u8* CsrWifiRouterCtrlTclasDelCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlTclasDelCfmDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlTclasDelCfm *primitive = (CsrWifiRouterCtrlTclasDelCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTclasDelCfm)); + CsrWifiRouterCtrlTclasDelCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTclasDelCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -1713,7 +1713,7 @@ u8* CsrWifiRouterCtrlTrafficProtocolIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlTrafficProtocolIndDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlTrafficProtocolInd *primitive = (CsrWifiRouterCtrlTrafficProtocolInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficProtocolInd)); + CsrWifiRouterCtrlTrafficProtocolInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTrafficProtocolInd), GFP_KERNEL); size_t offset; offset = 0; @@ -1764,7 +1764,7 @@ u8* CsrWifiRouterCtrlTrafficSampleIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlTrafficSampleIndDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlTrafficSampleInd *primitive = (CsrWifiRouterCtrlTrafficSampleInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlTrafficSampleInd)); + CsrWifiRouterCtrlTrafficSampleInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTrafficSampleInd), GFP_KERNEL); size_t offset; offset = 0; @@ -1819,7 +1819,7 @@ u8* CsrWifiRouterCtrlWifiOnIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlWifiOnIndDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlWifiOnInd *primitive = (CsrWifiRouterCtrlWifiOnInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnInd)); + CsrWifiRouterCtrlWifiOnInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnInd), GFP_KERNEL); size_t offset; offset = 0; @@ -1869,7 +1869,7 @@ u8* CsrWifiRouterCtrlWifiOnCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlWifiOnCfmDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlWifiOnCfm *primitive = (CsrWifiRouterCtrlWifiOnCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWifiOnCfm)); + CsrWifiRouterCtrlWifiOnCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -1907,7 +1907,7 @@ u8* CsrWifiRouterCtrlM4ReadyToSendIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlM4ReadyToSendIndDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlM4ReadyToSendInd *primitive = (CsrWifiRouterCtrlM4ReadyToSendInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlM4ReadyToSendInd)); + CsrWifiRouterCtrlM4ReadyToSendInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlM4ReadyToSendInd), GFP_KERNEL); size_t offset; offset = 0; @@ -1948,7 +1948,7 @@ u8* CsrWifiRouterCtrlM4TransmittedIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlM4TransmittedIndDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlM4TransmittedInd *primitive = (CsrWifiRouterCtrlM4TransmittedInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlM4TransmittedInd)); + CsrWifiRouterCtrlM4TransmittedInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlM4TransmittedInd), GFP_KERNEL); size_t offset; offset = 0; @@ -1990,7 +1990,7 @@ u8* CsrWifiRouterCtrlMicFailureIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlMicFailureIndDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlMicFailureInd *primitive = (CsrWifiRouterCtrlMicFailureInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlMicFailureInd)); + CsrWifiRouterCtrlMicFailureInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlMicFailureInd), GFP_KERNEL); size_t offset; offset = 0; @@ -2032,7 +2032,7 @@ u8* CsrWifiRouterCtrlConnectedIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlConnectedIndDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlConnectedInd *primitive = (CsrWifiRouterCtrlConnectedInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlConnectedInd)); + CsrWifiRouterCtrlConnectedInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlConnectedInd), GFP_KERNEL); size_t offset; offset = 0; @@ -2076,7 +2076,7 @@ u8* CsrWifiRouterCtrlPeerAddCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlPeerAddCfmDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlPeerAddCfm *primitive = (CsrWifiRouterCtrlPeerAddCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerAddCfm)); + CsrWifiRouterCtrlPeerAddCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPeerAddCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -2117,7 +2117,7 @@ u8* CsrWifiRouterCtrlPeerDelCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlPeerDelCfmDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlPeerDelCfm *primitive = (CsrWifiRouterCtrlPeerDelCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerDelCfm)); + CsrWifiRouterCtrlPeerDelCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPeerDelCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -2156,7 +2156,7 @@ u8* CsrWifiRouterCtrlUnexpectedFrameIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlUnexpectedFrameIndDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlUnexpectedFrameInd *primitive = (CsrWifiRouterCtrlUnexpectedFrameInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlUnexpectedFrameInd)); + CsrWifiRouterCtrlUnexpectedFrameInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlUnexpectedFrameInd), GFP_KERNEL); size_t offset; offset = 0; @@ -2195,7 +2195,7 @@ u8* CsrWifiRouterCtrlPeerUpdateCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlPeerUpdateCfmDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlPeerUpdateCfm *primitive = (CsrWifiRouterCtrlPeerUpdateCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlPeerUpdateCfm)); + CsrWifiRouterCtrlPeerUpdateCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPeerUpdateCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -2234,7 +2234,7 @@ u8* CsrWifiRouterCtrlCapabilitiesCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlCapabilitiesCfmDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlCapabilitiesCfm *primitive = (CsrWifiRouterCtrlCapabilitiesCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlCapabilitiesCfm)); + CsrWifiRouterCtrlCapabilitiesCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlCapabilitiesCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -2273,7 +2273,7 @@ u8* CsrWifiRouterCtrlBlockAckEnableCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlBlockAckEnableCfmDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlBlockAckEnableCfm *primitive = (CsrWifiRouterCtrlBlockAckEnableCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckEnableCfm)); + CsrWifiRouterCtrlBlockAckEnableCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckEnableCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -2312,7 +2312,7 @@ u8* CsrWifiRouterCtrlBlockAckDisableCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlBlockAckDisableCfmDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlBlockAckDisableCfm *primitive = (CsrWifiRouterCtrlBlockAckDisableCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckDisableCfm)); + CsrWifiRouterCtrlBlockAckDisableCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckDisableCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -2355,7 +2355,7 @@ u8* CsrWifiRouterCtrlBlockAckErrorIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlBlockAckErrorIndDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlBlockAckErrorInd *primitive = (CsrWifiRouterCtrlBlockAckErrorInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlBlockAckErrorInd)); + CsrWifiRouterCtrlBlockAckErrorInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckErrorInd), GFP_KERNEL); size_t offset; offset = 0; @@ -2396,7 +2396,7 @@ u8* CsrWifiRouterCtrlStaInactiveIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlStaInactiveIndDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlStaInactiveInd *primitive = (CsrWifiRouterCtrlStaInactiveInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlStaInactiveInd)); + CsrWifiRouterCtrlStaInactiveInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlStaInactiveInd), GFP_KERNEL); size_t offset; offset = 0; @@ -2448,7 +2448,7 @@ u8* CsrWifiRouterCtrlWapiRxMicCheckIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlWapiRxMicCheckIndDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlWapiRxMicCheckInd *primitive = (CsrWifiRouterCtrlWapiRxMicCheckInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiRxMicCheckInd)); + CsrWifiRouterCtrlWapiRxMicCheckInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWapiRxMicCheckInd), GFP_KERNEL); size_t offset; offset = 0; @@ -2458,7 +2458,7 @@ void* CsrWifiRouterCtrlWapiRxMicCheckIndDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->signalLength, buffer, &offset); if (primitive->signalLength) { - primitive->signal = (u8 *)CsrPmemAlloc(primitive->signalLength); + primitive->signal = kmalloc(primitive->signalLength, GFP_KERNEL); CsrMemCpyDes(primitive->signal, buffer, &offset, ((u16) (primitive->signalLength))); } else @@ -2468,7 +2468,7 @@ void* CsrWifiRouterCtrlWapiRxMicCheckIndDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->dataLength, buffer, &offset); if (primitive->dataLength) { - primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); + primitive->data = kmalloc(primitive->dataLength, GFP_KERNEL); CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength))); } else @@ -2517,7 +2517,7 @@ u8* CsrWifiRouterCtrlModeSetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlModeSetCfmDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlModeSetCfm *primitive = (CsrWifiRouterCtrlModeSetCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlModeSetCfm)); + CsrWifiRouterCtrlModeSetCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlModeSetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -2563,7 +2563,7 @@ u8* CsrWifiRouterCtrlWapiUnicastTxEncryptIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterCtrlWapiUnicastTxEncryptIndDes(u8 *buffer, size_t length) { - CsrWifiRouterCtrlWapiUnicastTxEncryptInd *primitive = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *) CsrPmemAlloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxEncryptInd)); + CsrWifiRouterCtrlWapiUnicastTxEncryptInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxEncryptInd), GFP_KERNEL); size_t offset; offset = 0; @@ -2573,7 +2573,7 @@ void* CsrWifiRouterCtrlWapiUnicastTxEncryptIndDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->dataLength, buffer, &offset); if (primitive->dataLength) { - primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); + primitive->data = kmalloc(primitive->dataLength, GFP_KERNEL); CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength))); } else diff --git a/drivers/staging/csr/csr_wifi_router_lib.h b/drivers/staging/csr/csr_wifi_router_lib.h index e5f1f63..f2f5196 100644 --- a/drivers/staging/csr/csr_wifi_router_lib.h +++ b/drivers/staging/csr/csr_wifi_router_lib.h @@ -99,7 +99,7 @@ extern const char *CsrWifiRouterDownstreamPrimNames[CSR_WIFI_ROUTER_PRIM_DOWNSTR *******************************************************************************/ #define CsrWifiRouterMaPacketCancelReqCreate(msg__, dst__, src__, interfaceTag__, hostTag__, priority__, peerMacAddress__) \ - msg__ = (CsrWifiRouterMaPacketCancelReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketCancelReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketCancelReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_CANCEL_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->hostTag = (hostTag__); \ @@ -149,7 +149,7 @@ extern const char *CsrWifiRouterDownstreamPrimNames[CSR_WIFI_ROUTER_PRIM_DOWNSTR *******************************************************************************/ #define CsrWifiRouterMaPacketReqCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, frameLength__, frame__, freeFunction__, priority__, hostTag__, cfmRequested__) \ - msg__ = (CsrWifiRouterMaPacketReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->subscriptionHandle = (subscriptionHandle__); \ @@ -193,7 +193,7 @@ extern const char *CsrWifiRouterDownstreamPrimNames[CSR_WIFI_ROUTER_PRIM_DOWNSTR *******************************************************************************/ #define CsrWifiRouterMaPacketIndCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, result__, frameLength__, frame__, freeFunction__, rssi__, snr__, rate__) \ - msg__ = (CsrWifiRouterMaPacketInd *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketInd)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_IND, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->subscriptionHandle = (subscriptionHandle__); \ @@ -231,7 +231,7 @@ extern const char *CsrWifiRouterDownstreamPrimNames[CSR_WIFI_ROUTER_PRIM_DOWNSTR *******************************************************************************/ #define CsrWifiRouterMaPacketResCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, result__) \ - msg__ = (CsrWifiRouterMaPacketRes *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketRes)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketRes), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_RES, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->subscriptionHandle = (subscriptionHandle__); \ @@ -265,7 +265,7 @@ extern const char *CsrWifiRouterDownstreamPrimNames[CSR_WIFI_ROUTER_PRIM_DOWNSTR *******************************************************************************/ #define CsrWifiRouterMaPacketCfmCreate(msg__, dst__, src__, interfaceTag__, result__, hostTag__, rate__) \ - msg__ = (CsrWifiRouterMaPacketCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->result = (result__); \ @@ -306,7 +306,7 @@ extern const char *CsrWifiRouterDownstreamPrimNames[CSR_WIFI_ROUTER_PRIM_DOWNSTR *******************************************************************************/ #define CsrWifiRouterMaPacketSubscribeReqCreate(msg__, dst__, src__, interfaceTag__, encapsulation__, protocol__, oui__) \ - msg__ = (CsrWifiRouterMaPacketSubscribeReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketSubscribeReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketSubscribeReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->encapsulation = (encapsulation__); \ @@ -342,7 +342,7 @@ extern const char *CsrWifiRouterDownstreamPrimNames[CSR_WIFI_ROUTER_PRIM_DOWNSTR *******************************************************************************/ #define CsrWifiRouterMaPacketSubscribeCfmCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, status__, allocOffset__) \ - msg__ = (CsrWifiRouterMaPacketSubscribeCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketSubscribeCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketSubscribeCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->subscriptionHandle = (subscriptionHandle__); \ @@ -374,7 +374,7 @@ extern const char *CsrWifiRouterDownstreamPrimNames[CSR_WIFI_ROUTER_PRIM_DOWNSTR *******************************************************************************/ #define CsrWifiRouterMaPacketUnsubscribeReqCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__) \ - msg__ = (CsrWifiRouterMaPacketUnsubscribeReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketUnsubscribeReq)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketUnsubscribeReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->subscriptionHandle = (subscriptionHandle__); @@ -405,7 +405,7 @@ extern const char *CsrWifiRouterDownstreamPrimNames[CSR_WIFI_ROUTER_PRIM_DOWNSTR *******************************************************************************/ #define CsrWifiRouterMaPacketUnsubscribeCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = (CsrWifiRouterMaPacketUnsubscribeCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketUnsubscribeCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketUnsubscribeCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); diff --git a/drivers/staging/csr/csr_wifi_router_serialize.c b/drivers/staging/csr/csr_wifi_router_serialize.c index dd2c2ce..adf37d4 100644 --- a/drivers/staging/csr/csr_wifi_router_serialize.c +++ b/drivers/staging/csr/csr_wifi_router_serialize.c @@ -52,7 +52,7 @@ u8* CsrWifiRouterMaPacketSubscribeReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterMaPacketSubscribeReqDes(u8 *buffer, size_t length) { - CsrWifiRouterMaPacketSubscribeReq *primitive = (CsrWifiRouterMaPacketSubscribeReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketSubscribeReq)); + CsrWifiRouterMaPacketSubscribeReq *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketSubscribeReq), GFP_KERNEL); size_t offset; offset = 0; @@ -106,7 +106,7 @@ u8* CsrWifiRouterMaPacketReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterMaPacketReqDes(u8 *buffer, size_t length) { - CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketReq)); + CsrWifiRouterMaPacketReq *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketReq), GFP_KERNEL); size_t offset; offset = 0; @@ -116,7 +116,7 @@ void* CsrWifiRouterMaPacketReqDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->frameLength, buffer, &offset); if (primitive->frameLength) { - primitive->frame = (u8 *)CsrPmemAlloc(primitive->frameLength); + primitive->frame = kmalloc(primitive->frameLength, GFP_KERNEL); CsrMemCpyDes(primitive->frame, buffer, &offset, ((u16) (primitive->frameLength))); } else @@ -167,7 +167,7 @@ u8* CsrWifiRouterMaPacketResSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterMaPacketResDes(u8 *buffer, size_t length) { - CsrWifiRouterMaPacketRes *primitive = (CsrWifiRouterMaPacketRes *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketRes)); + CsrWifiRouterMaPacketRes *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketRes), GFP_KERNEL); size_t offset; offset = 0; @@ -208,7 +208,7 @@ u8* CsrWifiRouterMaPacketCancelReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterMaPacketCancelReqDes(u8 *buffer, size_t length) { - CsrWifiRouterMaPacketCancelReq *primitive = (CsrWifiRouterMaPacketCancelReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketCancelReq)); + CsrWifiRouterMaPacketCancelReq *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketCancelReq), GFP_KERNEL); size_t offset; offset = 0; @@ -250,7 +250,7 @@ u8* CsrWifiRouterMaPacketSubscribeCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterMaPacketSubscribeCfmDes(u8 *buffer, size_t length) { - CsrWifiRouterMaPacketSubscribeCfm *primitive = (CsrWifiRouterMaPacketSubscribeCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketSubscribeCfm)); + CsrWifiRouterMaPacketSubscribeCfm *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketSubscribeCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -288,7 +288,7 @@ u8* CsrWifiRouterMaPacketUnsubscribeCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterMaPacketUnsubscribeCfmDes(u8 *buffer, size_t length) { - CsrWifiRouterMaPacketUnsubscribeCfm *primitive = (CsrWifiRouterMaPacketUnsubscribeCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketUnsubscribeCfm)); + CsrWifiRouterMaPacketUnsubscribeCfm *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketUnsubscribeCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -328,7 +328,7 @@ u8* CsrWifiRouterMaPacketCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterMaPacketCfmDes(u8 *buffer, size_t length) { - CsrWifiRouterMaPacketCfm *primitive = (CsrWifiRouterMaPacketCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketCfm)); + CsrWifiRouterMaPacketCfm *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -384,7 +384,7 @@ u8* CsrWifiRouterMaPacketIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiRouterMaPacketIndDes(u8 *buffer, size_t length) { - CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketInd)); + CsrWifiRouterMaPacketInd *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketInd), GFP_KERNEL); size_t offset; offset = 0; @@ -395,7 +395,7 @@ void* CsrWifiRouterMaPacketIndDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->frameLength, buffer, &offset); if (primitive->frameLength) { - primitive->frame = (u8 *)CsrPmemAlloc(primitive->frameLength); + primitive->frame = kmalloc(primitive->frameLength, GFP_KERNEL); CsrMemCpyDes(primitive->frame, buffer, &offset, ((u16) (primitive->frameLength))); } else diff --git a/drivers/staging/csr/csr_wifi_router_transport.c b/drivers/staging/csr/csr_wifi_router_transport.c index 5d86aa8..4bff435 100644 --- a/drivers/staging/csr/csr_wifi_router_transport.c +++ b/drivers/staging/csr/csr_wifi_router_transport.c @@ -180,7 +180,7 @@ static void CsrWifiRouterTransportSerialiseAndSend(u16 primType, void* msg) msgSize = 6 + (msgEntry->sizeofFunc)((void*)msg); - encodeBuffer = CsrPmemAlloc(msgSize); + encodeBuffer = kmalloc(msgSize, GFP_KERNEL); /* Encode PrimType */ CsrUint16Ser(encodeBuffer, &encodeBufferLen, primType); diff --git a/drivers/staging/csr/csr_wifi_serialize_primitive_types.c b/drivers/staging/csr/csr_wifi_serialize_primitive_types.c index 661d320..23b0e51 100644 --- a/drivers/staging/csr/csr_wifi_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_wifi_serialize_primitive_types.c @@ -9,6 +9,7 @@ *****************************************************************************/ #include +#include #include "csr_pmem.h" #include "csr_macro.h" #include "csr_msgconv.h" @@ -125,7 +126,7 @@ EXPORT_SYMBOL_GPL(CsrWifiEventSer); void* CsrWifiEventDes(u8 *buffer, size_t length) { - CsrWifiFsmEvent *primitive = (CsrWifiFsmEvent *) CsrPmemAlloc(sizeof(CsrWifiFsmEvent)); + CsrWifiFsmEvent *primitive = kmalloc(sizeof(CsrWifiFsmEvent), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); @@ -152,7 +153,7 @@ EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint8Ser); void* CsrWifiEventCsrUint8Des(u8 *buffer, size_t length) { - CsrWifiEventCsrUint8 *primitive = (CsrWifiEventCsrUint8 *) CsrPmemAlloc(sizeof(CsrWifiEventCsrUint8)); + CsrWifiEventCsrUint8 *primitive = kmalloc(sizeof(CsrWifiEventCsrUint8), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -182,7 +183,7 @@ EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16Ser); void* CsrWifiEventCsrUint16Des(u8 *buffer, size_t length) { - CsrWifiEventCsrUint16 *primitive = (CsrWifiEventCsrUint16 *) CsrPmemAlloc(sizeof(CsrWifiEventCsrUint16)); + CsrWifiEventCsrUint16 *primitive = kmalloc(sizeof(CsrWifiEventCsrUint16), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -212,7 +213,7 @@ EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint32Ser); void* CsrWifiEventCsrUint32Des(u8 *buffer, size_t length) { - CsrWifiEventCsrUint32 *primitive = (CsrWifiEventCsrUint32 *) CsrPmemAlloc(sizeof(CsrWifiEventCsrUint32)); + CsrWifiEventCsrUint32 *primitive = kmalloc(sizeof(CsrWifiEventCsrUint32), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); @@ -242,7 +243,7 @@ EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16CsrUint8Ser); void* CsrWifiEventCsrUint16CsrUint8Des(u8 *buffer, size_t length) { - CsrWifiEventCsrUint16CsrUint8 *primitive = (CsrWifiEventCsrUint16CsrUint8 *) CsrPmemAlloc(sizeof(CsrWifiEventCsrUint16CsrUint8)); + CsrWifiEventCsrUint16CsrUint8 *primitive = kmalloc(sizeof(CsrWifiEventCsrUint16CsrUint8), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->common.type, buffer, &offset); diff --git a/drivers/staging/csr/csr_wifi_sme_ap_lib.h b/drivers/staging/csr/csr_wifi_sme_ap_lib.h index 8834a3b..8825172 100644 --- a/drivers/staging/csr/csr_wifi_sme_ap_lib.h +++ b/drivers/staging/csr/csr_wifi_sme_ap_lib.h @@ -94,7 +94,7 @@ extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiSmeApActiveBaGetReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = (CsrWifiSmeApActiveBaGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApActiveBaGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeApActiveBaGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_ACTIVE_BA_GET_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); @@ -126,7 +126,7 @@ extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiSmeApActiveBaGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, activeBaCount__, activeBaSessions__) \ - msg__ = (CsrWifiSmeApActiveBaGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApActiveBaGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeApActiveBaGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_ACTIVE_BA_GET_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -159,7 +159,7 @@ extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiSmeApBaDeleteReqCreate(msg__, dst__, src__, interfaceTag__, reason__, baSession__) \ - msg__ = (CsrWifiSmeApBaDeleteReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApBaDeleteReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeApBaDeleteReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BA_DELETE_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->reason = (reason__); \ @@ -191,7 +191,7 @@ extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiSmeApBaDeleteCfmCreate(msg__, dst__, src__, interfaceTag__, status__, baSession__) \ - msg__ = (CsrWifiSmeApBaDeleteCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApBaDeleteCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeApBaDeleteCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BA_DELETE_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -233,7 +233,7 @@ extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiSmeApBeaconingStartReqCreate(msg__, dst__, src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__) \ - msg__ = (CsrWifiSmeApBeaconingStartReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApBeaconingStartReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeApBeaconingStartReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_START_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->initialPresence = (initialPresence__); \ @@ -275,7 +275,7 @@ extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiSmeApBeaconingStartCfmCreate(msg__, dst__, src__, interfaceTag__, status__, secIeLength__, secIe__) \ - msg__ = (CsrWifiSmeApBeaconingStartCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApBeaconingStartCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeApBeaconingStartCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_START_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -306,7 +306,7 @@ extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiSmeApBeaconingStopReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = (CsrWifiSmeApBeaconingStopReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApBeaconingStopReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeApBeaconingStopReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_STOP_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); @@ -335,7 +335,7 @@ extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiSmeApBeaconingStopCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = (CsrWifiSmeApBeaconingStopCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApBeaconingStopCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeApBeaconingStopCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_STOP_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); @@ -369,7 +369,7 @@ extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiSmeApErrorIndCreate(msg__, dst__, src__, interfaceTag__, apType__, status__) \ - msg__ = (CsrWifiSmeApErrorInd *) CsrPmemAlloc(sizeof(CsrWifiSmeApErrorInd)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeApErrorInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_ERROR_IND, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->apType = (apType__); \ @@ -401,7 +401,7 @@ extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiSmeApStaConnectStartIndCreate(msg__, dst__, src__, interfaceTag__, peerMacAddress__) \ - msg__ = (CsrWifiSmeApStaConnectStartInd *) CsrPmemAlloc(sizeof(CsrWifiSmeApStaConnectStartInd)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeApStaConnectStartInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_CONNECT_START_IND, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->peerMacAddress = (peerMacAddress__); @@ -437,7 +437,7 @@ extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiSmeApStaDisconnectReqCreate(msg__, dst__, src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__) \ - msg__ = (CsrWifiSmeApStaDisconnectReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApStaDisconnectReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeApStaDisconnectReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_DISCONNECT_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->deauthReason = (deauthReason__); \ @@ -471,7 +471,7 @@ extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiSmeApStaDisconnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__, peerMacaddress__) \ - msg__ = (CsrWifiSmeApStaDisconnectCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApStaDisconnectCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeApStaDisconnectCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_DISCONNECT_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -512,7 +512,7 @@ extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiSmeApStaNotifyIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__) \ - msg__ = (CsrWifiSmeApStaNotifyInd *) CsrPmemAlloc(sizeof(CsrWifiSmeApStaNotifyInd)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeApStaNotifyInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_NOTIFY_IND, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->mediaStatus = (mediaStatus__); \ @@ -553,7 +553,7 @@ extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiSmeApWmmParamUpdateReqCreate(msg__, dst__, src__, interfaceTag__, wmmApParams__, wmmApBcParams__) \ - msg__ = (CsrWifiSmeApWmmParamUpdateReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApWmmParamUpdateReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeApWmmParamUpdateReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WMM_PARAM_UPDATE_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ memcpy(msg__->wmmApParams, (wmmApParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); \ @@ -584,7 +584,7 @@ extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiSmeApWmmParamUpdateCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = (CsrWifiSmeApWmmParamUpdateCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApWmmParamUpdateCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeApWmmParamUpdateCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WMM_PARAM_UPDATE_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); @@ -614,7 +614,7 @@ extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiSmeApWpsConfigurationReqCreate(msg__, dst__, src__, wpsConfig__) \ - msg__ = (CsrWifiSmeApWpsConfigurationReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApWpsConfigurationReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeApWpsConfigurationReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_CONFIGURATION_REQ, dst__, src__); \ msg__->wpsConfig = (wpsConfig__); @@ -642,7 +642,7 @@ extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiSmeApWpsConfigurationCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiSmeApWpsConfigurationCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApWpsConfigurationCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeApWpsConfigurationCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_CONFIGURATION_CFM, dst__, src__); \ msg__->status = (status__); @@ -670,7 +670,7 @@ extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiSmeApWpsRegistrationFinishedReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = (CsrWifiSmeApWpsRegistrationFinishedReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApWpsRegistrationFinishedReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeApWpsRegistrationFinishedReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_FINISHED_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); @@ -699,7 +699,7 @@ extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiSmeApWpsRegistrationFinishedCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = (CsrWifiSmeApWpsRegistrationFinishedCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApWpsRegistrationFinishedCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeApWpsRegistrationFinishedCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_FINISHED_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); @@ -730,7 +730,7 @@ extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiSmeApWpsRegistrationStartedReqCreate(msg__, dst__, src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__) \ - msg__ = (CsrWifiSmeApWpsRegistrationStartedReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApWpsRegistrationStartedReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeApWpsRegistrationStartedReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_STARTED_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->SelectedDevicePasswordId = (SelectedDevicePasswordId__); \ @@ -761,7 +761,7 @@ extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiSmeApWpsRegistrationStartedCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = (CsrWifiSmeApWpsRegistrationStartedCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApWpsRegistrationStartedCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeApWpsRegistrationStartedCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_STARTED_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); diff --git a/drivers/staging/csr/csr_wifi_sme_lib.h b/drivers/staging/csr/csr_wifi_sme_lib.h index 7fa9c23..e20ae98 100644 --- a/drivers/staging/csr/csr_wifi_sme_lib.h +++ b/drivers/staging/csr/csr_wifi_sme_lib.h @@ -137,7 +137,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeActivateReqCreate(msg__, dst__, src__) \ - msg__ = (CsrWifiSmeActivateReq *) CsrPmemAlloc(sizeof(CsrWifiSmeActivateReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeActivateReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ACTIVATE_REQ, dst__, src__); #define CsrWifiSmeActivateReqSendTo(dst__, src__) \ @@ -164,7 +164,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeActivateCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiSmeActivateCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeActivateCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeActivateCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ACTIVATE_CFM, dst__, src__); \ msg__->status = (status__); @@ -191,7 +191,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeAdhocConfigGetReqCreate(msg__, dst__, src__) \ - msg__ = (CsrWifiSmeAdhocConfigGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeAdhocConfigGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeAdhocConfigGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ADHOC_CONFIG_GET_REQ, dst__, src__); #define CsrWifiSmeAdhocConfigGetReqSendTo(dst__, src__) \ @@ -220,7 +220,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeAdhocConfigGetCfmCreate(msg__, dst__, src__, status__, adHocConfig__) \ - msg__ = (CsrWifiSmeAdhocConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeAdhocConfigGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeAdhocConfigGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ADHOC_CONFIG_GET_CFM, dst__, src__); \ msg__->status = (status__); \ msg__->adHocConfig = (adHocConfig__); @@ -249,7 +249,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeAdhocConfigSetReqCreate(msg__, dst__, src__, adHocConfig__) \ - msg__ = (CsrWifiSmeAdhocConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeAdhocConfigSetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeAdhocConfigSetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ADHOC_CONFIG_SET_REQ, dst__, src__); \ msg__->adHocConfig = (adHocConfig__); @@ -277,7 +277,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeAdhocConfigSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiSmeAdhocConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeAdhocConfigSetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeAdhocConfigSetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ADHOC_CONFIG_SET_CFM, dst__, src__); \ msg__->status = (status__); @@ -307,7 +307,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeAmpStatusChangeIndCreate(msg__, dst__, src__, interfaceTag__, ampStatus__) \ - msg__ = (CsrWifiSmeAmpStatusChangeInd *) CsrPmemAlloc(sizeof(CsrWifiSmeAmpStatusChangeInd)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeAmpStatusChangeInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_AMP_STATUS_CHANGE_IND, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->ampStatus = (ampStatus__); @@ -348,7 +348,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeAssociationCompleteIndCreate(msg__, dst__, src__, interfaceTag__, status__, connectionInfo__, deauthReason__) \ - msg__ = (CsrWifiSmeAssociationCompleteInd *) CsrPmemAlloc(sizeof(CsrWifiSmeAssociationCompleteInd)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeAssociationCompleteInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ASSOCIATION_COMPLETE_IND, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -382,7 +382,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeAssociationStartIndCreate(msg__, dst__, src__, interfaceTag__, address__, ssid__) \ - msg__ = (CsrWifiSmeAssociationStartInd *) CsrPmemAlloc(sizeof(CsrWifiSmeAssociationStartInd)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeAssociationStartInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ASSOCIATION_START_IND, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->address = (address__); \ @@ -425,7 +425,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeBlacklistReqCreate(msg__, dst__, src__, interfaceTag__, action__, setAddressCount__, setAddresses__) \ - msg__ = (CsrWifiSmeBlacklistReq *) CsrPmemAlloc(sizeof(CsrWifiSmeBlacklistReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeBlacklistReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_BLACKLIST_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->action = (action__); \ @@ -465,7 +465,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeBlacklistCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getAddressCount__, getAddresses__) \ - msg__ = (CsrWifiSmeBlacklistCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeBlacklistCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeBlacklistCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_BLACKLIST_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -496,7 +496,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeCalibrationDataGetReqCreate(msg__, dst__, src__) \ - msg__ = (CsrWifiSmeCalibrationDataGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCalibrationDataGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeCalibrationDataGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CALIBRATION_DATA_GET_REQ, dst__, src__); #define CsrWifiSmeCalibrationDataGetReqSendTo(dst__, src__) \ @@ -527,7 +527,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeCalibrationDataGetCfmCreate(msg__, dst__, src__, status__, calibrationDataLength__, calibrationData__) \ - msg__ = (CsrWifiSmeCalibrationDataGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCalibrationDataGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeCalibrationDataGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CALIBRATION_DATA_GET_CFM, dst__, src__); \ msg__->status = (status__); \ msg__->calibrationDataLength = (calibrationDataLength__); \ @@ -562,7 +562,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeCalibrationDataSetReqCreate(msg__, dst__, src__, calibrationDataLength__, calibrationData__) \ - msg__ = (CsrWifiSmeCalibrationDataSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCalibrationDataSetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeCalibrationDataSetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CALIBRATION_DATA_SET_REQ, dst__, src__); \ msg__->calibrationDataLength = (calibrationDataLength__); \ msg__->calibrationData = (calibrationData__); @@ -591,7 +591,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeCalibrationDataSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiSmeCalibrationDataSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCalibrationDataSetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeCalibrationDataSetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CALIBRATION_DATA_SET_CFM, dst__, src__); \ msg__->status = (status__); @@ -620,7 +620,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeCcxConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = (CsrWifiSmeCcxConfigGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCcxConfigGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeCcxConfigGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CCX_CONFIG_GET_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); @@ -650,7 +650,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeCcxConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, ccxConfig__) \ - msg__ = (CsrWifiSmeCcxConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCcxConfigGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeCcxConfigGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CCX_CONFIG_GET_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -682,7 +682,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeCcxConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, ccxConfig__) \ - msg__ = (CsrWifiSmeCcxConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCcxConfigSetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeCcxConfigSetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CCX_CONFIG_SET_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->ccxConfig = (ccxConfig__); @@ -712,7 +712,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeCcxConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = (CsrWifiSmeCcxConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCcxConfigSetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeCcxConfigSetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CCX_CONFIG_SET_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); @@ -740,7 +740,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeCloakedSsidsGetReqCreate(msg__, dst__, src__) \ - msg__ = (CsrWifiSmeCloakedSsidsGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCloakedSsidsGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeCloakedSsidsGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CLOAKED_SSIDS_GET_REQ, dst__, src__); #define CsrWifiSmeCloakedSsidsGetReqSendTo(dst__, src__) \ @@ -769,7 +769,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeCloakedSsidsGetCfmCreate(msg__, dst__, src__, status__, cloakedSsids__) \ - msg__ = (CsrWifiSmeCloakedSsidsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCloakedSsidsGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeCloakedSsidsGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CLOAKED_SSIDS_GET_CFM, dst__, src__); \ msg__->status = (status__); \ msg__->cloakedSsids = (cloakedSsids__); @@ -803,7 +803,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeCloakedSsidsSetReqCreate(msg__, dst__, src__, cloakedSsids__) \ - msg__ = (CsrWifiSmeCloakedSsidsSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCloakedSsidsSetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeCloakedSsidsSetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CLOAKED_SSIDS_SET_REQ, dst__, src__); \ msg__->cloakedSsids = (cloakedSsids__); @@ -831,7 +831,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeCloakedSsidsSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiSmeCloakedSsidsSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCloakedSsidsSetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeCloakedSsidsSetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CLOAKED_SSIDS_SET_CFM, dst__, src__); \ msg__->status = (status__); @@ -858,7 +858,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeCoexConfigGetReqCreate(msg__, dst__, src__) \ - msg__ = (CsrWifiSmeCoexConfigGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexConfigGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeCoexConfigGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_CONFIG_GET_REQ, dst__, src__); #define CsrWifiSmeCoexConfigGetReqSendTo(dst__, src__) \ @@ -887,7 +887,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeCoexConfigGetCfmCreate(msg__, dst__, src__, status__, coexConfig__) \ - msg__ = (CsrWifiSmeCoexConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexConfigGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeCoexConfigGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_CONFIG_GET_CFM, dst__, src__); \ msg__->status = (status__); \ msg__->coexConfig = (coexConfig__); @@ -916,7 +916,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeCoexConfigSetReqCreate(msg__, dst__, src__, coexConfig__) \ - msg__ = (CsrWifiSmeCoexConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexConfigSetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeCoexConfigSetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_CONFIG_SET_REQ, dst__, src__); \ msg__->coexConfig = (coexConfig__); @@ -944,7 +944,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeCoexConfigSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiSmeCoexConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexConfigSetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeCoexConfigSetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_CONFIG_SET_CFM, dst__, src__); \ msg__->status = (status__); @@ -971,7 +971,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeCoexInfoGetReqCreate(msg__, dst__, src__) \ - msg__ = (CsrWifiSmeCoexInfoGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexInfoGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeCoexInfoGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_INFO_GET_REQ, dst__, src__); #define CsrWifiSmeCoexInfoGetReqSendTo(dst__, src__) \ @@ -999,7 +999,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeCoexInfoGetCfmCreate(msg__, dst__, src__, status__, coexInfo__) \ - msg__ = (CsrWifiSmeCoexInfoGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexInfoGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeCoexInfoGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_INFO_GET_CFM, dst__, src__); \ msg__->status = (status__); \ msg__->coexInfo = (coexInfo__); @@ -1065,7 +1065,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeConnectReqCreate(msg__, dst__, src__, interfaceTag__, connectionConfig__) \ - msg__ = (CsrWifiSmeConnectReq *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeConnectReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECT_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->connectionConfig = (connectionConfig__); @@ -1098,7 +1098,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeConnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = (CsrWifiSmeConnectCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeConnectCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECT_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); @@ -1127,7 +1127,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeConnectionConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = (CsrWifiSmeConnectionConfigGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionConfigGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeConnectionConfigGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_CONFIG_GET_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); @@ -1157,7 +1157,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeConnectionConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionConfig__) \ - msg__ = (CsrWifiSmeConnectionConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionConfigGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeConnectionConfigGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_CONFIG_GET_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -1187,7 +1187,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeConnectionInfoGetReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = (CsrWifiSmeConnectionInfoGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionInfoGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeConnectionInfoGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_INFO_GET_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); @@ -1217,7 +1217,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeConnectionInfoGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionInfo__) \ - msg__ = (CsrWifiSmeConnectionInfoGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionInfoGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeConnectionInfoGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_INFO_GET_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -1255,7 +1255,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeConnectionQualityIndCreate(msg__, dst__, src__, interfaceTag__, linkQuality__) \ - msg__ = (CsrWifiSmeConnectionQualityInd *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionQualityInd)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeConnectionQualityInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_QUALITY_IND, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->linkQuality = (linkQuality__); @@ -1284,7 +1284,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeConnectionStatsGetReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = (CsrWifiSmeConnectionStatsGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionStatsGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeConnectionStatsGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_STATS_GET_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); @@ -1314,7 +1314,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeConnectionStatsGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionStats__) \ - msg__ = (CsrWifiSmeConnectionStatsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionStatsGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeConnectionStatsGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_STATS_GET_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -1351,7 +1351,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeCoreDumpIndCreate(msg__, dst__, src__, dataLength__, data__) \ - msg__ = (CsrWifiSmeCoreDumpInd *) CsrPmemAlloc(sizeof(CsrWifiSmeCoreDumpInd)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeCoreDumpInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CORE_DUMP_IND, dst__, src__); \ msg__->dataLength = (dataLength__); \ msg__->data = (data__); @@ -1379,7 +1379,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeDeactivateReqCreate(msg__, dst__, src__) \ - msg__ = (CsrWifiSmeDeactivateReq *) CsrPmemAlloc(sizeof(CsrWifiSmeDeactivateReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeDeactivateReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_DEACTIVATE_REQ, dst__, src__); #define CsrWifiSmeDeactivateReqSendTo(dst__, src__) \ @@ -1408,7 +1408,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeDeactivateCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiSmeDeactivateCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeDeactivateCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeDeactivateCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_DEACTIVATE_CFM, dst__, src__); \ msg__->status = (status__); @@ -1437,7 +1437,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeDisconnectReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = (CsrWifiSmeDisconnectReq *) CsrPmemAlloc(sizeof(CsrWifiSmeDisconnectReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeDisconnectReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_DISCONNECT_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); @@ -1469,7 +1469,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeDisconnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = (CsrWifiSmeDisconnectCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeDisconnectCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeDisconnectCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_DISCONNECT_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); @@ -1498,7 +1498,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeErrorIndCreate(msg__, dst__, src__, errorMessage__) \ - msg__ = (CsrWifiSmeErrorInd *) CsrPmemAlloc(sizeof(CsrWifiSmeErrorInd)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeErrorInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ERROR_IND, dst__, src__); \ msg__->errorMessage = (errorMessage__); @@ -1529,7 +1529,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeEventMaskSetReqCreate(msg__, dst__, src__, indMask__) \ - msg__ = (CsrWifiSmeEventMaskSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeEventMaskSetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeEventMaskSetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_EVENT_MASK_SET_REQ, dst__, src__); \ msg__->indMask = (indMask__); @@ -1558,7 +1558,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeEventMaskSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiSmeEventMaskSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeEventMaskSetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeEventMaskSetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_EVENT_MASK_SET_CFM, dst__, src__); \ msg__->status = (status__); @@ -1586,7 +1586,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeHostConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = (CsrWifiSmeHostConfigGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeHostConfigGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeHostConfigGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_HOST_CONFIG_GET_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); @@ -1616,7 +1616,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeHostConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, hostConfig__) \ - msg__ = (CsrWifiSmeHostConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeHostConfigGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeHostConfigGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_HOST_CONFIG_GET_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -1649,7 +1649,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeHostConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, hostConfig__) \ - msg__ = (CsrWifiSmeHostConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeHostConfigSetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeHostConfigSetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_HOST_CONFIG_SET_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->hostConfig = (hostConfig__); @@ -1679,7 +1679,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeHostConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = (CsrWifiSmeHostConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeHostConfigSetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeHostConfigSetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_HOST_CONFIG_SET_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); @@ -1710,7 +1710,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeIbssStationIndCreate(msg__, dst__, src__, address__, isconnected__) \ - msg__ = (CsrWifiSmeIbssStationInd *) CsrPmemAlloc(sizeof(CsrWifiSmeIbssStationInd)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeIbssStationInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_IBSS_STATION_IND, dst__, src__); \ msg__->address = (address__); \ msg__->isconnected = (isconnected__); @@ -1740,7 +1740,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeInfoIndCreate(msg__, dst__, src__, infoMessage__) \ - msg__ = (CsrWifiSmeInfoInd *) CsrPmemAlloc(sizeof(CsrWifiSmeInfoInd)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeInfoInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_INFO_IND, dst__, src__); \ msg__->infoMessage = (infoMessage__); @@ -1768,7 +1768,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeInterfaceCapabilityGetReqCreate(msg__, dst__, src__) \ - msg__ = (CsrWifiSmeInterfaceCapabilityGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeInterfaceCapabilityGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeInterfaceCapabilityGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_REQ, dst__, src__); #define CsrWifiSmeInterfaceCapabilityGetReqSendTo(dst__, src__) \ @@ -1804,7 +1804,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeInterfaceCapabilityGetCfmCreate(msg__, dst__, src__, status__, numInterfaces__, capBitmap__) \ - msg__ = (CsrWifiSmeInterfaceCapabilityGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeInterfaceCapabilityGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeInterfaceCapabilityGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_CFM, dst__, src__); \ msg__->status = (status__); \ msg__->numInterfaces = (numInterfaces__); \ @@ -1841,7 +1841,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeKeyReqCreate(msg__, dst__, src__, interfaceTag__, action__, key__) \ - msg__ = (CsrWifiSmeKeyReq *) CsrPmemAlloc(sizeof(CsrWifiSmeKeyReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeKeyReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_KEY_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->action = (action__); \ @@ -1876,7 +1876,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeKeyCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, keyType__, peerMacAddress__) \ - msg__ = (CsrWifiSmeKeyCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeKeyCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeKeyCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_KEY_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -1908,7 +1908,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeLinkQualityGetReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = (CsrWifiSmeLinkQualityGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeLinkQualityGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeLinkQualityGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_LINK_QUALITY_GET_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); @@ -1938,7 +1938,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeLinkQualityGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, linkQuality__) \ - msg__ = (CsrWifiSmeLinkQualityGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeLinkQualityGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeLinkQualityGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_LINK_QUALITY_GET_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -1982,7 +1982,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeMediaStatusIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, connectionInfo__, disassocReason__, deauthReason__) \ - msg__ = (CsrWifiSmeMediaStatusInd *) CsrPmemAlloc(sizeof(CsrWifiSmeMediaStatusInd)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeMediaStatusInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MEDIA_STATUS_IND, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->mediaStatus = (mediaStatus__); \ @@ -2013,7 +2013,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeMibConfigGetReqCreate(msg__, dst__, src__) \ - msg__ = (CsrWifiSmeMibConfigGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibConfigGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeMibConfigGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_CONFIG_GET_REQ, dst__, src__); #define CsrWifiSmeMibConfigGetReqSendTo(dst__, src__) \ @@ -2041,7 +2041,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeMibConfigGetCfmCreate(msg__, dst__, src__, status__, mibConfig__) \ - msg__ = (CsrWifiSmeMibConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMibConfigGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeMibConfigGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_CONFIG_GET_CFM, dst__, src__); \ msg__->status = (status__); \ msg__->mibConfig = (mibConfig__); @@ -2071,7 +2071,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeMibConfigSetReqCreate(msg__, dst__, src__, mibConfig__) \ - msg__ = (CsrWifiSmeMibConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibConfigSetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeMibConfigSetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_CONFIG_SET_REQ, dst__, src__); \ msg__->mibConfig = (mibConfig__); @@ -2099,7 +2099,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeMibConfigSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiSmeMibConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMibConfigSetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeMibConfigSetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_CONFIG_SET_CFM, dst__, src__); \ msg__->status = (status__); @@ -2130,7 +2130,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeMibGetCfmCreate(msg__, dst__, src__, status__, mibAttributeLength__, mibAttribute__) \ - msg__ = (CsrWifiSmeMibGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeMibGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_GET_CFM, dst__, src__); \ msg__->status = (status__); \ msg__->mibAttributeLength = (mibAttributeLength__); \ @@ -2163,7 +2163,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeMibGetNextReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__) \ - msg__ = (CsrWifiSmeMibGetNextReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetNextReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeMibGetNextReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_GET_NEXT_REQ, dst__, src__); \ msg__->mibAttributeLength = (mibAttributeLength__); \ msg__->mibAttribute = (mibAttribute__); @@ -2198,7 +2198,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeMibGetNextCfmCreate(msg__, dst__, src__, status__, mibAttributeLength__, mibAttribute__) \ - msg__ = (CsrWifiSmeMibGetNextCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetNextCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeMibGetNextCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_GET_NEXT_CFM, dst__, src__); \ msg__->status = (status__); \ msg__->mibAttributeLength = (mibAttributeLength__); \ @@ -2231,7 +2231,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeMibGetReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__) \ - msg__ = (CsrWifiSmeMibGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeMibGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_GET_REQ, dst__, src__); \ msg__->mibAttributeLength = (mibAttributeLength__); \ msg__->mibAttribute = (mibAttribute__); @@ -2271,7 +2271,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeMibSetReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__) \ - msg__ = (CsrWifiSmeMibSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibSetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeMibSetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_SET_REQ, dst__, src__); \ msg__->mibAttributeLength = (mibAttributeLength__); \ msg__->mibAttribute = (mibAttribute__); @@ -2300,7 +2300,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeMibSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiSmeMibSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMibSetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeMibSetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_SET_CFM, dst__, src__); \ msg__->status = (status__); @@ -2335,7 +2335,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeMicFailureIndCreate(msg__, dst__, src__, interfaceTag__, secondFailure__, count__, address__, keyType__) \ - msg__ = (CsrWifiSmeMicFailureInd *) CsrPmemAlloc(sizeof(CsrWifiSmeMicFailureInd)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeMicFailureInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIC_FAILURE_IND, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->secondFailure = (secondFailure__); \ @@ -2377,7 +2377,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeMulticastAddressReqCreate(msg__, dst__, src__, interfaceTag__, action__, setAddressesCount__, setAddresses__) \ - msg__ = (CsrWifiSmeMulticastAddressReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMulticastAddressReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeMulticastAddressReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MULTICAST_ADDRESS_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->action = (action__); \ @@ -2416,7 +2416,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeMulticastAddressCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getAddressesCount__, getAddresses__) \ - msg__ = (CsrWifiSmeMulticastAddressCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMulticastAddressCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeMulticastAddressCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MULTICAST_ADDRESS_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -2476,7 +2476,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmePacketFilterSetReqCreate(msg__, dst__, src__, interfaceTag__, filterLength__, filter__, mode__, arpFilterAddress__) \ - msg__ = (CsrWifiSmePacketFilterSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmePacketFilterSetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmePacketFilterSetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PACKET_FILTER_SET_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->filterLength = (filterLength__); \ @@ -2509,7 +2509,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmePacketFilterSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = (CsrWifiSmePacketFilterSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePacketFilterSetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmePacketFilterSetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PACKET_FILTER_SET_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); @@ -2537,7 +2537,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmePermanentMacAddressGetReqCreate(msg__, dst__, src__) \ - msg__ = (CsrWifiSmePermanentMacAddressGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmePermanentMacAddressGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmePermanentMacAddressGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PERMANENT_MAC_ADDRESS_GET_REQ, dst__, src__); #define CsrWifiSmePermanentMacAddressGetReqSendTo(dst__, src__) \ @@ -2565,7 +2565,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmePermanentMacAddressGetCfmCreate(msg__, dst__, src__, status__, permanentMacAddress__) \ - msg__ = (CsrWifiSmePermanentMacAddressGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePermanentMacAddressGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmePermanentMacAddressGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PERMANENT_MAC_ADDRESS_GET_CFM, dst__, src__); \ msg__->status = (status__); \ msg__->permanentMacAddress = (permanentMacAddress__); @@ -2599,7 +2599,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmePmkidCandidateListIndCreate(msg__, dst__, src__, interfaceTag__, pmkidCandidatesCount__, pmkidCandidates__) \ - msg__ = (CsrWifiSmePmkidCandidateListInd *) CsrPmemAlloc(sizeof(CsrWifiSmePmkidCandidateListInd)); \ + msg__ = kmalloc(sizeof(CsrWifiSmePmkidCandidateListInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PMKID_CANDIDATE_LIST_IND, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->pmkidCandidatesCount = (pmkidCandidatesCount__); \ @@ -2641,7 +2641,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmePmkidReqCreate(msg__, dst__, src__, interfaceTag__, action__, setPmkidsCount__, setPmkids__) \ - msg__ = (CsrWifiSmePmkidReq *) CsrPmemAlloc(sizeof(CsrWifiSmePmkidReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmePmkidReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PMKID_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->action = (action__); \ @@ -2680,7 +2680,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmePmkidCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getPmkidsCount__, getPmkids__) \ - msg__ = (CsrWifiSmePmkidCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePmkidCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmePmkidCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PMKID_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -2711,7 +2711,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmePowerConfigGetReqCreate(msg__, dst__, src__) \ - msg__ = (CsrWifiSmePowerConfigGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmePowerConfigGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmePowerConfigGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_POWER_CONFIG_GET_REQ, dst__, src__); #define CsrWifiSmePowerConfigGetReqSendTo(dst__, src__) \ @@ -2740,7 +2740,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmePowerConfigGetCfmCreate(msg__, dst__, src__, status__, powerConfig__) \ - msg__ = (CsrWifiSmePowerConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePowerConfigGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmePowerConfigGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_POWER_CONFIG_GET_CFM, dst__, src__); \ msg__->status = (status__); \ msg__->powerConfig = (powerConfig__); @@ -2769,7 +2769,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmePowerConfigSetReqCreate(msg__, dst__, src__, powerConfig__) \ - msg__ = (CsrWifiSmePowerConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmePowerConfigSetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmePowerConfigSetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_POWER_CONFIG_SET_REQ, dst__, src__); \ msg__->powerConfig = (powerConfig__); @@ -2797,7 +2797,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmePowerConfigSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiSmePowerConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePowerConfigSetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmePowerConfigSetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_POWER_CONFIG_SET_CFM, dst__, src__); \ msg__->status = (status__); @@ -2824,7 +2824,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeRegulatoryDomainInfoGetReqCreate(msg__, dst__, src__) \ - msg__ = (CsrWifiSmeRegulatoryDomainInfoGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeRegulatoryDomainInfoGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeRegulatoryDomainInfoGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_REGULATORY_DOMAIN_INFO_GET_REQ, dst__, src__); #define CsrWifiSmeRegulatoryDomainInfoGetReqSendTo(dst__, src__) \ @@ -2853,7 +2853,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeRegulatoryDomainInfoGetCfmCreate(msg__, dst__, src__, status__, regDomInfo__) \ - msg__ = (CsrWifiSmeRegulatoryDomainInfoGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeRegulatoryDomainInfoGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeRegulatoryDomainInfoGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_REGULATORY_DOMAIN_INFO_GET_CFM, dst__, src__); \ msg__->status = (status__); \ msg__->regDomInfo = (regDomInfo__); @@ -2886,7 +2886,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeRoamCompleteIndCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = (CsrWifiSmeRoamCompleteInd *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamCompleteInd)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeRoamCompleteInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAM_COMPLETE_IND, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); @@ -2935,7 +2935,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeRoamStartIndCreate(msg__, dst__, src__, interfaceTag__, roamReason__, reason80211__) \ - msg__ = (CsrWifiSmeRoamStartInd *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamStartInd)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeRoamStartInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAM_START_IND, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->roamReason = (roamReason__); \ @@ -2965,7 +2965,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeRoamingConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = (CsrWifiSmeRoamingConfigGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamingConfigGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeRoamingConfigGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAMING_CONFIG_GET_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); @@ -2995,7 +2995,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeRoamingConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, roamingConfig__) \ - msg__ = (CsrWifiSmeRoamingConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamingConfigGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeRoamingConfigGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAMING_CONFIG_GET_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -3026,7 +3026,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeRoamingConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, roamingConfig__) \ - msg__ = (CsrWifiSmeRoamingConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamingConfigSetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeRoamingConfigSetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAMING_CONFIG_SET_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->roamingConfig = (roamingConfig__); @@ -3056,7 +3056,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeRoamingConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = (CsrWifiSmeRoamingConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamingConfigSetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeRoamingConfigSetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAMING_CONFIG_SET_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); @@ -3084,7 +3084,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeScanConfigGetReqCreate(msg__, dst__, src__) \ - msg__ = (CsrWifiSmeScanConfigGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeScanConfigGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeScanConfigGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_CONFIG_GET_REQ, dst__, src__); #define CsrWifiSmeScanConfigGetReqSendTo(dst__, src__) \ @@ -3113,7 +3113,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeScanConfigGetCfmCreate(msg__, dst__, src__, status__, scanConfig__) \ - msg__ = (CsrWifiSmeScanConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeScanConfigGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeScanConfigGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_CONFIG_GET_CFM, dst__, src__); \ msg__->status = (status__); \ msg__->scanConfig = (scanConfig__); @@ -3153,7 +3153,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeScanConfigSetReqCreate(msg__, dst__, src__, scanConfig__) \ - msg__ = (CsrWifiSmeScanConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeScanConfigSetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeScanConfigSetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_CONFIG_SET_REQ, dst__, src__); \ msg__->scanConfig = (scanConfig__); @@ -3181,7 +3181,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeScanConfigSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiSmeScanConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeScanConfigSetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeScanConfigSetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_CONFIG_SET_CFM, dst__, src__); \ msg__->status = (status__); @@ -3236,7 +3236,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeScanFullReqCreate(msg__, dst__, src__, ssidCount__, ssid__, bssid__, forceScan__, bssType__, scanType__, channelListCount__, channelList__, probeIeLength__, probeIe__) \ - msg__ = (CsrWifiSmeScanFullReq *) CsrPmemAlloc(sizeof(CsrWifiSmeScanFullReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeScanFullReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_FULL_REQ, dst__, src__); \ msg__->ssidCount = (ssidCount__); \ msg__->ssid = (ssid__); \ @@ -3274,7 +3274,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeScanFullCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiSmeScanFullCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeScanFullCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeScanFullCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_FULL_CFM, dst__, src__); \ msg__->status = (status__); @@ -3303,7 +3303,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeScanResultIndCreate(msg__, dst__, src__, result__) \ - msg__ = (CsrWifiSmeScanResultInd *) CsrPmemAlloc(sizeof(CsrWifiSmeScanResultInd)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeScanResultInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULT_IND, dst__, src__); \ msg__->result = (result__); @@ -3339,7 +3339,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeScanResultsFlushReqCreate(msg__, dst__, src__) \ - msg__ = (CsrWifiSmeScanResultsFlushReq *) CsrPmemAlloc(sizeof(CsrWifiSmeScanResultsFlushReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeScanResultsFlushReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULTS_FLUSH_REQ, dst__, src__); #define CsrWifiSmeScanResultsFlushReqSendTo(dst__, src__) \ @@ -3366,7 +3366,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeScanResultsFlushCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiSmeScanResultsFlushCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeScanResultsFlushCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeScanResultsFlushCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULTS_FLUSH_CFM, dst__, src__); \ msg__->status = (status__); @@ -3395,7 +3395,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeScanResultsGetReqCreate(msg__, dst__, src__) \ - msg__ = (CsrWifiSmeScanResultsGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeScanResultsGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeScanResultsGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULTS_GET_REQ, dst__, src__); #define CsrWifiSmeScanResultsGetReqSendTo(dst__, src__) \ @@ -3425,7 +3425,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeScanResultsGetCfmCreate(msg__, dst__, src__, status__, scanResultsCount__, scanResults__) \ - msg__ = (CsrWifiSmeScanResultsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeScanResultsGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeScanResultsGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULTS_GET_CFM, dst__, src__); \ msg__->status = (status__); \ msg__->scanResultsCount = (scanResultsCount__); \ @@ -3459,7 +3459,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeSetReqCreate(msg__, dst__, src__, dataLength__, data__) \ - msg__ = (CsrWifiSmeSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeSetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeSetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SET_REQ, dst__, src__); \ msg__->dataLength = (dataLength__); \ msg__->data = (data__); @@ -3487,7 +3487,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeSmeCommonConfigGetReqCreate(msg__, dst__, src__) \ - msg__ = (CsrWifiSmeSmeCommonConfigGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeCommonConfigGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeSmeCommonConfigGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_COMMON_CONFIG_GET_REQ, dst__, src__); #define CsrWifiSmeSmeCommonConfigGetReqSendTo(dst__, src__) \ @@ -3515,7 +3515,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeSmeCommonConfigGetCfmCreate(msg__, dst__, src__, status__, deviceConfig__) \ - msg__ = (CsrWifiSmeSmeCommonConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeCommonConfigGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeSmeCommonConfigGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_COMMON_CONFIG_GET_CFM, dst__, src__); \ msg__->status = (status__); \ msg__->deviceConfig = (deviceConfig__); @@ -3544,7 +3544,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeSmeCommonConfigSetReqCreate(msg__, dst__, src__, deviceConfig__) \ - msg__ = (CsrWifiSmeSmeCommonConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeCommonConfigSetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeSmeCommonConfigSetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_COMMON_CONFIG_SET_REQ, dst__, src__); \ msg__->deviceConfig = (deviceConfig__); @@ -3572,7 +3572,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeSmeCommonConfigSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiSmeSmeCommonConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeCommonConfigSetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeSmeCommonConfigSetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_COMMON_CONFIG_SET_CFM, dst__, src__); \ msg__->status = (status__); @@ -3600,7 +3600,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeSmeStaConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = (CsrWifiSmeSmeStaConfigGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeStaConfigGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeSmeStaConfigGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_STA_CONFIG_GET_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); @@ -3630,7 +3630,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeSmeStaConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, smeConfig__) \ - msg__ = (CsrWifiSmeSmeStaConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeStaConfigGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeSmeStaConfigGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_STA_CONFIG_GET_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -3661,7 +3661,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeSmeStaConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, smeConfig__) \ - msg__ = (CsrWifiSmeSmeStaConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeStaConfigSetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeSmeStaConfigSetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_STA_CONFIG_SET_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->smeConfig = (smeConfig__); @@ -3691,7 +3691,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeSmeStaConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = (CsrWifiSmeSmeStaConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeStaConfigSetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeSmeStaConfigSetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_STA_CONFIG_SET_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); @@ -3720,7 +3720,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeStationMacAddressGetReqCreate(msg__, dst__, src__) \ - msg__ = (CsrWifiSmeStationMacAddressGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeStationMacAddressGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeStationMacAddressGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_STATION_MAC_ADDRESS_GET_REQ, dst__, src__); #define CsrWifiSmeStationMacAddressGetReqSendTo(dst__, src__) \ @@ -3748,7 +3748,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeStationMacAddressGetCfmCreate(msg__, dst__, src__, status__, stationMacAddress__) \ - msg__ = (CsrWifiSmeStationMacAddressGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeStationMacAddressGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeStationMacAddressGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_STATION_MAC_ADDRESS_GET_CFM, dst__, src__); \ msg__->status = (status__); \ memcpy(msg__->stationMacAddress, (stationMacAddress__), sizeof(CsrWifiMacAddress) * 2); @@ -3806,7 +3806,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeTspecReqCreate(msg__, dst__, src__, interfaceTag__, action__, transactionId__, strict__, ctrlMask__, tspecLength__, tspec__, tclasLength__, tclas__) \ - msg__ = (CsrWifiSmeTspecReq *) CsrPmemAlloc(sizeof(CsrWifiSmeTspecReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeTspecReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_TSPEC_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->action = (action__); \ @@ -3849,7 +3849,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeTspecIndCreate(msg__, dst__, src__, interfaceTag__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \ - msg__ = (CsrWifiSmeTspecInd *) CsrPmemAlloc(sizeof(CsrWifiSmeTspecInd)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeTspecInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_TSPEC_IND, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->transactionId = (transactionId__); \ @@ -3888,7 +3888,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeTspecCfmCreate(msg__, dst__, src__, interfaceTag__, status__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \ - msg__ = (CsrWifiSmeTspecCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeTspecCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeTspecCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_TSPEC_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -3920,7 +3920,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeVersionsGetReqCreate(msg__, dst__, src__) \ - msg__ = (CsrWifiSmeVersionsGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeVersionsGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeVersionsGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_VERSIONS_GET_REQ, dst__, src__); #define CsrWifiSmeVersionsGetReqSendTo(dst__, src__) \ @@ -3948,7 +3948,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeVersionsGetCfmCreate(msg__, dst__, src__, status__, versions__) \ - msg__ = (CsrWifiSmeVersionsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeVersionsGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeVersionsGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_VERSIONS_GET_CFM, dst__, src__); \ msg__->status = (status__); \ msg__->versions = (versions__); @@ -4005,7 +4005,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeWifiFlightmodeReqCreate(msg__, dst__, src__, address__, mibFilesCount__, mibFiles__) \ - msg__ = (CsrWifiSmeWifiFlightmodeReq *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiFlightmodeReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeWifiFlightmodeReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_FLIGHTMODE_REQ, dst__, src__); \ msg__->address = (address__); \ msg__->mibFilesCount = (mibFilesCount__); \ @@ -4038,7 +4038,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeWifiFlightmodeCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiSmeWifiFlightmodeCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiFlightmodeCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeWifiFlightmodeCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_FLIGHTMODE_CFM, dst__, src__); \ msg__->status = (status__); @@ -4066,7 +4066,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeWifiOffReqCreate(msg__, dst__, src__) \ - msg__ = (CsrWifiSmeWifiOffReq *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiOffReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeWifiOffReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_OFF_REQ, dst__, src__); #define CsrWifiSmeWifiOffReqSendTo(dst__, src__) \ @@ -4094,7 +4094,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeWifiOffIndCreate(msg__, dst__, src__, reason__) \ - msg__ = (CsrWifiSmeWifiOffInd *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiOffInd)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeWifiOffInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_OFF_IND, dst__, src__); \ msg__->reason = (reason__); @@ -4126,7 +4126,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeWifiOffCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiSmeWifiOffCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiOffCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeWifiOffCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_OFF_CFM, dst__, src__); \ msg__->status = (status__); @@ -4175,7 +4175,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeWifiOnReqCreate(msg__, dst__, src__, address__, mibFilesCount__, mibFiles__) \ - msg__ = (CsrWifiSmeWifiOnReq *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiOnReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeWifiOnReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_ON_REQ, dst__, src__); \ msg__->address = (address__); \ msg__->mibFilesCount = (mibFilesCount__); \ @@ -4206,7 +4206,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeWifiOnIndCreate(msg__, dst__, src__, address__) \ - msg__ = (CsrWifiSmeWifiOnInd *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiOnInd)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeWifiOnInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_ON_IND, dst__, src__); \ msg__->address = (address__); @@ -4235,7 +4235,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeWifiOnCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiSmeWifiOnCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiOnCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeWifiOnCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_ON_CFM, dst__, src__); \ msg__->status = (status__); @@ -4264,7 +4264,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeWpsConfigurationReqCreate(msg__, dst__, src__, wpsConfig__) \ - msg__ = (CsrWifiSmeWpsConfigurationReq *) CsrPmemAlloc(sizeof(CsrWifiSmeWpsConfigurationReq)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeWpsConfigurationReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WPS_CONFIGURATION_REQ, dst__, src__); \ msg__->wpsConfig = (wpsConfig__); @@ -4292,7 +4292,7 @@ extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiSmeWpsConfigurationCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiSmeWpsConfigurationCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeWpsConfigurationCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiSmeWpsConfigurationCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WPS_CONFIGURATION_CFM, dst__, src__); \ msg__->status = (status__); diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.c b/drivers/staging/csr/csr_wifi_sme_serialize.c index 57b4cf0..a1db211 100644 --- a/drivers/staging/csr/csr_wifi_sme_serialize.c +++ b/drivers/staging/csr/csr_wifi_sme_serialize.c @@ -53,7 +53,7 @@ u8* CsrWifiSmeAdhocConfigSetReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeAdhocConfigSetReqDes(u8 *buffer, size_t length) { - CsrWifiSmeAdhocConfigSetReq *primitive = (CsrWifiSmeAdhocConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeAdhocConfigSetReq)); + CsrWifiSmeAdhocConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeAdhocConfigSetReq), GFP_KERNEL); size_t offset; offset = 0; @@ -108,7 +108,7 @@ u8* CsrWifiSmeBlacklistReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeBlacklistReqDes(u8 *buffer, size_t length) { - CsrWifiSmeBlacklistReq *primitive = (CsrWifiSmeBlacklistReq *) CsrPmemAlloc(sizeof(CsrWifiSmeBlacklistReq)); + CsrWifiSmeBlacklistReq *primitive = kmalloc(sizeof(CsrWifiSmeBlacklistReq), GFP_KERNEL); size_t offset; offset = 0; @@ -119,7 +119,7 @@ void* CsrWifiSmeBlacklistReqDes(u8 *buffer, size_t length) primitive->setAddresses = NULL; if (primitive->setAddressCount) { - primitive->setAddresses = (CsrWifiMacAddress *)CsrPmemAlloc(sizeof(CsrWifiMacAddress) * primitive->setAddressCount); + primitive->setAddresses = kmalloc(sizeof(CsrWifiMacAddress) * primitive->setAddressCount, GFP_KERNEL); } { u16 i1; @@ -169,7 +169,7 @@ u8* CsrWifiSmeCalibrationDataSetReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeCalibrationDataSetReqDes(u8 *buffer, size_t length) { - CsrWifiSmeCalibrationDataSetReq *primitive = (CsrWifiSmeCalibrationDataSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCalibrationDataSetReq)); + CsrWifiSmeCalibrationDataSetReq *primitive = kmalloc(sizeof(CsrWifiSmeCalibrationDataSetReq), GFP_KERNEL); size_t offset; offset = 0; @@ -177,7 +177,7 @@ void* CsrWifiSmeCalibrationDataSetReqDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->calibrationDataLength, buffer, &offset); if (primitive->calibrationDataLength) { - primitive->calibrationData = (u8 *)CsrPmemAlloc(primitive->calibrationDataLength); + primitive->calibrationData = kmalloc(primitive->calibrationDataLength, GFP_KERNEL); CsrMemCpyDes(primitive->calibrationData, buffer, &offset, ((u16) (primitive->calibrationDataLength))); } else @@ -227,7 +227,7 @@ u8* CsrWifiSmeCcxConfigSetReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeCcxConfigSetReqDes(u8 *buffer, size_t length) { - CsrWifiSmeCcxConfigSetReq *primitive = (CsrWifiSmeCcxConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCcxConfigSetReq)); + CsrWifiSmeCcxConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeCcxConfigSetReq), GFP_KERNEL); size_t offset; offset = 0; @@ -290,7 +290,7 @@ u8* CsrWifiSmeCoexConfigSetReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeCoexConfigSetReqDes(u8 *buffer, size_t length) { - CsrWifiSmeCoexConfigSetReq *primitive = (CsrWifiSmeCoexConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexConfigSetReq)); + CsrWifiSmeCoexConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeCoexConfigSetReq), GFP_KERNEL); size_t offset; offset = 0; @@ -366,7 +366,7 @@ u8* CsrWifiSmeConnectReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeConnectReqDes(u8 *buffer, size_t length) { - CsrWifiSmeConnectReq *primitive = (CsrWifiSmeConnectReq *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectReq)); + CsrWifiSmeConnectReq *primitive = kmalloc(sizeof(CsrWifiSmeConnectReq), GFP_KERNEL); size_t offset; offset = 0; @@ -383,7 +383,7 @@ void* CsrWifiSmeConnectReqDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->connectionConfig.mlmeAssociateReqInformationElementsLength, buffer, &offset); if (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength) { - primitive->connectionConfig.mlmeAssociateReqInformationElements = (u8 *)CsrPmemAlloc(primitive->connectionConfig.mlmeAssociateReqInformationElementsLength); + primitive->connectionConfig.mlmeAssociateReqInformationElements = kmalloc(primitive->connectionConfig.mlmeAssociateReqInformationElementsLength, GFP_KERNEL); CsrMemCpyDes(primitive->connectionConfig.mlmeAssociateReqInformationElements, buffer, &offset, ((u16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength))); } else @@ -432,7 +432,7 @@ u8* CsrWifiSmeHostConfigSetReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeHostConfigSetReqDes(u8 *buffer, size_t length) { - CsrWifiSmeHostConfigSetReq *primitive = (CsrWifiSmeHostConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeHostConfigSetReq)); + CsrWifiSmeHostConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeHostConfigSetReq), GFP_KERNEL); size_t offset; offset = 0; @@ -497,7 +497,7 @@ u8* CsrWifiSmeKeyReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeKeyReqDes(u8 *buffer, size_t length) { - CsrWifiSmeKeyReq *primitive = (CsrWifiSmeKeyReq *) CsrPmemAlloc(sizeof(CsrWifiSmeKeyReq)); + CsrWifiSmeKeyReq *primitive = kmalloc(sizeof(CsrWifiSmeKeyReq), GFP_KERNEL); size_t offset; offset = 0; @@ -553,7 +553,7 @@ u8* CsrWifiSmeMibConfigSetReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeMibConfigSetReqDes(u8 *buffer, size_t length) { - CsrWifiSmeMibConfigSetReq *primitive = (CsrWifiSmeMibConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibConfigSetReq)); + CsrWifiSmeMibConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeMibConfigSetReq), GFP_KERNEL); size_t offset; offset = 0; @@ -596,7 +596,7 @@ u8* CsrWifiSmeMibGetNextReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeMibGetNextReqDes(u8 *buffer, size_t length) { - CsrWifiSmeMibGetNextReq *primitive = (CsrWifiSmeMibGetNextReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetNextReq)); + CsrWifiSmeMibGetNextReq *primitive = kmalloc(sizeof(CsrWifiSmeMibGetNextReq), GFP_KERNEL); size_t offset; offset = 0; @@ -604,7 +604,7 @@ void* CsrWifiSmeMibGetNextReqDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->mibAttributeLength, buffer, &offset); if (primitive->mibAttributeLength) { - primitive->mibAttribute = (u8 *)CsrPmemAlloc(primitive->mibAttributeLength); + primitive->mibAttribute = kmalloc(primitive->mibAttributeLength, GFP_KERNEL); CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((u16) (primitive->mibAttributeLength))); } else @@ -652,7 +652,7 @@ u8* CsrWifiSmeMibGetReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeMibGetReqDes(u8 *buffer, size_t length) { - CsrWifiSmeMibGetReq *primitive = (CsrWifiSmeMibGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetReq)); + CsrWifiSmeMibGetReq *primitive = kmalloc(sizeof(CsrWifiSmeMibGetReq), GFP_KERNEL); size_t offset; offset = 0; @@ -660,7 +660,7 @@ void* CsrWifiSmeMibGetReqDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->mibAttributeLength, buffer, &offset); if (primitive->mibAttributeLength) { - primitive->mibAttribute = (u8 *)CsrPmemAlloc(primitive->mibAttributeLength); + primitive->mibAttribute = kmalloc(primitive->mibAttributeLength, GFP_KERNEL); CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((u16) (primitive->mibAttributeLength))); } else @@ -708,7 +708,7 @@ u8* CsrWifiSmeMibSetReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeMibSetReqDes(u8 *buffer, size_t length) { - CsrWifiSmeMibSetReq *primitive = (CsrWifiSmeMibSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMibSetReq)); + CsrWifiSmeMibSetReq *primitive = kmalloc(sizeof(CsrWifiSmeMibSetReq), GFP_KERNEL); size_t offset; offset = 0; @@ -716,7 +716,7 @@ void* CsrWifiSmeMibSetReqDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->mibAttributeLength, buffer, &offset); if (primitive->mibAttributeLength) { - primitive->mibAttribute = (u8 *)CsrPmemAlloc(primitive->mibAttributeLength); + primitive->mibAttribute = kmalloc(primitive->mibAttributeLength, GFP_KERNEL); CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((u16) (primitive->mibAttributeLength))); } else @@ -777,7 +777,7 @@ u8* CsrWifiSmeMulticastAddressReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeMulticastAddressReqDes(u8 *buffer, size_t length) { - CsrWifiSmeMulticastAddressReq *primitive = (CsrWifiSmeMulticastAddressReq *) CsrPmemAlloc(sizeof(CsrWifiSmeMulticastAddressReq)); + CsrWifiSmeMulticastAddressReq *primitive = kmalloc(sizeof(CsrWifiSmeMulticastAddressReq), GFP_KERNEL); size_t offset; offset = 0; @@ -788,7 +788,7 @@ void* CsrWifiSmeMulticastAddressReqDes(u8 *buffer, size_t length) primitive->setAddresses = NULL; if (primitive->setAddressesCount) { - primitive->setAddresses = (CsrWifiMacAddress *)CsrPmemAlloc(sizeof(CsrWifiMacAddress) * primitive->setAddressesCount); + primitive->setAddresses = kmalloc(sizeof(CsrWifiMacAddress) * primitive->setAddressesCount, GFP_KERNEL); } { u16 i1; @@ -844,7 +844,7 @@ u8* CsrWifiSmePacketFilterSetReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmePacketFilterSetReqDes(u8 *buffer, size_t length) { - CsrWifiSmePacketFilterSetReq *primitive = (CsrWifiSmePacketFilterSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmePacketFilterSetReq)); + CsrWifiSmePacketFilterSetReq *primitive = kmalloc(sizeof(CsrWifiSmePacketFilterSetReq), GFP_KERNEL); size_t offset; offset = 0; @@ -853,7 +853,7 @@ void* CsrWifiSmePacketFilterSetReqDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->filterLength, buffer, &offset); if (primitive->filterLength) { - primitive->filter = (u8 *)CsrPmemAlloc(primitive->filterLength); + primitive->filter = kmalloc(primitive->filterLength, GFP_KERNEL); CsrMemCpyDes(primitive->filter, buffer, &offset, ((u16) (primitive->filterLength))); } else @@ -918,7 +918,7 @@ u8* CsrWifiSmePmkidReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmePmkidReqDes(u8 *buffer, size_t length) { - CsrWifiSmePmkidReq *primitive = (CsrWifiSmePmkidReq *) CsrPmemAlloc(sizeof(CsrWifiSmePmkidReq)); + CsrWifiSmePmkidReq *primitive = kmalloc(sizeof(CsrWifiSmePmkidReq), GFP_KERNEL); size_t offset; offset = 0; @@ -929,7 +929,7 @@ void* CsrWifiSmePmkidReqDes(u8 *buffer, size_t length) primitive->setPmkids = NULL; if (primitive->setPmkidsCount) { - primitive->setPmkids = (CsrWifiSmePmkid *)CsrPmemAlloc(sizeof(CsrWifiSmePmkid) * primitive->setPmkidsCount); + primitive->setPmkids = kmalloc(sizeof(CsrWifiSmePmkid) * primitive->setPmkidsCount, GFP_KERNEL); } { u16 i1; @@ -986,7 +986,7 @@ u8* CsrWifiSmePowerConfigSetReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmePowerConfigSetReqDes(u8 *buffer, size_t length) { - CsrWifiSmePowerConfigSetReq *primitive = (CsrWifiSmePowerConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmePowerConfigSetReq)); + CsrWifiSmePowerConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmePowerConfigSetReq), GFP_KERNEL); size_t offset; offset = 0; @@ -1077,7 +1077,7 @@ u8* CsrWifiSmeRoamingConfigSetReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeRoamingConfigSetReqDes(u8 *buffer, size_t length) { - CsrWifiSmeRoamingConfigSetReq *primitive = (CsrWifiSmeRoamingConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamingConfigSetReq)); + CsrWifiSmeRoamingConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeRoamingConfigSetReq), GFP_KERNEL); size_t offset; offset = 0; @@ -1182,7 +1182,7 @@ u8* CsrWifiSmeScanConfigSetReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeScanConfigSetReqDes(u8 *buffer, size_t length) { - CsrWifiSmeScanConfigSetReq *primitive = (CsrWifiSmeScanConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeScanConfigSetReq)); + CsrWifiSmeScanConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeScanConfigSetReq), GFP_KERNEL); size_t offset; offset = 0; @@ -1210,7 +1210,7 @@ void* CsrWifiSmeScanConfigSetReqDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->scanConfig.passiveChannelListCount, buffer, &offset); if (primitive->scanConfig.passiveChannelListCount) { - primitive->scanConfig.passiveChannelList = (u8 *)CsrPmemAlloc(primitive->scanConfig.passiveChannelListCount); + primitive->scanConfig.passiveChannelList = kmalloc(primitive->scanConfig.passiveChannelListCount, GFP_KERNEL); CsrMemCpyDes(primitive->scanConfig.passiveChannelList, buffer, &offset, ((u16) (primitive->scanConfig.passiveChannelListCount))); } else @@ -1291,7 +1291,7 @@ u8* CsrWifiSmeScanFullReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeScanFullReqDes(u8 *buffer, size_t length) { - CsrWifiSmeScanFullReq *primitive = (CsrWifiSmeScanFullReq *) CsrPmemAlloc(sizeof(CsrWifiSmeScanFullReq)); + CsrWifiSmeScanFullReq *primitive = kmalloc(sizeof(CsrWifiSmeScanFullReq), GFP_KERNEL); size_t offset; offset = 0; @@ -1300,7 +1300,7 @@ void* CsrWifiSmeScanFullReqDes(u8 *buffer, size_t length) primitive->ssid = NULL; if (primitive->ssidCount) { - primitive->ssid = (CsrWifiSsid *)CsrPmemAlloc(sizeof(CsrWifiSsid) * primitive->ssidCount); + primitive->ssid = kmalloc(sizeof(CsrWifiSsid) * primitive->ssidCount, GFP_KERNEL); } { u16 i1; @@ -1317,7 +1317,7 @@ void* CsrWifiSmeScanFullReqDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->channelListCount, buffer, &offset); if (primitive->channelListCount) { - primitive->channelList = (u8 *)CsrPmemAlloc(primitive->channelListCount); + primitive->channelList = kmalloc(primitive->channelListCount, GFP_KERNEL); CsrMemCpyDes(primitive->channelList, buffer, &offset, ((u16) (primitive->channelListCount))); } else @@ -1327,7 +1327,7 @@ void* CsrWifiSmeScanFullReqDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->probeIeLength, buffer, &offset); if (primitive->probeIeLength) { - primitive->probeIe = (u8 *)CsrPmemAlloc(primitive->probeIeLength); + primitive->probeIe = kmalloc(primitive->probeIeLength, GFP_KERNEL); CsrMemCpyDes(primitive->probeIe, buffer, &offset, ((u16) (primitive->probeIeLength))); } else @@ -1383,7 +1383,7 @@ u8* CsrWifiSmeSmeStaConfigSetReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeSmeStaConfigSetReqDes(u8 *buffer, size_t length) { - CsrWifiSmeSmeStaConfigSetReq *primitive = (CsrWifiSmeSmeStaConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeStaConfigSetReq)); + CsrWifiSmeSmeStaConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeSmeStaConfigSetReq), GFP_KERNEL); size_t offset; offset = 0; @@ -1445,7 +1445,7 @@ u8* CsrWifiSmeTspecReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeTspecReqDes(u8 *buffer, size_t length) { - CsrWifiSmeTspecReq *primitive = (CsrWifiSmeTspecReq *) CsrPmemAlloc(sizeof(CsrWifiSmeTspecReq)); + CsrWifiSmeTspecReq *primitive = kmalloc(sizeof(CsrWifiSmeTspecReq), GFP_KERNEL); size_t offset; offset = 0; @@ -1458,7 +1458,7 @@ void* CsrWifiSmeTspecReqDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->tspecLength, buffer, &offset); if (primitive->tspecLength) { - primitive->tspec = (u8 *)CsrPmemAlloc(primitive->tspecLength); + primitive->tspec = kmalloc(primitive->tspecLength, GFP_KERNEL); CsrMemCpyDes(primitive->tspec, buffer, &offset, ((u16) (primitive->tspecLength))); } else @@ -1468,7 +1468,7 @@ void* CsrWifiSmeTspecReqDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->tclasLength, buffer, &offset); if (primitive->tclasLength) { - primitive->tclas = (u8 *)CsrPmemAlloc(primitive->tclasLength); + primitive->tclas = kmalloc(primitive->tclasLength, GFP_KERNEL); CsrMemCpyDes(primitive->tclas, buffer, &offset, ((u16) (primitive->tclasLength))); } else @@ -1533,7 +1533,7 @@ u8* CsrWifiSmeWifiFlightmodeReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeWifiFlightmodeReqDes(u8 *buffer, size_t length) { - CsrWifiSmeWifiFlightmodeReq *primitive = (CsrWifiSmeWifiFlightmodeReq *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiFlightmodeReq)); + CsrWifiSmeWifiFlightmodeReq *primitive = kmalloc(sizeof(CsrWifiSmeWifiFlightmodeReq), GFP_KERNEL); size_t offset; offset = 0; @@ -1543,7 +1543,7 @@ void* CsrWifiSmeWifiFlightmodeReqDes(u8 *buffer, size_t length) primitive->mibFiles = NULL; if (primitive->mibFilesCount) { - primitive->mibFiles = (CsrWifiSmeDataBlock *)CsrPmemAlloc(sizeof(CsrWifiSmeDataBlock) * primitive->mibFilesCount); + primitive->mibFiles = kmalloc(sizeof(CsrWifiSmeDataBlock) * primitive->mibFilesCount, GFP_KERNEL); } { u16 i1; @@ -1552,7 +1552,7 @@ void* CsrWifiSmeWifiFlightmodeReqDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->mibFiles[i1].length, buffer, &offset); if (primitive->mibFiles[i1].length) { - primitive->mibFiles[i1].data = (u8 *)CsrPmemAlloc(primitive->mibFiles[i1].length); + primitive->mibFiles[i1].data = kmalloc(primitive->mibFiles[i1].length, GFP_KERNEL); CsrMemCpyDes(primitive->mibFiles[i1].data, buffer, &offset, ((u16) (primitive->mibFiles[i1].length))); } else @@ -1625,7 +1625,7 @@ u8* CsrWifiSmeWifiOnReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeWifiOnReqDes(u8 *buffer, size_t length) { - CsrWifiSmeWifiOnReq *primitive = (CsrWifiSmeWifiOnReq *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiOnReq)); + CsrWifiSmeWifiOnReq *primitive = kmalloc(sizeof(CsrWifiSmeWifiOnReq), GFP_KERNEL); size_t offset; offset = 0; @@ -1635,7 +1635,7 @@ void* CsrWifiSmeWifiOnReqDes(u8 *buffer, size_t length) primitive->mibFiles = NULL; if (primitive->mibFilesCount) { - primitive->mibFiles = (CsrWifiSmeDataBlock *)CsrPmemAlloc(sizeof(CsrWifiSmeDataBlock) * primitive->mibFilesCount); + primitive->mibFiles = kmalloc(sizeof(CsrWifiSmeDataBlock) * primitive->mibFilesCount, GFP_KERNEL); } { u16 i1; @@ -1644,7 +1644,7 @@ void* CsrWifiSmeWifiOnReqDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->mibFiles[i1].length, buffer, &offset); if (primitive->mibFiles[i1].length) { - primitive->mibFiles[i1].data = (u8 *)CsrPmemAlloc(primitive->mibFiles[i1].length); + primitive->mibFiles[i1].data = kmalloc(primitive->mibFiles[i1].length, GFP_KERNEL); CsrMemCpyDes(primitive->mibFiles[i1].data, buffer, &offset, ((u16) (primitive->mibFiles[i1].length))); } else @@ -1712,7 +1712,7 @@ u8* CsrWifiSmeCloakedSsidsSetReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeCloakedSsidsSetReqDes(u8 *buffer, size_t length) { - CsrWifiSmeCloakedSsidsSetReq *primitive = (CsrWifiSmeCloakedSsidsSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeCloakedSsidsSetReq)); + CsrWifiSmeCloakedSsidsSetReq *primitive = kmalloc(sizeof(CsrWifiSmeCloakedSsidsSetReq), GFP_KERNEL); size_t offset; offset = 0; @@ -1721,7 +1721,7 @@ void* CsrWifiSmeCloakedSsidsSetReqDes(u8 *buffer, size_t length) primitive->cloakedSsids.cloakedSsids = NULL; if (primitive->cloakedSsids.cloakedSsidsCount) { - primitive->cloakedSsids.cloakedSsids = (CsrWifiSsid *)CsrPmemAlloc(sizeof(CsrWifiSsid) * primitive->cloakedSsids.cloakedSsidsCount); + primitive->cloakedSsids.cloakedSsids = kmalloc(sizeof(CsrWifiSsid) * primitive->cloakedSsids.cloakedSsidsCount, GFP_KERNEL); } { u16 i2; @@ -1772,7 +1772,7 @@ u8* CsrWifiSmeSmeCommonConfigSetReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeSmeCommonConfigSetReqDes(u8 *buffer, size_t length) { - CsrWifiSmeSmeCommonConfigSetReq *primitive = (CsrWifiSmeSmeCommonConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeCommonConfigSetReq)); + CsrWifiSmeSmeCommonConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeSmeCommonConfigSetReq), GFP_KERNEL); size_t offset; offset = 0; @@ -1853,7 +1853,7 @@ u8* CsrWifiSmeWpsConfigurationReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeWpsConfigurationReqDes(u8 *buffer, size_t length) { - CsrWifiSmeWpsConfigurationReq *primitive = (CsrWifiSmeWpsConfigurationReq *) CsrPmemAlloc(sizeof(CsrWifiSmeWpsConfigurationReq)); + CsrWifiSmeWpsConfigurationReq *primitive = kmalloc(sizeof(CsrWifiSmeWpsConfigurationReq), GFP_KERNEL); size_t offset; offset = 0; @@ -1874,7 +1874,7 @@ void* CsrWifiSmeWpsConfigurationReqDes(u8 *buffer, size_t length) primitive->wpsConfig.secondaryDeviceType = NULL; if (primitive->wpsConfig.secondaryDeviceTypeCount) { - primitive->wpsConfig.secondaryDeviceType = (CsrWifiSmeWpsDeviceType *)CsrPmemAlloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->wpsConfig.secondaryDeviceTypeCount); + primitive->wpsConfig.secondaryDeviceType = kmalloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->wpsConfig.secondaryDeviceTypeCount, GFP_KERNEL); } { u16 i2; @@ -1927,7 +1927,7 @@ u8* CsrWifiSmeSetReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeSetReqDes(u8 *buffer, size_t length) { - CsrWifiSmeSetReq *primitive = (CsrWifiSmeSetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeSetReq)); + CsrWifiSmeSetReq *primitive = kmalloc(sizeof(CsrWifiSmeSetReq), GFP_KERNEL); size_t offset; offset = 0; @@ -1935,7 +1935,7 @@ void* CsrWifiSmeSetReqDes(u8 *buffer, size_t length) CsrUint32Des((u32 *) &primitive->dataLength, buffer, &offset); if (primitive->dataLength) { - primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); + primitive->data = kmalloc(primitive->dataLength, GFP_KERNEL); CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength))); } else @@ -1985,7 +1985,7 @@ u8* CsrWifiSmeAdhocConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeAdhocConfigGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeAdhocConfigGetCfm *primitive = (CsrWifiSmeAdhocConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeAdhocConfigGetCfm)); + CsrWifiSmeAdhocConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeAdhocConfigGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -2107,7 +2107,7 @@ u8* CsrWifiSmeAssociationCompleteIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeAssociationCompleteIndDes(u8 *buffer, size_t length) { - CsrWifiSmeAssociationCompleteInd *primitive = (CsrWifiSmeAssociationCompleteInd *) CsrPmemAlloc(sizeof(CsrWifiSmeAssociationCompleteInd)); + CsrWifiSmeAssociationCompleteInd *primitive = kmalloc(sizeof(CsrWifiSmeAssociationCompleteInd), GFP_KERNEL); size_t offset; offset = 0; @@ -2130,7 +2130,7 @@ void* CsrWifiSmeAssociationCompleteIndDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->connectionInfo.beaconFrameLength, buffer, &offset); if (primitive->connectionInfo.beaconFrameLength) { - primitive->connectionInfo.beaconFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.beaconFrameLength); + primitive->connectionInfo.beaconFrame = kmalloc(primitive->connectionInfo.beaconFrameLength, GFP_KERNEL); CsrMemCpyDes(primitive->connectionInfo.beaconFrame, buffer, &offset, ((u16) (primitive->connectionInfo.beaconFrameLength))); } else @@ -2140,7 +2140,7 @@ void* CsrWifiSmeAssociationCompleteIndDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->connectionInfo.associationReqFrameLength, buffer, &offset); if (primitive->connectionInfo.associationReqFrameLength) { - primitive->connectionInfo.associationReqFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.associationReqFrameLength); + primitive->connectionInfo.associationReqFrame = kmalloc(primitive->connectionInfo.associationReqFrameLength, GFP_KERNEL); CsrMemCpyDes(primitive->connectionInfo.associationReqFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationReqFrameLength))); } else @@ -2150,7 +2150,7 @@ void* CsrWifiSmeAssociationCompleteIndDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->connectionInfo.associationRspFrameLength, buffer, &offset); if (primitive->connectionInfo.associationRspFrameLength) { - primitive->connectionInfo.associationRspFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.associationRspFrameLength); + primitive->connectionInfo.associationRspFrame = kmalloc(primitive->connectionInfo.associationRspFrameLength, GFP_KERNEL); CsrMemCpyDes(primitive->connectionInfo.associationRspFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationRspFrameLength))); } else @@ -2160,7 +2160,7 @@ void* CsrWifiSmeAssociationCompleteIndDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->connectionInfo.assocScanInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocScanInfoElementsLength) { - primitive->connectionInfo.assocScanInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocScanInfoElementsLength); + primitive->connectionInfo.assocScanInfoElements = kmalloc(primitive->connectionInfo.assocScanInfoElementsLength, GFP_KERNEL); CsrMemCpyDes(primitive->connectionInfo.assocScanInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocScanInfoElementsLength))); } else @@ -2173,7 +2173,7 @@ void* CsrWifiSmeAssociationCompleteIndDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocReqInfoElementsLength) { - primitive->connectionInfo.assocReqInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocReqInfoElementsLength); + primitive->connectionInfo.assocReqInfoElements = kmalloc(primitive->connectionInfo.assocReqInfoElementsLength, GFP_KERNEL); CsrMemCpyDes(primitive->connectionInfo.assocReqInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocReqInfoElementsLength))); } else @@ -2186,7 +2186,7 @@ void* CsrWifiSmeAssociationCompleteIndDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocRspInfoElementsLength) { - primitive->connectionInfo.assocRspInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocRspInfoElementsLength); + primitive->connectionInfo.assocRspInfoElements = kmalloc(primitive->connectionInfo.assocRspInfoElementsLength, GFP_KERNEL); CsrMemCpyDes(primitive->connectionInfo.assocRspInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocRspInfoElementsLength))); } else @@ -2240,7 +2240,7 @@ u8* CsrWifiSmeAssociationStartIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeAssociationStartIndDes(u8 *buffer, size_t length) { - CsrWifiSmeAssociationStartInd *primitive = (CsrWifiSmeAssociationStartInd *) CsrPmemAlloc(sizeof(CsrWifiSmeAssociationStartInd)); + CsrWifiSmeAssociationStartInd *primitive = kmalloc(sizeof(CsrWifiSmeAssociationStartInd), GFP_KERNEL); size_t offset; offset = 0; @@ -2297,7 +2297,7 @@ u8* CsrWifiSmeBlacklistCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeBlacklistCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeBlacklistCfm *primitive = (CsrWifiSmeBlacklistCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeBlacklistCfm)); + CsrWifiSmeBlacklistCfm *primitive = kmalloc(sizeof(CsrWifiSmeBlacklistCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -2309,7 +2309,7 @@ void* CsrWifiSmeBlacklistCfmDes(u8 *buffer, size_t length) primitive->getAddresses = NULL; if (primitive->getAddressCount) { - primitive->getAddresses = (CsrWifiMacAddress *)CsrPmemAlloc(sizeof(CsrWifiMacAddress) * primitive->getAddressCount); + primitive->getAddresses = kmalloc(sizeof(CsrWifiMacAddress) * primitive->getAddressCount, GFP_KERNEL); } { u16 i1; @@ -2361,7 +2361,7 @@ u8* CsrWifiSmeCalibrationDataGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeCalibrationDataGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeCalibrationDataGetCfm *primitive = (CsrWifiSmeCalibrationDataGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCalibrationDataGetCfm)); + CsrWifiSmeCalibrationDataGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeCalibrationDataGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -2370,7 +2370,7 @@ void* CsrWifiSmeCalibrationDataGetCfmDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->calibrationDataLength, buffer, &offset); if (primitive->calibrationDataLength) { - primitive->calibrationData = (u8 *)CsrPmemAlloc(primitive->calibrationDataLength); + primitive->calibrationData = kmalloc(primitive->calibrationDataLength, GFP_KERNEL); CsrMemCpyDes(primitive->calibrationData, buffer, &offset, ((u16) (primitive->calibrationDataLength))); } else @@ -2422,7 +2422,7 @@ u8* CsrWifiSmeCcxConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeCcxConfigGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeCcxConfigGetCfm *primitive = (CsrWifiSmeCcxConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCcxConfigGetCfm)); + CsrWifiSmeCcxConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeCcxConfigGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -2462,7 +2462,7 @@ u8* CsrWifiSmeCcxConfigSetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeCcxConfigSetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeCcxConfigSetCfm *primitive = (CsrWifiSmeCcxConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCcxConfigSetCfm)); + CsrWifiSmeCcxConfigSetCfm *primitive = kmalloc(sizeof(CsrWifiSmeCcxConfigSetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -2524,7 +2524,7 @@ u8* CsrWifiSmeCoexConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeCoexConfigGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeCoexConfigGetCfm *primitive = (CsrWifiSmeCoexConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexConfigGetCfm)); + CsrWifiSmeCoexConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeCoexConfigGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -2591,7 +2591,7 @@ u8* CsrWifiSmeCoexInfoGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeCoexInfoGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeCoexInfoGetCfm *primitive = (CsrWifiSmeCoexInfoGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCoexInfoGetCfm)); + CsrWifiSmeCoexInfoGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeCoexInfoGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -2636,7 +2636,7 @@ u8* CsrWifiSmeConnectCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeConnectCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeConnectCfm *primitive = (CsrWifiSmeConnectCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectCfm)); + CsrWifiSmeConnectCfm *primitive = kmalloc(sizeof(CsrWifiSmeConnectCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -2702,7 +2702,7 @@ u8* CsrWifiSmeConnectionConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeConnectionConfigGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeConnectionConfigGetCfm *primitive = (CsrWifiSmeConnectionConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionConfigGetCfm)); + CsrWifiSmeConnectionConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeConnectionConfigGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -2720,7 +2720,7 @@ void* CsrWifiSmeConnectionConfigGetCfmDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->connectionConfig.mlmeAssociateReqInformationElementsLength, buffer, &offset); if (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength) { - primitive->connectionConfig.mlmeAssociateReqInformationElements = (u8 *)CsrPmemAlloc(primitive->connectionConfig.mlmeAssociateReqInformationElementsLength); + primitive->connectionConfig.mlmeAssociateReqInformationElements = kmalloc(primitive->connectionConfig.mlmeAssociateReqInformationElementsLength, GFP_KERNEL); CsrMemCpyDes(primitive->connectionConfig.mlmeAssociateReqInformationElements, buffer, &offset, ((u16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength))); } else @@ -2848,7 +2848,7 @@ u8* CsrWifiSmeConnectionInfoGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeConnectionInfoGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeConnectionInfoGetCfm *primitive = (CsrWifiSmeConnectionInfoGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionInfoGetCfm)); + CsrWifiSmeConnectionInfoGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeConnectionInfoGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -2871,7 +2871,7 @@ void* CsrWifiSmeConnectionInfoGetCfmDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->connectionInfo.beaconFrameLength, buffer, &offset); if (primitive->connectionInfo.beaconFrameLength) { - primitive->connectionInfo.beaconFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.beaconFrameLength); + primitive->connectionInfo.beaconFrame = kmalloc(primitive->connectionInfo.beaconFrameLength, GFP_KERNEL); CsrMemCpyDes(primitive->connectionInfo.beaconFrame, buffer, &offset, ((u16) (primitive->connectionInfo.beaconFrameLength))); } else @@ -2881,7 +2881,7 @@ void* CsrWifiSmeConnectionInfoGetCfmDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->connectionInfo.associationReqFrameLength, buffer, &offset); if (primitive->connectionInfo.associationReqFrameLength) { - primitive->connectionInfo.associationReqFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.associationReqFrameLength); + primitive->connectionInfo.associationReqFrame = kmalloc(primitive->connectionInfo.associationReqFrameLength, GFP_KERNEL); CsrMemCpyDes(primitive->connectionInfo.associationReqFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationReqFrameLength))); } else @@ -2891,7 +2891,7 @@ void* CsrWifiSmeConnectionInfoGetCfmDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->connectionInfo.associationRspFrameLength, buffer, &offset); if (primitive->connectionInfo.associationRspFrameLength) { - primitive->connectionInfo.associationRspFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.associationRspFrameLength); + primitive->connectionInfo.associationRspFrame = kmalloc(primitive->connectionInfo.associationRspFrameLength, GFP_KERNEL); CsrMemCpyDes(primitive->connectionInfo.associationRspFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationRspFrameLength))); } else @@ -2901,7 +2901,7 @@ void* CsrWifiSmeConnectionInfoGetCfmDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->connectionInfo.assocScanInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocScanInfoElementsLength) { - primitive->connectionInfo.assocScanInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocScanInfoElementsLength); + primitive->connectionInfo.assocScanInfoElements = kmalloc(primitive->connectionInfo.assocScanInfoElementsLength, GFP_KERNEL); CsrMemCpyDes(primitive->connectionInfo.assocScanInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocScanInfoElementsLength))); } else @@ -2914,7 +2914,7 @@ void* CsrWifiSmeConnectionInfoGetCfmDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocReqInfoElementsLength) { - primitive->connectionInfo.assocReqInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocReqInfoElementsLength); + primitive->connectionInfo.assocReqInfoElements = kmalloc(primitive->connectionInfo.assocReqInfoElementsLength, GFP_KERNEL); CsrMemCpyDes(primitive->connectionInfo.assocReqInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocReqInfoElementsLength))); } else @@ -2927,7 +2927,7 @@ void* CsrWifiSmeConnectionInfoGetCfmDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocRspInfoElementsLength) { - primitive->connectionInfo.assocRspInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocRspInfoElementsLength); + primitive->connectionInfo.assocRspInfoElements = kmalloc(primitive->connectionInfo.assocRspInfoElementsLength, GFP_KERNEL); CsrMemCpyDes(primitive->connectionInfo.assocRspInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocRspInfoElementsLength))); } else @@ -2978,7 +2978,7 @@ u8* CsrWifiSmeConnectionQualityIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeConnectionQualityIndDes(u8 *buffer, size_t length) { - CsrWifiSmeConnectionQualityInd *primitive = (CsrWifiSmeConnectionQualityInd *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionQualityInd)); + CsrWifiSmeConnectionQualityInd *primitive = kmalloc(sizeof(CsrWifiSmeConnectionQualityInd), GFP_KERNEL); size_t offset; offset = 0; @@ -3065,7 +3065,7 @@ u8* CsrWifiSmeConnectionStatsGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeConnectionStatsGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeConnectionStatsGetCfm *primitive = (CsrWifiSmeConnectionStatsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeConnectionStatsGetCfm)); + CsrWifiSmeConnectionStatsGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeConnectionStatsGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -3126,7 +3126,7 @@ u8* CsrWifiSmeDisconnectCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeDisconnectCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeDisconnectCfm *primitive = (CsrWifiSmeDisconnectCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeDisconnectCfm)); + CsrWifiSmeDisconnectCfm *primitive = kmalloc(sizeof(CsrWifiSmeDisconnectCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -3166,7 +3166,7 @@ u8* CsrWifiSmeHostConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeHostConfigGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeHostConfigGetCfm *primitive = (CsrWifiSmeHostConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeHostConfigGetCfm)); + CsrWifiSmeHostConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeHostConfigGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -3204,7 +3204,7 @@ u8* CsrWifiSmeHostConfigSetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeHostConfigSetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeHostConfigSetCfm *primitive = (CsrWifiSmeHostConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeHostConfigSetCfm)); + CsrWifiSmeHostConfigSetCfm *primitive = kmalloc(sizeof(CsrWifiSmeHostConfigSetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -3240,7 +3240,7 @@ u8* CsrWifiSmeIbssStationIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeIbssStationIndDes(u8 *buffer, size_t length) { - CsrWifiSmeIbssStationInd *primitive = (CsrWifiSmeIbssStationInd *) CsrPmemAlloc(sizeof(CsrWifiSmeIbssStationInd)); + CsrWifiSmeIbssStationInd *primitive = kmalloc(sizeof(CsrWifiSmeIbssStationInd), GFP_KERNEL); size_t offset; offset = 0; @@ -3282,7 +3282,7 @@ u8* CsrWifiSmeKeyCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeKeyCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeKeyCfm *primitive = (CsrWifiSmeKeyCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeKeyCfm)); + CsrWifiSmeKeyCfm *primitive = kmalloc(sizeof(CsrWifiSmeKeyCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -3325,7 +3325,7 @@ u8* CsrWifiSmeLinkQualityGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeLinkQualityGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeLinkQualityGetCfm *primitive = (CsrWifiSmeLinkQualityGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeLinkQualityGetCfm)); + CsrWifiSmeLinkQualityGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeLinkQualityGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -3448,7 +3448,7 @@ u8* CsrWifiSmeMediaStatusIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeMediaStatusIndDes(u8 *buffer, size_t length) { - CsrWifiSmeMediaStatusInd *primitive = (CsrWifiSmeMediaStatusInd *) CsrPmemAlloc(sizeof(CsrWifiSmeMediaStatusInd)); + CsrWifiSmeMediaStatusInd *primitive = kmalloc(sizeof(CsrWifiSmeMediaStatusInd), GFP_KERNEL); size_t offset; offset = 0; @@ -3471,7 +3471,7 @@ void* CsrWifiSmeMediaStatusIndDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->connectionInfo.beaconFrameLength, buffer, &offset); if (primitive->connectionInfo.beaconFrameLength) { - primitive->connectionInfo.beaconFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.beaconFrameLength); + primitive->connectionInfo.beaconFrame = kmalloc(primitive->connectionInfo.beaconFrameLength, GFP_KERNEL); CsrMemCpyDes(primitive->connectionInfo.beaconFrame, buffer, &offset, ((u16) (primitive->connectionInfo.beaconFrameLength))); } else @@ -3481,7 +3481,7 @@ void* CsrWifiSmeMediaStatusIndDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->connectionInfo.associationReqFrameLength, buffer, &offset); if (primitive->connectionInfo.associationReqFrameLength) { - primitive->connectionInfo.associationReqFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.associationReqFrameLength); + primitive->connectionInfo.associationReqFrame = kmalloc(primitive->connectionInfo.associationReqFrameLength, GFP_KERNEL); CsrMemCpyDes(primitive->connectionInfo.associationReqFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationReqFrameLength))); } else @@ -3491,7 +3491,7 @@ void* CsrWifiSmeMediaStatusIndDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->connectionInfo.associationRspFrameLength, buffer, &offset); if (primitive->connectionInfo.associationRspFrameLength) { - primitive->connectionInfo.associationRspFrame = (u8 *)CsrPmemAlloc(primitive->connectionInfo.associationRspFrameLength); + primitive->connectionInfo.associationRspFrame = kmalloc(primitive->connectionInfo.associationRspFrameLength, GFP_KERNEL); CsrMemCpyDes(primitive->connectionInfo.associationRspFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationRspFrameLength))); } else @@ -3501,7 +3501,7 @@ void* CsrWifiSmeMediaStatusIndDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->connectionInfo.assocScanInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocScanInfoElementsLength) { - primitive->connectionInfo.assocScanInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocScanInfoElementsLength); + primitive->connectionInfo.assocScanInfoElements = kmalloc(primitive->connectionInfo.assocScanInfoElementsLength, GFP_KERNEL); CsrMemCpyDes(primitive->connectionInfo.assocScanInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocScanInfoElementsLength))); } else @@ -3514,7 +3514,7 @@ void* CsrWifiSmeMediaStatusIndDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocReqInfoElementsLength) { - primitive->connectionInfo.assocReqInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocReqInfoElementsLength); + primitive->connectionInfo.assocReqInfoElements = kmalloc(primitive->connectionInfo.assocReqInfoElementsLength, GFP_KERNEL); CsrMemCpyDes(primitive->connectionInfo.assocReqInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocReqInfoElementsLength))); } else @@ -3527,7 +3527,7 @@ void* CsrWifiSmeMediaStatusIndDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspInfoElementsLength, buffer, &offset); if (primitive->connectionInfo.assocRspInfoElementsLength) { - primitive->connectionInfo.assocRspInfoElements = (u8 *)CsrPmemAlloc(primitive->connectionInfo.assocRspInfoElementsLength); + primitive->connectionInfo.assocRspInfoElements = kmalloc(primitive->connectionInfo.assocRspInfoElementsLength, GFP_KERNEL); CsrMemCpyDes(primitive->connectionInfo.assocRspInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocRspInfoElementsLength))); } else @@ -3586,7 +3586,7 @@ u8* CsrWifiSmeMibConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeMibConfigGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeMibConfigGetCfm *primitive = (CsrWifiSmeMibConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMibConfigGetCfm)); + CsrWifiSmeMibConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeMibConfigGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -3632,7 +3632,7 @@ u8* CsrWifiSmeMibGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeMibGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeMibGetCfm *primitive = (CsrWifiSmeMibGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetCfm)); + CsrWifiSmeMibGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeMibGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -3641,7 +3641,7 @@ void* CsrWifiSmeMibGetCfmDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->mibAttributeLength, buffer, &offset); if (primitive->mibAttributeLength) { - primitive->mibAttribute = (u8 *)CsrPmemAlloc(primitive->mibAttributeLength); + primitive->mibAttribute = kmalloc(primitive->mibAttributeLength, GFP_KERNEL); CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((u16) (primitive->mibAttributeLength))); } else @@ -3691,7 +3691,7 @@ u8* CsrWifiSmeMibGetNextCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeMibGetNextCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeMibGetNextCfm *primitive = (CsrWifiSmeMibGetNextCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMibGetNextCfm)); + CsrWifiSmeMibGetNextCfm *primitive = kmalloc(sizeof(CsrWifiSmeMibGetNextCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -3700,7 +3700,7 @@ void* CsrWifiSmeMibGetNextCfmDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->mibAttributeLength, buffer, &offset); if (primitive->mibAttributeLength) { - primitive->mibAttribute = (u8 *)CsrPmemAlloc(primitive->mibAttributeLength); + primitive->mibAttribute = kmalloc(primitive->mibAttributeLength, GFP_KERNEL); CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((u16) (primitive->mibAttributeLength))); } else @@ -3750,7 +3750,7 @@ u8* CsrWifiSmeMicFailureIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeMicFailureIndDes(u8 *buffer, size_t length) { - CsrWifiSmeMicFailureInd *primitive = (CsrWifiSmeMicFailureInd *) CsrPmemAlloc(sizeof(CsrWifiSmeMicFailureInd)); + CsrWifiSmeMicFailureInd *primitive = kmalloc(sizeof(CsrWifiSmeMicFailureInd), GFP_KERNEL); size_t offset; offset = 0; @@ -3808,7 +3808,7 @@ u8* CsrWifiSmeMulticastAddressCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeMulticastAddressCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeMulticastAddressCfm *primitive = (CsrWifiSmeMulticastAddressCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeMulticastAddressCfm)); + CsrWifiSmeMulticastAddressCfm *primitive = kmalloc(sizeof(CsrWifiSmeMulticastAddressCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -3820,7 +3820,7 @@ void* CsrWifiSmeMulticastAddressCfmDes(u8 *buffer, size_t length) primitive->getAddresses = NULL; if (primitive->getAddressesCount) { - primitive->getAddresses = (CsrWifiMacAddress *)CsrPmemAlloc(sizeof(CsrWifiMacAddress) * primitive->getAddressesCount); + primitive->getAddresses = kmalloc(sizeof(CsrWifiMacAddress) * primitive->getAddressesCount, GFP_KERNEL); } { u16 i1; @@ -3866,7 +3866,7 @@ u8* CsrWifiSmePacketFilterSetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmePacketFilterSetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmePacketFilterSetCfm *primitive = (CsrWifiSmePacketFilterSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePacketFilterSetCfm)); + CsrWifiSmePacketFilterSetCfm *primitive = kmalloc(sizeof(CsrWifiSmePacketFilterSetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -3902,7 +3902,7 @@ u8* CsrWifiSmePermanentMacAddressGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmePermanentMacAddressGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmePermanentMacAddressGetCfm *primitive = (CsrWifiSmePermanentMacAddressGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePermanentMacAddressGetCfm)); + CsrWifiSmePermanentMacAddressGetCfm *primitive = kmalloc(sizeof(CsrWifiSmePermanentMacAddressGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -3955,7 +3955,7 @@ u8* CsrWifiSmePmkidCandidateListIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmePmkidCandidateListIndDes(u8 *buffer, size_t length) { - CsrWifiSmePmkidCandidateListInd *primitive = (CsrWifiSmePmkidCandidateListInd *) CsrPmemAlloc(sizeof(CsrWifiSmePmkidCandidateListInd)); + CsrWifiSmePmkidCandidateListInd *primitive = kmalloc(sizeof(CsrWifiSmePmkidCandidateListInd), GFP_KERNEL); size_t offset; offset = 0; @@ -3965,7 +3965,7 @@ void* CsrWifiSmePmkidCandidateListIndDes(u8 *buffer, size_t length) primitive->pmkidCandidates = NULL; if (primitive->pmkidCandidatesCount) { - primitive->pmkidCandidates = (CsrWifiSmePmkidCandidate *)CsrPmemAlloc(sizeof(CsrWifiSmePmkidCandidate) * primitive->pmkidCandidatesCount); + primitive->pmkidCandidates = kmalloc(sizeof(CsrWifiSmePmkidCandidate) * primitive->pmkidCandidatesCount, GFP_KERNEL); } { u16 i1; @@ -4033,7 +4033,7 @@ u8* CsrWifiSmePmkidCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmePmkidCfmDes(u8 *buffer, size_t length) { - CsrWifiSmePmkidCfm *primitive = (CsrWifiSmePmkidCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePmkidCfm)); + CsrWifiSmePmkidCfm *primitive = kmalloc(sizeof(CsrWifiSmePmkidCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -4045,7 +4045,7 @@ void* CsrWifiSmePmkidCfmDes(u8 *buffer, size_t length) primitive->getPmkids = NULL; if (primitive->getPmkidsCount) { - primitive->getPmkids = (CsrWifiSmePmkid *)CsrPmemAlloc(sizeof(CsrWifiSmePmkid) * primitive->getPmkidsCount); + primitive->getPmkids = kmalloc(sizeof(CsrWifiSmePmkid) * primitive->getPmkidsCount, GFP_KERNEL); } { u16 i1; @@ -4104,7 +4104,7 @@ u8* CsrWifiSmePowerConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmePowerConfigGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmePowerConfigGetCfm *primitive = (CsrWifiSmePowerConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmePowerConfigGetCfm)); + CsrWifiSmePowerConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmePowerConfigGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -4152,7 +4152,7 @@ u8* CsrWifiSmeRegulatoryDomainInfoGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeRegulatoryDomainInfoGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeRegulatoryDomainInfoGetCfm *primitive = (CsrWifiSmeRegulatoryDomainInfoGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeRegulatoryDomainInfoGetCfm)); + CsrWifiSmeRegulatoryDomainInfoGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeRegulatoryDomainInfoGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -4191,7 +4191,7 @@ u8* CsrWifiSmeRoamCompleteIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeRoamCompleteIndDes(u8 *buffer, size_t length) { - CsrWifiSmeRoamCompleteInd *primitive = (CsrWifiSmeRoamCompleteInd *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamCompleteInd)); + CsrWifiSmeRoamCompleteInd *primitive = kmalloc(sizeof(CsrWifiSmeRoamCompleteInd), GFP_KERNEL); size_t offset; offset = 0; @@ -4229,7 +4229,7 @@ u8* CsrWifiSmeRoamStartIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeRoamStartIndDes(u8 *buffer, size_t length) { - CsrWifiSmeRoamStartInd *primitive = (CsrWifiSmeRoamStartInd *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamStartInd)); + CsrWifiSmeRoamStartInd *primitive = kmalloc(sizeof(CsrWifiSmeRoamStartInd), GFP_KERNEL); size_t offset; offset = 0; @@ -4318,7 +4318,7 @@ u8* CsrWifiSmeRoamingConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeRoamingConfigGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeRoamingConfigGetCfm *primitive = (CsrWifiSmeRoamingConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamingConfigGetCfm)); + CsrWifiSmeRoamingConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeRoamingConfigGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -4380,7 +4380,7 @@ u8* CsrWifiSmeRoamingConfigSetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeRoamingConfigSetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeRoamingConfigSetCfm *primitive = (CsrWifiSmeRoamingConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeRoamingConfigSetCfm)); + CsrWifiSmeRoamingConfigSetCfm *primitive = kmalloc(sizeof(CsrWifiSmeRoamingConfigSetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -4462,7 +4462,7 @@ u8* CsrWifiSmeScanConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeScanConfigGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeScanConfigGetCfm *primitive = (CsrWifiSmeScanConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeScanConfigGetCfm)); + CsrWifiSmeScanConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeScanConfigGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -4491,7 +4491,7 @@ void* CsrWifiSmeScanConfigGetCfmDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->scanConfig.passiveChannelListCount, buffer, &offset); if (primitive->scanConfig.passiveChannelListCount) { - primitive->scanConfig.passiveChannelList = (u8 *)CsrPmemAlloc(primitive->scanConfig.passiveChannelListCount); + primitive->scanConfig.passiveChannelList = kmalloc(primitive->scanConfig.passiveChannelListCount, GFP_KERNEL); CsrMemCpyDes(primitive->scanConfig.passiveChannelList, buffer, &offset, ((u16) (primitive->scanConfig.passiveChannelListCount))); } else @@ -4675,7 +4675,7 @@ u8* CsrWifiSmeScanResultIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeScanResultIndDes(u8 *buffer, size_t length) { - CsrWifiSmeScanResultInd *primitive = (CsrWifiSmeScanResultInd *) CsrPmemAlloc(sizeof(CsrWifiSmeScanResultInd)); + CsrWifiSmeScanResultInd *primitive = kmalloc(sizeof(CsrWifiSmeScanResultInd), GFP_KERNEL); size_t offset; offset = 0; @@ -4697,7 +4697,7 @@ void* CsrWifiSmeScanResultIndDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->result.informationElementsLength, buffer, &offset); if (primitive->result.informationElementsLength) { - primitive->result.informationElements = (u8 *)CsrPmemAlloc(primitive->result.informationElementsLength); + primitive->result.informationElements = kmalloc(primitive->result.informationElementsLength, GFP_KERNEL); CsrMemCpyDes(primitive->result.informationElements, buffer, &offset, ((u16) (primitive->result.informationElementsLength))); } else @@ -4717,7 +4717,7 @@ void* CsrWifiSmeScanResultIndDes(u8 *buffer, size_t length) primitive->result.deviceInfo.groupInfo.p2PClientInfo = NULL; if (primitive->result.deviceInfo.groupInfo.p2pClientInfoCount) { - primitive->result.deviceInfo.groupInfo.p2PClientInfo = (CsrWifiSmeP2pClientInfoType *)CsrPmemAlloc(sizeof(CsrWifiSmeP2pClientInfoType) * primitive->result.deviceInfo.groupInfo.p2pClientInfoCount); + primitive->result.deviceInfo.groupInfo.p2PClientInfo = kmalloc(sizeof(CsrWifiSmeP2pClientInfoType) * primitive->result.deviceInfo.groupInfo.p2pClientInfoCount, GFP_KERNEL); } { u16 i4; @@ -4732,7 +4732,7 @@ void* CsrWifiSmeScanResultIndDes(u8 *buffer, size_t length) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL; if (primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount) { - primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = (CsrWifiSmeWpsDeviceType *)CsrPmemAlloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount); + primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = kmalloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount, GFP_KERNEL); } { u16 i6; @@ -4758,7 +4758,7 @@ void* CsrWifiSmeScanResultIndDes(u8 *buffer, size_t length) primitive->result.deviceInfo.standalonedevInfo.secDeviceType = NULL; if (primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount) { - primitive->result.deviceInfo.standalonedevInfo.secDeviceType = (CsrWifiSmeWpsDeviceType *)CsrPmemAlloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount); + primitive->result.deviceInfo.standalonedevInfo.secDeviceType = kmalloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount, GFP_KERNEL); } { u16 i4; @@ -4984,7 +4984,7 @@ u8* CsrWifiSmeScanResultsGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeScanResultsGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeScanResultsGetCfm *primitive = (CsrWifiSmeScanResultsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeScanResultsGetCfm)); + CsrWifiSmeScanResultsGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeScanResultsGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -4994,7 +4994,7 @@ void* CsrWifiSmeScanResultsGetCfmDes(u8 *buffer, size_t length) primitive->scanResults = NULL; if (primitive->scanResultsCount) { - primitive->scanResults = (CsrWifiSmeScanResult *)CsrPmemAlloc(sizeof(CsrWifiSmeScanResult) * primitive->scanResultsCount); + primitive->scanResults = kmalloc(sizeof(CsrWifiSmeScanResult) * primitive->scanResultsCount, GFP_KERNEL); } { u16 i1; @@ -5017,7 +5017,7 @@ void* CsrWifiSmeScanResultsGetCfmDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->scanResults[i1].informationElementsLength, buffer, &offset); if (primitive->scanResults[i1].informationElementsLength) { - primitive->scanResults[i1].informationElements = (u8 *)CsrPmemAlloc(primitive->scanResults[i1].informationElementsLength); + primitive->scanResults[i1].informationElements = kmalloc(primitive->scanResults[i1].informationElementsLength, GFP_KERNEL); CsrMemCpyDes(primitive->scanResults[i1].informationElements, buffer, &offset, ((u16) (primitive->scanResults[i1].informationElementsLength))); } else @@ -5037,7 +5037,7 @@ void* CsrWifiSmeScanResultsGetCfmDes(u8 *buffer, size_t length) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo = NULL; if (primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount) { - primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo = (CsrWifiSmeP2pClientInfoType *)CsrPmemAlloc(sizeof(CsrWifiSmeP2pClientInfoType) * primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount); + primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo = kmalloc(sizeof(CsrWifiSmeP2pClientInfoType) * primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount, GFP_KERNEL); } { u16 i4; @@ -5052,7 +5052,7 @@ void* CsrWifiSmeScanResultsGetCfmDes(u8 *buffer, size_t length) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL; if (primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount) { - primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = (CsrWifiSmeWpsDeviceType *)CsrPmemAlloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount); + primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = kmalloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount, GFP_KERNEL); } { u16 i6; @@ -5078,7 +5078,7 @@ void* CsrWifiSmeScanResultsGetCfmDes(u8 *buffer, size_t length) primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType = NULL; if (primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount) { - primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType = (CsrWifiSmeWpsDeviceType *)CsrPmemAlloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount); + primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType = kmalloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount, GFP_KERNEL); } { u16 i4; @@ -5169,7 +5169,7 @@ u8* CsrWifiSmeSmeStaConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeSmeStaConfigGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeSmeStaConfigGetCfm *primitive = (CsrWifiSmeSmeStaConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeStaConfigGetCfm)); + CsrWifiSmeSmeStaConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeSmeStaConfigGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -5211,7 +5211,7 @@ u8* CsrWifiSmeSmeStaConfigSetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeSmeStaConfigSetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeSmeStaConfigSetCfm *primitive = (CsrWifiSmeSmeStaConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeStaConfigSetCfm)); + CsrWifiSmeSmeStaConfigSetCfm *primitive = kmalloc(sizeof(CsrWifiSmeSmeStaConfigSetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -5259,7 +5259,7 @@ u8* CsrWifiSmeStationMacAddressGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeStationMacAddressGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeStationMacAddressGetCfm *primitive = (CsrWifiSmeStationMacAddressGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeStationMacAddressGetCfm)); + CsrWifiSmeStationMacAddressGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeStationMacAddressGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -5311,7 +5311,7 @@ u8* CsrWifiSmeTspecIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeTspecIndDes(u8 *buffer, size_t length) { - CsrWifiSmeTspecInd *primitive = (CsrWifiSmeTspecInd *) CsrPmemAlloc(sizeof(CsrWifiSmeTspecInd)); + CsrWifiSmeTspecInd *primitive = kmalloc(sizeof(CsrWifiSmeTspecInd), GFP_KERNEL); size_t offset; offset = 0; @@ -5322,7 +5322,7 @@ void* CsrWifiSmeTspecIndDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->tspecLength, buffer, &offset); if (primitive->tspecLength) { - primitive->tspec = (u8 *)CsrPmemAlloc(primitive->tspecLength); + primitive->tspec = kmalloc(primitive->tspecLength, GFP_KERNEL); CsrMemCpyDes(primitive->tspec, buffer, &offset, ((u16) (primitive->tspecLength))); } else @@ -5378,7 +5378,7 @@ u8* CsrWifiSmeTspecCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeTspecCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeTspecCfm *primitive = (CsrWifiSmeTspecCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeTspecCfm)); + CsrWifiSmeTspecCfm *primitive = kmalloc(sizeof(CsrWifiSmeTspecCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -5390,7 +5390,7 @@ void* CsrWifiSmeTspecCfmDes(u8 *buffer, size_t length) CsrUint16Des((u16 *) &primitive->tspecLength, buffer, &offset); if (primitive->tspecLength) { - primitive->tspec = (u8 *)CsrPmemAlloc(primitive->tspecLength); + primitive->tspec = kmalloc(primitive->tspecLength, GFP_KERNEL); CsrMemCpyDes(primitive->tspec, buffer, &offset, ((u16) (primitive->tspecLength))); } else @@ -5451,7 +5451,7 @@ u8* CsrWifiSmeVersionsGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeVersionsGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeVersionsGetCfm *primitive = (CsrWifiSmeVersionsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeVersionsGetCfm)); + CsrWifiSmeVersionsGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeVersionsGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -5521,7 +5521,7 @@ u8* CsrWifiSmeCloakedSsidsGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeCloakedSsidsGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeCloakedSsidsGetCfm *primitive = (CsrWifiSmeCloakedSsidsGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeCloakedSsidsGetCfm)); + CsrWifiSmeCloakedSsidsGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeCloakedSsidsGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -5531,7 +5531,7 @@ void* CsrWifiSmeCloakedSsidsGetCfmDes(u8 *buffer, size_t length) primitive->cloakedSsids.cloakedSsids = NULL; if (primitive->cloakedSsids.cloakedSsidsCount) { - primitive->cloakedSsids.cloakedSsids = (CsrWifiSsid *)CsrPmemAlloc(sizeof(CsrWifiSsid) * primitive->cloakedSsids.cloakedSsidsCount); + primitive->cloakedSsids.cloakedSsids = kmalloc(sizeof(CsrWifiSsid) * primitive->cloakedSsids.cloakedSsidsCount, GFP_KERNEL); } { u16 i2; @@ -5576,7 +5576,7 @@ u8* CsrWifiSmeWifiOnIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeWifiOnIndDes(u8 *buffer, size_t length) { - CsrWifiSmeWifiOnInd *primitive = (CsrWifiSmeWifiOnInd *) CsrPmemAlloc(sizeof(CsrWifiSmeWifiOnInd)); + CsrWifiSmeWifiOnInd *primitive = kmalloc(sizeof(CsrWifiSmeWifiOnInd), GFP_KERNEL); size_t offset; offset = 0; @@ -5617,7 +5617,7 @@ u8* CsrWifiSmeSmeCommonConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeSmeCommonConfigGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeSmeCommonConfigGetCfm *primitive = (CsrWifiSmeSmeCommonConfigGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeSmeCommonConfigGetCfm)); + CsrWifiSmeSmeCommonConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeSmeCommonConfigGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -5658,7 +5658,7 @@ u8* CsrWifiSmeInterfaceCapabilityGetCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeInterfaceCapabilityGetCfmDes(u8 *buffer, size_t length) { - CsrWifiSmeInterfaceCapabilityGetCfm *primitive = (CsrWifiSmeInterfaceCapabilityGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeInterfaceCapabilityGetCfm)); + CsrWifiSmeInterfaceCapabilityGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeInterfaceCapabilityGetCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -5694,7 +5694,7 @@ u8* CsrWifiSmeErrorIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeErrorIndDes(u8 *buffer, size_t length) { - CsrWifiSmeErrorInd *primitive = (CsrWifiSmeErrorInd *) CsrPmemAlloc(sizeof(CsrWifiSmeErrorInd)); + CsrWifiSmeErrorInd *primitive = kmalloc(sizeof(CsrWifiSmeErrorInd), GFP_KERNEL); size_t offset; offset = 0; @@ -5736,7 +5736,7 @@ u8* CsrWifiSmeInfoIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeInfoIndDes(u8 *buffer, size_t length) { - CsrWifiSmeInfoInd *primitive = (CsrWifiSmeInfoInd *) CsrPmemAlloc(sizeof(CsrWifiSmeInfoInd)); + CsrWifiSmeInfoInd *primitive = kmalloc(sizeof(CsrWifiSmeInfoInd), GFP_KERNEL); size_t offset; offset = 0; @@ -5783,7 +5783,7 @@ u8* CsrWifiSmeCoreDumpIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiSmeCoreDumpIndDes(u8 *buffer, size_t length) { - CsrWifiSmeCoreDumpInd *primitive = (CsrWifiSmeCoreDumpInd *) CsrPmemAlloc(sizeof(CsrWifiSmeCoreDumpInd)); + CsrWifiSmeCoreDumpInd *primitive = kmalloc(sizeof(CsrWifiSmeCoreDumpInd), GFP_KERNEL); size_t offset; offset = 0; @@ -5791,7 +5791,7 @@ void* CsrWifiSmeCoreDumpIndDes(u8 *buffer, size_t length) CsrUint32Des((u32 *) &primitive->dataLength, buffer, &offset); if (primitive->dataLength) { - primitive->data = (u8 *)CsrPmemAlloc(primitive->dataLength); + primitive->data = kmalloc(primitive->dataLength, GFP_KERNEL); CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength))); } else diff --git a/drivers/staging/csr/drv.c b/drivers/staging/csr/drv.c index 6f5b3dd..b2c27f4 100644 --- a/drivers/staging/csr/drv.c +++ b/drivers/staging/csr/drv.c @@ -1483,7 +1483,7 @@ unifi_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) break; } - pcli->snap_filter.protocols = CsrPmemAlloc(snap_filter.count * sizeof(u16)); + pcli->snap_filter.protocols = kmalloc(snap_filter.count * sizeof(u16), GFP_KERNEL); if (!pcli->snap_filter.protocols) { r = -ENOMEM; goto out; diff --git a/drivers/staging/csr/putest.c b/drivers/staging/csr/putest.c index f2cb11e..5613cf0 100644 --- a/drivers/staging/csr/putest.c +++ b/drivers/staging/csr/putest.c @@ -489,7 +489,7 @@ int unifi_putest_dl_fw_buff(unifi_priv_t *priv, unsigned char *arg) } /* Buffer for kernel copy of the f/w image */ - fw_buf = CsrPmemAlloc(fw_length); + fw_buf = kmalloc(fw_length, GFP_KERNEL); if (!fw_buf) { unifi_error(priv, "unifi_putest_dl_fw_buff: malloc fail\n"); return -ENOMEM; diff --git a/drivers/staging/csr/sme_mgt.c b/drivers/staging/csr/sme_mgt.c index e252883..58d1b3b 100644 --- a/drivers/staging/csr/sme_mgt.c +++ b/drivers/staging/csr/sme_mgt.c @@ -141,7 +141,7 @@ void CsrWifiSmeScanResultsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) } /* Take a Copy of the scan Results :-) */ - scanCopy = CsrPmemAlloc(bytesRequired); + scanCopy = kmalloc(bytesRequired, GFP_KERNEL); memcpy(scanCopy, cfm->scanResults, sizeof(CsrWifiSmeScanResult) * cfm->scanResultsCount); /* Take a Copy of the Info Elements AND update the scan result pointers */ diff --git a/drivers/staging/csr/ul_int.c b/drivers/staging/csr/ul_int.c index d8a728b..46d3507 100644 --- a/drivers/staging/csr/ul_int.c +++ b/drivers/staging/csr/ul_int.c @@ -105,15 +105,14 @@ ul_register_client(unifi_priv_t *priv, unsigned int configuration, ul_clients[id].configuration = configuration; /* Allocate memory for the reply signal.. */ - ul_clients[id].reply_signal = (CSR_SIGNAL*) CsrPmemAlloc(sizeof(CSR_SIGNAL)); + ul_clients[id].reply_signal = kmalloc(sizeof(CSR_SIGNAL), GFP_KERNEL); if (ul_clients[id].reply_signal == NULL) { unifi_error(priv, "Failed to allocate reply signal for client.\n"); return NULL; } /* .. and the bulk data of the reply signal. */ for (ref = 0; ref < UNIFI_MAX_DATA_REFERENCES; ref ++) { - ul_clients[id].reply_bulkdata[ref] = - (bulk_data_t*) CsrPmemAlloc(sizeof(bulk_data_t)); + ul_clients[id].reply_bulkdata[ref] = kmalloc(sizeof(bulk_data_t), GFP_KERNEL); /* If allocation fails, free allocated memory. */ if (ul_clients[id].reply_bulkdata[ref] == NULL) { for (; ref > 0; ref --) { diff --git a/drivers/staging/csr/unifi_sme.c b/drivers/staging/csr/unifi_sme.c index 0cb7b01..ff639d4 100644 --- a/drivers/staging/csr/unifi_sme.c +++ b/drivers/staging/csr/unifi_sme.c @@ -411,7 +411,7 @@ uf_multicast_list_wq(struct work_struct *work) * Allocate a new list, need to free it later * in unifi_mgt_multicast_address_cfm(). */ - multicast_address_list = CsrPmemAlloc(mc_count * sizeof(CsrWifiMacAddress)); + multicast_address_list = kmalloc(mc_count * sizeof(CsrWifiMacAddress), GFP_KERNEL); if (multicast_address_list == NULL) { return; @@ -590,7 +590,7 @@ int unifi_cfg_packet_filters(unifi_priv_t *priv, unsigned char *arg) priv->packet_filters.tclas_ies_length += sizeof(tclas_t); } if (priv->packet_filters.tclas_ies_length > 0) { - priv->filter_tclas_ies = CsrPmemAlloc(priv->packet_filters.tclas_ies_length); + priv->filter_tclas_ies = kmalloc(priv->packet_filters.tclas_ies_length, GFP_KERNEL); if (priv->filter_tclas_ies == NULL) { return -ENOMEM; } @@ -671,7 +671,7 @@ int unifi_cfg_wmm_addts(unifi_priv_t *priv, unsigned char *arg) unifi_trace(priv, UDBG4, "addts: tid = 0x%x ie_length = %d\n", addts_tid, addts_ie_length); - addts_ie = CsrPmemAlloc(addts_ie_length); + addts_ie = kmalloc(addts_ie_length, GFP_KERNEL); if (addts_ie == NULL) { unifi_error(priv, "unifi_cfg_wmm_addts: Failed to malloc %d bytes for addts_ie buffer\n", @@ -1209,7 +1209,7 @@ void uf_send_pkt_to_encrypt(struct work_struct *work) pktBulkDataLength = interfacePriv->wapi_unicast_bulk_data.data_length; if (pktBulkDataLength > 0) { - pktBulkData = (u8 *)CsrPmemAlloc(pktBulkDataLength); + pktBulkData = kmalloc(pktBulkDataLength, GFP_KERNEL); memset(pktBulkData, 0, pktBulkDataLength); } else { unifi_error(priv, "uf_send_pkt_to_encrypt() : invalid buffer\n"); -- cgit v0.10.2 From eaae2e9223e859cd968b58bd3173a3f17b50538d Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 16:50:34 -0700 Subject: staging: csr: remove csr_pmem.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's no longer needed. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_msgconv.c b/drivers/staging/csr/csr_msgconv.c index dbf0d64..69ae790 100644 --- a/drivers/staging/csr/csr_msgconv.c +++ b/drivers/staging/csr/csr_msgconv.c @@ -11,7 +11,6 @@ #include #include #include -#include "csr_pmem.h" #include "csr_panic.h" #include "csr_sched.h" #include "csr_msgconv.h" diff --git a/drivers/staging/csr/csr_pmem.h b/drivers/staging/csr/csr_pmem.h deleted file mode 100644 index 1fb74fa..0000000 --- a/drivers/staging/csr/csr_pmem.h +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef CSR_PMEM_H__ -#define CSR_PMEM_H__ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#include -#include "csr_macro.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/***************************************************************************** - - NAME - CsrPmemZalloc - - DESCRIPTION - This function is equivalent to CsrPmemAlloc, but the allocated memory - is initialised to zero. - - PARAMETERS - size - Size of memory requested. Note that a size of 0 is valid. - - RETURNS - Pointer to allocated memory. - -*****************************************************************************/ -#define CsrPmemZalloc(s) (CsrMemSet(CsrPmemAlloc(s), 0x00, (s))) - - -/***************************************************************************** - - NAME - pnew and zpnew - - DESCRIPTIOM - Type-safe wrappers for CsrPmemAlloc and CsrPmemZalloc, for allocating - single instances of a specified and named type. - - PARAMETERS - t - type to allocate. - -*****************************************************************************/ -#define pnew(t) ((t *) (CsrPmemAlloc(sizeof(t)))) -#define zpnew(t) ((t *) (CsrPmemZalloc(sizeof(t)))) - - -/*----------------------------------------------------------------------------* - * Csr Pmem Debug code. Allows custom callbacks on CsrPmemAlloc and CsrPmemFree - *----------------------------------------------------------------------------*/ -#ifdef CSR_PMEM_DEBUG_ENABLE - -typedef u8 CsrPmemDebugAllocType; -#define CSR_PMEM_DEBUG_TYPE_PMEM_ALLOC 1 -#define CSR_PMEM_DEBUG_TYPE_MEM_ALLOC 2 -#define CSR_PMEM_DEBUG_TYPE_MEM_CALLOC 3 -#define CSR_PMEM_DEBUG_TYPE_MEM_ALLOC_DMA 4 - -typedef void (CsrPmemDebugOnAlloc)(void *ptr, void *userptr, size_t size, CsrPmemDebugAllocType type, const char* file, u32 line); -typedef void (CsrPmemDebugOnFree)(void *ptr, void *userptr, CsrPmemDebugAllocType type, const char* file, u32 line); - -/*----------------------------------------------------------------------------* - * NAME - * CsrPmemInstallHooks - * - * DESCRIPTION - * Install debug hooks for memory allocation - * Use NULL values to uninstall the hooks - * headSize = The number of extra bytes to allocate in the head of the Allocated buffer - * footSize = The number of extra bytes to allocate in the end of the Allocated buffer - * - * RETURNS - * void - * - *----------------------------------------------------------------------------*/ -void CsrPmemDebugInstallHooks(u8 headSize, u8 endSize, CsrPmemDebugOnAlloc *onAllocCallback, CsrPmemDebugOnFree *onFreeCallback); - -void *CsrPmemDebugAlloc(size_t size, CsrPmemDebugAllocType type, const char* file, u32 line); - -void CsrPmemDebugFree(void *ptr, CsrPmemDebugAllocType type, const char* file, u32 line); - -#endif - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/drivers/staging/csr/csr_serialize_primitive_types.c b/drivers/staging/csr/csr_serialize_primitive_types.c index bb08f19..39406fd 100644 --- a/drivers/staging/csr/csr_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_serialize_primitive_types.c @@ -13,7 +13,6 @@ #include "csr_prim_defs.h" #include "csr_msgconv.h" #include "csr_macro.h" -#include "csr_pmem.h" #include "csr_lib.h" void CsrUint8Des(u8 *value, u8 *buffer, size_t *offset) diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index 801d8a8..4854f85 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -9,7 +9,6 @@ *****************************************************************************/ #include #include -#include "csr_pmem.h" #include "csr_unicode.h" #include "csr_macro.h" diff --git a/drivers/staging/csr/csr_wifi_fsm.h b/drivers/staging/csr/csr_wifi_fsm.h index e933ab1..073e2f8 100644 --- a/drivers/staging/csr/csr_wifi_fsm.h +++ b/drivers/staging/csr/csr_wifi_fsm.h @@ -15,7 +15,6 @@ extern "C" { #endif -#include "csr_pmem.h" #include "csr_prim_defs.h" #include "csr_log_text.h" #include "csr_wifi_fsm_event.h" diff --git a/drivers/staging/csr/csr_wifi_fsm_types.h b/drivers/staging/csr/csr_wifi_fsm_types.h index 3251fa9..26752bf3 100644 --- a/drivers/staging/csr/csr_wifi_fsm_types.h +++ b/drivers/staging/csr/csr_wifi_fsm_types.h @@ -17,7 +17,6 @@ extern "C" { #include #include "csr_macro.h" -#include "csr_pmem.h" #include "csr_panic.h" #include "csr_sched.h" diff --git a/drivers/staging/csr/csr_wifi_hip_unifi.h b/drivers/staging/csr/csr_wifi_hip_unifi.h index cabcf56..dc3c60b 100644 --- a/drivers/staging/csr/csr_wifi_hip_unifi.h +++ b/drivers/staging/csr/csr_wifi_hip_unifi.h @@ -97,7 +97,6 @@ extern "C" { #include "csr_framework_ext.h" /* from the synergy porting folder */ #include "csr_sdio.h" /* from the synergy porting folder */ -#include "csr_pmem.h" /* from the synergy porting folder */ #include "csr_macro.h" /* from the synergy porting folder */ #include "csr_formatted_io.h" /* from the synergy gsp folder */ #include "csr_wifi_result.h" diff --git a/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c b/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c index ce2c7d5..0689d6f 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c +++ b/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c @@ -11,7 +11,6 @@ /* Note: this is an auto-generated file. */ #include "csr_msgconv.h" -#include "csr_pmem.h" #include "csr_macro.h" #ifdef CSR_WIFI_NME_ENABLE diff --git a/drivers/staging/csr/csr_wifi_nme_ap_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_nme_ap_free_downstream_contents.c index bfc511e..ab93588 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_free_downstream_contents.c +++ b/drivers/staging/csr/csr_wifi_nme_ap_free_downstream_contents.c @@ -10,7 +10,6 @@ /* Note: this is an auto-generated file. */ #include -#include "csr_pmem.h" #include "csr_wifi_nme_ap_prim.h" #include "csr_wifi_nme_ap_lib.h" diff --git a/drivers/staging/csr/csr_wifi_nme_ap_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_nme_ap_free_upstream_contents.c index d9ebce3..2786a6b 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_free_upstream_contents.c +++ b/drivers/staging/csr/csr_wifi_nme_ap_free_upstream_contents.c @@ -10,7 +10,6 @@ /* Note: this is an auto-generated file. */ -#include "csr_pmem.h" #include "csr_wifi_nme_ap_prim.h" #include "csr_wifi_nme_ap_lib.h" diff --git a/drivers/staging/csr/csr_wifi_nme_ap_lib.h b/drivers/staging/csr/csr_wifi_nme_ap_lib.h index fed0ea2..d401470 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_lib.h +++ b/drivers/staging/csr/csr_wifi_nme_ap_lib.h @@ -13,7 +13,6 @@ #ifndef CSR_WIFI_NME_AP_LIB_H__ #define CSR_WIFI_NME_AP_LIB_H__ -#include "csr_pmem.h" #include "csr_sched.h" #include "csr_macro.h" #include "csr_msg_transport.h" diff --git a/drivers/staging/csr/csr_wifi_nme_ap_prim.h b/drivers/staging/csr/csr_wifi_nme_ap_prim.h index ec67046..fc44560 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_prim.h +++ b/drivers/staging/csr/csr_wifi_nme_ap_prim.h @@ -13,6 +13,7 @@ #ifndef CSR_WIFI_NME_AP_PRIM_H__ #define CSR_WIFI_NME_AP_PRIM_H__ +#include #include "csr_prim_defs.h" #include "csr_sched.h" #include "csr_wifi_common.h" diff --git a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c index 8112aa0..493e33e 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c +++ b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c @@ -11,7 +11,6 @@ /* Note: this is an auto-generated file. */ #include #include -#include "csr_pmem.h" #include "csr_msgconv.h" #include "csr_unicode.h" diff --git a/drivers/staging/csr/csr_wifi_nme_ap_serialize.h b/drivers/staging/csr/csr_wifi_nme_ap_serialize.h index 524da14..0f57829 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_serialize.h +++ b/drivers/staging/csr/csr_wifi_nme_ap_serialize.h @@ -13,7 +13,6 @@ #ifndef CSR_WIFI_NME_AP_SERIALIZE_H__ #define CSR_WIFI_NME_AP_SERIALIZE_H__ -#include "csr_pmem.h" #include "csr_wifi_msgconv.h" #include "csr_wifi_nme_ap_prim.h" diff --git a/drivers/staging/csr/csr_wifi_nme_lib.h b/drivers/staging/csr/csr_wifi_nme_lib.h index 04b7c31..709ece4 100644 --- a/drivers/staging/csr/csr_wifi_nme_lib.h +++ b/drivers/staging/csr/csr_wifi_nme_lib.h @@ -13,7 +13,6 @@ #ifndef CSR_WIFI_NME_LIB_H__ #define CSR_WIFI_NME_LIB_H__ -#include "csr_pmem.h" #include "csr_sched.h" #include "csr_macro.h" #include "csr_msg_transport.h" diff --git a/drivers/staging/csr/csr_wifi_nme_serialize.h b/drivers/staging/csr/csr_wifi_nme_serialize.h index dca36d9..c6b1636 100644 --- a/drivers/staging/csr/csr_wifi_nme_serialize.h +++ b/drivers/staging/csr/csr_wifi_nme_serialize.h @@ -13,9 +13,7 @@ #ifndef CSR_WIFI_NME_SERIALIZE_H__ #define CSR_WIFI_NME_SERIALIZE_H__ -#include "csr_pmem.h" #include "csr_wifi_msgconv.h" - #include "csr_wifi_nme_prim.h" #ifdef __cplusplus diff --git a/drivers/staging/csr/csr_wifi_router_converter_init.c b/drivers/staging/csr/csr_wifi_router_converter_init.c index a321786..775c013 100644 --- a/drivers/staging/csr/csr_wifi_router_converter_init.c +++ b/drivers/staging/csr/csr_wifi_router_converter_init.c @@ -11,7 +11,6 @@ /* Note: this is an auto-generated file. */ #include "csr_msgconv.h" -#include "csr_pmem.h" #include "csr_macro.h" diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c b/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c index 503f1af..a02e307 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c @@ -11,7 +11,6 @@ /* Note: this is an auto-generated file. */ #include "csr_msgconv.h" -#include "csr_pmem.h" #include "csr_macro.h" #ifdef CSR_LOG_ENABLE diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c index b4b7243..7fa85fb 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c @@ -10,7 +10,6 @@ /* Note: this is an auto-generated file. */ #include -#include "csr_pmem.h" #include "csr_wifi_router_ctrl_prim.h" #include "csr_wifi_router_ctrl_lib.h" diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c index 4605c53..954b3de 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c @@ -10,7 +10,6 @@ /* Note: this is an auto-generated file. */ #include -#include "csr_pmem.h" #include "csr_wifi_router_ctrl_prim.h" #include "csr_wifi_router_ctrl_lib.h" diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_lib.h b/drivers/staging/csr/csr_wifi_router_ctrl_lib.h index ba8e983..93d0fad 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_lib.h +++ b/drivers/staging/csr/csr_wifi_router_ctrl_lib.h @@ -13,7 +13,6 @@ #ifndef CSR_WIFI_ROUTER_CTRL_LIB_H__ #define CSR_WIFI_ROUTER_CTRL_LIB_H__ -#include "csr_pmem.h" #include "csr_sched.h" #include "csr_macro.h" #include "csr_msg_transport.h" diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c index e4b7ec9..b9f9adb 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c @@ -11,7 +11,6 @@ /* Note: this is an auto-generated file. */ #include #include -#include "csr_pmem.h" #include "csr_msgconv.h" #include "csr_unicode.h" diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h index f270377..2c2a229 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h +++ b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h @@ -13,7 +13,6 @@ #ifndef CSR_WIFI_ROUTER_CTRL_SERIALIZE_H__ #define CSR_WIFI_ROUTER_CTRL_SERIALIZE_H__ -#include "csr_pmem.h" #include "csr_wifi_msgconv.h" #include "csr_wifi_router_ctrl_prim.h" diff --git a/drivers/staging/csr/csr_wifi_router_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_router_free_downstream_contents.c index fbd5b35..c4badc5 100644 --- a/drivers/staging/csr/csr_wifi_router_free_downstream_contents.c +++ b/drivers/staging/csr/csr_wifi_router_free_downstream_contents.c @@ -10,7 +10,6 @@ /* Note: this is an auto-generated file. */ #include -#include "csr_pmem.h" #include "csr_wifi_router_prim.h" #include "csr_wifi_router_lib.h" diff --git a/drivers/staging/csr/csr_wifi_router_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_router_free_upstream_contents.c index 60f6ecd..de1086d 100644 --- a/drivers/staging/csr/csr_wifi_router_free_upstream_contents.c +++ b/drivers/staging/csr/csr_wifi_router_free_upstream_contents.c @@ -10,7 +10,6 @@ /* Note: this is an auto-generated file. */ #include -#include "csr_pmem.h" #include "csr_wifi_router_prim.h" #include "csr_wifi_router_lib.h" diff --git a/drivers/staging/csr/csr_wifi_router_lib.h b/drivers/staging/csr/csr_wifi_router_lib.h index f2f5196..06a2214 100644 --- a/drivers/staging/csr/csr_wifi_router_lib.h +++ b/drivers/staging/csr/csr_wifi_router_lib.h @@ -13,7 +13,6 @@ #ifndef CSR_WIFI_ROUTER_LIB_H__ #define CSR_WIFI_ROUTER_LIB_H__ -#include "csr_pmem.h" #include "csr_sched.h" #include "csr_macro.h" #include "csr_msg_transport.h" diff --git a/drivers/staging/csr/csr_wifi_router_serialize.c b/drivers/staging/csr/csr_wifi_router_serialize.c index adf37d4..5717ebc 100644 --- a/drivers/staging/csr/csr_wifi_router_serialize.c +++ b/drivers/staging/csr/csr_wifi_router_serialize.c @@ -10,7 +10,6 @@ /* Note: this is an auto-generated file. */ #include -#include "csr_pmem.h" #include "csr_msgconv.h" #include "csr_unicode.h" diff --git a/drivers/staging/csr/csr_wifi_router_serialize.h b/drivers/staging/csr/csr_wifi_router_serialize.h index 4951c40..07e21b2 100644 --- a/drivers/staging/csr/csr_wifi_router_serialize.h +++ b/drivers/staging/csr/csr_wifi_router_serialize.h @@ -13,9 +13,7 @@ #ifndef CSR_WIFI_ROUTER_SERIALIZE_H__ #define CSR_WIFI_ROUTER_SERIALIZE_H__ -#include "csr_pmem.h" #include "csr_wifi_msgconv.h" - #include "csr_wifi_router_prim.h" #ifdef __cplusplus diff --git a/drivers/staging/csr/csr_wifi_serialize_primitive_types.c b/drivers/staging/csr/csr_wifi_serialize_primitive_types.c index 23b0e51..dd93d00 100644 --- a/drivers/staging/csr/csr_wifi_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_wifi_serialize_primitive_types.c @@ -10,7 +10,6 @@ #include #include -#include "csr_pmem.h" #include "csr_macro.h" #include "csr_msgconv.h" #include "csr_wifi_msgconv.h" diff --git a/drivers/staging/csr/csr_wifi_sme_ap_lib.h b/drivers/staging/csr/csr_wifi_sme_ap_lib.h index 8825172..350cb9e 100644 --- a/drivers/staging/csr/csr_wifi_sme_ap_lib.h +++ b/drivers/staging/csr/csr_wifi_sme_ap_lib.h @@ -13,7 +13,6 @@ #ifndef CSR_WIFI_SME_AP_LIB_H__ #define CSR_WIFI_SME_AP_LIB_H__ -#include "csr_pmem.h" #include "csr_sched.h" #include "csr_macro.h" #include "csr_msg_transport.h" diff --git a/drivers/staging/csr/csr_wifi_sme_converter_init.c b/drivers/staging/csr/csr_wifi_sme_converter_init.c index 2d9c683..31835f0 100644 --- a/drivers/staging/csr/csr_wifi_sme_converter_init.c +++ b/drivers/staging/csr/csr_wifi_sme_converter_init.c @@ -11,7 +11,6 @@ /* Note: this is an auto-generated file. */ #include "csr_msgconv.h" -#include "csr_pmem.h" #include "csr_macro.h" diff --git a/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c index ae3fec8..03b5ddb 100644 --- a/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c +++ b/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c @@ -10,7 +10,6 @@ /* Note: this is an auto-generated file. */ #include -#include "csr_pmem.h" #include "csr_wifi_sme_prim.h" #include "csr_wifi_sme_lib.h" diff --git a/drivers/staging/csr/csr_wifi_sme_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_sme_free_upstream_contents.c index 1977747..c04767b 100644 --- a/drivers/staging/csr/csr_wifi_sme_free_upstream_contents.c +++ b/drivers/staging/csr/csr_wifi_sme_free_upstream_contents.c @@ -10,7 +10,6 @@ /* Note: this is an auto-generated file. */ #include -#include "csr_pmem.h" #include "csr_wifi_sme_prim.h" #include "csr_wifi_sme_lib.h" diff --git a/drivers/staging/csr/csr_wifi_sme_lib.h b/drivers/staging/csr/csr_wifi_sme_lib.h index e20ae98..3ca7456 100644 --- a/drivers/staging/csr/csr_wifi_sme_lib.h +++ b/drivers/staging/csr/csr_wifi_sme_lib.h @@ -13,7 +13,6 @@ #ifndef CSR_WIFI_SME_LIB_H__ #define CSR_WIFI_SME_LIB_H__ -#include "csr_pmem.h" #include "csr_sched.h" #include "csr_macro.h" #include "csr_msg_transport.h" diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.c b/drivers/staging/csr/csr_wifi_sme_serialize.c index a1db211..d55e3ee 100644 --- a/drivers/staging/csr/csr_wifi_sme_serialize.c +++ b/drivers/staging/csr/csr_wifi_sme_serialize.c @@ -11,7 +11,6 @@ /* Note: this is an auto-generated file. */ #include #include -#include "csr_pmem.h" #include "csr_msgconv.h" #include "csr_unicode.h" diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.h b/drivers/staging/csr/csr_wifi_sme_serialize.h index 9ea9d15..4f3af0a 100644 --- a/drivers/staging/csr/csr_wifi_sme_serialize.h +++ b/drivers/staging/csr/csr_wifi_sme_serialize.h @@ -13,9 +13,7 @@ #ifndef CSR_WIFI_SME_SERIALIZE_H__ #define CSR_WIFI_SME_SERIALIZE_H__ -#include "csr_pmem.h" #include "csr_wifi_msgconv.h" - #include "csr_wifi_sme_prim.h" #ifdef __cplusplus -- cgit v0.10.2 From 9e16d457689d1b866e8c1b7de331cb069e341f4c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 17:04:08 -0700 Subject: staging: csr: remove csr_utf16.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only one function was being used in the file, so move it to where it was being called and delete the rest of the file, and csr_unicode.h as it's no longer needed as well. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/Makefile b/drivers/staging/csr/Makefile index 814f57a..afda44b 100644 --- a/drivers/staging/csr/Makefile +++ b/drivers/staging/csr/Makefile @@ -71,6 +71,5 @@ csr_helper-y := csr_time.o \ csr_framework_ext.o \ csr_wifi_serialize_primitive_types.o \ csr_serialize_primitive_types.o \ - csr_utf16.o \ csr_msgconv.o \ csr_panic.o diff --git a/drivers/staging/csr/csr_msgconv.h b/drivers/staging/csr/csr_msgconv.h index 2e1aad8..0849709 100644 --- a/drivers/staging/csr/csr_msgconv.h +++ b/drivers/staging/csr/csr_msgconv.h @@ -14,7 +14,6 @@ #include #include "csr_prim_defs.h" #include "csr_sched.h" -#include "csr_unicode.h" #ifdef __cplusplus extern "C" { diff --git a/drivers/staging/csr/csr_serialize_primitive_types.c b/drivers/staging/csr/csr_serialize_primitive_types.c index 39406fd..a6f29ea 100644 --- a/drivers/staging/csr/csr_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_serialize_primitive_types.c @@ -15,6 +15,34 @@ #include "csr_macro.h" #include "csr_lib.h" +/******************************************************************************** +* +* Name: CsrUtf16StrLen +* +* Description: The function returns the number of 16 bit elements present +* in the 0-terminated string. +* +* Input: 0-terminated string of 16 bit unicoded characters. +* +* Output: The number of 16 bit elements in the string. +* +*********************************************************************************/ +static u32 CsrUtf16StrLen(const u16 *unicodeString) +{ + u32 length; + + length = 0; + if (unicodeString != NULL) + { + while (*unicodeString) + { + length++; + unicodeString++; + } + } + return length; +} + void CsrUint8Des(u8 *value, u8 *buffer, size_t *offset) { *value = buffer[*offset]; diff --git a/drivers/staging/csr/csr_unicode.h b/drivers/staging/csr/csr_unicode.h deleted file mode 100644 index 2105e71..0000000 --- a/drivers/staging/csr/csr_unicode.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef CSR_UNICODE_H__ -#define CSR_UNICODE_H__ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif - -u16 *CsrUint32ToUtf16String(u32 number); - -u32 CsrUtf16StringToUint32(const u16 *unicodeString); -u32 CsrUtf16StrLen(const u16 *unicodeString); - -u8 *CsrUtf16String2Utf8(const u16 *source); - -u16 *CsrUtf82Utf16String(const u8 *utf8String); - -u16 *CsrUtf16StrCpy(u16 *target, const u16 *source); -u16 *CsrUtf16StringDuplicate(const u16 *source); - -u16 CsrUtf16StrICmp(const u16 *string1, const u16 *string2); -u16 CsrUtf16StrNICmp(const u16 *string1, const u16 *string2, u32 count); - -u16 *CsrUtf16MemCpy(u16 *dest, const u16 *src, u32 count); -u16 *CsrUtf16ConcatenateTexts(const u16 *inputText1, const u16 *inputText2, - const u16 *inputText3, const u16 *inputText4); - -u16 *CsrUtf16String2XML(u16 *str); -u16 *CsrXML2Utf16String(u16 *str); - -u32 CsrUtf8StringLengthInBytes(const u8 *string); - -/******************************************************************************* - - NAME - CsrUtf8StrTruncate - - DESCRIPTION - In-place truncate a string on a UTF-8 character boundary by writing a - null character somewhere in the range target[count - 3]:target[count]. - - Please note that memory passed must be at least of length count + 1, to - ensure space for a full length string that is terminated at - target[count], in the event that target[count - 1] is the final byte of - a UTF-8 character. - - PARAMETERS - target - Target string to truncate. - count - The desired length, in bytes, of the resulting string. Depending - on the contents, the resulting string length will be between - count - 3 and count. - - RETURNS - Returns target - -*******************************************************************************/ -u8 *CsrUtf8StrTruncate(u8 *target, size_t count); - -/* - * UCS2 - * - * D-13157 - */ -typedef u8 CsrUcs2String; - -size_t CsrUcs2ByteStrLen(const CsrUcs2String *ucs2String); -size_t CsrConverterUcs2ByteStrLen(const CsrUcs2String *str); - -u8 *CsrUcs2ByteString2Utf8(const CsrUcs2String *ucs2String); -CsrUcs2String *CsrUtf82Ucs2ByteString(const u8 *utf8String); - -u8 *CsrUtf16String2Ucs2ByteString(const u16 *source); -u16 *CsrUcs2ByteString2Utf16String(const u8 *source); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c deleted file mode 100644 index 4854f85..0000000 --- a/drivers/staging/csr/csr_utf16.c +++ /dev/null @@ -1,1055 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ -#include -#include -#include "csr_unicode.h" -#include "csr_macro.h" - -#define UNI_SUR_HIGH_START ((u32) 0xD800) -#define UNI_SUR_HIGH_END ((u32) 0xDBFF) -#define UNI_SUR_LOW_START ((u32) 0xDC00) -#define UNI_SUR_LOW_END ((u32) 0xDFFF) -#define UNI_REPLACEMENT_CHAR ((u32) 0xFFFD) -#define UNI_HALF_SHIFT ((u8) 10) /* used for shifting by 10 bits */ -#define UNI_HALF_BASE ((u32) 0x00010000) -#define UNI_BYTEMASK ((u32) 0xBF) -#define UNI_BYTEMARK ((u32) 0x80) - -#define CAPITAL(x) ((x >= 'a') && (x <= 'z') ? ((x) & 0x00DF) : (x)) - -/* -* Index into the table with the first byte to get the number of trailing bytes in a utf-8 character. -* -1 if the byte has an invalid value. -* -* Legal sequences are: -* -* byte 1st 2nd 3rd 4th -* -* 00-7F -* C2-DF 80-BF -* E0 A0-BF 80-BF -* E1-EC 80-BF 80-BF -* ED 80-9F 80-BF -* EE-EF 80-BF 80-BF -* F0 90-BF 80-BF 80-BF -* F1-F3 80-BF 80-BF 80-BF -* F4 80-8F 80-BF 80-BF -*/ -static const s8 trailingBytesForUtf8[256] = -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 - 0x1F */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 - 0x3F */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 - 0x5F */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x7F */ - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x80 - 0x9F */ - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xA0 - 0xBF */ - -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xC0 - 0xDF */ - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xE0 - 0xFF */ -}; - -/* Values to be substracted from a u32 when converting from UTF8 to UTF16 */ -static const u32 offsetsFromUtf8[4] = -{ - 0x00000000, 0x00003080, 0x000E2080, 0x03C82080 -}; - -/******************************************************************************** -* -* Name: CsrUint32ToUtf16String -* -* Description: The function converts an 32 bit number to an UTF-16 string -* that is allocated and 0-terminated. -* -* Input: 32 bit number. -* -* Output: A string of UTF-16 characters. -* -*********************************************************************************/ -u16 *CsrUint32ToUtf16String(u32 number) -{ - u16 count, noOfDigits; - u16 *output; - u32 tempNumber; - - /* calculate the number of digits in the output */ - tempNumber = number; - noOfDigits = 1; - while (tempNumber >= 10) - { - tempNumber = tempNumber / 10; - noOfDigits++; - } - - output = kmalloc(sizeof(u16) * (noOfDigits + 1), GFP_KERNEL); /*add space for 0-termination*/ - - tempNumber = number; - for (count = noOfDigits; count > 0; count--) - { - output[count - 1] = (u16) ((tempNumber % 10) + '0'); - tempNumber = tempNumber / 10; - } - output[noOfDigits] = '\0'; - - return output; -} - -/******************************************************************************** -* -* Name: CsrUtf16StringToUint32 -* -* Description: The function converts an UTF-16 string that is -* 0-terminated into a 32 bit number. -* -* Input: A string of UTF-16 characters containig a number. -* -* Output: 32 bit number. -* -*********************************************************************************/ -u32 CsrUtf16StringToUint32(const u16 *unicodeString) -{ - u16 numLen, count; - u32 newNumber = 0; - - numLen = (u16) CsrUtf16StrLen(unicodeString); - - if ((numLen > 10) || (numLen == 0) || (unicodeString == NULL)) /*CSRMAX number is 4.294.967.295 */ - { - return 0; - } - - for (count = 0; count < numLen; count++) - { - u16 input = unicodeString[count]; - if ((input < 0x30) || (input > 0x39) || ((newNumber == 0x19999999) && (input > 0x35)) || (newNumber > 0x19999999)) /* chars are present or number is too large now causing number to get to large when *10 */ - { - return 0; - } - - newNumber = (newNumber * 10) + (input - 0x30); - } - return newNumber; -} - -/******************************************************************************** -* -* Name: CsrUtf16MemCpy -* -* Description: The function copies count number of 16 bit data elements -* from srv to dest. -* -* Input: A pointer to an unicoded string. -* -* Output: A pointer to an unicoded string. -* -*********************************************************************************/ -u16 *CsrUtf16MemCpy(u16 *dest, const u16 *src, u32 count) -{ - return memcpy((u8 *) dest, (u8 *) src, count * sizeof(u16)); -} - -/******************************************************************************** -* -* Name: CsrUtf16ConcatenateTexts -* -* Description: The function merge the contents of 4 unicoded input pointers -* into a new string. -* -* Input: 4 unicoded input strings (UTF-16). -* -* Output: A new unicoded string (UTF-16) containing the combined strings. -* -*********************************************************************************/ -u16 *CsrUtf16ConcatenateTexts(const u16 *inputText1, const u16 *inputText2, - const u16 *inputText3, const u16 *inputText4) -{ - u16 *outputText; - u32 textLen, textLen1, textLen2, textLen3, textLen4; - - textLen1 = CsrUtf16StrLen(inputText1); - textLen2 = CsrUtf16StrLen(inputText2); - textLen3 = CsrUtf16StrLen(inputText3); - textLen4 = CsrUtf16StrLen(inputText4); - - textLen = textLen1 + textLen2 + textLen3 + textLen4; - - if (textLen == 0) /*stop here is all lengths are 0*/ - { - return NULL; - } - - outputText = kmalloc((textLen + 1) * sizeof(u16), GFP_KERNEL); /* add space for 0-termination*/ - - - if (inputText1 != NULL) - { - CsrUtf16MemCpy(outputText, inputText1, textLen1); - } - - if (inputText2 != NULL) - { - CsrUtf16MemCpy(&(outputText[textLen1]), inputText2, textLen2); - } - - if (inputText3 != NULL) - { - CsrUtf16MemCpy(&(outputText[textLen1 + textLen2]), inputText3, textLen3); - } - - if (inputText4 != NULL) - { - CsrUtf16MemCpy(&(outputText[textLen1 + textLen2 + textLen3]), inputText4, textLen4); - } - - outputText[textLen] = '\0'; - - return outputText; -} - -/******************************************************************************** -* -* Name: CsrUtf16StrLen -* -* Description: The function returns the number of 16 bit elements present -* in the 0-terminated string. -* -* Input: 0-terminated string of 16 bit unicoded characters. -* -* Output: The number of 16 bit elements in the string. -* -*********************************************************************************/ -u32 CsrUtf16StrLen(const u16 *unicodeString) -{ - u32 length; - - length = 0; - if (unicodeString != NULL) - { - while (*unicodeString) - { - length++; - unicodeString++; - } - } - return length; -} - -/******************************************************************************** -* -* Name: CsrUtf16String2Utf8 -* -* Description: The function decodes an UTF-16 string into an UTF8 byte -* oriented string. -* -* Input: 0-terminated UTF-16 string characters. -* -* Output: 0-terminated string of byte oriented UTF8 coded characters. -* -*********************************************************************************/ -u8 *CsrUtf16String2Utf8(const u16 *source) -{ - u8 *dest, *destStart = NULL; - u32 i; - u32 ch; - u32 length; - u32 sourceLength; - u8 bytes; - u8 appendNull = FALSE; - - u8 firstByteMark[5] = {0x00, 0x00, 0xC0, 0xE0, 0xF0}; - - if (!source) - { - return NULL; - } - - length = 0; - sourceLength = CsrUtf16StrLen(source) + 1; - - for (i = 0; i < sourceLength; i++) - { - ch = source[i]; - if ((ch >= UNI_SUR_HIGH_START) && (ch <= UNI_SUR_HIGH_END)) /* This is a high surrogate */ - { - if (i + 1 < sourceLength) /* The low surrogate is in the source */ - { - u32 ch2 = source[++i]; - if ((ch2 >= UNI_SUR_LOW_START) && (ch2 <= UNI_SUR_LOW_END)) /* And it is a legal low surrogate */ - { - length += 4; - } - else /* It is not a low surrogate, instead put a Unicode - 'REPLACEMENT CHARACTER' (U+FFFD) */ - { - length += 3; - i--; /* Substract 1 again as the conversion must continue after the ill-formed code unit */ - } - } - else /* The low surrogate does not exist, instead put a Unicode - 'REPLACEMENT CHARACTER' (U+FFFD), and the null terminated character */ - { - length += 4; - } - } - else if ((ch >= UNI_SUR_LOW_START) && (ch <= UNI_SUR_LOW_END)) /* The value of UTF-16 is not allowed to be in this range, instead put - a Unicode 'REPLACEMENT CHARACTER' (U+FFFD) */ - { - length += 3; - } - else /* Figure out how many bytes that are required */ - { - if (ch < 0x0080) - { - length++; - } - else if (ch < 0x0800) - { - length += 2; - } - else - { - length += 3; - } - } - } - - dest = kmalloc(length, GFP_KERNEL); - destStart = dest; - - for (i = 0; i < sourceLength; i++) - { - ch = source[i]; - if ((ch >= UNI_SUR_HIGH_START) && (ch <= UNI_SUR_HIGH_END)) /* This is a high surrogate */ - { - if (i + 1 < sourceLength) /* The low surrogate is in the source */ - { - u32 ch2 = source[++i]; - if ((ch2 >= UNI_SUR_LOW_START) && (ch2 <= UNI_SUR_LOW_END)) /* And it is a legal low surrogate, convert to UTF-32 */ - { - ch = ((ch - UNI_SUR_HIGH_START) << UNI_HALF_SHIFT) + (ch2 - UNI_SUR_LOW_START) + UNI_HALF_BASE; - } - else /* It is not a low surrogate, instead put a Unicode - 'REPLACEMENT CHARACTER' (U+FFFD) */ - { - ch = UNI_REPLACEMENT_CHAR; - i--; /* Substract 1 again as the conversion must continue after the ill-formed code unit */ - } - } - else /* The low surrogate does not exist, instead put a Unicode - 'REPLACEMENT CHARACTER' (U+FFFD), and the null terminated character */ - { - ch = UNI_REPLACEMENT_CHAR; - appendNull = TRUE; - } - } - else if ((ch >= UNI_SUR_LOW_START) && (ch <= UNI_SUR_LOW_END)) /* The value of UTF-16 is not allowed to be in this range, instead put - a Unicode 'REPLACEMENT CHARACTER' (U+FFFD) */ - { - ch = UNI_REPLACEMENT_CHAR; - } - - /* Figure out how many bytes that are required */ - if (ch < (u32) 0x80) - { - bytes = 1; - } - else if (ch < (u32) 0x800) - { - bytes = 2; - } - else if (ch < (u32) 0x10000) - { - bytes = 3; - } - else if (ch < (u32) 0x110000) - { - bytes = 4; - } - else - { - bytes = 3; - ch = UNI_REPLACEMENT_CHAR; - } - - dest += bytes; - - switch (bytes) /* Convert character to UTF-8. Note: everything falls through. */ - { - case 4: - { - *--dest = (u8) ((ch | UNI_BYTEMARK) & UNI_BYTEMASK); - ch >>= 6; - } - /* FALLTHROUGH */ - case 3: - { - *--dest = (u8) ((ch | UNI_BYTEMARK) & UNI_BYTEMASK); - ch >>= 6; - } - /* FALLTHROUGH */ - case 2: - { - *--dest = (u8) ((ch | UNI_BYTEMARK) & UNI_BYTEMASK); - ch >>= 6; - } - /* FALLTHROUGH */ - case 1: - { - *--dest = (u8) (ch | firstByteMark[bytes]); - } - /* FALLTHROUGH */ - default: - { - break; - } - } - - dest += bytes; - } - - if (appendNull) /* Append the \0 character */ - { - *dest = '\0'; - } - - return destStart; -} - -/***************************************************************************** - - NAME - isLegalUtf8 - - DESCRIPTION - Returns TRUE if the given UFT-8 code unit is legal as defined by the - Unicode standard (see Chapter 3: Conformance, Section 3.9: Unicode - Encoding Forms, UTF-8). - - This function assumes that the length parameter is unconditionally - correct and that the first byte is already validated by looking it up - in the trailingBytesForUtf8 array, which also reveals the number of - trailing bytes. - - Legal code units are composed of one of the following byte sequences: - - 1st 2nd 3rd 4th - -------------------------------- - 00-7F - C2-DF 80-BF - E0 A0-BF 80-BF - E1-EC 80-BF 80-BF - ED 80-9F 80-BF - EE-EF 80-BF 80-BF - F0 90-BF 80-BF 80-BF - F1-F3 80-BF 80-BF 80-BF - F4 80-8F 80-BF 80-BF - - Please note that this function only checks whether the 2nd, 3rd and - 4th bytes fall into the valid ranges. - - PARAMETERS - codeUnit - pointer to the first byte of the byte sequence composing - the code unit to test. - length - the number of bytes in the code unit. Valid range is 1 to 4. - - RETURNS - TRUE if the given code unit is legal. - -*****************************************************************************/ -static u8 isLegalUtf8(const u8 *codeUnit, u32 length) -{ - const u8 *srcPtr = codeUnit + length; - u8 byte; - - switch (length) /* Everything falls through except case 1 */ - { - case 4: - { - byte = *--srcPtr; - if ((byte < 0x80) || (byte > 0xBF)) - { - return FALSE; - } - } - /* Fallthrough */ - case 3: - { - byte = *--srcPtr; - if ((byte < 0x80) || (byte > 0xBF)) - { - return FALSE; - } - } - /* Fallthrough */ - case 2: - { - byte = *--srcPtr; - if (byte > 0xBF) - { - return FALSE; - } - - switch (*codeUnit) /* No fallthrough */ - { - case 0xE0: - { - if (byte < 0xA0) - { - return FALSE; - } - break; - } - case 0xED: - { - if ((byte < 0x80) || (byte > 0x9F)) - { - return FALSE; - } - break; - } - case 0xF0: - { - if (byte < 0x90) - { - return FALSE; - } - break; - } - case 0xF4: - { - if ((byte < 0x80) || (byte > 0x8F)) - { - return FALSE; - } - break; - } - default: - { - if (byte < 0x80) - { - return FALSE; - } - break; - } - } - } - /* Fallthrough */ - case 1: - default: - /* The 1st byte and length are assumed correct */ - break; - } - - return TRUE; -} - -/******************************************************************************** -* -* Name: CsrUtf82Utf16String -* -* Description: The function decodes an UTF8 byte oriented string into a -* UTF-16string. -* -* Input: 0-terminated string of byte oriented UTF8 coded characters. -* -* Output: 0-terminated string of UTF-16 characters. -* -*********************************************************************************/ -u16 *CsrUtf82Utf16String(const u8 *utf8String) -{ - size_t i, length = 0; - size_t sourceLength; - u16 *dest = NULL; - u16 *destStart = NULL; - s8 extraBytes2Read; - - if (!utf8String) - { - return NULL; - } - sourceLength = strlen((char *)utf8String); - - for (i = 0; i < sourceLength; i++) - { - extraBytes2Read = trailingBytesForUtf8[utf8String[i]]; - - if (extraBytes2Read == -1) /* Illegal byte value, instead put a Unicode 'REPLACEMENT CHARACTER' (U+FFFD) */ - { - length += 1; - } - else if (i + extraBytes2Read > sourceLength) /* The extra bytes does not exist, instead put a Unicode 'REPLACEMENT - CHARACTER' (U+FFFD), and the null terminated character */ - { - length += 2; - break; - } - else if (isLegalUtf8(&utf8String[i], extraBytes2Read + 1) == FALSE) /* It is not a legal utf-8 character, instead put a Unicode 'REPLACEMENT - CHARACTER' (U+FFFD) */ - { - length += 1; - } - else - { - if (utf8String[i] > 0xEF) /* Needs a high and a low surrogate */ - { - length += 2; - } - else - { - length += 1; - } - i += extraBytes2Read; - } - } - - /* Create space for the null terminated character */ - dest = kmalloc((1 + length) * sizeof(u16), GFP_KERNEL); - destStart = dest; - - for (i = 0; i < sourceLength; i++) - { - extraBytes2Read = trailingBytesForUtf8[utf8String[i]]; - - if (extraBytes2Read == -1) /* Illegal byte value, instead put a Unicode 'REPLACEMENT CHARACTER' (U+FFFD) */ - { - *dest++ = UNI_REPLACEMENT_CHAR; - } - else if (i + extraBytes2Read > sourceLength) /* The extra bytes does not exist, instead put a Unicode 'REPLACEMENT - CHARACTER' (U+FFFD), and the null terminated character */ - { - *dest++ = UNI_REPLACEMENT_CHAR; - *dest++ = '\0'; - break; - } - else if (isLegalUtf8(&utf8String[i], extraBytes2Read + 1) == FALSE) /* It is not a legal utf-8 character, instead put a Unicode 'REPLACEMENT - CHARACTER' (U+FFFD) */ - { - *dest++ = UNI_REPLACEMENT_CHAR; - } - else /* It is legal, convert the character to an u32 */ - { - u32 ch = 0; - - switch (extraBytes2Read) /* Everything falls through */ - { - case 3: - { - ch += utf8String[i]; - ch <<= 6; - i++; - } - /* FALLTHROUGH */ - case 2: - { - ch += utf8String[i]; - ch <<= 6; - i++; - } - /* FALLTHROUGH */ - case 1: - { - ch += utf8String[i]; - ch <<= 6; - i++; - } - /* FALLTHROUGH */ - case 0: - { - ch += utf8String[i]; - } - /* FALLTHROUGH */ - default: - { - break; - } - } - - ch -= offsetsFromUtf8[extraBytes2Read]; - - if (ch <= 0xFFFF) /* Character can be encoded in one u16 */ - { - *dest++ = (u16) ch; - } - else /* The character needs two u16 */ - { - ch -= UNI_HALF_BASE; - *dest++ = (u16) ((ch >> UNI_HALF_SHIFT) | UNI_SUR_HIGH_START); - *dest++ = (u16) ((ch & 0x03FF) | UNI_SUR_LOW_START); - } - } - } - - destStart[length] = 0x00; - - return destStart; -} - -/******************************************************************************** -* -* Name: CsrUtf16StrCpy -* -* Description: The function copies the contents from one UTF-16 string -* to another UTF-16 string. -* -* Input: 0-terminated UTF-16 string. -* -* Output: 0-terminated UTF-16 string. -* -*********************************************************************************/ -u16 *CsrUtf16StrCpy(u16 *target, const u16 *source) -{ - if (source) /* if source is not NULL*/ - { - memcpy(target, source, (CsrUtf16StrLen(source) + 1) * sizeof(u16)); - return target; - } - else - { - return NULL; - } -} - -/******************************************************************************** -* -* Name: CsrUtf16StringDuplicate -* -* Description: The function allocates a new pointer and copies the input to -* the new pointer. -* -* Input: 0-terminated UTF-16 string. -* -* Output: Allocated variable0-terminated UTF-16 string. -* -*********************************************************************************/ -u16 *CsrUtf16StringDuplicate(const u16 *source) -{ - u16 *target = NULL; - u32 length; - - if (source) /* if source is not NULL*/ - { - length = (CsrUtf16StrLen(source) + 1) * sizeof(u16); - target = kmalloc(length, GFP_KERNEL); - memcpy(target, source, length); - } - return target; -} - -/******************************************************************************** -* -* Name: CsrUtf16StrICmp -* -* Description: The function compares two UTF-16 strings. -* -* Input: Two 0-terminated UTF-16 string. -* -* Output: 0: if the strings are identical. -* -*********************************************************************************/ -u16 CsrUtf16StrICmp(const u16 *string1, const u16 *string2) -{ - while (*string1 || *string2) - { - if (CAPITAL(*string1) != CAPITAL(*string2)) - { - return *string1 - *string2; - } - string1++; - string2++; - } - - return 0; -} - -/******************************************************************************** -* -* Name: CsrUtf16StrNICmp -* -* Description: The function compares upto count number of elements in the -* two UTF-16 string. -* -* Input: Two 0-terminated UTF-16 string and a maximum -* number of elements to check. -* -* Output: 0: if the strings are identical. -* -*********************************************************************************/ -u16 CsrUtf16StrNICmp(const u16 *string1, const u16 *string2, u32 count) -{ - while ((*string1 || *string2) && count--) - { - if (CAPITAL(*string1) != CAPITAL(*string2)) - { - return *string1 - *string2; - } - string1++; - string2++; - } - - return 0; -} - -/******************************************************************************** -* -* Name: CsrUtf16String2XML -* -* Description: The function converts an unicoded string (UTF-16) into an unicoded XML -* string where some special characters are encoded according to -* the XML spec. -* -* Input: A unicoded string (UTF-16) which is freed. -* -* Output: A new unicoded string (UTF-16) containing the converted output. -* -*********************************************************************************/ -u16 *CsrUtf16String2XML(u16 *str) -{ - u16 *scanString; - u16 *outputString = NULL; - u16 *resultString = str; - u32 stringLength = 0; - u8 encodeChars = FALSE; - - scanString = str; - if (scanString) - { - while (*scanString) - { - if (*scanString == L'&') - { - stringLength += 5; - encodeChars = TRUE; - } - else if ((*scanString == L'<') || (*scanString == L'>')) - { - stringLength += 4; - encodeChars = TRUE; - } - else - { - stringLength++; - } - - scanString++; - } - - stringLength++; - - if (encodeChars) - { - resultString = outputString = kmalloc(stringLength * sizeof(u16), GFP_KERNEL); - - scanString = str; - - while (*scanString) - { - if (*scanString == L'&') - { - *outputString++ = '&'; - *outputString++ = 'a'; - *outputString++ = 'm'; - *outputString++ = 'p'; - *outputString++ = ';'; - } - else if (*scanString == L'<') - { - *outputString++ = '&'; - *outputString++ = 'l'; - *outputString++ = 't'; - *outputString++ = ';'; - } - else if (*scanString == L'>') - { - *outputString++ = '&'; - *outputString++ = 'g'; - *outputString++ = 't'; - *outputString++ = ';'; - } - else - { - *outputString++ = *scanString; - } - - scanString++; - } - - *outputString++ = 0; - - kfree(str); - } - } - - return resultString; -} - -/******************************************************************************** -* -* Name: CsrXML2Utf16String -* -* Description: The function converts an unicoded XML string into an unicoded -* string (UTF-16) where some special XML characters are decoded according to -* the XML spec. -* -* Input: A unicoded XML string which is freed. -* -* Output: A new unicoded pointer containing the decoded output. -* -*********************************************************************************/ -u16 *CsrXML2Utf16String(u16 *str) -{ - u16 *scanString; - u16 *outputString = NULL; - u16 *resultString = str; - u32 stringLength = 0; - u8 encodeChars = FALSE; - - scanString = str; - if (scanString) - { - while (*scanString) - { - if (*scanString == (u16) L'&') - { - scanString++; - - if (!CsrUtf16StrNICmp(scanString, (u16 *) L"AMP;", 4)) - { - scanString += 3; - encodeChars = TRUE; - } - else if (!CsrUtf16StrNICmp(scanString, (u16 *) L"LT;", 3)) - { - scanString += 2; - encodeChars = TRUE; - } - else if (!CsrUtf16StrNICmp(scanString, (u16 *) L"GT;", 3)) - { - scanString += 2; - encodeChars = TRUE; - } - if (!CsrUtf16StrNICmp(scanString, (u16 *) L"APOS;", 5)) - { - scanString += 4; - encodeChars = TRUE; - } - if (!CsrUtf16StrNICmp(scanString, (u16 *) L"QUOT;", 5)) - { - scanString += 4; - encodeChars = TRUE; - } - else - { - scanString--; - } - } - - stringLength++; - scanString++; - } - - stringLength++; - - if (encodeChars) - { - resultString = outputString = kmalloc(stringLength * sizeof(u16), GFP_KERNEL); - - scanString = str; - - while (*scanString) - { - if (*scanString == L'&') - { - scanString++; - - if (!CsrUtf16StrNICmp(scanString, (u16 *) L"AMP;", 4)) - { - *outputString++ = L'&'; - scanString += 3; - } - else if (!CsrUtf16StrNICmp(scanString, (u16 *) L"LT;", 3)) - { - *outputString++ = L'<'; - scanString += 2; - } - else if (!CsrUtf16StrNICmp(scanString, (u16 *) L"GT;", 3)) - { - *outputString++ = L'>'; - scanString += 2; - } - else if (!CsrUtf16StrNICmp(scanString, (u16 *) L"APOS;", 5)) - { - *outputString++ = L'\''; - scanString += 4; - } - else if (!CsrUtf16StrNICmp(scanString, (u16 *) L"QUOT;", 5)) - { - *outputString++ = L'\"'; - scanString += 4; - } - else - { - *outputString++ = L'&'; - scanString--; - } - } - else - { - *outputString++ = *scanString; - } - - scanString++; - } - - *outputString++ = 0; - - kfree(str); - } - } - - return resultString; -} - -u32 CsrUtf8StringLengthInBytes(const u8 *string) -{ - size_t length = 0; - if (string) - { - length = strlen((const char *)string); - } - return (u32) length; -} - -u8 *CsrUtf8StrTruncate(u8 *target, size_t count) -{ - size_t lastByte = count - 1; - - target[count] = '\0'; - - if (count && (target[lastByte] & 0x80)) - { - /* the last byte contains non-ascii char */ - if (target[lastByte] & 0x40) - { - /* multi-byte char starting just before truncation */ - target[lastByte] = '\0'; - } - else if ((target[lastByte - 1] & 0xE0) == 0xE0) - { - /* 3-byte char starting 2 bytes before truncation */ - target[lastByte - 1] = '\0'; - } - else if ((target[lastByte - 2] & 0xF0) == 0xF0) - { - /* 4-byte char starting 3 bytes before truncation */ - target[lastByte - 2] = '\0'; - } - } - - return target; -} diff --git a/drivers/staging/csr/csr_wifi_msgconv.h b/drivers/staging/csr/csr_wifi_msgconv.h index 0631410..7ec35d7 100644 --- a/drivers/staging/csr/csr_wifi_msgconv.h +++ b/drivers/staging/csr/csr_wifi_msgconv.h @@ -13,7 +13,6 @@ #include "csr_prim_defs.h" #include "csr_sched.h" -#include "csr_unicode.h" #ifdef __cplusplus extern "C" { diff --git a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c index 493e33e..1a901a7 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c +++ b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c @@ -12,7 +12,6 @@ #include #include #include "csr_msgconv.h" -#include "csr_unicode.h" #ifdef CSR_WIFI_NME_ENABLE #ifdef CSR_WIFI_AP_ENABLE diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c index b9f9adb..3eda1b6 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c @@ -12,9 +12,6 @@ #include #include #include "csr_msgconv.h" -#include "csr_unicode.h" - - #include "csr_wifi_router_ctrl_prim.h" #include "csr_wifi_router_ctrl_serialize.h" diff --git a/drivers/staging/csr/csr_wifi_router_serialize.c b/drivers/staging/csr/csr_wifi_router_serialize.c index 5717ebc..4eccf5d 100644 --- a/drivers/staging/csr/csr_wifi_router_serialize.c +++ b/drivers/staging/csr/csr_wifi_router_serialize.c @@ -11,9 +11,6 @@ /* Note: this is an auto-generated file. */ #include #include "csr_msgconv.h" -#include "csr_unicode.h" - - #include "csr_wifi_router_prim.h" #include "csr_wifi_router_serialize.h" diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.c b/drivers/staging/csr/csr_wifi_sme_serialize.c index d55e3ee..7d7e1d8 100644 --- a/drivers/staging/csr/csr_wifi_sme_serialize.c +++ b/drivers/staging/csr/csr_wifi_sme_serialize.c @@ -12,9 +12,6 @@ #include #include #include "csr_msgconv.h" -#include "csr_unicode.h" - - #include "csr_wifi_sme_prim.h" #include "csr_wifi_sme_serialize.h" -- cgit v0.10.2 From 419e9266884fa853179ab726c27a63a9d3ae46e3 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 17:25:09 -0700 Subject: staging: csr: delete a bunch of unused library functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These functions were never being called, so they can be safely deleted. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/csr/csr_msgconv.c b/drivers/staging/csr/csr_msgconv.c index 69ae790..0081a25 100644 --- a/drivers/staging/csr/csr_msgconv.c +++ b/drivers/staging/csr/csr_msgconv.c @@ -290,35 +290,3 @@ CsrMsgConvEntry *CsrMsgConvInit(void) return converter; } EXPORT_SYMBOL_GPL(CsrMsgConvInit); - -CsrMsgConvEntry *CsrMsgConvGet(void) -{ - return converter; -} - -#ifdef ENABLE_SHUTDOWN -void CsrMsgConvDeinit(void) -{ - CsrMsgConvPrimEntry *s; - - if (converter == NULL) - { - return; - } - - /* Walk converter list and free elements. */ - s = converter->profile_converters; - while (s) - { - CsrMsgConvPrimEntry *s_next; - s_next = s->next; - kfree(s); - s = s_next; - } - - kfree(converter); - converter = NULL; -} -EXPORT_SYMBOL_GPL(CsrMsgConvDeinit); - -#endif /* ENABLE_SHUTDOWN */ diff --git a/drivers/staging/csr/csr_msgconv.h b/drivers/staging/csr/csr_msgconv.h index 0849709..09489f3 100644 --- a/drivers/staging/csr/csr_msgconv.h +++ b/drivers/staging/csr/csr_msgconv.h @@ -64,17 +64,7 @@ void CsrMsgConvInsert(u16 primType, const CsrMsgConvMsgEntry *ce); CsrMsgConvPrimEntry *CsrMsgConvFind(u16 primType); CsrMsgConvMsgEntry *CsrMsgConvFindEntry(u16 primType, u16 msgType); CsrMsgConvMsgEntry *CsrMsgConvFindEntryByMsg(u16 primType, const void *msg); -CsrMsgConvEntry *CsrMsgConvGet(void); CsrMsgConvEntry *CsrMsgConvInit(void); -#ifdef ENABLE_SHUTDOWN -void CsrMsgConvDeinit(void); -#endif /* ENABLE_SHUTDOWN */ - -/* SHOULD BE INTERNAL TO FRAMEWORK AKA DEPRECATED */ - -u32 CsrCharStringSerLen(const char *str); -u32 CsrUtf8StringSerLen(const u8 *str); -u32 CsrUtf16StringSerLen(const u16 *str); /* Prototypes for primitive type serializers */ void CsrUint8Ser(u8 *buffer, size_t *offset, u8 value); @@ -82,60 +72,13 @@ void CsrUint16Ser(u8 *buffer, size_t *offset, u16 value); void CsrUint32Ser(u8 *buffer, size_t *offset, u32 value); void CsrMemCpySer(u8 *buffer, size_t *offset, const void *value, size_t length); void CsrCharStringSer(u8 *buffer, size_t *offset, const char *value); -void CsrUtf8StringSer(u8 *buffer, size_t *offset, const u8 *value); -void CsrUtf16StringSer(u8 *buffer, size_t *offset, const u16 *value); -void CsrVoidPtrSer(u8 *buffer, size_t *offset, void *ptr); -void CsrSizeSer(u8 *buffer, size_t *offset, size_t value); void CsrUint8Des(u8 *value, u8 *buffer, size_t *offset); void CsrUint16Des(u16 *value, u8 *buffer, size_t *offset); void CsrUint32Des(u32 *value, u8 *buffer, size_t *offset); void CsrMemCpyDes(void *value, u8 *buffer, size_t *offset, size_t length); void CsrCharStringDes(char **value, u8 *buffer, size_t *offset); -void CsrUtf8StringDes(u8 **value, u8 *buffer, size_t *offset); -void CsrUtf16StringDes(u16 **value, u8 *buffer, size_t *offset); -void CsrVoidPtrDes(void **value, u8 *buffer, size_t *offset); -void CsrSizeDes(size_t *value, u8 *buffer, size_t *offset); - -size_t CsrEventSizeof(void *msg); -u8 *CsrEventSer(u8 *ptr, size_t *len, void *msg); -void *CsrEventDes(u8 *buffer, size_t length); - -size_t CsrEventCsrUint8Sizeof(void *msg); -u8 *CsrEventCsrUint8Ser(u8 *ptr, size_t *len, void *msg); -void *CsrEventCsrUint8Des(u8 *buffer, size_t length); - -size_t CsrEventCsrUint16Sizeof(void *msg); -u8 *CsrEventCsrUint16Ser(u8 *ptr, size_t *len, void *msg); -void *CsrEventCsrUint16Des(u8 *buffer, size_t length); - -size_t CsrEventCsrUint32Sizeof(void *msg); -u8 *CsrEventCsrUint32Ser(u8 *ptr, size_t *len, void *msg); -void *CsrEventCsrUint32Des(u8 *buffer, size_t length); - -size_t CsrEventCsrUint16CsrUint8Sizeof(void *msg); -u8 *CsrEventCsrUint16CsrUint8Ser(u8 *ptr, size_t *len, void *msg); -void *CsrEventCsrUint16CsrUint8Des(u8 *buffer, size_t length); - -size_t CsrEventCsrUint16CsrUint16Sizeof(void *msg); -u8 *CsrEventCsrUint16CsrUint16Ser(u8 *ptr, size_t *len, void *msg); -void *CsrEventCsrUint16CsrUint16Des(u8 *buffer, size_t length); - -size_t CsrEventCsrUint16CsrUint32Sizeof(void *msg); -u8 *CsrEventCsrUint16CsrUint32Ser(u8 *ptr, size_t *len, void *msg); -void *CsrEventCsrUint16CsrUint32Des(u8 *buffer, size_t length); - -size_t CsrEventCsrUint16CsrCharStringSizeof(void *msg); -u8 *CsrEventCsrUint16CsrCharStringSer(u8 *ptr, size_t *len, void *msg); -void *CsrEventCsrUint16CsrCharStringDes(u8 *buffer, size_t length); - -size_t CsrEventCsrUint32CsrUint16Sizeof(void *msg); -u8 *CsrEventCsrUint32CsrUint16Ser(u8 *ptr, size_t *len, void *msg); -void *CsrEventCsrUint32CsrUint16Des(u8 *buffer, size_t length); - -size_t CsrEventCsrUint32CsrCharStringSizeof(void *msg); -u8 *CsrEventCsrUint32CsrCharStringSer(u8 *ptr, size_t *len, void *msg); -void *CsrEventCsrUint32CsrCharStringDes(u8 *buffer, size_t length); + #ifdef __cplusplus } diff --git a/drivers/staging/csr/csr_serialize_primitive_types.c b/drivers/staging/csr/csr_serialize_primitive_types.c index a6f29ea..bf5e4ab 100644 --- a/drivers/staging/csr/csr_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_serialize_primitive_types.c @@ -15,34 +15,6 @@ #include "csr_macro.h" #include "csr_lib.h" -/******************************************************************************** -* -* Name: CsrUtf16StrLen -* -* Description: The function returns the number of 16 bit elements present -* in the 0-terminated string. -* -* Input: 0-terminated string of 16 bit unicoded characters. -* -* Output: The number of 16 bit elements in the string. -* -*********************************************************************************/ -static u32 CsrUtf16StrLen(const u16 *unicodeString) -{ - u32 length; - - length = 0; - if (unicodeString != NULL) - { - while (*unicodeString) - { - length++; - unicodeString++; - } - } - return length; -} - void CsrUint8Des(u8 *value, u8 *buffer, size_t *offset) { *value = buffer[*offset]; @@ -82,39 +54,6 @@ void CsrCharStringDes(char **value, u8 *buffer, size_t *offset) } EXPORT_SYMBOL_GPL(CsrCharStringDes); -void CsrUtf8StringDes(u8 **value, u8 *buffer, size_t *offset) -{ - *value = (u8 *)kstrdup((char *) &buffer[*offset], GFP_KERNEL); - *offset += strlen((char *) *value) + 1; -} - -void CsrUtf16StringDes(u16 **value, u8 *buffer, size_t *offset) -{ - u32 length, i; - - CsrUint32Des(&length, buffer, offset); - - *value = kmalloc(length * sizeof(**value), GFP_KERNEL); - for (i = 0; i < length; i++) - { - CsrUint16Des(&(*value)[i], buffer, offset); - } -} - -void CsrSizeDes(size_t *value, u8 *buffer, size_t *offset) -{ - *value = (buffer[*offset + 0] << 0) | - (buffer[*offset + 1] << 8) | - (buffer[*offset + 2] << 16) | - (buffer[*offset + 3] << 24); - *offset += sizeof(*value); -} - -void CsrVoidPtrDes(void **value, u8 *buffer, size_t *offset) -{ - CsrSizeDes((size_t *) value, buffer, offset); -} - void CsrUint8Ser(u8 *buffer, size_t *offset, u8 value) { buffer[*offset] = value; @@ -160,340 +99,3 @@ void CsrCharStringSer(u8 *buffer, size_t *offset, const char *value) } } EXPORT_SYMBOL_GPL(CsrCharStringSer); - -void CsrUtf8StringSer(u8 *buffer, size_t *offset, const u8 *value) -{ - CsrCharStringSer(buffer, offset, (char *) value); -} - -void CsrUtf16StringSer(u8 *buffer, size_t *offset, const u16 *value) -{ - if (value) - { - u32 length = CsrUtf16StrLen(value) + 1; - u32 i; - - CsrUint32Ser(buffer, offset, length); - - for (i = 0; i < length; i++) - { - CsrUint16Ser(buffer, offset, (u16) value[i]); - } - } - else - { - CsrUint32Ser(buffer, offset, 0); - } -} - -void CsrSizeSer(u8 *buffer, size_t *offset, size_t value) -{ - buffer[*offset + 0] = (u8) ((value >> 0) & 0xFF); - buffer[*offset + 1] = (u8) ((value >> 8) & 0xFF); - buffer[*offset + 2] = (u8) ((value >> 16) & 0xFF); - buffer[*offset + 3] = (u8) ((value >> 24) & 0xFF); - *offset += sizeof(value); -} - -void CsrVoidPtrSer(u8 *buffer, size_t *offset, void *ptr) -{ - CsrSizeSer(buffer, offset, (size_t) ptr); -} - -u32 CsrCharStringSerLen(const char *str) -{ - if (str) - { - return (u32)(strlen(str) + sizeof(*str)); - } - else - { - return sizeof(*str); - } -} - -u32 CsrUtf8StringSerLen(const u8 *str) -{ - if (str) - { - return (u32)(strlen((char *) str) + sizeof(*str)); - } - else - { - return sizeof(*str); - } -} - -u32 CsrUtf16StringSerLen(const u16 *str) -{ - if (str) - { - /* We always write down the length of the string */ - return sizeof(u32) + (CsrUtf16StrLen(str) + 1) * sizeof(*str); - } - else - { - return sizeof(u32); - } -} - -size_t CsrEventSizeof(void *msg) -{ - return 2; -} - -u8 *CsrEventSer(u8 *ptr, size_t *len, void *msg) -{ - CsrEvent *primitive = (CsrEvent *) msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->type); - return ptr; -} - -void *CsrEventDes(u8 *buffer, size_t length) -{ - CsrEvent *primitive = kmalloc(sizeof(CsrEvent), GFP_KERNEL); - size_t offset = 0; - CsrUint16Des(&primitive->type, buffer, &offset); - - return primitive; -} - -size_t CsrEventCsrUint8Sizeof(void *msg) -{ - return 3; -} - -u8 *CsrEventCsrUint8Ser(u8 *ptr, size_t *len, void *msg) -{ - CsrEventCsrUint8 *primitive = (CsrEventCsrUint8 *) msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->type); - CsrUint8Ser(ptr, len, primitive->value); - return ptr; -} - -void *CsrEventCsrUint8Des(u8 *buffer, size_t length) -{ - CsrEventCsrUint8 *primitive = kmalloc(sizeof(CsrEventCsrUint8), GFP_KERNEL); - - size_t offset = 0; - CsrUint16Des(&primitive->type, buffer, &offset); - CsrUint8Des(&primitive->value, buffer, &offset); - - return primitive; -} - -size_t CsrEventCsrUint16Sizeof(void *msg) -{ - return 4; -} - -u8 *CsrEventCsrUint16Ser(u8 *ptr, size_t *len, void *msg) -{ - CsrEventCsrUint16 *primitive = (CsrEventCsrUint16 *) msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->type); - CsrUint16Ser(ptr, len, primitive->value); - return ptr; -} - -void *CsrEventCsrUint16Des(u8 *buffer, size_t length) -{ - CsrEventCsrUint16 *primitive = kmalloc(sizeof(CsrEventCsrUint16), GFP_KERNEL); - - size_t offset = 0; - CsrUint16Des(&primitive->type, buffer, &offset); - CsrUint16Des(&primitive->value, buffer, &offset); - - return primitive; -} - -size_t CsrEventCsrUint32Sizeof(void *msg) -{ - return 6; -} - -u8 *CsrEventCsrUint32Ser(u8 *ptr, size_t *len, void *msg) -{ - CsrEventCsrUint32 *primitive = (CsrEventCsrUint32 *) msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->type); - CsrUint32Ser(ptr, len, primitive->value); - return ptr; -} - -void *CsrEventCsrUint32Des(u8 *buffer, size_t length) -{ - CsrEventCsrUint32 *primitive = kmalloc(sizeof(CsrEventCsrUint32), GFP_KERNEL); - - size_t offset = 0; - CsrUint16Des(&primitive->type, buffer, &offset); - CsrUint32Des(&primitive->value, buffer, &offset); - - return primitive; -} - -size_t CsrEventCsrUint16CsrUint8Sizeof(void *msg) -{ - return 5; -} - -u8 *CsrEventCsrUint16CsrUint8Ser(u8 *ptr, size_t *len, void *msg) -{ - CsrEventCsrUint16CsrUint8 *primitive = (CsrEventCsrUint16CsrUint8 *) msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->type); - CsrUint16Ser(ptr, len, primitive->value1); - CsrUint8Ser(ptr, len, primitive->value2); - return ptr; -} - -void *CsrEventCsrUint16CsrUint8Des(u8 *buffer, size_t length) -{ - CsrEventCsrUint16CsrUint8 *primitive = kmalloc(sizeof(CsrEventCsrUint16CsrUint8), GFP_KERNEL); - - size_t offset = 0; - CsrUint16Des(&primitive->type, buffer, &offset); - CsrUint16Des(&primitive->value1, buffer, &offset); - CsrUint8Des(&primitive->value2, buffer, &offset); - - return primitive; -} - -size_t CsrEventCsrUint16CsrUint16Sizeof(void *msg) -{ - return 6; -} - -u8 *CsrEventCsrUint16CsrUint16Ser(u8 *ptr, size_t *len, void *msg) -{ - CsrEventCsrUint16CsrUint16 *primitive = (CsrEventCsrUint16CsrUint16 *) msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->type); - CsrUint16Ser(ptr, len, primitive->value1); - CsrUint16Ser(ptr, len, primitive->value2); - return ptr; -} - -void *CsrEventCsrUint16CsrUint16Des(u8 *buffer, size_t length) -{ - CsrEventCsrUint16CsrUint16 *primitive = kmalloc(sizeof(CsrEventCsrUint16CsrUint16), GFP_KERNEL); - - size_t offset = 0; - CsrUint16Des(&primitive->type, buffer, &offset); - CsrUint16Des(&primitive->value1, buffer, &offset); - CsrUint16Des(&primitive->value2, buffer, &offset); - - return primitive; -} - -size_t CsrEventCsrUint16CsrUint32Sizeof(void *msg) -{ - return 8; -} - -u8 *CsrEventCsrUint16CsrUint32Ser(u8 *ptr, size_t *len, void *msg) -{ - CsrEventCsrUint16CsrUint32 *primitive = (CsrEventCsrUint16CsrUint32 *) msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->type); - CsrUint16Ser(ptr, len, primitive->value1); - CsrUint32Ser(ptr, len, primitive->value2); - return ptr; -} - -void *CsrEventCsrUint16CsrUint32Des(u8 *buffer, size_t length) -{ - CsrEventCsrUint16CsrUint32 *primitive = kmalloc(sizeof(CsrEventCsrUint16CsrUint32), GFP_KERNEL); - - size_t offset = 0; - CsrUint16Des(&primitive->type, buffer, &offset); - CsrUint16Des(&primitive->value1, buffer, &offset); - CsrUint32Des(&primitive->value2, buffer, &offset); - - return primitive; -} - -size_t CsrEventCsrUint16CsrCharStringSizeof(void *msg) -{ - CsrEventCsrUint16CsrCharString *primitive = (CsrEventCsrUint16CsrCharString *) msg; - return 4 + strlen(primitive->value2) + 1; -} - -u8 *CsrEventCsrUint16CsrCharStringSer(u8 *ptr, size_t *len, void *msg) -{ - CsrEventCsrUint16CsrCharString *primitive = (CsrEventCsrUint16CsrCharString *) msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->type); - CsrUint16Ser(ptr, len, primitive->value1); - CsrCharStringSer(ptr, len, primitive->value2); - return ptr; -} - -void *CsrEventCsrUint16CsrCharStringDes(u8 *buffer, size_t length) -{ - CsrEventCsrUint16CsrCharString *primitive = kmalloc(sizeof(CsrEventCsrUint16CsrCharString), GFP_KERNEL); - - size_t offset = 0; - CsrUint16Des(&primitive->type, buffer, &offset); - CsrUint16Des(&primitive->value1, buffer, &offset); - CsrCharStringDes(&primitive->value2, buffer, &offset); - - return primitive; -} - -size_t CsrEventCsrUint32CsrUint16Sizeof(void *msg) -{ - return 8; -} - -u8 *CsrEventCsrUint32CsrUint16Ser(u8 *ptr, size_t *len, void *msg) -{ - CsrEventCsrUint32CsrUint16 *primitive = (CsrEventCsrUint32CsrUint16 *) msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->type); - CsrUint32Ser(ptr, len, primitive->value1); - CsrUint16Ser(ptr, len, primitive->value2); - return ptr; -} - -void *CsrEventCsrUint32CsrUint16Des(u8 *buffer, size_t length) -{ - CsrEventCsrUint32CsrUint16 *primitive = kmalloc(sizeof(CsrEventCsrUint32CsrUint16), GFP_KERNEL); - - size_t offset = 0; - CsrUint16Des(&primitive->type, buffer, &offset); - CsrUint32Des(&primitive->value1, buffer, &offset); - CsrUint16Des(&primitive->value2, buffer, &offset); - - return primitive; -} - -size_t CsrEventCsrUint32CsrCharStringSizeof(void *msg) -{ - CsrEventCsrUint32CsrCharString *primitive = (CsrEventCsrUint32CsrCharString *) msg; - return 6 + strlen(primitive->value2) + 1; -} - -u8 *CsrEventCsrUint32CsrCharStringSer(u8 *ptr, size_t *len, void *msg) -{ - CsrEventCsrUint32CsrCharString *primitive = (CsrEventCsrUint32CsrCharString *) msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->type); - CsrUint32Ser(ptr, len, primitive->value1); - CsrCharStringSer(ptr, len, primitive->value2); - return ptr; -} - -void *CsrEventCsrUint32CsrCharStringDes(u8 *buffer, size_t length) -{ - CsrEventCsrUint32CsrCharString *primitive = kmalloc(sizeof(CsrEventCsrUint32CsrCharString), GFP_KERNEL); - - size_t offset = 0; - CsrUint16Des(&primitive->type, buffer, &offset); - CsrUint32Des(&primitive->value1, buffer, &offset); - CsrCharStringDes(&primitive->value2, buffer, &offset); - - return primitive; -} diff --git a/drivers/staging/csr/csr_time.c b/drivers/staging/csr/csr_time.c index 4d83674..83586ca 100644 --- a/drivers/staging/csr/csr_time.c +++ b/drivers/staging/csr/csr_time.c @@ -41,30 +41,3 @@ CsrTime CsrTimeGet(CsrTime *high) return low; } EXPORT_SYMBOL_GPL(CsrTimeGet); - -void CsrTimeUtcGet(CsrTimeUtc *tod, CsrTime *low, CsrTime *high) -{ - struct timespec ts; - u64 time; - - ts = current_kernel_time(); - time = (u64) ts.tv_sec * 1000000 + ts.tv_nsec / 1000; - - if (high != NULL) - { - *high = (CsrTime) ((time >> 32) & 0xFFFFFFFF); - } - - if (low != NULL) - { - *low = (CsrTime) (time & 0xFFFFFFFF); - } - - if (tod != NULL) - { - struct timeval tv; - do_gettimeofday(&tv); - tod->sec = tv.tv_sec; - tod->msec = tv.tv_usec / 1000; - } -} diff --git a/drivers/staging/csr/csr_time.h b/drivers/staging/csr/csr_time.h index 09eeeee..2a45f3e 100644 --- a/drivers/staging/csr/csr_time.h +++ b/drivers/staging/csr/csr_time.h @@ -75,32 +75,6 @@ typedef struct CsrTime CsrTimeGet(CsrTime *high); -/******************************************************************************* - - NAME - CsrTimeUtcGet - - DESCRIPTION - Get the current system wallclock time, and optionally the current system - time in a low and a high part as would have been returned by - CsrTimeGet. - - Although CsrTimeUtc is expressed in seconds and milliseconds, the actual - resolution is platform dependent, and can be less. It is recommended - that the resolution is at least 1 second. - - PARAMETERS - tod - Pointer to variable that will receive the current system - wallclock time. - low - The low part of the current system time in microseconds. Passing - NULL is valid. - high - The high part of the current system time in microseconds. Passing - NULL is valid. - -*******************************************************************************/ -void CsrTimeUtcGet(CsrTimeUtc *tod, CsrTime *low, CsrTime *high); - - /*------------------------------------------------------------------*/ /* CsrTime Macros */ /*------------------------------------------------------------------*/ @@ -133,71 +107,6 @@ void CsrTimeUtcGet(CsrTimeUtc *tod, CsrTime *low, CsrTime *high); *----------------------------------------------------------------------------*/ #define CsrTimeSub(t1, t2) ((s32) (t1) - (s32) (t2)) -/*----------------------------------------------------------------------------* - * NAME - * CsrTimeEq - * - * DESCRIPTION - * Compare two time values. - * - * RETURNS - * !0 if "t1" equal "t2", else 0. - * - *----------------------------------------------------------------------------*/ -#define CsrTimeEq(t1, t2) ((t1) == (t2)) - -/*----------------------------------------------------------------------------* - * NAME - * CsrTimeGt - * - * DESCRIPTION - * Compare two time values. - * - * RETURNS - * !0 if "t1" is greater than "t2", else 0. - * - *----------------------------------------------------------------------------*/ -#define CsrTimeGt(t1, t2) (CsrTimeSub((t1), (t2)) > 0) - -/*----------------------------------------------------------------------------* - * NAME - * CsrTimeGe - * - * DESCRIPTION - * Compare two time values. - * - * RETURNS - * !0 if "t1" is greater than, or equal to "t2", else 0. - * - *----------------------------------------------------------------------------*/ -#define CsrTimeGe(t1, t2) (CsrTimeSub((t1), (t2)) >= 0) - -/*----------------------------------------------------------------------------* - * NAME - * CsrTimeLt - * - * DESCRIPTION - * Compare two time values. - * - * RETURNS - * !0 if "t1" is less than "t2", else 0. - * - *----------------------------------------------------------------------------*/ -#define CsrTimeLt(t1, t2) (CsrTimeSub((t1), (t2)) < 0) - -/*----------------------------------------------------------------------------* - * NAME - * CsrTimeLe - * - * DESCRIPTION - * Compare two time values. - * - * RETURNS - * !0 if "t1" is less than, or equal to "t2", else 0. - * - *----------------------------------------------------------------------------*/ -#define CsrTimeLe(t1, t2) (CsrTimeSub((t1), (t2)) <= 0) - #ifdef __cplusplus } #endif diff --git a/drivers/staging/csr/csr_wifi_router_transport.c b/drivers/staging/csr/csr_wifi_router_transport.c index 4bff435..e905ead 100644 --- a/drivers/staging/csr/csr_wifi_router_transport.c +++ b/drivers/staging/csr/csr_wifi_router_transport.c @@ -50,16 +50,6 @@ void CsrWifiRouterTransportInit(unifi_priv_t *priv) #endif } -void CsrWifiRouterTransportDeinit(unifi_priv_t *priv) -{ - unifi_trace(priv, UDBG1, "CsrWifiRouterTransportDeinit: \n"); - if (priv == drvpriv) - { - CsrMsgConvDeinit(); - drvpriv = NULL; - } -} - void CsrWifiRouterTransportRecv(unifi_priv_t *priv, u8* buffer, size_t bufferLength) { CsrMsgConvMsgEntry* msgEntry; -- cgit v0.10.2